From: Andrea Amorese Date: Fri, 4 Feb 2022 10:55:51 +0000 (+0100) Subject: Built motion from commit 74a1f83a.|2.5.49 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=880a9e8c01af8a817a5aa8186362273b289f9399;p=motion2.git Built motion from commit 74a1f83a.|2.5.49 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4d2aeeb..2c85175 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-04T10:26:31.743Z", + "time": "2022-02-04T10:43:16.175Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ea5dc43..d5c05ae 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-02-04T10:26:31.743Z", + "time": "2022-02-04T10:43:16.175Z", "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 0d57de9..ea92274 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 _0xcdcb=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','motionbar'];(function(_0x3f652c,_0x38409f){var _0x13240d=function(_0x23992e){while(--_0x23992e){_0x3f652c['push'](_0x3f652c['shift']());}};_0x13240d(++_0x38409f);}(_0xcdcb,0xfd));var _0xbcdc=function(_0x19ff17,_0x5ab238){_0x19ff17=_0x19ff17-0x0;var _0x9d945b=_0xcdcb[_0x19ff17];return _0x9d945b;};'use strict';var Sequelize=require(_0xbcdc('0x0'));module[_0xbcdc('0x1')]={'name':{'type':Sequelize[_0xbcdc('0x2')],'get':function(_0x2b4a3e){return this['getDataValue'](_0xbcdc('0x3'));}},'action':{'type':Sequelize[_0xbcdc('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbcdc('0x5'),'integration',_0xbcdc('0x6'),_0xbcdc('0x7'),_0xbcdc('0x8'),_0xbcdc('0x9'),_0xbcdc('0xa'),_0xbcdc('0xb')]],'msg':_0xbcdc('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xbcdc('0x4')](0x1000),'comment':_0xbcdc('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xbcdc('0x4')](0x1000),'comment':_0xbcdc('0xe')},'data4':{'type':Sequelize[_0xbcdc('0x4')](0x1000),'comments':_0xbcdc('0xf')},'data5':{'type':Sequelize[_0xbcdc('0x4')](0x1000),'comments':_0xbcdc('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0xbcdc('0x11')},'data7':{'type':Sequelize[_0xbcdc('0x12')],'comments':_0xbcdc('0x13')}}; \ No newline at end of file +var _0x3aed=['sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','TEXT','urlForward[body]'];(function(_0x56d49b,_0x482208){var _0x14edc7=function(_0x48ba38){while(--_0x48ba38){_0x56d49b['push'](_0x56d49b['shift']());}};_0x14edc7(++_0x482208);}(_0x3aed,0x1ce));var _0xd3ae=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x3aed[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xd3ae('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3ae('0x1')],'get':function(_0x7f276d){return this[_0xd3ae('0x2')](_0xd3ae('0x3'));}},'action':{'type':Sequelize[_0xd3ae('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd3ae('0x5'),'integration',_0xd3ae('0x6'),_0xd3ae('0x7'),_0xd3ae('0x8'),_0xd3ae('0x9'),_0xd3ae('0xa'),'script']],'msg':_0xd3ae('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xd3ae('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xd3ae('0x4')](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[_0xd3ae('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xd3ae('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xd3ae('0xc')],'comments':_0xd3ae('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4c73891..4adea3a 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 _0x0bf9=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','eml-format','rimraf','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined'];(function(_0x538acc,_0x47e62){var _0x3b985a=function(_0x52b459){while(--_0x52b459){_0x538acc['push'](_0x538acc['shift']());}};_0x3b985a(++_0x47e62);}(_0x0bf9,0x14d));var _0x90bf=function(_0x413667,_0x91c663){_0x413667=_0x413667-0x0;var _0x3d6232=_0x0bf9[_0x413667];return _0x3d6232;};'use strict';var emlformat=require(_0x90bf('0x0'));var rimraf=require(_0x90bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90bf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90bf('0x3'));var util=require('util');var path=require(_0x90bf('0x4'));var sox=require('sox');var csv=require(_0x90bf('0x5'));var ejs=require(_0x90bf('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90bf('0x7'));var squel=require(_0x90bf('0x8'));var crypto=require(_0x90bf('0x9'));var jsforce=require(_0x90bf('0xa'));var deskjs=require(_0x90bf('0xb'));var toCsv=require(_0x90bf('0x5'));var querystring=require('querystring');var Papa=require(_0x90bf('0xc'));var Redis=require(_0x90bf('0xd'));var authService=require(_0x90bf('0xe'));var qs=require(_0x90bf('0xf'));var as=require(_0x90bf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90bf('0x11'))(_0x90bf('0x12'));var utils=require(_0x90bf('0x13'));var config=require(_0x90bf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x90bf('0x15'))['db'];function respondWithStatusCode(_0x9d99ca,_0x505f08){_0x505f08=_0x505f08||0xcc;return function(_0x2930f2){if(_0x2930f2){return _0x9d99ca[_0x90bf('0x16')](_0x505f08);}return _0x9d99ca['status'](_0x505f08)['end']();};}function respondWithResult(_0x46d0ed,_0x320860){_0x320860=_0x320860||0xc8;return function(_0x401c11){if(_0x401c11){return _0x46d0ed[_0x90bf('0x17')](_0x320860)['json'](_0x401c11);}};}function respondWithFilteredResult(_0x448f69,_0x332bd4){return function(_0x456bda){if(_0x456bda){var _0xe16359=typeof _0x332bd4[_0x90bf('0x18')]==='undefined'&&typeof _0x332bd4[_0x90bf('0x19')]===_0x90bf('0x1a');var _0x494f3b=_0x456bda[_0x90bf('0x1b')];var _0x154615=_0xe16359?0x0:_0x332bd4[_0x90bf('0x18')];var _0x41cd49=_0xe16359?_0x456bda[_0x90bf('0x1b')]:_0x332bd4[_0x90bf('0x18')]+_0x332bd4[_0x90bf('0x19')];var _0x44adc1;if(_0x41cd49>=_0x494f3b){_0x41cd49=_0x494f3b;_0x44adc1=0xc8;}else{_0x44adc1=0xce;}_0x448f69['status'](_0x44adc1);return _0x448f69[_0x90bf('0x1c')](_0x90bf('0x1d'),_0x154615+'-'+_0x41cd49+'/'+_0x494f3b)[_0x90bf('0x1e')](_0x456bda);}return null;};}function patchUpdates(_0x37bf1e){return function(_0x22a9ba){try{jsonpatch[_0x90bf('0x1f')](_0x22a9ba,_0x37bf1e,!![]);}catch(_0x1a4cf5){return BPromise[_0x90bf('0x20')](_0x1a4cf5);}return _0x22a9ba[_0x90bf('0x21')]();};}function saveUpdates(_0x89bdb6,_0x5ae81d){return function(_0x4990a3){if(_0x4990a3){return _0x4990a3[_0x90bf('0x22')](_0x89bdb6)[_0x90bf('0x23')](function(_0x289da1){return _0x289da1;});}return null;};}function removeEntity(_0x29e8d0,_0x1347a3){return function(_0x2d89ea){if(_0x2d89ea){return _0x2d89ea[_0x90bf('0x24')]()['then'](function(){_0x29e8d0[_0x90bf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11ac82,_0x5bcc37){return function(_0x26ae22){if(!_0x26ae22){_0x11ac82['sendStatus'](0x194);}return _0x26ae22;};}function handleError(_0x27d2ff,_0x48c883){_0x48c883=_0x48c883||0x1f4;return function(_0x2d98db){logger[_0x90bf('0x25')](_0x2d98db[_0x90bf('0x26')]);if(_0x2d98db[_0x90bf('0x27')]){delete _0x2d98db['name'];}_0x27d2ff[_0x90bf('0x17')](_0x48c883)['send'](_0x2d98db);};}exports[_0x90bf('0x22')]=function(_0x26d21c,_0x491eab){if(_0x26d21c[_0x90bf('0x28')]['id']){delete _0x26d21c[_0x90bf('0x28')]['id'];}return db[_0x90bf('0x29')][_0x90bf('0x2a')]({'where':{'id':_0x26d21c[_0x90bf('0x2b')]['id']}})[_0x90bf('0x23')](handleEntityNotFound(_0x491eab,null))[_0x90bf('0x23')](saveUpdates(_0x26d21c[_0x90bf('0x28')],null))[_0x90bf('0x23')](respondWithResult(_0x491eab,null))[_0x90bf('0x2c')](handleError(_0x491eab,null));};exports[_0x90bf('0x24')]=function(_0x1d9dc4,_0x94a130){return db[_0x90bf('0x29')][_0x90bf('0x2a')]({'where':{'id':_0x1d9dc4[_0x90bf('0x2b')]['id']}})[_0x90bf('0x23')](handleEntityNotFound(_0x94a130,null))[_0x90bf('0x23')](removeEntity(_0x94a130,null))['catch'](handleError(_0x94a130,null));}; \ No newline at end of file +var _0x2484=['Content-Range','apply','save','update','error','stack','name','body','Action','find','then','catch','destroy','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x25d597,_0x3de0e8){var _0x2fee8a=function(_0x2e8252){while(--_0x2e8252){_0x25d597['push'](_0x25d597['shift']());}};_0x2fee8a(++_0x3de0e8);}(_0x2484,0x149));var _0x4248=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x2484[_0x368e09];return _0x14b7df;};'use strict';var emlformat=require(_0x4248('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4248('0x1'));var jsonpatch=require(_0x4248('0x2'));var rp=require('request-promise');var moment=require(_0x4248('0x3'));var BPromise=require(_0x4248('0x4'));var Mustache=require(_0x4248('0x5'));var util=require(_0x4248('0x6'));var path=require(_0x4248('0x7'));var sox=require(_0x4248('0x8'));var csv=require(_0x4248('0x9'));var ejs=require(_0x4248('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4248('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4248('0xc'));var toCsv=require(_0x4248('0x9'));var querystring=require('querystring');var Papa=require(_0x4248('0xd'));var Redis=require(_0x4248('0xe'));var authService=require(_0x4248('0xf'));var qs=require(_0x4248('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x11'));var logger=require(_0x4248('0x12'))(_0x4248('0x13'));var utils=require('../../config/utils');var config=require(_0x4248('0x14'));var licenseUtil=require(_0x4248('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dadf1,_0x5a4c70){_0x5a4c70=_0x5a4c70||0xcc;return function(_0x49d268){if(_0x49d268){return _0x1dadf1[_0x4248('0x16')](_0x5a4c70);}return _0x1dadf1[_0x4248('0x17')](_0x5a4c70)[_0x4248('0x18')]();};}function respondWithResult(_0x56825e,_0x4df048){_0x4df048=_0x4df048||0xc8;return function(_0x4dad27){if(_0x4dad27){return _0x56825e[_0x4248('0x17')](_0x4df048)[_0x4248('0x19')](_0x4dad27);}};}function respondWithFilteredResult(_0x5607fa,_0x118c13){return function(_0x7ffb0d){if(_0x7ffb0d){var _0x5170f7=typeof _0x118c13[_0x4248('0x1a')]===_0x4248('0x1b')&&typeof _0x118c13[_0x4248('0x1c')]===_0x4248('0x1b');var _0x18e293=_0x7ffb0d[_0x4248('0x1d')];var _0x5968e4=_0x5170f7?0x0:_0x118c13[_0x4248('0x1a')];var _0x4a043f=_0x5170f7?_0x7ffb0d[_0x4248('0x1d')]:_0x118c13['offset']+_0x118c13[_0x4248('0x1c')];var _0x14356e;if(_0x4a043f>=_0x18e293){_0x4a043f=_0x18e293;_0x14356e=0xc8;}else{_0x14356e=0xce;}_0x5607fa[_0x4248('0x17')](_0x14356e);return _0x5607fa[_0x4248('0x1e')](_0x4248('0x1f'),_0x5968e4+'-'+_0x4a043f+'/'+_0x18e293)['json'](_0x7ffb0d);}return null;};}function patchUpdates(_0x2498fc){return function(_0xbdd7e9){try{jsonpatch[_0x4248('0x20')](_0xbdd7e9,_0x2498fc,!![]);}catch(_0x247861){return BPromise['reject'](_0x247861);}return _0xbdd7e9[_0x4248('0x21')]();};}function saveUpdates(_0x35ecee,_0x1feadf){return function(_0x5d04cd){if(_0x5d04cd){return _0x5d04cd[_0x4248('0x22')](_0x35ecee)['then'](function(_0x1e29b3){return _0x1e29b3;});}return null;};}function removeEntity(_0xb44431,_0x3c1b0c){return function(_0x40cf53){if(_0x40cf53){return _0x40cf53['destroy']()['then'](function(){_0xb44431[_0x4248('0x17')](0xcc)[_0x4248('0x18')]();});}};}function handleEntityNotFound(_0x186b98,_0x136a75){return function(_0x2d8080){if(!_0x2d8080){_0x186b98[_0x4248('0x16')](0x194);}return _0x2d8080;};}function handleError(_0x39cb8d,_0x25f826){_0x25f826=_0x25f826||0x1f4;return function(_0x310b0f){logger[_0x4248('0x23')](_0x310b0f[_0x4248('0x24')]);if(_0x310b0f[_0x4248('0x25')]){delete _0x310b0f[_0x4248('0x25')];}_0x39cb8d[_0x4248('0x17')](_0x25f826)['send'](_0x310b0f);};}exports[_0x4248('0x22')]=function(_0x54b9d4,_0x2a7b30){if(_0x54b9d4[_0x4248('0x26')]['id']){delete _0x54b9d4['body']['id'];}return db[_0x4248('0x27')][_0x4248('0x28')]({'where':{'id':_0x54b9d4['params']['id']}})[_0x4248('0x29')](handleEntityNotFound(_0x2a7b30,null))[_0x4248('0x29')](saveUpdates(_0x54b9d4[_0x4248('0x26')],null))['then'](respondWithResult(_0x2a7b30,null))[_0x4248('0x2a')](handleError(_0x2a7b30,null));};exports[_0x4248('0x2b')]=function(_0x5e8b61,_0xb8eb21){return db['Action'][_0x4248('0x28')]({'where':{'id':_0x5e8b61[_0x4248('0x2c')]['id']}})[_0x4248('0x29')](handleEntityNotFound(_0xb8eb21,null))[_0x4248('0x29')](removeEntity(_0xb8eb21,null))[_0x4248('0x2a')](handleError(_0xb8eb21,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9d16bbe..81934d1 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 _0x8ef1=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','Action','tools_actions'];(function(_0x1cf706,_0x4a3bf9){var _0x1daa93=function(_0x2017ae){while(--_0x2017ae){_0x1cf706['push'](_0x1cf706['shift']());}};_0x1daa93(++_0x4a3bf9);}(_0x8ef1,0x190));var _0x18ef=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8ef1[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x18ef('0x0'));var util=require(_0x18ef('0x1'));var logger=require(_0x18ef('0x2'))('api');var moment=require(_0x18ef('0x3'));var BPromise=require(_0x18ef('0x4'));var rp=require(_0x18ef('0x5'));var fs=require('fs');var path=require(_0x18ef('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x18ef('0x7')]=function(_0x20962a,_0xe42805){return _0x20962a['define'](_0x18ef('0x8'),attributes,{'tableName':_0x18ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x365c=['tools_actions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x365c,0x1d5));var _0xc365=function(_0x497844,_0x40738d){_0x497844=_0x497844-0x0;var _0x20c1ca=_0x365c[_0x497844];return _0x20c1ca;};'use strict';var _=require(_0xc365('0x0'));var util=require('util');var logger=require(_0xc365('0x1'))(_0xc365('0x2'));var moment=require(_0xc365('0x3'));var BPromise=require('bluebird');var rp=require(_0xc365('0x4'));var fs=require('fs');var path=require(_0xc365('0x5'));var rimraf=require(_0xc365('0x6'));var config=require(_0xc365('0x7'));var attributes=require(_0xc365('0x8'));module[_0xc365('0x9')]=function(_0x95567b,_0x32b728){return _0x95567b[_0xc365('0xa')](_0xc365('0xb'),attributes,{'tableName':_0xc365('0xc'),'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 269ef82..8f9043e 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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x53ec,0x192));var _0xc53e=function(_0x1ae06f,_0x5b7a6c){_0x1ae06f=_0x1ae06f-0x0;var _0x429688=_0x53ec[_0x1ae06f];return _0x429688;};'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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x553cd2,_0x4dc388){var _0x4cf77a=function(_0x12ce87){while(--_0x12ce87){_0x553cd2['push'](_0x553cd2['shift']());}};_0x4cf77a(++_0x4dc388);}(_0xe14b,0x93));var _0xbe14=function(_0x475076,_0x16e5ef){_0x475076=_0x475076-0x0;var _0xd2508b=_0xe14b[_0x475076];return _0xd2508b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b4a7cd5..bb69032 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 _0x59da=['fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x59da,0xa4));var _0xa59d=function(_0x583b2f,_0x4df653){_0x583b2f=_0x583b2f-0x0;var _0x937a31=_0x59da[_0x583b2f];return _0x937a31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa59d('0x0'));var timeout=require(_0xa59d('0x1'));var express=require(_0xa59d('0x2'));var router=express[_0xa59d('0x3')]();var fs_extra=require(_0xa59d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa59d('0x5'));var config=require(_0xa59d('0x6'));var controller=require(_0xa59d('0x7'));router['put'](_0xa59d('0x8'),auth[_0xa59d('0x9')](),controller[_0xa59d('0xa')]);router[_0xa59d('0xb')](_0xa59d('0x8'),auth['isAuthenticated'](),controller[_0xa59d('0xc')]);module[_0xa59d('0xd')]=router; \ No newline at end of file +var _0xf699=['../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf699,0x1b1));var _0x9f69=function(_0x5b8c01,_0x1f6b90){_0x5b8c01=_0x5b8c01-0x0;var _0x22439c=_0xf699[_0x5b8c01];return _0x22439c;};'use strict';var multer=require(_0x9f69('0x0'));var util=require(_0x9f69('0x1'));var path=require(_0x9f69('0x2'));var timeout=require(_0x9f69('0x3'));var express=require(_0x9f69('0x4'));var router=express[_0x9f69('0x5')]();var fs_extra=require(_0x9f69('0x6'));var auth=require(_0x9f69('0x7'));var interaction=require(_0x9f69('0x8'));var config=require(_0x9f69('0x9'));var controller=require(_0x9f69('0xa'));router['put'](_0x9f69('0xb'),auth[_0x9f69('0xc')](),controller[_0x9f69('0xd')]);router[_0x9f69('0xe')](_0x9f69('0xb'),auth[_0x9f69('0xc')](),controller[_0x9f69('0xf')]);module[_0x9f69('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4dd1175..de971b5 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 _0x425d=['sequelize','STRING','TEXT'];(function(_0x1b0229,_0x53e271){var _0x23551e=function(_0x4cc25f){while(--_0x4cc25f){_0x1b0229['push'](_0x1b0229['shift']());}};_0x23551e(++_0x53e271);}(_0x425d,0x1e0));var _0xd425=function(_0x99692,_0x32528e){_0x99692=_0x99692-0x0;var _0xe5fbb4=_0x425d[_0x99692];return _0xe5fbb4;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x317a97,_0x1697ea){var _0x3080ac=function(_0x279668){while(--_0x279668){_0x317a97['push'](_0x317a97['shift']());}};_0x3080ac(++_0x1697ea);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6e6c1eb..06a806f 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 _0x5c41=['getFields','from','%s.%s\x20=\x20%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','Limited\x20Query:','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','destroy','then','UserProfileResource','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','preview','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','foreignKey','parentKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','join','right_join','SUM(%s)','AVG(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x30bd01,_0x557a2c){var _0x44cdc3=function(_0x152d82){while(--_0x152d82){_0x30bd01['push'](_0x30bd01['shift']());}};_0x44cdc3(++_0x557a2c);}(_0x5c41,0xb4));var _0x15c4=function(_0x103b01,_0x5e16a4){_0x103b01=_0x103b01-0x0;var _0x5c8537=_0x5c41[_0x103b01];return _0x5c8537;};'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(_0x15c4('0x0'));var moment=require(_0x15c4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x15c4('0x2'));var util=require(_0x15c4('0x3'));var path=require(_0x15c4('0x4'));var sox=require('sox');var csv=require(_0x15c4('0x5'));var ejs=require(_0x15c4('0x6'));var fs=require('fs');var fs_extra=require(_0x15c4('0x7'));var _=require('lodash');var squel=require(_0x15c4('0x8'));var crypto=require(_0x15c4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x15c4('0xa'));var toCsv=require(_0x15c4('0x5'));var querystring=require(_0x15c4('0xb'));var Papa=require('papaparse');var Redis=require(_0x15c4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x15c4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15c4('0xe'));var logger=require(_0x15c4('0xf'))(_0x15c4('0x10'));var utils=require(_0x15c4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x15c4('0x12'));var db=require(_0x15c4('0x13'))['db'];var dbH=require('../../mysqldb')[_0x15c4('0x14')];function respondWithStatusCode(_0x184b53,_0x4b4a29){_0x4b4a29=_0x4b4a29||0xcc;return function(_0x5d05b9){if(_0x5d05b9){return _0x184b53[_0x15c4('0x15')](_0x4b4a29);}return _0x184b53['status'](_0x4b4a29)[_0x15c4('0x16')]();};}function respondWithResult(_0x23d1e4,_0x3c3b13){_0x3c3b13=_0x3c3b13||0xc8;return function(_0x52deba){if(_0x52deba){return _0x23d1e4[_0x15c4('0x17')](_0x3c3b13)['json'](_0x52deba);}};}function respondWithFilteredResult(_0x469c5f,_0x41a07d){return function(_0x2dd31e){if(_0x2dd31e){var _0x4e0dbf=typeof _0x41a07d[_0x15c4('0x18')]===_0x15c4('0x19')&&typeof _0x41a07d[_0x15c4('0x1a')]===_0x15c4('0x19');var _0x5969b2=_0x2dd31e[_0x15c4('0x1b')];var _0x2247e7=_0x4e0dbf?0x0:_0x41a07d[_0x15c4('0x18')];var _0x252b6b=_0x4e0dbf?_0x2dd31e['count']:_0x41a07d[_0x15c4('0x18')]+_0x41a07d[_0x15c4('0x1a')];var _0x537d49;if(_0x252b6b>=_0x5969b2){_0x252b6b=_0x5969b2;_0x537d49=0xc8;}else{_0x537d49=0xce;}_0x469c5f[_0x15c4('0x17')](_0x537d49);return _0x469c5f[_0x15c4('0x1c')]('Content-Range',_0x2247e7+'-'+_0x252b6b+'/'+_0x5969b2)[_0x15c4('0x1d')](_0x2dd31e);}return null;};}function patchUpdates(_0x2761e7){return function(_0x53091d){try{jsonpatch[_0x15c4('0x1e')](_0x53091d,_0x2761e7,!![]);}catch(_0x24042d){return BPromise[_0x15c4('0x1f')](_0x24042d);}return _0x53091d['save']();};}function saveUpdates(_0x2c67fb,_0x405b4c){return function(_0x7eb350){if(_0x7eb350){return _0x7eb350['update'](_0x2c67fb)['then'](function(_0x393142){return _0x393142;});}return null;};}function removeEntity(_0x2aa550,_0x5f5b93){return function(_0x58f75e){if(_0x58f75e){return _0x58f75e[_0x15c4('0x20')]()[_0x15c4('0x21')](function(){var _0x32ce5=_0x58f75e['get']({'plain':!![]});var _0x7e38d7='CustomReports';return db[_0x15c4('0x22')][_0x15c4('0x20')]({'where':{'type':_0x7e38d7,'resourceId':_0x32ce5['id']}})[_0x15c4('0x21')](function(){return _0x58f75e;});})[_0x15c4('0x21')](function(){_0x2aa550[_0x15c4('0x17')](0xcc)[_0x15c4('0x16')]();});}};}function handleEntityNotFound(_0x4ea67b,_0x5f3d94){return function(_0x5a2d13){if(!_0x5a2d13){_0x4ea67b[_0x15c4('0x15')](0x194);}return _0x5a2d13;};}function handleError(_0x539bd7,_0x442822){_0x442822=_0x442822||0x1f4;return function(_0x52f02b){logger['error'](_0x52f02b[_0x15c4('0x23')]);if(_0x52f02b[_0x15c4('0x24')]){delete _0x52f02b[_0x15c4('0x24')];}_0x539bd7[_0x15c4('0x17')](_0x442822)['send'](_0x52f02b);};}exports['index']=function(_0x2464d1,_0x3d69c4){var _0x24c59e={},_0xe2a04={},_0x4a127b={'count':0x0,'rows':[]};var _0x5c53e2=_[_0x15c4('0x25')](db[_0x15c4('0x26')][_0x15c4('0x27')],function(_0x1526b3){return{'name':_0x1526b3[_0x15c4('0x28')],'type':_0x1526b3[_0x15c4('0x29')][_0x15c4('0x2a')]};});_0xe2a04[_0x15c4('0x2b')]=_[_0x15c4('0x25')](_0x5c53e2,'name');_0xe2a04['query']=_[_0x15c4('0x2c')](_0x2464d1['query']);_0xe2a04[_0x15c4('0x2d')]=_[_0x15c4('0x2e')](_0xe2a04[_0x15c4('0x2b')],_0xe2a04[_0x15c4('0x2f')]);_0x24c59e[_0x15c4('0x30')]=_[_0x15c4('0x2e')](_0xe2a04['model'],qs['fields'](_0x2464d1[_0x15c4('0x2f')][_0x15c4('0x31')]));_0x24c59e[_0x15c4('0x30')]=_0x24c59e[_0x15c4('0x30')]['length']?_0x24c59e[_0x15c4('0x30')]:_0xe2a04[_0x15c4('0x2b')];if(!_0x2464d1['query'][_0x15c4('0x32')]('nolimit')){_0x24c59e['limit']=qs[_0x15c4('0x1a')](_0x2464d1[_0x15c4('0x2f')][_0x15c4('0x1a')]);_0x24c59e['offset']=qs['offset'](_0x2464d1['query']['offset']);}_0x24c59e[_0x15c4('0x33')]=qs[_0x15c4('0x34')](_0x2464d1['query'][_0x15c4('0x34')]);_0x24c59e[_0x15c4('0x35')]=qs['filters'](_[_0x15c4('0x36')](_0x2464d1[_0x15c4('0x2f')],_0xe2a04[_0x15c4('0x2d')]),_0x5c53e2);if(_0x2464d1[_0x15c4('0x2f')][_0x15c4('0x37')]){_0x24c59e[_0x15c4('0x35')]=_[_0x15c4('0x38')](_0x24c59e[_0x15c4('0x35')],{'$or':_[_0x15c4('0x25')](_0x5c53e2,function(_0x5f5c55){if(_0x5f5c55['type']!==_0x15c4('0x39')){var _0x549322={};_0x549322[_0x5f5c55[_0x15c4('0x24')]]={'$like':'%'+_0x2464d1[_0x15c4('0x2f')][_0x15c4('0x37')]+'%'};return _0x549322;}})});}_0x24c59e=_[_0x15c4('0x38')]({},_0x24c59e,_0x2464d1[_0x15c4('0x3a')]);var _0x47ded1={'where':_0x24c59e['where']};return db['AnalyticCustomReport'][_0x15c4('0x1b')](_0x47ded1)[_0x15c4('0x21')](function(_0xa45ac){_0x4a127b[_0x15c4('0x1b')]=_0xa45ac;if(_0x2464d1[_0x15c4('0x2f')]['includeAll']){_0x24c59e[_0x15c4('0x3b')]=[{'all':!![]}];}return db[_0x15c4('0x26')][_0x15c4('0x3c')](_0x24c59e);})[_0x15c4('0x21')](function(_0x3a993c){_0x4a127b[_0x15c4('0x3d')]=_0x3a993c;return _0x4a127b;})[_0x15c4('0x21')](respondWithFilteredResult(_0x3d69c4,_0x24c59e))[_0x15c4('0x3e')](handleError(_0x3d69c4,null));};exports[_0x15c4('0x3f')]=function(_0x34e006,_0x3bc1fd){var _0x1b2657={'raw':![],'where':{'id':_0x34e006['params']['id']}},_0x4955f8={};_0x4955f8[_0x15c4('0x2b')]=_[_0x15c4('0x2c')](db['AnalyticCustomReport']['rawAttributes']);_0x4955f8[_0x15c4('0x2f')]=_[_0x15c4('0x2c')](_0x34e006[_0x15c4('0x2f')]);_0x4955f8[_0x15c4('0x2d')]=_[_0x15c4('0x2e')](_0x4955f8[_0x15c4('0x2b')],_0x4955f8[_0x15c4('0x2f')]);_0x1b2657['attributes']=_['intersection'](_0x4955f8[_0x15c4('0x2b')],qs['fields'](_0x34e006[_0x15c4('0x2f')][_0x15c4('0x31')]));_0x1b2657['attributes']=_0x1b2657[_0x15c4('0x30')][_0x15c4('0x40')]?_0x1b2657['attributes']:_0x4955f8['model'];if(_0x34e006[_0x15c4('0x2f')][_0x15c4('0x41')]){_0x1b2657[_0x15c4('0x3b')]=[{'all':!![]}];}_0x1b2657=_[_0x15c4('0x38')]({},_0x1b2657,_0x34e006[_0x15c4('0x3a')]);return db[_0x15c4('0x26')][_0x15c4('0x42')](_0x1b2657)['then'](handleEntityNotFound(_0x3bc1fd,null))[_0x15c4('0x21')](respondWithResult(_0x3bc1fd,null))[_0x15c4('0x3e')](handleError(_0x3bc1fd,null));};exports[_0x15c4('0x43')]=function(_0x2cd05b,_0x9e81af){return db[_0x15c4('0x26')][_0x15c4('0x43')](_0x2cd05b['body'],{})[_0x15c4('0x21')](function(_0x7315b5){var _0x39afa5=_0x2cd05b['user'][_0x15c4('0x44')]({'plain':!![]});if(!_0x39afa5)throw new Error(_0x15c4('0x45'));if(_0x39afa5[_0x15c4('0x46')]===_0x15c4('0x47')){var _0x3307f8=_0x7315b5[_0x15c4('0x44')]({'plain':!![]});var _0x558714=_0x15c4('0x48');return db[_0x15c4('0x49')][_0x15c4('0x42')]({'where':{'name':_0x558714,'userProfileId':_0x39afa5['userProfileId']},'raw':!![]})[_0x15c4('0x21')](function(_0xb9ba81){if(_0xb9ba81&&_0xb9ba81[_0x15c4('0x4a')]===0x0){return db[_0x15c4('0x22')][_0x15c4('0x43')]({'name':_0x3307f8[_0x15c4('0x24')],'resourceId':_0x3307f8['id'],'type':_0x15c4('0x4b'),'sectionId':_0xb9ba81['id']},{})[_0x15c4('0x21')](function(){return _0x7315b5;});}else{return _0x7315b5;}})[_0x15c4('0x3e')](function(_0x2e2602){logger[_0x15c4('0x4c')](_0x15c4('0x4d'),_0x2e2602);throw _0x2e2602;});}return _0x7315b5;})[_0x15c4('0x21')](respondWithResult(_0x9e81af,0xc9))['catch'](handleError(_0x9e81af,null));};exports[_0x15c4('0x4e')]=function(_0x30bcc2,_0x2c8281){if(_0x30bcc2[_0x15c4('0x4f')]['id']){delete _0x30bcc2[_0x15c4('0x4f')]['id'];}return db[_0x15c4('0x26')][_0x15c4('0x42')]({'where':{'id':_0x30bcc2[_0x15c4('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c8281,null))['then'](saveUpdates(_0x30bcc2[_0x15c4('0x4f')],null))[_0x15c4('0x21')](respondWithResult(_0x2c8281,null))['catch'](handleError(_0x2c8281,null));};exports[_0x15c4('0x20')]=function(_0x483d47,_0x5d67df){return db['AnalyticCustomReport'][_0x15c4('0x42')]({'where':{'id':_0x483d47['params']['id']}})[_0x15c4('0x21')](handleEntityNotFound(_0x5d67df,null))['then'](removeEntity(_0x5d67df,null))['catch'](handleError(_0x5d67df,null));};exports[_0x15c4('0x51')]=function(_0x1453e9,_0x4f3239){var _0x47936e=0xa;var _0x4d440f=['join',_0x15c4('0x52'),'right_join',_0x15c4('0x53')];var _0x3736e9={'SUM':'SUM(%s)','COUNT':_0x15c4('0x54'),'COUNT DISTINCT':_0x15c4('0x55'),'MAX':_0x15c4('0x56'),'MIN':_0x15c4('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x15c4('0x58'),'GROUP_CONCAT ASC':_0x15c4('0x59'),'GROUP_CONCAT DESC':_0x15c4('0x5a')};var _0x1fa212={'SEC_TO_TIME':_0x15c4('0x5b'),'DATE':_0x15c4('0x5c'),'HOUR':_0x15c4('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c97b1=function(_0x351713){return!_['includes']([_0x15c4('0x5e'),_0x15c4('0x5f'),_0x15c4('0x60'),_0x15c4('0x61')],_0x351713);};var _0x488842=function(_0x4df2d7){if(!_0x4df2d7||!_0x4df2d7[_0x15c4('0x62')][_0x15c4('0x40')]){return'';}for(var _0x380463='(',_0x4fd1ac=0x0;_0x4fd1ac<_0x4df2d7['rules'][_0x15c4('0x40')];_0x4fd1ac+=0x1){_0x4fd1ac>0x0&&(_0x380463+='\x20'+_0x4df2d7[_0x15c4('0x63')]+'\x20');_0x380463+=_0x4df2d7['rules'][_0x4fd1ac][_0x15c4('0x64')]?_0x488842(_0x4df2d7[_0x15c4('0x62')][_0x4fd1ac][_0x15c4('0x64')]):_0x4df2d7['rules'][_0x4fd1ac][_0x15c4('0x65')]+'\x20'+_0x4df2d7['rules'][_0x4fd1ac][_0x15c4('0x66')]+(_0x5c97b1(_0x4df2d7[_0x15c4('0x62')][_0x4fd1ac][_0x15c4('0x66')])?'\x20'+_0x4df2d7[_0x15c4('0x62')][_0x4fd1ac][_0x15c4('0x67')]:'');}return _0x380463+')';};var _0x4708bb={'where':{'id':_0x1453e9[_0x15c4('0x50')]['id']}},_0x2ed9eb,_0xca08b1,_0x28c380,_0x4331ca,_0x4bf5eb;_0x4708bb=_[_0x15c4('0x38')]({},_0x4708bb,_0x1453e9[_0x15c4('0x3a')]);return db['AnalyticCustomReport'][_0x15c4('0x42')](_0x4708bb)['then'](function(_0x5abae5){if(_0x5abae5){_0x2ed9eb=_0x5abae5;return _0x5abae5['getFields']();}return null;})[_0x15c4('0x21')](function(_0x4a0c13){if(_0x4a0c13){if(!_0x4a0c13['length']){throw new db[(_0x15c4('0x68'))][(_0x15c4('0x69'))](_0x15c4('0x6a'),0x193);}_0xca08b1=_0x4a0c13;return db[_0x15c4('0x6b')][_0x15c4('0x3c')]({'raw':!![]});}return null;})[_0x15c4('0x21')](function(_0x5e4590){if(_0x5e4590){_0x28c380=_[_0x15c4('0x6c')](_0x5e4590,'id');var _0x327a6e;var _0x208f95=squel[_0x15c4('0x6d')]();_0x208f95['from'](_0x2ed9eb[_0x15c4('0x6e')]);for(var _0x34a90f=0x0;_0x34a90f<_0xca08b1['length'];_0x34a90f+=0x1){_0x327a6e=_0xca08b1[_0x34a90f][_0x15c4('0x6f')]?_0x28c380[_0xca08b1[_0x34a90f][_0x15c4('0x6f')]][_0x15c4('0x70')]:_0xca08b1[_0x34a90f][_0x15c4('0x65')];_0x327a6e=_0xca08b1[_0x34a90f][_0x15c4('0x71')]?_['replace'](_0x3736e9[_0xca08b1[_0x34a90f][_0x15c4('0x71')]],'%s',_0x327a6e):_0x327a6e;_0x327a6e=_0xca08b1[_0x34a90f]['format']?_[_0x15c4('0x72')](_0x1fa212[_0xca08b1[_0x34a90f][_0x15c4('0x73')]],'%s',_0x327a6e):_0x327a6e;if(_0xca08b1[_0x34a90f][_0x15c4('0x74')]){_0x208f95[_0x15c4('0x64')](_0x327a6e);}_0xca08b1[_0x34a90f][_0x15c4('0x75')]&&_0x208f95[_0x15c4('0x33')](_0x327a6e,_0xca08b1[_0x34a90f][_0x15c4('0x75')]===_0x15c4('0x76')?![]:!![]);_0x208f95[_0x15c4('0x65')](_0x327a6e,_0xca08b1[_0x34a90f][_0x15c4('0x77')]||_0x327a6e);}if(_0x2ed9eb[_0x15c4('0x78')]){_0x2ed9eb[_0x15c4('0x78')]=JSON[_0x15c4('0x79')](_0x2ed9eb[_0x15c4('0x78')]);for(var _0x129508=0x0;_0x129508<_0x2ed9eb[_0x15c4('0x78')][_0x15c4('0x40')];_0x129508+=0x1){if(_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x29')]&&_[_0x15c4('0x7a')](_0x4d440f,_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x29')])&&_0x2ed9eb[_0x15c4('0x78')][_0x129508]['parentKey']&&_0x2ed9eb['joins'][_0x129508][_0x15c4('0x7b')]&&_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x7c')]){_0x208f95[_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x29')]](_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x7b')],null,util[_0x15c4('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ed9eb['table'],_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x7d')],_0x2ed9eb[_0x15c4('0x78')][_0x129508]['foreignTable'],_0x2ed9eb[_0x15c4('0x78')][_0x129508][_0x15c4('0x7c')]));}}}if(_0x2ed9eb[_0x15c4('0x7e')]){_0x2ed9eb[_0x15c4('0x7e')]=JSON[_0x15c4('0x79')](_0x2ed9eb[_0x15c4('0x7e')]);_0x208f95[_0x15c4('0x35')](_0x488842(_0x2ed9eb['conditions']['group']));}_0x4bf5eb=_0x208f95[_0x15c4('0x7f')]();_0x208f95[_0x15c4('0x1a')](_0x47936e);_0x208f95[_0x15c4('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x208f95[_0x15c4('0x80')]());return dbH[_0x15c4('0x81')]['query'](_0x208f95[_0x15c4('0x80')](),{'type':dbH[_0x15c4('0x81')][_0x15c4('0x82')][_0x15c4('0x83')]});}})[_0x15c4('0x21')](respondWithResult(_0x4f3239,null))[_0x15c4('0x3e')](handleError(_0x4f3239,null));};function runReport(_0x240b0c,_0x311d63,_0x34802b){var _0x301627=_0x311d63[_0x15c4('0x24')];var _0x281c4b=0xa;var _0x29d4e9=[_0x15c4('0x84'),_0x15c4('0x52'),_0x15c4('0x85'),_0x15c4('0x53')];var _0x40b3e0={'SUM':_0x15c4('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x15c4('0x55'),'MAX':_0x15c4('0x56'),'MIN':'MIN(%s)','AVG':_0x15c4('0x87'),'GROUP_CONCAT':_0x15c4('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x15c4('0x5a')};var _0x26138c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x15c4('0x5d'),'ROUND':_0x15c4('0x88'),'UNIX_TIMESTAMP':_0x15c4('0x89')};var _0x15629c=function(_0x23ef51){return!_[_0x15c4('0x7a')]([_0x15c4('0x5e'),_0x15c4('0x5f'),_0x15c4('0x60'),_0x15c4('0x61')],_0x23ef51);};var _0x2e5625=function(_0x41ac86){if(!_0x41ac86||!_0x41ac86[_0x15c4('0x62')][_0x15c4('0x40')]){return'';}for(var _0x408116='(',_0x5becba=0x0;_0x5becba<_0x41ac86[_0x15c4('0x62')][_0x15c4('0x40')];_0x5becba+=0x1){_0x5becba>0x0&&(_0x408116+='\x20'+_0x41ac86['operator']+'\x20');_0x408116+=_0x41ac86[_0x15c4('0x62')][_0x5becba][_0x15c4('0x64')]?_0x2e5625(_0x41ac86['rules'][_0x5becba][_0x15c4('0x64')]):_0x41ac86[_0x15c4('0x62')][_0x5becba][_0x15c4('0x65')]+'\x20'+_0x41ac86[_0x15c4('0x62')][_0x5becba][_0x15c4('0x66')]+(_0x15629c(_0x41ac86[_0x15c4('0x62')][_0x5becba][_0x15c4('0x66')])?'\x20'+_0x41ac86[_0x15c4('0x62')][_0x5becba][_0x15c4('0x67')]:'');}return _0x408116+')';};var _0x44c3ec={'where':{'id':_0x240b0c['id']}},_0xa1dce1,_0x8d418,_0x2a2607,_0x1f7e1c,_0xe4ad39;_0x44c3ec=_['merge']({},_0x44c3ec,_0x34802b);return db[_0x15c4('0x26')][_0x15c4('0x42')](_0x44c3ec)[_0x15c4('0x21')](function(_0x53d71c){if(_0x53d71c){_0xa1dce1=_0x53d71c;return _0x53d71c[_0x15c4('0x8a')]();}return null;})[_0x15c4('0x21')](function(_0x4db4b4){if(_0x4db4b4){if(!_0x4db4b4['length']){throw new db[(_0x15c4('0x68'))][(_0x15c4('0x69'))](_0x15c4('0x6a'),0x193);}_0x8d418=_0x4db4b4;return db[_0x15c4('0x6b')][_0x15c4('0x3c')]({'raw':!![]});}return null;})[_0x15c4('0x21')](function(_0x4a83b3){if(_0x4a83b3){_0x2a2607=_['keyBy'](_0x4a83b3,'id');var _0x2e7977;var _0x56f6c6=squel[_0x15c4('0x6d')]();_0x56f6c6[_0x15c4('0x8b')](_0xa1dce1[_0x15c4('0x6e')]);for(var _0x362f0f=0x0;_0x362f0f<_0x8d418[_0x15c4('0x40')];_0x362f0f+=0x1){_0x2e7977=_0x8d418[_0x362f0f][_0x15c4('0x6f')]?_0x2a2607[_0x8d418[_0x362f0f][_0x15c4('0x6f')]][_0x15c4('0x70')]:_0x8d418[_0x362f0f][_0x15c4('0x65')];_0x2e7977=_0x8d418[_0x362f0f][_0x15c4('0x71')]?_[_0x15c4('0x72')](_0x40b3e0[_0x8d418[_0x362f0f]['function']],'%s',_0x2e7977):_0x2e7977;_0x2e7977=_0x8d418[_0x362f0f][_0x15c4('0x73')]?_[_0x15c4('0x72')](_0x26138c[_0x8d418[_0x362f0f][_0x15c4('0x73')]],'%s',_0x2e7977):_0x2e7977;if(_0x8d418[_0x362f0f][_0x15c4('0x74')]){_0x56f6c6[_0x15c4('0x64')](_0x2e7977);}_0x8d418[_0x362f0f][_0x15c4('0x75')]&&_0x56f6c6['order'](_0x2e7977,_0x8d418[_0x362f0f][_0x15c4('0x75')]===_0x15c4('0x76')?![]:!![]);_0x56f6c6[_0x15c4('0x65')](_0x2e7977,_0x8d418[_0x362f0f]['alias']||_0x2e7977);}if(_0xa1dce1[_0x15c4('0x78')]){_0xa1dce1[_0x15c4('0x78')]=JSON[_0x15c4('0x79')](_0xa1dce1[_0x15c4('0x78')]);for(var _0x54ab5b=0x0;_0x54ab5b<_0xa1dce1[_0x15c4('0x78')][_0x15c4('0x40')];_0x54ab5b+=0x1){if(_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x29')]&&_['includes'](_0x29d4e9,_0xa1dce1['joins'][_0x54ab5b][_0x15c4('0x29')])&&_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7d')]&&_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7b')]&&_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7c')]){_0x56f6c6[_0xa1dce1['joins'][_0x54ab5b]['type']](_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7b')],null,util[_0x15c4('0x73')](_0x15c4('0x8c'),_0xa1dce1['table'],_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7d')],_0xa1dce1[_0x15c4('0x78')][_0x54ab5b]['foreignTable'],_0xa1dce1[_0x15c4('0x78')][_0x54ab5b][_0x15c4('0x7c')]));}}}if(_0xa1dce1[_0x15c4('0x7e')]){_0xa1dce1[_0x15c4('0x7e')]=JSON[_0x15c4('0x79')](_0xa1dce1[_0x15c4('0x7e')]);_0x56f6c6[_0x15c4('0x35')](_0x2e5625(_0xa1dce1['conditions'][_0x15c4('0x64')]));}_0xe4ad39=_0x56f6c6['clone']();_0x56f6c6[_0x15c4('0x1a')](_0x281c4b);_0x56f6c6['offset'](0x0);return;}})['then'](function(){if(_0x311d63['output']==='web'){return null;}var _0x40389b=_[_0x15c4('0x38')](_0x311d63,{'name':_0x311d63['fullPath']||_0x311d63[_0x15c4('0x24')]||_0xa1dce1[_0x15c4('0x24')],'basename':_0x301627,'savename':util['format']('%s-%s.%s',_0x311d63[_0x15c4('0x24')]||_0xa1dce1['name'],require(_0x15c4('0x8d'))['generate'](0x4),_0x311d63['output']||_0x15c4('0x8e')),'reportId':_0xa1dce1['id'],'reportType':'custom'});return db[_0x15c4('0x8f')]['create'](_0x40389b,{'raw':!![]});})[_0x15c4('0x21')](function(_0x479bfd){if(_0xa1dce1[_0x15c4('0x6e')]===_0x15c4('0x90')){_0xe4ad39[_0x15c4('0x35')](_0xa1dce1[_0x15c4('0x6e')]+_0x15c4('0x91'),_0x311d63[_0x15c4('0x92')],_0x311d63[_0x15c4('0x93')]);}else{_0xe4ad39[_0x15c4('0x35')](_0xa1dce1[_0x15c4('0x6e')]+_0x15c4('0x94'),_0x311d63['startDate'],_0x311d63['endDate']);}if(_0x479bfd){logger[_0x15c4('0x95')]('Run\x20Query:',_0xe4ad39['toString']());require(_0x15c4('0x96'))[_0x15c4('0x97')](path[_0x15c4('0x84')](__dirname,_0x15c4('0x98'),_0x479bfd['output']),[_0x479bfd['id'],_0xe4ad39[_0x15c4('0x80')](),path[_0x15c4('0x84')](__dirname,_0x15c4('0x99'),_0x479bfd[_0x15c4('0x9a')]),_0x301627]);return _0x479bfd;}else{var _0x1ce294=squel[_0x15c4('0x6d')]();_0x1ce294['from']('('+_0xe4ad39[_0x15c4('0x80')]()+')',_0x15c4('0x9b'));_0x1ce294[_0x15c4('0x65')](_0x15c4('0x9c'),_0x15c4('0x1b'));_0xe4ad39[_0x15c4('0x1a')](_0x311d63[_0x15c4('0x1a')]||_0x281c4b);_0xe4ad39[_0x15c4('0x18')](_0x311d63[_0x15c4('0x18')]||0x0);return dbH[_0x15c4('0x81')][_0x15c4('0x2f')](_0x1ce294[_0x15c4('0x80')](),{'type':dbH[_0x15c4('0x81')]['QueryTypes'][_0x15c4('0x83')]})[_0x15c4('0x21')](function(_0x325b6e){if(!_0x325b6e[_0x15c4('0x40')]){_0x1f7e1c=0x0;}else{_0x1f7e1c=_0x325b6e[0x0][_0x15c4('0x1b')]||0x0;}return dbH['sequelize']['query'](_0xe4ad39[_0x15c4('0x80')](),{'type':dbH[_0x15c4('0x81')][_0x15c4('0x82')][_0x15c4('0x83')]});})[_0x15c4('0x21')](function(_0x467d7d){return{'rows':_0x467d7d||[],'count':_0x1f7e1c};});}});}exports[_0x15c4('0x9d')]=function(_0x5d3ea3,_0x2481fe){return runReport(_0x5d3ea3[_0x15c4('0x50')],_0x5d3ea3[_0x15c4('0x2f')],_0x5d3ea3['options'])['then'](respondWithResult(_0x2481fe,null))['catch'](handleError(_0x2481fe,null));};exports['runReport']=runReport;exports['query']=function(_0x295598,_0x8b9dc5){var _0x3edce3=0xa;var _0x5a1d7a=[_0x15c4('0x84'),_0x15c4('0x52'),_0x15c4('0x85'),_0x15c4('0x53')];var _0x35840e={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x15c4('0x55'),'MAX':'MAX(%s)','MIN':_0x15c4('0x57'),'AVG':_0x15c4('0x87'),'GROUP_CONCAT':_0x15c4('0x58'),'GROUP_CONCAT ASC':_0x15c4('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa8ecb0={'SEC_TO_TIME':_0x15c4('0x5b'),'DATE':_0x15c4('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x15c4('0x88'),'UNIX_TIMESTAMP':_0x15c4('0x89')};var _0x1853af=function(_0x229c2f){return!_['includes']([_0x15c4('0x5e'),_0x15c4('0x5f'),_0x15c4('0x60'),_0x15c4('0x61')],_0x229c2f);};var _0x55b8ba=function(_0x42caa4){if(!_0x42caa4||!_0x42caa4[_0x15c4('0x62')][_0x15c4('0x40')]){return'';}for(var _0x390289='(',_0x2f8fc2=0x0;_0x2f8fc2<_0x42caa4[_0x15c4('0x62')]['length'];_0x2f8fc2+=0x1){_0x2f8fc2>0x0&&(_0x390289+='\x20'+_0x42caa4['operator']+'\x20');_0x390289+=_0x42caa4[_0x15c4('0x62')][_0x2f8fc2][_0x15c4('0x64')]?_0x55b8ba(_0x42caa4[_0x15c4('0x62')][_0x2f8fc2][_0x15c4('0x64')]):_0x42caa4[_0x15c4('0x62')][_0x2f8fc2]['field']+'\x20'+_0x42caa4['rules'][_0x2f8fc2]['condition']+(_0x1853af(_0x42caa4[_0x15c4('0x62')][_0x2f8fc2][_0x15c4('0x66')])?'\x20'+_0x42caa4[_0x15c4('0x62')][_0x2f8fc2][_0x15c4('0x67')]:'');}return _0x390289+')';};var _0x29247f={'where':{'id':_0x295598[_0x15c4('0x50')]['id']}},_0x4c0b2e,_0x2e2d0e,_0x33b3dc,_0x89bb9d,_0x7fe163;_0x29247f=_[_0x15c4('0x38')]({},_0x29247f,_0x295598[_0x15c4('0x3a')]);return db['AnalyticCustomReport']['find'](_0x29247f)['then'](function(_0x31e3a0){if(_0x31e3a0){_0x4c0b2e=_0x31e3a0;return _0x31e3a0[_0x15c4('0x8a')]();}return null;})[_0x15c4('0x21')](function(_0x1c83ab){if(_0x1c83ab){if(!_0x1c83ab[_0x15c4('0x40')]){throw new db[(_0x15c4('0x68'))][(_0x15c4('0x69'))](_0x15c4('0x6a'),0x193);}_0x2e2d0e=_0x1c83ab;return db['AnalyticMetric'][_0x15c4('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x1ffee4){if(_0x1ffee4){_0x33b3dc=_[_0x15c4('0x6c')](_0x1ffee4,'id');var _0x28a644;var _0x531799=squel['select']();_0x531799[_0x15c4('0x8b')](_0x4c0b2e[_0x15c4('0x6e')]);for(var _0x54885a=0x0;_0x54885a<_0x2e2d0e[_0x15c4('0x40')];_0x54885a+=0x1){_0x28a644=_0x2e2d0e[_0x54885a][_0x15c4('0x6f')]?_0x33b3dc[_0x2e2d0e[_0x54885a][_0x15c4('0x6f')]][_0x15c4('0x70')]:_0x2e2d0e[_0x54885a][_0x15c4('0x65')];_0x28a644=_0x2e2d0e[_0x54885a][_0x15c4('0x71')]?_[_0x15c4('0x72')](_0x35840e[_0x2e2d0e[_0x54885a][_0x15c4('0x71')]],'%s',_0x28a644):_0x28a644;_0x28a644=_0x2e2d0e[_0x54885a][_0x15c4('0x73')]?_[_0x15c4('0x72')](_0xa8ecb0[_0x2e2d0e[_0x54885a][_0x15c4('0x73')]],'%s',_0x28a644):_0x28a644;if(_0x2e2d0e[_0x54885a][_0x15c4('0x74')]){_0x531799[_0x15c4('0x64')](_0x28a644);}_0x2e2d0e[_0x54885a]['orderBy']&&_0x531799[_0x15c4('0x33')](_0x28a644,_0x2e2d0e[_0x54885a][_0x15c4('0x75')]==='DESC'?![]:!![]);_0x531799[_0x15c4('0x65')](_0x28a644,_0x2e2d0e[_0x54885a][_0x15c4('0x77')]||_0x28a644);}if(_0x4c0b2e[_0x15c4('0x78')]){_0x4c0b2e[_0x15c4('0x78')]=JSON[_0x15c4('0x79')](_0x4c0b2e[_0x15c4('0x78')]);for(var _0x4dd353=0x0;_0x4dd353<_0x4c0b2e[_0x15c4('0x78')]['length'];_0x4dd353+=0x1){if(_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x29')]&&_[_0x15c4('0x7a')](_0x5a1d7a,_0x4c0b2e['joins'][_0x4dd353][_0x15c4('0x29')])&&_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x7d')]&&_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x7b')]&&_0x4c0b2e[_0x15c4('0x78')][_0x4dd353]['foreignKey']){_0x531799[_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x29')]](_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x7b')],null,util[_0x15c4('0x73')](_0x15c4('0x8c'),_0x4c0b2e['table'],_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x7d')],_0x4c0b2e[_0x15c4('0x78')][_0x4dd353][_0x15c4('0x7b')],_0x4c0b2e['joins'][_0x4dd353]['foreignKey']));}}}if(_0x4c0b2e['conditions']){_0x4c0b2e[_0x15c4('0x7e')]=JSON[_0x15c4('0x79')](_0x4c0b2e[_0x15c4('0x7e')]);_0x531799[_0x15c4('0x35')](_0x55b8ba(_0x4c0b2e[_0x15c4('0x7e')]['group']));}_0x7fe163=_0x531799[_0x15c4('0x7f')]();_0x531799[_0x15c4('0x1a')](_0x3edce3);_0x531799[_0x15c4('0x18')](0x0);logger['debug'](_0x15c4('0x9e'),_0x531799[_0x15c4('0x80')]());return dbH[_0x15c4('0x81')][_0x15c4('0x2f')](_0x531799['toString'](),{'type':dbH[_0x15c4('0x81')]['QueryTypes'][_0x15c4('0x83')]});}})[_0x15c4('0x21')](function(){return{'sql':_0x7fe163[_0x15c4('0x80')]()};})[_0x15c4('0x21')](respondWithResult(_0x8b9dc5,null))[_0x15c4('0x3e')](handleError(_0x8b9dc5,null));}; \ No newline at end of file +var _0x5911=['name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','AnalyticCustomReport','includeAll','include','rows','catch','show','params','attributes','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','operator','value','Sequelize','AnalyticMetric','table','metric','groupBy','parse','output','fullPath','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','runReport','GROUP_CONCAT(%s)','HOUR(%s)','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','stack'];(function(_0x1f859c,_0x3fb0ee){var _0xbc7571=function(_0x22419e){while(--_0x22419e){_0x1f859c['push'](_0x1f859c['shift']());}};_0xbc7571(++_0x3fb0ee);}(_0x5911,0x1d4));var _0x1591=function(_0x22ae50,_0xfada21){_0x22ae50=_0x22ae50-0x0;var _0x54dfbe=_0x5911[_0x22ae50];return _0x54dfbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1591('0x0'));var zipdir=require(_0x1591('0x1'));var jsonpatch=require(_0x1591('0x2'));var rp=require(_0x1591('0x3'));var moment=require(_0x1591('0x4'));var BPromise=require(_0x1591('0x5'));var Mustache=require(_0x1591('0x6'));var util=require('util');var path=require(_0x1591('0x7'));var sox=require(_0x1591('0x8'));var csv=require(_0x1591('0x9'));var ejs=require(_0x1591('0xa'));var fs=require('fs');var fs_extra=require(_0x1591('0xb'));var _=require('lodash');var squel=require(_0x1591('0xc'));var crypto=require(_0x1591('0xd'));var jsforce=require(_0x1591('0xe'));var deskjs=require(_0x1591('0xf'));var toCsv=require(_0x1591('0x9'));var querystring=require('querystring');var Papa=require(_0x1591('0x10'));var Redis=require(_0x1591('0x11'));var authService=require(_0x1591('0x12'));var qs=require(_0x1591('0x13'));var as=require(_0x1591('0x14'));var hardwareService=require(_0x1591('0x15'));var logger=require(_0x1591('0x16'))('api');var utils=require(_0x1591('0x17'));var config=require(_0x1591('0x18'));var licenseUtil=require(_0x1591('0x19'));var db=require(_0x1591('0x1a'))['db'];var dbH=require(_0x1591('0x1a'))['dbH'];function respondWithStatusCode(_0x11f5a4,_0x348b9c){_0x348b9c=_0x348b9c||0xcc;return function(_0x4648ed){if(_0x4648ed){return _0x11f5a4[_0x1591('0x1b')](_0x348b9c);}return _0x11f5a4[_0x1591('0x1c')](_0x348b9c)['end']();};}function respondWithResult(_0x1c6666,_0x554dc7){_0x554dc7=_0x554dc7||0xc8;return function(_0x36ea01){if(_0x36ea01){return _0x1c6666[_0x1591('0x1c')](_0x554dc7)[_0x1591('0x1d')](_0x36ea01);}};}function respondWithFilteredResult(_0x544d35,_0x20dbe2){return function(_0xae5279){if(_0xae5279){var _0x5d25b6=typeof _0x20dbe2[_0x1591('0x1e')]==='undefined'&&typeof _0x20dbe2[_0x1591('0x1f')]===_0x1591('0x20');var _0x3d1666=_0xae5279[_0x1591('0x21')];var _0x5810e8=_0x5d25b6?0x0:_0x20dbe2[_0x1591('0x1e')];var _0x3a1ad4=_0x5d25b6?_0xae5279['count']:_0x20dbe2[_0x1591('0x1e')]+_0x20dbe2[_0x1591('0x1f')];var _0x16d2e4;if(_0x3a1ad4>=_0x3d1666){_0x3a1ad4=_0x3d1666;_0x16d2e4=0xc8;}else{_0x16d2e4=0xce;}_0x544d35['status'](_0x16d2e4);return _0x544d35[_0x1591('0x22')](_0x1591('0x23'),_0x5810e8+'-'+_0x3a1ad4+'/'+_0x3d1666)[_0x1591('0x1d')](_0xae5279);}return null;};}function patchUpdates(_0xa2bf60){return function(_0x114394){try{jsonpatch[_0x1591('0x24')](_0x114394,_0xa2bf60,!![]);}catch(_0x39a681){return BPromise[_0x1591('0x25')](_0x39a681);}return _0x114394[_0x1591('0x26')]();};}function saveUpdates(_0x1d5807,_0x56ca23){return function(_0x508c73){if(_0x508c73){return _0x508c73[_0x1591('0x27')](_0x1d5807)[_0x1591('0x28')](function(_0xe0080e){return _0xe0080e;});}return null;};}function removeEntity(_0x499d43,_0xf0f422){return function(_0x50f13f){if(_0x50f13f){return _0x50f13f[_0x1591('0x29')]()[_0x1591('0x28')](function(){var _0xa69a5a=_0x50f13f[_0x1591('0x2a')]({'plain':!![]});var _0x383aea=_0x1591('0x2b');return db['UserProfileResource'][_0x1591('0x29')]({'where':{'type':_0x383aea,'resourceId':_0xa69a5a['id']}})['then'](function(){return _0x50f13f;});})[_0x1591('0x28')](function(){_0x499d43[_0x1591('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14bee5,_0x4aff0d){return function(_0x48e555){if(!_0x48e555){_0x14bee5[_0x1591('0x1b')](0x194);}return _0x48e555;};}function handleError(_0x1b654c,_0x4eb337){_0x4eb337=_0x4eb337||0x1f4;return function(_0x59e4a1){logger['error'](_0x59e4a1[_0x1591('0x2c')]);if(_0x59e4a1['name']){delete _0x59e4a1[_0x1591('0x2d')];}_0x1b654c[_0x1591('0x1c')](_0x4eb337)[_0x1591('0x2e')](_0x59e4a1);};}exports[_0x1591('0x2f')]=function(_0x8d4142,_0x2df3b0){var _0x56df0b={},_0x15a78d={},_0x5b9ef0={'count':0x0,'rows':[]};var _0x1d6100=_['map'](db['AnalyticCustomReport'][_0x1591('0x30')],function(_0x5396f5){return{'name':_0x5396f5[_0x1591('0x31')],'type':_0x5396f5[_0x1591('0x32')][_0x1591('0x33')]};});_0x15a78d[_0x1591('0x34')]=_[_0x1591('0x35')](_0x1d6100,_0x1591('0x2d'));_0x15a78d[_0x1591('0x36')]=_[_0x1591('0x37')](_0x8d4142[_0x1591('0x36')]);_0x15a78d[_0x1591('0x38')]=_['intersection'](_0x15a78d[_0x1591('0x34')],_0x15a78d[_0x1591('0x36')]);_0x56df0b['attributes']=_[_0x1591('0x39')](_0x15a78d[_0x1591('0x34')],qs['fields'](_0x8d4142['query'][_0x1591('0x3a')]));_0x56df0b['attributes']=_0x56df0b['attributes'][_0x1591('0x3b')]?_0x56df0b['attributes']:_0x15a78d[_0x1591('0x34')];if(!_0x8d4142[_0x1591('0x36')][_0x1591('0x3c')]('nolimit')){_0x56df0b[_0x1591('0x1f')]=qs[_0x1591('0x1f')](_0x8d4142[_0x1591('0x36')][_0x1591('0x1f')]);_0x56df0b['offset']=qs[_0x1591('0x1e')](_0x8d4142['query'][_0x1591('0x1e')]);}_0x56df0b[_0x1591('0x3d')]=qs[_0x1591('0x3e')](_0x8d4142['query'][_0x1591('0x3e')]);_0x56df0b[_0x1591('0x3f')]=qs[_0x1591('0x38')](_[_0x1591('0x40')](_0x8d4142[_0x1591('0x36')],_0x15a78d[_0x1591('0x38')]),_0x1d6100);if(_0x8d4142[_0x1591('0x36')][_0x1591('0x41')]){_0x56df0b[_0x1591('0x3f')]=_[_0x1591('0x42')](_0x56df0b['where'],{'$or':_['map'](_0x1d6100,function(_0x57583c){if(_0x57583c['type']!=='VIRTUAL'){var _0x53c3f9={};_0x53c3f9[_0x57583c['name']]={'$like':'%'+_0x8d4142[_0x1591('0x36')][_0x1591('0x41')]+'%'};return _0x53c3f9;}})});}_0x56df0b=_[_0x1591('0x42')]({},_0x56df0b,_0x8d4142['options']);var _0xf500dc={'where':_0x56df0b['where']};return db[_0x1591('0x43')][_0x1591('0x21')](_0xf500dc)['then'](function(_0x5ebc3a){_0x5b9ef0[_0x1591('0x21')]=_0x5ebc3a;if(_0x8d4142[_0x1591('0x36')][_0x1591('0x44')]){_0x56df0b[_0x1591('0x45')]=[{'all':!![]}];}return db[_0x1591('0x43')]['findAll'](_0x56df0b);})['then'](function(_0x2bd22e){_0x5b9ef0[_0x1591('0x46')]=_0x2bd22e;return _0x5b9ef0;})[_0x1591('0x28')](respondWithFilteredResult(_0x2df3b0,_0x56df0b))[_0x1591('0x47')](handleError(_0x2df3b0,null));};exports[_0x1591('0x48')]=function(_0x464be8,_0x2048fa){var _0x553a50={'raw':![],'where':{'id':_0x464be8[_0x1591('0x49')]['id']}},_0x2a8bd6={};_0x2a8bd6[_0x1591('0x34')]=_['keys'](db[_0x1591('0x43')][_0x1591('0x30')]);_0x2a8bd6[_0x1591('0x36')]=_[_0x1591('0x37')](_0x464be8[_0x1591('0x36')]);_0x2a8bd6['filters']=_[_0x1591('0x39')](_0x2a8bd6[_0x1591('0x34')],_0x2a8bd6[_0x1591('0x36')]);_0x553a50[_0x1591('0x4a')]=_[_0x1591('0x39')](_0x2a8bd6[_0x1591('0x34')],qs[_0x1591('0x3a')](_0x464be8[_0x1591('0x36')][_0x1591('0x3a')]));_0x553a50[_0x1591('0x4a')]=_0x553a50['attributes']['length']?_0x553a50[_0x1591('0x4a')]:_0x2a8bd6[_0x1591('0x34')];if(_0x464be8['query'][_0x1591('0x44')]){_0x553a50[_0x1591('0x45')]=[{'all':!![]}];}_0x553a50=_[_0x1591('0x42')]({},_0x553a50,_0x464be8[_0x1591('0x4b')]);return db['AnalyticCustomReport'][_0x1591('0x4c')](_0x553a50)['then'](handleEntityNotFound(_0x2048fa,null))[_0x1591('0x28')](respondWithResult(_0x2048fa,null))[_0x1591('0x47')](handleError(_0x2048fa,null));};exports[_0x1591('0x4d')]=function(_0x1bcddb,_0x11429f){return db[_0x1591('0x43')]['create'](_0x1bcddb['body'],{})[_0x1591('0x28')](function(_0x167808){var _0x131451=_0x1bcddb['user']['get']({'plain':!![]});if(!_0x131451)throw new Error(_0x1591('0x4e'));if(_0x131451[_0x1591('0x4f')]===_0x1591('0x50')){var _0x380e50=_0x167808[_0x1591('0x2a')]({'plain':!![]});var _0x5fce1=_0x1591('0x51');return db[_0x1591('0x52')][_0x1591('0x4c')]({'where':{'name':_0x5fce1,'userProfileId':_0x131451[_0x1591('0x53')]},'raw':!![]})[_0x1591('0x28')](function(_0x2680d9){if(_0x2680d9&&_0x2680d9[_0x1591('0x54')]===0x0){return db[_0x1591('0x55')][_0x1591('0x4d')]({'name':_0x380e50['name'],'resourceId':_0x380e50['id'],'type':_0x1591('0x2b'),'sectionId':_0x2680d9['id']},{})[_0x1591('0x28')](function(){return _0x167808;});}else{return _0x167808;}})[_0x1591('0x47')](function(_0xb8271){logger[_0x1591('0x56')](_0x1591('0x57'),_0xb8271);throw _0xb8271;});}return _0x167808;})['then'](respondWithResult(_0x11429f,0xc9))['catch'](handleError(_0x11429f,null));};exports[_0x1591('0x27')]=function(_0x510f13,_0x11ab77){if(_0x510f13[_0x1591('0x58')]['id']){delete _0x510f13[_0x1591('0x58')]['id'];}return db[_0x1591('0x43')][_0x1591('0x4c')]({'where':{'id':_0x510f13['params']['id']}})[_0x1591('0x28')](handleEntityNotFound(_0x11ab77,null))[_0x1591('0x28')](saveUpdates(_0x510f13[_0x1591('0x58')],null))[_0x1591('0x28')](respondWithResult(_0x11ab77,null))[_0x1591('0x47')](handleError(_0x11ab77,null));};exports['destroy']=function(_0x8925b6,_0x268ca4){return db['AnalyticCustomReport'][_0x1591('0x4c')]({'where':{'id':_0x8925b6['params']['id']}})[_0x1591('0x28')](handleEntityNotFound(_0x268ca4,null))[_0x1591('0x28')](removeEntity(_0x268ca4,null))[_0x1591('0x47')](handleError(_0x268ca4,null));};exports[_0x1591('0x59')]=function(_0x2dc04b,_0x2a5719){var _0x2611ed=0xa;var _0x363edb=[_0x1591('0x5a'),_0x1591('0x5b'),_0x1591('0x5c'),_0x1591('0x5d')];var _0x2f4ae3={'SUM':_0x1591('0x5e'),'COUNT':_0x1591('0x5f'),'COUNT DISTINCT':_0x1591('0x60'),'MAX':'MAX(%s)','MIN':_0x1591('0x61'),'AVG':_0x1591('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1591('0x63'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x9e4ff3={'SEC_TO_TIME':_0x1591('0x64'),'DATE':_0x1591('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x1591('0x66'),'UNIX_TIMESTAMP':_0x1591('0x67')};var _0x47a925=function(_0xe609bb){return!_[_0x1591('0x68')]([_0x1591('0x69'),_0x1591('0x6a'),_0x1591('0x6b'),'IS\x20NOT\x20EMPTY'],_0xe609bb);};var _0x296ced=function(_0x4fa0f3){if(!_0x4fa0f3||!_0x4fa0f3[_0x1591('0x6c')][_0x1591('0x3b')]){return'';}for(var _0xeb0464='(',_0x40b19a=0x0;_0x40b19a<_0x4fa0f3['rules'][_0x1591('0x3b')];_0x40b19a+=0x1){_0x40b19a>0x0&&(_0xeb0464+='\x20'+_0x4fa0f3['operator']+'\x20');_0xeb0464+=_0x4fa0f3[_0x1591('0x6c')][_0x40b19a][_0x1591('0x6d')]?_0x296ced(_0x4fa0f3[_0x1591('0x6c')][_0x40b19a]['group']):_0x4fa0f3['rules'][_0x40b19a][_0x1591('0x6e')]+'\x20'+_0x4fa0f3[_0x1591('0x6c')][_0x40b19a][_0x1591('0x6f')]+(_0x47a925(_0x4fa0f3[_0x1591('0x6c')][_0x40b19a][_0x1591('0x6f')])?'\x20'+_0x4fa0f3[_0x1591('0x6c')][_0x40b19a]['value']:'');}return _0xeb0464+')';};var _0x30bbd4={'where':{'id':_0x2dc04b[_0x1591('0x49')]['id']}},_0x3495db,_0x233ded,_0x3f7c94,_0x51d461,_0x2b73f0;_0x30bbd4=_['merge']({},_0x30bbd4,_0x2dc04b[_0x1591('0x4b')]);return db[_0x1591('0x43')][_0x1591('0x4c')](_0x30bbd4)[_0x1591('0x28')](function(_0x2a1c08){if(_0x2a1c08){_0x3495db=_0x2a1c08;return _0x2a1c08[_0x1591('0x70')]();}return null;})[_0x1591('0x28')](function(_0xf25c9b){if(_0xf25c9b){if(!_0xf25c9b[_0x1591('0x3b')]){throw new db['Sequelize'][(_0x1591('0x71'))](_0x1591('0x72'),0x193);}_0x233ded=_0xf25c9b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1591('0x28')](function(_0x15e2db){if(_0x15e2db){_0x3f7c94=_[_0x1591('0x73')](_0x15e2db,'id');var _0x272069;var _0x266393=squel[_0x1591('0x74')]();_0x266393[_0x1591('0x75')](_0x3495db['table']);for(var _0x3ffb0a=0x0;_0x3ffb0a<_0x233ded[_0x1591('0x3b')];_0x3ffb0a+=0x1){_0x272069=_0x233ded[_0x3ffb0a][_0x1591('0x76')]?_0x3f7c94[_0x233ded[_0x3ffb0a][_0x1591('0x76')]]['metric']:_0x233ded[_0x3ffb0a][_0x1591('0x6e')];_0x272069=_0x233ded[_0x3ffb0a][_0x1591('0x77')]?_[_0x1591('0x78')](_0x2f4ae3[_0x233ded[_0x3ffb0a]['function']],'%s',_0x272069):_0x272069;_0x272069=_0x233ded[_0x3ffb0a][_0x1591('0x79')]?_[_0x1591('0x78')](_0x9e4ff3[_0x233ded[_0x3ffb0a][_0x1591('0x79')]],'%s',_0x272069):_0x272069;if(_0x233ded[_0x3ffb0a]['groupBy']){_0x266393[_0x1591('0x6d')](_0x272069);}_0x233ded[_0x3ffb0a][_0x1591('0x7a')]&&_0x266393['order'](_0x272069,_0x233ded[_0x3ffb0a][_0x1591('0x7a')]===_0x1591('0x7b')?![]:!![]);_0x266393[_0x1591('0x6e')](_0x272069,_0x233ded[_0x3ffb0a][_0x1591('0x7c')]||_0x272069);}if(_0x3495db[_0x1591('0x7d')]){_0x3495db[_0x1591('0x7d')]=JSON['parse'](_0x3495db['joins']);for(var _0x48cdf8=0x0;_0x48cdf8<_0x3495db['joins'][_0x1591('0x3b')];_0x48cdf8+=0x1){if(_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x32')]&&_[_0x1591('0x68')](_0x363edb,_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x32')])&&_0x3495db['joins'][_0x48cdf8][_0x1591('0x7e')]&&_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x7f')]&&_0x3495db['joins'][_0x48cdf8][_0x1591('0x80')]){_0x266393[_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x32')]](_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x7f')],null,util[_0x1591('0x79')](_0x1591('0x81'),_0x3495db['table'],_0x3495db['joins'][_0x48cdf8][_0x1591('0x7e')],_0x3495db['joins'][_0x48cdf8][_0x1591('0x7f')],_0x3495db[_0x1591('0x7d')][_0x48cdf8][_0x1591('0x80')]));}}}if(_0x3495db[_0x1591('0x82')]){_0x3495db[_0x1591('0x82')]=JSON['parse'](_0x3495db['conditions']);_0x266393[_0x1591('0x3f')](_0x296ced(_0x3495db[_0x1591('0x82')][_0x1591('0x6d')]));}_0x2b73f0=_0x266393[_0x1591('0x83')]();_0x266393[_0x1591('0x1f')](_0x2611ed);_0x266393[_0x1591('0x1e')](0x0);logger[_0x1591('0x84')](_0x1591('0x85'),_0x266393[_0x1591('0x86')]());return dbH[_0x1591('0x87')][_0x1591('0x36')](_0x266393[_0x1591('0x86')](),{'type':dbH[_0x1591('0x87')][_0x1591('0x88')]['SELECT']});}})['then'](respondWithResult(_0x2a5719,null))[_0x1591('0x47')](handleError(_0x2a5719,null));};function runReport(_0x3bb919,_0xce14b,_0x1e54f){var _0x24bf51=_0xce14b[_0x1591('0x2d')];var _0x48b9ba=0xa;var _0x31796d=[_0x1591('0x5a'),_0x1591('0x5b'),_0x1591('0x5c'),'cross_join'];var _0x1b249f={'SUM':_0x1591('0x5e'),'COUNT':_0x1591('0x5f'),'COUNT DISTINCT':_0x1591('0x60'),'MAX':_0x1591('0x89'),'MIN':'MIN(%s)','AVG':_0x1591('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1591('0x63'),'GROUP_CONCAT DESC':_0x1591('0x8a')};var _0x9ddb5a={'SEC_TO_TIME':_0x1591('0x64'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x1591('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c765b=function(_0xa3e873){return!_[_0x1591('0x68')](['IS\x20NULL',_0x1591('0x6a'),_0x1591('0x6b'),_0x1591('0x8b')],_0xa3e873);};var _0x5b2102=function(_0x570034){if(!_0x570034||!_0x570034[_0x1591('0x6c')][_0x1591('0x3b')]){return'';}for(var _0x53a37a='(',_0x10a12a=0x0;_0x10a12a<_0x570034[_0x1591('0x6c')][_0x1591('0x3b')];_0x10a12a+=0x1){_0x10a12a>0x0&&(_0x53a37a+='\x20'+_0x570034[_0x1591('0x8c')]+'\x20');_0x53a37a+=_0x570034[_0x1591('0x6c')][_0x10a12a]['group']?_0x5b2102(_0x570034[_0x1591('0x6c')][_0x10a12a][_0x1591('0x6d')]):_0x570034[_0x1591('0x6c')][_0x10a12a]['field']+'\x20'+_0x570034['rules'][_0x10a12a][_0x1591('0x6f')]+(_0x5c765b(_0x570034['rules'][_0x10a12a]['condition'])?'\x20'+_0x570034[_0x1591('0x6c')][_0x10a12a][_0x1591('0x8d')]:'');}return _0x53a37a+')';};var _0x531622={'where':{'id':_0x3bb919['id']}},_0xfb2124,_0x3f2cff,_0x344fc5,_0x1b7d45,_0x340998;_0x531622=_[_0x1591('0x42')]({},_0x531622,_0x1e54f);return db['AnalyticCustomReport']['find'](_0x531622)[_0x1591('0x28')](function(_0x5f04f8){if(_0x5f04f8){_0xfb2124=_0x5f04f8;return _0x5f04f8[_0x1591('0x70')]();}return null;})[_0x1591('0x28')](function(_0x287dbf){if(_0x287dbf){if(!_0x287dbf[_0x1591('0x3b')]){throw new db[(_0x1591('0x8e'))][(_0x1591('0x71'))](_0x1591('0x72'),0x193);}_0x3f2cff=_0x287dbf;return db[_0x1591('0x8f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5784b7){if(_0x5784b7){_0x344fc5=_[_0x1591('0x73')](_0x5784b7,'id');var _0x618f80;var _0x28f4cb=squel[_0x1591('0x74')]();_0x28f4cb['from'](_0xfb2124[_0x1591('0x90')]);for(var _0x3bdcd9=0x0;_0x3bdcd9<_0x3f2cff[_0x1591('0x3b')];_0x3bdcd9+=0x1){_0x618f80=_0x3f2cff[_0x3bdcd9][_0x1591('0x76')]?_0x344fc5[_0x3f2cff[_0x3bdcd9][_0x1591('0x76')]][_0x1591('0x91')]:_0x3f2cff[_0x3bdcd9]['field'];_0x618f80=_0x3f2cff[_0x3bdcd9]['function']?_[_0x1591('0x78')](_0x1b249f[_0x3f2cff[_0x3bdcd9][_0x1591('0x77')]],'%s',_0x618f80):_0x618f80;_0x618f80=_0x3f2cff[_0x3bdcd9][_0x1591('0x79')]?_[_0x1591('0x78')](_0x9ddb5a[_0x3f2cff[_0x3bdcd9][_0x1591('0x79')]],'%s',_0x618f80):_0x618f80;if(_0x3f2cff[_0x3bdcd9][_0x1591('0x92')]){_0x28f4cb[_0x1591('0x6d')](_0x618f80);}_0x3f2cff[_0x3bdcd9][_0x1591('0x7a')]&&_0x28f4cb[_0x1591('0x3d')](_0x618f80,_0x3f2cff[_0x3bdcd9][_0x1591('0x7a')]===_0x1591('0x7b')?![]:!![]);_0x28f4cb[_0x1591('0x6e')](_0x618f80,_0x3f2cff[_0x3bdcd9][_0x1591('0x7c')]||_0x618f80);}if(_0xfb2124[_0x1591('0x7d')]){_0xfb2124['joins']=JSON[_0x1591('0x93')](_0xfb2124['joins']);for(var _0x548926=0x0;_0x548926<_0xfb2124['joins']['length'];_0x548926+=0x1){if(_0xfb2124[_0x1591('0x7d')][_0x548926]['type']&&_['includes'](_0x31796d,_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x32')])&&_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x7e')]&&_0xfb2124[_0x1591('0x7d')][_0x548926]['foreignTable']&&_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x80')]){_0x28f4cb[_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x32')]](_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0xfb2124[_0x1591('0x90')],_0xfb2124['joins'][_0x548926]['parentKey'],_0xfb2124['joins'][_0x548926][_0x1591('0x7f')],_0xfb2124[_0x1591('0x7d')][_0x548926][_0x1591('0x80')]));}}}if(_0xfb2124['conditions']){_0xfb2124[_0x1591('0x82')]=JSON[_0x1591('0x93')](_0xfb2124[_0x1591('0x82')]);_0x28f4cb[_0x1591('0x3f')](_0x5b2102(_0xfb2124[_0x1591('0x82')]['group']));}_0x340998=_0x28f4cb[_0x1591('0x83')]();_0x28f4cb['limit'](_0x48b9ba);_0x28f4cb[_0x1591('0x1e')](0x0);return;}})[_0x1591('0x28')](function(){if(_0xce14b[_0x1591('0x94')]==='web'){return null;}var _0x837e50=_[_0x1591('0x42')](_0xce14b,{'name':_0xce14b[_0x1591('0x95')]||_0xce14b[_0x1591('0x2d')]||_0xfb2124[_0x1591('0x2d')],'basename':_0x24bf51,'savename':util[_0x1591('0x79')]('%s-%s.%s',_0xce14b['name']||_0xfb2124[_0x1591('0x2d')],require(_0x1591('0x96'))[_0x1591('0x97')](0x4),_0xce14b[_0x1591('0x94')]||_0x1591('0x98')),'reportId':_0xfb2124['id'],'reportType':'custom'});return db[_0x1591('0x99')][_0x1591('0x4d')](_0x837e50,{'raw':!![]});})[_0x1591('0x28')](function(_0x3e5077){if(_0xfb2124[_0x1591('0x90')]===_0x1591('0x9a')){_0x340998['where'](_0xfb2124[_0x1591('0x90')]+_0x1591('0x9b'),_0xce14b['startDate'],_0xce14b[_0x1591('0x9c')]);}else{_0x340998[_0x1591('0x3f')](_0xfb2124[_0x1591('0x90')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xce14b[_0x1591('0x9d')],_0xce14b[_0x1591('0x9c')]);}if(_0x3e5077){logger[_0x1591('0x9e')](_0x1591('0x9f'),_0x340998[_0x1591('0x86')]());require(_0x1591('0xa0'))[_0x1591('0xa1')](path['join'](__dirname,_0x1591('0xa2'),_0x3e5077[_0x1591('0x94')]),[_0x3e5077['id'],_0x340998[_0x1591('0x86')](),path[_0x1591('0x5a')](__dirname,_0x1591('0xa3'),_0x3e5077['savename']),_0x24bf51]);return _0x3e5077;}else{var _0xfd8a7a=squel[_0x1591('0x74')]();_0xfd8a7a[_0x1591('0x75')]('('+_0x340998[_0x1591('0x86')]()+')',_0x1591('0xa4'));_0xfd8a7a[_0x1591('0x6e')](_0x1591('0xa5'),_0x1591('0x21'));_0x340998[_0x1591('0x1f')](_0xce14b[_0x1591('0x1f')]||_0x48b9ba);_0x340998[_0x1591('0x1e')](_0xce14b[_0x1591('0x1e')]||0x0);return dbH[_0x1591('0x87')]['query'](_0xfd8a7a[_0x1591('0x86')](),{'type':dbH[_0x1591('0x87')][_0x1591('0x88')][_0x1591('0xa6')]})[_0x1591('0x28')](function(_0x4fc62f){if(!_0x4fc62f[_0x1591('0x3b')]){_0x1b7d45=0x0;}else{_0x1b7d45=_0x4fc62f[0x0]['count']||0x0;}return dbH[_0x1591('0x87')][_0x1591('0x36')](_0x340998[_0x1591('0x86')](),{'type':dbH[_0x1591('0x87')][_0x1591('0x88')][_0x1591('0xa6')]});})[_0x1591('0x28')](function(_0x4bba07){return{'rows':_0x4bba07||[],'count':_0x1b7d45};});}});}exports['run']=function(_0x3b2917,_0x31f320){return runReport(_0x3b2917[_0x1591('0x49')],_0x3b2917[_0x1591('0x36')],_0x3b2917[_0x1591('0x4b')])[_0x1591('0x28')](respondWithResult(_0x31f320,null))[_0x1591('0x47')](handleError(_0x31f320,null));};exports[_0x1591('0xa7')]=runReport;exports[_0x1591('0x36')]=function(_0x5dbd56,_0x173fd9){var _0x5469e3=0xa;var _0x283d7f=[_0x1591('0x5a'),'left_join',_0x1591('0x5c'),'cross_join'];var _0x2c0002={'SUM':_0x1591('0x5e'),'COUNT':_0x1591('0x5f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x1591('0x62'),'GROUP_CONCAT':_0x1591('0xa8'),'GROUP_CONCAT ASC':_0x1591('0x63'),'GROUP_CONCAT DESC':_0x1591('0x8a')};var _0x49e4ce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x1591('0xa9'),'ROUND':_0x1591('0x66'),'UNIX_TIMESTAMP':_0x1591('0x67')};var _0x21f5a5=function(_0xd6c97a){return!_[_0x1591('0x68')](['IS\x20NULL',_0x1591('0x6a'),'IS\x20EMPTY',_0x1591('0x8b')],_0xd6c97a);};var _0x17e892=function(_0x15ba9b){if(!_0x15ba9b||!_0x15ba9b[_0x1591('0x6c')][_0x1591('0x3b')]){return'';}for(var _0x19f6b5='(',_0x333ef8=0x0;_0x333ef8<_0x15ba9b['rules'][_0x1591('0x3b')];_0x333ef8+=0x1){_0x333ef8>0x0&&(_0x19f6b5+='\x20'+_0x15ba9b[_0x1591('0x8c')]+'\x20');_0x19f6b5+=_0x15ba9b[_0x1591('0x6c')][_0x333ef8][_0x1591('0x6d')]?_0x17e892(_0x15ba9b[_0x1591('0x6c')][_0x333ef8][_0x1591('0x6d')]):_0x15ba9b['rules'][_0x333ef8][_0x1591('0x6e')]+'\x20'+_0x15ba9b[_0x1591('0x6c')][_0x333ef8][_0x1591('0x6f')]+(_0x21f5a5(_0x15ba9b['rules'][_0x333ef8][_0x1591('0x6f')])?'\x20'+_0x15ba9b[_0x1591('0x6c')][_0x333ef8]['value']:'');}return _0x19f6b5+')';};var _0x448a8d={'where':{'id':_0x5dbd56[_0x1591('0x49')]['id']}},_0x29605d,_0x4f2b05,_0x4dac53,_0x3536f4,_0x5dff38;_0x448a8d=_['merge']({},_0x448a8d,_0x5dbd56[_0x1591('0x4b')]);return db[_0x1591('0x43')][_0x1591('0x4c')](_0x448a8d)[_0x1591('0x28')](function(_0x3ac8fa){if(_0x3ac8fa){_0x29605d=_0x3ac8fa;return _0x3ac8fa['getFields']();}return null;})['then'](function(_0x59ac19){if(_0x59ac19){if(!_0x59ac19['length']){throw new db[(_0x1591('0x8e'))]['ValidationErrorItem'](_0x1591('0x72'),0x193);}_0x4f2b05=_0x59ac19;return db[_0x1591('0x8f')][_0x1591('0xaa')]({'raw':!![]});}return null;})[_0x1591('0x28')](function(_0x221adc){if(_0x221adc){_0x4dac53=_['keyBy'](_0x221adc,'id');var _0x4a3329;var _0x980ecd=squel[_0x1591('0x74')]();_0x980ecd[_0x1591('0x75')](_0x29605d[_0x1591('0x90')]);for(var _0x4b087e=0x0;_0x4b087e<_0x4f2b05['length'];_0x4b087e+=0x1){_0x4a3329=_0x4f2b05[_0x4b087e]['MetricId']?_0x4dac53[_0x4f2b05[_0x4b087e][_0x1591('0x76')]][_0x1591('0x91')]:_0x4f2b05[_0x4b087e]['field'];_0x4a3329=_0x4f2b05[_0x4b087e][_0x1591('0x77')]?_['replace'](_0x2c0002[_0x4f2b05[_0x4b087e][_0x1591('0x77')]],'%s',_0x4a3329):_0x4a3329;_0x4a3329=_0x4f2b05[_0x4b087e]['format']?_['replace'](_0x49e4ce[_0x4f2b05[_0x4b087e][_0x1591('0x79')]],'%s',_0x4a3329):_0x4a3329;if(_0x4f2b05[_0x4b087e]['groupBy']){_0x980ecd[_0x1591('0x6d')](_0x4a3329);}_0x4f2b05[_0x4b087e][_0x1591('0x7a')]&&_0x980ecd[_0x1591('0x3d')](_0x4a3329,_0x4f2b05[_0x4b087e][_0x1591('0x7a')]==='DESC'?![]:!![]);_0x980ecd[_0x1591('0x6e')](_0x4a3329,_0x4f2b05[_0x4b087e][_0x1591('0x7c')]||_0x4a3329);}if(_0x29605d['joins']){_0x29605d[_0x1591('0x7d')]=JSON[_0x1591('0x93')](_0x29605d[_0x1591('0x7d')]);for(var _0x2d78a4=0x0;_0x2d78a4<_0x29605d[_0x1591('0x7d')]['length'];_0x2d78a4+=0x1){if(_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x32')]&&_[_0x1591('0x68')](_0x283d7f,_0x29605d[_0x1591('0x7d')][_0x2d78a4]['type'])&&_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x7e')]&&_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x7f')]&&_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x80')]){_0x980ecd[_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x32')]](_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x7f')],null,util[_0x1591('0x79')]('%s.%s\x20=\x20%s.%s',_0x29605d[_0x1591('0x90')],_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x7e')],_0x29605d[_0x1591('0x7d')][_0x2d78a4]['foreignTable'],_0x29605d[_0x1591('0x7d')][_0x2d78a4][_0x1591('0x80')]));}}}if(_0x29605d[_0x1591('0x82')]){_0x29605d[_0x1591('0x82')]=JSON[_0x1591('0x93')](_0x29605d[_0x1591('0x82')]);_0x980ecd[_0x1591('0x3f')](_0x17e892(_0x29605d[_0x1591('0x82')][_0x1591('0x6d')]));}_0x5dff38=_0x980ecd['clone']();_0x980ecd['limit'](_0x5469e3);_0x980ecd[_0x1591('0x1e')](0x0);logger[_0x1591('0x84')](_0x1591('0x85'),_0x980ecd[_0x1591('0x86')]());return dbH[_0x1591('0x87')][_0x1591('0x36')](_0x980ecd['toString'](),{'type':dbH[_0x1591('0x87')][_0x1591('0x88')]['SELECT']});}})['then'](function(){return{'sql':_0x5dff38[_0x1591('0x86')]()};})[_0x1591('0x28')](respondWithResult(_0x173fd9,null))[_0x1591('0x47')](handleError(_0x173fd9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a32977c..f62a7c9 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 _0x491d=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','moment','request-promise','path','rimraf'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x491d,0x191));var _0xd491=function(_0x1fde7c,_0x4abc12){_0x1fde7c=_0x1fde7c-0x0;var _0xe736de=_0x491d[_0x1fde7c];return _0xe736de;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd491('0x0'));var BPromise=require('bluebird');var rp=require(_0xd491('0x1'));var fs=require('fs');var path=require(_0xd491('0x2'));var rimraf=require(_0xd491('0x3'));var config=require(_0xd491('0x4'));var attributes=require(_0xd491('0x5'));module[_0xd491('0x6')]=function(_0x47ba38,_0x1da043){return _0x47ba38[_0xd491('0x7')](_0xd491('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4747=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x460358,_0x354877){var _0xdfdfa8=function(_0x4cc317){while(--_0x4cc317){_0x460358['push'](_0x460358['shift']());}};_0xdfdfa8(++_0x354877);}(_0x4747,0xc7));var _0x7474=function(_0x4acdef,_0x3cc14f){_0x4acdef=_0x4acdef-0x0;var _0x3822f3=_0x4747[_0x4acdef];return _0x3822f3;};'use strict';var _=require(_0x7474('0x0'));var util=require(_0x7474('0x1'));var logger=require('../../config/logger')(_0x7474('0x2'));var moment=require(_0x7474('0x3'));var BPromise=require(_0x7474('0x4'));var rp=require(_0x7474('0x5'));var fs=require('fs');var path=require(_0x7474('0x6'));var rimraf=require(_0x7474('0x7'));var config=require(_0x7474('0x8'));var attributes=require(_0x7474('0x9'));module[_0x7474('0xa')]=function(_0x300f2b,_0x34de82){return _0x300f2b[_0x7474('0xb')](_0x7474('0xc'),attributes,{'tableName':_0x7474('0xd'),'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 c0d2361..2d72130 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 _0x1807=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x397c66,_0x39a39e){var _0x1caacf=function(_0x1565d5){while(--_0x1565d5){_0x397c66['push'](_0x397c66['shift']());}};_0x1caacf(++_0x39a39e);}(_0x1807,0x164));var _0x7180=function(_0x2947d1,_0x5e70b0){_0x2947d1=_0x2947d1-0x0;var _0x2b36a5=_0x1807[_0x2947d1];return _0x2b36a5;};'use strict';var _=require(_0x7180('0x0'));var util=require('util');var moment=require(_0x7180('0x1'));var BPromise=require(_0x7180('0x2'));var rs=require(_0x7180('0x3'));var fs=require('fs');var Redis=require(_0x7180('0x4'));var db=require(_0x7180('0x5'))['db'];var utils=require(_0x7180('0x6'));var logger=require('../../config/logger')(_0x7180('0x7'));var config=require('../../config/environment');var jayson=require(_0x7180('0x8'));var client=jayson[_0x7180('0x9')][_0x7180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc272,_0x3ea5c3,_0x451851){return new BPromise(function(_0x28f7db,_0x35ed57){return client[_0x7180('0xb')](_0x2dc272,_0x451851)[_0x7180('0xc')](function(_0x1bd6b2){logger[_0x7180('0xd')](_0x7180('0xe'),_0x3ea5c3,'request\x20sent');logger[_0x7180('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3ea5c3,_0x7180('0x10'),JSON[_0x7180('0x11')](_0x1bd6b2));if(_0x1bd6b2[_0x7180('0x12')]){if(_0x1bd6b2[_0x7180('0x12')][_0x7180('0x13')]===0x1f4){logger['error'](_0x7180('0xe'),_0x3ea5c3,_0x1bd6b2[_0x7180('0x12')][_0x7180('0x14')]);return _0x35ed57(_0x1bd6b2[_0x7180('0x12')][_0x7180('0x14')]);}logger['error'](_0x7180('0xe'),_0x3ea5c3,_0x1bd6b2[_0x7180('0x12')][_0x7180('0x14')]);return _0x28f7db(_0x1bd6b2[_0x7180('0x12')]['message']);}else{logger[_0x7180('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3ea5c3,_0x7180('0x10'));_0x28f7db(_0x1bd6b2['result'][_0x7180('0x14')]);}})[_0x7180('0x15')](function(_0x38d08d){logger[_0x7180('0x12')](_0x7180('0xe'),_0x3ea5c3,_0x38d08d);_0x35ed57(_0x38d08d);});});} \ No newline at end of file +var _0xafa0=['client','request','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticCustomReport,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5ef73c,_0x49584c){var _0x3d3736=function(_0x32b1ad){while(--_0x32b1ad){_0x5ef73c['push'](_0x5ef73c['shift']());}};_0x3d3736(++_0x49584c);}(_0xafa0,0x181));var _0x0afa=function(_0x4382e7,_0x2e599c){_0x4382e7=_0x4382e7-0x0;var _0x5d0666=_0xafa0[_0x4382e7];return _0x5d0666;};'use strict';var _=require(_0x0afa('0x0'));var util=require(_0x0afa('0x1'));var moment=require(_0x0afa('0x2'));var BPromise=require(_0x0afa('0x3'));var rs=require(_0x0afa('0x4'));var fs=require('fs');var Redis=require(_0x0afa('0x5'));var db=require(_0x0afa('0x6'))['db'];var utils=require(_0x0afa('0x7'));var logger=require(_0x0afa('0x8'))(_0x0afa('0x9'));var config=require('../../config/environment');var jayson=require(_0x0afa('0xa'));var client=jayson[_0x0afa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c45bc,_0x42c026,_0x353ddc){return new BPromise(function(_0x1727bc,_0x133092){return client[_0x0afa('0xc')](_0x4c45bc,_0x353ddc)['then'](function(_0x4437ba){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x42c026,_0x0afa('0xd'));logger[_0x0afa('0xe')](_0x0afa('0xf'),_0x42c026,_0x0afa('0xd'),JSON[_0x0afa('0x10')](_0x4437ba));if(_0x4437ba[_0x0afa('0x11')]){if(_0x4437ba['error']['code']===0x1f4){logger[_0x0afa('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x42c026,_0x4437ba['error'][_0x0afa('0x12')]);return _0x133092(_0x4437ba['error'][_0x0afa('0x12')]);}logger[_0x0afa('0x11')](_0x0afa('0x13'),_0x42c026,_0x4437ba['error'][_0x0afa('0x12')]);return _0x1727bc(_0x4437ba['error'][_0x0afa('0x12')]);}else{logger[_0x0afa('0x14')](_0x0afa('0x13'),_0x42c026,_0x0afa('0xd'));_0x1727bc(_0x4437ba[_0x0afa('0x15')][_0x0afa('0x12')]);}})['catch'](function(_0x2fb52b){logger[_0x0afa('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x42c026,_0x2fb52b);_0x133092(_0x2fb52b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 624abfe..3f38edc 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 _0x00a4=['index','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','query','create','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00a4,0x131));var _0x400a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00a4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x400a('0x0'));var util=require(_0x400a('0x1'));var path=require(_0x400a('0x2'));var timeout=require(_0x400a('0x3'));var express=require(_0x400a('0x4'));var router=express[_0x400a('0x5')]();var fs_extra=require(_0x400a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x400a('0x7'));var config=require(_0x400a('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x400a('0x9')]('/',auth['isAuthenticated'](),controller[_0x400a('0xa')]);router[_0x400a('0x9')]('/:id',auth[_0x400a('0xb')](),controller[_0x400a('0xc')]);router[_0x400a('0x9')](_0x400a('0xd'),auth[_0x400a('0xb')](),controller['preview']);router[_0x400a('0x9')](_0x400a('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x400a('0x9')](_0x400a('0xf'),auth[_0x400a('0xb')](),controller[_0x400a('0x10')]);router['post']('/',auth[_0x400a('0xb')](),controller[_0x400a('0x11')]);router['put']('/:id',auth[_0x400a('0xb')](),controller[_0x400a('0x12')]);router['delete'](_0x400a('0x13'),auth[_0x400a('0xb')](),controller['destroy']);module[_0x400a('0x14')]=router; \ No newline at end of file +var _0x5b90=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','update','delete','destroy','multer','connect-timeout','fs-extra'];(function(_0x500f29,_0x1beb00){var _0x5aac00=function(_0x5cf6fa){while(--_0x5cf6fa){_0x500f29['push'](_0x500f29['shift']());}};_0x5aac00(++_0x1beb00);}(_0x5b90,0x12d));var _0x05b9=function(_0x45f985,_0x26488c){_0x45f985=_0x45f985-0x0;var _0x5e337a=_0x5b90[_0x45f985];return _0x5e337a;};'use strict';var multer=require(_0x05b9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05b9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x05b9('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x05b9('0x3'));var config=require(_0x05b9('0x4'));var controller=require('./analyticCustomReport.controller');router[_0x05b9('0x5')]('/',auth[_0x05b9('0x6')](),controller[_0x05b9('0x7')]);router[_0x05b9('0x5')](_0x05b9('0x8'),auth[_0x05b9('0x6')](),controller[_0x05b9('0x9')]);router[_0x05b9('0x5')]('/:id/preview',auth[_0x05b9('0x6')](),controller[_0x05b9('0xa')]);router[_0x05b9('0x5')](_0x05b9('0xb'),auth[_0x05b9('0x6')](),controller[_0x05b9('0xc')]);router[_0x05b9('0x5')](_0x05b9('0xd'),auth[_0x05b9('0x6')](),controller[_0x05b9('0xe')]);router[_0x05b9('0xf')]('/',auth[_0x05b9('0x6')](),controller['create']);router['put'](_0x05b9('0x8'),auth[_0x05b9('0x6')](),controller[_0x05b9('0x10')]);router[_0x05b9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05b9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 14ed079..e886c75 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 _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x6aa7,0x178));var _0x76aa=function(_0x54910b,_0x5abaa9){_0x54910b=_0x54910b-0x0;var _0x1ba61b=_0x6aa7[_0x54910b];return _0x1ba61b;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x4dbb3f,_0x3c9555){var _0x1512ee=function(_0x5265be){while(--_0x5265be){_0x4dbb3f['push'](_0x4dbb3f['shift']());}};_0x1512ee(++_0x3c9555);}(_0xabce,0x103));var _0xeabc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xabce[_0x3bf83f];return _0x22c4a9;};'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 47820cc..6548a87 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 _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x56e10d,_0x2caedd){var _0x520c9a=function(_0x433621){while(--_0x433621){_0x56e10d['push'](_0x56e10d['shift']());}};_0x520c9a(++_0x2caedd);}(_0x1261,0x144));var _0x1126=function(_0x8b1a5e,_0x2744eb){_0x8b1a5e=_0x8b1a5e-0x0;var _0x1146b1=_0x1261[_0x8b1a5e];return _0x1146b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file +var _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 28a5f66..f8a72d9 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 _0x43e5=['define','analytics_default_reports','lodash','util','../../config/logger','api','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x4dacdc,_0xa808bc){var _0x1ade93=function(_0x1c7eed){while(--_0x1c7eed){_0x4dacdc['push'](_0x4dacdc['shift']());}};_0x1ade93(++_0xa808bc);}(_0x43e5,0x1d8));var _0x543e=function(_0x3853c9,_0xe60140){_0x3853c9=_0x3853c9-0x0;var _0x40d922=_0x43e5[_0x3853c9];return _0x40d922;};'use strict';var _=require(_0x543e('0x0'));var util=require(_0x543e('0x1'));var logger=require(_0x543e('0x2'))(_0x543e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x543e('0x4'));var config=require(_0x543e('0x5'));var attributes=require(_0x543e('0x6'));module[_0x543e('0x7')]=function(_0x32e388,_0x12d98b){return _0x32e388[_0x543e('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x543e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37ce=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x372a44,_0x306f75){var _0x3c1075=function(_0x41749f){while(--_0x41749f){_0x372a44['push'](_0x372a44['shift']());}};_0x3c1075(++_0x306f75);}(_0x37ce,0x1dc));var _0xe37c=function(_0x5f35fb,_0x2bd89b){_0x5f35fb=_0x5f35fb-0x0;var _0x5b10c9=_0x37ce[_0x5f35fb];return _0x5b10c9;};'use strict';var _=require(_0xe37c('0x0'));var util=require(_0xe37c('0x1'));var logger=require(_0xe37c('0x2'))(_0xe37c('0x3'));var moment=require(_0xe37c('0x4'));var BPromise=require(_0xe37c('0x5'));var rp=require(_0xe37c('0x6'));var fs=require('fs');var path=require(_0xe37c('0x7'));var rimraf=require(_0xe37c('0x8'));var config=require('../../config/environment');var attributes=require(_0xe37c('0x9'));module[_0xe37c('0xa')]=function(_0x55cc9b,_0x5abb61){return _0x55cc9b[_0xe37c('0xb')](_0xe37c('0xc'),attributes,{'tableName':_0xe37c('0xd'),'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 b8c3213..ae2acf4 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 _0x1383=['error','message','result','catch','AnalyticDefaultReport,\x20%s,\x20%s','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1383,0x149));var _0x3138=function(_0x22c1c3,_0x1ac427){_0x22c1c3=_0x22c1c3-0x0;var _0x38aeed=_0x1383[_0x22c1c3];return _0x38aeed;};'use strict';var _=require(_0x3138('0x0'));var util=require(_0x3138('0x1'));var moment=require('moment');var BPromise=require(_0x3138('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3138('0x3'))['db'];var utils=require(_0x3138('0x4'));var logger=require(_0x3138('0x5'))(_0x3138('0x6'));var config=require(_0x3138('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3138('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1883fe,_0x2ff86d,_0x3f0b53){return new BPromise(function(_0x473082,_0x561e58){return client['request'](_0x1883fe,_0x3f0b53)[_0x3138('0x9')](function(_0x1fa379){logger[_0x3138('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ff86d,_0x3138('0xb'));logger[_0x3138('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2ff86d,'request\x20sent',JSON['stringify'](_0x1fa379));if(_0x1fa379['error']){if(_0x1fa379[_0x3138('0xd')]['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ff86d,_0x1fa379['error'][_0x3138('0xe')]);return _0x561e58(_0x1fa379[_0x3138('0xd')][_0x3138('0xe')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ff86d,_0x1fa379['error'][_0x3138('0xe')]);return _0x473082(_0x1fa379[_0x3138('0xd')]['message']);}else{logger[_0x3138('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ff86d,_0x3138('0xb'));_0x473082(_0x1fa379[_0x3138('0xf')][_0x3138('0xe')]);}})[_0x3138('0x10')](function(_0x2020cf){logger[_0x3138('0xd')](_0x3138('0x11'),_0x2ff86d,_0x2020cf);_0x561e58(_0x2020cf);});});} \ No newline at end of file +var _0xa07c=['request\x20sent','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5de8f1,_0x1b32f2){var _0x2fb8e6=function(_0x488e06){while(--_0x488e06){_0x5de8f1['push'](_0x5de8f1['shift']());}};_0x2fb8e6(++_0x1b32f2);}(_0xa07c,0x112));var _0xca07=function(_0x4dbe6e,_0x20f19b){_0x4dbe6e=_0x4dbe6e-0x0;var _0x3b62e8=_0xa07c[_0x4dbe6e];return _0x3b62e8;};'use strict';var _=require('lodash');var util=require(_0xca07('0x0'));var moment=require(_0xca07('0x1'));var BPromise=require(_0xca07('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca07('0x3'))['db'];var utils=require(_0xca07('0x4'));var logger=require(_0xca07('0x5'))('rpc');var config=require(_0xca07('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca07('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x439dbb,_0x6f9f44,_0x2db6cc){return new BPromise(function(_0x58fb81,_0x4883eb){return client['request'](_0x439dbb,_0x2db6cc)[_0xca07('0x8')](function(_0x22729e){logger[_0xca07('0x9')](_0xca07('0xa'),_0x6f9f44,'request\x20sent');logger[_0xca07('0xb')](_0xca07('0xc'),_0x6f9f44,'request\x20sent',JSON['stringify'](_0x22729e));if(_0x22729e[_0xca07('0xd')]){if(_0x22729e[_0xca07('0xd')]['code']===0x1f4){logger['error'](_0xca07('0xa'),_0x6f9f44,_0x22729e[_0xca07('0xd')]['message']);return _0x4883eb(_0x22729e[_0xca07('0xd')][_0xca07('0xe')]);}logger['error'](_0xca07('0xa'),_0x6f9f44,_0x22729e['error']['message']);return _0x58fb81(_0x22729e[_0xca07('0xd')][_0xca07('0xe')]);}else{logger[_0xca07('0x9')](_0xca07('0xa'),_0x6f9f44,_0xca07('0xf'));_0x58fb81(_0x22729e['result'][_0xca07('0xe')]);}})[_0xca07('0x10')](function(_0x5a7f61){logger['error'](_0xca07('0xa'),_0x6f9f44,_0x5a7f61);_0x4883eb(_0x5a7f61);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e546737..fa7fa3a 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 _0xf22d=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put'];(function(_0x31902b,_0x5c9cac){var _0x2d7b70=function(_0x49230c){while(--_0x49230c){_0x31902b['push'](_0x31902b['shift']());}};_0x2d7b70(++_0x5c9cac);}(_0xf22d,0x150));var _0xdf22=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0xf22d[_0x15b399];return _0x199f2d;};'use strict';var multer=require(_0xdf22('0x0'));var util=require('util');var path=require(_0xdf22('0x1'));var timeout=require(_0xdf22('0x2'));var express=require(_0xdf22('0x3'));var router=express['Router']();var fs_extra=require(_0xdf22('0x4'));var auth=require(_0xdf22('0x5'));var interaction=require(_0xdf22('0x6'));var config=require('../../config/environment');var controller=require(_0xdf22('0x7'));router[_0xdf22('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf22('0x9')]);router[_0xdf22('0x8')](_0xdf22('0xa'),auth[_0xdf22('0xb')](),controller[_0xdf22('0xc')]);router[_0xdf22('0x8')](_0xdf22('0xd'),auth['isAuthenticated'](),controller[_0xdf22('0xe')]);router[_0xdf22('0x8')](_0xdf22('0xf'),auth[_0xdf22('0xb')](),controller[_0xdf22('0x10')]);router[_0xdf22('0x8')](_0xdf22('0x11'),auth[_0xdf22('0xb')](),controller[_0xdf22('0x12')]);router[_0xdf22('0x13')]('/',auth[_0xdf22('0xb')](),controller['create']);router[_0xdf22('0x14')](_0xdf22('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdf22('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x01a7=['query','create','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run'];(function(_0x577210,_0x1a0966){var _0x1991b1=function(_0x4d61ff){while(--_0x4d61ff){_0x577210['push'](_0x577210['shift']());}};_0x1991b1(++_0x1a0966);}(_0x01a7,0x17e));var _0x701a=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x01a7[_0x32729c];return _0x482cfd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x701a('0x0'));var express=require(_0x701a('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x701a('0x2'));var interaction=require(_0x701a('0x3'));var config=require(_0x701a('0x4'));var controller=require(_0x701a('0x5'));router[_0x701a('0x6')]('/',auth[_0x701a('0x7')](),controller[_0x701a('0x8')]);router['get'](_0x701a('0x9'),auth[_0x701a('0x7')](),controller[_0x701a('0xa')]);router['get'](_0x701a('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x701a('0x6')](_0x701a('0xc'),auth[_0x701a('0x7')](),controller[_0x701a('0xd')]);router[_0x701a('0x6')]('/:id/query',auth[_0x701a('0x7')](),controller[_0x701a('0xe')]);router['post']('/',auth[_0x701a('0x7')](),controller[_0x701a('0xf')]);router['put'](_0x701a('0x9'),auth[_0x701a('0x7')](),controller['update']);router['delete'](_0x701a('0x9'),auth[_0x701a('0x7')](),controller[_0x701a('0x10')]);module[_0x701a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f5b628c..b574bb9 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 _0x6b5d=['UNSIGNED','sequelize','exports','csv','pdf','xlsx','STRING','Loading','ENUM','manual','scheduled'];(function(_0x27496e,_0x5603ac){var _0x90dca4=function(_0x475fea){while(--_0x475fea){_0x27496e['push'](_0x27496e['shift']());}};_0x90dca4(++_0x5603ac);}(_0x6b5d,0x1cf));var _0xd6b5=function(_0x3fa753,_0x13227c){_0x3fa753=_0x3fa753-0x0;var _0x12d828=_0x6b5d[_0x3fa753];return _0x12d828;};'use strict';var Sequelize=require(_0xd6b5('0x0'));var moment=require('moment');module[_0xd6b5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd6b5('0x2'),_0xd6b5('0x3'),_0xd6b5('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd6b5('0x5')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xd6b5('0x5')],'defaultValue':_0xd6b5('0x6')},'type':{'type':Sequelize[_0xd6b5('0x7')](_0xd6b5('0x8'),_0xd6b5('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xd6b5('0xa')]},'reportType':{'type':Sequelize[_0xd6b5('0x5')]}}; \ No newline at end of file +var _0x1769=['sequelize','exports','STRING','csv','pdf','DATE','Loading','ENUM','scheduled','INTEGER'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x1769,0xf0));var _0x9176=function(_0x1279d3,_0x221755){_0x1279d3=_0x1279d3-0x0;var _0x3f2a8f=_0x1769[_0x1279d3];return _0x3f2a8f;};'use strict';var Sequelize=require(_0x9176('0x0'));var moment=require('moment');module[_0x9176('0x1')]={'name':{'type':Sequelize[_0x9176('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9176('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x9176('0x3'),_0x9176('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x9176('0x3')},'savename':{'type':Sequelize[_0x9176('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9176('0x5')]},'endDate':{'type':Sequelize[_0x9176('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9176('0x6')},'type':{'type':Sequelize[_0x9176('0x7')]('manual',_0x9176('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x9176('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x9176('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fbc0128..c3ffa8b 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 _0x1735=['output','existsSync','join','Report\x20not\x20found\x20or\x20empty','exists','download','root','server/files/reports','format','toLowerCase','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','create','user','role','ExtractedReports','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x1735,0x176));var _0x5173=function(_0x245208,_0x5ed2c6){_0x245208=_0x245208-0x0;var _0x5187dc=_0x1735[_0x245208];return _0x5187dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5173('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5173('0x1'));var rp=require('request-promise');var moment=require(_0x5173('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5173('0x3'));var util=require(_0x5173('0x4'));var path=require('path');var sox=require(_0x5173('0x5'));var csv=require(_0x5173('0x6'));var ejs=require(_0x5173('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5173('0x8'));var squel=require(_0x5173('0x9'));var crypto=require(_0x5173('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5173('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5173('0xc'));var Redis=require('ioredis');var authService=require(_0x5173('0xd'));var qs=require(_0x5173('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5173('0xf'));var logger=require(_0x5173('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5173('0x11'));var db=require(_0x5173('0x12'))['db'];function respondWithStatusCode(_0x4c52d2,_0x5654f4){_0x5654f4=_0x5654f4||0xcc;return function(_0x5391e1){if(_0x5391e1){return _0x4c52d2[_0x5173('0x13')](_0x5654f4);}return _0x4c52d2['status'](_0x5654f4)['end']();};}function respondWithResult(_0x1fcb31,_0x3521de){_0x3521de=_0x3521de||0xc8;return function(_0x389a3f){if(_0x389a3f){return _0x1fcb31[_0x5173('0x14')](_0x3521de)[_0x5173('0x15')](_0x389a3f);}};}function respondWithFilteredResult(_0x30ab48,_0x10a9f8){return function(_0x2f11a0){if(_0x2f11a0){var _0x35a52d=typeof _0x10a9f8[_0x5173('0x16')]===_0x5173('0x17')&&typeof _0x10a9f8[_0x5173('0x18')]===_0x5173('0x17');var _0x558d62=_0x2f11a0['count'];var _0x199c1e=_0x35a52d?0x0:_0x10a9f8[_0x5173('0x16')];var _0x1ab43a=_0x35a52d?_0x2f11a0[_0x5173('0x19')]:_0x10a9f8[_0x5173('0x16')]+_0x10a9f8[_0x5173('0x18')];var _0x12c7b5;if(_0x1ab43a>=_0x558d62){_0x1ab43a=_0x558d62;_0x12c7b5=0xc8;}else{_0x12c7b5=0xce;}_0x30ab48[_0x5173('0x14')](_0x12c7b5);return _0x30ab48[_0x5173('0x1a')](_0x5173('0x1b'),_0x199c1e+'-'+_0x1ab43a+'/'+_0x558d62)[_0x5173('0x15')](_0x2f11a0);}return null;};}function patchUpdates(_0x2fe91e){return function(_0x1f306f){try{jsonpatch[_0x5173('0x1c')](_0x1f306f,_0x2fe91e,!![]);}catch(_0x50ca4c){return BPromise[_0x5173('0x1d')](_0x50ca4c);}return _0x1f306f[_0x5173('0x1e')]();};}function saveUpdates(_0x1f44a9,_0x3ea45c){return function(_0x2d0cc0){if(_0x2d0cc0){return _0x2d0cc0[_0x5173('0x1f')](_0x1f44a9)[_0x5173('0x20')](function(_0x340df6){return _0x340df6;});}return null;};}function removeEntity(_0x1ef496,_0xdf8f96){return function(_0x15fc89){if(_0x15fc89){return _0x15fc89[_0x5173('0x21')]()[_0x5173('0x20')](function(){var _0x1b2cb0=_0x15fc89[_0x5173('0x22')]({'plain':!![]});var _0x22a112='ExtractedReports';return db[_0x5173('0x23')][_0x5173('0x21')]({'where':{'type':_0x22a112,'resourceId':_0x1b2cb0['id']}})['then'](function(){return _0x15fc89;});})[_0x5173('0x20')](function(){_0x1ef496['status'](0xcc)[_0x5173('0x24')]();});}};}function handleEntityNotFound(_0x12554e,_0x343037){return function(_0x162e10){if(!_0x162e10){_0x12554e[_0x5173('0x13')](0x194);}return _0x162e10;};}function handleError(_0x15b56a,_0x8182e8){_0x8182e8=_0x8182e8||0x1f4;return function(_0x36553c){logger['error'](_0x36553c[_0x5173('0x25')]);if(_0x36553c[_0x5173('0x26')]){delete _0x36553c[_0x5173('0x26')];}_0x15b56a[_0x5173('0x14')](_0x8182e8)['send'](_0x36553c);};}exports[_0x5173('0x27')]=function(_0x458ef9,_0x1a555a){var _0x2b6273={},_0x185337={},_0x16b9a0={'count':0x0,'rows':[]};var _0x3f6bbd=_[_0x5173('0x28')](db[_0x5173('0x29')][_0x5173('0x2a')],function(_0x4659e4){return{'name':_0x4659e4[_0x5173('0x2b')],'type':_0x4659e4[_0x5173('0x2c')][_0x5173('0x2d')]};});_0x185337[_0x5173('0x2e')]=_[_0x5173('0x28')](_0x3f6bbd,'name');_0x185337[_0x5173('0x2f')]=_[_0x5173('0x30')](_0x458ef9[_0x5173('0x2f')]);_0x185337[_0x5173('0x31')]=_['intersection'](_0x185337[_0x5173('0x2e')],_0x185337[_0x5173('0x2f')]);_0x2b6273['attributes']=_[_0x5173('0x32')](_0x185337[_0x5173('0x2e')],qs[_0x5173('0x33')](_0x458ef9[_0x5173('0x2f')]['fields']));_0x2b6273[_0x5173('0x34')]=_0x2b6273['attributes'][_0x5173('0x35')]?_0x2b6273['attributes']:_0x185337['model'];if(!_0x458ef9[_0x5173('0x2f')]['hasOwnProperty'](_0x5173('0x36'))){_0x2b6273[_0x5173('0x18')]=qs[_0x5173('0x18')](_0x458ef9[_0x5173('0x2f')][_0x5173('0x18')]);_0x2b6273[_0x5173('0x16')]=qs[_0x5173('0x16')](_0x458ef9[_0x5173('0x2f')]['offset']);}_0x2b6273[_0x5173('0x37')]=qs[_0x5173('0x38')](_0x458ef9[_0x5173('0x2f')][_0x5173('0x38')]);_0x2b6273[_0x5173('0x39')]=qs[_0x5173('0x31')](_[_0x5173('0x3a')](_0x458ef9['query'],_0x185337[_0x5173('0x31')]),_0x3f6bbd);if(_0x458ef9['query'][_0x5173('0x3b')]){_0x2b6273[_0x5173('0x39')]=_['merge'](_0x2b6273[_0x5173('0x39')],{'$or':_[_0x5173('0x28')](_0x3f6bbd,function(_0x1a921e){if(_0x1a921e[_0x5173('0x2c')]!==_0x5173('0x3c')){var _0x254338={};_0x254338[_0x1a921e[_0x5173('0x26')]]={'$like':'%'+_0x458ef9[_0x5173('0x2f')][_0x5173('0x3b')]+'%'};return _0x254338;}})});}_0x2b6273=_[_0x5173('0x3d')]({},_0x2b6273,_0x458ef9[_0x5173('0x3e')]);var _0xaea231={'where':_0x2b6273[_0x5173('0x39')]};return db[_0x5173('0x29')]['count'](_0xaea231)[_0x5173('0x20')](function(_0x22745f){_0x16b9a0['count']=_0x22745f;if(_0x458ef9[_0x5173('0x2f')]['includeAll']){_0x2b6273[_0x5173('0x3f')]=[{'all':!![]}];}return db[_0x5173('0x29')][_0x5173('0x40')](_0x2b6273);})[_0x5173('0x20')](function(_0x2e9c76){_0x16b9a0['rows']=_0x2e9c76;return _0x16b9a0;})[_0x5173('0x20')](respondWithFilteredResult(_0x1a555a,_0x2b6273))[_0x5173('0x41')](handleError(_0x1a555a,null));};exports[_0x5173('0x42')]=function(_0x2932b5,_0x47d317){var _0x1b6e66={'raw':!![],'where':{'id':_0x2932b5[_0x5173('0x43')]['id']}},_0x2fcfc0={};_0x2fcfc0[_0x5173('0x2e')]=_['keys'](db[_0x5173('0x29')][_0x5173('0x2a')]);_0x2fcfc0[_0x5173('0x2f')]=_[_0x5173('0x30')](_0x2932b5[_0x5173('0x2f')]);_0x2fcfc0[_0x5173('0x31')]=_[_0x5173('0x32')](_0x2fcfc0['model'],_0x2fcfc0[_0x5173('0x2f')]);_0x1b6e66[_0x5173('0x34')]=_['intersection'](_0x2fcfc0[_0x5173('0x2e')],qs[_0x5173('0x33')](_0x2932b5[_0x5173('0x2f')][_0x5173('0x33')]));_0x1b6e66[_0x5173('0x34')]=_0x1b6e66['attributes'][_0x5173('0x35')]?_0x1b6e66[_0x5173('0x34')]:_0x2fcfc0[_0x5173('0x2e')];if(_0x2932b5[_0x5173('0x2f')][_0x5173('0x44')]){_0x1b6e66[_0x5173('0x3f')]=[{'all':!![]}];}_0x1b6e66=_[_0x5173('0x3d')]({},_0x1b6e66,_0x2932b5[_0x5173('0x3e')]);return db[_0x5173('0x29')]['find'](_0x1b6e66)[_0x5173('0x20')](handleEntityNotFound(_0x47d317,null))[_0x5173('0x20')](respondWithResult(_0x47d317,null))[_0x5173('0x41')](handleError(_0x47d317,null));};exports[_0x5173('0x45')]=function(_0x54931a,_0x24c2f7){return db['AnalyticExtractedReport']['create'](_0x54931a['body'],{})[_0x5173('0x20')](function(_0x1af49b){var _0x50a581=_0x54931a[_0x5173('0x46')][_0x5173('0x22')]({'plain':!![]});if(!_0x50a581)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50a581[_0x5173('0x47')]==='user'){var _0x4fbb4c=_0x1af49b['get']({'plain':!![]});var _0x12d61b=_0x5173('0x48');return db[_0x5173('0x49')][_0x5173('0x4a')]({'where':{'name':_0x12d61b,'userProfileId':_0x50a581['userProfileId']},'raw':!![]})[_0x5173('0x20')](function(_0x4faa1a){if(_0x4faa1a&&_0x4faa1a[_0x5173('0x4b')]===0x0){return db[_0x5173('0x23')][_0x5173('0x45')]({'name':_0x4fbb4c[_0x5173('0x26')],'resourceId':_0x4fbb4c['id'],'type':_0x4faa1a[_0x5173('0x26')],'sectionId':_0x4faa1a['id']},{})['then'](function(){return _0x1af49b;});}else{return _0x1af49b;}})[_0x5173('0x41')](function(_0x72168a){logger[_0x5173('0x4c')](_0x5173('0x4d'),_0x72168a);throw _0x72168a;});}return _0x1af49b;})[_0x5173('0x20')](respondWithResult(_0x24c2f7,0xc9))[_0x5173('0x41')](handleError(_0x24c2f7,null));};exports['update']=function(_0xea910,_0x24ea0a){if(_0xea910[_0x5173('0x4e')]['id']){delete _0xea910['body']['id'];}return db[_0x5173('0x29')]['find']({'where':{'id':_0xea910[_0x5173('0x43')]['id']}})['then'](handleEntityNotFound(_0x24ea0a,null))[_0x5173('0x20')](saveUpdates(_0xea910[_0x5173('0x4e')],null))[_0x5173('0x20')](respondWithResult(_0x24ea0a,null))[_0x5173('0x41')](handleError(_0x24ea0a,null));};exports[_0x5173('0x21')]=function(_0x1bdd80,_0x5cb104){return db[_0x5173('0x29')][_0x5173('0x4a')]({'where':{'id':_0x1bdd80[_0x5173('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cb104,null))['then'](removeEntity(_0x5cb104,null))[_0x5173('0x41')](handleError(_0x5cb104,null));};exports['download']=function(_0x102c40,_0x2f9521,_0x3aca55){return db[_0x5173('0x29')][_0x5173('0x4a')]({'where':{'id':_0x102c40[_0x5173('0x43')]['id']},'attributes':['name',_0x5173('0x4f'),_0x5173('0x50'),_0x5173('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x2f9521,null))['then'](function(_0x30cfb2){if(_0x30cfb2){if(!fs[_0x5173('0x52')](path[_0x5173('0x53')](config['root'],'server/files/reports',_0x30cfb2[_0x5173('0x50')]))){throw new db['Sequelize']['ValidationError'](_0x5173('0x54'));}if(_0x102c40[_0x5173('0x2f')][_0x5173('0x55')]){return _0x2f9521[_0x5173('0x13')](0xc8);}return _0x2f9521[_0x5173('0x56')](path[_0x5173('0x53')](config[_0x5173('0x57')],_0x5173('0x58'),_0x30cfb2['savename']),util[_0x5173('0x59')]('%s.%s',_0x30cfb2[_0x5173('0x4f')]||_0x30cfb2[_0x5173('0x26')],_0x30cfb2[_0x5173('0x51')][_0x5173('0x5a')]()));}})[_0x5173('0x41')](handleError(_0x2f9521,null));}; \ No newline at end of file +var _0xa647=['json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','rawAttributes','map','keys','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','options','AnalyticExtractedReport','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','savename','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','basename','output','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status'];(function(_0x3d905f,_0x532d91){var _0x290795=function(_0x59a418){while(--_0x59a418){_0x3d905f['push'](_0x3d905f['shift']());}};_0x290795(++_0x532d91);}(_0xa647,0x95));var _0x7a64=function(_0x55db81,_0x18bf21){_0x55db81=_0x55db81-0x0;var _0x5b7d44=_0xa647[_0x55db81];return _0x5b7d44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a64('0x0'));var zipdir=require(_0x7a64('0x1'));var jsonpatch=require(_0x7a64('0x2'));var rp=require('request-promise');var moment=require(_0x7a64('0x3'));var BPromise=require(_0x7a64('0x4'));var Mustache=require(_0x7a64('0x5'));var util=require('util');var path=require(_0x7a64('0x6'));var sox=require(_0x7a64('0x7'));var csv=require(_0x7a64('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a64('0x9'));var crypto=require(_0x7a64('0xa'));var jsforce=require(_0x7a64('0xb'));var deskjs=require(_0x7a64('0xc'));var toCsv=require(_0x7a64('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7a64('0xd'));var authService=require(_0x7a64('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7a64('0xf'));var hardwareService=require(_0x7a64('0x10'));var logger=require('../../config/logger')(_0x7a64('0x11'));var utils=require(_0x7a64('0x12'));var config=require(_0x7a64('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de792,_0x27349f){_0x27349f=_0x27349f||0xcc;return function(_0x4ae13d){if(_0x4ae13d){return _0x4de792[_0x7a64('0x14')](_0x27349f);}return _0x4de792['status'](_0x27349f)[_0x7a64('0x15')]();};}function respondWithResult(_0x14389a,_0x218f62){_0x218f62=_0x218f62||0xc8;return function(_0x15cd70){if(_0x15cd70){return _0x14389a[_0x7a64('0x16')](_0x218f62)[_0x7a64('0x17')](_0x15cd70);}};}function respondWithFilteredResult(_0x2e01b3,_0x20d985){return function(_0x252954){if(_0x252954){var _0x1f7ac3=typeof _0x20d985[_0x7a64('0x18')]===_0x7a64('0x19')&&typeof _0x20d985['limit']===_0x7a64('0x19');var _0x2157cd=_0x252954[_0x7a64('0x1a')];var _0x17b04c=_0x1f7ac3?0x0:_0x20d985[_0x7a64('0x18')];var _0x1edd53=_0x1f7ac3?_0x252954[_0x7a64('0x1a')]:_0x20d985[_0x7a64('0x18')]+_0x20d985[_0x7a64('0x1b')];var _0x4227e4;if(_0x1edd53>=_0x2157cd){_0x1edd53=_0x2157cd;_0x4227e4=0xc8;}else{_0x4227e4=0xce;}_0x2e01b3['status'](_0x4227e4);return _0x2e01b3[_0x7a64('0x1c')]('Content-Range',_0x17b04c+'-'+_0x1edd53+'/'+_0x2157cd)['json'](_0x252954);}return null;};}function patchUpdates(_0x3c6189){return function(_0x1ba87b){try{jsonpatch['apply'](_0x1ba87b,_0x3c6189,!![]);}catch(_0x2d9814){return BPromise[_0x7a64('0x1d')](_0x2d9814);}return _0x1ba87b[_0x7a64('0x1e')]();};}function saveUpdates(_0x59463e,_0x1d5907){return function(_0x29f706){if(_0x29f706){return _0x29f706[_0x7a64('0x1f')](_0x59463e)[_0x7a64('0x20')](function(_0x445fcf){return _0x445fcf;});}return null;};}function removeEntity(_0x527c99,_0x4001a8){return function(_0x31774c){if(_0x31774c){return _0x31774c[_0x7a64('0x21')]()['then'](function(){var _0x224acb=_0x31774c[_0x7a64('0x22')]({'plain':!![]});var _0x123362=_0x7a64('0x23');return db[_0x7a64('0x24')][_0x7a64('0x21')]({'where':{'type':_0x123362,'resourceId':_0x224acb['id']}})[_0x7a64('0x20')](function(){return _0x31774c;});})[_0x7a64('0x20')](function(){_0x527c99[_0x7a64('0x16')](0xcc)[_0x7a64('0x15')]();});}};}function handleEntityNotFound(_0x13eaab,_0x1f76f1){return function(_0x127d61){if(!_0x127d61){_0x13eaab['sendStatus'](0x194);}return _0x127d61;};}function handleError(_0x252580,_0x19ffbc){_0x19ffbc=_0x19ffbc||0x1f4;return function(_0x58107c){logger[_0x7a64('0x25')](_0x58107c[_0x7a64('0x26')]);if(_0x58107c[_0x7a64('0x27')]){delete _0x58107c[_0x7a64('0x27')];}_0x252580[_0x7a64('0x16')](_0x19ffbc)[_0x7a64('0x28')](_0x58107c);};}exports[_0x7a64('0x29')]=function(_0x463f93,_0x26ed54){var _0x158366={},_0x45f182={},_0x1add20={'count':0x0,'rows':[]};var _0x5cb96e=_['map'](db['AnalyticExtractedReport'][_0x7a64('0x2a')],function(_0x156f64){return{'name':_0x156f64['fieldName'],'type':_0x156f64['type']['key']};});_0x45f182['model']=_[_0x7a64('0x2b')](_0x5cb96e,_0x7a64('0x27'));_0x45f182['query']=_[_0x7a64('0x2c')](_0x463f93[_0x7a64('0x2d')]);_0x45f182[_0x7a64('0x2e')]=_['intersection'](_0x45f182[_0x7a64('0x2f')],_0x45f182['query']);_0x158366[_0x7a64('0x30')]=_[_0x7a64('0x31')](_0x45f182[_0x7a64('0x2f')],qs[_0x7a64('0x32')](_0x463f93[_0x7a64('0x2d')][_0x7a64('0x32')]));_0x158366[_0x7a64('0x30')]=_0x158366[_0x7a64('0x30')]['length']?_0x158366[_0x7a64('0x30')]:_0x45f182['model'];if(!_0x463f93[_0x7a64('0x2d')]['hasOwnProperty'](_0x7a64('0x33'))){_0x158366[_0x7a64('0x1b')]=qs[_0x7a64('0x1b')](_0x463f93['query'][_0x7a64('0x1b')]);_0x158366[_0x7a64('0x18')]=qs[_0x7a64('0x18')](_0x463f93[_0x7a64('0x2d')][_0x7a64('0x18')]);}_0x158366[_0x7a64('0x34')]=qs['sort'](_0x463f93['query'][_0x7a64('0x35')]);_0x158366[_0x7a64('0x36')]=qs['filters'](_['pick'](_0x463f93[_0x7a64('0x2d')],_0x45f182[_0x7a64('0x2e')]),_0x5cb96e);if(_0x463f93[_0x7a64('0x2d')][_0x7a64('0x37')]){_0x158366[_0x7a64('0x36')]=_[_0x7a64('0x38')](_0x158366[_0x7a64('0x36')],{'$or':_[_0x7a64('0x2b')](_0x5cb96e,function(_0x5f05fd){if(_0x5f05fd['type']!==_0x7a64('0x39')){var _0x72aafb={};_0x72aafb[_0x5f05fd[_0x7a64('0x27')]]={'$like':'%'+_0x463f93['query'][_0x7a64('0x37')]+'%'};return _0x72aafb;}})});}_0x158366=_[_0x7a64('0x38')]({},_0x158366,_0x463f93['options']);var _0x3b4b11={'where':_0x158366[_0x7a64('0x36')]};return db['AnalyticExtractedReport']['count'](_0x3b4b11)[_0x7a64('0x20')](function(_0x6f9bad){_0x1add20[_0x7a64('0x1a')]=_0x6f9bad;if(_0x463f93[_0x7a64('0x2d')]['includeAll']){_0x158366[_0x7a64('0x3a')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7a64('0x3b')](_0x158366);})['then'](function(_0x257448){_0x1add20[_0x7a64('0x3c')]=_0x257448;return _0x1add20;})[_0x7a64('0x20')](respondWithFilteredResult(_0x26ed54,_0x158366))[_0x7a64('0x3d')](handleError(_0x26ed54,null));};exports[_0x7a64('0x3e')]=function(_0x545e1c,_0x3b2c1b){var _0x182d67={'raw':!![],'where':{'id':_0x545e1c[_0x7a64('0x3f')]['id']}},_0x4eb7d3={};_0x4eb7d3[_0x7a64('0x2f')]=_['keys'](db['AnalyticExtractedReport'][_0x7a64('0x2a')]);_0x4eb7d3[_0x7a64('0x2d')]=_[_0x7a64('0x2c')](_0x545e1c[_0x7a64('0x2d')]);_0x4eb7d3[_0x7a64('0x2e')]=_[_0x7a64('0x31')](_0x4eb7d3['model'],_0x4eb7d3['query']);_0x182d67['attributes']=_[_0x7a64('0x31')](_0x4eb7d3[_0x7a64('0x2f')],qs[_0x7a64('0x32')](_0x545e1c[_0x7a64('0x2d')][_0x7a64('0x32')]));_0x182d67[_0x7a64('0x30')]=_0x182d67[_0x7a64('0x30')][_0x7a64('0x40')]?_0x182d67[_0x7a64('0x30')]:_0x4eb7d3['model'];if(_0x545e1c[_0x7a64('0x2d')][_0x7a64('0x41')]){_0x182d67[_0x7a64('0x3a')]=[{'all':!![]}];}_0x182d67=_[_0x7a64('0x38')]({},_0x182d67,_0x545e1c[_0x7a64('0x42')]);return db[_0x7a64('0x43')]['find'](_0x182d67)[_0x7a64('0x20')](handleEntityNotFound(_0x3b2c1b,null))['then'](respondWithResult(_0x3b2c1b,null))[_0x7a64('0x3d')](handleError(_0x3b2c1b,null));};exports[_0x7a64('0x44')]=function(_0x32725d,_0x3d1c18){return db[_0x7a64('0x43')][_0x7a64('0x44')](_0x32725d['body'],{})['then'](function(_0x271c5){var _0x200fc6=_0x32725d[_0x7a64('0x45')][_0x7a64('0x22')]({'plain':!![]});if(!_0x200fc6)throw new Error(_0x7a64('0x46'));if(_0x200fc6['role']===_0x7a64('0x45')){var _0x3b5b7e=_0x271c5[_0x7a64('0x22')]({'plain':!![]});var _0x276e80='ExtractedReports';return db['UserProfileSection'][_0x7a64('0x47')]({'where':{'name':_0x276e80,'userProfileId':_0x200fc6[_0x7a64('0x48')]},'raw':!![]})[_0x7a64('0x20')](function(_0x121163){if(_0x121163&&_0x121163['autoAssociation']===0x0){return db[_0x7a64('0x24')]['create']({'name':_0x3b5b7e['name'],'resourceId':_0x3b5b7e['id'],'type':_0x121163[_0x7a64('0x27')],'sectionId':_0x121163['id']},{})['then'](function(){return _0x271c5;});}else{return _0x271c5;}})[_0x7a64('0x3d')](function(_0x3a2172){logger['error'](_0x7a64('0x49'),_0x3a2172);throw _0x3a2172;});}return _0x271c5;})[_0x7a64('0x20')](respondWithResult(_0x3d1c18,0xc9))[_0x7a64('0x3d')](handleError(_0x3d1c18,null));};exports[_0x7a64('0x1f')]=function(_0x496665,_0x8a1c77){if(_0x496665[_0x7a64('0x4a')]['id']){delete _0x496665[_0x7a64('0x4a')]['id'];}return db[_0x7a64('0x43')][_0x7a64('0x47')]({'where':{'id':_0x496665[_0x7a64('0x3f')]['id']}})[_0x7a64('0x20')](handleEntityNotFound(_0x8a1c77,null))[_0x7a64('0x20')](saveUpdates(_0x496665[_0x7a64('0x4a')],null))[_0x7a64('0x20')](respondWithResult(_0x8a1c77,null))[_0x7a64('0x3d')](handleError(_0x8a1c77,null));};exports['destroy']=function(_0x3a227c,_0x407051){return db['AnalyticExtractedReport'][_0x7a64('0x47')]({'where':{'id':_0x3a227c[_0x7a64('0x3f')]['id']}})[_0x7a64('0x20')](handleEntityNotFound(_0x407051,null))[_0x7a64('0x20')](removeEntity(_0x407051,null))[_0x7a64('0x3d')](handleError(_0x407051,null));};exports['download']=function(_0x3e3382,_0x220423,_0x55e87f){return db[_0x7a64('0x43')][_0x7a64('0x47')]({'where':{'id':_0x3e3382[_0x7a64('0x3f')]['id']},'attributes':[_0x7a64('0x27'),'basename',_0x7a64('0x4b'),'output'],'raw':!![]})[_0x7a64('0x20')](handleEntityNotFound(_0x220423,null))[_0x7a64('0x20')](function(_0x45adac){if(_0x45adac){if(!fs[_0x7a64('0x4c')](path[_0x7a64('0x4d')](config[_0x7a64('0x4e')],'server/files/reports',_0x45adac[_0x7a64('0x4b')]))){throw new db[(_0x7a64('0x4f'))]['ValidationError'](_0x7a64('0x50'));}if(_0x3e3382[_0x7a64('0x2d')]['exists']){return _0x220423[_0x7a64('0x14')](0xc8);}return _0x220423[_0x7a64('0x51')](path[_0x7a64('0x4d')](config[_0x7a64('0x4e')],'server/files/reports',_0x45adac['savename']),util[_0x7a64('0x52')](_0x7a64('0x53'),_0x45adac[_0x7a64('0x54')]||_0x45adac[_0x7a64('0x27')],_0x45adac[_0x7a64('0x55')]['toLowerCase']()));}})[_0x7a64('0x3d')](handleError(_0x220423,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 97fa021..51769fb 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 _0xacfa=['bluebird','request-promise','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xacfa,0xb1));var _0xaacf=function(_0x3ce3d0,_0x597f99){_0x3ce3d0=_0x3ce3d0-0x0;var _0x23cbe9=_0xacfa[_0x3ce3d0];return _0x23cbe9;};'use strict';var _=require(_0xaacf('0x0'));var util=require(_0xaacf('0x1'));var logger=require(_0xaacf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaacf('0x3'));var rp=require(_0xaacf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaacf('0x5'));module[_0xaacf('0x6')]=function(_0x24cf5e,_0x9cc256){return _0x24cf5e['define'](_0xaacf('0x7'),attributes,{'tableName':_0xaacf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf27d=['define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xf27d,0x123));var _0xdf27=function(_0x537806,_0x1acc05){_0x537806=_0x537806-0x0;var _0x436a6a=_0xf27d[_0x537806];return _0x436a6a;};'use strict';var _=require('lodash');var util=require(_0xdf27('0x0'));var logger=require(_0xdf27('0x1'))(_0xdf27('0x2'));var moment=require(_0xdf27('0x3'));var BPromise=require(_0xdf27('0x4'));var rp=require(_0xdf27('0x5'));var fs=require('fs');var path=require(_0xdf27('0x6'));var rimraf=require('rimraf');var config=require(_0xdf27('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xdf27('0x8')]=function(_0x4b83b7,_0x5a6de8){return _0x4b83b7[_0xdf27('0x9')](_0xdf27('0xa'),attributes,{'tableName':_0xdf27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 50b4317..ced5816 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 _0xddb0=['stringify','error','code','message','info','AnalyticExtractedReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x7c0646,_0x45d16b){var _0x32416d=function(_0x22abdd){while(--_0x22abdd){_0x7c0646['push'](_0x7c0646['shift']());}};_0x32416d(++_0x45d16b);}(_0xddb0,0x1c0));var _0x0ddb=function(_0x55ea91,_0xdc6b75){_0x55ea91=_0x55ea91-0x0;var _0x18e85a=_0xddb0[_0x55ea91];return _0x18e85a;};'use strict';var _=require(_0x0ddb('0x0'));var util=require(_0x0ddb('0x1'));var moment=require(_0x0ddb('0x2'));var BPromise=require(_0x0ddb('0x3'));var rs=require(_0x0ddb('0x4'));var fs=require('fs');var Redis=require(_0x0ddb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ddb('0x6'))(_0x0ddb('0x7'));var config=require(_0x0ddb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ddb('0x9')][_0x0ddb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c70fc,_0x37f242,_0x5e9d36){return new BPromise(function(_0x2e1c43,_0x397c0a){return client['request'](_0x2c70fc,_0x5e9d36)[_0x0ddb('0xb')](function(_0x279a62){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x37f242,_0x0ddb('0xc'));logger['debug'](_0x0ddb('0xd'),_0x37f242,_0x0ddb('0xc'),JSON[_0x0ddb('0xe')](_0x279a62));if(_0x279a62['error']){if(_0x279a62[_0x0ddb('0xf')][_0x0ddb('0x10')]===0x1f4){logger[_0x0ddb('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x37f242,_0x279a62[_0x0ddb('0xf')][_0x0ddb('0x11')]);return _0x397c0a(_0x279a62[_0x0ddb('0xf')][_0x0ddb('0x11')]);}logger[_0x0ddb('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x37f242,_0x279a62[_0x0ddb('0xf')][_0x0ddb('0x11')]);return _0x2e1c43(_0x279a62['error'][_0x0ddb('0x11')]);}else{logger[_0x0ddb('0x12')](_0x0ddb('0x13'),_0x37f242,_0x0ddb('0xc'));_0x2e1c43(_0x279a62['result']['message']);}})[_0x0ddb('0x14')](function(_0x419ded){logger[_0x0ddb('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x37f242,_0x419ded);_0x397c0a(_0x419ded);});});} \ No newline at end of file +var _0x713e=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xc1fd8f,_0x1e4682){var _0x3a335e=function(_0x4c3607){while(--_0x4c3607){_0xc1fd8f['push'](_0xc1fd8f['shift']());}};_0x3a335e(++_0x1e4682);}(_0x713e,0x147));var _0xe713=function(_0x2ee006,_0x518580){_0x2ee006=_0x2ee006-0x0;var _0x2481b6=_0x713e[_0x2ee006];return _0x2481b6;};'use strict';var _=require(_0xe713('0x0'));var util=require(_0xe713('0x1'));var moment=require(_0xe713('0x2'));var BPromise=require(_0xe713('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe713('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe713('0x5'));var logger=require(_0xe713('0x6'))('rpc');var config=require(_0xe713('0x7'));var jayson=require(_0xe713('0x8'));var client=jayson['client'][_0xe713('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21cc96,_0x997edb,_0xec3c5e){return new BPromise(function(_0x23e227,_0x4191b){return client[_0xe713('0xa')](_0x21cc96,_0xec3c5e)[_0xe713('0xb')](function(_0xe683e1){logger[_0xe713('0xc')](_0xe713('0xd'),_0x997edb,_0xe713('0xe'));logger['debug'](_0xe713('0xf'),_0x997edb,_0xe713('0xe'),JSON[_0xe713('0x10')](_0xe683e1));if(_0xe683e1[_0xe713('0x11')]){if(_0xe683e1[_0xe713('0x11')][_0xe713('0x12')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x997edb,_0xe683e1[_0xe713('0x11')][_0xe713('0x13')]);return _0x4191b(_0xe683e1[_0xe713('0x11')][_0xe713('0x13')]);}logger[_0xe713('0x11')](_0xe713('0xd'),_0x997edb,_0xe683e1[_0xe713('0x11')][_0xe713('0x13')]);return _0x23e227(_0xe683e1[_0xe713('0x11')][_0xe713('0x13')]);}else{logger['info'](_0xe713('0xd'),_0x997edb,_0xe713('0xe'));_0x23e227(_0xe683e1[_0xe713('0x14')]['message']);}})[_0xe713('0x15')](function(_0x39af2f){logger[_0xe713('0x11')](_0xe713('0xd'),_0x997edb,_0x39af2f);_0x4191b(_0x39af2f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 88764b3..2bfc7bc 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 _0x763f=['post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x763f,0x8f));var _0xf763=function(_0x27d11f,_0x2c59a8){_0x27d11f=_0x27d11f-0x0;var _0x36c1a5=_0x763f[_0x27d11f];return _0x36c1a5;};'use strict';var multer=require(_0xf763('0x0'));var util=require(_0xf763('0x1'));var path=require(_0xf763('0x2'));var timeout=require(_0xf763('0x3'));var express=require(_0xf763('0x4'));var router=express[_0xf763('0x5')]();var fs_extra=require(_0xf763('0x6'));var auth=require(_0xf763('0x7'));var interaction=require(_0xf763('0x8'));var config=require(_0xf763('0x9'));var controller=require(_0xf763('0xa'));router[_0xf763('0xb')]('/',auth[_0xf763('0xc')](),controller[_0xf763('0xd')]);router[_0xf763('0xb')](_0xf763('0xe'),auth[_0xf763('0xc')](),controller[_0xf763('0xf')]);router[_0xf763('0xb')](_0xf763('0x10'),auth[_0xf763('0xc')](),controller[_0xf763('0x11')]);router[_0xf763('0x12')]('/',auth[_0xf763('0xc')](),controller['create']);router[_0xf763('0x13')](_0xf763('0xe'),auth[_0xf763('0xc')](),controller['update']);router[_0xf763('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf763('0x15')]);module[_0xf763('0x16')]=router; \ No newline at end of file +var _0x4df9=['fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4df9,0x1de));var _0x94df=function(_0x1fa0e2,_0x37e26a){_0x1fa0e2=_0x1fa0e2-0x0;var _0x2457b0=_0x4df9[_0x1fa0e2];return _0x2457b0;};'use strict';var multer=require(_0x94df('0x0'));var util=require(_0x94df('0x1'));var path=require('path');var timeout=require(_0x94df('0x2'));var express=require(_0x94df('0x3'));var router=express[_0x94df('0x4')]();var fs_extra=require(_0x94df('0x5'));var auth=require(_0x94df('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94df('0x7'));router[_0x94df('0x8')]('/',auth[_0x94df('0x9')](),controller[_0x94df('0xa')]);router[_0x94df('0x8')]('/:id',auth[_0x94df('0x9')](),controller['show']);router[_0x94df('0x8')](_0x94df('0xb'),auth['isAuthenticated'](),controller[_0x94df('0xc')]);router[_0x94df('0xd')]('/',auth[_0x94df('0x9')](),controller[_0x94df('0xe')]);router[_0x94df('0xf')](_0x94df('0x10'),auth[_0x94df('0x9')](),controller[_0x94df('0x11')]);router[_0x94df('0x12')](_0x94df('0x10'),auth['isAuthenticated'](),controller[_0x94df('0x13')]);module[_0x94df('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c03890e..730373b 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 _0xa34a=['exports','STRING','BOOLEAN'];(function(_0x3523aa,_0x5b6999){var _0x44f998=function(_0x37cd13){while(--_0x37cd13){_0x3523aa['push'](_0x3523aa['shift']());}};_0x44f998(++_0x5b6999);}(_0xa34a,0x1e0));var _0xaa34=function(_0x3ff0da,_0x4f1b87){_0x3ff0da=_0x3ff0da-0x0;var _0x55b87e=_0xa34a[_0x3ff0da];return _0x55b87e;};'use strict';var Sequelize=require('sequelize');module[_0xaa34('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xaa34('0x1')]},'format':{'type':Sequelize[_0xaa34('0x1')]},'groupBy':{'type':Sequelize[_0xaa34('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xaa34('0x1')]},'custom':{'type':Sequelize[_0xaa34('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x81bc=['sequelize','exports','STRING','BOOLEAN'];(function(_0x94e95,_0x5c6948){var _0x41a606=function(_0x2fbf94){while(--_0x2fbf94){_0x94e95['push'](_0x94e95['shift']());}};_0x41a606(++_0x5c6948);}(_0x81bc,0x1f0));var _0xc81b=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x81bc[_0x17882c];return _0x355a59;};'use strict';var Sequelize=require(_0xc81b('0x0'));module[_0xc81b('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xc81b('0x2')]},'function':{'type':Sequelize[_0xc81b('0x2')]},'format':{'type':Sequelize[_0xc81b('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc81b('0x2')]},'custom':{'type':Sequelize[_0xc81b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7fdb6bf..2050d3a 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 _0x322f=['limit','count','set','Content-Range','reject','save','destroy','then','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','filter','includeAll','catch','show','params','include','find','create','body','update','ids','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x483dd6,_0x2a4943){var _0x406baa=function(_0x21de68){while(--_0x21de68){_0x483dd6['push'](_0x483dd6['shift']());}};_0x406baa(++_0x2a4943);}(_0x322f,0x101));var _0xf322=function(_0x19d25a,_0xdcd6c8){_0x19d25a=_0x19d25a-0x0;var _0x49292a=_0x322f[_0x19d25a];return _0x49292a;};'use strict';var emlformat=require(_0xf322('0x0'));var rimraf=require(_0xf322('0x1'));var zipdir=require(_0xf322('0x2'));var jsonpatch=require(_0xf322('0x3'));var rp=require(_0xf322('0x4'));var moment=require(_0xf322('0x5'));var BPromise=require(_0xf322('0x6'));var Mustache=require(_0xf322('0x7'));var util=require(_0xf322('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf322('0x9'));var ejs=require(_0xf322('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf322('0xb'));var squel=require(_0xf322('0xc'));var crypto=require('crypto');var jsforce=require(_0xf322('0xd'));var deskjs=require(_0xf322('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf322('0xf'));var Papa=require(_0xf322('0x10'));var Redis=require('ioredis');var authService=require(_0xf322('0x11'));var qs=require(_0xf322('0x12'));var as=require(_0xf322('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf322('0x14'))(_0xf322('0x15'));var utils=require(_0xf322('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf322('0x17'));var db=require(_0xf322('0x18'))['db'];function respondWithStatusCode(_0x33a957,_0x4c6869){_0x4c6869=_0x4c6869||0xcc;return function(_0x4d60c6){if(_0x4d60c6){return _0x33a957[_0xf322('0x19')](_0x4c6869);}return _0x33a957[_0xf322('0x1a')](_0x4c6869)[_0xf322('0x1b')]();};}function respondWithResult(_0x4e50cf,_0x2d7ae8){_0x2d7ae8=_0x2d7ae8||0xc8;return function(_0x52773e){if(_0x52773e){return _0x4e50cf[_0xf322('0x1a')](_0x2d7ae8)[_0xf322('0x1c')](_0x52773e);}};}function respondWithFilteredResult(_0x4ef8c0,_0x149993){return function(_0x261fce){if(_0x261fce){var _0x230d60=typeof _0x149993[_0xf322('0x1d')]===_0xf322('0x1e')&&typeof _0x149993[_0xf322('0x1f')]===_0xf322('0x1e');var _0x581e4e=_0x261fce[_0xf322('0x20')];var _0x503db1=_0x230d60?0x0:_0x149993[_0xf322('0x1d')];var _0x4b84ed=_0x230d60?_0x261fce['count']:_0x149993[_0xf322('0x1d')]+_0x149993[_0xf322('0x1f')];var _0x34f274;if(_0x4b84ed>=_0x581e4e){_0x4b84ed=_0x581e4e;_0x34f274=0xc8;}else{_0x34f274=0xce;}_0x4ef8c0[_0xf322('0x1a')](_0x34f274);return _0x4ef8c0[_0xf322('0x21')](_0xf322('0x22'),_0x503db1+'-'+_0x4b84ed+'/'+_0x581e4e)['json'](_0x261fce);}return null;};}function patchUpdates(_0x18854d){return function(_0x5597db){try{jsonpatch['apply'](_0x5597db,_0x18854d,!![]);}catch(_0x137510){return BPromise[_0xf322('0x23')](_0x137510);}return _0x5597db[_0xf322('0x24')]();};}function saveUpdates(_0x1b6dcb,_0x58759f){return function(_0x7167fd){if(_0x7167fd){return _0x7167fd['update'](_0x1b6dcb)['then'](function(_0x53578c){return _0x53578c;});}return null;};}function removeEntity(_0x19c89f,_0x5d1bb2){return function(_0x46cd0d){if(_0x46cd0d){return _0x46cd0d[_0xf322('0x25')]()[_0xf322('0x26')](function(){_0x19c89f[_0xf322('0x1a')](0xcc)[_0xf322('0x1b')]();});}};}function handleEntityNotFound(_0x55cb38,_0x4e3f0b){return function(_0x5f0a91){if(!_0x5f0a91){_0x55cb38[_0xf322('0x19')](0x194);}return _0x5f0a91;};}function handleError(_0x429156,_0x490999){_0x490999=_0x490999||0x1f4;return function(_0x281f8e){logger['error'](_0x281f8e['stack']);if(_0x281f8e[_0xf322('0x27')]){delete _0x281f8e['name'];}_0x429156['status'](_0x490999)['send'](_0x281f8e);};}exports[_0xf322('0x28')]=function(_0x3e63ac,_0x1cea87){var _0x474021={},_0x1a3186={},_0x4e6248={'count':0x0,'rows':[]};var _0x416432=_[_0xf322('0x29')](db[_0xf322('0x2a')][_0xf322('0x2b')],function(_0x4f9c98){return{'name':_0x4f9c98[_0xf322('0x2c')],'type':_0x4f9c98[_0xf322('0x2d')]['key']};});_0x1a3186[_0xf322('0x2e')]=_[_0xf322('0x29')](_0x416432,_0xf322('0x27'));_0x1a3186['query']=_[_0xf322('0x2f')](_0x3e63ac[_0xf322('0x30')]);_0x1a3186[_0xf322('0x31')]=_[_0xf322('0x32')](_0x1a3186[_0xf322('0x2e')],_0x1a3186[_0xf322('0x30')]);_0x474021[_0xf322('0x33')]=_['intersection'](_0x1a3186[_0xf322('0x2e')],qs[_0xf322('0x34')](_0x3e63ac[_0xf322('0x30')][_0xf322('0x34')]));_0x474021['attributes']=_0x474021[_0xf322('0x33')]['length']?_0x474021[_0xf322('0x33')]:_0x1a3186[_0xf322('0x2e')];if(!_0x3e63ac[_0xf322('0x30')][_0xf322('0x35')]('nolimit')){_0x474021['limit']=qs['limit'](_0x3e63ac['query']['limit']);_0x474021[_0xf322('0x1d')]=qs['offset'](_0x3e63ac[_0xf322('0x30')][_0xf322('0x1d')]);}_0x474021['order']=qs['sort'](_0x3e63ac['query'][_0xf322('0x36')]);_0x474021[_0xf322('0x37')]=qs['filters'](_[_0xf322('0x38')](_0x3e63ac[_0xf322('0x30')],_0x1a3186[_0xf322('0x31')]),_0x416432);if(_0x3e63ac['query']['filter']){_0x474021[_0xf322('0x37')]=_[_0xf322('0x39')](_0x474021[_0xf322('0x37')],{'$or':_['map'](_0x416432,function(_0xf19d8f){if(_0xf19d8f[_0xf322('0x2d')]!=='VIRTUAL'){var _0x2e9abe={};_0x2e9abe[_0xf19d8f[_0xf322('0x27')]]={'$like':'%'+_0x3e63ac['query'][_0xf322('0x3a')]+'%'};return _0x2e9abe;}})});}_0x474021=_[_0xf322('0x39')]({},_0x474021,_0x3e63ac['options']);var _0x4fcf01={'where':_0x474021[_0xf322('0x37')]};return db[_0xf322('0x2a')][_0xf322('0x20')](_0x4fcf01)[_0xf322('0x26')](function(_0x5e5545){_0x4e6248[_0xf322('0x20')]=_0x5e5545;if(_0x3e63ac[_0xf322('0x30')][_0xf322('0x3b')]){_0x474021['include']=[{'all':!![]}];}return db[_0xf322('0x2a')]['findAll'](_0x474021);})['then'](function(_0x2c808a){_0x4e6248['rows']=_0x2c808a;return _0x4e6248;})[_0xf322('0x26')](respondWithFilteredResult(_0x1cea87,_0x474021))[_0xf322('0x3c')](handleError(_0x1cea87,null));};exports[_0xf322('0x3d')]=function(_0x51583c,_0x32e93b){var _0x580d28={'raw':![],'where':{'id':_0x51583c[_0xf322('0x3e')]['id']}},_0x36b98e={};_0x36b98e[_0xf322('0x2e')]=_['keys'](db[_0xf322('0x2a')][_0xf322('0x2b')]);_0x36b98e[_0xf322('0x30')]=_[_0xf322('0x2f')](_0x51583c[_0xf322('0x30')]);_0x36b98e['filters']=_[_0xf322('0x32')](_0x36b98e['model'],_0x36b98e['query']);_0x580d28['attributes']=_['intersection'](_0x36b98e[_0xf322('0x2e')],qs[_0xf322('0x34')](_0x51583c['query'][_0xf322('0x34')]));_0x580d28[_0xf322('0x33')]=_0x580d28[_0xf322('0x33')]['length']?_0x580d28[_0xf322('0x33')]:_0x36b98e['model'];if(_0x51583c[_0xf322('0x30')][_0xf322('0x3b')]){_0x580d28[_0xf322('0x3f')]=[{'all':!![]}];}_0x580d28=_['merge']({},_0x580d28,_0x51583c['options']);return db[_0xf322('0x2a')][_0xf322('0x40')](_0x580d28)[_0xf322('0x26')](handleEntityNotFound(_0x32e93b,null))[_0xf322('0x26')](respondWithResult(_0x32e93b,null))[_0xf322('0x3c')](handleError(_0x32e93b,null));};exports[_0xf322('0x41')]=function(_0x3441c0,_0x35bdc6){return db['AnalyticFieldReport'][_0xf322('0x41')](_0x3441c0[_0xf322('0x42')],{})[_0xf322('0x26')](respondWithResult(_0x35bdc6,0xc9))['catch'](handleError(_0x35bdc6,null));};exports['bulkCreate']=function(_0x3bb9a8,_0x111666){return db[_0xf322('0x2a')]['bulkCreate'](_0x3bb9a8[_0xf322('0x42')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x111666,0xc9))[_0xf322('0x3c')](handleError(_0x111666,null));};exports[_0xf322('0x43')]=function(_0x4bab75,_0x502cd6){if(_0x4bab75[_0xf322('0x42')]['id']){delete _0x4bab75[_0xf322('0x42')]['id'];}return db[_0xf322('0x2a')]['find']({'where':{'id':_0x4bab75[_0xf322('0x3e')]['id']}})[_0xf322('0x26')](handleEntityNotFound(_0x502cd6,null))[_0xf322('0x26')](saveUpdates(_0x4bab75[_0xf322('0x42')],null))[_0xf322('0x26')](respondWithResult(_0x502cd6,null))[_0xf322('0x3c')](handleError(_0x502cd6,null));};exports['destroy']=function(_0x1c0c6e,_0x24789d){return db[_0xf322('0x2a')][_0xf322('0x40')]({'where':{'id':_0x1c0c6e[_0xf322('0x3e')]['id']}})[_0xf322('0x26')](handleEntityNotFound(_0x24789d,null))[_0xf322('0x26')](removeEntity(_0x24789d,null))['catch'](handleError(_0x24789d,null));};exports['bulkDestroy']=function(_0x2baf55,_0x2a4084){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x2baf55[_0xf322('0x30')][_0xf322('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xf322('0x26')](respondWithResult(_0x2a4084,0xcc))[_0xf322('0x3c')](handleError(_0x2a4084,null));};exports['addFields']=function(_0x52b6ca,_0x3aacba,_0x580733){return db[_0xf322('0x45')]['findOne']({'where':{'id':_0x52b6ca['params']['id']}})[_0xf322('0x26')](handleEntityNotFound(_0x3aacba,null))[_0xf322('0x26')](function(_0x20a61d){if(_0x20a61d){return db['sequelize'][_0xf322('0x46')](function(_0x58d93e){return db[_0xf322('0x2a')][_0xf322('0x25')]({'where':{'CustomReportId':_0x52b6ca[_0xf322('0x3e')]['id']},'transaction':_0x58d93e})[_0xf322('0x26')](function(_0x468a0a){var _0x35ffb1=_[_0xf322('0x29')](_0x52b6ca['body'],function(_0x52a427){delete _0x52a427['id'];_0x52a427[_0xf322('0x47')]=_0x52b6ca[_0xf322('0x3e')]['id'];return _0x52a427;});return db['AnalyticFieldReport']['bulkCreate'](_0x35ffb1,{'transaction':_0x58d93e});});})[_0xf322('0x26')](function(){return db[_0xf322('0x2a')]['findAll']({'where':{'CustomReportId':_0x52b6ca[_0xf322('0x3e')]['id']}});});}})[_0xf322('0x26')](respondWithResult(_0x3aacba,null))[_0xf322('0x3c')](handleError(_0x3aacba,null));}; \ No newline at end of file +var _0x4f91=['rows','catch','show','params','rawAttributes','options','find','create','body','bulkCreate','update','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','index','AnalyticFieldReport','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include'];(function(_0x19dcc8,_0x4bae0e){var _0x2810f4=function(_0x507cf4){while(--_0x507cf4){_0x19dcc8['push'](_0x19dcc8['shift']());}};_0x2810f4(++_0x4bae0e);}(_0x4f91,0x101));var _0x14f9=function(_0x328444,_0x25b246){_0x328444=_0x328444-0x0;var _0x2d5e9c=_0x4f91[_0x328444];return _0x2d5e9c;};'use strict';var emlformat=require(_0x14f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14f9('0x1'));var jsonpatch=require(_0x14f9('0x2'));var rp=require(_0x14f9('0x3'));var moment=require(_0x14f9('0x4'));var BPromise=require(_0x14f9('0x5'));var Mustache=require(_0x14f9('0x6'));var util=require('util');var path=require(_0x14f9('0x7'));var sox=require('sox');var csv=require(_0x14f9('0x8'));var ejs=require(_0x14f9('0x9'));var fs=require('fs');var fs_extra=require(_0x14f9('0xa'));var _=require('lodash');var squel=require(_0x14f9('0xb'));var crypto=require(_0x14f9('0xc'));var jsforce=require(_0x14f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x14f9('0x8'));var querystring=require(_0x14f9('0xe'));var Papa=require(_0x14f9('0xf'));var Redis=require('ioredis');var authService=require(_0x14f9('0x10'));var qs=require(_0x14f9('0x11'));var as=require(_0x14f9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14f9('0x13'))('api');var utils=require(_0x14f9('0x14'));var config=require(_0x14f9('0x15'));var licenseUtil=require(_0x14f9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34020f,_0x47a24d){_0x47a24d=_0x47a24d||0xcc;return function(_0x3256c0){if(_0x3256c0){return _0x34020f[_0x14f9('0x17')](_0x47a24d);}return _0x34020f['status'](_0x47a24d)[_0x14f9('0x18')]();};}function respondWithResult(_0x1828d7,_0x363e7f){_0x363e7f=_0x363e7f||0xc8;return function(_0x117386){if(_0x117386){return _0x1828d7[_0x14f9('0x19')](_0x363e7f)[_0x14f9('0x1a')](_0x117386);}};}function respondWithFilteredResult(_0x800453,_0x1be694){return function(_0x50bbbe){if(_0x50bbbe){var _0x48a2be=typeof _0x1be694[_0x14f9('0x1b')]===_0x14f9('0x1c')&&typeof _0x1be694[_0x14f9('0x1d')]===_0x14f9('0x1c');var _0x4cdfee=_0x50bbbe[_0x14f9('0x1e')];var _0x4d7e4d=_0x48a2be?0x0:_0x1be694[_0x14f9('0x1b')];var _0x8e33b=_0x48a2be?_0x50bbbe['count']:_0x1be694[_0x14f9('0x1b')]+_0x1be694[_0x14f9('0x1d')];var _0x39f684;if(_0x8e33b>=_0x4cdfee){_0x8e33b=_0x4cdfee;_0x39f684=0xc8;}else{_0x39f684=0xce;}_0x800453[_0x14f9('0x19')](_0x39f684);return _0x800453[_0x14f9('0x1f')](_0x14f9('0x20'),_0x4d7e4d+'-'+_0x8e33b+'/'+_0x4cdfee)[_0x14f9('0x1a')](_0x50bbbe);}return null;};}function patchUpdates(_0x222bf3){return function(_0x553fb4){try{jsonpatch[_0x14f9('0x21')](_0x553fb4,_0x222bf3,!![]);}catch(_0xa4f1ed){return BPromise[_0x14f9('0x22')](_0xa4f1ed);}return _0x553fb4[_0x14f9('0x23')]();};}function saveUpdates(_0x25ab21,_0x285a22){return function(_0x4eee4b){if(_0x4eee4b){return _0x4eee4b['update'](_0x25ab21)['then'](function(_0x36ff81){return _0x36ff81;});}return null;};}function removeEntity(_0xedf071,_0x41b34e){return function(_0x23c920){if(_0x23c920){return _0x23c920[_0x14f9('0x24')]()['then'](function(){_0xedf071[_0x14f9('0x19')](0xcc)[_0x14f9('0x18')]();});}};}function handleEntityNotFound(_0x578b42,_0x3c7ee5){return function(_0x341bb7){if(!_0x341bb7){_0x578b42[_0x14f9('0x17')](0x194);}return _0x341bb7;};}function handleError(_0x2b7d3e,_0x4f9920){_0x4f9920=_0x4f9920||0x1f4;return function(_0xbe5afe){logger[_0x14f9('0x25')](_0xbe5afe[_0x14f9('0x26')]);if(_0xbe5afe[_0x14f9('0x27')]){delete _0xbe5afe[_0x14f9('0x27')];}_0x2b7d3e['status'](_0x4f9920)['send'](_0xbe5afe);};}exports[_0x14f9('0x28')]=function(_0x18d326,_0x2cad9){var _0x2ef507={},_0x520057={},_0x2f3221={'count':0x0,'rows':[]};var _0x488547=_['map'](db[_0x14f9('0x29')]['rawAttributes'],function(_0x3f20f9){return{'name':_0x3f20f9[_0x14f9('0x2a')],'type':_0x3f20f9['type']['key']};});_0x520057[_0x14f9('0x2b')]=_[_0x14f9('0x2c')](_0x488547,_0x14f9('0x27'));_0x520057[_0x14f9('0x2d')]=_[_0x14f9('0x2e')](_0x18d326['query']);_0x520057[_0x14f9('0x2f')]=_[_0x14f9('0x30')](_0x520057[_0x14f9('0x2b')],_0x520057[_0x14f9('0x2d')]);_0x2ef507[_0x14f9('0x31')]=_['intersection'](_0x520057[_0x14f9('0x2b')],qs[_0x14f9('0x32')](_0x18d326[_0x14f9('0x2d')][_0x14f9('0x32')]));_0x2ef507['attributes']=_0x2ef507[_0x14f9('0x31')][_0x14f9('0x33')]?_0x2ef507['attributes']:_0x520057[_0x14f9('0x2b')];if(!_0x18d326['query'][_0x14f9('0x34')](_0x14f9('0x35'))){_0x2ef507['limit']=qs[_0x14f9('0x1d')](_0x18d326[_0x14f9('0x2d')][_0x14f9('0x1d')]);_0x2ef507[_0x14f9('0x1b')]=qs[_0x14f9('0x1b')](_0x18d326[_0x14f9('0x2d')]['offset']);}_0x2ef507['order']=qs[_0x14f9('0x36')](_0x18d326['query']['sort']);_0x2ef507['where']=qs[_0x14f9('0x2f')](_[_0x14f9('0x37')](_0x18d326['query'],_0x520057[_0x14f9('0x2f')]),_0x488547);if(_0x18d326['query'][_0x14f9('0x38')]){_0x2ef507[_0x14f9('0x39')]=_[_0x14f9('0x3a')](_0x2ef507['where'],{'$or':_[_0x14f9('0x2c')](_0x488547,function(_0x429036){if(_0x429036['type']!==_0x14f9('0x3b')){var _0x3b021e={};_0x3b021e[_0x429036['name']]={'$like':'%'+_0x18d326[_0x14f9('0x2d')]['filter']+'%'};return _0x3b021e;}})});}_0x2ef507=_[_0x14f9('0x3a')]({},_0x2ef507,_0x18d326['options']);var _0x5917d3={'where':_0x2ef507[_0x14f9('0x39')]};return db[_0x14f9('0x29')][_0x14f9('0x1e')](_0x5917d3)[_0x14f9('0x3c')](function(_0x4d549c){_0x2f3221['count']=_0x4d549c;if(_0x18d326['query'][_0x14f9('0x3d')]){_0x2ef507[_0x14f9('0x3e')]=[{'all':!![]}];}return db[_0x14f9('0x29')]['findAll'](_0x2ef507);})[_0x14f9('0x3c')](function(_0x4b3f08){_0x2f3221[_0x14f9('0x3f')]=_0x4b3f08;return _0x2f3221;})[_0x14f9('0x3c')](respondWithFilteredResult(_0x2cad9,_0x2ef507))[_0x14f9('0x40')](handleError(_0x2cad9,null));};exports[_0x14f9('0x41')]=function(_0x1ad0eb,_0x17a266){var _0x217e7e={'raw':![],'where':{'id':_0x1ad0eb[_0x14f9('0x42')]['id']}},_0x29265b={};_0x29265b[_0x14f9('0x2b')]=_['keys'](db[_0x14f9('0x29')][_0x14f9('0x43')]);_0x29265b[_0x14f9('0x2d')]=_[_0x14f9('0x2e')](_0x1ad0eb[_0x14f9('0x2d')]);_0x29265b['filters']=_[_0x14f9('0x30')](_0x29265b[_0x14f9('0x2b')],_0x29265b[_0x14f9('0x2d')]);_0x217e7e[_0x14f9('0x31')]=_[_0x14f9('0x30')](_0x29265b[_0x14f9('0x2b')],qs[_0x14f9('0x32')](_0x1ad0eb[_0x14f9('0x2d')][_0x14f9('0x32')]));_0x217e7e['attributes']=_0x217e7e[_0x14f9('0x31')][_0x14f9('0x33')]?_0x217e7e['attributes']:_0x29265b['model'];if(_0x1ad0eb['query']['includeAll']){_0x217e7e['include']=[{'all':!![]}];}_0x217e7e=_[_0x14f9('0x3a')]({},_0x217e7e,_0x1ad0eb[_0x14f9('0x44')]);return db[_0x14f9('0x29')][_0x14f9('0x45')](_0x217e7e)[_0x14f9('0x3c')](handleEntityNotFound(_0x17a266,null))[_0x14f9('0x3c')](respondWithResult(_0x17a266,null))[_0x14f9('0x40')](handleError(_0x17a266,null));};exports[_0x14f9('0x46')]=function(_0x32b31d,_0x4b2044){return db[_0x14f9('0x29')][_0x14f9('0x46')](_0x32b31d[_0x14f9('0x47')],{})['then'](respondWithResult(_0x4b2044,0xc9))[_0x14f9('0x40')](handleError(_0x4b2044,null));};exports[_0x14f9('0x48')]=function(_0x526870,_0x2d8fc5){return db[_0x14f9('0x29')][_0x14f9('0x48')](_0x526870[_0x14f9('0x47')],{'raw':![],'individualHooks':!![]})[_0x14f9('0x3c')](respondWithResult(_0x2d8fc5,0xc9))['catch'](handleError(_0x2d8fc5,null));};exports[_0x14f9('0x49')]=function(_0x589626,_0x13fe68){if(_0x589626['body']['id']){delete _0x589626[_0x14f9('0x47')]['id'];}return db['AnalyticFieldReport'][_0x14f9('0x45')]({'where':{'id':_0x589626[_0x14f9('0x42')]['id']}})[_0x14f9('0x3c')](handleEntityNotFound(_0x13fe68,null))[_0x14f9('0x3c')](saveUpdates(_0x589626['body'],null))['then'](respondWithResult(_0x13fe68,null))[_0x14f9('0x40')](handleError(_0x13fe68,null));};exports[_0x14f9('0x24')]=function(_0xa87cbc,_0x21d669){return db['AnalyticFieldReport'][_0x14f9('0x45')]({'where':{'id':_0xa87cbc[_0x14f9('0x42')]['id']}})[_0x14f9('0x3c')](handleEntityNotFound(_0x21d669,null))[_0x14f9('0x3c')](removeEntity(_0x21d669,null))[_0x14f9('0x40')](handleError(_0x21d669,null));};exports['bulkDestroy']=function(_0x5cbca7,_0x2674aa){return db[_0x14f9('0x29')][_0x14f9('0x24')]({'where':{'id':_0x5cbca7[_0x14f9('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2674aa,0xcc))[_0x14f9('0x40')](handleError(_0x2674aa,null));};exports[_0x14f9('0x4a')]=function(_0xe52773,_0x3e578b,_0xeb390d){return db[_0x14f9('0x4b')][_0x14f9('0x4c')]({'where':{'id':_0xe52773['params']['id']}})['then'](handleEntityNotFound(_0x3e578b,null))['then'](function(_0x16b99d){if(_0x16b99d){return db[_0x14f9('0x4d')]['transaction'](function(_0x42f919){return db['AnalyticFieldReport'][_0x14f9('0x24')]({'where':{'CustomReportId':_0xe52773[_0x14f9('0x42')]['id']},'transaction':_0x42f919})[_0x14f9('0x3c')](function(_0x2be187){var _0xdefce3=_[_0x14f9('0x2c')](_0xe52773[_0x14f9('0x47')],function(_0x4f9d9f){delete _0x4f9d9f['id'];_0x4f9d9f[_0x14f9('0x4e')]=_0xe52773[_0x14f9('0x42')]['id'];return _0x4f9d9f;});return db['AnalyticFieldReport'][_0x14f9('0x48')](_0xdefce3,{'transaction':_0x42f919});});})[_0x14f9('0x3c')](function(){return db[_0x14f9('0x29')][_0x14f9('0x4f')]({'where':{'CustomReportId':_0xe52773['params']['id']}});});}})[_0x14f9('0x3c')](respondWithResult(_0x3e578b,null))['catch'](handleError(_0x3e578b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 41171e6..375548b 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 _0x2886=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x588d7f,_0x129444){var _0x447659=function(_0x2bfbd0){while(--_0x2bfbd0){_0x588d7f['push'](_0x588d7f['shift']());}};_0x447659(++_0x129444);}(_0x2886,0x87));var _0x6288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2886[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6288('0x0'));var util=require(_0x6288('0x1'));var logger=require('../../config/logger')(_0x6288('0x2'));var moment=require(_0x6288('0x3'));var BPromise=require(_0x6288('0x4'));var rp=require(_0x6288('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6288('0x6'));var config=require(_0x6288('0x7'));var attributes=require(_0x6288('0x8'));module[_0x6288('0x9')]=function(_0x58cbc8,_0x3024c0){return _0x58cbc8[_0x6288('0xa')](_0x6288('0xb'),attributes,{'tableName':_0x6288('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6317=['AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xda470a,_0x1b445e){var _0x38bc99=function(_0x1e2b5e){while(--_0x1e2b5e){_0xda470a['push'](_0xda470a['shift']());}};_0x38bc99(++_0x1b445e);}(_0x6317,0x83));var _0x7631=function(_0x54f44f,_0x12326f){_0x54f44f=_0x54f44f-0x0;var _0x4f080e=_0x6317[_0x54f44f];return _0x4f080e;};'use strict';var _=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var logger=require(_0x7631('0x2'))(_0x7631('0x3'));var moment=require(_0x7631('0x4'));var BPromise=require(_0x7631('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7631('0x6'));var rimraf=require(_0x7631('0x7'));var config=require(_0x7631('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x2a2c0e,_0x492814){return _0x2a2c0e['define'](_0x7631('0x9'),attributes,{'tableName':'analytics_report_fields','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 226c849..f2cdb60 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 _0x4f10=['rpc','../../config/environment','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2692fa,_0x31211c){var _0x2dcf30=function(_0x435275){while(--_0x435275){_0x2692fa['push'](_0x2692fa['shift']());}};_0x2dcf30(++_0x31211c);}(_0x4f10,0x79));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x04f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x04f1('0x1'));var fs=require('fs');var Redis=require(_0x04f1('0x2'));var db=require(_0x04f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x04f1('0x4'))(_0x04f1('0x5'));var config=require(_0x04f1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x04f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40e3da,_0x27582b,_0x4ece5f){return new BPromise(function(_0x43a886,_0x3603c5){return client[_0x04f1('0x8')](_0x40e3da,_0x4ece5f)[_0x04f1('0x9')](function(_0x589ce9){logger['info'](_0x04f1('0xa'),_0x27582b,'request\x20sent');logger['debug'](_0x04f1('0xb'),_0x27582b,_0x04f1('0xc'),JSON[_0x04f1('0xd')](_0x589ce9));if(_0x589ce9['error']){if(_0x589ce9[_0x04f1('0xe')][_0x04f1('0xf')]===0x1f4){logger['error'](_0x04f1('0xa'),_0x27582b,_0x589ce9[_0x04f1('0xe')][_0x04f1('0x10')]);return _0x3603c5(_0x589ce9[_0x04f1('0xe')][_0x04f1('0x10')]);}logger['error'](_0x04f1('0xa'),_0x27582b,_0x589ce9[_0x04f1('0xe')][_0x04f1('0x10')]);return _0x43a886(_0x589ce9[_0x04f1('0xe')]['message']);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x27582b,_0x04f1('0xc'));_0x43a886(_0x589ce9['result']['message']);}})[_0x04f1('0x11')](function(_0x31532e){logger['error'](_0x04f1('0xa'),_0x27582b,_0x31532e);_0x3603c5(_0x31532e);});});} \ No newline at end of file +var _0x5741=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5741,0x135));var _0x1574=function(_0x5de30c,_0x2c65dc){_0x5de30c=_0x5de30c-0x0;var _0xbee2eb=_0x5741[_0x5de30c];return _0xbee2eb;};'use strict';var _=require(_0x1574('0x0'));var util=require('util');var moment=require(_0x1574('0x1'));var BPromise=require(_0x1574('0x2'));var rs=require(_0x1574('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1574('0x4'))['db'];var utils=require(_0x1574('0x5'));var logger=require(_0x1574('0x6'))(_0x1574('0x7'));var config=require(_0x1574('0x8'));var jayson=require(_0x1574('0x9'));var client=jayson[_0x1574('0xa')][_0x1574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c679,_0x398005,_0x5ae259){return new BPromise(function(_0x45ab17,_0x2922eb){return client['request'](_0x59c679,_0x5ae259)['then'](function(_0xa720ee){logger['info'](_0x1574('0xc'),_0x398005,_0x1574('0xd'));logger[_0x1574('0xe')](_0x1574('0xf'),_0x398005,_0x1574('0xd'),JSON['stringify'](_0xa720ee));if(_0xa720ee[_0x1574('0x10')]){if(_0xa720ee[_0x1574('0x10')][_0x1574('0x11')]===0x1f4){logger[_0x1574('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x398005,_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);return _0x2922eb(_0xa720ee['error']['message']);}logger[_0x1574('0x10')](_0x1574('0xc'),_0x398005,_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);return _0x45ab17(_0xa720ee[_0x1574('0x10')][_0x1574('0x12')]);}else{logger[_0x1574('0x13')](_0x1574('0xc'),_0x398005,_0x1574('0xd'));_0x45ab17(_0xa720ee['result'][_0x1574('0x12')]);}})[_0x1574('0x14')](function(_0x1463e1){logger[_0x1574('0x10')](_0x1574('0xc'),_0x398005,_0x1463e1);_0x2922eb(_0x1463e1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2056dd0..514af98 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(_0x2109ad,_0x1d84ee){var _0x590b6d=function(_0x186af2){while(--_0x186af2){_0x2109ad['push'](_0x2109ad['shift']());}};_0x590b6d(++_0x1d84ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x173f85,_0x412d00){var _0x30d116=function(_0x240e2b){while(--_0x240e2b){_0x173f85['push'](_0x173f85['shift']());}};_0x30d116(++_0x412d00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 01daf6b..2e44b0f 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 _0xe486=['TEXT','sequelize','exports','STRING','name'];(function(_0x561427,_0x2bebc8){var _0x1ab114=function(_0x345f7f){while(--_0x345f7f){_0x561427['push'](_0x561427['shift']());}};_0x1ab114(++_0x2bebc8);}(_0xe486,0x6a));var _0x6e48=function(_0x46f64c,_0x4d2a98){_0x46f64c=_0x46f64c-0x0;var _0x5d4f9f=_0xe486[_0x46f64c];return _0x5d4f9f;};'use strict';var Sequelize=require(_0x6e48('0x0'));module[_0x6e48('0x1')]={'name':{'type':Sequelize[_0x6e48('0x2')],'allowNull':![],'unique':_0x6e48('0x3')},'table':{'type':Sequelize[_0x6e48('0x2')]},'metric':{'type':Sequelize[_0x6e48('0x4')]},'description':{'type':Sequelize[_0x6e48('0x2')]}}; \ No newline at end of file +var _0x4c4d=['sequelize','TEXT'];(function(_0x58accc,_0x3f7a8f){var _0x377787=function(_0x1b948d){while(--_0x1b948d){_0x58accc['push'](_0x58accc['shift']());}};_0x377787(++_0x3f7a8f);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x135d48,_0xf216e7){_0x135d48=_0x135d48-0x0;var _0xd7a790=_0x4c4d[_0x135d48];return _0xd7a790;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd4c4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f738186..e3c342c 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 _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x2f69b4,_0x104675){var _0x19e8a1=function(_0x2e020e){while(--_0x2e020e){_0x2f69b4['push'](_0x2f69b4['shift']());}};_0x19e8a1(++_0x104675);}(_0xe14b,0x93));var _0xbe14=function(_0x4d6771,_0x35ca0f){_0x4d6771=_0x4d6771-0x0;var _0x21ff02=_0xe14b[_0x4d6771];return _0x21ff02;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','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','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x5674dc,_0x32f572){var _0x594305=function(_0x19d6dc){while(--_0x19d6dc){_0x5674dc['push'](_0x5674dc['shift']());}};_0x594305(++_0x32f572);}(_0xa41a,0x6b));var _0xaa41=function(_0x1f23f2,_0x559146){_0x1f23f2=_0x1f23f2-0x0;var _0x3d518a=_0xa41a[_0x1f23f2];return _0x3d518a;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 3ef3564..bc338d2 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 _0xb934=['exports','define','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xb934,0x92));var _0x4b93=function(_0x6bc880,_0x16594e){_0x6bc880=_0x6bc880-0x0;var _0x540542=_0xb934[_0x6bc880];return _0x540542;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require(_0x4b93('0x3'));var BPromise=require(_0x4b93('0x4'));var rp=require(_0x4b93('0x5'));var fs=require('fs');var path=require(_0x4b93('0x6'));var rimraf=require(_0x4b93('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x4b93('0x8')]=function(_0x1fa8af,_0x2ea5ad){return _0x1fa8af[_0x4b93('0x9')]('AnalyticMetric',attributes,{'tableName':_0x4b93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f72=['../../config/environment','exports','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6f72,0xae));var _0x26f7=function(_0x3aeb9b,_0x3f3ff2){_0x3aeb9b=_0x3aeb9b-0x0;var _0x5e318f=_0x6f72[_0x3aeb9b];return _0x5e318f;};'use strict';var _=require('lodash');var util=require(_0x26f7('0x0'));var logger=require(_0x26f7('0x1'))(_0x26f7('0x2'));var moment=require('moment');var BPromise=require(_0x26f7('0x3'));var rp=require(_0x26f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26f7('0x5'));var config=require(_0x26f7('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x26f7('0x7')]=function(_0x50719f,_0x29465a){return _0x50719f['define'](_0x26f7('0x8'),attributes,{'tableName':_0x26f7('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 8c69681..d581190 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 _0x022b=['rpc','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x45d1b1,_0x328cb0){var _0x313c30=function(_0x2b3214){while(--_0x2b3214){_0x45d1b1['push'](_0x45d1b1['shift']());}};_0x313c30(++_0x328cb0);}(_0x022b,0xa0));var _0xb022=function(_0xb027e2,_0x44fd80){_0xb027e2=_0xb027e2-0x0;var _0x426844=_0x022b[_0xb027e2];return _0x426844;};'use strict';var _=require(_0xb022('0x0'));var util=require(_0xb022('0x1'));var moment=require(_0xb022('0x2'));var BPromise=require(_0xb022('0x3'));var rs=require(_0xb022('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb022('0x5'))['db'];var utils=require(_0xb022('0x6'));var logger=require(_0xb022('0x7'))(_0xb022('0x8'));var config=require(_0xb022('0x9'));var jayson=require(_0xb022('0xa'));var client=jayson[_0xb022('0xb')][_0xb022('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19a81f,_0x3e0468,_0x1a8274){return new BPromise(function(_0x39b547,_0x6a129d){return client[_0xb022('0xd')](_0x19a81f,_0x1a8274)['then'](function(_0x265329){logger['info'](_0xb022('0xe'),_0x3e0468,_0xb022('0xf'));logger['debug'](_0xb022('0x10'),_0x3e0468,'request\x20sent',JSON[_0xb022('0x11')](_0x265329));if(_0x265329[_0xb022('0x12')]){if(_0x265329[_0xb022('0x12')][_0xb022('0x13')]===0x1f4){logger[_0xb022('0x12')](_0xb022('0xe'),_0x3e0468,_0x265329['error'][_0xb022('0x14')]);return _0x6a129d(_0x265329[_0xb022('0x12')][_0xb022('0x14')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3e0468,_0x265329[_0xb022('0x12')][_0xb022('0x14')]);return _0x39b547(_0x265329[_0xb022('0x12')][_0xb022('0x14')]);}else{logger[_0xb022('0x15')](_0xb022('0xe'),_0x3e0468,'request\x20sent');_0x39b547(_0x265329[_0xb022('0x16')][_0xb022('0x14')]);}})[_0xb022('0x17')](function(_0x3a8050){logger[_0xb022('0x12')](_0xb022('0xe'),_0x3e0468,_0x3a8050);_0x6a129d(_0x3a8050);});});} \ No newline at end of file +var _0x42ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x42ac,0x102));var _0xc42a=function(_0x1b170c,_0x2f7fdf){_0x1b170c=_0x1b170c-0x0;var _0xcb8bda=_0x42ac[_0x1b170c];return _0xcb8bda;};'use strict';var _=require(_0xc42a('0x0'));var util=require(_0xc42a('0x1'));var moment=require(_0xc42a('0x2'));var BPromise=require(_0xc42a('0x3'));var rs=require(_0xc42a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc42a('0x5'))['db'];var utils=require(_0xc42a('0x6'));var logger=require(_0xc42a('0x7'))(_0xc42a('0x8'));var config=require(_0xc42a('0x9'));var jayson=require(_0xc42a('0xa'));var client=jayson[_0xc42a('0xb')][_0xc42a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x413336,_0x1ecbfb,_0x753b25){return new BPromise(function(_0x5ac3c7,_0x176ea2){return client['request'](_0x413336,_0x753b25)[_0xc42a('0xd')](function(_0x5daff8){logger['info'](_0xc42a('0xe'),_0x1ecbfb,_0xc42a('0xf'));logger[_0xc42a('0x10')](_0xc42a('0x11'),_0x1ecbfb,_0xc42a('0xf'),JSON[_0xc42a('0x12')](_0x5daff8));if(_0x5daff8[_0xc42a('0x13')]){if(_0x5daff8[_0xc42a('0x13')][_0xc42a('0x14')]===0x1f4){logger[_0xc42a('0x13')](_0xc42a('0xe'),_0x1ecbfb,_0x5daff8['error'][_0xc42a('0x15')]);return _0x176ea2(_0x5daff8[_0xc42a('0x13')]['message']);}logger['error'](_0xc42a('0xe'),_0x1ecbfb,_0x5daff8[_0xc42a('0x13')][_0xc42a('0x15')]);return _0x5ac3c7(_0x5daff8[_0xc42a('0x13')][_0xc42a('0x15')]);}else{logger['info'](_0xc42a('0xe'),_0x1ecbfb,_0xc42a('0xf'));_0x5ac3c7(_0x5daff8[_0xc42a('0x16')][_0xc42a('0x15')]);}})[_0xc42a('0x17')](function(_0x29db04){logger[_0xc42a('0x13')](_0xc42a('0xe'),_0x1ecbfb,_0x29db04);_0x176ea2(_0x29db04);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 900286e..6dffebe 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 _0xaa3f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x2eafcc,_0x5be787){_0x2eafcc=_0x2eafcc-0x0;var _0x3bef85=_0xaa3f[_0x2eafcc];return _0x3bef85;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0xe')]('/',auth[_0xfaa3('0xc')](),controller['create']);router[_0xfaa3('0xf')](_0xfaa3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfaa3('0x10')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x11')]);module[_0xfaa3('0x12')]=router; \ No newline at end of file +var _0x1c75=['index','show','post','put','delete','/:id','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x31021e,_0x248900){var _0x1e6fe5=function(_0x420acf){while(--_0x420acf){_0x31021e['push'](_0x31021e['shift']());}};_0x1e6fe5(++_0x248900);}(_0x1c75,0xce));var _0x51c7=function(_0x3eac74,_0x300383){_0x3eac74=_0x3eac74-0x0;var _0x365ec9=_0x1c75[_0x3eac74];return _0x365ec9;};'use strict';var multer=require(_0x51c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51c7('0x1'));var router=express[_0x51c7('0x2')]();var fs_extra=require(_0x51c7('0x3'));var auth=require(_0x51c7('0x4'));var interaction=require(_0x51c7('0x5'));var config=require(_0x51c7('0x6'));var controller=require(_0x51c7('0x7'));router[_0x51c7('0x8')]('/',auth[_0x51c7('0x9')](),controller[_0x51c7('0xa')]);router[_0x51c7('0x8')]('/:id',auth[_0x51c7('0x9')](),controller[_0x51c7('0xb')]);router[_0x51c7('0xc')]('/',auth[_0x51c7('0x9')](),controller['create']);router[_0x51c7('0xd')]('/:id',auth[_0x51c7('0x9')](),controller['update']);router[_0x51c7('0xe')](_0x51c7('0xf'),auth['isAuthenticated'](),controller[_0x51c7('0x10')]);module[_0x51c7('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 2d62025..1156a1f 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 _0x4d67=['sequelize','exports','TEXT'];(function(_0x155bf9,_0x4e7992){var _0x3de8c8=function(_0xbfa921){while(--_0xbfa921){_0x155bf9['push'](_0x155bf9['shift']());}};_0x3de8c8(++_0x4e7992);}(_0x4d67,0x72));var _0x74d6=function(_0x21862c,_0x11b362){_0x21862c=_0x21862c-0x0;var _0x45c4bc=_0x4d67[_0x21862c];return _0x45c4bc;};'use strict';var Sequelize=require(_0x74d6('0x0'));module[_0x74d6('0x1')]={'tree':{'type':Sequelize[_0x74d6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3ba1=['exports','TEXT'];(function(_0x18dcae,_0x5ce5e8){var _0x3e13f3=function(_0x427780){while(--_0x427780){_0x18dcae['push'](_0x18dcae['shift']());}};_0x3e13f3(++_0x5ce5e8);}(_0x3ba1,0x1ae));var _0x13ba=function(_0x205534,_0x5c3b1c){_0x205534=_0x205534-0x0;var _0x138c77=_0x3ba1[_0x205534];return _0x138c77;};'use strict';var Sequelize=require('sequelize');module[_0x13ba('0x0')]={'tree':{'type':Sequelize[_0x13ba('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f7596c7..2c1eb9a 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 _0xd61c=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','length','includeAll','include','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0xd61c,0xd7));var _0xcd61=function(_0x3ca7e5,_0x3018d7){_0x3ca7e5=_0x3ca7e5-0x0;var _0x4a3600=_0xd61c[_0x3ca7e5];return _0x4a3600;};'use strict';var emlformat=require(_0xcd61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd61('0x1'));var jsonpatch=require(_0xcd61('0x2'));var rp=require(_0xcd61('0x3'));var moment=require('moment');var BPromise=require(_0xcd61('0x4'));var Mustache=require(_0xcd61('0x5'));var util=require(_0xcd61('0x6'));var path=require(_0xcd61('0x7'));var sox=require(_0xcd61('0x8'));var csv=require('to-csv');var ejs=require(_0xcd61('0x9'));var fs=require('fs');var fs_extra=require(_0xcd61('0xa'));var _=require(_0xcd61('0xb'));var squel=require('squel');var crypto=require(_0xcd61('0xc'));var jsforce=require(_0xcd61('0xd'));var deskjs=require(_0xcd61('0xe'));var toCsv=require(_0xcd61('0xf'));var querystring=require(_0xcd61('0x10'));var Papa=require('papaparse');var Redis=require(_0xcd61('0x11'));var authService=require(_0xcd61('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcd61('0x13'));var hardwareService=require(_0xcd61('0x14'));var logger=require(_0xcd61('0x15'))(_0xcd61('0x16'));var utils=require(_0xcd61('0x17'));var config=require(_0xcd61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd61('0x19'))['db'];function respondWithStatusCode(_0x568f07,_0x374b4d){_0x374b4d=_0x374b4d||0xcc;return function(_0x17d8c3){if(_0x17d8c3){return _0x568f07[_0xcd61('0x1a')](_0x374b4d);}return _0x568f07[_0xcd61('0x1b')](_0x374b4d)[_0xcd61('0x1c')]();};}function respondWithResult(_0x2226c6,_0x3bf40d){_0x3bf40d=_0x3bf40d||0xc8;return function(_0x43c3cd){if(_0x43c3cd){return _0x2226c6[_0xcd61('0x1b')](_0x3bf40d)['json'](_0x43c3cd);}};}function respondWithFilteredResult(_0x39589a,_0x24e5d6){return function(_0x4d0f40){if(_0x4d0f40){var _0x23d101=typeof _0x24e5d6[_0xcd61('0x1d')]===_0xcd61('0x1e')&&typeof _0x24e5d6[_0xcd61('0x1f')]===_0xcd61('0x1e');var _0x59a3c1=_0x4d0f40[_0xcd61('0x20')];var _0x420678=_0x23d101?0x0:_0x24e5d6[_0xcd61('0x1d')];var _0x6cf04c=_0x23d101?_0x4d0f40[_0xcd61('0x20')]:_0x24e5d6[_0xcd61('0x1d')]+_0x24e5d6[_0xcd61('0x1f')];var _0x4ef476;if(_0x6cf04c>=_0x59a3c1){_0x6cf04c=_0x59a3c1;_0x4ef476=0xc8;}else{_0x4ef476=0xce;}_0x39589a[_0xcd61('0x1b')](_0x4ef476);return _0x39589a[_0xcd61('0x21')](_0xcd61('0x22'),_0x420678+'-'+_0x6cf04c+'/'+_0x59a3c1)[_0xcd61('0x23')](_0x4d0f40);}return null;};}function patchUpdates(_0x19f6f8){return function(_0x254c1e){try{jsonpatch[_0xcd61('0x24')](_0x254c1e,_0x19f6f8,!![]);}catch(_0x366235){return BPromise[_0xcd61('0x25')](_0x366235);}return _0x254c1e['save']();};}function saveUpdates(_0x33903e,_0x479295){return function(_0x38671e){if(_0x38671e){return _0x38671e[_0xcd61('0x26')](_0x33903e)['then'](function(_0x343b9b){return _0x343b9b;});}return null;};}function removeEntity(_0x4cea5a,_0x51be6f){return function(_0x591f3d){if(_0x591f3d){return _0x591f3d[_0xcd61('0x27')]()[_0xcd61('0x28')](function(){_0x4cea5a['status'](0xcc)[_0xcd61('0x1c')]();});}};}function handleEntityNotFound(_0x4dbd13,_0x14e298){return function(_0x4dbe30){if(!_0x4dbe30){_0x4dbd13[_0xcd61('0x1a')](0x194);}return _0x4dbe30;};}function handleError(_0x1d9473,_0x46c6cb){_0x46c6cb=_0x46c6cb||0x1f4;return function(_0xae0464){logger[_0xcd61('0x29')](_0xae0464[_0xcd61('0x2a')]);if(_0xae0464[_0xcd61('0x2b')]){delete _0xae0464[_0xcd61('0x2b')];}_0x1d9473[_0xcd61('0x1b')](_0x46c6cb)[_0xcd61('0x2c')](_0xae0464);};}exports[_0xcd61('0x2d')]=function(_0x15268c,_0x478b94){var _0x62cc77={},_0x3cacc2={},_0x54d891={'count':0x0,'rows':[]};var _0x23a9c0=_[_0xcd61('0x2e')](db[_0xcd61('0x2f')][_0xcd61('0x30')],function(_0x3fa558){return{'name':_0x3fa558[_0xcd61('0x31')],'type':_0x3fa558[_0xcd61('0x32')][_0xcd61('0x33')]};});_0x3cacc2['model']=_['map'](_0x23a9c0,_0xcd61('0x2b'));_0x3cacc2[_0xcd61('0x34')]=_[_0xcd61('0x35')](_0x15268c[_0xcd61('0x34')]);_0x3cacc2[_0xcd61('0x36')]=_[_0xcd61('0x37')](_0x3cacc2['model'],_0x3cacc2[_0xcd61('0x34')]);_0x62cc77[_0xcd61('0x38')]=_['intersection'](_0x3cacc2[_0xcd61('0x39')],qs[_0xcd61('0x3a')](_0x15268c[_0xcd61('0x34')][_0xcd61('0x3a')]));_0x62cc77[_0xcd61('0x38')]=_0x62cc77[_0xcd61('0x38')]['length']?_0x62cc77[_0xcd61('0x38')]:_0x3cacc2['model'];if(!_0x15268c[_0xcd61('0x34')][_0xcd61('0x3b')](_0xcd61('0x3c'))){_0x62cc77['limit']=qs[_0xcd61('0x1f')](_0x15268c[_0xcd61('0x34')]['limit']);_0x62cc77[_0xcd61('0x1d')]=qs[_0xcd61('0x1d')](_0x15268c[_0xcd61('0x34')]['offset']);}_0x62cc77[_0xcd61('0x3d')]=qs['sort'](_0x15268c[_0xcd61('0x34')][_0xcd61('0x3e')]);_0x62cc77['where']=qs[_0xcd61('0x36')](_[_0xcd61('0x3f')](_0x15268c[_0xcd61('0x34')],_0x3cacc2[_0xcd61('0x36')]),_0x23a9c0);if(_0x15268c[_0xcd61('0x34')][_0xcd61('0x40')]){_0x62cc77['where']=_['merge'](_0x62cc77[_0xcd61('0x41')],{'$or':_[_0xcd61('0x2e')](_0x23a9c0,function(_0x13adf9){if(_0x13adf9[_0xcd61('0x32')]!==_0xcd61('0x42')){var _0x17661a={};_0x17661a[_0x13adf9[_0xcd61('0x2b')]]={'$like':'%'+_0x15268c[_0xcd61('0x34')][_0xcd61('0x40')]+'%'};return _0x17661a;}})});}_0x62cc77=_[_0xcd61('0x43')]({},_0x62cc77,_0x15268c[_0xcd61('0x44')]);var _0x33a834={'where':_0x62cc77[_0xcd61('0x41')]};return db[_0xcd61('0x2f')][_0xcd61('0x20')](_0x33a834)[_0xcd61('0x28')](function(_0x46f536){_0x54d891[_0xcd61('0x20')]=_0x46f536;if(_0x15268c[_0xcd61('0x34')]['includeAll']){_0x62cc77['include']=[{'all':!![]}];}return db[_0xcd61('0x2f')][_0xcd61('0x45')](_0x62cc77);})[_0xcd61('0x28')](function(_0x2fb46a){_0x54d891[_0xcd61('0x46')]=_0x2fb46a;return _0x54d891;})['then'](respondWithFilteredResult(_0x478b94,_0x62cc77))['catch'](handleError(_0x478b94,null));};exports[_0xcd61('0x47')]=function(_0x1f521a,_0x1ea5a3){var _0x40107d={'raw':!![],'where':{'id':_0x1f521a['params']['id']}},_0x4f98e1={};_0x4f98e1[_0xcd61('0x39')]=_[_0xcd61('0x35')](db['AnalyticTreeReport'][_0xcd61('0x30')]);_0x4f98e1[_0xcd61('0x34')]=_['keys'](_0x1f521a[_0xcd61('0x34')]);_0x4f98e1['filters']=_[_0xcd61('0x37')](_0x4f98e1[_0xcd61('0x39')],_0x4f98e1[_0xcd61('0x34')]);_0x40107d[_0xcd61('0x38')]=_['intersection'](_0x4f98e1['model'],qs[_0xcd61('0x3a')](_0x1f521a[_0xcd61('0x34')][_0xcd61('0x3a')]));_0x40107d[_0xcd61('0x38')]=_0x40107d[_0xcd61('0x38')][_0xcd61('0x48')]?_0x40107d['attributes']:_0x4f98e1['model'];if(_0x1f521a[_0xcd61('0x34')][_0xcd61('0x49')]){_0x40107d[_0xcd61('0x4a')]=[{'all':!![]}];}_0x40107d=_[_0xcd61('0x43')]({},_0x40107d,_0x1f521a[_0xcd61('0x44')]);return db[_0xcd61('0x2f')][_0xcd61('0x4b')](_0x40107d)[_0xcd61('0x28')](handleEntityNotFound(_0x1ea5a3,null))[_0xcd61('0x28')](respondWithResult(_0x1ea5a3,null))[_0xcd61('0x4c')](handleError(_0x1ea5a3,null));};exports[_0xcd61('0x4d')]=function(_0x38d08a,_0x33c5bf){return db['AnalyticTreeReport'][_0xcd61('0x4d')](_0x38d08a[_0xcd61('0x4e')],{})[_0xcd61('0x28')](respondWithResult(_0x33c5bf,0xc9))['catch'](handleError(_0x33c5bf,null));};exports[_0xcd61('0x26')]=function(_0x3b5038,_0x10b1a4){if(_0x3b5038[_0xcd61('0x4e')]['id']){delete _0x3b5038['body']['id'];}return db[_0xcd61('0x2f')][_0xcd61('0x4b')]({'where':{'id':_0x3b5038[_0xcd61('0x4f')]['id']}})['then'](handleEntityNotFound(_0x10b1a4,null))[_0xcd61('0x28')](saveUpdates(_0x3b5038['body'],null))[_0xcd61('0x28')](respondWithResult(_0x10b1a4,null))[_0xcd61('0x4c')](handleError(_0x10b1a4,null));};exports['destroy']=function(_0x485749,_0x55431d){return db['AnalyticTreeReport'][_0xcd61('0x4b')]({'where':{'id':_0x485749[_0xcd61('0x4f')]['id']}})[_0xcd61('0x28')](handleEntityNotFound(_0x55431d,null))[_0xcd61('0x28')](removeEntity(_0x55431d,null))[_0xcd61('0x4c')](handleError(_0x55431d,null));}; \ No newline at end of file +var _0xeff3=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x396d48,_0x264959){var _0x5ee81c=function(_0xdf1c53){while(--_0xdf1c53){_0x396d48['push'](_0x396d48['shift']());}};_0x5ee81c(++_0x264959);}(_0xeff3,0x7c));var _0x3eff=function(_0x31db2b,_0xb218b7){_0x31db2b=_0x31db2b-0x0;var _0x1459a0=_0xeff3[_0x31db2b];return _0x1459a0;};'use strict';var emlformat=require(_0x3eff('0x0'));var rimraf=require(_0x3eff('0x1'));var zipdir=require(_0x3eff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3eff('0x3'));var BPromise=require(_0x3eff('0x4'));var Mustache=require(_0x3eff('0x5'));var util=require('util');var path=require(_0x3eff('0x6'));var sox=require(_0x3eff('0x7'));var csv=require(_0x3eff('0x8'));var ejs=require(_0x3eff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3eff('0xa'));var crypto=require(_0x3eff('0xb'));var jsforce=require(_0x3eff('0xc'));var deskjs=require(_0x3eff('0xd'));var toCsv=require(_0x3eff('0x8'));var querystring=require(_0x3eff('0xe'));var Papa=require(_0x3eff('0xf'));var Redis=require(_0x3eff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3eff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3eff('0x12'));var logger=require(_0x3eff('0x13'))(_0x3eff('0x14'));var utils=require('../../config/utils');var config=require(_0x3eff('0x15'));var licenseUtil=require(_0x3eff('0x16'));var db=require(_0x3eff('0x17'))['db'];function respondWithStatusCode(_0x56585e,_0x1e4e88){_0x1e4e88=_0x1e4e88||0xcc;return function(_0xc9dbd5){if(_0xc9dbd5){return _0x56585e[_0x3eff('0x18')](_0x1e4e88);}return _0x56585e[_0x3eff('0x19')](_0x1e4e88)[_0x3eff('0x1a')]();};}function respondWithResult(_0x5b8969,_0x301c9a){_0x301c9a=_0x301c9a||0xc8;return function(_0x173cd3){if(_0x173cd3){return _0x5b8969[_0x3eff('0x19')](_0x301c9a)[_0x3eff('0x1b')](_0x173cd3);}};}function respondWithFilteredResult(_0x28840a,_0x16d98c){return function(_0x239cf9){if(_0x239cf9){var _0x20a32d=typeof _0x16d98c[_0x3eff('0x1c')]===_0x3eff('0x1d')&&typeof _0x16d98c[_0x3eff('0x1e')]===_0x3eff('0x1d');var _0xce0cea=_0x239cf9[_0x3eff('0x1f')];var _0x5b8af3=_0x20a32d?0x0:_0x16d98c[_0x3eff('0x1c')];var _0x1e39e7=_0x20a32d?_0x239cf9[_0x3eff('0x1f')]:_0x16d98c[_0x3eff('0x1c')]+_0x16d98c[_0x3eff('0x1e')];var _0x46ffb4;if(_0x1e39e7>=_0xce0cea){_0x1e39e7=_0xce0cea;_0x46ffb4=0xc8;}else{_0x46ffb4=0xce;}_0x28840a['status'](_0x46ffb4);return _0x28840a[_0x3eff('0x20')](_0x3eff('0x21'),_0x5b8af3+'-'+_0x1e39e7+'/'+_0xce0cea)['json'](_0x239cf9);}return null;};}function patchUpdates(_0x487ead){return function(_0x10e1f1){try{jsonpatch[_0x3eff('0x22')](_0x10e1f1,_0x487ead,!![]);}catch(_0x1b0f42){return BPromise[_0x3eff('0x23')](_0x1b0f42);}return _0x10e1f1[_0x3eff('0x24')]();};}function saveUpdates(_0x34bbb1,_0x20a4cd){return function(_0x370374){if(_0x370374){return _0x370374[_0x3eff('0x25')](_0x34bbb1)[_0x3eff('0x26')](function(_0x430b0f){return _0x430b0f;});}return null;};}function removeEntity(_0x115bb9,_0x477caa){return function(_0x155b6c){if(_0x155b6c){return _0x155b6c[_0x3eff('0x27')]()[_0x3eff('0x26')](function(){_0x115bb9[_0x3eff('0x19')](0xcc)[_0x3eff('0x1a')]();});}};}function handleEntityNotFound(_0x3e7a3b,_0x103946){return function(_0x3dc3c7){if(!_0x3dc3c7){_0x3e7a3b[_0x3eff('0x18')](0x194);}return _0x3dc3c7;};}function handleError(_0x3080a8,_0xb6d0){_0xb6d0=_0xb6d0||0x1f4;return function(_0x554791){logger[_0x3eff('0x28')](_0x554791['stack']);if(_0x554791[_0x3eff('0x29')]){delete _0x554791[_0x3eff('0x29')];}_0x3080a8['status'](_0xb6d0)[_0x3eff('0x2a')](_0x554791);};}exports[_0x3eff('0x2b')]=function(_0x42132e,_0x30a003){var _0x43b682={},_0x4b6a8b={},_0x5442c9={'count':0x0,'rows':[]};var _0x167331=_[_0x3eff('0x2c')](db[_0x3eff('0x2d')][_0x3eff('0x2e')],function(_0x4b6c03){return{'name':_0x4b6c03['fieldName'],'type':_0x4b6c03[_0x3eff('0x2f')][_0x3eff('0x30')]};});_0x4b6a8b['model']=_[_0x3eff('0x2c')](_0x167331,_0x3eff('0x29'));_0x4b6a8b[_0x3eff('0x31')]=_['keys'](_0x42132e['query']);_0x4b6a8b[_0x3eff('0x32')]=_[_0x3eff('0x33')](_0x4b6a8b['model'],_0x4b6a8b[_0x3eff('0x31')]);_0x43b682[_0x3eff('0x34')]=_[_0x3eff('0x33')](_0x4b6a8b[_0x3eff('0x35')],qs['fields'](_0x42132e['query'][_0x3eff('0x36')]));_0x43b682['attributes']=_0x43b682[_0x3eff('0x34')][_0x3eff('0x37')]?_0x43b682[_0x3eff('0x34')]:_0x4b6a8b[_0x3eff('0x35')];if(!_0x42132e['query'][_0x3eff('0x38')]('nolimit')){_0x43b682[_0x3eff('0x1e')]=qs[_0x3eff('0x1e')](_0x42132e[_0x3eff('0x31')]['limit']);_0x43b682['offset']=qs[_0x3eff('0x1c')](_0x42132e['query'][_0x3eff('0x1c')]);}_0x43b682[_0x3eff('0x39')]=qs[_0x3eff('0x3a')](_0x42132e[_0x3eff('0x31')]['sort']);_0x43b682[_0x3eff('0x3b')]=qs[_0x3eff('0x32')](_[_0x3eff('0x3c')](_0x42132e[_0x3eff('0x31')],_0x4b6a8b[_0x3eff('0x32')]),_0x167331);if(_0x42132e[_0x3eff('0x31')][_0x3eff('0x3d')]){_0x43b682[_0x3eff('0x3b')]=_['merge'](_0x43b682[_0x3eff('0x3b')],{'$or':_[_0x3eff('0x2c')](_0x167331,function(_0x174976){if(_0x174976[_0x3eff('0x2f')]!==_0x3eff('0x3e')){var _0x58209d={};_0x58209d[_0x174976[_0x3eff('0x29')]]={'$like':'%'+_0x42132e['query'][_0x3eff('0x3d')]+'%'};return _0x58209d;}})});}_0x43b682=_[_0x3eff('0x3f')]({},_0x43b682,_0x42132e[_0x3eff('0x40')]);var _0x32055e={'where':_0x43b682[_0x3eff('0x3b')]};return db[_0x3eff('0x2d')][_0x3eff('0x1f')](_0x32055e)['then'](function(_0x5d25bf){_0x5442c9[_0x3eff('0x1f')]=_0x5d25bf;if(_0x42132e[_0x3eff('0x31')][_0x3eff('0x41')]){_0x43b682[_0x3eff('0x42')]=[{'all':!![]}];}return db[_0x3eff('0x2d')][_0x3eff('0x43')](_0x43b682);})[_0x3eff('0x26')](function(_0xf851e3){_0x5442c9[_0x3eff('0x44')]=_0xf851e3;return _0x5442c9;})[_0x3eff('0x26')](respondWithFilteredResult(_0x30a003,_0x43b682))[_0x3eff('0x45')](handleError(_0x30a003,null));};exports[_0x3eff('0x46')]=function(_0x370882,_0x133e5d){var _0x55e512={'raw':!![],'where':{'id':_0x370882[_0x3eff('0x47')]['id']}},_0x1bad5f={};_0x1bad5f['model']=_[_0x3eff('0x48')](db[_0x3eff('0x2d')]['rawAttributes']);_0x1bad5f[_0x3eff('0x31')]=_[_0x3eff('0x48')](_0x370882['query']);_0x1bad5f['filters']=_[_0x3eff('0x33')](_0x1bad5f[_0x3eff('0x35')],_0x1bad5f[_0x3eff('0x31')]);_0x55e512[_0x3eff('0x34')]=_[_0x3eff('0x33')](_0x1bad5f[_0x3eff('0x35')],qs['fields'](_0x370882['query'][_0x3eff('0x36')]));_0x55e512[_0x3eff('0x34')]=_0x55e512[_0x3eff('0x34')][_0x3eff('0x37')]?_0x55e512['attributes']:_0x1bad5f[_0x3eff('0x35')];if(_0x370882[_0x3eff('0x31')][_0x3eff('0x41')]){_0x55e512[_0x3eff('0x42')]=[{'all':!![]}];}_0x55e512=_[_0x3eff('0x3f')]({},_0x55e512,_0x370882[_0x3eff('0x40')]);return db['AnalyticTreeReport'][_0x3eff('0x49')](_0x55e512)[_0x3eff('0x26')](handleEntityNotFound(_0x133e5d,null))[_0x3eff('0x26')](respondWithResult(_0x133e5d,null))[_0x3eff('0x45')](handleError(_0x133e5d,null));};exports[_0x3eff('0x4a')]=function(_0x3c0ca7,_0x3af8ad){return db['AnalyticTreeReport']['create'](_0x3c0ca7[_0x3eff('0x4b')],{})[_0x3eff('0x26')](respondWithResult(_0x3af8ad,0xc9))[_0x3eff('0x45')](handleError(_0x3af8ad,null));};exports['update']=function(_0x1d7375,_0x37b11a){if(_0x1d7375[_0x3eff('0x4b')]['id']){delete _0x1d7375[_0x3eff('0x4b')]['id'];}return db[_0x3eff('0x2d')][_0x3eff('0x49')]({'where':{'id':_0x1d7375[_0x3eff('0x47')]['id']}})[_0x3eff('0x26')](handleEntityNotFound(_0x37b11a,null))[_0x3eff('0x26')](saveUpdates(_0x1d7375['body'],null))[_0x3eff('0x26')](respondWithResult(_0x37b11a,null))[_0x3eff('0x45')](handleError(_0x37b11a,null));};exports[_0x3eff('0x27')]=function(_0x1caeaa,_0x2fcaef){return db[_0x3eff('0x2d')][_0x3eff('0x49')]({'where':{'id':_0x1caeaa[_0x3eff('0x47')]['id']}})[_0x3eff('0x26')](handleEntityNotFound(_0x2fcaef,null))[_0x3eff('0x26')](removeEntity(_0x2fcaef,null))['catch'](handleError(_0x2fcaef,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f29c642..39fedca 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 _0x586f=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x586f,0x12e));var _0xf586=function(_0x12e73c,_0x2cbe1d){_0x12e73c=_0x12e73c-0x0;var _0x4c41cb=_0x586f[_0x12e73c];return _0x4c41cb;};'use strict';var _=require(_0xf586('0x0'));var util=require('util');var logger=require(_0xf586('0x1'))('api');var moment=require(_0xf586('0x2'));var BPromise=require(_0xf586('0x3'));var rp=require(_0xf586('0x4'));var fs=require('fs');var path=require(_0xf586('0x5'));var rimraf=require('rimraf');var config=require(_0xf586('0x6'));var attributes=require(_0xf586('0x7'));module[_0xf586('0x8')]=function(_0x463ca6,_0x1a7d15){return _0x463ca6[_0xf586('0x9')](_0xf586('0xa'),attributes,{'tableName':_0xf586('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed79=['api','bluebird','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','../../config/logger'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xed79,0xbe));var _0x9ed7=function(_0x2d1080,_0x1f8c65){_0x2d1080=_0x2d1080-0x0;var _0x1b85a7=_0xed79[_0x2d1080];return _0x1b85a7;};'use strict';var _=require(_0x9ed7('0x0'));var util=require('util');var logger=require(_0x9ed7('0x1'))(_0x9ed7('0x2'));var moment=require('moment');var BPromise=require(_0x9ed7('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(_0x9ed7('0x4'));module[_0x9ed7('0x5')]=function(_0x4e905d,_0x42c066){return _0x4e905d[_0x9ed7('0x6')]('AnalyticTreeReport',attributes,{'tableName':_0x9ed7('0x7'),'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 25f579b..ce20334 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2b8122,_0x378059){var _0x15dcd7=function(_0x138355){while(--_0x138355){_0x2b8122['push'](_0x2b8122['shift']());}};_0x15dcd7(++_0x378059);}(_0x1261,0x144));var _0x1126=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x1261[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x45c1b7,_0x136e78){var _0x2ae433=function(_0x139954){while(--_0x139954){_0x45c1b7['push'](_0x45c1b7['shift']());}};_0x2ae433(++_0x136e78);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d08e1,_0x34853a){_0x4d08e1=_0x4d08e1-0x0;var _0x22445e=_0x2ef3[_0x4d08e1];return _0x22445e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 29ed1f3..df2dee3 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 _0x7b29=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b29,0x12d));var _0x97b2=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x7b29[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97b2('0x0'));var timeout=require(_0x97b2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97b2('0x2'));var auth=require(_0x97b2('0x3'));var interaction=require(_0x97b2('0x4'));var config=require(_0x97b2('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x97b2('0x6')]('/',auth[_0x97b2('0x7')](),controller[_0x97b2('0x8')]);router[_0x97b2('0x6')](_0x97b2('0x9'),auth[_0x97b2('0x7')](),controller[_0x97b2('0xa')]);router[_0x97b2('0xb')]('/',auth['isAuthenticated'](),controller[_0x97b2('0xc')]);router[_0x97b2('0xd')]('/:id',auth[_0x97b2('0x7')](),controller[_0x97b2('0xe')]);router[_0x97b2('0xf')](_0x97b2('0x9'),auth[_0x97b2('0x7')](),controller[_0x97b2('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfdfd=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','create','put','isAuthenticated','update'];(function(_0x7185cc,_0x424685){var _0x10bf37=function(_0x221225){while(--_0x221225){_0x7185cc['push'](_0x7185cc['shift']());}};_0x10bf37(++_0x424685);}(_0xfdfd,0x16b));var _0xdfdf=function(_0x3a2ace,_0x584d89){_0x3a2ace=_0x3a2ace-0x0;var _0x1616dd=_0xfdfd[_0x3a2ace];return _0x1616dd;};'use strict';var multer=require(_0xdfdf('0x0'));var util=require(_0xdfdf('0x1'));var path=require(_0xdfdf('0x2'));var timeout=require(_0xdfdf('0x3'));var express=require(_0xdfdf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfdf('0x5'));var interaction=require(_0xdfdf('0x6'));var config=require(_0xdfdf('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xdfdf('0x8')]('/',auth['isAuthenticated'](),controller[_0xdfdf('0x9')]);router[_0xdfdf('0x8')](_0xdfdf('0xa'),auth['isAuthenticated'](),controller[_0xdfdf('0xb')]);router[_0xdfdf('0xc')]('/',auth['isAuthenticated'](),controller[_0xdfdf('0xd')]);router[_0xdfdf('0xe')](_0xdfdf('0xa'),auth[_0xdfdf('0xf')](),controller[_0xdfdf('0x10')]);router[_0xdfdf('0x11')]('/:id',auth[_0xdfdf('0xf')](),controller[_0xdfdf('0x12')]);module[_0xdfdf('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b1718c3..f41d853 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 _0x9335=['sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9335,0xab));var _0x5933=function(_0x195167,_0x39933a){_0x195167=_0x195167-0x0;var _0x585f5e=_0x9335[_0x195167];return _0x585f5e;};'use strict';var Sequelize=require(_0x5933('0x0'));module[_0x5933('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x5933('0x2')]},'type':{'type':Sequelize[_0x5933('0x2')]}}; \ No newline at end of file +var _0x8a1b=['exports','STRING','sequelize'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x34d34,_0x14d1a6){_0x34d34=_0x34d34-0x0;var _0x2782db=_0x8a1b[_0x34d34];return _0x2782db;};'use strict';var Sequelize=require(_0xb8a1('0x0'));module[_0xb8a1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xb8a1('0x2')]},'type':{'type':Sequelize[_0xb8a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b77db69..60c2e47 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 _0xb3c2=['filter','options','include','rows','catch','show','params','find','clone','includeAll','get','omit','body','createdAt','create','file','basename','filename','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','order','sort','filters','where','merge','VIRTUAL'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0xb3c2,0x6d));var _0x2b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2b3c('0x0'));var rimraf=require(_0x2b3c('0x1'));var zipdir=require(_0x2b3c('0x2'));var jsonpatch=require(_0x2b3c('0x3'));var rp=require(_0x2b3c('0x4'));var moment=require(_0x2b3c('0x5'));var BPromise=require(_0x2b3c('0x6'));var Mustache=require('mustache');var util=require(_0x2b3c('0x7'));var path=require('path');var sox=require(_0x2b3c('0x8'));var csv=require(_0x2b3c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b3c('0xa'));var _=require(_0x2b3c('0xb'));var squel=require(_0x2b3c('0xc'));var crypto=require(_0x2b3c('0xd'));var jsforce=require(_0x2b3c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2b3c('0x9'));var querystring=require(_0x2b3c('0xf'));var Papa=require(_0x2b3c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2b3c('0x11'));var as=require(_0x2b3c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b3c('0x13'))(_0x2b3c('0x14'));var utils=require(_0x2b3c('0x15'));var config=require(_0x2b3c('0x16'));var licenseUtil=require(_0x2b3c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55d0ab,_0x38561c){_0x38561c=_0x38561c||0xcc;return function(_0x2bd1a4){if(_0x2bd1a4){return _0x55d0ab[_0x2b3c('0x18')](_0x38561c);}return _0x55d0ab[_0x2b3c('0x19')](_0x38561c)[_0x2b3c('0x1a')]();};}function respondWithResult(_0x504eaf,_0x1cc106){_0x1cc106=_0x1cc106||0xc8;return function(_0x30d0d1){if(_0x30d0d1){return _0x504eaf[_0x2b3c('0x19')](_0x1cc106)['json'](_0x30d0d1);}};}function respondWithFilteredResult(_0x399e80,_0x4457fb){return function(_0x99f8a4){if(_0x99f8a4){var _0x229335=typeof _0x4457fb[_0x2b3c('0x1b')]===_0x2b3c('0x1c')&&typeof _0x4457fb[_0x2b3c('0x1d')]===_0x2b3c('0x1c');var _0x5d04f6=_0x99f8a4[_0x2b3c('0x1e')];var _0x1c62e0=_0x229335?0x0:_0x4457fb[_0x2b3c('0x1b')];var _0x163c3a=_0x229335?_0x99f8a4['count']:_0x4457fb[_0x2b3c('0x1b')]+_0x4457fb[_0x2b3c('0x1d')];var _0x1a788f;if(_0x163c3a>=_0x5d04f6){_0x163c3a=_0x5d04f6;_0x1a788f=0xc8;}else{_0x1a788f=0xce;}_0x399e80[_0x2b3c('0x19')](_0x1a788f);return _0x399e80[_0x2b3c('0x1f')]('Content-Range',_0x1c62e0+'-'+_0x163c3a+'/'+_0x5d04f6)['json'](_0x99f8a4);}return null;};}function patchUpdates(_0x999e33){return function(_0x941d38){try{jsonpatch[_0x2b3c('0x20')](_0x941d38,_0x999e33,!![]);}catch(_0x12f870){return BPromise[_0x2b3c('0x21')](_0x12f870);}return _0x941d38[_0x2b3c('0x22')]();};}function saveUpdates(_0x3bc0dd,_0x10a9af){return function(_0x38d909){if(_0x38d909){return _0x38d909[_0x2b3c('0x23')](_0x3bc0dd)[_0x2b3c('0x24')](function(_0x13a4b3){return _0x13a4b3;});}return null;};}function removeEntity(_0x1abb32,_0x2420d3){return function(_0x43060c){if(_0x43060c){return _0x43060c[_0x2b3c('0x25')]()['then'](function(){_0x1abb32[_0x2b3c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e91da,_0x20d147){return function(_0x80a278){if(!_0x80a278){_0x5e91da[_0x2b3c('0x18')](0x194);}return _0x80a278;};}function handleError(_0x48bd78,_0x43edf8){_0x43edf8=_0x43edf8||0x1f4;return function(_0x3d7ffc){logger[_0x2b3c('0x26')](_0x3d7ffc['stack']);if(_0x3d7ffc['name']){delete _0x3d7ffc['name'];}_0x48bd78[_0x2b3c('0x19')](_0x43edf8)[_0x2b3c('0x27')](_0x3d7ffc);};}exports[_0x2b3c('0x28')]=function(_0x5e5b1,_0xe010e8){var _0x1e68a7={},_0x2a7bab={},_0x32e8b2={'count':0x0,'rows':[]};var _0x3c47ed=_[_0x2b3c('0x29')](db[_0x2b3c('0x2a')][_0x2b3c('0x2b')],function(_0x1d6d24){return{'name':_0x1d6d24[_0x2b3c('0x2c')],'type':_0x1d6d24[_0x2b3c('0x2d')][_0x2b3c('0x2e')]};});_0x2a7bab[_0x2b3c('0x2f')]=_['map'](_0x3c47ed,_0x2b3c('0x30'));_0x2a7bab[_0x2b3c('0x31')]=_[_0x2b3c('0x32')](_0x5e5b1['query']);_0x2a7bab['filters']=_[_0x2b3c('0x33')](_0x2a7bab[_0x2b3c('0x2f')],_0x2a7bab['query']);_0x1e68a7['attributes']=_['intersection'](_0x2a7bab['model'],qs[_0x2b3c('0x34')](_0x5e5b1['query'][_0x2b3c('0x34')]));_0x1e68a7['attributes']=_0x1e68a7[_0x2b3c('0x35')][_0x2b3c('0x36')]?_0x1e68a7[_0x2b3c('0x35')]:_0x2a7bab['model'];if(!_0x5e5b1[_0x2b3c('0x31')]['hasOwnProperty']('nolimit')){_0x1e68a7[_0x2b3c('0x1d')]=qs[_0x2b3c('0x1d')](_0x5e5b1[_0x2b3c('0x31')]['limit']);_0x1e68a7[_0x2b3c('0x1b')]=qs['offset'](_0x5e5b1['query'][_0x2b3c('0x1b')]);}_0x1e68a7[_0x2b3c('0x37')]=qs[_0x2b3c('0x38')](_0x5e5b1[_0x2b3c('0x31')][_0x2b3c('0x38')]);_0x1e68a7['where']=qs[_0x2b3c('0x39')](_['pick'](_0x5e5b1[_0x2b3c('0x31')],_0x2a7bab[_0x2b3c('0x39')]),_0x3c47ed);if(_0x5e5b1[_0x2b3c('0x31')]['filter']){_0x1e68a7[_0x2b3c('0x3a')]=_[_0x2b3c('0x3b')](_0x1e68a7['where'],{'$or':_['map'](_0x3c47ed,function(_0x348313){if(_0x348313[_0x2b3c('0x2d')]!==_0x2b3c('0x3c')){var _0x1bd099={};_0x1bd099[_0x348313[_0x2b3c('0x30')]]={'$like':'%'+_0x5e5b1[_0x2b3c('0x31')][_0x2b3c('0x3d')]+'%'};return _0x1bd099;}})});}_0x1e68a7=_[_0x2b3c('0x3b')]({},_0x1e68a7,_0x5e5b1[_0x2b3c('0x3e')]);var _0x576dc8={'where':_0x1e68a7[_0x2b3c('0x3a')]};return db[_0x2b3c('0x2a')][_0x2b3c('0x1e')](_0x576dc8)[_0x2b3c('0x24')](function(_0x329af7){_0x32e8b2[_0x2b3c('0x1e')]=_0x329af7;if(_0x5e5b1[_0x2b3c('0x31')]['includeAll']){_0x1e68a7[_0x2b3c('0x3f')]=[{'all':!![]}];}return db[_0x2b3c('0x2a')]['findAll'](_0x1e68a7);})['then'](function(_0x49689d){_0x32e8b2[_0x2b3c('0x40')]=_0x49689d;return _0x32e8b2;})['then'](respondWithFilteredResult(_0xe010e8,_0x1e68a7))[_0x2b3c('0x41')](handleError(_0xe010e8,null));};exports[_0x2b3c('0x42')]=function(_0x497750,_0xb38ba6){var _0x4d3cd0={'raw':!![],'where':{'id':_0x497750[_0x2b3c('0x43')]['id']}},_0x5177fd={};_0x5177fd[_0x2b3c('0x2f')]=_[_0x2b3c('0x32')](db[_0x2b3c('0x2a')]['rawAttributes']);_0x5177fd['query']=_['keys'](_0x497750[_0x2b3c('0x31')]);_0x5177fd['filters']=_[_0x2b3c('0x33')](_0x5177fd[_0x2b3c('0x2f')],_0x5177fd['query']);_0x4d3cd0[_0x2b3c('0x35')]=_[_0x2b3c('0x33')](_0x5177fd[_0x2b3c('0x2f')],qs['fields'](_0x497750[_0x2b3c('0x31')][_0x2b3c('0x34')]));_0x4d3cd0[_0x2b3c('0x35')]=_0x4d3cd0[_0x2b3c('0x35')][_0x2b3c('0x36')]?_0x4d3cd0[_0x2b3c('0x35')]:_0x5177fd[_0x2b3c('0x2f')];if(_0x497750[_0x2b3c('0x31')]['includeAll']){_0x4d3cd0[_0x2b3c('0x3f')]=[{'all':!![]}];}_0x4d3cd0=_[_0x2b3c('0x3b')]({},_0x4d3cd0,_0x497750[_0x2b3c('0x3e')]);return db['Attachment'][_0x2b3c('0x44')](_0x4d3cd0)[_0x2b3c('0x24')](handleEntityNotFound(_0xb38ba6,null))[_0x2b3c('0x24')](respondWithResult(_0xb38ba6,null))[_0x2b3c('0x41')](handleError(_0xb38ba6,null));};exports[_0x2b3c('0x45')]=function(_0xbda2d6,_0x5656f3){var _0x3e80f6={'where':{'id':_0xbda2d6[_0x2b3c('0x43')]['id']}},_0x5dd175={};_0x5dd175[_0x2b3c('0x2f')]=_[_0x2b3c('0x32')](db[_0x2b3c('0x2a')][_0x2b3c('0x2b')]);_0x3e80f6['attributes']=_[_0x2b3c('0x33')](_0x5dd175[_0x2b3c('0x2f')],qs[_0x2b3c('0x34')](_0xbda2d6['query']['fields']));_0x3e80f6['attributes']=_0x3e80f6[_0x2b3c('0x35')][_0x2b3c('0x36')]?_0x3e80f6['attributes']:_0x5dd175[_0x2b3c('0x2f')];if(_0xbda2d6['query'][_0x2b3c('0x46')]){_0x3e80f6[_0x2b3c('0x3f')]=[{'all':!![]}];}_0x3e80f6=_['merge']({},_0x3e80f6,_0xbda2d6[_0x2b3c('0x3e')]);return db[_0x2b3c('0x2a')][_0x2b3c('0x44')](_0x3e80f6)[_0x2b3c('0x24')](handleEntityNotFound(_0x5656f3,null))[_0x2b3c('0x24')](function(_0x4ab58b){if(_0x4ab58b){var _0x298569=_0x4ab58b[_0x2b3c('0x47')]({'plain':!![]});_0x298569=qs[_0x2b3c('0x48')](_0x298569,['id','createdAt','updatedAt']);_0xbda2d6[_0x2b3c('0x49')]=_[_0x2b3c('0x48')](_0xbda2d6[_0x2b3c('0x49')],['id',_0x2b3c('0x4a'),'updatedAt']);return db[_0x2b3c('0x2a')][_0x2b3c('0x4b')](_[_0x2b3c('0x3b')](_0x298569,_0xbda2d6[_0x2b3c('0x49')]),{'include':_0xbda2d6['query'][_0x2b3c('0x46')]?[{'all':!![]}]:undefined});}})[_0x2b3c('0x24')](respondWithResult(_0x5656f3,0xc9))[_0x2b3c('0x41')](handleError(_0x5656f3,null));};exports[_0x2b3c('0x23')]=function(_0x46832c,_0x5c5436){if(_0x46832c[_0x2b3c('0x49')]['id']){delete _0x46832c[_0x2b3c('0x49')]['id'];}return db[_0x2b3c('0x2a')]['find']({'where':{'id':_0x46832c[_0x2b3c('0x43')]['id']}})[_0x2b3c('0x24')](handleEntityNotFound(_0x5c5436,null))[_0x2b3c('0x24')](saveUpdates(_0x46832c[_0x2b3c('0x49')],null))[_0x2b3c('0x24')](respondWithResult(_0x5c5436,null))[_0x2b3c('0x41')](handleError(_0x5c5436,null));};exports['destroy']=function(_0x45ef2a,_0x2cd403){return db[_0x2b3c('0x2a')][_0x2b3c('0x44')]({'where':{'id':_0x45ef2a[_0x2b3c('0x43')]['id']}})[_0x2b3c('0x24')](handleEntityNotFound(_0x2cd403,null))[_0x2b3c('0x24')](removeEntity(_0x2cd403,null))[_0x2b3c('0x41')](handleError(_0x2cd403,null));};exports[_0x2b3c('0x4b')]=function(_0x454577,_0x20ad30,_0x14dbcd){_0x454577[_0x2b3c('0x49')][_0x2b3c('0x30')]=_0x454577[_0x2b3c('0x4c')]['originalname'];_0x454577[_0x2b3c('0x49')][_0x2b3c('0x4d')]=_0x454577[_0x2b3c('0x4c')][_0x2b3c('0x4e')];_0x454577[_0x2b3c('0x49')][_0x2b3c('0x2d')]=_0x454577['file']['mimetype'];return db['Attachment']['create'](_0x454577[_0x2b3c('0x49')])[_0x2b3c('0x24')](respondWithResult(_0x20ad30,0xc9))[_0x2b3c('0x41')](handleError(_0x20ad30,null));};exports[_0x2b3c('0x4f')]=function(_0x2c11f9,_0x4bf428,_0x9a3815){return db[_0x2b3c('0x2a')][_0x2b3c('0x50')]({'where':{'id':_0x2c11f9[_0x2b3c('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4bf428,null))[_0x2b3c('0x24')](function(_0x5c0bc7){if(_0x5c0bc7){var _0x250991=_0x5c0bc7[_0x2b3c('0x51')]!==null;var _0x4b4d69=path[_0x2b3c('0x52')](config['root'],_0x2b3c('0x53'));if(_0x250991){_0x4b4d69=path[_0x2b3c('0x52')](_0x4b4d69,_0x2b3c('0x54'));}var _0x5253d6=path['join'](_0x4b4d69,_0x5c0bc7[_0x2b3c('0x4d')]);return _0x4bf428['download'](_0x5253d6);}})[_0x2b3c('0x41')](handleError(_0x4bf428,null));}; \ No newline at end of file +var _0x7efe=['name','send','Attachment','rawAttributes','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','includeAll','include','findAll','rows','show','options','catch','params','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7efe,0x18f));var _0xe7ef=function(_0x58dfaa,_0xd0b173){_0x58dfaa=_0x58dfaa-0x0;var _0x59a3c7=_0x7efe[_0x58dfaa];return _0x59a3c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7ef('0x0'));var zipdir=require(_0xe7ef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe7ef('0x2'));var BPromise=require(_0xe7ef('0x3'));var Mustache=require('mustache');var util=require(_0xe7ef('0x4'));var path=require(_0xe7ef('0x5'));var sox=require(_0xe7ef('0x6'));var csv=require(_0xe7ef('0x7'));var ejs=require(_0xe7ef('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ef('0x9'));var _=require(_0xe7ef('0xa'));var squel=require(_0xe7ef('0xb'));var crypto=require(_0xe7ef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe7ef('0xd'));var toCsv=require(_0xe7ef('0x7'));var querystring=require(_0xe7ef('0xe'));var Papa=require(_0xe7ef('0xf'));var Redis=require('ioredis');var authService=require(_0xe7ef('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7ef('0x11'));var logger=require(_0xe7ef('0x12'))(_0xe7ef('0x13'));var utils=require(_0xe7ef('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe7ef('0x15'));var db=require(_0xe7ef('0x16'))['db'];function respondWithStatusCode(_0x287233,_0x1483b5){_0x1483b5=_0x1483b5||0xcc;return function(_0x322334){if(_0x322334){return _0x287233[_0xe7ef('0x17')](_0x1483b5);}return _0x287233[_0xe7ef('0x18')](_0x1483b5)[_0xe7ef('0x19')]();};}function respondWithResult(_0x5048f8,_0x35130c){_0x35130c=_0x35130c||0xc8;return function(_0x10e6c4){if(_0x10e6c4){return _0x5048f8['status'](_0x35130c)[_0xe7ef('0x1a')](_0x10e6c4);}};}function respondWithFilteredResult(_0x5f3489,_0x302bd5){return function(_0x45cac7){if(_0x45cac7){var _0x40e4bc=typeof _0x302bd5[_0xe7ef('0x1b')]===_0xe7ef('0x1c')&&typeof _0x302bd5[_0xe7ef('0x1d')]===_0xe7ef('0x1c');var _0x2e7b59=_0x45cac7[_0xe7ef('0x1e')];var _0x4b5398=_0x40e4bc?0x0:_0x302bd5[_0xe7ef('0x1b')];var _0xd91057=_0x40e4bc?_0x45cac7['count']:_0x302bd5[_0xe7ef('0x1b')]+_0x302bd5[_0xe7ef('0x1d')];var _0x2e4cfe;if(_0xd91057>=_0x2e7b59){_0xd91057=_0x2e7b59;_0x2e4cfe=0xc8;}else{_0x2e4cfe=0xce;}_0x5f3489[_0xe7ef('0x18')](_0x2e4cfe);return _0x5f3489[_0xe7ef('0x1f')](_0xe7ef('0x20'),_0x4b5398+'-'+_0xd91057+'/'+_0x2e7b59)[_0xe7ef('0x1a')](_0x45cac7);}return null;};}function patchUpdates(_0x43dd75){return function(_0x454727){try{jsonpatch[_0xe7ef('0x21')](_0x454727,_0x43dd75,!![]);}catch(_0x364059){return BPromise[_0xe7ef('0x22')](_0x364059);}return _0x454727[_0xe7ef('0x23')]();};}function saveUpdates(_0x5daf39,_0x2537de){return function(_0x5bc30d){if(_0x5bc30d){return _0x5bc30d[_0xe7ef('0x24')](_0x5daf39)[_0xe7ef('0x25')](function(_0x18233d){return _0x18233d;});}return null;};}function removeEntity(_0x228c49,_0x3c9803){return function(_0x2bc088){if(_0x2bc088){return _0x2bc088[_0xe7ef('0x26')]()[_0xe7ef('0x25')](function(){_0x228c49[_0xe7ef('0x18')](0xcc)[_0xe7ef('0x19')]();});}};}function handleEntityNotFound(_0x4a447d,_0x103141){return function(_0x29ca87){if(!_0x29ca87){_0x4a447d[_0xe7ef('0x17')](0x194);}return _0x29ca87;};}function handleError(_0x4496af,_0x26997c){_0x26997c=_0x26997c||0x1f4;return function(_0x4f526f){logger[_0xe7ef('0x27')](_0x4f526f[_0xe7ef('0x28')]);if(_0x4f526f[_0xe7ef('0x29')]){delete _0x4f526f[_0xe7ef('0x29')];}_0x4496af[_0xe7ef('0x18')](_0x26997c)[_0xe7ef('0x2a')](_0x4f526f);};}exports['index']=function(_0x573eb7,_0x2c9990){var _0x38761f={},_0x35d9d5={},_0x529f79={'count':0x0,'rows':[]};var _0x6f316=_['map'](db[_0xe7ef('0x2b')][_0xe7ef('0x2c')],function(_0x307c45){return{'name':_0x307c45['fieldName'],'type':_0x307c45['type']['key']};});_0x35d9d5[_0xe7ef('0x2d')]=_[_0xe7ef('0x2e')](_0x6f316,_0xe7ef('0x29'));_0x35d9d5['query']=_[_0xe7ef('0x2f')](_0x573eb7[_0xe7ef('0x30')]);_0x35d9d5['filters']=_['intersection'](_0x35d9d5[_0xe7ef('0x2d')],_0x35d9d5[_0xe7ef('0x30')]);_0x38761f[_0xe7ef('0x31')]=_[_0xe7ef('0x32')](_0x35d9d5[_0xe7ef('0x2d')],qs[_0xe7ef('0x33')](_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x33')]));_0x38761f['attributes']=_0x38761f[_0xe7ef('0x31')][_0xe7ef('0x34')]?_0x38761f[_0xe7ef('0x31')]:_0x35d9d5[_0xe7ef('0x2d')];if(!_0x573eb7['query'][_0xe7ef('0x35')](_0xe7ef('0x36'))){_0x38761f[_0xe7ef('0x1d')]=qs[_0xe7ef('0x1d')](_0x573eb7['query'][_0xe7ef('0x1d')]);_0x38761f['offset']=qs[_0xe7ef('0x1b')](_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x1b')]);}_0x38761f[_0xe7ef('0x37')]=qs[_0xe7ef('0x38')](_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x38')]);_0x38761f[_0xe7ef('0x39')]=qs[_0xe7ef('0x3a')](_['pick'](_0x573eb7[_0xe7ef('0x30')],_0x35d9d5['filters']),_0x6f316);if(_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x3b')]){_0x38761f[_0xe7ef('0x39')]=_[_0xe7ef('0x3c')](_0x38761f[_0xe7ef('0x39')],{'$or':_[_0xe7ef('0x2e')](_0x6f316,function(_0x42e3b1){if(_0x42e3b1[_0xe7ef('0x3d')]!=='VIRTUAL'){var _0x2d5bdc={};_0x2d5bdc[_0x42e3b1[_0xe7ef('0x29')]]={'$like':'%'+_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x3b')]+'%'};return _0x2d5bdc;}})});}_0x38761f=_[_0xe7ef('0x3c')]({},_0x38761f,_0x573eb7['options']);var _0x19b602={'where':_0x38761f['where']};return db['Attachment'][_0xe7ef('0x1e')](_0x19b602)[_0xe7ef('0x25')](function(_0x57c268){_0x529f79[_0xe7ef('0x1e')]=_0x57c268;if(_0x573eb7[_0xe7ef('0x30')][_0xe7ef('0x3e')]){_0x38761f[_0xe7ef('0x3f')]=[{'all':!![]}];}return db[_0xe7ef('0x2b')][_0xe7ef('0x40')](_0x38761f);})[_0xe7ef('0x25')](function(_0x192f4b){_0x529f79[_0xe7ef('0x41')]=_0x192f4b;return _0x529f79;})[_0xe7ef('0x25')](respondWithFilteredResult(_0x2c9990,_0x38761f))['catch'](handleError(_0x2c9990,null));};exports[_0xe7ef('0x42')]=function(_0x9a3a9,_0x2bb0b8){var _0x3658cb={'raw':!![],'where':{'id':_0x9a3a9['params']['id']}},_0x15cddf={};_0x15cddf['model']=_['keys'](db['Attachment'][_0xe7ef('0x2c')]);_0x15cddf[_0xe7ef('0x30')]=_[_0xe7ef('0x2f')](_0x9a3a9[_0xe7ef('0x30')]);_0x15cddf[_0xe7ef('0x3a')]=_[_0xe7ef('0x32')](_0x15cddf[_0xe7ef('0x2d')],_0x15cddf[_0xe7ef('0x30')]);_0x3658cb[_0xe7ef('0x31')]=_[_0xe7ef('0x32')](_0x15cddf[_0xe7ef('0x2d')],qs[_0xe7ef('0x33')](_0x9a3a9[_0xe7ef('0x30')]['fields']));_0x3658cb['attributes']=_0x3658cb[_0xe7ef('0x31')]['length']?_0x3658cb[_0xe7ef('0x31')]:_0x15cddf[_0xe7ef('0x2d')];if(_0x9a3a9['query'][_0xe7ef('0x3e')]){_0x3658cb[_0xe7ef('0x3f')]=[{'all':!![]}];}_0x3658cb=_['merge']({},_0x3658cb,_0x9a3a9[_0xe7ef('0x43')]);return db[_0xe7ef('0x2b')]['find'](_0x3658cb)[_0xe7ef('0x25')](handleEntityNotFound(_0x2bb0b8,null))[_0xe7ef('0x25')](respondWithResult(_0x2bb0b8,null))[_0xe7ef('0x44')](handleError(_0x2bb0b8,null));};exports['clone']=function(_0x3556af,_0x3c48d0){var _0x3c0665={'where':{'id':_0x3556af[_0xe7ef('0x45')]['id']}},_0x5339ca={};_0x5339ca['model']=_['keys'](db[_0xe7ef('0x2b')][_0xe7ef('0x2c')]);_0x3c0665[_0xe7ef('0x31')]=_[_0xe7ef('0x32')](_0x5339ca[_0xe7ef('0x2d')],qs[_0xe7ef('0x33')](_0x3556af[_0xe7ef('0x30')][_0xe7ef('0x33')]));_0x3c0665[_0xe7ef('0x31')]=_0x3c0665['attributes'][_0xe7ef('0x34')]?_0x3c0665[_0xe7ef('0x31')]:_0x5339ca[_0xe7ef('0x2d')];if(_0x3556af['query'][_0xe7ef('0x3e')]){_0x3c0665[_0xe7ef('0x3f')]=[{'all':!![]}];}_0x3c0665=_[_0xe7ef('0x3c')]({},_0x3c0665,_0x3556af[_0xe7ef('0x43')]);return db[_0xe7ef('0x2b')][_0xe7ef('0x46')](_0x3c0665)[_0xe7ef('0x25')](handleEntityNotFound(_0x3c48d0,null))['then'](function(_0x329e46){if(_0x329e46){var _0x430577=_0x329e46[_0xe7ef('0x47')]({'plain':!![]});_0x430577=qs[_0xe7ef('0x48')](_0x430577,['id',_0xe7ef('0x49'),_0xe7ef('0x4a')]);_0x3556af[_0xe7ef('0x4b')]=_[_0xe7ef('0x48')](_0x3556af[_0xe7ef('0x4b')],['id',_0xe7ef('0x49'),_0xe7ef('0x4a')]);return db[_0xe7ef('0x2b')][_0xe7ef('0x4c')](_[_0xe7ef('0x3c')](_0x430577,_0x3556af[_0xe7ef('0x4b')]),{'include':_0x3556af[_0xe7ef('0x30')][_0xe7ef('0x3e')]?[{'all':!![]}]:undefined});}})[_0xe7ef('0x25')](respondWithResult(_0x3c48d0,0xc9))['catch'](handleError(_0x3c48d0,null));};exports[_0xe7ef('0x24')]=function(_0x376618,_0x16fee4){if(_0x376618[_0xe7ef('0x4b')]['id']){delete _0x376618[_0xe7ef('0x4b')]['id'];}return db[_0xe7ef('0x2b')]['find']({'where':{'id':_0x376618[_0xe7ef('0x45')]['id']}})[_0xe7ef('0x25')](handleEntityNotFound(_0x16fee4,null))[_0xe7ef('0x25')](saveUpdates(_0x376618[_0xe7ef('0x4b')],null))[_0xe7ef('0x25')](respondWithResult(_0x16fee4,null))[_0xe7ef('0x44')](handleError(_0x16fee4,null));};exports[_0xe7ef('0x26')]=function(_0x419a4d,_0x2c6b33){return db[_0xe7ef('0x2b')][_0xe7ef('0x46')]({'where':{'id':_0x419a4d[_0xe7ef('0x45')]['id']}})[_0xe7ef('0x25')](handleEntityNotFound(_0x2c6b33,null))[_0xe7ef('0x25')](removeEntity(_0x2c6b33,null))['catch'](handleError(_0x2c6b33,null));};exports[_0xe7ef('0x4c')]=function(_0x3a9d46,_0x41fd3a,_0x162203){_0x3a9d46[_0xe7ef('0x4b')][_0xe7ef('0x29')]=_0x3a9d46[_0xe7ef('0x4d')][_0xe7ef('0x4e')];_0x3a9d46[_0xe7ef('0x4b')][_0xe7ef('0x4f')]=_0x3a9d46['file'][_0xe7ef('0x50')];_0x3a9d46[_0xe7ef('0x4b')][_0xe7ef('0x3d')]=_0x3a9d46['file'][_0xe7ef('0x51')];return db[_0xe7ef('0x2b')][_0xe7ef('0x4c')](_0x3a9d46['body'])['then'](respondWithResult(_0x41fd3a,0xc9))[_0xe7ef('0x44')](handleError(_0x41fd3a,null));};exports[_0xe7ef('0x52')]=function(_0x3226bd,_0x403b46,_0x507e06){return db[_0xe7ef('0x2b')][_0xe7ef('0x53')]({'where':{'id':_0x3226bd[_0xe7ef('0x45')]['id']},'raw':!![]})[_0xe7ef('0x25')](handleEntityNotFound(_0x403b46,null))[_0xe7ef('0x25')](function(_0x43e2f9){if(_0x43e2f9){var _0x821117=_0x43e2f9['ChatOfflineMessageId']!==null;var _0x446b78=path[_0xe7ef('0x54')](config[_0xe7ef('0x55')],_0xe7ef('0x56'));if(_0x821117){_0x446b78=path[_0xe7ef('0x54')](_0x446b78,_0xe7ef('0x57'));}var _0x2125da=path[_0xe7ef('0x54')](_0x446b78,_0x43e2f9[_0xe7ef('0x4f')]);return _0x403b46[_0xe7ef('0x52')](_0x2125da);}})[_0xe7ef('0x44')](handleError(_0x403b46,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1d19e46..68d4094 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 _0xf369=['../../config/logger','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0xbc5e19,_0x1648d0){var _0x24943c=function(_0x29db45){while(--_0x29db45){_0xbc5e19['push'](_0xbc5e19['shift']());}};_0x24943c(++_0x1648d0);}(_0xf369,0x108));var _0x9f36=function(_0x422569,_0xbf158a){_0x422569=_0x422569-0x0;var _0x34f785=_0xf369[_0x422569];return _0x34f785;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f36('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9f36('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f36('0x2'));var rimraf=require(_0x9f36('0x3'));var config=require(_0x9f36('0x4'));var attributes=require(_0x9f36('0x5'));module[_0x9f36('0x6')]=function(_0x5e6bfc,_0x2e1b92){return _0x5e6bfc[_0x9f36('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b9=['../../config/environment','./attachment.attributes','define','Attachment','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x32b9,0x13a));var _0x932b=function(_0xd8bb94,_0x77b119){_0xd8bb94=_0xd8bb94-0x0;var _0x17be1b=_0x32b9[_0xd8bb94];return _0x17be1b;};'use strict';var _=require(_0x932b('0x0'));var util=require(_0x932b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x932b('0x2'));var BPromise=require(_0x932b('0x3'));var rp=require(_0x932b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x932b('0x5'));var config=require(_0x932b('0x6'));var attributes=require(_0x932b('0x7'));module['exports']=function(_0x382eaa,_0x5cf624){return _0x382eaa[_0x932b('0x8')](_0x932b('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 8bf92c4..36748e5 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 _0xc2cc=['raw','CreateAttachment','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Attachment','create','body','options'];(function(_0x3a987c,_0x222403){var _0x5d63ae=function(_0x31f961){while(--_0x31f961){_0x3a987c['push'](_0x3a987c['shift']());}};_0x5d63ae(++_0x222403);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xcc2c('0x0'));var moment=require(_0xcc2c('0x1'));var BPromise=require(_0xcc2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc2c('0x4'));var logger=require('../../config/logger')(_0xcc2c('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc2c('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x475a85,_0x4ab837,_0x144b90){return new BPromise(function(_0x5a276f,_0x1d311f){return client['request'](_0x475a85,_0x144b90)['then'](function(_0x2bde97){logger[_0xcc2c('0x7')](_0xcc2c('0x8'),_0x4ab837,_0xcc2c('0x9'));logger[_0xcc2c('0xa')](_0xcc2c('0xb'),_0x4ab837,_0xcc2c('0x9'),JSON[_0xcc2c('0xc')](_0x2bde97));if(_0x2bde97['error']){if(_0x2bde97[_0xcc2c('0xd')]['code']===0x1f4){logger[_0xcc2c('0xd')](_0xcc2c('0x8'),_0x4ab837,_0x2bde97[_0xcc2c('0xd')][_0xcc2c('0xe')]);return _0x1d311f(_0x2bde97['error']['message']);}logger['error'](_0xcc2c('0x8'),_0x4ab837,_0x2bde97[_0xcc2c('0xd')]['message']);return _0x5a276f(_0x2bde97['error'][_0xcc2c('0xe')]);}else{logger['info'](_0xcc2c('0x8'),_0x4ab837,_0xcc2c('0x9'));_0x5a276f(_0x2bde97[_0xcc2c('0xf')][_0xcc2c('0xe')]);}})['catch'](function(_0x5d6189){logger[_0xcc2c('0xd')](_0xcc2c('0x8'),_0x4ab837,_0x5d6189);_0x1d311f(_0x5d6189);});});}exports['CreateAttachment']=function(_0x31849a){var _0x285deb=this;return new Promise(function(_0x440458,_0x2a9f02){return db[_0xcc2c('0x10')][_0xcc2c('0x11')](_0x31849a[_0xcc2c('0x12')],{'raw':_0x31849a['options']?_0x31849a[_0xcc2c('0x13')][_0xcc2c('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x4d22fe){logger['info'](_0xcc2c('0x15'),_0x31849a);logger['debug'](_0xcc2c('0x15'),_0x31849a,JSON[_0xcc2c('0xc')](_0x4d22fe));_0x440458(_0x4d22fe);})['catch'](function(_0x321279){logger[_0xcc2c('0xd')]('CreateAttachment',_0x321279[_0xcc2c('0xe')],_0x31849a);_0x2a9f02(_0x285deb['error'](0x1f4,_0x321279[_0xcc2c('0xe')]));});});}; \ No newline at end of file +var _0x8cfd=['options','raw','info','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body'];(function(_0x612ce5,_0x3f9440){var _0x1558e8=function(_0x2cfe1a){while(--_0x2cfe1a){_0x612ce5['push'](_0x612ce5['shift']());}};_0x1558e8(++_0x3f9440);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x6148ee,_0x4d2fca){_0x6148ee=_0x6148ee-0x0;var _0x5afc74=_0x8cfd[_0x6148ee];return _0x5afc74;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require(_0xd8cf('0x4'));var fs=require('fs');var Redis=require(_0xd8cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require(_0xd8cf('0xa'));var client=jayson[_0xd8cf('0xb')][_0xd8cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b41b7,_0x5cfd20,_0x3fe2d2){return new BPromise(function(_0xa5b446,_0x37b91b){return client[_0xd8cf('0xd')](_0x4b41b7,_0x3fe2d2)[_0xd8cf('0xe')](function(_0x668d6c){logger['info'](_0xd8cf('0xf'),_0x5cfd20,_0xd8cf('0x10'));logger[_0xd8cf('0x11')](_0xd8cf('0x12'),_0x5cfd20,_0xd8cf('0x10'),JSON[_0xd8cf('0x13')](_0x668d6c));if(_0x668d6c[_0xd8cf('0x14')]){if(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x15')]===0x1f4){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c[_0xd8cf('0x14')]['message']);return _0x37b91b(_0x668d6c[_0xd8cf('0x14')]['message']);}logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c['error'][_0xd8cf('0x16')]);return _0xa5b446(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x16')]);}else{logger['info'](_0xd8cf('0xf'),_0x5cfd20,'request\x20sent');_0xa5b446(_0x668d6c[_0xd8cf('0x17')][_0xd8cf('0x16')]);}})[_0xd8cf('0x18')](function(_0x55018c){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x55018c);_0x37b91b(_0x55018c);});});}exports['CreateAttachment']=function(_0xecd444){var _0x73e7c3=this;return new Promise(function(_0x3bee85,_0xf8732e){return db[_0xd8cf('0x19')][_0xd8cf('0x1a')](_0xecd444[_0xd8cf('0x1b')],{'raw':_0xecd444[_0xd8cf('0x1c')]?_0xecd444[_0xd8cf('0x1c')][_0xd8cf('0x1d')]===undefined?!![]:![]:!![]})[_0xd8cf('0xe')](function(_0x2f8e8a){logger[_0xd8cf('0x1e')](_0xd8cf('0x1f'),_0xecd444);logger['debug'](_0xd8cf('0x1f'),_0xecd444,JSON[_0xd8cf('0x13')](_0x2f8e8a));_0x3bee85(_0x2f8e8a);})[_0xd8cf('0x18')](function(_0x182613){logger[_0xd8cf('0x14')]('CreateAttachment',_0x182613[_0xd8cf('0x16')],_0xecd444);_0xf8732e(_0x73e7c3['error'](0x1f4,_0x182613['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index cf4d575..03cfce1 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x30986e,_0x323eb3){var _0x4f1939=function(_0x1b733f){while(--_0x1b733f){_0x30986e['push'](_0x30986e['shift']());}};_0x4f1939(++_0x323eb3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e2198,_0x399d54){_0x4e2198=_0x4e2198-0x0;var _0x22fdd7=_0xb10b[_0x4e2198];return _0x22fdd7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x1f3411,_0x3c5e48){var _0x30b488=function(_0x4cab57){while(--_0x4cab57){_0x1f3411['push'](_0x1f3411['shift']());}};_0x30b488(++_0x3c5e48);}(_0xadb5,0xad));var _0x5adb=function(_0x24755e,_0x1967f4){_0x24755e=_0x24755e-0x0;var _0x16ec73=_0xadb5[_0x24755e];return _0x16ec73;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4dd5cb6..0e7f4fe 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 _0xbe83=['add','minutes','clearBlockUser','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blockedAt','online','admin','user','agent','then'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xbe83,0x19c));var _0x3be8=function(_0x3ef8c7,_0x53538b){_0x3ef8c7=_0x3ef8c7-0x0;var _0x3882bc=_0xbe83[_0x3ef8c7];return _0x3882bc;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x3be8('0x0'))[_0x3be8('0x1')];var moment=require(_0x3be8('0x2'));var ActiveDirectory=require(_0x3be8('0x3'));var BPromise=require(_0x3be8('0x4'));var util=require(_0x3be8('0x5'));var db=require(_0x3be8('0x6'))['db'];var authService=require(_0x3be8('0x7'));var utils=require(_0x3be8('0x8'));var config=require(_0x3be8('0x9'));var logger=require(_0x3be8('0xa'))(_0x3be8('0xb'));function isActiveDirectoryConfigured(_0x19b3e2){var _0x17f2da=![];if(typeof _0x19b3e2[_0x3be8('0xc')]!==_0x3be8('0xd')){_0x17f2da=_0x19b3e2[_0x3be8('0xc')][_0x3be8('0xe')]&&_0x19b3e2[_0x3be8('0xc')][_0x3be8('0xf')]&&_0x19b3e2['activedirectory'][_0x3be8('0x10')];}return _0x17f2da;}function adAuthenticate(_0x2e50c9,_0x134897,_0x46c2d7){return new BPromise(function(_0x4ce734,_0x55fb42){try{var _0x559829=new ActiveDirectory(_0x2e50c9);_0x559829[_0x3be8('0x11')](_0x134897,_0x46c2d7,function(_0x1016fa,_0x55035d){if(_0x1016fa){logger[_0x3be8('0x12')]('Error\x20authenticate\x20%s:\x20%s',_0x134897,util[_0x3be8('0x13')](_0x1016fa,{'showHidden':![],'depth':null}));_0x55fb42('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x55035d){logger[_0x3be8('0x12')](_0x3be8('0x14'),_0x134897);_0x55fb42(_0x3be8('0x15'));}else{_0x4ce734(_0x55035d);}});}catch(_0x3d3f78){_0x55fb42(_0x3d3f78);}});}function ActiveDirectoryAuthenticate(_0x5bf5fc,_0x5e2547,_0x549e90,_0x4b4f5d){var _0xfeb0b8,_0x4ac23f;if(!isActiveDirectoryConfigured(config)){logger[_0x3be8('0x12')](_0x3be8('0x16'),_0x5e2547);return _0x4b4f5d(null,![],{'message':_0x3be8('0x15')});}return db[_0x3be8('0x17')][_0x3be8('0x18')]({'where':{'id':0x1},'attributes':[_0x3be8('0x19'),_0x3be8('0x1a')],'raw':!![]})['then'](function(_0x89c2cb){_0xfeb0b8=_0x89c2cb;if(!_0xfeb0b8['adSsoEnabled']){logger[_0x3be8('0x12')](_0x3be8('0x1b'),_0x5e2547);throw new Error(_0x3be8('0x15'));}return _0x5bf5fc[_0x3be8('0x18')]({'logging':!![],'attributes':['id',_0x3be8('0x1c'),_0x3be8('0x1d'),'salt',_0x3be8('0x1e'),_0x3be8('0x1f'),'blocked',_0x3be8('0x20'),_0x3be8('0x21')],'where':{'name':_0x5e2547,'role':{'$or':[_0x3be8('0x22'),_0x3be8('0x23'),_0x3be8('0x24')]},'adSsoEnabled':!![]}});})[_0x3be8('0x25')](function(_0x95ad93){if(!_0x95ad93||_0x95ad93&&_0x95ad93[_0x3be8('0x1c')]!==_0x5e2547){throw new Error(_0x3be8('0x15'));}_0x4ac23f=_0x95ad93;var _0x10bf41=_0x4ac23f[_0x3be8('0x1c')]+'@'+config[_0x3be8('0xc')][_0x3be8('0x10')];return adAuthenticate(config[_0x3be8('0xc')],_0x10bf41,_0x549e90);})[_0x3be8('0x25')](function(_0x2ff4f3){if(_0x4ac23f[_0x3be8('0x1f')]){throw new Error(_0x3be8('0x15'));}if(_0xfeb0b8[_0x3be8('0x1a')]>0x0){if(_0x4ac23f['blocked']){if(moment(_0x4ac23f['blockedAt'])[_0x3be8('0x26')](_0xfeb0b8['blockDuration'],_0x3be8('0x27'))>moment()){throw new Error(_0x3be8('0x15'));}return utils[_0x3be8('0x28')](_0x4ac23f,0x0,![],null)[_0x3be8('0x25')](function(){return utils[_0x3be8('0x29')](_0x4ac23f);})['then'](function(){return _0x4b4f5d(null,_0x4ac23f);});}else{return utils[_0x3be8('0x29')](_0x4ac23f)['then'](function(){return _0x4b4f5d(null,_0x4ac23f);});}}else{return utils['getLicense'](_0x4ac23f)[_0x3be8('0x25')](function(){return _0x4b4f5d(null,_0x4ac23f);});}})['catch'](function(_0x198599){return _0x4b4f5d(null,![],_0x198599);});}function handleError(_0x41aae2,_0x4a628a,_0x47f78a){return _0x41aae2[_0x3be8('0x2a')](_0x4a628a||0x1f4)[_0x3be8('0x2b')]({'message':_0x47f78a?_0x47f78a[_0x3be8('0x2c')]||_0x47f78a:''});}exports['login']=function(_0x1826de,_0x14102f,_0x563383){passport[_0x3be8('0x11')](_0x3be8('0x2d'),function(_0x37f4b2,_0x33f938,_0x4ef61e){var _0x591f8a=_0x37f4b2||_0x4ef61e;if(_0x591f8a){return handleError(_0x14102f,0x191,_0x591f8a);}if(!_0x33f938){return handleError(_0x14102f,0x194,{'message':_0x3be8('0x2e')});}else{var _0x308366={'payload':{'id':_0x33f938['id'],'role':_0x33f938[_0x3be8('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0x3be8('0x2f')](_0x308366)[_0x3be8('0x25')](function(_0x37fd21){_0x14102f[_0x3be8('0x30')]({'id':_0x33f938['id'],'token':_0x37fd21,'statusCall':'','isAlreadyLogged':_0x33f938[_0x3be8('0x21')]});});}})(_0x1826de,_0x14102f,_0x563383);};passport['use'](_0x3be8('0x2d'),new LocalStrategy({'usernameField':_0x3be8('0x1c'),'passwordField':'password'},function(_0x58780f,_0x2bb696,_0x117583){return ActiveDirectoryAuthenticate(db[_0x3be8('0x31')],_0x58780f,_0x2bb696,_0x117583);})); \ No newline at end of file +var _0xab47=['../../mysqldb','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','user','agent','name','blockDuration','add','minutes','getLicense','catch','status','send','message','authenticate','signToken','use','ad-login','User','passport','passport-local','moment','activedirectory2','bluebird','util'];(function(_0x164580,_0x3c81f9){var _0xed7154=function(_0x3b7929){while(--_0x3b7929){_0x164580['push'](_0x164580['shift']());}};_0xed7154(++_0x3c81f9);}(_0xab47,0x114));var _0x7ab4=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xab47[_0x265003];return _0x33c743;};'use strict';var passport=require(_0x7ab4('0x0'));var LocalStrategy=require(_0x7ab4('0x1'))['Strategy'];var moment=require(_0x7ab4('0x2'));var ActiveDirectory=require(_0x7ab4('0x3'));var BPromise=require(_0x7ab4('0x4'));var util=require(_0x7ab4('0x5'));var db=require(_0x7ab4('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7ab4('0x7'));var config=require(_0x7ab4('0x8'));var logger=require(_0x7ab4('0x9'))('api');function isActiveDirectoryConfigured(_0x24727d){var _0x578cca=![];if(typeof _0x24727d[_0x7ab4('0xa')]!==_0x7ab4('0xb')){_0x578cca=_0x24727d[_0x7ab4('0xa')][_0x7ab4('0xc')]&&_0x24727d[_0x7ab4('0xa')][_0x7ab4('0xd')]&&_0x24727d[_0x7ab4('0xa')][_0x7ab4('0xe')];}return _0x578cca;}function adAuthenticate(_0x5cd3c4,_0xaa957f,_0x4db342){return new BPromise(function(_0x3505f3,_0x1aa81e){try{var _0x2bf739=new ActiveDirectory(_0x5cd3c4);_0x2bf739['authenticate'](_0xaa957f,_0x4db342,function(_0x48b20f,_0x26d6fb){if(_0x48b20f){logger[_0x7ab4('0xf')](_0x7ab4('0x10'),_0xaa957f,util['inspect'](_0x48b20f,{'showHidden':![],'depth':null}));_0x1aa81e(_0x7ab4('0x11'));}else if(!_0x26d6fb){logger[_0x7ab4('0xf')](_0x7ab4('0x12'),_0xaa957f);_0x1aa81e(_0x7ab4('0x11'));}else{_0x3505f3(_0x26d6fb);}});}catch(_0x456ee8){_0x1aa81e(_0x456ee8);}});}function ActiveDirectoryAuthenticate(_0x1c6c80,_0x362952,_0x194070,_0x45ea0e){var _0x385887,_0x13c6da;if(!isActiveDirectoryConfigured(config)){logger[_0x7ab4('0xf')](_0x7ab4('0x13'),_0x362952);return _0x45ea0e(null,![],{'message':_0x7ab4('0x11')});}return db['Setting'][_0x7ab4('0x14')]({'where':{'id':0x1},'attributes':[_0x7ab4('0x15'),'blockDuration'],'raw':!![]})[_0x7ab4('0x16')](function(_0x52635b){_0x385887=_0x52635b;if(!_0x385887[_0x7ab4('0x15')]){logger[_0x7ab4('0xf')](_0x7ab4('0x17'),_0x362952);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1c6c80[_0x7ab4('0x14')]({'logging':!![],'attributes':['id','name',_0x7ab4('0x18'),_0x7ab4('0x19'),_0x7ab4('0x1a'),_0x7ab4('0x1b'),_0x7ab4('0x1c'),_0x7ab4('0x1d'),_0x7ab4('0x1e')],'where':{'name':_0x362952,'role':{'$or':['admin',_0x7ab4('0x1f'),_0x7ab4('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x394e63){if(!_0x394e63||_0x394e63&&_0x394e63[_0x7ab4('0x21')]!==_0x362952){throw new Error(_0x7ab4('0x11'));}_0x13c6da=_0x394e63;var _0x39e943=_0x13c6da[_0x7ab4('0x21')]+'@'+config[_0x7ab4('0xa')][_0x7ab4('0xe')];return adAuthenticate(config[_0x7ab4('0xa')],_0x39e943,_0x194070);})[_0x7ab4('0x16')](function(_0xa96c45){if(_0x13c6da[_0x7ab4('0x1b')]){throw new Error(_0x7ab4('0x11'));}if(_0x385887[_0x7ab4('0x22')]>0x0){if(_0x13c6da[_0x7ab4('0x1c')]){if(moment(_0x13c6da[_0x7ab4('0x1d')])[_0x7ab4('0x23')](_0x385887[_0x7ab4('0x22')],_0x7ab4('0x24'))>moment()){throw new Error(_0x7ab4('0x11'));}return utils['clearBlockUser'](_0x13c6da,0x0,![],null)[_0x7ab4('0x16')](function(){return utils[_0x7ab4('0x25')](_0x13c6da);})[_0x7ab4('0x16')](function(){return _0x45ea0e(null,_0x13c6da);});}else{return utils[_0x7ab4('0x25')](_0x13c6da)[_0x7ab4('0x16')](function(){return _0x45ea0e(null,_0x13c6da);});}}else{return utils['getLicense'](_0x13c6da)[_0x7ab4('0x16')](function(){return _0x45ea0e(null,_0x13c6da);});}})[_0x7ab4('0x26')](function(_0x3686c9){return _0x45ea0e(null,![],_0x3686c9);});}function handleError(_0x2e963f,_0x53f1de,_0x13de8f){return _0x2e963f[_0x7ab4('0x27')](_0x53f1de||0x1f4)[_0x7ab4('0x28')]({'message':_0x13de8f?_0x13de8f[_0x7ab4('0x29')]||_0x13de8f:''});}exports['login']=function(_0x2a01ee,_0x494a16,_0x320f9e){passport[_0x7ab4('0x2a')]('ad-login',function(_0x314d30,_0x3f1c43,_0x24b9fa){var _0x5d4b9e=_0x314d30||_0x24b9fa;if(_0x5d4b9e){return handleError(_0x494a16,0x191,_0x5d4b9e);}if(!_0x3f1c43){return handleError(_0x494a16,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x276cd3={'payload':{'id':_0x3f1c43['id'],'role':_0x3f1c43[_0x7ab4('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x7ab4('0x2b')](_0x276cd3)[_0x7ab4('0x16')](function(_0x4ca697){_0x494a16['json']({'id':_0x3f1c43['id'],'token':_0x4ca697,'statusCall':'','isAlreadyLogged':_0x3f1c43[_0x7ab4('0x1e')]});});}})(_0x2a01ee,_0x494a16,_0x320f9e);};passport[_0x7ab4('0x2c')](_0x7ab4('0x2d'),new LocalStrategy({'usernameField':_0x7ab4('0x21'),'passwordField':_0x7ab4('0x18')},function(_0xb51bb7,_0x2d6465,_0x5657a0){return ActiveDirectoryAuthenticate(db[_0x7ab4('0x2e')],_0xb51bb7,_0x2d6465,_0x5657a0);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ec095bc..de64c47 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 _0x9fee=['post','login','exports','Router'];(function(_0x36b2db,_0x5c4fdd){var _0x401c81=function(_0x1ace78){while(--_0x1ace78){_0x36b2db['push'](_0x36b2db['shift']());}};_0x401c81(++_0x5c4fdd);}(_0x9fee,0x97));var _0xe9fe=function(_0x5d05c0,_0x54d517){_0x5d05c0=_0x5d05c0-0x0;var _0x24a32c=_0x9fee[_0x5d05c0];return _0x24a32c;};'use strict';var express=require('express');var router=express[_0xe9fe('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0xe9fe('0x1')]('/',controller[_0xe9fe('0x2')]);module[_0xe9fe('0x3')]=router; \ No newline at end of file +var _0x91e7=['express','./authActiveDirectory.controller'];(function(_0x1b09a1,_0x38b42a){var _0x319331=function(_0x430da8){while(--_0x430da8){_0x1b09a1['push'](_0x1b09a1['shift']());}};_0x319331(++_0x38b42a);}(_0x91e7,0x130));var _0x791e=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x91e7[_0x2f0057];return _0x17f2c3;};'use strict';var express=require(_0x791e('0x0'));var router=express['Router']();var controller=require(_0x791e('0x1'));router['post']('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5382f72..1288c0d 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x2f60db,_0xa8f0a5){_0x2f60db=_0x2f60db-0x0;var _0x4badda=_0x7a54[_0x2f60db];return _0x4badda;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x6dc7db,_0x3e1b9e){_0x6dc7db=_0x6dc7db-0x0;var _0x1e6b84=_0x7a54[_0x6dc7db];return _0x1e6b84;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2682e1c..ea396ef 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 _0x789b=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie'];(function(_0x111b42,_0x3c68fc){var _0x946abf=function(_0x771f37){while(--_0x771f37){_0x111b42['push'](_0x111b42['shift']());}};_0x946abf(++_0x3c68fc);}(_0x789b,0x140));var _0xb789=function(_0x23d544,_0x19770f){_0x23d544=_0x23d544-0x0;var _0x91589a=_0x789b[_0x23d544];return _0x91589a;};'use strict';var express=require('express');var passport=require(_0xb789('0x0'));var router=express['Router']();var controller=require(_0xb789('0x1'));var userController=require(_0xb789('0x2'));var authService=require(_0xb789('0x3'));router[_0xb789('0x4')]('/',controller[_0xb789('0x5')]);router[_0xb789('0x4')]('/callback',controller[_0xb789('0x6')],authService['isMiddleware'],userController[_0xb789('0x5')],authService[_0xb789('0x7')]);module['exports']=router; \ No newline at end of file +var _0x7140=['../../components/auth/service','login','get','/callback','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x322c62,_0x352c1e){var _0x22da4d=function(_0x534399){while(--_0x534399){_0x322c62['push'](_0x322c62['shift']());}};_0x22da4d(++_0x352c1e);}(_0x7140,0xbb));var _0x0714=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x7140[_0x25d386];return _0x857f4a;};'use strict';var express=require(_0x0714('0x0'));var passport=require(_0x0714('0x1'));var router=express[_0x0714('0x2')]();var controller=require(_0x0714('0x3'));var userController=require(_0x0714('0x4'));var authService=require(_0x0714('0x5'));router['get']('/',controller[_0x0714('0x6')]);router[_0x0714('0x7')](_0x0714('0x8'),controller[_0x0714('0x9')],authService[_0x0714('0xa')],userController[_0x0714('0x6')],authService['setTokenCookie']);module[_0x0714('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9e60c58..f8a5719 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 _0x6d0d=['authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','User','util','passport','jayson/promise','moment','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x46742f,_0x518fae){var _0x497e35=function(_0x2ed64e){while(--_0x2ed64e){_0x46742f['push'](_0x46742f['shift']());}};_0x497e35(++_0x518fae);}(_0x6d0d,0x12d));var _0xd6d0=function(_0x11ba0f,_0x2c4937){_0x11ba0f=_0x11ba0f-0x0;var _0x484571=_0x6d0d[_0x11ba0f];return _0x484571;};'use strict';var util=require(_0xd6d0('0x0'));var passport=require(_0xd6d0('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xd6d0('0x2'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0xd6d0('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xd6d0('0x4'));var utils=require(_0xd6d0('0x5'));var client=jayson[_0xd6d0('0x6')]['http']({'port':0x232b});function localAuthenticate(_0x4773cb,_0x49ab2f,_0x279f1f,_0x1a0ed6){var _0x25af89,_0x599dc1;return db[_0xd6d0('0x7')][_0xd6d0('0x8')]({'where':{'id':0x1},'attributes':[_0xd6d0('0x9'),'blockDuration'],'raw':!![]})[_0xd6d0('0xa')](function(_0x24a122){_0x25af89=_0x24a122;return _0x4773cb['findOne']({'attributes':['id',_0xd6d0('0xb'),_0xd6d0('0xc'),_0xd6d0('0xd'),_0xd6d0('0xe'),_0xd6d0('0xf'),_0xd6d0('0x10'),_0xd6d0('0x11'),_0xd6d0('0x12')],'where':{'name':_0x49ab2f,'role':{'$or':[_0xd6d0('0x13'),_0xd6d0('0x14'),_0xd6d0('0x15')]}}});})['then'](function(_0x2c2724){if(!_0x2c2724||_0x2c2724&&_0x2c2724['name']!==_0x49ab2f){throw new Error(_0xd6d0('0x16'));}else{_0x599dc1=_0x2c2724;return _0x599dc1;}})[_0xd6d0('0xa')](function(){_0x599dc1[_0xd6d0('0x17')](_0x279f1f,function(_0x3188ff,_0x875698){var _0x3e23de=_0x599dc1['loginAttempts']+0x1;if(_0x3188ff){return _0x1a0ed6(_0x3188ff);}else if(!_0x875698){if(_0x599dc1[_0xd6d0('0xf')]){return _0x1a0ed6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x25af89[_0xd6d0('0x9')]>0x0){if(_0x599dc1[_0xd6d0('0x10')]){if(_0x25af89[_0xd6d0('0x18')]>0x0){if(moment(_0x599dc1[_0xd6d0('0x11')])[_0xd6d0('0x19')](_0x25af89['blockDuration'],_0xd6d0('0x1a'))>moment()){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}else{return utils['clearBlockUser'](_0x599dc1,_0x3e23de,![],null)['then'](function(){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});});}}else{return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}}else{if(_0x3e23de>=_0x25af89['allowedLoginAttempts']){return utils[_0xd6d0('0x1b')](_0x599dc1,0x0,!![],moment())['then'](function(){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});});}else{return utils[_0xd6d0('0x1b')](_0x599dc1,_0x3e23de,![],null)[_0xd6d0('0xa')](function(){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});});}}}else{return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}}else{if(_0x599dc1['disabled']){return _0x1a0ed6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x25af89[_0xd6d0('0x9')]>0x0){if(_0x599dc1['blocked']){if(_0x25af89[_0xd6d0('0x18')]>0x0){if(moment(_0x599dc1[_0xd6d0('0x11')])[_0xd6d0('0x19')](_0x25af89[_0xd6d0('0x18')],_0xd6d0('0x1a'))>moment()){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}else{return utils[_0xd6d0('0x1b')](_0x599dc1,0x0,![],null)[_0xd6d0('0xa')](function(){return utils[_0xd6d0('0x1c')](_0x599dc1);})[_0xd6d0('0xa')](function(){return _0x1a0ed6(null,_0x599dc1);});}}else{return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}}else{return utils[_0xd6d0('0x1b')](_0x599dc1,0x0,![],null)[_0xd6d0('0xa')](function(){return utils[_0xd6d0('0x1c')](_0x599dc1);})[_0xd6d0('0xa')](function(){return _0x1a0ed6(null,_0x599dc1);})[_0xd6d0('0x1d')](function(_0x24bdae){return _0x1a0ed6(null,![],_0x24bdae);});}}else{if(_0x599dc1['blocked']){return _0x1a0ed6(null,![],{'message':_0xd6d0('0x16')});}else{return utils[_0xd6d0('0x1c')](_0x599dc1)[_0xd6d0('0xa')](function(){return _0x1a0ed6(null,_0x599dc1);});}}}});})['catch'](function(_0x2e63a2){return _0x1a0ed6(null,![],_0x2e63a2);});}function sendServiceMail(_0x448f6c){return db[_0xd6d0('0x1e')][_0xd6d0('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xd6d0('0x20')],'include':[{'model':db[_0xd6d0('0x21')],'as':_0xd6d0('0x22'),'include':[{'model':db['CloudProvider'],'as':_0xd6d0('0x23')}]}]})['then'](function(_0x208f5a){if(!_0x208f5a){throw new Error(_0xd6d0('0x24'));}var _0x25c07c=_0x208f5a[_0xd6d0('0x25')]();var _0x5e59cb={'account':_0x25c07c,'message':_[_0xd6d0('0x26')]({'from':util[_0xd6d0('0x27')]('\x22%s\x22\x20<%s>',_0x208f5a['name'],_0x208f5a[_0xd6d0('0x20')]||_0x208f5a[_0xd6d0('0x22')][_0xd6d0('0x14')])},_0x448f6c)};return client[_0xd6d0('0x28')](_0xd6d0('0x29'),_0x5e59cb);})[_0xd6d0('0xa')](function(_0x323e01){if(_0x323e01[_0xd6d0('0x2a')]){throw new Error(util[_0xd6d0('0x27')](_0xd6d0('0x2b'),_0x323e01['error']['message']||JSON[_0xd6d0('0x2c')](_0x323e01['error'])));}return!![];});}function handleError(_0x3cc041,_0x1ea3c9,_0x3360b2){return _0x3cc041['status'](_0x1ea3c9||0x1f4)[_0xd6d0('0x2d')]({'message':_0x3360b2?_0x3360b2['message']||_0x3360b2:''});}exports[_0xd6d0('0x2e')]=function(_0x58e4be,_0x35f3d2,_0x3095b6){passport[_0xd6d0('0x17')](_0xd6d0('0x2f'),function(_0x3455d1,_0x4d9c8f,_0x36dc41){var _0x1051f3=_0x3455d1||_0x36dc41;if(_0x1051f3){return handleError(_0x35f3d2,0x191,_0x1051f3);}if(!_0x4d9c8f){return handleError(_0x35f3d2,0x194,{'message':_0xd6d0('0x30')});}else{var _0x5957af={'payload':{'id':_0x4d9c8f['id'],'role':_0x4d9c8f[_0xd6d0('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xd6d0('0x31')](_0x5957af)[_0xd6d0('0xa')](function(_0x447501){_0x35f3d2[_0xd6d0('0x32')]({'id':_0x4d9c8f['id'],'token':_0x447501,'statusCall':'','isAlreadyLogged':_0x4d9c8f[_0xd6d0('0x33')]});});}})(_0x58e4be,_0x35f3d2,_0x3095b6);};exports[_0xd6d0('0x34')]=function(_0xcf8b5d,_0x486d47){if(!_0xcf8b5d[_0xd6d0('0x35')][_0xd6d0('0x20')]){return handleError(_0x486d47,0x1f4,{'message':_0xd6d0('0x36')});}var _0x1cdede=rs['generate']();_0xcf8b5d[_0xd6d0('0x35')][_0xd6d0('0x20')]=_0xcf8b5d[_0xd6d0('0x35')][_0xd6d0('0x20')][_0xd6d0('0x37')]()['toLowerCase']();var _0x35bcb7;return db[_0xd6d0('0x7')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd6d0('0x18')],'raw':!![]})[_0xd6d0('0xa')](function(_0x458cc7){_0x35bcb7=_0x458cc7;return db['User'][_0xd6d0('0x1f')]({'where':{'email':_0xcf8b5d[_0xd6d0('0x35')][_0xd6d0('0x20')]}});})['then'](function(_0x26a33d){if(!_0x26a33d){throw new Error(_0xd6d0('0x38'));}if(_0x26a33d[_0xd6d0('0xf')]){throw new Error(_0xd6d0('0x39'));}if(_0x26a33d['blocked']){if(moment(_0x26a33d['blockedAt'])[_0xd6d0('0x19')](_0x35bcb7[_0xd6d0('0x18')],_0xd6d0('0x1a'))>moment()){throw new Error(_0xd6d0('0x3a'));}else{_0x26a33d['blocked']=![];_0x26a33d[_0xd6d0('0x11')]=null;}}_0x26a33d['resetPasswordToken']=_0x1cdede;_0x26a33d['resetPasswordExpires']=Date[_0xd6d0('0x3b')]()+0x36ee80;return _0x26a33d[_0xd6d0('0x3c')]();})[_0xd6d0('0xa')](function(){return sendServiceMail({'to':_0xcf8b5d['body'][_0xd6d0('0x20')],'subject':_0xd6d0('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xd6d0('0x3e')+_0xcf8b5d['headers'][_0xd6d0('0x3f')]+_0xd6d0('0x40')+_0x1cdede+'\x0a\x0a'+_0xd6d0('0x41')});})[_0xd6d0('0xa')](function(){_0x486d47[_0xd6d0('0x42')](0xc8)[_0xd6d0('0x2d')]({'message':_0xd6d0('0x43')});})[_0xd6d0('0x1d')](function(_0x42fb79){return handleError(_0x486d47,0x1f4,_0x42fb79);});};exports[_0xd6d0('0x44')]=function(_0x3b0f3d,_0x255405){return db['User'][_0xd6d0('0x1f')]({'where':{'resetPasswordToken':_0x3b0f3d['params'][_0xd6d0('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0xce809b){if(!_0xce809b){throw new Error(_0xd6d0('0x46'));}return db[_0xd6d0('0x7')][_0xd6d0('0x8')]({'attributes':['id','securePassword',_0xd6d0('0x47'),_0xd6d0('0x48')]})[_0xd6d0('0xa')](function(_0x262a6b){if(_0x262a6b[_0xd6d0('0x49')])authService[_0xd6d0('0x4a')](_0x3b0f3d[_0xd6d0('0x35')]['password']);if(!_0x262a6b[_0xd6d0('0x47')]||!_0xce809b[_0xd6d0('0x4b')])return _0xce809b;authService['validatePasswordHistory'](_0x3b0f3d['body'][_0xd6d0('0xc')],_0xce809b['previousPasswords'],_0x262a6b[_0xd6d0('0x48')]);return _0xce809b;})[_0xd6d0('0xa')](function(){_0xce809b[_0xd6d0('0xc')]=_0x3b0f3d['body'][_0xd6d0('0xc')];_0xce809b[_0xd6d0('0x4c')]=null;_0xce809b[_0xd6d0('0x4d')]=null;return _0xce809b[_0xd6d0('0x3c')]();});})[_0xd6d0('0xa')](function(){_0x255405[_0xd6d0('0x42')](0xc8)['send']({'message':_0xd6d0('0x4e')});})[_0xd6d0('0x1d')](function(_0x5c66c1){return handleError(_0x255405,0x1f4,_0x5c66c1);});};passport[_0xd6d0('0x4f')](_0xd6d0('0x2f'),new LocalStrategy({'usernameField':_0xd6d0('0xb'),'passwordField':_0xd6d0('0xc')},function(_0x2eccd1,_0x328d71,_0x1f23e2){return localAuthenticate(db[_0xd6d0('0x50')],_0x2eccd1,_0x328d71,_0x1f23e2);})); \ No newline at end of file +var _0x84a2=['CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x84a2,0x1b5));var _0x284a=function(_0x1509f7,_0x2fc1d2){_0x1509f7=_0x1509f7-0x0;var _0x3211a0=_0x84a2[_0x1509f7];return _0x3211a0;};'use strict';var util=require(_0x284a('0x0'));var passport=require(_0x284a('0x1'));var LocalStrategy=require(_0x284a('0x2'))[_0x284a('0x3')];var jayson=require(_0x284a('0x4'));var _=require('lodash');var rs=require(_0x284a('0x5'));var moment=require(_0x284a('0x6'));var db=require(_0x284a('0x7'))['db'];var authService=require(_0x284a('0x8'));var utils=require(_0x284a('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x19143c,_0x3f269c,_0x50a6f9,_0x4896f1){var _0x278a6e,_0x3c027a;return db['Setting'][_0x284a('0xa')]({'where':{'id':0x1},'attributes':[_0x284a('0xb'),_0x284a('0xc')],'raw':!![]})[_0x284a('0xd')](function(_0x8acf8b){_0x278a6e=_0x8acf8b;return _0x19143c[_0x284a('0xa')]({'attributes':['id',_0x284a('0xe'),_0x284a('0xf'),_0x284a('0x10'),_0x284a('0x11'),'disabled',_0x284a('0x12'),_0x284a('0x13'),_0x284a('0x14')],'where':{'name':_0x3f269c,'role':{'$or':[_0x284a('0x15'),_0x284a('0x16'),_0x284a('0x17')]}}});})['then'](function(_0x5d4663){if(!_0x5d4663||_0x5d4663&&_0x5d4663[_0x284a('0xe')]!==_0x3f269c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3c027a=_0x5d4663;return _0x3c027a;}})['then'](function(){_0x3c027a[_0x284a('0x18')](_0x50a6f9,function(_0x39d6bd,_0x20e9ce){var _0x1bff82=_0x3c027a[_0x284a('0x14')]+0x1;if(_0x39d6bd){return _0x4896f1(_0x39d6bd);}else if(!_0x20e9ce){if(_0x3c027a[_0x284a('0x19')]){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});}else if(_0x278a6e[_0x284a('0xb')]>0x0){if(_0x3c027a[_0x284a('0x12')]){if(_0x278a6e[_0x284a('0xc')]>0x0){if(moment(_0x3c027a[_0x284a('0x13')])[_0x284a('0x1b')](_0x278a6e['blockDuration'],_0x284a('0x1c'))>moment()){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});}else{return utils['clearBlockUser'](_0x3c027a,_0x1bff82,![],null)[_0x284a('0xd')](function(){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});});}}else{return _0x4896f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1bff82>=_0x278a6e[_0x284a('0xb')]){return utils['clearBlockUser'](_0x3c027a,0x0,!![],moment())['then'](function(){return _0x4896f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x284a('0x1d')](_0x3c027a,_0x1bff82,![],null)[_0x284a('0xd')](function(){return _0x4896f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4896f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3c027a[_0x284a('0x19')]){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});}else if(_0x278a6e[_0x284a('0xb')]>0x0){if(_0x3c027a['blocked']){if(_0x278a6e[_0x284a('0xc')]>0x0){if(moment(_0x3c027a[_0x284a('0x13')])[_0x284a('0x1b')](_0x278a6e[_0x284a('0xc')],'minutes')>moment()){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});}else{return utils[_0x284a('0x1d')](_0x3c027a,0x0,![],null)[_0x284a('0xd')](function(){return utils['getLicense'](_0x3c027a);})[_0x284a('0xd')](function(){return _0x4896f1(null,_0x3c027a);});}}else{return _0x4896f1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x284a('0x1d')](_0x3c027a,0x0,![],null)[_0x284a('0xd')](function(){return utils[_0x284a('0x1e')](_0x3c027a);})[_0x284a('0xd')](function(){return _0x4896f1(null,_0x3c027a);})[_0x284a('0x1f')](function(_0x4120dd){return _0x4896f1(null,![],_0x4120dd);});}}else{if(_0x3c027a[_0x284a('0x12')]){return _0x4896f1(null,![],{'message':_0x284a('0x1a')});}else{return utils['getLicense'](_0x3c027a)['then'](function(){return _0x4896f1(null,_0x3c027a);});}}}});})[_0x284a('0x1f')](function(_0x58b74d){return _0x4896f1(null,![],_0x58b74d);});}function sendServiceMail(_0x53638d){return db[_0x284a('0x20')][_0x284a('0x21')]({'where':{'service':!![]},'attributes':['id','name',_0x284a('0x22')],'include':[{'model':db[_0x284a('0x23')],'as':_0x284a('0x24'),'include':[{'model':db['CloudProvider'],'as':_0x284a('0x25')}]}]})[_0x284a('0xd')](function(_0x4fe05b){if(!_0x4fe05b){throw new Error(_0x284a('0x26'));}var _0x15c2f1=_0x4fe05b['getSmtpOptions']();var _0x5d187a={'account':_0x15c2f1,'message':_['merge']({'from':util[_0x284a('0x27')]('\x22%s\x22\x20<%s>',_0x4fe05b[_0x284a('0xe')],_0x4fe05b['email']||_0x4fe05b[_0x284a('0x24')][_0x284a('0x16')])},_0x53638d)};return client['request'](_0x284a('0x28'),_0x5d187a);})[_0x284a('0xd')](function(_0x1bc5e7){if(_0x1bc5e7[_0x284a('0x29')]){throw new Error(util['format'](_0x284a('0x2a'),_0x1bc5e7[_0x284a('0x29')]['message']||JSON['stringify'](_0x1bc5e7['error'])));}return!![];});}function handleError(_0x5bc42f,_0x55cc20,_0x1573e7){return _0x5bc42f[_0x284a('0x2b')](_0x55cc20||0x1f4)[_0x284a('0x2c')]({'message':_0x1573e7?_0x1573e7[_0x284a('0x2d')]||_0x1573e7:''});}exports[_0x284a('0x2e')]=function(_0x176ca2,_0x47623a,_0x2fa010){passport[_0x284a('0x18')](_0x284a('0x2f'),function(_0x28b8bf,_0x478f94,_0x1f8c8a){var _0x243eac=_0x28b8bf||_0x1f8c8a;if(_0x243eac){return handleError(_0x47623a,0x191,_0x243eac);}if(!_0x478f94){return handleError(_0x47623a,0x194,{'message':_0x284a('0x30')});}else{var _0x44672a={'payload':{'id':_0x478f94['id'],'role':_0x478f94['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x44672a)[_0x284a('0xd')](function(_0x1b1f7a){_0x47623a[_0x284a('0x31')]({'id':_0x478f94['id'],'token':_0x1b1f7a,'statusCall':'','isAlreadyLogged':_0x478f94[_0x284a('0x32')]});});}})(_0x176ca2,_0x47623a,_0x2fa010);};exports['forgot']=function(_0x8df118,_0x57834e){if(!_0x8df118['body'][_0x284a('0x22')]){return handleError(_0x57834e,0x1f4,{'message':_0x284a('0x33')});}var _0x307a0d=rs[_0x284a('0x34')]();_0x8df118[_0x284a('0x35')]['email']=_0x8df118['body']['email'][_0x284a('0x36')]()['toLowerCase']();var _0x1da4d9;return db[_0x284a('0x37')][_0x284a('0xa')]({'where':{'id':0x1},'attributes':[_0x284a('0xb'),_0x284a('0xc')],'raw':!![]})[_0x284a('0xd')](function(_0x583cd1){_0x1da4d9=_0x583cd1;return db[_0x284a('0x38')][_0x284a('0x21')]({'where':{'email':_0x8df118['body'][_0x284a('0x22')]}});})[_0x284a('0xd')](function(_0x4bfc33){if(!_0x4bfc33){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4bfc33[_0x284a('0x19')]){throw new Error(_0x284a('0x39'));}if(_0x4bfc33['blocked']){if(moment(_0x4bfc33['blockedAt'])[_0x284a('0x1b')](_0x1da4d9[_0x284a('0xc')],'minutes')>moment()){throw new Error(_0x284a('0x3a'));}else{_0x4bfc33[_0x284a('0x12')]=![];_0x4bfc33[_0x284a('0x13')]=null;}}_0x4bfc33[_0x284a('0x3b')]=_0x307a0d;_0x4bfc33[_0x284a('0x3c')]=Date[_0x284a('0x3d')]()+0x36ee80;return _0x4bfc33[_0x284a('0x3e')]();})[_0x284a('0xd')](function(){return sendServiceMail({'to':_0x8df118[_0x284a('0x35')][_0x284a('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x284a('0x3f')+'https://'+_0x8df118[_0x284a('0x40')][_0x284a('0x41')]+_0x284a('0x42')+_0x307a0d+'\x0a\x0a'+_0x284a('0x43')});})[_0x284a('0xd')](function(){_0x57834e[_0x284a('0x2b')](0xc8)[_0x284a('0x2c')]({'message':_0x284a('0x44')});})[_0x284a('0x1f')](function(_0x8d731d){return handleError(_0x57834e,0x1f4,_0x8d731d);});};exports[_0x284a('0x45')]=function(_0x3544ef,_0xa154fc){return db['User'][_0x284a('0x21')]({'where':{'resetPasswordToken':_0x3544ef['params'][_0x284a('0x46')],'resetPasswordExpires':{'$gt':Date[_0x284a('0x3d')]()}}})[_0x284a('0xd')](function(_0x3744c2){if(!_0x3744c2){throw new Error(_0x284a('0x47'));}return db['Setting'][_0x284a('0xa')]({'attributes':['id',_0x284a('0x48'),_0x284a('0x49'),_0x284a('0x4a')]})[_0x284a('0xd')](function(_0x3984b0){if(_0x3984b0[_0x284a('0x48')])authService[_0x284a('0x4b')](_0x3544ef[_0x284a('0x35')]['password']);if(!_0x3984b0[_0x284a('0x49')]||!_0x3744c2[_0x284a('0x4c')])return _0x3744c2;authService['validatePasswordHistory'](_0x3544ef['body'][_0x284a('0xf')],_0x3744c2[_0x284a('0x4c')],_0x3984b0[_0x284a('0x4a')]);return _0x3744c2;})[_0x284a('0xd')](function(){_0x3744c2[_0x284a('0xf')]=_0x3544ef['body'][_0x284a('0xf')];_0x3744c2[_0x284a('0x3b')]=null;_0x3744c2['resetPasswordExpires']=null;return _0x3744c2[_0x284a('0x3e')]();});})['then'](function(){_0xa154fc[_0x284a('0x2b')](0xc8)[_0x284a('0x2c')]({'message':_0x284a('0x4d')});})['catch'](function(_0x5cf493){return handleError(_0xa154fc,0x1f4,_0x5cf493);});};passport[_0x284a('0x4e')](_0x284a('0x2f'),new LocalStrategy({'usernameField':_0x284a('0xe'),'passwordField':_0x284a('0xf')},function(_0x481f36,_0x3fe592,_0x3d246c){return localAuthenticate(db['User'],_0x481f36,_0x3fe592,_0x3d246c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a9d566c..942c157 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 _0xd399=['forgot','reset','exports','express','./authLocal.controller','post','login','/forgot'];(function(_0x52c4ff,_0x3c4d36){var _0xd2f143=function(_0x331979){while(--_0x331979){_0x52c4ff['push'](_0x52c4ff['shift']());}};_0xd2f143(++_0x3c4d36);}(_0xd399,0xfb));var _0x9d39=function(_0x53ae8a,_0x441950){_0x53ae8a=_0x53ae8a-0x0;var _0x22d145=_0xd399[_0x53ae8a];return _0x22d145;};'use strict';var express=require(_0x9d39('0x0'));var router=express['Router']();var controller=require(_0x9d39('0x1'));router[_0x9d39('0x2')]('/',controller[_0x9d39('0x3')]);router[_0x9d39('0x2')](_0x9d39('0x4'),controller[_0x9d39('0x5')]);router[_0x9d39('0x2')]('/reset/:token',controller[_0x9d39('0x6')]);module[_0x9d39('0x7')]=router; \ No newline at end of file +var _0x64ff=['post','/forgot','/reset/:token','exports','Router'];(function(_0x40de73,_0x495ec9){var _0x3a825c=function(_0x2ddd2c){while(--_0x2ddd2c){_0x40de73['push'](_0x40de73['shift']());}};_0x3a825c(++_0x495ec9);}(_0x64ff,0xf4));var _0xf64f=function(_0x21b0fd,_0x4dd6f5){_0x21b0fd=_0x21b0fd-0x0;var _0x11558e=_0x64ff[_0x21b0fd];return _0x11558e;};'use strict';var express=require('express');var router=express[_0xf64f('0x0')]();var controller=require('./authLocal.controller');router[_0xf64f('0x1')]('/',controller['login']);router[_0xf64f('0x1')](_0xf64f('0x2'),controller['forgot']);router[_0xf64f('0x1')](_0xf64f('0x3'),controller['reset']);module[_0xf64f('0x4')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index dfa7ac6..07c4d35 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 _0xe2e3=['sequelize','STRING','INTEGER'];(function(_0x23e90d,_0x2442b9){var _0x3a1c5f=function(_0x43f2ac){while(--_0x43f2ac){_0x23e90d['push'](_0x23e90d['shift']());}};_0x3a1c5f(++_0x2442b9);}(_0xe2e3,0xa5));var _0x3e2e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xe2e3[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require(_0x3e2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e2e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x3e2e('0x1')]},'description':{'type':Sequelize[_0x3e2e('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3e2e('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0b5d=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0b5d,0x1ea));var _0xd0b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b5d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd0b5('0x0'));module[_0xd0b5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd0b5('0x2')]},'status':{'type':Sequelize[_0xd0b5('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd0b5('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 03c8430..57c8ed3 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 _0xa8f6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','error','stack','name','index','map','Automation','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','keys','options','create','body','find','destroy','addConditions','Condition','ids','getConditions','findOne','nolimit','addActions','Action','omit','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x235b59,_0x393f9e){var _0x5432f7=function(_0x2b5b7f){while(--_0x2b5b7f){_0x235b59['push'](_0x235b59['shift']());}};_0x5432f7(++_0x393f9e);}(_0xa8f6,0xf5));var _0x6a8f=function(_0x1310b3,_0x2b13c5){_0x1310b3=_0x1310b3-0x0;var _0xbca1a5=_0xa8f6[_0x1310b3];return _0xbca1a5;};'use strict';var emlformat=require(_0x6a8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a8f('0x1'));var jsonpatch=require(_0x6a8f('0x2'));var rp=require(_0x6a8f('0x3'));var moment=require(_0x6a8f('0x4'));var BPromise=require(_0x6a8f('0x5'));var Mustache=require(_0x6a8f('0x6'));var util=require(_0x6a8f('0x7'));var path=require(_0x6a8f('0x8'));var sox=require(_0x6a8f('0x9'));var csv=require(_0x6a8f('0xa'));var ejs=require(_0x6a8f('0xb'));var fs=require('fs');var fs_extra=require(_0x6a8f('0xc'));var _=require(_0x6a8f('0xd'));var squel=require(_0x6a8f('0xe'));var crypto=require(_0x6a8f('0xf'));var jsforce=require(_0x6a8f('0x10'));var deskjs=require(_0x6a8f('0x11'));var toCsv=require(_0x6a8f('0xa'));var querystring=require(_0x6a8f('0x12'));var Papa=require(_0x6a8f('0x13'));var Redis=require(_0x6a8f('0x14'));var authService=require(_0x6a8f('0x15'));var qs=require(_0x6a8f('0x16'));var as=require(_0x6a8f('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a8f('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x6a8f('0x19'));var licenseUtil=require(_0x6a8f('0x1a'));var db=require(_0x6a8f('0x1b'))['db'];function respondWithStatusCode(_0x5d8a46,_0x2f3372){_0x2f3372=_0x2f3372||0xcc;return function(_0x19c84a){if(_0x19c84a){return _0x5d8a46[_0x6a8f('0x1c')](_0x2f3372);}return _0x5d8a46[_0x6a8f('0x1d')](_0x2f3372)[_0x6a8f('0x1e')]();};}function respondWithResult(_0x15e708,_0x1a7094){_0x1a7094=_0x1a7094||0xc8;return function(_0xcf1bdd){if(_0xcf1bdd){return _0x15e708[_0x6a8f('0x1d')](_0x1a7094)['json'](_0xcf1bdd);}};}function respondWithFilteredResult(_0x3c5e42,_0x168c88){return function(_0x41f571){if(_0x41f571){var _0x2a332c=typeof _0x168c88[_0x6a8f('0x1f')]==='undefined'&&typeof _0x168c88[_0x6a8f('0x20')]===_0x6a8f('0x21');var _0x537202=_0x41f571[_0x6a8f('0x22')];var _0x245754=_0x2a332c?0x0:_0x168c88[_0x6a8f('0x1f')];var _0x3ad8d8=_0x2a332c?_0x41f571[_0x6a8f('0x22')]:_0x168c88[_0x6a8f('0x1f')]+_0x168c88[_0x6a8f('0x20')];var _0xaf600d;if(_0x3ad8d8>=_0x537202){_0x3ad8d8=_0x537202;_0xaf600d=0xc8;}else{_0xaf600d=0xce;}_0x3c5e42['status'](_0xaf600d);return _0x3c5e42[_0x6a8f('0x23')]('Content-Range',_0x245754+'-'+_0x3ad8d8+'/'+_0x537202)[_0x6a8f('0x24')](_0x41f571);}return null;};}function patchUpdates(_0x3a28b2){return function(_0x5dfc1e){try{jsonpatch[_0x6a8f('0x25')](_0x5dfc1e,_0x3a28b2,!![]);}catch(_0x410dc5){return BPromise[_0x6a8f('0x26')](_0x410dc5);}return _0x5dfc1e[_0x6a8f('0x27')]();};}function saveUpdates(_0x1dcd75,_0x473539){return function(_0x267980){if(_0x267980){return _0x267980['update'](_0x1dcd75)[_0x6a8f('0x28')](function(_0x32c6a1){return _0x32c6a1;});}return null;};}function removeEntity(_0x3e8624,_0x25ea52){return function(_0x38aa25){if(_0x38aa25){return _0x38aa25['destroy']()[_0x6a8f('0x28')](function(){_0x3e8624[_0x6a8f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12bcd4,_0x422b4e){return function(_0x539f7c){if(!_0x539f7c){_0x12bcd4['sendStatus'](0x194);}return _0x539f7c;};}function handleError(_0x56d10b,_0x5240ac){_0x5240ac=_0x5240ac||0x1f4;return function(_0x574858){logger[_0x6a8f('0x29')](_0x574858[_0x6a8f('0x2a')]);if(_0x574858[_0x6a8f('0x2b')]){delete _0x574858[_0x6a8f('0x2b')];}_0x56d10b[_0x6a8f('0x1d')](_0x5240ac)['send'](_0x574858);};}exports[_0x6a8f('0x2c')]=function(_0x8ed118,_0x5835b8){var _0x1f2572={},_0x2d0b77={},_0x361052={'count':0x0,'rows':[]};var _0x36f56c=_[_0x6a8f('0x2d')](db[_0x6a8f('0x2e')][_0x6a8f('0x2f')],function(_0x994b66){return{'name':_0x994b66['fieldName'],'type':_0x994b66[_0x6a8f('0x30')][_0x6a8f('0x31')]};});_0x2d0b77[_0x6a8f('0x32')]=_[_0x6a8f('0x2d')](_0x36f56c,_0x6a8f('0x2b'));_0x2d0b77[_0x6a8f('0x33')]=_['keys'](_0x8ed118[_0x6a8f('0x33')]);_0x2d0b77['filters']=_[_0x6a8f('0x34')](_0x2d0b77[_0x6a8f('0x32')],_0x2d0b77[_0x6a8f('0x33')]);_0x1f2572['attributes']=_[_0x6a8f('0x34')](_0x2d0b77[_0x6a8f('0x32')],qs[_0x6a8f('0x35')](_0x8ed118['query']['fields']));_0x1f2572['attributes']=_0x1f2572[_0x6a8f('0x36')][_0x6a8f('0x37')]?_0x1f2572[_0x6a8f('0x36')]:_0x2d0b77['model'];if(!_0x8ed118['query'][_0x6a8f('0x38')]('nolimit')){_0x1f2572[_0x6a8f('0x20')]=qs[_0x6a8f('0x20')](_0x8ed118['query'][_0x6a8f('0x20')]);_0x1f2572[_0x6a8f('0x1f')]=qs[_0x6a8f('0x1f')](_0x8ed118[_0x6a8f('0x33')]['offset']);}_0x1f2572[_0x6a8f('0x39')]=qs['sort'](_0x8ed118[_0x6a8f('0x33')][_0x6a8f('0x3a')]);_0x1f2572['where']=qs['filters'](_[_0x6a8f('0x3b')](_0x8ed118[_0x6a8f('0x33')],_0x2d0b77[_0x6a8f('0x3c')]),_0x36f56c);if(_0x8ed118['query']['filter']){_0x1f2572['where']=_['merge'](_0x1f2572[_0x6a8f('0x3d')],{'$or':_[_0x6a8f('0x2d')](_0x36f56c,function(_0x278dfc){if(_0x278dfc[_0x6a8f('0x30')]!==_0x6a8f('0x3e')){var _0x5512ac={};_0x5512ac[_0x278dfc['name']]={'$like':'%'+_0x8ed118[_0x6a8f('0x33')][_0x6a8f('0x3f')]+'%'};return _0x5512ac;}})});}_0x1f2572=_[_0x6a8f('0x40')]({},_0x1f2572,_0x8ed118['options']);var _0x1bc365={'where':_0x1f2572['where']};return db[_0x6a8f('0x2e')][_0x6a8f('0x22')](_0x1bc365)['then'](function(_0x24240c){_0x361052[_0x6a8f('0x22')]=_0x24240c;if(_0x8ed118['query'][_0x6a8f('0x41')]){_0x1f2572[_0x6a8f('0x42')]=[{'all':!![]}];}return db[_0x6a8f('0x2e')]['findAll'](_0x1f2572);})[_0x6a8f('0x28')](function(_0x3646d1){_0x361052[_0x6a8f('0x43')]=_0x3646d1;return _0x361052;})[_0x6a8f('0x28')](respondWithFilteredResult(_0x5835b8,_0x1f2572))[_0x6a8f('0x44')](handleError(_0x5835b8,null));};exports['show']=function(_0x2d1589,_0x1ff919){var _0x2362ad={'raw':![],'where':{'id':_0x2d1589[_0x6a8f('0x45')]['id']}},_0x18dbd0={};_0x18dbd0[_0x6a8f('0x32')]=_[_0x6a8f('0x46')](db[_0x6a8f('0x2e')][_0x6a8f('0x2f')]);_0x18dbd0[_0x6a8f('0x33')]=_['keys'](_0x2d1589[_0x6a8f('0x33')]);_0x18dbd0['filters']=_[_0x6a8f('0x34')](_0x18dbd0[_0x6a8f('0x32')],_0x18dbd0[_0x6a8f('0x33')]);_0x2362ad[_0x6a8f('0x36')]=_['intersection'](_0x18dbd0[_0x6a8f('0x32')],qs[_0x6a8f('0x35')](_0x2d1589['query'][_0x6a8f('0x35')]));_0x2362ad[_0x6a8f('0x36')]=_0x2362ad[_0x6a8f('0x36')][_0x6a8f('0x37')]?_0x2362ad[_0x6a8f('0x36')]:_0x18dbd0['model'];if(_0x2d1589[_0x6a8f('0x33')][_0x6a8f('0x41')]){_0x2362ad[_0x6a8f('0x42')]=[{'all':!![]}];}_0x2362ad=_[_0x6a8f('0x40')]({},_0x2362ad,_0x2d1589[_0x6a8f('0x47')]);return db[_0x6a8f('0x2e')]['find'](_0x2362ad)[_0x6a8f('0x28')](handleEntityNotFound(_0x1ff919,null))[_0x6a8f('0x28')](respondWithResult(_0x1ff919,null))['catch'](handleError(_0x1ff919,null));};exports[_0x6a8f('0x48')]=function(_0x55052f,_0x20c8dd){return db[_0x6a8f('0x2e')]['create'](_0x55052f[_0x6a8f('0x49')],{})['then'](respondWithResult(_0x20c8dd,0xc9))[_0x6a8f('0x44')](handleError(_0x20c8dd,null));};exports['update']=function(_0x2289d9,_0x1bcd57){if(_0x2289d9[_0x6a8f('0x49')]['id']){delete _0x2289d9['body']['id'];}return db[_0x6a8f('0x2e')][_0x6a8f('0x4a')]({'where':{'id':_0x2289d9['params']['id']}})[_0x6a8f('0x28')](handleEntityNotFound(_0x1bcd57,null))[_0x6a8f('0x28')](saveUpdates(_0x2289d9['body'],null))[_0x6a8f('0x28')](respondWithResult(_0x1bcd57,null))[_0x6a8f('0x44')](handleError(_0x1bcd57,null));};exports[_0x6a8f('0x4b')]=function(_0x4c5af3,_0x2b2266){return db[_0x6a8f('0x2e')][_0x6a8f('0x4a')]({'where':{'id':_0x4c5af3['params']['id']}})[_0x6a8f('0x28')](handleEntityNotFound(_0x2b2266,null))['then'](removeEntity(_0x2b2266,null))[_0x6a8f('0x44')](handleError(_0x2b2266,null));};exports[_0x6a8f('0x4c')]=function(_0x11a314,_0x41c714,_0x313885){return db[_0x6a8f('0x4d')]['find']({'where':{'id':_0x11a314[_0x6a8f('0x45')]['id']}})[_0x6a8f('0x28')](handleEntityNotFound(_0x41c714,null))[_0x6a8f('0x28')](function(_0x4a6ae5){if(_0x4a6ae5){return _0x4a6ae5[_0x6a8f('0x4c')](_0x11a314['body'][_0x6a8f('0x4e')],_['omit'](_0x11a314[_0x6a8f('0x49')],[_0x6a8f('0x4e'),'id'])||{});}})[_0x6a8f('0x28')](respondWithResult(_0x41c714,null))[_0x6a8f('0x44')](handleError(_0x41c714,null));};exports[_0x6a8f('0x4f')]=function(_0x2c121b,_0x2710f9,_0x117a8c){var _0x520867={};var _0xad6322={};var _0x4eb579;var _0x1975ba;return db[_0x6a8f('0x2e')][_0x6a8f('0x50')]({'where':{'id':_0x2c121b[_0x6a8f('0x45')]['id']}})[_0x6a8f('0x28')](handleEntityNotFound(_0x2710f9,null))[_0x6a8f('0x28')](function(_0x425578){if(_0x425578){_0x4eb579=_0x425578;_0xad6322['model']=_[_0x6a8f('0x46')](db[_0x6a8f('0x4d')][_0x6a8f('0x2f')]);_0xad6322['query']=_[_0x6a8f('0x46')](_0x2c121b[_0x6a8f('0x33')]);_0xad6322[_0x6a8f('0x3c')]=_[_0x6a8f('0x34')](_0xad6322[_0x6a8f('0x32')],_0xad6322[_0x6a8f('0x33')]);_0x520867['attributes']=_[_0x6a8f('0x34')](_0xad6322['model'],qs['fields'](_0x2c121b[_0x6a8f('0x33')][_0x6a8f('0x35')]));_0x520867[_0x6a8f('0x36')]=_0x520867['attributes'][_0x6a8f('0x37')]?_0x520867[_0x6a8f('0x36')]:_0xad6322['model'];_0x520867[_0x6a8f('0x39')]=qs[_0x6a8f('0x3a')](_0x2c121b[_0x6a8f('0x33')]['sort']);_0x520867[_0x6a8f('0x3d')]=qs[_0x6a8f('0x3c')](_[_0x6a8f('0x3b')](_0x2c121b[_0x6a8f('0x33')],_0xad6322[_0x6a8f('0x3c')]));if(_0x2c121b[_0x6a8f('0x33')][_0x6a8f('0x3f')]){_0x520867['where']=_['merge'](_0x520867['where'],{'$or':_[_0x6a8f('0x2d')](_0x520867[_0x6a8f('0x36')],function(_0x4633d0){var _0xa06797={};_0xa06797[_0x4633d0]={'$like':'%'+_0x2c121b[_0x6a8f('0x33')][_0x6a8f('0x3f')]+'%'};return _0xa06797;})});}_0x520867=_[_0x6a8f('0x40')]({},_0x520867,_0x2c121b[_0x6a8f('0x47')]);return _0x4eb579[_0x6a8f('0x4f')](_0x520867);}})[_0x6a8f('0x28')](function(_0x11bf73){if(_0x11bf73){_0x1975ba=_0x11bf73[_0x6a8f('0x37')];if(!_0x2c121b[_0x6a8f('0x33')][_0x6a8f('0x38')](_0x6a8f('0x51'))){_0x520867[_0x6a8f('0x20')]=qs[_0x6a8f('0x20')](_0x2c121b[_0x6a8f('0x33')][_0x6a8f('0x20')]);_0x520867['offset']=qs['offset'](_0x2c121b[_0x6a8f('0x33')]['offset']);}return _0x4eb579[_0x6a8f('0x4f')](_0x520867);}})[_0x6a8f('0x28')](function(_0x4f175a){if(_0x4f175a){return _0x4f175a?{'count':_0x1975ba,'rows':_0x4f175a}:null;}})['then'](respondWithResult(_0x2710f9,null))['catch'](handleError(_0x2710f9,null));};exports[_0x6a8f('0x52')]=function(_0x2bc743,_0x237d01,_0xd87b38){return db[_0x6a8f('0x53')]['find']({'where':{'id':_0x2bc743['params']['id']}})[_0x6a8f('0x28')](handleEntityNotFound(_0x237d01,null))[_0x6a8f('0x28')](function(_0x4ed1b2){if(_0x4ed1b2){return _0x4ed1b2['addActions'](_0x2bc743['body']['ids'],_[_0x6a8f('0x54')](_0x2bc743['body'],[_0x6a8f('0x4e'),'id'])||{});}})[_0x6a8f('0x28')](respondWithResult(_0x237d01,null))[_0x6a8f('0x44')](handleError(_0x237d01,null));};exports['getActions']=function(_0x40b670,_0x2b42c0,_0x40b2c2){var _0x301a59={};var _0x2f2965={};var _0x17e41d;var _0x5ecf55;return db[_0x6a8f('0x2e')]['findOne']({'where':{'id':_0x40b670['params']['id']}})['then'](handleEntityNotFound(_0x2b42c0,null))[_0x6a8f('0x28')](function(_0x3ff2b7){if(_0x3ff2b7){_0x17e41d=_0x3ff2b7;_0x2f2965['model']=_[_0x6a8f('0x46')](db[_0x6a8f('0x53')][_0x6a8f('0x2f')]);_0x2f2965[_0x6a8f('0x33')]=_[_0x6a8f('0x46')](_0x40b670['query']);_0x2f2965[_0x6a8f('0x3c')]=_[_0x6a8f('0x34')](_0x2f2965[_0x6a8f('0x32')],_0x2f2965[_0x6a8f('0x33')]);_0x301a59[_0x6a8f('0x36')]=_[_0x6a8f('0x34')](_0x2f2965[_0x6a8f('0x32')],qs[_0x6a8f('0x35')](_0x40b670[_0x6a8f('0x33')][_0x6a8f('0x35')]));_0x301a59[_0x6a8f('0x36')]=_0x301a59[_0x6a8f('0x36')][_0x6a8f('0x37')]?_0x301a59[_0x6a8f('0x36')]:_0x2f2965['model'];_0x301a59['order']=qs['sort'](_0x40b670['query'][_0x6a8f('0x3a')]);_0x301a59[_0x6a8f('0x3d')]=qs[_0x6a8f('0x3c')](_['pick'](_0x40b670[_0x6a8f('0x33')],_0x2f2965[_0x6a8f('0x3c')]));if(_0x40b670[_0x6a8f('0x33')][_0x6a8f('0x3f')]){_0x301a59[_0x6a8f('0x3d')]=_[_0x6a8f('0x40')](_0x301a59[_0x6a8f('0x3d')],{'$or':_[_0x6a8f('0x2d')](_0x301a59['attributes'],function(_0xdd3d14){var _0xb91c5b={};_0xb91c5b[_0xdd3d14]={'$like':'%'+_0x40b670[_0x6a8f('0x33')][_0x6a8f('0x3f')]+'%'};return _0xb91c5b;})});}_0x301a59=_[_0x6a8f('0x40')]({},_0x301a59,_0x40b670['options']);return _0x17e41d['getActions'](_0x301a59);}})[_0x6a8f('0x28')](function(_0x2cf174){if(_0x2cf174){_0x5ecf55=_0x2cf174[_0x6a8f('0x37')];if(!_0x40b670[_0x6a8f('0x33')]['hasOwnProperty']('nolimit')){_0x301a59[_0x6a8f('0x20')]=qs[_0x6a8f('0x20')](_0x40b670[_0x6a8f('0x33')][_0x6a8f('0x20')]);_0x301a59[_0x6a8f('0x1f')]=qs['offset'](_0x40b670[_0x6a8f('0x33')][_0x6a8f('0x1f')]);}return _0x17e41d[_0x6a8f('0x55')](_0x301a59);}})[_0x6a8f('0x28')](function(_0x346bd0){if(_0x346bd0){return _0x346bd0?{'count':_0x5ecf55,'rows':_0x346bd0}:null;}})[_0x6a8f('0x28')](respondWithResult(_0x2b42c0,null))[_0x6a8f('0x44')](handleError(_0x2b42c0,null));}; \ No newline at end of file +var _0xa35b=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','stack','name','index','map','Automation','rawAttributes','key','query','keys','filters','model','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','intersection','include','find','create','body','params','addConditions','Condition','ids','omit','findOne','hasOwnProperty','nolimit','getConditions','Action','addActions','getActions','order','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x40b910,_0x378977){var _0x9080d7=function(_0x35990b){while(--_0x35990b){_0x40b910['push'](_0x40b910['shift']());}};_0x9080d7(++_0x378977);}(_0xa35b,0x128));var _0xba35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa35b[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xba35('0x0'));var rimraf=require(_0xba35('0x1'));var zipdir=require(_0xba35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba35('0x3'));var moment=require('moment');var BPromise=require(_0xba35('0x4'));var Mustache=require(_0xba35('0x5'));var util=require(_0xba35('0x6'));var path=require(_0xba35('0x7'));var sox=require(_0xba35('0x8'));var csv=require(_0xba35('0x9'));var ejs=require(_0xba35('0xa'));var fs=require('fs');var fs_extra=require(_0xba35('0xb'));var _=require(_0xba35('0xc'));var squel=require(_0xba35('0xd'));var crypto=require(_0xba35('0xe'));var jsforce=require(_0xba35('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xba35('0x10'));var Papa=require(_0xba35('0x11'));var Redis=require('ioredis');var authService=require(_0xba35('0x12'));var qs=require(_0xba35('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba35('0x14'));var logger=require(_0xba35('0x15'))('api');var utils=require(_0xba35('0x16'));var config=require(_0xba35('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ce8ae,_0x130d40){_0x130d40=_0x130d40||0xcc;return function(_0x3b93d1){if(_0x3b93d1){return _0x4ce8ae[_0xba35('0x18')](_0x130d40);}return _0x4ce8ae['status'](_0x130d40)[_0xba35('0x19')]();};}function respondWithResult(_0x122406,_0x3b5ced){_0x3b5ced=_0x3b5ced||0xc8;return function(_0x2d3a23){if(_0x2d3a23){return _0x122406[_0xba35('0x1a')](_0x3b5ced)['json'](_0x2d3a23);}};}function respondWithFilteredResult(_0x1d09f0,_0x1ab416){return function(_0x28ad3d){if(_0x28ad3d){var _0x3c8441=typeof _0x1ab416[_0xba35('0x1b')]===_0xba35('0x1c')&&typeof _0x1ab416[_0xba35('0x1d')]===_0xba35('0x1c');var _0x4f3fd8=_0x28ad3d[_0xba35('0x1e')];var _0xcd3237=_0x3c8441?0x0:_0x1ab416[_0xba35('0x1b')];var _0xce4c69=_0x3c8441?_0x28ad3d[_0xba35('0x1e')]:_0x1ab416[_0xba35('0x1b')]+_0x1ab416['limit'];var _0x344887;if(_0xce4c69>=_0x4f3fd8){_0xce4c69=_0x4f3fd8;_0x344887=0xc8;}else{_0x344887=0xce;}_0x1d09f0['status'](_0x344887);return _0x1d09f0[_0xba35('0x1f')](_0xba35('0x20'),_0xcd3237+'-'+_0xce4c69+'/'+_0x4f3fd8)[_0xba35('0x21')](_0x28ad3d);}return null;};}function patchUpdates(_0x368efc){return function(_0x38b03e){try{jsonpatch['apply'](_0x38b03e,_0x368efc,!![]);}catch(_0x101bf8){return BPromise[_0xba35('0x22')](_0x101bf8);}return _0x38b03e['save']();};}function saveUpdates(_0x3aed8a,_0x311b3f){return function(_0x13937c){if(_0x13937c){return _0x13937c[_0xba35('0x23')](_0x3aed8a)[_0xba35('0x24')](function(_0x130e88){return _0x130e88;});}return null;};}function removeEntity(_0x54f90a,_0x4cfaa3){return function(_0x475718){if(_0x475718){return _0x475718['destroy']()[_0xba35('0x24')](function(){_0x54f90a[_0xba35('0x1a')](0xcc)[_0xba35('0x19')]();});}};}function handleEntityNotFound(_0x273ad4,_0x1a7edf){return function(_0x128651){if(!_0x128651){_0x273ad4['sendStatus'](0x194);}return _0x128651;};}function handleError(_0x3484f0,_0x2360b1){_0x2360b1=_0x2360b1||0x1f4;return function(_0x324c1e){logger['error'](_0x324c1e[_0xba35('0x25')]);if(_0x324c1e['name']){delete _0x324c1e[_0xba35('0x26')];}_0x3484f0[_0xba35('0x1a')](_0x2360b1)['send'](_0x324c1e);};}exports[_0xba35('0x27')]=function(_0x25f640,_0x361976){var _0x3274ba={},_0x2bd6c3={},_0x5f0b5f={'count':0x0,'rows':[]};var _0x563027=_[_0xba35('0x28')](db[_0xba35('0x29')][_0xba35('0x2a')],function(_0x281e55){return{'name':_0x281e55['fieldName'],'type':_0x281e55['type'][_0xba35('0x2b')]};});_0x2bd6c3['model']=_[_0xba35('0x28')](_0x563027,_0xba35('0x26'));_0x2bd6c3[_0xba35('0x2c')]=_[_0xba35('0x2d')](_0x25f640['query']);_0x2bd6c3[_0xba35('0x2e')]=_['intersection'](_0x2bd6c3[_0xba35('0x2f')],_0x2bd6c3[_0xba35('0x2c')]);_0x3274ba[_0xba35('0x30')]=_['intersection'](_0x2bd6c3[_0xba35('0x2f')],qs[_0xba35('0x31')](_0x25f640[_0xba35('0x2c')]['fields']));_0x3274ba[_0xba35('0x30')]=_0x3274ba[_0xba35('0x30')][_0xba35('0x32')]?_0x3274ba['attributes']:_0x2bd6c3['model'];if(!_0x25f640[_0xba35('0x2c')]['hasOwnProperty']('nolimit')){_0x3274ba[_0xba35('0x1d')]=qs[_0xba35('0x1d')](_0x25f640[_0xba35('0x2c')][_0xba35('0x1d')]);_0x3274ba['offset']=qs['offset'](_0x25f640[_0xba35('0x2c')]['offset']);}_0x3274ba['order']=qs['sort'](_0x25f640['query'][_0xba35('0x33')]);_0x3274ba[_0xba35('0x34')]=qs[_0xba35('0x2e')](_[_0xba35('0x35')](_0x25f640[_0xba35('0x2c')],_0x2bd6c3[_0xba35('0x2e')]),_0x563027);if(_0x25f640[_0xba35('0x2c')][_0xba35('0x36')]){_0x3274ba['where']=_[_0xba35('0x37')](_0x3274ba[_0xba35('0x34')],{'$or':_[_0xba35('0x28')](_0x563027,function(_0xd7ae7a){if(_0xd7ae7a['type']!=='VIRTUAL'){var _0x23fb29={};_0x23fb29[_0xd7ae7a[_0xba35('0x26')]]={'$like':'%'+_0x25f640['query'][_0xba35('0x36')]+'%'};return _0x23fb29;}})});}_0x3274ba=_[_0xba35('0x37')]({},_0x3274ba,_0x25f640[_0xba35('0x38')]);var _0x5ecec2={'where':_0x3274ba[_0xba35('0x34')]};return db[_0xba35('0x29')][_0xba35('0x1e')](_0x5ecec2)[_0xba35('0x24')](function(_0x5a012e){_0x5f0b5f[_0xba35('0x1e')]=_0x5a012e;if(_0x25f640[_0xba35('0x2c')][_0xba35('0x39')]){_0x3274ba['include']=[{'all':!![]}];}return db['Automation'][_0xba35('0x3a')](_0x3274ba);})['then'](function(_0x17f080){_0x5f0b5f[_0xba35('0x3b')]=_0x17f080;return _0x5f0b5f;})[_0xba35('0x24')](respondWithFilteredResult(_0x361976,_0x3274ba))[_0xba35('0x3c')](handleError(_0x361976,null));};exports['show']=function(_0x26f153,_0x48330e){var _0x2b392c={'raw':![],'where':{'id':_0x26f153['params']['id']}},_0x3bea2c={};_0x3bea2c[_0xba35('0x2f')]=_[_0xba35('0x2d')](db[_0xba35('0x29')][_0xba35('0x2a')]);_0x3bea2c['query']=_[_0xba35('0x2d')](_0x26f153['query']);_0x3bea2c['filters']=_[_0xba35('0x3d')](_0x3bea2c[_0xba35('0x2f')],_0x3bea2c[_0xba35('0x2c')]);_0x2b392c['attributes']=_[_0xba35('0x3d')](_0x3bea2c[_0xba35('0x2f')],qs[_0xba35('0x31')](_0x26f153[_0xba35('0x2c')]['fields']));_0x2b392c['attributes']=_0x2b392c[_0xba35('0x30')][_0xba35('0x32')]?_0x2b392c[_0xba35('0x30')]:_0x3bea2c['model'];if(_0x26f153['query']['includeAll']){_0x2b392c[_0xba35('0x3e')]=[{'all':!![]}];}_0x2b392c=_['merge']({},_0x2b392c,_0x26f153[_0xba35('0x38')]);return db[_0xba35('0x29')][_0xba35('0x3f')](_0x2b392c)['then'](handleEntityNotFound(_0x48330e,null))['then'](respondWithResult(_0x48330e,null))[_0xba35('0x3c')](handleError(_0x48330e,null));};exports[_0xba35('0x40')]=function(_0x3cfd06,_0x1997c7){return db[_0xba35('0x29')][_0xba35('0x40')](_0x3cfd06[_0xba35('0x41')],{})[_0xba35('0x24')](respondWithResult(_0x1997c7,0xc9))['catch'](handleError(_0x1997c7,null));};exports[_0xba35('0x23')]=function(_0x13f662,_0x386595){if(_0x13f662[_0xba35('0x41')]['id']){delete _0x13f662[_0xba35('0x41')]['id'];}return db[_0xba35('0x29')][_0xba35('0x3f')]({'where':{'id':_0x13f662[_0xba35('0x42')]['id']}})['then'](handleEntityNotFound(_0x386595,null))['then'](saveUpdates(_0x13f662[_0xba35('0x41')],null))[_0xba35('0x24')](respondWithResult(_0x386595,null))[_0xba35('0x3c')](handleError(_0x386595,null));};exports['destroy']=function(_0x4850c1,_0x1a8909){return db[_0xba35('0x29')][_0xba35('0x3f')]({'where':{'id':_0x4850c1[_0xba35('0x42')]['id']}})[_0xba35('0x24')](handleEntityNotFound(_0x1a8909,null))[_0xba35('0x24')](removeEntity(_0x1a8909,null))['catch'](handleError(_0x1a8909,null));};exports[_0xba35('0x43')]=function(_0x1b351a,_0x12b1b7,_0x49ca86){return db[_0xba35('0x44')][_0xba35('0x3f')]({'where':{'id':_0x1b351a[_0xba35('0x42')]['id']}})['then'](handleEntityNotFound(_0x12b1b7,null))[_0xba35('0x24')](function(_0xecea81){if(_0xecea81){return _0xecea81['addConditions'](_0x1b351a[_0xba35('0x41')][_0xba35('0x45')],_[_0xba35('0x46')](_0x1b351a[_0xba35('0x41')],[_0xba35('0x45'),'id'])||{});}})[_0xba35('0x24')](respondWithResult(_0x12b1b7,null))[_0xba35('0x3c')](handleError(_0x12b1b7,null));};exports['getConditions']=function(_0x5920f1,_0x48b250,_0x232d95){var _0x58b3db={};var _0x1c9e5c={};var _0x244824;var _0x3de098;return db[_0xba35('0x29')][_0xba35('0x47')]({'where':{'id':_0x5920f1[_0xba35('0x42')]['id']}})[_0xba35('0x24')](handleEntityNotFound(_0x48b250,null))[_0xba35('0x24')](function(_0x4c50f6){if(_0x4c50f6){_0x244824=_0x4c50f6;_0x1c9e5c[_0xba35('0x2f')]=_[_0xba35('0x2d')](db['Condition'][_0xba35('0x2a')]);_0x1c9e5c[_0xba35('0x2c')]=_['keys'](_0x5920f1[_0xba35('0x2c')]);_0x1c9e5c[_0xba35('0x2e')]=_[_0xba35('0x3d')](_0x1c9e5c[_0xba35('0x2f')],_0x1c9e5c[_0xba35('0x2c')]);_0x58b3db[_0xba35('0x30')]=_[_0xba35('0x3d')](_0x1c9e5c[_0xba35('0x2f')],qs['fields'](_0x5920f1[_0xba35('0x2c')]['fields']));_0x58b3db['attributes']=_0x58b3db[_0xba35('0x30')]['length']?_0x58b3db[_0xba35('0x30')]:_0x1c9e5c[_0xba35('0x2f')];_0x58b3db['order']=qs['sort'](_0x5920f1[_0xba35('0x2c')]['sort']);_0x58b3db['where']=qs['filters'](_[_0xba35('0x35')](_0x5920f1[_0xba35('0x2c')],_0x1c9e5c[_0xba35('0x2e')]));if(_0x5920f1['query'][_0xba35('0x36')]){_0x58b3db['where']=_[_0xba35('0x37')](_0x58b3db['where'],{'$or':_['map'](_0x58b3db[_0xba35('0x30')],function(_0x2583b1){var _0x4d95a8={};_0x4d95a8[_0x2583b1]={'$like':'%'+_0x5920f1[_0xba35('0x2c')][_0xba35('0x36')]+'%'};return _0x4d95a8;})});}_0x58b3db=_[_0xba35('0x37')]({},_0x58b3db,_0x5920f1[_0xba35('0x38')]);return _0x244824['getConditions'](_0x58b3db);}})[_0xba35('0x24')](function(_0x118cb5){if(_0x118cb5){_0x3de098=_0x118cb5[_0xba35('0x32')];if(!_0x5920f1[_0xba35('0x2c')][_0xba35('0x48')](_0xba35('0x49'))){_0x58b3db[_0xba35('0x1d')]=qs[_0xba35('0x1d')](_0x5920f1[_0xba35('0x2c')][_0xba35('0x1d')]);_0x58b3db['offset']=qs[_0xba35('0x1b')](_0x5920f1[_0xba35('0x2c')]['offset']);}return _0x244824[_0xba35('0x4a')](_0x58b3db);}})[_0xba35('0x24')](function(_0x568184){if(_0x568184){return _0x568184?{'count':_0x3de098,'rows':_0x568184}:null;}})[_0xba35('0x24')](respondWithResult(_0x48b250,null))[_0xba35('0x3c')](handleError(_0x48b250,null));};exports['addActions']=function(_0x5a07f9,_0x15f781,_0x20d8af){return db[_0xba35('0x4b')][_0xba35('0x3f')]({'where':{'id':_0x5a07f9[_0xba35('0x42')]['id']}})['then'](handleEntityNotFound(_0x15f781,null))[_0xba35('0x24')](function(_0x223e17){if(_0x223e17){return _0x223e17[_0xba35('0x4c')](_0x5a07f9[_0xba35('0x41')][_0xba35('0x45')],_[_0xba35('0x46')](_0x5a07f9[_0xba35('0x41')],[_0xba35('0x45'),'id'])||{});}})['then'](respondWithResult(_0x15f781,null))[_0xba35('0x3c')](handleError(_0x15f781,null));};exports[_0xba35('0x4d')]=function(_0x18d2ed,_0x26e05a,_0x5101db){var _0x25d060={};var _0x47f93e={};var _0x128f7c;var _0x2a6018;return db[_0xba35('0x29')][_0xba35('0x47')]({'where':{'id':_0x18d2ed['params']['id']}})[_0xba35('0x24')](handleEntityNotFound(_0x26e05a,null))[_0xba35('0x24')](function(_0xa9383d){if(_0xa9383d){_0x128f7c=_0xa9383d;_0x47f93e[_0xba35('0x2f')]=_[_0xba35('0x2d')](db[_0xba35('0x4b')]['rawAttributes']);_0x47f93e[_0xba35('0x2c')]=_[_0xba35('0x2d')](_0x18d2ed[_0xba35('0x2c')]);_0x47f93e[_0xba35('0x2e')]=_[_0xba35('0x3d')](_0x47f93e['model'],_0x47f93e[_0xba35('0x2c')]);_0x25d060[_0xba35('0x30')]=_[_0xba35('0x3d')](_0x47f93e[_0xba35('0x2f')],qs['fields'](_0x18d2ed['query'][_0xba35('0x31')]));_0x25d060['attributes']=_0x25d060[_0xba35('0x30')][_0xba35('0x32')]?_0x25d060[_0xba35('0x30')]:_0x47f93e['model'];_0x25d060[_0xba35('0x4e')]=qs[_0xba35('0x33')](_0x18d2ed[_0xba35('0x2c')]['sort']);_0x25d060[_0xba35('0x34')]=qs[_0xba35('0x2e')](_[_0xba35('0x35')](_0x18d2ed[_0xba35('0x2c')],_0x47f93e[_0xba35('0x2e')]));if(_0x18d2ed['query'][_0xba35('0x36')]){_0x25d060['where']=_[_0xba35('0x37')](_0x25d060[_0xba35('0x34')],{'$or':_[_0xba35('0x28')](_0x25d060[_0xba35('0x30')],function(_0x541bcf){var _0x2f4bef={};_0x2f4bef[_0x541bcf]={'$like':'%'+_0x18d2ed[_0xba35('0x2c')][_0xba35('0x36')]+'%'};return _0x2f4bef;})});}_0x25d060=_[_0xba35('0x37')]({},_0x25d060,_0x18d2ed[_0xba35('0x38')]);return _0x128f7c['getActions'](_0x25d060);}})['then'](function(_0xe2a8d7){if(_0xe2a8d7){_0x2a6018=_0xe2a8d7[_0xba35('0x32')];if(!_0x18d2ed[_0xba35('0x2c')][_0xba35('0x48')](_0xba35('0x49'))){_0x25d060['limit']=qs[_0xba35('0x1d')](_0x18d2ed[_0xba35('0x2c')][_0xba35('0x1d')]);_0x25d060[_0xba35('0x1b')]=qs['offset'](_0x18d2ed['query'][_0xba35('0x1b')]);}return _0x128f7c[_0xba35('0x4d')](_0x25d060);}})[_0xba35('0x24')](function(_0x3e6131){if(_0x3e6131){return _0x3e6131?{'count':_0x2a6018,'rows':_0x3e6131}:null;}})[_0xba35('0x24')](respondWithResult(_0x26e05a,null))[_0xba35('0x3c')](handleError(_0x26e05a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 212fe7d..24ebba6 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 _0x2c19=['define','Automation','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x2c19,0x1af));var _0x92c1=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x2c19[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0x92c1('0x0'));var logger=require(_0x92c1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92c1('0x2'));var rp=require(_0x92c1('0x3'));var fs=require('fs');var path=require(_0x92c1('0x4'));var rimraf=require(_0x92c1('0x5'));var config=require(_0x92c1('0x6'));var attributes=require(_0x92c1('0x7'));module[_0x92c1('0x8')]=function(_0x2c8ee2,_0x158780){return _0x2c8ee2[_0x92c1('0x9')](_0x92c1('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8404=['bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','util','api','moment'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x8404,0xb8));var _0x4840=function(_0x2428e2,_0x53e369){_0x2428e2=_0x2428e2-0x0;var _0x15759a=_0x8404[_0x2428e2];return _0x15759a;};'use strict';var _=require('lodash');var util=require(_0x4840('0x0'));var logger=require('../../config/logger')(_0x4840('0x1'));var moment=require(_0x4840('0x2'));var BPromise=require(_0x4840('0x3'));var rp=require(_0x4840('0x4'));var fs=require('fs');var path=require(_0x4840('0x5'));var rimraf=require(_0x4840('0x6'));var config=require('../../config/environment');var attributes=require(_0x4840('0x7'));module[_0x4840('0x8')]=function(_0x1c25c7,_0x212194){return _0x1c25c7[_0x4840('0x9')](_0x4840('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 84af918..505b56a 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 _0x5c96=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x57e62c,_0x23c1ba){var _0x25a327=function(_0x5dcaf8){while(--_0x5dcaf8){_0x57e62c['push'](_0x57e62c['shift']());}};_0x25a327(++_0x23c1ba);}(_0x5c96,0x133));var _0x65c9=function(_0x1133f3,_0x5772b8){_0x1133f3=_0x1133f3-0x0;var _0x5b499d=_0x5c96[_0x1133f3];return _0x5b499d;};'use strict';var _=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var moment=require(_0x65c9('0x2'));var BPromise=require(_0x65c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65c9('0x4'));var db=require(_0x65c9('0x5'))['db'];var utils=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));var config=require(_0x65c9('0x9'));var jayson=require(_0x65c9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x502c63,_0x4eb25b,_0x1a9b93){return new BPromise(function(_0x10a355,_0x1c679d){return client['request'](_0x502c63,_0x1a9b93)[_0x65c9('0xb')](function(_0x3249da){logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));logger[_0x65c9('0xf')](_0x65c9('0x10'),_0x4eb25b,'request\x20sent',JSON['stringify'](_0x3249da));if(_0x3249da['error']){if(_0x3249da[_0x65c9('0x11')][_0x65c9('0x12')]===0x1f4){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da[_0x65c9('0x11')]['message']);return _0x1c679d(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da['error'][_0x65c9('0x13')]);return _0x10a355(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}else{logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));_0x10a355(_0x3249da[_0x65c9('0x14')][_0x65c9('0x13')]);}})[_0x65c9('0x15')](function(_0x25c0e9){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x25c0e9);_0x1c679d(_0x25c0e9);});});} \ No newline at end of file +var _0x7462=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring'];(function(_0x3f4cb5,_0x5de9f8){var _0x12886b=function(_0x1114ad){while(--_0x1114ad){_0x3f4cb5['push'](_0x3f4cb5['shift']());}};_0x12886b(++_0x5de9f8);}(_0x7462,0x165));var _0x2746=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x7462[_0x1f239e];return _0x826971;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2746('0x3'));var logger=require(_0x2746('0x4'))('rpc');var config=require(_0x2746('0x5'));var jayson=require(_0x2746('0x6'));var client=jayson[_0x2746('0x7')][_0x2746('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f42,_0x2940d8,_0x1447bc){return new BPromise(function(_0x40ad2b,_0x283327){return client['request'](_0x2a2f42,_0x1447bc)[_0x2746('0x9')](function(_0x2e4713){logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));logger[_0x2746('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2940d8,_0x2746('0xb'),JSON[_0x2746('0xd')](_0x2e4713));if(_0x2e4713[_0x2746('0xe')]){if(_0x2e4713[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x283327(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x40ad2b(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}else{logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));_0x40ad2b(_0x2e4713['result']['message']);}})[_0x2746('0x11')](function(_0x43f06c){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x43f06c);_0x283327(_0x43f06c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 9235359..478d050 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 _0xe908=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0xe908,0x1be));var _0x8e90=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe908[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require(_0x8e90('0x0'));var path=require('path');var timeout=require(_0x8e90('0x1'));var express=require(_0x8e90('0x2'));var router=express[_0x8e90('0x3')]();var fs_extra=require(_0x8e90('0x4'));var auth=require(_0x8e90('0x5'));var interaction=require(_0x8e90('0x6'));var config=require(_0x8e90('0x7'));var controller=require(_0x8e90('0x8'));router[_0x8e90('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8e90('0x9')]('/:id',auth[_0x8e90('0xa')](),controller[_0x8e90('0xb')]);router['get'](_0x8e90('0xc'),auth['isAuthenticated'](),controller['getConditions']);router[_0x8e90('0x9')](_0x8e90('0xd'),auth[_0x8e90('0xa')](),controller[_0x8e90('0xe')]);router[_0x8e90('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e90('0x10')]);router[_0x8e90('0xf')](_0x8e90('0xc'),auth[_0x8e90('0xa')](),controller['addConditions']);router[_0x8e90('0xf')](_0x8e90('0xd'),auth[_0x8e90('0xa')](),controller[_0x8e90('0x11')]);router[_0x8e90('0x12')](_0x8e90('0x13'),auth[_0x8e90('0xa')](),controller[_0x8e90('0x14')]);router[_0x8e90('0x15')](_0x8e90('0x13'),auth[_0x8e90('0xa')](),controller[_0x8e90('0x16')]);module[_0x8e90('0x17')]=router; \ No newline at end of file +var _0x3561=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','getConditions','post','/:id/conditions','addConditions','/:id/actions','addActions','put','/:id','update','delete','destroy','multer','path'];(function(_0x581fa6,_0x4cc8c9){var _0x4d4378=function(_0x4ea676){while(--_0x4ea676){_0x581fa6['push'](_0x581fa6['shift']());}};_0x4d4378(++_0x4cc8c9);}(_0x3561,0x94));var _0x1356=function(_0x1fc574,_0x635b80){_0x1fc574=_0x1fc574-0x0;var _0x5393e5=_0x3561[_0x1fc574];return _0x5393e5;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/:id',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x1356('0xe')]);router[_0x1356('0xa')]('/:id/actions',auth[_0x1356('0xb')](),controller['getActions']);router[_0x1356('0xf')]('/',auth[_0x1356('0xb')](),controller['create']);router[_0x1356('0xf')](_0x1356('0x10'),auth['isAuthenticated'](),controller[_0x1356('0x11')]);router[_0x1356('0xf')](_0x1356('0x12'),auth[_0x1356('0xb')](),controller[_0x1356('0x13')]);router[_0x1356('0x14')](_0x1356('0x15'),auth[_0x1356('0xb')](),controller[_0x1356('0x16')]);router[_0x1356('0x17')](_0x1356('0x15'),auth[_0x1356('0xb')](),controller[_0x1356('0x18')]);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 b1f21a0..9ee96c2 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 _0x441c=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\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','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x32f216,_0x4d78e3){var _0x2d5e38=function(_0x534ba1){while(--_0x534ba1){_0x32f216['push'](_0x32f216['shift']());}};_0x2d5e38(++_0x4d78e3);}(_0x441c,0xeb));var _0xc441=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x441c[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xc441('0x0'));module['exports']={'name':{'type':Sequelize[_0xc441('0x1')],'unique':_0xc441('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc441('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xc441('0x4')},'description':{'type':Sequelize[_0xc441('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc441('0x5')},'limitCalls':{'type':Sequelize[_0xc441('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc441('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc441('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc441('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc441('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc441('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)[_0xc441('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc441('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)[_0xc441('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc441('0xc')},'dialTimezone':{'type':Sequelize[_0xc441('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc441('0x1')],'defaultValue':_0xc441('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xc441('0x3')](_0xc441('0xe'),_0xc441('0xf'),_0xc441('0x10')),'defaultValue':_0xc441('0xe')},'dialAMDActive':{'type':Sequelize[_0xc441('0x11')],'defaultValue':0x0,'comment':_0xc441('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xc441('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc441('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xc441('0x6')](0x9)[_0xc441('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc441('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc441('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc441('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc441('0x6')](0x9)[_0xc441('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc441('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xc441('0x6')](0x9)[_0xc441('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc441('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc441('0x6')](0x9)[_0xc441('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc441('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc441('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc441('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc441('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc441('0x1a'),_0xc441('0x1b')),'defaultValue':_0xc441('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc441('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc441('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc441('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc441('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc441('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc441('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc441('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc441('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)[_0xc441('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)[_0xc441('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc441('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc441('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc441('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc441('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc441('0x6')](0x5)[_0xc441('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc441('0x24')}}; \ No newline at end of file +var _0xaf68=['onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\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)','sequelize','exports','STRING','name','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xaf68,0xbc));var _0x8af6=function(_0x4dfa91,_0x30be73){_0x4dfa91=_0x4dfa91-0x0;var _0x511504=_0xaf68[_0x4dfa91];return _0x511504;};'use strict';var Sequelize=require(_0x8af6('0x0'));module[_0x8af6('0x1')]={'name':{'type':Sequelize[_0x8af6('0x2')],'unique':_0x8af6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x8af6('0x2')]},'active':{'type':Sequelize[_0x8af6('0x4')],'defaultValue':0x0,'comment':_0x8af6('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8af6('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8af6('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8af6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8af6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'comment':_0x8af6('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8af6('0xc')},'dialTimezone':{'type':Sequelize[_0x8af6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8af6('0xd')](_0x8af6('0xe'),_0x8af6('0xf'),_0x8af6('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8af6('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8af6('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8af6('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8af6('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8af6('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8af6('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8af6('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8af6('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8af6('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8af6('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8af6('0xd')](_0x8af6('0x16'),_0x8af6('0x17')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8af6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8af6('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8af6('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index cc5801a..b163c5c 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 _0x1b9d=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','role','update','CmHopper','nolimit','CampaignId','pick','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','insert','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','into','fromQuery','ListId\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x1b9d,0xf9));var _0xd1b9=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x1b9d[_0x5817e6];return _0x51916a;};'use strict';var emlformat=require(_0xd1b9('0x0'));var rimraf=require(_0xd1b9('0x1'));var zipdir=require(_0xd1b9('0x2'));var jsonpatch=require(_0xd1b9('0x3'));var rp=require(_0xd1b9('0x4'));var moment=require(_0xd1b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1b9('0x6'));var util=require(_0xd1b9('0x7'));var path=require(_0xd1b9('0x8'));var sox=require(_0xd1b9('0x9'));var csv=require(_0xd1b9('0xa'));var ejs=require(_0xd1b9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd1b9('0xc'));var crypto=require(_0xd1b9('0xd'));var jsforce=require(_0xd1b9('0xe'));var deskjs=require(_0xd1b9('0xf'));var toCsv=require(_0xd1b9('0xa'));var querystring=require('querystring');var Papa=require(_0xd1b9('0x10'));var Redis=require(_0xd1b9('0x11'));var authService=require(_0xd1b9('0x12'));var qs=require(_0xd1b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1b9('0x14'))(_0xd1b9('0x15'));var utils=require('../../config/utils');var config=require(_0xd1b9('0x16'));var licenseUtil=require(_0xd1b9('0x17'));var db=require(_0xd1b9('0x18'))['db'];function respondWithStatusCode(_0x1ee7f8,_0x30008c){_0x30008c=_0x30008c||0xcc;return function(_0x53cc2c){if(_0x53cc2c){return _0x1ee7f8[_0xd1b9('0x19')](_0x30008c);}return _0x1ee7f8[_0xd1b9('0x1a')](_0x30008c)['end']();};}function respondWithResult(_0xe0da69,_0x11d4a0){_0x11d4a0=_0x11d4a0||0xc8;return function(_0x2a488e){if(_0x2a488e){return _0xe0da69[_0xd1b9('0x1a')](_0x11d4a0)['json'](_0x2a488e);}};}function respondWithFilteredResult(_0x3cc911,_0x288a26){return function(_0x1f82e8){if(_0x1f82e8){var _0x225307=typeof _0x288a26[_0xd1b9('0x1b')]===_0xd1b9('0x1c')&&typeof _0x288a26[_0xd1b9('0x1d')]===_0xd1b9('0x1c');var _0x3ce429=_0x1f82e8[_0xd1b9('0x1e')];var _0x41367f=_0x225307?0x0:_0x288a26[_0xd1b9('0x1b')];var _0xedc232=_0x225307?_0x1f82e8[_0xd1b9('0x1e')]:_0x288a26[_0xd1b9('0x1b')]+_0x288a26[_0xd1b9('0x1d')];var _0x4d6e3f;if(_0xedc232>=_0x3ce429){_0xedc232=_0x3ce429;_0x4d6e3f=0xc8;}else{_0x4d6e3f=0xce;}_0x3cc911[_0xd1b9('0x1a')](_0x4d6e3f);return _0x3cc911[_0xd1b9('0x1f')](_0xd1b9('0x20'),_0x41367f+'-'+_0xedc232+'/'+_0x3ce429)[_0xd1b9('0x21')](_0x1f82e8);}return null;};}function patchUpdates(_0x145dba){return function(_0x4d3f4b){try{jsonpatch['apply'](_0x4d3f4b,_0x145dba,!![]);}catch(_0x35365a){return BPromise['reject'](_0x35365a);}return _0x4d3f4b[_0xd1b9('0x22')]();};}function saveUpdates(_0x4b5207,_0x48d2ea){return function(_0x11d760){if(_0x11d760){return _0x11d760['update'](_0x4b5207)[_0xd1b9('0x23')](function(_0x3352e6){return _0x3352e6;});}return null;};}function removeEntity(_0x304e3c,_0x4887a2){return function(_0x2e7ee7){if(_0x2e7ee7){return _0x2e7ee7[_0xd1b9('0x24')]()[_0xd1b9('0x23')](function(){var _0x3cf4f2=_0x2e7ee7[_0xd1b9('0x25')]({'plain':!![]});var _0x24967f=_0xd1b9('0x26');return db[_0xd1b9('0x27')]['destroy']({'where':{'type':_0x24967f,'resourceId':_0x3cf4f2['id']}})[_0xd1b9('0x23')](function(){return _0x2e7ee7;});})[_0xd1b9('0x23')](function(){_0x304e3c[_0xd1b9('0x1a')](0xcc)[_0xd1b9('0x28')]();});}};}function handleEntityNotFound(_0x34aab3,_0x88c832){return function(_0x24702e){if(!_0x24702e){_0x34aab3[_0xd1b9('0x19')](0x194);}return _0x24702e;};}function handleError(_0x5a7e62,_0x27e33a){_0x27e33a=_0x27e33a||0x1f4;return function(_0x313fb1){logger[_0xd1b9('0x29')](_0x313fb1[_0xd1b9('0x2a')]);if(_0x313fb1['name']){delete _0x313fb1[_0xd1b9('0x2b')];}_0x5a7e62[_0xd1b9('0x1a')](_0x27e33a)[_0xd1b9('0x2c')](_0x313fb1);};}exports[_0xd1b9('0x2d')]=function(_0x3c24fe,_0x28c61a){var _0x9d6afd={},_0x35da92={},_0x4dda77={'count':0x0,'rows':[]};var _0x41f5c6=_[_0xd1b9('0x2e')](db[_0xd1b9('0x2f')][_0xd1b9('0x30')],function(_0x5b42f8){return{'name':_0x5b42f8['fieldName'],'type':_0x5b42f8[_0xd1b9('0x31')][_0xd1b9('0x32')]};});_0x35da92[_0xd1b9('0x33')]=_[_0xd1b9('0x2e')](_0x41f5c6,_0xd1b9('0x2b'));_0x35da92[_0xd1b9('0x34')]=_[_0xd1b9('0x35')](_0x3c24fe[_0xd1b9('0x34')]);_0x35da92[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x35da92[_0xd1b9('0x33')],_0x35da92['query']);_0x9d6afd['attributes']=_[_0xd1b9('0x37')](_0x35da92[_0xd1b9('0x33')],qs[_0xd1b9('0x38')](_0x3c24fe[_0xd1b9('0x34')][_0xd1b9('0x38')]));_0x9d6afd['attributes']=_0x9d6afd[_0xd1b9('0x39')]['length']?_0x9d6afd[_0xd1b9('0x39')]:_0x35da92[_0xd1b9('0x33')];if(!_0x3c24fe['query'][_0xd1b9('0x3a')]('nolimit')){_0x9d6afd[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0x3c24fe[_0xd1b9('0x34')][_0xd1b9('0x1d')]);_0x9d6afd[_0xd1b9('0x1b')]=qs[_0xd1b9('0x1b')](_0x3c24fe['query'][_0xd1b9('0x1b')]);}_0x9d6afd[_0xd1b9('0x3b')]=qs[_0xd1b9('0x3c')](_0x3c24fe[_0xd1b9('0x34')][_0xd1b9('0x3c')]);_0x9d6afd['where']=qs[_0xd1b9('0x36')](_['pick'](_0x3c24fe[_0xd1b9('0x34')],_0x35da92[_0xd1b9('0x36')]),_0x41f5c6);if(_0x3c24fe[_0xd1b9('0x34')]['filter']){_0x9d6afd[_0xd1b9('0x3d')]=_[_0xd1b9('0x3e')](_0x9d6afd[_0xd1b9('0x3d')],{'$or':_[_0xd1b9('0x2e')](_0x41f5c6,function(_0x49565b){if(_0x49565b[_0xd1b9('0x31')]!=='VIRTUAL'){var _0x214257={};_0x214257[_0x49565b[_0xd1b9('0x2b')]]={'$like':'%'+_0x3c24fe['query'][_0xd1b9('0x3f')]+'%'};return _0x214257;}})});}_0x9d6afd=_[_0xd1b9('0x3e')]({},_0x9d6afd,_0x3c24fe['options']);var _0x5c4439={'where':_0x9d6afd['where']};return db[_0xd1b9('0x2f')][_0xd1b9('0x1e')](_0x5c4439)[_0xd1b9('0x23')](function(_0x16b8b7){_0x4dda77[_0xd1b9('0x1e')]=_0x16b8b7;if(_0x3c24fe[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0x9d6afd[_0xd1b9('0x41')]=[{'all':!![]}];}return db[_0xd1b9('0x2f')][_0xd1b9('0x42')](_0x9d6afd);})['then'](function(_0x5a8d06){_0x4dda77[_0xd1b9('0x43')]=_0x5a8d06;return _0x4dda77;})[_0xd1b9('0x23')](respondWithFilteredResult(_0x28c61a,_0x9d6afd))[_0xd1b9('0x44')](handleError(_0x28c61a,null));};exports[_0xd1b9('0x45')]=function(_0x81134b,_0x650e24){var _0xbc32d5={'raw':![],'where':{'id':_0x81134b['params']['id']}},_0x71aa7c={};_0x71aa7c['model']=_[_0xd1b9('0x35')](db[_0xd1b9('0x2f')]['rawAttributes']);_0x71aa7c[_0xd1b9('0x34')]=_[_0xd1b9('0x35')](_0x81134b[_0xd1b9('0x34')]);_0x71aa7c[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x71aa7c['model'],_0x71aa7c[_0xd1b9('0x34')]);_0xbc32d5[_0xd1b9('0x39')]=_[_0xd1b9('0x37')](_0x71aa7c['model'],qs[_0xd1b9('0x38')](_0x81134b[_0xd1b9('0x34')][_0xd1b9('0x38')]));_0xbc32d5[_0xd1b9('0x39')]=_0xbc32d5[_0xd1b9('0x39')][_0xd1b9('0x46')]?_0xbc32d5[_0xd1b9('0x39')]:_0x71aa7c['model'];if(_0x81134b[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0xbc32d5['include']=[{'all':!![]}];}_0xbc32d5=_[_0xd1b9('0x3e')]({},_0xbc32d5,_0x81134b[_0xd1b9('0x47')]);return db['Campaign'][_0xd1b9('0x48')](_0xbc32d5)['then'](handleEntityNotFound(_0x650e24,null))[_0xd1b9('0x23')](respondWithResult(_0x650e24,null))[_0xd1b9('0x44')](handleError(_0x650e24,null));};exports[_0xd1b9('0x49')]=function(_0x422e69,_0x1ea677){return db[_0xd1b9('0x2f')][_0xd1b9('0x49')](_0x422e69[_0xd1b9('0x4a')],{})[_0xd1b9('0x23')](function(_0x326c56){var _0x3cb319=_0x422e69[_0xd1b9('0x4b')]['get']({'plain':!![]});if(!_0x3cb319)throw new Error(_0xd1b9('0x4c'));if(_0x3cb319['role']==='user'){var _0x5aa1de=_0x326c56[_0xd1b9('0x25')]({'plain':!![]});var _0xe71e64=_0xd1b9('0x26');return db[_0xd1b9('0x4d')]['find']({'where':{'name':_0xe71e64,'userProfileId':_0x3cb319[_0xd1b9('0x4e')]},'raw':!![]})['then'](function(_0x5514ef){if(_0x5514ef&&_0x5514ef[_0xd1b9('0x4f')]===0x0){return db[_0xd1b9('0x27')][_0xd1b9('0x49')]({'name':_0x5aa1de[_0xd1b9('0x2b')],'resourceId':_0x5aa1de['id'],'type':_0x5514ef[_0xd1b9('0x2b')],'sectionId':_0x5514ef['id']},{})[_0xd1b9('0x23')](function(){return _0x326c56;});}else{return _0x326c56;}})[_0xd1b9('0x44')](function(_0x1d78c2){logger[_0xd1b9('0x29')](_0xd1b9('0x50'),_0x1d78c2);throw _0x1d78c2;});}return _0x326c56;})[_0xd1b9('0x23')](respondWithResult(_0x1ea677,0xc9))[_0xd1b9('0x44')](handleError(_0x1ea677,null));};exports[_0xd1b9('0x51')]=function(_0x63fbeb,_0xfda12c){var _0x508c5e={'where':{'id':_0x63fbeb[_0xd1b9('0x52')]['id']}},_0x1397a8={};_0x1397a8[_0xd1b9('0x33')]=_[_0xd1b9('0x35')](db[_0xd1b9('0x2f')][_0xd1b9('0x30')]);_0x508c5e[_0xd1b9('0x39')]=_[_0xd1b9('0x37')](_0x1397a8['model'],qs['fields'](_0x63fbeb['query'][_0xd1b9('0x38')]));_0x508c5e['attributes']=_0x508c5e[_0xd1b9('0x39')][_0xd1b9('0x46')]?_0x508c5e[_0xd1b9('0x39')]:_0x1397a8[_0xd1b9('0x33')];if(_0x63fbeb[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0x508c5e[_0xd1b9('0x41')]=[{'all':!![]}];}_0x508c5e=_[_0xd1b9('0x3e')]({},_0x508c5e,_0x63fbeb[_0xd1b9('0x47')]);return db[_0xd1b9('0x2f')][_0xd1b9('0x48')](_0x508c5e)[_0xd1b9('0x23')](handleEntityNotFound(_0xfda12c,null))[_0xd1b9('0x23')](function(_0xfb0e0f){if(_0xfb0e0f){var _0x1549a0=_0xfb0e0f[_0xd1b9('0x25')]({'plain':!![]});_0x1549a0=qs[_0xd1b9('0x53')](_0x1549a0,['id',_0xd1b9('0x54'),_0xd1b9('0x55')]);_0x63fbeb[_0xd1b9('0x4a')]=_[_0xd1b9('0x53')](_0x63fbeb[_0xd1b9('0x4a')],['id',_0xd1b9('0x54'),'updatedAt']);return db[_0xd1b9('0x2f')][_0xd1b9('0x49')](_[_0xd1b9('0x3e')](_0x1549a0,_0x63fbeb[_0xd1b9('0x4a')]),{'include':_0x63fbeb['query'][_0xd1b9('0x40')]?[{'all':!![]}]:undefined})[_0xd1b9('0x23')](function(_0x22246d){var _0x3d0882=_0x63fbeb[_0xd1b9('0x4b')][_0xd1b9('0x25')]({'plain':!![]});if(!_0x3d0882)throw new Error(_0xd1b9('0x4c'));if(_0x3d0882[_0xd1b9('0x56')]==='user'){var _0x34d835=_0x22246d[_0xd1b9('0x25')]({'plain':!![]});var _0x8db578=_0xd1b9('0x26');return db[_0xd1b9('0x4d')][_0xd1b9('0x48')]({'where':{'name':_0x8db578,'userProfileId':_0x3d0882[_0xd1b9('0x4e')]},'raw':!![]})['then'](function(_0x22e804){if(_0x22e804&&_0x22e804[_0xd1b9('0x4f')]===0x0){return db[_0xd1b9('0x27')][_0xd1b9('0x49')]({'name':_0x34d835[_0xd1b9('0x2b')],'resourceId':_0x34d835['id'],'type':_0x22e804['name'],'sectionId':_0x22e804['id']},{})[_0xd1b9('0x23')](function(){return _0x22246d;});}else{return _0x22246d;}})[_0xd1b9('0x44')](function(_0x171b5a){logger['error'](_0xd1b9('0x50'),_0x171b5a);throw _0x171b5a;});}return _0x22246d;});}})[_0xd1b9('0x23')](respondWithResult(_0xfda12c,0xc9))[_0xd1b9('0x44')](handleError(_0xfda12c,null));};exports[_0xd1b9('0x57')]=function(_0x5add91,_0x44a5dd){if(_0x5add91[_0xd1b9('0x4a')]['id']){delete _0x5add91[_0xd1b9('0x4a')]['id'];}return db[_0xd1b9('0x2f')][_0xd1b9('0x48')]({'where':{'id':_0x5add91[_0xd1b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x44a5dd,null))['then'](saveUpdates(_0x5add91[_0xd1b9('0x4a')],null))[_0xd1b9('0x23')](respondWithResult(_0x44a5dd,null))[_0xd1b9('0x44')](handleError(_0x44a5dd,null));};exports[_0xd1b9('0x24')]=function(_0x3bd160,_0x1c18f2){return db[_0xd1b9('0x2f')][_0xd1b9('0x48')]({'where':{'id':_0x3bd160[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x1c18f2,null))[_0xd1b9('0x23')](removeEntity(_0x1c18f2,null))[_0xd1b9('0x44')](handleError(_0x1c18f2,null));};exports['getHoppers']=function(_0x403779,_0x51b3d0,_0xbbfc2d){var _0x184015={'raw':!![],'where':{}};var _0x613f76={};var _0x49b1a9={'count':0x0,'rows':[]};return db[_0xd1b9('0x2f')]['findOne']({'where':{'id':_0x403779['params']['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x51b3d0,null))[_0xd1b9('0x23')](function(_0x5cbcb3){if(_0x5cbcb3){_0x613f76[_0xd1b9('0x33')]=_[_0xd1b9('0x35')](db[_0xd1b9('0x58')][_0xd1b9('0x30')]);_0x613f76[_0xd1b9('0x34')]=_['keys'](_0x403779['query']);_0x613f76[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x613f76[_0xd1b9('0x33')],_0x613f76[_0xd1b9('0x34')]);_0x184015[_0xd1b9('0x39')]=_['intersection'](_0x613f76[_0xd1b9('0x33')],qs[_0xd1b9('0x38')](_0x403779[_0xd1b9('0x34')]['fields']));_0x184015[_0xd1b9('0x39')]=_0x184015['attributes']['length']?_0x184015[_0xd1b9('0x39')]:_0x613f76[_0xd1b9('0x33')];if(!_0x403779[_0xd1b9('0x34')][_0xd1b9('0x3a')](_0xd1b9('0x59'))){_0x184015[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0x403779[_0xd1b9('0x34')][_0xd1b9('0x1d')]);_0x184015[_0xd1b9('0x1b')]=qs['offset'](_0x403779[_0xd1b9('0x34')][_0xd1b9('0x1b')]);}_0x184015['order']=qs[_0xd1b9('0x3c')](_0x403779[_0xd1b9('0x34')][_0xd1b9('0x3c')]);_0x184015[_0xd1b9('0x3d')]=qs['filters'](_['pick'](_0x403779[_0xd1b9('0x34')],_0x613f76['filters']));_0x184015[_0xd1b9('0x3d')][_0xd1b9('0x5a')]=_0x5cbcb3['id'];if(_0x403779[_0xd1b9('0x34')]['filter']){_0x184015[_0xd1b9('0x3d')]=_['merge'](_0x184015[_0xd1b9('0x3d')],{'$or':_['map'](_0x184015[_0xd1b9('0x39')],function(_0x1ec08a){var _0x46e903={};_0x46e903[_0x1ec08a]={'$like':'%'+_0x403779['query'][_0xd1b9('0x3f')]+'%'};return _0x46e903;})});}_0x184015=_['merge']({},_0x184015,_0x403779[_0xd1b9('0x47')]);return db[_0xd1b9('0x58')][_0xd1b9('0x1e')]({'where':_0x184015[_0xd1b9('0x3d')]})[_0xd1b9('0x23')](function(_0x241a18){_0x49b1a9['count']=_0x241a18;if(_0x403779[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0x184015[_0xd1b9('0x41')]=[{'all':!![]}];}return db[_0xd1b9('0x58')][_0xd1b9('0x42')](_0x184015);})['then'](function(_0x3a5dfe){_0x49b1a9[_0xd1b9('0x43')]=_0x3a5dfe;return _0x49b1a9;});}})[_0xd1b9('0x23')](respondWithFilteredResult(_0x51b3d0,_0x184015))['catch'](handleError(_0x51b3d0,null));};exports['getHopperHistories']=function(_0x1c0524,_0x2d4227,_0x11d285){var _0x5b2feb={'raw':!![],'where':{}};var _0x8741ec={};var _0xce2a11={'count':0x0,'rows':[]};return db[_0xd1b9('0x2f')]['findOne']({'where':{'id':_0x1c0524[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x2d4227,null))[_0xd1b9('0x23')](function(_0x472f6b){if(_0x472f6b){_0x8741ec[_0xd1b9('0x33')]=_[_0xd1b9('0x35')](db['CmHopperHistory'][_0xd1b9('0x30')]);_0x8741ec['query']=_[_0xd1b9('0x35')](_0x1c0524[_0xd1b9('0x34')]);_0x8741ec[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x8741ec['model'],_0x8741ec[_0xd1b9('0x34')]);_0x5b2feb[_0xd1b9('0x39')]=_[_0xd1b9('0x37')](_0x8741ec['model'],qs[_0xd1b9('0x38')](_0x1c0524[_0xd1b9('0x34')]['fields']));_0x5b2feb['attributes']=_0x5b2feb[_0xd1b9('0x39')][_0xd1b9('0x46')]?_0x5b2feb[_0xd1b9('0x39')]:_0x8741ec[_0xd1b9('0x33')];if(!_0x1c0524[_0xd1b9('0x34')]['hasOwnProperty'](_0xd1b9('0x59'))){_0x5b2feb[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0x1c0524[_0xd1b9('0x34')]['limit']);_0x5b2feb[_0xd1b9('0x1b')]=qs['offset'](_0x1c0524['query'][_0xd1b9('0x1b')]);}_0x5b2feb[_0xd1b9('0x3b')]=qs[_0xd1b9('0x3c')](_0x1c0524['query'][_0xd1b9('0x3c')]);_0x5b2feb['where']=qs[_0xd1b9('0x36')](_[_0xd1b9('0x5b')](_0x1c0524[_0xd1b9('0x34')],_0x8741ec[_0xd1b9('0x36')]));_0x5b2feb['where'][_0xd1b9('0x5a')]=_0x472f6b['id'];if(_0x1c0524[_0xd1b9('0x34')]['filter']){_0x5b2feb[_0xd1b9('0x3d')]=_[_0xd1b9('0x3e')](_0x5b2feb[_0xd1b9('0x3d')],{'$or':_[_0xd1b9('0x2e')](_0x5b2feb[_0xd1b9('0x39')],function(_0x26bfd7){var _0x28be4d={};_0x28be4d[_0x26bfd7]={'$like':'%'+_0x1c0524[_0xd1b9('0x34')][_0xd1b9('0x3f')]+'%'};return _0x28be4d;})});}_0x5b2feb=_['merge']({},_0x5b2feb,_0x1c0524['options']);return db['CmHopperHistory'][_0xd1b9('0x1e')]({'where':_0x5b2feb[_0xd1b9('0x3d')]})['then'](function(_0x41f14a){_0xce2a11[_0xd1b9('0x1e')]=_0x41f14a;if(_0x1c0524[_0xd1b9('0x34')]['includeAll']){_0x5b2feb['include']=[{'all':!![]}];}return db[_0xd1b9('0x5c')][_0xd1b9('0x42')](_0x5b2feb);})['then'](function(_0x406eab){_0xce2a11[_0xd1b9('0x43')]=_0x406eab;return _0xce2a11;});}})[_0xd1b9('0x23')](respondWithFilteredResult(_0x2d4227,_0x5b2feb))[_0xd1b9('0x44')](handleError(_0x2d4227,null));};exports[_0xd1b9('0x5d')]=function(_0x57f0c4,_0x1ee1b2,_0x3c9bc9){var _0x38c77b={'raw':!![],'where':{}};var _0x11a7bd={};var _0x5abedc={'count':0x0,'rows':[]};return db[_0xd1b9('0x2f')][_0xd1b9('0x5e')]({'where':{'id':_0x57f0c4[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x1ee1b2,null))[_0xd1b9('0x23')](function(_0x4b686d){if(_0x4b686d){_0x11a7bd['model']=_[_0xd1b9('0x35')](db['CmHopperFinal']['rawAttributes']);_0x11a7bd[_0xd1b9('0x34')]=_[_0xd1b9('0x35')](_0x57f0c4[_0xd1b9('0x34')]);_0x11a7bd[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x11a7bd[_0xd1b9('0x33')],_0x11a7bd['query']);_0x38c77b[_0xd1b9('0x39')]=_[_0xd1b9('0x37')](_0x11a7bd['model'],qs[_0xd1b9('0x38')](_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x38')]));_0x38c77b[_0xd1b9('0x39')]=_0x38c77b[_0xd1b9('0x39')][_0xd1b9('0x46')]?_0x38c77b[_0xd1b9('0x39')]:_0x11a7bd[_0xd1b9('0x33')];if(!_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x3a')](_0xd1b9('0x59'))){_0x38c77b[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x1d')]);_0x38c77b[_0xd1b9('0x1b')]=qs[_0xd1b9('0x1b')](_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x1b')]);}_0x38c77b[_0xd1b9('0x3b')]=qs[_0xd1b9('0x3c')](_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x3c')]);_0x38c77b['where']=qs[_0xd1b9('0x36')](_['pick'](_0x57f0c4['query'],_0x11a7bd[_0xd1b9('0x36')]));_0x38c77b[_0xd1b9('0x3d')][_0xd1b9('0x5a')]=_0x4b686d['id'];if(_0x57f0c4[_0xd1b9('0x34')]['filter']){_0x38c77b[_0xd1b9('0x3d')]=_['merge'](_0x38c77b[_0xd1b9('0x3d')],{'$or':_[_0xd1b9('0x2e')](_0x38c77b[_0xd1b9('0x39')],function(_0xc5f975){var _0x27e1fb={};_0x27e1fb[_0xc5f975]={'$like':'%'+_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x3f')]+'%'};return _0x27e1fb;})});}_0x38c77b=_['merge']({},_0x38c77b,_0x57f0c4[_0xd1b9('0x47')]);return db[_0xd1b9('0x5f')]['count']({'where':_0x38c77b[_0xd1b9('0x3d')]})[_0xd1b9('0x23')](function(_0x3c2f6b){_0x5abedc['count']=_0x3c2f6b;if(_0x57f0c4[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0x38c77b[_0xd1b9('0x41')]=[{'all':!![]}];}return db[_0xd1b9('0x5f')][_0xd1b9('0x42')](_0x38c77b);})[_0xd1b9('0x23')](function(_0x5a47ba){_0x5abedc['rows']=_0x5a47ba;return _0x5abedc;});}})['then'](respondWithFilteredResult(_0x1ee1b2,_0x38c77b))[_0xd1b9('0x44')](handleError(_0x1ee1b2,null));};exports['getHopperBlacks']=function(_0x3e6013,_0x5a7d48,_0x132d55){var _0x357723={'raw':!![],'where':{}};var _0x7ec4a8={};var _0xd31ff5={'count':0x0,'rows':[]};return db[_0xd1b9('0x2f')][_0xd1b9('0x5e')]({'where':{'id':_0x3e6013[_0xd1b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a7d48,null))[_0xd1b9('0x23')](function(_0x2b9a21){if(_0x2b9a21){_0x7ec4a8['model']=_['keys'](db[_0xd1b9('0x60')][_0xd1b9('0x30')]);_0x7ec4a8[_0xd1b9('0x34')]=_['keys'](_0x3e6013[_0xd1b9('0x34')]);_0x7ec4a8[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x7ec4a8[_0xd1b9('0x33')],_0x7ec4a8[_0xd1b9('0x34')]);_0x357723['attributes']=_['intersection'](_0x7ec4a8['model'],qs[_0xd1b9('0x38')](_0x3e6013['query'][_0xd1b9('0x38')]));_0x357723[_0xd1b9('0x39')]=_0x357723[_0xd1b9('0x39')][_0xd1b9('0x46')]?_0x357723[_0xd1b9('0x39')]:_0x7ec4a8[_0xd1b9('0x33')];if(!_0x3e6013[_0xd1b9('0x34')][_0xd1b9('0x3a')](_0xd1b9('0x59'))){_0x357723['limit']=qs['limit'](_0x3e6013[_0xd1b9('0x34')][_0xd1b9('0x1d')]);_0x357723['offset']=qs[_0xd1b9('0x1b')](_0x3e6013['query']['offset']);}_0x357723[_0xd1b9('0x3b')]=qs['sort'](_0x3e6013['query'][_0xd1b9('0x3c')]);_0x357723['where']=qs[_0xd1b9('0x36')](_[_0xd1b9('0x5b')](_0x3e6013[_0xd1b9('0x34')],_0x7ec4a8[_0xd1b9('0x36')]));_0x357723[_0xd1b9('0x3d')][_0xd1b9('0x5a')]=_0x2b9a21['id'];if(_0x3e6013[_0xd1b9('0x34')][_0xd1b9('0x3f')]){_0x357723[_0xd1b9('0x3d')]=_[_0xd1b9('0x3e')](_0x357723['where'],{'$or':_[_0xd1b9('0x2e')](_0x357723[_0xd1b9('0x39')],function(_0x1ccfa1){var _0x16c215={};_0x16c215[_0x1ccfa1]={'$like':'%'+_0x3e6013['query'][_0xd1b9('0x3f')]+'%'};return _0x16c215;})});}_0x357723=_[_0xd1b9('0x3e')]({},_0x357723,_0x3e6013['options']);return db[_0xd1b9('0x60')][_0xd1b9('0x1e')]({'where':_0x357723[_0xd1b9('0x3d')]})[_0xd1b9('0x23')](function(_0x685cc8){_0xd31ff5[_0xd1b9('0x1e')]=_0x685cc8;if(_0x3e6013[_0xd1b9('0x34')][_0xd1b9('0x40')]){_0x357723[_0xd1b9('0x41')]=[{'all':!![]}];}return db[_0xd1b9('0x60')][_0xd1b9('0x42')](_0x357723);})[_0xd1b9('0x23')](function(_0x4a8707){_0xd31ff5['rows']=_0x4a8707;return _0xd31ff5;});}})[_0xd1b9('0x23')](respondWithFilteredResult(_0x5a7d48,_0x357723))[_0xd1b9('0x44')](handleError(_0x5a7d48,null));};exports[_0xd1b9('0x61')]=function(_0xaed585,_0x50513c,_0x2b764d){var _0x118f4d={};var _0x2c5da5={};var _0x36765b;var _0x434c8b;return db[_0xd1b9('0x2f')]['findOne']({'where':{'id':_0xaed585[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x50513c,null))['then'](function(_0x17b15d){if(_0x17b15d){_0x36765b=_0x17b15d;_0x2c5da5[_0xd1b9('0x33')]=_[_0xd1b9('0x35')](db[_0xd1b9('0x62')][_0xd1b9('0x30')]);_0x2c5da5[_0xd1b9('0x34')]=_[_0xd1b9('0x35')](_0xaed585[_0xd1b9('0x34')]);_0x2c5da5[_0xd1b9('0x36')]=_[_0xd1b9('0x37')](_0x2c5da5['model'],_0x2c5da5[_0xd1b9('0x34')]);_0x118f4d['attributes']=_[_0xd1b9('0x37')](_0x2c5da5[_0xd1b9('0x33')],qs[_0xd1b9('0x38')](_0xaed585['query'][_0xd1b9('0x38')]));_0x118f4d[_0xd1b9('0x39')]=_0x118f4d['attributes']['length']?_0x118f4d[_0xd1b9('0x39')]:_0x2c5da5[_0xd1b9('0x33')];_0x118f4d[_0xd1b9('0x3b')]=qs[_0xd1b9('0x3c')](_0xaed585['query'][_0xd1b9('0x3c')]);_0x118f4d['where']=qs[_0xd1b9('0x36')](_[_0xd1b9('0x5b')](_0xaed585[_0xd1b9('0x34')],_0x2c5da5[_0xd1b9('0x36')]));if(_0xaed585[_0xd1b9('0x34')][_0xd1b9('0x3f')]){_0x118f4d[_0xd1b9('0x3d')]=_['merge'](_0x118f4d[_0xd1b9('0x3d')],{'$or':_[_0xd1b9('0x2e')](_0x118f4d[_0xd1b9('0x39')],function(_0x54c0bb){var _0x367d64={};_0x367d64[_0x54c0bb]={'$like':'%'+_0xaed585[_0xd1b9('0x34')][_0xd1b9('0x3f')]+'%'};return _0x367d64;})});}_0x118f4d=_[_0xd1b9('0x3e')]({},_0x118f4d,_0xaed585['options']);return _0x36765b['getLists'](_0x118f4d);}})[_0xd1b9('0x23')](function(_0x5615cb){if(_0x5615cb){_0x434c8b=_0x5615cb[_0xd1b9('0x46')];if(!_0xaed585[_0xd1b9('0x34')]['hasOwnProperty'](_0xd1b9('0x59'))){_0x118f4d[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0xaed585['query'][_0xd1b9('0x1d')]);_0x118f4d[_0xd1b9('0x1b')]=qs['offset'](_0xaed585[_0xd1b9('0x34')][_0xd1b9('0x1b')]);}return _0x36765b[_0xd1b9('0x61')](_0x118f4d);}})[_0xd1b9('0x23')](function(_0x2d4a88){if(_0x2d4a88){return _0x2d4a88?{'count':_0x434c8b,'rows':_0x2d4a88}:null;}})[_0xd1b9('0x23')](respondWithResult(_0x50513c,null))[_0xd1b9('0x44')](handleError(_0x50513c,null));};exports[_0xd1b9('0x63')]=function(_0x940bed,_0x39b0da,_0x28ae7f){var _0x2e157a,_0x2ff94d;return db[_0xd1b9('0x2f')][_0xd1b9('0x48')]({'where':{'id':_0x940bed[_0xd1b9('0x52')]['id']}})['then'](handleEntityNotFound(_0x39b0da,null))[_0xd1b9('0x23')](function(_0x51d9b7){if(_0x51d9b7){_0x2ff94d=_0x51d9b7;return _0x51d9b7[_0xd1b9('0x63')](_0x940bed[_0xd1b9('0x4a')][_0xd1b9('0x64')],_[_0xd1b9('0x53')](_0x940bed[_0xd1b9('0x4a')],[_0xd1b9('0x64'),'id'])||{});}return null;})['spread'](function(_0x58ba4e){var _0x995da;_0x2e157a=_0x58ba4e||[];var _0x46a137=[];if(_0x58ba4e){for(var _0x219778=0x0;_0x219778<_0x58ba4e['length'];_0x219778+=0x1){var _0x460954=_0x58ba4e[_0x219778][_0xd1b9('0x25')]({'plain':!![]});_0x2ff94d[_0xd1b9('0x65')]=_0x940bed[_0xd1b9('0x4a')]['dialCheckDuplicateType']?_0x940bed['body'][_0xd1b9('0x65')]:_0x2ff94d[_0xd1b9('0x65')];switch(_0x2ff94d[_0xd1b9('0x65')]){case'always':_0x995da=squel[_0xd1b9('0x66')]()['into']('cm_hopper')['fromQuery'](['phone',_0xd1b9('0x67'),_0xd1b9('0x68'),_0xd1b9('0x69'),'CampaignId','createdAt',_0xd1b9('0x55')],squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')](_0xd1b9('0x6c'),_0xd1b9('0x6c'))['field'](_0xd1b9('0x6d'),_0xd1b9('0x67'))[_0xd1b9('0x6b')]('id',_0xd1b9('0x68'))[_0xd1b9('0x6b')](_0x460954[_0xd1b9('0x6e')]['toString'](),_0xd1b9('0x69'))[_0xd1b9('0x6b')](_0x940bed[_0xd1b9('0x52')]['id'][_0xd1b9('0x6f')](),'CampaignId')['field'](_0xd1b9('0x6d'),_0xd1b9('0x54'))[_0xd1b9('0x6b')]('NOW()','updatedAt')[_0xd1b9('0x70')](_0xd1b9('0x71'))[_0xd1b9('0x3d')](_0xd1b9('0x72'))[_0xd1b9('0x3d')]('ListId\x20=\x20?',_0x460954[_0xd1b9('0x6e')][_0xd1b9('0x6f')]())[_0xd1b9('0x3d')](_0xd1b9('0x73'))['where'](_0xd1b9('0x74'),squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xd1b9('0x70')](_0xd1b9('0x75'))[_0xd1b9('0x3d')]('CampaignId\x20=\x20?',_0x940bed['params']['id'][_0xd1b9('0x6f')]()))[_0xd1b9('0x3d')](_0xd1b9('0x74'),squel[_0xd1b9('0x6a')]()['field'](_0xd1b9('0x76'))['from'](_0xd1b9('0x77'))[_0xd1b9('0x3d')](_0xd1b9('0x78'),_0x940bed[_0xd1b9('0x52')]['id']['toString']())))[_0xd1b9('0x6f')]();break;case _0xd1b9('0x79'):_0x995da=squel[_0xd1b9('0x66')]()[_0xd1b9('0x7a')](_0xd1b9('0x77'))[_0xd1b9('0x7b')](['phone',_0xd1b9('0x67'),'ContactId',_0xd1b9('0x69'),_0xd1b9('0x5a'),'createdAt',_0xd1b9('0x55')],squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')]('phone',_0xd1b9('0x6c'))[_0xd1b9('0x6b')]('NOW()',_0xd1b9('0x67'))[_0xd1b9('0x6b')]('id',_0xd1b9('0x68'))[_0xd1b9('0x6b')](_0x460954['CmListId'][_0xd1b9('0x6f')](),_0xd1b9('0x69'))['field'](_0x940bed[_0xd1b9('0x52')]['id'][_0xd1b9('0x6f')](),'CampaignId')[_0xd1b9('0x6b')](_0xd1b9('0x6d'),'createdAt')[_0xd1b9('0x6b')](_0xd1b9('0x6d'),_0xd1b9('0x55'))[_0xd1b9('0x70')](_0xd1b9('0x71'))['where'](_0xd1b9('0x72'))[_0xd1b9('0x3d')](_0xd1b9('0x7c'),_0x460954[_0xd1b9('0x6e')][_0xd1b9('0x6f')]())[_0xd1b9('0x3d')](_0xd1b9('0x73'))[_0xd1b9('0x3d')](_0xd1b9('0x74'),squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')](_0xd1b9('0x76'))[_0xd1b9('0x70')](_0xd1b9('0x77'))['where'](_0xd1b9('0x78'),_0x940bed[_0xd1b9('0x52')]['id']['toString']())))['toString']();break;default:_0x995da=squel[_0xd1b9('0x66')]()[_0xd1b9('0x7a')]('cm_hopper')[_0xd1b9('0x7b')]([_0xd1b9('0x6c'),_0xd1b9('0x67'),_0xd1b9('0x68'),_0xd1b9('0x69'),_0xd1b9('0x5a'),_0xd1b9('0x54'),_0xd1b9('0x55')],squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')](_0xd1b9('0x6c'),'phone')['field'](_0xd1b9('0x6d'),_0xd1b9('0x67'))['field']('id',_0xd1b9('0x68'))[_0xd1b9('0x6b')](_0x460954[_0xd1b9('0x6e')][_0xd1b9('0x6f')](),'ListId')[_0xd1b9('0x6b')](_0x940bed[_0xd1b9('0x52')]['id'][_0xd1b9('0x6f')](),_0xd1b9('0x5a'))[_0xd1b9('0x6b')](_0xd1b9('0x6d'),_0xd1b9('0x54'))[_0xd1b9('0x6b')]('NOW()',_0xd1b9('0x55'))[_0xd1b9('0x70')](_0xd1b9('0x71'))[_0xd1b9('0x3d')](_0xd1b9('0x72'))['where'](_0xd1b9('0x7c'),_0x460954[_0xd1b9('0x6e')][_0xd1b9('0x6f')]())[_0xd1b9('0x3d')](_0xd1b9('0x73')))[_0xd1b9('0x6f')]();}_0x46a137['push'](db[_0xd1b9('0x7d')][_0xd1b9('0x34')](_0x995da));}return BPromise[_0xd1b9('0x7e')](_0x46a137);}})['then'](function(){return _0x2e157a;})['then'](respondWithResult(_0x39b0da,null))['catch'](handleError(_0x39b0da,null));};exports[_0xd1b9('0x7f')]=function(_0x4bd93a,_0x11c486,_0x3dc56a){return db['Campaign'][_0xd1b9('0x48')]({'where':{'id':_0x4bd93a[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x11c486,null))[_0xd1b9('0x23')](function(_0x510095){if(_0x510095){return _0x510095['removeLists'](_0x4bd93a['query']['ids']);}})['then'](function(_0x449103){if(_0x449103){return db['CmHopper'][_0xd1b9('0x24')]({'where':{'ListId':_0x4bd93a['query'][_0xd1b9('0x64')],'CampaignId':_0x4bd93a['params']['id']}})[_0xd1b9('0x23')](function(){return _0x449103;});}})[_0xd1b9('0x23')](respondWithStatusCode(_0x11c486,null))[_0xd1b9('0x44')](handleError(_0x11c486,null));};exports['getBlackLists']=function(_0x2ce917,_0x23fff4,_0xdc815c){var _0x2d5a91={};var _0x4f7e39={};var _0x3dc705;var _0x347089;return db[_0xd1b9('0x2f')][_0xd1b9('0x5e')]({'where':{'id':_0x2ce917[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x23fff4,null))[_0xd1b9('0x23')](function(_0x53804a){if(_0x53804a){_0x3dc705=_0x53804a;_0x4f7e39[_0xd1b9('0x33')]=_[_0xd1b9('0x35')](db[_0xd1b9('0x62')][_0xd1b9('0x30')]);_0x4f7e39[_0xd1b9('0x34')]=_[_0xd1b9('0x35')](_0x2ce917['query']);_0x4f7e39['filters']=_[_0xd1b9('0x37')](_0x4f7e39['model'],_0x4f7e39[_0xd1b9('0x34')]);_0x2d5a91[_0xd1b9('0x39')]=_['intersection'](_0x4f7e39[_0xd1b9('0x33')],qs['fields'](_0x2ce917[_0xd1b9('0x34')][_0xd1b9('0x38')]));_0x2d5a91[_0xd1b9('0x39')]=_0x2d5a91['attributes'][_0xd1b9('0x46')]?_0x2d5a91[_0xd1b9('0x39')]:_0x4f7e39[_0xd1b9('0x33')];_0x2d5a91[_0xd1b9('0x3b')]=qs[_0xd1b9('0x3c')](_0x2ce917[_0xd1b9('0x34')][_0xd1b9('0x3c')]);_0x2d5a91[_0xd1b9('0x3d')]=qs['filters'](_['pick'](_0x2ce917[_0xd1b9('0x34')],_0x4f7e39['filters']));if(_0x2ce917['query']['filter']){_0x2d5a91[_0xd1b9('0x3d')]=_[_0xd1b9('0x3e')](_0x2d5a91[_0xd1b9('0x3d')],{'$or':_['map'](_0x2d5a91[_0xd1b9('0x39')],function(_0x1bbf01){var _0x19dc2e={};_0x19dc2e[_0x1bbf01]={'$like':'%'+_0x2ce917[_0xd1b9('0x34')]['filter']+'%'};return _0x19dc2e;})});}_0x2d5a91=_[_0xd1b9('0x3e')]({},_0x2d5a91,_0x2ce917[_0xd1b9('0x47')]);return _0x3dc705[_0xd1b9('0x80')](_0x2d5a91);}})['then'](function(_0x43235a){if(_0x43235a){_0x347089=_0x43235a[_0xd1b9('0x46')];if(!_0x2ce917[_0xd1b9('0x34')][_0xd1b9('0x3a')](_0xd1b9('0x59'))){_0x2d5a91[_0xd1b9('0x1d')]=qs[_0xd1b9('0x1d')](_0x2ce917[_0xd1b9('0x34')]['limit']);_0x2d5a91[_0xd1b9('0x1b')]=qs[_0xd1b9('0x1b')](_0x2ce917[_0xd1b9('0x34')]['offset']);}return _0x3dc705[_0xd1b9('0x80')](_0x2d5a91);}})['then'](function(_0x1827e2){if(_0x1827e2){return _0x1827e2?{'count':_0x347089,'rows':_0x1827e2}:null;}})[_0xd1b9('0x23')](respondWithResult(_0x23fff4,null))[_0xd1b9('0x44')](handleError(_0x23fff4,null));};exports['addBlackLists']=function(_0x3f536d,_0x55ecff,_0x520120){var _0x1f92b1,_0x3ac1e6;return db[_0xd1b9('0x2f')][_0xd1b9('0x48')]({'where':{'id':_0x3f536d[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x55ecff,null))[_0xd1b9('0x23')](function(_0x2fa408){if(_0x2fa408){_0x3ac1e6=_0x2fa408;return _0x2fa408[_0xd1b9('0x81')](_0x3f536d[_0xd1b9('0x4a')]['ids'],_['omit'](_0x3f536d[_0xd1b9('0x4a')],[_0xd1b9('0x64'),'id'])||{});}return null;})['spread'](function(_0x49ddef){var _0x59faa2;_0x1f92b1=_0x49ddef||[];var _0x5e6119=[];if(_0x49ddef){for(var _0x2b56f2=0x0;_0x2b56f2<_0x49ddef[_0xd1b9('0x46')];_0x2b56f2+=0x1){var _0x3c24a4=_0x49ddef[_0x2b56f2]['get']({'plain':!![]});_0x59faa2=squel[_0xd1b9('0x66')]()[_0xd1b9('0x7a')]('cm_hopper_black')[_0xd1b9('0x7b')]([_0xd1b9('0x6c'),_0xd1b9('0x68'),'ListId','CampaignId','createdAt',_0xd1b9('0x55')],squel[_0xd1b9('0x6a')]()[_0xd1b9('0x6b')](_0xd1b9('0x6c'),_0xd1b9('0x6c'))['field']('id',_0xd1b9('0x68'))[_0xd1b9('0x6b')](_0x3c24a4[_0xd1b9('0x6e')][_0xd1b9('0x6f')](),_0xd1b9('0x69'))[_0xd1b9('0x6b')](_0x3f536d[_0xd1b9('0x52')]['id'][_0xd1b9('0x6f')](),'CampaignId')[_0xd1b9('0x6b')](_0xd1b9('0x6d'),_0xd1b9('0x54'))[_0xd1b9('0x6b')](_0xd1b9('0x6d'),_0xd1b9('0x55'))['from']('cm_contacts')[_0xd1b9('0x3d')](_0xd1b9('0x72'))['where']('ListId\x20=\x20?',_0x3c24a4[_0xd1b9('0x6e')]['toString']())[_0xd1b9('0x3d')](_0xd1b9('0x73')))[_0xd1b9('0x6f')]();_0x5e6119[_0xd1b9('0x82')](db[_0xd1b9('0x7d')][_0xd1b9('0x34')](_0x59faa2));}return BPromise['all'](_0x5e6119);}})[_0xd1b9('0x23')](function(){return _0x1f92b1;})[_0xd1b9('0x23')](respondWithResult(_0x55ecff,null))[_0xd1b9('0x44')](handleError(_0x55ecff,null));};exports[_0xd1b9('0x83')]=function(_0x4e0138,_0x20ad62,_0x562273){return db[_0xd1b9('0x2f')]['find']({'where':{'id':_0x4e0138[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](handleEntityNotFound(_0x20ad62,null))[_0xd1b9('0x23')](function(_0x3ee062){if(_0x3ee062){return _0x3ee062[_0xd1b9('0x83')](_0x4e0138[_0xd1b9('0x34')][_0xd1b9('0x64')]);}})[_0xd1b9('0x23')](function(_0x2afff8){if(_0x2afff8){return db[_0xd1b9('0x60')][_0xd1b9('0x24')]({'where':{'ListId':_0x4e0138[_0xd1b9('0x34')][_0xd1b9('0x64')],'CampaignId':_0x4e0138[_0xd1b9('0x52')]['id']}})[_0xd1b9('0x23')](function(){return _0x2afff8;});}})[_0xd1b9('0x23')](respondWithStatusCode(_0x20ad62,null))['catch'](handleError(_0x20ad62,null));}; \ No newline at end of file +var _0x091c=['sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','IvrCampaigns','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Campaign','includeAll','include','rows','catch','show','params','keys','find','create','body','user','get','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','update','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','scheduledAt','toString','NOW()','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','all','removeBlackLists','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x091c,0x108));var _0xc091=function(_0x107d3a,_0x3ca698){_0x107d3a=_0x107d3a-0x0;var _0x10b64e=_0x091c[_0x107d3a];return _0x10b64e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc091('0x0'));var jsonpatch=require(_0xc091('0x1'));var rp=require('request-promise');var moment=require(_0xc091('0x2'));var BPromise=require(_0xc091('0x3'));var Mustache=require(_0xc091('0x4'));var util=require(_0xc091('0x5'));var path=require('path');var sox=require(_0xc091('0x6'));var csv=require(_0xc091('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc091('0x8'));var _=require(_0xc091('0x9'));var squel=require(_0xc091('0xa'));var crypto=require(_0xc091('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc091('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc091('0xd'));var Papa=require(_0xc091('0xe'));var Redis=require('ioredis');var authService=require(_0xc091('0xf'));var qs=require(_0xc091('0x10'));var as=require(_0xc091('0x11'));var hardwareService=require(_0xc091('0x12'));var logger=require('../../config/logger')(_0xc091('0x13'));var utils=require(_0xc091('0x14'));var config=require(_0xc091('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc091('0x16'))['db'];function respondWithStatusCode(_0x469709,_0xc7b2db){_0xc7b2db=_0xc7b2db||0xcc;return function(_0x35078a){if(_0x35078a){return _0x469709[_0xc091('0x17')](_0xc7b2db);}return _0x469709[_0xc091('0x18')](_0xc7b2db)['end']();};}function respondWithResult(_0x306da4,_0x445939){_0x445939=_0x445939||0xc8;return function(_0x49cc4f){if(_0x49cc4f){return _0x306da4['status'](_0x445939)[_0xc091('0x19')](_0x49cc4f);}};}function respondWithFilteredResult(_0x474de6,_0x5cdf7b){return function(_0x283ee2){if(_0x283ee2){var _0x1e975e=typeof _0x5cdf7b[_0xc091('0x1a')]==='undefined'&&typeof _0x5cdf7b[_0xc091('0x1b')]===_0xc091('0x1c');var _0x5029fe=_0x283ee2[_0xc091('0x1d')];var _0x501351=_0x1e975e?0x0:_0x5cdf7b['offset'];var _0x18e84d=_0x1e975e?_0x283ee2[_0xc091('0x1d')]:_0x5cdf7b[_0xc091('0x1a')]+_0x5cdf7b[_0xc091('0x1b')];var _0x4d969e;if(_0x18e84d>=_0x5029fe){_0x18e84d=_0x5029fe;_0x4d969e=0xc8;}else{_0x4d969e=0xce;}_0x474de6[_0xc091('0x18')](_0x4d969e);return _0x474de6[_0xc091('0x1e')](_0xc091('0x1f'),_0x501351+'-'+_0x18e84d+'/'+_0x5029fe)[_0xc091('0x19')](_0x283ee2);}return null;};}function patchUpdates(_0xd3790d){return function(_0x33b928){try{jsonpatch[_0xc091('0x20')](_0x33b928,_0xd3790d,!![]);}catch(_0x24c8d1){return BPromise[_0xc091('0x21')](_0x24c8d1);}return _0x33b928['save']();};}function saveUpdates(_0x1dd5dc,_0x5e34fe){return function(_0x248fcc){if(_0x248fcc){return _0x248fcc['update'](_0x1dd5dc)[_0xc091('0x22')](function(_0x39573a){return _0x39573a;});}return null;};}function removeEntity(_0x1e5645,_0x2ca666){return function(_0x14560a){if(_0x14560a){return _0x14560a[_0xc091('0x23')]()[_0xc091('0x22')](function(){var _0x59279a=_0x14560a['get']({'plain':!![]});var _0x4d70cd=_0xc091('0x24');return db[_0xc091('0x25')]['destroy']({'where':{'type':_0x4d70cd,'resourceId':_0x59279a['id']}})['then'](function(){return _0x14560a;});})[_0xc091('0x22')](function(){_0x1e5645[_0xc091('0x18')](0xcc)[_0xc091('0x26')]();});}};}function handleEntityNotFound(_0x25afed,_0x3e6472){return function(_0x24a029){if(!_0x24a029){_0x25afed[_0xc091('0x17')](0x194);}return _0x24a029;};}function handleError(_0x4dde32,_0x112a59){_0x112a59=_0x112a59||0x1f4;return function(_0x14211c){logger[_0xc091('0x27')](_0x14211c['stack']);if(_0x14211c[_0xc091('0x28')]){delete _0x14211c[_0xc091('0x28')];}_0x4dde32[_0xc091('0x18')](_0x112a59)[_0xc091('0x29')](_0x14211c);};}exports['index']=function(_0x1186f4,_0x458465){var _0x3cd5e={},_0x10fd79={},_0x551e62={'count':0x0,'rows':[]};var _0x420451=_[_0xc091('0x2a')](db['Campaign'][_0xc091('0x2b')],function(_0xd0d537){return{'name':_0xd0d537[_0xc091('0x2c')],'type':_0xd0d537[_0xc091('0x2d')][_0xc091('0x2e')]};});_0x10fd79[_0xc091('0x2f')]=_['map'](_0x420451,_0xc091('0x28'));_0x10fd79[_0xc091('0x30')]=_['keys'](_0x1186f4[_0xc091('0x30')]);_0x10fd79[_0xc091('0x31')]=_[_0xc091('0x32')](_0x10fd79[_0xc091('0x2f')],_0x10fd79[_0xc091('0x30')]);_0x3cd5e[_0xc091('0x33')]=_[_0xc091('0x32')](_0x10fd79[_0xc091('0x2f')],qs['fields'](_0x1186f4['query'][_0xc091('0x34')]));_0x3cd5e[_0xc091('0x33')]=_0x3cd5e['attributes'][_0xc091('0x35')]?_0x3cd5e['attributes']:_0x10fd79[_0xc091('0x2f')];if(!_0x1186f4[_0xc091('0x30')][_0xc091('0x36')](_0xc091('0x37'))){_0x3cd5e[_0xc091('0x1b')]=qs['limit'](_0x1186f4[_0xc091('0x30')][_0xc091('0x1b')]);_0x3cd5e[_0xc091('0x1a')]=qs[_0xc091('0x1a')](_0x1186f4[_0xc091('0x30')]['offset']);}_0x3cd5e[_0xc091('0x38')]=qs[_0xc091('0x39')](_0x1186f4[_0xc091('0x30')][_0xc091('0x39')]);_0x3cd5e[_0xc091('0x3a')]=qs[_0xc091('0x31')](_[_0xc091('0x3b')](_0x1186f4['query'],_0x10fd79['filters']),_0x420451);if(_0x1186f4['query'][_0xc091('0x3c')]){_0x3cd5e['where']=_[_0xc091('0x3d')](_0x3cd5e[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x420451,function(_0x5f5ca4){if(_0x5f5ca4[_0xc091('0x2d')]!=='VIRTUAL'){var _0x43d1dc={};_0x43d1dc[_0x5f5ca4['name']]={'$like':'%'+_0x1186f4[_0xc091('0x30')][_0xc091('0x3c')]+'%'};return _0x43d1dc;}})});}_0x3cd5e=_[_0xc091('0x3d')]({},_0x3cd5e,_0x1186f4[_0xc091('0x3e')]);var _0x50e8bd={'where':_0x3cd5e['where']};return db[_0xc091('0x3f')][_0xc091('0x1d')](_0x50e8bd)[_0xc091('0x22')](function(_0x1683b2){_0x551e62[_0xc091('0x1d')]=_0x1683b2;if(_0x1186f4[_0xc091('0x30')][_0xc091('0x40')]){_0x3cd5e[_0xc091('0x41')]=[{'all':!![]}];}return db[_0xc091('0x3f')]['findAll'](_0x3cd5e);})[_0xc091('0x22')](function(_0x3bcd33){_0x551e62[_0xc091('0x42')]=_0x3bcd33;return _0x551e62;})[_0xc091('0x22')](respondWithFilteredResult(_0x458465,_0x3cd5e))[_0xc091('0x43')](handleError(_0x458465,null));};exports[_0xc091('0x44')]=function(_0x3e99f3,_0x14b75d){var _0xd111d9={'raw':![],'where':{'id':_0x3e99f3[_0xc091('0x45')]['id']}},_0x2c224e={};_0x2c224e[_0xc091('0x2f')]=_[_0xc091('0x46')](db['Campaign'][_0xc091('0x2b')]);_0x2c224e[_0xc091('0x30')]=_['keys'](_0x3e99f3['query']);_0x2c224e[_0xc091('0x31')]=_['intersection'](_0x2c224e[_0xc091('0x2f')],_0x2c224e['query']);_0xd111d9['attributes']=_[_0xc091('0x32')](_0x2c224e[_0xc091('0x2f')],qs['fields'](_0x3e99f3[_0xc091('0x30')][_0xc091('0x34')]));_0xd111d9['attributes']=_0xd111d9[_0xc091('0x33')]['length']?_0xd111d9[_0xc091('0x33')]:_0x2c224e[_0xc091('0x2f')];if(_0x3e99f3['query'][_0xc091('0x40')]){_0xd111d9[_0xc091('0x41')]=[{'all':!![]}];}_0xd111d9=_[_0xc091('0x3d')]({},_0xd111d9,_0x3e99f3['options']);return db[_0xc091('0x3f')][_0xc091('0x47')](_0xd111d9)[_0xc091('0x22')](handleEntityNotFound(_0x14b75d,null))[_0xc091('0x22')](respondWithResult(_0x14b75d,null))[_0xc091('0x43')](handleError(_0x14b75d,null));};exports[_0xc091('0x48')]=function(_0x263155,_0x223f7a){return db[_0xc091('0x3f')][_0xc091('0x48')](_0x263155[_0xc091('0x49')],{})['then'](function(_0x8477c1){var _0x11eeec=_0x263155[_0xc091('0x4a')][_0xc091('0x4b')]({'plain':!![]});if(!_0x11eeec)throw new Error(_0xc091('0x4c'));if(_0x11eeec[_0xc091('0x4d')]===_0xc091('0x4a')){var _0x2637b5=_0x8477c1[_0xc091('0x4b')]({'plain':!![]});var _0x120f85=_0xc091('0x24');return db[_0xc091('0x4e')][_0xc091('0x47')]({'where':{'name':_0x120f85,'userProfileId':_0x11eeec['userProfileId']},'raw':!![]})[_0xc091('0x22')](function(_0x53cbb8){if(_0x53cbb8&&_0x53cbb8[_0xc091('0x4f')]===0x0){return db[_0xc091('0x25')][_0xc091('0x48')]({'name':_0x2637b5[_0xc091('0x28')],'resourceId':_0x2637b5['id'],'type':_0x53cbb8[_0xc091('0x28')],'sectionId':_0x53cbb8['id']},{})['then'](function(){return _0x8477c1;});}else{return _0x8477c1;}})[_0xc091('0x43')](function(_0x5d07a1){logger[_0xc091('0x27')](_0xc091('0x50'),_0x5d07a1);throw _0x5d07a1;});}return _0x8477c1;})[_0xc091('0x22')](respondWithResult(_0x223f7a,0xc9))[_0xc091('0x43')](handleError(_0x223f7a,null));};exports[_0xc091('0x51')]=function(_0x56710e,_0x49f809){var _0x11e993={'where':{'id':_0x56710e[_0xc091('0x45')]['id']}},_0x4d5a03={};_0x4d5a03[_0xc091('0x2f')]=_['keys'](db[_0xc091('0x3f')][_0xc091('0x2b')]);_0x11e993[_0xc091('0x33')]=_[_0xc091('0x32')](_0x4d5a03['model'],qs['fields'](_0x56710e[_0xc091('0x30')][_0xc091('0x34')]));_0x11e993[_0xc091('0x33')]=_0x11e993['attributes'][_0xc091('0x35')]?_0x11e993[_0xc091('0x33')]:_0x4d5a03[_0xc091('0x2f')];if(_0x56710e[_0xc091('0x30')][_0xc091('0x40')]){_0x11e993[_0xc091('0x41')]=[{'all':!![]}];}_0x11e993=_['merge']({},_0x11e993,_0x56710e[_0xc091('0x3e')]);return db[_0xc091('0x3f')][_0xc091('0x47')](_0x11e993)[_0xc091('0x22')](handleEntityNotFound(_0x49f809,null))['then'](function(_0xb3b6e1){if(_0xb3b6e1){var _0x54125e=_0xb3b6e1[_0xc091('0x4b')]({'plain':!![]});_0x54125e=qs[_0xc091('0x52')](_0x54125e,['id',_0xc091('0x53'),'updatedAt']);_0x56710e[_0xc091('0x49')]=_[_0xc091('0x52')](_0x56710e[_0xc091('0x49')],['id',_0xc091('0x53'),_0xc091('0x54')]);return db[_0xc091('0x3f')][_0xc091('0x48')](_['merge'](_0x54125e,_0x56710e[_0xc091('0x49')]),{'include':_0x56710e[_0xc091('0x30')][_0xc091('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x2bad1d){var _0xe04803=_0x56710e[_0xc091('0x4a')]['get']({'plain':!![]});if(!_0xe04803)throw new Error(_0xc091('0x4c'));if(_0xe04803[_0xc091('0x4d')]==='user'){var _0x460aad=_0x2bad1d['get']({'plain':!![]});var _0x14b573='IvrCampaigns';return db[_0xc091('0x4e')]['find']({'where':{'name':_0x14b573,'userProfileId':_0xe04803[_0xc091('0x55')]},'raw':!![]})[_0xc091('0x22')](function(_0x1e6722){if(_0x1e6722&&_0x1e6722[_0xc091('0x4f')]===0x0){return db[_0xc091('0x25')][_0xc091('0x48')]({'name':_0x460aad[_0xc091('0x28')],'resourceId':_0x460aad['id'],'type':_0x1e6722[_0xc091('0x28')],'sectionId':_0x1e6722['id']},{})[_0xc091('0x22')](function(){return _0x2bad1d;});}else{return _0x2bad1d;}})[_0xc091('0x43')](function(_0x28bdf8){logger[_0xc091('0x27')](_0xc091('0x50'),_0x28bdf8);throw _0x28bdf8;});}return _0x2bad1d;});}})[_0xc091('0x22')](respondWithResult(_0x49f809,0xc9))['catch'](handleError(_0x49f809,null));};exports[_0xc091('0x56')]=function(_0x3e0344,_0x27b2cf){if(_0x3e0344['body']['id']){delete _0x3e0344[_0xc091('0x49')]['id'];}return db[_0xc091('0x3f')][_0xc091('0x47')]({'where':{'id':_0x3e0344[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x27b2cf,null))[_0xc091('0x22')](saveUpdates(_0x3e0344[_0xc091('0x49')],null))[_0xc091('0x22')](respondWithResult(_0x27b2cf,null))[_0xc091('0x43')](handleError(_0x27b2cf,null));};exports[_0xc091('0x23')]=function(_0xba8f30,_0x100767){return db[_0xc091('0x3f')][_0xc091('0x47')]({'where':{'id':_0xba8f30['params']['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x100767,null))[_0xc091('0x22')](removeEntity(_0x100767,null))[_0xc091('0x43')](handleError(_0x100767,null));};exports['getHoppers']=function(_0x4d22f0,_0x1b0a14,_0x189810){var _0x340c71={'raw':!![],'where':{}};var _0x4be1bd={};var _0x429646={'count':0x0,'rows':[]};return db[_0xc091('0x3f')][_0xc091('0x57')]({'where':{'id':_0x4d22f0[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x1b0a14,null))[_0xc091('0x22')](function(_0x22491b){if(_0x22491b){_0x4be1bd[_0xc091('0x2f')]=_[_0xc091('0x46')](db[_0xc091('0x58')][_0xc091('0x2b')]);_0x4be1bd[_0xc091('0x30')]=_[_0xc091('0x46')](_0x4d22f0[_0xc091('0x30')]);_0x4be1bd['filters']=_[_0xc091('0x32')](_0x4be1bd[_0xc091('0x2f')],_0x4be1bd[_0xc091('0x30')]);_0x340c71[_0xc091('0x33')]=_[_0xc091('0x32')](_0x4be1bd['model'],qs['fields'](_0x4d22f0['query']['fields']));_0x340c71[_0xc091('0x33')]=_0x340c71[_0xc091('0x33')][_0xc091('0x35')]?_0x340c71[_0xc091('0x33')]:_0x4be1bd['model'];if(!_0x4d22f0[_0xc091('0x30')][_0xc091('0x36')](_0xc091('0x37'))){_0x340c71['limit']=qs[_0xc091('0x1b')](_0x4d22f0[_0xc091('0x30')]['limit']);_0x340c71[_0xc091('0x1a')]=qs[_0xc091('0x1a')](_0x4d22f0['query'][_0xc091('0x1a')]);}_0x340c71[_0xc091('0x38')]=qs[_0xc091('0x39')](_0x4d22f0[_0xc091('0x30')][_0xc091('0x39')]);_0x340c71[_0xc091('0x3a')]=qs[_0xc091('0x31')](_['pick'](_0x4d22f0[_0xc091('0x30')],_0x4be1bd[_0xc091('0x31')]));_0x340c71['where'][_0xc091('0x59')]=_0x22491b['id'];if(_0x4d22f0['query'][_0xc091('0x3c')]){_0x340c71[_0xc091('0x3a')]=_['merge'](_0x340c71[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x340c71['attributes'],function(_0x5d9d30){var _0x4c1f1a={};_0x4c1f1a[_0x5d9d30]={'$like':'%'+_0x4d22f0[_0xc091('0x30')][_0xc091('0x3c')]+'%'};return _0x4c1f1a;})});}_0x340c71=_['merge']({},_0x340c71,_0x4d22f0['options']);return db[_0xc091('0x58')][_0xc091('0x1d')]({'where':_0x340c71[_0xc091('0x3a')]})[_0xc091('0x22')](function(_0x1c9ecc){_0x429646['count']=_0x1c9ecc;if(_0x4d22f0[_0xc091('0x30')][_0xc091('0x40')]){_0x340c71['include']=[{'all':!![]}];}return db[_0xc091('0x58')][_0xc091('0x5a')](_0x340c71);})[_0xc091('0x22')](function(_0x10db70){_0x429646[_0xc091('0x42')]=_0x10db70;return _0x429646;});}})['then'](respondWithFilteredResult(_0x1b0a14,_0x340c71))[_0xc091('0x43')](handleError(_0x1b0a14,null));};exports[_0xc091('0x5b')]=function(_0x234de3,_0x55fc9b,_0x452a82){var _0x4321f3={'raw':!![],'where':{}};var _0x321149={};var _0x9dd7c4={'count':0x0,'rows':[]};return db[_0xc091('0x3f')][_0xc091('0x57')]({'where':{'id':_0x234de3['params']['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x55fc9b,null))['then'](function(_0x174030){if(_0x174030){_0x321149[_0xc091('0x2f')]=_[_0xc091('0x46')](db[_0xc091('0x5c')][_0xc091('0x2b')]);_0x321149[_0xc091('0x30')]=_[_0xc091('0x46')](_0x234de3[_0xc091('0x30')]);_0x321149[_0xc091('0x31')]=_[_0xc091('0x32')](_0x321149[_0xc091('0x2f')],_0x321149[_0xc091('0x30')]);_0x4321f3[_0xc091('0x33')]=_[_0xc091('0x32')](_0x321149[_0xc091('0x2f')],qs[_0xc091('0x34')](_0x234de3[_0xc091('0x30')][_0xc091('0x34')]));_0x4321f3[_0xc091('0x33')]=_0x4321f3[_0xc091('0x33')][_0xc091('0x35')]?_0x4321f3[_0xc091('0x33')]:_0x321149[_0xc091('0x2f')];if(!_0x234de3[_0xc091('0x30')]['hasOwnProperty'](_0xc091('0x37'))){_0x4321f3['limit']=qs[_0xc091('0x1b')](_0x234de3['query'][_0xc091('0x1b')]);_0x4321f3['offset']=qs[_0xc091('0x1a')](_0x234de3[_0xc091('0x30')][_0xc091('0x1a')]);}_0x4321f3['order']=qs[_0xc091('0x39')](_0x234de3['query'][_0xc091('0x39')]);_0x4321f3[_0xc091('0x3a')]=qs[_0xc091('0x31')](_[_0xc091('0x3b')](_0x234de3['query'],_0x321149[_0xc091('0x31')]));_0x4321f3[_0xc091('0x3a')][_0xc091('0x59')]=_0x174030['id'];if(_0x234de3['query'][_0xc091('0x3c')]){_0x4321f3[_0xc091('0x3a')]=_['merge'](_0x4321f3[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x4321f3[_0xc091('0x33')],function(_0x519502){var _0x32dbc9={};_0x32dbc9[_0x519502]={'$like':'%'+_0x234de3[_0xc091('0x30')][_0xc091('0x3c')]+'%'};return _0x32dbc9;})});}_0x4321f3=_[_0xc091('0x3d')]({},_0x4321f3,_0x234de3[_0xc091('0x3e')]);return db['CmHopperHistory']['count']({'where':_0x4321f3[_0xc091('0x3a')]})[_0xc091('0x22')](function(_0x56af27){_0x9dd7c4['count']=_0x56af27;if(_0x234de3['query'][_0xc091('0x40')]){_0x4321f3[_0xc091('0x41')]=[{'all':!![]}];}return db[_0xc091('0x5c')][_0xc091('0x5a')](_0x4321f3);})[_0xc091('0x22')](function(_0x5b3877){_0x9dd7c4[_0xc091('0x42')]=_0x5b3877;return _0x9dd7c4;});}})[_0xc091('0x22')](respondWithFilteredResult(_0x55fc9b,_0x4321f3))[_0xc091('0x43')](handleError(_0x55fc9b,null));};exports['getHopperFinals']=function(_0x3566a7,_0x82681,_0x850995){var _0x18edf2={'raw':!![],'where':{}};var _0x316878={};var _0x49e5e8={'count':0x0,'rows':[]};return db[_0xc091('0x3f')][_0xc091('0x57')]({'where':{'id':_0x3566a7['params']['id']}})['then'](handleEntityNotFound(_0x82681,null))[_0xc091('0x22')](function(_0x280e31){if(_0x280e31){_0x316878['model']=_['keys'](db[_0xc091('0x5d')][_0xc091('0x2b')]);_0x316878[_0xc091('0x30')]=_[_0xc091('0x46')](_0x3566a7[_0xc091('0x30')]);_0x316878[_0xc091('0x31')]=_['intersection'](_0x316878['model'],_0x316878[_0xc091('0x30')]);_0x18edf2[_0xc091('0x33')]=_['intersection'](_0x316878[_0xc091('0x2f')],qs[_0xc091('0x34')](_0x3566a7[_0xc091('0x30')][_0xc091('0x34')]));_0x18edf2[_0xc091('0x33')]=_0x18edf2[_0xc091('0x33')]['length']?_0x18edf2[_0xc091('0x33')]:_0x316878['model'];if(!_0x3566a7['query']['hasOwnProperty'](_0xc091('0x37'))){_0x18edf2['limit']=qs[_0xc091('0x1b')](_0x3566a7[_0xc091('0x30')][_0xc091('0x1b')]);_0x18edf2['offset']=qs[_0xc091('0x1a')](_0x3566a7[_0xc091('0x30')]['offset']);}_0x18edf2[_0xc091('0x38')]=qs[_0xc091('0x39')](_0x3566a7[_0xc091('0x30')]['sort']);_0x18edf2[_0xc091('0x3a')]=qs[_0xc091('0x31')](_[_0xc091('0x3b')](_0x3566a7[_0xc091('0x30')],_0x316878['filters']));_0x18edf2[_0xc091('0x3a')]['CampaignId']=_0x280e31['id'];if(_0x3566a7['query'][_0xc091('0x3c')]){_0x18edf2[_0xc091('0x3a')]=_[_0xc091('0x3d')](_0x18edf2[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x18edf2[_0xc091('0x33')],function(_0x1adb24){var _0x53db62={};_0x53db62[_0x1adb24]={'$like':'%'+_0x3566a7[_0xc091('0x30')][_0xc091('0x3c')]+'%'};return _0x53db62;})});}_0x18edf2=_[_0xc091('0x3d')]({},_0x18edf2,_0x3566a7[_0xc091('0x3e')]);return db[_0xc091('0x5d')][_0xc091('0x1d')]({'where':_0x18edf2[_0xc091('0x3a')]})['then'](function(_0xc1f197){_0x49e5e8[_0xc091('0x1d')]=_0xc1f197;if(_0x3566a7[_0xc091('0x30')][_0xc091('0x40')]){_0x18edf2[_0xc091('0x41')]=[{'all':!![]}];}return db[_0xc091('0x5d')]['findAll'](_0x18edf2);})[_0xc091('0x22')](function(_0x275560){_0x49e5e8['rows']=_0x275560;return _0x49e5e8;});}})[_0xc091('0x22')](respondWithFilteredResult(_0x82681,_0x18edf2))['catch'](handleError(_0x82681,null));};exports[_0xc091('0x5e')]=function(_0x210227,_0x5e692a,_0x551cab){var _0x972111={'raw':!![],'where':{}};var _0x3e17aa={};var _0x23207d={'count':0x0,'rows':[]};return db['Campaign'][_0xc091('0x57')]({'where':{'id':_0x210227[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x5e692a,null))[_0xc091('0x22')](function(_0x371494){if(_0x371494){_0x3e17aa[_0xc091('0x2f')]=_['keys'](db[_0xc091('0x5f')][_0xc091('0x2b')]);_0x3e17aa[_0xc091('0x30')]=_[_0xc091('0x46')](_0x210227[_0xc091('0x30')]);_0x3e17aa[_0xc091('0x31')]=_[_0xc091('0x32')](_0x3e17aa[_0xc091('0x2f')],_0x3e17aa[_0xc091('0x30')]);_0x972111[_0xc091('0x33')]=_['intersection'](_0x3e17aa[_0xc091('0x2f')],qs['fields'](_0x210227[_0xc091('0x30')][_0xc091('0x34')]));_0x972111['attributes']=_0x972111[_0xc091('0x33')][_0xc091('0x35')]?_0x972111['attributes']:_0x3e17aa[_0xc091('0x2f')];if(!_0x210227[_0xc091('0x30')][_0xc091('0x36')]('nolimit')){_0x972111[_0xc091('0x1b')]=qs['limit'](_0x210227[_0xc091('0x30')][_0xc091('0x1b')]);_0x972111[_0xc091('0x1a')]=qs[_0xc091('0x1a')](_0x210227[_0xc091('0x30')][_0xc091('0x1a')]);}_0x972111[_0xc091('0x38')]=qs[_0xc091('0x39')](_0x210227[_0xc091('0x30')][_0xc091('0x39')]);_0x972111[_0xc091('0x3a')]=qs['filters'](_[_0xc091('0x3b')](_0x210227['query'],_0x3e17aa['filters']));_0x972111[_0xc091('0x3a')][_0xc091('0x59')]=_0x371494['id'];if(_0x210227[_0xc091('0x30')][_0xc091('0x3c')]){_0x972111[_0xc091('0x3a')]=_['merge'](_0x972111[_0xc091('0x3a')],{'$or':_['map'](_0x972111[_0xc091('0x33')],function(_0x1bd900){var _0x23cb07={};_0x23cb07[_0x1bd900]={'$like':'%'+_0x210227[_0xc091('0x30')]['filter']+'%'};return _0x23cb07;})});}_0x972111=_[_0xc091('0x3d')]({},_0x972111,_0x210227[_0xc091('0x3e')]);return db[_0xc091('0x5f')][_0xc091('0x1d')]({'where':_0x972111['where']})[_0xc091('0x22')](function(_0x233d8f){_0x23207d['count']=_0x233d8f;if(_0x210227[_0xc091('0x30')][_0xc091('0x40')]){_0x972111[_0xc091('0x41')]=[{'all':!![]}];}return db[_0xc091('0x5f')][_0xc091('0x5a')](_0x972111);})[_0xc091('0x22')](function(_0x1ec05a){_0x23207d[_0xc091('0x42')]=_0x1ec05a;return _0x23207d;});}})['then'](respondWithFilteredResult(_0x5e692a,_0x972111))[_0xc091('0x43')](handleError(_0x5e692a,null));};exports[_0xc091('0x60')]=function(_0x390f1a,_0x4fbde0,_0x5d8761){var _0x4eae8e={};var _0x44e9fa={};var _0x1d6b68;var _0x618668;return db['Campaign'][_0xc091('0x57')]({'where':{'id':_0x390f1a['params']['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x4fbde0,null))[_0xc091('0x22')](function(_0x173661){if(_0x173661){_0x1d6b68=_0x173661;_0x44e9fa[_0xc091('0x2f')]=_[_0xc091('0x46')](db[_0xc091('0x61')][_0xc091('0x2b')]);_0x44e9fa['query']=_[_0xc091('0x46')](_0x390f1a[_0xc091('0x30')]);_0x44e9fa['filters']=_[_0xc091('0x32')](_0x44e9fa[_0xc091('0x2f')],_0x44e9fa['query']);_0x4eae8e['attributes']=_['intersection'](_0x44e9fa['model'],qs[_0xc091('0x34')](_0x390f1a['query']['fields']));_0x4eae8e[_0xc091('0x33')]=_0x4eae8e[_0xc091('0x33')][_0xc091('0x35')]?_0x4eae8e[_0xc091('0x33')]:_0x44e9fa['model'];_0x4eae8e[_0xc091('0x38')]=qs[_0xc091('0x39')](_0x390f1a[_0xc091('0x30')][_0xc091('0x39')]);_0x4eae8e[_0xc091('0x3a')]=qs['filters'](_[_0xc091('0x3b')](_0x390f1a['query'],_0x44e9fa['filters']));if(_0x390f1a['query']['filter']){_0x4eae8e[_0xc091('0x3a')]=_[_0xc091('0x3d')](_0x4eae8e[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x4eae8e[_0xc091('0x33')],function(_0x44170a){var _0x5e61b6={};_0x5e61b6[_0x44170a]={'$like':'%'+_0x390f1a[_0xc091('0x30')][_0xc091('0x3c')]+'%'};return _0x5e61b6;})});}_0x4eae8e=_['merge']({},_0x4eae8e,_0x390f1a[_0xc091('0x3e')]);return _0x1d6b68['getLists'](_0x4eae8e);}})[_0xc091('0x22')](function(_0x50e7a){if(_0x50e7a){_0x618668=_0x50e7a[_0xc091('0x35')];if(!_0x390f1a[_0xc091('0x30')][_0xc091('0x36')](_0xc091('0x37'))){_0x4eae8e[_0xc091('0x1b')]=qs[_0xc091('0x1b')](_0x390f1a[_0xc091('0x30')][_0xc091('0x1b')]);_0x4eae8e[_0xc091('0x1a')]=qs[_0xc091('0x1a')](_0x390f1a[_0xc091('0x30')]['offset']);}return _0x1d6b68[_0xc091('0x60')](_0x4eae8e);}})['then'](function(_0x43b3a8){if(_0x43b3a8){return _0x43b3a8?{'count':_0x618668,'rows':_0x43b3a8}:null;}})[_0xc091('0x22')](respondWithResult(_0x4fbde0,null))['catch'](handleError(_0x4fbde0,null));};exports[_0xc091('0x62')]=function(_0x1a4044,_0xfea8a2,_0x3f7115){var _0x2008e2,_0xffa596;return db[_0xc091('0x3f')][_0xc091('0x47')]({'where':{'id':_0x1a4044[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0xfea8a2,null))[_0xc091('0x22')](function(_0x211106){if(_0x211106){_0xffa596=_0x211106;return _0x211106['addLists'](_0x1a4044[_0xc091('0x49')][_0xc091('0x63')],_[_0xc091('0x52')](_0x1a4044['body'],[_0xc091('0x63'),'id'])||{});}return null;})[_0xc091('0x64')](function(_0x266d6b){var _0xf6df48;_0x2008e2=_0x266d6b||[];var _0x1e8716=[];if(_0x266d6b){for(var _0x49d97c=0x0;_0x49d97c<_0x266d6b[_0xc091('0x35')];_0x49d97c+=0x1){var _0x53ea6c=_0x266d6b[_0x49d97c]['get']({'plain':!![]});_0xffa596[_0xc091('0x65')]=_0x1a4044['body'][_0xc091('0x65')]?_0x1a4044['body'][_0xc091('0x65')]:_0xffa596[_0xc091('0x65')];switch(_0xffa596[_0xc091('0x65')]){case _0xc091('0x66'):_0xf6df48=squel[_0xc091('0x67')]()[_0xc091('0x68')](_0xc091('0x69'))['fromQuery']([_0xc091('0x6a'),'scheduledAt',_0xc091('0x6b'),_0xc091('0x6c'),_0xc091('0x59'),_0xc091('0x53'),_0xc091('0x54')],squel[_0xc091('0x6d')]()[_0xc091('0x6e')]('phone',_0xc091('0x6a'))['field']('NOW()',_0xc091('0x6f'))[_0xc091('0x6e')]('id',_0xc091('0x6b'))[_0xc091('0x6e')](_0x53ea6c['CmListId'][_0xc091('0x70')](),'ListId')[_0xc091('0x6e')](_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')](),_0xc091('0x59'))[_0xc091('0x6e')](_0xc091('0x71'),_0xc091('0x53'))['field'](_0xc091('0x71'),'updatedAt')[_0xc091('0x72')](_0xc091('0x73'))[_0xc091('0x3a')]('deletedAt\x20IS\x20NULL')[_0xc091('0x3a')](_0xc091('0x74'),_0x53ea6c[_0xc091('0x75')]['toString']())['where'](_0xc091('0x76'))[_0xc091('0x3a')](_0xc091('0x77'),squel['select']()['field'](_0xc091('0x78'))['from'](_0xc091('0x79'))[_0xc091('0x3a')]('CampaignId\x20=\x20?',_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc091('0x6e')](_0xc091('0x7a'))['from']('cm_hopper')[_0xc091('0x3a')](_0xc091('0x7b'),_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')]())))[_0xc091('0x70')]();break;case _0xc091('0x7c'):_0xf6df48=squel[_0xc091('0x67')]()[_0xc091('0x68')](_0xc091('0x69'))[_0xc091('0x7d')]([_0xc091('0x6a'),'scheduledAt',_0xc091('0x6b'),_0xc091('0x6c'),_0xc091('0x59'),'createdAt',_0xc091('0x54')],squel[_0xc091('0x6d')]()[_0xc091('0x6e')](_0xc091('0x6a'),_0xc091('0x6a'))[_0xc091('0x6e')](_0xc091('0x71'),_0xc091('0x6f'))['field']('id',_0xc091('0x6b'))[_0xc091('0x6e')](_0x53ea6c[_0xc091('0x75')][_0xc091('0x70')](),'ListId')[_0xc091('0x6e')](_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')](),'CampaignId')[_0xc091('0x6e')](_0xc091('0x71'),_0xc091('0x53'))[_0xc091('0x6e')](_0xc091('0x71'),_0xc091('0x54'))['from'](_0xc091('0x73'))[_0xc091('0x3a')]('deletedAt\x20IS\x20NULL')[_0xc091('0x3a')](_0xc091('0x74'),_0x53ea6c[_0xc091('0x75')][_0xc091('0x70')]())[_0xc091('0x3a')](_0xc091('0x76'))['where'](_0xc091('0x77'),squel['select']()[_0xc091('0x6e')](_0xc091('0x7a'))[_0xc091('0x72')](_0xc091('0x69'))[_0xc091('0x3a')](_0xc091('0x7b'),_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')]())))[_0xc091('0x70')]();break;default:_0xf6df48=squel[_0xc091('0x67')]()[_0xc091('0x68')](_0xc091('0x69'))[_0xc091('0x7d')]([_0xc091('0x6a'),_0xc091('0x6f'),_0xc091('0x6b'),_0xc091('0x6c'),_0xc091('0x59'),_0xc091('0x53'),_0xc091('0x54')],squel[_0xc091('0x6d')]()[_0xc091('0x6e')](_0xc091('0x6a'),_0xc091('0x6a'))[_0xc091('0x6e')]('NOW()',_0xc091('0x6f'))[_0xc091('0x6e')]('id',_0xc091('0x6b'))[_0xc091('0x6e')](_0x53ea6c[_0xc091('0x75')]['toString'](),_0xc091('0x6c'))[_0xc091('0x6e')](_0x1a4044[_0xc091('0x45')]['id'][_0xc091('0x70')](),_0xc091('0x59'))['field'](_0xc091('0x71'),_0xc091('0x53'))[_0xc091('0x6e')](_0xc091('0x71'),'updatedAt')[_0xc091('0x72')](_0xc091('0x73'))[_0xc091('0x3a')](_0xc091('0x7e'))[_0xc091('0x3a')]('ListId\x20=\x20?',_0x53ea6c[_0xc091('0x75')][_0xc091('0x70')]())[_0xc091('0x3a')](_0xc091('0x76')))[_0xc091('0x70')]();}_0x1e8716['push'](db[_0xc091('0x7f')][_0xc091('0x30')](_0xf6df48));}return BPromise['all'](_0x1e8716);}})[_0xc091('0x22')](function(){return _0x2008e2;})[_0xc091('0x22')](respondWithResult(_0xfea8a2,null))[_0xc091('0x43')](handleError(_0xfea8a2,null));};exports['removeLists']=function(_0x2c520b,_0x4353f4,_0x133c1f){return db[_0xc091('0x3f')]['find']({'where':{'id':_0x2c520b[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x4353f4,null))[_0xc091('0x22')](function(_0x25d46c){if(_0x25d46c){return _0x25d46c[_0xc091('0x80')](_0x2c520b[_0xc091('0x30')][_0xc091('0x63')]);}})[_0xc091('0x22')](function(_0x5b7a3e){if(_0x5b7a3e){return db['CmHopper']['destroy']({'where':{'ListId':_0x2c520b[_0xc091('0x30')][_0xc091('0x63')],'CampaignId':_0x2c520b['params']['id']}})[_0xc091('0x22')](function(){return _0x5b7a3e;});}})[_0xc091('0x22')](respondWithStatusCode(_0x4353f4,null))[_0xc091('0x43')](handleError(_0x4353f4,null));};exports[_0xc091('0x81')]=function(_0x1e33d5,_0x21006b,_0x306139){var _0x22b965={};var _0x68fb0f={};var _0x54a1ba;var _0x4fb4c1;return db[_0xc091('0x3f')]['findOne']({'where':{'id':_0x1e33d5[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x21006b,null))[_0xc091('0x22')](function(_0xefc6a5){if(_0xefc6a5){_0x54a1ba=_0xefc6a5;_0x68fb0f[_0xc091('0x2f')]=_[_0xc091('0x46')](db[_0xc091('0x61')][_0xc091('0x2b')]);_0x68fb0f['query']=_[_0xc091('0x46')](_0x1e33d5['query']);_0x68fb0f[_0xc091('0x31')]=_['intersection'](_0x68fb0f[_0xc091('0x2f')],_0x68fb0f[_0xc091('0x30')]);_0x22b965[_0xc091('0x33')]=_[_0xc091('0x32')](_0x68fb0f[_0xc091('0x2f')],qs['fields'](_0x1e33d5[_0xc091('0x30')][_0xc091('0x34')]));_0x22b965['attributes']=_0x22b965[_0xc091('0x33')][_0xc091('0x35')]?_0x22b965[_0xc091('0x33')]:_0x68fb0f[_0xc091('0x2f')];_0x22b965['order']=qs['sort'](_0x1e33d5['query']['sort']);_0x22b965[_0xc091('0x3a')]=qs[_0xc091('0x31')](_[_0xc091('0x3b')](_0x1e33d5[_0xc091('0x30')],_0x68fb0f[_0xc091('0x31')]));if(_0x1e33d5['query']['filter']){_0x22b965['where']=_[_0xc091('0x3d')](_0x22b965[_0xc091('0x3a')],{'$or':_[_0xc091('0x2a')](_0x22b965[_0xc091('0x33')],function(_0x34e940){var _0xdaa3={};_0xdaa3[_0x34e940]={'$like':'%'+_0x1e33d5[_0xc091('0x30')]['filter']+'%'};return _0xdaa3;})});}_0x22b965=_[_0xc091('0x3d')]({},_0x22b965,_0x1e33d5[_0xc091('0x3e')]);return _0x54a1ba['getBlackLists'](_0x22b965);}})[_0xc091('0x22')](function(_0x55e762){if(_0x55e762){_0x4fb4c1=_0x55e762[_0xc091('0x35')];if(!_0x1e33d5['query']['hasOwnProperty'](_0xc091('0x37'))){_0x22b965['limit']=qs[_0xc091('0x1b')](_0x1e33d5['query'][_0xc091('0x1b')]);_0x22b965[_0xc091('0x1a')]=qs[_0xc091('0x1a')](_0x1e33d5['query'][_0xc091('0x1a')]);}return _0x54a1ba['getBlackLists'](_0x22b965);}})[_0xc091('0x22')](function(_0x3be7e3){if(_0x3be7e3){return _0x3be7e3?{'count':_0x4fb4c1,'rows':_0x3be7e3}:null;}})['then'](respondWithResult(_0x21006b,null))[_0xc091('0x43')](handleError(_0x21006b,null));};exports['addBlackLists']=function(_0x1fb872,_0x4f7e4a,_0x1201fc){var _0x458613,_0x5071f6;return db[_0xc091('0x3f')][_0xc091('0x47')]({'where':{'id':_0x1fb872[_0xc091('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f7e4a,null))[_0xc091('0x22')](function(_0x5cf330){if(_0x5cf330){_0x5071f6=_0x5cf330;return _0x5cf330[_0xc091('0x82')](_0x1fb872['body'][_0xc091('0x63')],_[_0xc091('0x52')](_0x1fb872[_0xc091('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x4e9b58){var _0xfc8ae0;_0x458613=_0x4e9b58||[];var _0x417f2a=[];if(_0x4e9b58){for(var _0x3fcc47=0x0;_0x3fcc47<_0x4e9b58[_0xc091('0x35')];_0x3fcc47+=0x1){var _0x566802=_0x4e9b58[_0x3fcc47][_0xc091('0x4b')]({'plain':!![]});_0xfc8ae0=squel[_0xc091('0x67')]()['into'](_0xc091('0x83'))['fromQuery']([_0xc091('0x6a'),_0xc091('0x6b'),'ListId',_0xc091('0x59'),_0xc091('0x53'),_0xc091('0x54')],squel['select']()[_0xc091('0x6e')]('phone',_0xc091('0x6a'))[_0xc091('0x6e')]('id','ContactId')['field'](_0x566802[_0xc091('0x75')][_0xc091('0x70')](),_0xc091('0x6c'))[_0xc091('0x6e')](_0x1fb872[_0xc091('0x45')]['id'][_0xc091('0x70')](),_0xc091('0x59'))['field']('NOW()','createdAt')[_0xc091('0x6e')]('NOW()',_0xc091('0x54'))[_0xc091('0x72')](_0xc091('0x73'))[_0xc091('0x3a')](_0xc091('0x7e'))[_0xc091('0x3a')]('ListId\x20=\x20?',_0x566802[_0xc091('0x75')][_0xc091('0x70')]())[_0xc091('0x3a')](_0xc091('0x76')))[_0xc091('0x70')]();_0x417f2a[_0xc091('0x84')](db[_0xc091('0x7f')][_0xc091('0x30')](_0xfc8ae0));}return BPromise[_0xc091('0x85')](_0x417f2a);}})[_0xc091('0x22')](function(){return _0x458613;})[_0xc091('0x22')](respondWithResult(_0x4f7e4a,null))[_0xc091('0x43')](handleError(_0x4f7e4a,null));};exports[_0xc091('0x86')]=function(_0x1ec994,_0x12d7ab,_0x451fd3){return db[_0xc091('0x3f')][_0xc091('0x47')]({'where':{'id':_0x1ec994[_0xc091('0x45')]['id']}})[_0xc091('0x22')](handleEntityNotFound(_0x12d7ab,null))[_0xc091('0x22')](function(_0x2a2234){if(_0x2a2234){return _0x2a2234[_0xc091('0x86')](_0x1ec994[_0xc091('0x30')][_0xc091('0x63')]);}})['then'](function(_0x28b239){if(_0x28b239){return db[_0xc091('0x5f')][_0xc091('0x23')]({'where':{'ListId':_0x1ec994[_0xc091('0x30')][_0xc091('0x63')],'CampaignId':_0x1ec994[_0xc091('0x45')]['id']}})[_0xc091('0x22')](function(){return _0x28b239;});}})[_0xc091('0x22')](respondWithStatusCode(_0x12d7ab,null))['catch'](handleError(_0x12d7ab,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a291b9c..14455b9 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(_0x3284cd,_0x2e10a2){var _0xe92280=function(_0x398d2e){while(--_0x398d2e){_0x3284cd['push'](_0x3284cd['shift']());}};_0xe92280(++_0x2e10a2);}(_0x7a54,0x106));var _0x47a5=function(_0xc640a5,_0x2ecf8a){_0xc640a5=_0xc640a5-0x0;var _0xe0a36f=_0x7a54[_0xc640a5];return _0xe0a36f;};'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(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 14101a0..0a008da 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 _0x7764=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x7764,0xa4));var _0x4776=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x7764[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var moment=require(_0x4776('0x2'));var BPromise=require(_0x4776('0x3'));var rs=require(_0x4776('0x4'));var fs=require('fs');var Redis=require(_0x4776('0x5'));var db=require(_0x4776('0x6'))['db'];var utils=require(_0x4776('0x7'));var logger=require(_0x4776('0x8'))(_0x4776('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4776('0xa')][_0x4776('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f59e,_0x1f9a45,_0x2b61c7){return new BPromise(function(_0x4fcbcc,_0x53f976){return client[_0x4776('0xc')](_0x52f59e,_0x2b61c7)['then'](function(_0x35bf06){logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));logger[_0x4776('0x10')](_0x4776('0x11'),_0x1f9a45,_0x4776('0xf'),JSON[_0x4776('0x12')](_0x35bf06));if(_0x35bf06[_0x4776('0x13')]){if(_0x35bf06[_0x4776('0x13')][_0x4776('0x14')]===0x1f4){logger[_0x4776('0x13')](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x53f976(_0x35bf06[_0x4776('0x13')]['message']);}logger['error'](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x4fcbcc(_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);}else{logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));_0x4fcbcc(_0x35bf06[_0x4776('0x16')][_0x4776('0x15')]);}})['catch'](function(_0x46fec7){logger['error'](_0x4776('0xe'),_0x1f9a45,_0x46fec7);_0x53f976(_0x46fec7);});});}exports[_0x4776('0x17')]=function(_0x2366da){var _0xed81b5=this;return new Promise(function(_0xb5c938,_0x4b5f50){return db[_0x4776('0x18')][_0x4776('0x19')]({'raw':_0x2366da['options']?_0x2366da[_0x4776('0x1a')][_0x4776('0x1b')]===undefined?!![]:![]:!![],'where':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')]['where']||null:null,'attributes':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')][_0x4776('0x1c')]||null:null,'limit':_0x2366da[_0x4776('0x1a')]?_0x2366da['options'][_0x4776('0x1d')]||null:null,'include':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')]['include']?_[_0x4776('0x1e')](_0x2366da[_0x4776('0x1a')][_0x4776('0x1f')],function(_0x54f3de){return{'model':db[_0x54f3de['model']],'as':_0x54f3de['as'],'attributes':_0x54f3de['attributes'],'include':_0x54f3de[_0x4776('0x1f')]?_[_0x4776('0x1e')](_0x54f3de[_0x4776('0x1f')],function(_0xdfe443){return{'model':db[_0xdfe443[_0x4776('0x20')]],'as':_0xdfe443['as'],'attributes':_0xdfe443[_0x4776('0x1c')],'include':_0xdfe443[_0x4776('0x1f')]?_['map'](_0xdfe443[_0x4776('0x1f')],function(_0x1de3d1){return{'model':db[_0x1de3d1['model']],'as':_0x1de3d1['as'],'attributes':_0x1de3d1[_0x4776('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4776('0x21')](function(_0x4b8aeb){logger[_0x4776('0xd')](_0x4776('0x17'),_0x2366da);logger[_0x4776('0x10')](_0x4776('0x17'),_0x2366da,JSON[_0x4776('0x12')](_0x4b8aeb));_0xb5c938(_0x4b8aeb);})['catch'](function(_0x4bfd4b){logger[_0x4776('0x13')](_0x4776('0x17'),_0x4bfd4b[_0x4776('0x15')],_0x2366da);_0x4b5f50(_0xed81b5['error'](0x1f4,_0x4bfd4b[_0x4776('0x15')]));});});}; \ No newline at end of file +var _0x2392=['Campaign','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x2392,0xd0));var _0x2239=function(_0x1d8c61,_0x30d721){_0x1d8c61=_0x1d8c61-0x0;var _0x2eb711=_0x2392[_0x1d8c61];return _0x2eb711;};'use strict';var _=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var moment=require('moment');var BPromise=require(_0x2239('0x2'));var rs=require(_0x2239('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2239('0x4'));var logger=require(_0x2239('0x5'))(_0x2239('0x6'));var config=require(_0x2239('0x7'));var jayson=require(_0x2239('0x8'));var client=jayson[_0x2239('0x9')][_0x2239('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7932e3,_0x206434,_0xfe211){return new BPromise(function(_0x3efe46,_0x3191b7){return client[_0x2239('0xb')](_0x7932e3,_0xfe211)['then'](function(_0x150f4d){logger[_0x2239('0xc')]('Campaign,\x20%s,\x20%s',_0x206434,'request\x20sent');logger[_0x2239('0xd')](_0x2239('0xe'),_0x206434,_0x2239('0xf'),JSON[_0x2239('0x10')](_0x150f4d));if(_0x150f4d[_0x2239('0x11')]){if(_0x150f4d[_0x2239('0x11')][_0x2239('0x12')]===0x1f4){logger['error'](_0x2239('0x13'),_0x206434,_0x150f4d[_0x2239('0x11')]['message']);return _0x3191b7(_0x150f4d[_0x2239('0x11')][_0x2239('0x14')]);}logger[_0x2239('0x11')](_0x2239('0x13'),_0x206434,_0x150f4d['error'][_0x2239('0x14')]);return _0x3efe46(_0x150f4d['error'][_0x2239('0x14')]);}else{logger[_0x2239('0xc')](_0x2239('0x13'),_0x206434,_0x2239('0xf'));_0x3efe46(_0x150f4d['result'][_0x2239('0x14')]);}})[_0x2239('0x15')](function(_0x4a88ba){logger[_0x2239('0x11')]('Campaign,\x20%s,\x20%s',_0x206434,_0x4a88ba);_0x3191b7(_0x4a88ba);});});}exports[_0x2239('0x16')]=function(_0x558138){var _0x306750=this;return new Promise(function(_0x594f20,_0x2f8f10){return db[_0x2239('0x17')][_0x2239('0x18')]({'raw':_0x558138[_0x2239('0x19')]?_0x558138['options'][_0x2239('0x1a')]===undefined?!![]:![]:!![],'where':_0x558138['options']?_0x558138[_0x2239('0x19')]['where']||null:null,'attributes':_0x558138[_0x2239('0x19')]?_0x558138[_0x2239('0x19')][_0x2239('0x1b')]||null:null,'limit':_0x558138['options']?_0x558138['options'][_0x2239('0x1c')]||null:null,'include':_0x558138['options']?_0x558138[_0x2239('0x19')][_0x2239('0x1d')]?_[_0x2239('0x1e')](_0x558138[_0x2239('0x19')]['include'],function(_0x1f1f49){return{'model':db[_0x1f1f49[_0x2239('0x1f')]],'as':_0x1f1f49['as'],'attributes':_0x1f1f49[_0x2239('0x1b')],'include':_0x1f1f49[_0x2239('0x1d')]?_['map'](_0x1f1f49[_0x2239('0x1d')],function(_0x44e671){return{'model':db[_0x44e671[_0x2239('0x1f')]],'as':_0x44e671['as'],'attributes':_0x44e671['attributes'],'include':_0x44e671[_0x2239('0x1d')]?_[_0x2239('0x1e')](_0x44e671[_0x2239('0x1d')],function(_0x1c179e){return{'model':db[_0x1c179e[_0x2239('0x1f')]],'as':_0x1c179e['as'],'attributes':_0x1c179e[_0x2239('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2239('0x20')](function(_0x4f4135){logger['info']('GetCampaign',_0x558138);logger['debug']('GetCampaign',_0x558138,JSON[_0x2239('0x10')](_0x4f4135));_0x594f20(_0x4f4135);})[_0x2239('0x15')](function(_0x2a60b1){logger[_0x2239('0x11')]('GetCampaign',_0x2a60b1[_0x2239('0x14')],_0x558138);_0x2f8f10(_0x306750[_0x2239('0x11')](0x1f4,_0x2a60b1[_0x2239('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e9fd38a..08d7aa6 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 _0x4e6f=['./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','create','/:id/clone','clone','/:id/lists','/:id/blacklists','addBlackLists','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e6f,0x14d));var _0xf4e6=function(_0x9819df,_0x2808ba){_0x9819df=_0x9819df-0x0;var _0x40ea3c=_0x4e6f[_0x9819df];return _0x40ea3c;};'use strict';var multer=require(_0xf4e6('0x0'));var util=require('util');var path=require(_0xf4e6('0x1'));var timeout=require(_0xf4e6('0x2'));var express=require(_0xf4e6('0x3'));var router=express[_0xf4e6('0x4')]();var fs_extra=require(_0xf4e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf4e6('0x6'));var config=require(_0xf4e6('0x7'));var controller=require(_0xf4e6('0x8'));router[_0xf4e6('0x9')]('/',auth['isAuthenticated'](),controller[_0xf4e6('0xa')]);router[_0xf4e6('0x9')](_0xf4e6('0xb'),auth['isAuthenticated'](),controller[_0xf4e6('0xc')]);router[_0xf4e6('0x9')](_0xf4e6('0xd'),auth[_0xf4e6('0xe')](),controller[_0xf4e6('0xf')]);router['get']('/:id/hopper_histories',auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x10')]);router[_0xf4e6('0x9')](_0xf4e6('0x11'),auth['isAuthenticated'](),controller[_0xf4e6('0x12')]);router[_0xf4e6('0x9')](_0xf4e6('0x13'),auth['isAuthenticated'](),controller[_0xf4e6('0x14')]);router['get']('/:id/lists',auth[_0xf4e6('0xe')](),controller['getLists']);router[_0xf4e6('0x9')]('/:id/blacklists',auth[_0xf4e6('0xe')](),controller['getBlackLists']);router['post']('/',auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x15')]);router['post'](_0xf4e6('0x16'),auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x17')]);router['post'](_0xf4e6('0x18'),auth[_0xf4e6('0xe')](),controller['addLists']);router['post'](_0xf4e6('0x19'),auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x1a')]);router[_0xf4e6('0x1b')](_0xf4e6('0xb'),auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x1c')]);router[_0xf4e6('0x1d')](_0xf4e6('0xb'),auth[_0xf4e6('0xe')](),controller[_0xf4e6('0x1e')]);router[_0xf4e6('0x1d')](_0xf4e6('0x18'),auth[_0xf4e6('0xe')](),controller['removeLists']);router[_0xf4e6('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x1c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','getBlackLists','post','/:id/clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','express','Router'];(function(_0x4a155f,_0xb73f2){var _0x518b24=function(_0x1e5578){while(--_0x1e5578){_0x4a155f['push'](_0x4a155f['shift']());}};_0x518b24(++_0xb73f2);}(_0x1c4e,0x7f));var _0xe1c4=function(_0xc2c353,_0x41a5a3){_0xc2c353=_0xc2c353-0x0;var _0x806605=_0x1c4e[_0xc2c353];return _0x806605;};'use strict';var multer=require(_0xe1c4('0x0'));var util=require(_0xe1c4('0x1'));var path=require(_0xe1c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1c4('0x3'));var router=express[_0xe1c4('0x4')]();var fs_extra=require(_0xe1c4('0x5'));var auth=require(_0xe1c4('0x6'));var interaction=require(_0xe1c4('0x7'));var config=require(_0xe1c4('0x8'));var controller=require(_0xe1c4('0x9'));router['get']('/',auth[_0xe1c4('0xa')](),controller[_0xe1c4('0xb')]);router[_0xe1c4('0xc')](_0xe1c4('0xd'),auth[_0xe1c4('0xa')](),controller['show']);router[_0xe1c4('0xc')](_0xe1c4('0xe'),auth[_0xe1c4('0xa')](),controller['getHoppers']);router['get'](_0xe1c4('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xe1c4('0xc')](_0xe1c4('0x10'),auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x11')]);router[_0xe1c4('0xc')](_0xe1c4('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xe1c4('0xc')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe1c4('0x13')]);router[_0xe1c4('0xc')]('/:id/blacklists',auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x14')]);router[_0xe1c4('0x15')]('/',auth[_0xe1c4('0xa')](),controller['create']);router[_0xe1c4('0x15')](_0xe1c4('0x16'),auth[_0xe1c4('0xa')](),controller['clone']);router[_0xe1c4('0x15')](_0xe1c4('0x17'),auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x18')]);router[_0xe1c4('0x15')](_0xe1c4('0x19'),auth['isAuthenticated'](),controller[_0xe1c4('0x1a')]);router['put'](_0xe1c4('0xd'),auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x1b')]);router['delete'](_0xe1c4('0xd'),auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x1c')]);router[_0xe1c4('0x1d')](_0xe1c4('0x17'),auth[_0xe1c4('0xa')](),controller[_0xe1c4('0x1e')]);router[_0xe1c4('0x1d')](_0xe1c4('0x19'),auth['isAuthenticated'](),controller[_0xe1c4('0x1f')]);module[_0xe1c4('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e020794..832ca01 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 _0xdd4a=['getDataValue','STRING','VIRTUAL'];(function(_0x9f8d7e,_0x2d74b2){var _0x87c913=function(_0x526425){while(--_0x526425){_0x9f8d7e['push'](_0x9f8d7e['shift']());}};_0x87c913(++_0x2d74b2);}(_0xdd4a,0x64));var _0xadd4=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0xdd4a[_0x21353c];return _0xa99120;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0xadd4('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xadd4('0x0')]},'name':{'type':Sequelize[_0xadd4('0x1')],'get':function(){return this[_0xadd4('0x2')]('key');}}}; \ No newline at end of file +var _0x7172=['key','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7172,0x10f));var _0x2717=function(_0x5e2619,_0x211a80){_0x5e2619=_0x5e2619-0x0;var _0x45cdb3=_0x7172[_0x5e2619];return _0x45cdb3;};'use strict';var Sequelize=require(_0x2717('0x0'));module[_0x2717('0x1')]={'key':{'type':Sequelize[_0x2717('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x2717('0x2')]},'name':{'type':Sequelize[_0x2717('0x3')],'get':function(){return this[_0x2717('0x4')](_0x2717('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 4bf7614..2464953 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 _0xf7d5=['catch','body','params','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','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','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','CannedAnswers','then','error','stack','name','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll'];(function(_0x5119a0,_0x3e080a){var _0x3fffe5=function(_0x123183){while(--_0x123183){_0x5119a0['push'](_0x5119a0['shift']());}};_0x3fffe5(++_0x3e080a);}(_0xf7d5,0x11b));var _0x5f7d=function(_0x3d56d5,_0x492dc9){_0x3d56d5=_0x3d56d5-0x0;var _0x50b4f3=_0xf7d5[_0x3d56d5];return _0x50b4f3;};'use strict';var emlformat=require(_0x5f7d('0x0'));var rimraf=require(_0x5f7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f7d('0x2'));var rp=require(_0x5f7d('0x3'));var moment=require('moment');var BPromise=require(_0x5f7d('0x4'));var Mustache=require(_0x5f7d('0x5'));var util=require(_0x5f7d('0x6'));var path=require(_0x5f7d('0x7'));var sox=require(_0x5f7d('0x8'));var csv=require(_0x5f7d('0x9'));var ejs=require(_0x5f7d('0xa'));var fs=require('fs');var fs_extra=require(_0x5f7d('0xb'));var _=require(_0x5f7d('0xc'));var squel=require(_0x5f7d('0xd'));var crypto=require(_0x5f7d('0xe'));var jsforce=require(_0x5f7d('0xf'));var deskjs=require(_0x5f7d('0x10'));var toCsv=require(_0x5f7d('0x9'));var querystring=require(_0x5f7d('0x11'));var Papa=require(_0x5f7d('0x12'));var Redis=require(_0x5f7d('0x13'));var authService=require(_0x5f7d('0x14'));var qs=require(_0x5f7d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f7d('0x16'));var logger=require(_0x5f7d('0x17'))(_0x5f7d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f7d('0x19'))['db'];function respondWithStatusCode(_0x3cd1af,_0x6ae813){_0x6ae813=_0x6ae813||0xcc;return function(_0x151e48){if(_0x151e48){return _0x3cd1af[_0x5f7d('0x1a')](_0x6ae813);}return _0x3cd1af[_0x5f7d('0x1b')](_0x6ae813)['end']();};}function respondWithResult(_0x2cac0a,_0x5e9b54){_0x5e9b54=_0x5e9b54||0xc8;return function(_0xf2880){if(_0xf2880){return _0x2cac0a[_0x5f7d('0x1b')](_0x5e9b54)[_0x5f7d('0x1c')](_0xf2880);}};}function respondWithFilteredResult(_0xd7d88e,_0x222f16){return function(_0x3bb545){if(_0x3bb545){var _0x3091b3=typeof _0x222f16[_0x5f7d('0x1d')]==='undefined'&&typeof _0x222f16['limit']==='undefined';var _0x220814=_0x3bb545[_0x5f7d('0x1e')];var _0x1f6fe3=_0x3091b3?0x0:_0x222f16[_0x5f7d('0x1d')];var _0x16bdef=_0x3091b3?_0x3bb545[_0x5f7d('0x1e')]:_0x222f16['offset']+_0x222f16[_0x5f7d('0x1f')];var _0x465ffb;if(_0x16bdef>=_0x220814){_0x16bdef=_0x220814;_0x465ffb=0xc8;}else{_0x465ffb=0xce;}_0xd7d88e[_0x5f7d('0x1b')](_0x465ffb);return _0xd7d88e[_0x5f7d('0x20')](_0x5f7d('0x21'),_0x1f6fe3+'-'+_0x16bdef+'/'+_0x220814)[_0x5f7d('0x1c')](_0x3bb545);}return null;};}function patchUpdates(_0xf2629d){return function(_0x2a75de){try{jsonpatch[_0x5f7d('0x22')](_0x2a75de,_0xf2629d,!![]);}catch(_0x8ca1f0){return BPromise[_0x5f7d('0x23')](_0x8ca1f0);}return _0x2a75de[_0x5f7d('0x24')]();};}function saveUpdates(_0x3579d4,_0x4ed23d){return function(_0x1be66e){if(_0x1be66e){return _0x1be66e[_0x5f7d('0x25')](_0x3579d4)['then'](function(_0x1ac9a2){return _0x1ac9a2;});}return null;};}function removeEntity(_0x3a82f7,_0xbdc701){return function(_0x4d804f){if(_0x4d804f){return _0x4d804f[_0x5f7d('0x26')]()['then'](function(){var _0x30a47d=_0x4d804f[_0x5f7d('0x27')]({'plain':!![]});var _0x1c3a90=_0x5f7d('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c3a90,'resourceId':_0x30a47d['id']}})[_0x5f7d('0x29')](function(){return _0x4d804f;});})[_0x5f7d('0x29')](function(){_0x3a82f7[_0x5f7d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf38819,_0x1cefe6){return function(_0x4a96d3){if(!_0x4a96d3){_0xf38819[_0x5f7d('0x1a')](0x194);}return _0x4a96d3;};}function handleError(_0x4fff7d,_0x2fa448){_0x2fa448=_0x2fa448||0x1f4;return function(_0x5ab73c){logger[_0x5f7d('0x2a')](_0x5ab73c[_0x5f7d('0x2b')]);if(_0x5ab73c['name']){delete _0x5ab73c[_0x5f7d('0x2c')];}_0x4fff7d[_0x5f7d('0x1b')](_0x2fa448)['send'](_0x5ab73c);};}exports['index']=function(_0x351012,_0x18c69b){var _0x262d7d={},_0x467a08={},_0x557a6f={'count':0x0,'rows':[]};var _0x3ee610=_[_0x5f7d('0x2d')](db[_0x5f7d('0x2e')][_0x5f7d('0x2f')],function(_0x311bf5){return{'name':_0x311bf5['fieldName'],'type':_0x311bf5[_0x5f7d('0x30')][_0x5f7d('0x31')]};});_0x467a08[_0x5f7d('0x32')]=_['map'](_0x3ee610,_0x5f7d('0x2c'));_0x467a08[_0x5f7d('0x33')]=_[_0x5f7d('0x34')](_0x351012['query']);_0x467a08[_0x5f7d('0x35')]=_['intersection'](_0x467a08[_0x5f7d('0x32')],_0x467a08[_0x5f7d('0x33')]);_0x262d7d[_0x5f7d('0x36')]=_[_0x5f7d('0x37')](_0x467a08['model'],qs[_0x5f7d('0x38')](_0x351012[_0x5f7d('0x33')][_0x5f7d('0x38')]));_0x262d7d[_0x5f7d('0x36')]=_0x262d7d[_0x5f7d('0x36')][_0x5f7d('0x39')]?_0x262d7d['attributes']:_0x467a08[_0x5f7d('0x32')];if(!_0x351012[_0x5f7d('0x33')][_0x5f7d('0x3a')]('nolimit')){_0x262d7d[_0x5f7d('0x1f')]=qs[_0x5f7d('0x1f')](_0x351012['query'][_0x5f7d('0x1f')]);_0x262d7d['offset']=qs[_0x5f7d('0x1d')](_0x351012[_0x5f7d('0x33')][_0x5f7d('0x1d')]);}_0x262d7d[_0x5f7d('0x3b')]=qs[_0x5f7d('0x3c')](_0x351012[_0x5f7d('0x33')][_0x5f7d('0x3c')]);_0x262d7d['where']=qs['filters'](_[_0x5f7d('0x3d')](_0x351012[_0x5f7d('0x33')],_0x467a08[_0x5f7d('0x35')]),_0x3ee610);if(_0x351012[_0x5f7d('0x33')][_0x5f7d('0x3e')]){_0x262d7d[_0x5f7d('0x3f')]=_[_0x5f7d('0x40')](_0x262d7d['where'],{'$or':[{'key':{'$like':'%'+_0x351012[_0x5f7d('0x33')][_0x5f7d('0x3e')]+'%'}},{'value':{'$like':'%'+_0x351012[_0x5f7d('0x33')][_0x5f7d('0x3e')]+'%'}}]});}_0x262d7d=_['merge']({},_0x262d7d,_0x351012[_0x5f7d('0x41')]);var _0x15c14e={'where':_0x262d7d[_0x5f7d('0x3f')]};return db[_0x5f7d('0x2e')][_0x5f7d('0x1e')](_0x15c14e)[_0x5f7d('0x29')](function(_0x37a920){_0x557a6f[_0x5f7d('0x1e')]=_0x37a920;if(_0x351012['query'][_0x5f7d('0x42')]){_0x262d7d[_0x5f7d('0x43')]=[{'all':!![]}];}return db[_0x5f7d('0x2e')][_0x5f7d('0x44')](_0x262d7d);})[_0x5f7d('0x29')](function(_0x3f570f){_0x557a6f['rows']=_0x3f570f;return _0x557a6f;})[_0x5f7d('0x29')](respondWithFilteredResult(_0x18c69b,_0x262d7d))[_0x5f7d('0x45')](handleError(_0x18c69b,null));};exports['show']=function(_0x3811c2,_0x347c20){var _0x3b1b2d={'raw':!![],'where':{'id':_0x3811c2['params']['id']}},_0x20aac1={};_0x20aac1[_0x5f7d('0x32')]=_[_0x5f7d('0x34')](db[_0x5f7d('0x2e')][_0x5f7d('0x2f')]);_0x20aac1['query']=_[_0x5f7d('0x34')](_0x3811c2['query']);_0x20aac1[_0x5f7d('0x35')]=_[_0x5f7d('0x37')](_0x20aac1[_0x5f7d('0x32')],_0x20aac1[_0x5f7d('0x33')]);_0x3b1b2d['attributes']=_[_0x5f7d('0x37')](_0x20aac1[_0x5f7d('0x32')],qs[_0x5f7d('0x38')](_0x3811c2['query'][_0x5f7d('0x38')]));_0x3b1b2d[_0x5f7d('0x36')]=_0x3b1b2d[_0x5f7d('0x36')][_0x5f7d('0x39')]?_0x3b1b2d[_0x5f7d('0x36')]:_0x20aac1[_0x5f7d('0x32')];if(_0x3811c2[_0x5f7d('0x33')][_0x5f7d('0x42')]){_0x3b1b2d[_0x5f7d('0x43')]=[{'all':!![]}];}_0x3b1b2d=_[_0x5f7d('0x40')]({},_0x3b1b2d,_0x3811c2[_0x5f7d('0x41')]);return db[_0x5f7d('0x2e')]['find'](_0x3b1b2d)[_0x5f7d('0x29')](handleEntityNotFound(_0x347c20,null))[_0x5f7d('0x29')](respondWithResult(_0x347c20,null))['catch'](handleError(_0x347c20,null));};exports[_0x5f7d('0x25')]=function(_0x1cd18b,_0x3a621b){if(_0x1cd18b[_0x5f7d('0x46')]['id']){delete _0x1cd18b['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x1cd18b[_0x5f7d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a621b,null))['then'](saveUpdates(_0x1cd18b[_0x5f7d('0x46')],null))[_0x5f7d('0x29')](respondWithResult(_0x3a621b,null))[_0x5f7d('0x45')](handleError(_0x3a621b,null));};exports[_0x5f7d('0x26')]=function(_0x4eb8ec,_0x3db858){return db[_0x5f7d('0x2e')][_0x5f7d('0x48')]({'where':{'id':_0x4eb8ec[_0x5f7d('0x47')]['id']}})[_0x5f7d('0x29')](handleEntityNotFound(_0x3db858,null))['then'](removeEntity(_0x3db858,null))[_0x5f7d('0x45')](handleError(_0x3db858,null));};exports['create']=function(_0x2df066,_0x439019){var _0x1b1090={'key':_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x31')]};if(_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x49')]){_0x1b1090[_0x5f7d('0x49')]=_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x49')];}else if(_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x4a')]){_0x1b1090[_0x5f7d('0x4a')]=_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x4a')];}else if(_0x2df066['body'][_0x5f7d('0x4b')]){_0x1b1090[_0x5f7d('0x4b')]=_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x4b')];}else if(_0x2df066[_0x5f7d('0x46')]['ChatWebsiteId']){_0x1b1090[_0x5f7d('0x4c')]=_0x2df066[_0x5f7d('0x46')][_0x5f7d('0x4c')];}return db[_0x5f7d('0x2e')][_0x5f7d('0x48')]({'where':_0x1b1090})[_0x5f7d('0x29')](function(_0x295dd2){if(_0x295dd2){throw new db[(_0x5f7d('0x4d'))][(_0x5f7d('0x4e'))](_0x5f7d('0x4f'));}return db[_0x5f7d('0x2e')]['create'](_0x2df066[_0x5f7d('0x46')]);})[_0x5f7d('0x29')](function(_0xb39308){var _0x577590=_0x2df066[_0x5f7d('0x50')]['get']({'plain':!![]});if(!_0x577590)throw new Error(_0x5f7d('0x51'));if(_0x577590[_0x5f7d('0x52')]==='user'){var _0x1fa8f0=_0xb39308[_0x5f7d('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x5f7d('0x48')]({'where':{'name':_0x5f7d('0x28'),'userProfileId':_0x577590[_0x5f7d('0x53')]},'raw':!![]})['then'](function(_0x5c3098){if(_0x5c3098&&_0x5c3098[_0x5f7d('0x54')]===0x0){return db[_0x5f7d('0x55')][_0x5f7d('0x56')]({'name':_0x1fa8f0[_0x5f7d('0x2c')],'resourceId':_0x1fa8f0['id'],'type':_0x5c3098[_0x5f7d('0x2c')],'sectionId':_0x5c3098['id']},{})[_0x5f7d('0x29')](function(){return _0xb39308;});}else{return _0xb39308;}})['catch'](function(_0x2b11a3){logger[_0x5f7d('0x2a')](_0x5f7d('0x57'),_0x2b11a3);throw _0x2b11a3;});}return _0xb39308;})[_0x5f7d('0x29')](respondWithResult(_0x439019,0xc9))[_0x5f7d('0x45')](handleError(_0x439019,null));}; \ No newline at end of file +var _0x9035=['desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','offset','set','Content-Range','save','update','then','UserProfileResource','destroy','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','count','includeAll','include','findAll','rows','show','params','fields','body','find','catch','create','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','CannedAnswers','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x9035,0x151));var _0x5903=function(_0xf50be9,_0x2f1bc7){_0xf50be9=_0xf50be9-0x0;var _0x254b99=_0x9035[_0xf50be9];return _0x254b99;};'use strict';var emlformat=require(_0x5903('0x0'));var rimraf=require(_0x5903('0x1'));var zipdir=require(_0x5903('0x2'));var jsonpatch=require(_0x5903('0x3'));var rp=require(_0x5903('0x4'));var moment=require(_0x5903('0x5'));var BPromise=require(_0x5903('0x6'));var Mustache=require(_0x5903('0x7'));var util=require(_0x5903('0x8'));var path=require(_0x5903('0x9'));var sox=require(_0x5903('0xa'));var csv=require('to-csv');var ejs=require(_0x5903('0xb'));var fs=require('fs');var fs_extra=require(_0x5903('0xc'));var _=require(_0x5903('0xd'));var squel=require(_0x5903('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5903('0xf'));var toCsv=require(_0x5903('0x10'));var querystring=require(_0x5903('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5903('0x12'));var qs=require(_0x5903('0x13'));var as=require(_0x5903('0x14'));var hardwareService=require(_0x5903('0x15'));var logger=require(_0x5903('0x16'))(_0x5903('0x17'));var utils=require(_0x5903('0x18'));var config=require(_0x5903('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a59d1,_0x433e2f){_0x433e2f=_0x433e2f||0xcc;return function(_0x564857){if(_0x564857){return _0x3a59d1[_0x5903('0x1a')](_0x433e2f);}return _0x3a59d1[_0x5903('0x1b')](_0x433e2f)[_0x5903('0x1c')]();};}function respondWithResult(_0x34b266,_0x5750d6){_0x5750d6=_0x5750d6||0xc8;return function(_0x22229a){if(_0x22229a){return _0x34b266[_0x5903('0x1b')](_0x5750d6)['json'](_0x22229a);}};}function respondWithFilteredResult(_0x987cb0,_0x18bf7c){return function(_0x183e81){if(_0x183e81){var _0x1f485f=typeof _0x18bf7c['offset']===_0x5903('0x1d')&&typeof _0x18bf7c[_0x5903('0x1e')]===_0x5903('0x1d');var _0x385f78=_0x183e81['count'];var _0x124697=_0x1f485f?0x0:_0x18bf7c[_0x5903('0x1f')];var _0x2ce3de=_0x1f485f?_0x183e81['count']:_0x18bf7c['offset']+_0x18bf7c['limit'];var _0x571b63;if(_0x2ce3de>=_0x385f78){_0x2ce3de=_0x385f78;_0x571b63=0xc8;}else{_0x571b63=0xce;}_0x987cb0[_0x5903('0x1b')](_0x571b63);return _0x987cb0[_0x5903('0x20')](_0x5903('0x21'),_0x124697+'-'+_0x2ce3de+'/'+_0x385f78)['json'](_0x183e81);}return null;};}function patchUpdates(_0x2adf54){return function(_0x59c68b){try{jsonpatch['apply'](_0x59c68b,_0x2adf54,!![]);}catch(_0x2318a5){return BPromise['reject'](_0x2318a5);}return _0x59c68b[_0x5903('0x22')]();};}function saveUpdates(_0x762e5e,_0x4a737c){return function(_0x577ad5){if(_0x577ad5){return _0x577ad5[_0x5903('0x23')](_0x762e5e)['then'](function(_0x4fdcc2){return _0x4fdcc2;});}return null;};}function removeEntity(_0x834d3f,_0x249898){return function(_0xb026d0){if(_0xb026d0){return _0xb026d0['destroy']()[_0x5903('0x24')](function(){var _0x843c69=_0xb026d0['get']({'plain':!![]});var _0x378855='CannedAnswers';return db[_0x5903('0x25')][_0x5903('0x26')]({'where':{'type':_0x378855,'resourceId':_0x843c69['id']}})[_0x5903('0x24')](function(){return _0xb026d0;});})[_0x5903('0x24')](function(){_0x834d3f['status'](0xcc)[_0x5903('0x1c')]();});}};}function handleEntityNotFound(_0x18b01b,_0x346252){return function(_0x30f8c3){if(!_0x30f8c3){_0x18b01b[_0x5903('0x1a')](0x194);}return _0x30f8c3;};}function handleError(_0x5e56a8,_0x267c31){_0x267c31=_0x267c31||0x1f4;return function(_0x40824f){logger['error'](_0x40824f[_0x5903('0x27')]);if(_0x40824f['name']){delete _0x40824f[_0x5903('0x28')];}_0x5e56a8[_0x5903('0x1b')](_0x267c31)[_0x5903('0x29')](_0x40824f);};}exports[_0x5903('0x2a')]=function(_0x385d52,_0x3e6f20){var _0x23eadc={},_0x5ea998={},_0x247a36={'count':0x0,'rows':[]};var _0x693367=_[_0x5903('0x2b')](db[_0x5903('0x2c')][_0x5903('0x2d')],function(_0x30d029){return{'name':_0x30d029[_0x5903('0x2e')],'type':_0x30d029[_0x5903('0x2f')]['key']};});_0x5ea998['model']=_['map'](_0x693367,_0x5903('0x28'));_0x5ea998[_0x5903('0x30')]=_['keys'](_0x385d52[_0x5903('0x30')]);_0x5ea998[_0x5903('0x31')]=_['intersection'](_0x5ea998[_0x5903('0x32')],_0x5ea998[_0x5903('0x30')]);_0x23eadc[_0x5903('0x33')]=_[_0x5903('0x34')](_0x5ea998['model'],qs['fields'](_0x385d52[_0x5903('0x30')]['fields']));_0x23eadc[_0x5903('0x33')]=_0x23eadc[_0x5903('0x33')][_0x5903('0x35')]?_0x23eadc[_0x5903('0x33')]:_0x5ea998[_0x5903('0x32')];if(!_0x385d52['query'][_0x5903('0x36')](_0x5903('0x37'))){_0x23eadc['limit']=qs[_0x5903('0x1e')](_0x385d52[_0x5903('0x30')][_0x5903('0x1e')]);_0x23eadc[_0x5903('0x1f')]=qs['offset'](_0x385d52['query']['offset']);}_0x23eadc[_0x5903('0x38')]=qs[_0x5903('0x39')](_0x385d52[_0x5903('0x30')][_0x5903('0x39')]);_0x23eadc['where']=qs['filters'](_['pick'](_0x385d52[_0x5903('0x30')],_0x5ea998[_0x5903('0x31')]),_0x693367);if(_0x385d52['query'][_0x5903('0x3a')]){_0x23eadc['where']=_[_0x5903('0x3b')](_0x23eadc[_0x5903('0x3c')],{'$or':[{'key':{'$like':'%'+_0x385d52['query'][_0x5903('0x3a')]+'%'}},{'value':{'$like':'%'+_0x385d52[_0x5903('0x30')][_0x5903('0x3a')]+'%'}}]});}_0x23eadc=_[_0x5903('0x3b')]({},_0x23eadc,_0x385d52[_0x5903('0x3d')]);var _0x5df745={'where':_0x23eadc[_0x5903('0x3c')]};return db['CannedAnswer'][_0x5903('0x3e')](_0x5df745)[_0x5903('0x24')](function(_0x133056){_0x247a36['count']=_0x133056;if(_0x385d52[_0x5903('0x30')][_0x5903('0x3f')]){_0x23eadc[_0x5903('0x40')]=[{'all':!![]}];}return db[_0x5903('0x2c')][_0x5903('0x41')](_0x23eadc);})[_0x5903('0x24')](function(_0x31cee3){_0x247a36[_0x5903('0x42')]=_0x31cee3;return _0x247a36;})[_0x5903('0x24')](respondWithFilteredResult(_0x3e6f20,_0x23eadc))['catch'](handleError(_0x3e6f20,null));};exports[_0x5903('0x43')]=function(_0x5c04fe,_0x4cc1d2){var _0x656a78={'raw':!![],'where':{'id':_0x5c04fe[_0x5903('0x44')]['id']}},_0x25ac93={};_0x25ac93['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x25ac93[_0x5903('0x30')]=_['keys'](_0x5c04fe[_0x5903('0x30')]);_0x25ac93[_0x5903('0x31')]=_[_0x5903('0x34')](_0x25ac93[_0x5903('0x32')],_0x25ac93[_0x5903('0x30')]);_0x656a78[_0x5903('0x33')]=_['intersection'](_0x25ac93[_0x5903('0x32')],qs['fields'](_0x5c04fe['query'][_0x5903('0x45')]));_0x656a78[_0x5903('0x33')]=_0x656a78[_0x5903('0x33')][_0x5903('0x35')]?_0x656a78[_0x5903('0x33')]:_0x25ac93[_0x5903('0x32')];if(_0x5c04fe[_0x5903('0x30')][_0x5903('0x3f')]){_0x656a78[_0x5903('0x40')]=[{'all':!![]}];}_0x656a78=_[_0x5903('0x3b')]({},_0x656a78,_0x5c04fe[_0x5903('0x3d')]);return db['CannedAnswer']['find'](_0x656a78)[_0x5903('0x24')](handleEntityNotFound(_0x4cc1d2,null))[_0x5903('0x24')](respondWithResult(_0x4cc1d2,null))['catch'](handleError(_0x4cc1d2,null));};exports['update']=function(_0x366928,_0x2d627c){if(_0x366928[_0x5903('0x46')]['id']){delete _0x366928[_0x5903('0x46')]['id'];}return db[_0x5903('0x2c')][_0x5903('0x47')]({'where':{'id':_0x366928[_0x5903('0x44')]['id']}})[_0x5903('0x24')](handleEntityNotFound(_0x2d627c,null))[_0x5903('0x24')](saveUpdates(_0x366928['body'],null))[_0x5903('0x24')](respondWithResult(_0x2d627c,null))[_0x5903('0x48')](handleError(_0x2d627c,null));};exports[_0x5903('0x26')]=function(_0x3664f9,_0x2bc89d){return db[_0x5903('0x2c')][_0x5903('0x47')]({'where':{'id':_0x3664f9['params']['id']}})['then'](handleEntityNotFound(_0x2bc89d,null))[_0x5903('0x24')](removeEntity(_0x2bc89d,null))[_0x5903('0x48')](handleError(_0x2bc89d,null));};exports[_0x5903('0x49')]=function(_0x23c388,_0x186379){var _0x473a25={'key':_0x23c388[_0x5903('0x46')]['key']};if(_0x23c388['body'][_0x5903('0x4a')]){_0x473a25[_0x5903('0x4a')]=_0x23c388[_0x5903('0x46')][_0x5903('0x4a')];}else if(_0x23c388[_0x5903('0x46')][_0x5903('0x4b')]){_0x473a25[_0x5903('0x4b')]=_0x23c388[_0x5903('0x46')][_0x5903('0x4b')];}else if(_0x23c388[_0x5903('0x46')]['OpenchannelAccountId']){_0x473a25['OpenchannelAccountId']=_0x23c388['body']['OpenchannelAccountId'];}else if(_0x23c388[_0x5903('0x46')][_0x5903('0x4c')]){_0x473a25[_0x5903('0x4c')]=_0x23c388['body'][_0x5903('0x4c')];}return db[_0x5903('0x2c')]['find']({'where':_0x473a25})['then'](function(_0x12ac05){if(_0x12ac05){throw new db[(_0x5903('0x4d'))][(_0x5903('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x5903('0x2c')][_0x5903('0x49')](_0x23c388['body']);})[_0x5903('0x24')](function(_0x37bf1b){var _0x2bf31d=_0x23c388[_0x5903('0x4f')]['get']({'plain':!![]});if(!_0x2bf31d)throw new Error(_0x5903('0x50'));if(_0x2bf31d[_0x5903('0x51')]==='user'){var _0x4eae12=_0x37bf1b[_0x5903('0x52')]({'plain':!![]});return db[_0x5903('0x53')][_0x5903('0x47')]({'where':{'name':_0x5903('0x54'),'userProfileId':_0x2bf31d[_0x5903('0x55')]},'raw':!![]})[_0x5903('0x24')](function(_0xd8e613){if(_0xd8e613&&_0xd8e613['autoAssociation']===0x0){return db[_0x5903('0x25')][_0x5903('0x49')]({'name':_0x4eae12[_0x5903('0x28')],'resourceId':_0x4eae12['id'],'type':_0xd8e613[_0x5903('0x28')],'sectionId':_0xd8e613['id']},{})[_0x5903('0x24')](function(){return _0x37bf1b;});}else{return _0x37bf1b;}})['catch'](function(_0x266c0c){logger[_0x5903('0x56')](_0x5903('0x57'),_0x266c0c);throw _0x266c0c;});}return _0x37bf1b;})[_0x5903('0x24')](respondWithResult(_0x186379,0xc9))[_0x5903('0x48')](handleError(_0x186379,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7528997..3a8bd60 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 _0xeac9=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1d24ca,_0x196894){var _0x15bd4f=function(_0x9b6581){while(--_0x9b6581){_0x1d24ca['push'](_0x1d24ca['shift']());}};_0x15bd4f(++_0x196894);}(_0xeac9,0x185));var _0x9eac=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xeac9[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x9eac('0x0'));var util=require('util');var logger=require(_0x9eac('0x1'))('api');var moment=require(_0x9eac('0x2'));var BPromise=require(_0x9eac('0x3'));var rp=require(_0x9eac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eac('0x5'));var config=require(_0x9eac('0x6'));var attributes=require(_0x9eac('0x7'));module[_0x9eac('0x8')]=function(_0x43b930,_0x546b6f){return _0x43b930['define'](_0x9eac('0x9'),attributes,{'tableName':_0x9eac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9eac('0xb')});}; \ No newline at end of file +var _0x7b08=['define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x7b08,0x163));var _0x87b0=function(_0x94ea80,_0x52bd9b){_0x94ea80=_0x94ea80-0x0;var _0x478a29=_0x7b08[_0x94ea80];return _0x478a29;};'use strict';var _=require(_0x87b0('0x0'));var util=require('util');var logger=require(_0x87b0('0x1'))(_0x87b0('0x2'));var moment=require(_0x87b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x87b0('0x4'));var fs=require('fs');var path=require(_0x87b0('0x5'));var rimraf=require(_0x87b0('0x6'));var config=require(_0x87b0('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x87b0('0x8')]=function(_0x2b7526,_0x233040){return _0x2b7526[_0x87b0('0x9')](_0x87b0('0xa'),attributes,{'tableName':_0x87b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87b0('0xc'),'collate':_0x87b0('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6e8383b..024ecca 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(_0x42740d,_0xfb101c){var _0x32dd2d=function(_0x1667d4){while(--_0x1667d4){_0x42740d['push'](_0x42740d['shift']());}};_0x32dd2d(++_0xfb101c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x448bae,_0x38b74e){var _0x4614ae=function(_0x1607d9){while(--_0x1607d9){_0x448bae['push'](_0x448bae['shift']());}};_0x4614ae(++_0x38b74e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 0a7aa8d..1f5fe1d 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 _0x70c9=['exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x70c9,0x100));var _0x970c=function(_0x48816f,_0x49e36b){_0x48816f=_0x48816f-0x0;var _0x2af943=_0x70c9[_0x48816f];return _0x2af943;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x970c('0x0'));var express=require(_0x970c('0x1'));var router=express[_0x970c('0x2')]();var fs_extra=require(_0x970c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x970c('0x4'));var config=require(_0x970c('0x5'));var controller=require(_0x970c('0x6'));router[_0x970c('0x7')]('/',auth[_0x970c('0x8')](),controller[_0x970c('0x9')]);router[_0x970c('0x7')](_0x970c('0xa'),auth[_0x970c('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x970c('0xb')]);router[_0x970c('0xc')](_0x970c('0xa'),auth['isAuthenticated'](),controller[_0x970c('0xd')]);router[_0x970c('0xe')]('/:id',auth[_0x970c('0x8')](),controller[_0x970c('0xf')]);module[_0x970c('0x10')]=router; \ No newline at end of file +var _0xe948=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x26b1e7,_0x2d90c0){var _0x5b7029=function(_0x74f187){while(--_0x74f187){_0x26b1e7['push'](_0x26b1e7['shift']());}};_0x5b7029(++_0x2d90c0);}(_0xe948,0xf7));var _0x8e94=function(_0x3074ae,_0x1fc12c){_0x3074ae=_0x3074ae-0x0;var _0x482baf=_0xe948[_0x3074ae];return _0x482baf;};'use strict';var multer=require(_0x8e94('0x0'));var util=require(_0x8e94('0x1'));var path=require('path');var timeout=require(_0x8e94('0x2'));var express=require('express');var router=express[_0x8e94('0x3')]();var fs_extra=require(_0x8e94('0x4'));var auth=require(_0x8e94('0x5'));var interaction=require(_0x8e94('0x6'));var config=require(_0x8e94('0x7'));var controller=require('./cannedAnswer.controller');router[_0x8e94('0x8')]('/',auth[_0x8e94('0x9')](),controller[_0x8e94('0xa')]);router[_0x8e94('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8e94('0xb')]);router['post']('/',auth[_0x8e94('0x9')](),controller[_0x8e94('0xc')]);router[_0x8e94('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8e94('0xe')]);router['delete'](_0x8e94('0xf'),auth[_0x8e94('0x9')](),controller[_0x8e94('0x10')]);module[_0x8e94('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8468397..42025ea 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 _0xe5b5=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x4a71de,_0x5cdd49){var _0x54cfc5=function(_0x35c451){while(--_0x35c451){_0x4a71de['push'](_0x4a71de['shift']());}};_0x54cfc5(++_0x5cdd49);}(_0xe5b5,0x73));var _0x5e5b=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xe5b5[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require('sequelize');module[_0x5e5b('0x0')]={'calldate':{'type':Sequelize[_0x5e5b('0x1')],'allowNull':![],'defaultValue':_0x5e5b('0x2')},'clid':{'type':Sequelize[_0x5e5b('0x3')]},'src':{'type':Sequelize[_0x5e5b('0x3')]},'dst':{'type':Sequelize[_0x5e5b('0x3')]},'dcontext':{'type':Sequelize[_0x5e5b('0x3')]},'channel':{'type':Sequelize[_0x5e5b('0x3')]},'dstchannel':{'type':Sequelize[_0x5e5b('0x3')]},'lastapp':{'type':Sequelize[_0x5e5b('0x3')]},'lastdata':{'type':Sequelize[_0x5e5b('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5e5b('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5e5b('0x3')]},'amaflags':{'type':Sequelize[_0x5e5b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5e5b('0x3')]},'userfield':{'type':Sequelize[_0x5e5b('0x3')]},'uniqueid':{'type':Sequelize[_0x5e5b('0x3')]},'linkedid':{'type':Sequelize[_0x5e5b('0x3')]},'sequence':{'type':Sequelize[_0x5e5b('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5e5b('0x3')]},'tag':{'type':Sequelize[_0x5e5b('0x3')]}}; \ No newline at end of file +var _0x159b=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x38fd0b,_0x156f8a){var _0x3a53b9=function(_0x399a59){while(--_0x399a59){_0x38fd0b['push'](_0x38fd0b['shift']());}};_0x3a53b9(++_0x156f8a);}(_0x159b,0x181));var _0xb159=function(_0x291745,_0x50c9ac){_0x291745=_0x291745-0x0;var _0x5569e7=_0x159b[_0x291745];return _0x5569e7;};'use strict';var Sequelize=require(_0xb159('0x0'));module[_0xb159('0x1')]={'calldate':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'defaultValue':_0xb159('0x3')},'clid':{'type':Sequelize[_0xb159('0x4')]},'src':{'type':Sequelize[_0xb159('0x4')]},'dst':{'type':Sequelize[_0xb159('0x4')]},'dcontext':{'type':Sequelize[_0xb159('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb159('0x4')]},'lastapp':{'type':Sequelize[_0xb159('0x4')]},'lastdata':{'type':Sequelize[_0xb159('0x4')]},'duration':{'type':Sequelize[_0xb159('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb159('0x4')]},'amaflags':{'type':Sequelize[_0xb159('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb159('0x4')]},'userfield':{'type':Sequelize[_0xb159('0x4')]},'uniqueid':{'type':Sequelize[_0xb159('0x4')]},'linkedid':{'type':Sequelize[_0xb159('0x4')]},'sequence':{'type':Sequelize[_0xb159('0x4')]},'peeraccount':{'type':Sequelize[_0xb159('0x4')]},'type':{'type':Sequelize[_0xb159('0x4')]},'tag':{'type':Sequelize[_0xb159('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e17a925..a0c0432 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 _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x1db9,0x176));var _0x91db=function(_0x21d156,_0x52e781){_0x21d156=_0x21d156-0x0;var _0x3d4971=_0x1db9[_0x21d156];return _0x3d4971;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['Cdr'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['Cdr']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file +var _0x8ef6=['includeAll','include','rows','catch','show','params','find','create','body','update','describe','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','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','count'];(function(_0x5a57ae,_0x1262ce){var _0x41b7e9=function(_0x21ab3f){while(--_0x21ab3f){_0x5a57ae['push'](_0x5a57ae['shift']());}};_0x41b7e9(++_0x1262ce);}(_0x8ef6,0xf2));var _0x68ef=function(_0x173870,_0x348a7d){_0x173870=_0x173870-0x0;var _0x1ea06b=_0x8ef6[_0x173870];return _0x1ea06b;};'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'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x13280b,_0x5e4dbe){return function(_0x178460){if(!_0x178460){_0x13280b['sendStatus'](0x194);}return _0x178460;};}function handleError(_0x599243,_0x55d8b0){_0x55d8b0=_0x55d8b0||0x1f4;return function(_0x1a7ce1){logger[_0x68ef('0x29')](_0x1a7ce1[_0x68ef('0x2a')]);if(_0x1a7ce1[_0x68ef('0x2b')]){delete _0x1a7ce1['name'];}_0x599243['status'](_0x55d8b0)[_0x68ef('0x2c')](_0x1a7ce1);};}exports[_0x68ef('0x2d')]=function(_0x7bf96,_0x263b30){var _0x22ef25={},_0x201884={},_0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x2e')][_0x68ef('0x2f')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x30')]['key']};});_0x201884[_0x68ef('0x31')]=_[_0x68ef('0x32')](_0x4579cb,'name');_0x201884['query']=_[_0x68ef('0x33')](_0x7bf96[_0x68ef('0x34')]);_0x201884['filters']=_[_0x68ef('0x35')](_0x201884[_0x68ef('0x31')],_0x201884[_0x68ef('0x34')]);_0x22ef25[_0x68ef('0x36')]=_['intersection'](_0x201884[_0x68ef('0x31')],qs[_0x68ef('0x37')](_0x7bf96['query'][_0x68ef('0x37')]));_0x22ef25['attributes']=_0x22ef25[_0x68ef('0x36')][_0x68ef('0x38')]?_0x22ef25['attributes']:_0x201884[_0x68ef('0x31')];if(!_0x7bf96['query'][_0x68ef('0x39')]('nolimit')){_0x22ef25[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x7bf96[_0x68ef('0x34')]['limit']);_0x22ef25[_0x68ef('0x1f')]=qs['offset'](_0x7bf96[_0x68ef('0x34')]['offset']);}_0x22ef25[_0x68ef('0x3a')]=qs[_0x68ef('0x3b')](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3b')]);_0x22ef25[_0x68ef('0x3c')]=qs[_0x68ef('0x3d')](_['pick'](_0x7bf96[_0x68ef('0x34')],_0x201884[_0x68ef('0x3d')]),_0x4579cb);if(_0x7bf96[_0x68ef('0x34')]['filter']){_0x22ef25[_0x68ef('0x3c')]=_[_0x68ef('0x3e')](_0x22ef25[_0x68ef('0x3c')],{'$or':_['map'](_0x4579cb,function(_0x49f260){if(_0x49f260[_0x68ef('0x30')]!==_0x68ef('0x3f')){var _0x36213a={};_0x36213a[_0x49f260[_0x68ef('0x2b')]]={'$like':'%'+_0x7bf96[_0x68ef('0x34')][_0x68ef('0x40')]+'%'};return _0x36213a;}})});}_0x22ef25=_[_0x68ef('0x3e')]({},_0x22ef25,_0x7bf96['options']);var _0xaf7df1={'where':_0x22ef25[_0x68ef('0x3c')]};return db[_0x68ef('0x2e')][_0x68ef('0x41')](_0xaf7df1)['then'](function(_0x3cb156){_0x26288a[_0x68ef('0x41')]=_0x3cb156;if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x42')]){_0x22ef25[_0x68ef('0x43')]=[{'all':!![]}];}return db[_0x68ef('0x2e')]['findAll'](_0x22ef25);})[_0x68ef('0x27')](function(_0x3f7699){_0x26288a[_0x68ef('0x44')]=_0x3f7699;return _0x26288a;})[_0x68ef('0x27')](respondWithFilteredResult(_0x263b30,_0x22ef25))[_0x68ef('0x45')](handleError(_0x263b30,null));};exports[_0x68ef('0x46')]=function(_0x13ee90,_0xd6a0b5){var _0xc687ab={'raw':!![],'where':{'id':_0x13ee90[_0x68ef('0x47')]['id']}},_0x531096={};_0x531096[_0x68ef('0x31')]=_[_0x68ef('0x33')](db[_0x68ef('0x2e')][_0x68ef('0x2f')]);_0x531096[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x13ee90['query']);_0x531096[_0x68ef('0x3d')]=_['intersection'](_0x531096[_0x68ef('0x31')],_0x531096[_0x68ef('0x34')]);_0xc687ab[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x531096['model'],qs[_0x68ef('0x37')](_0x13ee90['query'][_0x68ef('0x37')]));_0xc687ab['attributes']=_0xc687ab[_0x68ef('0x36')][_0x68ef('0x38')]?_0xc687ab[_0x68ef('0x36')]:_0x531096['model'];if(_0x13ee90['query'][_0x68ef('0x42')]){_0xc687ab[_0x68ef('0x43')]=[{'all':!![]}];}_0xc687ab=_['merge']({},_0xc687ab,_0x13ee90['options']);return db['Cdr'][_0x68ef('0x48')](_0xc687ab)[_0x68ef('0x27')](handleEntityNotFound(_0xd6a0b5,null))[_0x68ef('0x27')](respondWithResult(_0xd6a0b5,null))[_0x68ef('0x45')](handleError(_0xd6a0b5,null));};exports[_0x68ef('0x49')]=function(_0x583566,_0x55f385){return db[_0x68ef('0x2e')][_0x68ef('0x49')](_0x583566[_0x68ef('0x4a')],{})[_0x68ef('0x27')](respondWithResult(_0x55f385,0xc9))['catch'](handleError(_0x55f385,null));};exports[_0x68ef('0x4b')]=function(_0x474e5a,_0x1c9b6f){if(_0x474e5a[_0x68ef('0x4a')]['id']){delete _0x474e5a['body']['id'];}return db['Cdr'][_0x68ef('0x48')]({'where':{'id':_0x474e5a[_0x68ef('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c9b6f,null))[_0x68ef('0x27')](saveUpdates(_0x474e5a[_0x68ef('0x4a')],null))[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,null))[_0x68ef('0x45')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x28')]=function(_0x4f0f77,_0x35d6bd){return db[_0x68ef('0x2e')][_0x68ef('0x48')]({'where':{'id':_0x4f0f77['params']['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x35d6bd,null))[_0x68ef('0x27')](removeEntity(_0x35d6bd,null))[_0x68ef('0x45')](handleError(_0x35d6bd,null));};exports['describe']=function(_0x7dce90,_0x59e8ee){return db['Cdr'][_0x68ef('0x4c')]()['then'](respondWithResult(_0x59e8ee,null))[_0x68ef('0x45')](handleError(_0x59e8ee,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index addafbd..d849ef9 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(_0x486646,_0xe6be46){var _0x491073=function(_0x1cf06d){while(--_0x1cf06d){_0x486646['push'](_0x486646['shift']());}};_0x491073(++_0xe6be46);}(_0x7a54,0x106));var _0x47a5=function(_0x1fd5ad,_0x25f6da){_0x1fd5ad=_0x1fd5ad-0x0;var _0xf71721=_0x7a54[_0x1fd5ad];return _0xf71721;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x18c326,_0xc049d){var _0x20cb7b=function(_0x4020d7){while(--_0x4020d7){_0x18c326['push'](_0x18c326['shift']());}};_0x20cb7b(++_0xc049d);}(_0x7a54,0x106));var _0x47a5=function(_0x12fe0e,_0x2cdba4){_0x12fe0e=_0x12fe0e-0x0;var _0x3890d2=_0x7a54[_0x12fe0e];return _0x3890d2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6c1dc14..5bee1f0 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 _0x501e=['http','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x501e,0x10f));var _0xe501=function(_0x15fcfb,_0x31f39f){_0x15fcfb=_0x15fcfb-0x0;var _0x461eed=_0x501e[_0x15fcfb];return _0x461eed;};'use strict';var _=require('lodash');var util=require(_0xe501('0x0'));var moment=require(_0xe501('0x1'));var BPromise=require(_0xe501('0x2'));var rs=require(_0xe501('0x3'));var fs=require('fs');var Redis=require(_0xe501('0x4'));var db=require(_0xe501('0x5'))['db'];var utils=require(_0xe501('0x6'));var logger=require('../../config/logger')(_0xe501('0x7'));var config=require(_0xe501('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f2b3e,_0x5da5ad,_0x35ebce){return new BPromise(function(_0x14e29d,_0x3aae9d){return client[_0xe501('0xa')](_0x4f2b3e,_0x35ebce)[_0xe501('0xb')](function(_0x37ed0e){logger[_0xe501('0xc')](_0xe501('0xd'),_0x5da5ad,'request\x20sent');logger['debug'](_0xe501('0xe'),_0x5da5ad,'request\x20sent',JSON['stringify'](_0x37ed0e));if(_0x37ed0e[_0xe501('0xf')]){if(_0x37ed0e[_0xe501('0xf')]['code']===0x1f4){logger[_0xe501('0xf')]('Cdr,\x20%s,\x20%s',_0x5da5ad,_0x37ed0e['error']['message']);return _0x3aae9d(_0x37ed0e['error'][_0xe501('0x10')]);}logger[_0xe501('0xf')](_0xe501('0xd'),_0x5da5ad,_0x37ed0e[_0xe501('0xf')][_0xe501('0x10')]);return _0x14e29d(_0x37ed0e['error']['message']);}else{logger[_0xe501('0xc')](_0xe501('0xd'),_0x5da5ad,_0xe501('0x11'));_0x14e29d(_0x37ed0e[_0xe501('0x12')][_0xe501('0x10')]);}})[_0xe501('0x13')](function(_0x1ee9ea){logger[_0xe501('0xf')]('Cdr,\x20%s,\x20%s',_0x5da5ad,_0x1ee9ea);_0x3aae9d(_0x1ee9ea);});});} \ No newline at end of file +var _0xdb06=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xdb06,0x1b5));var _0x6db0=function(_0x3dbaa0,_0x28aca0){_0x3dbaa0=_0x3dbaa0-0x0;var _0xbebe6c=_0xdb06[_0x3dbaa0];return _0xbebe6c;};'use strict';var _=require('lodash');var util=require(_0x6db0('0x0'));var moment=require(_0x6db0('0x1'));var BPromise=require(_0x6db0('0x2'));var rs=require(_0x6db0('0x3'));var fs=require('fs');var Redis=require(_0x6db0('0x4'));var db=require(_0x6db0('0x5'))['db'];var utils=require(_0x6db0('0x6'));var logger=require(_0x6db0('0x7'))(_0x6db0('0x8'));var config=require(_0x6db0('0x9'));var jayson=require(_0x6db0('0xa'));var client=jayson['client'][_0x6db0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c66c,_0x51d091,_0x137d0b){return new BPromise(function(_0xa437dc,_0x4b512d){return client[_0x6db0('0xc')](_0x56c66c,_0x137d0b)['then'](function(_0x3bc29a){logger[_0x6db0('0xd')]('Cdr,\x20%s,\x20%s',_0x51d091,_0x6db0('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x51d091,_0x6db0('0xe'),JSON['stringify'](_0x3bc29a));if(_0x3bc29a['error']){if(_0x3bc29a[_0x6db0('0xf')][_0x6db0('0x10')]===0x1f4){logger[_0x6db0('0xf')](_0x6db0('0x11'),_0x51d091,_0x3bc29a[_0x6db0('0xf')][_0x6db0('0x12')]);return _0x4b512d(_0x3bc29a['error'][_0x6db0('0x12')]);}logger[_0x6db0('0xf')](_0x6db0('0x11'),_0x51d091,_0x3bc29a[_0x6db0('0xf')][_0x6db0('0x12')]);return _0xa437dc(_0x3bc29a[_0x6db0('0xf')][_0x6db0('0x12')]);}else{logger[_0x6db0('0xd')](_0x6db0('0x11'),_0x51d091,_0x6db0('0xe'));_0xa437dc(_0x3bc29a[_0x6db0('0x13')][_0x6db0('0x12')]);}})[_0x6db0('0x14')](function(_0x48434d){logger[_0x6db0('0xf')](_0x6db0('0x11'),_0x51d091,_0x48434d);_0x4b512d(_0x48434d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d082687..8bf60e1 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(_0x475b7d,_0x3e1f95){var _0x2ad527=function(_0x191883){while(--_0x191883){_0x475b7d['push'](_0x475b7d['shift']());}};_0x2ad527(++_0x3e1f95);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e5f2c24..4e3a7ba 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 _0xec6a=['INTEGER','noop','exports'];(function(_0x36627b,_0x38fad5){var _0x559f29=function(_0x35a670){while(--_0x35a670){_0x36627b['push'](_0x36627b['shift']());}};_0x559f29(++_0x38fad5);}(_0xec6a,0x7a));var _0xaec6=function(_0xa72277,_0x39d86c){_0xa72277=_0xa72277-0x0;var _0x45a887=_0xec6a[_0xa72277];return _0x45a887;};'use strict';var Sequelize=require('sequelize');module[_0xaec6('0x0')]={'priority':{'type':Sequelize[_0xaec6('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaec6('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x689b=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2b543b,_0x5801fa){var _0x45bed7=function(_0x4f3c55){while(--_0x4f3c55){_0x2b543b['push'](_0x2b543b['shift']());}};_0x45bed7(++_0x5801fa);}(_0x689b,0xeb));var _0xb689=function(_0x4047f3,_0x1983c9){_0x4047f3=_0x4047f3-0x0;var _0x191af4=_0x689b[_0x4047f3];return _0x191af4;};'use strict';var Sequelize=require(_0xb689('0x0'));module[_0xb689('0x1')]={'priority':{'type':Sequelize[_0xb689('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb689('0x3')],'allowNull':![],'defaultValue':_0xb689('0x4')},'appdata':{'type':Sequelize[_0xb689('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb689('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 16e2bbd..c794dd0 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 _0xefe2=['count','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xefe2,0xd9));var _0x2efe=function(_0xa45c45,_0x2de75d){_0xa45c45=_0xa45c45-0x0;var _0x5ab426=_0xefe2[_0xa45c45];return _0x5ab426;};'use strict';var emlformat=require(_0x2efe('0x0'));var rimraf=require(_0x2efe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2efe('0x2'));var rp=require(_0x2efe('0x3'));var moment=require('moment');var BPromise=require(_0x2efe('0x4'));var Mustache=require('mustache');var util=require(_0x2efe('0x5'));var path=require(_0x2efe('0x6'));var sox=require(_0x2efe('0x7'));var csv=require(_0x2efe('0x8'));var ejs=require(_0x2efe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2efe('0xa'));var squel=require(_0x2efe('0xb'));var crypto=require(_0x2efe('0xc'));var jsforce=require(_0x2efe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2efe('0x8'));var querystring=require(_0x2efe('0xe'));var Papa=require(_0x2efe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2efe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2efe('0x11'))(_0x2efe('0x12'));var utils=require(_0x2efe('0x13'));var config=require(_0x2efe('0x14'));var licenseUtil=require(_0x2efe('0x15'));var db=require(_0x2efe('0x16'))['db'];function respondWithStatusCode(_0x39a93b,_0x250023){_0x250023=_0x250023||0xcc;return function(_0x41039a){if(_0x41039a){return _0x39a93b[_0x2efe('0x17')](_0x250023);}return _0x39a93b['status'](_0x250023)['end']();};}function respondWithResult(_0x28681f,_0x1d9e5c){_0x1d9e5c=_0x1d9e5c||0xc8;return function(_0x562753){if(_0x562753){return _0x28681f['status'](_0x1d9e5c)[_0x2efe('0x18')](_0x562753);}};}function respondWithFilteredResult(_0x5195c8,_0x235af3){return function(_0x3b8b31){if(_0x3b8b31){var _0x51cbf3=typeof _0x235af3[_0x2efe('0x19')]===_0x2efe('0x1a')&&typeof _0x235af3['limit']===_0x2efe('0x1a');var _0x499c70=_0x3b8b31['count'];var _0xefd47=_0x51cbf3?0x0:_0x235af3[_0x2efe('0x19')];var _0x16acde=_0x51cbf3?_0x3b8b31[_0x2efe('0x1b')]:_0x235af3[_0x2efe('0x19')]+_0x235af3[_0x2efe('0x1c')];var _0x3017a7;if(_0x16acde>=_0x499c70){_0x16acde=_0x499c70;_0x3017a7=0xc8;}else{_0x3017a7=0xce;}_0x5195c8[_0x2efe('0x1d')](_0x3017a7);return _0x5195c8[_0x2efe('0x1e')](_0x2efe('0x1f'),_0xefd47+'-'+_0x16acde+'/'+_0x499c70)[_0x2efe('0x18')](_0x3b8b31);}return null;};}function patchUpdates(_0x6962df){return function(_0x491958){try{jsonpatch[_0x2efe('0x20')](_0x491958,_0x6962df,!![]);}catch(_0x538f39){return BPromise[_0x2efe('0x21')](_0x538f39);}return _0x491958[_0x2efe('0x22')]();};}function saveUpdates(_0x30ed16,_0x4ebeb6){return function(_0x131169){if(_0x131169){return _0x131169[_0x2efe('0x23')](_0x30ed16)['then'](function(_0x1c4a8d){return _0x1c4a8d;});}return null;};}function removeEntity(_0x368d08,_0xc24859){return function(_0x319b7f){if(_0x319b7f){return _0x319b7f[_0x2efe('0x24')]()[_0x2efe('0x25')](function(){_0x368d08[_0x2efe('0x1d')](0xcc)[_0x2efe('0x26')]();});}};}function handleEntityNotFound(_0x3d4449,_0x301cf2){return function(_0x1beaad){if(!_0x1beaad){_0x3d4449[_0x2efe('0x17')](0x194);}return _0x1beaad;};}function handleError(_0x3059c7,_0x255330){_0x255330=_0x255330||0x1f4;return function(_0x4c5118){logger[_0x2efe('0x27')](_0x4c5118[_0x2efe('0x28')]);if(_0x4c5118[_0x2efe('0x29')]){delete _0x4c5118[_0x2efe('0x29')];}_0x3059c7[_0x2efe('0x1d')](_0x255330)[_0x2efe('0x2a')](_0x4c5118);};}exports[_0x2efe('0x2b')]=function(_0xa11a23,_0x4039cb){var _0x33124f={'raw':!![],'where':{'id':_0xa11a23[_0x2efe('0x2c')]['id']}},_0x56b011={};_0x56b011[_0x2efe('0x2d')]=_[_0x2efe('0x2e')](db[_0x2efe('0x2f')][_0x2efe('0x30')]);_0x56b011['query']=_[_0x2efe('0x2e')](_0xa11a23[_0x2efe('0x31')]);_0x56b011[_0x2efe('0x32')]=_[_0x2efe('0x33')](_0x56b011[_0x2efe('0x2d')],_0x56b011[_0x2efe('0x31')]);_0x33124f[_0x2efe('0x34')]=_[_0x2efe('0x33')](_0x56b011[_0x2efe('0x2d')],qs[_0x2efe('0x35')](_0xa11a23['query'][_0x2efe('0x35')]));_0x33124f[_0x2efe('0x34')]=_0x33124f[_0x2efe('0x34')][_0x2efe('0x36')]?_0x33124f[_0x2efe('0x34')]:_0x56b011[_0x2efe('0x2d')];if(_0xa11a23[_0x2efe('0x31')][_0x2efe('0x37')]){_0x33124f[_0x2efe('0x38')]=[{'all':!![]}];}_0x33124f=_['merge']({},_0x33124f,_0xa11a23[_0x2efe('0x39')]);return db[_0x2efe('0x2f')]['find'](_0x33124f)['then'](handleEntityNotFound(_0x4039cb,null))['then'](respondWithResult(_0x4039cb,null))[_0x2efe('0x3a')](handleError(_0x4039cb,null));};exports[_0x2efe('0x23')]=function(_0x38e44f,_0x5a8ba4){if(_0x38e44f[_0x2efe('0x3b')]['id']){delete _0x38e44f[_0x2efe('0x3b')]['id'];}return db[_0x2efe('0x2f')]['find']({'where':{'id':_0x38e44f['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x5a8ba4,null))['then'](saveUpdates(_0x38e44f[_0x2efe('0x3b')],null))[_0x2efe('0x25')](respondWithResult(_0x5a8ba4,null))[_0x2efe('0x3a')](handleError(_0x5a8ba4,null));};exports['destroy']=function(_0xd3ce22,_0x2ec0cd){return db[_0x2efe('0x2f')][_0x2efe('0x3c')]({'where':{'id':_0xd3ce22[_0x2efe('0x2c')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x2ec0cd,null))[_0x2efe('0x25')](removeEntity(_0x2ec0cd,null))['catch'](handleError(_0x2ec0cd,null));}; \ No newline at end of file +var _0x087b=['undefined','count','set','apply','reject','save','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','options','find','catch','update','body','params','destroy','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','sendStatus','status','end','json','offset','limit'];(function(_0x4ed370,_0x2c6084){var _0x49ce02=function(_0x13abb0){while(--_0x13abb0){_0x4ed370['push'](_0x4ed370['shift']());}};_0x49ce02(++_0x2c6084);}(_0x087b,0x11a));var _0xb087=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x087b[_0x39e84d];return _0x1991bc;};'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'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={'raw':!![],'where':{'id':_0x18058c['params']['id']}},_0x263259={};_0x263259[_0xb087('0x2d')]=_[_0xb087('0x2e')](db[_0xb087('0x2f')][_0xb087('0x30')]);_0x263259[_0xb087('0x31')]=_[_0xb087('0x2e')](_0x18058c[_0xb087('0x31')]);_0x263259[_0xb087('0x32')]=_['intersection'](_0x263259['model'],_0x263259[_0xb087('0x31')]);_0xb0baf6[_0xb087('0x33')]=_['intersection'](_0x263259[_0xb087('0x2d')],qs[_0xb087('0x34')](_0x18058c[_0xb087('0x31')][_0xb087('0x34')]));_0xb0baf6[_0xb087('0x33')]=_0xb0baf6[_0xb087('0x33')][_0xb087('0x35')]?_0xb0baf6[_0xb087('0x33')]:_0x263259[_0xb087('0x2d')];if(_0x18058c[_0xb087('0x31')][_0xb087('0x36')]){_0xb0baf6[_0xb087('0x37')]=[{'all':!![]}];}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x38')]);return db['ChatApplication'][_0xb087('0x39')](_0xb0baf6)[_0xb087('0x27')](handleEntityNotFound(_0x31e3e6,null))[_0xb087('0x27')](respondWithResult(_0x31e3e6,null))[_0xb087('0x3a')](handleError(_0x31e3e6,null));};exports[_0xb087('0x3b')]=function(_0x1a4b17,_0x32c3e8){if(_0x1a4b17[_0xb087('0x3c')]['id']){delete _0x1a4b17[_0xb087('0x3c')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x1a4b17[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x32c3e8,null))[_0xb087('0x27')](saveUpdates(_0x1a4b17[_0xb087('0x3c')],null))[_0xb087('0x27')](respondWithResult(_0x32c3e8,null))['catch'](handleError(_0x32c3e8,null));};exports[_0xb087('0x3e')]=function(_0x1fdc19,_0x48524e){return db['ChatApplication'][_0xb087('0x39')]({'where':{'id':_0x1fdc19[_0xb087('0x3d')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x48524e,null))['then'](removeEntity(_0x48524e,null))[_0xb087('0x3a')](handleError(_0x48524e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ea6b57b..5d444e5 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 _0x4604=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x4604,0x1c1));var _0x4460=function(_0x2d86cf,_0x55b01c){_0x2d86cf=_0x2d86cf-0x0;var _0x21329d=_0x4604[_0x2d86cf];return _0x21329d;};'use strict';var _=require(_0x4460('0x0'));var util=require(_0x4460('0x1'));var logger=require(_0x4460('0x2'))(_0x4460('0x3'));var moment=require(_0x4460('0x4'));var BPromise=require(_0x4460('0x5'));var rp=require(_0x4460('0x6'));var fs=require('fs');var path=require(_0x4460('0x7'));var rimraf=require(_0x4460('0x8'));var config=require(_0x4460('0x9'));var attributes=require('./chatApplication.attributes');module[_0x4460('0xa')]=function(_0x3c0aea,_0x11c63d){return _0x3c0aea[_0x4460('0xb')](_0x4460('0xc'),attributes,{'tableName':_0x4460('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4460('0xe'),'collate':_0x4460('0xf')});}; \ No newline at end of file +var _0x78ee=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x78ee,0x1d2));var _0xe78e=function(_0x62527e,_0x4bbab3){_0x62527e=_0x62527e-0x0;var _0x517915=_0x78ee[_0x62527e];return _0x517915;};'use strict';var _=require(_0xe78e('0x0'));var util=require(_0xe78e('0x1'));var logger=require(_0xe78e('0x2'))(_0xe78e('0x3'));var moment=require('moment');var BPromise=require(_0xe78e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe78e('0x5'));var rimraf=require(_0xe78e('0x6'));var config=require(_0xe78e('0x7'));var attributes=require('./chatApplication.attributes');module[_0xe78e('0x8')]=function(_0x3bce35,_0x45a07a){return _0x3bce35['define'](_0xe78e('0x9'),attributes,{'tableName':_0xe78e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe78e('0xb'),'collate':_0xe78e('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d2aa7f4..34fe0dd 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 _0x7dfb=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfb,0xeb));var _0xb7df=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x7dfb[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xb7df('0x0'));var util=require(_0xb7df('0x1'));var moment=require(_0xb7df('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb7df('0x4'));var logger=require('../../config/logger')(_0xb7df('0x5'));var config=require(_0xb7df('0x6'));var jayson=require(_0xb7df('0x7'));var client=jayson[_0xb7df('0x8')][_0xb7df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b9e3d,_0x25e646,_0xb9bdbe){return new BPromise(function(_0x53f783,_0x61db18){return client[_0xb7df('0xa')](_0x1b9e3d,_0xb9bdbe)[_0xb7df('0xb')](function(_0x52d087){logger['info']('ChatApplication,\x20%s,\x20%s',_0x25e646,_0xb7df('0xc'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x25e646,_0xb7df('0xc'),JSON[_0xb7df('0xd')](_0x52d087));if(_0x52d087[_0xb7df('0xe')]){if(_0x52d087['error'][_0xb7df('0xf')]===0x1f4){logger[_0xb7df('0xe')]('ChatApplication,\x20%s,\x20%s',_0x25e646,_0x52d087[_0xb7df('0xe')][_0xb7df('0x10')]);return _0x61db18(_0x52d087[_0xb7df('0xe')][_0xb7df('0x10')]);}logger[_0xb7df('0xe')](_0xb7df('0x11'),_0x25e646,_0x52d087[_0xb7df('0xe')][_0xb7df('0x10')]);return _0x53f783(_0x52d087['error'][_0xb7df('0x10')]);}else{logger['info'](_0xb7df('0x11'),_0x25e646,_0xb7df('0xc'));_0x53f783(_0x52d087[_0xb7df('0x12')][_0xb7df('0x10')]);}})[_0xb7df('0x13')](function(_0x32728b){logger[_0xb7df('0xe')](_0xb7df('0x11'),_0x25e646,_0x32728b);_0x61db18(_0x32728b);});});} \ No newline at end of file +var _0xf59c=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x74b290,_0x63b76c){var _0x2f8127=function(_0x338bc7){while(--_0x338bc7){_0x74b290['push'](_0x74b290['shift']());}};_0x2f8127(++_0x63b76c);}(_0xf59c,0xce));var _0xcf59=function(_0x2e459b,_0x253345){_0x2e459b=_0x2e459b-0x0;var _0x1a0c26=_0xf59c[_0x2e459b];return _0x1a0c26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf59('0x0'));var BPromise=require(_0xcf59('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf59('0x2'));var db=require(_0xcf59('0x3'))['db'];var utils=require(_0xcf59('0x4'));var logger=require(_0xcf59('0x5'))(_0xcf59('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcf59('0x7')][_0xcf59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20d94d,_0x51d117,_0x59592e){return new BPromise(function(_0x33e1a8,_0x2159be){return client[_0xcf59('0x9')](_0x20d94d,_0x59592e)[_0xcf59('0xa')](function(_0x2b6f86){logger['info']('ChatApplication,\x20%s,\x20%s',_0x51d117,_0xcf59('0xb'));logger[_0xcf59('0xc')](_0xcf59('0xd'),_0x51d117,'request\x20sent',JSON[_0xcf59('0xe')](_0x2b6f86));if(_0x2b6f86[_0xcf59('0xf')]){if(_0x2b6f86[_0xcf59('0xf')][_0xcf59('0x10')]===0x1f4){logger['error'](_0xcf59('0x11'),_0x51d117,_0x2b6f86[_0xcf59('0xf')][_0xcf59('0x12')]);return _0x2159be(_0x2b6f86[_0xcf59('0xf')][_0xcf59('0x12')]);}logger[_0xcf59('0xf')]('ChatApplication,\x20%s,\x20%s',_0x51d117,_0x2b6f86[_0xcf59('0xf')][_0xcf59('0x12')]);return _0x33e1a8(_0x2b6f86[_0xcf59('0xf')][_0xcf59('0x12')]);}else{logger[_0xcf59('0x13')](_0xcf59('0x11'),_0x51d117,_0xcf59('0xb'));_0x33e1a8(_0x2b6f86[_0xcf59('0x14')]['message']);}})[_0xcf59('0x15')](function(_0x4743df){logger[_0xcf59('0xf')](_0xcf59('0x11'),_0x51d117,_0x4743df);_0x2159be(_0x4743df);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ce6c78d..4e88eeb 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 _0x2085=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','show','isAuthenticated','update','delete','exports'];(function(_0x3cdedd,_0xa88e7){var _0x298830=function(_0x120f95){while(--_0x120f95){_0x3cdedd['push'](_0x3cdedd['shift']());}};_0x298830(++_0xa88e7);}(_0x2085,0x188));var _0x5208=function(_0x3322a0,_0xc75fc7){_0x3322a0=_0x3322a0-0x0;var _0x15be8e=_0x2085[_0x3322a0];return _0x15be8e;};'use strict';var multer=require(_0x5208('0x0'));var util=require(_0x5208('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5208('0x2'));var router=express['Router']();var fs_extra=require(_0x5208('0x3'));var auth=require(_0x5208('0x4'));var interaction=require(_0x5208('0x5'));var config=require('../../config/environment');var controller=require(_0x5208('0x6'));router[_0x5208('0x7')](_0x5208('0x8'),auth['isAuthenticated'](),controller[_0x5208('0x9')]);router['put'](_0x5208('0x8'),auth[_0x5208('0xa')](),controller[_0x5208('0xb')]);router[_0x5208('0xc')](_0x5208('0x8'),auth[_0x5208('0xa')](),controller['destroy']);module[_0x5208('0xd')]=router; \ No newline at end of file +var _0x7f11=['get','/:id','isAuthenticated','show','put','update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x5cfbe2,_0x584c44){var _0x3e4502=function(_0x5c2448){while(--_0x5c2448){_0x5cfbe2['push'](_0x5cfbe2['shift']());}};_0x3e4502(++_0x584c44);}(_0x7f11,0x1ca));var _0x17f1=function(_0x87e81b,_0x2ddb31){_0x87e81b=_0x87e81b-0x0;var _0x1d4c78=_0x7f11[_0x87e81b];return _0x1d4c78;};'use strict';var multer=require('multer');var util=require(_0x17f1('0x0'));var path=require('path');var timeout=require(_0x17f1('0x1'));var express=require(_0x17f1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x17f1('0x3'));var interaction=require(_0x17f1('0x4'));var config=require(_0x17f1('0x5'));var controller=require(_0x17f1('0x6'));router[_0x17f1('0x7')](_0x17f1('0x8'),auth[_0x17f1('0x9')](),controller[_0x17f1('0xa')]);router[_0x17f1('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x17f1('0xc')]);router[_0x17f1('0xd')]('/:id',auth[_0x17f1('0x9')](),controller['destroy']);module[_0x17f1('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ae88a14..7ff541e 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 _0xa965=['STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa965,0x172));var _0x5a96=function(_0x55e111,_0x391f5a){_0x55e111=_0x55e111-0x0;var _0x30d69c=_0xa965[_0x55e111];return _0x30d69c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5a96('0x0')]},'write':{'type':Sequelize[_0x5a96('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6093=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5ca3de,_0x2039bd){var _0x1b1740=function(_0x3e299b){while(--_0x3e299b){_0x5ca3de['push'](_0x5ca3de['shift']());}};_0x1b1740(++_0x2039bd);}(_0x6093,0x107));var _0x3609=function(_0x5aedae,_0x30f360){_0x5aedae=_0x5aedae-0x0;var _0x43bce5=_0x6093[_0x5aedae];return _0x43bce5;};'use strict';var Sequelize=require(_0x3609('0x0'));module[_0x3609('0x1')]={'name':{'type':Sequelize[_0x3609('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3609('0x2')]},'write':{'type':Sequelize[_0x3609('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cb0474b..43ae632 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 _0x74de=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','addMembers','ids','findOne','User','order','filter','addMessage','ChatGroupId','getMessages','$gte','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','ChatGroup','rawAttributes','key'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x74de,0x8a));var _0xe74d=function(_0x74566a,_0x4398d0){_0x74566a=_0x74566a-0x0;var _0x313fd6=_0x74de[_0x74566a];return _0x313fd6;};'use strict';var emlformat=require(_0xe74d('0x0'));var rimraf=require(_0xe74d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe74d('0x2'));var rp=require(_0xe74d('0x3'));var moment=require(_0xe74d('0x4'));var BPromise=require(_0xe74d('0x5'));var Mustache=require(_0xe74d('0x6'));var util=require(_0xe74d('0x7'));var path=require(_0xe74d('0x8'));var sox=require(_0xe74d('0x9'));var csv=require('to-csv');var ejs=require(_0xe74d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe74d('0xb'));var squel=require(_0xe74d('0xc'));var crypto=require(_0xe74d('0xd'));var jsforce=require(_0xe74d('0xe'));var deskjs=require(_0xe74d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe74d('0x10'));var Papa=require(_0xe74d('0x11'));var Redis=require(_0xe74d('0x12'));var authService=require(_0xe74d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe74d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe74d('0x15'))(_0xe74d('0x16'));var utils=require(_0xe74d('0x17'));var config=require(_0xe74d('0x18'));var licenseUtil=require(_0xe74d('0x19'));var db=require('../../mysqldb')['db'];config[_0xe74d('0x1a')]=_[_0xe74d('0x1b')](config[_0xe74d('0x1a')],{'host':_0xe74d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe74d('0x1d'))[_0xe74d('0x1e')](socket);function respondWithStatusCode(_0x5fc743,_0x45e781){_0x45e781=_0x45e781||0xcc;return function(_0x5118e6){if(_0x5118e6){return _0x5fc743[_0xe74d('0x1f')](_0x45e781);}return _0x5fc743[_0xe74d('0x20')](_0x45e781)[_0xe74d('0x21')]();};}function respondWithResult(_0x5c8383,_0x4127c4){_0x4127c4=_0x4127c4||0xc8;return function(_0x25031a){if(_0x25031a){return _0x5c8383[_0xe74d('0x20')](_0x4127c4)['json'](_0x25031a);}};}function respondWithFilteredResult(_0xeb49e9,_0x30f59c){return function(_0x458135){if(_0x458135){var _0x5463bd=typeof _0x30f59c['offset']===_0xe74d('0x22')&&typeof _0x30f59c[_0xe74d('0x23')]===_0xe74d('0x22');var _0x130534=_0x458135['count'];var _0x4606d0=_0x5463bd?0x0:_0x30f59c[_0xe74d('0x24')];var _0x1ee021=_0x5463bd?_0x458135[_0xe74d('0x25')]:_0x30f59c[_0xe74d('0x24')]+_0x30f59c[_0xe74d('0x23')];var _0x4f99c0;if(_0x1ee021>=_0x130534){_0x1ee021=_0x130534;_0x4f99c0=0xc8;}else{_0x4f99c0=0xce;}_0xeb49e9['status'](_0x4f99c0);return _0xeb49e9[_0xe74d('0x26')](_0xe74d('0x27'),_0x4606d0+'-'+_0x1ee021+'/'+_0x130534)[_0xe74d('0x28')](_0x458135);}return null;};}function patchUpdates(_0x590b61){return function(_0x7f6b48){try{jsonpatch[_0xe74d('0x29')](_0x7f6b48,_0x590b61,!![]);}catch(_0x3e9af9){return BPromise[_0xe74d('0x2a')](_0x3e9af9);}return _0x7f6b48[_0xe74d('0x2b')]();};}function saveUpdates(_0x422211,_0x58e4c8){return function(_0x26a1ff){if(_0x26a1ff){return _0x26a1ff[_0xe74d('0x2c')](_0x422211)[_0xe74d('0x2d')](function(_0x4754c3){return _0x4754c3;});}return null;};}function removeEntity(_0x167127,_0x29abfe){return function(_0x5b0c10){if(_0x5b0c10){return _0x5b0c10['destroy']()[_0xe74d('0x2d')](function(){_0x167127['status'](0xcc)[_0xe74d('0x21')]();});}};}function handleEntityNotFound(_0x2e2665,_0x28a4eb){return function(_0x43cbb8){if(!_0x43cbb8){_0x2e2665['sendStatus'](0x194);}return _0x43cbb8;};}function handleError(_0x40013e,_0x4fe115){_0x4fe115=_0x4fe115||0x1f4;return function(_0x4b9bc9){logger[_0xe74d('0x2e')](_0x4b9bc9[_0xe74d('0x2f')]);if(_0x4b9bc9[_0xe74d('0x30')]){delete _0x4b9bc9[_0xe74d('0x30')];}_0x40013e[_0xe74d('0x20')](_0x4fe115)[_0xe74d('0x31')](_0x4b9bc9);};}exports['index']=function(_0x18301d,_0x2b774e){var _0x78b5cf={},_0x54e1cd={},_0x1549a3={'count':0x0,'rows':[]};var _0x557ecb=_[_0xe74d('0x32')](db[_0xe74d('0x33')][_0xe74d('0x34')],function(_0x272964){return{'name':_0x272964['fieldName'],'type':_0x272964['type'][_0xe74d('0x35')]};});_0x54e1cd[_0xe74d('0x36')]=_[_0xe74d('0x32')](_0x557ecb,_0xe74d('0x30'));_0x54e1cd[_0xe74d('0x37')]=_['keys'](_0x18301d['query']);_0x54e1cd[_0xe74d('0x38')]=_[_0xe74d('0x39')](_0x54e1cd[_0xe74d('0x36')],_0x54e1cd[_0xe74d('0x37')]);_0x78b5cf[_0xe74d('0x3a')]=_[_0xe74d('0x39')](_0x54e1cd[_0xe74d('0x36')],qs['fields'](_0x18301d['query'][_0xe74d('0x3b')]));_0x78b5cf[_0xe74d('0x3a')]=_0x78b5cf[_0xe74d('0x3a')][_0xe74d('0x3c')]?_0x78b5cf[_0xe74d('0x3a')]:_0x54e1cd[_0xe74d('0x36')];if(!_0x18301d[_0xe74d('0x37')][_0xe74d('0x3d')](_0xe74d('0x3e'))){_0x78b5cf['limit']=qs[_0xe74d('0x23')](_0x18301d[_0xe74d('0x37')][_0xe74d('0x23')]);_0x78b5cf[_0xe74d('0x24')]=qs[_0xe74d('0x24')](_0x18301d[_0xe74d('0x37')][_0xe74d('0x24')]);}_0x78b5cf['order']=qs[_0xe74d('0x3f')](_0x18301d['query']['sort']);_0x78b5cf[_0xe74d('0x40')]=qs['filters'](_[_0xe74d('0x41')](_0x18301d[_0xe74d('0x37')],_0x54e1cd[_0xe74d('0x38')]),_0x557ecb);if(_0x18301d[_0xe74d('0x37')]['filter']){_0x78b5cf[_0xe74d('0x40')]=_['merge'](_0x78b5cf[_0xe74d('0x40')],{'$or':_[_0xe74d('0x32')](_0x557ecb,function(_0xf803f8){if(_0xf803f8[_0xe74d('0x42')]!==_0xe74d('0x43')){var _0x36389e={};_0x36389e[_0xf803f8[_0xe74d('0x30')]]={'$like':'%'+_0x18301d[_0xe74d('0x37')]['filter']+'%'};return _0x36389e;}})});}_0x78b5cf=_[_0xe74d('0x44')]({},_0x78b5cf,_0x18301d[_0xe74d('0x45')]);var _0x2d3eac={'where':_0x78b5cf[_0xe74d('0x40')]};return db[_0xe74d('0x33')][_0xe74d('0x25')](_0x2d3eac)[_0xe74d('0x2d')](function(_0x425104){_0x1549a3['count']=_0x425104;if(_0x18301d[_0xe74d('0x37')]['includeAll']){_0x78b5cf[_0xe74d('0x46')]=[{'all':!![]}];}return db[_0xe74d('0x33')][_0xe74d('0x47')](_0x78b5cf);})[_0xe74d('0x2d')](function(_0x5174d8){_0x1549a3[_0xe74d('0x48')]=_0x5174d8;return _0x1549a3;})[_0xe74d('0x2d')](respondWithFilteredResult(_0x2b774e,_0x78b5cf))[_0xe74d('0x49')](handleError(_0x2b774e,null));};exports[_0xe74d('0x4a')]=function(_0x2475e9,_0x2059f6){var _0x2af665={'raw':!![],'where':{'id':_0x2475e9[_0xe74d('0x4b')]['id']}},_0xf1a7cb={};_0xf1a7cb[_0xe74d('0x36')]=_['keys'](db[_0xe74d('0x33')][_0xe74d('0x34')]);_0xf1a7cb[_0xe74d('0x37')]=_[_0xe74d('0x4c')](_0x2475e9['query']);_0xf1a7cb[_0xe74d('0x38')]=_[_0xe74d('0x39')](_0xf1a7cb['model'],_0xf1a7cb[_0xe74d('0x37')]);_0x2af665[_0xe74d('0x3a')]=_[_0xe74d('0x39')](_0xf1a7cb['model'],qs[_0xe74d('0x3b')](_0x2475e9[_0xe74d('0x37')][_0xe74d('0x3b')]));_0x2af665['attributes']=_0x2af665['attributes'][_0xe74d('0x3c')]?_0x2af665[_0xe74d('0x3a')]:_0xf1a7cb[_0xe74d('0x36')];if(_0x2475e9[_0xe74d('0x37')][_0xe74d('0x4d')]){_0x2af665['include']=[{'all':!![]}];}_0x2af665=_[_0xe74d('0x44')]({},_0x2af665,_0x2475e9[_0xe74d('0x45')]);return db['ChatGroup'][_0xe74d('0x4e')](_0x2af665)[_0xe74d('0x2d')](handleEntityNotFound(_0x2059f6,null))[_0xe74d('0x2d')](respondWithResult(_0x2059f6,null))['catch'](handleError(_0x2059f6,null));};exports[_0xe74d('0x4f')]=function(_0x3040fc,_0x3a51dc){return db['ChatGroup'][_0xe74d('0x4f')](_0x3040fc[_0xe74d('0x50')],{})['then'](respondWithResult(_0x3a51dc,0xc9))[_0xe74d('0x49')](handleError(_0x3a51dc,null));};exports[_0xe74d('0x2c')]=function(_0x398c58,_0x27fd0a){if(_0x398c58[_0xe74d('0x50')]['id']){delete _0x398c58[_0xe74d('0x50')]['id'];}return db[_0xe74d('0x33')][_0xe74d('0x4e')]({'where':{'id':_0x398c58[_0xe74d('0x4b')]['id']}})[_0xe74d('0x2d')](handleEntityNotFound(_0x27fd0a,null))[_0xe74d('0x2d')](saveUpdates(_0x398c58[_0xe74d('0x50')],null))[_0xe74d('0x2d')](respondWithResult(_0x27fd0a,null))['catch'](handleError(_0x27fd0a,null));};exports[_0xe74d('0x51')]=function(_0x34ae7d,_0x25d86c){return db[_0xe74d('0x33')][_0xe74d('0x4e')]({'where':{'id':_0x34ae7d[_0xe74d('0x4b')]['id']}})[_0xe74d('0x2d')](handleEntityNotFound(_0x25d86c,null))[_0xe74d('0x2d')](removeEntity(_0x25d86c,null))[_0xe74d('0x49')](handleError(_0x25d86c,null));};exports['describe']=function(_0x471547,_0x1fa269){return db[_0xe74d('0x33')][_0xe74d('0x52')]()[_0xe74d('0x2d')](respondWithResult(_0x1fa269,null))[_0xe74d('0x49')](handleError(_0x1fa269,null));};exports[_0xe74d('0x53')]=function(_0x35974b,_0x848a96,_0x475fea){return db[_0xe74d('0x54')][_0xe74d('0x25')]({'where':{'ChatGroupId':_0x35974b[_0xe74d('0x4b')]['id'],'ToId':_0x35974b[_0xe74d('0x55')]['id'],'read':![]}})[_0xe74d('0x2d')](function(_0x2fc010){return{'id':_['toInteger'](_0x35974b['params']['id']),'count':_0x2fc010};})['then'](respondWithResult(_0x848a96,null))[_0xe74d('0x49')](handleError(_0x848a96,null));};exports[_0xe74d('0x56')]=function(_0x218b84,_0x4f182b,_0x177898){return db[_0xe74d('0x33')][_0xe74d('0x4e')]({'where':{'id':_0x218b84[_0xe74d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f182b,null))[_0xe74d('0x2d')](function(_0x14fd8f){if(_0x14fd8f){return _0x14fd8f[_0xe74d('0x56')](_0x218b84[_0xe74d('0x50')][_0xe74d('0x57')],_['omit'](_0x218b84[_0xe74d('0x50')],['ids','id'])||{});}})[_0xe74d('0x2d')](respondWithResult(_0x4f182b,null))['catch'](handleError(_0x4f182b,null));};exports['getMembers']=function(_0x3c4b72,_0xc2a543,_0x292c02){var _0x2ed398={};var _0x32b3f1={};var _0x39f826;var _0x12b9cc;return db[_0xe74d('0x33')][_0xe74d('0x58')]({'where':{'id':_0x3c4b72['params']['id']}})[_0xe74d('0x2d')](handleEntityNotFound(_0xc2a543,null))[_0xe74d('0x2d')](function(_0x1570d6){if(_0x1570d6){_0x39f826=_0x1570d6;_0x32b3f1[_0xe74d('0x36')]=_['keys'](db[_0xe74d('0x59')][_0xe74d('0x34')]);_0x32b3f1[_0xe74d('0x37')]=_[_0xe74d('0x4c')](_0x3c4b72['query']);_0x32b3f1[_0xe74d('0x38')]=_[_0xe74d('0x39')](_0x32b3f1[_0xe74d('0x36')],_0x32b3f1[_0xe74d('0x37')]);_0x2ed398['attributes']=_[_0xe74d('0x39')](_0x32b3f1[_0xe74d('0x36')],qs[_0xe74d('0x3b')](_0x3c4b72[_0xe74d('0x37')]['fields']));_0x2ed398[_0xe74d('0x3a')]=_0x2ed398[_0xe74d('0x3a')][_0xe74d('0x3c')]?_0x2ed398[_0xe74d('0x3a')]:_0x32b3f1['model'];_0x2ed398[_0xe74d('0x5a')]=qs[_0xe74d('0x3f')](_0x3c4b72[_0xe74d('0x37')][_0xe74d('0x3f')]);_0x2ed398[_0xe74d('0x40')]=qs[_0xe74d('0x38')](_['pick'](_0x3c4b72[_0xe74d('0x37')],_0x32b3f1['filters']));if(_0x3c4b72[_0xe74d('0x37')]['filter']){_0x2ed398[_0xe74d('0x40')]=_['merge'](_0x2ed398[_0xe74d('0x40')],{'$or':_[_0xe74d('0x32')](_0x2ed398[_0xe74d('0x3a')],function(_0x24b8a9){var _0x418ee7={};_0x418ee7[_0x24b8a9]={'$like':'%'+_0x3c4b72[_0xe74d('0x37')][_0xe74d('0x5b')]+'%'};return _0x418ee7;})});}_0x2ed398=_['merge']({},_0x2ed398,_0x3c4b72[_0xe74d('0x45')]);return _0x39f826['getMembers'](_0x2ed398);}})[_0xe74d('0x2d')](function(_0x2c62a8){if(_0x2c62a8){_0x12b9cc=_0x2c62a8[_0xe74d('0x3c')];if(!_0x3c4b72['query'][_0xe74d('0x3d')](_0xe74d('0x3e'))){_0x2ed398[_0xe74d('0x23')]=qs[_0xe74d('0x23')](_0x3c4b72[_0xe74d('0x37')]['limit']);_0x2ed398[_0xe74d('0x24')]=qs['offset'](_0x3c4b72['query'][_0xe74d('0x24')]);}return _0x39f826['getMembers'](_0x2ed398);}})[_0xe74d('0x2d')](function(_0x2d3790){if(_0x2d3790){return _0x2d3790?{'count':_0x12b9cc,'rows':_0x2d3790}:null;}})[_0xe74d('0x2d')](respondWithResult(_0xc2a543,null))['catch'](handleError(_0xc2a543,null));};exports['removeMembers']=function(_0x3ddadb,_0x169c8e,_0x5db5a1){return db[_0xe74d('0x33')]['find']({'where':{'id':_0x3ddadb['params']['id']}})[_0xe74d('0x2d')](handleEntityNotFound(_0x169c8e,null))[_0xe74d('0x2d')](function(_0x3cdf07){if(_0x3cdf07){return _0x3cdf07['removeMembers'](_0x3ddadb[_0xe74d('0x37')][_0xe74d('0x57')]);}})[_0xe74d('0x2d')](respondWithStatusCode(_0x169c8e,null))[_0xe74d('0x49')](handleError(_0x169c8e,null));};exports[_0xe74d('0x5c')]=function(_0x2f96b5,_0x36e626,_0x349fa4){if(_0x2f96b5[_0xe74d('0x50')]['id']){delete _0x2f96b5[_0xe74d('0x50')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2f96b5[_0xe74d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36e626,null))[_0xe74d('0x2d')](function(_0xe0460b){if(_0xe0460b){_0x2f96b5[_0xe74d('0x50')][_0xe74d('0x5d')]=_0xe0460b['id'];return db[_0xe74d('0x54')][_0xe74d('0x4f')](_0x2f96b5[_0xe74d('0x50')]);}})[_0xe74d('0x2d')](respondWithResult(_0x36e626,null))['catch'](handleError(_0x36e626,null));};exports[_0xe74d('0x5e')]=function(_0x10c2fa,_0x575750,_0x43c23f){var _0x219551={};var _0x25b44b={};var _0x374da6;var _0x5a6afd;return db[_0xe74d('0x33')][_0xe74d('0x58')]({'where':{'id':_0x10c2fa['params']['id']}})[_0xe74d('0x2d')](handleEntityNotFound(_0x575750,null))[_0xe74d('0x2d')](function(_0x5f19a0){if(_0x5f19a0){_0x374da6=_0x5f19a0;_0x25b44b['model']=_['keys'](db[_0xe74d('0x54')][_0xe74d('0x34')]);_0x25b44b['query']=_[_0xe74d('0x4c')](_0x10c2fa[_0xe74d('0x37')]);_0x25b44b['filters']=_[_0xe74d('0x39')](_0x25b44b[_0xe74d('0x36')],_0x25b44b[_0xe74d('0x37')]);_0x219551[_0xe74d('0x3a')]=_['intersection'](_0x25b44b[_0xe74d('0x36')],qs[_0xe74d('0x3b')](_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x3b')]));_0x219551[_0xe74d('0x3a')]=_0x219551[_0xe74d('0x3a')][_0xe74d('0x3c')]?_0x219551[_0xe74d('0x3a')]:_0x25b44b[_0xe74d('0x36')];_0x219551[_0xe74d('0x5a')]=qs[_0xe74d('0x3f')](_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x3f')]);_0x219551['where']=qs[_0xe74d('0x38')](_['pick'](_0x10c2fa[_0xe74d('0x37')],_0x25b44b[_0xe74d('0x38')]));if(_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x5b')]){_0x219551[_0xe74d('0x40')]=_[_0xe74d('0x44')](_0x219551[_0xe74d('0x40')],{'$or':_[_0xe74d('0x32')](_0x219551[_0xe74d('0x3a')],function(_0x2d0f91){var _0xd1b683={};_0xd1b683[_0x2d0f91]={'$like':'%'+_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x5b')]+'%'};return _0xd1b683;})});}if(_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x5f')]){var _0x522924=_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x5f')]['split'](',');var _0x18c79e={};_0x18c79e[_0x522924[0x0]]={'$gte':moment(_0x522924[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x219551[_0xe74d('0x40')]=_[_0xe74d('0x44')](_0x219551[_0xe74d('0x40')],_0x18c79e);}_0x219551=_[_0xe74d('0x44')]({},_0x219551,_0x10c2fa['options']);return _0x374da6[_0xe74d('0x5e')](_0x219551);}})[_0xe74d('0x2d')](function(_0x26f816){if(_0x26f816){_0x5a6afd=_0x26f816[_0xe74d('0x3c')];if(!_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x3d')](_0xe74d('0x3e'))){_0x219551[_0xe74d('0x23')]=qs['limit'](_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x23')]);_0x219551[_0xe74d('0x24')]=qs['offset'](_0x10c2fa[_0xe74d('0x37')][_0xe74d('0x24')]);}return _0x374da6['getMessages'](_0x219551);}})[_0xe74d('0x2d')](function(_0x22eb5f){if(_0x22eb5f){return _0x22eb5f?{'count':_0x5a6afd,'rows':_0x22eb5f}:null;}})[_0xe74d('0x2d')](respondWithResult(_0x575750,null))[_0xe74d('0x49')](handleError(_0x575750,null));}; \ No newline at end of file +var _0xc855=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1e6161,_0x470ba3){var _0x1781c1=function(_0x25dfd4){while(--_0x25dfd4){_0x1e6161['push'](_0x1e6161['shift']());}};_0x1781c1(++_0x470ba3);}(_0xc855,0xb8));var _0x5c85=function(_0x5358d8,_0x115c37){_0x5358d8=_0x5358d8-0x0;var _0x37cf31=_0xc855[_0x5358d8];return _0x37cf31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c85('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c85('0x1'));var rp=require(_0x5c85('0x2'));var moment=require(_0x5c85('0x3'));var BPromise=require(_0x5c85('0x4'));var Mustache=require('mustache');var util=require(_0x5c85('0x5'));var path=require(_0x5c85('0x6'));var sox=require(_0x5c85('0x7'));var csv=require(_0x5c85('0x8'));var ejs=require(_0x5c85('0x9'));var fs=require('fs');var fs_extra=require(_0x5c85('0xa'));var _=require(_0x5c85('0xb'));var squel=require('squel');var crypto=require(_0x5c85('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5c85('0xd'));var toCsv=require(_0x5c85('0x8'));var querystring=require(_0x5c85('0xe'));var Papa=require(_0x5c85('0xf'));var Redis=require(_0x5c85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c85('0x11'));var as=require(_0x5c85('0x12'));var hardwareService=require(_0x5c85('0x13'));var logger=require(_0x5c85('0x14'))(_0x5c85('0x15'));var utils=require(_0x5c85('0x16'));var config=require(_0x5c85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c85('0x18'))['db'];config[_0x5c85('0x19')]=_['defaults'](config[_0x5c85('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c85('0x1a'))(new Redis(config[_0x5c85('0x19')]));require(_0x5c85('0x1b'))[_0x5c85('0x1c')](socket);function respondWithStatusCode(_0x1edd0c,_0x5acc37){_0x5acc37=_0x5acc37||0xcc;return function(_0x1b65f1){if(_0x1b65f1){return _0x1edd0c[_0x5c85('0x1d')](_0x5acc37);}return _0x1edd0c[_0x5c85('0x1e')](_0x5acc37)[_0x5c85('0x1f')]();};}function respondWithResult(_0x55fe91,_0xd2be96){_0xd2be96=_0xd2be96||0xc8;return function(_0x1a41ee){if(_0x1a41ee){return _0x55fe91[_0x5c85('0x1e')](_0xd2be96)[_0x5c85('0x20')](_0x1a41ee);}};}function respondWithFilteredResult(_0x36231e,_0xc106f7){return function(_0x508388){if(_0x508388){var _0x2e419d=typeof _0xc106f7[_0x5c85('0x21')]===_0x5c85('0x22')&&typeof _0xc106f7[_0x5c85('0x23')]===_0x5c85('0x22');var _0x5e1124=_0x508388['count'];var _0x1b4fab=_0x2e419d?0x0:_0xc106f7[_0x5c85('0x21')];var _0x4ed329=_0x2e419d?_0x508388['count']:_0xc106f7[_0x5c85('0x21')]+_0xc106f7[_0x5c85('0x23')];var _0x580307;if(_0x4ed329>=_0x5e1124){_0x4ed329=_0x5e1124;_0x580307=0xc8;}else{_0x580307=0xce;}_0x36231e['status'](_0x580307);return _0x36231e[_0x5c85('0x24')](_0x5c85('0x25'),_0x1b4fab+'-'+_0x4ed329+'/'+_0x5e1124)[_0x5c85('0x20')](_0x508388);}return null;};}function patchUpdates(_0x154486){return function(_0x2de9ed){try{jsonpatch[_0x5c85('0x26')](_0x2de9ed,_0x154486,!![]);}catch(_0x5f1785){return BPromise[_0x5c85('0x27')](_0x5f1785);}return _0x2de9ed['save']();};}function saveUpdates(_0x41b940,_0xf6ae4b){return function(_0x2bbeab){if(_0x2bbeab){return _0x2bbeab[_0x5c85('0x28')](_0x41b940)[_0x5c85('0x29')](function(_0x34d222){return _0x34d222;});}return null;};}function removeEntity(_0x1bb68c,_0x310d42){return function(_0x4eda59){if(_0x4eda59){return _0x4eda59[_0x5c85('0x2a')]()[_0x5c85('0x29')](function(){_0x1bb68c['status'](0xcc)[_0x5c85('0x1f')]();});}};}function handleEntityNotFound(_0x59426f,_0x259acb){return function(_0x2423e1){if(!_0x2423e1){_0x59426f[_0x5c85('0x1d')](0x194);}return _0x2423e1;};}function handleError(_0x52dea8,_0x2ead24){_0x2ead24=_0x2ead24||0x1f4;return function(_0x4279a4){logger[_0x5c85('0x2b')](_0x4279a4[_0x5c85('0x2c')]);if(_0x4279a4['name']){delete _0x4279a4[_0x5c85('0x2d')];}_0x52dea8[_0x5c85('0x1e')](_0x2ead24)[_0x5c85('0x2e')](_0x4279a4);};}exports[_0x5c85('0x2f')]=function(_0x40c49a,_0x53b9fd){var _0x4e7c82={},_0x594d68={},_0x4aeb0b={'count':0x0,'rows':[]};var _0x1d8bc8=_[_0x5c85('0x30')](db[_0x5c85('0x31')][_0x5c85('0x32')],function(_0x7e42cf){return{'name':_0x7e42cf[_0x5c85('0x33')],'type':_0x7e42cf['type'][_0x5c85('0x34')]};});_0x594d68[_0x5c85('0x35')]=_[_0x5c85('0x30')](_0x1d8bc8,'name');_0x594d68['query']=_['keys'](_0x40c49a[_0x5c85('0x36')]);_0x594d68[_0x5c85('0x37')]=_[_0x5c85('0x38')](_0x594d68[_0x5c85('0x35')],_0x594d68[_0x5c85('0x36')]);_0x4e7c82[_0x5c85('0x39')]=_[_0x5c85('0x38')](_0x594d68['model'],qs['fields'](_0x40c49a[_0x5c85('0x36')][_0x5c85('0x3a')]));_0x4e7c82[_0x5c85('0x39')]=_0x4e7c82[_0x5c85('0x39')][_0x5c85('0x3b')]?_0x4e7c82[_0x5c85('0x39')]:_0x594d68['model'];if(!_0x40c49a[_0x5c85('0x36')]['hasOwnProperty'](_0x5c85('0x3c'))){_0x4e7c82[_0x5c85('0x23')]=qs[_0x5c85('0x23')](_0x40c49a[_0x5c85('0x36')][_0x5c85('0x23')]);_0x4e7c82[_0x5c85('0x21')]=qs[_0x5c85('0x21')](_0x40c49a[_0x5c85('0x36')][_0x5c85('0x21')]);}_0x4e7c82[_0x5c85('0x3d')]=qs[_0x5c85('0x3e')](_0x40c49a[_0x5c85('0x36')][_0x5c85('0x3e')]);_0x4e7c82[_0x5c85('0x3f')]=qs[_0x5c85('0x37')](_[_0x5c85('0x40')](_0x40c49a['query'],_0x594d68[_0x5c85('0x37')]),_0x1d8bc8);if(_0x40c49a['query']['filter']){_0x4e7c82[_0x5c85('0x3f')]=_[_0x5c85('0x41')](_0x4e7c82[_0x5c85('0x3f')],{'$or':_[_0x5c85('0x30')](_0x1d8bc8,function(_0x29d700){if(_0x29d700['type']!==_0x5c85('0x42')){var _0x237e57={};_0x237e57[_0x29d700['name']]={'$like':'%'+_0x40c49a[_0x5c85('0x36')][_0x5c85('0x43')]+'%'};return _0x237e57;}})});}_0x4e7c82=_[_0x5c85('0x41')]({},_0x4e7c82,_0x40c49a[_0x5c85('0x44')]);var _0xd4a2db={'where':_0x4e7c82[_0x5c85('0x3f')]};return db['ChatGroup']['count'](_0xd4a2db)['then'](function(_0x65e7e4){_0x4aeb0b[_0x5c85('0x45')]=_0x65e7e4;if(_0x40c49a[_0x5c85('0x36')][_0x5c85('0x46')]){_0x4e7c82[_0x5c85('0x47')]=[{'all':!![]}];}return db[_0x5c85('0x31')][_0x5c85('0x48')](_0x4e7c82);})[_0x5c85('0x29')](function(_0x6f3345){_0x4aeb0b[_0x5c85('0x49')]=_0x6f3345;return _0x4aeb0b;})[_0x5c85('0x29')](respondWithFilteredResult(_0x53b9fd,_0x4e7c82))['catch'](handleError(_0x53b9fd,null));};exports[_0x5c85('0x4a')]=function(_0x55b921,_0x5cc2cc){var _0x275ae1={'raw':!![],'where':{'id':_0x55b921[_0x5c85('0x4b')]['id']}},_0x468e16={};_0x468e16[_0x5c85('0x35')]=_[_0x5c85('0x4c')](db['ChatGroup'][_0x5c85('0x32')]);_0x468e16[_0x5c85('0x36')]=_[_0x5c85('0x4c')](_0x55b921[_0x5c85('0x36')]);_0x468e16[_0x5c85('0x37')]=_[_0x5c85('0x38')](_0x468e16[_0x5c85('0x35')],_0x468e16['query']);_0x275ae1[_0x5c85('0x39')]=_[_0x5c85('0x38')](_0x468e16['model'],qs['fields'](_0x55b921[_0x5c85('0x36')][_0x5c85('0x3a')]));_0x275ae1[_0x5c85('0x39')]=_0x275ae1[_0x5c85('0x39')][_0x5c85('0x3b')]?_0x275ae1[_0x5c85('0x39')]:_0x468e16[_0x5c85('0x35')];if(_0x55b921['query'][_0x5c85('0x46')]){_0x275ae1[_0x5c85('0x47')]=[{'all':!![]}];}_0x275ae1=_[_0x5c85('0x41')]({},_0x275ae1,_0x55b921[_0x5c85('0x44')]);return db[_0x5c85('0x31')][_0x5c85('0x4d')](_0x275ae1)[_0x5c85('0x29')](handleEntityNotFound(_0x5cc2cc,null))[_0x5c85('0x29')](respondWithResult(_0x5cc2cc,null))[_0x5c85('0x4e')](handleError(_0x5cc2cc,null));};exports[_0x5c85('0x4f')]=function(_0x3dede6,_0x58b4e1){return db[_0x5c85('0x31')][_0x5c85('0x4f')](_0x3dede6[_0x5c85('0x50')],{})[_0x5c85('0x29')](respondWithResult(_0x58b4e1,0xc9))['catch'](handleError(_0x58b4e1,null));};exports['update']=function(_0x4ee34e,_0x46995d){if(_0x4ee34e['body']['id']){delete _0x4ee34e[_0x5c85('0x50')]['id'];}return db[_0x5c85('0x31')][_0x5c85('0x4d')]({'where':{'id':_0x4ee34e[_0x5c85('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46995d,null))['then'](saveUpdates(_0x4ee34e[_0x5c85('0x50')],null))[_0x5c85('0x29')](respondWithResult(_0x46995d,null))['catch'](handleError(_0x46995d,null));};exports[_0x5c85('0x2a')]=function(_0x2d56b9,_0x6bf75c){return db['ChatGroup']['find']({'where':{'id':_0x2d56b9[_0x5c85('0x4b')]['id']}})[_0x5c85('0x29')](handleEntityNotFound(_0x6bf75c,null))[_0x5c85('0x29')](removeEntity(_0x6bf75c,null))[_0x5c85('0x4e')](handleError(_0x6bf75c,null));};exports[_0x5c85('0x51')]=function(_0x3a3138,_0x20b40f){return db['ChatGroup'][_0x5c85('0x51')]()['then'](respondWithResult(_0x20b40f,null))[_0x5c85('0x4e')](handleError(_0x20b40f,null));};exports[_0x5c85('0x52')]=function(_0x33da46,_0xe2d86,_0x50b827){return db[_0x5c85('0x53')][_0x5c85('0x45')]({'where':{'ChatGroupId':_0x33da46[_0x5c85('0x4b')]['id'],'ToId':_0x33da46[_0x5c85('0x54')]['id'],'read':![]}})[_0x5c85('0x29')](function(_0x35268b){return{'id':_['toInteger'](_0x33da46[_0x5c85('0x4b')]['id']),'count':_0x35268b};})[_0x5c85('0x29')](respondWithResult(_0xe2d86,null))[_0x5c85('0x4e')](handleError(_0xe2d86,null));};exports['addMembers']=function(_0x3ce514,_0x5e6ff9,_0x43f504){return db[_0x5c85('0x31')][_0x5c85('0x4d')]({'where':{'id':_0x3ce514[_0x5c85('0x4b')]['id']}})[_0x5c85('0x29')](handleEntityNotFound(_0x5e6ff9,null))['then'](function(_0x4330c2){if(_0x4330c2){return _0x4330c2[_0x5c85('0x55')](_0x3ce514[_0x5c85('0x50')][_0x5c85('0x56')],_[_0x5c85('0x57')](_0x3ce514[_0x5c85('0x50')],['ids','id'])||{});}})[_0x5c85('0x29')](respondWithResult(_0x5e6ff9,null))[_0x5c85('0x4e')](handleError(_0x5e6ff9,null));};exports[_0x5c85('0x58')]=function(_0x3b25fb,_0x6f8c22,_0x4a11f6){var _0x149001={};var _0x11ad36={};var _0x2e78a4;var _0x2b7ce9;return db[_0x5c85('0x31')]['findOne']({'where':{'id':_0x3b25fb['params']['id']}})[_0x5c85('0x29')](handleEntityNotFound(_0x6f8c22,null))[_0x5c85('0x29')](function(_0x2c7ae3){if(_0x2c7ae3){_0x2e78a4=_0x2c7ae3;_0x11ad36[_0x5c85('0x35')]=_[_0x5c85('0x4c')](db[_0x5c85('0x59')]['rawAttributes']);_0x11ad36['query']=_[_0x5c85('0x4c')](_0x3b25fb[_0x5c85('0x36')]);_0x11ad36[_0x5c85('0x37')]=_[_0x5c85('0x38')](_0x11ad36[_0x5c85('0x35')],_0x11ad36['query']);_0x149001[_0x5c85('0x39')]=_[_0x5c85('0x38')](_0x11ad36['model'],qs[_0x5c85('0x3a')](_0x3b25fb[_0x5c85('0x36')][_0x5c85('0x3a')]));_0x149001[_0x5c85('0x39')]=_0x149001[_0x5c85('0x39')][_0x5c85('0x3b')]?_0x149001['attributes']:_0x11ad36[_0x5c85('0x35')];_0x149001[_0x5c85('0x3d')]=qs[_0x5c85('0x3e')](_0x3b25fb['query']['sort']);_0x149001['where']=qs[_0x5c85('0x37')](_[_0x5c85('0x40')](_0x3b25fb[_0x5c85('0x36')],_0x11ad36[_0x5c85('0x37')]));if(_0x3b25fb[_0x5c85('0x36')]['filter']){_0x149001[_0x5c85('0x3f')]=_[_0x5c85('0x41')](_0x149001[_0x5c85('0x3f')],{'$or':_[_0x5c85('0x30')](_0x149001[_0x5c85('0x39')],function(_0x4e0685){var _0x1515cf={};_0x1515cf[_0x4e0685]={'$like':'%'+_0x3b25fb['query'][_0x5c85('0x43')]+'%'};return _0x1515cf;})});}_0x149001=_[_0x5c85('0x41')]({},_0x149001,_0x3b25fb['options']);return _0x2e78a4[_0x5c85('0x58')](_0x149001);}})[_0x5c85('0x29')](function(_0x3f6136){if(_0x3f6136){_0x2b7ce9=_0x3f6136['length'];if(!_0x3b25fb[_0x5c85('0x36')][_0x5c85('0x5a')](_0x5c85('0x3c'))){_0x149001[_0x5c85('0x23')]=qs['limit'](_0x3b25fb[_0x5c85('0x36')][_0x5c85('0x23')]);_0x149001[_0x5c85('0x21')]=qs[_0x5c85('0x21')](_0x3b25fb[_0x5c85('0x36')]['offset']);}return _0x2e78a4['getMembers'](_0x149001);}})[_0x5c85('0x29')](function(_0x48386d){if(_0x48386d){return _0x48386d?{'count':_0x2b7ce9,'rows':_0x48386d}:null;}})[_0x5c85('0x29')](respondWithResult(_0x6f8c22,null))['catch'](handleError(_0x6f8c22,null));};exports['removeMembers']=function(_0x15b730,_0x56462b,_0x1c015a){return db[_0x5c85('0x31')][_0x5c85('0x4d')]({'where':{'id':_0x15b730[_0x5c85('0x4b')]['id']}})[_0x5c85('0x29')](handleEntityNotFound(_0x56462b,null))['then'](function(_0x310f67){if(_0x310f67){return _0x310f67[_0x5c85('0x5b')](_0x15b730[_0x5c85('0x36')][_0x5c85('0x56')]);}})[_0x5c85('0x29')](respondWithStatusCode(_0x56462b,null))['catch'](handleError(_0x56462b,null));};exports[_0x5c85('0x5c')]=function(_0x586074,_0x31bec2,_0x59b272){if(_0x586074[_0x5c85('0x50')]['id']){delete _0x586074[_0x5c85('0x50')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x586074['params']['id']}})['then'](handleEntityNotFound(_0x31bec2,null))[_0x5c85('0x29')](function(_0x517140){if(_0x517140){_0x586074[_0x5c85('0x50')][_0x5c85('0x5d')]=_0x517140['id'];return db[_0x5c85('0x53')][_0x5c85('0x4f')](_0x586074['body']);}})[_0x5c85('0x29')](respondWithResult(_0x31bec2,null))[_0x5c85('0x4e')](handleError(_0x31bec2,null));};exports[_0x5c85('0x5e')]=function(_0xfbeede,_0x790ace,_0x252e23){var _0x293ee3={};var _0x362eea={};var _0x35b828;var _0x3a82a3;return db['ChatGroup'][_0x5c85('0x5f')]({'where':{'id':_0xfbeede[_0x5c85('0x4b')]['id']}})[_0x5c85('0x29')](handleEntityNotFound(_0x790ace,null))['then'](function(_0x1b246d){if(_0x1b246d){_0x35b828=_0x1b246d;_0x362eea[_0x5c85('0x35')]=_['keys'](db[_0x5c85('0x53')]['rawAttributes']);_0x362eea['query']=_[_0x5c85('0x4c')](_0xfbeede[_0x5c85('0x36')]);_0x362eea[_0x5c85('0x37')]=_['intersection'](_0x362eea[_0x5c85('0x35')],_0x362eea['query']);_0x293ee3[_0x5c85('0x39')]=_['intersection'](_0x362eea[_0x5c85('0x35')],qs[_0x5c85('0x3a')](_0xfbeede[_0x5c85('0x36')]['fields']));_0x293ee3[_0x5c85('0x39')]=_0x293ee3[_0x5c85('0x39')][_0x5c85('0x3b')]?_0x293ee3['attributes']:_0x362eea[_0x5c85('0x35')];_0x293ee3['order']=qs[_0x5c85('0x3e')](_0xfbeede[_0x5c85('0x36')][_0x5c85('0x3e')]);_0x293ee3['where']=qs[_0x5c85('0x37')](_[_0x5c85('0x40')](_0xfbeede[_0x5c85('0x36')],_0x362eea['filters']));if(_0xfbeede['query'][_0x5c85('0x43')]){_0x293ee3[_0x5c85('0x3f')]=_[_0x5c85('0x41')](_0x293ee3['where'],{'$or':_[_0x5c85('0x30')](_0x293ee3[_0x5c85('0x39')],function(_0x325a2b){var _0xbc1ac0={};_0xbc1ac0[_0x325a2b]={'$like':'%'+_0xfbeede[_0x5c85('0x36')][_0x5c85('0x43')]+'%'};return _0xbc1ac0;})});}if(_0xfbeede['query']['$gte']){var _0x422ce2=_0xfbeede[_0x5c85('0x36')]['$gte']['split'](',');var _0x105f2f={};_0x105f2f[_0x422ce2[0x0]]={'$gte':moment(_0x422ce2[0x1])[_0x5c85('0x60')](_0x5c85('0x61'))};_0x293ee3[_0x5c85('0x3f')]=_['merge'](_0x293ee3[_0x5c85('0x3f')],_0x105f2f);}_0x293ee3=_[_0x5c85('0x41')]({},_0x293ee3,_0xfbeede[_0x5c85('0x44')]);return _0x35b828[_0x5c85('0x5e')](_0x293ee3);}})[_0x5c85('0x29')](function(_0x13d69a){if(_0x13d69a){_0x3a82a3=_0x13d69a['length'];if(!_0xfbeede[_0x5c85('0x36')][_0x5c85('0x5a')]('nolimit')){_0x293ee3[_0x5c85('0x23')]=qs[_0x5c85('0x23')](_0xfbeede['query'][_0x5c85('0x23')]);_0x293ee3[_0x5c85('0x21')]=qs['offset'](_0xfbeede['query'][_0x5c85('0x21')]);}return _0x35b828[_0x5c85('0x5e')](_0x293ee3);}})[_0x5c85('0x29')](function(_0x4c1bba){if(_0x4c1bba){return _0x4c1bba?{'count':_0x3a82a3,'rows':_0x4c1bba}:null;}})[_0x5c85('0x29')](respondWithResult(_0x790ace,null))[_0x5c85('0x4e')](handleError(_0x790ace,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index aa72127..b7f3843 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 _0x391e=['ChatGroup','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x137cea,_0x20e60d){var _0x480882=function(_0x280975){while(--_0x280975){_0x137cea['push'](_0x137cea['shift']());}};_0x480882(++_0x20e60d);}(_0x391e,0x1cf));var _0xe391=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x391e[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe391('0x0'))['db'][_0xe391('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe391('0x2'),'afterUpdate':_0xe391('0x3'),'afterDestroy':_0xe391('0x4')};function emitEvent(_0xb88c39){return function(_0x5e5ce9,_0x2e8a98,_0x4ef1bd){ChatGroupEvents['emit'](_0xb88c39+':'+_0x5e5ce9['id'],_0x5e5ce9);ChatGroupEvents[_0xe391('0x5')](_0xb88c39,_0x5e5ce9);_0x4ef1bd(null);};}for(var e in events){if(events[_0xe391('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xe391('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x3c04=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x3c04,0x192));var _0x43c0=function(_0x159381,_0x5b1a81){_0x159381=_0x159381-0x0;var _0x5b9ae4=_0x3c04[_0x159381];return _0x5b9ae4;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x43c0('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x43c0('0x1')](0x0);var events={'afterCreate':_0x43c0('0x2'),'afterUpdate':_0x43c0('0x3'),'afterDestroy':_0x43c0('0x4')};function emitEvent(_0x212986){return function(_0x43818b,_0xda1f1f,_0x23b839){ChatGroupEvents[_0x43c0('0x5')](_0x212986+':'+_0x43818b['id'],_0x43818b);ChatGroupEvents['emit'](_0x212986,_0x43818b);_0x23b839(null);};}for(var e in events){if(events[_0x43c0('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x43c0('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 21e0c8b..94ec34d 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 _0x5f09=['bluebird','rimraf','../../config/environment','./chatGroup.attributes','exports','define','util','../../config/logger'];(function(_0x5c7769,_0x43afa7){var _0x29eebc=function(_0xa1ed20){while(--_0xa1ed20){_0x5c7769['push'](_0x5c7769['shift']());}};_0x29eebc(++_0x43afa7);}(_0x5f09,0x166));var _0x95f0=function(_0x398e29,_0x5c9d40){_0x398e29=_0x398e29-0x0;var _0x4e32c3=_0x5f09[_0x398e29];return _0x4e32c3;};'use strict';var _=require('lodash');var util=require(_0x95f0('0x0'));var logger=require(_0x95f0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x95f0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95f0('0x3'));var config=require(_0x95f0('0x4'));var attributes=require(_0x95f0('0x5'));module[_0x95f0('0x6')]=function(_0xb2e86c,_0x100f67){return _0xb2e86c[_0x95f0('0x7')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf6=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','lodash','util','api','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xebf6,0xc8));var _0x6ebf=function(_0x356e71,_0x438f79){_0x356e71=_0x356e71-0x0;var _0x815a62=_0xebf6[_0x356e71];return _0x815a62;};'use strict';var _=require(_0x6ebf('0x0'));var util=require(_0x6ebf('0x1'));var logger=require('../../config/logger')(_0x6ebf('0x2'));var moment=require(_0x6ebf('0x3'));var BPromise=require(_0x6ebf('0x4'));var rp=require(_0x6ebf('0x5'));var fs=require('fs');var path=require(_0x6ebf('0x6'));var rimraf=require(_0x6ebf('0x7'));var config=require(_0x6ebf('0x8'));var attributes=require(_0x6ebf('0x9'));module[_0x6ebf('0xa')]=function(_0x845f9,_0xa0a1bd){return _0x845f9['define'](_0x6ebf('0xb'),attributes,{'tableName':'chat_groups','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 cb88057..022fb22 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 _0xb38e=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1ba7b6,_0x171ec8){var _0x110fd5=function(_0x10421f){while(--_0x10421f){_0x1ba7b6['push'](_0x1ba7b6['shift']());}};_0x110fd5(++_0x171ec8);}(_0xb38e,0xa7));var _0xeb38=function(_0x4b5b3e,_0x5013e5){_0x4b5b3e=_0x4b5b3e-0x0;var _0x5c77d8=_0xb38e[_0x4b5b3e];return _0x5c77d8;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var moment=require(_0xeb38('0x2'));var BPromise=require(_0xeb38('0x3'));var rs=require(_0xeb38('0x4'));var fs=require('fs');var Redis=require(_0xeb38('0x5'));var db=require(_0xeb38('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb38('0x7'))(_0xeb38('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb38('0x9'));var client=jayson[_0xeb38('0xa')][_0xeb38('0xb')]({'port':0x232a});config[_0xeb38('0xc')]=_['defaults'](config[_0xeb38('0xc')],{'host':_0xeb38('0xd'),'port':0x18eb});var socket=require(_0xeb38('0xe'))(new Redis(config[_0xeb38('0xc')]));require('./chatGroup.socket')[_0xeb38('0xf')](socket);function respondWithRpcPromise(_0x34c438,_0x8a6144,_0xa54e19){return new BPromise(function(_0xfbd120,_0x1542f4){return client[_0xeb38('0x10')](_0x34c438,_0xa54e19)['then'](function(_0x170e47){logger['info'](_0xeb38('0x11'),_0x8a6144,_0xeb38('0x12'));logger['debug'](_0xeb38('0x13'),_0x8a6144,_0xeb38('0x12'),JSON[_0xeb38('0x14')](_0x170e47));if(_0x170e47[_0xeb38('0x15')]){if(_0x170e47[_0xeb38('0x15')][_0xeb38('0x16')]===0x1f4){logger['error'](_0xeb38('0x11'),_0x8a6144,_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);return _0x1542f4(_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);}logger[_0xeb38('0x15')](_0xeb38('0x11'),_0x8a6144,_0x170e47['error'][_0xeb38('0x17')]);return _0xfbd120(_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);}else{logger['info'](_0xeb38('0x11'),_0x8a6144,'request\x20sent');_0xfbd120(_0x170e47['result'][_0xeb38('0x17')]);}})[_0xeb38('0x18')](function(_0x95a29){logger['error']('ChatGroup,\x20%s,\x20%s',_0x8a6144,_0x95a29);_0x1542f4(_0x95a29);});});} \ No newline at end of file +var _0xd0e7=['redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x22ca53,_0x30e1a9){var _0x80aacf=function(_0x55f0b9){while(--_0x55f0b9){_0x22ca53['push'](_0x22ca53['shift']());}};_0x80aacf(++_0x30e1a9);}(_0xd0e7,0x10d));var _0x7d0e=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xd0e7[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0x7d0e('0x0'));var util=require(_0x7d0e('0x1'));var moment=require(_0x7d0e('0x2'));var BPromise=require(_0x7d0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d0e('0x4'));var db=require(_0x7d0e('0x5'))['db'];var utils=require(_0x7d0e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7d0e('0x7'));var jayson=require(_0x7d0e('0x8'));var client=jayson[_0x7d0e('0x9')][_0x7d0e('0xa')]({'port':0x232a});config[_0x7d0e('0xb')]=_[_0x7d0e('0xc')](config['redis'],{'host':_0x7d0e('0xd'),'port':0x18eb});var socket=require(_0x7d0e('0xe'))(new Redis(config[_0x7d0e('0xb')]));require(_0x7d0e('0xf'))[_0x7d0e('0x10')](socket);function respondWithRpcPromise(_0x349a14,_0x59f7f3,_0x2d1a49){return new BPromise(function(_0x13c377,_0x1122ce){return client['request'](_0x349a14,_0x2d1a49)[_0x7d0e('0x11')](function(_0x5fbe08){logger['info'](_0x7d0e('0x12'),_0x59f7f3,_0x7d0e('0x13'));logger[_0x7d0e('0x14')](_0x7d0e('0x15'),_0x59f7f3,_0x7d0e('0x13'),JSON[_0x7d0e('0x16')](_0x5fbe08));if(_0x5fbe08[_0x7d0e('0x17')]){if(_0x5fbe08[_0x7d0e('0x17')]['code']===0x1f4){logger[_0x7d0e('0x17')](_0x7d0e('0x12'),_0x59f7f3,_0x5fbe08[_0x7d0e('0x17')][_0x7d0e('0x18')]);return _0x1122ce(_0x5fbe08[_0x7d0e('0x17')]['message']);}logger[_0x7d0e('0x17')](_0x7d0e('0x12'),_0x59f7f3,_0x5fbe08[_0x7d0e('0x17')]['message']);return _0x13c377(_0x5fbe08[_0x7d0e('0x17')][_0x7d0e('0x18')]);}else{logger[_0x7d0e('0x19')](_0x7d0e('0x12'),_0x59f7f3,'request\x20sent');_0x13c377(_0x5fbe08[_0x7d0e('0x1a')][_0x7d0e('0x18')]);}})[_0x7d0e('0x1b')](function(_0x2b9a97){logger[_0x7d0e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x59f7f3,_0x2b9a97);_0x1122ce(_0x2b9a97);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 232bd86..19b3c8a 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 _0x2278=['./chatGroup.events','save','update','register','length','chatGroup:'];(function(_0x17ae3c,_0x331aa3){var _0x26bb54=function(_0x298333){while(--_0x298333){_0x17ae3c['push'](_0x17ae3c['shift']());}};_0x26bb54(++_0x331aa3);}(_0x2278,0x66));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x8227('0x0'));var events=[_0x8227('0x1'),'remove',_0x8227('0x2')];function createListener(_0x346d10,_0x3682c3){return function(_0x547d4f){_0x3682c3['emit'](_0x346d10,_0x547d4f);};}function removeListener(_0x19eef6,_0x1532e2){return function(){ChatGroupEvents['removeListener'](_0x19eef6,_0x1532e2);};}exports[_0x8227('0x3')]=function(_0x4ff3d2){for(var _0x29ee38=0x0,_0x2fd558=events[_0x8227('0x4')];_0x29ee38<_0x2fd558;_0x29ee38++){var _0x3dfae7=events[_0x29ee38];var _0x34f0fa=createListener(_0x8227('0x5')+_0x3dfae7,_0x4ff3d2);ChatGroupEvents['on'](_0x3dfae7,_0x34f0fa);}}; \ No newline at end of file +var _0xe90b=['remove','update','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x4c0abe,_0x4647a2){var _0x5dbe93=function(_0x3436c4){while(--_0x3436c4){_0x4c0abe['push'](_0x4c0abe['shift']());}};_0x5dbe93(++_0x4647a2);}(_0xe90b,0x12b));var _0xbe90=function(_0x561fe2,_0x47d719){_0x561fe2=_0x561fe2-0x0;var _0x1fb238=_0xe90b[_0x561fe2];return _0x1fb238;};'use strict';var ChatGroupEvents=require(_0xbe90('0x0'));var events=[_0xbe90('0x1'),_0xbe90('0x2'),_0xbe90('0x3')];function createListener(_0x481f5b,_0x1eb021){return function(_0x41b360){_0x1eb021['emit'](_0x481f5b,_0x41b360);};}function removeListener(_0x425051,_0x23da19){return function(){ChatGroupEvents[_0xbe90('0x4')](_0x425051,_0x23da19);};}exports[_0xbe90('0x5')]=function(_0x50537d){for(var _0x5da104=0x0,_0x49d114=events['length'];_0x5da104<_0x49d114;_0x5da104++){var _0x3adc8a=events[_0x5da104];var _0x55baab=createListener(_0xbe90('0x6')+_0x3adc8a,_0x50537d);ChatGroupEvents['on'](_0x3adc8a,_0x55baab);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1de3826..63ad57a 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 _0x0a73=['addMembers','addMessage','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','describe','/:id/unread','getUnread','/:id/members','/:id/messages','post','create'];(function(_0x109bc7,_0x2fbdd1){var _0x3efe8b=function(_0x1123bc){while(--_0x1123bc){_0x109bc7['push'](_0x109bc7['shift']());}};_0x3efe8b(++_0x2fbdd1);}(_0x0a73,0xd6));var _0x30a7=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0x0a73[_0x455f19];return _0x422f21;};'use strict';var multer=require(_0x30a7('0x0'));var util=require(_0x30a7('0x1'));var path=require(_0x30a7('0x2'));var timeout=require(_0x30a7('0x3'));var express=require(_0x30a7('0x4'));var router=express[_0x30a7('0x5')]();var fs_extra=require(_0x30a7('0x6'));var auth=require(_0x30a7('0x7'));var interaction=require(_0x30a7('0x8'));var config=require(_0x30a7('0x9'));var controller=require(_0x30a7('0xa'));router['get']('/',auth[_0x30a7('0xb')](),controller['index']);router[_0x30a7('0xc')]('/describe',auth[_0x30a7('0xb')](),controller[_0x30a7('0xd')]);router[_0x30a7('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x30a7('0xc')](_0x30a7('0xe'),auth['isAuthenticated'](),controller[_0x30a7('0xf')]);router[_0x30a7('0xc')](_0x30a7('0x10'),auth[_0x30a7('0xb')](),controller['getMembers']);router[_0x30a7('0xc')](_0x30a7('0x11'),auth[_0x30a7('0xb')](),controller['getMessages']);router[_0x30a7('0x12')]('/',auth[_0x30a7('0xb')](),controller[_0x30a7('0x13')]);router['post'](_0x30a7('0x10'),auth[_0x30a7('0xb')](),controller[_0x30a7('0x14')]);router['post']('/:id/messages',auth[_0x30a7('0xb')](),controller[_0x30a7('0x15')]);router[_0x30a7('0x16')](_0x30a7('0x17'),auth[_0x30a7('0xb')](),controller[_0x30a7('0x18')]);router[_0x30a7('0x19')](_0x30a7('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0x30a7('0x19')](_0x30a7('0x10'),auth[_0x30a7('0xb')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0x7e96=['addMembers','addMessage','/:id','update','delete','destroy','removeMembers','multer','Router','fs-extra','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7e96,0x187));var _0x67e9=function(_0x3435ce,_0x3cab3c){_0x3435ce=_0x3435ce-0x0;var _0x13a9dc=_0x7e96[_0x3435ce];return _0x13a9dc;};'use strict';var multer=require(_0x67e9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x67e9('0x1')]();var fs_extra=require(_0x67e9('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x67e9('0x3'));var controller=require(_0x67e9('0x4'));router[_0x67e9('0x5')]('/',auth[_0x67e9('0x6')](),controller[_0x67e9('0x7')]);router[_0x67e9('0x5')](_0x67e9('0x8'),auth[_0x67e9('0x6')](),controller[_0x67e9('0x9')]);router[_0x67e9('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x67e9('0xa'),auth[_0x67e9('0x6')](),controller[_0x67e9('0xb')]);router['get'](_0x67e9('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x67e9('0x5')](_0x67e9('0xd'),auth[_0x67e9('0x6')](),controller[_0x67e9('0xe')]);router[_0x67e9('0xf')]('/',auth[_0x67e9('0x6')](),controller[_0x67e9('0x10')]);router['post'](_0x67e9('0xc'),auth['isAuthenticated'](),controller[_0x67e9('0x11')]);router[_0x67e9('0xf')](_0x67e9('0xd'),auth['isAuthenticated'](),controller[_0x67e9('0x12')]);router['put'](_0x67e9('0x13'),auth['isAuthenticated'](),controller[_0x67e9('0x14')]);router[_0x67e9('0x15')]('/:id',auth[_0x67e9('0x6')](),controller[_0x67e9('0x16')]);router[_0x67e9('0x15')](_0x67e9('0xc'),auth[_0x67e9('0x6')](),controller[_0x67e9('0x17')]);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 32e1c0c..6bcfbff 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 _0x42f4=['thumb','STRING','DATE','TEXT','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0x42f4,0x19d));var _0x442f=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x42f4[_0x51ac09];return _0x3f827d;};'use strict';var Sequelize=require(_0x442f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x442f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x442f('0x2')]},'ratingType':{'type':Sequelize[_0x442f('0x3')](_0x442f('0x4'),_0x442f('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x442f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x442f('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x442f('0x6')]},'thirdDisposition':{'type':Sequelize[_0x442f('0x6')]},'note':{'type':Sequelize[_0x442f('0x6')]},'browserName':{'type':Sequelize[_0x442f('0x6')]},'browserVersion':{'type':Sequelize[_0x442f('0x6')]},'osName':{'type':Sequelize[_0x442f('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x442f('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x442f('0x6')]},'formData':{'type':Sequelize[_0x442f('0x8')](_0x442f('0x9'))},'read1stAt':{'type':Sequelize[_0x442f('0x7')]},'lastMsgAt':{'type':Sequelize[_0x442f('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x442f('0x3')]('in',_0x442f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x442f('0x6')]},'customerPort':{'type':Sequelize[_0x442f('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x442f('0x8')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa446=['INTEGER','star','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports'];(function(_0x1be314,_0x462c2f){var _0x107c9d=function(_0x49f5db){while(--_0x49f5db){_0x1be314['push'](_0x1be314['shift']());}};_0x107c9d(++_0x462c2f);}(_0xa446,0xc6));var _0x6a44=function(_0x334838,_0x5defd2){_0x334838=_0x334838-0x0;var _0x234a21=_0xa446[_0x334838];return _0x234a21;};'use strict';var Sequelize=require(_0x6a44('0x0'));module[_0x6a44('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6a44('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x6a44('0x3'),'thumb'),'defaultValue':_0x6a44('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x6a44('0x4')]},'mailTranscript':{'type':Sequelize[_0x6a44('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6a44('0x6')]},'disposition':{'type':Sequelize[_0x6a44('0x5')]},'secondDisposition':{'type':Sequelize[_0x6a44('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6a44('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x6a44('0x5')]},'browserVersion':{'type':Sequelize[_0x6a44('0x5')]},'osName':{'type':Sequelize[_0x6a44('0x5')]},'osVersion':{'type':Sequelize[_0x6a44('0x5')]},'deviceModel':{'type':Sequelize[_0x6a44('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x6a44('0x5')]},'referer':{'type':Sequelize[_0x6a44('0x4')]},'customerIp':{'type':Sequelize[_0x6a44('0x5')]},'formData':{'type':Sequelize[_0x6a44('0x4')](_0x6a44('0x7'))},'read1stAt':{'type':Sequelize[_0x6a44('0x6')]},'lastMsgAt':{'type':Sequelize[_0x6a44('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6a44('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6a44('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x6a44('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6a44('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4759885..064bb27 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 _0x91a7=['total','closed','UserId','waiting','disposition','unmanaged','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','field','color','from','select','u.id','u.fullname','ui.ChatInteractionId','users','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','catch','show','params','rawAttributes','include','create','describe','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','basename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','format','%s%d','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','sort','pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','includeAll','addTags','setTags','emit','chatInteractionTags:save','removeTags','download','unix','server','tmp','files','attachments','firstName','lastName','direction','Account','Owner','get','osName','customerIp','customerPort','N.A.','tail','createReadStream','createWriteStream','out','read','renderFile','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','mustache','path','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','destroy','then','stack','name','send','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','forEach','push','talking','answered','abandoned'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x91a7,0xe7));var _0x791a=function(_0x585b18,_0x206235){_0x585b18=_0x585b18-0x0;var _0x30f0aa=_0x91a7[_0x585b18];return _0x30f0aa;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x791a('0x0'));var rp=require(_0x791a('0x1'));var moment=require(_0x791a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x3'));var util=require('util');var path=require(_0x791a('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x5'));var Redis=require(_0x791a('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x791a('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x791a('0x8'))(_0x791a('0x9'));var config=require('../../config/environment');var db=require(_0x791a('0xa'))['db'];config[_0x791a('0xb')]=_[_0x791a('0xc')](config[_0x791a('0xb')],{'host':_0x791a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x791a('0xb')]));require(_0x791a('0xe'))['register'](socket);var jayson=require(_0x791a('0xf'));var client=jayson[_0x791a('0x10')][_0x791a('0x11')]({'port':0x232b});var client9004=jayson[_0x791a('0x10')][_0x791a('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x3fc10a,_0x53dc41,_0x5daecd,_0xc92016){return new BPromise(function(_0x2f2d8d,_0x4c56f0){var _0x346c44=_0xc92016||client;return _0x346c44[_0x791a('0x12')](_0x3fc10a,_0x5daecd)['then'](function(_0x2887f0){logger[_0x791a('0x13')](_0x791a('0x14'),_0x53dc41,_0x791a('0x15'));logger['debug'](_0x791a('0x16'),_0x53dc41,'request\x20sent',JSON[_0x791a('0x17')](_0x2887f0));if(_0x2887f0[_0x791a('0x18')]){if(_0x2887f0['error'][_0x791a('0x19')]===0x1f4){logger['error'](_0x791a('0x14'),_0x53dc41,_0x2887f0['error']['message']);return _0x4c56f0(_0x2887f0['error'][_0x791a('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x53dc41,_0x2887f0[_0x791a('0x18')][_0x791a('0x1a')]);return _0x2f2d8d(_0x2887f0[_0x791a('0x18')][_0x791a('0x1a')]);}else{logger['info'](_0x791a('0x14'),_0x53dc41,_0x791a('0x15'));_0x2f2d8d(_0x2887f0[_0x791a('0x1b')][_0x791a('0x1a')]);}})['catch'](function(_0x448085){logger[_0x791a('0x18')](_0x791a('0x14'),_0x53dc41,_0x448085);_0x4c56f0(_0x448085);});});}function respondWithStatusCode(_0x9e17b5,_0x3200dd){_0x3200dd=_0x3200dd||0xcc;return function(_0x1091af){if(_0x1091af){return _0x9e17b5[_0x791a('0x1c')](_0x3200dd);}return _0x9e17b5[_0x791a('0x1d')](_0x3200dd)[_0x791a('0x1e')]();};}function respondWithResult(_0xe8e452,_0x137992){_0x137992=_0x137992||0xc8;return function(_0x5e03a3){if(_0x5e03a3){return _0xe8e452[_0x791a('0x1d')](_0x137992)[_0x791a('0x1f')](_0x5e03a3);}};}function respondWithFilteredResult(_0x380329,_0x2966b8){return function(_0x4d748a){if(_0x4d748a){var _0x456480=typeof _0x2966b8[_0x791a('0x20')]==='undefined'&&typeof _0x2966b8[_0x791a('0x21')]===_0x791a('0x22');var _0x16dbaf=_0x4d748a['count'];var _0x29194d=_0x456480?0x0:_0x2966b8[_0x791a('0x20')];var _0x2b0784=_0x456480?_0x4d748a[_0x791a('0x23')]:_0x2966b8[_0x791a('0x20')]+_0x2966b8[_0x791a('0x21')];var _0x628816;if(_0x2b0784>=_0x16dbaf){_0x2b0784=_0x16dbaf;_0x628816=0xc8;}else{_0x628816=0xce;}_0x380329[_0x791a('0x1d')](_0x628816);return _0x380329['set'](_0x791a('0x24'),_0x29194d+'-'+_0x2b0784+'/'+_0x16dbaf)[_0x791a('0x1f')](_0x4d748a);}return null;};}function saveUpdates(_0x1b10a7){return function(_0x59d2c0){if(_0x59d2c0){return _0x59d2c0[_0x791a('0x25')](_0x1b10a7)['then'](function(_0xc59f5e){return _0xc59f5e;});}return null;};}function removeEntity(_0x2e4ec8){return function(_0xcde862){if(_0xcde862){return _0xcde862[_0x791a('0x26')]()[_0x791a('0x27')](function(){_0x2e4ec8[_0x791a('0x1d')](0xcc)[_0x791a('0x1e')]();});}};}function handleEntityNotFound(_0x4f5506){return function(_0x3662c6){if(!_0x3662c6){_0x4f5506[_0x791a('0x1c')](0x194);}return _0x3662c6;};}function handleError(_0x3fa066,_0x27f758){_0x27f758=_0x27f758||0x1f4;return function(_0x7d5dd0){logger['error'](_0x7d5dd0[_0x791a('0x28')]);if(_0x7d5dd0[_0x791a('0x29')]){delete _0x7d5dd0[_0x791a('0x29')];}_0x3fa066[_0x791a('0x1d')](_0x27f758)[_0x791a('0x2a')](_0x7d5dd0);};}function getMustacheRender(_0x4ef825,_0x305836){return Mustache[_0x791a('0x2b')](_0x4ef825,_[_0x791a('0x2c')](_0x305836[_0x791a('0x2d')],{'contact':_0x305836[_0x791a('0x2e')],'message':_0x305836['message'],'agent':_0x305836[_0x791a('0x2f')],'interaction':_0x305836['interaction'],'account':_0x305836[_0x791a('0x30')]}))||'';}function getInteractionUsers(_0x4cd047,_0x5edb88){return new BPromise(function(_0x425675,_0x404530){try{if(_0x5edb88[_0x4cd047['id']]){_0x4cd047[_0x791a('0x31')]=_[_0x791a('0x32')](_0x5edb88[_0x4cd047['id']],function(_0x18e1f5){return{'id':_0x18e1f5['id'],'fullname':_0x18e1f5[_0x791a('0x33')]};});}}catch(_0x29762d){_0x404530(_0x29762d);}_0x425675(_0x4cd047);});}function getInteractionTags(_0x5ac4c7,_0x37a090){return new BPromise(function(_0x4dc246,_0x10c5ca){try{if(_0x5ac4c7['TagIds']){_0x5ac4c7[_0x791a('0x34')]=[];_0x5ac4c7[_0x791a('0x35')]['split'](',')[_0x791a('0x36')](function(_0x22fb89){_0x5ac4c7['Tags'][_0x791a('0x37')](_0x37a090[_0x22fb89]);});}delete _0x5ac4c7[_0x791a('0x35')];}catch(_0x2861d6){_0x10c5ca(_0x2861d6);}_0x4dc246(_0x5ac4c7);});}function updateChatInteraction(_0x23db7d,_0x29d267,_0x44c720){return new BPromise(function(_0x3a9184,_0xf223d8){return getInteractionUsers(_0x23db7d,_0x44c720)[_0x791a('0x27')](function(_0xeafbb5){return getInteractionTags(_0xeafbb5,_0x29d267);})['then'](function(_0x15f066){return getStateInteraction(_0x15f066);})[_0x791a('0x27')](function(_0x50a4a6){_0x3a9184(_0x50a4a6);})['catch'](function(_0xf4e2fa){_0xf223d8(_0xf4e2fa);});});}function getStateInteraction(_0x5678a3){return new BPromise(function(_0x5bad7d){_0x5678a3['waiting']=0x0;_0x5678a3[_0x791a('0x38')]=0x0;_0x5678a3[_0x791a('0x39')]=0x0;_0x5678a3['unmanaged']=0x0;_0x5678a3[_0x791a('0x3a')]=0x0;_0x5678a3[_0x791a('0x3b')]=0x0;if(!_0x5678a3[_0x791a('0x3c')]&&!_0x5678a3[_0x791a('0x3d')]){_0x5678a3['waiting']+=0x1;}if(!_0x5678a3['closed']&&_0x5678a3['UserId']){_0x5678a3[_0x791a('0x38')]+=0x1;if(_0x5678a3[_0x791a('0x3e')]){_0x5678a3['waiting']-=0x1;}}if(_0x5678a3[_0x791a('0x3c')]&&_0x5678a3[_0x791a('0x3f')]===_0x791a('0x3a')){_0x5678a3[_0x791a('0x3a')]+=0x1;if(_0x5678a3['waiting']){_0x5678a3[_0x791a('0x3e')]-=0x1;}}else if(_0x5678a3['closed']&&!_0x5678a3[_0x791a('0x3d')]&&_0x5678a3[_0x791a('0x3f')]){_0x5678a3[_0x791a('0x40')]+=0x1;if(_0x5678a3[_0x791a('0x3e')]){_0x5678a3[_0x791a('0x3e')]-=0x1;}}else if(_0x5678a3['closed']&&_0x5678a3[_0x791a('0x3d')]){_0x5678a3[_0x791a('0x39')]+=0x1;if(_0x5678a3[_0x791a('0x38')]){_0x5678a3[_0x791a('0x38')]-=0x1;}}_0x5678a3[_0x791a('0x3b')]+=0x1;_0x5bad7d(_0x5678a3);});}exports['index']=function(_0x21d942,_0x2d1f92){var _0x4e379e={},_0x5b039e={},_0x1eb5b1={'count':0x0,'rows':[]};var _0x338e70=_[_0x791a('0x32')](db['ChatInteraction']['rawAttributes'],function(_0x37ca2e){return{'name':_0x37ca2e[_0x791a('0x41')],'type':_0x37ca2e['type'][_0x791a('0x42')]};});_0x5b039e[_0x791a('0x43')]=_[_0x791a('0x32')](_0x338e70,'name');_0x5b039e['query']=_[_0x791a('0x44')](_0x21d942[_0x791a('0x45')]);_0x5b039e[_0x791a('0x46')]=_[_0x791a('0x47')](_0x5b039e['model'],_0x5b039e[_0x791a('0x45')]);_0x4e379e[_0x791a('0x48')]=_[_0x791a('0x47')](_0x5b039e[_0x791a('0x43')],qs['fields'](_0x21d942[_0x791a('0x45')][_0x791a('0x49')]));_0x4e379e[_0x791a('0x48')]=_0x4e379e[_0x791a('0x48')][_0x791a('0x4a')]?_0x4e379e[_0x791a('0x48')]:_0x5b039e[_0x791a('0x43')];if(!_0x21d942['query'][_0x791a('0x4b')](_0x791a('0x4c'))){_0x4e379e['limit']=qs[_0x791a('0x21')](_0x21d942[_0x791a('0x45')]['limit']);_0x4e379e[_0x791a('0x20')]=qs[_0x791a('0x20')](_0x21d942[_0x791a('0x45')][_0x791a('0x20')]);}_0x4e379e[_0x791a('0x4d')]=qs['sort'](_0x21d942['query']['sort']);_0x4e379e[_0x791a('0x4e')]=qs['filters'](_['pick'](_0x21d942[_0x791a('0x45')],_0x5b039e['filters']),_0x338e70);var _0x3e0b17=[];var _0x346467=squel['select']()['field']('id')[_0x791a('0x4f')]('name')[_0x791a('0x4f')](_0x791a('0x50'))[_0x791a('0x51')]('tools_tags');var _0xbcab79=squel[_0x791a('0x52')]()['field'](_0x791a('0x53'))[_0x791a('0x4f')](_0x791a('0x54'))[_0x791a('0x4f')](_0x791a('0x55'))[_0x791a('0x51')]('user_has_chat_interactions','ui')['left_join'](_0x791a('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x45541b=squel[_0x791a('0x52')]()[_0x791a('0x51')](_0x791a('0x57'),'i')[_0x791a('0x58')](_0x791a('0x59'),'c',_0x791a('0x5a'))['left_join'](_0x791a('0x56'),'o',_0x791a('0x5b'))[_0x791a('0x58')](_0x791a('0x5c'),'a',_0x791a('0x5d'))[_0x791a('0x58')](_0x791a('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x791a('0x58')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x791a('0x58')](_0x791a('0x5f'),'t',_0x791a('0x60'));var _0x2e3432=squel[_0x791a('0x61')]();var _0x129d60=[];var _0x2001ce=squel[_0x791a('0x61')]();var _0x2bfb66;if(_0x21d942[_0x791a('0x45')][_0x791a('0x62')]){_0x2bfb66=as[_0x791a('0x63')](_0x21d942[_0x791a('0x45')][_0x791a('0x62')]);var _0x38adc1=_0x2bfb66[_0x791a('0x64')];for(var _0xb05c3=0x0;_0xb05c3<_0x2bfb66[_0x791a('0x65')][_0x791a('0x4a')];_0xb05c3++){var _0x3cf4c7=_0x2bfb66['conditions'][_0xb05c3];var _0x215010='i';var _0x32d521=_[_0x791a('0x66')](_0x338e70,[_0x791a('0x29'),_0x3cf4c7[_0x791a('0x4f')]]);if(!_0x32d521){switch(_0x3cf4c7['field']){case _0x791a('0x67'):if(_0x3cf4c7[_0x791a('0x68')]==0x1){_0x45541b[_0x791a('0x69')]('`'+_0x3cf4c7[_0x791a('0x4f')]+'`\x20=\x200');}else{_0x45541b[_0x791a('0x69')]('`'+_0x3cf4c7['field']+'`\x20>\x200');}break;case'Contact':if(_0x3cf4c7['operator']===_0x791a('0x6a')){if(_0x3cf4c7[_0x791a('0x68')][_0x791a('0x6b')]('\x20')[_0x791a('0x4a')]>0x1){_0x2e3432[_0x38adc1](_0x791a('0x6c'),qs[_0x791a('0x6d')](_0x3cf4c7[_0x791a('0x68')]),null);}else{var _0x5dca78='%'+_0x3cf4c7['value']+'%';_0x2e3432[_0x38adc1](_0x791a('0x6e'),_0x5dca78,_0x5dca78,_0x5dca78);}}else{_0x32d521=_[_0x791a('0x66')](_0x338e70,['name','ContactId']);_0x3cf4c7[_0x791a('0x4f')]=_0x791a('0x6f');_0x356cd8=as['buildExpression'](_0x215010,_0x32d521[_0x791a('0x70')],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8['value']['end']);}break;case _0x791a('0x73'):var _0xffe403=_0x3cf4c7['value'][_0x791a('0x6b')](',')[_0x791a('0x32')](function(_0x10b51f){return Number(_0x10b51f);});_0xffe403[_0x791a('0x36')](function(_0x565c83){_0x2001ce['or'](_0x791a('0x74'),'%,'+_0x565c83+',%');});_0x129d60=_[_0x791a('0x75')](_0x129d60,_0xffe403);break;case _0x791a('0x76'):if(_0x3cf4c7[_0x791a('0x77')]===_0x791a('0x6a')){_0x2e3432[_0x38adc1](_0x791a('0x78'),'%'+_0x3cf4c7[_0x791a('0x68')]+'%',null);}else{_0x32d521=_[_0x791a('0x66')](_0x338e70,['name','UserId']);_0x3cf4c7['field']=_0x791a('0x3d');_0x356cd8=as[_0x791a('0x79')](_0x215010,_0x32d521[_0x791a('0x70')],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8[_0x791a('0x68')][_0x791a('0x1e')]);}break;case _0x791a('0x2d'):_0x356cd8=as[_0x791a('0x79')]('me',null,_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8['text'],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8['value'][_0x791a('0x1e')]);break;}}else{var _0x356cd8=as['buildExpression'](_0x215010,_0x32d521['type'],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')]['start'],_0x356cd8['value'][_0x791a('0x1e')]);}}}else{var _0x13d6bf=_(_0x21d942[_0x791a('0x45')])['keys']()[_0x791a('0x32')](function(_0x4b27a7){return _[_0x791a('0x7a')](_0x338e70,[_0x791a('0x29'),_0x4b27a7])?_0x4b27a7:undefined;})[_0x791a('0x7b')]()[_0x791a('0x68')]();if(!_[_0x791a('0x7c')](_0x13d6bf)){_0x13d6bf[_0x791a('0x36')](function(_0x4b7e47){if(_0x4b7e47===_0x791a('0x7d')){_0x45541b[_0x791a('0x4e')](_0x791a('0x7e'),[][_0x791a('0x7f')](_0x21d942[_0x791a('0x45')][_0x4b7e47]));}else if(_0x4b7e47===_0x791a('0x80')){var _0x265584=JSON[_0x791a('0x81')](_0x21d942[_0x791a('0x45')][_0x4b7e47])[_0x791a('0x82')];var _0x93def2=JSON[_0x791a('0x81')](_0x21d942[_0x791a('0x45')][_0x4b7e47])[_0x791a('0x83')];_0x45541b[_0x791a('0x4e')](_0x791a('0x84'),_0x265584,_0x93def2);}else{if(_0x21d942[_0x791a('0x45')][_0x4b7e47]===_0x791a('0x85')){_0x45541b['where']('i.'+_0x4b7e47+_0x791a('0x86'));}else{_0x45541b[_0x791a('0x4e')]('i.'+_0x4b7e47+_0x791a('0x87'),_0x21d942[_0x791a('0x45')][_0x4b7e47]);}}});}if(_0x21d942[_0x791a('0x45')]['read']){if(_0x21d942[_0x791a('0x45')]['read']==0x1){_0x45541b[_0x791a('0x69')]('`unreadMessages`\x20=\x200');}else{_0x45541b[_0x791a('0x69')](_0x791a('0x88'));}}if(_0x21d942['query'][_0x791a('0x89')]){_0x129d60=_[_0x791a('0x8a')](_0x21d942[_0x791a('0x45')]['tag'])?_0x21d942[_0x791a('0x45')]['tag']:new Array(_0x21d942[_0x791a('0x45')]['tag']);_0x129d60['forEach'](function(_0x4eda9d){_0x2001ce['or'](_0x791a('0x74'),'%,'+_0x4eda9d+',%');});}if(_0x21d942[_0x791a('0x45')][_0x791a('0x8b')]){var _0xbcb58a=_0x21d942['query'][_0x791a('0x8b')][_0x791a('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x791a('0x8d')](_0xbcb58a)){_0x2e3432['or'](_0x791a('0x8e'),_0xbcb58a+'%');}else{_0x2e3432['or'](_0x791a('0x8f'),qs['getFullTextValue'](_0xbcb58a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xbcb58a+'%');}}}_0x45541b[_0x791a('0x4e')](_0x2e3432);_0x45541b[_0x791a('0x90')](_0x791a('0x91'));var _0x55f42d={'type':db[_0x791a('0x92')][_0x791a('0x93')][_0x791a('0x94')],'raw':!![]};var _0x4da737=_0x45541b['clone']();_0x4da737[_0x791a('0x4f')](_0x791a('0x91'));_0x4da737[_0x791a('0x4f')](_0x791a('0x95'),'unreadMessages');if(_0x4e379e['order']){_0x4e379e[_0x791a('0x4d')][_0x791a('0x36')](function(_0x350d64){var _0x100c74=_0x350d64[0x0]===_0x791a('0x96')?_0x350d64[0x0]:'i.'+_0x350d64[0x0];_0x45541b[_0x791a('0x4d')](_0x100c74,_0x350d64[0x1]===_0x791a('0x97')?![]:!![]);});}if(!_[_0x791a('0x7c')](_0x129d60)){_0x45541b[_0x791a('0x69')](_0x2001ce);_0x4da737[_0x791a('0x4e')](_0x791a('0x98'),_0x129d60);}BPromise[_0x791a('0x99')]()[_0x791a('0x27')](function(){if(!_0x2bfb66){if(_0x21d942['query'][_0x791a('0x7d')])return;_0x4da737[_0x791a('0x4e')](_0x791a('0x9a'));_0x45541b[_0x791a('0x4e')](_0x791a('0x9a'));return;}if(_0x21d942[_0x791a('0x9b')][_0x791a('0x9c')]!==_0x791a('0x2f'))return;return _0x21d942[_0x791a('0x9b')][_0x791a('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x19d6bd){if(_[_0x791a('0x7c')](_0x19d6bd)){_0x4da737['where'](_0x791a('0x9e'));_0x45541b[_0x791a('0x4e')](_0x791a('0x9e'));}else{_0x4da737[_0x791a('0x4e')](_0x791a('0x7e'),_['map'](_0x19d6bd,'id'));_0x45541b['where'](_0x791a('0x7e'),_[_0x791a('0x32')](_0x19d6bd,'id'));}});})['then'](function(){if(_0x21d942['user'][_0x791a('0x9c')]===_0x791a('0x2f')&&!_0x2bfb66&&!_0x21d942[_0x791a('0x45')][_0x791a('0x7d')])return[];return db[_0x791a('0x9f')][_0x791a('0x45')](_0x4da737[_0x791a('0xa0')](),_0x55f42d);})[_0x791a('0x27')](function(_0x5cbf23){_0x1eb5b1['count']=_0x5cbf23['length'];if(_0x1eb5b1[_0x791a('0x23')]===0x0)return[];return db[_0x791a('0x9f')][_0x791a('0x45')](_0x346467['toString'](),_0x55f42d)['then'](function(_0x37880d){_0x3e0b17=_[_0x791a('0xa1')](_0x37880d,'id');_0x55f42d=_[_0x791a('0x2c')](_0x55f42d,{'model':db[_0x791a('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21d942['query'][_0x791a('0x49')]){_0x4e379e[_0x791a('0x48')][_0x791a('0x36')](function(_0xae5e61){_0x45541b[_0x791a('0x4f')]('i.'+_0xae5e61);});}else{_0x45541b[_0x791a('0x4f')](_0x791a('0x95'),_0x791a('0x67'));_0x45541b[_0x791a('0x4f')](_0x791a('0xa3'),_0x791a('0xa4'));_0x45541b['field'](_0x791a('0xa5'),_0x791a('0xa6'));_0x45541b[_0x791a('0x4f')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x45541b['field'](_0x791a('0xa7'));_0x45541b[_0x791a('0x4f')](_0x791a('0xa8'),_0x791a('0xa9'));_0x45541b[_0x791a('0x4f')](_0x791a('0xaa'),'Contact.lastName');_0x45541b[_0x791a('0x4f')](_0x791a('0xab'),_0x791a('0xac'));_0x45541b['field'](_0x791a('0xad'),_0x791a('0xae'));_0x45541b['field'](_0x791a('0xaf'),'Contact.mobile');_0x45541b[_0x791a('0x4f')]('c.fax',_0x791a('0xb0'));_0x45541b['field']('o.fullname','Owner.fullname');_0x45541b['field'](_0x791a('0xb1'),_0x791a('0xb2'));_0x45541b[_0x791a('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x791a('0x35'));}if(_0x4e379e[_0x791a('0x21')])_0x45541b[_0x791a('0x21')](_0x4e379e[_0x791a('0x21')]);if(_0x4e379e[_0x791a('0x20')])_0x45541b['offset'](_0x4e379e['offset']);return db[_0x791a('0x9f')][_0x791a('0x45')](_0x45541b[_0x791a('0xa0')](),_0x55f42d);})['then'](function(_0x260ffd){if(_0x260ffd['length']>0x0)_0xbcab79[_0x791a('0x4e')](_0x791a('0xb3'),_[_0x791a('0x32')](_0x260ffd,'id'));return db['sequelize'][_0x791a('0x45')](_0xbcab79[_0x791a('0xa0')](),_0x55f42d)[_0x791a('0x27')](function(_0x480688){var _0x4e0f46=_[_0x791a('0xb4')](_0x480688,_0x791a('0xb5'));var _0x432795=[];_0x260ffd[_0x791a('0x36')](function(_0xb39ddf){_0x432795['push'](updateChatInteraction(_0xb39ddf,_0x3e0b17,_0x4e0f46));});return BPromise['all'](_0x432795);});});})['then'](function(_0x5d5b8a){_0x1eb5b1[_0x791a('0xb6')]=_0x5d5b8a;return _0x1eb5b1;})['then'](respondWithFilteredResult(_0x2d1f92,_0x4e379e))[_0x791a('0xb7')](handleError(_0x2d1f92,null));};exports[_0x791a('0xb8')]=function(_0x3f113c,_0x3411b9){var _0x2abd26={'raw':![],'where':{'id':_0x3f113c[_0x791a('0xb9')]['id']}},_0x1a3b01={};_0x1a3b01[_0x791a('0x43')]=_[_0x791a('0x44')](db[_0x791a('0xa2')][_0x791a('0xba')]);_0x1a3b01['query']=_[_0x791a('0x44')](_0x3f113c[_0x791a('0x45')]);_0x1a3b01['filters']=_[_0x791a('0x47')](_0x1a3b01[_0x791a('0x43')],_0x1a3b01[_0x791a('0x45')]);_0x2abd26['attributes']=_[_0x791a('0x47')](_0x1a3b01[_0x791a('0x43')],qs[_0x791a('0x49')](_0x3f113c['query'][_0x791a('0x49')]));_0x2abd26[_0x791a('0x48')]=_0x2abd26[_0x791a('0x48')][_0x791a('0x4a')]?_0x2abd26['attributes']:_0x1a3b01['model'];if(_0x3f113c['query']['includeAll']){_0x2abd26[_0x791a('0xbb')]=[{'all':!![]}];}_0x2abd26=_[_0x791a('0x2c')]({},_0x2abd26,_0x3f113c['options']);return db[_0x791a('0xa2')][_0x791a('0x66')](_0x2abd26)[_0x791a('0x27')](handleEntityNotFound(_0x3411b9,null))[_0x791a('0x27')](respondWithResult(_0x3411b9,null))[_0x791a('0xb7')](handleError(_0x3411b9,null));};exports[_0x791a('0xbc')]=function(_0x83db3a,_0x584f48){return db[_0x791a('0xa2')][_0x791a('0xbc')](_0x83db3a['body'],{})[_0x791a('0x27')](respondWithResult(_0x584f48,0xc9))['catch'](handleError(_0x584f48,null));};exports[_0x791a('0x25')]=function(_0x1a2ae1,_0x1c6574){if(_0x1a2ae1['body']['id']){delete _0x1a2ae1[_0x791a('0x2d')]['id'];}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x1a2ae1[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x1c6574,null))[_0x791a('0x27')](saveUpdates(_0x1a2ae1[_0x791a('0x2d')],null))[_0x791a('0x27')](respondWithResult(_0x1c6574,null))[_0x791a('0xb7')](handleError(_0x1c6574,null));};exports[_0x791a('0x26')]=function(_0x4f1d72,_0x4e840c){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x4f1d72[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x4e840c,null))[_0x791a('0x27')](removeEntity(_0x4e840c,null))['catch'](handleError(_0x4e840c,null));};exports['describe']=function(_0x439ec8,_0x1ce92c){return db[_0x791a('0xa2')][_0x791a('0xbd')]()[_0x791a('0x27')](respondWithResult(_0x1ce92c,null))[_0x791a('0xb7')](handleError(_0x1ce92c,null));};exports['createVidaooSession']=function(_0x27c37d,_0x541d45){var _0x32437e=_0x27c37d['params']['id'];var _0x2994b6;var _0x59a5b1;var _0x4c6b20;return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x32437e}})[_0x791a('0x27')](function(_0x371b29){_0x2994b6=_0x371b29;return db[_0x791a('0xbf')][_0x791a('0xbe')]({'where':{'id':_0x371b29[_0x791a('0x7d')]},'attributes':['id','vidaooApiKey',_0x791a('0xc0'),_0x791a('0xc1'),_0x791a('0xc2'),_0x791a('0xc3')],'raw':!![]});})[_0x791a('0x27')](function(_0x2766a8){if(_0x2766a8&&_0x2766a8['vidaooApiKey']&&_0x2766a8[_0x791a('0xc0')]){_0x59a5b1=_0x2766a8;var _0x4b196b={'interaction':{'id':_0x32437e},'agent':{'id':_0x27c37d['user']['id'],'name':_0x27c37d[_0x791a('0x9b')]['name'],'fullname':_0x27c37d[_0x791a('0x9b')]['fullname'],'email':_0x27c37d[_0x791a('0x9b')]['email']},'contact':_0x27c37d['body'][_0x791a('0x2e')],'account':_0x27c37d[_0x791a('0x2d')]['account']};var _0x5cfaed={'rejectUnauthorized':![],'method':'POST','url':_0x791a('0xc4'),'headers':{'X-APIKEY':_0x2766a8[_0x791a('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x27c37d[_0x791a('0x9b')][_0x791a('0xc6')]],'buttons':null,'topic':_0x59a5b1[_0x791a('0xc1')],'note':_['isNull'](_0x59a5b1['vidaooNote'])?null:getMustacheRender(_0x59a5b1[_0x791a('0xc2')],_0x4b196b),'metadata':null},'redirect':_0x791a('0xc7'),'json':!![]};try{if(!_['isNull'](_0x59a5b1[_0x791a('0xc3')])){var _0x5a49d1=getMustacheRender(_0x59a5b1[_0x791a('0xc3')],_0x4b196b);var _0x327920=JSON['parse'](_0x5a49d1);_0x5cfaed[_0x791a('0x2d')][_0x791a('0xc8')]=_0x327920;}}catch(_0x401df3){throw new db[(_0x791a('0x92'))][(_0x791a('0xc9'))](_0x791a('0xca'));}return rp(_0x5cfaed);}else{throw new db[(_0x791a('0x92'))]['ValidationError'](_0x791a('0xcb'));}})[_0x791a('0x27')](function(_0x3583fc){_0x4c6b20=_0x3583fc;if(_0x4c6b20['id']){var _0x484f0c={'body':_0x4c6b20['join_url'],'ChatWebsiteId':_0x59a5b1['id'],'ChatInteractionId':_0x2994b6['id'],'direction':'out','UserId':_0x27c37d[_0x791a('0x9b')]['id']};return db[_0x791a('0xcc')][_0x791a('0xbc')](_0x484f0c,{});}else{throw new db[(_0x791a('0x92'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x2994b6[_0x791a('0xcd')]({'vidaooSessionId':_0x4c6b20['id']});})[_0x791a('0x27')](respondWithResult(_0x541d45,null))[_0x791a('0xb7')](handleError(_0x541d45,null));};exports['customUpdate']=function(_0x4bd342,_0x3b8bd7){if(_0x4bd342[_0x791a('0x2d')]['id']){delete _0x4bd342['body']['id'];}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x4bd342[_0x791a('0xb9')]['id']},'include':[{'model':db[_0x791a('0xce')],'as':_0x791a('0xcf')}]})[_0x791a('0x27')](handleEntityNotFound(_0x3b8bd7,null))[_0x791a('0x27')](saveUpdates(_0x4bd342[_0x791a('0x2d')],null))[_0x791a('0x27')](respondWithResult(_0x3b8bd7,null))['catch'](handleError(_0x3b8bd7,null));};exports[_0x791a('0xd0')]=function(_0x308094,_0x15376a){if(_0x308094[_0x791a('0x2d')]['id']){delete _0x308094[_0x791a('0x2d')]['id'];}return db['ChatInteraction'][_0x791a('0x66')]({'where':{'id':_0x308094[_0x791a('0xb9')]['id']}})['then'](function(_0x19cd58){if(!_0x19cd58){logger[_0x791a('0x18')](_0x791a('0xd1'),_0x791a('0xd0'),0x194,_0x791a('0xd2'));_0x15376a[_0x791a('0x1c')](0x194);}else{if(_0x19cd58[_0x791a('0x3d')]){throw new db[(_0x791a('0x92'))][(_0x791a('0xc9'))](_0x791a('0xd3'));}}return _0x19cd58;})[_0x791a('0x27')](function(_0x226a53){if(_0x226a53){return _0x226a53[_0x791a('0x25')]({'closed':_0x308094['body'][_0x791a('0x3c')],'disposition':_0x308094[_0x791a('0x2d')][_0x791a('0x3f')]})[_0x791a('0x27')](function(_0x275b87){return _0x275b87;});}})[_0x791a('0x27')](function(){return respondWithRpcPromise('AbandonInteraction',_0x791a('0xd0'),_0x308094[_0x791a('0x2d')],client9004);})[_0x791a('0x27')](respondWithResult(_0x15376a,null))[_0x791a('0xb7')](handleError(_0x15376a,null));};exports[_0x791a('0xd4')]=function(_0x41cc4d,_0x49dd2){_0x41cc4d[_0x791a('0x2d')][_0x791a('0x29')]=_0x41cc4d[_0x791a('0xd5')]['originalname'];_0x41cc4d[_0x791a('0x2d')][_0x791a('0xd6')]=_0x41cc4d[_0x791a('0xd5')]['filename'];_0x41cc4d[_0x791a('0x2d')][_0x791a('0x70')]=_0x41cc4d[_0x791a('0xd5')]['mimetype'];return db['Attachment'][_0x791a('0xbc')](_0x41cc4d[_0x791a('0x2d')])[_0x791a('0x27')](respondWithResult(_0x49dd2,0xc9))[_0x791a('0xb7')](handleError(_0x49dd2,null));};exports[_0x791a('0xd7')]=function(_0x6422b6,_0x421483){return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x6422b6[_0x791a('0xb9')]['id']},'raw':!![]})[_0x791a('0x27')](handleEntityNotFound(_0x421483,null))['then'](function(_0x50ddb){if(_0x50ddb){if(_0x50ddb[_0x791a('0x3c')]){return _0x421483[_0x791a('0x1d')](0x193)[_0x791a('0x1f')]({'status':0x193,'message':_0x791a('0xd8')});}return db[_0x791a('0xd9')][_0x791a('0xbe')]({'where':{'id':_0x6422b6[_0x791a('0x45')][_0x791a('0xda')]},'raw':!![]})[_0x791a('0x27')](handleEntityNotFound(_0x421483,null));}})[_0x791a('0x27')](function(_0x3781d1){if(_0x3781d1){var _0xac33c0=_0x3781d1[_0x791a('0xdb')]!==null;var _0x255852=path[_0x791a('0xdc')](config[_0x791a('0xdd')],'server/files/attachments/');if(_0xac33c0){_0x255852=path[_0x791a('0xdc')](_0x255852,_0x791a('0xde'));}var _0x3cd9ec=path[_0x791a('0xdc')](_0x255852,_0x3781d1[_0x791a('0xd6')]);return _0x421483['download'](_0x3cd9ec);}})[_0x791a('0xb7')](handleError(_0x421483,null));};exports[_0x791a('0xdf')]=function(_0x3bc1dc,_0x4c33af){var _0x5871b0=null;var _0x450439=null;var _0x1db761=null;if(_0x3bc1dc['body']['id']){delete _0x3bc1dc[_0x791a('0x2d')]['id'];}if(_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')]){_0x1db761=path[_0x791a('0xdc')](config[_0x791a('0xdd')],'server/files/chat/upload/',util['format'](_0x791a('0xe1'),Date[_0x791a('0xe2')]()));_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe3')]=_0x1db761;}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x3bc1dc[_0x791a('0xb9')]['id']},'include':[{'model':db[_0x791a('0xcc')],'as':_0x791a('0xe4'),'include':[{'model':db[_0x791a('0x76')],'as':_0x791a('0x76')}]}]})['then'](handleEntityNotFound(_0x4c33af,null))['then'](saveUpdates(_0x3bc1dc[_0x791a('0x2d')],null))[_0x791a('0x27')](function(_0x152a56){if(_0x152a56){_0x5871b0=_0x152a56;return db[_0x791a('0xbf')][_0x791a('0x66')]({'where':{'id':_0x5871b0['ChatWebsiteId']}});}})[_0x791a('0x27')](function(_0x94d697){if(_0x94d697){_0x450439=_0x94d697;return db[_0x791a('0xce')][_0x791a('0x66')]({'where':{'id':_0x5871b0[_0x791a('0x6f')]}});}})[_0x791a('0x27')](function(_0x3c642c){if(_0x3c642c){if(_0x1db761){var _0x544afc=null;for(var _0x8c5f69=0x1;_0x8c5f69<_0x5871b0[_0x791a('0xe4')][_0x791a('0x4a')];++_0x8c5f69){_0x544afc=_0x5871b0[_0x791a('0xe4')][_0x8c5f69];var _0x1c8d33=_0x544afc['UserId']?util['format']('%s%d',_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):_0x791a('0xe6');var _0x4080f2=_0x3bc1dc[_0x791a('0x2d')]['customer']||util[_0x791a('0xe7')](_0x791a('0xe8'),'Visitor',_0x544afc[_0x791a('0x6f')]);switch(_0x450439['agentIdentifier']){case'website_alias':_0x1c8d33=_0x544afc['UserId']?util[_0x791a('0xe7')](_0x791a('0xe8'),_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):_0x791a('0xe6');break;case _0x791a('0xe9'):_0x1c8d33=_0x544afc[_0x791a('0x3d')]?_0x544afc[_0x791a('0x76')][_0x791a('0xea')]||_0x544afc[_0x791a('0x76')]['fullname']:_0x791a('0xe6');break;case _0x791a('0xeb'):_0x1c8d33=_0x544afc[_0x791a('0x3d')]?_0x544afc['User'][_0x791a('0x33')]:_0x791a('0xe6');break;default:_0x1c8d33=_0x544afc[_0x791a('0x3d')]?util[_0x791a('0xe7')]('%s%d',_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):'System';}var _0x11ec18=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x544afc[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xec')),_0x544afc['direction']==='in'?_0x4080f2:_0x1c8d33,_0x544afc['body']);if(!_0x544afc[_0x791a('0xed')]){fs[_0x791a('0xee')](_0x1db761,_0x11ec18);}}return db[_0x791a('0xef')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x791a('0xf0')],'as':_0x791a('0xf1'),'raw':!![],'include':[{'model':db[_0x791a('0xf2')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x791a('0x27')](function(_0x3ca8df){if(!_0x3ca8df||!_0x3ca8df[_0x791a('0xf1')]||!_0x3bc1dc['body'])return _0x5871b0;var _0xb5ea00=_0x3ca8df[_0x791a('0xf3')]();return respondWithRpcPromise(_0x791a('0xf4'),_0x791a('0xf5'),{'account':_0xb5ea00,'message':{'from':util[_0x791a('0xe7')](_0x791a('0xf6'),_0x3ca8df[_0x791a('0x29')],_0x3ca8df[_0x791a('0xc6')]||_0x3ca8df['Smtp'][_0x791a('0x9b')]),'to':_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')],'subject':'Mail\x20Transcript','text':util[_0x791a('0xe7')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')]),'attachments':[{'path':_0x1db761}]}})[_0x791a('0x27')](function(){return _0x5871b0;})[_0x791a('0xb7')](function(_0x4e8801){logger[_0x791a('0x18')](_0x4e8801);});})[_0x791a('0x27')](respondWithStatusCode(_0x4c33af,0xc8))[_0x791a('0xb7')](handleError(_0x4c33af,null));};exports[_0x791a('0xf7')]=function(_0x71e04c,_0x3219d9){return db[_0x791a('0xcc')]['find']({'where':{'id':_0x71e04c[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x3219d9,null))[_0x791a('0x27')](function(_0x1f8d6d){if(_0x1f8d6d){return _0x1f8d6d[_0x791a('0xf7')](_0x71e04c[_0x791a('0x2d')][_0x791a('0xf8')],_[_0x791a('0xf9')](_0x71e04c[_0x791a('0x2d')],['ids','id'])||{});}})[_0x791a('0x27')](respondWithResult(_0x3219d9,null))[_0x791a('0xb7')](handleError(_0x3219d9,null));};exports[_0x791a('0xfa')]=function(_0x4b19c6,_0xa51ffb){var _0x3b356f={'raw':![],'where':{}};var _0x30d901={};var _0x3e0953={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4b19c6[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0xa51ffb,null))[_0x791a('0x27')](function(_0x2cb8f4){if(_0x2cb8f4){_0x30d901['model']=_[_0x791a('0x44')](db[_0x791a('0xcc')][_0x791a('0xba')]);_0x30d901[_0x791a('0x45')]=_[_0x791a('0x44')](_0x4b19c6[_0x791a('0x45')]);_0x30d901[_0x791a('0x46')]=_[_0x791a('0x47')](_0x30d901[_0x791a('0x43')],_0x30d901[_0x791a('0x45')]);_0x3b356f['attributes']=_[_0x791a('0x47')](_0x30d901[_0x791a('0x43')],qs[_0x791a('0x49')](_0x4b19c6['query'][_0x791a('0x49')]));_0x3b356f[_0x791a('0x48')]=_0x3b356f[_0x791a('0x48')][_0x791a('0x4a')]?_0x3b356f['attributes']:_0x30d901['model'];if(!_0x4b19c6[_0x791a('0x45')][_0x791a('0x4b')](_0x791a('0x4c'))){_0x3b356f['limit']=qs['limit'](_0x4b19c6[_0x791a('0x45')][_0x791a('0x21')]);_0x3b356f[_0x791a('0x20')]=qs['offset'](_0x4b19c6[_0x791a('0x45')][_0x791a('0x20')]);}_0x3b356f[_0x791a('0x4d')]=qs['sort'](_0x4b19c6[_0x791a('0x45')][_0x791a('0xfb')]);_0x3b356f['where']=qs[_0x791a('0x46')](_[_0x791a('0xfc')](_0x4b19c6[_0x791a('0x45')],_0x30d901[_0x791a('0x46')]));_0x3b356f[_0x791a('0x4e')][_0x791a('0xb5')]=_0x2cb8f4['id'];if(_0x4b19c6['query'][_0x791a('0x8b')]){_0x3b356f[_0x791a('0x4e')]=_[_0x791a('0x2c')](_0x3b356f['where'],{'$or':_[_0x791a('0x32')](_0x3b356f[_0x791a('0x48')],function(_0x133a27){var _0x48db0d={};_0x48db0d[_0x133a27]={'$like':'%'+_0x4b19c6['query']['filter']+'%'};return _0x48db0d;})});}if(_0x4b19c6[_0x791a('0x45')][_0x791a('0x82')]){var _0x124eb4=_0x4b19c6[_0x791a('0x45')][_0x791a('0x82')][_0x791a('0x6b')](',');var _0x471d1f={};_0x471d1f[_0x124eb4[0x0]]={'$gte':moment(_0x124eb4[0x1])['format'](_0x791a('0xfd'))};_0x3b356f[_0x791a('0x4e')]=_['merge'](_0x3b356f['where'],_0x471d1f);}_0x3b356f=_[_0x791a('0x2c')]({},_0x3b356f,_0x4b19c6[_0x791a('0xfe')]);return db['ChatMessage']['count']({'where':_0x3b356f[_0x791a('0x4e')]})[_0x791a('0x27')](function(_0x5a6190){_0x3e0953[_0x791a('0x23')]=_0x5a6190;if(_0x4b19c6[_0x791a('0x45')]['includeAll']){_0x3b356f[_0x791a('0xbb')]=[{'all':!![]}];}return db[_0x791a('0xcc')][_0x791a('0xff')](_0x3b356f);})[_0x791a('0x27')](function(_0xba19bb){_0x3e0953[_0x791a('0xb6')]=_0xba19bb;return _0x3e0953;});}})[_0x791a('0x27')](respondWithFilteredResult(_0xa51ffb,_0x3b356f))[_0x791a('0xb7')](handleError(_0xa51ffb,null));};exports[_0x791a('0x100')]=function(_0x3e22c5,_0x39ce3d){var _0xf23869={'where':{}},_0x3f3871={},_0x5bbbf9={'count':0x0,'rows':[]};return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x3e22c5[_0x791a('0xb9')]['id']}})['then'](handleEntityNotFound(_0x39ce3d,null))[_0x791a('0x27')](function(_0x4dd8e1){if(_0x4dd8e1){_0x3f3871[_0x791a('0x43')]=_[_0x791a('0x44')](db[_0x791a('0xcc')][_0x791a('0xba')]);_0x3f3871[_0x791a('0x45')]=_[_0x791a('0x44')](_0x3e22c5[_0x791a('0x45')]);_0x3f3871[_0x791a('0x46')]=_[_0x791a('0x47')](_0x3f3871[_0x791a('0x43')],_0x3f3871[_0x791a('0x45')]);_0xf23869[_0x791a('0x48')]=_[_0x791a('0x47')](_0x3f3871[_0x791a('0x43')],qs['fields'](_0x3e22c5['query']['fields']));_0xf23869[_0x791a('0x48')]=_0xf23869[_0x791a('0x48')]['length']?_0xf23869['attributes']:_0x3f3871[_0x791a('0x43')];if(!_0x3e22c5[_0x791a('0x45')][_0x791a('0x4b')](_0x791a('0x4c'))){_0xf23869[_0x791a('0x21')]=qs[_0x791a('0x21')](_0x3e22c5['query'][_0x791a('0x21')]);_0xf23869[_0x791a('0x20')]=qs[_0x791a('0x20')](_0x3e22c5['query'][_0x791a('0x20')]);}_0xf23869[_0x791a('0x4d')]=qs[_0x791a('0xfb')](_0x3e22c5[_0x791a('0x45')][_0x791a('0xfb')]);_0xf23869[_0x791a('0x4e')]=qs[_0x791a('0x46')](_[_0x791a('0xfc')](_0x3e22c5['query'],_0x3f3871['filters']));_0xf23869[_0x791a('0x4e')][_0x791a('0xb5')]=_0x4dd8e1['id'];if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x8b')]){_0xf23869[_0x791a('0x4e')]=_['merge'](_0xf23869[_0x791a('0x4e')],{'$or':_['map'](_0xf23869[_0x791a('0x48')],function(_0x196f3c){var _0xc40de0={};_0xc40de0[_0x196f3c]={'$like':'%'+_0x3e22c5[_0x791a('0x45')][_0x791a('0x8b')]+'%'};return _0xc40de0;})});}_0xf23869[_0x791a('0x4e')]['secret']=![];if(_0x3e22c5[_0x791a('0x45')]['id']){_0xf23869[_0x791a('0x4e')]['id']={'$gt':_0x3e22c5[_0x791a('0x45')]['id']};}_0xf23869=_[_0x791a('0x2c')]({},_0xf23869,_0x3e22c5['options']);return db[_0x791a('0xcc')][_0x791a('0x23')]({'where':_0xf23869[_0x791a('0x4e')]})[_0x791a('0x27')](function(_0x240038){_0x5bbbf9[_0x791a('0x23')]=_0x240038;_0xf23869[_0x791a('0xbb')]=[];if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x101')]){_0xf23869[_0x791a('0xbb')]['push']({'model':db[_0x791a('0x76')],'as':'User','attributes':['id',_0x791a('0x33'),'alias']});}if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x102')]){_0xf23869[_0x791a('0xbb')]=[{'all':!![]}];}return db[_0x791a('0xcc')][_0x791a('0xff')](_0xf23869);})[_0x791a('0x27')](function(_0x292de0){_0x5bbbf9[_0x791a('0xb6')]=_0x292de0;return _0x5bbbf9;});}})[_0x791a('0x27')](respondWithFilteredResult(_0x39ce3d,_0xf23869))[_0x791a('0xb7')](handleError(_0x39ce3d,null));};exports[_0x791a('0x103')]=function(_0xb751bd,_0x552328){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0xb751bd[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x552328,null))['then'](function(_0xcb7454){if(_0xcb7454){return _0xcb7454[_0x791a('0x104')](_0xb751bd['body']['ids'],_[_0x791a('0xf9')](_0xb751bd[_0x791a('0x2d')],[_0x791a('0xf8'),'id'])||{})['spread'](function(){return db[_0x791a('0x73')][_0x791a('0xff')]({'attributes':['id',_0x791a('0x29'),_0x791a('0x50')],'where':{'id':_0xb751bd[_0x791a('0x2d')][_0x791a('0xf8')]}});})[_0x791a('0x27')](function(_0x3c1558){socket[_0x791a('0x105')](_0x791a('0x106'),{'id':Number(_0xb751bd[_0x791a('0xb9')]['id']),'tags':_0x3c1558||[]});return{'id':Number(_0xb751bd[_0x791a('0xb9')]['id']),'tags':_0x3c1558||[]};});}})[_0x791a('0x27')](respondWithResult(_0x552328,null))[_0x791a('0xb7')](handleError(_0x552328,null));};exports['removeTags']=function(_0x19c186,_0x40b552){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x19c186['params']['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x40b552,null))['then'](function(_0x13cfc9){if(_0x13cfc9){return _0x13cfc9[_0x791a('0x107')](_0x19c186['query'][_0x791a('0xf8')]);}})['then'](respondWithStatusCode(_0x40b552,null))['catch'](handleError(_0x40b552,null));};exports[_0x791a('0x108')]=function(_0x387072,_0x57f824){var _0x400fb1=moment()[_0x791a('0x109')]()[_0x791a('0xa0')]();var _0x5674cb=path[_0x791a('0xdc')](config[_0x791a('0xdd')],_0x791a('0x10a'),'files',_0x791a('0x10b'));var _0x2eae42=path[_0x791a('0xdc')](config['root'],'server',_0x791a('0x10c'),_0x791a('0x10d'));var _0x2be76f=path['join'](_0x5674cb,_0x400fb1);var _0x5b4728=util[_0x791a('0xe7')]('transcript-%d-%s.zip',_0x387072['params']['id'],_0x400fb1);var _0xeeb20=path[_0x791a('0xdc')](_0x5674cb,_0x5b4728);var _0x225529=[];_0x225529[_0x791a('0x37')]({'model':db[_0x791a('0x76')],'as':_0x791a('0x76'),'attributes':['id',_0x791a('0x33')],'raw':!![]});_0x225529[_0x791a('0x37')]({'model':db[_0x791a('0xce')],'as':_0x791a('0xcf'),'attributes':['id',_0x791a('0x10e'),_0x791a('0x10f')],'raw':!![]});if(_0x387072['query'][_0x791a('0x10d')]){_0x225529['push']({'model':db[_0x791a('0xd9')],'as':'Attachment','raw':!![]});}var _0x702d29=[{'model':db[_0x791a('0xcc')],'as':_0x791a('0xe4'),'attributes':['id',_0x791a('0x2d'),_0x791a('0x80'),_0x791a('0x110'),_0x791a('0xed'),'read'],'include':_0x225529}];_0x702d29[_0x791a('0x37')]({'model':db['ChatWebsite'],'as':_0x791a('0x111'),'attributes':['id',_0x791a('0x29')]});_0x702d29[_0x791a('0x37')]({'model':db[_0x791a('0x76')],'as':_0x791a('0x112'),'attributes':['id',_0x791a('0x33')]});return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x387072[_0x791a('0xb9')]['id']},'include':_0x702d29})['then'](handleEntityNotFound(_0x57f824,null))[_0x791a('0x27')](function(_0x1870fe){if(_0x1870fe){var _0x8a2b07=_0x1870fe[_0x791a('0x113')]({'plain':!![]});fs['mkdirSync'](_0x2be76f);var _0x522dd0={'channel':'Chat','account':_0x8a2b07[_0x791a('0x111')][_0x791a('0x29')],'agent':_0x8a2b07['Owner']?_0x8a2b07[_0x791a('0x112')][_0x791a('0x33')]:'N.A.','createdAt':moment(_0x8a2b07[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xfd'))[_0x791a('0xa0')](),'closedAt':_0x8a2b07[_0x791a('0x3c')]?moment(_0x8a2b07['closedAt'])[_0x791a('0xe7')](_0x791a('0xfd'))[_0x791a('0xa0')]():'','disposition':_0x8a2b07[_0x791a('0x3f')],'chatInfo':{'browser':_0x8a2b07['browserName'],'os':_0x8a2b07[_0x791a('0x114')],'referer':_0x8a2b07['referer'],'customerIp':_0x8a2b07[_0x791a('0x115')],'customerPort':_0x8a2b07[_0x791a('0x116')]?_0x8a2b07[_0x791a('0x116')]:_0x791a('0x117')},'messages':_(_0x8a2b07[_0x791a('0xe4')])[_0x791a('0x118')]()[_0x791a('0x8b')]({'secret':![]})[_0x791a('0x32')](function(_0x3ee4f4){if(_0x3ee4f4['Attachment']){var _0xe74178=path[_0x791a('0xdc')](_0x2eae42,_0x3ee4f4[_0x791a('0xd9')]['basename']);if(fs['existsSync'](_0xe74178)){fs[_0x791a('0x119')](_0xe74178)['pipe'](fs[_0x791a('0x11a')](path['join'](_0x2be76f,_0x3ee4f4[_0x791a('0xd9')][_0x791a('0xd6')])));}}return{'date':moment(_0x3ee4f4[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xfd'))['toString'](),'sender':_0x3ee4f4[_0x791a('0x110')]===_0x791a('0x11b')?_0x3ee4f4[_0x791a('0x76')]?_0x3ee4f4[_0x791a('0x76')][_0x791a('0x33')]:_0x791a('0xe6'):_0x3ee4f4['Contact'][_0x791a('0x10e')]+(_0x3ee4f4[_0x791a('0xcf')][_0x791a('0x10f')]?'\x20'+_0x3ee4f4[_0x791a('0xcf')][_0x791a('0x10f')]:''),'body':_0x3ee4f4['Attachment']?_0x3ee4f4[_0x791a('0xd9')][_0x791a('0xd6')]:_0x3ee4f4['body'],'direction':_0x3ee4f4[_0x791a('0x110')]===_0x791a('0x11b')?'A':'C','secret':_0x3ee4f4[_0x791a('0xed')],'read':_0x3ee4f4[_0x791a('0x11c')],'attachment':_0x3ee4f4[_0x791a('0xd9')]};})[_0x791a('0x68')]()};return ejs[_0x791a('0x11d')](path[_0x791a('0xdc')](config[_0x791a('0xdd')],_0x791a('0x10a'),'views','downloadInteraction.ejs'),{'interaction':_0x522dd0})[_0x791a('0x27')](function(_0x58b486){var _0x44909e=path['join'](_0x2be76f,'transcript-'+_0x8a2b07['id']+'-'+_0x400fb1+'.pdf');var _0x7918b4={'path':_0x44909e,'channel':_0x791a('0x11e'),'interactionId':_0x8a2b07['id']};return pdf[_0x791a('0x11f')](_0x58b486,_0x7918b4);})[_0x791a('0x27')](function(){return new Promise(function(_0x27b7fa,_0x122702){zipdir(_0x2be76f,{'saveTo':_0xeeb20},function(_0x4ece8a,_0x2ac438){if(_0x4ece8a)return _0x122702(_0x4ece8a);return _0x27b7fa(_0x2ac438);});})[_0x791a('0x27')](function(){return new BPromise(function(_0x1e5bbb,_0x48b2c7){rimraf(_0x2be76f,function(_0x1e7b8c){if(_0x1e7b8c)_0x48b2c7(_0x1e7b8c);return _0x1e5bbb();});});})['then'](function(){return _0x57f824['download'](_0xeeb20,_0x5b4728,function(_0xb73a80){if(_0xb73a80){logger[_0x791a('0x18')](_0x791a('0x120'),_0xb73a80);}else{fs[_0x791a('0x121')](_0xeeb20);}});});});}else{return _0x57f824['sendStatus'](0xc8);}})[_0x791a('0xb7')](handleError(_0x57f824,null));}; \ No newline at end of file +var _0x5636=['update','then','destroy','sendStatus','stack','name','send','render','body','contact','agent','interaction','account','map','Tags','TagIds','forEach','push','talking','answered','abandoned','total','closed','UserId','waiting','disposition','unmanaged','index','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20>\x200','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','some','compact','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','options','ChatInteraction','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','isNull','metadata','ValidationError','Sequelize','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','Attachment','json','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','format','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','secret','addTags','setTags','emit','chatInteractionTags:save','removeTags','server','tmp','files','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','mustache','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./chatInteraction.socket','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','undefined','limit','count','offset','Content-Range'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x5636,0x102));var _0x6563=function(_0x4f0bd1,_0x98f6de){_0x4f0bd1=_0x4f0bd1-0x0;var _0x2a546d=_0x5636[_0x4f0bd1];return _0x2a546d;};'use strict';var rimraf=require(_0x6563('0x0'));var zipdir=require(_0x6563('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6563('0x2'));var util=require(_0x6563('0x3'));var path=require(_0x6563('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6563('0x5'));var squel=require(_0x6563('0x6'));var Redis=require(_0x6563('0x7'));var qs=require(_0x6563('0x8'));var as=require(_0x6563('0x9'));var pdf=require(_0x6563('0xa'));var logger=require(_0x6563('0xb'))(_0x6563('0xc'));var config=require(_0x6563('0xd'));var db=require(_0x6563('0xe'))['db'];config[_0x6563('0xf')]=_[_0x6563('0x10')](config[_0x6563('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6563('0xf')]));require(_0x6563('0x11'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6563('0x12')]({'port':0x232b});var client9004=jayson[_0x6563('0x13')][_0x6563('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x12429c,_0x33816e,_0x2ed676,_0x31d3fa){return new BPromise(function(_0xbbae72,_0x447f9a){var _0x51aeca=_0x31d3fa||client;return _0x51aeca[_0x6563('0x14')](_0x12429c,_0x2ed676)['then'](function(_0x37131e){logger[_0x6563('0x15')](_0x6563('0x16'),_0x33816e,_0x6563('0x17'));logger['debug'](_0x6563('0x18'),_0x33816e,_0x6563('0x17'),JSON[_0x6563('0x19')](_0x37131e));if(_0x37131e[_0x6563('0x1a')]){if(_0x37131e['error'][_0x6563('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x33816e,_0x37131e['error'][_0x6563('0x1c')]);return _0x447f9a(_0x37131e['error']['message']);}logger[_0x6563('0x1a')](_0x6563('0x16'),_0x33816e,_0x37131e[_0x6563('0x1a')][_0x6563('0x1c')]);return _0xbbae72(_0x37131e[_0x6563('0x1a')][_0x6563('0x1c')]);}else{logger[_0x6563('0x15')](_0x6563('0x16'),_0x33816e,_0x6563('0x17'));_0xbbae72(_0x37131e['result'][_0x6563('0x1c')]);}})[_0x6563('0x1d')](function(_0x20b478){logger['error'](_0x6563('0x16'),_0x33816e,_0x20b478);_0x447f9a(_0x20b478);});});}function respondWithStatusCode(_0x5c37bb,_0x5953c5){_0x5953c5=_0x5953c5||0xcc;return function(_0x105379){if(_0x105379){return _0x5c37bb['sendStatus'](_0x5953c5);}return _0x5c37bb['status'](_0x5953c5)[_0x6563('0x1e')]();};}function respondWithResult(_0x492f45,_0x1097d0){_0x1097d0=_0x1097d0||0xc8;return function(_0x19f34e){if(_0x19f34e){return _0x492f45[_0x6563('0x1f')](_0x1097d0)['json'](_0x19f34e);}};}function respondWithFilteredResult(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(_0x7ea857){var _0x1590e6=typeof _0x51ff06['offset']===_0x6563('0x20')&&typeof _0x51ff06[_0x6563('0x21')]==='undefined';var _0x2ddb2b=_0x7ea857['count'];var _0x1fe1cb=_0x1590e6?0x0:_0x51ff06['offset'];var _0x480408=_0x1590e6?_0x7ea857[_0x6563('0x22')]:_0x51ff06[_0x6563('0x23')]+_0x51ff06[_0x6563('0x21')];var _0x2a1550;if(_0x480408>=_0x2ddb2b){_0x480408=_0x2ddb2b;_0x2a1550=0xc8;}else{_0x2a1550=0xce;}_0xd860d5[_0x6563('0x1f')](_0x2a1550);return _0xd860d5['set'](_0x6563('0x24'),_0x1fe1cb+'-'+_0x480408+'/'+_0x2ddb2b)['json'](_0x7ea857);}return null;};}function saveUpdates(_0x5b100b){return function(_0x3582c9){if(_0x3582c9){return _0x3582c9[_0x6563('0x25')](_0x5b100b)[_0x6563('0x26')](function(_0xdbbdda){return _0xdbbdda;});}return null;};}function removeEntity(_0x116605){return function(_0x305861){if(_0x305861){return _0x305861[_0x6563('0x27')]()[_0x6563('0x26')](function(){_0x116605[_0x6563('0x1f')](0xcc)[_0x6563('0x1e')]();});}};}function handleEntityNotFound(_0x59b1a6){return function(_0x9b3d86){if(!_0x9b3d86){_0x59b1a6[_0x6563('0x28')](0x194);}return _0x9b3d86;};}function handleError(_0x29fb9d,_0x1558fb){_0x1558fb=_0x1558fb||0x1f4;return function(_0x29ab06){logger[_0x6563('0x1a')](_0x29ab06[_0x6563('0x29')]);if(_0x29ab06['name']){delete _0x29ab06[_0x6563('0x2a')];}_0x29fb9d[_0x6563('0x1f')](_0x1558fb)[_0x6563('0x2b')](_0x29ab06);};}function getMustacheRender(_0x46fb1b,_0x3f79da){return Mustache[_0x6563('0x2c')](_0x46fb1b,_['merge'](_0x3f79da[_0x6563('0x2d')],{'contact':_0x3f79da[_0x6563('0x2e')],'message':_0x3f79da[_0x6563('0x1c')],'agent':_0x3f79da[_0x6563('0x2f')],'interaction':_0x3f79da[_0x6563('0x30')],'account':_0x3f79da[_0x6563('0x31')]}))||'';}function getInteractionUsers(_0x3f578a,_0x4cc655){return new BPromise(function(_0x1925cc,_0x394120){try{if(_0x4cc655[_0x3f578a['id']]){_0x3f578a['Users']=_[_0x6563('0x32')](_0x4cc655[_0x3f578a['id']],function(_0x1ff47d){return{'id':_0x1ff47d['id'],'fullname':_0x1ff47d['fullname']};});}}catch(_0x582650){_0x394120(_0x582650);}_0x1925cc(_0x3f578a);});}function getInteractionTags(_0x38fef5,_0x5ca0ab){return new BPromise(function(_0x227ac1,_0x45feb9){try{if(_0x38fef5['TagIds']){_0x38fef5[_0x6563('0x33')]=[];_0x38fef5[_0x6563('0x34')]['split'](',')[_0x6563('0x35')](function(_0xe5e80f){_0x38fef5[_0x6563('0x33')][_0x6563('0x36')](_0x5ca0ab[_0xe5e80f]);});}delete _0x38fef5[_0x6563('0x34')];}catch(_0x1f6341){_0x45feb9(_0x1f6341);}_0x227ac1(_0x38fef5);});}function updateChatInteraction(_0x95e404,_0x15c23e,_0x2e4177){return new BPromise(function(_0x54b601,_0x130a88){return getInteractionUsers(_0x95e404,_0x2e4177)[_0x6563('0x26')](function(_0x3b7a24){return getInteractionTags(_0x3b7a24,_0x15c23e);})[_0x6563('0x26')](function(_0x5ebe88){return getStateInteraction(_0x5ebe88);})['then'](function(_0x13bbbb){_0x54b601(_0x13bbbb);})[_0x6563('0x1d')](function(_0x28db6f){_0x130a88(_0x28db6f);});});}function getStateInteraction(_0x5db29d){return new BPromise(function(_0x3eadab){_0x5db29d['waiting']=0x0;_0x5db29d[_0x6563('0x37')]=0x0;_0x5db29d[_0x6563('0x38')]=0x0;_0x5db29d['unmanaged']=0x0;_0x5db29d[_0x6563('0x39')]=0x0;_0x5db29d[_0x6563('0x3a')]=0x0;if(!_0x5db29d[_0x6563('0x3b')]&&!_0x5db29d[_0x6563('0x3c')]){_0x5db29d[_0x6563('0x3d')]+=0x1;}if(!_0x5db29d[_0x6563('0x3b')]&&_0x5db29d[_0x6563('0x3c')]){_0x5db29d[_0x6563('0x37')]+=0x1;if(_0x5db29d[_0x6563('0x3d')]){_0x5db29d[_0x6563('0x3d')]-=0x1;}}if(_0x5db29d[_0x6563('0x3b')]&&_0x5db29d['disposition']==='abandoned'){_0x5db29d[_0x6563('0x39')]+=0x1;if(_0x5db29d[_0x6563('0x3d')]){_0x5db29d[_0x6563('0x3d')]-=0x1;}}else if(_0x5db29d[_0x6563('0x3b')]&&!_0x5db29d[_0x6563('0x3c')]&&_0x5db29d[_0x6563('0x3e')]){_0x5db29d[_0x6563('0x3f')]+=0x1;if(_0x5db29d['waiting']){_0x5db29d[_0x6563('0x3d')]-=0x1;}}else if(_0x5db29d[_0x6563('0x3b')]&&_0x5db29d[_0x6563('0x3c')]){_0x5db29d[_0x6563('0x38')]+=0x1;if(_0x5db29d['talking']){_0x5db29d[_0x6563('0x37')]-=0x1;}}_0x5db29d[_0x6563('0x3a')]+=0x1;_0x3eadab(_0x5db29d);});}exports[_0x6563('0x40')]=function(_0x257106,_0x1032eb){var _0x4e0f0a={},_0x496602={},_0x1504ca={'count':0x0,'rows':[]};var _0x42d54c=_[_0x6563('0x32')](db['ChatInteraction'][_0x6563('0x41')],function(_0x120723){return{'name':_0x120723[_0x6563('0x42')],'type':_0x120723[_0x6563('0x43')]['key']};});_0x496602[_0x6563('0x44')]=_[_0x6563('0x32')](_0x42d54c,_0x6563('0x2a'));_0x496602['query']=_[_0x6563('0x45')](_0x257106['query']);_0x496602[_0x6563('0x46')]=_['intersection'](_0x496602['model'],_0x496602[_0x6563('0x47')]);_0x4e0f0a[_0x6563('0x48')]=_[_0x6563('0x49')](_0x496602[_0x6563('0x44')],qs[_0x6563('0x4a')](_0x257106[_0x6563('0x47')][_0x6563('0x4a')]));_0x4e0f0a[_0x6563('0x48')]=_0x4e0f0a[_0x6563('0x48')][_0x6563('0x4b')]?_0x4e0f0a['attributes']:_0x496602[_0x6563('0x44')];if(!_0x257106['query'][_0x6563('0x4c')](_0x6563('0x4d'))){_0x4e0f0a[_0x6563('0x21')]=qs['limit'](_0x257106[_0x6563('0x47')][_0x6563('0x21')]);_0x4e0f0a['offset']=qs[_0x6563('0x23')](_0x257106[_0x6563('0x47')][_0x6563('0x23')]);}_0x4e0f0a[_0x6563('0x4e')]=qs[_0x6563('0x4f')](_0x257106['query'][_0x6563('0x4f')]);_0x4e0f0a['where']=qs[_0x6563('0x46')](_['pick'](_0x257106[_0x6563('0x47')],_0x496602['filters']),_0x42d54c);var _0x55e002=[];var _0x5c8274=squel['select']()[_0x6563('0x50')]('id')['field'](_0x6563('0x2a'))['field'](_0x6563('0x51'))[_0x6563('0x52')](_0x6563('0x53'));var _0x32ebac=squel[_0x6563('0x54')]()[_0x6563('0x50')](_0x6563('0x55'))[_0x6563('0x50')](_0x6563('0x56'))['field'](_0x6563('0x57'))[_0x6563('0x52')](_0x6563('0x58'),'ui')[_0x6563('0x59')](_0x6563('0x5a'),'u',_0x6563('0x5b'));var _0x40c99b=squel[_0x6563('0x54')]()[_0x6563('0x52')](_0x6563('0x5c'),'i')[_0x6563('0x59')]('cm_contacts','c',_0x6563('0x5d'))[_0x6563('0x59')](_0x6563('0x5a'),'o',_0x6563('0x5e'))[_0x6563('0x59')](_0x6563('0x5f'),'a',_0x6563('0x60'))[_0x6563('0x59')]('chat_messages','me',_0x6563('0x61'))['left_join'](_0x6563('0x62'),'it',_0x6563('0x63'))['left_join']('tools_tags','t',_0x6563('0x64'));var _0x8f5e46=squel[_0x6563('0x65')]();var _0x39fc04=[];var _0x52fffa=squel[_0x6563('0x65')]();var _0x49c1e0;if(_0x257106[_0x6563('0x47')][_0x6563('0x66')]){_0x49c1e0=as['parseSearch'](_0x257106['query'][_0x6563('0x66')]);var _0x5bae4c=_0x49c1e0['sqlOperator'];for(var _0x1fa23f=0x0;_0x1fa23f<_0x49c1e0['conditions'][_0x6563('0x4b')];_0x1fa23f++){var _0x41adce=_0x49c1e0[_0x6563('0x67')][_0x1fa23f];var _0x21d111='i';var _0x4829ab=_[_0x6563('0x68')](_0x42d54c,[_0x6563('0x2a'),_0x41adce[_0x6563('0x50')]]);if(!_0x4829ab){switch(_0x41adce[_0x6563('0x50')]){case _0x6563('0x69'):if(_0x41adce[_0x6563('0x6a')]==0x1){_0x40c99b[_0x6563('0x6b')]('`'+_0x41adce[_0x6563('0x50')]+'`\x20=\x200');}else{_0x40c99b['having']('`'+_0x41adce[_0x6563('0x50')]+_0x6563('0x6c'));}break;case'Contact':if(_0x41adce['operator']==='$substring'){if(_0x41adce[_0x6563('0x6a')][_0x6563('0x6d')]('\x20')[_0x6563('0x4b')]>0x1){_0x8f5e46[_0x5bae4c](_0x6563('0x6e'),qs['getFullTextValue'](_0x41adce[_0x6563('0x6a')]),null);}else{var _0x1a5c54='%'+_0x41adce[_0x6563('0x6a')]+'%';_0x8f5e46[_0x5bae4c](_0x6563('0x6f'),_0x1a5c54,_0x1a5c54,_0x1a5c54);}}else{_0x4829ab=_[_0x6563('0x68')](_0x42d54c,['name','ContactId']);_0x41adce[_0x6563('0x50')]=_0x6563('0x70');_0x331239=as[_0x6563('0x71')](_0x21d111,_0x4829ab['type'],_0x41adce);_0x8f5e46[_0x5bae4c](_0x331239[_0x6563('0x72')],_0x331239['value'][_0x6563('0x73')],_0x331239[_0x6563('0x6a')][_0x6563('0x1e')]);}break;case _0x6563('0x74'):var _0x254c3f=_0x41adce[_0x6563('0x6a')][_0x6563('0x6d')](',')['map'](function(_0x58671e){return Number(_0x58671e);});_0x254c3f[_0x6563('0x35')](function(_0x1228b3){_0x52fffa['or'](_0x6563('0x75'),'%,'+_0x1228b3+',%');});_0x39fc04=_[_0x6563('0x76')](_0x39fc04,_0x254c3f);break;case _0x6563('0x77'):if(_0x41adce[_0x6563('0x78')]==='$substring'){_0x8f5e46[_0x5bae4c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x41adce['value']+'%',null);}else{_0x4829ab=_[_0x6563('0x68')](_0x42d54c,[_0x6563('0x2a'),_0x6563('0x3c')]);_0x41adce[_0x6563('0x50')]=_0x6563('0x3c');_0x331239=as['buildExpression'](_0x21d111,_0x4829ab[_0x6563('0x43')],_0x41adce);_0x8f5e46[_0x5bae4c](_0x331239[_0x6563('0x72')],_0x331239[_0x6563('0x6a')][_0x6563('0x73')],_0x331239['value'][_0x6563('0x1e')]);}break;case _0x6563('0x2d'):_0x331239=as[_0x6563('0x71')]('me',null,_0x41adce);_0x8f5e46[_0x5bae4c](_0x331239[_0x6563('0x72')],_0x331239[_0x6563('0x6a')][_0x6563('0x73')],_0x331239[_0x6563('0x6a')][_0x6563('0x1e')]);break;}}else{var _0x331239=as[_0x6563('0x71')](_0x21d111,_0x4829ab[_0x6563('0x43')],_0x41adce);_0x8f5e46[_0x5bae4c](_0x331239[_0x6563('0x72')],_0x331239[_0x6563('0x6a')][_0x6563('0x73')],_0x331239[_0x6563('0x6a')]['end']);}}}else{var _0x173574=_(_0x257106[_0x6563('0x47')])[_0x6563('0x45')]()[_0x6563('0x32')](function(_0x2b4801){return _[_0x6563('0x79')](_0x42d54c,[_0x6563('0x2a'),_0x2b4801])?_0x2b4801:undefined;})[_0x6563('0x7a')]()[_0x6563('0x6a')]();if(!_[_0x6563('0x7b')](_0x173574)){_0x173574['forEach'](function(_0x1fd976){if(_0x1fd976===_0x6563('0x7c')){_0x40c99b[_0x6563('0x7d')](_0x6563('0x7e'),[][_0x6563('0x7f')](_0x257106[_0x6563('0x47')][_0x1fd976]));}else if(_0x1fd976===_0x6563('0x80')){var _0x489c26=JSON[_0x6563('0x81')](_0x257106[_0x6563('0x47')][_0x1fd976])[_0x6563('0x82')];var _0x3aaf22=JSON[_0x6563('0x81')](_0x257106[_0x6563('0x47')][_0x1fd976])['$lte'];_0x40c99b[_0x6563('0x7d')](_0x6563('0x83'),_0x489c26,_0x3aaf22);}else{if(_0x257106[_0x6563('0x47')][_0x1fd976]==='null'){_0x40c99b[_0x6563('0x7d')]('i.'+_0x1fd976+_0x6563('0x84'));}else{_0x40c99b[_0x6563('0x7d')]('i.'+_0x1fd976+'\x20=\x20?',_0x257106['query'][_0x1fd976]);}}});}if(_0x257106['query'][_0x6563('0x85')]){if(_0x257106[_0x6563('0x47')][_0x6563('0x85')]==0x1){_0x40c99b[_0x6563('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x40c99b[_0x6563('0x6b')](_0x6563('0x86'));}}if(_0x257106['query']['tag']){_0x39fc04=_[_0x6563('0x87')](_0x257106[_0x6563('0x47')][_0x6563('0x88')])?_0x257106[_0x6563('0x47')]['tag']:new Array(_0x257106[_0x6563('0x47')][_0x6563('0x88')]);_0x39fc04[_0x6563('0x35')](function(_0x22c981){_0x52fffa['or'](_0x6563('0x75'),'%,'+_0x22c981+',%');});}if(_0x257106[_0x6563('0x47')][_0x6563('0x89')]){var _0x142c9a=_0x257106[_0x6563('0x47')]['filter'][_0x6563('0x8a')]('\x5c','\x5c\x5c')[_0x6563('0x8a')](/'/g,'\x27\x27');if(qs[_0x6563('0x8b')](_0x142c9a)){_0x8f5e46['or'](_0x6563('0x8c'),_0x142c9a+'%');}else{_0x8f5e46['or'](_0x6563('0x8d'),qs[_0x6563('0x8e')](_0x142c9a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x142c9a+'%');}}}_0x40c99b[_0x6563('0x7d')](_0x8f5e46);_0x40c99b[_0x6563('0x8f')](_0x6563('0x90'));var _0x5bec95={'type':db['Sequelize'][_0x6563('0x91')][_0x6563('0x92')],'raw':!![]};var _0x143eb9=_0x40c99b[_0x6563('0x93')]();_0x143eb9[_0x6563('0x50')]('i.id');_0x143eb9['field'](_0x6563('0x94'),'unreadMessages');if(_0x4e0f0a[_0x6563('0x4e')]){_0x4e0f0a['order']['forEach'](function(_0x2014f4){var _0x9eee43=_0x2014f4[0x0]===_0x6563('0x95')?_0x2014f4[0x0]:'i.'+_0x2014f4[0x0];_0x40c99b[_0x6563('0x4e')](_0x9eee43,_0x2014f4[0x1]===_0x6563('0x96')?![]:!![]);});}if(!_[_0x6563('0x7b')](_0x39fc04)){_0x40c99b[_0x6563('0x6b')](_0x52fffa);_0x143eb9[_0x6563('0x7d')]('t.id\x20IN\x20?',_0x39fc04);}BPromise[_0x6563('0x97')]()[_0x6563('0x26')](function(){if(!_0x49c1e0){if(_0x257106[_0x6563('0x47')][_0x6563('0x7c')])return;_0x143eb9['where'](_0x6563('0x98'));_0x40c99b['where'](_0x6563('0x98'));return;}if(_0x257106[_0x6563('0x99')][_0x6563('0x9a')]!==_0x6563('0x2f'))return;return _0x257106[_0x6563('0x99')][_0x6563('0x9b')]({'attributes':['id'],'raw':!![]})[_0x6563('0x26')](function(_0x32623a){if(_[_0x6563('0x7b')](_0x32623a)){_0x143eb9[_0x6563('0x7d')](_0x6563('0x9c'));_0x40c99b[_0x6563('0x7d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x143eb9[_0x6563('0x7d')]('i.ChatWebsiteId\x20IN\x20?',_[_0x6563('0x32')](_0x32623a,'id'));_0x40c99b[_0x6563('0x7d')](_0x6563('0x7e'),_[_0x6563('0x32')](_0x32623a,'id'));}});})[_0x6563('0x26')](function(){if(_0x257106[_0x6563('0x99')][_0x6563('0x9a')]===_0x6563('0x2f')&&!_0x49c1e0&&!_0x257106[_0x6563('0x47')][_0x6563('0x7c')])return[];return db[_0x6563('0x9d')]['query'](_0x143eb9[_0x6563('0x9e')](),_0x5bec95);})[_0x6563('0x26')](function(_0xd233f5){_0x1504ca['count']=_0xd233f5[_0x6563('0x4b')];if(_0x1504ca[_0x6563('0x22')]===0x0)return[];return db[_0x6563('0x9d')][_0x6563('0x47')](_0x5c8274[_0x6563('0x9e')](),_0x5bec95)[_0x6563('0x26')](function(_0x563412){_0x55e002=_[_0x6563('0x9f')](_0x563412,'id');_0x5bec95=_[_0x6563('0xa0')](_0x5bec95,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x257106[_0x6563('0x47')]['fields']){_0x4e0f0a['attributes'][_0x6563('0x35')](function(_0x2bcba1){_0x40c99b[_0x6563('0x50')]('i.'+_0x2bcba1);});}else{_0x40c99b[_0x6563('0x50')](_0x6563('0x94'),_0x6563('0x69'));_0x40c99b[_0x6563('0x50')](_0x6563('0xa1'),_0x6563('0xa2'));_0x40c99b[_0x6563('0x50')]('a.mandatoryDisposition',_0x6563('0xa3'));_0x40c99b[_0x6563('0x50')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x40c99b[_0x6563('0x50')](_0x6563('0xa4'));_0x40c99b[_0x6563('0x50')](_0x6563('0xa5'),'Contact.firstName');_0x40c99b[_0x6563('0x50')]('c.lastName',_0x6563('0xa6'));_0x40c99b[_0x6563('0x50')](_0x6563('0xa7'),_0x6563('0xa8'));_0x40c99b[_0x6563('0x50')](_0x6563('0xa9'),'Contact.phone');_0x40c99b['field'](_0x6563('0xaa'),_0x6563('0xab'));_0x40c99b['field'](_0x6563('0xac'),'Contact.fax');_0x40c99b['field'](_0x6563('0xad'),_0x6563('0xae'));_0x40c99b[_0x6563('0x50')](_0x6563('0xaf'),'Owner.internal');_0x40c99b[_0x6563('0x50')](_0x6563('0xb0'),_0x6563('0x34'));}if(_0x4e0f0a[_0x6563('0x21')])_0x40c99b[_0x6563('0x21')](_0x4e0f0a[_0x6563('0x21')]);if(_0x4e0f0a[_0x6563('0x23')])_0x40c99b['offset'](_0x4e0f0a[_0x6563('0x23')]);return db[_0x6563('0x9d')][_0x6563('0x47')](_0x40c99b[_0x6563('0x9e')](),_0x5bec95);})['then'](function(_0x4a12c8){if(_0x4a12c8[_0x6563('0x4b')]>0x0)_0x32ebac[_0x6563('0x7d')](_0x6563('0xb1'),_[_0x6563('0x32')](_0x4a12c8,'id'));return db[_0x6563('0x9d')][_0x6563('0x47')](_0x32ebac[_0x6563('0x9e')](),_0x5bec95)[_0x6563('0x26')](function(_0x2deafc){var _0x59b0b9=_['groupBy'](_0x2deafc,_0x6563('0xb2'));var _0x822c8=[];_0x4a12c8[_0x6563('0x35')](function(_0x2fb4b1){_0x822c8[_0x6563('0x36')](updateChatInteraction(_0x2fb4b1,_0x55e002,_0x59b0b9));});return BPromise[_0x6563('0xb3')](_0x822c8);});});})['then'](function(_0x355453){_0x1504ca[_0x6563('0xb4')]=_0x355453;return _0x1504ca;})[_0x6563('0x26')](respondWithFilteredResult(_0x1032eb,_0x4e0f0a))[_0x6563('0x1d')](handleError(_0x1032eb,null));};exports[_0x6563('0xb5')]=function(_0x42171f,_0x1192f4){var _0x54148d={'raw':![],'where':{'id':_0x42171f[_0x6563('0xb6')]['id']}},_0x1a553d={};_0x1a553d[_0x6563('0x44')]=_[_0x6563('0x45')](db['ChatInteraction'][_0x6563('0x41')]);_0x1a553d[_0x6563('0x47')]=_[_0x6563('0x45')](_0x42171f[_0x6563('0x47')]);_0x1a553d[_0x6563('0x46')]=_[_0x6563('0x49')](_0x1a553d[_0x6563('0x44')],_0x1a553d['query']);_0x54148d['attributes']=_[_0x6563('0x49')](_0x1a553d[_0x6563('0x44')],qs[_0x6563('0x4a')](_0x42171f[_0x6563('0x47')]['fields']));_0x54148d['attributes']=_0x54148d[_0x6563('0x48')][_0x6563('0x4b')]?_0x54148d['attributes']:_0x1a553d[_0x6563('0x44')];if(_0x42171f['query'][_0x6563('0xb7')]){_0x54148d['include']=[{'all':!![]}];}_0x54148d=_[_0x6563('0xa0')]({},_0x54148d,_0x42171f[_0x6563('0xb8')]);return db[_0x6563('0xb9')]['find'](_0x54148d)[_0x6563('0x26')](handleEntityNotFound(_0x1192f4,null))[_0x6563('0x26')](respondWithResult(_0x1192f4,null))[_0x6563('0x1d')](handleError(_0x1192f4,null));};exports[_0x6563('0xba')]=function(_0x40a68a,_0x1692c4){return db['ChatInteraction'][_0x6563('0xba')](_0x40a68a[_0x6563('0x2d')],{})[_0x6563('0x26')](respondWithResult(_0x1692c4,0xc9))[_0x6563('0x1d')](handleError(_0x1692c4,null));};exports[_0x6563('0x25')]=function(_0x35bdff,_0x44e5c4){if(_0x35bdff[_0x6563('0x2d')]['id']){delete _0x35bdff['body']['id'];}return db[_0x6563('0xb9')]['find']({'where':{'id':_0x35bdff[_0x6563('0xb6')]['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x44e5c4,null))['then'](saveUpdates(_0x35bdff[_0x6563('0x2d')],null))[_0x6563('0x26')](respondWithResult(_0x44e5c4,null))[_0x6563('0x1d')](handleError(_0x44e5c4,null));};exports[_0x6563('0x27')]=function(_0x367404,_0x76476e){return db[_0x6563('0xb9')]['find']({'where':{'id':_0x367404[_0x6563('0xb6')]['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x76476e,null))[_0x6563('0x26')](removeEntity(_0x76476e,null))[_0x6563('0x1d')](handleError(_0x76476e,null));};exports[_0x6563('0xbb')]=function(_0x298704,_0x2221de){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x2221de,null))[_0x6563('0x1d')](handleError(_0x2221de,null));};exports[_0x6563('0xbc')]=function(_0x4f51f4,_0x20e323){var _0x39c44e=_0x4f51f4[_0x6563('0xb6')]['id'];var _0x472c6b;var _0x9aec93;var _0x60af4;return db[_0x6563('0xb9')]['findOne']({'where':{'id':_0x39c44e}})[_0x6563('0x26')](function(_0x392dca){_0x472c6b=_0x392dca;return db[_0x6563('0xbd')][_0x6563('0xbe')]({'where':{'id':_0x392dca[_0x6563('0x7c')]},'attributes':['id',_0x6563('0xbf'),_0x6563('0xc0'),_0x6563('0xc1'),'vidaooNote',_0x6563('0xc2')],'raw':!![]});})['then'](function(_0xb1e285){if(_0xb1e285&&_0xb1e285[_0x6563('0xbf')]&&_0xb1e285[_0x6563('0xc0')]){_0x9aec93=_0xb1e285;var _0x39ad28={'interaction':{'id':_0x39c44e},'agent':{'id':_0x4f51f4['user']['id'],'name':_0x4f51f4[_0x6563('0x99')][_0x6563('0x2a')],'fullname':_0x4f51f4[_0x6563('0x99')][_0x6563('0xc3')],'email':_0x4f51f4[_0x6563('0x99')][_0x6563('0xc4')]},'contact':_0x4f51f4[_0x6563('0x2d')][_0x6563('0x2e')],'account':_0x4f51f4['body'][_0x6563('0x31')]};var _0x4ac568={'rejectUnauthorized':![],'method':_0x6563('0xc5'),'url':_0x6563('0xc6'),'headers':{'X-APIKEY':_0xb1e285[_0x6563('0xbf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f51f4[_0x6563('0x99')][_0x6563('0xc4')]],'buttons':null,'topic':_0x9aec93['vidaooTopic'],'note':_['isNull'](_0x9aec93['vidaooNote'])?null:getMustacheRender(_0x9aec93[_0x6563('0xc7')],_0x39ad28),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x6563('0xc8')](_0x9aec93['vidaooMetadata'])){var _0x26e00c=getMustacheRender(_0x9aec93[_0x6563('0xc2')],_0x39ad28);var _0x1e75f7=JSON[_0x6563('0x81')](_0x26e00c);_0x4ac568[_0x6563('0x2d')][_0x6563('0xc9')]=_0x1e75f7;}}catch(_0x5d22bd){throw new db['Sequelize'][(_0x6563('0xca'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x4ac568);}else{throw new db[(_0x6563('0xcb'))][(_0x6563('0xca'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x6563('0x26')](function(_0x5babf2){_0x60af4=_0x5babf2;if(_0x60af4['id']){var _0x4b223f={'body':_0x60af4[_0x6563('0xcc')],'ChatWebsiteId':_0x9aec93['id'],'ChatInteractionId':_0x472c6b['id'],'direction':_0x6563('0xcd'),'UserId':_0x4f51f4[_0x6563('0x99')]['id']};return db[_0x6563('0xce')][_0x6563('0xba')](_0x4b223f,{});}else{throw new db['Sequelize'][(_0x6563('0xca'))](_0x6563('0xcf'));}})[_0x6563('0x26')](function(){return _0x472c6b[_0x6563('0xd0')]({'vidaooSessionId':_0x60af4['id']});})[_0x6563('0x26')](respondWithResult(_0x20e323,null))[_0x6563('0x1d')](handleError(_0x20e323,null));};exports[_0x6563('0xd1')]=function(_0x123b5e,_0x35cbd2){if(_0x123b5e[_0x6563('0x2d')]['id']){delete _0x123b5e[_0x6563('0x2d')]['id'];}return db[_0x6563('0xb9')][_0x6563('0x68')]({'where':{'id':_0x123b5e[_0x6563('0xb6')]['id']},'include':[{'model':db[_0x6563('0xd2')],'as':_0x6563('0xd3')}]})[_0x6563('0x26')](handleEntityNotFound(_0x35cbd2,null))[_0x6563('0x26')](saveUpdates(_0x123b5e[_0x6563('0x2d')],null))['then'](respondWithResult(_0x35cbd2,null))[_0x6563('0x1d')](handleError(_0x35cbd2,null));};exports[_0x6563('0xd4')]=function(_0x1a8f03,_0x47298a){if(_0x1a8f03[_0x6563('0x2d')]['id']){delete _0x1a8f03[_0x6563('0x2d')]['id'];}return db[_0x6563('0xb9')][_0x6563('0x68')]({'where':{'id':_0x1a8f03[_0x6563('0xb6')]['id']}})['then'](function(_0xdcdeb8){if(!_0xdcdeb8){logger['error'](_0x6563('0xd5'),_0x6563('0xd4'),0x194,_0x6563('0xd6'));_0x47298a['sendStatus'](0x194);}else{if(_0xdcdeb8[_0x6563('0x3c')]){throw new db[(_0x6563('0xcb'))]['ValidationError'](_0x6563('0xd7'));}}return _0xdcdeb8;})[_0x6563('0x26')](function(_0x3b8422){if(_0x3b8422){return _0x3b8422['update']({'closed':_0x1a8f03[_0x6563('0x2d')]['closed'],'disposition':_0x1a8f03[_0x6563('0x2d')][_0x6563('0x3e')]})['then'](function(_0xf16e8){return _0xf16e8;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x6563('0xd4'),_0x1a8f03[_0x6563('0x2d')],client9004);})[_0x6563('0x26')](respondWithResult(_0x47298a,null))[_0x6563('0x1d')](handleError(_0x47298a,null));};exports[_0x6563('0xd8')]=function(_0x32f037,_0x32ee06){_0x32f037[_0x6563('0x2d')][_0x6563('0x2a')]=_0x32f037[_0x6563('0xd9')][_0x6563('0xda')];_0x32f037[_0x6563('0x2d')][_0x6563('0xdb')]=_0x32f037[_0x6563('0xd9')]['filename'];_0x32f037[_0x6563('0x2d')][_0x6563('0x43')]=_0x32f037[_0x6563('0xd9')]['mimetype'];return db[_0x6563('0xdc')]['create'](_0x32f037[_0x6563('0x2d')])[_0x6563('0x26')](respondWithResult(_0x32ee06,0xc9))[_0x6563('0x1d')](handleError(_0x32ee06,null));};exports['attachmentDownload']=function(_0x474a74,_0x425980){return db['ChatInteraction'][_0x6563('0xbe')]({'where':{'id':_0x474a74[_0x6563('0xb6')]['id']},'raw':!![]})[_0x6563('0x26')](handleEntityNotFound(_0x425980,null))[_0x6563('0x26')](function(_0x3c8318){if(_0x3c8318){if(_0x3c8318['closed']){return _0x425980[_0x6563('0x1f')](0x193)[_0x6563('0xdd')]({'status':0x193,'message':'Unauthorized'});}return db[_0x6563('0xdc')]['findOne']({'where':{'id':_0x474a74['query'][_0x6563('0xde')]},'raw':!![]})[_0x6563('0x26')](handleEntityNotFound(_0x425980,null));}})[_0x6563('0x26')](function(_0x108511){if(_0x108511){var _0x12a51c=_0x108511[_0x6563('0xdf')]!==null;var _0x355f23=path[_0x6563('0xe0')](config[_0x6563('0xe1')],_0x6563('0xe2'));if(_0x12a51c){_0x355f23=path['join'](_0x355f23,_0x6563('0xe3'));}var _0x401aec=path[_0x6563('0xe0')](_0x355f23,_0x108511[_0x6563('0xdb')]);return _0x425980[_0x6563('0xe4')](_0x401aec);}})[_0x6563('0x1d')](handleError(_0x425980,null));};exports['close']=function(_0x46664e,_0x11f51d){var _0x2cd600=null;var _0x1883d0=null;var _0x42100b=null;if(_0x46664e[_0x6563('0x2d')]['id']){delete _0x46664e[_0x6563('0x2d')]['id'];}if(_0x46664e[_0x6563('0x2d')][_0x6563('0xe5')]){_0x42100b=path[_0x6563('0xe0')](config['root'],'server/files/chat/upload/',util[_0x6563('0xe6')]('transcript-%s.txt',Date[_0x6563('0xe7')]()));_0x46664e[_0x6563('0x2d')][_0x6563('0xe8')]=_0x42100b;}return db['ChatInteraction']['find']({'where':{'id':_0x46664e[_0x6563('0xb6')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x6563('0x77')],'as':'User'}]}]})[_0x6563('0x26')](handleEntityNotFound(_0x11f51d,null))[_0x6563('0x26')](saveUpdates(_0x46664e[_0x6563('0x2d')],null))['then'](function(_0x4d30d8){if(_0x4d30d8){_0x2cd600=_0x4d30d8;return db[_0x6563('0xbd')]['find']({'where':{'id':_0x2cd600[_0x6563('0x7c')]}});}})[_0x6563('0x26')](function(_0x30c100){if(_0x30c100){_0x1883d0=_0x30c100;return db[_0x6563('0xd2')][_0x6563('0x68')]({'where':{'id':_0x2cd600[_0x6563('0x70')]}});}})[_0x6563('0x26')](function(_0x23c5dc){if(_0x23c5dc){if(_0x42100b){var _0x7225ad=null;for(var _0x27c154=0x1;_0x27c154<_0x2cd600[_0x6563('0xe9')][_0x6563('0x4b')];++_0x27c154){_0x7225ad=_0x2cd600[_0x6563('0xe9')][_0x27c154];var _0x1b4885=_0x7225ad[_0x6563('0x3c')]?util[_0x6563('0xe6')](_0x6563('0xea'),_0x1883d0[_0x6563('0xeb')],_0x7225ad[_0x6563('0x3c')]):_0x6563('0xec');var _0x43077f=_0x46664e[_0x6563('0x2d')][_0x6563('0xed')]||util[_0x6563('0xe6')](_0x6563('0xea'),'Visitor',_0x7225ad['ContactId']);switch(_0x1883d0[_0x6563('0xee')]){case _0x6563('0xef'):_0x1b4885=_0x7225ad['UserId']?util[_0x6563('0xe6')](_0x6563('0xea'),_0x1883d0['agentAlias'],_0x7225ad[_0x6563('0x3c')]):_0x6563('0xec');break;case _0x6563('0xf0'):_0x1b4885=_0x7225ad[_0x6563('0x3c')]?_0x7225ad[_0x6563('0x77')][_0x6563('0xf1')]||_0x7225ad['User']['fullname']:_0x6563('0xec');break;case _0x6563('0xf2'):_0x1b4885=_0x7225ad[_0x6563('0x3c')]?_0x7225ad['User'][_0x6563('0xc3')]:_0x6563('0xec');break;default:_0x1b4885=_0x7225ad[_0x6563('0x3c')]?util[_0x6563('0xe6')](_0x6563('0xea'),_0x1883d0[_0x6563('0xeb')],_0x7225ad[_0x6563('0x3c')]):'System';}var _0x15bce2=util[_0x6563('0xe6')](_0x6563('0xf3'),moment(_0x7225ad['createdAt'])[_0x6563('0xe6')](_0x6563('0xf4')),_0x7225ad['direction']==='in'?_0x43077f:_0x1b4885,_0x7225ad[_0x6563('0x2d')]);if(!_0x7225ad['secret']){fs[_0x6563('0xf5')](_0x42100b,_0x15bce2);}}return db[_0x6563('0xf6')][_0x6563('0xbe')]({'where':{'service':!![]},'include':[{'model':db[_0x6563('0xf7')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6563('0xf8')],'as':_0x6563('0xf8'),'raw':!![]}]}]});}}})[_0x6563('0x26')](function(_0x183752){if(!_0x183752||!_0x183752[_0x6563('0xf9')]||!_0x46664e[_0x6563('0x2d')])return _0x2cd600;var _0x1ce2bb=_0x183752['getSmtpOptions']();return respondWithRpcPromise(_0x6563('0xfa'),_0x6563('0xfb'),{'account':_0x1ce2bb,'message':{'from':util[_0x6563('0xe6')](_0x6563('0xfc'),_0x183752[_0x6563('0x2a')],_0x183752[_0x6563('0xc4')]||_0x183752['Smtp'][_0x6563('0x99')]),'to':_0x46664e[_0x6563('0x2d')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x6563('0xe6')](_0x6563('0xfd'),_0x46664e[_0x6563('0x2d')]['mailTranscript']),'attachments':[{'path':_0x42100b}]}})[_0x6563('0x26')](function(){return _0x2cd600;})[_0x6563('0x1d')](function(_0xb6a8fc){logger[_0x6563('0x1a')](_0xb6a8fc);});})['then'](respondWithStatusCode(_0x11f51d,0xc8))['catch'](handleError(_0x11f51d,null));};exports[_0x6563('0xfe')]=function(_0x207bc3,_0x572f9f){return db[_0x6563('0xce')][_0x6563('0x68')]({'where':{'id':_0x207bc3[_0x6563('0xb6')]['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x572f9f,null))[_0x6563('0x26')](function(_0x2d5cdc){if(_0x2d5cdc){return _0x2d5cdc[_0x6563('0xfe')](_0x207bc3[_0x6563('0x2d')]['ids'],_[_0x6563('0xff')](_0x207bc3[_0x6563('0x2d')],[_0x6563('0x100'),'id'])||{});}})[_0x6563('0x26')](respondWithResult(_0x572f9f,null))[_0x6563('0x1d')](handleError(_0x572f9f,null));};exports['getMessages']=function(_0x6fc07c,_0x3f1050){var _0x2847e0={'raw':![],'where':{}};var _0x15fccc={};var _0x14fa16={'count':0x0,'rows':[]};return db[_0x6563('0xb9')][_0x6563('0xbe')]({'where':{'id':_0x6fc07c['params']['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x3f1050,null))[_0x6563('0x26')](function(_0x165efe){if(_0x165efe){_0x15fccc[_0x6563('0x44')]=_[_0x6563('0x45')](db[_0x6563('0xce')][_0x6563('0x41')]);_0x15fccc[_0x6563('0x47')]=_[_0x6563('0x45')](_0x6fc07c[_0x6563('0x47')]);_0x15fccc[_0x6563('0x46')]=_[_0x6563('0x49')](_0x15fccc['model'],_0x15fccc['query']);_0x2847e0[_0x6563('0x48')]=_[_0x6563('0x49')](_0x15fccc['model'],qs[_0x6563('0x4a')](_0x6fc07c[_0x6563('0x47')]['fields']));_0x2847e0['attributes']=_0x2847e0['attributes'][_0x6563('0x4b')]?_0x2847e0[_0x6563('0x48')]:_0x15fccc['model'];if(!_0x6fc07c[_0x6563('0x47')]['hasOwnProperty'](_0x6563('0x4d'))){_0x2847e0[_0x6563('0x21')]=qs['limit'](_0x6fc07c[_0x6563('0x47')][_0x6563('0x21')]);_0x2847e0[_0x6563('0x23')]=qs[_0x6563('0x23')](_0x6fc07c[_0x6563('0x47')]['offset']);}_0x2847e0[_0x6563('0x4e')]=qs['sort'](_0x6fc07c[_0x6563('0x47')][_0x6563('0x4f')]);_0x2847e0[_0x6563('0x7d')]=qs['filters'](_[_0x6563('0x101')](_0x6fc07c['query'],_0x15fccc[_0x6563('0x46')]));_0x2847e0[_0x6563('0x7d')][_0x6563('0xb2')]=_0x165efe['id'];if(_0x6fc07c[_0x6563('0x47')]['filter']){_0x2847e0[_0x6563('0x7d')]=_[_0x6563('0xa0')](_0x2847e0[_0x6563('0x7d')],{'$or':_[_0x6563('0x32')](_0x2847e0[_0x6563('0x48')],function(_0x422cd3){var _0x5a3361={};_0x5a3361[_0x422cd3]={'$like':'%'+_0x6fc07c['query'][_0x6563('0x89')]+'%'};return _0x5a3361;})});}if(_0x6fc07c[_0x6563('0x47')]['$gte']){var _0x4c5265=_0x6fc07c[_0x6563('0x47')][_0x6563('0x82')]['split'](',');var _0x38ae7f={};_0x38ae7f[_0x4c5265[0x0]]={'$gte':moment(_0x4c5265[0x1])[_0x6563('0xe6')](_0x6563('0x102'))};_0x2847e0[_0x6563('0x7d')]=_[_0x6563('0xa0')](_0x2847e0[_0x6563('0x7d')],_0x38ae7f);}_0x2847e0=_[_0x6563('0xa0')]({},_0x2847e0,_0x6fc07c['options']);return db[_0x6563('0xce')][_0x6563('0x22')]({'where':_0x2847e0[_0x6563('0x7d')]})[_0x6563('0x26')](function(_0xf613d){_0x14fa16[_0x6563('0x22')]=_0xf613d;if(_0x6fc07c['query']['includeAll']){_0x2847e0[_0x6563('0x103')]=[{'all':!![]}];}return db[_0x6563('0xce')][_0x6563('0x104')](_0x2847e0);})['then'](function(_0x20845d){_0x14fa16[_0x6563('0xb4')]=_0x20845d;return _0x14fa16;});}})['then'](respondWithFilteredResult(_0x3f1050,_0x2847e0))[_0x6563('0x1d')](handleError(_0x3f1050,null));};exports[_0x6563('0x105')]=function(_0x16d9c0,_0x49cccf){var _0x302287={'where':{}},_0x386a90={},_0x454b00={'count':0x0,'rows':[]};return db[_0x6563('0xb9')][_0x6563('0xbe')]({'where':{'id':_0x16d9c0[_0x6563('0xb6')]['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x49cccf,null))[_0x6563('0x26')](function(_0x395fd4){if(_0x395fd4){_0x386a90[_0x6563('0x44')]=_['keys'](db['ChatMessage'][_0x6563('0x41')]);_0x386a90[_0x6563('0x47')]=_['keys'](_0x16d9c0['query']);_0x386a90[_0x6563('0x46')]=_[_0x6563('0x49')](_0x386a90[_0x6563('0x44')],_0x386a90[_0x6563('0x47')]);_0x302287['attributes']=_['intersection'](_0x386a90['model'],qs['fields'](_0x16d9c0[_0x6563('0x47')]['fields']));_0x302287[_0x6563('0x48')]=_0x302287[_0x6563('0x48')]['length']?_0x302287[_0x6563('0x48')]:_0x386a90['model'];if(!_0x16d9c0['query']['hasOwnProperty'](_0x6563('0x4d'))){_0x302287[_0x6563('0x21')]=qs['limit'](_0x16d9c0['query'][_0x6563('0x21')]);_0x302287[_0x6563('0x23')]=qs[_0x6563('0x23')](_0x16d9c0[_0x6563('0x47')]['offset']);}_0x302287[_0x6563('0x4e')]=qs['sort'](_0x16d9c0[_0x6563('0x47')]['sort']);_0x302287[_0x6563('0x7d')]=qs[_0x6563('0x46')](_[_0x6563('0x101')](_0x16d9c0['query'],_0x386a90['filters']));_0x302287[_0x6563('0x7d')][_0x6563('0xb2')]=_0x395fd4['id'];if(_0x16d9c0[_0x6563('0x47')][_0x6563('0x89')]){_0x302287['where']=_['merge'](_0x302287['where'],{'$or':_[_0x6563('0x32')](_0x302287[_0x6563('0x48')],function(_0x88b2d9){var _0x118d14={};_0x118d14[_0x88b2d9]={'$like':'%'+_0x16d9c0[_0x6563('0x47')]['filter']+'%'};return _0x118d14;})});}_0x302287[_0x6563('0x7d')][_0x6563('0x106')]=![];if(_0x16d9c0[_0x6563('0x47')]['id']){_0x302287['where']['id']={'$gt':_0x16d9c0[_0x6563('0x47')]['id']};}_0x302287=_['merge']({},_0x302287,_0x16d9c0[_0x6563('0xb8')]);return db[_0x6563('0xce')]['count']({'where':_0x302287['where']})[_0x6563('0x26')](function(_0x15eefb){_0x454b00[_0x6563('0x22')]=_0x15eefb;_0x302287[_0x6563('0x103')]=[];if(_0x16d9c0[_0x6563('0x47')]['includeAgent']){_0x302287[_0x6563('0x103')]['push']({'model':db[_0x6563('0x77')],'as':'User','attributes':['id',_0x6563('0xc3'),_0x6563('0xf1')]});}if(_0x16d9c0['query']['includeAll']){_0x302287[_0x6563('0x103')]=[{'all':!![]}];}return db[_0x6563('0xce')][_0x6563('0x104')](_0x302287);})[_0x6563('0x26')](function(_0x3cef21){_0x454b00[_0x6563('0xb4')]=_0x3cef21;return _0x454b00;});}})[_0x6563('0x26')](respondWithFilteredResult(_0x49cccf,_0x302287))[_0x6563('0x1d')](handleError(_0x49cccf,null));};exports[_0x6563('0x107')]=function(_0x28c4e1,_0x12681c){return db[_0x6563('0xb9')][_0x6563('0x68')]({'where':{'id':_0x28c4e1[_0x6563('0xb6')]['id']}})[_0x6563('0x26')](handleEntityNotFound(_0x12681c,null))[_0x6563('0x26')](function(_0x2dcf31){if(_0x2dcf31){return _0x2dcf31[_0x6563('0x108')](_0x28c4e1[_0x6563('0x2d')]['ids'],_[_0x6563('0xff')](_0x28c4e1['body'],[_0x6563('0x100'),'id'])||{})['spread'](function(){return db['Tag'][_0x6563('0x104')]({'attributes':['id',_0x6563('0x2a'),_0x6563('0x51')],'where':{'id':_0x28c4e1[_0x6563('0x2d')]['ids']}});})[_0x6563('0x26')](function(_0x1abbd2){socket[_0x6563('0x109')](_0x6563('0x10a'),{'id':Number(_0x28c4e1[_0x6563('0xb6')]['id']),'tags':_0x1abbd2||[]});return{'id':Number(_0x28c4e1[_0x6563('0xb6')]['id']),'tags':_0x1abbd2||[]};});}})[_0x6563('0x26')](respondWithResult(_0x12681c,null))['catch'](handleError(_0x12681c,null));};exports[_0x6563('0x10b')]=function(_0x4dd4fc,_0x5260ee){return db[_0x6563('0xb9')][_0x6563('0x68')]({'where':{'id':_0x4dd4fc[_0x6563('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5260ee,null))[_0x6563('0x26')](function(_0xf8aa3d){if(_0xf8aa3d){return _0xf8aa3d[_0x6563('0x10b')](_0x4dd4fc['query'][_0x6563('0x100')]);}})[_0x6563('0x26')](respondWithStatusCode(_0x5260ee,null))[_0x6563('0x1d')](handleError(_0x5260ee,null));};exports[_0x6563('0xe4')]=function(_0x1e38cb,_0x51a23d){var _0x5dc7ac=moment()['unix']()[_0x6563('0x9e')]();var _0x3a86fb=path[_0x6563('0xe0')](config[_0x6563('0xe1')],_0x6563('0x10c'),'files',_0x6563('0x10d'));var _0x58f8bb=path['join'](config[_0x6563('0xe1')],'server',_0x6563('0x10e'),'attachments');var _0x169e28=path[_0x6563('0xe0')](_0x3a86fb,_0x5dc7ac);var _0x266576=util['format']('transcript-%d-%s.zip',_0x1e38cb[_0x6563('0xb6')]['id'],_0x5dc7ac);var _0x232cb1=path[_0x6563('0xe0')](_0x3a86fb,_0x266576);var _0x3ae6c9=[];_0x3ae6c9[_0x6563('0x36')]({'model':db[_0x6563('0x77')],'as':_0x6563('0x77'),'attributes':['id',_0x6563('0xc3')],'raw':!![]});_0x3ae6c9[_0x6563('0x36')]({'model':db['CmContact'],'as':_0x6563('0xd3'),'attributes':['id',_0x6563('0x10f'),_0x6563('0x110')],'raw':!![]});if(_0x1e38cb['query']['attachments']){_0x3ae6c9[_0x6563('0x36')]({'model':db['Attachment'],'as':_0x6563('0xdc'),'raw':!![]});}var _0x4dcbf1=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x6563('0x2d'),_0x6563('0x80'),_0x6563('0x111'),_0x6563('0x106'),_0x6563('0x85')],'include':_0x3ae6c9}];_0x4dcbf1[_0x6563('0x36')]({'model':db[_0x6563('0xbd')],'as':_0x6563('0x112'),'attributes':['id',_0x6563('0x2a')]});_0x4dcbf1[_0x6563('0x36')]({'model':db[_0x6563('0x77')],'as':_0x6563('0x113'),'attributes':['id',_0x6563('0xc3')]});return db[_0x6563('0xb9')][_0x6563('0x68')]({'where':{'id':_0x1e38cb['params']['id']},'include':_0x4dcbf1})[_0x6563('0x26')](handleEntityNotFound(_0x51a23d,null))[_0x6563('0x26')](function(_0x10ce72){if(_0x10ce72){var _0x39daee=_0x10ce72[_0x6563('0x114')]({'plain':!![]});fs[_0x6563('0x115')](_0x169e28);var _0x5db6ff={'channel':_0x6563('0x116'),'account':_0x39daee['Account']['name'],'agent':_0x39daee[_0x6563('0x113')]?_0x39daee[_0x6563('0x113')][_0x6563('0xc3')]:'N.A.','createdAt':moment(_0x39daee[_0x6563('0x80')])[_0x6563('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6563('0x9e')](),'closedAt':_0x39daee[_0x6563('0x3b')]?moment(_0x39daee[_0x6563('0x117')])[_0x6563('0xe6')](_0x6563('0x102'))['toString']():'','disposition':_0x39daee[_0x6563('0x3e')],'chatInfo':{'browser':_0x39daee[_0x6563('0x118')],'os':_0x39daee[_0x6563('0x119')],'referer':_0x39daee['referer'],'customerIp':_0x39daee['customerIp'],'customerPort':_0x39daee[_0x6563('0x11a')]?_0x39daee[_0x6563('0x11a')]:'N.A.'},'messages':_(_0x39daee[_0x6563('0xe9')])[_0x6563('0x11b')]()[_0x6563('0x89')]({'secret':![]})[_0x6563('0x32')](function(_0x3ccef7){if(_0x3ccef7['Attachment']){var _0x109c74=path['join'](_0x58f8bb,_0x3ccef7[_0x6563('0xdc')][_0x6563('0xdb')]);if(fs[_0x6563('0x11c')](_0x109c74)){fs[_0x6563('0x11d')](_0x109c74)[_0x6563('0x11e')](fs[_0x6563('0x11f')](path[_0x6563('0xe0')](_0x169e28,_0x3ccef7[_0x6563('0xdc')][_0x6563('0xdb')])));}}return{'date':moment(_0x3ccef7[_0x6563('0x80')])[_0x6563('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6563('0x9e')](),'sender':_0x3ccef7['direction']===_0x6563('0xcd')?_0x3ccef7[_0x6563('0x77')]?_0x3ccef7[_0x6563('0x77')][_0x6563('0xc3')]:_0x6563('0xec'):_0x3ccef7[_0x6563('0xd3')][_0x6563('0x10f')]+(_0x3ccef7[_0x6563('0xd3')][_0x6563('0x110')]?'\x20'+_0x3ccef7[_0x6563('0xd3')][_0x6563('0x110')]:''),'body':_0x3ccef7[_0x6563('0xdc')]?_0x3ccef7['Attachment']['basename']:_0x3ccef7[_0x6563('0x2d')],'direction':_0x3ccef7['direction']===_0x6563('0xcd')?'A':'C','secret':_0x3ccef7[_0x6563('0x106')],'read':_0x3ccef7[_0x6563('0x85')],'attachment':_0x3ccef7['Attachment']};})[_0x6563('0x6a')]()};return ejs[_0x6563('0x120')](path[_0x6563('0xe0')](config[_0x6563('0xe1')],'server',_0x6563('0x121'),_0x6563('0x122')),{'interaction':_0x5db6ff})[_0x6563('0x26')](function(_0x153e78){var _0x6ece24=path['join'](_0x169e28,_0x6563('0x123')+_0x39daee['id']+'-'+_0x5dc7ac+_0x6563('0x124'));var _0x474ec2={'path':_0x6ece24,'channel':_0x6563('0x116'),'interactionId':_0x39daee['id']};return pdf['createPdfFromHTML'](_0x153e78,_0x474ec2);})[_0x6563('0x26')](function(){return new Promise(function(_0x3b1818,_0x1c2e23){zipdir(_0x169e28,{'saveTo':_0x232cb1},function(_0xdf9537,_0x3027f9){if(_0xdf9537)return _0x1c2e23(_0xdf9537);return _0x3b1818(_0x3027f9);});})[_0x6563('0x26')](function(){return new BPromise(function(_0x88eb81,_0x3c2fb6){rimraf(_0x169e28,function(_0x40f56c){if(_0x40f56c)_0x3c2fb6(_0x40f56c);return _0x88eb81();});});})[_0x6563('0x26')](function(){return _0x51a23d['download'](_0x232cb1,_0x266576,function(_0x3efd40){if(_0x3efd40){logger[_0x6563('0x1a')](_0x6563('0x125'),_0x3efd40);}else{fs[_0x6563('0x126')](_0x232cb1);}});});});}else{return _0x51a23d[_0x6563('0x28')](0xc8);}})[_0x6563('0x1d')](handleError(_0x51a23d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index da3532b..81f0279 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 _0x1007=['ChatMessage','setMaxListeners','save','update','remove','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction'];(function(_0x5ee300,_0x17c83a){var _0x20d6aa=function(_0x3470bc){while(--_0x3470bc){_0x5ee300['push'](_0x5ee300['shift']());}};_0x20d6aa(++_0x17c83a);}(_0x1007,0xbd));var _0x7100=function(_0x5605e9,_0x5a9b4a){_0x5605e9=_0x5605e9-0x0;var _0x466681=_0x1007[_0x5605e9];return _0x466681;};'use strict';var EventEmitter=require(_0x7100('0x0'));var ChatInteraction=require(_0x7100('0x1'))['db'][_0x7100('0x2')];var ChatMessage=require(_0x7100('0x1'))['db'][_0x7100('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7100('0x4')](0x0);var events={'afterCreate':_0x7100('0x5'),'afterUpdate':_0x7100('0x6'),'afterDestroy':_0x7100('0x7')};function emitEvent(_0x1794bd){return function(_0x579719,_0x1bb502,_0x5be3db){_0x579719['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x44ffbb){_0x579719[_0x7100('0x8')](_0x7100('0x9'),_0x44ffbb['map'](function(_0x30cfd0){return{'id':_0x30cfd0['id']};}));return ChatMessage[_0x7100('0xa')]({'where':{'ChatInteractionId':_0x579719['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x69d592){_0x579719[_0x7100('0x8')](_0x7100('0xb'),_0x69d592['length']);ChatInteractionEvents[_0x7100('0xc')](_0x1794bd+':'+_0x579719['id'],_0x579719);ChatInteractionEvents[_0x7100('0xc')](_0x1794bd,_0x579719);_0x5be3db(null);})[_0x7100('0xd')](_0x5be3db(null));};}for(var e in events){if(events[_0x7100('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7100('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xaf27=['ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hook','exports','ChatInteraction'];(function(_0xf26c34,_0x400dcd){var _0x3161ed=function(_0x5bbd18){while(--_0x5bbd18){_0xf26c34['push'](_0xf26c34['shift']());}};_0x3161ed(++_0x400dcd);}(_0xaf27,0x76));var _0x7af2=function(_0x5afeab,_0x536dcd){_0x5afeab=_0x5afeab-0x0;var _0x419cd3=_0xaf27[_0x5afeab];return _0x419cd3;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x7af2('0x0')];var ChatMessage=require('../../mysqldb')['db'][_0x7af2('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7af2('0x2')](0x0);var events={'afterCreate':_0x7af2('0x3'),'afterUpdate':_0x7af2('0x4'),'afterDestroy':_0x7af2('0x5')};function emitEvent(_0x142103){return function(_0x9ed636,_0x1c2060,_0x1f1dc7){_0x9ed636[_0x7af2('0x6')]({'attributes':['id'],'raw':!![]})[_0x7af2('0x7')](function(_0x450ce4){_0x9ed636['setDataValue'](_0x7af2('0x8'),_0x450ce4[_0x7af2('0x9')](function(_0x135cc1){return{'id':_0x135cc1['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x9ed636['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7af2('0x7')](function(_0xe19640){_0x9ed636[_0x7af2('0xa')](_0x7af2('0xb'),_0xe19640[_0x7af2('0xc')]);ChatInteractionEvents[_0x7af2('0xd')](_0x142103+':'+_0x9ed636['id'],_0x9ed636);ChatInteractionEvents[_0x7af2('0xd')](_0x142103,_0x9ed636);_0x1f1dc7(null);})[_0x7af2('0xe')](_0x1f1dc7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7af2('0xf')](e,emitEvent(event));}}module[_0x7af2('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 0a5c4fc..88b88d6 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 _0xe7d3=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions'];(function(_0x4d8fe5,_0x19b76e){var _0x799978=function(_0x257dba){while(--_0x257dba){_0x4d8fe5['push'](_0x4d8fe5['shift']());}};_0x799978(++_0x19b76e);}(_0xe7d3,0x18e));var _0x3e7d=function(_0x3814ea,_0x2e193c){_0x3814ea=_0x3814ea-0x0;var _0x4d9915=_0xe7d3[_0x3814ea];return _0x4d9915;};'use strict';var _=require(_0x3e7d('0x0'));var util=require('util');var logger=require(_0x3e7d('0x1'))(_0x3e7d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e7d('0x3'));var fs=require('fs');var path=require(_0x3e7d('0x4'));var rimraf=require(_0x3e7d('0x5'));var config=require(_0x3e7d('0x6'));var attributes=require(_0x3e7d('0x7'));module['exports']=function(_0x2fb416,_0x31877b){return _0x2fb416[_0x3e7d('0x8')]('ChatInteraction',attributes,{'tableName':_0x3e7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34be04,_0xe2aeca,_0x4c3c60){if(_0x34be04[_0x3e7d('0xa')](_0x3e7d('0xb'))){_0x34be04[_0x3e7d('0xc')]=moment()[_0x3e7d('0xd')](_0x3e7d('0xe'));}_0x4c3c60(null,_0x34be04);}},'charset':_0x3e7d('0xf'),'collate':_0x3e7d('0x10')});}; \ No newline at end of file +var _0x9ef3=['closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x9ef3,0xb8));var _0x39ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ef3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x39ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39ef('0x1'));var moment=require(_0x39ef('0x2'));var BPromise=require(_0x39ef('0x3'));var rp=require(_0x39ef('0x4'));var fs=require('fs');var path=require(_0x39ef('0x5'));var rimraf=require(_0x39ef('0x6'));var config=require(_0x39ef('0x7'));var attributes=require(_0x39ef('0x8'));module[_0x39ef('0x9')]=function(_0x3eaf25,_0x447810){return _0x3eaf25[_0x39ef('0xa')](_0x39ef('0xb'),attributes,{'tableName':_0x39ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ece35,_0x1243b7,_0x30378f){if(_0x1ece35[_0x39ef('0xd')]('closed')){_0x1ece35[_0x39ef('0xe')]=moment()[_0x39ef('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x30378f(null,_0x1ece35);}},'charset':_0x39ef('0x10'),'collate':_0x39ef('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5cc7527..39a7102 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 _0x2c99=['then','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','limit','UpdateChatInteraction','AddTagsToChatInteraction'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x2c99,0x16e));var _0x92c9=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x2c99[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x92c9('0x0'));var util=require(_0x92c9('0x1'));var moment=require('moment');var BPromise=require(_0x92c9('0x2'));var rs=require(_0x92c9('0x3'));var fs=require('fs');var Redis=require(_0x92c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x92c9('0x5'));var logger=require('../../config/logger')(_0x92c9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92c9('0x7')][_0x92c9('0x8')]({'port':0x232a});config[_0x92c9('0x9')]=_[_0x92c9('0xa')](config['redis'],{'host':_0x92c9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92c9('0x9')]));require(_0x92c9('0xc'))[_0x92c9('0xd')](socket);function respondWithRpcPromise(_0x4e40cd,_0x4f97f8,_0x1857d7){return new BPromise(function(_0x44f1ff,_0x3b517e){return client['request'](_0x4e40cd,_0x1857d7)['then'](function(_0x5d1e53){logger[_0x92c9('0xe')](_0x92c9('0xf'),_0x4f97f8,_0x92c9('0x10'));logger[_0x92c9('0x11')](_0x92c9('0x12'),_0x4f97f8,_0x92c9('0x10'),JSON[_0x92c9('0x13')](_0x5d1e53));if(_0x5d1e53[_0x92c9('0x14')]){if(_0x5d1e53[_0x92c9('0x14')][_0x92c9('0x15')]===0x1f4){logger['error'](_0x92c9('0xf'),_0x4f97f8,_0x5d1e53[_0x92c9('0x14')][_0x92c9('0x16')]);return _0x3b517e(_0x5d1e53[_0x92c9('0x14')][_0x92c9('0x16')]);}logger[_0x92c9('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x4f97f8,_0x5d1e53[_0x92c9('0x14')][_0x92c9('0x16')]);return _0x44f1ff(_0x5d1e53[_0x92c9('0x14')]['message']);}else{logger[_0x92c9('0xe')](_0x92c9('0xf'),_0x4f97f8,_0x92c9('0x10'));_0x44f1ff(_0x5d1e53[_0x92c9('0x17')]['message']);}})[_0x92c9('0x18')](function(_0x2f60da){logger[_0x92c9('0x14')](_0x92c9('0xf'),_0x4f97f8,_0x2f60da);_0x3b517e(_0x2f60da);});});}exports['UpdateChatInteraction']=function(_0x3684c1){var _0x4bb1fd=this;return new Promise(function(_0xad5cda,_0xfdf66e){return db[_0x92c9('0x19')][_0x92c9('0x1a')](_0x3684c1[_0x92c9('0x1b')],{'raw':_0x3684c1[_0x92c9('0x1c')]?_0x3684c1[_0x92c9('0x1c')][_0x92c9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3684c1[_0x92c9('0x1c')]?_0x3684c1[_0x92c9('0x1c')][_0x92c9('0x1e')]||null:null,'attributes':_0x3684c1['options']?_0x3684c1[_0x92c9('0x1c')]['attributes']||null:null,'limit':_0x3684c1[_0x92c9('0x1c')]?_0x3684c1['options'][_0x92c9('0x1f')]||null:null})['then'](function(_0x5b7e8a){logger[_0x92c9('0xe')](_0x92c9('0x20'),_0x3684c1);logger[_0x92c9('0x11')](_0x92c9('0x20'),_0x3684c1,JSON['stringify'](_0x5b7e8a));_0xad5cda(_0x5b7e8a);})[_0x92c9('0x18')](function(_0x18771f){logger[_0x92c9('0x14')](_0x92c9('0x20'),_0x18771f['message'],_0x3684c1);_0xfdf66e(_0x4bb1fd[_0x92c9('0x14')](0x1f4,_0x18771f['message']));});});};exports[_0x92c9('0x21')]=function(_0x3a0957){return new Promise(function(_0xe7311c,_0x2a94ad){return db['ChatInteraction']['find']({'where':_0x3a0957[_0x92c9('0x1c')]?_0x3a0957[_0x92c9('0x1c')][_0x92c9('0x1e')]||null:null})[_0x92c9('0x22')](function(_0x581c5e){if(_0x581c5e){return _0x581c5e[_0x92c9('0x23')](_0x3a0957[_0x92c9('0x1b')]['ids'],_[_0x92c9('0x24')](_0x3a0957[_0x92c9('0x1b')],[_0x92c9('0x25'),'id'])||{});}})[_0x92c9('0x26')](function(_0x546e54){logger[_0x92c9('0xe')](_0x92c9('0x27'),_0x3a0957);logger['debug'](_0x92c9('0x27'),_0x3a0957,JSON['stringify'](_0x546e54));_0xe7311c(_0x546e54);})[_0x92c9('0x18')](function(_0x268984){logger[_0x92c9('0x14')](_0x92c9('0x27'),_0x268984[_0x92c9('0x16')],_0x3a0957);_0x2a94ad(_this[_0x92c9('0x14')](0x1f4,_0x268984[_0x92c9('0x16')]));});});}; \ No newline at end of file +var _0xc52c=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ChatInteraction,\x20%s,\x20%s','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','find','addTags','omit','ids','spread','AddTags','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','request\x20sent'];(function(_0xdbec0a,_0xc83316){var _0x45175d=function(_0x32a9df){while(--_0x32a9df){_0xdbec0a['push'](_0xdbec0a['shift']());}};_0x45175d(++_0xc83316);}(_0xc52c,0x1a6));var _0xcc52=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xc52c[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0xcc52('0x0'));var util=require(_0xcc52('0x1'));var moment=require('moment');var BPromise=require(_0xcc52('0x2'));var rs=require(_0xcc52('0x3'));var fs=require('fs');var Redis=require(_0xcc52('0x4'));var db=require(_0xcc52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc52('0x6'))(_0xcc52('0x7'));var config=require(_0xcc52('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc52('0x9')]({'port':0x232a});config['redis']=_[_0xcc52('0xa')](config[_0xcc52('0xb')],{'host':_0xcc52('0xc'),'port':0x18eb});var socket=require(_0xcc52('0xd'))(new Redis(config[_0xcc52('0xb')]));require(_0xcc52('0xe'))['register'](socket);function respondWithRpcPromise(_0x2044e9,_0x275fca,_0x4b2d14){return new BPromise(function(_0x33f5b2,_0x350903){return client[_0xcc52('0xf')](_0x2044e9,_0x4b2d14)[_0xcc52('0x10')](function(_0x39ec64){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x275fca,_0xcc52('0x11'));logger['debug'](_0xcc52('0x12'),_0x275fca,_0xcc52('0x11'),JSON[_0xcc52('0x13')](_0x39ec64));if(_0x39ec64[_0xcc52('0x14')]){if(_0x39ec64[_0xcc52('0x14')]['code']===0x1f4){logger[_0xcc52('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x275fca,_0x39ec64['error'][_0xcc52('0x15')]);return _0x350903(_0x39ec64[_0xcc52('0x14')][_0xcc52('0x15')]);}logger[_0xcc52('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x275fca,_0x39ec64['error'][_0xcc52('0x15')]);return _0x33f5b2(_0x39ec64[_0xcc52('0x14')][_0xcc52('0x15')]);}else{logger[_0xcc52('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x275fca,_0xcc52('0x11'));_0x33f5b2(_0x39ec64[_0xcc52('0x17')][_0xcc52('0x15')]);}})[_0xcc52('0x18')](function(_0x335711){logger[_0xcc52('0x14')](_0xcc52('0x19'),_0x275fca,_0x335711);_0x350903(_0x335711);});});}exports[_0xcc52('0x1a')]=function(_0x350f19){var _0x343ea7=this;return new Promise(function(_0x554e2d,_0x289828){return db[_0xcc52('0x1b')][_0xcc52('0x1c')](_0x350f19[_0xcc52('0x1d')],{'raw':_0x350f19['options']?_0x350f19[_0xcc52('0x1e')][_0xcc52('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350f19['options']?_0x350f19[_0xcc52('0x1e')][_0xcc52('0x20')]||null:null,'attributes':_0x350f19[_0xcc52('0x1e')]?_0x350f19[_0xcc52('0x1e')]['attributes']||null:null,'limit':_0x350f19[_0xcc52('0x1e')]?_0x350f19[_0xcc52('0x1e')]['limit']||null:null})[_0xcc52('0x10')](function(_0x885f5a){logger[_0xcc52('0x16')](_0xcc52('0x1a'),_0x350f19);logger['debug'](_0xcc52('0x1a'),_0x350f19,JSON[_0xcc52('0x13')](_0x885f5a));_0x554e2d(_0x885f5a);})[_0xcc52('0x18')](function(_0x12c1f0){logger['error'](_0xcc52('0x1a'),_0x12c1f0[_0xcc52('0x15')],_0x350f19);_0x289828(_0x343ea7[_0xcc52('0x14')](0x1f4,_0x12c1f0[_0xcc52('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0xcd480){return new Promise(function(_0x240e12,_0x1fdd3a){return db[_0xcc52('0x1b')][_0xcc52('0x21')]({'where':_0xcd480[_0xcc52('0x1e')]?_0xcd480[_0xcc52('0x1e')]['where']||null:null})[_0xcc52('0x10')](function(_0x18935b){if(_0x18935b){return _0x18935b[_0xcc52('0x22')](_0xcd480[_0xcc52('0x1d')]['ids'],_[_0xcc52('0x23')](_0xcd480['body'],[_0xcc52('0x24'),'id'])||{});}})[_0xcc52('0x25')](function(_0x56ef96){logger['info'](_0xcc52('0x26'),_0xcd480);logger[_0xcc52('0x27')](_0xcc52('0x26'),_0xcd480,JSON[_0xcc52('0x13')](_0x56ef96));_0x240e12(_0x56ef96);})['catch'](function(_0x16a80d){logger[_0xcc52('0x14')](_0xcc52('0x26'),_0x16a80d['message'],_0xcd480);_0x1fdd3a(_this['error'](0x1f4,_0x16a80d[_0xcc52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 20db122..6716044 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 _0xff16=['chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','length'];(function(_0x3fb2e4,_0x4f8067){var _0x2bbf74=function(_0x36e4e4){while(--_0x36e4e4){_0x3fb2e4['push'](_0x3fb2e4['shift']());}};_0x2bbf74(++_0x4f8067);}(_0xff16,0x7f));var _0x6ff1=function(_0x56bceb,_0x5775b1){_0x56bceb=_0x56bceb-0x0;var _0x339f2b=_0xff16[_0x56bceb];return _0x339f2b;};'use strict';var ChatInteractionEvents=require(_0x6ff1('0x0'));var events=[_0x6ff1('0x1'),'remove',_0x6ff1('0x2')];function createListener(_0x230cff,_0x41e506){return function(_0x25cf5a){_0x41e506[_0x6ff1('0x3')](_0x230cff,_0x25cf5a);};}function removeListener(_0x3f53b2,_0x3e4c94){return function(){ChatInteractionEvents[_0x6ff1('0x4')](_0x3f53b2,_0x3e4c94);};}exports['register']=function(_0x153a91){for(var _0x4f8f24=0x0,_0x133524=events[_0x6ff1('0x5')];_0x4f8f24<_0x133524;_0x4f8f24++){var _0x2333b1=events[_0x4f8f24];var _0xbea21f=createListener(_0x6ff1('0x6')+_0x2333b1,_0x153a91);ChatInteractionEvents['on'](_0x2333b1,_0xbea21f);}}; \ No newline at end of file +var _0x3bf4=['emit','removeListener','register','length','chatInteraction:','save','update'];(function(_0x51a049,_0x46353b){var _0x4d1063=function(_0x1a95dc){while(--_0x1a95dc){_0x51a049['push'](_0x51a049['shift']());}};_0x4d1063(++_0x46353b);}(_0x3bf4,0x1e1));var _0x43bf=function(_0x9caa3c,_0x3832e3){_0x9caa3c=_0x9caa3c-0x0;var _0x455ad7=_0x3bf4[_0x9caa3c];return _0x455ad7;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x43bf('0x0'),'remove',_0x43bf('0x1')];function createListener(_0x487dba,_0x50388d){return function(_0x406f32){_0x50388d[_0x43bf('0x2')](_0x487dba,_0x406f32);};}function removeListener(_0x17c5ab,_0x5a4350){return function(){ChatInteractionEvents[_0x43bf('0x3')](_0x17c5ab,_0x5a4350);};}exports[_0x43bf('0x4')]=function(_0x3a4b54){for(var _0x257166=0x0,_0xd1018d=events[_0x43bf('0x5')];_0x257166<_0xd1018d;_0x257166++){var _0x38331e=events[_0x257166];var _0x4aef97=createListener(_0x43bf('0x6')+_0x38331e,_0x3a4b54);ChatInteractionEvents['on'](_0x38331e,_0x4aef97);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e9d6311..2e35e6f 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 _0x9ed7=['connect-timeout','express','Router','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','addMessage','/:id/tags','tracked','chat','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0xd28e23,_0x143bbf){var _0xe1a253=function(_0x57de4b){while(--_0x57de4b){_0xd28e23['push'](_0xd28e23['shift']());}};_0xe1a253(++_0x143bbf);}(_0x9ed7,0xe9));var _0x79ed=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x9ed7[_0x238830];return _0x5917f0;};'use strict';var multer=require('multer');var util=require(_0x79ed('0x0'));var path=require(_0x79ed('0x1'));var timeout=require(_0x79ed('0x2'));var express=require(_0x79ed('0x3'));var router=express[_0x79ed('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79ed('0x5'));var controller=require(_0x79ed('0x6'));router[_0x79ed('0x7')]('/',auth[_0x79ed('0x8')](),controller['index']);router[_0x79ed('0x7')](_0x79ed('0x9'),auth[_0x79ed('0x8')](),controller[_0x79ed('0xa')]);router[_0x79ed('0x7')](_0x79ed('0xb'),auth[_0x79ed('0xc')](),controller[_0x79ed('0xd')]);router[_0x79ed('0x7')](_0x79ed('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x79ed('0xf')]);router[_0x79ed('0x7')](_0x79ed('0x10'),auth[_0x79ed('0x8')](),controller[_0x79ed('0x11')]);router[_0x79ed('0x7')]('/:id/my_messages',auth[_0x79ed('0xc')](),controller[_0x79ed('0x12')]);router[_0x79ed('0x7')](_0x79ed('0x13'),auth[_0x79ed('0x8')](),controller['download']);router[_0x79ed('0x14')]('/',auth[_0x79ed('0x8')](),controller[_0x79ed('0x15')]);router[_0x79ed('0x14')](_0x79ed('0x16'),auth[_0x79ed('0x8')](),controller[_0x79ed('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x466951,_0x457748,_0x397478){_0x397478(null,path['join'](config[_0x79ed('0x18')],_0x79ed('0x19')));},'filename':function(_0x3a014f,_0x176651,_0x2983ae){_0x2983ae(null,util[_0x79ed('0x1a')](_0x79ed('0x1b'),Date[_0x79ed('0x1c')](),_0x176651['originalname'][_0x79ed('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x79ed('0x14')](_0x79ed('0x1e'),upload['single'](_0x79ed('0x1f')),controller['attachmentUpload']);router[_0x79ed('0x14')]('/:id/messages',auth[_0x79ed('0xc')](),controller[_0x79ed('0x20')]);router[_0x79ed('0x14')](_0x79ed('0x21'),auth[_0x79ed('0x8')](),interaction[_0x79ed('0x22')](_0x79ed('0x23'),'chatinteraction:addtags'),controller['addTags']);router[_0x79ed('0x24')]('/:id',auth[_0x79ed('0x8')](),interaction[_0x79ed('0x22')](_0x79ed('0x23'),_0x79ed('0x25')),controller[_0x79ed('0x26')]);router[_0x79ed('0x24')](_0x79ed('0x27'),controller[_0x79ed('0x28')]);router[_0x79ed('0x24')]('/:id/abandon',auth[_0x79ed('0xc')](),controller['abandon']);router['put'](_0x79ed('0x29'),controller['close']);router[_0x79ed('0x2a')](_0x79ed('0xb'),auth[_0x79ed('0x8')](),interaction['tracked'](_0x79ed('0x23'),_0x79ed('0x2b')),controller[_0x79ed('0x2c')]);router[_0x79ed('0x2a')](_0x79ed('0x21'),auth[_0x79ed('0x8')](),controller[_0x79ed('0x2d')]);module[_0x79ed('0x2e')]=router; \ No newline at end of file +var _0x9ef5=['post','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download'];(function(_0x25e78f,_0x1a678e){var _0x21d3ea=function(_0x16fc99){while(--_0x16fc99){_0x25e78f['push'](_0x25e78f['shift']());}};_0x21d3ea(++_0x1a678e);}(_0x9ef5,0xe2));var _0x59ef=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x9ef5[_0x429948];return _0x35d5d1;};'use strict';var multer=require(_0x59ef('0x0'));var util=require('util');var path=require(_0x59ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x59ef('0x2'));var auth=require(_0x59ef('0x3'));var interaction=require(_0x59ef('0x4'));var config=require('../../config/environment');var controller=require(_0x59ef('0x5'));router[_0x59ef('0x6')]('/',auth[_0x59ef('0x7')](),controller['index']);router[_0x59ef('0x6')](_0x59ef('0x8'),auth[_0x59ef('0x7')](),controller[_0x59ef('0x9')]);router['get'](_0x59ef('0xa'),auth[_0x59ef('0xb')](),controller[_0x59ef('0xc')]);router[_0x59ef('0x6')](_0x59ef('0xd'),auth[_0x59ef('0xb')](),controller[_0x59ef('0xe')]);router['get'](_0x59ef('0xf'),auth['isAuthenticated'](),controller[_0x59ef('0x10')]);router[_0x59ef('0x6')](_0x59ef('0x11'),auth[_0x59ef('0xb')](),controller['getMyMessages']);router[_0x59ef('0x6')](_0x59ef('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x59ef('0x13')]('/',auth[_0x59ef('0x7')](),controller['create']);router[_0x59ef('0x13')](_0x59ef('0x14'),auth[_0x59ef('0x7')](),controller[_0x59ef('0x15')]);var upload=multer({'storage':multer[_0x59ef('0x16')]({'destination':function(_0x17ac22,_0xfa6e93,_0x2640f2){_0x2640f2(null,path[_0x59ef('0x17')](config['root'],_0x59ef('0x18')));},'filename':function(_0x3dea8e,_0x5f78c,_0x1be6bb){_0x1be6bb(null,util[_0x59ef('0x19')](_0x59ef('0x1a'),Date[_0x59ef('0x1b')](),_0x5f78c[_0x59ef('0x1c')][_0x59ef('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x59ef('0x1e')]('file'),controller[_0x59ef('0x1f')]);router['post'](_0x59ef('0xf'),auth[_0x59ef('0xb')](),controller[_0x59ef('0x20')]);router[_0x59ef('0x13')](_0x59ef('0x21'),auth[_0x59ef('0x7')](),interaction[_0x59ef('0x22')](_0x59ef('0x23'),'chatinteraction:addtags'),controller['addTags']);router[_0x59ef('0x24')](_0x59ef('0xa'),auth[_0x59ef('0x7')](),interaction[_0x59ef('0x22')]('chat',_0x59ef('0x25')),controller[_0x59ef('0x26')]);router[_0x59ef('0x24')](_0x59ef('0x27'),controller[_0x59ef('0x28')]);router['put']('/:id/abandon',auth[_0x59ef('0xb')](),controller[_0x59ef('0x29')]);router[_0x59ef('0x24')](_0x59ef('0x2a'),controller[_0x59ef('0x2b')]);router[_0x59ef('0x2c')](_0x59ef('0xa'),auth[_0x59ef('0x7')](),interaction[_0x59ef('0x22')](_0x59ef('0x23'),_0x59ef('0x2d')),controller[_0x59ef('0x2e')]);router[_0x59ef('0x2c')](_0x59ef('0x21'),auth[_0x59ef('0x7')](),controller[_0x59ef('0x2f')]);module[_0x59ef('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 64fa8d4..070125e 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 _0x9a6a=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x6a3ef1,_0x76f4ba){var _0x15fdda=function(_0x491a3f){while(--_0x491a3f){_0x6a3ef1['push'](_0x6a3ef1['shift']());}};_0x15fdda(++_0x76f4ba);}(_0x9a6a,0x66));var _0xa9a6=function(_0x18b518,_0x22e1ff){_0x18b518=_0x18b518-0x0;var _0x1356c5=_0x9a6a[_0x18b518];return _0x1356c5;};'use strict';var Sequelize=require(_0xa9a6('0x0'));module[_0xa9a6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa9a6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa9a6('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa9a6('0x4')]}}; \ No newline at end of file +var _0x6d1f=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x50b692,_0x195f5e){var _0x5539e4=function(_0x15b32f){while(--_0x15b32f){_0x50b692['push'](_0x50b692['shift']());}};_0x5539e4(++_0x195f5e);}(_0x6d1f,0xcc));var _0xf6d1=function(_0x21b6af,_0x17602c){_0x21b6af=_0x21b6af-0x0;var _0x4cb5ad=_0x6d1f[_0x21b6af];return _0x4cb5ad;};'use strict';var Sequelize=require(_0xf6d1('0x0'));module[_0xf6d1('0x1')]={'body':{'type':Sequelize[_0xf6d1('0x2')](_0xf6d1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf6d1('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf6d1('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3a32ffe..87682c1 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 _0x5e80=['zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','offset','count','set','save','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','limit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','length','find','catch','create','body','update','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','resourceId','push','agent','createdAt','FromId','ToId','read','-createdAt','all','eml-format'];(function(_0x2d2d9e,_0x348a75){var _0xcceccc=function(_0x386bed){while(--_0x386bed){_0x2d2d9e['push'](_0x2d2d9e['shift']());}};_0xcceccc(++_0x348a75);}(_0x5e80,0x140));var _0x05e8=function(_0x2dde51,_0xe210cc){_0x2dde51=_0x2dde51-0x0;var _0x5846bb=_0x5e80[_0x2dde51];return _0x5846bb;};'use strict';var emlformat=require(_0x05e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x05e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05e8('0x2'));var moment=require('moment');var BPromise=require(_0x05e8('0x3'));var Mustache=require('mustache');var util=require(_0x05e8('0x4'));var path=require('path');var sox=require(_0x05e8('0x5'));var csv=require(_0x05e8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05e8('0x7'));var _=require(_0x05e8('0x8'));var squel=require('squel');var crypto=require(_0x05e8('0x9'));var jsforce=require(_0x05e8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x05e8('0x6'));var querystring=require(_0x05e8('0xb'));var Papa=require(_0x05e8('0xc'));var Redis=require(_0x05e8('0xd'));var authService=require(_0x05e8('0xe'));var qs=require(_0x05e8('0xf'));var as=require(_0x05e8('0x10'));var hardwareService=require(_0x05e8('0x11'));var logger=require(_0x05e8('0x12'))(_0x05e8('0x13'));var utils=require(_0x05e8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x05e8('0x15'));var db=require(_0x05e8('0x16'))['db'];config[_0x05e8('0x17')]=_[_0x05e8('0x18')](config[_0x05e8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x05e8('0x19'))(new Redis(config[_0x05e8('0x17')]));require(_0x05e8('0x1a'))[_0x05e8('0x1b')](socket);function respondWithStatusCode(_0x33aa00,_0x2625c9){_0x2625c9=_0x2625c9||0xcc;return function(_0x321d51){if(_0x321d51){return _0x33aa00[_0x05e8('0x1c')](_0x2625c9);}return _0x33aa00[_0x05e8('0x1d')](_0x2625c9)[_0x05e8('0x1e')]();};}function respondWithResult(_0x30a71d,_0x16ed2d){_0x16ed2d=_0x16ed2d||0xc8;return function(_0x49ba07){if(_0x49ba07){return _0x30a71d[_0x05e8('0x1d')](_0x16ed2d)[_0x05e8('0x1f')](_0x49ba07);}};}function respondWithFilteredResult(_0x440e16,_0x548960){return function(_0xe6f75b){if(_0xe6f75b){var _0x485809=typeof _0x548960['offset']==='undefined'&&typeof _0x548960['limit']===_0x05e8('0x20');var _0x412c04=_0xe6f75b['count'];var _0x1ef718=_0x485809?0x0:_0x548960[_0x05e8('0x21')];var _0x29dfcb=_0x485809?_0xe6f75b[_0x05e8('0x22')]:_0x548960[_0x05e8('0x21')]+_0x548960['limit'];var _0x115ba4;if(_0x29dfcb>=_0x412c04){_0x29dfcb=_0x412c04;_0x115ba4=0xc8;}else{_0x115ba4=0xce;}_0x440e16[_0x05e8('0x1d')](_0x115ba4);return _0x440e16[_0x05e8('0x23')]('Content-Range',_0x1ef718+'-'+_0x29dfcb+'/'+_0x412c04)[_0x05e8('0x1f')](_0xe6f75b);}return null;};}function patchUpdates(_0x5da105){return function(_0xdb86f8){try{jsonpatch['apply'](_0xdb86f8,_0x5da105,!![]);}catch(_0x5b121d){return BPromise['reject'](_0x5b121d);}return _0xdb86f8[_0x05e8('0x24')]();};}function saveUpdates(_0x3eb772,_0xe32a49){return function(_0x33f316){if(_0x33f316){return _0x33f316['update'](_0x3eb772)[_0x05e8('0x25')](function(_0x5b1924){return _0x5b1924;});}return null;};}function removeEntity(_0x2df7b1,_0x16de4f){return function(_0x3cf982){if(_0x3cf982){return _0x3cf982[_0x05e8('0x26')]()[_0x05e8('0x25')](function(){_0x2df7b1['status'](0xcc)[_0x05e8('0x1e')]();});}};}function handleEntityNotFound(_0x2244b9,_0x5378d6){return function(_0x11d1b8){if(!_0x11d1b8){_0x2244b9['sendStatus'](0x194);}return _0x11d1b8;};}function handleError(_0x337bf7,_0x52b0d3){_0x52b0d3=_0x52b0d3||0x1f4;return function(_0xc9ad17){logger[_0x05e8('0x27')](_0xc9ad17[_0x05e8('0x28')]);if(_0xc9ad17[_0x05e8('0x29')]){delete _0xc9ad17['name'];}_0x337bf7[_0x05e8('0x1d')](_0x52b0d3)[_0x05e8('0x2a')](_0xc9ad17);};}exports[_0x05e8('0x2b')]=function(_0x5dac22,_0x1e082f){var _0x2f240d={},_0x1c0f3b={},_0x4902d0={'count':0x0,'rows':[]};var _0x2b3877=_[_0x05e8('0x2c')](db[_0x05e8('0x2d')][_0x05e8('0x2e')],function(_0x226177){return{'name':_0x226177[_0x05e8('0x2f')],'type':_0x226177[_0x05e8('0x30')][_0x05e8('0x31')]};});_0x1c0f3b['model']=_['map'](_0x2b3877,_0x05e8('0x29'));_0x1c0f3b[_0x05e8('0x32')]=_[_0x05e8('0x33')](_0x5dac22[_0x05e8('0x32')]);_0x1c0f3b['filters']=_['intersection'](_0x1c0f3b[_0x05e8('0x34')],_0x1c0f3b[_0x05e8('0x32')]);_0x2f240d[_0x05e8('0x35')]=_[_0x05e8('0x36')](_0x1c0f3b['model'],qs[_0x05e8('0x37')](_0x5dac22[_0x05e8('0x32')][_0x05e8('0x37')]));_0x2f240d[_0x05e8('0x35')]=_0x2f240d[_0x05e8('0x35')]['length']?_0x2f240d['attributes']:_0x1c0f3b['model'];if(!_0x5dac22[_0x05e8('0x32')][_0x05e8('0x38')]('nolimit')){_0x2f240d[_0x05e8('0x39')]=qs[_0x05e8('0x39')](_0x5dac22[_0x05e8('0x32')][_0x05e8('0x39')]);_0x2f240d[_0x05e8('0x21')]=qs[_0x05e8('0x21')](_0x5dac22[_0x05e8('0x32')][_0x05e8('0x21')]);}_0x2f240d['order']=qs[_0x05e8('0x3a')](_0x5dac22[_0x05e8('0x32')]['sort']);_0x2f240d[_0x05e8('0x3b')]=qs[_0x05e8('0x3c')](_[_0x05e8('0x3d')](_0x5dac22[_0x05e8('0x32')],_0x1c0f3b[_0x05e8('0x3c')]),_0x2b3877);if(_0x5dac22[_0x05e8('0x32')]['filter']){_0x2f240d[_0x05e8('0x3b')]=_[_0x05e8('0x3e')](_0x2f240d[_0x05e8('0x3b')],{'$or':_[_0x05e8('0x2c')](_0x2b3877,function(_0x18d5ee){if(_0x18d5ee['type']!==_0x05e8('0x3f')){var _0x175d6a={};_0x175d6a[_0x18d5ee[_0x05e8('0x29')]]={'$like':'%'+_0x5dac22[_0x05e8('0x32')][_0x05e8('0x40')]+'%'};return _0x175d6a;}})});}_0x2f240d=_[_0x05e8('0x3e')]({},_0x2f240d,_0x5dac22[_0x05e8('0x41')]);var _0x325e50={'where':_0x2f240d[_0x05e8('0x3b')]};return db[_0x05e8('0x2d')][_0x05e8('0x22')](_0x325e50)[_0x05e8('0x25')](function(_0x3cd67a){_0x4902d0[_0x05e8('0x22')]=_0x3cd67a;if(_0x5dac22[_0x05e8('0x32')][_0x05e8('0x42')]){_0x2f240d['include']=[{'all':!![]}];}return db[_0x05e8('0x2d')][_0x05e8('0x43')](_0x2f240d);})[_0x05e8('0x25')](function(_0x270830){_0x4902d0['rows']=_0x270830;return _0x4902d0;})[_0x05e8('0x25')](respondWithFilteredResult(_0x1e082f,_0x2f240d))['catch'](handleError(_0x1e082f,null));};exports[_0x05e8('0x44')]=function(_0x2faf4a,_0x1e6897){var _0xae49a9={'raw':!![],'where':{'id':_0x2faf4a[_0x05e8('0x45')]['id']}},_0x5e77c={};_0x5e77c[_0x05e8('0x34')]=_[_0x05e8('0x33')](db['ChatInternalMessage'][_0x05e8('0x2e')]);_0x5e77c['query']=_[_0x05e8('0x33')](_0x2faf4a[_0x05e8('0x32')]);_0x5e77c[_0x05e8('0x3c')]=_[_0x05e8('0x36')](_0x5e77c['model'],_0x5e77c[_0x05e8('0x32')]);_0xae49a9['attributes']=_['intersection'](_0x5e77c[_0x05e8('0x34')],qs[_0x05e8('0x37')](_0x2faf4a[_0x05e8('0x32')][_0x05e8('0x37')]));_0xae49a9['attributes']=_0xae49a9[_0x05e8('0x35')][_0x05e8('0x46')]?_0xae49a9['attributes']:_0x5e77c[_0x05e8('0x34')];if(_0x2faf4a[_0x05e8('0x32')][_0x05e8('0x42')]){_0xae49a9['include']=[{'all':!![]}];}_0xae49a9=_['merge']({},_0xae49a9,_0x2faf4a['options']);return db[_0x05e8('0x2d')][_0x05e8('0x47')](_0xae49a9)[_0x05e8('0x25')](handleEntityNotFound(_0x1e6897,null))[_0x05e8('0x25')](respondWithResult(_0x1e6897,null))[_0x05e8('0x48')](handleError(_0x1e6897,null));};exports['create']=function(_0xecf1eb,_0x10d74f){return db[_0x05e8('0x2d')][_0x05e8('0x49')](_0xecf1eb[_0x05e8('0x4a')],{})[_0x05e8('0x25')](respondWithResult(_0x10d74f,0xc9))[_0x05e8('0x48')](handleError(_0x10d74f,null));};exports[_0x05e8('0x4b')]=function(_0x407802,_0x8de731){if(_0x407802[_0x05e8('0x4a')]['id']){delete _0x407802['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x407802['params']['id']}})[_0x05e8('0x25')](handleEntityNotFound(_0x8de731,null))[_0x05e8('0x25')](saveUpdates(_0x407802[_0x05e8('0x4a')],null))['then'](respondWithResult(_0x8de731,null))[_0x05e8('0x48')](handleError(_0x8de731,null));};exports[_0x05e8('0x26')]=function(_0x34f78d,_0x24b44b){return db[_0x05e8('0x2d')]['find']({'where':{'id':_0x34f78d['params']['id']}})['then'](handleEntityNotFound(_0x24b44b,null))['then'](removeEntity(_0x24b44b,null))[_0x05e8('0x48')](handleError(_0x24b44b,null));};exports[_0x05e8('0x4c')]=function(_0x1ee903,_0x339f02){return db['ChatInternalMessage'][_0x05e8('0x4c')]()[_0x05e8('0x25')](respondWithResult(_0x339f02,null))[_0x05e8('0x48')](handleError(_0x339f02,null));};function wrapUser(_0x4ced75){return function(_0x2bf637){var _0x1ea720=_0x4ced75[_0x05e8('0x4d')]({'plain':!![]});_0x1ea720[_0x05e8('0x4e')]=[];if(_0x2bf637){_0x1ea720[_0x05e8('0x4f')]=_0x2bf637['createdAt'];_0x1ea720['lastMessage']=_0x2bf637;}else{_0x1ea720['lastMessageAt']=moment(0x0)[_0x05e8('0x50')](_0x05e8('0x51'));_0x1ea720[_0x05e8('0x52')]={};}return _0x1ea720;};}exports[_0x05e8('0x53')]=function(_0x95db88,_0x21045c,_0x12aefc){var _0x164cc5=[];return db[_0x05e8('0x54')][_0x05e8('0x43')]({'where':{'role':['agent',_0x05e8('0x55'),_0x05e8('0x56')]},'attributes':['id',_0x05e8('0x57'),_0x05e8('0x29'),_0x05e8('0x58'),_0x05e8('0x59'),_0x05e8('0x5a'),_0x05e8('0x5b'),_0x05e8('0x5c'),_0x05e8('0x5d'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0x05e8('0x30')],'through':{'attributes':[]}}]})[_0x05e8('0x25')](function(_0x2723bf){if(_0x2723bf){var _0x106070=_0x95db88['user'][_0x05e8('0x4d')]({'plain':!![]});if(!_0x106070)throw new Error(_0x05e8('0x5e'));if(_0x106070[_0x05e8('0x58')]===_0x05e8('0x56')){return db[_0x05e8('0x5f')][_0x05e8('0x47')]({'where':{'name':_0x05e8('0x60'),'userProfileId':_0x106070[_0x05e8('0x61')]},'raw':!![]})[_0x05e8('0x25')](function(_0x21cfea){if(_0x21cfea){if(_0x21cfea['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x21cfea['id']},'raw':!![]})['then'](function(_0x33ea25){var _0x5e840d=[];if(_['isEmpty'](_0x33ea25)){_0x5e840d=_[_0x05e8('0x40')](_0x2723bf,function(_0x1732fd){if(_0x1732fd[_0x05e8('0x58')]!=='agent'){return _0x1732fd;}});return _0x5e840d;}else{for(var _0x82a41b=0x0;_0x82a41b<_0x2723bf[_0x05e8('0x46')];_0x82a41b++){var _0x3cb349=_0x2723bf[_0x82a41b];if(_0x3cb349['role']==='agent'){var _0x5e3e74=_[_0x05e8('0x47')](_0x33ea25,function(_0x3fa383){return _0x3fa383[_0x05e8('0x62')]===_0x3cb349['id'];});if(_0x5e3e74)_0x5e840d[_0x05e8('0x63')](_0x3cb349);}else{_0x5e840d[_0x05e8('0x63')](_0x3cb349);}}return _0x5e840d;}});}else{return _0x2723bf;}}else{var _0x4fd6d9=_[_0x05e8('0x40')](_0x2723bf,function(_0x43f4f4){if(_0x43f4f4[_0x05e8('0x58')]!==_0x05e8('0x64')){return _0x43f4f4;}});return _0x4fd6d9;}});}else{return _0x2723bf;}}})[_0x05e8('0x25')](function(_0x2a4f20){var _0x1a8bde=[];if(_0x2a4f20){_0x164cc5=_0x2a4f20;for(var _0x47ccdc=0x0;_0x47ccdc<_0x2a4f20[_0x05e8('0x46')];_0x47ccdc+=0x1){_0x164cc5[_0x47ccdc][_0x05e8('0x4e')]=[];_0x1a8bde[_0x05e8('0x63')](db['ChatInternalMessage'][_0x05e8('0x47')]({'where':{'FromId':[_0x95db88[_0x05e8('0x56')]['id'],_0x2a4f20[_0x47ccdc]['id']],'ToId':[_0x95db88['user']['id'],_0x2a4f20[_0x47ccdc]['id']],'ChatGroupId':null},'attributes':['id',_0x05e8('0x65'),_0x05e8('0x66'),_0x05e8('0x67'),_0x05e8('0x68'),_0x05e8('0x4a')],'order':qs[_0x05e8('0x3a')](_0x05e8('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x05e8('0x25')](wrapUser(_0x2a4f20[_0x47ccdc])));}return BPromise[_0x05e8('0x6a')](_0x1a8bde);}return[];})[_0x05e8('0x25')](function(_0x5e1b11){return{'rows':_0x5e1b11,'count':_0x5e1b11[_0x05e8('0x46')]};})['then'](respondWithResult(_0x21045c,null))[_0x05e8('0x48')](handleError(_0x21045c,null));}; \ No newline at end of file +var _0xb1b8=['lastMessageAt','format','getUsers','User','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ChatInternalMessage','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','params','options','create','body','destroy','find','describe','get','messages','createdAt','lastMessage'];(function(_0x1a3128,_0x2479b0){var _0x210da6=function(_0x195151){while(--_0x195151){_0x1a3128['push'](_0x1a3128['shift']());}};_0x210da6(++_0x2479b0);}(_0xb1b8,0xfd));var _0x8b1b=function(_0x2c54db,_0x4decb4){_0x2c54db=_0x2c54db-0x0;var _0x40c4e4=_0xb1b8[_0x2c54db];return _0x40c4e4;};'use strict';var emlformat=require(_0x8b1b('0x0'));var rimraf=require(_0x8b1b('0x1'));var zipdir=require(_0x8b1b('0x2'));var jsonpatch=require(_0x8b1b('0x3'));var rp=require(_0x8b1b('0x4'));var moment=require('moment');var BPromise=require(_0x8b1b('0x5'));var Mustache=require('mustache');var util=require(_0x8b1b('0x6'));var path=require(_0x8b1b('0x7'));var sox=require(_0x8b1b('0x8'));var csv=require('to-csv');var ejs=require(_0x8b1b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b1b('0xa'));var squel=require('squel');var crypto=require(_0x8b1b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b1b('0xc'));var toCsv=require(_0x8b1b('0xd'));var querystring=require(_0x8b1b('0xe'));var Papa=require('papaparse');var Redis=require(_0x8b1b('0xf'));var authService=require(_0x8b1b('0x10'));var qs=require(_0x8b1b('0x11'));var as=require(_0x8b1b('0x12'));var hardwareService=require(_0x8b1b('0x13'));var logger=require(_0x8b1b('0x14'))(_0x8b1b('0x15'));var utils=require(_0x8b1b('0x16'));var config=require(_0x8b1b('0x17'));var licenseUtil=require(_0x8b1b('0x18'));var db=require(_0x8b1b('0x19'))['db'];config[_0x8b1b('0x1a')]=_[_0x8b1b('0x1b')](config[_0x8b1b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b1b('0x1c'))(new Redis(config[_0x8b1b('0x1a')]));require('./chatInternalMessage.socket')[_0x8b1b('0x1d')](socket);function respondWithStatusCode(_0xf31deb,_0x2214e0){_0x2214e0=_0x2214e0||0xcc;return function(_0x475113){if(_0x475113){return _0xf31deb[_0x8b1b('0x1e')](_0x2214e0);}return _0xf31deb[_0x8b1b('0x1f')](_0x2214e0)[_0x8b1b('0x20')]();};}function respondWithResult(_0x43af56,_0x58c105){_0x58c105=_0x58c105||0xc8;return function(_0x14664a){if(_0x14664a){return _0x43af56[_0x8b1b('0x1f')](_0x58c105)[_0x8b1b('0x21')](_0x14664a);}};}function respondWithFilteredResult(_0x54e7bc,_0x5e774b){return function(_0x5d4339){if(_0x5d4339){var _0x10c895=typeof _0x5e774b[_0x8b1b('0x22')]==='undefined'&&typeof _0x5e774b[_0x8b1b('0x23')]===_0x8b1b('0x24');var _0x12e41e=_0x5d4339[_0x8b1b('0x25')];var _0x8ac3f0=_0x10c895?0x0:_0x5e774b[_0x8b1b('0x22')];var _0x148b7b=_0x10c895?_0x5d4339['count']:_0x5e774b[_0x8b1b('0x22')]+_0x5e774b[_0x8b1b('0x23')];var _0x522cce;if(_0x148b7b>=_0x12e41e){_0x148b7b=_0x12e41e;_0x522cce=0xc8;}else{_0x522cce=0xce;}_0x54e7bc[_0x8b1b('0x1f')](_0x522cce);return _0x54e7bc[_0x8b1b('0x26')](_0x8b1b('0x27'),_0x8ac3f0+'-'+_0x148b7b+'/'+_0x12e41e)[_0x8b1b('0x21')](_0x5d4339);}return null;};}function patchUpdates(_0x47c92b){return function(_0x4d4e80){try{jsonpatch[_0x8b1b('0x28')](_0x4d4e80,_0x47c92b,!![]);}catch(_0x444a0f){return BPromise[_0x8b1b('0x29')](_0x444a0f);}return _0x4d4e80[_0x8b1b('0x2a')]();};}function saveUpdates(_0x43cb35,_0x49059c){return function(_0x1c7d8e){if(_0x1c7d8e){return _0x1c7d8e[_0x8b1b('0x2b')](_0x43cb35)[_0x8b1b('0x2c')](function(_0x3103a5){return _0x3103a5;});}return null;};}function removeEntity(_0x43648d,_0x3a8ce1){return function(_0x4afae7){if(_0x4afae7){return _0x4afae7['destroy']()[_0x8b1b('0x2c')](function(){_0x43648d[_0x8b1b('0x1f')](0xcc)[_0x8b1b('0x20')]();});}};}function handleEntityNotFound(_0x4a67c6,_0x4f3ebe){return function(_0x348f33){if(!_0x348f33){_0x4a67c6['sendStatus'](0x194);}return _0x348f33;};}function handleError(_0x511e09,_0x4df493){_0x4df493=_0x4df493||0x1f4;return function(_0x2d6ce8){logger[_0x8b1b('0x2d')](_0x2d6ce8[_0x8b1b('0x2e')]);if(_0x2d6ce8['name']){delete _0x2d6ce8[_0x8b1b('0x2f')];}_0x511e09['status'](_0x4df493)[_0x8b1b('0x30')](_0x2d6ce8);};}exports[_0x8b1b('0x31')]=function(_0x1ea9be,_0x10d2c5){var _0x2ae79c={},_0x2acbe1={},_0x3f49af={'count':0x0,'rows':[]};var _0x24ea33=_['map'](db[_0x8b1b('0x32')][_0x8b1b('0x33')],function(_0x3db34a){return{'name':_0x3db34a['fieldName'],'type':_0x3db34a[_0x8b1b('0x34')][_0x8b1b('0x35')]};});_0x2acbe1['model']=_[_0x8b1b('0x36')](_0x24ea33,_0x8b1b('0x2f'));_0x2acbe1[_0x8b1b('0x37')]=_[_0x8b1b('0x38')](_0x1ea9be[_0x8b1b('0x37')]);_0x2acbe1[_0x8b1b('0x39')]=_[_0x8b1b('0x3a')](_0x2acbe1[_0x8b1b('0x3b')],_0x2acbe1[_0x8b1b('0x37')]);_0x2ae79c[_0x8b1b('0x3c')]=_[_0x8b1b('0x3a')](_0x2acbe1[_0x8b1b('0x3b')],qs[_0x8b1b('0x3d')](_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x3d')]));_0x2ae79c[_0x8b1b('0x3c')]=_0x2ae79c['attributes'][_0x8b1b('0x3e')]?_0x2ae79c[_0x8b1b('0x3c')]:_0x2acbe1[_0x8b1b('0x3b')];if(!_0x1ea9be['query'][_0x8b1b('0x3f')](_0x8b1b('0x40'))){_0x2ae79c[_0x8b1b('0x23')]=qs['limit'](_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x23')]);_0x2ae79c['offset']=qs[_0x8b1b('0x22')](_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x22')]);}_0x2ae79c[_0x8b1b('0x41')]=qs[_0x8b1b('0x42')](_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x42')]);_0x2ae79c['where']=qs[_0x8b1b('0x39')](_[_0x8b1b('0x43')](_0x1ea9be[_0x8b1b('0x37')],_0x2acbe1[_0x8b1b('0x39')]),_0x24ea33);if(_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x44')]){_0x2ae79c[_0x8b1b('0x45')]=_['merge'](_0x2ae79c[_0x8b1b('0x45')],{'$or':_[_0x8b1b('0x36')](_0x24ea33,function(_0x280305){if(_0x280305[_0x8b1b('0x34')]!=='VIRTUAL'){var _0x69026c={};_0x69026c[_0x280305['name']]={'$like':'%'+_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x44')]+'%'};return _0x69026c;}})});}_0x2ae79c=_[_0x8b1b('0x46')]({},_0x2ae79c,_0x1ea9be['options']);var _0x2f2593={'where':_0x2ae79c[_0x8b1b('0x45')]};return db[_0x8b1b('0x32')]['count'](_0x2f2593)[_0x8b1b('0x2c')](function(_0x5c233e){_0x3f49af[_0x8b1b('0x25')]=_0x5c233e;if(_0x1ea9be[_0x8b1b('0x37')][_0x8b1b('0x47')]){_0x2ae79c[_0x8b1b('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x8b1b('0x49')](_0x2ae79c);})[_0x8b1b('0x2c')](function(_0x1cbf9e){_0x3f49af['rows']=_0x1cbf9e;return _0x3f49af;})['then'](respondWithFilteredResult(_0x10d2c5,_0x2ae79c))[_0x8b1b('0x4a')](handleError(_0x10d2c5,null));};exports['show']=function(_0x2da719,_0x3f8952){var _0x136582={'raw':!![],'where':{'id':_0x2da719[_0x8b1b('0x4b')]['id']}},_0x494d11={};_0x494d11[_0x8b1b('0x3b')]=_[_0x8b1b('0x38')](db[_0x8b1b('0x32')][_0x8b1b('0x33')]);_0x494d11[_0x8b1b('0x37')]=_['keys'](_0x2da719[_0x8b1b('0x37')]);_0x494d11[_0x8b1b('0x39')]=_[_0x8b1b('0x3a')](_0x494d11[_0x8b1b('0x3b')],_0x494d11[_0x8b1b('0x37')]);_0x136582[_0x8b1b('0x3c')]=_[_0x8b1b('0x3a')](_0x494d11[_0x8b1b('0x3b')],qs['fields'](_0x2da719['query'][_0x8b1b('0x3d')]));_0x136582['attributes']=_0x136582['attributes'][_0x8b1b('0x3e')]?_0x136582[_0x8b1b('0x3c')]:_0x494d11[_0x8b1b('0x3b')];if(_0x2da719[_0x8b1b('0x37')]['includeAll']){_0x136582[_0x8b1b('0x48')]=[{'all':!![]}];}_0x136582=_[_0x8b1b('0x46')]({},_0x136582,_0x2da719[_0x8b1b('0x4c')]);return db[_0x8b1b('0x32')]['find'](_0x136582)[_0x8b1b('0x2c')](handleEntityNotFound(_0x3f8952,null))[_0x8b1b('0x2c')](respondWithResult(_0x3f8952,null))[_0x8b1b('0x4a')](handleError(_0x3f8952,null));};exports[_0x8b1b('0x4d')]=function(_0x158460,_0x18a405){return db[_0x8b1b('0x32')][_0x8b1b('0x4d')](_0x158460[_0x8b1b('0x4e')],{})[_0x8b1b('0x2c')](respondWithResult(_0x18a405,0xc9))[_0x8b1b('0x4a')](handleError(_0x18a405,null));};exports[_0x8b1b('0x2b')]=function(_0x24b553,_0x36885a){if(_0x24b553['body']['id']){delete _0x24b553[_0x8b1b('0x4e')]['id'];}return db[_0x8b1b('0x32')]['find']({'where':{'id':_0x24b553[_0x8b1b('0x4b')]['id']}})[_0x8b1b('0x2c')](handleEntityNotFound(_0x36885a,null))[_0x8b1b('0x2c')](saveUpdates(_0x24b553[_0x8b1b('0x4e')],null))[_0x8b1b('0x2c')](respondWithResult(_0x36885a,null))[_0x8b1b('0x4a')](handleError(_0x36885a,null));};exports[_0x8b1b('0x4f')]=function(_0x6f8b90,_0x3c758d){return db[_0x8b1b('0x32')][_0x8b1b('0x50')]({'where':{'id':_0x6f8b90[_0x8b1b('0x4b')]['id']}})[_0x8b1b('0x2c')](handleEntityNotFound(_0x3c758d,null))[_0x8b1b('0x2c')](removeEntity(_0x3c758d,null))[_0x8b1b('0x4a')](handleError(_0x3c758d,null));};exports['describe']=function(_0x2c8830,_0x5a9e79){return db[_0x8b1b('0x32')][_0x8b1b('0x51')]()[_0x8b1b('0x2c')](respondWithResult(_0x5a9e79,null))[_0x8b1b('0x4a')](handleError(_0x5a9e79,null));};function wrapUser(_0x3c01f2){return function(_0x4cb4d7){var _0x590553=_0x3c01f2[_0x8b1b('0x52')]({'plain':!![]});_0x590553[_0x8b1b('0x53')]=[];if(_0x4cb4d7){_0x590553['lastMessageAt']=_0x4cb4d7[_0x8b1b('0x54')];_0x590553[_0x8b1b('0x55')]=_0x4cb4d7;}else{_0x590553[_0x8b1b('0x56')]=moment(0x0)[_0x8b1b('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x590553[_0x8b1b('0x55')]={};}return _0x590553;};}exports[_0x8b1b('0x58')]=function(_0x35acdc,_0x53d797,_0x1639ed){var _0x58ce43=[];return db[_0x8b1b('0x59')]['findAll']({'where':{'role':['agent','admin',_0x8b1b('0x5a')]},'attributes':['id',_0x8b1b('0x5b'),'name',_0x8b1b('0x5c'),_0x8b1b('0x5d'),'internal',_0x8b1b('0x5e'),_0x8b1b('0x5f'),_0x8b1b('0x60'),'showWebBar'],'order':qs[_0x8b1b('0x42')]('-online'),'include':[{'model':db[_0x8b1b('0x61')],'as':_0x8b1b('0x62'),'attributes':['id',_0x8b1b('0x2f'),_0x8b1b('0x34')],'through':{'attributes':[]}}]})[_0x8b1b('0x2c')](function(_0x52c1f1){if(_0x52c1f1){var _0x2af487=_0x35acdc[_0x8b1b('0x5a')][_0x8b1b('0x52')]({'plain':!![]});if(!_0x2af487)throw new Error(_0x8b1b('0x63'));if(_0x2af487['role']==='user'){return db[_0x8b1b('0x64')][_0x8b1b('0x50')]({'where':{'name':_0x8b1b('0x65'),'userProfileId':_0x2af487[_0x8b1b('0x66')]},'raw':!![]})['then'](function(_0x11afbf){if(_0x11afbf){if(_0x11afbf[_0x8b1b('0x67')]===0x0){return db[_0x8b1b('0x68')][_0x8b1b('0x49')]({'where':{'sectionId':_0x11afbf['id']},'raw':!![]})[_0x8b1b('0x2c')](function(_0x1caa77){var _0x3a48d8=[];if(_[_0x8b1b('0x69')](_0x1caa77)){_0x3a48d8=_['filter'](_0x52c1f1,function(_0x328961){if(_0x328961[_0x8b1b('0x5c')]!=='agent'){return _0x328961;}});return _0x3a48d8;}else{for(var _0x1f2014=0x0;_0x1f2014<_0x52c1f1[_0x8b1b('0x3e')];_0x1f2014++){var _0x6871d3=_0x52c1f1[_0x1f2014];if(_0x6871d3['role']===_0x8b1b('0x6a')){var _0x12790e=_['find'](_0x1caa77,function(_0x335a57){return _0x335a57[_0x8b1b('0x6b')]===_0x6871d3['id'];});if(_0x12790e)_0x3a48d8[_0x8b1b('0x6c')](_0x6871d3);}else{_0x3a48d8[_0x8b1b('0x6c')](_0x6871d3);}}return _0x3a48d8;}});}else{return _0x52c1f1;}}else{var _0x2418a5=_['filter'](_0x52c1f1,function(_0x94f5cb){if(_0x94f5cb[_0x8b1b('0x5c')]!==_0x8b1b('0x6a')){return _0x94f5cb;}});return _0x2418a5;}});}else{return _0x52c1f1;}}})['then'](function(_0x219c63){var _0x5bcc7d=[];if(_0x219c63){_0x58ce43=_0x219c63;for(var _0xc85ed0=0x0;_0xc85ed0<_0x219c63[_0x8b1b('0x3e')];_0xc85ed0+=0x1){_0x58ce43[_0xc85ed0][_0x8b1b('0x53')]=[];_0x5bcc7d['push'](db[_0x8b1b('0x32')][_0x8b1b('0x50')]({'where':{'FromId':[_0x35acdc['user']['id'],_0x219c63[_0xc85ed0]['id']],'ToId':[_0x35acdc['user']['id'],_0x219c63[_0xc85ed0]['id']],'ChatGroupId':null},'attributes':['id',_0x8b1b('0x54'),_0x8b1b('0x6d'),_0x8b1b('0x6e'),_0x8b1b('0x6f'),_0x8b1b('0x4e')],'order':qs[_0x8b1b('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8b1b('0x2c')](wrapUser(_0x219c63[_0xc85ed0])));}return BPromise[_0x8b1b('0x70')](_0x5bcc7d);}return[];})[_0x8b1b('0x2c')](function(_0x55ead1){return{'rows':_0x55ead1,'count':_0x55ead1[_0x8b1b('0x3e')]};})[_0x8b1b('0x2c')](respondWithResult(_0x53d797,null))['catch'](handleError(_0x53d797,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2ae397a..27b1f12 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 _0xea7c=['hasOwnProperty','hook','ChatInternalMessage','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea7c,0xe6));var _0xcea7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xea7c[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0xcea7('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcea7('0x1'),'afterUpdate':'update','afterDestroy':_0xcea7('0x2')};function emitEvent(_0x1df70a){return function(_0x49656a,_0x3d311c,_0x44be41){ChatInternalMessageEvents[_0xcea7('0x3')](_0x1df70a+':'+_0x49656a['id'],_0x49656a);ChatInternalMessageEvents[_0xcea7('0x3')](_0x1df70a,_0x49656a);_0x44be41(null);};}for(var e in events){if(events[_0xcea7('0x4')](e)){var event=events[e];ChatInternalMessage[_0xcea7('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5774=['remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5774,0x15d));var _0x4577=function(_0x160794,_0x5e2152){_0x160794=_0x160794-0x0;var _0x58b026=_0x5774[_0x160794];return _0x58b026;};'use strict';var EventEmitter=require(_0x4577('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x4577('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4577('0x2'),'afterUpdate':'update','afterDestroy':_0x4577('0x3')};function emitEvent(_0xa55591){return function(_0x56cf31,_0x5b4b21,_0x488d37){ChatInternalMessageEvents['emit'](_0xa55591+':'+_0x56cf31['id'],_0x56cf31);ChatInternalMessageEvents[_0x4577('0x4')](_0xa55591,_0x56cf31);_0x488d37(null);};}for(var e in events){if(events[_0x4577('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4577('0x6')](e,emitEvent(event));}}module[_0x4577('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4582a14..2aa45b3 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 _0x316d=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','lodash','util','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x316d,0x125));var _0xd316=function(_0x2df2eb,_0x3959a0){_0x2df2eb=_0x2df2eb-0x0;var _0xa5abb9=_0x316d[_0x2df2eb];return _0xa5abb9;};'use strict';var _=require(_0xd316('0x0'));var util=require(_0xd316('0x1'));var logger=require('../../config/logger')(_0xd316('0x2'));var moment=require(_0xd316('0x3'));var BPromise=require(_0xd316('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd316('0x5'));var rimraf=require(_0xd316('0x6'));var config=require(_0xd316('0x7'));var attributes=require(_0xd316('0x8'));module[_0xd316('0x9')]=function(_0x5b3f46,_0x5e3db8){return _0x5b3f46[_0xd316('0xa')](_0xd316('0xb'),attributes,{'tableName':_0xd316('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8fce=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x1a5ad1,_0x357407){var _0x7b8b22=function(_0x312e53){while(--_0x312e53){_0x1a5ad1['push'](_0x1a5ad1['shift']());}};_0x7b8b22(++_0x357407);}(_0x8fce,0x131));var _0xe8fc=function(_0xbe304b,_0x183ad5){_0xbe304b=_0xbe304b-0x0;var _0x40b717=_0x8fce[_0xbe304b];return _0x40b717;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe8fc('0x0'))(_0xe8fc('0x1'));var moment=require('moment');var BPromise=require(_0xe8fc('0x2'));var rp=require(_0xe8fc('0x3'));var fs=require('fs');var path=require(_0xe8fc('0x4'));var rimraf=require(_0xe8fc('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8fc('0x6'));module[_0xe8fc('0x7')]=function(_0x8dfa39,_0x4dbc3b){return _0x8dfa39[_0xe8fc('0x8')](_0xe8fc('0x9'),attributes,{'tableName':_0xe8fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe8fc('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 20ef026..2cd50a6 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 _0xe43d=['../../config/environment','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52e524,_0x162407){var _0x4e36ad=function(_0x218e6a){while(--_0x218e6a){_0x52e524['push'](_0x52e524['shift']());}};_0x4e36ad(++_0x162407);}(_0xe43d,0x75));var _0xde43=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0xe43d[_0x4fa2da];return _0xd6958a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde43('0x0'));var BPromise=require(_0xde43('0x1'));var rs=require(_0xde43('0x2'));var fs=require('fs');var Redis=require(_0xde43('0x3'));var db=require(_0xde43('0x4'))['db'];var utils=require(_0xde43('0x5'));var logger=require(_0xde43('0x6'))(_0xde43('0x7'));var config=require(_0xde43('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xde43('0x9')]=_[_0xde43('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xde43('0xb'))(new Redis(config['redis']));require(_0xde43('0xc'))['register'](socket);function respondWithRpcPromise(_0x5967ee,_0x2061ca,_0x19c642){return new BPromise(function(_0x327652,_0x1aeea9){return client[_0xde43('0xd')](_0x5967ee,_0x19c642)[_0xde43('0xe')](function(_0x55333b){logger[_0xde43('0xf')](_0xde43('0x10'),_0x2061ca,_0xde43('0x11'));logger[_0xde43('0x12')](_0xde43('0x13'),_0x2061ca,'request\x20sent',JSON['stringify'](_0x55333b));if(_0x55333b[_0xde43('0x14')]){if(_0x55333b['error'][_0xde43('0x15')]===0x1f4){logger[_0xde43('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x2061ca,_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);return _0x1aeea9(_0x55333b[_0xde43('0x14')]['message']);}logger[_0xde43('0x14')](_0xde43('0x10'),_0x2061ca,_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);return _0x327652(_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);}else{logger[_0xde43('0xf')](_0xde43('0x10'),_0x2061ca,_0xde43('0x11'));_0x327652(_0x55333b[_0xde43('0x17')]['message']);}})[_0xde43('0x18')](function(_0x11f642){logger[_0xde43('0x14')](_0xde43('0x10'),_0x2061ca,_0x11f642);_0x1aeea9(_0x11f642);});});} \ No newline at end of file +var _0x024a=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x16fc61,_0x3c2439){var _0x19ce9b=function(_0x553efd){while(--_0x553efd){_0x16fc61['push'](_0x16fc61['shift']());}};_0x19ce9b(++_0x3c2439);}(_0x024a,0x17f));var _0xa024=function(_0x2b7556,_0x371248){_0x2b7556=_0x2b7556-0x0;var _0x433195=_0x024a[_0x2b7556];return _0x433195;};'use strict';var _=require(_0xa024('0x0'));var util=require(_0xa024('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa024('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa024('0x3'));var logger=require(_0xa024('0x4'))(_0xa024('0x5'));var config=require('../../config/environment');var jayson=require(_0xa024('0x6'));var client=jayson['client'][_0xa024('0x7')]({'port':0x232a});config[_0xa024('0x8')]=_['defaults'](config[_0xa024('0x8')],{'host':_0xa024('0x9'),'port':0x18eb});var socket=require(_0xa024('0xa'))(new Redis(config[_0xa024('0x8')]));require(_0xa024('0xb'))[_0xa024('0xc')](socket);function respondWithRpcPromise(_0x1fafd3,_0x2ec2e1,_0x40100c){return new BPromise(function(_0x1ed31e,_0x5f0856){return client[_0xa024('0xd')](_0x1fafd3,_0x40100c)['then'](function(_0x105c94){logger[_0xa024('0xe')](_0xa024('0xf'),_0x2ec2e1,_0xa024('0x10'));logger[_0xa024('0x11')](_0xa024('0x12'),_0x2ec2e1,_0xa024('0x10'),JSON[_0xa024('0x13')](_0x105c94));if(_0x105c94[_0xa024('0x14')]){if(_0x105c94[_0xa024('0x14')][_0xa024('0x15')]===0x1f4){logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);return _0x5f0856(_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);}logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);return _0x1ed31e(_0x105c94[_0xa024('0x14')][_0xa024('0x16')]);}else{logger[_0xa024('0xe')](_0xa024('0xf'),_0x2ec2e1,_0xa024('0x10'));_0x1ed31e(_0x105c94[_0xa024('0x17')][_0xa024('0x16')]);}})[_0xa024('0x18')](function(_0x165fcd){logger[_0xa024('0x14')](_0xa024('0xf'),_0x2ec2e1,_0x165fcd);_0x5f0856(_0x165fcd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fca61d4..aa7a614 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 _0x0962=['chatInternalMessage:','./chatInternalMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x31a7cd,_0xb15589){var _0x15d4a=function(_0x5367d0){while(--_0x5367d0){_0x31a7cd['push'](_0x31a7cd['shift']());}};_0x15d4a(++_0xb15589);}(_0x0962,0x181));var _0x2096=function(_0x453b9d,_0x182e79){_0x453b9d=_0x453b9d-0x0;var _0x57ff72=_0x0962[_0x453b9d];return _0x57ff72;};'use strict';var ChatInternalMessageEvents=require(_0x2096('0x0'));var events=[_0x2096('0x1'),_0x2096('0x2'),'update'];function createListener(_0x216ec8,_0x53903a){return function(_0x1e0d59){_0x53903a[_0x2096('0x3')](_0x216ec8,_0x1e0d59);};}function removeListener(_0x1fc89f,_0x570a70){return function(){ChatInternalMessageEvents[_0x2096('0x4')](_0x1fc89f,_0x570a70);};}exports[_0x2096('0x5')]=function(_0x1628e3){for(var _0x14b0ae=0x0,_0x346cb0=events[_0x2096('0x6')];_0x14b0ae<_0x346cb0;_0x14b0ae++){var _0x58eee4=events[_0x14b0ae];var _0x1a9089=createListener(_0x2096('0x7')+_0x58eee4,_0x1628e3);ChatInternalMessageEvents['on'](_0x58eee4,_0x1a9089);}}; \ No newline at end of file +var _0x74b0=['./chatInternalMessage.events','save','remove','update','removeListener','length','chatInternalMessage:'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x74b0,0x1c0));var _0x074b=function(_0x1b8524,_0x1bb669){_0x1b8524=_0x1b8524-0x0;var _0x81418d=_0x74b0[_0x1b8524];return _0x81418d;};'use strict';var ChatInternalMessageEvents=require(_0x074b('0x0'));var events=[_0x074b('0x1'),_0x074b('0x2'),_0x074b('0x3')];function createListener(_0xd826df,_0x33fbad){return function(_0x47a7f6){_0x33fbad['emit'](_0xd826df,_0x47a7f6);};}function removeListener(_0x321e3b,_0x245216){return function(){ChatInternalMessageEvents[_0x074b('0x4')](_0x321e3b,_0x245216);};}exports['register']=function(_0x5643b0){for(var _0x3f9337=0x0,_0x55bab0=events[_0x074b('0x5')];_0x3f9337<_0x55bab0;_0x3f9337++){var _0x202b68=events[_0x3f9337];var _0x59422d=createListener(_0x074b('0x6')+_0x202b68,_0x5643b0);ChatInternalMessageEvents['on'](_0x202b68,_0x59422d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3aa617b..38750b3 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 _0x4071=['/users','show','post','create','put','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x4071,0x1c0));var _0x1407=function(_0x1697ae,_0x3146cc){_0x1697ae=_0x1697ae-0x0;var _0x4bcb04=_0x4071[_0x1697ae];return _0x4bcb04;};'use strict';var multer=require('multer');var util=require(_0x1407('0x0'));var path=require(_0x1407('0x1'));var timeout=require('connect-timeout');var express=require(_0x1407('0x2'));var router=express[_0x1407('0x3')]();var fs_extra=require(_0x1407('0x4'));var auth=require(_0x1407('0x5'));var interaction=require(_0x1407('0x6'));var config=require(_0x1407('0x7'));var controller=require(_0x1407('0x8'));router[_0x1407('0x9')]('/',auth[_0x1407('0xa')](),controller[_0x1407('0xb')]);router[_0x1407('0x9')](_0x1407('0xc'),auth[_0x1407('0xa')](),controller[_0x1407('0xd')]);router[_0x1407('0x9')](_0x1407('0xe'),auth['isAuthenticated'](),controller['getUsers']);router['get']('/:id',auth[_0x1407('0xa')](),controller[_0x1407('0xf')]);router[_0x1407('0x10')]('/',auth['isAuthenticated'](),controller[_0x1407('0x11')]);router[_0x1407('0x12')](_0x1407('0x13'),controller['update']);router['delete'](_0x1407('0x13'),auth[_0x1407('0xa')](),controller[_0x1407('0x14')]);module[_0x1407('0x15')]=router; \ No newline at end of file +var _0x7f70=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','multer','util'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x7f70,0x1a0));var _0x07f7=function(_0x104c94,_0x3d1eb2){_0x104c94=_0x104c94-0x0;var _0x2006d4=_0x7f70[_0x104c94];return _0x2006d4;};'use strict';var multer=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var path=require(_0x07f7('0x2'));var timeout=require(_0x07f7('0x3'));var express=require('express');var router=express[_0x07f7('0x4')]();var fs_extra=require(_0x07f7('0x5'));var auth=require(_0x07f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x07f7('0x7'));var controller=require(_0x07f7('0x8'));router[_0x07f7('0x9')]('/',auth[_0x07f7('0xa')](),controller[_0x07f7('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x07f7('0xc')]);router[_0x07f7('0x9')](_0x07f7('0xd'),auth['isAuthenticated'](),controller[_0x07f7('0xe')]);router[_0x07f7('0x9')](_0x07f7('0xf'),auth[_0x07f7('0xa')](),controller[_0x07f7('0x10')]);router[_0x07f7('0x11')]('/',auth[_0x07f7('0xa')](),controller[_0x07f7('0x12')]);router['put'](_0x07f7('0xf'),controller[_0x07f7('0x13')]);router[_0x07f7('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x07f7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e15c0af..a82f145 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 _0x0833=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x2993f1,_0x1ed6ac){var _0x208f01=function(_0x40f8b1){while(--_0x40f8b1){_0x2993f1['push'](_0x2993f1['shift']());}};_0x208f01(++_0x1ed6ac);}(_0x0833,0x1bd));var _0x3083=function(_0xc26e81,_0x31b7c6){_0xc26e81=_0xc26e81-0x0;var _0x2bd3bf=_0x0833[_0xc26e81];return _0x2bd3bf;};'use strict';var Sequelize=require(_0x3083('0x0'));module[_0x3083('0x1')]={'body':{'type':Sequelize[_0x3083('0x2')](_0x3083('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3083('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3083('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3083('0x6')]},'providerResponse':{'type':Sequelize[_0x3083('0x2')]}}; \ No newline at end of file +var _0x6ae2=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x102238,_0x21bc79){_0x102238=_0x102238-0x0;var _0x3b1330=_0x6ae2[_0x102238];return _0x3b1330;};'use strict';var Sequelize=require(_0x26ae('0x0'));module[_0x26ae('0x1')]={'body':{'type':Sequelize[_0x26ae('0x2')](_0x26ae('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x26ae('0x5')]('in',_0x26ae('0x6')),'defaultValue':_0x26ae('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x26ae('0x7')]},'providerResponse':{'type':Sequelize[_0x26ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d7ac6d9..c1b1e57 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 _0x078c=['intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','chat-interactions','accept','chat','read','format','UserId','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','email','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./chatMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x078c,0xc7));var _0xc078=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0x078c[_0xae01dd];return _0x8c26df;};'use strict';var emlformat=require(_0xc078('0x0'));var rimraf=require(_0xc078('0x1'));var zipdir=require(_0xc078('0x2'));var jsonpatch=require(_0xc078('0x3'));var rp=require(_0xc078('0x4'));var moment=require(_0xc078('0x5'));var BPromise=require(_0xc078('0x6'));var Mustache=require(_0xc078('0x7'));var util=require(_0xc078('0x8'));var path=require('path');var sox=require(_0xc078('0x9'));var csv=require(_0xc078('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc078('0xb'));var _=require('lodash');var squel=require(_0xc078('0xc'));var crypto=require(_0xc078('0xd'));var jsforce=require(_0xc078('0xe'));var deskjs=require(_0xc078('0xf'));var toCsv=require(_0xc078('0xa'));var querystring=require(_0xc078('0x10'));var Papa=require(_0xc078('0x11'));var Redis=require(_0xc078('0x12'));var authService=require(_0xc078('0x13'));var qs=require(_0xc078('0x14'));var as=require(_0xc078('0x15'));var hardwareService=require(_0xc078('0x16'));var logger=require(_0xc078('0x17'))('api');var utils=require(_0xc078('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc078('0x19'));var db=require(_0xc078('0x1a'))['db'];config['redis']=_[_0xc078('0x1b')](config[_0xc078('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc078('0x1c')]));require(_0xc078('0x1d'))[_0xc078('0x1e')](socket);var jayson=require(_0xc078('0x1f'));var client=jayson['client'][_0xc078('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xc078('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x15f526,_0x4ca86c,_0x44e784,_0xd4c95c){return new BPromise(function(_0x160adb,_0x1d2082){var _0x391ba8=_0xd4c95c||client;return _0x391ba8[_0xc078('0x21')](_0x15f526,_0x44e784)[_0xc078('0x22')](function(_0x7acfed){logger[_0xc078('0x23')]('ChatMessage,\x20%s,\x20%s',_0x4ca86c,_0xc078('0x24'));logger[_0xc078('0x25')](_0xc078('0x26'),_0x4ca86c,'request\x20sent',JSON[_0xc078('0x27')](_0x7acfed));if(_0x7acfed['error']){if(_0x7acfed[_0xc078('0x28')][_0xc078('0x29')]===0x1f4){logger[_0xc078('0x28')](_0xc078('0x2a'),_0x4ca86c,_0x7acfed['error'][_0xc078('0x2b')]);return _0x1d2082(_0x7acfed['error'][_0xc078('0x2b')]);}logger[_0xc078('0x28')](_0xc078('0x2a'),_0x4ca86c,_0x7acfed[_0xc078('0x28')]['message']);return _0x160adb(_0x7acfed[_0xc078('0x28')][_0xc078('0x2b')]);}else{logger[_0xc078('0x23')](_0xc078('0x2a'),_0x4ca86c,_0xc078('0x24'));_0x160adb(_0x7acfed[_0xc078('0x2c')]['message']);}})['catch'](function(_0x33d1f2){logger[_0xc078('0x28')](_0xc078('0x2a'),_0x4ca86c,_0x33d1f2);_0x1d2082(_0x33d1f2);});});}function respondWithStatusCode(_0x514422,_0x10e503){_0x10e503=_0x10e503||0xcc;return function(_0x4d0c93){if(_0x4d0c93){return _0x514422[_0xc078('0x2d')](_0x10e503);}return _0x514422[_0xc078('0x2e')](_0x10e503)[_0xc078('0x2f')]();};}function respondWithResult(_0x556458,_0x6e6d58){_0x6e6d58=_0x6e6d58||0xc8;return function(_0x18faac){if(_0x18faac){return _0x556458[_0xc078('0x2e')](_0x6e6d58)[_0xc078('0x30')](_0x18faac);}};}function respondWithFilteredResult(_0x58e82b,_0x43c696){return function(_0x2868b5){if(_0x2868b5){var _0x1bd3e2=typeof _0x43c696[_0xc078('0x31')]===_0xc078('0x32')&&typeof _0x43c696[_0xc078('0x33')]===_0xc078('0x32');var _0x33aa64=_0x2868b5[_0xc078('0x34')];var _0x9aac93=_0x1bd3e2?0x0:_0x43c696[_0xc078('0x31')];var _0x110c53=_0x1bd3e2?_0x2868b5[_0xc078('0x34')]:_0x43c696['offset']+_0x43c696[_0xc078('0x33')];var _0x2304e2;if(_0x110c53>=_0x33aa64){_0x110c53=_0x33aa64;_0x2304e2=0xc8;}else{_0x2304e2=0xce;}_0x58e82b['status'](_0x2304e2);return _0x58e82b[_0xc078('0x35')](_0xc078('0x36'),_0x9aac93+'-'+_0x110c53+'/'+_0x33aa64)[_0xc078('0x30')](_0x2868b5);}return null;};}function patchUpdates(_0x3339a3){return function(_0x47b029){try{jsonpatch[_0xc078('0x37')](_0x47b029,_0x3339a3,!![]);}catch(_0x2c19ea){return BPromise['reject'](_0x2c19ea);}return _0x47b029[_0xc078('0x38')]();};}function saveUpdates(_0x515990,_0x3b9b78){return function(_0x11400c){if(_0x11400c){return _0x11400c['update'](_0x515990)[_0xc078('0x22')](function(_0x1f315b){return _0x1f315b;});}return null;};}function removeEntity(_0x38378b,_0x1875f7){return function(_0x38176c){if(_0x38176c){return _0x38176c[_0xc078('0x39')]()[_0xc078('0x22')](function(){_0x38378b[_0xc078('0x2e')](0xcc)[_0xc078('0x2f')]();});}};}function handleEntityNotFound(_0x3cc0ea,_0x26500a){return function(_0x45d01e){if(!_0x45d01e){_0x3cc0ea[_0xc078('0x2d')](0x194);}return _0x45d01e;};}function handleError(_0x539438,_0x186747){_0x186747=_0x186747||0x1f4;return function(_0x4deee6){logger[_0xc078('0x28')](_0x4deee6[_0xc078('0x3a')]);if(_0x4deee6[_0xc078('0x3b')]){delete _0x4deee6['name'];}_0x539438['status'](_0x186747)[_0xc078('0x3c')](_0x4deee6);};}exports[_0xc078('0x3d')]=function(_0x328876,_0xf526d){var _0x4387df={},_0x1512e3={},_0x524c25={'count':0x0,'rows':[]};var _0x32bde5=_[_0xc078('0x3e')](db[_0xc078('0x3f')][_0xc078('0x40')],function(_0x3c5f0b){return{'name':_0x3c5f0b[_0xc078('0x41')],'type':_0x3c5f0b[_0xc078('0x42')][_0xc078('0x43')]};});_0x1512e3[_0xc078('0x44')]=_['map'](_0x32bde5,_0xc078('0x3b'));_0x1512e3[_0xc078('0x45')]=_[_0xc078('0x46')](_0x328876[_0xc078('0x45')]);_0x1512e3[_0xc078('0x47')]=_['intersection'](_0x1512e3[_0xc078('0x44')],_0x1512e3[_0xc078('0x45')]);_0x4387df[_0xc078('0x48')]=_[_0xc078('0x49')](_0x1512e3[_0xc078('0x44')],qs[_0xc078('0x4a')](_0x328876['query'][_0xc078('0x4a')]));_0x4387df[_0xc078('0x48')]=_0x4387df['attributes'][_0xc078('0x4b')]?_0x4387df[_0xc078('0x48')]:_0x1512e3[_0xc078('0x44')];if(!_0x328876[_0xc078('0x45')]['hasOwnProperty'](_0xc078('0x4c'))){_0x4387df['limit']=qs[_0xc078('0x33')](_0x328876[_0xc078('0x45')][_0xc078('0x33')]);_0x4387df[_0xc078('0x31')]=qs[_0xc078('0x31')](_0x328876['query'][_0xc078('0x31')]);}_0x4387df['order']=qs['sort'](_0x328876[_0xc078('0x45')][_0xc078('0x4d')]);_0x4387df[_0xc078('0x4e')]=qs[_0xc078('0x47')](_[_0xc078('0x4f')](_0x328876['query'],_0x1512e3[_0xc078('0x47')]),_0x32bde5);if(_0x328876['query'][_0xc078('0x50')]){_0x4387df[_0xc078('0x4e')]=_[_0xc078('0x51')](_0x4387df['where'],{'$or':_['map'](_0x32bde5,function(_0x257f1c){if(_0x257f1c[_0xc078('0x42')]!=='VIRTUAL'){var _0x55ebf3={};_0x55ebf3[_0x257f1c['name']]={'$like':'%'+_0x328876[_0xc078('0x45')][_0xc078('0x50')]+'%'};return _0x55ebf3;}})});}_0x4387df=_[_0xc078('0x51')]({},_0x4387df,_0x328876[_0xc078('0x52')]);var _0x151ecd={'where':_0x4387df[_0xc078('0x4e')]};return db[_0xc078('0x3f')][_0xc078('0x34')](_0x151ecd)[_0xc078('0x22')](function(_0x3180f6){_0x524c25[_0xc078('0x34')]=_0x3180f6;if(_0x328876[_0xc078('0x45')]['includeAll']){_0x4387df['include']=[{'all':!![]}];}return db[_0xc078('0x3f')][_0xc078('0x53')](_0x4387df);})[_0xc078('0x22')](function(_0x265106){_0x524c25[_0xc078('0x54')]=_0x265106;return _0x524c25;})[_0xc078('0x22')](respondWithFilteredResult(_0xf526d,_0x4387df))[_0xc078('0x55')](handleError(_0xf526d,null));};exports[_0xc078('0x56')]=function(_0x4b3803,_0x56a27d){var _0x35f2f5={'raw':!![],'where':{'id':_0x4b3803[_0xc078('0x57')]['id']}},_0x528922={};_0x528922[_0xc078('0x44')]=_[_0xc078('0x46')](db[_0xc078('0x3f')][_0xc078('0x40')]);_0x528922[_0xc078('0x45')]=_[_0xc078('0x46')](_0x4b3803[_0xc078('0x45')]);_0x528922[_0xc078('0x47')]=_[_0xc078('0x49')](_0x528922[_0xc078('0x44')],_0x528922[_0xc078('0x45')]);_0x35f2f5[_0xc078('0x48')]=_['intersection'](_0x528922[_0xc078('0x44')],qs['fields'](_0x4b3803[_0xc078('0x45')]['fields']));_0x35f2f5[_0xc078('0x48')]=_0x35f2f5[_0xc078('0x48')]['length']?_0x35f2f5[_0xc078('0x48')]:_0x528922[_0xc078('0x44')];if(_0x4b3803[_0xc078('0x45')][_0xc078('0x58')]){_0x35f2f5['include']=[{'all':!![]}];}_0x35f2f5=_[_0xc078('0x51')]({},_0x35f2f5,_0x4b3803['options']);return db[_0xc078('0x3f')][_0xc078('0x59')](_0x35f2f5)['then'](handleEntityNotFound(_0x56a27d,null))[_0xc078('0x22')](respondWithResult(_0x56a27d,null))['catch'](handleError(_0x56a27d,null));};exports['create']=function(_0x3eed1b,_0x3a3c79){return db['ChatMessage'][_0xc078('0x5a')](_0x3eed1b[_0xc078('0x5b')],{})[_0xc078('0x22')](respondWithResult(_0x3a3c79,0xc9))[_0xc078('0x55')](handleError(_0x3a3c79,null));};exports[_0xc078('0x5c')]=function(_0x448b58,_0x50684c){if(_0x448b58[_0xc078('0x5b')]['id']){delete _0x448b58[_0xc078('0x5b')]['id'];}return db['ChatMessage'][_0xc078('0x59')]({'where':{'id':_0x448b58[_0xc078('0x57')]['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x50684c,null))[_0xc078('0x22')](saveUpdates(_0x448b58[_0xc078('0x5b')],null))['then'](respondWithResult(_0x50684c,null))[_0xc078('0x55')](handleError(_0x50684c,null));};exports[_0xc078('0x39')]=function(_0x34015d,_0x46683b){return db[_0xc078('0x3f')]['find']({'where':{'id':_0x34015d[_0xc078('0x57')]['id']}})['then'](handleEntityNotFound(_0x46683b,null))['then'](removeEntity(_0x46683b,null))[_0xc078('0x55')](handleError(_0x46683b,null));};exports[_0xc078('0x5d')]=function(_0x444ee7,_0x243f9c){return db[_0xc078('0x3f')][_0xc078('0x5d')]()[_0xc078('0x22')](respondWithResult(_0x243f9c,null))[_0xc078('0x55')](handleError(_0x243f9c,null));};var interaction_log=require(_0xc078('0x17'))(_0xc078('0x5e'));exports[_0xc078('0x5f')]=function(_0x256fc5,_0x1b5b04,_0x5b210b){var _0x4780b6={'agent':{},'channel':_0xc078('0x60')};if(_0x256fc5[_0xc078('0x5b')]['id']){delete _0x256fc5[_0xc078('0x5b')]['id'];}_0x256fc5[_0xc078('0x5b')][_0xc078('0x61')]=!![];_0x256fc5[_0xc078('0x5b')]['readAt']=moment()[_0xc078('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x256fc5['body'][_0xc078('0x63')]=_0x256fc5[_0xc078('0x5b')][_0xc078('0x63')]||_0x256fc5['user']['id'];_0x4780b6[_0xc078('0x64')]['id']=_0x256fc5[_0xc078('0x5b')][_0xc078('0x63')];return db[_0xc078('0x3f')][_0xc078('0x59')]({'where':{'id':_0x256fc5[_0xc078('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b5b04,null))[_0xc078('0x22')](saveUpdates(_0x256fc5[_0xc078('0x5b')],null))[_0xc078('0x22')](function(_0x32da1f){if(_0x32da1f){_0x4780b6[_0xc078('0x2b')]=_0x32da1f['get']({'plain':!![]});return db[_0xc078('0x65')][_0xc078('0x59')]({'where':{'id':_0x32da1f[_0xc078('0x66')]}});}return null;})[_0xc078('0x22')](handleEntityNotFound(_0x1b5b04,null))['then'](function(_0x2ab941){if(_0x2ab941){return _0x2ab941['update']({'UserId':_0x256fc5[_0xc078('0x5b')]['UserId'],'read1stAt':_[_0xc078('0x67')](_0x2ab941[_0xc078('0x68')])?moment()[_0xc078('0x62')](_0xc078('0x69')):undefined});}return null;})['then'](function(_0x3c7149){if(_0x3c7149){_0x4780b6[_0xc078('0x6a')]=_0x3c7149[_0xc078('0x6b')]({'plain':!![]});interaction_log['info'](_0xc078('0x6c'),_0x256fc5[_0xc078('0x6d')]['id'],_0x256fc5[_0xc078('0x6d')][_0xc078('0x3b')],_0x256fc5[_0xc078('0x6d')]['role'],_0x4780b6['interaction']['id'],_0x256fc5['body']?JSON['stringify'](_0x256fc5['body']):_0xc078('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xc078('0x6f'),_0x4780b6);}return null;})[_0xc078('0x22')](function(_0x31f196){var _0x590ae8=_0xc078('0x70')+_0x31f196['message'][_0xc078('0x71')];return db[_0xc078('0x72')]['query'](_0x590ae8,{'type':db[_0xc078('0x73')][_0xc078('0x74')][_0xc078('0x75')],'raw':!![]})[_0xc078('0x22')](function(_0x109f94){return _0x109f94;});})[_0xc078('0x22')](function(_0x2fb3ad){if(_0x2fb3ad){_0x4780b6['message'][_0xc078('0x76')]=_0x2fb3ad[0x0];if(!_0x256fc5[_0xc078('0x5b')][_0xc078('0x63')])return;return db[_0xc078('0x77')][_0xc078('0x59')]({'where':{'id':_0x256fc5[_0xc078('0x5b')][_0xc078('0x63')],'role':_0xc078('0x64')},'attributes':['id','name',_0xc078('0x78'),'email',_0xc078('0x79')],'raw':!![]});}return null;})['then'](function(_0x1d697d){if(!_0x1d697d)return null;_0x4780b6[_0xc078('0x2b')][_0xc078('0x64')]=_0x1d697d;return _0x4780b6;})[_0xc078('0x22')](function(_0x43a143){if(_0x43a143){if(_0x256fc5[_0xc078('0x5b')][_0xc078('0x7a')]){_0x4780b6[_0xc078('0x2b')]['interface']=util['format'](_0xc078('0x7b'),_0x256fc5['user'][_0xc078('0x3b')]);_0x4780b6[_0xc078('0x2b')][_0xc078('0x7c')]=_0x4780b6['channel'];_0x4780b6[_0xc078('0x2b')][_0xc078('0x7d')]=_0x4780b6[_0xc078('0x7c')];_0x4780b6['message'][_0xc078('0x7e')]=_0xc078('0x5f');return respondWithRpcPromise(_0xc078('0x7f'),_0xc078('0x7f'),{'event':'acceptmessage','message':_[_0xc078('0x51')](_0x4780b6['message'],JSON[_0xc078('0x80')](_0x4780b6[_0xc078('0x6a')][_0xc078('0x81')]))},client9002)[_0xc078('0x22')](function(){return _0x4780b6;});}return _0x4780b6;}return null;})[_0xc078('0x22')](respondWithResult(_0x1b5b04,null))[_0xc078('0x55')](handleError(_0x1b5b04,null));};var interaction_log=require(_0xc078('0x17'))('chat-interactions');exports['reject']=function(_0x4a780c,_0x4367c5,_0x510bfd){var _0x3b41f1={'agent':{},'channel':'chat'};if(_0x4a780c['body']['id']){delete _0x4a780c[_0xc078('0x5b')]['id'];}_0x4a780c[_0xc078('0x5b')][_0xc078('0x63')]=_0x4a780c[_0xc078('0x5b')][_0xc078('0x63')]||_0x4a780c['user']['id'];_0x3b41f1['agent']['id']=_0x4a780c[_0xc078('0x5b')]['UserId'];return db[_0xc078('0x3f')][_0xc078('0x59')]({'where':{'id':_0x4a780c[_0xc078('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4367c5,null))[_0xc078('0x22')](function(_0x347d50){if(_0x347d50){_0x3b41f1[_0xc078('0x2b')]=_0x347d50[_0xc078('0x6b')]({'plain':!![]});return db[_0xc078('0x65')][_0xc078('0x59')]({'where':{'id':_0x347d50[_0xc078('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4367c5,null))[_0xc078('0x22')](function(_0x16a3a7){if(_0x16a3a7){_0x3b41f1[_0xc078('0x6a')]=_0x16a3a7['get']({'plain':!![]});interaction_log[_0xc078('0x23')](_0xc078('0x82'),_0x4a780c[_0xc078('0x6d')]['id'],_0x4a780c[_0xc078('0x6d')][_0xc078('0x3b')],_0x4a780c[_0xc078('0x6d')][_0xc078('0x83')],_0x3b41f1[_0xc078('0x6a')]['id'],_0x4a780c['body']?JSON[_0xc078('0x27')](_0x4a780c[_0xc078('0x5b')]):'null');return respondWithRpcPromise(_0xc078('0x84'),'rejectMessage',_0x3b41f1);}return null;})[_0xc078('0x22')](function(_0x3ef92e){var _0x57b2d8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ef92e[_0xc078('0x2b')][_0xc078('0x71')];return db[_0xc078('0x72')]['query'](_0x57b2d8,{'type':db[_0xc078('0x73')][_0xc078('0x74')][_0xc078('0x75')],'raw':!![]})[_0xc078('0x22')](function(_0x4d3bbc){return _0x4d3bbc;});})['then'](function(_0x31e1d7){if(_0x31e1d7){_0x3b41f1[_0xc078('0x2b')][_0xc078('0x76')]=_0x31e1d7[0x0];if(!_0x4a780c['body'][_0xc078('0x63')])return;return db['User'][_0xc078('0x59')]({'where':{'id':_0x4a780c[_0xc078('0x5b')][_0xc078('0x63')],'role':_0xc078('0x64')},'attributes':['id',_0xc078('0x3b'),_0xc078('0x78'),_0xc078('0x85'),_0xc078('0x79')],'raw':!![]});}return null;})[_0xc078('0x22')](function(_0x3914ad){if(!_0x3914ad)return null;_0x3b41f1[_0xc078('0x2b')]['agent']=_0x3914ad;return _0x3b41f1;})[_0xc078('0x22')](function(_0x4e587e){if(_0x4e587e){_0x4e587e[_0xc078('0x2b')]['interface']=util[_0xc078('0x62')](_0xc078('0x7b'),_0x4a780c['user'][_0xc078('0x3b')]);_0x4e587e['message']['channel']=_0x3b41f1[_0xc078('0x7c')];_0x4e587e[_0xc078('0x2b')]['motionChannel']=_0x3b41f1[_0xc078('0x7c')];_0x4e587e[_0xc078('0x2b')][_0xc078('0x7e')]=_0xc078('0x86');respondWithRpcPromise(_0xc078('0x7f'),_0xc078('0x7f'),{'event':_0xc078('0x87'),'message':_[_0xc078('0x51')](_0x3b41f1[_0xc078('0x2b')],JSON['parse'](_0x3b41f1[_0xc078('0x6a')][_0xc078('0x81')]))},client9002);return _0x3b41f1;}return null;})[_0xc078('0x22')](respondWithResult(_0x4367c5,null))[_0xc078('0x55')](handleError(_0x4367c5,null));}; \ No newline at end of file +var _0x8cb3=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','agent','fullname','email','internal','manual','SIP/%s','event','EventManager','acceptmessage','chat','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','channel','motionChannel','rejectmessage','parse','formData','eml-format','rimraf','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','ChatMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','fields','options','create','body','find','describe','chat-interactions','accept','read','format','UserId','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','user','null'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8cb3,0x9b));var _0x38cb=function(_0xaa2acf,_0x232a5b){_0xaa2acf=_0xaa2acf-0x0;var _0x2fc779=_0x8cb3[_0xaa2acf];return _0x2fc779;};'use strict';var emlformat=require(_0x38cb('0x0'));var rimraf=require(_0x38cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38cb('0x2'));var rp=require('request-promise');var moment=require(_0x38cb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x38cb('0x4'));var csv=require(_0x38cb('0x5'));var ejs=require(_0x38cb('0x6'));var fs=require('fs');var fs_extra=require(_0x38cb('0x7'));var _=require(_0x38cb('0x8'));var squel=require(_0x38cb('0x9'));var crypto=require(_0x38cb('0xa'));var jsforce=require(_0x38cb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x38cb('0x5'));var querystring=require(_0x38cb('0xc'));var Papa=require(_0x38cb('0xd'));var Redis=require(_0x38cb('0xe'));var authService=require(_0x38cb('0xf'));var qs=require(_0x38cb('0x10'));var as=require(_0x38cb('0x11'));var hardwareService=require(_0x38cb('0x12'));var logger=require(_0x38cb('0x13'))(_0x38cb('0x14'));var utils=require(_0x38cb('0x15'));var config=require(_0x38cb('0x16'));var licenseUtil=require(_0x38cb('0x17'));var db=require(_0x38cb('0x18'))['db'];config[_0x38cb('0x19')]=_[_0x38cb('0x1a')](config[_0x38cb('0x19')],{'host':_0x38cb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38cb('0x19')]));require(_0x38cb('0x1c'))[_0x38cb('0x1d')](socket);var jayson=require(_0x38cb('0x1e'));var client=jayson[_0x38cb('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x38cb('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc4af2d,_0x22a78a,_0x395802,_0x132201){return new BPromise(function(_0x18a177,_0x687cb3){var _0xf8e7bd=_0x132201||client;return _0xf8e7bd[_0x38cb('0x20')](_0xc4af2d,_0x395802)[_0x38cb('0x21')](function(_0x9d5192){logger[_0x38cb('0x22')](_0x38cb('0x23'),_0x22a78a,_0x38cb('0x24'));logger['debug'](_0x38cb('0x25'),_0x22a78a,'request\x20sent',JSON[_0x38cb('0x26')](_0x9d5192));if(_0x9d5192[_0x38cb('0x27')]){if(_0x9d5192[_0x38cb('0x27')][_0x38cb('0x28')]===0x1f4){logger[_0x38cb('0x27')](_0x38cb('0x23'),_0x22a78a,_0x9d5192[_0x38cb('0x27')][_0x38cb('0x29')]);return _0x687cb3(_0x9d5192['error'][_0x38cb('0x29')]);}logger['error'](_0x38cb('0x23'),_0x22a78a,_0x9d5192['error']['message']);return _0x18a177(_0x9d5192['error'][_0x38cb('0x29')]);}else{logger['info'](_0x38cb('0x23'),_0x22a78a,_0x38cb('0x24'));_0x18a177(_0x9d5192[_0x38cb('0x2a')][_0x38cb('0x29')]);}})[_0x38cb('0x2b')](function(_0x1cf0e8){logger['error'](_0x38cb('0x23'),_0x22a78a,_0x1cf0e8);_0x687cb3(_0x1cf0e8);});});}function respondWithStatusCode(_0x583fcc,_0x23ec32){_0x23ec32=_0x23ec32||0xcc;return function(_0x432aaa){if(_0x432aaa){return _0x583fcc[_0x38cb('0x2c')](_0x23ec32);}return _0x583fcc[_0x38cb('0x2d')](_0x23ec32)['end']();};}function respondWithResult(_0x1ffe8e,_0xa7ae85){_0xa7ae85=_0xa7ae85||0xc8;return function(_0x3a424a){if(_0x3a424a){return _0x1ffe8e[_0x38cb('0x2d')](_0xa7ae85)[_0x38cb('0x2e')](_0x3a424a);}};}function respondWithFilteredResult(_0x5a8091,_0xcbc8bc){return function(_0x5a7827){if(_0x5a7827){var _0x54236d=typeof _0xcbc8bc[_0x38cb('0x2f')]===_0x38cb('0x30')&&typeof _0xcbc8bc[_0x38cb('0x31')]===_0x38cb('0x30');var _0x4bfc94=_0x5a7827['count'];var _0x3440e3=_0x54236d?0x0:_0xcbc8bc[_0x38cb('0x2f')];var _0x5441ad=_0x54236d?_0x5a7827[_0x38cb('0x32')]:_0xcbc8bc[_0x38cb('0x2f')]+_0xcbc8bc['limit'];var _0x53b730;if(_0x5441ad>=_0x4bfc94){_0x5441ad=_0x4bfc94;_0x53b730=0xc8;}else{_0x53b730=0xce;}_0x5a8091[_0x38cb('0x2d')](_0x53b730);return _0x5a8091[_0x38cb('0x33')](_0x38cb('0x34'),_0x3440e3+'-'+_0x5441ad+'/'+_0x4bfc94)[_0x38cb('0x2e')](_0x5a7827);}return null;};}function patchUpdates(_0x2ec630){return function(_0x5c0ce5){try{jsonpatch[_0x38cb('0x35')](_0x5c0ce5,_0x2ec630,!![]);}catch(_0x214c29){return BPromise[_0x38cb('0x36')](_0x214c29);}return _0x5c0ce5[_0x38cb('0x37')]();};}function saveUpdates(_0x4cde66,_0x50fdd1){return function(_0x2d3c4d){if(_0x2d3c4d){return _0x2d3c4d[_0x38cb('0x38')](_0x4cde66)[_0x38cb('0x21')](function(_0x44cd7c){return _0x44cd7c;});}return null;};}function removeEntity(_0x15e4a3,_0x35eede){return function(_0x5e06df){if(_0x5e06df){return _0x5e06df[_0x38cb('0x39')]()['then'](function(){_0x15e4a3[_0x38cb('0x2d')](0xcc)[_0x38cb('0x3a')]();});}};}function handleEntityNotFound(_0x1db2b4,_0x4dc8ec){return function(_0x2a40d5){if(!_0x2a40d5){_0x1db2b4[_0x38cb('0x2c')](0x194);}return _0x2a40d5;};}function handleError(_0x39c736,_0x186ace){_0x186ace=_0x186ace||0x1f4;return function(_0x5b33c2){logger['error'](_0x5b33c2[_0x38cb('0x3b')]);if(_0x5b33c2[_0x38cb('0x3c')]){delete _0x5b33c2['name'];}_0x39c736[_0x38cb('0x2d')](_0x186ace)[_0x38cb('0x3d')](_0x5b33c2);};}exports['index']=function(_0x3bd11d,_0x1d3725){var _0x3d1fa7={},_0xeb7c4f={},_0x5a6923={'count':0x0,'rows':[]};var _0x49ea41=_[_0x38cb('0x3e')](db[_0x38cb('0x3f')][_0x38cb('0x40')],function(_0x175321){return{'name':_0x175321[_0x38cb('0x41')],'type':_0x175321['type'][_0x38cb('0x42')]};});_0xeb7c4f['model']=_[_0x38cb('0x3e')](_0x49ea41,'name');_0xeb7c4f['query']=_[_0x38cb('0x43')](_0x3bd11d[_0x38cb('0x44')]);_0xeb7c4f[_0x38cb('0x45')]=_[_0x38cb('0x46')](_0xeb7c4f['model'],_0xeb7c4f[_0x38cb('0x44')]);_0x3d1fa7[_0x38cb('0x47')]=_[_0x38cb('0x46')](_0xeb7c4f['model'],qs['fields'](_0x3bd11d['query']['fields']));_0x3d1fa7['attributes']=_0x3d1fa7[_0x38cb('0x47')][_0x38cb('0x48')]?_0x3d1fa7[_0x38cb('0x47')]:_0xeb7c4f[_0x38cb('0x49')];if(!_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x4a')](_0x38cb('0x4b'))){_0x3d1fa7[_0x38cb('0x31')]=qs[_0x38cb('0x31')](_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x31')]);_0x3d1fa7[_0x38cb('0x2f')]=qs['offset'](_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x2f')]);}_0x3d1fa7[_0x38cb('0x4c')]=qs[_0x38cb('0x4d')](_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x4d')]);_0x3d1fa7[_0x38cb('0x4e')]=qs[_0x38cb('0x45')](_[_0x38cb('0x4f')](_0x3bd11d['query'],_0xeb7c4f['filters']),_0x49ea41);if(_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x50')]){_0x3d1fa7[_0x38cb('0x4e')]=_[_0x38cb('0x51')](_0x3d1fa7['where'],{'$or':_['map'](_0x49ea41,function(_0x2c3d9e){if(_0x2c3d9e['type']!==_0x38cb('0x52')){var _0x4d3ddc={};_0x4d3ddc[_0x2c3d9e[_0x38cb('0x3c')]]={'$like':'%'+_0x3bd11d[_0x38cb('0x44')]['filter']+'%'};return _0x4d3ddc;}})});}_0x3d1fa7=_[_0x38cb('0x51')]({},_0x3d1fa7,_0x3bd11d['options']);var _0x1427ba={'where':_0x3d1fa7[_0x38cb('0x4e')]};return db[_0x38cb('0x3f')][_0x38cb('0x32')](_0x1427ba)[_0x38cb('0x21')](function(_0x37cf1a){_0x5a6923[_0x38cb('0x32')]=_0x37cf1a;if(_0x3bd11d[_0x38cb('0x44')][_0x38cb('0x53')]){_0x3d1fa7[_0x38cb('0x54')]=[{'all':!![]}];}return db[_0x38cb('0x3f')]['findAll'](_0x3d1fa7);})[_0x38cb('0x21')](function(_0x4d992c){_0x5a6923[_0x38cb('0x55')]=_0x4d992c;return _0x5a6923;})[_0x38cb('0x21')](respondWithFilteredResult(_0x1d3725,_0x3d1fa7))[_0x38cb('0x2b')](handleError(_0x1d3725,null));};exports['show']=function(_0xe535b1,_0x4eaf20){var _0x499a11={'raw':!![],'where':{'id':_0xe535b1[_0x38cb('0x56')]['id']}},_0x28fc37={};_0x28fc37[_0x38cb('0x49')]=_[_0x38cb('0x43')](db[_0x38cb('0x3f')][_0x38cb('0x40')]);_0x28fc37['query']=_[_0x38cb('0x43')](_0xe535b1[_0x38cb('0x44')]);_0x28fc37[_0x38cb('0x45')]=_[_0x38cb('0x46')](_0x28fc37[_0x38cb('0x49')],_0x28fc37['query']);_0x499a11[_0x38cb('0x47')]=_[_0x38cb('0x46')](_0x28fc37[_0x38cb('0x49')],qs['fields'](_0xe535b1[_0x38cb('0x44')][_0x38cb('0x57')]));_0x499a11[_0x38cb('0x47')]=_0x499a11[_0x38cb('0x47')][_0x38cb('0x48')]?_0x499a11[_0x38cb('0x47')]:_0x28fc37['model'];if(_0xe535b1[_0x38cb('0x44')][_0x38cb('0x53')]){_0x499a11['include']=[{'all':!![]}];}_0x499a11=_[_0x38cb('0x51')]({},_0x499a11,_0xe535b1[_0x38cb('0x58')]);return db[_0x38cb('0x3f')]['find'](_0x499a11)['then'](handleEntityNotFound(_0x4eaf20,null))[_0x38cb('0x21')](respondWithResult(_0x4eaf20,null))[_0x38cb('0x2b')](handleError(_0x4eaf20,null));};exports[_0x38cb('0x59')]=function(_0x4231f4,_0xde727e){return db[_0x38cb('0x3f')][_0x38cb('0x59')](_0x4231f4['body'],{})[_0x38cb('0x21')](respondWithResult(_0xde727e,0xc9))[_0x38cb('0x2b')](handleError(_0xde727e,null));};exports[_0x38cb('0x38')]=function(_0x55dadf,_0x2c8b7c){if(_0x55dadf[_0x38cb('0x5a')]['id']){delete _0x55dadf[_0x38cb('0x5a')]['id'];}return db[_0x38cb('0x3f')][_0x38cb('0x5b')]({'where':{'id':_0x55dadf[_0x38cb('0x56')]['id']}})[_0x38cb('0x21')](handleEntityNotFound(_0x2c8b7c,null))[_0x38cb('0x21')](saveUpdates(_0x55dadf[_0x38cb('0x5a')],null))[_0x38cb('0x21')](respondWithResult(_0x2c8b7c,null))[_0x38cb('0x2b')](handleError(_0x2c8b7c,null));};exports[_0x38cb('0x39')]=function(_0xbf14c9,_0x2d43b3){return db[_0x38cb('0x3f')][_0x38cb('0x5b')]({'where':{'id':_0xbf14c9[_0x38cb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d43b3,null))[_0x38cb('0x21')](removeEntity(_0x2d43b3,null))[_0x38cb('0x2b')](handleError(_0x2d43b3,null));};exports['describe']=function(_0x1971d3,_0x29663b){return db[_0x38cb('0x3f')][_0x38cb('0x5c')]()[_0x38cb('0x21')](respondWithResult(_0x29663b,null))[_0x38cb('0x2b')](handleError(_0x29663b,null));};var interaction_log=require(_0x38cb('0x13'))(_0x38cb('0x5d'));exports[_0x38cb('0x5e')]=function(_0x10de35,_0x18e66f,_0x359d2b){var _0x55f884={'agent':{},'channel':'chat'};if(_0x10de35['body']['id']){delete _0x10de35[_0x38cb('0x5a')]['id'];}_0x10de35['body'][_0x38cb('0x5f')]=!![];_0x10de35[_0x38cb('0x5a')]['readAt']=moment()[_0x38cb('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x10de35[_0x38cb('0x5a')]['UserId']=_0x10de35[_0x38cb('0x5a')][_0x38cb('0x61')]||_0x10de35['user']['id'];_0x55f884['agent']['id']=_0x10de35[_0x38cb('0x5a')][_0x38cb('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x10de35[_0x38cb('0x56')]['id'],'UserId':null}})[_0x38cb('0x21')](handleEntityNotFound(_0x18e66f,null))['then'](saveUpdates(_0x10de35['body'],null))[_0x38cb('0x21')](function(_0x3684f1){if(_0x3684f1){_0x55f884['message']=_0x3684f1['get']({'plain':!![]});return db['ChatInteraction'][_0x38cb('0x5b')]({'where':{'id':_0x3684f1[_0x38cb('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x18e66f,null))[_0x38cb('0x21')](function(_0xdb0386){if(_0xdb0386){return _0xdb0386[_0x38cb('0x38')]({'UserId':_0x10de35[_0x38cb('0x5a')]['UserId'],'read1stAt':_['isNil'](_0xdb0386[_0x38cb('0x63')])?moment()[_0x38cb('0x60')](_0x38cb('0x64')):undefined});}return null;})[_0x38cb('0x21')](function(_0x519d5c){if(_0x519d5c){_0x55f884[_0x38cb('0x65')]=_0x519d5c[_0x38cb('0x66')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10de35[_0x38cb('0x67')]['id'],_0x10de35[_0x38cb('0x67')]['name'],_0x10de35[_0x38cb('0x67')]['role'],_0x55f884[_0x38cb('0x65')]['id'],_0x10de35[_0x38cb('0x5a')]?JSON[_0x38cb('0x26')](_0x10de35['body']):_0x38cb('0x68'));return respondWithRpcPromise('AcceptMessage',_0x38cb('0x69'),_0x55f884);}return null;})['then'](function(_0x53e862){var _0x35bf3f=_0x38cb('0x6a')+_0x53e862[_0x38cb('0x29')][_0x38cb('0x6b')];return db[_0x38cb('0x6c')][_0x38cb('0x44')](_0x35bf3f,{'type':db[_0x38cb('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0x38cb('0x21')](function(_0x274b0f){return _0x274b0f;});})[_0x38cb('0x21')](function(_0x4e065a){if(_0x4e065a){_0x55f884[_0x38cb('0x29')][_0x38cb('0x6e')]=_0x4e065a[0x0];if(!_0x10de35[_0x38cb('0x5a')][_0x38cb('0x61')])return;return db[_0x38cb('0x6f')][_0x38cb('0x5b')]({'where':{'id':_0x10de35['body']['UserId'],'role':_0x38cb('0x70')},'attributes':['id',_0x38cb('0x3c'),_0x38cb('0x71'),_0x38cb('0x72'),_0x38cb('0x73')],'raw':!![]});}return null;})['then'](function(_0x55e41c){if(!_0x55e41c)return null;_0x55f884[_0x38cb('0x29')]['agent']=_0x55e41c;return _0x55f884;})[_0x38cb('0x21')](function(_0x114275){if(_0x114275){if(_0x10de35['body'][_0x38cb('0x74')]){_0x55f884[_0x38cb('0x29')]['interface']=util[_0x38cb('0x60')](_0x38cb('0x75'),_0x10de35['user']['name']);_0x55f884[_0x38cb('0x29')]['channel']=_0x55f884['channel'];_0x55f884['message']['motionChannel']=_0x55f884['channel'];_0x55f884['message'][_0x38cb('0x76')]=_0x38cb('0x5e');return respondWithRpcPromise(_0x38cb('0x77'),_0x38cb('0x77'),{'event':_0x38cb('0x78'),'message':_[_0x38cb('0x51')](_0x55f884[_0x38cb('0x29')],JSON['parse'](_0x55f884[_0x38cb('0x65')]['formData']))},client9002)[_0x38cb('0x21')](function(){return _0x55f884;});}return _0x55f884;}return null;})['then'](respondWithResult(_0x18e66f,null))[_0x38cb('0x2b')](handleError(_0x18e66f,null));};var interaction_log=require(_0x38cb('0x13'))(_0x38cb('0x5d'));exports[_0x38cb('0x36')]=function(_0x5b3c10,_0x56d77a,_0x2eb4b2){var _0x16cbfb={'agent':{},'channel':_0x38cb('0x79')};if(_0x5b3c10[_0x38cb('0x5a')]['id']){delete _0x5b3c10['body']['id'];}_0x5b3c10[_0x38cb('0x5a')]['UserId']=_0x5b3c10['body'][_0x38cb('0x61')]||_0x5b3c10['user']['id'];_0x16cbfb[_0x38cb('0x70')]['id']=_0x5b3c10[_0x38cb('0x5a')][_0x38cb('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x5b3c10[_0x38cb('0x56')]['id'],'UserId':null}})[_0x38cb('0x21')](handleEntityNotFound(_0x56d77a,null))[_0x38cb('0x21')](function(_0x26d2a2){if(_0x26d2a2){_0x16cbfb[_0x38cb('0x29')]=_0x26d2a2[_0x38cb('0x66')]({'plain':!![]});return db[_0x38cb('0x7a')][_0x38cb('0x5b')]({'where':{'id':_0x26d2a2[_0x38cb('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x56d77a,null))['then'](function(_0x4469fe){if(_0x4469fe){_0x16cbfb[_0x38cb('0x65')]=_0x4469fe[_0x38cb('0x66')]({'plain':!![]});interaction_log['info'](_0x38cb('0x7b'),_0x5b3c10[_0x38cb('0x67')]['id'],_0x5b3c10['user']['name'],_0x5b3c10[_0x38cb('0x67')]['role'],_0x16cbfb[_0x38cb('0x65')]['id'],_0x5b3c10[_0x38cb('0x5a')]?JSON[_0x38cb('0x26')](_0x5b3c10[_0x38cb('0x5a')]):_0x38cb('0x68'));return respondWithRpcPromise(_0x38cb('0x7c'),'rejectMessage',_0x16cbfb);}return null;})[_0x38cb('0x21')](function(_0x2826a2){var _0x4f016d=_0x38cb('0x6a')+_0x2826a2[_0x38cb('0x29')][_0x38cb('0x6b')];return db[_0x38cb('0x6c')]['query'](_0x4f016d,{'type':db[_0x38cb('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0x38cb('0x21')](function(_0x1c776a){return _0x1c776a;});})[_0x38cb('0x21')](function(_0x5cf224){if(_0x5cf224){_0x16cbfb[_0x38cb('0x29')][_0x38cb('0x6e')]=_0x5cf224[0x0];if(!_0x5b3c10[_0x38cb('0x5a')][_0x38cb('0x61')])return;return db[_0x38cb('0x6f')]['find']({'where':{'id':_0x5b3c10[_0x38cb('0x5a')][_0x38cb('0x61')],'role':_0x38cb('0x70')},'attributes':['id',_0x38cb('0x3c'),'fullname','email',_0x38cb('0x73')],'raw':!![]});}return null;})['then'](function(_0xa0f392){if(!_0xa0f392)return null;_0x16cbfb['message']['agent']=_0xa0f392;return _0x16cbfb;})[_0x38cb('0x21')](function(_0x80be70){if(_0x80be70){_0x80be70[_0x38cb('0x29')]['interface']=util[_0x38cb('0x60')](_0x38cb('0x75'),_0x5b3c10[_0x38cb('0x67')][_0x38cb('0x3c')]);_0x80be70[_0x38cb('0x29')]['channel']=_0x16cbfb[_0x38cb('0x7d')];_0x80be70[_0x38cb('0x29')][_0x38cb('0x7e')]=_0x16cbfb['channel'];_0x80be70[_0x38cb('0x29')]['event']=_0x38cb('0x36');respondWithRpcPromise(_0x38cb('0x77'),_0x38cb('0x77'),{'event':_0x38cb('0x7f'),'message':_['merge'](_0x16cbfb[_0x38cb('0x29')],JSON[_0x38cb('0x80')](_0x16cbfb[_0x38cb('0x65')][_0x38cb('0x81')]))},client9002);return _0x16cbfb;}return null;})['then'](respondWithResult(_0x56d77a,null))['catch'](handleError(_0x56d77a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3c24d91..0252240 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 _0x9f83=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x9f83,0x88));var _0x39f8=function(_0x3fd38e,_0x2af1c8){_0x3fd38e=_0x3fd38e-0x0;var _0xbfa623=_0x9f83[_0x3fd38e];return _0xbfa623;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x39f8('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x39f8('0x1'),'afterUpdate':_0x39f8('0x2'),'afterDestroy':_0x39f8('0x3')};function emitEvent(_0xd17ec6){return function(_0x348d03,_0xe8f372,_0x1490ad){ChatMessageEvents[_0x39f8('0x4')](_0xd17ec6+':'+_0x348d03['id'],_0x348d03);ChatMessageEvents[_0x39f8('0x4')](_0xd17ec6,_0x348d03);_0x1490ad(null);};}for(var e in events){if(events[_0x39f8('0x5')](e)){var event=events[e];ChatMessage[_0x39f8('0x6')](e,emitEvent(event));}}module[_0x39f8('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9c12=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x9c12,0xb9));var _0x29c1=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x9c12[_0x474bc0];return _0x4b24cf;};'use strict';var EventEmitter=require(_0x29c1('0x0'));var ChatMessage=require(_0x29c1('0x1'))['db'][_0x29c1('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x29c1('0x3')](0x0);var events={'afterCreate':_0x29c1('0x4'),'afterUpdate':_0x29c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4142e0){return function(_0x32ebca,_0x50fdd8,_0x5b39f4){ChatMessageEvents[_0x29c1('0x6')](_0x4142e0+':'+_0x32ebca['id'],_0x32ebca);ChatMessageEvents[_0x29c1('0x6')](_0x4142e0,_0x32ebca);_0x5b39f4(null);};}for(var e in events){if(events[_0x29c1('0x7')](e)){var event=events[e];ChatMessage[_0x29c1('0x8')](e,emitEvent(event));}}module[_0x29c1('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9a16ab8..04eeb2f 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 _0x6666=['lodash','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','toLowerCase','out','secret','findOne','then','createdAt','direction','catch','error'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x6666,0x6e));var _0x6666=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x6666[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x6666('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6666('0x1'));var rp=require(_0x6666('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6666('0x3'));var attributes=require(_0x6666('0x4'));module[_0x6666('0x5')]=function(_0x1cf748,_0xfb7053){return _0x1cf748[_0x6666('0x6')](_0x6666('0x7'),attributes,{'tableName':_0x6666('0x8'),'paranoid':![],'indexes':[{'name':_0x6666('0x9'),'fields':['body'],'type':_0x6666('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42ec03,_0x20b6fe,_0x504ee4){var _0x5c74e0=_0x1cf748[_0x6666('0xb')];var _0x5e1ba9=_0x42ec03[_0x6666('0xc')]({'plain':!![]});if(_0x5e1ba9['direction'][_0x6666('0xd')]()==='in'||_0x5e1ba9['direction'][_0x6666('0xd')]()===_0x6666('0xe')&&!_0x5e1ba9[_0x6666('0xf')]&&!_['isNil'](_0x5e1ba9['UserId'])){_0x5c74e0['ChatInteraction'][_0x6666('0x10')]({'where':{'id':_0x5e1ba9['ChatInteractionId']}})[_0x6666('0x11')](function(_0x43e04d){if(_0x43e04d){_0x43e04d['update']({'lastMsgAt':_0x5e1ba9[_0x6666('0x12')],'lastMsgDirection':_0x5e1ba9[_0x6666('0x13')][_0x6666('0xd')]()});}})[_0x6666('0x14')](function(_0x181358){console[_0x6666('0x15')](_0x181358);});}_0x504ee4();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9780=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','fti_chat_messages','body','models','get','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','direction','catch','error','utf8mb4'];(function(_0x560413,_0x31f392){var _0x3c42c2=function(_0x146e5a){while(--_0x146e5a){_0x560413['push'](_0x560413['shift']());}};_0x3c42c2(++_0x31f392);}(_0x9780,0x196));var _0x0978=function(_0x3d064a,_0x12cf18){_0x3d064a=_0x3d064a-0x0;var _0x5b2a83=_0x9780[_0x3d064a];return _0x5b2a83;};'use strict';var _=require(_0x0978('0x0'));var util=require('util');var logger=require(_0x0978('0x1'))(_0x0978('0x2'));var moment=require(_0x0978('0x3'));var BPromise=require(_0x0978('0x4'));var rp=require(_0x0978('0x5'));var fs=require('fs');var path=require(_0x0978('0x6'));var rimraf=require(_0x0978('0x7'));var config=require(_0x0978('0x8'));var attributes=require('./chatMessage.attributes');module[_0x0978('0x9')]=function(_0x309783,_0x3973ef){return _0x309783[_0x0978('0xa')](_0x0978('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x0978('0xc'),'fields':[_0x0978('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4923fa,_0x483e86,_0x172c6d){var _0x5481a2=_0x309783[_0x0978('0xe')];var _0x1d7be9=_0x4923fa[_0x0978('0xf')]({'plain':!![]});if(_0x1d7be9['direction'][_0x0978('0x10')]()==='in'||_0x1d7be9['direction']['toLowerCase']()===_0x0978('0x11')&&!_0x1d7be9[_0x0978('0x12')]&&!_[_0x0978('0x13')](_0x1d7be9[_0x0978('0x14')])){_0x5481a2[_0x0978('0x15')][_0x0978('0x16')]({'where':{'id':_0x1d7be9['ChatInteractionId']}})[_0x0978('0x17')](function(_0x207030){if(_0x207030){_0x207030[_0x0978('0x18')]({'lastMsgAt':_0x1d7be9['createdAt'],'lastMsgDirection':_0x1d7be9[_0x0978('0x19')][_0x0978('0x10')]()});}})[_0x0978('0x1a')](function(_0x5b10e3){console[_0x0978('0x1b')](_0x5b10e3);});}_0x172c6d();}},'charset':_0x0978('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f8bbbcd..c259cfd 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 _0x9375=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','ChatMessage','create','body','options','CreateChatMessage','catch'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x9375,0xf8));var _0x5937=function(_0x54f7b3,_0x4bdf67){_0x54f7b3=_0x54f7b3-0x0;var _0xedb7ad=_0x9375[_0x54f7b3];return _0xedb7ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5937('0x0'));var BPromise=require(_0x5937('0x1'));var rs=require(_0x5937('0x2'));var fs=require('fs');var Redis=require(_0x5937('0x3'));var db=require(_0x5937('0x4'))['db'];var utils=require(_0x5937('0x5'));var logger=require('../../config/logger')(_0x5937('0x6'));var config=require(_0x5937('0x7'));var jayson=require(_0x5937('0x8'));var client=jayson[_0x5937('0x9')]['http']({'port':0x232a});config[_0x5937('0xa')]=_[_0x5937('0xb')](config[_0x5937('0xa')],{'host':_0x5937('0xc'),'port':0x18eb});var socket=require(_0x5937('0xd'))(new Redis(config['redis']));require(_0x5937('0xe'))['register'](socket);function respondWithRpcPromise(_0x30de7b,_0x20f582,_0x18df50){return new BPromise(function(_0x5b94ef,_0x290254){return client[_0x5937('0xf')](_0x30de7b,_0x18df50)[_0x5937('0x10')](function(_0x51abf4){logger['info'](_0x5937('0x11'),_0x20f582,'request\x20sent');logger[_0x5937('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x20f582,_0x5937('0x13'),JSON[_0x5937('0x14')](_0x51abf4));if(_0x51abf4[_0x5937('0x15')]){if(_0x51abf4[_0x5937('0x15')][_0x5937('0x16')]===0x1f4){logger[_0x5937('0x15')](_0x5937('0x11'),_0x20f582,_0x51abf4[_0x5937('0x15')]['message']);return _0x290254(_0x51abf4[_0x5937('0x15')]['message']);}logger['error'](_0x5937('0x11'),_0x20f582,_0x51abf4[_0x5937('0x15')][_0x5937('0x17')]);return _0x5b94ef(_0x51abf4['error'][_0x5937('0x17')]);}else{logger[_0x5937('0x18')](_0x5937('0x11'),_0x20f582,_0x5937('0x13'));_0x5b94ef(_0x51abf4['result']['message']);}})['catch'](function(_0x261c20){logger['error'](_0x5937('0x11'),_0x20f582,_0x261c20);_0x290254(_0x261c20);});});}exports['CreateChatMessage']=function(_0x1f3a4b){var _0x260492=this;return new Promise(function(_0x3af611,_0x1ba307){return db[_0x5937('0x19')][_0x5937('0x1a')](_0x1f3a4b[_0x5937('0x1b')],{'raw':_0x1f3a4b[_0x5937('0x1c')]?_0x1f3a4b[_0x5937('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5937('0x10')](function(_0x3898c0){logger[_0x5937('0x18')](_0x5937('0x1d'),_0x1f3a4b);logger['debug'](_0x5937('0x1d'),_0x1f3a4b,JSON[_0x5937('0x14')](_0x3898c0));_0x3af611(_0x3898c0);})[_0x5937('0x1e')](function(_0x540704){logger[_0x5937('0x15')](_0x5937('0x1d'),_0x540704[_0x5937('0x17')],_0x1f3a4b);_0x1ba307(_0x260492[_0x5937('0x15')](0x1f4,_0x540704[_0x5937('0x17')]));});});}; \ No newline at end of file +var _0x40fa=['catch','ChatMessage','create','body','options','raw','then','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x40fa,0x194));var _0xa40f=function(_0x151e5d,_0x16d4cf){_0x151e5d=_0x151e5d-0x0;var _0x521ae0=_0x40fa[_0x151e5d];return _0x521ae0;};'use strict';var _=require(_0xa40f('0x0'));var util=require(_0xa40f('0x1'));var moment=require(_0xa40f('0x2'));var BPromise=require(_0xa40f('0x3'));var rs=require(_0xa40f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa40f('0x5'))['db'];var utils=require(_0xa40f('0x6'));var logger=require('../../config/logger')(_0xa40f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa40f('0x8')][_0xa40f('0x9')]({'port':0x232a});config[_0xa40f('0xa')]=_[_0xa40f('0xb')](config['redis'],{'host':_0xa40f('0xc'),'port':0x18eb});var socket=require(_0xa40f('0xd'))(new Redis(config[_0xa40f('0xa')]));require('./chatMessage.socket')[_0xa40f('0xe')](socket);function respondWithRpcPromise(_0x2b158b,_0x280e19,_0x5cbe1c){return new BPromise(function(_0x1da4a5,_0x9f397b){return client['request'](_0x2b158b,_0x5cbe1c)['then'](function(_0x47a303){logger[_0xa40f('0xf')](_0xa40f('0x10'),_0x280e19,_0xa40f('0x11'));logger[_0xa40f('0x12')](_0xa40f('0x13'),_0x280e19,_0xa40f('0x11'),JSON[_0xa40f('0x14')](_0x47a303));if(_0x47a303[_0xa40f('0x15')]){if(_0x47a303[_0xa40f('0x15')][_0xa40f('0x16')]===0x1f4){logger['error'](_0xa40f('0x10'),_0x280e19,_0x47a303[_0xa40f('0x15')][_0xa40f('0x17')]);return _0x9f397b(_0x47a303['error'][_0xa40f('0x17')]);}logger[_0xa40f('0x15')](_0xa40f('0x10'),_0x280e19,_0x47a303['error'][_0xa40f('0x17')]);return _0x1da4a5(_0x47a303[_0xa40f('0x15')]['message']);}else{logger[_0xa40f('0xf')](_0xa40f('0x10'),_0x280e19,_0xa40f('0x11'));_0x1da4a5(_0x47a303[_0xa40f('0x18')][_0xa40f('0x17')]);}})[_0xa40f('0x19')](function(_0x4ea0f7){logger[_0xa40f('0x15')]('ChatMessage,\x20%s,\x20%s',_0x280e19,_0x4ea0f7);_0x9f397b(_0x4ea0f7);});});}exports['CreateChatMessage']=function(_0x1966da){var _0x2f35f4=this;return new Promise(function(_0x5646b1,_0x3046d6){return db[_0xa40f('0x1a')][_0xa40f('0x1b')](_0x1966da[_0xa40f('0x1c')],{'raw':_0x1966da['options']?_0x1966da[_0xa40f('0x1d')][_0xa40f('0x1e')]===undefined?!![]:![]:!![]})[_0xa40f('0x1f')](function(_0x1f68b5){logger[_0xa40f('0xf')]('CreateChatMessage',_0x1966da);logger[_0xa40f('0x12')](_0xa40f('0x20'),_0x1966da,JSON[_0xa40f('0x14')](_0x1f68b5));_0x5646b1(_0x1f68b5);})[_0xa40f('0x19')](function(_0x374fe2){logger['error'](_0xa40f('0x20'),_0x374fe2[_0xa40f('0x17')],_0x1966da);_0x3046d6(_0x2f35f4['error'](0x1f4,_0x374fe2[_0xa40f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a72adb8..c269a7e 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 _0x294b=['./chatMessage.events','remove','update','emit','removeListener','register'];(function(_0x116dd7,_0x507e5f){var _0x236795=function(_0x151fda){while(--_0x151fda){_0x116dd7['push'](_0x116dd7['shift']());}};_0x236795(++_0x507e5f);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require(_0xb294('0x0'));var events=['save',_0xb294('0x1'),_0xb294('0x2')];function createListener(_0x3fb36e,_0x411640){return function(_0x1cd458){_0x411640[_0xb294('0x3')](_0x3fb36e,_0x1cd458);};}function removeListener(_0x58fe24,_0x5c0237){return function(){ChatMessageEvents[_0xb294('0x4')](_0x58fe24,_0x5c0237);};}exports[_0xb294('0x5')]=function(_0xaa6a67){for(var _0x181f5e=0x0,_0xcc7910=events['length'];_0x181f5e<_0xcc7910;_0x181f5e++){var _0x39dfbf=events[_0x181f5e];var _0x5110aa=createListener('chatMessage:'+_0x39dfbf,_0xaa6a67);ChatMessageEvents['on'](_0x39dfbf,_0x5110aa);}}; \ No newline at end of file +var _0x44ae=['update','emit','removeListener','register','length','./chatMessage.events','save','remove'];(function(_0x5d4472,_0x352505){var _0x28f6ca=function(_0x2a7342){while(--_0x2a7342){_0x5d4472['push'](_0x5d4472['shift']());}};_0x28f6ca(++_0x352505);}(_0x44ae,0x17d));var _0xe44a=function(_0x5db8e5,_0x35e3d5){_0x5db8e5=_0x5db8e5-0x0;var _0x4f800d=_0x44ae[_0x5db8e5];return _0x4f800d;};'use strict';var ChatMessageEvents=require(_0xe44a('0x0'));var events=[_0xe44a('0x1'),_0xe44a('0x2'),_0xe44a('0x3')];function createListener(_0x5b36d3,_0xfd391f){return function(_0x548b5b){_0xfd391f[_0xe44a('0x4')](_0x5b36d3,_0x548b5b);};}function removeListener(_0x18455c,_0x174a3f){return function(){ChatMessageEvents[_0xe44a('0x5')](_0x18455c,_0x174a3f);};}exports[_0xe44a('0x6')]=function(_0x3f9763){for(var _0x5c1c49=0x0,_0x41a06b=events[_0xe44a('0x7')];_0x5c1c49<_0x41a06b;_0x5c1c49++){var _0x21f98c=events[_0x5c1c49];var _0x202eaf=createListener('chatMessage:'+_0x21f98c,_0x3f9763);ChatMessageEvents['on'](_0x21f98c,_0x202eaf);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0cd4233..8b81bc6 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 _0x6878=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','put','update','/:id/accept','accept'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6878,0x107));var _0x8687=function(_0x4a08cb,_0x4ddb){_0x4a08cb=_0x4a08cb-0x0;var _0x15eed4=_0x6878[_0x4a08cb];return _0x15eed4;};'use strict';var multer=require(_0x8687('0x0'));var util=require(_0x8687('0x1'));var path=require(_0x8687('0x2'));var timeout=require(_0x8687('0x3'));var express=require(_0x8687('0x4'));var router=express[_0x8687('0x5')]();var fs_extra=require(_0x8687('0x6'));var auth=require(_0x8687('0x7'));var interaction=require(_0x8687('0x8'));var config=require(_0x8687('0x9'));var controller=require(_0x8687('0xa'));router[_0x8687('0xb')]('/',auth[_0x8687('0xc')](),controller[_0x8687('0xd')]);router['get'](_0x8687('0xe'),auth[_0x8687('0xc')](),controller['describe']);router[_0x8687('0xb')](_0x8687('0xf'),auth[_0x8687('0xc')](),controller[_0x8687('0x10')]);router[_0x8687('0x11')]('/',auth[_0x8687('0xc')](),interaction[_0x8687('0x12')]('chat','chatmessage:create'),controller['create']);router[_0x8687('0x13')](_0x8687('0xf'),controller[_0x8687('0x14')]);router[_0x8687('0x13')](_0x8687('0x15'),auth['isAuthenticated'](),controller[_0x8687('0x16')]);router[_0x8687('0x13')]('/:id/reject',auth[_0x8687('0xc')](),controller[_0x8687('0x17')]);router[_0x8687('0x18')](_0x8687('0xf'),auth[_0x8687('0xc')](),controller[_0x8687('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb0a3=['put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','chat','chatmessage:create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb0a3,0x1cf));var _0x3b0a=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0xb0a3[_0x582f72];return _0x4cd5fe;};'use strict';var multer=require(_0x3b0a('0x0'));var util=require(_0x3b0a('0x1'));var path=require(_0x3b0a('0x2'));var timeout=require(_0x3b0a('0x3'));var express=require(_0x3b0a('0x4'));var router=express[_0x3b0a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3b0a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b0a('0x7'));var controller=require('./chatMessage.controller');router[_0x3b0a('0x8')]('/',auth[_0x3b0a('0x9')](),controller[_0x3b0a('0xa')]);router['get'](_0x3b0a('0xb'),auth['isAuthenticated'](),controller[_0x3b0a('0xc')]);router[_0x3b0a('0x8')](_0x3b0a('0xd'),auth[_0x3b0a('0x9')](),controller[_0x3b0a('0xe')]);router['post']('/',auth[_0x3b0a('0x9')](),interaction['tracked'](_0x3b0a('0xf'),_0x3b0a('0x10')),controller['create']);router[_0x3b0a('0x11')]('/:id',controller['update']);router['put']('/:id/accept',auth[_0x3b0a('0x9')](),controller[_0x3b0a('0x12')]);router[_0x3b0a('0x11')](_0x3b0a('0x13'),auth['isAuthenticated'](),controller[_0x3b0a('0x14')]);router[_0x3b0a('0x15')](_0x3b0a('0xd'),auth[_0x3b0a('0x9')](),controller[_0x3b0a('0x16')]);module[_0x3b0a('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a7f67e0..4f6431c 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x0b0e[_0xd58823];return _0x249c0a;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x3d957a,_0x13f31f){var _0x31411d=function(_0x360666){while(--_0x360666){_0x3d957a['push'](_0x3d957a['shift']());}};_0x31411d(++_0x13f31f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 44b2233..1408584 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(_0x4ac4fe,_0x22dd2e){var _0x503002=function(_0x131573){while(--_0x131573){_0x4ac4fe['push'](_0x4ac4fe['shift']());}};_0x503002(++_0x22dd2e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7a54,0x106));var _0x47a5=function(_0x418c68,_0x10fabb){_0x418c68=_0x418c68-0x0;var _0x1bb942=_0x7a54[_0x418c68];return _0x1bb942;};'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 4560aca..04ce8b0 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 _0x1f7f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x1f7f,0x1f3));var _0xf1f7=function(_0x5e03fc,_0x1b5ed7){_0x5e03fc=_0x5e03fc-0x0;var _0x116ada=_0x1f7f[_0x5e03fc];return _0x116ada;};'use strict';var EventEmitter=require(_0xf1f7('0x0'));var ChatOfflineMessage=require(_0xf1f7('0x1'))['db'][_0xf1f7('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf1f7('0x3')](0x0);var events={'afterCreate':_0xf1f7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f7453){return function(_0x4d2583,_0x4c0ca9,_0x341c08){ChatOfflineMessageEvents[_0xf1f7('0x5')](_0x2f7453+':'+_0x4d2583['id'],_0x4d2583);ChatOfflineMessageEvents[_0xf1f7('0x5')](_0x2f7453,_0x4d2583);_0x341c08(null);};}for(var e in events){if(events[_0xf1f7('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xf1f7('0x7')](e,emitEvent(event));}}module[_0xf1f7('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc967=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x1d5656,_0x1f05dd){var _0x497334=function(_0x2ea7ed){while(--_0x2ea7ed){_0x1d5656['push'](_0x1d5656['shift']());}};_0x497334(++_0x1f05dd);}(_0xc967,0x1b3));var _0x7c96=function(_0x157b32,_0x1bf456){_0x157b32=_0x157b32-0x0;var _0x41a69b=_0xc967[_0x157b32];return _0x41a69b;};'use strict';var EventEmitter=require(_0x7c96('0x0'));var ChatOfflineMessage=require(_0x7c96('0x1'))['db'][_0x7c96('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7c96('0x3')](0x0);var events={'afterCreate':_0x7c96('0x4'),'afterUpdate':_0x7c96('0x5'),'afterDestroy':'remove'};function emitEvent(_0x518c8f){return function(_0x42508e,_0x37cb3b,_0x578a5d){ChatOfflineMessageEvents[_0x7c96('0x6')](_0x518c8f+':'+_0x42508e['id'],_0x42508e);ChatOfflineMessageEvents[_0x7c96('0x6')](_0x518c8f,_0x42508e);_0x578a5d(null);};}for(var e in events){if(events[_0x7c96('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x7c96('0x8')](e,emitEvent(event));}}module[_0x7c96('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7537347..0192251 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 _0xb38b=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x18fd7a,_0x19b58b){var _0x132313=function(_0x48e56c){while(--_0x48e56c){_0x18fd7a['push'](_0x18fd7a['shift']());}};_0x132313(++_0x19b58b);}(_0xb38b,0x1bb));var _0xbb38=function(_0x583f43,_0x3909ab){_0x583f43=_0x583f43-0x0;var _0x58e3bc=_0xb38b[_0x583f43];return _0x58e3bc;};'use strict';var attributes=require(_0xbb38('0x0'));module[_0xbb38('0x1')]=function(_0x631d70){return _0x631d70[_0xbb38('0x2')](_0xbb38('0x3'),attributes,{'tableName':_0xbb38('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb38('0x5'),'collate':_0xbb38('0x6')});}; \ No newline at end of file +var _0x05fb=['./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x5a9004,_0x2da2a0){var _0x16bf3c=function(_0x3ab40d){while(--_0x3ab40d){_0x5a9004['push'](_0x5a9004['shift']());}};_0x16bf3c(++_0x2da2a0);}(_0x05fb,0x108));var _0xb05f=function(_0x377f7e,_0x5f4b0a){_0x377f7e=_0x377f7e-0x0;var _0xe78077=_0x05fb[_0x377f7e];return _0xe78077;};'use strict';var attributes=require(_0xb05f('0x0'));module[_0xb05f('0x1')]=function(_0x21f13d){return _0x21f13d['define']('ChatOfflineMessage',attributes,{'tableName':_0xb05f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb05f('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 24f2ed3..676bdc0 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 _0x7e81=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4a38c2,_0x503460){var _0x5589d0=function(_0x551992){while(--_0x551992){_0x4a38c2['push'](_0x4a38c2['shift']());}};_0x5589d0(++_0x503460);}(_0x7e81,0xc5));var _0x17e8=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x7e81[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var moment=require(_0x17e8('0x2'));var BPromise=require(_0x17e8('0x3'));var rs=require(_0x17e8('0x4'));var fs=require('fs');var Redis=require(_0x17e8('0x5'));var db=require(_0x17e8('0x6'))['db'];var utils=require(_0x17e8('0x7'));var logger=require(_0x17e8('0x8'))(_0x17e8('0x9'));var config=require('../../config/environment');var jayson=require(_0x17e8('0xa'));var client=jayson[_0x17e8('0xb')][_0x17e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x176238,_0x10454f,_0x574402){return new BPromise(function(_0x54ee7e,_0xdad389){return client[_0x17e8('0xd')](_0x176238,_0x574402)[_0x17e8('0xe')](function(_0x49b142){logger['info'](_0x17e8('0xf'),_0x10454f,_0x17e8('0x10'));logger[_0x17e8('0x11')](_0x17e8('0x12'),_0x10454f,_0x17e8('0x10'),JSON['stringify'](_0x49b142));if(_0x49b142[_0x17e8('0x13')]){if(_0x49b142[_0x17e8('0x13')]['code']===0x1f4){logger[_0x17e8('0x13')](_0x17e8('0xf'),_0x10454f,_0x49b142[_0x17e8('0x13')][_0x17e8('0x14')]);return _0xdad389(_0x49b142[_0x17e8('0x13')][_0x17e8('0x14')]);}logger[_0x17e8('0x13')](_0x17e8('0xf'),_0x10454f,_0x49b142[_0x17e8('0x13')][_0x17e8('0x14')]);return _0x54ee7e(_0x49b142[_0x17e8('0x13')]['message']);}else{logger[_0x17e8('0x15')](_0x17e8('0xf'),_0x10454f,_0x17e8('0x10'));_0x54ee7e(_0x49b142[_0x17e8('0x16')][_0x17e8('0x14')]);}})[_0x17e8('0x17')](function(_0x3956ed){logger[_0x17e8('0x13')](_0x17e8('0xf'),_0x10454f,_0x3956ed);_0xdad389(_0x3956ed);});});} \ No newline at end of file +var _0x2ea5=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent'];(function(_0x4c3a24,_0x1544f2){var _0x1b557a=function(_0x1dd5c7){while(--_0x1dd5c7){_0x4c3a24['push'](_0x4c3a24['shift']());}};_0x1b557a(++_0x1544f2);}(_0x2ea5,0x1c1));var _0x52ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2ea5[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x52ea('0x0'));var util=require(_0x52ea('0x1'));var moment=require(_0x52ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x52ea('0x3'));var fs=require('fs');var Redis=require(_0x52ea('0x4'));var db=require(_0x52ea('0x5'))['db'];var utils=require(_0x52ea('0x6'));var logger=require('../../config/logger')(_0x52ea('0x7'));var config=require(_0x52ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x52ea('0x9')][_0x52ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ce91,_0x1508ba,_0x11aecd){return new BPromise(function(_0x2a372d,_0x11a880){return client['request'](_0x59ce91,_0x11aecd)['then'](function(_0x54cd86){logger[_0x52ea('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1508ba,_0x52ea('0xc'));logger[_0x52ea('0xd')](_0x52ea('0xe'),_0x1508ba,'request\x20sent',JSON[_0x52ea('0xf')](_0x54cd86));if(_0x54cd86[_0x52ea('0x10')]){if(_0x54cd86[_0x52ea('0x10')][_0x52ea('0x11')]===0x1f4){logger[_0x52ea('0x10')](_0x52ea('0x12'),_0x1508ba,_0x54cd86[_0x52ea('0x10')][_0x52ea('0x13')]);return _0x11a880(_0x54cd86[_0x52ea('0x10')][_0x52ea('0x13')]);}logger[_0x52ea('0x10')](_0x52ea('0x12'),_0x1508ba,_0x54cd86[_0x52ea('0x10')][_0x52ea('0x13')]);return _0x2a372d(_0x54cd86[_0x52ea('0x10')][_0x52ea('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1508ba,_0x52ea('0xc'));_0x2a372d(_0x54cd86[_0x52ea('0x14')][_0x52ea('0x13')]);}})['catch'](function(_0x962025){logger['error'](_0x52ea('0x12'),_0x1508ba,_0x962025);_0x11a880(_0x962025);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bd57664..30ef7ff 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 _0x1ced=['./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x1ced,0x1f0));var _0xd1ce=function(_0x36736e,_0x3990bd){_0x36736e=_0x36736e-0x0;var _0x21c162=_0x1ced[_0x36736e];return _0x21c162;};'use strict';var multer=require(_0xd1ce('0x0'));var util=require(_0xd1ce('0x1'));var path=require(_0xd1ce('0x2'));var timeout=require(_0xd1ce('0x3'));var express=require(_0xd1ce('0x4'));var router=express[_0xd1ce('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1ce('0x6'));var interaction=require(_0xd1ce('0x7'));var config=require('../../config/environment');var controller=require(_0xd1ce('0x8'));router[_0xd1ce('0x9')]('/',auth['isAuthenticated'](),controller[_0xd1ce('0xa')]);router[_0xd1ce('0x9')](_0xd1ce('0xb'),auth[_0xd1ce('0xc')](),controller[_0xd1ce('0xd')]);router[_0xd1ce('0x9')]('/:id',auth[_0xd1ce('0xc')](),controller[_0xd1ce('0xe')]);router[_0xd1ce('0xf')]('/',auth[_0xd1ce('0xc')](),controller[_0xd1ce('0x10')]);router[_0xd1ce('0x11')](_0xd1ce('0x12'),auth[_0xd1ce('0xc')](),controller[_0xd1ce('0x13')]);router['delete'](_0xd1ce('0x12'),auth[_0xd1ce('0xc')](),controller[_0xd1ce('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe561=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe561,0x16b));var _0x1e56=function(_0x2a0733,_0x290d2b){_0x2a0733=_0x2a0733-0x0;var _0x15dc3b=_0xe561[_0x2a0733];return _0x15dc3b;};'use strict';var multer=require(_0x1e56('0x0'));var util=require(_0x1e56('0x1'));var path=require(_0x1e56('0x2'));var timeout=require(_0x1e56('0x3'));var express=require(_0x1e56('0x4'));var router=express['Router']();var fs_extra=require(_0x1e56('0x5'));var auth=require(_0x1e56('0x6'));var interaction=require(_0x1e56('0x7'));var config=require('../../config/environment');var controller=require(_0x1e56('0x8'));router[_0x1e56('0x9')]('/',auth[_0x1e56('0xa')](),controller[_0x1e56('0xb')]);router[_0x1e56('0x9')](_0x1e56('0xc'),auth['isAuthenticated'](),controller[_0x1e56('0xd')]);router[_0x1e56('0x9')](_0x1e56('0xe'),auth[_0x1e56('0xa')](),controller[_0x1e56('0xf')]);router[_0x1e56('0x10')]('/',auth[_0x1e56('0xa')](),controller['create']);router[_0x1e56('0x11')](_0x1e56('0xe'),auth[_0x1e56('0xa')](),controller[_0x1e56('0x12')]);router[_0x1e56('0x13')](_0x1e56('0xe'),auth[_0x1e56('0xa')](),controller[_0x1e56('0x14')]);module[_0x1e56('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 0349ec0..f11fa7f 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 _0x94d0=['sequelize','exports','ENUM','timeout','mouseOver','STRING'];(function(_0x198dd8,_0x2511cc){var _0x3adfc4=function(_0x307b8c){while(--_0x307b8c){_0x198dd8['push'](_0x198dd8['shift']());}};_0x3adfc4(++_0x2511cc);}(_0x94d0,0x1e0));var _0x094d=function(_0x48ede2,_0x4e89a5){_0x48ede2=_0x48ede2-0x0;var _0x418800=_0x94d0[_0x48ede2];return _0x418800;};'use strict';var Sequelize=require(_0x094d('0x0'));module[_0x094d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x094d('0x2')]('mouseOver',_0x094d('0x3')),'defaultValue':_0x094d('0x4')},'selector':{'type':Sequelize[_0x094d('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe599=['exports','STRING','ENUM','mouseOver','timeout'];(function(_0x39d481,_0x23c1a2){var _0x3b22d0=function(_0xea81e6){while(--_0xea81e6){_0x39d481['push'](_0x39d481['shift']());}};_0x3b22d0(++_0x23c1a2);}(_0xe599,0x14f));var _0x9e59=function(_0x49a93e,_0x3c52cb){_0x49a93e=_0x49a93e-0x0;var _0x4eb8cd=_0xe599[_0x49a93e];return _0x4eb8cd;};'use strict';var Sequelize=require('sequelize');module[_0x9e59('0x0')]={'name':{'type':Sequelize[_0x9e59('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9e59('0x2')](_0x9e59('0x3'),_0x9e59('0x4')),'defaultValue':_0x9e59('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 83b8d54..f770fe3 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 _0xd847=['sendStatus','status','end','json','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','send','show','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x38c3ea,_0x416e4b){var _0x5bbca1=function(_0x2fcb69){while(--_0x2fcb69){_0x38c3ea['push'](_0x38c3ea['shift']());}};_0x5bbca1(++_0x416e4b);}(_0xd847,0x18a));var _0x7d84=function(_0x397e46,_0xff151b){_0x397e46=_0x397e46-0x0;var _0x234ba9=_0xd847[_0x397e46];return _0x234ba9;};'use strict';var emlformat=require(_0x7d84('0x0'));var rimraf=require(_0x7d84('0x1'));var zipdir=require(_0x7d84('0x2'));var jsonpatch=require(_0x7d84('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d84('0x4'));var Mustache=require(_0x7d84('0x5'));var util=require(_0x7d84('0x6'));var path=require(_0x7d84('0x7'));var sox=require(_0x7d84('0x8'));var csv=require('to-csv');var ejs=require(_0x7d84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d84('0xa'));var squel=require(_0x7d84('0xb'));var crypto=require(_0x7d84('0xc'));var jsforce=require(_0x7d84('0xd'));var deskjs=require(_0x7d84('0xe'));var toCsv=require(_0x7d84('0xf'));var querystring=require('querystring');var Papa=require(_0x7d84('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7d84('0x11'));var as=require(_0x7d84('0x12'));var hardwareService=require(_0x7d84('0x13'));var logger=require(_0x7d84('0x14'))(_0x7d84('0x15'));var utils=require(_0x7d84('0x16'));var config=require(_0x7d84('0x17'));var licenseUtil=require(_0x7d84('0x18'));var db=require(_0x7d84('0x19'))['db'];function respondWithStatusCode(_0x1504f0,_0x2b78c0){_0x2b78c0=_0x2b78c0||0xcc;return function(_0x3647ed){if(_0x3647ed){return _0x1504f0[_0x7d84('0x1a')](_0x2b78c0);}return _0x1504f0[_0x7d84('0x1b')](_0x2b78c0)[_0x7d84('0x1c')]();};}function respondWithResult(_0x36476c,_0x17318f){_0x17318f=_0x17318f||0xc8;return function(_0x637cd6){if(_0x637cd6){return _0x36476c[_0x7d84('0x1b')](_0x17318f)[_0x7d84('0x1d')](_0x637cd6);}};}function respondWithFilteredResult(_0x9263d9,_0x5bce31){return function(_0x1e22ee){if(_0x1e22ee){var _0x35df63=typeof _0x5bce31['offset']==='undefined'&&typeof _0x5bce31['limit']===_0x7d84('0x1e');var _0x193083=_0x1e22ee['count'];var _0x58b71b=_0x35df63?0x0:_0x5bce31['offset'];var _0x50c9b4=_0x35df63?_0x1e22ee[_0x7d84('0x1f')]:_0x5bce31['offset']+_0x5bce31[_0x7d84('0x20')];var _0x2417b7;if(_0x50c9b4>=_0x193083){_0x50c9b4=_0x193083;_0x2417b7=0xc8;}else{_0x2417b7=0xce;}_0x9263d9[_0x7d84('0x1b')](_0x2417b7);return _0x9263d9[_0x7d84('0x21')]('Content-Range',_0x58b71b+'-'+_0x50c9b4+'/'+_0x193083)[_0x7d84('0x1d')](_0x1e22ee);}return null;};}function patchUpdates(_0xea7feb){return function(_0x1af4e2){try{jsonpatch[_0x7d84('0x22')](_0x1af4e2,_0xea7feb,!![]);}catch(_0x1ecc9e){return BPromise[_0x7d84('0x23')](_0x1ecc9e);}return _0x1af4e2[_0x7d84('0x24')]();};}function saveUpdates(_0x14969c,_0x45c6d4){return function(_0x386aa8){if(_0x386aa8){return _0x386aa8[_0x7d84('0x25')](_0x14969c)[_0x7d84('0x26')](function(_0x339ceb){return _0x339ceb;});}return null;};}function removeEntity(_0x352d77,_0x218791){return function(_0x4e6ab8){if(_0x4e6ab8){return _0x4e6ab8[_0x7d84('0x27')]()[_0x7d84('0x26')](function(){_0x352d77[_0x7d84('0x1b')](0xcc)[_0x7d84('0x1c')]();});}};}function handleEntityNotFound(_0x18c42e,_0x129783){return function(_0x5d0994){if(!_0x5d0994){_0x18c42e[_0x7d84('0x1a')](0x194);}return _0x5d0994;};}function handleError(_0xc670d9,_0x46d8f5){_0x46d8f5=_0x46d8f5||0x1f4;return function(_0xfe8284){logger[_0x7d84('0x28')](_0xfe8284['stack']);if(_0xfe8284['name']){delete _0xfe8284['name'];}_0xc670d9[_0x7d84('0x1b')](_0x46d8f5)[_0x7d84('0x29')](_0xfe8284);};}exports[_0x7d84('0x2a')]=function(_0x5319cd,_0xad23f0){var _0x102a48={'raw':!![],'where':{'id':_0x5319cd['params']['id']}},_0x252a68={};_0x252a68['model']=_[_0x7d84('0x2b')](db['ChatProactiveAction'][_0x7d84('0x2c')]);_0x252a68[_0x7d84('0x2d')]=_[_0x7d84('0x2b')](_0x5319cd[_0x7d84('0x2d')]);_0x252a68['filters']=_[_0x7d84('0x2e')](_0x252a68[_0x7d84('0x2f')],_0x252a68['query']);_0x102a48[_0x7d84('0x30')]=_[_0x7d84('0x2e')](_0x252a68[_0x7d84('0x2f')],qs[_0x7d84('0x31')](_0x5319cd[_0x7d84('0x2d')][_0x7d84('0x31')]));_0x102a48[_0x7d84('0x30')]=_0x102a48[_0x7d84('0x30')][_0x7d84('0x32')]?_0x102a48[_0x7d84('0x30')]:_0x252a68[_0x7d84('0x2f')];if(_0x5319cd[_0x7d84('0x2d')][_0x7d84('0x33')]){_0x102a48[_0x7d84('0x34')]=[{'all':!![]}];}_0x102a48=_['merge']({},_0x102a48,_0x5319cd[_0x7d84('0x35')]);return db[_0x7d84('0x36')][_0x7d84('0x37')](_0x102a48)[_0x7d84('0x26')](handleEntityNotFound(_0xad23f0,null))['then'](respondWithResult(_0xad23f0,null))[_0x7d84('0x38')](handleError(_0xad23f0,null));};exports[_0x7d84('0x39')]=function(_0x41a6fb,_0x38b97a){return db[_0x7d84('0x36')][_0x7d84('0x39')](_0x41a6fb[_0x7d84('0x3a')],{})[_0x7d84('0x26')](respondWithResult(_0x38b97a,0xc9))[_0x7d84('0x38')](handleError(_0x38b97a,null));};exports['update']=function(_0x52b3aa,_0x3fc2bb){if(_0x52b3aa[_0x7d84('0x3a')]['id']){delete _0x52b3aa[_0x7d84('0x3a')]['id'];}return db[_0x7d84('0x36')][_0x7d84('0x37')]({'where':{'id':_0x52b3aa[_0x7d84('0x3b')]['id']}})[_0x7d84('0x26')](handleEntityNotFound(_0x3fc2bb,null))[_0x7d84('0x26')](saveUpdates(_0x52b3aa[_0x7d84('0x3a')],null))[_0x7d84('0x26')](respondWithResult(_0x3fc2bb,null))[_0x7d84('0x38')](handleError(_0x3fc2bb,null));};exports[_0x7d84('0x27')]=function(_0x30fafe,_0x184634){return db[_0x7d84('0x36')]['find']({'where':{'id':_0x30fafe['params']['id']}})['then'](handleEntityNotFound(_0x184634,null))[_0x7d84('0x26')](removeEntity(_0x184634,null))[_0x7d84('0x38')](handleError(_0x184634,null));}; \ No newline at end of file +var _0x3c70=['util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x3db1f7,_0x2beb9b){var _0x5016ed=function(_0x344ece){while(--_0x344ece){_0x3db1f7['push'](_0x3db1f7['shift']());}};_0x5016ed(++_0x2beb9b);}(_0x3c70,0x10c));var _0x03c7=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3c70[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x03c7('0x0'));var rimraf=require(_0x03c7('0x1'));var zipdir=require(_0x03c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03c7('0x3'));var moment=require(_0x03c7('0x4'));var BPromise=require(_0x03c7('0x5'));var Mustache=require(_0x03c7('0x6'));var util=require(_0x03c7('0x7'));var path=require(_0x03c7('0x8'));var sox=require('sox');var csv=require(_0x03c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03c7('0xa'));var _=require(_0x03c7('0xb'));var squel=require(_0x03c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x03c7('0xd'));var deskjs=require(_0x03c7('0xe'));var toCsv=require(_0x03c7('0x9'));var querystring=require('querystring');var Papa=require(_0x03c7('0xf'));var Redis=require('ioredis');var authService=require(_0x03c7('0x10'));var qs=require(_0x03c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03c7('0x12'));var logger=require(_0x03c7('0x13'))(_0x03c7('0x14'));var utils=require(_0x03c7('0x15'));var config=require(_0x03c7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe78fd1,_0xb1b40a){_0xb1b40a=_0xb1b40a||0xcc;return function(_0x49697f){if(_0x49697f){return _0xe78fd1[_0x03c7('0x17')](_0xb1b40a);}return _0xe78fd1[_0x03c7('0x18')](_0xb1b40a)[_0x03c7('0x19')]();};}function respondWithResult(_0x2c57af,_0x1d9668){_0x1d9668=_0x1d9668||0xc8;return function(_0x5adce3){if(_0x5adce3){return _0x2c57af[_0x03c7('0x18')](_0x1d9668)['json'](_0x5adce3);}};}function respondWithFilteredResult(_0xdc48a7,_0x1ae657){return function(_0x4e3ff5){if(_0x4e3ff5){var _0x9a3264=typeof _0x1ae657[_0x03c7('0x1a')]===_0x03c7('0x1b')&&typeof _0x1ae657['limit']===_0x03c7('0x1b');var _0x6c852d=_0x4e3ff5[_0x03c7('0x1c')];var _0xdb40cc=_0x9a3264?0x0:_0x1ae657[_0x03c7('0x1a')];var _0x2946d7=_0x9a3264?_0x4e3ff5['count']:_0x1ae657['offset']+_0x1ae657[_0x03c7('0x1d')];var _0x2cd27c;if(_0x2946d7>=_0x6c852d){_0x2946d7=_0x6c852d;_0x2cd27c=0xc8;}else{_0x2cd27c=0xce;}_0xdc48a7[_0x03c7('0x18')](_0x2cd27c);return _0xdc48a7[_0x03c7('0x1e')](_0x03c7('0x1f'),_0xdb40cc+'-'+_0x2946d7+'/'+_0x6c852d)['json'](_0x4e3ff5);}return null;};}function patchUpdates(_0x1e3de1){return function(_0x1e6fae){try{jsonpatch['apply'](_0x1e6fae,_0x1e3de1,!![]);}catch(_0x4e8062){return BPromise['reject'](_0x4e8062);}return _0x1e6fae[_0x03c7('0x20')]();};}function saveUpdates(_0x734b3b,_0x3a5da2){return function(_0x50b316){if(_0x50b316){return _0x50b316[_0x03c7('0x21')](_0x734b3b)[_0x03c7('0x22')](function(_0x3c960a){return _0x3c960a;});}return null;};}function removeEntity(_0x4d6a9c,_0xfa2d9e){return function(_0x4795e7){if(_0x4795e7){return _0x4795e7[_0x03c7('0x23')]()['then'](function(){_0x4d6a9c[_0x03c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270ee3,_0x304337){return function(_0x246f9d){if(!_0x246f9d){_0x270ee3['sendStatus'](0x194);}return _0x246f9d;};}function handleError(_0x3b1cbb,_0x2a4ac4){_0x2a4ac4=_0x2a4ac4||0x1f4;return function(_0x222912){logger[_0x03c7('0x24')](_0x222912['stack']);if(_0x222912['name']){delete _0x222912[_0x03c7('0x25')];}_0x3b1cbb['status'](_0x2a4ac4)[_0x03c7('0x26')](_0x222912);};}exports[_0x03c7('0x27')]=function(_0x51929b,_0x24a331){var _0x462f08={'raw':!![],'where':{'id':_0x51929b[_0x03c7('0x28')]['id']}},_0x153be5={};_0x153be5[_0x03c7('0x29')]=_[_0x03c7('0x2a')](db[_0x03c7('0x2b')][_0x03c7('0x2c')]);_0x153be5[_0x03c7('0x2d')]=_[_0x03c7('0x2a')](_0x51929b[_0x03c7('0x2d')]);_0x153be5['filters']=_[_0x03c7('0x2e')](_0x153be5[_0x03c7('0x29')],_0x153be5[_0x03c7('0x2d')]);_0x462f08['attributes']=_['intersection'](_0x153be5['model'],qs[_0x03c7('0x2f')](_0x51929b['query'][_0x03c7('0x2f')]));_0x462f08[_0x03c7('0x30')]=_0x462f08[_0x03c7('0x30')]['length']?_0x462f08[_0x03c7('0x30')]:_0x153be5[_0x03c7('0x29')];if(_0x51929b[_0x03c7('0x2d')]['includeAll']){_0x462f08[_0x03c7('0x31')]=[{'all':!![]}];}_0x462f08=_[_0x03c7('0x32')]({},_0x462f08,_0x51929b['options']);return db[_0x03c7('0x2b')][_0x03c7('0x33')](_0x462f08)['then'](handleEntityNotFound(_0x24a331,null))[_0x03c7('0x22')](respondWithResult(_0x24a331,null))[_0x03c7('0x34')](handleError(_0x24a331,null));};exports[_0x03c7('0x35')]=function(_0x48a30b,_0x2309de){return db[_0x03c7('0x2b')][_0x03c7('0x35')](_0x48a30b[_0x03c7('0x36')],{})['then'](respondWithResult(_0x2309de,0xc9))[_0x03c7('0x34')](handleError(_0x2309de,null));};exports['update']=function(_0x132c1b,_0xc29c21){if(_0x132c1b[_0x03c7('0x36')]['id']){delete _0x132c1b[_0x03c7('0x36')]['id'];}return db[_0x03c7('0x2b')][_0x03c7('0x33')]({'where':{'id':_0x132c1b['params']['id']}})['then'](handleEntityNotFound(_0xc29c21,null))[_0x03c7('0x22')](saveUpdates(_0x132c1b[_0x03c7('0x36')],null))['then'](respondWithResult(_0xc29c21,null))[_0x03c7('0x34')](handleError(_0xc29c21,null));};exports[_0x03c7('0x23')]=function(_0x346335,_0x7c8ba5){return db[_0x03c7('0x2b')][_0x03c7('0x33')]({'where':{'id':_0x346335[_0x03c7('0x28')]['id']}})['then'](handleEntityNotFound(_0x7c8ba5,null))['then'](removeEntity(_0x7c8ba5,null))[_0x03c7('0x34')](handleError(_0x7c8ba5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7313085..970ae79 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 _0xbf14=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','moment'];(function(_0x6aae29,_0x43bbfd){var _0x4214df=function(_0x4ffa3c){while(--_0x4ffa3c){_0x6aae29['push'](_0x6aae29['shift']());}};_0x4214df(++_0x43bbfd);}(_0xbf14,0xa4));var _0x4bf1=function(_0x1ce0d9,_0x39703d){_0x1ce0d9=_0x1ce0d9-0x0;var _0x31fae9=_0xbf14[_0x1ce0d9];return _0x31fae9;};'use strict';var _=require(_0x4bf1('0x0'));var util=require(_0x4bf1('0x1'));var logger=require(_0x4bf1('0x2'))('api');var moment=require(_0x4bf1('0x3'));var BPromise=require(_0x4bf1('0x4'));var rp=require(_0x4bf1('0x5'));var fs=require('fs');var path=require(_0x4bf1('0x6'));var rimraf=require(_0x4bf1('0x7'));var config=require(_0x4bf1('0x8'));var attributes=require(_0x4bf1('0x9'));module['exports']=function(_0x7d6008,_0x71d9c7){return _0x7d6008[_0x4bf1('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x4bf1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96e4=['api','moment','bluebird','request-promise','path','rimraf','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x216324,_0xfe9722){var _0x156bce=function(_0x53dbce){while(--_0x53dbce){_0x216324['push'](_0x216324['shift']());}};_0x156bce(++_0xfe9722);}(_0x96e4,0x134));var _0x496e=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0x96e4[_0x53a7af];return _0x3cc7f6;};'use strict';var _=require(_0x496e('0x0'));var util=require(_0x496e('0x1'));var logger=require('../../config/logger')(_0x496e('0x2'));var moment=require(_0x496e('0x3'));var BPromise=require(_0x496e('0x4'));var rp=require(_0x496e('0x5'));var fs=require('fs');var path=require(_0x496e('0x6'));var rimraf=require(_0x496e('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x1daef6,_0x522a3d){return _0x1daef6['define'](_0x496e('0x8'),attributes,{'tableName':_0x496e('0x9'),'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 0cff0a5..d057ea9 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 _0x8ba0=['error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x547302,_0x5c1853){var _0x120aa6=function(_0x54de1c){while(--_0x54de1c){_0x547302['push'](_0x547302['shift']());}};_0x120aa6(++_0x5c1853);}(_0x8ba0,0x16c));var _0x08ba=function(_0xf4e2d3,_0x17b606){_0xf4e2d3=_0xf4e2d3-0x0;var _0x2c6891=_0x8ba0[_0xf4e2d3];return _0x2c6891;};'use strict';var _=require(_0x08ba('0x0'));var util=require('util');var moment=require(_0x08ba('0x1'));var BPromise=require(_0x08ba('0x2'));var rs=require(_0x08ba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ba('0x4'))['db'];var utils=require(_0x08ba('0x5'));var logger=require(_0x08ba('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08ba('0x7'));var client=jayson['client'][_0x08ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13a353,_0x2b50b3,_0x1f03e5){return new BPromise(function(_0x56a908,_0x1bd41d){return client[_0x08ba('0x9')](_0x13a353,_0x1f03e5)[_0x08ba('0xa')](function(_0x5d9bc9){logger[_0x08ba('0xb')](_0x08ba('0xc'),_0x2b50b3,_0x08ba('0xd'));logger[_0x08ba('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2b50b3,'request\x20sent',JSON[_0x08ba('0xf')](_0x5d9bc9));if(_0x5d9bc9[_0x08ba('0x10')]){if(_0x5d9bc9[_0x08ba('0x10')][_0x08ba('0x11')]===0x1f4){logger[_0x08ba('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x2b50b3,_0x5d9bc9[_0x08ba('0x10')][_0x08ba('0x12')]);return _0x1bd41d(_0x5d9bc9['error'][_0x08ba('0x12')]);}logger[_0x08ba('0x10')](_0x08ba('0xc'),_0x2b50b3,_0x5d9bc9['error'][_0x08ba('0x12')]);return _0x56a908(_0x5d9bc9['error']['message']);}else{logger[_0x08ba('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x2b50b3,_0x08ba('0xd'));_0x56a908(_0x5d9bc9[_0x08ba('0x13')][_0x08ba('0x12')]);}})['catch'](function(_0x4e9501){logger['error'](_0x08ba('0xc'),_0x2b50b3,_0x4e9501);_0x1bd41d(_0x4e9501);});});} \ No newline at end of file +var _0x9904=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x21caf1,_0x244fff){var _0x814e47=function(_0x11d5d5){while(--_0x11d5d5){_0x21caf1['push'](_0x21caf1['shift']());}};_0x814e47(++_0x244fff);}(_0x9904,0x105));var _0x4990=function(_0x5b1cc1,_0x1c0911){_0x5b1cc1=_0x5b1cc1-0x0;var _0x22734e=_0x9904[_0x5b1cc1];return _0x22734e;};'use strict';var _=require(_0x4990('0x0'));var util=require(_0x4990('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4990('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4990('0x3'))['db'];var utils=require(_0x4990('0x4'));var logger=require(_0x4990('0x5'))(_0x4990('0x6'));var config=require(_0x4990('0x7'));var jayson=require(_0x4990('0x8'));var client=jayson[_0x4990('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11df4f,_0x22d14d,_0x44c0d7){return new BPromise(function(_0x4ce2b1,_0x49db08){return client['request'](_0x11df4f,_0x44c0d7)[_0x4990('0xa')](function(_0x545363){logger['info'](_0x4990('0xb'),_0x22d14d,_0x4990('0xc'));logger['debug'](_0x4990('0xd'),_0x22d14d,_0x4990('0xc'),JSON['stringify'](_0x545363));if(_0x545363['error']){if(_0x545363[_0x4990('0xe')][_0x4990('0xf')]===0x1f4){logger['error'](_0x4990('0xb'),_0x22d14d,_0x545363[_0x4990('0xe')][_0x4990('0x10')]);return _0x49db08(_0x545363['error']['message']);}logger[_0x4990('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x22d14d,_0x545363[_0x4990('0xe')][_0x4990('0x10')]);return _0x4ce2b1(_0x545363[_0x4990('0xe')][_0x4990('0x10')]);}else{logger[_0x4990('0x11')](_0x4990('0xb'),_0x22d14d,'request\x20sent');_0x4ce2b1(_0x545363[_0x4990('0x12')][_0x4990('0x10')]);}})[_0x4990('0x13')](function(_0x4d85c2){logger['error'](_0x4990('0xb'),_0x22d14d,_0x4d85c2);_0x49db08(_0x4d85c2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 716f944..98645e0 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 _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x5bb736,_0x32c198){var _0x483aad=function(_0x426b8e){while(--_0x426b8e){_0x5bb736['push'](_0x5bb736['shift']());}};_0x483aad(++_0x32c198);}(_0x31f0,0xb7));var _0x031f=function(_0x30777d,_0x19478e){_0x30777d=_0x30777d-0x0;var _0x208e01=_0x31f0[_0x30777d];return _0x208e01;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x404c03,_0x3e9bb7){var _0x1b64f6=function(_0x3d1d85){while(--_0x3d1d85){_0x404c03['push'](_0x404c03['shift']());}};_0x1b64f6(++_0x3e9bb7);}(_0x55ca,0x126));var _0xa55c=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x55ca[_0x4fc421];return _0x8c6d63;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 686f3e7..2a65be2 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 _0x9edd=['exports','STRING','name','INTEGER','roundrobin','sequelize'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x9edd,0x8f));var _0xd9ed=function(_0xbd5eb7,_0x132fe2){_0xbd5eb7=_0xbd5eb7-0x0;var _0x297703=_0x9edd[_0xbd5eb7];return _0x297703;};'use strict';var Sequelize=require(_0xd9ed('0x0'));module[_0xd9ed('0x1')]={'name':{'type':Sequelize[_0xd9ed('0x2')],'unique':_0xd9ed('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd9ed('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xd9ed('0x5'))}}; \ No newline at end of file +var _0x88a4=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x255d70,_0x3d86bc){var _0x2b6957=function(_0x52a862){while(--_0x52a862){_0x255d70['push'](_0x255d70['shift']());}};_0x2b6957(++_0x3d86bc);}(_0x88a4,0xf4));var _0x488a=function(_0x295fb3,_0x82aec1){_0x295fb3=_0x295fb3-0x0;var _0x4705bb=_0x88a4[_0x295fb3];return _0x4705bb;};'use strict';var Sequelize=require(_0x488a('0x0'));module['exports']={'name':{'type':Sequelize[_0x488a('0x1')],'unique':_0x488a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x488a('0x1')]},'timeout':{'type':Sequelize[_0x488a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x488a('0x4'),_0x488a('0x5'),_0x488a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7d355d0..a3e695d 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 _0x1de6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','ChatQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserChatQueue','order','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','nolimit','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','transaction','isEmpty','userChatQueue:remove','addAgents','spread','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x3ae1c8,_0x4f1c21){var _0x5a2621=function(_0x4d9dec){while(--_0x4d9dec){_0x3ae1c8['push'](_0x3ae1c8['shift']());}};_0x5a2621(++_0x4f1c21);}(_0x1de6,0x122));var _0x61de=function(_0x40f355,_0x27fac0){_0x40f355=_0x40f355-0x0;var _0x1ebb62=_0x1de6[_0x40f355];return _0x1ebb62;};'use strict';var emlformat=require(_0x61de('0x0'));var rimraf=require(_0x61de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61de('0x2'));var rp=require(_0x61de('0x3'));var moment=require('moment');var BPromise=require(_0x61de('0x4'));var Mustache=require(_0x61de('0x5'));var util=require(_0x61de('0x6'));var path=require('path');var sox=require(_0x61de('0x7'));var csv=require(_0x61de('0x8'));var ejs=require(_0x61de('0x9'));var fs=require('fs');var fs_extra=require(_0x61de('0xa'));var _=require(_0x61de('0xb'));var squel=require('squel');var crypto=require(_0x61de('0xc'));var jsforce=require(_0x61de('0xd'));var deskjs=require(_0x61de('0xe'));var toCsv=require(_0x61de('0x8'));var querystring=require(_0x61de('0xf'));var Papa=require(_0x61de('0x10'));var Redis=require('ioredis');var authService=require(_0x61de('0x11'));var qs=require(_0x61de('0x12'));var as=require(_0x61de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61de('0x14'))(_0x61de('0x15'));var utils=require(_0x61de('0x16'));var config=require(_0x61de('0x17'));var licenseUtil=require(_0x61de('0x18'));var db=require(_0x61de('0x19'))['db'];config[_0x61de('0x1a')]=_[_0x61de('0x1b')](config[_0x61de('0x1a')],{'host':_0x61de('0x1c'),'port':0x18eb});var socket=require(_0x61de('0x1d'))(new Redis(config[_0x61de('0x1a')]));require(_0x61de('0x1e'))[_0x61de('0x1f')](socket);var jayson=require(_0x61de('0x20'));var client=jayson['client'][_0x61de('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x45b8ad,_0x7dbb76,_0xba0030,_0x49f46a){return new BPromise(function(_0x4a5c45,_0xab0f83){var _0x3bd1ca=_0x49f46a||client;return _0x3bd1ca[_0x61de('0x22')](_0x45b8ad,_0xba0030)[_0x61de('0x23')](function(_0x42745f){logger['info'](_0x61de('0x24'),_0x7dbb76,'request\x20sent');logger['debug'](_0x61de('0x25'),_0x7dbb76,'request\x20sent',JSON[_0x61de('0x26')](_0x42745f));if(_0x42745f[_0x61de('0x27')]){if(_0x42745f[_0x61de('0x27')][_0x61de('0x28')]===0x1f4){logger[_0x61de('0x27')]('ChatQueue,\x20%s,\x20%s',_0x7dbb76,_0x42745f[_0x61de('0x27')][_0x61de('0x29')]);return _0xab0f83(_0x42745f[_0x61de('0x27')][_0x61de('0x29')]);}logger[_0x61de('0x27')](_0x61de('0x24'),_0x7dbb76,_0x42745f[_0x61de('0x27')][_0x61de('0x29')]);return _0x4a5c45(_0x42745f[_0x61de('0x27')][_0x61de('0x29')]);}else{logger[_0x61de('0x2a')](_0x61de('0x24'),_0x7dbb76,_0x61de('0x2b'));_0x4a5c45(_0x42745f[_0x61de('0x2c')][_0x61de('0x29')]);}})[_0x61de('0x2d')](function(_0x1b3d96){logger['error']('ChatQueue,\x20%s,\x20%s',_0x7dbb76,_0x1b3d96);_0xab0f83(_0x1b3d96);});});}function respondWithStatusCode(_0x54658a,_0x449353){_0x449353=_0x449353||0xcc;return function(_0x18a7b7){if(_0x18a7b7){return _0x54658a['sendStatus'](_0x449353);}return _0x54658a[_0x61de('0x2e')](_0x449353)[_0x61de('0x2f')]();};}function respondWithResult(_0x5f3cb7,_0x2315f2){_0x2315f2=_0x2315f2||0xc8;return function(_0x4e73b1){if(_0x4e73b1){return _0x5f3cb7[_0x61de('0x2e')](_0x2315f2)[_0x61de('0x30')](_0x4e73b1);}};}function respondWithFilteredResult(_0x4e7986,_0x2efeac){return function(_0x4c6631){if(_0x4c6631){var _0x12098a=typeof _0x2efeac[_0x61de('0x31')]==='undefined'&&typeof _0x2efeac[_0x61de('0x32')]===_0x61de('0x33');var _0x5d2102=_0x4c6631['count'];var _0x251aa0=_0x12098a?0x0:_0x2efeac[_0x61de('0x31')];var _0x1d1570=_0x12098a?_0x4c6631[_0x61de('0x34')]:_0x2efeac['offset']+_0x2efeac[_0x61de('0x32')];var _0x2ed956;if(_0x1d1570>=_0x5d2102){_0x1d1570=_0x5d2102;_0x2ed956=0xc8;}else{_0x2ed956=0xce;}_0x4e7986[_0x61de('0x2e')](_0x2ed956);return _0x4e7986['set'](_0x61de('0x35'),_0x251aa0+'-'+_0x1d1570+'/'+_0x5d2102)[_0x61de('0x30')](_0x4c6631);}return null;};}function patchUpdates(_0x1dd406){return function(_0x2ee0a4){try{jsonpatch[_0x61de('0x36')](_0x2ee0a4,_0x1dd406,!![]);}catch(_0x275f7d){return BPromise[_0x61de('0x37')](_0x275f7d);}return _0x2ee0a4['save']();};}function saveUpdates(_0x26480a,_0x2155fe){return function(_0x329e44){if(_0x329e44){return _0x329e44[_0x61de('0x38')](_0x26480a)[_0x61de('0x23')](function(_0xf478ae){return _0xf478ae;});}return null;};}function removeEntity(_0x3703a5,_0x58cca9){return function(_0x58c316){if(_0x58c316){return _0x58c316['destroy']()[_0x61de('0x23')](function(){var _0x4ef664=_0x58c316['get']({'plain':!![]});var _0x314b1c=_0x61de('0x39');return db[_0x61de('0x3a')][_0x61de('0x3b')]({'where':{'type':_0x314b1c,'resourceId':_0x4ef664['id']}})['then'](function(){return _0x58c316;});})[_0x61de('0x23')](function(){_0x3703a5[_0x61de('0x2e')](0xcc)[_0x61de('0x2f')]();});}};}function handleEntityNotFound(_0x582cac,_0x43d2b8){return function(_0x5eb96b){if(!_0x5eb96b){_0x582cac[_0x61de('0x3c')](0x194);}return _0x5eb96b;};}function handleError(_0x2fbfb9,_0x469fd6){_0x469fd6=_0x469fd6||0x1f4;return function(_0x51dec5){logger['error'](_0x51dec5[_0x61de('0x3d')]);if(_0x51dec5[_0x61de('0x3e')]){delete _0x51dec5[_0x61de('0x3e')];}_0x2fbfb9[_0x61de('0x2e')](_0x469fd6)[_0x61de('0x3f')](_0x51dec5);};}exports[_0x61de('0x40')]=function(_0x4b51de,_0x1a4529){var _0x10011f={},_0x31328b={},_0x59e1e0={'count':0x0,'rows':[]};var _0x325ea5=_['map'](db[_0x61de('0x41')]['rawAttributes'],function(_0x21f3f3){return{'name':_0x21f3f3[_0x61de('0x42')],'type':_0x21f3f3[_0x61de('0x43')][_0x61de('0x44')]};});_0x31328b[_0x61de('0x45')]=_['map'](_0x325ea5,'name');_0x31328b[_0x61de('0x46')]=_[_0x61de('0x47')](_0x4b51de['query']);_0x31328b['filters']=_[_0x61de('0x48')](_0x31328b[_0x61de('0x45')],_0x31328b[_0x61de('0x46')]);_0x10011f[_0x61de('0x49')]=_[_0x61de('0x48')](_0x31328b[_0x61de('0x45')],qs[_0x61de('0x4a')](_0x4b51de[_0x61de('0x46')][_0x61de('0x4a')]));_0x10011f[_0x61de('0x49')]=_0x10011f[_0x61de('0x49')][_0x61de('0x4b')]?_0x10011f[_0x61de('0x49')]:_0x31328b[_0x61de('0x45')];if(!_0x4b51de[_0x61de('0x46')][_0x61de('0x4c')]('nolimit')){_0x10011f[_0x61de('0x32')]=qs[_0x61de('0x32')](_0x4b51de[_0x61de('0x46')][_0x61de('0x32')]);_0x10011f[_0x61de('0x31')]=qs[_0x61de('0x31')](_0x4b51de['query'][_0x61de('0x31')]);}_0x10011f['order']=qs[_0x61de('0x4d')](_0x4b51de[_0x61de('0x46')][_0x61de('0x4d')]);_0x10011f['where']=qs[_0x61de('0x4e')](_[_0x61de('0x4f')](_0x4b51de['query'],_0x31328b[_0x61de('0x4e')]),_0x325ea5);if(_0x4b51de[_0x61de('0x46')][_0x61de('0x50')]){_0x10011f[_0x61de('0x51')]=_[_0x61de('0x52')](_0x10011f['where'],{'$or':_[_0x61de('0x53')](_0x325ea5,function(_0x25f1c8){if(_0x25f1c8[_0x61de('0x43')]!==_0x61de('0x54')){var _0x18cb4a={};_0x18cb4a[_0x25f1c8[_0x61de('0x3e')]]={'$like':'%'+_0x4b51de[_0x61de('0x46')][_0x61de('0x50')]+'%'};return _0x18cb4a;}})});}_0x10011f=_[_0x61de('0x52')]({},_0x10011f,_0x4b51de[_0x61de('0x55')]);var _0x529e30={'where':_0x10011f['where']};return db[_0x61de('0x41')][_0x61de('0x34')](_0x529e30)[_0x61de('0x23')](function(_0x3ae6ad){_0x59e1e0[_0x61de('0x34')]=_0x3ae6ad;if(_0x4b51de[_0x61de('0x46')][_0x61de('0x56')]){_0x10011f[_0x61de('0x57')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x10011f);})['then'](function(_0x5e73fa){_0x59e1e0[_0x61de('0x58')]=_0x5e73fa;return _0x59e1e0;})[_0x61de('0x23')](respondWithFilteredResult(_0x1a4529,_0x10011f))[_0x61de('0x2d')](handleError(_0x1a4529,null));};exports[_0x61de('0x59')]=function(_0x48ab96,_0x2da473){var _0x4b6801={'raw':!![],'where':{'id':_0x48ab96[_0x61de('0x5a')]['id']}},_0x4231f0={};_0x4231f0[_0x61de('0x45')]=_[_0x61de('0x47')](db['ChatQueue'][_0x61de('0x5b')]);_0x4231f0[_0x61de('0x46')]=_[_0x61de('0x47')](_0x48ab96[_0x61de('0x46')]);_0x4231f0[_0x61de('0x4e')]=_[_0x61de('0x48')](_0x4231f0[_0x61de('0x45')],_0x4231f0['query']);_0x4b6801[_0x61de('0x49')]=_['intersection'](_0x4231f0['model'],qs['fields'](_0x48ab96['query'][_0x61de('0x4a')]));_0x4b6801[_0x61de('0x49')]=_0x4b6801[_0x61de('0x49')][_0x61de('0x4b')]?_0x4b6801['attributes']:_0x4231f0[_0x61de('0x45')];if(_0x48ab96[_0x61de('0x46')][_0x61de('0x56')]){_0x4b6801[_0x61de('0x57')]=[{'all':!![]}];}_0x4b6801=_[_0x61de('0x52')]({},_0x4b6801,_0x48ab96[_0x61de('0x55')]);return db['ChatQueue'][_0x61de('0x5c')](_0x4b6801)['then'](handleEntityNotFound(_0x2da473,null))['then'](respondWithResult(_0x2da473,null))[_0x61de('0x2d')](handleError(_0x2da473,null));};exports[_0x61de('0x5d')]=function(_0x912a7f,_0x585cb9){return db[_0x61de('0x41')][_0x61de('0x5d')](_0x912a7f['body'],{})[_0x61de('0x23')](function(_0x18d35e){var _0x1b008f=_0x912a7f[_0x61de('0x5e')][_0x61de('0x5f')]({'plain':!![]});if(!_0x1b008f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b008f[_0x61de('0x60')]===_0x61de('0x5e')){var _0x432bb4=_0x18d35e[_0x61de('0x5f')]({'plain':!![]});var _0xbb2ed1=_0x61de('0x39');return db[_0x61de('0x61')][_0x61de('0x5c')]({'where':{'name':_0xbb2ed1,'userProfileId':_0x1b008f[_0x61de('0x62')]},'raw':!![]})['then'](function(_0x30f0dc){if(_0x30f0dc&&_0x30f0dc[_0x61de('0x63')]===0x0){return db[_0x61de('0x3a')][_0x61de('0x5d')]({'name':_0x432bb4[_0x61de('0x3e')],'resourceId':_0x432bb4['id'],'type':_0x30f0dc[_0x61de('0x3e')],'sectionId':_0x30f0dc['id']},{})[_0x61de('0x23')](function(){return _0x18d35e;});}else{return _0x18d35e;}})[_0x61de('0x2d')](function(_0x4ac78){logger['error'](_0x61de('0x64'),_0x4ac78);throw _0x4ac78;});}return _0x18d35e;})[_0x61de('0x23')](respondWithResult(_0x585cb9,0xc9))[_0x61de('0x2d')](handleError(_0x585cb9,null));};exports[_0x61de('0x38')]=function(_0x1fe2bf,_0x3a216b){if(_0x1fe2bf[_0x61de('0x65')]['id']){delete _0x1fe2bf[_0x61de('0x65')]['id'];}return db['ChatQueue'][_0x61de('0x5c')]({'where':{'id':_0x1fe2bf[_0x61de('0x5a')]['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x3a216b,null))[_0x61de('0x23')](saveUpdates(_0x1fe2bf['body'],null))[_0x61de('0x23')](respondWithResult(_0x3a216b,null))[_0x61de('0x2d')](handleError(_0x3a216b,null));};exports['destroy']=function(_0x72fffb,_0x53fb7f){return db[_0x61de('0x41')][_0x61de('0x5c')]({'where':{'id':_0x72fffb[_0x61de('0x5a')]['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x53fb7f,null))[_0x61de('0x23')](removeEntity(_0x53fb7f,null))[_0x61de('0x2d')](handleError(_0x53fb7f,null));};exports[_0x61de('0x66')]=function(_0x2b9f94,_0x42bb0c){return db[_0x61de('0x41')][_0x61de('0x66')]()['then'](respondWithResult(_0x42bb0c,null))['catch'](handleError(_0x42bb0c,null));};exports['getMembers']=function(_0x54983a,_0x5822b9,_0x2f32aa){var _0x4be358={'raw':!![],'where':{}},_0x2a5e93={},_0x18d199;return db[_0x61de('0x41')][_0x61de('0x67')]({'where':{'id':_0x54983a['params']['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x5822b9,null))[_0x61de('0x23')](function(_0x37f7fc){if(_0x37f7fc){_0x18d199=_0x37f7fc['get']({'plain':!![]});_0x2a5e93[_0x61de('0x45')]=_[_0x61de('0x47')](db[_0x61de('0x68')][_0x61de('0x5b')]);_0x2a5e93[_0x61de('0x46')]=_[_0x61de('0x47')](_0x54983a[_0x61de('0x46')]);_0x2a5e93[_0x61de('0x4e')]=_[_0x61de('0x48')](_0x2a5e93[_0x61de('0x45')],_0x2a5e93[_0x61de('0x46')]);_0x4be358[_0x61de('0x49')]=_[_0x61de('0x48')](_0x2a5e93[_0x61de('0x45')],qs[_0x61de('0x4a')](_0x54983a['query'][_0x61de('0x4a')]));_0x4be358[_0x61de('0x49')]=_0x4be358[_0x61de('0x49')]['length']?_0x4be358[_0x61de('0x49')]:_0x2a5e93[_0x61de('0x45')];if(!_0x54983a[_0x61de('0x46')]['hasOwnProperty']('nolimit')){_0x4be358[_0x61de('0x32')]=qs[_0x61de('0x32')](_0x54983a[_0x61de('0x46')][_0x61de('0x32')]);_0x4be358[_0x61de('0x31')]=qs[_0x61de('0x31')](_0x54983a[_0x61de('0x46')][_0x61de('0x31')]);}_0x4be358[_0x61de('0x69')]=qs[_0x61de('0x4d')](_0x54983a[_0x61de('0x46')][_0x61de('0x4d')]);_0x4be358[_0x61de('0x51')]=qs[_0x61de('0x4e')](_[_0x61de('0x4f')](_0x54983a[_0x61de('0x46')],_0x2a5e93['filters']));_0x4be358[_0x61de('0x51')]['ChatQueueId']=_0x37f7fc['id'];if(_0x54983a['query'][_0x61de('0x50')]){_0x4be358['where']=_['merge'](_0x4be358[_0x61de('0x51')],{'$or':_[_0x61de('0x53')](_0x4be358['attributes'],function(_0x2bc774){var _0x4248f1={};_0x4248f1[_0x2bc774]={'$like':'%'+_0x54983a[_0x61de('0x46')][_0x61de('0x50')]+'%'};return _0x4248f1;})});}_0x4be358=_[_0x61de('0x52')]({},_0x4be358,_0x54983a['options']);return db['UserChatQueue'][_0x61de('0x6a')](_0x4be358);}})[_0x61de('0x23')](function(_0x396a1e){if(_0x396a1e){return db[_0x61de('0x6b')][_0x61de('0x6c')]({'where':{'id':_[_0x61de('0x53')](_0x396a1e,_0x61de('0x6d')),'role':'agent'},'attributes':['id','name','chatPause',_0x61de('0x6e'),_0x61de('0x6f')]});}})[_0x61de('0x23')](function(_0x39bda7){if(_0x39bda7){return{'count':_0x39bda7[_0x61de('0x34')],'rows':_['map'](_0x39bda7[_0x61de('0x58')],function(_0x302a84){return{'membername':_0x302a84['name'],'UserId':_0x302a84['id'],'queue_name':_0x18d199['name'],'ChatQueueId':_0x18d199['id'],'interface':util[_0x61de('0x70')](_0x61de('0x71'),_0x61de('0x72'),_0x302a84[_0x61de('0x3e')]),'penalty':0x0,'paused':_0x302a84[_0x61de('0x73')],'createdAt':_0x302a84['createdAt'],'updatedAt':_0x302a84[_0x61de('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x61de('0x23')](respondWithFilteredResult(_0x5822b9,_0x4be358))[_0x61de('0x2d')](handleError(_0x5822b9,null));};exports[_0x61de('0x74')]=function(_0x15dcbf,_0xaa8a4c,_0x1f0194){var _0x238113={};var _0x2817c9={};var _0x312f60;var _0x2421e6;return db[_0x61de('0x41')][_0x61de('0x67')]({'where':{'id':_0x15dcbf['params']['id']}})[_0x61de('0x23')](handleEntityNotFound(_0xaa8a4c,null))[_0x61de('0x23')](function(_0x54726d){if(_0x54726d){_0x312f60=_0x54726d;_0x2817c9[_0x61de('0x45')]=_[_0x61de('0x47')](db[_0x61de('0x75')][_0x61de('0x5b')]);_0x2817c9[_0x61de('0x46')]=_[_0x61de('0x47')](_0x15dcbf[_0x61de('0x46')]);_0x2817c9[_0x61de('0x4e')]=_[_0x61de('0x48')](_0x2817c9[_0x61de('0x45')],_0x2817c9[_0x61de('0x46')]);_0x238113['attributes']=_['intersection'](_0x2817c9[_0x61de('0x45')],qs[_0x61de('0x4a')](_0x15dcbf[_0x61de('0x46')][_0x61de('0x4a')]));_0x238113[_0x61de('0x49')]=_0x238113['attributes'][_0x61de('0x4b')]?_0x238113[_0x61de('0x49')]:_0x2817c9[_0x61de('0x45')];_0x238113[_0x61de('0x69')]=qs[_0x61de('0x4d')](_0x15dcbf[_0x61de('0x46')][_0x61de('0x4d')]);_0x238113[_0x61de('0x51')]=qs['filters'](_[_0x61de('0x4f')](_0x15dcbf[_0x61de('0x46')],_0x2817c9['filters']));if(_0x15dcbf[_0x61de('0x46')][_0x61de('0x50')]){_0x238113['where']=_[_0x61de('0x52')](_0x238113['where'],{'$or':_['map'](_0x238113[_0x61de('0x49')],function(_0x40d305){var _0x17a0e0={};_0x17a0e0[_0x40d305]={'$like':'%'+_0x15dcbf['query'][_0x61de('0x50')]+'%'};return _0x17a0e0;})});}_0x238113=_[_0x61de('0x52')]({},_0x238113,_0x15dcbf['options']);return _0x312f60['getTeams'](_0x238113);}})[_0x61de('0x23')](function(_0x32f8ba){if(_0x32f8ba){_0x2421e6=_0x32f8ba[_0x61de('0x4b')];if(!_0x15dcbf[_0x61de('0x46')][_0x61de('0x4c')](_0x61de('0x76'))){_0x238113[_0x61de('0x32')]=qs[_0x61de('0x32')](_0x15dcbf['query'][_0x61de('0x32')]);_0x238113[_0x61de('0x31')]=qs[_0x61de('0x31')](_0x15dcbf[_0x61de('0x46')][_0x61de('0x31')]);}return _0x312f60[_0x61de('0x74')](_0x238113);}})['then'](function(_0x22de30){if(_0x22de30){return _0x22de30?{'count':_0x2421e6,'rows':_0x22de30}:null;}})[_0x61de('0x23')](respondWithResult(_0xaa8a4c,null))['catch'](handleError(_0xaa8a4c,null));};exports['addTeams']=function(_0xcafb4c,_0x286ec5,_0x92c61f){var _0x49da3f=_0xcafb4c['body']['ids'];return db[_0x61de('0x75')]['findAll']({'where':{'id':_0x49da3f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x61de('0x77'),'attributes':['id','name','online',_0x61de('0x78'),_0x61de('0x79')],'raw':!![]}]})[_0x61de('0x23')](function(_0x36c073){if(_0x36c073){var _0x4ce13c=_[_0x61de('0x7a')](_0x36c073,function(_0x406084){var _0x1a15d2=_0x406084[_0x61de('0x5f')]({'plain':!![]});return _0x1a15d2['Agents'];});return db['ChatQueue'][_0x61de('0x5c')]({'where':{'id':_0xcafb4c['params']['id']}})['then'](function(_0x2d1d5e){return db[_0x61de('0x7b')]['transaction'](function(_0x2774f1){return _0x2d1d5e[_0x61de('0x7c')](_0x49da3f,{'transaction':_0x2774f1})[_0x61de('0x23')](function(){return BPromise[_0x61de('0x7d')](_0x4ce13c,function(_0x2fba16){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x2fba16['id'],'ChatQueueId':_0xcafb4c[_0x61de('0x5a')]['id']},'transaction':_0x2774f1});});})[_0x61de('0x23')](function(){_0x4ce13c['forEach'](function(_0x1b6f6f){socket[_0x61de('0x7e')](_0x61de('0x7f'),{'UserId':_0x1b6f6f['id'],'ChatQueueId':_0x2d1d5e['id']});});});});});}})[_0x61de('0x23')](respondWithStatusCode(_0x286ec5,null))[_0x61de('0x2d')](handleError(_0x286ec5,null));};exports[_0x61de('0x80')]=function(_0x53dff0,_0x377d95,_0x4798d1){return db['Team'][_0x61de('0x6a')]({'where':{'id':_0x53dff0[_0x61de('0x46')][_0x61de('0x81')]},'attributes':['id'],'include':[{'model':db[_0x61de('0x6b')],'as':_0x61de('0x77'),'attributes':['id'],'raw':!![]}]})[_0x61de('0x23')](handleEntityNotFound(_0x377d95,null))[_0x61de('0x23')](function(_0x6cf14f){var _0x35cc83=_[_0x61de('0x53')](_0x6cf14f,'id');var _0x8ab89a=[];var _0x475702=[];var _0x5c2235=squel[_0x61de('0x82')]();_0x5c2235[_0x61de('0x83')](_0x61de('0x84'))[_0x61de('0x85')](_0x61de('0x86'),'tq')[_0x61de('0x87')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x61de('0x88'),_0x53dff0[_0x61de('0x5a')]['id']);for(var _0x3b5538=0x0;_0x3b5538<_0x6cf14f[_0x61de('0x4b')];_0x3b5538+=0x1){let _0x1c53a0=_0x6cf14f[_0x3b5538];for(var _0x5aa63b=0x0;_0x5aa63b<_0x1c53a0[_0x61de('0x77')][_0x61de('0x4b')];_0x5aa63b+=0x1){let _0x49a127=_0x1c53a0[_0x61de('0x77')][_0x5aa63b];var _0x4d4629=_0x5c2235['clone']();_0x4d4629[_0x61de('0x51')](_0x61de('0x89'),_0x49a127['id']);_0x475702[_0x61de('0x8a')](db[_0x61de('0x7b')]['query'](_0x4d4629[_0x61de('0x8b')](),{'type':db[_0x61de('0x7b')][_0x61de('0x8c')][_0x61de('0x8d')]})['then'](function(_0x25cd59){if(_0x25cd59[_0x61de('0x4b')]===0x1){return _0x49a127['id'];}else{var _0x1ebe8c=_[_0x61de('0x8e')](_[_0x61de('0x53')](_0x25cd59,_0x61de('0x8f')),function(_0x71fb9a){return _[_0x61de('0x90')](_0x35cc83,_0x71fb9a);});if(_0x1ebe8c){return _0x49a127['id'];}}}));}}return BPromise['all'](_0x475702)['then'](function(_0x2056e1){_0x8ab89a=_(_0x8ab89a)['union'](_0x2056e1)[_0x61de('0x91')]()[_0x61de('0x92')]();return db[_0x61de('0x41')][_0x61de('0x5c')]({'where':{'id':_0x53dff0[_0x61de('0x5a')]['id']}})[_0x61de('0x23')](function(_0x54f838){return db[_0x61de('0x7b')][_0x61de('0x93')](function(_0x42ee09){return _0x54f838['removeTeams'](_0x53dff0[_0x61de('0x46')][_0x61de('0x81')],{'transaction':_0x42ee09})[_0x61de('0x23')](function(){if(!_[_0x61de('0x94')](_0x8ab89a)){return _0x54f838['removeAgents'](_0x8ab89a,{'transaction':_0x42ee09});}})[_0x61de('0x23')](function(){_0x8ab89a['forEach'](function(_0x5238e0){socket[_0x61de('0x7e')](_0x61de('0x95'),{'UserId':_0x5238e0,'ChatQueueId':_0x54f838['id']});});});});});});})['then'](respondWithStatusCode(_0x377d95,null))['catch'](handleError(_0x377d95,null));};exports[_0x61de('0x96')]=function(_0x27ec39,_0x140103,_0x3112c4){return db[_0x61de('0x41')]['find']({'where':{'id':_0x27ec39[_0x61de('0x5a')]['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x140103,null))[_0x61de('0x23')](function(_0x2e86fd){if(_0x2e86fd){return _0x2e86fd[_0x61de('0x96')](_0x27ec39[_0x61de('0x65')][_0x61de('0x81')],_['omit'](_0x27ec39[_0x61de('0x65')],[_0x61de('0x81'),'id'])||{})[_0x61de('0x97')](function(_0x4a3611){for(var _0x76d8a0=0x0;_0x76d8a0<_0x27ec39[_0x61de('0x65')][_0x61de('0x81')]['length'];_0x76d8a0+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x27ec39[_0x61de('0x65')]['ids'][_0x76d8a0]),'ChatQueueId':Number(_0x27ec39[_0x61de('0x5a')]['id'])});}return _0x4a3611;});}})[_0x61de('0x23')](respondWithResult(_0x140103,null))['catch'](handleError(_0x140103,null));};exports[_0x61de('0x98')]=function(_0x2b6589,_0x4d609a,_0x4f0032){return db[_0x61de('0x41')][_0x61de('0x5c')]({'where':{'id':_0x2b6589['params']['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x4d609a,null))[_0x61de('0x23')](function(_0x5cb601){if(_0x5cb601){return _0x5cb601[_0x61de('0x98')](_0x2b6589[_0x61de('0x46')][_0x61de('0x81')])['then'](function(){if(_['isArray'](_0x2b6589[_0x61de('0x46')][_0x61de('0x81')])){for(var _0x30cb62=0x0;_0x30cb62<_0x2b6589[_0x61de('0x46')][_0x61de('0x81')][_0x61de('0x4b')];_0x30cb62+=0x1){socket[_0x61de('0x7e')]('userChatQueue:remove',{'UserId':Number(_0x2b6589[_0x61de('0x46')][_0x61de('0x81')][_0x30cb62]),'ChatQueueId':Number(_0x2b6589[_0x61de('0x5a')]['id'])});}}else{socket['emit'](_0x61de('0x95'),{'UserId':Number(_0x2b6589[_0x61de('0x46')]['ids']),'ChatQueueId':Number(_0x2b6589[_0x61de('0x5a')]['id'])});}});}})[_0x61de('0x23')](respondWithStatusCode(_0x4d609a,null))[_0x61de('0x2d')](handleError(_0x4d609a,null));};exports[_0x61de('0x99')]=function(_0x46fa61,_0x37ce36,_0x58ce6c){var _0x259045={};var _0x156679={};var _0x8bba6c;var _0x2de22f;return db[_0x61de('0x41')][_0x61de('0x67')]({'where':{'id':_0x46fa61[_0x61de('0x5a')]['id']}})[_0x61de('0x23')](handleEntityNotFound(_0x37ce36,null))[_0x61de('0x23')](function(_0x2b1839){if(_0x2b1839){_0x8bba6c=_0x2b1839;_0x156679['model']=_[_0x61de('0x47')](db[_0x61de('0x6b')]['rawAttributes']);_0x156679['query']=_[_0x61de('0x47')](_0x46fa61[_0x61de('0x46')]);_0x156679[_0x61de('0x4e')]=_[_0x61de('0x48')](_0x156679[_0x61de('0x45')],_0x156679[_0x61de('0x46')]);_0x259045['attributes']=_['intersection'](_0x156679[_0x61de('0x45')],qs[_0x61de('0x4a')](_0x46fa61[_0x61de('0x46')]['fields']));_0x259045['attributes']=_0x259045[_0x61de('0x49')][_0x61de('0x4b')]?_0x259045['attributes']:_0x156679[_0x61de('0x45')];_0x259045[_0x61de('0x69')]=qs[_0x61de('0x4d')](_0x46fa61[_0x61de('0x46')][_0x61de('0x4d')]);_0x259045['where']=qs['filters'](_[_0x61de('0x4f')](_0x46fa61[_0x61de('0x46')],_0x156679['filters']));if(_0x46fa61['query'][_0x61de('0x50')]){_0x259045[_0x61de('0x51')]=_['merge'](_0x259045[_0x61de('0x51')],{'$or':_[_0x61de('0x53')](_0x259045[_0x61de('0x49')],function(_0x4126e3){var _0x3df8dc={};_0x3df8dc[_0x4126e3]={'$like':'%'+_0x46fa61['query'][_0x61de('0x50')]+'%'};return _0x3df8dc;})});}_0x259045=_['merge']({},_0x259045,_0x46fa61[_0x61de('0x55')]);return _0x8bba6c[_0x61de('0x99')](_0x259045);}})[_0x61de('0x23')](function(_0x467a97){if(_0x467a97){_0x2de22f=_0x467a97[_0x61de('0x4b')];if(!_0x46fa61['query']['hasOwnProperty']('nolimit')){_0x259045['limit']=qs[_0x61de('0x32')](_0x46fa61[_0x61de('0x46')][_0x61de('0x32')]);_0x259045[_0x61de('0x31')]=qs[_0x61de('0x31')](_0x46fa61[_0x61de('0x46')][_0x61de('0x31')]);}return _0x8bba6c[_0x61de('0x99')](_0x259045);}})[_0x61de('0x23')](function(_0x26a339){if(_0x26a339){return _0x26a339?{'count':_0x2de22f,'rows':_0x26a339}:null;}})['then'](respondWithResult(_0x37ce36,null))['catch'](handleError(_0x37ce36,null));}; \ No newline at end of file +var _0x65bb=['emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ChatQueues','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','pick','ChatQueueId','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach'];(function(_0x746739,_0x289561){var _0x4b7447=function(_0x3435f2){while(--_0x3435f2){_0x746739['push'](_0x746739['shift']());}};_0x4b7447(++_0x289561);}(_0x65bb,0x1df));var _0xb65b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x65bb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb65b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb65b('0x1'));var moment=require(_0xb65b('0x2'));var BPromise=require(_0xb65b('0x3'));var Mustache=require(_0xb65b('0x4'));var util=require(_0xb65b('0x5'));var path=require(_0xb65b('0x6'));var sox=require(_0xb65b('0x7'));var csv=require('to-csv');var ejs=require(_0xb65b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb65b('0x9'));var squel=require('squel');var crypto=require(_0xb65b('0xa'));var jsforce=require(_0xb65b('0xb'));var deskjs=require(_0xb65b('0xc'));var toCsv=require(_0xb65b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb65b('0xe'));var authService=require(_0xb65b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb65b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb65b('0x11'));var utils=require(_0xb65b('0x12'));var config=require(_0xb65b('0x13'));var licenseUtil=require(_0xb65b('0x14'));var db=require(_0xb65b('0x15'))['db'];config['redis']=_[_0xb65b('0x16')](config[_0xb65b('0x17')],{'host':_0xb65b('0x18'),'port':0x18eb});var socket=require(_0xb65b('0x19'))(new Redis(config['redis']));require(_0xb65b('0x1a'))[_0xb65b('0x1b')](socket);var jayson=require(_0xb65b('0x1c'));var client=jayson[_0xb65b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44ec0a,_0x320540,_0x2f923b,_0x55c4b6){return new BPromise(function(_0x2e0541,_0x2a8726){var _0x6a9bce=_0x55c4b6||client;return _0x6a9bce[_0xb65b('0x1e')](_0x44ec0a,_0x2f923b)['then'](function(_0x1f0460){logger['info'](_0xb65b('0x1f'),_0x320540,_0xb65b('0x20'));logger[_0xb65b('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x320540,'request\x20sent',JSON[_0xb65b('0x22')](_0x1f0460));if(_0x1f0460['error']){if(_0x1f0460[_0xb65b('0x23')][_0xb65b('0x24')]===0x1f4){logger[_0xb65b('0x23')](_0xb65b('0x1f'),_0x320540,_0x1f0460['error']['message']);return _0x2a8726(_0x1f0460[_0xb65b('0x23')][_0xb65b('0x25')]);}logger[_0xb65b('0x23')](_0xb65b('0x1f'),_0x320540,_0x1f0460[_0xb65b('0x23')][_0xb65b('0x25')]);return _0x2e0541(_0x1f0460[_0xb65b('0x23')]['message']);}else{logger[_0xb65b('0x26')]('ChatQueue,\x20%s,\x20%s',_0x320540,'request\x20sent');_0x2e0541(_0x1f0460[_0xb65b('0x27')][_0xb65b('0x25')]);}})[_0xb65b('0x28')](function(_0x2a575e){logger[_0xb65b('0x23')]('ChatQueue,\x20%s,\x20%s',_0x320540,_0x2a575e);_0x2a8726(_0x2a575e);});});}function respondWithStatusCode(_0x243d54,_0x35dc14){_0x35dc14=_0x35dc14||0xcc;return function(_0x1c868d){if(_0x1c868d){return _0x243d54['sendStatus'](_0x35dc14);}return _0x243d54[_0xb65b('0x29')](_0x35dc14)[_0xb65b('0x2a')]();};}function respondWithResult(_0x585e27,_0x64ffcb){_0x64ffcb=_0x64ffcb||0xc8;return function(_0x4f2018){if(_0x4f2018){return _0x585e27[_0xb65b('0x29')](_0x64ffcb)[_0xb65b('0x2b')](_0x4f2018);}};}function respondWithFilteredResult(_0x47d7e0,_0x2d79e8){return function(_0x212a93){if(_0x212a93){var _0x414bf3=typeof _0x2d79e8['offset']===_0xb65b('0x2c')&&typeof _0x2d79e8[_0xb65b('0x2d')]===_0xb65b('0x2c');var _0x526563=_0x212a93[_0xb65b('0x2e')];var _0x668134=_0x414bf3?0x0:_0x2d79e8[_0xb65b('0x2f')];var _0x6fbffc=_0x414bf3?_0x212a93['count']:_0x2d79e8['offset']+_0x2d79e8['limit'];var _0x488958;if(_0x6fbffc>=_0x526563){_0x6fbffc=_0x526563;_0x488958=0xc8;}else{_0x488958=0xce;}_0x47d7e0['status'](_0x488958);return _0x47d7e0[_0xb65b('0x30')](_0xb65b('0x31'),_0x668134+'-'+_0x6fbffc+'/'+_0x526563)['json'](_0x212a93);}return null;};}function patchUpdates(_0x4e996c){return function(_0x578938){try{jsonpatch[_0xb65b('0x32')](_0x578938,_0x4e996c,!![]);}catch(_0x397389){return BPromise[_0xb65b('0x33')](_0x397389);}return _0x578938[_0xb65b('0x34')]();};}function saveUpdates(_0x539d25,_0x50ca31){return function(_0x2d1474){if(_0x2d1474){return _0x2d1474['update'](_0x539d25)[_0xb65b('0x35')](function(_0x3b93e1){return _0x3b93e1;});}return null;};}function removeEntity(_0x490259,_0x19beb2){return function(_0x281aa8){if(_0x281aa8){return _0x281aa8[_0xb65b('0x36')]()[_0xb65b('0x35')](function(){var _0x3aaf13=_0x281aa8[_0xb65b('0x37')]({'plain':!![]});var _0x529aed=_0xb65b('0x38');return db['UserProfileResource'][_0xb65b('0x36')]({'where':{'type':_0x529aed,'resourceId':_0x3aaf13['id']}})[_0xb65b('0x35')](function(){return _0x281aa8;});})['then'](function(){_0x490259['status'](0xcc)[_0xb65b('0x2a')]();});}};}function handleEntityNotFound(_0x30f9fc,_0x1dd7d7){return function(_0x1acccb){if(!_0x1acccb){_0x30f9fc[_0xb65b('0x39')](0x194);}return _0x1acccb;};}function handleError(_0x16cddb,_0xaf677c){_0xaf677c=_0xaf677c||0x1f4;return function(_0x26b442){logger[_0xb65b('0x23')](_0x26b442[_0xb65b('0x3a')]);if(_0x26b442[_0xb65b('0x3b')]){delete _0x26b442[_0xb65b('0x3b')];}_0x16cddb['status'](_0xaf677c)[_0xb65b('0x3c')](_0x26b442);};}exports[_0xb65b('0x3d')]=function(_0xb4bb20,_0x28a769){var _0x2336a9={},_0x2b31d7={},_0x387b77={'count':0x0,'rows':[]};var _0x5b2611=_[_0xb65b('0x3e')](db[_0xb65b('0x3f')][_0xb65b('0x40')],function(_0x59da20){return{'name':_0x59da20['fieldName'],'type':_0x59da20[_0xb65b('0x41')][_0xb65b('0x42')]};});_0x2b31d7[_0xb65b('0x43')]=_[_0xb65b('0x3e')](_0x5b2611,_0xb65b('0x3b'));_0x2b31d7['query']=_[_0xb65b('0x44')](_0xb4bb20[_0xb65b('0x45')]);_0x2b31d7[_0xb65b('0x46')]=_[_0xb65b('0x47')](_0x2b31d7[_0xb65b('0x43')],_0x2b31d7['query']);_0x2336a9[_0xb65b('0x48')]=_[_0xb65b('0x47')](_0x2b31d7[_0xb65b('0x43')],qs[_0xb65b('0x49')](_0xb4bb20[_0xb65b('0x45')]['fields']));_0x2336a9[_0xb65b('0x48')]=_0x2336a9[_0xb65b('0x48')][_0xb65b('0x4a')]?_0x2336a9['attributes']:_0x2b31d7[_0xb65b('0x43')];if(!_0xb4bb20[_0xb65b('0x45')]['hasOwnProperty'](_0xb65b('0x4b'))){_0x2336a9[_0xb65b('0x2d')]=qs[_0xb65b('0x2d')](_0xb4bb20[_0xb65b('0x45')][_0xb65b('0x2d')]);_0x2336a9[_0xb65b('0x2f')]=qs[_0xb65b('0x2f')](_0xb4bb20[_0xb65b('0x45')]['offset']);}_0x2336a9[_0xb65b('0x4c')]=qs[_0xb65b('0x4d')](_0xb4bb20['query']['sort']);_0x2336a9[_0xb65b('0x4e')]=qs[_0xb65b('0x46')](_['pick'](_0xb4bb20[_0xb65b('0x45')],_0x2b31d7['filters']),_0x5b2611);if(_0xb4bb20[_0xb65b('0x45')][_0xb65b('0x4f')]){_0x2336a9[_0xb65b('0x4e')]=_[_0xb65b('0x50')](_0x2336a9['where'],{'$or':_[_0xb65b('0x3e')](_0x5b2611,function(_0xf0bca6){if(_0xf0bca6['type']!=='VIRTUAL'){var _0xef72c5={};_0xef72c5[_0xf0bca6[_0xb65b('0x3b')]]={'$like':'%'+_0xb4bb20[_0xb65b('0x45')][_0xb65b('0x4f')]+'%'};return _0xef72c5;}})});}_0x2336a9=_[_0xb65b('0x50')]({},_0x2336a9,_0xb4bb20[_0xb65b('0x51')]);var _0x162a04={'where':_0x2336a9[_0xb65b('0x4e')]};return db[_0xb65b('0x3f')][_0xb65b('0x2e')](_0x162a04)[_0xb65b('0x35')](function(_0x38fda0){_0x387b77[_0xb65b('0x2e')]=_0x38fda0;if(_0xb4bb20[_0xb65b('0x45')][_0xb65b('0x52')]){_0x2336a9['include']=[{'all':!![]}];}return db[_0xb65b('0x3f')][_0xb65b('0x53')](_0x2336a9);})[_0xb65b('0x35')](function(_0x30d2aa){_0x387b77['rows']=_0x30d2aa;return _0x387b77;})['then'](respondWithFilteredResult(_0x28a769,_0x2336a9))['catch'](handleError(_0x28a769,null));};exports[_0xb65b('0x54')]=function(_0x2f0570,_0x485120){var _0x10a0e4={'raw':!![],'where':{'id':_0x2f0570[_0xb65b('0x55')]['id']}},_0x36fc0d={};_0x36fc0d[_0xb65b('0x43')]=_[_0xb65b('0x44')](db['ChatQueue'][_0xb65b('0x40')]);_0x36fc0d['query']=_[_0xb65b('0x44')](_0x2f0570[_0xb65b('0x45')]);_0x36fc0d['filters']=_[_0xb65b('0x47')](_0x36fc0d['model'],_0x36fc0d[_0xb65b('0x45')]);_0x10a0e4['attributes']=_[_0xb65b('0x47')](_0x36fc0d['model'],qs[_0xb65b('0x49')](_0x2f0570[_0xb65b('0x45')][_0xb65b('0x49')]));_0x10a0e4[_0xb65b('0x48')]=_0x10a0e4[_0xb65b('0x48')]['length']?_0x10a0e4[_0xb65b('0x48')]:_0x36fc0d[_0xb65b('0x43')];if(_0x2f0570['query'][_0xb65b('0x52')]){_0x10a0e4[_0xb65b('0x56')]=[{'all':!![]}];}_0x10a0e4=_[_0xb65b('0x50')]({},_0x10a0e4,_0x2f0570[_0xb65b('0x51')]);return db[_0xb65b('0x3f')][_0xb65b('0x57')](_0x10a0e4)[_0xb65b('0x35')](handleEntityNotFound(_0x485120,null))[_0xb65b('0x35')](respondWithResult(_0x485120,null))[_0xb65b('0x28')](handleError(_0x485120,null));};exports[_0xb65b('0x58')]=function(_0x57255f,_0x3d9d22){return db[_0xb65b('0x3f')][_0xb65b('0x58')](_0x57255f['body'],{})[_0xb65b('0x35')](function(_0x310f11){var _0x3d0024=_0x57255f[_0xb65b('0x59')]['get']({'plain':!![]});if(!_0x3d0024)throw new Error(_0xb65b('0x5a'));if(_0x3d0024[_0xb65b('0x5b')]===_0xb65b('0x59')){var _0x354684=_0x310f11[_0xb65b('0x37')]({'plain':!![]});var _0x1372b5='ChatQueues';return db[_0xb65b('0x5c')]['find']({'where':{'name':_0x1372b5,'userProfileId':_0x3d0024['userProfileId']},'raw':!![]})[_0xb65b('0x35')](function(_0x1a203c){if(_0x1a203c&&_0x1a203c[_0xb65b('0x5d')]===0x0){return db[_0xb65b('0x5e')][_0xb65b('0x58')]({'name':_0x354684[_0xb65b('0x3b')],'resourceId':_0x354684['id'],'type':_0x1a203c[_0xb65b('0x3b')],'sectionId':_0x1a203c['id']},{})[_0xb65b('0x35')](function(){return _0x310f11;});}else{return _0x310f11;}})[_0xb65b('0x28')](function(_0x1ba394){logger[_0xb65b('0x23')](_0xb65b('0x5f'),_0x1ba394);throw _0x1ba394;});}return _0x310f11;})[_0xb65b('0x35')](respondWithResult(_0x3d9d22,0xc9))[_0xb65b('0x28')](handleError(_0x3d9d22,null));};exports[_0xb65b('0x60')]=function(_0x9f085d,_0x29ff27){if(_0x9f085d[_0xb65b('0x61')]['id']){delete _0x9f085d['body']['id'];}return db[_0xb65b('0x3f')]['find']({'where':{'id':_0x9f085d[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](handleEntityNotFound(_0x29ff27,null))[_0xb65b('0x35')](saveUpdates(_0x9f085d[_0xb65b('0x61')],null))[_0xb65b('0x35')](respondWithResult(_0x29ff27,null))['catch'](handleError(_0x29ff27,null));};exports[_0xb65b('0x36')]=function(_0x5d90ef,_0x13990b){return db['ChatQueue'][_0xb65b('0x57')]({'where':{'id':_0x5d90ef['params']['id']}})['then'](handleEntityNotFound(_0x13990b,null))[_0xb65b('0x35')](removeEntity(_0x13990b,null))['catch'](handleError(_0x13990b,null));};exports[_0xb65b('0x62')]=function(_0x12a8c2,_0x2129ec){return db[_0xb65b('0x3f')][_0xb65b('0x62')]()[_0xb65b('0x35')](respondWithResult(_0x2129ec,null))[_0xb65b('0x28')](handleError(_0x2129ec,null));};exports['getMembers']=function(_0x4f6e07,_0x206dad,_0x4453c8){var _0x4bf843={'raw':!![],'where':{}},_0x3c5cb3={},_0xf323e4;return db[_0xb65b('0x3f')][_0xb65b('0x63')]({'where':{'id':_0x4f6e07[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](handleEntityNotFound(_0x206dad,null))[_0xb65b('0x35')](function(_0x5e08cf){if(_0x5e08cf){_0xf323e4=_0x5e08cf[_0xb65b('0x37')]({'plain':!![]});_0x3c5cb3[_0xb65b('0x43')]=_[_0xb65b('0x44')](db['UserChatQueue']['rawAttributes']);_0x3c5cb3[_0xb65b('0x45')]=_[_0xb65b('0x44')](_0x4f6e07[_0xb65b('0x45')]);_0x3c5cb3[_0xb65b('0x46')]=_[_0xb65b('0x47')](_0x3c5cb3[_0xb65b('0x43')],_0x3c5cb3[_0xb65b('0x45')]);_0x4bf843['attributes']=_[_0xb65b('0x47')](_0x3c5cb3[_0xb65b('0x43')],qs['fields'](_0x4f6e07['query']['fields']));_0x4bf843[_0xb65b('0x48')]=_0x4bf843['attributes'][_0xb65b('0x4a')]?_0x4bf843['attributes']:_0x3c5cb3[_0xb65b('0x43')];if(!_0x4f6e07[_0xb65b('0x45')]['hasOwnProperty'](_0xb65b('0x4b'))){_0x4bf843['limit']=qs[_0xb65b('0x2d')](_0x4f6e07[_0xb65b('0x45')][_0xb65b('0x2d')]);_0x4bf843[_0xb65b('0x2f')]=qs[_0xb65b('0x2f')](_0x4f6e07['query']['offset']);}_0x4bf843['order']=qs['sort'](_0x4f6e07[_0xb65b('0x45')][_0xb65b('0x4d')]);_0x4bf843[_0xb65b('0x4e')]=qs[_0xb65b('0x46')](_[_0xb65b('0x64')](_0x4f6e07['query'],_0x3c5cb3[_0xb65b('0x46')]));_0x4bf843[_0xb65b('0x4e')][_0xb65b('0x65')]=_0x5e08cf['id'];if(_0x4f6e07[_0xb65b('0x45')][_0xb65b('0x4f')]){_0x4bf843[_0xb65b('0x4e')]=_[_0xb65b('0x50')](_0x4bf843['where'],{'$or':_[_0xb65b('0x3e')](_0x4bf843[_0xb65b('0x48')],function(_0x10b0da){var _0x29d072={};_0x29d072[_0x10b0da]={'$like':'%'+_0x4f6e07[_0xb65b('0x45')][_0xb65b('0x4f')]+'%'};return _0x29d072;})});}_0x4bf843=_[_0xb65b('0x50')]({},_0x4bf843,_0x4f6e07['options']);return db[_0xb65b('0x66')][_0xb65b('0x53')](_0x4bf843);}})['then'](function(_0x41b8ca){if(_0x41b8ca){return db['User'][_0xb65b('0x67')]({'where':{'id':_['map'](_0x41b8ca,'UserId'),'role':_0xb65b('0x68')},'attributes':['id',_0xb65b('0x3b'),_0xb65b('0x69'),_0xb65b('0x6a'),'createdAt']});}})[_0xb65b('0x35')](function(_0x5d7828){if(_0x5d7828){return{'count':_0x5d7828['count'],'rows':_['map'](_0x5d7828[_0xb65b('0x6b')],function(_0x57cf42){return{'membername':_0x57cf42[_0xb65b('0x3b')],'UserId':_0x57cf42['id'],'queue_name':_0xf323e4[_0xb65b('0x3b')],'ChatQueueId':_0xf323e4['id'],'interface':util[_0xb65b('0x6c')](_0xb65b('0x6d'),_0xb65b('0x6e'),_0x57cf42[_0xb65b('0x3b')]),'penalty':0x0,'paused':_0x57cf42['chatPause'],'createdAt':_0x57cf42[_0xb65b('0x6f')],'updatedAt':_0x57cf42[_0xb65b('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb65b('0x35')](respondWithFilteredResult(_0x206dad,_0x4bf843))[_0xb65b('0x28')](handleError(_0x206dad,null));};exports[_0xb65b('0x70')]=function(_0x1976ad,_0x1bb2bb,_0x3495a4){var _0x249049={};var _0x1afb72={};var _0x44fce0;var _0x5db66a;return db[_0xb65b('0x3f')][_0xb65b('0x63')]({'where':{'id':_0x1976ad[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](handleEntityNotFound(_0x1bb2bb,null))[_0xb65b('0x35')](function(_0x480f6f){if(_0x480f6f){_0x44fce0=_0x480f6f;_0x1afb72[_0xb65b('0x43')]=_['keys'](db[_0xb65b('0x71')][_0xb65b('0x40')]);_0x1afb72[_0xb65b('0x45')]=_['keys'](_0x1976ad[_0xb65b('0x45')]);_0x1afb72[_0xb65b('0x46')]=_[_0xb65b('0x47')](_0x1afb72['model'],_0x1afb72[_0xb65b('0x45')]);_0x249049['attributes']=_[_0xb65b('0x47')](_0x1afb72['model'],qs[_0xb65b('0x49')](_0x1976ad[_0xb65b('0x45')][_0xb65b('0x49')]));_0x249049[_0xb65b('0x48')]=_0x249049[_0xb65b('0x48')]['length']?_0x249049[_0xb65b('0x48')]:_0x1afb72[_0xb65b('0x43')];_0x249049['order']=qs[_0xb65b('0x4d')](_0x1976ad[_0xb65b('0x45')]['sort']);_0x249049[_0xb65b('0x4e')]=qs['filters'](_[_0xb65b('0x64')](_0x1976ad[_0xb65b('0x45')],_0x1afb72[_0xb65b('0x46')]));if(_0x1976ad[_0xb65b('0x45')][_0xb65b('0x4f')]){_0x249049[_0xb65b('0x4e')]=_[_0xb65b('0x50')](_0x249049['where'],{'$or':_['map'](_0x249049[_0xb65b('0x48')],function(_0x50702c){var _0x1ca453={};_0x1ca453[_0x50702c]={'$like':'%'+_0x1976ad[_0xb65b('0x45')]['filter']+'%'};return _0x1ca453;})});}_0x249049=_[_0xb65b('0x50')]({},_0x249049,_0x1976ad[_0xb65b('0x51')]);return _0x44fce0[_0xb65b('0x70')](_0x249049);}})[_0xb65b('0x35')](function(_0x37058e){if(_0x37058e){_0x5db66a=_0x37058e[_0xb65b('0x4a')];if(!_0x1976ad[_0xb65b('0x45')]['hasOwnProperty'](_0xb65b('0x4b'))){_0x249049['limit']=qs[_0xb65b('0x2d')](_0x1976ad[_0xb65b('0x45')][_0xb65b('0x2d')]);_0x249049[_0xb65b('0x2f')]=qs[_0xb65b('0x2f')](_0x1976ad[_0xb65b('0x45')][_0xb65b('0x2f')]);}return _0x44fce0['getTeams'](_0x249049);}})[_0xb65b('0x35')](function(_0x1ca60d){if(_0x1ca60d){return _0x1ca60d?{'count':_0x5db66a,'rows':_0x1ca60d}:null;}})[_0xb65b('0x35')](respondWithResult(_0x1bb2bb,null))[_0xb65b('0x28')](handleError(_0x1bb2bb,null));};exports['addTeams']=function(_0x1362cd,_0x515d11,_0x296c08){var _0x3f2575=_0x1362cd[_0xb65b('0x61')][_0xb65b('0x72')];return db[_0xb65b('0x71')]['findAll']({'where':{'id':_0x3f2575},'attributes':['id'],'include':[{'model':db[_0xb65b('0x73')],'as':_0xb65b('0x74'),'attributes':['id',_0xb65b('0x3b'),_0xb65b('0x75'),'voicePause',_0xb65b('0x76')],'raw':!![]}]})[_0xb65b('0x35')](function(_0x213ef3){if(_0x213ef3){var _0x4d3d3e=_[_0xb65b('0x77')](_0x213ef3,function(_0x3b9e19){var _0x24cc78=_0x3b9e19['get']({'plain':!![]});return _0x24cc78[_0xb65b('0x74')];});return db[_0xb65b('0x3f')]['find']({'where':{'id':_0x1362cd[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](function(_0x37fda0){return db[_0xb65b('0x78')][_0xb65b('0x79')](function(_0x4aeae0){return _0x37fda0['addTeams'](_0x3f2575,{'transaction':_0x4aeae0})[_0xb65b('0x35')](function(){return BPromise[_0xb65b('0x7a')](_0x4d3d3e,function(_0x57c1aa){return db[_0xb65b('0x66')][_0xb65b('0x7b')]({'where':{'UserId':_0x57c1aa['id'],'ChatQueueId':_0x1362cd[_0xb65b('0x55')]['id']},'transaction':_0x4aeae0});});})[_0xb65b('0x35')](function(){_0x4d3d3e[_0xb65b('0x7c')](function(_0xd10b0f){socket[_0xb65b('0x7d')](_0xb65b('0x7e'),{'UserId':_0xd10b0f['id'],'ChatQueueId':_0x37fda0['id']});});});});});}})[_0xb65b('0x35')](respondWithStatusCode(_0x515d11,null))[_0xb65b('0x28')](handleError(_0x515d11,null));};exports[_0xb65b('0x7f')]=function(_0x4b24b1,_0x10bdf4,_0x554342){return db[_0xb65b('0x71')]['findAll']({'where':{'id':_0x4b24b1['query'][_0xb65b('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb65b('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10bdf4,null))[_0xb65b('0x35')](function(_0x558234){var _0x495346=_[_0xb65b('0x3e')](_0x558234,'id');var _0x51328d=[];var _0x119972=[];var _0x1bb166=squel[_0xb65b('0x80')]();_0x1bb166[_0xb65b('0x81')](_0xb65b('0x82'))[_0xb65b('0x83')]('team_has_chat_queues','tq')[_0xb65b('0x84')](_0xb65b('0x85'),'ut',_0xb65b('0x86'))[_0xb65b('0x4e')](_0xb65b('0x87'),_0x4b24b1[_0xb65b('0x55')]['id']);for(var _0x4548fe=0x0;_0x4548fe<_0x558234[_0xb65b('0x4a')];_0x4548fe+=0x1){let _0x2de384=_0x558234[_0x4548fe];for(var _0x4ca8ff=0x0;_0x4ca8ff<_0x2de384[_0xb65b('0x74')][_0xb65b('0x4a')];_0x4ca8ff+=0x1){let _0x3a83ef=_0x2de384[_0xb65b('0x74')][_0x4ca8ff];var _0x2acc46=_0x1bb166[_0xb65b('0x88')]();_0x2acc46[_0xb65b('0x4e')](_0xb65b('0x89'),_0x3a83ef['id']);_0x119972[_0xb65b('0x8a')](db[_0xb65b('0x78')]['query'](_0x2acc46[_0xb65b('0x8b')](),{'type':db[_0xb65b('0x78')][_0xb65b('0x8c')]['SELECT']})[_0xb65b('0x35')](function(_0x8d676f){if(_0x8d676f[_0xb65b('0x4a')]===0x1){return _0x3a83ef['id'];}else{var _0x499d55=_[_0xb65b('0x8d')](_[_0xb65b('0x3e')](_0x8d676f,_0xb65b('0x8e')),function(_0x11f72f){return _['includes'](_0x495346,_0x11f72f);});if(_0x499d55){return _0x3a83ef['id'];}}}));}}return BPromise['all'](_0x119972)[_0xb65b('0x35')](function(_0x29d65c){_0x51328d=_(_0x51328d)['union'](_0x29d65c)[_0xb65b('0x8f')]()['value']();return db[_0xb65b('0x3f')]['find']({'where':{'id':_0x4b24b1[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](function(_0x536d9d){return db[_0xb65b('0x78')]['transaction'](function(_0x3ae2ca){return _0x536d9d[_0xb65b('0x7f')](_0x4b24b1[_0xb65b('0x45')][_0xb65b('0x72')],{'transaction':_0x3ae2ca})['then'](function(){if(!_[_0xb65b('0x90')](_0x51328d)){return _0x536d9d[_0xb65b('0x91')](_0x51328d,{'transaction':_0x3ae2ca});}})[_0xb65b('0x35')](function(){_0x51328d[_0xb65b('0x7c')](function(_0x23d806){socket[_0xb65b('0x7d')](_0xb65b('0x92'),{'UserId':_0x23d806,'ChatQueueId':_0x536d9d['id']});});});});});});})['then'](respondWithStatusCode(_0x10bdf4,null))['catch'](handleError(_0x10bdf4,null));};exports[_0xb65b('0x93')]=function(_0x5df863,_0x818921,_0xe9a7d3){return db['ChatQueue'][_0xb65b('0x57')]({'where':{'id':_0x5df863[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](handleEntityNotFound(_0x818921,null))['then'](function(_0x63acf8){if(_0x63acf8){return _0x63acf8[_0xb65b('0x93')](_0x5df863[_0xb65b('0x61')][_0xb65b('0x72')],_['omit'](_0x5df863[_0xb65b('0x61')],[_0xb65b('0x72'),'id'])||{})[_0xb65b('0x94')](function(_0x9dd70e){for(var _0x21fd8a=0x0;_0x21fd8a<_0x5df863[_0xb65b('0x61')][_0xb65b('0x72')]['length'];_0x21fd8a+=0x1){socket[_0xb65b('0x7d')](_0xb65b('0x7e'),{'UserId':Number(_0x5df863[_0xb65b('0x61')][_0xb65b('0x72')][_0x21fd8a]),'ChatQueueId':Number(_0x5df863['params']['id'])});}return _0x9dd70e;});}})['then'](respondWithResult(_0x818921,null))[_0xb65b('0x28')](handleError(_0x818921,null));};exports[_0xb65b('0x91')]=function(_0x5eb926,_0x1fe292,_0x5d71b8){return db[_0xb65b('0x3f')][_0xb65b('0x57')]({'where':{'id':_0x5eb926[_0xb65b('0x55')]['id']}})[_0xb65b('0x35')](handleEntityNotFound(_0x1fe292,null))['then'](function(_0x13df39){if(_0x13df39){return _0x13df39[_0xb65b('0x91')](_0x5eb926[_0xb65b('0x45')]['ids'])[_0xb65b('0x35')](function(){if(_[_0xb65b('0x95')](_0x5eb926[_0xb65b('0x45')][_0xb65b('0x72')])){for(var _0x3885e0=0x0;_0x3885e0<_0x5eb926[_0xb65b('0x45')][_0xb65b('0x72')][_0xb65b('0x4a')];_0x3885e0+=0x1){socket[_0xb65b('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x5eb926[_0xb65b('0x45')][_0xb65b('0x72')][_0x3885e0]),'ChatQueueId':Number(_0x5eb926[_0xb65b('0x55')]['id'])});}}else{socket[_0xb65b('0x7d')](_0xb65b('0x92'),{'UserId':Number(_0x5eb926['query'][_0xb65b('0x72')]),'ChatQueueId':Number(_0x5eb926['params']['id'])});}});}})[_0xb65b('0x35')](respondWithStatusCode(_0x1fe292,null))[_0xb65b('0x28')](handleError(_0x1fe292,null));};exports[_0xb65b('0x96')]=function(_0x593793,_0x2b248e,_0x5f1e3f){var _0x3668fa={};var _0x19b7fb={};var _0x36a8d0;var _0x3e6566;return db[_0xb65b('0x3f')][_0xb65b('0x63')]({'where':{'id':_0x593793[_0xb65b('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b248e,null))[_0xb65b('0x35')](function(_0xbd524e){if(_0xbd524e){_0x36a8d0=_0xbd524e;_0x19b7fb['model']=_[_0xb65b('0x44')](db[_0xb65b('0x73')][_0xb65b('0x40')]);_0x19b7fb[_0xb65b('0x45')]=_['keys'](_0x593793[_0xb65b('0x45')]);_0x19b7fb['filters']=_[_0xb65b('0x47')](_0x19b7fb[_0xb65b('0x43')],_0x19b7fb[_0xb65b('0x45')]);_0x3668fa[_0xb65b('0x48')]=_[_0xb65b('0x47')](_0x19b7fb[_0xb65b('0x43')],qs['fields'](_0x593793['query']['fields']));_0x3668fa[_0xb65b('0x48')]=_0x3668fa[_0xb65b('0x48')][_0xb65b('0x4a')]?_0x3668fa[_0xb65b('0x48')]:_0x19b7fb['model'];_0x3668fa[_0xb65b('0x4c')]=qs['sort'](_0x593793['query'][_0xb65b('0x4d')]);_0x3668fa[_0xb65b('0x4e')]=qs[_0xb65b('0x46')](_['pick'](_0x593793['query'],_0x19b7fb['filters']));if(_0x593793[_0xb65b('0x45')][_0xb65b('0x4f')]){_0x3668fa['where']=_[_0xb65b('0x50')](_0x3668fa[_0xb65b('0x4e')],{'$or':_[_0xb65b('0x3e')](_0x3668fa['attributes'],function(_0x560641){var _0x1d44fe={};_0x1d44fe[_0x560641]={'$like':'%'+_0x593793[_0xb65b('0x45')]['filter']+'%'};return _0x1d44fe;})});}_0x3668fa=_[_0xb65b('0x50')]({},_0x3668fa,_0x593793[_0xb65b('0x51')]);return _0x36a8d0[_0xb65b('0x96')](_0x3668fa);}})['then'](function(_0x301a52){if(_0x301a52){_0x3e6566=_0x301a52['length'];if(!_0x593793[_0xb65b('0x45')]['hasOwnProperty']('nolimit')){_0x3668fa[_0xb65b('0x2d')]=qs['limit'](_0x593793[_0xb65b('0x45')]['limit']);_0x3668fa['offset']=qs[_0xb65b('0x2f')](_0x593793['query'][_0xb65b('0x2f')]);}return _0x36a8d0[_0xb65b('0x96')](_0x3668fa);}})[_0xb65b('0x35')](function(_0x16c1e2){if(_0x16c1e2){return _0x16c1e2?{'count':_0x3e6566,'rows':_0x16c1e2}:null;}})[_0xb65b('0x35')](respondWithResult(_0x2b248e,null))[_0xb65b('0x28')](handleError(_0x2b248e,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0ea63bc..163cbeb 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 _0x6d58=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1f21a7,_0x547477){var _0x169110=function(_0x126ba9){while(--_0x126ba9){_0x1f21a7['push'](_0x1f21a7['shift']());}};_0x169110(++_0x547477);}(_0x6d58,0x165));var _0x86d5=function(_0x52e91d,_0x39e46e){_0x52e91d=_0x52e91d-0x0;var _0xe964eb=_0x6d58[_0x52e91d];return _0xe964eb;};'use strict';var EventEmitter=require(_0x86d5('0x0'));var ChatQueue=require(_0x86d5('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x86d5('0x2')](0x0);var events={'afterCreate':_0x86d5('0x3'),'afterUpdate':_0x86d5('0x4'),'afterDestroy':_0x86d5('0x5')};function emitEvent(_0x2dc800){return function(_0x354941,_0x34e29c,_0x3cbf2f){ChatQueueEvents[_0x86d5('0x6')](_0x2dc800+':'+_0x354941['id'],_0x354941);ChatQueueEvents[_0x86d5('0x6')](_0x2dc800,_0x354941);_0x3cbf2f(null);};}for(var e in events){if(events[_0x86d5('0x7')](e)){var event=events[e];ChatQueue[_0x86d5('0x8')](e,emitEvent(event));}}module[_0x86d5('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x8a13=['ChatQueue','setMaxListeners','save','update','emit','exports','events','../../mysqldb'];(function(_0x2c5977,_0x3b3240){var _0x406c3a=function(_0x5a3887){while(--_0x5a3887){_0x2c5977['push'](_0x2c5977['shift']());}};_0x406c3a(++_0x3b3240);}(_0x8a13,0xd6));var _0x38a1=function(_0x3791a5,_0x3e9d44){_0x3791a5=_0x3791a5-0x0;var _0x495f05=_0x8a13[_0x3791a5];return _0x495f05;};'use strict';var EventEmitter=require(_0x38a1('0x0'));var ChatQueue=require(_0x38a1('0x1'))['db'][_0x38a1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x38a1('0x3')](0x0);var events={'afterCreate':_0x38a1('0x4'),'afterUpdate':_0x38a1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3a6920){return function(_0x155c66,_0x397f8d,_0x10b66e){ChatQueueEvents[_0x38a1('0x6')](_0x3a6920+':'+_0x155c66['id'],_0x155c66);ChatQueueEvents[_0x38a1('0x6')](_0x3a6920,_0x155c66);_0x10b66e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x38a1('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e7ab5a1..1b056b7 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 _0x2268=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2268,0x9a));var _0x8226=function(_0xb1fb04,_0x38cb30){_0xb1fb04=_0xb1fb04-0x0;var _0x5cc3ff=_0x2268[_0xb1fb04];return _0x5cc3ff;};'use strict';var _=require(_0x8226('0x0'));var util=require(_0x8226('0x1'));var logger=require(_0x8226('0x2'))(_0x8226('0x3'));var moment=require(_0x8226('0x4'));var BPromise=require(_0x8226('0x5'));var rp=require(_0x8226('0x6'));var fs=require('fs');var path=require(_0x8226('0x7'));var rimraf=require(_0x8226('0x8'));var config=require(_0x8226('0x9'));var attributes=require(_0x8226('0xa'));module[_0x8226('0xb')]=function(_0x4b391d,_0xec0137){return _0x4b391d[_0x8226('0xc')](_0x8226('0xd'),attributes,{'tableName':_0x8226('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe8f=['chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define'];(function(_0x82536f,_0x34d356){var _0x246861=function(_0x496210){while(--_0x496210){_0x82536f['push'](_0x82536f['shift']());}};_0x246861(++_0x34d356);}(_0xfe8f,0x121));var _0xffe8=function(_0x3d1f23,_0x921237){_0x3d1f23=_0x3d1f23-0x0;var _0x10c3f6=_0xfe8f[_0x3d1f23];return _0x10c3f6;};'use strict';var _=require(_0xffe8('0x0'));var util=require(_0xffe8('0x1'));var logger=require(_0xffe8('0x2'))(_0xffe8('0x3'));var moment=require(_0xffe8('0x4'));var BPromise=require(_0xffe8('0x5'));var rp=require(_0xffe8('0x6'));var fs=require('fs');var path=require(_0xffe8('0x7'));var rimraf=require(_0xffe8('0x8'));var config=require('../../config/environment');var attributes=require(_0xffe8('0x9'));module['exports']=function(_0xf19dac,_0x571088){return _0xf19dac[_0xffe8('0xa')]('ChatQueue',attributes,{'tableName':_0xffe8('0xb'),'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 6a559b1..68f41b2 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 _0xfbb2=['code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','options','raw','where','include','map','model','attributes','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfbb2,0xae));var _0x2fbb=function(_0x23b946,_0x2653e1){_0x23b946=_0x23b946-0x0;var _0xcfad4f=_0xfbb2[_0x23b946];return _0xcfad4f;};'use strict';var _=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var moment=require(_0x2fbb('0x2'));var BPromise=require(_0x2fbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbb('0x4'));var db=require(_0x2fbb('0x5'))['db'];var utils=require(_0x2fbb('0x6'));var logger=require(_0x2fbb('0x7'))(_0x2fbb('0x8'));var config=require(_0x2fbb('0x9'));var jayson=require(_0x2fbb('0xa'));var client=jayson['client'][_0x2fbb('0xb')]({'port':0x232a});config[_0x2fbb('0xc')]=_[_0x2fbb('0xd')](config['redis'],{'host':_0x2fbb('0xe'),'port':0x18eb});var socket=require(_0x2fbb('0xf'))(new Redis(config[_0x2fbb('0xc')]));require(_0x2fbb('0x10'))[_0x2fbb('0x11')](socket);function respondWithRpcPromise(_0x52b99d,_0x4abfac,_0x551625){return new BPromise(function(_0x4b083d,_0x3c98be){return client[_0x2fbb('0x12')](_0x52b99d,_0x551625)[_0x2fbb('0x13')](function(_0x4a2c2c){logger[_0x2fbb('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4abfac,_0x2fbb('0x15'));logger[_0x2fbb('0x16')](_0x2fbb('0x17'),_0x4abfac,_0x2fbb('0x15'),JSON[_0x2fbb('0x18')](_0x4a2c2c));if(_0x4a2c2c['error']){if(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1a')]===0x1f4){logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x4a2c2c['error'][_0x2fbb('0x1c')]);return _0x3c98be(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);}logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);return _0x4b083d(_0x4a2c2c[_0x2fbb('0x19')][_0x2fbb('0x1c')]);}else{logger[_0x2fbb('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4abfac,_0x2fbb('0x15'));_0x4b083d(_0x4a2c2c['result'][_0x2fbb('0x1c')]);}})[_0x2fbb('0x1d')](function(_0x47f0c5){logger['error'](_0x2fbb('0x1b'),_0x4abfac,_0x47f0c5);_0x3c98be(_0x47f0c5);});});}exports[_0x2fbb('0x1e')]=function(_0x1d1215){var _0x3dca1c=this;return new Promise(function(_0x579fe0,_0xcdec3d){return db['ChatQueue']['findAll']({'raw':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')][_0x2fbb('0x20')]===undefined?!![]:![]:!![],'where':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215['options'][_0x2fbb('0x21')]||null:null,'attributes':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')]['attributes']||null:null,'limit':_0x1d1215['options']?_0x1d1215[_0x2fbb('0x1f')]['limit']||null:null,'include':_0x1d1215[_0x2fbb('0x1f')]?_0x1d1215[_0x2fbb('0x1f')][_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x1d1215['options'][_0x2fbb('0x22')],function(_0x178569){return{'model':db[_0x178569[_0x2fbb('0x24')]],'as':_0x178569['as'],'attributes':_0x178569[_0x2fbb('0x25')],'include':_0x178569['include']?_[_0x2fbb('0x23')](_0x178569[_0x2fbb('0x22')],function(_0x1ddb64){return{'model':db[_0x1ddb64[_0x2fbb('0x24')]],'as':_0x1ddb64['as'],'attributes':_0x1ddb64['attributes'],'include':_0x1ddb64[_0x2fbb('0x22')]?_['map'](_0x1ddb64['include'],function(_0x33b493){return{'model':db[_0x33b493[_0x2fbb('0x24')]],'as':_0x33b493['as'],'attributes':_0x33b493['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45d35a){logger[_0x2fbb('0x14')](_0x2fbb('0x1e'),_0x1d1215);logger[_0x2fbb('0x16')](_0x2fbb('0x1e'),_0x1d1215,JSON[_0x2fbb('0x18')](_0x45d35a));_0x579fe0(_0x45d35a);})['catch'](function(_0x1bad55){logger[_0x2fbb('0x19')](_0x2fbb('0x1e'),_0x1bad55[_0x2fbb('0x1c')],_0x1d1215);_0xcdec3d(_0x3dca1c['error'](0x1f4,_0x1bad55[_0x2fbb('0x1c')]));});});};exports['ShowChatQueue']=function(_0x52b923){var _0x4a8373=this;return new Promise(function(_0x1e8a96,_0x221409){return db['ChatQueue'][_0x2fbb('0x26')]({'raw':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x21')]||null:null,'attributes':_0x52b923[_0x2fbb('0x1f')]?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x25')]||null:null,'include':_0x52b923['options']?_0x52b923[_0x2fbb('0x1f')][_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x52b923['options'][_0x2fbb('0x22')],function(_0x267402){return{'model':db[_0x267402['model']],'as':_0x267402['as'],'attributes':_0x267402['attributes'],'include':_0x267402[_0x2fbb('0x22')]?_[_0x2fbb('0x23')](_0x267402[_0x2fbb('0x22')],function(_0x59f3e1){return{'model':db[_0x59f3e1['model']],'as':_0x59f3e1['as'],'attributes':_0x59f3e1[_0x2fbb('0x25')],'include':_0x59f3e1[_0x2fbb('0x22')]?_['map'](_0x59f3e1[_0x2fbb('0x22')],function(_0x59fd8d){return{'model':db[_0x59fd8d[_0x2fbb('0x24')]],'as':_0x59fd8d['as'],'attributes':_0x59fd8d[_0x2fbb('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2fbb('0x13')](function(_0x4d4543){logger[_0x2fbb('0x14')](_0x2fbb('0x27'),_0x52b923);logger[_0x2fbb('0x16')]('ShowChatQueue',_0x52b923,JSON['stringify'](_0x4d4543));_0x1e8a96(_0x4d4543);})['catch'](function(_0x8645a2){logger[_0x2fbb('0x19')](_0x2fbb('0x27'),_0x8645a2['message'],_0x52b923);_0x221409(_0x4a8373[_0x2fbb('0x19')](0x1f4,_0x8645a2[_0x2fbb('0x1c')]));});});}; \ No newline at end of file +var _0x1b0e=['./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','options','raw','limit','map','model','attributes','include','then','catch','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x4882a7,_0x235bc4){var _0x31a22c=function(_0x23ab72){while(--_0x23ab72){_0x4882a7['push'](_0x4882a7['shift']());}};_0x31a22c(++_0x235bc4);}(_0x1b0e,0x132));var _0xe1b0=function(_0x53efe0,_0x5eeb29){_0x53efe0=_0x53efe0-0x0;var _0x16a442=_0x1b0e[_0x53efe0];return _0x16a442;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});config['redis']=_[_0xe1b0('0xb')](config[_0xe1b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1b0('0xd'))(new Redis(config[_0xe1b0('0xc')]));require(_0xe1b0('0xe'))[_0xe1b0('0xf')](socket);function respondWithRpcPromise(_0x20e18e,_0xca6614,_0x2d1c6f){return new BPromise(function(_0x29a264,_0x302ef2){return client[_0xe1b0('0x10')](_0x20e18e,_0x2d1c6f)['then'](function(_0x2eddc0){logger[_0xe1b0('0x11')](_0xe1b0('0x12'),_0xca6614,_0xe1b0('0x13'));logger[_0xe1b0('0x14')](_0xe1b0('0x15'),_0xca6614,_0xe1b0('0x13'),JSON[_0xe1b0('0x16')](_0x2eddc0));if(_0x2eddc0[_0xe1b0('0x17')]){if(_0x2eddc0['error'][_0xe1b0('0x18')]===0x1f4){logger[_0xe1b0('0x17')](_0xe1b0('0x12'),_0xca6614,_0x2eddc0['error']['message']);return _0x302ef2(_0x2eddc0[_0xe1b0('0x17')][_0xe1b0('0x19')]);}logger[_0xe1b0('0x17')](_0xe1b0('0x12'),_0xca6614,_0x2eddc0[_0xe1b0('0x17')][_0xe1b0('0x19')]);return _0x29a264(_0x2eddc0['error'][_0xe1b0('0x19')]);}else{logger[_0xe1b0('0x11')](_0xe1b0('0x12'),_0xca6614,_0xe1b0('0x13'));_0x29a264(_0x2eddc0[_0xe1b0('0x1a')]['message']);}})['catch'](function(_0x579fe2){logger[_0xe1b0('0x17')]('ChatQueue,\x20%s,\x20%s',_0xca6614,_0x579fe2);_0x302ef2(_0x579fe2);});});}exports[_0xe1b0('0x1b')]=function(_0x41bb55){var _0x2bebb7=this;return new Promise(function(_0x49f501,_0x3e0a89){return db[_0xe1b0('0x1c')]['findAll']({'raw':_0x41bb55[_0xe1b0('0x1d')]?_0x41bb55[_0xe1b0('0x1d')][_0xe1b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x41bb55['options']?_0x41bb55[_0xe1b0('0x1d')]['where']||null:null,'attributes':_0x41bb55['options']?_0x41bb55['options']['attributes']||null:null,'limit':_0x41bb55[_0xe1b0('0x1d')]?_0x41bb55['options'][_0xe1b0('0x1f')]||null:null,'include':_0x41bb55[_0xe1b0('0x1d')]?_0x41bb55[_0xe1b0('0x1d')]['include']?_[_0xe1b0('0x20')](_0x41bb55[_0xe1b0('0x1d')]['include'],function(_0x1ab8ef){return{'model':db[_0x1ab8ef[_0xe1b0('0x21')]],'as':_0x1ab8ef['as'],'attributes':_0x1ab8ef[_0xe1b0('0x22')],'include':_0x1ab8ef[_0xe1b0('0x23')]?_[_0xe1b0('0x20')](_0x1ab8ef['include'],function(_0x44a5d6){return{'model':db[_0x44a5d6[_0xe1b0('0x21')]],'as':_0x44a5d6['as'],'attributes':_0x44a5d6[_0xe1b0('0x22')],'include':_0x44a5d6[_0xe1b0('0x23')]?_[_0xe1b0('0x20')](_0x44a5d6[_0xe1b0('0x23')],function(_0x13dc9d){return{'model':db[_0x13dc9d[_0xe1b0('0x21')]],'as':_0x13dc9d['as'],'attributes':_0x13dc9d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1b0('0x24')](function(_0xd6ac42){logger['info'](_0xe1b0('0x1b'),_0x41bb55);logger[_0xe1b0('0x14')]('GetChatQueue',_0x41bb55,JSON['stringify'](_0xd6ac42));_0x49f501(_0xd6ac42);})[_0xe1b0('0x25')](function(_0x9c4710){logger[_0xe1b0('0x17')](_0xe1b0('0x1b'),_0x9c4710[_0xe1b0('0x19')],_0x41bb55);_0x3e0a89(_0x2bebb7[_0xe1b0('0x17')](0x1f4,_0x9c4710[_0xe1b0('0x19')]));});});};exports['ShowChatQueue']=function(_0x4e1a36){var _0x218716=this;return new Promise(function(_0x2113b7,_0xaf1d7a){return db[_0xe1b0('0x1c')][_0xe1b0('0x26')]({'raw':_0x4e1a36[_0xe1b0('0x1d')]?_0x4e1a36[_0xe1b0('0x1d')][_0xe1b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e1a36[_0xe1b0('0x1d')]?_0x4e1a36[_0xe1b0('0x1d')]['where']||null:null,'attributes':_0x4e1a36['options']?_0x4e1a36['options'][_0xe1b0('0x22')]||null:null,'include':_0x4e1a36['options']?_0x4e1a36[_0xe1b0('0x1d')][_0xe1b0('0x23')]?_[_0xe1b0('0x20')](_0x4e1a36[_0xe1b0('0x1d')][_0xe1b0('0x23')],function(_0x1b80e2){return{'model':db[_0x1b80e2[_0xe1b0('0x21')]],'as':_0x1b80e2['as'],'attributes':_0x1b80e2['attributes'],'include':_0x1b80e2['include']?_['map'](_0x1b80e2[_0xe1b0('0x23')],function(_0x504523){return{'model':db[_0x504523[_0xe1b0('0x21')]],'as':_0x504523['as'],'attributes':_0x504523['attributes'],'include':_0x504523['include']?_['map'](_0x504523[_0xe1b0('0x23')],function(_0x1237df){return{'model':db[_0x1237df[_0xe1b0('0x21')]],'as':_0x1237df['as'],'attributes':_0x1237df[_0xe1b0('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe1b0('0x24')](function(_0x3766bf){logger['info']('ShowChatQueue',_0x4e1a36);logger[_0xe1b0('0x14')](_0xe1b0('0x27'),_0x4e1a36,JSON['stringify'](_0x3766bf));_0x2113b7(_0x3766bf);})[_0xe1b0('0x25')](function(_0x4486ff){logger[_0xe1b0('0x17')](_0xe1b0('0x27'),_0x4486ff[_0xe1b0('0x19')],_0x4e1a36);_0xaf1d7a(_0x218716[_0xe1b0('0x17')](0x1f4,_0x4486ff[_0xe1b0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ee4f0d7..b8d587c 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 _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3eb1c1,_0x55ac1d){var _0x1c1226=function(_0x2419ce){while(--_0x2419ce){_0x3eb1c1['push'](_0x3eb1c1['shift']());}};_0x1c1226(++_0x55ac1d);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7bae[_0x2d7f0e];return _0x110b07;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file +var _0x55ca=['removeListener','register','./chatQueue.events','save'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x55ca,0x126));var _0xa55c=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x55ca[_0x1f1fb4];return _0x12fa15;};'use strict';var ChatQueueEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatQueueEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatQueue:'+_0x2121fd,_0x3c97c8);ChatQueueEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 47db14c..908a689 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x24170b,_0xd17937){var _0x1b483d=function(_0x432aea){while(--_0x432aea){_0x24170b['push'](_0x24170b['shift']());}};_0x1b483d(++_0xd17937);}(_0x7217,0x19e));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5c6085,_0x182fe8){var _0x3f16a6=function(_0x31afd9){while(--_0x31afd9){_0x5c6085['push'](_0x5c6085['shift']());}};_0x3f16a6(++_0x182fe8);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ab6e269..e044f65 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 _0xbe5b=['DATE','exports','STRING'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xbe5b,0xbe));var _0xbbe5=function(_0x38b53a,_0x197e30){_0x38b53a=_0x38b53a-0x0;var _0x5b9720=_0xbe5b[_0x38b53a];return _0x5b9720;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xbbe5('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbbe5('0x1')]},'joinAt':{'type':Sequelize[_0xbbe5('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbbe5('0x2')]},'exitAt':{'type':Sequelize[_0xbbe5('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x251b=['STRING','DATE','moment','sequelize'];(function(_0x554629,_0x5811f3){var _0xbca017=function(_0x55a5f2){while(--_0x55a5f2){_0x554629['push'](_0x554629['shift']());}};_0xbca017(++_0x5811f3);}(_0x251b,0x1e2));var _0xb251=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x251b[_0x120bc2];return _0x454a41;};'use strict';var moment=require(_0xb251('0x0'));var Sequelize=require(_0xb251('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb251('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb251('0x3')]},'leaveAt':{'type':Sequelize[_0xb251('0x3')]},'acceptAt':{'type':Sequelize[_0xb251('0x3')]},'exitAt':{'type':Sequelize[_0xb251('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e5dce03..6511731 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','ChatQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x3e4035,_0x43bd5e){var _0x3b9830=function(_0x67c7bf){while(--_0x67c7bf){_0x3e4035['push'](_0x3e4035['shift']());}};_0x3b9830(++_0x43bd5e);}(_0x57ca,0x108));var _0xa57c=function(_0x2011f3,_0x1df2e6){_0x2011f3=_0x2011f3-0x0;var _0x3b7164=_0x57ca[_0x2011f3];return _0x3b7164;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['ChatQueueReport'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['ChatQueueReport'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0x6333=['include','catch','params','create','body','find','describe','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x3bb047,_0x58c941){var _0x21191a=function(_0x48b4f1){while(--_0x48b4f1){_0x3bb047['push'](_0x3bb047['shift']());}};_0x21191a(++_0x58c941);}(_0x6333,0x83));var _0x3633=function(_0x36a7e0,_0x15344f){_0x36a7e0=_0x36a7e0-0x0;var _0x51df1e=_0x6333[_0x36a7e0];return _0x51df1e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3633('0x0'));var rp=require('request-promise');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var Mustache=require('mustache');var util=require(_0x3633('0x3'));var path=require('path');var sox=require(_0x3633('0x4'));var csv=require(_0x3633('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3633('0x6'));var squel=require(_0x3633('0x7'));var crypto=require(_0x3633('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3633('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3633('0x9'));var authService=require(_0x3633('0xa'));var qs=require(_0x3633('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3633('0xc'));var logger=require(_0x3633('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x3633('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337f72,_0xf1346){_0xf1346=_0xf1346||0xcc;return function(_0x51a78a){if(_0x51a78a){return _0x337f72[_0x3633('0xf')](_0xf1346);}return _0x337f72[_0x3633('0x10')](_0xf1346)['end']();};}function respondWithResult(_0x3231f9,_0x28f08e){_0x28f08e=_0x28f08e||0xc8;return function(_0x5bf51b){if(_0x5bf51b){return _0x3231f9[_0x3633('0x10')](_0x28f08e)['json'](_0x5bf51b);}};}function respondWithFilteredResult(_0x4c71ea,_0x1b5728){return function(_0x377f19){if(_0x377f19){var _0x2f5eab=typeof _0x1b5728[_0x3633('0x11')]===_0x3633('0x12')&&typeof _0x1b5728[_0x3633('0x13')]==='undefined';var _0x2d123e=_0x377f19[_0x3633('0x14')];var _0x578e08=_0x2f5eab?0x0:_0x1b5728['offset'];var _0x38a7bc=_0x2f5eab?_0x377f19['count']:_0x1b5728['offset']+_0x1b5728[_0x3633('0x13')];var _0x13f7af;if(_0x38a7bc>=_0x2d123e){_0x38a7bc=_0x2d123e;_0x13f7af=0xc8;}else{_0x13f7af=0xce;}_0x4c71ea[_0x3633('0x10')](_0x13f7af);return _0x4c71ea['set'](_0x3633('0x15'),_0x578e08+'-'+_0x38a7bc+'/'+_0x2d123e)[_0x3633('0x16')](_0x377f19);}return null;};}function patchUpdates(_0x107b5a){return function(_0x47d57b){try{jsonpatch[_0x3633('0x17')](_0x47d57b,_0x107b5a,!![]);}catch(_0x2b7f86){return BPromise[_0x3633('0x18')](_0x2b7f86);}return _0x47d57b['save']();};}function saveUpdates(_0x55686f,_0x17a013){return function(_0x4ed8e3){if(_0x4ed8e3){return _0x4ed8e3[_0x3633('0x19')](_0x55686f)[_0x3633('0x1a')](function(_0x1d5270){return _0x1d5270;});}return null;};}function removeEntity(_0x1115dd,_0x4306ef){return function(_0x27511a){if(_0x27511a){return _0x27511a[_0x3633('0x1b')]()[_0x3633('0x1a')](function(){_0x1115dd[_0x3633('0x10')](0xcc)[_0x3633('0x1c')]();});}};}function handleEntityNotFound(_0x2c781f,_0x3844d5){return function(_0x4b0ad7){if(!_0x4b0ad7){_0x2c781f[_0x3633('0xf')](0x194);}return _0x4b0ad7;};}function handleError(_0x145e3c,_0x493e14){_0x493e14=_0x493e14||0x1f4;return function(_0x19c36c){logger[_0x3633('0x1d')](_0x19c36c[_0x3633('0x1e')]);if(_0x19c36c[_0x3633('0x1f')]){delete _0x19c36c[_0x3633('0x1f')];}_0x145e3c[_0x3633('0x10')](_0x493e14)[_0x3633('0x20')](_0x19c36c);};}exports['index']=function(_0x9fa0fd,_0x55d70a){var _0x1ea384={},_0xbf7c64={},_0x2306e4={'count':0x0,'rows':[]};var _0x142c48=_[_0x3633('0x21')](db[_0x3633('0x22')][_0x3633('0x23')],function(_0x2ceabb){return{'name':_0x2ceabb['fieldName'],'type':_0x2ceabb[_0x3633('0x24')][_0x3633('0x25')]};});_0xbf7c64[_0x3633('0x26')]=_[_0x3633('0x21')](_0x142c48,_0x3633('0x1f'));_0xbf7c64[_0x3633('0x27')]=_[_0x3633('0x28')](_0x9fa0fd['query']);_0xbf7c64[_0x3633('0x29')]=_[_0x3633('0x2a')](_0xbf7c64['model'],_0xbf7c64[_0x3633('0x27')]);_0x1ea384[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0xbf7c64[_0x3633('0x26')],qs[_0x3633('0x2c')](_0x9fa0fd['query'][_0x3633('0x2c')]));_0x1ea384['attributes']=_0x1ea384['attributes'][_0x3633('0x2d')]?_0x1ea384['attributes']:_0xbf7c64[_0x3633('0x26')];if(!_0x9fa0fd[_0x3633('0x27')]['hasOwnProperty'](_0x3633('0x2e'))){_0x1ea384[_0x3633('0x13')]=qs['limit'](_0x9fa0fd['query'][_0x3633('0x13')]);_0x1ea384[_0x3633('0x11')]=qs[_0x3633('0x11')](_0x9fa0fd[_0x3633('0x27')]['offset']);}_0x1ea384[_0x3633('0x2f')]=qs[_0x3633('0x30')](_0x9fa0fd[_0x3633('0x27')]['sort']);_0x1ea384[_0x3633('0x31')]=qs['filters'](_[_0x3633('0x32')](_0x9fa0fd[_0x3633('0x27')],_0xbf7c64[_0x3633('0x29')]),_0x142c48);if(_0x9fa0fd[_0x3633('0x27')]['filter']){_0x1ea384[_0x3633('0x31')]=_[_0x3633('0x33')](_0x1ea384['where'],{'$or':_[_0x3633('0x21')](_0x142c48,function(_0x4c4647){if(_0x4c4647[_0x3633('0x24')]!==_0x3633('0x34')){var _0x1b1302={};_0x1b1302[_0x4c4647['name']]={'$like':'%'+_0x9fa0fd[_0x3633('0x27')]['filter']+'%'};return _0x1b1302;}})});}_0x1ea384=_[_0x3633('0x33')]({},_0x1ea384,_0x9fa0fd[_0x3633('0x35')]);var _0x10bbfd={'where':_0x1ea384[_0x3633('0x31')]};return db['ChatQueueReport'][_0x3633('0x14')](_0x10bbfd)[_0x3633('0x1a')](function(_0x1dfdcb){_0x2306e4[_0x3633('0x14')]=_0x1dfdcb;if(_0x9fa0fd[_0x3633('0x27')][_0x3633('0x36')]){_0x1ea384[_0x3633('0x37')]=[{'all':!![]}];}return db[_0x3633('0x22')]['findAll'](_0x1ea384);})['then'](function(_0x2cdeee){_0x2306e4['rows']=_0x2cdeee;return _0x2306e4;})[_0x3633('0x1a')](respondWithFilteredResult(_0x55d70a,_0x1ea384))[_0x3633('0x38')](handleError(_0x55d70a,null));};exports['show']=function(_0x192561,_0x3cf8d9){var _0x1edb4b={'raw':!![],'where':{'id':_0x192561[_0x3633('0x39')]['id']}},_0x399a80={};_0x399a80['model']=_['keys'](db[_0x3633('0x22')][_0x3633('0x23')]);_0x399a80[_0x3633('0x27')]=_[_0x3633('0x28')](_0x192561[_0x3633('0x27')]);_0x399a80[_0x3633('0x29')]=_[_0x3633('0x2a')](_0x399a80['model'],_0x399a80[_0x3633('0x27')]);_0x1edb4b[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0x399a80['model'],qs['fields'](_0x192561[_0x3633('0x27')]['fields']));_0x1edb4b[_0x3633('0x2b')]=_0x1edb4b['attributes'][_0x3633('0x2d')]?_0x1edb4b[_0x3633('0x2b')]:_0x399a80[_0x3633('0x26')];if(_0x192561[_0x3633('0x27')][_0x3633('0x36')]){_0x1edb4b[_0x3633('0x37')]=[{'all':!![]}];}_0x1edb4b=_[_0x3633('0x33')]({},_0x1edb4b,_0x192561[_0x3633('0x35')]);return db['ChatQueueReport']['find'](_0x1edb4b)[_0x3633('0x1a')](handleEntityNotFound(_0x3cf8d9,null))[_0x3633('0x1a')](respondWithResult(_0x3cf8d9,null))['catch'](handleError(_0x3cf8d9,null));};exports[_0x3633('0x3a')]=function(_0x352260,_0x2f14e5){return db['ChatQueueReport']['create'](_0x352260[_0x3633('0x3b')],{})[_0x3633('0x1a')](respondWithResult(_0x2f14e5,0xc9))[_0x3633('0x38')](handleError(_0x2f14e5,null));};exports[_0x3633('0x19')]=function(_0xb39d18,_0x2ae7bd){if(_0xb39d18['body']['id']){delete _0xb39d18[_0x3633('0x3b')]['id'];}return db[_0x3633('0x22')][_0x3633('0x3c')]({'where':{'id':_0xb39d18[_0x3633('0x39')]['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x2ae7bd,null))[_0x3633('0x1a')](saveUpdates(_0xb39d18[_0x3633('0x3b')],null))['then'](respondWithResult(_0x2ae7bd,null))[_0x3633('0x38')](handleError(_0x2ae7bd,null));};exports['destroy']=function(_0x321429,_0x31a072){return db['ChatQueueReport'][_0x3633('0x3c')]({'where':{'id':_0x321429['params']['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x31a072,null))[_0x3633('0x1a')](removeEntity(_0x31a072,null))[_0x3633('0x38')](handleError(_0x31a072,null));};exports[_0x3633('0x3d')]=function(_0x264e08,_0x57f2f6){return db[_0x3633('0x22')][_0x3633('0x3d')]()[_0x3633('0x1a')](respondWithResult(_0x57f2f6,null))['catch'](handleError(_0x57f2f6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b23921e..dc4fa78 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf1fa10,_0x52a90c){var _0x2078d9=function(_0x36e30d){while(--_0x36e30d){_0xf1fa10['push'](_0xf1fa10['shift']());}};_0x2078d9(++_0x52a90c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0xe706,0xa3));var _0x6e70=function(_0x37d4ac,_0x4e47d6){_0x37d4ac=_0x37d4ac-0x0;var _0x5e727a=_0xe706[_0x37d4ac];return _0x5e727a;};'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 8acac74..a72fe05 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 _0x8799=['ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug'];(function(_0x95a54c,_0x5aea6b){var _0x4ebad3=function(_0xf33bb7){while(--_0xf33bb7){_0x95a54c['push'](_0x95a54c['shift']());}};_0x4ebad3(++_0x5aea6b);}(_0x8799,0x1d1));var _0x9879=function(_0x3eccc0,_0xc7811){_0x3eccc0=_0x3eccc0-0x0;var _0x534654=_0x8799[_0x3eccc0];return _0x534654;};'use strict';var _=require(_0x9879('0x0'));var util=require(_0x9879('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9879('0x2'));var fs=require('fs');var Redis=require(_0x9879('0x3'));var db=require(_0x9879('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9879('0x5'))(_0x9879('0x6'));var config=require(_0x9879('0x7'));var jayson=require(_0x9879('0x8'));var client=jayson['client'][_0x9879('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c359c,_0x4586a2,_0x2e7998){return new BPromise(function(_0x3d90cb,_0x18fb99){return client[_0x9879('0xa')](_0x5c359c,_0x2e7998)[_0x9879('0xb')](function(_0x2c9e92){logger[_0x9879('0xc')](_0x9879('0xd'),_0x4586a2,'request\x20sent');logger[_0x9879('0xe')](_0x9879('0xf'),_0x4586a2,_0x9879('0x10'),JSON[_0x9879('0x11')](_0x2c9e92));if(_0x2c9e92[_0x9879('0x12')]){if(_0x2c9e92[_0x9879('0x12')][_0x9879('0x13')]===0x1f4){logger[_0x9879('0x12')](_0x9879('0xd'),_0x4586a2,_0x2c9e92['error'][_0x9879('0x14')]);return _0x18fb99(_0x2c9e92['error'][_0x9879('0x14')]);}logger[_0x9879('0x12')](_0x9879('0xd'),_0x4586a2,_0x2c9e92['error'][_0x9879('0x14')]);return _0x3d90cb(_0x2c9e92['error'][_0x9879('0x14')]);}else{logger[_0x9879('0xc')](_0x9879('0xd'),_0x4586a2,_0x9879('0x10'));_0x3d90cb(_0x2c9e92[_0x9879('0x15')][_0x9879('0x14')]);}})[_0x9879('0x16')](function(_0x32ff78){logger[_0x9879('0x12')](_0x9879('0xd'),_0x4586a2,_0x32ff78);_0x18fb99(_0x32ff78);});});}exports[_0x9879('0x17')]=function(_0x59d458){var _0x2ad798=this;return new Promise(function(_0x57d1a4,_0x220033){return db[_0x9879('0x18')]['create'](_0x59d458[_0x9879('0x19')],{'raw':_0x59d458['options']?_0x59d458[_0x9879('0x1a')][_0x9879('0x1b')]===undefined?!![]:![]:!![]})[_0x9879('0xb')](function(_0x465b81){logger[_0x9879('0xc')](_0x9879('0x17'),_0x59d458);logger[_0x9879('0xe')](_0x9879('0x17'),_0x59d458,JSON[_0x9879('0x11')](_0x465b81));_0x57d1a4(_0x465b81);})['catch'](function(_0x2d4a4c){logger[_0x9879('0x12')](_0x9879('0x17'),_0x2d4a4c[_0x9879('0x14')],_0x59d458);_0x220033(_0x2ad798['error'](0x1f4,_0x2d4a4c['message']));});});};exports[_0x9879('0x1c')]=function(_0x4d44b9){var _0x46c296=this;return new Promise(function(_0x4a93cc,_0x140e0f){return db['ChatQueueReport'][_0x9879('0x1d')](_0x4d44b9['body'],{'raw':_0x4d44b9['options']?_0x4d44b9['options'][_0x9879('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d44b9[_0x9879('0x1a')]?_0x4d44b9[_0x9879('0x1a')]['where']||null:null,'attributes':_0x4d44b9['options']?_0x4d44b9[_0x9879('0x1a')][_0x9879('0x1e')]||null:null,'limit':_0x4d44b9[_0x9879('0x1a')]?_0x4d44b9[_0x9879('0x1a')][_0x9879('0x1f')]||null:null})['then'](function(_0xd536bc){logger[_0x9879('0xc')](_0x9879('0x1c'),_0x4d44b9);logger[_0x9879('0xe')](_0x9879('0x1c'),_0x4d44b9,JSON[_0x9879('0x11')](_0xd536bc));_0x4a93cc(_0xd536bc);})['catch'](function(_0x21adb9){logger[_0x9879('0x12')](_0x9879('0x1c'),_0x21adb9[_0x9879('0x14')],_0x4d44b9);_0x140e0f(_0x46c296[_0x9879('0x12')](0x1f4,_0x21adb9[_0x9879('0x14')]));});});}; \ No newline at end of file +var _0x43b7=['message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body','attributes','limit','debug','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x43b7,0x183));var _0x743b=function(_0x302ac3,_0x29436c){_0x302ac3=_0x302ac3-0x0;var _0x46d1cb=_0x43b7[_0x302ac3];return _0x46d1cb;};'use strict';var _=require(_0x743b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x743b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x743b('0x2'));var db=require(_0x743b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x743b('0x4'));var config=require(_0x743b('0x5'));var jayson=require(_0x743b('0x6'));var client=jayson[_0x743b('0x7')][_0x743b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b25ec,_0x2560ad,_0x515ed3){return new BPromise(function(_0x542c29,_0x5c3a06){return client['request'](_0x1b25ec,_0x515ed3)['then'](function(_0xfb58b2){logger[_0x743b('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x2560ad,_0x743b('0xa'));logger['debug'](_0x743b('0xb'),_0x2560ad,_0x743b('0xa'),JSON[_0x743b('0xc')](_0xfb58b2));if(_0xfb58b2[_0x743b('0xd')]){if(_0xfb58b2[_0x743b('0xd')][_0x743b('0xe')]===0x1f4){logger[_0x743b('0xd')](_0x743b('0xf'),_0x2560ad,_0xfb58b2[_0x743b('0xd')][_0x743b('0x10')]);return _0x5c3a06(_0xfb58b2[_0x743b('0xd')]['message']);}logger[_0x743b('0xd')](_0x743b('0xf'),_0x2560ad,_0xfb58b2[_0x743b('0xd')][_0x743b('0x10')]);return _0x542c29(_0xfb58b2[_0x743b('0xd')]['message']);}else{logger[_0x743b('0x9')](_0x743b('0xf'),_0x2560ad,_0x743b('0xa'));_0x542c29(_0xfb58b2[_0x743b('0x11')]['message']);}})['catch'](function(_0x34db76){logger['error'](_0x743b('0xf'),_0x2560ad,_0x34db76);_0x5c3a06(_0x34db76);});});}exports[_0x743b('0x12')]=function(_0x25aba6){var _0x4162ae=this;return new Promise(function(_0x1fc575,_0x652f30){return db[_0x743b('0x13')][_0x743b('0x14')](_0x25aba6['body'],{'raw':_0x25aba6[_0x743b('0x15')]?_0x25aba6['options'][_0x743b('0x16')]===undefined?!![]:![]:!![]})[_0x743b('0x17')](function(_0x2e4a36){logger['info'](_0x743b('0x12'),_0x25aba6);logger['debug'](_0x743b('0x12'),_0x25aba6,JSON[_0x743b('0xc')](_0x2e4a36));_0x1fc575(_0x2e4a36);})['catch'](function(_0x1b4cb1){logger[_0x743b('0xd')](_0x743b('0x12'),_0x1b4cb1[_0x743b('0x10')],_0x25aba6);_0x652f30(_0x4162ae['error'](0x1f4,_0x1b4cb1['message']));});});};exports[_0x743b('0x18')]=function(_0xca2f38){var _0xfacf67=this;return new Promise(function(_0x54f620,_0x1220aa){return db[_0x743b('0x13')][_0x743b('0x19')](_0xca2f38[_0x743b('0x1a')],{'raw':_0xca2f38[_0x743b('0x15')]?_0xca2f38[_0x743b('0x15')][_0x743b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xca2f38[_0x743b('0x15')]?_0xca2f38[_0x743b('0x15')]['where']||null:null,'attributes':_0xca2f38[_0x743b('0x15')]?_0xca2f38[_0x743b('0x15')][_0x743b('0x1b')]||null:null,'limit':_0xca2f38['options']?_0xca2f38[_0x743b('0x15')][_0x743b('0x1c')]||null:null})[_0x743b('0x17')](function(_0x32da37){logger['info']('UpdateChatQueueReport',_0xca2f38);logger[_0x743b('0x1d')]('UpdateChatQueueReport',_0xca2f38,JSON[_0x743b('0xc')](_0x32da37));_0x54f620(_0x32da37);})[_0x743b('0x1e')](function(_0x3997c0){logger[_0x743b('0xd')](_0x743b('0x18'),_0x3997c0[_0x743b('0x10')],_0xca2f38);_0x1220aa(_0xfacf67[_0x743b('0xd')](0x1f4,_0x3997c0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ebd089a..c24c210 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 _0xdc00=['isAuthenticated','describe','show','post','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc00,0x137));var _0x0dc0=function(_0x43683d,_0x45fbfc){_0x43683d=_0x43683d-0x0;var _0x1d6a7d=_0xdc00[_0x43683d];return _0x1d6a7d;};'use strict';var multer=require('multer');var util=require(_0x0dc0('0x0'));var path=require('path');var timeout=require(_0x0dc0('0x1'));var express=require(_0x0dc0('0x2'));var router=express[_0x0dc0('0x3')]();var fs_extra=require(_0x0dc0('0x4'));var auth=require(_0x0dc0('0x5'));var interaction=require(_0x0dc0('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x0dc0('0x7')]('/',auth['isAuthenticated'](),controller[_0x0dc0('0x8')]);router[_0x0dc0('0x7')]('/describe',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xa')]);router[_0x0dc0('0x7')]('/:id',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xb')]);router[_0x0dc0('0xc')]('/',auth[_0x0dc0('0x9')](),controller['create']);router[_0x0dc0('0xd')]('/:id',auth[_0x0dc0('0x9')](),controller[_0x0dc0('0xe')]);router['delete']('/:id',auth[_0x0dc0('0x9')](),controller['destroy']);module[_0x0dc0('0xf')]=router; \ No newline at end of file +var _0xc009=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x41e096,_0x462a02){var _0x5ae577=function(_0x2ad101){while(--_0x2ad101){_0x41e096['push'](_0x41e096['shift']());}};_0x5ae577(++_0x462a02);}(_0xc009,0x12c));var _0x9c00=function(_0x5e7fd0,_0x3ac010){_0x5e7fd0=_0x5e7fd0-0x0;var _0x13f0eb=_0xc009[_0x5e7fd0];return _0x13f0eb;};'use strict';var multer=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var path=require(_0x9c00('0x2'));var timeout=require(_0x9c00('0x3'));var express=require('express');var router=express[_0x9c00('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c00('0x5'));var interaction=require(_0x9c00('0x6'));var config=require('../../config/environment');var controller=require(_0x9c00('0x7'));router[_0x9c00('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c00('0x9')]);router['get'](_0x9c00('0xa'),auth[_0x9c00('0xb')](),controller[_0x9c00('0xc')]);router[_0x9c00('0x8')](_0x9c00('0xd'),auth['isAuthenticated'](),controller[_0x9c00('0xe')]);router[_0x9c00('0xf')]('/',auth[_0x9c00('0xb')](),controller[_0x9c00('0x10')]);router[_0x9c00('0x11')]('/:id',auth[_0x9c00('0xb')](),controller[_0x9c00('0x12')]);router['delete'](_0x9c00('0xd'),auth[_0x9c00('0xb')](),controller[_0x9c00('0x13')]);module[_0x9c00('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ae630cd..f3f19df 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x242e36,_0x883ebf){var _0x5e39ba=function(_0x7e10cc){while(--_0x7e10cc){_0x242e36['push'](_0x242e36['shift']());}};_0x5e39ba(++_0x883ebf);}(_0xedd9,0xfc));var _0x9edd=function(_0x431713,_0x262a07){_0x431713=_0x431713-0x0;var _0x18f1c4=_0xedd9[_0x431713];return _0x18f1c4;};'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 +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x118633,_0x4b833d){var _0x335d3e=function(_0x1371c3){while(--_0x1371c3){_0x118633['push'](_0x118633['shift']());}};_0x335d3e(++_0x4b833d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x352713,_0x737610){_0x352713=_0x352713-0x0;var _0x46a4ea=_0xf3cd[_0x352713];return _0x46a4ea;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4d2453e..26266d1 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 _0xf425=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','findAll','rows','catch','params','rawAttributes','include','options','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0xd18224,_0x5d0ea2){var _0x56229f=function(_0x24faa4){while(--_0x24faa4){_0xd18224['push'](_0xd18224['shift']());}};_0x56229f(++_0x5d0ea2);}(_0xf425,0x101));var _0x5f42=function(_0x1fcc1e,_0x39efee){_0x1fcc1e=_0x1fcc1e-0x0;var _0x13497a=_0xf425[_0x1fcc1e];return _0x13497a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f42('0x0'));var rp=require('request-promise');var moment=require(_0x5f42('0x1'));var BPromise=require(_0x5f42('0x2'));var Mustache=require(_0x5f42('0x3'));var util=require(_0x5f42('0x4'));var path=require(_0x5f42('0x5'));var sox=require(_0x5f42('0x6'));var csv=require(_0x5f42('0x7'));var ejs=require(_0x5f42('0x8'));var fs=require('fs');var fs_extra=require(_0x5f42('0x9'));var _=require(_0x5f42('0xa'));var squel=require(_0x5f42('0xb'));var crypto=require(_0x5f42('0xc'));var jsforce=require(_0x5f42('0xd'));var deskjs=require(_0x5f42('0xe'));var toCsv=require(_0x5f42('0x7'));var querystring=require(_0x5f42('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f42('0x10'));var authService=require(_0x5f42('0x11'));var qs=require(_0x5f42('0x12'));var as=require(_0x5f42('0x13'));var hardwareService=require(_0x5f42('0x14'));var logger=require('../../config/logger')(_0x5f42('0x15'));var utils=require(_0x5f42('0x16'));var config=require(_0x5f42('0x17'));var licenseUtil=require(_0x5f42('0x18'));var db=require(_0x5f42('0x19'))['db'];function respondWithStatusCode(_0x4f7e62,_0x88eb29){_0x88eb29=_0x88eb29||0xcc;return function(_0x7cfa5){if(_0x7cfa5){return _0x4f7e62[_0x5f42('0x1a')](_0x88eb29);}return _0x4f7e62['status'](_0x88eb29)['end']();};}function respondWithResult(_0x59d223,_0x2aff84){_0x2aff84=_0x2aff84||0xc8;return function(_0x1564f7){if(_0x1564f7){return _0x59d223[_0x5f42('0x1b')](_0x2aff84)[_0x5f42('0x1c')](_0x1564f7);}};}function respondWithFilteredResult(_0x550efb,_0x3271eb){return function(_0x1e23f8){if(_0x1e23f8){var _0x44f270=typeof _0x3271eb['offset']===_0x5f42('0x1d')&&typeof _0x3271eb['limit']===_0x5f42('0x1d');var _0x89be24=_0x1e23f8[_0x5f42('0x1e')];var _0x1e30f0=_0x44f270?0x0:_0x3271eb[_0x5f42('0x1f')];var _0x36f8e0=_0x44f270?_0x1e23f8[_0x5f42('0x1e')]:_0x3271eb[_0x5f42('0x1f')]+_0x3271eb[_0x5f42('0x20')];var _0x5eab6f;if(_0x36f8e0>=_0x89be24){_0x36f8e0=_0x89be24;_0x5eab6f=0xc8;}else{_0x5eab6f=0xce;}_0x550efb[_0x5f42('0x1b')](_0x5eab6f);return _0x550efb[_0x5f42('0x21')](_0x5f42('0x22'),_0x1e30f0+'-'+_0x36f8e0+'/'+_0x89be24)['json'](_0x1e23f8);}return null;};}function patchUpdates(_0x18fd9f){return function(_0x406ff2){try{jsonpatch[_0x5f42('0x23')](_0x406ff2,_0x18fd9f,!![]);}catch(_0x4cb914){return BPromise[_0x5f42('0x24')](_0x4cb914);}return _0x406ff2[_0x5f42('0x25')]();};}function saveUpdates(_0x473cd3,_0x394529){return function(_0x31d166){if(_0x31d166){return _0x31d166[_0x5f42('0x26')](_0x473cd3)['then'](function(_0x57495c){return _0x57495c;});}return null;};}function removeEntity(_0x185aec,_0x1be59d){return function(_0x3fe51b){if(_0x3fe51b){return _0x3fe51b[_0x5f42('0x27')]()['then'](function(){_0x185aec[_0x5f42('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4522b3,_0x404715){return function(_0x1e4ab6){if(!_0x1e4ab6){_0x4522b3[_0x5f42('0x1a')](0x194);}return _0x1e4ab6;};}function handleError(_0xec0b98,_0x90b4ef){_0x90b4ef=_0x90b4ef||0x1f4;return function(_0x3b23a1){logger[_0x5f42('0x28')](_0x3b23a1[_0x5f42('0x29')]);if(_0x3b23a1['name']){delete _0x3b23a1[_0x5f42('0x2a')];}_0xec0b98[_0x5f42('0x1b')](_0x90b4ef)['send'](_0x3b23a1);};}exports[_0x5f42('0x2b')]=function(_0x35a1df,_0x169491){var _0x5bb466={},_0x420736={},_0x4484d7={'count':0x0,'rows':[]};var _0x5c9e4f=_[_0x5f42('0x2c')](db[_0x5f42('0x2d')]['rawAttributes'],function(_0x1ae26d){return{'name':_0x1ae26d[_0x5f42('0x2e')],'type':_0x1ae26d[_0x5f42('0x2f')][_0x5f42('0x30')]};});_0x420736[_0x5f42('0x31')]=_[_0x5f42('0x2c')](_0x5c9e4f,_0x5f42('0x2a'));_0x420736[_0x5f42('0x32')]=_[_0x5f42('0x33')](_0x35a1df[_0x5f42('0x32')]);_0x420736[_0x5f42('0x34')]=_[_0x5f42('0x35')](_0x420736[_0x5f42('0x31')],_0x420736[_0x5f42('0x32')]);_0x5bb466['attributes']=_[_0x5f42('0x35')](_0x420736[_0x5f42('0x31')],qs[_0x5f42('0x36')](_0x35a1df[_0x5f42('0x32')]['fields']));_0x5bb466[_0x5f42('0x37')]=_0x5bb466[_0x5f42('0x37')][_0x5f42('0x38')]?_0x5bb466[_0x5f42('0x37')]:_0x420736[_0x5f42('0x31')];if(!_0x35a1df[_0x5f42('0x32')][_0x5f42('0x39')](_0x5f42('0x3a'))){_0x5bb466[_0x5f42('0x20')]=qs[_0x5f42('0x20')](_0x35a1df[_0x5f42('0x32')][_0x5f42('0x20')]);_0x5bb466[_0x5f42('0x1f')]=qs[_0x5f42('0x1f')](_0x35a1df[_0x5f42('0x32')]['offset']);}_0x5bb466[_0x5f42('0x3b')]=qs[_0x5f42('0x3c')](_0x35a1df[_0x5f42('0x32')][_0x5f42('0x3c')]);_0x5bb466[_0x5f42('0x3d')]=qs[_0x5f42('0x34')](_[_0x5f42('0x3e')](_0x35a1df[_0x5f42('0x32')],_0x420736['filters']),_0x5c9e4f);if(_0x35a1df[_0x5f42('0x32')][_0x5f42('0x3f')]){_0x5bb466[_0x5f42('0x3d')]=_[_0x5f42('0x40')](_0x5bb466[_0x5f42('0x3d')],{'$or':_[_0x5f42('0x2c')](_0x5c9e4f,function(_0x38a360){if(_0x38a360[_0x5f42('0x2f')]!==_0x5f42('0x41')){var _0x45d414={};_0x45d414[_0x38a360[_0x5f42('0x2a')]]={'$like':'%'+_0x35a1df[_0x5f42('0x32')]['filter']+'%'};return _0x45d414;}})});}_0x5bb466=_['merge']({},_0x5bb466,_0x35a1df['options']);var _0x5b0c30={'where':_0x5bb466[_0x5f42('0x3d')]};return db['ChatTransferReport'][_0x5f42('0x1e')](_0x5b0c30)[_0x5f42('0x42')](function(_0x59df04){_0x4484d7[_0x5f42('0x1e')]=_0x59df04;if(_0x35a1df['query']['includeAll']){_0x5bb466['include']=[{'all':!![]}];}return db[_0x5f42('0x2d')][_0x5f42('0x43')](_0x5bb466);})['then'](function(_0x23ba43){_0x4484d7[_0x5f42('0x44')]=_0x23ba43;return _0x4484d7;})[_0x5f42('0x42')](respondWithFilteredResult(_0x169491,_0x5bb466))[_0x5f42('0x45')](handleError(_0x169491,null));};exports['show']=function(_0x12cc40,_0x113ecf){var _0x5e6003={'raw':!![],'where':{'id':_0x12cc40[_0x5f42('0x46')]['id']}},_0x98271a={};_0x98271a[_0x5f42('0x31')]=_[_0x5f42('0x33')](db[_0x5f42('0x2d')][_0x5f42('0x47')]);_0x98271a['query']=_[_0x5f42('0x33')](_0x12cc40[_0x5f42('0x32')]);_0x98271a[_0x5f42('0x34')]=_[_0x5f42('0x35')](_0x98271a[_0x5f42('0x31')],_0x98271a[_0x5f42('0x32')]);_0x5e6003[_0x5f42('0x37')]=_['intersection'](_0x98271a[_0x5f42('0x31')],qs[_0x5f42('0x36')](_0x12cc40['query'][_0x5f42('0x36')]));_0x5e6003[_0x5f42('0x37')]=_0x5e6003['attributes'][_0x5f42('0x38')]?_0x5e6003[_0x5f42('0x37')]:_0x98271a[_0x5f42('0x31')];if(_0x12cc40[_0x5f42('0x32')]['includeAll']){_0x5e6003[_0x5f42('0x48')]=[{'all':!![]}];}_0x5e6003=_[_0x5f42('0x40')]({},_0x5e6003,_0x12cc40[_0x5f42('0x49')]);return db['ChatTransferReport'][_0x5f42('0x4a')](_0x5e6003)[_0x5f42('0x42')](handleEntityNotFound(_0x113ecf,null))[_0x5f42('0x42')](respondWithResult(_0x113ecf,null))[_0x5f42('0x45')](handleError(_0x113ecf,null));};exports['create']=function(_0x20311a,_0x642f5b){return db[_0x5f42('0x2d')][_0x5f42('0x4b')](_0x20311a[_0x5f42('0x4c')],{})['then'](respondWithResult(_0x642f5b,0xc9))['catch'](handleError(_0x642f5b,null));};exports[_0x5f42('0x26')]=function(_0x4a3a64,_0x198352){if(_0x4a3a64[_0x5f42('0x4c')]['id']){delete _0x4a3a64['body']['id'];}return db[_0x5f42('0x2d')][_0x5f42('0x4a')]({'where':{'id':_0x4a3a64[_0x5f42('0x46')]['id']}})[_0x5f42('0x42')](handleEntityNotFound(_0x198352,null))[_0x5f42('0x42')](saveUpdates(_0x4a3a64[_0x5f42('0x4c')],null))[_0x5f42('0x42')](respondWithResult(_0x198352,null))[_0x5f42('0x45')](handleError(_0x198352,null));};exports[_0x5f42('0x27')]=function(_0x2c019b,_0x206d85){return db[_0x5f42('0x2d')]['find']({'where':{'id':_0x2c019b[_0x5f42('0x46')]['id']}})[_0x5f42('0x42')](handleEntityNotFound(_0x206d85,null))[_0x5f42('0x42')](removeEntity(_0x206d85,null))[_0x5f42('0x45')](handleError(_0x206d85,null));};exports['describe']=function(_0x1923c2,_0x13e582){return db[_0x5f42('0x2d')][_0x5f42('0x4d')]()[_0x5f42('0x42')](respondWithResult(_0x13e582,null))[_0x5f42('0x45')](handleError(_0x13e582,null));}; \ No newline at end of file +var _0x3991=['params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','send','index','map','ChatTransferReport','fieldName','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','rawAttributes','length','includeAll','catch','create','body','find'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x3991,0x169));var _0x1399=function(_0x329e69,_0x34ff8a){_0x329e69=_0x329e69-0x0;var _0x4814b0=_0x3991[_0x329e69];return _0x4814b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1399('0x0'));var zipdir=require(_0x1399('0x1'));var jsonpatch=require(_0x1399('0x2'));var rp=require(_0x1399('0x3'));var moment=require(_0x1399('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1399('0x5'));var util=require(_0x1399('0x6'));var path=require(_0x1399('0x7'));var sox=require(_0x1399('0x8'));var csv=require(_0x1399('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1399('0xa'));var toCsv=require(_0x1399('0x9'));var querystring=require(_0x1399('0xb'));var Papa=require(_0x1399('0xc'));var Redis=require(_0x1399('0xd'));var authService=require(_0x1399('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1399('0xf'));var logger=require(_0x1399('0x10'))(_0x1399('0x11'));var utils=require(_0x1399('0x12'));var config=require(_0x1399('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2f9f0,_0x1ad70c){_0x1ad70c=_0x1ad70c||0xcc;return function(_0x39929e){if(_0x39929e){return _0xd2f9f0[_0x1399('0x14')](_0x1ad70c);}return _0xd2f9f0[_0x1399('0x15')](_0x1ad70c)[_0x1399('0x16')]();};}function respondWithResult(_0x158928,_0x1171ef){_0x1171ef=_0x1171ef||0xc8;return function(_0xe4774c){if(_0xe4774c){return _0x158928[_0x1399('0x15')](_0x1171ef)[_0x1399('0x17')](_0xe4774c);}};}function respondWithFilteredResult(_0x1c8b45,_0x2b7d4d){return function(_0x2a3fa7){if(_0x2a3fa7){var _0x59154c=typeof _0x2b7d4d[_0x1399('0x18')]===_0x1399('0x19')&&typeof _0x2b7d4d['limit']==='undefined';var _0x34168b=_0x2a3fa7[_0x1399('0x1a')];var _0x5c02f7=_0x59154c?0x0:_0x2b7d4d[_0x1399('0x18')];var _0x4f680e=_0x59154c?_0x2a3fa7[_0x1399('0x1a')]:_0x2b7d4d['offset']+_0x2b7d4d[_0x1399('0x1b')];var _0x3f72a9;if(_0x4f680e>=_0x34168b){_0x4f680e=_0x34168b;_0x3f72a9=0xc8;}else{_0x3f72a9=0xce;}_0x1c8b45[_0x1399('0x15')](_0x3f72a9);return _0x1c8b45['set'](_0x1399('0x1c'),_0x5c02f7+'-'+_0x4f680e+'/'+_0x34168b)[_0x1399('0x17')](_0x2a3fa7);}return null;};}function patchUpdates(_0x5a64e3){return function(_0x289592){try{jsonpatch[_0x1399('0x1d')](_0x289592,_0x5a64e3,!![]);}catch(_0x50ff4d){return BPromise[_0x1399('0x1e')](_0x50ff4d);}return _0x289592[_0x1399('0x1f')]();};}function saveUpdates(_0x2d130b,_0x5ca596){return function(_0x4ec2e7){if(_0x4ec2e7){return _0x4ec2e7[_0x1399('0x20')](_0x2d130b)[_0x1399('0x21')](function(_0x2fa00c){return _0x2fa00c;});}return null;};}function removeEntity(_0x3761cd,_0x563912){return function(_0x3e305a){if(_0x3e305a){return _0x3e305a[_0x1399('0x22')]()[_0x1399('0x21')](function(){_0x3761cd[_0x1399('0x15')](0xcc)[_0x1399('0x16')]();});}};}function handleEntityNotFound(_0x416a34,_0x4522ca){return function(_0x1b2f32){if(!_0x1b2f32){_0x416a34[_0x1399('0x14')](0x194);}return _0x1b2f32;};}function handleError(_0x93f025,_0x5e8f72){_0x5e8f72=_0x5e8f72||0x1f4;return function(_0x5adb0f){logger[_0x1399('0x23')](_0x5adb0f['stack']);if(_0x5adb0f['name']){delete _0x5adb0f['name'];}_0x93f025[_0x1399('0x15')](_0x5e8f72)[_0x1399('0x24')](_0x5adb0f);};}exports[_0x1399('0x25')]=function(_0x12bb71,_0x855b9f){var _0x4d3828={},_0x542a0f={},_0x471ff7={'count':0x0,'rows':[]};var _0x40ff4f=_[_0x1399('0x26')](db[_0x1399('0x27')]['rawAttributes'],function(_0x53787f){return{'name':_0x53787f[_0x1399('0x28')],'type':_0x53787f['type'][_0x1399('0x29')]};});_0x542a0f['model']=_[_0x1399('0x26')](_0x40ff4f,_0x1399('0x2a'));_0x542a0f[_0x1399('0x2b')]=_[_0x1399('0x2c')](_0x12bb71[_0x1399('0x2b')]);_0x542a0f[_0x1399('0x2d')]=_['intersection'](_0x542a0f['model'],_0x542a0f[_0x1399('0x2b')]);_0x4d3828['attributes']=_[_0x1399('0x2e')](_0x542a0f[_0x1399('0x2f')],qs[_0x1399('0x30')](_0x12bb71['query'][_0x1399('0x30')]));_0x4d3828[_0x1399('0x31')]=_0x4d3828['attributes']['length']?_0x4d3828['attributes']:_0x542a0f[_0x1399('0x2f')];if(!_0x12bb71[_0x1399('0x2b')][_0x1399('0x32')](_0x1399('0x33'))){_0x4d3828['limit']=qs[_0x1399('0x1b')](_0x12bb71[_0x1399('0x2b')][_0x1399('0x1b')]);_0x4d3828[_0x1399('0x18')]=qs[_0x1399('0x18')](_0x12bb71['query']['offset']);}_0x4d3828[_0x1399('0x34')]=qs[_0x1399('0x35')](_0x12bb71['query'][_0x1399('0x35')]);_0x4d3828[_0x1399('0x36')]=qs[_0x1399('0x2d')](_[_0x1399('0x37')](_0x12bb71[_0x1399('0x2b')],_0x542a0f[_0x1399('0x2d')]),_0x40ff4f);if(_0x12bb71[_0x1399('0x2b')][_0x1399('0x38')]){_0x4d3828['where']=_[_0x1399('0x39')](_0x4d3828[_0x1399('0x36')],{'$or':_[_0x1399('0x26')](_0x40ff4f,function(_0x46e53a){if(_0x46e53a[_0x1399('0x3a')]!==_0x1399('0x3b')){var _0x28bffa={};_0x28bffa[_0x46e53a['name']]={'$like':'%'+_0x12bb71['query'][_0x1399('0x38')]+'%'};return _0x28bffa;}})});}_0x4d3828=_[_0x1399('0x39')]({},_0x4d3828,_0x12bb71[_0x1399('0x3c')]);var _0x32ce13={'where':_0x4d3828['where']};return db[_0x1399('0x27')][_0x1399('0x1a')](_0x32ce13)['then'](function(_0x4e1670){_0x471ff7['count']=_0x4e1670;if(_0x12bb71[_0x1399('0x2b')]['includeAll']){_0x4d3828[_0x1399('0x3d')]=[{'all':!![]}];}return db[_0x1399('0x27')][_0x1399('0x3e')](_0x4d3828);})[_0x1399('0x21')](function(_0xd1c9ea){_0x471ff7[_0x1399('0x3f')]=_0xd1c9ea;return _0x471ff7;})[_0x1399('0x21')](respondWithFilteredResult(_0x855b9f,_0x4d3828))['catch'](handleError(_0x855b9f,null));};exports['show']=function(_0x40c4e4,_0x5c262c){var _0x5ec458={'raw':!![],'where':{'id':_0x40c4e4['params']['id']}},_0x1bd57a={};_0x1bd57a['model']=_[_0x1399('0x2c')](db[_0x1399('0x27')][_0x1399('0x40')]);_0x1bd57a['query']=_[_0x1399('0x2c')](_0x40c4e4[_0x1399('0x2b')]);_0x1bd57a[_0x1399('0x2d')]=_[_0x1399('0x2e')](_0x1bd57a['model'],_0x1bd57a[_0x1399('0x2b')]);_0x5ec458['attributes']=_[_0x1399('0x2e')](_0x1bd57a[_0x1399('0x2f')],qs[_0x1399('0x30')](_0x40c4e4[_0x1399('0x2b')]['fields']));_0x5ec458['attributes']=_0x5ec458['attributes'][_0x1399('0x41')]?_0x5ec458[_0x1399('0x31')]:_0x1bd57a[_0x1399('0x2f')];if(_0x40c4e4[_0x1399('0x2b')][_0x1399('0x42')]){_0x5ec458[_0x1399('0x3d')]=[{'all':!![]}];}_0x5ec458=_[_0x1399('0x39')]({},_0x5ec458,_0x40c4e4[_0x1399('0x3c')]);return db['ChatTransferReport']['find'](_0x5ec458)[_0x1399('0x21')](handleEntityNotFound(_0x5c262c,null))[_0x1399('0x21')](respondWithResult(_0x5c262c,null))[_0x1399('0x43')](handleError(_0x5c262c,null));};exports[_0x1399('0x44')]=function(_0x36e1c9,_0x5b62ed){return db[_0x1399('0x27')][_0x1399('0x44')](_0x36e1c9[_0x1399('0x45')],{})[_0x1399('0x21')](respondWithResult(_0x5b62ed,0xc9))[_0x1399('0x43')](handleError(_0x5b62ed,null));};exports[_0x1399('0x20')]=function(_0x13ca66,_0x2829e7){if(_0x13ca66[_0x1399('0x45')]['id']){delete _0x13ca66[_0x1399('0x45')]['id'];}return db[_0x1399('0x27')][_0x1399('0x46')]({'where':{'id':_0x13ca66['params']['id']}})[_0x1399('0x21')](handleEntityNotFound(_0x2829e7,null))[_0x1399('0x21')](saveUpdates(_0x13ca66['body'],null))['then'](respondWithResult(_0x2829e7,null))[_0x1399('0x43')](handleError(_0x2829e7,null));};exports[_0x1399('0x22')]=function(_0x35a921,_0x4786c9){return db[_0x1399('0x27')][_0x1399('0x46')]({'where':{'id':_0x35a921[_0x1399('0x47')]['id']}})['then'](handleEntityNotFound(_0x4786c9,null))['then'](removeEntity(_0x4786c9,null))[_0x1399('0x43')](handleError(_0x4786c9,null));};exports['describe']=function(_0x333993,_0x19c0f6){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x19c0f6,null))[_0x1399('0x43')](handleError(_0x19c0f6,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 393166c..3798359 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 _0x4511=['./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4a74db,_0x55a2ed){var _0x1f0c25=function(_0x4c7d3b){while(--_0x4c7d3b){_0x4a74db['push'](_0x4a74db['shift']());}};_0x1f0c25(++_0x55a2ed);}(_0x4511,0x1b1));var _0x1451=function(_0x229e95,_0x2ed8a4){_0x229e95=_0x229e95-0x0;var _0x2e61b0=_0x4511[_0x229e95];return _0x2e61b0;};'use strict';var _=require('lodash');var util=require(_0x1451('0x0'));var logger=require(_0x1451('0x1'))(_0x1451('0x2'));var moment=require(_0x1451('0x3'));var BPromise=require('bluebird');var rp=require(_0x1451('0x4'));var fs=require('fs');var path=require(_0x1451('0x5'));var rimraf=require(_0x1451('0x6'));var config=require('../../config/environment');var attributes=require(_0x1451('0x7'));module[_0x1451('0x8')]=function(_0x3bfb94,_0x50316d){return _0x3bfb94['define'](_0x1451('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x1451('0xa'),'fields':[_0x1451('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8d=['moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4b8d,0xdd));var _0xd4b8=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x4b8d[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0xd4b8('0x0'));var util=require(_0xd4b8('0x1'));var logger=require('../../config/logger')(_0xd4b8('0x2'));var moment=require(_0xd4b8('0x3'));var BPromise=require('bluebird');var rp=require(_0xd4b8('0x4'));var fs=require('fs');var path=require(_0xd4b8('0x5'));var rimraf=require(_0xd4b8('0x6'));var config=require(_0xd4b8('0x7'));var attributes=require(_0xd4b8('0x8'));module[_0xd4b8('0x9')]=function(_0x465362,_0x1b5632){return _0x465362[_0xd4b8('0xa')](_0xd4b8('0xb'),attributes,{'tableName':_0xd4b8('0xc'),'paranoid':![],'indexes':[{'name':_0xd4b8('0xd'),'fields':[_0xd4b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3be1047..8d68ba6 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 _0x0a3c=['result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x3bd139,_0x52a505){var _0xa9342a=function(_0xb2a913){while(--_0xb2a913){_0x3bd139['push'](_0x3bd139['shift']());}};_0xa9342a(++_0x52a505);}(_0x0a3c,0x145));var _0xc0a3=function(_0x28eba2,_0x3ba8f0){_0x28eba2=_0x28eba2-0x0;var _0x50aefe=_0x0a3c[_0x28eba2];return _0x50aefe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0a3('0x0'));var BPromise=require('bluebird');var rs=require(_0xc0a3('0x1'));var fs=require('fs');var Redis=require(_0xc0a3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0a3('0x3'));var logger=require(_0xc0a3('0x4'))(_0xc0a3('0x5'));var config=require(_0xc0a3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc0a3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3575e5,_0x2832e4,_0x39e17e){return new BPromise(function(_0x522444,_0xe991fc){return client['request'](_0x3575e5,_0x39e17e)['then'](function(_0x19c7b0){logger[_0xc0a3('0x8')]('ChatTransferReport,\x20%s,\x20%s',_0x2832e4,_0xc0a3('0x9'));logger[_0xc0a3('0xa')](_0xc0a3('0xb'),_0x2832e4,_0xc0a3('0x9'),JSON[_0xc0a3('0xc')](_0x19c7b0));if(_0x19c7b0['error']){if(_0x19c7b0[_0xc0a3('0xd')][_0xc0a3('0xe')]===0x1f4){logger['error'](_0xc0a3('0xf'),_0x2832e4,_0x19c7b0[_0xc0a3('0xd')][_0xc0a3('0x10')]);return _0xe991fc(_0x19c7b0[_0xc0a3('0xd')][_0xc0a3('0x10')]);}logger['error'](_0xc0a3('0xf'),_0x2832e4,_0x19c7b0['error'][_0xc0a3('0x10')]);return _0x522444(_0x19c7b0['error'][_0xc0a3('0x10')]);}else{logger[_0xc0a3('0x8')](_0xc0a3('0xf'),_0x2832e4,_0xc0a3('0x9'));_0x522444(_0x19c7b0[_0xc0a3('0x11')][_0xc0a3('0x10')]);}})[_0xc0a3('0x12')](function(_0x203bd0){logger[_0xc0a3('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2832e4,_0x203bd0);_0xe991fc(_0x203bd0);});});} \ No newline at end of file +var _0xbb9a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xbb9a,0xed));var _0xabb9=function(_0x2f95ff,_0x49cb96){_0x2f95ff=_0x2f95ff-0x0;var _0x15a956=_0xbb9a[_0x2f95ff];return _0x15a956;};'use strict';var _=require(_0xabb9('0x0'));var util=require(_0xabb9('0x1'));var moment=require(_0xabb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xabb9('0x3'));var fs=require('fs');var Redis=require(_0xabb9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xabb9('0x5'))(_0xabb9('0x6'));var config=require(_0xabb9('0x7'));var jayson=require(_0xabb9('0x8'));var client=jayson[_0xabb9('0x9')][_0xabb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef406,_0x17080b,_0x505f28){return new BPromise(function(_0x336c88,_0x5904c5){return client[_0xabb9('0xb')](_0xef406,_0x505f28)[_0xabb9('0xc')](function(_0x45c07a){logger[_0xabb9('0xd')](_0xabb9('0xe'),_0x17080b,_0xabb9('0xf'));logger[_0xabb9('0x10')](_0xabb9('0x11'),_0x17080b,_0xabb9('0xf'),JSON[_0xabb9('0x12')](_0x45c07a));if(_0x45c07a['error']){if(_0x45c07a[_0xabb9('0x13')]['code']===0x1f4){logger['error'](_0xabb9('0xe'),_0x17080b,_0x45c07a[_0xabb9('0x13')]['message']);return _0x5904c5(_0x45c07a[_0xabb9('0x13')][_0xabb9('0x14')]);}logger[_0xabb9('0x13')](_0xabb9('0xe'),_0x17080b,_0x45c07a[_0xabb9('0x13')][_0xabb9('0x14')]);return _0x336c88(_0x45c07a[_0xabb9('0x13')][_0xabb9('0x14')]);}else{logger[_0xabb9('0xd')](_0xabb9('0xe'),_0x17080b,'request\x20sent');_0x336c88(_0x45c07a[_0xabb9('0x15')]['message']);}})['catch'](function(_0x28bfe9){logger[_0xabb9('0x13')](_0xabb9('0xe'),_0x17080b,_0x28bfe9);_0x5904c5(_0x28bfe9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1899524..6631d7b 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 _0x887f=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0x887f,0x9a));var _0xf887=function(_0x61d54,_0x4f4e36){_0x61d54=_0x61d54-0x0;var _0x31be6b=_0x887f[_0x61d54];return _0x31be6b;};'use strict';var multer=require(_0xf887('0x0'));var util=require(_0xf887('0x1'));var path=require('path');var timeout=require(_0xf887('0x2'));var express=require(_0xf887('0x3'));var router=express[_0xf887('0x4')]();var fs_extra=require(_0xf887('0x5'));var auth=require(_0xf887('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf887('0x7'));var controller=require('./chatTransferReport.controller');router[_0xf887('0x8')]('/',auth[_0xf887('0x9')](),controller[_0xf887('0xa')]);router[_0xf887('0x8')]('/describe',auth[_0xf887('0x9')](),controller[_0xf887('0xb')]);router[_0xf887('0x8')](_0xf887('0xc'),auth[_0xf887('0x9')](),controller[_0xf887('0xd')]);router['post']('/',auth[_0xf887('0x9')](),controller[_0xf887('0xe')]);router[_0xf887('0xf')](_0xf887('0xc'),auth[_0xf887('0x9')](),controller[_0xf887('0x10')]);router['delete'](_0xf887('0xc'),auth[_0xf887('0x9')](),controller[_0xf887('0x11')]);module[_0xf887('0x12')]=router; \ No newline at end of file +var _0x8cda=['express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3b6cc7,_0x5df0c1){var _0x37f564=function(_0x160517){while(--_0x160517){_0x3b6cc7['push'](_0x3b6cc7['shift']());}};_0x37f564(++_0x5df0c1);}(_0x8cda,0x176));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa8cd('0x0'));var util=require(_0xa8cd('0x1'));var path=require(_0xa8cd('0x2'));var timeout=require(_0xa8cd('0x3'));var express=require(_0xa8cd('0x4'));var router=express[_0xa8cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa8cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8cd('0x7'));var controller=require('./chatTransferReport.controller');router[_0xa8cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8cd('0x9')]);router[_0xa8cd('0x8')](_0xa8cd('0xa'),auth[_0xa8cd('0xb')](),controller[_0xa8cd('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa8cd('0xd')]);router[_0xa8cd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa8cd('0xf')]);router[_0xa8cd('0x10')](_0xa8cd('0x11'),auth[_0xa8cd('0xb')](),controller['update']);router[_0xa8cd('0x12')](_0xa8cd('0x11'),auth[_0xa8cd('0xb')](),controller[_0xa8cd('0x13')]);module[_0xa8cd('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a9639db..6ee849a 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 _0xe666=['setDataValue','onlineForm','stringify','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','input','name','text','getDataValue','parse'];(function(_0x497bdc,_0x3284e9){var _0x438a91=function(_0x5ad668){while(--_0x5ad668){_0x497bdc['push'](_0x497bdc['shift']());}};_0x438a91(++_0x3284e9);}(_0xe666,0x1f1));var _0x6e66=function(_0x179078,_0x17d88e){_0x179078=_0x179078-0x0;var _0x355f6d=_0xe666[_0x179078];return _0x355f6d;};'use strict';var Sequelize=require(_0x6e66('0x0'));var rs=require(_0x6e66('0x1'));module[_0x6e66('0x2')]={'name':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![],'unique':_0x6e66('0x4')},'description':{'type':Sequelize[_0x6e66('0x3')]},'mapKey':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x5')},'key':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x6')},'customerAlias':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![],'defaultValue':_0x6e66('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6e66('0x9')](_0x6e66('0xa'),_0x6e66('0xb')),'defaultValue':_0x6e66('0xa')},'header_online':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0xc')},'start_chat_button':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0xd')},'offline_chat_button':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0xe')},'header_offline':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0xf')},'download_transcript':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6e66('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x15')},'placeholderMessage':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x17')},'closingMessageButton':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0xe')},'skipMessageButton':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x18')},'conditionAgreement':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x6e66('0x9')](_0x6e66('0x19'),_0x6e66('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6e66('0x1b')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6e66('0x1c'),'variable':null,'config':{'placeholder':_0x6e66('0x1d'),'type':_0x6e66('0x1e'),'required':!![]},'props':{'title':_0x6e66('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x6e66('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e66('0x5'),'type':_0x6e66('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6e66('0x1f')]('onlineForm')?JSON[_0x6e66('0x20')](this['getDataValue']('onlineForm')):{};},'set':function(_0x59543a){return this[_0x6e66('0x21')](_0x6e66('0x22'),JSON['stringify'](_0x59543a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x6e66('0x23')]({'items':[{'type':_0x6e66('0x1c'),'props':{'title':_0x6e66('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e66('0x5'),'type':_0x6e66('0x5')},'variable':null},{'type':_0x6e66('0x24'),'config':{'placeholder':_0x6e66('0x25')},'props':{'title':_0x6e66('0x25'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6e66('0x1f')]('offlineForm')?JSON[_0x6e66('0x20')](this[_0x6e66('0x1f')](_0x6e66('0x26'))):{};},'set':function(_0xa8ab2b){return this[_0x6e66('0x21')](_0x6e66('0x26'),JSON[_0x6e66('0x23')](_0xa8ab2b));}},'token':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':function(){return rs[_0x6e66('0x27')]();}},'autoclose':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6e66('0x3')]},'forwardOffline':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6e66('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['STRING'],'defaultValue':_0x6e66('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x18')},'sendUnmanaged':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6e66('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6e66('0x1b')],'defaultValue':function(){return _0x6e66('0x2b');}},'notificationSound':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6e66('0x10')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':_0x6e66('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x2e')},'defaultTitle':{'type':Sequelize[_0x6e66('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6e66('0x10')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6e66('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e66('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6e66('0x30')},'systemAvatar':{'type':Sequelize[_0x6e66('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6e66('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![],'comment':_0x6e66('0x32'),'set':function(_0x3c2f70){if(!_0x3c2f70)this[_0x6e66('0x21')]('mandatoryDispositionPauseId',null);this[_0x6e66('0x21')](_0x6e66('0x33'),_0x3c2f70);}},'vidaooEscalation':{'type':Sequelize[_0x6e66('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6e66('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6e66('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x6e66('0x3')],'defaultValue':function(){return _0x6e66('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x6e66('0x1b')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6e66('0x1b')]}}; \ No newline at end of file +var _0x8d6f=['squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','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','Agent','#011F6A','INTEGER','BOOLEAN','ENUM'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8d6f,0x8e));var _0xf8d6=function(_0x54914d,_0x27207b){_0x54914d=_0x54914d-0x0;var _0x125d2f=_0x8d6f[_0x54914d];return _0x125d2f;};'use strict';var Sequelize=require(_0xf8d6('0x0'));var rs=require(_0xf8d6('0x1'));module[_0xf8d6('0x2')]={'name':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf8d6('0x4')},'description':{'type':Sequelize[_0xf8d6('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0x5')},'mapKeyOffline':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x5')},'key':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x6')},'customerAlias':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![],'defaultValue':_0xf8d6('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf8d6('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf8d6('0x3')]},'animation':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf8d6('0xa')]('rounded',_0xf8d6('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0xc')},'offline_chat_button':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0xd')},'header_offline':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0xe')},'download_transcript':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf8d6('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf8d6('0x10')]},'closingQuestion':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0x14')},'closingMessage':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0xd')},'skipMessageButton':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x15')},'conditionAgreement':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x16')},'ratingType':{'type':Sequelize[_0xf8d6('0xa')](_0xf8d6('0x17'),_0xf8d6('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf8d6('0x10')],'defaultValue':function(){return JSON[_0xf8d6('0x19')]({'items':[{'type':_0xf8d6('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0xf8d6('0x1b'),'required':!![]},'props':{'title':_0xf8d6('0x1c'),'helpText':''}},{'type':_0xf8d6('0x1a'),'props':{'title':_0xf8d6('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xf8d6('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf8d6('0x1d')](_0xf8d6('0x1e'))?JSON[_0xf8d6('0x1f')](this['getDataValue'](_0xf8d6('0x1e'))):{};},'set':function(_0x55a435){return this[_0xf8d6('0x20')](_0xf8d6('0x1e'),JSON['stringify'](_0x55a435));}},'offlineForm':{'type':Sequelize[_0xf8d6('0x10')],'defaultValue':function(){return JSON[_0xf8d6('0x19')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf8d6('0x5')},'variable':null},{'type':_0xf8d6('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0xf8d6('0x22'),'helpText':_0xf8d6('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xf8d6('0x1d')](_0xf8d6('0x24'))?JSON['parse'](this[_0xf8d6('0x1d')]('offlineForm')):{};},'set':function(_0x10a5b5){return this['setDataValue']('offlineForm',JSON['stringify'](_0x10a5b5));}},'token':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':function(){return rs[_0xf8d6('0x25')]();}},'autoclose':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf8d6('0x3')]},'forwardOffline':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf8d6('0x3')]},'waitingTitle':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf8d6('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x27')},'offlineMessageBody':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x15')},'sendUnmanaged':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf8d6('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf8d6('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x2a')},'messagesAlignment':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x2b')},'defaultTitle':{'type':Sequelize[_0xf8d6('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':_0xf8d6('0x2c')},'systemAvatar':{'type':Sequelize[_0xf8d6('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf8d6('0x8')],'comment':_0xf8d6('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xf8d6('0x9')],'defaultValue':![],'comment':_0xf8d6('0x2e'),'set':function(_0x47590e){if(!_0x47590e)this[_0xf8d6('0x20')](_0xf8d6('0x2f'),null);this[_0xf8d6('0x20')](_0xf8d6('0x30'),_0x47590e);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xf8d6('0x3')],'allowNull':![],'defaultValue':_0xf8d6('0x31')},'vidaooNote':{'type':Sequelize[_0xf8d6('0x3')],'defaultValue':function(){return _0xf8d6('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xf8d6('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf8d6('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c8ff81b..929363c 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 _0x3e9d=['list','priority','asc','account','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','toPairsIn','lastName','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getSnippet','iftime\x20%s,%s','interval','timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','custom','License','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','verticalAlignment','color','labelText','textColor','color_button','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','ChatWebsiteId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','Applications','List','applications'];(function(_0x5c9359,_0x1174ef){var _0x3471ba=function(_0x3f4bc7){while(--_0x3f4bc7){_0x5c9359['push'](_0x5c9359['shift']());}};_0x3471ba(++_0x1174ef);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x1d0a5b,_0x1f2d0f){_0x1d0a5b=_0x1d0a5b-0x0;var _0x59e805=_0x3e9d[_0x1d0a5b];return _0x59e805;};'use strict';var BPromise=require(_0xd3e9('0x0'));var Mustache=require(_0xd3e9('0x1'));var util=require('util');var path=require(_0xd3e9('0x2'));var ejs=require(_0xd3e9('0x3'));var fs=require('fs');var fs_extra=require(_0xd3e9('0x4'));var _=require(_0xd3e9('0x5'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0xd3e9('0x6'));var logger=require(_0xd3e9('0x7'))(_0xd3e9('0x8'));var config=require(_0xd3e9('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd3e9('0xa')](config[_0xd3e9('0xb')],{'host':_0xd3e9('0xc'),'port':0x18eb});var socket=require(_0xd3e9('0xd'))(new Redis(config[_0xd3e9('0xb')]));require(_0xd3e9('0xe'))[_0xd3e9('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xd3e9('0x10'));var client=jayson[_0xd3e9('0x11')][_0xd3e9('0x12')]({'port':0x232c});var client9002=jayson[_0xd3e9('0x11')][_0xd3e9('0x12')]({'port':0x232a});var client9003=jayson[_0xd3e9('0x11')][_0xd3e9('0x12')]({'port':0x232b});var client9001=jayson[_0xd3e9('0x11')][_0xd3e9('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x128dca,_0x511c02,_0x19fcdc,_0x49ad73){return new BPromise(function(_0x52fd43,_0x5185a1){var _0x445a6a=_0x49ad73||client;return _0x445a6a[_0xd3e9('0x13')](_0x128dca,_0x19fcdc)[_0xd3e9('0x14')](function(_0x7d59fd){logger[_0xd3e9('0x15')](_0xd3e9('0x16'),_0x511c02,_0xd3e9('0x17'));logger[_0xd3e9('0x18')](_0xd3e9('0x19'),_0x511c02,'request\x20sent',JSON[_0xd3e9('0x1a')](_0x7d59fd));if(_0x7d59fd['error']){if(_0x7d59fd[_0xd3e9('0x1b')]['code']===0x1f4){logger['error'](_0xd3e9('0x16'),_0x511c02,_0x7d59fd['error']['message']);return _0x5185a1(_0x7d59fd[_0xd3e9('0x1b')][_0xd3e9('0x1c')]);}logger['error'](_0xd3e9('0x16'),_0x511c02,_0x7d59fd[_0xd3e9('0x1b')]['message']);return _0x52fd43(_0x7d59fd[_0xd3e9('0x1b')]['message']);}else{logger[_0xd3e9('0x15')](_0xd3e9('0x16'),_0x511c02,_0xd3e9('0x17'));_0x52fd43(_0x7d59fd['result']['message']);}})[_0xd3e9('0x1d')](function(_0x51d352){logger[_0xd3e9('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x511c02,_0x51d352);_0x5185a1(_0x51d352);});});}function respondWithStatusCode(_0x8426d9,_0x34a3f9){_0x34a3f9=_0x34a3f9||0xcc;return function(_0x5017be){if(_0x5017be){return _0x8426d9[_0xd3e9('0x1e')](_0x34a3f9);}return _0x8426d9[_0xd3e9('0x1f')](_0x34a3f9)[_0xd3e9('0x20')]();};}function respondWithResult(_0x5484af,_0x54b5e6){_0x54b5e6=_0x54b5e6||0xc8;return function(_0x4d1b7e){if(_0x4d1b7e){return _0x5484af[_0xd3e9('0x1f')](_0x54b5e6)[_0xd3e9('0x21')](_0x4d1b7e);}};}function respondWithFilteredResult(_0x20aebc,_0x1c715a){return function(_0x5ebb7b){if(_0x5ebb7b){var _0x5099d6=typeof _0x1c715a['offset']===_0xd3e9('0x22')&&typeof _0x1c715a[_0xd3e9('0x23')]===_0xd3e9('0x22');var _0x4a3e1e=_0x5ebb7b[_0xd3e9('0x24')];var _0x2898d0=_0x5099d6?0x0:_0x1c715a[_0xd3e9('0x25')];var _0x4e1564=_0x5099d6?_0x5ebb7b[_0xd3e9('0x24')]:_0x1c715a[_0xd3e9('0x25')]+_0x1c715a[_0xd3e9('0x23')];var _0x12ee4d;if(_0x4e1564>=_0x4a3e1e){_0x4e1564=_0x4a3e1e;_0x12ee4d=0xc8;}else{_0x12ee4d=0xce;}_0x20aebc[_0xd3e9('0x1f')](_0x12ee4d);return _0x20aebc[_0xd3e9('0x26')](_0xd3e9('0x27'),_0x2898d0+'-'+_0x4e1564+'/'+_0x4a3e1e)[_0xd3e9('0x21')](_0x5ebb7b);}return null;};}function saveUpdates(_0x56c8bf){return function(_0x5ae4f0){if(_0x5ae4f0){return _0x5ae4f0['update'](_0x56c8bf)[_0xd3e9('0x14')](function(_0x22e8ed){return _0x22e8ed;});}return null;};}function removeEntity(_0x3f236e){return function(_0x5cd05a){if(_0x5cd05a){return _0x5cd05a[_0xd3e9('0x28')]()['then'](function(){var _0x11546d=_0x5cd05a['get']({'plain':!![]});var _0x29dbbc=_0xd3e9('0x29');return db[_0xd3e9('0x2a')][_0xd3e9('0x28')]({'where':{'type':_0x29dbbc,'resourceId':_0x11546d['id']}})[_0xd3e9('0x14')](function(){return _0x5cd05a;});})['then'](function(){_0x3f236e[_0xd3e9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b08da){return function(_0x1c141d){if(!_0x1c141d){_0x3b08da['sendStatus'](0x194);}return _0x1c141d;};}function handleError(_0x3e2b8d,_0x2cd985){_0x2cd985=_0x2cd985||0x1f4;return function(_0x166420){logger['error'](_0x166420[_0xd3e9('0x2b')]);if(_0x166420[_0xd3e9('0x2c')]){delete _0x166420[_0xd3e9('0x2c')];}_0x3e2b8d[_0xd3e9('0x1f')](_0x2cd985)[_0xd3e9('0x2d')](_0x166420);};}exports['index']=function(_0x122458,_0x99bec7){var _0x3b266f={'include':[{'model':db[_0xd3e9('0x2e')],'as':_0xd3e9('0x2f')}]},_0x43ab36={},_0x2c7814={'count':0x0,'rows':[]};var _0x5c002f=_['map'](db[_0xd3e9('0x30')][_0xd3e9('0x31')],function(_0x16e8b8){return{'name':_0x16e8b8['fieldName'],'type':_0x16e8b8[_0xd3e9('0x32')][_0xd3e9('0x33')]};});_0x43ab36[_0xd3e9('0x34')]=_[_0xd3e9('0x35')](_0x5c002f,_0xd3e9('0x2c'));_0x43ab36[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x122458['query']);_0x43ab36['filters']=_[_0xd3e9('0x38')](_0x43ab36[_0xd3e9('0x34')],_0x43ab36[_0xd3e9('0x36')]);_0x3b266f[_0xd3e9('0x39')]=_[_0xd3e9('0x38')](_0x43ab36[_0xd3e9('0x34')],qs['fields'](_0x122458[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x3b266f[_0xd3e9('0x39')]=_0x3b266f['attributes'][_0xd3e9('0x3b')]?_0x3b266f[_0xd3e9('0x39')]:_0x43ab36[_0xd3e9('0x34')];if(!_0x122458[_0xd3e9('0x36')]['hasOwnProperty'](_0xd3e9('0x3c'))){_0x3b266f['limit']=qs[_0xd3e9('0x23')](_0x122458[_0xd3e9('0x36')][_0xd3e9('0x23')]);_0x3b266f[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x122458[_0xd3e9('0x36')][_0xd3e9('0x25')]);}_0x3b266f[_0xd3e9('0x3d')]=qs[_0xd3e9('0x3e')](_0x122458[_0xd3e9('0x36')][_0xd3e9('0x3e')]);_0x3b266f[_0xd3e9('0x3f')]=qs[_0xd3e9('0x40')](_[_0xd3e9('0x41')](_0x122458[_0xd3e9('0x36')],_0x43ab36[_0xd3e9('0x40')]),_0x5c002f);if(_0x122458[_0xd3e9('0x36')][_0xd3e9('0x42')]){_0x3b266f[_0xd3e9('0x3f')]=_[_0xd3e9('0x43')](_0x3b266f[_0xd3e9('0x3f')],{'$or':_[_0xd3e9('0x35')](_0x5c002f,function(_0x2c609d){if(_0x2c609d[_0xd3e9('0x32')]!==_0xd3e9('0x44')){var _0xf19bf5={};_0xf19bf5[_0x2c609d[_0xd3e9('0x2c')]]={'$like':'%'+_0x122458['query'][_0xd3e9('0x42')]+'%'};return _0xf19bf5;}})});}_0x3b266f=_[_0xd3e9('0x43')]({},_0x3b266f,_0x122458[_0xd3e9('0x45')]);var _0x30961f={'where':_0x3b266f[_0xd3e9('0x3f')]};return db[_0xd3e9('0x30')]['count'](_0x30961f)[_0xd3e9('0x14')](function(_0x5ecea0){_0x2c7814[_0xd3e9('0x24')]=_0x5ecea0;if(_0x122458[_0xd3e9('0x36')]['includeAll']){_0x3b266f[_0xd3e9('0x46')]=[{'all':!![]}];}return db[_0xd3e9('0x30')][_0xd3e9('0x47')](_0x3b266f);})[_0xd3e9('0x14')](function(_0x3f10ba){_0x2c7814[_0xd3e9('0x48')]=_0x3f10ba;return _0x2c7814;})[_0xd3e9('0x14')](respondWithFilteredResult(_0x99bec7,_0x3b266f))['catch'](handleError(_0x99bec7,null));};exports[_0xd3e9('0x49')]=function(_0x52ab91,_0x3e0c58){var _0x7b813a={'raw':![],'where':{'id':_0x52ab91[_0xd3e9('0x4a')]['id']},'include':[{'model':db[_0xd3e9('0x2e')],'as':_0xd3e9('0x2f')}]},_0x548cca={};_0x548cca['model']=_['keys'](db[_0xd3e9('0x30')][_0xd3e9('0x31')]);_0x548cca['query']=_[_0xd3e9('0x37')](_0x52ab91[_0xd3e9('0x36')]);_0x548cca['filters']=_[_0xd3e9('0x38')](_0x548cca['model'],_0x548cca[_0xd3e9('0x36')]);_0x7b813a[_0xd3e9('0x39')]=_['intersection'](_0x548cca[_0xd3e9('0x34')],qs['fields'](_0x52ab91['query'][_0xd3e9('0x3a')]));_0x7b813a[_0xd3e9('0x39')]=_0x7b813a[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x7b813a[_0xd3e9('0x39')]:_0x548cca[_0xd3e9('0x34')];if(_0x52ab91[_0xd3e9('0x36')][_0xd3e9('0x4b')]){_0x7b813a[_0xd3e9('0x46')]=[{'all':!![]}];}_0x7b813a=_[_0xd3e9('0x43')]({},_0x7b813a,_0x52ab91[_0xd3e9('0x45')]);return db['ChatWebsite'][_0xd3e9('0x4c')](_0x7b813a)[_0xd3e9('0x14')](handleEntityNotFound(_0x3e0c58,null))['then'](respondWithResult(_0x3e0c58,null))[_0xd3e9('0x1d')](handleError(_0x3e0c58,null));};exports['create']=function(_0x498ac1,_0x1e66b6){return db[_0xd3e9('0x30')]['create'](_0x498ac1['body'],{})[_0xd3e9('0x14')](function(_0x532e01){var _0x5077e0=_0x498ac1[_0xd3e9('0x4d')]['get']({'plain':!![]});if(!_0x5077e0)throw new Error(_0xd3e9('0x4e'));if(_0x5077e0[_0xd3e9('0x4f')]===_0xd3e9('0x4d')){var _0x270398=_0x532e01[_0xd3e9('0x50')]({'plain':!![]});var _0x3e2af3=_0xd3e9('0x29');return db[_0xd3e9('0x51')][_0xd3e9('0x4c')]({'where':{'name':_0x3e2af3,'userProfileId':_0x5077e0['userProfileId']},'raw':!![]})['then'](function(_0x1f8501){if(_0x1f8501&&_0x1f8501[_0xd3e9('0x52')]===0x0){return db[_0xd3e9('0x2a')]['create']({'name':_0x270398[_0xd3e9('0x2c')],'resourceId':_0x270398['id'],'type':_0x1f8501['name'],'sectionId':_0x1f8501['id']},{})[_0xd3e9('0x14')](function(){return _0x532e01;});}else{return _0x532e01;}})[_0xd3e9('0x1d')](function(_0x671810){logger['error'](_0xd3e9('0x53'),_0x671810);throw _0x671810;});}return _0x532e01;})[_0xd3e9('0x14')](respondWithResult(_0x1e66b6,0xc9))[_0xd3e9('0x1d')](handleError(_0x1e66b6,null));};exports[_0xd3e9('0x54')]=function(_0x59f3ff,_0x120762){if(_0x59f3ff[_0xd3e9('0x55')]['id']){delete _0x59f3ff[_0xd3e9('0x55')]['id'];}return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x59f3ff[_0xd3e9('0x4a')]['id']},'include':[{'model':db[_0xd3e9('0x2e')],'as':_0xd3e9('0x2f')}]})['then'](handleEntityNotFound(_0x120762,null))[_0xd3e9('0x14')](saveUpdates(_0x59f3ff[_0xd3e9('0x55')],null))['then'](respondWithResult(_0x120762,null))[_0xd3e9('0x1d')](handleError(_0x120762,null));};exports[_0xd3e9('0x28')]=function(_0x129ef0,_0x24e4b6){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x129ef0[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x24e4b6,null))['then'](removeEntity(_0x24e4b6,null))['catch'](handleError(_0x24e4b6,null));};exports[_0xd3e9('0x56')]=function(_0x4ae30b,_0x55298d){return db['ChatWebsite'][_0xd3e9('0x56')]()[_0xd3e9('0x14')](respondWithResult(_0x55298d,null))[_0xd3e9('0x1d')](handleError(_0x55298d,null));};exports['addDisposition']=function(_0x40229d,_0x1a4182){if(_0x40229d[_0xd3e9('0x55')]['id']){delete _0x40229d['body']['id'];}return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x40229d[_0xd3e9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a4182,null))[_0xd3e9('0x14')](function(_0x5dc96c){if(_0x5dc96c){_0x40229d[_0xd3e9('0x55')][_0xd3e9('0x57')]=_0x5dc96c['id'];return db[_0xd3e9('0x58')][_0xd3e9('0x59')](_0x40229d[_0xd3e9('0x55')]);}})[_0xd3e9('0x14')](respondWithResult(_0x1a4182,null))[_0xd3e9('0x1d')](handleError(_0x1a4182,null));};exports[_0xd3e9('0x5a')]=function(_0x596b1e,_0x107c12){var _0x29c782={'raw':![],'where':{}};var _0x555bd8={};var _0x3b088d={'count':0x0,'rows':[]};return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x596b1e[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x107c12,null))[_0xd3e9('0x14')](function(_0x5b0f27){if(_0x5b0f27){_0x555bd8['model']=_['keys'](db[_0xd3e9('0x58')][_0xd3e9('0x31')]);_0x555bd8[_0xd3e9('0x36')]=_['keys'](_0x596b1e[_0xd3e9('0x36')]);_0x555bd8[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x555bd8[_0xd3e9('0x34')],_0x555bd8[_0xd3e9('0x36')]);_0x29c782['attributes']=_['intersection'](_0x555bd8[_0xd3e9('0x34')],qs[_0xd3e9('0x3a')](_0x596b1e['query'][_0xd3e9('0x3a')]));_0x29c782[_0xd3e9('0x39')]=_0x29c782[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x29c782[_0xd3e9('0x39')]:_0x555bd8[_0xd3e9('0x34')];if(!_0x596b1e[_0xd3e9('0x36')]['hasOwnProperty'](_0xd3e9('0x3c'))){_0x29c782[_0xd3e9('0x23')]=qs[_0xd3e9('0x23')](_0x596b1e[_0xd3e9('0x36')][_0xd3e9('0x23')]);_0x29c782[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x596b1e[_0xd3e9('0x36')][_0xd3e9('0x25')]);}_0x29c782['order']=qs['sort'](_0x596b1e['query'][_0xd3e9('0x3e')]);_0x29c782[_0xd3e9('0x3f')]=qs[_0xd3e9('0x40')](_[_0xd3e9('0x41')](_0x596b1e[_0xd3e9('0x36')],_0x555bd8[_0xd3e9('0x40')]));_0x29c782[_0xd3e9('0x3f')][_0xd3e9('0x57')]=_0x5b0f27['id'];if(_0x596b1e[_0xd3e9('0x36')][_0xd3e9('0x42')]){_0x29c782[_0xd3e9('0x3f')]=_[_0xd3e9('0x43')](_0x29c782[_0xd3e9('0x3f')],{'$or':_[_0xd3e9('0x35')](_0x29c782[_0xd3e9('0x39')],function(_0x12e7d6){var _0x56fbd6={};_0x56fbd6[_0x12e7d6]={'$like':'%'+_0x596b1e[_0xd3e9('0x36')][_0xd3e9('0x42')]+'%'};return _0x56fbd6;})});}_0x29c782=_['merge']({},_0x29c782,_0x596b1e['options']);return db[_0xd3e9('0x58')][_0xd3e9('0x24')]({'where':_0x29c782['where']})[_0xd3e9('0x14')](function(_0x5cb187){_0x3b088d['count']=_0x5cb187;if(_0x596b1e['query']['includeAll']){_0x29c782[_0xd3e9('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xd3e9('0x47')](_0x29c782);})['then'](function(_0x251e49){_0x3b088d['rows']=_0x251e49;return _0x3b088d;});}})['then'](respondWithFilteredResult(_0x107c12,_0x29c782))[_0xd3e9('0x1d')](handleError(_0x107c12,null));};exports['removeDispositions']=function(_0x55ddef,_0x12faa9){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x55ddef[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x12faa9,null))[_0xd3e9('0x14')](function(_0x39c90c){if(_0x39c90c){return _0x39c90c[_0xd3e9('0x5c')](_0x55ddef[_0xd3e9('0x36')][_0xd3e9('0x5d')]);}})[_0xd3e9('0x14')](respondWithStatusCode(_0x12faa9,null))[_0xd3e9('0x1d')](handleError(_0x12faa9,null));};exports[_0xd3e9('0x5e')]=function(_0x50bd43,_0x5b1887){if(_0x50bd43[_0xd3e9('0x55')]['id']){delete _0x50bd43[_0xd3e9('0x55')]['id'];}return db[_0xd3e9('0x30')]['find']({'where':{'id':_0x50bd43[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x5b1887,null))[_0xd3e9('0x14')](function(_0x53aeda){if(_0x53aeda){_0x50bd43[_0xd3e9('0x55')][_0xd3e9('0x57')]=_0x53aeda['id'];return db[_0xd3e9('0x5f')][_0xd3e9('0x59')](_0x50bd43[_0xd3e9('0x55')]);}})[_0xd3e9('0x14')](respondWithResult(_0x5b1887,null))[_0xd3e9('0x1d')](handleError(_0x5b1887,null));};exports[_0xd3e9('0x60')]=function(_0x1e78ea,_0x3efa97){var _0x2e3b36={'raw':![],'where':{}};var _0x12ca5c={};var _0x6fc510={'count':0x0,'rows':[]};return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x1e78ea[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x3efa97,null))['then'](function(_0x2ca931){if(_0x2ca931){_0x12ca5c['model']=_[_0xd3e9('0x37')](db['CannedAnswer'][_0xd3e9('0x31')]);_0x12ca5c[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x1e78ea[_0xd3e9('0x36')]);_0x12ca5c[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x12ca5c[_0xd3e9('0x34')],_0x12ca5c['query']);_0x2e3b36[_0xd3e9('0x39')]=_[_0xd3e9('0x38')](_0x12ca5c[_0xd3e9('0x34')],qs[_0xd3e9('0x3a')](_0x1e78ea[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x2e3b36[_0xd3e9('0x39')]=_0x2e3b36[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x2e3b36[_0xd3e9('0x39')]:_0x12ca5c[_0xd3e9('0x34')];if(!_0x1e78ea[_0xd3e9('0x36')][_0xd3e9('0x61')](_0xd3e9('0x3c'))){_0x2e3b36[_0xd3e9('0x23')]=qs[_0xd3e9('0x23')](_0x1e78ea[_0xd3e9('0x36')]['limit']);_0x2e3b36[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x1e78ea[_0xd3e9('0x36')][_0xd3e9('0x25')]);}_0x2e3b36['order']=qs['sort'](_0x1e78ea['query']['sort']);_0x2e3b36[_0xd3e9('0x3f')]=qs[_0xd3e9('0x40')](_[_0xd3e9('0x41')](_0x1e78ea[_0xd3e9('0x36')],_0x12ca5c[_0xd3e9('0x40')]));_0x2e3b36[_0xd3e9('0x3f')]['ChatWebsiteId']=_0x2ca931['id'];if(_0x1e78ea[_0xd3e9('0x36')][_0xd3e9('0x42')]){_0x2e3b36[_0xd3e9('0x3f')]=_[_0xd3e9('0x43')](_0x2e3b36[_0xd3e9('0x3f')],{'$or':_[_0xd3e9('0x35')](_0x2e3b36[_0xd3e9('0x39')],function(_0x4db5cc){var _0x54bd8d={};_0x54bd8d[_0x4db5cc]={'$like':'%'+_0x1e78ea['query'][_0xd3e9('0x42')]+'%'};return _0x54bd8d;})});}_0x2e3b36=_[_0xd3e9('0x43')]({},_0x2e3b36,_0x1e78ea[_0xd3e9('0x45')]);return db[_0xd3e9('0x5f')][_0xd3e9('0x24')]({'where':_0x2e3b36[_0xd3e9('0x3f')]})['then'](function(_0x4debc2){_0x6fc510[_0xd3e9('0x24')]=_0x4debc2;if(_0x1e78ea[_0xd3e9('0x36')]['includeAll']){_0x2e3b36[_0xd3e9('0x46')]=[{'all':!![]}];}return db[_0xd3e9('0x5f')]['findAll'](_0x2e3b36);})[_0xd3e9('0x14')](function(_0x4a5f36){_0x6fc510[_0xd3e9('0x48')]=_0x4a5f36;return _0x6fc510;});}})[_0xd3e9('0x14')](respondWithFilteredResult(_0x3efa97,_0x2e3b36))[_0xd3e9('0x1d')](handleError(_0x3efa97,null));};exports[_0xd3e9('0x62')]=function(_0x271dbd,_0x124eb9){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x271dbd['params']['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x124eb9,null))[_0xd3e9('0x14')](function(_0x123705){if(_0x123705){return _0x123705[_0xd3e9('0x62')](_0x271dbd['query']['ids']);}})[_0xd3e9('0x14')](respondWithStatusCode(_0x124eb9,null))[_0xd3e9('0x1d')](handleError(_0x124eb9,null));};exports[_0xd3e9('0x63')]=function(_0xba0bd,_0xfd1586){_0xba0bd['body'][_0xd3e9('0x64')]=_0xba0bd[_0xd3e9('0x65')][_0xd3e9('0x66')];return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0xba0bd['params']['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0xfd1586,null))[_0xd3e9('0x14')](saveUpdates(_0xba0bd['body'],null))[_0xd3e9('0x14')](respondWithResult(_0xfd1586,null))[_0xd3e9('0x1d')](handleError(_0xfd1586,null));};exports[_0xd3e9('0x67')]=function(_0xa27e99,_0x1e6ac4){_0xa27e99['body'][_0xd3e9('0x68')]=_0xa27e99['file'][_0xd3e9('0x66')];return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0xa27e99[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x1e6ac4,null))[_0xd3e9('0x14')](saveUpdates(_0xa27e99[_0xd3e9('0x55')],null))['then'](respondWithResult(_0x1e6ac4,null))['catch'](handleError(_0x1e6ac4,null));};exports[_0xd3e9('0x69')]=function(_0x244381,_0x56c30d){_0x244381[_0xd3e9('0x55')][_0xd3e9('0x6a')]=_0x244381[_0xd3e9('0x65')][_0xd3e9('0x66')];return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x244381[_0xd3e9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56c30d,null))['then'](saveUpdates(_0x244381['body'],null))['then'](respondWithResult(_0x56c30d,null))[_0xd3e9('0x1d')](handleError(_0x56c30d,null));};exports[_0xd3e9('0x6b')]=function(_0x145b2e,_0x28d456){_0x145b2e[_0xd3e9('0x55')]['systemAvatar']=_0x145b2e[_0xd3e9('0x65')][_0xd3e9('0x66')];return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x145b2e['params']['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x28d456,null))[_0xd3e9('0x14')](saveUpdates(_0x145b2e[_0xd3e9('0x55')],null))[_0xd3e9('0x14')](respondWithResult(_0x28d456,null))[_0xd3e9('0x1d')](handleError(_0x28d456,null));};exports[_0xd3e9('0x6c')]=function(_0x29c95,_0x26bf92){var _0x1cc6f3=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x6f'));var _0x14d142={'where':{'id':_0x29c95['params']['id']},'attributes':['id',_0xd3e9('0x64')],'raw':!![]};var _0x147f89=![];return require(_0xd3e9('0x70'))[_0xd3e9('0x71')]()['then'](function(_0x5adbbd){if(_0x5adbbd){_0x147f89=_0x5adbbd['custom'];}})['then'](function(){return db['ChatWebsite']['find'](_0x14d142);})[_0xd3e9('0x14')](handleEntityNotFound(_0x26bf92,null))[_0xd3e9('0x14')](function(_0x5351bf){if(_0x5351bf){if(!_[_0xd3e9('0x72')](_0x5351bf[_0xd3e9('0x64')])){if(fs[_0xd3e9('0x73')](path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x74'),_0x5351bf[_0xd3e9('0x64')]))&&_0x147f89){_0x1cc6f3=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x74'),_0x5351bf[_0xd3e9('0x64')]);}}return _0x26bf92[_0xd3e9('0x75')](_0x1cc6f3);}})[_0xd3e9('0x1d')](handleError(_0x26bf92,null));};exports[_0xd3e9('0x76')]=function(_0x38358f,_0x317c8d){var _0x3fb0ec=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x77'));var _0x10e747={'where':{'id':_0x38358f[_0xd3e9('0x4a')]['id']},'attributes':['id',_0xd3e9('0x68')],'raw':!![]};return db[_0xd3e9('0x30')][_0xd3e9('0x4c')](_0x10e747)[_0xd3e9('0x14')](handleEntityNotFound(_0x317c8d,null))[_0xd3e9('0x14')](function(_0x38c799){if(_0x38c799){if(!_[_0xd3e9('0x72')](_0x38c799['agentAvatar'])){if(fs['existsSync'](path[_0xd3e9('0x6d')](config['root'],_0xd3e9('0x78'),_0x38c799[_0xd3e9('0x68')]))){_0x3fb0ec=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x78'),_0x38c799[_0xd3e9('0x68')]);}}return _0x317c8d[_0xd3e9('0x75')](_0x3fb0ec);}})[_0xd3e9('0x1d')](handleError(_0x317c8d,null));};exports[_0xd3e9('0x79')]=function(_0x159a39,_0x274597){var _0x2fa303=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x7a'));var _0x41a906={'where':{'id':_0x159a39['params']['id']},'attributes':['id',_0xd3e9('0x6a'),_0xd3e9('0x7b')],'raw':!![]};return db[_0xd3e9('0x30')][_0xd3e9('0x4c')](_0x41a906)[_0xd3e9('0x14')](handleEntityNotFound(_0x274597,null))[_0xd3e9('0x14')](function(_0x51f43d){if(_0x51f43d){if(!_[_0xd3e9('0x72')](_0x51f43d[_0xd3e9('0x6a')])){if(fs[_0xd3e9('0x73')](path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],'server/files/images/avatars/',_0x51f43d[_0xd3e9('0x6a')]))&&_0x51f43d[_0xd3e9('0x7b')]){_0x2fa303=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x78'),_0x51f43d['customerAvatar']);}}return _0x274597[_0xd3e9('0x75')](_0x2fa303);}})[_0xd3e9('0x1d')](handleError(_0x274597,null));};exports[_0xd3e9('0x7c')]=function(_0x37aeb9,_0x271ad5){var _0x455960=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],'server/files/images/avatars/system_avatar.png');var _0x682626={'where':{'id':_0x37aeb9[_0xd3e9('0x4a')]['id']},'attributes':['id',_0xd3e9('0x7d')],'raw':!![]};return db[_0xd3e9('0x30')][_0xd3e9('0x4c')](_0x682626)['then'](handleEntityNotFound(_0x271ad5,null))[_0xd3e9('0x14')](function(_0x442b0c){if(_0x442b0c){if(!_[_0xd3e9('0x72')](_0x442b0c[_0xd3e9('0x7d')])){if(fs['existsSync'](path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],_0xd3e9('0x78'),_0x442b0c[_0xd3e9('0x7d')]))){_0x455960=path[_0xd3e9('0x6d')](config['root'],_0xd3e9('0x78'),_0x442b0c[_0xd3e9('0x7d')]);}}return _0x271ad5['download'](_0x455960);}})[_0xd3e9('0x1d')](handleError(_0x271ad5,null));};exports[_0xd3e9('0x7e')]=function(_0x3d9f3c,_0x21c5df){var _0x57af15=require(_0xd3e9('0x7f'));var _0x3eb010=new _0x57af15();var _0x2f5742=_0x3eb010[_0xd3e9('0x80')](_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0x82')])[_0xd3e9('0x83')]();var _0x250929={'body':_0x3d9f3c[_0xd3e9('0x55')],'channel':_0xd3e9('0x84')};var _0x195d4e=[];var _0x147ed6=[];var _0x4ca886={};var _0x2b23c9=![];return db['CmContact']['describe']()['then'](function(_0x1c06ba){if(!_0x1c06ba){throw new db[(_0xd3e9('0x85'))]['ValidationError'](_0xd3e9('0x86'));}_0x195d4e=_[_0xd3e9('0x87')](_[_0xd3e9('0x37')](_0x1c06ba),[_0xd3e9('0x88'),_0xd3e9('0x89')]);_0x147ed6=_['difference'](_['keys'](_0x1c06ba),[_0xd3e9('0x88'),_0xd3e9('0x89'),'CompanyId','ListId']);if(_0x3d9f3c[_0xd3e9('0x55')]['id']){delete _0x3d9f3c['body']['id'];}if(_[_0xd3e9('0x72')](_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x8a')])){throw new db[(_0xd3e9('0x85'))]['ValidationError'](_0xd3e9('0x8b'));}if(_[_0xd3e9('0x72')](_0x3d9f3c[_0xd3e9('0x55')]['body'])||_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x55')]===''){throw new db['Sequelize'][(_0xd3e9('0x8c'))](_0xd3e9('0x8d'));}if(_[_0xd3e9('0x72')](_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x8e')])){throw new db['Sequelize'][(_0xd3e9('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x147ed6);}if(!_[_0xd3e9('0x8f')](_0x147ed6,_0x3d9f3c['body'][_0xd3e9('0x8e')])){throw new db['Sequelize'][(_0xd3e9('0x8c'))](_0xd3e9('0x90')+_0x147ed6);}_0x4ca886[_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x8e')]]=_0x3d9f3c[_0xd3e9('0x55')]['from'];})[_0xd3e9('0x14')](function(){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x3d9f3c[_0xd3e9('0x4a')]['id']},'include':[{'model':db[_0xd3e9('0x91')],'as':'List','include':[{'model':db[_0xd3e9('0x92')],'as':_0xd3e9('0x93'),'where':_0x4ca886,'limit':0x1,'order':[[_0xd3e9('0x89'),_0xd3e9('0x94')]]}]},{'model':db['ChatApplication'],'as':_0xd3e9('0x95')}]});})[_0xd3e9('0x14')](handleEntityNotFound(_0x21c5df,null))[_0xd3e9('0x14')](function(_0x55f8b7){if(_0x55f8b7&&_0x55f8b7[_0xd3e9('0x96')]){_0x250929['account']=_0x55f8b7;_0x250929[_0xd3e9('0x97')]=_0x55f8b7['Applications'];_0x250929[_0xd3e9('0x98')]=_0x55f8b7['List'];_0x250929['applications']=_['orderBy'](_0x250929[_0xd3e9('0x97')],[_0xd3e9('0x99')],[_0xd3e9('0x9a')]);if(_0x250929[_0xd3e9('0x9b')][_0xd3e9('0x95')]){delete _0x250929[_0xd3e9('0x9b')]['Applications'];}if(_0x250929[_0xd3e9('0x9b')][_0xd3e9('0x96')]&&_0x250929[_0xd3e9('0x9b')]['List'][_0xd3e9('0x93')]['length']){return _0x250929[_0xd3e9('0x9b')]['List']['Contacts'][0x0];}var _0x4f191c=_['defaults'](_0x3d9f3c[_0xd3e9('0x55')],{'firstName':_0x3d9f3c['body'][_0xd3e9('0x8a')],'ListId':_0x55f8b7[_0xd3e9('0x9c')]});_0x4f191c[_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x8e')]]=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x8a')];return db[_0xd3e9('0x92')][_0xd3e9('0x59')](_0x4f191c,{'fields':_0x195d4e,'raw':!![]});}})[_0xd3e9('0x14')](handleEntityNotFound(_0x21c5df,null))[_0xd3e9('0x14')](function(_0x474dc2){_0x250929[_0xd3e9('0x9d')]=_0x474dc2;var _0x18447a=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x9e')];if(_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0x9f')]){_0x18447a=_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0x9f')];}else if(_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0xa0')]){_0x18447a=_['first'](_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0xa0')]['split'](','));}if(_0x474dc2){var _0x53bd5d={'ContactId':_0x474dc2['id'],'ChatWebsiteId':_0x3d9f3c[_0xd3e9('0x4a')]['id'],'from':(_0x474dc2[_0xd3e9('0xa1')]||'')+'\x20'+(_0x474dc2['lastName']||''),'customerIp':_0x18447a,'customerPort':_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0xa2')]?_0x3d9f3c[_0xd3e9('0x81')][_0xd3e9('0xa2')]:null,'referer':_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xa3')],'browserName':_0x2f5742[_0xd3e9('0xa4')][_0xd3e9('0x2c')]&&_0x2f5742[_0xd3e9('0xa4')]['version']?util['format'](_0xd3e9('0xa5'),_0x2f5742[_0xd3e9('0xa4')][_0xd3e9('0x2c')],_0x2f5742['browser'][_0xd3e9('0xa6')]):_0xd3e9('0xa7'),'browserVersion':_0x2f5742[_0xd3e9('0xa4')][_0xd3e9('0xa6')]||_0xd3e9('0xa7'),'osName':util[_0xd3e9('0xa8')](_0xd3e9('0xa5'),_0x2f5742['os']['name'],_0x2f5742['os'][_0xd3e9('0xa6')]),'osVersion':_0x2f5742['os'][_0xd3e9('0xa6')],'deviceModel':_0x2f5742['device'][_0xd3e9('0x34')]&&_0x2f5742[_0xd3e9('0xa9')][_0xd3e9('0xaa')]?util[_0xd3e9('0xa8')](_0xd3e9('0xab'),_0x2f5742[_0xd3e9('0xa9')][_0xd3e9('0x34')],_0x2f5742[_0xd3e9('0xa9')]['vendor'],_0x2f5742[_0xd3e9('0xa9')][_0xd3e9('0x32')]):null,'deviceVendor':_0x2f5742['device']['vendor'],'deviceType':_0x2f5742[_0xd3e9('0xa9')]['type'],'formData':JSON[_0xd3e9('0x1a')](_0x3d9f3c[_0xd3e9('0x55')])};var _0x43bd87={'ChatWebsiteId':_0x3d9f3c[_0xd3e9('0x4a')]['id'],'closed':![]};if(_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xac')]){_0x43bd87[_0xd3e9('0xac')]=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xac')];return db[_0xd3e9('0xad')][_0xd3e9('0x4c')]({'where':_0x43bd87})['then'](function(_0x134a05){if(_0x134a05){return[_0x134a05,![]];}_0x53bd5d[_0xd3e9('0xac')]=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xac')];_0x53bd5d[_0xd3e9('0xae')]=_0x3d9f3c[_0xd3e9('0x55')]['externalUrl'];return db[_0xd3e9('0xad')]['create'](_0x53bd5d)[_0xd3e9('0x14')](function(_0x53e9fa){return[_0x53e9fa,!![]];});});}_0x43bd87[_0xd3e9('0xaf')]=_0x474dc2['id'];if(_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb0')]&&_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb0')]['id']){_0x43bd87['id']=_0x3d9f3c['body'][_0xd3e9('0xb0')]['id'];return db[_0xd3e9('0xad')][_0xd3e9('0x4c')]({'where':_0x43bd87})[_0xd3e9('0x14')](function(_0x2ccf1a){if(_0x2ccf1a){return[_0x2ccf1a,![]];}return db['ChatInteraction'][_0xd3e9('0x59')](_0x53bd5d)[_0xd3e9('0x14')](function(_0x28dd87){return[_0x28dd87,!![]];});});}return db['ChatInteraction'][_0xd3e9('0x59')](_0x53bd5d)[_0xd3e9('0x14')](function(_0x2126b8){return[_0x2126b8,!![]];});}})[_0xd3e9('0xb1')](function(_0x220530,_0x202b96){if(_0x220530){_0x2b23c9=_0x202b96;if(!_0x202b96){var _0xe93e31={'from':(_0x250929[_0xd3e9('0x9d')]['firstName']||'')+'\x20'+(_0x250929[_0xd3e9('0x9d')]['lastName']||'')};if(_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xac')]&&_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb2')]&&_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xac')]!=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb2')]){_0xe93e31['threadId']=_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb2')];}return _0x220530['update'](_0xe93e31);}else{return _0x220530;}}})[_0xd3e9('0x14')](function(_0x39f4da){_0x250929[_0xd3e9('0xb0')]=_0x39f4da[_0xd3e9('0x50')]({'plain':!![]});_0x250929[_0xd3e9('0xb0')][_0xd3e9('0xb3')]=_0x2b23c9;if(_0x250929['interaction'][_0xd3e9('0xb3')]){if(_0x250929[_0xd3e9('0x9b')][_0xd3e9('0xb4')]){_0x250929[_0xd3e9('0x97')]['push']({'id':0x0,'priority':_0x250929[_0xd3e9('0x97')][_0xd3e9('0x3b')]+0x1,'app':_0xd3e9('0xb5'),'appdata':_0xd3e9('0xb6'),'interval':_0xd3e9('0xb7')});}}return db[_0xd3e9('0xb8')][_0xd3e9('0x59')]({'body':_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0x55')],'ChatWebsiteId':_0x3d9f3c[_0xd3e9('0x4a')]['id'],'ChatInteractionId':_0x39f4da['id'],'direction':'in','ContactId':_0x250929[_0xd3e9('0x9d')]['id'],'AttachmentId':_0x3d9f3c[_0xd3e9('0x55')][_0xd3e9('0xb9')]});})[_0xd3e9('0x14')](function(_0x1cebb0){_0x250929[_0xd3e9('0x1c')]=_0x1cebb0;if(_0x250929[_0xd3e9('0xb0')][_0xd3e9('0xba')]){return db[_0xd3e9('0xbb')]['find']({'attributes':['id',_0xd3e9('0x2c')],'where':{'id':_0x250929['interaction'][_0xd3e9('0xba')]}})['then'](function(_0x4f5997){if(_0x4f5997){_0x250929['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd3e9('0xbc'),'appdata':_0x4f5997[_0xd3e9('0x2c')]+','+(_0x250929[_0xd3e9('0x9b')][_0xd3e9('0xbd')]||0xa),'interval':_0xd3e9('0xb7')});_0x250929[_0xd3e9('0xbe')]=!![];}return respondWithRpcPromise(_0xd3e9('0xbf'),_0xd3e9('0xc0'),_0x250929);});}return respondWithRpcPromise(_0xd3e9('0xbf'),_0xd3e9('0xc0'),_0x250929);})['then'](function(_0x5792ca){respondWithRpcPromise(_0xd3e9('0xc1'),_0xd3e9('0xc1'),{'event':_0xd3e9('0x7e'),'message':_0x5792ca},client9002);return _0x5792ca;})['then'](respondWithResult(_0x21c5df,null))['catch'](handleError(_0x21c5df,null));};exports[_0xd3e9('0xc2')]=function(_0x35a877,_0x107588){var _0x32886d,_0x3d0c78,_0x3aecd4;var _0x52ed23=[];var _0x38cb87={};var _0x1e904b=_0x35a877[_0xd3e9('0xc3')]||[];var _0x2a5428=[];var _0x6e700d;return db['CmContact']['describe']()['then'](function(_0x309982){if(!_0x309982){throw new db[(_0xd3e9('0x85'))][(_0xd3e9('0x8c'))]('no\x20available\x20attributes');}_0x52ed23=_[_0xd3e9('0x87')](_[_0xd3e9('0x37')](_0x309982),[_0xd3e9('0x88'),_0xd3e9('0x89'),_0xd3e9('0xc4'),_0xd3e9('0x9c')]);if(_0x35a877['body']['id']){delete _0x35a877['body']['id'];}if(_[_0xd3e9('0x72')](_0x35a877[_0xd3e9('0x55')][_0xd3e9('0x8a')])){throw _0x107588[_0xd3e9('0x1f')](0x1f4)[_0xd3e9('0x2d')](new db[(_0xd3e9('0x85'))][(_0xd3e9('0x8c'))](_0xd3e9('0x8b')));}if(_['isNil'](_0x35a877['body'][_0xd3e9('0x55')])||_0x35a877[_0xd3e9('0x55')][_0xd3e9('0x55')]===''){throw _0x107588[_0xd3e9('0x1f')](0x1f4)['send'](new db['Sequelize'][(_0xd3e9('0x8c'))](_0xd3e9('0x8d')));}if(_[_0xd3e9('0x72')](_0x35a877[_0xd3e9('0x55')][_0xd3e9('0xc5')])){throw _0x107588[_0xd3e9('0x1f')](0x1f4)[_0xd3e9('0x2d')](new db['Sequelize'][(_0xd3e9('0x8c'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52ed23));}if(!_[_0xd3e9('0x8f')](_0x52ed23,_0x35a877[_0xd3e9('0x55')][_0xd3e9('0xc5')])){throw _0x107588[_0xd3e9('0x1f')](0x1f4)[_0xd3e9('0x2d')](new db[(_0xd3e9('0x85'))][(_0xd3e9('0x8c'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52ed23));}_0x38cb87[_0x35a877[_0xd3e9('0x55')][_0xd3e9('0xc5')]]=_0x35a877[_0xd3e9('0x55')]['from'];})[_0xd3e9('0x14')](function(){return db['ChatWebsite'][_0xd3e9('0x4c')]({'where':{'id':_0x35a877['params']['id']},'include':[{'model':db['CmList'],'as':_0xd3e9('0x96')},{'model':db[_0xd3e9('0xc6')],'as':_0xd3e9('0xc6')}]});})[_0xd3e9('0x14')](handleEntityNotFound(_0x107588,null))[_0xd3e9('0x14')](function(_0x4dc35a){if(_0x4dc35a&&_0x4dc35a['List']){_0x3d0c78=_0x4dc35a;var _0x401157=_[_0xd3e9('0xa')](_0x35a877[_0xd3e9('0x55')],{'firstName':_0x35a877[_0xd3e9('0x55')]['from'],'phone':_0x35a877['body']['from'],'ListId':_0x4dc35a['ListId']});_0x401157[_0x35a877['body'][_0xd3e9('0xc5')]]=_0x35a877[_0xd3e9('0x55')]['from'];return db[_0xd3e9('0x92')][_0xd3e9('0xc7')]({'where':_0x38cb87,'defaults':_0x401157});}})[_0xd3e9('0xb1')](function(_0x2227be){if(_0x2227be){_0x3aecd4=_0x2227be;var _0x783a96=fs['readFileSync'](path['join'](config[_0xd3e9('0x6e')],_0xd3e9('0xc8')),_0xd3e9('0xc9'));var _0x39e8b3=ejs[_0xd3e9('0xca')](_0x783a96,{'body':_[_0xd3e9('0xcb')](_0x35a877[_0xd3e9('0x55')][_0xd3e9('0x55')]),'bodyTitle':_0x3d0c78[_0xd3e9('0xcc')]});return db[_0xd3e9('0xcd')][_0xd3e9('0x59')]({'body':_0x39e8b3,'plainBody':htmlToText[_0xd3e9('0xce')](_0x39e8b3),'ContactId':_0x2227be['id'],'ChatWebsiteId':_0x3d0c78['id']});}})['then'](function(_0x460220){_0x6e700d=_0x460220;if(_0x1e904b['length']){var _0x790825=_0x1e904b[_0xd3e9('0x35')](function(_0x1ca80e){return{'name':_0x1ca80e[_0xd3e9('0xcf')],'basename':_0x1ca80e[_0xd3e9('0x66')],'type':_0x1ca80e[_0xd3e9('0xd0')],'ChatOfflineMessageId':_0x460220['id']};});_0x2a5428=_0x790825[_0xd3e9('0x35')](_0x2deed0=>{var _0x5a3484={'filename':_0x2deed0[_0xd3e9('0x2c')],'path':path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],'server',_0xd3e9('0xc3'),_0xd3e9('0xd1'),_0xd3e9('0xd2'),_0x2deed0[_0xd3e9('0xd3')])};return _0x5a3484;});if(!_0x3d0c78[_0xd3e9('0xd4')]){return db[_0xd3e9('0xd5')][_0xd3e9('0xd6')](function(_0x22d3cf){return db[_0xd3e9('0xd7')]['bulkCreate'](_0x790825,{'transaction':_0x22d3cf});});}}})[_0xd3e9('0x14')](function(){if(_0x6e700d){_0x32886d=_0x6e700d;return db[_0xd3e9('0xc6')][_0xd3e9('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0xd3e9('0xd8')],'as':_0xd3e9('0xd9'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd3e9('0xda'),'raw':!![]}]}]});}})[_0xd3e9('0x14')](function(_0x1effa5){if(_0x1effa5&&_0x1effa5[_0xd3e9('0xd9')]&&_0x3d0c78[_0xd3e9('0xdb')]&&_0x3d0c78[_0xd3e9('0xdc')]){var _0x4c4391=_0x1effa5[_0xd3e9('0xdd')]();return respondWithRpcPromise(_0xd3e9('0xde'),_0xd3e9('0xdf'),{'account':_0x4c4391,'message':{'from':util[_0xd3e9('0xa8')]('\x22%s\x22\x20<%s>',_0x1effa5[_0xd3e9('0x2c')],_0x1effa5[_0xd3e9('0xe0')]||_0x1effa5[_0xd3e9('0xd9')][_0xd3e9('0x4d')]),'to':_0x3d0c78[_0xd3e9('0xdc')],'subject':_0x3d0c78[_0xd3e9('0xe1')],'html':_0x32886d[_0xd3e9('0x55')],'attachments':_0x2a5428}},client9003)[_0xd3e9('0x14')](function(){return _0x32886d;})['catch'](function(_0x5793eb){logger['error'](_0x5793eb);});}})['then'](function(){if(_0x3d0c78&&_0x3d0c78[_0xd3e9('0xd4')]&&_0x3d0c78[_0xd3e9('0xe2')]){var _0x401058=[];if(_0x1e904b[_0xd3e9('0x3b')]){_0x401058=_0x1e904b[_0xd3e9('0x35')](function(_0x3fe3a9){return{'name':_0x3fe3a9[_0xd3e9('0xcf')],'basename':_0x3fe3a9[_0xd3e9('0x66')],'type':_0x3fe3a9[_0xd3e9('0xd0')],'ChatOfflineMessageId':_0x6e700d['id']};});}var _0x32eba5;if(!_['isNil'](_0x3d0c78['subjectOffline'])){var _0x53ce0d=_[_0xd3e9('0x35')](_0x35a877[_0xd3e9('0x55')],function(_0x17f8a0){return _0x17f8a0;});var _0x1a2c31=_[_0xd3e9('0xe3')](_0x53ce0d)[0x0];var _0x203952=_['mapValues'](_0x1a2c31,function(_0x5e857c){return _0x5e857c;});_0x32eba5=_0x203952[0x1][_0x3d0c78['subjectOffline']];}var _0x449d80={'from':_0x3aecd4[_0xd3e9('0xe0')],'firstName':_0x3aecd4[_0xd3e9('0xa1')],'lastName':_0x3aecd4[_0xd3e9('0xe4')],'mapKey':_0xd3e9('0xe0'),'message':{'from':_0x3aecd4[_0xd3e9('0xe0')],'to':_0x3d0c78[_0xd3e9('0xc6')][_0xd3e9('0xe0')],'cc':'','subject':_[_0xd3e9('0x72')](_0x32eba5)?_0x3d0c78[_0xd3e9('0xe1')]:_0x32eba5,'messageId':'','sentAt':new Date(),'attach':_0x401058['length'],'attachments':_0x401058,'originChannel':'Chat','ChatWebsiteId':_0x3d0c78['id'],'ChatOfflineMessageId':_0x32886d['id'],'originTo':_0x3d0c78[_0xd3e9('0xc6')][_0xd3e9('0xe0')]},'body':_0x32886d[_0xd3e9('0x55')]};var _0x23efe5={'account':{'id':_0x3d0c78[_0xd3e9('0xe2')]},'body':_0x449d80,'log':_0xd3e9('0xe5')};return respondWithRpcPromise(_0xd3e9('0xe5'),_0xd3e9('0xe6'),_0x23efe5,client9001)[_0xd3e9('0x14')](function(){return _0x32886d;})[_0xd3e9('0x1d')](function(_0x5676c6){logger[_0xd3e9('0x1b')](_0x5676c6);});}return;})[_0xd3e9('0x14')](function(){if(_0x32886d){return _0x32886d;}})[_0xd3e9('0x14')](respondWithResult(_0x107588,null))[_0xd3e9('0x1d')](function(_0x1bcec9){logger[_0xd3e9('0x1b')]('catch',_0x1bcec9);for(var _0x4d0f59 of _0x1e904b){var _0x58a069=path[_0xd3e9('0x6d')](config[_0xd3e9('0x6e')],'server','files','attachments','offline-chat',_0x4d0f59[_0xd3e9('0x66')]);fs_extra[_0xd3e9('0xe7')](_0x58a069)[_0xd3e9('0x1d')](function(_0x12c9d1){logger[_0xd3e9('0x1b')](_0xd3e9('0xe8'),_0x58a069,_0x12c9d1);});}});};exports[_0xd3e9('0xe9')]=function(_0x4e14f2,_0x5ff830){return db[_0xd3e9('0xad')]['find']({'where':{'id':_0x4e14f2[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x5ff830,null))['then'](function(_0x3e549b){if(_0x3e549b){return _0x3e549b[_0xd3e9('0xe9')](_0x4e14f2[_0xd3e9('0x55')][_0xd3e9('0x5d')],_[_0xd3e9('0xea')](_0x4e14f2[_0xd3e9('0x55')],['ids','id'])||{});}})[_0xd3e9('0x14')](respondWithResult(_0x5ff830,null))['catch'](handleError(_0x5ff830,null));};exports[_0xd3e9('0xeb')]=function(_0x29efaa,_0xf74995){var _0x31ebc7={'raw':![],'where':{}};var _0x39982f={};var _0x25bdea={'count':0x0,'rows':[]};return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x29efaa[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0xf74995,null))[_0xd3e9('0x14')](function(_0x117f78){if(_0x117f78){_0x39982f['model']=_[_0xd3e9('0x37')](db[_0xd3e9('0xad')]['rawAttributes']);_0x39982f[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x29efaa[_0xd3e9('0x36')]);_0x39982f[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x39982f['model'],_0x39982f[_0xd3e9('0x36')]);_0x31ebc7[_0xd3e9('0x39')]=_[_0xd3e9('0x38')](_0x39982f['model'],qs['fields'](_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x31ebc7[_0xd3e9('0x39')]=_0x31ebc7['attributes'][_0xd3e9('0x3b')]?_0x31ebc7['attributes']:_0x39982f['model'];if(!_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0x61')](_0xd3e9('0x3c'))){_0x31ebc7['limit']=qs[_0xd3e9('0x23')](_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0x23')]);_0x31ebc7[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x29efaa['query'][_0xd3e9('0x25')]);}_0x31ebc7['order']=qs[_0xd3e9('0x3e')](_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0x3e')]);_0x31ebc7[_0xd3e9('0x3f')]=qs['filters'](_[_0xd3e9('0x41')](_0x29efaa['query'],_0x39982f['filters']));_0x31ebc7[_0xd3e9('0x3f')][_0xd3e9('0x57')]=_0x117f78['id'];if(_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0x42')]){_0x31ebc7['where']=_[_0xd3e9('0x43')](_0x31ebc7['where'],{'$or':_['map'](_0x31ebc7[_0xd3e9('0x39')],function(_0x384eea){var _0x387196={};_0x387196[_0x384eea]={'$like':'%'+_0x29efaa[_0xd3e9('0x36')]['filter']+'%'};return _0x387196;})});}_0x31ebc7=_['merge']({},_0x31ebc7,_0x29efaa['options']);return db[_0xd3e9('0xad')]['count']({'where':_0x31ebc7[_0xd3e9('0x3f')]})['then'](function(_0x4fe3cc){_0x25bdea['count']=_0x4fe3cc;if(_0x29efaa[_0xd3e9('0x36')]['includeAll']){_0x31ebc7['include']=[{'model':db['CmContact'],'as':_0xd3e9('0xec'),'required':![]},{'model':db[_0xd3e9('0xbb')],'as':_0xd3e9('0xed'),'attributes':['name',_0xd3e9('0xee'),_0xd3e9('0xef')],'required':![]},{'model':db[_0xd3e9('0xf0')],'as':_0xd3e9('0xf1'),'attributes':['id',_0xd3e9('0x2c'),'color'],'where':_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0xf2')]?{'id':_0x29efaa['query'][_0xd3e9('0xf2')]}:undefined,'required':_0x29efaa[_0xd3e9('0x36')][_0xd3e9('0xf2')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x31ebc7);})[_0xd3e9('0x14')](function(_0x570dbe){_0x25bdea['rows']=_0x570dbe;return _0x25bdea;});}})[_0xd3e9('0x14')](respondWithFilteredResult(_0xf74995,_0x31ebc7))[_0xd3e9('0x1d')](handleError(_0xf74995,null));};function iftimePromise(_0x524af6,_0x1b23c7){return respondWithRpcPromise('Command',_0xd3e9('0xf3'),{'command':_0x1b23c7['timezone']?util['format'](_0xd3e9('0xf4'),_0x524af6[_0xd3e9('0xf5')],_0x1b23c7[_0xd3e9('0xf6')]):util[_0xd3e9('0xa8')]('iftime\x20%s',_0x524af6[_0xd3e9('0xf5')])},client9002)[_0xd3e9('0x14')](function(_0x416321){var _0x4a05b2=_0x416321&&_0x416321['indexOf']('true')>=0x0?!![]:![];logger[_0xd3e9('0x15')](_0xd3e9('0xf7'),_0x1b23c7['id'],_0x524af6['id'],_0x524af6[_0xd3e9('0xf5')],_0x4a05b2?_0xd3e9('0xf8'):_0xd3e9('0xf9'),_0x1b23c7[_0xd3e9('0xf6')]?_0x1b23c7[_0xd3e9('0xf6')]:_0xd3e9('0xfa'));return _0x4a05b2;})[_0xd3e9('0x1d')](function(_0x416a3c){logger[_0xd3e9('0x1b')](_0xd3e9('0xf7'),_0x1b23c7['id'],_0x524af6['id'],_0x524af6[_0xd3e9('0xf5')],util['inspect'](_0x416a3c,{'showHidden':![],'depth':null}),_0x1b23c7['timezone']?_0x1b23c7['timezone']:_0xd3e9('0xfa'));return![];});}exports[_0xd3e9('0xf3')]=function(_0x2d9f26,_0x2c779a){var _0x2e892c=0x0;var _0x44de84=0x0;var _0x3aefd2=![];var _0x4675c2;var _0x1abd3a;return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x2d9f26[_0xd3e9('0x4a')]['id']},'include':[{'model':db[_0xd3e9('0xfb')],'as':_0xd3e9('0xfb'),'include':[{'model':db[_0xd3e9('0xfb')],'as':'Intervals','attributes':['id',_0xd3e9('0xf5')],'raw':!![]}]}]})[_0xd3e9('0x14')](handleEntityNotFound(_0x2c779a,null))[_0xd3e9('0x14')](function(_0x30ec90){if(_0x30ec90){_0x4675c2=_0x30ec90;return _0x30ec90[_0xd3e9('0xfc')]({'raw':!![]});}})['then'](function(_0x3cd0a7){if(_0x4675c2){if(_0x3cd0a7){_0x1abd3a=_0x3cd0a7;}}return require(_0xd3e9('0x70'))['getLicense']();})[_0xd3e9('0x14')](function(_0x52ef61){if(_0x52ef61){_0x44de84=_0x52ef61['virtual'];_0x3aefd2=_0x52ef61[_0xd3e9('0xfd')];}})[_0xd3e9('0x14')](function(){return db[_0xd3e9('0xad')][_0xd3e9('0x24')]({'where':{'closed':![]}});})[_0xd3e9('0x14')](function(_0x17bd97){_0x2e892c=_0x17bd97;if(_0x44de84&&_0x17bd97>_0x44de84){return db[_0xd3e9('0xfe')][_0xd3e9('0x5b')]({'where':{'id':0x1}})[_0xd3e9('0x14')](function(_0xee3347){if(_0xee3347){_0xee3347['increment'](_0xd3e9('0xff'));}});}})[_0xd3e9('0x14')](function(){if(_0x4675c2[_0xd3e9('0xfb')]&&_0x4675c2[_0xd3e9('0xfb')]['Intervals']){var _0x29b5fe=[];for(var _0x31f0e7=0x0;_0x31f0e7<_0x4675c2['Interval']['Intervals']['length'];_0x31f0e7++){var _0x46d7b0=_0x4675c2['Interval']['Intervals'][_0x31f0e7][_0xd3e9('0x50')]({'plain':!![]});_0x29b5fe[_0xd3e9('0x100')](iftimePromise(_0x46d7b0,_0x4675c2));}return BPromise[_0xd3e9('0x101')](_0x29b5fe)[_0xd3e9('0x14')](function(_0xc76578){return _[_0xd3e9('0x102')](_0xc76578);});}else{return!![];}})[_0xd3e9('0x14')](function(_0x2e0adb){var _0x565261=fs[_0xd3e9('0x103')](path['join'](config[_0xd3e9('0x6e')],_0xd3e9('0x104')),_0xd3e9('0xc9'));var _0x2f1ece={'remote':_0x4675c2[_0xd3e9('0x105')],'query':querystring['stringify'](_['merge'](_0x4675c2[_0xd3e9('0x50')]({'plain':!![]}),{'customerIp':_0x2d9f26[_0xd3e9('0x81')][_0xd3e9('0xa0')]||_0x2d9f26[_0xd3e9('0x81')][_0xd3e9('0x106')]||_0x2d9f26[_0xd3e9('0x107')][_0xd3e9('0x108')]||_0x2d9f26['ip'],'referer':_0x2d9f26[_0xd3e9('0x81')][_0xd3e9('0xa3')],'openedInteractions':_0x2e892c,'maxInteractions':_0x44de84,'virtual':_0x3aefd2[_0xd3e9('0x109')],'online':_0x2e0adb,'custom':_0x3aefd2}))['replace'](/'/g,'\x5c\x27')};_0x2c779a[_0xd3e9('0x2d')](ejs[_0xd3e9('0xca')](Mustache[_0xd3e9('0xca')](_0x565261,_0x2f1ece),{'proactiveActions':_0x1abd3a,'alignment':_0x4675c2['alignment'],'verticalAlignment':_0x4675c2[_0xd3e9('0x10a')],'div_color':_0x4675c2[_0xd3e9('0x10b')],'labelText':_0x4675c2[_0xd3e9('0x10c')],'text_color':_0x4675c2[_0xd3e9('0x10d')],'button_color':_0x4675c2[_0xd3e9('0x10e')],'background_color':_0x4675c2['backgroundColor'],'hideWhenOffline':_0x4675c2[_0xd3e9('0x10f')],'interval':_0x4675c2[_0xd3e9('0x110')]}));})['catch'](handleError(_0x2c779a,null));};exports[_0xd3e9('0x111')]=function(_0x279b2e,_0x457741){var _0x30f0d3=_0x279b2e[_0xd3e9('0x4a')]['id'];var _0x44c22a=_0x279b2e[_0xd3e9('0x55')];var _0x3dde81=0xc8;var _0x445ce2=null;return db['sequelize'][_0xd3e9('0xd6')]({'isolationLevel':db[_0xd3e9('0xd5')]['Transaction'][_0xd3e9('0x112')][_0xd3e9('0x113')]},function(_0x5d0c34){return db[_0xd3e9('0x30')]['findOne']({'where':{'id':_0x30f0d3},'transaction':_0x5d0c34})[_0xd3e9('0x14')](function(_0x284812){if(_0x284812){return db[_0xd3e9('0x114')]['destroy']({'where':{'ChatWebsiteId':_0x30f0d3},'transaction':_0x5d0c34})[_0xd3e9('0x14')](function(){var _0x1082c1=_[_0xd3e9('0x35')](_0x44c22a,function(_0x1f2eec){_0x1f2eec[_0xd3e9('0x57')]=_0x30f0d3;return _0x1f2eec;});return db[_0xd3e9('0x114')][_0xd3e9('0x115')](_0x1082c1,{'transaction':_0x5d0c34});});}else{_0x3dde81=0x194;_0x445ce2=[];}});})['then'](function(){if(_0x3dde81!==0x194){return db[_0xd3e9('0x114')][_0xd3e9('0x116')]({'where':{'ChatWebsiteId':_0x30f0d3},'order':_0xd3e9('0x99')})[_0xd3e9('0x14')](function(_0xe2047a){_0x445ce2=_0xe2047a;});}})['catch'](function(_0x362537){_0x3dde81=0x1f4;logger[_0xd3e9('0x1b')](_0x362537[_0xd3e9('0x2b')]);if(_0x362537['name']){delete _0x362537[_0xd3e9('0x2c')];}_0x445ce2=_0x362537;})[_0xd3e9('0x117')](function(){if(_0x445ce2===null){_0x457741['sendStatus'](_0x3dde81);}else{if(_0x3dde81===0x1f4){_0x457741[_0xd3e9('0x1f')](_0x3dde81)['send'](_0x445ce2);}else{_0x457741['status'](_0x3dde81)[_0xd3e9('0x21')](_0x445ce2);}}});};exports['getApplications']=function(_0x5bed23,_0x4110bc){var _0x15c0af={};var _0x5c09fb={};var _0x2c7431;var _0x5de8fa;return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x5bed23[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x4110bc,null))[_0xd3e9('0x14')](function(_0x5253b5){if(_0x5253b5){_0x2c7431=_0x5253b5;_0x5c09fb[_0xd3e9('0x34')]=_[_0xd3e9('0x37')](db[_0xd3e9('0x114')][_0xd3e9('0x31')]);_0x5c09fb[_0xd3e9('0x36')]=_['keys'](_0x5bed23[_0xd3e9('0x36')]);_0x5c09fb[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x5c09fb['model'],_0x5c09fb[_0xd3e9('0x36')]);_0x15c0af['attributes']=_[_0xd3e9('0x38')](_0x5c09fb[_0xd3e9('0x34')],qs['fields'](_0x5bed23[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x15c0af[_0xd3e9('0x39')]=_0x15c0af[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x15c0af['attributes']:_0x5c09fb['model'];_0x15c0af[_0xd3e9('0x3d')]=qs[_0xd3e9('0x3e')](_0x5bed23[_0xd3e9('0x36')][_0xd3e9('0x3e')]);_0x15c0af[_0xd3e9('0x3f')]=qs['filters'](_[_0xd3e9('0x41')](_0x5bed23[_0xd3e9('0x36')],_0x5c09fb[_0xd3e9('0x40')]));if(_0x5bed23[_0xd3e9('0x36')]['filter']){_0x15c0af['where']=_[_0xd3e9('0x43')](_0x15c0af['where'],{'$or':_[_0xd3e9('0x35')](_0x15c0af[_0xd3e9('0x39')],function(_0x394bf3){var _0x2cb7cb={};_0x2cb7cb[_0x394bf3]={'$like':'%'+_0x5bed23[_0xd3e9('0x36')]['filter']+'%'};return _0x2cb7cb;})});}_0x15c0af=_[_0xd3e9('0x43')]({},_0x15c0af,_0x5bed23[_0xd3e9('0x45')]);return _0x2c7431[_0xd3e9('0x118')](_0x15c0af);}})[_0xd3e9('0x14')](function(_0x334798){if(_0x334798){_0x5de8fa=_0x334798[_0xd3e9('0x3b')];if(!_0x5bed23[_0xd3e9('0x36')][_0xd3e9('0x61')](_0xd3e9('0x3c'))){_0x15c0af[_0xd3e9('0x23')]=qs[_0xd3e9('0x23')](_0x5bed23[_0xd3e9('0x36')]['limit']);_0x15c0af[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x5bed23[_0xd3e9('0x36')]['offset']);}return _0x2c7431[_0xd3e9('0x118')](_0x15c0af);}})[_0xd3e9('0x14')](function(_0x173266){if(_0x173266){return _0x173266?{'count':_0x5de8fa,'rows':_0x173266}:null;}})['then'](respondWithResult(_0x4110bc,null))[_0xd3e9('0x1d')](handleError(_0x4110bc,null));};exports['addProactiveActions']=function(_0x3fb08b,_0x19cdf9){return db[_0xd3e9('0x119')][_0xd3e9('0x4c')]({'where':{'id':_0x3fb08b['params']['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x19cdf9,null))[_0xd3e9('0x14')](function(_0x434d1d){if(_0x434d1d){return _0x434d1d[_0xd3e9('0x11a')](_0x3fb08b[_0xd3e9('0x55')]['ids'],_[_0xd3e9('0xea')](_0x3fb08b[_0xd3e9('0x55')],[_0xd3e9('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x19cdf9,null))[_0xd3e9('0x1d')](handleError(_0x19cdf9,null));};exports['getProactiveActions']=function(_0x15d5fc,_0x86dfec){var _0x432b37={};var _0x4f72bc={};var _0x2557cb;var _0x47b028;return db['ChatWebsite'][_0xd3e9('0x5b')]({'where':{'id':_0x15d5fc['params']['id']}})['then'](handleEntityNotFound(_0x86dfec,null))[_0xd3e9('0x14')](function(_0x4d98b2){if(_0x4d98b2){_0x2557cb=_0x4d98b2;_0x4f72bc['model']=_[_0xd3e9('0x37')](db[_0xd3e9('0x11b')][_0xd3e9('0x31')]);_0x4f72bc[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x15d5fc['query']);_0x4f72bc[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x4f72bc[_0xd3e9('0x34')],_0x4f72bc[_0xd3e9('0x36')]);_0x432b37['attributes']=_[_0xd3e9('0x38')](_0x4f72bc[_0xd3e9('0x34')],qs[_0xd3e9('0x3a')](_0x15d5fc['query']['fields']));_0x432b37['attributes']=_0x432b37[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x432b37[_0xd3e9('0x39')]:_0x4f72bc[_0xd3e9('0x34')];_0x432b37[_0xd3e9('0x3d')]=qs[_0xd3e9('0x3e')](_0x15d5fc[_0xd3e9('0x36')][_0xd3e9('0x3e')]);_0x432b37[_0xd3e9('0x3f')]=qs['filters'](_[_0xd3e9('0x41')](_0x15d5fc['query'],_0x4f72bc['filters']));if(_0x15d5fc['query'][_0xd3e9('0x42')]){_0x432b37[_0xd3e9('0x3f')]=_['merge'](_0x432b37['where'],{'$or':_[_0xd3e9('0x35')](_0x432b37[_0xd3e9('0x39')],function(_0x1af127){var _0x1ba190={};_0x1ba190[_0x1af127]={'$like':'%'+_0x15d5fc[_0xd3e9('0x36')][_0xd3e9('0x42')]+'%'};return _0x1ba190;})});}_0x432b37=_[_0xd3e9('0x43')]({},_0x432b37,_0x15d5fc['options']);return _0x2557cb[_0xd3e9('0xfc')](_0x432b37);}})[_0xd3e9('0x14')](function(_0xecd995){if(_0xecd995){_0x47b028=_0xecd995[_0xd3e9('0x3b')];if(!_0x15d5fc['query'][_0xd3e9('0x61')]('nolimit')){_0x432b37[_0xd3e9('0x23')]=qs[_0xd3e9('0x23')](_0x15d5fc[_0xd3e9('0x36')][_0xd3e9('0x23')]);_0x432b37['offset']=qs['offset'](_0x15d5fc[_0xd3e9('0x36')][_0xd3e9('0x25')]);}return _0x2557cb[_0xd3e9('0xfc')](_0x432b37);}})['then'](function(_0xa51e22){if(_0xa51e22){return _0xa51e22?{'count':_0x47b028,'rows':_0xa51e22}:null;}})[_0xd3e9('0x14')](respondWithResult(_0x86dfec,null))[_0xd3e9('0x1d')](handleError(_0x86dfec,null));};exports[_0xd3e9('0x11c')]=function(_0xf6d57b,_0x3eda00){var _0x50aa4f=_0xf6d57b[_0xd3e9('0x36')][_0xd3e9('0x11d')]===_0xd3e9('0x11e')?'offlineForm':_0xd3e9('0x11f');return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'attributes':['id',_0x50aa4f],'where':{'id':_0xf6d57b['params']['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x3eda00,null))[_0xd3e9('0x14')](function(_0x2fa8df){if(_0x2fa8df){var _0x32c02d=_0x2fa8df[_0x50aa4f];var _0x11949c=_0x32c02d&&_0x32c02d[_0xd3e9('0x120')]?_0x32c02d[_0xd3e9('0x120')]:[];_0x3eda00['send']({'fromKey':_[_0xd3e9('0x72')](_0x32c02d[_0xd3e9('0x121')])?undefined:_0x32c02d['fromKey'],'count':_0x11949c['length'],'rows':_0x11949c});}})[_0xd3e9('0x1d')](handleError(_0x3eda00,null));};exports[_0xd3e9('0x122')]=function(_0x414acd,_0x188f76){var _0x2ffa63={'raw':![],'where':{}};var _0x2b5a41={};var _0x5aa29d={'count':0x0,'rows':[]};return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x414acd[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x188f76,null))[_0xd3e9('0x14')](function(_0x3dd7fe){if(_0x3dd7fe){_0x2b5a41['model']=_[_0xd3e9('0x37')](db['ChatOfflineMessage'][_0xd3e9('0x31')]);_0x2b5a41[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x414acd[_0xd3e9('0x36')]);_0x2b5a41[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x2b5a41[_0xd3e9('0x34')],_0x2b5a41[_0xd3e9('0x36')]);_0x2ffa63[_0xd3e9('0x39')]=_['intersection'](_0x2b5a41[_0xd3e9('0x34')],qs[_0xd3e9('0x3a')](_0x414acd[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x2ffa63[_0xd3e9('0x39')]=_0x2ffa63[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x2ffa63[_0xd3e9('0x39')]:_0x2b5a41[_0xd3e9('0x34')];if(!_0x414acd[_0xd3e9('0x36')]['hasOwnProperty']('nolimit')){_0x2ffa63['limit']=qs['limit'](_0x414acd['query'][_0xd3e9('0x23')]);_0x2ffa63[_0xd3e9('0x25')]=qs[_0xd3e9('0x25')](_0x414acd[_0xd3e9('0x36')][_0xd3e9('0x25')]);}_0x2ffa63[_0xd3e9('0x3d')]=qs[_0xd3e9('0x3e')](_0x414acd[_0xd3e9('0x36')]['sort']);_0x2ffa63[_0xd3e9('0x3f')]=qs[_0xd3e9('0x40')](_[_0xd3e9('0x41')](_0x414acd[_0xd3e9('0x36')],_0x2b5a41['filters']));_0x2ffa63['where'][_0xd3e9('0x57')]=_0x3dd7fe['id'];if(_0x414acd['query']['filter']){_0x2ffa63['where']=_[_0xd3e9('0x43')](_0x2ffa63[_0xd3e9('0x3f')],{'$or':_['map'](_0x2ffa63[_0xd3e9('0x39')],function(_0x4e1097){var _0x38f3fc={};_0x38f3fc[_0x4e1097]={'$like':'%'+_0x414acd[_0xd3e9('0x36')][_0xd3e9('0x42')]+'%'};return _0x38f3fc;})});}_0x2ffa63=_[_0xd3e9('0x43')]({},_0x2ffa63,_0x414acd[_0xd3e9('0x45')]);return db[_0xd3e9('0xcd')][_0xd3e9('0x24')]({'where':_0x2ffa63[_0xd3e9('0x3f')]})[_0xd3e9('0x14')](function(_0x512e0b){_0x5aa29d[_0xd3e9('0x24')]=_0x512e0b;if(_0x414acd[_0xd3e9('0x36')]['includeAll']){_0x2ffa63[_0xd3e9('0x46')]=[{'all':!![]}];}else{_0x2ffa63[_0xd3e9('0x46')]=[{'model':db['CmContact'],'as':_0xd3e9('0xec'),'required':![]},{'model':db[_0xd3e9('0xd7')],'as':'Attachments','required':![]}];}return db[_0xd3e9('0xcd')]['findAll'](_0x2ffa63);})[_0xd3e9('0x14')](function(_0xe95c22){_0x5aa29d['rows']=_0xe95c22;return _0x5aa29d;});}})[_0xd3e9('0x14')](respondWithFilteredResult(_0x188f76,_0x2ffa63))[_0xd3e9('0x1d')](handleError(_0x188f76,null));};exports['addAgents']=function(_0x30e4a5,_0x277f77){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x30e4a5[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x277f77,null))[_0xd3e9('0x14')](function(_0x2adf63){if(_0x2adf63){return _0x2adf63[_0xd3e9('0x123')](_0x30e4a5[_0xd3e9('0x55')][_0xd3e9('0x5d')],_[_0xd3e9('0xea')](_0x30e4a5[_0xd3e9('0x55')],[_0xd3e9('0x5d'),'id'])||{})[_0xd3e9('0xb1')](function(_0x510b7b){for(var _0x39a0d4=0x0;_0x39a0d4<_0x30e4a5[_0xd3e9('0x55')][_0xd3e9('0x5d')][_0xd3e9('0x3b')];_0x39a0d4+=0x1){socket[_0xd3e9('0x124')]('userChatWebsite:save',{'UserId':Number(_0x30e4a5['body'][_0xd3e9('0x5d')][_0x39a0d4]),'ChatWebsiteId':Number(_0x30e4a5[_0xd3e9('0x4a')]['id'])});}return _0x510b7b;});}})[_0xd3e9('0x14')](respondWithResult(_0x277f77,null))['catch'](handleError(_0x277f77,null));};exports[_0xd3e9('0x125')]=function(_0x1e4020,_0x200285){return db[_0xd3e9('0x30')][_0xd3e9('0x4c')]({'where':{'id':_0x1e4020[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x200285,null))[_0xd3e9('0x14')](function(_0x521c96){if(_0x521c96){return _0x521c96[_0xd3e9('0x125')](_0x1e4020[_0xd3e9('0x36')][_0xd3e9('0x5d')])['then'](function(){if(_[_0xd3e9('0x126')](_0x1e4020['query']['ids'])){for(var _0x32f3e6=0x0;_0x32f3e6<_0x1e4020[_0xd3e9('0x36')][_0xd3e9('0x5d')][_0xd3e9('0x3b')];_0x32f3e6+=0x1){socket[_0xd3e9('0x124')](_0xd3e9('0x127'),{'UserId':Number(_0x1e4020[_0xd3e9('0x36')][_0xd3e9('0x5d')][_0x32f3e6]),'ChatWebsiteId':Number(_0x1e4020[_0xd3e9('0x4a')]['id'])});}}else{socket['emit'](_0xd3e9('0x127'),{'UserId':Number(_0x1e4020[_0xd3e9('0x36')]['ids']),'ChatWebsiteId':Number(_0x1e4020[_0xd3e9('0x4a')]['id'])});}});}})[_0xd3e9('0x14')](respondWithStatusCode(_0x200285,null))[_0xd3e9('0x1d')](handleError(_0x200285,null));};exports[_0xd3e9('0x128')]=function(_0x46d0ee,_0x47eca1){var _0x4c1909={};var _0x889da0={};var _0x59673b;var _0x4f0083;return db[_0xd3e9('0x30')][_0xd3e9('0x5b')]({'where':{'id':_0x46d0ee[_0xd3e9('0x4a')]['id']}})[_0xd3e9('0x14')](handleEntityNotFound(_0x47eca1,null))['then'](function(_0x449b19){if(_0x449b19){_0x59673b=_0x449b19;_0x889da0[_0xd3e9('0x34')]=_[_0xd3e9('0x37')](db[_0xd3e9('0xbb')][_0xd3e9('0x31')]);_0x889da0[_0xd3e9('0x36')]=_[_0xd3e9('0x37')](_0x46d0ee[_0xd3e9('0x36')]);_0x889da0[_0xd3e9('0x40')]=_[_0xd3e9('0x38')](_0x889da0[_0xd3e9('0x34')],_0x889da0['query']);_0x4c1909['attributes']=_['intersection'](_0x889da0[_0xd3e9('0x34')],qs[_0xd3e9('0x3a')](_0x46d0ee[_0xd3e9('0x36')][_0xd3e9('0x3a')]));_0x4c1909['attributes']=_0x4c1909[_0xd3e9('0x39')][_0xd3e9('0x3b')]?_0x4c1909['attributes']:_0x889da0[_0xd3e9('0x34')];_0x4c1909[_0xd3e9('0x3d')]=qs[_0xd3e9('0x3e')](_0x46d0ee[_0xd3e9('0x36')][_0xd3e9('0x3e')]);_0x4c1909['where']=qs['filters'](_[_0xd3e9('0x41')](_0x46d0ee[_0xd3e9('0x36')],_0x889da0[_0xd3e9('0x40')]));if(_0x46d0ee[_0xd3e9('0x36')][_0xd3e9('0x42')]){_0x4c1909[_0xd3e9('0x3f')]=_['merge'](_0x4c1909[_0xd3e9('0x3f')],{'$or':_[_0xd3e9('0x35')](_0x4c1909['attributes'],function(_0x1074fa){var _0x56b902={};_0x56b902[_0x1074fa]={'$like':'%'+_0x46d0ee[_0xd3e9('0x36')][_0xd3e9('0x42')]+'%'};return _0x56b902;})});}_0x4c1909=_[_0xd3e9('0x43')]({},_0x4c1909,_0x46d0ee['options']);return _0x59673b[_0xd3e9('0x128')](_0x4c1909);}})[_0xd3e9('0x14')](function(_0x313ec5){if(_0x313ec5){_0x4f0083=_0x313ec5[_0xd3e9('0x3b')];if(!_0x46d0ee['query']['hasOwnProperty'](_0xd3e9('0x3c'))){_0x4c1909[_0xd3e9('0x23')]=qs[_0xd3e9('0x23')](_0x46d0ee[_0xd3e9('0x36')]['limit']);_0x4c1909[_0xd3e9('0x25')]=qs['offset'](_0x46d0ee[_0xd3e9('0x36')][_0xd3e9('0x25')]);}return _0x59673b[_0xd3e9('0x128')](_0x4c1909);}})[_0xd3e9('0x14')](function(_0x34ace1){if(_0x34ace1){return _0x34ace1?{'count':_0x4f0083,'rows':_0x34ace1}:null;}})[_0xd3e9('0x14')](respondWithResult(_0x47eca1,null))[_0xd3e9('0x1d')](handleError(_0x47eca1,null));}; \ No newline at end of file +var _0x67a2=['addDisposition','getDispositions','findOne','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addLogo','sitepic','file','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','join','server/files/images/logos/','root','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','download','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','CmContact','Contacts','ChatApplication','Applications','account','applications','orderBy','priority','asc','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','close','unmanaged','AttachmentId','User','UserId','unshift','agent','*,*,*,*','Start','startRouting','EventManager','notify','offline','createdAt','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','sequelize','transaction','bulkCreate','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','custom','increment','chatLicenseExceeded','Intervals','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','keys','find','create','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe'];(function(_0x22e6db,_0x1527cb){var _0x30aeef=function(_0x5cb69b){while(--_0x5cb69b){_0x22e6db['push'](_0x22e6db['shift']());}};_0x30aeef(++_0x1527cb);}(_0x67a2,0xd3));var _0x267a=function(_0x3d2e3a,_0xe11a42){_0x3d2e3a=_0x3d2e3a-0x0;var _0x28d85d=_0x67a2[_0x3d2e3a];return _0x28d85d;};'use strict';var BPromise=require(_0x267a('0x0'));var Mustache=require(_0x267a('0x1'));var util=require('util');var path=require(_0x267a('0x2'));var ejs=require(_0x267a('0x3'));var fs=require('fs');var fs_extra=require(_0x267a('0x4'));var _=require(_0x267a('0x5'));var querystring=require(_0x267a('0x6'));var Redis=require(_0x267a('0x7'));var qs=require(_0x267a('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x267a('0x9'));var db=require(_0x267a('0xa'))['db'];config[_0x267a('0xb')]=_['defaults'](config[_0x267a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x267a('0xc'))(new Redis(config[_0x267a('0xb')]));require(_0x267a('0xd'))[_0x267a('0xe')](socket);var htmlToText=require(_0x267a('0xf'));var jayson=require(_0x267a('0x10'));var client=jayson[_0x267a('0x11')]['http']({'port':0x232c});var client9002=jayson[_0x267a('0x11')][_0x267a('0x12')]({'port':0x232a});var client9003=jayson[_0x267a('0x11')][_0x267a('0x12')]({'port':0x232b});var client9001=jayson[_0x267a('0x11')][_0x267a('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x1d959d,_0x14da06,_0x429efa,_0x29517a){return new BPromise(function(_0x836944,_0x557606){var _0x662c40=_0x29517a||client;return _0x662c40['request'](_0x1d959d,_0x429efa)[_0x267a('0x13')](function(_0x7e6513){logger[_0x267a('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x14da06,'request\x20sent');logger[_0x267a('0x15')](_0x267a('0x16'),_0x14da06,_0x267a('0x17'),JSON['stringify'](_0x7e6513));if(_0x7e6513[_0x267a('0x18')]){if(_0x7e6513[_0x267a('0x18')][_0x267a('0x19')]===0x1f4){logger[_0x267a('0x18')](_0x267a('0x1a'),_0x14da06,_0x7e6513['error'][_0x267a('0x1b')]);return _0x557606(_0x7e6513['error'][_0x267a('0x1b')]);}logger[_0x267a('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x14da06,_0x7e6513[_0x267a('0x18')]['message']);return _0x836944(_0x7e6513[_0x267a('0x18')][_0x267a('0x1b')]);}else{logger[_0x267a('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x14da06,_0x267a('0x17'));_0x836944(_0x7e6513[_0x267a('0x1c')][_0x267a('0x1b')]);}})[_0x267a('0x1d')](function(_0x504820){logger[_0x267a('0x18')](_0x267a('0x1a'),_0x14da06,_0x504820);_0x557606(_0x504820);});});}function respondWithStatusCode(_0x2a894e,_0x2977cf){_0x2977cf=_0x2977cf||0xcc;return function(_0x85e332){if(_0x85e332){return _0x2a894e[_0x267a('0x1e')](_0x2977cf);}return _0x2a894e[_0x267a('0x1f')](_0x2977cf)[_0x267a('0x20')]();};}function respondWithResult(_0x5101b5,_0xfa55b9){_0xfa55b9=_0xfa55b9||0xc8;return function(_0x1b508b){if(_0x1b508b){return _0x5101b5[_0x267a('0x1f')](_0xfa55b9)['json'](_0x1b508b);}};}function respondWithFilteredResult(_0x4e7531,_0x499923){return function(_0x520051){if(_0x520051){var _0x1cb987=typeof _0x499923[_0x267a('0x21')]===_0x267a('0x22')&&typeof _0x499923[_0x267a('0x23')]===_0x267a('0x22');var _0x35c021=_0x520051[_0x267a('0x24')];var _0x4dd1b3=_0x1cb987?0x0:_0x499923[_0x267a('0x21')];var _0x44feba=_0x1cb987?_0x520051[_0x267a('0x24')]:_0x499923['offset']+_0x499923['limit'];var _0x1660d2;if(_0x44feba>=_0x35c021){_0x44feba=_0x35c021;_0x1660d2=0xc8;}else{_0x1660d2=0xce;}_0x4e7531['status'](_0x1660d2);return _0x4e7531[_0x267a('0x25')](_0x267a('0x26'),_0x4dd1b3+'-'+_0x44feba+'/'+_0x35c021)[_0x267a('0x27')](_0x520051);}return null;};}function saveUpdates(_0x131f13){return function(_0x1d7108){if(_0x1d7108){return _0x1d7108['update'](_0x131f13)[_0x267a('0x13')](function(_0x5bf317){return _0x5bf317;});}return null;};}function removeEntity(_0x4466ca){return function(_0x2fceee){if(_0x2fceee){return _0x2fceee[_0x267a('0x28')]()[_0x267a('0x13')](function(){var _0x54d8dd=_0x2fceee['get']({'plain':!![]});var _0x418372=_0x267a('0x29');return db[_0x267a('0x2a')]['destroy']({'where':{'type':_0x418372,'resourceId':_0x54d8dd['id']}})[_0x267a('0x13')](function(){return _0x2fceee;});})[_0x267a('0x13')](function(){_0x4466ca[_0x267a('0x1f')](0xcc)[_0x267a('0x20')]();});}};}function handleEntityNotFound(_0x2b8b30){return function(_0x441f08){if(!_0x441f08){_0x2b8b30[_0x267a('0x1e')](0x194);}return _0x441f08;};}function handleError(_0x578ed5,_0x8a3d41){_0x8a3d41=_0x8a3d41||0x1f4;return function(_0x56407e){logger[_0x267a('0x18')](_0x56407e['stack']);if(_0x56407e[_0x267a('0x2b')]){delete _0x56407e[_0x267a('0x2b')];}_0x578ed5[_0x267a('0x1f')](_0x8a3d41)[_0x267a('0x2c')](_0x56407e);};}exports[_0x267a('0x2d')]=function(_0xdee672,_0x1cae48){var _0x13f0d5={'include':[{'model':db[_0x267a('0x2e')],'as':_0x267a('0x2f')}]},_0x3cec1d={},_0x561de2={'count':0x0,'rows':[]};var _0x26686e=_[_0x267a('0x30')](db['ChatWebsite'][_0x267a('0x31')],function(_0x382245){return{'name':_0x382245['fieldName'],'type':_0x382245[_0x267a('0x32')]['key']};});_0x3cec1d[_0x267a('0x33')]=_[_0x267a('0x30')](_0x26686e,'name');_0x3cec1d[_0x267a('0x34')]=_['keys'](_0xdee672[_0x267a('0x34')]);_0x3cec1d[_0x267a('0x35')]=_['intersection'](_0x3cec1d[_0x267a('0x33')],_0x3cec1d[_0x267a('0x34')]);_0x13f0d5[_0x267a('0x36')]=_[_0x267a('0x37')](_0x3cec1d[_0x267a('0x33')],qs[_0x267a('0x38')](_0xdee672['query'][_0x267a('0x38')]));_0x13f0d5[_0x267a('0x36')]=_0x13f0d5[_0x267a('0x36')][_0x267a('0x39')]?_0x13f0d5[_0x267a('0x36')]:_0x3cec1d[_0x267a('0x33')];if(!_0xdee672[_0x267a('0x34')][_0x267a('0x3a')]('nolimit')){_0x13f0d5[_0x267a('0x23')]=qs['limit'](_0xdee672[_0x267a('0x34')]['limit']);_0x13f0d5[_0x267a('0x21')]=qs[_0x267a('0x21')](_0xdee672[_0x267a('0x34')][_0x267a('0x21')]);}_0x13f0d5[_0x267a('0x3b')]=qs[_0x267a('0x3c')](_0xdee672[_0x267a('0x34')][_0x267a('0x3c')]);_0x13f0d5[_0x267a('0x3d')]=qs[_0x267a('0x35')](_[_0x267a('0x3e')](_0xdee672[_0x267a('0x34')],_0x3cec1d[_0x267a('0x35')]),_0x26686e);if(_0xdee672[_0x267a('0x34')][_0x267a('0x3f')]){_0x13f0d5['where']=_[_0x267a('0x40')](_0x13f0d5[_0x267a('0x3d')],{'$or':_[_0x267a('0x30')](_0x26686e,function(_0xb24fed){if(_0xb24fed[_0x267a('0x32')]!==_0x267a('0x41')){var _0x51ff4b={};_0x51ff4b[_0xb24fed[_0x267a('0x2b')]]={'$like':'%'+_0xdee672['query'][_0x267a('0x3f')]+'%'};return _0x51ff4b;}})});}_0x13f0d5=_['merge']({},_0x13f0d5,_0xdee672[_0x267a('0x42')]);var _0x46fcd7={'where':_0x13f0d5['where']};return db[_0x267a('0x43')][_0x267a('0x24')](_0x46fcd7)['then'](function(_0x16e9db){_0x561de2[_0x267a('0x24')]=_0x16e9db;if(_0xdee672[_0x267a('0x34')][_0x267a('0x44')]){_0x13f0d5[_0x267a('0x45')]=[{'all':!![]}];}return db[_0x267a('0x43')][_0x267a('0x46')](_0x13f0d5);})[_0x267a('0x13')](function(_0x417046){_0x561de2[_0x267a('0x47')]=_0x417046;return _0x561de2;})['then'](respondWithFilteredResult(_0x1cae48,_0x13f0d5))['catch'](handleError(_0x1cae48,null));};exports[_0x267a('0x48')]=function(_0x3cf803,_0x20e7ef){var _0x3f7968={'raw':![],'where':{'id':_0x3cf803['params']['id']},'include':[{'model':db[_0x267a('0x2e')],'as':'mandatoryDispositionPause'}]},_0x28747d={};_0x28747d[_0x267a('0x33')]=_[_0x267a('0x49')](db[_0x267a('0x43')][_0x267a('0x31')]);_0x28747d[_0x267a('0x34')]=_[_0x267a('0x49')](_0x3cf803[_0x267a('0x34')]);_0x28747d[_0x267a('0x35')]=_[_0x267a('0x37')](_0x28747d['model'],_0x28747d[_0x267a('0x34')]);_0x3f7968[_0x267a('0x36')]=_[_0x267a('0x37')](_0x28747d[_0x267a('0x33')],qs['fields'](_0x3cf803[_0x267a('0x34')]['fields']));_0x3f7968[_0x267a('0x36')]=_0x3f7968[_0x267a('0x36')][_0x267a('0x39')]?_0x3f7968[_0x267a('0x36')]:_0x28747d[_0x267a('0x33')];if(_0x3cf803[_0x267a('0x34')][_0x267a('0x44')]){_0x3f7968[_0x267a('0x45')]=[{'all':!![]}];}_0x3f7968=_['merge']({},_0x3f7968,_0x3cf803['options']);return db[_0x267a('0x43')][_0x267a('0x4a')](_0x3f7968)[_0x267a('0x13')](handleEntityNotFound(_0x20e7ef,null))[_0x267a('0x13')](respondWithResult(_0x20e7ef,null))[_0x267a('0x1d')](handleError(_0x20e7ef,null));};exports[_0x267a('0x4b')]=function(_0x2e2553,_0x12c38e){return db[_0x267a('0x43')][_0x267a('0x4b')](_0x2e2553['body'],{})[_0x267a('0x13')](function(_0x26e4c3){var _0x2f9c29=_0x2e2553[_0x267a('0x4c')][_0x267a('0x4d')]({'plain':!![]});if(!_0x2f9c29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f9c29[_0x267a('0x4e')]===_0x267a('0x4c')){var _0x4e882a=_0x26e4c3[_0x267a('0x4d')]({'plain':!![]});var _0x2f8eeb=_0x267a('0x29');return db['UserProfileSection'][_0x267a('0x4a')]({'where':{'name':_0x2f8eeb,'userProfileId':_0x2f9c29[_0x267a('0x4f')]},'raw':!![]})[_0x267a('0x13')](function(_0x2ed192){if(_0x2ed192&&_0x2ed192[_0x267a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4e882a[_0x267a('0x2b')],'resourceId':_0x4e882a['id'],'type':_0x2ed192[_0x267a('0x2b')],'sectionId':_0x2ed192['id']},{})[_0x267a('0x13')](function(){return _0x26e4c3;});}else{return _0x26e4c3;}})[_0x267a('0x1d')](function(_0xb81475){logger[_0x267a('0x18')](_0x267a('0x51'),_0xb81475);throw _0xb81475;});}return _0x26e4c3;})[_0x267a('0x13')](respondWithResult(_0x12c38e,0xc9))[_0x267a('0x1d')](handleError(_0x12c38e,null));};exports[_0x267a('0x52')]=function(_0x41ef25,_0x37f048){if(_0x41ef25[_0x267a('0x53')]['id']){delete _0x41ef25['body']['id'];}return db['ChatWebsite'][_0x267a('0x4a')]({'where':{'id':_0x41ef25[_0x267a('0x54')]['id']},'include':[{'model':db[_0x267a('0x2e')],'as':_0x267a('0x2f')}]})['then'](handleEntityNotFound(_0x37f048,null))[_0x267a('0x13')](saveUpdates(_0x41ef25[_0x267a('0x53')],null))[_0x267a('0x13')](respondWithResult(_0x37f048,null))[_0x267a('0x1d')](handleError(_0x37f048,null));};exports[_0x267a('0x28')]=function(_0x19aebe,_0x3e6ce2){return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x19aebe[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x3e6ce2,null))[_0x267a('0x13')](removeEntity(_0x3e6ce2,null))[_0x267a('0x1d')](handleError(_0x3e6ce2,null));};exports[_0x267a('0x55')]=function(_0x8fde7c,_0xde69c6){return db[_0x267a('0x43')][_0x267a('0x55')]()[_0x267a('0x13')](respondWithResult(_0xde69c6,null))[_0x267a('0x1d')](handleError(_0xde69c6,null));};exports[_0x267a('0x56')]=function(_0x19d5f2,_0x581b18){if(_0x19d5f2[_0x267a('0x53')]['id']){delete _0x19d5f2[_0x267a('0x53')]['id'];}return db[_0x267a('0x43')]['find']({'where':{'id':_0x19d5f2[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x581b18,null))[_0x267a('0x13')](function(_0x2c913c){if(_0x2c913c){_0x19d5f2[_0x267a('0x53')]['ChatWebsiteId']=_0x2c913c['id'];return db['Disposition'][_0x267a('0x4b')](_0x19d5f2[_0x267a('0x53')]);}})['then'](respondWithResult(_0x581b18,null))[_0x267a('0x1d')](handleError(_0x581b18,null));};exports[_0x267a('0x57')]=function(_0x5684e6,_0x5eff40){var _0xf7f504={'raw':![],'where':{}};var _0x5b9d46={};var _0xbe801b={'count':0x0,'rows':[]};return db[_0x267a('0x43')][_0x267a('0x58')]({'where':{'id':_0x5684e6[_0x267a('0x54')]['id']}})['then'](handleEntityNotFound(_0x5eff40,null))[_0x267a('0x13')](function(_0x4942da){if(_0x4942da){_0x5b9d46[_0x267a('0x33')]=_[_0x267a('0x49')](db['Disposition'][_0x267a('0x31')]);_0x5b9d46['query']=_[_0x267a('0x49')](_0x5684e6[_0x267a('0x34')]);_0x5b9d46[_0x267a('0x35')]=_[_0x267a('0x37')](_0x5b9d46[_0x267a('0x33')],_0x5b9d46['query']);_0xf7f504['attributes']=_[_0x267a('0x37')](_0x5b9d46['model'],qs['fields'](_0x5684e6[_0x267a('0x34')][_0x267a('0x38')]));_0xf7f504[_0x267a('0x36')]=_0xf7f504['attributes'][_0x267a('0x39')]?_0xf7f504[_0x267a('0x36')]:_0x5b9d46[_0x267a('0x33')];if(!_0x5684e6[_0x267a('0x34')]['hasOwnProperty']('nolimit')){_0xf7f504[_0x267a('0x23')]=qs[_0x267a('0x23')](_0x5684e6[_0x267a('0x34')][_0x267a('0x23')]);_0xf7f504['offset']=qs[_0x267a('0x21')](_0x5684e6[_0x267a('0x34')][_0x267a('0x21')]);}_0xf7f504[_0x267a('0x3b')]=qs['sort'](_0x5684e6[_0x267a('0x34')][_0x267a('0x3c')]);_0xf7f504[_0x267a('0x3d')]=qs[_0x267a('0x35')](_[_0x267a('0x3e')](_0x5684e6[_0x267a('0x34')],_0x5b9d46[_0x267a('0x35')]));_0xf7f504[_0x267a('0x3d')][_0x267a('0x59')]=_0x4942da['id'];if(_0x5684e6[_0x267a('0x34')][_0x267a('0x3f')]){_0xf7f504[_0x267a('0x3d')]=_['merge'](_0xf7f504['where'],{'$or':_[_0x267a('0x30')](_0xf7f504[_0x267a('0x36')],function(_0x6de518){var _0x4483da={};_0x4483da[_0x6de518]={'$like':'%'+_0x5684e6[_0x267a('0x34')][_0x267a('0x3f')]+'%'};return _0x4483da;})});}_0xf7f504=_[_0x267a('0x40')]({},_0xf7f504,_0x5684e6[_0x267a('0x42')]);return db['Disposition']['count']({'where':_0xf7f504['where']})[_0x267a('0x13')](function(_0x19bdf9){_0xbe801b[_0x267a('0x24')]=_0x19bdf9;if(_0x5684e6[_0x267a('0x34')]['includeAll']){_0xf7f504['include']=[{'all':!![]}];}return db[_0x267a('0x5a')][_0x267a('0x46')](_0xf7f504);})[_0x267a('0x13')](function(_0x533798){_0xbe801b['rows']=_0x533798;return _0xbe801b;});}})[_0x267a('0x13')](respondWithFilteredResult(_0x5eff40,_0xf7f504))['catch'](handleError(_0x5eff40,null));};exports[_0x267a('0x5b')]=function(_0x458a8f,_0x168a04){return db[_0x267a('0x43')]['find']({'where':{'id':_0x458a8f[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x168a04,null))['then'](function(_0x4af94d){if(_0x4af94d){return _0x4af94d[_0x267a('0x5b')](_0x458a8f[_0x267a('0x34')][_0x267a('0x5c')]);}})[_0x267a('0x13')](respondWithStatusCode(_0x168a04,null))[_0x267a('0x1d')](handleError(_0x168a04,null));};exports[_0x267a('0x5d')]=function(_0x1a406a,_0x1d0f4a){if(_0x1a406a[_0x267a('0x53')]['id']){delete _0x1a406a[_0x267a('0x53')]['id'];}return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x1a406a['params']['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x1d0f4a,null))['then'](function(_0x50ab43){if(_0x50ab43){_0x1a406a[_0x267a('0x53')][_0x267a('0x59')]=_0x50ab43['id'];return db[_0x267a('0x5e')][_0x267a('0x4b')](_0x1a406a['body']);}})[_0x267a('0x13')](respondWithResult(_0x1d0f4a,null))[_0x267a('0x1d')](handleError(_0x1d0f4a,null));};exports[_0x267a('0x5f')]=function(_0x1d4358,_0x440785){var _0x573e74={'raw':![],'where':{}};var _0x35781f={};var _0x26069f={'count':0x0,'rows':[]};return db[_0x267a('0x43')]['findOne']({'where':{'id':_0x1d4358[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x440785,null))[_0x267a('0x13')](function(_0x47c938){if(_0x47c938){_0x35781f['model']=_[_0x267a('0x49')](db[_0x267a('0x5e')][_0x267a('0x31')]);_0x35781f[_0x267a('0x34')]=_[_0x267a('0x49')](_0x1d4358[_0x267a('0x34')]);_0x35781f['filters']=_[_0x267a('0x37')](_0x35781f[_0x267a('0x33')],_0x35781f[_0x267a('0x34')]);_0x573e74['attributes']=_[_0x267a('0x37')](_0x35781f['model'],qs[_0x267a('0x38')](_0x1d4358[_0x267a('0x34')]['fields']));_0x573e74[_0x267a('0x36')]=_0x573e74[_0x267a('0x36')]['length']?_0x573e74['attributes']:_0x35781f['model'];if(!_0x1d4358[_0x267a('0x34')][_0x267a('0x3a')](_0x267a('0x60'))){_0x573e74['limit']=qs['limit'](_0x1d4358[_0x267a('0x34')][_0x267a('0x23')]);_0x573e74[_0x267a('0x21')]=qs[_0x267a('0x21')](_0x1d4358['query'][_0x267a('0x21')]);}_0x573e74[_0x267a('0x3b')]=qs[_0x267a('0x3c')](_0x1d4358['query']['sort']);_0x573e74['where']=qs[_0x267a('0x35')](_['pick'](_0x1d4358[_0x267a('0x34')],_0x35781f[_0x267a('0x35')]));_0x573e74['where'][_0x267a('0x59')]=_0x47c938['id'];if(_0x1d4358[_0x267a('0x34')]['filter']){_0x573e74['where']=_['merge'](_0x573e74[_0x267a('0x3d')],{'$or':_[_0x267a('0x30')](_0x573e74[_0x267a('0x36')],function(_0x500c10){var _0x940c44={};_0x940c44[_0x500c10]={'$like':'%'+_0x1d4358['query'][_0x267a('0x3f')]+'%'};return _0x940c44;})});}_0x573e74=_[_0x267a('0x40')]({},_0x573e74,_0x1d4358['options']);return db[_0x267a('0x5e')][_0x267a('0x24')]({'where':_0x573e74[_0x267a('0x3d')]})[_0x267a('0x13')](function(_0x4493ce){_0x26069f['count']=_0x4493ce;if(_0x1d4358[_0x267a('0x34')][_0x267a('0x44')]){_0x573e74[_0x267a('0x45')]=[{'all':!![]}];}return db[_0x267a('0x5e')]['findAll'](_0x573e74);})[_0x267a('0x13')](function(_0x406c5b){_0x26069f[_0x267a('0x47')]=_0x406c5b;return _0x26069f;});}})[_0x267a('0x13')](respondWithFilteredResult(_0x440785,_0x573e74))[_0x267a('0x1d')](handleError(_0x440785,null));};exports['removeAnswers']=function(_0x5281fc,_0x54e86e){return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x5281fc['params']['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x54e86e,null))[_0x267a('0x13')](function(_0x33c90a){if(_0x33c90a){return _0x33c90a[_0x267a('0x61')](_0x5281fc[_0x267a('0x34')]['ids']);}})[_0x267a('0x13')](respondWithStatusCode(_0x54e86e,null))[_0x267a('0x1d')](handleError(_0x54e86e,null));};exports[_0x267a('0x62')]=function(_0x555006,_0x67ed83){_0x555006[_0x267a('0x53')][_0x267a('0x63')]=_0x555006[_0x267a('0x64')]['filename'];return db[_0x267a('0x43')]['find']({'where':{'id':_0x555006[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x67ed83,null))[_0x267a('0x13')](saveUpdates(_0x555006[_0x267a('0x53')],null))[_0x267a('0x13')](respondWithResult(_0x67ed83,null))['catch'](handleError(_0x67ed83,null));};exports['addAvatar']=function(_0x5de172,_0x52556b){_0x5de172[_0x267a('0x53')][_0x267a('0x65')]=_0x5de172[_0x267a('0x64')][_0x267a('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x5de172[_0x267a('0x54')]['id']}})['then'](handleEntityNotFound(_0x52556b,null))[_0x267a('0x13')](saveUpdates(_0x5de172[_0x267a('0x53')],null))[_0x267a('0x13')](respondWithResult(_0x52556b,null))[_0x267a('0x1d')](handleError(_0x52556b,null));};exports[_0x267a('0x67')]=function(_0x594e30,_0x20eed3){_0x594e30[_0x267a('0x53')]['customerAvatar']=_0x594e30[_0x267a('0x64')]['filename'];return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x594e30[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x20eed3,null))['then'](saveUpdates(_0x594e30[_0x267a('0x53')],null))[_0x267a('0x13')](respondWithResult(_0x20eed3,null))[_0x267a('0x1d')](handleError(_0x20eed3,null));};exports[_0x267a('0x68')]=function(_0x491673,_0x1237f5){_0x491673[_0x267a('0x53')][_0x267a('0x69')]=_0x491673[_0x267a('0x64')][_0x267a('0x66')];return db['ChatWebsite'][_0x267a('0x4a')]({'where':{'id':_0x491673[_0x267a('0x54')]['id']}})['then'](handleEntityNotFound(_0x1237f5,null))[_0x267a('0x13')](saveUpdates(_0x491673[_0x267a('0x53')],null))[_0x267a('0x13')](respondWithResult(_0x1237f5,null))[_0x267a('0x1d')](handleError(_0x1237f5,null));};exports['getLogo']=function(_0x565f96,_0x590713){var _0x4f12d5=path['join'](config['root'],_0x267a('0x6a'));var _0x3a5c2b={'where':{'id':_0x565f96[_0x267a('0x54')]['id']},'attributes':['id',_0x267a('0x63')],'raw':!![]};var _0x435b9e=![];return require(_0x267a('0x6b'))[_0x267a('0x6c')]()[_0x267a('0x13')](function(_0x5d29a3){if(_0x5d29a3){_0x435b9e=_0x5d29a3['custom'];}})[_0x267a('0x13')](function(){return db['ChatWebsite'][_0x267a('0x4a')](_0x3a5c2b);})[_0x267a('0x13')](handleEntityNotFound(_0x590713,null))[_0x267a('0x13')](function(_0x8a0700){if(_0x8a0700){if(!_[_0x267a('0x6d')](_0x8a0700['sitepic'])){if(fs['existsSync'](path[_0x267a('0x6e')](config['root'],_0x267a('0x6f'),_0x8a0700[_0x267a('0x63')]))&&_0x435b9e){_0x4f12d5=path['join'](config[_0x267a('0x70')],_0x267a('0x6f'),_0x8a0700[_0x267a('0x63')]);}}return _0x590713['download'](_0x4f12d5);}})[_0x267a('0x1d')](handleError(_0x590713,null));};exports[_0x267a('0x71')]=function(_0x3282da,_0x83efa6){var _0x1f30c4=path['join'](config['root'],_0x267a('0x72'));var _0x3c731d={'where':{'id':_0x3282da[_0x267a('0x54')]['id']},'attributes':['id',_0x267a('0x65')],'raw':!![]};return db[_0x267a('0x43')]['find'](_0x3c731d)[_0x267a('0x13')](handleEntityNotFound(_0x83efa6,null))[_0x267a('0x13')](function(_0x88f630){if(_0x88f630){if(!_['isNil'](_0x88f630['agentAvatar'])){if(fs[_0x267a('0x73')](path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0x74'),_0x88f630['agentAvatar']))){_0x1f30c4=path['join'](config[_0x267a('0x70')],_0x267a('0x74'),_0x88f630[_0x267a('0x65')]);}}return _0x83efa6['download'](_0x1f30c4);}})['catch'](handleError(_0x83efa6,null));};exports['getCustomerAvatar']=function(_0x4a57e4,_0x13466c){var _0x2de952=path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0x75'));var _0x1de8b0={'where':{'id':_0x4a57e4[_0x267a('0x54')]['id']},'attributes':['id',_0x267a('0x76'),_0x267a('0x77')],'raw':!![]};return db[_0x267a('0x43')][_0x267a('0x4a')](_0x1de8b0)[_0x267a('0x13')](handleEntityNotFound(_0x13466c,null))[_0x267a('0x13')](function(_0xb9c75e){if(_0xb9c75e){if(!_[_0x267a('0x6d')](_0xb9c75e[_0x267a('0x76')])){if(fs[_0x267a('0x73')](path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0x74'),_0xb9c75e[_0x267a('0x76')]))&&_0xb9c75e[_0x267a('0x77')]){_0x2de952=path['join'](config[_0x267a('0x70')],_0x267a('0x74'),_0xb9c75e['customerAvatar']);}}return _0x13466c[_0x267a('0x78')](_0x2de952);}})['catch'](handleError(_0x13466c,null));};exports['getSystemAvatar']=function(_0x326f8d,_0x38243f){var _0x3cef4e=path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0x79'));var _0x12e907={'where':{'id':_0x326f8d[_0x267a('0x54')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x267a('0x43')]['find'](_0x12e907)[_0x267a('0x13')](handleEntityNotFound(_0x38243f,null))[_0x267a('0x13')](function(_0x5782ee){if(_0x5782ee){if(!_[_0x267a('0x6d')](_0x5782ee['systemAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0x267a('0x74'),_0x5782ee['systemAvatar']))){_0x3cef4e=path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0x74'),_0x5782ee['systemAvatar']);}}return _0x38243f['download'](_0x3cef4e);}})[_0x267a('0x1d')](handleError(_0x38243f,null));};exports['notify']=function(_0x2795ab,_0x124a16){var _0x117cb9=require(_0x267a('0x7a'));var _0x13b92f=new _0x117cb9();var _0x1cf33b=_0x13b92f[_0x267a('0x7b')](_0x2795ab[_0x267a('0x7c')]['user-agent'])[_0x267a('0x7d')]();var _0x5a6379={'body':_0x2795ab['body'],'channel':_0x267a('0x7e')};var _0x15e3bb=[];var _0x2969f9=[];var _0x2b3bc4={};var _0xf2def4=![];return db['CmContact'][_0x267a('0x55')]()['then'](function(_0x57c1b2){if(!_0x57c1b2){throw new db[(_0x267a('0x7f'))][(_0x267a('0x80'))](_0x267a('0x81'));}_0x15e3bb=_[_0x267a('0x82')](_[_0x267a('0x49')](_0x57c1b2),['createdAt',_0x267a('0x83')]);_0x2969f9=_[_0x267a('0x82')](_[_0x267a('0x49')](_0x57c1b2),['createdAt',_0x267a('0x83'),_0x267a('0x84'),_0x267a('0x85')]);if(_0x2795ab['body']['id']){delete _0x2795ab['body']['id'];}if(_['isNil'](_0x2795ab['body'][_0x267a('0x86')])){throw new db[(_0x267a('0x7f'))]['ValidationError'](_0x267a('0x87'));}if(_[_0x267a('0x6d')](_0x2795ab[_0x267a('0x53')][_0x267a('0x53')])||_0x2795ab['body']['body']===''){throw new db['Sequelize'][(_0x267a('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2795ab[_0x267a('0x53')]['mapKey'])){throw new db[(_0x267a('0x7f'))][(_0x267a('0x80'))](_0x267a('0x88')+_0x2969f9);}if(!_[_0x267a('0x89')](_0x2969f9,_0x2795ab[_0x267a('0x53')][_0x267a('0x8a')])){throw new db[(_0x267a('0x7f'))][(_0x267a('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2969f9);}_0x2b3bc4[_0x2795ab[_0x267a('0x53')]['mapKey']]=_0x2795ab['body'][_0x267a('0x86')];})['then'](function(){return db['ChatWebsite'][_0x267a('0x4a')]({'where':{'id':_0x2795ab[_0x267a('0x54')]['id']},'include':[{'model':db[_0x267a('0x8b')],'as':_0x267a('0x8c'),'include':[{'model':db[_0x267a('0x8d')],'as':_0x267a('0x8e'),'where':_0x2b3bc4,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x267a('0x8f')],'as':_0x267a('0x90')}]});})['then'](handleEntityNotFound(_0x124a16,null))['then'](function(_0x1ce859){if(_0x1ce859&&_0x1ce859[_0x267a('0x8c')]){_0x5a6379[_0x267a('0x91')]=_0x1ce859;_0x5a6379[_0x267a('0x92')]=_0x1ce859[_0x267a('0x90')];_0x5a6379['list']=_0x1ce859[_0x267a('0x8c')];_0x5a6379['applications']=_[_0x267a('0x93')](_0x5a6379['applications'],[_0x267a('0x94')],[_0x267a('0x95')]);if(_0x5a6379[_0x267a('0x91')][_0x267a('0x90')]){delete _0x5a6379[_0x267a('0x91')][_0x267a('0x90')];}if(_0x5a6379[_0x267a('0x91')][_0x267a('0x8c')]&&_0x5a6379['account']['List'][_0x267a('0x8e')][_0x267a('0x39')]){return _0x5a6379[_0x267a('0x91')]['List']['Contacts'][0x0];}var _0x4e85c2=_[_0x267a('0x96')](_0x2795ab[_0x267a('0x53')],{'firstName':_0x2795ab['body'][_0x267a('0x86')],'ListId':_0x1ce859['ListId']});_0x4e85c2[_0x2795ab['body'][_0x267a('0x8a')]]=_0x2795ab[_0x267a('0x53')]['from'];return db[_0x267a('0x8d')][_0x267a('0x4b')](_0x4e85c2,{'fields':_0x15e3bb,'raw':!![]});}})['then'](handleEntityNotFound(_0x124a16,null))['then'](function(_0x5e2aa0){_0x5a6379['contact']=_0x5e2aa0;var _0x57a468=_0x2795ab[_0x267a('0x53')][_0x267a('0x97')];if(_0x2795ab[_0x267a('0x7c')]['cf-connecting-ip']){_0x57a468=_0x2795ab[_0x267a('0x7c')][_0x267a('0x98')];}else if(_0x2795ab[_0x267a('0x7c')][_0x267a('0x99')]){_0x57a468=_[_0x267a('0x9a')](_0x2795ab['headers'][_0x267a('0x99')][_0x267a('0x9b')](','));}if(_0x5e2aa0){var _0x979a36={'ContactId':_0x5e2aa0['id'],'ChatWebsiteId':_0x2795ab[_0x267a('0x54')]['id'],'from':(_0x5e2aa0[_0x267a('0x9c')]||'')+'\x20'+(_0x5e2aa0[_0x267a('0x9d')]||''),'customerIp':_0x57a468,'customerPort':_0x2795ab[_0x267a('0x7c')][_0x267a('0x9e')]?_0x2795ab[_0x267a('0x7c')][_0x267a('0x9e')]:null,'referer':_0x2795ab[_0x267a('0x53')][_0x267a('0x9f')],'browserName':_0x1cf33b[_0x267a('0xa0')][_0x267a('0x2b')]&&_0x1cf33b['browser'][_0x267a('0xa1')]?util[_0x267a('0xa2')](_0x267a('0xa3'),_0x1cf33b[_0x267a('0xa0')][_0x267a('0x2b')],_0x1cf33b[_0x267a('0xa0')][_0x267a('0xa1')]):_0x267a('0xa4'),'browserVersion':_0x1cf33b['browser'][_0x267a('0xa1')]||_0x267a('0xa4'),'osName':util['format']('%s\x20%s',_0x1cf33b['os'][_0x267a('0x2b')],_0x1cf33b['os'][_0x267a('0xa1')]),'osVersion':_0x1cf33b['os']['version'],'deviceModel':_0x1cf33b[_0x267a('0xa5')]['model']&&_0x1cf33b[_0x267a('0xa5')]['vendor']?util[_0x267a('0xa2')](_0x267a('0xa6'),_0x1cf33b[_0x267a('0xa5')][_0x267a('0x33')],_0x1cf33b[_0x267a('0xa5')][_0x267a('0xa7')],_0x1cf33b['device']['type']):null,'deviceVendor':_0x1cf33b[_0x267a('0xa5')][_0x267a('0xa7')],'deviceType':_0x1cf33b[_0x267a('0xa5')][_0x267a('0x32')],'formData':JSON[_0x267a('0xa8')](_0x2795ab[_0x267a('0x53')])};var _0x22e254={'ChatWebsiteId':_0x2795ab[_0x267a('0x54')]['id'],'closed':![]};if(_0x2795ab[_0x267a('0x53')][_0x267a('0xa9')]){_0x22e254['threadId']=_0x2795ab[_0x267a('0x53')][_0x267a('0xa9')];return db[_0x267a('0xaa')][_0x267a('0x4a')]({'where':_0x22e254})[_0x267a('0x13')](function(_0x4d9f11){if(_0x4d9f11){return[_0x4d9f11,![]];}_0x979a36[_0x267a('0xa9')]=_0x2795ab[_0x267a('0x53')][_0x267a('0xa9')];_0x979a36[_0x267a('0xab')]=_0x2795ab[_0x267a('0x53')][_0x267a('0xab')];return db[_0x267a('0xaa')][_0x267a('0x4b')](_0x979a36)['then'](function(_0x567a53){return[_0x567a53,!![]];});});}_0x22e254[_0x267a('0xac')]=_0x5e2aa0['id'];if(_0x2795ab[_0x267a('0x53')][_0x267a('0xad')]&&_0x2795ab[_0x267a('0x53')][_0x267a('0xad')]['id']){_0x22e254['id']=_0x2795ab[_0x267a('0x53')][_0x267a('0xad')]['id'];return db['ChatInteraction']['find']({'where':_0x22e254})[_0x267a('0x13')](function(_0x4167fc){if(_0x4167fc){return[_0x4167fc,![]];}return db[_0x267a('0xaa')][_0x267a('0x4b')](_0x979a36)['then'](function(_0x5271b4){return[_0x5271b4,!![]];});});}return db[_0x267a('0xaa')]['create'](_0x979a36)[_0x267a('0x13')](function(_0x540726){return[_0x540726,!![]];});}})[_0x267a('0xae')](function(_0x28d593,_0x2c959b){if(_0x28d593){_0xf2def4=_0x2c959b;if(!_0x2c959b){var _0xbaed6c={'from':(_0x5a6379[_0x267a('0xaf')][_0x267a('0x9c')]||'')+'\x20'+(_0x5a6379[_0x267a('0xaf')][_0x267a('0x9d')]||'')};if(_0x2795ab[_0x267a('0x53')][_0x267a('0xa9')]&&_0x2795ab['body'][_0x267a('0xb0')]&&_0x2795ab[_0x267a('0x53')][_0x267a('0xa9')]!=_0x2795ab[_0x267a('0x53')][_0x267a('0xb0')]){_0xbaed6c[_0x267a('0xa9')]=_0x2795ab[_0x267a('0x53')]['messageId'];}return _0x28d593[_0x267a('0x52')](_0xbaed6c);}else{return _0x28d593;}}})[_0x267a('0x13')](function(_0x121afc){_0x5a6379[_0x267a('0xad')]=_0x121afc['get']({'plain':!![]});_0x5a6379[_0x267a('0xad')][_0x267a('0xb1')]=_0xf2def4;if(_0x5a6379[_0x267a('0xad')][_0x267a('0xb1')]){if(_0x5a6379[_0x267a('0x91')]['autoclose']){_0x5a6379[_0x267a('0x92')]['push']({'id':0x0,'priority':_0x5a6379['applications'][_0x267a('0x39')]+0x1,'app':_0x267a('0xb2'),'appdata':_0x267a('0xb3'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x267a('0x4b')]({'body':_0x2795ab[_0x267a('0x53')][_0x267a('0x53')],'ChatWebsiteId':_0x2795ab['params']['id'],'ChatInteractionId':_0x121afc['id'],'direction':'in','ContactId':_0x5a6379[_0x267a('0xaf')]['id'],'AttachmentId':_0x2795ab[_0x267a('0x53')][_0x267a('0xb4')]});})[_0x267a('0x13')](function(_0x2b3e4f){_0x5a6379['message']=_0x2b3e4f;if(_0x5a6379[_0x267a('0xad')]['UserId']){return db[_0x267a('0xb5')][_0x267a('0x4a')]({'attributes':['id',_0x267a('0x2b')],'where':{'id':_0x5a6379['interaction'][_0x267a('0xb6')]}})[_0x267a('0x13')](function(_0x220b60){if(_0x220b60){_0x5a6379[_0x267a('0x92')][_0x267a('0xb7')]({'id':0x0,'priority':0x0,'app':_0x267a('0xb8'),'appdata':_0x220b60[_0x267a('0x2b')]+','+(_0x5a6379[_0x267a('0x91')]['waitForTheAssignedAgent']||0xa),'interval':_0x267a('0xb9')});_0x5a6379['forcedOwnership']=!![];}return respondWithRpcPromise(_0x267a('0xba'),_0x267a('0xbb'),_0x5a6379);});}return respondWithRpcPromise(_0x267a('0xba'),_0x267a('0xbb'),_0x5a6379);})[_0x267a('0x13')](function(_0x4c54c7){respondWithRpcPromise('EventManager',_0x267a('0xbc'),{'event':_0x267a('0xbd'),'message':_0x4c54c7},client9002);return _0x4c54c7;})[_0x267a('0x13')](respondWithResult(_0x124a16,null))[_0x267a('0x1d')](handleError(_0x124a16,null));};exports[_0x267a('0xbe')]=function(_0x213d19,_0x2127bb){var _0x1a38da,_0x535d2a,_0x146680;var _0x18d516=[];var _0x48d832={};var _0x4f7ee2=_0x213d19['files']||[];var _0x50a81c=[];var _0x193cdf;return db[_0x267a('0x8d')]['describe']()[_0x267a('0x13')](function(_0x50dde7){if(!_0x50dde7){throw new db[(_0x267a('0x7f'))]['ValidationError'](_0x267a('0x81'));}_0x18d516=_[_0x267a('0x82')](_[_0x267a('0x49')](_0x50dde7),[_0x267a('0xbf'),_0x267a('0x83'),_0x267a('0x84'),'ListId']);if(_0x213d19[_0x267a('0x53')]['id']){delete _0x213d19[_0x267a('0x53')]['id'];}if(_[_0x267a('0x6d')](_0x213d19[_0x267a('0x53')][_0x267a('0x86')])){throw _0x2127bb[_0x267a('0x1f')](0x1f4)[_0x267a('0x2c')](new db[(_0x267a('0x7f'))][(_0x267a('0x80'))](_0x267a('0x87')));}if(_['isNil'](_0x213d19['body'][_0x267a('0x53')])||_0x213d19[_0x267a('0x53')][_0x267a('0x53')]===''){throw _0x2127bb[_0x267a('0x1f')](0x1f4)[_0x267a('0x2c')](new db[(_0x267a('0x7f'))][(_0x267a('0x80'))](_0x267a('0xc0')));}if(_[_0x267a('0x6d')](_0x213d19[_0x267a('0x53')][_0x267a('0xc1')])){throw _0x2127bb[_0x267a('0x1f')](0x1f4)[_0x267a('0x2c')](new db[(_0x267a('0x7f'))]['ValidationError'](_0x267a('0xc2')+_0x18d516));}if(!_[_0x267a('0x89')](_0x18d516,_0x213d19['body'][_0x267a('0xc1')])){throw _0x2127bb[_0x267a('0x1f')](0x1f4)[_0x267a('0x2c')](new db[(_0x267a('0x7f'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18d516));}_0x48d832[_0x213d19[_0x267a('0x53')][_0x267a('0xc1')]]=_0x213d19[_0x267a('0x53')][_0x267a('0x86')];})['then'](function(){return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x213d19[_0x267a('0x54')]['id']},'include':[{'model':db[_0x267a('0x8b')],'as':'List'},{'model':db[_0x267a('0xc3')],'as':_0x267a('0xc3')}]});})[_0x267a('0x13')](handleEntityNotFound(_0x2127bb,null))[_0x267a('0x13')](function(_0x3b6287){if(_0x3b6287&&_0x3b6287[_0x267a('0x8c')]){_0x535d2a=_0x3b6287;var _0x1bdb89=_['defaults'](_0x213d19[_0x267a('0x53')],{'firstName':_0x213d19[_0x267a('0x53')][_0x267a('0x86')],'phone':_0x213d19['body']['from'],'ListId':_0x3b6287[_0x267a('0x85')]});_0x1bdb89[_0x213d19[_0x267a('0x53')][_0x267a('0xc1')]]=_0x213d19[_0x267a('0x53')][_0x267a('0x86')];return db[_0x267a('0x8d')][_0x267a('0xc4')]({'where':_0x48d832,'defaults':_0x1bdb89});}})[_0x267a('0xae')](function(_0x4a4e4c){if(_0x4a4e4c){_0x146680=_0x4a4e4c;var _0x29a03b=fs['readFileSync'](path[_0x267a('0x6e')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x267a('0xc5'));var _0x5c5bf9=ejs['render'](_0x29a03b,{'body':_[_0x267a('0xc6')](_0x213d19['body'][_0x267a('0x53')]),'bodyTitle':_0x535d2a[_0x267a('0xc7')]});return db[_0x267a('0xc8')][_0x267a('0x4b')]({'body':_0x5c5bf9,'plainBody':htmlToText[_0x267a('0xc9')](_0x5c5bf9),'ContactId':_0x4a4e4c['id'],'ChatWebsiteId':_0x535d2a['id']});}})[_0x267a('0x13')](function(_0x3bd3d9){_0x193cdf=_0x3bd3d9;if(_0x4f7ee2[_0x267a('0x39')]){var _0xc81446=_0x4f7ee2[_0x267a('0x30')](function(_0x55bf61){return{'name':_0x55bf61[_0x267a('0xca')],'basename':_0x55bf61['filename'],'type':_0x55bf61[_0x267a('0xcb')],'ChatOfflineMessageId':_0x3bd3d9['id']};});_0x50a81c=_0xc81446['map'](_0x5273ad=>{var _0xf4ec26={'filename':_0x5273ad[_0x267a('0x2b')],'path':path[_0x267a('0x6e')](config[_0x267a('0x70')],_0x267a('0xcc'),_0x267a('0xcd'),_0x267a('0xce'),'offline-chat',_0x5273ad['basename'])};return _0xf4ec26;});if(!_0x535d2a['openNewInteraction']){return db[_0x267a('0xcf')][_0x267a('0xd0')](function(_0x251432){return db['Attachment'][_0x267a('0xd1')](_0xc81446,{'transaction':_0x251432});});}}})[_0x267a('0x13')](function(){if(_0x193cdf){_0x1a38da=_0x193cdf;return db[_0x267a('0xc3')][_0x267a('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x267a('0xd2')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x267a('0x13')](function(_0x1bcb7){if(_0x1bcb7&&_0x1bcb7[_0x267a('0xd3')]&&_0x535d2a[_0x267a('0xd4')]&&_0x535d2a[_0x267a('0xd5')]){var _0xb2e50e=_0x1bcb7[_0x267a('0xd6')]();return respondWithRpcPromise('SendMail',_0x267a('0xd7'),{'account':_0xb2e50e,'message':{'from':util[_0x267a('0xa2')](_0x267a('0xd8'),_0x1bcb7['name'],_0x1bcb7[_0x267a('0xd9')]||_0x1bcb7['Smtp']['user']),'to':_0x535d2a[_0x267a('0xd5')],'subject':_0x535d2a['offlineMessageSubject'],'html':_0x1a38da[_0x267a('0x53')],'attachments':_0x50a81c}},client9003)[_0x267a('0x13')](function(){return _0x1a38da;})[_0x267a('0x1d')](function(_0x9ff9f9){logger[_0x267a('0x18')](_0x9ff9f9);});}})[_0x267a('0x13')](function(){if(_0x535d2a&&_0x535d2a[_0x267a('0xda')]&&_0x535d2a[_0x267a('0xdb')]){var _0x552049=[];if(_0x4f7ee2[_0x267a('0x39')]){_0x552049=_0x4f7ee2['map'](function(_0xc91a07){return{'name':_0xc91a07[_0x267a('0xca')],'basename':_0xc91a07['filename'],'type':_0xc91a07[_0x267a('0xcb')],'ChatOfflineMessageId':_0x193cdf['id']};});}var _0x299f7f;if(!_[_0x267a('0x6d')](_0x535d2a[_0x267a('0xdc')])){var _0x5c8536=_['map'](_0x213d19['body'],function(_0x3b0051){return _0x3b0051;});var _0x93fe82=_[_0x267a('0xdd')](_0x5c8536)[0x0];var _0x514e06=_[_0x267a('0xde')](_0x93fe82,function(_0x1e4fb1){return _0x1e4fb1;});_0x299f7f=_0x514e06[0x1][_0x535d2a[_0x267a('0xdc')]];}var _0x225d63={'from':_0x146680[_0x267a('0xd9')],'firstName':_0x146680[_0x267a('0x9c')],'lastName':_0x146680[_0x267a('0x9d')],'mapKey':_0x267a('0xd9'),'message':{'from':_0x146680['email'],'to':_0x535d2a[_0x267a('0xc3')][_0x267a('0xd9')],'cc':'','subject':_[_0x267a('0x6d')](_0x299f7f)?_0x535d2a[_0x267a('0xdf')]:_0x299f7f,'messageId':'','sentAt':new Date(),'attach':_0x552049['length'],'attachments':_0x552049,'originChannel':_0x267a('0xe0'),'ChatWebsiteId':_0x535d2a['id'],'ChatOfflineMessageId':_0x1a38da['id'],'originTo':_0x535d2a[_0x267a('0xc3')][_0x267a('0xd9')]},'body':_0x1a38da[_0x267a('0x53')]};var _0x44f7ba={'account':{'id':_0x535d2a[_0x267a('0xdb')]},'body':_0x225d63,'log':_0x267a('0xe1')};return respondWithRpcPromise('NotifyMailAccount',_0x267a('0xe2'),_0x44f7ba,client9001)[_0x267a('0x13')](function(){return _0x1a38da;})['catch'](function(_0x243144){logger['error'](_0x243144);});}return;})[_0x267a('0x13')](function(){if(_0x1a38da){return _0x1a38da;}})['then'](respondWithResult(_0x2127bb,null))['catch'](function(_0x4bfdcc){logger[_0x267a('0x18')](_0x267a('0x1d'),_0x4bfdcc);for(var _0x22df65 of _0x4f7ee2){var _0x16bd5e=path['join'](config[_0x267a('0x70')],_0x267a('0xcc'),_0x267a('0xcd'),_0x267a('0xce'),_0x267a('0xe3'),_0x22df65[_0x267a('0x66')]);fs_extra[_0x267a('0xe4')](_0x16bd5e)['catch'](function(_0x3e5f95){logger[_0x267a('0x18')](_0x267a('0xe5'),_0x16bd5e,_0x3e5f95);});}});};exports[_0x267a('0xe6')]=function(_0x161988,_0x2e4baa){return db[_0x267a('0xaa')][_0x267a('0x4a')]({'where':{'id':_0x161988[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x2e4baa,null))[_0x267a('0x13')](function(_0x3ad98d){if(_0x3ad98d){return _0x3ad98d[_0x267a('0xe6')](_0x161988[_0x267a('0x53')]['ids'],_['omit'](_0x161988[_0x267a('0x53')],['ids','id'])||{});}})[_0x267a('0x13')](respondWithResult(_0x2e4baa,null))['catch'](handleError(_0x2e4baa,null));};exports[_0x267a('0xe7')]=function(_0x5854cc,_0x23ebdf){var _0x5c10ea={'raw':![],'where':{}};var _0x6911b9={};var _0x2e5bc6={'count':0x0,'rows':[]};return db[_0x267a('0x43')]['findOne']({'where':{'id':_0x5854cc[_0x267a('0x54')]['id']}})['then'](handleEntityNotFound(_0x23ebdf,null))[_0x267a('0x13')](function(_0x388868){if(_0x388868){_0x6911b9['model']=_[_0x267a('0x49')](db[_0x267a('0xaa')][_0x267a('0x31')]);_0x6911b9[_0x267a('0x34')]=_['keys'](_0x5854cc[_0x267a('0x34')]);_0x6911b9['filters']=_[_0x267a('0x37')](_0x6911b9[_0x267a('0x33')],_0x6911b9[_0x267a('0x34')]);_0x5c10ea['attributes']=_[_0x267a('0x37')](_0x6911b9[_0x267a('0x33')],qs[_0x267a('0x38')](_0x5854cc['query'][_0x267a('0x38')]));_0x5c10ea['attributes']=_0x5c10ea[_0x267a('0x36')][_0x267a('0x39')]?_0x5c10ea['attributes']:_0x6911b9[_0x267a('0x33')];if(!_0x5854cc[_0x267a('0x34')]['hasOwnProperty']('nolimit')){_0x5c10ea[_0x267a('0x23')]=qs[_0x267a('0x23')](_0x5854cc[_0x267a('0x34')][_0x267a('0x23')]);_0x5c10ea[_0x267a('0x21')]=qs['offset'](_0x5854cc['query'][_0x267a('0x21')]);}_0x5c10ea[_0x267a('0x3b')]=qs[_0x267a('0x3c')](_0x5854cc[_0x267a('0x34')][_0x267a('0x3c')]);_0x5c10ea[_0x267a('0x3d')]=qs['filters'](_[_0x267a('0x3e')](_0x5854cc[_0x267a('0x34')],_0x6911b9['filters']));_0x5c10ea[_0x267a('0x3d')][_0x267a('0x59')]=_0x388868['id'];if(_0x5854cc[_0x267a('0x34')][_0x267a('0x3f')]){_0x5c10ea[_0x267a('0x3d')]=_[_0x267a('0x40')](_0x5c10ea['where'],{'$or':_[_0x267a('0x30')](_0x5c10ea[_0x267a('0x36')],function(_0x4f3d25){var _0x24b484={};_0x24b484[_0x4f3d25]={'$like':'%'+_0x5854cc['query'][_0x267a('0x3f')]+'%'};return _0x24b484;})});}_0x5c10ea=_[_0x267a('0x40')]({},_0x5c10ea,_0x5854cc[_0x267a('0x42')]);return db[_0x267a('0xaa')][_0x267a('0x24')]({'where':_0x5c10ea['where']})[_0x267a('0x13')](function(_0x1f6768){_0x2e5bc6[_0x267a('0x24')]=_0x1f6768;if(_0x5854cc[_0x267a('0x34')][_0x267a('0x44')]){_0x5c10ea['include']=[{'model':db[_0x267a('0x8d')],'as':_0x267a('0xe8'),'required':![]},{'model':db[_0x267a('0xb5')],'as':_0x267a('0xe9'),'attributes':[_0x267a('0x2b'),_0x267a('0xea'),_0x267a('0xeb')],'required':![]},{'model':db[_0x267a('0xec')],'as':'Tags','attributes':['id',_0x267a('0x2b'),_0x267a('0xed')],'where':_0x5854cc[_0x267a('0x34')][_0x267a('0xee')]?{'id':_0x5854cc['query']['tag']}:undefined,'required':_0x5854cc['query'][_0x267a('0xee')]?!![]:![]}];}return db['ChatInteraction'][_0x267a('0x46')](_0x5c10ea);})[_0x267a('0x13')](function(_0x2dad1e){_0x2e5bc6[_0x267a('0x47')]=_0x2dad1e;return _0x2e5bc6;});}})[_0x267a('0x13')](respondWithFilteredResult(_0x23ebdf,_0x5c10ea))[_0x267a('0x1d')](handleError(_0x23ebdf,null));};function iftimePromise(_0x2ddf3b,_0x151c38){return respondWithRpcPromise(_0x267a('0xef'),_0x267a('0xf0'),{'command':_0x151c38['timezone']?util[_0x267a('0xa2')](_0x267a('0xf1'),_0x2ddf3b['interval'],_0x151c38[_0x267a('0xf2')]):util[_0x267a('0xa2')](_0x267a('0xf3'),_0x2ddf3b[_0x267a('0xf4')])},client9002)[_0x267a('0x13')](function(_0x3e582f){var _0x3d885e=_0x3e582f&&_0x3e582f[_0x267a('0xf5')](_0x267a('0xf6'))>=0x0?!![]:![];logger[_0x267a('0x14')](_0x267a('0xf7'),_0x151c38['id'],_0x2ddf3b['id'],_0x2ddf3b['interval'],_0x3d885e?_0x267a('0xf8'):_0x267a('0xf9'),_0x151c38[_0x267a('0xf2')]?_0x151c38[_0x267a('0xf2')]:'No\x20timezone');return _0x3d885e;})[_0x267a('0x1d')](function(_0x2d23b9){logger[_0x267a('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x151c38['id'],_0x2ddf3b['id'],_0x2ddf3b[_0x267a('0xf4')],util['inspect'](_0x2d23b9,{'showHidden':![],'depth':null}),_0x151c38[_0x267a('0xf2')]?_0x151c38['timezone']:_0x267a('0xfa'));return![];});}exports[_0x267a('0xf0')]=function(_0x414efe,_0x4a7072){var _0x85f299=0x0;var _0x1b76c3=0x0;var _0x451d58=![];var _0x451a69;var _0x4c0b7c;return db[_0x267a('0x43')]['find']({'where':{'id':_0x414efe[_0x267a('0x54')]['id']},'include':[{'model':db[_0x267a('0xfb')],'as':_0x267a('0xfb'),'include':[{'model':db[_0x267a('0xfb')],'as':'Intervals','attributes':['id',_0x267a('0xf4')],'raw':!![]}]}]})[_0x267a('0x13')](handleEntityNotFound(_0x4a7072,null))['then'](function(_0x16e3f1){if(_0x16e3f1){_0x451a69=_0x16e3f1;return _0x16e3f1[_0x267a('0xfc')]({'raw':!![]});}})[_0x267a('0x13')](function(_0x20ae00){if(_0x451a69){if(_0x20ae00){_0x4c0b7c=_0x20ae00;}}return require(_0x267a('0x6b'))[_0x267a('0x6c')]();})['then'](function(_0x2d26d0){if(_0x2d26d0){_0x1b76c3=_0x2d26d0['virtual'];_0x451d58=_0x2d26d0[_0x267a('0xfd')];}})[_0x267a('0x13')](function(){return db[_0x267a('0xaa')][_0x267a('0x24')]({'where':{'closed':![]}});})[_0x267a('0x13')](function(_0x3d854a){_0x85f299=_0x3d854a;if(_0x1b76c3&&_0x3d854a>_0x1b76c3){return db['License'][_0x267a('0x58')]({'where':{'id':0x1}})[_0x267a('0x13')](function(_0x404e71){if(_0x404e71){_0x404e71[_0x267a('0xfe')](_0x267a('0xff'));}});}})[_0x267a('0x13')](function(){if(_0x451a69[_0x267a('0xfb')]&&_0x451a69[_0x267a('0xfb')][_0x267a('0x100')]){var _0x83da6a=[];for(var _0x4a15f7=0x0;_0x4a15f7<_0x451a69[_0x267a('0xfb')][_0x267a('0x100')]['length'];_0x4a15f7++){var _0x9eb1a6=_0x451a69[_0x267a('0xfb')]['Intervals'][_0x4a15f7][_0x267a('0x4d')]({'plain':!![]});_0x83da6a['push'](iftimePromise(_0x9eb1a6,_0x451a69));}return BPromise['all'](_0x83da6a)[_0x267a('0x13')](function(_0x39d80d){return _['some'](_0x39d80d);});}else{return!![];}})[_0x267a('0x13')](function(_0x387f5f){var _0x21cd2f=fs[_0x267a('0x101')](path[_0x267a('0x6e')](config['root'],_0x267a('0x102')),_0x267a('0xc5'));var _0x3c5be0={'remote':_0x451a69[_0x267a('0x103')],'query':querystring['stringify'](_[_0x267a('0x40')](_0x451a69[_0x267a('0x4d')]({'plain':!![]}),{'customerIp':_0x414efe[_0x267a('0x7c')][_0x267a('0x99')]||_0x414efe[_0x267a('0x7c')][_0x267a('0x104')]||_0x414efe[_0x267a('0x105')][_0x267a('0x106')]||_0x414efe['ip'],'referer':_0x414efe[_0x267a('0x7c')][_0x267a('0x9f')],'openedInteractions':_0x85f299,'maxInteractions':_0x1b76c3,'virtual':_0x451d58['virtual'],'online':_0x387f5f,'custom':_0x451d58}))['replace'](/'/g,'\x5c\x27')};_0x4a7072['send'](ejs[_0x267a('0x107')](Mustache[_0x267a('0x107')](_0x21cd2f,_0x3c5be0),{'proactiveActions':_0x4c0b7c,'alignment':_0x451a69[_0x267a('0x108')],'verticalAlignment':_0x451a69[_0x267a('0x109')],'div_color':_0x451a69[_0x267a('0xed')],'labelText':_0x451a69[_0x267a('0x10a')],'text_color':_0x451a69[_0x267a('0x10b')],'button_color':_0x451a69[_0x267a('0x10c')],'background_color':_0x451a69[_0x267a('0x10d')],'hideWhenOffline':_0x451a69[_0x267a('0x10e')],'interval':_0x451a69[_0x267a('0x10f')]}));})[_0x267a('0x1d')](handleError(_0x4a7072,null));};exports[_0x267a('0x110')]=function(_0x151167,_0x3badf7){var _0x4ac67c=_0x151167[_0x267a('0x54')]['id'];var _0x37d2d5=_0x151167[_0x267a('0x53')];var _0x151615=0xc8;var _0x30c68b=null;return db['sequelize'][_0x267a('0xd0')]({'isolationLevel':db[_0x267a('0xcf')]['Transaction'][_0x267a('0x111')][_0x267a('0x112')]},function(_0xe1c011){return db[_0x267a('0x43')][_0x267a('0x58')]({'where':{'id':_0x4ac67c},'transaction':_0xe1c011})[_0x267a('0x13')](function(_0x45d2c7){if(_0x45d2c7){return db[_0x267a('0x8f')]['destroy']({'where':{'ChatWebsiteId':_0x4ac67c},'transaction':_0xe1c011})[_0x267a('0x13')](function(){var _0x1c8a36=_[_0x267a('0x30')](_0x37d2d5,function(_0x5cabe7){_0x5cabe7[_0x267a('0x59')]=_0x4ac67c;return _0x5cabe7;});return db[_0x267a('0x8f')][_0x267a('0xd1')](_0x1c8a36,{'transaction':_0xe1c011});});}else{_0x151615=0x194;_0x30c68b=[];}});})[_0x267a('0x13')](function(){if(_0x151615!==0x194){return db[_0x267a('0x8f')][_0x267a('0x113')]({'where':{'ChatWebsiteId':_0x4ac67c},'order':_0x267a('0x94')})[_0x267a('0x13')](function(_0x5aa8a6){_0x30c68b=_0x5aa8a6;});}})[_0x267a('0x1d')](function(_0x52982b){_0x151615=0x1f4;logger[_0x267a('0x18')](_0x52982b[_0x267a('0x114')]);if(_0x52982b[_0x267a('0x2b')]){delete _0x52982b[_0x267a('0x2b')];}_0x30c68b=_0x52982b;})[_0x267a('0x115')](function(){if(_0x30c68b===null){_0x3badf7[_0x267a('0x1e')](_0x151615);}else{if(_0x151615===0x1f4){_0x3badf7[_0x267a('0x1f')](_0x151615)[_0x267a('0x2c')](_0x30c68b);}else{_0x3badf7[_0x267a('0x1f')](_0x151615)[_0x267a('0x27')](_0x30c68b);}}});};exports['getApplications']=function(_0x441b33,_0x2a4d8c){var _0x1efee9={};var _0x41fd40={};var _0x3b957f;var _0x5a39fe;return db['ChatWebsite'][_0x267a('0x58')]({'where':{'id':_0x441b33['params']['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x2a4d8c,null))[_0x267a('0x13')](function(_0x43f1f3){if(_0x43f1f3){_0x3b957f=_0x43f1f3;_0x41fd40[_0x267a('0x33')]=_[_0x267a('0x49')](db[_0x267a('0x8f')][_0x267a('0x31')]);_0x41fd40[_0x267a('0x34')]=_[_0x267a('0x49')](_0x441b33['query']);_0x41fd40[_0x267a('0x35')]=_[_0x267a('0x37')](_0x41fd40[_0x267a('0x33')],_0x41fd40[_0x267a('0x34')]);_0x1efee9['attributes']=_[_0x267a('0x37')](_0x41fd40[_0x267a('0x33')],qs['fields'](_0x441b33[_0x267a('0x34')][_0x267a('0x38')]));_0x1efee9['attributes']=_0x1efee9[_0x267a('0x36')]['length']?_0x1efee9[_0x267a('0x36')]:_0x41fd40[_0x267a('0x33')];_0x1efee9[_0x267a('0x3b')]=qs['sort'](_0x441b33[_0x267a('0x34')]['sort']);_0x1efee9[_0x267a('0x3d')]=qs[_0x267a('0x35')](_[_0x267a('0x3e')](_0x441b33[_0x267a('0x34')],_0x41fd40[_0x267a('0x35')]));if(_0x441b33[_0x267a('0x34')]['filter']){_0x1efee9[_0x267a('0x3d')]=_[_0x267a('0x40')](_0x1efee9['where'],{'$or':_['map'](_0x1efee9[_0x267a('0x36')],function(_0x2ee43e){var _0x4462d0={};_0x4462d0[_0x2ee43e]={'$like':'%'+_0x441b33['query'][_0x267a('0x3f')]+'%'};return _0x4462d0;})});}_0x1efee9=_['merge']({},_0x1efee9,_0x441b33[_0x267a('0x42')]);return _0x3b957f['getApplications'](_0x1efee9);}})[_0x267a('0x13')](function(_0x360673){if(_0x360673){_0x5a39fe=_0x360673[_0x267a('0x39')];if(!_0x441b33[_0x267a('0x34')][_0x267a('0x3a')](_0x267a('0x60'))){_0x1efee9[_0x267a('0x23')]=qs[_0x267a('0x23')](_0x441b33[_0x267a('0x34')]['limit']);_0x1efee9[_0x267a('0x21')]=qs['offset'](_0x441b33[_0x267a('0x34')][_0x267a('0x21')]);}return _0x3b957f[_0x267a('0x116')](_0x1efee9);}})[_0x267a('0x13')](function(_0x4c2ecf){if(_0x4c2ecf){return _0x4c2ecf?{'count':_0x5a39fe,'rows':_0x4c2ecf}:null;}})[_0x267a('0x13')](respondWithResult(_0x2a4d8c,null))[_0x267a('0x1d')](handleError(_0x2a4d8c,null));};exports[_0x267a('0x117')]=function(_0x59fd6e,_0x388d10){return db['chatProactiveAction'][_0x267a('0x4a')]({'where':{'id':_0x59fd6e[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x388d10,null))[_0x267a('0x13')](function(_0x238d61){if(_0x238d61){return _0x238d61[_0x267a('0x117')](_0x59fd6e[_0x267a('0x53')][_0x267a('0x5c')],_[_0x267a('0x118')](_0x59fd6e[_0x267a('0x53')],['ids','id'])||{});}})[_0x267a('0x13')](respondWithResult(_0x388d10,null))[_0x267a('0x1d')](handleError(_0x388d10,null));};exports[_0x267a('0xfc')]=function(_0x4edac4,_0x3121b9){var _0x17fd35={};var _0x5f2020={};var _0x4d3599;var _0x347a00;return db[_0x267a('0x43')][_0x267a('0x58')]({'where':{'id':_0x4edac4[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x3121b9,null))[_0x267a('0x13')](function(_0x565a27){if(_0x565a27){_0x4d3599=_0x565a27;_0x5f2020[_0x267a('0x33')]=_['keys'](db[_0x267a('0x119')][_0x267a('0x31')]);_0x5f2020[_0x267a('0x34')]=_[_0x267a('0x49')](_0x4edac4[_0x267a('0x34')]);_0x5f2020[_0x267a('0x35')]=_[_0x267a('0x37')](_0x5f2020['model'],_0x5f2020[_0x267a('0x34')]);_0x17fd35[_0x267a('0x36')]=_[_0x267a('0x37')](_0x5f2020[_0x267a('0x33')],qs['fields'](_0x4edac4[_0x267a('0x34')][_0x267a('0x38')]));_0x17fd35[_0x267a('0x36')]=_0x17fd35[_0x267a('0x36')]['length']?_0x17fd35[_0x267a('0x36')]:_0x5f2020[_0x267a('0x33')];_0x17fd35[_0x267a('0x3b')]=qs[_0x267a('0x3c')](_0x4edac4[_0x267a('0x34')][_0x267a('0x3c')]);_0x17fd35[_0x267a('0x3d')]=qs[_0x267a('0x35')](_[_0x267a('0x3e')](_0x4edac4['query'],_0x5f2020[_0x267a('0x35')]));if(_0x4edac4['query']['filter']){_0x17fd35[_0x267a('0x3d')]=_['merge'](_0x17fd35[_0x267a('0x3d')],{'$or':_[_0x267a('0x30')](_0x17fd35[_0x267a('0x36')],function(_0x1cf035){var _0x11df42={};_0x11df42[_0x1cf035]={'$like':'%'+_0x4edac4['query'][_0x267a('0x3f')]+'%'};return _0x11df42;})});}_0x17fd35=_[_0x267a('0x40')]({},_0x17fd35,_0x4edac4['options']);return _0x4d3599['getProactiveActions'](_0x17fd35);}})[_0x267a('0x13')](function(_0x5ec598){if(_0x5ec598){_0x347a00=_0x5ec598[_0x267a('0x39')];if(!_0x4edac4[_0x267a('0x34')]['hasOwnProperty']('nolimit')){_0x17fd35['limit']=qs[_0x267a('0x23')](_0x4edac4[_0x267a('0x34')]['limit']);_0x17fd35[_0x267a('0x21')]=qs[_0x267a('0x21')](_0x4edac4['query']['offset']);}return _0x4d3599['getProactiveActions'](_0x17fd35);}})[_0x267a('0x13')](function(_0x5df16c){if(_0x5df16c){return _0x5df16c?{'count':_0x347a00,'rows':_0x5df16c}:null;}})['then'](respondWithResult(_0x3121b9,null))[_0x267a('0x1d')](handleError(_0x3121b9,null));};exports['getFields']=function(_0x562b05,_0x222171){var _0x21f95f=_0x562b05[_0x267a('0x34')][_0x267a('0x11a')]===_0x267a('0x11b')?_0x267a('0x11c'):_0x267a('0x11d');return db[_0x267a('0x43')][_0x267a('0x4a')]({'attributes':['id',_0x21f95f],'where':{'id':_0x562b05[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x222171,null))[_0x267a('0x13')](function(_0x414d1e){if(_0x414d1e){var _0x2f61a9=_0x414d1e[_0x21f95f];var _0x13aa57=_0x2f61a9&&_0x2f61a9[_0x267a('0x11e')]?_0x2f61a9[_0x267a('0x11e')]:[];_0x222171[_0x267a('0x2c')]({'fromKey':_[_0x267a('0x6d')](_0x2f61a9[_0x267a('0x11f')])?undefined:_0x2f61a9['fromKey'],'count':_0x13aa57[_0x267a('0x39')],'rows':_0x13aa57});}})[_0x267a('0x1d')](handleError(_0x222171,null));};exports[_0x267a('0x120')]=function(_0x29d08b,_0x19fa1e){var _0x2e14cf={'raw':![],'where':{}};var _0x58e738={};var _0x521c7e={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x29d08b['params']['id']}})['then'](handleEntityNotFound(_0x19fa1e,null))[_0x267a('0x13')](function(_0x37c0b1){if(_0x37c0b1){_0x58e738[_0x267a('0x33')]=_[_0x267a('0x49')](db[_0x267a('0xc8')][_0x267a('0x31')]);_0x58e738[_0x267a('0x34')]=_[_0x267a('0x49')](_0x29d08b[_0x267a('0x34')]);_0x58e738[_0x267a('0x35')]=_[_0x267a('0x37')](_0x58e738[_0x267a('0x33')],_0x58e738[_0x267a('0x34')]);_0x2e14cf[_0x267a('0x36')]=_['intersection'](_0x58e738['model'],qs['fields'](_0x29d08b['query'][_0x267a('0x38')]));_0x2e14cf[_0x267a('0x36')]=_0x2e14cf[_0x267a('0x36')][_0x267a('0x39')]?_0x2e14cf[_0x267a('0x36')]:_0x58e738[_0x267a('0x33')];if(!_0x29d08b[_0x267a('0x34')][_0x267a('0x3a')](_0x267a('0x60'))){_0x2e14cf[_0x267a('0x23')]=qs[_0x267a('0x23')](_0x29d08b[_0x267a('0x34')][_0x267a('0x23')]);_0x2e14cf[_0x267a('0x21')]=qs['offset'](_0x29d08b[_0x267a('0x34')][_0x267a('0x21')]);}_0x2e14cf['order']=qs[_0x267a('0x3c')](_0x29d08b[_0x267a('0x34')][_0x267a('0x3c')]);_0x2e14cf['where']=qs[_0x267a('0x35')](_['pick'](_0x29d08b['query'],_0x58e738[_0x267a('0x35')]));_0x2e14cf[_0x267a('0x3d')][_0x267a('0x59')]=_0x37c0b1['id'];if(_0x29d08b[_0x267a('0x34')]['filter']){_0x2e14cf['where']=_[_0x267a('0x40')](_0x2e14cf[_0x267a('0x3d')],{'$or':_[_0x267a('0x30')](_0x2e14cf[_0x267a('0x36')],function(_0x16d36a){var _0x16b202={};_0x16b202[_0x16d36a]={'$like':'%'+_0x29d08b['query'][_0x267a('0x3f')]+'%'};return _0x16b202;})});}_0x2e14cf=_[_0x267a('0x40')]({},_0x2e14cf,_0x29d08b[_0x267a('0x42')]);return db[_0x267a('0xc8')][_0x267a('0x24')]({'where':_0x2e14cf[_0x267a('0x3d')]})[_0x267a('0x13')](function(_0x454469){_0x521c7e[_0x267a('0x24')]=_0x454469;if(_0x29d08b[_0x267a('0x34')][_0x267a('0x44')]){_0x2e14cf[_0x267a('0x45')]=[{'all':!![]}];}else{_0x2e14cf['include']=[{'model':db[_0x267a('0x8d')],'as':_0x267a('0xe8'),'required':![]},{'model':db[_0x267a('0x121')],'as':_0x267a('0x122'),'required':![]}];}return db[_0x267a('0xc8')][_0x267a('0x46')](_0x2e14cf);})[_0x267a('0x13')](function(_0x1fdbf4){_0x521c7e[_0x267a('0x47')]=_0x1fdbf4;return _0x521c7e;});}})[_0x267a('0x13')](respondWithFilteredResult(_0x19fa1e,_0x2e14cf))[_0x267a('0x1d')](handleError(_0x19fa1e,null));};exports[_0x267a('0x123')]=function(_0x30cd9f,_0x4a7687){return db[_0x267a('0x43')]['find']({'where':{'id':_0x30cd9f[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x4a7687,null))['then'](function(_0x303cd6){if(_0x303cd6){return _0x303cd6[_0x267a('0x123')](_0x30cd9f['body'][_0x267a('0x5c')],_[_0x267a('0x118')](_0x30cd9f['body'],['ids','id'])||{})[_0x267a('0xae')](function(_0x236223){for(var _0x5f25f4=0x0;_0x5f25f4<_0x30cd9f[_0x267a('0x53')][_0x267a('0x5c')][_0x267a('0x39')];_0x5f25f4+=0x1){socket['emit'](_0x267a('0x124'),{'UserId':Number(_0x30cd9f[_0x267a('0x53')]['ids'][_0x5f25f4]),'ChatWebsiteId':Number(_0x30cd9f[_0x267a('0x54')]['id'])});}return _0x236223;});}})[_0x267a('0x13')](respondWithResult(_0x4a7687,null))[_0x267a('0x1d')](handleError(_0x4a7687,null));};exports[_0x267a('0x125')]=function(_0x31a9b2,_0x303dc7){return db[_0x267a('0x43')][_0x267a('0x4a')]({'where':{'id':_0x31a9b2[_0x267a('0x54')]['id']}})['then'](handleEntityNotFound(_0x303dc7,null))[_0x267a('0x13')](function(_0x3ce330){if(_0x3ce330){return _0x3ce330['removeAgents'](_0x31a9b2[_0x267a('0x34')]['ids'])['then'](function(){if(_[_0x267a('0x126')](_0x31a9b2[_0x267a('0x34')]['ids'])){for(var _0xd1131e=0x0;_0xd1131e<_0x31a9b2['query'][_0x267a('0x5c')][_0x267a('0x39')];_0xd1131e+=0x1){socket[_0x267a('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x31a9b2['query']['ids'][_0xd1131e]),'ChatWebsiteId':Number(_0x31a9b2[_0x267a('0x54')]['id'])});}}else{socket[_0x267a('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x31a9b2[_0x267a('0x34')][_0x267a('0x5c')]),'ChatWebsiteId':Number(_0x31a9b2[_0x267a('0x54')]['id'])});}});}})[_0x267a('0x13')](respondWithStatusCode(_0x303dc7,null))[_0x267a('0x1d')](handleError(_0x303dc7,null));};exports[_0x267a('0x128')]=function(_0x11d3e5,_0x32c26f){var _0x46b472={};var _0x5d666e={};var _0x1722fb;var _0x5d148f;return db[_0x267a('0x43')][_0x267a('0x58')]({'where':{'id':_0x11d3e5[_0x267a('0x54')]['id']}})[_0x267a('0x13')](handleEntityNotFound(_0x32c26f,null))[_0x267a('0x13')](function(_0x27fbfb){if(_0x27fbfb){_0x1722fb=_0x27fbfb;_0x5d666e['model']=_[_0x267a('0x49')](db[_0x267a('0xb5')][_0x267a('0x31')]);_0x5d666e['query']=_['keys'](_0x11d3e5[_0x267a('0x34')]);_0x5d666e[_0x267a('0x35')]=_['intersection'](_0x5d666e[_0x267a('0x33')],_0x5d666e['query']);_0x46b472['attributes']=_[_0x267a('0x37')](_0x5d666e[_0x267a('0x33')],qs[_0x267a('0x38')](_0x11d3e5[_0x267a('0x34')][_0x267a('0x38')]));_0x46b472[_0x267a('0x36')]=_0x46b472[_0x267a('0x36')][_0x267a('0x39')]?_0x46b472[_0x267a('0x36')]:_0x5d666e[_0x267a('0x33')];_0x46b472['order']=qs[_0x267a('0x3c')](_0x11d3e5['query'][_0x267a('0x3c')]);_0x46b472[_0x267a('0x3d')]=qs[_0x267a('0x35')](_['pick'](_0x11d3e5['query'],_0x5d666e[_0x267a('0x35')]));if(_0x11d3e5[_0x267a('0x34')]['filter']){_0x46b472['where']=_[_0x267a('0x40')](_0x46b472[_0x267a('0x3d')],{'$or':_[_0x267a('0x30')](_0x46b472['attributes'],function(_0x4e1eb0){var _0x119132={};_0x119132[_0x4e1eb0]={'$like':'%'+_0x11d3e5['query'][_0x267a('0x3f')]+'%'};return _0x119132;})});}_0x46b472=_[_0x267a('0x40')]({},_0x46b472,_0x11d3e5[_0x267a('0x42')]);return _0x1722fb[_0x267a('0x128')](_0x46b472);}})[_0x267a('0x13')](function(_0x5465a4){if(_0x5465a4){_0x5d148f=_0x5465a4[_0x267a('0x39')];if(!_0x11d3e5['query'][_0x267a('0x3a')](_0x267a('0x60'))){_0x46b472[_0x267a('0x23')]=qs[_0x267a('0x23')](_0x11d3e5[_0x267a('0x34')][_0x267a('0x23')]);_0x46b472[_0x267a('0x21')]=qs[_0x267a('0x21')](_0x11d3e5['query'][_0x267a('0x21')]);}return _0x1722fb['getAgents'](_0x46b472);}})['then'](function(_0x22d09e){if(_0x22d09e){return _0x22d09e?{'count':_0x5d148f,'rows':_0x22d09e}:null;}})['then'](respondWithResult(_0x32c26f,null))[_0x267a('0x1d')](handleError(_0x32c26f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ea4efff..bd7cba0 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 _0x7da7=['remove','emit','hook','events','../../mysqldb','ChatWebsite','update'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7da7,0x10d));var _0x77da=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7da7[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0x77da('0x0'));var ChatWebsite=require(_0x77da('0x1'))['db'][_0x77da('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x77da('0x3'),'afterDestroy':_0x77da('0x4')};function emitEvent(_0x4f60c3){return function(_0x3a9fa6,_0x37b3d9,_0x56458c){ChatWebsiteEvents[_0x77da('0x5')](_0x4f60c3+':'+_0x3a9fa6['id'],_0x3a9fa6);ChatWebsiteEvents[_0x77da('0x5')](_0x4f60c3,_0x3a9fa6);_0x56458c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x77da('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x1ef3=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1d171d,_0x270b29){var _0x5dc43e=function(_0x562e05){while(--_0x562e05){_0x1d171d['push'](_0x1d171d['shift']());}};_0x5dc43e(++_0x270b29);}(_0x1ef3,0x69));var _0x31ef=function(_0x56ac47,_0x14c63f){_0x56ac47=_0x56ac47-0x0;var _0x10ec1a=_0x1ef3[_0x56ac47];return _0x10ec1a;};'use strict';var EventEmitter=require(_0x31ef('0x0'));var ChatWebsite=require(_0x31ef('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x31ef('0x2')](0x0);var events={'afterCreate':_0x31ef('0x3'),'afterUpdate':_0x31ef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x311a32){return function(_0x58388a,_0x49ce87,_0x1a8d7f){ChatWebsiteEvents[_0x31ef('0x5')](_0x311a32+':'+_0x58388a['id'],_0x58388a);ChatWebsiteEvents[_0x31ef('0x5')](_0x311a32,_0x58388a);_0x1a8d7f(null);};}for(var e in events){if(events[_0x31ef('0x6')](e)){var event=events[e];ChatWebsite[_0x31ef('0x7')](e,emitEvent(event));}}module[_0x31ef('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c1bd5dc..e214039 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 _0xd95f=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xd95f,0x1f1));var _0xfd95=function(_0x56029b,_0x4c3c28){_0x56029b=_0x56029b-0x0;var _0x4525bb=_0xd95f[_0x56029b];return _0x4525bb;};'use strict';var _=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var logger=require(_0xfd95('0x2'))(_0xfd95('0x3'));var moment=require(_0xfd95('0x4'));var BPromise=require(_0xfd95('0x5'));var rp=require(_0xfd95('0x6'));var fs=require('fs');var path=require(_0xfd95('0x7'));var rimraf=require(_0xfd95('0x8'));var config=require(_0xfd95('0x9'));var attributes=require(_0xfd95('0xa'));module[_0xfd95('0xb')]=function(_0x33ea8a,_0x18c659){return _0x33ea8a[_0xfd95('0xc')](_0xfd95('0xd'),attributes,{'tableName':_0xfd95('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb354=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb354,0x198));var _0x4b35=function(_0x3ca7a9,_0x4fc0c7){_0x3ca7a9=_0x3ca7a9-0x0;var _0x399428=_0xb354[_0x3ca7a9];return _0x399428;};'use strict';var _=require(_0x4b35('0x0'));var util=require(_0x4b35('0x1'));var logger=require(_0x4b35('0x2'))(_0x4b35('0x3'));var moment=require('moment');var BPromise=require(_0x4b35('0x4'));var rp=require(_0x4b35('0x5'));var fs=require('fs');var path=require(_0x4b35('0x6'));var rimraf=require('rimraf');var config=require(_0x4b35('0x7'));var attributes=require(_0x4b35('0x8'));module[_0x4b35('0x9')]=function(_0x3561b5,_0x9ffa93){return _0x3561b5[_0x4b35('0xa')](_0x4b35('0xb'),attributes,{'tableName':_0x4b35('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 35c91ee..f44cc9a 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 _0x17f0=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x51bb57,_0x31f64f){var _0x40123c=function(_0x5c6c54){while(--_0x5c6c54){_0x51bb57['push'](_0x51bb57['shift']());}};_0x40123c(++_0x31f64f);}(_0x17f0,0x66));var _0x017f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x17f0[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x017f('0x0'));var util=require(_0x017f('0x1'));var moment=require(_0x017f('0x2'));var BPromise=require(_0x017f('0x3'));var rs=require(_0x017f('0x4'));var fs=require('fs');var Redis=require(_0x017f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x017f('0x6'));var logger=require(_0x017f('0x7'))(_0x017f('0x8'));var config=require('../../config/environment');var jayson=require(_0x017f('0x9'));var client=jayson[_0x017f('0xa')][_0x017f('0xb')]({'port':0x232a});config[_0x017f('0xc')]=_[_0x017f('0xd')](config[_0x017f('0xc')],{'host':_0x017f('0xe'),'port':0x18eb});var socket=require(_0x017f('0xf'))(new Redis(config[_0x017f('0xc')]));require(_0x017f('0x10'))['register'](socket);function respondWithRpcPromise(_0x4074e4,_0x2c4cfa,_0x4d656f){return new BPromise(function(_0x3cf9af,_0x5f17ec){return client[_0x017f('0x11')](_0x4074e4,_0x4d656f)['then'](function(_0x18f0fd){logger[_0x017f('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2c4cfa,_0x017f('0x13'));logger['debug'](_0x017f('0x14'),_0x2c4cfa,'request\x20sent',JSON[_0x017f('0x15')](_0x18f0fd));if(_0x18f0fd[_0x017f('0x16')]){if(_0x18f0fd[_0x017f('0x16')][_0x017f('0x17')]===0x1f4){logger[_0x017f('0x16')](_0x017f('0x18'),_0x2c4cfa,_0x18f0fd[_0x017f('0x16')][_0x017f('0x19')]);return _0x5f17ec(_0x18f0fd[_0x017f('0x16')][_0x017f('0x19')]);}logger[_0x017f('0x16')](_0x017f('0x18'),_0x2c4cfa,_0x18f0fd['error'][_0x017f('0x19')]);return _0x3cf9af(_0x18f0fd[_0x017f('0x16')]['message']);}else{logger[_0x017f('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2c4cfa,_0x017f('0x13'));_0x3cf9af(_0x18f0fd['result']['message']);}})[_0x017f('0x1a')](function(_0x5c99a1){logger[_0x017f('0x16')](_0x017f('0x18'),_0x2c4cfa,_0x5c99a1);_0x5f17ec(_0x5c99a1);});});} \ No newline at end of file +var _0xa80c=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x320b91,_0x3c1f52){var _0x5ae54f=function(_0x3f9e6a){while(--_0x3f9e6a){_0x320b91['push'](_0x320b91['shift']());}};_0x5ae54f(++_0x3c1f52);}(_0xa80c,0xf3));var _0xca80=function(_0x5c2831,_0xb936cc){_0x5c2831=_0x5c2831-0x0;var _0x3fc79d=_0xa80c[_0x5c2831];return _0x3fc79d;};'use strict';var _=require(_0xca80('0x0'));var util=require(_0xca80('0x1'));var moment=require(_0xca80('0x2'));var BPromise=require('bluebird');var rs=require(_0xca80('0x3'));var fs=require('fs');var Redis=require(_0xca80('0x4'));var db=require(_0xca80('0x5'))['db'];var utils=require(_0xca80('0x6'));var logger=require('../../config/logger')(_0xca80('0x7'));var config=require(_0xca80('0x8'));var jayson=require(_0xca80('0x9'));var client=jayson[_0xca80('0xa')][_0xca80('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xca80('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca80('0xc')]));require(_0xca80('0xd'))['register'](socket);function respondWithRpcPromise(_0x51d4ec,_0x51e2a2,_0x4e886a){return new BPromise(function(_0x59230e,_0x46d402){return client[_0xca80('0xe')](_0x51d4ec,_0x4e886a)[_0xca80('0xf')](function(_0xd1107c){logger[_0xca80('0x10')](_0xca80('0x11'),_0x51e2a2,_0xca80('0x12'));logger[_0xca80('0x13')](_0xca80('0x14'),_0x51e2a2,_0xca80('0x12'),JSON[_0xca80('0x15')](_0xd1107c));if(_0xd1107c[_0xca80('0x16')]){if(_0xd1107c['error'][_0xca80('0x17')]===0x1f4){logger['error'](_0xca80('0x11'),_0x51e2a2,_0xd1107c[_0xca80('0x16')][_0xca80('0x18')]);return _0x46d402(_0xd1107c['error'][_0xca80('0x18')]);}logger['error'](_0xca80('0x11'),_0x51e2a2,_0xd1107c[_0xca80('0x16')][_0xca80('0x18')]);return _0x59230e(_0xd1107c[_0xca80('0x16')][_0xca80('0x18')]);}else{logger[_0xca80('0x10')](_0xca80('0x11'),_0x51e2a2,'request\x20sent');_0x59230e(_0xd1107c[_0xca80('0x19')][_0xca80('0x18')]);}})[_0xca80('0x1a')](function(_0x2f0e36){logger['error'](_0xca80('0x11'),_0x51e2a2,_0x2f0e36);_0x46d402(_0x2f0e36);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ac2f7b8..d9b63ba 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 _0x606e=['length','save','update','removeListener','register'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x606e,0x18c));var _0xe606=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x606e[_0x1e6e4e];return _0x3d746b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe606('0x0'),'remove',_0xe606('0x1')];function createListener(_0x4c64b3,_0x4ef64a){return function(_0xe8bb45){_0x4ef64a['emit'](_0x4c64b3,_0xe8bb45);};}function removeListener(_0x911a09,_0x5eeb03){return function(){ChatWebsiteEvents[_0xe606('0x2')](_0x911a09,_0x5eeb03);};}exports[_0xe606('0x3')]=function(_0x2b4ab0){for(var _0x457e3f=0x0,_0xf69ddd=events[_0xe606('0x4')];_0x457e3f<_0xf69ddd;_0x457e3f++){var _0x11f012=events[_0x457e3f];var _0x149698=createListener('chatWebsite:'+_0x11f012,_0x2b4ab0);ChatWebsiteEvents['on'](_0x11f012,_0x149698);}}; \ No newline at end of file +var _0x2903=['save','remove','emit','removeListener','chatWebsite:','./chatWebsite.events'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x2903,0x6b));var _0x3290=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2903[_0x321bb2];return _0x9c12ed;};'use strict';var ChatWebsiteEvents=require(_0x3290('0x0'));var events=[_0x3290('0x1'),_0x3290('0x2'),'update'];function createListener(_0xbe0f20,_0x11f2d0){return function(_0x4c9090){_0x11f2d0[_0x3290('0x3')](_0xbe0f20,_0x4c9090);};}function removeListener(_0x548981,_0x580fa2){return function(){ChatWebsiteEvents[_0x3290('0x4')](_0x548981,_0x580fa2);};}exports['register']=function(_0xae2255){for(var _0x5e1cbb=0x0,_0x413e02=events['length'];_0x5e1cbb<_0x413e02;_0x5e1cbb++){var _0x488b52=events[_0x5e1cbb];var _0x2f73ad=createListener(_0x3290('0x5')+_0x488b52,_0xae2255);ChatWebsiteEvents['on'](_0x488b52,_0x2f73ad);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4b8b364..81d5219 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 _0x3551=['join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','single','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/applications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage'];(function(_0x28b385,_0x40471e){var _0x34d7dc=function(_0x434ef3){while(--_0x434ef3){_0x28b385['push'](_0x28b385['shift']());}};_0x34d7dc(++_0x40471e);}(_0x3551,0xad));var _0x1355=function(_0x14be9e,_0x44e984){_0x14be9e=_0x14be9e-0x0;var _0x11fd99=_0x3551[_0x14be9e];return _0x11fd99;};'use strict';var multer=require(_0x1355('0x0'));var util=require(_0x1355('0x1'));var path=require(_0x1355('0x2'));var timeout=require(_0x1355('0x3'));var express=require(_0x1355('0x4'));var router=express['Router']();var fs_extra=require(_0x1355('0x5'));var auth=require(_0x1355('0x6'));var interaction=require(_0x1355('0x7'));var config=require(_0x1355('0x8'));var controller=require(_0x1355('0x9'));router[_0x1355('0xa')]('/',auth[_0x1355('0xb')](),controller[_0x1355('0xc')]);router[_0x1355('0xa')](_0x1355('0xd'),auth[_0x1355('0xb')](),controller[_0x1355('0xe')]);router['get'](_0x1355('0xf'),auth[_0x1355('0xb')](),controller[_0x1355('0x10')]);router[_0x1355('0xa')](_0x1355('0x11'),auth[_0x1355('0xb')](),controller['getDispositions']);router[_0x1355('0xa')](_0x1355('0x12'),auth['isAuthenticated'](),controller[_0x1355('0x13')]);router[_0x1355('0xa')](_0x1355('0x14'),controller[_0x1355('0x15')]);router[_0x1355('0xa')](_0x1355('0x16'),controller[_0x1355('0x17')]);router[_0x1355('0xa')](_0x1355('0x18'),controller[_0x1355('0x19')]);router[_0x1355('0xa')](_0x1355('0x1a'),controller[_0x1355('0x1b')]);router[_0x1355('0xa')]('/:id/interactions',auth[_0x1355('0xb')](),controller[_0x1355('0x1c')]);router[_0x1355('0xa')]('/:id/snippet',controller['getSnippet']);router[_0x1355('0xa')](_0x1355('0x1d'),auth[_0x1355('0xb')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1355('0x1e')]);router[_0x1355('0xa')](_0x1355('0x1f'),controller[_0x1355('0x20')]);router[_0x1355('0xa')]('/:id/offline_messages',auth[_0x1355('0xb')](),controller[_0x1355('0x21')]);router[_0x1355('0xa')](_0x1355('0x22'),auth[_0x1355('0xb')](),controller[_0x1355('0x23')]);router['post']('/',auth[_0x1355('0xb')](),controller['create']);router[_0x1355('0x24')](_0x1355('0x11'),auth[_0x1355('0xb')](),controller[_0x1355('0x25')]);router[_0x1355('0x24')](_0x1355('0x12'),auth['isAuthenticated'](),controller[_0x1355('0x26')]);var upload=multer({'storage':multer[_0x1355('0x27')]({'destination':function(_0x587be5,_0x555874,_0x321572){_0x321572(null,path[_0x1355('0x28')](config[_0x1355('0x29')],_0x1355('0x2a')));},'filename':function(_0x1f89bf,_0x834699,_0x48f892){_0x48f892(null,util[_0x1355('0x2b')](_0x1355('0x2c'),Date[_0x1355('0x2d')](),_0x834699[_0x1355('0x2e')]));}})});router[_0x1355('0x24')](_0x1355('0x14'),upload['single'](_0x1355('0x2f')),controller[_0x1355('0x30')]);var upload=multer({'storage':multer[_0x1355('0x27')]({'destination':function(_0x1ebb62,_0x4c1f32,_0x577fe6){_0x577fe6(null,path[_0x1355('0x28')](config[_0x1355('0x29')],_0x1355('0x31')));},'filename':function(_0x1fc4c0,_0x34435e,_0x4cee9f){_0x4cee9f(null,util[_0x1355('0x2b')](_0x1355('0x2c'),Date['now'](),_0x34435e[_0x1355('0x2e')]));}})});router[_0x1355('0x24')](_0x1355('0x16'),upload[_0x1355('0x32')](_0x1355('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1355('0x27')]({'destination':function(_0x4f3fbd,_0x4a87f7,_0x1d7a9f){_0x1d7a9f(null,path['join'](config[_0x1355('0x29')],_0x1355('0x31')));},'filename':function(_0x10a4d0,_0x324c87,_0x5628e1){_0x5628e1(null,util[_0x1355('0x2b')](_0x1355('0x2c'),Date[_0x1355('0x2d')](),_0x324c87[_0x1355('0x2e')]));}})});router['post'](_0x1355('0x18'),upload[_0x1355('0x32')](_0x1355('0x2f')),controller[_0x1355('0x33')]);var upload=multer({'storage':multer[_0x1355('0x27')]({'destination':function(_0x16437e,_0x3b6f42,_0x53aa1d){_0x53aa1d(null,path[_0x1355('0x28')](config[_0x1355('0x29')],_0x1355('0x31')));},'filename':function(_0x46aca8,_0x5a4d08,_0x4cdd63){_0x4cdd63(null,util[_0x1355('0x2b')](_0x1355('0x2c'),Date[_0x1355('0x2d')](),_0x5a4d08[_0x1355('0x2e')]));}})});router[_0x1355('0x24')](_0x1355('0x1a'),upload['single'](_0x1355('0x2f')),controller[_0x1355('0x34')]);router[_0x1355('0x24')]('/:id/notify',controller[_0x1355('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x374b55,_0xd75d0d,_0x1cfd3c){const _0x35c0b0=path['join'](config[_0x1355('0x29')],_0x1355('0x36'),_0x1355('0x37'),_0x1355('0x38'));fs_extra[_0x1355('0x39')](_0x35c0b0,function(){_0x1cfd3c(null,_0x35c0b0);});},'filename':function(_0x26e9ca,_0x48c989,_0x365718){const _0x50ac6d=_0x48c989['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x304cdd=path['extname'](_0x50ac6d);const _0x494644=Date[_0x1355('0x2d')]()+'-'+_0x50ac6d['replace'](_0x304cdd,'')+_0x304cdd;_0x365718(null,_0x494644);}})});router[_0x1355('0x24')](_0x1355('0x3a'),offlineUploadMulter[_0x1355('0x3b')](),controller[_0x1355('0x3c')]);router[_0x1355('0x24')](_0x1355('0x3d'),auth[_0x1355('0xb')](),controller[_0x1355('0x3e')]);router['post']('/:id/applications',auth[_0x1355('0xb')](),controller['addApplications']);router[_0x1355('0x24')](_0x1355('0x3f'),auth['isAuthenticated'](),controller[_0x1355('0x40')]);router['post'](_0x1355('0x22'),auth['isAuthenticated'](),controller[_0x1355('0x41')]);router['put'](_0x1355('0xf'),auth[_0x1355('0xb')](),controller[_0x1355('0x42')]);router['delete']('/:id',auth[_0x1355('0xb')](),controller['destroy']);router[_0x1355('0x43')](_0x1355('0x11'),auth[_0x1355('0xb')](),controller[_0x1355('0x44')]);router[_0x1355('0x43')](_0x1355('0x12'),auth[_0x1355('0xb')](),controller['removeAnswers']);router[_0x1355('0x43')]('/:id/users',auth[_0x1355('0xb')](),controller[_0x1355('0x45')]);module[_0x1355('0x46')]=router; \ No newline at end of file +var _0x34f1=['file','server/files/images/avatars/','%s-%s','originalname','single','addAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x34f1,0xf0));var _0x134f=function(_0x1e5aaf,_0x3b89e2){_0x1e5aaf=_0x1e5aaf-0x0;var _0x42798a=_0x34f1[_0x1e5aaf];return _0x42798a;};'use strict';var multer=require(_0x134f('0x0'));var util=require(_0x134f('0x1'));var path=require('path');var timeout=require(_0x134f('0x2'));var express=require('express');var router=express[_0x134f('0x3')]();var fs_extra=require(_0x134f('0x4'));var auth=require(_0x134f('0x5'));var interaction=require(_0x134f('0x6'));var config=require(_0x134f('0x7'));var controller=require('./chatWebsite.controller');router[_0x134f('0x8')]('/',auth['isAuthenticated'](),controller[_0x134f('0x9')]);router[_0x134f('0x8')](_0x134f('0xa'),auth['isAuthenticated'](),controller[_0x134f('0xb')]);router[_0x134f('0x8')](_0x134f('0xc'),auth['isAuthenticated'](),controller[_0x134f('0xd')]);router[_0x134f('0x8')](_0x134f('0xe'),auth[_0x134f('0xf')](),controller[_0x134f('0x10')]);router[_0x134f('0x8')]('/:id/canned_answers',auth[_0x134f('0xf')](),controller[_0x134f('0x11')]);router[_0x134f('0x8')](_0x134f('0x12'),controller[_0x134f('0x13')]);router[_0x134f('0x8')](_0x134f('0x14'),controller[_0x134f('0x15')]);router[_0x134f('0x8')](_0x134f('0x16'),controller[_0x134f('0x17')]);router['get'](_0x134f('0x18'),controller[_0x134f('0x19')]);router['get'](_0x134f('0x1a'),auth[_0x134f('0xf')](),controller['getInteractions']);router[_0x134f('0x8')]('/:id/snippet',controller[_0x134f('0x1b')]);router[_0x134f('0x8')](_0x134f('0x1c'),auth['isAuthenticated'](),controller['getApplications']);router[_0x134f('0x8')](_0x134f('0x1d'),auth['isAuthenticated'](),controller[_0x134f('0x1e')]);router[_0x134f('0x8')](_0x134f('0x1f'),controller[_0x134f('0x20')]);router[_0x134f('0x8')](_0x134f('0x21'),auth['isAuthenticated'](),controller[_0x134f('0x22')]);router['get'](_0x134f('0x23'),auth['isAuthenticated'](),controller[_0x134f('0x24')]);router[_0x134f('0x25')]('/',auth[_0x134f('0xf')](),controller[_0x134f('0x26')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x134f('0x27')]);router['post'](_0x134f('0x28'),auth[_0x134f('0xf')](),controller[_0x134f('0x29')]);var upload=multer({'storage':multer[_0x134f('0x2a')]({'destination':function(_0x34b32f,_0x26075a,_0x21de28){_0x21de28(null,path[_0x134f('0x2b')](config[_0x134f('0x2c')],_0x134f('0x2d')));},'filename':function(_0x11481e,_0xc0a5ed,_0x4860bc){_0x4860bc(null,util[_0x134f('0x2e')]('%s-%s',Date[_0x134f('0x2f')](),_0xc0a5ed['originalname']));}})});router[_0x134f('0x25')](_0x134f('0x12'),upload['single'](_0x134f('0x30')),controller['addLogo']);var upload=multer({'storage':multer[_0x134f('0x2a')]({'destination':function(_0x49e033,_0x2f1112,_0xab7754){_0xab7754(null,path['join'](config['root'],_0x134f('0x31')));},'filename':function(_0x5a329f,_0x2c72d1,_0x579e87){_0x579e87(null,util['format'](_0x134f('0x32'),Date[_0x134f('0x2f')](),_0x2c72d1[_0x134f('0x33')]));}})});router['post'](_0x134f('0x14'),upload[_0x134f('0x34')](_0x134f('0x30')),controller[_0x134f('0x35')]);var upload=multer({'storage':multer[_0x134f('0x2a')]({'destination':function(_0x1c58d0,_0x58c9a8,_0xa31220){_0xa31220(null,path[_0x134f('0x2b')](config[_0x134f('0x2c')],_0x134f('0x31')));},'filename':function(_0x2d88f7,_0x220294,_0x3f77c0){_0x3f77c0(null,util[_0x134f('0x2e')](_0x134f('0x32'),Date['now'](),_0x220294[_0x134f('0x33')]));}})});router[_0x134f('0x25')]('/:id/customer_avatar',upload[_0x134f('0x34')](_0x134f('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x134f('0x2a')]({'destination':function(_0x488928,_0x5ada7b,_0x2e7a09){_0x2e7a09(null,path['join'](config[_0x134f('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x5a499c,_0x276b4f,_0x4cc73e){_0x4cc73e(null,util[_0x134f('0x2e')](_0x134f('0x32'),Date['now'](),_0x276b4f[_0x134f('0x33')]));}})});router[_0x134f('0x25')](_0x134f('0x18'),upload[_0x134f('0x34')](_0x134f('0x30')),controller[_0x134f('0x36')]);router[_0x134f('0x25')]('/:id/notify',controller[_0x134f('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x134f('0x2a')]({'destination':function(_0x56a2a3,_0xf68c25,_0x614aa9){const _0x28981a=path[_0x134f('0x2b')](config[_0x134f('0x2c')],'server/files',_0x134f('0x38'),_0x134f('0x39'));fs_extra[_0x134f('0x3a')](_0x28981a,function(){_0x614aa9(null,_0x28981a);});},'filename':function(_0x3f83ad,_0x1e74d9,_0x5a5c52){const _0x31c636=_0x1e74d9[_0x134f('0x33')][_0x134f('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1b3263=path['extname'](_0x31c636);const _0x4c3c5d=Date['now']()+'-'+_0x31c636[_0x134f('0x3b')](_0x1b3263,'')+_0x1b3263;_0x5a5c52(null,_0x4c3c5d);}})});router[_0x134f('0x25')](_0x134f('0x3c'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0x134f('0x1a'),auth[_0x134f('0xf')](),controller[_0x134f('0x3d')]);router[_0x134f('0x25')](_0x134f('0x1c'),auth[_0x134f('0xf')](),controller[_0x134f('0x3e')]);router[_0x134f('0x25')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x134f('0x3f')]);router['post'](_0x134f('0x23'),auth[_0x134f('0xf')](),controller[_0x134f('0x40')]);router['put'](_0x134f('0xc'),auth['isAuthenticated'](),controller[_0x134f('0x41')]);router[_0x134f('0x42')](_0x134f('0xc'),auth['isAuthenticated'](),controller[_0x134f('0x43')]);router[_0x134f('0x42')]('/:id/dispositions',auth[_0x134f('0xf')](),controller[_0x134f('0x44')]);router[_0x134f('0x42')](_0x134f('0x28'),auth[_0x134f('0xf')](),controller[_0x134f('0x45')]);router['delete'](_0x134f('0x23'),auth[_0x134f('0xf')](),controller[_0x134f('0x46')]);module[_0x134f('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d876520..f7c273f 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 _0x19a8=['../components/auth/service','../config/environment','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','express'];(function(_0x44f1cb,_0x4bc512){var _0x5444d7=function(_0xcabdcd){while(--_0xcabdcd){_0x44f1cb['push'](_0x44f1cb['shift']());}};_0x5444d7(++_0x4bc512);}(_0x19a8,0xef));var _0x819a=function(_0x2c4b3c,_0xd111dc){_0x2c4b3c=_0x2c4b3c-0x0;var _0x27f17e=_0x19a8[_0x2c4b3c];return _0x27f17e;};var beaverLogger=require('beaver-logger/server');var express=require(_0x819a('0x0'));var auth=require(_0x819a('0x1'));var config=require(_0x819a('0x2'));var router=express['Router']();var isProduction=config[_0x819a('0x3')]===_0x819a('0x4')||![];function clientSideLogs(_0xba7b9f,_0x3c7b5d,_0x2c0c7c){var _0x521ff7=_0xba7b9f[_0x819a('0x5')][_0x819a('0x6')](_0x819a('0x7'));if(!_0x521ff7){throw new Error(_0x819a('0x8'));}return beaverLogger[_0x819a('0x9')]({'uri':_0x819a('0xa'),'logger':_0x521ff7,'enableCors':!isProduction})(_0xba7b9f,_0x3c7b5d,_0x2c0c7c);}router['use'](auth[_0x819a('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xee35=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','get'];(function(_0x2a837b,_0x3b1674){var _0x4f4bef=function(_0x40467f){while(--_0x40467f){_0x2a837b['push'](_0x2a837b['shift']());}};_0x4f4bef(++_0x3b1674);}(_0xee35,0x9f));var _0x5ee3=function(_0xe7c5b7,_0x27691d){_0xe7c5b7=_0xe7c5b7-0x0;var _0x1a1b70=_0xee35[_0xe7c5b7];return _0x1a1b70;};var beaverLogger=require(_0x5ee3('0x0'));var express=require(_0x5ee3('0x1'));var auth=require(_0x5ee3('0x2'));var config=require(_0x5ee3('0x3'));var router=express[_0x5ee3('0x4')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x4e69c1,_0x26f20d,_0x5697bb){var _0x34ba74=_0x4e69c1['app'][_0x5ee3('0x5')]('client-side-logger');if(!_0x34ba74){throw new Error(_0x5ee3('0x6'));}return beaverLogger[_0x5ee3('0x7')]({'uri':'/client-logs','logger':_0x34ba74,'enableCors':!isProduction})(_0x4e69c1,_0x26f20d,_0x5697bb);}router[_0x5ee3('0x8')](auth[_0x5ee3('0x9')](),clientSideLogs);module[_0x5ee3('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9650fd9..3bcaacb 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 _0x5fec=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Outlook365'];(function(_0x3a951e,_0x35eade){var _0x142e63=function(_0x377c54){while(--_0x377c54){_0x3a951e['push'](_0x3a951e['shift']());}};_0x142e63(++_0x35eade);}(_0x5fec,0xe3));var _0xc5fe=function(_0xa4dbef,_0x49f940){_0xa4dbef=_0xa4dbef-0x0;var _0x1b52a8=_0x5fec[_0xa4dbef];return _0x1b52a8;};'use strict';var Sequelize=require(_0xc5fe('0x0'));module[_0xc5fe('0x1')]={'name':{'type':Sequelize[_0xc5fe('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc5fe('0x3')](_0xc5fe('0x4'),_0xc5fe('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc5fe('0x3')](_0xc5fe('0x6'),_0xc5fe('0x7'))},'data1':{'type':Sequelize[_0xc5fe('0x2')],'comment':_0xc5fe('0x8')},'data2':{'type':Sequelize[_0xc5fe('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xc5fe('0x2')],'comment':_0xc5fe('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0xc5fe('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xc5fe('0xb')},'data6':{'type':Sequelize[_0xc5fe('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xcf53=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x130d3f,_0x374895){var _0x3014b6=function(_0x12061b){while(--_0x12061b){_0x130d3f['push'](_0x130d3f['shift']());}};_0x3014b6(++_0x374895);}(_0xcf53,0x1b6));var _0x3cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf53[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3cf5('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cf5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3cf5('0x2')](_0x3cf5('0x3'),_0x3cf5('0x4'),_0x3cf5('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3cf5('0x2')](_0x3cf5('0x6'),_0x3cf5('0x7'))},'data1':{'type':Sequelize[_0x3cf5('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x3cf5('0x1')],'comment':_0x3cf5('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x3cf5('0x9')},'data4':{'type':Sequelize[_0x3cf5('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x3cf5('0xa')],'comment':_0x3cf5('0xb')},'data6':{'type':Sequelize[_0x3cf5('0xa')],'comment':_0x3cf5('0xc')},'data7':{'type':Sequelize[_0x3cf5('0xa')],'comment':_0x3cf5('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5d8c5aa..d842f0e 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 _0x580d=['catch','params','find','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','parse','from','base64','toString','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','lodash','../../components/parsers/qs','../../config/logger','./cloudProvider.oauth','redis','localhost','sendStatus','status','end','json','count','offset','set','update','then','destroy','error','stack','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3'];(function(_0x2256aa,_0x20de01){var _0x2661ab=function(_0x1728bd){while(--_0x1728bd){_0x2256aa['push'](_0x2256aa['shift']());}};_0x2661ab(++_0x20de01);}(_0x580d,0x197));var _0xd580=function(_0x26b563,_0x40f11c){_0x26b563=_0x26b563-0x0;var _0x50b343=_0x580d[_0x26b563];return _0x50b343;};'use strict';var _=require(_0xd580('0x0'));var Redis=require('ioredis');var qs=require(_0xd580('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xd580('0x2'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xd580('0x3'));config[_0xd580('0x4')]=_['defaults'](config[_0xd580('0x4')],{'host':_0xd580('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd580('0x4')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x43d815,_0x4365ac){_0x4365ac=_0x4365ac||0xcc;return function(_0x18ff39){if(_0x18ff39){return _0x43d815[_0xd580('0x6')](_0x4365ac);}return _0x43d815[_0xd580('0x7')](_0x4365ac)[_0xd580('0x8')]();};}function respondWithResult(_0x26a178,_0x466247){_0x466247=_0x466247||0xc8;return function(_0x19e8e8){if(_0x19e8e8){return _0x26a178['status'](_0x466247)[_0xd580('0x9')](_0x19e8e8);}};}function respondWithFilteredResult(_0x20ad0,_0x220c19){return function(_0x355d1b){if(_0x355d1b){var _0x35cd75=typeof _0x220c19['offset']==='undefined'&&typeof _0x220c19['limit']==='undefined';var _0x213e22=_0x355d1b[_0xd580('0xa')];var _0x102264=_0x35cd75?0x0:_0x220c19['offset'];var _0x315ab4=_0x35cd75?_0x355d1b[_0xd580('0xa')]:_0x220c19[_0xd580('0xb')]+_0x220c19['limit'];var _0x3effe8;if(_0x315ab4>=_0x213e22){_0x315ab4=_0x213e22;_0x3effe8=0xc8;}else{_0x3effe8=0xce;}_0x20ad0[_0xd580('0x7')](_0x3effe8);return _0x20ad0[_0xd580('0xc')]('Content-Range',_0x102264+'-'+_0x315ab4+'/'+_0x213e22)[_0xd580('0x9')](_0x355d1b);}return null;};}function saveUpdates(_0x2c22ab){return function(_0xd68318){if(_0xd68318){return _0xd68318[_0xd580('0xd')](_0x2c22ab)[_0xd580('0xe')](function(_0x4d6816){return _0x4d6816;});}return null;};}function removeEntity(_0x467248){return function(_0x3deca1){if(_0x3deca1){return _0x3deca1[_0xd580('0xf')]()[_0xd580('0xe')](function(){_0x467248[_0xd580('0x7')](0xcc)[_0xd580('0x8')]();});}};}function handleEntityNotFound(_0x2d2794){return function(_0x11acef){if(!_0x11acef){_0x2d2794[_0xd580('0x6')](0x194);}return _0x11acef;};}function handleError(_0x32b614,_0x2da68a){_0x2da68a=_0x2da68a||0x1f4;return function(_0xb9b556){logger[_0xd580('0x10')](_0xb9b556[_0xd580('0x11')]);if(_0xb9b556['name']){delete _0xb9b556[_0xd580('0x12')];}_0x32b614['status'](_0x2da68a)['send'](_0xb9b556);};}function maskClientSecret(_0x467364){return _[_0xd580('0x13')](_0x467364[_0xd580('0x14')](0x0,0x3),0x14,'*');}exports[_0xd580('0x15')]=function(_0x521813,_0x2d9284){var _0x1c0cd8={},_0x197124={},_0x3542f8={'count':0x0,'rows':[]};var _0x5f2830=_[_0xd580('0x16')](db[_0xd580('0x17')][_0xd580('0x18')],function(_0x583039){return{'name':_0x583039[_0xd580('0x19')],'type':_0x583039[_0xd580('0x1a')][_0xd580('0x1b')]};});_0x197124[_0xd580('0x1c')]=_[_0xd580('0x16')](_0x5f2830,_0xd580('0x12'));_0x197124[_0xd580('0x1d')]=_[_0xd580('0x1e')](_0x521813[_0xd580('0x1d')]);_0x197124[_0xd580('0x1f')]=_['intersection'](_0x197124[_0xd580('0x1c')],_0x197124[_0xd580('0x1d')]);_0x1c0cd8[_0xd580('0x20')]=_[_0xd580('0x21')](_0x197124[_0xd580('0x1c')],qs['fields'](_0x521813[_0xd580('0x1d')][_0xd580('0x22')]));_0x1c0cd8[_0xd580('0x20')]=_0x1c0cd8[_0xd580('0x20')][_0xd580('0x23')]?_0x1c0cd8[_0xd580('0x20')]:_0x197124[_0xd580('0x1c')];if(!_0x521813[_0xd580('0x1d')]['hasOwnProperty'](_0xd580('0x24'))){_0x1c0cd8['limit']=qs['limit'](_0x521813[_0xd580('0x1d')][_0xd580('0x25')]);_0x1c0cd8['offset']=qs[_0xd580('0xb')](_0x521813['query']['offset']);}_0x1c0cd8[_0xd580('0x26')]=qs[_0xd580('0x27')](_0x521813['query'][_0xd580('0x27')]);_0x1c0cd8[_0xd580('0x28')]=qs[_0xd580('0x1f')](_[_0xd580('0x29')](_0x521813[_0xd580('0x1d')],_0x197124[_0xd580('0x1f')]),_0x5f2830);if(_0x521813[_0xd580('0x1d')][_0xd580('0x2a')]){_0x1c0cd8['where']=_[_0xd580('0x2b')](_0x1c0cd8[_0xd580('0x28')],{'$or':_[_0xd580('0x16')](_0x5f2830,function(_0x172f4b){if(_0x172f4b[_0xd580('0x1a')]!==_0xd580('0x2c')){var _0x263630={};_0x263630[_0x172f4b[_0xd580('0x12')]]={'$like':'%'+_0x521813['query']['filter']+'%'};return _0x263630;}})});}_0x1c0cd8=_[_0xd580('0x2b')]({},_0x1c0cd8,_0x521813['options']);var _0x20de44={'where':_0x1c0cd8[_0xd580('0x28')]};return db['CloudProvider'][_0xd580('0xa')](_0x20de44)[_0xd580('0xe')](function(_0x32a2aa){_0x3542f8[_0xd580('0xa')]=_0x32a2aa;if(_0x521813[_0xd580('0x1d')][_0xd580('0x2d')]){_0x1c0cd8[_0xd580('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0xd580('0x2f')](_0x1c0cd8);})['then'](function(_0x26ba43){_0x3542f8[_0xd580('0x30')]=_[_0xd580('0x16')](_0x26ba43,function(_0x5f1f6d){if(_0x5f1f6d[_0xd580('0x31')]===_0xd580('0x32')){var _0x58bdf2=encryptor[_0xd580('0x33')](_0x5f1f6d[_0xd580('0x34')]);_0x5f1f6d[_0xd580('0x34')]=maskClientSecret(_0x58bdf2);}return _0x5f1f6d;});return _0x3542f8;})['then'](respondWithFilteredResult(_0x2d9284,_0x1c0cd8))[_0xd580('0x35')](handleError(_0x2d9284,null));};exports['show']=function(_0x27db40,_0x485d0d){var _0x4053ac={'raw':!![],'where':{'id':_0x27db40[_0xd580('0x36')]['id']}},_0xfa1d82={};_0xfa1d82[_0xd580('0x1c')]=_[_0xd580('0x1e')](db['CloudProvider'][_0xd580('0x18')]);_0xfa1d82[_0xd580('0x1d')]=_[_0xd580('0x1e')](_0x27db40[_0xd580('0x1d')]);_0xfa1d82[_0xd580('0x1f')]=_[_0xd580('0x21')](_0xfa1d82[_0xd580('0x1c')],_0xfa1d82['query']);_0x4053ac['attributes']=_['intersection'](_0xfa1d82[_0xd580('0x1c')],qs['fields'](_0x27db40['query'][_0xd580('0x22')]));_0x4053ac[_0xd580('0x20')]=_0x4053ac[_0xd580('0x20')]['length']?_0x4053ac[_0xd580('0x20')]:_0xfa1d82[_0xd580('0x1c')];if(_0x27db40['query'][_0xd580('0x2d')]){_0x4053ac['include']=[{'all':!![]}];}_0x4053ac=_[_0xd580('0x2b')]({},_0x4053ac,_0x27db40['options']);return db[_0xd580('0x17')][_0xd580('0x37')](_0x4053ac)[_0xd580('0xe')](handleEntityNotFound(_0x485d0d,null))[_0xd580('0xe')](function(_0x3cdcfe){if(_0x3cdcfe[_0xd580('0x31')]==='MicrosoftAzure'){var _0x2ee69b=encryptor[_0xd580('0x33')](_0x3cdcfe[_0xd580('0x34')]);_0x3cdcfe[_0xd580('0x34')]=maskClientSecret(_0x2ee69b);}return _0x3cdcfe;})[_0xd580('0xe')](respondWithResult(_0x485d0d,null))['catch'](handleError(_0x485d0d,null));};exports[_0xd580('0x38')]=function(_0x58d0d5,_0x5e06a8){if(!_0x58d0d5[_0xd580('0x39')][_0xd580('0x12')])throw new Error(_0xd580('0x3a'));if(!_0x58d0d5[_0xd580('0x39')][_0xd580('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x3a554c=db[_0xd580('0x17')][_0xd580('0x18')][_0xd580('0x31')][_0xd580('0x3b')];if(!_0x3a554c[_0xd580('0x3c')](_0x58d0d5['body'][_0xd580('0x31')]))throw new Error(_0xd580('0x3d')+_0x3a554c[_0xd580('0x3e')](',\x20'));if(_0x58d0d5['body']['service']==='MicrosoftAzure'&&_0x58d0d5['body'][_0xd580('0x34')]){_0x58d0d5[_0xd580('0x39')][_0xd580('0x34')]=encryptor[_0xd580('0x3f')](_0x58d0d5[_0xd580('0x39')][_0xd580('0x34')]);}return db[_0xd580('0x17')][_0xd580('0x38')](_0x58d0d5['body'],{})['then'](respondWithResult(_0x5e06a8,0xc9))['catch'](handleError(_0x5e06a8,null));};exports[_0xd580('0xd')]=function(_0x831af2,_0x5c298f){if(_0x831af2[_0xd580('0x39')]['id']){delete _0x831af2[_0xd580('0x39')]['id'];}return db[_0xd580('0x17')][_0xd580('0x37')]({'where':{'id':_0x831af2['params']['id']}})[_0xd580('0xe')](handleEntityNotFound(_0x5c298f,null))[_0xd580('0xe')](function(_0x4cd5c5){if(_0x4cd5c5[_0xd580('0x31')]===_0xd580('0x32')&&_0x831af2[_0xd580('0x39')]['data3']){_0x831af2['body']['data3']=encryptor[_0xd580('0x3f')](_0x831af2[_0xd580('0x39')][_0xd580('0x34')]);}return _0x4cd5c5;})[_0xd580('0xe')](saveUpdates(_0x831af2[_0xd580('0x39')],null))[_0xd580('0xe')](respondWithResult(_0x5c298f,null))[_0xd580('0x35')](handleError(_0x5c298f,null));};exports[_0xd580('0xf')]=function(_0x2d1761,_0x66e5b8){return db[_0xd580('0x17')][_0xd580('0x37')]({'where':{'id':_0x2d1761[_0xd580('0x36')]['id']}})[_0xd580('0xe')](handleEntityNotFound(_0x66e5b8,null))[_0xd580('0xe')](removeEntity(_0x66e5b8,null))[_0xd580('0x35')](handleError(_0x66e5b8,null));};exports[_0xd580('0x40')]=function(_0x508b70,_0x20cfb8){return db[_0xd580('0x17')][_0xd580('0x41')]({'where':{'id':_0x508b70['params']['id']},'raw':!![]})[_0xd580('0xe')](function(_0x55639e){if(!_0x55639e)return _0x20cfb8[_0xd580('0x6')](0x194);return{'url':oauth[_0xd580('0x42')](_0x55639e,_0x508b70[_0xd580('0x43')]['id'])};})[_0xd580('0xe')](respondWithResult(_0x20cfb8,null))[_0xd580('0x35')](handleError(_0x20cfb8,null));};exports[_0xd580('0x44')]=function(_0x9c6c59,_0x5a125d){var _0x33de47=_0x9c6c59[_0xd580('0x39')];var _0x31c2c9;var _0x14a4f1;if(_0x33de47[_0xd580('0x10')])throw _0x33de47;redis[_0xd580('0x45')](_0x33de47[_0xd580('0x46')])[_0xd580('0xe')](function(_0x5bae93){if(!_0x5bae93)throw new Error('Invalid\x20state\x20parameter');_0x31c2c9=JSON[_0xd580('0x47')](_0x5bae93);var _0x41f1ef=Buffer[_0xd580('0x48')](_0x33de47[_0xd580('0x46')],_0xd580('0x49'))[_0xd580('0x4a')](_0xd580('0x4b'));_0x14a4f1=JSON[_0xd580('0x47')](_0x41f1ef);if(!oauth[_0xd580('0x4c')](_0x33de47[_0xd580('0x4d')],_0x31c2c9['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xd580('0x4e')](_0x33de47[_0xd580('0x46')]);return oauth[_0xd580('0x4f')](_0x33de47[_0xd580('0x50')],_0x31c2c9);})[_0xd580('0xe')](function(_0x39940b){_0x31c2c9[_0xd580('0x51')]=_0x39940b[_0xd580('0x52')];_0x31c2c9[_0xd580('0x53')]=_0x39940b['refresh_token'];return db['CloudProvider'][_0xd580('0xd')]({'data5':_0x31c2c9['data5'],'data6':_0x31c2c9[_0xd580('0x53')]},{'where':{'id':_0x31c2c9['id']}});})[_0xd580('0xe')](function(){oauth[_0xd580('0x54')](_0x31c2c9);socket[_0xd580('0x55')](_0xd580('0x56'),{'id':_0x14a4f1['id']});return;})['then'](respondWithStatusCode(_0x5a125d,null))[_0xd580('0x35')](function(_0x224385){if(_0x14a4f1){socket[_0xd580('0x55')](_0xd580('0x57'),{'id':_0x14a4f1['id']});}if(!_0x31c2c9){logger[_0xd580('0x10')](_0xd580('0x58'),_0x224385);return _0x5a125d[_0xd580('0x7')](0x1f4)[_0xd580('0x59')](_0x224385[_0xd580('0x5a')]);}logger[_0xd580('0x10')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x31c2c9['id'],JSON[_0xd580('0x5b')](_0x224385));});}; \ No newline at end of file +var _0x2929=['then','end','error','stack','name','send','padEnd','slice','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','create','encryptString','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','data6','refresh_token','data5','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','status','json','offset','undefined','count','Content-Range','update'];(function(_0x1ffbf5,_0x425ab5){var _0x343a38=function(_0x53be9b){while(--_0x53be9b){_0x1ffbf5['push'](_0x1ffbf5['shift']());}};_0x343a38(++_0x425ab5);}(_0x2929,0x102));var _0x9292=function(_0x705278,_0x33d8c6){_0x705278=_0x705278-0x0;var _0x15a383=_0x2929[_0x705278];return _0x15a383;};'use strict';var _=require(_0x9292('0x0'));var Redis=require(_0x9292('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x9292('0x2'));var config=require(_0x9292('0x3'));var logger=require('../../config/logger')(_0x9292('0x4'));var db=require(_0x9292('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x9292('0x6')](config['redis'],{'host':_0x9292('0x7'),'port':0x18eb});var socket=require(_0x9292('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x9292('0x9')]);function respondWithStatusCode(_0x2c6e86,_0xa7f1f9){_0xa7f1f9=_0xa7f1f9||0xcc;return function(_0x40012d){if(_0x40012d){return _0x2c6e86[_0x9292('0xa')](_0xa7f1f9);}return _0x2c6e86[_0x9292('0xb')](_0xa7f1f9)['end']();};}function respondWithResult(_0x1e800d,_0x47e6c2){_0x47e6c2=_0x47e6c2||0xc8;return function(_0x560c5a){if(_0x560c5a){return _0x1e800d[_0x9292('0xb')](_0x47e6c2)[_0x9292('0xc')](_0x560c5a);}};}function respondWithFilteredResult(_0x59fac0,_0x325550){return function(_0x4f173d){if(_0x4f173d){var _0x3ea2f0=typeof _0x325550[_0x9292('0xd')]===_0x9292('0xe')&&typeof _0x325550['limit']==='undefined';var _0x249fbf=_0x4f173d[_0x9292('0xf')];var _0x98f0bb=_0x3ea2f0?0x0:_0x325550['offset'];var _0x30b9d7=_0x3ea2f0?_0x4f173d[_0x9292('0xf')]:_0x325550['offset']+_0x325550['limit'];var _0x2f8fd9;if(_0x30b9d7>=_0x249fbf){_0x30b9d7=_0x249fbf;_0x2f8fd9=0xc8;}else{_0x2f8fd9=0xce;}_0x59fac0['status'](_0x2f8fd9);return _0x59fac0['set'](_0x9292('0x10'),_0x98f0bb+'-'+_0x30b9d7+'/'+_0x249fbf)[_0x9292('0xc')](_0x4f173d);}return null;};}function saveUpdates(_0x5b6fed){return function(_0x5c6d66){if(_0x5c6d66){return _0x5c6d66[_0x9292('0x11')](_0x5b6fed)[_0x9292('0x12')](function(_0x4b22bc){return _0x4b22bc;});}return null;};}function removeEntity(_0x2d4a91){return function(_0x1e9616){if(_0x1e9616){return _0x1e9616['destroy']()[_0x9292('0x12')](function(){_0x2d4a91[_0x9292('0xb')](0xcc)[_0x9292('0x13')]();});}};}function handleEntityNotFound(_0x46b6f3){return function(_0x3a6826){if(!_0x3a6826){_0x46b6f3['sendStatus'](0x194);}return _0x3a6826;};}function handleError(_0x218612,_0x338e2a){_0x338e2a=_0x338e2a||0x1f4;return function(_0x2dbcce){logger[_0x9292('0x14')](_0x2dbcce[_0x9292('0x15')]);if(_0x2dbcce[_0x9292('0x16')]){delete _0x2dbcce[_0x9292('0x16')];}_0x218612[_0x9292('0xb')](_0x338e2a)[_0x9292('0x17')](_0x2dbcce);};}function maskClientSecret(_0x31f8cc){return _[_0x9292('0x18')](_0x31f8cc[_0x9292('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x585539,_0x1c5e0b){var _0x3391d3={},_0x629b25={},_0x43b149={'count':0x0,'rows':[]};var _0x4a6115=_[_0x9292('0x1a')](db['CloudProvider'][_0x9292('0x1b')],function(_0x4ed10f){return{'name':_0x4ed10f[_0x9292('0x1c')],'type':_0x4ed10f[_0x9292('0x1d')][_0x9292('0x1e')]};});_0x629b25[_0x9292('0x1f')]=_['map'](_0x4a6115,_0x9292('0x16'));_0x629b25[_0x9292('0x20')]=_[_0x9292('0x21')](_0x585539[_0x9292('0x20')]);_0x629b25[_0x9292('0x22')]=_[_0x9292('0x23')](_0x629b25[_0x9292('0x1f')],_0x629b25[_0x9292('0x20')]);_0x3391d3['attributes']=_[_0x9292('0x23')](_0x629b25[_0x9292('0x1f')],qs[_0x9292('0x24')](_0x585539['query'][_0x9292('0x24')]));_0x3391d3[_0x9292('0x25')]=_0x3391d3['attributes'][_0x9292('0x26')]?_0x3391d3[_0x9292('0x25')]:_0x629b25['model'];if(!_0x585539[_0x9292('0x20')]['hasOwnProperty'](_0x9292('0x27'))){_0x3391d3[_0x9292('0x28')]=qs[_0x9292('0x28')](_0x585539[_0x9292('0x20')][_0x9292('0x28')]);_0x3391d3[_0x9292('0xd')]=qs[_0x9292('0xd')](_0x585539['query'][_0x9292('0xd')]);}_0x3391d3[_0x9292('0x29')]=qs[_0x9292('0x2a')](_0x585539[_0x9292('0x20')][_0x9292('0x2a')]);_0x3391d3[_0x9292('0x2b')]=qs[_0x9292('0x22')](_[_0x9292('0x2c')](_0x585539[_0x9292('0x20')],_0x629b25[_0x9292('0x22')]),_0x4a6115);if(_0x585539[_0x9292('0x20')][_0x9292('0x2d')]){_0x3391d3['where']=_[_0x9292('0x2e')](_0x3391d3[_0x9292('0x2b')],{'$or':_[_0x9292('0x1a')](_0x4a6115,function(_0x2d8e35){if(_0x2d8e35[_0x9292('0x1d')]!==_0x9292('0x2f')){var _0x99e2c7={};_0x99e2c7[_0x2d8e35[_0x9292('0x16')]]={'$like':'%'+_0x585539[_0x9292('0x20')]['filter']+'%'};return _0x99e2c7;}})});}_0x3391d3=_[_0x9292('0x2e')]({},_0x3391d3,_0x585539[_0x9292('0x30')]);var _0x1b7981={'where':_0x3391d3[_0x9292('0x2b')]};return db[_0x9292('0x31')]['count'](_0x1b7981)[_0x9292('0x12')](function(_0x531055){_0x43b149[_0x9292('0xf')]=_0x531055;if(_0x585539[_0x9292('0x20')][_0x9292('0x32')]){_0x3391d3[_0x9292('0x33')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x3391d3);})[_0x9292('0x12')](function(_0x3e6764){_0x43b149['rows']=_[_0x9292('0x1a')](_0x3e6764,function(_0x263437){if(_0x263437[_0x9292('0x34')]===_0x9292('0x35')){var _0x2cd29b=encryptor[_0x9292('0x36')](_0x263437[_0x9292('0x37')]);_0x263437['data3']=maskClientSecret(_0x2cd29b);}return _0x263437;});return _0x43b149;})[_0x9292('0x12')](respondWithFilteredResult(_0x1c5e0b,_0x3391d3))[_0x9292('0x38')](handleError(_0x1c5e0b,null));};exports[_0x9292('0x39')]=function(_0x3ff65f,_0x1d3f40){var _0x35c80e={'raw':!![],'where':{'id':_0x3ff65f[_0x9292('0x3a')]['id']}},_0x143033={};_0x143033[_0x9292('0x1f')]=_[_0x9292('0x21')](db[_0x9292('0x31')][_0x9292('0x1b')]);_0x143033[_0x9292('0x20')]=_[_0x9292('0x21')](_0x3ff65f[_0x9292('0x20')]);_0x143033[_0x9292('0x22')]=_['intersection'](_0x143033[_0x9292('0x1f')],_0x143033[_0x9292('0x20')]);_0x35c80e[_0x9292('0x25')]=_[_0x9292('0x23')](_0x143033[_0x9292('0x1f')],qs[_0x9292('0x24')](_0x3ff65f[_0x9292('0x20')][_0x9292('0x24')]));_0x35c80e[_0x9292('0x25')]=_0x35c80e[_0x9292('0x25')]['length']?_0x35c80e[_0x9292('0x25')]:_0x143033[_0x9292('0x1f')];if(_0x3ff65f['query'][_0x9292('0x32')]){_0x35c80e['include']=[{'all':!![]}];}_0x35c80e=_[_0x9292('0x2e')]({},_0x35c80e,_0x3ff65f[_0x9292('0x30')]);return db[_0x9292('0x31')][_0x9292('0x3b')](_0x35c80e)[_0x9292('0x12')](handleEntityNotFound(_0x1d3f40,null))[_0x9292('0x12')](function(_0xf84605){if(_0xf84605[_0x9292('0x34')]===_0x9292('0x35')){var _0x396438=encryptor[_0x9292('0x36')](_0xf84605[_0x9292('0x37')]);_0xf84605[_0x9292('0x37')]=maskClientSecret(_0x396438);}return _0xf84605;})[_0x9292('0x12')](respondWithResult(_0x1d3f40,null))[_0x9292('0x38')](handleError(_0x1d3f40,null));};exports['create']=function(_0x2d87a2,_0x40a8a2){if(!_0x2d87a2[_0x9292('0x3c')]['name'])throw new Error(_0x9292('0x3d'));if(!_0x2d87a2[_0x9292('0x3c')]['service'])throw new Error(_0x9292('0x3e'));var _0x3a6d54=db[_0x9292('0x31')][_0x9292('0x1b')][_0x9292('0x34')][_0x9292('0x3f')];if(!_0x3a6d54[_0x9292('0x40')](_0x2d87a2[_0x9292('0x3c')][_0x9292('0x34')]))throw new Error(_0x9292('0x41')+_0x3a6d54[_0x9292('0x42')](',\x20'));if(_0x2d87a2[_0x9292('0x3c')][_0x9292('0x34')]===_0x9292('0x35')&&_0x2d87a2[_0x9292('0x3c')]['data3']){_0x2d87a2[_0x9292('0x3c')][_0x9292('0x37')]=encryptor['encryptString'](_0x2d87a2[_0x9292('0x3c')]['data3']);}return db['CloudProvider'][_0x9292('0x43')](_0x2d87a2[_0x9292('0x3c')],{})['then'](respondWithResult(_0x40a8a2,0xc9))[_0x9292('0x38')](handleError(_0x40a8a2,null));};exports[_0x9292('0x11')]=function(_0x2cc3af,_0x1044df){if(_0x2cc3af['body']['id']){delete _0x2cc3af['body']['id'];}return db[_0x9292('0x31')]['find']({'where':{'id':_0x2cc3af[_0x9292('0x3a')]['id']}})[_0x9292('0x12')](handleEntityNotFound(_0x1044df,null))[_0x9292('0x12')](function(_0x1dd6d3){if(_0x1dd6d3[_0x9292('0x34')]===_0x9292('0x35')&&_0x2cc3af[_0x9292('0x3c')][_0x9292('0x37')]){_0x2cc3af[_0x9292('0x3c')][_0x9292('0x37')]=encryptor[_0x9292('0x44')](_0x2cc3af[_0x9292('0x3c')][_0x9292('0x37')]);}return _0x1dd6d3;})[_0x9292('0x12')](saveUpdates(_0x2cc3af[_0x9292('0x3c')],null))['then'](respondWithResult(_0x1044df,null))[_0x9292('0x38')](handleError(_0x1044df,null));};exports['destroy']=function(_0x5c1624,_0x37b1a8){return db['CloudProvider'][_0x9292('0x3b')]({'where':{'id':_0x5c1624[_0x9292('0x3a')]['id']}})[_0x9292('0x12')](handleEntityNotFound(_0x37b1a8,null))[_0x9292('0x12')](removeEntity(_0x37b1a8,null))['catch'](handleError(_0x37b1a8,null));};exports[_0x9292('0x45')]=function(_0x20f715,_0x4e1ea0){return db[_0x9292('0x31')][_0x9292('0x46')]({'where':{'id':_0x20f715[_0x9292('0x3a')]['id']},'raw':!![]})[_0x9292('0x12')](function(_0xf050a){if(!_0xf050a)return _0x4e1ea0[_0x9292('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xf050a,_0x20f715['user']['id'])};})[_0x9292('0x12')](respondWithResult(_0x4e1ea0,null))['catch'](handleError(_0x4e1ea0,null));};exports[_0x9292('0x47')]=function(_0x497d8a,_0x582add){var _0x51cd6e=_0x497d8a['body'];var _0x3cdfa0;var _0x54e7e4;if(_0x51cd6e['error'])throw _0x51cd6e;redis[_0x9292('0x48')](_0x51cd6e[_0x9292('0x49')])[_0x9292('0x12')](function(_0x44d7c6){if(!_0x44d7c6)throw new Error('Invalid\x20state\x20parameter');_0x3cdfa0=JSON[_0x9292('0x4a')](_0x44d7c6);var _0x16f7ce=Buffer['from'](_0x51cd6e[_0x9292('0x49')],_0x9292('0x4b'))[_0x9292('0x4c')](_0x9292('0x4d'));_0x54e7e4=JSON[_0x9292('0x4a')](_0x16f7ce);if(!oauth[_0x9292('0x4e')](_0x51cd6e[_0x9292('0x4f')],_0x3cdfa0['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x9292('0x50')](_0x51cd6e[_0x9292('0x49')]);return oauth[_0x9292('0x51')](_0x51cd6e['code'],_0x3cdfa0);})['then'](function(_0x5eaa9e){_0x3cdfa0['data5']=_0x5eaa9e['access_token'];_0x3cdfa0[_0x9292('0x52')]=_0x5eaa9e[_0x9292('0x53')];return db[_0x9292('0x31')][_0x9292('0x11')]({'data5':_0x3cdfa0[_0x9292('0x54')],'data6':_0x3cdfa0[_0x9292('0x52')]},{'where':{'id':_0x3cdfa0['id']}});})[_0x9292('0x12')](function(){oauth[_0x9292('0x55')](_0x3cdfa0);socket['emit'](_0x9292('0x56'),{'id':_0x54e7e4['id']});return;})['then'](respondWithStatusCode(_0x582add,null))[_0x9292('0x38')](function(_0x3a49c7){if(_0x54e7e4){socket['emit'](_0x9292('0x57'),{'id':_0x54e7e4['id']});}if(!_0x3cdfa0){logger[_0x9292('0x14')](_0x9292('0x58'),_0x3a49c7);return _0x582add[_0x9292('0xb')](0x1f4)['send'](_0x3a49c7[_0x9292('0x59')]);}logger[_0x9292('0x14')](_0x9292('0x5a'),_0x3cdfa0['id'],JSON[_0x9292('0x5b')](_0x3a49c7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 771d06a..bdda60d 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 _0x0e35=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CloudProvider','cloud_providers','lodash'];(function(_0x118597,_0x15fcd){var _0x567c3f=function(_0x155e2e){while(--_0x155e2e){_0x118597['push'](_0x118597['shift']());}};_0x567c3f(++_0x15fcd);}(_0x0e35,0xc2));var _0x50e3=function(_0x46a5a2,_0x258cd2){_0x46a5a2=_0x46a5a2-0x0;var _0x3a034a=_0x0e35[_0x46a5a2];return _0x3a034a;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var logger=require(_0x50e3('0x2'))(_0x50e3('0x3'));var moment=require(_0x50e3('0x4'));var BPromise=require(_0x50e3('0x5'));var rp=require(_0x50e3('0x6'));var fs=require('fs');var path=require(_0x50e3('0x7'));var rimraf=require(_0x50e3('0x8'));var config=require(_0x50e3('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x50e3('0xa')]=function(_0x35e2b1,_0x47c955){return _0x35e2b1['define'](_0x50e3('0xb'),attributes,{'tableName':_0x50e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeeb=['CloudProvider','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x59b046,_0x147d81){var _0x1b2c74=function(_0x4d776e){while(--_0x4d776e){_0x59b046['push'](_0x59b046['shift']());}};_0x1b2c74(++_0x147d81);}(_0xbeeb,0xda));var _0xbbee=function(_0x13d1c4,_0x5c0d64){_0x13d1c4=_0x13d1c4-0x0;var _0x4cb77b=_0xbeeb[_0x13d1c4];return _0x4cb77b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbbee('0x0'));var rp=require(_0xbbee('0x1'));var fs=require('fs');var path=require(_0xbbee('0x2'));var rimraf=require(_0xbbee('0x3'));var config=require(_0xbbee('0x4'));var attributes=require('./cloudProvider.attributes');module[_0xbbee('0x5')]=function(_0x38cef8,_0x2bb086){return _0x38cef8['define'](_0xbbee('0x6'),attributes,{'tableName':'cloud_providers','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 e74de86..bab660f 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 _0x319f=['{TENANT_ID}','data2','from','stringify','toString','randomBytes','client_id','data1','response_type','redirect_uri','data4','form_post','state','nonce','prompt','key','value','oauth2Claims','replace','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365'];(function(_0x24af44,_0xc7cec8){var _0x5f4f05=function(_0x2ade5a){while(--_0x2ade5a){_0x24af44['push'](_0x24af44['shift']());}};_0x5f4f05(++_0xc7cec8);}(_0x319f,0x82));var _0xf319=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x319f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf319('0x0'));var crypto=require(_0xf319('0x1'));var jwt=require(_0xf319('0x2'));var moment=require(_0xf319('0x3'));var Redis=require(_0xf319('0x4'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0xf319('0x5'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xf319('0x6'));var schedule=require(_0xf319('0x7'));var db=require(_0xf319('0x8'))['db'];config[_0xf319('0x9')]=_[_0xf319('0xa')](config[_0xf319('0x9')],{'host':_0xf319('0xb'),'port':0x18eb});var redis=new Redis(config[_0xf319('0x9')]);var MICROSOFT_AUTH_URL=_0xf319('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf319('0xd'),_0xf319('0xe'),'email','offline_access',_0xf319('0xf'),_0xf319('0x10'),_0xf319('0x11')],'Dynamics365':[_0xf319('0xd'),_0xf319('0x12')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xf319('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x38e062){var _0x23cdb5=_[_0xf319('0x14')](AZURE_AUTH_SCOPES[_0x38e062[_0xf319('0x15')]]);if(_0x38e062[_0xf319('0x15')]===_0xf319('0x16'))_0x23cdb5[_0xf319('0x17')](_0x38e062[_0xf319('0x18')]+_0xf319('0x19'));return _0x23cdb5[_0xf319('0x1a')]('\x20');}function getAccessTokenScope(_0xe75612){if(_0xe75612['type']===_0xf319('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xe75612['type']===_0xf319('0x16'))return _0xe75612[_0xf319('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x16c761,_0x575955){var _0x490dae=MICROSOFT_AUTH_URL['replace'](_0xf319('0x1c'),_0x16c761[_0xf319('0x1d')]);var _0x2a708c=['code','id_token'];var _0x2ecb08=Buffer[_0xf319('0x1e')](JSON[_0xf319('0x1f')]({'id':_0x575955}))[_0xf319('0x20')]('base64');var _0x512b19=crypto[_0xf319('0x21')](0x10)[_0xf319('0x20')]('hex');var _0x53883d=getAuthorizationScopes(_0x16c761);var _0x3630f0=[{'key':_0xf319('0x22'),'value':_0x16c761[_0xf319('0x23')]},{'key':_0xf319('0x24'),'value':encodeURIComponent(_0x2a708c[_0xf319('0x1a')]('\x20'))},{'key':_0xf319('0x25'),'value':_0x16c761[_0xf319('0x26')]},{'key':'response_mode','value':_0xf319('0x27')},{'key':'scope','value':encodeURIComponent(_0x53883d)},{'key':_0xf319('0x28'),'value':_0x2ecb08},{'key':_0xf319('0x29'),'value':_0x512b19},{'key':_0xf319('0x2a'),'value':'login'}];var _0x4d22e7=_0x490dae+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x3630f0,function(_0x3edfac){return _0x3edfac[_0xf319('0x2b')]+'='+_0x3edfac[_0xf319('0x2c')];})[_0xf319('0x1a')]('&');_0x16c761[_0xf319('0x2d')]={'issuer':_0x490dae[_0xf319('0x2e')](_0xf319('0x2f'),''),'audience':_0x16c761[_0xf319('0x23')],'state':_0x2ecb08,'nonce':_0x512b19};redis['set'](_0x2ecb08,JSON[_0xf319('0x1f')](_0x16c761));return _0x4d22e7;}function isValidIdToken(_0x473321,_0xa83e81){try{var _0x4db517=jwt[_0xf319('0x30')](_0x473321,{'complete':!![]});var _0x347a35=_0x4db517[_0xf319('0x31')];if(_0x347a35[_0xf319('0x32')]!==_0xa83e81[_0xf319('0x33')])return![];if(_0x347a35[_0xf319('0x34')]!==_0xa83e81[_0xf319('0x35')])return![];if(_0x347a35[_0xf319('0x29')]!==_0xa83e81[_0xf319('0x29')])return![];if(moment()[_0xf319('0x36')](moment[_0xf319('0x37')](_0x347a35[_0xf319('0x38')])))return![];return!![];}catch(_0x37cab0){throw _0x37cab0;}}function refreshOauth2MicrosoftAccessToken(_0x354636){return Promise[_0xf319('0x39')]()['then'](function(){if(_0x354636[_0xf319('0x3a')])return _0x354636;return db[_0xf319('0x3b')][_0xf319('0x3c')]({'where':{'id':_0x354636['id']},'raw':!![]});})[_0xf319('0x3d')](function(_0x10ebc0){var _0x3753e5={'grant_type':_0xf319('0x3e'),'refresh_token':_0x10ebc0[_0xf319('0x3f')],'scope':getAccessTokenScope(_0x10ebc0),'redirect_uri':_0x10ebc0['data4'],'client_id':_0x10ebc0[_0xf319('0x23')],'client_secret':encryptor[_0xf319('0x40')](_0x10ebc0[_0xf319('0x3a')])};var _0x1a29c9={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xf319('0x1c'),_0x10ebc0[_0xf319('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3753e5,'json':!![]};return rp(_0x1a29c9);})[_0xf319('0x3d')](function(_0xec7776){_0x354636[_0xf319('0x41')]=_0xec7776[_0xf319('0x42')];_0x354636['data6']=_0xec7776[_0xf319('0x3e')];return db[_0xf319('0x3b')][_0xf319('0x43')]({'data5':_0x354636[_0xf319('0x41')],'data6':_0x354636[_0xf319('0x3f')]},{'where':{'id':_0x354636['id']}});})[_0xf319('0x3d')](function(){return _0x354636;})['catch'](function(_0x1deee7){logger[_0xf319('0x44')](_0xf319('0x45'),_0x354636['id'],_0x1deee7);});}function getOauth2MicrosoftAccessToken(_0x59b131,_0x372fe4){var _0x176463={'grant_type':_0xf319('0x46'),'code':_0x59b131,'scope':getAccessTokenScope(_0x372fe4),'redirect_uri':_0x372fe4['data4'],'client_id':_0x372fe4[_0xf319('0x23')],'client_secret':encryptor['decryptString'](_0x372fe4[_0xf319('0x3a')])};var _0xeabc73={'method':_0xf319('0x47'),'uri':MICROSOFT_AUTH_URL[_0xf319('0x2e')](_0xf319('0x1c'),_0x372fe4[_0xf319('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x176463,'json':!![]};return rp(_0xeabc73);}function startRefreshInterval(_0x2cd6d9){var _0x5beada=schedule[_0xf319('0x48')];if(_0x5beada[_0x2cd6d9['id']])clearInterval(_0x5beada[_0x2cd6d9['id']]);_0x5beada[_0x2cd6d9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf319('0x49')](this,{'id':_0x2cd6d9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf319('0x48')]=_0x5beada;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xf319('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf319('0x3d')](function(_0x158412){var _0x152bb3=_0x158412[_0xf319('0x14')](function(_0x414278){return refreshOauth2MicrosoftAccessToken(_0x414278)['then'](function(_0x2e5840){startRefreshInterval(_0x2e5840);});});return Promise[_0xf319('0x4b')](_0x152bb3);})['catch'](function(_0x25fb93){var _0x536dfb=_0x25fb93?util[_0xf319('0x4c')](_0x25fb93,{'showHidden':![],'depth':null}):'';logger[_0xf319('0x44')](_0xf319('0x4d'),_0x536dfb);});}module[_0xf319('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb5a8=['response_type','data4','form_post','scope','login','key','value','oauth2/','set','stringify','decode','issuer','audience','nonce','isAfter','exp','resolve','then','data3','CloudProvider','findOne','decryptString','POST','data5','access_token','data6','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/token','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','base64','toString','hex','data1'];(function(_0x1f8fa2,_0x574f3c){var _0x155de6=function(_0x3ddfc0){while(--_0x3ddfc0){_0x1f8fa2['push'](_0x1f8fa2['shift']());}};_0x155de6(++_0x574f3c);}(_0xb5a8,0xbd));var _0x8b5a=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb5a8[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x8b5a('0x0'));var crypto=require(_0x8b5a('0x1'));var jwt=require(_0x8b5a('0x2'));var moment=require(_0x8b5a('0x3'));var Redis=require(_0x8b5a('0x4'));var rp=require(_0x8b5a('0x5'));var util=require(_0x8b5a('0x6'));var encryptor=require(_0x8b5a('0x7'));var config=require(_0x8b5a('0x8'));var logger=require(_0x8b5a('0x9'))(_0x8b5a('0xa'));var schedule=require(_0x8b5a('0xb'));var db=require(_0x8b5a('0xc'))['db'];config[_0x8b5a('0xd')]=_[_0x8b5a('0xe')](config['redis'],{'host':_0x8b5a('0xf'),'port':0x18eb});var redis=new Redis(config[_0x8b5a('0xd')]);var MICROSOFT_AUTH_URL=_0x8b5a('0x10');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x8b5a('0x11'),_0x8b5a('0x12'),_0x8b5a('0x13'),_0x8b5a('0x14'),_0x8b5a('0x15'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x8b5a('0x16'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x8b5a('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3415ee){var _0x3ee4c6=_[_0x8b5a('0x18')](AZURE_AUTH_SCOPES[_0x3415ee[_0x8b5a('0x19')]]);if(_0x3415ee[_0x8b5a('0x19')]===_0x8b5a('0x1a'))_0x3ee4c6[_0x8b5a('0x1b')](_0x3415ee[_0x8b5a('0x1c')]+_0x8b5a('0x1d'));return _0x3ee4c6[_0x8b5a('0x1e')]('\x20');}function getAccessTokenScope(_0x5d86a1){if(_0x5d86a1['type']==='Outlook365')return _0x8b5a('0x14');if(_0x5d86a1[_0x8b5a('0x19')]===_0x8b5a('0x1a'))return _0x5d86a1[_0x8b5a('0x1c')]+_0x8b5a('0x1d');}function generateMicrosoftAuthorizationUrl(_0x198b09,_0x3f9246){var _0x27c22e=MICROSOFT_AUTH_URL[_0x8b5a('0x1f')](_0x8b5a('0x20'),_0x198b09[_0x8b5a('0x21')]);var _0x1bd4df=[_0x8b5a('0x22'),'id_token'];var _0x41fa86=Buffer['from'](JSON['stringify']({'id':_0x3f9246}))['toString'](_0x8b5a('0x23'));var _0x21f033=crypto['randomBytes'](0x10)[_0x8b5a('0x24')](_0x8b5a('0x25'));var _0x38004f=getAuthorizationScopes(_0x198b09);var _0x1838bb=[{'key':'client_id','value':_0x198b09[_0x8b5a('0x26')]},{'key':_0x8b5a('0x27'),'value':encodeURIComponent(_0x1bd4df[_0x8b5a('0x1e')]('\x20'))},{'key':'redirect_uri','value':_0x198b09[_0x8b5a('0x28')]},{'key':'response_mode','value':_0x8b5a('0x29')},{'key':_0x8b5a('0x2a'),'value':encodeURIComponent(_0x38004f)},{'key':'state','value':_0x41fa86},{'key':'nonce','value':_0x21f033},{'key':'prompt','value':_0x8b5a('0x2b')}];var _0xbd42d3=_0x27c22e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8b5a('0x18')](_0x1838bb,function(_0x11ba2d){return _0x11ba2d[_0x8b5a('0x2c')]+'='+_0x11ba2d[_0x8b5a('0x2d')];})[_0x8b5a('0x1e')]('&');_0x198b09['oauth2Claims']={'issuer':_0x27c22e[_0x8b5a('0x1f')](_0x8b5a('0x2e'),''),'audience':_0x198b09['data1'],'state':_0x41fa86,'nonce':_0x21f033};redis[_0x8b5a('0x2f')](_0x41fa86,JSON[_0x8b5a('0x30')](_0x198b09));return _0xbd42d3;}function isValidIdToken(_0xaf2845,_0x513c62){try{var _0x2949aa=jwt[_0x8b5a('0x31')](_0xaf2845,{'complete':!![]});var _0x51f9ec=_0x2949aa['payload'];if(_0x51f9ec['iss']!==_0x513c62[_0x8b5a('0x32')])return![];if(_0x51f9ec['aud']!==_0x513c62[_0x8b5a('0x33')])return![];if(_0x51f9ec[_0x8b5a('0x34')]!==_0x513c62[_0x8b5a('0x34')])return![];if(moment()[_0x8b5a('0x35')](moment['unix'](_0x51f9ec[_0x8b5a('0x36')])))return![];return!![];}catch(_0x21eb26){throw _0x21eb26;}}function refreshOauth2MicrosoftAccessToken(_0x72bb91){return Promise[_0x8b5a('0x37')]()[_0x8b5a('0x38')](function(){if(_0x72bb91[_0x8b5a('0x39')])return _0x72bb91;return db[_0x8b5a('0x3a')][_0x8b5a('0x3b')]({'where':{'id':_0x72bb91['id']},'raw':!![]});})[_0x8b5a('0x38')](function(_0x699501){var _0xef60ea={'grant_type':'refresh_token','refresh_token':_0x699501['data6'],'scope':getAccessTokenScope(_0x699501),'redirect_uri':_0x699501[_0x8b5a('0x28')],'client_id':_0x699501[_0x8b5a('0x26')],'client_secret':encryptor[_0x8b5a('0x3c')](_0x699501['data3'])};var _0x20da32={'method':_0x8b5a('0x3d'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8b5a('0x20'),_0x699501['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xef60ea,'json':!![]};return rp(_0x20da32);})['then'](function(_0x46a693){_0x72bb91[_0x8b5a('0x3e')]=_0x46a693[_0x8b5a('0x3f')];_0x72bb91[_0x8b5a('0x40')]=_0x46a693[_0x8b5a('0x41')];return db[_0x8b5a('0x3a')][_0x8b5a('0x42')]({'data5':_0x72bb91[_0x8b5a('0x3e')],'data6':_0x72bb91[_0x8b5a('0x40')]},{'where':{'id':_0x72bb91['id']}});})['then'](function(){return _0x72bb91;})[_0x8b5a('0x43')](function(_0x74d9eb){logger[_0x8b5a('0x44')](_0x8b5a('0x45'),_0x72bb91['id'],_0x74d9eb);});}function getOauth2MicrosoftAccessToken(_0x32e2c0,_0x2fd93b){var _0x4e0b76={'grant_type':_0x8b5a('0x46'),'code':_0x32e2c0,'scope':getAccessTokenScope(_0x2fd93b),'redirect_uri':_0x2fd93b[_0x8b5a('0x28')],'client_id':_0x2fd93b[_0x8b5a('0x26')],'client_secret':encryptor[_0x8b5a('0x3c')](_0x2fd93b[_0x8b5a('0x39')])};var _0x13d3eb={'method':_0x8b5a('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x8b5a('0x1f')](_0x8b5a('0x20'),_0x2fd93b[_0x8b5a('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4e0b76,'json':!![]};return rp(_0x13d3eb);}function startRefreshInterval(_0x555327){var _0x5789dd=schedule[_0x8b5a('0x47')];if(_0x5789dd[_0x555327['id']])clearInterval(_0x5789dd[_0x555327['id']]);_0x5789dd[_0x555327['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8b5a('0x48')](this,{'id':_0x555327['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8b5a('0x47')]=_0x5789dd;}function startAllRefreshIntervals(){return db[_0x8b5a('0x3a')][_0x8b5a('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8b5a('0x38')](function(_0x5b1f9e){var _0xbe6b7e=_0x5b1f9e[_0x8b5a('0x18')](function(_0x468bee){return refreshOauth2MicrosoftAccessToken(_0x468bee)[_0x8b5a('0x38')](function(_0x33101a){startRefreshInterval(_0x33101a);});});return Promise[_0x8b5a('0x4a')](_0xbe6b7e);})[_0x8b5a('0x43')](function(_0x433cd2){var _0xf07b6f=_0x433cd2?util['inspect'](_0x433cd2,{'showHidden':![],'depth':null}):'';logger[_0x8b5a('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xf07b6f);});}module[_0x8b5a('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index f68af5d..884924d 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 _0x9458=['moment','ioredis','../../config/utils','../../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','error','code','message','request\x20sent','catch'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9458,0x1b8));var _0x8945=function(_0x2526d1,_0x2a37b1){_0x2526d1=_0x2526d1-0x0;var _0x51a0b4=_0x9458[_0x2526d1];return _0x51a0b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8945('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8945('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8945('0x2'));var logger=require(_0x8945('0x3'))(_0x8945('0x4'));var config=require(_0x8945('0x5'));var jayson=require(_0x8945('0x6'));var client=jayson[_0x8945('0x7')][_0x8945('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12187d,_0x928802,_0x1a2b8f){return new BPromise(function(_0x4aec0b,_0x29eaed){return client[_0x8945('0x9')](_0x12187d,_0x1a2b8f)[_0x8945('0xa')](function(_0x307b9e){logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,'request\x20sent');logger[_0x8945('0xd')](_0x8945('0xe'),_0x928802,'request\x20sent',JSON['stringify'](_0x307b9e));if(_0x307b9e[_0x8945('0xf')]){if(_0x307b9e['error'][_0x8945('0x10')]===0x1f4){logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);return _0x29eaed(_0x307b9e[_0x8945('0xf')]['message']);}logger[_0x8945('0xf')](_0x8945('0xc'),_0x928802,_0x307b9e['error'][_0x8945('0x11')]);return _0x4aec0b(_0x307b9e[_0x8945('0xf')][_0x8945('0x11')]);}else{logger[_0x8945('0xb')](_0x8945('0xc'),_0x928802,_0x8945('0x12'));_0x4aec0b(_0x307b9e['result']['message']);}})[_0x8945('0x13')](function(_0x4c0b8f){logger['error'](_0x8945('0xc'),_0x928802,_0x4c0b8f);_0x29eaed(_0x4c0b8f);});});} \ No newline at end of file +var _0xd9eb=['then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x242222,_0x1022ab){var _0x1d879e=function(_0x246f8){while(--_0x246f8){_0x242222['push'](_0x242222['shift']());}};_0x1d879e(++_0x1022ab);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0xd9eb[_0x5bccd3];return _0x322dbc;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var moment=require(_0xbd9e('0x2'));var BPromise=require(_0xbd9e('0x3'));var rs=require(_0xbd9e('0x4'));var fs=require('fs');var Redis=require(_0xbd9e('0x5'));var db=require(_0xbd9e('0x6'))['db'];var utils=require(_0xbd9e('0x7'));var logger=require(_0xbd9e('0x8'))(_0xbd9e('0x9'));var config=require(_0xbd9e('0xa'));var jayson=require(_0xbd9e('0xb'));var client=jayson[_0xbd9e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26408d,_0x37d9a1,_0x293a79){return new BPromise(function(_0x2dbf84,_0x20cddf){return client[_0xbd9e('0xd')](_0x26408d,_0x293a79)[_0xbd9e('0xe')](function(_0x82e476){logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));logger[_0xbd9e('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x37d9a1,_0xbd9e('0x11'),JSON[_0xbd9e('0x13')](_0x82e476));if(_0x82e476['error']){if(_0x82e476[_0xbd9e('0x14')]['code']===0x1f4){logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);return _0x20cddf(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476['error'][_0xbd9e('0x15')]);return _0x2dbf84(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}else{logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));_0x2dbf84(_0x82e476[_0xbd9e('0x16')][_0xbd9e('0x15')]);}})[_0xbd9e('0x17')](function(_0x42e634){logger[_0xbd9e('0x14')]('CloudProvider,\x20%s,\x20%s',_0x37d9a1,_0x42e634);_0x20cddf(_0x42e634);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1520445..dfb890f 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x522e2d,_0x28bf77){var _0x1d5eb7=function(_0x292d9e){while(--_0x292d9e){_0x522e2d['push'](_0x522e2d['shift']());}};_0x1d5eb7(++_0x28bf77);}(_0xdb28,0x106));var _0x8db2=function(_0x22a995,_0x547c01){_0x22a995=_0x22a995-0x0;var _0x5324c7=_0xdb28[_0x22a995];return _0x5324c7;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x2b58af,_0x4053c4){var _0x52c28a=function(_0x46da62){while(--_0x46da62){_0x2b58af['push'](_0x2b58af['shift']());}};_0x52c28a(++_0x4053c4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c73e7fb..2f0765e 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 _0xad24=['STRING','name','sequelize','exports'];(function(_0x414bd2,_0xc8a2a3){var _0x1b0adc=function(_0x4240ce){while(--_0x4240ce){_0x414bd2['push'](_0x414bd2['shift']());}};_0x1b0adc(++_0xc8a2a3);}(_0xad24,0x1ce));var _0x4ad2=function(_0x57c187,_0x512d6a){_0x57c187=_0x57c187-0x0;var _0x38c43b=_0xad24[_0x57c187];return _0x38c43b;};'use strict';var Sequelize=require(_0x4ad2('0x0'));module[_0x4ad2('0x1')]={'name':{'type':Sequelize[_0x4ad2('0x2')],'unique':_0x4ad2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4ad2('0x2')]},'companyId':{'type':Sequelize[_0x4ad2('0x2')]},'website':{'type':Sequelize[_0x4ad2('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4ad2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4ad2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4ad2('0x2')]},'email':{'type':Sequelize[_0x4ad2('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4ad2('0x2')]},'sPostalCode':{'type':Sequelize[_0x4ad2('0x2')]},'sCity':{'type':Sequelize[_0x4ad2('0x2')]},'sCountry':{'type':Sequelize[_0x4ad2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x241d=['name','sequelize','STRING'];(function(_0xddfbdc,_0x561a0b){var _0x395d72=function(_0x2b7de6){while(--_0x2b7de6){_0xddfbdc['push'](_0xddfbdc['shift']());}};_0x395d72(++_0x561a0b);}(_0x241d,0x64));var _0xd241=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x241d[_0x42bc91];return _0x3f5507;};'use strict';var Sequelize=require(_0xd241('0x0'));module['exports']={'name':{'type':Sequelize[_0xd241('0x1')],'unique':_0xd241('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd241('0x1')]},'companyId':{'type':Sequelize[_0xd241('0x1')]},'website':{'type':Sequelize[_0xd241('0x1')]},'phone':{'type':Sequelize[_0xd241('0x1')]},'fax':{'type':Sequelize[_0xd241('0x1')]},'type':{'type':Sequelize[_0xd241('0x1')]},'street':{'type':Sequelize[_0xd241('0x1')]},'postalCode':{'type':Sequelize[_0xd241('0x1')]},'city':{'type':Sequelize[_0xd241('0x1')]},'country':{'type':Sequelize[_0xd241('0x1')]},'email':{'type':Sequelize[_0xd241('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd241('0x1')]},'sPostalCode':{'type':Sequelize[_0xd241('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd241('0x1')]},'description':{'type':Sequelize[_0xd241('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a28fdbd..32e9f96 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 _0xc077=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','omit','ids','getContacts','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x104f06,_0xb99f12){var _0x4a6ffd=function(_0x1a7668){while(--_0x1a7668){_0x104f06['push'](_0x104f06['shift']());}};_0x4a6ffd(++_0xb99f12);}(_0xc077,0x14a));var _0x7c07=function(_0x18528a,_0x4de7d1){_0x18528a=_0x18528a-0x0;var _0x2c3214=_0xc077[_0x18528a];return _0x2c3214;};'use strict';var emlformat=require(_0x7c07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c07('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c07('0x2'));var moment=require(_0x7c07('0x3'));var BPromise=require(_0x7c07('0x4'));var Mustache=require(_0x7c07('0x5'));var util=require('util');var path=require(_0x7c07('0x6'));var sox=require(_0x7c07('0x7'));var csv=require(_0x7c07('0x8'));var ejs=require(_0x7c07('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c07('0xa'));var squel=require(_0x7c07('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c07('0xc'));var deskjs=require(_0x7c07('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c07('0xe'));var Papa=require('papaparse');var Redis=require(_0x7c07('0xf'));var authService=require(_0x7c07('0x10'));var qs=require(_0x7c07('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c07('0x12'))(_0x7c07('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c07('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e30f,_0x5307c7){_0x5307c7=_0x5307c7||0xcc;return function(_0x3a1a29){if(_0x3a1a29){return _0x16e30f[_0x7c07('0x15')](_0x5307c7);}return _0x16e30f[_0x7c07('0x16')](_0x5307c7)[_0x7c07('0x17')]();};}function respondWithResult(_0x34edcb,_0x3732c0){_0x3732c0=_0x3732c0||0xc8;return function(_0x10df07){if(_0x10df07){return _0x34edcb[_0x7c07('0x16')](_0x3732c0)[_0x7c07('0x18')](_0x10df07);}};}function respondWithFilteredResult(_0x4a79f8,_0x9ff5a5){return function(_0x589161){if(_0x589161){var _0x5a8f81=typeof _0x9ff5a5[_0x7c07('0x19')]===_0x7c07('0x1a')&&typeof _0x9ff5a5[_0x7c07('0x1b')]===_0x7c07('0x1a');var _0x1059bf=_0x589161[_0x7c07('0x1c')];var _0x4a3273=_0x5a8f81?0x0:_0x9ff5a5[_0x7c07('0x19')];var _0x6f4590=_0x5a8f81?_0x589161[_0x7c07('0x1c')]:_0x9ff5a5['offset']+_0x9ff5a5[_0x7c07('0x1b')];var _0x413ca2;if(_0x6f4590>=_0x1059bf){_0x6f4590=_0x1059bf;_0x413ca2=0xc8;}else{_0x413ca2=0xce;}_0x4a79f8[_0x7c07('0x16')](_0x413ca2);return _0x4a79f8[_0x7c07('0x1d')]('Content-Range',_0x4a3273+'-'+_0x6f4590+'/'+_0x1059bf)[_0x7c07('0x18')](_0x589161);}return null;};}function patchUpdates(_0x476e56){return function(_0x559fd5){try{jsonpatch[_0x7c07('0x1e')](_0x559fd5,_0x476e56,!![]);}catch(_0x123e8f){return BPromise[_0x7c07('0x1f')](_0x123e8f);}return _0x559fd5[_0x7c07('0x20')]();};}function saveUpdates(_0x3d4946,_0x264af5){return function(_0x7e5bc6){if(_0x7e5bc6){return _0x7e5bc6[_0x7c07('0x21')](_0x3d4946)[_0x7c07('0x22')](function(_0x29e52b){return _0x29e52b;});}return null;};}function removeEntity(_0x22a4f6,_0x1fad87){return function(_0x4c4c6f){if(_0x4c4c6f){return _0x4c4c6f[_0x7c07('0x23')]()[_0x7c07('0x22')](function(){var _0x5bb993=_0x4c4c6f[_0x7c07('0x24')]({'plain':!![]});var _0x15d56b=_0x7c07('0x25');return db[_0x7c07('0x26')]['destroy']({'where':{'type':_0x15d56b,'resourceId':_0x5bb993['id']}})[_0x7c07('0x22')](function(){return _0x4c4c6f;});})[_0x7c07('0x22')](function(){_0x22a4f6[_0x7c07('0x16')](0xcc)[_0x7c07('0x17')]();});}};}function handleEntityNotFound(_0x1ec38b,_0x42dc17){return function(_0x44def2){if(!_0x44def2){_0x1ec38b['sendStatus'](0x194);}return _0x44def2;};}function handleError(_0x32b86c,_0x51254c){_0x51254c=_0x51254c||0x1f4;return function(_0x24818d){logger[_0x7c07('0x27')](_0x24818d['stack']);if(_0x24818d[_0x7c07('0x28')]){delete _0x24818d['name'];}_0x32b86c['status'](_0x51254c)[_0x7c07('0x29')](_0x24818d);};}exports[_0x7c07('0x2a')]=function(_0x465166,_0x18a253){var _0x13e46e={},_0x4918b1={},_0x2a0e38={'count':0x0,'rows':[]};return db[_0x7c07('0x2b')][_0x7c07('0x2c')]()[_0x7c07('0x22')](function(_0x338df0){_0x4918b1[_0x7c07('0x2d')]=_[_0x7c07('0x2e')](_0x338df0);_0x4918b1['query']=_[_0x7c07('0x2e')](_0x465166[_0x7c07('0x2f')]);_0x4918b1[_0x7c07('0x30')]=_[_0x7c07('0x31')](_0x4918b1['model'],_0x4918b1[_0x7c07('0x2f')]);_0x13e46e[_0x7c07('0x32')]=_[_0x7c07('0x31')](_0x4918b1[_0x7c07('0x2d')],qs[_0x7c07('0x33')](_0x465166[_0x7c07('0x2f')][_0x7c07('0x33')]));_0x13e46e['attributes']=_0x13e46e[_0x7c07('0x32')][_0x7c07('0x34')]?_0x13e46e['attributes']:_0x4918b1['model'];if(!_0x465166['query'][_0x7c07('0x35')](_0x7c07('0x36'))){_0x13e46e['limit']=qs[_0x7c07('0x1b')](_0x465166['query'][_0x7c07('0x1b')]);_0x13e46e['offset']=qs[_0x7c07('0x19')](_0x465166['query'][_0x7c07('0x19')]);}_0x13e46e[_0x7c07('0x37')]=qs['sort'](_0x465166[_0x7c07('0x2f')][_0x7c07('0x38')]);_0x13e46e[_0x7c07('0x39')]=qs[_0x7c07('0x30')](_[_0x7c07('0x3a')](_0x465166[_0x7c07('0x2f')],_0x4918b1[_0x7c07('0x30')]),_0x338df0);if(_0x465166[_0x7c07('0x2f')][_0x7c07('0x3b')]){_0x13e46e[_0x7c07('0x39')]=_[_0x7c07('0x3c')](_0x13e46e[_0x7c07('0x39')],{'$or':_[_0x7c07('0x3d')](_0x13e46e[_0x7c07('0x32')],function(_0x3e8680){var _0x3de7f5={};_0x3de7f5[_0x3e8680]={'$like':'%'+_0x465166['query']['filter']+'%'};return _0x3de7f5;})});}_0x13e46e=_[_0x7c07('0x3c')]({},_0x13e46e,_0x465166['options']);var _0x5de059={'where':_0x13e46e[_0x7c07('0x39')]};return db[_0x7c07('0x2b')]['count'](_0x5de059)[_0x7c07('0x22')](function(_0x5146e9){_0x2a0e38[_0x7c07('0x1c')]=_0x5146e9;if(_0x465166['query'][_0x7c07('0x3e')]){_0x13e46e[_0x7c07('0x3f')]=[{'all':!![]}];}return db[_0x7c07('0x2b')][_0x7c07('0x40')](_0x13e46e);})[_0x7c07('0x22')](function(_0x25561b){_0x2a0e38[_0x7c07('0x41')]=_0x25561b;return _0x2a0e38;})[_0x7c07('0x22')](respondWithFilteredResult(_0x18a253,_0x13e46e))[_0x7c07('0x42')](handleError(_0x18a253,null));})[_0x7c07('0x42')](handleError(_0x18a253,null));};exports[_0x7c07('0x43')]=function(_0x14d668,_0x400d8e){var _0x51a712={'raw':![],'where':{'id':_0x14d668[_0x7c07('0x44')]['id']}},_0x179d1e={};_0x179d1e[_0x7c07('0x2d')]=_[_0x7c07('0x2e')](db[_0x7c07('0x2b')][_0x7c07('0x45')]);_0x179d1e[_0x7c07('0x2f')]=_[_0x7c07('0x2e')](_0x14d668[_0x7c07('0x2f')]);_0x179d1e['filters']=_[_0x7c07('0x31')](_0x179d1e['model'],_0x179d1e[_0x7c07('0x2f')]);_0x51a712[_0x7c07('0x32')]=_[_0x7c07('0x31')](_0x179d1e[_0x7c07('0x2d')],qs[_0x7c07('0x33')](_0x14d668[_0x7c07('0x2f')][_0x7c07('0x33')]));_0x51a712[_0x7c07('0x32')]=_0x51a712[_0x7c07('0x32')]['length']?_0x51a712[_0x7c07('0x32')]:_0x179d1e[_0x7c07('0x2d')];if(_0x14d668[_0x7c07('0x2f')][_0x7c07('0x3e')]){_0x51a712[_0x7c07('0x3f')]=[{'all':!![]}];}_0x51a712=_[_0x7c07('0x3c')]({},_0x51a712,_0x14d668[_0x7c07('0x46')]);return db['CmCompany'][_0x7c07('0x47')](_0x51a712)[_0x7c07('0x22')](handleEntityNotFound(_0x400d8e,null))[_0x7c07('0x22')](respondWithResult(_0x400d8e,null))[_0x7c07('0x42')](handleError(_0x400d8e,null));};exports[_0x7c07('0x48')]=function(_0x29298d,_0x22cb8b){return db['CmCompany']['create'](_0x29298d['body'],{})['then'](function(_0x553688){var _0x2261be=_0x29298d[_0x7c07('0x49')]['get']({'plain':!![]});if(!_0x2261be)throw new Error(_0x7c07('0x4a'));if(_0x2261be[_0x7c07('0x4b')]===_0x7c07('0x49')){var _0x18b68e=_0x553688[_0x7c07('0x24')]({'plain':!![]});var _0x1a4dec=_0x7c07('0x25');return db[_0x7c07('0x4c')][_0x7c07('0x47')]({'where':{'name':_0x1a4dec,'userProfileId':_0x2261be['userProfileId']},'raw':!![]})[_0x7c07('0x22')](function(_0x24eca5){if(_0x24eca5&&_0x24eca5['autoAssociation']===0x0){return db[_0x7c07('0x26')][_0x7c07('0x48')]({'name':_0x18b68e[_0x7c07('0x28')],'resourceId':_0x18b68e['id'],'type':_0x24eca5[_0x7c07('0x28')],'sectionId':_0x24eca5['id']},{})[_0x7c07('0x22')](function(){return _0x553688;});}else{return _0x553688;}})[_0x7c07('0x42')](function(_0x338f51){logger['error'](_0x7c07('0x4d'),_0x338f51);throw _0x338f51;});}return _0x553688;})['then'](respondWithResult(_0x22cb8b,0xc9))[_0x7c07('0x42')](handleError(_0x22cb8b,null));};exports[_0x7c07('0x21')]=function(_0x104111,_0x3b8844){if(_0x104111['body']['id']){delete _0x104111[_0x7c07('0x4e')]['id'];}return db[_0x7c07('0x2b')][_0x7c07('0x47')]({'where':{'id':_0x104111['params']['id']}})['then'](handleEntityNotFound(_0x3b8844,null))[_0x7c07('0x22')](saveUpdates(_0x104111['body'],null))['then'](respondWithResult(_0x3b8844,null))[_0x7c07('0x42')](handleError(_0x3b8844,null));};exports[_0x7c07('0x23')]=function(_0xa5b6b4,_0x12db9e){return db[_0x7c07('0x2b')][_0x7c07('0x47')]({'where':{'id':_0xa5b6b4['params']['id']}})[_0x7c07('0x22')](handleEntityNotFound(_0x12db9e,null))[_0x7c07('0x22')](removeEntity(_0x12db9e,null))['catch'](handleError(_0x12db9e,null));};exports[_0x7c07('0x2c')]=function(_0x2bc74b,_0x259e82){return db['CmCompany'][_0x7c07('0x2c')]()[_0x7c07('0x22')](respondWithResult(_0x259e82,null))['catch'](handleError(_0x259e82,null));};exports[_0x7c07('0x4f')]=function(_0x5cd290,_0x57025f,_0x49d178){return db[_0x7c07('0x50')][_0x7c07('0x47')]({'where':{'id':_0x5cd290[_0x7c07('0x44')]['id']}})[_0x7c07('0x22')](handleEntityNotFound(_0x57025f,null))[_0x7c07('0x22')](function(_0xd9ca85){if(_0xd9ca85){return _0xd9ca85[_0x7c07('0x4f')](_0x5cd290[_0x7c07('0x4e')]['ids'],_[_0x7c07('0x51')](_0x5cd290[_0x7c07('0x4e')],[_0x7c07('0x52'),'id'])||{});}})[_0x7c07('0x22')](respondWithResult(_0x57025f,null))[_0x7c07('0x42')](handleError(_0x57025f,null));};exports[_0x7c07('0x53')]=function(_0x2b712b,_0x29f638,_0xdd56e4){var _0x1cae79={};var _0x342657={};var _0x2bf90c;var _0x4e3db7;return db[_0x7c07('0x2b')][_0x7c07('0x54')]({'where':{'id':_0x2b712b[_0x7c07('0x44')]['id']}})['then'](handleEntityNotFound(_0x29f638,null))['then'](function(_0x3413a1){if(_0x3413a1){_0x2bf90c=_0x3413a1;_0x342657[_0x7c07('0x2d')]=_[_0x7c07('0x2e')](db[_0x7c07('0x50')]['rawAttributes']);_0x342657['query']=_[_0x7c07('0x2e')](_0x2b712b['query']);_0x342657[_0x7c07('0x30')]=_[_0x7c07('0x31')](_0x342657['model'],_0x342657[_0x7c07('0x2f')]);_0x1cae79[_0x7c07('0x32')]=_['intersection'](_0x342657['model'],qs['fields'](_0x2b712b[_0x7c07('0x2f')][_0x7c07('0x33')]));_0x1cae79[_0x7c07('0x32')]=_0x1cae79['attributes'][_0x7c07('0x34')]?_0x1cae79[_0x7c07('0x32')]:_0x342657[_0x7c07('0x2d')];_0x1cae79[_0x7c07('0x37')]=qs[_0x7c07('0x38')](_0x2b712b[_0x7c07('0x2f')]['sort']);_0x1cae79['where']=qs[_0x7c07('0x30')](_[_0x7c07('0x3a')](_0x2b712b[_0x7c07('0x2f')],_0x342657[_0x7c07('0x30')]));if(_0x2b712b[_0x7c07('0x2f')]['filter']){_0x1cae79[_0x7c07('0x39')]=_[_0x7c07('0x3c')](_0x1cae79['where'],{'$or':_[_0x7c07('0x3d')](_0x1cae79['attributes'],function(_0x5dcc22){var _0x23158a={};_0x23158a[_0x5dcc22]={'$like':'%'+_0x2b712b[_0x7c07('0x2f')][_0x7c07('0x3b')]+'%'};return _0x23158a;})});}_0x1cae79=_['merge']({},_0x1cae79,_0x2b712b['options']);return _0x2bf90c[_0x7c07('0x53')](_0x1cae79);}})[_0x7c07('0x22')](function(_0x224a5c){if(_0x224a5c){_0x4e3db7=_0x224a5c[_0x7c07('0x34')];if(!_0x2b712b[_0x7c07('0x2f')]['hasOwnProperty'](_0x7c07('0x36'))){_0x1cae79[_0x7c07('0x1b')]=qs[_0x7c07('0x1b')](_0x2b712b[_0x7c07('0x2f')][_0x7c07('0x1b')]);_0x1cae79[_0x7c07('0x19')]=qs['offset'](_0x2b712b['query']['offset']);}return _0x2bf90c[_0x7c07('0x53')](_0x1cae79);}})[_0x7c07('0x22')](function(_0x5ed393){if(_0x5ed393){return _0x5ed393?{'count':_0x4e3db7,'rows':_0x5ed393}:null;}})['then'](respondWithResult(_0x29f638,null))[_0x7c07('0x42')](handleError(_0x29f638,null));}; \ No newline at end of file +var _0x77f6=['destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','CmContact','addContacts','ids','getContacts','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then'];(function(_0x2fc026,_0xdc4f7a){var _0x34d056=function(_0x457d02){while(--_0x457d02){_0x2fc026['push'](_0x2fc026['shift']());}};_0x34d056(++_0xdc4f7a);}(_0x77f6,0x1dc));var _0x677f=function(_0x1f37c9,_0x8a0ed5){_0x1f37c9=_0x1f37c9-0x0;var _0x28bb7e=_0x77f6[_0x1f37c9];return _0x28bb7e;};'use strict';var emlformat=require(_0x677f('0x0'));var rimraf=require(_0x677f('0x1'));var zipdir=require(_0x677f('0x2'));var jsonpatch=require(_0x677f('0x3'));var rp=require('request-promise');var moment=require(_0x677f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x677f('0x5'));var sox=require('sox');var csv=require(_0x677f('0x6'));var ejs=require(_0x677f('0x7'));var fs=require('fs');var fs_extra=require(_0x677f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677f('0x9'));var deskjs=require(_0x677f('0xa'));var toCsv=require(_0x677f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x677f('0xb'));var authService=require(_0x677f('0xc'));var qs=require(_0x677f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x677f('0xe'));var logger=require(_0x677f('0xf'))(_0x677f('0x10'));var utils=require(_0x677f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x677f('0x12'));var db=require(_0x677f('0x13'))['db'];function respondWithStatusCode(_0x39636a,_0x29a70e){_0x29a70e=_0x29a70e||0xcc;return function(_0x300022){if(_0x300022){return _0x39636a[_0x677f('0x14')](_0x29a70e);}return _0x39636a[_0x677f('0x15')](_0x29a70e)[_0x677f('0x16')]();};}function respondWithResult(_0x2e4238,_0x4038ab){_0x4038ab=_0x4038ab||0xc8;return function(_0x540f92){if(_0x540f92){return _0x2e4238[_0x677f('0x15')](_0x4038ab)[_0x677f('0x17')](_0x540f92);}};}function respondWithFilteredResult(_0x44165d,_0x1acb67){return function(_0x410447){if(_0x410447){var _0xa22a23=typeof _0x1acb67[_0x677f('0x18')]===_0x677f('0x19')&&typeof _0x1acb67[_0x677f('0x1a')]===_0x677f('0x19');var _0x1730a4=_0x410447[_0x677f('0x1b')];var _0x3c9d4d=_0xa22a23?0x0:_0x1acb67['offset'];var _0x341b0f=_0xa22a23?_0x410447[_0x677f('0x1b')]:_0x1acb67[_0x677f('0x18')]+_0x1acb67['limit'];var _0x22df36;if(_0x341b0f>=_0x1730a4){_0x341b0f=_0x1730a4;_0x22df36=0xc8;}else{_0x22df36=0xce;}_0x44165d[_0x677f('0x15')](_0x22df36);return _0x44165d[_0x677f('0x1c')](_0x677f('0x1d'),_0x3c9d4d+'-'+_0x341b0f+'/'+_0x1730a4)[_0x677f('0x17')](_0x410447);}return null;};}function patchUpdates(_0x19a533){return function(_0x476705){try{jsonpatch[_0x677f('0x1e')](_0x476705,_0x19a533,!![]);}catch(_0x24aecb){return BPromise[_0x677f('0x1f')](_0x24aecb);}return _0x476705['save']();};}function saveUpdates(_0xa6926,_0x5ef2be){return function(_0x4de855){if(_0x4de855){return _0x4de855[_0x677f('0x20')](_0xa6926)[_0x677f('0x21')](function(_0x1db665){return _0x1db665;});}return null;};}function removeEntity(_0x4b8599,_0x35ffba){return function(_0x5f4bdb){if(_0x5f4bdb){return _0x5f4bdb[_0x677f('0x22')]()[_0x677f('0x21')](function(){var _0x32712d=_0x5f4bdb[_0x677f('0x23')]({'plain':!![]});var _0x26e114=_0x677f('0x24');return db[_0x677f('0x25')][_0x677f('0x22')]({'where':{'type':_0x26e114,'resourceId':_0x32712d['id']}})[_0x677f('0x21')](function(){return _0x5f4bdb;});})[_0x677f('0x21')](function(){_0x4b8599[_0x677f('0x15')](0xcc)[_0x677f('0x16')]();});}};}function handleEntityNotFound(_0x263b77,_0x1bf30e){return function(_0x22dfdb){if(!_0x22dfdb){_0x263b77[_0x677f('0x14')](0x194);}return _0x22dfdb;};}function handleError(_0x103fb0,_0x6895a5){_0x6895a5=_0x6895a5||0x1f4;return function(_0x1dc142){logger[_0x677f('0x26')](_0x1dc142[_0x677f('0x27')]);if(_0x1dc142[_0x677f('0x28')]){delete _0x1dc142[_0x677f('0x28')];}_0x103fb0[_0x677f('0x15')](_0x6895a5)[_0x677f('0x29')](_0x1dc142);};}exports[_0x677f('0x2a')]=function(_0x9c9c78,_0x5b2363){var _0x5628a7={},_0x5df024={},_0x1ccfcf={'count':0x0,'rows':[]};return db[_0x677f('0x2b')][_0x677f('0x2c')]()[_0x677f('0x21')](function(_0x9e9df6){_0x5df024[_0x677f('0x2d')]=_[_0x677f('0x2e')](_0x9e9df6);_0x5df024[_0x677f('0x2f')]=_[_0x677f('0x2e')](_0x9c9c78['query']);_0x5df024[_0x677f('0x30')]=_[_0x677f('0x31')](_0x5df024[_0x677f('0x2d')],_0x5df024[_0x677f('0x2f')]);_0x5628a7[_0x677f('0x32')]=_['intersection'](_0x5df024[_0x677f('0x2d')],qs['fields'](_0x9c9c78[_0x677f('0x2f')]['fields']));_0x5628a7[_0x677f('0x32')]=_0x5628a7['attributes'][_0x677f('0x33')]?_0x5628a7[_0x677f('0x32')]:_0x5df024[_0x677f('0x2d')];if(!_0x9c9c78[_0x677f('0x2f')][_0x677f('0x34')](_0x677f('0x35'))){_0x5628a7['limit']=qs[_0x677f('0x1a')](_0x9c9c78[_0x677f('0x2f')][_0x677f('0x1a')]);_0x5628a7[_0x677f('0x18')]=qs[_0x677f('0x18')](_0x9c9c78[_0x677f('0x2f')][_0x677f('0x18')]);}_0x5628a7[_0x677f('0x36')]=qs['sort'](_0x9c9c78[_0x677f('0x2f')][_0x677f('0x37')]);_0x5628a7[_0x677f('0x38')]=qs[_0x677f('0x30')](_[_0x677f('0x39')](_0x9c9c78['query'],_0x5df024[_0x677f('0x30')]),_0x9e9df6);if(_0x9c9c78[_0x677f('0x2f')][_0x677f('0x3a')]){_0x5628a7[_0x677f('0x38')]=_[_0x677f('0x3b')](_0x5628a7[_0x677f('0x38')],{'$or':_['map'](_0x5628a7['attributes'],function(_0x3f02f3){var _0x45eae7={};_0x45eae7[_0x3f02f3]={'$like':'%'+_0x9c9c78[_0x677f('0x2f')][_0x677f('0x3a')]+'%'};return _0x45eae7;})});}_0x5628a7=_['merge']({},_0x5628a7,_0x9c9c78[_0x677f('0x3c')]);var _0x304589={'where':_0x5628a7[_0x677f('0x38')]};return db[_0x677f('0x2b')][_0x677f('0x1b')](_0x304589)['then'](function(_0x22f7eb){_0x1ccfcf['count']=_0x22f7eb;if(_0x9c9c78[_0x677f('0x2f')][_0x677f('0x3d')]){_0x5628a7[_0x677f('0x3e')]=[{'all':!![]}];}return db[_0x677f('0x2b')][_0x677f('0x3f')](_0x5628a7);})[_0x677f('0x21')](function(_0x204502){_0x1ccfcf[_0x677f('0x40')]=_0x204502;return _0x1ccfcf;})[_0x677f('0x21')](respondWithFilteredResult(_0x5b2363,_0x5628a7))['catch'](handleError(_0x5b2363,null));})[_0x677f('0x41')](handleError(_0x5b2363,null));};exports[_0x677f('0x42')]=function(_0x5b5b4c,_0x402a36){var _0x3b62a3={'raw':![],'where':{'id':_0x5b5b4c[_0x677f('0x43')]['id']}},_0x148039={};_0x148039[_0x677f('0x2d')]=_[_0x677f('0x2e')](db[_0x677f('0x2b')][_0x677f('0x44')]);_0x148039[_0x677f('0x2f')]=_[_0x677f('0x2e')](_0x5b5b4c[_0x677f('0x2f')]);_0x148039['filters']=_[_0x677f('0x31')](_0x148039[_0x677f('0x2d')],_0x148039[_0x677f('0x2f')]);_0x3b62a3[_0x677f('0x32')]=_[_0x677f('0x31')](_0x148039[_0x677f('0x2d')],qs[_0x677f('0x45')](_0x5b5b4c['query'][_0x677f('0x45')]));_0x3b62a3[_0x677f('0x32')]=_0x3b62a3[_0x677f('0x32')][_0x677f('0x33')]?_0x3b62a3[_0x677f('0x32')]:_0x148039[_0x677f('0x2d')];if(_0x5b5b4c[_0x677f('0x2f')][_0x677f('0x3d')]){_0x3b62a3[_0x677f('0x3e')]=[{'all':!![]}];}_0x3b62a3=_[_0x677f('0x3b')]({},_0x3b62a3,_0x5b5b4c[_0x677f('0x3c')]);return db['CmCompany'][_0x677f('0x46')](_0x3b62a3)['then'](handleEntityNotFound(_0x402a36,null))[_0x677f('0x21')](respondWithResult(_0x402a36,null))[_0x677f('0x41')](handleError(_0x402a36,null));};exports[_0x677f('0x47')]=function(_0x1568df,_0x1d31a0){return db[_0x677f('0x2b')][_0x677f('0x47')](_0x1568df[_0x677f('0x48')],{})[_0x677f('0x21')](function(_0x3c9249){var _0x5265d6=_0x1568df[_0x677f('0x49')][_0x677f('0x23')]({'plain':!![]});if(!_0x5265d6)throw new Error(_0x677f('0x4a'));if(_0x5265d6[_0x677f('0x4b')]===_0x677f('0x49')){var _0x1285ea=_0x3c9249[_0x677f('0x23')]({'plain':!![]});var _0x36f35e='Companies';return db[_0x677f('0x4c')][_0x677f('0x46')]({'where':{'name':_0x36f35e,'userProfileId':_0x5265d6[_0x677f('0x4d')]},'raw':!![]})[_0x677f('0x21')](function(_0x11a9f7){if(_0x11a9f7&&_0x11a9f7[_0x677f('0x4e')]===0x0){return db[_0x677f('0x25')][_0x677f('0x47')]({'name':_0x1285ea[_0x677f('0x28')],'resourceId':_0x1285ea['id'],'type':_0x11a9f7[_0x677f('0x28')],'sectionId':_0x11a9f7['id']},{})['then'](function(){return _0x3c9249;});}else{return _0x3c9249;}})[_0x677f('0x41')](function(_0x2bace4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bace4);throw _0x2bace4;});}return _0x3c9249;})[_0x677f('0x21')](respondWithResult(_0x1d31a0,0xc9))[_0x677f('0x41')](handleError(_0x1d31a0,null));};exports[_0x677f('0x20')]=function(_0x1256b1,_0x135923){if(_0x1256b1['body']['id']){delete _0x1256b1['body']['id'];}return db[_0x677f('0x2b')]['find']({'where':{'id':_0x1256b1[_0x677f('0x43')]['id']}})['then'](handleEntityNotFound(_0x135923,null))[_0x677f('0x21')](saveUpdates(_0x1256b1['body'],null))[_0x677f('0x21')](respondWithResult(_0x135923,null))[_0x677f('0x41')](handleError(_0x135923,null));};exports[_0x677f('0x22')]=function(_0x5e479a,_0x33fa0f){return db[_0x677f('0x2b')][_0x677f('0x46')]({'where':{'id':_0x5e479a[_0x677f('0x43')]['id']}})[_0x677f('0x21')](handleEntityNotFound(_0x33fa0f,null))[_0x677f('0x21')](removeEntity(_0x33fa0f,null))[_0x677f('0x41')](handleError(_0x33fa0f,null));};exports[_0x677f('0x2c')]=function(_0x53f404,_0x28bae1){return db['CmCompany'][_0x677f('0x2c')]()[_0x677f('0x21')](respondWithResult(_0x28bae1,null))['catch'](handleError(_0x28bae1,null));};exports['addContacts']=function(_0x1c59fd,_0x52e9c,_0x3345e5){return db[_0x677f('0x4f')][_0x677f('0x46')]({'where':{'id':_0x1c59fd[_0x677f('0x43')]['id']}})['then'](handleEntityNotFound(_0x52e9c,null))[_0x677f('0x21')](function(_0x4fda94){if(_0x4fda94){return _0x4fda94[_0x677f('0x50')](_0x1c59fd[_0x677f('0x48')][_0x677f('0x51')],_['omit'](_0x1c59fd[_0x677f('0x48')],['ids','id'])||{});}})[_0x677f('0x21')](respondWithResult(_0x52e9c,null))[_0x677f('0x41')](handleError(_0x52e9c,null));};exports[_0x677f('0x52')]=function(_0x30dd8b,_0x1d101c,_0x276798){var _0xf8b21f={};var _0x4829a5={};var _0x1f2583;var _0x528ff4;return db['CmCompany'][_0x677f('0x53')]({'where':{'id':_0x30dd8b[_0x677f('0x43')]['id']}})[_0x677f('0x21')](handleEntityNotFound(_0x1d101c,null))['then'](function(_0x48cb91){if(_0x48cb91){_0x1f2583=_0x48cb91;_0x4829a5[_0x677f('0x2d')]=_[_0x677f('0x2e')](db[_0x677f('0x4f')][_0x677f('0x44')]);_0x4829a5[_0x677f('0x2f')]=_['keys'](_0x30dd8b[_0x677f('0x2f')]);_0x4829a5['filters']=_['intersection'](_0x4829a5['model'],_0x4829a5['query']);_0xf8b21f[_0x677f('0x32')]=_[_0x677f('0x31')](_0x4829a5[_0x677f('0x2d')],qs['fields'](_0x30dd8b[_0x677f('0x2f')][_0x677f('0x45')]));_0xf8b21f[_0x677f('0x32')]=_0xf8b21f[_0x677f('0x32')][_0x677f('0x33')]?_0xf8b21f[_0x677f('0x32')]:_0x4829a5[_0x677f('0x2d')];_0xf8b21f['order']=qs['sort'](_0x30dd8b[_0x677f('0x2f')]['sort']);_0xf8b21f[_0x677f('0x38')]=qs['filters'](_['pick'](_0x30dd8b[_0x677f('0x2f')],_0x4829a5[_0x677f('0x30')]));if(_0x30dd8b[_0x677f('0x2f')][_0x677f('0x3a')]){_0xf8b21f[_0x677f('0x38')]=_[_0x677f('0x3b')](_0xf8b21f[_0x677f('0x38')],{'$or':_[_0x677f('0x54')](_0xf8b21f[_0x677f('0x32')],function(_0x5d86f4){var _0x5118e5={};_0x5118e5[_0x5d86f4]={'$like':'%'+_0x30dd8b[_0x677f('0x2f')][_0x677f('0x3a')]+'%'};return _0x5118e5;})});}_0xf8b21f=_[_0x677f('0x3b')]({},_0xf8b21f,_0x30dd8b['options']);return _0x1f2583[_0x677f('0x52')](_0xf8b21f);}})[_0x677f('0x21')](function(_0xda6928){if(_0xda6928){_0x528ff4=_0xda6928['length'];if(!_0x30dd8b['query'][_0x677f('0x34')](_0x677f('0x35'))){_0xf8b21f[_0x677f('0x1a')]=qs[_0x677f('0x1a')](_0x30dd8b[_0x677f('0x2f')][_0x677f('0x1a')]);_0xf8b21f[_0x677f('0x18')]=qs[_0x677f('0x18')](_0x30dd8b['query']['offset']);}return _0x1f2583[_0x677f('0x52')](_0xf8b21f);}})[_0x677f('0x21')](function(_0x3fbf88){if(_0x3fbf88){return _0x3fbf88?{'count':_0x528ff4,'rows':_0x3fbf88}:null;}})[_0x677f('0x21')](respondWithResult(_0x1d101c,null))[_0x677f('0x41')](handleError(_0x1d101c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index bc27970..1014b95 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 _0xa095=['exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x363dee,_0x4d1a44){var _0x31ae44=function(_0x1a3727){while(--_0x1a3727){_0x363dee['push'](_0x363dee['shift']());}};_0x31ae44(++_0x4d1a44);}(_0xa095,0x156));var _0x5a09=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xa095[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x5a09('0x0'));var util=require('util');var logger=require(_0x5a09('0x1'))(_0x5a09('0x2'));var moment=require('moment');var BPromise=require(_0x5a09('0x3'));var rp=require(_0x5a09('0x4'));var fs=require('fs');var path=require(_0x5a09('0x5'));var rimraf=require(_0x5a09('0x6'));var config=require(_0x5a09('0x7'));var attributes=require(_0x5a09('0x8'));module[_0x5a09('0x9')]=function(_0xc61001,_0x32ff8d){return _0xc61001[_0x5a09('0xa')](_0x5a09('0xb'),attributes,{'tableName':_0x5a09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f5=['api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','util','../../config/logger'];(function(_0x1ca22a,_0x43a262){var _0x2796a3=function(_0x55715b){while(--_0x55715b){_0x1ca22a['push'](_0x1ca22a['shift']());}};_0x2796a3(++_0x43a262);}(_0xe9f5,0xfb));var _0x5e9f=function(_0x1a0103,_0x490f01){_0x1a0103=_0x1a0103-0x0;var _0xc94434=_0xe9f5[_0x1a0103];return _0xc94434;};'use strict';var _=require('lodash');var util=require(_0x5e9f('0x0'));var logger=require(_0x5e9f('0x1'))(_0x5e9f('0x2'));var moment=require(_0x5e9f('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e9f('0x4'));var fs=require('fs');var path=require(_0x5e9f('0x5'));var rimraf=require('rimraf');var config=require(_0x5e9f('0x6'));var attributes=require(_0x5e9f('0x7'));module[_0x5e9f('0x8')]=function(_0x1e4dce,_0x5287d2){return _0x1e4dce[_0x5e9f('0x9')]('CmCompany',attributes,{'tableName':_0x5e9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 13c5b85..bc96ffe 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 _0xdefd=['error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x398e92,_0x4049db){var _0x126e5f=function(_0x4a7af8){while(--_0x4a7af8){_0x398e92['push'](_0x398e92['shift']());}};_0x126e5f(++_0x4049db);}(_0xdefd,0xd7));var _0xddef=function(_0x92346e,_0x2125cb){_0x92346e=_0x92346e-0x0;var _0x349128=_0xdefd[_0x92346e];return _0x349128;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xddef('0x0'));var BPromise=require(_0xddef('0x1'));var rs=require(_0xddef('0x2'));var fs=require('fs');var Redis=require(_0xddef('0x3'));var db=require(_0xddef('0x4'))['db'];var utils=require(_0xddef('0x5'));var logger=require('../../config/logger')(_0xddef('0x6'));var config=require('../../config/environment');var jayson=require(_0xddef('0x7'));var client=jayson['client'][_0xddef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x711daa,_0x5ba73a,_0x5641a3){return new BPromise(function(_0x5a4677,_0x462638){return client[_0xddef('0x9')](_0x711daa,_0x5641a3)[_0xddef('0xa')](function(_0x26aca5){logger[_0xddef('0xb')](_0xddef('0xc'),_0x5ba73a,'request\x20sent');logger[_0xddef('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5ba73a,_0xddef('0xe'),JSON[_0xddef('0xf')](_0x26aca5));if(_0x26aca5['error']){if(_0x26aca5[_0xddef('0x10')][_0xddef('0x11')]===0x1f4){logger[_0xddef('0x10')]('CmCompany,\x20%s,\x20%s',_0x5ba73a,_0x26aca5[_0xddef('0x10')][_0xddef('0x12')]);return _0x462638(_0x26aca5[_0xddef('0x10')][_0xddef('0x12')]);}logger['error'](_0xddef('0xc'),_0x5ba73a,_0x26aca5[_0xddef('0x10')]['message']);return _0x5a4677(_0x26aca5[_0xddef('0x10')][_0xddef('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x5ba73a,_0xddef('0xe'));_0x5a4677(_0x26aca5[_0xddef('0x13')][_0xddef('0x12')]);}})[_0xddef('0x14')](function(_0x1891c5){logger[_0xddef('0x10')](_0xddef('0xc'),_0x5ba73a,_0x1891c5);_0x462638(_0x1891c5);});});} \ No newline at end of file +var _0x4f47=['then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request'];(function(_0x3766e0,_0x3203fa){var _0x28f495=function(_0x23833c){while(--_0x23833c){_0x3766e0['push'](_0x3766e0['shift']());}};_0x28f495(++_0x3203fa);}(_0x4f47,0x8f));var _0x74f4=function(_0x16b966,_0x112731){_0x16b966=_0x16b966-0x0;var _0x446bfb=_0x4f47[_0x16b966];return _0x446bfb;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var moment=require(_0x74f4('0x2'));var BPromise=require(_0x74f4('0x3'));var rs=require(_0x74f4('0x4'));var fs=require('fs');var Redis=require(_0x74f4('0x5'));var db=require(_0x74f4('0x6'))['db'];var utils=require(_0x74f4('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x74f4('0x8'));var client=jayson[_0x74f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c06f0,_0xf17f63,_0xea9fa9){return new BPromise(function(_0x55d610,_0x28f1c4){return client[_0x74f4('0xa')](_0x2c06f0,_0xea9fa9)[_0x74f4('0xb')](function(_0x283619){logger[_0x74f4('0xc')](_0x74f4('0xd'),_0xf17f63,'request\x20sent');logger[_0x74f4('0xe')](_0x74f4('0xf'),_0xf17f63,_0x74f4('0x10'),JSON[_0x74f4('0x11')](_0x283619));if(_0x283619['error']){if(_0x283619[_0x74f4('0x12')][_0x74f4('0x13')]===0x1f4){logger[_0x74f4('0x12')]('CmCompany,\x20%s,\x20%s',_0xf17f63,_0x283619['error'][_0x74f4('0x14')]);return _0x28f1c4(_0x283619[_0x74f4('0x12')]['message']);}logger['error'](_0x74f4('0xd'),_0xf17f63,_0x283619[_0x74f4('0x12')]['message']);return _0x55d610(_0x283619[_0x74f4('0x12')][_0x74f4('0x14')]);}else{logger[_0x74f4('0xc')](_0x74f4('0xd'),_0xf17f63,'request\x20sent');_0x55d610(_0x283619['result'][_0x74f4('0x14')]);}})[_0x74f4('0x15')](function(_0x5de7d4){logger[_0x74f4('0x12')](_0x74f4('0xd'),_0xf17f63,_0x5de7d4);_0x28f1c4(_0x5de7d4);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5191684..68b8ff1 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 _0xf23b=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','addContacts'];(function(_0x40b4fc,_0x22fed5){var _0x50d9a7=function(_0x5f42b4){while(--_0x5f42b4){_0x40b4fc['push'](_0x40b4fc['shift']());}};_0x50d9a7(++_0x22fed5);}(_0xf23b,0xd4));var _0xbf23=function(_0x753fcc,_0x2a73cc){_0x753fcc=_0x753fcc-0x0;var _0x2779b0=_0xf23b[_0x753fcc];return _0x2779b0;};'use strict';var multer=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var path=require(_0xbf23('0x2'));var timeout=require(_0xbf23('0x3'));var express=require(_0xbf23('0x4'));var router=express[_0xbf23('0x5')]();var fs_extra=require(_0xbf23('0x6'));var auth=require(_0xbf23('0x7'));var interaction=require(_0xbf23('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0xbf23('0x9')](),controller[_0xbf23('0xa')]);router[_0xbf23('0xb')](_0xbf23('0xc'),auth[_0xbf23('0x9')](),controller[_0xbf23('0xd')]);router['get'](_0xbf23('0xe'),auth[_0xbf23('0x9')](),controller[_0xbf23('0xf')]);router[_0xbf23('0xb')](_0xbf23('0x10'),auth['isAuthenticated'](),controller[_0xbf23('0x11')]);router['post']('/',auth[_0xbf23('0x9')](),controller['create']);router['post']('/:id/contacts',auth[_0xbf23('0x9')](),controller[_0xbf23('0x12')]);router['put']('/:id',auth[_0xbf23('0x9')](),controller[_0xbf23('0x13')]);router['delete'](_0xbf23('0xe'),auth[_0xbf23('0x9')](),controller['destroy']);module[_0xbf23('0x14')]=router; \ No newline at end of file +var _0x5002=['post','addContacts','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/:id','show','/:id/contacts','getContacts'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5002,0xad));var _0x2500=function(_0x4f6f04,_0x59c6ba){_0x4f6f04=_0x4f6f04-0x0;var _0x606b2c=_0x5002[_0x4f6f04];return _0x606b2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2500('0x0'));var timeout=require(_0x2500('0x1'));var express=require(_0x2500('0x2'));var router=express[_0x2500('0x3')]();var fs_extra=require(_0x2500('0x4'));var auth=require(_0x2500('0x5'));var interaction=require(_0x2500('0x6'));var config=require(_0x2500('0x7'));var controller=require(_0x2500('0x8'));router['get']('/',auth[_0x2500('0x9')](),controller[_0x2500('0xa')]);router[_0x2500('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2500('0xb')](_0x2500('0xc'),auth[_0x2500('0x9')](),controller[_0x2500('0xd')]);router[_0x2500('0xb')](_0x2500('0xe'),auth[_0x2500('0x9')](),controller[_0x2500('0xf')]);router['post']('/',auth[_0x2500('0x9')](),controller['create']);router[_0x2500('0x10')](_0x2500('0xe'),auth[_0x2500('0x9')](),controller[_0x2500('0x11')]);router['put'](_0x2500('0xc'),auth[_0x2500('0x9')](),controller[_0x2500('0x12')]);router[_0x2500('0x13')](_0x2500('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2500('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7400ea1..422f9f9 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 _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x3226d0,_0x377932){var _0x55ccbe=function(_0x2e0053){while(--_0x2e0053){_0x3226d0['push'](_0x3226d0['shift']());}};_0x55ccbe(++_0x377932);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a0e46,_0x510f37){_0x1a0e46=_0x1a0e46-0x0;var _0x5dee50=_0x5f2f[_0x1a0e46];return _0x5dee50;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0xb7e7=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7b7e('0x0'));var Sequelize=require('sequelize');module[_0x7b7e('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x7b7e('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7b7e('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7b7e('0x2')]},'dateOfBirth':{'type':Sequelize[_0x7b7e('0x2')]},'description':{'type':Sequelize[_0x7b7e('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7b7e('0x2')]},'email':{'type':Sequelize[_0x7b7e('0x2')]},'url':{'type':Sequelize[_0x7b7e('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7b7e('0x2')]},'twitter':{'type':Sequelize[_0x7b7e('0x2')]},'skype':{'type':Sequelize[_0x7b7e('0x2')]},'teams':{'type':Sequelize[_0x7b7e('0x2')]},'viber':{'type':Sequelize[_0x7b7e('0x2')]},'line':{'type':Sequelize[_0x7b7e('0x2')]},'wechat':{'type':Sequelize[_0x7b7e('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x7b7e('0x4')]},'priority':{'type':Sequelize[_0x7b7e('0x4')](0x2)[_0x7b7e('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7b7e('0x6')],'defaultValue':Sequelize[_0x7b7e('0x7')]},'dialTimezone':{'type':Sequelize[_0x7b7e('0x2')]},'utcOffset':{'type':Sequelize[_0x7b7e('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1419b98..20de9b9 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 _0x01f6=['describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','left_join','cm_user_has_contacts','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','buildExpression','type','filter','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','c.id','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','role','agent','sequelize','merge','c.firstName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','toString','Tags','rows','catch','CmContact','params','tags','columnName','displayName','analytics','findAll','values','body','get','mergeWith','join','info','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','show','$and','omit','format','cf_%d','pickBy','table','toParam','text','phone','getTags','rawAttributes','options','setTags','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','meta','binding','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','sms','fax','whatsapp','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','startCase','Website','Account','closed','closedAt','disposition','key','Owner','DESC','chat','browserName','customerPort','ratingType','ratingValue','referer','subject','openchannel','sortBy','util','path','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment/shared','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x01f6,0xea));var _0x601f=function(_0x511dd6,_0x5d294d){_0x511dd6=_0x511dd6-0x0;var _0x39f16b=_0x01f6[_0x511dd6];return _0x39f16b;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x601f('0x0'));var path=require(_0x601f('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x601f('0x2'));var Papa=require(_0x601f('0x3'));var Redis=require(_0x601f('0x4'));var qs=require(_0x601f('0x5'));var as=require(_0x601f('0x6'));var logger=require('../../config/logger')(_0x601f('0x7'));var config=require('../../config/environment');var shared=require(_0x601f('0x8'));var db=require('../../mysqldb')['db'];config[_0x601f('0x9')]=_['defaults'](config[_0x601f('0x9')],{'host':_0x601f('0xa'),'port':0x18eb});var socket=require(_0x601f('0xb'))(new Redis(config[_0x601f('0x9')]));require(_0x601f('0xc'))[_0x601f('0xd')](socket);function respondWithResult(_0x4e7809,_0x585599){_0x585599=_0x585599||0xc8;return function(_0x5afe11){if(_0x5afe11){return _0x4e7809['status'](_0x585599)[_0x601f('0xe')](_0x5afe11);}};}function respondWithFilteredResult(_0x398a09,_0x4b7b06){return function(_0x183b91){if(_0x183b91){var _0x11231a=typeof _0x4b7b06[_0x601f('0xf')]===_0x601f('0x10')&&typeof _0x4b7b06[_0x601f('0x11')]==='undefined';var _0x43fb21=_0x183b91[_0x601f('0x12')];var _0x19b400=_0x11231a?0x0:_0x4b7b06[_0x601f('0xf')];var _0x2dd922=_0x11231a?_0x183b91[_0x601f('0x12')]:_0x4b7b06['offset']+_0x4b7b06['limit'];var _0x311332;if(_0x2dd922>=_0x43fb21){_0x2dd922=_0x43fb21;_0x311332=0xc8;}else{_0x311332=0xce;}_0x398a09[_0x601f('0x13')](_0x311332);return _0x398a09[_0x601f('0x14')](_0x601f('0x15'),_0x19b400+'-'+_0x2dd922+'/'+_0x43fb21)[_0x601f('0xe')](_0x183b91);}return null;};}function saveUpdates(_0x32d6f4){return function(_0x44fdf9){if(_0x44fdf9){return _0x44fdf9[_0x601f('0x16')](_0x32d6f4)[_0x601f('0x17')](function(_0x535eae){return _0x535eae;});}return null;};}function removeEntity(_0x53fa67){return function(_0x1e2c46){if(_0x1e2c46){return _0x1e2c46[_0x601f('0x18')]()[_0x601f('0x17')](function(){_0x53fa67[_0x601f('0x13')](0xcc)[_0x601f('0x19')]();});}};}function handleEntityNotFound(_0x16740b){return function(_0x14bc8b){if(!_0x14bc8b){_0x16740b[_0x601f('0x1a')](0x194);}return _0x14bc8b;};}function handleError(_0x536bab,_0xbdb75f){_0xbdb75f=_0xbdb75f||0x1f4;return function(_0xaf88cc){logger['error'](_0xaf88cc[_0x601f('0x1b')]);if(_0xaf88cc[_0x601f('0x1c')]){delete _0xaf88cc[_0x601f('0x1c')];}_0x536bab['status'](_0xbdb75f)[_0x601f('0x1d')](_0xaf88cc);};}exports[_0x601f('0x1e')]=function(_0x4c2ace,_0x51bae5){var _0x1596a5={},_0x5533ce={},_0x1a954f={'count':0x0,'rows':[]};return db['CmContact'][_0x601f('0x1f')]()[_0x601f('0x17')](function(_0x11e1f5){var _0x15fbcb=[];for(var _0x4faeac=0x0;_0x4faeac0x1){_0x25da4f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x601f('0x5f')](_0x39a4af),null);}else{if(qs[_0x601f('0x60')](_0x39a4af)){_0x25da4f['or'](_0x601f('0x61'),_0x39a4af+'%');_0x25da4f['or'](_0x601f('0x62'),_0x39a4af+'%');_0x25da4f['or'](_0x601f('0x63'),_0x39a4af+'%');_0x25da4f['or'](_0x601f('0x64'),_0x39a4af+'%');}else if(qs[_0x601f('0x65')](_0x39a4af)){_0x25da4f['or'](_0x601f('0x66'),_0x39a4af+'%');}else{_0x25da4f['or']('c.firstName\x20LIKE\x20?','%'+_0x39a4af+'%');_0x25da4f['or'](_0x601f('0x67'),'%'+_0x39a4af+'%');_0x25da4f['or'](_0x601f('0x66'),'%'+_0x39a4af+'%');}}}}_0x32e19f[_0x601f('0x34')](_0x25da4f);_0x32e19f[_0x601f('0x68')]('c.id');var _0x56e5ad={'type':db[_0x601f('0x69')][_0x601f('0x6a')][_0x601f('0x6b')],'raw':!![]};var _0x36f255=_0x32e19f[_0x601f('0x6c')]()[_0x601f('0x37')](_0x601f('0x6d'));if(_0x1596a5[_0x601f('0x32')]){_0x1596a5[_0x601f('0x32')]['forEach'](function(_0x47610e){_0x32e19f['order']('c.'+_0x47610e[0x0],_0x47610e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x601f('0x57')](_0x484f83)){_0x32e19f['having'](_0x2137ae);_0x36f255[_0x601f('0x34')](_0x601f('0x6e'),_0x484f83);}BPromise[_0x601f('0x6f')]()[_0x601f('0x17')](function(){if(!_0x2eba37)return;if(_0x4c2ace[_0x601f('0x70')]['role']!=='agent')return;if(!_['some'](_0x2eba37['conditions'],['field',_0x601f('0x4c')])){return _0x4c2ace[_0x601f('0x70')][_0x601f('0x71')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c61f7){if(_[_0x601f('0x57')](_0x5c61f7)){_0x36f255[_0x601f('0x34')](_0x601f('0x72'));_0x32e19f[_0x601f('0x34')](_0x601f('0x72'));}else{_0x36f255[_0x601f('0x34')](_0x601f('0x59'),_[_0x601f('0x48')](_0x5c61f7,'id'));_0x32e19f[_0x601f('0x34')](_0x601f('0x59'),_[_0x601f('0x48')](_0x5c61f7,'id'));}});}})['then'](function(){if(_0x4c2ace[_0x601f('0x70')][_0x601f('0x73')]===_0x601f('0x74')&&!_0x2eba37&&!_0x4c2ace[_0x601f('0x2a')][_0x601f('0x58')])return[];return db['sequelize'][_0x601f('0x2a')](_0x36f255['toString'](),_0x56e5ad);})[_0x601f('0x17')](function(_0x49122d){_0x1a954f[_0x601f('0x12')]=_0x49122d['length'];if(_0x1a954f[_0x601f('0x12')]===0x0)return[];return db[_0x601f('0x75')]['query'](_0x907e17['toString'](),_0x56e5ad)[_0x601f('0x17')](function(_0x234324){_0x27fbb7=_['keyBy'](_0x234324,'id');_0x56e5ad=_[_0x601f('0x76')](_0x56e5ad,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c2ace[_0x601f('0x2a')][_0x601f('0x2f')]){_0x1596a5['attributes'][_0x601f('0x49')](function(_0x35144b){_0x32e19f['field']('c.'+_0x35144b);});}else{_0x32e19f[_0x601f('0x37')]('c.id');_0x32e19f[_0x601f('0x37')](_0x601f('0x77'));_0x32e19f[_0x601f('0x37')]('c.lastName');_0x32e19f[_0x601f('0x37')](_0x601f('0x78'));_0x32e19f['field'](_0x601f('0x79'));_0x32e19f[_0x601f('0x37')](_0x601f('0x7a'));_0x32e19f['field']('c.email');_0x32e19f[_0x601f('0x37')](_0x601f('0x7b'));_0x32e19f[_0x601f('0x37')](_0x601f('0x7c'));_0x32e19f[_0x601f('0x37')](_0x601f('0x7d'));_0x32e19f[_0x601f('0x37')](_0x601f('0x7e'));_0x32e19f[_0x601f('0x37')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x601f('0x7f'));}if(_0x1596a5[_0x601f('0x11')])_0x32e19f[_0x601f('0x11')](_0x1596a5[_0x601f('0x11')]);if(_0x1596a5[_0x601f('0xf')])_0x32e19f['offset'](_0x1596a5[_0x601f('0xf')]);return db['sequelize'][_0x601f('0x2a')](_0x32e19f[_0x601f('0x80')](),_0x56e5ad);});})[_0x601f('0x17')](function(_0x8fd49a){_0x8fd49a[_0x601f('0x49')](function(_0x34d894){if(_0x34d894['TagIds']){_0x34d894[_0x601f('0x81')]=[];_0x34d894[_0x601f('0x7f')][_0x601f('0x47')](',')[_0x601f('0x49')](function(_0x15d2d7){_0x34d894[_0x601f('0x81')][_0x601f('0x23')](_0x27fbb7[_0x15d2d7]);});}delete _0x34d894[_0x601f('0x7f')];});_0x1a954f[_0x601f('0x82')]=_0x8fd49a;return _0x1a954f;})[_0x601f('0x17')](respondWithFilteredResult(_0x51bae5,_0x1596a5));})[_0x601f('0x83')](handleError(_0x51bae5,null));};exports[_0x601f('0x18')]=function(_0x61b1b7,_0x176c65){return db[_0x601f('0x84')][_0x601f('0x45')]({'where':{'id':_0x61b1b7[_0x601f('0x85')]['id']}})[_0x601f('0x17')](handleEntityNotFound(_0x176c65,null))[_0x601f('0x17')](removeEntity(_0x176c65,null))['catch'](handleError(_0x176c65,null));};exports[_0x601f('0x1f')]=function(_0x19fe4d,_0x114488){return db[_0x601f('0x84')]['describe']()[_0x601f('0x17')](function(_0x20f6ed){delete _0x20f6ed[_0x601f('0x86')];for(var _0x538777=0x0;_0x538777=_0x1563bc){_0x208e25=_0x1563bc;_0x7c701c=0xc8;}else{_0x7c701c=0xce;}_0x5a8af7[_0x86e4('0x11')](_0x7c701c);return _0x5a8af7['set'](_0x86e4('0x17'),_0x56d89d+'-'+_0x208e25+'/'+_0x1563bc)[_0x86e4('0x12')](_0x2f3d20);}return null;};}function saveUpdates(_0x357875){return function(_0x3554f1){if(_0x3554f1){return _0x3554f1[_0x86e4('0x18')](_0x357875)[_0x86e4('0x19')](function(_0x1b5072){return _0x1b5072;});}return null;};}function removeEntity(_0x32d34e){return function(_0x2a6012){if(_0x2a6012){return _0x2a6012[_0x86e4('0x1a')]()[_0x86e4('0x19')](function(){_0x32d34e[_0x86e4('0x11')](0xcc)[_0x86e4('0x1b')]();});}};}function handleEntityNotFound(_0x33795c){return function(_0x459f8d){if(!_0x459f8d){_0x33795c[_0x86e4('0x1c')](0x194);}return _0x459f8d;};}function handleError(_0x53d6cc,_0x3c0e1b){_0x3c0e1b=_0x3c0e1b||0x1f4;return function(_0x312298){logger[_0x86e4('0x1d')](_0x312298[_0x86e4('0x1e')]);if(_0x312298[_0x86e4('0x1f')]){delete _0x312298[_0x86e4('0x1f')];}_0x53d6cc[_0x86e4('0x11')](_0x3c0e1b)[_0x86e4('0x20')](_0x312298);};}exports[_0x86e4('0x21')]=function(_0x41f71d,_0x3c832b){var _0x2defdd={},_0x2d1870={},_0x4c8473={'count':0x0,'rows':[]};return db[_0x86e4('0x22')][_0x86e4('0x23')]()[_0x86e4('0x19')](function(_0x2e8d82){var _0x52d864=[];for(var _0x471486=0x0;_0x4714860x1){_0x4c8dc5['or'](_0x86e4('0x60'),qs['getFullTextValue'](_0x3958a5),null);}else{if(qs['isNumeric'](_0x3958a5)){_0x4c8dc5['or'](_0x86e4('0x61'),_0x3958a5+'%');_0x4c8dc5['or'](_0x86e4('0x62'),_0x3958a5+'%');_0x4c8dc5['or']('c.mobile\x20LIKE\x20?',_0x3958a5+'%');_0x4c8dc5['or']('c.fax\x20LIKE\x20?',_0x3958a5+'%');}else if(qs[_0x86e4('0x63')](_0x3958a5)){_0x4c8dc5['or'](_0x86e4('0x64'),_0x3958a5+'%');}else{_0x4c8dc5['or']('c.firstName\x20LIKE\x20?','%'+_0x3958a5+'%');_0x4c8dc5['or'](_0x86e4('0x65'),'%'+_0x3958a5+'%');_0x4c8dc5['or']('c.email\x20LIKE\x20?','%'+_0x3958a5+'%');}}}}_0x268e3f[_0x86e4('0x36')](_0x4c8dc5);_0x268e3f[_0x86e4('0x66')](_0x86e4('0x67'));var _0x4b3d03={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x379216=_0x268e3f[_0x86e4('0x68')]()[_0x86e4('0x38')](_0x86e4('0x67'));if(_0x2defdd[_0x86e4('0x69')]){_0x2defdd['order']['forEach'](function(_0x5210c8){_0x268e3f[_0x86e4('0x69')]('c.'+_0x5210c8[0x0],_0x5210c8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x86e4('0x5a')](_0x5b741d)){_0x268e3f[_0x86e4('0x6a')](_0x6056d0);_0x379216[_0x86e4('0x36')](_0x86e4('0x6b'),_0x5b741d);}BPromise[_0x86e4('0x6c')]()[_0x86e4('0x19')](function(){if(!_0xb93c24)return;if(_0x41f71d[_0x86e4('0x6d')][_0x86e4('0x6e')]!=='agent')return;if(!_['some'](_0xb93c24[_0x86e4('0x46')],['field',_0x86e4('0x4c')])){return _0x41f71d[_0x86e4('0x6d')][_0x86e4('0x6f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4fd394){if(_[_0x86e4('0x5a')](_0x4fd394)){_0x379216['where'](_0x86e4('0x70'));_0x268e3f[_0x86e4('0x36')]('c.ListId\x20IS\x20NULL');}else{_0x379216[_0x86e4('0x36')](_0x86e4('0x5b'),_[_0x86e4('0x55')](_0x4fd394,'id'));_0x268e3f[_0x86e4('0x36')]('c.ListId\x20IN\x20?',_[_0x86e4('0x55')](_0x4fd394,'id'));}});}})[_0x86e4('0x19')](function(){if(_0x41f71d['user'][_0x86e4('0x6e')]===_0x86e4('0x71')&&!_0xb93c24&&!_0x41f71d[_0x86e4('0x2e')][_0x86e4('0x72')])return[];return db[_0x86e4('0x73')][_0x86e4('0x2e')](_0x379216[_0x86e4('0x74')](),_0x4b3d03);})[_0x86e4('0x19')](function(_0x2c447b){_0x4c8473[_0x86e4('0x15')]=_0x2c447b[_0x86e4('0x24')];if(_0x4c8473[_0x86e4('0x15')]===0x0)return[];return db['sequelize']['query'](_0x55417a[_0x86e4('0x74')](),_0x4b3d03)['then'](function(_0x18ff1e){_0x473206=_[_0x86e4('0x75')](_0x18ff1e,'id');_0x4b3d03=_[_0x86e4('0x76')](_0x4b3d03,{'model':db[_0x86e4('0x22')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41f71d[_0x86e4('0x2e')][_0x86e4('0x32')]){_0x2defdd[_0x86e4('0x31')][_0x86e4('0x49')](function(_0x10aa12){_0x268e3f[_0x86e4('0x38')]('c.'+_0x10aa12);});}else{_0x268e3f[_0x86e4('0x38')](_0x86e4('0x67'));_0x268e3f['field'](_0x86e4('0x77'));_0x268e3f[_0x86e4('0x38')](_0x86e4('0x78'));_0x268e3f[_0x86e4('0x38')](_0x86e4('0x79'));_0x268e3f[_0x86e4('0x38')](_0x86e4('0x7a'));_0x268e3f['field']('c.fax');_0x268e3f[_0x86e4('0x38')](_0x86e4('0x7b'));_0x268e3f['field']('c.ListId');_0x268e3f[_0x86e4('0x38')](_0x86e4('0x7c'));_0x268e3f['field']('c.deletedAt');_0x268e3f[_0x86e4('0x38')](_0x86e4('0x7d'));_0x268e3f[_0x86e4('0x38')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x86e4('0x7e'));}if(_0x2defdd[_0x86e4('0x14')])_0x268e3f[_0x86e4('0x14')](_0x2defdd['limit']);if(_0x2defdd[_0x86e4('0x16')])_0x268e3f[_0x86e4('0x16')](_0x2defdd[_0x86e4('0x16')]);return db[_0x86e4('0x73')][_0x86e4('0x2e')](_0x268e3f[_0x86e4('0x74')](),_0x4b3d03);});})[_0x86e4('0x19')](function(_0x3f00f8){_0x3f00f8['forEach'](function(_0x47bc42){if(_0x47bc42[_0x86e4('0x7e')]){_0x47bc42[_0x86e4('0x7f')]=[];_0x47bc42[_0x86e4('0x7e')][_0x86e4('0x48')](',')['forEach'](function(_0x4e7fc7){_0x47bc42[_0x86e4('0x7f')][_0x86e4('0x59')](_0x473206[_0x4e7fc7]);});}delete _0x47bc42[_0x86e4('0x7e')];});_0x4c8473[_0x86e4('0x80')]=_0x3f00f8;return _0x4c8473;})[_0x86e4('0x19')](respondWithFilteredResult(_0x3c832b,_0x2defdd));})[_0x86e4('0x81')](handleError(_0x3c832b,null));};exports[_0x86e4('0x1a')]=function(_0x3a522f,_0x295ede){return db[_0x86e4('0x22')]['find']({'where':{'id':_0x3a522f[_0x86e4('0x82')]['id']}})[_0x86e4('0x19')](handleEntityNotFound(_0x295ede,null))[_0x86e4('0x19')](removeEntity(_0x295ede,null))[_0x86e4('0x81')](handleError(_0x295ede,null));};exports[_0x86e4('0x23')]=function(_0x39c674,_0x506436){return db[_0x86e4('0x22')][_0x86e4('0x23')]()['then'](function(_0xd817d0){delete _0xd817d0[_0x86e4('0x83')];for(var _0x55b0f4=0x0;_0x55b0f4{}\s\\|]/g,'-');_0x88708f(null,util[_0xe999('0x21')](_0xe999('0x22'),path[_0xe999('0x23')](_0x487ee8[_0xe999('0x20')],path[_0xe999('0x24')](_0x487ee8[_0xe999('0x20')])),Date[_0xe999('0x25')](),path[_0xe999('0x24')](_0x487ee8[_0xe999('0x20')])));}})});router[_0xe999('0x19')](_0xe999('0x26'),upload[_0xe999('0x27')](_0xe999('0x28')),controller[_0xe999('0x29')]);var upload=multer({'storage':multer[_0xe999('0x2a')]({'destination':function(_0x5cc210,_0x44b653,_0x4a1187){_0x4a1187(null,path[_0xe999('0x2b')](config['root'],_0xe999('0x1f')));},'filename':function(_0x3ab90f,_0x2f29c3,_0x165ef6){_0x2f29c3[_0xe999('0x20')]=_0x2f29c3[_0xe999('0x20')][_0xe999('0x2c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x165ef6(null,util[_0xe999('0x21')](_0xe999('0x22'),path[_0xe999('0x23')](_0x2f29c3[_0xe999('0x20')],path['extname'](_0x2f29c3[_0xe999('0x20')])),Date[_0xe999('0x25')](),path[_0xe999('0x24')](_0x2f29c3[_0xe999('0x20')])));}})});router[_0xe999('0x19')](_0xe999('0x2d'),upload[_0xe999('0x27')](_0xe999('0x28')),controller[_0xe999('0x2e')]);router[_0xe999('0x19')](_0xe999('0x2f'),auth[_0xe999('0x8')](),controller[_0xe999('0x30')]);router[_0xe999('0x31')](_0xe999('0x32'),auth[_0xe999('0x8')](),controller[_0xe999('0x33')]);router['delete'](_0xe999('0x32'),auth[_0xe999('0x8')](),controller[_0xe999('0x34')]);module['exports']=router; \ No newline at end of file +var _0x97a2=['/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','%s-%s%s','basename','extname','/csv','file','replace','format','now','/upload','single','upload','import','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1c5ec5,_0x380beb){var _0x533194=function(_0x406a78){while(--_0x406a78){_0x1c5ec5['push'](_0x1c5ec5['shift']());}};_0x533194(++_0x380beb);}(_0x97a2,0xcc));var _0x297a=function(_0x16c17e,_0xf8f9aa){_0x16c17e=_0x16c17e-0x0;var _0x584a9e=_0x97a2[_0x16c17e];return _0x584a9e;};'use strict';var multer=require(_0x297a('0x0'));var util=require(_0x297a('0x1'));var path=require(_0x297a('0x2'));var timeout=require(_0x297a('0x3'));var express=require(_0x297a('0x4'));var router=express[_0x297a('0x5')]();var fs_extra=require(_0x297a('0x6'));var auth=require(_0x297a('0x7'));var interaction=require(_0x297a('0x8'));var config=require(_0x297a('0x9'));var controller=require(_0x297a('0xa'));router[_0x297a('0xb')]('/',auth[_0x297a('0xc')](),controller[_0x297a('0xd')]);router[_0x297a('0xb')](_0x297a('0xe'),auth[_0x297a('0xc')](),controller[_0x297a('0xf')]);router[_0x297a('0xb')](_0x297a('0x10'),auth[_0x297a('0xc')](),controller[_0x297a('0x11')]);router[_0x297a('0xb')](_0x297a('0x12'),auth[_0x297a('0xc')](),controller[_0x297a('0x13')]);router['get']('/:id/hoppers',auth[_0x297a('0xc')](),controller[_0x297a('0x14')]);router[_0x297a('0xb')](_0x297a('0x15'),auth[_0x297a('0xc')](),controller[_0x297a('0x16')]);router[_0x297a('0xb')](_0x297a('0x17'),auth[_0x297a('0xc')](),controller[_0x297a('0x18')]);router['get'](_0x297a('0x19'),auth[_0x297a('0xc')](),controller[_0x297a('0x1a')]);router[_0x297a('0xb')](_0x297a('0x1b'),auth[_0x297a('0xc')](),controller[_0x297a('0x1c')]);router[_0x297a('0x1d')](_0x297a('0x1e'),auth['isAuthenticated'](),controller[_0x297a('0x1f')]);router[_0x297a('0x1d')]('/',auth[_0x297a('0xc')](),controller[_0x297a('0x20')]);router[_0x297a('0x1d')](_0x297a('0x21'),auth[_0x297a('0xc')](),controller[_0x297a('0x22')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x297a('0x23')]);var upload=multer({'storage':multer[_0x297a('0x24')]({'destination':function(_0x5024a5,_0x35db23,_0x78cd87){_0x78cd87(null,path[_0x297a('0x25')](config[_0x297a('0x26')],'server/files/tmp'));},'filename':function(_0x306d51,_0x832ca4,_0x1850f0){_0x832ca4['originalname']=_0x832ca4[_0x297a('0x27')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1850f0(null,util['format'](_0x297a('0x28'),path[_0x297a('0x29')](_0x832ca4['originalname'],path[_0x297a('0x2a')](_0x832ca4[_0x297a('0x27')])),Date['now'](),path['extname'](_0x832ca4[_0x297a('0x27')])));}})});router[_0x297a('0x1d')](_0x297a('0x2b'),upload['single'](_0x297a('0x2c')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x297a('0x24')]({'destination':function(_0x2abf52,_0x543271,_0x45fe2f){_0x45fe2f(null,path[_0x297a('0x25')](config['root'],'server/files/tmp'));},'filename':function(_0x1c7256,_0x480ca0,_0x1f19da){_0x480ca0[_0x297a('0x27')]=_0x480ca0['originalname'][_0x297a('0x2d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f19da(null,util[_0x297a('0x2e')](_0x297a('0x28'),path[_0x297a('0x29')](_0x480ca0[_0x297a('0x27')],path[_0x297a('0x2a')](_0x480ca0['originalname'])),Date[_0x297a('0x2f')](),path[_0x297a('0x2a')](_0x480ca0[_0x297a('0x27')])));}})});router[_0x297a('0x1d')](_0x297a('0x30'),upload[_0x297a('0x31')]('file'),controller[_0x297a('0x32')]);router['post']('/upload/:id',auth[_0x297a('0xc')](),controller[_0x297a('0x33')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x297a('0x34')]);router[_0x297a('0x35')](_0x297a('0x10'),auth[_0x297a('0xc')](),controller['destroy']);module[_0x297a('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index ee0ee20..fd543ee 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 _0xa1ed=['TEXT','long','type','select','parse','values','isArray','stringify','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING'];(function(_0x19c4bd,_0x19a00d){var _0x2fc7b5=function(_0x24fdab){while(--_0x24fdab){_0x19c4bd['push'](_0x19c4bd['shift']());}};_0x2fc7b5(++_0x19a00d);}(_0xa1ed,0x1ac));var _0xda1e=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0xa1ed[_0x1c30bf];return _0x255b5e;};'use strict';var Sequelize=require(_0xda1e('0x0'));var _=require(_0xda1e('0x1'));module[_0xda1e('0x2')]={'name':{'type':Sequelize[_0xda1e('0x3')],'get':function(_0xdd0603){return this[_0xda1e('0x4')](_0xda1e('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x66da9){this[_0xda1e('0x6')](_0xda1e('0x5'),_0x66da9?_0x66da9:this[_0xda1e('0x4')](_0xda1e('0x7')));}},'type':{'type':Sequelize[_0xda1e('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0xda1e('0x9')](_0xda1e('0xa')),'get':function(){if(this[_0xda1e('0x4')](_0xda1e('0xb'))===_0xda1e('0xc')){return JSON[_0xda1e('0xd')](this[_0xda1e('0x4')](_0xda1e('0xe')));}else{return this[_0xda1e('0x4')](_0xda1e('0xe'));}},'set':function(_0x3cdc0f){if(Array[_0xda1e('0xf')](_0x3cdc0f)){this[_0xda1e('0x6')](_0xda1e('0xe'),JSON[_0xda1e('0x10')](_0x3cdc0f));}else{this[_0xda1e('0x6')](_0xda1e('0xe'),_0x3cdc0f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xda1e('0x11')](_0xda1e('0x12'))}}; \ No newline at end of file +var _0x45e4=['alias','STRING','setDataValue','long','select','values','isArray','stringify','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x1c975f,_0x3254f8){var _0x30427b=function(_0x399310){while(--_0x399310){_0x1c975f['push'](_0x1c975f['shift']());}};_0x30427b(++_0x3254f8);}(_0x45e4,0x7e));var _0x445e=function(_0x6f03d8,_0x512b27){_0x6f03d8=_0x6f03d8-0x0;var _0x37bb14=_0x45e4[_0x6f03d8];return _0x37bb14;};'use strict';var Sequelize=require(_0x445e('0x0'));var _=require('lodash');module[_0x445e('0x1')]={'name':{'type':Sequelize[_0x445e('0x2')],'get':function(_0xdeb1eb){return this[_0x445e('0x3')](_0x445e('0x4'));}},'alias':{'type':Sequelize[_0x445e('0x5')],'allowNull':![],'set':function(_0x16c6fe){this[_0x445e('0x6')](_0x445e('0x4'),_0x16c6fe?_0x16c6fe:this[_0x445e('0x3')]('name'));}},'type':{'type':Sequelize[_0x445e('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x445e('0x7')),'get':function(){if(this[_0x445e('0x3')]('type')===_0x445e('0x8')){return JSON['parse'](this[_0x445e('0x3')](_0x445e('0x9')));}else{return this[_0x445e('0x3')](_0x445e('0x9'));}},'set':function(_0x18ea07){if(Array[_0x445e('0xa')](_0x18ea07)){this[_0x445e('0x6')]('values',JSON[_0x445e('0xb')](_0x18ea07));}else{this[_0x445e('0x6')](_0x445e('0x9'),_0x18ea07);}}},'required':{'type':Sequelize[_0x445e('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x445e('0xc')],'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 c449276..2226fc7 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 _0x4960=['save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','catch','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x2d7149,_0x5782a1){var _0x3bd5a1=function(_0x2c0ce0){while(--_0x2c0ce0){_0x2d7149['push'](_0x2d7149['shift']());}};_0x3bd5a1(++_0x5782a1);}(_0x4960,0x1e6));var _0x0496=function(_0x53a179,_0x3f5689){_0x53a179=_0x53a179-0x0;var _0x48f0c9=_0x4960[_0x53a179];return _0x48f0c9;};'use strict';var emlformat=require(_0x0496('0x0'));var rimraf=require(_0x0496('0x1'));var zipdir=require(_0x0496('0x2'));var jsonpatch=require(_0x0496('0x3'));var rp=require('request-promise');var moment=require(_0x0496('0x4'));var BPromise=require(_0x0496('0x5'));var Mustache=require(_0x0496('0x6'));var util=require('util');var path=require(_0x0496('0x7'));var sox=require('sox');var csv=require(_0x0496('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0496('0x9'));var _=require(_0x0496('0xa'));var squel=require('squel');var crypto=require(_0x0496('0xb'));var jsforce=require(_0x0496('0xc'));var deskjs=require(_0x0496('0xd'));var toCsv=require(_0x0496('0x8'));var querystring=require(_0x0496('0xe'));var Papa=require(_0x0496('0xf'));var Redis=require(_0x0496('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0496('0x11'));var as=require(_0x0496('0x12'));var hardwareService=require(_0x0496('0x13'));var logger=require(_0x0496('0x14'))(_0x0496('0x15'));var utils=require(_0x0496('0x16'));var config=require(_0x0496('0x17'));var licenseUtil=require(_0x0496('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x596443,_0x24a6e4){_0x24a6e4=_0x24a6e4||0xcc;return function(_0x58763c){if(_0x58763c){return _0x596443[_0x0496('0x19')](_0x24a6e4);}return _0x596443[_0x0496('0x1a')](_0x24a6e4)[_0x0496('0x1b')]();};}function respondWithResult(_0x486e0f,_0x4e71a6){_0x4e71a6=_0x4e71a6||0xc8;return function(_0x716744){if(_0x716744){return _0x486e0f[_0x0496('0x1a')](_0x4e71a6)[_0x0496('0x1c')](_0x716744);}};}function respondWithFilteredResult(_0x3c0284,_0x5b3ef5){return function(_0x8483e7){if(_0x8483e7){var _0xacd6fb=typeof _0x5b3ef5[_0x0496('0x1d')]===_0x0496('0x1e')&&typeof _0x5b3ef5[_0x0496('0x1f')]===_0x0496('0x1e');var _0x10e671=_0x8483e7[_0x0496('0x20')];var _0x3b0e0a=_0xacd6fb?0x0:_0x5b3ef5[_0x0496('0x1d')];var _0x4e58fb=_0xacd6fb?_0x8483e7[_0x0496('0x20')]:_0x5b3ef5[_0x0496('0x1d')]+_0x5b3ef5[_0x0496('0x1f')];var _0x2c07eb;if(_0x4e58fb>=_0x10e671){_0x4e58fb=_0x10e671;_0x2c07eb=0xc8;}else{_0x2c07eb=0xce;}_0x3c0284[_0x0496('0x1a')](_0x2c07eb);return _0x3c0284[_0x0496('0x21')](_0x0496('0x22'),_0x3b0e0a+'-'+_0x4e58fb+'/'+_0x10e671)[_0x0496('0x1c')](_0x8483e7);}return null;};}function patchUpdates(_0x23314b){return function(_0x212ec4){try{jsonpatch['apply'](_0x212ec4,_0x23314b,!![]);}catch(_0x2bbf52){return BPromise[_0x0496('0x23')](_0x2bbf52);}return _0x212ec4[_0x0496('0x24')]();};}function saveUpdates(_0x21d424,_0x25fa9b){return function(_0x5da286){if(_0x5da286){return _0x5da286[_0x0496('0x25')](_0x21d424)[_0x0496('0x26')](function(_0xf8ed52){return _0xf8ed52;});}return null;};}function removeEntity(_0x2036ac,_0x47af42){return function(_0x319518){if(_0x319518){return _0x319518[_0x0496('0x27')]()[_0x0496('0x26')](function(){_0x2036ac[_0x0496('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3160f5,_0x4c3fc1){return function(_0x196056){if(!_0x196056){_0x3160f5[_0x0496('0x19')](0x194);}return _0x196056;};}function handleError(_0x451237,_0x9e7a43){_0x9e7a43=_0x9e7a43||0x1f4;return function(_0x3e9c21){logger[_0x0496('0x28')](_0x3e9c21[_0x0496('0x29')]);if(_0x3e9c21[_0x0496('0x2a')]){delete _0x3e9c21[_0x0496('0x2a')];}_0x451237[_0x0496('0x1a')](_0x9e7a43)[_0x0496('0x2b')](_0x3e9c21);};}exports[_0x0496('0x2c')]=function(_0x1b4a3c,_0x5943df){var _0x523e98={},_0x5035dd={},_0x4da2e8={'count':0x0,'rows':[]};var _0x56b3eb=_[_0x0496('0x2d')](db[_0x0496('0x2e')]['rawAttributes'],function(_0x3c2e2b){return{'name':_0x3c2e2b[_0x0496('0x2f')],'type':_0x3c2e2b[_0x0496('0x30')][_0x0496('0x31')]};});_0x5035dd[_0x0496('0x32')]=_[_0x0496('0x33')](_[_0x0496('0x2d')](_0x56b3eb,'name'),['name']);_0x5035dd['query']=_['keys'](_0x1b4a3c[_0x0496('0x34')]);_0x5035dd['filters']=_[_0x0496('0x35')](_0x5035dd['model'],_0x5035dd['query']);_0x523e98[_0x0496('0x36')]=_[_0x0496('0x35')](_0x5035dd[_0x0496('0x32')],qs[_0x0496('0x37')](_0x1b4a3c[_0x0496('0x34')][_0x0496('0x37')]));_0x523e98[_0x0496('0x36')]=_0x523e98[_0x0496('0x36')]['length']?_0x523e98[_0x0496('0x36')]:_0x5035dd[_0x0496('0x32')];if(!_0x1b4a3c[_0x0496('0x34')]['hasOwnProperty']('nolimit')){_0x523e98[_0x0496('0x1f')]=qs['limit'](_0x1b4a3c[_0x0496('0x34')][_0x0496('0x1f')]);_0x523e98[_0x0496('0x1d')]=qs[_0x0496('0x1d')](_0x1b4a3c[_0x0496('0x34')][_0x0496('0x1d')]);}_0x523e98[_0x0496('0x38')]=qs[_0x0496('0x39')](_0x1b4a3c[_0x0496('0x34')][_0x0496('0x39')]);_0x523e98[_0x0496('0x3a')]=qs[_0x0496('0x3b')](_[_0x0496('0x3c')](_0x1b4a3c['query'],_0x5035dd[_0x0496('0x3b')]),_0x56b3eb);if(_0x1b4a3c[_0x0496('0x34')][_0x0496('0x3d')]){_0x523e98[_0x0496('0x3a')]=_[_0x0496('0x3e')](_0x523e98[_0x0496('0x3a')],{'$or':_['map'](_0x56b3eb,function(_0x8c6562){if(_0x8c6562[_0x0496('0x30')]!==_0x0496('0x3f')){var _0x3de79b={};_0x3de79b[_0x8c6562[_0x0496('0x2a')]]={'$like':'%'+_0x1b4a3c[_0x0496('0x34')][_0x0496('0x3d')]+'%'};return _0x3de79b;}})});}_0x523e98=_['merge']({},_0x523e98,_0x1b4a3c[_0x0496('0x40')]);var _0x2e4535={'where':_0x523e98[_0x0496('0x3a')]};return db['CmCustomField'][_0x0496('0x20')](_0x2e4535)[_0x0496('0x26')](function(_0x2e804a){_0x4da2e8[_0x0496('0x20')]=_0x2e804a;if(_0x1b4a3c[_0x0496('0x34')][_0x0496('0x41')]){_0x523e98[_0x0496('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x0496('0x43')](_0x523e98);})[_0x0496('0x26')](function(_0x42d6b6){_0x4da2e8[_0x0496('0x44')]=_0x42d6b6;return _0x4da2e8;})[_0x0496('0x26')](respondWithFilteredResult(_0x5943df,_0x523e98))['catch'](handleError(_0x5943df,null));};exports['show']=function(_0x2620cd,_0x4fe217){var _0x565bad={'raw':!![],'where':{'id':_0x2620cd['params']['id']}},_0x15cd83={};_0x15cd83['model']=_['keys'](db[_0x0496('0x2e')][_0x0496('0x45')]);_0x15cd83[_0x0496('0x34')]=_['keys'](_0x2620cd[_0x0496('0x34')]);_0x15cd83['filters']=_[_0x0496('0x35')](_0x15cd83['model'],_0x15cd83[_0x0496('0x34')]);_0x565bad[_0x0496('0x36')]=_['intersection'](_0x15cd83[_0x0496('0x32')],qs[_0x0496('0x37')](_0x2620cd[_0x0496('0x34')][_0x0496('0x37')]));_0x565bad[_0x0496('0x36')]=_0x565bad[_0x0496('0x36')]['length']?_0x565bad['attributes']:_0x15cd83[_0x0496('0x32')];if(_0x2620cd[_0x0496('0x34')][_0x0496('0x41')]){_0x565bad['include']=[{'all':!![]}];}_0x565bad=_[_0x0496('0x3e')]({},_0x565bad,_0x2620cd['options']);return db[_0x0496('0x2e')][_0x0496('0x46')](_0x565bad)[_0x0496('0x26')](handleEntityNotFound(_0x4fe217,null))[_0x0496('0x26')](respondWithResult(_0x4fe217,null))[_0x0496('0x47')](handleError(_0x4fe217,null));};exports['update']=function(_0x3776a1,_0x501fa4){if(_0x3776a1[_0x0496('0x48')]['id']){delete _0x3776a1[_0x0496('0x48')]['id'];}return db[_0x0496('0x2e')]['find']({'where':{'id':_0x3776a1['params']['id']}})[_0x0496('0x26')](handleEntityNotFound(_0x501fa4,null))[_0x0496('0x26')](saveUpdates(_0x3776a1[_0x0496('0x48')],null))['then'](respondWithResult(_0x501fa4,null))[_0x0496('0x47')](handleError(_0x501fa4,null));};exports[_0x0496('0x27')]=function(_0x236fad,_0x4e4f59){return db[_0x0496('0x2e')][_0x0496('0x46')]({'where':{'id':_0x236fad[_0x0496('0x49')]['id']}})[_0x0496('0x26')](handleEntityNotFound(_0x4e4f59,null))[_0x0496('0x26')](removeEntity(_0x4e4f59,null))[_0x0496('0x47')](handleError(_0x4e4f59,null));};exports[_0x0496('0x4a')]=function(_0x5864fe,_0x43f42e){var _0x326a53;return db[_0x0496('0x4b')][_0x0496('0x4c')](function(_0xab6744){return db[_0x0496('0x2e')][_0x0496('0x4a')](_0x5864fe['body'],{'transaction':_0xab6744})['then'](function(_0x2de9b6){_0x326a53=_0x2de9b6;var _0x15a126={'type':db[_0x0496('0x4d')][_0x0496('0x4e')],'transaction':_0xab6744};switch(_0x5864fe[_0x0496('0x48')]['type']){case _0x0496('0x4f'):_0x15a126[_0x0496('0x30')]=db['Sequelize'][_0x0496('0x4e')];break;case _0x0496('0x50'):_0x15a126['type']=db[_0x0496('0x4d')][_0x0496('0x51')];break;case _0x0496('0x52'):_0x15a126[_0x0496('0x30')]=db[_0x0496('0x4d')][_0x0496('0x53')];_0x15a126[_0x0496('0x54')]=![];break;default:}return db[_0x0496('0x4b')]['queryInterface'][_0x0496('0x55')]('cm_contacts',util[_0x0496('0x56')]('cf_%d',_0x326a53['id']),_0x15a126);})[_0x0496('0x26')](function(){return _0x326a53;});})[_0x0496('0x26')](respondWithResult(_0x43f42e,0xc9))[_0x0496('0x47')](handleError(_0x43f42e,null));}; \ No newline at end of file +var _0x8212=['type','key','model','differenceBy','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','rows','catch','params','keys','find','update','body','create','transaction','Sequelize','TEXT','text','INTEGER','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','count','offset','Content-Range','apply','reject','save','then','destroy','stack','send','index','map','fieldName'];(function(_0x535854,_0x127ba8){var _0x20b966=function(_0x45b2d7){while(--_0x45b2d7){_0x535854['push'](_0x535854['shift']());}};_0x20b966(++_0x127ba8);}(_0x8212,0x12f));var _0x2821=function(_0x21b8db,_0x2593ee){_0x21b8db=_0x21b8db-0x0;var _0x2d14c8=_0x8212[_0x21b8db];return _0x2d14c8;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require(_0x2821('0x2'));var jsonpatch=require(_0x2821('0x3'));var rp=require(_0x2821('0x4'));var moment=require(_0x2821('0x5'));var BPromise=require(_0x2821('0x6'));var Mustache=require(_0x2821('0x7'));var util=require(_0x2821('0x8'));var path=require('path');var sox=require(_0x2821('0x9'));var csv=require(_0x2821('0xa'));var ejs=require(_0x2821('0xb'));var fs=require('fs');var fs_extra=require(_0x2821('0xc'));var _=require(_0x2821('0xd'));var squel=require(_0x2821('0xe'));var crypto=require('crypto');var jsforce=require(_0x2821('0xf'));var deskjs=require(_0x2821('0x10'));var toCsv=require(_0x2821('0xa'));var querystring=require(_0x2821('0x11'));var Papa=require('papaparse');var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var hardwareService=require(_0x2821('0x16'));var logger=require(_0x2821('0x17'))(_0x2821('0x18'));var utils=require(_0x2821('0x19'));var config=require(_0x2821('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2821('0x1b'))['db'];function respondWithStatusCode(_0x5ccf9f,_0x4ccc8a){_0x4ccc8a=_0x4ccc8a||0xcc;return function(_0x3e05f7){if(_0x3e05f7){return _0x5ccf9f[_0x2821('0x1c')](_0x4ccc8a);}return _0x5ccf9f[_0x2821('0x1d')](_0x4ccc8a)[_0x2821('0x1e')]();};}function respondWithResult(_0x27ae5f,_0x5c3f1b){_0x5c3f1b=_0x5c3f1b||0xc8;return function(_0x3b63ee){if(_0x3b63ee){return _0x27ae5f[_0x2821('0x1d')](_0x5c3f1b)['json'](_0x3b63ee);}};}function respondWithFilteredResult(_0x580670,_0x3c7dd7){return function(_0x353b7b){if(_0x353b7b){var _0x285cdd=typeof _0x3c7dd7['offset']==='undefined'&&typeof _0x3c7dd7[_0x2821('0x1f')]==='undefined';var _0x3fb320=_0x353b7b[_0x2821('0x20')];var _0x2ce71d=_0x285cdd?0x0:_0x3c7dd7[_0x2821('0x21')];var _0x1e5412=_0x285cdd?_0x353b7b[_0x2821('0x20')]:_0x3c7dd7['offset']+_0x3c7dd7[_0x2821('0x1f')];var _0x5ac3c4;if(_0x1e5412>=_0x3fb320){_0x1e5412=_0x3fb320;_0x5ac3c4=0xc8;}else{_0x5ac3c4=0xce;}_0x580670[_0x2821('0x1d')](_0x5ac3c4);return _0x580670['set'](_0x2821('0x22'),_0x2ce71d+'-'+_0x1e5412+'/'+_0x3fb320)['json'](_0x353b7b);}return null;};}function patchUpdates(_0x9a8592){return function(_0x29f084){try{jsonpatch[_0x2821('0x23')](_0x29f084,_0x9a8592,!![]);}catch(_0x37548a){return BPromise[_0x2821('0x24')](_0x37548a);}return _0x29f084[_0x2821('0x25')]();};}function saveUpdates(_0x1ec996,_0x429f16){return function(_0x46aa49){if(_0x46aa49){return _0x46aa49['update'](_0x1ec996)[_0x2821('0x26')](function(_0x16dc1b){return _0x16dc1b;});}return null;};}function removeEntity(_0x5e59f4,_0x357afb){return function(_0x10e718){if(_0x10e718){return _0x10e718[_0x2821('0x27')]()[_0x2821('0x26')](function(){_0x5e59f4['status'](0xcc)[_0x2821('0x1e')]();});}};}function handleEntityNotFound(_0x124e7,_0x982a76){return function(_0x43a112){if(!_0x43a112){_0x124e7[_0x2821('0x1c')](0x194);}return _0x43a112;};}function handleError(_0x5440c4,_0xdcd66c){_0xdcd66c=_0xdcd66c||0x1f4;return function(_0x376569){logger['error'](_0x376569[_0x2821('0x28')]);if(_0x376569['name']){delete _0x376569['name'];}_0x5440c4[_0x2821('0x1d')](_0xdcd66c)[_0x2821('0x29')](_0x376569);};}exports[_0x2821('0x2a')]=function(_0x2c270e,_0x4e2694){var _0x4a1153={},_0x3b97d4={},_0x22ac43={'count':0x0,'rows':[]};var _0x587739=_[_0x2821('0x2b')](db['CmCustomField']['rawAttributes'],function(_0x3d7a8f){return{'name':_0x3d7a8f[_0x2821('0x2c')],'type':_0x3d7a8f[_0x2821('0x2d')][_0x2821('0x2e')]};});_0x3b97d4[_0x2821('0x2f')]=_[_0x2821('0x30')](_[_0x2821('0x2b')](_0x587739,_0x2821('0x31')),['name']);_0x3b97d4[_0x2821('0x32')]=_['keys'](_0x2c270e[_0x2821('0x32')]);_0x3b97d4[_0x2821('0x33')]=_[_0x2821('0x34')](_0x3b97d4[_0x2821('0x2f')],_0x3b97d4[_0x2821('0x32')]);_0x4a1153[_0x2821('0x35')]=_[_0x2821('0x34')](_0x3b97d4[_0x2821('0x2f')],qs[_0x2821('0x36')](_0x2c270e[_0x2821('0x32')][_0x2821('0x36')]));_0x4a1153['attributes']=_0x4a1153[_0x2821('0x35')][_0x2821('0x37')]?_0x4a1153['attributes']:_0x3b97d4[_0x2821('0x2f')];if(!_0x2c270e['query'][_0x2821('0x38')]('nolimit')){_0x4a1153[_0x2821('0x1f')]=qs[_0x2821('0x1f')](_0x2c270e[_0x2821('0x32')][_0x2821('0x1f')]);_0x4a1153[_0x2821('0x21')]=qs[_0x2821('0x21')](_0x2c270e[_0x2821('0x32')][_0x2821('0x21')]);}_0x4a1153[_0x2821('0x39')]=qs[_0x2821('0x3a')](_0x2c270e[_0x2821('0x32')][_0x2821('0x3a')]);_0x4a1153[_0x2821('0x3b')]=qs[_0x2821('0x33')](_[_0x2821('0x3c')](_0x2c270e['query'],_0x3b97d4[_0x2821('0x33')]),_0x587739);if(_0x2c270e[_0x2821('0x32')][_0x2821('0x3d')]){_0x4a1153[_0x2821('0x3b')]=_[_0x2821('0x3e')](_0x4a1153[_0x2821('0x3b')],{'$or':_[_0x2821('0x2b')](_0x587739,function(_0x1537f1){if(_0x1537f1[_0x2821('0x2d')]!==_0x2821('0x3f')){var _0x4bd9d4={};_0x4bd9d4[_0x1537f1[_0x2821('0x31')]]={'$like':'%'+_0x2c270e['query']['filter']+'%'};return _0x4bd9d4;}})});}_0x4a1153=_[_0x2821('0x3e')]({},_0x4a1153,_0x2c270e[_0x2821('0x40')]);var _0x12e86c={'where':_0x4a1153[_0x2821('0x3b')]};return db[_0x2821('0x41')]['count'](_0x12e86c)['then'](function(_0x256613){_0x22ac43['count']=_0x256613;if(_0x2c270e[_0x2821('0x32')][_0x2821('0x42')]){_0x4a1153[_0x2821('0x43')]=[{'all':!![]}];}return db[_0x2821('0x41')][_0x2821('0x44')](_0x4a1153);})[_0x2821('0x26')](function(_0x263686){_0x22ac43[_0x2821('0x45')]=_0x263686;return _0x22ac43;})[_0x2821('0x26')](respondWithFilteredResult(_0x4e2694,_0x4a1153))[_0x2821('0x46')](handleError(_0x4e2694,null));};exports['show']=function(_0x360eaa,_0x1b241e){var _0x457d2e={'raw':!![],'where':{'id':_0x360eaa[_0x2821('0x47')]['id']}},_0x521119={};_0x521119[_0x2821('0x2f')]=_[_0x2821('0x48')](db[_0x2821('0x41')]['rawAttributes']);_0x521119[_0x2821('0x32')]=_[_0x2821('0x48')](_0x360eaa[_0x2821('0x32')]);_0x521119['filters']=_[_0x2821('0x34')](_0x521119['model'],_0x521119['query']);_0x457d2e[_0x2821('0x35')]=_[_0x2821('0x34')](_0x521119['model'],qs[_0x2821('0x36')](_0x360eaa[_0x2821('0x32')][_0x2821('0x36')]));_0x457d2e[_0x2821('0x35')]=_0x457d2e['attributes']['length']?_0x457d2e[_0x2821('0x35')]:_0x521119[_0x2821('0x2f')];if(_0x360eaa['query'][_0x2821('0x42')]){_0x457d2e[_0x2821('0x43')]=[{'all':!![]}];}_0x457d2e=_[_0x2821('0x3e')]({},_0x457d2e,_0x360eaa[_0x2821('0x40')]);return db['CmCustomField'][_0x2821('0x49')](_0x457d2e)[_0x2821('0x26')](handleEntityNotFound(_0x1b241e,null))[_0x2821('0x26')](respondWithResult(_0x1b241e,null))[_0x2821('0x46')](handleError(_0x1b241e,null));};exports[_0x2821('0x4a')]=function(_0x517504,_0x24b67a){if(_0x517504[_0x2821('0x4b')]['id']){delete _0x517504[_0x2821('0x4b')]['id'];}return db[_0x2821('0x41')][_0x2821('0x49')]({'where':{'id':_0x517504[_0x2821('0x47')]['id']}})[_0x2821('0x26')](handleEntityNotFound(_0x24b67a,null))[_0x2821('0x26')](saveUpdates(_0x517504['body'],null))['then'](respondWithResult(_0x24b67a,null))[_0x2821('0x46')](handleError(_0x24b67a,null));};exports[_0x2821('0x27')]=function(_0x4287fa,_0x221363){return db[_0x2821('0x41')][_0x2821('0x49')]({'where':{'id':_0x4287fa['params']['id']}})[_0x2821('0x26')](handleEntityNotFound(_0x221363,null))[_0x2821('0x26')](removeEntity(_0x221363,null))[_0x2821('0x46')](handleError(_0x221363,null));};exports[_0x2821('0x4c')]=function(_0x18105f,_0x1be529){var _0x145e9f;return db['sequelize'][_0x2821('0x4d')](function(_0x4b9398){return db[_0x2821('0x41')][_0x2821('0x4c')](_0x18105f[_0x2821('0x4b')],{'transaction':_0x4b9398})[_0x2821('0x26')](function(_0x1d9162){_0x145e9f=_0x1d9162;var _0x1a9b1c={'type':db[_0x2821('0x4e')][_0x2821('0x4f')],'transaction':_0x4b9398};switch(_0x18105f[_0x2821('0x4b')][_0x2821('0x2d')]){case _0x2821('0x50'):_0x1a9b1c[_0x2821('0x2d')]=db['Sequelize']['TEXT'];break;case'number':_0x1a9b1c['type']=db[_0x2821('0x4e')][_0x2821('0x51')];break;case'switch':_0x1a9b1c[_0x2821('0x2d')]=db['Sequelize']['BOOLEAN'];_0x1a9b1c['defaultValue']=![];break;default:}return db[_0x2821('0x52')][_0x2821('0x53')][_0x2821('0x54')](_0x2821('0x55'),util[_0x2821('0x56')]('cf_%d',_0x145e9f['id']),_0x1a9b1c);})['then'](function(){return _0x145e9f;});})[_0x2821('0x26')](respondWithResult(_0x1be529,0xc9))[_0x2821('0x46')](handleError(_0x1be529,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 43c61e6..bdcd35b 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 _0x7ee6=['CmCustomField','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4e604f,_0x8828af){var _0x37e4c7=function(_0x5e579e){while(--_0x5e579e){_0x4e604f['push'](_0x4e604f['shift']());}};_0x37e4c7(++_0x8828af);}(_0x7ee6,0x64));var _0x67ee=function(_0x3b671b,_0x11b4e0){_0x3b671b=_0x3b671b-0x0;var _0x14a044=_0x7ee6[_0x3b671b];return _0x14a044;};'use strict';var _=require('lodash');var util=require(_0x67ee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x67ee('0x1'));var BPromise=require(_0x67ee('0x2'));var rp=require(_0x67ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67ee('0x4'));var config=require(_0x67ee('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x67ee('0x6')]=function(_0x542eff,_0x3175f7){return _0x542eff[_0x67ee('0x7')](_0x67ee('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4452=['rimraf','./cmCustomField.attributes','exports','define','CmCustomField','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a47de,_0x57a87c){var _0x400ee6=function(_0x46745b){while(--_0x46745b){_0x5a47de['push'](_0x5a47de['shift']());}};_0x400ee6(++_0x57a87c);}(_0x4452,0xad));var _0x2445=function(_0x5b5b25,_0x27dd3a){_0x5b5b25=_0x5b5b25-0x0;var _0x3d39cd=_0x4452[_0x5b5b25];return _0x3d39cd;};'use strict';var _=require(_0x2445('0x0'));var util=require('util');var logger=require(_0x2445('0x1'))(_0x2445('0x2'));var moment=require(_0x2445('0x3'));var BPromise=require(_0x2445('0x4'));var rp=require(_0x2445('0x5'));var fs=require('fs');var path=require(_0x2445('0x6'));var rimraf=require(_0x2445('0x7'));var config=require('../../config/environment');var attributes=require(_0x2445('0x8'));module[_0x2445('0x9')]=function(_0x53a2cd,_0x497a2b){return _0x53a2cd[_0x2445('0xa')](_0x2445('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 108dcca..ad4b399 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 _0x59e1=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird'];(function(_0x310c28,_0x2e0402){var _0x1aeba6=function(_0x380e89){while(--_0x380e89){_0x310c28['push'](_0x310c28['shift']());}};_0x1aeba6(++_0x2e0402);}(_0x59e1,0x132));var _0x159e=function(_0x4acfe3,_0x27dff8){_0x4acfe3=_0x4acfe3-0x0;var _0x254f94=_0x59e1[_0x4acfe3];return _0x254f94;};'use strict';var _=require('lodash');var util=require(_0x159e('0x0'));var moment=require('moment');var BPromise=require(_0x159e('0x1'));var rs=require(_0x159e('0x2'));var fs=require('fs');var Redis=require(_0x159e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x159e('0x4'));var logger=require(_0x159e('0x5'))(_0x159e('0x6'));var config=require(_0x159e('0x7'));var jayson=require(_0x159e('0x8'));var client=jayson[_0x159e('0x9')][_0x159e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39bac9,_0x2ec0b7,_0xf28bd9){return new BPromise(function(_0x193b27,_0x3eb824){return client[_0x159e('0xb')](_0x39bac9,_0xf28bd9)[_0x159e('0xc')](function(_0x14ba3b){logger[_0x159e('0xd')](_0x159e('0xe'),_0x2ec0b7,'request\x20sent');logger['debug'](_0x159e('0xf'),_0x2ec0b7,_0x159e('0x10'),JSON['stringify'](_0x14ba3b));if(_0x14ba3b[_0x159e('0x11')]){if(_0x14ba3b[_0x159e('0x11')][_0x159e('0x12')]===0x1f4){logger[_0x159e('0x11')]('CmCustomField,\x20%s,\x20%s',_0x2ec0b7,_0x14ba3b[_0x159e('0x11')]['message']);return _0x3eb824(_0x14ba3b[_0x159e('0x11')][_0x159e('0x13')]);}logger[_0x159e('0x11')](_0x159e('0xe'),_0x2ec0b7,_0x14ba3b[_0x159e('0x11')]['message']);return _0x193b27(_0x14ba3b['error'][_0x159e('0x13')]);}else{logger[_0x159e('0xd')]('CmCustomField,\x20%s,\x20%s',_0x2ec0b7,_0x159e('0x10'));_0x193b27(_0x14ba3b[_0x159e('0x14')]['message']);}})[_0x159e('0x15')](function(_0x1d8955){logger[_0x159e('0x11')](_0x159e('0xe'),_0x2ec0b7,_0x1d8955);_0x3eb824(_0x1d8955);});});} \ No newline at end of file +var _0xbcff=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbcff,0xbb));var _0xfbcf=function(_0x361a7b,_0x3cb9f9){_0x361a7b=_0x361a7b-0x0;var _0xe4e328=_0xbcff[_0x361a7b];return _0xe4e328;};'use strict';var _=require(_0xfbcf('0x0'));var util=require('util');var moment=require(_0xfbcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbcf('0x2'));var fs=require('fs');var Redis=require(_0xfbcf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbcf('0x4'))(_0xfbcf('0x5'));var config=require('../../config/environment');var jayson=require(_0xfbcf('0x6'));var client=jayson[_0xfbcf('0x7')][_0xfbcf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e7584,_0x2ec56a,_0x217f28){return new BPromise(function(_0x55cd4e,_0x2cbd96){return client[_0xfbcf('0x9')](_0x1e7584,_0x217f28)[_0xfbcf('0xa')](function(_0x5784ee){logger[_0xfbcf('0xb')](_0xfbcf('0xc'),_0x2ec56a,_0xfbcf('0xd'));logger[_0xfbcf('0xe')](_0xfbcf('0xf'),_0x2ec56a,_0xfbcf('0xd'),JSON[_0xfbcf('0x10')](_0x5784ee));if(_0x5784ee['error']){if(_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x12')]===0x1f4){logger[_0xfbcf('0x11')](_0xfbcf('0xc'),_0x2ec56a,_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);return _0x2cbd96(_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);}logger[_0xfbcf('0x11')]('CmCustomField,\x20%s,\x20%s',_0x2ec56a,_0x5784ee[_0xfbcf('0x11')][_0xfbcf('0x13')]);return _0x55cd4e(_0x5784ee['error']['message']);}else{logger['info'](_0xfbcf('0xc'),_0x2ec56a,_0xfbcf('0xd'));_0x55cd4e(_0x5784ee[_0xfbcf('0x14')][_0xfbcf('0x13')]);}})[_0xfbcf('0x15')](function(_0x39b81d){logger[_0xfbcf('0x11')](_0xfbcf('0xc'),_0x2ec56a,_0x39b81d);_0x2cbd96(_0x39b81d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4e081b0..86fea2f 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 _0x75d2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x157585,_0xd65018){var _0x4288f9=function(_0x1810cf){while(--_0x1810cf){_0x157585['push'](_0x157585['shift']());}};_0x4288f9(++_0xd65018);}(_0x75d2,0x152));var _0x275d=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x75d2[_0x2c1aa8];return _0x4019f5;};'use strict';var multer=require(_0x275d('0x0'));var util=require(_0x275d('0x1'));var path=require(_0x275d('0x2'));var timeout=require(_0x275d('0x3'));var express=require(_0x275d('0x4'));var router=express[_0x275d('0x5')]();var fs_extra=require(_0x275d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x275d('0x7'));var config=require('../../config/environment');var controller=require(_0x275d('0x8'));router[_0x275d('0x9')]('/',auth[_0x275d('0xa')](),controller[_0x275d('0xb')]);router[_0x275d('0x9')](_0x275d('0xc'),auth['isAuthenticated'](),controller[_0x275d('0xd')]);router[_0x275d('0xe')]('/',auth[_0x275d('0xa')](),controller[_0x275d('0xf')]);router['put'](_0x275d('0xc'),auth[_0x275d('0xa')](),controller[_0x275d('0x10')]);router[_0x275d('0x11')](_0x275d('0xc'),auth[_0x275d('0xa')](),controller[_0x275d('0x12')]);module[_0x275d('0x13')]=router; \ No newline at end of file +var _0x56da=['../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23f0cc,_0x55ee1a){var _0x5ab656=function(_0x4edf6b){while(--_0x4edf6b){_0x23f0cc['push'](_0x23f0cc['shift']());}};_0x5ab656(++_0x55ee1a);}(_0x56da,0x119));var _0xa56d=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x56da[_0x287059];return _0x225c79;};'use strict';var multer=require(_0xa56d('0x0'));var util=require('util');var path=require(_0xa56d('0x1'));var timeout=require(_0xa56d('0x2'));var express=require('express');var router=express[_0xa56d('0x3')]();var fs_extra=require(_0xa56d('0x4'));var auth=require(_0xa56d('0x5'));var interaction=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var controller=require(_0xa56d('0x8'));router[_0xa56d('0x9')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xb')]);router[_0xa56d('0x9')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa56d('0xd')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xe')]);router[_0xa56d('0xf')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa56d('0x10')](_0xa56d('0xc'),auth[_0xa56d('0xa')](),controller['destroy']);module[_0xa56d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 88c7ec7..184601c 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 _0xd943=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','moment'];(function(_0x1d4dd6,_0x1ce0a6){var _0x38cc98=function(_0x29745b){while(--_0x29745b){_0x1d4dd6['push'](_0x1d4dd6['shift']());}};_0x38cc98(++_0x1ce0a6);}(_0xd943,0x15d));var _0x3d94=function(_0x4857d7,_0x523d86){_0x4857d7=_0x4857d7-0x0;var _0x465bea=_0xd943[_0x4857d7];return _0x465bea;};'use strict';var moment=require(_0x3d94('0x0'));var Sequelize=require(_0x3d94('0x1'));module[_0x3d94('0x2')]={'phone':{'type':Sequelize[_0x3d94('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3d94('0x4')],'defaultValue':moment()[_0x3d94('0x5')](_0x3d94('0x6'))},'countbusyretry':{'type':Sequelize[_0x3d94('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3d94('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3d94('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3d94('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3d94('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3d94('0x9')},'UserId':{'type':Sequelize[_0x3d94('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x3d94('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x3d94('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3d94('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3d94('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3d94('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3d94('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3d94('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9f0e=['sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x5630db,_0x176962){var _0x2c40a6=function(_0x3c6fe4){while(--_0x3c6fe4){_0x5630db['push'](_0x5630db['shift']());}};_0x2c40a6(++_0x176962);}(_0x9f0e,0x116));var _0xe9f0=function(_0x28436d,_0x914098){_0x28436d=_0x28436d-0x0;var _0x4b482a=_0x9f0e[_0x28436d];return _0x4b482a;};'use strict';var moment=require(_0xe9f0('0x0'));var Sequelize=require(_0xe9f0('0x1'));module[_0xe9f0('0x2')]={'phone':{'type':Sequelize[_0xe9f0('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe9f0('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xe9f0('0x5'))},'countbusyretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe9f0('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xe9f0('0x6')](0x2)[_0xe9f0('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe9f0('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe9f0('0x8')},'ListId':{'type':Sequelize[_0xe9f0('0x6')],'unique':_0xe9f0('0x8')},'UserId':{'type':Sequelize[_0xe9f0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xe9f0('0x6')],'unique':_0xe9f0('0x8')},'CampaignId':{'type':Sequelize[_0xe9f0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe9f0('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe9f0('0x3')]},'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 4786d8f..514e9ca 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 _0xe148=['push','utcOffset','getTimezone','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','then','destroy','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','concat','$and','$gte','$lt','$ne','$eq','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','create','getPreview','outbound','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','update','getPreviewRecall','CmContact','getVoiceQueues','preview','hopperId','CmCompany','dialActive','getOpenContacts','entity\x20not\x20found','timezones'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0xe148,0x9e));var _0x8e14=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0xe148[_0x2dd22e];return _0x257b01;};'use strict';var emlformat=require(_0x8e14('0x0'));var rimraf=require(_0x8e14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e14('0x2'));var rp=require(_0x8e14('0x3'));var moment=require('moment');var BPromise=require(_0x8e14('0x4'));var Mustache=require(_0x8e14('0x5'));var util=require(_0x8e14('0x6'));var path=require(_0x8e14('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e14('0x8'));var fs=require('fs');var fs_extra=require(_0x8e14('0x9'));var _=require('lodash');var squel=require(_0x8e14('0xa'));var crypto=require(_0x8e14('0xb'));var jsforce=require(_0x8e14('0xc'));var deskjs=require(_0x8e14('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e14('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e14('0xf'));var authService=require(_0x8e14('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e14('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e14('0x12'));var utils=require(_0x8e14('0x13'));var config=require(_0x8e14('0x14'));var shared=require(_0x8e14('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e14('0x15'))['db'];function respondWithStatusCode(_0x5712fe,_0x5c49d9){_0x5c49d9=_0x5c49d9||0xcc;return function(_0x2f5fc7){if(_0x2f5fc7){return _0x5712fe['sendStatus'](_0x5c49d9);}return _0x5712fe[_0x8e14('0x16')](_0x5c49d9)[_0x8e14('0x17')]();};}function respondWithResult(_0x59e069,_0x4f36a5){_0x4f36a5=_0x4f36a5||0xc8;return function(_0x1f9b2c){if(_0x1f9b2c){return _0x59e069[_0x8e14('0x16')](_0x4f36a5)[_0x8e14('0x18')](_0x1f9b2c);}};}function respondWithFilteredResult(_0x128217,_0x40b964){return function(_0x50db2e){if(_0x50db2e){var _0x27a934=typeof _0x40b964[_0x8e14('0x19')]==='undefined'&&typeof _0x40b964[_0x8e14('0x1a')]===_0x8e14('0x1b');var _0x3ebb7f=_0x50db2e[_0x8e14('0x1c')];var _0x10c24d=_0x27a934?0x0:_0x40b964[_0x8e14('0x19')];var _0x10256c=_0x27a934?_0x50db2e[_0x8e14('0x1c')]:_0x40b964[_0x8e14('0x19')]+_0x40b964[_0x8e14('0x1a')];var _0x5adbbb;if(_0x10256c>=_0x3ebb7f){_0x10256c=_0x3ebb7f;_0x5adbbb=0xc8;}else{_0x5adbbb=0xce;}_0x128217[_0x8e14('0x16')](_0x5adbbb);return _0x128217[_0x8e14('0x1d')]('Content-Range',_0x10c24d+'-'+_0x10256c+'/'+_0x3ebb7f)[_0x8e14('0x18')](_0x50db2e);}return null;};}function patchUpdates(_0x5a7d38){return function(_0x378e86){try{jsonpatch['apply'](_0x378e86,_0x5a7d38,!![]);}catch(_0x1989e4){return BPromise[_0x8e14('0x1e')](_0x1989e4);}return _0x378e86[_0x8e14('0x1f')]();};}function saveUpdates(_0x4b3de5,_0x23c5eb){return function(_0x4a72b6){if(_0x4a72b6){return _0x4a72b6['update'](_0x4b3de5)[_0x8e14('0x20')](function(_0x2b7ff5){return _0x2b7ff5;});}return null;};}function removeEntity(_0x1244d3,_0x52b041){return function(_0x3588c1){if(_0x3588c1){return _0x3588c1[_0x8e14('0x21')]()[_0x8e14('0x20')](function(){_0x1244d3[_0x8e14('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ee4a,_0x5b4af3){return function(_0x5c5277){if(!_0x5c5277){_0x28ee4a[_0x8e14('0x22')](0x194);}return _0x5c5277;};}function handleError(_0x43b6db,_0x356200){_0x356200=_0x356200||0x1f4;return function(_0x58991b){logger[_0x8e14('0x23')](_0x58991b[_0x8e14('0x24')]);if(_0x58991b[_0x8e14('0x25')]){delete _0x58991b[_0x8e14('0x25')];}_0x43b6db['status'](_0x356200)['send'](_0x58991b);};}exports[_0x8e14('0x26')]=function(_0x46e737,_0x170e0b){var _0x9eb6a7={},_0x292f44={},_0x21d9c8={'count':0x0,'rows':[]};var _0x4116f5=_['map'](db[_0x8e14('0x27')][_0x8e14('0x28')],function(_0x31a712){return{'name':_0x31a712[_0x8e14('0x29')],'type':_0x31a712['type'][_0x8e14('0x2a')]};});_0x292f44[_0x8e14('0x2b')]=_[_0x8e14('0x2c')](_0x4116f5,_0x8e14('0x25'));_0x292f44[_0x8e14('0x2d')]=_[_0x8e14('0x2e')](_0x46e737[_0x8e14('0x2d')]);_0x292f44[_0x8e14('0x2f')]=_[_0x8e14('0x30')](_0x292f44[_0x8e14('0x2b')],_0x292f44[_0x8e14('0x2d')]);_0x292f44['filters']=_[_0x8e14('0x31')](_0x292f44[_0x8e14('0x2f')],[_0x8e14('0x32'),'$or','$gt',_0x8e14('0x33'),_0x8e14('0x34'),'$lte',_0x8e14('0x35'),_0x8e14('0x36'),'$not',_0x8e14('0x37'),'$notBetween',_0x8e14('0x38'),_0x8e14('0x39'),_0x8e14('0x3a'),_0x8e14('0x3b'),'$iLike',_0x8e14('0x3c'),_0x8e14('0x3a'),_0x8e14('0x3d'),'$contains',_0x8e14('0x3e'),_0x8e14('0x3f')]);_0x9eb6a7[_0x8e14('0x40')]=_['intersection'](_0x292f44[_0x8e14('0x2b')],qs[_0x8e14('0x41')](_0x46e737[_0x8e14('0x2d')][_0x8e14('0x41')]));_0x9eb6a7['attributes']=_0x9eb6a7[_0x8e14('0x40')][_0x8e14('0x42')]?_0x9eb6a7['attributes']:_0x292f44[_0x8e14('0x2b')];if(!_0x46e737[_0x8e14('0x2d')][_0x8e14('0x43')](_0x8e14('0x44'))){_0x9eb6a7[_0x8e14('0x1a')]=qs[_0x8e14('0x1a')](_0x46e737[_0x8e14('0x2d')][_0x8e14('0x1a')]);_0x9eb6a7['offset']=qs['offset'](_0x46e737['query'][_0x8e14('0x19')]);}_0x9eb6a7['order']=qs[_0x8e14('0x45')](_0x46e737[_0x8e14('0x2d')][_0x8e14('0x45')]);_0x9eb6a7['where']=qs[_0x8e14('0x2f')](_[_0x8e14('0x46')](_0x46e737['query'],_0x292f44[_0x8e14('0x2f')]),_0x4116f5);if(_0x46e737[_0x8e14('0x2d')][_0x8e14('0x47')]){_0x9eb6a7[_0x8e14('0x48')]=_[_0x8e14('0x49')](_0x9eb6a7[_0x8e14('0x48')],{'$or':_[_0x8e14('0x2c')](_0x4116f5,function(_0x2f96a3){if(_0x2f96a3[_0x8e14('0x4a')]!==_0x8e14('0x4b')){var _0x59fde1={};_0x59fde1[_0x2f96a3[_0x8e14('0x25')]]={'$like':'%'+_0x46e737['query'][_0x8e14('0x47')]+'%'};return _0x59fde1;}})});}_0x9eb6a7=_['merge']({},_0x9eb6a7,_0x46e737[_0x8e14('0x4c')]);var _0x1c1fa5={'where':_0x9eb6a7[_0x8e14('0x48')]};return db['CmHopper'][_0x8e14('0x1c')](_0x1c1fa5)[_0x8e14('0x20')](function(_0x4d4ea1){_0x21d9c8[_0x8e14('0x1c')]=_0x4d4ea1;if(_0x46e737[_0x8e14('0x2d')]['includeAll']){_0x9eb6a7[_0x8e14('0x4d')]=[{'all':!![]}];}return db[_0x8e14('0x27')][_0x8e14('0x4e')](_0x9eb6a7);})['then'](function(_0x2d30ef){_0x21d9c8[_0x8e14('0x4f')]=_0x2d30ef;return _0x21d9c8;})[_0x8e14('0x20')](respondWithFilteredResult(_0x170e0b,_0x9eb6a7))[_0x8e14('0x50')](handleError(_0x170e0b,null));};exports[_0x8e14('0x51')]=function(_0x466512,_0x46443b){var _0x1e5e78={'raw':!![],'where':{'id':_0x466512[_0x8e14('0x52')]['id']}},_0x5835cd={};_0x5835cd[_0x8e14('0x2b')]=_['keys'](db[_0x8e14('0x27')][_0x8e14('0x28')]);_0x5835cd[_0x8e14('0x2d')]=_[_0x8e14('0x2e')](_0x466512[_0x8e14('0x2d')]);_0x5835cd['filters']=_[_0x8e14('0x30')](_0x5835cd[_0x8e14('0x2b')],_0x5835cd[_0x8e14('0x2d')]);_0x1e5e78['attributes']=_[_0x8e14('0x30')](_0x5835cd[_0x8e14('0x2b')],qs['fields'](_0x466512[_0x8e14('0x2d')][_0x8e14('0x41')]));_0x1e5e78['attributes']=_0x1e5e78[_0x8e14('0x40')][_0x8e14('0x42')]?_0x1e5e78['attributes']:_0x5835cd[_0x8e14('0x2b')];if(_0x466512[_0x8e14('0x2d')][_0x8e14('0x53')]){_0x1e5e78[_0x8e14('0x4d')]=[{'all':!![]}];}_0x1e5e78=_['merge']({},_0x1e5e78,_0x466512[_0x8e14('0x4c')]);return db['CmHopper'][_0x8e14('0x54')](_0x1e5e78)[_0x8e14('0x20')](handleEntityNotFound(_0x46443b,null))[_0x8e14('0x20')](respondWithResult(_0x46443b,null))[_0x8e14('0x50')](handleError(_0x46443b,null));};exports['create']=function(_0x369e36,_0xaad99e){return db['CmHopper']['create'](_0x369e36[_0x8e14('0x55')],{})[_0x8e14('0x20')](respondWithResult(_0xaad99e,0xc9))['catch'](handleError(_0xaad99e,null));};exports['update']=function(_0x37c3e0,_0x30570a){if(_0x37c3e0[_0x8e14('0x55')]['id']){delete _0x37c3e0[_0x8e14('0x55')]['id'];}return db[_0x8e14('0x27')][_0x8e14('0x54')]({'where':{'id':_0x37c3e0[_0x8e14('0x52')]['id']}})['then'](handleEntityNotFound(_0x30570a,null))[_0x8e14('0x20')](saveUpdates(_0x37c3e0[_0x8e14('0x55')],null))[_0x8e14('0x20')](respondWithResult(_0x30570a,null))[_0x8e14('0x50')](handleError(_0x30570a,null));};exports['describe']=function(_0x2a6ef3,_0x59c048){return db[_0x8e14('0x27')][_0x8e14('0x56')]()['then'](respondWithResult(_0x59c048,null))[_0x8e14('0x50')](handleError(_0x59c048,null));};exports['destroy']=function(_0xc81c06,_0x552ba5){var _0x39efb7;return db[_0x8e14('0x27')][_0x8e14('0x54')]({'where':{'id':_0xc81c06[_0x8e14('0x52')]['id']}})[_0x8e14('0x20')](handleEntityNotFound(_0x552ba5,null))[_0x8e14('0x20')](function(_0x24da7e){if(_0x24da7e){return _0x24da7e[_0x8e14('0x21')]()[_0x8e14('0x20')](function(_0x187832){return _0x187832;});}})[_0x8e14('0x20')](function(_0x11ec0b){_0x39efb7=_0x11ec0b;if(_0x11ec0b){if(_0x11ec0b['VoiceQueueId']||_0x11ec0b[_0x8e14('0x57')]){return db[_0x11ec0b[_0x8e14('0x58')]?_0x8e14('0x59'):_0x8e14('0x5a')]['find']({'where':{'id':_0x11ec0b[_0x8e14('0x58')]?_0x11ec0b[_0x8e14('0x58')]:_0x11ec0b['CampaignId']},'attributes':['id',_0x8e14('0x25')],'raw':!![]});}}})['then'](function(_0x1a7961){var _0x3e104e={};if(_0x1a7961){_[_0x8e14('0x49')](_0x3e104e,_[_0x8e14('0x5b')](_0x39efb7[_0x8e14('0x5c')],[_0x8e14('0x5d'),_0x8e14('0x5e'),'id']));_0x3e104e[_0x8e14('0x5f')]=0x15;_0x3e104e[_0x8e14('0x60')]=_0x8e14('0x61');_0x3e104e['campaign']=_0x1a7961[_0x8e14('0x25')];_0x3e104e[_0x8e14('0x62')]=_0xc81c06[_0x8e14('0x63')][_0x8e14('0x25')];_0x3e104e[_0x8e14('0x64')]=_0xc81c06[_0x8e14('0x63')]['id'];_0x3e104e[_0x8e14('0x61')]=!![];_0x3e104e[_0x8e14('0x65')]=moment()[_0x8e14('0x66')](_0x8e14('0x67'));_0x3e104e[_0x8e14('0x68')]=_0x39efb7[_0x8e14('0x69')];_0x3e104e['campaigntype']=_0x39efb7['VoiceQueueId']?_0x8e14('0x6a'):_0x8e14('0x6b');return db['CmContact'][_0x8e14('0x54')]({'where':{'id':_0x3e104e['ContactId']},'attributes':[_0x8e14('0x6c'),_0x8e14('0x6d')]})[_0x8e14('0x20')](function(_0x1fd66a){if(!_[_0x8e14('0x6e')](_0x552ba5)&&!_[_0x8e14('0x6e')](_0x1fd66a['firstName'])){_0x3e104e[_0x8e14('0x6f')]=_0x1fd66a[_0x8e14('0x6c')];if(!_[_0x8e14('0x6e')](_0x1fd66a[_0x8e14('0x6d')])){_0x3e104e[_0x8e14('0x6f')]+='\x20'+_0x1fd66a['lastName'];}}})[_0x8e14('0x70')](function(){return db[_0x8e14('0x71')][_0x8e14('0x72')](_0x3e104e);});}})[_0x8e14('0x20')](function(){return _0x552ba5[_0x8e14('0x16')](0xcc)[_0x8e14('0x17')]();})[_0x8e14('0x50')](handleError(_0x552ba5,null));};exports[_0x8e14('0x73')]=function(_0x413198,_0x343f4b,_0x2e48e1){var _0x59ff0e=[];return db['CmContact'][_0x8e14('0x56')]()['then'](function(_0x47c83e){_0x59ff0e=_['keys'](_0x47c83e);return _0x413198[_0x8e14('0x63')]['getVoiceQueues']({'where':{'type':_0x8e14('0x74'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x8e14('0x75')],'raw':!![]});})[_0x8e14('0x20')](function(_0x3c0f1c){if(_0x3c0f1c&&_0x3c0f1c[_0x8e14('0x42')]){return db[_0x8e14('0x76')][_0x8e14('0x77')](function(_0x55f2da){var _0x263da7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8e14('0x66')](_0x8e14('0x67'))},'VoiceQueueId':{'$in':_['map'](_0x3c0f1c,'id')},'$or':[{'UserId':null},{'UserId':_0x413198[_0x8e14('0x63')]['id']}]};var _0x1fbf87={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3c0f1c)[_0x8e14('0x47')]([_0x8e14('0x75'),0x0])[_0x8e14('0x2c')]('id')[_0x8e14('0x78')]()},'$or':[{'UserId':null},{'UserId':_0x413198[_0x8e14('0x63')]['id']}]};var _0x275529={'$or':[_0x263da7,_0x1fbf87]};var _0x475fe3=[];if(_0x413198['body'][_0x8e14('0x79')]&&_0x413198[_0x8e14('0x55')][_0x8e14('0x79')]===_0x8e14('0x7a')){if(!_[_0x8e14('0x7b')](_0x413198[_0x8e14('0x55')]['hopperIds'])){_0x275529['id']={'$in':_0x413198[_0x8e14('0x55')][_0x8e14('0x7c')]};}_0x475fe3=[[_0x8e14('0x7d'),'ASC'],['scheduledAt',_0x3c0f1c[0x0]['dialOrderByScheduledAt']===_0x8e14('0x7e')?_0x8e14('0x7f'):_0x8e14('0x7e')],db['sequelize'][_0x8e14('0x80')](_0x8e14('0x81')),['id',_0x8e14('0x7f')]];}else{if(!_[_0x8e14('0x7b')](_0x413198[_0x8e14('0x55')]['hopperIds'])){_0x275529['id']={'$notIn':_0x413198[_0x8e14('0x55')]['hopperIds']};}_0x475fe3=[[_0x8e14('0x7d'),_0x8e14('0x7f')],[_0x8e14('0x82'),_0x3c0f1c[0x0][_0x8e14('0x83')]],db[_0x8e14('0x76')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x8e14('0x7e')]];}return db[_0x8e14('0x27')]['findOne']({'attributes':['id',_0x8e14('0x84'),_0x8e14('0x85')],'where':_0x275529,'order':_0x475fe3,'transaction':_0x55f2da,'lock':_0x55f2da[_0x8e14('0x86')][_0x8e14('0x87')],'include':[{'model':db['CmContact'],'as':_0x8e14('0x88'),'attributes':_0x59ff0e,'include':[{'model':db['CmCompany'],'as':_0x8e14('0x89'),'attributes':['id',_0x8e14('0x25')]}]},{'model':db[_0x8e14('0x8a')],'as':_0x8e14('0x8b'),'attributes':['id',_0x8e14('0x25')]},{'model':db[_0x8e14('0x59')],'as':_0x8e14('0x8c'),'attributes':['id','name','dialActive']}]})['then'](function(_0x476283){if(_0x476283){return _0x476283[_0x8e14('0x8d')]({'UserId':_0x413198[_0x8e14('0x63')]['id']},{'transaction':_0x55f2da});}});});}})[_0x8e14('0x20')](handleEntityNotFound(_0x343f4b,null))[_0x8e14('0x20')](respondWithResult(_0x343f4b,null))[_0x8e14('0x50')](handleError(_0x343f4b,null));};exports[_0x8e14('0x8e')]=function(_0x1b88e9,_0x1fe8d0,_0x59830d){var _0x463acf=[];return db[_0x8e14('0x8f')][_0x8e14('0x56')]()[_0x8e14('0x20')](function(_0x140f0b){_0x463acf=_['keys'](_0x140f0b);return _0x1b88e9[_0x8e14('0x63')][_0x8e14('0x90')]({'where':{'type':_0x8e14('0x74'),'dialActive':!![],'dialMethod':_0x8e14('0x91')},'attributes':['id',_0x8e14('0x83'),_0x8e14('0x75')],'raw':!![]});})[_0x8e14('0x20')](function(_0x3a9514){if(_0x3a9514&&_0x3a9514[_0x8e14('0x42')]){return db['sequelize'][_0x8e14('0x77')](function(_0x11d911){var _0x5e47ab={'active':![],'recallme':!![],'id':_0x1b88e9[_0x8e14('0x55')][_0x8e14('0x92')]};return db[_0x8e14('0x27')]['findOne']({'attributes':['id',_0x8e14('0x84'),'recallme'],'where':_0x5e47ab,'transaction':_0x11d911,'lock':_0x11d911['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x8e14('0x88'),'attributes':_0x463acf,'include':[{'model':db[_0x8e14('0x93')],'as':_0x8e14('0x89'),'attributes':['id','name']}]},{'model':db[_0x8e14('0x8a')],'as':_0x8e14('0x8b'),'attributes':['id',_0x8e14('0x25')]},{'model':db[_0x8e14('0x59')],'as':'Queue','attributes':['id','name',_0x8e14('0x94')]}]})[_0x8e14('0x20')](function(_0x43ea7d){if(_0x43ea7d){return _0x43ea7d[_0x8e14('0x8d')]({'UserId':_0x1b88e9[_0x8e14('0x63')]['id']},{'transaction':_0x11d911});}});});}})[_0x8e14('0x20')](handleEntityNotFound(_0x1fe8d0,null))['then'](respondWithResult(_0x1fe8d0,null))['catch'](handleError(_0x1fe8d0,null));};exports['getOpenContacts']=function(_0x306b9c,_0x12f3cd,_0x2a327c){return _0x306b9c[_0x8e14('0x63')][_0x8e14('0x90')]({'where':{'type':_0x8e14('0x74'),'dialActive':!![],'dialMethod':_0x8e14('0x91')},'attributes':['id'],'raw':!![]})[_0x8e14('0x20')](function(_0x52b74f){if(_0x52b74f&&_0x52b74f[_0x8e14('0x42')]){return db[_0x8e14('0x27')][_0x8e14('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8e14('0x66')](_0x8e14('0x67'))},'VoiceQueueId':{'$in':_[_0x8e14('0x2c')](_0x52b74f,'id')},'$or':[{'UserId':null},{'UserId':_0x306b9c['user']['id']}]}});}return 0x0;})[_0x8e14('0x20')](function(_0x1c87c0){if(!_[_0x8e14('0x6e')](_0x1c87c0)&&_['isNumber'](_0x1c87c0)){return _0x12f3cd[_0x8e14('0x16')](0xc8)[_0x8e14('0x18')]({'contacts':_0x1c87c0});}else{logger[_0x8e14('0x23')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x8e14('0x95'),0x194,_0x8e14('0x96'));_0x12f3cd['sendStatus'](0x194);}})[_0x8e14('0x50')](handleError(_0x12f3cd,null));};exports['getTimezones']=function(_0x3a3b61,_0x75bb6e,_0x5c53e8){var _0x1d6b40=shared[_0x8e14('0x97')];var _0x5a0ce7=[];_['map'](_0x1d6b40,function(_0x2680d4){_0x5a0ce7[_0x8e14('0x98')]({'id':_0x2680d4[_0x8e14('0x25')],'name':_0x2680d4[_0x8e14('0x25')],'utcOffset':_0x2680d4[_0x8e14('0x99')]});});return _0x75bb6e['status'](0xc8)[_0x8e14('0x18')]({'tz':_0x5a0ce7});};exports[_0x8e14('0x9a')]=function(_0x3a3369,_0x3a2642,_0xe0c6ce){var _0x220367=shared[_0x8e14('0x97')];var _0x20f2d4={};if(!_[_0x8e14('0x6e')](_0x220367[_0x3a3369[_0x8e14('0x55')]['id']]))_0x20f2d4=_0x220367[_0x3a3369[_0x8e14('0x55')]['id']];return _0x3a2642[_0x8e14('0x16')](0xc8)[_0x8e14('0x18')](_0x20f2d4);}; \ No newline at end of file +var _0x5f51=['dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','model','$and','$or','$gt','$gte','$lt','$ne','$eq','$between','$notIn','$iLike','$notILike','$like','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','then','includeAll','include','rows','catch','show','params','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','CmContact','firstName','isNil','calleridname','lastName','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','getVoiceQueues','preview','hopperId','CmList'];(function(_0x138308,_0x4f0435){var _0x3d15e8=function(_0x314cd8){while(--_0x314cd8){_0x138308['push'](_0x138308['shift']());}};_0x3d15e8(++_0x4f0435);}(_0x5f51,0x9d));var _0x15f5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5f51[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x15f5('0x0'));var rimraf=require(_0x15f5('0x1'));var zipdir=require(_0x15f5('0x2'));var jsonpatch=require(_0x15f5('0x3'));var rp=require(_0x15f5('0x4'));var moment=require(_0x15f5('0x5'));var BPromise=require(_0x15f5('0x6'));var Mustache=require(_0x15f5('0x7'));var util=require(_0x15f5('0x8'));var path=require(_0x15f5('0x9'));var sox=require(_0x15f5('0xa'));var csv=require(_0x15f5('0xb'));var ejs=require(_0x15f5('0xc'));var fs=require('fs');var fs_extra=require(_0x15f5('0xd'));var _=require(_0x15f5('0xe'));var squel=require(_0x15f5('0xf'));var crypto=require('crypto');var jsforce=require(_0x15f5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x15f5('0xb'));var querystring=require(_0x15f5('0x11'));var Papa=require(_0x15f5('0x12'));var Redis=require(_0x15f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x15f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15f5('0x15'));var logger=require(_0x15f5('0x16'))(_0x15f5('0x17'));var utils=require(_0x15f5('0x18'));var config=require('../../config/environment');var shared=require(_0x15f5('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414a56,_0x293505){_0x293505=_0x293505||0xcc;return function(_0x1681a4){if(_0x1681a4){return _0x414a56['sendStatus'](_0x293505);}return _0x414a56['status'](_0x293505)[_0x15f5('0x1a')]();};}function respondWithResult(_0x2343ba,_0x13a66a){_0x13a66a=_0x13a66a||0xc8;return function(_0xc8b57f){if(_0xc8b57f){return _0x2343ba[_0x15f5('0x1b')](_0x13a66a)[_0x15f5('0x1c')](_0xc8b57f);}};}function respondWithFilteredResult(_0x44c78b,_0x52c985){return function(_0x2bb6f5){if(_0x2bb6f5){var _0x32a3ca=typeof _0x52c985['offset']===_0x15f5('0x1d')&&typeof _0x52c985['limit']==='undefined';var _0x551208=_0x2bb6f5[_0x15f5('0x1e')];var _0x185987=_0x32a3ca?0x0:_0x52c985['offset'];var _0x5889ba=_0x32a3ca?_0x2bb6f5['count']:_0x52c985[_0x15f5('0x1f')]+_0x52c985[_0x15f5('0x20')];var _0x203086;if(_0x5889ba>=_0x551208){_0x5889ba=_0x551208;_0x203086=0xc8;}else{_0x203086=0xce;}_0x44c78b[_0x15f5('0x1b')](_0x203086);return _0x44c78b[_0x15f5('0x21')](_0x15f5('0x22'),_0x185987+'-'+_0x5889ba+'/'+_0x551208)[_0x15f5('0x1c')](_0x2bb6f5);}return null;};}function patchUpdates(_0x2568d3){return function(_0x2187f0){try{jsonpatch[_0x15f5('0x23')](_0x2187f0,_0x2568d3,!![]);}catch(_0x54e5f7){return BPromise[_0x15f5('0x24')](_0x54e5f7);}return _0x2187f0[_0x15f5('0x25')]();};}function saveUpdates(_0x59b902,_0x284b5b){return function(_0x28f594){if(_0x28f594){return _0x28f594[_0x15f5('0x26')](_0x59b902)['then'](function(_0x431c89){return _0x431c89;});}return null;};}function removeEntity(_0x4c7a31,_0x48c483){return function(_0x2a32a7){if(_0x2a32a7){return _0x2a32a7[_0x15f5('0x27')]()['then'](function(){_0x4c7a31['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10930a,_0x2e6c9f){return function(_0x16a476){if(!_0x16a476){_0x10930a['sendStatus'](0x194);}return _0x16a476;};}function handleError(_0xef42ec,_0x4651fa){_0x4651fa=_0x4651fa||0x1f4;return function(_0x5a302a){logger[_0x15f5('0x28')](_0x5a302a[_0x15f5('0x29')]);if(_0x5a302a[_0x15f5('0x2a')]){delete _0x5a302a['name'];}_0xef42ec[_0x15f5('0x1b')](_0x4651fa)['send'](_0x5a302a);};}exports['index']=function(_0x1c4188,_0x516bb8){var _0x46e2a1={},_0x1f6200={},_0x109bd5={'count':0x0,'rows':[]};var _0x221c2e=_[_0x15f5('0x2b')](db[_0x15f5('0x2c')][_0x15f5('0x2d')],function(_0x42e508){return{'name':_0x42e508[_0x15f5('0x2e')],'type':_0x42e508[_0x15f5('0x2f')][_0x15f5('0x30')]};});_0x1f6200['model']=_[_0x15f5('0x2b')](_0x221c2e,_0x15f5('0x2a'));_0x1f6200[_0x15f5('0x31')]=_[_0x15f5('0x32')](_0x1c4188[_0x15f5('0x31')]);_0x1f6200[_0x15f5('0x33')]=_['intersection'](_0x1f6200[_0x15f5('0x34')],_0x1f6200[_0x15f5('0x31')]);_0x1f6200['filters']=_['concat'](_0x1f6200[_0x15f5('0x33')],[_0x15f5('0x35'),_0x15f5('0x36'),_0x15f5('0x37'),_0x15f5('0x38'),_0x15f5('0x39'),'$lte',_0x15f5('0x3a'),_0x15f5('0x3b'),'$not',_0x15f5('0x3c'),'$notBetween','$in',_0x15f5('0x3d'),'$like','$notLike',_0x15f5('0x3e'),_0x15f5('0x3f'),_0x15f5('0x40'),'$overlap','$contains',_0x15f5('0x41'),_0x15f5('0x42')]);_0x46e2a1['attributes']=_[_0x15f5('0x43')](_0x1f6200[_0x15f5('0x34')],qs[_0x15f5('0x44')](_0x1c4188[_0x15f5('0x31')][_0x15f5('0x44')]));_0x46e2a1[_0x15f5('0x45')]=_0x46e2a1[_0x15f5('0x45')][_0x15f5('0x46')]?_0x46e2a1[_0x15f5('0x45')]:_0x1f6200[_0x15f5('0x34')];if(!_0x1c4188[_0x15f5('0x31')][_0x15f5('0x47')](_0x15f5('0x48'))){_0x46e2a1[_0x15f5('0x20')]=qs[_0x15f5('0x20')](_0x1c4188[_0x15f5('0x31')][_0x15f5('0x20')]);_0x46e2a1[_0x15f5('0x1f')]=qs[_0x15f5('0x1f')](_0x1c4188[_0x15f5('0x31')][_0x15f5('0x1f')]);}_0x46e2a1['order']=qs[_0x15f5('0x49')](_0x1c4188[_0x15f5('0x31')][_0x15f5('0x49')]);_0x46e2a1['where']=qs[_0x15f5('0x33')](_['pick'](_0x1c4188['query'],_0x1f6200[_0x15f5('0x33')]),_0x221c2e);if(_0x1c4188[_0x15f5('0x31')][_0x15f5('0x4a')]){_0x46e2a1[_0x15f5('0x4b')]=_[_0x15f5('0x4c')](_0x46e2a1[_0x15f5('0x4b')],{'$or':_['map'](_0x221c2e,function(_0x61ab3d){if(_0x61ab3d['type']!=='VIRTUAL'){var _0x245e2b={};_0x245e2b[_0x61ab3d[_0x15f5('0x2a')]]={'$like':'%'+_0x1c4188['query'][_0x15f5('0x4a')]+'%'};return _0x245e2b;}})});}_0x46e2a1=_[_0x15f5('0x4c')]({},_0x46e2a1,_0x1c4188[_0x15f5('0x4d')]);var _0x5d1dec={'where':_0x46e2a1[_0x15f5('0x4b')]};return db[_0x15f5('0x2c')]['count'](_0x5d1dec)[_0x15f5('0x4e')](function(_0x1f2c50){_0x109bd5[_0x15f5('0x1e')]=_0x1f2c50;if(_0x1c4188[_0x15f5('0x31')][_0x15f5('0x4f')]){_0x46e2a1[_0x15f5('0x50')]=[{'all':!![]}];}return db[_0x15f5('0x2c')]['findAll'](_0x46e2a1);})[_0x15f5('0x4e')](function(_0xafd4ee){_0x109bd5[_0x15f5('0x51')]=_0xafd4ee;return _0x109bd5;})[_0x15f5('0x4e')](respondWithFilteredResult(_0x516bb8,_0x46e2a1))[_0x15f5('0x52')](handleError(_0x516bb8,null));};exports[_0x15f5('0x53')]=function(_0x17342b,_0x25b719){var _0x359b60={'raw':!![],'where':{'id':_0x17342b[_0x15f5('0x54')]['id']}},_0x5e911c={};_0x5e911c['model']=_[_0x15f5('0x32')](db[_0x15f5('0x2c')]['rawAttributes']);_0x5e911c[_0x15f5('0x31')]=_[_0x15f5('0x32')](_0x17342b[_0x15f5('0x31')]);_0x5e911c['filters']=_[_0x15f5('0x43')](_0x5e911c[_0x15f5('0x34')],_0x5e911c[_0x15f5('0x31')]);_0x359b60[_0x15f5('0x45')]=_['intersection'](_0x5e911c[_0x15f5('0x34')],qs[_0x15f5('0x44')](_0x17342b[_0x15f5('0x31')][_0x15f5('0x44')]));_0x359b60[_0x15f5('0x45')]=_0x359b60[_0x15f5('0x45')][_0x15f5('0x46')]?_0x359b60[_0x15f5('0x45')]:_0x5e911c[_0x15f5('0x34')];if(_0x17342b[_0x15f5('0x31')][_0x15f5('0x4f')]){_0x359b60[_0x15f5('0x50')]=[{'all':!![]}];}_0x359b60=_[_0x15f5('0x4c')]({},_0x359b60,_0x17342b['options']);return db[_0x15f5('0x2c')]['find'](_0x359b60)[_0x15f5('0x4e')](handleEntityNotFound(_0x25b719,null))[_0x15f5('0x4e')](respondWithResult(_0x25b719,null))[_0x15f5('0x52')](handleError(_0x25b719,null));};exports['create']=function(_0x5d8414,_0x45216c){return db[_0x15f5('0x2c')][_0x15f5('0x55')](_0x5d8414[_0x15f5('0x56')],{})[_0x15f5('0x4e')](respondWithResult(_0x45216c,0xc9))[_0x15f5('0x52')](handleError(_0x45216c,null));};exports[_0x15f5('0x26')]=function(_0x422290,_0x4dbd90){if(_0x422290[_0x15f5('0x56')]['id']){delete _0x422290[_0x15f5('0x56')]['id'];}return db[_0x15f5('0x2c')][_0x15f5('0x57')]({'where':{'id':_0x422290[_0x15f5('0x54')]['id']}})['then'](handleEntityNotFound(_0x4dbd90,null))[_0x15f5('0x4e')](saveUpdates(_0x422290[_0x15f5('0x56')],null))['then'](respondWithResult(_0x4dbd90,null))[_0x15f5('0x52')](handleError(_0x4dbd90,null));};exports[_0x15f5('0x58')]=function(_0xec30ba,_0x1eeb9d){return db[_0x15f5('0x2c')][_0x15f5('0x58')]()[_0x15f5('0x4e')](respondWithResult(_0x1eeb9d,null))[_0x15f5('0x52')](handleError(_0x1eeb9d,null));};exports['destroy']=function(_0x38b904,_0x27044e){var _0x476084;return db[_0x15f5('0x2c')]['find']({'where':{'id':_0x38b904[_0x15f5('0x54')]['id']}})[_0x15f5('0x4e')](handleEntityNotFound(_0x27044e,null))[_0x15f5('0x4e')](function(_0x2f7ad3){if(_0x2f7ad3){return _0x2f7ad3[_0x15f5('0x27')]()[_0x15f5('0x4e')](function(_0x1c721){return _0x1c721;});}})[_0x15f5('0x4e')](function(_0x109a8b){_0x476084=_0x109a8b;if(_0x109a8b){if(_0x109a8b[_0x15f5('0x59')]||_0x109a8b[_0x15f5('0x5a')]){return db[_0x109a8b[_0x15f5('0x59')]?_0x15f5('0x5b'):_0x15f5('0x5c')][_0x15f5('0x57')]({'where':{'id':_0x109a8b[_0x15f5('0x59')]?_0x109a8b[_0x15f5('0x59')]:_0x109a8b[_0x15f5('0x5a')]},'attributes':['id',_0x15f5('0x2a')],'raw':!![]});}}})[_0x15f5('0x4e')](function(_0x10eb00){var _0x48fa5b={};if(_0x10eb00){_['merge'](_0x48fa5b,_['omit'](_0x476084['dataValues'],[_0x15f5('0x5d'),_0x15f5('0x5e'),'id']));_0x48fa5b[_0x15f5('0x5f')]=0x15;_0x48fa5b[_0x15f5('0x60')]='deleted';_0x48fa5b[_0x15f5('0x61')]=_0x10eb00[_0x15f5('0x2a')];_0x48fa5b[_0x15f5('0x62')]=_0x38b904[_0x15f5('0x63')][_0x15f5('0x2a')];_0x48fa5b['UserId']=_0x38b904[_0x15f5('0x63')]['id'];_0x48fa5b[_0x15f5('0x64')]=!![];_0x48fa5b[_0x15f5('0x65')]=moment()[_0x15f5('0x66')](_0x15f5('0x67'));_0x48fa5b[_0x15f5('0x68')]=_0x476084[_0x15f5('0x69')];_0x48fa5b[_0x15f5('0x6a')]=_0x476084[_0x15f5('0x59')]?'queue':'ivr';return db[_0x15f5('0x6b')][_0x15f5('0x57')]({'where':{'id':_0x48fa5b['ContactId']},'attributes':[_0x15f5('0x6c'),'lastName']})['then'](function(_0x5a0946){if(!_[_0x15f5('0x6d')](_0x27044e)&&!_[_0x15f5('0x6d')](_0x5a0946[_0x15f5('0x6c')])){_0x48fa5b[_0x15f5('0x6e')]=_0x5a0946[_0x15f5('0x6c')];if(!_[_0x15f5('0x6d')](_0x5a0946[_0x15f5('0x6f')])){_0x48fa5b[_0x15f5('0x6e')]+='\x20'+_0x5a0946[_0x15f5('0x6f')];}}})['finally'](function(){return db['CmHopperFinal'][_0x15f5('0x55')](_0x48fa5b);});}})[_0x15f5('0x4e')](function(){return _0x27044e[_0x15f5('0x1b')](0xcc)[_0x15f5('0x1a')]();})[_0x15f5('0x52')](handleError(_0x27044e,null));};exports['getPreview']=function(_0xf05804,_0x42f10f,_0x18fcf5){var _0x9bac86=[];return db['CmContact'][_0x15f5('0x58')]()['then'](function(_0x4fbd24){_0x9bac86=_[_0x15f5('0x32')](_0x4fbd24);return _0xf05804[_0x15f5('0x63')]['getVoiceQueues']({'where':{'type':_0x15f5('0x70'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x15f5('0x71'),_0x15f5('0x72')],'raw':!![]});})[_0x15f5('0x4e')](function(_0x5120e8){if(_0x5120e8&&_0x5120e8[_0x15f5('0x46')]){return db[_0x15f5('0x73')][_0x15f5('0x74')](function(_0x571912){var _0x32f646={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x15f5('0x66')](_0x15f5('0x67'))},'VoiceQueueId':{'$in':_[_0x15f5('0x2b')](_0x5120e8,'id')},'$or':[{'UserId':null},{'UserId':_0xf05804[_0x15f5('0x63')]['id']}]};var _0xfd28b={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5120e8)['filter']([_0x15f5('0x72'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0xf05804[_0x15f5('0x63')]['id']}]};var _0x5307d6={'$or':[_0x32f646,_0xfd28b]};var _0xb303b6=[];if(_0xf05804[_0x15f5('0x56')][_0x15f5('0x75')]&&_0xf05804[_0x15f5('0x56')][_0x15f5('0x75')]===_0x15f5('0x76')){if(!_[_0x15f5('0x77')](_0xf05804['body'][_0x15f5('0x78')])){_0x5307d6['id']={'$in':_0xf05804['body'][_0x15f5('0x78')]};}_0xb303b6=[[_0x15f5('0x79'),_0x15f5('0x7a')],[_0x15f5('0x7b'),_0x5120e8[0x0][_0x15f5('0x71')]===_0x15f5('0x7a')?_0x15f5('0x7c'):_0x15f5('0x7a')],db[_0x15f5('0x73')][_0x15f5('0x7d')](_0x15f5('0x7e')),['id',_0x15f5('0x7c')]];}else{if(!_[_0x15f5('0x77')](_0xf05804[_0x15f5('0x56')][_0x15f5('0x78')])){_0x5307d6['id']={'$notIn':_0xf05804[_0x15f5('0x56')][_0x15f5('0x78')]};}_0xb303b6=[[_0x15f5('0x79'),_0x15f5('0x7c')],[_0x15f5('0x7b'),_0x5120e8[0x0][_0x15f5('0x71')]],db[_0x15f5('0x73')][_0x15f5('0x7d')](_0x15f5('0x7f')),['id',_0x15f5('0x7a')]];}return db['CmHopper'][_0x15f5('0x80')]({'attributes':['id',_0x15f5('0x81'),_0x15f5('0x82')],'where':_0x5307d6,'order':_0xb303b6,'transaction':_0x571912,'lock':_0x571912['LOCK'][_0x15f5('0x83')],'include':[{'model':db['CmContact'],'as':_0x15f5('0x84'),'attributes':_0x9bac86,'include':[{'model':db['CmCompany'],'as':_0x15f5('0x85'),'attributes':['id',_0x15f5('0x2a')]}]},{'model':db['CmList'],'as':_0x15f5('0x86'),'attributes':['id',_0x15f5('0x2a')]},{'model':db['VoiceQueue'],'as':_0x15f5('0x87'),'attributes':['id',_0x15f5('0x2a'),'dialActive']}]})[_0x15f5('0x4e')](function(_0x2cd9d7){if(_0x2cd9d7){return _0x2cd9d7[_0x15f5('0x26')]({'UserId':_0xf05804[_0x15f5('0x63')]['id']},{'transaction':_0x571912});}});});}})[_0x15f5('0x4e')](handleEntityNotFound(_0x42f10f,null))[_0x15f5('0x4e')](respondWithResult(_0x42f10f,null))[_0x15f5('0x52')](handleError(_0x42f10f,null));};exports[_0x15f5('0x88')]=function(_0x593823,_0x2279a3,_0x1127a4){var _0x1ded17=[];return db['CmContact'][_0x15f5('0x58')]()[_0x15f5('0x4e')](function(_0x36dff9){_0x1ded17=_[_0x15f5('0x32')](_0x36dff9);return _0x593823[_0x15f5('0x63')][_0x15f5('0x89')]({'where':{'type':_0x15f5('0x70'),'dialActive':!![],'dialMethod':_0x15f5('0x8a')},'attributes':['id','dialOrderByScheduledAt',_0x15f5('0x72')],'raw':!![]});})[_0x15f5('0x4e')](function(_0x220a38){if(_0x220a38&&_0x220a38[_0x15f5('0x46')]){return db[_0x15f5('0x73')]['transaction'](function(_0x504df4){var _0x693944={'active':![],'recallme':!![],'id':_0x593823[_0x15f5('0x56')][_0x15f5('0x8b')]};return db['CmHopper'][_0x15f5('0x80')]({'attributes':['id',_0x15f5('0x81'),_0x15f5('0x82')],'where':_0x693944,'transaction':_0x504df4,'lock':_0x504df4['LOCK'][_0x15f5('0x83')],'include':[{'model':db[_0x15f5('0x6b')],'as':_0x15f5('0x84'),'attributes':_0x1ded17,'include':[{'model':db['CmCompany'],'as':_0x15f5('0x85'),'attributes':['id',_0x15f5('0x2a')]}]},{'model':db[_0x15f5('0x8c')],'as':_0x15f5('0x86'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x15f5('0x87'),'attributes':['id','name',_0x15f5('0x8d')]}]})[_0x15f5('0x4e')](function(_0x201bde){if(_0x201bde){return _0x201bde['update']({'UserId':_0x593823[_0x15f5('0x63')]['id']},{'transaction':_0x504df4});}});});}})[_0x15f5('0x4e')](handleEntityNotFound(_0x2279a3,null))['then'](respondWithResult(_0x2279a3,null))[_0x15f5('0x52')](handleError(_0x2279a3,null));};exports[_0x15f5('0x8e')]=function(_0x46f8ed,_0x50bcec,_0x27541d){return _0x46f8ed[_0x15f5('0x63')][_0x15f5('0x89')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x15f5('0x8a')},'attributes':['id'],'raw':!![]})[_0x15f5('0x4e')](function(_0x2993e3){if(_0x2993e3&&_0x2993e3[_0x15f5('0x46')]){return db[_0x15f5('0x2c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x15f5('0x66')](_0x15f5('0x67'))},'VoiceQueueId':{'$in':_[_0x15f5('0x2b')](_0x2993e3,'id')},'$or':[{'UserId':null},{'UserId':_0x46f8ed[_0x15f5('0x63')]['id']}]}});}return 0x0;})['then'](function(_0x1b4c9e){if(!_['isNil'](_0x1b4c9e)&&_['isNumber'](_0x1b4c9e)){return _0x50bcec[_0x15f5('0x1b')](0xc8)['json']({'contacts':_0x1b4c9e});}else{logger['error'](_0x15f5('0x8f'),_0x15f5('0x8e'),0x194,_0x15f5('0x90'));_0x50bcec['sendStatus'](0x194);}})['catch'](handleError(_0x50bcec,null));};exports[_0x15f5('0x91')]=function(_0x390996,_0x1a56d5,_0x43c178){var _0x134b70=shared[_0x15f5('0x92')];var _0x3793ae=[];_[_0x15f5('0x2b')](_0x134b70,function(_0x48bdc5){_0x3793ae[_0x15f5('0x93')]({'id':_0x48bdc5['name'],'name':_0x48bdc5['name'],'utcOffset':_0x48bdc5[_0x15f5('0x94')]});});return _0x1a56d5[_0x15f5('0x1b')](0xc8)[_0x15f5('0x1c')]({'tz':_0x3793ae});};exports['getTimezone']=function(_0x3f9bf9,_0x452748,_0x1b4d86){var _0x1b5bc3=shared[_0x15f5('0x92')];var _0x507712={};if(!_[_0x15f5('0x6d')](_0x1b5bc3[_0x3f9bf9['body']['id']]))_0x507712=_0x1b5bc3[_0x3f9bf9[_0x15f5('0x56')]['id']];return _0x452748[_0x15f5('0x1b')](0xc8)[_0x15f5('0x1c')](_0x507712);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6215b51..11b8306 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 _0x3f8a=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x16b5e5,_0x5cfe59){var _0x12c623=function(_0x24498c){while(--_0x24498c){_0x16b5e5['push'](_0x16b5e5['shift']());}};_0x12c623(++_0x5cfe59);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x16c7d4,_0x1fd6a5){_0x16c7d4=_0x16c7d4-0x0;var _0x54c042=_0x3f8a[_0x16c7d4];return _0x54c042;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x43614d,_0x343cbd){_0x43614d=_0x43614d-0x0;var _0x45d214=_0xb4c7[_0x43614d];return _0x45d214;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmHopper',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[{'name':_0x7b4c('0xc'),'fields':['scheduledat']},{'name':_0x7b4c('0xd'),'fields':[_0x7b4c('0xd')]},{'name':_0x7b4c('0xe'),'fields':[_0x7b4c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b2b4fef..701a8c5 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 _0xc419=['debug','catch','CreateCmHopper','UpdateCmHopper','update','body','destroy','DestroyCmHopper','CmContact','sequelize','transaction','findAll','LOCK','UPDATE','keys','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','describe','GetContactRecallMe','Contact','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','User','CmList','List','NOW()\x20+\x20INTERVAL\x20','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopper','options','raw','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','find','where'];(function(_0x257ac3,_0x4d6f9e){var _0x1aa181=function(_0x381f03){while(--_0x381f03){_0x257ac3['push'](_0x257ac3['shift']());}};_0x1aa181(++_0x4d6f9e);}(_0xc419,0x94));var _0x9c41=function(_0x363e52,_0x41697d){_0x363e52=_0x363e52-0x0;var _0x2a0797=_0xc419[_0x363e52];return _0x2a0797;};'use strict';var _=require(_0x9c41('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c41('0x1'));var rs=require(_0x9c41('0x2'));var fs=require('fs');var Redis=require(_0x9c41('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c41('0x4'));var logger=require(_0x9c41('0x5'))(_0x9c41('0x6'));var config=require(_0x9c41('0x7'));var jayson=require(_0x9c41('0x8'));const {validateExpressRequest}=require(_0x9c41('0x9'));var client=jayson['client'][_0x9c41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x535514,_0x834a4d,_0x2fa9dc){return new BPromise(function(_0x1699f9,_0x26091b){return client[_0x9c41('0xb')](_0x535514,_0x2fa9dc)[_0x9c41('0xc')](function(_0x12732b){logger[_0x9c41('0xd')](_0x9c41('0xe'),_0x834a4d,_0x9c41('0xf'));logger['debug'](_0x9c41('0x10'),_0x834a4d,_0x9c41('0xf'),JSON[_0x9c41('0x11')](_0x12732b));if(_0x12732b[_0x9c41('0x12')]){if(_0x12732b[_0x9c41('0x12')][_0x9c41('0x13')]===0x1f4){logger[_0x9c41('0x12')](_0x9c41('0xe'),_0x834a4d,_0x12732b['error']['message']);return _0x26091b(_0x12732b[_0x9c41('0x12')][_0x9c41('0x14')]);}logger[_0x9c41('0x12')](_0x9c41('0xe'),_0x834a4d,_0x12732b[_0x9c41('0x12')][_0x9c41('0x14')]);return _0x1699f9(_0x12732b['error']['message']);}else{logger[_0x9c41('0xd')](_0x9c41('0xe'),_0x834a4d,'request\x20sent');_0x1699f9(_0x12732b[_0x9c41('0x15')]['message']);}})['catch'](function(_0x589fa3){logger[_0x9c41('0x12')](_0x9c41('0xe'),_0x834a4d,_0x589fa3);_0x26091b(_0x589fa3);});});}exports['GetCmHopper']=function(_0x6d1df5){var _0x20e850=this;return new Promise(function(_0xac2cbc,_0x256ebd){return db[_0x9c41('0x16')]['findAll']({'raw':_0x6d1df5[_0x9c41('0x17')]?_0x6d1df5[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![],'where':_0x6d1df5[_0x9c41('0x17')]?_0x6d1df5[_0x9c41('0x17')]['where']||null:null,'attributes':_0x6d1df5[_0x9c41('0x17')]?_0x6d1df5[_0x9c41('0x17')][_0x9c41('0x19')]||null:null,'limit':_0x6d1df5['options']?_0x6d1df5[_0x9c41('0x17')][_0x9c41('0x1a')]||null:null,'include':_0x6d1df5[_0x9c41('0x17')]?_0x6d1df5[_0x9c41('0x17')][_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x6d1df5[_0x9c41('0x17')]['include'],function(_0x7dfe1a){return{'model':db[_0x7dfe1a[_0x9c41('0x1d')]],'as':_0x7dfe1a['as'],'attributes':_0x7dfe1a[_0x9c41('0x19')],'include':_0x7dfe1a[_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x7dfe1a[_0x9c41('0x1b')],function(_0x4721b2){return{'model':db[_0x4721b2[_0x9c41('0x1d')]],'as':_0x4721b2['as'],'attributes':_0x4721b2[_0x9c41('0x19')],'include':_0x4721b2[_0x9c41('0x1b')]?_['map'](_0x4721b2['include'],function(_0x439dea){return{'model':db[_0x439dea[_0x9c41('0x1d')]],'as':_0x439dea['as'],'attributes':_0x439dea[_0x9c41('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c41('0xc')](function(_0x3893fa){logger[_0x9c41('0xd')]('GetCmHopper',_0x6d1df5);logger['debug'](_0x9c41('0x1e'),_0x6d1df5,JSON[_0x9c41('0x11')](_0x3893fa));_0xac2cbc(_0x3893fa);})['catch'](function(_0x59bffc){logger[_0x9c41('0x12')](_0x9c41('0x1e'),_0x59bffc[_0x9c41('0x14')],_0x6d1df5);_0x256ebd(_0x20e850[_0x9c41('0x12')](0x1f4,_0x59bffc['message']));});});};exports[_0x9c41('0x1f')]=function(_0x30bf30){var _0x32502d=this;return new Promise(function(_0xec1349,_0x14d5d9){return db[_0x9c41('0x16')][_0x9c41('0x20')]({'raw':_0x30bf30[_0x9c41('0x17')]?_0x30bf30[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![],'where':_0x30bf30[_0x9c41('0x17')]?_0x30bf30['options'][_0x9c41('0x21')]||null:null,'attributes':_0x30bf30['options']?_0x30bf30[_0x9c41('0x17')][_0x9c41('0x19')]||null:null,'include':_0x30bf30['options']?_0x30bf30[_0x9c41('0x17')]['include']?_[_0x9c41('0x1c')](_0x30bf30[_0x9c41('0x17')]['include'],function(_0x1097a6){return{'model':db[_0x1097a6[_0x9c41('0x1d')]],'as':_0x1097a6['as'],'attributes':_0x1097a6[_0x9c41('0x19')],'include':_0x1097a6['include']?_[_0x9c41('0x1c')](_0x1097a6[_0x9c41('0x1b')],function(_0x5e0e28){return{'model':db[_0x5e0e28['model']],'as':_0x5e0e28['as'],'attributes':_0x5e0e28[_0x9c41('0x19')],'include':_0x5e0e28[_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x5e0e28[_0x9c41('0x1b')],function(_0x46cc41){return{'model':db[_0x46cc41['model']],'as':_0x46cc41['as'],'attributes':_0x46cc41[_0x9c41('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c41('0xc')](function(_0x18cc1b){logger[_0x9c41('0xd')](_0x9c41('0x1f'),_0x30bf30);logger[_0x9c41('0x22')]('ShowCmHopper',_0x30bf30,JSON['stringify'](_0x18cc1b));_0xec1349(_0x18cc1b);})[_0x9c41('0x23')](function(_0x3ffe21){logger[_0x9c41('0x12')](_0x9c41('0x1f'),_0x3ffe21[_0x9c41('0x14')],_0x30bf30);_0x14d5d9(_0x32502d[_0x9c41('0x12')](0x1f4,_0x3ffe21[_0x9c41('0x14')]));});});};exports['CreateCmHopper']=function(_0x3f9433){var _0x1b1cd9=this;return new Promise(function(_0x4495ff,_0x253ad8){return db[_0x9c41('0x16')]['create'](_0x3f9433['body'],{'raw':_0x3f9433[_0x9c41('0x17')]?_0x3f9433[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![]})[_0x9c41('0xc')](function(_0x4d1b9e){logger[_0x9c41('0xd')](_0x9c41('0x24'),_0x3f9433);logger[_0x9c41('0x22')](_0x9c41('0x24'),_0x3f9433,JSON['stringify'](_0x4d1b9e));_0x4495ff(_0x4d1b9e);})[_0x9c41('0x23')](function(_0x1823bb){logger[_0x9c41('0x12')](_0x9c41('0x24'),_0x1823bb['message'],_0x3f9433);_0x253ad8(_0x1b1cd9[_0x9c41('0x12')](0x1f4,_0x1823bb[_0x9c41('0x14')]));});});};exports[_0x9c41('0x25')]=function(_0x2dea3c){var _0x46d6e8=this;return new Promise(function(_0x309d8b,_0x5be875){return db[_0x9c41('0x16')][_0x9c41('0x26')](_0x2dea3c[_0x9c41('0x27')],{'raw':_0x2dea3c[_0x9c41('0x17')]?_0x2dea3c[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dea3c[_0x9c41('0x17')]?_0x2dea3c[_0x9c41('0x17')]['where']||null:null,'attributes':_0x2dea3c['options']?_0x2dea3c[_0x9c41('0x17')]['attributes']||null:null,'limit':_0x2dea3c[_0x9c41('0x17')]?_0x2dea3c[_0x9c41('0x17')]['limit']||null:null})[_0x9c41('0xc')](function(_0x2721b5){logger[_0x9c41('0xd')](_0x9c41('0x25'),_0x2dea3c);logger[_0x9c41('0xd')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x9c41('0x11')](_0x2dea3c[_0x9c41('0x17')][_0x9c41('0x21')]),_0x2dea3c[_0x9c41('0x27')]['active']);logger['debug']('UpdateCmHopper',_0x2dea3c,JSON[_0x9c41('0x11')](_0x2721b5));_0x309d8b(_0x2721b5);})['catch'](function(_0x2002f9){logger['error'](_0x9c41('0x25'),_0x2002f9[_0x9c41('0x14')],_0x2dea3c);_0x5be875(_0x46d6e8[_0x9c41('0x12')](0x1f4,_0x2002f9[_0x9c41('0x14')]));});});};exports['DestroyCmHopper']=function(_0x31c708){var _0x4b21b5=this;return new Promise(function(_0x147f17,_0x4d6976){return db[_0x9c41('0x16')][_0x9c41('0x28')]({'where':_0x31c708[_0x9c41('0x17')]?_0x31c708[_0x9c41('0x17')]['where']||null:null})[_0x9c41('0xc')](function(_0x1e7cfc){logger['info'](_0x9c41('0x29'),_0x31c708);logger[_0x9c41('0x22')](_0x9c41('0x29'),_0x31c708,JSON['stringify'](_0x1e7cfc));_0x147f17(_0x1e7cfc);})['catch'](function(_0xb483dd){logger[_0x9c41('0x12')]('DestroyCmHopper',_0xb483dd['message'],_0x31c708);_0x4d6976(_0x4b21b5['error'](0x1f4,_0xb483dd['message']));});});};exports['GetContactDialer']=function(_0x266420){var _0x4c5260=this;return new Promise(function(_0x8c12c4,_0x404833){return db[_0x9c41('0x2a')]['describe']()['then'](function(_0xfa1795){return db[_0x9c41('0x2b')][_0x9c41('0x2c')](function(_0x5010bc){return db[_0x9c41('0x16')][_0x9c41('0x2d')]({'where':_0x266420['options']?_0x266420[_0x9c41('0x17')]['where']||null:null,'attributes':_0x266420[_0x9c41('0x17')]?_0x266420['options'][_0x9c41('0x19')]||null:null,'limit':_0x266420[_0x9c41('0x17')]?_0x266420[_0x9c41('0x17')]['limit']||null:null,'order':_0x266420[_0x9c41('0x17')]?_0x266420[_0x9c41('0x17')]['order']||null:null,'transaction':_0x5010bc,'lock':_0x5010bc[_0x9c41('0x2e')][_0x9c41('0x2f')],'include':[{'model':db[_0x9c41('0x2a')],'as':'Contact','attributes':_[_0x9c41('0x30')](_0xfa1795)},{'model':db['User'],'as':_0x9c41('0x31'),'attributes':['id',_0x9c41('0x32'),_0x9c41('0x33')]}]})[_0x9c41('0xc')](function(_0x14933d){var _0x133068=[];var _0x26661d=[];for(var _0x4ac5e1=0x0;_0x4ac5e1<_0x14933d[_0x9c41('0x34')];_0x4ac5e1+=0x1){var _0x56f16f=_0x14933d[_0x4ac5e1][_0x9c41('0x35')];if(_0x56f16f===null){_0x133068[_0x9c41('0x36')](_0x14933d[_0x4ac5e1][_0x9c41('0x26')](_0x266420[_0x9c41('0x27')],{'transaction':_0x5010bc}));}else if(!_0x26661d[_0x9c41('0x37')](_0x56f16f)){_0x26661d[_0x9c41('0x36')](_0x56f16f);_0x133068[_0x9c41('0x36')](_0x14933d[_0x4ac5e1][_0x9c41('0x26')](_0x266420[_0x9c41('0x27')],{'transaction':_0x5010bc}));}}return BPromise[_0x9c41('0x38')](_0x133068);});})['then'](function(_0x17db98){logger[_0x9c41('0xd')]('GetContactDialer',_0x266420);if(_0x17db98[_0x9c41('0x34')]>0x0){logger['info'](_0x9c41('0x39'),_0x17db98[0x0][_0x9c41('0x3a')]['id'],_0x17db98[0x0][_0x9c41('0x3a')][_0x9c41('0x3b')],_0x17db98[0x0][_0x9c41('0x3a')][_0x9c41('0x3c')]);}logger[_0x9c41('0x22')](_0x9c41('0x3d'),_0x266420,JSON['stringify'](_0x17db98));_0x8c12c4(_0x17db98);})[_0x9c41('0x23')](function(_0x317990){logger['error'](_0x9c41('0x3d'),_0x317990[_0x9c41('0x14')],_0x266420);_0x404833(_0x4c5260['error'](0x1f4,_0x317990[_0x9c41('0x14')]));});});});};exports[_0x9c41('0x3e')]=function(_0x5c8d82){var _0x3b89c4=this;return new Promise(function(_0x28c67b,_0x57c63b){return db['sequelize'][_0x9c41('0x2c')](function(_0x165a61){return db[_0x9c41('0x3f')][_0x9c41('0x40')](_0x5c8d82['body'],{'raw':_0x5c8d82[_0x9c41('0x17')]?_0x5c8d82[_0x9c41('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x165a61})[_0x9c41('0xc')](function(){logger['info'](_0x9c41('0x41'),JSON['stringify'](_0x5c8d82[_0x9c41('0x17')]['where']),_0x5c8d82[_0x9c41('0x17')][_0x9c41('0x21')][_0x9c41('0x3c')]);return db[_0x9c41('0x16')][_0x9c41('0x28')]({'where':_0x5c8d82['options']?_0x5c8d82[_0x9c41('0x17')]['where']||null:null,'transaction':_0x165a61});});})[_0x9c41('0xc')](function(_0x4b9365){logger[_0x9c41('0xd')](_0x9c41('0x3e'),_0x5c8d82);logger[_0x9c41('0x22')](_0x9c41('0x3e'),_0x5c8d82,JSON[_0x9c41('0x11')](_0x4b9365));_0x28c67b(_0x4b9365);})[_0x9c41('0x23')](function(_0x4d4334){logger[_0x9c41('0x12')]('MoveContactManagedDialer',_0x4d4334['message'],_0x5c8d82);_0x57c63b(_0x3b89c4[_0x9c41('0x12')](0x1f4,_0x4d4334['message']));});});};exports['CountReScheduled']=function(_0x2f252c){var _0x42b1a8=this;return new Promise(function(_0x5c4e26,_0x11bdd1){return db[_0x9c41('0x16')][_0x9c41('0x2d')]({'raw':_0x2f252c['options']?_0x2f252c[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![],'where':_0x2f252c['options']?_0x2f252c[_0x9c41('0x17')][_0x9c41('0x21')]||null:null,'attributes':[[db[_0x9c41('0x2b')]['fn'](_0x9c41('0x42'),db[_0x9c41('0x2b')]['fn']('IF',db[_0x9c41('0x2b')][_0x9c41('0x43')](_0x9c41('0x44')+util[_0x9c41('0x45')](_0x9c41('0x46'),moment()[_0x9c41('0x45')](_0x9c41('0x47')))+_0x9c41('0x48')))),_0x9c41('0x49')]]})[_0x9c41('0xc')](function(_0x22f9d7){logger['info']('CountReScheduled',_0x2f252c);logger['debug'](_0x9c41('0x4a'),_0x2f252c,JSON['stringify'](_0x22f9d7));_0x5c4e26(_0x22f9d7);})['catch'](function(_0x239355){logger[_0x9c41('0x12')](_0x9c41('0x4a'),_0x239355[_0x9c41('0x14')],_0x2f252c);_0x11bdd1(_0x42b1a8[_0x9c41('0x12')](0x1f4,_0x239355[_0x9c41('0x14')]));});});};exports['GetContactRecallMe']=function(_0xe7384b){var _0x13288d=this;return new Promise(function(_0x585994,_0x202783){return db['CmContact'][_0x9c41('0x4b')]()[_0x9c41('0xc')](function(_0x31afef){return db[_0x9c41('0x2b')][_0x9c41('0x2c')](function(_0x5f3b4f){return db['CmHopper'][_0x9c41('0x2d')]({'where':_0xe7384b['options']?_0xe7384b['options'][_0x9c41('0x21')]||null:null,'attributes':_0xe7384b[_0x9c41('0x17')]?_0xe7384b['options'][_0x9c41('0x19')]||null:null,'limit':0x1,'order':_0xe7384b[_0x9c41('0x17')]?_0xe7384b['options']['order']||null:null,'group':db[_0x9c41('0x16')][_0x9c41('0x35')],'transaction':_0x5f3b4f,'lock':_0x5f3b4f[_0x9c41('0x2e')][_0x9c41('0x2f')],'include':_0xe7384b[_0x9c41('0x17')]?_0xe7384b[_0x9c41('0x17')][_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0xe7384b[_0x9c41('0x17')][_0x9c41('0x1b')],function(_0x51027e){return{'model':db[_0x51027e[_0x9c41('0x1d')]],'as':_0x51027e['as'],'attributes':_0x51027e[_0x9c41('0x19')],'include':_0x51027e[_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x51027e[_0x9c41('0x1b')],function(_0x1704f0){return{'model':db[_0x1704f0[_0x9c41('0x1d')]],'as':_0x1704f0['as'],'attributes':_0x1704f0[_0x9c41('0x19')],'include':_0x1704f0[_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x1704f0[_0x9c41('0x1b')],function(_0x200dfe){return{'model':db[_0x200dfe['model']],'as':_0x200dfe['as'],'attributes':_0x200dfe[_0x9c41('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c41('0xc')](function(_0x4ac399){var _0x243005=[];for(var _0x417303=0x0;_0x417303<_0x4ac399['length'];_0x417303+=0x1){_0x243005[_0x9c41('0x36')](_0x4ac399[_0x417303]['update'](_0xe7384b[_0x9c41('0x27')],{'transaction':_0x5f3b4f}));}return BPromise[_0x9c41('0x38')](_0x243005);});})['then'](function(_0x655768){logger[_0x9c41('0xd')](_0x9c41('0x4c'),_0xe7384b);logger[_0x9c41('0x22')]('GetContactRecallMe',_0xe7384b,JSON[_0x9c41('0x11')](_0x655768));_0x585994(_0x655768);})['catch'](function(_0x1478ca){logger[_0x9c41('0x12')](_0x9c41('0x4c'),_0x1478ca[_0x9c41('0x14')],_0xe7384b);_0x202783(_0x13288d[_0x9c41('0x12')](0x1f4,_0x1478ca['message']));});});});};exports['GetCmHopperPreview']=function(_0x385524){var _0x27bfb1=this;return new Promise(function(_0x2e4650,_0x39650d){db[_0x9c41('0x2a')][_0x9c41('0x4b')]()[_0x9c41('0xc')](function(_0x501197){return db[_0x9c41('0x16')][_0x9c41('0x2d')]({'raw':_0x385524[_0x9c41('0x17')]?_0x385524[_0x9c41('0x17')][_0x9c41('0x18')]===undefined?!![]:![]:!![],'where':_0x385524[_0x9c41('0x17')]?_0x385524[_0x9c41('0x17')][_0x9c41('0x21')]||null:null,'attributes':_0x385524[_0x9c41('0x17')]?_0x385524[_0x9c41('0x17')][_0x9c41('0x19')]||null:null,'limit':_0x385524[_0x9c41('0x17')]?_0x385524[_0x9c41('0x17')]['limit']||null:null,'include':_0x385524['options']?_0x385524[_0x9c41('0x17')][_0x9c41('0x1b')]?_['map'](_0x385524['options'][_0x9c41('0x1b')],function(_0xb7f4b4){return{'model':db[_0xb7f4b4[_0x9c41('0x1d')]],'as':_0xb7f4b4['as'],'attributes':_0xb7f4b4['as']===_0x9c41('0x4d')?_[_0x9c41('0x30')](_0x501197):_0xb7f4b4[_0x9c41('0x19')],'include':_0xb7f4b4['include']?_[_0x9c41('0x1c')](_0xb7f4b4[_0x9c41('0x1b')],function(_0x57b7e9){return{'model':db[_0x57b7e9[_0x9c41('0x1d')]],'as':_0x57b7e9['as'],'attributes':_0x57b7e9['attributes'],'include':_0x57b7e9[_0x9c41('0x1b')]?_[_0x9c41('0x1c')](_0x57b7e9['include'],function(_0x1bcf96){return{'model':db[_0x1bcf96[_0x9c41('0x1d')]],'as':_0x1bcf96['as'],'attributes':_0x1bcf96[_0x9c41('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aad36){logger[_0x9c41('0xd')]('GetCmHopper',_0x385524);logger[_0x9c41('0x22')](_0x9c41('0x1e'),_0x385524,JSON[_0x9c41('0x11')](_0x4aad36));_0x2e4650(_0x4aad36);})['catch'](function(_0x16595d){logger[_0x9c41('0x12')]('GetCmHopper',_0x16595d[_0x9c41('0x14')],_0x385524);_0x39650d(_0x27bfb1[_0x9c41('0x12')](0x1f4,_0x16595d[_0x9c41('0x14')]));});});});};exports[_0x9c41('0x4e')]=function(_0x262a6c){var _0xb5a587=this;return new Promise(function(_0x4deba1,_0x3a3872){return db[_0x9c41('0x2a')][_0x9c41('0x4f')]({'raw':!![],'where':{'phone':_0x262a6c[_0x9c41('0x17')][_0x9c41('0x21')][_0x9c41('0x50')]},'attributes':['id','dialTimezone'],'order':[['id',_0x9c41('0x51')]]})['then'](function(_0x3df1d7){logger[_0x9c41('0xd')](_0x9c41('0x52'),_0x262a6c);logger[_0x9c41('0x22')]('getContactByPhone',_0x262a6c,JSON[_0x9c41('0x11')](_0x3df1d7));_0x4deba1(_0x3df1d7);})['catch'](function(_0x11f727){logger[_0x9c41('0x12')](_0x9c41('0x52'),_0x11f727[_0x9c41('0x14')],_0x262a6c);_0x3a3872(_0xb5a587[_0x9c41('0x12')](0x1f4,_0x11f727[_0x9c41('0x14')]));});});};exports[_0x9c41('0x53')]=function(_0x2b7565){var _0x13e89e=this;return new Promise(function(_0x3684c4,_0x37b5a5){return db[_0x9c41('0x2b')][_0x9c41('0x2c')](function(_0x5b134f){return db[_0x9c41('0x16')][_0x9c41('0x26')]({'active':![]},{'where':{},'transaction':_0x5b134f})['then'](function(_0x2eb49a){logger[_0x9c41('0xd')](_0x9c41('0x53'),_0x2b7565);logger[_0x9c41('0x22')](_0x9c41('0x53'),_0x2b7565,JSON[_0x9c41('0x11')](_0x2eb49a));_0x3684c4(_0x2eb49a);})[_0x9c41('0x23')](function(_0x58f4fb){logger[_0x9c41('0x12')](_0x9c41('0x53'),_0x58f4fb[_0x9c41('0x14')],_0x2b7565);_0x37b5a5(_0x13e89e[_0x9c41('0x12')](0x1f4,_0x58f4fb[_0x9c41('0x14')]));});});});};exports[_0x9c41('0x54')]=function(_0x238eae){var _0x245b9b=this;var _0x166781=_0x238eae[_0x9c41('0x27')]['where'][_0x9c41('0x55')];var _0x1e683c=_0x238eae[_0x9c41('0x27')][_0x9c41('0x21')][_0x9c41('0x56')];return new Promise(function(_0x3110c0,_0x5d2f7d){return db[_0x9c41('0x16')][_0x9c41('0x2d')]({'where':{'voiceQueueId':_0x166781,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9c41('0x2b')][_0x9c41('0x43')]('NOW()\x20+\x20INTERVAL\x20'+_0x1e683c+'\x20MINUTE')}},'include':[{'model':db['CmContact'],'as':_0x9c41('0x4d')},{'model':db[_0x9c41('0x57')],'as':_0x9c41('0x31'),'attributes':['id',_0x9c41('0x32'),_0x9c41('0x33')]},{'model':db[_0x9c41('0x58')],'as':_0x9c41('0x59')}]})[_0x9c41('0xc')](function(_0x4a9890){return db[_0x9c41('0x2b')][_0x9c41('0x2c')](function(_0x5ef6fe){return db[_0x9c41('0x16')][_0x9c41('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x166781,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9c41('0x2b')][_0x9c41('0x43')](_0x9c41('0x5a')+_0x1e683c+'\x20MINUTE')}},'transaction':_0x5ef6fe})[_0x9c41('0xc')](function(_0x54145d){_0x3110c0(_0x4a9890);})[_0x9c41('0x23')](function(_0x9e49eb){logger[_0x9c41('0x12')](_0x9c41('0x54'),_0x9e49eb[_0x9c41('0x14')],_0x238eae);_0x5d2f7d(validateExpressRequest);});});})[_0x9c41('0x23')](function(_0x605406){logger['error'](_0x9c41('0x54'),_0x605406[_0x9c41('0x14')],_0x238eae);_0x5d2f7d(_0x245b9b[_0x9c41('0x12')](0x1f4,_0x605406[_0x9c41('0x14')]));});});}; \ No newline at end of file +var _0x5709=['all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','CmList','List','literal','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','request','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','GetCmHopper','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','voicePause','length','UserId','push','update','includes'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x5709,0x79));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9570('0x0'));var util=require(_0x9570('0x1'));var moment=require(_0x9570('0x2'));var BPromise=require(_0x9570('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9570('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9570('0x5'))(_0x9570('0x6'));var config=require(_0x9570('0x7'));var jayson=require(_0x9570('0x8'));const {validateExpressRequest}=require(_0x9570('0x9'));var client=jayson['client'][_0x9570('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30ea9f,_0x1b390b,_0x56cf68){return new BPromise(function(_0x409738,_0x2ef3d4){return client[_0x9570('0xb')](_0x30ea9f,_0x56cf68)['then'](function(_0x72cbf){logger[_0x9570('0xc')](_0x9570('0xd'),_0x1b390b,'request\x20sent');logger['debug'](_0x9570('0xe'),_0x1b390b,'request\x20sent',JSON[_0x9570('0xf')](_0x72cbf));if(_0x72cbf[_0x9570('0x10')]){if(_0x72cbf['error'][_0x9570('0x11')]===0x1f4){logger['error'](_0x9570('0xd'),_0x1b390b,_0x72cbf[_0x9570('0x10')][_0x9570('0x12')]);return _0x2ef3d4(_0x72cbf[_0x9570('0x10')][_0x9570('0x12')]);}logger[_0x9570('0x10')](_0x9570('0xd'),_0x1b390b,_0x72cbf[_0x9570('0x10')][_0x9570('0x12')]);return _0x409738(_0x72cbf[_0x9570('0x10')][_0x9570('0x12')]);}else{logger[_0x9570('0xc')](_0x9570('0xd'),_0x1b390b,_0x9570('0x13'));_0x409738(_0x72cbf[_0x9570('0x14')]['message']);}})[_0x9570('0x15')](function(_0x3af220){logger['error'](_0x9570('0xd'),_0x1b390b,_0x3af220);_0x2ef3d4(_0x3af220);});});}exports['GetCmHopper']=function(_0x2d8ef8){var _0x339016=this;return new Promise(function(_0x1dc9bf,_0x154934){return db['CmHopper'][_0x9570('0x16')]({'raw':_0x2d8ef8[_0x9570('0x17')]?_0x2d8ef8[_0x9570('0x17')][_0x9570('0x18')]===undefined?!![]:![]:!![],'where':_0x2d8ef8[_0x9570('0x17')]?_0x2d8ef8['options'][_0x9570('0x19')]||null:null,'attributes':_0x2d8ef8[_0x9570('0x17')]?_0x2d8ef8['options'][_0x9570('0x1a')]||null:null,'limit':_0x2d8ef8[_0x9570('0x17')]?_0x2d8ef8['options'][_0x9570('0x1b')]||null:null,'include':_0x2d8ef8[_0x9570('0x17')]?_0x2d8ef8[_0x9570('0x17')][_0x9570('0x1c')]?_[_0x9570('0x1d')](_0x2d8ef8[_0x9570('0x17')]['include'],function(_0x45b976){return{'model':db[_0x45b976[_0x9570('0x1e')]],'as':_0x45b976['as'],'attributes':_0x45b976['attributes'],'include':_0x45b976[_0x9570('0x1c')]?_[_0x9570('0x1d')](_0x45b976[_0x9570('0x1c')],function(_0x11e7f5){return{'model':db[_0x11e7f5[_0x9570('0x1e')]],'as':_0x11e7f5['as'],'attributes':_0x11e7f5[_0x9570('0x1a')],'include':_0x11e7f5['include']?_['map'](_0x11e7f5[_0x9570('0x1c')],function(_0x2a818d){return{'model':db[_0x2a818d[_0x9570('0x1e')]],'as':_0x2a818d['as'],'attributes':_0x2a818d[_0x9570('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9570('0x1f')](function(_0x436a7d){logger['info']('GetCmHopper',_0x2d8ef8);logger[_0x9570('0x20')](_0x9570('0x21'),_0x2d8ef8,JSON[_0x9570('0xf')](_0x436a7d));_0x1dc9bf(_0x436a7d);})[_0x9570('0x15')](function(_0x23497f){logger[_0x9570('0x10')]('GetCmHopper',_0x23497f[_0x9570('0x12')],_0x2d8ef8);_0x154934(_0x339016[_0x9570('0x10')](0x1f4,_0x23497f[_0x9570('0x12')]));});});};exports[_0x9570('0x22')]=function(_0x27c554){var _0x348f9c=this;return new Promise(function(_0xfef84,_0x3bcb07){return db[_0x9570('0x23')][_0x9570('0x24')]({'raw':_0x27c554[_0x9570('0x17')]?_0x27c554['options']['raw']===undefined?!![]:![]:!![],'where':_0x27c554['options']?_0x27c554[_0x9570('0x17')][_0x9570('0x19')]||null:null,'attributes':_0x27c554['options']?_0x27c554[_0x9570('0x17')][_0x9570('0x1a')]||null:null,'include':_0x27c554[_0x9570('0x17')]?_0x27c554['options'][_0x9570('0x1c')]?_[_0x9570('0x1d')](_0x27c554[_0x9570('0x17')][_0x9570('0x1c')],function(_0x5f0316){return{'model':db[_0x5f0316['model']],'as':_0x5f0316['as'],'attributes':_0x5f0316[_0x9570('0x1a')],'include':_0x5f0316[_0x9570('0x1c')]?_['map'](_0x5f0316[_0x9570('0x1c')],function(_0x18ea65){return{'model':db[_0x18ea65[_0x9570('0x1e')]],'as':_0x18ea65['as'],'attributes':_0x18ea65[_0x9570('0x1a')],'include':_0x18ea65[_0x9570('0x1c')]?_['map'](_0x18ea65['include'],function(_0x5ed53c){return{'model':db[_0x5ed53c[_0x9570('0x1e')]],'as':_0x5ed53c['as'],'attributes':_0x5ed53c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xab4e84){logger['info']('ShowCmHopper',_0x27c554);logger[_0x9570('0x20')](_0x9570('0x22'),_0x27c554,JSON['stringify'](_0xab4e84));_0xfef84(_0xab4e84);})[_0x9570('0x15')](function(_0x4525f9){logger['error'](_0x9570('0x22'),_0x4525f9[_0x9570('0x12')],_0x27c554);_0x3bcb07(_0x348f9c[_0x9570('0x10')](0x1f4,_0x4525f9[_0x9570('0x12')]));});});};exports[_0x9570('0x25')]=function(_0x2ed949){var _0x45c72d=this;return new Promise(function(_0xfbef62,_0x5ec3ea){return db[_0x9570('0x23')][_0x9570('0x26')](_0x2ed949[_0x9570('0x27')],{'raw':_0x2ed949[_0x9570('0x17')]?_0x2ed949[_0x9570('0x17')][_0x9570('0x18')]===undefined?!![]:![]:!![]})[_0x9570('0x1f')](function(_0x306634){logger[_0x9570('0xc')](_0x9570('0x25'),_0x2ed949);logger['debug'](_0x9570('0x25'),_0x2ed949,JSON[_0x9570('0xf')](_0x306634));_0xfbef62(_0x306634);})[_0x9570('0x15')](function(_0x36cb17){logger[_0x9570('0x10')](_0x9570('0x25'),_0x36cb17[_0x9570('0x12')],_0x2ed949);_0x5ec3ea(_0x45c72d[_0x9570('0x10')](0x1f4,_0x36cb17['message']));});});};exports[_0x9570('0x28')]=function(_0x145a7b){var _0x480127=this;return new Promise(function(_0x10798d,_0x1500c5){return db[_0x9570('0x23')]['update'](_0x145a7b[_0x9570('0x27')],{'raw':_0x145a7b[_0x9570('0x17')]?_0x145a7b[_0x9570('0x17')][_0x9570('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145a7b[_0x9570('0x17')]?_0x145a7b[_0x9570('0x17')][_0x9570('0x19')]||null:null,'attributes':_0x145a7b[_0x9570('0x17')]?_0x145a7b[_0x9570('0x17')][_0x9570('0x1a')]||null:null,'limit':_0x145a7b['options']?_0x145a7b[_0x9570('0x17')][_0x9570('0x1b')]||null:null})[_0x9570('0x1f')](function(_0x479fc8){logger['info'](_0x9570('0x28'),_0x145a7b);logger['info'](_0x9570('0x29'),JSON['stringify'](_0x145a7b[_0x9570('0x17')][_0x9570('0x19')]),_0x145a7b['body'][_0x9570('0x2a')]);logger[_0x9570('0x20')](_0x9570('0x28'),_0x145a7b,JSON[_0x9570('0xf')](_0x479fc8));_0x10798d(_0x479fc8);})['catch'](function(_0x54c4e5){logger[_0x9570('0x10')](_0x9570('0x28'),_0x54c4e5[_0x9570('0x12')],_0x145a7b);_0x1500c5(_0x480127['error'](0x1f4,_0x54c4e5[_0x9570('0x12')]));});});};exports['DestroyCmHopper']=function(_0x1d3dde){var _0x464af3=this;return new Promise(function(_0x48e7b7,_0x51bf4b){return db[_0x9570('0x23')]['destroy']({'where':_0x1d3dde[_0x9570('0x17')]?_0x1d3dde[_0x9570('0x17')][_0x9570('0x19')]||null:null})['then'](function(_0x141316){logger['info'](_0x9570('0x2b'),_0x1d3dde);logger[_0x9570('0x20')]('DestroyCmHopper',_0x1d3dde,JSON[_0x9570('0xf')](_0x141316));_0x48e7b7(_0x141316);})[_0x9570('0x15')](function(_0xd03f28){logger[_0x9570('0x10')](_0x9570('0x2b'),_0xd03f28[_0x9570('0x12')],_0x1d3dde);_0x51bf4b(_0x464af3['error'](0x1f4,_0xd03f28[_0x9570('0x12')]));});});};exports[_0x9570('0x2c')]=function(_0x3efe41){var _0x46a412=this;return new Promise(function(_0x53fa6e,_0xc6587){return db[_0x9570('0x2d')][_0x9570('0x2e')]()[_0x9570('0x1f')](function(_0x5a33c7){return db[_0x9570('0x2f')][_0x9570('0x30')](function(_0x307fc8){return db[_0x9570('0x23')][_0x9570('0x16')]({'where':_0x3efe41['options']?_0x3efe41[_0x9570('0x17')][_0x9570('0x19')]||null:null,'attributes':_0x3efe41[_0x9570('0x17')]?_0x3efe41[_0x9570('0x17')][_0x9570('0x1a')]||null:null,'limit':_0x3efe41[_0x9570('0x17')]?_0x3efe41[_0x9570('0x17')][_0x9570('0x1b')]||null:null,'order':_0x3efe41[_0x9570('0x17')]?_0x3efe41['options'][_0x9570('0x31')]||null:null,'transaction':_0x307fc8,'lock':_0x307fc8[_0x9570('0x32')][_0x9570('0x33')],'include':[{'model':db[_0x9570('0x2d')],'as':_0x9570('0x34'),'attributes':_['keys'](_0x5a33c7)},{'model':db[_0x9570('0x35')],'as':_0x9570('0x36'),'attributes':['id','name',_0x9570('0x37')]}]})[_0x9570('0x1f')](function(_0x9b9863){var _0x24cd6e=[];var _0x37dd05=[];for(var _0x21c912=0x0;_0x21c912<_0x9b9863[_0x9570('0x38')];_0x21c912+=0x1){var _0x3f7da9=_0x9b9863[_0x21c912][_0x9570('0x39')];if(_0x3f7da9===null){_0x24cd6e[_0x9570('0x3a')](_0x9b9863[_0x21c912][_0x9570('0x3b')](_0x3efe41[_0x9570('0x27')],{'transaction':_0x307fc8}));}else if(!_0x37dd05[_0x9570('0x3c')](_0x3f7da9)){_0x37dd05[_0x9570('0x3a')](_0x3f7da9);_0x24cd6e['push'](_0x9b9863[_0x21c912]['update'](_0x3efe41['body'],{'transaction':_0x307fc8}));}}return BPromise[_0x9570('0x3d')](_0x24cd6e);});})['then'](function(_0x2bdfc4){logger[_0x9570('0xc')](_0x9570('0x2c'),_0x3efe41);if(_0x2bdfc4[_0x9570('0x38')]>0x0){logger[_0x9570('0xc')](_0x9570('0x3e'),_0x2bdfc4[0x0][_0x9570('0x3f')]['id'],_0x2bdfc4[0x0][_0x9570('0x3f')]['ContactId'],_0x2bdfc4[0x0][_0x9570('0x3f')]['active']);}logger[_0x9570('0x20')]('GetContactDialer',_0x3efe41,JSON[_0x9570('0xf')](_0x2bdfc4));_0x53fa6e(_0x2bdfc4);})[_0x9570('0x15')](function(_0x3ebc71){logger['error'](_0x9570('0x2c'),_0x3ebc71[_0x9570('0x12')],_0x3efe41);_0xc6587(_0x46a412[_0x9570('0x10')](0x1f4,_0x3ebc71['message']));});});});};exports[_0x9570('0x40')]=function(_0x5f4277){var _0x459d48=this;return new Promise(function(_0x1f844d,_0x579e2e){return db[_0x9570('0x2f')][_0x9570('0x30')](function(_0x102ace){return db['CmHopperFinal'][_0x9570('0x26')](_0x5f4277[_0x9570('0x27')],{'raw':_0x5f4277[_0x9570('0x17')]?_0x5f4277[_0x9570('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x102ace})[_0x9570('0x1f')](function(){logger[_0x9570('0xc')](_0x9570('0x41'),JSON[_0x9570('0xf')](_0x5f4277[_0x9570('0x17')]['where']),_0x5f4277[_0x9570('0x17')]['where'][_0x9570('0x2a')]);return db['CmHopper'][_0x9570('0x42')]({'where':_0x5f4277[_0x9570('0x17')]?_0x5f4277[_0x9570('0x17')][_0x9570('0x19')]||null:null,'transaction':_0x102ace});});})['then'](function(_0x347aba){logger[_0x9570('0xc')](_0x9570('0x40'),_0x5f4277);logger[_0x9570('0x20')](_0x9570('0x40'),_0x5f4277,JSON[_0x9570('0xf')](_0x347aba));_0x1f844d(_0x347aba);})[_0x9570('0x15')](function(_0x3e2071){logger[_0x9570('0x10')](_0x9570('0x40'),_0x3e2071['message'],_0x5f4277);_0x579e2e(_0x459d48[_0x9570('0x10')](0x1f4,_0x3e2071[_0x9570('0x12')]));});});};exports['CountReScheduled']=function(_0x520957){var _0x3ff343=this;return new Promise(function(_0xae5ed,_0x3133aa){return db[_0x9570('0x23')][_0x9570('0x16')]({'raw':_0x520957[_0x9570('0x17')]?_0x520957[_0x9570('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x520957[_0x9570('0x17')]?_0x520957[_0x9570('0x17')]['where']||null:null,'attributes':[[db[_0x9570('0x2f')]['fn'](_0x9570('0x43'),db[_0x9570('0x2f')]['fn']('IF',db[_0x9570('0x2f')]['literal'](_0x9570('0x44')+util[_0x9570('0x45')](_0x9570('0x46'),moment()[_0x9570('0x45')](_0x9570('0x47')))+_0x9570('0x48')))),_0x9570('0x49')]]})[_0x9570('0x1f')](function(_0x22c4a3){logger[_0x9570('0xc')](_0x9570('0x4a'),_0x520957);logger[_0x9570('0x20')](_0x9570('0x4a'),_0x520957,JSON[_0x9570('0xf')](_0x22c4a3));_0xae5ed(_0x22c4a3);})[_0x9570('0x15')](function(_0x289f56){logger['error'](_0x9570('0x4a'),_0x289f56[_0x9570('0x12')],_0x520957);_0x3133aa(_0x3ff343['error'](0x1f4,_0x289f56[_0x9570('0x12')]));});});};exports[_0x9570('0x4b')]=function(_0x579b31){var _0x1f1e15=this;return new Promise(function(_0x5f5cdf,_0x173676){return db[_0x9570('0x2d')][_0x9570('0x2e')]()['then'](function(_0x2a220d){return db[_0x9570('0x2f')][_0x9570('0x30')](function(_0x3c524b){return db[_0x9570('0x23')]['findAll']({'where':_0x579b31['options']?_0x579b31[_0x9570('0x17')][_0x9570('0x19')]||null:null,'attributes':_0x579b31[_0x9570('0x17')]?_0x579b31[_0x9570('0x17')][_0x9570('0x1a')]||null:null,'limit':0x1,'order':_0x579b31['options']?_0x579b31[_0x9570('0x17')][_0x9570('0x31')]||null:null,'group':db['CmHopper'][_0x9570('0x39')],'transaction':_0x3c524b,'lock':_0x3c524b[_0x9570('0x32')]['UPDATE'],'include':_0x579b31[_0x9570('0x17')]?_0x579b31['options'][_0x9570('0x1c')]?_['map'](_0x579b31[_0x9570('0x17')]['include'],function(_0x57de2c){return{'model':db[_0x57de2c[_0x9570('0x1e')]],'as':_0x57de2c['as'],'attributes':_0x57de2c[_0x9570('0x1a')],'include':_0x57de2c[_0x9570('0x1c')]?_[_0x9570('0x1d')](_0x57de2c[_0x9570('0x1c')],function(_0x4ca7a9){return{'model':db[_0x4ca7a9[_0x9570('0x1e')]],'as':_0x4ca7a9['as'],'attributes':_0x4ca7a9[_0x9570('0x1a')],'include':_0x4ca7a9['include']?_[_0x9570('0x1d')](_0x4ca7a9['include'],function(_0xe8687a){return{'model':db[_0xe8687a['model']],'as':_0xe8687a['as'],'attributes':_0xe8687a['attributes']};}):[]};}):[]};}):[]:[]})[_0x9570('0x1f')](function(_0x15ca34){var _0x4908da=[];for(var _0x430146=0x0;_0x430146<_0x15ca34['length'];_0x430146+=0x1){_0x4908da[_0x9570('0x3a')](_0x15ca34[_0x430146][_0x9570('0x3b')](_0x579b31[_0x9570('0x27')],{'transaction':_0x3c524b}));}return BPromise[_0x9570('0x3d')](_0x4908da);});})[_0x9570('0x1f')](function(_0x32e681){logger['info'](_0x9570('0x4b'),_0x579b31);logger['debug'](_0x9570('0x4b'),_0x579b31,JSON[_0x9570('0xf')](_0x32e681));_0x5f5cdf(_0x32e681);})[_0x9570('0x15')](function(_0x47abb7){logger[_0x9570('0x10')](_0x9570('0x4b'),_0x47abb7[_0x9570('0x12')],_0x579b31);_0x173676(_0x1f1e15[_0x9570('0x10')](0x1f4,_0x47abb7[_0x9570('0x12')]));});});});};exports[_0x9570('0x4c')]=function(_0x36d81b){var _0x131359=this;return new Promise(function(_0x201f58,_0x1f9435){db[_0x9570('0x2d')][_0x9570('0x2e')]()[_0x9570('0x1f')](function(_0x55b489){return db[_0x9570('0x23')]['findAll']({'raw':_0x36d81b['options']?_0x36d81b[_0x9570('0x17')][_0x9570('0x18')]===undefined?!![]:![]:!![],'where':_0x36d81b[_0x9570('0x17')]?_0x36d81b['options'][_0x9570('0x19')]||null:null,'attributes':_0x36d81b['options']?_0x36d81b[_0x9570('0x17')][_0x9570('0x1a')]||null:null,'limit':_0x36d81b[_0x9570('0x17')]?_0x36d81b[_0x9570('0x17')][_0x9570('0x1b')]||null:null,'include':_0x36d81b[_0x9570('0x17')]?_0x36d81b['options'][_0x9570('0x1c')]?_['map'](_0x36d81b['options'][_0x9570('0x1c')],function(_0x13d56e){return{'model':db[_0x13d56e[_0x9570('0x1e')]],'as':_0x13d56e['as'],'attributes':_0x13d56e['as']===_0x9570('0x34')?_['keys'](_0x55b489):_0x13d56e[_0x9570('0x1a')],'include':_0x13d56e[_0x9570('0x1c')]?_['map'](_0x13d56e[_0x9570('0x1c')],function(_0x391c5f){return{'model':db[_0x391c5f[_0x9570('0x1e')]],'as':_0x391c5f['as'],'attributes':_0x391c5f[_0x9570('0x1a')],'include':_0x391c5f[_0x9570('0x1c')]?_[_0x9570('0x1d')](_0x391c5f['include'],function(_0x4802da){return{'model':db[_0x4802da['model']],'as':_0x4802da['as'],'attributes':_0x4802da[_0x9570('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9570('0x1f')](function(_0x12f733){logger[_0x9570('0xc')](_0x9570('0x21'),_0x36d81b);logger[_0x9570('0x20')](_0x9570('0x21'),_0x36d81b,JSON[_0x9570('0xf')](_0x12f733));_0x201f58(_0x12f733);})['catch'](function(_0x192215){logger['error']('GetCmHopper',_0x192215[_0x9570('0x12')],_0x36d81b);_0x1f9435(_0x131359[_0x9570('0x10')](0x1f4,_0x192215[_0x9570('0x12')]));});});});};exports['GetContactByPhone']=function(_0x1ffb82){var _0x33e9b0=this;return new Promise(function(_0x420aff,_0x330817){return db['CmContact'][_0x9570('0x4d')]({'raw':!![],'where':{'phone':_0x1ffb82['options'][_0x9570('0x19')][_0x9570('0x4e')]},'attributes':['id',_0x9570('0x4f')],'order':[['id','DESC']]})[_0x9570('0x1f')](function(_0x4bc4cf){logger['info']('getContactByPhone',_0x1ffb82);logger[_0x9570('0x20')](_0x9570('0x50'),_0x1ffb82,JSON['stringify'](_0x4bc4cf));_0x420aff(_0x4bc4cf);})[_0x9570('0x15')](function(_0x45d2be){logger[_0x9570('0x10')](_0x9570('0x50'),_0x45d2be['message'],_0x1ffb82);_0x330817(_0x33e9b0[_0x9570('0x10')](0x1f4,_0x45d2be[_0x9570('0x12')]));});});};exports[_0x9570('0x51')]=function(_0x473d19){var _0x4522cc=this;return new Promise(function(_0x468ce8,_0x246343){return db[_0x9570('0x2f')][_0x9570('0x30')](function(_0x1bc767){return db['CmHopper']['update']({'active':![]},{'where':{},'transaction':_0x1bc767})[_0x9570('0x1f')](function(_0x582efd){logger[_0x9570('0xc')](_0x9570('0x51'),_0x473d19);logger[_0x9570('0x20')]('ResetActiveCalls',_0x473d19,JSON[_0x9570('0xf')](_0x582efd));_0x468ce8(_0x582efd);})['catch'](function(_0x4734ba){logger[_0x9570('0x10')](_0x9570('0x51'),_0x4734ba[_0x9570('0x12')],_0x473d19);_0x246343(_0x4522cc[_0x9570('0x10')](0x1f4,_0x4734ba[_0x9570('0x12')]));});});});};exports[_0x9570('0x52')]=function(_0x57432b){var _0x419403=this;var _0x485d8a=_0x57432b[_0x9570('0x27')][_0x9570('0x19')][_0x9570('0x53')];var _0x30f964=_0x57432b[_0x9570('0x27')][_0x9570('0x19')][_0x9570('0x54')];return new Promise(function(_0x49dc1d,_0x2b8a5c){return db[_0x9570('0x23')][_0x9570('0x16')]({'where':{'voiceQueueId':_0x485d8a,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0x9570('0x55')+_0x30f964+_0x9570('0x56'))}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':'Agent','attributes':['id',_0x9570('0x57'),_0x9570('0x37')]},{'model':db[_0x9570('0x58')],'as':_0x9570('0x59')}]})[_0x9570('0x1f')](function(_0x3b6409){return db['sequelize'][_0x9570('0x30')](function(_0x54ddba){return db[_0x9570('0x23')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x485d8a,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9570('0x2f')][_0x9570('0x5a')](_0x9570('0x55')+_0x30f964+_0x9570('0x56'))}},'transaction':_0x54ddba})[_0x9570('0x1f')](function(_0x373692){_0x49dc1d(_0x3b6409);})[_0x9570('0x15')](function(_0x5839d4){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x5839d4['message'],_0x57432b);_0x2b8a5c(validateExpressRequest);});});})['catch'](function(_0x54440b){logger['error'](_0x9570('0x52'),_0x54440b[_0x9570('0x12')],_0x57432b);_0x2b8a5c(_0x419403['error'](0x1f4,_0x54440b[_0x9570('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1b4937f..d3fdf6a 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 _0x4594=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','index','/describe','isAuthenticated','get','/opencontacts','/timezones','getTimezones','/:id','show','post','create','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','put','delete','destroy','exports','multer'];(function(_0x5d63d9,_0x5aa58d){var _0x580c02=function(_0x1c95ec){while(--_0x1c95ec){_0x5d63d9['push'](_0x5d63d9['shift']());}};_0x580c02(++_0x5aa58d);}(_0x4594,0xb3));var _0x4459=function(_0x13b9b0,_0x11540b){_0x13b9b0=_0x13b9b0-0x0;var _0x490b5b=_0x4594[_0x13b9b0];return _0x490b5b;};'use strict';var multer=require(_0x4459('0x0'));var util=require(_0x4459('0x1'));var path=require(_0x4459('0x2'));var timeout=require(_0x4459('0x3'));var express=require(_0x4459('0x4'));var router=express[_0x4459('0x5')]();var fs_extra=require(_0x4459('0x6'));var auth=require(_0x4459('0x7'));var interaction=require(_0x4459('0x8'));var config=require('../../config/environment');var controller=require(_0x4459('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4459('0xa')]);router['get'](_0x4459('0xb'),auth[_0x4459('0xc')](),controller['describe']);router[_0x4459('0xd')](_0x4459('0xe'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x4459('0xf'),auth['isAuthenticated'](),controller[_0x4459('0x10')]);router['get'](_0x4459('0x11'),auth[_0x4459('0xc')](),controller[_0x4459('0x12')]);router[_0x4459('0x13')]('/',auth[_0x4459('0xc')](),controller[_0x4459('0x14')]);router['post']('/preview',auth[_0x4459('0xc')](),controller[_0x4459('0x15')]);router[_0x4459('0x13')](_0x4459('0x16'),auth[_0x4459('0xc')](),controller[_0x4459('0x17')]);router[_0x4459('0x13')](_0x4459('0x18'),auth[_0x4459('0xc')](),controller[_0x4459('0x19')]);router[_0x4459('0x1a')]('/:id',auth[_0x4459('0xc')](),controller['update']);router[_0x4459('0x1b')](_0x4459('0x11'),auth['isAuthenticated'](),controller[_0x4459('0x1c')]);module[_0x4459('0x1d')]=router; \ No newline at end of file +var _0x970e=['get','isAuthenticated','index','describe','/timezones','getTimezones','/:id','post','getTimezone','getPreviewRecall','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x970e,0xcb));var _0xe970=function(_0x1baac0,_0x1ed1f5){_0x1baac0=_0x1baac0-0x0;var _0x230f26=_0x970e[_0x1baac0];return _0x230f26;};'use strict';var multer=require(_0xe970('0x0'));var util=require(_0xe970('0x1'));var path=require(_0xe970('0x2'));var timeout=require(_0xe970('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe970('0x4'));var interaction=require(_0xe970('0x5'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0xe970('0x6')]('/',auth[_0xe970('0x7')](),controller[_0xe970('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe970('0x9')]);router[_0xe970('0x6')]('/opencontacts',auth[_0xe970('0x7')](),controller['getOpenContacts']);router[_0xe970('0x6')](_0xe970('0xa'),auth[_0xe970('0x7')](),controller[_0xe970('0xb')]);router[_0xe970('0x6')](_0xe970('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe970('0xd')]('/',auth[_0xe970('0x7')](),controller['create']);router[_0xe970('0xd')]('/preview',auth[_0xe970('0x7')](),controller['getPreview']);router[_0xe970('0xd')]('/timezone',auth['isAuthenticated'](),controller[_0xe970('0xe')]);router[_0xe970('0xd')]('/previewrecall',auth['isAuthenticated'](),controller[_0xe970('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe970('0x10')]);router[_0xe970('0x11')](_0xe970('0xc'),auth[_0xe970('0x7')](),controller['destroy']);module[_0xe970('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8a00a48..b8d9a6c 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 _0xfafb=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xbfaf('0x0'));var Sequelize=require('sequelize');module[_0xbfaf('0x1')]={'phone':{'type':Sequelize[_0xbfaf('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xbfaf('0x3')],'unique':_0xbfaf('0x4')},'ListId':{'type':Sequelize[_0xbfaf('0x3')],'unique':_0xbfaf('0x4')},'VoiceQueueId':{'type':Sequelize[_0xbfaf('0x3')],'unique':_0xbfaf('0x4')}}; \ No newline at end of file +var _0x187d=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x55cd96,_0x37af58){var _0x1ceb7c=function(_0xc6d666){while(--_0xc6d666){_0x55cd96['push'](_0x55cd96['shift']());}};_0x1ceb7c(++_0x37af58);}(_0x187d,0x93));var _0xd187=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x187d[_0x494d1f];return _0x457b6e;};'use strict';var moment=require(_0xd187('0x0'));var Sequelize=require('sequelize');module[_0xd187('0x1')]={'phone':{'type':Sequelize[_0xd187('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd187('0x3')],'unique':_0xd187('0x4')},'ListId':{'type':Sequelize[_0xd187('0x3')],'unique':_0xd187('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd187('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 06db171..7d93ab0 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 _0x04c3=['json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','include','rows','catch','params','rawAttributes','length','includeAll','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x1a9d01,_0x4206e3){var _0x1218dd=function(_0x43e149){while(--_0x43e149){_0x1a9d01['push'](_0x1a9d01['shift']());}};_0x1218dd(++_0x4206e3);}(_0x04c3,0x1de));var _0x304c=function(_0x25a987,_0x34c654){_0x25a987=_0x25a987-0x0;var _0x4224ff=_0x04c3[_0x25a987];return _0x4224ff;};'use strict';var emlformat=require(_0x304c('0x0'));var rimraf=require(_0x304c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x304c('0x2'));var rp=require(_0x304c('0x3'));var moment=require(_0x304c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x304c('0x5'));var util=require(_0x304c('0x6'));var path=require(_0x304c('0x7'));var sox=require('sox');var csv=require(_0x304c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x304c('0x9'));var _=require(_0x304c('0xa'));var squel=require(_0x304c('0xb'));var crypto=require(_0x304c('0xc'));var jsforce=require(_0x304c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x304c('0x8'));var querystring=require(_0x304c('0xe'));var Papa=require(_0x304c('0xf'));var Redis=require(_0x304c('0x10'));var authService=require(_0x304c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x304c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x304c('0x13'))(_0x304c('0x14'));var utils=require(_0x304c('0x15'));var config=require(_0x304c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eb7f8,_0x34fc41){_0x34fc41=_0x34fc41||0xcc;return function(_0x4f40a1){if(_0x4f40a1){return _0x1eb7f8[_0x304c('0x17')](_0x34fc41);}return _0x1eb7f8[_0x304c('0x18')](_0x34fc41)[_0x304c('0x19')]();};}function respondWithResult(_0x3859c2,_0x28ea94){_0x28ea94=_0x28ea94||0xc8;return function(_0x5d9007){if(_0x5d9007){return _0x3859c2['status'](_0x28ea94)[_0x304c('0x1a')](_0x5d9007);}};}function respondWithFilteredResult(_0x1d2878,_0x908b71){return function(_0x42a4cf){if(_0x42a4cf){var _0x38fd1b=typeof _0x908b71[_0x304c('0x1b')]===_0x304c('0x1c')&&typeof _0x908b71[_0x304c('0x1d')]===_0x304c('0x1c');var _0x26a9ae=_0x42a4cf['count'];var _0x1021a9=_0x38fd1b?0x0:_0x908b71[_0x304c('0x1b')];var _0x144171=_0x38fd1b?_0x42a4cf[_0x304c('0x1e')]:_0x908b71[_0x304c('0x1b')]+_0x908b71[_0x304c('0x1d')];var _0x2ecf6e;if(_0x144171>=_0x26a9ae){_0x144171=_0x26a9ae;_0x2ecf6e=0xc8;}else{_0x2ecf6e=0xce;}_0x1d2878['status'](_0x2ecf6e);return _0x1d2878['set'](_0x304c('0x1f'),_0x1021a9+'-'+_0x144171+'/'+_0x26a9ae)[_0x304c('0x1a')](_0x42a4cf);}return null;};}function patchUpdates(_0x270ac6){return function(_0x4169ab){try{jsonpatch[_0x304c('0x20')](_0x4169ab,_0x270ac6,!![]);}catch(_0x5879c3){return BPromise['reject'](_0x5879c3);}return _0x4169ab['save']();};}function saveUpdates(_0x6542b2,_0xc80674){return function(_0x451fd3){if(_0x451fd3){return _0x451fd3[_0x304c('0x21')](_0x6542b2)[_0x304c('0x22')](function(_0x58561e){return _0x58561e;});}return null;};}function removeEntity(_0x7aa4f6,_0xbb1afc){return function(_0xc8bc85){if(_0xc8bc85){return _0xc8bc85[_0x304c('0x23')]()[_0x304c('0x22')](function(){_0x7aa4f6['status'](0xcc)[_0x304c('0x19')]();});}};}function handleEntityNotFound(_0x28348e,_0x2bbfcd){return function(_0x48d24e){if(!_0x48d24e){_0x28348e[_0x304c('0x17')](0x194);}return _0x48d24e;};}function handleError(_0x795a81,_0x44d763){_0x44d763=_0x44d763||0x1f4;return function(_0x3f2340){logger['error'](_0x3f2340[_0x304c('0x24')]);if(_0x3f2340['name']){delete _0x3f2340[_0x304c('0x25')];}_0x795a81[_0x304c('0x18')](_0x44d763)[_0x304c('0x26')](_0x3f2340);};}exports[_0x304c('0x27')]=function(_0x29b869,_0x2af762){var _0x43119f={},_0x5c0974={},_0x56225b={'count':0x0,'rows':[]};var _0x253719=_[_0x304c('0x28')](db[_0x304c('0x29')]['rawAttributes'],function(_0x2dc298){return{'name':_0x2dc298[_0x304c('0x2a')],'type':_0x2dc298[_0x304c('0x2b')][_0x304c('0x2c')]};});_0x5c0974[_0x304c('0x2d')]=_[_0x304c('0x28')](_0x253719,_0x304c('0x25'));_0x5c0974[_0x304c('0x2e')]=_[_0x304c('0x2f')](_0x29b869[_0x304c('0x2e')]);_0x5c0974[_0x304c('0x30')]=_['intersection'](_0x5c0974[_0x304c('0x2d')],_0x5c0974[_0x304c('0x2e')]);_0x43119f[_0x304c('0x31')]=_[_0x304c('0x32')](_0x5c0974[_0x304c('0x2d')],qs[_0x304c('0x33')](_0x29b869[_0x304c('0x2e')][_0x304c('0x33')]));_0x43119f['attributes']=_0x43119f[_0x304c('0x31')]['length']?_0x43119f[_0x304c('0x31')]:_0x5c0974['model'];if(!_0x29b869[_0x304c('0x2e')][_0x304c('0x34')](_0x304c('0x35'))){_0x43119f[_0x304c('0x1d')]=qs['limit'](_0x29b869[_0x304c('0x2e')][_0x304c('0x1d')]);_0x43119f[_0x304c('0x1b')]=qs[_0x304c('0x1b')](_0x29b869[_0x304c('0x2e')][_0x304c('0x1b')]);}_0x43119f[_0x304c('0x36')]=qs[_0x304c('0x37')](_0x29b869[_0x304c('0x2e')][_0x304c('0x37')]);_0x43119f['where']=qs[_0x304c('0x30')](_[_0x304c('0x38')](_0x29b869[_0x304c('0x2e')],_0x5c0974[_0x304c('0x30')]),_0x253719);if(_0x29b869['query'][_0x304c('0x39')]){_0x43119f['where']=_['merge'](_0x43119f['where'],{'$or':_[_0x304c('0x28')](_0x253719,function(_0x55d7aa){if(_0x55d7aa['type']!==_0x304c('0x3a')){var _0x1612bb={};_0x1612bb[_0x55d7aa[_0x304c('0x25')]]={'$like':'%'+_0x29b869[_0x304c('0x2e')][_0x304c('0x39')]+'%'};return _0x1612bb;}})});}_0x43119f=_[_0x304c('0x3b')]({},_0x43119f,_0x29b869[_0x304c('0x3c')]);var _0x47bc6d={'where':_0x43119f[_0x304c('0x3d')]};return db[_0x304c('0x29')]['count'](_0x47bc6d)[_0x304c('0x22')](function(_0x47689c){_0x56225b[_0x304c('0x1e')]=_0x47689c;if(_0x29b869[_0x304c('0x2e')]['includeAll']){_0x43119f[_0x304c('0x3e')]=[{'all':!![]}];}return db[_0x304c('0x29')]['findAll'](_0x43119f);})[_0x304c('0x22')](function(_0x4fdffd){_0x56225b[_0x304c('0x3f')]=_0x4fdffd;return _0x56225b;})[_0x304c('0x22')](respondWithFilteredResult(_0x2af762,_0x43119f))[_0x304c('0x40')](handleError(_0x2af762,null));};exports['show']=function(_0x48992a,_0x41656a){var _0x14b2e9={'raw':!![],'where':{'id':_0x48992a[_0x304c('0x41')]['id']}},_0x36441e={};_0x36441e[_0x304c('0x2d')]=_['keys'](db[_0x304c('0x29')][_0x304c('0x42')]);_0x36441e[_0x304c('0x2e')]=_['keys'](_0x48992a['query']);_0x36441e['filters']=_[_0x304c('0x32')](_0x36441e[_0x304c('0x2d')],_0x36441e[_0x304c('0x2e')]);_0x14b2e9[_0x304c('0x31')]=_['intersection'](_0x36441e[_0x304c('0x2d')],qs[_0x304c('0x33')](_0x48992a[_0x304c('0x2e')][_0x304c('0x33')]));_0x14b2e9['attributes']=_0x14b2e9[_0x304c('0x31')][_0x304c('0x43')]?_0x14b2e9[_0x304c('0x31')]:_0x36441e[_0x304c('0x2d')];if(_0x48992a[_0x304c('0x2e')][_0x304c('0x44')]){_0x14b2e9[_0x304c('0x3e')]=[{'all':!![]}];}_0x14b2e9=_['merge']({},_0x14b2e9,_0x48992a['options']);return db[_0x304c('0x29')][_0x304c('0x45')](_0x14b2e9)[_0x304c('0x22')](handleEntityNotFound(_0x41656a,null))['then'](respondWithResult(_0x41656a,null))[_0x304c('0x40')](handleError(_0x41656a,null));};exports[_0x304c('0x21')]=function(_0x4409da,_0x1b1ebd){if(_0x4409da[_0x304c('0x46')]['id']){delete _0x4409da[_0x304c('0x46')]['id'];}return db[_0x304c('0x29')][_0x304c('0x45')]({'where':{'id':_0x4409da[_0x304c('0x41')]['id']}})[_0x304c('0x22')](handleEntityNotFound(_0x1b1ebd,null))[_0x304c('0x22')](saveUpdates(_0x4409da[_0x304c('0x46')],null))[_0x304c('0x22')](respondWithResult(_0x1b1ebd,null))['catch'](handleError(_0x1b1ebd,null));};exports[_0x304c('0x23')]=function(_0x3277a5,_0x50c2ff){return db[_0x304c('0x29')]['find']({'where':{'id':_0x3277a5[_0x304c('0x41')]['id']}})[_0x304c('0x22')](handleEntityNotFound(_0x50c2ff,null))[_0x304c('0x22')](removeEntity(_0x50c2ff,null))[_0x304c('0x40')](handleError(_0x50c2ff,null));};exports[_0x304c('0x47')]=function(_0x12dcaa,_0x1da62b){return db[_0x304c('0x29')]['describe']()[_0x304c('0x22')](respondWithResult(_0x1da62b,null))[_0x304c('0x40')](handleError(_0x1da62b,null));}; \ No newline at end of file +var _0x4892=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperBlack','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x2affa1,_0x1582f5){var _0x37a7ad=function(_0x1f5f42){while(--_0x1f5f42){_0x2affa1['push'](_0x2affa1['shift']());}};_0x37a7ad(++_0x1582f5);}(_0x4892,0x1ee));var _0x2489=function(_0xe45da5,_0xdce9ae){_0xe45da5=_0xe45da5-0x0;var _0x48dbe1=_0x4892[_0xe45da5];return _0x48dbe1;};'use strict';var emlformat=require(_0x2489('0x0'));var rimraf=require(_0x2489('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2489('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2489('0x3'));var Mustache=require(_0x2489('0x4'));var util=require(_0x2489('0x5'));var path=require(_0x2489('0x6'));var sox=require(_0x2489('0x7'));var csv=require('to-csv');var ejs=require(_0x2489('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2489('0x9'));var squel=require(_0x2489('0xa'));var crypto=require(_0x2489('0xb'));var jsforce=require(_0x2489('0xc'));var deskjs=require(_0x2489('0xd'));var toCsv=require(_0x2489('0xe'));var querystring=require(_0x2489('0xf'));var Papa=require('papaparse');var Redis=require(_0x2489('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2489('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2489('0x12'))(_0x2489('0x13'));var utils=require(_0x2489('0x14'));var config=require(_0x2489('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33f93d,_0x23d494){_0x23d494=_0x23d494||0xcc;return function(_0x57cc41){if(_0x57cc41){return _0x33f93d[_0x2489('0x16')](_0x23d494);}return _0x33f93d[_0x2489('0x17')](_0x23d494)[_0x2489('0x18')]();};}function respondWithResult(_0x2a7be1,_0x23e252){_0x23e252=_0x23e252||0xc8;return function(_0x4fc0d4){if(_0x4fc0d4){return _0x2a7be1[_0x2489('0x17')](_0x23e252)[_0x2489('0x19')](_0x4fc0d4);}};}function respondWithFilteredResult(_0x3c5f35,_0x10f207){return function(_0x530c21){if(_0x530c21){var _0x56b4db=typeof _0x10f207[_0x2489('0x1a')]===_0x2489('0x1b')&&typeof _0x10f207['limit']===_0x2489('0x1b');var _0x509281=_0x530c21[_0x2489('0x1c')];var _0x43a84d=_0x56b4db?0x0:_0x10f207['offset'];var _0x573f05=_0x56b4db?_0x530c21[_0x2489('0x1c')]:_0x10f207[_0x2489('0x1a')]+_0x10f207[_0x2489('0x1d')];var _0x47887b;if(_0x573f05>=_0x509281){_0x573f05=_0x509281;_0x47887b=0xc8;}else{_0x47887b=0xce;}_0x3c5f35[_0x2489('0x17')](_0x47887b);return _0x3c5f35['set'](_0x2489('0x1e'),_0x43a84d+'-'+_0x573f05+'/'+_0x509281)[_0x2489('0x19')](_0x530c21);}return null;};}function patchUpdates(_0x4c5a76){return function(_0x5c199d){try{jsonpatch[_0x2489('0x1f')](_0x5c199d,_0x4c5a76,!![]);}catch(_0x4df4bd){return BPromise['reject'](_0x4df4bd);}return _0x5c199d[_0x2489('0x20')]();};}function saveUpdates(_0x1a187d,_0x4e5708){return function(_0x250563){if(_0x250563){return _0x250563[_0x2489('0x21')](_0x1a187d)['then'](function(_0x408f26){return _0x408f26;});}return null;};}function removeEntity(_0x56d0c0,_0x17dc2e){return function(_0x5808ed){if(_0x5808ed){return _0x5808ed[_0x2489('0x22')]()[_0x2489('0x23')](function(){_0x56d0c0[_0x2489('0x17')](0xcc)[_0x2489('0x18')]();});}};}function handleEntityNotFound(_0x1e2516,_0x46d59b){return function(_0x13b34e){if(!_0x13b34e){_0x1e2516[_0x2489('0x16')](0x194);}return _0x13b34e;};}function handleError(_0x26195c,_0x473b89){_0x473b89=_0x473b89||0x1f4;return function(_0x5bb5b6){logger[_0x2489('0x24')](_0x5bb5b6[_0x2489('0x25')]);if(_0x5bb5b6[_0x2489('0x26')]){delete _0x5bb5b6[_0x2489('0x26')];}_0x26195c[_0x2489('0x17')](_0x473b89)[_0x2489('0x27')](_0x5bb5b6);};}exports['index']=function(_0x175674,_0x5e147b){var _0x2478f4={},_0x3ad087={},_0xf61e1f={'count':0x0,'rows':[]};var _0x434702=_[_0x2489('0x28')](db['CmHopperBlack']['rawAttributes'],function(_0x358b30){return{'name':_0x358b30[_0x2489('0x29')],'type':_0x358b30[_0x2489('0x2a')][_0x2489('0x2b')]};});_0x3ad087[_0x2489('0x2c')]=_[_0x2489('0x28')](_0x434702,_0x2489('0x26'));_0x3ad087[_0x2489('0x2d')]=_['keys'](_0x175674[_0x2489('0x2d')]);_0x3ad087[_0x2489('0x2e')]=_[_0x2489('0x2f')](_0x3ad087['model'],_0x3ad087[_0x2489('0x2d')]);_0x2478f4[_0x2489('0x30')]=_[_0x2489('0x2f')](_0x3ad087[_0x2489('0x2c')],qs['fields'](_0x175674[_0x2489('0x2d')][_0x2489('0x31')]));_0x2478f4[_0x2489('0x30')]=_0x2478f4['attributes'][_0x2489('0x32')]?_0x2478f4[_0x2489('0x30')]:_0x3ad087['model'];if(!_0x175674[_0x2489('0x2d')][_0x2489('0x33')](_0x2489('0x34'))){_0x2478f4[_0x2489('0x1d')]=qs[_0x2489('0x1d')](_0x175674[_0x2489('0x2d')][_0x2489('0x1d')]);_0x2478f4[_0x2489('0x1a')]=qs[_0x2489('0x1a')](_0x175674[_0x2489('0x2d')][_0x2489('0x1a')]);}_0x2478f4[_0x2489('0x35')]=qs[_0x2489('0x36')](_0x175674[_0x2489('0x2d')][_0x2489('0x36')]);_0x2478f4[_0x2489('0x37')]=qs[_0x2489('0x2e')](_[_0x2489('0x38')](_0x175674[_0x2489('0x2d')],_0x3ad087['filters']),_0x434702);if(_0x175674[_0x2489('0x2d')]['filter']){_0x2478f4[_0x2489('0x37')]=_[_0x2489('0x39')](_0x2478f4[_0x2489('0x37')],{'$or':_[_0x2489('0x28')](_0x434702,function(_0x55c11e){if(_0x55c11e[_0x2489('0x2a')]!==_0x2489('0x3a')){var _0x1827d9={};_0x1827d9[_0x55c11e[_0x2489('0x26')]]={'$like':'%'+_0x175674[_0x2489('0x2d')][_0x2489('0x3b')]+'%'};return _0x1827d9;}})});}_0x2478f4=_[_0x2489('0x39')]({},_0x2478f4,_0x175674[_0x2489('0x3c')]);var _0x105238={'where':_0x2478f4[_0x2489('0x37')]};return db[_0x2489('0x3d')][_0x2489('0x1c')](_0x105238)[_0x2489('0x23')](function(_0x563319){_0xf61e1f[_0x2489('0x1c')]=_0x563319;if(_0x175674[_0x2489('0x2d')][_0x2489('0x3e')]){_0x2478f4['include']=[{'all':!![]}];}return db[_0x2489('0x3d')][_0x2489('0x3f')](_0x2478f4);})[_0x2489('0x23')](function(_0x5e7083){_0xf61e1f[_0x2489('0x40')]=_0x5e7083;return _0xf61e1f;})['then'](respondWithFilteredResult(_0x5e147b,_0x2478f4))[_0x2489('0x41')](handleError(_0x5e147b,null));};exports[_0x2489('0x42')]=function(_0x5ad22d,_0x142a2c){var _0x1d2252={'raw':!![],'where':{'id':_0x5ad22d[_0x2489('0x43')]['id']}},_0x37957a={};_0x37957a[_0x2489('0x2c')]=_[_0x2489('0x44')](db[_0x2489('0x3d')][_0x2489('0x45')]);_0x37957a[_0x2489('0x2d')]=_[_0x2489('0x44')](_0x5ad22d[_0x2489('0x2d')]);_0x37957a[_0x2489('0x2e')]=_['intersection'](_0x37957a[_0x2489('0x2c')],_0x37957a[_0x2489('0x2d')]);_0x1d2252[_0x2489('0x30')]=_[_0x2489('0x2f')](_0x37957a[_0x2489('0x2c')],qs[_0x2489('0x31')](_0x5ad22d[_0x2489('0x2d')][_0x2489('0x31')]));_0x1d2252[_0x2489('0x30')]=_0x1d2252['attributes']['length']?_0x1d2252[_0x2489('0x30')]:_0x37957a[_0x2489('0x2c')];if(_0x5ad22d[_0x2489('0x2d')]['includeAll']){_0x1d2252['include']=[{'all':!![]}];}_0x1d2252=_[_0x2489('0x39')]({},_0x1d2252,_0x5ad22d['options']);return db[_0x2489('0x3d')][_0x2489('0x46')](_0x1d2252)[_0x2489('0x23')](handleEntityNotFound(_0x142a2c,null))[_0x2489('0x23')](respondWithResult(_0x142a2c,null))[_0x2489('0x41')](handleError(_0x142a2c,null));};exports['update']=function(_0x4c74e2,_0x3f70cd){if(_0x4c74e2[_0x2489('0x47')]['id']){delete _0x4c74e2['body']['id'];}return db[_0x2489('0x3d')][_0x2489('0x46')]({'where':{'id':_0x4c74e2[_0x2489('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f70cd,null))[_0x2489('0x23')](saveUpdates(_0x4c74e2[_0x2489('0x47')],null))[_0x2489('0x23')](respondWithResult(_0x3f70cd,null))['catch'](handleError(_0x3f70cd,null));};exports[_0x2489('0x22')]=function(_0x382455,_0x38a48c){return db['CmHopperBlack']['find']({'where':{'id':_0x382455[_0x2489('0x43')]['id']}})[_0x2489('0x23')](handleEntityNotFound(_0x38a48c,null))[_0x2489('0x23')](removeEntity(_0x38a48c,null))[_0x2489('0x41')](handleError(_0x38a48c,null));};exports['describe']=function(_0x5e1464,_0x12e438){return db['CmHopperBlack']['describe']()[_0x2489('0x23')](respondWithResult(_0x12e438,null))[_0x2489('0x41')](handleError(_0x12e438,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a8c9592..9e26819 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 _0xc19a=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','util','moment'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0xc19a,0xa3));var _0xac19=function(_0x552cfd,_0x17aa8e){_0x552cfd=_0x552cfd-0x0;var _0xeb6921=_0xc19a[_0x552cfd];return _0xeb6921;};'use strict';var _=require('lodash');var util=require(_0xac19('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xac19('0x1'));var BPromise=require(_0xac19('0x2'));var rp=require(_0xac19('0x3'));var fs=require('fs');var path=require(_0xac19('0x4'));var rimraf=require(_0xac19('0x5'));var config=require(_0xac19('0x6'));var attributes=require(_0xac19('0x7'));module[_0xac19('0x8')]=function(_0x112485,_0x44b054){return _0x112485[_0xac19('0x9')](_0xac19('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb059=['moment','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','api'];(function(_0x5c4304,_0x2a3bba){var _0x480069=function(_0x4eb33f){while(--_0x4eb33f){_0x5c4304['push'](_0x5c4304['shift']());}};_0x480069(++_0x2a3bba);}(_0xb059,0x8c));var _0x9b05=function(_0x2f6b65,_0x44bd8c){_0x2f6b65=_0x2f6b65-0x0;var _0x54cd13=_0xb059[_0x2f6b65];return _0x54cd13;};'use strict';var _=require(_0x9b05('0x0'));var util=require(_0x9b05('0x1'));var logger=require('../../config/logger')(_0x9b05('0x2'));var moment=require(_0x9b05('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b05('0x4'));var fs=require('fs');var path=require(_0x9b05('0x5'));var rimraf=require(_0x9b05('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b05('0x7'));module['exports']=function(_0x5806b0,_0xce6b3c){return _0x5806b0[_0x9b05('0x8')](_0x9b05('0x9'),attributes,{'tableName':_0x9b05('0xa'),'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 dc84923..a158021 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 _0xb6cc=['CmHopperBlack,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','limit','include','map','model','attributes','debug','stringify','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x5e5045,_0x276fdc){var _0x414968=function(_0x50b171){while(--_0x50b171){_0x5e5045['push'](_0x5e5045['shift']());}};_0x414968(++_0x276fdc);}(_0xb6cc,0x13f));var _0xcb6c=function(_0x561461,_0x498808){_0x561461=_0x561461-0x0;var _0x8ccbf1=_0xb6cc[_0x561461];return _0x8ccbf1;};'use strict';var _=require('lodash');var util=require(_0xcb6c('0x0'));var moment=require(_0xcb6c('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb6c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcb6c('0x3'));var logger=require(_0xcb6c('0x4'))(_0xcb6c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb6c('0x6')][_0xcb6c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x385238,_0x19db5a,_0x1cffa5){return new BPromise(function(_0xbaefd3,_0x55e524){return client[_0xcb6c('0x8')](_0x385238,_0x1cffa5)[_0xcb6c('0x9')](function(_0x2e9e6b){logger[_0xcb6c('0xa')](_0xcb6c('0xb'),_0x19db5a,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x19db5a,_0xcb6c('0xc'),JSON['stringify'](_0x2e9e6b));if(_0x2e9e6b[_0xcb6c('0xd')]){if(_0x2e9e6b[_0xcb6c('0xd')][_0xcb6c('0xe')]===0x1f4){logger['error'](_0xcb6c('0xb'),_0x19db5a,_0x2e9e6b[_0xcb6c('0xd')][_0xcb6c('0xf')]);return _0x55e524(_0x2e9e6b[_0xcb6c('0xd')][_0xcb6c('0xf')]);}logger[_0xcb6c('0xd')](_0xcb6c('0xb'),_0x19db5a,_0x2e9e6b[_0xcb6c('0xd')][_0xcb6c('0xf')]);return _0xbaefd3(_0x2e9e6b[_0xcb6c('0xd')][_0xcb6c('0xf')]);}else{logger[_0xcb6c('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x19db5a,'request\x20sent');_0xbaefd3(_0x2e9e6b[_0xcb6c('0x10')]['message']);}})[_0xcb6c('0x11')](function(_0x679ba4){logger[_0xcb6c('0xd')](_0xcb6c('0xb'),_0x19db5a,_0x679ba4);_0x55e524(_0x679ba4);});});}exports[_0xcb6c('0x12')]=function(_0x2aef8){var _0xf0a7bc=this;return new Promise(function(_0x1ebe67,_0x1e2534){return db[_0xcb6c('0x13')]['findAll']({'raw':_0x2aef8['options']?_0x2aef8[_0xcb6c('0x14')][_0xcb6c('0x15')]===undefined?!![]:![]:!![],'where':_0x2aef8[_0xcb6c('0x14')]?_0x2aef8[_0xcb6c('0x14')]['where']||null:null,'attributes':_0x2aef8[_0xcb6c('0x14')]?_0x2aef8[_0xcb6c('0x14')]['attributes']||null:null,'limit':_0x2aef8['options']?_0x2aef8[_0xcb6c('0x14')][_0xcb6c('0x16')]||null:null,'include':_0x2aef8[_0xcb6c('0x14')]?_0x2aef8[_0xcb6c('0x14')][_0xcb6c('0x17')]?_[_0xcb6c('0x18')](_0x2aef8[_0xcb6c('0x14')][_0xcb6c('0x17')],function(_0x4b9428){return{'model':db[_0x4b9428[_0xcb6c('0x19')]],'as':_0x4b9428['as'],'attributes':_0x4b9428[_0xcb6c('0x1a')],'include':_0x4b9428[_0xcb6c('0x17')]?_['map'](_0x4b9428[_0xcb6c('0x17')],function(_0x2df1f9){return{'model':db[_0x2df1f9[_0xcb6c('0x19')]],'as':_0x2df1f9['as'],'attributes':_0x2df1f9[_0xcb6c('0x1a')],'include':_0x2df1f9[_0xcb6c('0x17')]?_[_0xcb6c('0x18')](_0x2df1f9[_0xcb6c('0x17')],function(_0x188921){return{'model':db[_0x188921['model']],'as':_0x188921['as'],'attributes':_0x188921['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb6c('0x9')](function(_0x2ddf21){logger['info']('GetCmHopperBlack',_0x2aef8);logger[_0xcb6c('0x1b')](_0xcb6c('0x12'),_0x2aef8,JSON[_0xcb6c('0x1c')](_0x2ddf21));_0x1ebe67(_0x2ddf21);})[_0xcb6c('0x11')](function(_0x19c437){logger[_0xcb6c('0xd')](_0xcb6c('0x12'),_0x19c437[_0xcb6c('0xf')],_0x2aef8);_0x1e2534(_0xf0a7bc[_0xcb6c('0xd')](0x1f4,_0x19c437[_0xcb6c('0xf')]));});});};exports['UpdateCmHopperBlack']=function(_0x25061d){var _0x52aa12=this;return new Promise(function(_0xc6dd04,_0x184bc1){return db[_0xcb6c('0x13')]['update'](_0x25061d[_0xcb6c('0x1d')],{'raw':_0x25061d[_0xcb6c('0x14')]?_0x25061d['options'][_0xcb6c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25061d['options']?_0x25061d[_0xcb6c('0x14')][_0xcb6c('0x1e')]||null:null,'attributes':_0x25061d[_0xcb6c('0x14')]?_0x25061d[_0xcb6c('0x14')][_0xcb6c('0x1a')]||null:null,'limit':_0x25061d[_0xcb6c('0x14')]?_0x25061d[_0xcb6c('0x14')]['limit']||null:null})[_0xcb6c('0x9')](function(_0x426daf){logger['info'](_0xcb6c('0x1f'),_0x25061d);logger[_0xcb6c('0x1b')]('UpdateCmHopperBlack',_0x25061d,JSON[_0xcb6c('0x1c')](_0x426daf));_0xc6dd04(_0x426daf);})['catch'](function(_0x265836){logger[_0xcb6c('0xd')](_0xcb6c('0x1f'),_0x265836[_0xcb6c('0xf')],_0x25061d);_0x184bc1(_0x52aa12[_0xcb6c('0xd')](0x1f4,_0x265836['message']));});});};exports[_0xcb6c('0x20')]=function(_0x237357){var _0x24099b=this;return new Promise(function(_0x9642a4,_0x5542ea){return db['CmHopperBlack']['destroy']({'where':_0x237357[_0xcb6c('0x14')]?_0x237357[_0xcb6c('0x14')][_0xcb6c('0x1e')]||null:null})[_0xcb6c('0x9')](function(_0x4d444d){logger[_0xcb6c('0xa')](_0xcb6c('0x20'),_0x237357);logger[_0xcb6c('0x1b')](_0xcb6c('0x20'),_0x237357,JSON[_0xcb6c('0x1c')](_0x4d444d));_0x9642a4(_0x4d444d);})['catch'](function(_0x252405){logger[_0xcb6c('0xd')](_0xcb6c('0x20'),_0x252405[_0xcb6c('0xf')],_0x237357);_0x5542ea(_0x24099b['error'](0x1f4,_0x252405[_0xcb6c('0xf')]));});});}; \ No newline at end of file +var _0x5fb7=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','model','map','include','attributes','debug','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x5fb7,0x143));var _0x75fb=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x5fb7[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x75fb('0x0'));var util=require(_0x75fb('0x1'));var moment=require(_0x75fb('0x2'));var BPromise=require(_0x75fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75fb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75fb('0x5'));var logger=require(_0x75fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x75fb('0x7'));var client=jayson[_0x75fb('0x8')][_0x75fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34df14,_0x5c5707,_0x1feaf8){return new BPromise(function(_0x5eccdc,_0xa65a4){return client['request'](_0x34df14,_0x1feaf8)[_0x75fb('0xa')](function(_0x57a9dd){logger['info'](_0x75fb('0xb'),_0x5c5707,_0x75fb('0xc'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5c5707,_0x75fb('0xc'),JSON[_0x75fb('0xd')](_0x57a9dd));if(_0x57a9dd[_0x75fb('0xe')]){if(_0x57a9dd[_0x75fb('0xe')][_0x75fb('0xf')]===0x1f4){logger[_0x75fb('0xe')](_0x75fb('0xb'),_0x5c5707,_0x57a9dd[_0x75fb('0xe')][_0x75fb('0x10')]);return _0xa65a4(_0x57a9dd['error'][_0x75fb('0x10')]);}logger[_0x75fb('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x5c5707,_0x57a9dd['error'][_0x75fb('0x10')]);return _0x5eccdc(_0x57a9dd['error'][_0x75fb('0x10')]);}else{logger[_0x75fb('0x11')](_0x75fb('0xb'),_0x5c5707,'request\x20sent');_0x5eccdc(_0x57a9dd[_0x75fb('0x12')][_0x75fb('0x10')]);}})[_0x75fb('0x13')](function(_0x4546e6){logger[_0x75fb('0xe')](_0x75fb('0xb'),_0x5c5707,_0x4546e6);_0xa65a4(_0x4546e6);});});}exports[_0x75fb('0x14')]=function(_0x34105e){var _0x571a0d=this;return new Promise(function(_0xee3f8f,_0xd19c75){return db[_0x75fb('0x15')][_0x75fb('0x16')]({'raw':_0x34105e[_0x75fb('0x17')]?_0x34105e[_0x75fb('0x17')][_0x75fb('0x18')]===undefined?!![]:![]:!![],'where':_0x34105e[_0x75fb('0x17')]?_0x34105e[_0x75fb('0x17')]['where']||null:null,'attributes':_0x34105e[_0x75fb('0x17')]?_0x34105e[_0x75fb('0x17')]['attributes']||null:null,'limit':_0x34105e[_0x75fb('0x17')]?_0x34105e[_0x75fb('0x17')][_0x75fb('0x19')]||null:null,'include':_0x34105e[_0x75fb('0x17')]?_0x34105e[_0x75fb('0x17')]['include']?_['map'](_0x34105e[_0x75fb('0x17')]['include'],function(_0x48e382){return{'model':db[_0x48e382[_0x75fb('0x1a')]],'as':_0x48e382['as'],'attributes':_0x48e382['attributes'],'include':_0x48e382['include']?_[_0x75fb('0x1b')](_0x48e382[_0x75fb('0x1c')],function(_0x5b19e1){return{'model':db[_0x5b19e1[_0x75fb('0x1a')]],'as':_0x5b19e1['as'],'attributes':_0x5b19e1[_0x75fb('0x1d')],'include':_0x5b19e1['include']?_[_0x75fb('0x1b')](_0x5b19e1[_0x75fb('0x1c')],function(_0xeb5fc){return{'model':db[_0xeb5fc[_0x75fb('0x1a')]],'as':_0xeb5fc['as'],'attributes':_0xeb5fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x75fb('0xa')](function(_0xba4f3b){logger[_0x75fb('0x11')]('GetCmHopperBlack',_0x34105e);logger[_0x75fb('0x1e')]('GetCmHopperBlack',_0x34105e,JSON[_0x75fb('0xd')](_0xba4f3b));_0xee3f8f(_0xba4f3b);})['catch'](function(_0x2ae850){logger[_0x75fb('0xe')](_0x75fb('0x14'),_0x2ae850[_0x75fb('0x10')],_0x34105e);_0xd19c75(_0x571a0d[_0x75fb('0xe')](0x1f4,_0x2ae850[_0x75fb('0x10')]));});});};exports[_0x75fb('0x1f')]=function(_0x435dc9){var _0x2cfab2=this;return new Promise(function(_0x87dfcf,_0x503679){return db[_0x75fb('0x15')][_0x75fb('0x20')](_0x435dc9['body'],{'raw':_0x435dc9['options']?_0x435dc9[_0x75fb('0x17')][_0x75fb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x435dc9['options']?_0x435dc9[_0x75fb('0x17')][_0x75fb('0x21')]||null:null,'attributes':_0x435dc9[_0x75fb('0x17')]?_0x435dc9[_0x75fb('0x17')][_0x75fb('0x1d')]||null:null,'limit':_0x435dc9['options']?_0x435dc9[_0x75fb('0x17')][_0x75fb('0x19')]||null:null})[_0x75fb('0xa')](function(_0x5ea945){logger[_0x75fb('0x11')](_0x75fb('0x1f'),_0x435dc9);logger['debug'](_0x75fb('0x1f'),_0x435dc9,JSON[_0x75fb('0xd')](_0x5ea945));_0x87dfcf(_0x5ea945);})[_0x75fb('0x13')](function(_0x405b92){logger[_0x75fb('0xe')](_0x75fb('0x1f'),_0x405b92[_0x75fb('0x10')],_0x435dc9);_0x503679(_0x2cfab2[_0x75fb('0xe')](0x1f4,_0x405b92[_0x75fb('0x10')]));});});};exports[_0x75fb('0x22')]=function(_0x5b049d){var _0x564e31=this;return new Promise(function(_0xd912c9,_0x2767b2){return db[_0x75fb('0x15')][_0x75fb('0x23')]({'where':_0x5b049d[_0x75fb('0x17')]?_0x5b049d[_0x75fb('0x17')][_0x75fb('0x21')]||null:null})['then'](function(_0x2bb918){logger[_0x75fb('0x11')](_0x75fb('0x22'),_0x5b049d);logger['debug'](_0x75fb('0x22'),_0x5b049d,JSON[_0x75fb('0xd')](_0x2bb918));_0xd912c9(_0x2bb918);})[_0x75fb('0x13')](function(_0x2f0379){logger[_0x75fb('0xe')](_0x75fb('0x22'),_0x2f0379[_0x75fb('0x10')],_0x5b049d);_0x2767b2(_0x564e31[_0x75fb('0xe')](0x1f4,_0x2f0379['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0a2c08b..885264b 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 _0x27a0=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','./cmHopperBlack.controller','get'];(function(_0x22a81b,_0x51edff){var _0x4540aa=function(_0x10b676){while(--_0x10b676){_0x22a81b['push'](_0x22a81b['shift']());}};_0x4540aa(++_0x51edff);}(_0x27a0,0xbf));var _0x027a=function(_0x473a1b,_0x454eb3){_0x473a1b=_0x473a1b-0x0;var _0x41323e=_0x27a0[_0x473a1b];return _0x41323e;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('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(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xe')]);router[_0x027a('0xf')](_0x027a('0xb'),auth[_0x027a('0x7')](),controller[_0x027a('0x10')]);module[_0x027a('0x11')]=router; \ No newline at end of file +var _0x2eb2=['/describe','describe','/:id','show','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5cd04c,_0x5f00ab){var _0x4b577b=function(_0x73e944){while(--_0x73e944){_0x5cd04c['push'](_0x5cd04c['shift']());}};_0x4b577b(++_0x5f00ab);}(_0x2eb2,0x19f));var _0x22eb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2eb2[_0x56482c];return _0x5aae7a;};'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('./cmHopperBlack.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')]('/:id',auth[_0x22eb('0x8')](),controller['update']);router['delete'](_0x22eb('0xc'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);module[_0x22eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2530403..cbd86fd 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 _0x7643=['exports','INTEGER','STRING','DATE','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x37ddc5,_0x345f9f){var _0xfcca2d=function(_0x35a590){while(--_0x35a590){_0x37ddc5['push'](_0x37ddc5['shift']());}};_0xfcca2d(++_0x345f9f);}(_0x7643,0xd6));var _0x3764=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x7643[_0x53f897];return _0x6879f8;};'use strict';var Sequelize=require(_0x3764('0x0'));var moment=require(_0x3764('0x1'));module[_0x3764('0x2')]={'state':{'type':Sequelize[_0x3764('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x3764('0x4')]},'scheduledat':{'type':Sequelize[_0x3764('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3764('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3764('0x4')]},'originatecalleridname':{'type':Sequelize[_0x3764('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3764('0x4')]},'starttime':{'type':Sequelize[_0x3764('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3764('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3764('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3764('0x4')]},'membername':{'type':Sequelize[_0x3764('0x4')]},'reason':{'type':Sequelize[_0x3764('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3764('0x4')]},'dispositionat':{'type':Sequelize[_0x3764('0x5')],'set':function(_0x514bc4){var _0x432524=this['getDataValue']('endtime');if(_0x432524&&_0x514bc4){this[_0x3764('0x6')](_0x3764('0x7'),moment(_0x514bc4)[_0x3764('0x8')](moment(_0x432524),_0x3764('0x9')));}return this[_0x3764('0x6')](_0x3764('0xa'),_0x514bc4);}},'amd':{'type':Sequelize[_0x3764('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3764('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3764('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x3764('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3764('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3764('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3764('0x5')]},'recallme':{'type':Sequelize[_0x3764('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3764('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3764('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x79e7=['INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x79e7,0x97));var _0x779e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x79e7[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x779e('0x0'));var moment=require(_0x779e('0x1'));module[_0x779e('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x779e('0x3')]},'scheduledat':{'type':Sequelize[_0x779e('0x4')]},'countbusyretry':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x779e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x779e('0x3')]},'originatecalleridname':{'type':Sequelize[_0x779e('0x3')]},'calleridnum':{'type':Sequelize[_0x779e('0x3')]},'calleridname':{'type':Sequelize[_0x779e('0x3')]},'starttime':{'type':Sequelize[_0x779e('0x4')]},'responsetime':{'type':Sequelize[_0x779e('0x4')]},'answertime':{'type':Sequelize[_0x779e('0x4')]},'droptime':{'type':Sequelize[_0x779e('0x4')]},'endtime':{'type':Sequelize[_0x779e('0x4')]},'ringtime':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x779e('0x3')]},'campaign':{'type':Sequelize[_0x779e('0x3')]},'campaigntype':{'type':Sequelize[_0x779e('0x3')]},'membername':{'type':Sequelize[_0x779e('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x779e('0x3')]},'dispositionat':{'type':Sequelize[_0x779e('0x4')],'set':function(_0x5c897e){var _0xd53334=this[_0x779e('0x6')](_0x779e('0x7'));if(_0xd53334&&_0x5c897e){this[_0x779e('0x8')](_0x779e('0x9'),moment(_0x5c897e)[_0x779e('0xa')](moment(_0xd53334),'seconds'));}return this[_0x779e('0x8')](_0x779e('0xb'),_0x5c897e);}},'amd':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x779e('0x4')]},'callback':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x779e('0x4')]},'deleted':{'type':Sequelize[_0x779e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x779e('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x779e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x779e('0x5')],'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 432651d..07ed211 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 _0x5fab=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','describe','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','Campaign','insert','CampaignId','createdAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3aa938,_0x2d9a7d){var _0x3aca0a=function(_0x545487){while(--_0x545487){_0x3aa938['push'](_0x3aa938['shift']());}};_0x3aca0a(++_0x2d9a7d);}(_0x5fab,0x177));var _0xb5fa=function(_0x2f49df,_0x518919){_0x2f49df=_0x2f49df-0x0;var _0x1ec090=_0x5fab[_0x2f49df];return _0x1ec090;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['CmHopperFinal'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':!![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')]()[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x42a359,_0x3a39f2){if(_0x42a359['body']['uniqueid']){delete _0x42a359[_0xb5fa('0x4d')]['uniqueid'];}return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')]({'where':{'uniqueid':_0x42a359['params']['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x3a39f2,null))[_0xb5fa('0x43')](saveUpdates(_0x42a359[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x3a39f2,null))[_0xb5fa('0x4b')](handleError(_0x3a39f2,null));};exports[_0xb5fa('0x4e')]=function(_0x51d5f7,_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x51d5f7[_0xb5fa('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x58')))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5a')))),'dropContacts'],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),_0xb5fa('0x5f')]]})[_0xb5fa('0x43')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x43')](respondWithResult(_0x27a651,null))[_0xb5fa('0x4b')](handleError(_0x27a651,null));};exports[_0xb5fa('0x60')]=function(_0x18cde9,_0x40d7d5,_0xd2ba4e){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'CampaignId':_0x18cde9[_0xb5fa('0x46')]['id']},'attributes':[[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db['sequelize']['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb5fa('0x61')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x62')))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),'answeringMachine']]})[_0xb5fa('0x43')](handleEntityNotFound(_0x40d7d5,null))[_0xb5fa('0x43')](respondWithResult(_0x40d7d5,null))[_0xb5fa('0x4b')](handleError(_0x40d7d5,null));};exports[_0xb5fa('0x63')]=function(_0x339dfb,_0x56e6b0,_0x1585cd){return db['VoiceQueue'][_0xb5fa('0x4a')]({'where':{'id':_0x339dfb[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x56e6b0,null))[_0xb5fa('0x43')](function(_0x5e44d8){var _0x4d1117;if(_0x5e44d8){_0x4d1117=squel['insert']()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')]([_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'ListId',_0xb5fa('0x6a'),'createdAt','updatedAt'],squel[_0xb5fa('0x6b')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))['field'](_0xb5fa('0x70'),_0xb5fa('0x6a'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'createdAt')[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x72'))[_0xb5fa('0x73')](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb['params']['id'][_0xb5fa('0x76')]())['where'](_0xb5fa('0x77'),_0x339dfb[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))['from'](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb[_0xb5fa('0x46')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')](_0xb5fa('0x74'))['where']('VoiceQueueId\x20=\x20?',_0x339dfb[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db[_0xb5fa('0x50')]['query'](_0x4d1117);}return[];})[_0xb5fa('0x43')](respondWithResult(_0x56e6b0,null))[_0xb5fa('0x4b')](handleError(_0x56e6b0,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5e6852,_0x391412,_0x3150ac){return db[_0xb5fa('0x7d')][_0xb5fa('0x4a')]({'where':{'id':_0x5e6852[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x391412,null))[_0xb5fa('0x43')](function(_0x25b278){var _0x1a0255;if(_0x25b278){_0x1a0255=squel[_0xb5fa('0x7e')]()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')](['phone','scheduledAt',_0xb5fa('0x69'),'ListId',_0xb5fa('0x7f'),_0xb5fa('0x80'),'updatedAt'],squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')]('ANY_VALUE(calleridnum)',_0xb5fa('0x67'))[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))[_0xb5fa('0x6c')](_0xb5fa('0x81'),_0xb5fa('0x7f'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x80'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'updatedAt')['from'](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x77'),_0x5e6852[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))[_0xb5fa('0x73')](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]()))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')]('cm_hopper_final')[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db['sequelize'][_0xb5fa('0x33')](_0x1a0255);}return[];})['then'](respondWithResult(_0x391412,null))['catch'](handleError(_0x391412,null));};exports[_0xb5fa('0x83')]=function(_0x27dbe8,_0x2faf23,_0x4d607d){return db[_0xb5fa('0x84')][_0xb5fa('0x85')]({'where':{'VoiceQueueId':_0x27dbe8[_0xb5fa('0x4d')]['VoiceQueueId'],'CampaignId':_0x27dbe8[_0xb5fa('0x4d')][_0xb5fa('0x7f')],'ContactId':_0x27dbe8['body'][_0xb5fa('0x69')]}})[_0xb5fa('0x43')](handleEntityNotFound(_0x2faf23,null))[_0xb5fa('0x43')](function(_0xf15d5c){if(_0xf15d5c){return _0xf15d5c;}return null;})[_0xb5fa('0x43')](respondWithResult(_0x2faf23,null))[_0xb5fa('0x4b')](handleError(_0x2faf23,null));}; \ No newline at end of file +var _0x4c60=['include','findAll','rows','catch','show','includeAll','find','describe','update','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','VoiceQueue','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x5dd315,_0x599d71){var _0x2d0c05=function(_0x42ae38){while(--_0x42ae38){_0x5dd315['push'](_0x5dd315['shift']());}};_0x2d0c05(++_0x599d71);}(_0x4c60,0xc1));var _0x04c6=function(_0xb7203,_0x147054){_0xb7203=_0xb7203-0x0;var _0x49920a=_0x4c60[_0xb7203];return _0x49920a;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['CmHopperFinal'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':!![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['CmHopperFinal'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['CmHopperFinal'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')]()['then'](respondWithResult(_0x4ef366,null))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0x2472ed,_0xee2822){if(_0x2472ed['body'][_0x04c6('0x44')]){delete _0x2472ed[_0x04c6('0x45')][_0x04c6('0x44')];}return db[_0x04c6('0x27')]['find']({'where':{'uniqueid':_0x2472ed[_0x04c6('0x46')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0xee2822,null))[_0x04c6('0x1f')](saveUpdates(_0x2472ed[_0x04c6('0x45')],null))['then'](respondWithResult(_0xee2822,null))[_0x04c6('0x3e')](handleError(_0xee2822,null));};exports[_0x04c6('0x47')]=function(_0x15ec61,_0x489361,_0x3119f0){return db[_0x04c6('0x27')][_0x04c6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x15ec61[_0x04c6('0x46')]['id']},'attributes':[[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4b')))),_0x04c6('0x4c')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),_0x04c6('0x55')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x56')))),'answeringMachine']]})[_0x04c6('0x1f')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x1f')](respondWithResult(_0x489361,null))[_0x04c6('0x3e')](handleError(_0x489361,null));};exports[_0x04c6('0x57')]=function(_0x28299e,_0x5b536f,_0xf073a8){return db[_0x04c6('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x28299e[_0x04c6('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize']['literal'](_0x04c6('0x4b')))),'noSuchContacts'],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x04c6('0x58')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x59')))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),'reCallContacts'],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x56')))),_0x04c6('0x5a')]]})[_0x04c6('0x1f')](handleEntityNotFound(_0x5b536f,null))[_0x04c6('0x1f')](respondWithResult(_0x5b536f,null))[_0x04c6('0x3e')](handleError(_0x5b536f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x31cc93,_0x1b6242,_0x1f5b9a){return db[_0x04c6('0x5b')][_0x04c6('0x41')]({'where':{'id':_0x31cc93['params']['id']}})['then'](handleEntityNotFound(_0x1b6242,null))[_0x04c6('0x1f')](function(_0x598941){var _0x2df63b;if(_0x598941){_0x2df63b=squel['insert']()[_0x04c6('0x5c')](_0x04c6('0x5d'))['fromQuery']([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),_0x04c6('0x64')],squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),'scheduledAt')[_0x04c6('0x66')](_0x04c6('0x69'),'ContactId')[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))[_0x04c6('0x66')](_0x04c6('0x6b'),'VoiceQueueId')[_0x04c6('0x66')]('NOW()',_0x04c6('0x63'))['field'](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())[_0x04c6('0x35')]('state\x20=\x20?',_0x31cc93[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x04c6('0x35')](_0x04c6('0x71'),squel['select']()[_0x04c6('0x66')](_0x04c6('0x5e'))['from'](_0x04c6('0x5d'))[_0x04c6('0x35')]('VoiceQueueId\x20=\x20?',_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()['field']('calleridnum')['from'](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where'](_0x04c6('0x72')))[_0x04c6('0x73')](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db[_0x04c6('0x48')][_0x04c6('0x2b')](_0x2df63b);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x1b6242,null))['catch'](handleError(_0x1b6242,null));};exports[_0x04c6('0x74')]=function(_0x4f258c,_0x202761,_0x480c74){return db['Campaign'][_0x04c6('0x41')]({'where':{'id':_0x4f258c['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x202761,null))[_0x04c6('0x1f')](function(_0x174de6){var _0x425d01;if(_0x174de6){_0x425d01=squel[_0x04c6('0x75')]()['into']('cm_hopper')[_0x04c6('0x76')]([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x77'),'createdAt',_0x04c6('0x64')],squel['select']()['field'](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x5f'))[_0x04c6('0x66')](_0x04c6('0x69'),_0x04c6('0x60'))[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))['field'](_0x04c6('0x78'),'CampaignId')['field'](_0x04c6('0x68'),_0x04c6('0x63'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x20?',_0x4f258c[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')](_0x04c6('0x7a'))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x5e'))[_0x04c6('0x6c')](_0x04c6('0x5d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c['params']['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x7b'))[_0x04c6('0x6c')](_0x04c6('0x6d'))['where'](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x204'))['group'](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db['sequelize'][_0x04c6('0x2b')](_0x425d01);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x202761,null))[_0x04c6('0x3e')](handleError(_0x202761,null));};exports['checkContactHopper']=function(_0x343c1f,_0x485457,_0x1c0c74){return db[_0x04c6('0x7c')][_0x04c6('0x7d')]({'where':{'VoiceQueueId':_0x343c1f['body']['VoiceQueueId'],'CampaignId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x77')],'ContactId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x60')]}})['then'](handleEntityNotFound(_0x485457,null))['then'](function(_0x3e12a4){if(_0x3e12a4){return _0x3e12a4;}return null;})[_0x04c6('0x1f')](respondWithResult(_0x485457,null))[_0x04c6('0x3e')](handleError(_0x485457,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 10fa030..1ad763e 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 _0x0fcf=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x0fcf,0xd2));var _0xf0fc=function(_0x38acd8,_0x431db0){_0x38acd8=_0x38acd8-0x0;var _0x5ad0b1=_0x0fcf[_0x38acd8];return _0x5ad0b1;};'use strict';var _=require(_0xf0fc('0x0'));var util=require(_0xf0fc('0x1'));var logger=require(_0xf0fc('0x2'))(_0xf0fc('0x3'));var moment=require(_0xf0fc('0x4'));var BPromise=require('bluebird');var rp=require(_0xf0fc('0x5'));var fs=require('fs');var path=require(_0xf0fc('0x6'));var rimraf=require(_0xf0fc('0x7'));var config=require(_0xf0fc('0x8'));var attributes=require(_0xf0fc('0x9'));module[_0xf0fc('0xa')]=function(_0x51509d,_0x3f66bf){return _0x51509d[_0xf0fc('0xb')](_0xf0fc('0xc'),attributes,{'tableName':_0xf0fc('0xd'),'paranoid':![],'indexes':[{'name':_0xf0fc('0xe'),'fields':[_0xf0fc('0xe')]},{'name':'uniqueid','fields':[_0xf0fc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x265f=['calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x265f,0x1bc));var _0xf265=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x265f[_0x18776a];return _0x484e4a;};'use strict';var _=require(_0xf265('0x0'));var util=require(_0xf265('0x1'));var logger=require(_0xf265('0x2'))('api');var moment=require(_0xf265('0x3'));var BPromise=require(_0xf265('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf265('0x5'));var config=require(_0xf265('0x6'));var attributes=require(_0xf265('0x7'));module[_0xf265('0x8')]=function(_0x542a9c,_0x24ac8e){return _0x542a9c[_0xf265('0x9')]('CmHopperFinal',attributes,{'tableName':_0xf265('0xa'),'paranoid':![],'indexes':[{'name':_0xf265('0xb'),'fields':[_0xf265('0xb')]},{'name':_0xf265('0xc'),'fields':[_0xf265('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 660f30e..d3bc69c 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x18d4d7,_0x29fb50){var _0xde5e0=function(_0x431d38){while(--_0x431d38){_0x18d4d7['push'](_0x18d4d7['shift']());}};_0xde5e0(++_0x29fb50);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a9e73,_0x567a70){_0x3a9e73=_0x3a9e73-0x0;var _0x5af67a=_0xb10b[_0x3a9e73];return _0x5af67a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xc4c212,_0xa8541b){var _0x320625=function(_0xaa44da){while(--_0xaa44da){_0xc4c212['push'](_0xc4c212['shift']());}};_0x320625(++_0xa8541b);}(_0x7a54,0x106));var _0x47a5=function(_0x2a4c30,_0x15ee72){_0x2a4c30=_0x2a4c30-0x0;var _0x3ae04c=_0x7a54[_0x2a4c30];return _0x3ae04c;};'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 2f1b943..a2f88c5 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 _0x3f06=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','connect-timeout','express','fs-extra'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3f06,0x140));var _0x63f0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3f06[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x63f0('0x0'));var path=require('path');var timeout=require(_0x63f0('0x1'));var express=require(_0x63f0('0x2'));var router=express['Router']();var fs_extra=require(_0x63f0('0x3'));var auth=require(_0x63f0('0x4'));var interaction=require(_0x63f0('0x5'));var config=require(_0x63f0('0x6'));var controller=require(_0x63f0('0x7'));router[_0x63f0('0x8')]('/',auth[_0x63f0('0x9')](),controller[_0x63f0('0xa')]);router['get'](_0x63f0('0xb'),auth[_0x63f0('0x9')](),controller['describe']);router['get'](_0x63f0('0xc'),auth['isAuthenticated'](),controller[_0x63f0('0xd')]);router['get'](_0x63f0('0xe'),auth[_0x63f0('0x9')](),controller[_0x63f0('0xf')]);router[_0x63f0('0x8')](_0x63f0('0x10'),auth[_0x63f0('0x9')](),controller[_0x63f0('0x11')]);router['post'](_0x63f0('0x12'),auth[_0x63f0('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x63f0('0x13')](_0x63f0('0x14'),auth[_0x63f0('0x9')](),controller[_0x63f0('0x15')]);router[_0x63f0('0x13')](_0x63f0('0x16'),auth[_0x63f0('0x9')](),controller[_0x63f0('0x17')]);router[_0x63f0('0x18')]('/:id',auth[_0x63f0('0x9')](),controller[_0x63f0('0x19')]);module[_0x63f0('0x1a')]=router; \ No newline at end of file +var _0x3a15=['update','exports','multer','path','express','Router','fs-extra','../../config/environment','index','/describe','isAuthenticated','describe','/:id','countContactsQueueCampaignHopperFinal','get','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x3a15,0xde));var _0x53a1=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x3a15[_0x59ae8f];return _0x3900b5;};'use strict';var multer=require(_0x53a1('0x0'));var util=require('util');var path=require(_0x53a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x53a1('0x2'));var router=express[_0x53a1('0x3')]();var fs_extra=require(_0x53a1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53a1('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x53a1('0x6')]);router['get'](_0x53a1('0x7'),auth[_0x53a1('0x8')](),controller[_0x53a1('0x9')]);router['get'](_0x53a1('0xa'),auth[_0x53a1('0x8')](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth[_0x53a1('0x8')](),controller[_0x53a1('0xb')]);router[_0x53a1('0xc')](_0x53a1('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x53a1('0xe'),auth[_0x53a1('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x53a1('0xf')](_0x53a1('0x10'),auth[_0x53a1('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x53a1('0xf')](_0x53a1('0x11'),auth[_0x53a1('0x8')](),controller[_0x53a1('0x12')]);router[_0x53a1('0x13')](_0x53a1('0xa'),auth[_0x53a1('0x8')](),controller[_0x53a1('0x14')]);module[_0x53a1('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0dde881..1ae7b1c 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 _0xf40b=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x2eb7d3,_0x406bd9){var _0x5a690e=function(_0xe2fa10){while(--_0xe2fa10){_0x2eb7d3['push'](_0x2eb7d3['shift']());}};_0x5a690e(++_0x406bd9);}(_0xf40b,0xf7));var _0xbf40=function(_0x17b8a9,_0x3bbf58){_0x17b8a9=_0x17b8a9-0x0;var _0x4add80=_0xf40b[_0x17b8a9];return _0x4add80;};'use strict';var Sequelize=require(_0xbf40('0x0'));module['exports']={'state':{'type':Sequelize[_0xbf40('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xbf40('0x2')]},'countbusyretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbf40('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbf40('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbf40('0x3')]},'calleridname':{'type':Sequelize[_0xbf40('0x3')]},'starttime':{'type':Sequelize[_0xbf40('0x2')]},'responsetime':{'type':Sequelize[_0xbf40('0x2')]},'answertime':{'type':Sequelize[_0xbf40('0x2')]},'droptime':{'type':Sequelize[_0xbf40('0x2')]},'endtime':{'type':Sequelize[_0xbf40('0x2')]},'ringtime':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbf40('0x3')]},'campaign':{'type':Sequelize[_0xbf40('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbf40('0x3')]},'amd':{'type':Sequelize[_0xbf40('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbf40('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbf40('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbf40('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbf40('0x2')]},'edited':{'type':Sequelize[_0xbf40('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbf40('0x3')]}}; \ No newline at end of file +var _0x1e67=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x11da67,_0x3cdd80){var _0x1a3b1b=function(_0x174b1e){while(--_0x174b1e){_0x11da67['push'](_0x11da67['shift']());}};_0x1a3b1b(++_0x3cdd80);}(_0x1e67,0x1dc));var _0x71e6=function(_0x193332,_0x550400){_0x193332=_0x193332-0x0;var _0x22e752=_0x1e67[_0x193332];return _0x22e752;};'use strict';var Sequelize=require('sequelize');module[_0x71e6('0x0')]={'state':{'type':Sequelize[_0x71e6('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x71e6('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x71e6('0x2')]},'originatecalleridname':{'type':Sequelize[_0x71e6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x71e6('0x2')]},'starttime':{'type':Sequelize[_0x71e6('0x3')]},'responsetime':{'type':Sequelize[_0x71e6('0x3')]},'answertime':{'type':Sequelize[_0x71e6('0x3')]},'droptime':{'type':Sequelize[_0x71e6('0x3')]},'endtime':{'type':Sequelize[_0x71e6('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x71e6('0x2')]},'campaigntype':{'type':Sequelize[_0x71e6('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x71e6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x71e6('0x3')]},'recallme':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x71e6('0x3')]},'edited':{'type':Sequelize[_0x71e6('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x71e6('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x71e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 202fd97..9ab8fa6 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 _0x81ba=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xefd445,_0x499913){var _0x19e6c9=function(_0x21b8ca){while(--_0x21b8ca){_0xefd445['push'](_0xefd445['shift']());}};_0x19e6c9(++_0x499913);}(_0x81ba,0x89));var _0xa81b=function(_0x2bc49e,_0x2aa2c1){_0x2bc49e=_0x2bc49e-0x0;var _0x509138=_0x81ba[_0x2bc49e];return _0x509138;};'use strict';var emlformat=require(_0xa81b('0x0'));var rimraf=require(_0xa81b('0x1'));var zipdir=require(_0xa81b('0x2'));var jsonpatch=require(_0xa81b('0x3'));var rp=require(_0xa81b('0x4'));var moment=require(_0xa81b('0x5'));var BPromise=require(_0xa81b('0x6'));var Mustache=require(_0xa81b('0x7'));var util=require('util');var path=require(_0xa81b('0x8'));var sox=require('sox');var csv=require(_0xa81b('0x9'));var ejs=require(_0xa81b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa81b('0xb'));var squel=require(_0xa81b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa81b('0xd'));var deskjs=require(_0xa81b('0xe'));var toCsv=require(_0xa81b('0x9'));var querystring=require(_0xa81b('0xf'));var Papa=require(_0xa81b('0x10'));var Redis=require('ioredis');var authService=require(_0xa81b('0x11'));var qs=require(_0xa81b('0x12'));var as=require(_0xa81b('0x13'));var hardwareService=require(_0xa81b('0x14'));var logger=require('../../config/logger')(_0xa81b('0x15'));var utils=require(_0xa81b('0x16'));var config=require(_0xa81b('0x17'));var licenseUtil=require(_0xa81b('0x18'));var db=require(_0xa81b('0x19'))['db'];function respondWithStatusCode(_0x1b538f,_0xce334b){_0xce334b=_0xce334b||0xcc;return function(_0x3e0ab4){if(_0x3e0ab4){return _0x1b538f[_0xa81b('0x1a')](_0xce334b);}return _0x1b538f[_0xa81b('0x1b')](_0xce334b)[_0xa81b('0x1c')]();};}function respondWithResult(_0x2a43be,_0x19e86b){_0x19e86b=_0x19e86b||0xc8;return function(_0x14b7a8){if(_0x14b7a8){return _0x2a43be[_0xa81b('0x1b')](_0x19e86b)[_0xa81b('0x1d')](_0x14b7a8);}};}function respondWithFilteredResult(_0x4d8be7,_0x4e834a){return function(_0x3e0099){if(_0x3e0099){var _0x1f60cf=typeof _0x4e834a[_0xa81b('0x1e')]===_0xa81b('0x1f')&&typeof _0x4e834a[_0xa81b('0x20')]===_0xa81b('0x1f');var _0x25c3d0=_0x3e0099[_0xa81b('0x21')];var _0x258be4=_0x1f60cf?0x0:_0x4e834a[_0xa81b('0x1e')];var _0x48dc40=_0x1f60cf?_0x3e0099[_0xa81b('0x21')]:_0x4e834a[_0xa81b('0x1e')]+_0x4e834a[_0xa81b('0x20')];var _0x268049;if(_0x48dc40>=_0x25c3d0){_0x48dc40=_0x25c3d0;_0x268049=0xc8;}else{_0x268049=0xce;}_0x4d8be7[_0xa81b('0x1b')](_0x268049);return _0x4d8be7[_0xa81b('0x22')]('Content-Range',_0x258be4+'-'+_0x48dc40+'/'+_0x25c3d0)[_0xa81b('0x1d')](_0x3e0099);}return null;};}function patchUpdates(_0x197582){return function(_0x3ad067){try{jsonpatch[_0xa81b('0x23')](_0x3ad067,_0x197582,!![]);}catch(_0x8da72b){return BPromise[_0xa81b('0x24')](_0x8da72b);}return _0x3ad067[_0xa81b('0x25')]();};}function saveUpdates(_0x42946b,_0x190ca5){return function(_0x21f00c){if(_0x21f00c){return _0x21f00c[_0xa81b('0x26')](_0x42946b)[_0xa81b('0x27')](function(_0x279c5d){return _0x279c5d;});}return null;};}function removeEntity(_0x1f5084,_0x43338a){return function(_0x50b628){if(_0x50b628){return _0x50b628[_0xa81b('0x28')]()[_0xa81b('0x27')](function(){_0x1f5084[_0xa81b('0x1b')](0xcc)[_0xa81b('0x1c')]();});}};}function handleEntityNotFound(_0x27c6f7,_0x45e821){return function(_0x5b9495){if(!_0x5b9495){_0x27c6f7[_0xa81b('0x1a')](0x194);}return _0x5b9495;};}function handleError(_0x1f64df,_0x1b17b4){_0x1b17b4=_0x1b17b4||0x1f4;return function(_0xdb6a90){logger['error'](_0xdb6a90[_0xa81b('0x29')]);if(_0xdb6a90[_0xa81b('0x2a')]){delete _0xdb6a90[_0xa81b('0x2a')];}_0x1f64df['status'](_0x1b17b4)[_0xa81b('0x2b')](_0xdb6a90);};}exports[_0xa81b('0x2c')]=function(_0x2fd3e0,_0x38bc7b){var _0x41e8a7={},_0x3be38c={},_0x3ac4a5={'count':0x0,'rows':[]};var _0x1c5873=_[_0xa81b('0x2d')](db[_0xa81b('0x2e')][_0xa81b('0x2f')],function(_0x448672){return{'name':_0x448672[_0xa81b('0x30')],'type':_0x448672[_0xa81b('0x31')][_0xa81b('0x32')]};});_0x3be38c[_0xa81b('0x33')]=_[_0xa81b('0x2d')](_0x1c5873,'name');_0x3be38c[_0xa81b('0x34')]=_['keys'](_0x2fd3e0['query']);_0x3be38c[_0xa81b('0x35')]=_[_0xa81b('0x36')](_0x3be38c[_0xa81b('0x33')],_0x3be38c['query']);_0x41e8a7[_0xa81b('0x37')]=_[_0xa81b('0x36')](_0x3be38c['model'],qs[_0xa81b('0x38')](_0x2fd3e0['query'][_0xa81b('0x38')]));_0x41e8a7[_0xa81b('0x37')]=_0x41e8a7[_0xa81b('0x37')][_0xa81b('0x39')]?_0x41e8a7[_0xa81b('0x37')]:_0x3be38c[_0xa81b('0x33')];if(!_0x2fd3e0[_0xa81b('0x34')][_0xa81b('0x3a')](_0xa81b('0x3b'))){_0x41e8a7[_0xa81b('0x20')]=qs[_0xa81b('0x20')](_0x2fd3e0[_0xa81b('0x34')]['limit']);_0x41e8a7[_0xa81b('0x1e')]=qs[_0xa81b('0x1e')](_0x2fd3e0[_0xa81b('0x34')][_0xa81b('0x1e')]);}_0x41e8a7[_0xa81b('0x3c')]=qs[_0xa81b('0x3d')](_0x2fd3e0[_0xa81b('0x34')][_0xa81b('0x3d')]);_0x41e8a7[_0xa81b('0x3e')]=qs['filters'](_[_0xa81b('0x3f')](_0x2fd3e0['query'],_0x3be38c[_0xa81b('0x35')]),_0x1c5873);if(_0x2fd3e0[_0xa81b('0x34')][_0xa81b('0x40')]){_0x41e8a7[_0xa81b('0x3e')]=_[_0xa81b('0x41')](_0x41e8a7[_0xa81b('0x3e')],{'$or':_[_0xa81b('0x2d')](_0x1c5873,function(_0x29aa95){if(_0x29aa95[_0xa81b('0x31')]!==_0xa81b('0x42')){var _0x2f04fe={};_0x2f04fe[_0x29aa95[_0xa81b('0x2a')]]={'$like':'%'+_0x2fd3e0[_0xa81b('0x34')]['filter']+'%'};return _0x2f04fe;}})});}_0x41e8a7=_[_0xa81b('0x41')]({},_0x41e8a7,_0x2fd3e0['options']);var _0x2df374={'where':_0x41e8a7[_0xa81b('0x3e')]};return db['CmHopperHistory'][_0xa81b('0x21')](_0x2df374)[_0xa81b('0x27')](function(_0x313173){_0x3ac4a5[_0xa81b('0x21')]=_0x313173;if(_0x2fd3e0[_0xa81b('0x34')][_0xa81b('0x43')]){_0x41e8a7[_0xa81b('0x44')]=[{'all':!![]}];}return db[_0xa81b('0x2e')][_0xa81b('0x45')](_0x41e8a7);})[_0xa81b('0x27')](function(_0x532ea8){_0x3ac4a5[_0xa81b('0x46')]=_0x532ea8;return _0x3ac4a5;})[_0xa81b('0x27')](respondWithFilteredResult(_0x38bc7b,_0x41e8a7))[_0xa81b('0x47')](handleError(_0x38bc7b,null));};exports['show']=function(_0x27e65b,_0x478e0a){var _0x262fcd={'raw':!![],'where':{'id':_0x27e65b[_0xa81b('0x48')]['id']}},_0x22b291={};_0x22b291[_0xa81b('0x33')]=_[_0xa81b('0x49')](db[_0xa81b('0x2e')][_0xa81b('0x2f')]);_0x22b291[_0xa81b('0x34')]=_[_0xa81b('0x49')](_0x27e65b[_0xa81b('0x34')]);_0x22b291[_0xa81b('0x35')]=_[_0xa81b('0x36')](_0x22b291[_0xa81b('0x33')],_0x22b291[_0xa81b('0x34')]);_0x262fcd[_0xa81b('0x37')]=_[_0xa81b('0x36')](_0x22b291[_0xa81b('0x33')],qs[_0xa81b('0x38')](_0x27e65b[_0xa81b('0x34')][_0xa81b('0x38')]));_0x262fcd[_0xa81b('0x37')]=_0x262fcd[_0xa81b('0x37')][_0xa81b('0x39')]?_0x262fcd[_0xa81b('0x37')]:_0x22b291[_0xa81b('0x33')];if(_0x27e65b[_0xa81b('0x34')][_0xa81b('0x43')]){_0x262fcd[_0xa81b('0x44')]=[{'all':!![]}];}_0x262fcd=_[_0xa81b('0x41')]({},_0x262fcd,_0x27e65b['options']);return db['CmHopperHistory'][_0xa81b('0x4a')](_0x262fcd)[_0xa81b('0x27')](handleEntityNotFound(_0x478e0a,null))['then'](respondWithResult(_0x478e0a,null))['catch'](handleError(_0x478e0a,null));};exports['create']=function(_0x3d16f7,_0x143a73){return db['CmHopperHistory']['create'](_0x3d16f7[_0xa81b('0x4b')],{})[_0xa81b('0x27')](respondWithResult(_0x143a73,0xc9))[_0xa81b('0x47')](handleError(_0x143a73,null));};exports[_0xa81b('0x4c')]=function(_0x2d7508,_0x522d75){return db[_0xa81b('0x2e')][_0xa81b('0x4c')]()[_0xa81b('0x27')](respondWithResult(_0x522d75,null))['catch'](handleError(_0x522d75,null));};exports[_0xa81b('0x26')]=function(_0x57649b,_0x44a305){if(_0x57649b[_0xa81b('0x4b')][_0xa81b('0x4d')]){delete _0x57649b[_0xa81b('0x4b')][_0xa81b('0x4d')];}return db[_0xa81b('0x2e')][_0xa81b('0x4a')]({'where':{'uniqueid':_0x57649b[_0xa81b('0x48')]['id']}})[_0xa81b('0x27')](handleEntityNotFound(_0x44a305,null))[_0xa81b('0x27')](saveUpdates(_0x57649b['body'],null))['then'](respondWithResult(_0x44a305,null))[_0xa81b('0x47')](handleError(_0x44a305,null));}; \ No newline at end of file +var _0xa1b7=['include','findAll','rows','catch','show','params','length','create','body','describe','update','find','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll'];(function(_0xd33d7c,_0xb71592){var _0xd355b2=function(_0x2a125e){while(--_0x2a125e){_0xd33d7c['push'](_0xd33d7c['shift']());}};_0xd355b2(++_0xb71592);}(_0xa1b7,0xa2));var _0x7a1b=function(_0x24e299,_0x23e4c0){_0x24e299=_0x24e299-0x0;var _0xe7520=_0xa1b7[_0x24e299];return _0xe7520;};'use strict';var emlformat=require(_0x7a1b('0x0'));var rimraf=require(_0x7a1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a1b('0x2'));var rp=require('request-promise');var moment=require(_0x7a1b('0x3'));var BPromise=require(_0x7a1b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7a1b('0x5'));var sox=require(_0x7a1b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a1b('0x7'));var _=require(_0x7a1b('0x8'));var squel=require('squel');var crypto=require(_0x7a1b('0x9'));var jsforce=require(_0x7a1b('0xa'));var deskjs=require(_0x7a1b('0xb'));var toCsv=require(_0x7a1b('0xc'));var querystring=require(_0x7a1b('0xd'));var Papa=require(_0x7a1b('0xe'));var Redis=require(_0x7a1b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a1b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a1b('0x11'));var logger=require(_0x7a1b('0x12'))(_0x7a1b('0x13'));var utils=require('../../config/utils');var config=require(_0x7a1b('0x14'));var licenseUtil=require(_0x7a1b('0x15'));var db=require(_0x7a1b('0x16'))['db'];function respondWithStatusCode(_0x18f04e,_0x4af409){_0x4af409=_0x4af409||0xcc;return function(_0x2a9cbc){if(_0x2a9cbc){return _0x18f04e[_0x7a1b('0x17')](_0x4af409);}return _0x18f04e[_0x7a1b('0x18')](_0x4af409)['end']();};}function respondWithResult(_0x447870,_0x34721a){_0x34721a=_0x34721a||0xc8;return function(_0x44759e){if(_0x44759e){return _0x447870['status'](_0x34721a)[_0x7a1b('0x19')](_0x44759e);}};}function respondWithFilteredResult(_0x4ebb71,_0xfbd0f3){return function(_0x49ba89){if(_0x49ba89){var _0x1fae0a=typeof _0xfbd0f3[_0x7a1b('0x1a')]===_0x7a1b('0x1b')&&typeof _0xfbd0f3[_0x7a1b('0x1c')]==='undefined';var _0x486fc4=_0x49ba89[_0x7a1b('0x1d')];var _0x4e7e5a=_0x1fae0a?0x0:_0xfbd0f3[_0x7a1b('0x1a')];var _0x352bda=_0x1fae0a?_0x49ba89[_0x7a1b('0x1d')]:_0xfbd0f3[_0x7a1b('0x1a')]+_0xfbd0f3['limit'];var _0x4d3382;if(_0x352bda>=_0x486fc4){_0x352bda=_0x486fc4;_0x4d3382=0xc8;}else{_0x4d3382=0xce;}_0x4ebb71[_0x7a1b('0x18')](_0x4d3382);return _0x4ebb71[_0x7a1b('0x1e')](_0x7a1b('0x1f'),_0x4e7e5a+'-'+_0x352bda+'/'+_0x486fc4)[_0x7a1b('0x19')](_0x49ba89);}return null;};}function patchUpdates(_0x969a7){return function(_0x5cab42){try{jsonpatch['apply'](_0x5cab42,_0x969a7,!![]);}catch(_0x52b493){return BPromise['reject'](_0x52b493);}return _0x5cab42[_0x7a1b('0x20')]();};}function saveUpdates(_0x725ca6,_0x3e2d55){return function(_0x2c541c){if(_0x2c541c){return _0x2c541c['update'](_0x725ca6)[_0x7a1b('0x21')](function(_0x44a2cd){return _0x44a2cd;});}return null;};}function removeEntity(_0x217081,_0x2d1ca3){return function(_0x138c38){if(_0x138c38){return _0x138c38[_0x7a1b('0x22')]()[_0x7a1b('0x21')](function(){_0x217081[_0x7a1b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ba86,_0x52c68c){return function(_0x2d92e6){if(!_0x2d92e6){_0x41ba86[_0x7a1b('0x17')](0x194);}return _0x2d92e6;};}function handleError(_0x41d0df,_0x3a3b7e){_0x3a3b7e=_0x3a3b7e||0x1f4;return function(_0x290446){logger[_0x7a1b('0x23')](_0x290446[_0x7a1b('0x24')]);if(_0x290446['name']){delete _0x290446[_0x7a1b('0x25')];}_0x41d0df[_0x7a1b('0x18')](_0x3a3b7e)[_0x7a1b('0x26')](_0x290446);};}exports[_0x7a1b('0x27')]=function(_0x21870e,_0x45fe5a){var _0x57d23b={},_0x4c027f={},_0x17ae51={'count':0x0,'rows':[]};var _0x1a04e9=_[_0x7a1b('0x28')](db[_0x7a1b('0x29')][_0x7a1b('0x2a')],function(_0x3cc0cd){return{'name':_0x3cc0cd[_0x7a1b('0x2b')],'type':_0x3cc0cd[_0x7a1b('0x2c')][_0x7a1b('0x2d')]};});_0x4c027f[_0x7a1b('0x2e')]=_[_0x7a1b('0x28')](_0x1a04e9,'name');_0x4c027f['query']=_[_0x7a1b('0x2f')](_0x21870e[_0x7a1b('0x30')]);_0x4c027f[_0x7a1b('0x31')]=_[_0x7a1b('0x32')](_0x4c027f['model'],_0x4c027f['query']);_0x57d23b['attributes']=_[_0x7a1b('0x32')](_0x4c027f['model'],qs[_0x7a1b('0x33')](_0x21870e[_0x7a1b('0x30')][_0x7a1b('0x33')]));_0x57d23b[_0x7a1b('0x34')]=_0x57d23b['attributes']['length']?_0x57d23b[_0x7a1b('0x34')]:_0x4c027f['model'];if(!_0x21870e['query'][_0x7a1b('0x35')](_0x7a1b('0x36'))){_0x57d23b[_0x7a1b('0x1c')]=qs[_0x7a1b('0x1c')](_0x21870e['query'][_0x7a1b('0x1c')]);_0x57d23b['offset']=qs['offset'](_0x21870e[_0x7a1b('0x30')][_0x7a1b('0x1a')]);}_0x57d23b[_0x7a1b('0x37')]=qs[_0x7a1b('0x38')](_0x21870e[_0x7a1b('0x30')][_0x7a1b('0x38')]);_0x57d23b[_0x7a1b('0x39')]=qs[_0x7a1b('0x31')](_[_0x7a1b('0x3a')](_0x21870e[_0x7a1b('0x30')],_0x4c027f[_0x7a1b('0x31')]),_0x1a04e9);if(_0x21870e['query']['filter']){_0x57d23b[_0x7a1b('0x39')]=_[_0x7a1b('0x3b')](_0x57d23b[_0x7a1b('0x39')],{'$or':_['map'](_0x1a04e9,function(_0x5d22c1){if(_0x5d22c1[_0x7a1b('0x2c')]!=='VIRTUAL'){var _0x42eedf={};_0x42eedf[_0x5d22c1['name']]={'$like':'%'+_0x21870e[_0x7a1b('0x30')][_0x7a1b('0x3c')]+'%'};return _0x42eedf;}})});}_0x57d23b=_[_0x7a1b('0x3b')]({},_0x57d23b,_0x21870e[_0x7a1b('0x3d')]);var _0x58da12={'where':_0x57d23b[_0x7a1b('0x39')]};return db['CmHopperHistory'][_0x7a1b('0x1d')](_0x58da12)[_0x7a1b('0x21')](function(_0x521b25){_0x17ae51['count']=_0x521b25;if(_0x21870e['query'][_0x7a1b('0x3e')]){_0x57d23b[_0x7a1b('0x3f')]=[{'all':!![]}];}return db[_0x7a1b('0x29')][_0x7a1b('0x40')](_0x57d23b);})['then'](function(_0x16d24e){_0x17ae51[_0x7a1b('0x41')]=_0x16d24e;return _0x17ae51;})[_0x7a1b('0x21')](respondWithFilteredResult(_0x45fe5a,_0x57d23b))[_0x7a1b('0x42')](handleError(_0x45fe5a,null));};exports[_0x7a1b('0x43')]=function(_0x7feaed,_0x20f1fe){var _0x3da202={'raw':!![],'where':{'id':_0x7feaed[_0x7a1b('0x44')]['id']}},_0x522250={};_0x522250[_0x7a1b('0x2e')]=_[_0x7a1b('0x2f')](db[_0x7a1b('0x29')]['rawAttributes']);_0x522250[_0x7a1b('0x30')]=_[_0x7a1b('0x2f')](_0x7feaed[_0x7a1b('0x30')]);_0x522250[_0x7a1b('0x31')]=_[_0x7a1b('0x32')](_0x522250[_0x7a1b('0x2e')],_0x522250[_0x7a1b('0x30')]);_0x3da202[_0x7a1b('0x34')]=_[_0x7a1b('0x32')](_0x522250['model'],qs[_0x7a1b('0x33')](_0x7feaed['query'][_0x7a1b('0x33')]));_0x3da202[_0x7a1b('0x34')]=_0x3da202[_0x7a1b('0x34')][_0x7a1b('0x45')]?_0x3da202[_0x7a1b('0x34')]:_0x522250[_0x7a1b('0x2e')];if(_0x7feaed[_0x7a1b('0x30')]['includeAll']){_0x3da202[_0x7a1b('0x3f')]=[{'all':!![]}];}_0x3da202=_[_0x7a1b('0x3b')]({},_0x3da202,_0x7feaed[_0x7a1b('0x3d')]);return db['CmHopperHistory']['find'](_0x3da202)[_0x7a1b('0x21')](handleEntityNotFound(_0x20f1fe,null))[_0x7a1b('0x21')](respondWithResult(_0x20f1fe,null))[_0x7a1b('0x42')](handleError(_0x20f1fe,null));};exports[_0x7a1b('0x46')]=function(_0x2a8202,_0x40c12a){return db['CmHopperHistory'][_0x7a1b('0x46')](_0x2a8202[_0x7a1b('0x47')],{})[_0x7a1b('0x21')](respondWithResult(_0x40c12a,0xc9))[_0x7a1b('0x42')](handleError(_0x40c12a,null));};exports[_0x7a1b('0x48')]=function(_0x179fdd,_0xef8bb5){return db[_0x7a1b('0x29')][_0x7a1b('0x48')]()[_0x7a1b('0x21')](respondWithResult(_0xef8bb5,null))['catch'](handleError(_0xef8bb5,null));};exports[_0x7a1b('0x49')]=function(_0x559148,_0x2b8a36){if(_0x559148[_0x7a1b('0x47')]['uniqueid']){delete _0x559148['body']['uniqueid'];}return db[_0x7a1b('0x29')][_0x7a1b('0x4a')]({'where':{'uniqueid':_0x559148[_0x7a1b('0x44')]['id']}})[_0x7a1b('0x21')](handleEntityNotFound(_0x2b8a36,null))[_0x7a1b('0x21')](saveUpdates(_0x559148['body'],null))[_0x7a1b('0x21')](respondWithResult(_0x2b8a36,null))[_0x7a1b('0x42')](handleError(_0x2b8a36,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 217cc72..93bbb80 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 _0x8374=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x2f6c9f,_0xbfa9a9){var _0x2f23a8=function(_0x5ba78d){while(--_0x5ba78d){_0x2f6c9f['push'](_0x2f6c9f['shift']());}};_0x2f23a8(++_0xbfa9a9);}(_0x8374,0x174));var _0x4837=function(_0x46db1f,_0x214aaf){_0x46db1f=_0x46db1f-0x0;var _0x47b247=_0x8374[_0x46db1f];return _0x47b247;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require(_0x4837('0x4'));var BPromise=require(_0x4837('0x5'));var rp=require(_0x4837('0x6'));var fs=require('fs');var path=require(_0x4837('0x7'));var rimraf=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var attributes=require(_0x4837('0xa'));module[_0x4837('0xb')]=function(_0x2bd5a7,_0x425c07){return _0x2bd5a7['define'](_0x4837('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x4837('0xd'),'fields':[_0x4837('0xd')]},{'name':_0x4837('0xe'),'fields':[_0x4837('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','util','../../config/logger','api','bluebird'];(function(_0x112476,_0x52ac6c){var _0x1df46d=function(_0x2235a2){while(--_0x2235a2){_0x112476['push'](_0x112476['shift']());}};_0x1df46d(++_0x52ac6c);}(_0x2032,0xd9));var _0x2203=function(_0x581911,_0x103549){_0x581911=_0x581911-0x0;var _0x58e897=_0x2032[_0x581911];return _0x58e897;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'name':_0x2203('0xc'),'fields':[_0x2203('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 925a0e8..f0850a4 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 _0xd6fd=['client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','options','raw','CreateCmHopperHistory','AvgHandleTime','sequelize','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','then','GetVoiceQueueHopperHistory','findAll','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0xd6fd,0x7d));var _0xdd6f=function(_0x1c238f,_0x36012b){_0x1c238f=_0x1c238f-0x0;var _0x344288=_0xd6fd[_0x1c238f];return _0x344288;};'use strict';var _=require(_0xdd6f('0x0'));var util=require(_0xdd6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd6f('0x2'));var db=require(_0xdd6f('0x3'))['db'];var utils=require(_0xdd6f('0x4'));var logger=require(_0xdd6f('0x5'))(_0xdd6f('0x6'));var config=require(_0xdd6f('0x7'));var jayson=require(_0xdd6f('0x8'));var client=jayson[_0xdd6f('0x9')][_0xdd6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10a842,_0x1dff4d,_0x3219e2){return new BPromise(function(_0x52ae13,_0x515ad8){return client[_0xdd6f('0xb')](_0x10a842,_0x3219e2)['then'](function(_0x35fc53){logger[_0xdd6f('0xc')](_0xdd6f('0xd'),_0x1dff4d,_0xdd6f('0xe'));logger[_0xdd6f('0xf')](_0xdd6f('0x10'),_0x1dff4d,_0xdd6f('0xe'),JSON[_0xdd6f('0x11')](_0x35fc53));if(_0x35fc53[_0xdd6f('0x12')]){if(_0x35fc53[_0xdd6f('0x12')][_0xdd6f('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1dff4d,_0x35fc53['error']['message']);return _0x515ad8(_0x35fc53[_0xdd6f('0x12')][_0xdd6f('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1dff4d,_0x35fc53['error'][_0xdd6f('0x14')]);return _0x52ae13(_0x35fc53[_0xdd6f('0x12')][_0xdd6f('0x14')]);}else{logger[_0xdd6f('0xc')](_0xdd6f('0xd'),_0x1dff4d,'request\x20sent');_0x52ae13(_0x35fc53[_0xdd6f('0x15')][_0xdd6f('0x14')]);}})[_0xdd6f('0x16')](function(_0x5e72a6){logger['error'](_0xdd6f('0xd'),_0x1dff4d,_0x5e72a6);_0x515ad8(_0x5e72a6);});});}exports['CreateCmHopperHistory']=function(_0x1ef38f){var _0x4286ae=this;return new Promise(function(_0x4b5215,_0x9e87f2){return db[_0xdd6f('0x17')]['create'](_0x1ef38f['body'],{'raw':_0x1ef38f['options']?_0x1ef38f[_0xdd6f('0x18')][_0xdd6f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x49bcb9){logger[_0xdd6f('0xc')]('CreateCmHopperHistory',_0x1ef38f);logger[_0xdd6f('0xf')]('CreateCmHopperHistory',_0x1ef38f,JSON[_0xdd6f('0x11')](_0x49bcb9));_0x4b5215(_0x49bcb9);})[_0xdd6f('0x16')](function(_0x5c33e9){logger[_0xdd6f('0x12')](_0xdd6f('0x1a'),_0x5c33e9[_0xdd6f('0x14')],_0x1ef38f);_0x9e87f2(_0x4286ae['error'](0x1f4,_0x5c33e9[_0xdd6f('0x14')]));});});};exports[_0xdd6f('0x1b')]=function(_0x49b961){var _0x3de039=this;return new Promise(function(_0x9a1021,_0x5b419d){return db[_0xdd6f('0x17')]['findAll']({'raw':_0x49b961[_0xdd6f('0x18')]?_0x49b961[_0xdd6f('0x18')][_0xdd6f('0x19')]===undefined?!![]:![]:!![],'where':_0x49b961[_0xdd6f('0x18')]?_0x49b961[_0xdd6f('0x18')]['where']||null:null,'attributes':[[db[_0xdd6f('0x1c')]['fn']('COUNT',db[_0xdd6f('0x1c')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x1f')))),_0xdd6f('0x20')],[db['sequelize']['fn']('COUNT',db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x21')))),_0xdd6f('0x22')],[db[_0xdd6f('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x23')))),_0xdd6f('0x24')],[db['sequelize']['fn'](_0xdd6f('0x25'),db[_0xdd6f('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xdd6f('0x26')))),'predictiveIntervalAvgTalktime']]})[_0xdd6f('0x27')](function(_0x44e58b){logger[_0xdd6f('0xc')](_0xdd6f('0x1b'),_0x49b961);logger[_0xdd6f('0xf')](_0xdd6f('0x1b'),_0x49b961,JSON[_0xdd6f('0x11')](_0x44e58b));_0x9a1021(_0x44e58b);})[_0xdd6f('0x16')](function(_0x4cb7c8){logger[_0xdd6f('0x12')](_0xdd6f('0x1b'),_0x4cb7c8[_0xdd6f('0x14')],_0x49b961);_0x5b419d(_0x3de039[_0xdd6f('0x12')](0x1f4,_0x4cb7c8['message']));});});};exports[_0xdd6f('0x28')]=function(_0x1598ee){var _0x34185d=this;return new Promise(function(_0xbe9ae4,_0x3cd952){return db['CmHopperHistory'][_0xdd6f('0x29')]({'raw':_0x1598ee[_0xdd6f('0x18')]?_0x1598ee[_0xdd6f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1598ee[_0xdd6f('0x18')]?_0x1598ee[_0xdd6f('0x18')][_0xdd6f('0x2a')]||null:null,'attributes':[[_0xdd6f('0x2b'),_0xdd6f('0x2c')],[db[_0xdd6f('0x1c')]['fn']('COUNT',db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')]('`state`\x20=\x200,\x201,\x20null'))),_0xdd6f('0x2d')],[db[_0xdd6f('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xdd6f('0x1e')](_0xdd6f('0x2e')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')]['literal'](_0xdd6f('0x2f')))),_0xdd6f('0x30')],[db['sequelize']['fn'](_0xdd6f('0x1d'),db['sequelize']['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x31')))),_0xdd6f('0x32')],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')]['literal'](_0xdd6f('0x33')))),_0xdd6f('0x34')],[db['sequelize']['fn'](_0xdd6f('0x1d'),db['sequelize']['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x35')))),'outboundDropCallsDayTimeout'],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db['sequelize'][_0xdd6f('0x1e')](_0xdd6f('0x36')))),_0xdd6f('0x37')],[db['sequelize']['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x38')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdd6f('0x1c')]['literal'](_0xdd6f('0x39')))),_0xdd6f('0x3a')],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db['sequelize']['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x3b')))),_0xdd6f('0x3c')],[db['sequelize']['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xdd6f('0x1c')]['fn']('COUNT',db[_0xdd6f('0x1c')]['fn']('IF',db['sequelize'][_0xdd6f('0x1e')](_0xdd6f('0x3d')))),'outboundRejectCallsDay'],[db[_0xdd6f('0x1c')]['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db['sequelize'][_0xdd6f('0x1e')](_0xdd6f('0x3e')))),'outboundReCallsDay']],'group':[_0xdd6f('0x2b')]})[_0xdd6f('0x27')](function(_0x3ca304){logger[_0xdd6f('0xc')]('GetVoiceQueueHopperHistory',_0x1598ee);logger['debug'](_0xdd6f('0x28'),_0x1598ee,JSON[_0xdd6f('0x11')](_0x3ca304));_0xbe9ae4(_0x3ca304);})[_0xdd6f('0x16')](function(_0x3fe4a1){logger['error'](_0xdd6f('0x28'),_0x3fe4a1[_0xdd6f('0x14')],_0x1598ee);_0x3cd952(_0x34185d['error'](0x1f4,_0x3fe4a1[_0xdd6f('0x14')]));});});};exports[_0xdd6f('0x3f')]=function(_0x6e4497){var _0x4a0555=this;return new Promise(function(_0xb06183,_0x4a1a52){return db[_0xdd6f('0x17')][_0xdd6f('0x29')]({'raw':_0x6e4497[_0xdd6f('0x18')]?_0x6e4497['options'][_0xdd6f('0x19')]===undefined?!![]:![]:!![],'where':_0x6e4497[_0xdd6f('0x18')]?_0x6e4497[_0xdd6f('0x18')][_0xdd6f('0x2a')]||null:null,'attributes':[[_0xdd6f('0x2b'),'name'],[db[_0xdd6f('0x1c')]['fn']('COUNT',db[_0xdd6f('0x1c')][_0xdd6f('0x40')]('id')),_0xdd6f('0x41')],[db['sequelize']['fn'](_0xdd6f('0x1d'),db[_0xdd6f('0x1c')]['fn']('IF',db[_0xdd6f('0x1c')][_0xdd6f('0x1e')](_0xdd6f('0x2f')))),_0xdd6f('0x42')]],'group':[_0xdd6f('0x2b')]})[_0xdd6f('0x27')](function(_0x12212b){logger[_0xdd6f('0xc')](_0xdd6f('0x3f'),_0x6e4497);logger['debug'](_0xdd6f('0x3f'),_0x6e4497,JSON[_0xdd6f('0x11')](_0x12212b));_0xb06183(_0x12212b);})[_0xdd6f('0x16')](function(_0x7d3275){logger[_0xdd6f('0x12')](_0xdd6f('0x3f'),_0x7d3275[_0xdd6f('0x14')],_0x6e4497);_0x4a1a52(_0x4a0555['error'](0x1f4,_0x7d3275[_0xdd6f('0x14')]));});});}; \ No newline at end of file +var _0x4058=['predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','stringify','CmHopperHistory,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x55d754,_0x27237d){var _0x19eb25=function(_0xb88737){while(--_0xb88737){_0x55d754['push'](_0x55d754['shift']());}};_0x19eb25(++_0x27237d);}(_0x4058,0x129));var _0x8405=function(_0x1546eb,_0x14c8b1){_0x1546eb=_0x1546eb-0x0;var _0x2e605c=_0x4058[_0x1546eb];return _0x2e605c;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});}exports[_0x8405('0x16')]=function(_0x358633){var _0x30a506=this;return new Promise(function(_0x1e608f,_0x34c79c){return db[_0x8405('0x17')][_0x8405('0x18')](_0x358633[_0x8405('0x19')],{'raw':_0x358633[_0x8405('0x1a')]?_0x358633[_0x8405('0x1a')][_0x8405('0x1b')]===undefined?!![]:![]:!![]})[_0x8405('0xc')](function(_0x2483ab){logger[_0x8405('0xd')](_0x8405('0x16'),_0x358633);logger[_0x8405('0xf')](_0x8405('0x16'),_0x358633,JSON[_0x8405('0x10')](_0x2483ab));_0x1e608f(_0x2483ab);})[_0x8405('0x15')](function(_0x1e8d08){logger['error']('CreateCmHopperHistory',_0x1e8d08[_0x8405('0x13')],_0x358633);_0x34c79c(_0x30a506[_0x8405('0x12')](0x1f4,_0x1e8d08[_0x8405('0x13')]));});});};exports['AvgHandleTime']=function(_0x5e3849){var _0x5d51a9=this;return new Promise(function(_0x48c5ea,_0x480ad2){return db[_0x8405('0x17')][_0x8405('0x1c')]({'raw':_0x5e3849[_0x8405('0x1a')]?_0x5e3849[_0x8405('0x1a')][_0x8405('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e3849[_0x8405('0x1a')]?_0x5e3849[_0x8405('0x1a')][_0x8405('0x1d')]||null:null,'attributes':[[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')][_0x8405('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x8405('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x22')))),_0x8405('0x23')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x24')))),_0x8405('0x25')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x8405('0x26')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x27'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x8405('0x1e')]['fn'](_0x8405('0x27'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')]['literal'](_0x8405('0x29')))),_0x8405('0x2a')]]})[_0x8405('0xc')](function(_0xe8de32){logger[_0x8405('0xd')](_0x8405('0x2b'),_0x5e3849);logger[_0x8405('0xf')](_0x8405('0x2b'),_0x5e3849,JSON[_0x8405('0x10')](_0xe8de32));_0x48c5ea(_0xe8de32);})[_0x8405('0x15')](function(_0x2ddb8d){logger[_0x8405('0x12')]('AvgHandleTime',_0x2ddb8d[_0x8405('0x13')],_0x5e3849);_0x480ad2(_0x5d51a9['error'](0x1f4,_0x2ddb8d['message']));});});};exports[_0x8405('0x2c')]=function(_0x42587c){var _0x5406e3=this;return new Promise(function(_0x17ed2c,_0x4349d2){return db[_0x8405('0x17')][_0x8405('0x1c')]({'raw':_0x42587c[_0x8405('0x1a')]?_0x42587c['options'][_0x8405('0x1b')]===undefined?!![]:![]:!![],'where':_0x42587c[_0x8405('0x1a')]?_0x42587c[_0x8405('0x1a')][_0x8405('0x1d')]||null:null,'attributes':[[_0x8405('0x2d'),'name'],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x2f')))),_0x8405('0x30')],[db['sequelize']['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x8405('0x31')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x32')))),_0x8405('0x33')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8405('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0x8405('0x34')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8405('0x35')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x36')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x37')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x38')))),_0x8405('0x39')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')]['literal'](_0x8405('0x3a')))),_0x8405('0x3b')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x3c')))),'outboundRejectCallsDay'],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x8405('0x3d')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x3e')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x8405('0x1f'),db['sequelize']['fn']('IF',db[_0x8405('0x1e')][_0x8405('0x21')](_0x8405('0x3f')))),'outboundReCallsDay']],'group':['campaign']})[_0x8405('0xc')](function(_0x4d4e37){logger[_0x8405('0xd')](_0x8405('0x2c'),_0x42587c);logger[_0x8405('0xf')](_0x8405('0x2c'),_0x42587c,JSON[_0x8405('0x10')](_0x4d4e37));_0x17ed2c(_0x4d4e37);})[_0x8405('0x15')](function(_0x1f720c){logger[_0x8405('0x12')](_0x8405('0x2c'),_0x1f720c['message'],_0x42587c);_0x4349d2(_0x5406e3[_0x8405('0x12')](0x1f4,_0x1f720c[_0x8405('0x13')]));});});};exports[_0x8405('0x40')]=function(_0x20ee80){var _0x58dbfa=this;return new Promise(function(_0x4719ea,_0x4025c6){return db[_0x8405('0x17')][_0x8405('0x1c')]({'raw':_0x20ee80[_0x8405('0x1a')]?_0x20ee80[_0x8405('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x20ee80[_0x8405('0x1a')]?_0x20ee80[_0x8405('0x1a')][_0x8405('0x1d')]||null:null,'attributes':[['campaign',_0x8405('0x41')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')][_0x8405('0x20')]('id')),_0x8405('0x42')],[db[_0x8405('0x1e')]['fn'](_0x8405('0x1f'),db[_0x8405('0x1e')]['fn']('IF',db[_0x8405('0x1e')]['literal'](_0x8405('0x22')))),'ivrAnswerCallsDay']],'group':[_0x8405('0x2d')]})['then'](function(_0x259383){logger[_0x8405('0xd')](_0x8405('0x40'),_0x20ee80);logger[_0x8405('0xf')](_0x8405('0x40'),_0x20ee80,JSON['stringify'](_0x259383));_0x4719ea(_0x259383);})[_0x8405('0x15')](function(_0x48f7a7){logger['error'](_0x8405('0x40'),_0x48f7a7['message'],_0x20ee80);_0x4025c6(_0x58dbfa[_0x8405('0x12')](0x1f4,_0x48f7a7[_0x8405('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c6e59be..74d1b74 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 _0x4809=['../../config/environment','./cmHopperHistory.controller','get','index','isAuthenticated','describe','show','post','put','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4809,0x1ce));var _0x9480=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x4809[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x9480('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9480('0x1'));var express=require(_0x9480('0x2'));var router=express[_0x9480('0x3')]();var fs_extra=require(_0x9480('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9480('0x5'));var config=require(_0x9480('0x6'));var controller=require(_0x9480('0x7'));router[_0x9480('0x8')]('/',auth['isAuthenticated'](),controller[_0x9480('0x9')]);router[_0x9480('0x8')]('/describe',auth[_0x9480('0xa')](),controller[_0x9480('0xb')]);router[_0x9480('0x8')]('/:id',auth[_0x9480('0xa')](),controller[_0x9480('0xc')]);router[_0x9480('0xd')]('/',auth[_0x9480('0xa')](),controller['create']);router[_0x9480('0xe')](_0x9480('0xf'),auth[_0x9480('0xa')](),controller[_0x9480('0x10')]);module[_0x9480('0x11')]=router; \ No newline at end of file +var _0x0d1e=['describe','get','/:id','create','put','update','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x36d5b7,_0x2378a5){var _0x14922b=function(_0x2788b4){while(--_0x2788b4){_0x36d5b7['push'](_0x36d5b7['shift']());}};_0x14922b(++_0x2378a5);}(_0x0d1e,0x69));var _0xe0d1=function(_0x5abc1e,_0x8715e7){_0x5abc1e=_0x5abc1e-0x0;var _0x3423d1=_0x0d1e[_0x5abc1e];return _0x3423d1;};'use strict';var multer=require('multer');var util=require(_0xe0d1('0x0'));var path=require('path');var timeout=require(_0xe0d1('0x1'));var express=require('express');var router=express[_0xe0d1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe0d1('0x3'));var config=require(_0xe0d1('0x4'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xe0d1('0x5')](),controller[_0xe0d1('0x6')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe0d1('0x7')]);router[_0xe0d1('0x8')](_0xe0d1('0x9'),auth[_0xe0d1('0x5')](),controller['show']);router['post']('/',auth[_0xe0d1('0x5')](),controller[_0xe0d1('0xa')]);router[_0xe0d1('0xb')](_0xe0d1('0x9'),auth['isAuthenticated'](),controller[_0xe0d1('0xc')]);module[_0xe0d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ef34df9..f454619 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 _0xe1dc=['STRING','name','sequelize','exports'];(function(_0x135736,_0x4c31c9){var _0x5b9dc2=function(_0xfae101){while(--_0xfae101){_0x135736['push'](_0x135736['shift']());}};_0x5b9dc2(++_0x4c31c9);}(_0xe1dc,0x8a));var _0xce1d=function(_0x3ef9f2,_0xefed96){_0x3ef9f2=_0x3ef9f2-0x0;var _0x51dffd=_0xe1dc[_0x3ef9f2];return _0x51dffd;};'use strict';var Sequelize=require(_0xce1d('0x0'));module[_0xce1d('0x1')]={'name':{'type':Sequelize[_0xce1d('0x2')],'unique':_0xce1d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xce1d('0x2')]},'dialPrefix':{'type':Sequelize[_0xce1d('0x2')]}}; \ No newline at end of file +var _0xe599=['name','sequelize','exports','STRING'];(function(_0x5a2291,_0x3ddda7){var _0x10e3f5=function(_0xc510cc){while(--_0xc510cc){_0x5a2291['push'](_0x5a2291['shift']());}};_0x10e3f5(++_0x3ddda7);}(_0xe599,0x1e5));var _0x9e59=function(_0x5ee7e9,_0x42b462){_0x5ee7e9=_0x5ee7e9-0x0;var _0x4dfa5c=_0xe599[_0x5ee7e9];return _0x4dfa5c;};'use strict';var Sequelize=require(_0x9e59('0x0'));module[_0x9e59('0x1')]={'name':{'type':Sequelize[_0x9e59('0x2')],'unique':_0x9e59('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9e59('0x2')]},'dialPrefix':{'type':Sequelize[_0x9e59('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6805365..0f710ec 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 _0xe9e1=['message','json','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','hasOwnProperty','getContacts','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','findOne','options','removeDispositions','ids','addContacts','CmContact','describe','tags','isArray','join','each','omit','push'];(function(_0xba50fb,_0x1db734){var _0x32fb53=function(_0x636057){while(--_0x636057){_0xba50fb['push'](_0xba50fb['shift']());}};_0x32fb53(++_0x1db734);}(_0xe9e1,0x1de));var _0x1e9e=function(_0x3979e9,_0x656c12){_0x3979e9=_0x3979e9-0x0;var _0x5c68d5=_0xe9e1[_0x3979e9];return _0x5c68d5;};'use strict';var emlformat=require(_0x1e9e('0x0'));var rimraf=require(_0x1e9e('0x1'));var zipdir=require(_0x1e9e('0x2'));var jsonpatch=require(_0x1e9e('0x3'));var rp=require(_0x1e9e('0x4'));var moment=require(_0x1e9e('0x5'));var BPromise=require(_0x1e9e('0x6'));var Mustache=require('mustache');var util=require(_0x1e9e('0x7'));var path=require(_0x1e9e('0x8'));var sox=require(_0x1e9e('0x9'));var csv=require(_0x1e9e('0xa'));var ejs=require(_0x1e9e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e9e('0xc'));var squel=require(_0x1e9e('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e9e('0xe'));var deskjs=require(_0x1e9e('0xf'));var toCsv=require(_0x1e9e('0xa'));var querystring=require(_0x1e9e('0x10'));var Papa=require(_0x1e9e('0x11'));var Redis=require('ioredis');var authService=require(_0x1e9e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e9e('0x13'));var logger=require(_0x1e9e('0x14'))(_0x1e9e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e9e('0x16'));var db=require(_0x1e9e('0x17'))['db'];config[_0x1e9e('0x18')]=_['defaults'](config[_0x1e9e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e9e('0x19'))(new Redis(config[_0x1e9e('0x18')]));require('./cmList.socket')[_0x1e9e('0x1a')](socket);function respondWithStatusCode(_0x521bc6,_0x26baef){_0x26baef=_0x26baef||0xcc;return function(_0x4b7514){if(_0x4b7514){return _0x521bc6[_0x1e9e('0x1b')](_0x26baef);}return _0x521bc6[_0x1e9e('0x1c')](_0x26baef)[_0x1e9e('0x1d')]();};}function respondWithResult(_0x283fca,_0x20c2fb){_0x20c2fb=_0x20c2fb||0xc8;return function(_0x2c7fda){if(_0x2c7fda){return _0x283fca[_0x1e9e('0x1c')](_0x20c2fb)['json'](_0x2c7fda);}};}function respondWithFilteredResult(_0x2c15e6,_0x5adeb5){return function(_0x5e2bb0){if(_0x5e2bb0){var _0x357bd3=typeof _0x5adeb5[_0x1e9e('0x1e')]==='undefined'&&typeof _0x5adeb5['limit']===_0x1e9e('0x1f');var _0x1c17f8=_0x5e2bb0[_0x1e9e('0x20')];var _0x5cec66=_0x357bd3?0x0:_0x5adeb5[_0x1e9e('0x1e')];var _0x1aea30=_0x357bd3?_0x5e2bb0[_0x1e9e('0x20')]:_0x5adeb5['offset']+_0x5adeb5['limit'];var _0x58fb04;if(_0x1aea30>=_0x1c17f8){_0x1aea30=_0x1c17f8;_0x58fb04=0xc8;}else{_0x58fb04=0xce;}_0x2c15e6[_0x1e9e('0x1c')](_0x58fb04);return _0x2c15e6['set'](_0x1e9e('0x21'),_0x5cec66+'-'+_0x1aea30+'/'+_0x1c17f8)['json'](_0x5e2bb0);}return null;};}function patchUpdates(_0x418bb5){return function(_0x14e59c){try{jsonpatch[_0x1e9e('0x22')](_0x14e59c,_0x418bb5,!![]);}catch(_0x2fb7f6){return BPromise['reject'](_0x2fb7f6);}return _0x14e59c[_0x1e9e('0x23')]();};}function saveUpdates(_0x222197,_0x4f8f78){return function(_0x3b5468){if(_0x3b5468){return _0x3b5468[_0x1e9e('0x24')](_0x222197)[_0x1e9e('0x25')](function(_0x3313f4){return _0x3313f4;});}return null;};}function removeEntity(_0x35af32,_0x339b22){return function(_0x14d5bd){if(_0x14d5bd){return _0x14d5bd['destroy']()[_0x1e9e('0x25')](function(){var _0x15155e=_0x14d5bd[_0x1e9e('0x26')]({'plain':!![]});var _0x2679ec=_0x1e9e('0x27');return db[_0x1e9e('0x28')][_0x1e9e('0x29')]({'where':{'type':_0x2679ec,'resourceId':_0x15155e['id']}})[_0x1e9e('0x25')](function(){return _0x14d5bd;});})[_0x1e9e('0x25')](function(){_0x35af32[_0x1e9e('0x1c')](0xcc)[_0x1e9e('0x1d')]();});}};}function handleEntityNotFound(_0xc560af,_0x4c308b){return function(_0x107ddb){if(!_0x107ddb){_0xc560af[_0x1e9e('0x1b')](0x194);}return _0x107ddb;};}function handleError(_0xa11136,_0x43ca23){_0x43ca23=_0x43ca23||0x1f4;return function(_0x4e9774){logger[_0x1e9e('0x2a')](_0x4e9774[_0x1e9e('0x2b')]);if(_0x4e9774[_0x1e9e('0x2c')]){delete _0x4e9774[_0x1e9e('0x2c')];}_0xa11136['status'](_0x43ca23)[_0x1e9e('0x2d')](_0x4e9774);};}exports[_0x1e9e('0x2e')]=function(_0x3ebed2,_0x5bef85){var _0x36c924={},_0x15d97c={},_0x525a87={'count':0x0,'rows':[]};var _0x571bff=_[_0x1e9e('0x2f')](db[_0x1e9e('0x30')][_0x1e9e('0x31')],function(_0xfeba3c){return{'name':_0xfeba3c['fieldName'],'type':_0xfeba3c[_0x1e9e('0x32')][_0x1e9e('0x33')]};});_0x15d97c[_0x1e9e('0x34')]=_[_0x1e9e('0x2f')](_0x571bff,_0x1e9e('0x2c'));_0x15d97c[_0x1e9e('0x35')]=_[_0x1e9e('0x36')](_0x3ebed2[_0x1e9e('0x35')]);_0x15d97c[_0x1e9e('0x37')]=_[_0x1e9e('0x38')](_0x15d97c[_0x1e9e('0x34')],_0x15d97c[_0x1e9e('0x35')]);_0x36c924[_0x1e9e('0x39')]=_[_0x1e9e('0x38')](_0x15d97c[_0x1e9e('0x34')],qs['fields'](_0x3ebed2[_0x1e9e('0x35')][_0x1e9e('0x3a')]));_0x36c924[_0x1e9e('0x39')]=_0x36c924[_0x1e9e('0x39')][_0x1e9e('0x3b')]?_0x36c924[_0x1e9e('0x39')]:_0x15d97c['model'];if(!_0x3ebed2[_0x1e9e('0x35')]['hasOwnProperty'](_0x1e9e('0x3c'))){_0x36c924[_0x1e9e('0x3d')]=qs[_0x1e9e('0x3d')](_0x3ebed2['query'][_0x1e9e('0x3d')]);_0x36c924[_0x1e9e('0x1e')]=qs[_0x1e9e('0x1e')](_0x3ebed2['query']['offset']);}_0x36c924[_0x1e9e('0x3e')]=qs[_0x1e9e('0x3f')](_0x3ebed2[_0x1e9e('0x35')][_0x1e9e('0x3f')]);_0x36c924['where']=qs[_0x1e9e('0x37')](_[_0x1e9e('0x40')](_0x3ebed2[_0x1e9e('0x35')],_0x15d97c[_0x1e9e('0x37')]),_0x571bff);if(_0x3ebed2['query'][_0x1e9e('0x41')]){_0x36c924[_0x1e9e('0x42')]=_[_0x1e9e('0x43')](_0x36c924[_0x1e9e('0x42')],{'$or':_[_0x1e9e('0x2f')](_0x571bff,function(_0x5a9787){if(_0x5a9787[_0x1e9e('0x32')]!=='VIRTUAL'){var _0x450d14={};_0x450d14[_0x5a9787[_0x1e9e('0x2c')]]={'$like':'%'+_0x3ebed2[_0x1e9e('0x35')][_0x1e9e('0x41')]+'%'};return _0x450d14;}})});}_0x36c924=_[_0x1e9e('0x43')]({},_0x36c924,_0x3ebed2['options']);var _0x3d11b6={'where':_0x36c924[_0x1e9e('0x42')]};return db[_0x1e9e('0x30')]['count'](_0x3d11b6)[_0x1e9e('0x25')](function(_0x2442b){_0x525a87[_0x1e9e('0x20')]=_0x2442b;if(_0x3ebed2[_0x1e9e('0x35')][_0x1e9e('0x44')]){_0x36c924['include']=[{'all':!![]}];}return db[_0x1e9e('0x30')][_0x1e9e('0x45')](_0x36c924);})[_0x1e9e('0x25')](function(_0x427913){_0x525a87[_0x1e9e('0x46')]=_0x427913;return _0x525a87;})['then'](respondWithFilteredResult(_0x5bef85,_0x36c924))['catch'](handleError(_0x5bef85,null));};exports[_0x1e9e('0x47')]=function(_0x3776f4,_0x32e82e){var _0xc81e3c={'raw':![],'where':{'id':_0x3776f4[_0x1e9e('0x48')]['id']}},_0x21ba92={};_0x21ba92[_0x1e9e('0x34')]=_[_0x1e9e('0x36')](db['CmList'][_0x1e9e('0x31')]);_0x21ba92['query']=_['keys'](_0x3776f4[_0x1e9e('0x35')]);_0x21ba92[_0x1e9e('0x37')]=_[_0x1e9e('0x38')](_0x21ba92[_0x1e9e('0x34')],_0x21ba92[_0x1e9e('0x35')]);_0xc81e3c[_0x1e9e('0x39')]=_['intersection'](_0x21ba92['model'],qs[_0x1e9e('0x3a')](_0x3776f4[_0x1e9e('0x35')][_0x1e9e('0x3a')]));_0xc81e3c[_0x1e9e('0x39')]=_0xc81e3c[_0x1e9e('0x39')][_0x1e9e('0x3b')]?_0xc81e3c[_0x1e9e('0x39')]:_0x21ba92[_0x1e9e('0x34')];if(_0x3776f4[_0x1e9e('0x35')]['includeAll']){_0xc81e3c[_0x1e9e('0x49')]=[{'all':!![]}];}_0xc81e3c=_[_0x1e9e('0x43')]({},_0xc81e3c,_0x3776f4['options']);return db[_0x1e9e('0x30')][_0x1e9e('0x4a')](_0xc81e3c)['then'](handleEntityNotFound(_0x32e82e,null))[_0x1e9e('0x25')](respondWithResult(_0x32e82e,null))[_0x1e9e('0x4b')](handleError(_0x32e82e,null));};exports[_0x1e9e('0x4c')]=function(_0x1dd877,_0x4e35a5){return db[_0x1e9e('0x30')][_0x1e9e('0x4c')](_0x1dd877[_0x1e9e('0x4d')],{})['then'](function(_0x18be95){var _0x45e048=_0x1dd877[_0x1e9e('0x4e')]['get']({'plain':!![]});if(!_0x45e048)throw new Error(_0x1e9e('0x4f'));if(_0x45e048[_0x1e9e('0x50')]===_0x1e9e('0x4e')){var _0x277d15=_0x18be95['get']({'plain':!![]});var _0x1c5ab4=_0x1e9e('0x27');return db[_0x1e9e('0x51')][_0x1e9e('0x4a')]({'where':{'name':_0x1c5ab4,'userProfileId':_0x45e048[_0x1e9e('0x52')]},'raw':!![]})[_0x1e9e('0x25')](function(_0x3ae1f7){if(_0x3ae1f7&&_0x3ae1f7[_0x1e9e('0x53')]===0x0){return db[_0x1e9e('0x28')][_0x1e9e('0x4c')]({'name':_0x277d15[_0x1e9e('0x2c')],'resourceId':_0x277d15['id'],'type':_0x3ae1f7[_0x1e9e('0x2c')],'sectionId':_0x3ae1f7['id']},{})[_0x1e9e('0x25')](function(){return _0x18be95;});}else{return _0x18be95;}})['catch'](function(_0x63f384){logger['error'](_0x1e9e('0x54'),_0x63f384);throw _0x63f384;});}return _0x18be95;})[_0x1e9e('0x25')](respondWithResult(_0x4e35a5,0xc9))[_0x1e9e('0x4b')](handleError(_0x4e35a5,null));};exports[_0x1e9e('0x24')]=function(_0x8cceff,_0x537ff1){if(_0x8cceff[_0x1e9e('0x4d')]['id']){delete _0x8cceff['body']['id'];}return db[_0x1e9e('0x30')][_0x1e9e('0x4a')]({'where':{'id':_0x8cceff[_0x1e9e('0x48')]['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x537ff1,null))[_0x1e9e('0x25')](saveUpdates(_0x8cceff[_0x1e9e('0x4d')],null))[_0x1e9e('0x25')](respondWithResult(_0x537ff1,null))[_0x1e9e('0x4b')](handleError(_0x537ff1,null));};exports[_0x1e9e('0x29')]=function(_0xae3660,_0x44e42e){return db[_0x1e9e('0x30')][_0x1e9e('0x4a')]({'where':{'id':_0xae3660['params']['id']}})['then'](handleEntityNotFound(_0x44e42e,null))['then'](removeEntity(_0x44e42e,null))['catch'](handleError(_0x44e42e,null));};exports['describe']=function(_0x427c0f,_0x4f53cb){return db[_0x1e9e('0x30')]['describe']()['then'](respondWithResult(_0x4f53cb,null))[_0x1e9e('0x4b')](handleError(_0x4f53cb,null));};exports[_0x1e9e('0x55')]=function(_0x2632cf,_0x4f08d2,_0x3a08c0){if(_0x2632cf['body']['id']){delete _0x2632cf[_0x1e9e('0x4d')]['id'];}return db['CmList'][_0x1e9e('0x4a')]({'where':{'id':_0x2632cf['params']['id']}})['then'](handleEntityNotFound(_0x4f08d2,null))[_0x1e9e('0x25')](function(_0x817c2f){if(_0x817c2f){_0x2632cf['body'][_0x1e9e('0x56')]=_0x817c2f['id'];return db[_0x1e9e('0x57')][_0x1e9e('0x4c')](_0x2632cf[_0x1e9e('0x4d')]);}})[_0x1e9e('0x25')](respondWithResult(_0x4f08d2,null))[_0x1e9e('0x4b')](handleError(_0x4f08d2,null));};exports[_0x1e9e('0x58')]=function(_0x56cf04,_0x44a61b,_0x282f05){var _0xabe5f4={'raw':![],'where':{}};var _0x286c5f={};var _0x38d15f={'count':0x0,'rows':[]};return db[_0x1e9e('0x30')][_0x1e9e('0x59')]({'where':{'id':_0x56cf04[_0x1e9e('0x48')]['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x44a61b,null))[_0x1e9e('0x25')](function(_0x2233f0){if(_0x2233f0){_0x286c5f[_0x1e9e('0x34')]=_[_0x1e9e('0x36')](db[_0x1e9e('0x57')]['rawAttributes']);_0x286c5f[_0x1e9e('0x35')]=_[_0x1e9e('0x36')](_0x56cf04[_0x1e9e('0x35')]);_0x286c5f[_0x1e9e('0x37')]=_[_0x1e9e('0x38')](_0x286c5f[_0x1e9e('0x34')],_0x286c5f[_0x1e9e('0x35')]);_0xabe5f4[_0x1e9e('0x39')]=_['intersection'](_0x286c5f['model'],qs[_0x1e9e('0x3a')](_0x56cf04['query'][_0x1e9e('0x3a')]));_0xabe5f4[_0x1e9e('0x39')]=_0xabe5f4['attributes']['length']?_0xabe5f4['attributes']:_0x286c5f[_0x1e9e('0x34')];if(!_0x56cf04[_0x1e9e('0x35')]['hasOwnProperty'](_0x1e9e('0x3c'))){_0xabe5f4[_0x1e9e('0x3d')]=qs[_0x1e9e('0x3d')](_0x56cf04[_0x1e9e('0x35')][_0x1e9e('0x3d')]);_0xabe5f4[_0x1e9e('0x1e')]=qs[_0x1e9e('0x1e')](_0x56cf04['query']['offset']);}_0xabe5f4['order']=qs['sort'](_0x56cf04[_0x1e9e('0x35')][_0x1e9e('0x3f')]);_0xabe5f4['where']=qs['filters'](_[_0x1e9e('0x40')](_0x56cf04[_0x1e9e('0x35')],_0x286c5f[_0x1e9e('0x37')]));_0xabe5f4[_0x1e9e('0x42')][_0x1e9e('0x56')]=_0x2233f0['id'];if(_0x56cf04['query'][_0x1e9e('0x41')]){_0xabe5f4[_0x1e9e('0x42')]=_['merge'](_0xabe5f4['where'],{'$or':_['map'](_0xabe5f4[_0x1e9e('0x39')],function(_0x5e084b){var _0x3e6964={};_0x3e6964[_0x5e084b]={'$like':'%'+_0x56cf04['query'][_0x1e9e('0x41')]+'%'};return _0x3e6964;})});}_0xabe5f4=_[_0x1e9e('0x43')]({},_0xabe5f4,_0x56cf04[_0x1e9e('0x5a')]);return db[_0x1e9e('0x57')]['count']({'where':_0xabe5f4['where']})[_0x1e9e('0x25')](function(_0x47536d){_0x38d15f['count']=_0x47536d;if(_0x56cf04['query'][_0x1e9e('0x44')]){_0xabe5f4['include']=[{'all':!![]}];}return db[_0x1e9e('0x57')][_0x1e9e('0x45')](_0xabe5f4);})[_0x1e9e('0x25')](function(_0x13ea4d){_0x38d15f[_0x1e9e('0x46')]=_0x13ea4d;return _0x38d15f;});}})[_0x1e9e('0x25')](respondWithFilteredResult(_0x44a61b,_0xabe5f4))[_0x1e9e('0x4b')](handleError(_0x44a61b,null));};exports[_0x1e9e('0x5b')]=function(_0x1c38be,_0x4d56be,_0x31ae56){return db['CmList'][_0x1e9e('0x4a')]({'where':{'id':_0x1c38be[_0x1e9e('0x48')]['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x4d56be,null))[_0x1e9e('0x25')](function(_0x2a2ed1){if(_0x2a2ed1){return _0x2a2ed1['removeDispositions'](_0x1c38be[_0x1e9e('0x35')][_0x1e9e('0x5c')]);}})[_0x1e9e('0x25')](respondWithStatusCode(_0x4d56be,null))[_0x1e9e('0x4b')](handleError(_0x4d56be,null));};exports[_0x1e9e('0x5d')]=function(_0x27902e,_0x5cfc59,_0x3388df){return db[_0x1e9e('0x30')][_0x1e9e('0x4a')]({'where':{'id':_0x27902e['params']['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x5cfc59,null))[_0x1e9e('0x25')](function(_0x2dd284){if(_0x2dd284){var _0x44df46=[];var _0x54b564={'success':[],'errors':[]};return db[_0x1e9e('0x5e')][_0x1e9e('0x5f')]()[_0x1e9e('0x25')](function(_0x59c90b){if(_0x27902e[_0x1e9e('0x4d')][_0x1e9e('0x60')]&&_[_0x1e9e('0x61')](_0x27902e[_0x1e9e('0x4d')]['tags'])){if(_0x27902e[_0x1e9e('0x4d')][_0x1e9e('0x60')][_0x1e9e('0x3b')]){_0x27902e[_0x1e9e('0x4d')][_0x1e9e('0x60')]=_0x27902e['body'][_0x1e9e('0x60')][_0x1e9e('0x62')](';')+';';}else{_0x27902e[_0x1e9e('0x4d')]['tags']=null;}}else{_0x27902e[_0x1e9e('0x4d')][_0x1e9e('0x60')]=null;}if(_0x27902e[_0x1e9e('0x4d')]&&_['isArray'](_0x27902e['body'])){for(var _0x4c4e25=0x0;_0x4c4e25<_0x27902e['body']['length'];_0x4c4e25+=0x1){_0x27902e[_0x1e9e('0x4d')][_0x4c4e25][_0x1e9e('0x56')]=_0x27902e[_0x1e9e('0x48')]['id'];_0x44df46['push'](_0x27902e['body'][_0x4c4e25]);}return BPromise[_0x1e9e('0x63')](_0x44df46,function(_0x2f020f){return db['CmContact'][_0x1e9e('0x4c')](_[_0x1e9e('0x64')](_0x2f020f,['ids','id'])||{},{'fields':_[_0x1e9e('0x36')](_0x59c90b),'raw':!![]})[_0x1e9e('0x25')](function(_0x2b13ab){_0x54b564['success'][_0x1e9e('0x65')](_0x2b13ab['dataValues']);})['catch'](function(_0x79a4c6){_0x54b564['errors'][_0x1e9e('0x65')]({'data':_0x2f020f,'error':_0x79a4c6[_0x1e9e('0x66')]});});})[_0x1e9e('0x25')](function(_0xd71706){return _0x54b564;})[_0x1e9e('0x4b')](function(_0x2013d0){return _0x2013d0;});}else{_0x5cfc59[_0x1e9e('0x1c')](0x190)[_0x1e9e('0x67')]({'message':_0x1e9e('0x68')});}});}})[_0x1e9e('0x25')](respondWithResult(_0x5cfc59,null))['catch'](handleError(_0x5cfc59,null));};exports['getContacts']=function(_0x5dceba,_0x3c0996,_0x52315c){var _0x2ac719;return db['CmList'][_0x1e9e('0x4a')]({'where':{'id':_0x5dceba[_0x1e9e('0x48')]['id']},'include':[{'model':db[_0x1e9e('0x69')],'as':_0x1e9e('0x6a')}]})[_0x1e9e('0x25')](handleEntityNotFound(_0x3c0996,null))[_0x1e9e('0x25')](function(_0x1a44e0){if(_0x1a44e0){_0x2ac719=_0x1a44e0;return db[_0x1e9e('0x5e')][_0x1e9e('0x31')];}})[_0x1e9e('0x25')](function(_0x318fe6){if(_0x318fe6){var _0x5268a3={};var _0x385ff5={};_0x385ff5[_0x1e9e('0x34')]=_[_0x1e9e('0x6b')](_[_0x1e9e('0x36')](_0x318fe6),_[_0x1e9e('0x2f')](_0x2ac719[_0x1e9e('0x6a')],function(_0x4fe373){return util[_0x1e9e('0x6c')](_0x1e9e('0x6d'),_0x4fe373['id']);}));_0x385ff5[_0x1e9e('0x35')]=_[_0x1e9e('0x36')](_0x5dceba[_0x1e9e('0x35')]);_0x385ff5[_0x1e9e('0x37')]=_[_0x1e9e('0x38')](_0x385ff5[_0x1e9e('0x34')],_0x385ff5[_0x1e9e('0x35')]);_0x5268a3[_0x1e9e('0x39')]=_[_0x1e9e('0x38')](_0x385ff5[_0x1e9e('0x34')],qs['fields'](_0x5dceba['query'][_0x1e9e('0x3a')]));_0x5268a3[_0x1e9e('0x39')]=_0x5268a3[_0x1e9e('0x39')][_0x1e9e('0x3b')]?_0x5268a3[_0x1e9e('0x39')]:_0x385ff5[_0x1e9e('0x34')];if(!_0x5dceba[_0x1e9e('0x35')]['hasOwnProperty'](_0x1e9e('0x3c'))){_0x5268a3[_0x1e9e('0x3d')]=qs[_0x1e9e('0x3d')](_0x5dceba[_0x1e9e('0x35')]['limit']);_0x5268a3[_0x1e9e('0x1e')]=qs[_0x1e9e('0x1e')](_0x5dceba[_0x1e9e('0x35')][_0x1e9e('0x1e')]);}_0x5268a3[_0x1e9e('0x3e')]=qs[_0x1e9e('0x3f')](_0x5dceba[_0x1e9e('0x35')][_0x1e9e('0x3f')]);_0x5268a3[_0x1e9e('0x42')]=qs[_0x1e9e('0x37')](_['pick'](_0x5dceba[_0x1e9e('0x35')],_0x385ff5[_0x1e9e('0x37')]));_0x5268a3['raw']=!![];if(_0x5dceba['query'][_0x1e9e('0x41')]){_0x5268a3['where']=_[_0x1e9e('0x43')](_0x5268a3[_0x1e9e('0x42')],{'$or':_['map'](_0x5268a3['attributes'],function(_0x935be9){var _0x49e1a3={};_0x49e1a3[_0x935be9]={'$like':'%'+_0x5dceba[_0x1e9e('0x35')]['filter']+'%'};return _0x49e1a3;})});}_0x5268a3=_[_0x1e9e('0x43')]({},_0x5268a3,_0x5dceba[_0x1e9e('0x5a')]);return _0x2ac719['getContacts'](_0x5268a3);}})[_0x1e9e('0x25')](respondWithResult(_0x3c0996,null))['catch'](handleError(_0x3c0996,null));};exports[_0x1e9e('0x6e')]=function(_0x306f4d,_0x356736,_0xf7bc00){var _0x2e8080;return db[_0x1e9e('0x30')][_0x1e9e('0x4a')]({'where':{'id':_0x306f4d[_0x1e9e('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x1e9e('0x6a')}]})[_0x1e9e('0x25')](handleEntityNotFound(_0x356736,null))['then'](function(_0x1adf0a){if(_0x1adf0a){_0x2e8080=_0x1adf0a;return db['CmContact'][_0x1e9e('0x31')];}})[_0x1e9e('0x25')](function(_0x2d561f){if(_0x2d561f){var _0x407cb0={};var _0x44b950={};_0x44b950[_0x1e9e('0x34')]=_[_0x1e9e('0x6b')](_[_0x1e9e('0x36')](_0x2d561f),_[_0x1e9e('0x2f')](_0x2e8080[_0x1e9e('0x6a')],function(_0x24d20f){return util[_0x1e9e('0x6c')](_0x1e9e('0x6d'),_0x24d20f['id']);}));_0x44b950['query']=_[_0x1e9e('0x36')](_0x306f4d[_0x1e9e('0x35')]);_0x44b950[_0x1e9e('0x37')]=_['intersection'](_0x44b950['model'],_0x44b950['query']);_0x407cb0[_0x1e9e('0x39')]=_['intersection'](_0x44b950[_0x1e9e('0x34')],qs[_0x1e9e('0x3a')](_0x306f4d[_0x1e9e('0x35')]['fields']));_0x407cb0[_0x1e9e('0x39')]=_0x407cb0[_0x1e9e('0x39')][_0x1e9e('0x3b')]?_0x407cb0[_0x1e9e('0x39')]:_0x44b950[_0x1e9e('0x34')];if(!_0x306f4d[_0x1e9e('0x35')][_0x1e9e('0x6f')](_0x1e9e('0x3c'))){_0x407cb0[_0x1e9e('0x3d')]=qs[_0x1e9e('0x3d')](_0x306f4d[_0x1e9e('0x35')][_0x1e9e('0x3d')]);_0x407cb0[_0x1e9e('0x1e')]=qs[_0x1e9e('0x1e')](_0x306f4d[_0x1e9e('0x35')]['offset']);}_0x407cb0[_0x1e9e('0x3e')]=qs[_0x1e9e('0x3f')](_0x306f4d[_0x1e9e('0x35')][_0x1e9e('0x3f')]);_0x407cb0['where']=qs[_0x1e9e('0x37')](_['pick'](_0x306f4d[_0x1e9e('0x35')],_0x44b950[_0x1e9e('0x37')]));_0x407cb0['raw']=!![];if(_0x306f4d[_0x1e9e('0x35')]['filter']){_0x407cb0[_0x1e9e('0x42')]=_[_0x1e9e('0x43')](_0x407cb0[_0x1e9e('0x42')],{'$or':_[_0x1e9e('0x2f')](_0x407cb0[_0x1e9e('0x39')],function(_0x24c9f2){var _0x50c187={};_0x50c187[_0x24c9f2]={'$like':'%'+_0x306f4d[_0x1e9e('0x35')][_0x1e9e('0x41')]+'%'};return _0x50c187;})});}_0x407cb0=_[_0x1e9e('0x43')]({},_0x407cb0,_0x306f4d[_0x1e9e('0x5a')]);return _0x2e8080[_0x1e9e('0x70')](_0x407cb0);}})[_0x1e9e('0x25')](function(_0x3ff19b){if(!_[_0x1e9e('0x71')](_0x3ff19b)){var _0x1b56af=toCsv(_0x3ff19b);var _0x5a556b=Date[_0x1e9e('0x72')]();fs['writeFileSync'](util[_0x1e9e('0x6c')]('/tmp/list_%d_%s.csv',_0x2e8080['id'],_0x5a556b),_0x1b56af);_0x356736[_0x1e9e('0x73')](_0x1e9e('0x74'),_0x1e9e('0x75')+util[_0x1e9e('0x6c')](_0x1e9e('0x76'),_0x2e8080['id'],_0x5a556b));_0x356736[_0x1e9e('0x73')](_0x1e9e('0x77'),_0x1e9e('0x78'));return _0x356736[_0x1e9e('0x79')](util[_0x1e9e('0x6c')](_0x1e9e('0x7a'),_0x2e8080['id'],_0x5a556b));}else{return _0x356736[_0x1e9e('0x1b')](0xcc);}})[_0x1e9e('0x4b')](handleError(_0x356736,null));};exports[_0x1e9e('0x7b')]=function(_0xefb85d,_0x5088b6,_0x39bfb5){var _0x215b6b;delete _0xefb85d[_0x1e9e('0x4d')]['id'];return db[_0x1e9e('0x30')][_0x1e9e('0x59')]({'where':{'id':_0xefb85d['params']['id']}})['then'](handleEntityNotFound(_0x5088b6,null))[_0x1e9e('0x25')](function(_0x54186b){if(_0x54186b){return db[_0x1e9e('0x7c')]['transaction'](function(_0xe3ade8){return db[_0x1e9e('0x69')][_0x1e9e('0x4c')](_0xefb85d[_0x1e9e('0x4d')],{'transaction':_0xe3ade8})[_0x1e9e('0x25')](function(_0x404c71){_0x215b6b=_0x404c71;return _0x54186b[_0x1e9e('0x7d')](_0x404c71,{'transaction':_0xe3ade8});})[_0x1e9e('0x25')](function(){var _0x1968b8={'type':db[_0x1e9e('0x7e')][_0x1e9e('0x7f')],'transaction':_0xe3ade8};switch(_0xefb85d['body'][_0x1e9e('0x32')]){case _0x1e9e('0x80'):_0x1968b8['type']=db[_0x1e9e('0x7e')][_0x1e9e('0x7f')];break;case _0x1e9e('0x81'):_0x1968b8['type']=db[_0x1e9e('0x7e')][_0x1e9e('0x82')];break;case'switch':_0x1968b8['type']=db[_0x1e9e('0x7e')][_0x1e9e('0x83')];_0x1968b8[_0x1e9e('0x84')]=![];break;default:}return db['sequelize'][_0x1e9e('0x85')]['addColumn'](_0x1e9e('0x86'),util[_0x1e9e('0x6c')](_0x1e9e('0x87'),_0x215b6b['id']),_0x1968b8);})[_0x1e9e('0x25')](function(){return _0x215b6b;});});}})[_0x1e9e('0x25')](respondWithResult(_0x5088b6,null))['catch'](handleError(_0x5088b6,null));};exports['getCustomFields']=function(_0x1efe32,_0x1c5b19,_0x5e9d33){var _0x1787bc={};var _0x29bf2b={};var _0x2dcd45;var _0xe3c2dc;return db[_0x1e9e('0x30')][_0x1e9e('0x59')]({'where':{'id':_0x1efe32['params']['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x1c5b19,null))[_0x1e9e('0x25')](function(_0x107b55){if(_0x107b55){_0x2dcd45=_0x107b55;_0x29bf2b[_0x1e9e('0x34')]=_['keys'](db[_0x1e9e('0x69')][_0x1e9e('0x31')]);_0x29bf2b['query']=_[_0x1e9e('0x36')](_0x1efe32[_0x1e9e('0x35')]);_0x29bf2b[_0x1e9e('0x37')]=_['intersection'](_0x29bf2b[_0x1e9e('0x34')],_0x29bf2b[_0x1e9e('0x35')]);_0x1787bc[_0x1e9e('0x39')]=_['intersection'](_0x29bf2b['model'],qs[_0x1e9e('0x3a')](_0x1efe32[_0x1e9e('0x35')]['fields']));_0x1787bc['attributes']=_0x1787bc[_0x1e9e('0x39')]['length']?_0x1787bc[_0x1e9e('0x39')]:_0x29bf2b[_0x1e9e('0x34')];_0x1787bc[_0x1e9e('0x3e')]=qs[_0x1e9e('0x3f')](_0x1efe32[_0x1e9e('0x35')]['sort']);_0x1787bc['where']=qs[_0x1e9e('0x37')](_[_0x1e9e('0x40')](_0x1efe32['query'],_0x29bf2b['filters']));_0x1787bc[_0x1e9e('0x42')]=_[_0x1e9e('0x43')](_0x1787bc[_0x1e9e('0x42')],{'$or':[{'ListId':_0x107b55['id']},{'ListId':null}]});if(_0x1efe32[_0x1e9e('0x35')]['filter']){_0x1787bc['where']=_['merge'](_0x1787bc['where'],{'$or':_[_0x1e9e('0x2f')](_0x1787bc[_0x1e9e('0x39')],function(_0x4f66f6){var _0x4066b1={};_0x4066b1[_0x4f66f6]={'$like':'%'+_0x1efe32['query'][_0x1e9e('0x41')]+'%'};return _0x4066b1;})});}_0x1787bc=_[_0x1e9e('0x43')]({},_0x1787bc,_0x1efe32['options']);return db['CmCustomField'][_0x1e9e('0x88')](_0x1787bc);}})[_0x1e9e('0x25')](respondWithResult(_0x1c5b19,null))[_0x1e9e('0x4b')](handleError(_0x1c5b19,null));};exports[_0x1e9e('0x89')]=function(_0x437e45,_0x204e85,_0x2ea2b8){return db['CmList'][_0x1e9e('0x4a')]({'where':{'id':_0x437e45[_0x1e9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x204e85,null))[_0x1e9e('0x25')](function(_0x147e40){if(_0x147e40){return _0x147e40[_0x1e9e('0x89')](_0x437e45[_0x1e9e('0x4d')][_0x1e9e('0x5c')],_[_0x1e9e('0x64')](_0x437e45[_0x1e9e('0x4d')],[_0x1e9e('0x5c'),'id'])||{})[_0x1e9e('0x8a')](function(_0x35d2c7){for(var _0x11dc94=0x0;_0x11dc94<_0x437e45[_0x1e9e('0x4d')][_0x1e9e('0x5c')][_0x1e9e('0x3b')];_0x11dc94+=0x1){socket['emit'](_0x1e9e('0x8b'),{'UserId':Number(_0x437e45[_0x1e9e('0x4d')][_0x1e9e('0x5c')][_0x11dc94]),'CmListId':Number(_0x437e45[_0x1e9e('0x48')]['id'])});}return _0x35d2c7;});}})['then'](respondWithResult(_0x204e85,null))['catch'](handleError(_0x204e85,null));};exports[_0x1e9e('0x8c')]=function(_0x22f987,_0x3adbf9,_0x58e9f4){return db['CmList'][_0x1e9e('0x4a')]({'where':{'id':_0x22f987[_0x1e9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3adbf9,null))['then'](function(_0x7d9b5e){if(_0x7d9b5e){return _0x7d9b5e[_0x1e9e('0x8c')](_0x22f987[_0x1e9e('0x35')][_0x1e9e('0x5c')])[_0x1e9e('0x25')](function(){if(_[_0x1e9e('0x61')](_0x22f987[_0x1e9e('0x35')][_0x1e9e('0x5c')])){for(var _0x8bc8ea=0x0;_0x8bc8ea<_0x22f987[_0x1e9e('0x35')]['ids'][_0x1e9e('0x3b')];_0x8bc8ea+=0x1){socket[_0x1e9e('0x8d')]('userCmList:remove',{'UserId':Number(_0x22f987['query'][_0x1e9e('0x5c')][_0x8bc8ea]),'CmListId':Number(_0x22f987[_0x1e9e('0x48')]['id'])});}}else{socket[_0x1e9e('0x8d')](_0x1e9e('0x8e'),{'UserId':Number(_0x22f987[_0x1e9e('0x35')]['ids']),'CmListId':Number(_0x22f987[_0x1e9e('0x48')]['id'])});}});}})[_0x1e9e('0x25')](respondWithStatusCode(_0x3adbf9,null))['catch'](handleError(_0x3adbf9,null));};exports['getAgents']=function(_0x1d7adc,_0x5babc3,_0x3216c9){var _0x110948={};var _0xb4a52e={};var _0x22d519;var _0x17f38b;return db[_0x1e9e('0x30')][_0x1e9e('0x59')]({'where':{'id':_0x1d7adc['params']['id']}})['then'](handleEntityNotFound(_0x5babc3,null))['then'](function(_0x536f03){if(_0x536f03){_0x22d519=_0x536f03;_0xb4a52e[_0x1e9e('0x34')]=_['keys'](db[_0x1e9e('0x8f')][_0x1e9e('0x31')]);_0xb4a52e[_0x1e9e('0x35')]=_[_0x1e9e('0x36')](_0x1d7adc[_0x1e9e('0x35')]);_0xb4a52e['filters']=_[_0x1e9e('0x38')](_0xb4a52e[_0x1e9e('0x34')],_0xb4a52e['query']);_0x110948[_0x1e9e('0x39')]=_[_0x1e9e('0x38')](_0xb4a52e[_0x1e9e('0x34')],qs[_0x1e9e('0x3a')](_0x1d7adc[_0x1e9e('0x35')][_0x1e9e('0x3a')]));_0x110948[_0x1e9e('0x39')]=_0x110948[_0x1e9e('0x39')]['length']?_0x110948['attributes']:_0xb4a52e[_0x1e9e('0x34')];_0x110948[_0x1e9e('0x3e')]=qs[_0x1e9e('0x3f')](_0x1d7adc[_0x1e9e('0x35')][_0x1e9e('0x3f')]);_0x110948['where']=qs['filters'](_[_0x1e9e('0x40')](_0x1d7adc[_0x1e9e('0x35')],_0xb4a52e[_0x1e9e('0x37')]));if(_0x1d7adc[_0x1e9e('0x35')]['filter']){_0x110948['where']=_[_0x1e9e('0x43')](_0x110948[_0x1e9e('0x42')],{'$or':_[_0x1e9e('0x2f')](_0x110948[_0x1e9e('0x39')],function(_0xc79576){var _0x7c91b8={};_0x7c91b8[_0xc79576]={'$like':'%'+_0x1d7adc[_0x1e9e('0x35')][_0x1e9e('0x41')]+'%'};return _0x7c91b8;})});}_0x110948=_[_0x1e9e('0x43')]({},_0x110948,_0x1d7adc[_0x1e9e('0x5a')]);return _0x22d519['getAgents'](_0x110948);}})[_0x1e9e('0x25')](function(_0x42772d){if(_0x42772d){_0x17f38b=_0x42772d['length'];if(!_0x1d7adc['query']['hasOwnProperty'](_0x1e9e('0x3c'))){_0x110948[_0x1e9e('0x3d')]=qs[_0x1e9e('0x3d')](_0x1d7adc[_0x1e9e('0x35')][_0x1e9e('0x3d')]);_0x110948['offset']=qs['offset'](_0x1d7adc[_0x1e9e('0x35')][_0x1e9e('0x1e')]);}return _0x22d519[_0x1e9e('0x90')](_0x110948);}})[_0x1e9e('0x25')](function(_0x293a89){if(_0x293a89){return _0x293a89?{'count':_0x17f38b,'rows':_0x293a89}:null;}})[_0x1e9e('0x25')](respondWithResult(_0x5babc3,null))[_0x1e9e('0x4b')](handleError(_0x5babc3,null));}; \ No newline at end of file +var _0x6ff2=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','findOne','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','omit','success','dataValues','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','get','Lists','end','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0x6ff2,0xe4));var _0x26ff=function(_0x3c2f2d,_0x54c717){_0x3c2f2d=_0x3c2f2d-0x0;var _0x176977=_0x6ff2[_0x3c2f2d];return _0x176977;};'use strict';var emlformat=require(_0x26ff('0x0'));var rimraf=require(_0x26ff('0x1'));var zipdir=require(_0x26ff('0x2'));var jsonpatch=require(_0x26ff('0x3'));var rp=require('request-promise');var moment=require(_0x26ff('0x4'));var BPromise=require(_0x26ff('0x5'));var Mustache=require(_0x26ff('0x6'));var util=require(_0x26ff('0x7'));var path=require(_0x26ff('0x8'));var sox=require(_0x26ff('0x9'));var csv=require(_0x26ff('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ff('0xb'));var squel=require(_0x26ff('0xc'));var crypto=require(_0x26ff('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x26ff('0xe'));var toCsv=require(_0x26ff('0xa'));var querystring=require('querystring');var Papa=require(_0x26ff('0xf'));var Redis=require(_0x26ff('0x10'));var authService=require(_0x26ff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26ff('0x12'));var logger=require(_0x26ff('0x13'))(_0x26ff('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x26ff('0x15'));var db=require(_0x26ff('0x16'))['db'];config[_0x26ff('0x17')]=_[_0x26ff('0x18')](config[_0x26ff('0x17')],{'host':_0x26ff('0x19'),'port':0x18eb});var socket=require(_0x26ff('0x1a'))(new Redis(config[_0x26ff('0x17')]));require(_0x26ff('0x1b'))[_0x26ff('0x1c')](socket);function respondWithStatusCode(_0x4e1c28,_0x959b54){_0x959b54=_0x959b54||0xcc;return function(_0x24c055){if(_0x24c055){return _0x4e1c28['sendStatus'](_0x959b54);}return _0x4e1c28['status'](_0x959b54)['end']();};}function respondWithResult(_0x8c8408,_0x4e268a){_0x4e268a=_0x4e268a||0xc8;return function(_0x5905bb){if(_0x5905bb){return _0x8c8408[_0x26ff('0x1d')](_0x4e268a)['json'](_0x5905bb);}};}function respondWithFilteredResult(_0x56a1b2,_0x350f12){return function(_0x40bacf){if(_0x40bacf){var _0xc052c2=typeof _0x350f12['offset']==='undefined'&&typeof _0x350f12[_0x26ff('0x1e')]===_0x26ff('0x1f');var _0x4b5074=_0x40bacf[_0x26ff('0x20')];var _0x3993fa=_0xc052c2?0x0:_0x350f12[_0x26ff('0x21')];var _0x1924f6=_0xc052c2?_0x40bacf[_0x26ff('0x20')]:_0x350f12[_0x26ff('0x21')]+_0x350f12[_0x26ff('0x1e')];var _0x1658e0;if(_0x1924f6>=_0x4b5074){_0x1924f6=_0x4b5074;_0x1658e0=0xc8;}else{_0x1658e0=0xce;}_0x56a1b2[_0x26ff('0x1d')](_0x1658e0);return _0x56a1b2[_0x26ff('0x22')](_0x26ff('0x23'),_0x3993fa+'-'+_0x1924f6+'/'+_0x4b5074)[_0x26ff('0x24')](_0x40bacf);}return null;};}function patchUpdates(_0x2e6cc1){return function(_0x59b8cb){try{jsonpatch['apply'](_0x59b8cb,_0x2e6cc1,!![]);}catch(_0x214fb5){return BPromise[_0x26ff('0x25')](_0x214fb5);}return _0x59b8cb[_0x26ff('0x26')]();};}function saveUpdates(_0x626fa0,_0x3453c3){return function(_0x1db065){if(_0x1db065){return _0x1db065['update'](_0x626fa0)[_0x26ff('0x27')](function(_0x3566a1){return _0x3566a1;});}return null;};}function removeEntity(_0x5f5074,_0x5ced8a){return function(_0xf95999){if(_0xf95999){return _0xf95999[_0x26ff('0x28')]()[_0x26ff('0x27')](function(){var _0x3bb19d=_0xf95999[_0x26ff('0x29')]({'plain':!![]});var _0x117e86=_0x26ff('0x2a');return db['UserProfileResource'][_0x26ff('0x28')]({'where':{'type':_0x117e86,'resourceId':_0x3bb19d['id']}})[_0x26ff('0x27')](function(){return _0xf95999;});})['then'](function(){_0x5f5074['status'](0xcc)[_0x26ff('0x2b')]();});}};}function handleEntityNotFound(_0x21cd32,_0x538865){return function(_0x45a992){if(!_0x45a992){_0x21cd32[_0x26ff('0x2c')](0x194);}return _0x45a992;};}function handleError(_0x19c2a4,_0x3c37af){_0x3c37af=_0x3c37af||0x1f4;return function(_0x2f960b){logger[_0x26ff('0x2d')](_0x2f960b[_0x26ff('0x2e')]);if(_0x2f960b[_0x26ff('0x2f')]){delete _0x2f960b[_0x26ff('0x2f')];}_0x19c2a4['status'](_0x3c37af)[_0x26ff('0x30')](_0x2f960b);};}exports[_0x26ff('0x31')]=function(_0x22c536,_0x52a0b1){var _0x1f7fe9={},_0x2a44e5={},_0x89646f={'count':0x0,'rows':[]};var _0x347cce=_[_0x26ff('0x32')](db[_0x26ff('0x33')][_0x26ff('0x34')],function(_0x287884){return{'name':_0x287884[_0x26ff('0x35')],'type':_0x287884[_0x26ff('0x36')][_0x26ff('0x37')]};});_0x2a44e5[_0x26ff('0x38')]=_['map'](_0x347cce,_0x26ff('0x2f'));_0x2a44e5[_0x26ff('0x39')]=_[_0x26ff('0x3a')](_0x22c536[_0x26ff('0x39')]);_0x2a44e5[_0x26ff('0x3b')]=_[_0x26ff('0x3c')](_0x2a44e5[_0x26ff('0x38')],_0x2a44e5[_0x26ff('0x39')]);_0x1f7fe9[_0x26ff('0x3d')]=_[_0x26ff('0x3c')](_0x2a44e5[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x22c536['query']['fields']));_0x1f7fe9['attributes']=_0x1f7fe9['attributes'][_0x26ff('0x3f')]?_0x1f7fe9[_0x26ff('0x3d')]:_0x2a44e5['model'];if(!_0x22c536[_0x26ff('0x39')]['hasOwnProperty'](_0x26ff('0x40'))){_0x1f7fe9['limit']=qs[_0x26ff('0x1e')](_0x22c536['query'][_0x26ff('0x1e')]);_0x1f7fe9[_0x26ff('0x21')]=qs[_0x26ff('0x21')](_0x22c536[_0x26ff('0x39')][_0x26ff('0x21')]);}_0x1f7fe9[_0x26ff('0x41')]=qs[_0x26ff('0x42')](_0x22c536['query'][_0x26ff('0x42')]);_0x1f7fe9['where']=qs[_0x26ff('0x3b')](_[_0x26ff('0x43')](_0x22c536['query'],_0x2a44e5[_0x26ff('0x3b')]),_0x347cce);if(_0x22c536['query'][_0x26ff('0x44')]){_0x1f7fe9[_0x26ff('0x45')]=_[_0x26ff('0x46')](_0x1f7fe9['where'],{'$or':_[_0x26ff('0x32')](_0x347cce,function(_0x55ee50){if(_0x55ee50[_0x26ff('0x36')]!==_0x26ff('0x47')){var _0x5e8ca9={};_0x5e8ca9[_0x55ee50[_0x26ff('0x2f')]]={'$like':'%'+_0x22c536[_0x26ff('0x39')][_0x26ff('0x44')]+'%'};return _0x5e8ca9;}})});}_0x1f7fe9=_[_0x26ff('0x46')]({},_0x1f7fe9,_0x22c536[_0x26ff('0x48')]);var _0xd76da6={'where':_0x1f7fe9[_0x26ff('0x45')]};return db[_0x26ff('0x33')][_0x26ff('0x20')](_0xd76da6)[_0x26ff('0x27')](function(_0x12b0a9){_0x89646f['count']=_0x12b0a9;if(_0x22c536[_0x26ff('0x39')][_0x26ff('0x49')]){_0x1f7fe9[_0x26ff('0x4a')]=[{'all':!![]}];}return db[_0x26ff('0x33')][_0x26ff('0x4b')](_0x1f7fe9);})['then'](function(_0x4ee5d3){_0x89646f['rows']=_0x4ee5d3;return _0x89646f;})[_0x26ff('0x27')](respondWithFilteredResult(_0x52a0b1,_0x1f7fe9))['catch'](handleError(_0x52a0b1,null));};exports[_0x26ff('0x4c')]=function(_0x5b526b,_0x4ebf2f){var _0x98be31={'raw':![],'where':{'id':_0x5b526b['params']['id']}},_0x456932={};_0x456932['model']=_[_0x26ff('0x3a')](db[_0x26ff('0x33')][_0x26ff('0x34')]);_0x456932[_0x26ff('0x39')]=_[_0x26ff('0x3a')](_0x5b526b[_0x26ff('0x39')]);_0x456932[_0x26ff('0x3b')]=_[_0x26ff('0x3c')](_0x456932[_0x26ff('0x38')],_0x456932['query']);_0x98be31['attributes']=_[_0x26ff('0x3c')](_0x456932[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x5b526b[_0x26ff('0x39')][_0x26ff('0x3e')]));_0x98be31[_0x26ff('0x3d')]=_0x98be31['attributes'][_0x26ff('0x3f')]?_0x98be31[_0x26ff('0x3d')]:_0x456932[_0x26ff('0x38')];if(_0x5b526b[_0x26ff('0x39')][_0x26ff('0x49')]){_0x98be31[_0x26ff('0x4a')]=[{'all':!![]}];}_0x98be31=_['merge']({},_0x98be31,_0x5b526b[_0x26ff('0x48')]);return db[_0x26ff('0x33')][_0x26ff('0x4d')](_0x98be31)[_0x26ff('0x27')](handleEntityNotFound(_0x4ebf2f,null))[_0x26ff('0x27')](respondWithResult(_0x4ebf2f,null))[_0x26ff('0x4e')](handleError(_0x4ebf2f,null));};exports['create']=function(_0x2f3719,_0x463edf){return db['CmList']['create'](_0x2f3719[_0x26ff('0x4f')],{})[_0x26ff('0x27')](function(_0x1ab9f4){var _0x455f22=_0x2f3719[_0x26ff('0x50')]['get']({'plain':!![]});if(!_0x455f22)throw new Error(_0x26ff('0x51'));if(_0x455f22['role']==='user'){var _0x3133d5=_0x1ab9f4['get']({'plain':!![]});var _0x4f2c10=_0x26ff('0x2a');return db[_0x26ff('0x52')][_0x26ff('0x4d')]({'where':{'name':_0x4f2c10,'userProfileId':_0x455f22[_0x26ff('0x53')]},'raw':!![]})[_0x26ff('0x27')](function(_0x35fa85){if(_0x35fa85&&_0x35fa85[_0x26ff('0x54')]===0x0){return db[_0x26ff('0x55')][_0x26ff('0x56')]({'name':_0x3133d5[_0x26ff('0x2f')],'resourceId':_0x3133d5['id'],'type':_0x35fa85[_0x26ff('0x2f')],'sectionId':_0x35fa85['id']},{})[_0x26ff('0x27')](function(){return _0x1ab9f4;});}else{return _0x1ab9f4;}})[_0x26ff('0x4e')](function(_0x595905){logger[_0x26ff('0x2d')](_0x26ff('0x57'),_0x595905);throw _0x595905;});}return _0x1ab9f4;})[_0x26ff('0x27')](respondWithResult(_0x463edf,0xc9))[_0x26ff('0x4e')](handleError(_0x463edf,null));};exports[_0x26ff('0x58')]=function(_0xfec919,_0x20bc57){if(_0xfec919[_0x26ff('0x4f')]['id']){delete _0xfec919[_0x26ff('0x4f')]['id'];}return db[_0x26ff('0x33')][_0x26ff('0x4d')]({'where':{'id':_0xfec919[_0x26ff('0x59')]['id']}})['then'](handleEntityNotFound(_0x20bc57,null))[_0x26ff('0x27')](saveUpdates(_0xfec919[_0x26ff('0x4f')],null))['then'](respondWithResult(_0x20bc57,null))[_0x26ff('0x4e')](handleError(_0x20bc57,null));};exports[_0x26ff('0x28')]=function(_0x19b7c7,_0x3fd0fe){return db['CmList'][_0x26ff('0x4d')]({'where':{'id':_0x19b7c7['params']['id']}})['then'](handleEntityNotFound(_0x3fd0fe,null))[_0x26ff('0x27')](removeEntity(_0x3fd0fe,null))[_0x26ff('0x4e')](handleError(_0x3fd0fe,null));};exports['describe']=function(_0x19ea9d,_0x5a449a){return db[_0x26ff('0x33')][_0x26ff('0x5a')]()[_0x26ff('0x27')](respondWithResult(_0x5a449a,null))[_0x26ff('0x4e')](handleError(_0x5a449a,null));};exports['addDisposition']=function(_0x870fe6,_0x20e355,_0x6d4e2){if(_0x870fe6[_0x26ff('0x4f')]['id']){delete _0x870fe6[_0x26ff('0x4f')]['id'];}return db[_0x26ff('0x33')]['find']({'where':{'id':_0x870fe6[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x20e355,null))['then'](function(_0x301e9c){if(_0x301e9c){_0x870fe6[_0x26ff('0x4f')][_0x26ff('0x5b')]=_0x301e9c['id'];return db[_0x26ff('0x5c')]['create'](_0x870fe6[_0x26ff('0x4f')]);}})[_0x26ff('0x27')](respondWithResult(_0x20e355,null))['catch'](handleError(_0x20e355,null));};exports['getDispositions']=function(_0x946413,_0x13ce9b,_0x10a850){var _0x5dee69={'raw':![],'where':{}};var _0x636bad={};var _0x14ad12={'count':0x0,'rows':[]};return db['CmList'][_0x26ff('0x5d')]({'where':{'id':_0x946413['params']['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x13ce9b,null))[_0x26ff('0x27')](function(_0x57e73d){if(_0x57e73d){_0x636bad[_0x26ff('0x38')]=_[_0x26ff('0x3a')](db[_0x26ff('0x5c')][_0x26ff('0x34')]);_0x636bad[_0x26ff('0x39')]=_[_0x26ff('0x3a')](_0x946413[_0x26ff('0x39')]);_0x636bad['filters']=_[_0x26ff('0x3c')](_0x636bad[_0x26ff('0x38')],_0x636bad[_0x26ff('0x39')]);_0x5dee69['attributes']=_[_0x26ff('0x3c')](_0x636bad[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x946413[_0x26ff('0x39')][_0x26ff('0x3e')]));_0x5dee69['attributes']=_0x5dee69[_0x26ff('0x3d')][_0x26ff('0x3f')]?_0x5dee69[_0x26ff('0x3d')]:_0x636bad[_0x26ff('0x38')];if(!_0x946413['query'][_0x26ff('0x5e')](_0x26ff('0x40'))){_0x5dee69[_0x26ff('0x1e')]=qs[_0x26ff('0x1e')](_0x946413[_0x26ff('0x39')][_0x26ff('0x1e')]);_0x5dee69[_0x26ff('0x21')]=qs[_0x26ff('0x21')](_0x946413[_0x26ff('0x39')][_0x26ff('0x21')]);}_0x5dee69['order']=qs[_0x26ff('0x42')](_0x946413[_0x26ff('0x39')][_0x26ff('0x42')]);_0x5dee69[_0x26ff('0x45')]=qs['filters'](_[_0x26ff('0x43')](_0x946413[_0x26ff('0x39')],_0x636bad[_0x26ff('0x3b')]));_0x5dee69[_0x26ff('0x45')][_0x26ff('0x5b')]=_0x57e73d['id'];if(_0x946413[_0x26ff('0x39')][_0x26ff('0x44')]){_0x5dee69[_0x26ff('0x45')]=_[_0x26ff('0x46')](_0x5dee69['where'],{'$or':_[_0x26ff('0x32')](_0x5dee69[_0x26ff('0x3d')],function(_0xd1c1ed){var _0x1cf656={};_0x1cf656[_0xd1c1ed]={'$like':'%'+_0x946413[_0x26ff('0x39')][_0x26ff('0x44')]+'%'};return _0x1cf656;})});}_0x5dee69=_[_0x26ff('0x46')]({},_0x5dee69,_0x946413[_0x26ff('0x48')]);return db[_0x26ff('0x5c')]['count']({'where':_0x5dee69[_0x26ff('0x45')]})[_0x26ff('0x27')](function(_0x56901b){_0x14ad12[_0x26ff('0x20')]=_0x56901b;if(_0x946413[_0x26ff('0x39')][_0x26ff('0x49')]){_0x5dee69[_0x26ff('0x4a')]=[{'all':!![]}];}return db[_0x26ff('0x5c')][_0x26ff('0x4b')](_0x5dee69);})[_0x26ff('0x27')](function(_0x2133f5){_0x14ad12[_0x26ff('0x5f')]=_0x2133f5;return _0x14ad12;});}})['then'](respondWithFilteredResult(_0x13ce9b,_0x5dee69))[_0x26ff('0x4e')](handleError(_0x13ce9b,null));};exports['removeDispositions']=function(_0x3e4967,_0x772842,_0x13a5c0){return db['CmList'][_0x26ff('0x4d')]({'where':{'id':_0x3e4967[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x772842,null))['then'](function(_0x345ad1){if(_0x345ad1){return _0x345ad1[_0x26ff('0x60')](_0x3e4967[_0x26ff('0x39')][_0x26ff('0x61')]);}})[_0x26ff('0x27')](respondWithStatusCode(_0x772842,null))[_0x26ff('0x4e')](handleError(_0x772842,null));};exports[_0x26ff('0x62')]=function(_0x5c1795,_0x5926ac,_0x56e941){return db[_0x26ff('0x33')][_0x26ff('0x4d')]({'where':{'id':_0x5c1795[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x5926ac,null))[_0x26ff('0x27')](function(_0x4366c1){if(_0x4366c1){var _0x98c1e9=[];var _0x5c2e87={'success':[],'errors':[]};return db[_0x26ff('0x63')][_0x26ff('0x5a')]()[_0x26ff('0x27')](function(_0x197e7b){if(_0x5c1795[_0x26ff('0x4f')]['tags']&&_[_0x26ff('0x64')](_0x5c1795['body'][_0x26ff('0x65')])){if(_0x5c1795['body'][_0x26ff('0x65')][_0x26ff('0x3f')]){_0x5c1795['body'][_0x26ff('0x65')]=_0x5c1795[_0x26ff('0x4f')][_0x26ff('0x65')]['join'](';')+';';}else{_0x5c1795[_0x26ff('0x4f')]['tags']=null;}}else{_0x5c1795[_0x26ff('0x4f')][_0x26ff('0x65')]=null;}if(_0x5c1795[_0x26ff('0x4f')]&&_['isArray'](_0x5c1795[_0x26ff('0x4f')])){for(var _0xc0a0b9=0x0;_0xc0a0b9<_0x5c1795[_0x26ff('0x4f')][_0x26ff('0x3f')];_0xc0a0b9+=0x1){_0x5c1795[_0x26ff('0x4f')][_0xc0a0b9][_0x26ff('0x5b')]=_0x5c1795[_0x26ff('0x59')]['id'];_0x98c1e9[_0x26ff('0x66')](_0x5c1795['body'][_0xc0a0b9]);}return BPromise[_0x26ff('0x67')](_0x98c1e9,function(_0x4af66a){return db[_0x26ff('0x63')][_0x26ff('0x56')](_[_0x26ff('0x68')](_0x4af66a,['ids','id'])||{},{'fields':_['keys'](_0x197e7b),'raw':!![]})[_0x26ff('0x27')](function(_0x38d241){_0x5c2e87[_0x26ff('0x69')][_0x26ff('0x66')](_0x38d241[_0x26ff('0x6a')]);})[_0x26ff('0x4e')](function(_0x4cb03a){_0x5c2e87['errors'][_0x26ff('0x66')]({'data':_0x4af66a,'error':_0x4cb03a['message']});});})[_0x26ff('0x27')](function(_0x2eb54b){return _0x5c2e87;})['catch'](function(_0x1040ed){return _0x1040ed;});}else{_0x5926ac['status'](0x190)[_0x26ff('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x26ff('0x27')](respondWithResult(_0x5926ac,null))[_0x26ff('0x4e')](handleError(_0x5926ac,null));};exports[_0x26ff('0x6b')]=function(_0x524c76,_0x5e687c,_0x200697){var _0x32ca35;return db[_0x26ff('0x33')][_0x26ff('0x4d')]({'where':{'id':_0x524c76[_0x26ff('0x59')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x26ff('0x6c')}]})['then'](handleEntityNotFound(_0x5e687c,null))[_0x26ff('0x27')](function(_0x4feb1d){if(_0x4feb1d){_0x32ca35=_0x4feb1d;return db[_0x26ff('0x63')][_0x26ff('0x34')];}})[_0x26ff('0x27')](function(_0x558b89){if(_0x558b89){var _0x555e39={};var _0x508e13={};_0x508e13[_0x26ff('0x38')]=_[_0x26ff('0x6d')](_[_0x26ff('0x3a')](_0x558b89),_['map'](_0x32ca35['CustomFields'],function(_0x138237){return util[_0x26ff('0x6e')](_0x26ff('0x6f'),_0x138237['id']);}));_0x508e13[_0x26ff('0x39')]=_[_0x26ff('0x3a')](_0x524c76[_0x26ff('0x39')]);_0x508e13[_0x26ff('0x3b')]=_[_0x26ff('0x3c')](_0x508e13[_0x26ff('0x38')],_0x508e13[_0x26ff('0x39')]);_0x555e39[_0x26ff('0x3d')]=_[_0x26ff('0x3c')](_0x508e13[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x524c76[_0x26ff('0x39')][_0x26ff('0x3e')]));_0x555e39[_0x26ff('0x3d')]=_0x555e39[_0x26ff('0x3d')][_0x26ff('0x3f')]?_0x555e39[_0x26ff('0x3d')]:_0x508e13['model'];if(!_0x524c76[_0x26ff('0x39')][_0x26ff('0x5e')](_0x26ff('0x40'))){_0x555e39[_0x26ff('0x1e')]=qs[_0x26ff('0x1e')](_0x524c76[_0x26ff('0x39')][_0x26ff('0x1e')]);_0x555e39[_0x26ff('0x21')]=qs[_0x26ff('0x21')](_0x524c76[_0x26ff('0x39')]['offset']);}_0x555e39[_0x26ff('0x41')]=qs[_0x26ff('0x42')](_0x524c76[_0x26ff('0x39')]['sort']);_0x555e39[_0x26ff('0x45')]=qs[_0x26ff('0x3b')](_['pick'](_0x524c76[_0x26ff('0x39')],_0x508e13[_0x26ff('0x3b')]));_0x555e39[_0x26ff('0x70')]=!![];if(_0x524c76[_0x26ff('0x39')][_0x26ff('0x44')]){_0x555e39[_0x26ff('0x45')]=_['merge'](_0x555e39['where'],{'$or':_[_0x26ff('0x32')](_0x555e39[_0x26ff('0x3d')],function(_0x2dbdc4){var _0x5393e9={};_0x5393e9[_0x2dbdc4]={'$like':'%'+_0x524c76[_0x26ff('0x39')][_0x26ff('0x44')]+'%'};return _0x5393e9;})});}_0x555e39=_[_0x26ff('0x46')]({},_0x555e39,_0x524c76[_0x26ff('0x48')]);return _0x32ca35[_0x26ff('0x6b')](_0x555e39);}})[_0x26ff('0x27')](respondWithResult(_0x5e687c,null))['catch'](handleError(_0x5e687c,null));};exports[_0x26ff('0x71')]=function(_0x2a2895,_0x590f62,_0x528b42){var _0x46cb61;return db['CmList'][_0x26ff('0x4d')]({'where':{'id':_0x2a2895[_0x26ff('0x59')]['id']},'include':[{'model':db[_0x26ff('0x72')],'as':_0x26ff('0x6c')}]})[_0x26ff('0x27')](handleEntityNotFound(_0x590f62,null))[_0x26ff('0x27')](function(_0x413166){if(_0x413166){_0x46cb61=_0x413166;return db[_0x26ff('0x63')][_0x26ff('0x34')];}})[_0x26ff('0x27')](function(_0x3e8958){if(_0x3e8958){var _0xba71c3={};var _0x46ab34={};_0x46ab34[_0x26ff('0x38')]=_[_0x26ff('0x6d')](_[_0x26ff('0x3a')](_0x3e8958),_[_0x26ff('0x32')](_0x46cb61['CustomFields'],function(_0x5e000a){return util[_0x26ff('0x6e')](_0x26ff('0x6f'),_0x5e000a['id']);}));_0x46ab34[_0x26ff('0x39')]=_[_0x26ff('0x3a')](_0x2a2895['query']);_0x46ab34[_0x26ff('0x3b')]=_['intersection'](_0x46ab34[_0x26ff('0x38')],_0x46ab34[_0x26ff('0x39')]);_0xba71c3[_0x26ff('0x3d')]=_[_0x26ff('0x3c')](_0x46ab34[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x2a2895[_0x26ff('0x39')][_0x26ff('0x3e')]));_0xba71c3['attributes']=_0xba71c3[_0x26ff('0x3d')][_0x26ff('0x3f')]?_0xba71c3[_0x26ff('0x3d')]:_0x46ab34[_0x26ff('0x38')];if(!_0x2a2895['query'][_0x26ff('0x5e')](_0x26ff('0x40'))){_0xba71c3[_0x26ff('0x1e')]=qs[_0x26ff('0x1e')](_0x2a2895[_0x26ff('0x39')][_0x26ff('0x1e')]);_0xba71c3[_0x26ff('0x21')]=qs[_0x26ff('0x21')](_0x2a2895[_0x26ff('0x39')]['offset']);}_0xba71c3[_0x26ff('0x41')]=qs[_0x26ff('0x42')](_0x2a2895[_0x26ff('0x39')][_0x26ff('0x42')]);_0xba71c3[_0x26ff('0x45')]=qs[_0x26ff('0x3b')](_[_0x26ff('0x43')](_0x2a2895[_0x26ff('0x39')],_0x46ab34[_0x26ff('0x3b')]));_0xba71c3[_0x26ff('0x70')]=!![];if(_0x2a2895[_0x26ff('0x39')]['filter']){_0xba71c3['where']=_[_0x26ff('0x46')](_0xba71c3[_0x26ff('0x45')],{'$or':_[_0x26ff('0x32')](_0xba71c3[_0x26ff('0x3d')],function(_0x1045f2){var _0x3a8fbf={};_0x3a8fbf[_0x1045f2]={'$like':'%'+_0x2a2895[_0x26ff('0x39')]['filter']+'%'};return _0x3a8fbf;})});}_0xba71c3=_[_0x26ff('0x46')]({},_0xba71c3,_0x2a2895[_0x26ff('0x48')]);return _0x46cb61['getContacts'](_0xba71c3);}})[_0x26ff('0x27')](function(_0x8b722c){if(!_['isEmpty'](_0x8b722c)){var _0x2c26f6=toCsv(_0x8b722c);var _0xcb11d6=Date[_0x26ff('0x73')]();fs[_0x26ff('0x74')](util[_0x26ff('0x6e')](_0x26ff('0x75'),_0x46cb61['id'],_0xcb11d6),_0x2c26f6);_0x590f62[_0x26ff('0x76')](_0x26ff('0x77'),'attachment;\x20filename='+util[_0x26ff('0x6e')](_0x26ff('0x78'),_0x46cb61['id'],_0xcb11d6));_0x590f62['setHeader'](_0x26ff('0x79'),_0x26ff('0x7a'));return _0x590f62[_0x26ff('0x7b')](util['format']('/tmp/list_%d_%s.csv',_0x46cb61['id'],_0xcb11d6));}else{return _0x590f62['sendStatus'](0xcc);}})['catch'](handleError(_0x590f62,null));};exports[_0x26ff('0x7c')]=function(_0x2c17ec,_0x7ead93,_0x560dab){var _0x28d94c;delete _0x2c17ec[_0x26ff('0x4f')]['id'];return db['CmList'][_0x26ff('0x5d')]({'where':{'id':_0x2c17ec[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x7ead93,null))[_0x26ff('0x27')](function(_0x1af1c8){if(_0x1af1c8){return db[_0x26ff('0x7d')][_0x26ff('0x7e')](function(_0x82dd1d){return db['CmCustomField'][_0x26ff('0x56')](_0x2c17ec['body'],{'transaction':_0x82dd1d})['then'](function(_0x35289e){_0x28d94c=_0x35289e;return _0x1af1c8[_0x26ff('0x7f')](_0x35289e,{'transaction':_0x82dd1d});})[_0x26ff('0x27')](function(){var _0x24eceb={'type':db['Sequelize'][_0x26ff('0x80')],'transaction':_0x82dd1d};switch(_0x2c17ec[_0x26ff('0x4f')][_0x26ff('0x36')]){case _0x26ff('0x81'):_0x24eceb['type']=db[_0x26ff('0x82')]['TEXT'];break;case _0x26ff('0x83'):_0x24eceb[_0x26ff('0x36')]=db[_0x26ff('0x82')][_0x26ff('0x84')];break;case _0x26ff('0x85'):_0x24eceb[_0x26ff('0x36')]=db[_0x26ff('0x82')]['BOOLEAN'];_0x24eceb['defaultValue']=![];break;default:}return db[_0x26ff('0x7d')][_0x26ff('0x86')][_0x26ff('0x87')](_0x26ff('0x88'),util[_0x26ff('0x6e')]('cf_%s',_0x28d94c['id']),_0x24eceb);})[_0x26ff('0x27')](function(){return _0x28d94c;});});}})[_0x26ff('0x27')](respondWithResult(_0x7ead93,null))['catch'](handleError(_0x7ead93,null));};exports[_0x26ff('0x89')]=function(_0x43d1a2,_0x573faa,_0x5e31c6){var _0xdf67ed={};var _0x25a220={};var _0x5625f8;var _0x444262;return db[_0x26ff('0x33')]['findOne']({'where':{'id':_0x43d1a2[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x573faa,null))[_0x26ff('0x27')](function(_0x47fac8){if(_0x47fac8){_0x5625f8=_0x47fac8;_0x25a220['model']=_[_0x26ff('0x3a')](db[_0x26ff('0x72')][_0x26ff('0x34')]);_0x25a220['query']=_[_0x26ff('0x3a')](_0x43d1a2[_0x26ff('0x39')]);_0x25a220['filters']=_['intersection'](_0x25a220[_0x26ff('0x38')],_0x25a220[_0x26ff('0x39')]);_0xdf67ed[_0x26ff('0x3d')]=_['intersection'](_0x25a220[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x43d1a2[_0x26ff('0x39')][_0x26ff('0x3e')]));_0xdf67ed[_0x26ff('0x3d')]=_0xdf67ed[_0x26ff('0x3d')]['length']?_0xdf67ed['attributes']:_0x25a220[_0x26ff('0x38')];_0xdf67ed['order']=qs[_0x26ff('0x42')](_0x43d1a2['query']['sort']);_0xdf67ed['where']=qs[_0x26ff('0x3b')](_[_0x26ff('0x43')](_0x43d1a2['query'],_0x25a220['filters']));_0xdf67ed[_0x26ff('0x45')]=_['merge'](_0xdf67ed['where'],{'$or':[{'ListId':_0x47fac8['id']},{'ListId':null}]});if(_0x43d1a2[_0x26ff('0x39')]['filter']){_0xdf67ed[_0x26ff('0x45')]=_['merge'](_0xdf67ed[_0x26ff('0x45')],{'$or':_[_0x26ff('0x32')](_0xdf67ed[_0x26ff('0x3d')],function(_0x4cecb4){var _0x38219c={};_0x38219c[_0x4cecb4]={'$like':'%'+_0x43d1a2['query'][_0x26ff('0x44')]+'%'};return _0x38219c;})});}_0xdf67ed=_[_0x26ff('0x46')]({},_0xdf67ed,_0x43d1a2[_0x26ff('0x48')]);return db[_0x26ff('0x72')][_0x26ff('0x8a')](_0xdf67ed);}})[_0x26ff('0x27')](respondWithResult(_0x573faa,null))[_0x26ff('0x4e')](handleError(_0x573faa,null));};exports['addAgents']=function(_0x367d2f,_0x1e5f20,_0x123659){return db[_0x26ff('0x33')][_0x26ff('0x4d')]({'where':{'id':_0x367d2f[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x1e5f20,null))['then'](function(_0x5ebec2){if(_0x5ebec2){return _0x5ebec2[_0x26ff('0x8b')](_0x367d2f[_0x26ff('0x4f')][_0x26ff('0x61')],_[_0x26ff('0x68')](_0x367d2f['body'],['ids','id'])||{})[_0x26ff('0x8c')](function(_0x5efd75){for(var _0x21994f=0x0;_0x21994f<_0x367d2f[_0x26ff('0x4f')][_0x26ff('0x61')][_0x26ff('0x3f')];_0x21994f+=0x1){socket[_0x26ff('0x8d')](_0x26ff('0x8e'),{'UserId':Number(_0x367d2f[_0x26ff('0x4f')]['ids'][_0x21994f]),'CmListId':Number(_0x367d2f[_0x26ff('0x59')]['id'])});}return _0x5efd75;});}})[_0x26ff('0x27')](respondWithResult(_0x1e5f20,null))[_0x26ff('0x4e')](handleError(_0x1e5f20,null));};exports[_0x26ff('0x8f')]=function(_0x2dc36f,_0x20b12a,_0x3a2230){return db[_0x26ff('0x33')][_0x26ff('0x4d')]({'where':{'id':_0x2dc36f['params']['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x20b12a,null))[_0x26ff('0x27')](function(_0x53bb8c){if(_0x53bb8c){return _0x53bb8c[_0x26ff('0x8f')](_0x2dc36f[_0x26ff('0x39')]['ids'])['then'](function(){if(_[_0x26ff('0x64')](_0x2dc36f[_0x26ff('0x39')][_0x26ff('0x61')])){for(var _0xed5770=0x0;_0xed5770<_0x2dc36f['query'][_0x26ff('0x61')][_0x26ff('0x3f')];_0xed5770+=0x1){socket[_0x26ff('0x8d')](_0x26ff('0x90'),{'UserId':Number(_0x2dc36f[_0x26ff('0x39')][_0x26ff('0x61')][_0xed5770]),'CmListId':Number(_0x2dc36f[_0x26ff('0x59')]['id'])});}}else{socket[_0x26ff('0x8d')]('userCmList:remove',{'UserId':Number(_0x2dc36f['query'][_0x26ff('0x61')]),'CmListId':Number(_0x2dc36f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x20b12a,null))[_0x26ff('0x4e')](handleError(_0x20b12a,null));};exports['getAgents']=function(_0x1fb00d,_0x4b0022,_0x1159c9){var _0x1562e1={};var _0x2a6dac={};var _0x1974f8;var _0x23da81;return db[_0x26ff('0x33')][_0x26ff('0x5d')]({'where':{'id':_0x1fb00d[_0x26ff('0x59')]['id']}})[_0x26ff('0x27')](handleEntityNotFound(_0x4b0022,null))[_0x26ff('0x27')](function(_0x29cab8){if(_0x29cab8){_0x1974f8=_0x29cab8;_0x2a6dac[_0x26ff('0x38')]=_[_0x26ff('0x3a')](db[_0x26ff('0x91')][_0x26ff('0x34')]);_0x2a6dac[_0x26ff('0x39')]=_['keys'](_0x1fb00d[_0x26ff('0x39')]);_0x2a6dac['filters']=_['intersection'](_0x2a6dac['model'],_0x2a6dac['query']);_0x1562e1['attributes']=_['intersection'](_0x2a6dac[_0x26ff('0x38')],qs[_0x26ff('0x3e')](_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x3e')]));_0x1562e1['attributes']=_0x1562e1[_0x26ff('0x3d')][_0x26ff('0x3f')]?_0x1562e1[_0x26ff('0x3d')]:_0x2a6dac[_0x26ff('0x38')];_0x1562e1[_0x26ff('0x41')]=qs[_0x26ff('0x42')](_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x42')]);_0x1562e1[_0x26ff('0x45')]=qs[_0x26ff('0x3b')](_['pick'](_0x1fb00d[_0x26ff('0x39')],_0x2a6dac[_0x26ff('0x3b')]));if(_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x44')]){_0x1562e1[_0x26ff('0x45')]=_['merge'](_0x1562e1[_0x26ff('0x45')],{'$or':_[_0x26ff('0x32')](_0x1562e1[_0x26ff('0x3d')],function(_0x3ba70d){var _0x4c171d={};_0x4c171d[_0x3ba70d]={'$like':'%'+_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x44')]+'%'};return _0x4c171d;})});}_0x1562e1=_['merge']({},_0x1562e1,_0x1fb00d['options']);return _0x1974f8[_0x26ff('0x92')](_0x1562e1);}})[_0x26ff('0x27')](function(_0x2f487a){if(_0x2f487a){_0x23da81=_0x2f487a[_0x26ff('0x3f')];if(!_0x1fb00d[_0x26ff('0x39')]['hasOwnProperty'](_0x26ff('0x40'))){_0x1562e1[_0x26ff('0x1e')]=qs[_0x26ff('0x1e')](_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x1e')]);_0x1562e1[_0x26ff('0x21')]=qs[_0x26ff('0x21')](_0x1fb00d[_0x26ff('0x39')][_0x26ff('0x21')]);}return _0x1974f8[_0x26ff('0x92')](_0x1562e1);}})[_0x26ff('0x27')](function(_0x426f99){if(_0x426f99){return _0x426f99?{'count':_0x23da81,'rows':_0x426f99}:null;}})[_0x26ff('0x27')](respondWithResult(_0x4b0022,null))['catch'](handleError(_0x4b0022,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c0e6581..511a8a6 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x3f097c,_0x32f99f){var _0x524678=function(_0x12987a){while(--_0x12987a){_0x3f097c['push'](_0x3f097c['shift']());}};_0x524678(++_0x32f99f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x55ca,0x126));var _0xa55c=function(_0x820843,_0x4b6f7e){_0x820843=_0x820843-0x0;var _0x2077c2=_0x55ca[_0x820843];return _0x2077c2;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6102ecb..00c9e1f 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 _0x9c44=['request-promise','path','./cmList.attributes','define','CmList','cm_lists','../../config/logger','api','moment','bluebird'];(function(_0x45751e,_0x330035){var _0x1a3969=function(_0x53aa28){while(--_0x53aa28){_0x45751e['push'](_0x45751e['shift']());}};_0x1a3969(++_0x330035);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x11d373,_0x49a0b1){var _0x4f4349=function(_0x278ec9){while(--_0x278ec9){_0x11d373['push'](_0x11d373['shift']());}};_0x4f4349(++_0x49a0b1);}(_0xedd9,0xfc));var _0x9edd=function(_0x35db4f,_0x1036fc){_0x35db4f=_0x35db4f-0x0;var _0x670013=_0xedd9[_0x35db4f];return _0x670013;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),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 2821dac..3056b41 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 _0x104f=['stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','request\x20sent'];(function(_0x394024,_0x517aa7){var _0x13efcc=function(_0x1b982c){while(--_0x1b982c){_0x394024['push'](_0x394024['shift']());}};_0x13efcc(++_0x517aa7);}(_0x104f,0xfb));var _0xf104=function(_0x397b72,_0x2b533c){_0x397b72=_0x397b72-0x0;var _0x1c47be=_0x104f[_0x397b72];return _0x1c47be;};'use strict';var _=require('lodash');var util=require(_0xf104('0x0'));var moment=require(_0xf104('0x1'));var BPromise=require(_0xf104('0x2'));var rs=require(_0xf104('0x3'));var fs=require('fs');var Redis=require(_0xf104('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf104('0x5'));var logger=require(_0xf104('0x6'))(_0xf104('0x7'));var config=require('../../config/environment');var jayson=require(_0xf104('0x8'));var client=jayson[_0xf104('0x9')][_0xf104('0xa')]({'port':0x232a});config[_0xf104('0xb')]=_[_0xf104('0xc')](config[_0xf104('0xb')],{'host':_0xf104('0xd'),'port':0x18eb});var socket=require(_0xf104('0xe'))(new Redis(config[_0xf104('0xb')]));require(_0xf104('0xf'))['register'](socket);function respondWithRpcPromise(_0x65b584,_0x26ca8d,_0x8d912c){return new BPromise(function(_0x1c041d,_0x4e375c){return client[_0xf104('0x10')](_0x65b584,_0x8d912c)[_0xf104('0x11')](function(_0x9d48c2){logger['info']('CmList,\x20%s,\x20%s',_0x26ca8d,_0xf104('0x12'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x26ca8d,'request\x20sent',JSON[_0xf104('0x13')](_0x9d48c2));if(_0x9d48c2[_0xf104('0x14')]){if(_0x9d48c2[_0xf104('0x14')][_0xf104('0x15')]===0x1f4){logger[_0xf104('0x14')](_0xf104('0x16'),_0x26ca8d,_0x9d48c2['error'][_0xf104('0x17')]);return _0x4e375c(_0x9d48c2[_0xf104('0x14')][_0xf104('0x17')]);}logger['error'](_0xf104('0x16'),_0x26ca8d,_0x9d48c2[_0xf104('0x14')]['message']);return _0x1c041d(_0x9d48c2[_0xf104('0x14')][_0xf104('0x17')]);}else{logger[_0xf104('0x18')](_0xf104('0x16'),_0x26ca8d,_0xf104('0x12'));_0x1c041d(_0x9d48c2[_0xf104('0x19')][_0xf104('0x17')]);}})[_0xf104('0x1a')](function(_0x10bc18){logger[_0xf104('0x14')]('CmList,\x20%s,\x20%s',_0x26ca8d,_0x10bc18);_0x4e375c(_0x10bc18);});});} \ No newline at end of file +var _0x66a2=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x3b4b79,_0x395e10){var _0x5d48b9=function(_0x48aaa6){while(--_0x48aaa6){_0x3b4b79['push'](_0x3b4b79['shift']());}};_0x5d48b9(++_0x395e10);}(_0x66a2,0xce));var _0x266a=function(_0x1ec3af,_0x37e2df){_0x1ec3af=_0x1ec3af-0x0;var _0x61b349=_0x66a2[_0x1ec3af];return _0x61b349;};'use strict';var _=require('lodash');var util=require(_0x266a('0x0'));var moment=require(_0x266a('0x1'));var BPromise=require(_0x266a('0x2'));var rs=require(_0x266a('0x3'));var fs=require('fs');var Redis=require(_0x266a('0x4'));var db=require(_0x266a('0x5'))['db'];var utils=require(_0x266a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x266a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x266a('0x8')][_0x266a('0x9')]({'port':0x232a});config[_0x266a('0xa')]=_[_0x266a('0xb')](config['redis'],{'host':_0x266a('0xc'),'port':0x18eb});var socket=require(_0x266a('0xd'))(new Redis(config[_0x266a('0xa')]));require(_0x266a('0xe'))[_0x266a('0xf')](socket);function respondWithRpcPromise(_0x2c4179,_0x5c9a78,_0x32d197){return new BPromise(function(_0x23edb2,_0x1111b9){return client[_0x266a('0x10')](_0x2c4179,_0x32d197)[_0x266a('0x11')](function(_0x12c3f5){logger['info'](_0x266a('0x12'),_0x5c9a78,_0x266a('0x13'));logger[_0x266a('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x5c9a78,_0x266a('0x13'),JSON[_0x266a('0x15')](_0x12c3f5));if(_0x12c3f5[_0x266a('0x16')]){if(_0x12c3f5[_0x266a('0x16')][_0x266a('0x17')]===0x1f4){logger[_0x266a('0x16')](_0x266a('0x12'),_0x5c9a78,_0x12c3f5['error'][_0x266a('0x18')]);return _0x1111b9(_0x12c3f5[_0x266a('0x16')]['message']);}logger[_0x266a('0x16')](_0x266a('0x12'),_0x5c9a78,_0x12c3f5[_0x266a('0x16')][_0x266a('0x18')]);return _0x23edb2(_0x12c3f5['error'][_0x266a('0x18')]);}else{logger[_0x266a('0x19')]('CmList,\x20%s,\x20%s',_0x5c9a78,_0x266a('0x13'));_0x23edb2(_0x12c3f5[_0x266a('0x1a')]['message']);}})['catch'](function(_0x14576e){logger[_0x266a('0x16')](_0x266a('0x12'),_0x5c9a78,_0x14576e);_0x1111b9(_0x14576e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index db8fe48..eb623af 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 _0xc3c5=['remove','removeListener','register','cmList:','save'];(function(_0x2aefd4,_0x161fd8){var _0x14b362=function(_0x57f086){while(--_0x57f086){_0x2aefd4['push'](_0x2aefd4['shift']());}};_0x14b362(++_0x161fd8);}(_0xc3c5,0x167));var _0x5c3c=function(_0x37aa3c,_0x3b036b){_0x37aa3c=_0x37aa3c-0x0;var _0x21c497=_0xc3c5[_0x37aa3c];return _0x21c497;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x5c3c('0x0'),_0x5c3c('0x1'),'update'];function createListener(_0x4a063d,_0x32704f){return function(_0x2dfa30){_0x32704f['emit'](_0x4a063d,_0x2dfa30);};}function removeListener(_0x5a29a9,_0x3e2a44){return function(){CmListEvents[_0x5c3c('0x2')](_0x5a29a9,_0x3e2a44);};}exports[_0x5c3c('0x3')]=function(_0x444fde){for(var _0x25ee1e=0x0,_0x459700=events['length'];_0x25ee1e<_0x459700;_0x25ee1e++){var _0x22c24f=events[_0x25ee1e];var _0x4e5178=createListener(_0x5c3c('0x4')+_0x22c24f,_0x444fde);CmListEvents['on'](_0x22c24f,_0x4e5178);}}; \ No newline at end of file +var _0x13c6=['./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5d169c,_0x1924c1){var _0x85cf04=function(_0x3fc821){while(--_0x3fc821){_0x5d169c['push'](_0x5d169c['shift']());}};_0x85cf04(++_0x1924c1);}(_0x13c6,0x180));var _0x613c=function(_0x2f1343,_0x59bd6a){_0x2f1343=_0x2f1343-0x0;var _0x2d8268=_0x13c6[_0x2f1343];return _0x2d8268;};'use strict';var CmListEvents=require(_0x613c('0x0'));var events=[_0x613c('0x1'),_0x613c('0x2'),_0x613c('0x3')];function createListener(_0x4caa70,_0x3c597d){return function(_0x24c034){_0x3c597d[_0x613c('0x4')](_0x4caa70,_0x24c034);};}function removeListener(_0x1fd871,_0x4e3ade){return function(){CmListEvents[_0x613c('0x5')](_0x1fd871,_0x4e3ade);};}exports[_0x613c('0x6')]=function(_0x2db3db){for(var _0x4b16c3=0x0,_0x52c48e=events[_0x613c('0x7')];_0x4b16c3<_0x52c48e;_0x4b16c3++){var _0x30f80e=events[_0x4b16c3];var _0x3cb2cf=createListener('cmList:'+_0x30f80e,_0x2db3db);CmListEvents['on'](_0x30f80e,_0x3cb2cf);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0530ceb..5c6d96a 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 _0xa59e=['addCustomField','addAgents','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','/describe','describe','get','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts'];(function(_0xac8441,_0x1bbd7b){var _0x11c864=function(_0x5c27e2){while(--_0x5c27e2){_0xac8441['push'](_0xac8441['shift']());}};_0x11c864(++_0x1bbd7b);}(_0xa59e,0x1db));var _0xea59=function(_0x412c9c,_0x398eb4){_0x412c9c=_0x412c9c-0x0;var _0x449d7d=_0xa59e[_0x412c9c];return _0x449d7d;};'use strict';var multer=require('multer');var util=require(_0xea59('0x0'));var path=require(_0xea59('0x1'));var timeout=require(_0xea59('0x2'));var express=require('express');var router=express[_0xea59('0x3')]();var fs_extra=require(_0xea59('0x4'));var auth=require(_0xea59('0x5'));var interaction=require(_0xea59('0x6'));var config=require(_0xea59('0x7'));var controller=require(_0xea59('0x8'));router['get']('/',auth[_0xea59('0x9')](),controller['index']);router['get'](_0xea59('0xa'),auth[_0xea59('0x9')](),controller[_0xea59('0xb')]);router[_0xea59('0xc')](_0xea59('0xd'),auth[_0xea59('0x9')](),controller[_0xea59('0xe')]);router[_0xea59('0xc')]('/:id/dispositions',auth[_0xea59('0x9')](),controller[_0xea59('0xf')]);router[_0xea59('0xc')](_0xea59('0x10'),auth[_0xea59('0x9')](),controller[_0xea59('0x11')]);router[_0xea59('0xc')](_0xea59('0x12'),auth[_0xea59('0x9')](),controller[_0xea59('0x13')]);router[_0xea59('0xc')](_0xea59('0x14'),auth[_0xea59('0x9')](),controller[_0xea59('0x15')]);router[_0xea59('0xc')](_0xea59('0x16'),auth[_0xea59('0x9')](),controller[_0xea59('0x17')]);router[_0xea59('0x18')]('/',auth[_0xea59('0x9')](),controller[_0xea59('0x19')]);router[_0xea59('0x18')](_0xea59('0x1a'),auth[_0xea59('0x9')](),controller[_0xea59('0x1b')]);router['post'](_0xea59('0x10'),auth[_0xea59('0x9')](),controller[_0xea59('0x1c')]);router[_0xea59('0x18')](_0xea59('0x14'),auth[_0xea59('0x9')](),controller[_0xea59('0x1d')]);router['post'](_0xea59('0x16'),auth['isAuthenticated'](),controller[_0xea59('0x1e')]);router[_0xea59('0x1f')](_0xea59('0xd'),auth[_0xea59('0x9')](),controller['update']);router[_0xea59('0x20')](_0xea59('0xd'),auth['isAuthenticated'](),controller[_0xea59('0x21')]);router[_0xea59('0x20')](_0xea59('0x1a'),auth[_0xea59('0x9')](),controller['removeDispositions']);router['delete'](_0xea59('0x16'),auth['isAuthenticated'](),controller[_0xea59('0x22')]);module[_0xea59('0x23')]=router; \ No newline at end of file +var _0xa78d=['/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv'];(function(_0x4d130c,_0x3c0372){var _0x1085ac=function(_0x918459){while(--_0x918459){_0x4d130c['push'](_0x4d130c['shift']());}};_0x1085ac(++_0x3c0372);}(_0xa78d,0x7b));var _0xda78=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xa78d[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0xda78('0x0'));var util=require('util');var path=require(_0xda78('0x1'));var timeout=require('connect-timeout');var express=require(_0xda78('0x2'));var router=express[_0xda78('0x3')]();var fs_extra=require(_0xda78('0x4'));var auth=require(_0xda78('0x5'));var interaction=require(_0xda78('0x6'));var config=require(_0xda78('0x7'));var controller=require(_0xda78('0x8'));router['get']('/',auth[_0xda78('0x9')](),controller[_0xda78('0xa')]);router['get'](_0xda78('0xb'),auth[_0xda78('0x9')](),controller[_0xda78('0xc')]);router['get'](_0xda78('0xd'),auth[_0xda78('0x9')](),controller[_0xda78('0xe')]);router[_0xda78('0xf')](_0xda78('0x10'),auth[_0xda78('0x9')](),controller[_0xda78('0x11')]);router['get'](_0xda78('0x12'),auth[_0xda78('0x9')](),controller[_0xda78('0x13')]);router['get']('/:id/contacts/csv',auth[_0xda78('0x9')](),controller[_0xda78('0x14')]);router[_0xda78('0xf')](_0xda78('0x15'),auth[_0xda78('0x9')](),controller['getCustomFields']);router[_0xda78('0xf')](_0xda78('0x16'),auth['isAuthenticated'](),controller[_0xda78('0x17')]);router[_0xda78('0x18')]('/',auth[_0xda78('0x9')](),controller[_0xda78('0x19')]);router[_0xda78('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xda78('0x1a')]);router['post']('/:id/contacts',auth[_0xda78('0x9')](),controller[_0xda78('0x1b')]);router['post'](_0xda78('0x15'),auth[_0xda78('0x9')](),controller['addCustomField']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xda78('0x1c')]);router[_0xda78('0x1d')](_0xda78('0xd'),auth[_0xda78('0x9')](),controller[_0xda78('0x1e')]);router['delete'](_0xda78('0xd'),auth[_0xda78('0x9')](),controller[_0xda78('0x1f')]);router[_0xda78('0x20')](_0xda78('0x10'),auth['isAuthenticated'](),controller[_0xda78('0x21')]);router['delete']('/:id/users',auth[_0xda78('0x9')](),controller[_0xda78('0x22')]);module[_0xda78('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a815ca4..347571b 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 _0x3588=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0x3588,0x17f));var _0x8358=function(_0x162f4b,_0x31b569){_0x162f4b=_0x162f4b-0x0;var _0x57b00b=_0x3588[_0x162f4b];return _0x57b00b;};'use strict';var Sequelize=require(_0x8358('0x0'));module[_0x8358('0x1')]={'name':{'type':Sequelize[_0x8358('0x2')],'get':function(_0xf8aa42){return this['getDataValue'](_0x8358('0x3'));}},'field':{'type':Sequelize[_0x8358('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x8358('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa52a=['sequelize','VIRTUAL','STRING'];(function(_0x4da46c,_0x36e18c){var _0x332454=function(_0x39c4e6){while(--_0x39c4e6){_0x4da46c['push'](_0x4da46c['shift']());}};_0x332454(++_0x36e18c);}(_0xa52a,0xed));var _0xaa52=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0xa52a[_0x51904f];return _0x24dc27;};'use strict';var Sequelize=require(_0xaa52('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa52('0x1')],'get':function(_0x47b8f2){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xaa52('0x2')],'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 38040db..eeccfa5 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(_0x420377,_0x544378){var _0x19b544=function(_0x5756e6){while(--_0x5756e6){_0x420377['push'](_0x420377['shift']());}};_0x19b544(++_0x544378);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4d77fa,_0x4aa3c6){var _0x4d0f37=function(_0x2bb196){while(--_0x2bb196){_0x4d77fa['push'](_0x4d77fa['shift']());}};_0x4d0f37(++_0x4aa3c6);}(_0x7a54,0x106));var _0x47a5=function(_0x56eab8,_0x34f9b5){_0x56eab8=_0x56eab8-0x0;var _0x2f38ea=_0x7a54[_0x56eab8];return _0x2f38ea;};'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 32cec73..4aafebe 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 _0x325f=['path','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','bluebird','request-promise'];(function(_0x3f21f3,_0x4edffe){var _0x276c69=function(_0x36ff88){while(--_0x36ff88){_0x3f21f3['push'](_0x3f21f3['shift']());}};_0x276c69(++_0x4edffe);}(_0x325f,0x11e));var _0xf325=function(_0x31ba60,_0x352c6b){_0x31ba60=_0x31ba60-0x0;var _0x12b629=_0x325f[_0x31ba60];return _0x12b629;};'use strict';var _=require(_0xf325('0x0'));var util=require(_0xf325('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf325('0x2'));var rp=require(_0xf325('0x3'));var fs=require('fs');var path=require(_0xf325('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf325('0x5'));module[_0xf325('0x6')]=function(_0x1fece6,_0x53b28a){return _0x1fece6[_0xf325('0x7')](_0xf325('0x8'),attributes,{'tableName':_0xf325('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4057=['./condition.attributes','define','Condition','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5b5354,_0x2786a3){var _0x51b9a9=function(_0x1de798){while(--_0x1de798){_0x5b5354['push'](_0x5b5354['shift']());}};_0x51b9a9(++_0x2786a3);}(_0x4057,0x142));var _0x7405=function(_0xd6a1c9,_0x203324){_0xd6a1c9=_0xd6a1c9-0x0;var _0x51ea29=_0x4057[_0xd6a1c9];return _0x51ea29;};'use strict';var _=require(_0x7405('0x0'));var util=require(_0x7405('0x1'));var logger=require(_0x7405('0x2'))(_0x7405('0x3'));var moment=require(_0x7405('0x4'));var BPromise=require('bluebird');var rp=require(_0x7405('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7405('0x6'));var config=require(_0x7405('0x7'));var attributes=require(_0x7405('0x8'));module['exports']=function(_0x2da592,_0xa0047f){return _0x2da592[_0x7405('0x9')](_0x7405('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index d82e026..ff59ec9 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 _0x7ca7=['error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x473392,_0x1ad1e3){var _0x4c3eb1=function(_0x8fd690){while(--_0x8fd690){_0x473392['push'](_0x473392['shift']());}};_0x4c3eb1(++_0x1ad1e3);}(_0x7ca7,0x1b4));var _0x77ca=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x7ca7[_0x23c6f2];return _0x4c270b;};'use strict';var _=require('lodash');var util=require(_0x77ca('0x0'));var moment=require(_0x77ca('0x1'));var BPromise=require(_0x77ca('0x2'));var rs=require(_0x77ca('0x3'));var fs=require('fs');var Redis=require(_0x77ca('0x4'));var db=require(_0x77ca('0x5'))['db'];var utils=require(_0x77ca('0x6'));var logger=require('../../config/logger')(_0x77ca('0x7'));var config=require(_0x77ca('0x8'));var jayson=require(_0x77ca('0x9'));var client=jayson[_0x77ca('0xa')][_0x77ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfa69e,_0x2341a4,_0x551a90){return new BPromise(function(_0x47e7dc,_0x33f64f){return client[_0x77ca('0xc')](_0xfa69e,_0x551a90)[_0x77ca('0xd')](function(_0x2aaaf4){logger[_0x77ca('0xe')](_0x77ca('0xf'),_0x2341a4,_0x77ca('0x10'));logger[_0x77ca('0x11')](_0x77ca('0x12'),_0x2341a4,_0x77ca('0x10'),JSON[_0x77ca('0x13')](_0x2aaaf4));if(_0x2aaaf4[_0x77ca('0x14')]){if(_0x2aaaf4['error'][_0x77ca('0x15')]===0x1f4){logger[_0x77ca('0x14')](_0x77ca('0xf'),_0x2341a4,_0x2aaaf4[_0x77ca('0x14')][_0x77ca('0x16')]);return _0x33f64f(_0x2aaaf4[_0x77ca('0x14')][_0x77ca('0x16')]);}logger['error'](_0x77ca('0xf'),_0x2341a4,_0x2aaaf4[_0x77ca('0x14')][_0x77ca('0x16')]);return _0x47e7dc(_0x2aaaf4[_0x77ca('0x14')][_0x77ca('0x16')]);}else{logger[_0x77ca('0xe')](_0x77ca('0xf'),_0x2341a4,_0x77ca('0x10'));_0x47e7dc(_0x2aaaf4[_0x77ca('0x17')][_0x77ca('0x16')]);}})['catch'](function(_0x118489){logger['error'](_0x77ca('0xf'),_0x2341a4,_0x118489);_0x33f64f(_0x118489);});});} \ No newline at end of file +var _0x7eb2=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e752b,_0x5cb17d){var _0x40a0b4=function(_0x11365a){while(--_0x11365a){_0x2e752b['push'](_0x2e752b['shift']());}};_0x40a0b4(++_0x5cb17d);}(_0x7eb2,0x149));var _0x27eb=function(_0x4e5179,_0x593694){_0x4e5179=_0x4e5179-0x0;var _0x100c1c=_0x7eb2[_0x4e5179];return _0x100c1c;};'use strict';var _=require(_0x27eb('0x0'));var util=require(_0x27eb('0x1'));var moment=require('moment');var BPromise=require(_0x27eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27eb('0x4'));var logger=require(_0x27eb('0x5'))(_0x27eb('0x6'));var config=require(_0x27eb('0x7'));var jayson=require(_0x27eb('0x8'));var client=jayson[_0x27eb('0x9')][_0x27eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x822e44,_0x6d70d4,_0x323ae8){return new BPromise(function(_0x456770,_0x2a97c2){return client['request'](_0x822e44,_0x323ae8)[_0x27eb('0xb')](function(_0x429660){logger[_0x27eb('0xc')](_0x27eb('0xd'),_0x6d70d4,_0x27eb('0xe'));logger[_0x27eb('0xf')](_0x27eb('0x10'),_0x6d70d4,_0x27eb('0xe'),JSON[_0x27eb('0x11')](_0x429660));if(_0x429660[_0x27eb('0x12')]){if(_0x429660['error'][_0x27eb('0x13')]===0x1f4){logger[_0x27eb('0x12')](_0x27eb('0xd'),_0x6d70d4,_0x429660[_0x27eb('0x12')][_0x27eb('0x14')]);return _0x2a97c2(_0x429660[_0x27eb('0x12')]['message']);}logger[_0x27eb('0x12')](_0x27eb('0xd'),_0x6d70d4,_0x429660[_0x27eb('0x12')][_0x27eb('0x14')]);return _0x456770(_0x429660[_0x27eb('0x12')][_0x27eb('0x14')]);}else{logger[_0x27eb('0xc')]('Condition,\x20%s,\x20%s',_0x6d70d4,_0x27eb('0xe'));_0x456770(_0x429660[_0x27eb('0x15')][_0x27eb('0x14')]);}})[_0x27eb('0x16')](function(_0x1b9645){logger[_0x27eb('0x12')](_0x27eb('0xd'),_0x6d70d4,_0x1b9645);_0x2a97c2(_0x1b9645);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index dab0017..e53b814 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 _0x3315=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy'];(function(_0x560cae,_0xd53b5f){var _0x5bcd8f=function(_0x15b2d9){while(--_0x15b2d9){_0x560cae['push'](_0x560cae['shift']());}};_0x5bcd8f(++_0xd53b5f);}(_0x3315,0xf8));var _0x5331=function(_0x188487,_0x1ee13a){_0x188487=_0x188487-0x0;var _0x38ea41=_0x3315[_0x188487];return _0x38ea41;};'use strict';var multer=require(_0x5331('0x0'));var util=require('util');var path=require(_0x5331('0x1'));var timeout=require(_0x5331('0x2'));var express=require('express');var router=express[_0x5331('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5331('0x4'));var config=require(_0x5331('0x5'));var controller=require(_0x5331('0x6'));router[_0x5331('0x7')](_0x5331('0x8'),auth[_0x5331('0x9')](),controller['update']);router[_0x5331('0xa')](_0x5331('0x8'),auth[_0x5331('0x9')](),controller[_0x5331('0xb')]);module[_0x5331('0xc')]=router; \ No newline at end of file +var _0xd96f=['connect-timeout','express','Router','fs-extra','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x3d248c,_0x4a0101){var _0x8aba14=function(_0x5ecfd7){while(--_0x5ecfd7){_0x3d248c['push'](_0x3d248c['shift']());}};_0x8aba14(++_0x4a0101);}(_0xd96f,0x1dd));var _0xfd96=function(_0x1c0d1f,_0x31eab7){_0x1c0d1f=_0x1c0d1f-0x0;var _0x34f239=_0xd96f[_0x1c0d1f];return _0x34f239;};'use strict';var multer=require(_0xfd96('0x0'));var util=require(_0xfd96('0x1'));var path=require(_0xfd96('0x2'));var timeout=require(_0xfd96('0x3'));var express=require(_0xfd96('0x4'));var router=express[_0xfd96('0x5')]();var fs_extra=require(_0xfd96('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd96('0x7'));var controller=require('./condition.controller');router[_0xfd96('0x8')](_0xfd96('0x9'),auth[_0xfd96('0xa')](),controller[_0xfd96('0xb')]);router[_0xfd96('0xc')](_0xfd96('0x9'),auth[_0xfd96('0xa')](),controller[_0xfd96('0xd')]);module[_0xfd96('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6adb082..3fb9210 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 _0xb10b=['name','sequelize','STRING'];(function(_0x2da1b7,_0x270eda){var _0x3a7af9=function(_0x4b9a21){while(--_0x4b9a21){_0x2da1b7['push'](_0x2da1b7['shift']());}};_0x3a7af9(++_0x270eda);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f7fb2,_0x116309){_0x1f7fb2=_0x1f7fb2-0x0;var _0x61fc27=_0xb10b[_0x1f7fb2];return _0x61fc27;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x19e166,_0x4cc641){var _0x5e6bed=function(_0xb7fce7){while(--_0xb7fce7){_0x19e166['push'](_0x19e166['shift']());}};_0x5e6bed(++_0x4cc641);}(_0x757a,0xde));var _0xa757=function(_0x2041ce,_0x290ab8){_0x2041ce=_0x2041ce-0x0;var _0x3cbd9f=_0x757a[_0x2041ce];return _0x3cbd9f;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4f0ea5c..41647b5 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 _0xf382=['json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','name','send','index','map','Dashboard','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','include','findAll','rows','catch','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','body','role','userProfileId','autoAssociation','params','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','pick','nolimit','getItems','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','status','end'];(function(_0x4deaf7,_0x3f91fa){var _0x4048dc=function(_0x17d6da){while(--_0x17d6da){_0x4deaf7['push'](_0x4deaf7['shift']());}};_0x4048dc(++_0x3f91fa);}(_0xf382,0x1d5));var _0x2f38=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xf382[_0x2d9c6a];return _0xf3c918;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f38('0x0'));var zipdir=require(_0x2f38('0x1'));var jsonpatch=require(_0x2f38('0x2'));var rp=require(_0x2f38('0x3'));var moment=require('moment');var BPromise=require(_0x2f38('0x4'));var Mustache=require(_0x2f38('0x5'));var util=require(_0x2f38('0x6'));var path=require('path');var sox=require(_0x2f38('0x7'));var csv=require(_0x2f38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f38('0x9'));var _=require('lodash');var squel=require(_0x2f38('0xa'));var crypto=require(_0x2f38('0xb'));var jsforce=require(_0x2f38('0xc'));var deskjs=require(_0x2f38('0xd'));var toCsv=require(_0x2f38('0x8'));var querystring=require(_0x2f38('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f38('0xf'));var authService=require(_0x2f38('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f38('0x11'))(_0x2f38('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f38('0x13'))['db'];config[_0x2f38('0x14')]=_[_0x2f38('0x15')](config[_0x2f38('0x14')],{'host':_0x2f38('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f38('0x17'))[_0x2f38('0x18')](socket);function respondWithStatusCode(_0x441497,_0x4b0ea5){_0x4b0ea5=_0x4b0ea5||0xcc;return function(_0x38309a){if(_0x38309a){return _0x441497['sendStatus'](_0x4b0ea5);}return _0x441497[_0x2f38('0x19')](_0x4b0ea5)[_0x2f38('0x1a')]();};}function respondWithResult(_0x8ecde7,_0x2dfe07){_0x2dfe07=_0x2dfe07||0xc8;return function(_0x497a7d){if(_0x497a7d){return _0x8ecde7['status'](_0x2dfe07)[_0x2f38('0x1b')](_0x497a7d);}};}function respondWithFilteredResult(_0x595b86,_0x103b22){return function(_0x3ba804){if(_0x3ba804){var _0x558a05=typeof _0x103b22['offset']==='undefined'&&typeof _0x103b22['limit']==='undefined';var _0x49ec67=_0x3ba804['count'];var _0x28b7f4=_0x558a05?0x0:_0x103b22[_0x2f38('0x1c')];var _0x5c5020=_0x558a05?_0x3ba804[_0x2f38('0x1d')]:_0x103b22[_0x2f38('0x1c')]+_0x103b22[_0x2f38('0x1e')];var _0x47c971;if(_0x5c5020>=_0x49ec67){_0x5c5020=_0x49ec67;_0x47c971=0xc8;}else{_0x47c971=0xce;}_0x595b86[_0x2f38('0x19')](_0x47c971);return _0x595b86[_0x2f38('0x1f')](_0x2f38('0x20'),_0x28b7f4+'-'+_0x5c5020+'/'+_0x49ec67)[_0x2f38('0x1b')](_0x3ba804);}return null;};}function patchUpdates(_0x50ee3a){return function(_0x3aaf17){try{jsonpatch['apply'](_0x3aaf17,_0x50ee3a,!![]);}catch(_0x174c15){return BPromise[_0x2f38('0x21')](_0x174c15);}return _0x3aaf17[_0x2f38('0x22')]();};}function saveUpdates(_0x337dd3,_0x327b33){return function(_0x3d297c){if(_0x3d297c){return _0x3d297c[_0x2f38('0x23')](_0x337dd3)[_0x2f38('0x24')](function(_0x4e8b34){return _0x4e8b34;});}return null;};}function removeEntity(_0x28f391,_0x2c2f59){return function(_0x8640ef){if(_0x8640ef){return _0x8640ef[_0x2f38('0x25')]()[_0x2f38('0x24')](function(){var _0x2577e5=_0x8640ef[_0x2f38('0x26')]({'plain':!![]});var _0x34cc7b=_0x2f38('0x27');return db[_0x2f38('0x28')][_0x2f38('0x25')]({'where':{'type':_0x34cc7b,'resourceId':_0x2577e5['id']}})[_0x2f38('0x24')](function(){return _0x8640ef;});})['then'](function(){_0x28f391[_0x2f38('0x19')](0xcc)[_0x2f38('0x1a')]();});}};}function handleEntityNotFound(_0x1e38c2,_0x483cec){return function(_0x32c4e7){if(!_0x32c4e7){_0x1e38c2[_0x2f38('0x29')](0x194);}return _0x32c4e7;};}function handleError(_0xe91478,_0x13e2a5){_0x13e2a5=_0x13e2a5||0x1f4;return function(_0x3d55be){logger[_0x2f38('0x2a')](_0x3d55be['stack']);if(_0x3d55be['name']){delete _0x3d55be[_0x2f38('0x2b')];}_0xe91478['status'](_0x13e2a5)[_0x2f38('0x2c')](_0x3d55be);};}exports[_0x2f38('0x2d')]=function(_0x2c3a3d,_0x583889){var _0x106cfb={},_0x36e953={},_0xfa7e5b={'count':0x0,'rows':[]};var _0xcda7f6=_[_0x2f38('0x2e')](db[_0x2f38('0x2f')]['rawAttributes'],function(_0xecd221){return{'name':_0xecd221['fieldName'],'type':_0xecd221[_0x2f38('0x30')][_0x2f38('0x31')]};});_0x36e953[_0x2f38('0x32')]=_[_0x2f38('0x2e')](_0xcda7f6,'name');_0x36e953[_0x2f38('0x33')]=_['keys'](_0x2c3a3d[_0x2f38('0x33')]);_0x36e953['filters']=_['intersection'](_0x36e953[_0x2f38('0x32')],_0x36e953[_0x2f38('0x33')]);_0x106cfb['attributes']=_[_0x2f38('0x34')](_0x36e953[_0x2f38('0x32')],qs[_0x2f38('0x35')](_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x35')]));_0x106cfb[_0x2f38('0x36')]=_0x106cfb[_0x2f38('0x36')][_0x2f38('0x37')]?_0x106cfb['attributes']:_0x36e953[_0x2f38('0x32')];if(!_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x38')]('nolimit')){_0x106cfb[_0x2f38('0x1e')]=qs[_0x2f38('0x1e')](_0x2c3a3d['query']['limit']);_0x106cfb[_0x2f38('0x1c')]=qs[_0x2f38('0x1c')](_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x1c')]);}_0x106cfb[_0x2f38('0x39')]=qs[_0x2f38('0x3a')](_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x3a')]);_0x106cfb['where']=qs['filters'](_['pick'](_0x2c3a3d[_0x2f38('0x33')],_0x36e953[_0x2f38('0x3b')]),_0xcda7f6);if(_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x3c')]){_0x106cfb[_0x2f38('0x3d')]=_[_0x2f38('0x3e')](_0x106cfb[_0x2f38('0x3d')],{'$or':_[_0x2f38('0x2e')](_0xcda7f6,function(_0x3b7656){if(_0x3b7656[_0x2f38('0x30')]!=='VIRTUAL'){var _0xd4a44c={};_0xd4a44c[_0x3b7656[_0x2f38('0x2b')]]={'$like':'%'+_0x2c3a3d[_0x2f38('0x33')][_0x2f38('0x3c')]+'%'};return _0xd4a44c;}})});}_0x106cfb=_[_0x2f38('0x3e')]({},_0x106cfb,_0x2c3a3d[_0x2f38('0x3f')]);var _0x44597b={'where':_0x106cfb[_0x2f38('0x3d')]};return db[_0x2f38('0x2f')][_0x2f38('0x1d')](_0x44597b)[_0x2f38('0x24')](function(_0x2e44bc){_0xfa7e5b[_0x2f38('0x1d')]=_0x2e44bc;if(_0x2c3a3d[_0x2f38('0x33')]['includeAll']){_0x106cfb[_0x2f38('0x40')]=[{'all':!![]}];}return db[_0x2f38('0x2f')][_0x2f38('0x41')](_0x106cfb);})[_0x2f38('0x24')](function(_0x2f145e){_0xfa7e5b[_0x2f38('0x42')]=_0x2f145e;return _0xfa7e5b;})[_0x2f38('0x24')](respondWithFilteredResult(_0x583889,_0x106cfb))[_0x2f38('0x43')](handleError(_0x583889,null));};exports['show']=function(_0xb89565,_0x28f6d7){var _0xcb0f62={'raw':![],'where':{'id':_0xb89565['params']['id']}},_0x3a7a15={};_0x3a7a15['model']=_[_0x2f38('0x44')](db[_0x2f38('0x2f')]['rawAttributes']);_0x3a7a15[_0x2f38('0x33')]=_[_0x2f38('0x44')](_0xb89565[_0x2f38('0x33')]);_0x3a7a15[_0x2f38('0x3b')]=_[_0x2f38('0x34')](_0x3a7a15[_0x2f38('0x32')],_0x3a7a15[_0x2f38('0x33')]);_0xcb0f62[_0x2f38('0x36')]=_[_0x2f38('0x34')](_0x3a7a15['model'],qs[_0x2f38('0x35')](_0xb89565[_0x2f38('0x33')][_0x2f38('0x35')]));_0xcb0f62[_0x2f38('0x36')]=_0xcb0f62[_0x2f38('0x36')][_0x2f38('0x37')]?_0xcb0f62['attributes']:_0x3a7a15[_0x2f38('0x32')];if(_0xb89565[_0x2f38('0x33')][_0x2f38('0x45')]){_0xcb0f62['include']=[{'all':!![]}];}_0xcb0f62=_['merge']({},_0xcb0f62,_0xb89565[_0x2f38('0x3f')]);return db[_0x2f38('0x2f')][_0x2f38('0x46')](_0xcb0f62)[_0x2f38('0x24')](handleEntityNotFound(_0x28f6d7,null))[_0x2f38('0x24')](respondWithResult(_0x28f6d7,null))[_0x2f38('0x43')](handleError(_0x28f6d7,null));};exports[_0x2f38('0x47')]=function(_0x3beb6f,_0xfbe04c){return db[_0x2f38('0x2f')][_0x2f38('0x47')](_0x3beb6f['body'],{})['then'](function(_0x27d1a8){var _0x5896b0=_0x3beb6f[_0x2f38('0x48')][_0x2f38('0x26')]({'plain':!![]});if(!_0x5896b0)throw new Error(_0x2f38('0x49'));if(_0x5896b0['role']===_0x2f38('0x48')){var _0x49f646=_0x27d1a8[_0x2f38('0x26')]({'plain':!![]});var _0x276795=_0x2f38('0x27');return db[_0x2f38('0x4a')][_0x2f38('0x46')]({'where':{'name':_0x276795,'userProfileId':_0x5896b0['userProfileId']},'raw':!![]})[_0x2f38('0x24')](function(_0x14fbb4){if(_0x14fbb4&&_0x14fbb4['autoAssociation']===0x0){return db['UserProfileResource'][_0x2f38('0x47')]({'name':_0x49f646[_0x2f38('0x2b')],'resourceId':_0x49f646['id'],'type':_0x14fbb4[_0x2f38('0x2b')],'sectionId':_0x14fbb4['id']},{})[_0x2f38('0x24')](function(){return _0x27d1a8;});}else{return _0x27d1a8;}})[_0x2f38('0x43')](function(_0x1a7da3){logger[_0x2f38('0x2a')](_0x2f38('0x4b'),_0x1a7da3);throw _0x1a7da3;});}return _0x27d1a8;})['then'](respondWithResult(_0xfbe04c,0xc9))['catch'](handleError(_0xfbe04c,null));};exports[_0x2f38('0x4c')]=function(_0x515e99,_0x5be2b4){var _0x1d6ac7={'where':{'id':_0x515e99['params']['id']}},_0x1ef805={};_0x1ef805[_0x2f38('0x32')]=_[_0x2f38('0x44')](db[_0x2f38('0x2f')][_0x2f38('0x4d')]);_0x1d6ac7['attributes']=_[_0x2f38('0x34')](_0x1ef805['model'],qs[_0x2f38('0x35')](_0x515e99[_0x2f38('0x33')][_0x2f38('0x35')]));_0x1d6ac7['attributes']=_0x1d6ac7[_0x2f38('0x36')][_0x2f38('0x37')]?_0x1d6ac7['attributes']:_0x1ef805['model'];if(_0x515e99[_0x2f38('0x33')][_0x2f38('0x45')]){_0x1d6ac7[_0x2f38('0x40')]=[{'all':!![]}];}_0x1d6ac7=_[_0x2f38('0x3e')]({},_0x1d6ac7,_0x515e99[_0x2f38('0x3f')]);return db[_0x2f38('0x2f')]['find'](_0x1d6ac7)['then'](handleEntityNotFound(_0x5be2b4,null))[_0x2f38('0x24')](function(_0x39f6de){if(_0x39f6de){var _0x1480b2=_0x39f6de['get']({'plain':!![]});_0x1480b2=qs[_0x2f38('0x4e')](_0x1480b2,['id',_0x2f38('0x4f'),_0x2f38('0x50')]);_0x515e99[_0x2f38('0x51')]=_[_0x2f38('0x4e')](_0x515e99['body'],['id',_0x2f38('0x4f'),_0x2f38('0x50')]);return db[_0x2f38('0x2f')][_0x2f38('0x47')](_['merge'](_0x1480b2,_0x515e99[_0x2f38('0x51')]),{'include':_0x515e99['query'][_0x2f38('0x45')]?[{'all':!![]}]:undefined})[_0x2f38('0x24')](function(_0x3fa61a){var _0x137b6d=_0x515e99[_0x2f38('0x48')][_0x2f38('0x26')]({'plain':!![]});if(!_0x137b6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x137b6d[_0x2f38('0x52')]===_0x2f38('0x48')){var _0x1b6ea4=_0x3fa61a[_0x2f38('0x26')]({'plain':!![]});var _0x29b6f4='CustomDashboards';return db[_0x2f38('0x4a')][_0x2f38('0x46')]({'where':{'name':_0x29b6f4,'userProfileId':_0x137b6d[_0x2f38('0x53')]},'raw':!![]})[_0x2f38('0x24')](function(_0x38c607){if(_0x38c607&&_0x38c607[_0x2f38('0x54')]===0x0){return db[_0x2f38('0x28')]['create']({'name':_0x1b6ea4['name'],'resourceId':_0x1b6ea4['id'],'type':_0x38c607['name'],'sectionId':_0x38c607['id']},{})[_0x2f38('0x24')](function(){return _0x3fa61a;});}else{return _0x3fa61a;}})['catch'](function(_0x157736){logger[_0x2f38('0x2a')](_0x2f38('0x4b'),_0x157736);throw _0x157736;});}return _0x3fa61a;});}})[_0x2f38('0x24')](respondWithResult(_0x5be2b4,0xc9))[_0x2f38('0x43')](handleError(_0x5be2b4,null));};exports[_0x2f38('0x23')]=function(_0x2cec33,_0x225af1){if(_0x2cec33[_0x2f38('0x51')]['id']){delete _0x2cec33[_0x2f38('0x51')]['id'];}return db[_0x2f38('0x2f')][_0x2f38('0x46')]({'where':{'id':_0x2cec33[_0x2f38('0x55')]['id']}})[_0x2f38('0x24')](handleEntityNotFound(_0x225af1,null))[_0x2f38('0x24')](saveUpdates(_0x2cec33['body'],null))[_0x2f38('0x24')](respondWithResult(_0x225af1,null))[_0x2f38('0x43')](handleError(_0x225af1,null));};exports['destroy']=function(_0xb71464,_0x4dd59d){return db[_0x2f38('0x2f')][_0x2f38('0x46')]({'where':{'id':_0xb71464[_0x2f38('0x55')]['id']}})[_0x2f38('0x24')](handleEntityNotFound(_0x4dd59d,null))['then'](removeEntity(_0x4dd59d,null))['catch'](handleError(_0x4dd59d,null));};function widgetAttributes(_0x30d997){try{switch(_0x30d997[_0x2f38('0x30')]){case'iframe':return[{'name':'attrUrl','value':_0x30d997[_0x2f38('0x56')]||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x0]?_0x30d997[_0x2f38('0x57')][0x0][_0x2f38('0x58')]:undefined)||_0x2f38('0x59')}];case'custom':return[{'name':_0x2f38('0x5a'),'value':_0x30d997[_0x2f38('0x5a')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x0]?_0x30d997['attrs'][0x0]['value']:undefined)||''}];case _0x2f38('0x5b'):return[{'name':_0x2f38('0x5c'),'value':_0x30d997[_0x2f38('0x5c')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997['attrs'][0x0]?_0x30d997['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x30d997[_0x2f38('0x5d')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x1]?_0x30d997[_0x2f38('0x57')][0x1][_0x2f38('0x58')]:undefined)||'0.00'},{'name':_0x2f38('0x5e'),'value':_0x30d997['attrFontSize']||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x2]?_0x30d997[_0x2f38('0x57')][0x2][_0x2f38('0x58')]:undefined)||0xc}];case _0x2f38('0x5f'):return[{'name':_0x2f38('0x60'),'value':_0x30d997[_0x2f38('0x60')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x0]?_0x30d997['attrs'][0x0][_0x2f38('0x58')]:undefined)||_0x2f38('0x61')},{'name':_0x2f38('0x62'),'value':_0x30d997['attrVoiceQueues']||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x1]?_0x30d997['attrs'][0x1][_0x2f38('0x58')]:undefined)||[]},{'name':_0x2f38('0x5e'),'value':_0x30d997[_0x2f38('0x5e')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x2]?_0x30d997[_0x2f38('0x57')][0x2][_0x2f38('0x58')]:undefined)||0x14},{'name':_0x2f38('0x63'),'value':_0x30d997[_0x2f38('0x63')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x3]?_0x30d997['attrs'][0x3]['value']:undefined)||_0x2f38('0x64')},{'name':'attrEmailAccounts','value':_0x30d997[_0x2f38('0x65')]||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x4]?_0x30d997['attrs'][0x4][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x66'),'value':_0x30d997['attrFaxAccounts']||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x5]?_0x30d997[_0x2f38('0x57')][0x5][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x67'),'value':_0x30d997[_0x2f38('0x67')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x6]?_0x30d997[_0x2f38('0x57')][0x6][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x68'),'value':_0x30d997[_0x2f38('0x68')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x7]?_0x30d997[_0x2f38('0x57')][0x7][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x69'),'value':_0x30d997['attrWhatsappAccounts']||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x8]?_0x30d997[_0x2f38('0x57')][0x8]['value']:undefined)||''},{'name':_0x2f38('0x6a'),'value':_0x30d997[_0x2f38('0x6a')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997['attrs'][0x9]?_0x30d997[_0x2f38('0x57')][0x9][_0x2f38('0x58')]:undefined)||''}];case _0x2f38('0x6b'):case'pie-chart':return[{'name':_0x2f38('0x6c'),'value':_0x30d997['attrSerie1']||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x0]?_0x30d997[_0x2f38('0x57')][0x0][_0x2f38('0x58')]:undefined)||'total'},{'name':_0x2f38('0x6d'),'value':_0x30d997[_0x2f38('0x6d')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x1]?_0x30d997[_0x2f38('0x57')][0x1][_0x2f38('0x58')]:undefined)||null},{'name':_0x2f38('0x6e'),'value':_0x30d997[_0x2f38('0x6e')]||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x2]?_0x30d997[_0x2f38('0x57')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x30d997[_0x2f38('0x62')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x3]?_0x30d997[_0x2f38('0x57')][0x3][_0x2f38('0x58')]:undefined)||[]},{'name':'attrChannel','value':_0x30d997['attrChannel']||(_0x30d997[_0x2f38('0x57')]&&_0x30d997['attrs'][0x4]?_0x30d997[_0x2f38('0x57')][0x4][_0x2f38('0x58')]:undefined)||_0x2f38('0x64')},{'name':_0x2f38('0x65'),'value':_0x30d997[_0x2f38('0x65')]||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x5]?_0x30d997[_0x2f38('0x57')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x30d997['attrFaxAccounts']||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x6]?_0x30d997['attrs'][0x6][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x67'),'value':_0x30d997['attrSmsAccounts']||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0x7]?_0x30d997[_0x2f38('0x57')][0x7][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x68'),'value':_0x30d997[_0x2f38('0x68')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x8]?_0x30d997[_0x2f38('0x57')][0x8][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x69'),'value':_0x30d997[_0x2f38('0x69')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997['attrs'][0x9]?_0x30d997['attrs'][0x9][_0x2f38('0x58')]:undefined)||''},{'name':_0x2f38('0x6a'),'value':_0x30d997[_0x2f38('0x6a')]||(_0x30d997['attrs']&&_0x30d997[_0x2f38('0x57')][0xa]?_0x30d997[_0x2f38('0x57')][0xa][_0x2f38('0x58')]:undefined)||''}];case _0x2f38('0x6f'):return[{'name':_0x2f38('0x70'),'type':_0x30d997[_0x2f38('0x71')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997['attrs'][0x0]?_0x30d997[_0x2f38('0x57')][0x0][_0x2f38('0x30')]:undefined)||null,'value':_0x30d997[_0x2f38('0x70')]||(_0x30d997[_0x2f38('0x57')]&&_0x30d997[_0x2f38('0x57')][0x0]?_0x30d997[_0x2f38('0x57')][0x0][_0x2f38('0x58')]:undefined)||null},{'name':'attrRefresh','value':_0x30d997[_0x2f38('0x72')]||(_0x30d997['attrs']&&_0x30d997['attrs'][0x1]?_0x30d997[_0x2f38('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3abaaa){logger[_0x2f38('0x2a')](_0x2f38('0x73'),JSON[_0x2f38('0x74')](_0x3abaaa));return[];}}exports[_0x2f38('0x75')]=function(_0x12bfb4,_0x182e22,_0x3c5f94){if(_0x12bfb4[_0x2f38('0x51')]['id']){delete _0x12bfb4[_0x2f38('0x51')]['id'];}return db[_0x2f38('0x2f')][_0x2f38('0x46')]({'where':{'id':_0x12bfb4['params']['id']}})[_0x2f38('0x24')](handleEntityNotFound(_0x182e22,null))[_0x2f38('0x24')](function(_0x2d45f6){if(_0x2d45f6){_0x12bfb4['body'][_0x2f38('0x76')]=_0x2d45f6['id'];_0x12bfb4['body'][_0x2f38('0x57')]=widgetAttributes(_0x12bfb4['body']);return db[_0x2f38('0x77')][_0x2f38('0x47')](_0x12bfb4[_0x2f38('0x51')]);}})[_0x2f38('0x24')](respondWithResult(_0x182e22,null))[_0x2f38('0x43')](handleError(_0x182e22,null));};exports['getItems']=function(_0x4fd1bc,_0x2d02fb,_0x2ee71c){var _0x29bfd3={};var _0x795ae8={};var _0x277144;var _0x5f3ff6;return db[_0x2f38('0x2f')][_0x2f38('0x78')]({'where':{'id':_0x4fd1bc[_0x2f38('0x55')]['id']}})[_0x2f38('0x24')](handleEntityNotFound(_0x2d02fb,null))[_0x2f38('0x24')](function(_0x509682){if(_0x509682){_0x277144=_0x509682;_0x795ae8[_0x2f38('0x32')]=_['keys'](db[_0x2f38('0x77')][_0x2f38('0x4d')]);_0x795ae8[_0x2f38('0x33')]=_[_0x2f38('0x44')](_0x4fd1bc[_0x2f38('0x33')]);_0x795ae8[_0x2f38('0x3b')]=_['intersection'](_0x795ae8[_0x2f38('0x32')],_0x795ae8[_0x2f38('0x33')]);_0x29bfd3[_0x2f38('0x36')]=_[_0x2f38('0x34')](_0x795ae8['model'],qs[_0x2f38('0x35')](_0x4fd1bc[_0x2f38('0x33')][_0x2f38('0x35')]));_0x29bfd3[_0x2f38('0x36')]=_0x29bfd3[_0x2f38('0x36')][_0x2f38('0x37')]?_0x29bfd3[_0x2f38('0x36')]:_0x795ae8['model'];_0x29bfd3[_0x2f38('0x39')]=qs['sort'](_0x4fd1bc['query'][_0x2f38('0x3a')]);_0x29bfd3[_0x2f38('0x3d')]=qs[_0x2f38('0x3b')](_[_0x2f38('0x79')](_0x4fd1bc[_0x2f38('0x33')],_0x795ae8['filters']));if(_0x4fd1bc['query']['filter']){_0x29bfd3[_0x2f38('0x3d')]=_[_0x2f38('0x3e')](_0x29bfd3['where'],{'$or':_[_0x2f38('0x2e')](_0x29bfd3[_0x2f38('0x36')],function(_0x3aa7bd){var _0x37cb17={};_0x37cb17[_0x3aa7bd]={'$like':'%'+_0x4fd1bc[_0x2f38('0x33')][_0x2f38('0x3c')]+'%'};return _0x37cb17;})});}_0x29bfd3=_[_0x2f38('0x3e')]({},_0x29bfd3,_0x4fd1bc[_0x2f38('0x3f')]);return _0x277144['getItems'](_0x29bfd3);}})[_0x2f38('0x24')](function(_0x2b11bb){if(_0x2b11bb){_0x5f3ff6=_0x2b11bb[_0x2f38('0x37')];if(!_0x4fd1bc[_0x2f38('0x33')][_0x2f38('0x38')](_0x2f38('0x7a'))){_0x29bfd3['limit']=qs[_0x2f38('0x1e')](_0x4fd1bc[_0x2f38('0x33')][_0x2f38('0x1e')]);_0x29bfd3[_0x2f38('0x1c')]=qs['offset'](_0x4fd1bc[_0x2f38('0x33')][_0x2f38('0x1c')]);}return _0x277144[_0x2f38('0x7b')](_0x29bfd3);}})['then'](function(_0x489e5d){if(_0x489e5d){return _0x489e5d?{'count':_0x5f3ff6,'rows':_0x489e5d}:null;}})[_0x2f38('0x24')](respondWithResult(_0x2d02fb,null))[_0x2f38('0x43')](handleError(_0x2d02fb,null));}; \ No newline at end of file +var _0x57a4=['includeAll','include','rows','catch','show','intersection','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','params','updatedAt','body','omit','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','findOne','order','getItems','eml-format','rimraf','zip-dir','bluebird','mustache','path','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','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','destroy','then','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x36d182,_0x5358c5){var _0x37e7fb=function(_0x46da30){while(--_0x46da30){_0x36d182['push'](_0x36d182['shift']());}};_0x37e7fb(++_0x5358c5);}(_0x57a4,0x1a9));var _0x457a=function(_0x5461ea,_0xc51bad){_0x5461ea=_0x5461ea-0x0;var _0x39fc8e=_0x57a4[_0x5461ea];return _0x39fc8e;};'use strict';var emlformat=require(_0x457a('0x0'));var rimraf=require(_0x457a('0x1'));var zipdir=require(_0x457a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x457a('0x3'));var Mustache=require(_0x457a('0x4'));var util=require('util');var path=require(_0x457a('0x5'));var sox=require('sox');var csv=require(_0x457a('0x6'));var ejs=require(_0x457a('0x7'));var fs=require('fs');var fs_extra=require(_0x457a('0x8'));var _=require(_0x457a('0x9'));var squel=require(_0x457a('0xa'));var crypto=require(_0x457a('0xb'));var jsforce=require(_0x457a('0xc'));var deskjs=require(_0x457a('0xd'));var toCsv=require(_0x457a('0x6'));var querystring=require(_0x457a('0xe'));var Papa=require(_0x457a('0xf'));var Redis=require('ioredis');var authService=require(_0x457a('0x10'));var qs=require(_0x457a('0x11'));var as=require(_0x457a('0x12'));var hardwareService=require(_0x457a('0x13'));var logger=require(_0x457a('0x14'))(_0x457a('0x15'));var utils=require(_0x457a('0x16'));var config=require(_0x457a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x457a('0x18')](config['redis'],{'host':_0x457a('0x19'),'port':0x18eb});var socket=require(_0x457a('0x1a'))(new Redis(config[_0x457a('0x1b')]));require(_0x457a('0x1c'))['register'](socket);function respondWithStatusCode(_0x438a6d,_0x448a59){_0x448a59=_0x448a59||0xcc;return function(_0x423b7f){if(_0x423b7f){return _0x438a6d['sendStatus'](_0x448a59);}return _0x438a6d['status'](_0x448a59)[_0x457a('0x1d')]();};}function respondWithResult(_0x5c47a9,_0xa164d3){_0xa164d3=_0xa164d3||0xc8;return function(_0x203f78){if(_0x203f78){return _0x5c47a9['status'](_0xa164d3)[_0x457a('0x1e')](_0x203f78);}};}function respondWithFilteredResult(_0x248529,_0x36cb97){return function(_0x2739bb){if(_0x2739bb){var _0x5ae742=typeof _0x36cb97[_0x457a('0x1f')]==='undefined'&&typeof _0x36cb97[_0x457a('0x20')]===_0x457a('0x21');var _0x5eb2a1=_0x2739bb['count'];var _0xe14fcf=_0x5ae742?0x0:_0x36cb97[_0x457a('0x1f')];var _0x44668a=_0x5ae742?_0x2739bb[_0x457a('0x22')]:_0x36cb97[_0x457a('0x1f')]+_0x36cb97[_0x457a('0x20')];var _0x29929;if(_0x44668a>=_0x5eb2a1){_0x44668a=_0x5eb2a1;_0x29929=0xc8;}else{_0x29929=0xce;}_0x248529[_0x457a('0x23')](_0x29929);return _0x248529['set'](_0x457a('0x24'),_0xe14fcf+'-'+_0x44668a+'/'+_0x5eb2a1)[_0x457a('0x1e')](_0x2739bb);}return null;};}function patchUpdates(_0x515043){return function(_0x12e271){try{jsonpatch[_0x457a('0x25')](_0x12e271,_0x515043,!![]);}catch(_0x2c5578){return BPromise['reject'](_0x2c5578);}return _0x12e271[_0x457a('0x26')]();};}function saveUpdates(_0x1d905f,_0x282748){return function(_0x3086b7){if(_0x3086b7){return _0x3086b7['update'](_0x1d905f)['then'](function(_0x4ce11d){return _0x4ce11d;});}return null;};}function removeEntity(_0x82b731,_0x5df490){return function(_0x40da03){if(_0x40da03){return _0x40da03[_0x457a('0x27')]()[_0x457a('0x28')](function(){var _0x1efb74=_0x40da03[_0x457a('0x29')]({'plain':!![]});var _0x4ce73f=_0x457a('0x2a');return db[_0x457a('0x2b')]['destroy']({'where':{'type':_0x4ce73f,'resourceId':_0x1efb74['id']}})[_0x457a('0x28')](function(){return _0x40da03;});})[_0x457a('0x28')](function(){_0x82b731[_0x457a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12105e,_0x54a9f7){return function(_0x3cddbc){if(!_0x3cddbc){_0x12105e[_0x457a('0x2c')](0x194);}return _0x3cddbc;};}function handleError(_0x429d7a,_0x11b834){_0x11b834=_0x11b834||0x1f4;return function(_0xcc00db){logger[_0x457a('0x2d')](_0xcc00db[_0x457a('0x2e')]);if(_0xcc00db[_0x457a('0x2f')]){delete _0xcc00db[_0x457a('0x2f')];}_0x429d7a[_0x457a('0x23')](_0x11b834)[_0x457a('0x30')](_0xcc00db);};}exports[_0x457a('0x31')]=function(_0x13fa45,_0x42e374){var _0x16c0eb={},_0x3b4095={},_0x2460a5={'count':0x0,'rows':[]};var _0x3daf82=_[_0x457a('0x32')](db[_0x457a('0x33')][_0x457a('0x34')],function(_0x5b55e1){return{'name':_0x5b55e1[_0x457a('0x35')],'type':_0x5b55e1[_0x457a('0x36')]['key']};});_0x3b4095[_0x457a('0x37')]=_[_0x457a('0x32')](_0x3daf82,_0x457a('0x2f'));_0x3b4095['query']=_[_0x457a('0x38')](_0x13fa45[_0x457a('0x39')]);_0x3b4095['filters']=_['intersection'](_0x3b4095[_0x457a('0x37')],_0x3b4095['query']);_0x16c0eb['attributes']=_['intersection'](_0x3b4095[_0x457a('0x37')],qs[_0x457a('0x3a')](_0x13fa45[_0x457a('0x39')]['fields']));_0x16c0eb['attributes']=_0x16c0eb[_0x457a('0x3b')][_0x457a('0x3c')]?_0x16c0eb[_0x457a('0x3b')]:_0x3b4095['model'];if(!_0x13fa45[_0x457a('0x39')][_0x457a('0x3d')](_0x457a('0x3e'))){_0x16c0eb[_0x457a('0x20')]=qs[_0x457a('0x20')](_0x13fa45[_0x457a('0x39')][_0x457a('0x20')]);_0x16c0eb['offset']=qs[_0x457a('0x1f')](_0x13fa45[_0x457a('0x39')][_0x457a('0x1f')]);}_0x16c0eb['order']=qs[_0x457a('0x3f')](_0x13fa45[_0x457a('0x39')]['sort']);_0x16c0eb[_0x457a('0x40')]=qs[_0x457a('0x41')](_[_0x457a('0x42')](_0x13fa45[_0x457a('0x39')],_0x3b4095['filters']),_0x3daf82);if(_0x13fa45[_0x457a('0x39')][_0x457a('0x43')]){_0x16c0eb[_0x457a('0x40')]=_[_0x457a('0x44')](_0x16c0eb[_0x457a('0x40')],{'$or':_[_0x457a('0x32')](_0x3daf82,function(_0x5740f8){if(_0x5740f8[_0x457a('0x36')]!==_0x457a('0x45')){var _0x7eeac1={};_0x7eeac1[_0x5740f8['name']]={'$like':'%'+_0x13fa45['query'][_0x457a('0x43')]+'%'};return _0x7eeac1;}})});}_0x16c0eb=_['merge']({},_0x16c0eb,_0x13fa45[_0x457a('0x46')]);var _0x4e0ade={'where':_0x16c0eb[_0x457a('0x40')]};return db[_0x457a('0x33')][_0x457a('0x22')](_0x4e0ade)['then'](function(_0x12e787){_0x2460a5[_0x457a('0x22')]=_0x12e787;if(_0x13fa45['query'][_0x457a('0x47')]){_0x16c0eb[_0x457a('0x48')]=[{'all':!![]}];}return db[_0x457a('0x33')]['findAll'](_0x16c0eb);})['then'](function(_0x4e8ddb){_0x2460a5[_0x457a('0x49')]=_0x4e8ddb;return _0x2460a5;})[_0x457a('0x28')](respondWithFilteredResult(_0x42e374,_0x16c0eb))[_0x457a('0x4a')](handleError(_0x42e374,null));};exports[_0x457a('0x4b')]=function(_0x465013,_0x112272){var _0x1fa139={'raw':![],'where':{'id':_0x465013['params']['id']}},_0x4cf3a8={};_0x4cf3a8[_0x457a('0x37')]=_[_0x457a('0x38')](db[_0x457a('0x33')][_0x457a('0x34')]);_0x4cf3a8['query']=_[_0x457a('0x38')](_0x465013[_0x457a('0x39')]);_0x4cf3a8['filters']=_['intersection'](_0x4cf3a8[_0x457a('0x37')],_0x4cf3a8[_0x457a('0x39')]);_0x1fa139[_0x457a('0x3b')]=_[_0x457a('0x4c')](_0x4cf3a8[_0x457a('0x37')],qs['fields'](_0x465013[_0x457a('0x39')][_0x457a('0x3a')]));_0x1fa139['attributes']=_0x1fa139['attributes'][_0x457a('0x3c')]?_0x1fa139[_0x457a('0x3b')]:_0x4cf3a8['model'];if(_0x465013[_0x457a('0x39')][_0x457a('0x47')]){_0x1fa139[_0x457a('0x48')]=[{'all':!![]}];}_0x1fa139=_['merge']({},_0x1fa139,_0x465013['options']);return db['Dashboard']['find'](_0x1fa139)['then'](handleEntityNotFound(_0x112272,null))['then'](respondWithResult(_0x112272,null))['catch'](handleError(_0x112272,null));};exports[_0x457a('0x4d')]=function(_0x283be1,_0x38c7ac){return db['Dashboard'][_0x457a('0x4d')](_0x283be1['body'],{})[_0x457a('0x28')](function(_0x56bc3d){var _0x2a9ea5=_0x283be1['user'][_0x457a('0x29')]({'plain':!![]});if(!_0x2a9ea5)throw new Error(_0x457a('0x4e'));if(_0x2a9ea5[_0x457a('0x4f')]===_0x457a('0x50')){var _0x272c4a=_0x56bc3d[_0x457a('0x29')]({'plain':!![]});var _0x4960b0='CustomDashboards';return db['UserProfileSection'][_0x457a('0x51')]({'where':{'name':_0x4960b0,'userProfileId':_0x2a9ea5['userProfileId']},'raw':!![]})[_0x457a('0x28')](function(_0x4c5275){if(_0x4c5275&&_0x4c5275[_0x457a('0x52')]===0x0){return db[_0x457a('0x2b')][_0x457a('0x4d')]({'name':_0x272c4a[_0x457a('0x2f')],'resourceId':_0x272c4a['id'],'type':_0x4c5275[_0x457a('0x2f')],'sectionId':_0x4c5275['id']},{})['then'](function(){return _0x56bc3d;});}else{return _0x56bc3d;}})[_0x457a('0x4a')](function(_0x1b0cba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b0cba);throw _0x1b0cba;});}return _0x56bc3d;})[_0x457a('0x28')](respondWithResult(_0x38c7ac,0xc9))[_0x457a('0x4a')](handleError(_0x38c7ac,null));};exports['clone']=function(_0x1a2c05,_0x4f92fa){var _0x106824={'where':{'id':_0x1a2c05[_0x457a('0x53')]['id']}},_0x28b2a0={};_0x28b2a0[_0x457a('0x37')]=_['keys'](db[_0x457a('0x33')][_0x457a('0x34')]);_0x106824[_0x457a('0x3b')]=_[_0x457a('0x4c')](_0x28b2a0[_0x457a('0x37')],qs[_0x457a('0x3a')](_0x1a2c05[_0x457a('0x39')]['fields']));_0x106824[_0x457a('0x3b')]=_0x106824['attributes'][_0x457a('0x3c')]?_0x106824['attributes']:_0x28b2a0[_0x457a('0x37')];if(_0x1a2c05['query']['includeAll']){_0x106824[_0x457a('0x48')]=[{'all':!![]}];}_0x106824=_['merge']({},_0x106824,_0x1a2c05[_0x457a('0x46')]);return db['Dashboard'][_0x457a('0x51')](_0x106824)[_0x457a('0x28')](handleEntityNotFound(_0x4f92fa,null))[_0x457a('0x28')](function(_0x2b2b42){if(_0x2b2b42){var _0x26ee5e=_0x2b2b42[_0x457a('0x29')]({'plain':!![]});_0x26ee5e=qs['omit'](_0x26ee5e,['id','createdAt',_0x457a('0x54')]);_0x1a2c05[_0x457a('0x55')]=_[_0x457a('0x56')](_0x1a2c05['body'],['id',_0x457a('0x57'),_0x457a('0x54')]);return db[_0x457a('0x33')][_0x457a('0x4d')](_[_0x457a('0x44')](_0x26ee5e,_0x1a2c05['body']),{'include':_0x1a2c05[_0x457a('0x39')][_0x457a('0x47')]?[{'all':!![]}]:undefined})[_0x457a('0x28')](function(_0x2edc0a){var _0x3fd7d5=_0x1a2c05[_0x457a('0x50')][_0x457a('0x29')]({'plain':!![]});if(!_0x3fd7d5)throw new Error(_0x457a('0x4e'));if(_0x3fd7d5['role']===_0x457a('0x50')){var _0x2c4c4e=_0x2edc0a[_0x457a('0x29')]({'plain':!![]});var _0x58f8cf=_0x457a('0x2a');return db[_0x457a('0x58')][_0x457a('0x51')]({'where':{'name':_0x58f8cf,'userProfileId':_0x3fd7d5['userProfileId']},'raw':!![]})[_0x457a('0x28')](function(_0x2377e9){if(_0x2377e9&&_0x2377e9[_0x457a('0x52')]===0x0){return db[_0x457a('0x2b')][_0x457a('0x4d')]({'name':_0x2c4c4e['name'],'resourceId':_0x2c4c4e['id'],'type':_0x2377e9[_0x457a('0x2f')],'sectionId':_0x2377e9['id']},{})[_0x457a('0x28')](function(){return _0x2edc0a;});}else{return _0x2edc0a;}})['catch'](function(_0x5db8fa){logger[_0x457a('0x2d')](_0x457a('0x59'),_0x5db8fa);throw _0x5db8fa;});}return _0x2edc0a;});}})[_0x457a('0x28')](respondWithResult(_0x4f92fa,0xc9))[_0x457a('0x4a')](handleError(_0x4f92fa,null));};exports[_0x457a('0x5a')]=function(_0x49f58f,_0x2d10d4){if(_0x49f58f['body']['id']){delete _0x49f58f[_0x457a('0x55')]['id'];}return db[_0x457a('0x33')][_0x457a('0x51')]({'where':{'id':_0x49f58f[_0x457a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d10d4,null))[_0x457a('0x28')](saveUpdates(_0x49f58f[_0x457a('0x55')],null))[_0x457a('0x28')](respondWithResult(_0x2d10d4,null))[_0x457a('0x4a')](handleError(_0x2d10d4,null));};exports[_0x457a('0x27')]=function(_0x24fa31,_0x5797df){return db['Dashboard'][_0x457a('0x51')]({'where':{'id':_0x24fa31[_0x457a('0x53')]['id']}})[_0x457a('0x28')](handleEntityNotFound(_0x5797df,null))[_0x457a('0x28')](removeEntity(_0x5797df,null))['catch'](handleError(_0x5797df,null));};function widgetAttributes(_0x397b9c){try{switch(_0x397b9c['type']){case'iframe':return[{'name':_0x457a('0x5b'),'value':_0x397b9c[_0x457a('0x5b')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x5d')]:undefined)||_0x457a('0x5e')}];case'custom':return[{'name':_0x457a('0x5f'),'value':_0x397b9c[_0x457a('0x5f')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x5d')]:undefined)||''}];case _0x457a('0x60'):return[{'name':_0x457a('0x61'),'value':_0x397b9c[_0x457a('0x61')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c['attrs'][0x0][_0x457a('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x457a('0x62'),'value':_0x397b9c[_0x457a('0x62')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x1]?_0x397b9c['attrs'][0x1]['value']:undefined)||_0x457a('0x63')},{'name':_0x457a('0x64'),'value':_0x397b9c[_0x457a('0x64')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x2]?_0x397b9c['attrs'][0x2][_0x457a('0x5d')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x397b9c['attrMetric']||(_0x397b9c['attrs']&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x5d')]:undefined)||'total'},{'name':_0x457a('0x65'),'value':_0x397b9c[_0x457a('0x65')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x1]?_0x397b9c[_0x457a('0x5c')][0x1][_0x457a('0x5d')]:undefined)||[]},{'name':_0x457a('0x64'),'value':_0x397b9c['attrFontSize']||(_0x397b9c['attrs']&&_0x397b9c[_0x457a('0x5c')][0x2]?_0x397b9c[_0x457a('0x5c')][0x2][_0x457a('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x397b9c[_0x457a('0x66')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x3]?_0x397b9c[_0x457a('0x5c')][0x3][_0x457a('0x5d')]:undefined)||'voice'},{'name':_0x457a('0x67'),'value':_0x397b9c['attrEmailAccounts']||(_0x397b9c['attrs']&&_0x397b9c[_0x457a('0x5c')][0x4]?_0x397b9c['attrs'][0x4][_0x457a('0x5d')]:undefined)||''},{'name':_0x457a('0x68'),'value':_0x397b9c['attrFaxAccounts']||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x5]?_0x397b9c[_0x457a('0x5c')][0x5][_0x457a('0x5d')]:undefined)||''},{'name':_0x457a('0x69'),'value':_0x397b9c[_0x457a('0x69')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x6]?_0x397b9c['attrs'][0x6][_0x457a('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x397b9c[_0x457a('0x6a')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x7]?_0x397b9c[_0x457a('0x5c')][0x7][_0x457a('0x5d')]:undefined)||''},{'name':_0x457a('0x6b'),'value':_0x397b9c[_0x457a('0x6b')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x8]?_0x397b9c['attrs'][0x8][_0x457a('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x397b9c['attrChatWebsites']||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x9]?_0x397b9c[_0x457a('0x5c')][0x9][_0x457a('0x5d')]:undefined)||''}];case _0x457a('0x6c'):case'pie-chart':return[{'name':'attrSerie1','value':_0x397b9c[_0x457a('0x6d')]||(_0x397b9c['attrs']&&_0x397b9c['attrs'][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x5d')]:undefined)||'total'},{'name':_0x457a('0x6e'),'value':_0x397b9c[_0x457a('0x6e')]||(_0x397b9c['attrs']&&_0x397b9c['attrs'][0x1]?_0x397b9c[_0x457a('0x5c')][0x1][_0x457a('0x5d')]:undefined)||null},{'name':_0x457a('0x6f'),'value':_0x397b9c[_0x457a('0x6f')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x2]?_0x397b9c[_0x457a('0x5c')][0x2][_0x457a('0x5d')]:undefined)||null},{'name':_0x457a('0x65'),'value':_0x397b9c[_0x457a('0x65')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x3]?_0x397b9c[_0x457a('0x5c')][0x3][_0x457a('0x5d')]:undefined)||[]},{'name':_0x457a('0x66'),'value':_0x397b9c[_0x457a('0x66')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x4]?_0x397b9c[_0x457a('0x5c')][0x4][_0x457a('0x5d')]:undefined)||_0x457a('0x70')},{'name':_0x457a('0x67'),'value':_0x397b9c[_0x457a('0x67')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x5]?_0x397b9c[_0x457a('0x5c')][0x5]['value']:undefined)||''},{'name':_0x457a('0x68'),'value':_0x397b9c[_0x457a('0x68')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x6]?_0x397b9c[_0x457a('0x5c')][0x6]['value']:undefined)||''},{'name':_0x457a('0x69'),'value':_0x397b9c[_0x457a('0x69')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x7]?_0x397b9c[_0x457a('0x5c')][0x7][_0x457a('0x5d')]:undefined)||''},{'name':_0x457a('0x6a'),'value':_0x397b9c[_0x457a('0x6a')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x8]?_0x397b9c[_0x457a('0x5c')][0x8]['value']:undefined)||''},{'name':_0x457a('0x6b'),'value':_0x397b9c[_0x457a('0x6b')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x9]?_0x397b9c[_0x457a('0x5c')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x397b9c[_0x457a('0x71')]||(_0x397b9c['attrs']&&_0x397b9c[_0x457a('0x5c')][0xa]?_0x397b9c[_0x457a('0x5c')][0xa]['value']:undefined)||''}];case _0x457a('0x72'):return[{'name':_0x457a('0x73'),'type':_0x397b9c[_0x457a('0x74')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x36')]:undefined)||null,'value':_0x397b9c[_0x457a('0x73')]||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c[_0x457a('0x5c')][0x0]?_0x397b9c[_0x457a('0x5c')][0x0][_0x457a('0x5d')]:undefined)||null},{'name':_0x457a('0x75'),'value':_0x397b9c['attrRefresh']||(_0x397b9c[_0x457a('0x5c')]&&_0x397b9c['attrs'][0x1]?_0x397b9c[_0x457a('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x12648a){logger['error'](_0x457a('0x76'),JSON[_0x457a('0x77')](_0x12648a));return[];}}exports['addItem']=function(_0x441da1,_0x171592,_0x56f17e){if(_0x441da1[_0x457a('0x55')]['id']){delete _0x441da1['body']['id'];}return db['Dashboard'][_0x457a('0x51')]({'where':{'id':_0x441da1[_0x457a('0x53')]['id']}})[_0x457a('0x28')](handleEntityNotFound(_0x171592,null))['then'](function(_0x5bc928){if(_0x5bc928){_0x441da1[_0x457a('0x55')]['DashboardId']=_0x5bc928['id'];_0x441da1[_0x457a('0x55')]['attrs']=widgetAttributes(_0x441da1[_0x457a('0x55')]);return db[_0x457a('0x78')][_0x457a('0x4d')](_0x441da1[_0x457a('0x55')]);}})[_0x457a('0x28')](respondWithResult(_0x171592,null))['catch'](handleError(_0x171592,null));};exports['getItems']=function(_0x150cd7,_0x37ca8a,_0x3c9451){var _0x5bceac={};var _0x499399={};var _0x2490a4;var _0x49c258;return db['Dashboard'][_0x457a('0x79')]({'where':{'id':_0x150cd7['params']['id']}})[_0x457a('0x28')](handleEntityNotFound(_0x37ca8a,null))[_0x457a('0x28')](function(_0x357f19){if(_0x357f19){_0x2490a4=_0x357f19;_0x499399['model']=_[_0x457a('0x38')](db[_0x457a('0x78')]['rawAttributes']);_0x499399[_0x457a('0x39')]=_['keys'](_0x150cd7[_0x457a('0x39')]);_0x499399[_0x457a('0x41')]=_[_0x457a('0x4c')](_0x499399['model'],_0x499399['query']);_0x5bceac[_0x457a('0x3b')]=_['intersection'](_0x499399['model'],qs[_0x457a('0x3a')](_0x150cd7[_0x457a('0x39')][_0x457a('0x3a')]));_0x5bceac['attributes']=_0x5bceac[_0x457a('0x3b')][_0x457a('0x3c')]?_0x5bceac[_0x457a('0x3b')]:_0x499399[_0x457a('0x37')];_0x5bceac[_0x457a('0x7a')]=qs[_0x457a('0x3f')](_0x150cd7[_0x457a('0x39')][_0x457a('0x3f')]);_0x5bceac[_0x457a('0x40')]=qs[_0x457a('0x41')](_[_0x457a('0x42')](_0x150cd7[_0x457a('0x39')],_0x499399[_0x457a('0x41')]));if(_0x150cd7[_0x457a('0x39')]['filter']){_0x5bceac[_0x457a('0x40')]=_[_0x457a('0x44')](_0x5bceac[_0x457a('0x40')],{'$or':_[_0x457a('0x32')](_0x5bceac[_0x457a('0x3b')],function(_0x2ba7ab){var _0x10c10d={};_0x10c10d[_0x2ba7ab]={'$like':'%'+_0x150cd7[_0x457a('0x39')][_0x457a('0x43')]+'%'};return _0x10c10d;})});}_0x5bceac=_[_0x457a('0x44')]({},_0x5bceac,_0x150cd7[_0x457a('0x46')]);return _0x2490a4['getItems'](_0x5bceac);}})[_0x457a('0x28')](function(_0x56c2d5){if(_0x56c2d5){_0x49c258=_0x56c2d5[_0x457a('0x3c')];if(!_0x150cd7['query'][_0x457a('0x3d')]('nolimit')){_0x5bceac['limit']=qs[_0x457a('0x20')](_0x150cd7[_0x457a('0x39')][_0x457a('0x20')]);_0x5bceac[_0x457a('0x1f')]=qs['offset'](_0x150cd7['query'][_0x457a('0x1f')]);}return _0x2490a4[_0x457a('0x7b')](_0x5bceac);}})[_0x457a('0x28')](function(_0x164b7c){if(_0x164b7c){return _0x164b7c?{'count':_0x49c258,'rows':_0x164b7c}:null;}})[_0x457a('0x28')](respondWithResult(_0x37ca8a,null))[_0x457a('0x4a')](handleError(_0x37ca8a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index eafb174..30d64fb 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 _0x36e2=['hook','events','Dashboard','setMaxListeners','remove','emit'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x36e2,0x1f3));var _0x236e=function(_0x396713,_0x1f449c){_0x396713=_0x396713-0x0;var _0x4d85c8=_0x36e2[_0x396713];return _0x4d85c8;};'use strict';var EventEmitter=require(_0x236e('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x236e('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x236e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x236e('0x3')};function emitEvent(_0x3c5c53){return function(_0x3c385c,_0x268c4a,_0x176dbc){DashboardEvents[_0x236e('0x4')](_0x3c5c53+':'+_0x3c385c['id'],_0x3c385c);DashboardEvents[_0x236e('0x4')](_0x3c5c53,_0x3c385c);_0x176dbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x236e('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x37ca=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x1c3912,_0x4f0f06){var _0x354437=function(_0x357f9d){while(--_0x357f9d){_0x1c3912['push'](_0x1c3912['shift']());}};_0x354437(++_0x4f0f06);}(_0x37ca,0x142));var _0xa37c=function(_0x26b03e,_0xc5f8cc){_0x26b03e=_0x26b03e-0x0;var _0x72034b=_0x37ca[_0x26b03e];return _0x72034b;};'use strict';var EventEmitter=require(_0xa37c('0x0'));var Dashboard=require(_0xa37c('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa37c('0x2')](0x0);var events={'afterCreate':_0xa37c('0x3'),'afterUpdate':_0xa37c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56702d){return function(_0x435dbc,_0x4027b4,_0x4d2a97){DashboardEvents[_0xa37c('0x5')](_0x56702d+':'+_0x435dbc['id'],_0x435dbc);DashboardEvents[_0xa37c('0x5')](_0x56702d,_0x435dbc);_0x4d2a97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa37c('0x6')](e,emitEvent(event));}}module[_0xa37c('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 9a355dc..267b919 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 _0x9931=['api','bluebird','request-promise','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9931,0xb1));var _0x1993=function(_0xdab4c0,_0x37858f){_0xdab4c0=_0xdab4c0-0x0;var _0xdf3ef4=_0x9931[_0xdab4c0];return _0xdf3ef4;};'use strict';var _=require(_0x1993('0x0'));var util=require(_0x1993('0x1'));var logger=require(_0x1993('0x2'))(_0x1993('0x3'));var moment=require('moment');var BPromise=require(_0x1993('0x4'));var rp=require(_0x1993('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1993('0x6'));var attributes=require(_0x1993('0x7'));module[_0x1993('0x8')]=function(_0x286006,_0x5281c2){return _0x286006[_0x1993('0x9')](_0x1993('0xa'),attributes,{'tableName':_0x1993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c50=['path','rimraf','./dashboard.attributes','define','dashboards','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x445024,_0x36dca6){var _0x5ab19a=function(_0x598957){while(--_0x598957){_0x445024['push'](_0x445024['shift']());}};_0x5ab19a(++_0x36dca6);}(_0x8c50,0xcd));var _0x08c5=function(_0x3f5e39,_0x44e335){_0x3f5e39=_0x3f5e39-0x0;var _0x370229=_0x8c50[_0x3f5e39];return _0x370229;};'use strict';var _=require('lodash');var util=require(_0x08c5('0x0'));var logger=require(_0x08c5('0x1'))('api');var moment=require(_0x08c5('0x2'));var BPromise=require(_0x08c5('0x3'));var rp=require(_0x08c5('0x4'));var fs=require('fs');var path=require(_0x08c5('0x5'));var rimraf=require(_0x08c5('0x6'));var config=require('../../config/environment');var attributes=require(_0x08c5('0x7'));module['exports']=function(_0x55e14a,_0xa09f74){return _0x55e14a[_0x08c5('0x8')]('Dashboard',attributes,{'tableName':_0x08c5('0x9'),'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 2380e9e..201453a 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 _0x42bc=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','request\x20sent','error','Dashboard,\x20%s,\x20%s','message','info','result'];(function(_0x44720d,_0x30350b){var _0x58e619=function(_0x279192){while(--_0x279192){_0x44720d['push'](_0x44720d['shift']());}};_0x58e619(++_0x30350b);}(_0x42bc,0xb5));var _0xc42b=function(_0x88249c,_0x24124e){_0x88249c=_0x88249c-0x0;var _0x951993=_0x42bc[_0x88249c];return _0x951993;};'use strict';var _=require(_0xc42b('0x0'));var util=require(_0xc42b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc42b('0x3'));var logger=require(_0xc42b('0x4'))('rpc');var config=require(_0xc42b('0x5'));var jayson=require(_0xc42b('0x6'));var client=jayson['client'][_0xc42b('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc42b('0x8')],{'host':_0xc42b('0x9'),'port':0x18eb});var socket=require(_0xc42b('0xa'))(new Redis(config['redis']));require(_0xc42b('0xb'))['register'](socket);function respondWithRpcPromise(_0x284f81,_0x4c2797,_0x3f492c){return new BPromise(function(_0x1622c4,_0x4343d7){return client[_0xc42b('0xc')](_0x284f81,_0x3f492c)['then'](function(_0x3f8518){logger['info']('Dashboard,\x20%s,\x20%s',_0x4c2797,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x4c2797,_0xc42b('0xd'),JSON['stringify'](_0x3f8518));if(_0x3f8518['error']){if(_0x3f8518[_0xc42b('0xe')]['code']===0x1f4){logger[_0xc42b('0xe')](_0xc42b('0xf'),_0x4c2797,_0x3f8518[_0xc42b('0xe')]['message']);return _0x4343d7(_0x3f8518[_0xc42b('0xe')][_0xc42b('0x10')]);}logger[_0xc42b('0xe')](_0xc42b('0xf'),_0x4c2797,_0x3f8518[_0xc42b('0xe')]['message']);return _0x1622c4(_0x3f8518[_0xc42b('0xe')]['message']);}else{logger[_0xc42b('0x11')](_0xc42b('0xf'),_0x4c2797,'request\x20sent');_0x1622c4(_0x3f8518[_0xc42b('0x12')]['message']);}})[_0xc42b('0x13')](function(_0x4f642e){logger[_0xc42b('0xe')](_0xc42b('0xf'),_0x4c2797,_0x4f642e);_0x4343d7(_0x4f642e);});});} \ No newline at end of file +var _0x2389=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2389,0x98));var _0x9238=function(_0x50f19a,_0xa5fafe){_0x50f19a=_0x50f19a-0x0;var _0xde90b6=_0x2389[_0x50f19a];return _0xde90b6;};'use strict';var _=require(_0x9238('0x0'));var util=require(_0x9238('0x1'));var moment=require(_0x9238('0x2'));var BPromise=require(_0x9238('0x3'));var rs=require(_0x9238('0x4'));var fs=require('fs');var Redis=require(_0x9238('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9238('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9238('0x7'));var client=jayson['client'][_0x9238('0x8')]({'port':0x232a});config[_0x9238('0x9')]=_[_0x9238('0xa')](config[_0x9238('0x9')],{'host':_0x9238('0xb'),'port':0x18eb});var socket=require(_0x9238('0xc'))(new Redis(config[_0x9238('0x9')]));require(_0x9238('0xd'))[_0x9238('0xe')](socket);function respondWithRpcPromise(_0x5d2c58,_0x56b3af,_0x344911){return new BPromise(function(_0x1da76a,_0x438507){return client['request'](_0x5d2c58,_0x344911)[_0x9238('0xf')](function(_0x4e8e23){logger[_0x9238('0x10')]('Dashboard,\x20%s,\x20%s',_0x56b3af,_0x9238('0x11'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x56b3af,'request\x20sent',JSON[_0x9238('0x12')](_0x4e8e23));if(_0x4e8e23[_0x9238('0x13')]){if(_0x4e8e23[_0x9238('0x13')]['code']===0x1f4){logger[_0x9238('0x13')](_0x9238('0x14'),_0x56b3af,_0x4e8e23[_0x9238('0x13')][_0x9238('0x15')]);return _0x438507(_0x4e8e23[_0x9238('0x13')][_0x9238('0x15')]);}logger[_0x9238('0x13')](_0x9238('0x14'),_0x56b3af,_0x4e8e23['error']['message']);return _0x1da76a(_0x4e8e23[_0x9238('0x13')][_0x9238('0x15')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x56b3af,_0x9238('0x11'));_0x1da76a(_0x4e8e23[_0x9238('0x16')][_0x9238('0x15')]);}})['catch'](function(_0x1f692c){logger[_0x9238('0x13')](_0x9238('0x14'),_0x56b3af,_0x1f692c);_0x438507(_0x1f692c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 894a0aa..4990102 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 _0x012a=['length','dashboard:','./dashboard.events','save','remove','emit','register'];(function(_0x11088e,_0x5a5df3){var _0x3d8f41=function(_0x5df772){while(--_0x5df772){_0x11088e['push'](_0x11088e['shift']());}};_0x3d8f41(++_0x5a5df3);}(_0x012a,0xb1));var _0xa012=function(_0x54febe,_0xeb01b){_0x54febe=_0x54febe-0x0;var _0x20f7bc=_0x012a[_0x54febe];return _0x20f7bc;};'use strict';var DashboardEvents=require(_0xa012('0x0'));var events=[_0xa012('0x1'),_0xa012('0x2'),'update'];function createListener(_0x3ef0be,_0x46ad76){return function(_0x5cdadb){_0x46ad76[_0xa012('0x3')](_0x3ef0be,_0x5cdadb);};}function removeListener(_0x5cd0df,_0x40864f){return function(){DashboardEvents['removeListener'](_0x5cd0df,_0x40864f);};}exports[_0xa012('0x4')]=function(_0x274d2c){for(var _0x5e6c40=0x0,_0x2fa9e6=events[_0xa012('0x5')];_0x5e6c40<_0x2fa9e6;_0x5e6c40++){var _0x5a15e5=events[_0x5e6c40];var _0x107e75=createListener(_0xa012('0x6')+_0x5a15e5,_0x274d2c);DashboardEvents['on'](_0x5a15e5,_0x107e75);}}; \ No newline at end of file +var _0xeb14=['remove','update','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb14,0x146));var _0x4eb1=function(_0x1f5c06,_0x21c192){_0x1f5c06=_0x1f5c06-0x0;var _0x11bdcc=_0xeb14[_0x1f5c06];return _0x11bdcc;};'use strict';var DashboardEvents=require(_0x4eb1('0x0'));var events=[_0x4eb1('0x1'),_0x4eb1('0x2'),_0x4eb1('0x3')];function createListener(_0x4e8aef,_0x22bedd){return function(_0x33eb2c){_0x22bedd[_0x4eb1('0x4')](_0x4e8aef,_0x33eb2c);};}function removeListener(_0x284d88,_0x59d851){return function(){DashboardEvents[_0x4eb1('0x5')](_0x284d88,_0x59d851);};}exports[_0x4eb1('0x6')]=function(_0x49fd56){for(var _0x1c465e=0x0,_0x1f4afc=events[_0x4eb1('0x7')];_0x1c465e<_0x1f4afc;_0x1c465e++){var _0x2cb84c=events[_0x1c465e];var _0x5740ee=createListener('dashboard:'+_0x2cb84c,_0x49fd56);DashboardEvents['on'](_0x2cb84c,_0x5740ee);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a4b512f..626c055 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 _0xf908=['update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/items','getItems','create','/:id/clone','clone','post','addItem','put'];(function(_0x5aa23e,_0x2be734){var _0x10ad39=function(_0x358b4e){while(--_0x358b4e){_0x5aa23e['push'](_0x5aa23e['shift']());}};_0x10ad39(++_0x2be734);}(_0xf908,0x1e4));var _0x8f90=function(_0x51eb43,_0x24e966){_0x51eb43=_0x51eb43-0x0;var _0xcf26d4=_0xf908[_0x51eb43];return _0xcf26d4;};'use strict';var multer=require('multer');var util=require(_0x8f90('0x0'));var path=require(_0x8f90('0x1'));var timeout=require(_0x8f90('0x2'));var express=require(_0x8f90('0x3'));var router=express[_0x8f90('0x4')]();var fs_extra=require(_0x8f90('0x5'));var auth=require(_0x8f90('0x6'));var interaction=require(_0x8f90('0x7'));var config=require(_0x8f90('0x8'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x8f90('0x9')](),controller[_0x8f90('0xa')]);router['get']('/:id',auth[_0x8f90('0x9')](),controller['show']);router[_0x8f90('0xb')](_0x8f90('0xc'),auth[_0x8f90('0x9')](),controller[_0x8f90('0xd')]);router['post']('/',auth[_0x8f90('0x9')](),controller[_0x8f90('0xe')]);router['post'](_0x8f90('0xf'),auth['isAuthenticated'](),controller[_0x8f90('0x10')]);router[_0x8f90('0x11')](_0x8f90('0xc'),auth['isAuthenticated'](),controller[_0x8f90('0x12')]);router[_0x8f90('0x13')]('/:id',auth[_0x8f90('0x9')](),controller[_0x8f90('0x14')]);router['delete'](_0x8f90('0x15'),auth[_0x8f90('0x9')](),controller[_0x8f90('0x16')]);module[_0x8f90('0x17')]=router; \ No newline at end of file +var _0xec29=['create','clone','addItem','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post'];(function(_0x35bb2d,_0xd820ec){var _0x2f95ee=function(_0x57e72){while(--_0x57e72){_0x35bb2d['push'](_0x35bb2d['shift']());}};_0x2f95ee(++_0xd820ec);}(_0xec29,0xae));var _0x9ec2=function(_0x559f2a,_0x43bbfa){_0x559f2a=_0x559f2a-0x0;var _0x55314a=_0xec29[_0x559f2a];return _0x55314a;};'use strict';var multer=require('multer');var util=require(_0x9ec2('0x0'));var path=require(_0x9ec2('0x1'));var timeout=require(_0x9ec2('0x2'));var express=require(_0x9ec2('0x3'));var router=express[_0x9ec2('0x4')]();var fs_extra=require(_0x9ec2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ec2('0x6'));var config=require('../../config/environment');var controller=require(_0x9ec2('0x7'));router[_0x9ec2('0x8')]('/',auth[_0x9ec2('0x9')](),controller[_0x9ec2('0xa')]);router[_0x9ec2('0x8')](_0x9ec2('0xb'),auth['isAuthenticated'](),controller[_0x9ec2('0xc')]);router[_0x9ec2('0x8')]('/:id/items',auth[_0x9ec2('0x9')](),controller[_0x9ec2('0xd')]);router[_0x9ec2('0xe')]('/',auth[_0x9ec2('0x9')](),controller[_0x9ec2('0xf')]);router['post']('/:id/clone',auth[_0x9ec2('0x9')](),controller[_0x9ec2('0x10')]);router['post']('/:id/items',auth[_0x9ec2('0x9')](),controller[_0x9ec2('0x11')]);router['put'](_0x9ec2('0xb'),auth[_0x9ec2('0x9')](),controller[_0x9ec2('0x12')]);router[_0x9ec2('0x13')](_0x9ec2('0xb'),auth[_0x9ec2('0x9')](),controller[_0x9ec2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cba6ceb..799b9cd 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 _0x187d=['stringify','INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0x1df965,_0xbca28d){var _0x1e2198=function(_0x3828d7){while(--_0x3828d7){_0x1df965['push'](_0x1df965['shift']());}};_0x1e2198(++_0xbca28d);}(_0x187d,0x93));var _0xd187=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x187d[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0xd187('0x0'));var squel=require('squel');var _=require(_0xd187('0x1'));module[_0xd187('0x2')]={'title':{'type':Sequelize[_0xd187('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd187('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd187('0x4')](_0xd187('0x5')),'get':function(){try{return JSON['parse'](this[_0xd187('0x6')](_0xd187('0x7')));}catch(_0x4ebc8d){return[];}},'set':function(_0x1d2533){try{this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')](_0x1d2533));}catch(_0x28ce2f){this[_0xd187('0x8')](_0xd187('0x7'),JSON[_0xd187('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd187('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd187('0xa')]},'col':{'type':Sequelize[_0xd187('0xa')]},'background':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':_0xd187('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd187('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd187('0x3')]},'titleFontSize':{'type':Sequelize[_0xd187('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4819=['long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x260bf6,_0x2a3139){var _0x2d8274=function(_0x490d02){while(--_0x490d02){_0x260bf6['push'](_0x260bf6['shift']());}};_0x2d8274(++_0x2a3139);}(_0x4819,0xcd));var _0x9481=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0x4819[_0x4a94b1];return _0x20949f;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9481('0x0'));var _=require(_0x9481('0x1'));module[_0x9481('0x2')]={'title':{'type':Sequelize[_0x9481('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x5')),'get':function(){try{return JSON[_0x9481('0x6')](this[_0x9481('0x7')](_0x9481('0x8')));}catch(_0x5ac51c){return[];}},'set':function(_0x4d9e3a){try{this['setDataValue']('attrs',JSON[_0x9481('0x9')](_0x4d9e3a));}catch(_0x6c6a08){this[_0x9481('0xa')](_0x9481('0x8'),JSON[_0x9481('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9481('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9481('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9481('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9481('0x3')],'allowNull':![],'defaultValue':_0x9481('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9481('0x3')]},'titleFontSize':{'type':Sequelize[_0x9481('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 952edb8..aa2d800 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 _0xac6a=['request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','show','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','find','catch','params','type','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac6a,0xc2));var _0xaac6=function(_0xa3cbb0,_0x479e1d){_0xa3cbb0=_0xa3cbb0-0x0;var _0x22ba02=_0xac6a[_0xa3cbb0];return _0x22ba02;};'use strict';var emlformat=require(_0xaac6('0x0'));var rimraf=require(_0xaac6('0x1'));var zipdir=require(_0xaac6('0x2'));var jsonpatch=require(_0xaac6('0x3'));var rp=require(_0xaac6('0x4'));var moment=require('moment');var BPromise=require(_0xaac6('0x5'));var Mustache=require('mustache');var util=require(_0xaac6('0x6'));var path=require(_0xaac6('0x7'));var sox=require(_0xaac6('0x8'));var csv=require(_0xaac6('0x9'));var ejs=require(_0xaac6('0xa'));var fs=require('fs');var fs_extra=require(_0xaac6('0xb'));var _=require(_0xaac6('0xc'));var squel=require(_0xaac6('0xd'));var crypto=require(_0xaac6('0xe'));var jsforce=require(_0xaac6('0xf'));var deskjs=require(_0xaac6('0x10'));var toCsv=require(_0xaac6('0x9'));var querystring=require('querystring');var Papa=require(_0xaac6('0x11'));var Redis=require(_0xaac6('0x12'));var authService=require(_0xaac6('0x13'));var qs=require(_0xaac6('0x14'));var as=require(_0xaac6('0x15'));var hardwareService=require(_0xaac6('0x16'));var logger=require('../../config/logger')(_0xaac6('0x17'));var utils=require(_0xaac6('0x18'));var config=require(_0xaac6('0x19'));var licenseUtil=require(_0xaac6('0x1a'));var db=require(_0xaac6('0x1b'))['db'];config['redis']=_[_0xaac6('0x1c')](config[_0xaac6('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaac6('0x1d')]));require(_0xaac6('0x1e'))[_0xaac6('0x1f')](socket);function respondWithStatusCode(_0x404d82,_0x408bd3){_0x408bd3=_0x408bd3||0xcc;return function(_0x159ec7){if(_0x159ec7){return _0x404d82[_0xaac6('0x20')](_0x408bd3);}return _0x404d82[_0xaac6('0x21')](_0x408bd3)[_0xaac6('0x22')]();};}function respondWithResult(_0x1ceeca,_0x23e8ca){_0x23e8ca=_0x23e8ca||0xc8;return function(_0xfe72e1){if(_0xfe72e1){return _0x1ceeca['status'](_0x23e8ca)['json'](_0xfe72e1);}};}function respondWithFilteredResult(_0x8d0c31,_0x3be109){return function(_0x3cce6f){if(_0x3cce6f){var _0xaf75d=typeof _0x3be109[_0xaac6('0x23')]==='undefined'&&typeof _0x3be109[_0xaac6('0x24')]===_0xaac6('0x25');var _0x26dd96=_0x3cce6f[_0xaac6('0x26')];var _0xab5028=_0xaf75d?0x0:_0x3be109[_0xaac6('0x23')];var _0x450019=_0xaf75d?_0x3cce6f['count']:_0x3be109[_0xaac6('0x23')]+_0x3be109[_0xaac6('0x24')];var _0x276123;if(_0x450019>=_0x26dd96){_0x450019=_0x26dd96;_0x276123=0xc8;}else{_0x276123=0xce;}_0x8d0c31[_0xaac6('0x21')](_0x276123);return _0x8d0c31[_0xaac6('0x27')](_0xaac6('0x28'),_0xab5028+'-'+_0x450019+'/'+_0x26dd96)[_0xaac6('0x29')](_0x3cce6f);}return null;};}function patchUpdates(_0x4f7089){return function(_0x53f259){try{jsonpatch[_0xaac6('0x2a')](_0x53f259,_0x4f7089,!![]);}catch(_0x54592c){return BPromise[_0xaac6('0x2b')](_0x54592c);}return _0x53f259[_0xaac6('0x2c')]();};}function saveUpdates(_0x326238,_0x4892f4){return function(_0x1b0007){if(_0x1b0007){return _0x1b0007['update'](_0x326238)[_0xaac6('0x2d')](function(_0x943dc9){return _0x943dc9;});}return null;};}function removeEntity(_0x21ea41,_0x335300){return function(_0xfee9a9){if(_0xfee9a9){return _0xfee9a9['destroy']()[_0xaac6('0x2d')](function(){_0x21ea41[_0xaac6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a896,_0xd19b){return function(_0x512d93){if(!_0x512d93){_0x50a896[_0xaac6('0x20')](0x194);}return _0x512d93;};}function handleError(_0x41090a,_0x15dfee){_0x15dfee=_0x15dfee||0x1f4;return function(_0x3b63f3){logger[_0xaac6('0x2e')](_0x3b63f3[_0xaac6('0x2f')]);if(_0x3b63f3[_0xaac6('0x30')]){delete _0x3b63f3[_0xaac6('0x30')];}_0x41090a[_0xaac6('0x21')](_0x15dfee)['send'](_0x3b63f3);};}exports[_0xaac6('0x31')]=function(_0x14bd4f,_0x43c46e){var _0x463951={'raw':![],'where':{'id':_0x14bd4f['params']['id']}},_0xf71ad8={};_0xf71ad8['model']=_[_0xaac6('0x32')](db[_0xaac6('0x33')][_0xaac6('0x34')]);_0xf71ad8['query']=_[_0xaac6('0x32')](_0x14bd4f[_0xaac6('0x35')]);_0xf71ad8[_0xaac6('0x36')]=_['intersection'](_0xf71ad8[_0xaac6('0x37')],_0xf71ad8[_0xaac6('0x35')]);_0x463951[_0xaac6('0x38')]=_[_0xaac6('0x39')](_0xf71ad8[_0xaac6('0x37')],qs['fields'](_0x14bd4f[_0xaac6('0x35')][_0xaac6('0x3a')]));_0x463951['attributes']=_0x463951[_0xaac6('0x38')][_0xaac6('0x3b')]?_0x463951['attributes']:_0xf71ad8[_0xaac6('0x37')];if(_0x14bd4f[_0xaac6('0x35')][_0xaac6('0x3c')]){_0x463951[_0xaac6('0x3d')]=[{'all':!![]}];}_0x463951=_[_0xaac6('0x3e')]({},_0x463951,_0x14bd4f['options']);return db[_0xaac6('0x33')][_0xaac6('0x3f')](_0x463951)[_0xaac6('0x2d')](handleEntityNotFound(_0x43c46e,null))[_0xaac6('0x2d')](respondWithResult(_0x43c46e,null))[_0xaac6('0x40')](handleError(_0x43c46e,null));};exports['destroy']=function(_0x5161ad,_0x4ce619){return db['DashboardItem']['find']({'where':{'id':_0x5161ad[_0xaac6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ce619,null))[_0xaac6('0x2d')](removeEntity(_0x4ce619,null))[_0xaac6('0x40')](handleError(_0x4ce619,null));};function widgetAttributes(_0x33ecaa){try{switch(_0x33ecaa[_0xaac6('0x42')]){case _0xaac6('0x43'):return[{'name':_0xaac6('0x44'),'value':_0x33ecaa[_0xaac6('0x44')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0xaac6('0x46'),'value':_0x33ecaa[_0xaac6('0x46')]||(_0x33ecaa['attrs']&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0][_0xaac6('0x47')]:undefined)||''}];case _0xaac6('0x48'):return[{'name':_0xaac6('0x49'),'value':_0x33ecaa['attrHourFormat']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x33ecaa[_0xaac6('0x4a')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x1]?_0x33ecaa[_0xaac6('0x45')][0x1]['value']:undefined)||'0.00'},{'name':_0xaac6('0x4b'),'value':_0x33ecaa[_0xaac6('0x4b')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x2]?_0x33ecaa[_0xaac6('0x45')][0x2][_0xaac6('0x47')]:undefined)||0xc}];case _0xaac6('0x4c'):return[{'name':_0xaac6('0x4d'),'value':_0x33ecaa['attrMetric']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0][_0xaac6('0x47')]:undefined)||_0xaac6('0x4e')},{'name':_0xaac6('0x4f'),'value':_0x33ecaa[_0xaac6('0x4f')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa['attrs'][0x1]?_0x33ecaa[_0xaac6('0x45')][0x1]['value']:undefined)||[]},{'name':_0xaac6('0x4b'),'value':_0x33ecaa[_0xaac6('0x4b')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x2]?_0x33ecaa[_0xaac6('0x45')][0x2]['value']:undefined)||0x14},{'name':_0xaac6('0x50'),'value':_0x33ecaa[_0xaac6('0x50')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x3]?_0x33ecaa[_0xaac6('0x45')][0x3][_0xaac6('0x47')]:undefined)||_0xaac6('0x51')},{'name':_0xaac6('0x52'),'value':_0x33ecaa['attrEmailAccounts']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x4]?_0x33ecaa[_0xaac6('0x45')][0x4]['value']:undefined)||''},{'name':_0xaac6('0x53'),'value':_0x33ecaa[_0xaac6('0x53')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x5]?_0x33ecaa[_0xaac6('0x45')][0x5][_0xaac6('0x47')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x33ecaa[_0xaac6('0x54')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x6]?_0x33ecaa[_0xaac6('0x45')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x33ecaa[_0xaac6('0x55')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa['attrs'][0x7]?_0x33ecaa[_0xaac6('0x45')][0x7][_0xaac6('0x47')]:undefined)||''},{'name':_0xaac6('0x56'),'value':_0x33ecaa[_0xaac6('0x56')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x8]?_0x33ecaa['attrs'][0x8][_0xaac6('0x47')]:undefined)||''},{'name':_0xaac6('0x57'),'value':_0x33ecaa['attrChatWebsites']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x9]?_0x33ecaa['attrs'][0x9]['value']:undefined)||''}];case _0xaac6('0x58'):case _0xaac6('0x59'):return[{'name':'attrSerie1','value':_0x33ecaa[_0xaac6('0x5a')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0][_0xaac6('0x47')]:undefined)||_0xaac6('0x4e')},{'name':'attrSerie2','value':_0x33ecaa[_0xaac6('0x5b')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa['attrs'][0x1]?_0x33ecaa[_0xaac6('0x45')][0x1][_0xaac6('0x47')]:undefined)||null},{'name':_0xaac6('0x5c'),'value':_0x33ecaa[_0xaac6('0x5c')]||(_0x33ecaa['attrs']&&_0x33ecaa['attrs'][0x2]?_0x33ecaa['attrs'][0x2]['value']:undefined)||null},{'name':_0xaac6('0x4f'),'value':_0x33ecaa[_0xaac6('0x4f')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa['attrs'][0x3]?_0x33ecaa[_0xaac6('0x45')][0x3][_0xaac6('0x47')]:undefined)||[]},{'name':_0xaac6('0x50'),'value':_0x33ecaa[_0xaac6('0x50')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa['attrs'][0x4]?_0x33ecaa['attrs'][0x4][_0xaac6('0x47')]:undefined)||_0xaac6('0x51')},{'name':_0xaac6('0x52'),'value':_0x33ecaa['attrEmailAccounts']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x5]?_0x33ecaa[_0xaac6('0x45')][0x5][_0xaac6('0x47')]:undefined)||''},{'name':_0xaac6('0x53'),'value':_0x33ecaa[_0xaac6('0x53')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x6]?_0x33ecaa[_0xaac6('0x45')][0x6]['value']:undefined)||''},{'name':_0xaac6('0x54'),'value':_0x33ecaa[_0xaac6('0x54')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x7]?_0x33ecaa['attrs'][0x7][_0xaac6('0x47')]:undefined)||''},{'name':_0xaac6('0x55'),'value':_0x33ecaa[_0xaac6('0x55')]||(_0x33ecaa['attrs']&&_0x33ecaa[_0xaac6('0x45')][0x8]?_0x33ecaa[_0xaac6('0x45')][0x8][_0xaac6('0x47')]:undefined)||''},{'name':_0xaac6('0x56'),'value':_0x33ecaa[_0xaac6('0x56')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x9]?_0x33ecaa[_0xaac6('0x45')][0x9]['value']:undefined)||''},{'name':_0xaac6('0x57'),'value':_0x33ecaa[_0xaac6('0x57')]||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0xa]?_0x33ecaa[_0xaac6('0x45')][0xa][_0xaac6('0x47')]:undefined)||''}];case _0xaac6('0x5d'):return[{'name':_0xaac6('0x5e'),'type':_0x33ecaa['reportType']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0][_0xaac6('0x42')]:undefined)||null,'value':_0x33ecaa['attrReport']||(_0x33ecaa[_0xaac6('0x45')]&&_0x33ecaa[_0xaac6('0x45')][0x0]?_0x33ecaa[_0xaac6('0x45')][0x0][_0xaac6('0x47')]:undefined)||null},{'name':'attrRefresh','value':_0x33ecaa[_0xaac6('0x5f')]||(_0x33ecaa['attrs']&&_0x33ecaa[_0xaac6('0x45')][0x1]?_0x33ecaa[_0xaac6('0x45')][0x1][_0xaac6('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x257025){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x257025));return[];}}exports['create']=function(_0x510954,_0x1c372b){if(_0x510954['body']){_0x510954['body']['attrs']=widgetAttributes(_0x510954[_0xaac6('0x60')]);}return db[_0xaac6('0x33')][_0xaac6('0x61')](_0x510954['body'],{})[_0xaac6('0x2d')](respondWithResult(_0x1c372b,0xc9))[_0xaac6('0x40')](handleError(_0x1c372b,null));};exports[_0xaac6('0x62')]=function(_0x491d9e,_0x40c564){if(_0x491d9e[_0xaac6('0x60')]['id']){delete _0x491d9e[_0xaac6('0x60')]['id'];}_0x491d9e[_0xaac6('0x60')]['attrs']=widgetAttributes(_0x491d9e[_0xaac6('0x60')]);return db[_0xaac6('0x33')]['find']({'where':{'id':_0x491d9e[_0xaac6('0x41')]['id']}})[_0xaac6('0x2d')](handleEntityNotFound(_0x40c564,null))[_0xaac6('0x2d')](saveUpdates(_0x491d9e[_0xaac6('0x60')],null))[_0xaac6('0x2d')](respondWithResult(_0x40c564,null))[_0xaac6('0x40')](handleError(_0x40c564,null));}; \ No newline at end of file +var _0x1059=['create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','params','model','DashboardItem','rawAttributes','query','attributes','fields','length','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0x295276,_0x13f98a){var _0x14b3dc=function(_0x3a1270){while(--_0x3a1270){_0x295276['push'](_0x295276['shift']());}};_0x14b3dc(++_0x13f98a);}(_0x1059,0x176));var _0x9105=function(_0x1232e7,_0x3808cd){_0x1232e7=_0x1232e7-0x0;var _0x29a410=_0x1059[_0x1232e7];return _0x29a410;};'use strict';var emlformat=require(_0x9105('0x0'));var rimraf=require(_0x9105('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9105('0x2'));var rp=require(_0x9105('0x3'));var moment=require(_0x9105('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9105('0x5'));var util=require('util');var path=require(_0x9105('0x6'));var sox=require(_0x9105('0x7'));var csv=require('to-csv');var ejs=require(_0x9105('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9105('0x9'));var squel=require(_0x9105('0xa'));var crypto=require(_0x9105('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9105('0xc'));var toCsv=require(_0x9105('0xd'));var querystring=require(_0x9105('0xe'));var Papa=require(_0x9105('0xf'));var Redis=require('ioredis');var authService=require(_0x9105('0x10'));var qs=require(_0x9105('0x11'));var as=require(_0x9105('0x12'));var hardwareService=require(_0x9105('0x13'));var logger=require('../../config/logger')(_0x9105('0x14'));var utils=require('../../config/utils');var config=require(_0x9105('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9105('0x16')]=_[_0x9105('0x17')](config[_0x9105('0x16')],{'host':_0x9105('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9105('0x16')]));require('./dashboardItem.socket')[_0x9105('0x19')](socket);function respondWithStatusCode(_0x1aa0d0,_0x3d4790){_0x3d4790=_0x3d4790||0xcc;return function(_0x481152){if(_0x481152){return _0x1aa0d0['sendStatus'](_0x3d4790);}return _0x1aa0d0[_0x9105('0x1a')](_0x3d4790)[_0x9105('0x1b')]();};}function respondWithResult(_0x3933d5,_0x40d98){_0x40d98=_0x40d98||0xc8;return function(_0x1a01dd){if(_0x1a01dd){return _0x3933d5[_0x9105('0x1a')](_0x40d98)[_0x9105('0x1c')](_0x1a01dd);}};}function respondWithFilteredResult(_0x13d241,_0xb093b0){return function(_0x3d44d4){if(_0x3d44d4){var _0x17e769=typeof _0xb093b0[_0x9105('0x1d')]==='undefined'&&typeof _0xb093b0['limit']===_0x9105('0x1e');var _0x825941=_0x3d44d4[_0x9105('0x1f')];var _0x6eafc8=_0x17e769?0x0:_0xb093b0['offset'];var _0x395454=_0x17e769?_0x3d44d4[_0x9105('0x1f')]:_0xb093b0['offset']+_0xb093b0[_0x9105('0x20')];var _0x2810f5;if(_0x395454>=_0x825941){_0x395454=_0x825941;_0x2810f5=0xc8;}else{_0x2810f5=0xce;}_0x13d241[_0x9105('0x1a')](_0x2810f5);return _0x13d241[_0x9105('0x21')](_0x9105('0x22'),_0x6eafc8+'-'+_0x395454+'/'+_0x825941)[_0x9105('0x1c')](_0x3d44d4);}return null;};}function patchUpdates(_0x47a77e){return function(_0x318aaa){try{jsonpatch[_0x9105('0x23')](_0x318aaa,_0x47a77e,!![]);}catch(_0x2e6988){return BPromise[_0x9105('0x24')](_0x2e6988);}return _0x318aaa[_0x9105('0x25')]();};}function saveUpdates(_0x432025,_0xbbad86){return function(_0x44a3d8){if(_0x44a3d8){return _0x44a3d8[_0x9105('0x26')](_0x432025)[_0x9105('0x27')](function(_0x2d83e2){return _0x2d83e2;});}return null;};}function removeEntity(_0x59f4c3,_0x3a66f1){return function(_0x474069){if(_0x474069){return _0x474069[_0x9105('0x28')]()[_0x9105('0x27')](function(){_0x59f4c3[_0x9105('0x1a')](0xcc)[_0x9105('0x1b')]();});}};}function handleEntityNotFound(_0x5d7db1,_0x3cc40f){return function(_0x1340ba){if(!_0x1340ba){_0x5d7db1[_0x9105('0x29')](0x194);}return _0x1340ba;};}function handleError(_0x4dc3be,_0x3ce577){_0x3ce577=_0x3ce577||0x1f4;return function(_0x148045){logger[_0x9105('0x2a')](_0x148045['stack']);if(_0x148045[_0x9105('0x2b')]){delete _0x148045[_0x9105('0x2b')];}_0x4dc3be[_0x9105('0x1a')](_0x3ce577)['send'](_0x148045);};}exports['show']=function(_0x13fe5d,_0x1a282f){var _0x271501={'raw':![],'where':{'id':_0x13fe5d[_0x9105('0x2c')]['id']}},_0x4a070b={};_0x4a070b[_0x9105('0x2d')]=_['keys'](db[_0x9105('0x2e')][_0x9105('0x2f')]);_0x4a070b[_0x9105('0x30')]=_['keys'](_0x13fe5d['query']);_0x4a070b['filters']=_['intersection'](_0x4a070b[_0x9105('0x2d')],_0x4a070b['query']);_0x271501[_0x9105('0x31')]=_['intersection'](_0x4a070b[_0x9105('0x2d')],qs[_0x9105('0x32')](_0x13fe5d[_0x9105('0x30')][_0x9105('0x32')]));_0x271501[_0x9105('0x31')]=_0x271501['attributes'][_0x9105('0x33')]?_0x271501[_0x9105('0x31')]:_0x4a070b[_0x9105('0x2d')];if(_0x13fe5d[_0x9105('0x30')]['includeAll']){_0x271501[_0x9105('0x34')]=[{'all':!![]}];}_0x271501=_[_0x9105('0x35')]({},_0x271501,_0x13fe5d[_0x9105('0x36')]);return db[_0x9105('0x2e')]['find'](_0x271501)[_0x9105('0x27')](handleEntityNotFound(_0x1a282f,null))[_0x9105('0x27')](respondWithResult(_0x1a282f,null))[_0x9105('0x37')](handleError(_0x1a282f,null));};exports[_0x9105('0x28')]=function(_0x1e65da,_0x3c5dbb){return db[_0x9105('0x2e')][_0x9105('0x38')]({'where':{'id':_0x1e65da['params']['id']}})[_0x9105('0x27')](handleEntityNotFound(_0x3c5dbb,null))[_0x9105('0x27')](removeEntity(_0x3c5dbb,null))[_0x9105('0x37')](handleError(_0x3c5dbb,null));};function widgetAttributes(_0x55c334){try{switch(_0x55c334[_0x9105('0x39')]){case _0x9105('0x3a'):return[{'name':_0x9105('0x3b'),'value':_0x55c334[_0x9105('0x3b')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334['attrs'][0x0][_0x9105('0x3d')]:undefined)||_0x9105('0x3e')}];case _0x9105('0x3f'):return[{'name':_0x9105('0x40'),'value':_0x55c334['attrPath']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334['attrs'][0x0][_0x9105('0x3d')]:undefined)||''}];case _0x9105('0x41'):return[{'name':_0x9105('0x42'),'value':_0x55c334[_0x9105('0x42')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334[_0x9105('0x3c')][0x0][_0x9105('0x3d')]:undefined)||'HH:mm:ss'},{'name':_0x9105('0x43'),'value':_0x55c334[_0x9105('0x43')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x1]?_0x55c334['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0x9105('0x44'),'value':_0x55c334['attrFontSize']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x2]?_0x55c334[_0x9105('0x3c')][0x2]['value']:undefined)||0xc}];case _0x9105('0x45'):return[{'name':_0x9105('0x46'),'value':_0x55c334[_0x9105('0x46')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334[_0x9105('0x3c')][0x0][_0x9105('0x3d')]:undefined)||_0x9105('0x47')},{'name':_0x9105('0x48'),'value':_0x55c334[_0x9105('0x48')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x1]?_0x55c334['attrs'][0x1][_0x9105('0x3d')]:undefined)||[]},{'name':_0x9105('0x44'),'value':_0x55c334[_0x9105('0x44')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x2]?_0x55c334['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x9105('0x49'),'value':_0x55c334[_0x9105('0x49')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x3]?_0x55c334[_0x9105('0x3c')][0x3]['value']:undefined)||'voice'},{'name':_0x9105('0x4a'),'value':_0x55c334[_0x9105('0x4a')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x4]?_0x55c334[_0x9105('0x3c')][0x4][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4b'),'value':_0x55c334[_0x9105('0x4b')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x5]?_0x55c334[_0x9105('0x3c')][0x5][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4c'),'value':_0x55c334['attrSmsAccounts']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334['attrs'][0x6]?_0x55c334[_0x9105('0x3c')][0x6]['value']:undefined)||''},{'name':_0x9105('0x4d'),'value':_0x55c334[_0x9105('0x4d')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334['attrs'][0x7]?_0x55c334[_0x9105('0x3c')][0x7][_0x9105('0x3d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55c334[_0x9105('0x4e')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x8]?_0x55c334[_0x9105('0x3c')][0x8][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4f'),'value':_0x55c334['attrChatWebsites']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x9]?_0x55c334[_0x9105('0x3c')][0x9][_0x9105('0x3d')]:undefined)||''}];case _0x9105('0x50'):case _0x9105('0x51'):return[{'name':'attrSerie1','value':_0x55c334[_0x9105('0x52')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334['attrs'][0x0][_0x9105('0x3d')]:undefined)||'total'},{'name':_0x9105('0x53'),'value':_0x55c334['attrSerie2']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x1]?_0x55c334[_0x9105('0x3c')][0x1][_0x9105('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x55c334[_0x9105('0x54')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x2]?_0x55c334['attrs'][0x2][_0x9105('0x3d')]:undefined)||null},{'name':_0x9105('0x48'),'value':_0x55c334['attrVoiceQueues']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x3]?_0x55c334[_0x9105('0x3c')][0x3]['value']:undefined)||[]},{'name':_0x9105('0x49'),'value':_0x55c334[_0x9105('0x49')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x4]?_0x55c334[_0x9105('0x3c')][0x4][_0x9105('0x3d')]:undefined)||_0x9105('0x55')},{'name':'attrEmailAccounts','value':_0x55c334[_0x9105('0x4a')]||(_0x55c334['attrs']&&_0x55c334[_0x9105('0x3c')][0x5]?_0x55c334[_0x9105('0x3c')][0x5][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4b'),'value':_0x55c334[_0x9105('0x4b')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334['attrs'][0x6]?_0x55c334[_0x9105('0x3c')][0x6][_0x9105('0x3d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x55c334[_0x9105('0x4c')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x7]?_0x55c334[_0x9105('0x3c')][0x7][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4d'),'value':_0x55c334[_0x9105('0x4d')]||(_0x55c334['attrs']&&_0x55c334[_0x9105('0x3c')][0x8]?_0x55c334['attrs'][0x8][_0x9105('0x3d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55c334[_0x9105('0x4e')]||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x9]?_0x55c334[_0x9105('0x3c')][0x9][_0x9105('0x3d')]:undefined)||''},{'name':_0x9105('0x4f'),'value':_0x55c334['attrChatWebsites']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0xa]?_0x55c334[_0x9105('0x3c')][0xa][_0x9105('0x3d')]:undefined)||''}];case _0x9105('0x56'):return[{'name':'attrReport','type':_0x55c334[_0x9105('0x57')]||(_0x55c334['attrs']&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334['attrs'][0x0]['type']:undefined)||null,'value':_0x55c334['attrReport']||(_0x55c334['attrs']&&_0x55c334[_0x9105('0x3c')][0x0]?_0x55c334[_0x9105('0x3c')][0x0][_0x9105('0x3d')]:undefined)||null},{'name':_0x9105('0x58'),'value':_0x55c334['attrRefresh']||(_0x55c334[_0x9105('0x3c')]&&_0x55c334[_0x9105('0x3c')][0x1]?_0x55c334[_0x9105('0x3c')][0x1][_0x9105('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x2fed36){logger[_0x9105('0x2a')](_0x9105('0x59'),JSON[_0x9105('0x5a')](_0x2fed36));return[];}}exports[_0x9105('0x5b')]=function(_0x451e1f,_0x49b0a6){if(_0x451e1f[_0x9105('0x5c')]){_0x451e1f[_0x9105('0x5c')][_0x9105('0x3c')]=widgetAttributes(_0x451e1f[_0x9105('0x5c')]);}return db[_0x9105('0x2e')]['create'](_0x451e1f[_0x9105('0x5c')],{})[_0x9105('0x27')](respondWithResult(_0x49b0a6,0xc9))['catch'](handleError(_0x49b0a6,null));};exports[_0x9105('0x26')]=function(_0x374fa5,_0x333edd){if(_0x374fa5['body']['id']){delete _0x374fa5[_0x9105('0x5c')]['id'];}_0x374fa5[_0x9105('0x5c')][_0x9105('0x3c')]=widgetAttributes(_0x374fa5['body']);return db[_0x9105('0x2e')][_0x9105('0x38')]({'where':{'id':_0x374fa5[_0x9105('0x2c')]['id']}})['then'](handleEntityNotFound(_0x333edd,null))['then'](saveUpdates(_0x374fa5[_0x9105('0x5c')],null))['then'](respondWithResult(_0x333edd,null))[_0x9105('0x37')](handleError(_0x333edd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index aa9ed71..45e70d0 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 _0x1b7b=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b7b,0x104));var _0xb1b7=function(_0x50a6c7,_0x28fdba){_0x50a6c7=_0x50a6c7-0x0;var _0x5cedb7=_0x1b7b[_0x50a6c7];return _0x5cedb7;};'use strict';var EventEmitter=require(_0xb1b7('0x0'));var DashboardItem=require(_0xb1b7('0x1'))['db'][_0xb1b7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb1b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb1b7('0x4'),'afterDestroy':_0xb1b7('0x5')};function emitEvent(_0x42c59f){return function(_0x3ce3a8,_0x460875,_0x48c931){DashboardItemEvents[_0xb1b7('0x6')](_0x42c59f+':'+_0x3ce3a8['id'],_0x3ce3a8);DashboardItemEvents['emit'](_0x42c59f,_0x3ce3a8);_0x48c931(null);};}for(var e in events){if(events[_0xb1b7('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xb1b7('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xb4d6=['DashboardItem','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x9f721,_0x14bcc5){var _0x20052d=function(_0xba8047){while(--_0xba8047){_0x9f721['push'](_0x9f721['shift']());}};_0x20052d(++_0x14bcc5);}(_0xb4d6,0x1b6));var _0x6b4d=function(_0x455eda,_0x5ba3e4){_0x455eda=_0x455eda-0x0;var _0x30284b=_0xb4d6[_0x455eda];return _0x30284b;};'use strict';var EventEmitter=require(_0x6b4d('0x0'));var DashboardItem=require(_0x6b4d('0x1'))['db'][_0x6b4d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b4d('0x3'),'afterUpdate':_0x6b4d('0x4'),'afterDestroy':_0x6b4d('0x5')};function emitEvent(_0x41adff){return function(_0x10265a,_0x3a7ce4,_0x55f403){DashboardItemEvents[_0x6b4d('0x6')](_0x41adff+':'+_0x10265a['id'],_0x10265a);DashboardItemEvents[_0x6b4d('0x6')](_0x41adff,_0x10265a);_0x55f403(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x6b4d('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 16e3619..ec57032 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 _0xbcbe=['rimraf','../../config/environment','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e9e00,_0x428aef){var _0xc3fd8d=function(_0x41de6d){while(--_0x41de6d){_0x3e9e00['push'](_0x3e9e00['shift']());}};_0xc3fd8d(++_0x428aef);}(_0xbcbe,0x1bd));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var logger=require(_0xebcb('0x2'))(_0xebcb('0x3'));var moment=require(_0xebcb('0x4'));var BPromise=require(_0xebcb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xebcb('0x6'));var config=require(_0xebcb('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x11948f,_0x12d0d1){return _0x11948f[_0xebcb('0x8')](_0xebcb('0x9'),attributes,{'tableName':_0xebcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03cf=['util','../../config/logger','bluebird','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x03cf,0x64));var _0xf03c=function(_0x34fe9a,_0x32cfc2){_0x34fe9a=_0x34fe9a-0x0;var _0x3f9504=_0x03cf[_0x34fe9a];return _0x3f9504;};'use strict';var _=require('lodash');var util=require(_0xf03c('0x0'));var logger=require(_0xf03c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf03c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf03c('0x3'));var rimraf=require('rimraf');var config=require(_0xf03c('0x4'));var attributes=require(_0xf03c('0x5'));module[_0xf03c('0x6')]=function(_0x4c2af5,_0x11841d){return _0x4c2af5[_0xf03c('0x7')](_0xf03c('0x8'),attributes,{'tableName':_0xf03c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 08c5dde..dbd3143 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 _0x1cc1=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5420cd,_0x14cfac){var _0x49ced8=function(_0x5e42a9){while(--_0x5e42a9){_0x5420cd['push'](_0x5420cd['shift']());}};_0x49ced8(++_0x14cfac);}(_0x1cc1,0x1e5));var _0x11cc=function(_0x3faf68,_0xeb3111){_0x3faf68=_0x3faf68-0x0;var _0x282527=_0x1cc1[_0x3faf68];return _0x282527;};'use strict';var _=require(_0x11cc('0x0'));var util=require(_0x11cc('0x1'));var moment=require(_0x11cc('0x2'));var BPromise=require(_0x11cc('0x3'));var rs=require(_0x11cc('0x4'));var fs=require('fs');var Redis=require(_0x11cc('0x5'));var db=require(_0x11cc('0x6'))['db'];var utils=require(_0x11cc('0x7'));var logger=require(_0x11cc('0x8'))(_0x11cc('0x9'));var config=require(_0x11cc('0xa'));var jayson=require(_0x11cc('0xb'));var client=jayson[_0x11cc('0xc')][_0x11cc('0xd')]({'port':0x232a});config[_0x11cc('0xe')]=_[_0x11cc('0xf')](config[_0x11cc('0xe')],{'host':_0x11cc('0x10'),'port':0x18eb});var socket=require(_0x11cc('0x11'))(new Redis(config[_0x11cc('0xe')]));require('./dashboardItem.socket')[_0x11cc('0x12')](socket);function respondWithRpcPromise(_0x56de04,_0xa7f4d3,_0x2f47ab){return new BPromise(function(_0x56bdcb,_0x350cc1){return client[_0x11cc('0x13')](_0x56de04,_0x2f47ab)[_0x11cc('0x14')](function(_0x682b7b){logger[_0x11cc('0x15')]('DashboardItem,\x20%s,\x20%s',_0xa7f4d3,_0x11cc('0x16'));logger[_0x11cc('0x17')](_0x11cc('0x18'),_0xa7f4d3,'request\x20sent',JSON[_0x11cc('0x19')](_0x682b7b));if(_0x682b7b[_0x11cc('0x1a')]){if(_0x682b7b[_0x11cc('0x1a')][_0x11cc('0x1b')]===0x1f4){logger['error'](_0x11cc('0x1c'),_0xa7f4d3,_0x682b7b['error'][_0x11cc('0x1d')]);return _0x350cc1(_0x682b7b[_0x11cc('0x1a')][_0x11cc('0x1d')]);}logger[_0x11cc('0x1a')](_0x11cc('0x1c'),_0xa7f4d3,_0x682b7b[_0x11cc('0x1a')]['message']);return _0x56bdcb(_0x682b7b[_0x11cc('0x1a')][_0x11cc('0x1d')]);}else{logger['info'](_0x11cc('0x1c'),_0xa7f4d3,'request\x20sent');_0x56bdcb(_0x682b7b['result']['message']);}})[_0x11cc('0x1e')](function(_0x2fb0c8){logger[_0x11cc('0x1a')](_0x11cc('0x1c'),_0xa7f4d3,_0x2fb0c8);_0x350cc1(_0x2fb0c8);});});} \ No newline at end of file +var _0xe849=['code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','error'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xe849,0x1c6));var _0x9e84=function(_0x202949,_0x478512){_0x202949=_0x202949-0x0;var _0x35a125=_0xe849[_0x202949];return _0x35a125;};'use strict';var _=require(_0x9e84('0x0'));var util=require(_0x9e84('0x1'));var moment=require(_0x9e84('0x2'));var BPromise=require(_0x9e84('0x3'));var rs=require(_0x9e84('0x4'));var fs=require('fs');var Redis=require(_0x9e84('0x5'));var db=require(_0x9e84('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e84('0x7'));var config=require(_0x9e84('0x8'));var jayson=require(_0x9e84('0x9'));var client=jayson[_0x9e84('0xa')][_0x9e84('0xb')]({'port':0x232a});config[_0x9e84('0xc')]=_['defaults'](config[_0x9e84('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e84('0xd'))(new Redis(config[_0x9e84('0xc')]));require(_0x9e84('0xe'))[_0x9e84('0xf')](socket);function respondWithRpcPromise(_0x22332e,_0x26361e,_0x553a1f){return new BPromise(function(_0x155c6b,_0x266f6b){return client[_0x9e84('0x10')](_0x22332e,_0x553a1f)[_0x9e84('0x11')](function(_0x542af8){logger[_0x9e84('0x12')](_0x9e84('0x13'),_0x26361e,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x26361e,'request\x20sent',JSON['stringify'](_0x542af8));if(_0x542af8[_0x9e84('0x14')]){if(_0x542af8['error'][_0x9e84('0x15')]===0x1f4){logger['error'](_0x9e84('0x13'),_0x26361e,_0x542af8[_0x9e84('0x14')]['message']);return _0x266f6b(_0x542af8['error'][_0x9e84('0x16')]);}logger['error'](_0x9e84('0x13'),_0x26361e,_0x542af8[_0x9e84('0x14')][_0x9e84('0x16')]);return _0x155c6b(_0x542af8[_0x9e84('0x14')]['message']);}else{logger['info'](_0x9e84('0x13'),_0x26361e,_0x9e84('0x17'));_0x155c6b(_0x542af8[_0x9e84('0x18')]['message']);}})['catch'](function(_0x7fa09e){logger[_0x9e84('0x14')](_0x9e84('0x13'),_0x26361e,_0x7fa09e);_0x266f6b(_0x7fa09e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5044f6e..6962351 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 _0x50a6=['length','save','remove','update','emit','removeListener','register'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x50a6,0xcc));var _0x650a=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x50a6[_0x279e6f];return _0x489a5f;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x650a('0x0'),_0x650a('0x1'),_0x650a('0x2')];function createListener(_0x5ed506,_0xfc99b7){return function(_0x349995){_0xfc99b7[_0x650a('0x3')](_0x5ed506,_0x349995);};}function removeListener(_0xe376c,_0x5cabeb){return function(){DashboardItemEvents[_0x650a('0x4')](_0xe376c,_0x5cabeb);};}exports[_0x650a('0x5')]=function(_0x45973e){for(var _0x4c77b7=0x0,_0x51cb73=events[_0x650a('0x6')];_0x4c77b7<_0x51cb73;_0x4c77b7++){var _0x34187c=events[_0x4c77b7];var _0x3e799e=createListener('dashboardItem:'+_0x34187c,_0x45973e);DashboardItemEvents['on'](_0x34187c,_0x3e799e);}}; \ No newline at end of file +var _0x8ef7=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8ef7,0x84));var _0x78ef=function(_0xe78add,_0x237047){_0xe78add=_0xe78add-0x0;var _0x41bf85=_0x8ef7[_0xe78add];return _0x41bf85;};'use strict';var DashboardItemEvents=require(_0x78ef('0x0'));var events=['save',_0x78ef('0x1'),'update'];function createListener(_0x48119a,_0x38d1a8){return function(_0x1870e8){_0x38d1a8[_0x78ef('0x2')](_0x48119a,_0x1870e8);};}function removeListener(_0x352deb,_0x3b9f54){return function(){DashboardItemEvents[_0x78ef('0x3')](_0x352deb,_0x3b9f54);};}exports[_0x78ef('0x4')]=function(_0x1302bb){for(var _0x4a3fa4=0x0,_0x553218=events[_0x78ef('0x5')];_0x4a3fa4<_0x553218;_0x4a3fa4++){var _0x5794b9=events[_0x4a3fa4];var _0x32e8b9=createListener(_0x78ef('0x6')+_0x5794b9,_0x1302bb);DashboardItemEvents['on'](_0x5794b9,_0x32e8b9);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b3ecf39..348528d 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 _0x2a02=['get','/:id','isAuthenticated','post','create','put','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2a02,0x1b9));var _0x22a0=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0x2a02[_0x4a04de];return _0xbbe018;};'use strict';var multer=require(_0x22a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x22a0('0x1'));var express=require(_0x22a0('0x2'));var router=express['Router']();var fs_extra=require(_0x22a0('0x3'));var auth=require(_0x22a0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x22a0('0x5'));var controller=require(_0x22a0('0x6'));router[_0x22a0('0x7')](_0x22a0('0x8'),auth[_0x22a0('0x9')](),controller['show']);router[_0x22a0('0xa')]('/',auth['isAuthenticated'](),controller[_0x22a0('0xb')]);router[_0x22a0('0xc')](_0x22a0('0x8'),auth[_0x22a0('0x9')](),controller['update']);router[_0x22a0('0xd')](_0x22a0('0x8'),auth[_0x22a0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x23c7=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated','create','update','exports','multer','util','path'];(function(_0x5034cb,_0x322be8){var _0x44c8e2=function(_0xd9946e){while(--_0xd9946e){_0x5034cb['push'](_0x5034cb['shift']());}};_0x44c8e2(++_0x322be8);}(_0x23c7,0x11d));var _0x723c=function(_0x26ba21,_0x96fdd2){_0x26ba21=_0x26ba21-0x0;var _0x2ca744=_0x23c7[_0x26ba21];return _0x2ca744;};'use strict';var multer=require(_0x723c('0x0'));var util=require(_0x723c('0x1'));var path=require(_0x723c('0x2'));var timeout=require(_0x723c('0x3'));var express=require('express');var router=express[_0x723c('0x4')]();var fs_extra=require(_0x723c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x723c('0x6'));var config=require(_0x723c('0x7'));var controller=require(_0x723c('0x8'));router['get'](_0x723c('0x9'),auth['isAuthenticated'](),controller[_0x723c('0xa')]);router[_0x723c('0xb')]('/',auth[_0x723c('0xc')](),controller[_0x723c('0xd')]);router['put'](_0x723c('0x9'),auth[_0x723c('0xc')](),controller[_0x723c('0xe')]);router['delete']('/:id',auth[_0x723c('0xc')](),controller['destroy']);module[_0x723c('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 88c736a..3c5b4fe 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 _0x84da=['second','third','STRING','ENUM','first'];(function(_0x42b89e,_0x2ae4e9){var _0x43da07=function(_0x1ab415){while(--_0x1ab415){_0x42b89e['push'](_0x42b89e['shift']());}};_0x43da07(++_0x2ae4e9);}(_0x84da,0x93));var _0xa84d=function(_0x597c86,_0x1783b7){_0x597c86=_0x597c86-0x0;var _0x204f8b=_0x84da[_0x597c86];return _0x204f8b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa84d('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xa84d('0x1')](_0xa84d('0x2'),_0xa84d('0x3'),_0xa84d('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xa84d('0x0')]}}; \ No newline at end of file +var _0x8d27=['first','exports','STRING','ENUM','third'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d27,0x13c));var _0x78d2=function(_0x376f8d,_0x1156be){_0x376f8d=_0x376f8d-0x0;var _0x248c1c=_0x8d27[_0x376f8d];return _0x248c1c;};'use strict';var Sequelize=require('sequelize');module[_0x78d2('0x0')]={'name':{'type':Sequelize[_0x78d2('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x78d2('0x2')]('first','second',_0x78d2('0x3')),'allowNull':![],'defaultValue':_0x78d2('0x4')},'description':{'type':Sequelize[_0x78d2('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 661d3cd..71405c7 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 _0x3759=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','undefined','limit','offset','count','status','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','send','map','fieldName','type','key','keys','query','attributes','intersection','fields','model','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','Disposition','findAll','rows','catch','show','length','find','create','body','user','role','Dispositions','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3759,0x131));var _0x9375=function(_0x2b9de5,_0x151ddd){_0x2b9de5=_0x2b9de5-0x0;var _0x357eea=_0x3759[_0x2b9de5];return _0x357eea;};'use strict';var emlformat=require(_0x9375('0x0'));var rimraf=require(_0x9375('0x1'));var zipdir=require(_0x9375('0x2'));var jsonpatch=require(_0x9375('0x3'));var rp=require(_0x9375('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9375('0x5'));var util=require(_0x9375('0x6'));var path=require('path');var sox=require(_0x9375('0x7'));var csv=require(_0x9375('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9375('0x9'));var _=require(_0x9375('0xa'));var squel=require(_0x9375('0xb'));var crypto=require(_0x9375('0xc'));var jsforce=require(_0x9375('0xd'));var deskjs=require(_0x9375('0xe'));var toCsv=require(_0x9375('0x8'));var querystring=require(_0x9375('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9375('0x10'));var as=require(_0x9375('0x11'));var hardwareService=require(_0x9375('0x12'));var logger=require('../../config/logger')(_0x9375('0x13'));var utils=require(_0x9375('0x14'));var config=require(_0x9375('0x15'));var licenseUtil=require(_0x9375('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21d0c4,_0x1344ff){_0x1344ff=_0x1344ff||0xcc;return function(_0x339b77){if(_0x339b77){return _0x21d0c4[_0x9375('0x17')](_0x1344ff);}return _0x21d0c4['status'](_0x1344ff)['end']();};}function respondWithResult(_0x49b871,_0x3dd87c){_0x3dd87c=_0x3dd87c||0xc8;return function(_0x49ea92){if(_0x49ea92){return _0x49b871['status'](_0x3dd87c)[_0x9375('0x18')](_0x49ea92);}};}function respondWithFilteredResult(_0x4402a5,_0x1e58e4){return function(_0x58c8ea){if(_0x58c8ea){var _0x468a36=typeof _0x1e58e4['offset']===_0x9375('0x19')&&typeof _0x1e58e4[_0x9375('0x1a')]==='undefined';var _0x22d180=_0x58c8ea['count'];var _0x5e915d=_0x468a36?0x0:_0x1e58e4[_0x9375('0x1b')];var _0x23fc9c=_0x468a36?_0x58c8ea[_0x9375('0x1c')]:_0x1e58e4[_0x9375('0x1b')]+_0x1e58e4['limit'];var _0x18d80c;if(_0x23fc9c>=_0x22d180){_0x23fc9c=_0x22d180;_0x18d80c=0xc8;}else{_0x18d80c=0xce;}_0x4402a5[_0x9375('0x1d')](_0x18d80c);return _0x4402a5['set'](_0x9375('0x1e'),_0x5e915d+'-'+_0x23fc9c+'/'+_0x22d180)[_0x9375('0x18')](_0x58c8ea);}return null;};}function patchUpdates(_0x36c98f){return function(_0x10a61e){try{jsonpatch['apply'](_0x10a61e,_0x36c98f,!![]);}catch(_0x298a8b){return BPromise[_0x9375('0x1f')](_0x298a8b);}return _0x10a61e[_0x9375('0x20')]();};}function saveUpdates(_0x308a8c,_0x2b77e4){return function(_0x1adab1){if(_0x1adab1){return _0x1adab1[_0x9375('0x21')](_0x308a8c)['then'](function(_0x4ccc28){return _0x4ccc28;});}return null;};}function removeEntity(_0x273091,_0x1c36b0){return function(_0x2d948d){if(_0x2d948d){return _0x2d948d[_0x9375('0x22')]()[_0x9375('0x23')](function(){var _0x454b5d=_0x2d948d[_0x9375('0x24')]({'plain':!![]});var _0x4985d2='Dispositions';return db[_0x9375('0x25')][_0x9375('0x22')]({'where':{'type':_0x4985d2,'resourceId':_0x454b5d['id']}})[_0x9375('0x23')](function(){return _0x2d948d;});})['then'](function(){_0x273091['status'](0xcc)[_0x9375('0x26')]();});}};}function handleEntityNotFound(_0x5ad63a,_0x1925d4){return function(_0x4d0432){if(!_0x4d0432){_0x5ad63a[_0x9375('0x17')](0x194);}return _0x4d0432;};}function handleError(_0x136f24,_0x5e640d){_0x5e640d=_0x5e640d||0x1f4;return function(_0x872be7){logger[_0x9375('0x27')](_0x872be7['stack']);if(_0x872be7[_0x9375('0x28')]){delete _0x872be7[_0x9375('0x28')];}_0x136f24[_0x9375('0x1d')](_0x5e640d)[_0x9375('0x29')](_0x872be7);};}exports['index']=function(_0x56dae5,_0x1fea2f){var _0x196499={},_0x363ce3={},_0x515fdb={'count':0x0,'rows':[]};var _0x149b57=_[_0x9375('0x2a')](db['Disposition']['rawAttributes'],function(_0x4651db){return{'name':_0x4651db[_0x9375('0x2b')],'type':_0x4651db[_0x9375('0x2c')][_0x9375('0x2d')]};});_0x363ce3['model']=_[_0x9375('0x2a')](_0x149b57,_0x9375('0x28'));_0x363ce3['query']=_[_0x9375('0x2e')](_0x56dae5['query']);_0x363ce3['filters']=_['intersection'](_0x363ce3['model'],_0x363ce3[_0x9375('0x2f')]);_0x196499[_0x9375('0x30')]=_[_0x9375('0x31')](_0x363ce3['model'],qs[_0x9375('0x32')](_0x56dae5[_0x9375('0x2f')][_0x9375('0x32')]));_0x196499[_0x9375('0x30')]=_0x196499[_0x9375('0x30')]['length']?_0x196499[_0x9375('0x30')]:_0x363ce3[_0x9375('0x33')];if(!_0x56dae5[_0x9375('0x2f')][_0x9375('0x34')]('nolimit')){_0x196499[_0x9375('0x1a')]=qs[_0x9375('0x1a')](_0x56dae5['query'][_0x9375('0x1a')]);_0x196499[_0x9375('0x1b')]=qs[_0x9375('0x1b')](_0x56dae5['query'][_0x9375('0x1b')]);}_0x196499[_0x9375('0x35')]=qs[_0x9375('0x36')](_0x56dae5['query']['sort']);_0x196499[_0x9375('0x37')]=qs[_0x9375('0x38')](_[_0x9375('0x39')](_0x56dae5[_0x9375('0x2f')],_0x363ce3[_0x9375('0x38')]),_0x149b57);if(_0x56dae5[_0x9375('0x2f')]['filter']){_0x196499[_0x9375('0x37')]=_['merge'](_0x196499[_0x9375('0x37')],{'$or':_['map'](_0x149b57,function(_0x51ef37){if(_0x51ef37[_0x9375('0x2c')]!==_0x9375('0x3a')){var _0x3f73e1={};_0x3f73e1[_0x51ef37[_0x9375('0x28')]]={'$like':'%'+_0x56dae5[_0x9375('0x2f')][_0x9375('0x3b')]+'%'};return _0x3f73e1;}})});}_0x196499=_[_0x9375('0x3c')]({},_0x196499,_0x56dae5['options']);var _0x262ac4={'where':_0x196499[_0x9375('0x37')]};return db['Disposition'][_0x9375('0x1c')](_0x262ac4)[_0x9375('0x23')](function(_0x40a998){_0x515fdb[_0x9375('0x1c')]=_0x40a998;if(_0x56dae5[_0x9375('0x2f')][_0x9375('0x3d')]){_0x196499[_0x9375('0x3e')]=[{'all':!![]}];}return db[_0x9375('0x3f')][_0x9375('0x40')](_0x196499);})[_0x9375('0x23')](function(_0xe12484){_0x515fdb[_0x9375('0x41')]=_0xe12484;return _0x515fdb;})[_0x9375('0x23')](respondWithFilteredResult(_0x1fea2f,_0x196499))[_0x9375('0x42')](handleError(_0x1fea2f,null));};exports[_0x9375('0x43')]=function(_0x4ec0de,_0x382252){var _0x37efd9={'raw':!![],'where':{'id':_0x4ec0de['params']['id']}},_0x1661e0={};_0x1661e0[_0x9375('0x33')]=_[_0x9375('0x2e')](db[_0x9375('0x3f')]['rawAttributes']);_0x1661e0['query']=_[_0x9375('0x2e')](_0x4ec0de[_0x9375('0x2f')]);_0x1661e0[_0x9375('0x38')]=_[_0x9375('0x31')](_0x1661e0[_0x9375('0x33')],_0x1661e0[_0x9375('0x2f')]);_0x37efd9[_0x9375('0x30')]=_[_0x9375('0x31')](_0x1661e0[_0x9375('0x33')],qs[_0x9375('0x32')](_0x4ec0de['query'][_0x9375('0x32')]));_0x37efd9['attributes']=_0x37efd9[_0x9375('0x30')][_0x9375('0x44')]?_0x37efd9[_0x9375('0x30')]:_0x1661e0['model'];if(_0x4ec0de[_0x9375('0x2f')]['includeAll']){_0x37efd9[_0x9375('0x3e')]=[{'all':!![]}];}_0x37efd9=_['merge']({},_0x37efd9,_0x4ec0de['options']);return db[_0x9375('0x3f')][_0x9375('0x45')](_0x37efd9)['then'](handleEntityNotFound(_0x382252,null))[_0x9375('0x23')](respondWithResult(_0x382252,null))[_0x9375('0x42')](handleError(_0x382252,null));};exports['create']=function(_0x37097c,_0x2d39e0){return db['Disposition'][_0x9375('0x46')](_0x37097c[_0x9375('0x47')],{})[_0x9375('0x23')](function(_0x5cfaeb){var _0x5c698c=_0x37097c[_0x9375('0x48')][_0x9375('0x24')]({'plain':!![]});if(!_0x5c698c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c698c[_0x9375('0x49')]===_0x9375('0x48')){var _0x49b19a=_0x5cfaeb['get']({'plain':!![]});var _0x18d4f7=_0x9375('0x4a');return db['UserProfileSection'][_0x9375('0x45')]({'where':{'name':_0x18d4f7,'userProfileId':_0x5c698c[_0x9375('0x4b')]},'raw':!![]})[_0x9375('0x23')](function(_0x25abb6){if(_0x25abb6&&_0x25abb6[_0x9375('0x4c')]===0x0){return db[_0x9375('0x25')][_0x9375('0x46')]({'name':_0x49b19a[_0x9375('0x28')],'resourceId':_0x49b19a['id'],'type':_0x25abb6[_0x9375('0x28')],'sectionId':_0x25abb6['id']},{})['then'](function(){return _0x5cfaeb;});}else{return _0x5cfaeb;}})[_0x9375('0x42')](function(_0xa5105e){logger[_0x9375('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa5105e);throw _0xa5105e;});}return _0x5cfaeb;})[_0x9375('0x23')](respondWithResult(_0x2d39e0,0xc9))['catch'](handleError(_0x2d39e0,null));};exports[_0x9375('0x21')]=function(_0x34b75b,_0xeab228){if(_0x34b75b[_0x9375('0x47')]['id']){delete _0x34b75b[_0x9375('0x47')]['id'];}return db[_0x9375('0x3f')]['find']({'where':{'id':_0x34b75b[_0x9375('0x4d')]['id']}})[_0x9375('0x23')](handleEntityNotFound(_0xeab228,null))[_0x9375('0x23')](saveUpdates(_0x34b75b[_0x9375('0x47')],null))[_0x9375('0x23')](respondWithResult(_0xeab228,null))['catch'](handleError(_0xeab228,null));};exports[_0x9375('0x22')]=function(_0xf123e5,_0x187bf3){return db['Disposition']['find']({'where':{'id':_0xf123e5[_0x9375('0x4d')]['id']}})[_0x9375('0x23')](handleEntityNotFound(_0x187bf3,null))['then'](removeEntity(_0x187bf3,null))['catch'](handleError(_0x187bf3,null));}; \ No newline at end of file +var _0x07f7=['fieldName','model','query','intersection','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','length','merge','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','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07f7,0x7e));var _0x707f=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x07f7[_0x468b0f];return _0x3e74d9;};'use strict';var emlformat=require(_0x707f('0x0'));var rimraf=require(_0x707f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x707f('0x2'));var rp=require('request-promise');var moment=require(_0x707f('0x3'));var BPromise=require(_0x707f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x707f('0x5'));var sox=require(_0x707f('0x6'));var csv=require(_0x707f('0x7'));var ejs=require(_0x707f('0x8'));var fs=require('fs');var fs_extra=require(_0x707f('0x9'));var _=require(_0x707f('0xa'));var squel=require('squel');var crypto=require(_0x707f('0xb'));var jsforce=require(_0x707f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x707f('0x7'));var querystring=require('querystring');var Papa=require(_0x707f('0xd'));var Redis=require(_0x707f('0xe'));var authService=require(_0x707f('0xf'));var qs=require(_0x707f('0x10'));var as=require(_0x707f('0x11'));var hardwareService=require(_0x707f('0x12'));var logger=require(_0x707f('0x13'))(_0x707f('0x14'));var utils=require(_0x707f('0x15'));var config=require(_0x707f('0x16'));var licenseUtil=require(_0x707f('0x17'));var db=require(_0x707f('0x18'))['db'];function respondWithStatusCode(_0x3c89be,_0x33859a){_0x33859a=_0x33859a||0xcc;return function(_0x2107e8){if(_0x2107e8){return _0x3c89be[_0x707f('0x19')](_0x33859a);}return _0x3c89be['status'](_0x33859a)[_0x707f('0x1a')]();};}function respondWithResult(_0x48d8e5,_0x49ff5b){_0x49ff5b=_0x49ff5b||0xc8;return function(_0x8867eb){if(_0x8867eb){return _0x48d8e5[_0x707f('0x1b')](_0x49ff5b)[_0x707f('0x1c')](_0x8867eb);}};}function respondWithFilteredResult(_0x5f23d3,_0x3a7442){return function(_0x31c85b){if(_0x31c85b){var _0x560aed=typeof _0x3a7442[_0x707f('0x1d')]==='undefined'&&typeof _0x3a7442[_0x707f('0x1e')]===_0x707f('0x1f');var _0x594665=_0x31c85b[_0x707f('0x20')];var _0x4048cc=_0x560aed?0x0:_0x3a7442['offset'];var _0x4385fb=_0x560aed?_0x31c85b[_0x707f('0x20')]:_0x3a7442['offset']+_0x3a7442[_0x707f('0x1e')];var _0x1e41ef;if(_0x4385fb>=_0x594665){_0x4385fb=_0x594665;_0x1e41ef=0xc8;}else{_0x1e41ef=0xce;}_0x5f23d3['status'](_0x1e41ef);return _0x5f23d3[_0x707f('0x21')](_0x707f('0x22'),_0x4048cc+'-'+_0x4385fb+'/'+_0x594665)[_0x707f('0x1c')](_0x31c85b);}return null;};}function patchUpdates(_0x6157ec){return function(_0x4f514b){try{jsonpatch[_0x707f('0x23')](_0x4f514b,_0x6157ec,!![]);}catch(_0x372d85){return BPromise[_0x707f('0x24')](_0x372d85);}return _0x4f514b[_0x707f('0x25')]();};}function saveUpdates(_0x1a3e19,_0x5b76af){return function(_0x40eb65){if(_0x40eb65){return _0x40eb65[_0x707f('0x26')](_0x1a3e19)[_0x707f('0x27')](function(_0x2641b6){return _0x2641b6;});}return null;};}function removeEntity(_0x3621f1,_0x27018c){return function(_0x1e9647){if(_0x1e9647){return _0x1e9647['destroy']()[_0x707f('0x27')](function(){var _0x2d47db=_0x1e9647[_0x707f('0x28')]({'plain':!![]});var _0x8aa6bb=_0x707f('0x29');return db[_0x707f('0x2a')][_0x707f('0x2b')]({'where':{'type':_0x8aa6bb,'resourceId':_0x2d47db['id']}})[_0x707f('0x27')](function(){return _0x1e9647;});})[_0x707f('0x27')](function(){_0x3621f1[_0x707f('0x1b')](0xcc)[_0x707f('0x1a')]();});}};}function handleEntityNotFound(_0x59cff5,_0x5124a5){return function(_0x10b57f){if(!_0x10b57f){_0x59cff5[_0x707f('0x19')](0x194);}return _0x10b57f;};}function handleError(_0x100841,_0x123688){_0x123688=_0x123688||0x1f4;return function(_0x5696a9){logger[_0x707f('0x2c')](_0x5696a9[_0x707f('0x2d')]);if(_0x5696a9['name']){delete _0x5696a9[_0x707f('0x2e')];}_0x100841[_0x707f('0x1b')](_0x123688)[_0x707f('0x2f')](_0x5696a9);};}exports[_0x707f('0x30')]=function(_0x4a5d26,_0x34f9a4){var _0x12a8c1={},_0x571d6f={},_0x313f55={'count':0x0,'rows':[]};var _0x1f75a2=_[_0x707f('0x31')](db['Disposition']['rawAttributes'],function(_0x5a2710){return{'name':_0x5a2710[_0x707f('0x32')],'type':_0x5a2710['type']['key']};});_0x571d6f[_0x707f('0x33')]=_['map'](_0x1f75a2,_0x707f('0x2e'));_0x571d6f[_0x707f('0x34')]=_['keys'](_0x4a5d26['query']);_0x571d6f['filters']=_['intersection'](_0x571d6f[_0x707f('0x33')],_0x571d6f[_0x707f('0x34')]);_0x12a8c1['attributes']=_[_0x707f('0x35')](_0x571d6f['model'],qs['fields'](_0x4a5d26['query']['fields']));_0x12a8c1['attributes']=_0x12a8c1['attributes']['length']?_0x12a8c1[_0x707f('0x36')]:_0x571d6f[_0x707f('0x33')];if(!_0x4a5d26[_0x707f('0x34')][_0x707f('0x37')](_0x707f('0x38'))){_0x12a8c1[_0x707f('0x1e')]=qs[_0x707f('0x1e')](_0x4a5d26[_0x707f('0x34')][_0x707f('0x1e')]);_0x12a8c1[_0x707f('0x1d')]=qs[_0x707f('0x1d')](_0x4a5d26[_0x707f('0x34')][_0x707f('0x1d')]);}_0x12a8c1['order']=qs[_0x707f('0x39')](_0x4a5d26[_0x707f('0x34')]['sort']);_0x12a8c1['where']=qs[_0x707f('0x3a')](_[_0x707f('0x3b')](_0x4a5d26[_0x707f('0x34')],_0x571d6f[_0x707f('0x3a')]),_0x1f75a2);if(_0x4a5d26['query'][_0x707f('0x3c')]){_0x12a8c1[_0x707f('0x3d')]=_['merge'](_0x12a8c1['where'],{'$or':_[_0x707f('0x31')](_0x1f75a2,function(_0x53e68d){if(_0x53e68d[_0x707f('0x3e')]!==_0x707f('0x3f')){var _0x21fcab={};_0x21fcab[_0x53e68d['name']]={'$like':'%'+_0x4a5d26[_0x707f('0x34')][_0x707f('0x3c')]+'%'};return _0x21fcab;}})});}_0x12a8c1=_['merge']({},_0x12a8c1,_0x4a5d26[_0x707f('0x40')]);var _0x4e8636={'where':_0x12a8c1[_0x707f('0x3d')]};return db[_0x707f('0x41')][_0x707f('0x20')](_0x4e8636)['then'](function(_0x5872e7){_0x313f55[_0x707f('0x20')]=_0x5872e7;if(_0x4a5d26[_0x707f('0x34')][_0x707f('0x42')]){_0x12a8c1[_0x707f('0x43')]=[{'all':!![]}];}return db[_0x707f('0x41')][_0x707f('0x44')](_0x12a8c1);})[_0x707f('0x27')](function(_0x55b1fb){_0x313f55[_0x707f('0x45')]=_0x55b1fb;return _0x313f55;})['then'](respondWithFilteredResult(_0x34f9a4,_0x12a8c1))[_0x707f('0x46')](handleError(_0x34f9a4,null));};exports[_0x707f('0x47')]=function(_0x520db1,_0x2ce05d){var _0xd1b61d={'raw':!![],'where':{'id':_0x520db1[_0x707f('0x48')]['id']}},_0x10a8e9={};_0x10a8e9[_0x707f('0x33')]=_[_0x707f('0x49')](db[_0x707f('0x41')][_0x707f('0x4a')]);_0x10a8e9['query']=_['keys'](_0x520db1['query']);_0x10a8e9['filters']=_[_0x707f('0x35')](_0x10a8e9[_0x707f('0x33')],_0x10a8e9[_0x707f('0x34')]);_0xd1b61d['attributes']=_[_0x707f('0x35')](_0x10a8e9[_0x707f('0x33')],qs['fields'](_0x520db1[_0x707f('0x34')][_0x707f('0x4b')]));_0xd1b61d[_0x707f('0x36')]=_0xd1b61d[_0x707f('0x36')][_0x707f('0x4c')]?_0xd1b61d['attributes']:_0x10a8e9[_0x707f('0x33')];if(_0x520db1[_0x707f('0x34')][_0x707f('0x42')]){_0xd1b61d[_0x707f('0x43')]=[{'all':!![]}];}_0xd1b61d=_[_0x707f('0x4d')]({},_0xd1b61d,_0x520db1[_0x707f('0x40')]);return db['Disposition'][_0x707f('0x4e')](_0xd1b61d)[_0x707f('0x27')](handleEntityNotFound(_0x2ce05d,null))[_0x707f('0x27')](respondWithResult(_0x2ce05d,null))[_0x707f('0x46')](handleError(_0x2ce05d,null));};exports[_0x707f('0x4f')]=function(_0x249e2f,_0x353802){return db[_0x707f('0x41')][_0x707f('0x4f')](_0x249e2f[_0x707f('0x50')],{})[_0x707f('0x27')](function(_0x19df4a){var _0x4da4a1=_0x249e2f[_0x707f('0x51')][_0x707f('0x28')]({'plain':!![]});if(!_0x4da4a1)throw new Error(_0x707f('0x52'));if(_0x4da4a1[_0x707f('0x53')]===_0x707f('0x51')){var _0x3ed83d=_0x19df4a['get']({'plain':!![]});var _0x2bdce8=_0x707f('0x29');return db[_0x707f('0x54')][_0x707f('0x4e')]({'where':{'name':_0x2bdce8,'userProfileId':_0x4da4a1[_0x707f('0x55')]},'raw':!![]})[_0x707f('0x27')](function(_0x4f40eb){if(_0x4f40eb&&_0x4f40eb[_0x707f('0x56')]===0x0){return db['UserProfileResource'][_0x707f('0x4f')]({'name':_0x3ed83d[_0x707f('0x2e')],'resourceId':_0x3ed83d['id'],'type':_0x4f40eb['name'],'sectionId':_0x4f40eb['id']},{})[_0x707f('0x27')](function(){return _0x19df4a;});}else{return _0x19df4a;}})[_0x707f('0x46')](function(_0x3a529e){logger['error'](_0x707f('0x57'),_0x3a529e);throw _0x3a529e;});}return _0x19df4a;})[_0x707f('0x27')](respondWithResult(_0x353802,0xc9))[_0x707f('0x46')](handleError(_0x353802,null));};exports[_0x707f('0x26')]=function(_0x20c8b3,_0x53476d){if(_0x20c8b3[_0x707f('0x50')]['id']){delete _0x20c8b3[_0x707f('0x50')]['id'];}return db[_0x707f('0x41')][_0x707f('0x4e')]({'where':{'id':_0x20c8b3[_0x707f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53476d,null))[_0x707f('0x27')](saveUpdates(_0x20c8b3['body'],null))[_0x707f('0x27')](respondWithResult(_0x53476d,null))[_0x707f('0x46')](handleError(_0x53476d,null));};exports[_0x707f('0x2b')]=function(_0xc378ef,_0x34b6c3){return db[_0x707f('0x41')][_0x707f('0x4e')]({'where':{'id':_0xc378ef[_0x707f('0x48')]['id']}})['then'](handleEntityNotFound(_0x34b6c3,null))[_0x707f('0x27')](removeEntity(_0x34b6c3,null))['catch'](handleError(_0x34b6c3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 200aa56..42ebd92 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 _0xf444=['moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api'];(function(_0x1e4c58,_0x2bb717){var _0x466c44=function(_0x30431a){while(--_0x30431a){_0x1e4c58['push'](_0x1e4c58['shift']());}};_0x466c44(++_0x2bb717);}(_0xf444,0x134));var _0x4f44=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xf444[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require(_0x4f44('0x0'));var util=require(_0x4f44('0x1'));var logger=require(_0x4f44('0x2'))(_0x4f44('0x3'));var moment=require(_0x4f44('0x4'));var BPromise=require(_0x4f44('0x5'));var rp=require(_0x4f44('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f44('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f44('0x8'));module[_0x4f44('0x9')]=function(_0x4c646a,_0x215921){return _0x4c646a[_0x4f44('0xa')](_0x4f44('0xb'),attributes,{'tableName':_0x4f44('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4f44('0xd'),'fields':[_0x4f44('0xe'),_0x4f44('0xf')]},{'unique':!![],'name':_0x4f44('0x10'),'fields':[_0x4f44('0xe'),_0x4f44('0x11')]},{'unique':!![],'name':_0x4f44('0x12'),'fields':['name',_0x4f44('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0x4f44('0xe'),_0x4f44('0x14')]},{'unique':!![],'name':_0x4f44('0x15'),'fields':[_0x4f44('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x4f44('0x16'),'fields':[_0x4f44('0xe'),_0x4f44('0x17')]},{'unique':!![],'name':_0x4f44('0x18'),'fields':[_0x4f44('0xe'),_0x4f44('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9c5=['lodash','../../config/logger','bluebird','path','rimraf','./disposition.attributes','name_voice','name','ListId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId'];(function(_0x1c71cd,_0x1f7d62){var _0x5072de=function(_0x3cbf4b){while(--_0x3cbf4b){_0x1c71cd['push'](_0x1c71cd['shift']());}};_0x5072de(++_0x1f7d62);}(_0xf9c5,0xee));var _0x5f9c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf9c5[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5f9c('0x0'));var util=require('util');var logger=require(_0x5f9c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5f9c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f9c('0x3'));var rimraf=require(_0x5f9c('0x4'));var config=require('../../config/environment');var attributes=require(_0x5f9c('0x5'));module['exports']=function(_0x2831f4,_0x187508){return _0x2831f4['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5f9c('0x6'),'fields':[_0x5f9c('0x7'),_0x5f9c('0x8')]},{'unique':!![],'name':'name_chat','fields':[_0x5f9c('0x7'),'ChatWebsiteId']},{'unique':!![],'name':_0x5f9c('0x9'),'fields':[_0x5f9c('0x7'),'MailAccountId']},{'unique':!![],'name':_0x5f9c('0xa'),'fields':['name',_0x5f9c('0xb')]},{'unique':!![],'name':_0x5f9c('0xc'),'fields':[_0x5f9c('0x7'),_0x5f9c('0xd')]},{'unique':!![],'name':_0x5f9c('0xe'),'fields':[_0x5f9c('0x7'),'OpenchannelAccountId']},{'unique':!![],'name':_0x5f9c('0xf'),'fields':['name',_0x5f9c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 160bbd8..1b9d4d3 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(_0x1e5143,_0x1963ec){var _0x478d7d=function(_0x353fbf){while(--_0x353fbf){_0x1e5143['push'](_0x1e5143['shift']());}};_0x478d7d(++_0x1963ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x13a692,_0x4aada2){var _0x1fb60a=function(_0xa8fabd){while(--_0xa8fabd){_0x13a692['push'](_0x13a692['shift']());}};_0x1fb60a(++_0x4aada2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 1734aa6..660525e 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 _0x37e1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x17f35c,_0x4e3ca8){var _0x11ee16=function(_0x2e7244){while(--_0x2e7244){_0x17f35c['push'](_0x17f35c['shift']());}};_0x11ee16(++_0x4e3ca8);}(_0x37e1,0x150));var _0x137e=function(_0x1f18d5,_0x57c794){_0x1f18d5=_0x1f18d5-0x0;var _0x4cdac7=_0x37e1[_0x1f18d5];return _0x4cdac7;};'use strict';var multer=require(_0x137e('0x0'));var util=require(_0x137e('0x1'));var path=require(_0x137e('0x2'));var timeout=require('connect-timeout');var express=require(_0x137e('0x3'));var router=express[_0x137e('0x4')]();var fs_extra=require(_0x137e('0x5'));var auth=require(_0x137e('0x6'));var interaction=require(_0x137e('0x7'));var config=require(_0x137e('0x8'));var controller=require('./disposition.controller');router[_0x137e('0x9')]('/',auth[_0x137e('0xa')](),controller[_0x137e('0xb')]);router[_0x137e('0x9')](_0x137e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x137e('0xd')]('/',auth[_0x137e('0xa')](),controller[_0x137e('0xe')]);router['put'](_0x137e('0xc'),auth[_0x137e('0xa')](),controller[_0x137e('0xf')]);router[_0x137e('0x10')]('/:id',auth[_0x137e('0xa')](),controller[_0x137e('0x11')]);module[_0x137e('0x12')]=router; \ No newline at end of file +var _0xaeb6=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x20e551,_0x37b0fd){var _0x38ff86=function(_0x1c4464){while(--_0x1c4464){_0x20e551['push'](_0x20e551['shift']());}};_0x38ff86(++_0x37b0fd);}(_0xaeb6,0x1e8));var _0x6aeb=function(_0x1537b0,_0x1ea287){_0x1537b0=_0x1537b0-0x0;var _0x567826=_0xaeb6[_0x1537b0];return _0x567826;};'use strict';var multer=require(_0x6aeb('0x0'));var util=require(_0x6aeb('0x1'));var path=require('path');var timeout=require(_0x6aeb('0x2'));var express=require('express');var router=express[_0x6aeb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aeb('0x4'));var interaction=require(_0x6aeb('0x5'));var config=require(_0x6aeb('0x6'));var controller=require('./disposition.controller');router[_0x6aeb('0x7')]('/',auth[_0x6aeb('0x8')](),controller['index']);router[_0x6aeb('0x7')](_0x6aeb('0x9'),auth['isAuthenticated'](),controller[_0x6aeb('0xa')]);router[_0x6aeb('0xb')]('/',auth[_0x6aeb('0x8')](),controller[_0x6aeb('0xc')]);router[_0x6aeb('0xd')](_0x6aeb('0x9'),auth['isAuthenticated'](),controller[_0x6aeb('0xe')]);router[_0x6aeb('0xf')]('/:id',auth[_0x6aeb('0x8')](),controller[_0x6aeb('0x10')]);module[_0x6aeb('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dddcc3a..d6dfad0 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 _0xcd0f=['IAX','DADHI','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','12000','14400','7200','9600','v17,v27,v29','SIP'];(function(_0x27eca4,_0x47ced3){var _0x38c46c=function(_0x1f9af0){while(--_0x1f9af0){_0x27eca4['push'](_0x27eca4['shift']());}};_0x38c46c(++_0x47ced3);}(_0xcd0f,0xa3));var _0xfcd0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcd0f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xfcd0('0x0'));module[_0xfcd0('0x1')]={'name':{'type':Sequelize[_0xfcd0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfcd0('0x2')]},'ecm':{'type':Sequelize[_0xfcd0('0x3')](_0xfcd0('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xfcd0('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xfcd0('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xfcd0('0x3')](_0xfcd0('0x5'),_0xfcd0('0x6'),'7200','9600',_0xfcd0('0x7'),_0xfcd0('0x8')),'defaultValue':_0xfcd0('0x6')},'maxrate':{'type':Sequelize[_0xfcd0('0x3')](_0xfcd0('0x5'),_0xfcd0('0x6'),_0xfcd0('0x9'),_0xfcd0('0xa'),'12000','14400'),'defaultValue':_0xfcd0('0x8')},'modem':{'type':Sequelize[_0xfcd0('0x2')],'defaultValue':_0xfcd0('0xb')},'gateway':{'type':Sequelize[_0xfcd0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfcd0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfcd0('0x3')](_0xfcd0('0xc'),_0xfcd0('0xd'),_0xfcd0('0xe'),'KHOMP'),'defaultValue':_0xfcd0('0xc')},'key':{'type':Sequelize[_0xfcd0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfcd0('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfcd0('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfcd0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfcd0('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfcd0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfcd0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfcd0('0x11')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfcd0('0x10')],'defaultValue':![],'comment':_0xfcd0('0x12'),'set':function(_0x1a7ac7){if(!_0x1a7ac7)this['setDataValue'](_0xfcd0('0x13'),null);this[_0xfcd0('0x14')](_0xfcd0('0x15'),_0x1a7ac7);}}}; \ No newline at end of file +var _0x19ef=['14400','v17,v27,v29','INTEGER','SIP','IAX','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','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x19ef,0x19f));var _0xf19e=function(_0x5e327c,_0x1bce0c){_0x5e327c=_0x5e327c-0x0;var _0x3b734d=_0x19ef[_0x5e327c];return _0x3b734d;};'use strict';var Sequelize=require('sequelize');module[_0xf19e('0x0')]={'name':{'type':Sequelize[_0xf19e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf19e('0x2')](_0xf19e('0x3'),'no'),'defaultValue':_0xf19e('0x3')},'headerinfo':{'type':Sequelize[_0xf19e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xf19e('0x1')],'unique':_0xf19e('0x4')},'minrate':{'type':Sequelize[_0xf19e('0x2')](_0xf19e('0x5'),_0xf19e('0x6'),_0xf19e('0x7'),_0xf19e('0x8'),_0xf19e('0x9'),_0xf19e('0xa')),'defaultValue':_0xf19e('0x6')},'maxrate':{'type':Sequelize[_0xf19e('0x2')]('2400','4800',_0xf19e('0x7'),_0xf19e('0x8'),_0xf19e('0x9'),_0xf19e('0xa')),'defaultValue':_0xf19e('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xf19e('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf19e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf19e('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf19e('0x2')](_0xf19e('0xd'),_0xf19e('0xe'),_0xf19e('0xf'),_0xf19e('0x10')),'defaultValue':_0xf19e('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf19e('0x11')],'defaultValue':function(){return _0xf19e('0x12');}},'notificationSound':{'type':Sequelize[_0xf19e('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf19e('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf19e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf19e('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf19e('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf19e('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf19e('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf19e('0x15'),'set':function(_0x4b96bd){if(!_0x4b96bd)this[_0xf19e('0x16')](_0xf19e('0x17'),null);this[_0xf19e('0x16')](_0xf19e('0x18'),_0x4b96bd);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 790efff..6acf977 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 _0x5dcd=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','Pause','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','FaxAccountId','findOne','Disposition','rows','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','finally','getApplications','from-voip-provider','exten','app','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','status','json','offset','limit','count','set','reject','save','update','get','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','FaxAccount','rawAttributes'];(function(_0x2d86fc,_0x368346){var _0x10f339=function(_0x2a3e29){while(--_0x2a3e29){_0x2d86fc['push'](_0x2d86fc['shift']());}};_0x10f339(++_0x368346);}(_0x5dcd,0x149));var _0xd5dc=function(_0x4179d7,_0x189fd4){_0x4179d7=_0x4179d7-0x0;var _0x3d79d4=_0x5dcd[_0x4179d7];return _0x3d79d4;};'use strict';var emlformat=require(_0xd5dc('0x0'));var rimraf=require(_0xd5dc('0x1'));var zipdir=require(_0xd5dc('0x2'));var jsonpatch=require(_0xd5dc('0x3'));var rp=require('request-promise');var moment=require(_0xd5dc('0x4'));var BPromise=require(_0xd5dc('0x5'));var Mustache=require(_0xd5dc('0x6'));var util=require(_0xd5dc('0x7'));var path=require(_0xd5dc('0x8'));var sox=require(_0xd5dc('0x9'));var csv=require('to-csv');var ejs=require(_0xd5dc('0xa'));var fs=require('fs');var fs_extra=require(_0xd5dc('0xb'));var _=require(_0xd5dc('0xc'));var squel=require(_0xd5dc('0xd'));var crypto=require('crypto');var jsforce=require(_0xd5dc('0xe'));var deskjs=require(_0xd5dc('0xf'));var toCsv=require(_0xd5dc('0x10'));var querystring=require(_0xd5dc('0x11'));var Papa=require(_0xd5dc('0x12'));var Redis=require(_0xd5dc('0x13'));var authService=require(_0xd5dc('0x14'));var qs=require(_0xd5dc('0x15'));var as=require(_0xd5dc('0x16'));var hardwareService=require(_0xd5dc('0x17'));var logger=require(_0xd5dc('0x18'))(_0xd5dc('0x19'));var utils=require(_0xd5dc('0x1a'));var config=require(_0xd5dc('0x1b'));var licenseUtil=require(_0xd5dc('0x1c'));var db=require(_0xd5dc('0x1d'))['db'];config[_0xd5dc('0x1e')]=_['defaults'](config[_0xd5dc('0x1e')],{'host':_0xd5dc('0x1f'),'port':0x18eb});var socket=require(_0xd5dc('0x20'))(new Redis(config[_0xd5dc('0x1e')]));require('./faxAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd5dc('0x21')][_0xd5dc('0x22')]({'port':0x232c});var client9002=jayson[_0xd5dc('0x21')][_0xd5dc('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x90e5a9,_0x5c0ff6,_0x3f139e,_0x44e00f){return new BPromise(function(_0x534fd1,_0x2164fc){var _0xa1c71c=_0x44e00f||client;return _0xa1c71c[_0xd5dc('0x23')](_0x90e5a9,_0x3f139e)[_0xd5dc('0x24')](function(_0x39a987){logger['info'](_0xd5dc('0x25'),_0x5c0ff6,_0xd5dc('0x26'));logger[_0xd5dc('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5c0ff6,'request\x20sent',JSON[_0xd5dc('0x28')](_0x39a987));if(_0x39a987['error']){if(_0x39a987[_0xd5dc('0x29')][_0xd5dc('0x2a')]===0x1f4){logger['error'](_0xd5dc('0x25'),_0x5c0ff6,_0x39a987[_0xd5dc('0x29')][_0xd5dc('0x2b')]);return _0x2164fc(_0x39a987[_0xd5dc('0x29')][_0xd5dc('0x2b')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5c0ff6,_0x39a987['error'][_0xd5dc('0x2b')]);return _0x534fd1(_0x39a987['error'][_0xd5dc('0x2b')]);}else{logger[_0xd5dc('0x2c')](_0xd5dc('0x25'),_0x5c0ff6,_0xd5dc('0x26'));_0x534fd1(_0x39a987[_0xd5dc('0x2d')][_0xd5dc('0x2b')]);}})['catch'](function(_0x18b43a){logger['error'](_0xd5dc('0x25'),_0x5c0ff6,_0x18b43a);_0x2164fc(_0x18b43a);});});}function respondWithStatusCode(_0x1e4bd6,_0x3a555a){_0x3a555a=_0x3a555a||0xcc;return function(_0x41633c){if(_0x41633c){return _0x1e4bd6['sendStatus'](_0x3a555a);}return _0x1e4bd6[_0xd5dc('0x2e')](_0x3a555a)['end']();};}function respondWithResult(_0x4d9265,_0x26c6ef){_0x26c6ef=_0x26c6ef||0xc8;return function(_0x5125e6){if(_0x5125e6){return _0x4d9265[_0xd5dc('0x2e')](_0x26c6ef)[_0xd5dc('0x2f')](_0x5125e6);}};}function respondWithFilteredResult(_0x44539d,_0x459921){return function(_0x3f62a0){if(_0x3f62a0){var _0x21ceb6=typeof _0x459921[_0xd5dc('0x30')]==='undefined'&&typeof _0x459921[_0xd5dc('0x31')]==='undefined';var _0x3461ad=_0x3f62a0[_0xd5dc('0x32')];var _0x164ba5=_0x21ceb6?0x0:_0x459921['offset'];var _0x498660=_0x21ceb6?_0x3f62a0[_0xd5dc('0x32')]:_0x459921['offset']+_0x459921[_0xd5dc('0x31')];var _0x1e3e0a;if(_0x498660>=_0x3461ad){_0x498660=_0x3461ad;_0x1e3e0a=0xc8;}else{_0x1e3e0a=0xce;}_0x44539d[_0xd5dc('0x2e')](_0x1e3e0a);return _0x44539d[_0xd5dc('0x33')]('Content-Range',_0x164ba5+'-'+_0x498660+'/'+_0x3461ad)[_0xd5dc('0x2f')](_0x3f62a0);}return null;};}function patchUpdates(_0x3f0567){return function(_0x57533e){try{jsonpatch['apply'](_0x57533e,_0x3f0567,!![]);}catch(_0xc964a3){return BPromise[_0xd5dc('0x34')](_0xc964a3);}return _0x57533e[_0xd5dc('0x35')]();};}function saveUpdates(_0x2febf9,_0x282035){return function(_0x2fe551){if(_0x2fe551){return _0x2fe551[_0xd5dc('0x36')](_0x2febf9)[_0xd5dc('0x24')](function(_0x310f4c){return _0x310f4c;});}return null;};}function removeEntity(_0x11aa7e,_0x33b828){return function(_0x163a85){if(_0x163a85){return _0x163a85['destroy']()[_0xd5dc('0x24')](function(){var _0x1b469f=_0x163a85[_0xd5dc('0x37')]({'plain':!![]});var _0x59a85d='FaxAccounts';return db[_0xd5dc('0x38')][_0xd5dc('0x39')]({'where':{'type':_0x59a85d,'resourceId':_0x1b469f['id']}})[_0xd5dc('0x24')](function(){return _0x163a85;});})['then'](function(){_0x11aa7e[_0xd5dc('0x2e')](0xcc)[_0xd5dc('0x3a')]();});}};}function handleEntityNotFound(_0x3edc8a,_0xdbac6b){return function(_0x557cff){if(!_0x557cff){_0x3edc8a[_0xd5dc('0x3b')](0x194);}return _0x557cff;};}function handleError(_0x4d018f,_0x2a52d7){_0x2a52d7=_0x2a52d7||0x1f4;return function(_0x184bc6){logger[_0xd5dc('0x29')](_0x184bc6[_0xd5dc('0x3c')]);if(_0x184bc6[_0xd5dc('0x3d')]){delete _0x184bc6[_0xd5dc('0x3d')];}_0x4d018f['status'](_0x2a52d7)[_0xd5dc('0x3e')](_0x184bc6);};}exports[_0xd5dc('0x3f')]=function(_0x436fc1,_0x2ac386){var _0x366cdc={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x36b85e={},_0x2c8619={'count':0x0,'rows':[]};var _0x4509d3=_[_0xd5dc('0x40')](db[_0xd5dc('0x41')][_0xd5dc('0x42')],function(_0x503f77){return{'name':_0x503f77[_0xd5dc('0x43')],'type':_0x503f77[_0xd5dc('0x44')][_0xd5dc('0x45')]};});_0x36b85e[_0xd5dc('0x46')]=_['map'](_0x4509d3,_0xd5dc('0x3d'));_0x36b85e[_0xd5dc('0x47')]=_['keys'](_0x436fc1[_0xd5dc('0x47')]);_0x36b85e[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x36b85e[_0xd5dc('0x46')],_0x36b85e[_0xd5dc('0x47')]);_0x366cdc[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x36b85e[_0xd5dc('0x46')],qs['fields'](_0x436fc1[_0xd5dc('0x47')][_0xd5dc('0x4b')]));_0x366cdc[_0xd5dc('0x4a')]=_0x366cdc[_0xd5dc('0x4a')][_0xd5dc('0x4c')]?_0x366cdc[_0xd5dc('0x4a')]:_0x36b85e[_0xd5dc('0x46')];if(!_0x436fc1[_0xd5dc('0x47')][_0xd5dc('0x4d')](_0xd5dc('0x4e'))){_0x366cdc[_0xd5dc('0x31')]=qs['limit'](_0x436fc1[_0xd5dc('0x47')][_0xd5dc('0x31')]);_0x366cdc[_0xd5dc('0x30')]=qs[_0xd5dc('0x30')](_0x436fc1['query'][_0xd5dc('0x30')]);}_0x366cdc[_0xd5dc('0x4f')]=qs[_0xd5dc('0x50')](_0x436fc1['query']['sort']);_0x366cdc[_0xd5dc('0x51')]=qs[_0xd5dc('0x48')](_[_0xd5dc('0x52')](_0x436fc1[_0xd5dc('0x47')],_0x36b85e[_0xd5dc('0x48')]),_0x4509d3);if(_0x436fc1[_0xd5dc('0x47')]['filter']){_0x366cdc[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0x366cdc[_0xd5dc('0x51')],{'$or':_[_0xd5dc('0x40')](_0x4509d3,function(_0x33a281){if(_0x33a281['type']!=='VIRTUAL'){var _0x439d38={};_0x439d38[_0x33a281[_0xd5dc('0x3d')]]={'$like':'%'+_0x436fc1['query'][_0xd5dc('0x54')]+'%'};return _0x439d38;}})});}_0x366cdc=_[_0xd5dc('0x53')]({},_0x366cdc,_0x436fc1[_0xd5dc('0x55')]);var _0x1a9474={'where':_0x366cdc[_0xd5dc('0x51')]};return db[_0xd5dc('0x41')]['count'](_0x1a9474)[_0xd5dc('0x24')](function(_0x280a9d){_0x2c8619[_0xd5dc('0x32')]=_0x280a9d;if(_0x436fc1['query']['includeAll']){_0x366cdc[_0xd5dc('0x56')]=[{'all':!![]}];}return db[_0xd5dc('0x41')][_0xd5dc('0x57')](_0x366cdc);})[_0xd5dc('0x24')](function(_0x1317a4){_0x2c8619['rows']=_0x1317a4;return _0x2c8619;})[_0xd5dc('0x24')](respondWithFilteredResult(_0x2ac386,_0x366cdc))[_0xd5dc('0x58')](handleError(_0x2ac386,null));};exports[_0xd5dc('0x59')]=function(_0x1f061b,_0x11d2e9){var _0x1fec6b={'raw':![],'where':{'id':_0x1f061b[_0xd5dc('0x5a')]['id']},'include':[{'model':db[_0xd5dc('0x5b')],'as':'mandatoryDispositionPause'}]},_0x5252dd={};_0x5252dd[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db[_0xd5dc('0x41')][_0xd5dc('0x42')]);_0x5252dd[_0xd5dc('0x47')]=_[_0xd5dc('0x5c')](_0x1f061b['query']);_0x5252dd[_0xd5dc('0x48')]=_['intersection'](_0x5252dd[_0xd5dc('0x46')],_0x5252dd[_0xd5dc('0x47')]);_0x1fec6b[_0xd5dc('0x4a')]=_['intersection'](_0x5252dd[_0xd5dc('0x46')],qs[_0xd5dc('0x4b')](_0x1f061b[_0xd5dc('0x47')]['fields']));_0x1fec6b[_0xd5dc('0x4a')]=_0x1fec6b[_0xd5dc('0x4a')][_0xd5dc('0x4c')]?_0x1fec6b[_0xd5dc('0x4a')]:_0x5252dd[_0xd5dc('0x46')];if(_0x1f061b['query'][_0xd5dc('0x5d')]){_0x1fec6b['include']=[{'all':!![]}];}_0x1fec6b=_[_0xd5dc('0x53')]({},_0x1fec6b,_0x1f061b[_0xd5dc('0x55')]);return db[_0xd5dc('0x41')][_0xd5dc('0x5e')](_0x1fec6b)[_0xd5dc('0x24')](handleEntityNotFound(_0x11d2e9,null))[_0xd5dc('0x24')](respondWithResult(_0x11d2e9,null))['catch'](handleError(_0x11d2e9,null));};exports[_0xd5dc('0x5f')]=function(_0x5c9014,_0x28a8fc){return db[_0xd5dc('0x41')]['create'](_0x5c9014[_0xd5dc('0x60')],{})[_0xd5dc('0x24')](function(_0x3d088c){var _0x6c505b=_0x5c9014[_0xd5dc('0x61')]['get']({'plain':!![]});if(!_0x6c505b)throw new Error(_0xd5dc('0x62'));if(_0x6c505b[_0xd5dc('0x63')]===_0xd5dc('0x61')){var _0x252f9=_0x3d088c['get']({'plain':!![]});var _0x5d9bb7=_0xd5dc('0x64');return db[_0xd5dc('0x65')]['find']({'where':{'name':_0x5d9bb7,'userProfileId':_0x6c505b[_0xd5dc('0x66')]},'raw':!![]})[_0xd5dc('0x24')](function(_0x59ab1c){if(_0x59ab1c&&_0x59ab1c[_0xd5dc('0x67')]===0x0){return db['UserProfileResource'][_0xd5dc('0x5f')]({'name':_0x252f9[_0xd5dc('0x3d')],'resourceId':_0x252f9['id'],'type':_0x59ab1c[_0xd5dc('0x3d')],'sectionId':_0x59ab1c['id']},{})[_0xd5dc('0x24')](function(){return _0x3d088c;});}else{return _0x3d088c;}})[_0xd5dc('0x58')](function(_0x2cfd0a){logger[_0xd5dc('0x29')](_0xd5dc('0x68'),_0x2cfd0a);throw _0x2cfd0a;});}return _0x3d088c;})[_0xd5dc('0x24')](respondWithResult(_0x28a8fc,0xc9))[_0xd5dc('0x58')](handleError(_0x28a8fc,null));};exports[_0xd5dc('0x36')]=function(_0x6e21a,_0x1295e2){if(_0x6e21a['body']['id']){delete _0x6e21a[_0xd5dc('0x60')]['id'];}return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x6e21a[_0xd5dc('0x5a')]['id']},'include':[{'model':db[_0xd5dc('0x5b')],'as':_0xd5dc('0x69')}]})[_0xd5dc('0x24')](handleEntityNotFound(_0x1295e2,null))['then'](saveUpdates(_0x6e21a['body'],null))[_0xd5dc('0x24')](respondWithResult(_0x1295e2,null))[_0xd5dc('0x58')](handleError(_0x1295e2,null));};exports[_0xd5dc('0x39')]=function(_0x162b56,_0x442109){return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x162b56[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x442109,null))[_0xd5dc('0x24')](removeEntity(_0x442109,null))['catch'](handleError(_0x442109,null));};exports[_0xd5dc('0x6a')]=function(_0x448141,_0x2c0d85){return db['FaxAccount'][_0xd5dc('0x6a')]()[_0xd5dc('0x24')](respondWithResult(_0x2c0d85,null))[_0xd5dc('0x58')](handleError(_0x2c0d85,null));};exports['addDisposition']=function(_0x584eb6,_0x1c6461,_0x69d08a){if(_0x584eb6[_0xd5dc('0x60')]['id']){delete _0x584eb6[_0xd5dc('0x60')]['id'];}return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x584eb6['params']['id']}})['then'](handleEntityNotFound(_0x1c6461,null))['then'](function(_0x5dbfc0){if(_0x5dbfc0){_0x584eb6[_0xd5dc('0x60')][_0xd5dc('0x6b')]=_0x5dbfc0['id'];return db['Disposition']['create'](_0x584eb6['body']);}})[_0xd5dc('0x24')](respondWithResult(_0x1c6461,null))[_0xd5dc('0x58')](handleError(_0x1c6461,null));};exports['getDispositions']=function(_0x2506f8,_0x57fdfb,_0xae5f07){var _0x4d5b57={'raw':![],'where':{}};var _0x3d86d5={};var _0x270e5e={'count':0x0,'rows':[]};return db[_0xd5dc('0x41')][_0xd5dc('0x6c')]({'where':{'id':_0x2506f8[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x57fdfb,null))[_0xd5dc('0x24')](function(_0x1ade17){if(_0x1ade17){_0x3d86d5[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db[_0xd5dc('0x6d')]['rawAttributes']);_0x3d86d5['query']=_[_0xd5dc('0x5c')](_0x2506f8[_0xd5dc('0x47')]);_0x3d86d5[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x3d86d5['model'],_0x3d86d5[_0xd5dc('0x47')]);_0x4d5b57[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x3d86d5[_0xd5dc('0x46')],qs[_0xd5dc('0x4b')](_0x2506f8['query'][_0xd5dc('0x4b')]));_0x4d5b57['attributes']=_0x4d5b57[_0xd5dc('0x4a')][_0xd5dc('0x4c')]?_0x4d5b57[_0xd5dc('0x4a')]:_0x3d86d5['model'];if(!_0x2506f8[_0xd5dc('0x47')]['hasOwnProperty']('nolimit')){_0x4d5b57[_0xd5dc('0x31')]=qs[_0xd5dc('0x31')](_0x2506f8['query'][_0xd5dc('0x31')]);_0x4d5b57['offset']=qs[_0xd5dc('0x30')](_0x2506f8['query'][_0xd5dc('0x30')]);}_0x4d5b57[_0xd5dc('0x4f')]=qs[_0xd5dc('0x50')](_0x2506f8[_0xd5dc('0x47')][_0xd5dc('0x50')]);_0x4d5b57[_0xd5dc('0x51')]=qs['filters'](_[_0xd5dc('0x52')](_0x2506f8[_0xd5dc('0x47')],_0x3d86d5[_0xd5dc('0x48')]));_0x4d5b57[_0xd5dc('0x51')][_0xd5dc('0x6b')]=_0x1ade17['id'];if(_0x2506f8[_0xd5dc('0x47')][_0xd5dc('0x54')]){_0x4d5b57[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0x4d5b57[_0xd5dc('0x51')],{'$or':_['map'](_0x4d5b57[_0xd5dc('0x4a')],function(_0x2d80ee){var _0x4cd7ce={};_0x4cd7ce[_0x2d80ee]={'$like':'%'+_0x2506f8[_0xd5dc('0x47')][_0xd5dc('0x54')]+'%'};return _0x4cd7ce;})});}_0x4d5b57=_[_0xd5dc('0x53')]({},_0x4d5b57,_0x2506f8[_0xd5dc('0x55')]);return db[_0xd5dc('0x6d')][_0xd5dc('0x32')]({'where':_0x4d5b57[_0xd5dc('0x51')]})[_0xd5dc('0x24')](function(_0x2643c0){_0x270e5e[_0xd5dc('0x32')]=_0x2643c0;if(_0x2506f8['query'][_0xd5dc('0x5d')]){_0x4d5b57['include']=[{'all':!![]}];}return db[_0xd5dc('0x6d')]['findAll'](_0x4d5b57);})[_0xd5dc('0x24')](function(_0x9fc335){_0x270e5e[_0xd5dc('0x6e')]=_0x9fc335;return _0x270e5e;});}})[_0xd5dc('0x24')](respondWithFilteredResult(_0x57fdfb,_0x4d5b57))[_0xd5dc('0x58')](handleError(_0x57fdfb,null));};exports['removeDispositions']=function(_0x3e88e5,_0x320b24,_0x389490){return db['FaxAccount'][_0xd5dc('0x5e')]({'where':{'id':_0x3e88e5[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x320b24,null))[_0xd5dc('0x24')](function(_0x1c6d2a){if(_0x1c6d2a){return _0x1c6d2a['removeDispositions'](_0x3e88e5[_0xd5dc('0x47')]['ids']);}})[_0xd5dc('0x24')](respondWithStatusCode(_0x320b24,null))[_0xd5dc('0x58')](handleError(_0x320b24,null));};exports[_0xd5dc('0x6f')]=function(_0x4ecd67,_0x503efc,_0xfa0fc5){if(_0x4ecd67['body']['id']){delete _0x4ecd67[_0xd5dc('0x60')]['id'];}return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x4ecd67['params']['id']}})['then'](handleEntityNotFound(_0x503efc,null))[_0xd5dc('0x24')](function(_0xd735b5){if(_0xd735b5){_0x4ecd67[_0xd5dc('0x60')]['FaxAccountId']=_0xd735b5['id'];return db[_0xd5dc('0x70')][_0xd5dc('0x5f')](_0x4ecd67[_0xd5dc('0x60')]);}})['then'](respondWithResult(_0x503efc,null))[_0xd5dc('0x58')](handleError(_0x503efc,null));};exports[_0xd5dc('0x71')]=function(_0x3eca72,_0x15076b,_0x570cf8){var _0xc4ce4a={'raw':![],'where':{}};var _0x1be91e={};var _0x247b4e={'count':0x0,'rows':[]};return db[_0xd5dc('0x41')][_0xd5dc('0x6c')]({'where':{'id':_0x3eca72['params']['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x15076b,null))[_0xd5dc('0x24')](function(_0x110e3a){if(_0x110e3a){_0x1be91e[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db['CannedAnswer'][_0xd5dc('0x42')]);_0x1be91e[_0xd5dc('0x47')]=_[_0xd5dc('0x5c')](_0x3eca72[_0xd5dc('0x47')]);_0x1be91e[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x1be91e[_0xd5dc('0x46')],_0x1be91e[_0xd5dc('0x47')]);_0xc4ce4a[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x1be91e['model'],qs['fields'](_0x3eca72[_0xd5dc('0x47')]['fields']));_0xc4ce4a[_0xd5dc('0x4a')]=_0xc4ce4a['attributes'][_0xd5dc('0x4c')]?_0xc4ce4a[_0xd5dc('0x4a')]:_0x1be91e['model'];if(!_0x3eca72[_0xd5dc('0x47')][_0xd5dc('0x4d')](_0xd5dc('0x4e'))){_0xc4ce4a['limit']=qs[_0xd5dc('0x31')](_0x3eca72[_0xd5dc('0x47')]['limit']);_0xc4ce4a['offset']=qs[_0xd5dc('0x30')](_0x3eca72[_0xd5dc('0x47')][_0xd5dc('0x30')]);}_0xc4ce4a[_0xd5dc('0x4f')]=qs['sort'](_0x3eca72[_0xd5dc('0x47')]['sort']);_0xc4ce4a[_0xd5dc('0x51')]=qs[_0xd5dc('0x48')](_[_0xd5dc('0x52')](_0x3eca72[_0xd5dc('0x47')],_0x1be91e[_0xd5dc('0x48')]));_0xc4ce4a[_0xd5dc('0x51')]['FaxAccountId']=_0x110e3a['id'];if(_0x3eca72[_0xd5dc('0x47')][_0xd5dc('0x54')]){_0xc4ce4a[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0xc4ce4a[_0xd5dc('0x51')],{'$or':_[_0xd5dc('0x40')](_0xc4ce4a[_0xd5dc('0x4a')],function(_0x146955){var _0x9d068f={};_0x9d068f[_0x146955]={'$like':'%'+_0x3eca72['query'][_0xd5dc('0x54')]+'%'};return _0x9d068f;})});}_0xc4ce4a=_['merge']({},_0xc4ce4a,_0x3eca72[_0xd5dc('0x55')]);return db['CannedAnswer'][_0xd5dc('0x32')]({'where':_0xc4ce4a[_0xd5dc('0x51')]})[_0xd5dc('0x24')](function(_0x4e8792){_0x247b4e['count']=_0x4e8792;if(_0x3eca72[_0xd5dc('0x47')][_0xd5dc('0x5d')]){_0xc4ce4a[_0xd5dc('0x56')]=[{'all':!![]}];}return db[_0xd5dc('0x70')][_0xd5dc('0x57')](_0xc4ce4a);})['then'](function(_0x405438){_0x247b4e[_0xd5dc('0x6e')]=_0x405438;return _0x247b4e;});}})['then'](respondWithFilteredResult(_0x15076b,_0xc4ce4a))[_0xd5dc('0x58')](handleError(_0x15076b,null));};exports[_0xd5dc('0x72')]=function(_0x224bd2,_0xba30fe,_0x2439ea){return db[_0xd5dc('0x41')]['find']({'where':{'id':_0x224bd2[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0xba30fe,null))[_0xd5dc('0x24')](function(_0x4830df){if(_0x4830df){return _0x4830df['removeAnswers'](_0x224bd2[_0xd5dc('0x47')][_0xd5dc('0x73')]);}})[_0xd5dc('0x24')](respondWithStatusCode(_0xba30fe,null))[_0xd5dc('0x58')](handleError(_0xba30fe,null));};exports[_0xd5dc('0x74')]=function(_0x55434d,_0x510487,_0x24be6d){return db[_0xd5dc('0x75')]['find']({'where':{'id':_0x55434d[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x510487,null))[_0xd5dc('0x24')](function(_0x389ed7){if(_0x389ed7){return _0x389ed7['addInteraction'](_0x55434d[_0xd5dc('0x60')]['ids'],_[_0xd5dc('0x76')](_0x55434d[_0xd5dc('0x60')],[_0xd5dc('0x73'),'id'])||{});}})[_0xd5dc('0x24')](respondWithResult(_0x510487,null))['catch'](handleError(_0x510487,null));};exports['getInteractions']=function(_0x2b532e,_0xb6f535,_0x46c9fc){var _0x416b9d={'raw':![],'where':{}};var _0x137528={};var _0x5f2151={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2b532e[_0xd5dc('0x5a')]['id']}})['then'](handleEntityNotFound(_0xb6f535,null))['then'](function(_0x226e2c){if(_0x226e2c){_0x137528[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db['FaxInteraction'][_0xd5dc('0x42')]);_0x137528[_0xd5dc('0x47')]=_[_0xd5dc('0x5c')](_0x2b532e['query']);_0x137528[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x137528[_0xd5dc('0x46')],_0x137528['query']);_0x416b9d[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x137528[_0xd5dc('0x46')],qs[_0xd5dc('0x4b')](_0x2b532e['query']['fields']));_0x416b9d[_0xd5dc('0x4a')]=_0x416b9d['attributes'][_0xd5dc('0x4c')]?_0x416b9d[_0xd5dc('0x4a')]:_0x137528[_0xd5dc('0x46')];if(!_0x2b532e[_0xd5dc('0x47')]['hasOwnProperty'](_0xd5dc('0x4e'))){_0x416b9d[_0xd5dc('0x31')]=qs[_0xd5dc('0x31')](_0x2b532e[_0xd5dc('0x47')]['limit']);_0x416b9d[_0xd5dc('0x30')]=qs[_0xd5dc('0x30')](_0x2b532e[_0xd5dc('0x47')][_0xd5dc('0x30')]);}_0x416b9d['order']=qs[_0xd5dc('0x50')](_0x2b532e['query'][_0xd5dc('0x50')]);_0x416b9d[_0xd5dc('0x51')]=qs[_0xd5dc('0x48')](_[_0xd5dc('0x52')](_0x2b532e[_0xd5dc('0x47')],_0x137528[_0xd5dc('0x48')]));_0x416b9d[_0xd5dc('0x51')][_0xd5dc('0x6b')]=_0x226e2c['id'];if(_0x2b532e['query']['filter']){_0x416b9d[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0x416b9d['where'],{'$or':_[_0xd5dc('0x40')](_0x416b9d[_0xd5dc('0x4a')],function(_0x280d75){var _0xdd2af1={};_0xdd2af1[_0x280d75]={'$like':'%'+_0x2b532e[_0xd5dc('0x47')]['filter']+'%'};return _0xdd2af1;})});}_0x416b9d=_[_0xd5dc('0x53')]({},_0x416b9d,_0x2b532e[_0xd5dc('0x55')]);return db[_0xd5dc('0x75')][_0xd5dc('0x32')]({'where':_0x416b9d[_0xd5dc('0x51')]})[_0xd5dc('0x24')](function(_0x4c1061){_0x5f2151['count']=_0x4c1061;if(_0x2b532e[_0xd5dc('0x47')]['includeAll']){_0x416b9d[_0xd5dc('0x56')]=[{'model':db['CmContact'],'as':_0xd5dc('0x77'),'required':![]},{'model':db[_0xd5dc('0x78')],'as':_0xd5dc('0x79'),'attributes':[_0xd5dc('0x3d'),_0xd5dc('0x7a'),_0xd5dc('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xd5dc('0x7c'),'attributes':['id','name',_0xd5dc('0x7d')],'where':_0x2b532e['query']['tag']?{'id':_0x2b532e[_0xd5dc('0x47')][_0xd5dc('0x7e')]}:undefined,'required':_0x2b532e[_0xd5dc('0x47')][_0xd5dc('0x7e')]?!![]:![]}];}return db[_0xd5dc('0x75')][_0xd5dc('0x57')](_0x416b9d);})['then'](function(_0x186dcf){_0x5f2151[_0xd5dc('0x6e')]=_0x186dcf;return _0x5f2151;});}})['then'](respondWithFilteredResult(_0xb6f535,_0x416b9d))[_0xd5dc('0x58')](handleError(_0xb6f535,null));};exports[_0xd5dc('0x7f')]=function(_0xfd8cd0,_0x451380){var _0x443628=_0xfd8cd0[_0xd5dc('0x5a')]['id'];var _0x561add=_0xfd8cd0[_0xd5dc('0x60')];var _0x4526b8=0xc8;var _0x11c601=null;return db[_0xd5dc('0x80')][_0xd5dc('0x81')]({'isolationLevel':db[_0xd5dc('0x80')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x437f22){return db[_0xd5dc('0x41')]['findOne']({'where':{'id':_0x443628},'transaction':_0x437f22})[_0xd5dc('0x24')](function(_0x36a7e2){if(_0x36a7e2){return db[_0xd5dc('0x82')][_0xd5dc('0x39')]({'where':{'FaxAccountId':_0x443628},'transaction':_0x437f22})[_0xd5dc('0x24')](function(){var _0x1209e1=_[_0xd5dc('0x40')](_0x561add,function(_0x211369){_0x211369[_0xd5dc('0x6b')]=_0x443628;return _0x211369;});return db[_0xd5dc('0x82')][_0xd5dc('0x83')](_0x1209e1,{'transaction':_0x437f22});});}else{_0x4526b8=0x194;_0x11c601=[];}});})[_0xd5dc('0x24')](function(){if(_0x4526b8!==0x194){return db[_0xd5dc('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x443628},'order':_0xd5dc('0x84')})[_0xd5dc('0x24')](function(_0x48278f){_0x11c601=_0x48278f;});}})[_0xd5dc('0x58')](function(_0x11586b){_0x4526b8=0x1f4;logger['error'](_0x11586b['stack']);if(_0x11586b[_0xd5dc('0x3d')]){delete _0x11586b[_0xd5dc('0x3d')];}_0x11c601=_0x11586b;})[_0xd5dc('0x85')](function(){if(_0x11c601===null){_0x451380[_0xd5dc('0x3b')](_0x4526b8);}else{if(_0x4526b8===0x1f4){_0x451380[_0xd5dc('0x2e')](_0x4526b8)[_0xd5dc('0x3e')](_0x11c601);}else{_0x451380['status'](_0x4526b8)[_0xd5dc('0x2f')](_0x11c601);}}});};exports[_0xd5dc('0x86')]=function(_0x5a3c85,_0x3eb7c0,_0x291097){var _0x2c8acf={};var _0x5593b3={};var _0x330c2a;var _0x2a9cef;return db[_0xd5dc('0x41')][_0xd5dc('0x6c')]({'where':{'id':_0x5a3c85[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x3eb7c0,null))[_0xd5dc('0x24')](function(_0x51eb71){if(_0x51eb71){_0x330c2a=_0x51eb71;_0x5593b3[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db[_0xd5dc('0x82')][_0xd5dc('0x42')]);_0x5593b3[_0xd5dc('0x47')]=_[_0xd5dc('0x5c')](_0x5a3c85[_0xd5dc('0x47')]);_0x5593b3[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x5593b3[_0xd5dc('0x46')],_0x5593b3[_0xd5dc('0x47')]);_0x2c8acf[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x5593b3[_0xd5dc('0x46')],qs[_0xd5dc('0x4b')](_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x4b')]));_0x2c8acf[_0xd5dc('0x4a')]=_0x2c8acf['attributes'][_0xd5dc('0x4c')]?_0x2c8acf[_0xd5dc('0x4a')]:_0x5593b3[_0xd5dc('0x46')];_0x2c8acf[_0xd5dc('0x4f')]=qs[_0xd5dc('0x50')](_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x50')]);_0x2c8acf[_0xd5dc('0x51')]=qs[_0xd5dc('0x48')](_[_0xd5dc('0x52')](_0x5a3c85[_0xd5dc('0x47')],_0x5593b3[_0xd5dc('0x48')]));if(_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x54')]){_0x2c8acf['where']=_[_0xd5dc('0x53')](_0x2c8acf['where'],{'$or':_[_0xd5dc('0x40')](_0x2c8acf[_0xd5dc('0x4a')],function(_0x37cf18){var _0x300f70={};_0x300f70[_0x37cf18]={'$like':'%'+_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x54')]+'%'};return _0x300f70;})});}_0x2c8acf=_[_0xd5dc('0x53')]({},_0x2c8acf,_0x5a3c85[_0xd5dc('0x55')]);return _0x330c2a[_0xd5dc('0x86')](_0x2c8acf);}})['then'](function(_0x16b946){if(_0x16b946){_0x2a9cef=_0x16b946[_0xd5dc('0x4c')];if(!_0x5a3c85['query'][_0xd5dc('0x4d')]('nolimit')){_0x2c8acf[_0xd5dc('0x31')]=qs[_0xd5dc('0x31')](_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x31')]);_0x2c8acf[_0xd5dc('0x30')]=qs['offset'](_0x5a3c85[_0xd5dc('0x47')][_0xd5dc('0x30')]);}return _0x330c2a[_0xd5dc('0x86')](_0x2c8acf);}})[_0xd5dc('0x24')](function(_0x1a8073){if(_0x1a8073){return _0x1a8073?{'count':_0x2a9cef,'rows':_0x1a8073}:null;}})[_0xd5dc('0x24')](respondWithResult(_0x3eb7c0,null))['catch'](handleError(_0x3eb7c0,null));};function Extension(_0x2113cf,_0x5a9f0e,_0x46f1f4,_0x1bda25){this['context']=_0xd5dc('0x87');this[_0xd5dc('0x88')]=_0x2113cf['localstationid'];this[_0xd5dc('0x89')]=_0x1bda25;this[_0xd5dc('0x44')]=_0xd5dc('0x8a');this['description']=_0xd5dc('0x8b');this[_0xd5dc('0x6b')]=_0x2113cf['id'];this[_0xd5dc('0x84')]=_0x5a9f0e;this[_0xd5dc('0x8c')]=_0x46f1f4;}function createExtensionsReciveFax(_0x2da24b){var _0xcf7d88=0x1;var _0x3a3238=[];_0x3a3238[_0xd5dc('0x8d')](new Extension(_0x2da24b,_0xcf7d88,'','Answer'));_0xcf7d88+=0x1;_0x3a3238['push'](new Extension(_0x2da24b,_0xcf7d88,_0xd5dc('0x8e'),_0xd5dc('0x8f')));_0xcf7d88+=0x1;for(var _0x443c75 in _0x2da24b){if(_0x2da24b[_0xd5dc('0x4d')](_0x443c75)&&(_0x443c75==='ecm'||_0x443c75===_0xd5dc('0x90')||_0x443c75===_0xd5dc('0x91')||_0x443c75===_0xd5dc('0x92')||_0x443c75===_0xd5dc('0x93')||_0x443c75===_0xd5dc('0x94')||_0x443c75===_0xd5dc('0x95')||_0x443c75===_0xd5dc('0x96')||_0x443c75===_0xd5dc('0x97'))){_0x3a3238['push'](new Extension(_0x2da24b,_0xcf7d88,_0xd5dc('0x98')+_0x443c75+')='+_0x2da24b[_0x443c75],_0xd5dc('0x8f')));_0xcf7d88+=0x1;}}_0x3a3238[_0xd5dc('0x8d')](new Extension(_0x2da24b,_0xcf7d88,'6',_0xd5dc('0x99')));_0xcf7d88+=0x1;_0x3a3238['push'](new Extension(_0x2da24b,_0xcf7d88,_0xd5dc('0x9a'),_0xd5dc('0x9b')));_0xcf7d88=0x0;return _0x3a3238;}exports[_0xd5dc('0x9c')]=function(_0x55016b,_0x48e3c3,_0x333313){var _0x986aa2;return db['sequelize'][_0xd5dc('0x81')](function(_0x1f7705){return db[_0xd5dc('0x41')][_0xd5dc('0x5f')](_0x55016b[_0xd5dc('0x60')],{'transaction':_0x1f7705})['then'](function(_0x22ae84){_0x986aa2=_0x22ae84['get']({'plain':!![]});return db[_0xd5dc('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x986aa2),{'transaction':_0x1f7705});});})[_0xd5dc('0x24')](function(){return _0x986aa2;})[_0xd5dc('0x24')](respondWithResult(_0x48e3c3,null))[_0xd5dc('0x58')](handleError(_0x48e3c3,null));};exports[_0xd5dc('0x9e')]=function(_0x11f0e8,_0x2f8fd1,_0x3f7922){var _0x9e85f2;return db[_0xd5dc('0x80')][_0xd5dc('0x81')](function(_0x4e8417){return db[_0xd5dc('0x41')]['update'](_0x11f0e8[_0xd5dc('0x60')],{'where':{'id':_0x11f0e8[_0xd5dc('0x60')]['id']},'transaction':_0x4e8417})[_0xd5dc('0x24')](function(_0x822662){return db[_0xd5dc('0x9d')][_0xd5dc('0x39')]({'where':{'FaxAccountId':_0x11f0e8['body']['id']},'transaction':_0x4e8417})[_0xd5dc('0x24')](function(_0x3c56f4){return db[_0xd5dc('0x9d')]['bulkCreate'](createExtensionsReciveFax(_[_0xd5dc('0x76')](_0x11f0e8[_0xd5dc('0x60')],[_0xd5dc('0x9f'),'key','createdAt',_0xd5dc('0xa0'),_0xd5dc('0xa1'),_0xd5dc('0xa2')])),{'transaction':_0x4e8417});});});})[_0xd5dc('0x24')](function(){return db[_0xd5dc('0x41')]['findById'](_0x11f0e8[_0xd5dc('0x60')]['id']);})[_0xd5dc('0x24')](respondWithResult(_0x2f8fd1,null))['catch'](handleError(_0x2f8fd1,null));};exports[_0xd5dc('0xa3')]=function(_0x57174,_0x2611de,_0x2ee46d){var _0x9511d3={'raw':!![],'where':{}};var _0x17ab9f={};var _0x2ab882={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x57174['params']['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x2611de,null))['then'](function(_0xa118a){if(_0xa118a){_0x17ab9f[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db[_0xd5dc('0xa4')]['rawAttributes']);_0x17ab9f['query']=_['keys'](_0x57174[_0xd5dc('0x47')]);_0x17ab9f[_0xd5dc('0x48')]=_['intersection'](_0x17ab9f[_0xd5dc('0x46')],_0x17ab9f['query']);_0x9511d3[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x17ab9f['model'],qs['fields'](_0x57174[_0xd5dc('0x47')]['fields']));_0x9511d3[_0xd5dc('0x4a')]=_0x9511d3[_0xd5dc('0x4a')]['length']?_0x9511d3['attributes']:_0x17ab9f[_0xd5dc('0x46')];if(!_0x57174[_0xd5dc('0x47')]['hasOwnProperty'](_0xd5dc('0x4e'))){_0x9511d3[_0xd5dc('0x31')]=qs[_0xd5dc('0x31')](_0x57174[_0xd5dc('0x47')][_0xd5dc('0x31')]);_0x9511d3[_0xd5dc('0x30')]=qs['offset'](_0x57174[_0xd5dc('0x47')][_0xd5dc('0x30')]);}_0x9511d3['order']=qs['sort'](_0x57174[_0xd5dc('0x47')]['sort']);_0x9511d3[_0xd5dc('0x51')]=qs['filters'](_[_0xd5dc('0x52')](_0x57174['query'],_0x17ab9f[_0xd5dc('0x48')]));_0x9511d3[_0xd5dc('0x51')][_0xd5dc('0x6b')]=_0xa118a['id'];if(_0x57174[_0xd5dc('0x47')]['filter']){_0x9511d3[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0x9511d3[_0xd5dc('0x51')],{'$or':_[_0xd5dc('0x40')](_0x9511d3['attributes'],function(_0x21f7ab){var _0x1335c9={};_0x1335c9[_0x21f7ab]={'$like':'%'+_0x57174[_0xd5dc('0x47')][_0xd5dc('0x54')]+'%'};return _0x1335c9;})});}if(_0x57174['query']['$gte']){var _0x500fa4=_0x57174['query'][_0xd5dc('0xa5')][_0xd5dc('0xa6')](',');var _0x31e0ee={};_0x31e0ee[_0x500fa4[0x0]]={'$gte':moment(_0x500fa4[0x1])[_0xd5dc('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9511d3[_0xd5dc('0x51')]=_['merge'](_0x9511d3['where'],_0x31e0ee);}_0x9511d3=_[_0xd5dc('0x53')]({},_0x9511d3,_0x57174[_0xd5dc('0x55')]);return db[_0xd5dc('0xa4')][_0xd5dc('0x32')]({'where':_0x9511d3[_0xd5dc('0x51')]})[_0xd5dc('0x24')](function(_0x20e56e){_0x2ab882['count']=_0x20e56e;if(_0x57174[_0xd5dc('0x47')]['includeAll']){_0x9511d3[_0xd5dc('0x56')]=[{'all':!![]}];}return db[_0xd5dc('0xa4')]['findAll'](_0x9511d3);})[_0xd5dc('0x24')](function(_0x3793ce){_0x2ab882[_0xd5dc('0x6e')]=_0x3793ce;return _0x2ab882;});}})['then'](respondWithFilteredResult(_0x2611de,_0x9511d3))[_0xd5dc('0x58')](handleError(_0x2611de,null));};exports['send']=function(_0x5dc7af,_0x3b1871,_0x1cd5de){var _0x2b7b,_0x2f941d={},_0x5062d6;if(_0x5dc7af[_0xd5dc('0x60')]['to']){_0x5062d6=_0x5dc7af['body']['to'][0x0];}return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x5dc7af[_0xd5dc('0x5a')]['id']},'include':[{'model':db[_0xd5dc('0xa8')],'as':_0xd5dc('0xa9'),'include':[{'model':db[_0xd5dc('0xaa')],'as':_0xd5dc('0xab'),'where':{'fax':_0x5062d6},'limit':0x1,'order':[[_0xd5dc('0xa0'),_0xd5dc('0xac')]]}]}]})[_0xd5dc('0x24')](handleEntityNotFound(_0x3b1871,null))['then'](function(_0x3917de){_0x2b7b=_0x3917de;if(_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')]&&_0x5dc7af['body'][_0xd5dc('0xad')][_0xd5dc('0x4c')]){for(var _0x1d4581=0x0;_0x1d4581<_0x5dc7af['body']['attachments']['length'];_0x1d4581+=0x1){_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][_0x1d4581]={'filename':_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][_0x1d4581][_0xd5dc('0x3d')],'id':_0x5dc7af['body'][_0xd5dc('0xad')][_0x1d4581]['id'],'path':path[_0xd5dc('0xae')](config['root'],_0xd5dc('0xaf'),_0x5dc7af[_0xd5dc('0x60')]['attachments'][_0x1d4581]['basename'])};}}return respondWithRpcPromise(_0xd5dc('0xb0'),_0xd5dc('0xb0'),{'FaxAccountId':_[_0xd5dc('0xb1')](_0x5dc7af['params']['id'])?undefined:_0x5dc7af['params']['id'],'path':_[_0xd5dc('0xb1')](_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0][_0xd5dc('0x8')])?undefined:_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0][_0xd5dc('0x8')],'fax':_[_0xd5dc('0xb1')](_0x5dc7af[_0xd5dc('0x60')]['to'][0x0])?undefined:_0x5dc7af[_0xd5dc('0x60')]['to'][0x0]},client9002);})[_0xd5dc('0x24')](function(){if(_0x2b7b){if(_[_0xd5dc('0xb1')](_0x5dc7af['body']['from'])){_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xb2')]=util[_0xd5dc('0xa7')]('\x22%s\x22\x20<%s>',_0x2b7b[_0xd5dc('0x3d')],_0x2b7b[_0xd5dc('0xb3')]);}if(_0x2b7b[_0xd5dc('0xa9')]){if(_0x2b7b['List'][_0xd5dc('0xab')]['length']){return _0x2b7b[_0xd5dc('0xa9')]['Contacts'][0x0];}else{return db[_0xd5dc('0xaa')][_0xd5dc('0x5f')](_[_0xd5dc('0xb4')](_0x5dc7af['body'],{'firstName':_0x5dc7af[_0xd5dc('0x60')]['to'][0x0],'phone':_0x5dc7af['body']['to'][0x0],'fax':_0x5dc7af[_0xd5dc('0x60')]['to'][0x0],'ListId':_0x2b7b['ListId']}));}}else{throw new Error(_0xd5dc('0xb5'));}}else{throw new Error(_0xd5dc('0xb6'));}})[_0xd5dc('0x24')](function(_0x596d0e){if(_0x596d0e){return db[_0xd5dc('0x75')][_0xd5dc('0x5e')]({'where':{'ContactId':_0x596d0e['id'],'closed':![],'FaxAccountId':_0x2b7b['id']}})[_0xd5dc('0x24')](function(_0x230cc9){if(_0x230cc9){return[_0x230cc9,![]];}return db[_0xd5dc('0x75')][_0xd5dc('0x5f')]({'UserId':_0x5dc7af[_0xd5dc('0x61')]['id'],'ContactId':_0x596d0e['id'],'FaxAccountId':_0x2b7b['id'],'fax':_0x5dc7af[_0xd5dc('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd5dc('0x53')](_0x5dc7af[_0xd5dc('0x60')],{'read':![],'body':_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0][_0xd5dc('0xb7')],'FaxAccountId':_0x2b7b['id'],'UserId':_0x5dc7af['user']['id'],'ContactId':_0x596d0e['id'],'AttachmentId':_0x5dc7af['body'][_0xd5dc('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xd5dc('0xa4')],'as':'Messages'}]})[_0xd5dc('0x24')](function(_0x3bf9be){return[_0x3bf9be,!![]];});});}else{throw new Error(_0xd5dc('0xb8'));}})[_0xd5dc('0xb9')](function(_0x308b63,_0x373d60){if(_0x373d60){return _0x308b63;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0]['filename'],'FaxAccountId':_0x2b7b['id'],'FaxInteractionId':_0x308b63['id'],'UserId':_0x5dc7af[_0xd5dc('0x61')]['id'],'ContactId':_0x308b63[_0xd5dc('0xba')],'AttachmentId':_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0]['id']})[_0xd5dc('0x24')](function(_0xf66304){_0x308b63[_0xd5dc('0xbb')]['Messages']=[];_0x308b63[_0xd5dc('0xbb')][_0xd5dc('0xbc')][_0xd5dc('0x8d')](_0xf66304[_0xd5dc('0xbb')]);return _0x308b63;});})[_0xd5dc('0x24')](function(_0x499c22){respondWithRpcPromise(_0xd5dc('0xbd'),_0xd5dc('0xbd'),{'FaxAccountId':_['isNil'](_0x5dc7af[_0xd5dc('0x5a')]['id'])?undefined:_0x5dc7af[_0xd5dc('0x5a')]['id'],'path':_[_0xd5dc('0xb1')](_0x5dc7af['body']['attachments'][0x0][_0xd5dc('0x8')])?undefined:_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0][_0xd5dc('0x8')],'fax':_[_0xd5dc('0xb1')](_0x5dc7af[_0xd5dc('0x60')]['to'][0x0])?undefined:_0x5dc7af['body']['to'][0x0],'AttachmentId':_0x5dc7af[_0xd5dc('0x60')][_0xd5dc('0xad')][0x0]['id']},client9002)[_0xd5dc('0x24')](function(_0x45c924){logger[_0xd5dc('0x2c')](_0xd5dc('0xbe'),_0x45c924);})[_0xd5dc('0x58')](function(_0x4fdd6b){logger['info'](_0xd5dc('0xbe'),_0x4fdd6b);});return _0x499c22;})['then'](respondWithResult(_0x3b1871,null))[_0xd5dc('0x58')](handleError(_0x3b1871,null));};exports[_0xd5dc('0xbf')]=function(_0x35229d,_0x41894a,_0x3f3dc5){return db['FaxAccount'][_0xd5dc('0x5e')]({'where':{'id':_0x35229d[_0xd5dc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x41894a,null))['then'](function(_0x3580a7){if(_0x3580a7){return _0x3580a7[_0xd5dc('0xbf')](_0x35229d['body'][_0xd5dc('0x73')],_[_0xd5dc('0x76')](_0x35229d[_0xd5dc('0x60')],['ids','id'])||{})[_0xd5dc('0xb9')](function(_0x2dd0cb){for(var _0x46cea9=0x0;_0x46cea9<_0x35229d[_0xd5dc('0x60')][_0xd5dc('0x73')]['length'];_0x46cea9+=0x1){socket['emit'](_0xd5dc('0xc0'),{'UserId':Number(_0x35229d[_0xd5dc('0x60')]['ids'][_0x46cea9]),'FaxAccountId':Number(_0x35229d[_0xd5dc('0x5a')]['id'])});}return _0x2dd0cb;});}})[_0xd5dc('0x24')](respondWithResult(_0x41894a,null))[_0xd5dc('0x58')](handleError(_0x41894a,null));};exports[_0xd5dc('0xc1')]=function(_0x49b0cb,_0x124590,_0x5bd16d){return db[_0xd5dc('0x41')][_0xd5dc('0x5e')]({'where':{'id':_0x49b0cb[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x124590,null))[_0xd5dc('0x24')](function(_0x458fd9){if(_0x458fd9){return _0x458fd9[_0xd5dc('0xc1')](_0x49b0cb[_0xd5dc('0x47')]['ids'])[_0xd5dc('0x24')](function(){if(_[_0xd5dc('0xc2')](_0x49b0cb[_0xd5dc('0x47')][_0xd5dc('0x73')])){for(var _0x5e4dd7=0x0;_0x5e4dd7<_0x49b0cb['query'][_0xd5dc('0x73')][_0xd5dc('0x4c')];_0x5e4dd7+=0x1){socket['emit'](_0xd5dc('0xc3'),{'UserId':Number(_0x49b0cb[_0xd5dc('0x47')]['ids'][_0x5e4dd7]),'FaxAccountId':Number(_0x49b0cb[_0xd5dc('0x5a')]['id'])});}}else{socket[_0xd5dc('0xc4')](_0xd5dc('0xc3'),{'UserId':Number(_0x49b0cb[_0xd5dc('0x47')][_0xd5dc('0x73')]),'FaxAccountId':Number(_0x49b0cb[_0xd5dc('0x5a')]['id'])});}});}})[_0xd5dc('0x24')](respondWithStatusCode(_0x124590,null))[_0xd5dc('0x58')](handleError(_0x124590,null));};exports[_0xd5dc('0xc5')]=function(_0x2a20ee,_0x5edd45,_0x56e082){var _0x551314={};var _0x92be2e={};var _0x31187a;var _0x5227e8;return db[_0xd5dc('0x41')][_0xd5dc('0x6c')]({'where':{'id':_0x2a20ee[_0xd5dc('0x5a')]['id']}})[_0xd5dc('0x24')](handleEntityNotFound(_0x5edd45,null))[_0xd5dc('0x24')](function(_0x3f2e55){if(_0x3f2e55){_0x31187a=_0x3f2e55;_0x92be2e[_0xd5dc('0x46')]=_[_0xd5dc('0x5c')](db['User']['rawAttributes']);_0x92be2e[_0xd5dc('0x47')]=_[_0xd5dc('0x5c')](_0x2a20ee['query']);_0x92be2e[_0xd5dc('0x48')]=_[_0xd5dc('0x49')](_0x92be2e['model'],_0x92be2e[_0xd5dc('0x47')]);_0x551314[_0xd5dc('0x4a')]=_[_0xd5dc('0x49')](_0x92be2e['model'],qs['fields'](_0x2a20ee[_0xd5dc('0x47')]['fields']));_0x551314['attributes']=_0x551314['attributes'][_0xd5dc('0x4c')]?_0x551314[_0xd5dc('0x4a')]:_0x92be2e[_0xd5dc('0x46')];_0x551314[_0xd5dc('0x4f')]=qs[_0xd5dc('0x50')](_0x2a20ee[_0xd5dc('0x47')]['sort']);_0x551314[_0xd5dc('0x51')]=qs[_0xd5dc('0x48')](_['pick'](_0x2a20ee[_0xd5dc('0x47')],_0x92be2e[_0xd5dc('0x48')]));if(_0x2a20ee[_0xd5dc('0x47')][_0xd5dc('0x54')]){_0x551314[_0xd5dc('0x51')]=_[_0xd5dc('0x53')](_0x551314[_0xd5dc('0x51')],{'$or':_['map'](_0x551314[_0xd5dc('0x4a')],function(_0x22a2e8){var _0x3bb94c={};_0x3bb94c[_0x22a2e8]={'$like':'%'+_0x2a20ee[_0xd5dc('0x47')][_0xd5dc('0x54')]+'%'};return _0x3bb94c;})});}_0x551314=_[_0xd5dc('0x53')]({},_0x551314,_0x2a20ee['options']);return _0x31187a[_0xd5dc('0xc5')](_0x551314);}})[_0xd5dc('0x24')](function(_0x190cdf){if(_0x190cdf){_0x5227e8=_0x190cdf[_0xd5dc('0x4c')];if(!_0x2a20ee[_0xd5dc('0x47')][_0xd5dc('0x4d')](_0xd5dc('0x4e'))){_0x551314['limit']=qs[_0xd5dc('0x31')](_0x2a20ee[_0xd5dc('0x47')][_0xd5dc('0x31')]);_0x551314[_0xd5dc('0x30')]=qs['offset'](_0x2a20ee[_0xd5dc('0x47')][_0xd5dc('0x30')]);}return _0x31187a['getAgents'](_0x551314);}})[_0xd5dc('0x24')](function(_0x5512f2){if(_0x5512f2){return _0x5512f2?{'count':_0x5227e8,'rows':_0x5512f2}:null;}})[_0xd5dc('0x24')](respondWithResult(_0x5edd45,null))[_0xd5dc('0x58')](handleError(_0x5edd45,null));}; \ No newline at end of file +var _0x905b=['apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','VoiceExtension','updateAccountApplications','omit','tech','TrunkId','ListId','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','info','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0xd11a86,_0x5867cf){var _0x2e6ec7=function(_0x3783d2){while(--_0x3783d2){_0xd11a86['push'](_0xd11a86['shift']());}};_0x2e6ec7(++_0x5867cf);}(_0x905b,0x93));var _0xb905=function(_0x5500a6,_0xf95e27){_0x5500a6=_0x5500a6-0x0;var _0x52255b=_0x905b[_0x5500a6];return _0x52255b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb905('0x0'));var zipdir=require(_0xb905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb905('0x2'));var moment=require(_0xb905('0x3'));var BPromise=require(_0xb905('0x4'));var Mustache=require(_0xb905('0x5'));var util=require(_0xb905('0x6'));var path=require(_0xb905('0x7'));var sox=require(_0xb905('0x8'));var csv=require(_0xb905('0x9'));var ejs=require(_0xb905('0xa'));var fs=require('fs');var fs_extra=require(_0xb905('0xb'));var _=require(_0xb905('0xc'));var squel=require(_0xb905('0xd'));var crypto=require(_0xb905('0xe'));var jsforce=require(_0xb905('0xf'));var deskjs=require(_0xb905('0x10'));var toCsv=require(_0xb905('0x9'));var querystring=require(_0xb905('0x11'));var Papa=require(_0xb905('0x12'));var Redis=require(_0xb905('0x13'));var authService=require(_0xb905('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb905('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb905('0x16'));var utils=require(_0xb905('0x17'));var config=require(_0xb905('0x18'));var licenseUtil=require(_0xb905('0x19'));var db=require(_0xb905('0x1a'))['db'];config[_0xb905('0x1b')]=_[_0xb905('0x1c')](config['redis'],{'host':_0xb905('0x1d'),'port':0x18eb});var socket=require(_0xb905('0x1e'))(new Redis(config[_0xb905('0x1b')]));require(_0xb905('0x1f'))[_0xb905('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb905('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0xb905('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x41f5f6,_0x5a10fc,_0x158473,_0x32fb0f){return new BPromise(function(_0x575ea4,_0x38edcf){var _0x4b2829=_0x32fb0f||client;return _0x4b2829[_0xb905('0x23')](_0x41f5f6,_0x158473)[_0xb905('0x24')](function(_0x2519e5){logger['info'](_0xb905('0x25'),_0x5a10fc,_0xb905('0x26'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5a10fc,_0xb905('0x26'),JSON['stringify'](_0x2519e5));if(_0x2519e5[_0xb905('0x27')]){if(_0x2519e5[_0xb905('0x27')][_0xb905('0x28')]===0x1f4){logger[_0xb905('0x27')](_0xb905('0x25'),_0x5a10fc,_0x2519e5[_0xb905('0x27')]['message']);return _0x38edcf(_0x2519e5[_0xb905('0x27')]['message']);}logger['error'](_0xb905('0x25'),_0x5a10fc,_0x2519e5['error'][_0xb905('0x29')]);return _0x575ea4(_0x2519e5['error'][_0xb905('0x29')]);}else{logger['info'](_0xb905('0x25'),_0x5a10fc,_0xb905('0x26'));_0x575ea4(_0x2519e5[_0xb905('0x2a')][_0xb905('0x29')]);}})[_0xb905('0x2b')](function(_0x58841d){logger['error'](_0xb905('0x25'),_0x5a10fc,_0x58841d);_0x38edcf(_0x58841d);});});}function respondWithStatusCode(_0x4e0a6f,_0x58e364){_0x58e364=_0x58e364||0xcc;return function(_0x522e4c){if(_0x522e4c){return _0x4e0a6f[_0xb905('0x2c')](_0x58e364);}return _0x4e0a6f[_0xb905('0x2d')](_0x58e364)[_0xb905('0x2e')]();};}function respondWithResult(_0x3a8f42,_0xdbba8e){_0xdbba8e=_0xdbba8e||0xc8;return function(_0x23abee){if(_0x23abee){return _0x3a8f42[_0xb905('0x2d')](_0xdbba8e)[_0xb905('0x2f')](_0x23abee);}};}function respondWithFilteredResult(_0x48de83,_0xf10607){return function(_0x496376){if(_0x496376){var _0x170362=typeof _0xf10607[_0xb905('0x30')]===_0xb905('0x31')&&typeof _0xf10607[_0xb905('0x32')]===_0xb905('0x31');var _0x2389bd=_0x496376[_0xb905('0x33')];var _0x347e91=_0x170362?0x0:_0xf10607['offset'];var _0xf21041=_0x170362?_0x496376[_0xb905('0x33')]:_0xf10607[_0xb905('0x30')]+_0xf10607['limit'];var _0x2d1c8f;if(_0xf21041>=_0x2389bd){_0xf21041=_0x2389bd;_0x2d1c8f=0xc8;}else{_0x2d1c8f=0xce;}_0x48de83[_0xb905('0x2d')](_0x2d1c8f);return _0x48de83['set'](_0xb905('0x34'),_0x347e91+'-'+_0xf21041+'/'+_0x2389bd)['json'](_0x496376);}return null;};}function patchUpdates(_0x285c0d){return function(_0x843b28){try{jsonpatch[_0xb905('0x35')](_0x843b28,_0x285c0d,!![]);}catch(_0x2d007c){return BPromise[_0xb905('0x36')](_0x2d007c);}return _0x843b28[_0xb905('0x37')]();};}function saveUpdates(_0x185785,_0x599a18){return function(_0x5af494){if(_0x5af494){return _0x5af494[_0xb905('0x38')](_0x185785)[_0xb905('0x24')](function(_0x30d39e){return _0x30d39e;});}return null;};}function removeEntity(_0x31237f,_0xb59f8a){return function(_0x3a835b){if(_0x3a835b){return _0x3a835b[_0xb905('0x39')]()['then'](function(){var _0x4a5ca1=_0x3a835b[_0xb905('0x3a')]({'plain':!![]});var _0x33bfde=_0xb905('0x3b');return db[_0xb905('0x3c')][_0xb905('0x39')]({'where':{'type':_0x33bfde,'resourceId':_0x4a5ca1['id']}})[_0xb905('0x24')](function(){return _0x3a835b;});})[_0xb905('0x24')](function(){_0x31237f[_0xb905('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfca5b9,_0x457099){return function(_0x2f02d7){if(!_0x2f02d7){_0xfca5b9['sendStatus'](0x194);}return _0x2f02d7;};}function handleError(_0x2baf97,_0x621017){_0x621017=_0x621017||0x1f4;return function(_0x99efc8){logger[_0xb905('0x27')](_0x99efc8['stack']);if(_0x99efc8['name']){delete _0x99efc8[_0xb905('0x3d')];}_0x2baf97[_0xb905('0x2d')](_0x621017)[_0xb905('0x3e')](_0x99efc8);};}exports['index']=function(_0x5a496f,_0x3a51e0){var _0x5dc0b9={'include':[{'model':db[_0xb905('0x3f')],'as':_0xb905('0x40')}]},_0x4ff188={},_0x29f899={'count':0x0,'rows':[]};var _0x512a7d=_['map'](db[_0xb905('0x41')][_0xb905('0x42')],function(_0x225f5b){return{'name':_0x225f5b[_0xb905('0x43')],'type':_0x225f5b[_0xb905('0x44')][_0xb905('0x45')]};});_0x4ff188[_0xb905('0x46')]=_[_0xb905('0x47')](_0x512a7d,_0xb905('0x3d'));_0x4ff188[_0xb905('0x48')]=_['keys'](_0x5a496f[_0xb905('0x48')]);_0x4ff188[_0xb905('0x49')]=_[_0xb905('0x4a')](_0x4ff188[_0xb905('0x46')],_0x4ff188[_0xb905('0x48')]);_0x5dc0b9[_0xb905('0x4b')]=_[_0xb905('0x4a')](_0x4ff188['model'],qs[_0xb905('0x4c')](_0x5a496f[_0xb905('0x48')][_0xb905('0x4c')]));_0x5dc0b9[_0xb905('0x4b')]=_0x5dc0b9[_0xb905('0x4b')][_0xb905('0x4d')]?_0x5dc0b9[_0xb905('0x4b')]:_0x4ff188[_0xb905('0x46')];if(!_0x5a496f[_0xb905('0x48')][_0xb905('0x4e')](_0xb905('0x4f'))){_0x5dc0b9[_0xb905('0x32')]=qs[_0xb905('0x32')](_0x5a496f[_0xb905('0x48')][_0xb905('0x32')]);_0x5dc0b9['offset']=qs[_0xb905('0x30')](_0x5a496f['query'][_0xb905('0x30')]);}_0x5dc0b9[_0xb905('0x50')]=qs['sort'](_0x5a496f[_0xb905('0x48')][_0xb905('0x51')]);_0x5dc0b9[_0xb905('0x52')]=qs['filters'](_['pick'](_0x5a496f[_0xb905('0x48')],_0x4ff188[_0xb905('0x49')]),_0x512a7d);if(_0x5a496f[_0xb905('0x48')][_0xb905('0x53')]){_0x5dc0b9['where']=_[_0xb905('0x54')](_0x5dc0b9[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x512a7d,function(_0x2b91bb){if(_0x2b91bb[_0xb905('0x44')]!==_0xb905('0x55')){var _0x268074={};_0x268074[_0x2b91bb[_0xb905('0x3d')]]={'$like':'%'+_0x5a496f[_0xb905('0x48')][_0xb905('0x53')]+'%'};return _0x268074;}})});}_0x5dc0b9=_[_0xb905('0x54')]({},_0x5dc0b9,_0x5a496f[_0xb905('0x56')]);var _0x389637={'where':_0x5dc0b9[_0xb905('0x52')]};return db['FaxAccount'][_0xb905('0x33')](_0x389637)[_0xb905('0x24')](function(_0x163b31){_0x29f899[_0xb905('0x33')]=_0x163b31;if(_0x5a496f[_0xb905('0x48')][_0xb905('0x57')]){_0x5dc0b9[_0xb905('0x58')]=[{'all':!![]}];}return db[_0xb905('0x41')][_0xb905('0x59')](_0x5dc0b9);})[_0xb905('0x24')](function(_0x5a62da){_0x29f899[_0xb905('0x5a')]=_0x5a62da;return _0x29f899;})[_0xb905('0x24')](respondWithFilteredResult(_0x3a51e0,_0x5dc0b9))[_0xb905('0x2b')](handleError(_0x3a51e0,null));};exports[_0xb905('0x5b')]=function(_0x1c71ba,_0x106b7b){var _0x53e4d8={'raw':![],'where':{'id':_0x1c71ba[_0xb905('0x5c')]['id']},'include':[{'model':db[_0xb905('0x3f')],'as':'mandatoryDispositionPause'}]},_0x4afa6d={};_0x4afa6d[_0xb905('0x46')]=_[_0xb905('0x5d')](db[_0xb905('0x41')][_0xb905('0x42')]);_0x4afa6d[_0xb905('0x48')]=_['keys'](_0x1c71ba[_0xb905('0x48')]);_0x4afa6d[_0xb905('0x49')]=_[_0xb905('0x4a')](_0x4afa6d[_0xb905('0x46')],_0x4afa6d['query']);_0x53e4d8[_0xb905('0x4b')]=_[_0xb905('0x4a')](_0x4afa6d['model'],qs[_0xb905('0x4c')](_0x1c71ba[_0xb905('0x48')][_0xb905('0x4c')]));_0x53e4d8[_0xb905('0x4b')]=_0x53e4d8[_0xb905('0x4b')]['length']?_0x53e4d8['attributes']:_0x4afa6d[_0xb905('0x46')];if(_0x1c71ba[_0xb905('0x48')][_0xb905('0x57')]){_0x53e4d8[_0xb905('0x58')]=[{'all':!![]}];}_0x53e4d8=_['merge']({},_0x53e4d8,_0x1c71ba[_0xb905('0x56')]);return db[_0xb905('0x41')][_0xb905('0x5e')](_0x53e4d8)['then'](handleEntityNotFound(_0x106b7b,null))['then'](respondWithResult(_0x106b7b,null))[_0xb905('0x2b')](handleError(_0x106b7b,null));};exports[_0xb905('0x5f')]=function(_0x4456a7,_0x115b04){return db['FaxAccount'][_0xb905('0x5f')](_0x4456a7['body'],{})[_0xb905('0x24')](function(_0x503442){var _0x419c54=_0x4456a7[_0xb905('0x60')]['get']({'plain':!![]});if(!_0x419c54)throw new Error(_0xb905('0x61'));if(_0x419c54[_0xb905('0x62')]===_0xb905('0x60')){var _0x4e68d2=_0x503442['get']({'plain':!![]});var _0x3a06a5=_0xb905('0x3b');return db[_0xb905('0x63')]['find']({'where':{'name':_0x3a06a5,'userProfileId':_0x419c54[_0xb905('0x64')]},'raw':!![]})[_0xb905('0x24')](function(_0x1bced5){if(_0x1bced5&&_0x1bced5[_0xb905('0x65')]===0x0){return db[_0xb905('0x3c')][_0xb905('0x5f')]({'name':_0x4e68d2[_0xb905('0x3d')],'resourceId':_0x4e68d2['id'],'type':_0x1bced5[_0xb905('0x3d')],'sectionId':_0x1bced5['id']},{})[_0xb905('0x24')](function(){return _0x503442;});}else{return _0x503442;}})[_0xb905('0x2b')](function(_0x3fa136){logger[_0xb905('0x27')](_0xb905('0x66'),_0x3fa136);throw _0x3fa136;});}return _0x503442;})[_0xb905('0x24')](respondWithResult(_0x115b04,0xc9))[_0xb905('0x2b')](handleError(_0x115b04,null));};exports[_0xb905('0x38')]=function(_0x3b1596,_0x4d24d5){if(_0x3b1596[_0xb905('0x67')]['id']){delete _0x3b1596['body']['id'];}return db['FaxAccount'][_0xb905('0x5e')]({'where':{'id':_0x3b1596[_0xb905('0x5c')]['id']},'include':[{'model':db[_0xb905('0x3f')],'as':_0xb905('0x40')}]})[_0xb905('0x24')](handleEntityNotFound(_0x4d24d5,null))[_0xb905('0x24')](saveUpdates(_0x3b1596[_0xb905('0x67')],null))[_0xb905('0x24')](respondWithResult(_0x4d24d5,null))[_0xb905('0x2b')](handleError(_0x4d24d5,null));};exports[_0xb905('0x39')]=function(_0x2ef9c7,_0x426b34){return db[_0xb905('0x41')][_0xb905('0x5e')]({'where':{'id':_0x2ef9c7[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x426b34,null))[_0xb905('0x24')](removeEntity(_0x426b34,null))[_0xb905('0x2b')](handleError(_0x426b34,null));};exports[_0xb905('0x68')]=function(_0x2f4bd,_0x5bf540){return db[_0xb905('0x41')][_0xb905('0x68')]()[_0xb905('0x24')](respondWithResult(_0x5bf540,null))[_0xb905('0x2b')](handleError(_0x5bf540,null));};exports[_0xb905('0x69')]=function(_0x169dfc,_0x4c6888,_0x234aa3){if(_0x169dfc['body']['id']){delete _0x169dfc['body']['id'];}return db[_0xb905('0x41')]['find']({'where':{'id':_0x169dfc[_0xb905('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4c6888,null))[_0xb905('0x24')](function(_0x5dcb97){if(_0x5dcb97){_0x169dfc[_0xb905('0x67')][_0xb905('0x6a')]=_0x5dcb97['id'];return db[_0xb905('0x6b')][_0xb905('0x5f')](_0x169dfc['body']);}})['then'](respondWithResult(_0x4c6888,null))['catch'](handleError(_0x4c6888,null));};exports[_0xb905('0x6c')]=function(_0x550e9a,_0x1a01a8,_0x364e62){var _0x210961={'raw':![],'where':{}};var _0x4418f8={};var _0x3d74db={'count':0x0,'rows':[]};return db[_0xb905('0x41')]['findOne']({'where':{'id':_0x550e9a['params']['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x1a01a8,null))['then'](function(_0x33a79a){if(_0x33a79a){_0x4418f8['model']=_[_0xb905('0x5d')](db[_0xb905('0x6b')]['rawAttributes']);_0x4418f8[_0xb905('0x48')]=_[_0xb905('0x5d')](_0x550e9a[_0xb905('0x48')]);_0x4418f8['filters']=_[_0xb905('0x4a')](_0x4418f8[_0xb905('0x46')],_0x4418f8['query']);_0x210961[_0xb905('0x4b')]=_['intersection'](_0x4418f8[_0xb905('0x46')],qs['fields'](_0x550e9a['query'][_0xb905('0x4c')]));_0x210961[_0xb905('0x4b')]=_0x210961['attributes']['length']?_0x210961[_0xb905('0x4b')]:_0x4418f8[_0xb905('0x46')];if(!_0x550e9a[_0xb905('0x48')]['hasOwnProperty']('nolimit')){_0x210961[_0xb905('0x32')]=qs['limit'](_0x550e9a[_0xb905('0x48')][_0xb905('0x32')]);_0x210961[_0xb905('0x30')]=qs[_0xb905('0x30')](_0x550e9a['query']['offset']);}_0x210961[_0xb905('0x50')]=qs[_0xb905('0x51')](_0x550e9a['query'][_0xb905('0x51')]);_0x210961[_0xb905('0x52')]=qs['filters'](_[_0xb905('0x6d')](_0x550e9a[_0xb905('0x48')],_0x4418f8[_0xb905('0x49')]));_0x210961[_0xb905('0x52')][_0xb905('0x6a')]=_0x33a79a['id'];if(_0x550e9a['query'][_0xb905('0x53')]){_0x210961[_0xb905('0x52')]=_['merge'](_0x210961[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x210961[_0xb905('0x4b')],function(_0x147dbf){var _0x361756={};_0x361756[_0x147dbf]={'$like':'%'+_0x550e9a[_0xb905('0x48')][_0xb905('0x53')]+'%'};return _0x361756;})});}_0x210961=_[_0xb905('0x54')]({},_0x210961,_0x550e9a['options']);return db[_0xb905('0x6b')][_0xb905('0x33')]({'where':_0x210961[_0xb905('0x52')]})['then'](function(_0x5515ab){_0x3d74db[_0xb905('0x33')]=_0x5515ab;if(_0x550e9a['query']['includeAll']){_0x210961[_0xb905('0x58')]=[{'all':!![]}];}return db[_0xb905('0x6b')][_0xb905('0x59')](_0x210961);})[_0xb905('0x24')](function(_0x583eae){_0x3d74db['rows']=_0x583eae;return _0x3d74db;});}})[_0xb905('0x24')](respondWithFilteredResult(_0x1a01a8,_0x210961))[_0xb905('0x2b')](handleError(_0x1a01a8,null));};exports[_0xb905('0x6e')]=function(_0xcb602a,_0x25efda,_0x2935a3){return db[_0xb905('0x41')][_0xb905('0x5e')]({'where':{'id':_0xcb602a[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x25efda,null))[_0xb905('0x24')](function(_0x4735b0){if(_0x4735b0){return _0x4735b0[_0xb905('0x6e')](_0xcb602a[_0xb905('0x48')][_0xb905('0x6f')]);}})[_0xb905('0x24')](respondWithStatusCode(_0x25efda,null))[_0xb905('0x2b')](handleError(_0x25efda,null));};exports[_0xb905('0x70')]=function(_0x25a34f,_0xf02ab2,_0x5fd874){if(_0x25a34f[_0xb905('0x67')]['id']){delete _0x25a34f[_0xb905('0x67')]['id'];}return db[_0xb905('0x41')]['find']({'where':{'id':_0x25a34f[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0xf02ab2,null))[_0xb905('0x24')](function(_0x48051e){if(_0x48051e){_0x25a34f[_0xb905('0x67')][_0xb905('0x6a')]=_0x48051e['id'];return db[_0xb905('0x71')]['create'](_0x25a34f['body']);}})[_0xb905('0x24')](respondWithResult(_0xf02ab2,null))[_0xb905('0x2b')](handleError(_0xf02ab2,null));};exports['getAnswers']=function(_0x5040b9,_0x467be3,_0x1f946d){var _0x2f59eb={'raw':![],'where':{}};var _0x2a4172={};var _0x26a822={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb905('0x72')]({'where':{'id':_0x5040b9[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x467be3,null))[_0xb905('0x24')](function(_0x1524ad){if(_0x1524ad){_0x2a4172[_0xb905('0x46')]=_[_0xb905('0x5d')](db[_0xb905('0x71')][_0xb905('0x42')]);_0x2a4172[_0xb905('0x48')]=_['keys'](_0x5040b9[_0xb905('0x48')]);_0x2a4172[_0xb905('0x49')]=_['intersection'](_0x2a4172[_0xb905('0x46')],_0x2a4172['query']);_0x2f59eb['attributes']=_[_0xb905('0x4a')](_0x2a4172[_0xb905('0x46')],qs[_0xb905('0x4c')](_0x5040b9[_0xb905('0x48')][_0xb905('0x4c')]));_0x2f59eb[_0xb905('0x4b')]=_0x2f59eb[_0xb905('0x4b')][_0xb905('0x4d')]?_0x2f59eb[_0xb905('0x4b')]:_0x2a4172[_0xb905('0x46')];if(!_0x5040b9[_0xb905('0x48')]['hasOwnProperty'](_0xb905('0x4f'))){_0x2f59eb[_0xb905('0x32')]=qs[_0xb905('0x32')](_0x5040b9[_0xb905('0x48')][_0xb905('0x32')]);_0x2f59eb['offset']=qs[_0xb905('0x30')](_0x5040b9[_0xb905('0x48')][_0xb905('0x30')]);}_0x2f59eb[_0xb905('0x50')]=qs[_0xb905('0x51')](_0x5040b9['query'][_0xb905('0x51')]);_0x2f59eb[_0xb905('0x52')]=qs['filters'](_[_0xb905('0x6d')](_0x5040b9[_0xb905('0x48')],_0x2a4172[_0xb905('0x49')]));_0x2f59eb[_0xb905('0x52')][_0xb905('0x6a')]=_0x1524ad['id'];if(_0x5040b9['query'][_0xb905('0x53')]){_0x2f59eb['where']=_[_0xb905('0x54')](_0x2f59eb[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x2f59eb[_0xb905('0x4b')],function(_0x50f0db){var _0x12f18d={};_0x12f18d[_0x50f0db]={'$like':'%'+_0x5040b9[_0xb905('0x48')][_0xb905('0x53')]+'%'};return _0x12f18d;})});}_0x2f59eb=_[_0xb905('0x54')]({},_0x2f59eb,_0x5040b9['options']);return db[_0xb905('0x71')][_0xb905('0x33')]({'where':_0x2f59eb[_0xb905('0x52')]})[_0xb905('0x24')](function(_0x5a3915){_0x26a822[_0xb905('0x33')]=_0x5a3915;if(_0x5040b9[_0xb905('0x48')][_0xb905('0x57')]){_0x2f59eb[_0xb905('0x58')]=[{'all':!![]}];}return db[_0xb905('0x71')][_0xb905('0x59')](_0x2f59eb);})[_0xb905('0x24')](function(_0x57ec98){_0x26a822[_0xb905('0x5a')]=_0x57ec98;return _0x26a822;});}})['then'](respondWithFilteredResult(_0x467be3,_0x2f59eb))[_0xb905('0x2b')](handleError(_0x467be3,null));};exports[_0xb905('0x73')]=function(_0x461623,_0x248799,_0x3f973b){return db['FaxAccount'][_0xb905('0x5e')]({'where':{'id':_0x461623['params']['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x248799,null))['then'](function(_0xd20ca4){if(_0xd20ca4){return _0xd20ca4[_0xb905('0x73')](_0x461623[_0xb905('0x48')][_0xb905('0x6f')]);}})[_0xb905('0x24')](respondWithStatusCode(_0x248799,null))[_0xb905('0x2b')](handleError(_0x248799,null));};exports[_0xb905('0x74')]=function(_0x179d06,_0x180aa3,_0x2de3f9){return db[_0xb905('0x75')][_0xb905('0x5e')]({'where':{'id':_0x179d06[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x180aa3,null))[_0xb905('0x24')](function(_0x4590e6){if(_0x4590e6){return _0x4590e6[_0xb905('0x74')](_0x179d06[_0xb905('0x67')]['ids'],_['omit'](_0x179d06[_0xb905('0x67')],[_0xb905('0x6f'),'id'])||{});}})[_0xb905('0x24')](respondWithResult(_0x180aa3,null))[_0xb905('0x2b')](handleError(_0x180aa3,null));};exports['getInteractions']=function(_0x320b79,_0x613e91,_0x4cf941){var _0x1aaebb={'raw':![],'where':{}};var _0x1376aa={};var _0x11277c={'count':0x0,'rows':[]};return db[_0xb905('0x41')][_0xb905('0x72')]({'where':{'id':_0x320b79['params']['id']}})['then'](handleEntityNotFound(_0x613e91,null))[_0xb905('0x24')](function(_0x2cef86){if(_0x2cef86){_0x1376aa[_0xb905('0x46')]=_[_0xb905('0x5d')](db[_0xb905('0x75')][_0xb905('0x42')]);_0x1376aa[_0xb905('0x48')]=_[_0xb905('0x5d')](_0x320b79[_0xb905('0x48')]);_0x1376aa['filters']=_[_0xb905('0x4a')](_0x1376aa[_0xb905('0x46')],_0x1376aa[_0xb905('0x48')]);_0x1aaebb['attributes']=_['intersection'](_0x1376aa[_0xb905('0x46')],qs[_0xb905('0x4c')](_0x320b79[_0xb905('0x48')][_0xb905('0x4c')]));_0x1aaebb['attributes']=_0x1aaebb['attributes'][_0xb905('0x4d')]?_0x1aaebb[_0xb905('0x4b')]:_0x1376aa[_0xb905('0x46')];if(!_0x320b79['query'][_0xb905('0x4e')](_0xb905('0x4f'))){_0x1aaebb['limit']=qs[_0xb905('0x32')](_0x320b79[_0xb905('0x48')]['limit']);_0x1aaebb[_0xb905('0x30')]=qs[_0xb905('0x30')](_0x320b79[_0xb905('0x48')][_0xb905('0x30')]);}_0x1aaebb[_0xb905('0x50')]=qs[_0xb905('0x51')](_0x320b79['query'][_0xb905('0x51')]);_0x1aaebb[_0xb905('0x52')]=qs[_0xb905('0x49')](_[_0xb905('0x6d')](_0x320b79[_0xb905('0x48')],_0x1376aa['filters']));_0x1aaebb[_0xb905('0x52')][_0xb905('0x6a')]=_0x2cef86['id'];if(_0x320b79[_0xb905('0x48')][_0xb905('0x53')]){_0x1aaebb[_0xb905('0x52')]=_[_0xb905('0x54')](_0x1aaebb[_0xb905('0x52')],{'$or':_['map'](_0x1aaebb[_0xb905('0x4b')],function(_0x2dec0a){var _0x1274f5={};_0x1274f5[_0x2dec0a]={'$like':'%'+_0x320b79[_0xb905('0x48')][_0xb905('0x53')]+'%'};return _0x1274f5;})});}_0x1aaebb=_[_0xb905('0x54')]({},_0x1aaebb,_0x320b79['options']);return db[_0xb905('0x75')][_0xb905('0x33')]({'where':_0x1aaebb['where']})[_0xb905('0x24')](function(_0x162b2c){_0x11277c[_0xb905('0x33')]=_0x162b2c;if(_0x320b79[_0xb905('0x48')]['includeAll']){_0x1aaebb[_0xb905('0x58')]=[{'model':db[_0xb905('0x76')],'as':'Contact','required':![]},{'model':db[_0xb905('0x77')],'as':_0xb905('0x78'),'attributes':['name','fullname',_0xb905('0x79')],'required':![]},{'model':db[_0xb905('0x7a')],'as':_0xb905('0x7b'),'attributes':['id',_0xb905('0x3d'),_0xb905('0x7c')],'where':_0x320b79[_0xb905('0x48')][_0xb905('0x7d')]?{'id':_0x320b79['query'][_0xb905('0x7d')]}:undefined,'required':_0x320b79[_0xb905('0x48')][_0xb905('0x7d')]?!![]:![]}];}return db[_0xb905('0x75')][_0xb905('0x59')](_0x1aaebb);})[_0xb905('0x24')](function(_0x4c6a69){_0x11277c['rows']=_0x4c6a69;return _0x11277c;});}})['then'](respondWithFilteredResult(_0x613e91,_0x1aaebb))[_0xb905('0x2b')](handleError(_0x613e91,null));};exports[_0xb905('0x7e')]=function(_0x519aa4,_0x1fd814){var _0x1b27d7=_0x519aa4['params']['id'];var _0x9c4223=_0x519aa4[_0xb905('0x67')];var _0x1483f0=0xc8;var _0x41c4b3=null;return db['sequelize'][_0xb905('0x7f')]({'isolationLevel':db['sequelize'][_0xb905('0x80')][_0xb905('0x81')][_0xb905('0x82')]},function(_0x4aabb4){return db[_0xb905('0x41')][_0xb905('0x72')]({'where':{'id':_0x1b27d7},'transaction':_0x4aabb4})['then'](function(_0x4da918){if(_0x4da918){return db[_0xb905('0x83')]['destroy']({'where':{'FaxAccountId':_0x1b27d7},'transaction':_0x4aabb4})[_0xb905('0x24')](function(){var _0x1a6ca0=_['map'](_0x9c4223,function(_0x5cde08){_0x5cde08[_0xb905('0x6a')]=_0x1b27d7;return _0x5cde08;});return db['FaxApplication'][_0xb905('0x84')](_0x1a6ca0,{'transaction':_0x4aabb4});});}else{_0x1483f0=0x194;_0x41c4b3=[];}});})[_0xb905('0x24')](function(){if(_0x1483f0!==0x194){return db['FaxApplication'][_0xb905('0x85')]({'where':{'FaxAccountId':_0x1b27d7},'order':'priority'})[_0xb905('0x24')](function(_0x48e258){_0x41c4b3=_0x48e258;});}})[_0xb905('0x2b')](function(_0x342461){_0x1483f0=0x1f4;logger[_0xb905('0x27')](_0x342461['stack']);if(_0x342461['name']){delete _0x342461[_0xb905('0x3d')];}_0x41c4b3=_0x342461;})[_0xb905('0x86')](function(){if(_0x41c4b3===null){_0x1fd814[_0xb905('0x2c')](_0x1483f0);}else{if(_0x1483f0===0x1f4){_0x1fd814[_0xb905('0x2d')](_0x1483f0)[_0xb905('0x3e')](_0x41c4b3);}else{_0x1fd814['status'](_0x1483f0)[_0xb905('0x2f')](_0x41c4b3);}}});};exports['getApplications']=function(_0x4cebee,_0x2eb31d,_0x2729f8){var _0x5a8003={};var _0xb76fdf={};var _0x37a6be;var _0x9de5b6;return db[_0xb905('0x41')][_0xb905('0x72')]({'where':{'id':_0x4cebee[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x2eb31d,null))[_0xb905('0x24')](function(_0x262e30){if(_0x262e30){_0x37a6be=_0x262e30;_0xb76fdf['model']=_[_0xb905('0x5d')](db[_0xb905('0x83')]['rawAttributes']);_0xb76fdf['query']=_[_0xb905('0x5d')](_0x4cebee[_0xb905('0x48')]);_0xb76fdf['filters']=_[_0xb905('0x4a')](_0xb76fdf[_0xb905('0x46')],_0xb76fdf[_0xb905('0x48')]);_0x5a8003[_0xb905('0x4b')]=_['intersection'](_0xb76fdf[_0xb905('0x46')],qs['fields'](_0x4cebee[_0xb905('0x48')][_0xb905('0x4c')]));_0x5a8003[_0xb905('0x4b')]=_0x5a8003[_0xb905('0x4b')][_0xb905('0x4d')]?_0x5a8003[_0xb905('0x4b')]:_0xb76fdf[_0xb905('0x46')];_0x5a8003[_0xb905('0x50')]=qs['sort'](_0x4cebee[_0xb905('0x48')][_0xb905('0x51')]);_0x5a8003['where']=qs[_0xb905('0x49')](_[_0xb905('0x6d')](_0x4cebee[_0xb905('0x48')],_0xb76fdf['filters']));if(_0x4cebee[_0xb905('0x48')][_0xb905('0x53')]){_0x5a8003['where']=_[_0xb905('0x54')](_0x5a8003[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x5a8003[_0xb905('0x4b')],function(_0x3a5d72){var _0x302c85={};_0x302c85[_0x3a5d72]={'$like':'%'+_0x4cebee[_0xb905('0x48')][_0xb905('0x53')]+'%'};return _0x302c85;})});}_0x5a8003=_[_0xb905('0x54')]({},_0x5a8003,_0x4cebee[_0xb905('0x56')]);return _0x37a6be['getApplications'](_0x5a8003);}})[_0xb905('0x24')](function(_0x1ece99){if(_0x1ece99){_0x9de5b6=_0x1ece99[_0xb905('0x4d')];if(!_0x4cebee[_0xb905('0x48')][_0xb905('0x4e')](_0xb905('0x4f'))){_0x5a8003[_0xb905('0x32')]=qs[_0xb905('0x32')](_0x4cebee[_0xb905('0x48')][_0xb905('0x32')]);_0x5a8003['offset']=qs[_0xb905('0x30')](_0x4cebee[_0xb905('0x48')][_0xb905('0x30')]);}return _0x37a6be[_0xb905('0x87')](_0x5a8003);}})[_0xb905('0x24')](function(_0x5d8e24){if(_0x5d8e24){return _0x5d8e24?{'count':_0x9de5b6,'rows':_0x5d8e24}:null;}})[_0xb905('0x24')](respondWithResult(_0x2eb31d,null))[_0xb905('0x2b')](handleError(_0x2eb31d,null));};function Extension(_0x3fefc4,_0x5c194e,_0x425cd2,_0x567968){this[_0xb905('0x88')]='from-voip-provider';this[_0xb905('0x89')]=_0x3fefc4[_0xb905('0x8a')];this[_0xb905('0x8b')]=_0x567968;this[_0xb905('0x44')]=_0xb905('0x8c');this[_0xb905('0x8d')]=_0xb905('0x8e');this['FaxAccountId']=_0x3fefc4['id'];this[_0xb905('0x8f')]=_0x5c194e;this[_0xb905('0x90')]=_0x425cd2;}function createExtensionsReciveFax(_0x3d30a8){var _0x4660f3=0x1;var _0x1216e9=[];_0x1216e9[_0xb905('0x91')](new Extension(_0x3d30a8,_0x4660f3,'',_0xb905('0x92')));_0x4660f3+=0x1;_0x1216e9['push'](new Extension(_0x3d30a8,_0x4660f3,_0xb905('0x93'),_0xb905('0x94')));_0x4660f3+=0x1;for(var _0x110f7d in _0x3d30a8){if(_0x3d30a8['hasOwnProperty'](_0x110f7d)&&(_0x110f7d==='ecm'||_0x110f7d===_0xb905('0x8a')||_0x110f7d==='gateway'||_0x110f7d===_0xb905('0x95')||_0x110f7d===_0xb905('0x96')||_0x110f7d==='maxrate'||_0x110f7d===_0xb905('0x97')||_0x110f7d===_0xb905('0x98')||_0x110f7d==='t38timeout')){_0x1216e9[_0xb905('0x91')](new Extension(_0x3d30a8,_0x4660f3,_0xb905('0x99')+_0x110f7d+')='+_0x3d30a8[_0x110f7d],_0xb905('0x94')));_0x4660f3+=0x1;}}_0x1216e9[_0xb905('0x91')](new Extension(_0x3d30a8,_0x4660f3,'6',_0xb905('0x9a')));_0x4660f3+=0x1;_0x1216e9[_0xb905('0x91')](new Extension(_0x3d30a8,_0x4660f3,_0xb905('0x9b'),_0xb905('0x9c')));_0x4660f3=0x0;return _0x1216e9;}exports['addAccountApplications']=function(_0x42bbac,_0x22e0c8,_0x56b49e){var _0x39be1d;return db[_0xb905('0x9d')][_0xb905('0x7f')](function(_0x446307){return db[_0xb905('0x41')]['create'](_0x42bbac['body'],{'transaction':_0x446307})[_0xb905('0x24')](function(_0xd4bda6){_0x39be1d=_0xd4bda6[_0xb905('0x3a')]({'plain':!![]});return db[_0xb905('0x9e')][_0xb905('0x84')](createExtensionsReciveFax(_0x39be1d),{'transaction':_0x446307});});})[_0xb905('0x24')](function(){return _0x39be1d;})['then'](respondWithResult(_0x22e0c8,null))[_0xb905('0x2b')](handleError(_0x22e0c8,null));};exports[_0xb905('0x9f')]=function(_0x2d0fff,_0x19c0ae,_0x4887d2){var _0x2d5a06;return db[_0xb905('0x9d')]['transaction'](function(_0x176a06){return db[_0xb905('0x41')]['update'](_0x2d0fff[_0xb905('0x67')],{'where':{'id':_0x2d0fff[_0xb905('0x67')]['id']},'transaction':_0x176a06})['then'](function(_0x176c44){return db[_0xb905('0x9e')]['destroy']({'where':{'FaxAccountId':_0x2d0fff[_0xb905('0x67')]['id']},'transaction':_0x176a06})[_0xb905('0x24')](function(_0x5dd416){return db[_0xb905('0x9e')][_0xb905('0x84')](createExtensionsReciveFax(_[_0xb905('0xa0')](_0x2d0fff[_0xb905('0x67')],[_0xb905('0xa1'),_0xb905('0x45'),'createdAt','updatedAt',_0xb905('0xa2'),_0xb905('0xa3')])),{'transaction':_0x176a06});});});})[_0xb905('0x24')](function(){return db[_0xb905('0x41')]['findById'](_0x2d0fff[_0xb905('0x67')]['id']);})[_0xb905('0x24')](respondWithResult(_0x19c0ae,null))['catch'](handleError(_0x19c0ae,null));};exports[_0xb905('0xa4')]=function(_0x25c5cc,_0x3b9cb6,_0x43b73f){var _0x33e52f={'raw':!![],'where':{}};var _0x138fc6={};var _0x223337={'count':0x0,'rows':[]};return db[_0xb905('0x41')][_0xb905('0x72')]({'where':{'id':_0x25c5cc[_0xb905('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3b9cb6,null))[_0xb905('0x24')](function(_0xd03957){if(_0xd03957){_0x138fc6[_0xb905('0x46')]=_[_0xb905('0x5d')](db[_0xb905('0xa5')][_0xb905('0x42')]);_0x138fc6[_0xb905('0x48')]=_[_0xb905('0x5d')](_0x25c5cc[_0xb905('0x48')]);_0x138fc6['filters']=_[_0xb905('0x4a')](_0x138fc6[_0xb905('0x46')],_0x138fc6['query']);_0x33e52f[_0xb905('0x4b')]=_[_0xb905('0x4a')](_0x138fc6[_0xb905('0x46')],qs['fields'](_0x25c5cc[_0xb905('0x48')]['fields']));_0x33e52f[_0xb905('0x4b')]=_0x33e52f['attributes']['length']?_0x33e52f[_0xb905('0x4b')]:_0x138fc6[_0xb905('0x46')];if(!_0x25c5cc[_0xb905('0x48')]['hasOwnProperty'](_0xb905('0x4f'))){_0x33e52f['limit']=qs[_0xb905('0x32')](_0x25c5cc['query'][_0xb905('0x32')]);_0x33e52f[_0xb905('0x30')]=qs[_0xb905('0x30')](_0x25c5cc['query'][_0xb905('0x30')]);}_0x33e52f['order']=qs[_0xb905('0x51')](_0x25c5cc[_0xb905('0x48')][_0xb905('0x51')]);_0x33e52f[_0xb905('0x52')]=qs[_0xb905('0x49')](_[_0xb905('0x6d')](_0x25c5cc['query'],_0x138fc6['filters']));_0x33e52f[_0xb905('0x52')][_0xb905('0x6a')]=_0xd03957['id'];if(_0x25c5cc[_0xb905('0x48')]['filter']){_0x33e52f[_0xb905('0x52')]=_[_0xb905('0x54')](_0x33e52f[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x33e52f[_0xb905('0x4b')],function(_0x3571e3){var _0x531cc0={};_0x531cc0[_0x3571e3]={'$like':'%'+_0x25c5cc[_0xb905('0x48')]['filter']+'%'};return _0x531cc0;})});}if(_0x25c5cc[_0xb905('0x48')]['$gte']){var _0x3a1f71=_0x25c5cc[_0xb905('0x48')][_0xb905('0xa6')]['split'](',');var _0x1dcdb9={};_0x1dcdb9[_0x3a1f71[0x0]]={'$gte':moment(_0x3a1f71[0x1])[_0xb905('0xa7')](_0xb905('0xa8'))};_0x33e52f['where']=_['merge'](_0x33e52f[_0xb905('0x52')],_0x1dcdb9);}_0x33e52f=_['merge']({},_0x33e52f,_0x25c5cc[_0xb905('0x56')]);return db[_0xb905('0xa5')][_0xb905('0x33')]({'where':_0x33e52f['where']})[_0xb905('0x24')](function(_0x5a4484){_0x223337[_0xb905('0x33')]=_0x5a4484;if(_0x25c5cc[_0xb905('0x48')]['includeAll']){_0x33e52f[_0xb905('0x58')]=[{'all':!![]}];}return db[_0xb905('0xa5')]['findAll'](_0x33e52f);})[_0xb905('0x24')](function(_0x538f1e){_0x223337[_0xb905('0x5a')]=_0x538f1e;return _0x223337;});}})['then'](respondWithFilteredResult(_0x3b9cb6,_0x33e52f))[_0xb905('0x2b')](handleError(_0x3b9cb6,null));};exports[_0xb905('0x3e')]=function(_0x57cf7e,_0x346929,_0x4d7ecf){var _0x21dbae,_0xc8b5a6={},_0x4950df;if(_0x57cf7e[_0xb905('0x67')]['to']){_0x4950df=_0x57cf7e[_0xb905('0x67')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x57cf7e[_0xb905('0x5c')]['id']},'include':[{'model':db[_0xb905('0xa9')],'as':_0xb905('0xaa'),'include':[{'model':db['CmContact'],'as':_0xb905('0xab'),'where':{'fax':_0x4950df},'limit':0x1,'order':[[_0xb905('0xac'),_0xb905('0xad')]]}]}]})[_0xb905('0x24')](handleEntityNotFound(_0x346929,null))[_0xb905('0x24')](function(_0x447304){_0x21dbae=_0x447304;if(_0x57cf7e[_0xb905('0x67')]['attachments']&&_0x57cf7e[_0xb905('0x67')]['attachments'][_0xb905('0x4d')]){for(var _0x56bfad=0x0;_0x56bfad<_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][_0xb905('0x4d')];_0x56bfad+=0x1){_0x57cf7e['body'][_0xb905('0xae')][_0x56bfad]={'filename':_0x57cf7e['body'][_0xb905('0xae')][_0x56bfad][_0xb905('0x3d')],'id':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][_0x56bfad]['id'],'path':path['join'](config['root'],'server/files/attachments',_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][_0x56bfad][_0xb905('0xaf')])};}}return respondWithRpcPromise(_0xb905('0xb0'),_0xb905('0xb0'),{'FaxAccountId':_[_0xb905('0xb1')](_0x57cf7e[_0xb905('0x5c')]['id'])?undefined:_0x57cf7e[_0xb905('0x5c')]['id'],'path':_[_0xb905('0xb1')](_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0][_0xb905('0x7')])?undefined:_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0]['path'],'fax':_[_0xb905('0xb1')](_0x57cf7e[_0xb905('0x67')]['to'][0x0])?undefined:_0x57cf7e[_0xb905('0x67')]['to'][0x0]},client9002);})['then'](function(){if(_0x21dbae){if(_['isNil'](_0x57cf7e[_0xb905('0x67')][_0xb905('0xb2')])){_0x57cf7e[_0xb905('0x67')][_0xb905('0xb2')]=util['format'](_0xb905('0xb3'),_0x21dbae['name'],_0x21dbae[_0xb905('0xb4')]);}if(_0x21dbae[_0xb905('0xaa')]){if(_0x21dbae[_0xb905('0xaa')][_0xb905('0xab')][_0xb905('0x4d')]){return _0x21dbae['List']['Contacts'][0x0];}else{return db[_0xb905('0x76')][_0xb905('0x5f')](_[_0xb905('0x1c')](_0x57cf7e[_0xb905('0x67')],{'firstName':_0x57cf7e[_0xb905('0x67')]['to'][0x0],'phone':_0x57cf7e[_0xb905('0x67')]['to'][0x0],'fax':_0x57cf7e[_0xb905('0x67')]['to'][0x0],'ListId':_0x21dbae[_0xb905('0xa3')]}));}}else{throw new Error(_0xb905('0xb5'));}}else{throw new Error(_0xb905('0xb6'));}})['then'](function(_0x359501){if(_0x359501){return db['FaxInteraction']['find']({'where':{'ContactId':_0x359501['id'],'closed':![],'FaxAccountId':_0x21dbae['id']}})[_0xb905('0x24')](function(_0x112d8c){if(_0x112d8c){return[_0x112d8c,![]];}return db[_0xb905('0x75')][_0xb905('0x5f')]({'UserId':_0x57cf7e[_0xb905('0x60')]['id'],'ContactId':_0x359501['id'],'FaxAccountId':_0x21dbae['id'],'fax':_0x57cf7e[_0xb905('0x67')]['to'][0x0],'firstMsgDirection':_0xb905('0xb7'),'Messages':[_[_0xb905('0x54')](_0x57cf7e[_0xb905('0x67')],{'read':![],'body':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0]['filename'],'FaxAccountId':_0x21dbae['id'],'UserId':_0x57cf7e['user']['id'],'ContactId':_0x359501['id'],'AttachmentId':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xb905('0xb8')}]})[_0xb905('0x24')](function(_0x4e2bc7){return[_0x4e2bc7,!![]];});});}else{throw new Error(_0xb905('0xb9'));}})['spread'](function(_0x4aa95b,_0x4f8ce8){if(_0x4f8ce8){return _0x4aa95b;}return db[_0xb905('0xa5')][_0xb905('0x5f')]({'direction':_0xb905('0xb7'),'read':![],'body':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0][_0xb905('0xba')],'FaxAccountId':_0x21dbae['id'],'FaxInteractionId':_0x4aa95b['id'],'UserId':_0x57cf7e[_0xb905('0x60')]['id'],'ContactId':_0x4aa95b[_0xb905('0xbb')],'AttachmentId':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0]['id']})['then'](function(_0x3fc33b){_0x4aa95b[_0xb905('0xbc')][_0xb905('0xb8')]=[];_0x4aa95b[_0xb905('0xbc')][_0xb905('0xb8')][_0xb905('0x91')](_0x3fc33b[_0xb905('0xbc')]);return _0x4aa95b;});})[_0xb905('0x24')](function(_0x148874){respondWithRpcPromise('SendFax',_0xb905('0xbd'),{'FaxAccountId':_[_0xb905('0xb1')](_0x57cf7e[_0xb905('0x5c')]['id'])?undefined:_0x57cf7e[_0xb905('0x5c')]['id'],'path':_[_0xb905('0xb1')](_0x57cf7e['body'][_0xb905('0xae')][0x0][_0xb905('0x7')])?undefined:_0x57cf7e[_0xb905('0x67')]['attachments'][0x0][_0xb905('0x7')],'fax':_[_0xb905('0xb1')](_0x57cf7e[_0xb905('0x67')]['to'][0x0])?undefined:_0x57cf7e[_0xb905('0x67')]['to'][0x0],'AttachmentId':_0x57cf7e[_0xb905('0x67')][_0xb905('0xae')][0x0]['id']},client9002)[_0xb905('0x24')](function(_0x98cdd4){logger['info'](_0xb905('0xbe'),_0x98cdd4);})[_0xb905('0x2b')](function(_0x17aa76){logger[_0xb905('0xbf')](_0xb905('0xbe'),_0x17aa76);});return _0x148874;})[_0xb905('0x24')](respondWithResult(_0x346929,null))[_0xb905('0x2b')](handleError(_0x346929,null));};exports[_0xb905('0xc0')]=function(_0x120d03,_0x54d0e6,_0x46edb3){return db['FaxAccount']['find']({'where':{'id':_0x120d03[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x54d0e6,null))[_0xb905('0x24')](function(_0x30ac4d){if(_0x30ac4d){return _0x30ac4d[_0xb905('0xc0')](_0x120d03[_0xb905('0x67')][_0xb905('0x6f')],_[_0xb905('0xa0')](_0x120d03[_0xb905('0x67')],['ids','id'])||{})[_0xb905('0xc1')](function(_0x588b37){for(var _0x54d01c=0x0;_0x54d01c<_0x120d03[_0xb905('0x67')]['ids'][_0xb905('0x4d')];_0x54d01c+=0x1){socket[_0xb905('0xc2')](_0xb905('0xc3'),{'UserId':Number(_0x120d03[_0xb905('0x67')]['ids'][_0x54d01c]),'FaxAccountId':Number(_0x120d03[_0xb905('0x5c')]['id'])});}return _0x588b37;});}})[_0xb905('0x24')](respondWithResult(_0x54d0e6,null))['catch'](handleError(_0x54d0e6,null));};exports[_0xb905('0xc4')]=function(_0x471b39,_0x2fd70f,_0x1bd40b){return db[_0xb905('0x41')][_0xb905('0x5e')]({'where':{'id':_0x471b39[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x2fd70f,null))[_0xb905('0x24')](function(_0x4c94ba){if(_0x4c94ba){return _0x4c94ba[_0xb905('0xc4')](_0x471b39[_0xb905('0x48')][_0xb905('0x6f')])['then'](function(){if(_[_0xb905('0xc5')](_0x471b39[_0xb905('0x48')]['ids'])){for(var _0x5b5531=0x0;_0x5b5531<_0x471b39[_0xb905('0x48')][_0xb905('0x6f')][_0xb905('0x4d')];_0x5b5531+=0x1){socket['emit'](_0xb905('0xc6'),{'UserId':Number(_0x471b39[_0xb905('0x48')][_0xb905('0x6f')][_0x5b5531]),'FaxAccountId':Number(_0x471b39['params']['id'])});}}else{socket[_0xb905('0xc2')](_0xb905('0xc6'),{'UserId':Number(_0x471b39[_0xb905('0x48')][_0xb905('0x6f')]),'FaxAccountId':Number(_0x471b39[_0xb905('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fd70f,null))[_0xb905('0x2b')](handleError(_0x2fd70f,null));};exports[_0xb905('0xc7')]=function(_0x4fe920,_0x5444d9,_0x550930){var _0x117bf1={};var _0x566b0b={};var _0x2d5e92;var _0xfb342d;return db[_0xb905('0x41')]['findOne']({'where':{'id':_0x4fe920[_0xb905('0x5c')]['id']}})[_0xb905('0x24')](handleEntityNotFound(_0x5444d9,null))[_0xb905('0x24')](function(_0x4e9d96){if(_0x4e9d96){_0x2d5e92=_0x4e9d96;_0x566b0b[_0xb905('0x46')]=_[_0xb905('0x5d')](db[_0xb905('0x77')]['rawAttributes']);_0x566b0b[_0xb905('0x48')]=_['keys'](_0x4fe920[_0xb905('0x48')]);_0x566b0b[_0xb905('0x49')]=_['intersection'](_0x566b0b[_0xb905('0x46')],_0x566b0b[_0xb905('0x48')]);_0x117bf1['attributes']=_[_0xb905('0x4a')](_0x566b0b[_0xb905('0x46')],qs[_0xb905('0x4c')](_0x4fe920[_0xb905('0x48')][_0xb905('0x4c')]));_0x117bf1[_0xb905('0x4b')]=_0x117bf1[_0xb905('0x4b')][_0xb905('0x4d')]?_0x117bf1['attributes']:_0x566b0b[_0xb905('0x46')];_0x117bf1['order']=qs['sort'](_0x4fe920[_0xb905('0x48')][_0xb905('0x51')]);_0x117bf1['where']=qs[_0xb905('0x49')](_[_0xb905('0x6d')](_0x4fe920[_0xb905('0x48')],_0x566b0b['filters']));if(_0x4fe920[_0xb905('0x48')][_0xb905('0x53')]){_0x117bf1['where']=_['merge'](_0x117bf1[_0xb905('0x52')],{'$or':_[_0xb905('0x47')](_0x117bf1['attributes'],function(_0x44956f){var _0x24937c={};_0x24937c[_0x44956f]={'$like':'%'+_0x4fe920['query'][_0xb905('0x53')]+'%'};return _0x24937c;})});}_0x117bf1=_[_0xb905('0x54')]({},_0x117bf1,_0x4fe920[_0xb905('0x56')]);return _0x2d5e92[_0xb905('0xc7')](_0x117bf1);}})[_0xb905('0x24')](function(_0x3a7a3a){if(_0x3a7a3a){_0xfb342d=_0x3a7a3a[_0xb905('0x4d')];if(!_0x4fe920[_0xb905('0x48')][_0xb905('0x4e')](_0xb905('0x4f'))){_0x117bf1[_0xb905('0x32')]=qs['limit'](_0x4fe920[_0xb905('0x48')]['limit']);_0x117bf1[_0xb905('0x30')]=qs['offset'](_0x4fe920[_0xb905('0x48')][_0xb905('0x30')]);}return _0x2d5e92[_0xb905('0xc7')](_0x117bf1);}})[_0xb905('0x24')](function(_0xc13273){if(_0xc13273){return _0xc13273?{'count':_0xfb342d,'rows':_0xc13273}:null;}})['then'](respondWithResult(_0x5444d9,null))[_0xb905('0x2b')](handleError(_0x5444d9,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 089da43..53324c8 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 _0xa68a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x62b010,_0x16732c){var _0x3dd630=function(_0x5abe7d){while(--_0x5abe7d){_0x62b010['push'](_0x62b010['shift']());}};_0x3dd630(++_0x16732c);}(_0xa68a,0x1ad));var _0xaa68=function(_0x24dad6,_0x2dce12){_0x24dad6=_0x24dad6-0x0;var _0x59ac54=_0xa68a[_0x24dad6];return _0x59ac54;};'use strict';var EventEmitter=require(_0xaa68('0x0'));var FaxAccount=require(_0xaa68('0x1'))['db'][_0xaa68('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xaa68('0x3')](0x0);var events={'afterCreate':_0xaa68('0x4'),'afterUpdate':'update','afterDestroy':_0xaa68('0x5')};function emitEvent(_0x3371b3){return function(_0x15db6f,_0x382443,_0x1d3f83){FaxAccountEvents[_0xaa68('0x6')](_0x3371b3+':'+_0x15db6f['id'],_0x15db6f);FaxAccountEvents[_0xaa68('0x6')](_0x3371b3,_0x15db6f);_0x1d3f83(null);};}for(var e in events){if(events[_0xaa68('0x7')](e)){var event=events[e];FaxAccount[_0xaa68('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xe799=['save','update','remove','hook','exports','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x5751be,_0x54cefa){var _0x3dbe60=function(_0x2404b2){while(--_0x2404b2){_0x5751be['push'](_0x5751be['shift']());}};_0x3dbe60(++_0x54cefa);}(_0xe799,0x7d));var _0x9e79=function(_0x1c3c71,_0x34015a){_0x1c3c71=_0x1c3c71-0x0;var _0x1a759a=_0xe799[_0x1c3c71];return _0x1a759a;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x9e79('0x0'))['db'][_0x9e79('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9e79('0x2')](0x0);var events={'afterCreate':_0x9e79('0x3'),'afterUpdate':_0x9e79('0x4'),'afterDestroy':_0x9e79('0x5')};function emitEvent(_0x48427f){return function(_0x5ce24b,_0x1031f7,_0x1de11a){FaxAccountEvents['emit'](_0x48427f+':'+_0x5ce24b['id'],_0x5ce24b);FaxAccountEvents['emit'](_0x48427f,_0x5ce24b);_0x1de11a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9e79('0x6')](e,emitEvent(event));}}module[_0x9e79('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3ee3fb8..2cb5b42 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 _0x0219=['request-promise','path','../../config/environment','exports','FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x1b338e,_0x25ac31){var _0x3ae2f4=function(_0x229fc5){while(--_0x229fc5){_0x1b338e['push'](_0x1b338e['shift']());}};_0x3ae2f4(++_0x25ac31);}(_0x0219,0x92));var _0x9021=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x0219[_0x20c290];return _0x3d7b3b;};'use strict';var _=require(_0x9021('0x0'));var util=require('util');var logger=require(_0x9021('0x1'))(_0x9021('0x2'));var moment=require('moment');var BPromise=require(_0x9021('0x3'));var rp=require(_0x9021('0x4'));var fs=require('fs');var path=require(_0x9021('0x5'));var rimraf=require('rimraf');var config=require(_0x9021('0x6'));var attributes=require('./faxAccount.attributes');module[_0x9021('0x7')]=function(_0x52853a,_0x31beb8){return _0x52853a['define'](_0x9021('0x8'),attributes,{'tableName':_0x9021('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc06f=['rimraf','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x315685,_0x33cdea){var _0x335200=function(_0x50e93c){while(--_0x50e93c){_0x315685['push'](_0x315685['shift']());}};_0x335200(++_0x33cdea);}(_0xc06f,0x1d3));var _0xfc06=function(_0x1d8238,_0x7d9d9){_0x1d8238=_0x1d8238-0x0;var _0x322544=_0xc06f[_0x1d8238];return _0x322544;};'use strict';var _=require(_0xfc06('0x0'));var util=require('util');var logger=require(_0xfc06('0x1'))(_0xfc06('0x2'));var moment=require(_0xfc06('0x3'));var BPromise=require(_0xfc06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc06('0x5'));var rimraf=require(_0xfc06('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xfc06('0x7')]=function(_0x338ce5,_0x466d2f){return _0x338ce5[_0xfc06('0x8')](_0xfc06('0x9'),attributes,{'tableName':_0xfc06('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 779103c..b62abae 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 _0x4b2f=['./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxAccount','FaxAccount','raw','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','DESC','Applications','get','applications','list','orderBy','priority','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','length','close','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','find','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','randomstring','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4b2f,0x159));var _0xf4b2=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4b2f[_0x5c883f];return _0x4210cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4b2('0x0'));var BPromise=require('bluebird');var rs=require(_0xf4b2('0x1'));var fs=require('fs');var Redis=require(_0xf4b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b2('0x3'));var logger=require('../../config/logger')(_0xf4b2('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b2('0x5')][_0xf4b2('0x6')]({'port':0x232c});config[_0xf4b2('0x7')]=_[_0xf4b2('0x8')](config[_0xf4b2('0x7')],{'host':_0xf4b2('0x9'),'port':0x18eb});var socket=require(_0xf4b2('0xa'))(new Redis(config['redis']));require(_0xf4b2('0xb'))[_0xf4b2('0xc')](socket);function respondWithRpcPromise(_0x4511d1,_0x2ceda7,_0x5cb795){return new BPromise(function(_0x5ce0b1,_0x5a98cc){return client['request'](_0x4511d1,_0x5cb795)[_0xf4b2('0xd')](function(_0xd3f3a2){logger['info'](_0xf4b2('0xe'),_0x2ceda7,_0xf4b2('0xf'));logger[_0xf4b2('0x10')](_0xf4b2('0x11'),_0x2ceda7,_0xf4b2('0xf'),JSON[_0xf4b2('0x12')](_0xd3f3a2));if(_0xd3f3a2[_0xf4b2('0x13')]){if(_0xd3f3a2['error']['code']===0x1f4){logger[_0xf4b2('0x13')](_0xf4b2('0xe'),_0x2ceda7,_0xd3f3a2[_0xf4b2('0x13')]['message']);return _0x5a98cc(_0xd3f3a2['error'][_0xf4b2('0x14')]);}logger[_0xf4b2('0x13')](_0xf4b2('0xe'),_0x2ceda7,_0xd3f3a2['error'][_0xf4b2('0x14')]);return _0x5ce0b1(_0xd3f3a2[_0xf4b2('0x13')][_0xf4b2('0x14')]);}else{logger[_0xf4b2('0x15')](_0xf4b2('0xe'),_0x2ceda7,_0xf4b2('0xf'));_0x5ce0b1(_0xd3f3a2[_0xf4b2('0x16')]['message']);}})[_0xf4b2('0x17')](function(_0x55b4d0){logger[_0xf4b2('0x13')](_0xf4b2('0xe'),_0x2ceda7,_0x55b4d0);_0x5a98cc(_0x55b4d0);});});}exports[_0xf4b2('0x18')]=function(_0x476d76){var _0xb536c6=this;return new Promise(function(_0x58ded3,_0x172528){return db[_0xf4b2('0x19')]['findAll']({'raw':_0x476d76['options']?_0x476d76['options'][_0xf4b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x476d76[_0xf4b2('0x1b')]?_0x476d76['options'][_0xf4b2('0x1c')]||null:null,'attributes':_0x476d76[_0xf4b2('0x1b')]?_0x476d76[_0xf4b2('0x1b')][_0xf4b2('0x1d')]||null:null,'limit':_0x476d76[_0xf4b2('0x1b')]?_0x476d76[_0xf4b2('0x1b')][_0xf4b2('0x1e')]||null:null,'include':_0x476d76[_0xf4b2('0x1b')]?_0x476d76[_0xf4b2('0x1b')][_0xf4b2('0x1f')]?_[_0xf4b2('0x20')](_0x476d76['options']['include'],function(_0x549b4e){return{'model':db[_0x549b4e[_0xf4b2('0x21')]],'as':_0x549b4e['as'],'attributes':_0x549b4e[_0xf4b2('0x1d')],'include':_0x549b4e['include']?_[_0xf4b2('0x20')](_0x549b4e['include'],function(_0x42296f){return{'model':db[_0x42296f[_0xf4b2('0x21')]],'as':_0x42296f['as'],'attributes':_0x42296f[_0xf4b2('0x1d')],'include':_0x42296f[_0xf4b2('0x1f')]?_['map'](_0x42296f[_0xf4b2('0x1f')],function(_0x4ac86c){return{'model':db[_0x4ac86c[_0xf4b2('0x21')]],'as':_0x4ac86c['as'],'attributes':_0x4ac86c[_0xf4b2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e49a){logger['info'](_0xf4b2('0x18'),_0x476d76);logger[_0xf4b2('0x10')](_0xf4b2('0x18'),_0x476d76,JSON[_0xf4b2('0x12')](_0x11e49a));_0x58ded3(_0x11e49a);})[_0xf4b2('0x17')](function(_0x23e681){logger[_0xf4b2('0x13')](_0xf4b2('0x18'),_0x23e681['message'],_0x476d76);_0x172528(_0xb536c6[_0xf4b2('0x13')](0x1f4,_0x23e681['message']));});});};exports[_0xf4b2('0x22')]=function(_0x44d2ad,_0x57e153,_0x4d058e){var _0x5d5f45=this;return new Promise(function(_0x314832,_0x11ec19){var _0x5da0d9={'body':_0x44d2ad[_0xf4b2('0x23')],'channel':_0xf4b2('0x24')};var _0x105626=[];var _0xf671e=[];var _0x776932={};return db[_0xf4b2('0x25')][_0xf4b2('0x26')]()[_0xf4b2('0xd')](function(_0x1b797e){if(!_0x1b797e){throw new db[(_0xf4b2('0x27'))][(_0xf4b2('0x28'))](_0xf4b2('0x29'));}_0x105626=_[_0xf4b2('0x2a')](_[_0xf4b2('0x2b')](_0x1b797e),['createdAt','updatedAt']);_0xf671e=_[_0xf4b2('0x2a')](_['keys'](_0x1b797e),[_0xf4b2('0x2c'),_0xf4b2('0x2d'),_0xf4b2('0x2e'),'ListId']);if(_0x44d2ad[_0xf4b2('0x23')]['id']){delete _0x44d2ad[_0xf4b2('0x23')]['id'];}if(_[_0xf4b2('0x2f')](_0x44d2ad['body']['from'])){throw new db['Sequelize'][(_0xf4b2('0x28'))](_0xf4b2('0x30'));}if(_[_0xf4b2('0x2f')](_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x23')])||_0x44d2ad[_0xf4b2('0x23')]['body']===''){throw new db['Sequelize'][(_0xf4b2('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x31')])){throw new db[(_0xf4b2('0x27'))]['ValidationError'](_0xf4b2('0x32')+_0xf671e);}if(!_[_0xf4b2('0x33')](_0xf671e,_0x44d2ad[_0xf4b2('0x23')]['mapKey'])){throw new db[(_0xf4b2('0x27'))][(_0xf4b2('0x28'))](_0xf4b2('0x34')+_0xf671e);}_0x776932[_0x44d2ad[_0xf4b2('0x23')]['mapKey']]=_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x35')];})[_0xf4b2('0xd')](function(){return db[_0xf4b2('0x19')]['find']({'where':{'id':_0x44d2ad[_0xf4b2('0x36')]['id']},'include':[{'model':db[_0xf4b2('0x37')],'as':_0xf4b2('0x38'),'include':[{'model':db[_0xf4b2('0x25')],'as':_0xf4b2('0x39'),'where':_0x776932,'limit':0x1,'order':[[_0xf4b2('0x2d'),_0xf4b2('0x3a')]]}]},{'model':db['FaxApplication'],'as':_0xf4b2('0x3b')}]});})['then'](function(_0xb67ac){if(_0xb67ac&&_0xb67ac[_0xf4b2('0x38')]){var _0x3f1be1=_0xb67ac[_0xf4b2('0x3c')]({'plain':!![]});_0x5da0d9[_0xf4b2('0x36')]=_0x3f1be1;_0x5da0d9[_0xf4b2('0x3d')]=_0x3f1be1[_0xf4b2('0x3b')];_0x5da0d9[_0xf4b2('0x3e')]=_0x3f1be1[_0xf4b2('0x38')];_0x5da0d9['applications']=_[_0xf4b2('0x3f')](_0x5da0d9[_0xf4b2('0x3d')],[_0xf4b2('0x40')],['asc']);if(_0x5da0d9['account']['Applications']){delete _0x5da0d9['account']['Applications'];}if(_0x5da0d9[_0xf4b2('0x36')][_0xf4b2('0x38')]&&_0x5da0d9['account']['List'][_0xf4b2('0x39')]['length']){return _0x5da0d9[_0xf4b2('0x36')]['List'][_0xf4b2('0x39')][0x0];}var _0x9719a2=_['defaults'](_0x44d2ad[_0xf4b2('0x23')],{'firstName':_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x35')],'ListId':_0x3f1be1[_0xf4b2('0x41')]});_0x9719a2[_0x44d2ad['body'][_0xf4b2('0x31')]]=_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x35')];return db[_0xf4b2('0x25')]['create'](_0x9719a2,{'fields':_0x105626,'raw':!![]});}})['then'](function(_0xdf5446){_0x5da0d9[_0xf4b2('0x42')]=_0xdf5446;if(_0xdf5446){var _0x36adba={'ContactId':_0xdf5446['id'],'FaxAccountId':_0x44d2ad[_0xf4b2('0x36')]['id'],'fax':_0xdf5446['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0xdf5446['id'],'closed':![],'FaxAccountId':_0x44d2ad[_0xf4b2('0x36')]['id']}})['then'](function(_0xd0a387){if(_0xd0a387){return[_0xd0a387,![]];}return db[_0xf4b2('0x43')][_0xf4b2('0x44')](_0x36adba)['then'](function(_0x541840){return[_0x541840,!![]];});});}else{throw new Error(_0xf4b2('0x45'));}})[_0xf4b2('0x46')](function(_0x58848e,_0x3ed0f6){var _0x58f7f9=_0x58848e[_0xf4b2('0x3c')]({'plain':!![]});if(_0x3ed0f6){if(_0x5da0d9[_0xf4b2('0x36')][_0xf4b2('0x47')]){_0x5da0d9[_0xf4b2('0x3d')][_0xf4b2('0x48')]({'id':0x0,'priority':_0x5da0d9[_0xf4b2('0x3d')][_0xf4b2('0x49')]+0x1,'app':_0xf4b2('0x4a'),'appdata':'unmanaged','interval':_0xf4b2('0x4b')});}_0x58f7f9[_0xf4b2('0x4c')]=!![];}else{_0x58f7f9[_0xf4b2('0x4c')]=![];}_0x5da0d9[_0xf4b2('0x4d')]=_0x58f7f9;return db[_0xf4b2('0x4e')][_0xf4b2('0x44')]({'body':_0x44d2ad[_0xf4b2('0x23')][_0xf4b2('0x23')],'FaxAccountId':_0x44d2ad[_0xf4b2('0x36')]['id'],'FaxInteractionId':_0x58848e['id'],'direction':'in','ContactId':_0x58848e[_0xf4b2('0x4f')],'AttachmentId':_0x44d2ad[_0xf4b2('0x23')]['AttachmentId']});})[_0xf4b2('0xd')](function(_0xb76ad3){_0x5da0d9[_0xf4b2('0x14')]=_0xb76ad3;if(_0x5da0d9[_0xf4b2('0x4d')][_0xf4b2('0x50')]){return db[_0xf4b2('0x51')][_0xf4b2('0x52')]({'attributes':['id',_0xf4b2('0x53')],'where':{'id':_0x5da0d9['interaction'][_0xf4b2('0x50')]}})[_0xf4b2('0xd')](function(_0x102ad4){if(_0x102ad4){_0x5da0d9[_0xf4b2('0x3d')][_0xf4b2('0x54')]({'id':0x0,'priority':0x0,'app':_0xf4b2('0x55'),'appdata':_0x102ad4[_0xf4b2('0x53')]+','+(_0x5da0d9[_0xf4b2('0x36')][_0xf4b2('0x56')]||0xa),'interval':_0xf4b2('0x4b')});}return respondWithRpcPromise(_0xf4b2('0x57'),_0xf4b2('0x58'),_0x5da0d9);});}return respondWithRpcPromise('Start',_0xf4b2('0x58'),_0x5da0d9);})['then'](function(_0x54fd05){_0x314832(_0x54fd05);})[_0xf4b2('0x17')](function(_0x4a27d7){_0x11ec19(_0x5d5f45['error'](0x1f4,_0x4a27d7[_0xf4b2('0x14')]));});});}; \ No newline at end of file +var _0x8bc6=['CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','then','get','applications','list','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','catch','NotifyFaxAccount','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account'];(function(_0x19a008,_0x15968e){var _0xdfe7df=function(_0x15a210){while(--_0x15a210){_0x19a008['push'](_0x19a008['shift']());}};_0xdfe7df(++_0x15968e);}(_0x8bc6,0xe3));var _0x68bc=function(_0x3e3255,_0x485196){_0x3e3255=_0x3e3255-0x0;var _0x57368e=_0x8bc6[_0x3e3255];return _0x57368e;};'use strict';var _=require(_0x68bc('0x0'));var util=require(_0x68bc('0x1'));var moment=require(_0x68bc('0x2'));var BPromise=require(_0x68bc('0x3'));var rs=require(_0x68bc('0x4'));var fs=require('fs');var Redis=require(_0x68bc('0x5'));var db=require(_0x68bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68bc('0x7'))('rpc');var config=require(_0x68bc('0x8'));var jayson=require(_0x68bc('0x9'));var client=jayson[_0x68bc('0xa')]['http']({'port':0x232c});config[_0x68bc('0xb')]=_[_0x68bc('0xc')](config['redis'],{'host':_0x68bc('0xd'),'port':0x18eb});var socket=require(_0x68bc('0xe'))(new Redis(config[_0x68bc('0xb')]));require(_0x68bc('0xf'))[_0x68bc('0x10')](socket);function respondWithRpcPromise(_0x8a2ea6,_0xe68a32,_0xf84ae9){return new BPromise(function(_0x2ddbf1,_0x30d2e1){return client[_0x68bc('0x11')](_0x8a2ea6,_0xf84ae9)['then'](function(_0x406494){logger['info'](_0x68bc('0x12'),_0xe68a32,_0x68bc('0x13'));logger[_0x68bc('0x14')](_0x68bc('0x15'),_0xe68a32,'request\x20sent',JSON[_0x68bc('0x16')](_0x406494));if(_0x406494[_0x68bc('0x17')]){if(_0x406494[_0x68bc('0x17')][_0x68bc('0x18')]===0x1f4){logger['error'](_0x68bc('0x12'),_0xe68a32,_0x406494[_0x68bc('0x17')][_0x68bc('0x19')]);return _0x30d2e1(_0x406494['error'][_0x68bc('0x19')]);}logger['error'](_0x68bc('0x12'),_0xe68a32,_0x406494[_0x68bc('0x17')][_0x68bc('0x19')]);return _0x2ddbf1(_0x406494[_0x68bc('0x17')][_0x68bc('0x19')]);}else{logger[_0x68bc('0x1a')](_0x68bc('0x12'),_0xe68a32,_0x68bc('0x13'));_0x2ddbf1(_0x406494[_0x68bc('0x1b')][_0x68bc('0x19')]);}})['catch'](function(_0x26365a){logger[_0x68bc('0x17')](_0x68bc('0x12'),_0xe68a32,_0x26365a);_0x30d2e1(_0x26365a);});});}exports[_0x68bc('0x1c')]=function(_0x746fa1){var _0x556869=this;return new Promise(function(_0x5b78cd,_0x5815ea){return db[_0x68bc('0x1d')][_0x68bc('0x1e')]({'raw':_0x746fa1['options']?_0x746fa1[_0x68bc('0x1f')][_0x68bc('0x20')]===undefined?!![]:![]:!![],'where':_0x746fa1[_0x68bc('0x1f')]?_0x746fa1[_0x68bc('0x1f')][_0x68bc('0x21')]||null:null,'attributes':_0x746fa1['options']?_0x746fa1[_0x68bc('0x1f')][_0x68bc('0x22')]||null:null,'limit':_0x746fa1[_0x68bc('0x1f')]?_0x746fa1['options']['limit']||null:null,'include':_0x746fa1[_0x68bc('0x1f')]?_0x746fa1[_0x68bc('0x1f')][_0x68bc('0x23')]?_[_0x68bc('0x24')](_0x746fa1['options'][_0x68bc('0x23')],function(_0x3ad244){return{'model':db[_0x3ad244[_0x68bc('0x25')]],'as':_0x3ad244['as'],'attributes':_0x3ad244[_0x68bc('0x22')],'include':_0x3ad244['include']?_['map'](_0x3ad244[_0x68bc('0x23')],function(_0x2f3ee1){return{'model':db[_0x2f3ee1[_0x68bc('0x25')]],'as':_0x2f3ee1['as'],'attributes':_0x2f3ee1['attributes'],'include':_0x2f3ee1[_0x68bc('0x23')]?_[_0x68bc('0x24')](_0x2f3ee1['include'],function(_0x526973){return{'model':db[_0x526973[_0x68bc('0x25')]],'as':_0x526973['as'],'attributes':_0x526973['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x152e2f){logger[_0x68bc('0x1a')]('GetFaxAccount',_0x746fa1);logger['debug']('GetFaxAccount',_0x746fa1,JSON[_0x68bc('0x16')](_0x152e2f));_0x5b78cd(_0x152e2f);})[_0x68bc('0x26')](function(_0x4414f0){logger[_0x68bc('0x17')](_0x68bc('0x1c'),_0x4414f0['message'],_0x746fa1);_0x5815ea(_0x556869[_0x68bc('0x17')](0x1f4,_0x4414f0[_0x68bc('0x19')]));});});};exports[_0x68bc('0x27')]=function(_0x1e7378,_0x10521e,_0x24b34d){var _0x2add36=this;return new Promise(function(_0x4bed54,_0xad6b11){var _0x126fbd={'body':_0x1e7378['body'],'channel':_0x68bc('0x28')};var _0x150839=[];var _0x2cb807=[];var _0x5c4e65={};return db['CmContact'][_0x68bc('0x29')]()['then'](function(_0x1497bb){if(!_0x1497bb){throw new db[(_0x68bc('0x2a'))]['ValidationError'](_0x68bc('0x2b'));}_0x150839=_[_0x68bc('0x2c')](_[_0x68bc('0x2d')](_0x1497bb),[_0x68bc('0x2e'),_0x68bc('0x2f')]);_0x2cb807=_[_0x68bc('0x2c')](_[_0x68bc('0x2d')](_0x1497bb),[_0x68bc('0x2e'),_0x68bc('0x2f'),_0x68bc('0x30'),'ListId']);if(_0x1e7378[_0x68bc('0x31')]['id']){delete _0x1e7378['body']['id'];}if(_['isNil'](_0x1e7378[_0x68bc('0x31')]['from'])){throw new db[(_0x68bc('0x2a'))][(_0x68bc('0x32'))](_0x68bc('0x33'));}if(_[_0x68bc('0x34')](_0x1e7378[_0x68bc('0x31')]['body'])||_0x1e7378[_0x68bc('0x31')][_0x68bc('0x31')]===''){throw new db[(_0x68bc('0x2a'))][(_0x68bc('0x32'))](_0x68bc('0x35'));}if(_['isNil'](_0x1e7378[_0x68bc('0x31')][_0x68bc('0x36')])){throw new db[(_0x68bc('0x2a'))][(_0x68bc('0x32'))](_0x68bc('0x37')+_0x2cb807);}if(!_[_0x68bc('0x38')](_0x2cb807,_0x1e7378[_0x68bc('0x31')][_0x68bc('0x36')])){throw new db[(_0x68bc('0x2a'))][(_0x68bc('0x32'))](_0x68bc('0x39')+_0x2cb807);}_0x5c4e65[_0x1e7378['body'][_0x68bc('0x36')]]=_0x1e7378[_0x68bc('0x31')][_0x68bc('0x3a')];})['then'](function(){return db[_0x68bc('0x1d')][_0x68bc('0x3b')]({'where':{'id':_0x1e7378[_0x68bc('0x3c')]['id']},'include':[{'model':db[_0x68bc('0x3d')],'as':_0x68bc('0x3e'),'include':[{'model':db[_0x68bc('0x3f')],'as':_0x68bc('0x40'),'where':_0x5c4e65,'limit':0x1,'order':[['updatedAt',_0x68bc('0x41')]]}]},{'model':db[_0x68bc('0x42')],'as':_0x68bc('0x43')}]});})[_0x68bc('0x44')](function(_0x3c016f){if(_0x3c016f&&_0x3c016f[_0x68bc('0x3e')]){var _0x16f0e9=_0x3c016f[_0x68bc('0x45')]({'plain':!![]});_0x126fbd[_0x68bc('0x3c')]=_0x16f0e9;_0x126fbd[_0x68bc('0x46')]=_0x16f0e9[_0x68bc('0x43')];_0x126fbd[_0x68bc('0x47')]=_0x16f0e9['List'];_0x126fbd[_0x68bc('0x46')]=_[_0x68bc('0x48')](_0x126fbd[_0x68bc('0x46')],[_0x68bc('0x49')],[_0x68bc('0x4a')]);if(_0x126fbd[_0x68bc('0x3c')]['Applications']){delete _0x126fbd[_0x68bc('0x3c')]['Applications'];}if(_0x126fbd['account'][_0x68bc('0x3e')]&&_0x126fbd[_0x68bc('0x3c')][_0x68bc('0x3e')][_0x68bc('0x40')][_0x68bc('0x4b')]){return _0x126fbd[_0x68bc('0x3c')][_0x68bc('0x3e')][_0x68bc('0x40')][0x0];}var _0x2d34ce=_[_0x68bc('0xc')](_0x1e7378[_0x68bc('0x31')],{'firstName':_0x1e7378[_0x68bc('0x31')][_0x68bc('0x3a')],'ListId':_0x16f0e9[_0x68bc('0x4c')]});_0x2d34ce[_0x1e7378[_0x68bc('0x31')][_0x68bc('0x36')]]=_0x1e7378[_0x68bc('0x31')][_0x68bc('0x3a')];return db[_0x68bc('0x3f')][_0x68bc('0x4d')](_0x2d34ce,{'fields':_0x150839,'raw':!![]});}})['then'](function(_0x23abc0){_0x126fbd[_0x68bc('0x4e')]=_0x23abc0;if(_0x23abc0){var _0x56ea94={'ContactId':_0x23abc0['id'],'FaxAccountId':_0x1e7378[_0x68bc('0x3c')]['id'],'fax':_0x23abc0[_0x68bc('0x28')]};return db[_0x68bc('0x4f')][_0x68bc('0x3b')]({'where':{'ContactId':_0x23abc0['id'],'closed':![],'FaxAccountId':_0x1e7378[_0x68bc('0x3c')]['id']}})[_0x68bc('0x44')](function(_0x1a4f20){if(_0x1a4f20){return[_0x1a4f20,![]];}return db[_0x68bc('0x4f')][_0x68bc('0x4d')](_0x56ea94)[_0x68bc('0x44')](function(_0x4a71ec){return[_0x4a71ec,!![]];});});}else{throw new Error(_0x68bc('0x50'));}})[_0x68bc('0x51')](function(_0x2e4d7b,_0x12cbfa){var _0x32a24a=_0x2e4d7b[_0x68bc('0x45')]({'plain':!![]});if(_0x12cbfa){if(_0x126fbd[_0x68bc('0x3c')][_0x68bc('0x52')]){_0x126fbd[_0x68bc('0x46')]['push']({'id':0x0,'priority':_0x126fbd[_0x68bc('0x46')][_0x68bc('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x32a24a[_0x68bc('0x53')]=!![];}else{_0x32a24a[_0x68bc('0x53')]=![];}_0x126fbd[_0x68bc('0x54')]=_0x32a24a;return db[_0x68bc('0x55')][_0x68bc('0x4d')]({'body':_0x1e7378[_0x68bc('0x31')][_0x68bc('0x31')],'FaxAccountId':_0x1e7378['account']['id'],'FaxInteractionId':_0x2e4d7b['id'],'direction':'in','ContactId':_0x2e4d7b[_0x68bc('0x56')],'AttachmentId':_0x1e7378['body']['AttachmentId']});})[_0x68bc('0x44')](function(_0x2f57f6){_0x126fbd[_0x68bc('0x19')]=_0x2f57f6;if(_0x126fbd[_0x68bc('0x54')][_0x68bc('0x57')]){return db[_0x68bc('0x58')]['find']({'attributes':['id',_0x68bc('0x59')],'where':{'id':_0x126fbd['interaction']['UserId']}})[_0x68bc('0x44')](function(_0x2767fc){if(_0x2767fc){_0x126fbd['applications'][_0x68bc('0x5a')]({'id':0x0,'priority':0x0,'app':_0x68bc('0x5b'),'appdata':_0x2767fc[_0x68bc('0x59')]+','+(_0x126fbd[_0x68bc('0x3c')][_0x68bc('0x5c')]||0xa),'interval':_0x68bc('0x5d')});}return respondWithRpcPromise(_0x68bc('0x5e'),_0x68bc('0x5f'),_0x126fbd);});}return respondWithRpcPromise(_0x68bc('0x5e'),'startRouting',_0x126fbd);})[_0x68bc('0x44')](function(_0x59d734){_0x4bed54(_0x59d734);})[_0x68bc('0x26')](function(_0x1b21d8){_0xad6b11(_0x2add36[_0x68bc('0x17')](0x1f4,_0x1b21d8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f2a55b2..dfe00f1 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 _0x637b=['save','remove','update','emit','removeListener','register','length','./faxAccount.events'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x637b,0x13f));var _0xb637=function(_0x1a6565,_0x11072){_0x1a6565=_0x1a6565-0x0;var _0x271ca8=_0x637b[_0x1a6565];return _0x271ca8;};'use strict';var FaxAccountEvents=require(_0xb637('0x0'));var events=[_0xb637('0x1'),_0xb637('0x2'),_0xb637('0x3')];function createListener(_0x31076d,_0x4cbe51){return function(_0x1695fb){_0x4cbe51[_0xb637('0x4')](_0x31076d,_0x1695fb);};}function removeListener(_0x1c911b,_0x3a7e13){return function(){FaxAccountEvents[_0xb637('0x5')](_0x1c911b,_0x3a7e13);};}exports[_0xb637('0x6')]=function(_0x5d620b){for(var _0x2ce7c0=0x0,_0x19bd5a=events[_0xb637('0x7')];_0x2ce7c0<_0x19bd5a;_0x2ce7c0++){var _0x309d88=events[_0x2ce7c0];var _0x1a4a05=createListener('faxAccount:'+_0x309d88,_0x5d620b);FaxAccountEvents['on'](_0x309d88,_0x1a4a05);}}; \ No newline at end of file +var _0x1797=['remove','update','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x1797,0xc2));var _0x7179=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x1797[_0x2d8fc2];return _0x3a9e53;};'use strict';var FaxAccountEvents=require(_0x7179('0x0'));var events=[_0x7179('0x1'),_0x7179('0x2'),_0x7179('0x3')];function createListener(_0x867231,_0x50f7c2){return function(_0xf55c28){_0x50f7c2['emit'](_0x867231,_0xf55c28);};}function removeListener(_0x53f301,_0x5c51c9){return function(){FaxAccountEvents[_0x7179('0x4')](_0x53f301,_0x5c51c9);};}exports['register']=function(_0x23e626){for(var _0x599e71=0x0,_0x36db55=events[_0x7179('0x5')];_0x599e71<_0x36db55;_0x599e71++){var _0x421168=events[_0x599e71];var _0x5b7578=createListener(_0x7179('0x6')+_0x421168,_0x23e626);FaxAccountEvents['on'](_0x421168,_0x5b7578);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3345640..f74fca7 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(_0x5c9c86,_0x429dec){var _0x10bacc=function(_0x106f11){while(--_0x106f11){_0x5c9c86['push'](_0x5c9c86['shift']());}};_0x10bacc(++_0x429dec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x3dd8f6,_0x414312){var _0x1f2ce7=function(_0x44b1c0){while(--_0x44b1c0){_0x3dd8f6['push'](_0x3dd8f6['shift']());}};_0x1f2ce7(++_0x414312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 9b90e12..6e188ce 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 _0x0fa9=['noop','STRING','sequelize'];(function(_0xa68324,_0x424be1){var _0x19dd73=function(_0x45b185){while(--_0x45b185){_0xa68324['push'](_0xa68324['shift']());}};_0x19dd73(++_0x424be1);}(_0x0fa9,0x10a));var _0x90fa=function(_0x41f0a2,_0x1af1a8){_0x41f0a2=_0x41f0a2-0x0;var _0x1e1867=_0x0fa9[_0x41f0a2];return _0x1e1867;};'use strict';var Sequelize=require(_0x90fa('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90fa('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x90fa('0x2')]},'interval':{'type':Sequelize[_0x90fa('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfcf9=['sequelize','noop','STRING','*,*,*,*'];(function(_0x34d0dc,_0x292343){var _0x482f8a=function(_0x278d71){while(--_0x278d71){_0x34d0dc['push'](_0x34d0dc['shift']());}};_0x482f8a(++_0x292343);}(_0xfcf9,0x1e8));var _0x9fcf=function(_0xb2ae9a,_0x4111ba){_0xb2ae9a=_0xb2ae9a-0x0;var _0x19e920=_0xfcf9[_0xb2ae9a];return _0x19e920;};'use strict';var Sequelize=require(_0x9fcf('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9fcf('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9fcf('0x2')],'defaultValue':_0x9fcf('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4efad11..24c21f4 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 _0x2dbd=['save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxApplication','count','includeAll','include','findAll','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject'];(function(_0x4da220,_0xcd5777){var _0x162244=function(_0x56e901){while(--_0x56e901){_0x4da220['push'](_0x4da220['shift']());}};_0x162244(++_0xcd5777);}(_0x2dbd,0x18a));var _0xd2db=function(_0x289535,_0x35986c){_0x289535=_0x289535-0x0;var _0x15187f=_0x2dbd[_0x289535];return _0x15187f;};'use strict';var emlformat=require(_0xd2db('0x0'));var rimraf=require(_0xd2db('0x1'));var zipdir=require(_0xd2db('0x2'));var jsonpatch=require(_0xd2db('0x3'));var rp=require(_0xd2db('0x4'));var moment=require(_0xd2db('0x5'));var BPromise=require(_0xd2db('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd2db('0x7'));var sox=require(_0xd2db('0x8'));var csv=require(_0xd2db('0x9'));var ejs=require(_0xd2db('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2db('0xb'));var squel=require('squel');var crypto=require(_0xd2db('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd2db('0xd'));var toCsv=require(_0xd2db('0x9'));var querystring=require(_0xd2db('0xe'));var Papa=require(_0xd2db('0xf'));var Redis=require('ioredis');var authService=require(_0xd2db('0x10'));var qs=require(_0xd2db('0x11'));var as=require(_0xd2db('0x12'));var hardwareService=require(_0xd2db('0x13'));var logger=require(_0xd2db('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd2db('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x212c59,_0x463bc1){_0x463bc1=_0x463bc1||0xcc;return function(_0x4bac5d){if(_0x4bac5d){return _0x212c59[_0xd2db('0x16')](_0x463bc1);}return _0x212c59[_0xd2db('0x17')](_0x463bc1)[_0xd2db('0x18')]();};}function respondWithResult(_0xd518a1,_0xd61392){_0xd61392=_0xd61392||0xc8;return function(_0x352b7a){if(_0x352b7a){return _0xd518a1[_0xd2db('0x17')](_0xd61392)[_0xd2db('0x19')](_0x352b7a);}};}function respondWithFilteredResult(_0x5419a3,_0x20e20f){return function(_0x4d04d4){if(_0x4d04d4){var _0x12e0ac=typeof _0x20e20f[_0xd2db('0x1a')]==='undefined'&&typeof _0x20e20f[_0xd2db('0x1b')]===_0xd2db('0x1c');var _0x10f88d=_0x4d04d4['count'];var _0x5c47fe=_0x12e0ac?0x0:_0x20e20f[_0xd2db('0x1a')];var _0x2e90d1=_0x12e0ac?_0x4d04d4['count']:_0x20e20f[_0xd2db('0x1a')]+_0x20e20f[_0xd2db('0x1b')];var _0x112b1f;if(_0x2e90d1>=_0x10f88d){_0x2e90d1=_0x10f88d;_0x112b1f=0xc8;}else{_0x112b1f=0xce;}_0x5419a3[_0xd2db('0x17')](_0x112b1f);return _0x5419a3[_0xd2db('0x1d')]('Content-Range',_0x5c47fe+'-'+_0x2e90d1+'/'+_0x10f88d)[_0xd2db('0x19')](_0x4d04d4);}return null;};}function patchUpdates(_0x132c03){return function(_0x4fa163){try{jsonpatch[_0xd2db('0x1e')](_0x4fa163,_0x132c03,!![]);}catch(_0x2e9e7a){return BPromise[_0xd2db('0x1f')](_0x2e9e7a);}return _0x4fa163[_0xd2db('0x20')]();};}function saveUpdates(_0x9f04ca,_0x189024){return function(_0x55c397){if(_0x55c397){return _0x55c397[_0xd2db('0x21')](_0x9f04ca)['then'](function(_0x4eb448){return _0x4eb448;});}return null;};}function removeEntity(_0x34a90,_0x3d6a11){return function(_0x4c5ceb){if(_0x4c5ceb){return _0x4c5ceb[_0xd2db('0x22')]()[_0xd2db('0x23')](function(){_0x34a90[_0xd2db('0x17')](0xcc)[_0xd2db('0x18')]();});}};}function handleEntityNotFound(_0x27a70c,_0xd91c07){return function(_0x4af4a0){if(!_0x4af4a0){_0x27a70c['sendStatus'](0x194);}return _0x4af4a0;};}function handleError(_0x4ed737,_0x328eb5){_0x328eb5=_0x328eb5||0x1f4;return function(_0x15678b){logger[_0xd2db('0x24')](_0x15678b[_0xd2db('0x25')]);if(_0x15678b[_0xd2db('0x26')]){delete _0x15678b[_0xd2db('0x26')];}_0x4ed737[_0xd2db('0x17')](_0x328eb5)[_0xd2db('0x27')](_0x15678b);};}exports['index']=function(_0x229abc,_0x2f34c8){var _0x2f3215={},_0x23ec43={},_0x449a19={'count':0x0,'rows':[]};var _0x4226bf=_[_0xd2db('0x28')](db['FaxApplication'][_0xd2db('0x29')],function(_0x475445){return{'name':_0x475445[_0xd2db('0x2a')],'type':_0x475445[_0xd2db('0x2b')]['key']};});_0x23ec43[_0xd2db('0x2c')]=_[_0xd2db('0x28')](_0x4226bf,_0xd2db('0x26'));_0x23ec43[_0xd2db('0x2d')]=_[_0xd2db('0x2e')](_0x229abc[_0xd2db('0x2d')]);_0x23ec43[_0xd2db('0x2f')]=_[_0xd2db('0x30')](_0x23ec43[_0xd2db('0x2c')],_0x23ec43['query']);_0x2f3215[_0xd2db('0x31')]=_['intersection'](_0x23ec43[_0xd2db('0x2c')],qs[_0xd2db('0x32')](_0x229abc[_0xd2db('0x2d')][_0xd2db('0x32')]));_0x2f3215[_0xd2db('0x31')]=_0x2f3215[_0xd2db('0x31')][_0xd2db('0x33')]?_0x2f3215[_0xd2db('0x31')]:_0x23ec43[_0xd2db('0x2c')];if(!_0x229abc[_0xd2db('0x2d')]['hasOwnProperty'](_0xd2db('0x34'))){_0x2f3215['limit']=qs[_0xd2db('0x1b')](_0x229abc[_0xd2db('0x2d')]['limit']);_0x2f3215[_0xd2db('0x1a')]=qs[_0xd2db('0x1a')](_0x229abc[_0xd2db('0x2d')][_0xd2db('0x1a')]);}_0x2f3215[_0xd2db('0x35')]=qs[_0xd2db('0x36')](_0x229abc[_0xd2db('0x2d')][_0xd2db('0x36')]);_0x2f3215[_0xd2db('0x37')]=qs[_0xd2db('0x2f')](_[_0xd2db('0x38')](_0x229abc['query'],_0x23ec43[_0xd2db('0x2f')]),_0x4226bf);if(_0x229abc[_0xd2db('0x2d')][_0xd2db('0x39')]){_0x2f3215[_0xd2db('0x37')]=_['merge'](_0x2f3215['where'],{'$or':_['map'](_0x4226bf,function(_0x60f709){if(_0x60f709[_0xd2db('0x2b')]!==_0xd2db('0x3a')){var _0x5da52e={};_0x5da52e[_0x60f709[_0xd2db('0x26')]]={'$like':'%'+_0x229abc[_0xd2db('0x2d')]['filter']+'%'};return _0x5da52e;}})});}_0x2f3215=_[_0xd2db('0x3b')]({},_0x2f3215,_0x229abc[_0xd2db('0x3c')]);var _0x3862c1={'where':_0x2f3215['where']};return db[_0xd2db('0x3d')][_0xd2db('0x3e')](_0x3862c1)[_0xd2db('0x23')](function(_0x246184){_0x449a19[_0xd2db('0x3e')]=_0x246184;if(_0x229abc['query'][_0xd2db('0x3f')]){_0x2f3215[_0xd2db('0x40')]=[{'all':!![]}];}return db[_0xd2db('0x3d')][_0xd2db('0x41')](_0x2f3215);})[_0xd2db('0x23')](function(_0x2f6e03){_0x449a19['rows']=_0x2f6e03;return _0x449a19;})[_0xd2db('0x23')](respondWithFilteredResult(_0x2f34c8,_0x2f3215))['catch'](handleError(_0x2f34c8,null));};exports['show']=function(_0x23ac58,_0x2cdf0b){var _0x991ca={'raw':!![],'where':{'id':_0x23ac58[_0xd2db('0x42')]['id']}},_0x19519f={};_0x19519f[_0xd2db('0x2c')]=_[_0xd2db('0x2e')](db[_0xd2db('0x3d')]['rawAttributes']);_0x19519f[_0xd2db('0x2d')]=_[_0xd2db('0x2e')](_0x23ac58[_0xd2db('0x2d')]);_0x19519f[_0xd2db('0x2f')]=_[_0xd2db('0x30')](_0x19519f[_0xd2db('0x2c')],_0x19519f['query']);_0x991ca['attributes']=_['intersection'](_0x19519f[_0xd2db('0x2c')],qs[_0xd2db('0x32')](_0x23ac58[_0xd2db('0x2d')][_0xd2db('0x32')]));_0x991ca[_0xd2db('0x31')]=_0x991ca[_0xd2db('0x31')]['length']?_0x991ca['attributes']:_0x19519f[_0xd2db('0x2c')];if(_0x23ac58['query'][_0xd2db('0x3f')]){_0x991ca[_0xd2db('0x40')]=[{'all':!![]}];}_0x991ca=_[_0xd2db('0x3b')]({},_0x991ca,_0x23ac58[_0xd2db('0x3c')]);return db[_0xd2db('0x3d')][_0xd2db('0x43')](_0x991ca)[_0xd2db('0x23')](handleEntityNotFound(_0x2cdf0b,null))[_0xd2db('0x23')](respondWithResult(_0x2cdf0b,null))['catch'](handleError(_0x2cdf0b,null));};exports[_0xd2db('0x44')]=function(_0x301b6c,_0x59362c){return db[_0xd2db('0x3d')][_0xd2db('0x44')](_0x301b6c[_0xd2db('0x45')],{})[_0xd2db('0x23')](respondWithResult(_0x59362c,0xc9))[_0xd2db('0x46')](handleError(_0x59362c,null));};exports['update']=function(_0x4a91ae,_0x599937){if(_0x4a91ae[_0xd2db('0x45')]['id']){delete _0x4a91ae[_0xd2db('0x45')]['id'];}return db['FaxApplication'][_0xd2db('0x43')]({'where':{'id':_0x4a91ae[_0xd2db('0x42')]['id']}})[_0xd2db('0x23')](handleEntityNotFound(_0x599937,null))[_0xd2db('0x23')](saveUpdates(_0x4a91ae['body'],null))[_0xd2db('0x23')](respondWithResult(_0x599937,null))['catch'](handleError(_0x599937,null));};exports['destroy']=function(_0x5aaf8e,_0x43e37e){return db[_0xd2db('0x3d')]['find']({'where':{'id':_0x5aaf8e[_0xd2db('0x42')]['id']}})[_0xd2db('0x23')](handleEntityNotFound(_0x43e37e,null))[_0xd2db('0x23')](removeEntity(_0x43e37e,null))[_0xd2db('0x46')](handleError(_0x43e37e,null));}; \ No newline at end of file +var _0xcd82=['fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','destroy','then','stack','name','send','index','map','FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','update','find','eml-format','rimraf','zip-dir'];(function(_0x30ad84,_0x2d4003){var _0x18d7ed=function(_0x36af56){while(--_0x36af56){_0x30ad84['push'](_0x30ad84['shift']());}};_0x18d7ed(++_0x2d4003);}(_0xcd82,0x91));var _0x2cd8=function(_0x5f51c4,_0x204c1a){_0x5f51c4=_0x5f51c4-0x0;var _0x5c0a8d=_0xcd82[_0x5f51c4];return _0x5c0a8d;};'use strict';var emlformat=require(_0x2cd8('0x0'));var rimraf=require(_0x2cd8('0x1'));var zipdir=require(_0x2cd8('0x2'));var jsonpatch=require(_0x2cd8('0x3'));var rp=require('request-promise');var moment=require(_0x2cd8('0x4'));var BPromise=require(_0x2cd8('0x5'));var Mustache=require(_0x2cd8('0x6'));var util=require(_0x2cd8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2cd8('0x8'));var ejs=require(_0x2cd8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cd8('0xa'));var squel=require(_0x2cd8('0xb'));var crypto=require('crypto');var jsforce=require(_0x2cd8('0xc'));var deskjs=require(_0x2cd8('0xd'));var toCsv=require(_0x2cd8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cd8('0xe'));var authService=require(_0x2cd8('0xf'));var qs=require(_0x2cd8('0x10'));var as=require(_0x2cd8('0x11'));var hardwareService=require(_0x2cd8('0x12'));var logger=require(_0x2cd8('0x13'))(_0x2cd8('0x14'));var utils=require(_0x2cd8('0x15'));var config=require(_0x2cd8('0x16'));var licenseUtil=require(_0x2cd8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fdd9,_0x5e2e75){_0x5e2e75=_0x5e2e75||0xcc;return function(_0x4c2ef2){if(_0x4c2ef2){return _0x50fdd9[_0x2cd8('0x18')](_0x5e2e75);}return _0x50fdd9[_0x2cd8('0x19')](_0x5e2e75)[_0x2cd8('0x1a')]();};}function respondWithResult(_0x2d0a4e,_0xfb24ea){_0xfb24ea=_0xfb24ea||0xc8;return function(_0x200a9e){if(_0x200a9e){return _0x2d0a4e[_0x2cd8('0x19')](_0xfb24ea)[_0x2cd8('0x1b')](_0x200a9e);}};}function respondWithFilteredResult(_0x434d67,_0x16161d){return function(_0x451e83){if(_0x451e83){var _0x2e9e2e=typeof _0x16161d[_0x2cd8('0x1c')]==='undefined'&&typeof _0x16161d[_0x2cd8('0x1d')]===_0x2cd8('0x1e');var _0x393471=_0x451e83[_0x2cd8('0x1f')];var _0x225f3b=_0x2e9e2e?0x0:_0x16161d[_0x2cd8('0x1c')];var _0x39686d=_0x2e9e2e?_0x451e83[_0x2cd8('0x1f')]:_0x16161d[_0x2cd8('0x1c')]+_0x16161d['limit'];var _0x1242c5;if(_0x39686d>=_0x393471){_0x39686d=_0x393471;_0x1242c5=0xc8;}else{_0x1242c5=0xce;}_0x434d67[_0x2cd8('0x19')](_0x1242c5);return _0x434d67['set']('Content-Range',_0x225f3b+'-'+_0x39686d+'/'+_0x393471)[_0x2cd8('0x1b')](_0x451e83);}return null;};}function patchUpdates(_0x3e4b93){return function(_0x181702){try{jsonpatch[_0x2cd8('0x20')](_0x181702,_0x3e4b93,!![]);}catch(_0x321b62){return BPromise[_0x2cd8('0x21')](_0x321b62);}return _0x181702['save']();};}function saveUpdates(_0x5de990,_0x1a9e02){return function(_0x3ae2d6){if(_0x3ae2d6){return _0x3ae2d6['update'](_0x5de990)['then'](function(_0x5d62f0){return _0x5d62f0;});}return null;};}function removeEntity(_0x53cb65,_0x563975){return function(_0x3649d1){if(_0x3649d1){return _0x3649d1[_0x2cd8('0x22')]()[_0x2cd8('0x23')](function(){_0x53cb65['status'](0xcc)[_0x2cd8('0x1a')]();});}};}function handleEntityNotFound(_0x2cfdac,_0x591d7c){return function(_0x582790){if(!_0x582790){_0x2cfdac['sendStatus'](0x194);}return _0x582790;};}function handleError(_0x2b74b7,_0x468b57){_0x468b57=_0x468b57||0x1f4;return function(_0x397bd1){logger['error'](_0x397bd1[_0x2cd8('0x24')]);if(_0x397bd1[_0x2cd8('0x25')]){delete _0x397bd1[_0x2cd8('0x25')];}_0x2b74b7[_0x2cd8('0x19')](_0x468b57)[_0x2cd8('0x26')](_0x397bd1);};}exports[_0x2cd8('0x27')]=function(_0x1778da,_0x57b187){var _0x2e465a={},_0x413cab={},_0x4c113a={'count':0x0,'rows':[]};var _0x2f9f9c=_[_0x2cd8('0x28')](db[_0x2cd8('0x29')]['rawAttributes'],function(_0x4b505a){return{'name':_0x4b505a[_0x2cd8('0x2a')],'type':_0x4b505a[_0x2cd8('0x2b')][_0x2cd8('0x2c')]};});_0x413cab[_0x2cd8('0x2d')]=_[_0x2cd8('0x28')](_0x2f9f9c,_0x2cd8('0x25'));_0x413cab[_0x2cd8('0x2e')]=_[_0x2cd8('0x2f')](_0x1778da[_0x2cd8('0x2e')]);_0x413cab[_0x2cd8('0x30')]=_[_0x2cd8('0x31')](_0x413cab[_0x2cd8('0x2d')],_0x413cab[_0x2cd8('0x2e')]);_0x2e465a['attributes']=_[_0x2cd8('0x31')](_0x413cab[_0x2cd8('0x2d')],qs[_0x2cd8('0x32')](_0x1778da[_0x2cd8('0x2e')]['fields']));_0x2e465a['attributes']=_0x2e465a[_0x2cd8('0x33')]['length']?_0x2e465a[_0x2cd8('0x33')]:_0x413cab[_0x2cd8('0x2d')];if(!_0x1778da['query'][_0x2cd8('0x34')](_0x2cd8('0x35'))){_0x2e465a[_0x2cd8('0x1d')]=qs[_0x2cd8('0x1d')](_0x1778da[_0x2cd8('0x2e')][_0x2cd8('0x1d')]);_0x2e465a[_0x2cd8('0x1c')]=qs[_0x2cd8('0x1c')](_0x1778da[_0x2cd8('0x2e')]['offset']);}_0x2e465a[_0x2cd8('0x36')]=qs['sort'](_0x1778da['query'][_0x2cd8('0x37')]);_0x2e465a[_0x2cd8('0x38')]=qs[_0x2cd8('0x30')](_['pick'](_0x1778da[_0x2cd8('0x2e')],_0x413cab[_0x2cd8('0x30')]),_0x2f9f9c);if(_0x1778da[_0x2cd8('0x2e')][_0x2cd8('0x39')]){_0x2e465a[_0x2cd8('0x38')]=_[_0x2cd8('0x3a')](_0x2e465a['where'],{'$or':_[_0x2cd8('0x28')](_0x2f9f9c,function(_0x34bdf2){if(_0x34bdf2[_0x2cd8('0x2b')]!==_0x2cd8('0x3b')){var _0x8f6810={};_0x8f6810[_0x34bdf2[_0x2cd8('0x25')]]={'$like':'%'+_0x1778da['query']['filter']+'%'};return _0x8f6810;}})});}_0x2e465a=_[_0x2cd8('0x3a')]({},_0x2e465a,_0x1778da[_0x2cd8('0x3c')]);var _0x57ae79={'where':_0x2e465a[_0x2cd8('0x38')]};return db[_0x2cd8('0x29')][_0x2cd8('0x1f')](_0x57ae79)[_0x2cd8('0x23')](function(_0x1169f1){_0x4c113a[_0x2cd8('0x1f')]=_0x1169f1;if(_0x1778da[_0x2cd8('0x2e')]['includeAll']){_0x2e465a[_0x2cd8('0x3d')]=[{'all':!![]}];}return db['FaxApplication'][_0x2cd8('0x3e')](_0x2e465a);})[_0x2cd8('0x23')](function(_0x556618){_0x4c113a[_0x2cd8('0x3f')]=_0x556618;return _0x4c113a;})[_0x2cd8('0x23')](respondWithFilteredResult(_0x57b187,_0x2e465a))[_0x2cd8('0x40')](handleError(_0x57b187,null));};exports[_0x2cd8('0x41')]=function(_0x43c12c,_0x3a22fc){var _0x180eae={'raw':!![],'where':{'id':_0x43c12c[_0x2cd8('0x42')]['id']}},_0x63d8cc={};_0x63d8cc['model']=_[_0x2cd8('0x2f')](db[_0x2cd8('0x29')][_0x2cd8('0x43')]);_0x63d8cc[_0x2cd8('0x2e')]=_[_0x2cd8('0x2f')](_0x43c12c[_0x2cd8('0x2e')]);_0x63d8cc['filters']=_[_0x2cd8('0x31')](_0x63d8cc[_0x2cd8('0x2d')],_0x63d8cc[_0x2cd8('0x2e')]);_0x180eae[_0x2cd8('0x33')]=_[_0x2cd8('0x31')](_0x63d8cc[_0x2cd8('0x2d')],qs[_0x2cd8('0x32')](_0x43c12c[_0x2cd8('0x2e')][_0x2cd8('0x32')]));_0x180eae[_0x2cd8('0x33')]=_0x180eae[_0x2cd8('0x33')][_0x2cd8('0x44')]?_0x180eae['attributes']:_0x63d8cc[_0x2cd8('0x2d')];if(_0x43c12c[_0x2cd8('0x2e')][_0x2cd8('0x45')]){_0x180eae[_0x2cd8('0x3d')]=[{'all':!![]}];}_0x180eae=_[_0x2cd8('0x3a')]({},_0x180eae,_0x43c12c['options']);return db['FaxApplication']['find'](_0x180eae)[_0x2cd8('0x23')](handleEntityNotFound(_0x3a22fc,null))[_0x2cd8('0x23')](respondWithResult(_0x3a22fc,null))[_0x2cd8('0x40')](handleError(_0x3a22fc,null));};exports[_0x2cd8('0x46')]=function(_0x4ee0b0,_0x4cb1fb){return db['FaxApplication'][_0x2cd8('0x46')](_0x4ee0b0[_0x2cd8('0x47')],{})[_0x2cd8('0x23')](respondWithResult(_0x4cb1fb,0xc9))[_0x2cd8('0x40')](handleError(_0x4cb1fb,null));};exports[_0x2cd8('0x48')]=function(_0x2be12a,_0x502ad7){if(_0x2be12a[_0x2cd8('0x47')]['id']){delete _0x2be12a[_0x2cd8('0x47')]['id'];}return db['FaxApplication'][_0x2cd8('0x49')]({'where':{'id':_0x2be12a[_0x2cd8('0x42')]['id']}})['then'](handleEntityNotFound(_0x502ad7,null))[_0x2cd8('0x23')](saveUpdates(_0x2be12a[_0x2cd8('0x47')],null))['then'](respondWithResult(_0x502ad7,null))[_0x2cd8('0x40')](handleError(_0x502ad7,null));};exports[_0x2cd8('0x22')]=function(_0x5cf20c,_0x51d7ad){return db[_0x2cd8('0x29')][_0x2cd8('0x49')]({'where':{'id':_0x5cf20c[_0x2cd8('0x42')]['id']}})[_0x2cd8('0x23')](handleEntityNotFound(_0x51d7ad,null))[_0x2cd8('0x23')](removeEntity(_0x51d7ad,null))[_0x2cd8('0x40')](handleError(_0x51d7ad,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 36a7bc2..34b58e8 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 _0x6f41=['utf8mb4_unicode_ci','util','api','moment','bluebird','path','./faxApplication.attributes','exports','FaxApplication'];(function(_0x4e8682,_0x272d09){var _0x3ea727=function(_0x4164d7){while(--_0x4164d7){_0x4e8682['push'](_0x4e8682['shift']());}};_0x3ea727(++_0x272d09);}(_0x6f41,0x17b));var _0x16f4=function(_0x5f143a,_0x4aa14d){_0x5f143a=_0x5f143a-0x0;var _0x4bae5f=_0x6f41[_0x5f143a];return _0x4bae5f;};'use strict';var _=require('lodash');var util=require(_0x16f4('0x0'));var logger=require('../../config/logger')(_0x16f4('0x1'));var moment=require(_0x16f4('0x2'));var BPromise=require(_0x16f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16f4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16f4('0x5'));module[_0x16f4('0x6')]=function(_0x4b9216,_0x57e8a2){return _0x4b9216['define'](_0x16f4('0x7'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x16f4('0x8')});}; \ No newline at end of file +var _0x7ab9=['../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31e7b4,_0x1f4165){var _0x305ce0=function(_0x297df2){while(--_0x297df2){_0x31e7b4['push'](_0x31e7b4['shift']());}};_0x305ce0(++_0x1f4165);}(_0x7ab9,0xca));var _0x97ab=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x7ab9[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x97ab('0x0'));var util=require(_0x97ab('0x1'));var logger=require(_0x97ab('0x2'))(_0x97ab('0x3'));var moment=require('moment');var BPromise=require(_0x97ab('0x4'));var rp=require(_0x97ab('0x5'));var fs=require('fs');var path=require(_0x97ab('0x6'));var rimraf=require(_0x97ab('0x7'));var config=require(_0x97ab('0x8'));var attributes=require('./faxApplication.attributes');module[_0x97ab('0x9')]=function(_0x107983,_0x210e9c){return _0x107983[_0x97ab('0xa')]('FaxApplication',attributes,{'tableName':_0x97ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97ab('0xc'),'collate':_0x97ab('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 24b5f78..b3a907f 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 _0x7bb0=['moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','util'];(function(_0x198f46,_0x317ae8){var _0x4c680c=function(_0x1f5e74){while(--_0x1f5e74){_0x198f46['push'](_0x198f46['shift']());}};_0x4c680c(++_0x317ae8);}(_0x7bb0,0xa7));var _0x07bb=function(_0xf9b4e3,_0x3a1b45){_0xf9b4e3=_0xf9b4e3-0x0;var _0x4bc8d3=_0x7bb0[_0xf9b4e3];return _0x4bc8d3;};'use strict';var _=require('lodash');var util=require(_0x07bb('0x0'));var moment=require(_0x07bb('0x1'));var BPromise=require(_0x07bb('0x2'));var rs=require(_0x07bb('0x3'));var fs=require('fs');var Redis=require(_0x07bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07bb('0x5'))('rpc');var config=require(_0x07bb('0x6'));var jayson=require(_0x07bb('0x7'));var client=jayson[_0x07bb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21f39c,_0x329c81,_0x1322e2){return new BPromise(function(_0x30079a,_0x35b258){return client[_0x07bb('0x9')](_0x21f39c,_0x1322e2)[_0x07bb('0xa')](function(_0x1f9953){logger[_0x07bb('0xb')]('FaxApplication,\x20%s,\x20%s',_0x329c81,_0x07bb('0xc'));logger[_0x07bb('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x329c81,_0x07bb('0xc'),JSON['stringify'](_0x1f9953));if(_0x1f9953[_0x07bb('0xe')]){if(_0x1f9953[_0x07bb('0xe')]['code']===0x1f4){logger[_0x07bb('0xe')](_0x07bb('0xf'),_0x329c81,_0x1f9953[_0x07bb('0xe')]['message']);return _0x35b258(_0x1f9953[_0x07bb('0xe')][_0x07bb('0x10')]);}logger['error'](_0x07bb('0xf'),_0x329c81,_0x1f9953[_0x07bb('0xe')][_0x07bb('0x10')]);return _0x30079a(_0x1f9953[_0x07bb('0xe')][_0x07bb('0x10')]);}else{logger[_0x07bb('0xb')](_0x07bb('0xf'),_0x329c81,_0x07bb('0xc'));_0x30079a(_0x1f9953[_0x07bb('0x11')][_0x07bb('0x10')]);}})[_0x07bb('0x12')](function(_0x374d34){logger[_0x07bb('0xe')]('FaxApplication,\x20%s,\x20%s',_0x329c81,_0x374d34);_0x35b258(_0x374d34);});});}exports[_0x07bb('0x13')]=function(_0x181f46){var _0x2efe26=this;return new Promise(function(_0x24a7d1,_0x193863){return db[_0x07bb('0x14')][_0x07bb('0x15')](_0x181f46[_0x07bb('0x16')],{'raw':_0x181f46[_0x07bb('0x17')]?_0x181f46[_0x07bb('0x17')][_0x07bb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181f46['options']?_0x181f46['options'][_0x07bb('0x19')]||null:null,'attributes':_0x181f46[_0x07bb('0x17')]?_0x181f46['options'][_0x07bb('0x1a')]||null:null,'limit':_0x181f46[_0x07bb('0x17')]?_0x181f46[_0x07bb('0x17')][_0x07bb('0x1b')]||null:null})[_0x07bb('0xa')](function(_0x1a5abb){logger[_0x07bb('0xb')]('UpdateFaxApplication',_0x181f46);logger[_0x07bb('0xd')](_0x07bb('0x13'),_0x181f46,JSON['stringify'](_0x1a5abb));_0x24a7d1(_0x1a5abb);})[_0x07bb('0x12')](function(_0x1ac08a){logger[_0x07bb('0xe')](_0x07bb('0x13'),_0x1ac08a[_0x07bb('0x10')],_0x181f46);_0x193863(_0x2efe26['error'](0x1f4,_0x1ac08a[_0x07bb('0x10')]));});});}; \ No newline at end of file +var _0x0a61=['jayson/promise','client','request','then','request\x20sent','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36b4de,_0x52fbba){var _0x540126=function(_0x1fd6c9){while(--_0x1fd6c9){_0x36b4de['push'](_0x36b4de['shift']());}};_0x540126(++_0x52fbba);}(_0x0a61,0x12c));var _0x10a6=function(_0x39fc1c,_0x188d88){_0x39fc1c=_0x39fc1c-0x0;var _0xee23ec=_0x0a61[_0x39fc1c];return _0xee23ec;};'use strict';var _=require(_0x10a6('0x0'));var util=require(_0x10a6('0x1'));var moment=require(_0x10a6('0x2'));var BPromise=require(_0x10a6('0x3'));var rs=require(_0x10a6('0x4'));var fs=require('fs');var Redis=require(_0x10a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10a6('0x6'));var logger=require(_0x10a6('0x7'))(_0x10a6('0x8'));var config=require(_0x10a6('0x9'));var jayson=require(_0x10a6('0xa'));var client=jayson[_0x10a6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3867bb,_0x18d036,_0x30e7c2){return new BPromise(function(_0x2bbd58,_0xa49b65){return client[_0x10a6('0xc')](_0x3867bb,_0x30e7c2)[_0x10a6('0xd')](function(_0x3bd1c3){logger['info']('FaxApplication,\x20%s,\x20%s',_0x18d036,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x18d036,_0x10a6('0xe'),JSON[_0x10a6('0xf')](_0x3bd1c3));if(_0x3bd1c3['error']){if(_0x3bd1c3[_0x10a6('0x10')][_0x10a6('0x11')]===0x1f4){logger[_0x10a6('0x10')]('FaxApplication,\x20%s,\x20%s',_0x18d036,_0x3bd1c3['error'][_0x10a6('0x12')]);return _0xa49b65(_0x3bd1c3[_0x10a6('0x10')][_0x10a6('0x12')]);}logger[_0x10a6('0x10')]('FaxApplication,\x20%s,\x20%s',_0x18d036,_0x3bd1c3['error']['message']);return _0x2bbd58(_0x3bd1c3[_0x10a6('0x10')][_0x10a6('0x12')]);}else{logger['info'](_0x10a6('0x13'),_0x18d036,_0x10a6('0xe'));_0x2bbd58(_0x3bd1c3[_0x10a6('0x14')][_0x10a6('0x12')]);}})[_0x10a6('0x15')](function(_0x5f3cea){logger[_0x10a6('0x10')]('FaxApplication,\x20%s,\x20%s',_0x18d036,_0x5f3cea);_0xa49b65(_0x5f3cea);});});}exports[_0x10a6('0x16')]=function(_0x324d9e){var _0x3034c2=this;return new Promise(function(_0x46a710,_0x3c8482){return db[_0x10a6('0x17')][_0x10a6('0x18')](_0x324d9e['body'],{'raw':_0x324d9e[_0x10a6('0x19')]?_0x324d9e['options'][_0x10a6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x324d9e[_0x10a6('0x19')]?_0x324d9e['options'][_0x10a6('0x1b')]||null:null,'attributes':_0x324d9e[_0x10a6('0x19')]?_0x324d9e[_0x10a6('0x19')][_0x10a6('0x1c')]||null:null,'limit':_0x324d9e[_0x10a6('0x19')]?_0x324d9e[_0x10a6('0x19')][_0x10a6('0x1d')]||null:null})[_0x10a6('0xd')](function(_0x2c00a2){logger[_0x10a6('0x1e')](_0x10a6('0x16'),_0x324d9e);logger['debug'](_0x10a6('0x16'),_0x324d9e,JSON[_0x10a6('0xf')](_0x2c00a2));_0x46a710(_0x2c00a2);})['catch'](function(_0x3935f9){logger['error'](_0x10a6('0x16'),_0x3935f9[_0x10a6('0x12')],_0x324d9e);_0x3c8482(_0x3034c2[_0x10a6('0x10')](0x1f4,_0x3935f9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1842ca6..1f0099e 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 _0x2547=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x4a6470,_0x167a61){var _0x5203d7=function(_0x107a98){while(--_0x107a98){_0x4a6470['push'](_0x4a6470['shift']());}};_0x5203d7(++_0x167a61);}(_0x2547,0x1cd));var _0x7254=function(_0x2d6c3d,_0x489153){_0x2d6c3d=_0x2d6c3d-0x0;var _0x2a06a7=_0x2547[_0x2d6c3d];return _0x2a06a7;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['post']('/',auth[_0x7254('0xa')](),controller['create']);router['put']('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0xe')]);router[_0x7254('0xf')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5221aa,_0x4f9bd8){var _0x22c2da=function(_0x1f7926){while(--_0x1f7926){_0x5221aa['push'](_0x5221aa['shift']());}};_0x22c2da(++_0x4f9bd8);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xe5b5[_0x36909d];return _0x1fd29d;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index bf07cdd..f1b0feb 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 _0x3b96=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x471eb6,_0x153ab9){var _0x86d4a1=function(_0x3847f3){while(--_0x3847f3){_0x471eb6['push'](_0x471eb6['shift']());}};_0x86d4a1(++_0x153ab9);}(_0x3b96,0x182));var _0x63b9=function(_0x59689a,_0x23f736){_0x59689a=_0x59689a-0x0;var _0x2a3eba=_0x3b96[_0x59689a];return _0x2a3eba;};'use strict';var Sequelize=require(_0x63b9('0x0'));module[_0x63b9('0x1')]={'closed':{'type':Sequelize[_0x63b9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x63b9('0x3')]},'disposition':{'type':Sequelize[_0x63b9('0x4')]},'secondDisposition':{'type':Sequelize[_0x63b9('0x4')]},'thirdDisposition':{'type':Sequelize[_0x63b9('0x4')]},'note':{'type':Sequelize[_0x63b9('0x4')]},'read1stAt':{'type':Sequelize[_0x63b9('0x3')]},'fax':{'type':Sequelize[_0x63b9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x63b9('0x5')]('in',_0x63b9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x63b9('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x63b9('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0970=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0970,0x1a1));var _0x0097=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0970[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0097('0x0'));module[_0x0097('0x1')]={'closed':{'type':Sequelize[_0x0097('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0097('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0097('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0097('0x4')]},'note':{'type':Sequelize[_0x0097('0x4')]},'read1stAt':{'type':Sequelize[_0x0097('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x0097('0x5')]('in',_0x0097('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0097('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0097('0x5')]('in',_0x0097('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 31f7dc4..6759e9a 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 _0x99a9=['send','map','fullname','TagIds','Tags','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','FaxInteraction','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','tools_tags','u.id','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','buildExpression','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','clone','i.id','contactName','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','show','includeAll','include','create','params','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','keys','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','tmp','server','attachments','transcript-%d-%s.zip','Messages','mkdirSync','existsSync','basename','resolve','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x99a9,0x178));var _0x999a=function(_0x227413,_0x44ba39){_0x227413=_0x227413-0x0;var _0x1abc2a=_0x99a9[_0x227413];return _0x1abc2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999a('0x0'));var zipdir=require(_0x999a('0x1'));var jsonpatch=require(_0x999a('0x2'));var rp=require(_0x999a('0x3'));var moment=require(_0x999a('0x4'));var BPromise=require(_0x999a('0x5'));var Mustache=require('mustache');var util=require(_0x999a('0x6'));var path=require('path');var sox=require(_0x999a('0x7'));var csv=require(_0x999a('0x8'));var ejs=require(_0x999a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x999a('0xa'));var jsforce=require(_0x999a('0xb'));var deskjs=require(_0x999a('0xc'));var toCsv=require(_0x999a('0x8'));var querystring=require(_0x999a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x999a('0xe'));var qs=require(_0x999a('0xf'));var as=require(_0x999a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x999a('0x11'))('api');var utils=require(_0x999a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x999a('0x13'));var db=require(_0x999a('0x14'))['db'];config[_0x999a('0x15')]=_[_0x999a('0x16')](config[_0x999a('0x15')],{'host':_0x999a('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x999a('0x15')]));require('./faxInteraction.socket')[_0x999a('0x18')](socket);function respondWithStatusCode(_0x69bdc,_0x4d773d){_0x4d773d=_0x4d773d||0xcc;return function(_0x4ed2c3){if(_0x4ed2c3){return _0x69bdc['sendStatus'](_0x4d773d);}return _0x69bdc['status'](_0x4d773d)[_0x999a('0x19')]();};}function respondWithResult(_0x2f78d6,_0x42ab27){_0x42ab27=_0x42ab27||0xc8;return function(_0x20ad65){if(_0x20ad65){return _0x2f78d6[_0x999a('0x1a')](_0x42ab27)[_0x999a('0x1b')](_0x20ad65);}};}function respondWithFilteredResult(_0x2812db,_0x4c7f54){return function(_0x2fbcd4){if(_0x2fbcd4){var _0x5a146c=typeof _0x4c7f54[_0x999a('0x1c')]==='undefined'&&typeof _0x4c7f54[_0x999a('0x1d')]===_0x999a('0x1e');var _0x28f5ee=_0x2fbcd4[_0x999a('0x1f')];var _0x224726=_0x5a146c?0x0:_0x4c7f54[_0x999a('0x1c')];var _0x508309=_0x5a146c?_0x2fbcd4['count']:_0x4c7f54[_0x999a('0x1c')]+_0x4c7f54[_0x999a('0x1d')];var _0x4d5fa9;if(_0x508309>=_0x28f5ee){_0x508309=_0x28f5ee;_0x4d5fa9=0xc8;}else{_0x4d5fa9=0xce;}_0x2812db[_0x999a('0x1a')](_0x4d5fa9);return _0x2812db[_0x999a('0x20')](_0x999a('0x21'),_0x224726+'-'+_0x508309+'/'+_0x28f5ee)[_0x999a('0x1b')](_0x2fbcd4);}return null;};}function patchUpdates(_0x15026f){return function(_0x473243){try{jsonpatch[_0x999a('0x22')](_0x473243,_0x15026f,!![]);}catch(_0x54b8ef){return BPromise['reject'](_0x54b8ef);}return _0x473243[_0x999a('0x23')]();};}function saveUpdates(_0x4bb3a0,_0x420ca7){return function(_0x3ee843){if(_0x3ee843){return _0x3ee843[_0x999a('0x24')](_0x4bb3a0)[_0x999a('0x25')](function(_0x11edab){return _0x11edab;});}return null;};}function removeEntity(_0x44c99c,_0x2fa536){return function(_0x20a8e8){if(_0x20a8e8){return _0x20a8e8['destroy']()['then'](function(){_0x44c99c[_0x999a('0x1a')](0xcc)[_0x999a('0x19')]();});}};}function handleEntityNotFound(_0x5bd9fd,_0x4c24e4){return function(_0x1ad854){if(!_0x1ad854){_0x5bd9fd[_0x999a('0x26')](0x194);}return _0x1ad854;};}function handleError(_0x3a599f,_0x5b4913){_0x5b4913=_0x5b4913||0x1f4;return function(_0x274a07){logger[_0x999a('0x27')](_0x274a07[_0x999a('0x28')]);if(_0x274a07[_0x999a('0x29')]){delete _0x274a07[_0x999a('0x29')];}_0x3a599f[_0x999a('0x1a')](_0x5b4913)[_0x999a('0x2a')](_0x274a07);};}function getInteractionUsers(_0x425b50,_0x529ae5){return new BPromise(function(_0x26fc9b,_0x1ab4c0){try{if(_0x529ae5[_0x425b50['id']]){_0x425b50['Users']=_[_0x999a('0x2b')](_0x529ae5[_0x425b50['id']],function(_0x32ab70){return{'id':_0x32ab70['id'],'fullname':_0x32ab70[_0x999a('0x2c')]};});}}catch(_0x268447){_0x1ab4c0(_0x268447);}_0x26fc9b(_0x425b50);});}function getInteractionTags(_0x446f57,_0x2ce48d){return new BPromise(function(_0x1a2299,_0x1b7804){try{if(_0x446f57[_0x999a('0x2d')]){_0x446f57[_0x999a('0x2e')]=[];_0x446f57[_0x999a('0x2d')]['split'](',')['forEach'](function(_0x4071e4){_0x446f57[_0x999a('0x2e')][_0x999a('0x2f')](_0x2ce48d[_0x4071e4]);});}delete _0x446f57[_0x999a('0x2d')];}catch(_0x270b4c){_0x1b7804(_0x270b4c);}_0x1a2299(_0x446f57);});}function updateFaxInteraction(_0x50a8ed,_0x11aa78,_0x551e08){return new BPromise(function(_0x2f66bc,_0x4c23e4){return getInteractionUsers(_0x50a8ed,_0x551e08)[_0x999a('0x25')](function(_0x5ebd60){return getInteractionTags(_0x5ebd60,_0x11aa78);})[_0x999a('0x25')](function(_0x64f69b){return getStateInteraction(_0x64f69b);})[_0x999a('0x25')](function(_0x5ab5f8){_0x2f66bc(_0x5ab5f8);})[_0x999a('0x30')](function(_0x553257){_0x4c23e4(_0x553257);});});}function getStateInteraction(_0x20ed29){return new BPromise(function(_0x10cfbf){_0x20ed29[_0x999a('0x31')]=0x0;_0x20ed29[_0x999a('0x32')]=0x0;_0x20ed29[_0x999a('0x33')]=0x0;_0x20ed29[_0x999a('0x34')]=0x0;_0x20ed29[_0x999a('0x35')]=0x0;if(!_0x20ed29[_0x999a('0x36')]&&!_0x20ed29[_0x999a('0x37')]){_0x20ed29['waiting']+=0x1;}if(!_0x20ed29[_0x999a('0x36')]&&_0x20ed29[_0x999a('0x37')]){_0x20ed29[_0x999a('0x32')]+=0x1;if(_0x20ed29['waiting']){_0x20ed29[_0x999a('0x31')]-=0x1;}}if(_0x20ed29['closed']&&_0x20ed29[_0x999a('0x37')]){_0x20ed29['answered']+=0x1;if(_0x20ed29['talking']){_0x20ed29[_0x999a('0x32')]-=0x1;}}if(_0x20ed29[_0x999a('0x36')]&&!_0x20ed29[_0x999a('0x37')]){_0x20ed29[_0x999a('0x34')]+=0x1;if(_0x20ed29[_0x999a('0x31')]){_0x20ed29[_0x999a('0x31')]-=0x1;}}_0x20ed29[_0x999a('0x35')]+=0x1;_0x10cfbf(_0x20ed29);});}exports[_0x999a('0x38')]=function(_0x34c6d7,_0x2bcbb4){var _0x12cf16={},_0x34667b={},_0x4ddbe3={'count':0x0,'rows':[]};var _0x3aa8cc=_[_0x999a('0x2b')](db[_0x999a('0x39')][_0x999a('0x3a')],function(_0x3f3c62){return{'name':_0x3f3c62['fieldName'],'type':_0x3f3c62[_0x999a('0x3b')][_0x999a('0x3c')]};});_0x34667b[_0x999a('0x3d')]=_[_0x999a('0x2b')](_0x3aa8cc,_0x999a('0x29'));_0x34667b[_0x999a('0x3e')]=_['keys'](_0x34c6d7[_0x999a('0x3e')]);_0x34667b[_0x999a('0x3f')]=_[_0x999a('0x40')](_0x34667b[_0x999a('0x3d')],_0x34667b['query']);_0x12cf16['attributes']=_[_0x999a('0x40')](_0x34667b['model'],qs[_0x999a('0x41')](_0x34c6d7['query'][_0x999a('0x41')]));_0x12cf16[_0x999a('0x42')]=_0x12cf16[_0x999a('0x42')][_0x999a('0x43')]?_0x12cf16[_0x999a('0x42')]:_0x34667b[_0x999a('0x3d')];if(!_0x34c6d7['query'][_0x999a('0x44')]('nolimit')){_0x12cf16['limit']=qs['limit'](_0x34c6d7[_0x999a('0x3e')][_0x999a('0x1d')]);_0x12cf16['offset']=qs[_0x999a('0x1c')](_0x34c6d7['query'][_0x999a('0x1c')]);}_0x12cf16[_0x999a('0x45')]=qs[_0x999a('0x46')](_0x34c6d7[_0x999a('0x3e')][_0x999a('0x46')]);_0x12cf16[_0x999a('0x47')]=qs['filters'](_[_0x999a('0x48')](_0x34c6d7[_0x999a('0x3e')],_0x34667b[_0x999a('0x3f')]),_0x3aa8cc);var _0x54a8bf=[];var _0x4446fa=squel[_0x999a('0x49')]()[_0x999a('0x4a')]('id')['field'](_0x999a('0x29'))[_0x999a('0x4a')]('color')['from'](_0x999a('0x4b'));var _0x17460e=squel[_0x999a('0x49')]()[_0x999a('0x4a')](_0x999a('0x4c'))[_0x999a('0x4a')]('u.fullname')[_0x999a('0x4a')](_0x999a('0x4d'))[_0x999a('0x4e')](_0x999a('0x4f'),'ui')[_0x999a('0x50')](_0x999a('0x51'),'u',_0x999a('0x52'));var _0x107c2e=squel[_0x999a('0x49')]()[_0x999a('0x4e')]('fax_interactions','i')[_0x999a('0x50')](_0x999a('0x53'),'c',_0x999a('0x54'))['left_join'](_0x999a('0x51'),'o',_0x999a('0x55'))[_0x999a('0x50')]('fax_accounts','a',_0x999a('0x56'))[_0x999a('0x50')](_0x999a('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x999a('0x50')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x999a('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x51d6fc=squel['expr']();var _0x5bd9b7=[];var _0x4d504a=squel[_0x999a('0x58')]();var _0x179329;if(_0x34c6d7[_0x999a('0x3e')]['search']){_0x179329=as[_0x999a('0x59')](_0x34c6d7['query'][_0x999a('0x5a')]);var _0x4fd673=_0x179329[_0x999a('0x5b')];for(var _0x5a67fd=0x0;_0x5a67fd<_0x179329[_0x999a('0x5c')]['length'];_0x5a67fd++){var _0x468712=_0x179329[_0x999a('0x5c')][_0x5a67fd];var _0x78da33='i';var _0x10f355=_['find'](_0x3aa8cc,['name',_0x468712['field']]);if(!_0x10f355){switch(_0x468712[_0x999a('0x4a')]){case _0x999a('0x5d'):if(_0x468712[_0x999a('0x5e')]==0x1){_0x107c2e[_0x999a('0x5f')]('`'+_0x468712[_0x999a('0x4a')]+'`\x20=\x200');}else{_0x107c2e[_0x999a('0x5f')]('`'+_0x468712[_0x999a('0x4a')]+'`\x20>\x200');}break;case _0x999a('0x60'):if(_0x468712['operator']===_0x999a('0x61')){if(_0x468712[_0x999a('0x5e')][_0x999a('0x62')]('\x20')[_0x999a('0x43')]>0x1){_0x51d6fc[_0x4fd673](_0x999a('0x63'),qs[_0x999a('0x64')](_0x468712[_0x999a('0x5e')]),null);}else{var _0x504f2c='%'+_0x468712['value']+'%';_0x51d6fc[_0x4fd673]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x504f2c,_0x504f2c,_0x504f2c);}}else{_0x10f355=_[_0x999a('0x65')](_0x3aa8cc,[_0x999a('0x29'),_0x999a('0x66')]);_0x468712[_0x999a('0x4a')]=_0x999a('0x66');_0xad3980=as['buildExpression'](_0x78da33,_0x10f355['type'],_0x468712);_0x51d6fc[_0x4fd673](_0xad3980['text'],_0xad3980[_0x999a('0x5e')][_0x999a('0x67')],_0xad3980[_0x999a('0x5e')][_0x999a('0x19')]);}break;case'Tag':var _0x49ec7b=_0x468712[_0x999a('0x5e')][_0x999a('0x62')](',')[_0x999a('0x2b')](function(_0x2bc875){return Number(_0x2bc875);});_0x49ec7b[_0x999a('0x68')](function(_0x388212){_0x4d504a['or'](_0x999a('0x69'),'%,'+_0x388212+',%');});_0x5bd9b7=_[_0x999a('0x6a')](_0x5bd9b7,_0x49ec7b);break;case _0x999a('0x6b'):if(_0x468712[_0x999a('0x6c')]===_0x999a('0x61')){_0x51d6fc[_0x4fd673](_0x999a('0x6d'),'%'+_0x468712[_0x999a('0x5e')]+'%',null);}else{_0x10f355=_[_0x999a('0x65')](_0x3aa8cc,[_0x999a('0x29'),_0x999a('0x37')]);_0x468712[_0x999a('0x4a')]='UserId';_0xad3980=as['buildExpression'](_0x78da33,_0x10f355[_0x999a('0x3b')],_0x468712);_0x51d6fc[_0x4fd673](_0xad3980[_0x999a('0x6e')],_0xad3980[_0x999a('0x5e')][_0x999a('0x67')],_0xad3980['value'][_0x999a('0x19')]);}break;case _0x999a('0x6f'):_0xad3980=as[_0x999a('0x70')]('me',null,_0x468712);_0x51d6fc[_0x4fd673](_0xad3980[_0x999a('0x6e')],_0xad3980[_0x999a('0x5e')][_0x999a('0x67')],_0xad3980[_0x999a('0x5e')][_0x999a('0x19')]);break;}}else{var _0xad3980=as[_0x999a('0x70')](_0x78da33,_0x10f355[_0x999a('0x3b')],_0x468712);_0x51d6fc[_0x4fd673](_0xad3980[_0x999a('0x6e')],_0xad3980[_0x999a('0x5e')][_0x999a('0x67')],_0xad3980[_0x999a('0x5e')][_0x999a('0x19')]);}}}else{var _0x4a701e=_(_0x34c6d7[_0x999a('0x3e')])['keys']()[_0x999a('0x2b')](function(_0xbbe846){return _[_0x999a('0x71')](_0x3aa8cc,[_0x999a('0x29'),_0xbbe846])?_0xbbe846:undefined;})[_0x999a('0x72')]()['value']();if(!_[_0x999a('0x73')](_0x4a701e)){_0x4a701e['forEach'](function(_0x4dc042){if(_0x4dc042===_0x999a('0x74')){_0x107c2e[_0x999a('0x47')](_0x999a('0x75'),[][_0x999a('0x76')](_0x34c6d7[_0x999a('0x3e')][_0x4dc042]));}else if(_0x4dc042===_0x999a('0x77')){var _0xd6ccf0=JSON[_0x999a('0x78')](_0x34c6d7['query'][_0x4dc042])[_0x999a('0x79')];var _0x21407d=JSON[_0x999a('0x78')](_0x34c6d7['query'][_0x4dc042])['$lte'];_0x107c2e['where'](_0x999a('0x7a'),_0xd6ccf0,_0x21407d);}else{if(_0x34c6d7[_0x999a('0x3e')][_0x4dc042]===_0x999a('0x7b')){_0x107c2e[_0x999a('0x47')]('i.'+_0x4dc042+_0x999a('0x7c'));}else{_0x107c2e[_0x999a('0x47')]('i.'+_0x4dc042+_0x999a('0x7d'),_0x34c6d7[_0x999a('0x3e')][_0x4dc042]);}}});}if(_0x34c6d7[_0x999a('0x3e')][_0x999a('0x7e')]){if(_0x34c6d7[_0x999a('0x3e')][_0x999a('0x7e')]==0x1){_0x107c2e[_0x999a('0x5f')](_0x999a('0x7f'));}else{_0x107c2e['having']('`unreadMessages`\x20>\x200');}}if(_0x34c6d7[_0x999a('0x3e')][_0x999a('0x80')]){_0x5bd9b7=_[_0x999a('0x81')](_0x34c6d7[_0x999a('0x3e')][_0x999a('0x80')])?_0x34c6d7[_0x999a('0x3e')][_0x999a('0x80')]:new Array(_0x34c6d7['query'][_0x999a('0x80')]);_0x5bd9b7[_0x999a('0x68')](function(_0x1f91d1){_0x4d504a['or'](_0x999a('0x69'),'%,'+_0x1f91d1+',%');});}if(_0x34c6d7[_0x999a('0x3e')][_0x999a('0x82')]){var _0x22bbd1=_0x34c6d7['query'][_0x999a('0x82')][_0x999a('0x83')]('\x5c','\x5c\x5c')[_0x999a('0x83')](/'/g,'\x27\x27');if(qs[_0x999a('0x84')](_0x22bbd1)){_0x51d6fc['or'](_0x999a('0x85'),_0x22bbd1+'%')['or'](_0x999a('0x86'),_0x22bbd1+'%');}_0x51d6fc['or'](_0x999a('0x87'),_0x22bbd1+'%');}}_0x107c2e[_0x999a('0x47')](_0x51d6fc);_0x107c2e['group']('i.id');var _0x13b547={'type':db['Sequelize'][_0x999a('0x88')][_0x999a('0x89')],'raw':!![]};var _0x5b55e0=_0x107c2e[_0x999a('0x8a')]();_0x5b55e0[_0x999a('0x4a')](_0x999a('0x8b'));_0x5b55e0[_0x999a('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x12cf16[_0x999a('0x45')]){_0x12cf16[_0x999a('0x45')]['forEach'](function(_0x44544c){var _0x1c1cde=_0x44544c[0x0]===_0x999a('0x8c')?_0x44544c[0x0]:'i.'+_0x44544c[0x0];_0x107c2e[_0x999a('0x45')](_0x1c1cde,_0x44544c[0x1]===_0x999a('0x8d')?![]:!![]);});}if(!_[_0x999a('0x73')](_0x5bd9b7)){_0x107c2e['having'](_0x4d504a);_0x5b55e0[_0x999a('0x47')]('t.id\x20IN\x20?',_0x5bd9b7);}BPromise['resolve']()[_0x999a('0x25')](function(){if(!_0x179329){if(_0x34c6d7[_0x999a('0x3e')][_0x999a('0x74')])return;_0x5b55e0['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x107c2e[_0x999a('0x47')](_0x999a('0x8e'));return;}if(_0x34c6d7[_0x999a('0x8f')][_0x999a('0x90')]!==_0x999a('0x91'))return;return _0x34c6d7[_0x999a('0x8f')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x999a('0x25')](function(_0x109f58){if(_[_0x999a('0x73')](_0x109f58)){_0x5b55e0[_0x999a('0x47')](_0x999a('0x92'));_0x107c2e[_0x999a('0x47')](_0x999a('0x92'));}else{_0x5b55e0[_0x999a('0x47')](_0x999a('0x75'),_[_0x999a('0x2b')](_0x109f58,'id'));_0x107c2e[_0x999a('0x47')](_0x999a('0x75'),_[_0x999a('0x2b')](_0x109f58,'id'));}});})[_0x999a('0x25')](function(){if(_0x34c6d7[_0x999a('0x8f')][_0x999a('0x90')]===_0x999a('0x91')&&!_0x179329&&!_0x34c6d7[_0x999a('0x3e')][_0x999a('0x74')])return[];return db['sequelize']['query'](_0x5b55e0[_0x999a('0x93')](),_0x13b547);})[_0x999a('0x25')](function(_0x42939b){_0x4ddbe3['count']=_0x42939b[_0x999a('0x43')];if(_0x4ddbe3[_0x999a('0x1f')]===0x0)return[];return db[_0x999a('0x94')][_0x999a('0x3e')](_0x4446fa[_0x999a('0x93')](),_0x13b547)[_0x999a('0x25')](function(_0x1345f9){_0x54a8bf=_['keyBy'](_0x1345f9,'id');_0x13b547=_[_0x999a('0x95')](_0x13b547,{'model':db[_0x999a('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34c6d7[_0x999a('0x3e')]['fields']){_0x12cf16[_0x999a('0x42')][_0x999a('0x68')](function(_0x138a8d){_0x107c2e[_0x999a('0x4a')]('i.'+_0x138a8d);});}else{_0x107c2e[_0x999a('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x999a('0x5d'));_0x107c2e['field'](_0x999a('0x96'),_0x999a('0x97'));_0x107c2e[_0x999a('0x4a')](_0x999a('0x98'),_0x999a('0x99'));_0x107c2e[_0x999a('0x4a')](_0x999a('0x9a'),_0x999a('0x8c'));_0x107c2e[_0x999a('0x4a')]('i.*');_0x107c2e[_0x999a('0x4a')](_0x999a('0x9b'),_0x999a('0x9c'));_0x107c2e[_0x999a('0x4a')](_0x999a('0x9d'),'Contact.lastName');_0x107c2e[_0x999a('0x4a')]('c.email',_0x999a('0x9e'));_0x107c2e[_0x999a('0x4a')](_0x999a('0x9f'),_0x999a('0xa0'));_0x107c2e[_0x999a('0x4a')](_0x999a('0xa1'),_0x999a('0xa2'));_0x107c2e[_0x999a('0x4a')]('c.fax','Contact.fax');_0x107c2e[_0x999a('0x4a')](_0x999a('0xa3'),_0x999a('0xa4'));_0x107c2e[_0x999a('0x4a')](_0x999a('0xa5'),_0x999a('0xa6'));_0x107c2e[_0x999a('0x4a')](_0x999a('0xa7'),_0x999a('0x2d'));}if(_0x12cf16[_0x999a('0x1d')])_0x107c2e['limit'](_0x12cf16[_0x999a('0x1d')]);if(_0x12cf16['offset'])_0x107c2e[_0x999a('0x1c')](_0x12cf16[_0x999a('0x1c')]);return db[_0x999a('0x94')]['query'](_0x107c2e[_0x999a('0x93')](),_0x13b547);})[_0x999a('0x25')](function(_0x4c65bb){if(_0x4c65bb[_0x999a('0x43')]>0x0)_0x17460e[_0x999a('0x47')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x4c65bb,'id'));return db[_0x999a('0x94')][_0x999a('0x3e')](_0x17460e[_0x999a('0x93')](),_0x13b547)[_0x999a('0x25')](function(_0xa44039){var _0x4d0f66=_[_0x999a('0xa8')](_0xa44039,_0x999a('0xa9'));var _0xefab5b=[];_0x4c65bb[_0x999a('0x68')](function(_0x10afbc){_0xefab5b[_0x999a('0x2f')](updateFaxInteraction(_0x10afbc,_0x54a8bf,_0x4d0f66));});return BPromise[_0x999a('0xaa')](_0xefab5b);});});})['then'](function(_0x52c33f){_0x4ddbe3[_0x999a('0xab')]=_0x52c33f;return _0x4ddbe3;})['then'](respondWithFilteredResult(_0x2bcbb4,_0x12cf16))[_0x999a('0x30')](handleError(_0x2bcbb4,null));};exports[_0x999a('0xac')]=function(_0x36aa12,_0x105750){var _0x206a78={'raw':![],'where':{'id':_0x36aa12['params']['id']}},_0x5c031a={};_0x5c031a['model']=_['keys'](db[_0x999a('0x39')][_0x999a('0x3a')]);_0x5c031a[_0x999a('0x3e')]=_['keys'](_0x36aa12[_0x999a('0x3e')]);_0x5c031a['filters']=_[_0x999a('0x40')](_0x5c031a[_0x999a('0x3d')],_0x5c031a[_0x999a('0x3e')]);_0x206a78['attributes']=_[_0x999a('0x40')](_0x5c031a[_0x999a('0x3d')],qs['fields'](_0x36aa12['query'][_0x999a('0x41')]));_0x206a78[_0x999a('0x42')]=_0x206a78[_0x999a('0x42')][_0x999a('0x43')]?_0x206a78[_0x999a('0x42')]:_0x5c031a[_0x999a('0x3d')];if(_0x36aa12[_0x999a('0x3e')][_0x999a('0xad')]){_0x206a78[_0x999a('0xae')]=[{'all':!![]}];}_0x206a78=_[_0x999a('0x95')]({},_0x206a78,_0x36aa12['options']);return db[_0x999a('0x39')][_0x999a('0x65')](_0x206a78)[_0x999a('0x25')](handleEntityNotFound(_0x105750,null))['then'](respondWithResult(_0x105750,null))[_0x999a('0x30')](handleError(_0x105750,null));};exports[_0x999a('0xaf')]=function(_0x41a783,_0x416068){return db[_0x999a('0x39')][_0x999a('0xaf')](_0x41a783[_0x999a('0x6f')],{})[_0x999a('0x25')](respondWithResult(_0x416068,0xc9))[_0x999a('0x30')](handleError(_0x416068,null));};exports[_0x999a('0x24')]=function(_0x7a78f7,_0x53ceb9){if(_0x7a78f7['body']['id']){delete _0x7a78f7[_0x999a('0x6f')]['id'];}return db[_0x999a('0x39')][_0x999a('0x65')]({'where':{'id':_0x7a78f7[_0x999a('0xb0')]['id']}})[_0x999a('0x25')](handleEntityNotFound(_0x53ceb9,null))[_0x999a('0x25')](saveUpdates(_0x7a78f7[_0x999a('0x6f')],null))[_0x999a('0x25')](respondWithResult(_0x53ceb9,null))[_0x999a('0x30')](handleError(_0x53ceb9,null));};exports[_0x999a('0xb1')]=function(_0xe36103,_0xbc8fa0){return db['FaxInteraction'][_0x999a('0x65')]({'where':{'id':_0xe36103['params']['id']}})['then'](handleEntityNotFound(_0xbc8fa0,null))['then'](removeEntity(_0xbc8fa0,null))[_0x999a('0x30')](handleError(_0xbc8fa0,null));};exports[_0x999a('0xb2')]=function(_0x15aa2e,_0x6876ee){return db[_0x999a('0x39')]['describe']()[_0x999a('0x25')](respondWithResult(_0x6876ee,null))['catch'](handleError(_0x6876ee,null));};exports[_0x999a('0xb3')]=function(_0x3b1d5f,_0x1641a0,_0x49983a){return db[_0x999a('0xb4')]['find']({'where':{'id':_0x3b1d5f[_0x999a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1641a0,null))[_0x999a('0x25')](function(_0x5f0404){if(_0x5f0404){return _0x5f0404[_0x999a('0xb3')](_0x3b1d5f[_0x999a('0x6f')]['ids'],_[_0x999a('0xb5')](_0x3b1d5f[_0x999a('0x6f')],[_0x999a('0xb6'),'id'])||{});}})[_0x999a('0x25')](respondWithResult(_0x1641a0,null))[_0x999a('0x30')](handleError(_0x1641a0,null));};exports[_0x999a('0xb7')]=function(_0x1a9ee7,_0x3a4a78,_0x53502a){var _0x1e05d5={'raw':![],'where':{}};var _0x527b40={};var _0x5c3c78={'count':0x0,'rows':[]};return db[_0x999a('0x39')]['findOne']({'where':{'id':_0x1a9ee7[_0x999a('0xb0')]['id']}})[_0x999a('0x25')](handleEntityNotFound(_0x3a4a78,null))['then'](function(_0xbe153f){if(_0xbe153f){_0x527b40[_0x999a('0x3d')]=_[_0x999a('0xb8')](db[_0x999a('0xb4')][_0x999a('0x3a')]);_0x527b40[_0x999a('0x3e')]=_['keys'](_0x1a9ee7['query']);_0x527b40['filters']=_[_0x999a('0x40')](_0x527b40[_0x999a('0x3d')],_0x527b40['query']);_0x1e05d5['attributes']=_[_0x999a('0x40')](_0x527b40[_0x999a('0x3d')],qs[_0x999a('0x41')](_0x1a9ee7[_0x999a('0x3e')]['fields']));_0x1e05d5[_0x999a('0x42')]=_0x1e05d5[_0x999a('0x42')][_0x999a('0x43')]?_0x1e05d5['attributes']:_0x527b40['model'];if(!_0x1a9ee7[_0x999a('0x3e')]['hasOwnProperty']('nolimit')){_0x1e05d5[_0x999a('0x1d')]=qs[_0x999a('0x1d')](_0x1a9ee7[_0x999a('0x3e')][_0x999a('0x1d')]);_0x1e05d5[_0x999a('0x1c')]=qs[_0x999a('0x1c')](_0x1a9ee7[_0x999a('0x3e')][_0x999a('0x1c')]);}_0x1e05d5[_0x999a('0x45')]=qs['sort'](_0x1a9ee7['query'][_0x999a('0x46')]);_0x1e05d5['where']=qs['filters'](_[_0x999a('0x48')](_0x1a9ee7['query'],_0x527b40['filters']));_0x1e05d5[_0x999a('0x47')][_0x999a('0xa9')]=_0xbe153f['id'];if(_0x1a9ee7[_0x999a('0x3e')][_0x999a('0x82')]){_0x1e05d5['where']=_[_0x999a('0x95')](_0x1e05d5['where'],{'$or':_[_0x999a('0x2b')](_0x1e05d5[_0x999a('0x42')],function(_0x1310b5){var _0x16c238={};_0x16c238[_0x1310b5]={'$like':'%'+_0x1a9ee7['query'][_0x999a('0x82')]+'%'};return _0x16c238;})});}if(_0x1a9ee7[_0x999a('0x3e')][_0x999a('0x79')]){var _0x3d404d=_0x1a9ee7[_0x999a('0x3e')]['$gte'][_0x999a('0x62')](',');var _0x3d499f={};_0x3d499f[_0x3d404d[0x0]]={'$gte':moment(_0x3d404d[0x1])[_0x999a('0xb9')](_0x999a('0xba'))};_0x1e05d5[_0x999a('0x47')]=_[_0x999a('0x95')](_0x1e05d5[_0x999a('0x47')],_0x3d499f);}_0x1e05d5=_['merge']({},_0x1e05d5,_0x1a9ee7[_0x999a('0xbb')]);return db[_0x999a('0xb4')]['count']({'where':_0x1e05d5['where']})[_0x999a('0x25')](function(_0x114094){_0x5c3c78[_0x999a('0x1f')]=_0x114094;if(_0x1a9ee7[_0x999a('0x3e')]['includeAll']){_0x1e05d5[_0x999a('0xae')]=[{'all':!![]}];}return db[_0x999a('0xb4')][_0x999a('0xbc')](_0x1e05d5);})[_0x999a('0x25')](function(_0xb9d4e7){_0x5c3c78[_0x999a('0xab')]=_0xb9d4e7;return _0x5c3c78;});}})[_0x999a('0x25')](respondWithFilteredResult(_0x3a4a78,_0x1e05d5))[_0x999a('0x30')](handleError(_0x3a4a78,null));};exports['addTags']=function(_0x183aac,_0x35ad02,_0x58c143){return db[_0x999a('0x39')][_0x999a('0x65')]({'where':{'id':_0x183aac[_0x999a('0xb0')]['id']}})[_0x999a('0x25')](handleEntityNotFound(_0x35ad02,null))['then'](function(_0xebb050){if(_0xebb050){return _0xebb050[_0x999a('0xbd')](_0x183aac[_0x999a('0x6f')]['ids'],_['omit'](_0x183aac[_0x999a('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x999a('0xbe')]['findAll']({'attributes':['id',_0x999a('0x29'),_0x999a('0xbf')],'where':{'id':_0x183aac[_0x999a('0x6f')][_0x999a('0xb6')]}});})['then'](function(_0x18e696){socket[_0x999a('0xc0')](_0x999a('0xc1'),{'id':Number(_0x183aac['params']['id']),'tags':_0x18e696||[]});return{'id':Number(_0x183aac[_0x999a('0xb0')]['id']),'tags':_0x18e696||[]};});}})[_0x999a('0x25')](respondWithResult(_0x35ad02,null))['catch'](handleError(_0x35ad02,null));};exports[_0x999a('0xc2')]=function(_0x1c10e2,_0x1985b8,_0x335940){return db[_0x999a('0x39')][_0x999a('0x65')]({'where':{'id':_0x1c10e2[_0x999a('0xb0')]['id']}})[_0x999a('0x25')](handleEntityNotFound(_0x1985b8,null))[_0x999a('0x25')](function(_0x250305){if(_0x250305){return _0x250305['removeTags'](_0x1c10e2['query'][_0x999a('0xb6')]);}})[_0x999a('0x25')](respondWithStatusCode(_0x1985b8,null))[_0x999a('0x30')](handleError(_0x1985b8,null));};exports[_0x999a('0xc3')]=function(_0x14f9dd,_0x533650){var _0x1b2575=moment()[_0x999a('0xc4')]()['toString']();var _0x3496ee=path[_0x999a('0xc5')](config[_0x999a('0xc6')],'server','files',_0x999a('0xc7'));var _0x74feec=path[_0x999a('0xc5')](config[_0x999a('0xc6')],_0x999a('0xc8'),'files',_0x999a('0xc9'));var _0x4f36bf=path[_0x999a('0xc5')](_0x3496ee,_0x1b2575);var _0x4e4bd5=util[_0x999a('0xb9')](_0x999a('0xca'),_0x14f9dd[_0x999a('0xb0')]['id'],_0x1b2575);var _0x42a1a5=path[_0x999a('0xc5')](_0x3496ee,_0x4e4bd5);var _0x3ec75f=[];_0x3ec75f[_0x999a('0x2f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x38be12=[{'model':db[_0x999a('0xb4')],'as':_0x999a('0xcb'),'attributes':['id',_0x999a('0x6f'),'createdAt'],'include':_0x3ec75f}];return db[_0x999a('0x39')][_0x999a('0x65')]({'where':{'id':_0x14f9dd[_0x999a('0xb0')]['id']},'include':_0x38be12})[_0x999a('0x25')](handleEntityNotFound(_0x533650,null))['then'](function(_0x3ea65b){if(_0x3ea65b&&_0x3ea65b[_0x999a('0xcb')]){var _0x404b5a=_0x3ea65b['get']({'plain':!![]});fs[_0x999a('0xcc')](_0x4f36bf);for(var _0x4f0c95=0x0;_0x4f0c95<_0x404b5a[_0x999a('0xcb')][_0x999a('0x43')];_0x4f0c95++){var _0x4a58fa=_0x404b5a[_0x999a('0xcb')][_0x4f0c95]['Attachment'];if(_0x4a58fa){var _0x4384ee=path[_0x999a('0xc5')](_0x74feec,_0x4a58fa['basename']);if(fs[_0x999a('0xcd')](_0x4384ee)){fs['createReadStream'](_0x4384ee)['pipe'](fs['createWriteStream'](path[_0x999a('0xc5')](_0x4f36bf,_0x4a58fa[_0x999a('0xce')])));}}}return BPromise[_0x999a('0xcf')]()[_0x999a('0x25')](function(){return new BPromise(function(_0x5d173f,_0x354c2f){zipdir(_0x4f36bf,{'saveTo':_0x42a1a5},function(_0x14cf16,_0x35350f){if(_0x14cf16)return _0x354c2f(_0x14cf16);return _0x5d173f(_0x35350f);});})[_0x999a('0x25')](function(){return new BPromise(function(_0x14be67,_0x50da66){rimraf(_0x4f36bf,function(_0x104d61){if(_0x104d61)_0x50da66(_0x104d61);return _0x14be67();});});})['then'](function(){return _0x533650[_0x999a('0xc3')](_0x42a1a5,_0x4e4bd5,function(_0x53ec31){if(_0x53ec31){console['log'](_0x999a('0xd0'),_0x53ec31);}else{fs['unlinkSync'](_0x42a1a5);}});});});}else{return _0x533650[_0x999a('0x26')](0xc8);}})[_0x999a('0x30')](handleError(_0x533650,null));}; \ No newline at end of file +var _0x6fca=['fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','start','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','all','rows','show','params','create','update','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','spread','Tag','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','fullname','Tags','TagIds','split','forEach','push','catch','waiting','answered','closed','UserId','talking','unmanaged','total','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id'];(function(_0x1d654f,_0x9cf763){var _0x5416d5=function(_0x3d6085){while(--_0x3d6085){_0x1d654f['push'](_0x1d654f['shift']());}};_0x5416d5(++_0x9cf763);}(_0x6fca,0x14f));var _0xa6fc=function(_0xf4555e,_0xff6417){_0xf4555e=_0xf4555e-0x0;var _0x207720=_0x6fca[_0xf4555e];return _0x207720;};'use strict';var emlformat=require(_0xa6fc('0x0'));var rimraf=require(_0xa6fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6fc('0x2'));var rp=require(_0xa6fc('0x3'));var moment=require(_0xa6fc('0x4'));var BPromise=require(_0xa6fc('0x5'));var Mustache=require(_0xa6fc('0x6'));var util=require(_0xa6fc('0x7'));var path=require(_0xa6fc('0x8'));var sox=require('sox');var csv=require(_0xa6fc('0x9'));var ejs=require(_0xa6fc('0xa'));var fs=require('fs');var fs_extra=require(_0xa6fc('0xb'));var _=require('lodash');var squel=require(_0xa6fc('0xc'));var crypto=require(_0xa6fc('0xd'));var jsforce=require(_0xa6fc('0xe'));var deskjs=require(_0xa6fc('0xf'));var toCsv=require(_0xa6fc('0x9'));var querystring=require(_0xa6fc('0x10'));var Papa=require(_0xa6fc('0x11'));var Redis=require(_0xa6fc('0x12'));var authService=require(_0xa6fc('0x13'));var qs=require(_0xa6fc('0x14'));var as=require(_0xa6fc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6fc('0x16'))(_0xa6fc('0x17'));var utils=require(_0xa6fc('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa6fc('0x19'))['db'];config[_0xa6fc('0x1a')]=_[_0xa6fc('0x1b')](config[_0xa6fc('0x1a')],{'host':_0xa6fc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6fc('0x1a')]));require(_0xa6fc('0x1d'))[_0xa6fc('0x1e')](socket);function respondWithStatusCode(_0x12c61f,_0x930255){_0x930255=_0x930255||0xcc;return function(_0x312d42){if(_0x312d42){return _0x12c61f[_0xa6fc('0x1f')](_0x930255);}return _0x12c61f[_0xa6fc('0x20')](_0x930255)[_0xa6fc('0x21')]();};}function respondWithResult(_0xe1e782,_0x247aaa){_0x247aaa=_0x247aaa||0xc8;return function(_0x340db0){if(_0x340db0){return _0xe1e782[_0xa6fc('0x20')](_0x247aaa)[_0xa6fc('0x22')](_0x340db0);}};}function respondWithFilteredResult(_0x29944d,_0x25fffc){return function(_0x5dcce7){if(_0x5dcce7){var _0x44fa40=typeof _0x25fffc[_0xa6fc('0x23')]===_0xa6fc('0x24')&&typeof _0x25fffc[_0xa6fc('0x25')]===_0xa6fc('0x24');var _0x5b12d6=_0x5dcce7[_0xa6fc('0x26')];var _0x4444f1=_0x44fa40?0x0:_0x25fffc['offset'];var _0x46dc64=_0x44fa40?_0x5dcce7[_0xa6fc('0x26')]:_0x25fffc['offset']+_0x25fffc[_0xa6fc('0x25')];var _0x4d5c7a;if(_0x46dc64>=_0x5b12d6){_0x46dc64=_0x5b12d6;_0x4d5c7a=0xc8;}else{_0x4d5c7a=0xce;}_0x29944d['status'](_0x4d5c7a);return _0x29944d[_0xa6fc('0x27')](_0xa6fc('0x28'),_0x4444f1+'-'+_0x46dc64+'/'+_0x5b12d6)[_0xa6fc('0x22')](_0x5dcce7);}return null;};}function patchUpdates(_0x504811){return function(_0x3e399f){try{jsonpatch[_0xa6fc('0x29')](_0x3e399f,_0x504811,!![]);}catch(_0x48cc35){return BPromise[_0xa6fc('0x2a')](_0x48cc35);}return _0x3e399f[_0xa6fc('0x2b')]();};}function saveUpdates(_0x19cd9d,_0x1374d2){return function(_0x556bde){if(_0x556bde){return _0x556bde['update'](_0x19cd9d)[_0xa6fc('0x2c')](function(_0x1a582d){return _0x1a582d;});}return null;};}function removeEntity(_0x2470b0,_0x29e04e){return function(_0x5a25ce){if(_0x5a25ce){return _0x5a25ce[_0xa6fc('0x2d')]()['then'](function(){_0x2470b0[_0xa6fc('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342d1c,_0x3f197d){return function(_0x109238){if(!_0x109238){_0x342d1c[_0xa6fc('0x1f')](0x194);}return _0x109238;};}function handleError(_0x3191eb,_0x556fc8){_0x556fc8=_0x556fc8||0x1f4;return function(_0x1d51ab){logger[_0xa6fc('0x2e')](_0x1d51ab['stack']);if(_0x1d51ab[_0xa6fc('0x2f')]){delete _0x1d51ab[_0xa6fc('0x2f')];}_0x3191eb[_0xa6fc('0x20')](_0x556fc8)[_0xa6fc('0x30')](_0x1d51ab);};}function getInteractionUsers(_0x10067e,_0x656472){return new BPromise(function(_0x102339,_0xbab203){try{if(_0x656472[_0x10067e['id']]){_0x10067e['Users']=_['map'](_0x656472[_0x10067e['id']],function(_0x2c4287){return{'id':_0x2c4287['id'],'fullname':_0x2c4287[_0xa6fc('0x31')]};});}}catch(_0x2a43cf){_0xbab203(_0x2a43cf);}_0x102339(_0x10067e);});}function getInteractionTags(_0x2b8fb3,_0xded7f1){return new BPromise(function(_0x373699,_0x106f71){try{if(_0x2b8fb3['TagIds']){_0x2b8fb3[_0xa6fc('0x32')]=[];_0x2b8fb3[_0xa6fc('0x33')][_0xa6fc('0x34')](',')[_0xa6fc('0x35')](function(_0x5250ca){_0x2b8fb3[_0xa6fc('0x32')][_0xa6fc('0x36')](_0xded7f1[_0x5250ca]);});}delete _0x2b8fb3[_0xa6fc('0x33')];}catch(_0x47a1c9){_0x106f71(_0x47a1c9);}_0x373699(_0x2b8fb3);});}function updateFaxInteraction(_0x40cd5c,_0x5bf407,_0x291163){return new BPromise(function(_0x4e60e0,_0x2ae770){return getInteractionUsers(_0x40cd5c,_0x291163)[_0xa6fc('0x2c')](function(_0x320871){return getInteractionTags(_0x320871,_0x5bf407);})['then'](function(_0xaaae08){return getStateInteraction(_0xaaae08);})['then'](function(_0x2a8fe2){_0x4e60e0(_0x2a8fe2);})[_0xa6fc('0x37')](function(_0x4164dd){_0x2ae770(_0x4164dd);});});}function getStateInteraction(_0x2234d7){return new BPromise(function(_0x473e9b){_0x2234d7[_0xa6fc('0x38')]=0x0;_0x2234d7['talking']=0x0;_0x2234d7[_0xa6fc('0x39')]=0x0;_0x2234d7['unmanaged']=0x0;_0x2234d7['total']=0x0;if(!_0x2234d7[_0xa6fc('0x3a')]&&!_0x2234d7[_0xa6fc('0x3b')]){_0x2234d7[_0xa6fc('0x38')]+=0x1;}if(!_0x2234d7[_0xa6fc('0x3a')]&&_0x2234d7[_0xa6fc('0x3b')]){_0x2234d7['talking']+=0x1;if(_0x2234d7[_0xa6fc('0x38')]){_0x2234d7[_0xa6fc('0x38')]-=0x1;}}if(_0x2234d7['closed']&&_0x2234d7[_0xa6fc('0x3b')]){_0x2234d7[_0xa6fc('0x39')]+=0x1;if(_0x2234d7[_0xa6fc('0x3c')]){_0x2234d7[_0xa6fc('0x3c')]-=0x1;}}if(_0x2234d7[_0xa6fc('0x3a')]&&!_0x2234d7['UserId']){_0x2234d7[_0xa6fc('0x3d')]+=0x1;if(_0x2234d7['waiting']){_0x2234d7[_0xa6fc('0x38')]-=0x1;}}_0x2234d7[_0xa6fc('0x3e')]+=0x1;_0x473e9b(_0x2234d7);});}exports['index']=function(_0x47f9c0,_0x42e5ca){var _0x20ae8c={},_0x30175b={},_0x21019f={'count':0x0,'rows':[]};var _0x1ab26b=_[_0xa6fc('0x3f')](db[_0xa6fc('0x40')][_0xa6fc('0x41')],function(_0xc1d1c7){return{'name':_0xc1d1c7[_0xa6fc('0x42')],'type':_0xc1d1c7[_0xa6fc('0x43')][_0xa6fc('0x44')]};});_0x30175b[_0xa6fc('0x45')]=_[_0xa6fc('0x3f')](_0x1ab26b,'name');_0x30175b[_0xa6fc('0x46')]=_[_0xa6fc('0x47')](_0x47f9c0['query']);_0x30175b[_0xa6fc('0x48')]=_[_0xa6fc('0x49')](_0x30175b[_0xa6fc('0x45')],_0x30175b['query']);_0x20ae8c['attributes']=_[_0xa6fc('0x49')](_0x30175b[_0xa6fc('0x45')],qs[_0xa6fc('0x4a')](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x4a')]));_0x20ae8c[_0xa6fc('0x4b')]=_0x20ae8c['attributes'][_0xa6fc('0x4c')]?_0x20ae8c[_0xa6fc('0x4b')]:_0x30175b[_0xa6fc('0x45')];if(!_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x4d')]('nolimit')){_0x20ae8c['limit']=qs[_0xa6fc('0x25')](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x25')]);_0x20ae8c['offset']=qs['offset'](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x23')]);}_0x20ae8c[_0xa6fc('0x4e')]=qs[_0xa6fc('0x4f')](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x4f')]);_0x20ae8c[_0xa6fc('0x50')]=qs[_0xa6fc('0x48')](_[_0xa6fc('0x51')](_0x47f9c0[_0xa6fc('0x46')],_0x30175b[_0xa6fc('0x48')]),_0x1ab26b);var _0x3026b8=[];var _0x4e11e1=squel['select']()[_0xa6fc('0x52')]('id')['field']('name')[_0xa6fc('0x52')](_0xa6fc('0x53'))[_0xa6fc('0x54')](_0xa6fc('0x55'));var _0x1bc26c=squel[_0xa6fc('0x56')]()['field']('u.id')['field'](_0xa6fc('0x57'))['field'](_0xa6fc('0x58'))[_0xa6fc('0x54')](_0xa6fc('0x59'),'ui')['left_join'](_0xa6fc('0x5a'),'u','u.id\x20=\x20ui.UserId');var _0x1c3d6a=squel[_0xa6fc('0x56')]()[_0xa6fc('0x54')](_0xa6fc('0x5b'),'i')[_0xa6fc('0x5c')]('cm_contacts','c',_0xa6fc('0x5d'))[_0xa6fc('0x5c')](_0xa6fc('0x5a'),'o',_0xa6fc('0x5e'))['left_join'](_0xa6fc('0x5f'),'a',_0xa6fc('0x60'))[_0xa6fc('0x5c')](_0xa6fc('0x61'),'me',_0xa6fc('0x62'))['left_join'](_0xa6fc('0x63'),'it',_0xa6fc('0x64'))[_0xa6fc('0x5c')](_0xa6fc('0x55'),'t','t.id\x20=\x20it.TagId');var _0x169b3b=squel[_0xa6fc('0x65')]();var _0x3075c8=[];var _0x362c20=squel[_0xa6fc('0x65')]();var _0xa17466;if(_0x47f9c0[_0xa6fc('0x46')]['search']){_0xa17466=as[_0xa6fc('0x66')](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x67')]);var _0x41eddf=_0xa17466[_0xa6fc('0x68')];for(var _0x22a80=0x0;_0x22a80<_0xa17466['conditions']['length'];_0x22a80++){var _0x2b4322=_0xa17466[_0xa6fc('0x69')][_0x22a80];var _0x4a1d7c='i';var _0x51a9d5=_[_0xa6fc('0x6a')](_0x1ab26b,[_0xa6fc('0x2f'),_0x2b4322[_0xa6fc('0x52')]]);if(!_0x51a9d5){switch(_0x2b4322[_0xa6fc('0x52')]){case _0xa6fc('0x6b'):if(_0x2b4322[_0xa6fc('0x6c')]==0x1){_0x1c3d6a[_0xa6fc('0x6d')]('`'+_0x2b4322[_0xa6fc('0x52')]+_0xa6fc('0x6e'));}else{_0x1c3d6a[_0xa6fc('0x6d')]('`'+_0x2b4322['field']+'`\x20>\x200');}break;case _0xa6fc('0x6f'):if(_0x2b4322[_0xa6fc('0x70')]===_0xa6fc('0x71')){if(_0x2b4322[_0xa6fc('0x6c')][_0xa6fc('0x34')]('\x20')['length']>0x1){_0x169b3b[_0x41eddf](_0xa6fc('0x72'),qs['getFullTextValue'](_0x2b4322[_0xa6fc('0x6c')]),null);}else{var _0x297292='%'+_0x2b4322[_0xa6fc('0x6c')]+'%';_0x169b3b[_0x41eddf]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x297292,_0x297292,_0x297292);}}else{_0x51a9d5=_[_0xa6fc('0x6a')](_0x1ab26b,[_0xa6fc('0x2f'),_0xa6fc('0x73')]);_0x2b4322['field']=_0xa6fc('0x73');_0x3a6f6b=as[_0xa6fc('0x74')](_0x4a1d7c,_0x51a9d5[_0xa6fc('0x43')],_0x2b4322);_0x169b3b[_0x41eddf](_0x3a6f6b['text'],_0x3a6f6b[_0xa6fc('0x6c')]['start'],_0x3a6f6b[_0xa6fc('0x6c')][_0xa6fc('0x21')]);}break;case'Tag':var _0x310a40=_0x2b4322[_0xa6fc('0x6c')]['split'](',')['map'](function(_0x34c3be){return Number(_0x34c3be);});_0x310a40[_0xa6fc('0x35')](function(_0x3a89f7){_0x362c20['or'](_0xa6fc('0x75'),'%,'+_0x3a89f7+',%');});_0x3075c8=_[_0xa6fc('0x76')](_0x3075c8,_0x310a40);break;case'User':if(_0x2b4322['operator']===_0xa6fc('0x71')){_0x169b3b[_0x41eddf](_0xa6fc('0x77'),'%'+_0x2b4322[_0xa6fc('0x6c')]+'%',null);}else{_0x51a9d5=_[_0xa6fc('0x6a')](_0x1ab26b,[_0xa6fc('0x2f'),_0xa6fc('0x3b')]);_0x2b4322['field']='UserId';_0x3a6f6b=as[_0xa6fc('0x74')](_0x4a1d7c,_0x51a9d5[_0xa6fc('0x43')],_0x2b4322);_0x169b3b[_0x41eddf](_0x3a6f6b[_0xa6fc('0x78')],_0x3a6f6b[_0xa6fc('0x6c')]['start'],_0x3a6f6b[_0xa6fc('0x6c')][_0xa6fc('0x21')]);}break;case _0xa6fc('0x79'):_0x3a6f6b=as[_0xa6fc('0x74')]('me',null,_0x2b4322);_0x169b3b[_0x41eddf](_0x3a6f6b['text'],_0x3a6f6b['value'][_0xa6fc('0x7a')],_0x3a6f6b[_0xa6fc('0x6c')][_0xa6fc('0x21')]);break;}}else{var _0x3a6f6b=as[_0xa6fc('0x74')](_0x4a1d7c,_0x51a9d5['type'],_0x2b4322);_0x169b3b[_0x41eddf](_0x3a6f6b[_0xa6fc('0x78')],_0x3a6f6b['value'][_0xa6fc('0x7a')],_0x3a6f6b[_0xa6fc('0x6c')][_0xa6fc('0x21')]);}}}else{var _0x2eb7a9=_(_0x47f9c0['query'])['keys']()[_0xa6fc('0x3f')](function(_0x1a6c0d){return _[_0xa6fc('0x7b')](_0x1ab26b,['name',_0x1a6c0d])?_0x1a6c0d:undefined;})[_0xa6fc('0x7c')]()[_0xa6fc('0x6c')]();if(!_[_0xa6fc('0x7d')](_0x2eb7a9)){_0x2eb7a9[_0xa6fc('0x35')](function(_0x2d9a09){if(_0x2d9a09===_0xa6fc('0x7e')){_0x1c3d6a[_0xa6fc('0x50')](_0xa6fc('0x7f'),[][_0xa6fc('0x80')](_0x47f9c0['query'][_0x2d9a09]));}else if(_0x2d9a09===_0xa6fc('0x81')){var _0xff3846=JSON[_0xa6fc('0x82')](_0x47f9c0[_0xa6fc('0x46')][_0x2d9a09])[_0xa6fc('0x83')];var _0x52ad84=JSON[_0xa6fc('0x82')](_0x47f9c0[_0xa6fc('0x46')][_0x2d9a09])['$lte'];_0x1c3d6a[_0xa6fc('0x50')](_0xa6fc('0x84'),_0xff3846,_0x52ad84);}else{if(_0x47f9c0[_0xa6fc('0x46')][_0x2d9a09]==='null'){_0x1c3d6a['where']('i.'+_0x2d9a09+_0xa6fc('0x85'));}else{_0x1c3d6a['where']('i.'+_0x2d9a09+_0xa6fc('0x86'),_0x47f9c0[_0xa6fc('0x46')][_0x2d9a09]);}}});}if(_0x47f9c0['query'][_0xa6fc('0x87')]){if(_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x87')]==0x1){_0x1c3d6a['having'](_0xa6fc('0x88'));}else{_0x1c3d6a[_0xa6fc('0x6d')](_0xa6fc('0x89'));}}if(_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x8a')]){_0x3075c8=_['isArray'](_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x8a')])?_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x8a')]:new Array(_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x8a')]);_0x3075c8[_0xa6fc('0x35')](function(_0x13034e){_0x362c20['or'](_0xa6fc('0x75'),'%,'+_0x13034e+',%');});}if(_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x8b')]){var _0x23a10a=_0x47f9c0[_0xa6fc('0x46')]['filter'][_0xa6fc('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x23a10a)){_0x169b3b['or']('i.id\x20LIKE\x20?',_0x23a10a+'%')['or']('i.fax\x20LIKE\x20?',_0x23a10a+'%');}_0x169b3b['or'](_0xa6fc('0x8d'),_0x23a10a+'%');}}_0x1c3d6a[_0xa6fc('0x50')](_0x169b3b);_0x1c3d6a[_0xa6fc('0x8e')]('i.id');var _0xce6936={'type':db['Sequelize'][_0xa6fc('0x8f')]['SELECT'],'raw':!![]};var _0x5f2702=_0x1c3d6a[_0xa6fc('0x90')]();_0x5f2702[_0xa6fc('0x52')]('i.id');_0x5f2702['field'](_0xa6fc('0x91'),'unreadMessages');if(_0x20ae8c[_0xa6fc('0x4e')]){_0x20ae8c[_0xa6fc('0x4e')][_0xa6fc('0x35')](function(_0x2c732a){var _0x17bba2=_0x2c732a[0x0]===_0xa6fc('0x92')?_0x2c732a[0x0]:'i.'+_0x2c732a[0x0];_0x1c3d6a[_0xa6fc('0x4e')](_0x17bba2,_0x2c732a[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x3075c8)){_0x1c3d6a[_0xa6fc('0x6d')](_0x362c20);_0x5f2702[_0xa6fc('0x50')](_0xa6fc('0x93'),_0x3075c8);}BPromise[_0xa6fc('0x94')]()[_0xa6fc('0x2c')](function(){if(!_0xa17466){if(_0x47f9c0['query'][_0xa6fc('0x7e')])return;_0x5f2702[_0xa6fc('0x50')](_0xa6fc('0x95'));_0x1c3d6a[_0xa6fc('0x50')](_0xa6fc('0x95'));return;}if(_0x47f9c0['user'][_0xa6fc('0x96')]!==_0xa6fc('0x97'))return;return _0x47f9c0[_0xa6fc('0x98')][_0xa6fc('0x99')]({'attributes':['id'],'raw':!![]})[_0xa6fc('0x2c')](function(_0x34dae1){if(_[_0xa6fc('0x7d')](_0x34dae1)){_0x5f2702[_0xa6fc('0x50')](_0xa6fc('0x9a'));_0x1c3d6a['where'](_0xa6fc('0x9a'));}else{_0x5f2702[_0xa6fc('0x50')](_0xa6fc('0x7f'),_[_0xa6fc('0x3f')](_0x34dae1,'id'));_0x1c3d6a['where'](_0xa6fc('0x7f'),_[_0xa6fc('0x3f')](_0x34dae1,'id'));}});})[_0xa6fc('0x2c')](function(){if(_0x47f9c0['user'][_0xa6fc('0x96')]===_0xa6fc('0x97')&&!_0xa17466&&!_0x47f9c0[_0xa6fc('0x46')][_0xa6fc('0x7e')])return[];return db['sequelize'][_0xa6fc('0x46')](_0x5f2702[_0xa6fc('0x9b')](),_0xce6936);})[_0xa6fc('0x2c')](function(_0x495305){_0x21019f['count']=_0x495305[_0xa6fc('0x4c')];if(_0x21019f['count']===0x0)return[];return db['sequelize'][_0xa6fc('0x46')](_0x4e11e1[_0xa6fc('0x9b')](),_0xce6936)[_0xa6fc('0x2c')](function(_0x1a1a9f){_0x3026b8=_[_0xa6fc('0x9c')](_0x1a1a9f,'id');_0xce6936=_[_0xa6fc('0x9d')](_0xce6936,{'model':db[_0xa6fc('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47f9c0['query'][_0xa6fc('0x4a')]){_0x20ae8c[_0xa6fc('0x4b')]['forEach'](function(_0xb28866){_0x1c3d6a[_0xa6fc('0x52')]('i.'+_0xb28866);});}else{_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0x91'),_0xa6fc('0x6b'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0x9e'),_0xa6fc('0x9f'));_0x1c3d6a['field']('a.mandatoryDisposition',_0xa6fc('0xa0'));_0x1c3d6a['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xa6fc('0x92'));_0x1c3d6a[_0xa6fc('0x52')]('i.*');_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xa1'),_0xa6fc('0xa2'));_0x1c3d6a[_0xa6fc('0x52')]('c.lastName',_0xa6fc('0xa3'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xa4'),'Contact.email');_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xa5'),_0xa6fc('0xa6'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xa7'),'Contact.mobile');_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xa8'),_0xa6fc('0xa9'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xaa'),_0xa6fc('0xab'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xac'),_0xa6fc('0xad'));_0x1c3d6a[_0xa6fc('0x52')](_0xa6fc('0xae'),'TagIds');}if(_0x20ae8c['limit'])_0x1c3d6a[_0xa6fc('0x25')](_0x20ae8c[_0xa6fc('0x25')]);if(_0x20ae8c[_0xa6fc('0x23')])_0x1c3d6a[_0xa6fc('0x23')](_0x20ae8c[_0xa6fc('0x23')]);return db[_0xa6fc('0xaf')][_0xa6fc('0x46')](_0x1c3d6a[_0xa6fc('0x9b')](),_0xce6936);})[_0xa6fc('0x2c')](function(_0xa23a07){if(_0xa23a07[_0xa6fc('0x4c')]>0x0)_0x1bc26c[_0xa6fc('0x50')](_0xa6fc('0xb0'),_['map'](_0xa23a07,'id'));return db[_0xa6fc('0xaf')]['query'](_0x1bc26c['toString'](),_0xce6936)[_0xa6fc('0x2c')](function(_0x3845c1){var _0x139938=_['groupBy'](_0x3845c1,'FaxInteractionId');var _0x32345c=[];_0xa23a07['forEach'](function(_0x28e4c0){_0x32345c[_0xa6fc('0x36')](updateFaxInteraction(_0x28e4c0,_0x3026b8,_0x139938));});return BPromise[_0xa6fc('0xb1')](_0x32345c);});});})[_0xa6fc('0x2c')](function(_0x555d00){_0x21019f[_0xa6fc('0xb2')]=_0x555d00;return _0x21019f;})[_0xa6fc('0x2c')](respondWithFilteredResult(_0x42e5ca,_0x20ae8c))[_0xa6fc('0x37')](handleError(_0x42e5ca,null));};exports[_0xa6fc('0xb3')]=function(_0x36cabb,_0x41c816){var _0x1a7ec6={'raw':![],'where':{'id':_0x36cabb[_0xa6fc('0xb4')]['id']}},_0x1ed76a={};_0x1ed76a['model']=_[_0xa6fc('0x47')](db[_0xa6fc('0x40')][_0xa6fc('0x41')]);_0x1ed76a[_0xa6fc('0x46')]=_['keys'](_0x36cabb[_0xa6fc('0x46')]);_0x1ed76a[_0xa6fc('0x48')]=_[_0xa6fc('0x49')](_0x1ed76a[_0xa6fc('0x45')],_0x1ed76a[_0xa6fc('0x46')]);_0x1a7ec6[_0xa6fc('0x4b')]=_[_0xa6fc('0x49')](_0x1ed76a['model'],qs[_0xa6fc('0x4a')](_0x36cabb[_0xa6fc('0x46')]['fields']));_0x1a7ec6[_0xa6fc('0x4b')]=_0x1a7ec6[_0xa6fc('0x4b')][_0xa6fc('0x4c')]?_0x1a7ec6[_0xa6fc('0x4b')]:_0x1ed76a[_0xa6fc('0x45')];if(_0x36cabb[_0xa6fc('0x46')]['includeAll']){_0x1a7ec6['include']=[{'all':!![]}];}_0x1a7ec6=_[_0xa6fc('0x9d')]({},_0x1a7ec6,_0x36cabb['options']);return db[_0xa6fc('0x40')][_0xa6fc('0x6a')](_0x1a7ec6)[_0xa6fc('0x2c')](handleEntityNotFound(_0x41c816,null))['then'](respondWithResult(_0x41c816,null))['catch'](handleError(_0x41c816,null));};exports[_0xa6fc('0xb5')]=function(_0x1340e1,_0x2aa364){return db[_0xa6fc('0x40')]['create'](_0x1340e1['body'],{})[_0xa6fc('0x2c')](respondWithResult(_0x2aa364,0xc9))[_0xa6fc('0x37')](handleError(_0x2aa364,null));};exports[_0xa6fc('0xb6')]=function(_0x5d0edb,_0x41503c){if(_0x5d0edb[_0xa6fc('0x79')]['id']){delete _0x5d0edb['body']['id'];}return db[_0xa6fc('0x40')][_0xa6fc('0x6a')]({'where':{'id':_0x5d0edb[_0xa6fc('0xb4')]['id']}})[_0xa6fc('0x2c')](handleEntityNotFound(_0x41503c,null))[_0xa6fc('0x2c')](saveUpdates(_0x5d0edb['body'],null))['then'](respondWithResult(_0x41503c,null))[_0xa6fc('0x37')](handleError(_0x41503c,null));};exports[_0xa6fc('0x2d')]=function(_0x49d724,_0x53836c){return db[_0xa6fc('0x40')]['find']({'where':{'id':_0x49d724[_0xa6fc('0xb4')]['id']}})['then'](handleEntityNotFound(_0x53836c,null))[_0xa6fc('0x2c')](removeEntity(_0x53836c,null))[_0xa6fc('0x37')](handleError(_0x53836c,null));};exports[_0xa6fc('0xb7')]=function(_0x593f3c,_0x23a29f){return db['FaxInteraction'][_0xa6fc('0xb7')]()['then'](respondWithResult(_0x23a29f,null))[_0xa6fc('0x37')](handleError(_0x23a29f,null));};exports[_0xa6fc('0xb8')]=function(_0x316893,_0x5308a6,_0x573f65){return db[_0xa6fc('0xb9')][_0xa6fc('0x6a')]({'where':{'id':_0x316893[_0xa6fc('0xb4')]['id']}})[_0xa6fc('0x2c')](handleEntityNotFound(_0x5308a6,null))[_0xa6fc('0x2c')](function(_0x39faed){if(_0x39faed){return _0x39faed['addMessage'](_0x316893[_0xa6fc('0x79')][_0xa6fc('0xba')],_[_0xa6fc('0xbb')](_0x316893[_0xa6fc('0x79')],[_0xa6fc('0xba'),'id'])||{});}})[_0xa6fc('0x2c')](respondWithResult(_0x5308a6,null))['catch'](handleError(_0x5308a6,null));};exports[_0xa6fc('0xbc')]=function(_0x39afd3,_0x1b2017,_0x2f063f){var _0x59197b={'raw':![],'where':{}};var _0x2ca34f={};var _0x434dab={'count':0x0,'rows':[]};return db[_0xa6fc('0x40')][_0xa6fc('0xbd')]({'where':{'id':_0x39afd3['params']['id']}})[_0xa6fc('0x2c')](handleEntityNotFound(_0x1b2017,null))['then'](function(_0x24f5d8){if(_0x24f5d8){_0x2ca34f[_0xa6fc('0x45')]=_[_0xa6fc('0x47')](db[_0xa6fc('0xb9')][_0xa6fc('0x41')]);_0x2ca34f['query']=_['keys'](_0x39afd3[_0xa6fc('0x46')]);_0x2ca34f[_0xa6fc('0x48')]=_[_0xa6fc('0x49')](_0x2ca34f['model'],_0x2ca34f[_0xa6fc('0x46')]);_0x59197b[_0xa6fc('0x4b')]=_[_0xa6fc('0x49')](_0x2ca34f[_0xa6fc('0x45')],qs[_0xa6fc('0x4a')](_0x39afd3[_0xa6fc('0x46')][_0xa6fc('0x4a')]));_0x59197b[_0xa6fc('0x4b')]=_0x59197b[_0xa6fc('0x4b')][_0xa6fc('0x4c')]?_0x59197b['attributes']:_0x2ca34f[_0xa6fc('0x45')];if(!_0x39afd3[_0xa6fc('0x46')][_0xa6fc('0x4d')]('nolimit')){_0x59197b[_0xa6fc('0x25')]=qs[_0xa6fc('0x25')](_0x39afd3[_0xa6fc('0x46')][_0xa6fc('0x25')]);_0x59197b[_0xa6fc('0x23')]=qs[_0xa6fc('0x23')](_0x39afd3[_0xa6fc('0x46')][_0xa6fc('0x23')]);}_0x59197b[_0xa6fc('0x4e')]=qs['sort'](_0x39afd3['query'][_0xa6fc('0x4f')]);_0x59197b[_0xa6fc('0x50')]=qs[_0xa6fc('0x48')](_['pick'](_0x39afd3[_0xa6fc('0x46')],_0x2ca34f['filters']));_0x59197b[_0xa6fc('0x50')][_0xa6fc('0xbe')]=_0x24f5d8['id'];if(_0x39afd3['query'][_0xa6fc('0x8b')]){_0x59197b['where']=_[_0xa6fc('0x9d')](_0x59197b[_0xa6fc('0x50')],{'$or':_['map'](_0x59197b[_0xa6fc('0x4b')],function(_0x5cd589){var _0x2846af={};_0x2846af[_0x5cd589]={'$like':'%'+_0x39afd3['query'][_0xa6fc('0x8b')]+'%'};return _0x2846af;})});}if(_0x39afd3['query'][_0xa6fc('0x83')]){var _0x1c4cba=_0x39afd3[_0xa6fc('0x46')][_0xa6fc('0x83')][_0xa6fc('0x34')](',');var _0x5732d4={};_0x5732d4[_0x1c4cba[0x0]]={'$gte':moment(_0x1c4cba[0x1])[_0xa6fc('0xbf')](_0xa6fc('0xc0'))};_0x59197b[_0xa6fc('0x50')]=_['merge'](_0x59197b[_0xa6fc('0x50')],_0x5732d4);}_0x59197b=_['merge']({},_0x59197b,_0x39afd3[_0xa6fc('0xc1')]);return db['FaxMessage'][_0xa6fc('0x26')]({'where':_0x59197b['where']})[_0xa6fc('0x2c')](function(_0x20c9d2){_0x434dab[_0xa6fc('0x26')]=_0x20c9d2;if(_0x39afd3['query']['includeAll']){_0x59197b[_0xa6fc('0xc2')]=[{'all':!![]}];}return db[_0xa6fc('0xb9')][_0xa6fc('0xc3')](_0x59197b);})[_0xa6fc('0x2c')](function(_0x14da68){_0x434dab[_0xa6fc('0xb2')]=_0x14da68;return _0x434dab;});}})[_0xa6fc('0x2c')](respondWithFilteredResult(_0x1b2017,_0x59197b))[_0xa6fc('0x37')](handleError(_0x1b2017,null));};exports[_0xa6fc('0xc4')]=function(_0x4550d3,_0x147d08,_0x46b9ba){return db[_0xa6fc('0x40')][_0xa6fc('0x6a')]({'where':{'id':_0x4550d3[_0xa6fc('0xb4')]['id']}})[_0xa6fc('0x2c')](handleEntityNotFound(_0x147d08,null))['then'](function(_0x4d74ba){if(_0x4d74ba){return _0x4d74ba[_0xa6fc('0xc5')](_0x4550d3[_0xa6fc('0x79')][_0xa6fc('0xba')],_[_0xa6fc('0xbb')](_0x4550d3[_0xa6fc('0x79')],[_0xa6fc('0xba'),'id'])||{})[_0xa6fc('0xc6')](function(){return db[_0xa6fc('0xc7')][_0xa6fc('0xc3')]({'attributes':['id',_0xa6fc('0x2f'),_0xa6fc('0x53')],'where':{'id':_0x4550d3[_0xa6fc('0x79')][_0xa6fc('0xba')]}});})[_0xa6fc('0x2c')](function(_0x4ead41){socket[_0xa6fc('0xc8')](_0xa6fc('0xc9'),{'id':Number(_0x4550d3[_0xa6fc('0xb4')]['id']),'tags':_0x4ead41||[]});return{'id':Number(_0x4550d3[_0xa6fc('0xb4')]['id']),'tags':_0x4ead41||[]};});}})['then'](respondWithResult(_0x147d08,null))[_0xa6fc('0x37')](handleError(_0x147d08,null));};exports[_0xa6fc('0xca')]=function(_0x500407,_0x281b24,_0x320a03){return db['FaxInteraction'][_0xa6fc('0x6a')]({'where':{'id':_0x500407[_0xa6fc('0xb4')]['id']}})[_0xa6fc('0x2c')](handleEntityNotFound(_0x281b24,null))[_0xa6fc('0x2c')](function(_0x37b0d1){if(_0x37b0d1){return _0x37b0d1['removeTags'](_0x500407[_0xa6fc('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x281b24,null))[_0xa6fc('0x37')](handleError(_0x281b24,null));};exports[_0xa6fc('0xcb')]=function(_0x1bec46,_0x39acd1){var _0x46752c=moment()['unix']()['toString']();var _0x180f9d=path[_0xa6fc('0xcc')](config[_0xa6fc('0xcd')],_0xa6fc('0xce'),_0xa6fc('0xcf'),_0xa6fc('0xd0'));var _0x240a95=path['join'](config[_0xa6fc('0xcd')],_0xa6fc('0xce'),_0xa6fc('0xcf'),'attachments');var _0x3f7323=path[_0xa6fc('0xcc')](_0x180f9d,_0x46752c);var _0x48fbb8=util[_0xa6fc('0xbf')]('transcript-%d-%s.zip',_0x1bec46[_0xa6fc('0xb4')]['id'],_0x46752c);var _0xa6a2c5=path[_0xa6fc('0xcc')](_0x180f9d,_0x48fbb8);var _0x15ef6d=[];_0x15ef6d[_0xa6fc('0x36')]({'model':db[_0xa6fc('0xd1')],'as':'Attachment','raw':!![]});var _0x5c8cfc=[{'model':db[_0xa6fc('0xb9')],'as':_0xa6fc('0xd2'),'attributes':['id',_0xa6fc('0x79'),_0xa6fc('0x81')],'include':_0x15ef6d}];return db[_0xa6fc('0x40')]['find']({'where':{'id':_0x1bec46[_0xa6fc('0xb4')]['id']},'include':_0x5c8cfc})[_0xa6fc('0x2c')](handleEntityNotFound(_0x39acd1,null))[_0xa6fc('0x2c')](function(_0x4328e6){if(_0x4328e6&&_0x4328e6[_0xa6fc('0xd2')]){var _0x391cd3=_0x4328e6[_0xa6fc('0xd3')]({'plain':!![]});fs[_0xa6fc('0xd4')](_0x3f7323);for(var _0x171a3b=0x0;_0x171a3b<_0x391cd3['Messages']['length'];_0x171a3b++){var _0x1da172=_0x391cd3[_0xa6fc('0xd2')][_0x171a3b][_0xa6fc('0xd1')];if(_0x1da172){var _0x13fc34=path['join'](_0x240a95,_0x1da172[_0xa6fc('0xd5')]);if(fs[_0xa6fc('0xd6')](_0x13fc34)){fs[_0xa6fc('0xd7')](_0x13fc34)['pipe'](fs['createWriteStream'](path['join'](_0x3f7323,_0x1da172[_0xa6fc('0xd5')])));}}}return BPromise['resolve']()[_0xa6fc('0x2c')](function(){return new BPromise(function(_0x144d30,_0x7eb6fc){zipdir(_0x3f7323,{'saveTo':_0xa6a2c5},function(_0x2e2d8b,_0x144ed3){if(_0x2e2d8b)return _0x7eb6fc(_0x2e2d8b);return _0x144d30(_0x144ed3);});})[_0xa6fc('0x2c')](function(){return new BPromise(function(_0x1273bd,_0x4e8acb){rimraf(_0x3f7323,function(_0xece123){if(_0xece123)_0x4e8acb(_0xece123);return _0x1273bd();});});})[_0xa6fc('0x2c')](function(){return _0x39acd1[_0xa6fc('0xcb')](_0xa6a2c5,_0x48fbb8,function(_0xf6e127){if(_0xf6e127){console['log']('err',_0xf6e127);}else{fs[_0xa6fc('0xd8')](_0xa6a2c5);}});});});}else{return _0x39acd1[_0xa6fc('0x1f')](0xc8);}})[_0xa6fc('0x37')](handleError(_0x39acd1,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3c2d83f..b94f5da 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 _0x33cc=['save','update','remove','then','Users','map','findAll','unreadMessages','length','emit','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x33cc,0x14f));var _0xc33c=function(_0x301464,_0x563431){_0x301464=_0x301464-0x0;var _0x877237=_0x33cc[_0x301464];return _0x877237;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xc33c('0x0'))['db'][_0xc33c('0x1')];var FaxMessage=require(_0xc33c('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc33c('0x2')](0x0);var events={'afterCreate':_0xc33c('0x3'),'afterUpdate':_0xc33c('0x4'),'afterDestroy':_0xc33c('0x5')};function emitEvent(_0x4ca21d){return function(_0x47a55f,_0x3ba2d8,_0x26260f){_0x47a55f['getUsers']({'attributes':['id'],'raw':!![]})[_0xc33c('0x6')](function(_0x24b7af){_0x47a55f['setDataValue'](_0xc33c('0x7'),_0x24b7af[_0xc33c('0x8')](function(_0x2cb5f1){return{'id':_0x2cb5f1['id']};}));return FaxMessage[_0xc33c('0x9')]({'where':{'FaxInteractionId':_0x47a55f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc33c('0x6')](function(_0x2a9cbd){_0x47a55f['setDataValue'](_0xc33c('0xa'),_0x2a9cbd[_0xc33c('0xb')]);FaxInteractionEvents['emit'](_0x4ca21d+':'+_0x47a55f['id'],_0x47a55f);FaxInteractionEvents[_0xc33c('0xc')](_0x4ca21d,_0x47a55f);_0x26260f(null);})['catch'](_0x26260f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x1f18=['save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x1f18,0x10a));var _0x81f1=function(_0xc2ac06,_0x1a65c6){_0xc2ac06=_0xc2ac06-0x0;var _0x95800b=_0x1f18[_0xc2ac06];return _0x95800b;};'use strict';var EventEmitter=require(_0x81f1('0x0'));var FaxInteraction=require(_0x81f1('0x1'))['db'][_0x81f1('0x2')];var FaxMessage=require(_0x81f1('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x81f1('0x3')](0x0);var events={'afterCreate':_0x81f1('0x4'),'afterUpdate':_0x81f1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25c4f){return function(_0x3756cb,_0x6edf88,_0x5357d1){_0x3756cb[_0x81f1('0x6')]({'attributes':['id'],'raw':!![]})[_0x81f1('0x7')](function(_0x511c2a){_0x3756cb[_0x81f1('0x8')](_0x81f1('0x9'),_0x511c2a['map'](function(_0x499ee7){return{'id':_0x499ee7['id']};}));return FaxMessage[_0x81f1('0xa')]({'where':{'FaxInteractionId':_0x3756cb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x81f1('0x7')](function(_0x4c2b95){_0x3756cb['setDataValue'](_0x81f1('0xb'),_0x4c2b95[_0x81f1('0xc')]);FaxInteractionEvents[_0x81f1('0xd')](_0x25c4f+':'+_0x3756cb['id'],_0x3756cb);FaxInteractionEvents['emit'](_0x25c4f,_0x3756cb);_0x5357d1(null);})[_0x81f1('0xe')](_0x5357d1(null));};}for(var e in events){if(events[_0x81f1('0xf')](e)){var event=events[e];FaxInteraction[_0x81f1('0x10')](e,emitEvent(event));}}module[_0x81f1('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index dbf098a..3801bf4 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 _0xd709=['exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxInteraction.attributes'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd709,0x104));var _0x9d70=function(_0x2b2dec,_0x4efd31){_0x2b2dec=_0x2b2dec-0x0;var _0x168183=_0xd709[_0x2b2dec];return _0x168183;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d70('0x0'))(_0x9d70('0x1'));var moment=require('moment');var BPromise=require(_0x9d70('0x2'));var rp=require(_0x9d70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d70('0x4'));var attributes=require(_0x9d70('0x5'));module[_0x9d70('0x6')]=function(_0x3babb0,_0x144270){return _0x3babb0[_0x9d70('0x7')](_0x9d70('0x8'),attributes,{'tableName':_0x9d70('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fdc52,_0x44d806,_0x51a6ce){if(_0x1fdc52[_0x9d70('0xa')]('closed')){_0x1fdc52[_0x9d70('0xb')]=moment()[_0x9d70('0xc')](_0x9d70('0xd'));}_0x51a6ce(null,_0x1fdc52);}}});}; \ No newline at end of file +var _0x806e=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x424350,_0x1293a9){var _0x3cee3f=function(_0x25af1f){while(--_0x25af1f){_0x424350['push'](_0x424350['shift']());}};_0x3cee3f(++_0x1293a9);}(_0x806e,0x1ef));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe806('0x0'));var util=require(_0xe806('0x1'));var logger=require(_0xe806('0x2'))(_0xe806('0x3'));var moment=require(_0xe806('0x4'));var BPromise=require(_0xe806('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe806('0x6'));var rimraf=require(_0xe806('0x7'));var config=require(_0xe806('0x8'));var attributes=require(_0xe806('0x9'));module[_0xe806('0xa')]=function(_0x28623e,_0x7c5cf7){return _0x28623e[_0xe806('0xb')](_0xe806('0xc'),attributes,{'tableName':_0xe806('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x274a93,_0x5e0730,_0x409e61){if(_0x274a93[_0xe806('0xe')](_0xe806('0xf'))){_0x274a93[_0xe806('0x10')]=moment()[_0xe806('0x11')](_0xe806('0x12'));}_0x409e61(null,_0x274a93);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e25087c..5266136 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 _0x5af2=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','FaxInteraction','update','options','raw','where','attributes','limit','UpdateFaxInteraction','debug','stringify','catch','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','register','then'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5af2,0xb1));var _0x25af=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5af2[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x25af('0x0'));var util=require('util');var moment=require(_0x25af('0x1'));var BPromise=require(_0x25af('0x2'));var rs=require(_0x25af('0x3'));var fs=require('fs');var Redis=require(_0x25af('0x4'));var db=require(_0x25af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x25af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x25af('0x7'));var client=jayson[_0x25af('0x8')]['http']({'port':0x232a});config[_0x25af('0x9')]=_[_0x25af('0xa')](config[_0x25af('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25af('0x9')]));require('./faxInteraction.socket')[_0x25af('0xb')](socket);function respondWithRpcPromise(_0x360f9f,_0x3141f2,_0x3a5459){return new BPromise(function(_0x45ef7f,_0x280bb0){return client['request'](_0x360f9f,_0x3a5459)[_0x25af('0xc')](function(_0x58e772){logger[_0x25af('0xd')](_0x25af('0xe'),_0x3141f2,_0x25af('0xf'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3141f2,_0x25af('0xf'),JSON['stringify'](_0x58e772));if(_0x58e772[_0x25af('0x10')]){if(_0x58e772[_0x25af('0x10')]['code']===0x1f4){logger[_0x25af('0x10')](_0x25af('0xe'),_0x3141f2,_0x58e772[_0x25af('0x10')][_0x25af('0x11')]);return _0x280bb0(_0x58e772[_0x25af('0x10')]['message']);}logger['error'](_0x25af('0xe'),_0x3141f2,_0x58e772['error'][_0x25af('0x11')]);return _0x45ef7f(_0x58e772[_0x25af('0x10')][_0x25af('0x11')]);}else{logger[_0x25af('0xd')](_0x25af('0xe'),_0x3141f2,'request\x20sent');_0x45ef7f(_0x58e772[_0x25af('0x12')][_0x25af('0x11')]);}})['catch'](function(_0xd230e0){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3141f2,_0xd230e0);_0x280bb0(_0xd230e0);});});}exports['UpdateFaxInteraction']=function(_0x677665){var _0x20b195=this;return new Promise(function(_0x390011,_0x1bfbdb){return db[_0x25af('0x13')][_0x25af('0x14')](_0x677665['body'],{'raw':_0x677665[_0x25af('0x15')]?_0x677665['options'][_0x25af('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x677665[_0x25af('0x15')]?_0x677665[_0x25af('0x15')][_0x25af('0x17')]||null:null,'attributes':_0x677665['options']?_0x677665[_0x25af('0x15')][_0x25af('0x18')]||null:null,'limit':_0x677665[_0x25af('0x15')]?_0x677665[_0x25af('0x15')][_0x25af('0x19')]||null:null})[_0x25af('0xc')](function(_0x1612c5){logger[_0x25af('0xd')](_0x25af('0x1a'),_0x677665);logger[_0x25af('0x1b')](_0x25af('0x1a'),_0x677665,JSON[_0x25af('0x1c')](_0x1612c5));_0x390011(_0x1612c5);})[_0x25af('0x1d')](function(_0x3c72be){logger[_0x25af('0x10')](_0x25af('0x1a'),_0x3c72be[_0x25af('0x11')],_0x677665);_0x1bfbdb(_0x20b195[_0x25af('0x10')](0x1f4,_0x3c72be[_0x25af('0x11')]));});});};exports[_0x25af('0x1e')]=function(_0x3e48b3){return new Promise(function(_0x50ecb9,_0x5262a6){return db[_0x25af('0x13')][_0x25af('0x1f')]({'where':_0x3e48b3['options']?_0x3e48b3[_0x25af('0x15')][_0x25af('0x17')]||null:null})[_0x25af('0xc')](function(_0x453f8b){if(_0x453f8b){return _0x453f8b[_0x25af('0x20')](_0x3e48b3[_0x25af('0x21')][_0x25af('0x22')],_[_0x25af('0x23')](_0x3e48b3['body'],[_0x25af('0x22'),'id'])||{});}})[_0x25af('0x24')](function(_0x51e214){logger[_0x25af('0xd')](_0x25af('0x25'),_0x3e48b3);logger[_0x25af('0x1b')]('AddTags',_0x3e48b3,JSON[_0x25af('0x1c')](_0x51e214));_0x50ecb9(_0x51e214);})['catch'](function(_0x3c410d){logger[_0x25af('0x10')](_0x25af('0x25'),_0x3c410d[_0x25af('0x11')],_0x3e48b3);_0x5262a6(_this[_0x25af('0x10')](0x1f4,_0x3c410d[_0x25af('0x11')]));});});}; \ No newline at end of file +var _0x8dd2=['FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','debug','find','addTags','omit','ids','AddTags','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x1bb65e,_0x40563e){var _0x296be2=function(_0x2dec2c){while(--_0x2dec2c){_0x1bb65e['push'](_0x1bb65e['shift']());}};_0x296be2(++_0x40563e);}(_0x8dd2,0x67));var _0x28dd=function(_0x1aa3ce,_0x453b5a){_0x1aa3ce=_0x1aa3ce-0x0;var _0x3fb000=_0x8dd2[_0x1aa3ce];return _0x3fb000;};'use strict';var _=require(_0x28dd('0x0'));var util=require(_0x28dd('0x1'));var moment=require(_0x28dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28dd('0x3'));var db=require(_0x28dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28dd('0x5'));var config=require(_0x28dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x28dd('0x7')][_0x28dd('0x8')]({'port':0x232a});config['redis']=_[_0x28dd('0x9')](config[_0x28dd('0xa')],{'host':_0x28dd('0xb'),'port':0x18eb});var socket=require(_0x28dd('0xc'))(new Redis(config[_0x28dd('0xa')]));require('./faxInteraction.socket')[_0x28dd('0xd')](socket);function respondWithRpcPromise(_0xbc405f,_0x2941f6,_0x2b2820){return new BPromise(function(_0x4b6618,_0x4098e1){return client[_0x28dd('0xe')](_0xbc405f,_0x2b2820)[_0x28dd('0xf')](function(_0x2fbfbb){logger[_0x28dd('0x10')](_0x28dd('0x11'),_0x2941f6,_0x28dd('0x12'));logger['debug'](_0x28dd('0x13'),_0x2941f6,'request\x20sent',JSON[_0x28dd('0x14')](_0x2fbfbb));if(_0x2fbfbb[_0x28dd('0x15')]){if(_0x2fbfbb['error'][_0x28dd('0x16')]===0x1f4){logger[_0x28dd('0x15')](_0x28dd('0x11'),_0x2941f6,_0x2fbfbb[_0x28dd('0x15')][_0x28dd('0x17')]);return _0x4098e1(_0x2fbfbb[_0x28dd('0x15')][_0x28dd('0x17')]);}logger['error'](_0x28dd('0x11'),_0x2941f6,_0x2fbfbb['error'][_0x28dd('0x17')]);return _0x4b6618(_0x2fbfbb[_0x28dd('0x15')]['message']);}else{logger['info'](_0x28dd('0x11'),_0x2941f6,_0x28dd('0x12'));_0x4b6618(_0x2fbfbb[_0x28dd('0x18')]['message']);}})[_0x28dd('0x19')](function(_0x573b9e){logger[_0x28dd('0x15')](_0x28dd('0x11'),_0x2941f6,_0x573b9e);_0x4098e1(_0x573b9e);});});}exports[_0x28dd('0x1a')]=function(_0x9ef332){var _0x156027=this;return new Promise(function(_0x32dc68,_0x2b846a){return db[_0x28dd('0x1b')][_0x28dd('0x1c')](_0x9ef332[_0x28dd('0x1d')],{'raw':_0x9ef332[_0x28dd('0x1e')]?_0x9ef332[_0x28dd('0x1e')][_0x28dd('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9ef332['options']?_0x9ef332[_0x28dd('0x1e')][_0x28dd('0x20')]||null:null,'attributes':_0x9ef332['options']?_0x9ef332[_0x28dd('0x1e')]['attributes']||null:null,'limit':_0x9ef332['options']?_0x9ef332['options'][_0x28dd('0x21')]||null:null})[_0x28dd('0xf')](function(_0x26ddf6){logger[_0x28dd('0x10')](_0x28dd('0x1a'),_0x9ef332);logger[_0x28dd('0x22')]('UpdateFaxInteraction',_0x9ef332,JSON[_0x28dd('0x14')](_0x26ddf6));_0x32dc68(_0x26ddf6);})['catch'](function(_0x45006d){logger[_0x28dd('0x15')](_0x28dd('0x1a'),_0x45006d[_0x28dd('0x17')],_0x9ef332);_0x2b846a(_0x156027[_0x28dd('0x15')](0x1f4,_0x45006d['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3b1f22){return new Promise(function(_0x402d24,_0x412007){return db[_0x28dd('0x1b')][_0x28dd('0x23')]({'where':_0x3b1f22[_0x28dd('0x1e')]?_0x3b1f22[_0x28dd('0x1e')][_0x28dd('0x20')]||null:null})[_0x28dd('0xf')](function(_0x241f52){if(_0x241f52){return _0x241f52[_0x28dd('0x24')](_0x3b1f22[_0x28dd('0x1d')]['ids'],_[_0x28dd('0x25')](_0x3b1f22['body'],[_0x28dd('0x26'),'id'])||{});}})['spread'](function(_0xb931ea){logger[_0x28dd('0x10')]('AddTags',_0x3b1f22);logger[_0x28dd('0x22')](_0x28dd('0x27'),_0x3b1f22,JSON[_0x28dd('0x14')](_0xb931ea));_0x402d24(_0xb931ea);})[_0x28dd('0x19')](function(_0x354024){logger[_0x28dd('0x15')](_0x28dd('0x27'),_0x354024[_0x28dd('0x17')],_0x3b1f22);_0x412007(_this[_0x28dd('0x15')](0x1f4,_0x354024[_0x28dd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bcc9a75..a3137c0 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 _0x3ab1=['register','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x329169,_0x50f84f){var _0x1bf5f8=function(_0x9c762a){while(--_0x9c762a){_0x329169['push'](_0x329169['shift']());}};_0x1bf5f8(++_0x50f84f);}(_0x3ab1,0x17b));var _0x13ab=function(_0x45303b,_0x7a0cfc){_0x45303b=_0x45303b-0x0;var _0x266399=_0x3ab1[_0x45303b];return _0x266399;};'use strict';var FaxInteractionEvents=require(_0x13ab('0x0'));var events=[_0x13ab('0x1'),_0x13ab('0x2'),_0x13ab('0x3')];function createListener(_0x232808,_0x5e5420){return function(_0x587b54){_0x5e5420[_0x13ab('0x4')](_0x232808,_0x587b54);};}function removeListener(_0x2d7077,_0x3ec544){return function(){FaxInteractionEvents[_0x13ab('0x5')](_0x2d7077,_0x3ec544);};}exports[_0x13ab('0x6')]=function(_0x272494){for(var _0x10a206=0x0,_0x1ed3ce=events['length'];_0x10a206<_0x1ed3ce;_0x10a206++){var _0x443d41=events[_0x10a206];var _0x54e946=createListener('faxInteraction:'+_0x443d41,_0x272494);FaxInteractionEvents['on'](_0x443d41,_0x54e946);}}; \ No newline at end of file +var _0x50e7=['remove','update','register','length','faxInteraction:','save'];(function(_0x4e8ea5,_0x35bef1){var _0x394f75=function(_0x5519f5){while(--_0x5519f5){_0x4e8ea5['push'](_0x4e8ea5['shift']());}};_0x394f75(++_0x35bef1);}(_0x50e7,0x14f));var _0x750e=function(_0x413105,_0x2e8e38){_0x413105=_0x413105-0x0;var _0x1a98a5=_0x50e7[_0x413105];return _0x1a98a5;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x750e('0x0'),_0x750e('0x1'),_0x750e('0x2')];function createListener(_0x504e18,_0x4141db){return function(_0x39013e){_0x4141db['emit'](_0x504e18,_0x39013e);};}function removeListener(_0x1416de,_0xe6189c){return function(){FaxInteractionEvents['removeListener'](_0x1416de,_0xe6189c);};}exports[_0x750e('0x3')]=function(_0x5f35eb){for(var _0x4cbd90=0x0,_0x1cb9c2=events[_0x750e('0x4')];_0x4cbd90<_0x1cb9c2;_0x4cbd90++){var _0x344bbd=events[_0x4cbd90];var _0x175249=createListener(_0x750e('0x5')+_0x344bbd,_0x5f35eb);FaxInteractionEvents['on'](_0x344bbd,_0x175249);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e39cae7..a2066ba 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 _0xfd95=['addTags','put','tracked','faxinteraction:update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','fax','faxinteraction:addtags'];(function(_0x4d0f4f,_0x260ff8){var _0x3750bb=function(_0x14b54a){while(--_0x14b54a){_0x4d0f4f['push'](_0x4d0f4f['shift']());}};_0x3750bb(++_0x260ff8);}(_0xfd95,0x97));var _0x5fd9=function(_0x132d2e,_0x3304cd){_0x132d2e=_0x132d2e-0x0;var _0x1f7bb1=_0xfd95[_0x132d2e];return _0x1f7bb1;};'use strict';var multer=require(_0x5fd9('0x0'));var util=require('util');var path=require(_0x5fd9('0x1'));var timeout=require(_0x5fd9('0x2'));var express=require(_0x5fd9('0x3'));var router=express[_0x5fd9('0x4')]();var fs_extra=require(_0x5fd9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5fd9('0x6'));var config=require(_0x5fd9('0x7'));var controller=require(_0x5fd9('0x8'));router[_0x5fd9('0x9')]('/',auth['isAuthenticated'](),controller[_0x5fd9('0xa')]);router['get'](_0x5fd9('0xb'),auth[_0x5fd9('0xc')](),controller[_0x5fd9('0xd')]);router[_0x5fd9('0x9')](_0x5fd9('0xe'),auth[_0x5fd9('0xc')](),controller[_0x5fd9('0xf')]);router[_0x5fd9('0x9')](_0x5fd9('0x10'),auth[_0x5fd9('0xc')](),controller['getMessages']);router['get'](_0x5fd9('0x11'),auth[_0x5fd9('0xc')](),controller[_0x5fd9('0x12')]);router[_0x5fd9('0x13')]('/',auth[_0x5fd9('0xc')](),controller['create']);router[_0x5fd9('0x13')](_0x5fd9('0x10'),auth[_0x5fd9('0xc')](),controller['addMessage']);router['post'](_0x5fd9('0x14'),auth[_0x5fd9('0xc')](),interaction['tracked'](_0x5fd9('0x15'),_0x5fd9('0x16')),controller[_0x5fd9('0x17')]);router[_0x5fd9('0x18')](_0x5fd9('0xe'),auth[_0x5fd9('0xc')](),interaction[_0x5fd9('0x19')](_0x5fd9('0x15'),_0x5fd9('0x1a')),controller['update']);router[_0x5fd9('0x1b')]('/:id',auth[_0x5fd9('0xc')](),interaction[_0x5fd9('0x19')](_0x5fd9('0x15'),'faxinteraction:destroy'),controller[_0x5fd9('0x1c')]);router[_0x5fd9('0x1b')](_0x5fd9('0x14'),auth[_0x5fd9('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x7a13=['isAuthenticated','describe','/:id','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get'];(function(_0x8d2897,_0x5276ab){var _0x104bf4=function(_0x71a611){while(--_0x71a611){_0x8d2897['push'](_0x8d2897['shift']());}};_0x104bf4(++_0x5276ab);}(_0x7a13,0x14b));var _0x37a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x37a1('0x0'));var util=require(_0x37a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x37a1('0x2'));var auth=require(_0x37a1('0x3'));var interaction=require(_0x37a1('0x4'));var config=require('../../config/environment');var controller=require(_0x37a1('0x5'));router[_0x37a1('0x6')]('/',auth[_0x37a1('0x7')](),controller['index']);router[_0x37a1('0x6')]('/describe',auth[_0x37a1('0x7')](),controller[_0x37a1('0x8')]);router[_0x37a1('0x6')](_0x37a1('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x37a1('0x6')](_0x37a1('0xa'),auth[_0x37a1('0x7')](),controller['getMessages']);router['get'](_0x37a1('0xb'),auth[_0x37a1('0x7')](),controller['download']);router[_0x37a1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37a1('0xc')]('/:id/messages',auth[_0x37a1('0x7')](),controller[_0x37a1('0xd')]);router[_0x37a1('0xc')](_0x37a1('0xe'),auth[_0x37a1('0x7')](),interaction[_0x37a1('0xf')](_0x37a1('0x10'),_0x37a1('0x11')),controller[_0x37a1('0x12')]);router[_0x37a1('0x13')](_0x37a1('0x9'),auth[_0x37a1('0x7')](),interaction[_0x37a1('0xf')](_0x37a1('0x10'),_0x37a1('0x14')),controller[_0x37a1('0x15')]);router[_0x37a1('0x16')](_0x37a1('0x9'),auth[_0x37a1('0x7')](),interaction[_0x37a1('0xf')](_0x37a1('0x10'),_0x37a1('0x17')),controller[_0x37a1('0x18')]);router[_0x37a1('0x16')](_0x37a1('0xe'),auth['isAuthenticated'](),controller['removeTags']);module[_0x37a1('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5d41a8a..09e74ad 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 _0xc2cc=['medium','ENUM','out','DATE','exports','TEXT'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xcc2c('0x0')]={'body':{'type':Sequelize[_0xcc2c('0x1')](_0xcc2c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcc2c('0x3')]('in','out'),'defaultValue':_0xcc2c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xcc2c('0x5')]}}; \ No newline at end of file +var _0xed1f=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x19eb04,_0x4eeaa8){var _0x889fbd=function(_0x5db80d){while(--_0x5db80d){_0x19eb04['push'](_0x19eb04['shift']());}};_0x889fbd(++_0x4eeaa8);}(_0xed1f,0x6a));var _0xfed1=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xed1f[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'body':{'type':Sequelize[_0xfed1('0x2')](_0xfed1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfed1('0x5')]('in',_0xfed1('0x6')),'defaultValue':_0xfed1('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfed1('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfed1('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5b3477c..ddc53bd 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 _0x4f90=['defaults','localhost','./faxMessage.socket','register','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','FaxMessage','include','findAll','catch','show','length','includeAll','options','find','params','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','event','acceptmessage','rejectMessage','ContactId','sequelize','internal','motionChannel','EventManager','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4f90,0x19b));var _0x04f9=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x4f90[_0x53b8e0];return _0x10630c;};'use strict';var emlformat=require(_0x04f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04f9('0x1'));var jsonpatch=require(_0x04f9('0x2'));var rp=require(_0x04f9('0x3'));var moment=require(_0x04f9('0x4'));var BPromise=require(_0x04f9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04f9('0x6'));var csv=require(_0x04f9('0x7'));var ejs=require(_0x04f9('0x8'));var fs=require('fs');var fs_extra=require(_0x04f9('0x9'));var _=require('lodash');var squel=require(_0x04f9('0xa'));var crypto=require(_0x04f9('0xb'));var jsforce=require(_0x04f9('0xc'));var deskjs=require(_0x04f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x04f9('0xe'));var Papa=require(_0x04f9('0xf'));var Redis=require(_0x04f9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x04f9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04f9('0x12'));var logger=require(_0x04f9('0x13'))('api');var utils=require(_0x04f9('0x14'));var config=require(_0x04f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x04f9('0x16'))['db'];config[_0x04f9('0x17')]=_[_0x04f9('0x18')](config[_0x04f9('0x17')],{'host':_0x04f9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04f9('0x17')]));require(_0x04f9('0x1a'))[_0x04f9('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x04f9('0x1c')]({'port':0x232c});var client9002=jayson[_0x04f9('0x1d')][_0x04f9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x50f939,_0xbd538d,_0x43adfc,_0x36b973){return new BPromise(function(_0x4b330,_0x8cdc7d){var _0x2b3001=_0x36b973||client;return _0x2b3001[_0x04f9('0x1e')](_0x50f939,_0x43adfc)[_0x04f9('0x1f')](function(_0x3ac787){logger[_0x04f9('0x20')](_0x04f9('0x21'),_0xbd538d,_0x04f9('0x22'));logger[_0x04f9('0x23')](_0x04f9('0x24'),_0xbd538d,_0x04f9('0x22'),JSON[_0x04f9('0x25')](_0x3ac787));if(_0x3ac787[_0x04f9('0x26')]){if(_0x3ac787[_0x04f9('0x26')][_0x04f9('0x27')]===0x1f4){logger[_0x04f9('0x26')](_0x04f9('0x21'),_0xbd538d,_0x3ac787[_0x04f9('0x26')][_0x04f9('0x28')]);return _0x8cdc7d(_0x3ac787[_0x04f9('0x26')]['message']);}logger[_0x04f9('0x26')](_0x04f9('0x21'),_0xbd538d,_0x3ac787[_0x04f9('0x26')]['message']);return _0x4b330(_0x3ac787[_0x04f9('0x26')]['message']);}else{logger['info'](_0x04f9('0x21'),_0xbd538d,_0x04f9('0x22'));_0x4b330(_0x3ac787['result'][_0x04f9('0x28')]);}})['catch'](function(_0x3ee502){logger[_0x04f9('0x26')](_0x04f9('0x21'),_0xbd538d,_0x3ee502);_0x8cdc7d(_0x3ee502);});});}function respondWithStatusCode(_0x551576,_0x41c384){_0x41c384=_0x41c384||0xcc;return function(_0x3e8d3b){if(_0x3e8d3b){return _0x551576[_0x04f9('0x29')](_0x41c384);}return _0x551576['status'](_0x41c384)[_0x04f9('0x2a')]();};}function respondWithResult(_0x19726c,_0x35f1c9){_0x35f1c9=_0x35f1c9||0xc8;return function(_0x377cc5){if(_0x377cc5){return _0x19726c[_0x04f9('0x2b')](_0x35f1c9)[_0x04f9('0x2c')](_0x377cc5);}};}function respondWithFilteredResult(_0xdbd259,_0x284b05){return function(_0x3329ad){if(_0x3329ad){var _0x5f4909=typeof _0x284b05[_0x04f9('0x2d')]===_0x04f9('0x2e')&&typeof _0x284b05[_0x04f9('0x2f')]===_0x04f9('0x2e');var _0x2fd20b=_0x3329ad[_0x04f9('0x30')];var _0x281c6d=_0x5f4909?0x0:_0x284b05['offset'];var _0x15bbda=_0x5f4909?_0x3329ad[_0x04f9('0x30')]:_0x284b05['offset']+_0x284b05[_0x04f9('0x2f')];var _0x40068e;if(_0x15bbda>=_0x2fd20b){_0x15bbda=_0x2fd20b;_0x40068e=0xc8;}else{_0x40068e=0xce;}_0xdbd259[_0x04f9('0x2b')](_0x40068e);return _0xdbd259['set'](_0x04f9('0x31'),_0x281c6d+'-'+_0x15bbda+'/'+_0x2fd20b)['json'](_0x3329ad);}return null;};}function patchUpdates(_0xde5bc8){return function(_0x490f5d){try{jsonpatch[_0x04f9('0x32')](_0x490f5d,_0xde5bc8,!![]);}catch(_0x17ebdb){return BPromise[_0x04f9('0x33')](_0x17ebdb);}return _0x490f5d[_0x04f9('0x34')]();};}function saveUpdates(_0x571e01,_0x4b45a3){return function(_0x43ae32){if(_0x43ae32){return _0x43ae32[_0x04f9('0x35')](_0x571e01)[_0x04f9('0x1f')](function(_0x11a06a){return _0x11a06a;});}return null;};}function removeEntity(_0x2fc512,_0x7fea52){return function(_0x565e37){if(_0x565e37){return _0x565e37[_0x04f9('0x36')]()[_0x04f9('0x1f')](function(){_0x2fc512[_0x04f9('0x2b')](0xcc)[_0x04f9('0x2a')]();});}};}function handleEntityNotFound(_0x1a2daf,_0x16d93f){return function(_0x4b27d3){if(!_0x4b27d3){_0x1a2daf[_0x04f9('0x29')](0x194);}return _0x4b27d3;};}function handleError(_0x325999,_0xca0998){_0xca0998=_0xca0998||0x1f4;return function(_0x24dce9){logger['error'](_0x24dce9[_0x04f9('0x37')]);if(_0x24dce9[_0x04f9('0x38')]){delete _0x24dce9[_0x04f9('0x38')];}_0x325999['status'](_0xca0998)[_0x04f9('0x39')](_0x24dce9);};}exports[_0x04f9('0x3a')]=function(_0x40e6f2,_0x519394){var _0xfea93={},_0x3082a5={},_0x505f2c={'count':0x0,'rows':[]};var _0x490c90=_[_0x04f9('0x3b')](db['FaxMessage'][_0x04f9('0x3c')],function(_0x5a1264){return{'name':_0x5a1264[_0x04f9('0x3d')],'type':_0x5a1264[_0x04f9('0x3e')][_0x04f9('0x3f')]};});_0x3082a5['model']=_['map'](_0x490c90,_0x04f9('0x38'));_0x3082a5[_0x04f9('0x40')]=_[_0x04f9('0x41')](_0x40e6f2[_0x04f9('0x40')]);_0x3082a5[_0x04f9('0x42')]=_[_0x04f9('0x43')](_0x3082a5['model'],_0x3082a5[_0x04f9('0x40')]);_0xfea93[_0x04f9('0x44')]=_[_0x04f9('0x43')](_0x3082a5[_0x04f9('0x45')],qs[_0x04f9('0x46')](_0x40e6f2[_0x04f9('0x40')][_0x04f9('0x46')]));_0xfea93[_0x04f9('0x44')]=_0xfea93[_0x04f9('0x44')]['length']?_0xfea93[_0x04f9('0x44')]:_0x3082a5[_0x04f9('0x45')];if(!_0x40e6f2[_0x04f9('0x40')][_0x04f9('0x47')](_0x04f9('0x48'))){_0xfea93['limit']=qs['limit'](_0x40e6f2[_0x04f9('0x40')]['limit']);_0xfea93[_0x04f9('0x2d')]=qs['offset'](_0x40e6f2[_0x04f9('0x40')]['offset']);}_0xfea93['order']=qs['sort'](_0x40e6f2['query'][_0x04f9('0x49')]);_0xfea93[_0x04f9('0x4a')]=qs[_0x04f9('0x42')](_[_0x04f9('0x4b')](_0x40e6f2[_0x04f9('0x40')],_0x3082a5['filters']),_0x490c90);if(_0x40e6f2['query'][_0x04f9('0x4c')]){_0xfea93['where']=_[_0x04f9('0x4d')](_0xfea93[_0x04f9('0x4a')],{'$or':_[_0x04f9('0x3b')](_0x490c90,function(_0x2790d3){if(_0x2790d3[_0x04f9('0x3e')]!==_0x04f9('0x4e')){var _0x40e0ba={};_0x40e0ba[_0x2790d3[_0x04f9('0x38')]]={'$like':'%'+_0x40e6f2[_0x04f9('0x40')][_0x04f9('0x4c')]+'%'};return _0x40e0ba;}})});}_0xfea93=_[_0x04f9('0x4d')]({},_0xfea93,_0x40e6f2['options']);var _0x2859be={'where':_0xfea93[_0x04f9('0x4a')]};return db[_0x04f9('0x4f')][_0x04f9('0x30')](_0x2859be)[_0x04f9('0x1f')](function(_0x3c5a54){_0x505f2c[_0x04f9('0x30')]=_0x3c5a54;if(_0x40e6f2['query']['includeAll']){_0xfea93[_0x04f9('0x50')]=[{'all':!![]}];}return db[_0x04f9('0x4f')][_0x04f9('0x51')](_0xfea93);})[_0x04f9('0x1f')](function(_0x13a4eb){_0x505f2c['rows']=_0x13a4eb;return _0x505f2c;})[_0x04f9('0x1f')](respondWithFilteredResult(_0x519394,_0xfea93))[_0x04f9('0x52')](handleError(_0x519394,null));};exports[_0x04f9('0x53')]=function(_0x40ed7c,_0x1610c3){var _0x54d290={'raw':!![],'where':{'id':_0x40ed7c['params']['id']}},_0x38f635={};_0x38f635['model']=_[_0x04f9('0x41')](db[_0x04f9('0x4f')][_0x04f9('0x3c')]);_0x38f635['query']=_['keys'](_0x40ed7c[_0x04f9('0x40')]);_0x38f635[_0x04f9('0x42')]=_['intersection'](_0x38f635['model'],_0x38f635['query']);_0x54d290[_0x04f9('0x44')]=_['intersection'](_0x38f635[_0x04f9('0x45')],qs[_0x04f9('0x46')](_0x40ed7c[_0x04f9('0x40')][_0x04f9('0x46')]));_0x54d290['attributes']=_0x54d290[_0x04f9('0x44')][_0x04f9('0x54')]?_0x54d290[_0x04f9('0x44')]:_0x38f635[_0x04f9('0x45')];if(_0x40ed7c[_0x04f9('0x40')][_0x04f9('0x55')]){_0x54d290[_0x04f9('0x50')]=[{'all':!![]}];}_0x54d290=_['merge']({},_0x54d290,_0x40ed7c[_0x04f9('0x56')]);return db[_0x04f9('0x4f')][_0x04f9('0x57')](_0x54d290)['then'](handleEntityNotFound(_0x1610c3,null))[_0x04f9('0x1f')](respondWithResult(_0x1610c3,null))[_0x04f9('0x52')](handleError(_0x1610c3,null));};exports[_0x04f9('0x35')]=function(_0xb4d045,_0x4c4df0){if(_0xb4d045['body']['id']){delete _0xb4d045['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0xb4d045[_0x04f9('0x58')]['id']}})[_0x04f9('0x1f')](handleEntityNotFound(_0x4c4df0,null))[_0x04f9('0x1f')](saveUpdates(_0xb4d045[_0x04f9('0x59')],null))[_0x04f9('0x1f')](respondWithResult(_0x4c4df0,null))[_0x04f9('0x52')](handleError(_0x4c4df0,null));};exports[_0x04f9('0x36')]=function(_0x41f8b0,_0x2e6cfd){return db['FaxMessage'][_0x04f9('0x57')]({'where':{'id':_0x41f8b0[_0x04f9('0x58')]['id']}})[_0x04f9('0x1f')](handleEntityNotFound(_0x2e6cfd,null))[_0x04f9('0x1f')](removeEntity(_0x2e6cfd,null))[_0x04f9('0x52')](handleError(_0x2e6cfd,null));};exports[_0x04f9('0x5a')]=function(_0x3ae4d9,_0x3871db){return db[_0x04f9('0x4f')][_0x04f9('0x5a')]()[_0x04f9('0x1f')](respondWithResult(_0x3871db,null))[_0x04f9('0x52')](handleError(_0x3871db,null));};var interaction_log=require(_0x04f9('0x13'))(_0x04f9('0x5b'));exports[_0x04f9('0x5c')]=function(_0x33f203,_0x4b72af,_0x4d46fb){var _0x5166c5={'agent':{},'channel':_0x04f9('0x5d')};if(_0x33f203['body']['id']){delete _0x33f203[_0x04f9('0x59')]['id'];}_0x33f203['body'][_0x04f9('0x5e')]=!![];_0x33f203[_0x04f9('0x59')][_0x04f9('0x5f')]=moment()[_0x04f9('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f203['body'][_0x04f9('0x61')]=_0x33f203[_0x04f9('0x59')]['UserId']||_0x33f203[_0x04f9('0x62')]['id'];_0x5166c5[_0x04f9('0x63')]['id']=_0x33f203[_0x04f9('0x59')][_0x04f9('0x61')];return db[_0x04f9('0x4f')][_0x04f9('0x57')]({'where':{'id':_0x33f203[_0x04f9('0x58')]['id'],'UserId':null}})[_0x04f9('0x1f')](handleEntityNotFound(_0x4b72af,null))[_0x04f9('0x1f')](saveUpdates(_0x33f203[_0x04f9('0x59')],null))[_0x04f9('0x1f')](function(_0x4ee6f2){if(_0x4ee6f2){_0x5166c5[_0x04f9('0x28')]=_0x4ee6f2[_0x04f9('0x64')]({'plain':!![]});return db[_0x04f9('0x65')][_0x04f9('0x57')]({'where':{'id':_0x4ee6f2[_0x04f9('0x66')]}});}return null;})[_0x04f9('0x1f')](handleEntityNotFound(_0x4b72af,null))[_0x04f9('0x1f')](function(_0x5366b8){if(_0x5366b8){return _0x5366b8['update']({'UserId':_0x33f203[_0x04f9('0x59')][_0x04f9('0x61')],'read1stAt':_[_0x04f9('0x67')](_0x5366b8[_0x04f9('0x68')])?moment()[_0x04f9('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x04f9('0x1f')](function(_0x3178ff){if(_0x3178ff){_0x5166c5[_0x04f9('0x69')]=_0x3178ff['get']({'plain':!![]});interaction_log['info'](_0x04f9('0x6a'),_0x33f203[_0x04f9('0x62')]['id'],_0x33f203[_0x04f9('0x62')]['name'],_0x33f203[_0x04f9('0x62')][_0x04f9('0x6b')],_0x5166c5[_0x04f9('0x69')]['id'],_0x33f203[_0x04f9('0x59')]?JSON[_0x04f9('0x25')](_0x33f203[_0x04f9('0x59')]):_0x04f9('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x04f9('0x6d'),_0x5166c5);}return null;})[_0x04f9('0x1f')](function(_0x10e936){var _0x185404=_0x04f9('0x6e')+_0x10e936[_0x04f9('0x28')]['ContactId'];return db['sequelize'][_0x04f9('0x40')](_0x185404,{'type':db[_0x04f9('0x6f')][_0x04f9('0x70')][_0x04f9('0x71')],'raw':!![]})[_0x04f9('0x1f')](function(_0x5bf662){return _0x5bf662;});})['then'](function(_0x28c6f0){if(_0x28c6f0){_0x5166c5[_0x04f9('0x28')][_0x04f9('0x72')]=_0x28c6f0[0x0];if(!_0x33f203['body'][_0x04f9('0x61')])return;return db[_0x04f9('0x73')][_0x04f9('0x57')]({'where':{'id':_0x33f203[_0x04f9('0x59')]['UserId'],'role':_0x04f9('0x63')},'attributes':['id',_0x04f9('0x38'),_0x04f9('0x74'),_0x04f9('0x75'),'internal'],'raw':!![]});}return null;})[_0x04f9('0x1f')](function(_0x5dba0a){if(!_0x5dba0a)return null;_0x5166c5[_0x04f9('0x28')][_0x04f9('0x63')]=_0x5dba0a;return _0x5166c5;})['then'](function(_0x33d2d8){if(_0x33d2d8){if(_0x33f203['body']['manual']){_0x5166c5[_0x04f9('0x28')][_0x04f9('0x76')]=util['format'](_0x04f9('0x77'),_0x33f203['user'][_0x04f9('0x38')]);_0x5166c5['message'][_0x04f9('0x78')]=_0x5166c5[_0x04f9('0x78')];_0x5166c5[_0x04f9('0x28')]['motionChannel']=_0x5166c5['channel'];_0x5166c5[_0x04f9('0x28')][_0x04f9('0x79')]=_0x04f9('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x04f9('0x7a'),'message':_0x5166c5[_0x04f9('0x28')]},client9002)[_0x04f9('0x1f')](function(){return _0x5166c5;});}return _0x5166c5;}return null;})['then'](respondWithResult(_0x4b72af,null))['catch'](handleError(_0x4b72af,null));};var interaction_log=require('../../config/logger')(_0x04f9('0x5b'));exports[_0x04f9('0x33')]=function(_0x5dae60,_0x29deaf,_0x2ad4c9){var _0x4b8cc9={'agent':{},'channel':'fax'};if(_0x5dae60[_0x04f9('0x59')]['id']){delete _0x5dae60[_0x04f9('0x59')]['id'];}_0x5dae60[_0x04f9('0x59')][_0x04f9('0x61')]=_0x5dae60[_0x04f9('0x59')][_0x04f9('0x61')]||_0x5dae60[_0x04f9('0x62')]['id'];_0x4b8cc9[_0x04f9('0x63')]['id']=_0x5dae60[_0x04f9('0x59')][_0x04f9('0x61')];return db[_0x04f9('0x4f')][_0x04f9('0x57')]({'where':{'id':_0x5dae60[_0x04f9('0x58')]['id'],'UserId':null}})[_0x04f9('0x1f')](handleEntityNotFound(_0x29deaf,null))['then'](function(_0x1ebf80){if(_0x1ebf80){_0x4b8cc9[_0x04f9('0x28')]=_0x1ebf80[_0x04f9('0x64')]({'plain':!![]});return db[_0x04f9('0x65')][_0x04f9('0x57')]({'where':{'id':_0x1ebf80[_0x04f9('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x29deaf,null))['then'](function(_0x37db96){if(_0x37db96){_0x4b8cc9['interaction']=_0x37db96[_0x04f9('0x64')]({'plain':!![]});interaction_log[_0x04f9('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5dae60[_0x04f9('0x62')]['id'],_0x5dae60['user'][_0x04f9('0x38')],_0x5dae60['user'][_0x04f9('0x6b')],_0x4b8cc9[_0x04f9('0x69')]['id'],_0x5dae60['body']?JSON[_0x04f9('0x25')](_0x5dae60[_0x04f9('0x59')]):_0x04f9('0x6c'));return respondWithRpcPromise('RejectMessage',_0x04f9('0x7b'),_0x4b8cc9);}return null;})[_0x04f9('0x1f')](function(_0xfe7153){var _0x32f09b=_0x04f9('0x6e')+_0xfe7153[_0x04f9('0x28')][_0x04f9('0x7c')];return db[_0x04f9('0x7d')][_0x04f9('0x40')](_0x32f09b,{'type':db['Sequelize'][_0x04f9('0x70')][_0x04f9('0x71')],'raw':!![]})[_0x04f9('0x1f')](function(_0x56f275){return _0x56f275;});})[_0x04f9('0x1f')](function(_0x5b9ced){if(_0x5b9ced){_0x4b8cc9[_0x04f9('0x28')][_0x04f9('0x72')]=_0x5b9ced[0x0];if(!_0x5dae60[_0x04f9('0x59')]['UserId'])return;return db[_0x04f9('0x73')][_0x04f9('0x57')]({'where':{'id':_0x5dae60[_0x04f9('0x59')][_0x04f9('0x61')],'role':'agent'},'attributes':['id',_0x04f9('0x38'),_0x04f9('0x74'),_0x04f9('0x75'),_0x04f9('0x7e')],'raw':!![]});}return null;})[_0x04f9('0x1f')](function(_0x4d1487){if(!_0x4d1487)return null;_0x4b8cc9[_0x04f9('0x28')][_0x04f9('0x63')]=_0x4d1487;return _0x4b8cc9;})[_0x04f9('0x1f')](function(_0x41b524){if(_0x41b524){_0x41b524[_0x04f9('0x28')][_0x04f9('0x76')]=util[_0x04f9('0x60')](_0x04f9('0x77'),_0x5dae60[_0x04f9('0x62')][_0x04f9('0x38')]);_0x41b524[_0x04f9('0x28')][_0x04f9('0x78')]=_0x4b8cc9[_0x04f9('0x78')];_0x41b524['message'][_0x04f9('0x7f')]=_0x4b8cc9[_0x04f9('0x78')];_0x41b524[_0x04f9('0x28')][_0x04f9('0x79')]=_0x04f9('0x33');respondWithRpcPromise(_0x04f9('0x80'),_0x04f9('0x80'),{'event':_0x04f9('0x81'),'message':_0x41b524[_0x04f9('0x28')]},client9002);return _0x4b8cc9;}return null;})[_0x04f9('0x1f')](respondWithResult(_0x29deaf,null))[_0x04f9('0x52')](handleError(_0x29deaf,null));};exports['create']=function(_0xa158e7,_0x168738){var _0x2bff24;return db['FaxMessage'][_0x04f9('0x82')](_0xa158e7[_0x04f9('0x59')],{})[_0x04f9('0x1f')](function(_0x18b23b){_0x2bff24=_0x18b23b;return db[_0x04f9('0x83')]['findOne']({'where':{'id':_0x2bff24['ContactId']}});})['then'](function(_0x2bc78f){if(_[_0x04f9('0x67')](_0x2bc78f)){return;}else{_0x2bff24[_0x04f9('0x5d')]=_0x2bc78f[_0x04f9('0x5d')];return db[_0x04f9('0x84')][_0x04f9('0x85')]({'where':{'id':_0x2bff24[_0x04f9('0x86')]}});}})[_0x04f9('0x1f')](function(_0x4f99e8){return respondWithRpcPromise(_0x04f9('0x87'),_0x04f9('0x87'),{'FaxAccountId':_[_0x04f9('0x67')](_0xa158e7[_0x04f9('0x59')])?undefined:_0xa158e7['body'][_0x04f9('0x88')],'path':_[_0x04f9('0x67')](_0x4f99e8)?undefined:util[_0x04f9('0x60')](_0x04f9('0x89'),_0x4f99e8[_0x04f9('0x8a')]),'fax':_[_0x04f9('0x67')](_0x2bff24[_0x04f9('0x5d')])?undefined:_0x2bff24['fax'],'AttachmentId':_0x2bff24[_0x04f9('0x86')]},client9002);})[_0x04f9('0x1f')](respondWithResult(_0x168738,0xc9))[_0x04f9('0x52')](handleError(_0x168738,null));};exports[_0x04f9('0x8b')]=function(_0x2f93d4,_0x21f92a){var _0x192f82=path[_0x04f9('0x8c')](config[_0x04f9('0x8d')],_0x04f9('0x8e'),_0x04f9('0x8f'),_0x04f9('0x90'));return db['FaxMessage'][_0x04f9('0x57')]({'where':{'id':_0x2f93d4['params']['id']},'include':[{'model':db[_0x04f9('0x84')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x21f92a,null))['then'](function(_0x182d97){if(_0x182d97){return _0x21f92a[_0x04f9('0x8b')](path[_0x04f9('0x8c')](_0x192f82,_0x182d97['Attachment'][_0x04f9('0x8a')]));}})[_0x04f9('0x52')](handleError(_0x21f92a,null));}; \ No newline at end of file +var _0xe1ae=['FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','rejectMessage','User','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','FaxMessage','includeAll','include','show','params','keys','find','body','describe','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get'];(function(_0x2bafde,_0x39326c){var _0x5733dc=function(_0x3aa9a6){while(--_0x3aa9a6){_0x2bafde['push'](_0x2bafde['shift']());}};_0x5733dc(++_0x39326c);}(_0xe1ae,0x143));var _0xee1a=function(_0x13405d,_0xe260e2){_0x13405d=_0x13405d-0x0;var _0x486569=_0xe1ae[_0x13405d];return _0x486569;};'use strict';var emlformat=require(_0xee1a('0x0'));var rimraf=require(_0xee1a('0x1'));var zipdir=require(_0xee1a('0x2'));var jsonpatch=require(_0xee1a('0x3'));var rp=require(_0xee1a('0x4'));var moment=require(_0xee1a('0x5'));var BPromise=require(_0xee1a('0x6'));var Mustache=require(_0xee1a('0x7'));var util=require(_0xee1a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xee1a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee1a('0xa'));var _=require(_0xee1a('0xb'));var squel=require(_0xee1a('0xc'));var crypto=require(_0xee1a('0xd'));var jsforce=require(_0xee1a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee1a('0x9'));var querystring=require(_0xee1a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee1a('0x10'));var qs=require(_0xee1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee1a('0x12'));var logger=require(_0xee1a('0x13'))('api');var utils=require(_0xee1a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee1a('0x15'));var db=require(_0xee1a('0x16'))['db'];config[_0xee1a('0x17')]=_['defaults'](config[_0xee1a('0x17')],{'host':_0xee1a('0x18'),'port':0x18eb});var socket=require(_0xee1a('0x19'))(new Redis(config['redis']));require(_0xee1a('0x1a'))['register'](socket);var jayson=require(_0xee1a('0x1b'));var client=jayson[_0xee1a('0x1c')][_0xee1a('0x1d')]({'port':0x232c});var client9002=jayson[_0xee1a('0x1c')][_0xee1a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5c9082,_0x22e3d6,_0x5a4d1b,_0x4f5b8b){return new BPromise(function(_0x2f5283,_0x26b614){var _0x4d1983=_0x4f5b8b||client;return _0x4d1983[_0xee1a('0x1e')](_0x5c9082,_0x5a4d1b)[_0xee1a('0x1f')](function(_0x382f3f){logger[_0xee1a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x22e3d6,_0xee1a('0x21'));logger['debug'](_0xee1a('0x22'),_0x22e3d6,'request\x20sent',JSON[_0xee1a('0x23')](_0x382f3f));if(_0x382f3f[_0xee1a('0x24')]){if(_0x382f3f[_0xee1a('0x24')][_0xee1a('0x25')]===0x1f4){logger[_0xee1a('0x24')]('FaxMessage,\x20%s,\x20%s',_0x22e3d6,_0x382f3f[_0xee1a('0x24')][_0xee1a('0x26')]);return _0x26b614(_0x382f3f[_0xee1a('0x24')][_0xee1a('0x26')]);}logger[_0xee1a('0x24')](_0xee1a('0x27'),_0x22e3d6,_0x382f3f[_0xee1a('0x24')][_0xee1a('0x26')]);return _0x2f5283(_0x382f3f[_0xee1a('0x24')][_0xee1a('0x26')]);}else{logger[_0xee1a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x22e3d6,_0xee1a('0x21'));_0x2f5283(_0x382f3f[_0xee1a('0x28')][_0xee1a('0x26')]);}})[_0xee1a('0x29')](function(_0x4a59c1){logger['error'](_0xee1a('0x27'),_0x22e3d6,_0x4a59c1);_0x26b614(_0x4a59c1);});});}function respondWithStatusCode(_0x54c9af,_0x102046){_0x102046=_0x102046||0xcc;return function(_0x9ff751){if(_0x9ff751){return _0x54c9af['sendStatus'](_0x102046);}return _0x54c9af['status'](_0x102046)[_0xee1a('0x2a')]();};}function respondWithResult(_0x29a95e,_0x5a33f1){_0x5a33f1=_0x5a33f1||0xc8;return function(_0x424bf1){if(_0x424bf1){return _0x29a95e[_0xee1a('0x2b')](_0x5a33f1)['json'](_0x424bf1);}};}function respondWithFilteredResult(_0x136b8f,_0x20223e){return function(_0x4f2feb){if(_0x4f2feb){var _0x3db364=typeof _0x20223e[_0xee1a('0x2c')]===_0xee1a('0x2d')&&typeof _0x20223e['limit']===_0xee1a('0x2d');var _0x27d536=_0x4f2feb[_0xee1a('0x2e')];var _0x47a8ac=_0x3db364?0x0:_0x20223e[_0xee1a('0x2c')];var _0x3d08b1=_0x3db364?_0x4f2feb[_0xee1a('0x2e')]:_0x20223e[_0xee1a('0x2c')]+_0x20223e[_0xee1a('0x2f')];var _0x1d087f;if(_0x3d08b1>=_0x27d536){_0x3d08b1=_0x27d536;_0x1d087f=0xc8;}else{_0x1d087f=0xce;}_0x136b8f['status'](_0x1d087f);return _0x136b8f['set'](_0xee1a('0x30'),_0x47a8ac+'-'+_0x3d08b1+'/'+_0x27d536)[_0xee1a('0x31')](_0x4f2feb);}return null;};}function patchUpdates(_0x40b416){return function(_0xf770dc){try{jsonpatch[_0xee1a('0x32')](_0xf770dc,_0x40b416,!![]);}catch(_0x213151){return BPromise[_0xee1a('0x33')](_0x213151);}return _0xf770dc[_0xee1a('0x34')]();};}function saveUpdates(_0x40c596,_0x268583){return function(_0x5c4823){if(_0x5c4823){return _0x5c4823[_0xee1a('0x35')](_0x40c596)['then'](function(_0xdbee61){return _0xdbee61;});}return null;};}function removeEntity(_0x32634e,_0x50ddd9){return function(_0xa86bc7){if(_0xa86bc7){return _0xa86bc7[_0xee1a('0x36')]()[_0xee1a('0x1f')](function(){_0x32634e[_0xee1a('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a923,_0xb70fb7){return function(_0x233f42){if(!_0x233f42){_0x22a923['sendStatus'](0x194);}return _0x233f42;};}function handleError(_0x3a34fa,_0x3728ec){_0x3728ec=_0x3728ec||0x1f4;return function(_0x28f32e){logger[_0xee1a('0x24')](_0x28f32e[_0xee1a('0x37')]);if(_0x28f32e[_0xee1a('0x38')]){delete _0x28f32e[_0xee1a('0x38')];}_0x3a34fa[_0xee1a('0x2b')](_0x3728ec)[_0xee1a('0x39')](_0x28f32e);};}exports[_0xee1a('0x3a')]=function(_0x18ae20,_0x53de9e){var _0x48a074={},_0x3a5705={},_0x280391={'count':0x0,'rows':[]};var _0x2c19a1=_[_0xee1a('0x3b')](db['FaxMessage'][_0xee1a('0x3c')],function(_0x131beb){return{'name':_0x131beb[_0xee1a('0x3d')],'type':_0x131beb[_0xee1a('0x3e')][_0xee1a('0x3f')]};});_0x3a5705['model']=_[_0xee1a('0x3b')](_0x2c19a1,'name');_0x3a5705[_0xee1a('0x40')]=_['keys'](_0x18ae20[_0xee1a('0x40')]);_0x3a5705[_0xee1a('0x41')]=_[_0xee1a('0x42')](_0x3a5705[_0xee1a('0x43')],_0x3a5705['query']);_0x48a074[_0xee1a('0x44')]=_[_0xee1a('0x42')](_0x3a5705[_0xee1a('0x43')],qs[_0xee1a('0x45')](_0x18ae20[_0xee1a('0x40')][_0xee1a('0x45')]));_0x48a074['attributes']=_0x48a074[_0xee1a('0x44')][_0xee1a('0x46')]?_0x48a074[_0xee1a('0x44')]:_0x3a5705[_0xee1a('0x43')];if(!_0x18ae20[_0xee1a('0x40')][_0xee1a('0x47')](_0xee1a('0x48'))){_0x48a074[_0xee1a('0x2f')]=qs[_0xee1a('0x2f')](_0x18ae20[_0xee1a('0x40')][_0xee1a('0x2f')]);_0x48a074[_0xee1a('0x2c')]=qs[_0xee1a('0x2c')](_0x18ae20[_0xee1a('0x40')][_0xee1a('0x2c')]);}_0x48a074[_0xee1a('0x49')]=qs['sort'](_0x18ae20[_0xee1a('0x40')]['sort']);_0x48a074[_0xee1a('0x4a')]=qs[_0xee1a('0x41')](_[_0xee1a('0x4b')](_0x18ae20['query'],_0x3a5705[_0xee1a('0x41')]),_0x2c19a1);if(_0x18ae20[_0xee1a('0x40')][_0xee1a('0x4c')]){_0x48a074['where']=_[_0xee1a('0x4d')](_0x48a074[_0xee1a('0x4a')],{'$or':_[_0xee1a('0x3b')](_0x2c19a1,function(_0x1fce76){if(_0x1fce76[_0xee1a('0x3e')]!=='VIRTUAL'){var _0xc281b8={};_0xc281b8[_0x1fce76['name']]={'$like':'%'+_0x18ae20[_0xee1a('0x40')]['filter']+'%'};return _0xc281b8;}})});}_0x48a074=_[_0xee1a('0x4d')]({},_0x48a074,_0x18ae20[_0xee1a('0x4e')]);var _0x4610d6={'where':_0x48a074[_0xee1a('0x4a')]};return db[_0xee1a('0x4f')]['count'](_0x4610d6)['then'](function(_0x513d7d){_0x280391[_0xee1a('0x2e')]=_0x513d7d;if(_0x18ae20[_0xee1a('0x40')][_0xee1a('0x50')]){_0x48a074[_0xee1a('0x51')]=[{'all':!![]}];}return db[_0xee1a('0x4f')]['findAll'](_0x48a074);})[_0xee1a('0x1f')](function(_0x19a57e){_0x280391['rows']=_0x19a57e;return _0x280391;})['then'](respondWithFilteredResult(_0x53de9e,_0x48a074))[_0xee1a('0x29')](handleError(_0x53de9e,null));};exports[_0xee1a('0x52')]=function(_0x564c46,_0x48dc8b){var _0xde8da9={'raw':!![],'where':{'id':_0x564c46[_0xee1a('0x53')]['id']}},_0x25d03f={};_0x25d03f[_0xee1a('0x43')]=_[_0xee1a('0x54')](db[_0xee1a('0x4f')][_0xee1a('0x3c')]);_0x25d03f[_0xee1a('0x40')]=_[_0xee1a('0x54')](_0x564c46[_0xee1a('0x40')]);_0x25d03f['filters']=_[_0xee1a('0x42')](_0x25d03f[_0xee1a('0x43')],_0x25d03f[_0xee1a('0x40')]);_0xde8da9[_0xee1a('0x44')]=_['intersection'](_0x25d03f['model'],qs[_0xee1a('0x45')](_0x564c46[_0xee1a('0x40')][_0xee1a('0x45')]));_0xde8da9['attributes']=_0xde8da9[_0xee1a('0x44')][_0xee1a('0x46')]?_0xde8da9[_0xee1a('0x44')]:_0x25d03f[_0xee1a('0x43')];if(_0x564c46[_0xee1a('0x40')][_0xee1a('0x50')]){_0xde8da9['include']=[{'all':!![]}];}_0xde8da9=_[_0xee1a('0x4d')]({},_0xde8da9,_0x564c46[_0xee1a('0x4e')]);return db[_0xee1a('0x4f')][_0xee1a('0x55')](_0xde8da9)[_0xee1a('0x1f')](handleEntityNotFound(_0x48dc8b,null))[_0xee1a('0x1f')](respondWithResult(_0x48dc8b,null))['catch'](handleError(_0x48dc8b,null));};exports[_0xee1a('0x35')]=function(_0x2203e4,_0x33b4d2){if(_0x2203e4[_0xee1a('0x56')]['id']){delete _0x2203e4[_0xee1a('0x56')]['id'];}return db['FaxMessage'][_0xee1a('0x55')]({'where':{'id':_0x2203e4[_0xee1a('0x53')]['id']}})['then'](handleEntityNotFound(_0x33b4d2,null))['then'](saveUpdates(_0x2203e4[_0xee1a('0x56')],null))[_0xee1a('0x1f')](respondWithResult(_0x33b4d2,null))[_0xee1a('0x29')](handleError(_0x33b4d2,null));};exports['destroy']=function(_0x47890a,_0x355246){return db[_0xee1a('0x4f')][_0xee1a('0x55')]({'where':{'id':_0x47890a[_0xee1a('0x53')]['id']}})[_0xee1a('0x1f')](handleEntityNotFound(_0x355246,null))[_0xee1a('0x1f')](removeEntity(_0x355246,null))[_0xee1a('0x29')](handleError(_0x355246,null));};exports[_0xee1a('0x57')]=function(_0x29b9d6,_0x4be21a){return db[_0xee1a('0x4f')][_0xee1a('0x57')]()[_0xee1a('0x1f')](respondWithResult(_0x4be21a,null))[_0xee1a('0x29')](handleError(_0x4be21a,null));};var interaction_log=require(_0xee1a('0x13'))('fax-interactions');exports[_0xee1a('0x58')]=function(_0x40fc65,_0x1d9d70,_0x5c22cf){var _0x4768ca={'agent':{},'channel':_0xee1a('0x59')};if(_0x40fc65[_0xee1a('0x56')]['id']){delete _0x40fc65[_0xee1a('0x56')]['id'];}_0x40fc65[_0xee1a('0x56')]['read']=!![];_0x40fc65['body'][_0xee1a('0x5a')]=moment()[_0xee1a('0x5b')](_0xee1a('0x5c'));_0x40fc65['body']['UserId']=_0x40fc65[_0xee1a('0x56')]['UserId']||_0x40fc65[_0xee1a('0x5d')]['id'];_0x4768ca[_0xee1a('0x5e')]['id']=_0x40fc65['body'][_0xee1a('0x5f')];return db[_0xee1a('0x4f')]['find']({'where':{'id':_0x40fc65['params']['id'],'UserId':null}})[_0xee1a('0x1f')](handleEntityNotFound(_0x1d9d70,null))[_0xee1a('0x1f')](saveUpdates(_0x40fc65[_0xee1a('0x56')],null))['then'](function(_0x4b5fe9){if(_0x4b5fe9){_0x4768ca[_0xee1a('0x26')]=_0x4b5fe9[_0xee1a('0x60')]({'plain':!![]});return db[_0xee1a('0x61')][_0xee1a('0x55')]({'where':{'id':_0x4b5fe9[_0xee1a('0x62')]}});}return null;})[_0xee1a('0x1f')](handleEntityNotFound(_0x1d9d70,null))[_0xee1a('0x1f')](function(_0x5e84fb){if(_0x5e84fb){return _0x5e84fb[_0xee1a('0x35')]({'UserId':_0x40fc65[_0xee1a('0x56')]['UserId'],'read1stAt':_[_0xee1a('0x63')](_0x5e84fb[_0xee1a('0x64')])?moment()['format'](_0xee1a('0x5c')):undefined});}return null;})[_0xee1a('0x1f')](function(_0x376913){if(_0x376913){_0x4768ca['interaction']=_0x376913['get']({'plain':!![]});interaction_log[_0xee1a('0x20')](_0xee1a('0x65'),_0x40fc65[_0xee1a('0x5d')]['id'],_0x40fc65['user'][_0xee1a('0x38')],_0x40fc65[_0xee1a('0x5d')][_0xee1a('0x66')],_0x4768ca[_0xee1a('0x67')]['id'],_0x40fc65[_0xee1a('0x56')]?JSON[_0xee1a('0x23')](_0x40fc65[_0xee1a('0x56')]):_0xee1a('0x68'));return respondWithRpcPromise(_0xee1a('0x69'),_0xee1a('0x6a'),_0x4768ca);}return null;})[_0xee1a('0x1f')](function(_0x3798d4){var _0x151125=_0xee1a('0x6b')+_0x3798d4['message'][_0xee1a('0x6c')];return db[_0xee1a('0x6d')][_0xee1a('0x40')](_0x151125,{'type':db[_0xee1a('0x6e')][_0xee1a('0x6f')][_0xee1a('0x70')],'raw':!![]})['then'](function(_0x95955){return _0x95955;});})[_0xee1a('0x1f')](function(_0x5c1748){if(_0x5c1748){_0x4768ca[_0xee1a('0x26')][_0xee1a('0x71')]=_0x5c1748[0x0];if(!_0x40fc65['body'][_0xee1a('0x5f')])return;return db['User'][_0xee1a('0x55')]({'where':{'id':_0x40fc65[_0xee1a('0x56')][_0xee1a('0x5f')],'role':'agent'},'attributes':['id',_0xee1a('0x38'),_0xee1a('0x72'),_0xee1a('0x73'),_0xee1a('0x74')],'raw':!![]});}return null;})[_0xee1a('0x1f')](function(_0x48db46){if(!_0x48db46)return null;_0x4768ca[_0xee1a('0x26')]['agent']=_0x48db46;return _0x4768ca;})['then'](function(_0x9def31){if(_0x9def31){if(_0x40fc65[_0xee1a('0x56')][_0xee1a('0x75')]){_0x4768ca['message'][_0xee1a('0x76')]=util['format'](_0xee1a('0x77'),_0x40fc65[_0xee1a('0x5d')][_0xee1a('0x38')]);_0x4768ca[_0xee1a('0x26')]['channel']=_0x4768ca[_0xee1a('0x78')];_0x4768ca['message'][_0xee1a('0x79')]=_0x4768ca['channel'];_0x4768ca[_0xee1a('0x26')][_0xee1a('0x7a')]=_0xee1a('0x58');return respondWithRpcPromise(_0xee1a('0x7b'),_0xee1a('0x7b'),{'event':_0xee1a('0x7c'),'message':_0x4768ca['message']},client9002)[_0xee1a('0x1f')](function(){return _0x4768ca;});}return _0x4768ca;}return null;})[_0xee1a('0x1f')](respondWithResult(_0x1d9d70,null))['catch'](handleError(_0x1d9d70,null));};var interaction_log=require(_0xee1a('0x13'))(_0xee1a('0x7d'));exports[_0xee1a('0x33')]=function(_0x7d4261,_0x2bd732,_0x44df14){var _0x5152bc={'agent':{},'channel':_0xee1a('0x59')};if(_0x7d4261[_0xee1a('0x56')]['id']){delete _0x7d4261[_0xee1a('0x56')]['id'];}_0x7d4261[_0xee1a('0x56')][_0xee1a('0x5f')]=_0x7d4261[_0xee1a('0x56')]['UserId']||_0x7d4261[_0xee1a('0x5d')]['id'];_0x5152bc['agent']['id']=_0x7d4261[_0xee1a('0x56')]['UserId'];return db[_0xee1a('0x4f')]['find']({'where':{'id':_0x7d4261[_0xee1a('0x53')]['id'],'UserId':null}})[_0xee1a('0x1f')](handleEntityNotFound(_0x2bd732,null))[_0xee1a('0x1f')](function(_0x4aa6be){if(_0x4aa6be){_0x5152bc[_0xee1a('0x26')]=_0x4aa6be[_0xee1a('0x60')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4aa6be[_0xee1a('0x62')]}});}return null;})[_0xee1a('0x1f')](handleEntityNotFound(_0x2bd732,null))[_0xee1a('0x1f')](function(_0x26ef79){if(_0x26ef79){_0x5152bc['interaction']=_0x26ef79[_0xee1a('0x60')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7d4261[_0xee1a('0x5d')]['id'],_0x7d4261[_0xee1a('0x5d')][_0xee1a('0x38')],_0x7d4261['user']['role'],_0x5152bc['interaction']['id'],_0x7d4261[_0xee1a('0x56')]?JSON['stringify'](_0x7d4261['body']):_0xee1a('0x68'));return respondWithRpcPromise('RejectMessage',_0xee1a('0x7e'),_0x5152bc);}return null;})[_0xee1a('0x1f')](function(_0x1368f2){var _0x3cfdf=_0xee1a('0x6b')+_0x1368f2['message'][_0xee1a('0x6c')];return db[_0xee1a('0x6d')][_0xee1a('0x40')](_0x3cfdf,{'type':db[_0xee1a('0x6e')][_0xee1a('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x23b0f6){return _0x23b0f6;});})['then'](function(_0x508298){if(_0x508298){_0x5152bc[_0xee1a('0x26')][_0xee1a('0x71')]=_0x508298[0x0];if(!_0x7d4261[_0xee1a('0x56')][_0xee1a('0x5f')])return;return db[_0xee1a('0x7f')][_0xee1a('0x55')]({'where':{'id':_0x7d4261[_0xee1a('0x56')][_0xee1a('0x5f')],'role':_0xee1a('0x5e')},'attributes':['id','name',_0xee1a('0x72'),_0xee1a('0x73'),_0xee1a('0x74')],'raw':!![]});}return null;})[_0xee1a('0x1f')](function(_0x220c61){if(!_0x220c61)return null;_0x5152bc[_0xee1a('0x26')][_0xee1a('0x5e')]=_0x220c61;return _0x5152bc;})[_0xee1a('0x1f')](function(_0x3611b4){if(_0x3611b4){_0x3611b4[_0xee1a('0x26')][_0xee1a('0x76')]=util[_0xee1a('0x5b')](_0xee1a('0x77'),_0x7d4261[_0xee1a('0x5d')][_0xee1a('0x38')]);_0x3611b4['message'][_0xee1a('0x78')]=_0x5152bc[_0xee1a('0x78')];_0x3611b4['message'][_0xee1a('0x79')]=_0x5152bc['channel'];_0x3611b4[_0xee1a('0x26')][_0xee1a('0x7a')]=_0xee1a('0x33');respondWithRpcPromise('EventManager',_0xee1a('0x7b'),{'event':_0xee1a('0x80'),'message':_0x3611b4['message']},client9002);return _0x5152bc;}return null;})[_0xee1a('0x1f')](respondWithResult(_0x2bd732,null))[_0xee1a('0x29')](handleError(_0x2bd732,null));};exports[_0xee1a('0x81')]=function(_0x208fd3,_0x57354b){var _0x591db2;return db['FaxMessage'][_0xee1a('0x81')](_0x208fd3['body'],{})[_0xee1a('0x1f')](function(_0x52467c){_0x591db2=_0x52467c;return db[_0xee1a('0x82')]['findOne']({'where':{'id':_0x591db2['ContactId']}});})['then'](function(_0x24cda0){if(_['isNil'](_0x24cda0)){return;}else{_0x591db2[_0xee1a('0x59')]=_0x24cda0[_0xee1a('0x59')];return db[_0xee1a('0x83')][_0xee1a('0x84')]({'where':{'id':_0x591db2[_0xee1a('0x85')]}});}})[_0xee1a('0x1f')](function(_0x4b0741){return respondWithRpcPromise(_0xee1a('0x86'),_0xee1a('0x86'),{'FaxAccountId':_['isNil'](_0x208fd3[_0xee1a('0x56')])?undefined:_0x208fd3[_0xee1a('0x56')]['FaxAccountId'],'path':_[_0xee1a('0x63')](_0x4b0741)?undefined:util[_0xee1a('0x5b')](_0xee1a('0x87'),_0x4b0741[_0xee1a('0x88')]),'fax':_[_0xee1a('0x63')](_0x591db2['fax'])?undefined:_0x591db2['fax'],'AttachmentId':_0x591db2[_0xee1a('0x85')]},client9002);})['then'](respondWithResult(_0x57354b,0xc9))['catch'](handleError(_0x57354b,null));};exports[_0xee1a('0x89')]=function(_0x4dbd3d,_0x2398a4){var _0xdbc891=path['join'](config['root'],_0xee1a('0x8a'),_0xee1a('0x8b'),'attachments');return db[_0xee1a('0x4f')][_0xee1a('0x55')]({'where':{'id':_0x4dbd3d[_0xee1a('0x53')]['id']},'include':[{'model':db[_0xee1a('0x83')],'as':_0xee1a('0x83')}]})['then'](handleEntityNotFound(_0x2398a4,null))['then'](function(_0x55b0b0){if(_0x55b0b0){return _0x2398a4['download'](path['join'](_0xdbc891,_0x55b0b0[_0xee1a('0x83')]['basename']));}})[_0xee1a('0x29')](handleError(_0x2398a4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b537864..95c5b59 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 _0xa809=['save','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa809,0x1f3));var _0x9a80=function(_0x2cdc12,_0x56506c){_0x2cdc12=_0x2cdc12-0x0;var _0xb51617=_0xa809[_0x2cdc12];return _0xb51617;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x9a80('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a80('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5e516a){return function(_0x2b07d5,_0x1f3715,_0x183098){FaxMessageEvents[_0x9a80('0x2')](_0x5e516a+':'+_0x2b07d5['id'],_0x2b07d5);FaxMessageEvents['emit'](_0x5e516a,_0x2b07d5);_0x183098(null);};}for(var e in events){if(events[_0x9a80('0x3')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x9a80('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0x1267=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1267,0xb5));var _0x7126=function(_0x50667b,_0x314100){_0x50667b=_0x50667b-0x0;var _0x2e875b=_0x1267[_0x50667b];return _0x2e875b;};'use strict';var EventEmitter=require(_0x7126('0x0'));var FaxMessage=require(_0x7126('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7126('0x2'),'afterUpdate':_0x7126('0x3'),'afterDestroy':_0x7126('0x4')};function emitEvent(_0x3587d0){return function(_0x35f8e5,_0x403ed4,_0x4346f7){FaxMessageEvents['emit'](_0x3587d0+':'+_0x35f8e5['id'],_0x35f8e5);FaxMessageEvents[_0x7126('0x5')](_0x3587d0,_0x35f8e5);_0x4346f7(null);};}for(var e in events){if(events[_0x7126('0x6')](e)){var event=events[e];FaxMessage[_0x7126('0x7')](e,emitEvent(event));}}module[_0x7126('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a9dc2a4..74474ef 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 _0xd89c=['update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','models','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xd89c,0xed));var _0xcd89=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xd89c[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xcd89('0x0'));var util=require(_0xcd89('0x1'));var logger=require(_0xcd89('0x2'))(_0xcd89('0x3'));var moment=require(_0xcd89('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd89('0x6'));var config=require(_0xcd89('0x7'));var attributes=require(_0xcd89('0x8'));module['exports']=function(_0x533685,_0x296645){return _0x533685[_0xcd89('0x9')](_0xcd89('0xa'),attributes,{'tableName':_0xcd89('0xb'),'paranoid':![],'indexes':[{'name':_0xcd89('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41ea37,_0x2f7b6c,_0x2a57b9){var _0x16e50a=_0x533685[_0xcd89('0xd')];var _0xf5625b=_0x41ea37[_0xcd89('0xe')]({'plain':!![]});if(_0xf5625b[_0xcd89('0xf')][_0xcd89('0x10')]()==='in'||_0xf5625b[_0xcd89('0xf')][_0xcd89('0x10')]()===_0xcd89('0x11')&&!_0xf5625b[_0xcd89('0x12')]&&!_[_0xcd89('0x13')](_0xf5625b['UserId'])){_0x16e50a[_0xcd89('0x14')][_0xcd89('0x15')]({'where':{'id':_0xf5625b[_0xcd89('0x16')]}})[_0xcd89('0x17')](function(_0xfdde45){if(_0xfdde45){_0xfdde45[_0xcd89('0x18')]({'lastMsgAt':_0xf5625b[_0xcd89('0x19')],'lastMsgDirection':_0xf5625b['direction'][_0xcd89('0x10')]()});}})[_0xcd89('0x1a')](function(_0x5d84b8){console[_0xcd89('0x1b')](_0x5d84b8);});}_0x2a57b9();}},'charset':_0xcd89('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5e78=['../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4ca68e,_0x312673){var _0xefc153=function(_0xfd620e){while(--_0xfd620e){_0x4ca68e['push'](_0x4ca68e['shift']());}};_0xefc153(++_0x312673);}(_0x5e78,0xad));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85e7('0x0'));var util=require(_0x85e7('0x1'));var logger=require(_0x85e7('0x2'))(_0x85e7('0x3'));var moment=require('moment');var BPromise=require(_0x85e7('0x4'));var rp=require(_0x85e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85e7('0x6'));var config=require(_0x85e7('0x7'));var attributes=require(_0x85e7('0x8'));module[_0x85e7('0x9')]=function(_0x16a183,_0x329eae){return _0x16a183[_0x85e7('0xa')](_0x85e7('0xb'),attributes,{'tableName':_0x85e7('0xc'),'paranoid':![],'indexes':[{'name':_0x85e7('0xd'),'fields':['body'],'type':_0x85e7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a9c69,_0x39c9b4,_0x35e53a){var _0x5add18=_0x16a183[_0x85e7('0xf')];var _0x39511a=_0x3a9c69[_0x85e7('0x10')]({'plain':!![]});if(_0x39511a[_0x85e7('0x11')]['toLowerCase']()==='in'||_0x39511a['direction'][_0x85e7('0x12')]()===_0x85e7('0x13')&&!_0x39511a[_0x85e7('0x14')]&&!_[_0x85e7('0x15')](_0x39511a[_0x85e7('0x16')])){_0x5add18[_0x85e7('0x17')][_0x85e7('0x18')]({'where':{'id':_0x39511a[_0x85e7('0x19')]}})[_0x85e7('0x1a')](function(_0x57968d){if(_0x57968d){_0x57968d[_0x85e7('0x1b')]({'lastMsgAt':_0x39511a['createdAt'],'lastMsgDirection':_0x39511a[_0x85e7('0x11')][_0x85e7('0x12')]()});}})[_0x85e7('0x1c')](function(_0x38cc13){console['error'](_0x38cc13);});}_0x35e53a();}},'charset':_0x85e7('0x1d'),'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 19635f3..72351f5 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 _0x0e85=['catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result'];(function(_0x2cda87,_0x56e5d3){var _0x4b6ff9=function(_0x576342){while(--_0x576342){_0x2cda87['push'](_0x2cda87['shift']());}};_0x4b6ff9(++_0x56e5d3);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});config['redis']=_[_0x50e8('0x9')](config[_0x50e8('0xa')],{'host':_0x50e8('0xb'),'port':0x18eb});var socket=require(_0x50e8('0xc'))(new Redis(config[_0x50e8('0xa')]));require(_0x50e8('0xd'))['register'](socket);function respondWithRpcPromise(_0x11717c,_0x228ed1,_0x19d1bc){return new BPromise(function(_0x2d4750,_0x154b9e){return client[_0x50e8('0xe')](_0x11717c,_0x19d1bc)[_0x50e8('0xf')](function(_0x3d25ea){logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));logger[_0x50e8('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x228ed1,'request\x20sent',JSON[_0x50e8('0x12')](_0x3d25ea));if(_0x3d25ea[_0x50e8('0x13')]){if(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x14')]===0x1f4){logger['error'](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x154b9e(_0x3d25ea['error']['message']);}logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x2d4750(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));_0x2d4750(_0x3d25ea[_0x50e8('0x17')][_0x50e8('0x16')]);}})[_0x50e8('0x18')](function(_0x5dae4e){logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x5dae4e);_0x154b9e(_0x5dae4e);});});}exports['CreateFaxMessage']=function(_0x415596){var _0x55997c=this;return new Promise(function(_0x4d2318,_0xe04a5c){return db[_0x50e8('0x19')][_0x50e8('0x1a')](_0x415596[_0x50e8('0x1b')],{'raw':_0x415596['options']?_0x415596[_0x50e8('0x1c')][_0x50e8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x31d23c){logger[_0x50e8('0x1e')]('CreateFaxMessage',_0x415596);logger[_0x50e8('0x11')](_0x50e8('0x1f'),_0x415596,JSON['stringify'](_0x31d23c));_0x4d2318(_0x31d23c);})['catch'](function(_0x59582d){logger[_0x50e8('0x13')](_0x50e8('0x1f'),_0x59582d[_0x50e8('0x16')],_0x415596);_0xe04a5c(_0x55997c[_0x50e8('0x13')](0x1f4,_0x59582d[_0x50e8('0x16')]));});});};exports[_0x50e8('0x20')]=function(_0x53d848){var _0x3a6442=this;return new Promise(function(_0x396611,_0x4b3a09){return db[_0x50e8('0x19')][_0x50e8('0x21')](_0x53d848[_0x50e8('0x1b')],{'raw':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d848['options']?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x22')]||null:null,'attributes':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x23')]||null:null,'limit':_0x53d848[_0x50e8('0x1c')]?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x24')]||null:null})[_0x50e8('0xf')](function(_0x18aa31){logger[_0x50e8('0x1e')]('UpdateFaxMessage',_0x53d848);logger[_0x50e8('0x11')](_0x50e8('0x20'),_0x53d848,JSON['stringify'](_0x18aa31));_0x396611(_0x18aa31);})['catch'](function(_0x329b9c){logger[_0x50e8('0x13')](_0x50e8('0x20'),_0x329b9c['message'],_0x53d848);_0x4b3a09(_0x3a6442['error'](0x1f4,_0x329b9c[_0x50e8('0x16')]));});});}; \ No newline at end of file +var _0x70e0=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','stringify','catch','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x19a631,_0x2bcdbe){var _0x590361=function(_0x268428){while(--_0x268428){_0x19a631['push'](_0x19a631['shift']());}};_0x590361(++_0x2bcdbe);}(_0x70e0,0x17b));var _0x070e=function(_0x2fb172,_0x45667f){_0x2fb172=_0x2fb172-0x0;var _0x10bff4=_0x70e0[_0x2fb172];return _0x10bff4;};'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});config['redis']=_['defaults'](config[_0x070e('0x9')],{'host':_0x070e('0xa'),'port':0x18eb});var socket=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x9')]));require(_0x070e('0xc'))[_0x070e('0xd')](socket);function respondWithRpcPromise(_0x11ffa8,_0x4e99e6,_0x49b2fb){return new BPromise(function(_0x50f4eb,_0x2e3e5e){return client[_0x070e('0xe')](_0x11ffa8,_0x49b2fb)[_0x070e('0xf')](function(_0xa927a2){logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));logger[_0x070e('0x13')](_0x070e('0x14'),_0x4e99e6,_0x070e('0x12'),JSON['stringify'](_0xa927a2));if(_0xa927a2['error']){if(_0xa927a2[_0x070e('0x15')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x2e3e5e(_0xa927a2['error']['message']);}logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x50f4eb(_0xa927a2['error']['message']);}else{logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));_0x50f4eb(_0xa927a2[_0x070e('0x17')][_0x070e('0x16')]);}})['catch'](function(_0x3938b5){logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0x3938b5);_0x2e3e5e(_0x3938b5);});});}exports[_0x070e('0x18')]=function(_0x259893){var _0x5c16fd=this;return new Promise(function(_0x5b2f48,_0x4e958f){return db[_0x070e('0x19')][_0x070e('0x1a')](_0x259893[_0x070e('0x1b')],{'raw':_0x259893['options']?_0x259893[_0x070e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x070e('0xf')](function(_0x3f6985){logger[_0x070e('0x10')](_0x070e('0x18'),_0x259893);logger[_0x070e('0x13')](_0x070e('0x18'),_0x259893,JSON[_0x070e('0x1d')](_0x3f6985));_0x5b2f48(_0x3f6985);})[_0x070e('0x1e')](function(_0x595c7e){logger[_0x070e('0x15')](_0x070e('0x18'),_0x595c7e[_0x070e('0x16')],_0x259893);_0x4e958f(_0x5c16fd['error'](0x1f4,_0x595c7e[_0x070e('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x4a2dbd){var _0x2ccbd7=this;return new Promise(function(_0x25f6e,_0x41deb1){return db[_0x070e('0x19')][_0x070e('0x1f')](_0x4a2dbd['body'],{'raw':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x21')]||null:null,'attributes':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')]['attributes']||null:null,'limit':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x22')]||null:null})['then'](function(_0x5c5f0d){logger[_0x070e('0x10')](_0x070e('0x23'),_0x4a2dbd);logger[_0x070e('0x13')]('UpdateFaxMessage',_0x4a2dbd,JSON[_0x070e('0x1d')](_0x5c5f0d));_0x25f6e(_0x5c5f0d);})[_0x070e('0x1e')](function(_0x3a9425){logger[_0x070e('0x15')]('UpdateFaxMessage',_0x3a9425['message'],_0x4a2dbd);_0x41deb1(_0x2ccbd7['error'](0x1f4,_0x3a9425['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8c80bf4..a9091d9 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 _0xae73=['update','register','faxMessage:','./faxMessage.events','remove'];(function(_0xa99357,_0x50ffad){var _0x111875=function(_0x4dce0c){while(--_0x4dce0c){_0xa99357['push'](_0xa99357['shift']());}};_0x111875(++_0x50ffad);}(_0xae73,0x16b));var _0x3ae7=function(_0x58916b,_0x43fc5d){_0x58916b=_0x58916b-0x0;var _0x238322=_0xae73[_0x58916b];return _0x238322;};'use strict';var FaxMessageEvents=require(_0x3ae7('0x0'));var events=['save',_0x3ae7('0x1'),_0x3ae7('0x2')];function createListener(_0x529a65,_0x52118c){return function(_0x4aad77){_0x52118c['emit'](_0x529a65,_0x4aad77);};}function removeListener(_0xf6b6d2,_0x5c4a37){return function(){FaxMessageEvents['removeListener'](_0xf6b6d2,_0x5c4a37);};}exports[_0x3ae7('0x3')]=function(_0x5d5fca){for(var _0xa7dce0=0x0,_0x2ff1bb=events['length'];_0xa7dce0<_0x2ff1bb;_0xa7dce0++){var _0x1b53b8=events[_0xa7dce0];var _0x4faa47=createListener(_0x3ae7('0x4')+_0x1b53b8,_0x5d5fca);FaxMessageEvents['on'](_0x1b53b8,_0x4faa47);}}; \ No newline at end of file +var _0xe625=['update','removeListener','length','faxMessage:','./faxMessage.events','remove'];(function(_0x49d813,_0x232fe1){var _0x54a154=function(_0x352e8a){while(--_0x352e8a){_0x49d813['push'](_0x49d813['shift']());}};_0x54a154(++_0x232fe1);}(_0xe625,0x1ae));var _0x5e62=function(_0x1a4354,_0x3903d0){_0x1a4354=_0x1a4354-0x0;var _0x3bb560=_0xe625[_0x1a4354];return _0x3bb560;};'use strict';var FaxMessageEvents=require(_0x5e62('0x0'));var events=['save',_0x5e62('0x1'),_0x5e62('0x2')];function createListener(_0x34787b,_0x2b800f){return function(_0x250c74){_0x2b800f['emit'](_0x34787b,_0x250c74);};}function removeListener(_0x7d9051,_0x2c656e){return function(){FaxMessageEvents[_0x5e62('0x3')](_0x7d9051,_0x2c656e);};}exports['register']=function(_0x440967){for(var _0x45d46b=0x0,_0x3d4b27=events[_0x5e62('0x4')];_0x45d46b<_0x3d4b27;_0x45d46b++){var _0x450f30=events[_0x45d46b];var _0x4e003a=createListener(_0x5e62('0x5')+_0x450f30,_0x440967);FaxMessageEvents['on'](_0x450f30,_0x4e003a);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 027c8c8..6501837 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 _0xfe57=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','show','download','faxmessage:create','create','put','/:id','update','/:id/reject','reject','destroy','exports','multer','util','express'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xfe57,0x195));var _0x7fe5=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0xfe57[_0x175a55];return _0x167adf;};'use strict';var multer=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fe5('0x2'));var router=express[_0x7fe5('0x3')]();var fs_extra=require(_0x7fe5('0x4'));var auth=require(_0x7fe5('0x5'));var interaction=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var controller=require(_0x7fe5('0x8'));router[_0x7fe5('0x9')]('/',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xb')]);router[_0x7fe5('0x9')](_0x7fe5('0xc'),auth[_0x7fe5('0xa')](),controller['describe']);router[_0x7fe5('0x9')]('/:id',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xd')]);router['get']('/:id/download',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xe')]);router['post']('/',auth[_0x7fe5('0xa')](),interaction['tracked']('fax',_0x7fe5('0xf')),controller[_0x7fe5('0x10')]);router[_0x7fe5('0x11')](_0x7fe5('0x12'),auth['isAuthenticated'](),controller[_0x7fe5('0x13')]);router[_0x7fe5('0x11')]('/:id/accept',auth[_0x7fe5('0xa')](),controller['accept']);router[_0x7fe5('0x11')](_0x7fe5('0x14'),auth['isAuthenticated'](),controller[_0x7fe5('0x15')]);router['delete'](_0x7fe5('0x12'),auth[_0x7fe5('0xa')](),controller[_0x7fe5('0x16')]);module[_0x7fe5('0x17')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5efc58,_0x3686b2){var _0x7bd07=function(_0x281730){while(--_0x281730){_0x5efc58['push'](_0x5efc58['shift']());}};_0x7bd07(++_0x3686b2);}(_0x0fd9,0xa3));var _0x90fd=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x0fd9[_0x11deef];return _0xe9ba85;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 24e4590..a6360a9 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 _0x336e=['ENUM','rrmemory','beepall','roundrobin','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x336e,0xad));var _0xe336=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x336e[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe336('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe336('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe336('0x1')](_0xe336('0x2'),_0xe336('0x3'),_0xe336('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe336('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa742=['STRING','rrmemory','roundrobin','INTEGER','name'];(function(_0x2b3100,_0x345565){var _0x59bb19=function(_0x34a393){while(--_0x34a393){_0x2b3100['push'](_0x2b3100['shift']());}};_0x59bb19(++_0x345565);}(_0xa742,0xc7));var _0x2a74=function(_0x34937d,_0x284d9a){_0x34937d=_0x34937d-0x0;var _0x20c992=_0xa742[_0x34937d];return _0x20c992;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2a74('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a74('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2a74('0x2'),'beepall',_0x2a74('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2a74('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ba50a8f..b4492bb 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 _0x812b=['includes','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','FaxQueue','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','describe','findOne','rawAttributes','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','Agents','interface','flatMap','sequelize','each','UserFaxQueue','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId'];(function(_0x1a7536,_0x30c791){var _0x4660d9=function(_0x1db222){while(--_0x1db222){_0x1a7536['push'](_0x1a7536['shift']());}};_0x4660d9(++_0x30c791);}(_0x812b,0xa0));var _0xb812=function(_0x1730dd,_0x3cacb2){_0x1730dd=_0x1730dd-0x0;var _0x15a53c=_0x812b[_0x1730dd];return _0x15a53c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb812('0x0'));var zipdir=require(_0xb812('0x1'));var jsonpatch=require(_0xb812('0x2'));var rp=require(_0xb812('0x3'));var moment=require(_0xb812('0x4'));var BPromise=require(_0xb812('0x5'));var Mustache=require(_0xb812('0x6'));var util=require(_0xb812('0x7'));var path=require(_0xb812('0x8'));var sox=require(_0xb812('0x9'));var csv=require(_0xb812('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb812('0xb'));var _=require(_0xb812('0xc'));var squel=require('squel');var crypto=require(_0xb812('0xd'));var jsforce=require(_0xb812('0xe'));var deskjs=require(_0xb812('0xf'));var toCsv=require(_0xb812('0xa'));var querystring=require(_0xb812('0x10'));var Papa=require(_0xb812('0x11'));var Redis=require(_0xb812('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb812('0x13'));var as=require(_0xb812('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb812('0x15'))(_0xb812('0x16'));var utils=require(_0xb812('0x17'));var config=require(_0xb812('0x18'));var licenseUtil=require(_0xb812('0x19'));var db=require(_0xb812('0x1a'))['db'];config[_0xb812('0x1b')]=_[_0xb812('0x1c')](config[_0xb812('0x1b')],{'host':_0xb812('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb812('0x1b')]));require(_0xb812('0x1e'))[_0xb812('0x1f')](socket);function respondWithStatusCode(_0x3f5c60,_0x3263aa){_0x3263aa=_0x3263aa||0xcc;return function(_0xfad38e){if(_0xfad38e){return _0x3f5c60[_0xb812('0x20')](_0x3263aa);}return _0x3f5c60['status'](_0x3263aa)[_0xb812('0x21')]();};}function respondWithResult(_0x4e6104,_0x1ac947){_0x1ac947=_0x1ac947||0xc8;return function(_0x5cb159){if(_0x5cb159){return _0x4e6104[_0xb812('0x22')](_0x1ac947)[_0xb812('0x23')](_0x5cb159);}};}function respondWithFilteredResult(_0x4a696f,_0x305ef0){return function(_0x4f48f8){if(_0x4f48f8){var _0x4fc964=typeof _0x305ef0[_0xb812('0x24')]===_0xb812('0x25')&&typeof _0x305ef0[_0xb812('0x26')]===_0xb812('0x25');var _0x229c0d=_0x4f48f8[_0xb812('0x27')];var _0x40f323=_0x4fc964?0x0:_0x305ef0[_0xb812('0x24')];var _0x46f946=_0x4fc964?_0x4f48f8[_0xb812('0x27')]:_0x305ef0[_0xb812('0x24')]+_0x305ef0[_0xb812('0x26')];var _0x4c26b2;if(_0x46f946>=_0x229c0d){_0x46f946=_0x229c0d;_0x4c26b2=0xc8;}else{_0x4c26b2=0xce;}_0x4a696f[_0xb812('0x22')](_0x4c26b2);return _0x4a696f[_0xb812('0x28')]('Content-Range',_0x40f323+'-'+_0x46f946+'/'+_0x229c0d)[_0xb812('0x23')](_0x4f48f8);}return null;};}function patchUpdates(_0x457bca){return function(_0x1b3de2){try{jsonpatch[_0xb812('0x29')](_0x1b3de2,_0x457bca,!![]);}catch(_0x2f4067){return BPromise[_0xb812('0x2a')](_0x2f4067);}return _0x1b3de2[_0xb812('0x2b')]();};}function saveUpdates(_0x382ac1,_0x4005ee){return function(_0x45ffc9){if(_0x45ffc9){return _0x45ffc9[_0xb812('0x2c')](_0x382ac1)[_0xb812('0x2d')](function(_0x55906d){return _0x55906d;});}return null;};}function removeEntity(_0x2c854a,_0x152dec){return function(_0x3848cf){if(_0x3848cf){return _0x3848cf[_0xb812('0x2e')]()['then'](function(){var _0x2c4da6=_0x3848cf[_0xb812('0x2f')]({'plain':!![]});var _0x4dc87a=_0xb812('0x30');return db[_0xb812('0x31')][_0xb812('0x2e')]({'where':{'type':_0x4dc87a,'resourceId':_0x2c4da6['id']}})['then'](function(){return _0x3848cf;});})[_0xb812('0x2d')](function(){_0x2c854a[_0xb812('0x22')](0xcc)[_0xb812('0x21')]();});}};}function handleEntityNotFound(_0x48eb86,_0x53de46){return function(_0x1a3e72){if(!_0x1a3e72){_0x48eb86['sendStatus'](0x194);}return _0x1a3e72;};}function handleError(_0xab2f64,_0x33701c){_0x33701c=_0x33701c||0x1f4;return function(_0x4a6053){logger[_0xb812('0x32')](_0x4a6053[_0xb812('0x33')]);if(_0x4a6053[_0xb812('0x34')]){delete _0x4a6053[_0xb812('0x34')];}_0xab2f64[_0xb812('0x22')](_0x33701c)[_0xb812('0x35')](_0x4a6053);};}exports['index']=function(_0xd18587,_0x31045d){var _0xa7a30={},_0x16fb4c={},_0x532f7e={'count':0x0,'rows':[]};var _0x42d0c1=_[_0xb812('0x36')](db['FaxQueue']['rawAttributes'],function(_0x46749f){return{'name':_0x46749f[_0xb812('0x37')],'type':_0x46749f[_0xb812('0x38')]['key']};});_0x16fb4c[_0xb812('0x39')]=_[_0xb812('0x36')](_0x42d0c1,_0xb812('0x34'));_0x16fb4c[_0xb812('0x3a')]=_['keys'](_0xd18587[_0xb812('0x3a')]);_0x16fb4c[_0xb812('0x3b')]=_['intersection'](_0x16fb4c[_0xb812('0x39')],_0x16fb4c[_0xb812('0x3a')]);_0xa7a30[_0xb812('0x3c')]=_[_0xb812('0x3d')](_0x16fb4c['model'],qs['fields'](_0xd18587[_0xb812('0x3a')][_0xb812('0x3e')]));_0xa7a30[_0xb812('0x3c')]=_0xa7a30[_0xb812('0x3c')][_0xb812('0x3f')]?_0xa7a30['attributes']:_0x16fb4c[_0xb812('0x39')];if(!_0xd18587[_0xb812('0x3a')]['hasOwnProperty']('nolimit')){_0xa7a30[_0xb812('0x26')]=qs[_0xb812('0x26')](_0xd18587[_0xb812('0x3a')][_0xb812('0x26')]);_0xa7a30[_0xb812('0x24')]=qs[_0xb812('0x24')](_0xd18587['query'][_0xb812('0x24')]);}_0xa7a30[_0xb812('0x40')]=qs[_0xb812('0x41')](_0xd18587[_0xb812('0x3a')][_0xb812('0x41')]);_0xa7a30[_0xb812('0x42')]=qs['filters'](_[_0xb812('0x43')](_0xd18587[_0xb812('0x3a')],_0x16fb4c[_0xb812('0x3b')]),_0x42d0c1);if(_0xd18587[_0xb812('0x3a')][_0xb812('0x44')]){_0xa7a30[_0xb812('0x42')]=_['merge'](_0xa7a30[_0xb812('0x42')],{'$or':_[_0xb812('0x36')](_0x42d0c1,function(_0x53012a){if(_0x53012a[_0xb812('0x38')]!==_0xb812('0x45')){var _0x3f7325={};_0x3f7325[_0x53012a[_0xb812('0x34')]]={'$like':'%'+_0xd18587[_0xb812('0x3a')][_0xb812('0x44')]+'%'};return _0x3f7325;}})});}_0xa7a30=_['merge']({},_0xa7a30,_0xd18587['options']);var _0x53a114={'where':_0xa7a30[_0xb812('0x42')]};return db[_0xb812('0x46')][_0xb812('0x27')](_0x53a114)['then'](function(_0x2582e4){_0x532f7e[_0xb812('0x27')]=_0x2582e4;if(_0xd18587[_0xb812('0x3a')][_0xb812('0x47')]){_0xa7a30[_0xb812('0x48')]=[{'all':!![]}];}return db[_0xb812('0x46')][_0xb812('0x49')](_0xa7a30);})['then'](function(_0x35b435){_0x532f7e[_0xb812('0x4a')]=_0x35b435;return _0x532f7e;})[_0xb812('0x2d')](respondWithFilteredResult(_0x31045d,_0xa7a30))[_0xb812('0x4b')](handleError(_0x31045d,null));};exports[_0xb812('0x4c')]=function(_0x34de42,_0x1b3e93){var _0x496e3b={'raw':!![],'where':{'id':_0x34de42[_0xb812('0x4d')]['id']}},_0xefed5c={};_0xefed5c[_0xb812('0x39')]=_[_0xb812('0x4e')](db[_0xb812('0x46')]['rawAttributes']);_0xefed5c[_0xb812('0x3a')]=_[_0xb812('0x4e')](_0x34de42[_0xb812('0x3a')]);_0xefed5c['filters']=_['intersection'](_0xefed5c[_0xb812('0x39')],_0xefed5c[_0xb812('0x3a')]);_0x496e3b[_0xb812('0x3c')]=_['intersection'](_0xefed5c[_0xb812('0x39')],qs[_0xb812('0x3e')](_0x34de42[_0xb812('0x3a')][_0xb812('0x3e')]));_0x496e3b[_0xb812('0x3c')]=_0x496e3b[_0xb812('0x3c')][_0xb812('0x3f')]?_0x496e3b['attributes']:_0xefed5c[_0xb812('0x39')];if(_0x34de42[_0xb812('0x3a')][_0xb812('0x47')]){_0x496e3b[_0xb812('0x48')]=[{'all':!![]}];}_0x496e3b=_[_0xb812('0x4f')]({},_0x496e3b,_0x34de42[_0xb812('0x50')]);return db[_0xb812('0x46')]['find'](_0x496e3b)[_0xb812('0x2d')](handleEntityNotFound(_0x1b3e93,null))[_0xb812('0x2d')](respondWithResult(_0x1b3e93,null))[_0xb812('0x4b')](handleError(_0x1b3e93,null));};exports[_0xb812('0x51')]=function(_0x141b04,_0x1621bd){return db[_0xb812('0x46')][_0xb812('0x51')](_0x141b04[_0xb812('0x52')],{})[_0xb812('0x2d')](function(_0x298825){var _0xcc2f1f=_0x141b04['user'][_0xb812('0x2f')]({'plain':!![]});if(!_0xcc2f1f)throw new Error(_0xb812('0x53'));if(_0xcc2f1f[_0xb812('0x54')]===_0xb812('0x55')){var _0x16c2af=_0x298825[_0xb812('0x2f')]({'plain':!![]});var _0x4c71f0=_0xb812('0x30');return db[_0xb812('0x56')][_0xb812('0x57')]({'where':{'name':_0x4c71f0,'userProfileId':_0xcc2f1f[_0xb812('0x58')]},'raw':!![]})[_0xb812('0x2d')](function(_0x22bd77){if(_0x22bd77&&_0x22bd77[_0xb812('0x59')]===0x0){return db['UserProfileResource'][_0xb812('0x51')]({'name':_0x16c2af['name'],'resourceId':_0x16c2af['id'],'type':_0x22bd77['name'],'sectionId':_0x22bd77['id']},{})['then'](function(){return _0x298825;});}else{return _0x298825;}})[_0xb812('0x4b')](function(_0x2f814e){logger[_0xb812('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f814e);throw _0x2f814e;});}return _0x298825;})[_0xb812('0x2d')](respondWithResult(_0x1621bd,0xc9))['catch'](handleError(_0x1621bd,null));};exports[_0xb812('0x2c')]=function(_0x5c34ea,_0x30fca8){if(_0x5c34ea[_0xb812('0x52')]['id']){delete _0x5c34ea[_0xb812('0x52')]['id'];}return db[_0xb812('0x46')][_0xb812('0x57')]({'where':{'id':_0x5c34ea[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x30fca8,null))[_0xb812('0x2d')](saveUpdates(_0x5c34ea[_0xb812('0x52')],null))[_0xb812('0x2d')](respondWithResult(_0x30fca8,null))[_0xb812('0x4b')](handleError(_0x30fca8,null));};exports[_0xb812('0x2e')]=function(_0xa8f068,_0x5d7d3a){return db[_0xb812('0x46')][_0xb812('0x57')]({'where':{'id':_0xa8f068[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x5d7d3a,null))[_0xb812('0x2d')](removeEntity(_0x5d7d3a,null))['catch'](handleError(_0x5d7d3a,null));};exports['describe']=function(_0x2ea40f,_0x43bd93){return db['FaxQueue'][_0xb812('0x5a')]()[_0xb812('0x2d')](respondWithResult(_0x43bd93,null))[_0xb812('0x4b')](handleError(_0x43bd93,null));};exports['getMembers']=function(_0x28d94e,_0x575c2e,_0x1c9f0e){var _0x4737c0={'raw':!![],'where':{}},_0xb0c3b={},_0x29b33a;return db[_0xb812('0x46')][_0xb812('0x5b')]({'where':{'id':_0x28d94e[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x575c2e,null))[_0xb812('0x2d')](function(_0x40644c){if(_0x40644c){_0x29b33a=_0x40644c[_0xb812('0x2f')]({'plain':!![]});_0xb0c3b[_0xb812('0x39')]=_[_0xb812('0x4e')](db['UserFaxQueue'][_0xb812('0x5c')]);_0xb0c3b[_0xb812('0x3a')]=_[_0xb812('0x4e')](_0x28d94e[_0xb812('0x3a')]);_0xb0c3b['filters']=_['intersection'](_0xb0c3b[_0xb812('0x39')],_0xb0c3b['query']);_0x4737c0[_0xb812('0x3c')]=_[_0xb812('0x3d')](_0xb0c3b['model'],qs[_0xb812('0x3e')](_0x28d94e[_0xb812('0x3a')][_0xb812('0x3e')]));_0x4737c0[_0xb812('0x3c')]=_0x4737c0[_0xb812('0x3c')][_0xb812('0x3f')]?_0x4737c0[_0xb812('0x3c')]:_0xb0c3b[_0xb812('0x39')];if(!_0x28d94e[_0xb812('0x3a')][_0xb812('0x5d')](_0xb812('0x5e'))){_0x4737c0[_0xb812('0x26')]=qs['limit'](_0x28d94e[_0xb812('0x3a')][_0xb812('0x26')]);_0x4737c0[_0xb812('0x24')]=qs['offset'](_0x28d94e['query'][_0xb812('0x24')]);}_0x4737c0['order']=qs['sort'](_0x28d94e[_0xb812('0x3a')][_0xb812('0x41')]);_0x4737c0[_0xb812('0x42')]=qs['filters'](_['pick'](_0x28d94e[_0xb812('0x3a')],_0xb0c3b[_0xb812('0x3b')]));_0x4737c0[_0xb812('0x42')]['FaxQueueId']=_0x40644c['id'];if(_0x28d94e[_0xb812('0x3a')]['filter']){_0x4737c0['where']=_['merge'](_0x4737c0[_0xb812('0x42')],{'$or':_[_0xb812('0x36')](_0x4737c0[_0xb812('0x3c')],function(_0x23a014){var _0x10eef6={};_0x10eef6[_0x23a014]={'$like':'%'+_0x28d94e[_0xb812('0x3a')]['filter']+'%'};return _0x10eef6;})});}_0x4737c0=_['merge']({},_0x4737c0,_0x28d94e[_0xb812('0x50')]);return db['UserFaxQueue']['findAll'](_0x4737c0);}})[_0xb812('0x2d')](function(_0x6d5cda){if(_0x6d5cda){return db[_0xb812('0x5f')][_0xb812('0x60')]({'where':{'id':_[_0xb812('0x36')](_0x6d5cda,_0xb812('0x61')),'role':_0xb812('0x62')},'attributes':['id',_0xb812('0x34'),_0xb812('0x63'),_0xb812('0x64'),_0xb812('0x65')]});}})[_0xb812('0x2d')](function(_0x382ae7){if(_0x382ae7){return{'count':_0x382ae7['count'],'rows':_[_0xb812('0x36')](_0x382ae7[_0xb812('0x4a')],function(_0x3212a8){return{'membername':_0x3212a8[_0xb812('0x34')],'UserId':_0x3212a8['id'],'queue_name':_0x29b33a[_0xb812('0x34')],'FaxQueueId':_0x29b33a['id'],'interface':util['format'](_0xb812('0x66'),_0xb812('0x67'),_0x3212a8['name']),'penalty':0x0,'paused':_0x3212a8[_0xb812('0x63')],'createdAt':_0x3212a8['createdAt'],'updatedAt':_0x3212a8[_0xb812('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x575c2e,_0x4737c0))['catch'](handleError(_0x575c2e,null));};exports['getTeams']=function(_0xa5f8c4,_0x5c6857,_0x48e7cd){var _0x244e7c={};var _0x34d975={};var _0x370380;var _0x55d2cf;return db[_0xb812('0x46')]['findOne']({'where':{'id':_0xa5f8c4[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x5c6857,null))['then'](function(_0x4527e8){if(_0x4527e8){_0x370380=_0x4527e8;_0x34d975[_0xb812('0x39')]=_['keys'](db[_0xb812('0x68')]['rawAttributes']);_0x34d975['query']=_[_0xb812('0x4e')](_0xa5f8c4[_0xb812('0x3a')]);_0x34d975[_0xb812('0x3b')]=_[_0xb812('0x3d')](_0x34d975[_0xb812('0x39')],_0x34d975['query']);_0x244e7c[_0xb812('0x3c')]=_[_0xb812('0x3d')](_0x34d975[_0xb812('0x39')],qs[_0xb812('0x3e')](_0xa5f8c4[_0xb812('0x3a')][_0xb812('0x3e')]));_0x244e7c['attributes']=_0x244e7c[_0xb812('0x3c')][_0xb812('0x3f')]?_0x244e7c[_0xb812('0x3c')]:_0x34d975['model'];_0x244e7c[_0xb812('0x40')]=qs['sort'](_0xa5f8c4[_0xb812('0x3a')]['sort']);_0x244e7c[_0xb812('0x42')]=qs['filters'](_[_0xb812('0x43')](_0xa5f8c4[_0xb812('0x3a')],_0x34d975[_0xb812('0x3b')]));if(_0xa5f8c4['query'][_0xb812('0x44')]){_0x244e7c[_0xb812('0x42')]=_[_0xb812('0x4f')](_0x244e7c[_0xb812('0x42')],{'$or':_['map'](_0x244e7c['attributes'],function(_0x2a1c1a){var _0x274e22={};_0x274e22[_0x2a1c1a]={'$like':'%'+_0xa5f8c4['query'][_0xb812('0x44')]+'%'};return _0x274e22;})});}_0x244e7c=_['merge']({},_0x244e7c,_0xa5f8c4['options']);return _0x370380[_0xb812('0x69')](_0x244e7c);}})[_0xb812('0x2d')](function(_0x4efb17){if(_0x4efb17){_0x55d2cf=_0x4efb17['length'];if(!_0xa5f8c4[_0xb812('0x3a')][_0xb812('0x5d')](_0xb812('0x5e'))){_0x244e7c[_0xb812('0x26')]=qs[_0xb812('0x26')](_0xa5f8c4[_0xb812('0x3a')][_0xb812('0x26')]);_0x244e7c[_0xb812('0x24')]=qs['offset'](_0xa5f8c4[_0xb812('0x3a')][_0xb812('0x24')]);}return _0x370380[_0xb812('0x69')](_0x244e7c);}})[_0xb812('0x2d')](function(_0x54d411){if(_0x54d411){return _0x54d411?{'count':_0x55d2cf,'rows':_0x54d411}:null;}})[_0xb812('0x2d')](respondWithResult(_0x5c6857,null))[_0xb812('0x4b')](handleError(_0x5c6857,null));};exports[_0xb812('0x6a')]=function(_0x445cb0,_0x30f314,_0x22e015){var _0x34a083=_0x445cb0[_0xb812('0x52')]['ids'];return db[_0xb812('0x68')][_0xb812('0x49')]({'where':{'id':_0x34a083},'attributes':['id'],'include':[{'model':db[_0xb812('0x5f')],'as':_0xb812('0x6b'),'attributes':['id','name','online','voicePause',_0xb812('0x6c')],'raw':!![]}]})[_0xb812('0x2d')](function(_0x27ffc2){if(_0x27ffc2){var _0x40d130=_[_0xb812('0x6d')](_0x27ffc2,function(_0x1b7385){var _0x1961c2=_0x1b7385[_0xb812('0x2f')]({'plain':!![]});return _0x1961c2[_0xb812('0x6b')];});return db[_0xb812('0x46')]['find']({'where':{'id':_0x445cb0['params']['id']}})['then'](function(_0x4a5b2e){return db[_0xb812('0x6e')]['transaction'](function(_0x39aec6){return _0x4a5b2e[_0xb812('0x6a')](_0x34a083,{'transaction':_0x39aec6})[_0xb812('0x2d')](function(){return BPromise[_0xb812('0x6f')](_0x40d130,function(_0x555c92){return db[_0xb812('0x70')][_0xb812('0x71')]({'where':{'UserId':_0x555c92['id'],'FaxQueueId':_0x445cb0['params']['id']},'transaction':_0x39aec6});});})[_0xb812('0x2d')](function(){_0x40d130[_0xb812('0x72')](function(_0x136189){socket['emit'](_0xb812('0x73'),{'UserId':_0x136189['id'],'FaxQueueId':_0x4a5b2e['id']});});});});});}})['then'](respondWithStatusCode(_0x30f314,null))[_0xb812('0x4b')](handleError(_0x30f314,null));};exports[_0xb812('0x74')]=function(_0x40f3b2,_0x349893,_0x11c792){return db[_0xb812('0x68')][_0xb812('0x49')]({'where':{'id':_0x40f3b2['query'][_0xb812('0x75')]},'attributes':['id'],'include':[{'model':db[_0xb812('0x5f')],'as':_0xb812('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xb812('0x2d')](handleEntityNotFound(_0x349893,null))[_0xb812('0x2d')](function(_0x480024){var _0x12e3c9=_[_0xb812('0x36')](_0x480024,'id');var _0x316d03=[];var _0x4de842=[];var _0x2ae538=squel[_0xb812('0x76')]();_0x2ae538[_0xb812('0x77')](_0xb812('0x78'))[_0xb812('0x79')](_0xb812('0x7a'),'tq')[_0xb812('0x7b')](_0xb812('0x7c'),'ut',_0xb812('0x7d'))[_0xb812('0x42')](_0xb812('0x7e'),_0x40f3b2[_0xb812('0x4d')]['id']);for(var _0x3c4fd1=0x0;_0x3c4fd1<_0x480024['length'];_0x3c4fd1+=0x1){let _0x532c41=_0x480024[_0x3c4fd1];for(var _0x5cd8ce=0x0;_0x5cd8ce<_0x532c41[_0xb812('0x6b')]['length'];_0x5cd8ce+=0x1){let _0x1c3b6d=_0x532c41[_0xb812('0x6b')][_0x5cd8ce];var _0x208818=_0x2ae538[_0xb812('0x7f')]();_0x208818[_0xb812('0x42')](_0xb812('0x80'),_0x1c3b6d['id']);_0x4de842[_0xb812('0x81')](db['sequelize'][_0xb812('0x3a')](_0x208818[_0xb812('0x82')](),{'type':db[_0xb812('0x6e')][_0xb812('0x83')][_0xb812('0x84')]})[_0xb812('0x2d')](function(_0x1daf92){if(_0x1daf92[_0xb812('0x3f')]===0x1){return _0x1c3b6d['id'];}else{var _0x493960=_['every'](_[_0xb812('0x36')](_0x1daf92,_0xb812('0x85')),function(_0x227d72){return _[_0xb812('0x86')](_0x12e3c9,_0x227d72);});if(_0x493960){return _0x1c3b6d['id'];}}}));}}return BPromise['all'](_0x4de842)['then'](function(_0x4b40e0){_0x316d03=_(_0x316d03)[_0xb812('0x87')](_0x4b40e0)[_0xb812('0x88')]()[_0xb812('0x89')]();return db[_0xb812('0x46')][_0xb812('0x57')]({'where':{'id':_0x40f3b2[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](function(_0x5d3443){return db[_0xb812('0x6e')]['transaction'](function(_0x3147c5){return _0x5d3443[_0xb812('0x74')](_0x40f3b2['query'][_0xb812('0x75')],{'transaction':_0x3147c5})[_0xb812('0x2d')](function(){if(!_[_0xb812('0x8a')](_0x316d03)){return _0x5d3443[_0xb812('0x8b')](_0x316d03,{'transaction':_0x3147c5});}})['then'](function(){_0x316d03['forEach'](function(_0x2e746a){socket[_0xb812('0x8c')](_0xb812('0x8d'),{'UserId':_0x2e746a,'FaxQueueId':_0x5d3443['id']});});});});});});})[_0xb812('0x2d')](respondWithStatusCode(_0x349893,null))[_0xb812('0x4b')](handleError(_0x349893,null));};exports['addAgents']=function(_0x556984,_0xcd5b52,_0x1a299f){return db[_0xb812('0x46')][_0xb812('0x57')]({'where':{'id':_0x556984[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0xcd5b52,null))[_0xb812('0x2d')](function(_0x40e5e0){if(_0x40e5e0){return _0x40e5e0[_0xb812('0x8e')](_0x556984[_0xb812('0x52')][_0xb812('0x75')],_[_0xb812('0x8f')](_0x556984[_0xb812('0x52')],['ids','id'])||{})[_0xb812('0x90')](function(_0x49468c){for(var _0x32316c=0x0;_0x32316c<_0x556984['body'][_0xb812('0x75')]['length'];_0x32316c+=0x1){socket[_0xb812('0x8c')]('userFaxQueue:save',{'UserId':Number(_0x556984[_0xb812('0x52')][_0xb812('0x75')][_0x32316c]),'FaxQueueId':Number(_0x556984[_0xb812('0x4d')]['id'])});}return _0x49468c;});}})[_0xb812('0x2d')](respondWithResult(_0xcd5b52,null))[_0xb812('0x4b')](handleError(_0xcd5b52,null));};exports[_0xb812('0x8b')]=function(_0x2dd105,_0x24a099,_0x457291){return db[_0xb812('0x46')][_0xb812('0x57')]({'where':{'id':_0x2dd105[_0xb812('0x4d')]['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x24a099,null))[_0xb812('0x2d')](function(_0x21795c){if(_0x21795c){return _0x21795c[_0xb812('0x8b')](_0x2dd105[_0xb812('0x3a')][_0xb812('0x75')])[_0xb812('0x2d')](function(){if(_[_0xb812('0x91')](_0x2dd105[_0xb812('0x3a')][_0xb812('0x75')])){for(var _0x581914=0x0;_0x581914<_0x2dd105[_0xb812('0x3a')]['ids'][_0xb812('0x3f')];_0x581914+=0x1){socket[_0xb812('0x8c')](_0xb812('0x8d'),{'UserId':Number(_0x2dd105['query'][_0xb812('0x75')][_0x581914]),'FaxQueueId':Number(_0x2dd105[_0xb812('0x4d')]['id'])});}}else{socket['emit'](_0xb812('0x8d'),{'UserId':Number(_0x2dd105['query'][_0xb812('0x75')]),'FaxQueueId':Number(_0x2dd105[_0xb812('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x24a099,null))[_0xb812('0x4b')](handleError(_0x24a099,null));};exports['getAgents']=function(_0x1ce716,_0x416833,_0x28f00b){var _0x5b0ebf={};var _0x30ef13={};var _0x3d9336;var _0x115a9e;return db['FaxQueue'][_0xb812('0x5b')]({'where':{'id':_0x1ce716['params']['id']}})[_0xb812('0x2d')](handleEntityNotFound(_0x416833,null))['then'](function(_0x351469){if(_0x351469){_0x3d9336=_0x351469;_0x30ef13[_0xb812('0x39')]=_[_0xb812('0x4e')](db['User'][_0xb812('0x5c')]);_0x30ef13[_0xb812('0x3a')]=_[_0xb812('0x4e')](_0x1ce716[_0xb812('0x3a')]);_0x30ef13[_0xb812('0x3b')]=_[_0xb812('0x3d')](_0x30ef13[_0xb812('0x39')],_0x30ef13['query']);_0x5b0ebf[_0xb812('0x3c')]=_['intersection'](_0x30ef13[_0xb812('0x39')],qs['fields'](_0x1ce716[_0xb812('0x3a')]['fields']));_0x5b0ebf[_0xb812('0x3c')]=_0x5b0ebf[_0xb812('0x3c')][_0xb812('0x3f')]?_0x5b0ebf['attributes']:_0x30ef13[_0xb812('0x39')];_0x5b0ebf[_0xb812('0x40')]=qs[_0xb812('0x41')](_0x1ce716[_0xb812('0x3a')][_0xb812('0x41')]);_0x5b0ebf['where']=qs['filters'](_[_0xb812('0x43')](_0x1ce716[_0xb812('0x3a')],_0x30ef13[_0xb812('0x3b')]));if(_0x1ce716['query'][_0xb812('0x44')]){_0x5b0ebf[_0xb812('0x42')]=_[_0xb812('0x4f')](_0x5b0ebf[_0xb812('0x42')],{'$or':_[_0xb812('0x36')](_0x5b0ebf[_0xb812('0x3c')],function(_0xb3e9b6){var _0xadd197={};_0xadd197[_0xb3e9b6]={'$like':'%'+_0x1ce716[_0xb812('0x3a')][_0xb812('0x44')]+'%'};return _0xadd197;})});}_0x5b0ebf=_[_0xb812('0x4f')]({},_0x5b0ebf,_0x1ce716[_0xb812('0x50')]);return _0x3d9336[_0xb812('0x92')](_0x5b0ebf);}})[_0xb812('0x2d')](function(_0x31b986){if(_0x31b986){_0x115a9e=_0x31b986[_0xb812('0x3f')];if(!_0x1ce716[_0xb812('0x3a')][_0xb812('0x5d')](_0xb812('0x5e'))){_0x5b0ebf[_0xb812('0x26')]=qs['limit'](_0x1ce716[_0xb812('0x3a')]['limit']);_0x5b0ebf[_0xb812('0x24')]=qs[_0xb812('0x24')](_0x1ce716[_0xb812('0x3a')][_0xb812('0x24')]);}return _0x3d9336[_0xb812('0x92')](_0x5b0ebf);}})['then'](function(_0x372e1e){if(_0x372e1e){return _0x372e1e?{'count':_0x115a9e,'rows':_0x372e1e}:null;}})['then'](respondWithResult(_0x416833,null))[_0xb812('0x4b')](handleError(_0x416833,null));}; \ No newline at end of file +var _0x458a=['spread','removeAgents','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','FaxQueue','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','describe','findOne','FaxQueueId','User','UserId','agent','faxPause','createdAt','rows','format','%s/%s','SIP','getTeams','Team','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents'];(function(_0x4332be,_0x3c8d73){var _0x4b4ca0=function(_0x16be6f){while(--_0x16be6f){_0x4332be['push'](_0x4332be['shift']());}};_0x4b4ca0(++_0x3c8d73);}(_0x458a,0x121));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa458('0x0'));var rimraf=require(_0xa458('0x1'));var zipdir=require(_0xa458('0x2'));var jsonpatch=require(_0xa458('0x3'));var rp=require(_0xa458('0x4'));var moment=require('moment');var BPromise=require(_0xa458('0x5'));var Mustache=require('mustache');var util=require(_0xa458('0x6'));var path=require(_0xa458('0x7'));var sox=require(_0xa458('0x8'));var csv=require(_0xa458('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa458('0xa'));var _=require(_0xa458('0xb'));var squel=require(_0xa458('0xc'));var crypto=require('crypto');var jsforce=require(_0xa458('0xd'));var deskjs=require(_0xa458('0xe'));var toCsv=require(_0xa458('0x9'));var querystring=require(_0xa458('0xf'));var Papa=require(_0xa458('0x10'));var Redis=require('ioredis');var authService=require(_0xa458('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa458('0x12'));var hardwareService=require(_0xa458('0x13'));var logger=require(_0xa458('0x14'))('api');var utils=require(_0xa458('0x15'));var config=require(_0xa458('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa458('0x17')](config['redis'],{'host':_0xa458('0x18'),'port':0x18eb});var socket=require(_0xa458('0x19'))(new Redis(config[_0xa458('0x1a')]));require('./faxQueue.socket')[_0xa458('0x1b')](socket);function respondWithStatusCode(_0xc38a91,_0x5f2dfc){_0x5f2dfc=_0x5f2dfc||0xcc;return function(_0x54e966){if(_0x54e966){return _0xc38a91[_0xa458('0x1c')](_0x5f2dfc);}return _0xc38a91[_0xa458('0x1d')](_0x5f2dfc)[_0xa458('0x1e')]();};}function respondWithResult(_0x49f8d8,_0xac8bbc){_0xac8bbc=_0xac8bbc||0xc8;return function(_0x10502c){if(_0x10502c){return _0x49f8d8[_0xa458('0x1d')](_0xac8bbc)[_0xa458('0x1f')](_0x10502c);}};}function respondWithFilteredResult(_0x1fbad6,_0x40fd21){return function(_0x5e513e){if(_0x5e513e){var _0x37fa10=typeof _0x40fd21['offset']===_0xa458('0x20')&&typeof _0x40fd21[_0xa458('0x21')]===_0xa458('0x20');var _0x3cf161=_0x5e513e[_0xa458('0x22')];var _0x849795=_0x37fa10?0x0:_0x40fd21[_0xa458('0x23')];var _0x36af9c=_0x37fa10?_0x5e513e[_0xa458('0x22')]:_0x40fd21['offset']+_0x40fd21['limit'];var _0x228963;if(_0x36af9c>=_0x3cf161){_0x36af9c=_0x3cf161;_0x228963=0xc8;}else{_0x228963=0xce;}_0x1fbad6[_0xa458('0x1d')](_0x228963);return _0x1fbad6[_0xa458('0x24')]('Content-Range',_0x849795+'-'+_0x36af9c+'/'+_0x3cf161)['json'](_0x5e513e);}return null;};}function patchUpdates(_0x335e12){return function(_0xc59140){try{jsonpatch[_0xa458('0x25')](_0xc59140,_0x335e12,!![]);}catch(_0x1721bc){return BPromise[_0xa458('0x26')](_0x1721bc);}return _0xc59140[_0xa458('0x27')]();};}function saveUpdates(_0x140aa2,_0x1afb78){return function(_0x4c8899){if(_0x4c8899){return _0x4c8899['update'](_0x140aa2)['then'](function(_0x3e8579){return _0x3e8579;});}return null;};}function removeEntity(_0x5c227f,_0x40f75c){return function(_0x3122e9){if(_0x3122e9){return _0x3122e9[_0xa458('0x28')]()[_0xa458('0x29')](function(){var _0x110d74=_0x3122e9[_0xa458('0x2a')]({'plain':!![]});var _0x2ce7a6=_0xa458('0x2b');return db[_0xa458('0x2c')][_0xa458('0x28')]({'where':{'type':_0x2ce7a6,'resourceId':_0x110d74['id']}})[_0xa458('0x29')](function(){return _0x3122e9;});})[_0xa458('0x29')](function(){_0x5c227f[_0xa458('0x1d')](0xcc)[_0xa458('0x1e')]();});}};}function handleEntityNotFound(_0x53574a,_0x25a34a){return function(_0x12fe43){if(!_0x12fe43){_0x53574a['sendStatus'](0x194);}return _0x12fe43;};}function handleError(_0x872c4,_0x42e965){_0x42e965=_0x42e965||0x1f4;return function(_0x411ba9){logger[_0xa458('0x2d')](_0x411ba9[_0xa458('0x2e')]);if(_0x411ba9[_0xa458('0x2f')]){delete _0x411ba9[_0xa458('0x2f')];}_0x872c4['status'](_0x42e965)[_0xa458('0x30')](_0x411ba9);};}exports[_0xa458('0x31')]=function(_0x447642,_0x445802){var _0x567aff={},_0xb3d72={},_0x77cfb0={'count':0x0,'rows':[]};var _0x3293a0=_[_0xa458('0x32')](db['FaxQueue'][_0xa458('0x33')],function(_0x4d12b6){return{'name':_0x4d12b6[_0xa458('0x34')],'type':_0x4d12b6['type'][_0xa458('0x35')]};});_0xb3d72[_0xa458('0x36')]=_[_0xa458('0x32')](_0x3293a0,_0xa458('0x2f'));_0xb3d72[_0xa458('0x37')]=_[_0xa458('0x38')](_0x447642[_0xa458('0x37')]);_0xb3d72['filters']=_[_0xa458('0x39')](_0xb3d72['model'],_0xb3d72['query']);_0x567aff['attributes']=_[_0xa458('0x39')](_0xb3d72[_0xa458('0x36')],qs['fields'](_0x447642['query'][_0xa458('0x3a')]));_0x567aff['attributes']=_0x567aff[_0xa458('0x3b')][_0xa458('0x3c')]?_0x567aff[_0xa458('0x3b')]:_0xb3d72[_0xa458('0x36')];if(!_0x447642[_0xa458('0x37')][_0xa458('0x3d')]('nolimit')){_0x567aff['limit']=qs[_0xa458('0x21')](_0x447642[_0xa458('0x37')][_0xa458('0x21')]);_0x567aff[_0xa458('0x23')]=qs[_0xa458('0x23')](_0x447642['query'][_0xa458('0x23')]);}_0x567aff[_0xa458('0x3e')]=qs[_0xa458('0x3f')](_0x447642[_0xa458('0x37')][_0xa458('0x3f')]);_0x567aff[_0xa458('0x40')]=qs['filters'](_[_0xa458('0x41')](_0x447642[_0xa458('0x37')],_0xb3d72[_0xa458('0x42')]),_0x3293a0);if(_0x447642[_0xa458('0x37')]['filter']){_0x567aff[_0xa458('0x40')]=_['merge'](_0x567aff['where'],{'$or':_[_0xa458('0x32')](_0x3293a0,function(_0x108fce){if(_0x108fce[_0xa458('0x43')]!==_0xa458('0x44')){var _0x31a5ec={};_0x31a5ec[_0x108fce[_0xa458('0x2f')]]={'$like':'%'+_0x447642[_0xa458('0x37')][_0xa458('0x45')]+'%'};return _0x31a5ec;}})});}_0x567aff=_[_0xa458('0x46')]({},_0x567aff,_0x447642[_0xa458('0x47')]);var _0x5b92da={'where':_0x567aff[_0xa458('0x40')]};return db[_0xa458('0x48')]['count'](_0x5b92da)[_0xa458('0x29')](function(_0x1a8883){_0x77cfb0[_0xa458('0x22')]=_0x1a8883;if(_0x447642['query'][_0xa458('0x49')]){_0x567aff[_0xa458('0x4a')]=[{'all':!![]}];}return db[_0xa458('0x48')][_0xa458('0x4b')](_0x567aff);})['then'](function(_0x4869ee){_0x77cfb0['rows']=_0x4869ee;return _0x77cfb0;})['then'](respondWithFilteredResult(_0x445802,_0x567aff))[_0xa458('0x4c')](handleError(_0x445802,null));};exports[_0xa458('0x4d')]=function(_0x1a7b56,_0x52d121){var _0x272445={'raw':!![],'where':{'id':_0x1a7b56[_0xa458('0x4e')]['id']}},_0x579fab={};_0x579fab[_0xa458('0x36')]=_[_0xa458('0x38')](db['FaxQueue'][_0xa458('0x33')]);_0x579fab[_0xa458('0x37')]=_[_0xa458('0x38')](_0x1a7b56[_0xa458('0x37')]);_0x579fab[_0xa458('0x42')]=_[_0xa458('0x39')](_0x579fab['model'],_0x579fab[_0xa458('0x37')]);_0x272445[_0xa458('0x3b')]=_[_0xa458('0x39')](_0x579fab[_0xa458('0x36')],qs[_0xa458('0x3a')](_0x1a7b56['query'][_0xa458('0x3a')]));_0x272445['attributes']=_0x272445[_0xa458('0x3b')][_0xa458('0x3c')]?_0x272445[_0xa458('0x3b')]:_0x579fab[_0xa458('0x36')];if(_0x1a7b56[_0xa458('0x37')]['includeAll']){_0x272445[_0xa458('0x4a')]=[{'all':!![]}];}_0x272445=_['merge']({},_0x272445,_0x1a7b56['options']);return db['FaxQueue']['find'](_0x272445)[_0xa458('0x29')](handleEntityNotFound(_0x52d121,null))[_0xa458('0x29')](respondWithResult(_0x52d121,null))[_0xa458('0x4c')](handleError(_0x52d121,null));};exports[_0xa458('0x4f')]=function(_0x35d880,_0x4d18fe){return db[_0xa458('0x48')][_0xa458('0x4f')](_0x35d880[_0xa458('0x50')],{})[_0xa458('0x29')](function(_0x29145a){var _0x3f3fee=_0x35d880[_0xa458('0x51')][_0xa458('0x2a')]({'plain':!![]});if(!_0x3f3fee)throw new Error(_0xa458('0x52'));if(_0x3f3fee['role']==='user'){var _0x1c0946=_0x29145a[_0xa458('0x2a')]({'plain':!![]});var _0x1e7413=_0xa458('0x2b');return db[_0xa458('0x53')][_0xa458('0x54')]({'where':{'name':_0x1e7413,'userProfileId':_0x3f3fee[_0xa458('0x55')]},'raw':!![]})[_0xa458('0x29')](function(_0x587ea0){if(_0x587ea0&&_0x587ea0[_0xa458('0x56')]===0x0){return db[_0xa458('0x2c')][_0xa458('0x4f')]({'name':_0x1c0946['name'],'resourceId':_0x1c0946['id'],'type':_0x587ea0['name'],'sectionId':_0x587ea0['id']},{})[_0xa458('0x29')](function(){return _0x29145a;});}else{return _0x29145a;}})[_0xa458('0x4c')](function(_0x1e3eb5){logger[_0xa458('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3eb5);throw _0x1e3eb5;});}return _0x29145a;})[_0xa458('0x29')](respondWithResult(_0x4d18fe,0xc9))[_0xa458('0x4c')](handleError(_0x4d18fe,null));};exports[_0xa458('0x57')]=function(_0x113a77,_0xf05cb7){if(_0x113a77[_0xa458('0x50')]['id']){delete _0x113a77[_0xa458('0x50')]['id'];}return db[_0xa458('0x48')][_0xa458('0x54')]({'where':{'id':_0x113a77[_0xa458('0x4e')]['id']}})[_0xa458('0x29')](handleEntityNotFound(_0xf05cb7,null))[_0xa458('0x29')](saveUpdates(_0x113a77[_0xa458('0x50')],null))[_0xa458('0x29')](respondWithResult(_0xf05cb7,null))[_0xa458('0x4c')](handleError(_0xf05cb7,null));};exports[_0xa458('0x28')]=function(_0xd14ed3,_0x3e1a60){return db[_0xa458('0x48')][_0xa458('0x54')]({'where':{'id':_0xd14ed3[_0xa458('0x4e')]['id']}})[_0xa458('0x29')](handleEntityNotFound(_0x3e1a60,null))[_0xa458('0x29')](removeEntity(_0x3e1a60,null))[_0xa458('0x4c')](handleError(_0x3e1a60,null));};exports[_0xa458('0x58')]=function(_0x58ce2c,_0x3813ac){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x3813ac,null))['catch'](handleError(_0x3813ac,null));};exports['getMembers']=function(_0x48ae31,_0x4805f6,_0x4027fe){var _0xdbeb50={'raw':!![],'where':{}},_0x4ab74d={},_0x400625;return db['FaxQueue'][_0xa458('0x59')]({'where':{'id':_0x48ae31['params']['id']}})[_0xa458('0x29')](handleEntityNotFound(_0x4805f6,null))['then'](function(_0x134086){if(_0x134086){_0x400625=_0x134086[_0xa458('0x2a')]({'plain':!![]});_0x4ab74d['model']=_[_0xa458('0x38')](db['UserFaxQueue'][_0xa458('0x33')]);_0x4ab74d['query']=_[_0xa458('0x38')](_0x48ae31[_0xa458('0x37')]);_0x4ab74d[_0xa458('0x42')]=_[_0xa458('0x39')](_0x4ab74d[_0xa458('0x36')],_0x4ab74d[_0xa458('0x37')]);_0xdbeb50[_0xa458('0x3b')]=_[_0xa458('0x39')](_0x4ab74d[_0xa458('0x36')],qs['fields'](_0x48ae31['query']['fields']));_0xdbeb50[_0xa458('0x3b')]=_0xdbeb50[_0xa458('0x3b')]['length']?_0xdbeb50[_0xa458('0x3b')]:_0x4ab74d['model'];if(!_0x48ae31[_0xa458('0x37')]['hasOwnProperty']('nolimit')){_0xdbeb50[_0xa458('0x21')]=qs[_0xa458('0x21')](_0x48ae31[_0xa458('0x37')]['limit']);_0xdbeb50[_0xa458('0x23')]=qs[_0xa458('0x23')](_0x48ae31[_0xa458('0x37')]['offset']);}_0xdbeb50[_0xa458('0x3e')]=qs[_0xa458('0x3f')](_0x48ae31['query']['sort']);_0xdbeb50[_0xa458('0x40')]=qs[_0xa458('0x42')](_[_0xa458('0x41')](_0x48ae31[_0xa458('0x37')],_0x4ab74d[_0xa458('0x42')]));_0xdbeb50[_0xa458('0x40')][_0xa458('0x5a')]=_0x134086['id'];if(_0x48ae31[_0xa458('0x37')][_0xa458('0x45')]){_0xdbeb50[_0xa458('0x40')]=_[_0xa458('0x46')](_0xdbeb50[_0xa458('0x40')],{'$or':_[_0xa458('0x32')](_0xdbeb50[_0xa458('0x3b')],function(_0x475cd2){var _0x28bfcf={};_0x28bfcf[_0x475cd2]={'$like':'%'+_0x48ae31['query'][_0xa458('0x45')]+'%'};return _0x28bfcf;})});}_0xdbeb50=_['merge']({},_0xdbeb50,_0x48ae31['options']);return db['UserFaxQueue'][_0xa458('0x4b')](_0xdbeb50);}})[_0xa458('0x29')](function(_0x4a0f9a){if(_0x4a0f9a){return db[_0xa458('0x5b')]['findAndCountAll']({'where':{'id':_[_0xa458('0x32')](_0x4a0f9a,_0xa458('0x5c')),'role':_0xa458('0x5d')},'attributes':['id','name',_0xa458('0x5e'),'updatedAt',_0xa458('0x5f')]});}})[_0xa458('0x29')](function(_0x1dde61){if(_0x1dde61){return{'count':_0x1dde61[_0xa458('0x22')],'rows':_[_0xa458('0x32')](_0x1dde61[_0xa458('0x60')],function(_0x2623ef){return{'membername':_0x2623ef[_0xa458('0x2f')],'UserId':_0x2623ef['id'],'queue_name':_0x400625[_0xa458('0x2f')],'FaxQueueId':_0x400625['id'],'interface':util[_0xa458('0x61')](_0xa458('0x62'),_0xa458('0x63'),_0x2623ef['name']),'penalty':0x0,'paused':_0x2623ef[_0xa458('0x5e')],'createdAt':_0x2623ef[_0xa458('0x5f')],'updatedAt':_0x2623ef['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa458('0x29')](respondWithFilteredResult(_0x4805f6,_0xdbeb50))[_0xa458('0x4c')](handleError(_0x4805f6,null));};exports[_0xa458('0x64')]=function(_0x173a6e,_0x2c10cc,_0x45ec55){var _0x264181={};var _0x1de24a={};var _0x238eb1;var _0x12ade0;return db[_0xa458('0x48')][_0xa458('0x59')]({'where':{'id':_0x173a6e[_0xa458('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c10cc,null))[_0xa458('0x29')](function(_0x27d95d){if(_0x27d95d){_0x238eb1=_0x27d95d;_0x1de24a['model']=_['keys'](db[_0xa458('0x65')][_0xa458('0x33')]);_0x1de24a[_0xa458('0x37')]=_[_0xa458('0x38')](_0x173a6e[_0xa458('0x37')]);_0x1de24a[_0xa458('0x42')]=_[_0xa458('0x39')](_0x1de24a[_0xa458('0x36')],_0x1de24a['query']);_0x264181[_0xa458('0x3b')]=_['intersection'](_0x1de24a[_0xa458('0x36')],qs['fields'](_0x173a6e['query']['fields']));_0x264181[_0xa458('0x3b')]=_0x264181[_0xa458('0x3b')][_0xa458('0x3c')]?_0x264181['attributes']:_0x1de24a['model'];_0x264181[_0xa458('0x3e')]=qs['sort'](_0x173a6e['query'][_0xa458('0x3f')]);_0x264181[_0xa458('0x40')]=qs[_0xa458('0x42')](_[_0xa458('0x41')](_0x173a6e[_0xa458('0x37')],_0x1de24a['filters']));if(_0x173a6e['query'][_0xa458('0x45')]){_0x264181[_0xa458('0x40')]=_[_0xa458('0x46')](_0x264181['where'],{'$or':_['map'](_0x264181[_0xa458('0x3b')],function(_0x42bcb0){var _0x12ac6e={};_0x12ac6e[_0x42bcb0]={'$like':'%'+_0x173a6e[_0xa458('0x37')][_0xa458('0x45')]+'%'};return _0x12ac6e;})});}_0x264181=_[_0xa458('0x46')]({},_0x264181,_0x173a6e['options']);return _0x238eb1[_0xa458('0x64')](_0x264181);}})[_0xa458('0x29')](function(_0x95beda){if(_0x95beda){_0x12ade0=_0x95beda[_0xa458('0x3c')];if(!_0x173a6e[_0xa458('0x37')][_0xa458('0x3d')](_0xa458('0x66'))){_0x264181[_0xa458('0x21')]=qs['limit'](_0x173a6e[_0xa458('0x37')][_0xa458('0x21')]);_0x264181[_0xa458('0x23')]=qs[_0xa458('0x23')](_0x173a6e[_0xa458('0x37')][_0xa458('0x23')]);}return _0x238eb1[_0xa458('0x64')](_0x264181);}})[_0xa458('0x29')](function(_0x3229b0){if(_0x3229b0){return _0x3229b0?{'count':_0x12ade0,'rows':_0x3229b0}:null;}})['then'](respondWithResult(_0x2c10cc,null))[_0xa458('0x4c')](handleError(_0x2c10cc,null));};exports[_0xa458('0x67')]=function(_0x27e1d3,_0x3e71bc,_0x2729d3){var _0x354714=_0x27e1d3[_0xa458('0x50')]['ids'];return db[_0xa458('0x65')][_0xa458('0x4b')]({'where':{'id':_0x354714},'attributes':['id'],'include':[{'model':db[_0xa458('0x5b')],'as':_0xa458('0x68'),'attributes':['id',_0xa458('0x2f'),_0xa458('0x69'),_0xa458('0x6a'),_0xa458('0x6b')],'raw':!![]}]})[_0xa458('0x29')](function(_0x2472b7){if(_0x2472b7){var _0x118a13=_['flatMap'](_0x2472b7,function(_0x324a7e){var _0x5ebc5=_0x324a7e[_0xa458('0x2a')]({'plain':!![]});return _0x5ebc5['Agents'];});return db[_0xa458('0x48')][_0xa458('0x54')]({'where':{'id':_0x27e1d3[_0xa458('0x4e')]['id']}})[_0xa458('0x29')](function(_0x28a7b1){return db[_0xa458('0x6c')][_0xa458('0x6d')](function(_0x4f9060){return _0x28a7b1[_0xa458('0x67')](_0x354714,{'transaction':_0x4f9060})[_0xa458('0x29')](function(){return BPromise['each'](_0x118a13,function(_0x1756b9){return db['UserFaxQueue'][_0xa458('0x6e')]({'where':{'UserId':_0x1756b9['id'],'FaxQueueId':_0x27e1d3[_0xa458('0x4e')]['id']},'transaction':_0x4f9060});});})['then'](function(){_0x118a13[_0xa458('0x6f')](function(_0x55ebc6){socket[_0xa458('0x70')](_0xa458('0x71'),{'UserId':_0x55ebc6['id'],'FaxQueueId':_0x28a7b1['id']});});});});});}})[_0xa458('0x29')](respondWithStatusCode(_0x3e71bc,null))['catch'](handleError(_0x3e71bc,null));};exports[_0xa458('0x72')]=function(_0x550534,_0x1c09fc,_0x6048d4){return db[_0xa458('0x65')][_0xa458('0x4b')]({'where':{'id':_0x550534[_0xa458('0x37')][_0xa458('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa458('0x5b')],'as':_0xa458('0x68'),'attributes':['id'],'raw':!![]}]})[_0xa458('0x29')](handleEntityNotFound(_0x1c09fc,null))['then'](function(_0x1936e1){var _0x5eb2e4=_[_0xa458('0x32')](_0x1936e1,'id');var _0x1093ce=[];var _0x8e5b42=[];var _0x1e17a9=squel[_0xa458('0x74')]();_0x1e17a9[_0xa458('0x75')]('tq.TeamId')[_0xa458('0x76')](_0xa458('0x77'),'tq')[_0xa458('0x78')](_0xa458('0x79'),'ut',_0xa458('0x7a'))[_0xa458('0x40')](_0xa458('0x7b'),_0x550534[_0xa458('0x4e')]['id']);for(var _0x2f621a=0x0;_0x2f621a<_0x1936e1['length'];_0x2f621a+=0x1){let _0x1ab9e2=_0x1936e1[_0x2f621a];for(var _0x1de3ad=0x0;_0x1de3ad<_0x1ab9e2[_0xa458('0x68')][_0xa458('0x3c')];_0x1de3ad+=0x1){let _0x4436fc=_0x1ab9e2['Agents'][_0x1de3ad];var _0x4881f8=_0x1e17a9['clone']();_0x4881f8[_0xa458('0x40')](_0xa458('0x7c'),_0x4436fc['id']);_0x8e5b42['push'](db[_0xa458('0x6c')][_0xa458('0x37')](_0x4881f8[_0xa458('0x7d')](),{'type':db[_0xa458('0x6c')][_0xa458('0x7e')][_0xa458('0x7f')]})[_0xa458('0x29')](function(_0x4b0f17){if(_0x4b0f17[_0xa458('0x3c')]===0x1){return _0x4436fc['id'];}else{var _0x302625=_[_0xa458('0x80')](_['map'](_0x4b0f17,_0xa458('0x81')),function(_0x1d1a07){return _[_0xa458('0x82')](_0x5eb2e4,_0x1d1a07);});if(_0x302625){return _0x4436fc['id'];}}}));}}return BPromise[_0xa458('0x83')](_0x8e5b42)[_0xa458('0x29')](function(_0x3e0494){_0x1093ce=_(_0x1093ce)[_0xa458('0x84')](_0x3e0494)[_0xa458('0x85')]()[_0xa458('0x86')]();return db[_0xa458('0x48')][_0xa458('0x54')]({'where':{'id':_0x550534[_0xa458('0x4e')]['id']}})['then'](function(_0x2372a7){return db[_0xa458('0x6c')][_0xa458('0x6d')](function(_0x85cd51){return _0x2372a7[_0xa458('0x72')](_0x550534[_0xa458('0x37')][_0xa458('0x73')],{'transaction':_0x85cd51})[_0xa458('0x29')](function(){if(!_[_0xa458('0x87')](_0x1093ce)){return _0x2372a7['removeAgents'](_0x1093ce,{'transaction':_0x85cd51});}})['then'](function(){_0x1093ce[_0xa458('0x6f')](function(_0x2e62e4){socket['emit']('userFaxQueue:remove',{'UserId':_0x2e62e4,'FaxQueueId':_0x2372a7['id']});});});});});});})[_0xa458('0x29')](respondWithStatusCode(_0x1c09fc,null))['catch'](handleError(_0x1c09fc,null));};exports[_0xa458('0x88')]=function(_0xce35c9,_0x565d68,_0x33d91e){return db['FaxQueue']['find']({'where':{'id':_0xce35c9[_0xa458('0x4e')]['id']}})[_0xa458('0x29')](handleEntityNotFound(_0x565d68,null))['then'](function(_0x323a14){if(_0x323a14){return _0x323a14['addAgents'](_0xce35c9[_0xa458('0x50')][_0xa458('0x73')],_['omit'](_0xce35c9[_0xa458('0x50')],[_0xa458('0x73'),'id'])||{})[_0xa458('0x89')](function(_0x5eaf63){for(var _0x5f5e0a=0x0;_0x5f5e0a<_0xce35c9[_0xa458('0x50')][_0xa458('0x73')]['length'];_0x5f5e0a+=0x1){socket[_0xa458('0x70')](_0xa458('0x71'),{'UserId':Number(_0xce35c9[_0xa458('0x50')][_0xa458('0x73')][_0x5f5e0a]),'FaxQueueId':Number(_0xce35c9[_0xa458('0x4e')]['id'])});}return _0x5eaf63;});}})[_0xa458('0x29')](respondWithResult(_0x565d68,null))[_0xa458('0x4c')](handleError(_0x565d68,null));};exports[_0xa458('0x8a')]=function(_0x200fc7,_0x270272,_0x470444){return db[_0xa458('0x48')]['find']({'where':{'id':_0x200fc7[_0xa458('0x4e')]['id']}})[_0xa458('0x29')](handleEntityNotFound(_0x270272,null))[_0xa458('0x29')](function(_0x230e46){if(_0x230e46){return _0x230e46[_0xa458('0x8a')](_0x200fc7[_0xa458('0x37')][_0xa458('0x73')])[_0xa458('0x29')](function(){if(_[_0xa458('0x8b')](_0x200fc7[_0xa458('0x37')]['ids'])){for(var _0x2ac67a=0x0;_0x2ac67a<_0x200fc7[_0xa458('0x37')][_0xa458('0x73')]['length'];_0x2ac67a+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x200fc7[_0xa458('0x37')][_0xa458('0x73')][_0x2ac67a]),'FaxQueueId':Number(_0x200fc7[_0xa458('0x4e')]['id'])});}}else{socket['emit'](_0xa458('0x8c'),{'UserId':Number(_0x200fc7[_0xa458('0x37')][_0xa458('0x73')]),'FaxQueueId':Number(_0x200fc7['params']['id'])});}});}})[_0xa458('0x29')](respondWithStatusCode(_0x270272,null))['catch'](handleError(_0x270272,null));};exports[_0xa458('0x8d')]=function(_0x534171,_0x31bd00,_0x1719f0){var _0x2ed6dd={};var _0x1b1eae={};var _0xcbdb1f;var _0x18a45b;return db[_0xa458('0x48')][_0xa458('0x59')]({'where':{'id':_0x534171['params']['id']}})['then'](handleEntityNotFound(_0x31bd00,null))[_0xa458('0x29')](function(_0x9f6a09){if(_0x9f6a09){_0xcbdb1f=_0x9f6a09;_0x1b1eae[_0xa458('0x36')]=_[_0xa458('0x38')](db['User'][_0xa458('0x33')]);_0x1b1eae[_0xa458('0x37')]=_['keys'](_0x534171[_0xa458('0x37')]);_0x1b1eae[_0xa458('0x42')]=_['intersection'](_0x1b1eae[_0xa458('0x36')],_0x1b1eae[_0xa458('0x37')]);_0x2ed6dd['attributes']=_[_0xa458('0x39')](_0x1b1eae[_0xa458('0x36')],qs[_0xa458('0x3a')](_0x534171[_0xa458('0x37')][_0xa458('0x3a')]));_0x2ed6dd['attributes']=_0x2ed6dd['attributes'][_0xa458('0x3c')]?_0x2ed6dd['attributes']:_0x1b1eae[_0xa458('0x36')];_0x2ed6dd['order']=qs[_0xa458('0x3f')](_0x534171[_0xa458('0x37')][_0xa458('0x3f')]);_0x2ed6dd['where']=qs[_0xa458('0x42')](_[_0xa458('0x41')](_0x534171[_0xa458('0x37')],_0x1b1eae[_0xa458('0x42')]));if(_0x534171[_0xa458('0x37')]['filter']){_0x2ed6dd[_0xa458('0x40')]=_['merge'](_0x2ed6dd[_0xa458('0x40')],{'$or':_[_0xa458('0x32')](_0x2ed6dd[_0xa458('0x3b')],function(_0x24848b){var _0x221469={};_0x221469[_0x24848b]={'$like':'%'+_0x534171['query'][_0xa458('0x45')]+'%'};return _0x221469;})});}_0x2ed6dd=_['merge']({},_0x2ed6dd,_0x534171[_0xa458('0x47')]);return _0xcbdb1f[_0xa458('0x8d')](_0x2ed6dd);}})[_0xa458('0x29')](function(_0x597704){if(_0x597704){_0x18a45b=_0x597704[_0xa458('0x3c')];if(!_0x534171['query'][_0xa458('0x3d')]('nolimit')){_0x2ed6dd['limit']=qs['limit'](_0x534171[_0xa458('0x37')]['limit']);_0x2ed6dd[_0xa458('0x23')]=qs['offset'](_0x534171[_0xa458('0x37')][_0xa458('0x23')]);}return _0xcbdb1f['getAgents'](_0x2ed6dd);}})[_0xa458('0x29')](function(_0x14dcf6){if(_0x14dcf6){return _0x14dcf6?{'count':_0x18a45b,'rows':_0x14dcf6}:null;}})[_0xa458('0x29')](respondWithResult(_0x31bd00,null))[_0xa458('0x4c')](handleError(_0x31bd00,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 14bdd08..f7fac73 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 _0x7220=['FaxQueue','setMaxListeners','save','emit','hook','events','../../mysqldb'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x7220,0xc2));var _0x0722=function(_0x1c5b9c,_0x426216){_0x1c5b9c=_0x1c5b9c-0x0;var _0x474b22=_0x7220[_0x1c5b9c];return _0x474b22;};'use strict';var EventEmitter=require(_0x0722('0x0'));var FaxQueue=require(_0x0722('0x1'))['db'][_0x0722('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0722('0x3')](0x0);var events={'afterCreate':_0x0722('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4bac5d){return function(_0x51fc80,_0x2b85de,_0xa436a4){FaxQueueEvents['emit'](_0x4bac5d+':'+_0x51fc80['id'],_0x51fc80);FaxQueueEvents[_0x0722('0x5')](_0x4bac5d,_0x51fc80);_0xa436a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0722('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x010c=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1b0659,_0x586a89){var _0x1e3bf6=function(_0x4fb9a2){while(--_0x4fb9a2){_0x1b0659['push'](_0x1b0659['shift']());}};_0x1e3bf6(++_0x586a89);}(_0x010c,0x169));var _0xc010=function(_0x4994f3,_0x31ea96){_0x4994f3=_0x4994f3-0x0;var _0x41edad=_0x010c[_0x4994f3];return _0x41edad;};'use strict';var EventEmitter=require(_0xc010('0x0'));var FaxQueue=require(_0xc010('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc010('0x2')](0x0);var events={'afterCreate':_0xc010('0x3'),'afterUpdate':_0xc010('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41be1c){return function(_0xaa5593,_0x3d3a1d,_0x126d93){FaxQueueEvents[_0xc010('0x5')](_0x41be1c+':'+_0xaa5593['id'],_0xaa5593);FaxQueueEvents[_0xc010('0x5')](_0x41be1c,_0xaa5593);_0x126d93(null);};}for(var e in events){if(events[_0xc010('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xc010('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 294399e..1fa3ad7 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 _0xb833=['../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x305519,_0x3b7b15){var _0x4b18e6=function(_0x4cc23f){while(--_0x4cc23f){_0x305519['push'](_0x305519['shift']());}};_0x4b18e6(++_0x3b7b15);}(_0xb833,0x87));var _0x3b83=function(_0x38d073,_0x4c598c){_0x38d073=_0x38d073-0x0;var _0x25548d=_0xb833[_0x38d073];return _0x25548d;};'use strict';var _=require(_0x3b83('0x0'));var util=require(_0x3b83('0x1'));var logger=require(_0x3b83('0x2'))(_0x3b83('0x3'));var moment=require(_0x3b83('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b83('0x5'));var fs=require('fs');var path=require(_0x3b83('0x6'));var rimraf=require(_0x3b83('0x7'));var config=require(_0x3b83('0x8'));var attributes=require('./faxQueue.attributes');module[_0x3b83('0x9')]=function(_0x2d6193,_0x4f0b3c){return _0x2d6193[_0x3b83('0xa')](_0x3b83('0xb'),attributes,{'tableName':_0x3b83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedbb=['define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x42634a,_0x3e8775){var _0xac097a=function(_0x4c0ccf){while(--_0x4c0ccf){_0x42634a['push'](_0x42634a['shift']());}};_0xac097a(++_0x3e8775);}(_0xedbb,0x148));var _0xbedb=function(_0x368084,_0x51fd90){_0x368084=_0x368084-0x0;var _0x38ead4=_0xedbb[_0x368084];return _0x38ead4;};'use strict';var _=require(_0xbedb('0x0'));var util=require(_0xbedb('0x1'));var logger=require('../../config/logger')(_0xbedb('0x2'));var moment=require(_0xbedb('0x3'));var BPromise=require(_0xbedb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbedb('0x5'));var rimraf=require(_0xbedb('0x6'));var config=require(_0xbedb('0x7'));var attributes=require(_0xbedb('0x8'));module[_0xbedb('0x9')]=function(_0x2b8347,_0x1f77f7){return _0x2b8347[_0xbedb('0xa')](_0xbedb('0xb'),attributes,{'tableName':_0xbedb('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 0aedd2d..a205f21 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 _0xf052=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf052,0x120));var _0x2f05=function(_0x4074d5,_0xa57194){_0x4074d5=_0x4074d5-0x0;var _0x502cfe=_0xf052[_0x4074d5];return _0x502cfe;};'use strict';var _=require(_0x2f05('0x0'));var util=require(_0x2f05('0x1'));var moment=require(_0x2f05('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f05('0x4'))['db'];var utils=require(_0x2f05('0x5'));var logger=require(_0x2f05('0x6'))(_0x2f05('0x7'));var config=require(_0x2f05('0x8'));var jayson=require(_0x2f05('0x9'));var client=jayson[_0x2f05('0xa')][_0x2f05('0xb')]({'port':0x232a});config[_0x2f05('0xc')]=_[_0x2f05('0xd')](config[_0x2f05('0xc')],{'host':_0x2f05('0xe'),'port':0x18eb});var socket=require(_0x2f05('0xf'))(new Redis(config[_0x2f05('0xc')]));require(_0x2f05('0x10'))[_0x2f05('0x11')](socket);function respondWithRpcPromise(_0xa6fbc7,_0x5f06b1,_0x17a35e){return new BPromise(function(_0xbe7eba,_0x1cff68){return client[_0x2f05('0x12')](_0xa6fbc7,_0x17a35e)[_0x2f05('0x13')](function(_0x394b39){logger[_0x2f05('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5f06b1,_0x2f05('0x15'));logger[_0x2f05('0x16')](_0x2f05('0x17'),_0x5f06b1,'request\x20sent',JSON[_0x2f05('0x18')](_0x394b39));if(_0x394b39[_0x2f05('0x19')]){if(_0x394b39[_0x2f05('0x19')][_0x2f05('0x1a')]===0x1f4){logger[_0x2f05('0x19')](_0x2f05('0x1b'),_0x5f06b1,_0x394b39['error']['message']);return _0x1cff68(_0x394b39[_0x2f05('0x19')]['message']);}logger[_0x2f05('0x19')](_0x2f05('0x1b'),_0x5f06b1,_0x394b39[_0x2f05('0x19')][_0x2f05('0x1c')]);return _0xbe7eba(_0x394b39[_0x2f05('0x19')]['message']);}else{logger[_0x2f05('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5f06b1,_0x2f05('0x15'));_0xbe7eba(_0x394b39['result'][_0x2f05('0x1c')]);}})[_0x2f05('0x1d')](function(_0x334bd9){logger[_0x2f05('0x19')](_0x2f05('0x1b'),_0x5f06b1,_0x334bd9);_0x1cff68(_0x334bd9);});});}exports[_0x2f05('0x1e')]=function(_0x1e5f67){var _0x421288=this;return new Promise(function(_0x4d9044,_0x498941){return db['FaxQueue']['findAll']({'raw':_0x1e5f67[_0x2f05('0x1f')]?_0x1e5f67[_0x2f05('0x1f')][_0x2f05('0x20')]===undefined?!![]:![]:!![],'where':_0x1e5f67['options']?_0x1e5f67[_0x2f05('0x1f')][_0x2f05('0x21')]||null:null,'attributes':_0x1e5f67[_0x2f05('0x1f')]?_0x1e5f67[_0x2f05('0x1f')][_0x2f05('0x22')]||null:null,'limit':_0x1e5f67[_0x2f05('0x1f')]?_0x1e5f67[_0x2f05('0x1f')][_0x2f05('0x23')]||null:null,'include':_0x1e5f67[_0x2f05('0x1f')]?_0x1e5f67[_0x2f05('0x1f')]['include']?_['map'](_0x1e5f67[_0x2f05('0x1f')][_0x2f05('0x24')],function(_0x3e00c5){return{'model':db[_0x3e00c5['model']],'as':_0x3e00c5['as'],'attributes':_0x3e00c5['attributes'],'include':_0x3e00c5['include']?_[_0x2f05('0x25')](_0x3e00c5[_0x2f05('0x24')],function(_0x172f86){return{'model':db[_0x172f86[_0x2f05('0x26')]],'as':_0x172f86['as'],'attributes':_0x172f86[_0x2f05('0x22')],'include':_0x172f86[_0x2f05('0x24')]?_[_0x2f05('0x25')](_0x172f86[_0x2f05('0x24')],function(_0x32bb65){return{'model':db[_0x32bb65['model']],'as':_0x32bb65['as'],'attributes':_0x32bb65[_0x2f05('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2f05('0x13')](function(_0xd5274f){logger[_0x2f05('0x14')](_0x2f05('0x1e'),_0x1e5f67);logger[_0x2f05('0x16')]('GetFaxQueue',_0x1e5f67,JSON[_0x2f05('0x18')](_0xd5274f));_0x4d9044(_0xd5274f);})[_0x2f05('0x1d')](function(_0x78710c){logger[_0x2f05('0x19')](_0x2f05('0x1e'),_0x78710c[_0x2f05('0x1c')],_0x1e5f67);_0x498941(_0x421288[_0x2f05('0x19')](0x1f4,_0x78710c[_0x2f05('0x1c')]));});});};exports[_0x2f05('0x27')]=function(_0x49bbac){var _0xde5148=this;return new Promise(function(_0x32d6ba,_0x15b06f){return db[_0x2f05('0x28')][_0x2f05('0x29')]({'raw':_0x49bbac[_0x2f05('0x1f')]?_0x49bbac[_0x2f05('0x1f')][_0x2f05('0x20')]===undefined?!![]:![]:!![],'where':_0x49bbac[_0x2f05('0x1f')]?_0x49bbac[_0x2f05('0x1f')]['where']||null:null,'attributes':_0x49bbac['options']?_0x49bbac[_0x2f05('0x1f')]['attributes']||null:null,'include':_0x49bbac[_0x2f05('0x1f')]?_0x49bbac[_0x2f05('0x1f')][_0x2f05('0x24')]?_[_0x2f05('0x25')](_0x49bbac[_0x2f05('0x1f')][_0x2f05('0x24')],function(_0x347698){return{'model':db[_0x347698[_0x2f05('0x26')]],'as':_0x347698['as'],'attributes':_0x347698[_0x2f05('0x22')],'include':_0x347698[_0x2f05('0x24')]?_['map'](_0x347698[_0x2f05('0x24')],function(_0x3eb28c){return{'model':db[_0x3eb28c[_0x2f05('0x26')]],'as':_0x3eb28c['as'],'attributes':_0x3eb28c[_0x2f05('0x22')],'include':_0x3eb28c[_0x2f05('0x24')]?_['map'](_0x3eb28c['include'],function(_0x13120a){return{'model':db[_0x13120a[_0x2f05('0x26')]],'as':_0x13120a['as'],'attributes':_0x13120a[_0x2f05('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2f05('0x13')](function(_0x2f27c6){logger[_0x2f05('0x14')]('ShowFaxQueue',_0x49bbac);logger[_0x2f05('0x16')](_0x2f05('0x27'),_0x49bbac,JSON['stringify'](_0x2f27c6));_0x32d6ba(_0x2f27c6);})[_0x2f05('0x1d')](function(_0xd1757f){logger[_0x2f05('0x19')](_0x2f05('0x27'),_0xd1757f['message'],_0x49bbac);_0x15b06f(_0xde5148[_0x2f05('0x19')](0x1f4,_0xd1757f[_0x2f05('0x1c')]));});});}; \ No newline at end of file +var _0xd3df=['limit','include','attributes','map','model','then','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x5db449,_0x3de1f9){var _0x5257df=function(_0x5190e5){while(--_0x5190e5){_0x5db449['push'](_0x5db449['shift']());}};_0x5257df(++_0x3de1f9);}(_0xd3df,0xfd));var _0xfd3d=function(_0x5c460d,_0x1ec4b8){_0x5c460d=_0x5c460d-0x0;var _0x28760c=_0xd3df[_0x5c460d];return _0x28760c;};'use strict';var _=require(_0xfd3d('0x0'));var util=require(_0xfd3d('0x1'));var moment=require(_0xfd3d('0x2'));var BPromise=require(_0xfd3d('0x3'));var rs=require(_0xfd3d('0x4'));var fs=require('fs');var Redis=require(_0xfd3d('0x5'));var db=require(_0xfd3d('0x6'))['db'];var utils=require(_0xfd3d('0x7'));var logger=require(_0xfd3d('0x8'))(_0xfd3d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd3d('0xa')][_0xfd3d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfd3d('0xc')],{'host':_0xfd3d('0xd'),'port':0x18eb});var socket=require(_0xfd3d('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xfd3d('0xf')](socket);function respondWithRpcPromise(_0x58d240,_0x1719e2,_0x3453ef){return new BPromise(function(_0x2a6513,_0x29c801){return client[_0xfd3d('0x10')](_0x58d240,_0x3453ef)['then'](function(_0xcf4463){logger[_0xfd3d('0x11')](_0xfd3d('0x12'),_0x1719e2,_0xfd3d('0x13'));logger[_0xfd3d('0x14')](_0xfd3d('0x15'),_0x1719e2,_0xfd3d('0x13'),JSON[_0xfd3d('0x16')](_0xcf4463));if(_0xcf4463[_0xfd3d('0x17')]){if(_0xcf4463['error'][_0xfd3d('0x18')]===0x1f4){logger[_0xfd3d('0x17')](_0xfd3d('0x12'),_0x1719e2,_0xcf4463[_0xfd3d('0x17')]['message']);return _0x29c801(_0xcf4463[_0xfd3d('0x17')][_0xfd3d('0x19')]);}logger[_0xfd3d('0x17')](_0xfd3d('0x12'),_0x1719e2,_0xcf4463['error'][_0xfd3d('0x19')]);return _0x2a6513(_0xcf4463[_0xfd3d('0x17')][_0xfd3d('0x19')]);}else{logger[_0xfd3d('0x11')](_0xfd3d('0x12'),_0x1719e2,_0xfd3d('0x13'));_0x2a6513(_0xcf4463[_0xfd3d('0x1a')]['message']);}})[_0xfd3d('0x1b')](function(_0x5a7b33){logger[_0xfd3d('0x17')](_0xfd3d('0x12'),_0x1719e2,_0x5a7b33);_0x29c801(_0x5a7b33);});});}exports[_0xfd3d('0x1c')]=function(_0x2da774){var _0xbc645c=this;return new Promise(function(_0x3624ec,_0x1a6655){return db[_0xfd3d('0x1d')][_0xfd3d('0x1e')]({'raw':_0x2da774[_0xfd3d('0x1f')]?_0x2da774[_0xfd3d('0x1f')][_0xfd3d('0x20')]===undefined?!![]:![]:!![],'where':_0x2da774['options']?_0x2da774['options'][_0xfd3d('0x21')]||null:null,'attributes':_0x2da774[_0xfd3d('0x1f')]?_0x2da774[_0xfd3d('0x1f')]['attributes']||null:null,'limit':_0x2da774[_0xfd3d('0x1f')]?_0x2da774['options'][_0xfd3d('0x22')]||null:null,'include':_0x2da774[_0xfd3d('0x1f')]?_0x2da774['options'][_0xfd3d('0x23')]?_['map'](_0x2da774[_0xfd3d('0x1f')][_0xfd3d('0x23')],function(_0x399d9c){return{'model':db[_0x399d9c['model']],'as':_0x399d9c['as'],'attributes':_0x399d9c[_0xfd3d('0x24')],'include':_0x399d9c[_0xfd3d('0x23')]?_[_0xfd3d('0x25')](_0x399d9c['include'],function(_0x2396c9){return{'model':db[_0x2396c9[_0xfd3d('0x26')]],'as':_0x2396c9['as'],'attributes':_0x2396c9['attributes'],'include':_0x2396c9[_0xfd3d('0x23')]?_[_0xfd3d('0x25')](_0x2396c9['include'],function(_0x78221){return{'model':db[_0x78221[_0xfd3d('0x26')]],'as':_0x78221['as'],'attributes':_0x78221[_0xfd3d('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfd3d('0x27')](function(_0x1794c3){logger[_0xfd3d('0x11')]('GetFaxQueue',_0x2da774);logger[_0xfd3d('0x14')](_0xfd3d('0x1c'),_0x2da774,JSON['stringify'](_0x1794c3));_0x3624ec(_0x1794c3);})[_0xfd3d('0x1b')](function(_0x3e05e1){logger[_0xfd3d('0x17')]('GetFaxQueue',_0x3e05e1[_0xfd3d('0x19')],_0x2da774);_0x1a6655(_0xbc645c[_0xfd3d('0x17')](0x1f4,_0x3e05e1[_0xfd3d('0x19')]));});});};exports[_0xfd3d('0x28')]=function(_0xadd699){var _0x3aa99e=this;return new Promise(function(_0x49610b,_0x36948c){return db['FaxQueue']['find']({'raw':_0xadd699[_0xfd3d('0x1f')]?_0xadd699[_0xfd3d('0x1f')][_0xfd3d('0x20')]===undefined?!![]:![]:!![],'where':_0xadd699[_0xfd3d('0x1f')]?_0xadd699['options']['where']||null:null,'attributes':_0xadd699[_0xfd3d('0x1f')]?_0xadd699[_0xfd3d('0x1f')]['attributes']||null:null,'include':_0xadd699['options']?_0xadd699[_0xfd3d('0x1f')]['include']?_[_0xfd3d('0x25')](_0xadd699[_0xfd3d('0x1f')][_0xfd3d('0x23')],function(_0x209414){return{'model':db[_0x209414[_0xfd3d('0x26')]],'as':_0x209414['as'],'attributes':_0x209414['attributes'],'include':_0x209414[_0xfd3d('0x23')]?_[_0xfd3d('0x25')](_0x209414[_0xfd3d('0x23')],function(_0x5ca123){return{'model':db[_0x5ca123[_0xfd3d('0x26')]],'as':_0x5ca123['as'],'attributes':_0x5ca123['attributes'],'include':_0x5ca123[_0xfd3d('0x23')]?_[_0xfd3d('0x25')](_0x5ca123[_0xfd3d('0x23')],function(_0x289d5f){return{'model':db[_0x289d5f[_0xfd3d('0x26')]],'as':_0x289d5f['as'],'attributes':_0x289d5f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd3d('0x27')](function(_0x5933e4){logger[_0xfd3d('0x11')]('ShowFaxQueue',_0xadd699);logger[_0xfd3d('0x14')]('ShowFaxQueue',_0xadd699,JSON['stringify'](_0x5933e4));_0x49610b(_0x5933e4);})[_0xfd3d('0x1b')](function(_0x6c162a){logger[_0xfd3d('0x17')](_0xfd3d('0x28'),_0x6c162a[_0xfd3d('0x19')],_0xadd699);_0x36948c(_0x3aa99e[_0xfd3d('0x17')](0x1f4,_0x6c162a[_0xfd3d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 151f587..57960d4 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 _0xe53e=['update','removeListener','faxQueue:','./faxQueue.events','remove'];(function(_0x59987a,_0x399e11){var _0x460646=function(_0x32c3c0){while(--_0x32c3c0){_0x59987a['push'](_0x59987a['shift']());}};_0x460646(++_0x399e11);}(_0xe53e,0x11b));var _0xee53=function(_0x572370,_0x542384){_0x572370=_0x572370-0x0;var _0x14d304=_0xe53e[_0x572370];return _0x14d304;};'use strict';var FaxQueueEvents=require(_0xee53('0x0'));var events=['save',_0xee53('0x1'),_0xee53('0x2')];function createListener(_0x517f0b,_0x36a9ce){return function(_0x101a11){_0x36a9ce['emit'](_0x517f0b,_0x101a11);};}function removeListener(_0x3b09a8,_0x3adb6f){return function(){FaxQueueEvents[_0xee53('0x3')](_0x3b09a8,_0x3adb6f);};}exports['register']=function(_0x57331a){for(var _0x562989=0x0,_0x1c816e=events['length'];_0x562989<_0x1c816e;_0x562989++){var _0x25fc90=events[_0x562989];var _0x5b02f7=createListener(_0xee53('0x4')+_0x25fc90,_0x57331a);FaxQueueEvents['on'](_0x25fc90,_0x5b02f7);}}; \ No newline at end of file +var _0x0cf7=['length','save','remove','update','emit','removeListener'];(function(_0x56734f,_0x28c3cf){var _0x34b752=function(_0x5a4e8d){while(--_0x5a4e8d){_0x56734f['push'](_0x56734f['shift']());}};_0x34b752(++_0x28c3cf);}(_0x0cf7,0xe5));var _0x70cf=function(_0x385cb8,_0x1dd54a){_0x385cb8=_0x385cb8-0x0;var _0x3d96d2=_0x0cf7[_0x385cb8];return _0x3d96d2;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x70cf('0x0'),_0x70cf('0x1'),_0x70cf('0x2')];function createListener(_0x283ef7,_0x1d8942){return function(_0xac88f5){_0x1d8942[_0x70cf('0x3')](_0x283ef7,_0xac88f5);};}function removeListener(_0xed5fb6,_0x2e6f13){return function(){FaxQueueEvents[_0x70cf('0x4')](_0xed5fb6,_0x2e6f13);};}exports['register']=function(_0x456a4d){for(var _0x2f102c=0x0,_0x5b3383=events[_0x70cf('0x5')];_0x2f102c<_0x5b3383;_0x2f102c++){var _0xfa6cbc=events[_0x2f102c];var _0x30b136=createListener('faxQueue:'+_0xfa6cbc,_0x456a4d);FaxQueueEvents['on'](_0xfa6cbc,_0x30b136);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b88550e..7b6b579 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 _0xf69c=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','removeTeams','delete','removeAgents','exports','multer'];(function(_0x4a3d11,_0x2d2381){var _0x47e2e8=function(_0x1e6034){while(--_0x1e6034){_0x4a3d11['push'](_0x4a3d11['shift']());}};_0x47e2e8(++_0x2d2381);}(_0xf69c,0x151));var _0xcf69=function(_0x9682c,_0x21f496){_0x9682c=_0x9682c-0x0;var _0x124f9d=_0xf69c[_0x9682c];return _0x124f9d;};'use strict';var multer=require(_0xcf69('0x0'));var util=require('util');var path=require(_0xcf69('0x1'));var timeout=require(_0xcf69('0x2'));var express=require('express');var router=express[_0xcf69('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcf69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf69('0x5'));var controller=require('./faxQueue.controller');router[_0xcf69('0x6')]('/',auth[_0xcf69('0x7')](),controller[_0xcf69('0x8')]);router[_0xcf69('0x6')](_0xcf69('0x9'),auth['isAuthenticated'](),controller[_0xcf69('0xa')]);router[_0xcf69('0x6')](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller['show']);router[_0xcf69('0x6')](_0xcf69('0xc'),auth[_0xcf69('0x7')](),controller[_0xcf69('0xd')]);router[_0xcf69('0x6')](_0xcf69('0xe'),auth['isAuthenticated'](),controller[_0xcf69('0xf')]);router['get'](_0xcf69('0x10'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x11')]);router[_0xcf69('0x12')]('/',auth[_0xcf69('0x7')](),controller[_0xcf69('0x13')]);router[_0xcf69('0x12')](_0xcf69('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xcf69('0x7')](),controller['addAgents']);router[_0xcf69('0x14')](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x15')]);router['delete'](_0xcf69('0xb'),auth[_0xcf69('0x7')](),controller['destroy']);router['delete'](_0xcf69('0xe'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x16')]);router[_0xcf69('0x17')](_0xcf69('0x10'),auth[_0xcf69('0x7')](),controller[_0xcf69('0x18')]);module[_0xcf69('0x19')]=router; \ No newline at end of file +var _0x41d0=['addTeams','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getTeams','/:id/users','getAgents','post','create','/:id/teams'];(function(_0x5ec5ed,_0x1a1520){var _0x209bb9=function(_0x23fde1){while(--_0x23fde1){_0x5ec5ed['push'](_0x5ec5ed['shift']());}};_0x209bb9(++_0x1a1520);}(_0x41d0,0x1c6));var _0x041d=function(_0x221e3f,_0x2dd056){_0x221e3f=_0x221e3f-0x0;var _0x3c3a75=_0x41d0[_0x221e3f];return _0x3c3a75;};'use strict';var multer=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var path=require(_0x041d('0x2'));var timeout=require(_0x041d('0x3'));var express=require('express');var router=express[_0x041d('0x4')]();var fs_extra=require(_0x041d('0x5'));var auth=require(_0x041d('0x6'));var interaction=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var controller=require(_0x041d('0x9'));router[_0x041d('0xa')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0xc')]);router['get'](_0x041d('0xd'),auth['isAuthenticated'](),controller[_0x041d('0xe')]);router['get'](_0x041d('0xf'),auth[_0x041d('0xb')](),controller['show']);router['get']('/:id/members',auth[_0x041d('0xb')](),controller['getMembers']);router[_0x041d('0xa')]('/:id/teams',auth[_0x041d('0xb')](),controller[_0x041d('0x10')]);router[_0x041d('0xa')](_0x041d('0x11'),auth[_0x041d('0xb')](),controller[_0x041d('0x12')]);router[_0x041d('0x13')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0x14')]);router['post'](_0x041d('0x15'),auth[_0x041d('0xb')](),controller[_0x041d('0x16')]);router[_0x041d('0x13')](_0x041d('0x11'),auth[_0x041d('0xb')](),controller['addAgents']);router[_0x041d('0x17')](_0x041d('0xf'),auth[_0x041d('0xb')](),controller[_0x041d('0x18')]);router[_0x041d('0x19')](_0x041d('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0x041d('0x19')](_0x041d('0x15'),auth['isAuthenticated'](),controller[_0x041d('0x1a')]);router['delete'](_0x041d('0x11'),auth[_0x041d('0xb')](),controller[_0x041d('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 26e50ce..3bdb4fe 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 _0xbe4d=['exports','STRING','DATE','sequelize'];(function(_0x59bd6a,_0x540db8){var _0x54ffd0=function(_0x2549d0){while(--_0x2549d0){_0x59bd6a['push'](_0x59bd6a['shift']());}};_0x54ffd0(++_0x540db8);}(_0xbe4d,0xff));var _0xdbe4=function(_0x5a1d76,_0x391e1c){_0x5a1d76=_0x5a1d76-0x0;var _0x34e7d6=_0xbe4d[_0x5a1d76];return _0x34e7d6;};'use strict';var moment=require('moment');var Sequelize=require(_0xdbe4('0x0'));module[_0xdbe4('0x1')]={'uniqueid':{'type':Sequelize[_0xdbe4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdbe4('0x3')]},'leaveAt':{'type':Sequelize[_0xdbe4('0x3')]},'acceptAt':{'type':Sequelize[_0xdbe4('0x3')]},'exitAt':{'type':Sequelize[_0xdbe4('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd48=['STRING','DATE','moment','sequelize','exports'];(function(_0x1d8409,_0x3ed12e){var _0x16374c=function(_0xdedbf0){while(--_0xdedbf0){_0x1d8409['push'](_0x1d8409['shift']());}};_0x16374c(++_0x3ed12e);}(_0xbd48,0x124));var _0x8bd4=function(_0x2077e6,_0x1ae253){_0x2077e6=_0x2077e6-0x0;var _0x16f64c=_0xbd48[_0x2077e6];return _0x16f64c;};'use strict';var moment=require(_0x8bd4('0x0'));var Sequelize=require(_0x8bd4('0x1'));module[_0x8bd4('0x2')]={'uniqueid':{'type':Sequelize[_0x8bd4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8bd4('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8bd4('0x4')]},'acceptAt':{'type':Sequelize[_0x8bd4('0x4')]},'exitAt':{'type':Sequelize[_0x8bd4('0x4')]},'reason':{'type':Sequelize[_0x8bd4('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 17d35fa..a46e613 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 _0x90ae=['FaxQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map'];(function(_0x837cfd,_0x57f698){var _0x712007=function(_0x334581){while(--_0x334581){_0x837cfd['push'](_0x837cfd['shift']());}};_0x712007(++_0x57f698);}(_0x90ae,0x195));var _0xe90a=function(_0x3cc9b5,_0x55a2aa){_0x3cc9b5=_0x3cc9b5-0x0;var _0x27ac27=_0x90ae[_0x3cc9b5];return _0x27ac27;};'use strict';var emlformat=require(_0xe90a('0x0'));var rimraf=require(_0xe90a('0x1'));var zipdir=require(_0xe90a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe90a('0x3'));var moment=require(_0xe90a('0x4'));var BPromise=require(_0xe90a('0x5'));var Mustache=require(_0xe90a('0x6'));var util=require(_0xe90a('0x7'));var path=require(_0xe90a('0x8'));var sox=require(_0xe90a('0x9'));var csv=require(_0xe90a('0xa'));var ejs=require(_0xe90a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe90a('0xc'));var squel=require(_0xe90a('0xd'));var crypto=require(_0xe90a('0xe'));var jsforce=require(_0xe90a('0xf'));var deskjs=require(_0xe90a('0x10'));var toCsv=require(_0xe90a('0xa'));var querystring=require('querystring');var Papa=require(_0xe90a('0x11'));var Redis=require(_0xe90a('0x12'));var authService=require(_0xe90a('0x13'));var qs=require(_0xe90a('0x14'));var as=require(_0xe90a('0x15'));var hardwareService=require(_0xe90a('0x16'));var logger=require(_0xe90a('0x17'))('api');var utils=require(_0xe90a('0x18'));var config=require(_0xe90a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c2176,_0x2ffd2c){_0x2ffd2c=_0x2ffd2c||0xcc;return function(_0x54d1ce){if(_0x54d1ce){return _0x1c2176[_0xe90a('0x1a')](_0x2ffd2c);}return _0x1c2176[_0xe90a('0x1b')](_0x2ffd2c)[_0xe90a('0x1c')]();};}function respondWithResult(_0x5e550e,_0x2e9d5f){_0x2e9d5f=_0x2e9d5f||0xc8;return function(_0x3d845e){if(_0x3d845e){return _0x5e550e['status'](_0x2e9d5f)[_0xe90a('0x1d')](_0x3d845e);}};}function respondWithFilteredResult(_0x53969d,_0x5342d7){return function(_0x497708){if(_0x497708){var _0x3061fb=typeof _0x5342d7[_0xe90a('0x1e')]===_0xe90a('0x1f')&&typeof _0x5342d7[_0xe90a('0x20')]===_0xe90a('0x1f');var _0x417d80=_0x497708[_0xe90a('0x21')];var _0x1363cd=_0x3061fb?0x0:_0x5342d7[_0xe90a('0x1e')];var _0x80477a=_0x3061fb?_0x497708[_0xe90a('0x21')]:_0x5342d7[_0xe90a('0x1e')]+_0x5342d7[_0xe90a('0x20')];var _0x5d6b81;if(_0x80477a>=_0x417d80){_0x80477a=_0x417d80;_0x5d6b81=0xc8;}else{_0x5d6b81=0xce;}_0x53969d[_0xe90a('0x1b')](_0x5d6b81);return _0x53969d[_0xe90a('0x22')](_0xe90a('0x23'),_0x1363cd+'-'+_0x80477a+'/'+_0x417d80)[_0xe90a('0x1d')](_0x497708);}return null;};}function patchUpdates(_0x4cfb63){return function(_0x41a0af){try{jsonpatch[_0xe90a('0x24')](_0x41a0af,_0x4cfb63,!![]);}catch(_0x32c085){return BPromise['reject'](_0x32c085);}return _0x41a0af[_0xe90a('0x25')]();};}function saveUpdates(_0xaccc92,_0x3c58cd){return function(_0x13d857){if(_0x13d857){return _0x13d857[_0xe90a('0x26')](_0xaccc92)[_0xe90a('0x27')](function(_0x5384b5){return _0x5384b5;});}return null;};}function removeEntity(_0x461c01,_0x4f8888){return function(_0x2f75c2){if(_0x2f75c2){return _0x2f75c2[_0xe90a('0x28')]()[_0xe90a('0x27')](function(){_0x461c01[_0xe90a('0x1b')](0xcc)[_0xe90a('0x1c')]();});}};}function handleEntityNotFound(_0x2eeda9,_0x57bede){return function(_0x157f2d){if(!_0x157f2d){_0x2eeda9[_0xe90a('0x1a')](0x194);}return _0x157f2d;};}function handleError(_0x4d1bec,_0x15a36b){_0x15a36b=_0x15a36b||0x1f4;return function(_0x334f5c){logger['error'](_0x334f5c[_0xe90a('0x29')]);if(_0x334f5c[_0xe90a('0x2a')]){delete _0x334f5c[_0xe90a('0x2a')];}_0x4d1bec[_0xe90a('0x1b')](_0x15a36b)['send'](_0x334f5c);};}exports[_0xe90a('0x2b')]=function(_0x2dc8e9,_0x58c11b){var _0x1bd5d7={},_0x44fc07={},_0x2dac6f={'count':0x0,'rows':[]};var _0x235a71=_[_0xe90a('0x2c')](db[_0xe90a('0x2d')]['rawAttributes'],function(_0x17dc3f){return{'name':_0x17dc3f[_0xe90a('0x2e')],'type':_0x17dc3f['type'][_0xe90a('0x2f')]};});_0x44fc07[_0xe90a('0x30')]=_[_0xe90a('0x2c')](_0x235a71,_0xe90a('0x2a'));_0x44fc07[_0xe90a('0x31')]=_[_0xe90a('0x32')](_0x2dc8e9[_0xe90a('0x31')]);_0x44fc07[_0xe90a('0x33')]=_['intersection'](_0x44fc07[_0xe90a('0x30')],_0x44fc07[_0xe90a('0x31')]);_0x1bd5d7[_0xe90a('0x34')]=_[_0xe90a('0x35')](_0x44fc07['model'],qs[_0xe90a('0x36')](_0x2dc8e9[_0xe90a('0x31')][_0xe90a('0x36')]));_0x1bd5d7[_0xe90a('0x34')]=_0x1bd5d7[_0xe90a('0x34')][_0xe90a('0x37')]?_0x1bd5d7[_0xe90a('0x34')]:_0x44fc07[_0xe90a('0x30')];if(!_0x2dc8e9[_0xe90a('0x31')]['hasOwnProperty']('nolimit')){_0x1bd5d7[_0xe90a('0x20')]=qs[_0xe90a('0x20')](_0x2dc8e9[_0xe90a('0x31')][_0xe90a('0x20')]);_0x1bd5d7['offset']=qs[_0xe90a('0x1e')](_0x2dc8e9[_0xe90a('0x31')][_0xe90a('0x1e')]);}_0x1bd5d7[_0xe90a('0x38')]=qs[_0xe90a('0x39')](_0x2dc8e9[_0xe90a('0x31')]['sort']);_0x1bd5d7[_0xe90a('0x3a')]=qs[_0xe90a('0x33')](_[_0xe90a('0x3b')](_0x2dc8e9[_0xe90a('0x31')],_0x44fc07['filters']),_0x235a71);if(_0x2dc8e9[_0xe90a('0x31')]['filter']){_0x1bd5d7[_0xe90a('0x3a')]=_[_0xe90a('0x3c')](_0x1bd5d7[_0xe90a('0x3a')],{'$or':_[_0xe90a('0x2c')](_0x235a71,function(_0x5a30aa){if(_0x5a30aa[_0xe90a('0x3d')]!==_0xe90a('0x3e')){var _0x1681e5={};_0x1681e5[_0x5a30aa['name']]={'$like':'%'+_0x2dc8e9['query']['filter']+'%'};return _0x1681e5;}})});}_0x1bd5d7=_[_0xe90a('0x3c')]({},_0x1bd5d7,_0x2dc8e9[_0xe90a('0x3f')]);var _0x471211={'where':_0x1bd5d7[_0xe90a('0x3a')]};return db['FaxQueueReport'][_0xe90a('0x21')](_0x471211)[_0xe90a('0x27')](function(_0x12c846){_0x2dac6f[_0xe90a('0x21')]=_0x12c846;if(_0x2dc8e9['query'][_0xe90a('0x40')]){_0x1bd5d7['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xe90a('0x41')](_0x1bd5d7);})['then'](function(_0x167de3){_0x2dac6f[_0xe90a('0x42')]=_0x167de3;return _0x2dac6f;})[_0xe90a('0x27')](respondWithFilteredResult(_0x58c11b,_0x1bd5d7))[_0xe90a('0x43')](handleError(_0x58c11b,null));};exports[_0xe90a('0x44')]=function(_0x14e259,_0x28e8a5){var _0x51fa72={'raw':!![],'where':{'id':_0x14e259[_0xe90a('0x45')]['id']}},_0x326652={};_0x326652['model']=_[_0xe90a('0x32')](db[_0xe90a('0x2d')][_0xe90a('0x46')]);_0x326652[_0xe90a('0x31')]=_['keys'](_0x14e259[_0xe90a('0x31')]);_0x326652[_0xe90a('0x33')]=_[_0xe90a('0x35')](_0x326652[_0xe90a('0x30')],_0x326652[_0xe90a('0x31')]);_0x51fa72[_0xe90a('0x34')]=_[_0xe90a('0x35')](_0x326652[_0xe90a('0x30')],qs[_0xe90a('0x36')](_0x14e259['query']['fields']));_0x51fa72['attributes']=_0x51fa72[_0xe90a('0x34')][_0xe90a('0x37')]?_0x51fa72[_0xe90a('0x34')]:_0x326652['model'];if(_0x14e259[_0xe90a('0x31')][_0xe90a('0x40')]){_0x51fa72['include']=[{'all':!![]}];}_0x51fa72=_[_0xe90a('0x3c')]({},_0x51fa72,_0x14e259[_0xe90a('0x3f')]);return db['FaxQueueReport'][_0xe90a('0x47')](_0x51fa72)['then'](handleEntityNotFound(_0x28e8a5,null))[_0xe90a('0x27')](respondWithResult(_0x28e8a5,null))[_0xe90a('0x43')](handleError(_0x28e8a5,null));};exports[_0xe90a('0x48')]=function(_0x2f1802,_0x5d6099){return db[_0xe90a('0x2d')][_0xe90a('0x48')](_0x2f1802['body'],{})['then'](respondWithResult(_0x5d6099,0xc9))[_0xe90a('0x43')](handleError(_0x5d6099,null));};exports[_0xe90a('0x26')]=function(_0x203aa6,_0x12c95b){if(_0x203aa6[_0xe90a('0x49')]['id']){delete _0x203aa6[_0xe90a('0x49')]['id'];}return db[_0xe90a('0x2d')][_0xe90a('0x47')]({'where':{'id':_0x203aa6[_0xe90a('0x45')]['id']}})[_0xe90a('0x27')](handleEntityNotFound(_0x12c95b,null))['then'](saveUpdates(_0x203aa6['body'],null))[_0xe90a('0x27')](respondWithResult(_0x12c95b,null))[_0xe90a('0x43')](handleError(_0x12c95b,null));};exports[_0xe90a('0x28')]=function(_0x2208ce,_0x5ae248){return db['FaxQueueReport'][_0xe90a('0x47')]({'where':{'id':_0x2208ce[_0xe90a('0x45')]['id']}})[_0xe90a('0x27')](handleEntityNotFound(_0x5ae248,null))[_0xe90a('0x27')](removeEntity(_0x5ae248,null))[_0xe90a('0x43')](handleError(_0x5ae248,null));};exports['describe']=function(_0x3b9e73,_0x2b8825){return db['FaxQueueReport'][_0xe90a('0x4a')]()['then'](respondWithResult(_0x2b8825,null))[_0xe90a('0x43')](handleError(_0x2b8825,null));}; \ No newline at end of file +var _0x44a3=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','map','keys','query','filters','intersection','attributes','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35dff8,_0x94094f){var _0x486bd0=function(_0x35d63a){while(--_0x35d63a){_0x35dff8['push'](_0x35dff8['shift']());}};_0x486bd0(++_0x94094f);}(_0x44a3,0x1a9));var _0x344a=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0x44a3[_0x5c84a6];return _0xb8c5f0;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){_0x90070c[_0x344a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5e49,_0x484f97){return function(_0x36c920){if(!_0x36c920){_0x2a5e49[_0x344a('0x17')](0x194);}return _0x36c920;};}function handleError(_0x2ebae9,_0x16d404){_0x16d404=_0x16d404||0x1f4;return function(_0x26f059){logger[_0x344a('0x27')](_0x26f059[_0x344a('0x28')]);if(_0x26f059[_0x344a('0x29')]){delete _0x26f059['name'];}_0x2ebae9[_0x344a('0x18')](_0x16d404)[_0x344a('0x2a')](_0x26f059);};}exports[_0x344a('0x2b')]=function(_0xc02d6,_0x14bd54){var _0x2d72c9={},_0x5b877d={},_0x3d25fe={'count':0x0,'rows':[]};var _0x49bbf8=_['map'](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x5a36bb){return{'name':_0x5a36bb['fieldName'],'type':_0x5a36bb['type']['key']};});_0x5b877d[_0x344a('0x2e')]=_[_0x344a('0x2f')](_0x49bbf8,_0x344a('0x29'));_0x5b877d['query']=_[_0x344a('0x30')](_0xc02d6[_0x344a('0x31')]);_0x5b877d[_0x344a('0x32')]=_[_0x344a('0x33')](_0x5b877d[_0x344a('0x2e')],_0x5b877d[_0x344a('0x31')]);_0x2d72c9[_0x344a('0x34')]=_['intersection'](_0x5b877d[_0x344a('0x2e')],qs['fields'](_0xc02d6['query']['fields']));_0x2d72c9[_0x344a('0x34')]=_0x2d72c9[_0x344a('0x34')][_0x344a('0x35')]?_0x2d72c9[_0x344a('0x34')]:_0x5b877d[_0x344a('0x2e')];if(!_0xc02d6[_0x344a('0x31')]['hasOwnProperty'](_0x344a('0x36'))){_0x2d72c9[_0x344a('0x1d')]=qs[_0x344a('0x1d')](_0xc02d6['query'][_0x344a('0x1d')]);_0x2d72c9[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0xc02d6[_0x344a('0x31')][_0x344a('0x1b')]);}_0x2d72c9['order']=qs[_0x344a('0x37')](_0xc02d6[_0x344a('0x31')][_0x344a('0x37')]);_0x2d72c9[_0x344a('0x38')]=qs[_0x344a('0x32')](_['pick'](_0xc02d6[_0x344a('0x31')],_0x5b877d[_0x344a('0x32')]),_0x49bbf8);if(_0xc02d6[_0x344a('0x31')][_0x344a('0x39')]){_0x2d72c9[_0x344a('0x38')]=_['merge'](_0x2d72c9[_0x344a('0x38')],{'$or':_[_0x344a('0x2f')](_0x49bbf8,function(_0x1f52dc){if(_0x1f52dc[_0x344a('0x3a')]!==_0x344a('0x3b')){var _0x27d2d5={};_0x27d2d5[_0x1f52dc[_0x344a('0x29')]]={'$like':'%'+_0xc02d6[_0x344a('0x31')]['filter']+'%'};return _0x27d2d5;}})});}_0x2d72c9=_[_0x344a('0x3c')]({},_0x2d72c9,_0xc02d6[_0x344a('0x3d')]);var _0x3d34c3={'where':_0x2d72c9[_0x344a('0x38')]};return db[_0x344a('0x2c')]['count'](_0x3d34c3)[_0x344a('0x25')](function(_0x2736e9){_0x3d25fe[_0x344a('0x1e')]=_0x2736e9;if(_0xc02d6[_0x344a('0x31')][_0x344a('0x3e')]){_0x2d72c9[_0x344a('0x3f')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x40')](_0x2d72c9);})[_0x344a('0x25')](function(_0x4b1bac){_0x3d25fe[_0x344a('0x41')]=_0x4b1bac;return _0x3d25fe;})[_0x344a('0x25')](respondWithFilteredResult(_0x14bd54,_0x2d72c9))[_0x344a('0x42')](handleError(_0x14bd54,null));};exports[_0x344a('0x43')]=function(_0x4f9dc2,_0x32bfa6){var _0x3069ca={'raw':!![],'where':{'id':_0x4f9dc2[_0x344a('0x44')]['id']}},_0x2b0ee9={};_0x2b0ee9[_0x344a('0x2e')]=_[_0x344a('0x30')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x2b0ee9[_0x344a('0x31')]=_[_0x344a('0x30')](_0x4f9dc2[_0x344a('0x31')]);_0x2b0ee9['filters']=_[_0x344a('0x33')](_0x2b0ee9[_0x344a('0x2e')],_0x2b0ee9['query']);_0x3069ca[_0x344a('0x34')]=_[_0x344a('0x33')](_0x2b0ee9['model'],qs[_0x344a('0x45')](_0x4f9dc2[_0x344a('0x31')]['fields']));_0x3069ca[_0x344a('0x34')]=_0x3069ca[_0x344a('0x34')][_0x344a('0x35')]?_0x3069ca['attributes']:_0x2b0ee9[_0x344a('0x2e')];if(_0x4f9dc2['query'][_0x344a('0x3e')]){_0x3069ca[_0x344a('0x3f')]=[{'all':!![]}];}_0x3069ca=_[_0x344a('0x3c')]({},_0x3069ca,_0x4f9dc2[_0x344a('0x3d')]);return db['FaxQueueReport']['find'](_0x3069ca)[_0x344a('0x25')](handleEntityNotFound(_0x32bfa6,null))[_0x344a('0x25')](respondWithResult(_0x32bfa6,null))[_0x344a('0x42')](handleError(_0x32bfa6,null));};exports[_0x344a('0x46')]=function(_0x300c9f,_0xa3c8f0){return db[_0x344a('0x2c')][_0x344a('0x46')](_0x300c9f[_0x344a('0x47')],{})[_0x344a('0x25')](respondWithResult(_0xa3c8f0,0xc9))['catch'](handleError(_0xa3c8f0,null));};exports[_0x344a('0x24')]=function(_0x2d9858,_0x6fad37){if(_0x2d9858[_0x344a('0x47')]['id']){delete _0x2d9858['body']['id'];}return db[_0x344a('0x2c')]['find']({'where':{'id':_0x2d9858['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x6fad37,null))[_0x344a('0x25')](saveUpdates(_0x2d9858['body'],null))[_0x344a('0x25')](respondWithResult(_0x6fad37,null))[_0x344a('0x42')](handleError(_0x6fad37,null));};exports[_0x344a('0x26')]=function(_0x226f41,_0x51e411){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x226f41[_0x344a('0x44')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x51e411,null))[_0x344a('0x25')](removeEntity(_0x51e411,null))[_0x344a('0x42')](handleError(_0x51e411,null));};exports[_0x344a('0x49')]=function(_0xe9fc2b,_0x292357){return db[_0x344a('0x2c')]['describe']()[_0x344a('0x25')](respondWithResult(_0x292357,null))['catch'](handleError(_0x292357,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5d0cbcd..2f68f76 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3c1a1e,_0x12a99f){var _0x2690a2=function(_0x2a2bc8){while(--_0x2a2bc8){_0x3c1a1e['push'](_0x3c1a1e['shift']());}};_0x2690a2(++_0x12a99f);}(_0xabce,0x103));var _0xeabc=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xabce[_0x4709c0];return _0x13348b;};'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('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37d675,_0x2d88f8){var _0x494cc4=function(_0x4eb364){while(--_0x4eb364){_0x37d675['push'](_0x37d675['shift']());}};_0x494cc4(++_0x2d88f8);}(_0x4975,0x86));var _0x5497=function(_0x3b1c41,_0x1fd134){_0x3b1c41=_0x3b1c41-0x0;var _0x1f9836=_0x4975[_0x3b1c41];return _0x1f9836;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9bf734e..8b991bc 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 _0xfafe=['stringify','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0x5b7d63,_0x3bf7d0){var _0x5163ce=function(_0x2526e2){while(--_0x2526e2){_0x5b7d63['push'](_0x5b7d63['shift']());}};_0x5163ce(++_0x3bf7d0);}(_0xfafe,0x185));var _0xefaf=function(_0x1039eb,_0x2f1513){_0x1039eb=_0x1039eb-0x0;var _0x15a082=_0xfafe[_0x1039eb];return _0x15a082;};'use strict';var _=require(_0xefaf('0x0'));var util=require(_0xefaf('0x1'));var moment=require(_0xefaf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefaf('0x3'))['db'];var utils=require(_0xefaf('0x4'));var logger=require(_0xefaf('0x5'))(_0xefaf('0x6'));var config=require(_0xefaf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xefaf('0x8')][_0xefaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5964af,_0x19de65,_0x237cd1){return new BPromise(function(_0xbadf47,_0x4bb46a){return client[_0xefaf('0xa')](_0x5964af,_0x237cd1)[_0xefaf('0xb')](function(_0x4e8523){logger[_0xefaf('0xc')](_0xefaf('0xd'),_0x19de65,'request\x20sent');logger[_0xefaf('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x19de65,_0xefaf('0xf'),JSON['stringify'](_0x4e8523));if(_0x4e8523[_0xefaf('0x10')]){if(_0x4e8523[_0xefaf('0x10')][_0xefaf('0x11')]===0x1f4){logger[_0xefaf('0x10')](_0xefaf('0xd'),_0x19de65,_0x4e8523[_0xefaf('0x10')][_0xefaf('0x12')]);return _0x4bb46a(_0x4e8523['error'][_0xefaf('0x12')]);}logger['error'](_0xefaf('0xd'),_0x19de65,_0x4e8523['error'][_0xefaf('0x12')]);return _0xbadf47(_0x4e8523[_0xefaf('0x10')][_0xefaf('0x12')]);}else{logger[_0xefaf('0xc')](_0xefaf('0xd'),_0x19de65,'request\x20sent');_0xbadf47(_0x4e8523[_0xefaf('0x13')][_0xefaf('0x12')]);}})[_0xefaf('0x14')](function(_0x4921d8){logger[_0xefaf('0x10')](_0xefaf('0xd'),_0x19de65,_0x4921d8);_0x4bb46a(_0x4921d8);});});}exports[_0xefaf('0x15')]=function(_0x1a54e6){var _0x5bc856=this;return new Promise(function(_0x27395f,_0x976f94){return db[_0xefaf('0x16')][_0xefaf('0x17')](_0x1a54e6[_0xefaf('0x18')],{'raw':_0x1a54e6[_0xefaf('0x19')]?_0x1a54e6['options'][_0xefaf('0x1a')]===undefined?!![]:![]:!![]})[_0xefaf('0xb')](function(_0x2ea64c){logger[_0xefaf('0xc')]('CreateFaxQueueReport',_0x1a54e6);logger[_0xefaf('0xe')](_0xefaf('0x15'),_0x1a54e6,JSON[_0xefaf('0x1b')](_0x2ea64c));_0x27395f(_0x2ea64c);})[_0xefaf('0x14')](function(_0xabb81f){logger[_0xefaf('0x10')](_0xefaf('0x15'),_0xabb81f['message'],_0x1a54e6);_0x976f94(_0x5bc856[_0xefaf('0x10')](0x1f4,_0xabb81f['message']));});});};exports['UpdateFaxQueueReport']=function(_0x1c3ac9){var _0x3c87a1=this;return new Promise(function(_0xaabe5d,_0x47bcb3){return db[_0xefaf('0x16')]['update'](_0x1c3ac9[_0xefaf('0x18')],{'raw':_0x1c3ac9[_0xefaf('0x19')]?_0x1c3ac9[_0xefaf('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c3ac9[_0xefaf('0x19')]?_0x1c3ac9[_0xefaf('0x19')][_0xefaf('0x1c')]||null:null,'attributes':_0x1c3ac9[_0xefaf('0x19')]?_0x1c3ac9[_0xefaf('0x19')][_0xefaf('0x1d')]||null:null,'limit':_0x1c3ac9[_0xefaf('0x19')]?_0x1c3ac9[_0xefaf('0x19')][_0xefaf('0x1e')]||null:null})[_0xefaf('0xb')](function(_0x1489d6){logger['info']('UpdateFaxQueueReport',_0x1c3ac9);logger['debug'](_0xefaf('0x1f'),_0x1c3ac9,JSON['stringify'](_0x1489d6));_0xaabe5d(_0x1489d6);})[_0xefaf('0x14')](function(_0x2673c1){logger[_0xefaf('0x10')]('UpdateFaxQueueReport',_0x2673c1[_0xefaf('0x12')],_0x1c3ac9);_0x47bcb3(_0x3c87a1[_0xefaf('0x10')](0x1f4,_0x2673c1[_0xefaf('0x12')]));});});}; \ No newline at end of file +var _0x9608=['http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x5be599,_0x5263fc){var _0x2708ae=function(_0x3ebd40){while(--_0x3ebd40){_0x5be599['push'](_0x5be599['shift']());}};_0x2708ae(++_0x5263fc);}(_0x9608,0x16c));var _0x8960=function(_0x50ae1d,_0x9bea6c){_0x50ae1d=_0x50ae1d-0x0;var _0x4b03f1=_0x9608[_0x50ae1d];return _0x4b03f1;};'use strict';var _=require(_0x8960('0x0'));var util=require(_0x8960('0x1'));var moment=require(_0x8960('0x2'));var BPromise=require(_0x8960('0x3'));var rs=require(_0x8960('0x4'));var fs=require('fs');var Redis=require(_0x8960('0x5'));var db=require(_0x8960('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8960('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8960('0x8'));var client=jayson[_0x8960('0x9')][_0x8960('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14670a,_0x21b462,_0x5bfb58){return new BPromise(function(_0x2ca0f3,_0x6a4b64){return client[_0x8960('0xb')](_0x14670a,_0x5bfb58)['then'](function(_0x4108df){logger[_0x8960('0xc')](_0x8960('0xd'),_0x21b462,'request\x20sent');logger[_0x8960('0xe')](_0x8960('0xf'),_0x21b462,_0x8960('0x10'),JSON[_0x8960('0x11')](_0x4108df));if(_0x4108df[_0x8960('0x12')]){if(_0x4108df[_0x8960('0x12')][_0x8960('0x13')]===0x1f4){logger[_0x8960('0x12')](_0x8960('0xd'),_0x21b462,_0x4108df[_0x8960('0x12')][_0x8960('0x14')]);return _0x6a4b64(_0x4108df[_0x8960('0x12')]['message']);}logger['error'](_0x8960('0xd'),_0x21b462,_0x4108df['error']['message']);return _0x2ca0f3(_0x4108df[_0x8960('0x12')][_0x8960('0x14')]);}else{logger[_0x8960('0xc')](_0x8960('0xd'),_0x21b462,_0x8960('0x10'));_0x2ca0f3(_0x4108df[_0x8960('0x15')]['message']);}})[_0x8960('0x16')](function(_0x20a5e8){logger[_0x8960('0x12')](_0x8960('0xd'),_0x21b462,_0x20a5e8);_0x6a4b64(_0x20a5e8);});});}exports[_0x8960('0x17')]=function(_0xaa752f){var _0x3fc033=this;return new Promise(function(_0x1c1bc2,_0x10c2a1){return db[_0x8960('0x18')][_0x8960('0x19')](_0xaa752f[_0x8960('0x1a')],{'raw':_0xaa752f[_0x8960('0x1b')]?_0xaa752f[_0x8960('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8960('0x1c')](function(_0x2c93da){logger[_0x8960('0xc')](_0x8960('0x17'),_0xaa752f);logger[_0x8960('0xe')]('CreateFaxQueueReport',_0xaa752f,JSON[_0x8960('0x11')](_0x2c93da));_0x1c1bc2(_0x2c93da);})[_0x8960('0x16')](function(_0x1ac2cb){logger[_0x8960('0x12')]('CreateFaxQueueReport',_0x1ac2cb[_0x8960('0x14')],_0xaa752f);_0x10c2a1(_0x3fc033[_0x8960('0x12')](0x1f4,_0x1ac2cb[_0x8960('0x14')]));});});};exports[_0x8960('0x1d')]=function(_0x19cba7){var _0x7088ed=this;return new Promise(function(_0x5a53c7,_0x1ef1c9){return db[_0x8960('0x18')][_0x8960('0x1e')](_0x19cba7[_0x8960('0x1a')],{'raw':_0x19cba7[_0x8960('0x1b')]?_0x19cba7[_0x8960('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cba7[_0x8960('0x1b')]?_0x19cba7['options'][_0x8960('0x1f')]||null:null,'attributes':_0x19cba7[_0x8960('0x1b')]?_0x19cba7[_0x8960('0x1b')][_0x8960('0x20')]||null:null,'limit':_0x19cba7[_0x8960('0x1b')]?_0x19cba7[_0x8960('0x1b')][_0x8960('0x21')]||null:null})[_0x8960('0x1c')](function(_0x346d33){logger[_0x8960('0xc')](_0x8960('0x1d'),_0x19cba7);logger[_0x8960('0xe')]('UpdateFaxQueueReport',_0x19cba7,JSON['stringify'](_0x346d33));_0x5a53c7(_0x346d33);})[_0x8960('0x16')](function(_0x14933b){logger[_0x8960('0x12')](_0x8960('0x1d'),_0x14933b['message'],_0x19cba7);_0x1ef1c9(_0x7088ed[_0x8960('0x12')](0x1f4,_0x14933b[_0x8960('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a0d4f54..b64ec64 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 _0x047c=['Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4f7bf9,_0x497309){var _0x5981a1=function(_0x5471c0){while(--_0x5471c0){_0x4f7bf9['push'](_0x4f7bf9['shift']());}};_0x5981a1(++_0x497309);}(_0x047c,0xb0));var _0xc047=function(_0x18197d,_0x233a0d){_0x18197d=_0x18197d-0x0;var _0x2c78e0=_0x047c[_0x18197d];return _0x2c78e0;};'use strict';var multer=require(_0xc047('0x0'));var util=require('util');var path=require(_0xc047('0x1'));var timeout=require(_0xc047('0x2'));var express=require(_0xc047('0x3'));var router=express[_0xc047('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc047('0x5'));var interaction=require(_0xc047('0x6'));var config=require('../../config/environment');var controller=require(_0xc047('0x7'));router[_0xc047('0x8')]('/',auth[_0xc047('0x9')](),controller['index']);router[_0xc047('0x8')]('/describe',auth[_0xc047('0x9')](),controller[_0xc047('0xa')]);router[_0xc047('0x8')](_0xc047('0xb'),auth[_0xc047('0x9')](),controller[_0xc047('0xc')]);router[_0xc047('0xd')]('/',auth[_0xc047('0x9')](),controller['create']);router[_0xc047('0xe')](_0xc047('0xb'),auth[_0xc047('0x9')](),controller['update']);router[_0xc047('0xf')](_0xc047('0xb'),auth['isAuthenticated'](),controller[_0xc047('0x10')]);module[_0xc047('0x11')]=router; \ No newline at end of file +var _0x6d10=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports'];(function(_0x4e0611,_0x3af735){var _0x295545=function(_0x5410c1){while(--_0x5410c1){_0x4e0611['push'](_0x4e0611['shift']());}};_0x295545(++_0x3af735);}(_0x6d10,0x19e));var _0x06d1=function(_0xcc9846,_0x415ef5){_0xcc9846=_0xcc9846-0x0;var _0x3a80ab=_0x6d10[_0xcc9846];return _0x3a80ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x06d1('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x06d1('0x1')]();var fs_extra=require(_0x06d1('0x2'));var auth=require(_0x06d1('0x3'));var interaction=require(_0x06d1('0x4'));var config=require('../../config/environment');var controller=require(_0x06d1('0x5'));router[_0x06d1('0x6')]('/',auth['isAuthenticated'](),controller[_0x06d1('0x7')]);router['get'](_0x06d1('0x8'),auth[_0x06d1('0x9')](),controller[_0x06d1('0xa')]);router[_0x06d1('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x06d1('0xb')]('/',auth[_0x06d1('0x9')](),controller[_0x06d1('0xc')]);router[_0x06d1('0xd')](_0x06d1('0xe'),auth[_0x06d1('0x9')](),controller[_0x06d1('0xf')]);router['delete'](_0x06d1('0xe'),auth[_0x06d1('0x9')](),controller[_0x06d1('0x10')]);module[_0x06d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d51ab81..b42bbb5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e295e,_0x481d47){_0x4e295e=_0x4e295e-0x0;var _0xd0e70a=_0x9bde[_0x4e295e];return _0xd0e70a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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 e9fcc9e..8dbb4e1 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 _0xd879=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','include','FaxTransferReport','findAll','show','params','includeAll','options','create','body','catch','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','json','offset','undefined','count','limit','set','reject','update','then','end','error','stack','send','index','map','rawAttributes','fieldName','type','model','name'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xd879,0x1d7));var _0x9d87=function(_0x664bc7,_0x17e7e6){_0x664bc7=_0x664bc7-0x0;var _0xa5dd30=_0xd879[_0x664bc7];return _0xa5dd30;};'use strict';var emlformat=require(_0x9d87('0x0'));var rimraf=require(_0x9d87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d87('0x2'));var rp=require(_0x9d87('0x3'));var moment=require(_0x9d87('0x4'));var BPromise=require(_0x9d87('0x5'));var Mustache=require('mustache');var util=require(_0x9d87('0x6'));var path=require(_0x9d87('0x7'));var sox=require(_0x9d87('0x8'));var csv=require(_0x9d87('0x9'));var ejs=require(_0x9d87('0xa'));var fs=require('fs');var fs_extra=require(_0x9d87('0xb'));var _=require(_0x9d87('0xc'));var squel=require(_0x9d87('0xd'));var crypto=require(_0x9d87('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9d87('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9d87('0x10'));var Papa=require(_0x9d87('0x11'));var Redis=require(_0x9d87('0x12'));var authService=require(_0x9d87('0x13'));var qs=require(_0x9d87('0x14'));var as=require(_0x9d87('0x15'));var hardwareService=require(_0x9d87('0x16'));var logger=require(_0x9d87('0x17'))('api');var utils=require(_0x9d87('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae55b,_0x5434b8){_0x5434b8=_0x5434b8||0xcc;return function(_0x544c32){if(_0x544c32){return _0x4ae55b[_0x9d87('0x19')](_0x5434b8);}return _0x4ae55b[_0x9d87('0x1a')](_0x5434b8)['end']();};}function respondWithResult(_0x4e6f26,_0x4d6c6e){_0x4d6c6e=_0x4d6c6e||0xc8;return function(_0x5dc961){if(_0x5dc961){return _0x4e6f26[_0x9d87('0x1a')](_0x4d6c6e)[_0x9d87('0x1b')](_0x5dc961);}};}function respondWithFilteredResult(_0x57e718,_0x1bd793){return function(_0x1d39c9){if(_0x1d39c9){var _0x1adbf3=typeof _0x1bd793[_0x9d87('0x1c')]===_0x9d87('0x1d')&&typeof _0x1bd793['limit']==='undefined';var _0x5e641f=_0x1d39c9[_0x9d87('0x1e')];var _0xf14bcd=_0x1adbf3?0x0:_0x1bd793[_0x9d87('0x1c')];var _0x2e1232=_0x1adbf3?_0x1d39c9['count']:_0x1bd793[_0x9d87('0x1c')]+_0x1bd793[_0x9d87('0x1f')];var _0x235dab;if(_0x2e1232>=_0x5e641f){_0x2e1232=_0x5e641f;_0x235dab=0xc8;}else{_0x235dab=0xce;}_0x57e718[_0x9d87('0x1a')](_0x235dab);return _0x57e718[_0x9d87('0x20')]('Content-Range',_0xf14bcd+'-'+_0x2e1232+'/'+_0x5e641f)['json'](_0x1d39c9);}return null;};}function patchUpdates(_0xa439e4){return function(_0xe4b51d){try{jsonpatch['apply'](_0xe4b51d,_0xa439e4,!![]);}catch(_0x2231c0){return BPromise[_0x9d87('0x21')](_0x2231c0);}return _0xe4b51d['save']();};}function saveUpdates(_0x1fa998,_0x8b1e94){return function(_0x45a5c6){if(_0x45a5c6){return _0x45a5c6[_0x9d87('0x22')](_0x1fa998)[_0x9d87('0x23')](function(_0x2e9d72){return _0x2e9d72;});}return null;};}function removeEntity(_0x4a9d39,_0x856cbd){return function(_0x4c787b){if(_0x4c787b){return _0x4c787b['destroy']()[_0x9d87('0x23')](function(){_0x4a9d39[_0x9d87('0x1a')](0xcc)[_0x9d87('0x24')]();});}};}function handleEntityNotFound(_0x42f18a,_0x1822de){return function(_0x2ca2a6){if(!_0x2ca2a6){_0x42f18a['sendStatus'](0x194);}return _0x2ca2a6;};}function handleError(_0x4c841e,_0x28e42a){_0x28e42a=_0x28e42a||0x1f4;return function(_0x3c717d){logger[_0x9d87('0x25')](_0x3c717d[_0x9d87('0x26')]);if(_0x3c717d['name']){delete _0x3c717d['name'];}_0x4c841e[_0x9d87('0x1a')](_0x28e42a)[_0x9d87('0x27')](_0x3c717d);};}exports[_0x9d87('0x28')]=function(_0x4e9aee,_0x220626){var _0x2a19f4={},_0x22a422={},_0x5e25d4={'count':0x0,'rows':[]};var _0x15b475=_[_0x9d87('0x29')](db['FaxTransferReport'][_0x9d87('0x2a')],function(_0x175f98){return{'name':_0x175f98[_0x9d87('0x2b')],'type':_0x175f98[_0x9d87('0x2c')]['key']};});_0x22a422[_0x9d87('0x2d')]=_[_0x9d87('0x29')](_0x15b475,_0x9d87('0x2e'));_0x22a422['query']=_[_0x9d87('0x2f')](_0x4e9aee[_0x9d87('0x30')]);_0x22a422['filters']=_[_0x9d87('0x31')](_0x22a422[_0x9d87('0x2d')],_0x22a422[_0x9d87('0x30')]);_0x2a19f4[_0x9d87('0x32')]=_[_0x9d87('0x31')](_0x22a422['model'],qs[_0x9d87('0x33')](_0x4e9aee['query'][_0x9d87('0x33')]));_0x2a19f4[_0x9d87('0x32')]=_0x2a19f4[_0x9d87('0x32')][_0x9d87('0x34')]?_0x2a19f4['attributes']:_0x22a422[_0x9d87('0x2d')];if(!_0x4e9aee[_0x9d87('0x30')][_0x9d87('0x35')](_0x9d87('0x36'))){_0x2a19f4['limit']=qs[_0x9d87('0x1f')](_0x4e9aee[_0x9d87('0x30')]['limit']);_0x2a19f4[_0x9d87('0x1c')]=qs[_0x9d87('0x1c')](_0x4e9aee[_0x9d87('0x30')][_0x9d87('0x1c')]);}_0x2a19f4[_0x9d87('0x37')]=qs[_0x9d87('0x38')](_0x4e9aee[_0x9d87('0x30')][_0x9d87('0x38')]);_0x2a19f4[_0x9d87('0x39')]=qs[_0x9d87('0x3a')](_['pick'](_0x4e9aee[_0x9d87('0x30')],_0x22a422[_0x9d87('0x3a')]),_0x15b475);if(_0x4e9aee['query']['filter']){_0x2a19f4[_0x9d87('0x39')]=_[_0x9d87('0x3b')](_0x2a19f4[_0x9d87('0x39')],{'$or':_[_0x9d87('0x29')](_0x15b475,function(_0x315881){if(_0x315881[_0x9d87('0x2c')]!=='VIRTUAL'){var _0xe880e0={};_0xe880e0[_0x315881[_0x9d87('0x2e')]]={'$like':'%'+_0x4e9aee[_0x9d87('0x30')][_0x9d87('0x3c')]+'%'};return _0xe880e0;}})});}_0x2a19f4=_[_0x9d87('0x3b')]({},_0x2a19f4,_0x4e9aee['options']);var _0x3d0404={'where':_0x2a19f4['where']};return db['FaxTransferReport'][_0x9d87('0x1e')](_0x3d0404)[_0x9d87('0x23')](function(_0x25c215){_0x5e25d4[_0x9d87('0x1e')]=_0x25c215;if(_0x4e9aee[_0x9d87('0x30')]['includeAll']){_0x2a19f4[_0x9d87('0x3d')]=[{'all':!![]}];}return db[_0x9d87('0x3e')][_0x9d87('0x3f')](_0x2a19f4);})[_0x9d87('0x23')](function(_0xd23034){_0x5e25d4['rows']=_0xd23034;return _0x5e25d4;})[_0x9d87('0x23')](respondWithFilteredResult(_0x220626,_0x2a19f4))['catch'](handleError(_0x220626,null));};exports[_0x9d87('0x40')]=function(_0x191f02,_0x5e52e1){var _0x4fcb41={'raw':!![],'where':{'id':_0x191f02[_0x9d87('0x41')]['id']}},_0x499d0a={};_0x499d0a['model']=_['keys'](db['FaxTransferReport'][_0x9d87('0x2a')]);_0x499d0a[_0x9d87('0x30')]=_[_0x9d87('0x2f')](_0x191f02['query']);_0x499d0a[_0x9d87('0x3a')]=_[_0x9d87('0x31')](_0x499d0a['model'],_0x499d0a[_0x9d87('0x30')]);_0x4fcb41[_0x9d87('0x32')]=_[_0x9d87('0x31')](_0x499d0a[_0x9d87('0x2d')],qs[_0x9d87('0x33')](_0x191f02[_0x9d87('0x30')][_0x9d87('0x33')]));_0x4fcb41[_0x9d87('0x32')]=_0x4fcb41[_0x9d87('0x32')]['length']?_0x4fcb41['attributes']:_0x499d0a['model'];if(_0x191f02[_0x9d87('0x30')][_0x9d87('0x42')]){_0x4fcb41[_0x9d87('0x3d')]=[{'all':!![]}];}_0x4fcb41=_[_0x9d87('0x3b')]({},_0x4fcb41,_0x191f02[_0x9d87('0x43')]);return db[_0x9d87('0x3e')]['find'](_0x4fcb41)['then'](handleEntityNotFound(_0x5e52e1,null))[_0x9d87('0x23')](respondWithResult(_0x5e52e1,null))['catch'](handleError(_0x5e52e1,null));};exports[_0x9d87('0x44')]=function(_0x3d2f77,_0x16b3f5){return db['FaxTransferReport']['create'](_0x3d2f77[_0x9d87('0x45')],{})[_0x9d87('0x23')](respondWithResult(_0x16b3f5,0xc9))[_0x9d87('0x46')](handleError(_0x16b3f5,null));};exports[_0x9d87('0x22')]=function(_0x19df9c,_0xf02e0e){if(_0x19df9c[_0x9d87('0x45')]['id']){delete _0x19df9c['body']['id'];}return db['FaxTransferReport'][_0x9d87('0x47')]({'where':{'id':_0x19df9c[_0x9d87('0x41')]['id']}})['then'](handleEntityNotFound(_0xf02e0e,null))[_0x9d87('0x23')](saveUpdates(_0x19df9c[_0x9d87('0x45')],null))['then'](respondWithResult(_0xf02e0e,null))[_0x9d87('0x46')](handleError(_0xf02e0e,null));};exports[_0x9d87('0x48')]=function(_0x7b42d9,_0x2f68ce){return db['FaxTransferReport']['find']({'where':{'id':_0x7b42d9['params']['id']}})['then'](handleEntityNotFound(_0x2f68ce,null))[_0x9d87('0x23')](removeEntity(_0x2f68ce,null))[_0x9d87('0x46')](handleError(_0x2f68ce,null));};exports[_0x9d87('0x49')]=function(_0x24fdb9,_0x39dc84){return db[_0x9d87('0x3e')][_0x9d87('0x49')]()[_0x9d87('0x23')](respondWithResult(_0x39dc84,null))[_0x9d87('0x46')](handleError(_0x39dc84,null));}; \ No newline at end of file +var _0x88a4=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','catch','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','status','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x588a83,_0x145f98){var _0x51c0d4=function(_0x1b9c84){while(--_0x1b9c84){_0x588a83['push'](_0x588a83['shift']());}};_0x51c0d4(++_0x145f98);}(_0x88a4,0xb4));var _0x488a=function(_0x350786,_0x16d1a5){_0x350786=_0x350786-0x0;var _0x56a97e=_0x88a4[_0x350786];return _0x56a97e;};'use strict';var emlformat=require(_0x488a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x488a('0x1'));var rp=require(_0x488a('0x2'));var moment=require(_0x488a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x488a('0x4'));var sox=require(_0x488a('0x5'));var csv=require(_0x488a('0x6'));var ejs=require(_0x488a('0x7'));var fs=require('fs');var fs_extra=require(_0x488a('0x8'));var _=require('lodash');var squel=require(_0x488a('0x9'));var crypto=require(_0x488a('0xa'));var jsforce=require(_0x488a('0xb'));var deskjs=require(_0x488a('0xc'));var toCsv=require(_0x488a('0x6'));var querystring=require(_0x488a('0xd'));var Papa=require(_0x488a('0xe'));var Redis=require(_0x488a('0xf'));var authService=require(_0x488a('0x10'));var qs=require(_0x488a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x488a('0x12'));var utils=require('../../config/utils');var config=require(_0x488a('0x13'));var licenseUtil=require(_0x488a('0x14'));var db=require(_0x488a('0x15'))['db'];function respondWithStatusCode(_0x1a0103,_0x85c2ab){_0x85c2ab=_0x85c2ab||0xcc;return function(_0x34f422){if(_0x34f422){return _0x1a0103[_0x488a('0x16')](_0x85c2ab);}return _0x1a0103['status'](_0x85c2ab)[_0x488a('0x17')]();};}function respondWithResult(_0x4554c0,_0x5d436e){_0x5d436e=_0x5d436e||0xc8;return function(_0x42bc07){if(_0x42bc07){return _0x4554c0['status'](_0x5d436e)['json'](_0x42bc07);}};}function respondWithFilteredResult(_0x3febc8,_0x284c32){return function(_0x4b0153){if(_0x4b0153){var _0x28727b=typeof _0x284c32[_0x488a('0x18')]===_0x488a('0x19')&&typeof _0x284c32['limit']===_0x488a('0x19');var _0x2d479f=_0x4b0153[_0x488a('0x1a')];var _0x7b96b9=_0x28727b?0x0:_0x284c32[_0x488a('0x18')];var _0x262be4=_0x28727b?_0x4b0153['count']:_0x284c32[_0x488a('0x18')]+_0x284c32[_0x488a('0x1b')];var _0x364690;if(_0x262be4>=_0x2d479f){_0x262be4=_0x2d479f;_0x364690=0xc8;}else{_0x364690=0xce;}_0x3febc8['status'](_0x364690);return _0x3febc8[_0x488a('0x1c')](_0x488a('0x1d'),_0x7b96b9+'-'+_0x262be4+'/'+_0x2d479f)[_0x488a('0x1e')](_0x4b0153);}return null;};}function patchUpdates(_0x1b39a9){return function(_0x40d6a8){try{jsonpatch[_0x488a('0x1f')](_0x40d6a8,_0x1b39a9,!![]);}catch(_0xd2e7a1){return BPromise[_0x488a('0x20')](_0xd2e7a1);}return _0x40d6a8[_0x488a('0x21')]();};}function saveUpdates(_0x36b783,_0x541a75){return function(_0x187e6a){if(_0x187e6a){return _0x187e6a[_0x488a('0x22')](_0x36b783)[_0x488a('0x23')](function(_0x12eb84){return _0x12eb84;});}return null;};}function removeEntity(_0x220d89,_0x54a947){return function(_0x18506e){if(_0x18506e){return _0x18506e['destroy']()[_0x488a('0x23')](function(){_0x220d89['status'](0xcc)[_0x488a('0x17')]();});}};}function handleEntityNotFound(_0x1c3661,_0x507734){return function(_0x16f72b){if(!_0x16f72b){_0x1c3661[_0x488a('0x16')](0x194);}return _0x16f72b;};}function handleError(_0x398e07,_0x21b01e){_0x21b01e=_0x21b01e||0x1f4;return function(_0xcff690){logger[_0x488a('0x24')](_0xcff690['stack']);if(_0xcff690[_0x488a('0x25')]){delete _0xcff690[_0x488a('0x25')];}_0x398e07[_0x488a('0x26')](_0x21b01e)[_0x488a('0x27')](_0xcff690);};}exports[_0x488a('0x28')]=function(_0x4e7bae,_0x576b01){var _0x1af35f={},_0x446674={},_0x51a813={'count':0x0,'rows':[]};var _0x5821d4=_[_0x488a('0x29')](db[_0x488a('0x2a')][_0x488a('0x2b')],function(_0xe70863){return{'name':_0xe70863[_0x488a('0x2c')],'type':_0xe70863[_0x488a('0x2d')][_0x488a('0x2e')]};});_0x446674[_0x488a('0x2f')]=_[_0x488a('0x29')](_0x5821d4,_0x488a('0x25'));_0x446674[_0x488a('0x30')]=_[_0x488a('0x31')](_0x4e7bae['query']);_0x446674['filters']=_[_0x488a('0x32')](_0x446674['model'],_0x446674[_0x488a('0x30')]);_0x1af35f[_0x488a('0x33')]=_[_0x488a('0x32')](_0x446674[_0x488a('0x2f')],qs[_0x488a('0x34')](_0x4e7bae[_0x488a('0x30')]['fields']));_0x1af35f[_0x488a('0x33')]=_0x1af35f[_0x488a('0x33')]['length']?_0x1af35f[_0x488a('0x33')]:_0x446674[_0x488a('0x2f')];if(!_0x4e7bae[_0x488a('0x30')][_0x488a('0x35')](_0x488a('0x36'))){_0x1af35f['limit']=qs[_0x488a('0x1b')](_0x4e7bae[_0x488a('0x30')][_0x488a('0x1b')]);_0x1af35f[_0x488a('0x18')]=qs[_0x488a('0x18')](_0x4e7bae['query'][_0x488a('0x18')]);}_0x1af35f[_0x488a('0x37')]=qs[_0x488a('0x38')](_0x4e7bae[_0x488a('0x30')][_0x488a('0x38')]);_0x1af35f[_0x488a('0x39')]=qs[_0x488a('0x3a')](_[_0x488a('0x3b')](_0x4e7bae[_0x488a('0x30')],_0x446674[_0x488a('0x3a')]),_0x5821d4);if(_0x4e7bae[_0x488a('0x30')][_0x488a('0x3c')]){_0x1af35f[_0x488a('0x39')]=_[_0x488a('0x3d')](_0x1af35f[_0x488a('0x39')],{'$or':_[_0x488a('0x29')](_0x5821d4,function(_0x40a406){if(_0x40a406[_0x488a('0x2d')]!==_0x488a('0x3e')){var _0x54004c={};_0x54004c[_0x40a406[_0x488a('0x25')]]={'$like':'%'+_0x4e7bae[_0x488a('0x30')][_0x488a('0x3c')]+'%'};return _0x54004c;}})});}_0x1af35f=_[_0x488a('0x3d')]({},_0x1af35f,_0x4e7bae[_0x488a('0x3f')]);var _0x3b7fbe={'where':_0x1af35f[_0x488a('0x39')]};return db[_0x488a('0x2a')][_0x488a('0x1a')](_0x3b7fbe)[_0x488a('0x23')](function(_0x4ec1fc){_0x51a813[_0x488a('0x1a')]=_0x4ec1fc;if(_0x4e7bae[_0x488a('0x30')]['includeAll']){_0x1af35f[_0x488a('0x40')]=[{'all':!![]}];}return db[_0x488a('0x2a')]['findAll'](_0x1af35f);})[_0x488a('0x23')](function(_0x1ecc18){_0x51a813[_0x488a('0x41')]=_0x1ecc18;return _0x51a813;})[_0x488a('0x23')](respondWithFilteredResult(_0x576b01,_0x1af35f))['catch'](handleError(_0x576b01,null));};exports[_0x488a('0x42')]=function(_0x48e49f,_0x21a64a){var _0xb2e23={'raw':!![],'where':{'id':_0x48e49f[_0x488a('0x43')]['id']}},_0x3d0414={};_0x3d0414[_0x488a('0x2f')]=_[_0x488a('0x31')](db[_0x488a('0x2a')][_0x488a('0x2b')]);_0x3d0414[_0x488a('0x30')]=_[_0x488a('0x31')](_0x48e49f[_0x488a('0x30')]);_0x3d0414[_0x488a('0x3a')]=_['intersection'](_0x3d0414[_0x488a('0x2f')],_0x3d0414[_0x488a('0x30')]);_0xb2e23[_0x488a('0x33')]=_[_0x488a('0x32')](_0x3d0414[_0x488a('0x2f')],qs['fields'](_0x48e49f[_0x488a('0x30')][_0x488a('0x34')]));_0xb2e23['attributes']=_0xb2e23[_0x488a('0x33')][_0x488a('0x44')]?_0xb2e23['attributes']:_0x3d0414[_0x488a('0x2f')];if(_0x48e49f['query'][_0x488a('0x45')]){_0xb2e23[_0x488a('0x40')]=[{'all':!![]}];}_0xb2e23=_[_0x488a('0x3d')]({},_0xb2e23,_0x48e49f[_0x488a('0x3f')]);return db[_0x488a('0x2a')][_0x488a('0x46')](_0xb2e23)['then'](handleEntityNotFound(_0x21a64a,null))['then'](respondWithResult(_0x21a64a,null))[_0x488a('0x47')](handleError(_0x21a64a,null));};exports[_0x488a('0x48')]=function(_0x291e79,_0x35d902){return db[_0x488a('0x2a')][_0x488a('0x48')](_0x291e79[_0x488a('0x49')],{})[_0x488a('0x23')](respondWithResult(_0x35d902,0xc9))['catch'](handleError(_0x35d902,null));};exports[_0x488a('0x22')]=function(_0x302e83,_0x21ca72){if(_0x302e83[_0x488a('0x49')]['id']){delete _0x302e83[_0x488a('0x49')]['id'];}return db[_0x488a('0x2a')]['find']({'where':{'id':_0x302e83[_0x488a('0x43')]['id']}})[_0x488a('0x23')](handleEntityNotFound(_0x21ca72,null))[_0x488a('0x23')](saveUpdates(_0x302e83[_0x488a('0x49')],null))['then'](respondWithResult(_0x21ca72,null))[_0x488a('0x47')](handleError(_0x21ca72,null));};exports[_0x488a('0x4a')]=function(_0x44449a,_0x566e2d){return db[_0x488a('0x2a')][_0x488a('0x46')]({'where':{'id':_0x44449a[_0x488a('0x43')]['id']}})[_0x488a('0x23')](handleEntityNotFound(_0x566e2d,null))['then'](removeEntity(_0x566e2d,null))[_0x488a('0x47')](handleError(_0x566e2d,null));};exports['describe']=function(_0x2b74fa,_0x4436cf){return db[_0x488a('0x2a')][_0x488a('0x4b')]()['then'](respondWithResult(_0x4436cf,null))[_0x488a('0x47')](handleError(_0x4436cf,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 80c2414..ce86e1f 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 _0x8aea=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8aea,0x7a));var _0xa8ae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8aea[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa8ae('0x0'));var util=require(_0xa8ae('0x1'));var logger=require(_0xa8ae('0x2'))('api');var moment=require(_0xa8ae('0x3'));var BPromise=require(_0xa8ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8ae('0x5'));var rimraf=require(_0xa8ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xa8ae('0x7'));module[_0xa8ae('0x8')]=function(_0x5cedbe,_0x48cf1a){return _0x5cedbe['define'](_0xa8ae('0x9'),attributes,{'tableName':_0xa8ae('0xa'),'paranoid':![],'indexes':[{'name':_0xa8ae('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2652=['../../config/environment','./faxTransferReport.attributes','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2652,0x1e1));var _0x2265=function(_0x1f14af,_0x37c7bf){_0x1f14af=_0x1f14af-0x0;var _0x3d2cf5=_0x2652[_0x1f14af];return _0x3d2cf5;};'use strict';var _=require(_0x2265('0x0'));var util=require(_0x2265('0x1'));var logger=require(_0x2265('0x2'))(_0x2265('0x3'));var moment=require(_0x2265('0x4'));var BPromise=require(_0x2265('0x5'));var rp=require(_0x2265('0x6'));var fs=require('fs');var path=require(_0x2265('0x7'));var rimraf=require(_0x2265('0x8'));var config=require(_0x2265('0x9'));var attributes=require(_0x2265('0xa'));module['exports']=function(_0x4134a0,_0x5aa1b2){return _0x4134a0['define'](_0x2265('0xb'),attributes,{'tableName':_0x2265('0xc'),'paranoid':![],'indexes':[{'name':_0x2265('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a8a64d7..92b1fbc 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 _0xdd0f=['message','result','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xdd0f,0x17e));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfdd0('0x0'));var util=require(_0xfdd0('0x1'));var moment=require(_0xfdd0('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(_0xfdd0('0x3'));var logger=require(_0xfdd0('0x4'))(_0xfdd0('0x5'));var config=require(_0xfdd0('0x6'));var jayson=require(_0xfdd0('0x7'));var client=jayson[_0xfdd0('0x8')][_0xfdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15b63e,_0x3e7bfb,_0x3a1ee9){return new BPromise(function(_0x55a2d6,_0x41feb8){return client[_0xfdd0('0xa')](_0x15b63e,_0x3a1ee9)['then'](function(_0x36dd21){logger[_0xfdd0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3e7bfb,'request\x20sent');logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3e7bfb,_0xfdd0('0xc'),JSON[_0xfdd0('0xd')](_0x36dd21));if(_0x36dd21[_0xfdd0('0xe')]){if(_0x36dd21[_0xfdd0('0xe')][_0xfdd0('0xf')]===0x1f4){logger[_0xfdd0('0xe')](_0xfdd0('0x10'),_0x3e7bfb,_0x36dd21[_0xfdd0('0xe')][_0xfdd0('0x11')]);return _0x41feb8(_0x36dd21[_0xfdd0('0xe')][_0xfdd0('0x11')]);}logger[_0xfdd0('0xe')](_0xfdd0('0x10'),_0x3e7bfb,_0x36dd21[_0xfdd0('0xe')][_0xfdd0('0x11')]);return _0x55a2d6(_0x36dd21['error'][_0xfdd0('0x11')]);}else{logger[_0xfdd0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3e7bfb,_0xfdd0('0xc'));_0x55a2d6(_0x36dd21[_0xfdd0('0x12')]['message']);}})['catch'](function(_0x6c98b8){logger[_0xfdd0('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x3e7bfb,_0x6c98b8);_0x41feb8(_0x6c98b8);});});} \ No newline at end of file +var _0x7795=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7795,0x80));var _0x5779=function(_0x1c2fce,_0x21724e){_0x1c2fce=_0x1c2fce-0x0;var _0x53454a=_0x7795[_0x1c2fce];return _0x53454a;};'use strict';var _=require(_0x5779('0x0'));var util=require('util');var moment=require(_0x5779('0x1'));var BPromise=require(_0x5779('0x2'));var rs=require(_0x5779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5779('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5779('0x5'))('rpc');var config=require(_0x5779('0x6'));var jayson=require(_0x5779('0x7'));var client=jayson[_0x5779('0x8')][_0x5779('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aaba0,_0x2c803c,_0x44c11d){return new BPromise(function(_0x2bc44e,_0x5eac3a){return client[_0x5779('0xa')](_0x5aaba0,_0x44c11d)['then'](function(_0x24e6bb){logger[_0x5779('0xb')](_0x5779('0xc'),_0x2c803c,_0x5779('0xd'));logger[_0x5779('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2c803c,'request\x20sent',JSON[_0x5779('0xf')](_0x24e6bb));if(_0x24e6bb['error']){if(_0x24e6bb['error']['code']===0x1f4){logger[_0x5779('0x10')](_0x5779('0xc'),_0x2c803c,_0x24e6bb['error'][_0x5779('0x11')]);return _0x5eac3a(_0x24e6bb[_0x5779('0x10')][_0x5779('0x11')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2c803c,_0x24e6bb[_0x5779('0x10')]['message']);return _0x2bc44e(_0x24e6bb[_0x5779('0x10')][_0x5779('0x11')]);}else{logger['info'](_0x5779('0xc'),_0x2c803c,_0x5779('0xd'));_0x2bc44e(_0x24e6bb[_0x5779('0x12')][_0x5779('0x11')]);}})[_0x5779('0x13')](function(_0x1ad14e){logger[_0x5779('0x10')](_0x5779('0xc'),_0x2c803c,_0x1ad14e);_0x5eac3a(_0x1ad14e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 65ebd4b..8e7cdbd 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 _0x3f74=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x401226,_0x46f7df){var _0x53fe60=function(_0x3e978c){while(--_0x3e978c){_0x401226['push'](_0x401226['shift']());}};_0x53fe60(++_0x46f7df);}(_0x3f74,0xb9));var _0x43f7=function(_0x1a576e,_0x58f47){_0x1a576e=_0x1a576e-0x0;var _0xf167c0=_0x3f74[_0x1a576e];return _0xf167c0;};'use strict';var multer=require(_0x43f7('0x0'));var util=require(_0x43f7('0x1'));var path=require(_0x43f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x43f7('0x3'));var router=express[_0x43f7('0x4')]();var fs_extra=require(_0x43f7('0x5'));var auth=require(_0x43f7('0x6'));var interaction=require(_0x43f7('0x7'));var config=require(_0x43f7('0x8'));var controller=require('./faxTransferReport.controller');router[_0x43f7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43f7('0x9')](_0x43f7('0xa'),auth[_0x43f7('0xb')](),controller['describe']);router[_0x43f7('0x9')](_0x43f7('0xc'),auth[_0x43f7('0xb')](),controller[_0x43f7('0xd')]);router[_0x43f7('0xe')]('/',auth['isAuthenticated'](),controller[_0x43f7('0xf')]);router[_0x43f7('0x10')](_0x43f7('0xc'),auth[_0x43f7('0xb')](),controller[_0x43f7('0x11')]);router[_0x43f7('0x12')](_0x43f7('0xc'),auth['isAuthenticated'](),controller[_0x43f7('0x13')]);module[_0x43f7('0x14')]=router; \ No newline at end of file +var _0xe291=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','show','post','create','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xe291,0x187));var _0x1e29=function(_0x3f1f28,_0xc2c596){_0x3f1f28=_0x3f1f28-0x0;var _0x5ad1aa=_0xe291[_0x3f1f28];return _0x5ad1aa;};'use strict';var multer=require(_0x1e29('0x0'));var util=require('util');var path=require(_0x1e29('0x1'));var timeout=require('connect-timeout');var express=require(_0x1e29('0x2'));var router=express[_0x1e29('0x3')]();var fs_extra=require(_0x1e29('0x4'));var auth=require(_0x1e29('0x5'));var interaction=require(_0x1e29('0x6'));var config=require(_0x1e29('0x7'));var controller=require('./faxTransferReport.controller');router[_0x1e29('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e29('0x9')]);router['get'](_0x1e29('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1e29('0x8')](_0x1e29('0xb'),auth[_0x1e29('0xc')](),controller[_0x1e29('0xd')]);router[_0x1e29('0xe')]('/',auth['isAuthenticated'](),controller[_0x1e29('0xf')]);router['put'](_0x1e29('0xb'),auth[_0x1e29('0xc')](),controller['update']);router['delete'](_0x1e29('0xb'),auth['isAuthenticated'](),controller[_0x1e29('0x10')]);module[_0x1e29('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b571760..5d2c161 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 _0x2e96=['get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x1dd4f8,_0x4e6984){var _0xe8e55e=function(_0x205217){while(--_0x205217){_0x1dd4f8['push'](_0x1dd4f8['shift']());}};_0xe8e55e(++_0x4e6984);}(_0x2e96,0x148));var _0x62e9=function(_0x56ce8c,_0x45d7e7){_0x56ce8c=_0x56ce8c-0x0;var _0x3cd356=_0x2e96[_0x56ce8c];return _0x3cd356;};'use strict';var multer=require('multer');var util=require(_0x62e9('0x0'));var path=require('path');var timeout=require(_0x62e9('0x1'));var express=require(_0x62e9('0x2'));var router=express[_0x62e9('0x3')]();var fs_extra=require(_0x62e9('0x4'));var auth=require(_0x62e9('0x5'));var interaction=require(_0x62e9('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x62e9('0x7')](),controller['index']);router[_0x62e9('0x8')](_0x62e9('0x9'),auth[_0x62e9('0x7')](),controller['show']);router[_0x62e9('0x8')](_0x62e9('0xa'),auth[_0x62e9('0x7')](),controller[_0x62e9('0xb')]);router[_0x62e9('0x8')](_0x62e9('0xc'),auth[_0x62e9('0x7')](),controller[_0x62e9('0xd')]);router[_0x62e9('0xe')]('/',auth[_0x62e9('0x7')](),controller[_0x62e9('0xf')]);router[_0x62e9('0xe')](_0x62e9('0xa'),auth[_0x62e9('0x7')](),controller[_0x62e9('0x10')]);router[_0x62e9('0x11')](_0x62e9('0x9'),auth[_0x62e9('0x7')](),controller[_0x62e9('0x12')]);router['delete'](_0x62e9('0x9'),auth[_0x62e9('0x7')](),controller[_0x62e9('0x13')]);module[_0x62e9('0x14')]=router; \ No newline at end of file +var _0xd49d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','post','/:id/configurations','addConfiguration','update','multer','path','connect-timeout'];(function(_0xb8111f,_0x2b0a3b){var _0x233d1b=function(_0x416f63){while(--_0x416f63){_0xb8111f['push'](_0xb8111f['shift']());}};_0x233d1b(++_0x2b0a3b);}(_0xd49d,0xa8));var _0xdd49=function(_0x4d63e7,_0x3f3390){_0x4d63e7=_0x4d63e7-0x0;var _0x5e6c25=_0xd49d[_0x4d63e7];return _0x5e6c25;};'use strict';var multer=require(_0xdd49('0x0'));var util=require('util');var path=require(_0xdd49('0x1'));var timeout=require(_0xdd49('0x2'));var express=require(_0xdd49('0x3'));var router=express[_0xdd49('0x4')]();var fs_extra=require(_0xdd49('0x5'));var auth=require(_0xdd49('0x6'));var interaction=require(_0xdd49('0x7'));var config=require(_0xdd49('0x8'));var controller=require(_0xdd49('0x9'));router[_0xdd49('0xa')]('/',auth[_0xdd49('0xb')](),controller[_0xdd49('0xc')]);router[_0xdd49('0xa')](_0xdd49('0xd'),auth[_0xdd49('0xb')](),controller['show']);router[_0xdd49('0xa')]('/:id/configurations',auth[_0xdd49('0xb')](),controller[_0xdd49('0xe')]);router[_0xdd49('0xa')]('/:id/fields',auth[_0xdd49('0xb')](),controller['getFields']);router[_0xdd49('0xf')]('/',auth[_0xdd49('0xb')](),controller['create']);router[_0xdd49('0xf')](_0xdd49('0x10'),auth[_0xdd49('0xb')](),controller[_0xdd49('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdd49('0x12')]);router['delete'](_0xdd49('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 88b9aac..ea1bd2b 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 _0xe688=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x86b317,_0x5d3dac){var _0xcc98f4=function(_0x40f3f8){while(--_0x40f3f8){_0x86b317['push'](_0x86b317['shift']());}};_0xcc98f4(++_0x5d3dac);}(_0xe688,0x18d));var _0x8e68=function(_0x4b949c,_0x569284){_0x4b949c=_0x4b949c-0x0;var _0x5c6a3c=_0xe688[_0x4b949c];return _0x5c6a3c;};'use strict';var Sequelize=require(_0x8e68('0x0'));module[_0x8e68('0x1')]={'name':{'type':Sequelize[_0x8e68('0x2')]},'description':{'type':Sequelize[_0x8e68('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8e68('0x2')]},'authType':{'type':Sequelize[_0x8e68('0x3')]('basic'),'defaultValue':_0x8e68('0x4')},'password':{'type':Sequelize[_0x8e68('0x2')]},'consumerKey':{'type':Sequelize[_0x8e68('0x2')]},'consumerSecret':{'type':Sequelize[_0x8e68('0x2')]},'token':{'type':Sequelize[_0x8e68('0x2')]},'tokenSecret':{'type':Sequelize[_0x8e68('0x2')]},'serverUrl':{'type':Sequelize[_0x8e68('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8e68('0x3')](_0x8e68('0x5'),_0x8e68('0x6')),'defaultValue':_0x8e68('0x5')}}; \ No newline at end of file +var _0x3ded=['STRING','ENUM','integrationTab','sequelize','exports'];(function(_0x13d221,_0x536fdc){var _0x13336b=function(_0x25c0b4){while(--_0x25c0b4){_0x13d221['push'](_0x13d221['shift']());}};_0x13336b(++_0x536fdc);}(_0x3ded,0x139));var _0xd3de=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x3ded[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0xd3de('0x0'));module[_0xd3de('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd3de('0x2')]},'remoteUri':{'type':Sequelize[_0xd3de('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd3de('0x2')]},'token':{'type':Sequelize[_0xd3de('0x2')]},'tokenSecret':{'type':Sequelize[_0xd3de('0x2')]},'serverUrl':{'type':Sequelize[_0xd3de('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd3de('0x3')]('integrationTab','newTab'),'defaultValue':_0xd3de('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 30d5962..70db802 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 _0x6cf5=['save','update','then','destroy','end','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','DeskAccount','count','includeAll','include','findAll','rows','show','merge','find','catch','create','body','params','getConfigurations','DeskConfiguration','pick','hasOwnProperty','findOne','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','authType','username','password','consumerKey','token','remoteUri','substring','lastIndexOf','GET','%s/custom_fields','basic','headers','Authorization','format','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','set','reject'];(function(_0x47af8e,_0x1f1cb0){var _0x5187a2=function(_0x30c66c){while(--_0x30c66c){_0x47af8e['push'](_0x47af8e['shift']());}};_0x5187a2(++_0x1f1cb0);}(_0x6cf5,0x1b4));var _0x56cf=function(_0x480bfd,_0x438f5b){_0x480bfd=_0x480bfd-0x0;var _0x48ec9b=_0x6cf5[_0x480bfd];return _0x48ec9b;};'use strict';var emlformat=require(_0x56cf('0x0'));var rimraf=require(_0x56cf('0x1'));var zipdir=require(_0x56cf('0x2'));var jsonpatch=require(_0x56cf('0x3'));var rp=require(_0x56cf('0x4'));var moment=require(_0x56cf('0x5'));var BPromise=require(_0x56cf('0x6'));var Mustache=require(_0x56cf('0x7'));var util=require(_0x56cf('0x8'));var path=require(_0x56cf('0x9'));var sox=require('sox');var csv=require(_0x56cf('0xa'));var ejs=require(_0x56cf('0xb'));var fs=require('fs');var fs_extra=require(_0x56cf('0xc'));var _=require(_0x56cf('0xd'));var squel=require(_0x56cf('0xe'));var crypto=require(_0x56cf('0xf'));var jsforce=require(_0x56cf('0x10'));var deskjs=require(_0x56cf('0x11'));var toCsv=require(_0x56cf('0xa'));var querystring=require(_0x56cf('0x12'));var Papa=require(_0x56cf('0x13'));var Redis=require(_0x56cf('0x14'));var authService=require(_0x56cf('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x56cf('0x16'));var hardwareService=require(_0x56cf('0x17'));var logger=require('../../config/logger')(_0x56cf('0x18'));var utils=require('../../config/utils');var config=require(_0x56cf('0x19'));var licenseUtil=require(_0x56cf('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x56cf('0x1b'));function respondWithStatusCode(_0x5a651d,_0x3bfdc1){_0x3bfdc1=_0x3bfdc1||0xcc;return function(_0x6d3ec7){if(_0x6d3ec7){return _0x5a651d[_0x56cf('0x1c')](_0x3bfdc1);}return _0x5a651d[_0x56cf('0x1d')](_0x3bfdc1)['end']();};}function respondWithResult(_0xe2261c,_0xecd681){_0xecd681=_0xecd681||0xc8;return function(_0x401225){if(_0x401225){return _0xe2261c['status'](_0xecd681)[_0x56cf('0x1e')](_0x401225);}};}function respondWithFilteredResult(_0x5f4a20,_0x5732da){return function(_0x27fe5d){if(_0x27fe5d){var _0x30871e=typeof _0x5732da[_0x56cf('0x1f')]==='undefined'&&typeof _0x5732da[_0x56cf('0x20')]===_0x56cf('0x21');var _0x3fb13a=_0x27fe5d['count'];var _0x5e7555=_0x30871e?0x0:_0x5732da[_0x56cf('0x1f')];var _0x637812=_0x30871e?_0x27fe5d['count']:_0x5732da['offset']+_0x5732da[_0x56cf('0x20')];var _0x39910c;if(_0x637812>=_0x3fb13a){_0x637812=_0x3fb13a;_0x39910c=0xc8;}else{_0x39910c=0xce;}_0x5f4a20[_0x56cf('0x1d')](_0x39910c);return _0x5f4a20[_0x56cf('0x22')]('Content-Range',_0x5e7555+'-'+_0x637812+'/'+_0x3fb13a)[_0x56cf('0x1e')](_0x27fe5d);}return null;};}function patchUpdates(_0x52228b){return function(_0xd2eafd){try{jsonpatch['apply'](_0xd2eafd,_0x52228b,!![]);}catch(_0x4220d2){return BPromise[_0x56cf('0x23')](_0x4220d2);}return _0xd2eafd[_0x56cf('0x24')]();};}function saveUpdates(_0x1ec4de,_0x4ff295){return function(_0x342970){if(_0x342970){return _0x342970[_0x56cf('0x25')](_0x1ec4de)[_0x56cf('0x26')](function(_0x5970f9){return _0x5970f9;});}return null;};}function removeEntity(_0x5304bd,_0x3c742b){return function(_0x34931a){if(_0x34931a){return _0x34931a[_0x56cf('0x27')]()[_0x56cf('0x26')](function(){_0x5304bd[_0x56cf('0x1d')](0xcc)[_0x56cf('0x28')]();});}};}function handleEntityNotFound(_0x36c567,_0xd06bf6){return function(_0x132cf0){if(!_0x132cf0){_0x36c567[_0x56cf('0x1c')](0x194);}return _0x132cf0;};}function handleError(_0x29c8cd,_0xf33796){_0xf33796=_0xf33796||0x1f4;return function(_0x439d49){logger['error'](_0x439d49[_0x56cf('0x29')]);if(_0x439d49['name']){delete _0x439d49['name'];}_0x29c8cd[_0x56cf('0x1d')](_0xf33796)[_0x56cf('0x2a')](_0x439d49);};}exports[_0x56cf('0x2b')]=function(_0x46692a,_0x45bd5d){var _0x8c6df9={},_0x250934={},_0x24a986={'count':0x0,'rows':[]};var _0x4817c5=_[_0x56cf('0x2c')](db['DeskAccount'][_0x56cf('0x2d')],function(_0x2e87e5){return{'name':_0x2e87e5[_0x56cf('0x2e')],'type':_0x2e87e5[_0x56cf('0x2f')][_0x56cf('0x30')]};});_0x250934[_0x56cf('0x31')]=_[_0x56cf('0x2c')](_0x4817c5,_0x56cf('0x32'));_0x250934[_0x56cf('0x33')]=_[_0x56cf('0x34')](_0x46692a[_0x56cf('0x33')]);_0x250934[_0x56cf('0x35')]=_[_0x56cf('0x36')](_0x250934[_0x56cf('0x31')],_0x250934[_0x56cf('0x33')]);_0x8c6df9[_0x56cf('0x37')]=_[_0x56cf('0x36')](_0x250934[_0x56cf('0x31')],qs[_0x56cf('0x38')](_0x46692a[_0x56cf('0x33')]['fields']));_0x8c6df9[_0x56cf('0x37')]=_0x8c6df9[_0x56cf('0x37')][_0x56cf('0x39')]?_0x8c6df9[_0x56cf('0x37')]:_0x250934[_0x56cf('0x31')];if(!_0x46692a[_0x56cf('0x33')]['hasOwnProperty'](_0x56cf('0x3a'))){_0x8c6df9[_0x56cf('0x20')]=qs[_0x56cf('0x20')](_0x46692a[_0x56cf('0x33')][_0x56cf('0x20')]);_0x8c6df9[_0x56cf('0x1f')]=qs[_0x56cf('0x1f')](_0x46692a[_0x56cf('0x33')]['offset']);}_0x8c6df9[_0x56cf('0x3b')]=qs[_0x56cf('0x3c')](_0x46692a[_0x56cf('0x33')][_0x56cf('0x3c')]);_0x8c6df9[_0x56cf('0x3d')]=qs[_0x56cf('0x35')](_['pick'](_0x46692a[_0x56cf('0x33')],_0x250934['filters']),_0x4817c5);if(_0x46692a[_0x56cf('0x33')][_0x56cf('0x3e')]){_0x8c6df9[_0x56cf('0x3d')]=_['merge'](_0x8c6df9[_0x56cf('0x3d')],{'$or':_[_0x56cf('0x2c')](_0x4817c5,function(_0x5a78a9){if(_0x5a78a9[_0x56cf('0x2f')]!==_0x56cf('0x3f')){var _0x46144f={};_0x46144f[_0x5a78a9['name']]={'$like':'%'+_0x46692a[_0x56cf('0x33')][_0x56cf('0x3e')]+'%'};return _0x46144f;}})});}_0x8c6df9=_['merge']({},_0x8c6df9,_0x46692a[_0x56cf('0x40')]);var _0x3e640c={'where':_0x8c6df9[_0x56cf('0x3d')]};return db[_0x56cf('0x41')]['count'](_0x3e640c)['then'](function(_0x3e38d4){_0x24a986[_0x56cf('0x42')]=_0x3e38d4;if(_0x46692a[_0x56cf('0x33')][_0x56cf('0x43')]){_0x8c6df9[_0x56cf('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0x56cf('0x45')](_0x8c6df9);})[_0x56cf('0x26')](function(_0x209e9f){_0x24a986[_0x56cf('0x46')]=_0x209e9f;return _0x24a986;})[_0x56cf('0x26')](respondWithFilteredResult(_0x45bd5d,_0x8c6df9))['catch'](handleError(_0x45bd5d,null));};exports[_0x56cf('0x47')]=function(_0x48a308,_0x5ece40){var _0x49de7e={'raw':![],'where':{'id':_0x48a308['params']['id']}},_0x15703a={};_0x15703a[_0x56cf('0x31')]=_['keys'](db[_0x56cf('0x41')][_0x56cf('0x2d')]);_0x15703a['query']=_['keys'](_0x48a308[_0x56cf('0x33')]);_0x15703a[_0x56cf('0x35')]=_['intersection'](_0x15703a[_0x56cf('0x31')],_0x15703a[_0x56cf('0x33')]);_0x49de7e[_0x56cf('0x37')]=_[_0x56cf('0x36')](_0x15703a[_0x56cf('0x31')],qs[_0x56cf('0x38')](_0x48a308[_0x56cf('0x33')][_0x56cf('0x38')]));_0x49de7e[_0x56cf('0x37')]=_0x49de7e[_0x56cf('0x37')]['length']?_0x49de7e[_0x56cf('0x37')]:_0x15703a[_0x56cf('0x31')];if(_0x48a308[_0x56cf('0x33')][_0x56cf('0x43')]){_0x49de7e['include']=[{'all':!![]}];}_0x49de7e=_[_0x56cf('0x48')]({},_0x49de7e,_0x48a308[_0x56cf('0x40')]);return db['DeskAccount'][_0x56cf('0x49')](_0x49de7e)['then'](handleEntityNotFound(_0x5ece40,null))[_0x56cf('0x26')](respondWithResult(_0x5ece40,null))[_0x56cf('0x4a')](handleError(_0x5ece40,null));};exports[_0x56cf('0x4b')]=function(_0x515158,_0x5d56f5){return db['DeskAccount'][_0x56cf('0x4b')](_0x515158['body'],{})[_0x56cf('0x26')](respondWithResult(_0x5d56f5,0xc9))['catch'](handleError(_0x5d56f5,null));};exports['update']=function(_0x15a5e5,_0x4fa166){if(_0x15a5e5['body']['id']){delete _0x15a5e5['body']['id'];}return db[_0x56cf('0x41')][_0x56cf('0x49')]({'where':{'id':_0x15a5e5['params']['id']}})['then'](handleEntityNotFound(_0x4fa166,null))['then'](saveUpdates(_0x15a5e5[_0x56cf('0x4c')],null))[_0x56cf('0x26')](respondWithResult(_0x4fa166,null))[_0x56cf('0x4a')](handleError(_0x4fa166,null));};exports[_0x56cf('0x27')]=function(_0x196206,_0x9ae818){return db[_0x56cf('0x41')][_0x56cf('0x49')]({'where':{'id':_0x196206[_0x56cf('0x4d')]['id']}})[_0x56cf('0x26')](handleEntityNotFound(_0x9ae818,null))['then'](removeEntity(_0x9ae818,null))[_0x56cf('0x4a')](handleError(_0x9ae818,null));};exports[_0x56cf('0x4e')]=function(_0x2a0854,_0x1f4937,_0x39a3f1){var _0x56ccc4={};var _0x376b53={};var _0x5eff20;var _0x46eba9;return db[_0x56cf('0x41')]['findOne']({'where':{'id':_0x2a0854[_0x56cf('0x4d')]['id']}})[_0x56cf('0x26')](handleEntityNotFound(_0x1f4937,null))[_0x56cf('0x26')](function(_0x374df2){if(_0x374df2){_0x5eff20=_0x374df2;_0x376b53[_0x56cf('0x31')]=_[_0x56cf('0x34')](db[_0x56cf('0x4f')][_0x56cf('0x2d')]);_0x376b53[_0x56cf('0x33')]=_[_0x56cf('0x34')](_0x2a0854[_0x56cf('0x33')]);_0x376b53['filters']=_['intersection'](_0x376b53[_0x56cf('0x31')],_0x376b53[_0x56cf('0x33')]);_0x56ccc4['attributes']=_[_0x56cf('0x36')](_0x376b53[_0x56cf('0x31')],qs[_0x56cf('0x38')](_0x2a0854[_0x56cf('0x33')][_0x56cf('0x38')]));_0x56ccc4[_0x56cf('0x37')]=_0x56ccc4[_0x56cf('0x37')][_0x56cf('0x39')]?_0x56ccc4[_0x56cf('0x37')]:_0x376b53[_0x56cf('0x31')];_0x56ccc4[_0x56cf('0x3b')]=qs[_0x56cf('0x3c')](_0x2a0854['query'][_0x56cf('0x3c')]);_0x56ccc4[_0x56cf('0x3d')]=qs['filters'](_[_0x56cf('0x50')](_0x2a0854[_0x56cf('0x33')],_0x376b53[_0x56cf('0x35')]));if(_0x2a0854['query'][_0x56cf('0x3e')]){_0x56ccc4[_0x56cf('0x3d')]=_[_0x56cf('0x48')](_0x56ccc4[_0x56cf('0x3d')],{'$or':_[_0x56cf('0x2c')](_0x56ccc4[_0x56cf('0x37')],function(_0x454a38){var _0x592014={};_0x592014[_0x454a38]={'$like':'%'+_0x2a0854[_0x56cf('0x33')][_0x56cf('0x3e')]+'%'};return _0x592014;})});}_0x56ccc4=_[_0x56cf('0x48')]({},_0x56ccc4,_0x2a0854[_0x56cf('0x40')]);return _0x5eff20[_0x56cf('0x4e')](_0x56ccc4);}})['then'](function(_0x41c488){if(_0x41c488){_0x46eba9=_0x41c488[_0x56cf('0x39')];if(!_0x2a0854[_0x56cf('0x33')][_0x56cf('0x51')](_0x56cf('0x3a'))){_0x56ccc4[_0x56cf('0x20')]=qs['limit'](_0x2a0854['query'][_0x56cf('0x20')]);_0x56ccc4['offset']=qs[_0x56cf('0x1f')](_0x2a0854[_0x56cf('0x33')][_0x56cf('0x1f')]);}return _0x5eff20['getConfigurations'](_0x56ccc4);}})[_0x56cf('0x26')](function(_0x5420d7){if(_0x5420d7){return _0x5420d7?{'count':_0x46eba9,'rows':_0x5420d7}:null;}})[_0x56cf('0x26')](respondWithResult(_0x1f4937,null))[_0x56cf('0x4a')](handleError(_0x1f4937,null));};exports['addConfiguration']=function(_0x37d963,_0x3180d4,_0x5f0793){if(_0x37d963[_0x56cf('0x4c')]['id']){delete _0x37d963[_0x56cf('0x4c')]['id'];}return db[_0x56cf('0x41')][_0x56cf('0x52')]({'where':{'id':_0x37d963[_0x56cf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3180d4,null))['then'](function(_0x999da5){if(_0x999da5){_0x37d963[_0x56cf('0x4c')][_0x56cf('0x53')]=_0x999da5['id'];_0x37d963[_0x56cf('0x4c')]['Subjects']=integrations[_0x56cf('0x54')](_0x37d963[_0x56cf('0x4c')][_0x56cf('0x55')],_0x37d963[_0x56cf('0x4c')][_0x56cf('0x2f')]);_0x37d963['body'][_0x56cf('0x56')]=integrations['getDescriptions'](_0x37d963[_0x56cf('0x4c')][_0x56cf('0x55')],_0x37d963[_0x56cf('0x4c')][_0x56cf('0x2f')]);return db['DeskConfiguration'][_0x56cf('0x4b')](_0x37d963[_0x56cf('0x4c')],{'include':[{'model':db[_0x56cf('0x57')],'as':_0x56cf('0x58')},{'model':db[_0x56cf('0x57')],'as':_0x56cf('0x56')}]});}return null;})['then'](respondWithResult(_0x3180d4,null))[_0x56cf('0x4a')](handleError(_0x3180d4,null));};exports[_0x56cf('0x59')]=function(_0x3af230,_0x371815,_0x51c028){var _0x4b82f6=[{'name':_0x56cf('0x5a'),'label':_0x56cf('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3694b2='';return db[_0x56cf('0x41')][_0x56cf('0x52')]({'where':{'id':_0x3af230[_0x56cf('0x4d')]['id']},'attributes':['id','remoteUri',_0x56cf('0x5b'),_0x56cf('0x5c'),_0x56cf('0x5d'),_0x56cf('0x5e'),'consumerSecret',_0x56cf('0x5f'),'tokenSecret']})[_0x56cf('0x26')](handleEntityNotFound(_0x371815,null))['then'](function(_0x3adf78){if(_0x3adf78){_0x3694b2=_0x3adf78[_0x56cf('0x60')];var _0x3c228f=_0x3694b2['slice'](-0x1);if(_0x3c228f==='/'){_0x3694b2=_0x3694b2[_0x56cf('0x61')](0x0,_0x3694b2[_0x56cf('0x62')](_0x3c228f));}var _0x464cc7={'method':_0x56cf('0x63'),'uri':util['format'](_0x56cf('0x64'),_0x3694b2),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3adf78[_0x56cf('0x5b')]===_0x56cf('0x65')){_0x464cc7[_0x56cf('0x66')][_0x56cf('0x67')]=util[_0x56cf('0x68')]('Basic\x20%s',new Buffer(util[_0x56cf('0x68')](_0x56cf('0x69'),_0x3adf78[_0x56cf('0x5c')],_0x3adf78[_0x56cf('0x5d')]))[_0x56cf('0x6a')](_0x56cf('0x6b')));}return rp(_0x464cc7)[_0x56cf('0x26')](function(_0xe0687a){return _0x4b82f6[_0x56cf('0x6c')](_[_0x56cf('0x2c')](_0xe0687a[_0x56cf('0x6d')]['entries'],function(_0x4f1f44){return{'id':_0x4f1f44['name'],'name':_0x4f1f44[_0x56cf('0x32')],'type':_0x4f1f44['type'],'active':_0x4f1f44[_0x56cf('0x6e')],'label':_0x4f1f44[_0x56cf('0x6f')],'custom':!![]};}));});}})[_0x56cf('0x26')](function(_0x590926){return{'count':_0x590926[_0x56cf('0x39')],'rows':_0x590926};})[_0x56cf('0x26')](respondWithResult(_0x371815,null))['catch'](function(_0x3f87b0){var _0x578647=_0x3af230['query'][_0x56cf('0x70')]?0x1f4:_0x3f87b0[_0x56cf('0x71')]||0x1f4;logger[_0x56cf('0x72')](_0x56cf('0x73'),_0x56cf('0x59'),_0x578647,JSON[_0x56cf('0x74')](_0x3f87b0));delete _0x3f87b0[_0x56cf('0x32')];if(_0x578647===0x191){_0x578647=0x190;}_0x371815[_0x56cf('0x1d')](_0x578647)[_0x56cf('0x2a')](_0x3af230[_0x56cf('0x33')][_0x56cf('0x70')]?{'message':_0x56cf('0x75'),'statusCode':_0x3f87b0['statusCode']}:_0x3f87b0);});}; \ No newline at end of file +var _0x11ca=['test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x1e422c,_0x590326){var _0x9cf389=function(_0x5df6c7){while(--_0x5df6c7){_0x1e422c['push'](_0x1e422c['shift']());}};_0x9cf389(++_0x590326);}(_0x11ca,0x72));var _0xa11c=function(_0x4e34d7,_0x9f89cc){_0x4e34d7=_0x4e34d7-0x0;var _0x2295d8=_0x11ca[_0x4e34d7];return _0x2295d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa11c('0x0'));var jsonpatch=require(_0xa11c('0x1'));var rp=require(_0xa11c('0x2'));var moment=require('moment');var BPromise=require(_0xa11c('0x3'));var Mustache=require(_0xa11c('0x4'));var util=require('util');var path=require(_0xa11c('0x5'));var sox=require(_0xa11c('0x6'));var csv=require(_0xa11c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa11c('0x8'));var _=require(_0xa11c('0x9'));var squel=require(_0xa11c('0xa'));var crypto=require(_0xa11c('0xb'));var jsforce=require(_0xa11c('0xc'));var deskjs=require(_0xa11c('0xd'));var toCsv=require(_0xa11c('0x7'));var querystring=require(_0xa11c('0xe'));var Papa=require(_0xa11c('0xf'));var Redis=require(_0xa11c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa11c('0x11'));var hardwareService=require(_0xa11c('0x12'));var logger=require('../../config/logger')(_0xa11c('0x13'));var utils=require(_0xa11c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa11c('0x15'))['db'];var integrations=require(_0xa11c('0x16'));function respondWithStatusCode(_0x3af534,_0x4bc0b4){_0x4bc0b4=_0x4bc0b4||0xcc;return function(_0x573564){if(_0x573564){return _0x3af534[_0xa11c('0x17')](_0x4bc0b4);}return _0x3af534['status'](_0x4bc0b4)[_0xa11c('0x18')]();};}function respondWithResult(_0x49e701,_0x5de341){_0x5de341=_0x5de341||0xc8;return function(_0x6e2a7d){if(_0x6e2a7d){return _0x49e701[_0xa11c('0x19')](_0x5de341)['json'](_0x6e2a7d);}};}function respondWithFilteredResult(_0x5ba5dd,_0x52094a){return function(_0x18cd06){if(_0x18cd06){var _0x56158f=typeof _0x52094a[_0xa11c('0x1a')]===_0xa11c('0x1b')&&typeof _0x52094a['limit']===_0xa11c('0x1b');var _0xda7b85=_0x18cd06['count'];var _0x272b83=_0x56158f?0x0:_0x52094a[_0xa11c('0x1a')];var _0x1eba3d=_0x56158f?_0x18cd06[_0xa11c('0x1c')]:_0x52094a[_0xa11c('0x1a')]+_0x52094a[_0xa11c('0x1d')];var _0x655203;if(_0x1eba3d>=_0xda7b85){_0x1eba3d=_0xda7b85;_0x655203=0xc8;}else{_0x655203=0xce;}_0x5ba5dd[_0xa11c('0x19')](_0x655203);return _0x5ba5dd[_0xa11c('0x1e')](_0xa11c('0x1f'),_0x272b83+'-'+_0x1eba3d+'/'+_0xda7b85)[_0xa11c('0x20')](_0x18cd06);}return null;};}function patchUpdates(_0x296c98){return function(_0x31a8c9){try{jsonpatch[_0xa11c('0x21')](_0x31a8c9,_0x296c98,!![]);}catch(_0x59799e){return BPromise[_0xa11c('0x22')](_0x59799e);}return _0x31a8c9[_0xa11c('0x23')]();};}function saveUpdates(_0x2c2fd3,_0x12b3ca){return function(_0x3956b7){if(_0x3956b7){return _0x3956b7[_0xa11c('0x24')](_0x2c2fd3)[_0xa11c('0x25')](function(_0x3f728d){return _0x3f728d;});}return null;};}function removeEntity(_0x55d4f8,_0x45e3e8){return function(_0x50b35f){if(_0x50b35f){return _0x50b35f[_0xa11c('0x26')]()[_0xa11c('0x25')](function(){_0x55d4f8[_0xa11c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a98e,_0x12340e){return function(_0x1bf104){if(!_0x1bf104){_0x12a98e['sendStatus'](0x194);}return _0x1bf104;};}function handleError(_0x549a35,_0x4a00d9){_0x4a00d9=_0x4a00d9||0x1f4;return function(_0x48ce12){logger[_0xa11c('0x27')](_0x48ce12[_0xa11c('0x28')]);if(_0x48ce12[_0xa11c('0x29')]){delete _0x48ce12[_0xa11c('0x29')];}_0x549a35[_0xa11c('0x19')](_0x4a00d9)['send'](_0x48ce12);};}exports[_0xa11c('0x2a')]=function(_0x3ea201,_0x5effa9){var _0x1ce8b2={},_0x3649dd={},_0x535057={'count':0x0,'rows':[]};var _0x1d7f4c=_['map'](db[_0xa11c('0x2b')][_0xa11c('0x2c')],function(_0x571c4f){return{'name':_0x571c4f[_0xa11c('0x2d')],'type':_0x571c4f[_0xa11c('0x2e')][_0xa11c('0x2f')]};});_0x3649dd[_0xa11c('0x30')]=_[_0xa11c('0x31')](_0x1d7f4c,'name');_0x3649dd[_0xa11c('0x32')]=_[_0xa11c('0x33')](_0x3ea201[_0xa11c('0x32')]);_0x3649dd[_0xa11c('0x34')]=_[_0xa11c('0x35')](_0x3649dd[_0xa11c('0x30')],_0x3649dd[_0xa11c('0x32')]);_0x1ce8b2['attributes']=_[_0xa11c('0x35')](_0x3649dd['model'],qs[_0xa11c('0x36')](_0x3ea201['query'][_0xa11c('0x36')]));_0x1ce8b2[_0xa11c('0x37')]=_0x1ce8b2[_0xa11c('0x37')][_0xa11c('0x38')]?_0x1ce8b2[_0xa11c('0x37')]:_0x3649dd[_0xa11c('0x30')];if(!_0x3ea201[_0xa11c('0x32')][_0xa11c('0x39')]('nolimit')){_0x1ce8b2[_0xa11c('0x1d')]=qs['limit'](_0x3ea201[_0xa11c('0x32')][_0xa11c('0x1d')]);_0x1ce8b2[_0xa11c('0x1a')]=qs[_0xa11c('0x1a')](_0x3ea201[_0xa11c('0x32')][_0xa11c('0x1a')]);}_0x1ce8b2[_0xa11c('0x3a')]=qs[_0xa11c('0x3b')](_0x3ea201[_0xa11c('0x32')][_0xa11c('0x3b')]);_0x1ce8b2[_0xa11c('0x3c')]=qs[_0xa11c('0x34')](_[_0xa11c('0x3d')](_0x3ea201[_0xa11c('0x32')],_0x3649dd['filters']),_0x1d7f4c);if(_0x3ea201[_0xa11c('0x32')][_0xa11c('0x3e')]){_0x1ce8b2[_0xa11c('0x3c')]=_[_0xa11c('0x3f')](_0x1ce8b2['where'],{'$or':_[_0xa11c('0x31')](_0x1d7f4c,function(_0xfa047){if(_0xfa047['type']!==_0xa11c('0x40')){var _0x105c15={};_0x105c15[_0xfa047[_0xa11c('0x29')]]={'$like':'%'+_0x3ea201['query']['filter']+'%'};return _0x105c15;}})});}_0x1ce8b2=_[_0xa11c('0x3f')]({},_0x1ce8b2,_0x3ea201[_0xa11c('0x41')]);var _0x2193f4={'where':_0x1ce8b2[_0xa11c('0x3c')]};return db[_0xa11c('0x2b')][_0xa11c('0x1c')](_0x2193f4)['then'](function(_0x296954){_0x535057[_0xa11c('0x1c')]=_0x296954;if(_0x3ea201[_0xa11c('0x32')][_0xa11c('0x42')]){_0x1ce8b2[_0xa11c('0x43')]=[{'all':!![]}];}return db[_0xa11c('0x2b')]['findAll'](_0x1ce8b2);})[_0xa11c('0x25')](function(_0x90ebab){_0x535057[_0xa11c('0x44')]=_0x90ebab;return _0x535057;})['then'](respondWithFilteredResult(_0x5effa9,_0x1ce8b2))[_0xa11c('0x45')](handleError(_0x5effa9,null));};exports[_0xa11c('0x46')]=function(_0x5b123b,_0x6094d8){var _0x46ea1c={'raw':![],'where':{'id':_0x5b123b[_0xa11c('0x47')]['id']}},_0x384684={};_0x384684[_0xa11c('0x30')]=_[_0xa11c('0x33')](db['DeskAccount'][_0xa11c('0x2c')]);_0x384684[_0xa11c('0x32')]=_[_0xa11c('0x33')](_0x5b123b[_0xa11c('0x32')]);_0x384684[_0xa11c('0x34')]=_[_0xa11c('0x35')](_0x384684['model'],_0x384684[_0xa11c('0x32')]);_0x46ea1c[_0xa11c('0x37')]=_[_0xa11c('0x35')](_0x384684['model'],qs['fields'](_0x5b123b[_0xa11c('0x32')][_0xa11c('0x36')]));_0x46ea1c[_0xa11c('0x37')]=_0x46ea1c[_0xa11c('0x37')][_0xa11c('0x38')]?_0x46ea1c[_0xa11c('0x37')]:_0x384684[_0xa11c('0x30')];if(_0x5b123b[_0xa11c('0x32')][_0xa11c('0x42')]){_0x46ea1c[_0xa11c('0x43')]=[{'all':!![]}];}_0x46ea1c=_['merge']({},_0x46ea1c,_0x5b123b[_0xa11c('0x41')]);return db[_0xa11c('0x2b')][_0xa11c('0x48')](_0x46ea1c)[_0xa11c('0x25')](handleEntityNotFound(_0x6094d8,null))[_0xa11c('0x25')](respondWithResult(_0x6094d8,null))[_0xa11c('0x45')](handleError(_0x6094d8,null));};exports[_0xa11c('0x49')]=function(_0xa52f1d,_0x1be419){return db[_0xa11c('0x2b')][_0xa11c('0x49')](_0xa52f1d[_0xa11c('0x4a')],{})[_0xa11c('0x25')](respondWithResult(_0x1be419,0xc9))[_0xa11c('0x45')](handleError(_0x1be419,null));};exports[_0xa11c('0x24')]=function(_0x2e2250,_0x1714e3){if(_0x2e2250[_0xa11c('0x4a')]['id']){delete _0x2e2250[_0xa11c('0x4a')]['id'];}return db[_0xa11c('0x2b')]['find']({'where':{'id':_0x2e2250[_0xa11c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1714e3,null))[_0xa11c('0x25')](saveUpdates(_0x2e2250[_0xa11c('0x4a')],null))[_0xa11c('0x25')](respondWithResult(_0x1714e3,null))[_0xa11c('0x45')](handleError(_0x1714e3,null));};exports[_0xa11c('0x26')]=function(_0x11dc99,_0x1e8ad1){return db[_0xa11c('0x2b')][_0xa11c('0x48')]({'where':{'id':_0x11dc99[_0xa11c('0x47')]['id']}})[_0xa11c('0x25')](handleEntityNotFound(_0x1e8ad1,null))[_0xa11c('0x25')](removeEntity(_0x1e8ad1,null))[_0xa11c('0x45')](handleError(_0x1e8ad1,null));};exports[_0xa11c('0x4b')]=function(_0x4cbe64,_0x1fa3dd,_0x2429be){var _0x5eb5d0={};var _0x154a59={};var _0x262701;var _0x38bb91;return db[_0xa11c('0x2b')][_0xa11c('0x4c')]({'where':{'id':_0x4cbe64[_0xa11c('0x47')]['id']}})[_0xa11c('0x25')](handleEntityNotFound(_0x1fa3dd,null))[_0xa11c('0x25')](function(_0x4a4125){if(_0x4a4125){_0x262701=_0x4a4125;_0x154a59[_0xa11c('0x30')]=_['keys'](db[_0xa11c('0x4d')][_0xa11c('0x2c')]);_0x154a59[_0xa11c('0x32')]=_['keys'](_0x4cbe64[_0xa11c('0x32')]);_0x154a59[_0xa11c('0x34')]=_[_0xa11c('0x35')](_0x154a59['model'],_0x154a59[_0xa11c('0x32')]);_0x5eb5d0[_0xa11c('0x37')]=_['intersection'](_0x154a59[_0xa11c('0x30')],qs[_0xa11c('0x36')](_0x4cbe64[_0xa11c('0x32')][_0xa11c('0x36')]));_0x5eb5d0['attributes']=_0x5eb5d0['attributes'][_0xa11c('0x38')]?_0x5eb5d0[_0xa11c('0x37')]:_0x154a59[_0xa11c('0x30')];_0x5eb5d0[_0xa11c('0x3a')]=qs[_0xa11c('0x3b')](_0x4cbe64[_0xa11c('0x32')][_0xa11c('0x3b')]);_0x5eb5d0['where']=qs[_0xa11c('0x34')](_[_0xa11c('0x3d')](_0x4cbe64[_0xa11c('0x32')],_0x154a59[_0xa11c('0x34')]));if(_0x4cbe64['query']['filter']){_0x5eb5d0[_0xa11c('0x3c')]=_[_0xa11c('0x3f')](_0x5eb5d0[_0xa11c('0x3c')],{'$or':_[_0xa11c('0x31')](_0x5eb5d0[_0xa11c('0x37')],function(_0x27928f){var _0x4e46d9={};_0x4e46d9[_0x27928f]={'$like':'%'+_0x4cbe64['query'][_0xa11c('0x3e')]+'%'};return _0x4e46d9;})});}_0x5eb5d0=_[_0xa11c('0x3f')]({},_0x5eb5d0,_0x4cbe64[_0xa11c('0x41')]);return _0x262701[_0xa11c('0x4b')](_0x5eb5d0);}})[_0xa11c('0x25')](function(_0x452d5f){if(_0x452d5f){_0x38bb91=_0x452d5f['length'];if(!_0x4cbe64[_0xa11c('0x32')]['hasOwnProperty'](_0xa11c('0x4e'))){_0x5eb5d0[_0xa11c('0x1d')]=qs[_0xa11c('0x1d')](_0x4cbe64[_0xa11c('0x32')][_0xa11c('0x1d')]);_0x5eb5d0[_0xa11c('0x1a')]=qs[_0xa11c('0x1a')](_0x4cbe64['query'][_0xa11c('0x1a')]);}return _0x262701[_0xa11c('0x4b')](_0x5eb5d0);}})[_0xa11c('0x25')](function(_0xe209a7){if(_0xe209a7){return _0xe209a7?{'count':_0x38bb91,'rows':_0xe209a7}:null;}})[_0xa11c('0x25')](respondWithResult(_0x1fa3dd,null))[_0xa11c('0x45')](handleError(_0x1fa3dd,null));};exports['addConfiguration']=function(_0x25d8c1,_0x4f1af3,_0x26ed71){if(_0x25d8c1[_0xa11c('0x4a')]['id']){delete _0x25d8c1[_0xa11c('0x4a')]['id'];}return db[_0xa11c('0x2b')][_0xa11c('0x4c')]({'where':{'id':_0x25d8c1[_0xa11c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f1af3,null))[_0xa11c('0x25')](function(_0x345eed){if(_0x345eed){_0x25d8c1[_0xa11c('0x4a')]['AccountId']=_0x345eed['id'];_0x25d8c1[_0xa11c('0x4a')][_0xa11c('0x4f')]=integrations['getSubjects'](_0x25d8c1[_0xa11c('0x4a')][_0xa11c('0x50')],_0x25d8c1['body'][_0xa11c('0x2e')]);_0x25d8c1[_0xa11c('0x4a')][_0xa11c('0x51')]=integrations[_0xa11c('0x52')](_0x25d8c1[_0xa11c('0x4a')][_0xa11c('0x50')],_0x25d8c1[_0xa11c('0x4a')][_0xa11c('0x2e')]);return db[_0xa11c('0x4d')][_0xa11c('0x49')](_0x25d8c1[_0xa11c('0x4a')],{'include':[{'model':db[_0xa11c('0x53')],'as':_0xa11c('0x4f')},{'model':db[_0xa11c('0x53')],'as':'Descriptions'}]});}return null;})[_0xa11c('0x25')](respondWithResult(_0x4f1af3,null))[_0xa11c('0x45')](handleError(_0x4f1af3,null));};exports[_0xa11c('0x54')]=function(_0x371cd9,_0x24e473,_0x223315){var _0x2e6d9a=[{'name':_0xa11c('0x55'),'label':_0xa11c('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x43367a='';return db[_0xa11c('0x2b')][_0xa11c('0x4c')]({'where':{'id':_0x371cd9[_0xa11c('0x47')]['id']},'attributes':['id',_0xa11c('0x56'),_0xa11c('0x57'),_0xa11c('0x58'),_0xa11c('0x59'),_0xa11c('0x5a'),'consumerSecret',_0xa11c('0x5b'),_0xa11c('0x5c')]})[_0xa11c('0x25')](handleEntityNotFound(_0x24e473,null))[_0xa11c('0x25')](function(_0x33f5e1){if(_0x33f5e1){_0x43367a=_0x33f5e1[_0xa11c('0x56')];var _0x532c6c=_0x43367a[_0xa11c('0x5d')](-0x1);if(_0x532c6c==='/'){_0x43367a=_0x43367a[_0xa11c('0x5e')](0x0,_0x43367a[_0xa11c('0x5f')](_0x532c6c));}var _0x113e09={'method':_0xa11c('0x60'),'uri':util[_0xa11c('0x61')]('%s/custom_fields',_0x43367a),'headers':{'Content-Type':'application/json','Accept':_0xa11c('0x62')},'json':!![]};if(_0x33f5e1[_0xa11c('0x57')]==='basic'){_0x113e09[_0xa11c('0x63')][_0xa11c('0x64')]=util[_0xa11c('0x61')](_0xa11c('0x65'),new Buffer(util[_0xa11c('0x61')](_0xa11c('0x66'),_0x33f5e1[_0xa11c('0x58')],_0x33f5e1['password']))['toString'](_0xa11c('0x67')));}return rp(_0x113e09)[_0xa11c('0x25')](function(_0x1e9f15){return _0x2e6d9a[_0xa11c('0x68')](_[_0xa11c('0x31')](_0x1e9f15[_0xa11c('0x69')]['entries'],function(_0x16b6ec){return{'id':_0x16b6ec[_0xa11c('0x29')],'name':_0x16b6ec[_0xa11c('0x29')],'type':_0x16b6ec[_0xa11c('0x2e')],'active':_0x16b6ec[_0xa11c('0x6a')],'label':_0x16b6ec[_0xa11c('0x6b')],'custom':!![]};}));});}})[_0xa11c('0x25')](function(_0xf3071f){return{'count':_0xf3071f[_0xa11c('0x38')],'rows':_0xf3071f};})[_0xa11c('0x25')](respondWithResult(_0x24e473,null))['catch'](function(_0x2a29cd){var _0x529314=_0x371cd9[_0xa11c('0x32')]['test']?0x1f4:_0x2a29cd[_0xa11c('0x6c')]||0x1f4;logger[_0xa11c('0x27')](_0xa11c('0x6d'),_0xa11c('0x54'),_0x529314,JSON['stringify'](_0x2a29cd));delete _0x2a29cd[_0xa11c('0x29')];if(_0x529314===0x191){_0x529314=0x190;}_0x24e473[_0xa11c('0x19')](_0x529314)['send'](_0x371cd9['query'][_0xa11c('0x6e')]?{'message':_0xa11c('0x6f'),'statusCode':_0x2a29cd[_0xa11c('0x6c')]}:_0x2a29cd);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8f7dfb0..1002dd1 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 _0x5d51=['int_desk_accounts','util','../../config/logger','api','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x4df004,_0x564e32){var _0x432b7d=function(_0x1cbd07){while(--_0x1cbd07){_0x4df004['push'](_0x4df004['shift']());}};_0x432b7d(++_0x564e32);}(_0x5d51,0x15d));var _0x15d5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5d51[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x15d5('0x0'));var logger=require(_0x15d5('0x1'))(_0x15d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15d5('0x3'));var rimraf=require(_0x15d5('0x4'));var config=require(_0x15d5('0x5'));var attributes=require(_0x15d5('0x6'));var integrations=require(_0x15d5('0x7'));module[_0x15d5('0x8')]=function(_0x84097,_0x372e49){return _0x84097[_0x15d5('0x9')](_0x15d5('0xa'),attributes,{'tableName':_0x15d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa70a=['moment','request-promise','rimraf','../../config/environment','exports','define','DeskAccount','int_desk_accounts','lodash','api'];(function(_0x4fdff0,_0x4168a2){var _0x5bd566=function(_0x165e3c){while(--_0x165e3c){_0x4fdff0['push'](_0x4fdff0['shift']());}};_0x5bd566(++_0x4168a2);}(_0xa70a,0x1ca));var _0xaa70=function(_0xe997a5,_0x55e8f8){_0xe997a5=_0xe997a5-0x0;var _0x718c72=_0xa70a[_0xe997a5];return _0x718c72;};'use strict';var _=require(_0xaa70('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa70('0x1'));var moment=require(_0xaa70('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa70('0x4'));var config=require(_0xaa70('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xaa70('0x6')]=function(_0x1ecfde,_0x3566fb){return _0x1ecfde[_0xaa70('0x7')](_0xaa70('0x8'),attributes,{'tableName':_0xaa70('0x9'),'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 22c88b1..88bf0e5 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 _0xe8e8=['info','result','findAll','options','where','attributes','include','model','map','GetDeskAccount','catch','DeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4f401b,_0x2caa9e){var _0x547f1d=function(_0x586a29){while(--_0x586a29){_0x4f401b['push'](_0x4f401b['shift']());}};_0x547f1d(++_0x2caa9e);}(_0xe8e8,0x7e));var _0x8e8e=function(_0x12e9fe,_0x4fb923){_0x12e9fe=_0x12e9fe-0x0;var _0x445d79=_0xe8e8[_0x12e9fe];return _0x445d79;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var moment=require(_0x8e8e('0x2'));var BPromise=require(_0x8e8e('0x3'));var rs=require(_0x8e8e('0x4'));var fs=require('fs');var Redis=require(_0x8e8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e8e('0x6'));var logger=require(_0x8e8e('0x7'))(_0x8e8e('0x8'));var config=require(_0x8e8e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e8e('0xa')][_0x8e8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x428077,_0x508264,_0x40e402){return new BPromise(function(_0x35a86d,_0x1952fb){return client[_0x8e8e('0xc')](_0x428077,_0x40e402)[_0x8e8e('0xd')](function(_0x52d3db){logger['info'](_0x8e8e('0xe'),_0x508264,'request\x20sent');logger[_0x8e8e('0xf')](_0x8e8e('0x10'),_0x508264,_0x8e8e('0x11'),JSON[_0x8e8e('0x12')](_0x52d3db));if(_0x52d3db[_0x8e8e('0x13')]){if(_0x52d3db[_0x8e8e('0x13')][_0x8e8e('0x14')]===0x1f4){logger[_0x8e8e('0x13')](_0x8e8e('0xe'),_0x508264,_0x52d3db[_0x8e8e('0x13')]['message']);return _0x1952fb(_0x52d3db[_0x8e8e('0x13')][_0x8e8e('0x15')]);}logger[_0x8e8e('0x13')](_0x8e8e('0xe'),_0x508264,_0x52d3db[_0x8e8e('0x13')][_0x8e8e('0x15')]);return _0x35a86d(_0x52d3db[_0x8e8e('0x13')][_0x8e8e('0x15')]);}else{logger[_0x8e8e('0x16')](_0x8e8e('0xe'),_0x508264,_0x8e8e('0x11'));_0x35a86d(_0x52d3db[_0x8e8e('0x17')][_0x8e8e('0x15')]);}})['catch'](function(_0x403766){logger[_0x8e8e('0x13')](_0x8e8e('0xe'),_0x508264,_0x403766);_0x1952fb(_0x403766);});});}exports['GetDeskAccount']=function(_0x41407f){var _0x427469=this;return new Promise(function(_0x5835c4,_0x5927de){return db['DeskAccount'][_0x8e8e('0x18')]({'raw':_0x41407f['options']?_0x41407f[_0x8e8e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x41407f[_0x8e8e('0x19')]?_0x41407f[_0x8e8e('0x19')][_0x8e8e('0x1a')]||null:null,'attributes':_0x41407f['options']?_0x41407f[_0x8e8e('0x19')][_0x8e8e('0x1b')]||null:null,'limit':_0x41407f[_0x8e8e('0x19')]?_0x41407f[_0x8e8e('0x19')]['limit']||null:null,'include':_0x41407f[_0x8e8e('0x19')]?_0x41407f[_0x8e8e('0x19')]['include']?_['map'](_0x41407f['options'][_0x8e8e('0x1c')],function(_0x5227c2){return{'model':db[_0x5227c2[_0x8e8e('0x1d')]],'as':_0x5227c2['as'],'attributes':_0x5227c2[_0x8e8e('0x1b')],'include':_0x5227c2[_0x8e8e('0x1c')]?_[_0x8e8e('0x1e')](_0x5227c2[_0x8e8e('0x1c')],function(_0x9f0033){return{'model':db[_0x9f0033[_0x8e8e('0x1d')]],'as':_0x9f0033['as'],'attributes':_0x9f0033[_0x8e8e('0x1b')],'include':_0x9f0033[_0x8e8e('0x1c')]?_[_0x8e8e('0x1e')](_0x9f0033[_0x8e8e('0x1c')],function(_0x4548b9){return{'model':db[_0x4548b9[_0x8e8e('0x1d')]],'as':_0x4548b9['as'],'attributes':_0x4548b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e8e('0xd')](function(_0x48375a){logger[_0x8e8e('0x16')](_0x8e8e('0x1f'),_0x41407f);logger[_0x8e8e('0xf')]('GetDeskAccount',_0x41407f,JSON[_0x8e8e('0x12')](_0x48375a));_0x5835c4(_0x48375a);})[_0x8e8e('0x20')](function(_0x142658){logger[_0x8e8e('0x13')](_0x8e8e('0x1f'),_0x142658[_0x8e8e('0x15')],_0x41407f);_0x5927de(_0x427469[_0x8e8e('0x13')](0x1f4,_0x142658['message']));});});};exports['ShowDeskAccount']=function(_0x7c613){var _0x2e59fc=this;return new Promise(function(_0x387f64,_0x540dd8){return db[_0x8e8e('0x21')][_0x8e8e('0x22')]({'raw':_0x7c613[_0x8e8e('0x19')]?_0x7c613[_0x8e8e('0x19')][_0x8e8e('0x23')]===undefined?!![]:![]:!![],'where':_0x7c613[_0x8e8e('0x19')]?_0x7c613[_0x8e8e('0x19')]['where']||null:null,'attributes':_0x7c613[_0x8e8e('0x19')]?_0x7c613[_0x8e8e('0x19')][_0x8e8e('0x1b')]||null:null,'include':_0x7c613['options']?_0x7c613[_0x8e8e('0x19')][_0x8e8e('0x1c')]?_[_0x8e8e('0x1e')](_0x7c613['options'][_0x8e8e('0x1c')],function(_0x171959){return{'model':db[_0x171959[_0x8e8e('0x1d')]],'as':_0x171959['as'],'attributes':_0x171959[_0x8e8e('0x1b')],'include':_0x171959[_0x8e8e('0x1c')]?_['map'](_0x171959['include'],function(_0x2fc5bd){return{'model':db[_0x2fc5bd[_0x8e8e('0x1d')]],'as':_0x2fc5bd['as'],'attributes':_0x2fc5bd['attributes'],'include':_0x2fc5bd[_0x8e8e('0x1c')]?_[_0x8e8e('0x1e')](_0x2fc5bd[_0x8e8e('0x1c')],function(_0x7d1065){return{'model':db[_0x7d1065[_0x8e8e('0x1d')]],'as':_0x7d1065['as'],'attributes':_0x7d1065[_0x8e8e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8e8e('0xd')](function(_0x151f21){logger[_0x8e8e('0x16')]('ShowDeskAccount',_0x7c613);logger[_0x8e8e('0xf')](_0x8e8e('0x24'),_0x7c613,JSON['stringify'](_0x151f21));_0x387f64(_0x151f21);})[_0x8e8e('0x20')](function(_0x197a6a){logger[_0x8e8e('0x13')](_0x8e8e('0x24'),_0x197a6a[_0x8e8e('0x15')],_0x7c613);_0x540dd8(_0x2e59fc['error'](0x1f4,_0x197a6a[_0x8e8e('0x15')]));});});}; \ No newline at end of file +var _0xd9d6=['stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','include','model','attributes','map','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x8501bf,_0x5b4ff5){var _0x4f8179=function(_0x591c31){while(--_0x591c31){_0x8501bf['push'](_0x8501bf['shift']());}};_0x4f8179(++_0x5b4ff5);}(_0xd9d6,0x11d));var _0x6d9d=function(_0x100d4c,_0x1d1e60){_0x100d4c=_0x100d4c-0x0;var _0x1bce92=_0xd9d6[_0x100d4c];return _0x1bce92;};'use strict';var _=require(_0x6d9d('0x0'));var util=require(_0x6d9d('0x1'));var moment=require(_0x6d9d('0x2'));var BPromise=require(_0x6d9d('0x3'));var rs=require(_0x6d9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d9d('0x5'))['db'];var utils=require(_0x6d9d('0x6'));var logger=require(_0x6d9d('0x7'))('rpc');var config=require(_0x6d9d('0x8'));var jayson=require(_0x6d9d('0x9'));var client=jayson[_0x6d9d('0xa')][_0x6d9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x101e73,_0x26639c,_0xda3fd1){return new BPromise(function(_0x4272b6,_0x1540a2){return client[_0x6d9d('0xc')](_0x101e73,_0xda3fd1)[_0x6d9d('0xd')](function(_0x4aabaa){logger[_0x6d9d('0xe')](_0x6d9d('0xf'),_0x26639c,'request\x20sent');logger[_0x6d9d('0x10')](_0x6d9d('0x11'),_0x26639c,_0x6d9d('0x12'),JSON[_0x6d9d('0x13')](_0x4aabaa));if(_0x4aabaa[_0x6d9d('0x14')]){if(_0x4aabaa[_0x6d9d('0x14')][_0x6d9d('0x15')]===0x1f4){logger[_0x6d9d('0x14')]('DeskAccount,\x20%s,\x20%s',_0x26639c,_0x4aabaa[_0x6d9d('0x14')][_0x6d9d('0x16')]);return _0x1540a2(_0x4aabaa[_0x6d9d('0x14')][_0x6d9d('0x16')]);}logger[_0x6d9d('0x14')](_0x6d9d('0xf'),_0x26639c,_0x4aabaa[_0x6d9d('0x14')][_0x6d9d('0x16')]);return _0x4272b6(_0x4aabaa[_0x6d9d('0x14')][_0x6d9d('0x16')]);}else{logger[_0x6d9d('0xe')](_0x6d9d('0xf'),_0x26639c,_0x6d9d('0x12'));_0x4272b6(_0x4aabaa[_0x6d9d('0x17')]['message']);}})[_0x6d9d('0x18')](function(_0x3c9e6e){logger[_0x6d9d('0x14')](_0x6d9d('0xf'),_0x26639c,_0x3c9e6e);_0x1540a2(_0x3c9e6e);});});}exports[_0x6d9d('0x19')]=function(_0x3e2d90){var _0x3ca1d4=this;return new Promise(function(_0x7d06cb,_0x50578c){return db[_0x6d9d('0x1a')][_0x6d9d('0x1b')]({'raw':_0x3e2d90['options']?_0x3e2d90['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e2d90[_0x6d9d('0x1c')]?_0x3e2d90['options'][_0x6d9d('0x1d')]||null:null,'attributes':_0x3e2d90[_0x6d9d('0x1c')]?_0x3e2d90['options']['attributes']||null:null,'limit':_0x3e2d90[_0x6d9d('0x1c')]?_0x3e2d90['options'][_0x6d9d('0x1e')]||null:null,'include':_0x3e2d90[_0x6d9d('0x1c')]?_0x3e2d90[_0x6d9d('0x1c')][_0x6d9d('0x1f')]?_['map'](_0x3e2d90[_0x6d9d('0x1c')][_0x6d9d('0x1f')],function(_0x79d6c0){return{'model':db[_0x79d6c0[_0x6d9d('0x20')]],'as':_0x79d6c0['as'],'attributes':_0x79d6c0[_0x6d9d('0x21')],'include':_0x79d6c0['include']?_[_0x6d9d('0x22')](_0x79d6c0['include'],function(_0x53db6d){return{'model':db[_0x53db6d[_0x6d9d('0x20')]],'as':_0x53db6d['as'],'attributes':_0x53db6d[_0x6d9d('0x21')],'include':_0x53db6d['include']?_[_0x6d9d('0x22')](_0x53db6d[_0x6d9d('0x1f')],function(_0x252557){return{'model':db[_0x252557[_0x6d9d('0x20')]],'as':_0x252557['as'],'attributes':_0x252557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13c01e){logger[_0x6d9d('0xe')](_0x6d9d('0x19'),_0x3e2d90);logger[_0x6d9d('0x10')]('GetDeskAccount',_0x3e2d90,JSON[_0x6d9d('0x13')](_0x13c01e));_0x7d06cb(_0x13c01e);})[_0x6d9d('0x18')](function(_0x3f6b3d){logger[_0x6d9d('0x14')](_0x6d9d('0x19'),_0x3f6b3d[_0x6d9d('0x16')],_0x3e2d90);_0x50578c(_0x3ca1d4[_0x6d9d('0x14')](0x1f4,_0x3f6b3d[_0x6d9d('0x16')]));});});};exports[_0x6d9d('0x23')]=function(_0x5e356d){var _0x23913a=this;return new Promise(function(_0x32099f,_0x4ea539){return db[_0x6d9d('0x1a')][_0x6d9d('0x24')]({'raw':_0x5e356d[_0x6d9d('0x1c')]?_0x5e356d[_0x6d9d('0x1c')][_0x6d9d('0x25')]===undefined?!![]:![]:!![],'where':_0x5e356d[_0x6d9d('0x1c')]?_0x5e356d[_0x6d9d('0x1c')][_0x6d9d('0x1d')]||null:null,'attributes':_0x5e356d[_0x6d9d('0x1c')]?_0x5e356d[_0x6d9d('0x1c')][_0x6d9d('0x21')]||null:null,'include':_0x5e356d[_0x6d9d('0x1c')]?_0x5e356d[_0x6d9d('0x1c')]['include']?_[_0x6d9d('0x22')](_0x5e356d[_0x6d9d('0x1c')][_0x6d9d('0x1f')],function(_0xf96b3e){return{'model':db[_0xf96b3e[_0x6d9d('0x20')]],'as':_0xf96b3e['as'],'attributes':_0xf96b3e[_0x6d9d('0x21')],'include':_0xf96b3e[_0x6d9d('0x1f')]?_['map'](_0xf96b3e['include'],function(_0x5eb5ca){return{'model':db[_0x5eb5ca[_0x6d9d('0x20')]],'as':_0x5eb5ca['as'],'attributes':_0x5eb5ca[_0x6d9d('0x21')],'include':_0x5eb5ca[_0x6d9d('0x1f')]?_[_0x6d9d('0x22')](_0x5eb5ca[_0x6d9d('0x1f')],function(_0x11d479){return{'model':db[_0x11d479[_0x6d9d('0x20')]],'as':_0x11d479['as'],'attributes':_0x11d479[_0x6d9d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x164270){logger['info']('ShowDeskAccount',_0x5e356d);logger[_0x6d9d('0x10')](_0x6d9d('0x23'),_0x5e356d,JSON['stringify'](_0x164270));_0x32099f(_0x164270);})[_0x6d9d('0x18')](function(_0x138a4d){logger[_0x6d9d('0x14')](_0x6d9d('0x23'),_0x138a4d[_0x6d9d('0x16')],_0x5e356d);_0x4ea539(_0x23913a[_0x6d9d('0x14')](0x1f4,_0x138a4d['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 37f6bb6..0b326ef 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x55ca,0x126));var _0xa55c=function(_0x7c5834,_0xa96cfb){_0x7c5834=_0x7c5834-0x0;var _0x40becf=_0x55ca[_0x7c5834];return _0x40becf;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x526ee9,_0xc04fb9){var _0x2f1e1c=function(_0x2ba57e){while(--_0x2ba57e){_0x526ee9['push'](_0x526ee9['shift']());}};_0x2f1e1c(++_0xc04fb9);}(_0xedd9,0xfc));var _0x9edd=function(_0x15e5c8,_0x58cca5){_0x15e5c8=_0x15e5c8-0x0;var _0x27b304=_0xedd9[_0x15e5c8];return _0x27b304;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cfc27e4..bca4de6 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 _0x616a=['sequelize'];(function(_0x56b8c4,_0x12b01b){var _0x1a7086=function(_0xdf5e20){while(--_0xdf5e20){_0x56b8c4['push'](_0x56b8c4['shift']());}};_0x1a7086(++_0x12b01b);}(_0x616a,0xe4));var _0xa616=function(_0x397078,_0x5d548b){_0x397078=_0x397078-0x0;var _0x3eeb7c=_0x616a[_0x397078];return _0x3eeb7c;};'use strict';var Sequelize=require(_0xa616('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f07=['exports','STRING','sequelize'];(function(_0x59d94b,_0x2e6c2d){var _0x51b2d9=function(_0x2a9728){while(--_0x2a9728){_0x59d94b['push'](_0x59d94b['shift']());}};_0x51b2d9(++_0x2e6c2d);}(_0x9f07,0x170));var _0x79f0=function(_0x6a55b7,_0x591445){_0x6a55b7=_0x6a55b7-0x0;var _0x5e379a=_0x9f07[_0x6a55b7];return _0x5e379a;};'use strict';var Sequelize=require(_0x79f0('0x0'));module[_0x79f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index da36c9c..e6c6200 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 _0x22a4=['model','attributes','fields','length','nolimit','order','sort','where','pick','merge','DeskConfiguration','include','findAll','rows','catch','params','keys','includeAll','options','create','body','find','getFields','findOne','filter','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x2e51e7,_0x4c39ff){var _0x12a359=function(_0x4f774b){while(--_0x4f774b){_0x2e51e7['push'](_0x2e51e7['shift']());}};_0x12a359(++_0x4c39ff);}(_0x22a4,0xcb));var _0x422a=function(_0x5acb5c,_0xb2f845){_0x5acb5c=_0x5acb5c-0x0;var _0x359c2b=_0x22a4[_0x5acb5c];return _0x359c2b;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require(_0x422a('0x8'));var path=require('path');var sox=require(_0x422a('0x9'));var csv=require('to-csv');var ejs=require(_0x422a('0xa'));var fs=require('fs');var fs_extra=require(_0x422a('0xb'));var _=require(_0x422a('0xc'));var squel=require(_0x422a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x422a('0xe'));var querystring=require(_0x422a('0xf'));var Papa=require(_0x422a('0x10'));var Redis=require('ioredis');var authService=require(_0x422a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x12'));var hardwareService=require(_0x422a('0x13'));var logger=require(_0x422a('0x14'))(_0x422a('0x15'));var utils=require(_0x422a('0x16'));var config=require(_0x422a('0x17'));var licenseUtil=require(_0x422a('0x18'));var db=require(_0x422a('0x19'))['db'];function respondWithStatusCode(_0x61c15d,_0x8216b9){_0x8216b9=_0x8216b9||0xcc;return function(_0x1e8a3b){if(_0x1e8a3b){return _0x61c15d[_0x422a('0x1a')](_0x8216b9);}return _0x61c15d['status'](_0x8216b9)[_0x422a('0x1b')]();};}function respondWithResult(_0xd5cdcf,_0x4770e6){_0x4770e6=_0x4770e6||0xc8;return function(_0x3d2f3f){if(_0x3d2f3f){return _0xd5cdcf[_0x422a('0x1c')](_0x4770e6)[_0x422a('0x1d')](_0x3d2f3f);}};}function respondWithFilteredResult(_0x1f7967,_0xb60201){return function(_0x1cb4a9){if(_0x1cb4a9){var _0x462572=typeof _0xb60201[_0x422a('0x1e')]==='undefined'&&typeof _0xb60201[_0x422a('0x1f')]==='undefined';var _0x22cdd6=_0x1cb4a9[_0x422a('0x20')];var _0x194e2b=_0x462572?0x0:_0xb60201[_0x422a('0x1e')];var _0x56811d=_0x462572?_0x1cb4a9['count']:_0xb60201[_0x422a('0x1e')]+_0xb60201['limit'];var _0x3ab2ce;if(_0x56811d>=_0x22cdd6){_0x56811d=_0x22cdd6;_0x3ab2ce=0xc8;}else{_0x3ab2ce=0xce;}_0x1f7967[_0x422a('0x1c')](_0x3ab2ce);return _0x1f7967[_0x422a('0x21')](_0x422a('0x22'),_0x194e2b+'-'+_0x56811d+'/'+_0x22cdd6)[_0x422a('0x1d')](_0x1cb4a9);}return null;};}function patchUpdates(_0x188e13){return function(_0x402659){try{jsonpatch[_0x422a('0x23')](_0x402659,_0x188e13,!![]);}catch(_0x2bc744){return BPromise[_0x422a('0x24')](_0x2bc744);}return _0x402659['save']();};}function saveUpdates(_0x1dbd17,_0x46bc27){return function(_0x3cbddf){if(_0x3cbddf){return _0x3cbddf['update'](_0x1dbd17)[_0x422a('0x25')](function(_0x1d3a80){return _0x1d3a80;});}return null;};}function removeEntity(_0xeed801,_0x1ee90e){return function(_0xd292fd){if(_0xd292fd){return _0xd292fd[_0x422a('0x26')]()[_0x422a('0x25')](function(){_0xeed801[_0x422a('0x1c')](0xcc)[_0x422a('0x1b')]();});}};}function handleEntityNotFound(_0x193ec7,_0x1509e2){return function(_0xf0e5ec){if(!_0xf0e5ec){_0x193ec7[_0x422a('0x1a')](0x194);}return _0xf0e5ec;};}function handleError(_0x43b739,_0x22bee0){_0x22bee0=_0x22bee0||0x1f4;return function(_0x574b31){logger[_0x422a('0x27')](_0x574b31[_0x422a('0x28')]);if(_0x574b31['name']){delete _0x574b31[_0x422a('0x29')];}_0x43b739[_0x422a('0x1c')](_0x22bee0)[_0x422a('0x2a')](_0x574b31);};}exports[_0x422a('0x2b')]=function(_0x477527,_0x4d3ac6){var _0x7accf5={},_0x579de1={},_0x12fc3e={'count':0x0,'rows':[]};var _0x117ab9=_[_0x422a('0x2c')](db['DeskConfiguration'][_0x422a('0x2d')],function(_0x19dd01){return{'name':_0x19dd01[_0x422a('0x2e')],'type':_0x19dd01[_0x422a('0x2f')][_0x422a('0x30')]};});_0x579de1['model']=_[_0x422a('0x2c')](_0x117ab9,_0x422a('0x29'));_0x579de1[_0x422a('0x31')]=_['keys'](_0x477527[_0x422a('0x31')]);_0x579de1[_0x422a('0x32')]=_[_0x422a('0x33')](_0x579de1[_0x422a('0x34')],_0x579de1[_0x422a('0x31')]);_0x7accf5[_0x422a('0x35')]=_[_0x422a('0x33')](_0x579de1[_0x422a('0x34')],qs[_0x422a('0x36')](_0x477527[_0x422a('0x31')][_0x422a('0x36')]));_0x7accf5[_0x422a('0x35')]=_0x7accf5[_0x422a('0x35')][_0x422a('0x37')]?_0x7accf5[_0x422a('0x35')]:_0x579de1[_0x422a('0x34')];if(!_0x477527['query']['hasOwnProperty'](_0x422a('0x38'))){_0x7accf5[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x477527[_0x422a('0x31')]['limit']);_0x7accf5[_0x422a('0x1e')]=qs[_0x422a('0x1e')](_0x477527[_0x422a('0x31')]['offset']);}_0x7accf5[_0x422a('0x39')]=qs[_0x422a('0x3a')](_0x477527[_0x422a('0x31')][_0x422a('0x3a')]);_0x7accf5[_0x422a('0x3b')]=qs[_0x422a('0x32')](_[_0x422a('0x3c')](_0x477527[_0x422a('0x31')],_0x579de1[_0x422a('0x32')]),_0x117ab9);if(_0x477527[_0x422a('0x31')]['filter']){_0x7accf5[_0x422a('0x3b')]=_[_0x422a('0x3d')](_0x7accf5[_0x422a('0x3b')],{'$or':_[_0x422a('0x2c')](_0x117ab9,function(_0x4da6e5){if(_0x4da6e5[_0x422a('0x2f')]!=='VIRTUAL'){var _0x51db7f={};_0x51db7f[_0x4da6e5['name']]={'$like':'%'+_0x477527[_0x422a('0x31')]['filter']+'%'};return _0x51db7f;}})});}_0x7accf5=_['merge']({},_0x7accf5,_0x477527['options']);var _0x21dba5={'where':_0x7accf5[_0x422a('0x3b')]};return db[_0x422a('0x3e')]['count'](_0x21dba5)[_0x422a('0x25')](function(_0x1bd6e3){_0x12fc3e[_0x422a('0x20')]=_0x1bd6e3;if(_0x477527[_0x422a('0x31')]['includeAll']){_0x7accf5[_0x422a('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x422a('0x40')](_0x7accf5);})[_0x422a('0x25')](function(_0x172868){_0x12fc3e[_0x422a('0x41')]=_0x172868;return _0x12fc3e;})[_0x422a('0x25')](respondWithFilteredResult(_0x4d3ac6,_0x7accf5))[_0x422a('0x42')](handleError(_0x4d3ac6,null));};exports['show']=function(_0x576fbb,_0x29634d){var _0x14e9de={'raw':![],'where':{'id':_0x576fbb[_0x422a('0x43')]['id']}},_0x48d0ec={};_0x48d0ec['model']=_[_0x422a('0x44')](db[_0x422a('0x3e')][_0x422a('0x2d')]);_0x48d0ec[_0x422a('0x31')]=_['keys'](_0x576fbb[_0x422a('0x31')]);_0x48d0ec[_0x422a('0x32')]=_[_0x422a('0x33')](_0x48d0ec[_0x422a('0x34')],_0x48d0ec[_0x422a('0x31')]);_0x14e9de[_0x422a('0x35')]=_[_0x422a('0x33')](_0x48d0ec[_0x422a('0x34')],qs[_0x422a('0x36')](_0x576fbb['query'][_0x422a('0x36')]));_0x14e9de[_0x422a('0x35')]=_0x14e9de['attributes'][_0x422a('0x37')]?_0x14e9de['attributes']:_0x48d0ec[_0x422a('0x34')];if(_0x576fbb[_0x422a('0x31')][_0x422a('0x45')]){_0x14e9de['include']=[{'all':!![]}];}_0x14e9de=_[_0x422a('0x3d')]({},_0x14e9de,_0x576fbb[_0x422a('0x46')]);return db[_0x422a('0x3e')]['find'](_0x14e9de)[_0x422a('0x25')](handleEntityNotFound(_0x29634d,null))[_0x422a('0x25')](respondWithResult(_0x29634d,null))[_0x422a('0x42')](handleError(_0x29634d,null));};exports[_0x422a('0x47')]=function(_0x2b81a6,_0x304ac2){return db['DeskConfiguration'][_0x422a('0x47')](_0x2b81a6[_0x422a('0x48')],{})[_0x422a('0x25')](respondWithResult(_0x304ac2,0xc9))['catch'](handleError(_0x304ac2,null));};exports['update']=function(_0x1e38e1,_0x355d12){if(_0x1e38e1[_0x422a('0x48')]['id']){delete _0x1e38e1['body']['id'];}return db[_0x422a('0x3e')][_0x422a('0x49')]({'where':{'id':_0x1e38e1['params']['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x355d12,null))[_0x422a('0x25')](saveUpdates(_0x1e38e1[_0x422a('0x48')],null))[_0x422a('0x25')](respondWithResult(_0x355d12,null))['catch'](handleError(_0x355d12,null));};exports[_0x422a('0x26')]=function(_0x39c48b,_0x109caa){return db[_0x422a('0x3e')][_0x422a('0x49')]({'where':{'id':_0x39c48b[_0x422a('0x43')]['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x109caa,null))['then'](removeEntity(_0x109caa,null))[_0x422a('0x42')](handleError(_0x109caa,null));};exports[_0x422a('0x4a')]=function(_0x57c456,_0x3903d3,_0x506c8d){var _0x235653={};var _0x22b2e8={};var _0x1f69d5;var _0x178211;return db[_0x422a('0x3e')][_0x422a('0x4b')]({'where':{'id':_0x57c456[_0x422a('0x43')]['id']}})['then'](handleEntityNotFound(_0x3903d3,null))[_0x422a('0x25')](function(_0x3c3acf){if(_0x3c3acf){_0x1f69d5=_0x3c3acf;_0x22b2e8[_0x422a('0x34')]=_[_0x422a('0x44')](db['DeskField'][_0x422a('0x2d')]);_0x22b2e8['query']=_[_0x422a('0x44')](_0x57c456[_0x422a('0x31')]);_0x22b2e8[_0x422a('0x32')]=_[_0x422a('0x33')](_0x22b2e8['model'],_0x22b2e8[_0x422a('0x31')]);_0x235653[_0x422a('0x35')]=_['intersection'](_0x22b2e8['model'],qs[_0x422a('0x36')](_0x57c456[_0x422a('0x31')][_0x422a('0x36')]));_0x235653['attributes']=_0x235653[_0x422a('0x35')]['length']?_0x235653[_0x422a('0x35')]:_0x22b2e8['model'];_0x235653[_0x422a('0x39')]=qs['sort'](_0x57c456[_0x422a('0x31')][_0x422a('0x3a')]);_0x235653[_0x422a('0x3b')]=qs[_0x422a('0x32')](_[_0x422a('0x3c')](_0x57c456[_0x422a('0x31')],_0x22b2e8['filters']));if(_0x57c456['query']['filter']){_0x235653['where']=_[_0x422a('0x3d')](_0x235653[_0x422a('0x3b')],{'$or':_['map'](_0x235653[_0x422a('0x35')],function(_0x3b4103){var _0x4c849d={};_0x4c849d[_0x3b4103]={'$like':'%'+_0x57c456[_0x422a('0x31')][_0x422a('0x4c')]+'%'};return _0x4c849d;})});}_0x235653=_[_0x422a('0x3d')]({},_0x235653,_0x57c456[_0x422a('0x46')]);return _0x1f69d5[_0x422a('0x4a')](_0x235653);}})[_0x422a('0x25')](function(_0x7773fb){if(_0x7773fb){_0x178211=_0x7773fb[_0x422a('0x37')];if(!_0x57c456[_0x422a('0x31')][_0x422a('0x4d')](_0x422a('0x38'))){_0x235653[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x57c456[_0x422a('0x31')][_0x422a('0x1f')]);_0x235653[_0x422a('0x1e')]=qs[_0x422a('0x1e')](_0x57c456[_0x422a('0x31')][_0x422a('0x1e')]);}return _0x1f69d5[_0x422a('0x4a')](_0x235653);}})[_0x422a('0x25')](function(_0xcc94c5){if(_0xcc94c5){return _0xcc94c5?{'count':_0x178211,'rows':_0xcc94c5}:null;}})[_0x422a('0x25')](respondWithResult(_0x3903d3,null))[_0x422a('0x42')](handleError(_0x3903d3,null));};exports[_0x422a('0x4e')]=function(_0x34bb86,_0x466fe1,_0x2a5fe7){var _0x2f57e2={};var _0x1fc530={};var _0x2b7e88;var _0x5472bc;return db[_0x422a('0x3e')][_0x422a('0x4b')]({'where':{'id':_0x34bb86[_0x422a('0x43')]['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x466fe1,null))[_0x422a('0x25')](function(_0x392909){if(_0x392909){_0x2b7e88=_0x392909;_0x1fc530[_0x422a('0x34')]=_['keys'](db[_0x422a('0x4f')][_0x422a('0x2d')]);_0x1fc530['query']=_[_0x422a('0x44')](_0x34bb86[_0x422a('0x31')]);_0x1fc530[_0x422a('0x32')]=_[_0x422a('0x33')](_0x1fc530[_0x422a('0x34')],_0x1fc530[_0x422a('0x31')]);_0x2f57e2['attributes']=_['intersection'](_0x1fc530['model'],qs['fields'](_0x34bb86[_0x422a('0x31')][_0x422a('0x36')]));_0x2f57e2['attributes']=_0x2f57e2[_0x422a('0x35')][_0x422a('0x37')]?_0x2f57e2[_0x422a('0x35')]:_0x1fc530[_0x422a('0x34')];_0x2f57e2[_0x422a('0x39')]=qs[_0x422a('0x3a')](_0x34bb86[_0x422a('0x31')][_0x422a('0x3a')]);_0x2f57e2[_0x422a('0x3b')]=qs['filters'](_[_0x422a('0x3c')](_0x34bb86['query'],_0x1fc530[_0x422a('0x32')]));if(_0x34bb86[_0x422a('0x31')][_0x422a('0x4c')]){_0x2f57e2['where']=_[_0x422a('0x3d')](_0x2f57e2[_0x422a('0x3b')],{'$or':_['map'](_0x2f57e2[_0x422a('0x35')],function(_0x4a38b6){var _0x5601fd={};_0x5601fd[_0x4a38b6]={'$like':'%'+_0x34bb86[_0x422a('0x31')][_0x422a('0x4c')]+'%'};return _0x5601fd;})});}_0x2f57e2=_[_0x422a('0x3d')]({},_0x2f57e2,_0x34bb86[_0x422a('0x46')]);return _0x2b7e88['getSubjects'](_0x2f57e2);}})[_0x422a('0x25')](function(_0x41fe64){if(_0x41fe64){_0x5472bc=_0x41fe64[_0x422a('0x37')];if(!_0x34bb86[_0x422a('0x31')][_0x422a('0x4d')](_0x422a('0x38'))){_0x2f57e2[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x34bb86[_0x422a('0x31')][_0x422a('0x1f')]);_0x2f57e2['offset']=qs[_0x422a('0x1e')](_0x34bb86[_0x422a('0x31')][_0x422a('0x1e')]);}return _0x2b7e88[_0x422a('0x4e')](_0x2f57e2);}})[_0x422a('0x25')](function(_0x1850be){if(_0x1850be){return _0x1850be?{'count':_0x5472bc,'rows':_0x1850be}:null;}})[_0x422a('0x25')](respondWithResult(_0x466fe1,null))[_0x422a('0x42')](handleError(_0x466fe1,null));};exports[_0x422a('0x50')]=function(_0x1d6a73,_0x3af6ab,_0x232497){var _0x21d76a={};var _0x3c6275={};var _0x2c8c4a;var _0x19ef66;return db[_0x422a('0x3e')]['findOne']({'where':{'id':_0x1d6a73[_0x422a('0x43')]['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x3af6ab,null))['then'](function(_0x5018f0){if(_0x5018f0){_0x2c8c4a=_0x5018f0;_0x3c6275['model']=_['keys'](db['DeskField'][_0x422a('0x2d')]);_0x3c6275[_0x422a('0x31')]=_[_0x422a('0x44')](_0x1d6a73[_0x422a('0x31')]);_0x3c6275['filters']=_['intersection'](_0x3c6275[_0x422a('0x34')],_0x3c6275['query']);_0x21d76a['attributes']=_[_0x422a('0x33')](_0x3c6275[_0x422a('0x34')],qs[_0x422a('0x36')](_0x1d6a73['query']['fields']));_0x21d76a[_0x422a('0x35')]=_0x21d76a[_0x422a('0x35')][_0x422a('0x37')]?_0x21d76a[_0x422a('0x35')]:_0x3c6275[_0x422a('0x34')];_0x21d76a[_0x422a('0x39')]=qs['sort'](_0x1d6a73[_0x422a('0x31')]['sort']);_0x21d76a[_0x422a('0x3b')]=qs[_0x422a('0x32')](_[_0x422a('0x3c')](_0x1d6a73[_0x422a('0x31')],_0x3c6275[_0x422a('0x32')]));if(_0x1d6a73[_0x422a('0x31')]['filter']){_0x21d76a[_0x422a('0x3b')]=_[_0x422a('0x3d')](_0x21d76a[_0x422a('0x3b')],{'$or':_[_0x422a('0x2c')](_0x21d76a[_0x422a('0x35')],function(_0x3b3f86){var _0x10f8f2={};_0x10f8f2[_0x3b3f86]={'$like':'%'+_0x1d6a73[_0x422a('0x31')][_0x422a('0x4c')]+'%'};return _0x10f8f2;})});}_0x21d76a=_[_0x422a('0x3d')]({},_0x21d76a,_0x1d6a73[_0x422a('0x46')]);return _0x2c8c4a[_0x422a('0x50')](_0x21d76a);}})[_0x422a('0x25')](function(_0x472a08){if(_0x472a08){_0x19ef66=_0x472a08[_0x422a('0x37')];if(!_0x1d6a73[_0x422a('0x31')][_0x422a('0x4d')](_0x422a('0x38'))){_0x21d76a[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x1d6a73[_0x422a('0x31')][_0x422a('0x1f')]);_0x21d76a[_0x422a('0x1e')]=qs[_0x422a('0x1e')](_0x1d6a73[_0x422a('0x31')][_0x422a('0x1e')]);}return _0x2c8c4a[_0x422a('0x50')](_0x21d76a);}})[_0x422a('0x25')](function(_0x1e8b30){if(_0x1e8b30){return _0x1e8b30?{'count':_0x19ef66,'rows':_0x1e8b30}:null;}})[_0x422a('0x25')](respondWithResult(_0x3af6ab,null))[_0x422a('0x42')](handleError(_0x3af6ab,null));};exports[_0x422a('0x51')]=function(_0x5452c2,_0x576c2a,_0x13a7bb){var _0x24ff3a={};var _0x3bf78c={};var _0x283040;var _0x5120ec;return db[_0x422a('0x3e')]['findOne']({'where':{'id':_0x5452c2[_0x422a('0x43')]['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x576c2a,null))[_0x422a('0x25')](function(_0xfedd74){if(_0xfedd74){_0x283040=_0xfedd74;_0x3bf78c[_0x422a('0x34')]=_[_0x422a('0x44')](db[_0x422a('0x52')][_0x422a('0x2d')]);_0x3bf78c[_0x422a('0x31')]=_['keys'](_0x5452c2[_0x422a('0x31')]);_0x3bf78c[_0x422a('0x32')]=_['intersection'](_0x3bf78c['model'],_0x3bf78c['query']);_0x24ff3a['attributes']=_[_0x422a('0x33')](_0x3bf78c[_0x422a('0x34')],qs['fields'](_0x5452c2['query'][_0x422a('0x36')]));_0x24ff3a[_0x422a('0x35')]=_0x24ff3a[_0x422a('0x35')][_0x422a('0x37')]?_0x24ff3a[_0x422a('0x35')]:_0x3bf78c[_0x422a('0x34')];_0x24ff3a[_0x422a('0x39')]=qs[_0x422a('0x3a')](_0x5452c2[_0x422a('0x31')][_0x422a('0x3a')]);_0x24ff3a[_0x422a('0x3b')]=qs[_0x422a('0x32')](_['pick'](_0x5452c2[_0x422a('0x31')],_0x3bf78c['filters']));if(_0x5452c2['query'][_0x422a('0x4c')]){_0x24ff3a[_0x422a('0x3b')]=_[_0x422a('0x3d')](_0x24ff3a['where'],{'$or':_[_0x422a('0x2c')](_0x24ff3a[_0x422a('0x35')],function(_0x497c80){var _0x5222a0={};_0x5222a0[_0x497c80]={'$like':'%'+_0x5452c2[_0x422a('0x31')][_0x422a('0x4c')]+'%'};return _0x5222a0;})});}_0x24ff3a=_[_0x422a('0x3d')]({},_0x24ff3a,_0x5452c2[_0x422a('0x46')]);return _0x283040[_0x422a('0x51')](_0x24ff3a);}})[_0x422a('0x25')](function(_0x2eaf12){if(_0x2eaf12){_0x5120ec=_0x2eaf12[_0x422a('0x37')];if(!_0x5452c2[_0x422a('0x31')][_0x422a('0x4d')](_0x422a('0x38'))){_0x24ff3a[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x5452c2[_0x422a('0x31')][_0x422a('0x1f')]);_0x24ff3a[_0x422a('0x1e')]=qs['offset'](_0x5452c2[_0x422a('0x31')][_0x422a('0x1e')]);}return _0x283040[_0x422a('0x51')](_0x24ff3a);}})[_0x422a('0x25')](function(_0x4e7374){if(_0x4e7374){return _0x4e7374?{'count':_0x5120ec,'rows':_0x4e7374}:null;}})[_0x422a('0x25')](respondWithResult(_0x576c2a,null))['catch'](handleError(_0x576c2a,null));};exports[_0x422a('0x53')]=function(_0x5d6151,_0x1a7ac4,_0x1d044c){if(_0x5d6151[_0x422a('0x48')]['id']){delete _0x5d6151[_0x422a('0x48')]['id'];}return db[_0x422a('0x3e')][_0x422a('0x4b')]({'where':{'id':_0x5d6151[_0x422a('0x43')]['id']}})[_0x422a('0x25')](handleEntityNotFound(_0x1a7ac4,null))[_0x422a('0x25')](function(_0x502ef4){if(_0x502ef4){return _0x502ef4[_0x422a('0x53')](_0x5d6151[_0x422a('0x48')][_0x422a('0x54')]||[]);}return null;})[_0x422a('0x25')](respondWithResult(_0x1a7ac4,null))[_0x422a('0x42')](handleError(_0x1a7ac4,null));}; \ No newline at end of file +var _0x172c=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','update','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','DeskConfiguration','rawAttributes','key','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x172c,0x11d));var _0xc172=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x172c[_0x2e8418];return _0x548fe6;};'use strict';var emlformat=require(_0xc172('0x0'));var rimraf=require(_0xc172('0x1'));var zipdir=require(_0xc172('0x2'));var jsonpatch=require(_0xc172('0x3'));var rp=require(_0xc172('0x4'));var moment=require(_0xc172('0x5'));var BPromise=require(_0xc172('0x6'));var Mustache=require(_0xc172('0x7'));var util=require(_0xc172('0x8'));var path=require(_0xc172('0x9'));var sox=require(_0xc172('0xa'));var csv=require(_0xc172('0xb'));var ejs=require(_0xc172('0xc'));var fs=require('fs');var fs_extra=require(_0xc172('0xd'));var _=require(_0xc172('0xe'));var squel=require('squel');var crypto=require(_0xc172('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc172('0xb'));var querystring=require('querystring');var Papa=require(_0xc172('0x10'));var Redis=require(_0xc172('0x11'));var authService=require(_0xc172('0x12'));var qs=require(_0xc172('0x13'));var as=require(_0xc172('0x14'));var hardwareService=require(_0xc172('0x15'));var logger=require(_0xc172('0x16'))(_0xc172('0x17'));var utils=require('../../config/utils');var config=require(_0xc172('0x18'));var licenseUtil=require(_0xc172('0x19'));var db=require(_0xc172('0x1a'))['db'];function respondWithStatusCode(_0x444b52,_0x3caca5){_0x3caca5=_0x3caca5||0xcc;return function(_0x3b6959){if(_0x3b6959){return _0x444b52[_0xc172('0x1b')](_0x3caca5);}return _0x444b52[_0xc172('0x1c')](_0x3caca5)[_0xc172('0x1d')]();};}function respondWithResult(_0x1b04ff,_0x1c4787){_0x1c4787=_0x1c4787||0xc8;return function(_0xf2c79f){if(_0xf2c79f){return _0x1b04ff['status'](_0x1c4787)[_0xc172('0x1e')](_0xf2c79f);}};}function respondWithFilteredResult(_0x32d033,_0x768342){return function(_0x45750d){if(_0x45750d){var _0xfa7a7d=typeof _0x768342[_0xc172('0x1f')]==='undefined'&&typeof _0x768342[_0xc172('0x20')]===_0xc172('0x21');var _0x1cf0ec=_0x45750d[_0xc172('0x22')];var _0x4430a3=_0xfa7a7d?0x0:_0x768342[_0xc172('0x1f')];var _0x46919a=_0xfa7a7d?_0x45750d['count']:_0x768342[_0xc172('0x1f')]+_0x768342['limit'];var _0x540ed1;if(_0x46919a>=_0x1cf0ec){_0x46919a=_0x1cf0ec;_0x540ed1=0xc8;}else{_0x540ed1=0xce;}_0x32d033[_0xc172('0x1c')](_0x540ed1);return _0x32d033[_0xc172('0x23')](_0xc172('0x24'),_0x4430a3+'-'+_0x46919a+'/'+_0x1cf0ec)[_0xc172('0x1e')](_0x45750d);}return null;};}function patchUpdates(_0x46e7de){return function(_0x11af6e){try{jsonpatch[_0xc172('0x25')](_0x11af6e,_0x46e7de,!![]);}catch(_0x5bf67f){return BPromise[_0xc172('0x26')](_0x5bf67f);}return _0x11af6e['save']();};}function saveUpdates(_0x373357,_0x227551){return function(_0x36d0ea){if(_0x36d0ea){return _0x36d0ea['update'](_0x373357)[_0xc172('0x27')](function(_0x55c4a2){return _0x55c4a2;});}return null;};}function removeEntity(_0x1e8ced,_0x4d7f20){return function(_0x46be7a){if(_0x46be7a){return _0x46be7a[_0xc172('0x28')]()[_0xc172('0x27')](function(){_0x1e8ced[_0xc172('0x1c')](0xcc)[_0xc172('0x1d')]();});}};}function handleEntityNotFound(_0x221bfb,_0x58bf18){return function(_0x15935c){if(!_0x15935c){_0x221bfb[_0xc172('0x1b')](0x194);}return _0x15935c;};}function handleError(_0x17933b,_0x248378){_0x248378=_0x248378||0x1f4;return function(_0x5ed62b){logger[_0xc172('0x29')](_0x5ed62b['stack']);if(_0x5ed62b[_0xc172('0x2a')]){delete _0x5ed62b['name'];}_0x17933b['status'](_0x248378)[_0xc172('0x2b')](_0x5ed62b);};}exports['index']=function(_0x3fae1e,_0x5c4b66){var _0xcd2be={},_0x645065={},_0x41c410={'count':0x0,'rows':[]};var _0x52636a=_[_0xc172('0x2c')](db[_0xc172('0x2d')][_0xc172('0x2e')],function(_0x1fa553){return{'name':_0x1fa553['fieldName'],'type':_0x1fa553['type'][_0xc172('0x2f')]};});_0x645065['model']=_[_0xc172('0x2c')](_0x52636a,_0xc172('0x2a'));_0x645065[_0xc172('0x30')]=_[_0xc172('0x31')](_0x3fae1e[_0xc172('0x30')]);_0x645065[_0xc172('0x32')]=_[_0xc172('0x33')](_0x645065['model'],_0x645065[_0xc172('0x30')]);_0xcd2be[_0xc172('0x34')]=_[_0xc172('0x33')](_0x645065[_0xc172('0x35')],qs['fields'](_0x3fae1e[_0xc172('0x30')]['fields']));_0xcd2be['attributes']=_0xcd2be[_0xc172('0x34')][_0xc172('0x36')]?_0xcd2be[_0xc172('0x34')]:_0x645065[_0xc172('0x35')];if(!_0x3fae1e['query'][_0xc172('0x37')](_0xc172('0x38'))){_0xcd2be['limit']=qs[_0xc172('0x20')](_0x3fae1e[_0xc172('0x30')][_0xc172('0x20')]);_0xcd2be[_0xc172('0x1f')]=qs['offset'](_0x3fae1e[_0xc172('0x30')][_0xc172('0x1f')]);}_0xcd2be['order']=qs[_0xc172('0x39')](_0x3fae1e['query'][_0xc172('0x39')]);_0xcd2be[_0xc172('0x3a')]=qs['filters'](_[_0xc172('0x3b')](_0x3fae1e[_0xc172('0x30')],_0x645065[_0xc172('0x32')]),_0x52636a);if(_0x3fae1e[_0xc172('0x30')][_0xc172('0x3c')]){_0xcd2be[_0xc172('0x3a')]=_[_0xc172('0x3d')](_0xcd2be['where'],{'$or':_[_0xc172('0x2c')](_0x52636a,function(_0x16051e){if(_0x16051e[_0xc172('0x3e')]!==_0xc172('0x3f')){var _0x357a06={};_0x357a06[_0x16051e[_0xc172('0x2a')]]={'$like':'%'+_0x3fae1e['query'][_0xc172('0x3c')]+'%'};return _0x357a06;}})});}_0xcd2be=_['merge']({},_0xcd2be,_0x3fae1e[_0xc172('0x40')]);var _0x1ea7c7={'where':_0xcd2be[_0xc172('0x3a')]};return db[_0xc172('0x2d')][_0xc172('0x22')](_0x1ea7c7)[_0xc172('0x27')](function(_0x1c3c80){_0x41c410[_0xc172('0x22')]=_0x1c3c80;if(_0x3fae1e[_0xc172('0x30')][_0xc172('0x41')]){_0xcd2be[_0xc172('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xc172('0x43')](_0xcd2be);})[_0xc172('0x27')](function(_0x3bc1db){_0x41c410['rows']=_0x3bc1db;return _0x41c410;})[_0xc172('0x27')](respondWithFilteredResult(_0x5c4b66,_0xcd2be))[_0xc172('0x44')](handleError(_0x5c4b66,null));};exports[_0xc172('0x45')]=function(_0x306d9a,_0x286b34){var _0x53ba97={'raw':![],'where':{'id':_0x306d9a[_0xc172('0x46')]['id']}},_0x2c401b={};_0x2c401b[_0xc172('0x35')]=_[_0xc172('0x31')](db[_0xc172('0x2d')][_0xc172('0x2e')]);_0x2c401b[_0xc172('0x30')]=_[_0xc172('0x31')](_0x306d9a[_0xc172('0x30')]);_0x2c401b[_0xc172('0x32')]=_[_0xc172('0x33')](_0x2c401b['model'],_0x2c401b['query']);_0x53ba97[_0xc172('0x34')]=_[_0xc172('0x33')](_0x2c401b[_0xc172('0x35')],qs[_0xc172('0x47')](_0x306d9a[_0xc172('0x30')]['fields']));_0x53ba97[_0xc172('0x34')]=_0x53ba97[_0xc172('0x34')][_0xc172('0x36')]?_0x53ba97['attributes']:_0x2c401b[_0xc172('0x35')];if(_0x306d9a['query']['includeAll']){_0x53ba97[_0xc172('0x42')]=[{'all':!![]}];}_0x53ba97=_[_0xc172('0x3d')]({},_0x53ba97,_0x306d9a[_0xc172('0x40')]);return db['DeskConfiguration'][_0xc172('0x48')](_0x53ba97)[_0xc172('0x27')](handleEntityNotFound(_0x286b34,null))[_0xc172('0x27')](respondWithResult(_0x286b34,null))['catch'](handleError(_0x286b34,null));};exports[_0xc172('0x49')]=function(_0x39bc16,_0x3e72ce){return db[_0xc172('0x2d')]['create'](_0x39bc16[_0xc172('0x4a')],{})[_0xc172('0x27')](respondWithResult(_0x3e72ce,0xc9))[_0xc172('0x44')](handleError(_0x3e72ce,null));};exports[_0xc172('0x4b')]=function(_0x7f9cdc,_0x62316d){if(_0x7f9cdc[_0xc172('0x4a')]['id']){delete _0x7f9cdc[_0xc172('0x4a')]['id'];}return db[_0xc172('0x2d')]['find']({'where':{'id':_0x7f9cdc[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0x62316d,null))['then'](saveUpdates(_0x7f9cdc['body'],null))[_0xc172('0x27')](respondWithResult(_0x62316d,null))[_0xc172('0x44')](handleError(_0x62316d,null));};exports[_0xc172('0x28')]=function(_0x50fd33,_0xed51e4){return db['DeskConfiguration'][_0xc172('0x48')]({'where':{'id':_0x50fd33[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0xed51e4,null))[_0xc172('0x27')](removeEntity(_0xed51e4,null))[_0xc172('0x44')](handleError(_0xed51e4,null));};exports[_0xc172('0x4c')]=function(_0x33183f,_0x4f9e58,_0x438a77){var _0x1542c7={};var _0x16ba22={};var _0x5277ce;var _0x32d0d2;return db['DeskConfiguration'][_0xc172('0x4d')]({'where':{'id':_0x33183f[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0x4f9e58,null))[_0xc172('0x27')](function(_0xa3ca6e){if(_0xa3ca6e){_0x5277ce=_0xa3ca6e;_0x16ba22[_0xc172('0x35')]=_[_0xc172('0x31')](db[_0xc172('0x4e')][_0xc172('0x2e')]);_0x16ba22[_0xc172('0x30')]=_[_0xc172('0x31')](_0x33183f[_0xc172('0x30')]);_0x16ba22[_0xc172('0x32')]=_[_0xc172('0x33')](_0x16ba22[_0xc172('0x35')],_0x16ba22[_0xc172('0x30')]);_0x1542c7[_0xc172('0x34')]=_['intersection'](_0x16ba22[_0xc172('0x35')],qs[_0xc172('0x47')](_0x33183f['query'][_0xc172('0x47')]));_0x1542c7['attributes']=_0x1542c7[_0xc172('0x34')][_0xc172('0x36')]?_0x1542c7[_0xc172('0x34')]:_0x16ba22['model'];_0x1542c7[_0xc172('0x4f')]=qs[_0xc172('0x39')](_0x33183f[_0xc172('0x30')]['sort']);_0x1542c7[_0xc172('0x3a')]=qs[_0xc172('0x32')](_['pick'](_0x33183f[_0xc172('0x30')],_0x16ba22[_0xc172('0x32')]));if(_0x33183f['query'][_0xc172('0x3c')]){_0x1542c7['where']=_[_0xc172('0x3d')](_0x1542c7[_0xc172('0x3a')],{'$or':_['map'](_0x1542c7[_0xc172('0x34')],function(_0x4c1da1){var _0x13a114={};_0x13a114[_0x4c1da1]={'$like':'%'+_0x33183f[_0xc172('0x30')][_0xc172('0x3c')]+'%'};return _0x13a114;})});}_0x1542c7=_['merge']({},_0x1542c7,_0x33183f[_0xc172('0x40')]);return _0x5277ce['getFields'](_0x1542c7);}})[_0xc172('0x27')](function(_0x52cd58){if(_0x52cd58){_0x32d0d2=_0x52cd58[_0xc172('0x36')];if(!_0x33183f[_0xc172('0x30')][_0xc172('0x37')](_0xc172('0x38'))){_0x1542c7['limit']=qs[_0xc172('0x20')](_0x33183f[_0xc172('0x30')][_0xc172('0x20')]);_0x1542c7[_0xc172('0x1f')]=qs['offset'](_0x33183f[_0xc172('0x30')][_0xc172('0x1f')]);}return _0x5277ce[_0xc172('0x4c')](_0x1542c7);}})['then'](function(_0x34ec8f){if(_0x34ec8f){return _0x34ec8f?{'count':_0x32d0d2,'rows':_0x34ec8f}:null;}})[_0xc172('0x27')](respondWithResult(_0x4f9e58,null))['catch'](handleError(_0x4f9e58,null));};exports[_0xc172('0x50')]=function(_0x27b1e2,_0x12b57a,_0x398959){var _0x492b63={};var _0x4ed5a9={};var _0x5e8796;var _0x2d6ef6;return db[_0xc172('0x2d')][_0xc172('0x4d')]({'where':{'id':_0x27b1e2[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0x12b57a,null))['then'](function(_0x1e31e2){if(_0x1e31e2){_0x5e8796=_0x1e31e2;_0x4ed5a9[_0xc172('0x35')]=_[_0xc172('0x31')](db[_0xc172('0x4e')]['rawAttributes']);_0x4ed5a9[_0xc172('0x30')]=_[_0xc172('0x31')](_0x27b1e2[_0xc172('0x30')]);_0x4ed5a9[_0xc172('0x32')]=_[_0xc172('0x33')](_0x4ed5a9[_0xc172('0x35')],_0x4ed5a9[_0xc172('0x30')]);_0x492b63[_0xc172('0x34')]=_[_0xc172('0x33')](_0x4ed5a9[_0xc172('0x35')],qs[_0xc172('0x47')](_0x27b1e2[_0xc172('0x30')]['fields']));_0x492b63[_0xc172('0x34')]=_0x492b63[_0xc172('0x34')][_0xc172('0x36')]?_0x492b63['attributes']:_0x4ed5a9[_0xc172('0x35')];_0x492b63[_0xc172('0x4f')]=qs[_0xc172('0x39')](_0x27b1e2[_0xc172('0x30')][_0xc172('0x39')]);_0x492b63[_0xc172('0x3a')]=qs[_0xc172('0x32')](_[_0xc172('0x3b')](_0x27b1e2['query'],_0x4ed5a9[_0xc172('0x32')]));if(_0x27b1e2[_0xc172('0x30')][_0xc172('0x3c')]){_0x492b63[_0xc172('0x3a')]=_[_0xc172('0x3d')](_0x492b63['where'],{'$or':_[_0xc172('0x2c')](_0x492b63[_0xc172('0x34')],function(_0x4c316f){var _0x4a9efa={};_0x4a9efa[_0x4c316f]={'$like':'%'+_0x27b1e2[_0xc172('0x30')][_0xc172('0x3c')]+'%'};return _0x4a9efa;})});}_0x492b63=_[_0xc172('0x3d')]({},_0x492b63,_0x27b1e2[_0xc172('0x40')]);return _0x5e8796[_0xc172('0x50')](_0x492b63);}})[_0xc172('0x27')](function(_0x21bc11){if(_0x21bc11){_0x2d6ef6=_0x21bc11[_0xc172('0x36')];if(!_0x27b1e2[_0xc172('0x30')][_0xc172('0x37')](_0xc172('0x38'))){_0x492b63['limit']=qs['limit'](_0x27b1e2[_0xc172('0x30')][_0xc172('0x20')]);_0x492b63[_0xc172('0x1f')]=qs[_0xc172('0x1f')](_0x27b1e2[_0xc172('0x30')][_0xc172('0x1f')]);}return _0x5e8796[_0xc172('0x50')](_0x492b63);}})[_0xc172('0x27')](function(_0x1d6509){if(_0x1d6509){return _0x1d6509?{'count':_0x2d6ef6,'rows':_0x1d6509}:null;}})['then'](respondWithResult(_0x12b57a,null))[_0xc172('0x44')](handleError(_0x12b57a,null));};exports[_0xc172('0x51')]=function(_0x25b727,_0x23a26d,_0x552df8){var _0x41dac1={};var _0x52271c={};var _0x1e2960;var _0x3dbd5f;return db[_0xc172('0x2d')]['findOne']({'where':{'id':_0x25b727[_0xc172('0x46')]['id']}})['then'](handleEntityNotFound(_0x23a26d,null))[_0xc172('0x27')](function(_0x31cb53){if(_0x31cb53){_0x1e2960=_0x31cb53;_0x52271c[_0xc172('0x35')]=_[_0xc172('0x31')](db['DeskField'][_0xc172('0x2e')]);_0x52271c['query']=_[_0xc172('0x31')](_0x25b727[_0xc172('0x30')]);_0x52271c[_0xc172('0x32')]=_['intersection'](_0x52271c[_0xc172('0x35')],_0x52271c['query']);_0x41dac1[_0xc172('0x34')]=_[_0xc172('0x33')](_0x52271c[_0xc172('0x35')],qs[_0xc172('0x47')](_0x25b727['query'][_0xc172('0x47')]));_0x41dac1[_0xc172('0x34')]=_0x41dac1[_0xc172('0x34')][_0xc172('0x36')]?_0x41dac1[_0xc172('0x34')]:_0x52271c[_0xc172('0x35')];_0x41dac1[_0xc172('0x4f')]=qs[_0xc172('0x39')](_0x25b727[_0xc172('0x30')]['sort']);_0x41dac1[_0xc172('0x3a')]=qs['filters'](_[_0xc172('0x3b')](_0x25b727[_0xc172('0x30')],_0x52271c[_0xc172('0x32')]));if(_0x25b727[_0xc172('0x30')]['filter']){_0x41dac1[_0xc172('0x3a')]=_[_0xc172('0x3d')](_0x41dac1['where'],{'$or':_[_0xc172('0x2c')](_0x41dac1['attributes'],function(_0x51b3e7){var _0x382f85={};_0x382f85[_0x51b3e7]={'$like':'%'+_0x25b727[_0xc172('0x30')][_0xc172('0x3c')]+'%'};return _0x382f85;})});}_0x41dac1=_[_0xc172('0x3d')]({},_0x41dac1,_0x25b727[_0xc172('0x40')]);return _0x1e2960[_0xc172('0x51')](_0x41dac1);}})[_0xc172('0x27')](function(_0x418b17){if(_0x418b17){_0x3dbd5f=_0x418b17[_0xc172('0x36')];if(!_0x25b727[_0xc172('0x30')]['hasOwnProperty'](_0xc172('0x38'))){_0x41dac1[_0xc172('0x20')]=qs[_0xc172('0x20')](_0x25b727[_0xc172('0x30')][_0xc172('0x20')]);_0x41dac1[_0xc172('0x1f')]=qs[_0xc172('0x1f')](_0x25b727[_0xc172('0x30')]['offset']);}return _0x1e2960[_0xc172('0x51')](_0x41dac1);}})[_0xc172('0x27')](function(_0x3366b4){if(_0x3366b4){return _0x3366b4?{'count':_0x3dbd5f,'rows':_0x3366b4}:null;}})[_0xc172('0x27')](respondWithResult(_0x23a26d,null))[_0xc172('0x44')](handleError(_0x23a26d,null));};exports[_0xc172('0x52')]=function(_0x15c5a9,_0x2b5551,_0x19bc5c){var _0x5e085c={};var _0x44cbef={};var _0x249cf6;var _0x126a13;return db[_0xc172('0x2d')][_0xc172('0x4d')]({'where':{'id':_0x15c5a9[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0x2b5551,null))[_0xc172('0x27')](function(_0x3ffc9b){if(_0x3ffc9b){_0x249cf6=_0x3ffc9b;_0x44cbef['model']=_[_0xc172('0x31')](db[_0xc172('0x53')][_0xc172('0x2e')]);_0x44cbef[_0xc172('0x30')]=_[_0xc172('0x31')](_0x15c5a9[_0xc172('0x30')]);_0x44cbef['filters']=_[_0xc172('0x33')](_0x44cbef[_0xc172('0x35')],_0x44cbef[_0xc172('0x30')]);_0x5e085c[_0xc172('0x34')]=_['intersection'](_0x44cbef[_0xc172('0x35')],qs['fields'](_0x15c5a9[_0xc172('0x30')][_0xc172('0x47')]));_0x5e085c[_0xc172('0x34')]=_0x5e085c[_0xc172('0x34')][_0xc172('0x36')]?_0x5e085c[_0xc172('0x34')]:_0x44cbef[_0xc172('0x35')];_0x5e085c[_0xc172('0x4f')]=qs[_0xc172('0x39')](_0x15c5a9[_0xc172('0x30')][_0xc172('0x39')]);_0x5e085c[_0xc172('0x3a')]=qs[_0xc172('0x32')](_[_0xc172('0x3b')](_0x15c5a9[_0xc172('0x30')],_0x44cbef[_0xc172('0x32')]));if(_0x15c5a9[_0xc172('0x30')][_0xc172('0x3c')]){_0x5e085c['where']=_[_0xc172('0x3d')](_0x5e085c[_0xc172('0x3a')],{'$or':_[_0xc172('0x2c')](_0x5e085c[_0xc172('0x34')],function(_0x570c85){var _0x14ffd8={};_0x14ffd8[_0x570c85]={'$like':'%'+_0x15c5a9['query'][_0xc172('0x3c')]+'%'};return _0x14ffd8;})});}_0x5e085c=_[_0xc172('0x3d')]({},_0x5e085c,_0x15c5a9[_0xc172('0x40')]);return _0x249cf6['getTags'](_0x5e085c);}})[_0xc172('0x27')](function(_0x5b3d28){if(_0x5b3d28){_0x126a13=_0x5b3d28['length'];if(!_0x15c5a9[_0xc172('0x30')][_0xc172('0x37')](_0xc172('0x38'))){_0x5e085c['limit']=qs[_0xc172('0x20')](_0x15c5a9['query'][_0xc172('0x20')]);_0x5e085c[_0xc172('0x1f')]=qs[_0xc172('0x1f')](_0x15c5a9['query'][_0xc172('0x1f')]);}return _0x249cf6[_0xc172('0x52')](_0x5e085c);}})[_0xc172('0x27')](function(_0x1ffe1f){if(_0x1ffe1f){return _0x1ffe1f?{'count':_0x126a13,'rows':_0x1ffe1f}:null;}})[_0xc172('0x27')](respondWithResult(_0x2b5551,null))[_0xc172('0x44')](handleError(_0x2b5551,null));};exports[_0xc172('0x54')]=function(_0x12ae63,_0x3aec4b,_0x825661){if(_0x12ae63[_0xc172('0x4a')]['id']){delete _0x12ae63['body']['id'];}return db[_0xc172('0x2d')][_0xc172('0x4d')]({'where':{'id':_0x12ae63[_0xc172('0x46')]['id']}})[_0xc172('0x27')](handleEntityNotFound(_0x3aec4b,null))[_0xc172('0x27')](function(_0x33834e){if(_0x33834e){return _0x33834e[_0xc172('0x54')](_0x12ae63['body'][_0xc172('0x55')]||[]);}return null;})[_0xc172('0x27')](respondWithResult(_0x3aec4b,null))[_0xc172('0x44')](handleError(_0x3aec4b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index da88884..853c5d2 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 _0xe43c=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations'];(function(_0x26a639,_0x1befc0){var _0x28eeef=function(_0x2d517e){while(--_0x2d517e){_0x26a639['push'](_0x26a639['shift']());}};_0x28eeef(++_0x1befc0);}(_0xe43c,0x180));var _0xce43=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe43c[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xce43('0x0'));var util=require(_0xce43('0x1'));var logger=require(_0xce43('0x2'))(_0xce43('0x3'));var moment=require(_0xce43('0x4'));var BPromise=require(_0xce43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce43('0x6'));var rimraf=require('rimraf');var config=require(_0xce43('0x7'));var attributes=require(_0xce43('0x8'));module[_0xce43('0x9')]=function(_0x3557d0,_0x5d6e5c){return _0x3557d0[_0xce43('0xa')]('DeskConfiguration',attributes,{'tableName':_0xce43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','util'];(function(_0x1591f3,_0x1a083c){var _0x4f001e=function(_0x4e407d){while(--_0x4e407d){_0x1591f3['push'](_0x1591f3['shift']());}};_0x4f001e(++_0x1a083c);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x542a24,_0x2521c7){_0x542a24=_0x542a24-0x0;var _0x37f60a=_0xb6b8[_0x542a24];return _0x37f60a;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));var moment=require(_0x8b6b('0x3'));var BPromise=require(_0x8b6b('0x4'));var rp=require(_0x8b6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b6b('0x6'));var config=require(_0x8b6b('0x7'));var attributes=require(_0x8b6b('0x8'));module['exports']=function(_0x144451,_0x511688){return _0x144451['define'](_0x8b6b('0x9'),attributes,{'tableName':_0x8b6b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index ec7b517..f2aaf14 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 _0x2f68=['code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskConfiguration,\x20%s,\x20%s','debug','stringify','error'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x2f68,0x12b));var _0x82f6=function(_0x3801ae,_0x2c9995){_0x3801ae=_0x3801ae-0x0;var _0x566195=_0x2f68[_0x3801ae];return _0x566195;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});} \ No newline at end of file +var _0x39d0=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x39d0,0x144));var _0x039d=function(_0x4fd47f,_0x5031d3){_0x4fd47f=_0x4fd47f-0x0;var _0x59b74e=_0x39d0[_0x4fd47f];return _0x59b74e;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x039d('0x1'));var rs=require(_0x039d('0x2'));var fs=require('fs');var Redis=require(_0x039d('0x3'));var db=require(_0x039d('0x4'))['db'];var utils=require(_0x039d('0x5'));var logger=require('../../config/logger')(_0x039d('0x6'));var config=require(_0x039d('0x7'));var jayson=require(_0x039d('0x8'));var client=jayson[_0x039d('0x9')][_0x039d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dcc60,_0x2f8c4b,_0x4705e8){return new BPromise(function(_0x425f6e,_0x210090){return client[_0x039d('0xb')](_0x7dcc60,_0x4705e8)['then'](function(_0x591f97){logger[_0x039d('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8c4b,_0x039d('0xd'));logger[_0x039d('0xe')](_0x039d('0xf'),_0x2f8c4b,_0x039d('0xd'),JSON['stringify'](_0x591f97));if(_0x591f97[_0x039d('0x10')]){if(_0x591f97[_0x039d('0x10')][_0x039d('0x11')]===0x1f4){logger['error'](_0x039d('0x12'),_0x2f8c4b,_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);return _0x210090(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}logger[_0x039d('0x10')](_0x039d('0x12'),_0x2f8c4b,_0x591f97['error']['message']);return _0x425f6e(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}else{logger[_0x039d('0xc')](_0x039d('0x12'),_0x2f8c4b,_0x039d('0xd'));_0x425f6e(_0x591f97[_0x039d('0x14')]['message']);}})[_0x039d('0x15')](function(_0x226853){logger[_0x039d('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8c4b,_0x226853);_0x210090(_0x226853);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 98bf08f..b69cd50 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 _0x172c=['index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller'];(function(_0x51c26f,_0x31fd47){var _0x2d1ff5=function(_0x30e87c){while(--_0x30e87c){_0x51c26f['push'](_0x51c26f['shift']());}};_0x2d1ff5(++_0x31fd47);}(_0x172c,0x1ad));var _0xc172=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x172c[_0x469ac7];return _0x22f3b0;};'use strict';var multer=require('multer');var util=require(_0xc172('0x0'));var path=require('path');var timeout=require(_0xc172('0x1'));var express=require(_0xc172('0x2'));var router=express[_0xc172('0x3')]();var fs_extra=require(_0xc172('0x4'));var auth=require(_0xc172('0x5'));var interaction=require(_0xc172('0x6'));var config=require('../../config/environment');var controller=require(_0xc172('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc172('0x8')]);router[_0xc172('0x9')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0xc')]);router['post']('/',auth[_0xc172('0xb')](),controller[_0xc172('0xd')]);router[_0xc172('0xe')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0xf')]);router[_0xc172('0x10')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0x11')]);module[_0xc172('0x12')]=router; \ No newline at end of file +var _0xbd9f=['./intDeskField.controller','get','index','/:id','isAuthenticated','post','create','update','exports','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x398da6,_0x21c09a){var _0x19db1a=function(_0x2e4514){while(--_0x2e4514){_0x398da6['push'](_0x398da6['shift']());}};_0x19db1a(++_0x21c09a);}(_0xbd9f,0x98));var _0xfbd9=function(_0x49d6e4,_0x1af05e){_0x49d6e4=_0x49d6e4-0x0;var _0x3a142f=_0xbd9f[_0x49d6e4];return _0x3a142f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfbd9('0x0'));var express=require('express');var router=express[_0xfbd9('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xfbd9('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfbd9('0x3'));var controller=require(_0xfbd9('0x4'));router[_0xfbd9('0x5')]('/',auth['isAuthenticated'](),controller[_0xfbd9('0x6')]);router['get'](_0xfbd9('0x7'),auth[_0xfbd9('0x8')](),controller['show']);router[_0xfbd9('0x9')]('/',auth[_0xfbd9('0x8')](),controller[_0xfbd9('0xa')]);router['put'](_0xfbd9('0x7'),auth['isAuthenticated'](),controller[_0xfbd9('0xb')]);router['delete'](_0xfbd9('0x7'),auth[_0xfbd9('0x8')](),controller['destroy']);module[_0xfbd9('0xc')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3c02238..4af1de9 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 _0xb377=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x2507f4,_0x3f5ea9){var _0x28e094=function(_0x2329e4){while(--_0x2329e4){_0x2507f4['push'](_0x2507f4['shift']());}};_0x28e094(++_0x3f5ea9);}(_0xb377,0x157));var _0x7b37=function(_0xe9f48d,_0x24a9de){_0xe9f48d=_0xe9f48d-0x0;var _0x13a3d4=_0xb377[_0xe9f48d];return _0x13a3d4;};'use strict';var Sequelize=require(_0x7b37('0x0'));module[_0x7b37('0x1')]={'type':{'type':Sequelize[_0x7b37('0x2')]('string',_0x7b37('0x3'),_0x7b37('0x4'),'keyValue',_0x7b37('0x5')),'defaultValue':_0x7b37('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7b37('0x7')]},'keyType':{'type':Sequelize[_0x7b37('0x2')](_0x7b37('0x6'),_0x7b37('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7b37('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7b37('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ccb=['customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x9ccb,0xe7));var _0xb9cc=function(_0x35e0d4,_0x4cc3b2){_0x35e0d4=_0x35e0d4-0x0;var _0x481513=_0x9ccb[_0x35e0d4];return _0x481513;};'use strict';var Sequelize=require(_0xb9cc('0x0'));module[_0xb9cc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb9cc('0x2'),'variable',_0xb9cc('0x3'),_0xb9cc('0x4'),'picklist'),'defaultValue':_0xb9cc('0x2')},'content':{'type':Sequelize[_0xb9cc('0x5')]},'key':{'type':Sequelize[_0xb9cc('0x5')]},'keyType':{'type':Sequelize[_0xb9cc('0x6')](_0xb9cc('0x2'),_0xb9cc('0x7'),_0xb9cc('0x3'))},'keyContent':{'type':Sequelize[_0xb9cc('0x5')]},'idField':{'type':Sequelize[_0xb9cc('0x5')]},'nameField':{'type':Sequelize[_0xb9cc('0x5')]},'customField':{'type':Sequelize[_0xb9cc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 718f790..567fc72 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 _0xfed6=['send','index','rawAttributes','fieldName','type','key','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','DeskField','includeAll','include','findAll','rows','show','keys','intersection','length','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x4ae807,_0xbf2fac){var _0x43e2f5=function(_0x55a7f4){while(--_0x55a7f4){_0x4ae807['push'](_0x4ae807['shift']());}};_0x43e2f5(++_0xbf2fac);}(_0xfed6,0x14a));var _0x6fed=function(_0x3dc1c6,_0x8529a1){_0x3dc1c6=_0x3dc1c6-0x0;var _0x3c82ce=_0xfed6[_0x3dc1c6];return _0x3c82ce;};'use strict';var emlformat=require(_0x6fed('0x0'));var rimraf=require(_0x6fed('0x1'));var zipdir=require(_0x6fed('0x2'));var jsonpatch=require(_0x6fed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6fed('0x4'));var Mustache=require('mustache');var util=require(_0x6fed('0x5'));var path=require(_0x6fed('0x6'));var sox=require(_0x6fed('0x7'));var csv=require(_0x6fed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fed('0x9'));var _=require(_0x6fed('0xa'));var squel=require(_0x6fed('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fed('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6fed('0xd'));var Redis=require(_0x6fed('0xe'));var authService=require(_0x6fed('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6fed('0x10'));var hardwareService=require(_0x6fed('0x11'));var logger=require(_0x6fed('0x12'))(_0x6fed('0x13'));var utils=require('../../config/utils');var config=require(_0x6fed('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fed('0x15'))['db'];function respondWithStatusCode(_0x1a7863,_0x707f8d){_0x707f8d=_0x707f8d||0xcc;return function(_0x414e4f){if(_0x414e4f){return _0x1a7863[_0x6fed('0x16')](_0x707f8d);}return _0x1a7863[_0x6fed('0x17')](_0x707f8d)[_0x6fed('0x18')]();};}function respondWithResult(_0x3579e5,_0x5558ef){_0x5558ef=_0x5558ef||0xc8;return function(_0x304d01){if(_0x304d01){return _0x3579e5[_0x6fed('0x17')](_0x5558ef)[_0x6fed('0x19')](_0x304d01);}};}function respondWithFilteredResult(_0x4cc86c,_0x1332c6){return function(_0x294280){if(_0x294280){var _0x67415d=typeof _0x1332c6[_0x6fed('0x1a')]===_0x6fed('0x1b')&&typeof _0x1332c6[_0x6fed('0x1c')]===_0x6fed('0x1b');var _0x4eb346=_0x294280['count'];var _0x2f419a=_0x67415d?0x0:_0x1332c6['offset'];var _0x56988a=_0x67415d?_0x294280[_0x6fed('0x1d')]:_0x1332c6['offset']+_0x1332c6[_0x6fed('0x1c')];var _0x261663;if(_0x56988a>=_0x4eb346){_0x56988a=_0x4eb346;_0x261663=0xc8;}else{_0x261663=0xce;}_0x4cc86c[_0x6fed('0x17')](_0x261663);return _0x4cc86c[_0x6fed('0x1e')](_0x6fed('0x1f'),_0x2f419a+'-'+_0x56988a+'/'+_0x4eb346)[_0x6fed('0x19')](_0x294280);}return null;};}function patchUpdates(_0x357adf){return function(_0x2c838b){try{jsonpatch[_0x6fed('0x20')](_0x2c838b,_0x357adf,!![]);}catch(_0x2f4dc3){return BPromise['reject'](_0x2f4dc3);}return _0x2c838b[_0x6fed('0x21')]();};}function saveUpdates(_0x4e4373,_0x4e394b){return function(_0x1a2bec){if(_0x1a2bec){return _0x1a2bec[_0x6fed('0x22')](_0x4e4373)[_0x6fed('0x23')](function(_0x473d86){return _0x473d86;});}return null;};}function removeEntity(_0x21954c,_0x3c59a1){return function(_0xefb994){if(_0xefb994){return _0xefb994[_0x6fed('0x24')]()[_0x6fed('0x23')](function(){_0x21954c[_0x6fed('0x17')](0xcc)[_0x6fed('0x18')]();});}};}function handleEntityNotFound(_0x497747,_0x4b0e15){return function(_0x39b3ab){if(!_0x39b3ab){_0x497747[_0x6fed('0x16')](0x194);}return _0x39b3ab;};}function handleError(_0x5d02f5,_0x491d65){_0x491d65=_0x491d65||0x1f4;return function(_0x52cad1){logger[_0x6fed('0x25')](_0x52cad1[_0x6fed('0x26')]);if(_0x52cad1[_0x6fed('0x27')]){delete _0x52cad1['name'];}_0x5d02f5[_0x6fed('0x17')](_0x491d65)[_0x6fed('0x28')](_0x52cad1);};}exports[_0x6fed('0x29')]=function(_0x440d8a,_0x2e7a65){var _0x18bea5={},_0x35d2c2={},_0x1870ff={'count':0x0,'rows':[]};var _0x15bf3f=_['map'](db['DeskField'][_0x6fed('0x2a')],function(_0x48009a){return{'name':_0x48009a[_0x6fed('0x2b')],'type':_0x48009a[_0x6fed('0x2c')][_0x6fed('0x2d')]};});_0x35d2c2['model']=_['map'](_0x15bf3f,_0x6fed('0x27'));_0x35d2c2[_0x6fed('0x2e')]=_['keys'](_0x440d8a[_0x6fed('0x2e')]);_0x35d2c2['filters']=_['intersection'](_0x35d2c2[_0x6fed('0x2f')],_0x35d2c2['query']);_0x18bea5[_0x6fed('0x30')]=_['intersection'](_0x35d2c2['model'],qs[_0x6fed('0x31')](_0x440d8a['query']['fields']));_0x18bea5[_0x6fed('0x30')]=_0x18bea5[_0x6fed('0x30')]['length']?_0x18bea5[_0x6fed('0x30')]:_0x35d2c2[_0x6fed('0x2f')];if(!_0x440d8a['query'][_0x6fed('0x32')](_0x6fed('0x33'))){_0x18bea5['limit']=qs[_0x6fed('0x1c')](_0x440d8a[_0x6fed('0x2e')][_0x6fed('0x1c')]);_0x18bea5[_0x6fed('0x1a')]=qs['offset'](_0x440d8a[_0x6fed('0x2e')]['offset']);}_0x18bea5[_0x6fed('0x34')]=qs[_0x6fed('0x35')](_0x440d8a['query'][_0x6fed('0x35')]);_0x18bea5['where']=qs[_0x6fed('0x36')](_[_0x6fed('0x37')](_0x440d8a[_0x6fed('0x2e')],_0x35d2c2[_0x6fed('0x36')]),_0x15bf3f);if(_0x440d8a['query'][_0x6fed('0x38')]){_0x18bea5[_0x6fed('0x39')]=_[_0x6fed('0x3a')](_0x18bea5[_0x6fed('0x39')],{'$or':_['map'](_0x15bf3f,function(_0x102068){if(_0x102068[_0x6fed('0x2c')]!=='VIRTUAL'){var _0xf61812={};_0xf61812[_0x102068[_0x6fed('0x27')]]={'$like':'%'+_0x440d8a[_0x6fed('0x2e')][_0x6fed('0x38')]+'%'};return _0xf61812;}})});}_0x18bea5=_[_0x6fed('0x3a')]({},_0x18bea5,_0x440d8a[_0x6fed('0x3b')]);var _0x111be3={'where':_0x18bea5[_0x6fed('0x39')]};return db[_0x6fed('0x3c')]['count'](_0x111be3)[_0x6fed('0x23')](function(_0x36dfb9){_0x1870ff['count']=_0x36dfb9;if(_0x440d8a['query'][_0x6fed('0x3d')]){_0x18bea5[_0x6fed('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x6fed('0x3f')](_0x18bea5);})[_0x6fed('0x23')](function(_0x5ca319){_0x1870ff[_0x6fed('0x40')]=_0x5ca319;return _0x1870ff;})[_0x6fed('0x23')](respondWithFilteredResult(_0x2e7a65,_0x18bea5))['catch'](handleError(_0x2e7a65,null));};exports[_0x6fed('0x41')]=function(_0x398daa,_0x792d5){var _0x3424bf={'raw':!![],'where':{'id':_0x398daa['params']['id']}},_0x5bd845={};_0x5bd845[_0x6fed('0x2f')]=_[_0x6fed('0x42')](db[_0x6fed('0x3c')][_0x6fed('0x2a')]);_0x5bd845[_0x6fed('0x2e')]=_['keys'](_0x398daa['query']);_0x5bd845['filters']=_[_0x6fed('0x43')](_0x5bd845[_0x6fed('0x2f')],_0x5bd845[_0x6fed('0x2e')]);_0x3424bf[_0x6fed('0x30')]=_[_0x6fed('0x43')](_0x5bd845[_0x6fed('0x2f')],qs[_0x6fed('0x31')](_0x398daa[_0x6fed('0x2e')][_0x6fed('0x31')]));_0x3424bf['attributes']=_0x3424bf['attributes'][_0x6fed('0x44')]?_0x3424bf[_0x6fed('0x30')]:_0x5bd845[_0x6fed('0x2f')];if(_0x398daa[_0x6fed('0x2e')][_0x6fed('0x3d')]){_0x3424bf['include']=[{'all':!![]}];}_0x3424bf=_[_0x6fed('0x3a')]({},_0x3424bf,_0x398daa[_0x6fed('0x3b')]);return db[_0x6fed('0x3c')]['find'](_0x3424bf)['then'](handleEntityNotFound(_0x792d5,null))[_0x6fed('0x23')](respondWithResult(_0x792d5,null))[_0x6fed('0x45')](handleError(_0x792d5,null));};exports[_0x6fed('0x46')]=function(_0x2f253c,_0x5a2ea5){return db[_0x6fed('0x3c')][_0x6fed('0x46')](_0x2f253c[_0x6fed('0x47')],{})[_0x6fed('0x23')](respondWithResult(_0x5a2ea5,0xc9))[_0x6fed('0x45')](handleError(_0x5a2ea5,null));};exports[_0x6fed('0x22')]=function(_0x1891aa,_0x59b9c2){if(_0x1891aa[_0x6fed('0x47')]['id']){delete _0x1891aa['body']['id'];}return db[_0x6fed('0x3c')][_0x6fed('0x48')]({'where':{'id':_0x1891aa[_0x6fed('0x49')]['id']}})[_0x6fed('0x23')](handleEntityNotFound(_0x59b9c2,null))[_0x6fed('0x23')](saveUpdates(_0x1891aa[_0x6fed('0x47')],null))['then'](respondWithResult(_0x59b9c2,null))[_0x6fed('0x45')](handleError(_0x59b9c2,null));};exports[_0x6fed('0x24')]=function(_0xc07afa,_0x465272){return db[_0x6fed('0x3c')][_0x6fed('0x48')]({'where':{'id':_0xc07afa[_0x6fed('0x49')]['id']}})['then'](handleEntityNotFound(_0x465272,null))[_0x6fed('0x23')](removeEntity(_0x465272,null))[_0x6fed('0x45')](handleError(_0x465272,null));}; \ No newline at end of file +var _0x556b=['send','index','DeskField','rawAttributes','type','model','name','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','map','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','destroy','sendStatus','stack'];(function(_0x3b3d46,_0x4b4866){var _0x219568=function(_0x42c9fd){while(--_0x42c9fd){_0x3b3d46['push'](_0x3b3d46['shift']());}};_0x219568(++_0x4b4866);}(_0x556b,0x1d7));var _0xb556=function(_0xbdafdc,_0x1b483d){_0xbdafdc=_0xbdafdc-0x0;var _0x5dcfc2=_0x556b[_0xbdafdc];return _0x5dcfc2;};'use strict';var emlformat=require(_0xb556('0x0'));var rimraf=require(_0xb556('0x1'));var zipdir=require(_0xb556('0x2'));var jsonpatch=require(_0xb556('0x3'));var rp=require(_0xb556('0x4'));var moment=require('moment');var BPromise=require(_0xb556('0x5'));var Mustache=require(_0xb556('0x6'));var util=require(_0xb556('0x7'));var path=require(_0xb556('0x8'));var sox=require(_0xb556('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb556('0xa'));var squel=require(_0xb556('0xb'));var crypto=require(_0xb556('0xc'));var jsforce=require(_0xb556('0xd'));var deskjs=require(_0xb556('0xe'));var toCsv=require(_0xb556('0xf'));var querystring=require(_0xb556('0x10'));var Papa=require(_0xb556('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb556('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb556('0x13'));var logger=require(_0xb556('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb556('0x15'));var licenseUtil=require(_0xb556('0x16'));var db=require(_0xb556('0x17'))['db'];function respondWithStatusCode(_0x40d9f2,_0xef593){_0xef593=_0xef593||0xcc;return function(_0x383401){if(_0x383401){return _0x40d9f2['sendStatus'](_0xef593);}return _0x40d9f2['status'](_0xef593)[_0xb556('0x18')]();};}function respondWithResult(_0x5a002a,_0x29fa7e){_0x29fa7e=_0x29fa7e||0xc8;return function(_0x52ff5e){if(_0x52ff5e){return _0x5a002a['status'](_0x29fa7e)['json'](_0x52ff5e);}};}function respondWithFilteredResult(_0x39305f,_0x9c69d9){return function(_0xffd07){if(_0xffd07){var _0x329bd0=typeof _0x9c69d9[_0xb556('0x19')]===_0xb556('0x1a')&&typeof _0x9c69d9[_0xb556('0x1b')]===_0xb556('0x1a');var _0xcfaa19=_0xffd07['count'];var _0x475808=_0x329bd0?0x0:_0x9c69d9[_0xb556('0x19')];var _0xb378b2=_0x329bd0?_0xffd07[_0xb556('0x1c')]:_0x9c69d9['offset']+_0x9c69d9[_0xb556('0x1b')];var _0x355b15;if(_0xb378b2>=_0xcfaa19){_0xb378b2=_0xcfaa19;_0x355b15=0xc8;}else{_0x355b15=0xce;}_0x39305f[_0xb556('0x1d')](_0x355b15);return _0x39305f[_0xb556('0x1e')]('Content-Range',_0x475808+'-'+_0xb378b2+'/'+_0xcfaa19)[_0xb556('0x1f')](_0xffd07);}return null;};}function patchUpdates(_0x3f1f30){return function(_0xa840e7){try{jsonpatch[_0xb556('0x20')](_0xa840e7,_0x3f1f30,!![]);}catch(_0x49d0b5){return BPromise[_0xb556('0x21')](_0x49d0b5);}return _0xa840e7[_0xb556('0x22')]();};}function saveUpdates(_0x21a3b6,_0x126af6){return function(_0x420ddb){if(_0x420ddb){return _0x420ddb[_0xb556('0x23')](_0x21a3b6)[_0xb556('0x24')](function(_0x5f10a5){return _0x5f10a5;});}return null;};}function removeEntity(_0x33797a,_0x3d5ae7){return function(_0x12b195){if(_0x12b195){return _0x12b195[_0xb556('0x25')]()[_0xb556('0x24')](function(){_0x33797a[_0xb556('0x1d')](0xcc)[_0xb556('0x18')]();});}};}function handleEntityNotFound(_0x442264,_0x22abed){return function(_0x184e87){if(!_0x184e87){_0x442264[_0xb556('0x26')](0x194);}return _0x184e87;};}function handleError(_0x3a328c,_0xb89dbe){_0xb89dbe=_0xb89dbe||0x1f4;return function(_0x1962b1){logger['error'](_0x1962b1[_0xb556('0x27')]);if(_0x1962b1['name']){delete _0x1962b1['name'];}_0x3a328c['status'](_0xb89dbe)[_0xb556('0x28')](_0x1962b1);};}exports[_0xb556('0x29')]=function(_0x27fd7e,_0x58180c){var _0x19544e={},_0x3c9a87={},_0x5d8d06={'count':0x0,'rows':[]};var _0x58990f=_['map'](db[_0xb556('0x2a')][_0xb556('0x2b')],function(_0x4bba03){return{'name':_0x4bba03['fieldName'],'type':_0x4bba03[_0xb556('0x2c')]['key']};});_0x3c9a87[_0xb556('0x2d')]=_['map'](_0x58990f,_0xb556('0x2e'));_0x3c9a87['query']=_[_0xb556('0x2f')](_0x27fd7e[_0xb556('0x30')]);_0x3c9a87['filters']=_['intersection'](_0x3c9a87[_0xb556('0x2d')],_0x3c9a87[_0xb556('0x30')]);_0x19544e[_0xb556('0x31')]=_['intersection'](_0x3c9a87[_0xb556('0x2d')],qs[_0xb556('0x32')](_0x27fd7e[_0xb556('0x30')][_0xb556('0x32')]));_0x19544e['attributes']=_0x19544e[_0xb556('0x31')][_0xb556('0x33')]?_0x19544e['attributes']:_0x3c9a87['model'];if(!_0x27fd7e[_0xb556('0x30')][_0xb556('0x34')](_0xb556('0x35'))){_0x19544e['limit']=qs[_0xb556('0x1b')](_0x27fd7e[_0xb556('0x30')]['limit']);_0x19544e[_0xb556('0x19')]=qs[_0xb556('0x19')](_0x27fd7e[_0xb556('0x30')]['offset']);}_0x19544e['order']=qs[_0xb556('0x36')](_0x27fd7e[_0xb556('0x30')][_0xb556('0x36')]);_0x19544e['where']=qs[_0xb556('0x37')](_[_0xb556('0x38')](_0x27fd7e['query'],_0x3c9a87['filters']),_0x58990f);if(_0x27fd7e[_0xb556('0x30')][_0xb556('0x39')]){_0x19544e['where']=_['merge'](_0x19544e[_0xb556('0x3a')],{'$or':_[_0xb556('0x3b')](_0x58990f,function(_0x38c26d){if(_0x38c26d[_0xb556('0x2c')]!=='VIRTUAL'){var _0x348a8e={};_0x348a8e[_0x38c26d['name']]={'$like':'%'+_0x27fd7e['query'][_0xb556('0x39')]+'%'};return _0x348a8e;}})});}_0x19544e=_[_0xb556('0x3c')]({},_0x19544e,_0x27fd7e[_0xb556('0x3d')]);var _0x15add6={'where':_0x19544e[_0xb556('0x3a')]};return db[_0xb556('0x2a')]['count'](_0x15add6)[_0xb556('0x24')](function(_0xe1e49){_0x5d8d06[_0xb556('0x1c')]=_0xe1e49;if(_0x27fd7e[_0xb556('0x30')][_0xb556('0x3e')]){_0x19544e['include']=[{'all':!![]}];}return db[_0xb556('0x2a')][_0xb556('0x3f')](_0x19544e);})['then'](function(_0x107746){_0x5d8d06[_0xb556('0x40')]=_0x107746;return _0x5d8d06;})[_0xb556('0x24')](respondWithFilteredResult(_0x58180c,_0x19544e))[_0xb556('0x41')](handleError(_0x58180c,null));};exports[_0xb556('0x42')]=function(_0x35c0ad,_0xfb9f2b){var _0x488888={'raw':!![],'where':{'id':_0x35c0ad[_0xb556('0x43')]['id']}},_0x51ad59={};_0x51ad59[_0xb556('0x2d')]=_['keys'](db['DeskField'][_0xb556('0x2b')]);_0x51ad59[_0xb556('0x30')]=_[_0xb556('0x2f')](_0x35c0ad['query']);_0x51ad59[_0xb556('0x37')]=_['intersection'](_0x51ad59[_0xb556('0x2d')],_0x51ad59[_0xb556('0x30')]);_0x488888[_0xb556('0x31')]=_[_0xb556('0x44')](_0x51ad59['model'],qs[_0xb556('0x32')](_0x35c0ad[_0xb556('0x30')]['fields']));_0x488888[_0xb556('0x31')]=_0x488888[_0xb556('0x31')][_0xb556('0x33')]?_0x488888[_0xb556('0x31')]:_0x51ad59['model'];if(_0x35c0ad[_0xb556('0x30')][_0xb556('0x3e')]){_0x488888[_0xb556('0x45')]=[{'all':!![]}];}_0x488888=_[_0xb556('0x3c')]({},_0x488888,_0x35c0ad['options']);return db['DeskField'][_0xb556('0x46')](_0x488888)[_0xb556('0x24')](handleEntityNotFound(_0xfb9f2b,null))['then'](respondWithResult(_0xfb9f2b,null))[_0xb556('0x41')](handleError(_0xfb9f2b,null));};exports[_0xb556('0x47')]=function(_0x55b9a1,_0x29ac04){return db[_0xb556('0x2a')][_0xb556('0x47')](_0x55b9a1[_0xb556('0x48')],{})[_0xb556('0x24')](respondWithResult(_0x29ac04,0xc9))[_0xb556('0x41')](handleError(_0x29ac04,null));};exports[_0xb556('0x23')]=function(_0x167e6b,_0x221df8){if(_0x167e6b[_0xb556('0x48')]['id']){delete _0x167e6b[_0xb556('0x48')]['id'];}return db[_0xb556('0x2a')][_0xb556('0x46')]({'where':{'id':_0x167e6b[_0xb556('0x43')]['id']}})[_0xb556('0x24')](handleEntityNotFound(_0x221df8,null))[_0xb556('0x24')](saveUpdates(_0x167e6b['body'],null))[_0xb556('0x24')](respondWithResult(_0x221df8,null))[_0xb556('0x41')](handleError(_0x221df8,null));};exports['destroy']=function(_0x496b7f,_0x4686d5){return db[_0xb556('0x2a')][_0xb556('0x46')]({'where':{'id':_0x496b7f[_0xb556('0x43')]['id']}})['then'](handleEntityNotFound(_0x4686d5,null))['then'](removeEntity(_0x4686d5,null))[_0xb556('0x41')](handleError(_0x4686d5,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f3ee57f..c7987d1 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 _0x130f=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3d5555,_0x2df2f8){var _0x456e99=function(_0x50edf1){while(--_0x50edf1){_0x3d5555['push'](_0x3d5555['shift']());}};_0x456e99(++_0x2df2f8);}(_0x130f,0x88));var _0xf130=function(_0x37a747,_0x25abc8){_0x37a747=_0x37a747-0x0;var _0x450344=_0x130f[_0x37a747];return _0x450344;};'use strict';var _=require(_0xf130('0x0'));var util=require(_0xf130('0x1'));var logger=require(_0xf130('0x2'))('api');var moment=require(_0xf130('0x3'));var BPromise=require(_0xf130('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf130('0x5'));var rimraf=require(_0xf130('0x6'));var config=require(_0xf130('0x7'));var attributes=require(_0xf130('0x8'));module[_0xf130('0x9')]=function(_0x1d19fc,_0x4bc866){return _0x1d19fc[_0xf130('0xa')](_0xf130('0xb'),attributes,{'tableName':_0xf130('0xc'),'paranoid':![],'indexes':[{'name':_0xf130('0xd'),'fields':[_0xf130('0xe'),_0xf130('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb0a=['../../config/environment','./intDeskField.attributes','DeskField','desk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x58a183,_0x40c2b0){var _0x28106b=function(_0x18ba9d){while(--_0x18ba9d){_0x58a183['push'](_0x58a183['shift']());}};_0x28106b(++_0x40c2b0);}(_0xdb0a,0x6d));var _0xadb0=function(_0xa7e16e,_0x3dffb0){_0xa7e16e=_0xa7e16e-0x0;var _0xd9b0a8=_0xdb0a[_0xa7e16e];return _0xd9b0a8;};'use strict';var _=require('lodash');var util=require(_0xadb0('0x0'));var logger=require(_0xadb0('0x1'))(_0xadb0('0x2'));var moment=require(_0xadb0('0x3'));var BPromise=require(_0xadb0('0x4'));var rp=require(_0xadb0('0x5'));var fs=require('fs');var path=require(_0xadb0('0x6'));var rimraf=require(_0xadb0('0x7'));var config=require(_0xadb0('0x8'));var attributes=require(_0xadb0('0x9'));module['exports']=function(_0x3d3e2a,_0x2d1919){return _0x3d3e2a['define'](_0xadb0('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xadb0('0xb'),'fields':['idField',_0xadb0('0xc')],'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 e09eb9f..393f1ed 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 _0x35e7=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x173b35,_0x5830a){var _0x5d68fb=function(_0x3a0dab){while(--_0x3a0dab){_0x173b35['push'](_0x173b35['shift']());}};_0x5d68fb(++_0x5830a);}(_0x35e7,0x1a1));var _0x735e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x35e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x735e('0x0'));var util=require('util');var moment=require(_0x735e('0x1'));var BPromise=require(_0x735e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x735e('0x3'));var db=require(_0x735e('0x4'))['db'];var utils=require(_0x735e('0x5'));var logger=require(_0x735e('0x6'))(_0x735e('0x7'));var config=require(_0x735e('0x8'));var jayson=require(_0x735e('0x9'));var client=jayson['client'][_0x735e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f04cd,_0x12b621,_0x4643e5){return new BPromise(function(_0x2ff7a9,_0x5ee4eb){return client['request'](_0x4f04cd,_0x4643e5)['then'](function(_0x15ff53){logger[_0x735e('0xb')](_0x735e('0xc'),_0x12b621,'request\x20sent');logger[_0x735e('0xd')](_0x735e('0xe'),_0x12b621,_0x735e('0xf'),JSON[_0x735e('0x10')](_0x15ff53));if(_0x15ff53[_0x735e('0x11')]){if(_0x15ff53[_0x735e('0x11')][_0x735e('0x12')]===0x1f4){logger[_0x735e('0x11')]('DeskField,\x20%s,\x20%s',_0x12b621,_0x15ff53[_0x735e('0x11')]['message']);return _0x5ee4eb(_0x15ff53[_0x735e('0x11')]['message']);}logger['error'](_0x735e('0xc'),_0x12b621,_0x15ff53[_0x735e('0x11')][_0x735e('0x13')]);return _0x2ff7a9(_0x15ff53[_0x735e('0x11')][_0x735e('0x13')]);}else{logger[_0x735e('0xb')](_0x735e('0xc'),_0x12b621,_0x735e('0xf'));_0x2ff7a9(_0x15ff53[_0x735e('0x14')][_0x735e('0x13')]);}})[_0x735e('0x15')](function(_0x514065){logger[_0x735e('0x11')](_0x735e('0xc'),_0x12b621,_0x514065);_0x5ee4eb(_0x514065);});});} \ No newline at end of file +var _0xca21=['code','message','result','catch','lodash','util','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xca21,0xfb));var _0x1ca2=function(_0x45ca71,_0x214473){_0x45ca71=_0x45ca71-0x0;var _0x101df8=_0xca21[_0x45ca71];return _0x101df8;};'use strict';var _=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ca2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1ca2('0x3'))(_0x1ca2('0x4'));var config=require('../../config/environment');var jayson=require(_0x1ca2('0x5'));var client=jayson[_0x1ca2('0x6')][_0x1ca2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x599512,_0xc08db3,_0x6e3cd6){return new BPromise(function(_0x3226ec,_0x232db4){return client[_0x1ca2('0x8')](_0x599512,_0x6e3cd6)[_0x1ca2('0x9')](function(_0x5e165a){logger[_0x1ca2('0xa')](_0x1ca2('0xb'),_0xc08db3,'request\x20sent');logger[_0x1ca2('0xc')](_0x1ca2('0xd'),_0xc08db3,'request\x20sent',JSON['stringify'](_0x5e165a));if(_0x5e165a[_0x1ca2('0xe')]){if(_0x5e165a[_0x1ca2('0xe')][_0x1ca2('0xf')]===0x1f4){logger[_0x1ca2('0xe')]('DeskField,\x20%s,\x20%s',_0xc08db3,_0x5e165a[_0x1ca2('0xe')][_0x1ca2('0x10')]);return _0x232db4(_0x5e165a[_0x1ca2('0xe')]['message']);}logger['error'](_0x1ca2('0xb'),_0xc08db3,_0x5e165a[_0x1ca2('0xe')][_0x1ca2('0x10')]);return _0x3226ec(_0x5e165a[_0x1ca2('0xe')]['message']);}else{logger[_0x1ca2('0xa')](_0x1ca2('0xb'),_0xc08db3,'request\x20sent');_0x3226ec(_0x5e165a[_0x1ca2('0x11')][_0x1ca2('0x10')]);}})[_0x1ca2('0x12')](function(_0x5dd957){logger[_0x1ca2('0xe')]('DeskField,\x20%s,\x20%s',_0xc08db3,_0x5dd957);_0x232db4(_0x5dd957);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6dbcd1a..e8fb704 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 _0xf864=['destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete'];(function(_0x80503b,_0x4bb17f){var _0x1ca7ff=function(_0x224209){while(--_0x224209){_0x80503b['push'](_0x80503b['shift']());}};_0x1ca7ff(++_0x4bb17f);}(_0xf864,0x119));var _0x4f86=function(_0x16a463,_0x44730e){_0x16a463=_0x16a463-0x0;var _0x2153ae=_0xf864[_0x16a463];return _0x2153ae;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4f86('0x0'));var express=require(_0x4f86('0x1'));var router=express[_0x4f86('0x2')]();var fs_extra=require(_0x4f86('0x3'));var auth=require(_0x4f86('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f86('0x5'));var controller=require(_0x4f86('0x6'));router[_0x4f86('0x7')]('/',auth[_0x4f86('0x8')](),controller[_0x4f86('0x9')]);router[_0x4f86('0x7')](_0x4f86('0xa'),auth[_0x4f86('0x8')](),controller['show']);router['get'](_0x4f86('0xb'),auth[_0x4f86('0x8')](),controller['getConfigurations']);router['get'](_0x4f86('0xc'),auth['isAuthenticated'](),controller[_0x4f86('0xd')]);router[_0x4f86('0xe')]('/',auth[_0x4f86('0x8')](),controller[_0x4f86('0xf')]);router[_0x4f86('0xe')](_0x4f86('0xb'),auth['isAuthenticated'](),controller[_0x4f86('0x10')]);router['put'](_0x4f86('0xa'),auth[_0x4f86('0x8')](),controller[_0x4f86('0x11')]);router[_0x4f86('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4f86('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3fb6=['getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x12f328,_0x15c332){var _0x22b2f2=function(_0x18985f){while(--_0x18985f){_0x12f328['push'](_0x12f328['shift']());}};_0x22b2f2(++_0x15c332);}(_0x3fb6,0x1d0));var _0x63fb=function(_0xdd33c9,_0x305fd4){_0xdd33c9=_0xdd33c9-0x0;var _0x1c18ce=_0x3fb6[_0xdd33c9];return _0x1c18ce;};'use strict';var multer=require(_0x63fb('0x0'));var util=require(_0x63fb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63fb('0x2'));var router=express['Router']();var fs_extra=require(_0x63fb('0x3'));var auth=require(_0x63fb('0x4'));var interaction=require(_0x63fb('0x5'));var config=require(_0x63fb('0x6'));var controller=require(_0x63fb('0x7'));router[_0x63fb('0x8')]('/',auth[_0x63fb('0x9')](),controller[_0x63fb('0xa')]);router[_0x63fb('0x8')](_0x63fb('0xb'),auth[_0x63fb('0x9')](),controller[_0x63fb('0xc')]);router['get'](_0x63fb('0xd'),auth['isAuthenticated'](),controller[_0x63fb('0xe')]);router[_0x63fb('0x8')](_0x63fb('0xf'),auth[_0x63fb('0x9')](),controller[_0x63fb('0x10')]);router[_0x63fb('0x11')]('/',auth[_0x63fb('0x9')](),controller[_0x63fb('0x12')]);router[_0x63fb('0x11')](_0x63fb('0xd'),auth[_0x63fb('0x9')](),controller[_0x63fb('0x13')]);router[_0x63fb('0x14')](_0x63fb('0xb'),auth[_0x63fb('0x9')](),controller['update']);router[_0x63fb('0x15')](_0x63fb('0xb'),auth[_0x63fb('0x9')](),controller[_0x63fb('0x16')]);module[_0x63fb('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e0bb8b8..8ad9db2 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 _0x85d0=['STRING','BOOLEAN'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x85d0,0x164));var _0x085d=function(_0x397e00,_0xb34967){_0x397e00=_0x397e00-0x0;var _0x45c0f2=_0x85d0[_0x397e00];return _0x45c0f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x085d('0x0')]},'remoteUri':{'type':Sequelize[_0x085d('0x0')]},'tenantId':{'type':Sequelize[_0x085d('0x0')]},'clientId':{'type':Sequelize[_0x085d('0x0')]},'clientSecret':{'type':Sequelize[_0x085d('0x0')]},'serverUrl':{'type':Sequelize[_0x085d('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x085d('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x68f5=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2cbd56,_0x2aea4a){var _0x46d03b=function(_0x45c094){while(--_0x45c094){_0x2cbd56['push'](_0x2cbd56['shift']());}};_0x46d03b(++_0x2aea4a);}(_0x68f5,0x11a));var _0x568f=function(_0x470c3d,_0x2be227){_0x470c3d=_0x470c3d-0x0;var _0x31043f=_0x68f5[_0x470c3d];return _0x31043f;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'name':{'type':Sequelize[_0x568f('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x568f('0x2')]},'remoteUri':{'type':Sequelize[_0x568f('0x2')]},'tenantId':{'type':Sequelize[_0x568f('0x2')]},'clientId':{'type':Sequelize[_0x568f('0x2')]},'clientSecret':{'type':Sequelize[_0x568f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x568f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x568f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fd37eb9..6e23bb6 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 _0x8b49=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','filters','length','find','create','body','getConfigurations','findOne','filter','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','substring','format','%s/api/data/v9.0/','getFields','ticketType','Incident','description','customerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data7','data5','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x8b49,0xb2));var _0x98b4=function(_0x55c947,_0x5e20a8){_0x55c947=_0x55c947-0x0;var _0x2556b3=_0x8b49[_0x55c947];return _0x2556b3;};'use strict';var rp=require(_0x98b4('0x0'));var util=require(_0x98b4('0x1'));var _=require(_0x98b4('0x2'));var qs=require(_0x98b4('0x3'));var logger=require(_0x98b4('0x4'))(_0x98b4('0x5'));var db=require(_0x98b4('0x6'))['db'];var integrations=require(_0x98b4('0x7'));function respondWithResult(_0x39e387,_0x36034b){_0x36034b=_0x36034b||0xc8;return function(_0x1b821a){if(_0x1b821a){return _0x39e387[_0x98b4('0x8')](_0x36034b)[_0x98b4('0x9')](_0x1b821a);}};}function respondWithFilteredResult(_0x5c47f4,_0x39d3ac){return function(_0x109207){if(_0x109207){var _0x10a466=typeof _0x39d3ac['offset']===_0x98b4('0xa')&&typeof _0x39d3ac[_0x98b4('0xb')]===_0x98b4('0xa');var _0x4c5771=_0x109207[_0x98b4('0xc')];var _0x5161a4=_0x10a466?0x0:_0x39d3ac['offset'];var _0x449e52=_0x10a466?_0x109207['count']:_0x39d3ac[_0x98b4('0xd')]+_0x39d3ac[_0x98b4('0xb')];var _0x44c4b1;if(_0x449e52>=_0x4c5771){_0x449e52=_0x4c5771;_0x44c4b1=0xc8;}else{_0x44c4b1=0xce;}_0x5c47f4['status'](_0x44c4b1);return _0x5c47f4[_0x98b4('0xe')]('Content-Range',_0x5161a4+'-'+_0x449e52+'/'+_0x4c5771)[_0x98b4('0x9')](_0x109207);}return null;};}function saveUpdates(_0x3a93ef){return function(_0x57e399){if(_0x57e399){return _0x57e399[_0x98b4('0xf')](_0x3a93ef)[_0x98b4('0x10')](function(_0x51169f){return _0x51169f;});}return null;};}function removeEntity(_0x4e4e95){return function(_0x4a5d3e){if(_0x4a5d3e){return _0x4a5d3e[_0x98b4('0x11')]()[_0x98b4('0x10')](function(){_0x4e4e95[_0x98b4('0x8')](0xcc)[_0x98b4('0x12')]();});}};}function handleEntityNotFound(_0x2b45c0){return function(_0x5c0615){if(!_0x5c0615){_0x2b45c0['sendStatus'](0x194);}return _0x5c0615;};}function handleError(_0x4dec6f,_0x45cac5){_0x45cac5=_0x45cac5||0x1f4;return function(_0x1b82d2){logger[_0x98b4('0x13')](_0x1b82d2[_0x98b4('0x14')]);if(_0x1b82d2['name']){delete _0x1b82d2[_0x98b4('0x15')];}_0x4dec6f[_0x98b4('0x8')](_0x45cac5)[_0x98b4('0x16')](_0x1b82d2);};}exports[_0x98b4('0x17')]=function(_0xd594a0,_0x4a6e47){var _0x54c652={},_0x483004={},_0x1fd84a={'count':0x0,'rows':[]};var _0x4da8f8=_[_0x98b4('0x18')](db[_0x98b4('0x19')][_0x98b4('0x1a')],function(_0x3881ee){return{'name':_0x3881ee['fieldName'],'type':_0x3881ee[_0x98b4('0x1b')][_0x98b4('0x1c')]};});_0x483004[_0x98b4('0x1d')]=_['map'](_0x4da8f8,_0x98b4('0x15'));_0x483004[_0x98b4('0x1e')]=_[_0x98b4('0x1f')](_0xd594a0[_0x98b4('0x1e')]);_0x483004['filters']=_[_0x98b4('0x20')](_0x483004[_0x98b4('0x1d')],_0x483004[_0x98b4('0x1e')]);_0x54c652[_0x98b4('0x21')]=_[_0x98b4('0x20')](_0x483004['model'],qs[_0x98b4('0x22')](_0xd594a0[_0x98b4('0x1e')][_0x98b4('0x22')]));_0x54c652[_0x98b4('0x21')]=_0x54c652[_0x98b4('0x21')]['length']?_0x54c652[_0x98b4('0x21')]:_0x483004[_0x98b4('0x1d')];if(!_0xd594a0[_0x98b4('0x1e')][_0x98b4('0x23')]('nolimit')){_0x54c652[_0x98b4('0xb')]=qs['limit'](_0xd594a0['query'][_0x98b4('0xb')]);_0x54c652[_0x98b4('0xd')]=qs[_0x98b4('0xd')](_0xd594a0['query'][_0x98b4('0xd')]);}_0x54c652[_0x98b4('0x24')]=qs[_0x98b4('0x25')](_0xd594a0[_0x98b4('0x1e')][_0x98b4('0x25')]);_0x54c652[_0x98b4('0x26')]=qs['filters'](_[_0x98b4('0x27')](_0xd594a0[_0x98b4('0x1e')],_0x483004['filters']),_0x4da8f8);if(_0xd594a0[_0x98b4('0x1e')]['filter']){_0x54c652[_0x98b4('0x26')]=_['merge'](_0x54c652['where'],{'$or':_['map'](_0x4da8f8,function(_0x482c45){if(_0x482c45['type']!=='VIRTUAL'){var _0xed758={};_0xed758[_0x482c45['name']]={'$like':'%'+_0xd594a0['query']['filter']+'%'};return _0xed758;}})});}_0x54c652=_[_0x98b4('0x28')]({},_0x54c652,_0xd594a0[_0x98b4('0x29')]);var _0x4af92c={'where':_0x54c652['where']};return db[_0x98b4('0x19')][_0x98b4('0xc')](_0x4af92c)[_0x98b4('0x10')](function(_0xf0d25b){_0x1fd84a[_0x98b4('0xc')]=_0xf0d25b;if(_0xd594a0[_0x98b4('0x1e')]['includeAll']){_0x54c652[_0x98b4('0x2a')]=[{'all':!![]}];}return db[_0x98b4('0x19')][_0x98b4('0x2b')](_0x54c652);})[_0x98b4('0x10')](function(_0x4a7bf1){_0x1fd84a[_0x98b4('0x2c')]=_0x4a7bf1;return _0x1fd84a;})['then'](respondWithFilteredResult(_0x4a6e47,_0x54c652))[_0x98b4('0x2d')](handleError(_0x4a6e47,null));};exports[_0x98b4('0x2e')]=function(_0x4051d3,_0x386adc){var _0x7ad540={'raw':![],'where':{'id':_0x4051d3[_0x98b4('0x2f')]['id']}},_0x225fda={};_0x225fda[_0x98b4('0x1d')]=_[_0x98b4('0x1f')](db['Dynamics365Account'][_0x98b4('0x1a')]);_0x225fda['query']=_[_0x98b4('0x1f')](_0x4051d3['query']);_0x225fda[_0x98b4('0x30')]=_[_0x98b4('0x20')](_0x225fda[_0x98b4('0x1d')],_0x225fda[_0x98b4('0x1e')]);_0x7ad540[_0x98b4('0x21')]=_[_0x98b4('0x20')](_0x225fda[_0x98b4('0x1d')],qs[_0x98b4('0x22')](_0x4051d3[_0x98b4('0x1e')][_0x98b4('0x22')]));_0x7ad540[_0x98b4('0x21')]=_0x7ad540[_0x98b4('0x21')][_0x98b4('0x31')]?_0x7ad540[_0x98b4('0x21')]:_0x225fda['model'];if(_0x4051d3['query']['includeAll']){_0x7ad540[_0x98b4('0x2a')]=[{'all':!![]}];}_0x7ad540=_['merge']({},_0x7ad540,_0x4051d3['options']);return db['Dynamics365Account'][_0x98b4('0x32')](_0x7ad540)['then'](handleEntityNotFound(_0x386adc,null))['then'](respondWithResult(_0x386adc,null))[_0x98b4('0x2d')](handleError(_0x386adc,null));};exports['create']=function(_0x134267,_0x492c3e){return db[_0x98b4('0x19')][_0x98b4('0x33')](_0x134267['body'],{})[_0x98b4('0x10')](respondWithResult(_0x492c3e,0xc9))[_0x98b4('0x2d')](handleError(_0x492c3e,null));};exports[_0x98b4('0xf')]=function(_0x4ffdfc,_0x4f220a){if(_0x4ffdfc[_0x98b4('0x34')]['id']){delete _0x4ffdfc[_0x98b4('0x34')]['id'];}return db[_0x98b4('0x19')][_0x98b4('0x32')]({'where':{'id':_0x4ffdfc['params']['id']}})['then'](handleEntityNotFound(_0x4f220a,null))['then'](saveUpdates(_0x4ffdfc[_0x98b4('0x34')],null))[_0x98b4('0x10')](respondWithResult(_0x4f220a,null))['catch'](handleError(_0x4f220a,null));};exports['destroy']=function(_0x2bcc43,_0x23d7e3){return db['Dynamics365Account']['find']({'where':{'id':_0x2bcc43[_0x98b4('0x2f')]['id']}})[_0x98b4('0x10')](handleEntityNotFound(_0x23d7e3,null))[_0x98b4('0x10')](removeEntity(_0x23d7e3,null))[_0x98b4('0x2d')](handleError(_0x23d7e3,null));};exports[_0x98b4('0x35')]=function(_0x27e3cd,_0x438a71){var _0x5bfc83={};var _0x5d5959={};var _0x14813f;var _0x504797;return db['Dynamics365Account'][_0x98b4('0x36')]({'where':{'id':_0x27e3cd[_0x98b4('0x2f')]['id']}})[_0x98b4('0x10')](handleEntityNotFound(_0x438a71,null))[_0x98b4('0x10')](function(_0x3f6417){if(_0x3f6417){_0x14813f=_0x3f6417;_0x5d5959[_0x98b4('0x1d')]=_[_0x98b4('0x1f')](db['Dynamics365Configuration']['rawAttributes']);_0x5d5959[_0x98b4('0x1e')]=_['keys'](_0x27e3cd[_0x98b4('0x1e')]);_0x5d5959['filters']=_[_0x98b4('0x20')](_0x5d5959['model'],_0x5d5959[_0x98b4('0x1e')]);_0x5bfc83[_0x98b4('0x21')]=_[_0x98b4('0x20')](_0x5d5959[_0x98b4('0x1d')],qs[_0x98b4('0x22')](_0x27e3cd[_0x98b4('0x1e')][_0x98b4('0x22')]));_0x5bfc83[_0x98b4('0x21')]=_0x5bfc83[_0x98b4('0x21')][_0x98b4('0x31')]?_0x5bfc83[_0x98b4('0x21')]:_0x5d5959[_0x98b4('0x1d')];_0x5bfc83['order']=qs[_0x98b4('0x25')](_0x27e3cd[_0x98b4('0x1e')][_0x98b4('0x25')]);_0x5bfc83[_0x98b4('0x26')]=qs[_0x98b4('0x30')](_[_0x98b4('0x27')](_0x27e3cd['query'],_0x5d5959[_0x98b4('0x30')]));if(_0x27e3cd[_0x98b4('0x1e')][_0x98b4('0x37')]){_0x5bfc83[_0x98b4('0x26')]=_[_0x98b4('0x28')](_0x5bfc83['where'],{'$or':_[_0x98b4('0x18')](_0x5bfc83[_0x98b4('0x21')],function(_0x1b2686){var _0x653ecd={};_0x653ecd[_0x1b2686]={'$like':'%'+_0x27e3cd[_0x98b4('0x1e')][_0x98b4('0x37')]+'%'};return _0x653ecd;})});}_0x5bfc83=_['merge']({},_0x5bfc83,_0x27e3cd['options']);return _0x14813f[_0x98b4('0x35')](_0x5bfc83);}})['then'](function(_0x5bed62){if(_0x5bed62){_0x504797=_0x5bed62[_0x98b4('0x31')];if(!_0x27e3cd['query']['hasOwnProperty'](_0x98b4('0x38'))){_0x5bfc83[_0x98b4('0xb')]=qs[_0x98b4('0xb')](_0x27e3cd[_0x98b4('0x1e')][_0x98b4('0xb')]);_0x5bfc83['offset']=qs[_0x98b4('0xd')](_0x27e3cd['query'][_0x98b4('0xd')]);}return _0x14813f[_0x98b4('0x35')](_0x5bfc83);}})[_0x98b4('0x10')](function(_0x24057b){if(_0x24057b){return _0x24057b?{'count':_0x504797,'rows':_0x24057b}:null;}})['then'](respondWithResult(_0x438a71,null))[_0x98b4('0x2d')](handleError(_0x438a71,null));};exports[_0x98b4('0x39')]=function(_0xb6157f,_0xb21dab){if(_0xb6157f[_0x98b4('0x34')]['id']){delete _0xb6157f['body']['id'];}return db[_0x98b4('0x19')][_0x98b4('0x36')]({'where':{'id':_0xb6157f['params']['id']}})[_0x98b4('0x10')](handleEntityNotFound(_0xb21dab,null))[_0x98b4('0x10')](function(_0x510153){if(_0x510153){_0xb6157f['body']['AccountId']=_0x510153['id'];_0xb6157f[_0x98b4('0x34')][_0x98b4('0x3a')]=integrations[_0x98b4('0x3b')](_0xb6157f[_0x98b4('0x34')]['channel'],_0xb6157f[_0x98b4('0x34')]['type']);_0xb6157f[_0x98b4('0x34')][_0x98b4('0x3c')]=integrations[_0x98b4('0x3d')](_0xb6157f[_0x98b4('0x34')][_0x98b4('0x3e')],_0xb6157f['body'][_0x98b4('0x1b')]);return db[_0x98b4('0x3f')][_0x98b4('0x33')](_0xb6157f['body'],{'include':[{'model':db[_0x98b4('0x40')],'as':_0x98b4('0x3a')},{'model':db[_0x98b4('0x40')],'as':_0x98b4('0x3c')}]});}return null;})[_0x98b4('0x10')](respondWithResult(_0xb21dab,null))[_0x98b4('0x2d')](handleError(_0xb21dab,null));};function sanitizeRemoteUri(_0x1d7087){var _0x3d4076=_0x1d7087['slice'](-0x1);if(_0x3d4076==='/')return _0x1d7087[_0x98b4('0x41')](0x0,_0x1d7087['lastIndexOf'](_0x3d4076));return _0x1d7087;}function getWebApiUrl(_0x7ff3ca){return util[_0x98b4('0x42')](_0x98b4('0x43'),_0x7ff3ca);}exports[_0x98b4('0x44')]=function(_0x2e5b0e,_0x26d1c8){var _0x210657=_0x2e5b0e[_0x98b4('0x1e')][_0x98b4('0x45')];var _0x35a153=_0x210657==='incident'?_0x98b4('0x46'):'PhoneCall';var _0x2abaf2='';var _0x10b4b4='';var _0x41624d='';var _0x1c81d6='';var _0x4fc745='';var _0x33a065='';var _0x20f6b5='';var _0x24adae='';var _0x36c11c=['title',_0x98b4('0x47'),_0x98b4('0x48'),'ownerid',_0x98b4('0x49'),'subject',_0x98b4('0x4a'),_0x98b4('0x4b'),_0x98b4('0x4c'),'phonecall_activity_parties'];var _0xfd1f34=[_0x98b4('0x4d'),_0x98b4('0x4e'),'actualserviceunits',_0x98b4('0x4f'),_0x98b4('0x50'),'contactidyominame',_0x98b4('0x51'),_0x98b4('0x52'),_0x98b4('0x53'),'createdbyexternalpartyyominame',_0x98b4('0x54'),'createdbyyominame','createdon','createdonbehalfbyname',_0x98b4('0x55'),_0x98b4('0x56'),_0x98b4('0x57'),_0x98b4('0x58'),_0x98b4('0x59'),'entitlementidname','entityimage_timestamp',_0x98b4('0x5a'),_0x98b4('0x5b'),_0x98b4('0x5c'),'firstresponsebykpiidname',_0x98b4('0x5d'),_0x98b4('0x5e'),_0x98b4('0x5f'),'kbarticleidname',_0x98b4('0x60'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x98b4('0x61'),'modifiedbyyominame',_0x98b4('0x62'),_0x98b4('0x63'),_0x98b4('0x64'),_0x98b4('0x65'),'msdyn_iotalertname',_0x98b4('0x66'),_0x98b4('0x67'),_0x98b4('0x68'),_0x98b4('0x69'),'owneridtype',_0x98b4('0x6a'),_0x98b4('0x6b'),_0x98b4('0x6c'),_0x98b4('0x6d'),_0x98b4('0x6e'),'productidname',_0x98b4('0x6f'),_0x98b4('0x70'),'resolvebykpiidname',_0x98b4('0x71'),'responsiblecontactidname',_0x98b4('0x72'),_0x98b4('0x73'),'slainvokedidname',_0x98b4('0x74'),_0x98b4('0x75'),_0x98b4('0x76'),_0x98b4('0x77'),_0x98b4('0x78'),_0x98b4('0x79'),_0x98b4('0x7a'),_0x98b4('0x7b'),'traversedpath',_0x98b4('0x7c'),_0x98b4('0x7d')];var _0x93899=_0x36c11c['concat'](_0xfd1f34);return db['Dynamics365Account'][_0x98b4('0x36')]({'where':{'id':_0x2e5b0e['params']['id']},'attributes':['id',_0x98b4('0x7e'),_0x98b4('0x7f'),_0x98b4('0x80'),_0x98b4('0x81'),_0x98b4('0x82'),'clientSecret',_0x98b4('0x83')],'include':[{'model':db['CloudProvider'],'as':_0x98b4('0x84'),'attributes':['id','data5',_0x98b4('0x85')]}]})['then'](handleEntityNotFound(_0x26d1c8,null))[_0x98b4('0x10')](function(_0x649311){if(_0x649311){if(_0x649311[_0x98b4('0x83')]){_0x649311['access_token']=_0x649311[_0x98b4('0x84')][_0x98b4('0x86')];_0x24adae=sanitizeRemoteUri(_0x649311[_0x98b4('0x84')]['data7']);_0x20f6b5=getWebApiUrl(_0x24adae);return _0x649311;}_0x24adae=sanitizeRemoteUri(_0x649311[_0x98b4('0x80')]);_0x20f6b5=getWebApiUrl(_0x24adae);var _0x62a2b7={'method':'POST','uri':_0x98b4('0x87')+_0x649311[_0x98b4('0x81')]+_0x98b4('0x88'),'form':{'client_id':_0x649311[_0x98b4('0x82')],'resource':_0x24adae,'username':_0x649311[_0x98b4('0x7e')],'password':_0x649311[_0x98b4('0x7f')],'grant_type':_0x98b4('0x7f'),'client_secret':_0x649311[_0x98b4('0x89')]},'json':!![]};return rp(_0x62a2b7);}})[_0x98b4('0x10')](function(_0xec3927){_0x33a065=_0xec3927['access_token'];var _0x351595={'method':_0x98b4('0x8a'),'uri':encodeURI(_0x20f6b5+_0x98b4('0x8b')+_0x35a153+'\x27'),'headers':{'Authorization':_0x98b4('0x8c')+_0x33a065,'If-None-Match':null,'OData-Version':_0x98b4('0x8d')},'json':!![]};return rp(_0x351595);})[_0x98b4('0x10')](function(_0x4dfb16){var _0x1edfff=_0x4dfb16['value'][0x0];var _0xeb1a9e=_0x1edfff[_0x98b4('0x8e')];var _0xdd8c7={'method':'GET','uri':_0x20f6b5+_0x98b4('0x8f')+_0xeb1a9e+_0x98b4('0x90'),'headers':{'Authorization':_0x98b4('0x8c')+_0x33a065,'If-None-Match':null,'OData-Version':_0x98b4('0x8d')},'json':!![]};return rp(_0xdd8c7);})[_0x98b4('0x10')](function(_0x4c9e99){_0x2abaf2=_0x4c9e99;_0x10b4b4=_0x2abaf2[_0x98b4('0x91')];_0x10b4b4=_[_0x98b4('0x92')](_0x10b4b4,function(_0x5eb411){return!_0x93899[_0x98b4('0x93')](_0x5eb411[_0x98b4('0x94')]);});var _0x2b040f=[];var _0x119106=[];_0x10b4b4[_0x98b4('0x95')](function(_0x55d001){if(_0x55d001[_0x98b4('0x96')]){var _0x57afa0=_0x55d001[_0x98b4('0x96')][_0x98b4('0x41')](_0x55d001[_0x98b4('0x96')][_0x98b4('0x97')]('.')+0x1);if(_0x57afa0===_0x98b4('0x98')){_0x2b040f[_0x98b4('0x99')](getSelectList(_0x20f6b5,_0x210657,_0x119106,_0x2abaf2[_0x98b4('0x8e')],_0x55d001[_0x98b4('0x8e')],_0x33a065));}}});return Promise[_0x98b4('0x9a')](_0x2b040f);})['then'](function(_0x132c7f){_0x41624d=_0x132c7f[0x0];var _0x34462b=[];var _0x50243f=[];_0x10b4b4[_0x98b4('0x95')](function(_0x26cf1d){if(!_[_0x98b4('0x9b')](_0x26cf1d[_0x98b4('0x96')])){var _0xb047be=_0x26cf1d[_0x98b4('0x96')]['substring'](_0x26cf1d['@odata.type']['lastIndexOf']('.')+0x1);if(_0xb047be===_0x98b4('0x9c')){_0x34462b[_0x98b4('0x99')](getBooleanList(_0x20f6b5,_0x210657,_0x50243f,_0x2abaf2[_0x98b4('0x8e')],_0x26cf1d['MetadataId'],_0x33a065));}}});return Promise[_0x98b4('0x9a')](_0x34462b);})['then'](function(_0xe059bf){_0x1c81d6=_0xe059bf[0x0];var _0x568176=[];var _0x4175cf=[];_0x10b4b4[_0x98b4('0x95')](function(_0x44bbc1){if(_0x44bbc1['@odata.type']){var _0x2b5c4b=_0x44bbc1['@odata.type']['substring'](_0x44bbc1[_0x98b4('0x96')]['lastIndexOf']('.')+0x1);if(_0x2b5c4b===_0x98b4('0x9d')||_0x2b5c4b===_0x98b4('0x9e')||_0x2b5c4b===_0x98b4('0x9f')||_0x2b5c4b===_0x98b4('0xa0')||_0x2b5c4b===_0x98b4('0xa1')||_0x2b5c4b===_0x98b4('0xa2')||_0x2b5c4b==='StatusAttributeMetadata'||_0x2b5c4b==='EntityNameAttributeMetadata'||_0x2b5c4b==='StateAttributeMetadata'||_0x2b5c4b===_0x98b4('0xa3')){_0x568176[_0x98b4('0x99')](getInputList(_0x20f6b5,_0x210657,_0x2b5c4b,_0x4175cf,_0x2abaf2[_0x98b4('0x8e')],_0x44bbc1[_0x98b4('0x8e')],_0x33a065));}}});return Promise['all'](_0x568176);})['then'](function(_0x23ef34){_0x4fc745=_0x23ef34[0x0];var _0x17eb3c=_0x41624d[_0x98b4('0xa4')](_0x1c81d6)[_0x98b4('0xa4')](_0x4fc745);var _0x5dd2a7={'count':_0x17eb3c[_0x98b4('0x31')],'rows':_0x17eb3c};return _0x5dd2a7;})['then'](respondWithResult(_0x26d1c8,null))[_0x98b4('0x2d')](function(_0x456192){var _0x35c87e=_0x2e5b0e[_0x98b4('0x1e')]['test']?0x1f4:_0x456192[_0x98b4('0xa5')]||0x1f4;logger[_0x98b4('0x13')](_0x456192['stack']);delete _0x456192[_0x98b4('0x15')];if(_0x35c87e===0x191){_0x35c87e=0x190;}_0x26d1c8['status'](_0x35c87e)[_0x98b4('0x16')](_0x2e5b0e[_0x98b4('0x1e')]['test']?{'message':_0x98b4('0xa6'),'statusCode':_0x456192[_0x98b4('0xa5')]}:_0x456192);});};function getSelectList(_0x18ecf0,_0x3444f0,_0x9d0080,_0x5c3ec1,_0x1efb1f,_0x387ebc){var _0x28ce88={'method':_0x98b4('0x8a'),'uri':_0x18ecf0+'EntityDefinitions('+_0x5c3ec1+')/Attributes('+_0x1efb1f+_0x98b4('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x98b4('0x8c')+_0x387ebc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28ce88)[_0x98b4('0x10')](function(_0x45a582){var _0x4cff9d=[];var _0x2308a4=_0x45a582[_0x98b4('0xa8')][_0x98b4('0xa9')];_0x2308a4[_0x98b4('0x95')](function(_0x1f34cd){_0x4cff9d[_0x98b4('0x99')]({'name':_0x1f34cd['Label'][_0x98b4('0xaa')][_0x98b4('0xab')],'value':String(_0x1f34cd[_0x98b4('0xac')])});});var _0x3ea894={'id':_0x3444f0+'_'+_0x45a582[_0x98b4('0x94')],'name':_0x45a582[_0x98b4('0xad')][_0x98b4('0xaa')]['Label'],'custom':![],'options':_0x4cff9d};_0x9d0080[_0x98b4('0x99')](_0x3ea894);return _0x9d0080;});}function getBooleanList(_0x4fbb80,_0x57157c,_0x14bfa3,_0x3462e7,_0x147692,_0x2b4e20){var _0x594829={'method':_0x98b4('0x8a'),'uri':_0x4fbb80+'EntityDefinitions('+_0x3462e7+_0x98b4('0xae')+_0x147692+_0x98b4('0xaf'),'headers':{'Authorization':_0x98b4('0x8c')+_0x2b4e20,'If-None-Match':null,'OData-Version':_0x98b4('0x8d')},'json':!![]};return rp(_0x594829)[_0x98b4('0x10')](function(_0x5ab4d0){var _0x9012f6=[];_0x9012f6[_0x98b4('0x99')]({'name':_0x5ab4d0['OptionSet'][_0x98b4('0xb0')][_0x98b4('0xab')]['UserLocalizedLabel'][_0x98b4('0xab')],'value':_0x98b4('0xb1')},{'name':_0x5ab4d0['OptionSet'][_0x98b4('0xb2')][_0x98b4('0xab')][_0x98b4('0xaa')][_0x98b4('0xab')],'value':_0x98b4('0xb3')});var _0x5b8402={'id':_0x57157c+'_'+_0x5ab4d0[_0x98b4('0x94')],'name':_0x5ab4d0[_0x98b4('0xad')]['UserLocalizedLabel'][_0x98b4('0xab')],'custom':![],'options':_0x9012f6};_0x14bfa3[_0x98b4('0x99')](_0x5b8402);return _0x14bfa3;});}function getInputList(_0x57aaca,_0x1fd9be,_0x1a9a5e,_0x4271ee,_0x2076ea,_0x220ebb,_0x508183){var _0x2a8c56={'method':_0x98b4('0x8a'),'uri':_0x57aaca+_0x98b4('0x8f')+_0x2076ea+')/Attributes('+_0x220ebb+')/Microsoft.Dynamics.CRM.'+_0x1a9a5e+_0x98b4('0xb4'),'headers':{'Authorization':_0x98b4('0x8c')+_0x508183,'If-None-Match':null,'OData-Version':_0x98b4('0x8d')},'json':!![]};return rp(_0x2a8c56)[_0x98b4('0x10')](function(_0x243fe3){var _0x1d2662={'id':_0x1fd9be+'_'+_0x243fe3[_0x98b4('0x94')],'name':_0x243fe3[_0x98b4('0xad')][_0x98b4('0xaa')]?_0x243fe3[_0x98b4('0xad')][_0x98b4('0xaa')][_0x98b4('0xab')]:_0x243fe3[_0x98b4('0x94')],'custom':![],'options':[]};_0x4271ee[_0x98b4('0x99')](_0x1d2662);return _0x4271ee;});} \ No newline at end of file +var _0x6c74=['count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','Dynamics365Configuration','hasOwnProperty','findOne','AccountId','channel','getDescriptions','Subjects','Dynamics365Field','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','username','access_token','GET','Bearer\x20','4.0','value','MetadataId','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','EntityDefinitions(','FalseOption','UserLocalizedLabel','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined'];(function(_0x148fcc,_0xe5f47e){var _0x51d4f2=function(_0x12975f){while(--_0x12975f){_0x148fcc['push'](_0x148fcc['shift']());}};_0x51d4f2(++_0xe5f47e);}(_0x6c74,0xb4));var _0x46c7=function(_0x1aa873,_0x37a6a0){_0x1aa873=_0x1aa873-0x0;var _0x2909ea=_0x6c74[_0x1aa873];return _0x2909ea;};'use strict';var rp=require('request-promise');var util=require(_0x46c7('0x0'));var _=require('lodash');var qs=require(_0x46c7('0x1'));var logger=require(_0x46c7('0x2'))(_0x46c7('0x3'));var db=require(_0x46c7('0x4'))['db'];var integrations=require(_0x46c7('0x5'));function respondWithResult(_0x477c19,_0xf95dc1){_0xf95dc1=_0xf95dc1||0xc8;return function(_0x4717f9){if(_0x4717f9){return _0x477c19[_0x46c7('0x6')](_0xf95dc1)[_0x46c7('0x7')](_0x4717f9);}};}function respondWithFilteredResult(_0x392ec9,_0x23353d){return function(_0x3eb5bc){if(_0x3eb5bc){var _0x55c7cc=typeof _0x23353d[_0x46c7('0x8')]===_0x46c7('0x9')&&typeof _0x23353d['limit']===_0x46c7('0x9');var _0x1f39e6=_0x3eb5bc[_0x46c7('0xa')];var _0x49c489=_0x55c7cc?0x0:_0x23353d['offset'];var _0x5a6ed4=_0x55c7cc?_0x3eb5bc[_0x46c7('0xa')]:_0x23353d['offset']+_0x23353d[_0x46c7('0xb')];var _0x69755a;if(_0x5a6ed4>=_0x1f39e6){_0x5a6ed4=_0x1f39e6;_0x69755a=0xc8;}else{_0x69755a=0xce;}_0x392ec9[_0x46c7('0x6')](_0x69755a);return _0x392ec9[_0x46c7('0xc')](_0x46c7('0xd'),_0x49c489+'-'+_0x5a6ed4+'/'+_0x1f39e6)[_0x46c7('0x7')](_0x3eb5bc);}return null;};}function saveUpdates(_0x5d555f){return function(_0x41497d){if(_0x41497d){return _0x41497d[_0x46c7('0xe')](_0x5d555f)[_0x46c7('0xf')](function(_0x382eb4){return _0x382eb4;});}return null;};}function removeEntity(_0x43d185){return function(_0x338d12){if(_0x338d12){return _0x338d12[_0x46c7('0x10')]()[_0x46c7('0xf')](function(){_0x43d185[_0x46c7('0x6')](0xcc)[_0x46c7('0x11')]();});}};}function handleEntityNotFound(_0xf6d609){return function(_0x53061b){if(!_0x53061b){_0xf6d609[_0x46c7('0x12')](0x194);}return _0x53061b;};}function handleError(_0x44e267,_0x1ea2d0){_0x1ea2d0=_0x1ea2d0||0x1f4;return function(_0x57c0d5){logger[_0x46c7('0x13')](_0x57c0d5[_0x46c7('0x14')]);if(_0x57c0d5[_0x46c7('0x15')]){delete _0x57c0d5[_0x46c7('0x15')];}_0x44e267[_0x46c7('0x6')](_0x1ea2d0)['send'](_0x57c0d5);};}exports[_0x46c7('0x16')]=function(_0x4e4b31,_0x5f491a){var _0x2f77a3={},_0x78af6e={},_0x1af2f3={'count':0x0,'rows':[]};var _0x3b26b0=_[_0x46c7('0x17')](db[_0x46c7('0x18')][_0x46c7('0x19')],function(_0x5810c0){return{'name':_0x5810c0[_0x46c7('0x1a')],'type':_0x5810c0[_0x46c7('0x1b')][_0x46c7('0x1c')]};});_0x78af6e['model']=_[_0x46c7('0x17')](_0x3b26b0,_0x46c7('0x15'));_0x78af6e[_0x46c7('0x1d')]=_[_0x46c7('0x1e')](_0x4e4b31[_0x46c7('0x1d')]);_0x78af6e[_0x46c7('0x1f')]=_[_0x46c7('0x20')](_0x78af6e[_0x46c7('0x21')],_0x78af6e[_0x46c7('0x1d')]);_0x2f77a3[_0x46c7('0x22')]=_[_0x46c7('0x20')](_0x78af6e[_0x46c7('0x21')],qs[_0x46c7('0x23')](_0x4e4b31['query'][_0x46c7('0x23')]));_0x2f77a3['attributes']=_0x2f77a3[_0x46c7('0x22')]['length']?_0x2f77a3[_0x46c7('0x22')]:_0x78af6e[_0x46c7('0x21')];if(!_0x4e4b31[_0x46c7('0x1d')]['hasOwnProperty'](_0x46c7('0x24'))){_0x2f77a3[_0x46c7('0xb')]=qs['limit'](_0x4e4b31[_0x46c7('0x1d')][_0x46c7('0xb')]);_0x2f77a3[_0x46c7('0x8')]=qs['offset'](_0x4e4b31['query'][_0x46c7('0x8')]);}_0x2f77a3[_0x46c7('0x25')]=qs['sort'](_0x4e4b31[_0x46c7('0x1d')][_0x46c7('0x26')]);_0x2f77a3[_0x46c7('0x27')]=qs['filters'](_[_0x46c7('0x28')](_0x4e4b31[_0x46c7('0x1d')],_0x78af6e[_0x46c7('0x1f')]),_0x3b26b0);if(_0x4e4b31['query'][_0x46c7('0x29')]){_0x2f77a3[_0x46c7('0x27')]=_[_0x46c7('0x2a')](_0x2f77a3[_0x46c7('0x27')],{'$or':_[_0x46c7('0x17')](_0x3b26b0,function(_0x2b3126){if(_0x2b3126[_0x46c7('0x1b')]!==_0x46c7('0x2b')){var _0x15350b={};_0x15350b[_0x2b3126['name']]={'$like':'%'+_0x4e4b31[_0x46c7('0x1d')][_0x46c7('0x29')]+'%'};return _0x15350b;}})});}_0x2f77a3=_[_0x46c7('0x2a')]({},_0x2f77a3,_0x4e4b31[_0x46c7('0x2c')]);var _0x2dfc8a={'where':_0x2f77a3['where']};return db[_0x46c7('0x18')]['count'](_0x2dfc8a)[_0x46c7('0xf')](function(_0x2e43f1){_0x1af2f3['count']=_0x2e43f1;if(_0x4e4b31[_0x46c7('0x1d')][_0x46c7('0x2d')]){_0x2f77a3[_0x46c7('0x2e')]=[{'all':!![]}];}return db[_0x46c7('0x18')]['findAll'](_0x2f77a3);})[_0x46c7('0xf')](function(_0x4b1e30){_0x1af2f3[_0x46c7('0x2f')]=_0x4b1e30;return _0x1af2f3;})[_0x46c7('0xf')](respondWithFilteredResult(_0x5f491a,_0x2f77a3))[_0x46c7('0x30')](handleError(_0x5f491a,null));};exports[_0x46c7('0x31')]=function(_0x4abe54,_0xb74eb8){var _0x46e241={'raw':![],'where':{'id':_0x4abe54[_0x46c7('0x32')]['id']}},_0xc34bf7={};_0xc34bf7[_0x46c7('0x21')]=_[_0x46c7('0x1e')](db[_0x46c7('0x18')]['rawAttributes']);_0xc34bf7[_0x46c7('0x1d')]=_[_0x46c7('0x1e')](_0x4abe54[_0x46c7('0x1d')]);_0xc34bf7[_0x46c7('0x1f')]=_[_0x46c7('0x20')](_0xc34bf7['model'],_0xc34bf7[_0x46c7('0x1d')]);_0x46e241[_0x46c7('0x22')]=_[_0x46c7('0x20')](_0xc34bf7[_0x46c7('0x21')],qs[_0x46c7('0x23')](_0x4abe54[_0x46c7('0x1d')][_0x46c7('0x23')]));_0x46e241[_0x46c7('0x22')]=_0x46e241[_0x46c7('0x22')][_0x46c7('0x33')]?_0x46e241['attributes']:_0xc34bf7[_0x46c7('0x21')];if(_0x4abe54[_0x46c7('0x1d')][_0x46c7('0x2d')]){_0x46e241[_0x46c7('0x2e')]=[{'all':!![]}];}_0x46e241=_[_0x46c7('0x2a')]({},_0x46e241,_0x4abe54['options']);return db[_0x46c7('0x18')][_0x46c7('0x34')](_0x46e241)['then'](handleEntityNotFound(_0xb74eb8,null))[_0x46c7('0xf')](respondWithResult(_0xb74eb8,null))[_0x46c7('0x30')](handleError(_0xb74eb8,null));};exports[_0x46c7('0x35')]=function(_0xf84865,_0x3886f0){return db['Dynamics365Account'][_0x46c7('0x35')](_0xf84865[_0x46c7('0x36')],{})[_0x46c7('0xf')](respondWithResult(_0x3886f0,0xc9))[_0x46c7('0x30')](handleError(_0x3886f0,null));};exports[_0x46c7('0xe')]=function(_0x2c1a9f,_0x31eb1f){if(_0x2c1a9f['body']['id']){delete _0x2c1a9f[_0x46c7('0x36')]['id'];}return db[_0x46c7('0x18')][_0x46c7('0x34')]({'where':{'id':_0x2c1a9f[_0x46c7('0x32')]['id']}})['then'](handleEntityNotFound(_0x31eb1f,null))[_0x46c7('0xf')](saveUpdates(_0x2c1a9f[_0x46c7('0x36')],null))[_0x46c7('0xf')](respondWithResult(_0x31eb1f,null))[_0x46c7('0x30')](handleError(_0x31eb1f,null));};exports[_0x46c7('0x10')]=function(_0x43eb54,_0x7261ed){return db[_0x46c7('0x18')]['find']({'where':{'id':_0x43eb54[_0x46c7('0x32')]['id']}})[_0x46c7('0xf')](handleEntityNotFound(_0x7261ed,null))['then'](removeEntity(_0x7261ed,null))[_0x46c7('0x30')](handleError(_0x7261ed,null));};exports[_0x46c7('0x37')]=function(_0x344951,_0x3428e4){var _0x1e8b51={};var _0x317852={};var _0xde43df;var _0xda1468;return db[_0x46c7('0x18')]['findOne']({'where':{'id':_0x344951[_0x46c7('0x32')]['id']}})['then'](handleEntityNotFound(_0x3428e4,null))[_0x46c7('0xf')](function(_0x2666de){if(_0x2666de){_0xde43df=_0x2666de;_0x317852['model']=_[_0x46c7('0x1e')](db[_0x46c7('0x38')][_0x46c7('0x19')]);_0x317852[_0x46c7('0x1d')]=_['keys'](_0x344951[_0x46c7('0x1d')]);_0x317852[_0x46c7('0x1f')]=_[_0x46c7('0x20')](_0x317852['model'],_0x317852[_0x46c7('0x1d')]);_0x1e8b51[_0x46c7('0x22')]=_['intersection'](_0x317852['model'],qs[_0x46c7('0x23')](_0x344951['query'][_0x46c7('0x23')]));_0x1e8b51[_0x46c7('0x22')]=_0x1e8b51['attributes'][_0x46c7('0x33')]?_0x1e8b51[_0x46c7('0x22')]:_0x317852[_0x46c7('0x21')];_0x1e8b51[_0x46c7('0x25')]=qs[_0x46c7('0x26')](_0x344951['query'][_0x46c7('0x26')]);_0x1e8b51[_0x46c7('0x27')]=qs[_0x46c7('0x1f')](_[_0x46c7('0x28')](_0x344951[_0x46c7('0x1d')],_0x317852[_0x46c7('0x1f')]));if(_0x344951['query'][_0x46c7('0x29')]){_0x1e8b51[_0x46c7('0x27')]=_[_0x46c7('0x2a')](_0x1e8b51[_0x46c7('0x27')],{'$or':_['map'](_0x1e8b51['attributes'],function(_0x83c642){var _0x1f550a={};_0x1f550a[_0x83c642]={'$like':'%'+_0x344951['query'][_0x46c7('0x29')]+'%'};return _0x1f550a;})});}_0x1e8b51=_[_0x46c7('0x2a')]({},_0x1e8b51,_0x344951['options']);return _0xde43df['getConfigurations'](_0x1e8b51);}})[_0x46c7('0xf')](function(_0x84dac1){if(_0x84dac1){_0xda1468=_0x84dac1[_0x46c7('0x33')];if(!_0x344951[_0x46c7('0x1d')][_0x46c7('0x39')](_0x46c7('0x24'))){_0x1e8b51[_0x46c7('0xb')]=qs[_0x46c7('0xb')](_0x344951[_0x46c7('0x1d')]['limit']);_0x1e8b51['offset']=qs[_0x46c7('0x8')](_0x344951[_0x46c7('0x1d')][_0x46c7('0x8')]);}return _0xde43df['getConfigurations'](_0x1e8b51);}})[_0x46c7('0xf')](function(_0x564afa){if(_0x564afa){return _0x564afa?{'count':_0xda1468,'rows':_0x564afa}:null;}})[_0x46c7('0xf')](respondWithResult(_0x3428e4,null))[_0x46c7('0x30')](handleError(_0x3428e4,null));};exports['addConfiguration']=function(_0x4b8b92,_0x85e32a){if(_0x4b8b92['body']['id']){delete _0x4b8b92[_0x46c7('0x36')]['id'];}return db[_0x46c7('0x18')][_0x46c7('0x3a')]({'where':{'id':_0x4b8b92[_0x46c7('0x32')]['id']}})[_0x46c7('0xf')](handleEntityNotFound(_0x85e32a,null))[_0x46c7('0xf')](function(_0x56f44f){if(_0x56f44f){_0x4b8b92[_0x46c7('0x36')][_0x46c7('0x3b')]=_0x56f44f['id'];_0x4b8b92[_0x46c7('0x36')]['Subjects']=integrations['getSubjects'](_0x4b8b92[_0x46c7('0x36')][_0x46c7('0x3c')],_0x4b8b92[_0x46c7('0x36')][_0x46c7('0x1b')]);_0x4b8b92[_0x46c7('0x36')]['Descriptions']=integrations[_0x46c7('0x3d')](_0x4b8b92[_0x46c7('0x36')]['channel'],_0x4b8b92[_0x46c7('0x36')]['type']);return db[_0x46c7('0x38')][_0x46c7('0x35')](_0x4b8b92['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x46c7('0x3e')},{'model':db[_0x46c7('0x3f')],'as':_0x46c7('0x40')}]});}return null;})[_0x46c7('0xf')](respondWithResult(_0x85e32a,null))[_0x46c7('0x30')](handleError(_0x85e32a,null));};function sanitizeRemoteUri(_0x3df30f){var _0x74a42c=_0x3df30f[_0x46c7('0x41')](-0x1);if(_0x74a42c==='/')return _0x3df30f['substring'](0x0,_0x3df30f[_0x46c7('0x42')](_0x74a42c));return _0x3df30f;}function getWebApiUrl(_0x27d203){return util[_0x46c7('0x43')](_0x46c7('0x44'),_0x27d203);}exports[_0x46c7('0x45')]=function(_0x62b928,_0x2c42c5){var _0x8d7e18=_0x62b928[_0x46c7('0x1d')][_0x46c7('0x46')];var _0x4c8940=_0x8d7e18===_0x46c7('0x47')?_0x46c7('0x48'):'PhoneCall';var _0x13905b='';var _0x1e3823='';var _0x9418b2='';var _0x3024e4='';var _0x304dc6='';var _0x410942='';var _0x307ddd='';var _0x28f715='';var _0x478759=['title',_0x46c7('0x49'),'customerid','ownerid',_0x46c7('0x4a'),_0x46c7('0x4b'),_0x46c7('0x4c'),_0x46c7('0x4d'),_0x46c7('0x4e'),'phonecall_activity_parties'];var _0x5c98fc=[_0x46c7('0x4f'),_0x46c7('0x50'),_0x46c7('0x51'),_0x46c7('0x52'),_0x46c7('0x53'),_0x46c7('0x54'),'contractdetailidname',_0x46c7('0x55'),_0x46c7('0x56'),_0x46c7('0x57'),_0x46c7('0x58'),'createdbyyominame',_0x46c7('0x59'),_0x46c7('0x5a'),_0x46c7('0x5b'),_0x46c7('0x5c'),_0x46c7('0x5d'),_0x46c7('0x5e'),_0x46c7('0x5f'),_0x46c7('0x60'),'entityimage_timestamp',_0x46c7('0x61'),_0x46c7('0x62'),_0x46c7('0x63'),'firstresponsebykpiidname',_0x46c7('0x64'),_0x46c7('0x65'),_0x46c7('0x66'),_0x46c7('0x67'),_0x46c7('0x68'),_0x46c7('0x69'),_0x46c7('0x6a'),_0x46c7('0x6b'),_0x46c7('0x6c'),'modifiedbyyominame',_0x46c7('0x6d'),_0x46c7('0x6e'),'modifiedonbehalfbyyominame',_0x46c7('0x6f'),_0x46c7('0x70'),'numberofchildincidents','onholdtime',_0x46c7('0x71'),_0x46c7('0x72'),_0x46c7('0x73'),_0x46c7('0x74'),_0x46c7('0x75'),_0x46c7('0x76'),'primarycontactidyominame',_0x46c7('0x77'),_0x46c7('0x78'),_0x46c7('0x79'),_0x46c7('0x7a'),'resolvebykpiidname',_0x46c7('0x7b'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0x46c7('0x7c'),_0x46c7('0x7d'),_0x46c7('0x7e'),_0x46c7('0x7f'),_0x46c7('0x80'),_0x46c7('0x81'),_0x46c7('0x82'),_0x46c7('0x83'),_0x46c7('0x84'),_0x46c7('0x85'),_0x46c7('0x86'),_0x46c7('0x87')];var _0x4ad886=_0x478759[_0x46c7('0x88')](_0x5c98fc);return db['Dynamics365Account'][_0x46c7('0x3a')]({'where':{'id':_0x62b928[_0x46c7('0x32')]['id']},'attributes':['id','username',_0x46c7('0x89'),_0x46c7('0x8a'),_0x46c7('0x8b'),_0x46c7('0x8c'),_0x46c7('0x8d'),_0x46c7('0x8e')],'include':[{'model':db['CloudProvider'],'as':_0x46c7('0x8f'),'attributes':['id',_0x46c7('0x90'),_0x46c7('0x91')]}]})['then'](handleEntityNotFound(_0x2c42c5,null))[_0x46c7('0xf')](function(_0x352185){if(_0x352185){if(_0x352185[_0x46c7('0x8e')]){_0x352185['access_token']=_0x352185[_0x46c7('0x8f')][_0x46c7('0x90')];_0x28f715=sanitizeRemoteUri(_0x352185[_0x46c7('0x8f')][_0x46c7('0x91')]);_0x307ddd=getWebApiUrl(_0x28f715);return _0x352185;}_0x28f715=sanitizeRemoteUri(_0x352185['remoteUri']);_0x307ddd=getWebApiUrl(_0x28f715);var _0x42039d={'method':'POST','uri':_0x46c7('0x92')+_0x352185[_0x46c7('0x8b')]+_0x46c7('0x93'),'form':{'client_id':_0x352185[_0x46c7('0x8c')],'resource':_0x28f715,'username':_0x352185[_0x46c7('0x94')],'password':_0x352185['password'],'grant_type':_0x46c7('0x89'),'client_secret':_0x352185[_0x46c7('0x8d')]},'json':!![]};return rp(_0x42039d);}})['then'](function(_0x144c81){_0x410942=_0x144c81[_0x46c7('0x95')];var _0x3ce538={'method':_0x46c7('0x96'),'uri':encodeURI(_0x307ddd+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4c8940+'\x27'),'headers':{'Authorization':_0x46c7('0x97')+_0x410942,'If-None-Match':null,'OData-Version':_0x46c7('0x98')},'json':!![]};return rp(_0x3ce538);})[_0x46c7('0xf')](function(_0xa6c892){var _0x590af4=_0xa6c892[_0x46c7('0x99')][0x0];var _0x52fa2e=_0x590af4[_0x46c7('0x9a')];var _0x49685f={'method':_0x46c7('0x96'),'uri':_0x307ddd+'EntityDefinitions('+_0x52fa2e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x46c7('0x97')+_0x410942,'If-None-Match':null,'OData-Version':_0x46c7('0x98')},'json':!![]};return rp(_0x49685f);})['then'](function(_0xd26346){_0x13905b=_0xd26346;_0x1e3823=_0x13905b[_0x46c7('0x9b')];_0x1e3823=_[_0x46c7('0x9c')](_0x1e3823,function(_0xfb939){return!_0x4ad886['includes'](_0xfb939[_0x46c7('0x9d')]);});var _0x514906=[];var _0x1ce3f1=[];_0x1e3823['forEach'](function(_0x5c2b67){if(_0x5c2b67[_0x46c7('0x9e')]){var _0x1afba3=_0x5c2b67[_0x46c7('0x9e')]['substring'](_0x5c2b67['@odata.type'][_0x46c7('0x42')]('.')+0x1);if(_0x1afba3===_0x46c7('0x9f')){_0x514906[_0x46c7('0xa0')](getSelectList(_0x307ddd,_0x8d7e18,_0x1ce3f1,_0x13905b['MetadataId'],_0x5c2b67[_0x46c7('0x9a')],_0x410942));}}});return Promise[_0x46c7('0xa1')](_0x514906);})[_0x46c7('0xf')](function(_0x2a89cb){_0x9418b2=_0x2a89cb[0x0];var _0x2b4da3=[];var _0x2a9565=[];_0x1e3823[_0x46c7('0xa2')](function(_0x3820a2){if(!_[_0x46c7('0xa3')](_0x3820a2['@odata.type'])){var _0x4581cb=_0x3820a2[_0x46c7('0x9e')][_0x46c7('0xa4')](_0x3820a2[_0x46c7('0x9e')][_0x46c7('0x42')]('.')+0x1);if(_0x4581cb==='BooleanAttributeMetadata'){_0x2b4da3[_0x46c7('0xa0')](getBooleanList(_0x307ddd,_0x8d7e18,_0x2a9565,_0x13905b[_0x46c7('0x9a')],_0x3820a2['MetadataId'],_0x410942));}}});return Promise[_0x46c7('0xa1')](_0x2b4da3);})[_0x46c7('0xf')](function(_0x1fa5ee){_0x3024e4=_0x1fa5ee[0x0];var _0x5443f3=[];var _0x5ef069=[];_0x1e3823[_0x46c7('0xa2')](function(_0x97496c){if(_0x97496c[_0x46c7('0x9e')]){var _0x105820=_0x97496c['@odata.type'][_0x46c7('0xa4')](_0x97496c[_0x46c7('0x9e')][_0x46c7('0x42')]('.')+0x1);if(_0x105820===_0x46c7('0xa5')||_0x105820===_0x46c7('0xa6')||_0x105820==='BigIntAttributeMetadata'||_0x105820===_0x46c7('0xa7')||_0x105820==='MemoAttributeMetadata'||_0x105820===_0x46c7('0xa8')||_0x105820===_0x46c7('0xa9')||_0x105820===_0x46c7('0xaa')||_0x105820===_0x46c7('0xab')||_0x105820===_0x46c7('0xac')){_0x5443f3[_0x46c7('0xa0')](getInputList(_0x307ddd,_0x8d7e18,_0x105820,_0x5ef069,_0x13905b[_0x46c7('0x9a')],_0x97496c[_0x46c7('0x9a')],_0x410942));}}});return Promise['all'](_0x5443f3);})[_0x46c7('0xf')](function(_0x9e99d6){_0x304dc6=_0x9e99d6[0x0];var _0x4f6422=_0x9418b2[_0x46c7('0x88')](_0x3024e4)[_0x46c7('0x88')](_0x304dc6);var _0x598503={'count':_0x4f6422['length'],'rows':_0x4f6422};return _0x598503;})[_0x46c7('0xf')](respondWithResult(_0x2c42c5,null))[_0x46c7('0x30')](function(_0xf7bc80){var _0x52d9b4=_0x62b928[_0x46c7('0x1d')]['test']?0x1f4:_0xf7bc80[_0x46c7('0xad')]||0x1f4;logger[_0x46c7('0x13')](_0xf7bc80['stack']);delete _0xf7bc80['name'];if(_0x52d9b4===0x191){_0x52d9b4=0x190;}_0x2c42c5['status'](_0x52d9b4)['send'](_0x62b928[_0x46c7('0x1d')][_0x46c7('0xae')]?{'message':_0x46c7('0xaf'),'statusCode':_0xf7bc80[_0x46c7('0xad')]}:_0xf7bc80);});};function getSelectList(_0x3d8c37,_0x442dfd,_0x5ac5a9,_0x11b300,_0x557341,_0x20ce0e){var _0x58431c={'method':_0x46c7('0x96'),'uri':_0x3d8c37+'EntityDefinitions('+_0x11b300+_0x46c7('0xb0')+_0x557341+_0x46c7('0xb1')+_0x46c7('0xb2'),'headers':{'Authorization':_0x46c7('0x97')+_0x20ce0e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x58431c)[_0x46c7('0xf')](function(_0x1e66b5){var _0x2e35bb=[];var _0x3d1eaa=_0x1e66b5[_0x46c7('0xb3')][_0x46c7('0xb4')];_0x3d1eaa[_0x46c7('0xa2')](function(_0x3af5a5){_0x2e35bb[_0x46c7('0xa0')]({'name':_0x3af5a5['Label']['UserLocalizedLabel'][_0x46c7('0xb5')],'value':String(_0x3af5a5[_0x46c7('0xb6')])});});var _0x353c69={'id':_0x442dfd+'_'+_0x1e66b5[_0x46c7('0x9d')],'name':_0x1e66b5[_0x46c7('0xb7')]['UserLocalizedLabel'][_0x46c7('0xb5')],'custom':![],'options':_0x2e35bb};_0x5ac5a9['push'](_0x353c69);return _0x5ac5a9;});}function getBooleanList(_0x2fbca6,_0x16b295,_0x5c0c9a,_0x253fb8,_0x130292,_0xcdb1d0){var _0x256fcf={'method':'GET','uri':_0x2fbca6+_0x46c7('0xb8')+_0x253fb8+_0x46c7('0xb0')+_0x130292+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x46c7('0x97')+_0xcdb1d0,'If-None-Match':null,'OData-Version':_0x46c7('0x98')},'json':!![]};return rp(_0x256fcf)['then'](function(_0x3539e7){var _0x392675=[];_0x392675[_0x46c7('0xa0')]({'name':_0x3539e7[_0x46c7('0xb3')]['TrueOption']['Label']['UserLocalizedLabel'][_0x46c7('0xb5')],'value':'true'},{'name':_0x3539e7['OptionSet'][_0x46c7('0xb9')][_0x46c7('0xb5')][_0x46c7('0xba')][_0x46c7('0xb5')],'value':_0x46c7('0xbb')});var _0x4693ce={'id':_0x16b295+'_'+_0x3539e7['LogicalName'],'name':_0x3539e7[_0x46c7('0xb7')][_0x46c7('0xba')][_0x46c7('0xb5')],'custom':![],'options':_0x392675};_0x5c0c9a[_0x46c7('0xa0')](_0x4693ce);return _0x5c0c9a;});}function getInputList(_0x402ae3,_0x1c8282,_0x57831e,_0x4d733e,_0x342ca9,_0x5e5c90,_0x4aee49){var _0x1b517b={'method':_0x46c7('0x96'),'uri':_0x402ae3+_0x46c7('0xb8')+_0x342ca9+_0x46c7('0xb0')+_0x5e5c90+_0x46c7('0xbc')+_0x57831e+_0x46c7('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0x4aee49,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b517b)[_0x46c7('0xf')](function(_0x45e411){var _0x20b0cb={'id':_0x1c8282+'_'+_0x45e411[_0x46c7('0x9d')],'name':_0x45e411['DisplayName'][_0x46c7('0xba')]?_0x45e411[_0x46c7('0xb7')][_0x46c7('0xba')][_0x46c7('0xb5')]:_0x45e411['LogicalName'],'custom':![],'options':[]};_0x4d733e[_0x46c7('0xa0')](_0x20b0cb);return _0x4d733e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f7c1659..740cc49 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x39d5d7,_0x5acbf3){var _0x3e0f3e=function(_0x4a666e){while(--_0x4a666e){_0x39d5d7['push'](_0x39d5d7['shift']());}};_0x3e0f3e(++_0x5acbf3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7e7[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 5f5304e..111427a 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 _0x8db3=['Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDynamics365Account','findAll','options','raw','attributes','limit','include','model','info','stringify','ShowDynamics365Account','Dynamics365Account','find','where','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58e3f5,_0x34f521){var _0x786d2=function(_0x57b8bb){while(--_0x57b8bb){_0x58e3f5['push'](_0x58e3f5['shift']());}};_0x786d2(++_0x34f521);}(_0x8db3,0x12c));var _0x38db=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8db3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x38db('0x0'));var util=require(_0x38db('0x1'));var moment=require(_0x38db('0x2'));var BPromise=require('bluebird');var rs=require(_0x38db('0x3'));var fs=require('fs');var Redis=require(_0x38db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x38db('0x5'));var logger=require(_0x38db('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x38db('0x7'));var client=jayson[_0x38db('0x8')][_0x38db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x430e5a,_0x23c6c7,_0x10972e){return new BPromise(function(_0x5ae7be,_0x10b504){return client[_0x38db('0xa')](_0x430e5a,_0x10972e)[_0x38db('0xb')](function(_0xec7e96){logger['info'](_0x38db('0xc'),_0x23c6c7,_0x38db('0xd'));logger[_0x38db('0xe')](_0x38db('0xf'),_0x23c6c7,_0x38db('0xd'),JSON['stringify'](_0xec7e96));if(_0xec7e96[_0x38db('0x10')]){if(_0xec7e96['error'][_0x38db('0x11')]===0x1f4){logger[_0x38db('0x10')](_0x38db('0xc'),_0x23c6c7,_0xec7e96[_0x38db('0x10')]['message']);return _0x10b504(_0xec7e96[_0x38db('0x10')][_0x38db('0x12')]);}logger[_0x38db('0x10')](_0x38db('0xc'),_0x23c6c7,_0xec7e96[_0x38db('0x10')][_0x38db('0x12')]);return _0x5ae7be(_0xec7e96['error'][_0x38db('0x12')]);}else{logger['info'](_0x38db('0xc'),_0x23c6c7,_0x38db('0xd'));_0x5ae7be(_0xec7e96['result'][_0x38db('0x12')]);}})[_0x38db('0x13')](function(_0xab6162){logger[_0x38db('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x23c6c7,_0xab6162);_0x10b504(_0xab6162);});});}exports[_0x38db('0x14')]=function(_0xb6eb27){var _0x1142b2=this;return new Promise(function(_0x2a4d88,_0x5cc2ab){return db['Dynamics365Account'][_0x38db('0x15')]({'raw':_0xb6eb27['options']?_0xb6eb27[_0x38db('0x16')][_0x38db('0x17')]===undefined?!![]:![]:!![],'where':_0xb6eb27[_0x38db('0x16')]?_0xb6eb27[_0x38db('0x16')]['where']||null:null,'attributes':_0xb6eb27['options']?_0xb6eb27[_0x38db('0x16')][_0x38db('0x18')]||null:null,'limit':_0xb6eb27['options']?_0xb6eb27['options'][_0x38db('0x19')]||null:null,'include':_0xb6eb27[_0x38db('0x16')]?_0xb6eb27[_0x38db('0x16')][_0x38db('0x1a')]?_['map'](_0xb6eb27['options'][_0x38db('0x1a')],function(_0x1d32f2){return{'model':db[_0x1d32f2[_0x38db('0x1b')]],'as':_0x1d32f2['as'],'attributes':_0x1d32f2[_0x38db('0x18')],'include':_0x1d32f2[_0x38db('0x1a')]?_['map'](_0x1d32f2['include'],function(_0x1a2b7b){return{'model':db[_0x1a2b7b[_0x38db('0x1b')]],'as':_0x1a2b7b['as'],'attributes':_0x1a2b7b['attributes'],'include':_0x1a2b7b[_0x38db('0x1a')]?_['map'](_0x1a2b7b[_0x38db('0x1a')],function(_0x5e9eba){return{'model':db[_0x5e9eba[_0x38db('0x1b')]],'as':_0x5e9eba['as'],'attributes':_0x5e9eba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56bc39){logger[_0x38db('0x1c')](_0x38db('0x14'),_0xb6eb27);logger['debug'](_0x38db('0x14'),_0xb6eb27,JSON[_0x38db('0x1d')](_0x56bc39));_0x2a4d88(_0x56bc39);})[_0x38db('0x13')](function(_0x516396){logger[_0x38db('0x10')]('GetDynamics365Account',_0x516396[_0x38db('0x12')],_0xb6eb27);_0x5cc2ab(_0x1142b2[_0x38db('0x10')](0x1f4,_0x516396['message']));});});};exports[_0x38db('0x1e')]=function(_0x13639c){var _0x1bd1ea=this;return new Promise(function(_0x1f7917,_0x19c496){return db[_0x38db('0x1f')][_0x38db('0x20')]({'raw':_0x13639c['options']?_0x13639c[_0x38db('0x16')][_0x38db('0x17')]===undefined?!![]:![]:!![],'where':_0x13639c['options']?_0x13639c[_0x38db('0x16')][_0x38db('0x21')]||null:null,'attributes':_0x13639c[_0x38db('0x16')]?_0x13639c[_0x38db('0x16')][_0x38db('0x18')]||null:null,'include':_0x13639c[_0x38db('0x16')]?_0x13639c[_0x38db('0x16')][_0x38db('0x1a')]?_[_0x38db('0x22')](_0x13639c['options'][_0x38db('0x1a')],function(_0x1a026e){return{'model':db[_0x1a026e[_0x38db('0x1b')]],'as':_0x1a026e['as'],'attributes':_0x1a026e[_0x38db('0x18')],'include':_0x1a026e['include']?_[_0x38db('0x22')](_0x1a026e[_0x38db('0x1a')],function(_0x283244){return{'model':db[_0x283244['model']],'as':_0x283244['as'],'attributes':_0x283244[_0x38db('0x18')],'include':_0x283244[_0x38db('0x1a')]?_[_0x38db('0x22')](_0x283244[_0x38db('0x1a')],function(_0x1277d3){return{'model':db[_0x1277d3['model']],'as':_0x1277d3['as'],'attributes':_0x1277d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x38db('0xb')](function(_0x199be2){logger[_0x38db('0x1c')](_0x38db('0x1e'),_0x13639c);logger['debug'](_0x38db('0x1e'),_0x13639c,JSON[_0x38db('0x1d')](_0x199be2));_0x1f7917(_0x199be2);})[_0x38db('0x13')](function(_0x5b8118){logger[_0x38db('0x10')](_0x38db('0x1e'),_0x5b8118['message'],_0x13639c);_0x19c496(_0x1bd1ea[_0x38db('0x10')](0x1f4,_0x5b8118[_0x38db('0x12')]));});});}; \ No newline at end of file +var _0xddb0=['map','model','ShowDynamics365Account','find','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','attributes'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xddb0,0x1d9));var _0x0ddb=function(_0x3eeead,_0x47af06){_0x3eeead=_0x3eeead-0x0;var _0x400d29=_0xddb0[_0x3eeead];return _0x400d29;};'use strict';var _=require('lodash');var util=require(_0x0ddb('0x0'));var moment=require(_0x0ddb('0x1'));var BPromise=require(_0x0ddb('0x2'));var rs=require(_0x0ddb('0x3'));var fs=require('fs');var Redis=require(_0x0ddb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ddb('0x5'));var logger=require(_0x0ddb('0x6'))(_0x0ddb('0x7'));var config=require(_0x0ddb('0x8'));var jayson=require(_0x0ddb('0x9'));var client=jayson[_0x0ddb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a36a5,_0x502927,_0x1e9556){return new BPromise(function(_0x4ff3a6,_0x4d527c){return client[_0x0ddb('0xb')](_0x2a36a5,_0x1e9556)[_0x0ddb('0xc')](function(_0x27a8a8){logger[_0x0ddb('0xd')](_0x0ddb('0xe'),_0x502927,_0x0ddb('0xf'));logger['debug'](_0x0ddb('0x10'),_0x502927,_0x0ddb('0xf'),JSON[_0x0ddb('0x11')](_0x27a8a8));if(_0x27a8a8['error']){if(_0x27a8a8[_0x0ddb('0x12')][_0x0ddb('0x13')]===0x1f4){logger[_0x0ddb('0x12')](_0x0ddb('0xe'),_0x502927,_0x27a8a8[_0x0ddb('0x12')]['message']);return _0x4d527c(_0x27a8a8[_0x0ddb('0x12')]['message']);}logger[_0x0ddb('0x12')](_0x0ddb('0xe'),_0x502927,_0x27a8a8[_0x0ddb('0x12')][_0x0ddb('0x14')]);return _0x4ff3a6(_0x27a8a8[_0x0ddb('0x12')][_0x0ddb('0x14')]);}else{logger[_0x0ddb('0xd')](_0x0ddb('0xe'),_0x502927,_0x0ddb('0xf'));_0x4ff3a6(_0x27a8a8[_0x0ddb('0x15')][_0x0ddb('0x14')]);}})[_0x0ddb('0x16')](function(_0x230e54){logger[_0x0ddb('0x12')](_0x0ddb('0xe'),_0x502927,_0x230e54);_0x4d527c(_0x230e54);});});}exports[_0x0ddb('0x17')]=function(_0x5e2d89){var _0x18c338=this;return new Promise(function(_0x15f94e,_0x2b97e0){return db[_0x0ddb('0x18')][_0x0ddb('0x19')]({'raw':_0x5e2d89[_0x0ddb('0x1a')]?_0x5e2d89[_0x0ddb('0x1a')][_0x0ddb('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e2d89['options']?_0x5e2d89[_0x0ddb('0x1a')][_0x0ddb('0x1c')]||null:null,'attributes':_0x5e2d89[_0x0ddb('0x1a')]?_0x5e2d89[_0x0ddb('0x1a')]['attributes']||null:null,'limit':_0x5e2d89['options']?_0x5e2d89[_0x0ddb('0x1a')]['limit']||null:null,'include':_0x5e2d89[_0x0ddb('0x1a')]?_0x5e2d89[_0x0ddb('0x1a')][_0x0ddb('0x1d')]?_['map'](_0x5e2d89[_0x0ddb('0x1a')][_0x0ddb('0x1d')],function(_0x35f2e9){return{'model':db[_0x35f2e9['model']],'as':_0x35f2e9['as'],'attributes':_0x35f2e9[_0x0ddb('0x1e')],'include':_0x35f2e9[_0x0ddb('0x1d')]?_[_0x0ddb('0x1f')](_0x35f2e9[_0x0ddb('0x1d')],function(_0xf1077d){return{'model':db[_0xf1077d[_0x0ddb('0x20')]],'as':_0xf1077d['as'],'attributes':_0xf1077d[_0x0ddb('0x1e')],'include':_0xf1077d[_0x0ddb('0x1d')]?_[_0x0ddb('0x1f')](_0xf1077d[_0x0ddb('0x1d')],function(_0x587a5b){return{'model':db[_0x587a5b['model']],'as':_0x587a5b['as'],'attributes':_0x587a5b[_0x0ddb('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbfb5ac){logger[_0x0ddb('0xd')](_0x0ddb('0x17'),_0x5e2d89);logger['debug'](_0x0ddb('0x17'),_0x5e2d89,JSON[_0x0ddb('0x11')](_0xbfb5ac));_0x15f94e(_0xbfb5ac);})['catch'](function(_0x214576){logger[_0x0ddb('0x12')]('GetDynamics365Account',_0x214576[_0x0ddb('0x14')],_0x5e2d89);_0x2b97e0(_0x18c338[_0x0ddb('0x12')](0x1f4,_0x214576['message']));});});};exports[_0x0ddb('0x21')]=function(_0x3647a4){var _0x246a3c=this;return new Promise(function(_0x1917c6,_0x5f18a8){return db[_0x0ddb('0x18')][_0x0ddb('0x22')]({'raw':_0x3647a4['options']?_0x3647a4[_0x0ddb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3647a4[_0x0ddb('0x1a')]?_0x3647a4['options']['where']||null:null,'attributes':_0x3647a4[_0x0ddb('0x1a')]?_0x3647a4['options'][_0x0ddb('0x1e')]||null:null,'include':_0x3647a4[_0x0ddb('0x1a')]?_0x3647a4[_0x0ddb('0x1a')]['include']?_[_0x0ddb('0x1f')](_0x3647a4['options'][_0x0ddb('0x1d')],function(_0x3349fd){return{'model':db[_0x3349fd['model']],'as':_0x3349fd['as'],'attributes':_0x3349fd[_0x0ddb('0x1e')],'include':_0x3349fd[_0x0ddb('0x1d')]?_[_0x0ddb('0x1f')](_0x3349fd[_0x0ddb('0x1d')],function(_0x5e2298){return{'model':db[_0x5e2298[_0x0ddb('0x20')]],'as':_0x5e2298['as'],'attributes':_0x5e2298[_0x0ddb('0x1e')],'include':_0x5e2298[_0x0ddb('0x1d')]?_[_0x0ddb('0x1f')](_0x5e2298['include'],function(_0x8c76ad){return{'model':db[_0x8c76ad['model']],'as':_0x8c76ad['as'],'attributes':_0x8c76ad[_0x0ddb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0ddb('0xc')](function(_0xd3eebf){logger[_0x0ddb('0xd')]('ShowDynamics365Account',_0x3647a4);logger[_0x0ddb('0x23')](_0x0ddb('0x21'),_0x3647a4,JSON[_0x0ddb('0x11')](_0xd3eebf));_0x1917c6(_0xd3eebf);})[_0x0ddb('0x16')](function(_0x501e84){logger[_0x0ddb('0x12')](_0x0ddb('0x21'),_0x501e84[_0x0ddb('0x14')],_0x3647a4);_0x5f18a8(_0x246a3c['error'](0x1f4,_0x501e84[_0x0ddb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index fa0a808..df29529 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 _0xfcc5=['util','path','connect-timeout','express','fs-extra','../../config/environment','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfcc5,0x14a));var _0x5fcc=function(_0x3a2beb,_0xe8de96){_0x3a2beb=_0x3a2beb-0x0;var _0x3d363e=_0xfcc5[_0x3a2beb];return _0x3d363e;};'use strict';var multer=require('multer');var util=require(_0x5fcc('0x0'));var path=require(_0x5fcc('0x1'));var timeout=require(_0x5fcc('0x2'));var express=require(_0x5fcc('0x3'));var router=express['Router']();var fs_extra=require(_0x5fcc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fcc('0x5'));var controller=require(_0x5fcc('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5fcc('0x7')]);router[_0x5fcc('0x8')](_0x5fcc('0x9'),auth[_0x5fcc('0xa')](),controller[_0x5fcc('0xb')]);router['get'](_0x5fcc('0xc'),auth['isAuthenticated'](),controller[_0x5fcc('0xd')]);router[_0x5fcc('0x8')]('/:id/subjects',auth[_0x5fcc('0xa')](),controller[_0x5fcc('0xe')]);router[_0x5fcc('0x8')](_0x5fcc('0xf'),auth[_0x5fcc('0xa')](),controller[_0x5fcc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5fcc('0x11')]);router[_0x5fcc('0x12')](_0x5fcc('0x9'),auth[_0x5fcc('0xa')](),controller[_0x5fcc('0x13')]);router[_0x5fcc('0x14')](_0x5fcc('0x9'),auth['isAuthenticated'](),controller[_0x5fcc('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf9fd=['show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index'];(function(_0x2f2643,_0x12d2be){var _0x5a95c6=function(_0xaa998d){while(--_0xaa998d){_0x2f2643['push'](_0x2f2643['shift']());}};_0x5a95c6(++_0x12d2be);}(_0xf9fd,0x14f));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xdf9f('0x0'));var path=require(_0xdf9f('0x1'));var timeout=require(_0xdf9f('0x2'));var express=require(_0xdf9f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf9f('0x4'));var interaction=require(_0xdf9f('0x5'));var config=require(_0xdf9f('0x6'));var controller=require(_0xdf9f('0x7'));router[_0xdf9f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf9f('0x9')]);router[_0xdf9f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xdf9f('0xa')]);router[_0xdf9f('0x8')]('/:id/fields',auth[_0xdf9f('0xb')](),controller[_0xdf9f('0xc')]);router[_0xdf9f('0x8')](_0xdf9f('0xd'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0xe')]);router[_0xdf9f('0x8')](_0xdf9f('0xf'),auth['isAuthenticated'](),controller[_0xdf9f('0x10')]);router['post']('/',auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x11')]);router[_0xdf9f('0x12')](_0xdf9f('0x13'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x14')]);router[_0xdf9f('0x15')]('/:id',auth[_0xdf9f('0xb')](),controller['destroy']);module[_0xdf9f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index aff1325..03b1412 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 _0xa4ce=['incident','phonecall','nothing','sequelize','exports','STRING','ENUM'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa4ce,0x73));var _0xea4c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa4ce[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xea4c('0x0'));module[_0xea4c('0x1')]={'name':{'type':Sequelize[_0xea4c('0x2')]},'description':{'type':Sequelize[_0xea4c('0x2')]},'ticketType':{'type':Sequelize[_0xea4c('0x3')](_0xea4c('0x4'),_0xea4c('0x5')),'defaultValue':_0xea4c('0x4')},'moduleCreate':{'type':Sequelize[_0xea4c('0x3')]('contact',_0xea4c('0x6')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file +var _0x2f77=['exports','STRING','incident','phonecall','contact','sequelize'];(function(_0x1e3232,_0x292c4e){var _0x466678=function(_0x2732be){while(--_0x2732be){_0x1e3232['push'](_0x1e3232['shift']());}};_0x466678(++_0x292c4e);}(_0x2f77,0x1f1));var _0x72f7=function(_0x1465e2,_0x7e5150){_0x1465e2=_0x1465e2-0x0;var _0x38f758=_0x2f77[_0x1465e2];return _0x38f758;};'use strict';var Sequelize=require(_0x72f7('0x0'));module[_0x72f7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x72f7('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x72f7('0x3'),_0x72f7('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x72f7('0x5'),'nothing'),'defaultValue':_0x72f7('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 18ee5cb..0366cbc 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 _0x9b45=['nolimit','getSubjects','options','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getFields','findOne','Dynamics365Field','pick'];(function(_0xfd314f,_0x541798){var _0xdafc57=function(_0x6e9dfd){while(--_0x6e9dfd){_0xfd314f['push'](_0xfd314f['shift']());}};_0xdafc57(++_0x541798);}(_0x9b45,0x185));var _0x59b4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9b45[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59b4('0x0'));var zipdir=require(_0x59b4('0x1'));var jsonpatch=require(_0x59b4('0x2'));var rp=require(_0x59b4('0x3'));var moment=require('moment');var BPromise=require(_0x59b4('0x4'));var Mustache=require('mustache');var util=require(_0x59b4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x59b4('0x6'));var ejs=require(_0x59b4('0x7'));var fs=require('fs');var fs_extra=require(_0x59b4('0x8'));var _=require(_0x59b4('0x9'));var squel=require(_0x59b4('0xa'));var crypto=require(_0x59b4('0xb'));var jsforce=require(_0x59b4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x59b4('0xd'));var Papa=require('papaparse');var Redis=require(_0x59b4('0xe'));var authService=require(_0x59b4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x59b4('0x10'));var hardwareService=require(_0x59b4('0x11'));var logger=require('../../config/logger')(_0x59b4('0x12'));var utils=require(_0x59b4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x59b4('0x14'));var db=require(_0x59b4('0x15'))['db'];function respondWithStatusCode(_0x4c7306,_0xa55448){_0xa55448=_0xa55448||0xcc;return function(_0xdf386a){if(_0xdf386a){return _0x4c7306[_0x59b4('0x16')](_0xa55448);}return _0x4c7306[_0x59b4('0x17')](_0xa55448)[_0x59b4('0x18')]();};}function respondWithResult(_0x38fd4b,_0x285493){_0x285493=_0x285493||0xc8;return function(_0x28d706){if(_0x28d706){return _0x38fd4b[_0x59b4('0x17')](_0x285493)[_0x59b4('0x19')](_0x28d706);}};}function respondWithFilteredResult(_0x518933,_0x6a98fe){return function(_0x52f7bf){if(_0x52f7bf){var _0x79e06d=typeof _0x6a98fe[_0x59b4('0x1a')]===_0x59b4('0x1b')&&typeof _0x6a98fe['limit']===_0x59b4('0x1b');var _0x36072e=_0x52f7bf[_0x59b4('0x1c')];var _0xbb5b8a=_0x79e06d?0x0:_0x6a98fe['offset'];var _0x1970eb=_0x79e06d?_0x52f7bf['count']:_0x6a98fe[_0x59b4('0x1a')]+_0x6a98fe[_0x59b4('0x1d')];var _0x40a92c;if(_0x1970eb>=_0x36072e){_0x1970eb=_0x36072e;_0x40a92c=0xc8;}else{_0x40a92c=0xce;}_0x518933['status'](_0x40a92c);return _0x518933['set']('Content-Range',_0xbb5b8a+'-'+_0x1970eb+'/'+_0x36072e)[_0x59b4('0x19')](_0x52f7bf);}return null;};}function patchUpdates(_0x502e57){return function(_0x4ae939){try{jsonpatch[_0x59b4('0x1e')](_0x4ae939,_0x502e57,!![]);}catch(_0x406b92){return BPromise[_0x59b4('0x1f')](_0x406b92);}return _0x4ae939[_0x59b4('0x20')]();};}function saveUpdates(_0x181917,_0x361865){return function(_0x1fbd37){if(_0x1fbd37){return _0x1fbd37[_0x59b4('0x21')](_0x181917)[_0x59b4('0x22')](function(_0x50518e){return _0x50518e;});}return null;};}function removeEntity(_0x3cb62a,_0x3d05a0){return function(_0x18e4c4){if(_0x18e4c4){return _0x18e4c4[_0x59b4('0x23')]()[_0x59b4('0x22')](function(){_0x3cb62a[_0x59b4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4053,_0x34778e){return function(_0x1dfd55){if(!_0x1dfd55){_0x4b4053[_0x59b4('0x16')](0x194);}return _0x1dfd55;};}function handleError(_0x183388,_0x4549b2){_0x4549b2=_0x4549b2||0x1f4;return function(_0x557432){logger['error'](_0x557432['stack']);if(_0x557432[_0x59b4('0x24')]){delete _0x557432['name'];}_0x183388[_0x59b4('0x17')](_0x4549b2)[_0x59b4('0x25')](_0x557432);};}exports[_0x59b4('0x26')]=function(_0x214cac,_0x261907){var _0xfb0aa6={},_0x33ab7a={},_0x3f12fe={'count':0x0,'rows':[]};var _0x463174=_['map'](db[_0x59b4('0x27')][_0x59b4('0x28')],function(_0x4ff034){return{'name':_0x4ff034[_0x59b4('0x29')],'type':_0x4ff034[_0x59b4('0x2a')]['key']};});_0x33ab7a[_0x59b4('0x2b')]=_[_0x59b4('0x2c')](_0x463174,_0x59b4('0x24'));_0x33ab7a[_0x59b4('0x2d')]=_[_0x59b4('0x2e')](_0x214cac[_0x59b4('0x2d')]);_0x33ab7a['filters']=_[_0x59b4('0x2f')](_0x33ab7a['model'],_0x33ab7a[_0x59b4('0x2d')]);_0xfb0aa6[_0x59b4('0x30')]=_[_0x59b4('0x2f')](_0x33ab7a[_0x59b4('0x2b')],qs[_0x59b4('0x31')](_0x214cac[_0x59b4('0x2d')]['fields']));_0xfb0aa6['attributes']=_0xfb0aa6[_0x59b4('0x30')][_0x59b4('0x32')]?_0xfb0aa6[_0x59b4('0x30')]:_0x33ab7a[_0x59b4('0x2b')];if(!_0x214cac['query'][_0x59b4('0x33')]('nolimit')){_0xfb0aa6[_0x59b4('0x1d')]=qs[_0x59b4('0x1d')](_0x214cac['query'][_0x59b4('0x1d')]);_0xfb0aa6[_0x59b4('0x1a')]=qs['offset'](_0x214cac[_0x59b4('0x2d')][_0x59b4('0x1a')]);}_0xfb0aa6[_0x59b4('0x34')]=qs[_0x59b4('0x35')](_0x214cac[_0x59b4('0x2d')][_0x59b4('0x35')]);_0xfb0aa6[_0x59b4('0x36')]=qs['filters'](_['pick'](_0x214cac[_0x59b4('0x2d')],_0x33ab7a[_0x59b4('0x37')]),_0x463174);if(_0x214cac[_0x59b4('0x2d')][_0x59b4('0x38')]){_0xfb0aa6['where']=_['merge'](_0xfb0aa6[_0x59b4('0x36')],{'$or':_[_0x59b4('0x2c')](_0x463174,function(_0x5c643e){if(_0x5c643e[_0x59b4('0x2a')]!==_0x59b4('0x39')){var _0x458643={};_0x458643[_0x5c643e[_0x59b4('0x24')]]={'$like':'%'+_0x214cac[_0x59b4('0x2d')][_0x59b4('0x38')]+'%'};return _0x458643;}})});}_0xfb0aa6=_['merge']({},_0xfb0aa6,_0x214cac['options']);var _0x18b3f4={'where':_0xfb0aa6['where']};return db[_0x59b4('0x27')][_0x59b4('0x1c')](_0x18b3f4)['then'](function(_0x2eca45){_0x3f12fe['count']=_0x2eca45;if(_0x214cac[_0x59b4('0x2d')][_0x59b4('0x3a')]){_0xfb0aa6[_0x59b4('0x3b')]=[{'all':!![]}];}return db[_0x59b4('0x27')][_0x59b4('0x3c')](_0xfb0aa6);})[_0x59b4('0x22')](function(_0x4b0d6e){_0x3f12fe[_0x59b4('0x3d')]=_0x4b0d6e;return _0x3f12fe;})[_0x59b4('0x22')](respondWithFilteredResult(_0x261907,_0xfb0aa6))[_0x59b4('0x3e')](handleError(_0x261907,null));};exports[_0x59b4('0x3f')]=function(_0x3e58b2,_0x25c37f){var _0x32e20b={'raw':![],'where':{'id':_0x3e58b2[_0x59b4('0x40')]['id']}},_0x4758bf={};_0x4758bf[_0x59b4('0x2b')]=_[_0x59b4('0x2e')](db[_0x59b4('0x27')][_0x59b4('0x28')]);_0x4758bf[_0x59b4('0x2d')]=_[_0x59b4('0x2e')](_0x3e58b2[_0x59b4('0x2d')]);_0x4758bf[_0x59b4('0x37')]=_[_0x59b4('0x2f')](_0x4758bf[_0x59b4('0x2b')],_0x4758bf[_0x59b4('0x2d')]);_0x32e20b[_0x59b4('0x30')]=_[_0x59b4('0x2f')](_0x4758bf['model'],qs[_0x59b4('0x31')](_0x3e58b2[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x32e20b[_0x59b4('0x30')]=_0x32e20b[_0x59b4('0x30')][_0x59b4('0x32')]?_0x32e20b[_0x59b4('0x30')]:_0x4758bf[_0x59b4('0x2b')];if(_0x3e58b2['query'][_0x59b4('0x3a')]){_0x32e20b[_0x59b4('0x3b')]=[{'all':!![]}];}_0x32e20b=_[_0x59b4('0x41')]({},_0x32e20b,_0x3e58b2['options']);return db[_0x59b4('0x27')][_0x59b4('0x42')](_0x32e20b)[_0x59b4('0x22')](handleEntityNotFound(_0x25c37f,null))[_0x59b4('0x22')](respondWithResult(_0x25c37f,null))[_0x59b4('0x3e')](handleError(_0x25c37f,null));};exports['create']=function(_0x5cfbeb,_0x1f7c68){return db['Dynamics365Configuration'][_0x59b4('0x43')](_0x5cfbeb[_0x59b4('0x44')],{})[_0x59b4('0x22')](respondWithResult(_0x1f7c68,0xc9))[_0x59b4('0x3e')](handleError(_0x1f7c68,null));};exports[_0x59b4('0x21')]=function(_0x46f1e8,_0x1d052b){if(_0x46f1e8['body']['id']){delete _0x46f1e8[_0x59b4('0x44')]['id'];}return db[_0x59b4('0x27')][_0x59b4('0x42')]({'where':{'id':_0x46f1e8['params']['id']}})[_0x59b4('0x22')](handleEntityNotFound(_0x1d052b,null))[_0x59b4('0x22')](saveUpdates(_0x46f1e8[_0x59b4('0x44')],null))[_0x59b4('0x22')](respondWithResult(_0x1d052b,null))[_0x59b4('0x3e')](handleError(_0x1d052b,null));};exports[_0x59b4('0x23')]=function(_0x4a5100,_0x517682){return db[_0x59b4('0x27')]['find']({'where':{'id':_0x4a5100['params']['id']}})[_0x59b4('0x22')](handleEntityNotFound(_0x517682,null))[_0x59b4('0x22')](removeEntity(_0x517682,null))['catch'](handleError(_0x517682,null));};exports[_0x59b4('0x45')]=function(_0x2f00f2,_0x4f8256,_0x286ec3){var _0x103ac0={};var _0x2c1a50={};var _0x53b034;var _0x393dca;return db['Dynamics365Configuration'][_0x59b4('0x46')]({'where':{'id':_0x2f00f2[_0x59b4('0x40')]['id']}})['then'](handleEntityNotFound(_0x4f8256,null))[_0x59b4('0x22')](function(_0x54be2f){if(_0x54be2f){_0x53b034=_0x54be2f;_0x2c1a50[_0x59b4('0x2b')]=_[_0x59b4('0x2e')](db[_0x59b4('0x47')][_0x59b4('0x28')]);_0x2c1a50[_0x59b4('0x2d')]=_[_0x59b4('0x2e')](_0x2f00f2[_0x59b4('0x2d')]);_0x2c1a50[_0x59b4('0x37')]=_[_0x59b4('0x2f')](_0x2c1a50[_0x59b4('0x2b')],_0x2c1a50[_0x59b4('0x2d')]);_0x103ac0[_0x59b4('0x30')]=_[_0x59b4('0x2f')](_0x2c1a50['model'],qs[_0x59b4('0x31')](_0x2f00f2[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x103ac0[_0x59b4('0x30')]=_0x103ac0[_0x59b4('0x30')][_0x59b4('0x32')]?_0x103ac0[_0x59b4('0x30')]:_0x2c1a50[_0x59b4('0x2b')];_0x103ac0[_0x59b4('0x34')]=qs['sort'](_0x2f00f2[_0x59b4('0x2d')][_0x59b4('0x35')]);_0x103ac0[_0x59b4('0x36')]=qs['filters'](_[_0x59b4('0x48')](_0x2f00f2[_0x59b4('0x2d')],_0x2c1a50[_0x59b4('0x37')]));if(_0x2f00f2[_0x59b4('0x2d')][_0x59b4('0x38')]){_0x103ac0[_0x59b4('0x36')]=_[_0x59b4('0x41')](_0x103ac0[_0x59b4('0x36')],{'$or':_['map'](_0x103ac0[_0x59b4('0x30')],function(_0x3f39d4){var _0x24acb9={};_0x24acb9[_0x3f39d4]={'$like':'%'+_0x2f00f2['query'][_0x59b4('0x38')]+'%'};return _0x24acb9;})});}_0x103ac0=_[_0x59b4('0x41')]({},_0x103ac0,_0x2f00f2['options']);return _0x53b034[_0x59b4('0x45')](_0x103ac0);}})[_0x59b4('0x22')](function(_0x20830d){if(_0x20830d){_0x393dca=_0x20830d[_0x59b4('0x32')];if(!_0x2f00f2['query'][_0x59b4('0x33')](_0x59b4('0x49'))){_0x103ac0[_0x59b4('0x1d')]=qs['limit'](_0x2f00f2[_0x59b4('0x2d')]['limit']);_0x103ac0[_0x59b4('0x1a')]=qs['offset'](_0x2f00f2[_0x59b4('0x2d')][_0x59b4('0x1a')]);}return _0x53b034[_0x59b4('0x45')](_0x103ac0);}})[_0x59b4('0x22')](function(_0x21b628){if(_0x21b628){return _0x21b628?{'count':_0x393dca,'rows':_0x21b628}:null;}})['then'](respondWithResult(_0x4f8256,null))[_0x59b4('0x3e')](handleError(_0x4f8256,null));};exports[_0x59b4('0x4a')]=function(_0x3f4b99,_0x40efb2,_0x1b4104){var _0x2fd6c8={};var _0xe8d359={};var _0x112167;var _0x42351f;return db['Dynamics365Configuration'][_0x59b4('0x46')]({'where':{'id':_0x3f4b99['params']['id']}})['then'](handleEntityNotFound(_0x40efb2,null))[_0x59b4('0x22')](function(_0x3ef767){if(_0x3ef767){_0x112167=_0x3ef767;_0xe8d359[_0x59b4('0x2b')]=_[_0x59b4('0x2e')](db['Dynamics365Field'][_0x59b4('0x28')]);_0xe8d359['query']=_[_0x59b4('0x2e')](_0x3f4b99[_0x59b4('0x2d')]);_0xe8d359[_0x59b4('0x37')]=_[_0x59b4('0x2f')](_0xe8d359[_0x59b4('0x2b')],_0xe8d359['query']);_0x2fd6c8['attributes']=_[_0x59b4('0x2f')](_0xe8d359['model'],qs['fields'](_0x3f4b99['query'][_0x59b4('0x31')]));_0x2fd6c8[_0x59b4('0x30')]=_0x2fd6c8[_0x59b4('0x30')][_0x59b4('0x32')]?_0x2fd6c8[_0x59b4('0x30')]:_0xe8d359[_0x59b4('0x2b')];_0x2fd6c8[_0x59b4('0x34')]=qs[_0x59b4('0x35')](_0x3f4b99['query'][_0x59b4('0x35')]);_0x2fd6c8['where']=qs[_0x59b4('0x37')](_[_0x59b4('0x48')](_0x3f4b99[_0x59b4('0x2d')],_0xe8d359['filters']));if(_0x3f4b99[_0x59b4('0x2d')][_0x59b4('0x38')]){_0x2fd6c8[_0x59b4('0x36')]=_[_0x59b4('0x41')](_0x2fd6c8[_0x59b4('0x36')],{'$or':_[_0x59b4('0x2c')](_0x2fd6c8['attributes'],function(_0x1068ec){var _0x2d987f={};_0x2d987f[_0x1068ec]={'$like':'%'+_0x3f4b99[_0x59b4('0x2d')][_0x59b4('0x38')]+'%'};return _0x2d987f;})});}_0x2fd6c8=_[_0x59b4('0x41')]({},_0x2fd6c8,_0x3f4b99['options']);return _0x112167[_0x59b4('0x4a')](_0x2fd6c8);}})[_0x59b4('0x22')](function(_0x11a4d9){if(_0x11a4d9){_0x42351f=_0x11a4d9[_0x59b4('0x32')];if(!_0x3f4b99[_0x59b4('0x2d')][_0x59b4('0x33')](_0x59b4('0x49'))){_0x2fd6c8['limit']=qs[_0x59b4('0x1d')](_0x3f4b99['query'][_0x59b4('0x1d')]);_0x2fd6c8[_0x59b4('0x1a')]=qs[_0x59b4('0x1a')](_0x3f4b99[_0x59b4('0x2d')]['offset']);}return _0x112167['getSubjects'](_0x2fd6c8);}})['then'](function(_0x5ada6c){if(_0x5ada6c){return _0x5ada6c?{'count':_0x42351f,'rows':_0x5ada6c}:null;}})[_0x59b4('0x22')](respondWithResult(_0x40efb2,null))['catch'](handleError(_0x40efb2,null));};exports['getDescriptions']=function(_0x580255,_0x8021b4,_0xf54ed7){var _0x5d3772={};var _0x4fc851={};var _0x21c45a;var _0x176f0f;return db[_0x59b4('0x27')]['findOne']({'where':{'id':_0x580255[_0x59b4('0x40')]['id']}})[_0x59b4('0x22')](handleEntityNotFound(_0x8021b4,null))['then'](function(_0x2ffb71){if(_0x2ffb71){_0x21c45a=_0x2ffb71;_0x4fc851[_0x59b4('0x2b')]=_[_0x59b4('0x2e')](db[_0x59b4('0x47')][_0x59b4('0x28')]);_0x4fc851['query']=_[_0x59b4('0x2e')](_0x580255[_0x59b4('0x2d')]);_0x4fc851[_0x59b4('0x37')]=_[_0x59b4('0x2f')](_0x4fc851['model'],_0x4fc851[_0x59b4('0x2d')]);_0x5d3772[_0x59b4('0x30')]=_[_0x59b4('0x2f')](_0x4fc851[_0x59b4('0x2b')],qs[_0x59b4('0x31')](_0x580255[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x5d3772[_0x59b4('0x30')]=_0x5d3772[_0x59b4('0x30')][_0x59b4('0x32')]?_0x5d3772[_0x59b4('0x30')]:_0x4fc851['model'];_0x5d3772[_0x59b4('0x34')]=qs[_0x59b4('0x35')](_0x580255[_0x59b4('0x2d')][_0x59b4('0x35')]);_0x5d3772[_0x59b4('0x36')]=qs[_0x59b4('0x37')](_[_0x59b4('0x48')](_0x580255[_0x59b4('0x2d')],_0x4fc851[_0x59b4('0x37')]));if(_0x580255['query'][_0x59b4('0x38')]){_0x5d3772[_0x59b4('0x36')]=_[_0x59b4('0x41')](_0x5d3772[_0x59b4('0x36')],{'$or':_[_0x59b4('0x2c')](_0x5d3772[_0x59b4('0x30')],function(_0x488999){var _0x511629={};_0x511629[_0x488999]={'$like':'%'+_0x580255[_0x59b4('0x2d')][_0x59b4('0x38')]+'%'};return _0x511629;})});}_0x5d3772=_['merge']({},_0x5d3772,_0x580255[_0x59b4('0x4b')]);return _0x21c45a['getDescriptions'](_0x5d3772);}})[_0x59b4('0x22')](function(_0x336987){if(_0x336987){_0x176f0f=_0x336987['length'];if(!_0x580255[_0x59b4('0x2d')][_0x59b4('0x33')](_0x59b4('0x49'))){_0x5d3772[_0x59b4('0x1d')]=qs[_0x59b4('0x1d')](_0x580255['query'][_0x59b4('0x1d')]);_0x5d3772['offset']=qs[_0x59b4('0x1a')](_0x580255[_0x59b4('0x2d')][_0x59b4('0x1a')]);}return _0x21c45a[_0x59b4('0x4c')](_0x5d3772);}})[_0x59b4('0x22')](function(_0x52eb8c){if(_0x52eb8c){return _0x52eb8c?{'count':_0x176f0f,'rows':_0x52eb8c}:null;}})['then'](respondWithResult(_0x8021b4,null))[_0x59b4('0x3e')](handleError(_0x8021b4,null));}; \ No newline at end of file +var _0x8b68=['destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getFields','Dynamics365Field','filter','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then'];(function(_0x1922df,_0x47b904){var _0x4dbdc6=function(_0x2c038d){while(--_0x2c038d){_0x1922df['push'](_0x1922df['shift']());}};_0x4dbdc6(++_0x47b904);}(_0x8b68,0x175));var _0x88b6=function(_0x68927b,_0x42fb60){_0x68927b=_0x68927b-0x0;var _0x17778f=_0x8b68[_0x68927b];return _0x17778f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88b6('0x0'));var zipdir=require(_0x88b6('0x1'));var jsonpatch=require(_0x88b6('0x2'));var rp=require(_0x88b6('0x3'));var moment=require(_0x88b6('0x4'));var BPromise=require(_0x88b6('0x5'));var Mustache=require('mustache');var util=require(_0x88b6('0x6'));var path=require(_0x88b6('0x7'));var sox=require(_0x88b6('0x8'));var csv=require('to-csv');var ejs=require(_0x88b6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88b6('0xa'));var squel=require(_0x88b6('0xb'));var crypto=require(_0x88b6('0xc'));var jsforce=require(_0x88b6('0xd'));var deskjs=require(_0x88b6('0xe'));var toCsv=require(_0x88b6('0xf'));var querystring=require(_0x88b6('0x10'));var Papa=require(_0x88b6('0x11'));var Redis=require(_0x88b6('0x12'));var authService=require(_0x88b6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x88b6('0x14'));var hardwareService=require(_0x88b6('0x15'));var logger=require(_0x88b6('0x16'))(_0x88b6('0x17'));var utils=require(_0x88b6('0x18'));var config=require(_0x88b6('0x19'));var licenseUtil=require(_0x88b6('0x1a'));var db=require(_0x88b6('0x1b'))['db'];function respondWithStatusCode(_0x3e8cbd,_0xced98d){_0xced98d=_0xced98d||0xcc;return function(_0x168fd5){if(_0x168fd5){return _0x3e8cbd[_0x88b6('0x1c')](_0xced98d);}return _0x3e8cbd[_0x88b6('0x1d')](_0xced98d)[_0x88b6('0x1e')]();};}function respondWithResult(_0x5ce3c4,_0x365c89){_0x365c89=_0x365c89||0xc8;return function(_0x486e3b){if(_0x486e3b){return _0x5ce3c4[_0x88b6('0x1d')](_0x365c89)[_0x88b6('0x1f')](_0x486e3b);}};}function respondWithFilteredResult(_0x2568a2,_0x49cabf){return function(_0x4fab07){if(_0x4fab07){var _0x3e1468=typeof _0x49cabf[_0x88b6('0x20')]===_0x88b6('0x21')&&typeof _0x49cabf['limit']===_0x88b6('0x21');var _0x55854d=_0x4fab07[_0x88b6('0x22')];var _0x3ceb2f=_0x3e1468?0x0:_0x49cabf[_0x88b6('0x20')];var _0xb36e8e=_0x3e1468?_0x4fab07[_0x88b6('0x22')]:_0x49cabf[_0x88b6('0x20')]+_0x49cabf[_0x88b6('0x23')];var _0x97e97d;if(_0xb36e8e>=_0x55854d){_0xb36e8e=_0x55854d;_0x97e97d=0xc8;}else{_0x97e97d=0xce;}_0x2568a2['status'](_0x97e97d);return _0x2568a2[_0x88b6('0x24')](_0x88b6('0x25'),_0x3ceb2f+'-'+_0xb36e8e+'/'+_0x55854d)['json'](_0x4fab07);}return null;};}function patchUpdates(_0x5bd8a5){return function(_0x7adf7d){try{jsonpatch['apply'](_0x7adf7d,_0x5bd8a5,!![]);}catch(_0x4d2e35){return BPromise[_0x88b6('0x26')](_0x4d2e35);}return _0x7adf7d[_0x88b6('0x27')]();};}function saveUpdates(_0x308e69,_0x421ff2){return function(_0x1a729c){if(_0x1a729c){return _0x1a729c[_0x88b6('0x28')](_0x308e69)[_0x88b6('0x29')](function(_0x5333c7){return _0x5333c7;});}return null;};}function removeEntity(_0x294bae,_0x56bc09){return function(_0x32c8ec){if(_0x32c8ec){return _0x32c8ec[_0x88b6('0x2a')]()[_0x88b6('0x29')](function(){_0x294bae[_0x88b6('0x1d')](0xcc)[_0x88b6('0x1e')]();});}};}function handleEntityNotFound(_0x1cb470,_0x4e1397){return function(_0xa90470){if(!_0xa90470){_0x1cb470[_0x88b6('0x1c')](0x194);}return _0xa90470;};}function handleError(_0x38213c,_0x4a42bf){_0x4a42bf=_0x4a42bf||0x1f4;return function(_0x5126f4){logger['error'](_0x5126f4[_0x88b6('0x2b')]);if(_0x5126f4[_0x88b6('0x2c')]){delete _0x5126f4[_0x88b6('0x2c')];}_0x38213c['status'](_0x4a42bf)['send'](_0x5126f4);};}exports[_0x88b6('0x2d')]=function(_0x1d483c,_0x42b8ab){var _0x24a239={},_0x5618dc={},_0x29a44f={'count':0x0,'rows':[]};var _0xd9d0a1=_[_0x88b6('0x2e')](db[_0x88b6('0x2f')][_0x88b6('0x30')],function(_0x4ecf81){return{'name':_0x4ecf81[_0x88b6('0x31')],'type':_0x4ecf81[_0x88b6('0x32')]['key']};});_0x5618dc['model']=_['map'](_0xd9d0a1,_0x88b6('0x2c'));_0x5618dc[_0x88b6('0x33')]=_['keys'](_0x1d483c[_0x88b6('0x33')]);_0x5618dc[_0x88b6('0x34')]=_[_0x88b6('0x35')](_0x5618dc[_0x88b6('0x36')],_0x5618dc[_0x88b6('0x33')]);_0x24a239[_0x88b6('0x37')]=_[_0x88b6('0x35')](_0x5618dc[_0x88b6('0x36')],qs['fields'](_0x1d483c[_0x88b6('0x33')][_0x88b6('0x38')]));_0x24a239[_0x88b6('0x37')]=_0x24a239[_0x88b6('0x37')][_0x88b6('0x39')]?_0x24a239[_0x88b6('0x37')]:_0x5618dc[_0x88b6('0x36')];if(!_0x1d483c[_0x88b6('0x33')][_0x88b6('0x3a')](_0x88b6('0x3b'))){_0x24a239[_0x88b6('0x23')]=qs['limit'](_0x1d483c[_0x88b6('0x33')][_0x88b6('0x23')]);_0x24a239['offset']=qs[_0x88b6('0x20')](_0x1d483c[_0x88b6('0x33')][_0x88b6('0x20')]);}_0x24a239[_0x88b6('0x3c')]=qs[_0x88b6('0x3d')](_0x1d483c['query'][_0x88b6('0x3d')]);_0x24a239[_0x88b6('0x3e')]=qs[_0x88b6('0x34')](_[_0x88b6('0x3f')](_0x1d483c[_0x88b6('0x33')],_0x5618dc[_0x88b6('0x34')]),_0xd9d0a1);if(_0x1d483c[_0x88b6('0x33')]['filter']){_0x24a239['where']=_[_0x88b6('0x40')](_0x24a239[_0x88b6('0x3e')],{'$or':_['map'](_0xd9d0a1,function(_0x3694ca){if(_0x3694ca[_0x88b6('0x32')]!=='VIRTUAL'){var _0x3463f7={};_0x3463f7[_0x3694ca[_0x88b6('0x2c')]]={'$like':'%'+_0x1d483c[_0x88b6('0x33')]['filter']+'%'};return _0x3463f7;}})});}_0x24a239=_[_0x88b6('0x40')]({},_0x24a239,_0x1d483c[_0x88b6('0x41')]);var _0x528b3f={'where':_0x24a239[_0x88b6('0x3e')]};return db[_0x88b6('0x2f')][_0x88b6('0x22')](_0x528b3f)[_0x88b6('0x29')](function(_0x245fa0){_0x29a44f[_0x88b6('0x22')]=_0x245fa0;if(_0x1d483c[_0x88b6('0x33')]['includeAll']){_0x24a239[_0x88b6('0x42')]=[{'all':!![]}];}return db[_0x88b6('0x2f')][_0x88b6('0x43')](_0x24a239);})[_0x88b6('0x29')](function(_0x348a92){_0x29a44f[_0x88b6('0x44')]=_0x348a92;return _0x29a44f;})[_0x88b6('0x29')](respondWithFilteredResult(_0x42b8ab,_0x24a239))[_0x88b6('0x45')](handleError(_0x42b8ab,null));};exports[_0x88b6('0x46')]=function(_0x17467d,_0x199761){var _0x5dcdf9={'raw':![],'where':{'id':_0x17467d[_0x88b6('0x47')]['id']}},_0x385a92={};_0x385a92[_0x88b6('0x36')]=_[_0x88b6('0x48')](db[_0x88b6('0x2f')][_0x88b6('0x30')]);_0x385a92[_0x88b6('0x33')]=_[_0x88b6('0x48')](_0x17467d[_0x88b6('0x33')]);_0x385a92[_0x88b6('0x34')]=_[_0x88b6('0x35')](_0x385a92['model'],_0x385a92[_0x88b6('0x33')]);_0x5dcdf9[_0x88b6('0x37')]=_[_0x88b6('0x35')](_0x385a92['model'],qs[_0x88b6('0x38')](_0x17467d[_0x88b6('0x33')][_0x88b6('0x38')]));_0x5dcdf9[_0x88b6('0x37')]=_0x5dcdf9[_0x88b6('0x37')]['length']?_0x5dcdf9[_0x88b6('0x37')]:_0x385a92[_0x88b6('0x36')];if(_0x17467d[_0x88b6('0x33')][_0x88b6('0x49')]){_0x5dcdf9[_0x88b6('0x42')]=[{'all':!![]}];}_0x5dcdf9=_['merge']({},_0x5dcdf9,_0x17467d[_0x88b6('0x41')]);return db[_0x88b6('0x2f')][_0x88b6('0x4a')](_0x5dcdf9)[_0x88b6('0x29')](handleEntityNotFound(_0x199761,null))['then'](respondWithResult(_0x199761,null))[_0x88b6('0x45')](handleError(_0x199761,null));};exports[_0x88b6('0x4b')]=function(_0xee091b,_0x11d5c9){return db['Dynamics365Configuration']['create'](_0xee091b[_0x88b6('0x4c')],{})[_0x88b6('0x29')](respondWithResult(_0x11d5c9,0xc9))[_0x88b6('0x45')](handleError(_0x11d5c9,null));};exports[_0x88b6('0x28')]=function(_0x317dd5,_0x730d79){if(_0x317dd5['body']['id']){delete _0x317dd5[_0x88b6('0x4c')]['id'];}return db[_0x88b6('0x2f')][_0x88b6('0x4a')]({'where':{'id':_0x317dd5['params']['id']}})['then'](handleEntityNotFound(_0x730d79,null))[_0x88b6('0x29')](saveUpdates(_0x317dd5[_0x88b6('0x4c')],null))[_0x88b6('0x29')](respondWithResult(_0x730d79,null))['catch'](handleError(_0x730d79,null));};exports[_0x88b6('0x2a')]=function(_0x45ce96,_0xeaad96){return db[_0x88b6('0x2f')][_0x88b6('0x4a')]({'where':{'id':_0x45ce96[_0x88b6('0x47')]['id']}})[_0x88b6('0x29')](handleEntityNotFound(_0xeaad96,null))[_0x88b6('0x29')](removeEntity(_0xeaad96,null))[_0x88b6('0x45')](handleError(_0xeaad96,null));};exports[_0x88b6('0x4d')]=function(_0xc0fc13,_0x44b939,_0x32c5f1){var _0x3bae7e={};var _0x24d555={};var _0x416ce9;var _0x1b059d;return db[_0x88b6('0x2f')]['findOne']({'where':{'id':_0xc0fc13[_0x88b6('0x47')]['id']}})[_0x88b6('0x29')](handleEntityNotFound(_0x44b939,null))['then'](function(_0x2a5407){if(_0x2a5407){_0x416ce9=_0x2a5407;_0x24d555[_0x88b6('0x36')]=_[_0x88b6('0x48')](db[_0x88b6('0x4e')][_0x88b6('0x30')]);_0x24d555[_0x88b6('0x33')]=_[_0x88b6('0x48')](_0xc0fc13[_0x88b6('0x33')]);_0x24d555[_0x88b6('0x34')]=_[_0x88b6('0x35')](_0x24d555[_0x88b6('0x36')],_0x24d555[_0x88b6('0x33')]);_0x3bae7e[_0x88b6('0x37')]=_[_0x88b6('0x35')](_0x24d555[_0x88b6('0x36')],qs[_0x88b6('0x38')](_0xc0fc13['query']['fields']));_0x3bae7e[_0x88b6('0x37')]=_0x3bae7e['attributes']['length']?_0x3bae7e[_0x88b6('0x37')]:_0x24d555['model'];_0x3bae7e[_0x88b6('0x3c')]=qs[_0x88b6('0x3d')](_0xc0fc13[_0x88b6('0x33')][_0x88b6('0x3d')]);_0x3bae7e['where']=qs[_0x88b6('0x34')](_[_0x88b6('0x3f')](_0xc0fc13[_0x88b6('0x33')],_0x24d555[_0x88b6('0x34')]));if(_0xc0fc13[_0x88b6('0x33')][_0x88b6('0x4f')]){_0x3bae7e[_0x88b6('0x3e')]=_[_0x88b6('0x40')](_0x3bae7e[_0x88b6('0x3e')],{'$or':_[_0x88b6('0x2e')](_0x3bae7e[_0x88b6('0x37')],function(_0x16c3db){var _0x5cbdbc={};_0x5cbdbc[_0x16c3db]={'$like':'%'+_0xc0fc13['query'][_0x88b6('0x4f')]+'%'};return _0x5cbdbc;})});}_0x3bae7e=_['merge']({},_0x3bae7e,_0xc0fc13[_0x88b6('0x41')]);return _0x416ce9[_0x88b6('0x4d')](_0x3bae7e);}})[_0x88b6('0x29')](function(_0x582051){if(_0x582051){_0x1b059d=_0x582051[_0x88b6('0x39')];if(!_0xc0fc13[_0x88b6('0x33')][_0x88b6('0x3a')](_0x88b6('0x3b'))){_0x3bae7e[_0x88b6('0x23')]=qs[_0x88b6('0x23')](_0xc0fc13[_0x88b6('0x33')][_0x88b6('0x23')]);_0x3bae7e[_0x88b6('0x20')]=qs[_0x88b6('0x20')](_0xc0fc13['query']['offset']);}return _0x416ce9[_0x88b6('0x4d')](_0x3bae7e);}})['then'](function(_0x4d1378){if(_0x4d1378){return _0x4d1378?{'count':_0x1b059d,'rows':_0x4d1378}:null;}})[_0x88b6('0x29')](respondWithResult(_0x44b939,null))['catch'](handleError(_0x44b939,null));};exports[_0x88b6('0x50')]=function(_0x8471d8,_0xac05d8,_0x571bd4){var _0x307353={};var _0x3f3151={};var _0x33a4c3;var _0x41418b;return db[_0x88b6('0x2f')][_0x88b6('0x51')]({'where':{'id':_0x8471d8['params']['id']}})['then'](handleEntityNotFound(_0xac05d8,null))[_0x88b6('0x29')](function(_0x5840ad){if(_0x5840ad){_0x33a4c3=_0x5840ad;_0x3f3151['model']=_[_0x88b6('0x48')](db['Dynamics365Field'][_0x88b6('0x30')]);_0x3f3151[_0x88b6('0x33')]=_[_0x88b6('0x48')](_0x8471d8[_0x88b6('0x33')]);_0x3f3151['filters']=_[_0x88b6('0x35')](_0x3f3151['model'],_0x3f3151[_0x88b6('0x33')]);_0x307353[_0x88b6('0x37')]=_[_0x88b6('0x35')](_0x3f3151['model'],qs[_0x88b6('0x38')](_0x8471d8[_0x88b6('0x33')][_0x88b6('0x38')]));_0x307353[_0x88b6('0x37')]=_0x307353[_0x88b6('0x37')][_0x88b6('0x39')]?_0x307353[_0x88b6('0x37')]:_0x3f3151[_0x88b6('0x36')];_0x307353['order']=qs[_0x88b6('0x3d')](_0x8471d8[_0x88b6('0x33')][_0x88b6('0x3d')]);_0x307353[_0x88b6('0x3e')]=qs[_0x88b6('0x34')](_[_0x88b6('0x3f')](_0x8471d8[_0x88b6('0x33')],_0x3f3151[_0x88b6('0x34')]));if(_0x8471d8[_0x88b6('0x33')][_0x88b6('0x4f')]){_0x307353['where']=_['merge'](_0x307353[_0x88b6('0x3e')],{'$or':_['map'](_0x307353[_0x88b6('0x37')],function(_0x2ee620){var _0x2dbbfa={};_0x2dbbfa[_0x2ee620]={'$like':'%'+_0x8471d8['query'][_0x88b6('0x4f')]+'%'};return _0x2dbbfa;})});}_0x307353=_['merge']({},_0x307353,_0x8471d8['options']);return _0x33a4c3['getSubjects'](_0x307353);}})['then'](function(_0x284c3a){if(_0x284c3a){_0x41418b=_0x284c3a[_0x88b6('0x39')];if(!_0x8471d8[_0x88b6('0x33')][_0x88b6('0x3a')](_0x88b6('0x3b'))){_0x307353[_0x88b6('0x23')]=qs['limit'](_0x8471d8[_0x88b6('0x33')]['limit']);_0x307353[_0x88b6('0x20')]=qs[_0x88b6('0x20')](_0x8471d8[_0x88b6('0x33')]['offset']);}return _0x33a4c3[_0x88b6('0x50')](_0x307353);}})[_0x88b6('0x29')](function(_0x3b4644){if(_0x3b4644){return _0x3b4644?{'count':_0x41418b,'rows':_0x3b4644}:null;}})['then'](respondWithResult(_0xac05d8,null))[_0x88b6('0x45')](handleError(_0xac05d8,null));};exports[_0x88b6('0x52')]=function(_0x5dabc6,_0x8939a7,_0x1920c2){var _0x2d11dd={};var _0x29dc9d={};var _0x88515d;var _0x256cc4;return db[_0x88b6('0x2f')][_0x88b6('0x51')]({'where':{'id':_0x5dabc6[_0x88b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x8939a7,null))['then'](function(_0x56703d){if(_0x56703d){_0x88515d=_0x56703d;_0x29dc9d[_0x88b6('0x36')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x29dc9d[_0x88b6('0x33')]=_[_0x88b6('0x48')](_0x5dabc6[_0x88b6('0x33')]);_0x29dc9d[_0x88b6('0x34')]=_[_0x88b6('0x35')](_0x29dc9d['model'],_0x29dc9d[_0x88b6('0x33')]);_0x2d11dd['attributes']=_[_0x88b6('0x35')](_0x29dc9d[_0x88b6('0x36')],qs[_0x88b6('0x38')](_0x5dabc6[_0x88b6('0x33')][_0x88b6('0x38')]));_0x2d11dd[_0x88b6('0x37')]=_0x2d11dd['attributes']['length']?_0x2d11dd[_0x88b6('0x37')]:_0x29dc9d[_0x88b6('0x36')];_0x2d11dd['order']=qs['sort'](_0x5dabc6[_0x88b6('0x33')][_0x88b6('0x3d')]);_0x2d11dd[_0x88b6('0x3e')]=qs[_0x88b6('0x34')](_['pick'](_0x5dabc6['query'],_0x29dc9d['filters']));if(_0x5dabc6[_0x88b6('0x33')][_0x88b6('0x4f')]){_0x2d11dd[_0x88b6('0x3e')]=_[_0x88b6('0x40')](_0x2d11dd[_0x88b6('0x3e')],{'$or':_[_0x88b6('0x2e')](_0x2d11dd['attributes'],function(_0x3f94cb){var _0x43158c={};_0x43158c[_0x3f94cb]={'$like':'%'+_0x5dabc6[_0x88b6('0x33')]['filter']+'%'};return _0x43158c;})});}_0x2d11dd=_['merge']({},_0x2d11dd,_0x5dabc6[_0x88b6('0x41')]);return _0x88515d[_0x88b6('0x52')](_0x2d11dd);}})['then'](function(_0x5dc6a6){if(_0x5dc6a6){_0x256cc4=_0x5dc6a6[_0x88b6('0x39')];if(!_0x5dabc6['query'][_0x88b6('0x3a')](_0x88b6('0x3b'))){_0x2d11dd[_0x88b6('0x23')]=qs[_0x88b6('0x23')](_0x5dabc6['query'][_0x88b6('0x23')]);_0x2d11dd['offset']=qs[_0x88b6('0x20')](_0x5dabc6[_0x88b6('0x33')][_0x88b6('0x20')]);}return _0x88515d[_0x88b6('0x52')](_0x2d11dd);}})[_0x88b6('0x29')](function(_0x209e2c){if(_0x209e2c){return _0x209e2c?{'count':_0x256cc4,'rows':_0x209e2c}:null;}})[_0x88b6('0x29')](respondWithResult(_0x8939a7,null))[_0x88b6('0x45')](handleError(_0x8939a7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f1fd641..eaffab1 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4ef43a,_0x493843){var _0x1ca40e=function(_0x5095ec){while(--_0x5095ec){_0x4ef43a['push'](_0x4ef43a['shift']());}};_0x1ca40e(++_0x493843);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1e1839,_0x4ac3c4){_0x1e1839=_0x1e1839-0x0;var _0x4b9a39=_0xd6d6[_0x1e1839];return _0x4b9a39;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./intDynamics365Configuration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x137045,_0x20ef30){var _0x107602=function(_0x2df02b){while(--_0x2df02b){_0x137045['push'](_0x137045['shift']());}};_0x107602(++_0x20ef30);}(_0x81bd,0x7c));var _0xd81b=function(_0x13fb4f,_0x42f6af){_0x13fb4f=_0x13fb4f-0x0;var _0x298a4e=_0x81bd[_0x13fb4f];return _0x298a4e;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e4f277f..03e7984 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 _0x74ad=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x74ad,0xb6));var _0xd74a=function(_0x25d5e9,_0x340fda){_0x25d5e9=_0x25d5e9-0x0;var _0xa351e2=_0x74ad[_0x25d5e9];return _0xa351e2;};'use strict';var _=require(_0xd74a('0x0'));var util=require(_0xd74a('0x1'));var moment=require(_0xd74a('0x2'));var BPromise=require(_0xd74a('0x3'));var rs=require(_0xd74a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd74a('0x5'))['db'];var utils=require(_0xd74a('0x6'));var logger=require('../../config/logger')(_0xd74a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd74a('0x8'));var client=jayson[_0xd74a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22cd87,_0x4ddf22,_0x242206){return new BPromise(function(_0x34bd0d,_0x1279d3){return client[_0xd74a('0xa')](_0x22cd87,_0x242206)['then'](function(_0x38714a){logger[_0xd74a('0xb')](_0xd74a('0xc'),_0x4ddf22,_0xd74a('0xd'));logger['debug'](_0xd74a('0xe'),_0x4ddf22,_0xd74a('0xd'),JSON[_0xd74a('0xf')](_0x38714a));if(_0x38714a[_0xd74a('0x10')]){if(_0x38714a['error'][_0xd74a('0x11')]===0x1f4){logger[_0xd74a('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ddf22,_0x38714a[_0xd74a('0x10')]['message']);return _0x1279d3(_0x38714a[_0xd74a('0x10')]['message']);}logger[_0xd74a('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ddf22,_0x38714a[_0xd74a('0x10')]['message']);return _0x34bd0d(_0x38714a[_0xd74a('0x10')][_0xd74a('0x12')]);}else{logger[_0xd74a('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ddf22,'request\x20sent');_0x34bd0d(_0x38714a[_0xd74a('0x13')][_0xd74a('0x12')]);}})['catch'](function(_0x450d33){logger[_0xd74a('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ddf22,_0x450d33);_0x1279d3(_0x450d33);});});} \ No newline at end of file +var _0x1f59=['code','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cc374,_0x21c582){var _0x306658=function(_0x3ff6e5){while(--_0x3ff6e5){_0x2cc374['push'](_0x2cc374['shift']());}};_0x306658(++_0x21c582);}(_0x1f59,0x10b));var _0x91f5=function(_0x11f3cb,_0x11fd9a){_0x11f3cb=_0x11f3cb-0x0;var _0x344a30=_0x1f59[_0x11f3cb];return _0x344a30;};'use strict';var _=require('lodash');var util=require(_0x91f5('0x0'));var moment=require(_0x91f5('0x1'));var BPromise=require(_0x91f5('0x2'));var rs=require(_0x91f5('0x3'));var fs=require('fs');var Redis=require(_0x91f5('0x4'));var db=require(_0x91f5('0x5'))['db'];var utils=require(_0x91f5('0x6'));var logger=require('../../config/logger')(_0x91f5('0x7'));var config=require(_0x91f5('0x8'));var jayson=require(_0x91f5('0x9'));var client=jayson[_0x91f5('0xa')][_0x91f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x83a0ab,_0x8b539d,_0x1776fa){return new BPromise(function(_0x4a34a7,_0x22c2b2){return client['request'](_0x83a0ab,_0x1776fa)[_0x91f5('0xc')](function(_0x3a121b){logger['info'](_0x91f5('0xd'),_0x8b539d,_0x91f5('0xe'));logger[_0x91f5('0xf')](_0x91f5('0x10'),_0x8b539d,'request\x20sent',JSON[_0x91f5('0x11')](_0x3a121b));if(_0x3a121b[_0x91f5('0x12')]){if(_0x3a121b[_0x91f5('0x12')][_0x91f5('0x13')]===0x1f4){logger[_0x91f5('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8b539d,_0x3a121b[_0x91f5('0x12')][_0x91f5('0x14')]);return _0x22c2b2(_0x3a121b[_0x91f5('0x12')][_0x91f5('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x8b539d,_0x3a121b['error']['message']);return _0x4a34a7(_0x3a121b['error']['message']);}else{logger[_0x91f5('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8b539d,_0x91f5('0xe'));_0x4a34a7(_0x3a121b['result']['message']);}})['catch'](function(_0x4743c6){logger[_0x91f5('0x12')](_0x91f5('0xd'),_0x8b539d,_0x4743c6);_0x22c2b2(_0x4743c6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e8a7de5..5ec38a4 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 _0xa208=['../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x45f324,_0x3bdd23){var _0xe06c88=function(_0xec2731){while(--_0xec2731){_0x45f324['push'](_0x45f324['shift']());}};_0xe06c88(++_0x3bdd23);}(_0xa208,0xf6));var _0x8a20=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa208[_0x424a9a];return _0xa7831c;};'use strict';var multer=require('multer');var util=require(_0x8a20('0x0'));var path=require(_0x8a20('0x1'));var timeout=require(_0x8a20('0x2'));var express=require(_0x8a20('0x3'));var router=express[_0x8a20('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8a20('0x5'));var config=require(_0x8a20('0x6'));var controller=require(_0x8a20('0x7'));router['get']('/',auth[_0x8a20('0x8')](),controller[_0x8a20('0x9')]);router[_0x8a20('0xa')]('/:id',auth[_0x8a20('0x8')](),controller['show']);router[_0x8a20('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a20('0xc')](_0x8a20('0xd'),auth[_0x8a20('0x8')](),controller[_0x8a20('0xe')]);router[_0x8a20('0xf')](_0x8a20('0xd'),auth[_0x8a20('0x8')](),controller[_0x8a20('0x10')]);module[_0x8a20('0x11')]=router; \ No newline at end of file +var _0xe4ef=['index','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x204c4e,_0xfe71c8){var _0x2a0623=function(_0x1e7c3e){while(--_0x1e7c3e){_0x204c4e['push'](_0x204c4e['shift']());}};_0x2a0623(++_0xfe71c8);}(_0xe4ef,0x71));var _0xfe4e=function(_0x560e15,_0x12d673){_0x560e15=_0x560e15-0x0;var _0x3f397b=_0xe4ef[_0x560e15];return _0x3f397b;};'use strict';var multer=require(_0xfe4e('0x0'));var util=require(_0xfe4e('0x1'));var path=require('path');var timeout=require(_0xfe4e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe4e('0x3'));var auth=require(_0xfe4e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfe4e('0x5'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xfe4e('0x6')](),controller[_0xfe4e('0x7')]);router['get'](_0xfe4e('0x8'),auth[_0xfe4e('0x6')](),controller[_0xfe4e('0x9')]);router['post']('/',auth[_0xfe4e('0x6')](),controller[_0xfe4e('0xa')]);router[_0xfe4e('0xb')](_0xfe4e('0x8'),auth[_0xfe4e('0x6')](),controller['update']);router[_0xfe4e('0xc')]('/:id',auth[_0xfe4e('0x6')](),controller[_0xfe4e('0xd')]);module[_0xfe4e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 322ccb0..bbae3d4 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 _0x9517=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x76254f,_0x433b27){var _0x323848=function(_0x2ae14c){while(--_0x2ae14c){_0x76254f['push'](_0x76254f['shift']());}};_0x323848(++_0x433b27);}(_0x9517,0x146));var _0x7951=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9517[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7951('0x0'));module[_0x7951('0x1')]={'type':{'type':Sequelize[_0x7951('0x2')](_0x7951('0x3'),_0x7951('0x4'),_0x7951('0x5'),_0x7951('0x6'),_0x7951('0x7')),'defaultValue':_0x7951('0x3')},'content':{'type':Sequelize[_0x7951('0x8')]},'key':{'type':Sequelize[_0x7951('0x8')]},'keyType':{'type':Sequelize[_0x7951('0x2')](_0x7951('0x3'),_0x7951('0x4'),_0x7951('0x5'))},'keyContent':{'type':Sequelize[_0x7951('0x8')]},'idField':{'type':Sequelize[_0x7951('0x8')]},'nameField':{'type':Sequelize[_0x7951('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7951('0x8')]}}; \ No newline at end of file +var _0x5eb5=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0xb4b671,_0x236e36){var _0x454639=function(_0x1bbdeb){while(--_0x1bbdeb){_0xb4b671['push'](_0xb4b671['shift']());}};_0x454639(++_0x236e36);}(_0x5eb5,0x176));var _0x55eb=function(_0x517064,_0x4d72e2){_0x517064=_0x517064-0x0;var _0x2f8c99=_0x5eb5[_0x517064];return _0x2f8c99;};'use strict';var Sequelize=require(_0x55eb('0x0'));module[_0x55eb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x55eb('0x2'),_0x55eb('0x3'),_0x55eb('0x4'),_0x55eb('0x5'),'picklist'),'defaultValue':_0x55eb('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x55eb('0x6')]},'keyType':{'type':Sequelize[_0x55eb('0x7')](_0x55eb('0x2'),_0x55eb('0x3'),_0x55eb('0x4'))},'keyContent':{'type':Sequelize[_0x55eb('0x6')]},'idField':{'type':Sequelize[_0x55eb('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x55eb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7a2be10..0208ced 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 _0xa92f=['update','then','error','name','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','keys','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0xeb26d1,_0x301de1){var _0x4a4e2e=function(_0xa3dad1){while(--_0xa3dad1){_0xeb26d1['push'](_0xeb26d1['shift']());}};_0x4a4e2e(++_0x301de1);}(_0xa92f,0x140));var _0xfa92=function(_0x58580e,_0x16b499){_0x58580e=_0x58580e-0x0;var _0x414a91=_0xa92f[_0x58580e];return _0x414a91;};'use strict';var emlformat=require(_0xfa92('0x0'));var rimraf=require(_0xfa92('0x1'));var zipdir=require(_0xfa92('0x2'));var jsonpatch=require(_0xfa92('0x3'));var rp=require(_0xfa92('0x4'));var moment=require('moment');var BPromise=require(_0xfa92('0x5'));var Mustache=require(_0xfa92('0x6'));var util=require(_0xfa92('0x7'));var path=require(_0xfa92('0x8'));var sox=require(_0xfa92('0x9'));var csv=require(_0xfa92('0xa'));var ejs=require(_0xfa92('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfa92('0xc'));var crypto=require(_0xfa92('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa92('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa92('0xf'));var Redis=require('ioredis');var authService=require(_0xfa92('0x10'));var qs=require(_0xfa92('0x11'));var as=require(_0xfa92('0x12'));var hardwareService=require(_0xfa92('0x13'));var logger=require(_0xfa92('0x14'))('api');var utils=require(_0xfa92('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfa92('0x16'));var db=require(_0xfa92('0x17'))['db'];function respondWithStatusCode(_0x46a52e,_0x2bcd71){_0x2bcd71=_0x2bcd71||0xcc;return function(_0x2b19bd){if(_0x2b19bd){return _0x46a52e[_0xfa92('0x18')](_0x2bcd71);}return _0x46a52e['status'](_0x2bcd71)[_0xfa92('0x19')]();};}function respondWithResult(_0x5cde98,_0x322817){_0x322817=_0x322817||0xc8;return function(_0x3f7bf6){if(_0x3f7bf6){return _0x5cde98[_0xfa92('0x1a')](_0x322817)['json'](_0x3f7bf6);}};}function respondWithFilteredResult(_0x17bb62,_0x15bd23){return function(_0x2b9ed5){if(_0x2b9ed5){var _0x240690=typeof _0x15bd23[_0xfa92('0x1b')]===_0xfa92('0x1c')&&typeof _0x15bd23[_0xfa92('0x1d')]===_0xfa92('0x1c');var _0x1bfc3d=_0x2b9ed5['count'];var _0x5d1aca=_0x240690?0x0:_0x15bd23[_0xfa92('0x1b')];var _0x42ffca=_0x240690?_0x2b9ed5[_0xfa92('0x1e')]:_0x15bd23[_0xfa92('0x1b')]+_0x15bd23[_0xfa92('0x1d')];var _0xb5c504;if(_0x42ffca>=_0x1bfc3d){_0x42ffca=_0x1bfc3d;_0xb5c504=0xc8;}else{_0xb5c504=0xce;}_0x17bb62[_0xfa92('0x1a')](_0xb5c504);return _0x17bb62[_0xfa92('0x1f')](_0xfa92('0x20'),_0x5d1aca+'-'+_0x42ffca+'/'+_0x1bfc3d)['json'](_0x2b9ed5);}return null;};}function patchUpdates(_0x1670ea){return function(_0x223a35){try{jsonpatch[_0xfa92('0x21')](_0x223a35,_0x1670ea,!![]);}catch(_0x486bae){return BPromise['reject'](_0x486bae);}return _0x223a35[_0xfa92('0x22')]();};}function saveUpdates(_0x5c822d,_0x436162){return function(_0x4ce3fd){if(_0x4ce3fd){return _0x4ce3fd[_0xfa92('0x23')](_0x5c822d)['then'](function(_0x1b5cc3){return _0x1b5cc3;});}return null;};}function removeEntity(_0x5e005b,_0x18500c){return function(_0x36830b){if(_0x36830b){return _0x36830b['destroy']()[_0xfa92('0x24')](function(){_0x5e005b[_0xfa92('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475fda,_0x22620a){return function(_0x5d026e){if(!_0x5d026e){_0x475fda[_0xfa92('0x18')](0x194);}return _0x5d026e;};}function handleError(_0x5e911c,_0x370319){_0x370319=_0x370319||0x1f4;return function(_0x5a96fb){logger[_0xfa92('0x25')](_0x5a96fb['stack']);if(_0x5a96fb[_0xfa92('0x26')]){delete _0x5a96fb[_0xfa92('0x26')];}_0x5e911c['status'](_0x370319)['send'](_0x5a96fb);};}exports[_0xfa92('0x27')]=function(_0x601e2d,_0x2d9526){var _0x570251={},_0x4eaf6b={},_0xaf7a25={'count':0x0,'rows':[]};var _0x5749a6=_[_0xfa92('0x28')](db[_0xfa92('0x29')][_0xfa92('0x2a')],function(_0x1aa222){return{'name':_0x1aa222[_0xfa92('0x2b')],'type':_0x1aa222['type'][_0xfa92('0x2c')]};});_0x4eaf6b[_0xfa92('0x2d')]=_[_0xfa92('0x28')](_0x5749a6,_0xfa92('0x26'));_0x4eaf6b['query']=_['keys'](_0x601e2d[_0xfa92('0x2e')]);_0x4eaf6b['filters']=_['intersection'](_0x4eaf6b[_0xfa92('0x2d')],_0x4eaf6b[_0xfa92('0x2e')]);_0x570251[_0xfa92('0x2f')]=_[_0xfa92('0x30')](_0x4eaf6b[_0xfa92('0x2d')],qs[_0xfa92('0x31')](_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x31')]));_0x570251[_0xfa92('0x2f')]=_0x570251[_0xfa92('0x2f')][_0xfa92('0x32')]?_0x570251[_0xfa92('0x2f')]:_0x4eaf6b['model'];if(!_0x601e2d[_0xfa92('0x2e')]['hasOwnProperty']('nolimit')){_0x570251[_0xfa92('0x1d')]=qs[_0xfa92('0x1d')](_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x1d')]);_0x570251[_0xfa92('0x1b')]=qs[_0xfa92('0x1b')](_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x1b')]);}_0x570251[_0xfa92('0x33')]=qs[_0xfa92('0x34')](_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x34')]);_0x570251[_0xfa92('0x35')]=qs[_0xfa92('0x36')](_[_0xfa92('0x37')](_0x601e2d[_0xfa92('0x2e')],_0x4eaf6b['filters']),_0x5749a6);if(_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x38')]){_0x570251[_0xfa92('0x35')]=_[_0xfa92('0x39')](_0x570251[_0xfa92('0x35')],{'$or':_['map'](_0x5749a6,function(_0x2df445){if(_0x2df445[_0xfa92('0x3a')]!=='VIRTUAL'){var _0x18ca20={};_0x18ca20[_0x2df445[_0xfa92('0x26')]]={'$like':'%'+_0x601e2d[_0xfa92('0x2e')]['filter']+'%'};return _0x18ca20;}})});}_0x570251=_[_0xfa92('0x39')]({},_0x570251,_0x601e2d[_0xfa92('0x3b')]);var _0x1e728c={'where':_0x570251[_0xfa92('0x35')]};return db[_0xfa92('0x29')][_0xfa92('0x1e')](_0x1e728c)['then'](function(_0x3ec4d5){_0xaf7a25[_0xfa92('0x1e')]=_0x3ec4d5;if(_0x601e2d[_0xfa92('0x2e')][_0xfa92('0x3c')]){_0x570251[_0xfa92('0x3d')]=[{'all':!![]}];}return db[_0xfa92('0x29')][_0xfa92('0x3e')](_0x570251);})[_0xfa92('0x24')](function(_0x4d9cbd){_0xaf7a25['rows']=_0x4d9cbd;return _0xaf7a25;})[_0xfa92('0x24')](respondWithFilteredResult(_0x2d9526,_0x570251))[_0xfa92('0x3f')](handleError(_0x2d9526,null));};exports[_0xfa92('0x40')]=function(_0x2542aa,_0x25d0bf){var _0x29cd35={'raw':!![],'where':{'id':_0x2542aa['params']['id']}},_0x52c669={};_0x52c669[_0xfa92('0x2d')]=_[_0xfa92('0x41')](db[_0xfa92('0x29')][_0xfa92('0x2a')]);_0x52c669[_0xfa92('0x2e')]=_[_0xfa92('0x41')](_0x2542aa['query']);_0x52c669['filters']=_['intersection'](_0x52c669[_0xfa92('0x2d')],_0x52c669['query']);_0x29cd35[_0xfa92('0x2f')]=_[_0xfa92('0x30')](_0x52c669[_0xfa92('0x2d')],qs[_0xfa92('0x31')](_0x2542aa['query'][_0xfa92('0x31')]));_0x29cd35[_0xfa92('0x2f')]=_0x29cd35[_0xfa92('0x2f')][_0xfa92('0x32')]?_0x29cd35[_0xfa92('0x2f')]:_0x52c669[_0xfa92('0x2d')];if(_0x2542aa['query'][_0xfa92('0x3c')]){_0x29cd35[_0xfa92('0x3d')]=[{'all':!![]}];}_0x29cd35=_['merge']({},_0x29cd35,_0x2542aa['options']);return db[_0xfa92('0x29')][_0xfa92('0x42')](_0x29cd35)[_0xfa92('0x24')](handleEntityNotFound(_0x25d0bf,null))[_0xfa92('0x24')](respondWithResult(_0x25d0bf,null))['catch'](handleError(_0x25d0bf,null));};exports[_0xfa92('0x43')]=function(_0x2d7d84,_0x20ee79){return db[_0xfa92('0x29')]['create'](_0x2d7d84[_0xfa92('0x44')],{})[_0xfa92('0x24')](respondWithResult(_0x20ee79,0xc9))[_0xfa92('0x3f')](handleError(_0x20ee79,null));};exports[_0xfa92('0x23')]=function(_0x484fac,_0x5c77aa){if(_0x484fac['body']['id']){delete _0x484fac[_0xfa92('0x44')]['id'];}return db['Dynamics365Field'][_0xfa92('0x42')]({'where':{'id':_0x484fac['params']['id']}})[_0xfa92('0x24')](handleEntityNotFound(_0x5c77aa,null))[_0xfa92('0x24')](saveUpdates(_0x484fac[_0xfa92('0x44')],null))[_0xfa92('0x24')](respondWithResult(_0x5c77aa,null))[_0xfa92('0x3f')](handleError(_0x5c77aa,null));};exports[_0xfa92('0x45')]=function(_0x4675a3,_0x44e03a){return db[_0xfa92('0x29')][_0xfa92('0x42')]({'where':{'id':_0x4675a3[_0xfa92('0x46')]['id']}})[_0xfa92('0x24')](handleEntityNotFound(_0x44e03a,null))[_0xfa92('0x24')](removeEntity(_0x44e03a,null))['catch'](handleError(_0x44e03a,null));}; \ No newline at end of file +var _0x2f3d=['save','update','then','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','Dynamics365Field','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f3d,0x73));var _0xd2f3=function(_0x27c556,_0x54ee19){_0x27c556=_0x27c556-0x0;var _0x2f79ff=_0x2f3d[_0x27c556];return _0x2f79ff;};'use strict';var emlformat=require(_0xd2f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2f3('0x1'));var jsonpatch=require(_0xd2f3('0x2'));var rp=require(_0xd2f3('0x3'));var moment=require('moment');var BPromise=require(_0xd2f3('0x4'));var Mustache=require('mustache');var util=require(_0xd2f3('0x5'));var path=require(_0xd2f3('0x6'));var sox=require('sox');var csv=require(_0xd2f3('0x7'));var ejs=require(_0xd2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xd2f3('0x9'));var _=require('lodash');var squel=require(_0xd2f3('0xa'));var crypto=require(_0xd2f3('0xb'));var jsforce=require(_0xd2f3('0xc'));var deskjs=require(_0xd2f3('0xd'));var toCsv=require(_0xd2f3('0x7'));var querystring=require(_0xd2f3('0xe'));var Papa=require(_0xd2f3('0xf'));var Redis=require(_0xd2f3('0x10'));var authService=require(_0xd2f3('0x11'));var qs=require(_0xd2f3('0x12'));var as=require(_0xd2f3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f3('0x14'))(_0xd2f3('0x15'));var utils=require(_0xd2f3('0x16'));var config=require(_0xd2f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2f3('0x18'))['db'];function respondWithStatusCode(_0x3c45a7,_0x4b493c){_0x4b493c=_0x4b493c||0xcc;return function(_0x90d9db){if(_0x90d9db){return _0x3c45a7[_0xd2f3('0x19')](_0x4b493c);}return _0x3c45a7[_0xd2f3('0x1a')](_0x4b493c)[_0xd2f3('0x1b')]();};}function respondWithResult(_0x2dcf24,_0x5ae160){_0x5ae160=_0x5ae160||0xc8;return function(_0x301edf){if(_0x301edf){return _0x2dcf24['status'](_0x5ae160)[_0xd2f3('0x1c')](_0x301edf);}};}function respondWithFilteredResult(_0x36c176,_0x26b1e4){return function(_0x4eff9c){if(_0x4eff9c){var _0x13dc12=typeof _0x26b1e4[_0xd2f3('0x1d')]===_0xd2f3('0x1e')&&typeof _0x26b1e4[_0xd2f3('0x1f')]==='undefined';var _0x3778b2=_0x4eff9c[_0xd2f3('0x20')];var _0x2ba894=_0x13dc12?0x0:_0x26b1e4[_0xd2f3('0x1d')];var _0x39c654=_0x13dc12?_0x4eff9c[_0xd2f3('0x20')]:_0x26b1e4[_0xd2f3('0x1d')]+_0x26b1e4['limit'];var _0x2bc6a4;if(_0x39c654>=_0x3778b2){_0x39c654=_0x3778b2;_0x2bc6a4=0xc8;}else{_0x2bc6a4=0xce;}_0x36c176[_0xd2f3('0x1a')](_0x2bc6a4);return _0x36c176[_0xd2f3('0x21')]('Content-Range',_0x2ba894+'-'+_0x39c654+'/'+_0x3778b2)[_0xd2f3('0x1c')](_0x4eff9c);}return null;};}function patchUpdates(_0x58948e){return function(_0x3c73c3){try{jsonpatch[_0xd2f3('0x22')](_0x3c73c3,_0x58948e,!![]);}catch(_0x36f5c3){return BPromise['reject'](_0x36f5c3);}return _0x3c73c3[_0xd2f3('0x23')]();};}function saveUpdates(_0x37b847,_0x4b9c60){return function(_0xf8e246){if(_0xf8e246){return _0xf8e246[_0xd2f3('0x24')](_0x37b847)[_0xd2f3('0x25')](function(_0xc76ee7){return _0xc76ee7;});}return null;};}function removeEntity(_0x509cd1,_0x38ddac){return function(_0x1d9d4e){if(_0x1d9d4e){return _0x1d9d4e['destroy']()[_0xd2f3('0x25')](function(){_0x509cd1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa62dc0,_0x585cf7){return function(_0x22e605){if(!_0x22e605){_0xa62dc0[_0xd2f3('0x19')](0x194);}return _0x22e605;};}function handleError(_0x1f44e0,_0x2a906b){_0x2a906b=_0x2a906b||0x1f4;return function(_0x5e817a){logger['error'](_0x5e817a['stack']);if(_0x5e817a[_0xd2f3('0x26')]){delete _0x5e817a[_0xd2f3('0x26')];}_0x1f44e0[_0xd2f3('0x1a')](_0x2a906b)[_0xd2f3('0x27')](_0x5e817a);};}exports['index']=function(_0x3a7ea9,_0x5debbe){var _0x2f7230={},_0x10b3f2={},_0x435466={'count':0x0,'rows':[]};var _0x3007c5=_[_0xd2f3('0x28')](db['Dynamics365Field'][_0xd2f3('0x29')],function(_0x338d65){return{'name':_0x338d65[_0xd2f3('0x2a')],'type':_0x338d65[_0xd2f3('0x2b')][_0xd2f3('0x2c')]};});_0x10b3f2[_0xd2f3('0x2d')]=_[_0xd2f3('0x28')](_0x3007c5,'name');_0x10b3f2[_0xd2f3('0x2e')]=_[_0xd2f3('0x2f')](_0x3a7ea9[_0xd2f3('0x2e')]);_0x10b3f2[_0xd2f3('0x30')]=_[_0xd2f3('0x31')](_0x10b3f2[_0xd2f3('0x2d')],_0x10b3f2['query']);_0x2f7230[_0xd2f3('0x32')]=_[_0xd2f3('0x31')](_0x10b3f2['model'],qs[_0xd2f3('0x33')](_0x3a7ea9['query'][_0xd2f3('0x33')]));_0x2f7230[_0xd2f3('0x32')]=_0x2f7230['attributes'][_0xd2f3('0x34')]?_0x2f7230[_0xd2f3('0x32')]:_0x10b3f2['model'];if(!_0x3a7ea9[_0xd2f3('0x2e')][_0xd2f3('0x35')](_0xd2f3('0x36'))){_0x2f7230[_0xd2f3('0x1f')]=qs['limit'](_0x3a7ea9[_0xd2f3('0x2e')][_0xd2f3('0x1f')]);_0x2f7230[_0xd2f3('0x1d')]=qs[_0xd2f3('0x1d')](_0x3a7ea9[_0xd2f3('0x2e')][_0xd2f3('0x1d')]);}_0x2f7230[_0xd2f3('0x37')]=qs[_0xd2f3('0x38')](_0x3a7ea9[_0xd2f3('0x2e')][_0xd2f3('0x38')]);_0x2f7230['where']=qs[_0xd2f3('0x30')](_[_0xd2f3('0x39')](_0x3a7ea9[_0xd2f3('0x2e')],_0x10b3f2[_0xd2f3('0x30')]),_0x3007c5);if(_0x3a7ea9[_0xd2f3('0x2e')][_0xd2f3('0x3a')]){_0x2f7230['where']=_[_0xd2f3('0x3b')](_0x2f7230['where'],{'$or':_['map'](_0x3007c5,function(_0x5e09ba){if(_0x5e09ba['type']!==_0xd2f3('0x3c')){var _0x588e07={};_0x588e07[_0x5e09ba['name']]={'$like':'%'+_0x3a7ea9[_0xd2f3('0x2e')]['filter']+'%'};return _0x588e07;}})});}_0x2f7230=_['merge']({},_0x2f7230,_0x3a7ea9[_0xd2f3('0x3d')]);var _0x6acb39={'where':_0x2f7230[_0xd2f3('0x3e')]};return db[_0xd2f3('0x3f')][_0xd2f3('0x20')](_0x6acb39)['then'](function(_0x2ca870){_0x435466[_0xd2f3('0x20')]=_0x2ca870;if(_0x3a7ea9[_0xd2f3('0x2e')]['includeAll']){_0x2f7230[_0xd2f3('0x40')]=[{'all':!![]}];}return db[_0xd2f3('0x3f')][_0xd2f3('0x41')](_0x2f7230);})[_0xd2f3('0x25')](function(_0x4aaeca){_0x435466[_0xd2f3('0x42')]=_0x4aaeca;return _0x435466;})[_0xd2f3('0x25')](respondWithFilteredResult(_0x5debbe,_0x2f7230))[_0xd2f3('0x43')](handleError(_0x5debbe,null));};exports[_0xd2f3('0x44')]=function(_0x23b3ac,_0x28ef9e){var _0x26fc4c={'raw':!![],'where':{'id':_0x23b3ac[_0xd2f3('0x45')]['id']}},_0x15e1ae={};_0x15e1ae[_0xd2f3('0x2d')]=_[_0xd2f3('0x2f')](db[_0xd2f3('0x3f')]['rawAttributes']);_0x15e1ae['query']=_[_0xd2f3('0x2f')](_0x23b3ac['query']);_0x15e1ae[_0xd2f3('0x30')]=_[_0xd2f3('0x31')](_0x15e1ae[_0xd2f3('0x2d')],_0x15e1ae[_0xd2f3('0x2e')]);_0x26fc4c[_0xd2f3('0x32')]=_[_0xd2f3('0x31')](_0x15e1ae[_0xd2f3('0x2d')],qs[_0xd2f3('0x33')](_0x23b3ac[_0xd2f3('0x2e')]['fields']));_0x26fc4c[_0xd2f3('0x32')]=_0x26fc4c[_0xd2f3('0x32')][_0xd2f3('0x34')]?_0x26fc4c[_0xd2f3('0x32')]:_0x15e1ae[_0xd2f3('0x2d')];if(_0x23b3ac['query'][_0xd2f3('0x46')]){_0x26fc4c['include']=[{'all':!![]}];}_0x26fc4c=_[_0xd2f3('0x3b')]({},_0x26fc4c,_0x23b3ac[_0xd2f3('0x3d')]);return db[_0xd2f3('0x3f')]['find'](_0x26fc4c)[_0xd2f3('0x25')](handleEntityNotFound(_0x28ef9e,null))[_0xd2f3('0x25')](respondWithResult(_0x28ef9e,null))[_0xd2f3('0x43')](handleError(_0x28ef9e,null));};exports['create']=function(_0x2ba19d,_0x5cbd2a){return db['Dynamics365Field'][_0xd2f3('0x47')](_0x2ba19d[_0xd2f3('0x48')],{})[_0xd2f3('0x25')](respondWithResult(_0x5cbd2a,0xc9))[_0xd2f3('0x43')](handleError(_0x5cbd2a,null));};exports[_0xd2f3('0x24')]=function(_0x40d229,_0x157bbb){if(_0x40d229['body']['id']){delete _0x40d229[_0xd2f3('0x48')]['id'];}return db[_0xd2f3('0x3f')][_0xd2f3('0x49')]({'where':{'id':_0x40d229[_0xd2f3('0x45')]['id']}})[_0xd2f3('0x25')](handleEntityNotFound(_0x157bbb,null))[_0xd2f3('0x25')](saveUpdates(_0x40d229[_0xd2f3('0x48')],null))['then'](respondWithResult(_0x157bbb,null))[_0xd2f3('0x43')](handleError(_0x157bbb,null));};exports[_0xd2f3('0x4a')]=function(_0x341b2d,_0x4759aa){return db[_0xd2f3('0x3f')]['find']({'where':{'id':_0x341b2d[_0xd2f3('0x45')]['id']}})[_0xd2f3('0x25')](handleEntityNotFound(_0x4759aa,null))[_0xd2f3('0x25')](removeEntity(_0x4759aa,null))[_0xd2f3('0x43')](handleError(_0x4759aa,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 87de397..bad1025 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 _0x1e34=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','FieldId'];(function(_0x491910,_0x3756ef){var _0x5593d6=function(_0x3cf3b4){while(--_0x3cf3b4){_0x491910['push'](_0x491910['shift']());}};_0x5593d6(++_0x3756ef);}(_0x1e34,0x138));var _0x41e3=function(_0x316190,_0x92c814){_0x316190=_0x316190-0x0;var _0x1d1401=_0x1e34[_0x316190];return _0x1d1401;};'use strict';var _=require(_0x41e3('0x0'));var util=require('util');var logger=require(_0x41e3('0x1'))(_0x41e3('0x2'));var moment=require(_0x41e3('0x3'));var BPromise=require(_0x41e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e3('0x5'));var rimraf=require(_0x41e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x41e3('0x7'));module[_0x41e3('0x8')]=function(_0x6269c9,_0x5b4871){return _0x6269c9['define']('Dynamics365Field',attributes,{'tableName':_0x41e3('0x9'),'paranoid':![],'indexes':[{'name':_0x41e3('0xa'),'fields':['idField',_0x41e3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b26=['rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','path'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x3b26,0x18e));var _0x63b2=function(_0x124ec9,_0x4d74ee){_0x124ec9=_0x124ec9-0x0;var _0x1e93bc=_0x3b26[_0x124ec9];return _0x1e93bc;};'use strict';var _=require('lodash');var util=require(_0x63b2('0x0'));var logger=require(_0x63b2('0x1'))('api');var moment=require(_0x63b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x63b2('0x3'));var fs=require('fs');var path=require(_0x63b2('0x4'));var rimraf=require(_0x63b2('0x5'));var config=require('../../config/environment');var attributes=require(_0x63b2('0x6'));module['exports']=function(_0x1be3f1,_0xc80c1a){return _0x1be3f1[_0x63b2('0x7')](_0x63b2('0x8'),attributes,{'tableName':_0x63b2('0x9'),'paranoid':![],'indexes':[{'name':_0x63b2('0xa'),'fields':[_0x63b2('0xb'),_0x63b2('0xc')],'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 6baa29c..521b4b3 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 _0x1f59=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5f41f5,_0x52a50e){var _0x26bf5f=function(_0x21ccb3){while(--_0x21ccb3){_0x5f41f5['push'](_0x5f41f5['shift']());}};_0x26bf5f(++_0x52a50e);}(_0x1f59,0x19a));var _0x91f5=function(_0x297802,_0xb8d908){_0x297802=_0x297802-0x0;var _0x529b99=_0x1f59[_0x297802];return _0x529b99;};'use strict';var _=require(_0x91f5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x91f5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91f5('0x2'));var db=require(_0x91f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x91f5('0x4'))(_0x91f5('0x5'));var config=require(_0x91f5('0x6'));var jayson=require(_0x91f5('0x7'));var client=jayson[_0x91f5('0x8')][_0x91f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c9763,_0x395c0a,_0x4e8c8b){return new BPromise(function(_0x5ab6db,_0xce521){return client[_0x91f5('0xa')](_0x4c9763,_0x4e8c8b)[_0x91f5('0xb')](function(_0x11087f){logger[_0x91f5('0xc')](_0x91f5('0xd'),_0x395c0a,_0x91f5('0xe'));logger[_0x91f5('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x395c0a,_0x91f5('0xe'),JSON['stringify'](_0x11087f));if(_0x11087f[_0x91f5('0x10')]){if(_0x11087f[_0x91f5('0x10')]['code']===0x1f4){logger[_0x91f5('0x10')](_0x91f5('0xd'),_0x395c0a,_0x11087f[_0x91f5('0x10')][_0x91f5('0x11')]);return _0xce521(_0x11087f[_0x91f5('0x10')][_0x91f5('0x11')]);}logger[_0x91f5('0x10')](_0x91f5('0xd'),_0x395c0a,_0x11087f[_0x91f5('0x10')][_0x91f5('0x11')]);return _0x5ab6db(_0x11087f[_0x91f5('0x10')][_0x91f5('0x11')]);}else{logger[_0x91f5('0xc')](_0x91f5('0xd'),_0x395c0a,'request\x20sent');_0x5ab6db(_0x11087f['result'][_0x91f5('0x11')]);}})[_0x91f5('0x12')](function(_0x1eae5e){logger[_0x91f5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x395c0a,_0x1eae5e);_0xce521(_0x1eae5e);});});} \ No newline at end of file +var _0x7e9b=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Dynamics365Field,\x20%s,\x20%s'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7e9b,0x1ec));var _0xb7e9=function(_0x307a6b,_0x457f52){_0x307a6b=_0x307a6b-0x0;var _0x285daa=_0x7e9b[_0x307a6b];return _0x285daa;};'use strict';var _=require(_0xb7e9('0x0'));var util=require(_0xb7e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7e9('0x2'));var fs=require('fs');var Redis=require(_0xb7e9('0x3'));var db=require(_0xb7e9('0x4'))['db'];var utils=require(_0xb7e9('0x5'));var logger=require(_0xb7e9('0x6'))(_0xb7e9('0x7'));var config=require('../../config/environment');var jayson=require(_0xb7e9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cddd1,_0x4f6aef,_0x5f2843){return new BPromise(function(_0x10fa6d,_0x3de92c){return client[_0xb7e9('0x9')](_0x5cddd1,_0x5f2843)[_0xb7e9('0xa')](function(_0x295fec){logger['info'](_0xb7e9('0xb'),_0x4f6aef,_0xb7e9('0xc'));logger[_0xb7e9('0xd')](_0xb7e9('0xe'),_0x4f6aef,_0xb7e9('0xc'),JSON[_0xb7e9('0xf')](_0x295fec));if(_0x295fec[_0xb7e9('0x10')]){if(_0x295fec['error'][_0xb7e9('0x11')]===0x1f4){logger[_0xb7e9('0x10')](_0xb7e9('0xb'),_0x4f6aef,_0x295fec['error'][_0xb7e9('0x12')]);return _0x3de92c(_0x295fec[_0xb7e9('0x10')][_0xb7e9('0x12')]);}logger[_0xb7e9('0x10')](_0xb7e9('0xb'),_0x4f6aef,_0x295fec['error']['message']);return _0x10fa6d(_0x295fec['error']['message']);}else{logger[_0xb7e9('0x13')](_0xb7e9('0xb'),_0x4f6aef,_0xb7e9('0xc'));_0x10fa6d(_0x295fec[_0xb7e9('0x14')][_0xb7e9('0x12')]);}})['catch'](function(_0x2ad6c9){logger[_0xb7e9('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4f6aef,_0x2ad6c9);_0x3de92c(_0x2ad6c9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b10b5c7..27c7c84 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 _0x06b7=['put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','addConfiguration'];(function(_0x3e50c2,_0x22e564){var _0x5b49d0=function(_0x1bd8e3){while(--_0x1bd8e3){_0x3e50c2['push'](_0x3e50c2['shift']());}};_0x5b49d0(++_0x22e564);}(_0x06b7,0x180));var _0x706b=function(_0x5943f2,_0x215a15){_0x5943f2=_0x5943f2-0x0;var _0x117091=_0x06b7[_0x5943f2];return _0x117091;};'use strict';var multer=require(_0x706b('0x0'));var util=require(_0x706b('0x1'));var path=require(_0x706b('0x2'));var timeout=require('connect-timeout');var express=require(_0x706b('0x3'));var router=express[_0x706b('0x4')]();var fs_extra=require(_0x706b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x706b('0x6'));var config=require(_0x706b('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x706b('0x8')]('/',auth[_0x706b('0x9')](),controller[_0x706b('0xa')]);router[_0x706b('0x8')](_0x706b('0xb'),auth['isAuthenticated'](),controller[_0x706b('0xc')]);router[_0x706b('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x706b('0x8')]('/:id/fields',auth[_0x706b('0x9')](),controller['getFields']);router[_0x706b('0xd')]('/',auth[_0x706b('0x9')](),controller[_0x706b('0xe')]);router[_0x706b('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x706b('0xf')]);router[_0x706b('0x10')](_0x706b('0xb'),auth[_0x706b('0x9')](),controller[_0x706b('0x11')]);router[_0x706b('0x12')]('/:id',auth[_0x706b('0x9')](),controller['destroy']);module[_0x706b('0x13')]=router; \ No newline at end of file +var _0xa357=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa357,0xd8));var _0x7a35=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xa357[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0x7a35('0x0'));var util=require('util');var path=require(_0x7a35('0x1'));var timeout=require(_0x7a35('0x2'));var express=require('express');var router=express[_0x7a35('0x3')]();var fs_extra=require(_0x7a35('0x4'));var auth=require(_0x7a35('0x5'));var interaction=require(_0x7a35('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x7a35('0x7')]('/',auth[_0x7a35('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a35('0x7')](_0x7a35('0x9'),auth[_0x7a35('0x8')](),controller['getConfigurations']);router[_0x7a35('0x7')](_0x7a35('0xa'),auth[_0x7a35('0x8')](),controller[_0x7a35('0xb')]);router[_0x7a35('0xc')]('/',auth[_0x7a35('0x8')](),controller[_0x7a35('0xd')]);router[_0x7a35('0xc')]('/:id/configurations',auth[_0x7a35('0x8')](),controller['addConfiguration']);router[_0x7a35('0xe')](_0x7a35('0xf'),auth[_0x7a35('0x8')](),controller[_0x7a35('0x10')]);router[_0x7a35('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7a35('0x12')]);module[_0x7a35('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 87c80d7..7abc6ee 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 _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x3710d4,_0x4f7702){var _0x3abd13=function(_0x1b43ec){while(--_0x1b43ec){_0x3710d4['push'](_0x3710d4['shift']());}};_0x3abd13(++_0x4f7702);}(_0x4bd3,0x174));var _0x34bd=function(_0x37bf9e,_0xd2cae8){_0x37bf9e=_0x37bf9e-0x0;var _0x11dbff=_0x4bd3[_0x37bf9e];return _0x11dbff;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa456=['STRING','username','sequelize','exports'];(function(_0x50da16,_0x3d0f37){var _0x31c278=function(_0x318e6b){while(--_0x318e6b){_0x50da16['push'](_0x50da16['shift']());}};_0x31c278(++_0x3d0f37);}(_0xa456,0x142));var _0x6a45=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa456[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('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 e7c16d5..5e5ba88 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 _0x4746=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','keys','FreshdeskConfiguration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshdeskField','getFields','apiKey','remoteUri','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1c5ac6,_0x512bc7){var _0x2106d7=function(_0x42f087){while(--_0x42f087){_0x1c5ac6['push'](_0x1c5ac6['shift']());}};_0x2106d7(++_0x512bc7);}(_0x4746,0xc6));var _0x6474=function(_0x14e5cd,_0x3d95ef){_0x14e5cd=_0x14e5cd-0x0;var _0x5c1094=_0x4746[_0x14e5cd];return _0x5c1094;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4936c2,_0x5cf0de){_0x5cf0de=_0x5cf0de||0xcc;return function(_0x23c805){if(_0x23c805){return _0x4936c2[_0x6474('0x16')](_0x5cf0de);}return _0x4936c2[_0x6474('0x17')](_0x5cf0de)[_0x6474('0x18')]();};}function respondWithResult(_0x113aba,_0x37fe08){_0x37fe08=_0x37fe08||0xc8;return function(_0x407149){if(_0x407149){return _0x113aba[_0x6474('0x17')](_0x37fe08)[_0x6474('0x19')](_0x407149);}};}function respondWithFilteredResult(_0x5cf8fa,_0x5ee279){return function(_0x583afa){if(_0x583afa){var _0x205df7=typeof _0x5ee279[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5ee279[_0x6474('0x1c')]===_0x6474('0x1b');var _0x502755=_0x583afa[_0x6474('0x1d')];var _0x7585ed=_0x205df7?0x0:_0x5ee279[_0x6474('0x1a')];var _0xc3448d=_0x205df7?_0x583afa[_0x6474('0x1d')]:_0x5ee279[_0x6474('0x1a')]+_0x5ee279[_0x6474('0x1c')];var _0x47029c;if(_0xc3448d>=_0x502755){_0xc3448d=_0x502755;_0x47029c=0xc8;}else{_0x47029c=0xce;}_0x5cf8fa['status'](_0x47029c);return _0x5cf8fa[_0x6474('0x1e')]('Content-Range',_0x7585ed+'-'+_0xc3448d+'/'+_0x502755)[_0x6474('0x19')](_0x583afa);}return null;};}function patchUpdates(_0x1df53c){return function(_0x2be8fe){try{jsonpatch[_0x6474('0x1f')](_0x2be8fe,_0x1df53c,!![]);}catch(_0x271b12){return BPromise[_0x6474('0x20')](_0x271b12);}return _0x2be8fe[_0x6474('0x21')]();};}function saveUpdates(_0x5d0e5c,_0xf3cd65){return function(_0x5f44f1){if(_0x5f44f1){return _0x5f44f1[_0x6474('0x22')](_0x5d0e5c)['then'](function(_0x4ba645){return _0x4ba645;});}return null;};}function removeEntity(_0x58e024,_0xb67896){return function(_0x340fb6){if(_0x340fb6){return _0x340fb6[_0x6474('0x23')]()[_0x6474('0x24')](function(){_0x58e024[_0x6474('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7020fb,_0x388d2d){return function(_0x46bf4f){if(!_0x46bf4f){_0x7020fb[_0x6474('0x16')](0x194);}return _0x46bf4f;};}function handleError(_0x559b33,_0x587b7a){_0x587b7a=_0x587b7a||0x1f4;return function(_0x38a5a4){logger[_0x6474('0x25')](_0x38a5a4[_0x6474('0x26')]);if(_0x38a5a4[_0x6474('0x27')]){delete _0x38a5a4['name'];}_0x559b33['status'](_0x587b7a)['send'](_0x38a5a4);};}exports['index']=function(_0x3333a8,_0x28d445){var _0x1751bc={},_0x2387e9={},_0x52e64b={'count':0x0,'rows':[]};var _0x13af68=_[_0x6474('0x28')](db[_0x6474('0x29')][_0x6474('0x2a')],function(_0x2a3ad0){return{'name':_0x2a3ad0[_0x6474('0x2b')],'type':_0x2a3ad0[_0x6474('0x2c')]['key']};});_0x2387e9[_0x6474('0x2d')]=_[_0x6474('0x28')](_0x13af68,_0x6474('0x27'));_0x2387e9[_0x6474('0x2e')]=_['keys'](_0x3333a8['query']);_0x2387e9['filters']=_[_0x6474('0x2f')](_0x2387e9[_0x6474('0x2d')],_0x2387e9[_0x6474('0x2e')]);_0x1751bc['attributes']=_[_0x6474('0x2f')](_0x2387e9[_0x6474('0x2d')],qs[_0x6474('0x30')](_0x3333a8['query'][_0x6474('0x30')]));_0x1751bc[_0x6474('0x31')]=_0x1751bc[_0x6474('0x31')]['length']?_0x1751bc[_0x6474('0x31')]:_0x2387e9[_0x6474('0x2d')];if(!_0x3333a8['query'][_0x6474('0x32')](_0x6474('0x33'))){_0x1751bc[_0x6474('0x1c')]=qs[_0x6474('0x1c')](_0x3333a8[_0x6474('0x2e')]['limit']);_0x1751bc[_0x6474('0x1a')]=qs[_0x6474('0x1a')](_0x3333a8['query']['offset']);}_0x1751bc[_0x6474('0x34')]=qs['sort'](_0x3333a8[_0x6474('0x2e')][_0x6474('0x35')]);_0x1751bc[_0x6474('0x36')]=qs[_0x6474('0x37')](_[_0x6474('0x38')](_0x3333a8['query'],_0x2387e9['filters']),_0x13af68);if(_0x3333a8[_0x6474('0x2e')][_0x6474('0x39')]){_0x1751bc[_0x6474('0x36')]=_['merge'](_0x1751bc[_0x6474('0x36')],{'$or':_['map'](_0x13af68,function(_0xf5f16f){if(_0xf5f16f['type']!=='VIRTUAL'){var _0x53be2e={};_0x53be2e[_0xf5f16f[_0x6474('0x27')]]={'$like':'%'+_0x3333a8[_0x6474('0x2e')][_0x6474('0x39')]+'%'};return _0x53be2e;}})});}_0x1751bc=_[_0x6474('0x3a')]({},_0x1751bc,_0x3333a8[_0x6474('0x3b')]);var _0x29bb36={'where':_0x1751bc['where']};return db[_0x6474('0x29')][_0x6474('0x1d')](_0x29bb36)['then'](function(_0xca2394){_0x52e64b[_0x6474('0x1d')]=_0xca2394;if(_0x3333a8[_0x6474('0x2e')]['includeAll']){_0x1751bc[_0x6474('0x3c')]=[{'all':!![]}];}return db[_0x6474('0x29')][_0x6474('0x3d')](_0x1751bc);})['then'](function(_0x5c1153){_0x52e64b[_0x6474('0x3e')]=_0x5c1153;return _0x52e64b;})[_0x6474('0x24')](respondWithFilteredResult(_0x28d445,_0x1751bc))['catch'](handleError(_0x28d445,null));};exports[_0x6474('0x3f')]=function(_0x44ed73,_0x9bdba5){var _0x1a4bde={'raw':![],'where':{'id':_0x44ed73['params']['id']}},_0x49590d={};_0x49590d[_0x6474('0x2d')]=_['keys'](db[_0x6474('0x29')][_0x6474('0x2a')]);_0x49590d[_0x6474('0x2e')]=_['keys'](_0x44ed73[_0x6474('0x2e')]);_0x49590d[_0x6474('0x37')]=_['intersection'](_0x49590d[_0x6474('0x2d')],_0x49590d[_0x6474('0x2e')]);_0x1a4bde[_0x6474('0x31')]=_[_0x6474('0x2f')](_0x49590d[_0x6474('0x2d')],qs[_0x6474('0x30')](_0x44ed73[_0x6474('0x2e')]['fields']));_0x1a4bde[_0x6474('0x31')]=_0x1a4bde[_0x6474('0x31')]['length']?_0x1a4bde[_0x6474('0x31')]:_0x49590d[_0x6474('0x2d')];if(_0x44ed73['query']['includeAll']){_0x1a4bde['include']=[{'all':!![]}];}_0x1a4bde=_['merge']({},_0x1a4bde,_0x44ed73[_0x6474('0x3b')]);return db[_0x6474('0x29')][_0x6474('0x40')](_0x1a4bde)[_0x6474('0x24')](handleEntityNotFound(_0x9bdba5,null))['then'](respondWithResult(_0x9bdba5,null))[_0x6474('0x41')](handleError(_0x9bdba5,null));};exports[_0x6474('0x42')]=function(_0x1c411e,_0x29ffac){return db[_0x6474('0x29')][_0x6474('0x42')](_0x1c411e['body'],{})[_0x6474('0x24')](respondWithResult(_0x29ffac,0xc9))[_0x6474('0x41')](handleError(_0x29ffac,null));};exports[_0x6474('0x22')]=function(_0x495666,_0x2d83e5){if(_0x495666[_0x6474('0x43')]['id']){delete _0x495666['body']['id'];}return db[_0x6474('0x29')][_0x6474('0x40')]({'where':{'id':_0x495666[_0x6474('0x44')]['id']}})[_0x6474('0x24')](handleEntityNotFound(_0x2d83e5,null))[_0x6474('0x24')](saveUpdates(_0x495666[_0x6474('0x43')],null))[_0x6474('0x24')](respondWithResult(_0x2d83e5,null))['catch'](handleError(_0x2d83e5,null));};exports[_0x6474('0x23')]=function(_0x3697a0,_0x231a02){return db['FreshdeskAccount'][_0x6474('0x40')]({'where':{'id':_0x3697a0[_0x6474('0x44')]['id']}})[_0x6474('0x24')](handleEntityNotFound(_0x231a02,null))['then'](removeEntity(_0x231a02,null))['catch'](handleError(_0x231a02,null));};exports[_0x6474('0x45')]=function(_0x3cc8ad,_0x4ce208,_0x5a4335){var _0xed51b5={};var _0x4e1e3b={};var _0x9b3bc0;var _0x409e55;return db[_0x6474('0x29')][_0x6474('0x46')]({'where':{'id':_0x3cc8ad[_0x6474('0x44')]['id']}})[_0x6474('0x24')](handleEntityNotFound(_0x4ce208,null))[_0x6474('0x24')](function(_0x451080){if(_0x451080){_0x9b3bc0=_0x451080;_0x4e1e3b[_0x6474('0x2d')]=_[_0x6474('0x47')](db[_0x6474('0x48')][_0x6474('0x2a')]);_0x4e1e3b[_0x6474('0x2e')]=_['keys'](_0x3cc8ad[_0x6474('0x2e')]);_0x4e1e3b['filters']=_['intersection'](_0x4e1e3b[_0x6474('0x2d')],_0x4e1e3b[_0x6474('0x2e')]);_0xed51b5[_0x6474('0x31')]=_[_0x6474('0x2f')](_0x4e1e3b['model'],qs[_0x6474('0x30')](_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x30')]));_0xed51b5[_0x6474('0x31')]=_0xed51b5[_0x6474('0x31')][_0x6474('0x49')]?_0xed51b5[_0x6474('0x31')]:_0x4e1e3b[_0x6474('0x2d')];_0xed51b5[_0x6474('0x34')]=qs[_0x6474('0x35')](_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x35')]);_0xed51b5['where']=qs['filters'](_[_0x6474('0x38')](_0x3cc8ad[_0x6474('0x2e')],_0x4e1e3b[_0x6474('0x37')]));if(_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x39')]){_0xed51b5[_0x6474('0x36')]=_[_0x6474('0x3a')](_0xed51b5['where'],{'$or':_['map'](_0xed51b5[_0x6474('0x31')],function(_0x242870){var _0x2db5d7={};_0x2db5d7[_0x242870]={'$like':'%'+_0x3cc8ad['query'][_0x6474('0x39')]+'%'};return _0x2db5d7;})});}_0xed51b5=_[_0x6474('0x3a')]({},_0xed51b5,_0x3cc8ad['options']);return _0x9b3bc0[_0x6474('0x45')](_0xed51b5);}})['then'](function(_0x152459){if(_0x152459){_0x409e55=_0x152459[_0x6474('0x49')];if(!_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x32')]('nolimit')){_0xed51b5[_0x6474('0x1c')]=qs[_0x6474('0x1c')](_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x1c')]);_0xed51b5[_0x6474('0x1a')]=qs[_0x6474('0x1a')](_0x3cc8ad[_0x6474('0x2e')][_0x6474('0x1a')]);}return _0x9b3bc0[_0x6474('0x45')](_0xed51b5);}})[_0x6474('0x24')](function(_0x4a1560){if(_0x4a1560){return _0x4a1560?{'count':_0x409e55,'rows':_0x4a1560}:null;}})[_0x6474('0x24')](respondWithResult(_0x4ce208,null))['catch'](handleError(_0x4ce208,null));};exports[_0x6474('0x4a')]=function(_0x40182c,_0x273854,_0x3d8139){if(_0x40182c[_0x6474('0x43')]['id']){delete _0x40182c[_0x6474('0x43')]['id'];}return db[_0x6474('0x29')][_0x6474('0x46')]({'where':{'id':_0x40182c['params']['id']}})[_0x6474('0x24')](handleEntityNotFound(_0x273854,null))['then'](function(_0x173ad6){if(_0x173ad6){_0x40182c[_0x6474('0x43')][_0x6474('0x4b')]=_0x173ad6['id'];_0x40182c['body']['Subjects']=integrations[_0x6474('0x4c')](_0x40182c[_0x6474('0x43')][_0x6474('0x4d')],_0x40182c['body'][_0x6474('0x2c')]);_0x40182c['body'][_0x6474('0x4e')]=integrations['getDescriptions'](_0x40182c['body']['channel'],_0x40182c[_0x6474('0x43')][_0x6474('0x2c')]);return db[_0x6474('0x48')][_0x6474('0x42')](_0x40182c['body'],{'include':[{'model':db[_0x6474('0x4f')],'as':'Subjects'},{'model':db[_0x6474('0x4f')],'as':_0x6474('0x4e')}]});}return null;})['then'](respondWithResult(_0x273854,null))['catch'](handleError(_0x273854,null));};exports[_0x6474('0x50')]=function(_0x30f9fe,_0x26ab00,_0x9f1ec0){var _0x58a86c='';return db['FreshdeskAccount'][_0x6474('0x46')]({'where':{'id':_0x30f9fe[_0x6474('0x44')]['id']},'attributes':['id','remoteUri',_0x6474('0x51')]})[_0x6474('0x24')](handleEntityNotFound(_0x26ab00,null))[_0x6474('0x24')](function(_0x2a49f8){if(_0x2a49f8){_0x58a86c=_0x2a49f8[_0x6474('0x52')];var _0x4fa53b=_0x58a86c['slice'](-0x1);if(_0x4fa53b==='/'){_0x58a86c=_0x58a86c[_0x6474('0x53')](0x0,_0x58a86c[_0x6474('0x54')](_0x4fa53b));}return rp({'method':'GET','uri':util['format'](_0x6474('0x55'),_0x58a86c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x6474('0x56')](_0x6474('0x57'),new Buffer(util[_0x6474('0x56')](_0x6474('0x58'),_0x2a49f8[_0x6474('0x51')]))[_0x6474('0x59')]('base64'))},'json':!![]});}})[_0x6474('0x24')](function(_0xc4fc20){if(_0xc4fc20){var _0x1e2746=[_0x6474('0x5a'),_0x6474('0x5b'),_0x6474('0x5c'),_0x6474('0x5d'),_0x6474('0x17'),_0x6474('0x5e'),'group',_0x6474('0x5f'),_0x6474('0x60'),'group',_0x6474('0x61')];_[_0x6474('0x62')](_0xc4fc20,function(_0x268cee){return _0x1e2746[_0x6474('0x63')](_0x268cee[_0x6474('0x27')])||!_0x268cee[_0x6474('0x64')]&&_0x268cee[_0x6474('0x2c')]!==_0x6474('0x65')&&_0x268cee[_0x6474('0x2c')]!==_0x6474('0x66');});return{'count':_0xc4fc20[_0x6474('0x49')],'rows':_[_0x6474('0x28')](_0xc4fc20,function(_0x361fa4){return{'id':_0x361fa4[_0x6474('0x27')],'name':_0x361fa4[_0x6474('0x67')],'custom':!_0x361fa4[_0x6474('0x64')],'options':_0x361fa4[_0x6474('0x68')]?_[_0x6474('0x28')](_0x361fa4[_0x6474('0x68')],function(_0x22e676){return{'name':_['capitalize'](_0x22e676),'value':_0x22e676};}):[]};})};}})[_0x6474('0x24')](respondWithResult(_0x26ab00,null))[_0x6474('0x41')](function(_0x20cd4e){var _0x2bca17=_0x30f9fe[_0x6474('0x2e')][_0x6474('0x69')]?0x1f4:_0x20cd4e['statusCode']||0x1f4;logger['error'](_0x6474('0x6a'),_0x6474('0x50'),_0x2bca17,JSON[_0x6474('0x6b')](_0x20cd4e));delete _0x20cd4e['name'];if(_0x2bca17===0x191){_0x2bca17=0x190;}_0x26ab00[_0x6474('0x17')](_0x2bca17)[_0x6474('0x6c')](_0x30f9fe['query']['test']?{'message':_0x6474('0x6d'),'statusCode':_0x20cd4e['statusCode']}:_0x20cd4e);});}; \ No newline at end of file +var _0xf151=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','includeAll','include','rows','catch','show','params','length','options','find','create','FreshdeskAccount','body','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','description','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields','stringify','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2c64e7,_0x322872){var _0x416fdf=function(_0x5f5b70){while(--_0x5f5b70){_0x2c64e7['push'](_0x2c64e7['shift']());}};_0x416fdf(++_0x322872);}(_0xf151,0xab));var _0x1f15=function(_0x42ea8d,_0x1d9d6b){_0x42ea8d=_0x42ea8d-0x0;var _0x3719b6=_0xf151[_0x42ea8d];return _0x3719b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f15('0x0'));var jsonpatch=require(_0x1f15('0x1'));var rp=require(_0x1f15('0x2'));var moment=require(_0x1f15('0x3'));var BPromise=require(_0x1f15('0x4'));var Mustache=require(_0x1f15('0x5'));var util=require(_0x1f15('0x6'));var path=require(_0x1f15('0x7'));var sox=require('sox');var csv=require(_0x1f15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f15('0x9'));var crypto=require(_0x1f15('0xa'));var jsforce=require(_0x1f15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f15('0x8'));var querystring=require(_0x1f15('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f15('0xd'));var qs=require(_0x1f15('0xe'));var as=require(_0x1f15('0xf'));var hardwareService=require(_0x1f15('0x10'));var logger=require('../../config/logger')(_0x1f15('0x11'));var utils=require(_0x1f15('0x12'));var config=require(_0x1f15('0x13'));var licenseUtil=require(_0x1f15('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x340109,_0x94e8e4){_0x94e8e4=_0x94e8e4||0xcc;return function(_0x440c0b){if(_0x440c0b){return _0x340109[_0x1f15('0x15')](_0x94e8e4);}return _0x340109[_0x1f15('0x16')](_0x94e8e4)[_0x1f15('0x17')]();};}function respondWithResult(_0x5a9f14,_0xfafc5c){_0xfafc5c=_0xfafc5c||0xc8;return function(_0x356768){if(_0x356768){return _0x5a9f14[_0x1f15('0x16')](_0xfafc5c)[_0x1f15('0x18')](_0x356768);}};}function respondWithFilteredResult(_0x48ef33,_0x428133){return function(_0x5baa48){if(_0x5baa48){var _0x19f7a2=typeof _0x428133[_0x1f15('0x19')]===_0x1f15('0x1a')&&typeof _0x428133['limit']==='undefined';var _0x25697e=_0x5baa48[_0x1f15('0x1b')];var _0x448725=_0x19f7a2?0x0:_0x428133['offset'];var _0xccfdf5=_0x19f7a2?_0x5baa48['count']:_0x428133[_0x1f15('0x19')]+_0x428133[_0x1f15('0x1c')];var _0x4ff4fb;if(_0xccfdf5>=_0x25697e){_0xccfdf5=_0x25697e;_0x4ff4fb=0xc8;}else{_0x4ff4fb=0xce;}_0x48ef33['status'](_0x4ff4fb);return _0x48ef33[_0x1f15('0x1d')]('Content-Range',_0x448725+'-'+_0xccfdf5+'/'+_0x25697e)[_0x1f15('0x18')](_0x5baa48);}return null;};}function patchUpdates(_0x2916b5){return function(_0x3598dd){try{jsonpatch[_0x1f15('0x1e')](_0x3598dd,_0x2916b5,!![]);}catch(_0xbf02bc){return BPromise[_0x1f15('0x1f')](_0xbf02bc);}return _0x3598dd[_0x1f15('0x20')]();};}function saveUpdates(_0x588c78,_0x4888c8){return function(_0x36b211){if(_0x36b211){return _0x36b211[_0x1f15('0x21')](_0x588c78)['then'](function(_0x57cb54){return _0x57cb54;});}return null;};}function removeEntity(_0x303d93,_0x49fe69){return function(_0x2598b4){if(_0x2598b4){return _0x2598b4['destroy']()[_0x1f15('0x22')](function(){_0x303d93[_0x1f15('0x16')](0xcc)[_0x1f15('0x17')]();});}};}function handleEntityNotFound(_0x46e8a7,_0x262121){return function(_0xdca8f4){if(!_0xdca8f4){_0x46e8a7[_0x1f15('0x15')](0x194);}return _0xdca8f4;};}function handleError(_0x317bfc,_0x42e5e3){_0x42e5e3=_0x42e5e3||0x1f4;return function(_0x49bf73){logger[_0x1f15('0x23')](_0x49bf73['stack']);if(_0x49bf73[_0x1f15('0x24')]){delete _0x49bf73[_0x1f15('0x24')];}_0x317bfc['status'](_0x42e5e3)[_0x1f15('0x25')](_0x49bf73);};}exports[_0x1f15('0x26')]=function(_0x1a5a14,_0x4be862){var _0x38ce55={},_0x14f9f4={},_0x15b68f={'count':0x0,'rows':[]};var _0x51b054=_[_0x1f15('0x27')](db['FreshdeskAccount'][_0x1f15('0x28')],function(_0x47e627){return{'name':_0x47e627[_0x1f15('0x29')],'type':_0x47e627[_0x1f15('0x2a')][_0x1f15('0x2b')]};});_0x14f9f4[_0x1f15('0x2c')]=_[_0x1f15('0x27')](_0x51b054,_0x1f15('0x24'));_0x14f9f4[_0x1f15('0x2d')]=_[_0x1f15('0x2e')](_0x1a5a14['query']);_0x14f9f4['filters']=_[_0x1f15('0x2f')](_0x14f9f4[_0x1f15('0x2c')],_0x14f9f4[_0x1f15('0x2d')]);_0x38ce55[_0x1f15('0x30')]=_[_0x1f15('0x2f')](_0x14f9f4[_0x1f15('0x2c')],qs['fields'](_0x1a5a14[_0x1f15('0x2d')][_0x1f15('0x31')]));_0x38ce55[_0x1f15('0x30')]=_0x38ce55[_0x1f15('0x30')]['length']?_0x38ce55['attributes']:_0x14f9f4['model'];if(!_0x1a5a14['query'][_0x1f15('0x32')](_0x1f15('0x33'))){_0x38ce55[_0x1f15('0x1c')]=qs[_0x1f15('0x1c')](_0x1a5a14['query'][_0x1f15('0x1c')]);_0x38ce55['offset']=qs[_0x1f15('0x19')](_0x1a5a14[_0x1f15('0x2d')][_0x1f15('0x19')]);}_0x38ce55[_0x1f15('0x34')]=qs[_0x1f15('0x35')](_0x1a5a14[_0x1f15('0x2d')]['sort']);_0x38ce55[_0x1f15('0x36')]=qs[_0x1f15('0x37')](_['pick'](_0x1a5a14[_0x1f15('0x2d')],_0x14f9f4[_0x1f15('0x37')]),_0x51b054);if(_0x1a5a14[_0x1f15('0x2d')]['filter']){_0x38ce55[_0x1f15('0x36')]=_[_0x1f15('0x38')](_0x38ce55['where'],{'$or':_['map'](_0x51b054,function(_0x327db9){if(_0x327db9[_0x1f15('0x2a')]!=='VIRTUAL'){var _0x21785a={};_0x21785a[_0x327db9[_0x1f15('0x24')]]={'$like':'%'+_0x1a5a14['query'][_0x1f15('0x39')]+'%'};return _0x21785a;}})});}_0x38ce55=_[_0x1f15('0x38')]({},_0x38ce55,_0x1a5a14['options']);var _0x112b38={'where':_0x38ce55['where']};return db['FreshdeskAccount']['count'](_0x112b38)['then'](function(_0x3f19b9){_0x15b68f[_0x1f15('0x1b')]=_0x3f19b9;if(_0x1a5a14[_0x1f15('0x2d')][_0x1f15('0x3a')]){_0x38ce55[_0x1f15('0x3b')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x38ce55);})[_0x1f15('0x22')](function(_0x5f049a){_0x15b68f[_0x1f15('0x3c')]=_0x5f049a;return _0x15b68f;})['then'](respondWithFilteredResult(_0x4be862,_0x38ce55))[_0x1f15('0x3d')](handleError(_0x4be862,null));};exports[_0x1f15('0x3e')]=function(_0xadb025,_0x17947b){var _0x5a6ad4={'raw':![],'where':{'id':_0xadb025[_0x1f15('0x3f')]['id']}},_0x3de951={};_0x3de951[_0x1f15('0x2c')]=_[_0x1f15('0x2e')](db['FreshdeskAccount'][_0x1f15('0x28')]);_0x3de951[_0x1f15('0x2d')]=_['keys'](_0xadb025[_0x1f15('0x2d')]);_0x3de951['filters']=_[_0x1f15('0x2f')](_0x3de951[_0x1f15('0x2c')],_0x3de951[_0x1f15('0x2d')]);_0x5a6ad4[_0x1f15('0x30')]=_[_0x1f15('0x2f')](_0x3de951[_0x1f15('0x2c')],qs[_0x1f15('0x31')](_0xadb025[_0x1f15('0x2d')][_0x1f15('0x31')]));_0x5a6ad4['attributes']=_0x5a6ad4[_0x1f15('0x30')][_0x1f15('0x40')]?_0x5a6ad4['attributes']:_0x3de951[_0x1f15('0x2c')];if(_0xadb025[_0x1f15('0x2d')][_0x1f15('0x3a')]){_0x5a6ad4['include']=[{'all':!![]}];}_0x5a6ad4=_[_0x1f15('0x38')]({},_0x5a6ad4,_0xadb025[_0x1f15('0x41')]);return db['FreshdeskAccount'][_0x1f15('0x42')](_0x5a6ad4)['then'](handleEntityNotFound(_0x17947b,null))[_0x1f15('0x22')](respondWithResult(_0x17947b,null))[_0x1f15('0x3d')](handleError(_0x17947b,null));};exports[_0x1f15('0x43')]=function(_0x655f34,_0x54858b){return db[_0x1f15('0x44')][_0x1f15('0x43')](_0x655f34[_0x1f15('0x45')],{})[_0x1f15('0x22')](respondWithResult(_0x54858b,0xc9))[_0x1f15('0x3d')](handleError(_0x54858b,null));};exports[_0x1f15('0x21')]=function(_0x391332,_0x2cbcb7){if(_0x391332[_0x1f15('0x45')]['id']){delete _0x391332['body']['id'];}return db[_0x1f15('0x44')][_0x1f15('0x42')]({'where':{'id':_0x391332['params']['id']}})[_0x1f15('0x22')](handleEntityNotFound(_0x2cbcb7,null))[_0x1f15('0x22')](saveUpdates(_0x391332[_0x1f15('0x45')],null))[_0x1f15('0x22')](respondWithResult(_0x2cbcb7,null))[_0x1f15('0x3d')](handleError(_0x2cbcb7,null));};exports['destroy']=function(_0x253ef7,_0x3c1429){return db[_0x1f15('0x44')][_0x1f15('0x42')]({'where':{'id':_0x253ef7[_0x1f15('0x3f')]['id']}})[_0x1f15('0x22')](handleEntityNotFound(_0x3c1429,null))['then'](removeEntity(_0x3c1429,null))[_0x1f15('0x3d')](handleError(_0x3c1429,null));};exports[_0x1f15('0x46')]=function(_0xc27f39,_0x3ad899,_0x1e9291){var _0xfc9a74={};var _0x43cdb8={};var _0x4a5f00;var _0x499779;return db[_0x1f15('0x44')][_0x1f15('0x47')]({'where':{'id':_0xc27f39[_0x1f15('0x3f')]['id']}})[_0x1f15('0x22')](handleEntityNotFound(_0x3ad899,null))[_0x1f15('0x22')](function(_0x18e508){if(_0x18e508){_0x4a5f00=_0x18e508;_0x43cdb8['model']=_[_0x1f15('0x2e')](db[_0x1f15('0x48')][_0x1f15('0x28')]);_0x43cdb8['query']=_['keys'](_0xc27f39[_0x1f15('0x2d')]);_0x43cdb8[_0x1f15('0x37')]=_['intersection'](_0x43cdb8[_0x1f15('0x2c')],_0x43cdb8['query']);_0xfc9a74['attributes']=_[_0x1f15('0x2f')](_0x43cdb8[_0x1f15('0x2c')],qs[_0x1f15('0x31')](_0xc27f39[_0x1f15('0x2d')]['fields']));_0xfc9a74[_0x1f15('0x30')]=_0xfc9a74[_0x1f15('0x30')]['length']?_0xfc9a74[_0x1f15('0x30')]:_0x43cdb8[_0x1f15('0x2c')];_0xfc9a74[_0x1f15('0x34')]=qs[_0x1f15('0x35')](_0xc27f39[_0x1f15('0x2d')][_0x1f15('0x35')]);_0xfc9a74[_0x1f15('0x36')]=qs[_0x1f15('0x37')](_[_0x1f15('0x49')](_0xc27f39[_0x1f15('0x2d')],_0x43cdb8[_0x1f15('0x37')]));if(_0xc27f39[_0x1f15('0x2d')]['filter']){_0xfc9a74['where']=_[_0x1f15('0x38')](_0xfc9a74[_0x1f15('0x36')],{'$or':_['map'](_0xfc9a74[_0x1f15('0x30')],function(_0xaa82e8){var _0x3400cd={};_0x3400cd[_0xaa82e8]={'$like':'%'+_0xc27f39[_0x1f15('0x2d')]['filter']+'%'};return _0x3400cd;})});}_0xfc9a74=_[_0x1f15('0x38')]({},_0xfc9a74,_0xc27f39[_0x1f15('0x41')]);return _0x4a5f00['getConfigurations'](_0xfc9a74);}})[_0x1f15('0x22')](function(_0x2ac5a7){if(_0x2ac5a7){_0x499779=_0x2ac5a7['length'];if(!_0xc27f39[_0x1f15('0x2d')]['hasOwnProperty'](_0x1f15('0x33'))){_0xfc9a74[_0x1f15('0x1c')]=qs[_0x1f15('0x1c')](_0xc27f39[_0x1f15('0x2d')][_0x1f15('0x1c')]);_0xfc9a74['offset']=qs[_0x1f15('0x19')](_0xc27f39['query']['offset']);}return _0x4a5f00[_0x1f15('0x46')](_0xfc9a74);}})[_0x1f15('0x22')](function(_0x487f62){if(_0x487f62){return _0x487f62?{'count':_0x499779,'rows':_0x487f62}:null;}})[_0x1f15('0x22')](respondWithResult(_0x3ad899,null))[_0x1f15('0x3d')](handleError(_0x3ad899,null));};exports[_0x1f15('0x4a')]=function(_0x437397,_0x524ebb,_0x273d42){if(_0x437397[_0x1f15('0x45')]['id']){delete _0x437397[_0x1f15('0x45')]['id'];}return db['FreshdeskAccount'][_0x1f15('0x47')]({'where':{'id':_0x437397[_0x1f15('0x3f')]['id']}})[_0x1f15('0x22')](handleEntityNotFound(_0x524ebb,null))[_0x1f15('0x22')](function(_0x2f7621){if(_0x2f7621){_0x437397[_0x1f15('0x45')][_0x1f15('0x4b')]=_0x2f7621['id'];_0x437397[_0x1f15('0x45')][_0x1f15('0x4c')]=integrations[_0x1f15('0x4d')](_0x437397[_0x1f15('0x45')][_0x1f15('0x4e')],_0x437397[_0x1f15('0x45')]['type']);_0x437397[_0x1f15('0x45')][_0x1f15('0x4f')]=integrations['getDescriptions'](_0x437397['body'][_0x1f15('0x4e')],_0x437397[_0x1f15('0x45')][_0x1f15('0x2a')]);return db['FreshdeskConfiguration'][_0x1f15('0x43')](_0x437397[_0x1f15('0x45')],{'include':[{'model':db['FreshdeskField'],'as':_0x1f15('0x4c')},{'model':db[_0x1f15('0x50')],'as':_0x1f15('0x4f')}]});}return null;})[_0x1f15('0x22')](respondWithResult(_0x524ebb,null))['catch'](handleError(_0x524ebb,null));};exports['getFields']=function(_0x2b8711,_0xa7307f,_0x2e06d1){var _0x5a2a13='';return db[_0x1f15('0x44')][_0x1f15('0x47')]({'where':{'id':_0x2b8711[_0x1f15('0x3f')]['id']},'attributes':['id',_0x1f15('0x51'),_0x1f15('0x52')]})['then'](handleEntityNotFound(_0xa7307f,null))['then'](function(_0x5e313f){if(_0x5e313f){_0x5a2a13=_0x5e313f[_0x1f15('0x51')];var _0x57e2c4=_0x5a2a13[_0x1f15('0x53')](-0x1);if(_0x57e2c4==='/'){_0x5a2a13=_0x5a2a13[_0x1f15('0x54')](0x0,_0x5a2a13['lastIndexOf'](_0x57e2c4));}return rp({'method':_0x1f15('0x55'),'uri':util[_0x1f15('0x56')](_0x1f15('0x57'),_0x5a2a13,_0x1f15('0x58')),'headers':{'Authorization':util[_0x1f15('0x56')](_0x1f15('0x59'),new Buffer(util['format'](_0x1f15('0x5a'),_0x5e313f[_0x1f15('0x52')]))[_0x1f15('0x5b')]('base64'))},'json':!![]});}})[_0x1f15('0x22')](function(_0x399eb7){if(_0x399eb7){var _0x5a72c1=[_0x1f15('0x5c'),'subject','agent',_0x1f15('0x5d'),_0x1f15('0x16'),'priority',_0x1f15('0x5e'),_0x1f15('0x5f'),_0x1f15('0x60'),_0x1f15('0x5e'),_0x1f15('0x61')];_[_0x1f15('0x62')](_0x399eb7,function(_0x560e5f){return _0x5a72c1[_0x1f15('0x63')](_0x560e5f[_0x1f15('0x24')])||!_0x560e5f[_0x1f15('0x64')]&&_0x560e5f[_0x1f15('0x2a')]!=='custom_text'&&_0x560e5f['type']!==_0x1f15('0x65');});return{'count':_0x399eb7[_0x1f15('0x40')],'rows':_['map'](_0x399eb7,function(_0x37363b){return{'id':_0x37363b[_0x1f15('0x24')],'name':_0x37363b[_0x1f15('0x66')],'custom':!_0x37363b[_0x1f15('0x64')],'options':_0x37363b[_0x1f15('0x67')]?_[_0x1f15('0x27')](_0x37363b['choices'],function(_0x4a2b32){return{'name':_[_0x1f15('0x68')](_0x4a2b32),'value':_0x4a2b32};}):[]};})};}})[_0x1f15('0x22')](respondWithResult(_0xa7307f,null))[_0x1f15('0x3d')](function(_0x481f5f){var _0x46afff=_0x2b8711[_0x1f15('0x2d')][_0x1f15('0x69')]?0x1f4:_0x481f5f[_0x1f15('0x6a')]||0x1f4;logger[_0x1f15('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x1f15('0x6b'),_0x46afff,JSON[_0x1f15('0x6c')](_0x481f5f));delete _0x481f5f[_0x1f15('0x24')];if(_0x46afff===0x191){_0x46afff=0x190;}_0xa7307f[_0x1f15('0x16')](_0x46afff)[_0x1f15('0x25')](_0x2b8711[_0x1f15('0x2d')][_0x1f15('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x481f5f[_0x1f15('0x6a')]}:_0x481f5f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9f1956e..abe6123 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 _0x8c88=['bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','../../config/logger','api','moment'];(function(_0x42a243,_0x7779a4){var _0x38e80a=function(_0x9bfb04){while(--_0x9bfb04){_0x42a243['push'](_0x42a243['shift']());}};_0x38e80a(++_0x7779a4);}(_0x8c88,0x1d5));var _0x88c8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8c88[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x88c8('0x0'));var util=require('util');var logger=require(_0x88c8('0x1'))(_0x88c8('0x2'));var moment=require(_0x88c8('0x3'));var BPromise=require(_0x88c8('0x4'));var rp=require(_0x88c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88c8('0x6'));var config=require(_0x88c8('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x88c8('0x8'));module[_0x88c8('0x9')]=function(_0x1c6642,_0x56bc31){return _0x1c6642['define'](_0x88c8('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dca=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x53de38,_0x5500ea){var _0x56e444=function(_0x2cb91e){while(--_0x2cb91e){_0x53de38['push'](_0x53de38['shift']());}};_0x56e444(++_0x5500ea);}(_0x7dca,0x176));var _0xa7dc=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x7dca[_0x286bfb];return _0x52b683;};'use strict';var _=require(_0xa7dc('0x0'));var util=require(_0xa7dc('0x1'));var logger=require(_0xa7dc('0x2'))(_0xa7dc('0x3'));var moment=require(_0xa7dc('0x4'));var BPromise=require(_0xa7dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7dc('0x6'));var rimraf=require(_0xa7dc('0x7'));var config=require(_0xa7dc('0x8'));var attributes=require(_0xa7dc('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa7dc('0xa')]=function(_0x14349f,_0x303ca2){return _0x14349f[_0xa7dc('0xb')](_0xa7dc('0xc'),attributes,{'tableName':_0xa7dc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b4aa608..e4a6e98 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 _0x16f7=['GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','stringify','ShowFreshdeskAccount','info','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x39772c,_0x3eec31){var _0x172b4f=function(_0x4fa109){while(--_0x4fa109){_0x39772c['push'](_0x39772c['shift']());}};_0x172b4f(++_0x3eec31);}(_0x16f7,0x1ed));var _0x716f=function(_0x1965ba,_0x52a90a){_0x1965ba=_0x1965ba-0x0;var _0x37c4a7=_0x16f7[_0x1965ba];return _0x37c4a7;};'use strict';var _=require(_0x716f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x716f('0x1'));var fs=require('fs');var Redis=require(_0x716f('0x2'));var db=require(_0x716f('0x3'))['db'];var utils=require(_0x716f('0x4'));var logger=require(_0x716f('0x5'))(_0x716f('0x6'));var config=require('../../config/environment');var jayson=require(_0x716f('0x7'));var client=jayson[_0x716f('0x8')][_0x716f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c719,_0x495448,_0x21da53){return new BPromise(function(_0x23a54c,_0x34eaf0){return client['request'](_0x42c719,_0x21da53)[_0x716f('0xa')](function(_0x103522){logger['info'](_0x716f('0xb'),_0x495448,'request\x20sent');logger[_0x716f('0xc')](_0x716f('0xd'),_0x495448,_0x716f('0xe'),JSON['stringify'](_0x103522));if(_0x103522[_0x716f('0xf')]){if(_0x103522[_0x716f('0xf')]['code']===0x1f4){logger[_0x716f('0xf')](_0x716f('0xb'),_0x495448,_0x103522[_0x716f('0xf')][_0x716f('0x10')]);return _0x34eaf0(_0x103522[_0x716f('0xf')][_0x716f('0x10')]);}logger[_0x716f('0xf')](_0x716f('0xb'),_0x495448,_0x103522['error']['message']);return _0x23a54c(_0x103522[_0x716f('0xf')]['message']);}else{logger['info'](_0x716f('0xb'),_0x495448,_0x716f('0xe'));_0x23a54c(_0x103522[_0x716f('0x11')]['message']);}})[_0x716f('0x12')](function(_0x30d344){logger[_0x716f('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x495448,_0x30d344);_0x34eaf0(_0x30d344);});});}exports[_0x716f('0x13')]=function(_0x146f31){var _0xd9942c=this;return new Promise(function(_0xa6af94,_0x30c505){return db[_0x716f('0x14')][_0x716f('0x15')]({'raw':_0x146f31[_0x716f('0x16')]?_0x146f31[_0x716f('0x16')][_0x716f('0x17')]===undefined?!![]:![]:!![],'where':_0x146f31[_0x716f('0x16')]?_0x146f31[_0x716f('0x16')][_0x716f('0x18')]||null:null,'attributes':_0x146f31[_0x716f('0x16')]?_0x146f31['options'][_0x716f('0x19')]||null:null,'limit':_0x146f31['options']?_0x146f31['options']['limit']||null:null,'include':_0x146f31[_0x716f('0x16')]?_0x146f31[_0x716f('0x16')]['include']?_['map'](_0x146f31['options'][_0x716f('0x1a')],function(_0x54d07d){return{'model':db[_0x54d07d[_0x716f('0x1b')]],'as':_0x54d07d['as'],'attributes':_0x54d07d[_0x716f('0x19')],'include':_0x54d07d[_0x716f('0x1a')]?_[_0x716f('0x1c')](_0x54d07d[_0x716f('0x1a')],function(_0x4d7529){return{'model':db[_0x4d7529[_0x716f('0x1b')]],'as':_0x4d7529['as'],'attributes':_0x4d7529[_0x716f('0x19')],'include':_0x4d7529[_0x716f('0x1a')]?_[_0x716f('0x1c')](_0x4d7529[_0x716f('0x1a')],function(_0x18e39c){return{'model':db[_0x18e39c[_0x716f('0x1b')]],'as':_0x18e39c['as'],'attributes':_0x18e39c['attributes']};}):[]};}):[]};}):[]:[]})[_0x716f('0xa')](function(_0x1a4cf0){logger['info'](_0x716f('0x13'),_0x146f31);logger[_0x716f('0xc')]('GetFreshdeskAccount',_0x146f31,JSON[_0x716f('0x1d')](_0x1a4cf0));_0xa6af94(_0x1a4cf0);})[_0x716f('0x12')](function(_0x41e524){logger[_0x716f('0xf')]('GetFreshdeskAccount',_0x41e524[_0x716f('0x10')],_0x146f31);_0x30c505(_0xd9942c[_0x716f('0xf')](0x1f4,_0x41e524[_0x716f('0x10')]));});});};exports[_0x716f('0x1e')]=function(_0x3e4809){var _0x2ded98=this;return new Promise(function(_0x5616d9,_0x5a357f){return db[_0x716f('0x14')]['find']({'raw':_0x3e4809[_0x716f('0x16')]?_0x3e4809[_0x716f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3e4809['options']?_0x3e4809[_0x716f('0x16')]['where']||null:null,'attributes':_0x3e4809[_0x716f('0x16')]?_0x3e4809[_0x716f('0x16')][_0x716f('0x19')]||null:null,'include':_0x3e4809[_0x716f('0x16')]?_0x3e4809[_0x716f('0x16')][_0x716f('0x1a')]?_[_0x716f('0x1c')](_0x3e4809['options']['include'],function(_0x17249f){return{'model':db[_0x17249f[_0x716f('0x1b')]],'as':_0x17249f['as'],'attributes':_0x17249f[_0x716f('0x19')],'include':_0x17249f[_0x716f('0x1a')]?_[_0x716f('0x1c')](_0x17249f[_0x716f('0x1a')],function(_0x4dc00b){return{'model':db[_0x4dc00b[_0x716f('0x1b')]],'as':_0x4dc00b['as'],'attributes':_0x4dc00b[_0x716f('0x19')],'include':_0x4dc00b[_0x716f('0x1a')]?_[_0x716f('0x1c')](_0x4dc00b['include'],function(_0x26362e){return{'model':db[_0x26362e[_0x716f('0x1b')]],'as':_0x26362e['as'],'attributes':_0x26362e['attributes']};}):[]};}):[]};}):[]:[]})[_0x716f('0xa')](function(_0x6b6b0d){logger[_0x716f('0x1f')](_0x716f('0x1e'),_0x3e4809);logger[_0x716f('0xc')](_0x716f('0x1e'),_0x3e4809,JSON[_0x716f('0x1d')](_0x6b6b0d));_0x5616d9(_0x6b6b0d);})[_0x716f('0x12')](function(_0x4d7544){logger[_0x716f('0xf')]('ShowFreshdeskAccount',_0x4d7544[_0x716f('0x10')],_0x3e4809);_0x5a357f(_0x2ded98[_0x716f('0xf')](0x1f4,_0x4d7544[_0x716f('0x10')]));});});}; \ No newline at end of file +var _0x0de5=['map','model','then','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','attributes','limit','include'];(function(_0x56e2cb,_0x15d535){var _0x205e39=function(_0x265219){while(--_0x265219){_0x56e2cb['push'](_0x56e2cb['shift']());}};_0x205e39(++_0x15d535);}(_0x0de5,0xef));var _0x50de=function(_0x376fd9,_0x10a995){_0x376fd9=_0x376fd9-0x0;var _0x37b6a9=_0x0de5[_0x376fd9];return _0x37b6a9;};'use strict';var _=require(_0x50de('0x0'));var util=require(_0x50de('0x1'));var moment=require(_0x50de('0x2'));var BPromise=require(_0x50de('0x3'));var rs=require(_0x50de('0x4'));var fs=require('fs');var Redis=require(_0x50de('0x5'));var db=require(_0x50de('0x6'))['db'];var utils=require(_0x50de('0x7'));var logger=require(_0x50de('0x8'))(_0x50de('0x9'));var config=require(_0x50de('0xa'));var jayson=require(_0x50de('0xb'));var client=jayson[_0x50de('0xc')][_0x50de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x57eeb0,_0x221813,_0x591bf9){return new BPromise(function(_0x482046,_0x1f3150){return client[_0x50de('0xe')](_0x57eeb0,_0x591bf9)['then'](function(_0x9ff65b){logger['info'](_0x50de('0xf'),_0x221813,'request\x20sent');logger[_0x50de('0x10')](_0x50de('0x11'),_0x221813,_0x50de('0x12'),JSON[_0x50de('0x13')](_0x9ff65b));if(_0x9ff65b['error']){if(_0x9ff65b[_0x50de('0x14')][_0x50de('0x15')]===0x1f4){logger[_0x50de('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x221813,_0x9ff65b[_0x50de('0x14')][_0x50de('0x16')]);return _0x1f3150(_0x9ff65b[_0x50de('0x14')][_0x50de('0x16')]);}logger[_0x50de('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x221813,_0x9ff65b[_0x50de('0x14')][_0x50de('0x16')]);return _0x482046(_0x9ff65b['error'][_0x50de('0x16')]);}else{logger[_0x50de('0x17')]('FreshdeskAccount,\x20%s,\x20%s',_0x221813,'request\x20sent');_0x482046(_0x9ff65b[_0x50de('0x18')][_0x50de('0x16')]);}})[_0x50de('0x19')](function(_0x45ad6b){logger[_0x50de('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x221813,_0x45ad6b);_0x1f3150(_0x45ad6b);});});}exports[_0x50de('0x1a')]=function(_0x383377){var _0x4e0e15=this;return new Promise(function(_0x1810a7,_0x5ad582){return db[_0x50de('0x1b')][_0x50de('0x1c')]({'raw':_0x383377['options']?_0x383377['options'][_0x50de('0x1d')]===undefined?!![]:![]:!![],'where':_0x383377[_0x50de('0x1e')]?_0x383377[_0x50de('0x1e')]['where']||null:null,'attributes':_0x383377[_0x50de('0x1e')]?_0x383377[_0x50de('0x1e')][_0x50de('0x1f')]||null:null,'limit':_0x383377[_0x50de('0x1e')]?_0x383377[_0x50de('0x1e')][_0x50de('0x20')]||null:null,'include':_0x383377[_0x50de('0x1e')]?_0x383377['options'][_0x50de('0x21')]?_[_0x50de('0x22')](_0x383377[_0x50de('0x1e')]['include'],function(_0x395b4c){return{'model':db[_0x395b4c[_0x50de('0x23')]],'as':_0x395b4c['as'],'attributes':_0x395b4c[_0x50de('0x1f')],'include':_0x395b4c['include']?_[_0x50de('0x22')](_0x395b4c['include'],function(_0x5cb928){return{'model':db[_0x5cb928['model']],'as':_0x5cb928['as'],'attributes':_0x5cb928['attributes'],'include':_0x5cb928[_0x50de('0x21')]?_['map'](_0x5cb928['include'],function(_0x54cd9c){return{'model':db[_0x54cd9c[_0x50de('0x23')]],'as':_0x54cd9c['as'],'attributes':_0x54cd9c[_0x50de('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x50de('0x24')](function(_0x521f90){logger[_0x50de('0x17')](_0x50de('0x1a'),_0x383377);logger[_0x50de('0x10')]('GetFreshdeskAccount',_0x383377,JSON[_0x50de('0x13')](_0x521f90));_0x1810a7(_0x521f90);})[_0x50de('0x19')](function(_0x227914){logger['error'](_0x50de('0x1a'),_0x227914['message'],_0x383377);_0x5ad582(_0x4e0e15[_0x50de('0x14')](0x1f4,_0x227914[_0x50de('0x16')]));});});};exports[_0x50de('0x25')]=function(_0x5c7d9d){var _0x556a9f=this;return new Promise(function(_0x523835,_0x3fb5b2){return db['FreshdeskAccount'][_0x50de('0x26')]({'raw':_0x5c7d9d[_0x50de('0x1e')]?_0x5c7d9d[_0x50de('0x1e')][_0x50de('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c7d9d[_0x50de('0x1e')]?_0x5c7d9d[_0x50de('0x1e')]['where']||null:null,'attributes':_0x5c7d9d[_0x50de('0x1e')]?_0x5c7d9d[_0x50de('0x1e')][_0x50de('0x1f')]||null:null,'include':_0x5c7d9d[_0x50de('0x1e')]?_0x5c7d9d[_0x50de('0x1e')][_0x50de('0x21')]?_[_0x50de('0x22')](_0x5c7d9d['options'][_0x50de('0x21')],function(_0x49d383){return{'model':db[_0x49d383[_0x50de('0x23')]],'as':_0x49d383['as'],'attributes':_0x49d383[_0x50de('0x1f')],'include':_0x49d383[_0x50de('0x21')]?_[_0x50de('0x22')](_0x49d383[_0x50de('0x21')],function(_0x4197bd){return{'model':db[_0x4197bd['model']],'as':_0x4197bd['as'],'attributes':_0x4197bd[_0x50de('0x1f')],'include':_0x4197bd[_0x50de('0x21')]?_['map'](_0x4197bd[_0x50de('0x21')],function(_0x420250){return{'model':db[_0x420250['model']],'as':_0x420250['as'],'attributes':_0x420250['attributes']};}):[]};}):[]};}):[]:[]})[_0x50de('0x24')](function(_0x14aa30){logger[_0x50de('0x17')](_0x50de('0x25'),_0x5c7d9d);logger[_0x50de('0x10')](_0x50de('0x25'),_0x5c7d9d,JSON[_0x50de('0x13')](_0x14aa30));_0x523835(_0x14aa30);})[_0x50de('0x19')](function(_0x556120){logger[_0x50de('0x14')](_0x50de('0x25'),_0x556120[_0x50de('0x16')],_0x5c7d9d);_0x3fb5b2(_0x556a9f[_0x50de('0x14')](0x1f4,_0x556120[_0x50de('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3980050..3a1b0ec 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 _0xce49=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c2863,_0x4487b6){var _0x4a4337=function(_0x3c0fb4){while(--_0x3c0fb4){_0x2c2863['push'](_0x2c2863['shift']());}};_0x4a4337(++_0x4487b6);}(_0xce49,0x10d));var _0x9ce4=function(_0x2f44fa,_0x39046a){_0x2f44fa=_0x2f44fa-0x0;var _0x2f7f10=_0xce49[_0x2f44fa];return _0x2f7f10;};'use strict';var multer=require(_0x9ce4('0x0'));var util=require(_0x9ce4('0x1'));var path=require(_0x9ce4('0x2'));var timeout=require(_0x9ce4('0x3'));var express=require(_0x9ce4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ce4('0x5'));var interaction=require(_0x9ce4('0x6'));var config=require(_0x9ce4('0x7'));var controller=require(_0x9ce4('0x8'));router[_0x9ce4('0x9')]('/',auth[_0x9ce4('0xa')](),controller['index']);router['get'](_0x9ce4('0xb'),auth[_0x9ce4('0xa')](),controller[_0x9ce4('0xc')]);router[_0x9ce4('0x9')]('/:id/fields',auth[_0x9ce4('0xa')](),controller[_0x9ce4('0xd')]);router[_0x9ce4('0x9')](_0x9ce4('0xe'),auth[_0x9ce4('0xa')](),controller[_0x9ce4('0xf')]);router[_0x9ce4('0x9')]('/:id/descriptions',auth[_0x9ce4('0xa')](),controller[_0x9ce4('0x10')]);router[_0x9ce4('0x9')](_0x9ce4('0x11'),auth['isAuthenticated'](),controller[_0x9ce4('0x12')]);router[_0x9ce4('0x13')]('/',auth[_0x9ce4('0xa')](),controller[_0x9ce4('0x14')]);router['post'](_0x9ce4('0x11'),auth[_0x9ce4('0xa')](),controller['setTags']);router[_0x9ce4('0x15')]('/:id',auth[_0x9ce4('0xa')](),controller[_0x9ce4('0x16')]);router[_0x9ce4('0x17')]('/:id',auth[_0x9ce4('0xa')](),controller[_0x9ce4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3804=['./intFreshdeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4c32f5,_0x3dbbf1){var _0x19cae9=function(_0x3c77cd){while(--_0x3c77cd){_0x4c32f5['push'](_0x4c32f5['shift']());}};_0x19cae9(++_0x3dbbf1);}(_0x3804,0x178));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4380('0x0'));var path=require(_0x4380('0x1'));var timeout=require(_0x4380('0x2'));var express=require(_0x4380('0x3'));var router=express[_0x4380('0x4')]();var fs_extra=require(_0x4380('0x5'));var auth=require(_0x4380('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4380('0x7'));var controller=require(_0x4380('0x8'));router[_0x4380('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4380('0x9')](_0x4380('0xa'),auth[_0x4380('0xb')](),controller[_0x4380('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x4380('0xd')]);router[_0x4380('0x9')](_0x4380('0xe'),auth[_0x4380('0xb')](),controller['getSubjects']);router[_0x4380('0x9')]('/:id/descriptions',auth[_0x4380('0xb')](),controller[_0x4380('0xf')]);router['get'](_0x4380('0x10'),auth[_0x4380('0xb')](),controller[_0x4380('0x11')]);router['post']('/',auth[_0x4380('0xb')](),controller[_0x4380('0x12')]);router[_0x4380('0x13')](_0x4380('0x10'),auth[_0x4380('0xb')](),controller[_0x4380('0x14')]);router[_0x4380('0x15')](_0x4380('0xa'),auth['isAuthenticated'](),controller[_0x4380('0x16')]);router['delete']('/:id',auth[_0x4380('0xb')](),controller['destroy']);module[_0x4380('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4208b72..69e8d84 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 _0xa07a=['sequelize','exports','STRING'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xa07a,0xa8));var _0xaa07=function(_0x425afb,_0x303b95){_0x425afb=_0x425afb-0x0;var _0x1cbde2=_0xa07a[_0x425afb];return _0x1cbde2;};'use strict';var Sequelize=require(_0xaa07('0x0'));module[_0xaa07('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa07('0x2')]}}; \ No newline at end of file +var _0xf61d=['exports','STRING','sequelize'];(function(_0x2ee6cc,_0x4672bd){var _0x567cad=function(_0x3ae4bb){while(--_0x3ae4bb){_0x2ee6cc['push'](_0x2ee6cc['shift']());}};_0x567cad(++_0x4672bd);}(_0xf61d,0x1f1));var _0xdf61=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0xf61d[_0x4b8156];return _0x4a819c;};'use strict';var Sequelize=require(_0xdf61('0x0'));module[_0xdf61('0x1')]={'name':{'type':Sequelize[_0xdf61('0x2')]},'description':{'type':Sequelize[_0xdf61('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5c2e59e..b6e3cc5 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 _0xc8ff=['limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','rows','catch','show','params','keys','fields','length','include','find','create','body','destroy','getFields','FreshdeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','offset','undefined'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0xc8ff,0x131));var _0xfc8f=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xc8ff[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xfc8f('0x0'));var rimraf=require(_0xfc8f('0x1'));var zipdir=require(_0xfc8f('0x2'));var jsonpatch=require(_0xfc8f('0x3'));var rp=require(_0xfc8f('0x4'));var moment=require(_0xfc8f('0x5'));var BPromise=require(_0xfc8f('0x6'));var Mustache=require(_0xfc8f('0x7'));var util=require(_0xfc8f('0x8'));var path=require(_0xfc8f('0x9'));var sox=require('sox');var csv=require(_0xfc8f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc8f('0xb'));var _=require(_0xfc8f('0xc'));var squel=require('squel');var crypto=require(_0xfc8f('0xd'));var jsforce=require(_0xfc8f('0xe'));var deskjs=require(_0xfc8f('0xf'));var toCsv=require(_0xfc8f('0xa'));var querystring=require(_0xfc8f('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc8f('0x11'));var authService=require(_0xfc8f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc8f('0x13'));var hardwareService=require(_0xfc8f('0x14'));var logger=require('../../config/logger')(_0xfc8f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16fb97,_0x1c3dcb){_0x1c3dcb=_0x1c3dcb||0xcc;return function(_0x5adf04){if(_0x5adf04){return _0x16fb97[_0xfc8f('0x16')](_0x1c3dcb);}return _0x16fb97[_0xfc8f('0x17')](_0x1c3dcb)['end']();};}function respondWithResult(_0x4f2129,_0x1261d0){_0x1261d0=_0x1261d0||0xc8;return function(_0x70c5c){if(_0x70c5c){return _0x4f2129[_0xfc8f('0x17')](_0x1261d0)[_0xfc8f('0x18')](_0x70c5c);}};}function respondWithFilteredResult(_0x412878,_0x52785d){return function(_0x59454f){if(_0x59454f){var _0x2eb983=typeof _0x52785d[_0xfc8f('0x19')]===_0xfc8f('0x1a')&&typeof _0x52785d[_0xfc8f('0x1b')]===_0xfc8f('0x1a');var _0x54f014=_0x59454f[_0xfc8f('0x1c')];var _0x45b38b=_0x2eb983?0x0:_0x52785d['offset'];var _0x143270=_0x2eb983?_0x59454f['count']:_0x52785d[_0xfc8f('0x19')]+_0x52785d[_0xfc8f('0x1b')];var _0x4ec758;if(_0x143270>=_0x54f014){_0x143270=_0x54f014;_0x4ec758=0xc8;}else{_0x4ec758=0xce;}_0x412878[_0xfc8f('0x17')](_0x4ec758);return _0x412878[_0xfc8f('0x1d')](_0xfc8f('0x1e'),_0x45b38b+'-'+_0x143270+'/'+_0x54f014)[_0xfc8f('0x18')](_0x59454f);}return null;};}function patchUpdates(_0x5dd7a2){return function(_0x4d603a){try{jsonpatch['apply'](_0x4d603a,_0x5dd7a2,!![]);}catch(_0x5aa703){return BPromise[_0xfc8f('0x1f')](_0x5aa703);}return _0x4d603a[_0xfc8f('0x20')]();};}function saveUpdates(_0x402cf6,_0x268647){return function(_0x538657){if(_0x538657){return _0x538657[_0xfc8f('0x21')](_0x402cf6)[_0xfc8f('0x22')](function(_0x440504){return _0x440504;});}return null;};}function removeEntity(_0x2a56ab,_0x2820b9){return function(_0x40cd5e){if(_0x40cd5e){return _0x40cd5e['destroy']()[_0xfc8f('0x22')](function(){_0x2a56ab[_0xfc8f('0x17')](0xcc)[_0xfc8f('0x23')]();});}};}function handleEntityNotFound(_0x2b8cc7,_0x5ed138){return function(_0x301a34){if(!_0x301a34){_0x2b8cc7[_0xfc8f('0x16')](0x194);}return _0x301a34;};}function handleError(_0x3212b0,_0x3f5cc6){_0x3f5cc6=_0x3f5cc6||0x1f4;return function(_0x203839){logger[_0xfc8f('0x24')](_0x203839[_0xfc8f('0x25')]);if(_0x203839['name']){delete _0x203839[_0xfc8f('0x26')];}_0x3212b0[_0xfc8f('0x17')](_0x3f5cc6)[_0xfc8f('0x27')](_0x203839);};}exports[_0xfc8f('0x28')]=function(_0x306ae9,_0x232b2d){var _0x198f45={},_0x4d8a43={},_0x3c9ac8={'count':0x0,'rows':[]};var _0x3f7534=_[_0xfc8f('0x29')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x3f7176){return{'name':_0x3f7176[_0xfc8f('0x2a')],'type':_0x3f7176[_0xfc8f('0x2b')][_0xfc8f('0x2c')]};});_0x4d8a43[_0xfc8f('0x2d')]=_[_0xfc8f('0x29')](_0x3f7534,_0xfc8f('0x26'));_0x4d8a43[_0xfc8f('0x2e')]=_['keys'](_0x306ae9['query']);_0x4d8a43[_0xfc8f('0x2f')]=_[_0xfc8f('0x30')](_0x4d8a43[_0xfc8f('0x2d')],_0x4d8a43['query']);_0x198f45[_0xfc8f('0x31')]=_[_0xfc8f('0x30')](_0x4d8a43['model'],qs['fields'](_0x306ae9['query']['fields']));_0x198f45[_0xfc8f('0x31')]=_0x198f45[_0xfc8f('0x31')]['length']?_0x198f45[_0xfc8f('0x31')]:_0x4d8a43[_0xfc8f('0x2d')];if(!_0x306ae9[_0xfc8f('0x2e')]['hasOwnProperty'](_0xfc8f('0x32'))){_0x198f45[_0xfc8f('0x1b')]=qs[_0xfc8f('0x1b')](_0x306ae9['query'][_0xfc8f('0x1b')]);_0x198f45[_0xfc8f('0x19')]=qs['offset'](_0x306ae9[_0xfc8f('0x2e')][_0xfc8f('0x19')]);}_0x198f45[_0xfc8f('0x33')]=qs[_0xfc8f('0x34')](_0x306ae9['query']['sort']);_0x198f45[_0xfc8f('0x35')]=qs[_0xfc8f('0x2f')](_[_0xfc8f('0x36')](_0x306ae9[_0xfc8f('0x2e')],_0x4d8a43[_0xfc8f('0x2f')]),_0x3f7534);if(_0x306ae9[_0xfc8f('0x2e')]['filter']){_0x198f45[_0xfc8f('0x35')]=_[_0xfc8f('0x37')](_0x198f45[_0xfc8f('0x35')],{'$or':_[_0xfc8f('0x29')](_0x3f7534,function(_0x3ae57a){if(_0x3ae57a[_0xfc8f('0x2b')]!==_0xfc8f('0x38')){var _0x14de89={};_0x14de89[_0x3ae57a[_0xfc8f('0x26')]]={'$like':'%'+_0x306ae9[_0xfc8f('0x2e')][_0xfc8f('0x39')]+'%'};return _0x14de89;}})});}_0x198f45=_[_0xfc8f('0x37')]({},_0x198f45,_0x306ae9[_0xfc8f('0x3a')]);var _0x4a8085={'where':_0x198f45[_0xfc8f('0x35')]};return db[_0xfc8f('0x3b')][_0xfc8f('0x1c')](_0x4a8085)['then'](function(_0x11f773){_0x3c9ac8[_0xfc8f('0x1c')]=_0x11f773;if(_0x306ae9[_0xfc8f('0x2e')][_0xfc8f('0x3c')]){_0x198f45['include']=[{'all':!![]}];}return db[_0xfc8f('0x3b')]['findAll'](_0x198f45);})[_0xfc8f('0x22')](function(_0x30d3cd){_0x3c9ac8[_0xfc8f('0x3d')]=_0x30d3cd;return _0x3c9ac8;})[_0xfc8f('0x22')](respondWithFilteredResult(_0x232b2d,_0x198f45))[_0xfc8f('0x3e')](handleError(_0x232b2d,null));};exports[_0xfc8f('0x3f')]=function(_0x22ed31,_0x7a2d0e){var _0x4f3d7d={'raw':![],'where':{'id':_0x22ed31[_0xfc8f('0x40')]['id']}},_0x50b435={};_0x50b435['model']=_[_0xfc8f('0x41')](db[_0xfc8f('0x3b')]['rawAttributes']);_0x50b435[_0xfc8f('0x2e')]=_[_0xfc8f('0x41')](_0x22ed31[_0xfc8f('0x2e')]);_0x50b435['filters']=_[_0xfc8f('0x30')](_0x50b435['model'],_0x50b435[_0xfc8f('0x2e')]);_0x4f3d7d[_0xfc8f('0x31')]=_['intersection'](_0x50b435['model'],qs[_0xfc8f('0x42')](_0x22ed31['query'][_0xfc8f('0x42')]));_0x4f3d7d[_0xfc8f('0x31')]=_0x4f3d7d[_0xfc8f('0x31')][_0xfc8f('0x43')]?_0x4f3d7d[_0xfc8f('0x31')]:_0x50b435[_0xfc8f('0x2d')];if(_0x22ed31[_0xfc8f('0x2e')][_0xfc8f('0x3c')]){_0x4f3d7d[_0xfc8f('0x44')]=[{'all':!![]}];}_0x4f3d7d=_[_0xfc8f('0x37')]({},_0x4f3d7d,_0x22ed31[_0xfc8f('0x3a')]);return db[_0xfc8f('0x3b')][_0xfc8f('0x45')](_0x4f3d7d)[_0xfc8f('0x22')](handleEntityNotFound(_0x7a2d0e,null))[_0xfc8f('0x22')](respondWithResult(_0x7a2d0e,null))[_0xfc8f('0x3e')](handleError(_0x7a2d0e,null));};exports[_0xfc8f('0x46')]=function(_0x1bc2c6,_0x479600){return db['FreshdeskConfiguration'][_0xfc8f('0x46')](_0x1bc2c6[_0xfc8f('0x47')],{})['then'](respondWithResult(_0x479600,0xc9))['catch'](handleError(_0x479600,null));};exports[_0xfc8f('0x21')]=function(_0x3e4eaa,_0x56e7a7){if(_0x3e4eaa[_0xfc8f('0x47')]['id']){delete _0x3e4eaa[_0xfc8f('0x47')]['id'];}return db[_0xfc8f('0x3b')]['find']({'where':{'id':_0x3e4eaa['params']['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0x56e7a7,null))[_0xfc8f('0x22')](saveUpdates(_0x3e4eaa[_0xfc8f('0x47')],null))[_0xfc8f('0x22')](respondWithResult(_0x56e7a7,null))['catch'](handleError(_0x56e7a7,null));};exports[_0xfc8f('0x48')]=function(_0x18fcce,_0x8580fb){return db[_0xfc8f('0x3b')]['find']({'where':{'id':_0x18fcce['params']['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0x8580fb,null))[_0xfc8f('0x22')](removeEntity(_0x8580fb,null))[_0xfc8f('0x3e')](handleError(_0x8580fb,null));};exports[_0xfc8f('0x49')]=function(_0x11ced0,_0x80dc8a,_0x441cce){var _0x47f4de={};var _0x2d353a={};var _0x38c2c1;var _0x3ab2ba;return db[_0xfc8f('0x3b')]['findOne']({'where':{'id':_0x11ced0['params']['id']}})['then'](handleEntityNotFound(_0x80dc8a,null))[_0xfc8f('0x22')](function(_0x29f813){if(_0x29f813){_0x38c2c1=_0x29f813;_0x2d353a[_0xfc8f('0x2d')]=_['keys'](db[_0xfc8f('0x4a')]['rawAttributes']);_0x2d353a[_0xfc8f('0x2e')]=_['keys'](_0x11ced0[_0xfc8f('0x2e')]);_0x2d353a['filters']=_['intersection'](_0x2d353a['model'],_0x2d353a[_0xfc8f('0x2e')]);_0x47f4de[_0xfc8f('0x31')]=_['intersection'](_0x2d353a[_0xfc8f('0x2d')],qs[_0xfc8f('0x42')](_0x11ced0[_0xfc8f('0x2e')][_0xfc8f('0x42')]));_0x47f4de[_0xfc8f('0x31')]=_0x47f4de['attributes'][_0xfc8f('0x43')]?_0x47f4de[_0xfc8f('0x31')]:_0x2d353a[_0xfc8f('0x2d')];_0x47f4de['order']=qs[_0xfc8f('0x34')](_0x11ced0[_0xfc8f('0x2e')][_0xfc8f('0x34')]);_0x47f4de[_0xfc8f('0x35')]=qs[_0xfc8f('0x2f')](_[_0xfc8f('0x36')](_0x11ced0['query'],_0x2d353a[_0xfc8f('0x2f')]));if(_0x11ced0[_0xfc8f('0x2e')][_0xfc8f('0x39')]){_0x47f4de['where']=_['merge'](_0x47f4de[_0xfc8f('0x35')],{'$or':_[_0xfc8f('0x29')](_0x47f4de[_0xfc8f('0x31')],function(_0x849d75){var _0x16fcfe={};_0x16fcfe[_0x849d75]={'$like':'%'+_0x11ced0[_0xfc8f('0x2e')]['filter']+'%'};return _0x16fcfe;})});}_0x47f4de=_[_0xfc8f('0x37')]({},_0x47f4de,_0x11ced0[_0xfc8f('0x3a')]);return _0x38c2c1['getFields'](_0x47f4de);}})[_0xfc8f('0x22')](function(_0x32589b){if(_0x32589b){_0x3ab2ba=_0x32589b['length'];if(!_0x11ced0['query'][_0xfc8f('0x4b')](_0xfc8f('0x32'))){_0x47f4de[_0xfc8f('0x1b')]=qs[_0xfc8f('0x1b')](_0x11ced0[_0xfc8f('0x2e')]['limit']);_0x47f4de[_0xfc8f('0x19')]=qs[_0xfc8f('0x19')](_0x11ced0['query'][_0xfc8f('0x19')]);}return _0x38c2c1[_0xfc8f('0x49')](_0x47f4de);}})['then'](function(_0x26d90f){if(_0x26d90f){return _0x26d90f?{'count':_0x3ab2ba,'rows':_0x26d90f}:null;}})['then'](respondWithResult(_0x80dc8a,null))[_0xfc8f('0x3e')](handleError(_0x80dc8a,null));};exports[_0xfc8f('0x4c')]=function(_0x3e8ff7,_0x6cc617,_0x116538){var _0x44c746={};var _0xac4b48={};var _0x3c6918;var _0x5dab47;return db[_0xfc8f('0x3b')][_0xfc8f('0x4d')]({'where':{'id':_0x3e8ff7[_0xfc8f('0x40')]['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0x6cc617,null))[_0xfc8f('0x22')](function(_0x27c7a1){if(_0x27c7a1){_0x3c6918=_0x27c7a1;_0xac4b48['model']=_[_0xfc8f('0x41')](db[_0xfc8f('0x4a')]['rawAttributes']);_0xac4b48[_0xfc8f('0x2e')]=_[_0xfc8f('0x41')](_0x3e8ff7['query']);_0xac4b48[_0xfc8f('0x2f')]=_[_0xfc8f('0x30')](_0xac4b48['model'],_0xac4b48[_0xfc8f('0x2e')]);_0x44c746['attributes']=_[_0xfc8f('0x30')](_0xac4b48[_0xfc8f('0x2d')],qs[_0xfc8f('0x42')](_0x3e8ff7[_0xfc8f('0x2e')][_0xfc8f('0x42')]));_0x44c746['attributes']=_0x44c746[_0xfc8f('0x31')][_0xfc8f('0x43')]?_0x44c746['attributes']:_0xac4b48[_0xfc8f('0x2d')];_0x44c746[_0xfc8f('0x33')]=qs['sort'](_0x3e8ff7[_0xfc8f('0x2e')]['sort']);_0x44c746[_0xfc8f('0x35')]=qs[_0xfc8f('0x2f')](_[_0xfc8f('0x36')](_0x3e8ff7[_0xfc8f('0x2e')],_0xac4b48['filters']));if(_0x3e8ff7['query'][_0xfc8f('0x39')]){_0x44c746[_0xfc8f('0x35')]=_[_0xfc8f('0x37')](_0x44c746[_0xfc8f('0x35')],{'$or':_[_0xfc8f('0x29')](_0x44c746['attributes'],function(_0x3728ad){var _0x415630={};_0x415630[_0x3728ad]={'$like':'%'+_0x3e8ff7['query']['filter']+'%'};return _0x415630;})});}_0x44c746=_[_0xfc8f('0x37')]({},_0x44c746,_0x3e8ff7[_0xfc8f('0x3a')]);return _0x3c6918['getSubjects'](_0x44c746);}})['then'](function(_0x56bf86){if(_0x56bf86){_0x5dab47=_0x56bf86[_0xfc8f('0x43')];if(!_0x3e8ff7[_0xfc8f('0x2e')][_0xfc8f('0x4b')](_0xfc8f('0x32'))){_0x44c746['limit']=qs[_0xfc8f('0x1b')](_0x3e8ff7[_0xfc8f('0x2e')]['limit']);_0x44c746[_0xfc8f('0x19')]=qs[_0xfc8f('0x19')](_0x3e8ff7[_0xfc8f('0x2e')][_0xfc8f('0x19')]);}return _0x3c6918[_0xfc8f('0x4c')](_0x44c746);}})[_0xfc8f('0x22')](function(_0x1ea8cb){if(_0x1ea8cb){return _0x1ea8cb?{'count':_0x5dab47,'rows':_0x1ea8cb}:null;}})['then'](respondWithResult(_0x6cc617,null))['catch'](handleError(_0x6cc617,null));};exports[_0xfc8f('0x4e')]=function(_0x3c0983,_0x5424e9,_0x1ec7a9){var _0xf64cb9={};var _0x4f35ea={};var _0x3221fd;var _0x4a57b0;return db[_0xfc8f('0x3b')]['findOne']({'where':{'id':_0x3c0983[_0xfc8f('0x40')]['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0x5424e9,null))[_0xfc8f('0x22')](function(_0x50a001){if(_0x50a001){_0x3221fd=_0x50a001;_0x4f35ea['model']=_[_0xfc8f('0x41')](db[_0xfc8f('0x4a')]['rawAttributes']);_0x4f35ea[_0xfc8f('0x2e')]=_[_0xfc8f('0x41')](_0x3c0983[_0xfc8f('0x2e')]);_0x4f35ea[_0xfc8f('0x2f')]=_[_0xfc8f('0x30')](_0x4f35ea[_0xfc8f('0x2d')],_0x4f35ea['query']);_0xf64cb9[_0xfc8f('0x31')]=_[_0xfc8f('0x30')](_0x4f35ea['model'],qs[_0xfc8f('0x42')](_0x3c0983['query']['fields']));_0xf64cb9[_0xfc8f('0x31')]=_0xf64cb9[_0xfc8f('0x31')][_0xfc8f('0x43')]?_0xf64cb9[_0xfc8f('0x31')]:_0x4f35ea[_0xfc8f('0x2d')];_0xf64cb9[_0xfc8f('0x33')]=qs['sort'](_0x3c0983[_0xfc8f('0x2e')][_0xfc8f('0x34')]);_0xf64cb9[_0xfc8f('0x35')]=qs[_0xfc8f('0x2f')](_[_0xfc8f('0x36')](_0x3c0983[_0xfc8f('0x2e')],_0x4f35ea[_0xfc8f('0x2f')]));if(_0x3c0983[_0xfc8f('0x2e')][_0xfc8f('0x39')]){_0xf64cb9[_0xfc8f('0x35')]=_[_0xfc8f('0x37')](_0xf64cb9[_0xfc8f('0x35')],{'$or':_[_0xfc8f('0x29')](_0xf64cb9[_0xfc8f('0x31')],function(_0x15e74b){var _0x3cc83b={};_0x3cc83b[_0x15e74b]={'$like':'%'+_0x3c0983[_0xfc8f('0x2e')][_0xfc8f('0x39')]+'%'};return _0x3cc83b;})});}_0xf64cb9=_[_0xfc8f('0x37')]({},_0xf64cb9,_0x3c0983[_0xfc8f('0x3a')]);return _0x3221fd[_0xfc8f('0x4e')](_0xf64cb9);}})[_0xfc8f('0x22')](function(_0x402a2b){if(_0x402a2b){_0x4a57b0=_0x402a2b[_0xfc8f('0x43')];if(!_0x3c0983[_0xfc8f('0x2e')][_0xfc8f('0x4b')](_0xfc8f('0x32'))){_0xf64cb9[_0xfc8f('0x1b')]=qs['limit'](_0x3c0983['query']['limit']);_0xf64cb9['offset']=qs[_0xfc8f('0x19')](_0x3c0983['query'][_0xfc8f('0x19')]);}return _0x3221fd['getDescriptions'](_0xf64cb9);}})[_0xfc8f('0x22')](function(_0x1862bd){if(_0x1862bd){return _0x1862bd?{'count':_0x4a57b0,'rows':_0x1862bd}:null;}})['then'](respondWithResult(_0x5424e9,null))[_0xfc8f('0x3e')](handleError(_0x5424e9,null));};exports[_0xfc8f('0x4f')]=function(_0x12245a,_0x2cbcbb,_0x552f8c){var _0x4d5079={};var _0x286e05={};var _0x181d7c;var _0x2ad353;return db['FreshdeskConfiguration'][_0xfc8f('0x4d')]({'where':{'id':_0x12245a[_0xfc8f('0x40')]['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0x2cbcbb,null))[_0xfc8f('0x22')](function(_0x40f2b0){if(_0x40f2b0){_0x181d7c=_0x40f2b0;_0x286e05[_0xfc8f('0x2d')]=_[_0xfc8f('0x41')](db[_0xfc8f('0x50')]['rawAttributes']);_0x286e05[_0xfc8f('0x2e')]=_[_0xfc8f('0x41')](_0x12245a['query']);_0x286e05[_0xfc8f('0x2f')]=_[_0xfc8f('0x30')](_0x286e05[_0xfc8f('0x2d')],_0x286e05[_0xfc8f('0x2e')]);_0x4d5079[_0xfc8f('0x31')]=_[_0xfc8f('0x30')](_0x286e05['model'],qs[_0xfc8f('0x42')](_0x12245a[_0xfc8f('0x2e')]['fields']));_0x4d5079[_0xfc8f('0x31')]=_0x4d5079[_0xfc8f('0x31')][_0xfc8f('0x43')]?_0x4d5079['attributes']:_0x286e05['model'];_0x4d5079[_0xfc8f('0x33')]=qs[_0xfc8f('0x34')](_0x12245a[_0xfc8f('0x2e')][_0xfc8f('0x34')]);_0x4d5079['where']=qs[_0xfc8f('0x2f')](_[_0xfc8f('0x36')](_0x12245a[_0xfc8f('0x2e')],_0x286e05[_0xfc8f('0x2f')]));if(_0x12245a[_0xfc8f('0x2e')][_0xfc8f('0x39')]){_0x4d5079[_0xfc8f('0x35')]=_['merge'](_0x4d5079[_0xfc8f('0x35')],{'$or':_[_0xfc8f('0x29')](_0x4d5079[_0xfc8f('0x31')],function(_0x1fcd89){var _0x1df614={};_0x1df614[_0x1fcd89]={'$like':'%'+_0x12245a[_0xfc8f('0x2e')][_0xfc8f('0x39')]+'%'};return _0x1df614;})});}_0x4d5079=_[_0xfc8f('0x37')]({},_0x4d5079,_0x12245a[_0xfc8f('0x3a')]);return _0x181d7c[_0xfc8f('0x4f')](_0x4d5079);}})['then'](function(_0x3809da){if(_0x3809da){_0x2ad353=_0x3809da[_0xfc8f('0x43')];if(!_0x12245a[_0xfc8f('0x2e')][_0xfc8f('0x4b')](_0xfc8f('0x32'))){_0x4d5079['limit']=qs[_0xfc8f('0x1b')](_0x12245a[_0xfc8f('0x2e')]['limit']);_0x4d5079[_0xfc8f('0x19')]=qs[_0xfc8f('0x19')](_0x12245a[_0xfc8f('0x2e')][_0xfc8f('0x19')]);}return _0x181d7c[_0xfc8f('0x4f')](_0x4d5079);}})['then'](function(_0x656322){if(_0x656322){return _0x656322?{'count':_0x2ad353,'rows':_0x656322}:null;}})['then'](respondWithResult(_0x2cbcbb,null))[_0xfc8f('0x3e')](handleError(_0x2cbcbb,null));};exports[_0xfc8f('0x51')]=function(_0x107466,_0xb3cd2c,_0x558cb7){if(_0x107466[_0xfc8f('0x47')]['id']){delete _0x107466[_0xfc8f('0x47')]['id'];}return db['FreshdeskConfiguration'][_0xfc8f('0x4d')]({'where':{'id':_0x107466[_0xfc8f('0x40')]['id']}})[_0xfc8f('0x22')](handleEntityNotFound(_0xb3cd2c,null))[_0xfc8f('0x22')](function(_0x3b5f7){if(_0x3b5f7){return _0x3b5f7[_0xfc8f('0x51')](_0x107466['body'][_0xfc8f('0x52')]||[]);}return null;})['then'](respondWithResult(_0xb3cd2c,null))['catch'](handleError(_0xb3cd2c,null));}; \ No newline at end of file +var _0x7424=['show','params','options','find','catch','create','body','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','Tag','getTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x4b81bc,_0x19187c){var _0x4dd999=function(_0x1279a3){while(--_0x1279a3){_0x4b81bc['push'](_0x4b81bc['shift']());}};_0x4dd999(++_0x19187c);}(_0x7424,0xb5));var _0x4742=function(_0x45c4d7,_0x170c0d){_0x45c4d7=_0x45c4d7-0x0;var _0x546b09=_0x7424[_0x45c4d7];return _0x546b09;};'use strict';var emlformat=require(_0x4742('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4742('0x1'));var rp=require(_0x4742('0x2'));var moment=require(_0x4742('0x3'));var BPromise=require(_0x4742('0x4'));var Mustache=require(_0x4742('0x5'));var util=require(_0x4742('0x6'));var path=require(_0x4742('0x7'));var sox=require(_0x4742('0x8'));var csv=require(_0x4742('0x9'));var ejs=require(_0x4742('0xa'));var fs=require('fs');var fs_extra=require(_0x4742('0xb'));var _=require('lodash');var squel=require(_0x4742('0xc'));var crypto=require('crypto');var jsforce=require(_0x4742('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4742('0x9'));var querystring=require(_0x4742('0xe'));var Papa=require(_0x4742('0xf'));var Redis=require(_0x4742('0x10'));var authService=require(_0x4742('0x11'));var qs=require(_0x4742('0x12'));var as=require(_0x4742('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4742('0x14'))('api');var utils=require(_0x4742('0x15'));var config=require(_0x4742('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4742('0x17'))['db'];function respondWithStatusCode(_0x239de8,_0x1f0200){_0x1f0200=_0x1f0200||0xcc;return function(_0x2a9854){if(_0x2a9854){return _0x239de8[_0x4742('0x18')](_0x1f0200);}return _0x239de8[_0x4742('0x19')](_0x1f0200)[_0x4742('0x1a')]();};}function respondWithResult(_0x5799a0,_0x182e7b){_0x182e7b=_0x182e7b||0xc8;return function(_0x1572d5){if(_0x1572d5){return _0x5799a0[_0x4742('0x19')](_0x182e7b)['json'](_0x1572d5);}};}function respondWithFilteredResult(_0x46783c,_0x1ed3b5){return function(_0x5c8646){if(_0x5c8646){var _0x4873e8=typeof _0x1ed3b5[_0x4742('0x1b')]==='undefined'&&typeof _0x1ed3b5[_0x4742('0x1c')]==='undefined';var _0x311718=_0x5c8646[_0x4742('0x1d')];var _0x59ffb6=_0x4873e8?0x0:_0x1ed3b5[_0x4742('0x1b')];var _0x3e9605=_0x4873e8?_0x5c8646[_0x4742('0x1d')]:_0x1ed3b5[_0x4742('0x1b')]+_0x1ed3b5[_0x4742('0x1c')];var _0x11da3f;if(_0x3e9605>=_0x311718){_0x3e9605=_0x311718;_0x11da3f=0xc8;}else{_0x11da3f=0xce;}_0x46783c[_0x4742('0x19')](_0x11da3f);return _0x46783c[_0x4742('0x1e')](_0x4742('0x1f'),_0x59ffb6+'-'+_0x3e9605+'/'+_0x311718)['json'](_0x5c8646);}return null;};}function patchUpdates(_0x5d302e){return function(_0xad74ee){try{jsonpatch[_0x4742('0x20')](_0xad74ee,_0x5d302e,!![]);}catch(_0x411769){return BPromise[_0x4742('0x21')](_0x411769);}return _0xad74ee[_0x4742('0x22')]();};}function saveUpdates(_0x4c90b7,_0x7932c0){return function(_0x212989){if(_0x212989){return _0x212989[_0x4742('0x23')](_0x4c90b7)[_0x4742('0x24')](function(_0x35a4c5){return _0x35a4c5;});}return null;};}function removeEntity(_0x181c49,_0x4380f5){return function(_0x3488d6){if(_0x3488d6){return _0x3488d6[_0x4742('0x25')]()[_0x4742('0x24')](function(){_0x181c49[_0x4742('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc3ef,_0x4128e0){return function(_0xf8104e){if(!_0xf8104e){_0x4dc3ef[_0x4742('0x18')](0x194);}return _0xf8104e;};}function handleError(_0x49d097,_0x199e0f){_0x199e0f=_0x199e0f||0x1f4;return function(_0x4a17b9){logger[_0x4742('0x26')](_0x4a17b9['stack']);if(_0x4a17b9[_0x4742('0x27')]){delete _0x4a17b9[_0x4742('0x27')];}_0x49d097[_0x4742('0x19')](_0x199e0f)[_0x4742('0x28')](_0x4a17b9);};}exports['index']=function(_0x4e9cb2,_0x50b2c7){var _0x923787={},_0x4065d6={},_0x553984={'count':0x0,'rows':[]};var _0x561637=_[_0x4742('0x29')](db[_0x4742('0x2a')][_0x4742('0x2b')],function(_0xffa678){return{'name':_0xffa678[_0x4742('0x2c')],'type':_0xffa678[_0x4742('0x2d')][_0x4742('0x2e')]};});_0x4065d6[_0x4742('0x2f')]=_[_0x4742('0x29')](_0x561637,'name');_0x4065d6['query']=_[_0x4742('0x30')](_0x4e9cb2[_0x4742('0x31')]);_0x4065d6['filters']=_['intersection'](_0x4065d6[_0x4742('0x2f')],_0x4065d6['query']);_0x923787[_0x4742('0x32')]=_[_0x4742('0x33')](_0x4065d6[_0x4742('0x2f')],qs[_0x4742('0x34')](_0x4e9cb2[_0x4742('0x31')]['fields']));_0x923787[_0x4742('0x32')]=_0x923787['attributes'][_0x4742('0x35')]?_0x923787[_0x4742('0x32')]:_0x4065d6[_0x4742('0x2f')];if(!_0x4e9cb2['query'][_0x4742('0x36')](_0x4742('0x37'))){_0x923787[_0x4742('0x1c')]=qs[_0x4742('0x1c')](_0x4e9cb2['query'][_0x4742('0x1c')]);_0x923787[_0x4742('0x1b')]=qs[_0x4742('0x1b')](_0x4e9cb2[_0x4742('0x31')][_0x4742('0x1b')]);}_0x923787[_0x4742('0x38')]=qs[_0x4742('0x39')](_0x4e9cb2['query']['sort']);_0x923787[_0x4742('0x3a')]=qs['filters'](_[_0x4742('0x3b')](_0x4e9cb2[_0x4742('0x31')],_0x4065d6[_0x4742('0x3c')]),_0x561637);if(_0x4e9cb2[_0x4742('0x31')]['filter']){_0x923787['where']=_[_0x4742('0x3d')](_0x923787[_0x4742('0x3a')],{'$or':_[_0x4742('0x29')](_0x561637,function(_0x57f3dc){if(_0x57f3dc[_0x4742('0x2d')]!==_0x4742('0x3e')){var _0x3d4ec3={};_0x3d4ec3[_0x57f3dc['name']]={'$like':'%'+_0x4e9cb2[_0x4742('0x31')][_0x4742('0x3f')]+'%'};return _0x3d4ec3;}})});}_0x923787=_[_0x4742('0x3d')]({},_0x923787,_0x4e9cb2['options']);var _0x2ef5c0={'where':_0x923787[_0x4742('0x3a')]};return db[_0x4742('0x2a')][_0x4742('0x1d')](_0x2ef5c0)[_0x4742('0x24')](function(_0x2eb00b){_0x553984[_0x4742('0x1d')]=_0x2eb00b;if(_0x4e9cb2['query'][_0x4742('0x40')]){_0x923787[_0x4742('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x4742('0x42')](_0x923787);})[_0x4742('0x24')](function(_0x4cc6e7){_0x553984[_0x4742('0x43')]=_0x4cc6e7;return _0x553984;})[_0x4742('0x24')](respondWithFilteredResult(_0x50b2c7,_0x923787))['catch'](handleError(_0x50b2c7,null));};exports[_0x4742('0x44')]=function(_0x3cf671,_0x396864){var _0x139d7e={'raw':![],'where':{'id':_0x3cf671[_0x4742('0x45')]['id']}},_0x143f63={};_0x143f63[_0x4742('0x2f')]=_['keys'](db[_0x4742('0x2a')][_0x4742('0x2b')]);_0x143f63['query']=_['keys'](_0x3cf671[_0x4742('0x31')]);_0x143f63[_0x4742('0x3c')]=_[_0x4742('0x33')](_0x143f63[_0x4742('0x2f')],_0x143f63['query']);_0x139d7e[_0x4742('0x32')]=_['intersection'](_0x143f63[_0x4742('0x2f')],qs[_0x4742('0x34')](_0x3cf671['query']['fields']));_0x139d7e[_0x4742('0x32')]=_0x139d7e['attributes']['length']?_0x139d7e[_0x4742('0x32')]:_0x143f63[_0x4742('0x2f')];if(_0x3cf671[_0x4742('0x31')]['includeAll']){_0x139d7e[_0x4742('0x41')]=[{'all':!![]}];}_0x139d7e=_['merge']({},_0x139d7e,_0x3cf671[_0x4742('0x46')]);return db[_0x4742('0x2a')][_0x4742('0x47')](_0x139d7e)['then'](handleEntityNotFound(_0x396864,null))[_0x4742('0x24')](respondWithResult(_0x396864,null))[_0x4742('0x48')](handleError(_0x396864,null));};exports[_0x4742('0x49')]=function(_0x290051,_0x132ead){return db[_0x4742('0x2a')]['create'](_0x290051[_0x4742('0x4a')],{})[_0x4742('0x24')](respondWithResult(_0x132ead,0xc9))[_0x4742('0x48')](handleError(_0x132ead,null));};exports[_0x4742('0x23')]=function(_0x15a333,_0x3b4b4f){if(_0x15a333[_0x4742('0x4a')]['id']){delete _0x15a333[_0x4742('0x4a')]['id'];}return db[_0x4742('0x2a')][_0x4742('0x47')]({'where':{'id':_0x15a333['params']['id']}})['then'](handleEntityNotFound(_0x3b4b4f,null))[_0x4742('0x24')](saveUpdates(_0x15a333[_0x4742('0x4a')],null))[_0x4742('0x24')](respondWithResult(_0x3b4b4f,null))[_0x4742('0x48')](handleError(_0x3b4b4f,null));};exports[_0x4742('0x25')]=function(_0x3cbb15,_0x458011){return db[_0x4742('0x2a')][_0x4742('0x47')]({'where':{'id':_0x3cbb15[_0x4742('0x45')]['id']}})['then'](handleEntityNotFound(_0x458011,null))[_0x4742('0x24')](removeEntity(_0x458011,null))['catch'](handleError(_0x458011,null));};exports['getFields']=function(_0x34f5a3,_0x31c2a7,_0x1b00c8){var _0x4d4f56={};var _0x2e325a={};var _0x3fb10c;var _0x4cef82;return db[_0x4742('0x2a')][_0x4742('0x4b')]({'where':{'id':_0x34f5a3[_0x4742('0x45')]['id']}})[_0x4742('0x24')](handleEntityNotFound(_0x31c2a7,null))[_0x4742('0x24')](function(_0x5897a9){if(_0x5897a9){_0x3fb10c=_0x5897a9;_0x2e325a[_0x4742('0x2f')]=_[_0x4742('0x30')](db[_0x4742('0x4c')]['rawAttributes']);_0x2e325a[_0x4742('0x31')]=_[_0x4742('0x30')](_0x34f5a3[_0x4742('0x31')]);_0x2e325a[_0x4742('0x3c')]=_[_0x4742('0x33')](_0x2e325a['model'],_0x2e325a[_0x4742('0x31')]);_0x4d4f56['attributes']=_[_0x4742('0x33')](_0x2e325a[_0x4742('0x2f')],qs[_0x4742('0x34')](_0x34f5a3[_0x4742('0x31')][_0x4742('0x34')]));_0x4d4f56[_0x4742('0x32')]=_0x4d4f56['attributes'][_0x4742('0x35')]?_0x4d4f56[_0x4742('0x32')]:_0x2e325a[_0x4742('0x2f')];_0x4d4f56['order']=qs[_0x4742('0x39')](_0x34f5a3[_0x4742('0x31')][_0x4742('0x39')]);_0x4d4f56['where']=qs[_0x4742('0x3c')](_['pick'](_0x34f5a3['query'],_0x2e325a[_0x4742('0x3c')]));if(_0x34f5a3[_0x4742('0x31')][_0x4742('0x3f')]){_0x4d4f56[_0x4742('0x3a')]=_[_0x4742('0x3d')](_0x4d4f56[_0x4742('0x3a')],{'$or':_[_0x4742('0x29')](_0x4d4f56[_0x4742('0x32')],function(_0x1a79ad){var _0x180b23={};_0x180b23[_0x1a79ad]={'$like':'%'+_0x34f5a3[_0x4742('0x31')][_0x4742('0x3f')]+'%'};return _0x180b23;})});}_0x4d4f56=_[_0x4742('0x3d')]({},_0x4d4f56,_0x34f5a3['options']);return _0x3fb10c[_0x4742('0x4d')](_0x4d4f56);}})[_0x4742('0x24')](function(_0x34947d){if(_0x34947d){_0x4cef82=_0x34947d[_0x4742('0x35')];if(!_0x34f5a3[_0x4742('0x31')]['hasOwnProperty']('nolimit')){_0x4d4f56['limit']=qs[_0x4742('0x1c')](_0x34f5a3[_0x4742('0x31')][_0x4742('0x1c')]);_0x4d4f56[_0x4742('0x1b')]=qs[_0x4742('0x1b')](_0x34f5a3[_0x4742('0x31')][_0x4742('0x1b')]);}return _0x3fb10c[_0x4742('0x4d')](_0x4d4f56);}})[_0x4742('0x24')](function(_0x387c7c){if(_0x387c7c){return _0x387c7c?{'count':_0x4cef82,'rows':_0x387c7c}:null;}})[_0x4742('0x24')](respondWithResult(_0x31c2a7,null))[_0x4742('0x48')](handleError(_0x31c2a7,null));};exports[_0x4742('0x4e')]=function(_0x2c56cc,_0x35c3a2,_0x1a99a1){var _0x16dd1b={};var _0x446dce={};var _0x452d7d;var _0x4db838;return db[_0x4742('0x2a')][_0x4742('0x4b')]({'where':{'id':_0x2c56cc[_0x4742('0x45')]['id']}})['then'](handleEntityNotFound(_0x35c3a2,null))[_0x4742('0x24')](function(_0x454427){if(_0x454427){_0x452d7d=_0x454427;_0x446dce[_0x4742('0x2f')]=_[_0x4742('0x30')](db[_0x4742('0x4c')]['rawAttributes']);_0x446dce['query']=_[_0x4742('0x30')](_0x2c56cc['query']);_0x446dce['filters']=_[_0x4742('0x33')](_0x446dce[_0x4742('0x2f')],_0x446dce[_0x4742('0x31')]);_0x16dd1b['attributes']=_[_0x4742('0x33')](_0x446dce[_0x4742('0x2f')],qs[_0x4742('0x34')](_0x2c56cc[_0x4742('0x31')]['fields']));_0x16dd1b[_0x4742('0x32')]=_0x16dd1b[_0x4742('0x32')][_0x4742('0x35')]?_0x16dd1b[_0x4742('0x32')]:_0x446dce[_0x4742('0x2f')];_0x16dd1b[_0x4742('0x38')]=qs['sort'](_0x2c56cc[_0x4742('0x31')]['sort']);_0x16dd1b[_0x4742('0x3a')]=qs['filters'](_[_0x4742('0x3b')](_0x2c56cc['query'],_0x446dce['filters']));if(_0x2c56cc[_0x4742('0x31')][_0x4742('0x3f')]){_0x16dd1b['where']=_[_0x4742('0x3d')](_0x16dd1b[_0x4742('0x3a')],{'$or':_[_0x4742('0x29')](_0x16dd1b[_0x4742('0x32')],function(_0x525e01){var _0x15bc1f={};_0x15bc1f[_0x525e01]={'$like':'%'+_0x2c56cc[_0x4742('0x31')][_0x4742('0x3f')]+'%'};return _0x15bc1f;})});}_0x16dd1b=_[_0x4742('0x3d')]({},_0x16dd1b,_0x2c56cc['options']);return _0x452d7d[_0x4742('0x4e')](_0x16dd1b);}})['then'](function(_0x33ab0a){if(_0x33ab0a){_0x4db838=_0x33ab0a['length'];if(!_0x2c56cc[_0x4742('0x31')][_0x4742('0x36')](_0x4742('0x37'))){_0x16dd1b[_0x4742('0x1c')]=qs[_0x4742('0x1c')](_0x2c56cc[_0x4742('0x31')][_0x4742('0x1c')]);_0x16dd1b[_0x4742('0x1b')]=qs[_0x4742('0x1b')](_0x2c56cc[_0x4742('0x31')][_0x4742('0x1b')]);}return _0x452d7d[_0x4742('0x4e')](_0x16dd1b);}})[_0x4742('0x24')](function(_0x5583dd){if(_0x5583dd){return _0x5583dd?{'count':_0x4db838,'rows':_0x5583dd}:null;}})[_0x4742('0x24')](respondWithResult(_0x35c3a2,null))[_0x4742('0x48')](handleError(_0x35c3a2,null));};exports[_0x4742('0x4f')]=function(_0x13812e,_0x1ac1a1,_0x56556b){var _0x45e8dd={};var _0x2f0a3e={};var _0xcf38b8;var _0x4836b0;return db[_0x4742('0x2a')]['findOne']({'where':{'id':_0x13812e[_0x4742('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ac1a1,null))[_0x4742('0x24')](function(_0xf39b27){if(_0xf39b27){_0xcf38b8=_0xf39b27;_0x2f0a3e['model']=_[_0x4742('0x30')](db[_0x4742('0x4c')][_0x4742('0x2b')]);_0x2f0a3e[_0x4742('0x31')]=_[_0x4742('0x30')](_0x13812e[_0x4742('0x31')]);_0x2f0a3e[_0x4742('0x3c')]=_[_0x4742('0x33')](_0x2f0a3e['model'],_0x2f0a3e['query']);_0x45e8dd[_0x4742('0x32')]=_[_0x4742('0x33')](_0x2f0a3e[_0x4742('0x2f')],qs[_0x4742('0x34')](_0x13812e[_0x4742('0x31')][_0x4742('0x34')]));_0x45e8dd[_0x4742('0x32')]=_0x45e8dd['attributes'][_0x4742('0x35')]?_0x45e8dd['attributes']:_0x2f0a3e[_0x4742('0x2f')];_0x45e8dd[_0x4742('0x38')]=qs[_0x4742('0x39')](_0x13812e[_0x4742('0x31')][_0x4742('0x39')]);_0x45e8dd['where']=qs[_0x4742('0x3c')](_[_0x4742('0x3b')](_0x13812e[_0x4742('0x31')],_0x2f0a3e['filters']));if(_0x13812e[_0x4742('0x31')][_0x4742('0x3f')]){_0x45e8dd[_0x4742('0x3a')]=_[_0x4742('0x3d')](_0x45e8dd[_0x4742('0x3a')],{'$or':_[_0x4742('0x29')](_0x45e8dd[_0x4742('0x32')],function(_0x39e3a0){var _0x2cde5e={};_0x2cde5e[_0x39e3a0]={'$like':'%'+_0x13812e[_0x4742('0x31')]['filter']+'%'};return _0x2cde5e;})});}_0x45e8dd=_[_0x4742('0x3d')]({},_0x45e8dd,_0x13812e[_0x4742('0x46')]);return _0xcf38b8['getDescriptions'](_0x45e8dd);}})[_0x4742('0x24')](function(_0xb9c4e4){if(_0xb9c4e4){_0x4836b0=_0xb9c4e4[_0x4742('0x35')];if(!_0x13812e[_0x4742('0x31')][_0x4742('0x36')](_0x4742('0x37'))){_0x45e8dd[_0x4742('0x1c')]=qs[_0x4742('0x1c')](_0x13812e[_0x4742('0x31')]['limit']);_0x45e8dd[_0x4742('0x1b')]=qs[_0x4742('0x1b')](_0x13812e['query'][_0x4742('0x1b')]);}return _0xcf38b8['getDescriptions'](_0x45e8dd);}})['then'](function(_0x553d39){if(_0x553d39){return _0x553d39?{'count':_0x4836b0,'rows':_0x553d39}:null;}})[_0x4742('0x24')](respondWithResult(_0x1ac1a1,null))['catch'](handleError(_0x1ac1a1,null));};exports['getTags']=function(_0x5217d1,_0x4d35cd,_0xd37753){var _0x38dd93={};var _0x537a3b={};var _0x57212b;var _0x270139;return db[_0x4742('0x2a')][_0x4742('0x4b')]({'where':{'id':_0x5217d1[_0x4742('0x45')]['id']}})[_0x4742('0x24')](handleEntityNotFound(_0x4d35cd,null))[_0x4742('0x24')](function(_0x498963){if(_0x498963){_0x57212b=_0x498963;_0x537a3b['model']=_['keys'](db[_0x4742('0x50')][_0x4742('0x2b')]);_0x537a3b[_0x4742('0x31')]=_['keys'](_0x5217d1[_0x4742('0x31')]);_0x537a3b[_0x4742('0x3c')]=_[_0x4742('0x33')](_0x537a3b[_0x4742('0x2f')],_0x537a3b[_0x4742('0x31')]);_0x38dd93['attributes']=_[_0x4742('0x33')](_0x537a3b['model'],qs['fields'](_0x5217d1[_0x4742('0x31')][_0x4742('0x34')]));_0x38dd93[_0x4742('0x32')]=_0x38dd93[_0x4742('0x32')]['length']?_0x38dd93[_0x4742('0x32')]:_0x537a3b[_0x4742('0x2f')];_0x38dd93[_0x4742('0x38')]=qs[_0x4742('0x39')](_0x5217d1[_0x4742('0x31')][_0x4742('0x39')]);_0x38dd93[_0x4742('0x3a')]=qs[_0x4742('0x3c')](_[_0x4742('0x3b')](_0x5217d1[_0x4742('0x31')],_0x537a3b[_0x4742('0x3c')]));if(_0x5217d1[_0x4742('0x31')][_0x4742('0x3f')]){_0x38dd93[_0x4742('0x3a')]=_[_0x4742('0x3d')](_0x38dd93[_0x4742('0x3a')],{'$or':_['map'](_0x38dd93['attributes'],function(_0x51fdda){var _0xced89d={};_0xced89d[_0x51fdda]={'$like':'%'+_0x5217d1['query'][_0x4742('0x3f')]+'%'};return _0xced89d;})});}_0x38dd93=_[_0x4742('0x3d')]({},_0x38dd93,_0x5217d1[_0x4742('0x46')]);return _0x57212b[_0x4742('0x51')](_0x38dd93);}})['then'](function(_0x286d46){if(_0x286d46){_0x270139=_0x286d46[_0x4742('0x35')];if(!_0x5217d1[_0x4742('0x31')][_0x4742('0x36')](_0x4742('0x37'))){_0x38dd93[_0x4742('0x1c')]=qs[_0x4742('0x1c')](_0x5217d1[_0x4742('0x31')][_0x4742('0x1c')]);_0x38dd93[_0x4742('0x1b')]=qs[_0x4742('0x1b')](_0x5217d1['query'][_0x4742('0x1b')]);}return _0x57212b[_0x4742('0x51')](_0x38dd93);}})[_0x4742('0x24')](function(_0x4cbcec){if(_0x4cbcec){return _0x4cbcec?{'count':_0x270139,'rows':_0x4cbcec}:null;}})[_0x4742('0x24')](respondWithResult(_0x4d35cd,null))[_0x4742('0x48')](handleError(_0x4d35cd,null));};exports['setTags']=function(_0x4973aa,_0x4cdbfb,_0x403326){if(_0x4973aa[_0x4742('0x4a')]['id']){delete _0x4973aa[_0x4742('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x4742('0x4b')]({'where':{'id':_0x4973aa['params']['id']}})[_0x4742('0x24')](handleEntityNotFound(_0x4cdbfb,null))[_0x4742('0x24')](function(_0x37deef){if(_0x37deef){return _0x37deef['setTags'](_0x4973aa[_0x4742('0x4a')][_0x4742('0x52')]||[]);}return null;})[_0x4742('0x24')](respondWithResult(_0x4cdbfb,null))[_0x4742('0x48')](handleError(_0x4cdbfb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 866e764..4038bed 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 _0x4cce=['bluebird','request-promise','./intFreshdeskConfiguration.attributes','define','../../config/logger','api'];(function(_0x445f81,_0x365d26){var _0x500593=function(_0x32da7f){while(--_0x32da7f){_0x445f81['push'](_0x445f81['shift']());}};_0x500593(++_0x365d26);}(_0x4cce,0x196));var _0xe4cc=function(_0x42080a,_0x194178){_0x42080a=_0x42080a-0x0;var _0x15ff84=_0x4cce[_0x42080a];return _0x15ff84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe4cc('0x0'))(_0xe4cc('0x1'));var moment=require('moment');var BPromise=require(_0xe4cc('0x2'));var rp=require(_0xe4cc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4cc('0x4'));module['exports']=function(_0x51c8a5,_0x18602d){return _0x51c8a5[_0xe4cc('0x5')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e17=['int_freshdesk_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1e17,0x1a1));var _0x71e1=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x1e17[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0x71e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x71e1('0x1'));var moment=require(_0x71e1('0x2'));var BPromise=require(_0x71e1('0x3'));var rp=require(_0x71e1('0x4'));var fs=require('fs');var path=require(_0x71e1('0x5'));var rimraf=require(_0x71e1('0x6'));var config=require(_0x71e1('0x7'));var attributes=require(_0x71e1('0x8'));module[_0x71e1('0x9')]=function(_0x3a76c5,_0x57a6e6){return _0x3a76c5[_0x71e1('0xa')](_0x71e1('0xb'),attributes,{'tableName':_0x71e1('0xc'),'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 9d95cea..5178d37 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 _0xc640=['FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../config/logger','../../config/environment','client','http','info'];(function(_0x11aa63,_0x4bce0d){var _0xf90e6d=function(_0x297349){while(--_0x297349){_0x11aa63['push'](_0x11aa63['shift']());}};_0xf90e6d(++_0x4bce0d);}(_0xc640,0x127));var _0x0c64=function(_0x39900d,_0x310fcb){_0x39900d=_0x39900d-0x0;var _0x13090d=_0xc640[_0x39900d];return _0x13090d;};'use strict';var _=require(_0x0c64('0x0'));var util=require(_0x0c64('0x1'));var moment=require(_0x0c64('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c64('0x4'))('rpc');var config=require(_0x0c64('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0c64('0x6')][_0x0c64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x182701,_0x1ca546,_0x560be7){return new BPromise(function(_0x468cb6,_0x265f64){return client['request'](_0x182701,_0x560be7)['then'](function(_0x91ea5a){logger[_0x0c64('0x8')](_0x0c64('0x9'),_0x1ca546,'request\x20sent');logger[_0x0c64('0xa')](_0x0c64('0xb'),_0x1ca546,'request\x20sent',JSON[_0x0c64('0xc')](_0x91ea5a));if(_0x91ea5a['error']){if(_0x91ea5a['error'][_0x0c64('0xd')]===0x1f4){logger[_0x0c64('0xe')](_0x0c64('0x9'),_0x1ca546,_0x91ea5a['error'][_0x0c64('0xf')]);return _0x265f64(_0x91ea5a[_0x0c64('0xe')][_0x0c64('0xf')]);}logger[_0x0c64('0xe')](_0x0c64('0x9'),_0x1ca546,_0x91ea5a[_0x0c64('0xe')][_0x0c64('0xf')]);return _0x468cb6(_0x91ea5a[_0x0c64('0xe')][_0x0c64('0xf')]);}else{logger[_0x0c64('0x8')](_0x0c64('0x9'),_0x1ca546,_0x0c64('0x10'));_0x468cb6(_0x91ea5a[_0x0c64('0x11')][_0x0c64('0xf')]);}})[_0x0c64('0x12')](function(_0x537345){logger['error'](_0x0c64('0x9'),_0x1ca546,_0x537345);_0x265f64(_0x537345);});});} \ No newline at end of file +var _0xb923=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x177cf3,_0x534897){var _0x248dea=function(_0x5266c1){while(--_0x5266c1){_0x177cf3['push'](_0x177cf3['shift']());}};_0x248dea(++_0x534897);}(_0xb923,0x1b3));var _0x3b92=function(_0x5afd82,_0x4c58f1){_0x5afd82=_0x5afd82-0x0;var _0x5de22e=_0xb923[_0x5afd82];return _0x5de22e;};'use strict';var _=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var moment=require('moment');var BPromise=require(_0x3b92('0x2'));var rs=require(_0x3b92('0x3'));var fs=require('fs');var Redis=require(_0x3b92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b92('0x5'));var logger=require(_0x3b92('0x6'))(_0x3b92('0x7'));var config=require(_0x3b92('0x8'));var jayson=require(_0x3b92('0x9'));var client=jayson['client'][_0x3b92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9dc8ce,_0x191c41,_0x23264f){return new BPromise(function(_0x19ad64,_0x385323){return client[_0x3b92('0xb')](_0x9dc8ce,_0x23264f)[_0x3b92('0xc')](function(_0x32e63d){logger[_0x3b92('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x191c41,_0x3b92('0xe'));logger[_0x3b92('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x191c41,_0x3b92('0xe'),JSON[_0x3b92('0x10')](_0x32e63d));if(_0x32e63d[_0x3b92('0x11')]){if(_0x32e63d[_0x3b92('0x11')][_0x3b92('0x12')]===0x1f4){logger[_0x3b92('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x191c41,_0x32e63d['error'][_0x3b92('0x13')]);return _0x385323(_0x32e63d[_0x3b92('0x11')][_0x3b92('0x13')]);}logger[_0x3b92('0x11')](_0x3b92('0x14'),_0x191c41,_0x32e63d[_0x3b92('0x11')][_0x3b92('0x13')]);return _0x19ad64(_0x32e63d['error'][_0x3b92('0x13')]);}else{logger[_0x3b92('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x191c41,_0x3b92('0xe'));_0x19ad64(_0x32e63d[_0x3b92('0x15')][_0x3b92('0x13')]);}})[_0x3b92('0x16')](function(_0x32e029){logger[_0x3b92('0x11')](_0x3b92('0x14'),_0x191c41,_0x32e029);_0x385323(_0x32e029);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f93a8b7..fd8604e 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 _0x958e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2f7343,_0x4fda44){var _0xa655f=function(_0x276eb8){while(--_0x276eb8){_0x2f7343['push'](_0x2f7343['shift']());}};_0xa655f(++_0x4fda44);}(_0x958e,0x118));var _0xe958=function(_0x321c41,_0x289c6f){_0x321c41=_0x321c41-0x0;var _0x2d79cf=_0x958e[_0x321c41];return _0x2d79cf;};'use strict';var multer=require(_0xe958('0x0'));var util=require(_0xe958('0x1'));var path=require(_0xe958('0x2'));var timeout=require(_0xe958('0x3'));var express=require(_0xe958('0x4'));var router=express[_0xe958('0x5')]();var fs_extra=require(_0xe958('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe958('0x7'));var config=require('../../config/environment');var controller=require(_0xe958('0x8'));router['get']('/',auth[_0xe958('0x9')](),controller[_0xe958('0xa')]);router[_0xe958('0xb')]('/:id',auth[_0xe958('0x9')](),controller['show']);router[_0xe958('0xc')]('/',auth['isAuthenticated'](),controller[_0xe958('0xd')]);router[_0xe958('0xe')](_0xe958('0xf'),auth['isAuthenticated'](),controller[_0xe958('0x10')]);router[_0xe958('0x11')](_0xe958('0xf'),auth['isAuthenticated'](),controller[_0xe958('0x12')]);module[_0xe958('0x13')]=router; \ No newline at end of file +var _0x2eeb=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','update','delete','exports'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0x2eeb,0x144));var _0xb2ee=function(_0x3ca68b,_0x2fdcbd){_0x3ca68b=_0x3ca68b-0x0;var _0x2d8e9b=_0x2eeb[_0x3ca68b];return _0x2d8e9b;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require('path');var timeout=require(_0xb2ee('0x2'));var express=require(_0xb2ee('0x3'));var router=express[_0xb2ee('0x4')]();var fs_extra=require(_0xb2ee('0x5'));var auth=require(_0xb2ee('0x6'));var interaction=require(_0xb2ee('0x7'));var config=require(_0xb2ee('0x8'));var controller=require(_0xb2ee('0x9'));router[_0xb2ee('0xa')]('/',auth[_0xb2ee('0xb')](),controller[_0xb2ee('0xc')]);router[_0xb2ee('0xa')](_0xb2ee('0xd'),auth[_0xb2ee('0xb')](),controller[_0xb2ee('0xe')]);router['post']('/',auth[_0xb2ee('0xb')](),controller['create']);router['put']('/:id',auth[_0xb2ee('0xb')](),controller[_0xb2ee('0xf')]);router[_0xb2ee('0x10')](_0xb2ee('0xd'),auth[_0xb2ee('0xb')](),controller['destroy']);module[_0xb2ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7dc3884..5006ccc 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 _0xf9d9=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xf9d9,0x15c));var _0x9f9d=function(_0x2dc098,_0x48eb28){_0x2dc098=_0x2dc098-0x0;var _0x391d8d=_0xf9d9[_0x2dc098];return _0x391d8d;};'use strict';var Sequelize=require(_0x9f9d('0x0'));module[_0x9f9d('0x1')]={'type':{'type':Sequelize[_0x9f9d('0x2')](_0x9f9d('0x3'),'variable',_0x9f9d('0x4'),_0x9f9d('0x5'),_0x9f9d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9f9d('0x7')]},'key':{'type':Sequelize[_0x9f9d('0x7')]},'keyType':{'type':Sequelize[_0x9f9d('0x2')](_0x9f9d('0x3'),_0x9f9d('0x8'),_0x9f9d('0x4'))},'keyContent':{'type':Sequelize[_0x9f9d('0x7')]},'idField':{'type':Sequelize[_0x9f9d('0x7')]},'nameField':{'type':Sequelize[_0x9f9d('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f9d('0x7')]}}; \ No newline at end of file +var _0x0df0=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x0df0,0x190));var _0x00df=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0x0df0[_0x21c23e];return _0xa7b7e2;};'use strict';var Sequelize=require(_0x00df('0x0'));module[_0x00df('0x1')]={'type':{'type':Sequelize[_0x00df('0x2')](_0x00df('0x3'),_0x00df('0x4'),_0x00df('0x5'),'keyValue','picklist'),'defaultValue':_0x00df('0x3')},'content':{'type':Sequelize[_0x00df('0x6')]},'key':{'type':Sequelize[_0x00df('0x6')]},'keyType':{'type':Sequelize[_0x00df('0x2')]('string',_0x00df('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x00df('0x6')]},'nameField':{'type':Sequelize[_0x00df('0x6')]},'customField':{'type':Sequelize[_0x00df('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00df('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3f8e5de..ad9e906 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 _0xa699=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskField','includeAll','include','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send'];(function(_0x42bbcb,_0x54a555){var _0x220625=function(_0x263c73){while(--_0x263c73){_0x42bbcb['push'](_0x42bbcb['shift']());}};_0x220625(++_0x54a555);}(_0xa699,0x6b));var _0x9a69=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0xa699[_0x46b22a];return _0x44c2e8;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];function respondWithStatusCode(_0x56e43f,_0x81dfb1){_0x81dfb1=_0x81dfb1||0xcc;return function(_0x2e613e){if(_0x2e613e){return _0x56e43f[_0x9a69('0x1a')](_0x81dfb1);}return _0x56e43f[_0x9a69('0x1b')](_0x81dfb1)[_0x9a69('0x1c')]();};}function respondWithResult(_0x70475b,_0x34b5b0){_0x34b5b0=_0x34b5b0||0xc8;return function(_0x2a5b83){if(_0x2a5b83){return _0x70475b[_0x9a69('0x1b')](_0x34b5b0)['json'](_0x2a5b83);}};}function respondWithFilteredResult(_0x2323ae,_0x17de41){return function(_0x2be3ec){if(_0x2be3ec){var _0x5e982d=typeof _0x17de41[_0x9a69('0x1d')]===_0x9a69('0x1e')&&typeof _0x17de41[_0x9a69('0x1f')]===_0x9a69('0x1e');var _0xed2c19=_0x2be3ec['count'];var _0x2e4264=_0x5e982d?0x0:_0x17de41[_0x9a69('0x1d')];var _0x186a5a=_0x5e982d?_0x2be3ec[_0x9a69('0x20')]:_0x17de41[_0x9a69('0x1d')]+_0x17de41[_0x9a69('0x1f')];var _0x2633d5;if(_0x186a5a>=_0xed2c19){_0x186a5a=_0xed2c19;_0x2633d5=0xc8;}else{_0x2633d5=0xce;}_0x2323ae[_0x9a69('0x1b')](_0x2633d5);return _0x2323ae[_0x9a69('0x21')](_0x9a69('0x22'),_0x2e4264+'-'+_0x186a5a+'/'+_0xed2c19)['json'](_0x2be3ec);}return null;};}function patchUpdates(_0x4d8db9){return function(_0x5ebb09){try{jsonpatch[_0x9a69('0x23')](_0x5ebb09,_0x4d8db9,!![]);}catch(_0x12ebe5){return BPromise['reject'](_0x12ebe5);}return _0x5ebb09[_0x9a69('0x24')]();};}function saveUpdates(_0x527ca6,_0x265291){return function(_0x4d6a93){if(_0x4d6a93){return _0x4d6a93['update'](_0x527ca6)['then'](function(_0x189989){return _0x189989;});}return null;};}function removeEntity(_0x5f4138,_0x140cbe){return function(_0x28f5f7){if(_0x28f5f7){return _0x28f5f7[_0x9a69('0x25')]()[_0x9a69('0x26')](function(){_0x5f4138['status'](0xcc)[_0x9a69('0x1c')]();});}};}function handleEntityNotFound(_0x5130b2,_0x203d32){return function(_0x4ef126){if(!_0x4ef126){_0x5130b2['sendStatus'](0x194);}return _0x4ef126;};}function handleError(_0xbcdcd9,_0xf6fea2){_0xf6fea2=_0xf6fea2||0x1f4;return function(_0x268cef){logger[_0x9a69('0x27')](_0x268cef[_0x9a69('0x28')]);if(_0x268cef[_0x9a69('0x29')]){delete _0x268cef[_0x9a69('0x29')];}_0xbcdcd9[_0x9a69('0x1b')](_0xf6fea2)[_0x9a69('0x2a')](_0x268cef);};}exports[_0x9a69('0x2b')]=function(_0x47916a,_0x1ff48e){var _0x165a87={},_0x5433b3={},_0x54e643={'count':0x0,'rows':[]};var _0x4b3539=_[_0x9a69('0x2c')](db['FreshdeskField'][_0x9a69('0x2d')],function(_0x2d15e3){return{'name':_0x2d15e3[_0x9a69('0x2e')],'type':_0x2d15e3[_0x9a69('0x2f')][_0x9a69('0x30')]};});_0x5433b3[_0x9a69('0x31')]=_[_0x9a69('0x2c')](_0x4b3539,_0x9a69('0x29'));_0x5433b3[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x47916a[_0x9a69('0x32')]);_0x5433b3[_0x9a69('0x34')]=_[_0x9a69('0x35')](_0x5433b3[_0x9a69('0x31')],_0x5433b3[_0x9a69('0x32')]);_0x165a87[_0x9a69('0x36')]=_[_0x9a69('0x35')](_0x5433b3['model'],qs['fields'](_0x47916a[_0x9a69('0x32')][_0x9a69('0x37')]));_0x165a87[_0x9a69('0x36')]=_0x165a87[_0x9a69('0x36')][_0x9a69('0x38')]?_0x165a87['attributes']:_0x5433b3['model'];if(!_0x47916a['query']['hasOwnProperty'](_0x9a69('0x39'))){_0x165a87[_0x9a69('0x1f')]=qs[_0x9a69('0x1f')](_0x47916a[_0x9a69('0x32')][_0x9a69('0x1f')]);_0x165a87[_0x9a69('0x1d')]=qs['offset'](_0x47916a['query'][_0x9a69('0x1d')]);}_0x165a87[_0x9a69('0x3a')]=qs[_0x9a69('0x3b')](_0x47916a['query'][_0x9a69('0x3b')]);_0x165a87[_0x9a69('0x3c')]=qs[_0x9a69('0x34')](_[_0x9a69('0x3d')](_0x47916a[_0x9a69('0x32')],_0x5433b3[_0x9a69('0x34')]),_0x4b3539);if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]){_0x165a87[_0x9a69('0x3c')]=_[_0x9a69('0x3f')](_0x165a87[_0x9a69('0x3c')],{'$or':_['map'](_0x4b3539,function(_0x1ac0b7){if(_0x1ac0b7['type']!=='VIRTUAL'){var _0x4cc399={};_0x4cc399[_0x1ac0b7['name']]={'$like':'%'+_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]+'%'};return _0x4cc399;}})});}_0x165a87=_['merge']({},_0x165a87,_0x47916a['options']);var _0x5a1e62={'where':_0x165a87[_0x9a69('0x3c')]};return db[_0x9a69('0x40')][_0x9a69('0x20')](_0x5a1e62)['then'](function(_0x2ff507){_0x54e643[_0x9a69('0x20')]=_0x2ff507;if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x41')]){_0x165a87[_0x9a69('0x42')]=[{'all':!![]}];}return db[_0x9a69('0x40')]['findAll'](_0x165a87);})[_0x9a69('0x26')](function(_0x27d0db){_0x54e643[_0x9a69('0x43')]=_0x27d0db;return _0x54e643;})[_0x9a69('0x26')](respondWithFilteredResult(_0x1ff48e,_0x165a87))['catch'](handleError(_0x1ff48e,null));};exports[_0x9a69('0x44')]=function(_0x373939,_0x5b309a){var _0x318de1={'raw':!![],'where':{'id':_0x373939[_0x9a69('0x45')]['id']}},_0x3c78e2={};_0x3c78e2['model']=_['keys'](db['FreshdeskField'][_0x9a69('0x2d')]);_0x3c78e2[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x373939[_0x9a69('0x32')]);_0x3c78e2['filters']=_[_0x9a69('0x35')](_0x3c78e2[_0x9a69('0x31')],_0x3c78e2[_0x9a69('0x32')]);_0x318de1[_0x9a69('0x36')]=_['intersection'](_0x3c78e2[_0x9a69('0x31')],qs[_0x9a69('0x37')](_0x373939[_0x9a69('0x32')][_0x9a69('0x37')]));_0x318de1['attributes']=_0x318de1[_0x9a69('0x36')]['length']?_0x318de1[_0x9a69('0x36')]:_0x3c78e2['model'];if(_0x373939[_0x9a69('0x32')]['includeAll']){_0x318de1[_0x9a69('0x42')]=[{'all':!![]}];}_0x318de1=_['merge']({},_0x318de1,_0x373939[_0x9a69('0x46')]);return db[_0x9a69('0x40')][_0x9a69('0x47')](_0x318de1)[_0x9a69('0x26')](handleEntityNotFound(_0x5b309a,null))['then'](respondWithResult(_0x5b309a,null))[_0x9a69('0x48')](handleError(_0x5b309a,null));};exports[_0x9a69('0x49')]=function(_0x77781d,_0x2537b0){return db[_0x9a69('0x40')][_0x9a69('0x49')](_0x77781d[_0x9a69('0x4a')],{})[_0x9a69('0x26')](respondWithResult(_0x2537b0,0xc9))[_0x9a69('0x48')](handleError(_0x2537b0,null));};exports['update']=function(_0x281ef0,_0x6046a7){if(_0x281ef0[_0x9a69('0x4a')]['id']){delete _0x281ef0[_0x9a69('0x4a')]['id'];}return db[_0x9a69('0x40')][_0x9a69('0x47')]({'where':{'id':_0x281ef0[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x6046a7,null))[_0x9a69('0x26')](saveUpdates(_0x281ef0[_0x9a69('0x4a')],null))[_0x9a69('0x26')](respondWithResult(_0x6046a7,null))[_0x9a69('0x48')](handleError(_0x6046a7,null));};exports[_0x9a69('0x25')]=function(_0x43b084,_0x18ab7a){return db['FreshdeskField'][_0x9a69('0x47')]({'where':{'id':_0x43b084[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x18ab7a,null))[_0x9a69('0x26')](removeEntity(_0x18ab7a,null))[_0x9a69('0x48')](handleError(_0x18ab7a,null));}; \ No newline at end of file +var _0x5ff3=['json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','name','index','map','FreshdeskField','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end'];(function(_0x2426ee,_0x1dcafe){var _0xeca255=function(_0x28f191){while(--_0x28f191){_0x2426ee['push'](_0x2426ee['shift']());}};_0xeca255(++_0x1dcafe);}(_0x5ff3,0x17d));var _0x35ff=function(_0x43c6e8,_0x2bb1e1){_0x43c6e8=_0x43c6e8-0x0;var _0x5bda11=_0x5ff3[_0x43c6e8];return _0x5bda11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426e4e,_0x5ad0c6){return function(_0x4c46b7){if(!_0x4c46b7){_0x426e4e[_0x35ff('0x1f')](0x194);}return _0x4c46b7;};}function handleError(_0x9e2789,_0x95b9e2){_0x95b9e2=_0x95b9e2||0x1f4;return function(_0x11a5eb){logger[_0x35ff('0x20')](_0x11a5eb['stack']);if(_0x11a5eb[_0x35ff('0x21')]){delete _0x11a5eb[_0x35ff('0x21')];}_0x9e2789[_0x35ff('0x13')](_0x95b9e2)['send'](_0x11a5eb);};}exports[_0x35ff('0x22')]=function(_0x1f51c5,_0x3b4331){var _0x6d5407={},_0x47fcb5={},_0x61b554={'count':0x0,'rows':[]};var _0x1afc98=_[_0x35ff('0x23')](db[_0x35ff('0x24')]['rawAttributes'],function(_0x3f9440){return{'name':_0x3f9440['fieldName'],'type':_0x3f9440[_0x35ff('0x25')][_0x35ff('0x26')]};});_0x47fcb5[_0x35ff('0x27')]=_[_0x35ff('0x23')](_0x1afc98,'name');_0x47fcb5[_0x35ff('0x28')]=_['keys'](_0x1f51c5[_0x35ff('0x28')]);_0x47fcb5[_0x35ff('0x29')]=_['intersection'](_0x47fcb5['model'],_0x47fcb5[_0x35ff('0x28')]);_0x6d5407[_0x35ff('0x2a')]=_['intersection'](_0x47fcb5[_0x35ff('0x27')],qs[_0x35ff('0x2b')](_0x1f51c5['query'][_0x35ff('0x2b')]));_0x6d5407[_0x35ff('0x2a')]=_0x6d5407[_0x35ff('0x2a')][_0x35ff('0x2c')]?_0x6d5407[_0x35ff('0x2a')]:_0x47fcb5[_0x35ff('0x27')];if(!_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x2d')](_0x35ff('0x2e'))){_0x6d5407[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x18')]);_0x6d5407['offset']=qs[_0x35ff('0x16')](_0x1f51c5['query'][_0x35ff('0x16')]);}_0x6d5407[_0x35ff('0x2f')]=qs[_0x35ff('0x30')](_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x30')]);_0x6d5407['where']=qs[_0x35ff('0x29')](_[_0x35ff('0x31')](_0x1f51c5[_0x35ff('0x28')],_0x47fcb5[_0x35ff('0x29')]),_0x1afc98);if(_0x1f51c5[_0x35ff('0x28')]['filter']){_0x6d5407[_0x35ff('0x32')]=_[_0x35ff('0x33')](_0x6d5407[_0x35ff('0x32')],{'$or':_['map'](_0x1afc98,function(_0x4b98d2){if(_0x4b98d2[_0x35ff('0x25')]!==_0x35ff('0x34')){var _0x1f2a53={};_0x1f2a53[_0x4b98d2[_0x35ff('0x21')]]={'$like':'%'+_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x35')]+'%'};return _0x1f2a53;}})});}_0x6d5407=_[_0x35ff('0x33')]({},_0x6d5407,_0x1f51c5[_0x35ff('0x36')]);var _0x5dc229={'where':_0x6d5407['where']};return db['FreshdeskField'][_0x35ff('0x19')](_0x5dc229)[_0x35ff('0x1e')](function(_0x10088a){_0x61b554[_0x35ff('0x19')]=_0x10088a;if(_0x1f51c5[_0x35ff('0x28')]['includeAll']){_0x6d5407[_0x35ff('0x37')]=[{'all':!![]}];}return db[_0x35ff('0x24')][_0x35ff('0x38')](_0x6d5407);})[_0x35ff('0x1e')](function(_0x117ee6){_0x61b554[_0x35ff('0x39')]=_0x117ee6;return _0x61b554;})['then'](respondWithFilteredResult(_0x3b4331,_0x6d5407))['catch'](handleError(_0x3b4331,null));};exports[_0x35ff('0x3a')]=function(_0x1fb1ed,_0x14d741){var _0x21b123={'raw':!![],'where':{'id':_0x1fb1ed['params']['id']}},_0x4b1e3e={};_0x4b1e3e[_0x35ff('0x27')]=_[_0x35ff('0x3b')](db[_0x35ff('0x24')][_0x35ff('0x3c')]);_0x4b1e3e[_0x35ff('0x28')]=_[_0x35ff('0x3b')](_0x1fb1ed[_0x35ff('0x28')]);_0x4b1e3e['filters']=_['intersection'](_0x4b1e3e[_0x35ff('0x27')],_0x4b1e3e[_0x35ff('0x28')]);_0x21b123[_0x35ff('0x2a')]=_['intersection'](_0x4b1e3e[_0x35ff('0x27')],qs[_0x35ff('0x2b')](_0x1fb1ed['query']['fields']));_0x21b123[_0x35ff('0x2a')]=_0x21b123['attributes'][_0x35ff('0x2c')]?_0x21b123[_0x35ff('0x2a')]:_0x4b1e3e['model'];if(_0x1fb1ed[_0x35ff('0x28')]['includeAll']){_0x21b123['include']=[{'all':!![]}];}_0x21b123=_[_0x35ff('0x33')]({},_0x21b123,_0x1fb1ed[_0x35ff('0x36')]);return db[_0x35ff('0x24')][_0x35ff('0x3d')](_0x21b123)[_0x35ff('0x1e')](handleEntityNotFound(_0x14d741,null))[_0x35ff('0x1e')](respondWithResult(_0x14d741,null))[_0x35ff('0x3e')](handleError(_0x14d741,null));};exports[_0x35ff('0x3f')]=function(_0x10a290,_0xee99f9){return db[_0x35ff('0x24')][_0x35ff('0x3f')](_0x10a290['body'],{})[_0x35ff('0x1e')](respondWithResult(_0xee99f9,0xc9))[_0x35ff('0x3e')](handleError(_0xee99f9,null));};exports[_0x35ff('0x1d')]=function(_0x2d26e2,_0x506def){if(_0x2d26e2['body']['id']){delete _0x2d26e2[_0x35ff('0x40')]['id'];}return db['FreshdeskField'][_0x35ff('0x3d')]({'where':{'id':_0x2d26e2[_0x35ff('0x41')]['id']}})[_0x35ff('0x1e')](handleEntityNotFound(_0x506def,null))[_0x35ff('0x1e')](saveUpdates(_0x2d26e2[_0x35ff('0x40')],null))[_0x35ff('0x1e')](respondWithResult(_0x506def,null))[_0x35ff('0x3e')](handleError(_0x506def,null));};exports[_0x35ff('0x42')]=function(_0x3be5fc,_0x535cc8){return db['FreshdeskField'][_0x35ff('0x3d')]({'where':{'id':_0x3be5fc['params']['id']}})[_0x35ff('0x1e')](handleEntityNotFound(_0x535cc8,null))[_0x35ff('0x1e')](removeEntity(_0x535cc8,null))[_0x35ff('0x3e')](handleError(_0x535cc8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f4f57e7..7a7f89b 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 _0x9fd0=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9fd0,0x9d));var _0x09fd=function(_0x33a399,_0x37ce26){_0x33a399=_0x33a399-0x0;var _0xb5b030=_0x9fd0[_0x33a399];return _0xb5b030;};'use strict';var _=require(_0x09fd('0x0'));var util=require(_0x09fd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09fd('0x2'));var BPromise=require(_0x09fd('0x3'));var rp=require(_0x09fd('0x4'));var fs=require('fs');var path=require(_0x09fd('0x5'));var rimraf=require(_0x09fd('0x6'));var config=require(_0x09fd('0x7'));var attributes=require(_0x09fd('0x8'));module[_0x09fd('0x9')]=function(_0x819b69,_0x2ec740){return _0x819b69[_0x09fd('0xa')](_0x09fd('0xb'),attributes,{'tableName':_0x09fd('0xc'),'paranoid':![],'indexes':[{'name':_0x09fd('0xd'),'fields':['idField',_0x09fd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0f5=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x288478,_0x23303e){var _0x234c05=function(_0x4ff5a5){while(--_0x4ff5a5){_0x288478['push'](_0x288478['shift']());}};_0x234c05(++_0x23303e);}(_0xd0f5,0xb6));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var logger=require(_0x5d0f('0x2'))(_0x5d0f('0x3'));var moment=require('moment');var BPromise=require(_0x5d0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d0f('0x5'));var rimraf=require('rimraf');var config=require(_0x5d0f('0x6'));var attributes=require(_0x5d0f('0x7'));module['exports']=function(_0x15c39d,_0x4cd5dc){return _0x15c39d[_0x5d0f('0x8')](_0x5d0f('0x9'),attributes,{'tableName':_0x5d0f('0xa'),'paranoid':![],'indexes':[{'name':_0x5d0f('0xb'),'fields':[_0x5d0f('0xc'),_0x5d0f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c81d3e6..c1299ad 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 _0x4706=['jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x36610a,_0x5954f0){var _0x56e2ad=function(_0x577d45){while(--_0x577d45){_0x36610a['push'](_0x36610a['shift']());}};_0x56e2ad(++_0x5954f0);}(_0x4706,0x19d));var _0x6470=function(_0x33671f,_0x5b20ec){_0x33671f=_0x33671f-0x0;var _0xb3705e=_0x4706[_0x33671f];return _0xb3705e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6470('0x0'));var rs=require(_0x6470('0x1'));var fs=require('fs');var Redis=require(_0x6470('0x2'));var db=require(_0x6470('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6470('0x4'))(_0x6470('0x5'));var config=require(_0x6470('0x6'));var jayson=require(_0x6470('0x7'));var client=jayson['client'][_0x6470('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11a0a7,_0x2e5420,_0x392726){return new BPromise(function(_0x46846d,_0x5809b8){return client['request'](_0x11a0a7,_0x392726)[_0x6470('0x9')](function(_0x26f326){logger[_0x6470('0xa')](_0x6470('0xb'),_0x2e5420,'request\x20sent');logger[_0x6470('0xc')](_0x6470('0xd'),_0x2e5420,_0x6470('0xe'),JSON[_0x6470('0xf')](_0x26f326));if(_0x26f326[_0x6470('0x10')]){if(_0x26f326[_0x6470('0x10')][_0x6470('0x11')]===0x1f4){logger[_0x6470('0x10')](_0x6470('0xb'),_0x2e5420,_0x26f326[_0x6470('0x10')]['message']);return _0x5809b8(_0x26f326[_0x6470('0x10')][_0x6470('0x12')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2e5420,_0x26f326[_0x6470('0x10')][_0x6470('0x12')]);return _0x46846d(_0x26f326[_0x6470('0x10')][_0x6470('0x12')]);}else{logger[_0x6470('0xa')](_0x6470('0xb'),_0x2e5420,'request\x20sent');_0x46846d(_0x26f326[_0x6470('0x13')][_0x6470('0x12')]);}})[_0x6470('0x14')](function(_0x16a665){logger[_0x6470('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x2e5420,_0x16a665);_0x5809b8(_0x16a665);});});} \ No newline at end of file +var _0x9c88=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x51ff44,_0x3a2464){var _0x2a22fe=function(_0x75828e){while(--_0x75828e){_0x51ff44['push'](_0x51ff44['shift']());}};_0x2a22fe(++_0x3a2464);}(_0x9c88,0x1cc));var _0x89c8=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x9c88[_0x438912];return _0x18112f;};'use strict';var _=require(_0x89c8('0x0'));var util=require('util');var moment=require(_0x89c8('0x1'));var BPromise=require(_0x89c8('0x2'));var rs=require(_0x89c8('0x3'));var fs=require('fs');var Redis=require(_0x89c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x89c8('0x5'));var logger=require(_0x89c8('0x6'))(_0x89c8('0x7'));var config=require(_0x89c8('0x8'));var jayson=require(_0x89c8('0x9'));var client=jayson[_0x89c8('0xa')][_0x89c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x241f53,_0x1dc9e8,_0x3768bd){return new BPromise(function(_0x53251c,_0x16f03c){return client[_0x89c8('0xc')](_0x241f53,_0x3768bd)['then'](function(_0x3530b9){logger[_0x89c8('0xd')](_0x89c8('0xe'),_0x1dc9e8,'request\x20sent');logger[_0x89c8('0xf')](_0x89c8('0x10'),_0x1dc9e8,_0x89c8('0x11'),JSON[_0x89c8('0x12')](_0x3530b9));if(_0x3530b9[_0x89c8('0x13')]){if(_0x3530b9[_0x89c8('0x13')][_0x89c8('0x14')]===0x1f4){logger[_0x89c8('0x13')](_0x89c8('0xe'),_0x1dc9e8,_0x3530b9[_0x89c8('0x13')][_0x89c8('0x15')]);return _0x16f03c(_0x3530b9[_0x89c8('0x13')]['message']);}logger[_0x89c8('0x13')](_0x89c8('0xe'),_0x1dc9e8,_0x3530b9[_0x89c8('0x13')][_0x89c8('0x15')]);return _0x53251c(_0x3530b9[_0x89c8('0x13')][_0x89c8('0x15')]);}else{logger[_0x89c8('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x1dc9e8,_0x89c8('0x11'));_0x53251c(_0x3530b9[_0x89c8('0x16')][_0x89c8('0x15')]);}})[_0x89c8('0x17')](function(_0x4ebba4){logger[_0x89c8('0x13')](_0x89c8('0xe'),_0x1dc9e8,_0x4ebba4);_0x16f03c(_0x4ebba4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 888c4b3..8710c0c 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 _0xbf6e=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x399131,_0x2db855){var _0xce76e2=function(_0x175a64){while(--_0x175a64){_0x399131['push'](_0x399131['shift']());}};_0xce76e2(++_0x2db855);}(_0xbf6e,0x149));var _0xebf6=function(_0x404991,_0x5a9865){_0x404991=_0x404991-0x0;var _0x429b45=_0xbf6e[_0x404991];return _0x429b45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0x8')](_0xebf6('0xc'),auth[_0xebf6('0x9')](),controller['getConfigurations']);router[_0xebf6('0x8')](_0xebf6('0xd'),auth['isAuthenticated'](),controller[_0xebf6('0xe')]);router[_0xebf6('0xf')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0x10')]);router[_0xebf6('0xf')](_0xebf6('0xc'),auth['isAuthenticated'](),controller[_0xebf6('0x11')]);router[_0xebf6('0x12')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0x13')]);router[_0xebf6('0x14')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9354=['addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x294896,_0x587a82){var _0x1c3d55=function(_0xef50f9){while(--_0xef50f9){_0x294896['push'](_0x294896['shift']());}};_0x1c3d55(++_0x587a82);}(_0x9354,0x96));var _0x4935=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0x9354[_0x399d76];return _0x3b19a1;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4935('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x15')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);module[_0x4935('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 e5c62a7..0d91d6c 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 _0x065e=['sequelize','STRING','username'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x065e,0x1a7));var _0xe065=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x065e[_0x2afbb0];return _0x411ff2;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4a5629,_0x18e231){var _0x515cba=function(_0x4fbc6f){while(--_0x4fbc6f){_0x4a5629['push'](_0x4a5629['shift']());}};_0x515cba(++_0x18e231);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2ed42e7..b05cd47 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 _0xee10=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','save','update','destroy','stack','send','index','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','then','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','catch','find','getConfigurations','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','findOne','apiKey','remoteUri','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields','stringify','name','test','eml-format'];(function(_0x4d745e,_0x508b76){var _0x4b759a=function(_0x22813a){while(--_0x22813a){_0x4d745e['push'](_0x4d745e['shift']());}};_0x4b759a(++_0x508b76);}(_0xee10,0x66));var _0x0ee1=function(_0xd52aa4,_0x52c8a0){_0xd52aa4=_0xd52aa4-0x0;var _0x5100b3=_0xee10[_0xd52aa4];return _0x5100b3;};'use strict';var emlformat=require(_0x0ee1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ee1('0x1'));var jsonpatch=require(_0x0ee1('0x2'));var rp=require(_0x0ee1('0x3'));var moment=require(_0x0ee1('0x4'));var BPromise=require(_0x0ee1('0x5'));var Mustache=require(_0x0ee1('0x6'));var util=require(_0x0ee1('0x7'));var path=require(_0x0ee1('0x8'));var sox=require(_0x0ee1('0x9'));var csv=require(_0x0ee1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ee1('0xb'));var _=require(_0x0ee1('0xc'));var squel=require('squel');var crypto=require(_0x0ee1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ee1('0xe'));var toCsv=require(_0x0ee1('0xa'));var querystring=require(_0x0ee1('0xf'));var Papa=require(_0x0ee1('0x10'));var Redis=require(_0x0ee1('0x11'));var authService=require(_0x0ee1('0x12'));var qs=require(_0x0ee1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ee1('0x14'));var logger=require(_0x0ee1('0x15'))(_0x0ee1('0x16'));var utils=require(_0x0ee1('0x17'));var config=require(_0x0ee1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0ee1('0x19'));function respondWithStatusCode(_0xa0438,_0x31cc64){_0x31cc64=_0x31cc64||0xcc;return function(_0x3c3b12){if(_0x3c3b12){return _0xa0438[_0x0ee1('0x1a')](_0x31cc64);}return _0xa0438[_0x0ee1('0x1b')](_0x31cc64)[_0x0ee1('0x1c')]();};}function respondWithResult(_0x264f3f,_0x282f95){_0x282f95=_0x282f95||0xc8;return function(_0x1171bd){if(_0x1171bd){return _0x264f3f[_0x0ee1('0x1b')](_0x282f95)[_0x0ee1('0x1d')](_0x1171bd);}};}function respondWithFilteredResult(_0xc59468,_0x241575){return function(_0x498d9f){if(_0x498d9f){var _0x2f79c1=typeof _0x241575[_0x0ee1('0x1e')]==='undefined'&&typeof _0x241575[_0x0ee1('0x1f')]===_0x0ee1('0x20');var _0x422775=_0x498d9f['count'];var _0x541c3c=_0x2f79c1?0x0:_0x241575[_0x0ee1('0x1e')];var _0x59d31a=_0x2f79c1?_0x498d9f['count']:_0x241575[_0x0ee1('0x1e')]+_0x241575['limit'];var _0x41dc1a;if(_0x59d31a>=_0x422775){_0x59d31a=_0x422775;_0x41dc1a=0xc8;}else{_0x41dc1a=0xce;}_0xc59468['status'](_0x41dc1a);return _0xc59468[_0x0ee1('0x21')](_0x0ee1('0x22'),_0x541c3c+'-'+_0x59d31a+'/'+_0x422775)[_0x0ee1('0x1d')](_0x498d9f);}return null;};}function patchUpdates(_0x39ba89){return function(_0x38f858){try{jsonpatch['apply'](_0x38f858,_0x39ba89,!![]);}catch(_0x5ed4c4){return BPromise['reject'](_0x5ed4c4);}return _0x38f858[_0x0ee1('0x23')]();};}function saveUpdates(_0x64e504,_0x210974){return function(_0x5eaedc){if(_0x5eaedc){return _0x5eaedc[_0x0ee1('0x24')](_0x64e504)['then'](function(_0x3298e6){return _0x3298e6;});}return null;};}function removeEntity(_0x17e20a,_0x4ebee7){return function(_0x235b62){if(_0x235b62){return _0x235b62[_0x0ee1('0x25')]()['then'](function(){_0x17e20a[_0x0ee1('0x1b')](0xcc)[_0x0ee1('0x1c')]();});}};}function handleEntityNotFound(_0x5a6c7d,_0x20f2e0){return function(_0x3b9fed){if(!_0x3b9fed){_0x5a6c7d['sendStatus'](0x194);}return _0x3b9fed;};}function handleError(_0x37389d,_0x22024d){_0x22024d=_0x22024d||0x1f4;return function(_0x324a91){logger['error'](_0x324a91[_0x0ee1('0x26')]);if(_0x324a91['name']){delete _0x324a91['name'];}_0x37389d[_0x0ee1('0x1b')](_0x22024d)[_0x0ee1('0x27')](_0x324a91);};}exports[_0x0ee1('0x28')]=function(_0x26eedf,_0x3e384c){var _0x23b093={},_0x5a24c1={},_0x25bf49={'count':0x0,'rows':[]};var _0x1876bb=_['map'](db[_0x0ee1('0x29')]['rawAttributes'],function(_0x15dd8e){return{'name':_0x15dd8e[_0x0ee1('0x2a')],'type':_0x15dd8e[_0x0ee1('0x2b')][_0x0ee1('0x2c')]};});_0x5a24c1[_0x0ee1('0x2d')]=_['map'](_0x1876bb,'name');_0x5a24c1[_0x0ee1('0x2e')]=_[_0x0ee1('0x2f')](_0x26eedf[_0x0ee1('0x2e')]);_0x5a24c1[_0x0ee1('0x30')]=_['intersection'](_0x5a24c1[_0x0ee1('0x2d')],_0x5a24c1[_0x0ee1('0x2e')]);_0x23b093[_0x0ee1('0x31')]=_[_0x0ee1('0x32')](_0x5a24c1[_0x0ee1('0x2d')],qs[_0x0ee1('0x33')](_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x33')]));_0x23b093[_0x0ee1('0x31')]=_0x23b093[_0x0ee1('0x31')][_0x0ee1('0x34')]?_0x23b093[_0x0ee1('0x31')]:_0x5a24c1[_0x0ee1('0x2d')];if(!_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x35')]('nolimit')){_0x23b093[_0x0ee1('0x1f')]=qs['limit'](_0x26eedf[_0x0ee1('0x2e')]['limit']);_0x23b093[_0x0ee1('0x1e')]=qs[_0x0ee1('0x1e')](_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x1e')]);}_0x23b093[_0x0ee1('0x36')]=qs[_0x0ee1('0x37')](_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x37')]);_0x23b093[_0x0ee1('0x38')]=qs['filters'](_[_0x0ee1('0x39')](_0x26eedf[_0x0ee1('0x2e')],_0x5a24c1[_0x0ee1('0x30')]),_0x1876bb);if(_0x26eedf['query'][_0x0ee1('0x3a')]){_0x23b093[_0x0ee1('0x38')]=_[_0x0ee1('0x3b')](_0x23b093[_0x0ee1('0x38')],{'$or':_[_0x0ee1('0x3c')](_0x1876bb,function(_0x328baa){if(_0x328baa[_0x0ee1('0x2b')]!==_0x0ee1('0x3d')){var _0x458a3c={};_0x458a3c[_0x328baa['name']]={'$like':'%'+_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x3a')]+'%'};return _0x458a3c;}})});}_0x23b093=_[_0x0ee1('0x3b')]({},_0x23b093,_0x26eedf[_0x0ee1('0x3e')]);var _0xff2d0a={'where':_0x23b093[_0x0ee1('0x38')]};return db[_0x0ee1('0x29')][_0x0ee1('0x3f')](_0xff2d0a)[_0x0ee1('0x40')](function(_0x3295a0){_0x25bf49[_0x0ee1('0x3f')]=_0x3295a0;if(_0x26eedf[_0x0ee1('0x2e')][_0x0ee1('0x41')]){_0x23b093[_0x0ee1('0x42')]=[{'all':!![]}];}return db[_0x0ee1('0x29')][_0x0ee1('0x43')](_0x23b093);})[_0x0ee1('0x40')](function(_0x57a137){_0x25bf49[_0x0ee1('0x44')]=_0x57a137;return _0x25bf49;})[_0x0ee1('0x40')](respondWithFilteredResult(_0x3e384c,_0x23b093))['catch'](handleError(_0x3e384c,null));};exports[_0x0ee1('0x45')]=function(_0x34b52f,_0x1b9a5e){var _0x334fe0={'raw':![],'where':{'id':_0x34b52f[_0x0ee1('0x46')]['id']}},_0x47c778={};_0x47c778[_0x0ee1('0x2d')]=_['keys'](db[_0x0ee1('0x29')][_0x0ee1('0x47')]);_0x47c778[_0x0ee1('0x2e')]=_['keys'](_0x34b52f[_0x0ee1('0x2e')]);_0x47c778[_0x0ee1('0x30')]=_['intersection'](_0x47c778[_0x0ee1('0x2d')],_0x47c778[_0x0ee1('0x2e')]);_0x334fe0[_0x0ee1('0x31')]=_[_0x0ee1('0x32')](_0x47c778[_0x0ee1('0x2d')],qs[_0x0ee1('0x33')](_0x34b52f['query']['fields']));_0x334fe0[_0x0ee1('0x31')]=_0x334fe0['attributes'][_0x0ee1('0x34')]?_0x334fe0[_0x0ee1('0x31')]:_0x47c778[_0x0ee1('0x2d')];if(_0x34b52f[_0x0ee1('0x2e')][_0x0ee1('0x41')]){_0x334fe0[_0x0ee1('0x42')]=[{'all':!![]}];}_0x334fe0=_[_0x0ee1('0x3b')]({},_0x334fe0,_0x34b52f[_0x0ee1('0x3e')]);return db[_0x0ee1('0x29')]['find'](_0x334fe0)[_0x0ee1('0x40')](handleEntityNotFound(_0x1b9a5e,null))[_0x0ee1('0x40')](respondWithResult(_0x1b9a5e,null))['catch'](handleError(_0x1b9a5e,null));};exports[_0x0ee1('0x48')]=function(_0x5400d6,_0x128091){return db[_0x0ee1('0x29')][_0x0ee1('0x48')](_0x5400d6[_0x0ee1('0x49')],{})['then'](respondWithResult(_0x128091,0xc9))['catch'](handleError(_0x128091,null));};exports[_0x0ee1('0x24')]=function(_0x415e71,_0x5c29ce){if(_0x415e71[_0x0ee1('0x49')]['id']){delete _0x415e71[_0x0ee1('0x49')]['id'];}return db[_0x0ee1('0x29')]['find']({'where':{'id':_0x415e71[_0x0ee1('0x46')]['id']}})[_0x0ee1('0x40')](handleEntityNotFound(_0x5c29ce,null))[_0x0ee1('0x40')](saveUpdates(_0x415e71[_0x0ee1('0x49')],null))[_0x0ee1('0x40')](respondWithResult(_0x5c29ce,null))[_0x0ee1('0x4a')](handleError(_0x5c29ce,null));};exports[_0x0ee1('0x25')]=function(_0x4a81d1,_0x1cddf1){return db['FreshsalesAccount'][_0x0ee1('0x4b')]({'where':{'id':_0x4a81d1['params']['id']}})[_0x0ee1('0x40')](handleEntityNotFound(_0x1cddf1,null))[_0x0ee1('0x40')](removeEntity(_0x1cddf1,null))['catch'](handleError(_0x1cddf1,null));};exports[_0x0ee1('0x4c')]=function(_0x1ccaee,_0x60d4c9,_0x2a5654){var _0x4c9a8c={};var _0xfdbe1f={};var _0x3b12fe;var _0xc45490;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1ccaee[_0x0ee1('0x46')]['id']}})['then'](handleEntityNotFound(_0x60d4c9,null))[_0x0ee1('0x40')](function(_0x55f7f8){if(_0x55f7f8){_0x3b12fe=_0x55f7f8;_0xfdbe1f[_0x0ee1('0x2d')]=_[_0x0ee1('0x2f')](db[_0x0ee1('0x4d')][_0x0ee1('0x47')]);_0xfdbe1f[_0x0ee1('0x2e')]=_[_0x0ee1('0x2f')](_0x1ccaee['query']);_0xfdbe1f[_0x0ee1('0x30')]=_[_0x0ee1('0x32')](_0xfdbe1f[_0x0ee1('0x2d')],_0xfdbe1f[_0x0ee1('0x2e')]);_0x4c9a8c[_0x0ee1('0x31')]=_['intersection'](_0xfdbe1f[_0x0ee1('0x2d')],qs['fields'](_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x33')]));_0x4c9a8c[_0x0ee1('0x31')]=_0x4c9a8c['attributes'][_0x0ee1('0x34')]?_0x4c9a8c[_0x0ee1('0x31')]:_0xfdbe1f[_0x0ee1('0x2d')];_0x4c9a8c[_0x0ee1('0x36')]=qs[_0x0ee1('0x37')](_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x37')]);_0x4c9a8c[_0x0ee1('0x38')]=qs[_0x0ee1('0x30')](_[_0x0ee1('0x39')](_0x1ccaee[_0x0ee1('0x2e')],_0xfdbe1f[_0x0ee1('0x30')]));if(_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x3a')]){_0x4c9a8c['where']=_['merge'](_0x4c9a8c[_0x0ee1('0x38')],{'$or':_['map'](_0x4c9a8c[_0x0ee1('0x31')],function(_0x322237){var _0x4aa79a={};_0x4aa79a[_0x322237]={'$like':'%'+_0x1ccaee['query']['filter']+'%'};return _0x4aa79a;})});}_0x4c9a8c=_[_0x0ee1('0x3b')]({},_0x4c9a8c,_0x1ccaee[_0x0ee1('0x3e')]);return _0x3b12fe[_0x0ee1('0x4c')](_0x4c9a8c);}})['then'](function(_0x451b18){if(_0x451b18){_0xc45490=_0x451b18[_0x0ee1('0x34')];if(!_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x35')](_0x0ee1('0x4e'))){_0x4c9a8c[_0x0ee1('0x1f')]=qs[_0x0ee1('0x1f')](_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x1f')]);_0x4c9a8c[_0x0ee1('0x1e')]=qs[_0x0ee1('0x1e')](_0x1ccaee[_0x0ee1('0x2e')][_0x0ee1('0x1e')]);}return _0x3b12fe[_0x0ee1('0x4c')](_0x4c9a8c);}})['then'](function(_0x37ce04){if(_0x37ce04){return _0x37ce04?{'count':_0xc45490,'rows':_0x37ce04}:null;}})[_0x0ee1('0x40')](respondWithResult(_0x60d4c9,null))[_0x0ee1('0x4a')](handleError(_0x60d4c9,null));};exports[_0x0ee1('0x4f')]=function(_0x72c5a8,_0x3e08a5,_0x65bc65){if(_0x72c5a8[_0x0ee1('0x49')]['id']){delete _0x72c5a8['body']['id'];}return db[_0x0ee1('0x29')]['findOne']({'where':{'id':_0x72c5a8[_0x0ee1('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e08a5,null))[_0x0ee1('0x40')](function(_0x46d627){if(_0x46d627){_0x72c5a8[_0x0ee1('0x49')][_0x0ee1('0x50')]=_0x46d627['id'];_0x72c5a8[_0x0ee1('0x49')][_0x0ee1('0x51')]=integrations[_0x0ee1('0x52')](_0x72c5a8['body'][_0x0ee1('0x53')],_0x72c5a8[_0x0ee1('0x49')][_0x0ee1('0x2b')]);_0x72c5a8[_0x0ee1('0x49')][_0x0ee1('0x54')]=integrations[_0x0ee1('0x55')](_0x72c5a8[_0x0ee1('0x49')]['channel'],_0x72c5a8[_0x0ee1('0x49')]['type']);return db[_0x0ee1('0x4d')][_0x0ee1('0x48')](_0x72c5a8['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x0ee1('0x56')],'as':_0x0ee1('0x54')}]});}return null;})[_0x0ee1('0x40')](respondWithResult(_0x3e08a5,null))[_0x0ee1('0x4a')](handleError(_0x3e08a5,null));};exports['getFields']=function(_0x21132b,_0xbf5afe,_0x19f2ef){var _0x56802a='';var _0x382893='';return db['FreshsalesAccount'][_0x0ee1('0x57')]({'where':{'id':_0x21132b['params']['id']},'attributes':['id','username','remoteUri',_0x0ee1('0x58')]})[_0x0ee1('0x40')](handleEntityNotFound(_0xbf5afe,null))[_0x0ee1('0x40')](function(_0x90faa7){if(_0x90faa7){_0x382893=_0x90faa7['username'];_0x56802a=_0x90faa7[_0x0ee1('0x59')];var _0x525afd=_0x90faa7[_0x0ee1('0x59')]['slice'](-0x1);if(_0x525afd==='/'){_0x56802a=_0x56802a['substring'](0x0,_0x56802a[_0x0ee1('0x5a')](_0x525afd));}return rp({'method':_0x0ee1('0x5b'),'uri':util[_0x0ee1('0x5c')]('%s%s',_0x56802a,_0x0ee1('0x5d')),'headers':{'Authorization':_0x0ee1('0x5e')+_0x90faa7[_0x0ee1('0x58')]},'json':!![]});}})[_0x0ee1('0x40')](function(_0x20c0e2){if(_0x20c0e2){var _0x40a0e4=_0x20c0e2[_0x0ee1('0x5f')];var _0x12de01=![];var _0x1b36ff=null;for(_0x1b36ff=0x0;_0x1b36ff<_0x40a0e4[_0x0ee1('0x34')];_0x1b36ff++){if(_0x40a0e4[_0x1b36ff][_0x0ee1('0x60')]===_0x382893){_0x12de01=!![];}}if(_0x12de01){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0ee1('0x61')});}}})[_0x0ee1('0x40')](respondWithResult(_0xbf5afe,null))[_0x0ee1('0x4a')](function(_0x3cd254){var _0xa2d667=_0x21132b['query']['test']?0x1f4:_0x3cd254[_0x0ee1('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0ee1('0x63'),_0xa2d667,JSON[_0x0ee1('0x64')](_0x3cd254));delete _0x3cd254[_0x0ee1('0x65')];if(_0xa2d667===0x191){_0xa2d667=0x190;}_0xbf5afe[_0x0ee1('0x1b')](_0xa2d667)[_0x0ee1('0x27')](_0x21132b[_0x0ee1('0x2e')][_0x0ee1('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x3cd254[_0x0ee1('0x62')]}:_0x3cd254);});}; \ No newline at end of file +var _0x84e7=['map','FreshsalesAccount','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','fields','includeAll','create','body','find','getConfigurations','findOne','pick','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','slice','substring','GET','format','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','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/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','then','destroy','error','name','send'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0x84e7,0xfb));var _0x784e=function(_0x3aa767,_0x5a3e6c){_0x3aa767=_0x3aa767-0x0;var _0x4aa9eb=_0x84e7[_0x3aa767];return _0x4aa9eb;};'use strict';var emlformat=require(_0x784e('0x0'));var rimraf=require(_0x784e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x784e('0x2'));var Mustache=require(_0x784e('0x3'));var util=require(_0x784e('0x4'));var path=require(_0x784e('0x5'));var sox=require('sox');var csv=require(_0x784e('0x6'));var ejs=require(_0x784e('0x7'));var fs=require('fs');var fs_extra=require(_0x784e('0x8'));var _=require(_0x784e('0x9'));var squel=require('squel');var crypto=require(_0x784e('0xa'));var jsforce=require(_0x784e('0xb'));var deskjs=require(_0x784e('0xc'));var toCsv=require(_0x784e('0x6'));var querystring=require(_0x784e('0xd'));var Papa=require(_0x784e('0xe'));var Redis=require(_0x784e('0xf'));var authService=require(_0x784e('0x10'));var qs=require(_0x784e('0x11'));var as=require(_0x784e('0x12'));var hardwareService=require(_0x784e('0x13'));var logger=require(_0x784e('0x14'))(_0x784e('0x15'));var utils=require(_0x784e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x784e('0x17'));var db=require(_0x784e('0x18'))['db'];var integrations=require(_0x784e('0x19'));function respondWithStatusCode(_0x1efad5,_0x502211){_0x502211=_0x502211||0xcc;return function(_0x534141){if(_0x534141){return _0x1efad5[_0x784e('0x1a')](_0x502211);}return _0x1efad5[_0x784e('0x1b')](_0x502211)[_0x784e('0x1c')]();};}function respondWithResult(_0x2998df,_0x45e6ab){_0x45e6ab=_0x45e6ab||0xc8;return function(_0x8a7b55){if(_0x8a7b55){return _0x2998df['status'](_0x45e6ab)['json'](_0x8a7b55);}};}function respondWithFilteredResult(_0x6f9d06,_0xd0c37){return function(_0x5213d0){if(_0x5213d0){var _0x40d4bc=typeof _0xd0c37['offset']===_0x784e('0x1d')&&typeof _0xd0c37[_0x784e('0x1e')]===_0x784e('0x1d');var _0x5e4f69=_0x5213d0['count'];var _0x44e7d9=_0x40d4bc?0x0:_0xd0c37[_0x784e('0x1f')];var _0x42cfec=_0x40d4bc?_0x5213d0[_0x784e('0x20')]:_0xd0c37['offset']+_0xd0c37[_0x784e('0x1e')];var _0x171b93;if(_0x42cfec>=_0x5e4f69){_0x42cfec=_0x5e4f69;_0x171b93=0xc8;}else{_0x171b93=0xce;}_0x6f9d06['status'](_0x171b93);return _0x6f9d06['set'](_0x784e('0x21'),_0x44e7d9+'-'+_0x42cfec+'/'+_0x5e4f69)[_0x784e('0x22')](_0x5213d0);}return null;};}function patchUpdates(_0x2f31a4){return function(_0x37264c){try{jsonpatch[_0x784e('0x23')](_0x37264c,_0x2f31a4,!![]);}catch(_0x5d9618){return BPromise[_0x784e('0x24')](_0x5d9618);}return _0x37264c['save']();};}function saveUpdates(_0x2912a6,_0xc5fd17){return function(_0x41e00f){if(_0x41e00f){return _0x41e00f[_0x784e('0x25')](_0x2912a6)[_0x784e('0x26')](function(_0x530922){return _0x530922;});}return null;};}function removeEntity(_0x33e8d4,_0x147943){return function(_0x1298ee){if(_0x1298ee){return _0x1298ee[_0x784e('0x27')]()[_0x784e('0x26')](function(){_0x33e8d4[_0x784e('0x1b')](0xcc)[_0x784e('0x1c')]();});}};}function handleEntityNotFound(_0x43160f,_0x1f8b00){return function(_0x301d47){if(!_0x301d47){_0x43160f[_0x784e('0x1a')](0x194);}return _0x301d47;};}function handleError(_0x21a88c,_0x4f8c17){_0x4f8c17=_0x4f8c17||0x1f4;return function(_0x51df4f){logger[_0x784e('0x28')](_0x51df4f['stack']);if(_0x51df4f['name']){delete _0x51df4f[_0x784e('0x29')];}_0x21a88c[_0x784e('0x1b')](_0x4f8c17)[_0x784e('0x2a')](_0x51df4f);};}exports['index']=function(_0x2d7ce0,_0x3f2d87){var _0x4da903={},_0x58e0d9={},_0x43ef56={'count':0x0,'rows':[]};var _0x468984=_[_0x784e('0x2b')](db[_0x784e('0x2c')]['rawAttributes'],function(_0x2ae38b){return{'name':_0x2ae38b['fieldName'],'type':_0x2ae38b['type'][_0x784e('0x2d')]};});_0x58e0d9[_0x784e('0x2e')]=_[_0x784e('0x2b')](_0x468984,'name');_0x58e0d9[_0x784e('0x2f')]=_['keys'](_0x2d7ce0[_0x784e('0x2f')]);_0x58e0d9[_0x784e('0x30')]=_[_0x784e('0x31')](_0x58e0d9[_0x784e('0x2e')],_0x58e0d9[_0x784e('0x2f')]);_0x4da903[_0x784e('0x32')]=_[_0x784e('0x31')](_0x58e0d9[_0x784e('0x2e')],qs['fields'](_0x2d7ce0[_0x784e('0x2f')]['fields']));_0x4da903[_0x784e('0x32')]=_0x4da903[_0x784e('0x32')][_0x784e('0x33')]?_0x4da903[_0x784e('0x32')]:_0x58e0d9['model'];if(!_0x2d7ce0['query']['hasOwnProperty'](_0x784e('0x34'))){_0x4da903[_0x784e('0x1e')]=qs[_0x784e('0x1e')](_0x2d7ce0[_0x784e('0x2f')]['limit']);_0x4da903[_0x784e('0x1f')]=qs[_0x784e('0x1f')](_0x2d7ce0[_0x784e('0x2f')][_0x784e('0x1f')]);}_0x4da903[_0x784e('0x35')]=qs[_0x784e('0x36')](_0x2d7ce0[_0x784e('0x2f')][_0x784e('0x36')]);_0x4da903['where']=qs['filters'](_['pick'](_0x2d7ce0[_0x784e('0x2f')],_0x58e0d9[_0x784e('0x30')]),_0x468984);if(_0x2d7ce0[_0x784e('0x2f')][_0x784e('0x37')]){_0x4da903[_0x784e('0x38')]=_[_0x784e('0x39')](_0x4da903['where'],{'$or':_['map'](_0x468984,function(_0x201d4f){if(_0x201d4f[_0x784e('0x3a')]!==_0x784e('0x3b')){var _0xf4d18d={};_0xf4d18d[_0x201d4f['name']]={'$like':'%'+_0x2d7ce0[_0x784e('0x2f')][_0x784e('0x37')]+'%'};return _0xf4d18d;}})});}_0x4da903=_[_0x784e('0x39')]({},_0x4da903,_0x2d7ce0[_0x784e('0x3c')]);var _0x391bb4={'where':_0x4da903[_0x784e('0x38')]};return db['FreshsalesAccount']['count'](_0x391bb4)[_0x784e('0x26')](function(_0x4a843c){_0x43ef56[_0x784e('0x20')]=_0x4a843c;if(_0x2d7ce0[_0x784e('0x2f')]['includeAll']){_0x4da903[_0x784e('0x3d')]=[{'all':!![]}];}return db[_0x784e('0x2c')][_0x784e('0x3e')](_0x4da903);})['then'](function(_0x318723){_0x43ef56[_0x784e('0x3f')]=_0x318723;return _0x43ef56;})[_0x784e('0x26')](respondWithFilteredResult(_0x3f2d87,_0x4da903))[_0x784e('0x40')](handleError(_0x3f2d87,null));};exports['show']=function(_0x4fe2ee,_0x5f1fa5){var _0xf328e2={'raw':![],'where':{'id':_0x4fe2ee[_0x784e('0x41')]['id']}},_0x4c6dae={};_0x4c6dae['model']=_[_0x784e('0x42')](db[_0x784e('0x2c')][_0x784e('0x43')]);_0x4c6dae[_0x784e('0x2f')]=_[_0x784e('0x42')](_0x4fe2ee['query']);_0x4c6dae[_0x784e('0x30')]=_[_0x784e('0x31')](_0x4c6dae[_0x784e('0x2e')],_0x4c6dae[_0x784e('0x2f')]);_0xf328e2[_0x784e('0x32')]=_['intersection'](_0x4c6dae[_0x784e('0x2e')],qs[_0x784e('0x44')](_0x4fe2ee[_0x784e('0x2f')][_0x784e('0x44')]));_0xf328e2[_0x784e('0x32')]=_0xf328e2[_0x784e('0x32')]['length']?_0xf328e2[_0x784e('0x32')]:_0x4c6dae[_0x784e('0x2e')];if(_0x4fe2ee['query'][_0x784e('0x45')]){_0xf328e2[_0x784e('0x3d')]=[{'all':!![]}];}_0xf328e2=_['merge']({},_0xf328e2,_0x4fe2ee[_0x784e('0x3c')]);return db['FreshsalesAccount']['find'](_0xf328e2)[_0x784e('0x26')](handleEntityNotFound(_0x5f1fa5,null))[_0x784e('0x26')](respondWithResult(_0x5f1fa5,null))['catch'](handleError(_0x5f1fa5,null));};exports[_0x784e('0x46')]=function(_0x1997aa,_0x288da9){return db[_0x784e('0x2c')]['create'](_0x1997aa[_0x784e('0x47')],{})['then'](respondWithResult(_0x288da9,0xc9))[_0x784e('0x40')](handleError(_0x288da9,null));};exports[_0x784e('0x25')]=function(_0x17c316,_0x250956){if(_0x17c316[_0x784e('0x47')]['id']){delete _0x17c316[_0x784e('0x47')]['id'];}return db['FreshsalesAccount'][_0x784e('0x48')]({'where':{'id':_0x17c316[_0x784e('0x41')]['id']}})[_0x784e('0x26')](handleEntityNotFound(_0x250956,null))[_0x784e('0x26')](saveUpdates(_0x17c316[_0x784e('0x47')],null))[_0x784e('0x26')](respondWithResult(_0x250956,null))[_0x784e('0x40')](handleError(_0x250956,null));};exports[_0x784e('0x27')]=function(_0x14921c,_0x4e63da){return db[_0x784e('0x2c')]['find']({'where':{'id':_0x14921c[_0x784e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e63da,null))[_0x784e('0x26')](removeEntity(_0x4e63da,null))[_0x784e('0x40')](handleError(_0x4e63da,null));};exports[_0x784e('0x49')]=function(_0x25c007,_0x465157,_0x33b3b7){var _0x1b9e6d={};var _0x2a1c62={};var _0x53ecdd;var _0x25c73d;return db['FreshsalesAccount'][_0x784e('0x4a')]({'where':{'id':_0x25c007[_0x784e('0x41')]['id']}})['then'](handleEntityNotFound(_0x465157,null))['then'](function(_0x328ec7){if(_0x328ec7){_0x53ecdd=_0x328ec7;_0x2a1c62[_0x784e('0x2e')]=_[_0x784e('0x42')](db['FreshsalesConfiguration'][_0x784e('0x43')]);_0x2a1c62['query']=_[_0x784e('0x42')](_0x25c007[_0x784e('0x2f')]);_0x2a1c62[_0x784e('0x30')]=_[_0x784e('0x31')](_0x2a1c62[_0x784e('0x2e')],_0x2a1c62[_0x784e('0x2f')]);_0x1b9e6d[_0x784e('0x32')]=_[_0x784e('0x31')](_0x2a1c62[_0x784e('0x2e')],qs[_0x784e('0x44')](_0x25c007[_0x784e('0x2f')]['fields']));_0x1b9e6d[_0x784e('0x32')]=_0x1b9e6d[_0x784e('0x32')]['length']?_0x1b9e6d[_0x784e('0x32')]:_0x2a1c62[_0x784e('0x2e')];_0x1b9e6d[_0x784e('0x35')]=qs[_0x784e('0x36')](_0x25c007[_0x784e('0x2f')][_0x784e('0x36')]);_0x1b9e6d[_0x784e('0x38')]=qs[_0x784e('0x30')](_[_0x784e('0x4b')](_0x25c007[_0x784e('0x2f')],_0x2a1c62[_0x784e('0x30')]));if(_0x25c007[_0x784e('0x2f')]['filter']){_0x1b9e6d['where']=_[_0x784e('0x39')](_0x1b9e6d[_0x784e('0x38')],{'$or':_[_0x784e('0x2b')](_0x1b9e6d['attributes'],function(_0x820145){var _0x49ab53={};_0x49ab53[_0x820145]={'$like':'%'+_0x25c007[_0x784e('0x2f')][_0x784e('0x37')]+'%'};return _0x49ab53;})});}_0x1b9e6d=_[_0x784e('0x39')]({},_0x1b9e6d,_0x25c007['options']);return _0x53ecdd['getConfigurations'](_0x1b9e6d);}})[_0x784e('0x26')](function(_0x1e059d){if(_0x1e059d){_0x25c73d=_0x1e059d[_0x784e('0x33')];if(!_0x25c007[_0x784e('0x2f')]['hasOwnProperty'](_0x784e('0x34'))){_0x1b9e6d[_0x784e('0x1e')]=qs['limit'](_0x25c007[_0x784e('0x2f')][_0x784e('0x1e')]);_0x1b9e6d[_0x784e('0x1f')]=qs[_0x784e('0x1f')](_0x25c007['query']['offset']);}return _0x53ecdd[_0x784e('0x49')](_0x1b9e6d);}})[_0x784e('0x26')](function(_0xf1ab){if(_0xf1ab){return _0xf1ab?{'count':_0x25c73d,'rows':_0xf1ab}:null;}})[_0x784e('0x26')](respondWithResult(_0x465157,null))[_0x784e('0x40')](handleError(_0x465157,null));};exports['addConfiguration']=function(_0x164c61,_0x4be1dc,_0x2abee1){if(_0x164c61[_0x784e('0x47')]['id']){delete _0x164c61[_0x784e('0x47')]['id'];}return db['FreshsalesAccount'][_0x784e('0x4a')]({'where':{'id':_0x164c61[_0x784e('0x41')]['id']}})[_0x784e('0x26')](handleEntityNotFound(_0x4be1dc,null))[_0x784e('0x26')](function(_0x1e8930){if(_0x1e8930){_0x164c61[_0x784e('0x47')]['AccountId']=_0x1e8930['id'];_0x164c61['body'][_0x784e('0x4c')]=integrations[_0x784e('0x4d')](_0x164c61[_0x784e('0x47')][_0x784e('0x4e')],_0x164c61[_0x784e('0x47')][_0x784e('0x3a')]);_0x164c61['body']['Descriptions']=integrations[_0x784e('0x4f')](_0x164c61[_0x784e('0x47')]['channel'],_0x164c61['body']['type']);return db[_0x784e('0x50')][_0x784e('0x46')](_0x164c61[_0x784e('0x47')],{'include':[{'model':db[_0x784e('0x51')],'as':'Subjects'},{'model':db[_0x784e('0x51')],'as':_0x784e('0x52')}]});}return null;})['then'](respondWithResult(_0x4be1dc,null))[_0x784e('0x40')](handleError(_0x4be1dc,null));};exports[_0x784e('0x53')]=function(_0x2344db,_0x8f70e6,_0x4134b0){var _0x1318fb='';var _0x3ccb90='';return db['FreshsalesAccount'][_0x784e('0x4a')]({'where':{'id':_0x2344db[_0x784e('0x41')]['id']},'attributes':['id',_0x784e('0x54'),'remoteUri','apiKey']})[_0x784e('0x26')](handleEntityNotFound(_0x8f70e6,null))[_0x784e('0x26')](function(_0x449f71){if(_0x449f71){_0x3ccb90=_0x449f71[_0x784e('0x54')];_0x1318fb=_0x449f71[_0x784e('0x55')];var _0x4a60dd=_0x449f71[_0x784e('0x55')][_0x784e('0x56')](-0x1);if(_0x4a60dd==='/'){_0x1318fb=_0x1318fb[_0x784e('0x57')](0x0,_0x1318fb['lastIndexOf'](_0x4a60dd));}return rp({'method':_0x784e('0x58'),'uri':util[_0x784e('0x59')]('%s%s',_0x1318fb,_0x784e('0x5a')),'headers':{'Authorization':_0x784e('0x5b')+_0x449f71[_0x784e('0x5c')]},'json':!![]});}})[_0x784e('0x26')](function(_0x39fdf5){if(_0x39fdf5){var _0x286efc=_0x39fdf5[_0x784e('0x5d')];var _0xe6fb4=![];var _0x3de67e=null;for(_0x3de67e=0x0;_0x3de67e<_0x286efc['length'];_0x3de67e++){if(_0x286efc[_0x3de67e][_0x784e('0x5e')]===_0x3ccb90){_0xe6fb4=!![];}}if(_0xe6fb4){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x784e('0x26')](respondWithResult(_0x8f70e6,null))[_0x784e('0x40')](function(_0x3e87f0){var _0x6efdc4=_0x2344db[_0x784e('0x2f')]['test']?0x1f4:_0x3e87f0[_0x784e('0x5f')]||0x1f4;logger['error'](_0x784e('0x60'),_0x784e('0x53'),_0x6efdc4,JSON['stringify'](_0x3e87f0));delete _0x3e87f0['name'];if(_0x6efdc4===0x191){_0x6efdc4=0x190;}_0x8f70e6['status'](_0x6efdc4)[_0x784e('0x2a')](_0x2344db[_0x784e('0x2f')]['test']?{'message':_0x784e('0x61'),'statusCode':_0x3e87f0[_0x784e('0x5f')]}:_0x3e87f0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3676724..e2bad9c 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts'];(function(_0x41386d,_0x587dfe){var _0x385842=function(_0x8c6830){while(--_0x8c6830){_0x41386d['push'](_0x41386d['shift']());}};_0x385842(++_0x587dfe);}(_0x1261,0x144));var _0x1126=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x1261[_0x5756f8];return _0x3bb749;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40ba58,_0x907180){return _0x40ba58['define'](_0x1126('0xa'),attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2da6=['int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount'];(function(_0x4a1be1,_0x226adc){var _0x52ab9c=function(_0x15f400){while(--_0x15f400){_0x4a1be1['push'](_0x4a1be1['shift']());}};_0x52ab9c(++_0x226adc);}(_0x2da6,0x1dd));var _0x62da=function(_0xb8837d,_0x3b829d){_0xb8837d=_0xb8837d-0x0;var _0x44d95e=_0x2da6[_0xb8837d];return _0x44d95e;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));var integrations=require(_0x62da('0x9'));module[_0x62da('0xa')]=function(_0x30437f,_0x100e73){return _0x30437f[_0x62da('0xb')](_0x62da('0xc'),attributes,{'tableName':_0x62da('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 9ecdf41..1e091d9 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 _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x2aed99,_0x579af0){var _0x29355c=function(_0x4e608d){while(--_0x4e608d){_0x2aed99['push'](_0x2aed99['shift']());}};_0x29355c(++_0x579af0);}(_0x68b3,0x1d8));var _0x368b=function(_0x449485,_0x1f38da){_0x449485=_0x449485-0x0;var _0x9c46b1=_0x68b3[_0x449485];return _0x9c46b1;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file +var _0xbbbc=['attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x565e76,_0x22530a){_0x565e76=_0x565e76-0x0;var _0x455711=_0xbbbc[_0x565e76];return _0x455711;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['FreshsalesAccount'][_0xcbbb('0x16')]({'raw':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x18')]===undefined?!![]:![]:!![],'where':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x19')]||null:null,'attributes':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1a')]||null:null,'limit':_0x3436af['options']?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1b')]||null:null,'include':_0x3436af[_0xcbbb('0x17')]?_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x3436af[_0xcbbb('0x17')][_0xcbbb('0x1c')],function(_0x3ca570){return{'model':db[_0x3ca570['model']],'as':_0x3ca570['as'],'attributes':_0x3ca570[_0xcbbb('0x1a')],'include':_0x3ca570[_0xcbbb('0x1c')]?_['map'](_0x3ca570[_0xcbbb('0x1c')],function(_0x4ffa80){return{'model':db[_0x4ffa80['model']],'as':_0x4ffa80['as'],'attributes':_0x4ffa80[_0xcbbb('0x1a')],'include':_0x4ffa80[_0xcbbb('0x1c')]?_['map'](_0x4ffa80['include'],function(_0x5499a1){return{'model':db[_0x5499a1[_0xcbbb('0x1e')]],'as':_0x5499a1['as'],'attributes':_0x5499a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e3b1){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON[_0xcbbb('0x1f')](_0x21e3b1));_0x5052df(_0x21e3b1);})[_0xcbbb('0x14')](function(_0x1c986d){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x1c986d[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x1c986d[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x20')]=function(_0x2a9639){var _0xcae72c=this;return new Promise(function(_0x117739,_0x21c560){return db['FreshsalesAccount'][_0xcbbb('0x21')]({'raw':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639['options'][_0xcbbb('0x18')]===undefined?!![]:![]:!![],'where':_0x2a9639['options']?_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x19')]||null:null,'attributes':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639['options'][_0xcbbb('0x1a')]||null:null,'include':_0x2a9639[_0xcbbb('0x17')]?_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x2a9639[_0xcbbb('0x17')][_0xcbbb('0x1c')],function(_0x1ac1a2){return{'model':db[_0x1ac1a2[_0xcbbb('0x1e')]],'as':_0x1ac1a2['as'],'attributes':_0x1ac1a2[_0xcbbb('0x1a')],'include':_0x1ac1a2['include']?_['map'](_0x1ac1a2['include'],function(_0x4ed7e8){return{'model':db[_0x4ed7e8[_0xcbbb('0x1e')]],'as':_0x4ed7e8['as'],'attributes':_0x4ed7e8[_0xcbbb('0x1a')],'include':_0x4ed7e8[_0xcbbb('0x1c')]?_[_0xcbbb('0x1d')](_0x4ed7e8[_0xcbbb('0x1c')],function(_0x358537){return{'model':db[_0x358537[_0xcbbb('0x1e')]],'as':_0x358537['as'],'attributes':_0x358537[_0xcbbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcbbb('0xd')](function(_0x198178){logger[_0xcbbb('0xe')](_0xcbbb('0x20'),_0x2a9639);logger['debug']('ShowFreshsalesAccount',_0x2a9639,JSON[_0xcbbb('0x1f')](_0x198178));_0x117739(_0x198178);})['catch'](function(_0x4919ad){logger['error'](_0xcbbb('0x20'),_0x4919ad[_0xcbbb('0x12')],_0x2a9639);_0x21c560(_0xcae72c[_0xcbbb('0x11')](0x1f4,_0x4919ad[_0xcbbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 67f0b1e..84e47f9 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 _0x7f85=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x46b7ed,_0x211e80){var _0x25ffb4=function(_0x95e398){while(--_0x95e398){_0x46b7ed['push'](_0x46b7ed['shift']());}};_0x25ffb4(++_0x211e80);}(_0x7f85,0x128));var _0x57f8=function(_0x14a2de,_0xb6f4fa){_0x14a2de=_0x14a2de-0x0;var _0x5f2d6c=_0x7f85[_0x14a2de];return _0x5f2d6c;};'use strict';var multer=require(_0x57f8('0x0'));var util=require(_0x57f8('0x1'));var path=require(_0x57f8('0x2'));var timeout=require(_0x57f8('0x3'));var express=require(_0x57f8('0x4'));var router=express['Router']();var fs_extra=require(_0x57f8('0x5'));var auth=require(_0x57f8('0x6'));var interaction=require(_0x57f8('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x57f8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57f8('0x8')](_0x57f8('0x9'),auth[_0x57f8('0xa')](),controller['show']);router[_0x57f8('0x8')](_0x57f8('0xb'),auth[_0x57f8('0xa')](),controller[_0x57f8('0xc')]);router[_0x57f8('0x8')]('/:id/descriptions',auth[_0x57f8('0xa')](),controller[_0x57f8('0xd')]);router['get'](_0x57f8('0xe'),auth[_0x57f8('0xa')](),controller[_0x57f8('0xf')]);router['post']('/',auth[_0x57f8('0xa')](),controller['create']);router[_0x57f8('0x10')](_0x57f8('0x9'),auth[_0x57f8('0xa')](),controller[_0x57f8('0x11')]);router['delete'](_0x57f8('0x9'),auth[_0x57f8('0xa')](),controller[_0x57f8('0x12')]);module[_0x57f8('0x13')]=router; \ No newline at end of file +var _0xa538=['getSubjects','getDescriptions','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0xa538,0x93));var _0x8a53=function(_0x38dff2,_0x17bfd3){_0x38dff2=_0x38dff2-0x0;var _0x1f1bb5=_0xa538[_0x38dff2];return _0x1f1bb5;};'use strict';var multer=require(_0x8a53('0x0'));var util=require(_0x8a53('0x1'));var path=require(_0x8a53('0x2'));var timeout=require(_0x8a53('0x3'));var express=require('express');var router=express[_0x8a53('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a53('0x5'));var interaction=require(_0x8a53('0x6'));var config=require(_0x8a53('0x7'));var controller=require(_0x8a53('0x8'));router[_0x8a53('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a53('0xa')]);router[_0x8a53('0x9')](_0x8a53('0xb'),auth[_0x8a53('0xc')](),controller['show']);router[_0x8a53('0x9')](_0x8a53('0xd'),auth['isAuthenticated'](),controller[_0x8a53('0xe')]);router[_0x8a53('0x9')]('/:id/descriptions',auth[_0x8a53('0xc')](),controller[_0x8a53('0xf')]);router[_0x8a53('0x9')]('/:id/fields',auth[_0x8a53('0xc')](),controller[_0x8a53('0x10')]);router[_0x8a53('0x11')]('/',auth[_0x8a53('0xc')](),controller['create']);router[_0x8a53('0x12')](_0x8a53('0xb'),auth['isAuthenticated'](),controller[_0x8a53('0x13')]);router[_0x8a53('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a53('0x15')]);module[_0x8a53('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fbbaf8e..8291737 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 _0x3d17=['STRING','sequelize','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x3d17,0x166));var _0x73d1=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x3d17[_0x10f68e];return _0x4c8372;};'use strict';var Sequelize=require(_0x73d1('0x0'));module[_0x73d1('0x1')]={'name':{'type':Sequelize[_0x73d1('0x2')]},'description':{'type':Sequelize[_0x73d1('0x2')]}}; \ No newline at end of file +var _0xefc1=['exports','STRING','sequelize'];(function(_0x34f3c7,_0x393441){var _0x258767=function(_0x1528d1){while(--_0x1528d1){_0x34f3c7['push'](_0x34f3c7['shift']());}};_0x258767(++_0x393441);}(_0xefc1,0xe3));var _0x1efc=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xefc1[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x1efc('0x0'));module[_0x1efc('0x1')]={'name':{'type':Sequelize[_0x1efc('0x2')]},'description':{'type':Sequelize[_0x1efc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c080ce6..626d1cf 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 _0xe0e9=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','includeAll','findAll','rows','catch','show','create','update','body','find','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshsalesField','options','getFields','eml-format','rimraf','zip-dir'];(function(_0x506c20,_0x2f35d5){var _0x348d64=function(_0x243e8e){while(--_0x243e8e){_0x506c20['push'](_0x506c20['shift']());}};_0x348d64(++_0x2f35d5);}(_0xe0e9,0xe7));var _0x9e0e=function(_0x6a984a,_0x2d5a1d){_0x6a984a=_0x6a984a-0x0;var _0x280f09=_0xe0e9[_0x6a984a];return _0x280f09;};'use strict';var emlformat=require(_0x9e0e('0x0'));var rimraf=require(_0x9e0e('0x1'));var zipdir=require(_0x9e0e('0x2'));var jsonpatch=require(_0x9e0e('0x3'));var rp=require(_0x9e0e('0x4'));var moment=require(_0x9e0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e0e('0x6'));var util=require(_0x9e0e('0x7'));var path=require(_0x9e0e('0x8'));var sox=require(_0x9e0e('0x9'));var csv=require(_0x9e0e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e0e('0xb'));var squel=require(_0x9e0e('0xc'));var crypto=require(_0x9e0e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e0e('0xe'));var toCsv=require(_0x9e0e('0xa'));var querystring=require(_0x9e0e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e0e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9e0e('0x11'));var hardwareService=require(_0x9e0e('0x12'));var logger=require(_0x9e0e('0x13'))(_0x9e0e('0x14'));var utils=require(_0x9e0e('0x15'));var config=require(_0x9e0e('0x16'));var licenseUtil=require(_0x9e0e('0x17'));var db=require(_0x9e0e('0x18'))['db'];function respondWithStatusCode(_0x45f46f,_0x52673c){_0x52673c=_0x52673c||0xcc;return function(_0x35ebc6){if(_0x35ebc6){return _0x45f46f['sendStatus'](_0x52673c);}return _0x45f46f[_0x9e0e('0x19')](_0x52673c)[_0x9e0e('0x1a')]();};}function respondWithResult(_0x28c840,_0x46dbc5){_0x46dbc5=_0x46dbc5||0xc8;return function(_0x1a0590){if(_0x1a0590){return _0x28c840[_0x9e0e('0x19')](_0x46dbc5)['json'](_0x1a0590);}};}function respondWithFilteredResult(_0x4ffbed,_0x266eea){return function(_0x5e7d96){if(_0x5e7d96){var _0x4ec1ac=typeof _0x266eea[_0x9e0e('0x1b')]==='undefined'&&typeof _0x266eea['limit']===_0x9e0e('0x1c');var _0x5b28ee=_0x5e7d96[_0x9e0e('0x1d')];var _0xe367c4=_0x4ec1ac?0x0:_0x266eea[_0x9e0e('0x1b')];var _0x565562=_0x4ec1ac?_0x5e7d96[_0x9e0e('0x1d')]:_0x266eea[_0x9e0e('0x1b')]+_0x266eea[_0x9e0e('0x1e')];var _0x502881;if(_0x565562>=_0x5b28ee){_0x565562=_0x5b28ee;_0x502881=0xc8;}else{_0x502881=0xce;}_0x4ffbed[_0x9e0e('0x19')](_0x502881);return _0x4ffbed['set'](_0x9e0e('0x1f'),_0xe367c4+'-'+_0x565562+'/'+_0x5b28ee)[_0x9e0e('0x20')](_0x5e7d96);}return null;};}function patchUpdates(_0x267b08){return function(_0x4f31f7){try{jsonpatch['apply'](_0x4f31f7,_0x267b08,!![]);}catch(_0x479289){return BPromise[_0x9e0e('0x21')](_0x479289);}return _0x4f31f7[_0x9e0e('0x22')]();};}function saveUpdates(_0x4f24a7,_0x422ffb){return function(_0x48f27f){if(_0x48f27f){return _0x48f27f['update'](_0x4f24a7)[_0x9e0e('0x23')](function(_0x146831){return _0x146831;});}return null;};}function removeEntity(_0x160bee,_0x179c11){return function(_0x58a2a2){if(_0x58a2a2){return _0x58a2a2[_0x9e0e('0x24')]()[_0x9e0e('0x23')](function(){_0x160bee[_0x9e0e('0x19')](0xcc)[_0x9e0e('0x1a')]();});}};}function handleEntityNotFound(_0x562f97,_0x446310){return function(_0x54db98){if(!_0x54db98){_0x562f97[_0x9e0e('0x25')](0x194);}return _0x54db98;};}function handleError(_0x14d9f8,_0x271d58){_0x271d58=_0x271d58||0x1f4;return function(_0x2bb337){logger[_0x9e0e('0x26')](_0x2bb337[_0x9e0e('0x27')]);if(_0x2bb337['name']){delete _0x2bb337[_0x9e0e('0x28')];}_0x14d9f8[_0x9e0e('0x19')](_0x271d58)['send'](_0x2bb337);};}exports['index']=function(_0x54fce9,_0x656ba4){var _0x35f3cc={},_0x573f6c={},_0x2757fa={'count':0x0,'rows':[]};var _0x16e31c=_[_0x9e0e('0x29')](db[_0x9e0e('0x2a')][_0x9e0e('0x2b')],function(_0x3c9ac7){return{'name':_0x3c9ac7[_0x9e0e('0x2c')],'type':_0x3c9ac7['type']['key']};});_0x573f6c[_0x9e0e('0x2d')]=_['map'](_0x16e31c,'name');_0x573f6c[_0x9e0e('0x2e')]=_[_0x9e0e('0x2f')](_0x54fce9[_0x9e0e('0x2e')]);_0x573f6c['filters']=_[_0x9e0e('0x30')](_0x573f6c[_0x9e0e('0x2d')],_0x573f6c[_0x9e0e('0x2e')]);_0x35f3cc[_0x9e0e('0x31')]=_[_0x9e0e('0x30')](_0x573f6c['model'],qs[_0x9e0e('0x32')](_0x54fce9[_0x9e0e('0x2e')]['fields']));_0x35f3cc[_0x9e0e('0x31')]=_0x35f3cc['attributes'][_0x9e0e('0x33')]?_0x35f3cc[_0x9e0e('0x31')]:_0x573f6c[_0x9e0e('0x2d')];if(!_0x54fce9['query']['hasOwnProperty'](_0x9e0e('0x34'))){_0x35f3cc[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x54fce9[_0x9e0e('0x2e')][_0x9e0e('0x1e')]);_0x35f3cc[_0x9e0e('0x1b')]=qs['offset'](_0x54fce9[_0x9e0e('0x2e')][_0x9e0e('0x1b')]);}_0x35f3cc[_0x9e0e('0x35')]=qs[_0x9e0e('0x36')](_0x54fce9[_0x9e0e('0x2e')][_0x9e0e('0x36')]);_0x35f3cc['where']=qs[_0x9e0e('0x37')](_[_0x9e0e('0x38')](_0x54fce9[_0x9e0e('0x2e')],_0x573f6c[_0x9e0e('0x37')]),_0x16e31c);if(_0x54fce9['query'][_0x9e0e('0x39')]){_0x35f3cc['where']=_[_0x9e0e('0x3a')](_0x35f3cc[_0x9e0e('0x3b')],{'$or':_['map'](_0x16e31c,function(_0x156e31){if(_0x156e31[_0x9e0e('0x3c')]!==_0x9e0e('0x3d')){var _0x510c6c={};_0x510c6c[_0x156e31[_0x9e0e('0x28')]]={'$like':'%'+_0x54fce9[_0x9e0e('0x2e')][_0x9e0e('0x39')]+'%'};return _0x510c6c;}})});}_0x35f3cc=_[_0x9e0e('0x3a')]({},_0x35f3cc,_0x54fce9['options']);var _0x3b01d4={'where':_0x35f3cc[_0x9e0e('0x3b')]};return db[_0x9e0e('0x2a')][_0x9e0e('0x1d')](_0x3b01d4)[_0x9e0e('0x23')](function(_0x51e990){_0x2757fa[_0x9e0e('0x1d')]=_0x51e990;if(_0x54fce9[_0x9e0e('0x2e')][_0x9e0e('0x3e')]){_0x35f3cc['include']=[{'all':!![]}];}return db[_0x9e0e('0x2a')][_0x9e0e('0x3f')](_0x35f3cc);})[_0x9e0e('0x23')](function(_0x56d60d){_0x2757fa[_0x9e0e('0x40')]=_0x56d60d;return _0x2757fa;})[_0x9e0e('0x23')](respondWithFilteredResult(_0x656ba4,_0x35f3cc))[_0x9e0e('0x41')](handleError(_0x656ba4,null));};exports[_0x9e0e('0x42')]=function(_0x3fc6fb,_0xb9874c){var _0x5868cc={'raw':![],'where':{'id':_0x3fc6fb['params']['id']}},_0x57c39b={};_0x57c39b[_0x9e0e('0x2d')]=_[_0x9e0e('0x2f')](db[_0x9e0e('0x2a')]['rawAttributes']);_0x57c39b['query']=_['keys'](_0x3fc6fb[_0x9e0e('0x2e')]);_0x57c39b[_0x9e0e('0x37')]=_['intersection'](_0x57c39b['model'],_0x57c39b[_0x9e0e('0x2e')]);_0x5868cc[_0x9e0e('0x31')]=_[_0x9e0e('0x30')](_0x57c39b[_0x9e0e('0x2d')],qs['fields'](_0x3fc6fb[_0x9e0e('0x2e')][_0x9e0e('0x32')]));_0x5868cc[_0x9e0e('0x31')]=_0x5868cc[_0x9e0e('0x31')]['length']?_0x5868cc[_0x9e0e('0x31')]:_0x57c39b['model'];if(_0x3fc6fb[_0x9e0e('0x2e')]['includeAll']){_0x5868cc['include']=[{'all':!![]}];}_0x5868cc=_[_0x9e0e('0x3a')]({},_0x5868cc,_0x3fc6fb['options']);return db[_0x9e0e('0x2a')]['find'](_0x5868cc)['then'](handleEntityNotFound(_0xb9874c,null))[_0x9e0e('0x23')](respondWithResult(_0xb9874c,null))['catch'](handleError(_0xb9874c,null));};exports[_0x9e0e('0x43')]=function(_0x418159,_0x101c71){return db[_0x9e0e('0x2a')][_0x9e0e('0x43')](_0x418159['body'],{})[_0x9e0e('0x23')](respondWithResult(_0x101c71,0xc9))[_0x9e0e('0x41')](handleError(_0x101c71,null));};exports[_0x9e0e('0x44')]=function(_0x487cba,_0x586194){if(_0x487cba[_0x9e0e('0x45')]['id']){delete _0x487cba[_0x9e0e('0x45')]['id'];}return db[_0x9e0e('0x2a')][_0x9e0e('0x46')]({'where':{'id':_0x487cba['params']['id']}})['then'](handleEntityNotFound(_0x586194,null))[_0x9e0e('0x23')](saveUpdates(_0x487cba[_0x9e0e('0x45')],null))[_0x9e0e('0x23')](respondWithResult(_0x586194,null))[_0x9e0e('0x41')](handleError(_0x586194,null));};exports[_0x9e0e('0x24')]=function(_0x50c11d,_0xcf5c9){return db[_0x9e0e('0x2a')][_0x9e0e('0x46')]({'where':{'id':_0x50c11d['params']['id']}})[_0x9e0e('0x23')](handleEntityNotFound(_0xcf5c9,null))['then'](removeEntity(_0xcf5c9,null))[_0x9e0e('0x41')](handleError(_0xcf5c9,null));};exports[_0x9e0e('0x47')]=function(_0x16e11e,_0x4af151,_0x511981){var _0x123db6={};var _0x40a209={};var _0x1f0039;var _0x53fed6;return db['FreshsalesConfiguration'][_0x9e0e('0x48')]({'where':{'id':_0x16e11e['params']['id']}})[_0x9e0e('0x23')](handleEntityNotFound(_0x4af151,null))['then'](function(_0x255d3b){if(_0x255d3b){_0x1f0039=_0x255d3b;_0x40a209[_0x9e0e('0x2d')]=_['keys'](db['FreshsalesField'][_0x9e0e('0x2b')]);_0x40a209[_0x9e0e('0x2e')]=_['keys'](_0x16e11e[_0x9e0e('0x2e')]);_0x40a209['filters']=_[_0x9e0e('0x30')](_0x40a209['model'],_0x40a209[_0x9e0e('0x2e')]);_0x123db6['attributes']=_[_0x9e0e('0x30')](_0x40a209[_0x9e0e('0x2d')],qs[_0x9e0e('0x32')](_0x16e11e[_0x9e0e('0x2e')][_0x9e0e('0x32')]));_0x123db6[_0x9e0e('0x31')]=_0x123db6[_0x9e0e('0x31')][_0x9e0e('0x33')]?_0x123db6[_0x9e0e('0x31')]:_0x40a209[_0x9e0e('0x2d')];_0x123db6[_0x9e0e('0x35')]=qs[_0x9e0e('0x36')](_0x16e11e['query'][_0x9e0e('0x36')]);_0x123db6['where']=qs['filters'](_['pick'](_0x16e11e['query'],_0x40a209[_0x9e0e('0x37')]));if(_0x16e11e[_0x9e0e('0x2e')][_0x9e0e('0x39')]){_0x123db6[_0x9e0e('0x3b')]=_[_0x9e0e('0x3a')](_0x123db6[_0x9e0e('0x3b')],{'$or':_[_0x9e0e('0x29')](_0x123db6[_0x9e0e('0x31')],function(_0x4e80a0){var _0x24b8ec={};_0x24b8ec[_0x4e80a0]={'$like':'%'+_0x16e11e[_0x9e0e('0x2e')]['filter']+'%'};return _0x24b8ec;})});}_0x123db6=_[_0x9e0e('0x3a')]({},_0x123db6,_0x16e11e['options']);return _0x1f0039[_0x9e0e('0x47')](_0x123db6);}})[_0x9e0e('0x23')](function(_0x3e7bc2){if(_0x3e7bc2){_0x53fed6=_0x3e7bc2[_0x9e0e('0x33')];if(!_0x16e11e[_0x9e0e('0x2e')][_0x9e0e('0x49')](_0x9e0e('0x34'))){_0x123db6[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x16e11e['query'][_0x9e0e('0x1e')]);_0x123db6['offset']=qs['offset'](_0x16e11e[_0x9e0e('0x2e')][_0x9e0e('0x1b')]);}return _0x1f0039[_0x9e0e('0x47')](_0x123db6);}})[_0x9e0e('0x23')](function(_0x59cb4c){if(_0x59cb4c){return _0x59cb4c?{'count':_0x53fed6,'rows':_0x59cb4c}:null;}})[_0x9e0e('0x23')](respondWithResult(_0x4af151,null))[_0x9e0e('0x41')](handleError(_0x4af151,null));};exports[_0x9e0e('0x4a')]=function(_0x4653b0,_0xdd5056,_0x1bc920){var _0x3af8ba={};var _0x19cd1e={};var _0x2917b7;var _0x3807e6;return db[_0x9e0e('0x2a')][_0x9e0e('0x48')]({'where':{'id':_0x4653b0['params']['id']}})[_0x9e0e('0x23')](handleEntityNotFound(_0xdd5056,null))['then'](function(_0x221b13){if(_0x221b13){_0x2917b7=_0x221b13;_0x19cd1e[_0x9e0e('0x2d')]=_[_0x9e0e('0x2f')](db[_0x9e0e('0x4b')][_0x9e0e('0x2b')]);_0x19cd1e[_0x9e0e('0x2e')]=_[_0x9e0e('0x2f')](_0x4653b0[_0x9e0e('0x2e')]);_0x19cd1e[_0x9e0e('0x37')]=_[_0x9e0e('0x30')](_0x19cd1e[_0x9e0e('0x2d')],_0x19cd1e[_0x9e0e('0x2e')]);_0x3af8ba[_0x9e0e('0x31')]=_[_0x9e0e('0x30')](_0x19cd1e[_0x9e0e('0x2d')],qs[_0x9e0e('0x32')](_0x4653b0[_0x9e0e('0x2e')][_0x9e0e('0x32')]));_0x3af8ba[_0x9e0e('0x31')]=_0x3af8ba[_0x9e0e('0x31')][_0x9e0e('0x33')]?_0x3af8ba[_0x9e0e('0x31')]:_0x19cd1e[_0x9e0e('0x2d')];_0x3af8ba['order']=qs['sort'](_0x4653b0['query'][_0x9e0e('0x36')]);_0x3af8ba[_0x9e0e('0x3b')]=qs[_0x9e0e('0x37')](_[_0x9e0e('0x38')](_0x4653b0[_0x9e0e('0x2e')],_0x19cd1e[_0x9e0e('0x37')]));if(_0x4653b0['query'][_0x9e0e('0x39')]){_0x3af8ba[_0x9e0e('0x3b')]=_[_0x9e0e('0x3a')](_0x3af8ba['where'],{'$or':_[_0x9e0e('0x29')](_0x3af8ba[_0x9e0e('0x31')],function(_0x4ee46c){var _0x2a047a={};_0x2a047a[_0x4ee46c]={'$like':'%'+_0x4653b0[_0x9e0e('0x2e')][_0x9e0e('0x39')]+'%'};return _0x2a047a;})});}_0x3af8ba=_[_0x9e0e('0x3a')]({},_0x3af8ba,_0x4653b0[_0x9e0e('0x4c')]);return _0x2917b7[_0x9e0e('0x4a')](_0x3af8ba);}})[_0x9e0e('0x23')](function(_0x38bc65){if(_0x38bc65){_0x3807e6=_0x38bc65[_0x9e0e('0x33')];if(!_0x4653b0[_0x9e0e('0x2e')][_0x9e0e('0x49')]('nolimit')){_0x3af8ba[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x4653b0[_0x9e0e('0x2e')][_0x9e0e('0x1e')]);_0x3af8ba['offset']=qs[_0x9e0e('0x1b')](_0x4653b0['query']['offset']);}return _0x2917b7[_0x9e0e('0x4a')](_0x3af8ba);}})[_0x9e0e('0x23')](function(_0x123e23){if(_0x123e23){return _0x123e23?{'count':_0x3807e6,'rows':_0x123e23}:null;}})['then'](respondWithResult(_0xdd5056,null))['catch'](handleError(_0xdd5056,null));};exports[_0x9e0e('0x4d')]=function(_0x3a392f,_0x41868f,_0x1c1298){var _0x335d3f={};var _0x7a07b6={};var _0x327f74;var _0x4d22ab;return db['FreshsalesConfiguration'][_0x9e0e('0x48')]({'where':{'id':_0x3a392f['params']['id']}})[_0x9e0e('0x23')](handleEntityNotFound(_0x41868f,null))[_0x9e0e('0x23')](function(_0x17839b){if(_0x17839b){_0x327f74=_0x17839b;_0x7a07b6['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x7a07b6[_0x9e0e('0x2e')]=_[_0x9e0e('0x2f')](_0x3a392f[_0x9e0e('0x2e')]);_0x7a07b6[_0x9e0e('0x37')]=_[_0x9e0e('0x30')](_0x7a07b6['model'],_0x7a07b6[_0x9e0e('0x2e')]);_0x335d3f[_0x9e0e('0x31')]=_['intersection'](_0x7a07b6[_0x9e0e('0x2d')],qs[_0x9e0e('0x32')](_0x3a392f[_0x9e0e('0x2e')][_0x9e0e('0x32')]));_0x335d3f[_0x9e0e('0x31')]=_0x335d3f['attributes']['length']?_0x335d3f['attributes']:_0x7a07b6[_0x9e0e('0x2d')];_0x335d3f[_0x9e0e('0x35')]=qs[_0x9e0e('0x36')](_0x3a392f[_0x9e0e('0x2e')]['sort']);_0x335d3f[_0x9e0e('0x3b')]=qs['filters'](_['pick'](_0x3a392f[_0x9e0e('0x2e')],_0x7a07b6[_0x9e0e('0x37')]));if(_0x3a392f['query']['filter']){_0x335d3f['where']=_[_0x9e0e('0x3a')](_0x335d3f['where'],{'$or':_[_0x9e0e('0x29')](_0x335d3f[_0x9e0e('0x31')],function(_0x18666d){var _0x521c96={};_0x521c96[_0x18666d]={'$like':'%'+_0x3a392f[_0x9e0e('0x2e')][_0x9e0e('0x39')]+'%'};return _0x521c96;})});}_0x335d3f=_['merge']({},_0x335d3f,_0x3a392f[_0x9e0e('0x4c')]);return _0x327f74[_0x9e0e('0x4d')](_0x335d3f);}})[_0x9e0e('0x23')](function(_0x3a89a7){if(_0x3a89a7){_0x4d22ab=_0x3a89a7[_0x9e0e('0x33')];if(!_0x3a392f['query'][_0x9e0e('0x49')](_0x9e0e('0x34'))){_0x335d3f[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x3a392f[_0x9e0e('0x2e')][_0x9e0e('0x1e')]);_0x335d3f[_0x9e0e('0x1b')]=qs[_0x9e0e('0x1b')](_0x3a392f[_0x9e0e('0x2e')][_0x9e0e('0x1b')]);}return _0x327f74[_0x9e0e('0x4d')](_0x335d3f);}})[_0x9e0e('0x23')](function(_0x140205){if(_0x140205){return _0x140205?{'count':_0x4d22ab,'rows':_0x140205}:null;}})[_0x9e0e('0x23')](respondWithResult(_0x41868f,null))[_0x9e0e('0x41')](handleError(_0x41868f,null));}; \ No newline at end of file +var _0x9bdd=['nolimit','order','sort','where','filter','merge','VIRTUAL','FreshsalesConfiguration','findAll','show','includeAll','find','create','body','params','getSubjects','findOne','FreshsalesField','catch','getDescriptions','pick','getFields','options','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x9bdd,0x1eb));var _0xd9bd=function(_0x421544,_0x4c68a3){_0x421544=_0x421544-0x0;var _0x338610=_0x9bdd[_0x421544];return _0x338610;};'use strict';var emlformat=require(_0xd9bd('0x0'));var rimraf=require(_0xd9bd('0x1'));var zipdir=require(_0xd9bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9bd('0x3'));var moment=require(_0xd9bd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd9bd('0x5'));var util=require(_0xd9bd('0x6'));var path=require(_0xd9bd('0x7'));var sox=require(_0xd9bd('0x8'));var csv=require(_0xd9bd('0x9'));var ejs=require(_0xd9bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9bd('0xb'));var squel=require(_0xd9bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xd9bd('0xd'));var deskjs=require(_0xd9bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd9bd('0xf'));var Papa=require(_0xd9bd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9bd('0x11'));var as=require(_0xd9bd('0x12'));var hardwareService=require(_0xd9bd('0x13'));var logger=require(_0xd9bd('0x14'))(_0xd9bd('0x15'));var utils=require(_0xd9bd('0x16'));var config=require(_0xd9bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9bd('0x18'))['db'];function respondWithStatusCode(_0xafa84d,_0x5045d2){_0x5045d2=_0x5045d2||0xcc;return function(_0x140f3c){if(_0x140f3c){return _0xafa84d[_0xd9bd('0x19')](_0x5045d2);}return _0xafa84d[_0xd9bd('0x1a')](_0x5045d2)[_0xd9bd('0x1b')]();};}function respondWithResult(_0x58da17,_0x17445d){_0x17445d=_0x17445d||0xc8;return function(_0x54ad92){if(_0x54ad92){return _0x58da17['status'](_0x17445d)[_0xd9bd('0x1c')](_0x54ad92);}};}function respondWithFilteredResult(_0x19d00a,_0x39fa42){return function(_0xf9d696){if(_0xf9d696){var _0x2ed0ca=typeof _0x39fa42[_0xd9bd('0x1d')]===_0xd9bd('0x1e')&&typeof _0x39fa42['limit']==='undefined';var _0x13ea96=_0xf9d696[_0xd9bd('0x1f')];var _0x2ceaf2=_0x2ed0ca?0x0:_0x39fa42[_0xd9bd('0x1d')];var _0x2edf12=_0x2ed0ca?_0xf9d696['count']:_0x39fa42[_0xd9bd('0x1d')]+_0x39fa42[_0xd9bd('0x20')];var _0x4aa7f3;if(_0x2edf12>=_0x13ea96){_0x2edf12=_0x13ea96;_0x4aa7f3=0xc8;}else{_0x4aa7f3=0xce;}_0x19d00a['status'](_0x4aa7f3);return _0x19d00a['set']('Content-Range',_0x2ceaf2+'-'+_0x2edf12+'/'+_0x13ea96)[_0xd9bd('0x1c')](_0xf9d696);}return null;};}function patchUpdates(_0x222195){return function(_0x121ed5){try{jsonpatch[_0xd9bd('0x21')](_0x121ed5,_0x222195,!![]);}catch(_0x29cd25){return BPromise[_0xd9bd('0x22')](_0x29cd25);}return _0x121ed5['save']();};}function saveUpdates(_0x5a1431,_0x112837){return function(_0x2ded6e){if(_0x2ded6e){return _0x2ded6e[_0xd9bd('0x23')](_0x5a1431)['then'](function(_0x4a1116){return _0x4a1116;});}return null;};}function removeEntity(_0x1d3844,_0x51233f){return function(_0x1a67a6){if(_0x1a67a6){return _0x1a67a6[_0xd9bd('0x24')]()[_0xd9bd('0x25')](function(){_0x1d3844['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7eef,_0x114fbd){return function(_0xc9d27f){if(!_0xc9d27f){_0x1a7eef[_0xd9bd('0x19')](0x194);}return _0xc9d27f;};}function handleError(_0x5e680f,_0x57e718){_0x57e718=_0x57e718||0x1f4;return function(_0x583aa6){logger[_0xd9bd('0x26')](_0x583aa6[_0xd9bd('0x27')]);if(_0x583aa6[_0xd9bd('0x28')]){delete _0x583aa6[_0xd9bd('0x28')];}_0x5e680f[_0xd9bd('0x1a')](_0x57e718)[_0xd9bd('0x29')](_0x583aa6);};}exports['index']=function(_0x3fbf29,_0x52d401){var _0x3a2023={},_0x5cf74b={},_0x2a6aaf={'count':0x0,'rows':[]};var _0xa04a48=_[_0xd9bd('0x2a')](db['FreshsalesConfiguration'][_0xd9bd('0x2b')],function(_0x2f1ad1){return{'name':_0x2f1ad1[_0xd9bd('0x2c')],'type':_0x2f1ad1[_0xd9bd('0x2d')]['key']};});_0x5cf74b['model']=_[_0xd9bd('0x2a')](_0xa04a48,_0xd9bd('0x28'));_0x5cf74b['query']=_[_0xd9bd('0x2e')](_0x3fbf29[_0xd9bd('0x2f')]);_0x5cf74b[_0xd9bd('0x30')]=_[_0xd9bd('0x31')](_0x5cf74b['model'],_0x5cf74b[_0xd9bd('0x2f')]);_0x3a2023[_0xd9bd('0x32')]=_['intersection'](_0x5cf74b[_0xd9bd('0x33')],qs[_0xd9bd('0x34')](_0x3fbf29[_0xd9bd('0x2f')][_0xd9bd('0x34')]));_0x3a2023[_0xd9bd('0x32')]=_0x3a2023['attributes'][_0xd9bd('0x35')]?_0x3a2023[_0xd9bd('0x32')]:_0x5cf74b[_0xd9bd('0x33')];if(!_0x3fbf29['query'][_0xd9bd('0x36')](_0xd9bd('0x37'))){_0x3a2023[_0xd9bd('0x20')]=qs[_0xd9bd('0x20')](_0x3fbf29[_0xd9bd('0x2f')]['limit']);_0x3a2023[_0xd9bd('0x1d')]=qs['offset'](_0x3fbf29['query'][_0xd9bd('0x1d')]);}_0x3a2023[_0xd9bd('0x38')]=qs[_0xd9bd('0x39')](_0x3fbf29[_0xd9bd('0x2f')][_0xd9bd('0x39')]);_0x3a2023[_0xd9bd('0x3a')]=qs[_0xd9bd('0x30')](_['pick'](_0x3fbf29[_0xd9bd('0x2f')],_0x5cf74b[_0xd9bd('0x30')]),_0xa04a48);if(_0x3fbf29[_0xd9bd('0x2f')][_0xd9bd('0x3b')]){_0x3a2023[_0xd9bd('0x3a')]=_[_0xd9bd('0x3c')](_0x3a2023[_0xd9bd('0x3a')],{'$or':_[_0xd9bd('0x2a')](_0xa04a48,function(_0x2b239e){if(_0x2b239e[_0xd9bd('0x2d')]!==_0xd9bd('0x3d')){var _0x504432={};_0x504432[_0x2b239e['name']]={'$like':'%'+_0x3fbf29[_0xd9bd('0x2f')]['filter']+'%'};return _0x504432;}})});}_0x3a2023=_[_0xd9bd('0x3c')]({},_0x3a2023,_0x3fbf29['options']);var _0x4945a4={'where':_0x3a2023[_0xd9bd('0x3a')]};return db[_0xd9bd('0x3e')][_0xd9bd('0x1f')](_0x4945a4)[_0xd9bd('0x25')](function(_0xbd6c87){_0x2a6aaf[_0xd9bd('0x1f')]=_0xbd6c87;if(_0x3fbf29['query']['includeAll']){_0x3a2023['include']=[{'all':!![]}];}return db[_0xd9bd('0x3e')][_0xd9bd('0x3f')](_0x3a2023);})[_0xd9bd('0x25')](function(_0x52b58d){_0x2a6aaf['rows']=_0x52b58d;return _0x2a6aaf;})[_0xd9bd('0x25')](respondWithFilteredResult(_0x52d401,_0x3a2023))['catch'](handleError(_0x52d401,null));};exports[_0xd9bd('0x40')]=function(_0x4bccf3,_0x4074f2){var _0x4d41d6={'raw':![],'where':{'id':_0x4bccf3['params']['id']}},_0x3df91d={};_0x3df91d[_0xd9bd('0x33')]=_[_0xd9bd('0x2e')](db[_0xd9bd('0x3e')][_0xd9bd('0x2b')]);_0x3df91d[_0xd9bd('0x2f')]=_[_0xd9bd('0x2e')](_0x4bccf3['query']);_0x3df91d[_0xd9bd('0x30')]=_['intersection'](_0x3df91d[_0xd9bd('0x33')],_0x3df91d[_0xd9bd('0x2f')]);_0x4d41d6['attributes']=_[_0xd9bd('0x31')](_0x3df91d['model'],qs[_0xd9bd('0x34')](_0x4bccf3[_0xd9bd('0x2f')][_0xd9bd('0x34')]));_0x4d41d6['attributes']=_0x4d41d6[_0xd9bd('0x32')][_0xd9bd('0x35')]?_0x4d41d6[_0xd9bd('0x32')]:_0x3df91d[_0xd9bd('0x33')];if(_0x4bccf3[_0xd9bd('0x2f')][_0xd9bd('0x41')]){_0x4d41d6['include']=[{'all':!![]}];}_0x4d41d6=_[_0xd9bd('0x3c')]({},_0x4d41d6,_0x4bccf3['options']);return db[_0xd9bd('0x3e')][_0xd9bd('0x42')](_0x4d41d6)['then'](handleEntityNotFound(_0x4074f2,null))[_0xd9bd('0x25')](respondWithResult(_0x4074f2,null))['catch'](handleError(_0x4074f2,null));};exports[_0xd9bd('0x43')]=function(_0x37c5a6,_0x185893){return db[_0xd9bd('0x3e')][_0xd9bd('0x43')](_0x37c5a6[_0xd9bd('0x44')],{})['then'](respondWithResult(_0x185893,0xc9))['catch'](handleError(_0x185893,null));};exports['update']=function(_0x344c42,_0x3484ce){if(_0x344c42[_0xd9bd('0x44')]['id']){delete _0x344c42[_0xd9bd('0x44')]['id'];}return db[_0xd9bd('0x3e')][_0xd9bd('0x42')]({'where':{'id':_0x344c42[_0xd9bd('0x45')]['id']}})[_0xd9bd('0x25')](handleEntityNotFound(_0x3484ce,null))[_0xd9bd('0x25')](saveUpdates(_0x344c42['body'],null))[_0xd9bd('0x25')](respondWithResult(_0x3484ce,null))['catch'](handleError(_0x3484ce,null));};exports[_0xd9bd('0x24')]=function(_0x403bea,_0x17305e){return db[_0xd9bd('0x3e')][_0xd9bd('0x42')]({'where':{'id':_0x403bea[_0xd9bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x17305e,null))[_0xd9bd('0x25')](removeEntity(_0x17305e,null))['catch'](handleError(_0x17305e,null));};exports[_0xd9bd('0x46')]=function(_0x5f4661,_0x247995,_0x43cd9a){var _0x46533c={};var _0x5867a6={};var _0x1fa3ed;var _0x4ffa17;return db[_0xd9bd('0x3e')][_0xd9bd('0x47')]({'where':{'id':_0x5f4661[_0xd9bd('0x45')]['id']}})[_0xd9bd('0x25')](handleEntityNotFound(_0x247995,null))[_0xd9bd('0x25')](function(_0x121378){if(_0x121378){_0x1fa3ed=_0x121378;_0x5867a6[_0xd9bd('0x33')]=_[_0xd9bd('0x2e')](db[_0xd9bd('0x48')]['rawAttributes']);_0x5867a6['query']=_[_0xd9bd('0x2e')](_0x5f4661[_0xd9bd('0x2f')]);_0x5867a6[_0xd9bd('0x30')]=_[_0xd9bd('0x31')](_0x5867a6[_0xd9bd('0x33')],_0x5867a6['query']);_0x46533c[_0xd9bd('0x32')]=_['intersection'](_0x5867a6[_0xd9bd('0x33')],qs[_0xd9bd('0x34')](_0x5f4661[_0xd9bd('0x2f')][_0xd9bd('0x34')]));_0x46533c[_0xd9bd('0x32')]=_0x46533c['attributes'][_0xd9bd('0x35')]?_0x46533c['attributes']:_0x5867a6['model'];_0x46533c[_0xd9bd('0x38')]=qs[_0xd9bd('0x39')](_0x5f4661[_0xd9bd('0x2f')][_0xd9bd('0x39')]);_0x46533c[_0xd9bd('0x3a')]=qs[_0xd9bd('0x30')](_['pick'](_0x5f4661[_0xd9bd('0x2f')],_0x5867a6[_0xd9bd('0x30')]));if(_0x5f4661[_0xd9bd('0x2f')][_0xd9bd('0x3b')]){_0x46533c['where']=_[_0xd9bd('0x3c')](_0x46533c[_0xd9bd('0x3a')],{'$or':_[_0xd9bd('0x2a')](_0x46533c[_0xd9bd('0x32')],function(_0x3cd3ac){var _0x54900e={};_0x54900e[_0x3cd3ac]={'$like':'%'+_0x5f4661['query'][_0xd9bd('0x3b')]+'%'};return _0x54900e;})});}_0x46533c=_[_0xd9bd('0x3c')]({},_0x46533c,_0x5f4661['options']);return _0x1fa3ed[_0xd9bd('0x46')](_0x46533c);}})[_0xd9bd('0x25')](function(_0x5850ca){if(_0x5850ca){_0x4ffa17=_0x5850ca[_0xd9bd('0x35')];if(!_0x5f4661['query'][_0xd9bd('0x36')]('nolimit')){_0x46533c[_0xd9bd('0x20')]=qs[_0xd9bd('0x20')](_0x5f4661[_0xd9bd('0x2f')][_0xd9bd('0x20')]);_0x46533c[_0xd9bd('0x1d')]=qs[_0xd9bd('0x1d')](_0x5f4661[_0xd9bd('0x2f')]['offset']);}return _0x1fa3ed[_0xd9bd('0x46')](_0x46533c);}})[_0xd9bd('0x25')](function(_0x3fd310){if(_0x3fd310){return _0x3fd310?{'count':_0x4ffa17,'rows':_0x3fd310}:null;}})['then'](respondWithResult(_0x247995,null))[_0xd9bd('0x49')](handleError(_0x247995,null));};exports[_0xd9bd('0x4a')]=function(_0x25321c,_0x7a5942,_0x4e3ee5){var _0x322690={};var _0x2e90d2={};var _0x11fc70;var _0x401290;return db[_0xd9bd('0x3e')][_0xd9bd('0x47')]({'where':{'id':_0x25321c['params']['id']}})[_0xd9bd('0x25')](handleEntityNotFound(_0x7a5942,null))[_0xd9bd('0x25')](function(_0x2dee81){if(_0x2dee81){_0x11fc70=_0x2dee81;_0x2e90d2[_0xd9bd('0x33')]=_[_0xd9bd('0x2e')](db[_0xd9bd('0x48')][_0xd9bd('0x2b')]);_0x2e90d2['query']=_[_0xd9bd('0x2e')](_0x25321c['query']);_0x2e90d2[_0xd9bd('0x30')]=_['intersection'](_0x2e90d2[_0xd9bd('0x33')],_0x2e90d2['query']);_0x322690[_0xd9bd('0x32')]=_[_0xd9bd('0x31')](_0x2e90d2[_0xd9bd('0x33')],qs[_0xd9bd('0x34')](_0x25321c[_0xd9bd('0x2f')]['fields']));_0x322690[_0xd9bd('0x32')]=_0x322690['attributes'][_0xd9bd('0x35')]?_0x322690[_0xd9bd('0x32')]:_0x2e90d2[_0xd9bd('0x33')];_0x322690['order']=qs[_0xd9bd('0x39')](_0x25321c[_0xd9bd('0x2f')][_0xd9bd('0x39')]);_0x322690[_0xd9bd('0x3a')]=qs[_0xd9bd('0x30')](_[_0xd9bd('0x4b')](_0x25321c[_0xd9bd('0x2f')],_0x2e90d2['filters']));if(_0x25321c[_0xd9bd('0x2f')]['filter']){_0x322690[_0xd9bd('0x3a')]=_[_0xd9bd('0x3c')](_0x322690[_0xd9bd('0x3a')],{'$or':_[_0xd9bd('0x2a')](_0x322690[_0xd9bd('0x32')],function(_0x1cf774){var _0x73fc5f={};_0x73fc5f[_0x1cf774]={'$like':'%'+_0x25321c[_0xd9bd('0x2f')]['filter']+'%'};return _0x73fc5f;})});}_0x322690=_['merge']({},_0x322690,_0x25321c['options']);return _0x11fc70[_0xd9bd('0x4a')](_0x322690);}})[_0xd9bd('0x25')](function(_0xfe7967){if(_0xfe7967){_0x401290=_0xfe7967[_0xd9bd('0x35')];if(!_0x25321c[_0xd9bd('0x2f')]['hasOwnProperty']('nolimit')){_0x322690[_0xd9bd('0x20')]=qs[_0xd9bd('0x20')](_0x25321c[_0xd9bd('0x2f')][_0xd9bd('0x20')]);_0x322690['offset']=qs[_0xd9bd('0x1d')](_0x25321c[_0xd9bd('0x2f')][_0xd9bd('0x1d')]);}return _0x11fc70['getDescriptions'](_0x322690);}})['then'](function(_0x49ff85){if(_0x49ff85){return _0x49ff85?{'count':_0x401290,'rows':_0x49ff85}:null;}})[_0xd9bd('0x25')](respondWithResult(_0x7a5942,null))[_0xd9bd('0x49')](handleError(_0x7a5942,null));};exports[_0xd9bd('0x4c')]=function(_0x5ad595,_0x17c387,_0x3f476c){var _0x429f77={};var _0x554526={};var _0x516f6b;var _0x5f2453;return db['FreshsalesConfiguration'][_0xd9bd('0x47')]({'where':{'id':_0x5ad595['params']['id']}})[_0xd9bd('0x25')](handleEntityNotFound(_0x17c387,null))['then'](function(_0x291bb8){if(_0x291bb8){_0x516f6b=_0x291bb8;_0x554526['model']=_[_0xd9bd('0x2e')](db[_0xd9bd('0x48')][_0xd9bd('0x2b')]);_0x554526[_0xd9bd('0x2f')]=_[_0xd9bd('0x2e')](_0x5ad595[_0xd9bd('0x2f')]);_0x554526['filters']=_['intersection'](_0x554526[_0xd9bd('0x33')],_0x554526[_0xd9bd('0x2f')]);_0x429f77['attributes']=_['intersection'](_0x554526[_0xd9bd('0x33')],qs['fields'](_0x5ad595[_0xd9bd('0x2f')][_0xd9bd('0x34')]));_0x429f77[_0xd9bd('0x32')]=_0x429f77[_0xd9bd('0x32')][_0xd9bd('0x35')]?_0x429f77[_0xd9bd('0x32')]:_0x554526[_0xd9bd('0x33')];_0x429f77[_0xd9bd('0x38')]=qs['sort'](_0x5ad595[_0xd9bd('0x2f')][_0xd9bd('0x39')]);_0x429f77[_0xd9bd('0x3a')]=qs[_0xd9bd('0x30')](_[_0xd9bd('0x4b')](_0x5ad595[_0xd9bd('0x2f')],_0x554526[_0xd9bd('0x30')]));if(_0x5ad595['query'][_0xd9bd('0x3b')]){_0x429f77[_0xd9bd('0x3a')]=_['merge'](_0x429f77[_0xd9bd('0x3a')],{'$or':_[_0xd9bd('0x2a')](_0x429f77[_0xd9bd('0x32')],function(_0x252cb3){var _0x462604={};_0x462604[_0x252cb3]={'$like':'%'+_0x5ad595[_0xd9bd('0x2f')]['filter']+'%'};return _0x462604;})});}_0x429f77=_[_0xd9bd('0x3c')]({},_0x429f77,_0x5ad595[_0xd9bd('0x4d')]);return _0x516f6b['getFields'](_0x429f77);}})[_0xd9bd('0x25')](function(_0x34b077){if(_0x34b077){_0x5f2453=_0x34b077[_0xd9bd('0x35')];if(!_0x5ad595[_0xd9bd('0x2f')]['hasOwnProperty']('nolimit')){_0x429f77[_0xd9bd('0x20')]=qs['limit'](_0x5ad595[_0xd9bd('0x2f')][_0xd9bd('0x20')]);_0x429f77[_0xd9bd('0x1d')]=qs[_0xd9bd('0x1d')](_0x5ad595[_0xd9bd('0x2f')][_0xd9bd('0x1d')]);}return _0x516f6b[_0xd9bd('0x4c')](_0x429f77);}})[_0xd9bd('0x25')](function(_0x5d1ca0){if(_0x5d1ca0){return _0x5d1ca0?{'count':_0x5f2453,'rows':_0x5d1ca0}:null;}})[_0xd9bd('0x25')](respondWithResult(_0x17c387,null))[_0xd9bd('0x49')](handleError(_0x17c387,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b2ed8ee..2de8368 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 _0x119a=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0x119a,0x6f));var _0xa119=function(_0xe38dde,_0x143e49){_0xe38dde=_0xe38dde-0x0;var _0x3e1eea=_0x119a[_0xe38dde];return _0x3e1eea;};'use strict';var _=require(_0xa119('0x0'));var util=require(_0xa119('0x1'));var logger=require(_0xa119('0x2'))('api');var moment=require(_0xa119('0x3'));var BPromise=require('bluebird');var rp=require(_0xa119('0x4'));var fs=require('fs');var path=require(_0xa119('0x5'));var rimraf=require(_0xa119('0x6'));var config=require(_0xa119('0x7'));var attributes=require(_0xa119('0x8'));module['exports']=function(_0xb6c627,_0x2647aa){return _0xb6c627['define']('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd09=['api','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x5412c2,_0x2f3149){var _0x5766d0=function(_0xc6de7d){while(--_0xc6de7d){_0x5412c2['push'](_0x5412c2['shift']());}};_0x5766d0(++_0x2f3149);}(_0xcd09,0x105));var _0x9cd0=function(_0x3afb73,_0xaa578f){_0x3afb73=_0x3afb73-0x0;var _0x5165f2=_0xcd09[_0x3afb73];return _0x5165f2;};'use strict';var _=require(_0x9cd0('0x0'));var util=require(_0x9cd0('0x1'));var logger=require(_0x9cd0('0x2'))(_0x9cd0('0x3'));var moment=require(_0x9cd0('0x4'));var BPromise=require('bluebird');var rp=require(_0x9cd0('0x5'));var fs=require('fs');var path=require(_0x9cd0('0x6'));var rimraf=require(_0x9cd0('0x7'));var config=require('../../config/environment');var attributes=require(_0x9cd0('0x8'));module['exports']=function(_0x4da56a,_0x52d292){return _0x4da56a[_0x9cd0('0x9')](_0x9cd0('0xa'),attributes,{'tableName':_0x9cd0('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 7673893..140843c 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 _0x14ed=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x1264f7,_0x120f0f){var _0x2c3a94=function(_0x5c6806){while(--_0x5c6806){_0x1264f7['push'](_0x1264f7['shift']());}};_0x2c3a94(++_0x120f0f);}(_0x14ed,0x120));var _0xd14e=function(_0x1d0a81,_0x33efb5){_0x1d0a81=_0x1d0a81-0x0;var _0x4f2874=_0x14ed[_0x1d0a81];return _0x4f2874;};'use strict';var _=require(_0xd14e('0x0'));var util=require(_0xd14e('0x1'));var moment=require('moment');var BPromise=require(_0xd14e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd14e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd14e('0x4'))(_0xd14e('0x5'));var config=require(_0xd14e('0x6'));var jayson=require(_0xd14e('0x7'));var client=jayson[_0xd14e('0x8')][_0xd14e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4159fb,_0x1eb103,_0x569194){return new BPromise(function(_0x1e98b5,_0x5d96fa){return client['request'](_0x4159fb,_0x569194)[_0xd14e('0xa')](function(_0x3088b4){logger[_0xd14e('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1eb103,_0xd14e('0xc'));logger[_0xd14e('0xd')](_0xd14e('0xe'),_0x1eb103,_0xd14e('0xc'),JSON[_0xd14e('0xf')](_0x3088b4));if(_0x3088b4[_0xd14e('0x10')]){if(_0x3088b4['error'][_0xd14e('0x11')]===0x1f4){logger['error'](_0xd14e('0x12'),_0x1eb103,_0x3088b4['error'][_0xd14e('0x13')]);return _0x5d96fa(_0x3088b4[_0xd14e('0x10')]['message']);}logger[_0xd14e('0x10')](_0xd14e('0x12'),_0x1eb103,_0x3088b4['error'][_0xd14e('0x13')]);return _0x1e98b5(_0x3088b4['error']['message']);}else{logger['info'](_0xd14e('0x12'),_0x1eb103,'request\x20sent');_0x1e98b5(_0x3088b4['result'][_0xd14e('0x13')]);}})[_0xd14e('0x14')](function(_0x52a990){logger[_0xd14e('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1eb103,_0x52a990);_0x5d96fa(_0x52a990);});});} \ No newline at end of file +var _0xa82f=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x4c7dd4,_0x3d794f){var _0x45fcd3=function(_0x42119d){while(--_0x42119d){_0x4c7dd4['push'](_0x4c7dd4['shift']());}};_0x45fcd3(++_0x3d794f);}(_0xa82f,0x127));var _0xfa82=function(_0x35631e,_0x2b0105){_0x35631e=_0x35631e-0x0;var _0x1aa7b7=_0xa82f[_0x35631e];return _0x1aa7b7;};'use strict';var _=require('lodash');var util=require(_0xfa82('0x0'));var moment=require(_0xfa82('0x1'));var BPromise=require(_0xfa82('0x2'));var rs=require(_0xfa82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa82('0x4'))['db'];var utils=require(_0xfa82('0x5'));var logger=require(_0xfa82('0x6'))(_0xfa82('0x7'));var config=require(_0xfa82('0x8'));var jayson=require(_0xfa82('0x9'));var client=jayson['client'][_0xfa82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32db2e,_0x55bd1d,_0x2df142){return new BPromise(function(_0x6c6243,_0x172555){return client['request'](_0x32db2e,_0x2df142)[_0xfa82('0xb')](function(_0x1e5b71){logger[_0xfa82('0xc')](_0xfa82('0xd'),_0x55bd1d,_0xfa82('0xe'));logger[_0xfa82('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x55bd1d,'request\x20sent',JSON[_0xfa82('0x10')](_0x1e5b71));if(_0x1e5b71['error']){if(_0x1e5b71[_0xfa82('0x11')][_0xfa82('0x12')]===0x1f4){logger[_0xfa82('0x11')](_0xfa82('0xd'),_0x55bd1d,_0x1e5b71[_0xfa82('0x11')][_0xfa82('0x13')]);return _0x172555(_0x1e5b71[_0xfa82('0x11')][_0xfa82('0x13')]);}logger['error'](_0xfa82('0xd'),_0x55bd1d,_0x1e5b71[_0xfa82('0x11')][_0xfa82('0x13')]);return _0x6c6243(_0x1e5b71['error']['message']);}else{logger[_0xfa82('0xc')](_0xfa82('0xd'),_0x55bd1d,'request\x20sent');_0x6c6243(_0x1e5b71[_0xfa82('0x14')][_0xfa82('0x13')]);}})[_0xfa82('0x15')](function(_0x3c1d4d){logger[_0xfa82('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55bd1d,_0x3c1d4d);_0x172555(_0x3c1d4d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e7e42a3..6b82937 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 _0x6c76=['/:id','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x6c76,0x184));var _0x66c7=function(_0x267384,_0x5d02a2){_0x267384=_0x267384-0x0;var _0x1387e6=_0x6c76[_0x267384];return _0x1387e6;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0xa')]('/',auth[_0x66c7('0x8')](),controller['create']);router[_0x66c7('0xb')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xd')]);router['delete'](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);module[_0x66c7('0xf')]=router; \ No newline at end of file +var _0xce9b=['fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','put','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xce9b,0xc6));var _0xbce9=function(_0x44f176,_0x5f0cac){_0x44f176=_0x44f176-0x0;var _0x1cc0fe=_0xce9b[_0x44f176];return _0x1cc0fe;};'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('0xe')]('/',auth[_0xbce9('0xb')](),controller['create']);router[_0xbce9('0xf')](_0xbce9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbce9('0x10')](_0xbce9('0xd'),auth[_0xbce9('0xb')](),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 5377080..2f6d774 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 _0xef15=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xef15,0x12c));var _0x5ef1=function(_0x169639,_0x146136){_0x169639=_0x169639-0x0;var _0x277351=_0xef15[_0x169639];return _0x277351;};'use strict';var Sequelize=require(_0x5ef1('0x0'));module[_0x5ef1('0x1')]={'type':{'type':Sequelize[_0x5ef1('0x2')](_0x5ef1('0x3'),'variable','customVariable',_0x5ef1('0x4'),_0x5ef1('0x5')),'defaultValue':_0x5ef1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5ef1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5ef1('0x3'),'variable',_0x5ef1('0x7'))},'keyContent':{'type':Sequelize[_0x5ef1('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5ef1('0x6')]},'customField':{'type':Sequelize[_0x5ef1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ef1('0x6')]}}; \ No newline at end of file +var _0xceb5=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x2c10ab,_0x58c3bf){var _0x35ea64=function(_0x1110b2){while(--_0x1110b2){_0x2c10ab['push'](_0x2c10ab['shift']());}};_0x35ea64(++_0x58c3bf);}(_0xceb5,0x81));var _0x5ceb=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xceb5[_0x53bcc3];return _0x47c959;};'use strict';var Sequelize=require(_0x5ceb('0x0'));module[_0x5ceb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5ceb('0x2'),_0x5ceb('0x3'),_0x5ceb('0x4'),'keyValue',_0x5ceb('0x5')),'defaultValue':_0x5ceb('0x2')},'content':{'type':Sequelize[_0x5ceb('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5ceb('0x7')](_0x5ceb('0x2'),_0x5ceb('0x3'),_0x5ceb('0x4'))},'keyContent':{'type':Sequelize[_0x5ceb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5ceb('0x6')]},'customField':{'type':Sequelize[_0x5ceb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ceb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c50a3ee..11f9b54 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 _0xd79d=['lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x4da2e7,_0x3e961a){var _0x1f3081=function(_0x49ddd9){while(--_0x49ddd9){_0x4da2e7['push'](_0x4da2e7['shift']());}};_0x1f3081(++_0x3e961a);}(_0xd79d,0x158));var _0xdd79=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0xd79d[_0x4ede09];return _0x253193;};'use strict';var emlformat=require(_0xdd79('0x0'));var rimraf=require(_0xdd79('0x1'));var zipdir=require(_0xdd79('0x2'));var jsonpatch=require(_0xdd79('0x3'));var rp=require(_0xdd79('0x4'));var moment=require('moment');var BPromise=require(_0xdd79('0x5'));var Mustache=require(_0xdd79('0x6'));var util=require(_0xdd79('0x7'));var path=require(_0xdd79('0x8'));var sox=require('sox');var csv=require(_0xdd79('0x9'));var ejs=require(_0xdd79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd79('0xb'));var squel=require('squel');var crypto=require(_0xdd79('0xc'));var jsforce=require(_0xdd79('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdd79('0x9'));var querystring=require(_0xdd79('0xe'));var Papa=require(_0xdd79('0xf'));var Redis=require('ioredis');var authService=require(_0xdd79('0x10'));var qs=require(_0xdd79('0x11'));var as=require(_0xdd79('0x12'));var hardwareService=require(_0xdd79('0x13'));var logger=require(_0xdd79('0x14'))(_0xdd79('0x15'));var utils=require(_0xdd79('0x16'));var config=require(_0xdd79('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd79('0x18'))['db'];function respondWithStatusCode(_0x3362d4,_0x2adf4b){_0x2adf4b=_0x2adf4b||0xcc;return function(_0x57a791){if(_0x57a791){return _0x3362d4[_0xdd79('0x19')](_0x2adf4b);}return _0x3362d4[_0xdd79('0x1a')](_0x2adf4b)[_0xdd79('0x1b')]();};}function respondWithResult(_0x3f8634,_0xbe0e6d){_0xbe0e6d=_0xbe0e6d||0xc8;return function(_0x1c7f9b){if(_0x1c7f9b){return _0x3f8634['status'](_0xbe0e6d)[_0xdd79('0x1c')](_0x1c7f9b);}};}function respondWithFilteredResult(_0x32cb34,_0x205417){return function(_0x475039){if(_0x475039){var _0x54954d=typeof _0x205417[_0xdd79('0x1d')]===_0xdd79('0x1e')&&typeof _0x205417[_0xdd79('0x1f')]===_0xdd79('0x1e');var _0x37b423=_0x475039[_0xdd79('0x20')];var _0x24d589=_0x54954d?0x0:_0x205417['offset'];var _0xf71e1=_0x54954d?_0x475039[_0xdd79('0x20')]:_0x205417[_0xdd79('0x1d')]+_0x205417[_0xdd79('0x1f')];var _0x22b391;if(_0xf71e1>=_0x37b423){_0xf71e1=_0x37b423;_0x22b391=0xc8;}else{_0x22b391=0xce;}_0x32cb34['status'](_0x22b391);return _0x32cb34['set']('Content-Range',_0x24d589+'-'+_0xf71e1+'/'+_0x37b423)[_0xdd79('0x1c')](_0x475039);}return null;};}function patchUpdates(_0x52015b){return function(_0x3e16f0){try{jsonpatch[_0xdd79('0x21')](_0x3e16f0,_0x52015b,!![]);}catch(_0x35db9f){return BPromise[_0xdd79('0x22')](_0x35db9f);}return _0x3e16f0['save']();};}function saveUpdates(_0x481c95,_0x366d6b){return function(_0x26b25a){if(_0x26b25a){return _0x26b25a[_0xdd79('0x23')](_0x481c95)[_0xdd79('0x24')](function(_0x251812){return _0x251812;});}return null;};}function removeEntity(_0x52797c,_0x3d270d){return function(_0x36702d){if(_0x36702d){return _0x36702d[_0xdd79('0x25')]()['then'](function(){_0x52797c[_0xdd79('0x1a')](0xcc)[_0xdd79('0x1b')]();});}};}function handleEntityNotFound(_0x1795aa,_0x246cb1){return function(_0x7fd8f1){if(!_0x7fd8f1){_0x1795aa[_0xdd79('0x19')](0x194);}return _0x7fd8f1;};}function handleError(_0x29fd9b,_0x5e4e77){_0x5e4e77=_0x5e4e77||0x1f4;return function(_0x5b1ef6){logger[_0xdd79('0x26')](_0x5b1ef6['stack']);if(_0x5b1ef6[_0xdd79('0x27')]){delete _0x5b1ef6[_0xdd79('0x27')];}_0x29fd9b[_0xdd79('0x1a')](_0x5e4e77)[_0xdd79('0x28')](_0x5b1ef6);};}exports['index']=function(_0x51b63b,_0x4d477c){var _0x4916ae={},_0x4aaec1={},_0x7f5952={'count':0x0,'rows':[]};var _0x32a2b5=_[_0xdd79('0x29')](db['FreshsalesField'][_0xdd79('0x2a')],function(_0x1dd9ef){return{'name':_0x1dd9ef[_0xdd79('0x2b')],'type':_0x1dd9ef[_0xdd79('0x2c')][_0xdd79('0x2d')]};});_0x4aaec1[_0xdd79('0x2e')]=_[_0xdd79('0x29')](_0x32a2b5,'name');_0x4aaec1[_0xdd79('0x2f')]=_[_0xdd79('0x30')](_0x51b63b[_0xdd79('0x2f')]);_0x4aaec1[_0xdd79('0x31')]=_['intersection'](_0x4aaec1[_0xdd79('0x2e')],_0x4aaec1[_0xdd79('0x2f')]);_0x4916ae[_0xdd79('0x32')]=_['intersection'](_0x4aaec1['model'],qs[_0xdd79('0x33')](_0x51b63b[_0xdd79('0x2f')]['fields']));_0x4916ae[_0xdd79('0x32')]=_0x4916ae[_0xdd79('0x32')][_0xdd79('0x34')]?_0x4916ae[_0xdd79('0x32')]:_0x4aaec1['model'];if(!_0x51b63b[_0xdd79('0x2f')][_0xdd79('0x35')]('nolimit')){_0x4916ae[_0xdd79('0x1f')]=qs[_0xdd79('0x1f')](_0x51b63b[_0xdd79('0x2f')]['limit']);_0x4916ae['offset']=qs[_0xdd79('0x1d')](_0x51b63b[_0xdd79('0x2f')]['offset']);}_0x4916ae['order']=qs[_0xdd79('0x36')](_0x51b63b[_0xdd79('0x2f')][_0xdd79('0x36')]);_0x4916ae['where']=qs[_0xdd79('0x31')](_['pick'](_0x51b63b[_0xdd79('0x2f')],_0x4aaec1[_0xdd79('0x31')]),_0x32a2b5);if(_0x51b63b[_0xdd79('0x2f')][_0xdd79('0x37')]){_0x4916ae[_0xdd79('0x38')]=_[_0xdd79('0x39')](_0x4916ae[_0xdd79('0x38')],{'$or':_['map'](_0x32a2b5,function(_0x33b412){if(_0x33b412[_0xdd79('0x2c')]!==_0xdd79('0x3a')){var _0x27df45={};_0x27df45[_0x33b412[_0xdd79('0x27')]]={'$like':'%'+_0x51b63b[_0xdd79('0x2f')]['filter']+'%'};return _0x27df45;}})});}_0x4916ae=_[_0xdd79('0x39')]({},_0x4916ae,_0x51b63b[_0xdd79('0x3b')]);var _0x1c7ddb={'where':_0x4916ae[_0xdd79('0x38')]};return db[_0xdd79('0x3c')]['count'](_0x1c7ddb)[_0xdd79('0x24')](function(_0x554cf2){_0x7f5952[_0xdd79('0x20')]=_0x554cf2;if(_0x51b63b['query'][_0xdd79('0x3d')]){_0x4916ae[_0xdd79('0x3e')]=[{'all':!![]}];}return db[_0xdd79('0x3c')][_0xdd79('0x3f')](_0x4916ae);})[_0xdd79('0x24')](function(_0x269bb3){_0x7f5952[_0xdd79('0x40')]=_0x269bb3;return _0x7f5952;})[_0xdd79('0x24')](respondWithFilteredResult(_0x4d477c,_0x4916ae))[_0xdd79('0x41')](handleError(_0x4d477c,null));};exports['show']=function(_0x4e8e1e,_0x18a9b5){var _0x2a2157={'raw':!![],'where':{'id':_0x4e8e1e[_0xdd79('0x42')]['id']}},_0x42e713={};_0x42e713['model']=_[_0xdd79('0x30')](db['FreshsalesField'][_0xdd79('0x2a')]);_0x42e713[_0xdd79('0x2f')]=_[_0xdd79('0x30')](_0x4e8e1e[_0xdd79('0x2f')]);_0x42e713[_0xdd79('0x31')]=_[_0xdd79('0x43')](_0x42e713[_0xdd79('0x2e')],_0x42e713['query']);_0x2a2157[_0xdd79('0x32')]=_['intersection'](_0x42e713[_0xdd79('0x2e')],qs[_0xdd79('0x33')](_0x4e8e1e['query']['fields']));_0x2a2157[_0xdd79('0x32')]=_0x2a2157[_0xdd79('0x32')][_0xdd79('0x34')]?_0x2a2157['attributes']:_0x42e713[_0xdd79('0x2e')];if(_0x4e8e1e[_0xdd79('0x2f')]['includeAll']){_0x2a2157['include']=[{'all':!![]}];}_0x2a2157=_[_0xdd79('0x39')]({},_0x2a2157,_0x4e8e1e[_0xdd79('0x3b')]);return db[_0xdd79('0x3c')][_0xdd79('0x44')](_0x2a2157)[_0xdd79('0x24')](handleEntityNotFound(_0x18a9b5,null))[_0xdd79('0x24')](respondWithResult(_0x18a9b5,null))[_0xdd79('0x41')](handleError(_0x18a9b5,null));};exports[_0xdd79('0x45')]=function(_0x292aac,_0xd4a183){return db[_0xdd79('0x3c')][_0xdd79('0x45')](_0x292aac['body'],{})[_0xdd79('0x24')](respondWithResult(_0xd4a183,0xc9))['catch'](handleError(_0xd4a183,null));};exports[_0xdd79('0x23')]=function(_0x3c6304,_0x4b5a01){if(_0x3c6304[_0xdd79('0x46')]['id']){delete _0x3c6304[_0xdd79('0x46')]['id'];}return db[_0xdd79('0x3c')][_0xdd79('0x44')]({'where':{'id':_0x3c6304[_0xdd79('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b5a01,null))['then'](saveUpdates(_0x3c6304[_0xdd79('0x46')],null))['then'](respondWithResult(_0x4b5a01,null))[_0xdd79('0x41')](handleError(_0x4b5a01,null));};exports['destroy']=function(_0x4b31fb,_0xb33da){return db[_0xdd79('0x3c')][_0xdd79('0x44')]({'where':{'id':_0x4b31fb[_0xdd79('0x42')]['id']}})[_0xdd79('0x24')](handleEntityNotFound(_0xb33da,null))[_0xdd79('0x24')](removeEntity(_0xb33da,null))[_0xdd79('0x41')](handleError(_0xb33da,null));}; \ No newline at end of file +var _0xafd2=['find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','end','name','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','rawAttributes'];(function(_0x4d25fe,_0x58a160){var _0x1376ea=function(_0xa6a155){while(--_0xa6a155){_0x4d25fe['push'](_0x4d25fe['shift']());}};_0x1376ea(++_0x58a160);}(_0xafd2,0x16c));var _0x2afd=function(_0x49b8e8,_0x4a6e50){_0x49b8e8=_0x49b8e8-0x0;var _0x1237a0=_0xafd2[_0x49b8e8];return _0x1237a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2afd('0x0'));var zipdir=require(_0x2afd('0x1'));var jsonpatch=require(_0x2afd('0x2'));var rp=require(_0x2afd('0x3'));var moment=require(_0x2afd('0x4'));var BPromise=require(_0x2afd('0x5'));var Mustache=require(_0x2afd('0x6'));var util=require(_0x2afd('0x7'));var path=require('path');var sox=require(_0x2afd('0x8'));var csv=require(_0x2afd('0x9'));var ejs=require(_0x2afd('0xa'));var fs=require('fs');var fs_extra=require(_0x2afd('0xb'));var _=require(_0x2afd('0xc'));var squel=require(_0x2afd('0xd'));var crypto=require(_0x2afd('0xe'));var jsforce=require(_0x2afd('0xf'));var deskjs=require(_0x2afd('0x10'));var toCsv=require(_0x2afd('0x9'));var querystring=require('querystring');var Papa=require(_0x2afd('0x11'));var Redis=require(_0x2afd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2afd('0x13'));var hardwareService=require(_0x2afd('0x14'));var logger=require(_0x2afd('0x15'))(_0x2afd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2afd('0x17'))['db'];function respondWithStatusCode(_0x4dd1c7,_0x568f6d){_0x568f6d=_0x568f6d||0xcc;return function(_0x1496cf){if(_0x1496cf){return _0x4dd1c7[_0x2afd('0x18')](_0x568f6d);}return _0x4dd1c7[_0x2afd('0x19')](_0x568f6d)['end']();};}function respondWithResult(_0x682d5e,_0xd97622){_0xd97622=_0xd97622||0xc8;return function(_0x1b2cd8){if(_0x1b2cd8){return _0x682d5e[_0x2afd('0x19')](_0xd97622)[_0x2afd('0x1a')](_0x1b2cd8);}};}function respondWithFilteredResult(_0x4211d4,_0x20c28d){return function(_0x41b372){if(_0x41b372){var _0x38ff8b=typeof _0x20c28d[_0x2afd('0x1b')]==='undefined'&&typeof _0x20c28d[_0x2afd('0x1c')]===_0x2afd('0x1d');var _0x198a2a=_0x41b372[_0x2afd('0x1e')];var _0x2315e1=_0x38ff8b?0x0:_0x20c28d['offset'];var _0x52789f=_0x38ff8b?_0x41b372[_0x2afd('0x1e')]:_0x20c28d[_0x2afd('0x1b')]+_0x20c28d['limit'];var _0x5431c5;if(_0x52789f>=_0x198a2a){_0x52789f=_0x198a2a;_0x5431c5=0xc8;}else{_0x5431c5=0xce;}_0x4211d4[_0x2afd('0x19')](_0x5431c5);return _0x4211d4[_0x2afd('0x1f')](_0x2afd('0x20'),_0x2315e1+'-'+_0x52789f+'/'+_0x198a2a)[_0x2afd('0x1a')](_0x41b372);}return null;};}function patchUpdates(_0x2cb5fc){return function(_0x15e6e2){try{jsonpatch[_0x2afd('0x21')](_0x15e6e2,_0x2cb5fc,!![]);}catch(_0x34064e){return BPromise[_0x2afd('0x22')](_0x34064e);}return _0x15e6e2['save']();};}function saveUpdates(_0x30ebb6,_0x52472a){return function(_0x5de00f){if(_0x5de00f){return _0x5de00f['update'](_0x30ebb6)['then'](function(_0x4d5295){return _0x4d5295;});}return null;};}function removeEntity(_0x4cc7cb,_0x105873){return function(_0x5c9814){if(_0x5c9814){return _0x5c9814['destroy']()[_0x2afd('0x23')](function(){_0x4cc7cb[_0x2afd('0x19')](0xcc)[_0x2afd('0x24')]();});}};}function handleEntityNotFound(_0x561b13,_0x3049f3){return function(_0x481353){if(!_0x481353){_0x561b13['sendStatus'](0x194);}return _0x481353;};}function handleError(_0x5c6255,_0x52660a){_0x52660a=_0x52660a||0x1f4;return function(_0x19d82c){logger['error'](_0x19d82c['stack']);if(_0x19d82c[_0x2afd('0x25')]){delete _0x19d82c[_0x2afd('0x25')];}_0x5c6255[_0x2afd('0x19')](_0x52660a)['send'](_0x19d82c);};}exports['index']=function(_0x3b25b4,_0x1ab42b){var _0x2f3069={},_0x15efa0={},_0x14f99e={'count':0x0,'rows':[]};var _0x59884e=_[_0x2afd('0x26')](db['FreshsalesField']['rawAttributes'],function(_0xb0177f){return{'name':_0xb0177f[_0x2afd('0x27')],'type':_0xb0177f['type'][_0x2afd('0x28')]};});_0x15efa0[_0x2afd('0x29')]=_['map'](_0x59884e,_0x2afd('0x25'));_0x15efa0[_0x2afd('0x2a')]=_[_0x2afd('0x2b')](_0x3b25b4[_0x2afd('0x2a')]);_0x15efa0['filters']=_[_0x2afd('0x2c')](_0x15efa0[_0x2afd('0x29')],_0x15efa0['query']);_0x2f3069[_0x2afd('0x2d')]=_[_0x2afd('0x2c')](_0x15efa0[_0x2afd('0x29')],qs[_0x2afd('0x2e')](_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x2e')]));_0x2f3069[_0x2afd('0x2d')]=_0x2f3069[_0x2afd('0x2d')][_0x2afd('0x2f')]?_0x2f3069[_0x2afd('0x2d')]:_0x15efa0['model'];if(!_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x30')](_0x2afd('0x31'))){_0x2f3069[_0x2afd('0x1c')]=qs[_0x2afd('0x1c')](_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x1c')]);_0x2f3069[_0x2afd('0x1b')]=qs[_0x2afd('0x1b')](_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x1b')]);}_0x2f3069[_0x2afd('0x32')]=qs[_0x2afd('0x33')](_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x33')]);_0x2f3069[_0x2afd('0x34')]=qs[_0x2afd('0x35')](_[_0x2afd('0x36')](_0x3b25b4['query'],_0x15efa0[_0x2afd('0x35')]),_0x59884e);if(_0x3b25b4['query'][_0x2afd('0x37')]){_0x2f3069[_0x2afd('0x34')]=_[_0x2afd('0x38')](_0x2f3069[_0x2afd('0x34')],{'$or':_[_0x2afd('0x26')](_0x59884e,function(_0x4e5d42){if(_0x4e5d42[_0x2afd('0x39')]!==_0x2afd('0x3a')){var _0x2ba0d7={};_0x2ba0d7[_0x4e5d42[_0x2afd('0x25')]]={'$like':'%'+_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x37')]+'%'};return _0x2ba0d7;}})});}_0x2f3069=_[_0x2afd('0x38')]({},_0x2f3069,_0x3b25b4[_0x2afd('0x3b')]);var _0x5a1cda={'where':_0x2f3069[_0x2afd('0x34')]};return db[_0x2afd('0x3c')]['count'](_0x5a1cda)[_0x2afd('0x23')](function(_0x433eef){_0x14f99e[_0x2afd('0x1e')]=_0x433eef;if(_0x3b25b4[_0x2afd('0x2a')][_0x2afd('0x3d')]){_0x2f3069[_0x2afd('0x3e')]=[{'all':!![]}];}return db[_0x2afd('0x3c')][_0x2afd('0x3f')](_0x2f3069);})[_0x2afd('0x23')](function(_0x2b17b4){_0x14f99e[_0x2afd('0x40')]=_0x2b17b4;return _0x14f99e;})[_0x2afd('0x23')](respondWithFilteredResult(_0x1ab42b,_0x2f3069))[_0x2afd('0x41')](handleError(_0x1ab42b,null));};exports[_0x2afd('0x42')]=function(_0x371ac7,_0x13744e){var _0x24fd23={'raw':!![],'where':{'id':_0x371ac7['params']['id']}},_0x1d57d8={};_0x1d57d8[_0x2afd('0x29')]=_[_0x2afd('0x2b')](db[_0x2afd('0x3c')][_0x2afd('0x43')]);_0x1d57d8[_0x2afd('0x2a')]=_['keys'](_0x371ac7['query']);_0x1d57d8[_0x2afd('0x35')]=_[_0x2afd('0x2c')](_0x1d57d8['model'],_0x1d57d8[_0x2afd('0x2a')]);_0x24fd23[_0x2afd('0x2d')]=_[_0x2afd('0x2c')](_0x1d57d8[_0x2afd('0x29')],qs['fields'](_0x371ac7[_0x2afd('0x2a')][_0x2afd('0x2e')]));_0x24fd23[_0x2afd('0x2d')]=_0x24fd23[_0x2afd('0x2d')][_0x2afd('0x2f')]?_0x24fd23[_0x2afd('0x2d')]:_0x1d57d8[_0x2afd('0x29')];if(_0x371ac7[_0x2afd('0x2a')][_0x2afd('0x3d')]){_0x24fd23[_0x2afd('0x3e')]=[{'all':!![]}];}_0x24fd23=_[_0x2afd('0x38')]({},_0x24fd23,_0x371ac7['options']);return db[_0x2afd('0x3c')][_0x2afd('0x44')](_0x24fd23)[_0x2afd('0x23')](handleEntityNotFound(_0x13744e,null))['then'](respondWithResult(_0x13744e,null))[_0x2afd('0x41')](handleError(_0x13744e,null));};exports[_0x2afd('0x45')]=function(_0x171743,_0x2f02fd){return db[_0x2afd('0x3c')]['create'](_0x171743[_0x2afd('0x46')],{})[_0x2afd('0x23')](respondWithResult(_0x2f02fd,0xc9))['catch'](handleError(_0x2f02fd,null));};exports['update']=function(_0x3ec04e,_0x4ac63a){if(_0x3ec04e['body']['id']){delete _0x3ec04e[_0x2afd('0x46')]['id'];}return db[_0x2afd('0x3c')][_0x2afd('0x44')]({'where':{'id':_0x3ec04e[_0x2afd('0x47')]['id']}})[_0x2afd('0x23')](handleEntityNotFound(_0x4ac63a,null))[_0x2afd('0x23')](saveUpdates(_0x3ec04e[_0x2afd('0x46')],null))['then'](respondWithResult(_0x4ac63a,null))[_0x2afd('0x41')](handleError(_0x4ac63a,null));};exports['destroy']=function(_0x3ccc12,_0x412ab7){return db[_0x2afd('0x3c')][_0x2afd('0x44')]({'where':{'id':_0x3ccc12[_0x2afd('0x47')]['id']}})[_0x2afd('0x23')](handleEntityNotFound(_0x412ab7,null))[_0x2afd('0x23')](removeEntity(_0x412ab7,null))['catch'](handleError(_0x412ab7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0827bcc..458aaf1 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 _0x585e=['lodash','util','../../config/logger','api','moment','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x1406c8,_0x40a801){var _0x3ec6f8=function(_0xc1183a){while(--_0xc1183a){_0x1406c8['push'](_0x1406c8['shift']());}};_0x3ec6f8(++_0x40a801);}(_0x585e,0x1c2));var _0xe585=function(_0x5405d6,_0x301f1a){_0x5405d6=_0x5405d6-0x0;var _0x4c6133=_0x585e[_0x5405d6];return _0x4c6133;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var logger=require(_0xe585('0x2'))(_0xe585('0x3'));var moment=require(_0xe585('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe585('0x5'));var rimraf=require(_0xe585('0x6'));var config=require('../../config/environment');var attributes=require(_0xe585('0x7'));module[_0xe585('0x8')]=function(_0x14dcd7,_0x2301bc){return _0x14dcd7[_0xe585('0x9')](_0xe585('0xa'),attributes,{'tableName':_0xe585('0xb'),'paranoid':![],'indexes':[{'name':_0xe585('0xc'),'fields':[_0xe585('0xd'),_0xe585('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf66=['bluebird','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xcf66,0x71));var _0x6cf6=function(_0xcfb98f,_0x3ee6c9){_0xcfb98f=_0xcfb98f-0x0;var _0x499664=_0xcf66[_0xcfb98f];return _0x499664;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[{'name':_0x6cf6('0xa'),'fields':[_0x6cf6('0xb'),_0x6cf6('0xc')],'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 a672c71..a16c2c6 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 _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x17b1b1,_0x338deb){var _0x2c1984=function(_0x18da80){while(--_0x18da80){_0x17b1b1['push'](_0x17b1b1['shift']());}};_0x2c1984(++_0x338deb);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file +var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x477748,_0x22c7a7){var _0x27d1ff=function(_0x47779f){while(--_0x47779f){_0x477748['push'](_0x477748['shift']());}};_0x27d1ff(++_0x22c7a7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x200cb2,_0x487640){_0x200cb2=_0x200cb2-0x0;var _0x19388c=_0xdbf5[_0x200cb2];return _0x19388c;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 71c7ed3..24d95e6 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4ddd67,_0x52a3eb){var _0x9c2e75=function(_0x15fa8e){while(--_0x15fa8e){_0x4ddd67['push'](_0x4ddd67['shift']());}};_0x9c2e75(++_0x52a3eb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x465952,_0x3d0b8f){var _0x7e19a9=function(_0xfdc447){while(--_0xfdc447){_0x465952['push'](_0x465952['shift']());}};_0x7e19a9(++_0x3d0b8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 0cb8132..de9dab9 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 _0x4d68=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d68,0x1c3));var _0x84d6=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x4d68[_0x4aa838];return _0x3abff0;};'use strict';var Sequelize=require(_0x84d6('0x0'));module[_0x84d6('0x1')]={'name':{'type':Sequelize[_0x84d6('0x2')]},'description':{'type':Sequelize[_0x84d6('0x2')]},'username':{'type':Sequelize[_0x84d6('0x2')],'unique':_0x84d6('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x84d6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x84d6('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x84d6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x84d6('0x4')](_0x84d6('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xff01=['STRING','username','integrationTab','sequelize','exports'];(function(_0x3429ed,_0x5f3938){var _0x2f76e8=function(_0x358238){while(--_0x358238){_0x3429ed['push'](_0x3429ed['shift']());}};_0x2f76e8(++_0x5f3938);}(_0xff01,0xb7));var _0x1ff0=function(_0x478b37,_0x2bfed6){_0x478b37=_0x478b37-0x0;var _0x27d789=_0xff01[_0x478b37];return _0x27d789;};'use strict';var Sequelize=require(_0x1ff0('0x0'));module[_0x1ff0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1ff0('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1ff0('0x3')},'remoteUri':{'type':Sequelize[_0x1ff0('0x2')]},'password':{'type':Sequelize[_0x1ff0('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1ff0('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1ff0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1ff0('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3fb667f..159ece9 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 _0xbc37=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','include','SalesforceAccount','findAll','rows','catch','show','params','length','options','create','body','find','getConfigurations','findOne','SalesforceConfiguration','pick','filter','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xbc37,0x161));var _0x7bc3=function(_0x20693a,_0x539731){_0x20693a=_0x20693a-0x0;var _0x3c2fe8=_0xbc37[_0x20693a];return _0x3c2fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7bc3('0x0'));var jsonpatch=require(_0x7bc3('0x1'));var rp=require(_0x7bc3('0x2'));var moment=require(_0x7bc3('0x3'));var BPromise=require(_0x7bc3('0x4'));var Mustache=require('mustache');var util=require(_0x7bc3('0x5'));var path=require(_0x7bc3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bc3('0x7'));var fs=require('fs');var fs_extra=require(_0x7bc3('0x8'));var _=require(_0x7bc3('0x9'));var squel=require('squel');var crypto=require(_0x7bc3('0xa'));var jsforce=require(_0x7bc3('0xb'));var deskjs=require(_0x7bc3('0xc'));var toCsv=require(_0x7bc3('0xd'));var querystring=require(_0x7bc3('0xe'));var Papa=require(_0x7bc3('0xf'));var Redis=require('ioredis');var authService=require(_0x7bc3('0x10'));var qs=require(_0x7bc3('0x11'));var as=require(_0x7bc3('0x12'));var hardwareService=require(_0x7bc3('0x13'));var logger=require(_0x7bc3('0x14'))(_0x7bc3('0x15'));var utils=require(_0x7bc3('0x16'));var config=require(_0x7bc3('0x17'));var licenseUtil=require(_0x7bc3('0x18'));var db=require(_0x7bc3('0x19'))['db'];var integrations=require(_0x7bc3('0x1a'));function respondWithStatusCode(_0x2a34b6,_0x5690a5){_0x5690a5=_0x5690a5||0xcc;return function(_0x27f459){if(_0x27f459){return _0x2a34b6[_0x7bc3('0x1b')](_0x5690a5);}return _0x2a34b6[_0x7bc3('0x1c')](_0x5690a5)[_0x7bc3('0x1d')]();};}function respondWithResult(_0x30c1bb,_0x5a1646){_0x5a1646=_0x5a1646||0xc8;return function(_0x7aa9c0){if(_0x7aa9c0){return _0x30c1bb[_0x7bc3('0x1c')](_0x5a1646)[_0x7bc3('0x1e')](_0x7aa9c0);}};}function respondWithFilteredResult(_0x50de8e,_0x152844){return function(_0xa4a6c2){if(_0xa4a6c2){var _0x4584b6=typeof _0x152844['offset']===_0x7bc3('0x1f')&&typeof _0x152844[_0x7bc3('0x20')]===_0x7bc3('0x1f');var _0x1b3509=_0xa4a6c2[_0x7bc3('0x21')];var _0x179a47=_0x4584b6?0x0:_0x152844['offset'];var _0x17244e=_0x4584b6?_0xa4a6c2[_0x7bc3('0x21')]:_0x152844[_0x7bc3('0x22')]+_0x152844[_0x7bc3('0x20')];var _0x4ad365;if(_0x17244e>=_0x1b3509){_0x17244e=_0x1b3509;_0x4ad365=0xc8;}else{_0x4ad365=0xce;}_0x50de8e['status'](_0x4ad365);return _0x50de8e[_0x7bc3('0x23')](_0x7bc3('0x24'),_0x179a47+'-'+_0x17244e+'/'+_0x1b3509)[_0x7bc3('0x1e')](_0xa4a6c2);}return null;};}function patchUpdates(_0x3c97f1){return function(_0x5085cc){try{jsonpatch[_0x7bc3('0x25')](_0x5085cc,_0x3c97f1,!![]);}catch(_0x9251b0){return BPromise[_0x7bc3('0x26')](_0x9251b0);}return _0x5085cc[_0x7bc3('0x27')]();};}function saveUpdates(_0x261655,_0x3f7025){return function(_0x132261){if(_0x132261){return _0x132261['update'](_0x261655)['then'](function(_0x4b4ede){return _0x4b4ede;});}return null;};}function removeEntity(_0x38eb4e,_0x5ec7f5){return function(_0x73bdd8){if(_0x73bdd8){return _0x73bdd8[_0x7bc3('0x28')]()[_0x7bc3('0x29')](function(){_0x38eb4e[_0x7bc3('0x1c')](0xcc)[_0x7bc3('0x1d')]();});}};}function handleEntityNotFound(_0x1490d1,_0x36c3ca){return function(_0x1b1b7c){if(!_0x1b1b7c){_0x1490d1[_0x7bc3('0x1b')](0x194);}return _0x1b1b7c;};}function handleError(_0x2787e4,_0x2af3ee){_0x2af3ee=_0x2af3ee||0x1f4;return function(_0x275bae){logger[_0x7bc3('0x2a')](_0x275bae['stack']);if(_0x275bae[_0x7bc3('0x2b')]){delete _0x275bae['name'];}_0x2787e4['status'](_0x2af3ee)['send'](_0x275bae);};}exports['index']=function(_0x6d135b,_0x1760fa){var _0x56edea={},_0x2dee5e={},_0x5d4ec3={'count':0x0,'rows':[]};var _0x50bf99=_[_0x7bc3('0x2c')](db['SalesforceAccount'][_0x7bc3('0x2d')],function(_0x206a4d){return{'name':_0x206a4d[_0x7bc3('0x2e')],'type':_0x206a4d[_0x7bc3('0x2f')]['key']};});_0x2dee5e[_0x7bc3('0x30')]=_['map'](_0x50bf99,_0x7bc3('0x2b'));_0x2dee5e[_0x7bc3('0x31')]=_[_0x7bc3('0x32')](_0x6d135b['query']);_0x2dee5e[_0x7bc3('0x33')]=_[_0x7bc3('0x34')](_0x2dee5e[_0x7bc3('0x30')],_0x2dee5e['query']);_0x56edea[_0x7bc3('0x35')]=_[_0x7bc3('0x34')](_0x2dee5e[_0x7bc3('0x30')],qs[_0x7bc3('0x36')](_0x6d135b[_0x7bc3('0x31')][_0x7bc3('0x36')]));_0x56edea[_0x7bc3('0x35')]=_0x56edea[_0x7bc3('0x35')]['length']?_0x56edea['attributes']:_0x2dee5e[_0x7bc3('0x30')];if(!_0x6d135b[_0x7bc3('0x31')][_0x7bc3('0x37')](_0x7bc3('0x38'))){_0x56edea['limit']=qs[_0x7bc3('0x20')](_0x6d135b[_0x7bc3('0x31')]['limit']);_0x56edea[_0x7bc3('0x22')]=qs[_0x7bc3('0x22')](_0x6d135b[_0x7bc3('0x31')][_0x7bc3('0x22')]);}_0x56edea[_0x7bc3('0x39')]=qs[_0x7bc3('0x3a')](_0x6d135b[_0x7bc3('0x31')][_0x7bc3('0x3a')]);_0x56edea['where']=qs['filters'](_['pick'](_0x6d135b[_0x7bc3('0x31')],_0x2dee5e['filters']),_0x50bf99);if(_0x6d135b[_0x7bc3('0x31')]['filter']){_0x56edea[_0x7bc3('0x3b')]=_[_0x7bc3('0x3c')](_0x56edea['where'],{'$or':_['map'](_0x50bf99,function(_0x1fd404){if(_0x1fd404[_0x7bc3('0x2f')]!=='VIRTUAL'){var _0x31cf4f={};_0x31cf4f[_0x1fd404[_0x7bc3('0x2b')]]={'$like':'%'+_0x6d135b[_0x7bc3('0x31')]['filter']+'%'};return _0x31cf4f;}})});}_0x56edea=_['merge']({},_0x56edea,_0x6d135b['options']);var _0x2fcd1e={'where':_0x56edea[_0x7bc3('0x3b')]};return db['SalesforceAccount']['count'](_0x2fcd1e)['then'](function(_0x3c7154){_0x5d4ec3[_0x7bc3('0x21')]=_0x3c7154;if(_0x6d135b[_0x7bc3('0x31')][_0x7bc3('0x3d')]){_0x56edea[_0x7bc3('0x3e')]=[{'all':!![]}];}return db[_0x7bc3('0x3f')][_0x7bc3('0x40')](_0x56edea);})[_0x7bc3('0x29')](function(_0x5cfea4){_0x5d4ec3[_0x7bc3('0x41')]=_0x5cfea4;return _0x5d4ec3;})[_0x7bc3('0x29')](respondWithFilteredResult(_0x1760fa,_0x56edea))[_0x7bc3('0x42')](handleError(_0x1760fa,null));};exports[_0x7bc3('0x43')]=function(_0x10d25c,_0x1e82b1){var _0x248130={'raw':![],'where':{'id':_0x10d25c[_0x7bc3('0x44')]['id']}},_0x48cdeb={};_0x48cdeb[_0x7bc3('0x30')]=_[_0x7bc3('0x32')](db[_0x7bc3('0x3f')][_0x7bc3('0x2d')]);_0x48cdeb[_0x7bc3('0x31')]=_[_0x7bc3('0x32')](_0x10d25c[_0x7bc3('0x31')]);_0x48cdeb[_0x7bc3('0x33')]=_['intersection'](_0x48cdeb['model'],_0x48cdeb['query']);_0x248130[_0x7bc3('0x35')]=_[_0x7bc3('0x34')](_0x48cdeb[_0x7bc3('0x30')],qs[_0x7bc3('0x36')](_0x10d25c['query'][_0x7bc3('0x36')]));_0x248130[_0x7bc3('0x35')]=_0x248130['attributes'][_0x7bc3('0x45')]?_0x248130[_0x7bc3('0x35')]:_0x48cdeb[_0x7bc3('0x30')];if(_0x10d25c[_0x7bc3('0x31')][_0x7bc3('0x3d')]){_0x248130[_0x7bc3('0x3e')]=[{'all':!![]}];}_0x248130=_[_0x7bc3('0x3c')]({},_0x248130,_0x10d25c[_0x7bc3('0x46')]);return db[_0x7bc3('0x3f')]['find'](_0x248130)[_0x7bc3('0x29')](handleEntityNotFound(_0x1e82b1,null))[_0x7bc3('0x29')](respondWithResult(_0x1e82b1,null))[_0x7bc3('0x42')](handleError(_0x1e82b1,null));};exports[_0x7bc3('0x47')]=function(_0x9854e0,_0x1eeddd){return db[_0x7bc3('0x3f')][_0x7bc3('0x47')](_0x9854e0['body'],{})[_0x7bc3('0x29')](respondWithResult(_0x1eeddd,0xc9))[_0x7bc3('0x42')](handleError(_0x1eeddd,null));};exports['update']=function(_0x2185cd,_0x3e5809){if(_0x2185cd['body']['id']){delete _0x2185cd[_0x7bc3('0x48')]['id'];}return db[_0x7bc3('0x3f')][_0x7bc3('0x49')]({'where':{'id':_0x2185cd[_0x7bc3('0x44')]['id']}})[_0x7bc3('0x29')](handleEntityNotFound(_0x3e5809,null))[_0x7bc3('0x29')](saveUpdates(_0x2185cd[_0x7bc3('0x48')],null))[_0x7bc3('0x29')](respondWithResult(_0x3e5809,null))[_0x7bc3('0x42')](handleError(_0x3e5809,null));};exports[_0x7bc3('0x28')]=function(_0x52b01f,_0x557d56){return db[_0x7bc3('0x3f')][_0x7bc3('0x49')]({'where':{'id':_0x52b01f[_0x7bc3('0x44')]['id']}})[_0x7bc3('0x29')](handleEntityNotFound(_0x557d56,null))[_0x7bc3('0x29')](removeEntity(_0x557d56,null))[_0x7bc3('0x42')](handleError(_0x557d56,null));};exports[_0x7bc3('0x4a')]=function(_0x59778a,_0x204228,_0x2922d8){var _0xa6f2b1={};var _0x3b62c7={};var _0x9eb835;var _0x377517;return db['SalesforceAccount'][_0x7bc3('0x4b')]({'where':{'id':_0x59778a['params']['id']}})[_0x7bc3('0x29')](handleEntityNotFound(_0x204228,null))[_0x7bc3('0x29')](function(_0x31a3ba){if(_0x31a3ba){_0x9eb835=_0x31a3ba;_0x3b62c7[_0x7bc3('0x30')]=_['keys'](db[_0x7bc3('0x4c')][_0x7bc3('0x2d')]);_0x3b62c7[_0x7bc3('0x31')]=_[_0x7bc3('0x32')](_0x59778a[_0x7bc3('0x31')]);_0x3b62c7[_0x7bc3('0x33')]=_[_0x7bc3('0x34')](_0x3b62c7[_0x7bc3('0x30')],_0x3b62c7['query']);_0xa6f2b1[_0x7bc3('0x35')]=_['intersection'](_0x3b62c7['model'],qs[_0x7bc3('0x36')](_0x59778a['query']['fields']));_0xa6f2b1[_0x7bc3('0x35')]=_0xa6f2b1['attributes'][_0x7bc3('0x45')]?_0xa6f2b1[_0x7bc3('0x35')]:_0x3b62c7[_0x7bc3('0x30')];_0xa6f2b1[_0x7bc3('0x39')]=qs[_0x7bc3('0x3a')](_0x59778a[_0x7bc3('0x31')][_0x7bc3('0x3a')]);_0xa6f2b1[_0x7bc3('0x3b')]=qs[_0x7bc3('0x33')](_[_0x7bc3('0x4d')](_0x59778a['query'],_0x3b62c7[_0x7bc3('0x33')]));if(_0x59778a[_0x7bc3('0x31')][_0x7bc3('0x4e')]){_0xa6f2b1['where']=_[_0x7bc3('0x3c')](_0xa6f2b1[_0x7bc3('0x3b')],{'$or':_[_0x7bc3('0x2c')](_0xa6f2b1[_0x7bc3('0x35')],function(_0x3fcb42){var _0x58ff45={};_0x58ff45[_0x3fcb42]={'$like':'%'+_0x59778a[_0x7bc3('0x31')]['filter']+'%'};return _0x58ff45;})});}_0xa6f2b1=_[_0x7bc3('0x3c')]({},_0xa6f2b1,_0x59778a[_0x7bc3('0x46')]);return _0x9eb835[_0x7bc3('0x4a')](_0xa6f2b1);}})[_0x7bc3('0x29')](function(_0x29e6b9){if(_0x29e6b9){_0x377517=_0x29e6b9['length'];if(!_0x59778a[_0x7bc3('0x31')]['hasOwnProperty'](_0x7bc3('0x38'))){_0xa6f2b1[_0x7bc3('0x20')]=qs[_0x7bc3('0x20')](_0x59778a['query'][_0x7bc3('0x20')]);_0xa6f2b1['offset']=qs['offset'](_0x59778a[_0x7bc3('0x31')]['offset']);}return _0x9eb835[_0x7bc3('0x4a')](_0xa6f2b1);}})[_0x7bc3('0x29')](function(_0x9f0f11){if(_0x9f0f11){return _0x9f0f11?{'count':_0x377517,'rows':_0x9f0f11}:null;}})['then'](respondWithResult(_0x204228,null))[_0x7bc3('0x42')](handleError(_0x204228,null));};exports[_0x7bc3('0x4f')]=function(_0x4022fe,_0x3cd7a7,_0x45e68c){if(_0x4022fe[_0x7bc3('0x48')]['id']){delete _0x4022fe[_0x7bc3('0x48')]['id'];}return db[_0x7bc3('0x3f')]['findOne']({'where':{'id':_0x4022fe['params']['id']}})['then'](handleEntityNotFound(_0x3cd7a7,null))[_0x7bc3('0x29')](function(_0x4d16cf){if(_0x4d16cf){_0x4022fe[_0x7bc3('0x48')]['AccountId']=_0x4d16cf['id'];_0x4022fe[_0x7bc3('0x48')]['Subjects']=integrations[_0x7bc3('0x50')](_0x4022fe[_0x7bc3('0x48')][_0x7bc3('0x51')],_0x4022fe[_0x7bc3('0x48')][_0x7bc3('0x2f')]);_0x4022fe[_0x7bc3('0x48')][_0x7bc3('0x52')]=integrations[_0x7bc3('0x53')](_0x4022fe['body'][_0x7bc3('0x51')],_0x4022fe[_0x7bc3('0x48')]['type']);return db[_0x7bc3('0x4c')][_0x7bc3('0x47')](_0x4022fe[_0x7bc3('0x48')],{'include':[{'model':db[_0x7bc3('0x54')],'as':_0x7bc3('0x55')},{'model':db[_0x7bc3('0x54')],'as':_0x7bc3('0x52')}]});}return null;})['then'](respondWithResult(_0x3cd7a7,null))[_0x7bc3('0x42')](handleError(_0x3cd7a7,null));};exports[_0x7bc3('0x56')]=function(_0x52b400,_0x4a1791,_0x56213c){var _0x14ae45;var _0x3f85da='';var _0x1166fc='Task';return db[_0x7bc3('0x3f')][_0x7bc3('0x4b')]({'where':{'id':_0x52b400[_0x7bc3('0x44')]['id']},'attributes':['id',_0x7bc3('0x57'),_0x7bc3('0x58'),_0x7bc3('0x59'),_0x7bc3('0x5a'),_0x7bc3('0x5b'),_0x7bc3('0x5c')]})[_0x7bc3('0x29')](handleEntityNotFound(_0x4a1791,null))['then'](function(_0x5e312d){if(_0x5e312d){_0x3f85da=_0x5e312d[_0x7bc3('0x57')];var _0x4cca7f=_0x3f85da[_0x7bc3('0x5d')](-0x1);if(_0x4cca7f==='/'){_0x3f85da=_0x3f85da[_0x7bc3('0x5e')](0x0,_0x3f85da['lastIndexOf'](_0x4cca7f));}_0x14ae45=new jsforce[(_0x7bc3('0x5f'))]({'oauth2':{'loginUrl':_0x3f85da,'clientId':_0x5e312d[_0x7bc3('0x58')],'clientSecret':_0x5e312d[_0x7bc3('0x59')]}});return _0x14ae45[_0x7bc3('0x60')](_0x5e312d['username'],_0x5e312d[_0x7bc3('0x5b')][_0x7bc3('0x61')](_0x5e312d[_0x7bc3('0x5c')]));}})[_0x7bc3('0x29')](function(_0x317a25){if(_0x317a25){if(!_[_0x7bc3('0x62')](_0x52b400['query'][_0x7bc3('0x63')])){_0x1166fc=_0x52b400[_0x7bc3('0x31')]['ticketType'];}return _0x14ae45[_0x7bc3('0x64')](_0x1166fc)[_0x7bc3('0x65')]();}})[_0x7bc3('0x29')](function(_0x49fc48){var _0x49197c=[_0x7bc3('0x66'),'ActivityDate','IsReminderSet',_0x7bc3('0x67'),_0x7bc3('0x68'),'Description'];var _0x1b7b2e=['string',_0x7bc3('0x69'),_0x7bc3('0x6a'),_0x7bc3('0x6b'),_0x7bc3('0x6c'),_0x7bc3('0x6d'),_0x7bc3('0x6e')];if(_0x49fc48){_[_0x7bc3('0x6f')](_0x49fc48[_0x7bc3('0x36')],function(_0x5a520a){return _0x49197c['includes'](_0x5a520a[_0x7bc3('0x2b')])||!_0x1b7b2e[_0x7bc3('0x70')](_0x5a520a[_0x7bc3('0x2f')]);});return{'count':_0x49fc48[_0x7bc3('0x36')][_0x7bc3('0x45')],'rows':_[_0x7bc3('0x2c')](_0x49fc48[_0x7bc3('0x36')],function(_0x1b3497){return{'id':_0x1b3497['name'],'name':_0x1b3497[_0x7bc3('0x71')],'custom':_0x1b3497[_0x7bc3('0x72')],'options':_0x1b3497['picklistValues'][_0x7bc3('0x45')]>0x0?_['map'](_0x1b3497[_0x7bc3('0x73')],function(_0x39bb3c){return{'name':_0x39bb3c[_0x7bc3('0x71')],'value':_0x39bb3c[_0x7bc3('0x74')]};}):_0x1b3497[_0x7bc3('0x2f')]=='boolean'?[{'name':_0x7bc3('0x75'),'value':_0x7bc3('0x76')},{'name':_0x7bc3('0x77'),'value':_0x7bc3('0x78')}]:[]};})};}})[_0x7bc3('0x29')](respondWithResult(_0x4a1791,null))[_0x7bc3('0x42')](function(_0x1300dc){var _0x57a51d=_0x52b400[_0x7bc3('0x31')][_0x7bc3('0x79')]?0x1f4:_0x1300dc[_0x7bc3('0x7a')]||0x1f4;logger[_0x7bc3('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x7bc3('0x56'),_0x57a51d,JSON[_0x7bc3('0x7b')](_0x1300dc));delete _0x1300dc[_0x7bc3('0x2b')];if(_0x57a51d===0x191){_0x57a51d=0x190;}_0x4a1791['status'](_0x57a51d)[_0x7bc3('0x7c')](_0x52b400[_0x7bc3('0x31')][_0x7bc3('0x79')]?{'message':_0x7bc3('0x7d'),'statusCode':_0x1300dc[_0x7bc3('0x7a')]}:_0x1300dc);});}; \ No newline at end of file +var _0xe0a3=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','params','find','catch','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','merge','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceField','getFields','remoteUri','clientId','password','slice','substring','lastIndexOf','Connection','username','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','update','then','name','send','SalesforceAccount','rawAttributes','type','map','query','keys','filters','intersection','model'];(function(_0x163099,_0x266055){var _0x2b9661=function(_0xa4a3e4){while(--_0xa4a3e4){_0x163099['push'](_0x163099['shift']());}};_0x2b9661(++_0x266055);}(_0xe0a3,0xba));var _0x3e0a=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0xe0a3[_0x21353c];return _0xa99120;};'use strict';var emlformat=require(_0x3e0a('0x0'));var rimraf=require(_0x3e0a('0x1'));var zipdir=require(_0x3e0a('0x2'));var jsonpatch=require(_0x3e0a('0x3'));var rp=require(_0x3e0a('0x4'));var moment=require(_0x3e0a('0x5'));var BPromise=require(_0x3e0a('0x6'));var Mustache=require(_0x3e0a('0x7'));var util=require('util');var path=require(_0x3e0a('0x8'));var sox=require(_0x3e0a('0x9'));var csv=require(_0x3e0a('0xa'));var ejs=require(_0x3e0a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e0a('0xc'));var squel=require(_0x3e0a('0xd'));var crypto=require(_0x3e0a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3e0a('0xf'));var toCsv=require(_0x3e0a('0xa'));var querystring=require(_0x3e0a('0x10'));var Papa=require(_0x3e0a('0x11'));var Redis=require(_0x3e0a('0x12'));var authService=require(_0x3e0a('0x13'));var qs=require(_0x3e0a('0x14'));var as=require(_0x3e0a('0x15'));var hardwareService=require(_0x3e0a('0x16'));var logger=require(_0x3e0a('0x17'))(_0x3e0a('0x18'));var utils=require(_0x3e0a('0x19'));var config=require(_0x3e0a('0x1a'));var licenseUtil=require(_0x3e0a('0x1b'));var db=require(_0x3e0a('0x1c'))['db'];var integrations=require(_0x3e0a('0x1d'));function respondWithStatusCode(_0x11aa1c,_0x4fc4b9){_0x4fc4b9=_0x4fc4b9||0xcc;return function(_0x12acc8){if(_0x12acc8){return _0x11aa1c[_0x3e0a('0x1e')](_0x4fc4b9);}return _0x11aa1c['status'](_0x4fc4b9)[_0x3e0a('0x1f')]();};}function respondWithResult(_0x490c3e,_0x10e7af){_0x10e7af=_0x10e7af||0xc8;return function(_0x49b509){if(_0x49b509){return _0x490c3e[_0x3e0a('0x20')](_0x10e7af)['json'](_0x49b509);}};}function respondWithFilteredResult(_0x5555b5,_0x259e26){return function(_0x2eaeec){if(_0x2eaeec){var _0x45f950=typeof _0x259e26[_0x3e0a('0x21')]===_0x3e0a('0x22')&&typeof _0x259e26['limit']==='undefined';var _0x5168f2=_0x2eaeec[_0x3e0a('0x23')];var _0x20d313=_0x45f950?0x0:_0x259e26['offset'];var _0x5d1e83=_0x45f950?_0x2eaeec[_0x3e0a('0x23')]:_0x259e26[_0x3e0a('0x21')]+_0x259e26[_0x3e0a('0x24')];var _0x37b6c8;if(_0x5d1e83>=_0x5168f2){_0x5d1e83=_0x5168f2;_0x37b6c8=0xc8;}else{_0x37b6c8=0xce;}_0x5555b5[_0x3e0a('0x20')](_0x37b6c8);return _0x5555b5[_0x3e0a('0x25')]('Content-Range',_0x20d313+'-'+_0x5d1e83+'/'+_0x5168f2)[_0x3e0a('0x26')](_0x2eaeec);}return null;};}function patchUpdates(_0x111add){return function(_0x3d54c4){try{jsonpatch[_0x3e0a('0x27')](_0x3d54c4,_0x111add,!![]);}catch(_0x5b08e0){return BPromise[_0x3e0a('0x28')](_0x5b08e0);}return _0x3d54c4['save']();};}function saveUpdates(_0x3cee8a,_0xd3ce32){return function(_0x3d0e65){if(_0x3d0e65){return _0x3d0e65[_0x3e0a('0x29')](_0x3cee8a)[_0x3e0a('0x2a')](function(_0x429dd2){return _0x429dd2;});}return null;};}function removeEntity(_0x25b342,_0x30a4e6){return function(_0x5c5038){if(_0x5c5038){return _0x5c5038['destroy']()['then'](function(){_0x25b342[_0x3e0a('0x20')](0xcc)[_0x3e0a('0x1f')]();});}};}function handleEntityNotFound(_0x544fa3,_0x53a566){return function(_0x4e6352){if(!_0x4e6352){_0x544fa3['sendStatus'](0x194);}return _0x4e6352;};}function handleError(_0x258587,_0x38b4d7){_0x38b4d7=_0x38b4d7||0x1f4;return function(_0x2db7d5){logger['error'](_0x2db7d5['stack']);if(_0x2db7d5['name']){delete _0x2db7d5[_0x3e0a('0x2b')];}_0x258587[_0x3e0a('0x20')](_0x38b4d7)[_0x3e0a('0x2c')](_0x2db7d5);};}exports['index']=function(_0x59a468,_0x18b858){var _0x1b7bff={},_0x334a67={},_0x535534={'count':0x0,'rows':[]};var _0x488a61=_['map'](db[_0x3e0a('0x2d')][_0x3e0a('0x2e')],function(_0x393951){return{'name':_0x393951['fieldName'],'type':_0x393951[_0x3e0a('0x2f')]['key']};});_0x334a67['model']=_[_0x3e0a('0x30')](_0x488a61,_0x3e0a('0x2b'));_0x334a67[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x59a468[_0x3e0a('0x31')]);_0x334a67[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0x334a67[_0x3e0a('0x35')],_0x334a67[_0x3e0a('0x31')]);_0x1b7bff[_0x3e0a('0x36')]=_[_0x3e0a('0x34')](_0x334a67[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x1b7bff['attributes']=_0x1b7bff[_0x3e0a('0x36')][_0x3e0a('0x38')]?_0x1b7bff[_0x3e0a('0x36')]:_0x334a67[_0x3e0a('0x35')];if(!_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x39')](_0x3e0a('0x3a'))){_0x1b7bff[_0x3e0a('0x24')]=qs[_0x3e0a('0x24')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x24')]);_0x1b7bff[_0x3e0a('0x21')]=qs[_0x3e0a('0x21')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x21')]);}_0x1b7bff[_0x3e0a('0x3b')]=qs['sort'](_0x59a468['query'][_0x3e0a('0x3c')]);_0x1b7bff[_0x3e0a('0x3d')]=qs[_0x3e0a('0x33')](_[_0x3e0a('0x3e')](_0x59a468['query'],_0x334a67[_0x3e0a('0x33')]),_0x488a61);if(_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x3f')]){_0x1b7bff[_0x3e0a('0x3d')]=_['merge'](_0x1b7bff[_0x3e0a('0x3d')],{'$or':_['map'](_0x488a61,function(_0x110cd8){if(_0x110cd8[_0x3e0a('0x2f')]!==_0x3e0a('0x40')){var _0x45c776={};_0x45c776[_0x110cd8[_0x3e0a('0x2b')]]={'$like':'%'+_0x59a468[_0x3e0a('0x31')]['filter']+'%'};return _0x45c776;}})});}_0x1b7bff=_['merge']({},_0x1b7bff,_0x59a468[_0x3e0a('0x41')]);var _0x54754f={'where':_0x1b7bff[_0x3e0a('0x3d')]};return db[_0x3e0a('0x2d')][_0x3e0a('0x23')](_0x54754f)[_0x3e0a('0x2a')](function(_0x2e669e){_0x535534[_0x3e0a('0x23')]=_0x2e669e;if(_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x42')]){_0x1b7bff[_0x3e0a('0x43')]=[{'all':!![]}];}return db[_0x3e0a('0x2d')]['findAll'](_0x1b7bff);})['then'](function(_0xcd9d69){_0x535534['rows']=_0xcd9d69;return _0x535534;})[_0x3e0a('0x2a')](respondWithFilteredResult(_0x18b858,_0x1b7bff))['catch'](handleError(_0x18b858,null));};exports['show']=function(_0x21ed7e,_0x12db0e){var _0x5cd60f={'raw':![],'where':{'id':_0x21ed7e[_0x3e0a('0x44')]['id']}},_0xc33302={};_0xc33302[_0x3e0a('0x35')]=_[_0x3e0a('0x32')](db[_0x3e0a('0x2d')]['rawAttributes']);_0xc33302[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x21ed7e['query']);_0xc33302[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0xc33302['model'],_0xc33302[_0x3e0a('0x31')]);_0x5cd60f[_0x3e0a('0x36')]=_['intersection'](_0xc33302[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x21ed7e[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x5cd60f['attributes']=_0x5cd60f[_0x3e0a('0x36')][_0x3e0a('0x38')]?_0x5cd60f[_0x3e0a('0x36')]:_0xc33302[_0x3e0a('0x35')];if(_0x21ed7e[_0x3e0a('0x31')]['includeAll']){_0x5cd60f['include']=[{'all':!![]}];}_0x5cd60f=_['merge']({},_0x5cd60f,_0x21ed7e[_0x3e0a('0x41')]);return db[_0x3e0a('0x2d')][_0x3e0a('0x45')](_0x5cd60f)['then'](handleEntityNotFound(_0x12db0e,null))['then'](respondWithResult(_0x12db0e,null))[_0x3e0a('0x46')](handleError(_0x12db0e,null));};exports[_0x3e0a('0x47')]=function(_0x3516ff,_0x33e5cb){return db[_0x3e0a('0x2d')][_0x3e0a('0x47')](_0x3516ff[_0x3e0a('0x48')],{})[_0x3e0a('0x2a')](respondWithResult(_0x33e5cb,0xc9))[_0x3e0a('0x46')](handleError(_0x33e5cb,null));};exports['update']=function(_0x4bc24,_0x3ab14d){if(_0x4bc24['body']['id']){delete _0x4bc24['body']['id'];}return db[_0x3e0a('0x2d')][_0x3e0a('0x45')]({'where':{'id':_0x4bc24[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x3ab14d,null))[_0x3e0a('0x2a')](saveUpdates(_0x4bc24['body'],null))['then'](respondWithResult(_0x3ab14d,null))[_0x3e0a('0x46')](handleError(_0x3ab14d,null));};exports[_0x3e0a('0x49')]=function(_0x5106f0,_0x369680){return db[_0x3e0a('0x2d')]['find']({'where':{'id':_0x5106f0[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x369680,null))[_0x3e0a('0x2a')](removeEntity(_0x369680,null))['catch'](handleError(_0x369680,null));};exports[_0x3e0a('0x4a')]=function(_0x52d0b6,_0x5588e6,_0x4e00ec){var _0x16c187={};var _0x3e1e8f={};var _0x28ba6a;var _0x3fb30e;return db[_0x3e0a('0x2d')][_0x3e0a('0x4b')]({'where':{'id':_0x52d0b6[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x5588e6,null))[_0x3e0a('0x2a')](function(_0x81223a){if(_0x81223a){_0x28ba6a=_0x81223a;_0x3e1e8f[_0x3e0a('0x35')]=_[_0x3e0a('0x32')](db[_0x3e0a('0x4c')][_0x3e0a('0x2e')]);_0x3e1e8f[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x52d0b6['query']);_0x3e1e8f[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0x3e1e8f[_0x3e0a('0x35')],_0x3e1e8f['query']);_0x16c187['attributes']=_['intersection'](_0x3e1e8f[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x16c187[_0x3e0a('0x36')]=_0x16c187['attributes'][_0x3e0a('0x38')]?_0x16c187[_0x3e0a('0x36')]:_0x3e1e8f['model'];_0x16c187[_0x3e0a('0x3b')]=qs[_0x3e0a('0x3c')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x3c')]);_0x16c187['where']=qs[_0x3e0a('0x33')](_[_0x3e0a('0x3e')](_0x52d0b6[_0x3e0a('0x31')],_0x3e1e8f[_0x3e0a('0x33')]));if(_0x52d0b6['query'][_0x3e0a('0x3f')]){_0x16c187[_0x3e0a('0x3d')]=_[_0x3e0a('0x4d')](_0x16c187['where'],{'$or':_[_0x3e0a('0x30')](_0x16c187[_0x3e0a('0x36')],function(_0x244b04){var _0x57d7eb={};_0x57d7eb[_0x244b04]={'$like':'%'+_0x52d0b6['query']['filter']+'%'};return _0x57d7eb;})});}_0x16c187=_[_0x3e0a('0x4d')]({},_0x16c187,_0x52d0b6[_0x3e0a('0x41')]);return _0x28ba6a[_0x3e0a('0x4a')](_0x16c187);}})['then'](function(_0x1a48a5){if(_0x1a48a5){_0x3fb30e=_0x1a48a5[_0x3e0a('0x38')];if(!_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x39')]('nolimit')){_0x16c187[_0x3e0a('0x24')]=qs['limit'](_0x52d0b6['query'][_0x3e0a('0x24')]);_0x16c187[_0x3e0a('0x21')]=qs[_0x3e0a('0x21')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x21')]);}return _0x28ba6a[_0x3e0a('0x4a')](_0x16c187);}})[_0x3e0a('0x2a')](function(_0x35492a){if(_0x35492a){return _0x35492a?{'count':_0x3fb30e,'rows':_0x35492a}:null;}})[_0x3e0a('0x2a')](respondWithResult(_0x5588e6,null))['catch'](handleError(_0x5588e6,null));};exports[_0x3e0a('0x4e')]=function(_0x2259fb,_0x3c85b4,_0x561823){if(_0x2259fb[_0x3e0a('0x48')]['id']){delete _0x2259fb[_0x3e0a('0x48')]['id'];}return db[_0x3e0a('0x2d')]['findOne']({'where':{'id':_0x2259fb['params']['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x3c85b4,null))[_0x3e0a('0x2a')](function(_0x3dcc22){if(_0x3dcc22){_0x2259fb[_0x3e0a('0x48')]['AccountId']=_0x3dcc22['id'];_0x2259fb[_0x3e0a('0x48')][_0x3e0a('0x4f')]=integrations[_0x3e0a('0x50')](_0x2259fb['body'][_0x3e0a('0x51')],_0x2259fb[_0x3e0a('0x48')]['type']);_0x2259fb[_0x3e0a('0x48')]['Descriptions']=integrations[_0x3e0a('0x52')](_0x2259fb[_0x3e0a('0x48')][_0x3e0a('0x51')],_0x2259fb['body']['type']);return db[_0x3e0a('0x4c')][_0x3e0a('0x47')](_0x2259fb['body'],{'include':[{'model':db[_0x3e0a('0x53')],'as':'Subjects'},{'model':db[_0x3e0a('0x53')],'as':'Descriptions'}]});}return null;})[_0x3e0a('0x2a')](respondWithResult(_0x3c85b4,null))['catch'](handleError(_0x3c85b4,null));};exports[_0x3e0a('0x54')]=function(_0x4c26c8,_0x270c44,_0x24632d){var _0x1e54c2;var _0x40f030='';var _0x49d1f2='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x4c26c8[_0x3e0a('0x44')]['id']},'attributes':['id',_0x3e0a('0x55'),_0x3e0a('0x56'),'clientSecret','username',_0x3e0a('0x57'),'securityToken']})['then'](handleEntityNotFound(_0x270c44,null))[_0x3e0a('0x2a')](function(_0x562ab8){if(_0x562ab8){_0x40f030=_0x562ab8[_0x3e0a('0x55')];var _0x442127=_0x40f030[_0x3e0a('0x58')](-0x1);if(_0x442127==='/'){_0x40f030=_0x40f030[_0x3e0a('0x59')](0x0,_0x40f030[_0x3e0a('0x5a')](_0x442127));}_0x1e54c2=new jsforce[(_0x3e0a('0x5b'))]({'oauth2':{'loginUrl':_0x40f030,'clientId':_0x562ab8['clientId'],'clientSecret':_0x562ab8['clientSecret']}});return _0x1e54c2['login'](_0x562ab8[_0x3e0a('0x5c')],_0x562ab8[_0x3e0a('0x57')]['concat'](_0x562ab8[_0x3e0a('0x5d')]));}})[_0x3e0a('0x2a')](function(_0x44632a){if(_0x44632a){if(!_[_0x3e0a('0x5e')](_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x5f')])){_0x49d1f2=_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x5f')];}return _0x1e54c2[_0x3e0a('0x60')](_0x49d1f2)['describe']();}})[_0x3e0a('0x2a')](function(_0x2e8b84){var _0x525261=[_0x3e0a('0x61'),_0x3e0a('0x62'),_0x3e0a('0x63'),_0x3e0a('0x64'),_0x3e0a('0x65'),'Description'];var _0x1aad3c=[_0x3e0a('0x66'),_0x3e0a('0x67'),_0x3e0a('0x68'),_0x3e0a('0x69'),_0x3e0a('0x6a'),'textarea',_0x3e0a('0x6b')];if(_0x2e8b84){_[_0x3e0a('0x6c')](_0x2e8b84[_0x3e0a('0x37')],function(_0x102ece){return _0x525261[_0x3e0a('0x6d')](_0x102ece[_0x3e0a('0x2b')])||!_0x1aad3c[_0x3e0a('0x6d')](_0x102ece['type']);});return{'count':_0x2e8b84[_0x3e0a('0x37')]['length'],'rows':_[_0x3e0a('0x30')](_0x2e8b84['fields'],function(_0xf26f8c){return{'id':_0xf26f8c[_0x3e0a('0x2b')],'name':_0xf26f8c[_0x3e0a('0x6e')],'custom':_0xf26f8c['custom'],'options':_0xf26f8c[_0x3e0a('0x6f')][_0x3e0a('0x38')]>0x0?_[_0x3e0a('0x30')](_0xf26f8c[_0x3e0a('0x6f')],function(_0x541e1c){return{'name':_0x541e1c['label'],'value':_0x541e1c[_0x3e0a('0x70')]};}):_0xf26f8c[_0x3e0a('0x2f')]==_0x3e0a('0x69')?[{'name':_0x3e0a('0x71'),'value':_0x3e0a('0x72')},{'name':_0x3e0a('0x73'),'value':'false'}]:[]};})};}})[_0x3e0a('0x2a')](respondWithResult(_0x270c44,null))[_0x3e0a('0x46')](function(_0x4d3178){var _0x4c1857=_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x74')]?0x1f4:_0x4d3178[_0x3e0a('0x75')]||0x1f4;logger['error'](_0x3e0a('0x76'),_0x3e0a('0x54'),_0x4c1857,JSON[_0x3e0a('0x77')](_0x4d3178));delete _0x4d3178[_0x3e0a('0x2b')];if(_0x4c1857===0x191){_0x4c1857=0x190;}_0x270c44[_0x3e0a('0x20')](_0x4c1857)[_0x3e0a('0x2c')](_0x4c26c8[_0x3e0a('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4d3178['statusCode']}:_0x4d3178);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1612087..e12e596 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 _0xe562=['bluebird','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe562,0x6b));var _0x2e56=function(_0x41f270,_0x4b164c){_0x41f270=_0x41f270-0x0;var _0x53ef26=_0xe562[_0x41f270];return _0x53ef26;};'use strict';var _=require(_0x2e56('0x0'));var util=require('util');var logger=require(_0x2e56('0x1'))(_0x2e56('0x2'));var moment=require('moment');var BPromise=require(_0x2e56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e56('0x4'));var rimraf=require(_0x2e56('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e56('0x6'));var integrations=require(_0x2e56('0x7'));module[_0x2e56('0x8')]=function(_0x5aa09c,_0x24f359){return _0x5aa09c[_0x2e56('0x9')]('SalesforceAccount',attributes,{'tableName':_0x2e56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd200=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x120ec8,_0x525578){var _0x1202f4=function(_0x189e52){while(--_0x189e52){_0x120ec8['push'](_0x120ec8['shift']());}};_0x1202f4(++_0x525578);}(_0xd200,0x1d4));var _0x0d20=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xd200[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0x0d20('0x0'));var logger=require(_0x0d20('0x1'))(_0x0d20('0x2'));var moment=require(_0x0d20('0x3'));var BPromise=require(_0x0d20('0x4'));var rp=require(_0x0d20('0x5'));var fs=require('fs');var path=require(_0x0d20('0x6'));var rimraf=require(_0x0d20('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d20('0x8'));var integrations=require(_0x0d20('0x9'));module['exports']=function(_0x3908e5,_0x5417d2){return _0x3908e5[_0x0d20('0xa')](_0x0d20('0xb'),attributes,{'tableName':_0x0d20('0xc'),'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 aee5347..693b3d1 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 _0x0e18=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f4bef,_0x359a87){var _0x1989b7=function(_0xe0ffca){while(--_0xe0ffca){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0x1989b7(++_0x359a87);}(_0x0e18,0x158));var _0x80e1=function(_0x26208d,_0x2fc1cf){_0x26208d=_0x26208d-0x0;var _0x40a09f=_0x0e18[_0x26208d];return _0x40a09f;};'use strict';var _=require(_0x80e1('0x0'));var util=require('util');var moment=require(_0x80e1('0x1'));var BPromise=require(_0x80e1('0x2'));var rs=require(_0x80e1('0x3'));var fs=require('fs');var Redis=require(_0x80e1('0x4'));var db=require(_0x80e1('0x5'))['db'];var utils=require(_0x80e1('0x6'));var logger=require('../../config/logger')(_0x80e1('0x7'));var config=require(_0x80e1('0x8'));var jayson=require(_0x80e1('0x9'));var client=jayson['client'][_0x80e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216eb2,_0xd31245,_0x184e09){return new BPromise(function(_0x46f8bc,_0x24bcd0){return client[_0x80e1('0xb')](_0x216eb2,_0x184e09)[_0x80e1('0xc')](function(_0x1a1c63){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xd31245,_0x80e1('0xd'));logger['debug'](_0x80e1('0xe'),_0xd31245,_0x80e1('0xd'),JSON[_0x80e1('0xf')](_0x1a1c63));if(_0x1a1c63[_0x80e1('0x10')]){if(_0x1a1c63[_0x80e1('0x10')][_0x80e1('0x11')]===0x1f4){logger[_0x80e1('0x10')](_0x80e1('0x12'),_0xd31245,_0x1a1c63[_0x80e1('0x10')][_0x80e1('0x13')]);return _0x24bcd0(_0x1a1c63[_0x80e1('0x10')][_0x80e1('0x13')]);}logger[_0x80e1('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xd31245,_0x1a1c63[_0x80e1('0x10')][_0x80e1('0x13')]);return _0x46f8bc(_0x1a1c63[_0x80e1('0x10')][_0x80e1('0x13')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xd31245,'request\x20sent');_0x46f8bc(_0x1a1c63[_0x80e1('0x14')][_0x80e1('0x13')]);}})[_0x80e1('0x15')](function(_0xd5782d){logger[_0x80e1('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xd31245,_0xd5782d);_0x24bcd0(_0xd5782d);});});}exports[_0x80e1('0x16')]=function(_0xe334e2){var _0x42636f=this;return new Promise(function(_0x21ec60,_0x464670){return db[_0x80e1('0x17')][_0x80e1('0x18')]({'raw':_0xe334e2[_0x80e1('0x19')]?_0xe334e2[_0x80e1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xe334e2['options']?_0xe334e2['options'][_0x80e1('0x1a')]||null:null,'attributes':_0xe334e2[_0x80e1('0x19')]?_0xe334e2[_0x80e1('0x19')][_0x80e1('0x1b')]||null:null,'limit':_0xe334e2[_0x80e1('0x19')]?_0xe334e2[_0x80e1('0x19')][_0x80e1('0x1c')]||null:null,'include':_0xe334e2[_0x80e1('0x19')]?_0xe334e2[_0x80e1('0x19')][_0x80e1('0x1d')]?_['map'](_0xe334e2[_0x80e1('0x19')][_0x80e1('0x1d')],function(_0x342192){return{'model':db[_0x342192[_0x80e1('0x1e')]],'as':_0x342192['as'],'attributes':_0x342192[_0x80e1('0x1b')],'include':_0x342192[_0x80e1('0x1d')]?_[_0x80e1('0x1f')](_0x342192['include'],function(_0x4575f3){return{'model':db[_0x4575f3[_0x80e1('0x1e')]],'as':_0x4575f3['as'],'attributes':_0x4575f3[_0x80e1('0x1b')],'include':_0x4575f3[_0x80e1('0x1d')]?_[_0x80e1('0x1f')](_0x4575f3[_0x80e1('0x1d')],function(_0x348fe0){return{'model':db[_0x348fe0[_0x80e1('0x1e')]],'as':_0x348fe0['as'],'attributes':_0x348fe0[_0x80e1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f874c){logger['info'](_0x80e1('0x16'),_0xe334e2);logger[_0x80e1('0x20')](_0x80e1('0x16'),_0xe334e2,JSON[_0x80e1('0xf')](_0x2f874c));_0x21ec60(_0x2f874c);})['catch'](function(_0x26e06e){logger['error'](_0x80e1('0x16'),_0x26e06e[_0x80e1('0x13')],_0xe334e2);_0x464670(_0x42636f[_0x80e1('0x10')](0x1f4,_0x26e06e[_0x80e1('0x13')]));});});};exports[_0x80e1('0x21')]=function(_0x122133){var _0x2bcc78=this;return new Promise(function(_0x4cb9ff,_0x420abb){return db[_0x80e1('0x17')][_0x80e1('0x22')]({'raw':_0x122133[_0x80e1('0x19')]?_0x122133[_0x80e1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x122133[_0x80e1('0x19')]?_0x122133[_0x80e1('0x19')]['where']||null:null,'attributes':_0x122133[_0x80e1('0x19')]?_0x122133[_0x80e1('0x19')][_0x80e1('0x1b')]||null:null,'include':_0x122133[_0x80e1('0x19')]?_0x122133[_0x80e1('0x19')][_0x80e1('0x1d')]?_[_0x80e1('0x1f')](_0x122133[_0x80e1('0x19')][_0x80e1('0x1d')],function(_0x221047){return{'model':db[_0x221047[_0x80e1('0x1e')]],'as':_0x221047['as'],'attributes':_0x221047['attributes'],'include':_0x221047[_0x80e1('0x1d')]?_[_0x80e1('0x1f')](_0x221047[_0x80e1('0x1d')],function(_0x1763a4){return{'model':db[_0x1763a4[_0x80e1('0x1e')]],'as':_0x1763a4['as'],'attributes':_0x1763a4[_0x80e1('0x1b')],'include':_0x1763a4[_0x80e1('0x1d')]?_[_0x80e1('0x1f')](_0x1763a4[_0x80e1('0x1d')],function(_0x49ec9a){return{'model':db[_0x49ec9a[_0x80e1('0x1e')]],'as':_0x49ec9a['as'],'attributes':_0x49ec9a[_0x80e1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7edc){logger['info']('ShowSalesforceAccount',_0x122133);logger[_0x80e1('0x20')]('ShowSalesforceAccount',_0x122133,JSON[_0x80e1('0xf')](_0x5d7edc));_0x4cb9ff(_0x5d7edc);})['catch'](function(_0x570c78){logger[_0x80e1('0x10')](_0x80e1('0x21'),_0x570c78['message'],_0x122133);_0x420abb(_0x2bcc78['error'](0x1f4,_0x570c78[_0x80e1('0x13')]));});});}; \ No newline at end of file +var _0x1a12=['then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a12,0x80));var _0x21a1=function(_0x5c6f4f,_0x2afc60){_0x5c6f4f=_0x5c6f4f-0x0;var _0x19cf7c=_0x1a12[_0x5c6f4f];return _0x19cf7c;};'use strict';var _=require(_0x21a1('0x0'));var util=require(_0x21a1('0x1'));var moment=require(_0x21a1('0x2'));var BPromise=require(_0x21a1('0x3'));var rs=require(_0x21a1('0x4'));var fs=require('fs');var Redis=require(_0x21a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21a1('0x6'));var logger=require('../../config/logger')(_0x21a1('0x7'));var config=require(_0x21a1('0x8'));var jayson=require(_0x21a1('0x9'));var client=jayson[_0x21a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ffcec,_0x1cd626,_0x5a0fa5){return new BPromise(function(_0x5e592a,_0x3cf7b7){return client[_0x21a1('0xb')](_0x1ffcec,_0x5a0fa5)[_0x21a1('0xc')](function(_0x8238d9){logger[_0x21a1('0xd')](_0x21a1('0xe'),_0x1cd626,'request\x20sent');logger['debug'](_0x21a1('0xf'),_0x1cd626,_0x21a1('0x10'),JSON['stringify'](_0x8238d9));if(_0x8238d9['error']){if(_0x8238d9[_0x21a1('0x11')][_0x21a1('0x12')]===0x1f4){logger[_0x21a1('0x11')](_0x21a1('0xe'),_0x1cd626,_0x8238d9[_0x21a1('0x11')][_0x21a1('0x13')]);return _0x3cf7b7(_0x8238d9[_0x21a1('0x11')][_0x21a1('0x13')]);}logger[_0x21a1('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x1cd626,_0x8238d9[_0x21a1('0x11')][_0x21a1('0x13')]);return _0x5e592a(_0x8238d9[_0x21a1('0x11')]['message']);}else{logger[_0x21a1('0xd')](_0x21a1('0xe'),_0x1cd626,_0x21a1('0x10'));_0x5e592a(_0x8238d9[_0x21a1('0x14')][_0x21a1('0x13')]);}})[_0x21a1('0x15')](function(_0x49220b){logger['error'](_0x21a1('0xe'),_0x1cd626,_0x49220b);_0x3cf7b7(_0x49220b);});});}exports[_0x21a1('0x16')]=function(_0xb805c4){var _0x1bde99=this;return new Promise(function(_0x185e95,_0x333261){return db[_0x21a1('0x17')][_0x21a1('0x18')]({'raw':_0xb805c4[_0x21a1('0x19')]?_0xb805c4['options'][_0x21a1('0x1a')]===undefined?!![]:![]:!![],'where':_0xb805c4[_0x21a1('0x19')]?_0xb805c4[_0x21a1('0x19')][_0x21a1('0x1b')]||null:null,'attributes':_0xb805c4['options']?_0xb805c4[_0x21a1('0x19')][_0x21a1('0x1c')]||null:null,'limit':_0xb805c4[_0x21a1('0x19')]?_0xb805c4[_0x21a1('0x19')]['limit']||null:null,'include':_0xb805c4[_0x21a1('0x19')]?_0xb805c4[_0x21a1('0x19')][_0x21a1('0x1d')]?_[_0x21a1('0x1e')](_0xb805c4[_0x21a1('0x19')][_0x21a1('0x1d')],function(_0x39b924){return{'model':db[_0x39b924[_0x21a1('0x1f')]],'as':_0x39b924['as'],'attributes':_0x39b924['attributes'],'include':_0x39b924['include']?_['map'](_0x39b924['include'],function(_0x2d4dd4){return{'model':db[_0x2d4dd4[_0x21a1('0x1f')]],'as':_0x2d4dd4['as'],'attributes':_0x2d4dd4[_0x21a1('0x1c')],'include':_0x2d4dd4['include']?_[_0x21a1('0x1e')](_0x2d4dd4[_0x21a1('0x1d')],function(_0x939299){return{'model':db[_0x939299['model']],'as':_0x939299['as'],'attributes':_0x939299[_0x21a1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21a1('0xc')](function(_0x22fbc3){logger[_0x21a1('0xd')]('GetSalesforceAccount',_0xb805c4);logger[_0x21a1('0x20')]('GetSalesforceAccount',_0xb805c4,JSON[_0x21a1('0x21')](_0x22fbc3));_0x185e95(_0x22fbc3);})[_0x21a1('0x15')](function(_0x1c901c){logger[_0x21a1('0x11')](_0x21a1('0x16'),_0x1c901c[_0x21a1('0x13')],_0xb805c4);_0x333261(_0x1bde99[_0x21a1('0x11')](0x1f4,_0x1c901c[_0x21a1('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x1bda66){var _0x40fd03=this;return new Promise(function(_0x26347c,_0x13d66f){return db[_0x21a1('0x17')]['find']({'raw':_0x1bda66[_0x21a1('0x19')]?_0x1bda66[_0x21a1('0x19')][_0x21a1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bda66[_0x21a1('0x19')]?_0x1bda66['options'][_0x21a1('0x1b')]||null:null,'attributes':_0x1bda66['options']?_0x1bda66[_0x21a1('0x19')]['attributes']||null:null,'include':_0x1bda66['options']?_0x1bda66['options'][_0x21a1('0x1d')]?_['map'](_0x1bda66[_0x21a1('0x19')][_0x21a1('0x1d')],function(_0x29ee79){return{'model':db[_0x29ee79[_0x21a1('0x1f')]],'as':_0x29ee79['as'],'attributes':_0x29ee79[_0x21a1('0x1c')],'include':_0x29ee79[_0x21a1('0x1d')]?_[_0x21a1('0x1e')](_0x29ee79['include'],function(_0x55e812){return{'model':db[_0x55e812['model']],'as':_0x55e812['as'],'attributes':_0x55e812[_0x21a1('0x1c')],'include':_0x55e812[_0x21a1('0x1d')]?_[_0x21a1('0x1e')](_0x55e812[_0x21a1('0x1d')],function(_0x2f816b){return{'model':db[_0x2f816b[_0x21a1('0x1f')]],'as':_0x2f816b['as'],'attributes':_0x2f816b[_0x21a1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21a1('0xc')](function(_0x4cfc8d){logger['info'](_0x21a1('0x22'),_0x1bda66);logger[_0x21a1('0x20')](_0x21a1('0x22'),_0x1bda66,JSON[_0x21a1('0x21')](_0x4cfc8d));_0x26347c(_0x4cfc8d);})[_0x21a1('0x15')](function(_0x3e919d){logger[_0x21a1('0x11')](_0x21a1('0x22'),_0x3e919d[_0x21a1('0x13')],_0x1bda66);_0x13d66f(_0x40fd03[_0x21a1('0x11')](0x1f4,_0x3e919d[_0x21a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c7b9406..b90331f 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(_0x538d8f,_0x3c135d){var _0x3e0e88=function(_0x105092){while(--_0x105092){_0x538d8f['push'](_0x538d8f['shift']());}};_0x3e0e88(++_0x3c135d);}(_0x2ef3,0xba));var _0x32ef=function(_0x1205cc,_0x3d103a){_0x1205cc=_0x1205cc-0x0;var _0x4b709f=_0x2ef3[_0x1205cc];return _0x4b709f;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x164a4b,_0x3fd282){_0x164a4b=_0x164a4b-0x0;var _0x3f3f74=_0xdb28[_0x164a4b];return _0x3f3f74;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c3ada21..3c185e4 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 _0x8220=['nothing','lead','account','STRING','Task','ENUM','contact','account_contact_lead','contact_lead'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x8220,0x93));var _0x0822=function(_0x1af046,_0x218baa){_0x1af046=_0x1af046-0x0;var _0x479abf=_0x8220[_0x1af046];return _0x479abf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0822('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x0822('0x1'),'Case'),'defaultValue':_0x0822('0x1')},'moduleSearch':{'type':Sequelize[_0x0822('0x2')]('contact_lead',_0x0822('0x3'),'lead',_0x0822('0x4'),'account'),'defaultValue':_0x0822('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x0822('0x6'),_0x0822('0x3'),_0x0822('0x7'),_0x0822('0x8')),'defaultValue':_0x0822('0x7')},'leadId':{'type':Sequelize[_0x0822('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x0822('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x0822('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x0822('0x0')]}}; \ No newline at end of file +var _0x0e76=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account','nothing'];(function(_0x39dac0,_0x47dfeb){var _0x5e9abd=function(_0x23b33c){while(--_0x23b33c){_0x39dac0['push'](_0x39dac0['shift']());}};_0x5e9abd(++_0x47dfeb);}(_0x0e76,0x10e));var _0x60e7=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x0e76[_0x3b632f];return _0x10e788;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x60e7('0x0')]},'description':{'type':Sequelize[_0x60e7('0x0')]},'ticketType':{'type':Sequelize[_0x60e7('0x1')](_0x60e7('0x2'),_0x60e7('0x3')),'defaultValue':_0x60e7('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x60e7('0x4'),_0x60e7('0x5'),_0x60e7('0x6'),'account_contact_lead',_0x60e7('0x7')),'defaultValue':_0x60e7('0x4')},'moduleCreate':{'type':Sequelize[_0x60e7('0x1')](_0x60e7('0x8'),_0x60e7('0x5'),'lead',_0x60e7('0x7')),'defaultValue':_0x60e7('0x6')},'leadId':{'type':Sequelize[_0x60e7('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x60e7('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x60e7('0x0')]},'additionalSearchLead':{'type':Sequelize[_0x60e7('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7fd4872..a8a0eb9 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 _0x7a34=['find','create','body','destroy','getFields','getSubjects','findOne','SalesforceField','merge','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','name','send','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','then','rows','catch','show','params','rawAttributes','length'];(function(_0x1dd14d,_0x5f208f){var _0x4ced0e=function(_0x33a577){while(--_0x33a577){_0x1dd14d['push'](_0x1dd14d['shift']());}};_0x4ced0e(++_0x5f208f);}(_0x7a34,0xa6));var _0x47a3=function(_0xd9a059,_0x414cf6){_0xd9a059=_0xd9a059-0x0;var _0x587e06=_0x7a34[_0xd9a059];return _0x587e06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47a3('0x0'));var jsonpatch=require(_0x47a3('0x1'));var rp=require('request-promise');var moment=require(_0x47a3('0x2'));var BPromise=require(_0x47a3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x47a3('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x47a3('0x5'));var fs=require('fs');var fs_extra=require(_0x47a3('0x6'));var _=require(_0x47a3('0x7'));var squel=require(_0x47a3('0x8'));var crypto=require('crypto');var jsforce=require(_0x47a3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x47a3('0xa'));var querystring=require(_0x47a3('0xb'));var Papa=require(_0x47a3('0xc'));var Redis=require(_0x47a3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x47a3('0xe'));var as=require(_0x47a3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a3('0x10'))(_0x47a3('0x11'));var utils=require('../../config/utils');var config=require(_0x47a3('0x12'));var licenseUtil=require(_0x47a3('0x13'));var db=require(_0x47a3('0x14'))['db'];function respondWithStatusCode(_0xd09eca,_0x3087f0){_0x3087f0=_0x3087f0||0xcc;return function(_0x1861cf){if(_0x1861cf){return _0xd09eca[_0x47a3('0x15')](_0x3087f0);}return _0xd09eca[_0x47a3('0x16')](_0x3087f0)[_0x47a3('0x17')]();};}function respondWithResult(_0x2c49d3,_0x5c0e43){_0x5c0e43=_0x5c0e43||0xc8;return function(_0x263bfe){if(_0x263bfe){return _0x2c49d3[_0x47a3('0x16')](_0x5c0e43)[_0x47a3('0x18')](_0x263bfe);}};}function respondWithFilteredResult(_0x35869b,_0x2e3765){return function(_0x5dcbe0){if(_0x5dcbe0){var _0x31680d=typeof _0x2e3765[_0x47a3('0x19')]===_0x47a3('0x1a')&&typeof _0x2e3765['limit']===_0x47a3('0x1a');var _0x6a9673=_0x5dcbe0['count'];var _0x3ccb16=_0x31680d?0x0:_0x2e3765[_0x47a3('0x19')];var _0x277b51=_0x31680d?_0x5dcbe0[_0x47a3('0x1b')]:_0x2e3765['offset']+_0x2e3765['limit'];var _0x184b77;if(_0x277b51>=_0x6a9673){_0x277b51=_0x6a9673;_0x184b77=0xc8;}else{_0x184b77=0xce;}_0x35869b[_0x47a3('0x16')](_0x184b77);return _0x35869b[_0x47a3('0x1c')](_0x47a3('0x1d'),_0x3ccb16+'-'+_0x277b51+'/'+_0x6a9673)[_0x47a3('0x18')](_0x5dcbe0);}return null;};}function patchUpdates(_0x5045c4){return function(_0xb473ae){try{jsonpatch[_0x47a3('0x1e')](_0xb473ae,_0x5045c4,!![]);}catch(_0x330cb1){return BPromise[_0x47a3('0x1f')](_0x330cb1);}return _0xb473ae['save']();};}function saveUpdates(_0x2e07aa,_0x45521d){return function(_0x50b5cc){if(_0x50b5cc){return _0x50b5cc[_0x47a3('0x20')](_0x2e07aa)['then'](function(_0x5f511f){return _0x5f511f;});}return null;};}function removeEntity(_0x522ee4,_0x24e311){return function(_0x13cd84){if(_0x13cd84){return _0x13cd84['destroy']()['then'](function(){_0x522ee4[_0x47a3('0x16')](0xcc)[_0x47a3('0x17')]();});}};}function handleEntityNotFound(_0x431a93,_0x5eeb6f){return function(_0x23581d){if(!_0x23581d){_0x431a93[_0x47a3('0x15')](0x194);}return _0x23581d;};}function handleError(_0x5ad583,_0x185efa){_0x185efa=_0x185efa||0x1f4;return function(_0x2f7702){logger['error'](_0x2f7702['stack']);if(_0x2f7702['name']){delete _0x2f7702[_0x47a3('0x21')];}_0x5ad583['status'](_0x185efa)[_0x47a3('0x22')](_0x2f7702);};}exports[_0x47a3('0x23')]=function(_0x479aa7,_0x59081c){var _0x545555={},_0x55f5a6={},_0x4c3958={'count':0x0,'rows':[]};var _0x2b0224=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x2ab340){return{'name':_0x2ab340[_0x47a3('0x24')],'type':_0x2ab340[_0x47a3('0x25')][_0x47a3('0x26')]};});_0x55f5a6[_0x47a3('0x27')]=_[_0x47a3('0x28')](_0x2b0224,_0x47a3('0x21'));_0x55f5a6['query']=_[_0x47a3('0x29')](_0x479aa7[_0x47a3('0x2a')]);_0x55f5a6['filters']=_[_0x47a3('0x2b')](_0x55f5a6['model'],_0x55f5a6[_0x47a3('0x2a')]);_0x545555[_0x47a3('0x2c')]=_[_0x47a3('0x2b')](_0x55f5a6[_0x47a3('0x27')],qs[_0x47a3('0x2d')](_0x479aa7['query'][_0x47a3('0x2d')]));_0x545555[_0x47a3('0x2c')]=_0x545555[_0x47a3('0x2c')]['length']?_0x545555[_0x47a3('0x2c')]:_0x55f5a6[_0x47a3('0x27')];if(!_0x479aa7['query'][_0x47a3('0x2e')](_0x47a3('0x2f'))){_0x545555[_0x47a3('0x30')]=qs[_0x47a3('0x30')](_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x30')]);_0x545555['offset']=qs[_0x47a3('0x19')](_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x19')]);}_0x545555[_0x47a3('0x31')]=qs[_0x47a3('0x32')](_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x32')]);_0x545555[_0x47a3('0x33')]=qs[_0x47a3('0x34')](_[_0x47a3('0x35')](_0x479aa7['query'],_0x55f5a6[_0x47a3('0x34')]),_0x2b0224);if(_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x36')]){_0x545555[_0x47a3('0x33')]=_['merge'](_0x545555[_0x47a3('0x33')],{'$or':_[_0x47a3('0x28')](_0x2b0224,function(_0x564e7d){if(_0x564e7d['type']!==_0x47a3('0x37')){var _0x487d34={};_0x487d34[_0x564e7d[_0x47a3('0x21')]]={'$like':'%'+_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x36')]+'%'};return _0x487d34;}})});}_0x545555=_['merge']({},_0x545555,_0x479aa7[_0x47a3('0x38')]);var _0x24b494={'where':_0x545555[_0x47a3('0x33')]};return db['SalesforceConfiguration'][_0x47a3('0x1b')](_0x24b494)['then'](function(_0xaedb3a){_0x4c3958[_0x47a3('0x1b')]=_0xaedb3a;if(_0x479aa7[_0x47a3('0x2a')][_0x47a3('0x39')]){_0x545555[_0x47a3('0x3a')]=[{'all':!![]}];}return db[_0x47a3('0x3b')][_0x47a3('0x3c')](_0x545555);})[_0x47a3('0x3d')](function(_0x3e2fbe){_0x4c3958[_0x47a3('0x3e')]=_0x3e2fbe;return _0x4c3958;})['then'](respondWithFilteredResult(_0x59081c,_0x545555))[_0x47a3('0x3f')](handleError(_0x59081c,null));};exports[_0x47a3('0x40')]=function(_0x2784c6,_0x2a659c){var _0x47b39a={'raw':![],'where':{'id':_0x2784c6[_0x47a3('0x41')]['id']}},_0x5f31b6={};_0x5f31b6[_0x47a3('0x27')]=_[_0x47a3('0x29')](db[_0x47a3('0x3b')][_0x47a3('0x42')]);_0x5f31b6[_0x47a3('0x2a')]=_[_0x47a3('0x29')](_0x2784c6[_0x47a3('0x2a')]);_0x5f31b6[_0x47a3('0x34')]=_[_0x47a3('0x2b')](_0x5f31b6['model'],_0x5f31b6[_0x47a3('0x2a')]);_0x47b39a[_0x47a3('0x2c')]=_[_0x47a3('0x2b')](_0x5f31b6[_0x47a3('0x27')],qs[_0x47a3('0x2d')](_0x2784c6[_0x47a3('0x2a')][_0x47a3('0x2d')]));_0x47b39a[_0x47a3('0x2c')]=_0x47b39a[_0x47a3('0x2c')][_0x47a3('0x43')]?_0x47b39a['attributes']:_0x5f31b6[_0x47a3('0x27')];if(_0x2784c6[_0x47a3('0x2a')]['includeAll']){_0x47b39a['include']=[{'all':!![]}];}_0x47b39a=_['merge']({},_0x47b39a,_0x2784c6['options']);return db[_0x47a3('0x3b')][_0x47a3('0x44')](_0x47b39a)[_0x47a3('0x3d')](handleEntityNotFound(_0x2a659c,null))[_0x47a3('0x3d')](respondWithResult(_0x2a659c,null))[_0x47a3('0x3f')](handleError(_0x2a659c,null));};exports[_0x47a3('0x45')]=function(_0x1edc55,_0x39ab5f){return db['SalesforceConfiguration'][_0x47a3('0x45')](_0x1edc55[_0x47a3('0x46')],{})['then'](respondWithResult(_0x39ab5f,0xc9))['catch'](handleError(_0x39ab5f,null));};exports[_0x47a3('0x20')]=function(_0x16adf8,_0x4c3de8){if(_0x16adf8[_0x47a3('0x46')]['id']){delete _0x16adf8['body']['id'];}return db[_0x47a3('0x3b')][_0x47a3('0x44')]({'where':{'id':_0x16adf8['params']['id']}})[_0x47a3('0x3d')](handleEntityNotFound(_0x4c3de8,null))[_0x47a3('0x3d')](saveUpdates(_0x16adf8[_0x47a3('0x46')],null))[_0x47a3('0x3d')](respondWithResult(_0x4c3de8,null))[_0x47a3('0x3f')](handleError(_0x4c3de8,null));};exports[_0x47a3('0x47')]=function(_0x4dd736,_0x4264bd){return db[_0x47a3('0x3b')]['find']({'where':{'id':_0x4dd736[_0x47a3('0x41')]['id']}})[_0x47a3('0x3d')](handleEntityNotFound(_0x4264bd,null))[_0x47a3('0x3d')](removeEntity(_0x4264bd,null))['catch'](handleError(_0x4264bd,null));};exports[_0x47a3('0x48')]=function(_0x573441,_0x27ce90,_0x222e69){var _0x31f552={};var _0x3bb887={};var _0x2a5a80;var _0x1a3c82;return db[_0x47a3('0x3b')]['findOne']({'where':{'id':_0x573441[_0x47a3('0x41')]['id']}})[_0x47a3('0x3d')](handleEntityNotFound(_0x27ce90,null))[_0x47a3('0x3d')](function(_0x4dd259){if(_0x4dd259){_0x2a5a80=_0x4dd259;_0x3bb887[_0x47a3('0x27')]=_[_0x47a3('0x29')](db['SalesforceField']['rawAttributes']);_0x3bb887[_0x47a3('0x2a')]=_[_0x47a3('0x29')](_0x573441[_0x47a3('0x2a')]);_0x3bb887[_0x47a3('0x34')]=_[_0x47a3('0x2b')](_0x3bb887[_0x47a3('0x27')],_0x3bb887['query']);_0x31f552[_0x47a3('0x2c')]=_[_0x47a3('0x2b')](_0x3bb887[_0x47a3('0x27')],qs[_0x47a3('0x2d')](_0x573441['query'][_0x47a3('0x2d')]));_0x31f552[_0x47a3('0x2c')]=_0x31f552['attributes'][_0x47a3('0x43')]?_0x31f552[_0x47a3('0x2c')]:_0x3bb887[_0x47a3('0x27')];_0x31f552[_0x47a3('0x31')]=qs[_0x47a3('0x32')](_0x573441[_0x47a3('0x2a')][_0x47a3('0x32')]);_0x31f552[_0x47a3('0x33')]=qs[_0x47a3('0x34')](_['pick'](_0x573441['query'],_0x3bb887[_0x47a3('0x34')]));if(_0x573441[_0x47a3('0x2a')][_0x47a3('0x36')]){_0x31f552[_0x47a3('0x33')]=_['merge'](_0x31f552['where'],{'$or':_['map'](_0x31f552[_0x47a3('0x2c')],function(_0x5adcd0){var _0x1735a4={};_0x1735a4[_0x5adcd0]={'$like':'%'+_0x573441[_0x47a3('0x2a')]['filter']+'%'};return _0x1735a4;})});}_0x31f552=_['merge']({},_0x31f552,_0x573441[_0x47a3('0x38')]);return _0x2a5a80[_0x47a3('0x48')](_0x31f552);}})[_0x47a3('0x3d')](function(_0x40113d){if(_0x40113d){_0x1a3c82=_0x40113d[_0x47a3('0x43')];if(!_0x573441[_0x47a3('0x2a')][_0x47a3('0x2e')](_0x47a3('0x2f'))){_0x31f552['limit']=qs[_0x47a3('0x30')](_0x573441[_0x47a3('0x2a')]['limit']);_0x31f552['offset']=qs[_0x47a3('0x19')](_0x573441[_0x47a3('0x2a')]['offset']);}return _0x2a5a80[_0x47a3('0x48')](_0x31f552);}})[_0x47a3('0x3d')](function(_0x293750){if(_0x293750){return _0x293750?{'count':_0x1a3c82,'rows':_0x293750}:null;}})[_0x47a3('0x3d')](respondWithResult(_0x27ce90,null))[_0x47a3('0x3f')](handleError(_0x27ce90,null));};exports[_0x47a3('0x49')]=function(_0x1c62d3,_0x339c28,_0x4b6878){var _0x575d81={};var _0x58016c={};var _0x50b0bb;var _0x5e95b6;return db[_0x47a3('0x3b')][_0x47a3('0x4a')]({'where':{'id':_0x1c62d3[_0x47a3('0x41')]['id']}})['then'](handleEntityNotFound(_0x339c28,null))[_0x47a3('0x3d')](function(_0x550a46){if(_0x550a46){_0x50b0bb=_0x550a46;_0x58016c[_0x47a3('0x27')]=_[_0x47a3('0x29')](db[_0x47a3('0x4b')][_0x47a3('0x42')]);_0x58016c[_0x47a3('0x2a')]=_[_0x47a3('0x29')](_0x1c62d3[_0x47a3('0x2a')]);_0x58016c[_0x47a3('0x34')]=_['intersection'](_0x58016c[_0x47a3('0x27')],_0x58016c['query']);_0x575d81[_0x47a3('0x2c')]=_[_0x47a3('0x2b')](_0x58016c[_0x47a3('0x27')],qs[_0x47a3('0x2d')](_0x1c62d3[_0x47a3('0x2a')]['fields']));_0x575d81['attributes']=_0x575d81[_0x47a3('0x2c')]['length']?_0x575d81['attributes']:_0x58016c[_0x47a3('0x27')];_0x575d81[_0x47a3('0x31')]=qs[_0x47a3('0x32')](_0x1c62d3[_0x47a3('0x2a')][_0x47a3('0x32')]);_0x575d81[_0x47a3('0x33')]=qs[_0x47a3('0x34')](_['pick'](_0x1c62d3[_0x47a3('0x2a')],_0x58016c['filters']));if(_0x1c62d3[_0x47a3('0x2a')][_0x47a3('0x36')]){_0x575d81['where']=_[_0x47a3('0x4c')](_0x575d81[_0x47a3('0x33')],{'$or':_[_0x47a3('0x28')](_0x575d81[_0x47a3('0x2c')],function(_0x29debd){var _0x5ec5aa={};_0x5ec5aa[_0x29debd]={'$like':'%'+_0x1c62d3[_0x47a3('0x2a')][_0x47a3('0x36')]+'%'};return _0x5ec5aa;})});}_0x575d81=_[_0x47a3('0x4c')]({},_0x575d81,_0x1c62d3['options']);return _0x50b0bb[_0x47a3('0x49')](_0x575d81);}})[_0x47a3('0x3d')](function(_0x1eda29){if(_0x1eda29){_0x5e95b6=_0x1eda29[_0x47a3('0x43')];if(!_0x1c62d3[_0x47a3('0x2a')][_0x47a3('0x2e')](_0x47a3('0x2f'))){_0x575d81[_0x47a3('0x30')]=qs[_0x47a3('0x30')](_0x1c62d3['query'][_0x47a3('0x30')]);_0x575d81['offset']=qs[_0x47a3('0x19')](_0x1c62d3['query'][_0x47a3('0x19')]);}return _0x50b0bb[_0x47a3('0x49')](_0x575d81);}})[_0x47a3('0x3d')](function(_0x12f2a8){if(_0x12f2a8){return _0x12f2a8?{'count':_0x5e95b6,'rows':_0x12f2a8}:null;}})[_0x47a3('0x3d')](respondWithResult(_0x339c28,null))['catch'](handleError(_0x339c28,null));};exports[_0x47a3('0x4d')]=function(_0x258f9c,_0x5b0065,_0x385ae4){var _0x33f324={};var _0x211aaa={};var _0xb6bbf3;var _0x5a20ed;return db['SalesforceConfiguration'][_0x47a3('0x4a')]({'where':{'id':_0x258f9c['params']['id']}})[_0x47a3('0x3d')](handleEntityNotFound(_0x5b0065,null))[_0x47a3('0x3d')](function(_0x41c036){if(_0x41c036){_0xb6bbf3=_0x41c036;_0x211aaa['model']=_[_0x47a3('0x29')](db['SalesforceField'][_0x47a3('0x42')]);_0x211aaa[_0x47a3('0x2a')]=_[_0x47a3('0x29')](_0x258f9c['query']);_0x211aaa['filters']=_[_0x47a3('0x2b')](_0x211aaa[_0x47a3('0x27')],_0x211aaa['query']);_0x33f324[_0x47a3('0x2c')]=_[_0x47a3('0x2b')](_0x211aaa[_0x47a3('0x27')],qs[_0x47a3('0x2d')](_0x258f9c[_0x47a3('0x2a')][_0x47a3('0x2d')]));_0x33f324[_0x47a3('0x2c')]=_0x33f324['attributes'][_0x47a3('0x43')]?_0x33f324[_0x47a3('0x2c')]:_0x211aaa[_0x47a3('0x27')];_0x33f324[_0x47a3('0x31')]=qs[_0x47a3('0x32')](_0x258f9c['query'][_0x47a3('0x32')]);_0x33f324[_0x47a3('0x33')]=qs['filters'](_[_0x47a3('0x35')](_0x258f9c[_0x47a3('0x2a')],_0x211aaa[_0x47a3('0x34')]));if(_0x258f9c[_0x47a3('0x2a')]['filter']){_0x33f324['where']=_[_0x47a3('0x4c')](_0x33f324[_0x47a3('0x33')],{'$or':_['map'](_0x33f324[_0x47a3('0x2c')],function(_0x4c9c54){var _0x3aee1c={};_0x3aee1c[_0x4c9c54]={'$like':'%'+_0x258f9c[_0x47a3('0x2a')][_0x47a3('0x36')]+'%'};return _0x3aee1c;})});}_0x33f324=_[_0x47a3('0x4c')]({},_0x33f324,_0x258f9c[_0x47a3('0x38')]);return _0xb6bbf3[_0x47a3('0x4d')](_0x33f324);}})['then'](function(_0x4e7cdf){if(_0x4e7cdf){_0x5a20ed=_0x4e7cdf[_0x47a3('0x43')];if(!_0x258f9c[_0x47a3('0x2a')]['hasOwnProperty']('nolimit')){_0x33f324[_0x47a3('0x30')]=qs[_0x47a3('0x30')](_0x258f9c['query']['limit']);_0x33f324[_0x47a3('0x19')]=qs[_0x47a3('0x19')](_0x258f9c['query'][_0x47a3('0x19')]);}return _0xb6bbf3['getDescriptions'](_0x33f324);}})[_0x47a3('0x3d')](function(_0x3b939a){if(_0x3b939a){return _0x3b939a?{'count':_0x5a20ed,'rows':_0x3b939a}:null;}})[_0x47a3('0x3d')](respondWithResult(_0x5b0065,null))[_0x47a3('0x3f')](handleError(_0x5b0065,null));}; \ No newline at end of file +var _0x27af=['filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','find','getFields','findOne','SalesforceField','sort','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','VIRTUAL'];(function(_0x545ac2,_0x1abb98){var _0x274850=function(_0x5de5ae){while(--_0x5de5ae){_0x545ac2['push'](_0x545ac2['shift']());}};_0x274850(++_0x1abb98);}(_0x27af,0xbe));var _0xf27a=function(_0x526239,_0x30443f){_0x526239=_0x526239-0x0;var _0x2e62de=_0x27af[_0x526239];return _0x2e62de;};'use strict';var emlformat=require(_0xf27a('0x0'));var rimraf=require(_0xf27a('0x1'));var zipdir=require(_0xf27a('0x2'));var jsonpatch=require(_0xf27a('0x3'));var rp=require(_0xf27a('0x4'));var moment=require(_0xf27a('0x5'));var BPromise=require(_0xf27a('0x6'));var Mustache=require(_0xf27a('0x7'));var util=require(_0xf27a('0x8'));var path=require(_0xf27a('0x9'));var sox=require(_0xf27a('0xa'));var csv=require(_0xf27a('0xb'));var ejs=require(_0xf27a('0xc'));var fs=require('fs');var fs_extra=require(_0xf27a('0xd'));var _=require('lodash');var squel=require(_0xf27a('0xe'));var crypto=require(_0xf27a('0xf'));var jsforce=require(_0xf27a('0x10'));var deskjs=require(_0xf27a('0x11'));var toCsv=require(_0xf27a('0xb'));var querystring=require(_0xf27a('0x12'));var Papa=require(_0xf27a('0x13'));var Redis=require(_0xf27a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf27a('0x15'));var as=require(_0xf27a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf27a('0x17'))(_0xf27a('0x18'));var utils=require(_0xf27a('0x19'));var config=require(_0xf27a('0x1a'));var licenseUtil=require(_0xf27a('0x1b'));var db=require(_0xf27a('0x1c'))['db'];function respondWithStatusCode(_0x11f4e5,_0x581ab5){_0x581ab5=_0x581ab5||0xcc;return function(_0x47363c){if(_0x47363c){return _0x11f4e5['sendStatus'](_0x581ab5);}return _0x11f4e5[_0xf27a('0x1d')](_0x581ab5)[_0xf27a('0x1e')]();};}function respondWithResult(_0x8a7432,_0x502dd5){_0x502dd5=_0x502dd5||0xc8;return function(_0x1d54a2){if(_0x1d54a2){return _0x8a7432[_0xf27a('0x1d')](_0x502dd5)['json'](_0x1d54a2);}};}function respondWithFilteredResult(_0x1a57e3,_0x3c9fa5){return function(_0x469353){if(_0x469353){var _0x3a6c41=typeof _0x3c9fa5[_0xf27a('0x1f')]==='undefined'&&typeof _0x3c9fa5[_0xf27a('0x20')]===_0xf27a('0x21');var _0x3c2ea8=_0x469353[_0xf27a('0x22')];var _0x457927=_0x3a6c41?0x0:_0x3c9fa5['offset'];var _0x2a6d91=_0x3a6c41?_0x469353[_0xf27a('0x22')]:_0x3c9fa5[_0xf27a('0x1f')]+_0x3c9fa5['limit'];var _0x38f85d;if(_0x2a6d91>=_0x3c2ea8){_0x2a6d91=_0x3c2ea8;_0x38f85d=0xc8;}else{_0x38f85d=0xce;}_0x1a57e3[_0xf27a('0x1d')](_0x38f85d);return _0x1a57e3[_0xf27a('0x23')](_0xf27a('0x24'),_0x457927+'-'+_0x2a6d91+'/'+_0x3c2ea8)['json'](_0x469353);}return null;};}function patchUpdates(_0x504ff0){return function(_0x375627){try{jsonpatch[_0xf27a('0x25')](_0x375627,_0x504ff0,!![]);}catch(_0x1c059f){return BPromise['reject'](_0x1c059f);}return _0x375627[_0xf27a('0x26')]();};}function saveUpdates(_0x94593e,_0x35b22a){return function(_0x5280ca){if(_0x5280ca){return _0x5280ca['update'](_0x94593e)[_0xf27a('0x27')](function(_0x28c0c5){return _0x28c0c5;});}return null;};}function removeEntity(_0x31d257,_0x11ffd6){return function(_0x535b93){if(_0x535b93){return _0x535b93[_0xf27a('0x28')]()[_0xf27a('0x27')](function(){_0x31d257[_0xf27a('0x1d')](0xcc)[_0xf27a('0x1e')]();});}};}function handleEntityNotFound(_0x59c727,_0x270490){return function(_0x27b0d6){if(!_0x27b0d6){_0x59c727[_0xf27a('0x29')](0x194);}return _0x27b0d6;};}function handleError(_0x43c492,_0x1e1c6b){_0x1e1c6b=_0x1e1c6b||0x1f4;return function(_0x467df3){logger[_0xf27a('0x2a')](_0x467df3[_0xf27a('0x2b')]);if(_0x467df3[_0xf27a('0x2c')]){delete _0x467df3[_0xf27a('0x2c')];}_0x43c492[_0xf27a('0x1d')](_0x1e1c6b)[_0xf27a('0x2d')](_0x467df3);};}exports['index']=function(_0x2cbda4,_0x18e478){var _0x1e1f08={},_0x4f6daf={},_0x668c49={'count':0x0,'rows':[]};var _0x5b45d4=_[_0xf27a('0x2e')](db[_0xf27a('0x2f')]['rawAttributes'],function(_0x24f47a){return{'name':_0x24f47a[_0xf27a('0x30')],'type':_0x24f47a[_0xf27a('0x31')][_0xf27a('0x32')]};});_0x4f6daf[_0xf27a('0x33')]=_['map'](_0x5b45d4,_0xf27a('0x2c'));_0x4f6daf[_0xf27a('0x34')]=_[_0xf27a('0x35')](_0x2cbda4['query']);_0x4f6daf[_0xf27a('0x36')]=_[_0xf27a('0x37')](_0x4f6daf[_0xf27a('0x33')],_0x4f6daf[_0xf27a('0x34')]);_0x1e1f08['attributes']=_[_0xf27a('0x37')](_0x4f6daf[_0xf27a('0x33')],qs[_0xf27a('0x38')](_0x2cbda4[_0xf27a('0x34')][_0xf27a('0x38')]));_0x1e1f08[_0xf27a('0x39')]=_0x1e1f08['attributes'][_0xf27a('0x3a')]?_0x1e1f08['attributes']:_0x4f6daf[_0xf27a('0x33')];if(!_0x2cbda4[_0xf27a('0x34')][_0xf27a('0x3b')]('nolimit')){_0x1e1f08[_0xf27a('0x20')]=qs[_0xf27a('0x20')](_0x2cbda4[_0xf27a('0x34')][_0xf27a('0x20')]);_0x1e1f08[_0xf27a('0x1f')]=qs['offset'](_0x2cbda4[_0xf27a('0x34')]['offset']);}_0x1e1f08[_0xf27a('0x3c')]=qs['sort'](_0x2cbda4['query']['sort']);_0x1e1f08[_0xf27a('0x3d')]=qs[_0xf27a('0x36')](_[_0xf27a('0x3e')](_0x2cbda4[_0xf27a('0x34')],_0x4f6daf[_0xf27a('0x36')]),_0x5b45d4);if(_0x2cbda4[_0xf27a('0x34')]['filter']){_0x1e1f08[_0xf27a('0x3d')]=_[_0xf27a('0x3f')](_0x1e1f08[_0xf27a('0x3d')],{'$or':_[_0xf27a('0x2e')](_0x5b45d4,function(_0x16a614){if(_0x16a614[_0xf27a('0x31')]!==_0xf27a('0x40')){var _0x220d49={};_0x220d49[_0x16a614[_0xf27a('0x2c')]]={'$like':'%'+_0x2cbda4[_0xf27a('0x34')][_0xf27a('0x41')]+'%'};return _0x220d49;}})});}_0x1e1f08=_[_0xf27a('0x3f')]({},_0x1e1f08,_0x2cbda4['options']);var _0x2574b2={'where':_0x1e1f08[_0xf27a('0x3d')]};return db['SalesforceConfiguration']['count'](_0x2574b2)[_0xf27a('0x27')](function(_0xf0f183){_0x668c49[_0xf27a('0x22')]=_0xf0f183;if(_0x2cbda4['query'][_0xf27a('0x42')]){_0x1e1f08['include']=[{'all':!![]}];}return db[_0xf27a('0x2f')][_0xf27a('0x43')](_0x1e1f08);})[_0xf27a('0x27')](function(_0xaa0253){_0x668c49[_0xf27a('0x44')]=_0xaa0253;return _0x668c49;})[_0xf27a('0x27')](respondWithFilteredResult(_0x18e478,_0x1e1f08))[_0xf27a('0x45')](handleError(_0x18e478,null));};exports[_0xf27a('0x46')]=function(_0x30a0c6,_0x51dc68){var _0x6b91b0={'raw':![],'where':{'id':_0x30a0c6[_0xf27a('0x47')]['id']}},_0x4efca0={};_0x4efca0[_0xf27a('0x33')]=_[_0xf27a('0x35')](db[_0xf27a('0x2f')][_0xf27a('0x48')]);_0x4efca0[_0xf27a('0x34')]=_[_0xf27a('0x35')](_0x30a0c6[_0xf27a('0x34')]);_0x4efca0[_0xf27a('0x36')]=_[_0xf27a('0x37')](_0x4efca0[_0xf27a('0x33')],_0x4efca0['query']);_0x6b91b0[_0xf27a('0x39')]=_[_0xf27a('0x37')](_0x4efca0[_0xf27a('0x33')],qs[_0xf27a('0x38')](_0x30a0c6[_0xf27a('0x34')][_0xf27a('0x38')]));_0x6b91b0['attributes']=_0x6b91b0['attributes'][_0xf27a('0x3a')]?_0x6b91b0[_0xf27a('0x39')]:_0x4efca0[_0xf27a('0x33')];if(_0x30a0c6[_0xf27a('0x34')][_0xf27a('0x42')]){_0x6b91b0[_0xf27a('0x49')]=[{'all':!![]}];}_0x6b91b0=_[_0xf27a('0x3f')]({},_0x6b91b0,_0x30a0c6[_0xf27a('0x4a')]);return db[_0xf27a('0x2f')]['find'](_0x6b91b0)[_0xf27a('0x27')](handleEntityNotFound(_0x51dc68,null))[_0xf27a('0x27')](respondWithResult(_0x51dc68,null))[_0xf27a('0x45')](handleError(_0x51dc68,null));};exports[_0xf27a('0x4b')]=function(_0x3a58a0,_0x40f5de){return db['SalesforceConfiguration'][_0xf27a('0x4b')](_0x3a58a0[_0xf27a('0x4c')],{})['then'](respondWithResult(_0x40f5de,0xc9))[_0xf27a('0x45')](handleError(_0x40f5de,null));};exports['update']=function(_0x28e4ca,_0x22415f){if(_0x28e4ca['body']['id']){delete _0x28e4ca['body']['id'];}return db[_0xf27a('0x2f')][_0xf27a('0x4d')]({'where':{'id':_0x28e4ca[_0xf27a('0x47')]['id']}})[_0xf27a('0x27')](handleEntityNotFound(_0x22415f,null))[_0xf27a('0x27')](saveUpdates(_0x28e4ca[_0xf27a('0x4c')],null))['then'](respondWithResult(_0x22415f,null))[_0xf27a('0x45')](handleError(_0x22415f,null));};exports['destroy']=function(_0xa703f4,_0x27cf6e){return db[_0xf27a('0x2f')][_0xf27a('0x4d')]({'where':{'id':_0xa703f4[_0xf27a('0x47')]['id']}})[_0xf27a('0x27')](handleEntityNotFound(_0x27cf6e,null))[_0xf27a('0x27')](removeEntity(_0x27cf6e,null))[_0xf27a('0x45')](handleError(_0x27cf6e,null));};exports[_0xf27a('0x4e')]=function(_0x8db3d8,_0x1ce2b7,_0x4db58f){var _0x11ade8={};var _0x394620={};var _0x2bd3ba;var _0x23c108;return db[_0xf27a('0x2f')][_0xf27a('0x4f')]({'where':{'id':_0x8db3d8[_0xf27a('0x47')]['id']}})[_0xf27a('0x27')](handleEntityNotFound(_0x1ce2b7,null))[_0xf27a('0x27')](function(_0x29f728){if(_0x29f728){_0x2bd3ba=_0x29f728;_0x394620[_0xf27a('0x33')]=_[_0xf27a('0x35')](db[_0xf27a('0x50')][_0xf27a('0x48')]);_0x394620[_0xf27a('0x34')]=_[_0xf27a('0x35')](_0x8db3d8[_0xf27a('0x34')]);_0x394620['filters']=_[_0xf27a('0x37')](_0x394620[_0xf27a('0x33')],_0x394620[_0xf27a('0x34')]);_0x11ade8[_0xf27a('0x39')]=_[_0xf27a('0x37')](_0x394620[_0xf27a('0x33')],qs[_0xf27a('0x38')](_0x8db3d8[_0xf27a('0x34')][_0xf27a('0x38')]));_0x11ade8['attributes']=_0x11ade8[_0xf27a('0x39')][_0xf27a('0x3a')]?_0x11ade8['attributes']:_0x394620[_0xf27a('0x33')];_0x11ade8[_0xf27a('0x3c')]=qs['sort'](_0x8db3d8['query'][_0xf27a('0x51')]);_0x11ade8[_0xf27a('0x3d')]=qs['filters'](_['pick'](_0x8db3d8['query'],_0x394620[_0xf27a('0x36')]));if(_0x8db3d8[_0xf27a('0x34')]['filter']){_0x11ade8[_0xf27a('0x3d')]=_[_0xf27a('0x3f')](_0x11ade8[_0xf27a('0x3d')],{'$or':_[_0xf27a('0x2e')](_0x11ade8['attributes'],function(_0x11d668){var _0x395f53={};_0x395f53[_0x11d668]={'$like':'%'+_0x8db3d8[_0xf27a('0x34')][_0xf27a('0x41')]+'%'};return _0x395f53;})});}_0x11ade8=_['merge']({},_0x11ade8,_0x8db3d8[_0xf27a('0x4a')]);return _0x2bd3ba[_0xf27a('0x4e')](_0x11ade8);}})[_0xf27a('0x27')](function(_0x6d183e){if(_0x6d183e){_0x23c108=_0x6d183e[_0xf27a('0x3a')];if(!_0x8db3d8[_0xf27a('0x34')][_0xf27a('0x3b')](_0xf27a('0x52'))){_0x11ade8[_0xf27a('0x20')]=qs['limit'](_0x8db3d8[_0xf27a('0x34')][_0xf27a('0x20')]);_0x11ade8[_0xf27a('0x1f')]=qs[_0xf27a('0x1f')](_0x8db3d8[_0xf27a('0x34')][_0xf27a('0x1f')]);}return _0x2bd3ba[_0xf27a('0x4e')](_0x11ade8);}})[_0xf27a('0x27')](function(_0x4f200){if(_0x4f200){return _0x4f200?{'count':_0x23c108,'rows':_0x4f200}:null;}})[_0xf27a('0x27')](respondWithResult(_0x1ce2b7,null))[_0xf27a('0x45')](handleError(_0x1ce2b7,null));};exports[_0xf27a('0x53')]=function(_0x597f00,_0x1a3048,_0x52d7f9){var _0x30c6b3={};var _0x3fa338={};var _0x469a90;var _0x1b6c53;return db[_0xf27a('0x2f')][_0xf27a('0x4f')]({'where':{'id':_0x597f00[_0xf27a('0x47')]['id']}})[_0xf27a('0x27')](handleEntityNotFound(_0x1a3048,null))[_0xf27a('0x27')](function(_0xc4e040){if(_0xc4e040){_0x469a90=_0xc4e040;_0x3fa338[_0xf27a('0x33')]=_[_0xf27a('0x35')](db[_0xf27a('0x50')][_0xf27a('0x48')]);_0x3fa338[_0xf27a('0x34')]=_[_0xf27a('0x35')](_0x597f00[_0xf27a('0x34')]);_0x3fa338[_0xf27a('0x36')]=_[_0xf27a('0x37')](_0x3fa338[_0xf27a('0x33')],_0x3fa338['query']);_0x30c6b3[_0xf27a('0x39')]=_[_0xf27a('0x37')](_0x3fa338[_0xf27a('0x33')],qs[_0xf27a('0x38')](_0x597f00[_0xf27a('0x34')][_0xf27a('0x38')]));_0x30c6b3[_0xf27a('0x39')]=_0x30c6b3[_0xf27a('0x39')][_0xf27a('0x3a')]?_0x30c6b3[_0xf27a('0x39')]:_0x3fa338[_0xf27a('0x33')];_0x30c6b3[_0xf27a('0x3c')]=qs[_0xf27a('0x51')](_0x597f00['query']['sort']);_0x30c6b3['where']=qs[_0xf27a('0x36')](_[_0xf27a('0x3e')](_0x597f00[_0xf27a('0x34')],_0x3fa338[_0xf27a('0x36')]));if(_0x597f00[_0xf27a('0x34')][_0xf27a('0x41')]){_0x30c6b3[_0xf27a('0x3d')]=_['merge'](_0x30c6b3[_0xf27a('0x3d')],{'$or':_[_0xf27a('0x2e')](_0x30c6b3['attributes'],function(_0x5f42c0){var _0x42bd4b={};_0x42bd4b[_0x5f42c0]={'$like':'%'+_0x597f00[_0xf27a('0x34')]['filter']+'%'};return _0x42bd4b;})});}_0x30c6b3=_[_0xf27a('0x3f')]({},_0x30c6b3,_0x597f00[_0xf27a('0x4a')]);return _0x469a90[_0xf27a('0x53')](_0x30c6b3);}})[_0xf27a('0x27')](function(_0x484cf9){if(_0x484cf9){_0x1b6c53=_0x484cf9['length'];if(!_0x597f00[_0xf27a('0x34')][_0xf27a('0x3b')](_0xf27a('0x52'))){_0x30c6b3[_0xf27a('0x20')]=qs[_0xf27a('0x20')](_0x597f00[_0xf27a('0x34')]['limit']);_0x30c6b3[_0xf27a('0x1f')]=qs[_0xf27a('0x1f')](_0x597f00[_0xf27a('0x34')][_0xf27a('0x1f')]);}return _0x469a90[_0xf27a('0x53')](_0x30c6b3);}})[_0xf27a('0x27')](function(_0x39c9de){if(_0x39c9de){return _0x39c9de?{'count':_0x1b6c53,'rows':_0x39c9de}:null;}})[_0xf27a('0x27')](respondWithResult(_0x1a3048,null))[_0xf27a('0x45')](handleError(_0x1a3048,null));};exports['getDescriptions']=function(_0x9baeab,_0x3c1889,_0x1352fe){var _0x4ef358={};var _0x2b8ccd={};var _0x2aa770;var _0x2f5407;return db[_0xf27a('0x2f')][_0xf27a('0x4f')]({'where':{'id':_0x9baeab[_0xf27a('0x47')]['id']}})[_0xf27a('0x27')](handleEntityNotFound(_0x3c1889,null))[_0xf27a('0x27')](function(_0x1aea10){if(_0x1aea10){_0x2aa770=_0x1aea10;_0x2b8ccd[_0xf27a('0x33')]=_[_0xf27a('0x35')](db[_0xf27a('0x50')][_0xf27a('0x48')]);_0x2b8ccd['query']=_[_0xf27a('0x35')](_0x9baeab[_0xf27a('0x34')]);_0x2b8ccd[_0xf27a('0x36')]=_[_0xf27a('0x37')](_0x2b8ccd[_0xf27a('0x33')],_0x2b8ccd[_0xf27a('0x34')]);_0x4ef358['attributes']=_[_0xf27a('0x37')](_0x2b8ccd[_0xf27a('0x33')],qs[_0xf27a('0x38')](_0x9baeab['query'][_0xf27a('0x38')]));_0x4ef358['attributes']=_0x4ef358[_0xf27a('0x39')]['length']?_0x4ef358[_0xf27a('0x39')]:_0x2b8ccd[_0xf27a('0x33')];_0x4ef358[_0xf27a('0x3c')]=qs[_0xf27a('0x51')](_0x9baeab[_0xf27a('0x34')][_0xf27a('0x51')]);_0x4ef358['where']=qs['filters'](_[_0xf27a('0x3e')](_0x9baeab['query'],_0x2b8ccd[_0xf27a('0x36')]));if(_0x9baeab[_0xf27a('0x34')][_0xf27a('0x41')]){_0x4ef358[_0xf27a('0x3d')]=_['merge'](_0x4ef358[_0xf27a('0x3d')],{'$or':_[_0xf27a('0x2e')](_0x4ef358[_0xf27a('0x39')],function(_0x4d40e8){var _0x324f6d={};_0x324f6d[_0x4d40e8]={'$like':'%'+_0x9baeab[_0xf27a('0x34')][_0xf27a('0x41')]+'%'};return _0x324f6d;})});}_0x4ef358=_[_0xf27a('0x3f')]({},_0x4ef358,_0x9baeab[_0xf27a('0x4a')]);return _0x2aa770[_0xf27a('0x54')](_0x4ef358);}})[_0xf27a('0x27')](function(_0x4b6793){if(_0x4b6793){_0x2f5407=_0x4b6793['length'];if(!_0x9baeab[_0xf27a('0x34')]['hasOwnProperty'](_0xf27a('0x52'))){_0x4ef358[_0xf27a('0x20')]=qs[_0xf27a('0x20')](_0x9baeab[_0xf27a('0x34')][_0xf27a('0x20')]);_0x4ef358[_0xf27a('0x1f')]=qs[_0xf27a('0x1f')](_0x9baeab['query'][_0xf27a('0x1f')]);}return _0x2aa770[_0xf27a('0x54')](_0x4ef358);}})['then'](function(_0x533d10){if(_0x533d10){return _0x533d10?{'count':_0x2f5407,'rows':_0x533d10}:null;}})[_0xf27a('0x27')](respondWithResult(_0x3c1889,null))[_0xf27a('0x45')](handleError(_0x3c1889,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9feba67..43eb64f 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 _0x03d5=['int_salesforce_configurations','util','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x03d5,0x1e5));var _0x503d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x503d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x503d('0x1'));var BPromise=require(_0x503d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x503d('0x3'));var rimraf=require(_0x503d('0x4'));var config=require(_0x503d('0x5'));var attributes=require(_0x503d('0x6'));module[_0x503d('0x7')]=function(_0xece949,_0x5ab0c1){return _0xece949[_0x503d('0x8')](_0x503d('0x9'),attributes,{'tableName':_0x503d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x415a=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2cee93,_0x135332){var _0x34588c=function(_0x34694f){while(--_0x34694f){_0x2cee93['push'](_0x2cee93['shift']());}};_0x34588c(++_0x135332);}(_0x415a,0x19f));var _0xa415=function(_0x278c50,_0x5458f3){_0x278c50=_0x278c50-0x0;var _0x4632a3=_0x415a[_0x278c50];return _0x4632a3;};'use strict';var _=require(_0xa415('0x0'));var util=require(_0xa415('0x1'));var logger=require(_0xa415('0x2'))(_0xa415('0x3'));var moment=require(_0xa415('0x4'));var BPromise=require(_0xa415('0x5'));var rp=require(_0xa415('0x6'));var fs=require('fs');var path=require(_0xa415('0x7'));var rimraf=require(_0xa415('0x8'));var config=require(_0xa415('0x9'));var attributes=require(_0xa415('0xa'));module['exports']=function(_0x384922,_0x4e0933){return _0x384922[_0xa415('0xb')](_0xa415('0xc'),attributes,{'tableName':_0xa415('0xd'),'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 755470a..d12b0b2 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 _0x8267=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x8267,0x1b6));var _0x7826=function(_0x5683e0,_0xfadf76){_0x5683e0=_0x5683e0-0x0;var _0x1e129b=_0x8267[_0x5683e0];return _0x1e129b;};'use strict';var _=require(_0x7826('0x0'));var util=require('util');var moment=require(_0x7826('0x1'));var BPromise=require(_0x7826('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7826('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7826('0x4'));var logger=require(_0x7826('0x5'))(_0x7826('0x6'));var config=require(_0x7826('0x7'));var jayson=require(_0x7826('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x234251,_0x1d008c,_0x3dadbf){return new BPromise(function(_0x3b6514,_0x3cce9f){return client[_0x7826('0x9')](_0x234251,_0x3dadbf)[_0x7826('0xa')](function(_0x239ea2){logger[_0x7826('0xb')](_0x7826('0xc'),_0x1d008c,'request\x20sent');logger[_0x7826('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1d008c,_0x7826('0xe'),JSON[_0x7826('0xf')](_0x239ea2));if(_0x239ea2[_0x7826('0x10')]){if(_0x239ea2[_0x7826('0x10')][_0x7826('0x11')]===0x1f4){logger['error'](_0x7826('0xc'),_0x1d008c,_0x239ea2[_0x7826('0x10')]['message']);return _0x3cce9f(_0x239ea2[_0x7826('0x10')][_0x7826('0x12')]);}logger[_0x7826('0x10')](_0x7826('0xc'),_0x1d008c,_0x239ea2[_0x7826('0x10')]['message']);return _0x3b6514(_0x239ea2[_0x7826('0x10')][_0x7826('0x12')]);}else{logger['info'](_0x7826('0xc'),_0x1d008c,_0x7826('0xe'));_0x3b6514(_0x239ea2[_0x7826('0x13')][_0x7826('0x12')]);}})['catch'](function(_0x19e1b0){logger[_0x7826('0x10')](_0x7826('0xc'),_0x1d008c,_0x19e1b0);_0x3cce9f(_0x19e1b0);});});} \ No newline at end of file +var _0x0ad3=['request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x1bb4ea,_0x3f648c){var _0x278b74=function(_0x10f175){while(--_0x10f175){_0x1bb4ea['push'](_0x1bb4ea['shift']());}};_0x278b74(++_0x3f648c);}(_0x0ad3,0xd2));var _0x30ad=function(_0x494690,_0x33ab0b){_0x494690=_0x494690-0x0;var _0x567af2=_0x0ad3[_0x494690];return _0x567af2;};'use strict';var _=require(_0x30ad('0x0'));var util=require(_0x30ad('0x1'));var moment=require(_0x30ad('0x2'));var BPromise=require(_0x30ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30ad('0x4'));var db=require(_0x30ad('0x5'))['db'];var utils=require(_0x30ad('0x6'));var logger=require(_0x30ad('0x7'))(_0x30ad('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x30ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x599558,_0x4af616,_0xa43ce8){return new BPromise(function(_0x235a83,_0x459ddd){return client[_0x30ad('0xa')](_0x599558,_0xa43ce8)['then'](function(_0xc9da8b){logger[_0x30ad('0xb')](_0x30ad('0xc'),_0x4af616,'request\x20sent');logger[_0x30ad('0xd')](_0x30ad('0xe'),_0x4af616,_0x30ad('0xf'),JSON['stringify'](_0xc9da8b));if(_0xc9da8b[_0x30ad('0x10')]){if(_0xc9da8b['error']['code']===0x1f4){logger[_0x30ad('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4af616,_0xc9da8b[_0x30ad('0x10')][_0x30ad('0x11')]);return _0x459ddd(_0xc9da8b[_0x30ad('0x10')][_0x30ad('0x11')]);}logger[_0x30ad('0x10')](_0x30ad('0xc'),_0x4af616,_0xc9da8b[_0x30ad('0x10')][_0x30ad('0x11')]);return _0x235a83(_0xc9da8b[_0x30ad('0x10')][_0x30ad('0x11')]);}else{logger['info'](_0x30ad('0xc'),_0x4af616,'request\x20sent');_0x235a83(_0xc9da8b[_0x30ad('0x12')][_0x30ad('0x11')]);}})[_0x30ad('0x13')](function(_0x3a3905){logger[_0x30ad('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4af616,_0x3a3905);_0x459ddd(_0x3a3905);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 166264f..4029cec 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 _0x20f9=['destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','post','create','delete','/:id'];(function(_0xfb2f6a,_0x46730c){var _0x3b4af9=function(_0x3fc17d){while(--_0x3fc17d){_0xfb2f6a['push'](_0xfb2f6a['shift']());}};_0x3b4af9(++_0x46730c);}(_0x20f9,0xf2));var _0x920f=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x20f9[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x920f('0x0'));var util=require('util');var path=require(_0x920f('0x1'));var timeout=require('connect-timeout');var express=require(_0x920f('0x2'));var router=express[_0x920f('0x3')]();var fs_extra=require(_0x920f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x920f('0x5'));var controller=require(_0x920f('0x6'));router[_0x920f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x920f('0x8')](),controller['show']);router[_0x920f('0x9')]('/',auth[_0x920f('0x8')](),controller[_0x920f('0xa')]);router['put']('/:id',auth[_0x920f('0x8')](),controller['update']);router[_0x920f('0xb')](_0x920f('0xc'),auth['isAuthenticated'](),controller[_0x920f('0xd')]);module[_0x920f('0xe')]=router; \ No newline at end of file +var _0x0719=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0719,0x14d));var _0x9071=function(_0x1be6f9,_0x5f58bd){_0x1be6f9=_0x1be6f9-0x0;var _0x14ff6f=_0x0719[_0x1be6f9];return _0x14ff6f;};'use strict';var multer=require('multer');var util=require(_0x9071('0x0'));var path=require(_0x9071('0x1'));var timeout=require('connect-timeout');var express=require(_0x9071('0x2'));var router=express[_0x9071('0x3')]();var fs_extra=require(_0x9071('0x4'));var auth=require(_0x9071('0x5'));var interaction=require(_0x9071('0x6'));var config=require(_0x9071('0x7'));var controller=require(_0x9071('0x8'));router['get']('/',auth[_0x9071('0x9')](),controller[_0x9071('0xa')]);router['get']('/:id',auth[_0x9071('0x9')](),controller['show']);router[_0x9071('0xb')]('/',auth[_0x9071('0x9')](),controller[_0x9071('0xc')]);router[_0x9071('0xd')](_0x9071('0xe'),auth[_0x9071('0x9')](),controller[_0x9071('0xf')]);router[_0x9071('0x10')](_0x9071('0xe'),auth[_0x9071('0x9')](),controller[_0x9071('0x11')]);module[_0x9071('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 245dd46..72c4307 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 _0xdee3=['keyValue','STRING','ENUM','variable','customVariable','sequelize','exports','string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdee3,0x14d));var _0x3dee=function(_0x46eb71,_0x1ac82d){_0x46eb71=_0x46eb71-0x0;var _0x14f47b=_0xdee3[_0x46eb71];return _0x14f47b;};'use strict';var Sequelize=require(_0x3dee('0x0'));module[_0x3dee('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3dee('0x2'),'variable','customVariable',_0x3dee('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3dee('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3dee('0x5')](_0x3dee('0x2'),_0x3dee('0x6'),_0x3dee('0x7'))},'keyContent':{'type':Sequelize[_0x3dee('0x4')]},'idField':{'type':Sequelize[_0x3dee('0x4')]},'variableName':{'type':Sequelize[_0x3dee('0x4')]}}; \ No newline at end of file +var _0x9691=['variable','sequelize','exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x9691,0x1b9));var _0x1969=function(_0x407601,_0x52939f){_0x407601=_0x407601-0x0;var _0x224d89=_0x9691[_0x407601];return _0x224d89;};'use strict';var Sequelize=require(_0x1969('0x0'));module[_0x1969('0x1')]={'type':{'type':Sequelize[_0x1969('0x2')](_0x1969('0x3'),'variable',_0x1969('0x4'),'keyValue',_0x1969('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1969('0x6')]},'key':{'type':Sequelize[_0x1969('0x6')]},'keyType':{'type':Sequelize[_0x1969('0x2')]('string',_0x1969('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x1969('0x6')]},'idField':{'type':Sequelize[_0x1969('0x6')]},'variableName':{'type':Sequelize[_0x1969('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 40e4085..27e6fb3 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 _0x8313=['bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','order','sort','where','filters','filter','merge','VIRTUAL','options','SalesforceField','count','includeAll','include','findAll','rows','catch','length','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8313,0x1ac));var _0x3831=function(_0x464d00,_0x9867bf){_0x464d00=_0x464d00-0x0;var _0x334ae6=_0x8313[_0x464d00];return _0x334ae6;};'use strict';var emlformat=require(_0x3831('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3831('0x1'));var jsonpatch=require(_0x3831('0x2'));var rp=require(_0x3831('0x3'));var moment=require('moment');var BPromise=require(_0x3831('0x4'));var Mustache=require(_0x3831('0x5'));var util=require('util');var path=require(_0x3831('0x6'));var sox=require(_0x3831('0x7'));var csv=require(_0x3831('0x8'));var ejs=require(_0x3831('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3831('0xa'));var squel=require('squel');var crypto=require(_0x3831('0xb'));var jsforce=require(_0x3831('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3831('0x8'));var querystring=require(_0x3831('0xd'));var Papa=require('papaparse');var Redis=require(_0x3831('0xe'));var authService=require(_0x3831('0xf'));var qs=require(_0x3831('0x10'));var as=require(_0x3831('0x11'));var hardwareService=require(_0x3831('0x12'));var logger=require('../../config/logger')(_0x3831('0x13'));var utils=require(_0x3831('0x14'));var config=require(_0x3831('0x15'));var licenseUtil=require(_0x3831('0x16'));var db=require(_0x3831('0x17'))['db'];function respondWithStatusCode(_0xc29db7,_0xc278e7){_0xc278e7=_0xc278e7||0xcc;return function(_0x2621f0){if(_0x2621f0){return _0xc29db7[_0x3831('0x18')](_0xc278e7);}return _0xc29db7[_0x3831('0x19')](_0xc278e7)['end']();};}function respondWithResult(_0x5ad082,_0x55e324){_0x55e324=_0x55e324||0xc8;return function(_0x11f778){if(_0x11f778){return _0x5ad082[_0x3831('0x19')](_0x55e324)[_0x3831('0x1a')](_0x11f778);}};}function respondWithFilteredResult(_0x56c9cc,_0x1b5560){return function(_0x3034be){if(_0x3034be){var _0x5b1997=typeof _0x1b5560[_0x3831('0x1b')]===_0x3831('0x1c')&&typeof _0x1b5560[_0x3831('0x1d')]==='undefined';var _0x58c4a8=_0x3034be['count'];var _0x5c13f0=_0x5b1997?0x0:_0x1b5560['offset'];var _0x5eba91=_0x5b1997?_0x3034be['count']:_0x1b5560[_0x3831('0x1b')]+_0x1b5560['limit'];var _0x46d7fc;if(_0x5eba91>=_0x58c4a8){_0x5eba91=_0x58c4a8;_0x46d7fc=0xc8;}else{_0x46d7fc=0xce;}_0x56c9cc[_0x3831('0x19')](_0x46d7fc);return _0x56c9cc[_0x3831('0x1e')](_0x3831('0x1f'),_0x5c13f0+'-'+_0x5eba91+'/'+_0x58c4a8)[_0x3831('0x1a')](_0x3034be);}return null;};}function patchUpdates(_0x46c138){return function(_0x10d6e0){try{jsonpatch[_0x3831('0x20')](_0x10d6e0,_0x46c138,!![]);}catch(_0x4e1446){return BPromise[_0x3831('0x21')](_0x4e1446);}return _0x10d6e0[_0x3831('0x22')]();};}function saveUpdates(_0x3914bc,_0x50d1d2){return function(_0x211b0e){if(_0x211b0e){return _0x211b0e[_0x3831('0x23')](_0x3914bc)[_0x3831('0x24')](function(_0x299744){return _0x299744;});}return null;};}function removeEntity(_0x304a51,_0x20ed81){return function(_0x13e06d){if(_0x13e06d){return _0x13e06d[_0x3831('0x25')]()['then'](function(){_0x304a51[_0x3831('0x19')](0xcc)[_0x3831('0x26')]();});}};}function handleEntityNotFound(_0x400209,_0x341772){return function(_0x3842fc){if(!_0x3842fc){_0x400209[_0x3831('0x18')](0x194);}return _0x3842fc;};}function handleError(_0x41be14,_0x6de24c){_0x6de24c=_0x6de24c||0x1f4;return function(_0x3ff788){logger['error'](_0x3ff788['stack']);if(_0x3ff788[_0x3831('0x27')]){delete _0x3ff788[_0x3831('0x27')];}_0x41be14['status'](_0x6de24c)['send'](_0x3ff788);};}exports[_0x3831('0x28')]=function(_0x5ad269,_0x19f432){var _0x120bbc={},_0x2d50f8={},_0x2c0c91={'count':0x0,'rows':[]};var _0x4e1119=_[_0x3831('0x29')](db['SalesforceField'][_0x3831('0x2a')],function(_0x536041){return{'name':_0x536041[_0x3831('0x2b')],'type':_0x536041[_0x3831('0x2c')][_0x3831('0x2d')]};});_0x2d50f8['model']=_[_0x3831('0x29')](_0x4e1119,_0x3831('0x27'));_0x2d50f8[_0x3831('0x2e')]=_[_0x3831('0x2f')](_0x5ad269[_0x3831('0x2e')]);_0x2d50f8['filters']=_[_0x3831('0x30')](_0x2d50f8[_0x3831('0x31')],_0x2d50f8[_0x3831('0x2e')]);_0x120bbc['attributes']=_[_0x3831('0x30')](_0x2d50f8[_0x3831('0x31')],qs[_0x3831('0x32')](_0x5ad269[_0x3831('0x2e')][_0x3831('0x32')]));_0x120bbc[_0x3831('0x33')]=_0x120bbc[_0x3831('0x33')]['length']?_0x120bbc[_0x3831('0x33')]:_0x2d50f8[_0x3831('0x31')];if(!_0x5ad269[_0x3831('0x2e')]['hasOwnProperty']('nolimit')){_0x120bbc[_0x3831('0x1d')]=qs['limit'](_0x5ad269[_0x3831('0x2e')][_0x3831('0x1d')]);_0x120bbc[_0x3831('0x1b')]=qs[_0x3831('0x1b')](_0x5ad269['query']['offset']);}_0x120bbc[_0x3831('0x34')]=qs[_0x3831('0x35')](_0x5ad269['query']['sort']);_0x120bbc[_0x3831('0x36')]=qs[_0x3831('0x37')](_['pick'](_0x5ad269[_0x3831('0x2e')],_0x2d50f8['filters']),_0x4e1119);if(_0x5ad269['query'][_0x3831('0x38')]){_0x120bbc[_0x3831('0x36')]=_[_0x3831('0x39')](_0x120bbc[_0x3831('0x36')],{'$or':_[_0x3831('0x29')](_0x4e1119,function(_0x47e1f0){if(_0x47e1f0[_0x3831('0x2c')]!==_0x3831('0x3a')){var _0x1c1e3c={};_0x1c1e3c[_0x47e1f0[_0x3831('0x27')]]={'$like':'%'+_0x5ad269[_0x3831('0x2e')][_0x3831('0x38')]+'%'};return _0x1c1e3c;}})});}_0x120bbc=_[_0x3831('0x39')]({},_0x120bbc,_0x5ad269[_0x3831('0x3b')]);var _0x48537b={'where':_0x120bbc['where']};return db[_0x3831('0x3c')]['count'](_0x48537b)[_0x3831('0x24')](function(_0x38b61b){_0x2c0c91[_0x3831('0x3d')]=_0x38b61b;if(_0x5ad269[_0x3831('0x2e')][_0x3831('0x3e')]){_0x120bbc[_0x3831('0x3f')]=[{'all':!![]}];}return db[_0x3831('0x3c')][_0x3831('0x40')](_0x120bbc);})[_0x3831('0x24')](function(_0xb2ce19){_0x2c0c91[_0x3831('0x41')]=_0xb2ce19;return _0x2c0c91;})['then'](respondWithFilteredResult(_0x19f432,_0x120bbc))[_0x3831('0x42')](handleError(_0x19f432,null));};exports['show']=function(_0x2c76bc,_0xb2276){var _0x316ea2={'raw':!![],'where':{'id':_0x2c76bc['params']['id']}},_0x303ffd={};_0x303ffd[_0x3831('0x31')]=_[_0x3831('0x2f')](db[_0x3831('0x3c')][_0x3831('0x2a')]);_0x303ffd[_0x3831('0x2e')]=_[_0x3831('0x2f')](_0x2c76bc[_0x3831('0x2e')]);_0x303ffd['filters']=_['intersection'](_0x303ffd[_0x3831('0x31')],_0x303ffd[_0x3831('0x2e')]);_0x316ea2['attributes']=_['intersection'](_0x303ffd[_0x3831('0x31')],qs[_0x3831('0x32')](_0x2c76bc[_0x3831('0x2e')][_0x3831('0x32')]));_0x316ea2[_0x3831('0x33')]=_0x316ea2[_0x3831('0x33')][_0x3831('0x43')]?_0x316ea2[_0x3831('0x33')]:_0x303ffd['model'];if(_0x2c76bc[_0x3831('0x2e')][_0x3831('0x3e')]){_0x316ea2[_0x3831('0x3f')]=[{'all':!![]}];}_0x316ea2=_[_0x3831('0x39')]({},_0x316ea2,_0x2c76bc['options']);return db[_0x3831('0x3c')]['find'](_0x316ea2)[_0x3831('0x24')](handleEntityNotFound(_0xb2276,null))[_0x3831('0x24')](respondWithResult(_0xb2276,null))[_0x3831('0x42')](handleError(_0xb2276,null));};exports[_0x3831('0x44')]=function(_0x1bfd02,_0x5c7809){return db['SalesforceField']['create'](_0x1bfd02[_0x3831('0x45')],{})['then'](respondWithResult(_0x5c7809,0xc9))[_0x3831('0x42')](handleError(_0x5c7809,null));};exports[_0x3831('0x23')]=function(_0x4ad258,_0x5e5a7d){if(_0x4ad258[_0x3831('0x45')]['id']){delete _0x4ad258['body']['id'];}return db['SalesforceField'][_0x3831('0x46')]({'where':{'id':_0x4ad258[_0x3831('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e5a7d,null))[_0x3831('0x24')](saveUpdates(_0x4ad258['body'],null))['then'](respondWithResult(_0x5e5a7d,null))[_0x3831('0x42')](handleError(_0x5e5a7d,null));};exports[_0x3831('0x25')]=function(_0x968255,_0x40f1c0){return db[_0x3831('0x3c')][_0x3831('0x46')]({'where':{'id':_0x968255[_0x3831('0x47')]['id']}})['then'](handleEntityNotFound(_0x40f1c0,null))['then'](removeEntity(_0x40f1c0,null))[_0x3831('0x42')](handleError(_0x40f1c0,null));}; \ No newline at end of file +var _0xfcc7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','SalesforceField','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x52ba4d,_0x1c098e){var _0x5a0e8a=function(_0x1fe5f){while(--_0x1fe5f){_0x52ba4d['push'](_0x52ba4d['shift']());}};_0x5a0e8a(++_0x1c098e);}(_0xfcc7,0x164));var _0x7fcc=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0xfcc7[_0x35b195];return _0x2433bf;};'use strict';var emlformat=require(_0x7fcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fcc('0x1'));var jsonpatch=require(_0x7fcc('0x2'));var rp=require('request-promise');var moment=require(_0x7fcc('0x3'));var BPromise=require(_0x7fcc('0x4'));var Mustache=require(_0x7fcc('0x5'));var util=require('util');var path=require(_0x7fcc('0x6'));var sox=require(_0x7fcc('0x7'));var csv=require(_0x7fcc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fcc('0x9'));var _=require(_0x7fcc('0xa'));var squel=require(_0x7fcc('0xb'));var crypto=require('crypto');var jsforce=require(_0x7fcc('0xc'));var deskjs=require(_0x7fcc('0xd'));var toCsv=require(_0x7fcc('0x8'));var querystring=require(_0x7fcc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fcc('0xf'));var qs=require(_0x7fcc('0x10'));var as=require(_0x7fcc('0x11'));var hardwareService=require(_0x7fcc('0x12'));var logger=require(_0x7fcc('0x13'))(_0x7fcc('0x14'));var utils=require(_0x7fcc('0x15'));var config=require(_0x7fcc('0x16'));var licenseUtil=require(_0x7fcc('0x17'));var db=require(_0x7fcc('0x18'))['db'];function respondWithStatusCode(_0x460d78,_0x5e041f){_0x5e041f=_0x5e041f||0xcc;return function(_0x3a58be){if(_0x3a58be){return _0x460d78[_0x7fcc('0x19')](_0x5e041f);}return _0x460d78[_0x7fcc('0x1a')](_0x5e041f)[_0x7fcc('0x1b')]();};}function respondWithResult(_0x2eb98b,_0x25b897){_0x25b897=_0x25b897||0xc8;return function(_0x1a80b9){if(_0x1a80b9){return _0x2eb98b[_0x7fcc('0x1a')](_0x25b897)[_0x7fcc('0x1c')](_0x1a80b9);}};}function respondWithFilteredResult(_0x337555,_0x26a562){return function(_0x44d52e){if(_0x44d52e){var _0x394bcf=typeof _0x26a562[_0x7fcc('0x1d')]===_0x7fcc('0x1e')&&typeof _0x26a562[_0x7fcc('0x1f')]===_0x7fcc('0x1e');var _0x5e9212=_0x44d52e['count'];var _0x531fbf=_0x394bcf?0x0:_0x26a562[_0x7fcc('0x1d')];var _0x2ad022=_0x394bcf?_0x44d52e[_0x7fcc('0x20')]:_0x26a562[_0x7fcc('0x1d')]+_0x26a562[_0x7fcc('0x1f')];var _0x373436;if(_0x2ad022>=_0x5e9212){_0x2ad022=_0x5e9212;_0x373436=0xc8;}else{_0x373436=0xce;}_0x337555['status'](_0x373436);return _0x337555[_0x7fcc('0x21')](_0x7fcc('0x22'),_0x531fbf+'-'+_0x2ad022+'/'+_0x5e9212)['json'](_0x44d52e);}return null;};}function patchUpdates(_0xeb38bb){return function(_0x506d2e){try{jsonpatch[_0x7fcc('0x23')](_0x506d2e,_0xeb38bb,!![]);}catch(_0x280df9){return BPromise[_0x7fcc('0x24')](_0x280df9);}return _0x506d2e['save']();};}function saveUpdates(_0x380ca2,_0x171223){return function(_0xd76102){if(_0xd76102){return _0xd76102['update'](_0x380ca2)[_0x7fcc('0x25')](function(_0x63a69){return _0x63a69;});}return null;};}function removeEntity(_0x57f406,_0x49d7ad){return function(_0x4e2ebc){if(_0x4e2ebc){return _0x4e2ebc['destroy']()[_0x7fcc('0x25')](function(){_0x57f406[_0x7fcc('0x1a')](0xcc)[_0x7fcc('0x1b')]();});}};}function handleEntityNotFound(_0x2608b7,_0x63aff4){return function(_0x792b8f){if(!_0x792b8f){_0x2608b7[_0x7fcc('0x19')](0x194);}return _0x792b8f;};}function handleError(_0x487260,_0x53f63b){_0x53f63b=_0x53f63b||0x1f4;return function(_0x1d5b96){logger[_0x7fcc('0x26')](_0x1d5b96[_0x7fcc('0x27')]);if(_0x1d5b96[_0x7fcc('0x28')]){delete _0x1d5b96[_0x7fcc('0x28')];}_0x487260[_0x7fcc('0x1a')](_0x53f63b)[_0x7fcc('0x29')](_0x1d5b96);};}exports[_0x7fcc('0x2a')]=function(_0x4c08ae,_0x182338){var _0x1f3c04={},_0x456e55={},_0xec56d8={'count':0x0,'rows':[]};var _0x3cefc0=_['map'](db[_0x7fcc('0x2b')]['rawAttributes'],function(_0xdf40cf){return{'name':_0xdf40cf[_0x7fcc('0x2c')],'type':_0xdf40cf['type'][_0x7fcc('0x2d')]};});_0x456e55[_0x7fcc('0x2e')]=_[_0x7fcc('0x2f')](_0x3cefc0,_0x7fcc('0x28'));_0x456e55[_0x7fcc('0x30')]=_[_0x7fcc('0x31')](_0x4c08ae[_0x7fcc('0x30')]);_0x456e55[_0x7fcc('0x32')]=_[_0x7fcc('0x33')](_0x456e55[_0x7fcc('0x2e')],_0x456e55['query']);_0x1f3c04[_0x7fcc('0x34')]=_[_0x7fcc('0x33')](_0x456e55[_0x7fcc('0x2e')],qs[_0x7fcc('0x35')](_0x4c08ae[_0x7fcc('0x30')][_0x7fcc('0x35')]));_0x1f3c04[_0x7fcc('0x34')]=_0x1f3c04['attributes'][_0x7fcc('0x36')]?_0x1f3c04['attributes']:_0x456e55[_0x7fcc('0x2e')];if(!_0x4c08ae[_0x7fcc('0x30')]['hasOwnProperty'](_0x7fcc('0x37'))){_0x1f3c04['limit']=qs[_0x7fcc('0x1f')](_0x4c08ae['query'][_0x7fcc('0x1f')]);_0x1f3c04['offset']=qs[_0x7fcc('0x1d')](_0x4c08ae[_0x7fcc('0x30')][_0x7fcc('0x1d')]);}_0x1f3c04[_0x7fcc('0x38')]=qs['sort'](_0x4c08ae[_0x7fcc('0x30')][_0x7fcc('0x39')]);_0x1f3c04['where']=qs[_0x7fcc('0x32')](_['pick'](_0x4c08ae['query'],_0x456e55[_0x7fcc('0x32')]),_0x3cefc0);if(_0x4c08ae[_0x7fcc('0x30')][_0x7fcc('0x3a')]){_0x1f3c04[_0x7fcc('0x3b')]=_['merge'](_0x1f3c04[_0x7fcc('0x3b')],{'$or':_[_0x7fcc('0x2f')](_0x3cefc0,function(_0x4dcef4){if(_0x4dcef4[_0x7fcc('0x3c')]!==_0x7fcc('0x3d')){var _0x44dab9={};_0x44dab9[_0x4dcef4[_0x7fcc('0x28')]]={'$like':'%'+_0x4c08ae['query'][_0x7fcc('0x3a')]+'%'};return _0x44dab9;}})});}_0x1f3c04=_[_0x7fcc('0x3e')]({},_0x1f3c04,_0x4c08ae['options']);var _0xc95e98={'where':_0x1f3c04[_0x7fcc('0x3b')]};return db[_0x7fcc('0x2b')][_0x7fcc('0x20')](_0xc95e98)[_0x7fcc('0x25')](function(_0x5aafa4){_0xec56d8[_0x7fcc('0x20')]=_0x5aafa4;if(_0x4c08ae['query'][_0x7fcc('0x3f')]){_0x1f3c04[_0x7fcc('0x40')]=[{'all':!![]}];}return db[_0x7fcc('0x2b')][_0x7fcc('0x41')](_0x1f3c04);})['then'](function(_0x5d1b83){_0xec56d8[_0x7fcc('0x42')]=_0x5d1b83;return _0xec56d8;})['then'](respondWithFilteredResult(_0x182338,_0x1f3c04))[_0x7fcc('0x43')](handleError(_0x182338,null));};exports[_0x7fcc('0x44')]=function(_0x4ee790,_0x2dede0){var _0x5d52b6={'raw':!![],'where':{'id':_0x4ee790[_0x7fcc('0x45')]['id']}},_0x241cec={};_0x241cec[_0x7fcc('0x2e')]=_[_0x7fcc('0x31')](db[_0x7fcc('0x2b')]['rawAttributes']);_0x241cec[_0x7fcc('0x30')]=_[_0x7fcc('0x31')](_0x4ee790[_0x7fcc('0x30')]);_0x241cec['filters']=_[_0x7fcc('0x33')](_0x241cec[_0x7fcc('0x2e')],_0x241cec[_0x7fcc('0x30')]);_0x5d52b6[_0x7fcc('0x34')]=_[_0x7fcc('0x33')](_0x241cec[_0x7fcc('0x2e')],qs[_0x7fcc('0x35')](_0x4ee790['query']['fields']));_0x5d52b6[_0x7fcc('0x34')]=_0x5d52b6[_0x7fcc('0x34')]['length']?_0x5d52b6[_0x7fcc('0x34')]:_0x241cec['model'];if(_0x4ee790[_0x7fcc('0x30')][_0x7fcc('0x3f')]){_0x5d52b6['include']=[{'all':!![]}];}_0x5d52b6=_[_0x7fcc('0x3e')]({},_0x5d52b6,_0x4ee790['options']);return db['SalesforceField'][_0x7fcc('0x46')](_0x5d52b6)[_0x7fcc('0x25')](handleEntityNotFound(_0x2dede0,null))[_0x7fcc('0x25')](respondWithResult(_0x2dede0,null))['catch'](handleError(_0x2dede0,null));};exports[_0x7fcc('0x47')]=function(_0x2a99f2,_0x16a9ec){return db[_0x7fcc('0x2b')][_0x7fcc('0x47')](_0x2a99f2[_0x7fcc('0x48')],{})[_0x7fcc('0x25')](respondWithResult(_0x16a9ec,0xc9))[_0x7fcc('0x43')](handleError(_0x16a9ec,null));};exports[_0x7fcc('0x49')]=function(_0x36ef70,_0xc4c96d){if(_0x36ef70[_0x7fcc('0x48')]['id']){delete _0x36ef70[_0x7fcc('0x48')]['id'];}return db[_0x7fcc('0x2b')][_0x7fcc('0x46')]({'where':{'id':_0x36ef70['params']['id']}})[_0x7fcc('0x25')](handleEntityNotFound(_0xc4c96d,null))['then'](saveUpdates(_0x36ef70['body'],null))['then'](respondWithResult(_0xc4c96d,null))[_0x7fcc('0x43')](handleError(_0xc4c96d,null));};exports[_0x7fcc('0x4a')]=function(_0x28edcb,_0x365753){return db['SalesforceField'][_0x7fcc('0x46')]({'where':{'id':_0x28edcb['params']['id']}})[_0x7fcc('0x25')](handleEntityNotFound(_0x365753,null))[_0x7fcc('0x25')](removeEntity(_0x365753,null))['catch'](handleError(_0x365753,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7db5340..6413164 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 _0xd88a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','idField','FieldId','util','../../config/logger'];(function(_0xa3540a,_0x4b8240){var _0x308ff2=function(_0x53b3f6){while(--_0x53b3f6){_0xa3540a['push'](_0xa3540a['shift']());}};_0x308ff2(++_0x4b8240);}(_0xd88a,0x129));var _0xad88=function(_0x3fb5f9,_0xa4c2d9){_0x3fb5f9=_0x3fb5f9-0x0;var _0x541745=_0xd88a[_0x3fb5f9];return _0x541745;};'use strict';var _=require('lodash');var util=require(_0xad88('0x0'));var logger=require(_0xad88('0x1'))(_0xad88('0x2'));var moment=require('moment');var BPromise=require(_0xad88('0x3'));var rp=require(_0xad88('0x4'));var fs=require('fs');var path=require(_0xad88('0x5'));var rimraf=require(_0xad88('0x6'));var config=require(_0xad88('0x7'));var attributes=require(_0xad88('0x8'));module['exports']=function(_0x27adbf,_0x70d707){return _0x27adbf['define'](_0xad88('0x9'),attributes,{'tableName':_0xad88('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xad88('0xb'),_0xad88('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6c3=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0xa6c3,0x18f));var _0x3a6c=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xa6c3[_0x365be9];return _0x185c12;};'use strict';var _=require(_0x3a6c('0x0'));var util=require(_0x3a6c('0x1'));var logger=require(_0x3a6c('0x2'))(_0x3a6c('0x3'));var moment=require(_0x3a6c('0x4'));var BPromise=require(_0x3a6c('0x5'));var rp=require(_0x3a6c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a6c('0x7'));var config=require(_0x3a6c('0x8'));var attributes=require(_0x3a6c('0x9'));module[_0x3a6c('0xa')]=function(_0x3683f0,_0x3e9e1a){return _0x3683f0[_0x3a6c('0xb')](_0x3a6c('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3a6c('0xd'),'fields':[_0x3a6c('0xe'),'FieldId'],'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 18a7549..0bbc69d 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 _0x8d41=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8d41,0x1b1));var _0x18d4=function(_0x436827,_0x570104){_0x436827=_0x436827-0x0;var _0x22434d=_0x8d41[_0x436827];return _0x22434d;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var Redis=require(_0x18d4('0x5'));var db=require(_0x18d4('0x6'))['db'];var utils=require(_0x18d4('0x7'));var logger=require(_0x18d4('0x8'))(_0x18d4('0x9'));var config=require('../../config/environment');var jayson=require(_0x18d4('0xa'));var client=jayson[_0x18d4('0xb')][_0x18d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f5d53,_0x1d9b8e,_0x4fea98){return new BPromise(function(_0x136b9c,_0x16f71c){return client[_0x18d4('0xd')](_0x4f5d53,_0x4fea98)[_0x18d4('0xe')](function(_0x502d6b){logger[_0x18d4('0xf')](_0x18d4('0x10'),_0x1d9b8e,_0x18d4('0x11'));logger[_0x18d4('0x12')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1d9b8e,_0x18d4('0x11'),JSON[_0x18d4('0x13')](_0x502d6b));if(_0x502d6b[_0x18d4('0x14')]){if(_0x502d6b[_0x18d4('0x14')][_0x18d4('0x15')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1d9b8e,_0x502d6b[_0x18d4('0x14')][_0x18d4('0x16')]);return _0x16f71c(_0x502d6b[_0x18d4('0x14')][_0x18d4('0x16')]);}logger[_0x18d4('0x14')](_0x18d4('0x10'),_0x1d9b8e,_0x502d6b[_0x18d4('0x14')][_0x18d4('0x16')]);return _0x136b9c(_0x502d6b[_0x18d4('0x14')][_0x18d4('0x16')]);}else{logger['info'](_0x18d4('0x10'),_0x1d9b8e,'request\x20sent');_0x136b9c(_0x502d6b[_0x18d4('0x17')][_0x18d4('0x16')]);}})[_0x18d4('0x18')](function(_0x4a99d0){logger[_0x18d4('0x14')](_0x18d4('0x10'),_0x1d9b8e,_0x4a99d0);_0x16f71c(_0x4a99d0);});});} \ No newline at end of file +var _0xf7f5=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','catch','lodash','moment'];(function(_0x30d14d,_0x5b7cdc){var _0x47054e=function(_0x3535f2){while(--_0x3535f2){_0x30d14d['push'](_0x30d14d['shift']());}};_0x47054e(++_0x5b7cdc);}(_0xf7f5,0x1cc));var _0x5f7f=function(_0x37c761,_0x2b8c56){_0x37c761=_0x37c761-0x0;var _0x4a07c2=_0xf7f5[_0x37c761];return _0x4a07c2;};'use strict';var _=require(_0x5f7f('0x0'));var util=require('util');var moment=require(_0x5f7f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f7f('0x2'));var fs=require('fs');var Redis=require(_0x5f7f('0x3'));var db=require(_0x5f7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f7f('0x5'))(_0x5f7f('0x6'));var config=require(_0x5f7f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5f7f('0x8')][_0x5f7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438d9d,_0x475687,_0x24716d){return new BPromise(function(_0x36a2bf,_0x5c720c){return client[_0x5f7f('0xa')](_0x438d9d,_0x24716d)[_0x5f7f('0xb')](function(_0x3d951b){logger[_0x5f7f('0xc')]('SalesforceField,\x20%s,\x20%s',_0x475687,_0x5f7f('0xd'));logger[_0x5f7f('0xe')](_0x5f7f('0xf'),_0x475687,'request\x20sent',JSON[_0x5f7f('0x10')](_0x3d951b));if(_0x3d951b[_0x5f7f('0x11')]){if(_0x3d951b[_0x5f7f('0x11')][_0x5f7f('0x12')]===0x1f4){logger[_0x5f7f('0x11')](_0x5f7f('0x13'),_0x475687,_0x3d951b[_0x5f7f('0x11')][_0x5f7f('0x14')]);return _0x5c720c(_0x3d951b[_0x5f7f('0x11')]['message']);}logger[_0x5f7f('0x11')](_0x5f7f('0x13'),_0x475687,_0x3d951b['error'][_0x5f7f('0x14')]);return _0x36a2bf(_0x3d951b[_0x5f7f('0x11')][_0x5f7f('0x14')]);}else{logger[_0x5f7f('0xc')](_0x5f7f('0x13'),_0x475687,'request\x20sent');_0x36a2bf(_0x3d951b['result'][_0x5f7f('0x14')]);}})[_0x5f7f('0x15')](function(_0x16c5dc){logger[_0x5f7f('0x11')](_0x5f7f('0x13'),_0x475687,_0x16c5dc);_0x5c720c(_0x16c5dc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6a9289c..e015f62 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 _0xa03f=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show'];(function(_0xc39580,_0x3f2edc){var _0x4284d0=function(_0x3b66c8){while(--_0x3b66c8){_0xc39580['push'](_0xc39580['shift']());}};_0x4284d0(++_0x3f2edc);}(_0xa03f,0x1ce));var _0xfa03=function(_0x41ae3d,_0x550d8e){_0x41ae3d=_0x41ae3d-0x0;var _0x4a4497=_0xa03f[_0x41ae3d];return _0x4a4497;};'use strict';var multer=require(_0xfa03('0x0'));var util=require(_0xfa03('0x1'));var path=require(_0xfa03('0x2'));var timeout=require(_0xfa03('0x3'));var express=require('express');var router=express[_0xfa03('0x4')]();var fs_extra=require(_0xfa03('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfa03('0x6'));var config=require(_0xfa03('0x7'));var controller=require(_0xfa03('0x8'));router[_0xfa03('0x9')]('/',auth[_0xfa03('0xa')](),controller[_0xfa03('0xb')]);router[_0xfa03('0x9')]('/:id',auth[_0xfa03('0xa')](),controller[_0xfa03('0xc')]);router[_0xfa03('0x9')](_0xfa03('0xd'),auth[_0xfa03('0xa')](),controller[_0xfa03('0xe')]);router[_0xfa03('0x9')](_0xfa03('0xf'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x10')]);router[_0xfa03('0x11')]('/',auth[_0xfa03('0xa')](),controller[_0xfa03('0x12')]);router['post'](_0xfa03('0xd'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x13')]);router[_0xfa03('0x14')](_0xfa03('0x15'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x16')]);router[_0xfa03('0x17')](_0xfa03('0x15'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0f45=['/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','post','create'];(function(_0x5a8795,_0x462f13){var _0x140a4e=function(_0x35ae00){while(--_0x35ae00){_0x5a8795['push'](_0x5a8795['shift']());}};_0x140a4e(++_0x462f13);}(_0x0f45,0x7f));var _0x50f4=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x0f45[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x50f4('0x0'));var util=require(_0x50f4('0x1'));var path=require(_0x50f4('0x2'));var timeout=require(_0x50f4('0x3'));var express=require(_0x50f4('0x4'));var router=express[_0x50f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x50f4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x50f4('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x50f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x50f4('0x9')]);router[_0x50f4('0x8')](_0x50f4('0xa'),auth[_0x50f4('0xb')](),controller[_0x50f4('0xc')]);router[_0x50f4('0x8')]('/:id/configurations',auth[_0x50f4('0xb')](),controller[_0x50f4('0xd')]);router[_0x50f4('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x50f4('0xe')]);router[_0x50f4('0xf')]('/',auth[_0x50f4('0xb')](),controller[_0x50f4('0x10')]);router['post'](_0x50f4('0x11'),auth['isAuthenticated'](),controller[_0x50f4('0x12')]);router[_0x50f4('0x13')](_0x50f4('0xa'),auth[_0x50f4('0xb')](),controller[_0x50f4('0x14')]);router[_0x50f4('0x15')]('/:id',auth[_0x50f4('0xb')](),controller[_0x50f4('0x16')]);module[_0x50f4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c84b978..8e3d4be 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 _0xa761=['username','remoteUri','exports','STRING'];(function(_0x1ac18d,_0x3c4497){var _0x14d5eb=function(_0x74d5a3){while(--_0x74d5a3){_0x1ac18d['push'](_0x1ac18d['shift']());}};_0x14d5eb(++_0x3c4497);}(_0xa761,0x15e));var _0x1a76=function(_0x1594b0,_0x1bba59){_0x1594b0=_0x1594b0-0x0;var _0x74d8d=_0xa761[_0x1594b0];return _0x74d8d;};'use strict';var Sequelize=require('sequelize');module[_0x1a76('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a76('0x1')]},'username':{'type':Sequelize[_0x1a76('0x1')],'unique':_0x1a76('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1a76('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1a76('0x3')},'serverUrl':{'type':Sequelize[_0x1a76('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xafd6=['STRING','username','remoteUri'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xafd6,0x1da));var _0x6afd=function(_0x21610d,_0x489c77){_0x21610d=_0x21610d-0x0;var _0x433e8c=_0xafd6[_0x21610d];return _0x433e8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6afd('0x0')]},'description':{'type':Sequelize[_0x6afd('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x6afd('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6afd('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6afd('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b68d214..9b05adf 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 _0x0df4=['business_stc','additional_assignee_list','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ServicenowConfiguration','order','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','assignment_group'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x0df4,0xf3));var _0x40df=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x0df4[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0x40df('0x0'));var rimraf=require(_0x40df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40df('0x2'));var rp=require(_0x40df('0x3'));var moment=require(_0x40df('0x4'));var BPromise=require(_0x40df('0x5'));var Mustache=require(_0x40df('0x6'));var util=require(_0x40df('0x7'));var path=require(_0x40df('0x8'));var sox=require(_0x40df('0x9'));var csv=require(_0x40df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40df('0xb'));var _=require(_0x40df('0xc'));var squel=require(_0x40df('0xd'));var crypto=require(_0x40df('0xe'));var jsforce=require(_0x40df('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x40df('0x10'));var Papa=require('papaparse');var Redis=require(_0x40df('0x11'));var authService=require(_0x40df('0x12'));var qs=require(_0x40df('0x13'));var as=require(_0x40df('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x40df('0x15'));var utils=require(_0x40df('0x16'));var config=require(_0x40df('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40df('0x18'))['db'];var integrations=require(_0x40df('0x19'));function respondWithStatusCode(_0xe2583c,_0x47c703){_0x47c703=_0x47c703||0xcc;return function(_0x2e659e){if(_0x2e659e){return _0xe2583c[_0x40df('0x1a')](_0x47c703);}return _0xe2583c[_0x40df('0x1b')](_0x47c703)[_0x40df('0x1c')]();};}function respondWithResult(_0x182f05,_0x21f8d2){_0x21f8d2=_0x21f8d2||0xc8;return function(_0x5458f2){if(_0x5458f2){return _0x182f05[_0x40df('0x1b')](_0x21f8d2)['json'](_0x5458f2);}};}function respondWithFilteredResult(_0x3b7b51,_0x10b1c7){return function(_0x45cc27){if(_0x45cc27){var _0x28bcc3=typeof _0x10b1c7[_0x40df('0x1d')]===_0x40df('0x1e')&&typeof _0x10b1c7[_0x40df('0x1f')]===_0x40df('0x1e');var _0x115fca=_0x45cc27[_0x40df('0x20')];var _0x4f3d27=_0x28bcc3?0x0:_0x10b1c7[_0x40df('0x1d')];var _0x56b401=_0x28bcc3?_0x45cc27[_0x40df('0x20')]:_0x10b1c7[_0x40df('0x1d')]+_0x10b1c7[_0x40df('0x1f')];var _0x149ed0;if(_0x56b401>=_0x115fca){_0x56b401=_0x115fca;_0x149ed0=0xc8;}else{_0x149ed0=0xce;}_0x3b7b51['status'](_0x149ed0);return _0x3b7b51['set']('Content-Range',_0x4f3d27+'-'+_0x56b401+'/'+_0x115fca)[_0x40df('0x21')](_0x45cc27);}return null;};}function patchUpdates(_0x4f8bd3){return function(_0x5ef67f){try{jsonpatch[_0x40df('0x22')](_0x5ef67f,_0x4f8bd3,!![]);}catch(_0x37a8ba){return BPromise[_0x40df('0x23')](_0x37a8ba);}return _0x5ef67f[_0x40df('0x24')]();};}function saveUpdates(_0xb2c48f,_0x408452){return function(_0x2945cf){if(_0x2945cf){return _0x2945cf[_0x40df('0x25')](_0xb2c48f)['then'](function(_0xd44758){return _0xd44758;});}return null;};}function removeEntity(_0x340894,_0x4f21a5){return function(_0x1a1c01){if(_0x1a1c01){return _0x1a1c01[_0x40df('0x26')]()[_0x40df('0x27')](function(){_0x340894[_0x40df('0x1b')](0xcc)[_0x40df('0x1c')]();});}};}function handleEntityNotFound(_0xce2c72,_0x7160fe){return function(_0x5e848d){if(!_0x5e848d){_0xce2c72[_0x40df('0x1a')](0x194);}return _0x5e848d;};}function handleError(_0x57e197,_0x1b89d3){_0x1b89d3=_0x1b89d3||0x1f4;return function(_0xd6c819){logger[_0x40df('0x28')](_0xd6c819[_0x40df('0x29')]);if(_0xd6c819[_0x40df('0x2a')]){delete _0xd6c819['name'];}_0x57e197[_0x40df('0x1b')](_0x1b89d3)[_0x40df('0x2b')](_0xd6c819);};}exports[_0x40df('0x2c')]=function(_0x51a106,_0x18f9c5){var _0x12f289={},_0x763b30={},_0x4eec3d={'count':0x0,'rows':[]};var _0x193447=_[_0x40df('0x2d')](db[_0x40df('0x2e')][_0x40df('0x2f')],function(_0x4edbc5){return{'name':_0x4edbc5[_0x40df('0x30')],'type':_0x4edbc5[_0x40df('0x31')]['key']};});_0x763b30[_0x40df('0x32')]=_[_0x40df('0x2d')](_0x193447,_0x40df('0x2a'));_0x763b30[_0x40df('0x33')]=_[_0x40df('0x34')](_0x51a106[_0x40df('0x33')]);_0x763b30[_0x40df('0x35')]=_['intersection'](_0x763b30[_0x40df('0x32')],_0x763b30['query']);_0x12f289[_0x40df('0x36')]=_[_0x40df('0x37')](_0x763b30[_0x40df('0x32')],qs[_0x40df('0x38')](_0x51a106['query'][_0x40df('0x38')]));_0x12f289[_0x40df('0x36')]=_0x12f289[_0x40df('0x36')][_0x40df('0x39')]?_0x12f289[_0x40df('0x36')]:_0x763b30[_0x40df('0x32')];if(!_0x51a106[_0x40df('0x33')]['hasOwnProperty'](_0x40df('0x3a'))){_0x12f289[_0x40df('0x1f')]=qs['limit'](_0x51a106[_0x40df('0x33')][_0x40df('0x1f')]);_0x12f289['offset']=qs['offset'](_0x51a106[_0x40df('0x33')][_0x40df('0x1d')]);}_0x12f289['order']=qs[_0x40df('0x3b')](_0x51a106[_0x40df('0x33')]['sort']);_0x12f289['where']=qs[_0x40df('0x35')](_[_0x40df('0x3c')](_0x51a106['query'],_0x763b30[_0x40df('0x35')]),_0x193447);if(_0x51a106['query'][_0x40df('0x3d')]){_0x12f289['where']=_[_0x40df('0x3e')](_0x12f289[_0x40df('0x3f')],{'$or':_[_0x40df('0x2d')](_0x193447,function(_0x323897){if(_0x323897[_0x40df('0x31')]!==_0x40df('0x40')){var _0x3bb3c8={};_0x3bb3c8[_0x323897[_0x40df('0x2a')]]={'$like':'%'+_0x51a106['query'][_0x40df('0x3d')]+'%'};return _0x3bb3c8;}})});}_0x12f289=_['merge']({},_0x12f289,_0x51a106[_0x40df('0x41')]);var _0x6154fe={'where':_0x12f289[_0x40df('0x3f')]};return db['ServicenowAccount'][_0x40df('0x20')](_0x6154fe)[_0x40df('0x27')](function(_0x2b426f){_0x4eec3d['count']=_0x2b426f;if(_0x51a106[_0x40df('0x33')][_0x40df('0x42')]){_0x12f289[_0x40df('0x43')]=[{'all':!![]}];}return db[_0x40df('0x2e')]['findAll'](_0x12f289);})['then'](function(_0x2d3b1a){_0x4eec3d[_0x40df('0x44')]=_0x2d3b1a;return _0x4eec3d;})[_0x40df('0x27')](respondWithFilteredResult(_0x18f9c5,_0x12f289))[_0x40df('0x45')](handleError(_0x18f9c5,null));};exports[_0x40df('0x46')]=function(_0x3d8ea1,_0x2e6dcb){var _0x43374b={'raw':![],'where':{'id':_0x3d8ea1[_0x40df('0x47')]['id']}},_0x1e63b7={};_0x1e63b7['model']=_[_0x40df('0x34')](db[_0x40df('0x2e')][_0x40df('0x2f')]);_0x1e63b7[_0x40df('0x33')]=_[_0x40df('0x34')](_0x3d8ea1[_0x40df('0x33')]);_0x1e63b7['filters']=_[_0x40df('0x37')](_0x1e63b7[_0x40df('0x32')],_0x1e63b7[_0x40df('0x33')]);_0x43374b[_0x40df('0x36')]=_[_0x40df('0x37')](_0x1e63b7[_0x40df('0x32')],qs[_0x40df('0x38')](_0x3d8ea1[_0x40df('0x33')]['fields']));_0x43374b[_0x40df('0x36')]=_0x43374b[_0x40df('0x36')]['length']?_0x43374b[_0x40df('0x36')]:_0x1e63b7[_0x40df('0x32')];if(_0x3d8ea1[_0x40df('0x33')][_0x40df('0x42')]){_0x43374b[_0x40df('0x43')]=[{'all':!![]}];}_0x43374b=_[_0x40df('0x3e')]({},_0x43374b,_0x3d8ea1[_0x40df('0x41')]);return db[_0x40df('0x2e')]['find'](_0x43374b)[_0x40df('0x27')](handleEntityNotFound(_0x2e6dcb,null))[_0x40df('0x27')](respondWithResult(_0x2e6dcb,null))[_0x40df('0x45')](handleError(_0x2e6dcb,null));};exports[_0x40df('0x48')]=function(_0x1cf5fa,_0x3dbcc6){return db[_0x40df('0x2e')][_0x40df('0x48')](_0x1cf5fa[_0x40df('0x49')],{})[_0x40df('0x27')](respondWithResult(_0x3dbcc6,0xc9))[_0x40df('0x45')](handleError(_0x3dbcc6,null));};exports['update']=function(_0x5dfb7c,_0x5cbe10){if(_0x5dfb7c[_0x40df('0x49')]['id']){delete _0x5dfb7c[_0x40df('0x49')]['id'];}return db[_0x40df('0x2e')][_0x40df('0x4a')]({'where':{'id':_0x5dfb7c['params']['id']}})[_0x40df('0x27')](handleEntityNotFound(_0x5cbe10,null))[_0x40df('0x27')](saveUpdates(_0x5dfb7c[_0x40df('0x49')],null))['then'](respondWithResult(_0x5cbe10,null))['catch'](handleError(_0x5cbe10,null));};exports[_0x40df('0x26')]=function(_0xf843bb,_0x6e1bf4){return db[_0x40df('0x2e')][_0x40df('0x4a')]({'where':{'id':_0xf843bb['params']['id']}})[_0x40df('0x27')](handleEntityNotFound(_0x6e1bf4,null))[_0x40df('0x27')](removeEntity(_0x6e1bf4,null))[_0x40df('0x45')](handleError(_0x6e1bf4,null));};exports[_0x40df('0x4b')]=function(_0x11a8a2,_0x23a4de,_0x2c0189){var _0x30bada={};var _0x1fb869={};var _0x4612e1;var _0x2f27c3;return db[_0x40df('0x2e')]['findOne']({'where':{'id':_0x11a8a2[_0x40df('0x47')]['id']}})[_0x40df('0x27')](handleEntityNotFound(_0x23a4de,null))[_0x40df('0x27')](function(_0x406675){if(_0x406675){_0x4612e1=_0x406675;_0x1fb869[_0x40df('0x32')]=_['keys'](db[_0x40df('0x4c')][_0x40df('0x2f')]);_0x1fb869[_0x40df('0x33')]=_['keys'](_0x11a8a2[_0x40df('0x33')]);_0x1fb869[_0x40df('0x35')]=_[_0x40df('0x37')](_0x1fb869['model'],_0x1fb869[_0x40df('0x33')]);_0x30bada[_0x40df('0x36')]=_[_0x40df('0x37')](_0x1fb869['model'],qs['fields'](_0x11a8a2[_0x40df('0x33')][_0x40df('0x38')]));_0x30bada['attributes']=_0x30bada[_0x40df('0x36')][_0x40df('0x39')]?_0x30bada[_0x40df('0x36')]:_0x1fb869[_0x40df('0x32')];_0x30bada[_0x40df('0x4d')]=qs[_0x40df('0x3b')](_0x11a8a2[_0x40df('0x33')][_0x40df('0x3b')]);_0x30bada['where']=qs[_0x40df('0x35')](_['pick'](_0x11a8a2['query'],_0x1fb869[_0x40df('0x35')]));if(_0x11a8a2[_0x40df('0x33')][_0x40df('0x3d')]){_0x30bada[_0x40df('0x3f')]=_[_0x40df('0x3e')](_0x30bada[_0x40df('0x3f')],{'$or':_[_0x40df('0x2d')](_0x30bada[_0x40df('0x36')],function(_0x97c1c4){var _0xb54c1e={};_0xb54c1e[_0x97c1c4]={'$like':'%'+_0x11a8a2[_0x40df('0x33')][_0x40df('0x3d')]+'%'};return _0xb54c1e;})});}_0x30bada=_[_0x40df('0x3e')]({},_0x30bada,_0x11a8a2[_0x40df('0x41')]);return _0x4612e1[_0x40df('0x4b')](_0x30bada);}})[_0x40df('0x27')](function(_0x47a8a1){if(_0x47a8a1){_0x2f27c3=_0x47a8a1[_0x40df('0x39')];if(!_0x11a8a2[_0x40df('0x33')][_0x40df('0x4e')]('nolimit')){_0x30bada[_0x40df('0x1f')]=qs[_0x40df('0x1f')](_0x11a8a2[_0x40df('0x33')]['limit']);_0x30bada['offset']=qs[_0x40df('0x1d')](_0x11a8a2[_0x40df('0x33')][_0x40df('0x1d')]);}return _0x4612e1[_0x40df('0x4b')](_0x30bada);}})['then'](function(_0x3ecd95){if(_0x3ecd95){return _0x3ecd95?{'count':_0x2f27c3,'rows':_0x3ecd95}:null;}})[_0x40df('0x27')](respondWithResult(_0x23a4de,null))[_0x40df('0x45')](handleError(_0x23a4de,null));};exports['addConfiguration']=function(_0x569cb6,_0x57d544,_0x391242){if(_0x569cb6[_0x40df('0x49')]['id']){delete _0x569cb6[_0x40df('0x49')]['id'];}return db[_0x40df('0x2e')][_0x40df('0x4f')]({'where':{'id':_0x569cb6['params']['id']}})[_0x40df('0x27')](handleEntityNotFound(_0x57d544,null))[_0x40df('0x27')](function(_0x414262){if(_0x414262){_0x569cb6[_0x40df('0x49')][_0x40df('0x50')]=_0x414262['id'];_0x569cb6[_0x40df('0x49')][_0x40df('0x51')]=integrations[_0x40df('0x52')](_0x569cb6[_0x40df('0x49')][_0x40df('0x53')],_0x569cb6[_0x40df('0x49')][_0x40df('0x31')]);_0x569cb6[_0x40df('0x49')][_0x40df('0x54')]=integrations[_0x40df('0x55')](_0x569cb6[_0x40df('0x49')][_0x40df('0x53')],_0x569cb6['body'][_0x40df('0x31')]);return db['ServicenowConfiguration']['create'](_0x569cb6[_0x40df('0x49')],{'include':[{'model':db[_0x40df('0x56')],'as':'Subjects'},{'model':db[_0x40df('0x56')],'as':_0x40df('0x54')}]});}return null;})[_0x40df('0x27')](respondWithResult(_0x57d544,null))['catch'](handleError(_0x57d544,null));};exports['getFields']=function(_0x458939,_0xba14bf,_0x4f43e5){var _0x42eb9d=[_0x40df('0x57'),_0x40df('0x58'),_0x40df('0x59'),_0x40df('0x5a'),'close_code',_0x40df('0x5b'),'incident_state',_0x40df('0x5c'),'category'];var _0x2babfa=[_0x40df('0x5d'),_0x40df('0x57'),_0x40df('0x5e'),_0x40df('0x5f'),_0x40df('0x60'),_0x40df('0x61'),_0x40df('0x62'),_0x40df('0x58'),_0x40df('0x63'),_0x40df('0x64'),_0x40df('0x65'),'sys_updated_by',_0x40df('0x66'),_0x40df('0x67'),_0x40df('0x68'),'sys_domain',_0x40df('0x69'),'sys_created_by','knowledge','order',_0x40df('0x6a'),_0x40df('0x6b'),_0x40df('0x6c'),_0x40df('0x6d'),_0x40df('0x6e'),_0x40df('0x6f'),'work_notes_list','business_service',_0x40df('0x70'),_0x40df('0x71'),_0x40df('0x72'),_0x40df('0x73'),_0x40df('0x74'),'opened_at',_0x40df('0x75'),_0x40df('0x76'),_0x40df('0x77'),'reopened_time',_0x40df('0x78'),_0x40df('0x79'),_0x40df('0x7a'),_0x40df('0x5a'),'work_notes',_0x40df('0x7b'),_0x40df('0x7c'),_0x40df('0x7d'),'delivery_task','work_start',_0x40df('0x7e'),_0x40df('0x7f'),_0x40df('0x80'),'description',_0x40df('0x81'),_0x40df('0x5b'),'sys_class_name',_0x40df('0x82'),'closed_by',_0x40df('0x83'),_0x40df('0x84'),_0x40df('0x85'),_0x40df('0x86'),_0x40df('0x87'),_0x40df('0x88'),_0x40df('0x89'),_0x40df('0x8a'),_0x40df('0x8b'),_0x40df('0x8c'),_0x40df('0x8d'),'assigned_to',_0x40df('0x5c'),_0x40df('0x8e'),_0x40df('0x8f'),_0x40df('0x90'),_0x40df('0x91'),_0x40df('0x92'),_0x40df('0x93'),_0x40df('0x94'),_0x40df('0x95'),'escalation',_0x40df('0x96'),_0x40df('0x97'),_0x40df('0x98'),_0x40df('0x99')];var _0x4982d8='';var _0x1c5b18='';var _0x3f058d=[];var _0x57e530='';var _0x3ed66a='';var _0x5888e1=[];var _0x344119='';var _0x31ecaa='';var _0x3dc0fa={};var _0x5a87ee='';return db[_0x40df('0x2e')][_0x40df('0x4f')]({'where':{'id':_0x458939[_0x40df('0x47')]['id']},'attributes':['id',_0x40df('0x9a'),_0x40df('0x9b'),_0x40df('0x9c'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0xba14bf,null))[_0x40df('0x27')](function(_0x55cf8a){if(_0x55cf8a){_0x5a87ee=_0x55cf8a[_0x40df('0x9d')];var _0x5622b0=_0x5a87ee[_0x40df('0x9e')](-0x1);if(_0x5622b0==='/'){_0x5a87ee=_0x5a87ee['substring'](0x0,_0x5a87ee['lastIndexOf'](_0x5622b0));}_0x31ecaa=util[_0x40df('0x9f')](_0x40df('0xa0'),_0x5a87ee);_0x344119=util[_0x40df('0x9f')]('%s/api/now/table/',_0x5a87ee);_0x3dc0fa={'user':_0x55cf8a[_0x40df('0x9a')],'pass':_0x55cf8a[_0x40df('0x9b')]};var _0x24bd56={'method':_0x40df('0xa1'),'uri':_0x31ecaa+_0x40df('0xa2'),'auth':_0x3dc0fa,'json':!![]};return rp(_0x24bd56);}})['then'](function(_0x3398e1){if(_0x3398e1[_0x40df('0xa3')]['length']>0x0){_0x4982d8=_0x3398e1[_0x40df('0xa3')];}console[_0x40df('0xa4')](_0x40df('0xa5'),_0x4982d8);_0x5888e1=[];_0x1c5b18=Object[_0x40df('0xa6')]([],_0x4982d8);_[_0x40df('0xa7')](_0x1c5b18,function(_0x332a0a){return!_0x42eb9d['includes'](_0x332a0a[_0x40df('0x2a')]);});_0x1c5b18[_0x40df('0xa8')](function(_0x43a5d6){var _0x3947bd=createFieldObject(_0x344119,_0x3dc0fa,_0x43a5d6[_0x40df('0xa9')],_0x43a5d6[_0x40df('0x2a')],_0x43a5d6[_0x40df('0xaa')],![]);_0x5888e1[_0x40df('0xab')](_0x3947bd);});return Promise[_0x40df('0xac')](_0x5888e1);})[_0x40df('0x27')](function(_0x38e490){_0x3f058d=_0x38e490;_0x57e530=Object[_0x40df('0xa6')]([],_0x4982d8);console[_0x40df('0xa4')]('TCL:\x20_object',_0x4982d8);_[_0x40df('0xa7')](_0x57e530,function(_0x498a0a){return _0x2babfa[_0x40df('0xad')](_0x498a0a[_0x40df('0x2a')]);});console[_0x40df('0xa4')](_0x40df('0xae'),_0x57e530);_0x5888e1=[];_0x57e530[_0x40df('0xa8')](function(_0x9da0db){var _0x40dfe7=createFieldObject(_0x344119,_0x3dc0fa,_0x9da0db['internalType'],_0x9da0db['name'],_0x9da0db['label'],!![]);_0x5888e1[_0x40df('0xab')](_0x40dfe7);});return Promise[_0x40df('0xac')](_0x5888e1);})[_0x40df('0x27')](function(_0xf30867){_0x3ed66a=_0xf30867;var _0x2e4e56=_0x3f058d[_0x40df('0xaf')](_0x3ed66a);return{'count':_0x2e4e56['length'],'rows':_0x2e4e56};})[_0x40df('0x27')](respondWithResult(_0xba14bf,null))['catch'](function(_0x42b398){console['log'](_0x40df('0xb0')+_0x42b398);var _0x371e31=_0x458939[_0x40df('0x33')][_0x40df('0xb1')]?0x1f4:_0x42b398['statusCode']||0x1f4;logger['error'](_0x42b398[_0x40df('0x29')]);delete _0x42b398[_0x40df('0x2a')];if(_0x371e31===0x191){_0x371e31=0x190;}_0xba14bf['status'](_0x371e31)[_0x40df('0x2b')](_0x458939['query'][_0x40df('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x42b398[_0x40df('0xb2')]}:_0x42b398);});};function createFieldObject(_0x286677,_0x5de966,_0xfcdb34,_0x202c02,_0x432101,_0x5b79c5){return new Promise(function(_0x4653b1,_0x8c6b46){var _0xdfe7d9={'id':_0x202c02,'name':_0x432101,'custom':_0x5b79c5};if(_0xfcdb34==='boolean'){_0xdfe7d9[_0x40df('0x41')]=[{'name':'True','value':_0x40df('0xb3')},{'name':_0x40df('0xb4'),'value':_0x40df('0xb5')}];_0x4653b1(_0xdfe7d9);}else{var _0x265860={'method':'GET','uri':_0x286677+_0x40df('0xb6')+_0x202c02,'auth':_0x5de966,'json':!![]};return rp(_0x265860)[_0x40df('0x27')](function(_0x49ba51){var _0x5f549d=[];if(_0x49ba51[_0x40df('0xa3')][_0x40df('0x39')]>0x0){_0x49ba51[_0x40df('0xa3')][_0x40df('0xa8')](function(_0x2f4a74){if(_0x2f4a74[_0x40df('0xb7')]==='false'){var _0x1aca2d={'name':_0x2f4a74[_0x40df('0xaa')],'value':_0x2f4a74[_0x40df('0xb8')]};_0x5f549d[_0x40df('0xab')](_0x1aca2d);}});}_0xdfe7d9[_0x40df('0x41')]=_0x5f549d;if(_0xdfe7d9['options'][_0x40df('0x39')]>0x0){_0x4653b1(_0xdfe7d9);}else{if(_0x5b79c5==![]){_0x4653b1();}else{_0x4653b1(_0xdfe7d9);}}});}});} \ No newline at end of file +var _0x3784=['inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','then','end','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','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','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','assign','includes','forEach','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element='];(function(_0x57f5db,_0x5529f0){var _0x1f2e2c=function(_0x2ae4d3){while(--_0x2ae4d3){_0x57f5db['push'](_0x57f5db['shift']());}};_0x1f2e2c(++_0x5529f0);}(_0x3784,0xbc));var _0x4378=function(_0x169d85,_0x516fc1){_0x169d85=_0x169d85-0x0;var _0x26d4b5=_0x3784[_0x169d85];return _0x26d4b5;};'use strict';var emlformat=require(_0x4378('0x0'));var rimraf=require(_0x4378('0x1'));var zipdir=require(_0x4378('0x2'));var jsonpatch=require(_0x4378('0x3'));var rp=require(_0x4378('0x4'));var moment=require(_0x4378('0x5'));var BPromise=require(_0x4378('0x6'));var Mustache=require(_0x4378('0x7'));var util=require(_0x4378('0x8'));var path=require(_0x4378('0x9'));var sox=require('sox');var csv=require(_0x4378('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4378('0xb'));var _=require('lodash');var squel=require(_0x4378('0xc'));var crypto=require(_0x4378('0xd'));var jsforce=require(_0x4378('0xe'));var deskjs=require(_0x4378('0xf'));var toCsv=require(_0x4378('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4378('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4378('0x11'));var logger=require('../../config/logger')(_0x4378('0x12'));var utils=require(_0x4378('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4378('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4378('0x15'));function respondWithStatusCode(_0x49b45e,_0x11056d){_0x11056d=_0x11056d||0xcc;return function(_0x39f41d){if(_0x39f41d){return _0x49b45e[_0x4378('0x16')](_0x11056d);}return _0x49b45e[_0x4378('0x17')](_0x11056d)['end']();};}function respondWithResult(_0x2f8094,_0xdf0673){_0xdf0673=_0xdf0673||0xc8;return function(_0xbcfa41){if(_0xbcfa41){return _0x2f8094[_0x4378('0x17')](_0xdf0673)[_0x4378('0x18')](_0xbcfa41);}};}function respondWithFilteredResult(_0x486aee,_0x2dcca6){return function(_0x20aabe){if(_0x20aabe){var _0x17fb40=typeof _0x2dcca6['offset']===_0x4378('0x19')&&typeof _0x2dcca6['limit']===_0x4378('0x19');var _0x2f470b=_0x20aabe[_0x4378('0x1a')];var _0x353f31=_0x17fb40?0x0:_0x2dcca6[_0x4378('0x1b')];var _0x3cef39=_0x17fb40?_0x20aabe[_0x4378('0x1a')]:_0x2dcca6['offset']+_0x2dcca6[_0x4378('0x1c')];var _0x4eec91;if(_0x3cef39>=_0x2f470b){_0x3cef39=_0x2f470b;_0x4eec91=0xc8;}else{_0x4eec91=0xce;}_0x486aee[_0x4378('0x17')](_0x4eec91);return _0x486aee[_0x4378('0x1d')](_0x4378('0x1e'),_0x353f31+'-'+_0x3cef39+'/'+_0x2f470b)[_0x4378('0x18')](_0x20aabe);}return null;};}function patchUpdates(_0x40debd){return function(_0xad5c4a){try{jsonpatch[_0x4378('0x1f')](_0xad5c4a,_0x40debd,!![]);}catch(_0x2d2535){return BPromise['reject'](_0x2d2535);}return _0xad5c4a['save']();};}function saveUpdates(_0x294e54,_0x21c68e){return function(_0x2fac2a){if(_0x2fac2a){return _0x2fac2a[_0x4378('0x20')](_0x294e54)['then'](function(_0x1039ec){return _0x1039ec;});}return null;};}function removeEntity(_0x2b0fd6,_0x2803bf){return function(_0x3fe693){if(_0x3fe693){return _0x3fe693[_0x4378('0x21')]()[_0x4378('0x22')](function(){_0x2b0fd6['status'](0xcc)[_0x4378('0x23')]();});}};}function handleEntityNotFound(_0x4928c1,_0x35bc60){return function(_0x31b4c7){if(!_0x31b4c7){_0x4928c1[_0x4378('0x16')](0x194);}return _0x31b4c7;};}function handleError(_0x399645,_0xb0d904){_0xb0d904=_0xb0d904||0x1f4;return function(_0x4cad0b){logger[_0x4378('0x24')](_0x4cad0b[_0x4378('0x25')]);if(_0x4cad0b['name']){delete _0x4cad0b[_0x4378('0x26')];}_0x399645[_0x4378('0x17')](_0xb0d904)[_0x4378('0x27')](_0x4cad0b);};}exports[_0x4378('0x28')]=function(_0x2e071b,_0x779f99){var _0x1a0923={},_0x565202={},_0x105c1e={'count':0x0,'rows':[]};var _0x4b9a60=_[_0x4378('0x29')](db[_0x4378('0x2a')]['rawAttributes'],function(_0x26e890){return{'name':_0x26e890[_0x4378('0x2b')],'type':_0x26e890[_0x4378('0x2c')][_0x4378('0x2d')]};});_0x565202[_0x4378('0x2e')]=_[_0x4378('0x29')](_0x4b9a60,_0x4378('0x26'));_0x565202[_0x4378('0x2f')]=_[_0x4378('0x30')](_0x2e071b[_0x4378('0x2f')]);_0x565202[_0x4378('0x31')]=_['intersection'](_0x565202[_0x4378('0x2e')],_0x565202[_0x4378('0x2f')]);_0x1a0923[_0x4378('0x32')]=_[_0x4378('0x33')](_0x565202[_0x4378('0x2e')],qs[_0x4378('0x34')](_0x2e071b[_0x4378('0x2f')][_0x4378('0x34')]));_0x1a0923[_0x4378('0x32')]=_0x1a0923[_0x4378('0x32')][_0x4378('0x35')]?_0x1a0923[_0x4378('0x32')]:_0x565202['model'];if(!_0x2e071b[_0x4378('0x2f')]['hasOwnProperty'](_0x4378('0x36'))){_0x1a0923[_0x4378('0x1c')]=qs['limit'](_0x2e071b[_0x4378('0x2f')]['limit']);_0x1a0923[_0x4378('0x1b')]=qs['offset'](_0x2e071b[_0x4378('0x2f')][_0x4378('0x1b')]);}_0x1a0923[_0x4378('0x37')]=qs[_0x4378('0x38')](_0x2e071b[_0x4378('0x2f')]['sort']);_0x1a0923[_0x4378('0x39')]=qs[_0x4378('0x31')](_[_0x4378('0x3a')](_0x2e071b['query'],_0x565202[_0x4378('0x31')]),_0x4b9a60);if(_0x2e071b[_0x4378('0x2f')][_0x4378('0x3b')]){_0x1a0923[_0x4378('0x39')]=_[_0x4378('0x3c')](_0x1a0923[_0x4378('0x39')],{'$or':_[_0x4378('0x29')](_0x4b9a60,function(_0xacbeb1){if(_0xacbeb1['type']!==_0x4378('0x3d')){var _0x77a401={};_0x77a401[_0xacbeb1[_0x4378('0x26')]]={'$like':'%'+_0x2e071b[_0x4378('0x2f')][_0x4378('0x3b')]+'%'};return _0x77a401;}})});}_0x1a0923=_[_0x4378('0x3c')]({},_0x1a0923,_0x2e071b[_0x4378('0x3e')]);var _0x34e105={'where':_0x1a0923['where']};return db[_0x4378('0x2a')]['count'](_0x34e105)['then'](function(_0x3a30a5){_0x105c1e[_0x4378('0x1a')]=_0x3a30a5;if(_0x2e071b[_0x4378('0x2f')][_0x4378('0x3f')]){_0x1a0923[_0x4378('0x40')]=[{'all':!![]}];}return db[_0x4378('0x2a')][_0x4378('0x41')](_0x1a0923);})['then'](function(_0x1f9d00){_0x105c1e[_0x4378('0x42')]=_0x1f9d00;return _0x105c1e;})[_0x4378('0x22')](respondWithFilteredResult(_0x779f99,_0x1a0923))['catch'](handleError(_0x779f99,null));};exports[_0x4378('0x43')]=function(_0x349299,_0x229b32){var _0x57f69f={'raw':![],'where':{'id':_0x349299['params']['id']}},_0xa76911={};_0xa76911[_0x4378('0x2e')]=_['keys'](db[_0x4378('0x2a')][_0x4378('0x44')]);_0xa76911[_0x4378('0x2f')]=_[_0x4378('0x30')](_0x349299[_0x4378('0x2f')]);_0xa76911['filters']=_[_0x4378('0x33')](_0xa76911[_0x4378('0x2e')],_0xa76911[_0x4378('0x2f')]);_0x57f69f['attributes']=_[_0x4378('0x33')](_0xa76911[_0x4378('0x2e')],qs['fields'](_0x349299['query'][_0x4378('0x34')]));_0x57f69f[_0x4378('0x32')]=_0x57f69f['attributes'][_0x4378('0x35')]?_0x57f69f[_0x4378('0x32')]:_0xa76911[_0x4378('0x2e')];if(_0x349299[_0x4378('0x2f')]['includeAll']){_0x57f69f['include']=[{'all':!![]}];}_0x57f69f=_[_0x4378('0x3c')]({},_0x57f69f,_0x349299[_0x4378('0x3e')]);return db[_0x4378('0x2a')][_0x4378('0x45')](_0x57f69f)[_0x4378('0x22')](handleEntityNotFound(_0x229b32,null))['then'](respondWithResult(_0x229b32,null))[_0x4378('0x46')](handleError(_0x229b32,null));};exports[_0x4378('0x47')]=function(_0x10a61b,_0x20ffe5){return db[_0x4378('0x2a')]['create'](_0x10a61b['body'],{})['then'](respondWithResult(_0x20ffe5,0xc9))[_0x4378('0x46')](handleError(_0x20ffe5,null));};exports[_0x4378('0x20')]=function(_0x255377,_0x4e05bb){if(_0x255377['body']['id']){delete _0x255377['body']['id'];}return db[_0x4378('0x2a')][_0x4378('0x45')]({'where':{'id':_0x255377['params']['id']}})[_0x4378('0x22')](handleEntityNotFound(_0x4e05bb,null))[_0x4378('0x22')](saveUpdates(_0x255377[_0x4378('0x48')],null))['then'](respondWithResult(_0x4e05bb,null))[_0x4378('0x46')](handleError(_0x4e05bb,null));};exports['destroy']=function(_0x2dc45c,_0x5df372){return db[_0x4378('0x2a')][_0x4378('0x45')]({'where':{'id':_0x2dc45c[_0x4378('0x49')]['id']}})[_0x4378('0x22')](handleEntityNotFound(_0x5df372,null))[_0x4378('0x22')](removeEntity(_0x5df372,null))[_0x4378('0x46')](handleError(_0x5df372,null));};exports[_0x4378('0x4a')]=function(_0x55dc7d,_0x13d767,_0x3bf79a){var _0x6f489d={};var _0x1c7307={};var _0x8a1192;var _0x2f192c;return db[_0x4378('0x2a')][_0x4378('0x4b')]({'where':{'id':_0x55dc7d[_0x4378('0x49')]['id']}})[_0x4378('0x22')](handleEntityNotFound(_0x13d767,null))[_0x4378('0x22')](function(_0x152d19){if(_0x152d19){_0x8a1192=_0x152d19;_0x1c7307[_0x4378('0x2e')]=_[_0x4378('0x30')](db[_0x4378('0x4c')][_0x4378('0x44')]);_0x1c7307[_0x4378('0x2f')]=_[_0x4378('0x30')](_0x55dc7d[_0x4378('0x2f')]);_0x1c7307['filters']=_[_0x4378('0x33')](_0x1c7307[_0x4378('0x2e')],_0x1c7307[_0x4378('0x2f')]);_0x6f489d[_0x4378('0x32')]=_[_0x4378('0x33')](_0x1c7307[_0x4378('0x2e')],qs[_0x4378('0x34')](_0x55dc7d[_0x4378('0x2f')][_0x4378('0x34')]));_0x6f489d[_0x4378('0x32')]=_0x6f489d[_0x4378('0x32')][_0x4378('0x35')]?_0x6f489d[_0x4378('0x32')]:_0x1c7307[_0x4378('0x2e')];_0x6f489d[_0x4378('0x37')]=qs[_0x4378('0x38')](_0x55dc7d[_0x4378('0x2f')][_0x4378('0x38')]);_0x6f489d[_0x4378('0x39')]=qs[_0x4378('0x31')](_['pick'](_0x55dc7d['query'],_0x1c7307[_0x4378('0x31')]));if(_0x55dc7d[_0x4378('0x2f')][_0x4378('0x3b')]){_0x6f489d[_0x4378('0x39')]=_[_0x4378('0x3c')](_0x6f489d['where'],{'$or':_[_0x4378('0x29')](_0x6f489d[_0x4378('0x32')],function(_0x17d5ff){var _0x5ddfeb={};_0x5ddfeb[_0x17d5ff]={'$like':'%'+_0x55dc7d[_0x4378('0x2f')][_0x4378('0x3b')]+'%'};return _0x5ddfeb;})});}_0x6f489d=_['merge']({},_0x6f489d,_0x55dc7d[_0x4378('0x3e')]);return _0x8a1192['getConfigurations'](_0x6f489d);}})[_0x4378('0x22')](function(_0xc4daa1){if(_0xc4daa1){_0x2f192c=_0xc4daa1[_0x4378('0x35')];if(!_0x55dc7d['query'][_0x4378('0x4d')](_0x4378('0x36'))){_0x6f489d['limit']=qs[_0x4378('0x1c')](_0x55dc7d[_0x4378('0x2f')][_0x4378('0x1c')]);_0x6f489d[_0x4378('0x1b')]=qs[_0x4378('0x1b')](_0x55dc7d[_0x4378('0x2f')][_0x4378('0x1b')]);}return _0x8a1192[_0x4378('0x4a')](_0x6f489d);}})[_0x4378('0x22')](function(_0x34191f){if(_0x34191f){return _0x34191f?{'count':_0x2f192c,'rows':_0x34191f}:null;}})[_0x4378('0x22')](respondWithResult(_0x13d767,null))['catch'](handleError(_0x13d767,null));};exports[_0x4378('0x4e')]=function(_0x3fb93d,_0x5bac57,_0x414974){if(_0x3fb93d[_0x4378('0x48')]['id']){delete _0x3fb93d[_0x4378('0x48')]['id'];}return db[_0x4378('0x2a')][_0x4378('0x4b')]({'where':{'id':_0x3fb93d[_0x4378('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bac57,null))['then'](function(_0x3f3f68){if(_0x3f3f68){_0x3fb93d[_0x4378('0x48')][_0x4378('0x4f')]=_0x3f3f68['id'];_0x3fb93d['body'][_0x4378('0x50')]=integrations[_0x4378('0x51')](_0x3fb93d['body'][_0x4378('0x52')],_0x3fb93d['body'][_0x4378('0x2c')]);_0x3fb93d['body'][_0x4378('0x53')]=integrations[_0x4378('0x54')](_0x3fb93d[_0x4378('0x48')][_0x4378('0x52')],_0x3fb93d[_0x4378('0x48')][_0x4378('0x2c')]);return db[_0x4378('0x4c')][_0x4378('0x47')](_0x3fb93d[_0x4378('0x48')],{'include':[{'model':db[_0x4378('0x55')],'as':_0x4378('0x50')},{'model':db[_0x4378('0x55')],'as':_0x4378('0x53')}]});}return null;})[_0x4378('0x22')](respondWithResult(_0x5bac57,null))[_0x4378('0x46')](handleError(_0x5bac57,null));};exports[_0x4378('0x56')]=function(_0x7899e1,_0x188142,_0x379fc7){var _0x3c7e66=['made_sla',_0x4378('0x57'),_0x4378('0x58'),_0x4378('0x59'),_0x4378('0x5a'),_0x4378('0x5b'),_0x4378('0x5c'),_0x4378('0x5d'),_0x4378('0x5e')];var _0x3ff5c1=[_0x4378('0x5f'),_0x4378('0x60'),_0x4378('0x61'),_0x4378('0x62'),_0x4378('0x63'),_0x4378('0x64'),_0x4378('0x65'),'hold_reason',_0x4378('0x66'),_0x4378('0x67'),_0x4378('0x68'),_0x4378('0x69'),_0x4378('0x6a'),_0x4378('0x6b'),_0x4378('0x6c'),'sys_domain',_0x4378('0x6d'),_0x4378('0x6e'),_0x4378('0x58'),'order',_0x4378('0x6f'),'closed_at',_0x4378('0x70'),_0x4378('0x71'),'impact','active',_0x4378('0x72'),_0x4378('0x73'),_0x4378('0x74'),'sys_domain_path',_0x4378('0x75'),_0x4378('0x76'),_0x4378('0x77'),_0x4378('0x78'),_0x4378('0x79'),_0x4378('0x7a'),'work_end','reopened_time',_0x4378('0x7b'),_0x4378('0x7c'),_0x4378('0x7d'),_0x4378('0x59'),_0x4378('0x7e'),_0x4378('0x7f'),_0x4378('0x5a'),_0x4378('0x80'),_0x4378('0x81'),'work_start',_0x4378('0x82'),_0x4378('0x83'),_0x4378('0x84'),'description',_0x4378('0x85'),_0x4378('0x5b'),_0x4378('0x86'),_0x4378('0x87'),'closed_by',_0x4378('0x88'),_0x4378('0x89'),_0x4378('0x8a'),_0x4378('0x8b'),_0x4378('0x8c'),_0x4378('0x5c'),_0x4378('0x8d'),_0x4378('0x8e'),_0x4378('0x8f'),'reassignment_count',_0x4378('0x90'),'assigned_to',_0x4378('0x5d'),'comments',_0x4378('0x91'),_0x4378('0x92'),_0x4378('0x93'),_0x4378('0x94'),_0x4378('0x95'),_0x4378('0x96'),'sys_tags',_0x4378('0x97'),_0x4378('0x98'),_0x4378('0x99'),_0x4378('0x9a'),_0x4378('0x5e')];var _0x2b9e75='';var _0x12e9b5='';var _0x2d7afe=[];var _0x4b6c65='';var _0x3391ab='';var _0x5b08d6=[];var _0x2a29da='';var _0x32613c='';var _0x26e285={};var _0x348ee3='';return db[_0x4378('0x2a')]['findOne']({'where':{'id':_0x7899e1[_0x4378('0x49')]['id']},'attributes':['id',_0x4378('0x9b'),'password',_0x4378('0x9c'),_0x4378('0x9d'),'serverUrl']})[_0x4378('0x22')](handleEntityNotFound(_0x188142,null))['then'](function(_0x3833a8){if(_0x3833a8){_0x348ee3=_0x3833a8[_0x4378('0x9d')];var _0x30f96e=_0x348ee3[_0x4378('0x9e')](-0x1);if(_0x30f96e==='/'){_0x348ee3=_0x348ee3[_0x4378('0x9f')](0x0,_0x348ee3[_0x4378('0xa0')](_0x30f96e));}_0x32613c=util['format'](_0x4378('0xa1'),_0x348ee3);_0x2a29da=util['format'](_0x4378('0xa2'),_0x348ee3);_0x26e285={'user':_0x3833a8[_0x4378('0x9b')],'pass':_0x3833a8[_0x4378('0xa3')]};var _0x5002d5={'method':'GET','uri':_0x32613c+_0x4378('0xa4'),'auth':_0x26e285,'json':!![]};return rp(_0x5002d5);}})[_0x4378('0x22')](function(_0x20148c){if(_0x20148c[_0x4378('0xa5')]['length']>0x0){_0x2b9e75=_0x20148c['result'];}console['log']('incident\x20table\x20objects',_0x2b9e75);_0x5b08d6=[];_0x12e9b5=Object[_0x4378('0xa6')]([],_0x2b9e75);_['remove'](_0x12e9b5,function(_0x1960c0){return!_0x3c7e66[_0x4378('0xa7')](_0x1960c0['name']);});_0x12e9b5[_0x4378('0xa8')](function(_0x2bfcfd){var _0x17c578=createFieldObject(_0x2a29da,_0x26e285,_0x2bfcfd['internalType'],_0x2bfcfd[_0x4378('0x26')],_0x2bfcfd['label'],![]);_0x5b08d6['push'](_0x17c578);});return Promise[_0x4378('0xa9')](_0x5b08d6);})[_0x4378('0x22')](function(_0xc3cae3){_0x2d7afe=_0xc3cae3;_0x4b6c65=Object['assign']([],_0x2b9e75);console[_0x4378('0xaa')]('TCL:\x20_object',_0x2b9e75);_['remove'](_0x4b6c65,function(_0x1f8e4f){return _0x3ff5c1['includes'](_0x1f8e4f[_0x4378('0x26')]);});console['log'](_0x4378('0xab'),_0x4b6c65);_0x5b08d6=[];_0x4b6c65['forEach'](function(_0x4251ce){var _0x370425=createFieldObject(_0x2a29da,_0x26e285,_0x4251ce[_0x4378('0xac')],_0x4251ce[_0x4378('0x26')],_0x4251ce[_0x4378('0xad')],!![]);_0x5b08d6[_0x4378('0xae')](_0x370425);});return Promise[_0x4378('0xa9')](_0x5b08d6);})['then'](function(_0x475d6e){_0x3391ab=_0x475d6e;var _0x28ecd8=_0x2d7afe[_0x4378('0xaf')](_0x3391ab);return{'count':_0x28ecd8[_0x4378('0x35')],'rows':_0x28ecd8};})[_0x4378('0x22')](respondWithResult(_0x188142,null))[_0x4378('0x46')](function(_0xff0942){console['log'](_0x4378('0xb0')+_0xff0942);var _0x4e591f=_0x7899e1['query'][_0x4378('0xb1')]?0x1f4:_0xff0942[_0x4378('0xb2')]||0x1f4;logger[_0x4378('0x24')](_0xff0942[_0x4378('0x25')]);delete _0xff0942[_0x4378('0x26')];if(_0x4e591f===0x191){_0x4e591f=0x190;}_0x188142[_0x4378('0x17')](_0x4e591f)['send'](_0x7899e1['query'][_0x4378('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0xff0942[_0x4378('0xb2')]}:_0xff0942);});};function createFieldObject(_0xba89ee,_0x41c4ec,_0x8a9f62,_0x302898,_0x4432b2,_0x2df883){return new Promise(function(_0x285d2c,_0x29ef19){var _0x1917e4={'id':_0x302898,'name':_0x4432b2,'custom':_0x2df883};if(_0x8a9f62===_0x4378('0xb3')){_0x1917e4[_0x4378('0x3e')]=[{'name':_0x4378('0xb4'),'value':_0x4378('0xb5')},{'name':_0x4378('0xb6'),'value':_0x4378('0xb7')}];_0x285d2c(_0x1917e4);}else{var _0x8ea302={'method':_0x4378('0xb8'),'uri':_0xba89ee+_0x4378('0xb9')+_0x302898,'auth':_0x41c4ec,'json':!![]};return rp(_0x8ea302)[_0x4378('0x22')](function(_0x3ea34e){var _0x4aeda2=[];if(_0x3ea34e[_0x4378('0xa5')]['length']>0x0){_0x3ea34e[_0x4378('0xa5')][_0x4378('0xa8')](function(_0x49ef15){if(_0x49ef15[_0x4378('0xba')]==='false'){var _0x148647={'name':_0x49ef15[_0x4378('0xad')],'value':_0x49ef15['value']};_0x4aeda2[_0x4378('0xae')](_0x148647);}});}_0x1917e4['options']=_0x4aeda2;if(_0x1917e4[_0x4378('0x3e')][_0x4378('0x35')]>0x0){_0x285d2c(_0x1917e4);}else{if(_0x2df883==![]){_0x285d2c();}else{_0x285d2c(_0x1917e4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e8bec5b..3b3e834 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x2081aa,_0x31d653){var _0x36485d=function(_0x4381f5){while(--_0x4381f5){_0x2081aa['push'](_0x2081aa['shift']());}};_0x36485d(++_0x31d653);}(_0x5fab,0x177));var _0xb5fa=function(_0x5be1ac,_0x5ee1f4){_0x5be1ac=_0x5be1ac-0x0;var _0x21b996=_0x5fab[_0x5be1ac];return _0x21b996;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x1b903e,_0x1fd908){var _0x37c2f9=function(_0x254847){while(--_0x254847){_0x1b903e['push'](_0x1b903e['shift']());}};_0x37c2f9(++_0x1fd908);}(_0x038b,0x114));var _0xb038=function(_0x3f834c,_0x6d5b8c){_0x3f834c=_0x3f834c-0x0;var _0x42ee4a=_0x038b[_0x3f834c];return _0x42ee4a;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f5d0829..aead688 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 _0x6558=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','where','debug','lodash','moment','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6558,0x15b));var _0x8655=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x6558[_0x359bbe];return _0x1b3353;};'use strict';var _=require(_0x8655('0x0'));var util=require('util');var moment=require(_0x8655('0x1'));var BPromise=require('bluebird');var rs=require(_0x8655('0x2'));var fs=require('fs');var Redis=require(_0x8655('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8655('0x4'));var logger=require(_0x8655('0x5'))(_0x8655('0x6'));var config=require(_0x8655('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8655('0x8')][_0x8655('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51b684,_0x39040e,_0x36ebf1){return new BPromise(function(_0xd06570,_0x3160b2){return client[_0x8655('0xa')](_0x51b684,_0x36ebf1)[_0x8655('0xb')](function(_0x2f7d26){logger[_0x8655('0xc')](_0x8655('0xd'),_0x39040e,_0x8655('0xe'));logger['debug'](_0x8655('0xf'),_0x39040e,_0x8655('0xe'),JSON[_0x8655('0x10')](_0x2f7d26));if(_0x2f7d26[_0x8655('0x11')]){if(_0x2f7d26[_0x8655('0x11')][_0x8655('0x12')]===0x1f4){logger[_0x8655('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x39040e,_0x2f7d26[_0x8655('0x11')][_0x8655('0x13')]);return _0x3160b2(_0x2f7d26[_0x8655('0x11')]['message']);}logger[_0x8655('0x11')](_0x8655('0xd'),_0x39040e,_0x2f7d26[_0x8655('0x11')][_0x8655('0x13')]);return _0xd06570(_0x2f7d26[_0x8655('0x11')][_0x8655('0x13')]);}else{logger[_0x8655('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x39040e,_0x8655('0xe'));_0xd06570(_0x2f7d26[_0x8655('0x14')][_0x8655('0x13')]);}})[_0x8655('0x15')](function(_0x2defb2){logger[_0x8655('0x11')](_0x8655('0xd'),_0x39040e,_0x2defb2);_0x3160b2(_0x2defb2);});});}exports[_0x8655('0x16')]=function(_0x25c73a){var _0x2720aa=this;return new Promise(function(_0x45689b,_0x18a7db){return db['ServicenowAccount'][_0x8655('0x17')]({'raw':_0x25c73a[_0x8655('0x18')]?_0x25c73a['options'][_0x8655('0x19')]===undefined?!![]:![]:!![],'where':_0x25c73a[_0x8655('0x18')]?_0x25c73a[_0x8655('0x18')]['where']||null:null,'attributes':_0x25c73a[_0x8655('0x18')]?_0x25c73a[_0x8655('0x18')][_0x8655('0x1a')]||null:null,'limit':_0x25c73a[_0x8655('0x18')]?_0x25c73a['options'][_0x8655('0x1b')]||null:null,'include':_0x25c73a[_0x8655('0x18')]?_0x25c73a['options'][_0x8655('0x1c')]?_[_0x8655('0x1d')](_0x25c73a[_0x8655('0x18')]['include'],function(_0x49b0ad){return{'model':db[_0x49b0ad['model']],'as':_0x49b0ad['as'],'attributes':_0x49b0ad[_0x8655('0x1a')],'include':_0x49b0ad[_0x8655('0x1c')]?_[_0x8655('0x1d')](_0x49b0ad['include'],function(_0xb4590e){return{'model':db[_0xb4590e[_0x8655('0x1e')]],'as':_0xb4590e['as'],'attributes':_0xb4590e[_0x8655('0x1a')],'include':_0xb4590e[_0x8655('0x1c')]?_[_0x8655('0x1d')](_0xb4590e[_0x8655('0x1c')],function(_0x106f40){return{'model':db[_0x106f40[_0x8655('0x1e')]],'as':_0x106f40['as'],'attributes':_0x106f40[_0x8655('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8655('0xb')](function(_0x294fb5){logger['info'](_0x8655('0x16'),_0x25c73a);logger['debug'](_0x8655('0x16'),_0x25c73a,JSON[_0x8655('0x10')](_0x294fb5));_0x45689b(_0x294fb5);})[_0x8655('0x15')](function(_0x551e14){logger[_0x8655('0x11')]('GetServicenowAccount',_0x551e14[_0x8655('0x13')],_0x25c73a);_0x18a7db(_0x2720aa['error'](0x1f4,_0x551e14[_0x8655('0x13')]));});});};exports[_0x8655('0x1f')]=function(_0x50afee){var _0x338649=this;return new Promise(function(_0x1a76cb,_0x4dcc32){return db['ServicenowAccount'][_0x8655('0x20')]({'raw':_0x50afee['options']?_0x50afee[_0x8655('0x18')][_0x8655('0x19')]===undefined?!![]:![]:!![],'where':_0x50afee['options']?_0x50afee[_0x8655('0x18')][_0x8655('0x21')]||null:null,'attributes':_0x50afee[_0x8655('0x18')]?_0x50afee['options'][_0x8655('0x1a')]||null:null,'include':_0x50afee['options']?_0x50afee[_0x8655('0x18')][_0x8655('0x1c')]?_[_0x8655('0x1d')](_0x50afee[_0x8655('0x18')][_0x8655('0x1c')],function(_0x5626f2){return{'model':db[_0x5626f2[_0x8655('0x1e')]],'as':_0x5626f2['as'],'attributes':_0x5626f2[_0x8655('0x1a')],'include':_0x5626f2[_0x8655('0x1c')]?_['map'](_0x5626f2[_0x8655('0x1c')],function(_0x19a246){return{'model':db[_0x19a246[_0x8655('0x1e')]],'as':_0x19a246['as'],'attributes':_0x19a246[_0x8655('0x1a')],'include':_0x19a246['include']?_[_0x8655('0x1d')](_0x19a246['include'],function(_0x50a4ec){return{'model':db[_0x50a4ec['model']],'as':_0x50a4ec['as'],'attributes':_0x50a4ec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x393ad4){logger[_0x8655('0xc')](_0x8655('0x1f'),_0x50afee);logger[_0x8655('0x22')](_0x8655('0x1f'),_0x50afee,JSON[_0x8655('0x10')](_0x393ad4));_0x1a76cb(_0x393ad4);})[_0x8655('0x15')](function(_0x3ddf35){logger[_0x8655('0x11')](_0x8655('0x1f'),_0x3ddf35[_0x8655('0x13')],_0x50afee);_0x4dcc32(_0x338649[_0x8655('0x11')](0x1f4,_0x3ddf35[_0x8655('0x13')]));});});}; \ No newline at end of file +var _0x4be4=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','include','map','model','stringify','ShowServicenowAccount','find'];(function(_0x3e24e6,_0x4ab96d){var _0x2ad918=function(_0x446335){while(--_0x446335){_0x3e24e6['push'](_0x3e24e6['shift']());}};_0x2ad918(++_0x4ab96d);}(_0x4be4,0xa0));var _0x44be=function(_0x164e33,_0x60026){_0x164e33=_0x164e33-0x0;var _0x3b9eb5=_0x4be4[_0x164e33];return _0x3b9eb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44be('0x0'));var BPromise=require('bluebird');var rs=require(_0x44be('0x1'));var fs=require('fs');var Redis=require(_0x44be('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x44be('0x3'));var logger=require(_0x44be('0x4'))(_0x44be('0x5'));var config=require(_0x44be('0x6'));var jayson=require(_0x44be('0x7'));var client=jayson[_0x44be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x299345,_0x215a43,_0x2209d4){return new BPromise(function(_0x4912f3,_0x1793c2){return client['request'](_0x299345,_0x2209d4)[_0x44be('0x9')](function(_0x55dfe6){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x215a43,_0x44be('0xa'));logger[_0x44be('0xb')](_0x44be('0xc'),_0x215a43,_0x44be('0xa'),JSON['stringify'](_0x55dfe6));if(_0x55dfe6['error']){if(_0x55dfe6[_0x44be('0xd')][_0x44be('0xe')]===0x1f4){logger[_0x44be('0xd')](_0x44be('0xf'),_0x215a43,_0x55dfe6[_0x44be('0xd')]['message']);return _0x1793c2(_0x55dfe6[_0x44be('0xd')][_0x44be('0x10')]);}logger[_0x44be('0xd')](_0x44be('0xf'),_0x215a43,_0x55dfe6[_0x44be('0xd')][_0x44be('0x10')]);return _0x4912f3(_0x55dfe6[_0x44be('0xd')]['message']);}else{logger[_0x44be('0x11')](_0x44be('0xf'),_0x215a43,_0x44be('0xa'));_0x4912f3(_0x55dfe6[_0x44be('0x12')][_0x44be('0x10')]);}})[_0x44be('0x13')](function(_0x3c8503){logger['error'](_0x44be('0xf'),_0x215a43,_0x3c8503);_0x1793c2(_0x3c8503);});});}exports[_0x44be('0x14')]=function(_0x12e06e){var _0x472079=this;return new Promise(function(_0x11e710,_0x69aff8){return db[_0x44be('0x15')][_0x44be('0x16')]({'raw':_0x12e06e['options']?_0x12e06e[_0x44be('0x17')][_0x44be('0x18')]===undefined?!![]:![]:!![],'where':_0x12e06e[_0x44be('0x17')]?_0x12e06e['options']['where']||null:null,'attributes':_0x12e06e[_0x44be('0x17')]?_0x12e06e['options'][_0x44be('0x19')]||null:null,'limit':_0x12e06e[_0x44be('0x17')]?_0x12e06e[_0x44be('0x17')]['limit']||null:null,'include':_0x12e06e['options']?_0x12e06e[_0x44be('0x17')][_0x44be('0x1a')]?_[_0x44be('0x1b')](_0x12e06e[_0x44be('0x17')]['include'],function(_0x5207db){return{'model':db[_0x5207db[_0x44be('0x1c')]],'as':_0x5207db['as'],'attributes':_0x5207db[_0x44be('0x19')],'include':_0x5207db[_0x44be('0x1a')]?_['map'](_0x5207db['include'],function(_0x3130c1){return{'model':db[_0x3130c1[_0x44be('0x1c')]],'as':_0x3130c1['as'],'attributes':_0x3130c1[_0x44be('0x19')],'include':_0x3130c1['include']?_[_0x44be('0x1b')](_0x3130c1[_0x44be('0x1a')],function(_0x4bca9b){return{'model':db[_0x4bca9b['model']],'as':_0x4bca9b['as'],'attributes':_0x4bca9b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x100f8b){logger[_0x44be('0x11')]('GetServicenowAccount',_0x12e06e);logger['debug']('GetServicenowAccount',_0x12e06e,JSON[_0x44be('0x1d')](_0x100f8b));_0x11e710(_0x100f8b);})[_0x44be('0x13')](function(_0xe6972){logger['error']('GetServicenowAccount',_0xe6972[_0x44be('0x10')],_0x12e06e);_0x69aff8(_0x472079[_0x44be('0xd')](0x1f4,_0xe6972[_0x44be('0x10')]));});});};exports[_0x44be('0x1e')]=function(_0x3893e5){var _0x3e4330=this;return new Promise(function(_0x4e64e1,_0x3d13c4){return db[_0x44be('0x15')][_0x44be('0x1f')]({'raw':_0x3893e5[_0x44be('0x17')]?_0x3893e5['options'][_0x44be('0x18')]===undefined?!![]:![]:!![],'where':_0x3893e5[_0x44be('0x17')]?_0x3893e5[_0x44be('0x17')]['where']||null:null,'attributes':_0x3893e5[_0x44be('0x17')]?_0x3893e5[_0x44be('0x17')]['attributes']||null:null,'include':_0x3893e5['options']?_0x3893e5[_0x44be('0x17')][_0x44be('0x1a')]?_[_0x44be('0x1b')](_0x3893e5[_0x44be('0x17')][_0x44be('0x1a')],function(_0x178db2){return{'model':db[_0x178db2[_0x44be('0x1c')]],'as':_0x178db2['as'],'attributes':_0x178db2[_0x44be('0x19')],'include':_0x178db2[_0x44be('0x1a')]?_[_0x44be('0x1b')](_0x178db2[_0x44be('0x1a')],function(_0x31fe29){return{'model':db[_0x31fe29[_0x44be('0x1c')]],'as':_0x31fe29['as'],'attributes':_0x31fe29[_0x44be('0x19')],'include':_0x31fe29[_0x44be('0x1a')]?_[_0x44be('0x1b')](_0x31fe29[_0x44be('0x1a')],function(_0x212b93){return{'model':db[_0x212b93[_0x44be('0x1c')]],'as':_0x212b93['as'],'attributes':_0x212b93[_0x44be('0x19')]};}):[]};}):[]};}):[]:[]})[_0x44be('0x9')](function(_0x1226ac){logger[_0x44be('0x11')](_0x44be('0x1e'),_0x3893e5);logger['debug']('ShowServicenowAccount',_0x3893e5,JSON[_0x44be('0x1d')](_0x1226ac));_0x4e64e1(_0x1226ac);})['catch'](function(_0x186bc3){logger[_0x44be('0xd')](_0x44be('0x1e'),_0x186bc3[_0x44be('0x10')],_0x3893e5);_0x3d13c4(_0x3e4330[_0x44be('0xd')](0x1f4,_0x186bc3[_0x44be('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1acc853..9e96a33 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 _0x11ce=['../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x30e25c,_0x355276){var _0x47959b=function(_0x2f9417){while(--_0x2f9417){_0x30e25c['push'](_0x30e25c['shift']());}};_0x47959b(++_0x355276);}(_0x11ce,0x10c));var _0xe11c=function(_0x378715,_0x14a8fb){_0x378715=_0x378715-0x0;var _0x1595b9=_0x11ce[_0x378715];return _0x1595b9;};'use strict';var multer=require(_0xe11c('0x0'));var util=require('util');var path=require(_0xe11c('0x1'));var timeout=require(_0xe11c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe11c('0x3'));var auth=require(_0xe11c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe11c('0x5'));var controller=require(_0xe11c('0x6'));router[_0xe11c('0x7')]('/',auth[_0xe11c('0x8')](),controller[_0xe11c('0x9')]);router[_0xe11c('0x7')]('/:id',auth[_0xe11c('0x8')](),controller[_0xe11c('0xa')]);router[_0xe11c('0x7')](_0xe11c('0xb'),auth['isAuthenticated'](),controller[_0xe11c('0xc')]);router[_0xe11c('0x7')](_0xe11c('0xd'),auth[_0xe11c('0x8')](),controller['getSubjects']);router[_0xe11c('0x7')]('/:id/descriptions',auth[_0xe11c('0x8')](),controller[_0xe11c('0xe')]);router['post']('/',auth[_0xe11c('0x8')](),controller[_0xe11c('0xf')]);router[_0xe11c('0x10')]('/:id',auth[_0xe11c('0x8')](),controller[_0xe11c('0x11')]);router['delete'](_0xe11c('0x12'),auth[_0xe11c('0x8')](),controller[_0xe11c('0x13')]);module[_0xe11c('0x14')]=router; \ No newline at end of file +var _0xacba=['/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getFields','getSubjects'];(function(_0x19a43c,_0x56d4f6){var _0x1119be=function(_0x3dd74a){while(--_0x3dd74a){_0x19a43c['push'](_0x19a43c['shift']());}};_0x1119be(++_0x56d4f6);}(_0xacba,0x1ea));var _0xaacb=function(_0x5a65a6,_0x34ab9d){_0x5a65a6=_0x5a65a6-0x0;var _0x1f9091=_0xacba[_0x5a65a6];return _0x1f9091;};'use strict';var multer=require(_0xaacb('0x0'));var util=require(_0xaacb('0x1'));var path=require('path');var timeout=require(_0xaacb('0x2'));var express=require(_0xaacb('0x3'));var router=express[_0xaacb('0x4')]();var fs_extra=require(_0xaacb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaacb('0x6'));var config=require(_0xaacb('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xaacb('0x8')]('/',auth[_0xaacb('0x9')](),controller[_0xaacb('0xa')]);router[_0xaacb('0x8')](_0xaacb('0xb'),auth[_0xaacb('0x9')](),controller['show']);router[_0xaacb('0x8')]('/:id/fields',auth[_0xaacb('0x9')](),controller[_0xaacb('0xc')]);router[_0xaacb('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaacb('0xd')]);router[_0xaacb('0x8')](_0xaacb('0xe'),auth['isAuthenticated'](),controller[_0xaacb('0xf')]);router[_0xaacb('0x10')]('/',auth[_0xaacb('0x9')](),controller['create']);router['put'](_0xaacb('0xb'),auth[_0xaacb('0x9')](),controller[_0xaacb('0x11')]);router[_0xaacb('0x12')](_0xaacb('0xb'),auth[_0xaacb('0x9')](),controller[_0xaacb('0x13')]);module[_0xaacb('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 ca32e1f..470d57f 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 _0xaeb6=['sequelize','exports','STRING'];(function(_0x21f3eb,_0x5d088a){var _0x5742aa=function(_0x5eab68){while(--_0x5eab68){_0x21f3eb['push'](_0x21f3eb['shift']());}};_0x5742aa(++_0x5d088a);}(_0xaeb6,0x69));var _0x6aeb=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xaeb6[_0x2e7a43];return _0x52e9e1;};'use strict';var Sequelize=require(_0x6aeb('0x0'));module[_0x6aeb('0x1')]={'name':{'type':Sequelize[_0x6aeb('0x2')]},'description':{'type':Sequelize[_0x6aeb('0x2')]}}; \ No newline at end of file +var _0xaebc=['sequelize','STRING'];(function(_0x54a9b3,_0x416abf){var _0x5c47f2=function(_0x1d2cd5){while(--_0x1d2cd5){_0x54a9b3['push'](_0x54a9b3['shift']());}};_0x5c47f2(++_0x416abf);}(_0xaebc,0x1a6));var _0xcaeb=function(_0x51f84a,_0x445f17){_0x51f84a=_0x51f84a-0x0;var _0x4ba63d=_0xaebc[_0x51f84a];return _0x4ba63d;};'use strict';var Sequelize=require(_0xcaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xcaeb('0x1')]},'description':{'type':Sequelize[_0xcaeb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d98687f..eeeab12 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 _0x912c=['util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','save','then','error','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowConfiguration','includeAll','include','rows','catch','params','options','find','create','body','update','destroy','getFields','ServicenowField','rawAttributes','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x13987c,_0xec9c9f){var _0x55582c=function(_0x6bce92){while(--_0x6bce92){_0x13987c['push'](_0x13987c['shift']());}};_0x55582c(++_0xec9c9f);}(_0x912c,0x94));var _0xc912=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x912c[_0x2d982d];return _0x4f36b0;};'use strict';var emlformat=require(_0xc912('0x0'));var rimraf=require(_0xc912('0x1'));var zipdir=require(_0xc912('0x2'));var jsonpatch=require(_0xc912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc912('0x4'));var Mustache=require(_0xc912('0x5'));var util=require(_0xc912('0x6'));var path=require(_0xc912('0x7'));var sox=require(_0xc912('0x8'));var csv=require('to-csv');var ejs=require(_0xc912('0x9'));var fs=require('fs');var fs_extra=require(_0xc912('0xa'));var _=require(_0xc912('0xb'));var squel=require(_0xc912('0xc'));var crypto=require('crypto');var jsforce=require(_0xc912('0xd'));var deskjs=require(_0xc912('0xe'));var toCsv=require(_0xc912('0xf'));var querystring=require(_0xc912('0x10'));var Papa=require(_0xc912('0x11'));var Redis=require(_0xc912('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc912('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc912('0x14'))('api');var utils=require(_0xc912('0x15'));var config=require(_0xc912('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc912('0x17'))['db'];function respondWithStatusCode(_0x290f00,_0x127088){_0x127088=_0x127088||0xcc;return function(_0x47a3a9){if(_0x47a3a9){return _0x290f00[_0xc912('0x18')](_0x127088);}return _0x290f00[_0xc912('0x19')](_0x127088)['end']();};}function respondWithResult(_0x5cbfe2,_0x26238a){_0x26238a=_0x26238a||0xc8;return function(_0x310d90){if(_0x310d90){return _0x5cbfe2['status'](_0x26238a)[_0xc912('0x1a')](_0x310d90);}};}function respondWithFilteredResult(_0x435839,_0x12d0b5){return function(_0x5f1d48){if(_0x5f1d48){var _0x5e0a34=typeof _0x12d0b5[_0xc912('0x1b')]==='undefined'&&typeof _0x12d0b5[_0xc912('0x1c')]==='undefined';var _0x1c4f7d=_0x5f1d48[_0xc912('0x1d')];var _0x1bda7d=_0x5e0a34?0x0:_0x12d0b5['offset'];var _0x1153a6=_0x5e0a34?_0x5f1d48[_0xc912('0x1d')]:_0x12d0b5['offset']+_0x12d0b5['limit'];var _0x510f96;if(_0x1153a6>=_0x1c4f7d){_0x1153a6=_0x1c4f7d;_0x510f96=0xc8;}else{_0x510f96=0xce;}_0x435839[_0xc912('0x19')](_0x510f96);return _0x435839[_0xc912('0x1e')]('Content-Range',_0x1bda7d+'-'+_0x1153a6+'/'+_0x1c4f7d)[_0xc912('0x1a')](_0x5f1d48);}return null;};}function patchUpdates(_0x465198){return function(_0x34c2e0){try{jsonpatch[_0xc912('0x1f')](_0x34c2e0,_0x465198,!![]);}catch(_0x5057ce){return BPromise[_0xc912('0x20')](_0x5057ce);}return _0x34c2e0[_0xc912('0x21')]();};}function saveUpdates(_0x2b80bc,_0x48ddf2){return function(_0x4b128d){if(_0x4b128d){return _0x4b128d['update'](_0x2b80bc)[_0xc912('0x22')](function(_0x1291d0){return _0x1291d0;});}return null;};}function removeEntity(_0x4b1960,_0xd9c46){return function(_0x3e101c){if(_0x3e101c){return _0x3e101c['destroy']()['then'](function(){_0x4b1960[_0xc912('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a641,_0x291f8d){return function(_0x5da340){if(!_0x5da340){_0x35a641[_0xc912('0x18')](0x194);}return _0x5da340;};}function handleError(_0x1fb9de,_0x5bd988){_0x5bd988=_0x5bd988||0x1f4;return function(_0x2aedd0){logger[_0xc912('0x23')](_0x2aedd0[_0xc912('0x24')]);if(_0x2aedd0[_0xc912('0x25')]){delete _0x2aedd0[_0xc912('0x25')];}_0x1fb9de[_0xc912('0x19')](_0x5bd988)['send'](_0x2aedd0);};}exports[_0xc912('0x26')]=function(_0x37cb12,_0x16b7bd){var _0x1326ad={},_0x3a0f2b={},_0x1bd049={'count':0x0,'rows':[]};var _0x44f4d6=_[_0xc912('0x27')](db['ServicenowConfiguration']['rawAttributes'],function(_0x1ff580){return{'name':_0x1ff580[_0xc912('0x28')],'type':_0x1ff580[_0xc912('0x29')]['key']};});_0x3a0f2b[_0xc912('0x2a')]=_[_0xc912('0x27')](_0x44f4d6,_0xc912('0x25'));_0x3a0f2b[_0xc912('0x2b')]=_[_0xc912('0x2c')](_0x37cb12[_0xc912('0x2b')]);_0x3a0f2b[_0xc912('0x2d')]=_[_0xc912('0x2e')](_0x3a0f2b['model'],_0x3a0f2b['query']);_0x1326ad['attributes']=_['intersection'](_0x3a0f2b[_0xc912('0x2a')],qs['fields'](_0x37cb12[_0xc912('0x2b')][_0xc912('0x2f')]));_0x1326ad['attributes']=_0x1326ad[_0xc912('0x30')][_0xc912('0x31')]?_0x1326ad[_0xc912('0x30')]:_0x3a0f2b[_0xc912('0x2a')];if(!_0x37cb12[_0xc912('0x2b')][_0xc912('0x32')](_0xc912('0x33'))){_0x1326ad[_0xc912('0x1c')]=qs[_0xc912('0x1c')](_0x37cb12[_0xc912('0x2b')]['limit']);_0x1326ad['offset']=qs[_0xc912('0x1b')](_0x37cb12[_0xc912('0x2b')][_0xc912('0x1b')]);}_0x1326ad[_0xc912('0x34')]=qs[_0xc912('0x35')](_0x37cb12[_0xc912('0x2b')][_0xc912('0x35')]);_0x1326ad[_0xc912('0x36')]=qs[_0xc912('0x2d')](_[_0xc912('0x37')](_0x37cb12[_0xc912('0x2b')],_0x3a0f2b[_0xc912('0x2d')]),_0x44f4d6);if(_0x37cb12[_0xc912('0x2b')][_0xc912('0x38')]){_0x1326ad['where']=_[_0xc912('0x39')](_0x1326ad[_0xc912('0x36')],{'$or':_['map'](_0x44f4d6,function(_0x1b3786){if(_0x1b3786[_0xc912('0x29')]!==_0xc912('0x3a')){var _0x16c9fa={};_0x16c9fa[_0x1b3786['name']]={'$like':'%'+_0x37cb12['query']['filter']+'%'};return _0x16c9fa;}})});}_0x1326ad=_['merge']({},_0x1326ad,_0x37cb12['options']);var _0x53afc8={'where':_0x1326ad[_0xc912('0x36')]};return db[_0xc912('0x3b')]['count'](_0x53afc8)[_0xc912('0x22')](function(_0x496730){_0x1bd049[_0xc912('0x1d')]=_0x496730;if(_0x37cb12[_0xc912('0x2b')][_0xc912('0x3c')]){_0x1326ad[_0xc912('0x3d')]=[{'all':!![]}];}return db[_0xc912('0x3b')]['findAll'](_0x1326ad);})['then'](function(_0x2d1c4e){_0x1bd049[_0xc912('0x3e')]=_0x2d1c4e;return _0x1bd049;})[_0xc912('0x22')](respondWithFilteredResult(_0x16b7bd,_0x1326ad))[_0xc912('0x3f')](handleError(_0x16b7bd,null));};exports['show']=function(_0x898773,_0xe0ea87){var _0x3b3d37={'raw':![],'where':{'id':_0x898773[_0xc912('0x40')]['id']}},_0x3663a9={};_0x3663a9['model']=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x3663a9[_0xc912('0x2b')]=_['keys'](_0x898773[_0xc912('0x2b')]);_0x3663a9[_0xc912('0x2d')]=_[_0xc912('0x2e')](_0x3663a9[_0xc912('0x2a')],_0x3663a9[_0xc912('0x2b')]);_0x3b3d37[_0xc912('0x30')]=_[_0xc912('0x2e')](_0x3663a9[_0xc912('0x2a')],qs['fields'](_0x898773[_0xc912('0x2b')]['fields']));_0x3b3d37[_0xc912('0x30')]=_0x3b3d37[_0xc912('0x30')]['length']?_0x3b3d37['attributes']:_0x3663a9['model'];if(_0x898773[_0xc912('0x2b')][_0xc912('0x3c')]){_0x3b3d37[_0xc912('0x3d')]=[{'all':!![]}];}_0x3b3d37=_[_0xc912('0x39')]({},_0x3b3d37,_0x898773[_0xc912('0x41')]);return db[_0xc912('0x3b')][_0xc912('0x42')](_0x3b3d37)[_0xc912('0x22')](handleEntityNotFound(_0xe0ea87,null))[_0xc912('0x22')](respondWithResult(_0xe0ea87,null))[_0xc912('0x3f')](handleError(_0xe0ea87,null));};exports[_0xc912('0x43')]=function(_0x3a3010,_0x12f4aa){return db[_0xc912('0x3b')][_0xc912('0x43')](_0x3a3010[_0xc912('0x44')],{})[_0xc912('0x22')](respondWithResult(_0x12f4aa,0xc9))[_0xc912('0x3f')](handleError(_0x12f4aa,null));};exports[_0xc912('0x45')]=function(_0x2af7f7,_0x14d641){if(_0x2af7f7[_0xc912('0x44')]['id']){delete _0x2af7f7[_0xc912('0x44')]['id'];}return db[_0xc912('0x3b')][_0xc912('0x42')]({'where':{'id':_0x2af7f7[_0xc912('0x40')]['id']}})[_0xc912('0x22')](handleEntityNotFound(_0x14d641,null))[_0xc912('0x22')](saveUpdates(_0x2af7f7['body'],null))['then'](respondWithResult(_0x14d641,null))[_0xc912('0x3f')](handleError(_0x14d641,null));};exports[_0xc912('0x46')]=function(_0x5de9d9,_0x214a51){return db['ServicenowConfiguration'][_0xc912('0x42')]({'where':{'id':_0x5de9d9[_0xc912('0x40')]['id']}})[_0xc912('0x22')](handleEntityNotFound(_0x214a51,null))[_0xc912('0x22')](removeEntity(_0x214a51,null))['catch'](handleError(_0x214a51,null));};exports[_0xc912('0x47')]=function(_0x350b9f,_0x1a18f8,_0x2167ff){var _0x5e6b09={};var _0x54a53f={};var _0x8efc17;var _0x62e558;return db[_0xc912('0x3b')]['findOne']({'where':{'id':_0x350b9f[_0xc912('0x40')]['id']}})[_0xc912('0x22')](handleEntityNotFound(_0x1a18f8,null))[_0xc912('0x22')](function(_0x4e9ddf){if(_0x4e9ddf){_0x8efc17=_0x4e9ddf;_0x54a53f[_0xc912('0x2a')]=_[_0xc912('0x2c')](db[_0xc912('0x48')][_0xc912('0x49')]);_0x54a53f['query']=_['keys'](_0x350b9f[_0xc912('0x2b')]);_0x54a53f[_0xc912('0x2d')]=_['intersection'](_0x54a53f['model'],_0x54a53f[_0xc912('0x2b')]);_0x5e6b09[_0xc912('0x30')]=_['intersection'](_0x54a53f[_0xc912('0x2a')],qs[_0xc912('0x2f')](_0x350b9f[_0xc912('0x2b')]['fields']));_0x5e6b09['attributes']=_0x5e6b09[_0xc912('0x30')][_0xc912('0x31')]?_0x5e6b09[_0xc912('0x30')]:_0x54a53f['model'];_0x5e6b09['order']=qs[_0xc912('0x35')](_0x350b9f[_0xc912('0x2b')][_0xc912('0x35')]);_0x5e6b09[_0xc912('0x36')]=qs[_0xc912('0x2d')](_['pick'](_0x350b9f[_0xc912('0x2b')],_0x54a53f[_0xc912('0x2d')]));if(_0x350b9f[_0xc912('0x2b')][_0xc912('0x38')]){_0x5e6b09[_0xc912('0x36')]=_[_0xc912('0x39')](_0x5e6b09[_0xc912('0x36')],{'$or':_[_0xc912('0x27')](_0x5e6b09['attributes'],function(_0xaa13a7){var _0x1c6a88={};_0x1c6a88[_0xaa13a7]={'$like':'%'+_0x350b9f[_0xc912('0x2b')][_0xc912('0x38')]+'%'};return _0x1c6a88;})});}_0x5e6b09=_[_0xc912('0x39')]({},_0x5e6b09,_0x350b9f['options']);return _0x8efc17[_0xc912('0x47')](_0x5e6b09);}})[_0xc912('0x22')](function(_0x49fdf4){if(_0x49fdf4){_0x62e558=_0x49fdf4['length'];if(!_0x350b9f['query'][_0xc912('0x32')](_0xc912('0x33'))){_0x5e6b09[_0xc912('0x1c')]=qs[_0xc912('0x1c')](_0x350b9f[_0xc912('0x2b')][_0xc912('0x1c')]);_0x5e6b09[_0xc912('0x1b')]=qs[_0xc912('0x1b')](_0x350b9f[_0xc912('0x2b')][_0xc912('0x1b')]);}return _0x8efc17[_0xc912('0x47')](_0x5e6b09);}})['then'](function(_0x828b83){if(_0x828b83){return _0x828b83?{'count':_0x62e558,'rows':_0x828b83}:null;}})[_0xc912('0x22')](respondWithResult(_0x1a18f8,null))['catch'](handleError(_0x1a18f8,null));};exports['getSubjects']=function(_0x560255,_0x3909fb,_0x4c222d){var _0x52d385={};var _0x349345={};var _0x5e6a0a;var _0x1715c6;return db[_0xc912('0x3b')][_0xc912('0x4a')]({'where':{'id':_0x560255['params']['id']}})[_0xc912('0x22')](handleEntityNotFound(_0x3909fb,null))['then'](function(_0x451aa8){if(_0x451aa8){_0x5e6a0a=_0x451aa8;_0x349345[_0xc912('0x2a')]=_[_0xc912('0x2c')](db['ServicenowField']['rawAttributes']);_0x349345[_0xc912('0x2b')]=_[_0xc912('0x2c')](_0x560255['query']);_0x349345[_0xc912('0x2d')]=_[_0xc912('0x2e')](_0x349345[_0xc912('0x2a')],_0x349345[_0xc912('0x2b')]);_0x52d385[_0xc912('0x30')]=_[_0xc912('0x2e')](_0x349345['model'],qs[_0xc912('0x2f')](_0x560255['query']['fields']));_0x52d385[_0xc912('0x30')]=_0x52d385[_0xc912('0x30')]['length']?_0x52d385[_0xc912('0x30')]:_0x349345[_0xc912('0x2a')];_0x52d385[_0xc912('0x34')]=qs[_0xc912('0x35')](_0x560255[_0xc912('0x2b')][_0xc912('0x35')]);_0x52d385[_0xc912('0x36')]=qs[_0xc912('0x2d')](_[_0xc912('0x37')](_0x560255['query'],_0x349345['filters']));if(_0x560255[_0xc912('0x2b')]['filter']){_0x52d385[_0xc912('0x36')]=_[_0xc912('0x39')](_0x52d385[_0xc912('0x36')],{'$or':_[_0xc912('0x27')](_0x52d385[_0xc912('0x30')],function(_0x1c12c4){var _0x30da7d={};_0x30da7d[_0x1c12c4]={'$like':'%'+_0x560255[_0xc912('0x2b')]['filter']+'%'};return _0x30da7d;})});}_0x52d385=_[_0xc912('0x39')]({},_0x52d385,_0x560255[_0xc912('0x41')]);return _0x5e6a0a['getSubjects'](_0x52d385);}})[_0xc912('0x22')](function(_0x985fd3){if(_0x985fd3){_0x1715c6=_0x985fd3['length'];if(!_0x560255[_0xc912('0x2b')][_0xc912('0x32')]('nolimit')){_0x52d385['limit']=qs['limit'](_0x560255[_0xc912('0x2b')][_0xc912('0x1c')]);_0x52d385[_0xc912('0x1b')]=qs['offset'](_0x560255[_0xc912('0x2b')]['offset']);}return _0x5e6a0a[_0xc912('0x4b')](_0x52d385);}})[_0xc912('0x22')](function(_0x5e877a){if(_0x5e877a){return _0x5e877a?{'count':_0x1715c6,'rows':_0x5e877a}:null;}})['then'](respondWithResult(_0x3909fb,null))['catch'](handleError(_0x3909fb,null));};exports[_0xc912('0x4c')]=function(_0x2f7b38,_0x475146,_0x1ebd79){var _0x5ace8c={};var _0x566912={};var _0x14c347;var _0x54d8a8;return db[_0xc912('0x3b')][_0xc912('0x4a')]({'where':{'id':_0x2f7b38[_0xc912('0x40')]['id']}})[_0xc912('0x22')](handleEntityNotFound(_0x475146,null))[_0xc912('0x22')](function(_0x444353){if(_0x444353){_0x14c347=_0x444353;_0x566912[_0xc912('0x2a')]=_['keys'](db[_0xc912('0x48')]['rawAttributes']);_0x566912[_0xc912('0x2b')]=_['keys'](_0x2f7b38['query']);_0x566912[_0xc912('0x2d')]=_[_0xc912('0x2e')](_0x566912[_0xc912('0x2a')],_0x566912[_0xc912('0x2b')]);_0x5ace8c['attributes']=_[_0xc912('0x2e')](_0x566912[_0xc912('0x2a')],qs['fields'](_0x2f7b38['query']['fields']));_0x5ace8c[_0xc912('0x30')]=_0x5ace8c[_0xc912('0x30')][_0xc912('0x31')]?_0x5ace8c[_0xc912('0x30')]:_0x566912[_0xc912('0x2a')];_0x5ace8c[_0xc912('0x34')]=qs[_0xc912('0x35')](_0x2f7b38[_0xc912('0x2b')][_0xc912('0x35')]);_0x5ace8c[_0xc912('0x36')]=qs[_0xc912('0x2d')](_['pick'](_0x2f7b38['query'],_0x566912[_0xc912('0x2d')]));if(_0x2f7b38[_0xc912('0x2b')]['filter']){_0x5ace8c[_0xc912('0x36')]=_[_0xc912('0x39')](_0x5ace8c[_0xc912('0x36')],{'$or':_[_0xc912('0x27')](_0x5ace8c[_0xc912('0x30')],function(_0x2b33d8){var _0x3fcc33={};_0x3fcc33[_0x2b33d8]={'$like':'%'+_0x2f7b38[_0xc912('0x2b')][_0xc912('0x38')]+'%'};return _0x3fcc33;})});}_0x5ace8c=_['merge']({},_0x5ace8c,_0x2f7b38[_0xc912('0x41')]);return _0x14c347['getDescriptions'](_0x5ace8c);}})['then'](function(_0x5c1286){if(_0x5c1286){_0x54d8a8=_0x5c1286[_0xc912('0x31')];if(!_0x2f7b38[_0xc912('0x2b')][_0xc912('0x32')](_0xc912('0x33'))){_0x5ace8c['limit']=qs['limit'](_0x2f7b38[_0xc912('0x2b')][_0xc912('0x1c')]);_0x5ace8c[_0xc912('0x1b')]=qs[_0xc912('0x1b')](_0x2f7b38[_0xc912('0x2b')][_0xc912('0x1b')]);}return _0x14c347[_0xc912('0x4c')](_0x5ace8c);}})[_0xc912('0x22')](function(_0x9f054a){if(_0x9f054a){return _0x9f054a?{'count':_0x54d8a8,'rows':_0x9f054a}:null;}})[_0xc912('0x22')](respondWithResult(_0x475146,null))[_0xc912('0x3f')](handleError(_0x475146,null));}; \ No newline at end of file +var _0x072d=['getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','ServicenowField'];(function(_0x40eadc,_0x37af8d){var _0x6963b4=function(_0x4c2c9){while(--_0x4c2c9){_0x40eadc['push'](_0x40eadc['shift']());}};_0x6963b4(++_0x37af8d);}(_0x072d,0xf8));var _0xd072=function(_0x41f4ed,_0x1f646d){_0x41f4ed=_0x41f4ed-0x0;var _0x25c457=_0x072d[_0x41f4ed];return _0x25c457;};'use strict';var emlformat=require(_0xd072('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd072('0x1'));var jsonpatch=require(_0xd072('0x2'));var rp=require(_0xd072('0x3'));var moment=require(_0xd072('0x4'));var BPromise=require(_0xd072('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd072('0x6'));var csv=require(_0xd072('0x7'));var ejs=require(_0xd072('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd072('0x9'));var squel=require(_0xd072('0xa'));var crypto=require(_0xd072('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd072('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd072('0xd'));var Papa=require(_0xd072('0xe'));var Redis=require(_0xd072('0xf'));var authService=require(_0xd072('0x10'));var qs=require(_0xd072('0x11'));var as=require(_0xd072('0x12'));var hardwareService=require(_0xd072('0x13'));var logger=require(_0xd072('0x14'))('api');var utils=require(_0xd072('0x15'));var config=require(_0xd072('0x16'));var licenseUtil=require(_0xd072('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x856cff,_0x475471){_0x475471=_0x475471||0xcc;return function(_0x4f2c19){if(_0x4f2c19){return _0x856cff['sendStatus'](_0x475471);}return _0x856cff[_0xd072('0x18')](_0x475471)[_0xd072('0x19')]();};}function respondWithResult(_0x10a0bb,_0xd708b9){_0xd708b9=_0xd708b9||0xc8;return function(_0x42a9e2){if(_0x42a9e2){return _0x10a0bb['status'](_0xd708b9)[_0xd072('0x1a')](_0x42a9e2);}};}function respondWithFilteredResult(_0x411880,_0x5b049b){return function(_0x32b19d){if(_0x32b19d){var _0x9c62b3=typeof _0x5b049b['offset']===_0xd072('0x1b')&&typeof _0x5b049b[_0xd072('0x1c')]===_0xd072('0x1b');var _0x3ad344=_0x32b19d['count'];var _0x5a90a8=_0x9c62b3?0x0:_0x5b049b[_0xd072('0x1d')];var _0x5513fd=_0x9c62b3?_0x32b19d['count']:_0x5b049b[_0xd072('0x1d')]+_0x5b049b[_0xd072('0x1c')];var _0x48303f;if(_0x5513fd>=_0x3ad344){_0x5513fd=_0x3ad344;_0x48303f=0xc8;}else{_0x48303f=0xce;}_0x411880['status'](_0x48303f);return _0x411880[_0xd072('0x1e')](_0xd072('0x1f'),_0x5a90a8+'-'+_0x5513fd+'/'+_0x3ad344)[_0xd072('0x1a')](_0x32b19d);}return null;};}function patchUpdates(_0x2d2496){return function(_0x54c5c5){try{jsonpatch[_0xd072('0x20')](_0x54c5c5,_0x2d2496,!![]);}catch(_0x5aab2d){return BPromise[_0xd072('0x21')](_0x5aab2d);}return _0x54c5c5[_0xd072('0x22')]();};}function saveUpdates(_0x4dd3bc,_0x1b48c5){return function(_0x31829d){if(_0x31829d){return _0x31829d['update'](_0x4dd3bc)[_0xd072('0x23')](function(_0x3818de){return _0x3818de;});}return null;};}function removeEntity(_0x1b4608,_0xefc665){return function(_0x549d6a){if(_0x549d6a){return _0x549d6a[_0xd072('0x24')]()['then'](function(){_0x1b4608[_0xd072('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426c93,_0x59eb87){return function(_0x50a7b9){if(!_0x50a7b9){_0x426c93[_0xd072('0x25')](0x194);}return _0x50a7b9;};}function handleError(_0x283471,_0x4eb176){_0x4eb176=_0x4eb176||0x1f4;return function(_0x2fde4d){logger[_0xd072('0x26')](_0x2fde4d['stack']);if(_0x2fde4d[_0xd072('0x27')]){delete _0x2fde4d[_0xd072('0x27')];}_0x283471[_0xd072('0x18')](_0x4eb176)[_0xd072('0x28')](_0x2fde4d);};}exports[_0xd072('0x29')]=function(_0x2d74e8,_0x4d7c37){var _0x59211e={},_0x207e50={},_0x316c24={'count':0x0,'rows':[]};var _0x4f19cb=_[_0xd072('0x2a')](db[_0xd072('0x2b')][_0xd072('0x2c')],function(_0x508036){return{'name':_0x508036[_0xd072('0x2d')],'type':_0x508036[_0xd072('0x2e')][_0xd072('0x2f')]};});_0x207e50[_0xd072('0x30')]=_[_0xd072('0x2a')](_0x4f19cb,_0xd072('0x27'));_0x207e50[_0xd072('0x31')]=_[_0xd072('0x32')](_0x2d74e8[_0xd072('0x31')]);_0x207e50[_0xd072('0x33')]=_[_0xd072('0x34')](_0x207e50[_0xd072('0x30')],_0x207e50[_0xd072('0x31')]);_0x59211e[_0xd072('0x35')]=_[_0xd072('0x34')](_0x207e50[_0xd072('0x30')],qs[_0xd072('0x36')](_0x2d74e8[_0xd072('0x31')][_0xd072('0x36')]));_0x59211e[_0xd072('0x35')]=_0x59211e['attributes'][_0xd072('0x37')]?_0x59211e['attributes']:_0x207e50[_0xd072('0x30')];if(!_0x2d74e8[_0xd072('0x31')][_0xd072('0x38')](_0xd072('0x39'))){_0x59211e[_0xd072('0x1c')]=qs[_0xd072('0x1c')](_0x2d74e8['query'][_0xd072('0x1c')]);_0x59211e[_0xd072('0x1d')]=qs[_0xd072('0x1d')](_0x2d74e8[_0xd072('0x31')][_0xd072('0x1d')]);}_0x59211e[_0xd072('0x3a')]=qs[_0xd072('0x3b')](_0x2d74e8[_0xd072('0x31')][_0xd072('0x3b')]);_0x59211e['where']=qs[_0xd072('0x33')](_[_0xd072('0x3c')](_0x2d74e8[_0xd072('0x31')],_0x207e50[_0xd072('0x33')]),_0x4f19cb);if(_0x2d74e8[_0xd072('0x31')][_0xd072('0x3d')]){_0x59211e[_0xd072('0x3e')]=_[_0xd072('0x3f')](_0x59211e['where'],{'$or':_[_0xd072('0x2a')](_0x4f19cb,function(_0x23f82){if(_0x23f82[_0xd072('0x2e')]!=='VIRTUAL'){var _0x286cf9={};_0x286cf9[_0x23f82['name']]={'$like':'%'+_0x2d74e8[_0xd072('0x31')]['filter']+'%'};return _0x286cf9;}})});}_0x59211e=_['merge']({},_0x59211e,_0x2d74e8[_0xd072('0x40')]);var _0xa8f71={'where':_0x59211e[_0xd072('0x3e')]};return db[_0xd072('0x2b')]['count'](_0xa8f71)['then'](function(_0x195f9c){_0x316c24[_0xd072('0x41')]=_0x195f9c;if(_0x2d74e8[_0xd072('0x31')][_0xd072('0x42')]){_0x59211e[_0xd072('0x43')]=[{'all':!![]}];}return db[_0xd072('0x2b')][_0xd072('0x44')](_0x59211e);})[_0xd072('0x23')](function(_0x2cbd20){_0x316c24[_0xd072('0x45')]=_0x2cbd20;return _0x316c24;})[_0xd072('0x23')](respondWithFilteredResult(_0x4d7c37,_0x59211e))[_0xd072('0x46')](handleError(_0x4d7c37,null));};exports[_0xd072('0x47')]=function(_0x5b99df,_0x47de37){var _0x3a12b3={'raw':![],'where':{'id':_0x5b99df[_0xd072('0x48')]['id']}},_0x28f6fb={};_0x28f6fb[_0xd072('0x30')]=_[_0xd072('0x32')](db[_0xd072('0x2b')]['rawAttributes']);_0x28f6fb[_0xd072('0x31')]=_[_0xd072('0x32')](_0x5b99df[_0xd072('0x31')]);_0x28f6fb[_0xd072('0x33')]=_[_0xd072('0x34')](_0x28f6fb[_0xd072('0x30')],_0x28f6fb[_0xd072('0x31')]);_0x3a12b3[_0xd072('0x35')]=_[_0xd072('0x34')](_0x28f6fb['model'],qs[_0xd072('0x36')](_0x5b99df[_0xd072('0x31')][_0xd072('0x36')]));_0x3a12b3['attributes']=_0x3a12b3[_0xd072('0x35')][_0xd072('0x37')]?_0x3a12b3[_0xd072('0x35')]:_0x28f6fb[_0xd072('0x30')];if(_0x5b99df[_0xd072('0x31')][_0xd072('0x42')]){_0x3a12b3['include']=[{'all':!![]}];}_0x3a12b3=_[_0xd072('0x3f')]({},_0x3a12b3,_0x5b99df[_0xd072('0x40')]);return db['ServicenowConfiguration'][_0xd072('0x49')](_0x3a12b3)[_0xd072('0x23')](handleEntityNotFound(_0x47de37,null))['then'](respondWithResult(_0x47de37,null))[_0xd072('0x46')](handleError(_0x47de37,null));};exports[_0xd072('0x4a')]=function(_0x362535,_0x3f1a2d){return db[_0xd072('0x2b')][_0xd072('0x4a')](_0x362535[_0xd072('0x4b')],{})[_0xd072('0x23')](respondWithResult(_0x3f1a2d,0xc9))[_0xd072('0x46')](handleError(_0x3f1a2d,null));};exports[_0xd072('0x4c')]=function(_0x1db8e6,_0x3c196d){if(_0x1db8e6[_0xd072('0x4b')]['id']){delete _0x1db8e6[_0xd072('0x4b')]['id'];}return db[_0xd072('0x2b')][_0xd072('0x49')]({'where':{'id':_0x1db8e6[_0xd072('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c196d,null))['then'](saveUpdates(_0x1db8e6['body'],null))['then'](respondWithResult(_0x3c196d,null))[_0xd072('0x46')](handleError(_0x3c196d,null));};exports['destroy']=function(_0x16475c,_0x1d3e12){return db[_0xd072('0x2b')][_0xd072('0x49')]({'where':{'id':_0x16475c['params']['id']}})['then'](handleEntityNotFound(_0x1d3e12,null))[_0xd072('0x23')](removeEntity(_0x1d3e12,null))['catch'](handleError(_0x1d3e12,null));};exports[_0xd072('0x4d')]=function(_0x1aa36f,_0x5c88c7,_0xee5062){var _0x5e072f={};var _0x65f9b9={};var _0x5072e2;var _0x4f69bb;return db[_0xd072('0x2b')][_0xd072('0x4e')]({'where':{'id':_0x1aa36f[_0xd072('0x48')]['id']}})[_0xd072('0x23')](handleEntityNotFound(_0x5c88c7,null))[_0xd072('0x23')](function(_0x5dac0a){if(_0x5dac0a){_0x5072e2=_0x5dac0a;_0x65f9b9[_0xd072('0x30')]=_[_0xd072('0x32')](db[_0xd072('0x4f')][_0xd072('0x2c')]);_0x65f9b9[_0xd072('0x31')]=_[_0xd072('0x32')](_0x1aa36f[_0xd072('0x31')]);_0x65f9b9[_0xd072('0x33')]=_[_0xd072('0x34')](_0x65f9b9[_0xd072('0x30')],_0x65f9b9[_0xd072('0x31')]);_0x5e072f[_0xd072('0x35')]=_[_0xd072('0x34')](_0x65f9b9[_0xd072('0x30')],qs[_0xd072('0x36')](_0x1aa36f[_0xd072('0x31')]['fields']));_0x5e072f[_0xd072('0x35')]=_0x5e072f[_0xd072('0x35')]['length']?_0x5e072f[_0xd072('0x35')]:_0x65f9b9['model'];_0x5e072f[_0xd072('0x3a')]=qs['sort'](_0x1aa36f[_0xd072('0x31')]['sort']);_0x5e072f[_0xd072('0x3e')]=qs[_0xd072('0x33')](_[_0xd072('0x3c')](_0x1aa36f[_0xd072('0x31')],_0x65f9b9[_0xd072('0x33')]));if(_0x1aa36f[_0xd072('0x31')][_0xd072('0x3d')]){_0x5e072f[_0xd072('0x3e')]=_[_0xd072('0x3f')](_0x5e072f[_0xd072('0x3e')],{'$or':_[_0xd072('0x2a')](_0x5e072f[_0xd072('0x35')],function(_0x7beabe){var _0x244291={};_0x244291[_0x7beabe]={'$like':'%'+_0x1aa36f[_0xd072('0x31')][_0xd072('0x3d')]+'%'};return _0x244291;})});}_0x5e072f=_[_0xd072('0x3f')]({},_0x5e072f,_0x1aa36f[_0xd072('0x40')]);return _0x5072e2['getFields'](_0x5e072f);}})[_0xd072('0x23')](function(_0x5c4d49){if(_0x5c4d49){_0x4f69bb=_0x5c4d49[_0xd072('0x37')];if(!_0x1aa36f[_0xd072('0x31')][_0xd072('0x38')](_0xd072('0x39'))){_0x5e072f[_0xd072('0x1c')]=qs[_0xd072('0x1c')](_0x1aa36f[_0xd072('0x31')][_0xd072('0x1c')]);_0x5e072f[_0xd072('0x1d')]=qs[_0xd072('0x1d')](_0x1aa36f[_0xd072('0x31')][_0xd072('0x1d')]);}return _0x5072e2[_0xd072('0x4d')](_0x5e072f);}})['then'](function(_0x250424){if(_0x250424){return _0x250424?{'count':_0x4f69bb,'rows':_0x250424}:null;}})[_0xd072('0x23')](respondWithResult(_0x5c88c7,null))['catch'](handleError(_0x5c88c7,null));};exports[_0xd072('0x50')]=function(_0x463de9,_0x30cb2f,_0x2449b2){var _0x44aeb6={};var _0x51bcd4={};var _0x33eb3f;var _0x427586;return db[_0xd072('0x2b')]['findOne']({'where':{'id':_0x463de9['params']['id']}})[_0xd072('0x23')](handleEntityNotFound(_0x30cb2f,null))[_0xd072('0x23')](function(_0x320a1b){if(_0x320a1b){_0x33eb3f=_0x320a1b;_0x51bcd4[_0xd072('0x30')]=_[_0xd072('0x32')](db[_0xd072('0x4f')][_0xd072('0x2c')]);_0x51bcd4[_0xd072('0x31')]=_[_0xd072('0x32')](_0x463de9['query']);_0x51bcd4['filters']=_[_0xd072('0x34')](_0x51bcd4[_0xd072('0x30')],_0x51bcd4['query']);_0x44aeb6['attributes']=_[_0xd072('0x34')](_0x51bcd4[_0xd072('0x30')],qs['fields'](_0x463de9[_0xd072('0x31')][_0xd072('0x36')]));_0x44aeb6[_0xd072('0x35')]=_0x44aeb6[_0xd072('0x35')]['length']?_0x44aeb6[_0xd072('0x35')]:_0x51bcd4[_0xd072('0x30')];_0x44aeb6[_0xd072('0x3a')]=qs['sort'](_0x463de9['query'][_0xd072('0x3b')]);_0x44aeb6[_0xd072('0x3e')]=qs[_0xd072('0x33')](_['pick'](_0x463de9['query'],_0x51bcd4['filters']));if(_0x463de9['query']['filter']){_0x44aeb6[_0xd072('0x3e')]=_[_0xd072('0x3f')](_0x44aeb6[_0xd072('0x3e')],{'$or':_[_0xd072('0x2a')](_0x44aeb6[_0xd072('0x35')],function(_0x4bfa98){var _0x5d4a1e={};_0x5d4a1e[_0x4bfa98]={'$like':'%'+_0x463de9[_0xd072('0x31')][_0xd072('0x3d')]+'%'};return _0x5d4a1e;})});}_0x44aeb6=_[_0xd072('0x3f')]({},_0x44aeb6,_0x463de9[_0xd072('0x40')]);return _0x33eb3f[_0xd072('0x50')](_0x44aeb6);}})[_0xd072('0x23')](function(_0x30e51a){if(_0x30e51a){_0x427586=_0x30e51a[_0xd072('0x37')];if(!_0x463de9[_0xd072('0x31')][_0xd072('0x38')](_0xd072('0x39'))){_0x44aeb6[_0xd072('0x1c')]=qs[_0xd072('0x1c')](_0x463de9['query'][_0xd072('0x1c')]);_0x44aeb6[_0xd072('0x1d')]=qs['offset'](_0x463de9[_0xd072('0x31')]['offset']);}return _0x33eb3f[_0xd072('0x50')](_0x44aeb6);}})[_0xd072('0x23')](function(_0x4dd54b){if(_0x4dd54b){return _0x4dd54b?{'count':_0x427586,'rows':_0x4dd54b}:null;}})[_0xd072('0x23')](respondWithResult(_0x30cb2f,null))['catch'](handleError(_0x30cb2f,null));};exports[_0xd072('0x51')]=function(_0xb51998,_0x26b9cb,_0x58c953){var _0x26681b={};var _0x1724de={};var _0x2b4b7d;var _0x151f96;return db[_0xd072('0x2b')][_0xd072('0x4e')]({'where':{'id':_0xb51998[_0xd072('0x48')]['id']}})[_0xd072('0x23')](handleEntityNotFound(_0x26b9cb,null))[_0xd072('0x23')](function(_0x5e7a7d){if(_0x5e7a7d){_0x2b4b7d=_0x5e7a7d;_0x1724de['model']=_[_0xd072('0x32')](db[_0xd072('0x4f')][_0xd072('0x2c')]);_0x1724de['query']=_[_0xd072('0x32')](_0xb51998['query']);_0x1724de['filters']=_[_0xd072('0x34')](_0x1724de['model'],_0x1724de['query']);_0x26681b['attributes']=_[_0xd072('0x34')](_0x1724de[_0xd072('0x30')],qs['fields'](_0xb51998[_0xd072('0x31')][_0xd072('0x36')]));_0x26681b['attributes']=_0x26681b[_0xd072('0x35')][_0xd072('0x37')]?_0x26681b[_0xd072('0x35')]:_0x1724de[_0xd072('0x30')];_0x26681b[_0xd072('0x3a')]=qs[_0xd072('0x3b')](_0xb51998[_0xd072('0x31')][_0xd072('0x3b')]);_0x26681b['where']=qs[_0xd072('0x33')](_['pick'](_0xb51998['query'],_0x1724de[_0xd072('0x33')]));if(_0xb51998[_0xd072('0x31')][_0xd072('0x3d')]){_0x26681b['where']=_[_0xd072('0x3f')](_0x26681b['where'],{'$or':_[_0xd072('0x2a')](_0x26681b[_0xd072('0x35')],function(_0x28fc26){var _0x23b6d4={};_0x23b6d4[_0x28fc26]={'$like':'%'+_0xb51998['query'][_0xd072('0x3d')]+'%'};return _0x23b6d4;})});}_0x26681b=_[_0xd072('0x3f')]({},_0x26681b,_0xb51998['options']);return _0x2b4b7d[_0xd072('0x51')](_0x26681b);}})[_0xd072('0x23')](function(_0x1b7959){if(_0x1b7959){_0x151f96=_0x1b7959[_0xd072('0x37')];if(!_0xb51998[_0xd072('0x31')][_0xd072('0x38')](_0xd072('0x39'))){_0x26681b[_0xd072('0x1c')]=qs[_0xd072('0x1c')](_0xb51998[_0xd072('0x31')]['limit']);_0x26681b[_0xd072('0x1d')]=qs[_0xd072('0x1d')](_0xb51998[_0xd072('0x31')][_0xd072('0x1d')]);}return _0x2b4b7d[_0xd072('0x51')](_0x26681b);}})[_0xd072('0x23')](function(_0x425214){if(_0x425214){return _0x425214?{'count':_0x151f96,'rows':_0x425214}:null;}})[_0xd072('0x23')](respondWithResult(_0x26b9cb,null))[_0xd072('0x46')](handleError(_0x26b9cb,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 45afc54..5d73f0d 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 _0x3f48=['../../config/logger','api','moment','bluebird','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x1cdba9,_0x4fc64b){var _0x7aef26=function(_0x2bd372){while(--_0x2bd372){_0x1cdba9['push'](_0x1cdba9['shift']());}};_0x7aef26(++_0x4fc64b);}(_0x3f48,0x17c));var _0x83f4=function(_0xb8082f,_0x171cb2){_0xb8082f=_0xb8082f-0x0;var _0x3798a2=_0x3f48[_0xb8082f];return _0x3798a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x83f4('0x0'))(_0x83f4('0x1'));var moment=require(_0x83f4('0x2'));var BPromise=require(_0x83f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83f4('0x4'));var rimraf=require(_0x83f4('0x5'));var config=require('../../config/environment');var attributes=require(_0x83f4('0x6'));module['exports']=function(_0x3a3551,_0x6cca1b){return _0x3a3551[_0x83f4('0x7')](_0x83f4('0x8'),attributes,{'tableName':_0x83f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1b=['exports','define','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4dc502,_0x44c136){var _0x12f6bf=function(_0x4f91f1){while(--_0x4f91f1){_0x4dc502['push'](_0x4dc502['shift']());}};_0x12f6bf(++_0x44c136);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0xbaa1('0x8'),'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 07843e6..fe4516a 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 _0x34ec=['../../config/logger','rpc','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x34ec,0x1f4));var _0xc34e=function(_0x104e1a,_0x1d1f1c){_0x104e1a=_0x104e1a-0x0;var _0x4b7a59=_0x34ec[_0x104e1a];return _0x4b7a59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc34e('0x0'));var BPromise=require(_0xc34e('0x1'));var rs=require(_0xc34e('0x2'));var fs=require('fs');var Redis=require(_0xc34e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc34e('0x4'))(_0xc34e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc34e('0x6')][_0xc34e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bca29,_0x4b3a02,_0x3d2636){return new BPromise(function(_0x8a2a50,_0x14143a){return client['request'](_0x2bca29,_0x3d2636)[_0xc34e('0x8')](function(_0x2403c2){logger[_0xc34e('0x9')](_0xc34e('0xa'),_0x4b3a02,'request\x20sent');logger['debug'](_0xc34e('0xb'),_0x4b3a02,'request\x20sent',JSON[_0xc34e('0xc')](_0x2403c2));if(_0x2403c2['error']){if(_0x2403c2[_0xc34e('0xd')][_0xc34e('0xe')]===0x1f4){logger[_0xc34e('0xd')](_0xc34e('0xa'),_0x4b3a02,_0x2403c2[_0xc34e('0xd')][_0xc34e('0xf')]);return _0x14143a(_0x2403c2['error']['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4b3a02,_0x2403c2['error'][_0xc34e('0xf')]);return _0x8a2a50(_0x2403c2[_0xc34e('0xd')][_0xc34e('0xf')]);}else{logger['info'](_0xc34e('0xa'),_0x4b3a02,'request\x20sent');_0x8a2a50(_0x2403c2[_0xc34e('0x10')][_0xc34e('0xf')]);}})[_0xc34e('0x11')](function(_0x106467){logger['error'](_0xc34e('0xa'),_0x4b3a02,_0x106467);_0x14143a(_0x106467);});});} \ No newline at end of file +var _0x9b0d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x58ba1a,_0x267dea){var _0x3baaff=function(_0x35f822){while(--_0x35f822){_0x58ba1a['push'](_0x58ba1a['shift']());}};_0x3baaff(++_0x267dea);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x1c522f,_0x371e01){_0x1c522f=_0x1c522f-0x0;var _0xf3322f=_0x9b0d[_0x1c522f];return _0xf3322f;};'use strict';var _=require('lodash');var util=require(_0xd9b0('0x0'));var moment=require(_0xd9b0('0x1'));var BPromise=require(_0xd9b0('0x2'));var rs=require(_0xd9b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9b0('0x4'))['db'];var utils=require(_0xd9b0('0x5'));var logger=require(_0xd9b0('0x6'))(_0xd9b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9b0('0x8'));var client=jayson[_0xd9b0('0x9')][_0xd9b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c012,_0x58bd64,_0x384d09){return new BPromise(function(_0x33f402,_0x510adc){return client[_0xd9b0('0xb')](_0x31c012,_0x384d09)[_0xd9b0('0xc')](function(_0x48181a){logger[_0xd9b0('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58bd64,_0xd9b0('0xe'));logger['debug'](_0xd9b0('0xf'),_0x58bd64,_0xd9b0('0xe'),JSON[_0xd9b0('0x10')](_0x48181a));if(_0x48181a[_0xd9b0('0x11')]){if(_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x12')]===0x1f4){logger['error'](_0xd9b0('0x13'),_0x58bd64,_0x48181a[_0xd9b0('0x11')]['message']);return _0x510adc(_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x14')]);}logger[_0xd9b0('0x11')](_0xd9b0('0x13'),_0x58bd64,_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x14')]);return _0x33f402(_0x48181a['error'][_0xd9b0('0x14')]);}else{logger['info'](_0xd9b0('0x13'),_0x58bd64,_0xd9b0('0xe'));_0x33f402(_0x48181a[_0xd9b0('0x15')][_0xd9b0('0x14')]);}})[_0xd9b0('0x16')](function(_0x3e7547){logger[_0xd9b0('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58bd64,_0x3e7547);_0x510adc(_0x3e7547);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3366019..e72f9d4 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 _0x0b64=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x49710a,_0x56a5f1){var _0x686417=function(_0x5d51ef){while(--_0x5d51ef){_0x49710a['push'](_0x49710a['shift']());}};_0x686417(++_0x56a5f1);}(_0x0b64,0x17b));var _0x40b6=function(_0x585d3d,_0x141b34){_0x585d3d=_0x585d3d-0x0;var _0x3489fa=_0x0b64[_0x585d3d];return _0x3489fa;};'use strict';var multer=require('multer');var util=require(_0x40b6('0x0'));var path=require(_0x40b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x40b6('0x2'));var auth=require(_0x40b6('0x3'));var interaction=require(_0x40b6('0x4'));var config=require(_0x40b6('0x5'));var controller=require(_0x40b6('0x6'));router[_0x40b6('0x7')]('/',auth[_0x40b6('0x8')](),controller[_0x40b6('0x9')]);router['get'](_0x40b6('0xa'),auth[_0x40b6('0x8')](),controller[_0x40b6('0xb')]);router[_0x40b6('0xc')]('/',auth[_0x40b6('0x8')](),controller['create']);router[_0x40b6('0xd')](_0x40b6('0xa'),auth[_0x40b6('0x8')](),controller[_0x40b6('0xe')]);router['delete'](_0x40b6('0xa'),auth[_0x40b6('0x8')](),controller['destroy']);module[_0x40b6('0xf')]=router; \ No newline at end of file +var _0x378b=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','show','create','put','update','destroy'];(function(_0x4b1eaf,_0x39bcdd){var _0x3bc4c8=function(_0x2f802c){while(--_0x2f802c){_0x4b1eaf['push'](_0x4b1eaf['shift']());}};_0x3bc4c8(++_0x39bcdd);}(_0x378b,0x65));var _0xb378=function(_0x599dd2,_0x46d978){_0x599dd2=_0x599dd2-0x0;var _0x5dba73=_0x378b[_0x599dd2];return _0x5dba73;};'use strict';var multer=require(_0xb378('0x0'));var util=require(_0xb378('0x1'));var path=require(_0xb378('0x2'));var timeout=require(_0xb378('0x3'));var express=require('express');var router=express[_0xb378('0x4')]();var fs_extra=require(_0xb378('0x5'));var auth=require(_0xb378('0x6'));var interaction=require(_0xb378('0x7'));var config=require(_0xb378('0x8'));var controller=require(_0xb378('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb378('0xa')]);router[_0xb378('0xb')](_0xb378('0xc'),auth[_0xb378('0xd')](),controller[_0xb378('0xe')]);router['post']('/',auth[_0xb378('0xd')](),controller[_0xb378('0xf')]);router[_0xb378('0x10')](_0xb378('0xc'),auth[_0xb378('0xd')](),controller[_0xb378('0x11')]);router['delete'](_0xb378('0xc'),auth[_0xb378('0xd')](),controller[_0xb378('0x12')]);module[_0xb378('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 92473fc..8172ed3 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 _0x9f6d=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2ef793,_0x299219){var _0x287307=function(_0x2e5bb8){while(--_0x2e5bb8){_0x2ef793['push'](_0x2ef793['shift']());}};_0x287307(++_0x299219);}(_0x9f6d,0x19b));var _0xd9f6=function(_0x111c47,_0x2c867b){_0x111c47=_0x111c47-0x0;var _0x30790f=_0x9f6d[_0x111c47];return _0x30790f;};'use strict';var Sequelize=require(_0xd9f6('0x0'));module[_0xd9f6('0x1')]={'type':{'type':Sequelize[_0xd9f6('0x2')](_0xd9f6('0x3'),_0xd9f6('0x4'),_0xd9f6('0x5'),_0xd9f6('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd9f6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd9f6('0x2')](_0xd9f6('0x3'),_0xd9f6('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd9f6('0x7')]},'idField':{'type':Sequelize[_0xd9f6('0x7')]},'nameField':{'type':Sequelize[_0xd9f6('0x7')]},'customField':{'type':Sequelize[_0xd9f6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd9f6('0x7')]}}; \ No newline at end of file +var _0x1093=['picklist','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0xf7fdec,_0x403876){var _0x18e647=function(_0xc44d37){while(--_0xc44d37){_0xf7fdec['push'](_0xf7fdec['shift']());}};_0x18e647(++_0x403876);}(_0x1093,0xcb));var _0x3109=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x1093[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x3109('0x0'));module['exports']={'type':{'type':Sequelize[_0x3109('0x1')]('string',_0x3109('0x2'),_0x3109('0x3'),_0x3109('0x4'),_0x3109('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3109('0x6')]},'key':{'type':Sequelize[_0x3109('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x3109('0x3'))},'keyContent':{'type':Sequelize[_0x3109('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3109('0x6')]},'customField':{'type':Sequelize[_0x3109('0x7')],'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 faefed1..71fa4b1 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 _0xfe43=['ServicenowField','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','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/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','stack','name','send'];(function(_0xd0fae4,_0x2f5610){var _0x4838da=function(_0x3d9b36){while(--_0x3d9b36){_0xd0fae4['push'](_0xd0fae4['shift']());}};_0x4838da(++_0x2f5610);}(_0xfe43,0x70));var _0x3fe4=function(_0x30ae7b,_0x3a718f){_0x30ae7b=_0x30ae7b-0x0;var _0xa9d0cf=_0xfe43[_0x30ae7b];return _0xa9d0cf;};'use strict';var emlformat=require(_0x3fe4('0x0'));var rimraf=require(_0x3fe4('0x1'));var zipdir=require(_0x3fe4('0x2'));var jsonpatch=require(_0x3fe4('0x3'));var rp=require(_0x3fe4('0x4'));var moment=require(_0x3fe4('0x5'));var BPromise=require(_0x3fe4('0x6'));var Mustache=require(_0x3fe4('0x7'));var util=require(_0x3fe4('0x8'));var path=require(_0x3fe4('0x9'));var sox=require(_0x3fe4('0xa'));var csv=require(_0x3fe4('0xb'));var ejs=require(_0x3fe4('0xc'));var fs=require('fs');var fs_extra=require(_0x3fe4('0xd'));var _=require('lodash');var squel=require(_0x3fe4('0xe'));var crypto=require(_0x3fe4('0xf'));var jsforce=require(_0x3fe4('0x10'));var deskjs=require(_0x3fe4('0x11'));var toCsv=require(_0x3fe4('0xb'));var querystring=require(_0x3fe4('0x12'));var Papa=require(_0x3fe4('0x13'));var Redis=require(_0x3fe4('0x14'));var authService=require(_0x3fe4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x3fe4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3fe4('0x17'));var utils=require(_0x3fe4('0x18'));var config=require(_0x3fe4('0x19'));var licenseUtil=require(_0x3fe4('0x1a'));var db=require(_0x3fe4('0x1b'))['db'];function respondWithStatusCode(_0x22d25c,_0x3dd492){_0x3dd492=_0x3dd492||0xcc;return function(_0x55d9b0){if(_0x55d9b0){return _0x22d25c[_0x3fe4('0x1c')](_0x3dd492);}return _0x22d25c[_0x3fe4('0x1d')](_0x3dd492)[_0x3fe4('0x1e')]();};}function respondWithResult(_0x3949d9,_0x138c48){_0x138c48=_0x138c48||0xc8;return function(_0x14f923){if(_0x14f923){return _0x3949d9['status'](_0x138c48)[_0x3fe4('0x1f')](_0x14f923);}};}function respondWithFilteredResult(_0x4f2295,_0x175990){return function(_0x205638){if(_0x205638){var _0x43622f=typeof _0x175990[_0x3fe4('0x20')]===_0x3fe4('0x21')&&typeof _0x175990['limit']==='undefined';var _0x34a422=_0x205638[_0x3fe4('0x22')];var _0x33ff0e=_0x43622f?0x0:_0x175990[_0x3fe4('0x20')];var _0x5c1663=_0x43622f?_0x205638[_0x3fe4('0x22')]:_0x175990[_0x3fe4('0x20')]+_0x175990[_0x3fe4('0x23')];var _0x554457;if(_0x5c1663>=_0x34a422){_0x5c1663=_0x34a422;_0x554457=0xc8;}else{_0x554457=0xce;}_0x4f2295[_0x3fe4('0x1d')](_0x554457);return _0x4f2295[_0x3fe4('0x24')](_0x3fe4('0x25'),_0x33ff0e+'-'+_0x5c1663+'/'+_0x34a422)[_0x3fe4('0x1f')](_0x205638);}return null;};}function patchUpdates(_0x48f36b){return function(_0x361297){try{jsonpatch['apply'](_0x361297,_0x48f36b,!![]);}catch(_0xd7abf5){return BPromise[_0x3fe4('0x26')](_0xd7abf5);}return _0x361297['save']();};}function saveUpdates(_0x279535,_0x482268){return function(_0x53eba0){if(_0x53eba0){return _0x53eba0['update'](_0x279535)[_0x3fe4('0x27')](function(_0x123eab){return _0x123eab;});}return null;};}function removeEntity(_0x155018,_0x34e28d){return function(_0x377b36){if(_0x377b36){return _0x377b36[_0x3fe4('0x28')]()[_0x3fe4('0x27')](function(){_0x155018[_0x3fe4('0x1d')](0xcc)[_0x3fe4('0x1e')]();});}};}function handleEntityNotFound(_0xc3b272,_0x161f73){return function(_0x5a25eb){if(!_0x5a25eb){_0xc3b272[_0x3fe4('0x1c')](0x194);}return _0x5a25eb;};}function handleError(_0x2a7e59,_0x48bb70){_0x48bb70=_0x48bb70||0x1f4;return function(_0x17e980){logger['error'](_0x17e980[_0x3fe4('0x29')]);if(_0x17e980[_0x3fe4('0x2a')]){delete _0x17e980[_0x3fe4('0x2a')];}_0x2a7e59[_0x3fe4('0x1d')](_0x48bb70)[_0x3fe4('0x2b')](_0x17e980);};}exports['index']=function(_0x274312,_0xa743c5){var _0x4a272b={},_0x1773b5={},_0x28c218={'count':0x0,'rows':[]};var _0x12ea32=_['map'](db[_0x3fe4('0x2c')][_0x3fe4('0x2d')],function(_0x25cd95){return{'name':_0x25cd95[_0x3fe4('0x2e')],'type':_0x25cd95[_0x3fe4('0x2f')][_0x3fe4('0x30')]};});_0x1773b5['model']=_['map'](_0x12ea32,_0x3fe4('0x2a'));_0x1773b5[_0x3fe4('0x31')]=_[_0x3fe4('0x32')](_0x274312['query']);_0x1773b5['filters']=_[_0x3fe4('0x33')](_0x1773b5['model'],_0x1773b5['query']);_0x4a272b['attributes']=_[_0x3fe4('0x33')](_0x1773b5[_0x3fe4('0x34')],qs[_0x3fe4('0x35')](_0x274312['query'][_0x3fe4('0x35')]));_0x4a272b[_0x3fe4('0x36')]=_0x4a272b[_0x3fe4('0x36')][_0x3fe4('0x37')]?_0x4a272b[_0x3fe4('0x36')]:_0x1773b5['model'];if(!_0x274312['query'][_0x3fe4('0x38')](_0x3fe4('0x39'))){_0x4a272b['limit']=qs['limit'](_0x274312['query'][_0x3fe4('0x23')]);_0x4a272b[_0x3fe4('0x20')]=qs[_0x3fe4('0x20')](_0x274312[_0x3fe4('0x31')]['offset']);}_0x4a272b[_0x3fe4('0x3a')]=qs[_0x3fe4('0x3b')](_0x274312[_0x3fe4('0x31')][_0x3fe4('0x3b')]);_0x4a272b[_0x3fe4('0x3c')]=qs[_0x3fe4('0x3d')](_[_0x3fe4('0x3e')](_0x274312[_0x3fe4('0x31')],_0x1773b5['filters']),_0x12ea32);if(_0x274312[_0x3fe4('0x31')][_0x3fe4('0x3f')]){_0x4a272b[_0x3fe4('0x3c')]=_[_0x3fe4('0x40')](_0x4a272b[_0x3fe4('0x3c')],{'$or':_[_0x3fe4('0x41')](_0x12ea32,function(_0x36a916){if(_0x36a916[_0x3fe4('0x2f')]!==_0x3fe4('0x42')){var _0x4c0a98={};_0x4c0a98[_0x36a916[_0x3fe4('0x2a')]]={'$like':'%'+_0x274312[_0x3fe4('0x31')][_0x3fe4('0x3f')]+'%'};return _0x4c0a98;}})});}_0x4a272b=_[_0x3fe4('0x40')]({},_0x4a272b,_0x274312[_0x3fe4('0x43')]);var _0x48a91c={'where':_0x4a272b[_0x3fe4('0x3c')]};return db[_0x3fe4('0x2c')][_0x3fe4('0x22')](_0x48a91c)[_0x3fe4('0x27')](function(_0xc7f7b3){_0x28c218['count']=_0xc7f7b3;if(_0x274312[_0x3fe4('0x31')][_0x3fe4('0x44')]){_0x4a272b[_0x3fe4('0x45')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x4a272b);})[_0x3fe4('0x27')](function(_0x5df2b6){_0x28c218[_0x3fe4('0x46')]=_0x5df2b6;return _0x28c218;})[_0x3fe4('0x27')](respondWithFilteredResult(_0xa743c5,_0x4a272b))[_0x3fe4('0x47')](handleError(_0xa743c5,null));};exports[_0x3fe4('0x48')]=function(_0x4751fe,_0x3c6625){var _0x464753={'raw':!![],'where':{'id':_0x4751fe['params']['id']}},_0x1cbb84={};_0x1cbb84[_0x3fe4('0x34')]=_['keys'](db[_0x3fe4('0x2c')][_0x3fe4('0x2d')]);_0x1cbb84['query']=_[_0x3fe4('0x32')](_0x4751fe[_0x3fe4('0x31')]);_0x1cbb84[_0x3fe4('0x3d')]=_[_0x3fe4('0x33')](_0x1cbb84[_0x3fe4('0x34')],_0x1cbb84[_0x3fe4('0x31')]);_0x464753[_0x3fe4('0x36')]=_[_0x3fe4('0x33')](_0x1cbb84[_0x3fe4('0x34')],qs[_0x3fe4('0x35')](_0x4751fe[_0x3fe4('0x31')]['fields']));_0x464753[_0x3fe4('0x36')]=_0x464753[_0x3fe4('0x36')][_0x3fe4('0x37')]?_0x464753[_0x3fe4('0x36')]:_0x1cbb84[_0x3fe4('0x34')];if(_0x4751fe[_0x3fe4('0x31')]['includeAll']){_0x464753[_0x3fe4('0x45')]=[{'all':!![]}];}_0x464753=_['merge']({},_0x464753,_0x4751fe['options']);return db['ServicenowField'][_0x3fe4('0x49')](_0x464753)[_0x3fe4('0x27')](handleEntityNotFound(_0x3c6625,null))['then'](respondWithResult(_0x3c6625,null))[_0x3fe4('0x47')](handleError(_0x3c6625,null));};exports[_0x3fe4('0x4a')]=function(_0x4668f8,_0x2d7020){return db[_0x3fe4('0x2c')][_0x3fe4('0x4a')](_0x4668f8['body'],{})[_0x3fe4('0x27')](respondWithResult(_0x2d7020,0xc9))[_0x3fe4('0x47')](handleError(_0x2d7020,null));};exports[_0x3fe4('0x4b')]=function(_0x1c0a55,_0x49c61d){if(_0x1c0a55[_0x3fe4('0x4c')]['id']){delete _0x1c0a55[_0x3fe4('0x4c')]['id'];}return db[_0x3fe4('0x2c')][_0x3fe4('0x49')]({'where':{'id':_0x1c0a55[_0x3fe4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49c61d,null))[_0x3fe4('0x27')](saveUpdates(_0x1c0a55[_0x3fe4('0x4c')],null))['then'](respondWithResult(_0x49c61d,null))[_0x3fe4('0x47')](handleError(_0x49c61d,null));};exports[_0x3fe4('0x28')]=function(_0x3617a7,_0x1da14e){return db[_0x3fe4('0x2c')]['find']({'where':{'id':_0x3617a7[_0x3fe4('0x4d')]['id']}})[_0x3fe4('0x27')](handleEntityNotFound(_0x1da14e,null))[_0x3fe4('0x27')](removeEntity(_0x1da14e,null))['catch'](handleError(_0x1da14e,null));}; \ No newline at end of file +var _0x3a75=['request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','ServicenowField','findAll','rows','catch','show','params','includeAll','include','create','body','eml-format','zip-dir','fast-json-patch'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3a75,0x156));var _0x53a7=function(_0x438df5,_0x46083d){_0x438df5=_0x438df5-0x0;var _0x529d95=_0x3a75[_0x438df5];return _0x529d95;};'use strict';var emlformat=require(_0x53a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a7('0x1'));var jsonpatch=require(_0x53a7('0x2'));var rp=require(_0x53a7('0x3'));var moment=require(_0x53a7('0x4'));var BPromise=require(_0x53a7('0x5'));var Mustache=require('mustache');var util=require(_0x53a7('0x6'));var path=require(_0x53a7('0x7'));var sox=require('sox');var csv=require(_0x53a7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a7('0x9'));var _=require('lodash');var squel=require(_0x53a7('0xa'));var crypto=require('crypto');var jsforce=require(_0x53a7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x53a7('0x8'));var querystring=require('querystring');var Papa=require(_0x53a7('0xc'));var Redis=require('ioredis');var authService=require(_0x53a7('0xd'));var qs=require(_0x53a7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53a7('0xf'));var logger=require('../../config/logger')(_0x53a7('0x10'));var utils=require('../../config/utils');var config=require(_0x53a7('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x53a7('0x12'))['db'];function respondWithStatusCode(_0x3ad0fc,_0x57ea21){_0x57ea21=_0x57ea21||0xcc;return function(_0x16aede){if(_0x16aede){return _0x3ad0fc[_0x53a7('0x13')](_0x57ea21);}return _0x3ad0fc[_0x53a7('0x14')](_0x57ea21)[_0x53a7('0x15')]();};}function respondWithResult(_0x7499c7,_0x47e12d){_0x47e12d=_0x47e12d||0xc8;return function(_0x2e4748){if(_0x2e4748){return _0x7499c7[_0x53a7('0x14')](_0x47e12d)[_0x53a7('0x16')](_0x2e4748);}};}function respondWithFilteredResult(_0x458833,_0x5e9d1f){return function(_0x4b7077){if(_0x4b7077){var _0x37c6e1=typeof _0x5e9d1f[_0x53a7('0x17')]===_0x53a7('0x18')&&typeof _0x5e9d1f[_0x53a7('0x19')]===_0x53a7('0x18');var _0x4f2ce9=_0x4b7077[_0x53a7('0x1a')];var _0xc4fc40=_0x37c6e1?0x0:_0x5e9d1f[_0x53a7('0x17')];var _0x3839fb=_0x37c6e1?_0x4b7077['count']:_0x5e9d1f['offset']+_0x5e9d1f[_0x53a7('0x19')];var _0xa6f113;if(_0x3839fb>=_0x4f2ce9){_0x3839fb=_0x4f2ce9;_0xa6f113=0xc8;}else{_0xa6f113=0xce;}_0x458833[_0x53a7('0x14')](_0xa6f113);return _0x458833[_0x53a7('0x1b')](_0x53a7('0x1c'),_0xc4fc40+'-'+_0x3839fb+'/'+_0x4f2ce9)['json'](_0x4b7077);}return null;};}function patchUpdates(_0xfe70a6){return function(_0x55fc41){try{jsonpatch[_0x53a7('0x1d')](_0x55fc41,_0xfe70a6,!![]);}catch(_0xccbb7d){return BPromise[_0x53a7('0x1e')](_0xccbb7d);}return _0x55fc41['save']();};}function saveUpdates(_0x4a969e,_0x5ac39a){return function(_0x2ba0d5){if(_0x2ba0d5){return _0x2ba0d5[_0x53a7('0x1f')](_0x4a969e)['then'](function(_0x22fc07){return _0x22fc07;});}return null;};}function removeEntity(_0x19435f,_0x4f605c){return function(_0x7ff618){if(_0x7ff618){return _0x7ff618[_0x53a7('0x20')]()[_0x53a7('0x21')](function(){_0x19435f[_0x53a7('0x14')](0xcc)[_0x53a7('0x15')]();});}};}function handleEntityNotFound(_0xaf27b0,_0x1c35b9){return function(_0x596076){if(!_0x596076){_0xaf27b0[_0x53a7('0x13')](0x194);}return _0x596076;};}function handleError(_0x5a50b5,_0x69f44f){_0x69f44f=_0x69f44f||0x1f4;return function(_0x9dc66b){logger[_0x53a7('0x22')](_0x9dc66b[_0x53a7('0x23')]);if(_0x9dc66b[_0x53a7('0x24')]){delete _0x9dc66b['name'];}_0x5a50b5[_0x53a7('0x14')](_0x69f44f)['send'](_0x9dc66b);};}exports['index']=function(_0x38b890,_0x5025a8){var _0x17c268={},_0x1334ce={},_0x52165c={'count':0x0,'rows':[]};var _0x2adcfe=_[_0x53a7('0x25')](db['ServicenowField'][_0x53a7('0x26')],function(_0x1d525d){return{'name':_0x1d525d[_0x53a7('0x27')],'type':_0x1d525d['type'][_0x53a7('0x28')]};});_0x1334ce['model']=_['map'](_0x2adcfe,_0x53a7('0x24'));_0x1334ce['query']=_[_0x53a7('0x29')](_0x38b890[_0x53a7('0x2a')]);_0x1334ce['filters']=_['intersection'](_0x1334ce[_0x53a7('0x2b')],_0x1334ce[_0x53a7('0x2a')]);_0x17c268[_0x53a7('0x2c')]=_[_0x53a7('0x2d')](_0x1334ce[_0x53a7('0x2b')],qs[_0x53a7('0x2e')](_0x38b890[_0x53a7('0x2a')]['fields']));_0x17c268[_0x53a7('0x2c')]=_0x17c268['attributes'][_0x53a7('0x2f')]?_0x17c268[_0x53a7('0x2c')]:_0x1334ce[_0x53a7('0x2b')];if(!_0x38b890[_0x53a7('0x2a')]['hasOwnProperty'](_0x53a7('0x30'))){_0x17c268[_0x53a7('0x19')]=qs[_0x53a7('0x19')](_0x38b890[_0x53a7('0x2a')][_0x53a7('0x19')]);_0x17c268[_0x53a7('0x17')]=qs['offset'](_0x38b890[_0x53a7('0x2a')]['offset']);}_0x17c268[_0x53a7('0x31')]=qs[_0x53a7('0x32')](_0x38b890[_0x53a7('0x2a')][_0x53a7('0x32')]);_0x17c268[_0x53a7('0x33')]=qs[_0x53a7('0x34')](_[_0x53a7('0x35')](_0x38b890[_0x53a7('0x2a')],_0x1334ce[_0x53a7('0x34')]),_0x2adcfe);if(_0x38b890[_0x53a7('0x2a')][_0x53a7('0x36')]){_0x17c268[_0x53a7('0x33')]=_['merge'](_0x17c268[_0x53a7('0x33')],{'$or':_[_0x53a7('0x25')](_0x2adcfe,function(_0x35a9da){if(_0x35a9da[_0x53a7('0x37')]!==_0x53a7('0x38')){var _0x5a7fa1={};_0x5a7fa1[_0x35a9da[_0x53a7('0x24')]]={'$like':'%'+_0x38b890[_0x53a7('0x2a')][_0x53a7('0x36')]+'%'};return _0x5a7fa1;}})});}_0x17c268=_[_0x53a7('0x39')]({},_0x17c268,_0x38b890[_0x53a7('0x3a')]);var _0x9cde8f={'where':_0x17c268[_0x53a7('0x33')]};return db[_0x53a7('0x3b')]['count'](_0x9cde8f)[_0x53a7('0x21')](function(_0x1caf73){_0x52165c[_0x53a7('0x1a')]=_0x1caf73;if(_0x38b890[_0x53a7('0x2a')]['includeAll']){_0x17c268['include']=[{'all':!![]}];}return db[_0x53a7('0x3b')][_0x53a7('0x3c')](_0x17c268);})['then'](function(_0x2eac27){_0x52165c[_0x53a7('0x3d')]=_0x2eac27;return _0x52165c;})[_0x53a7('0x21')](respondWithFilteredResult(_0x5025a8,_0x17c268))[_0x53a7('0x3e')](handleError(_0x5025a8,null));};exports[_0x53a7('0x3f')]=function(_0x2dce5f,_0x4240f7){var _0x339940={'raw':!![],'where':{'id':_0x2dce5f[_0x53a7('0x40')]['id']}},_0x10e9df={};_0x10e9df[_0x53a7('0x2b')]=_[_0x53a7('0x29')](db[_0x53a7('0x3b')][_0x53a7('0x26')]);_0x10e9df[_0x53a7('0x2a')]=_[_0x53a7('0x29')](_0x2dce5f[_0x53a7('0x2a')]);_0x10e9df[_0x53a7('0x34')]=_[_0x53a7('0x2d')](_0x10e9df['model'],_0x10e9df[_0x53a7('0x2a')]);_0x339940[_0x53a7('0x2c')]=_['intersection'](_0x10e9df[_0x53a7('0x2b')],qs[_0x53a7('0x2e')](_0x2dce5f[_0x53a7('0x2a')][_0x53a7('0x2e')]));_0x339940['attributes']=_0x339940['attributes']['length']?_0x339940[_0x53a7('0x2c')]:_0x10e9df[_0x53a7('0x2b')];if(_0x2dce5f[_0x53a7('0x2a')][_0x53a7('0x41')]){_0x339940[_0x53a7('0x42')]=[{'all':!![]}];}_0x339940=_[_0x53a7('0x39')]({},_0x339940,_0x2dce5f[_0x53a7('0x3a')]);return db[_0x53a7('0x3b')]['find'](_0x339940)[_0x53a7('0x21')](handleEntityNotFound(_0x4240f7,null))['then'](respondWithResult(_0x4240f7,null))[_0x53a7('0x3e')](handleError(_0x4240f7,null));};exports[_0x53a7('0x43')]=function(_0x3d7890,_0xf7bf8){return db[_0x53a7('0x3b')]['create'](_0x3d7890[_0x53a7('0x44')],{})[_0x53a7('0x21')](respondWithResult(_0xf7bf8,0xc9))['catch'](handleError(_0xf7bf8,null));};exports[_0x53a7('0x1f')]=function(_0x3b84e6,_0x38f928){if(_0x3b84e6[_0x53a7('0x44')]['id']){delete _0x3b84e6[_0x53a7('0x44')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x3b84e6[_0x53a7('0x40')]['id']}})[_0x53a7('0x21')](handleEntityNotFound(_0x38f928,null))[_0x53a7('0x21')](saveUpdates(_0x3b84e6[_0x53a7('0x44')],null))[_0x53a7('0x21')](respondWithResult(_0x38f928,null))['catch'](handleError(_0x38f928,null));};exports[_0x53a7('0x20')]=function(_0x15fe67,_0x48bb78){return db[_0x53a7('0x3b')]['find']({'where':{'id':_0x15fe67[_0x53a7('0x40')]['id']}})[_0x53a7('0x21')](handleEntityNotFound(_0x48bb78,null))[_0x53a7('0x21')](removeEntity(_0x48bb78,null))[_0x53a7('0x3e')](handleError(_0x48bb78,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 264df94..57e2be0 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 _0xe3ab=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xe3ab,0x199));var _0xbe3a=function(_0xb4dc0,_0x573840){_0xb4dc0=_0xb4dc0-0x0;var _0x84cf3c=_0xe3ab[_0xb4dc0];return _0x84cf3c;};'use strict';var _=require(_0xbe3a('0x0'));var util=require(_0xbe3a('0x1'));var logger=require(_0xbe3a('0x2'))(_0xbe3a('0x3'));var moment=require(_0xbe3a('0x4'));var BPromise=require(_0xbe3a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe3a('0x6'));var rimraf=require(_0xbe3a('0x7'));var config=require(_0xbe3a('0x8'));var attributes=require(_0xbe3a('0x9'));module[_0xbe3a('0xa')]=function(_0xc25097,_0x528d59){return _0xc25097[_0xbe3a('0xb')](_0xbe3a('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xbe3a('0xd'),'fields':[_0xbe3a('0xe'),_0xbe3a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad34=['servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x2ca0fe,_0x20c12c){var _0x21890e=function(_0x5d717b){while(--_0x5d717b){_0x2ca0fe['push'](_0x2ca0fe['shift']());}};_0x21890e(++_0x20c12c);}(_0xad34,0xc3));var _0x4ad3=function(_0x5654d5,_0x4e5f42){_0x5654d5=_0x5654d5-0x0;var _0x72e95b=_0xad34[_0x5654d5];return _0x72e95b;};'use strict';var _=require(_0x4ad3('0x0'));var util=require(_0x4ad3('0x1'));var logger=require(_0x4ad3('0x2'))('api');var moment=require(_0x4ad3('0x3'));var BPromise=require(_0x4ad3('0x4'));var rp=require(_0x4ad3('0x5'));var fs=require('fs');var path=require(_0x4ad3('0x6'));var rimraf=require(_0x4ad3('0x7'));var config=require(_0x4ad3('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x4ad3('0x9')]=function(_0x32b366,_0x53cb8c){return _0x32b366[_0x4ad3('0xa')](_0x4ad3('0xb'),attributes,{'tableName':_0x4ad3('0xc'),'paranoid':![],'indexes':[{'name':_0x4ad3('0xd'),'fields':[_0x4ad3('0xe'),_0x4ad3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 835b141..eb0f199 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x499001,_0x3f27ae){var _0x320c65=function(_0x121fea){while(--_0x121fea){_0x499001['push'](_0x499001['shift']());}};_0x320c65(++_0x3f27ae);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1e09ec,_0x977b6){_0x1e09ec=_0x1e09ec-0x0;var _0x40acae=_0xf4eb[_0x1e09ec];return _0x40acae;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xbe78f0,_0x189884){var _0x3f9240=function(_0x3b1a69){while(--_0x3b1a69){_0xbe78f0['push'](_0xbe78f0['shift']());}};_0x3f9240(++_0x189884);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4a63db,_0x5a2edd){_0x4a63db=_0x4a63db-0x0;var _0x1be50f=_0xb43b[_0x4a63db];return _0x1be50f;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5440764..9886c42 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(_0x35287c,_0x4e9bc3){var _0x354469=function(_0x2b68c7){while(--_0x2b68c7){_0x35287c['push'](_0x35287c['shift']());}};_0x354469(++_0x4e9bc3);}(_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/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','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x12a4a8,_0x1b7491){var _0x310b28=function(_0x46171d){while(--_0x46171d){_0x12a4a8['push'](_0x12a4a8['shift']());}};_0x310b28(++_0x1b7491);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d9498f4..e8f6ed7 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(_0x3a4c78,_0x5009d5){var _0x363904=function(_0x1e08bc){while(--_0x1e08bc){_0x3a4c78['push'](_0x3a4c78['shift']());}};_0x363904(++_0x5009d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x5bdefd,_0x384e71){var _0x223fa1=function(_0x48ff9f){while(--_0x48ff9f){_0x5bdefd['push'](_0x5bdefd['shift']());}};_0x223fa1(++_0x384e71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 337da79..fb20dac 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 _0xcb37=['reject','save','then','destroy','end','sendStatus','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','filter','options','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0xcb37,0x14a));var _0x7cb3=function(_0xb1bae6,_0x1d89b3){_0xb1bae6=_0xb1bae6-0x0;var _0x3904fe=_0xcb37[_0xb1bae6];return _0x3904fe;};'use strict';var emlformat=require(_0x7cb3('0x0'));var rimraf=require(_0x7cb3('0x1'));var zipdir=require(_0x7cb3('0x2'));var jsonpatch=require(_0x7cb3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7cb3('0x4'));var util=require(_0x7cb3('0x5'));var path=require(_0x7cb3('0x6'));var sox=require('sox');var csv=require(_0x7cb3('0x7'));var ejs=require(_0x7cb3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cb3('0x9'));var squel=require(_0x7cb3('0xa'));var crypto=require(_0x7cb3('0xb'));var jsforce=require(_0x7cb3('0xc'));var deskjs=require(_0x7cb3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7cb3('0xe'));var Papa=require(_0x7cb3('0xf'));var Redis=require('ioredis');var authService=require(_0x7cb3('0x10'));var qs=require(_0x7cb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7cb3('0x12'));var logger=require(_0x7cb3('0x13'))('api');var utils=require(_0x7cb3('0x14'));var config=require(_0x7cb3('0x15'));var licenseUtil=require(_0x7cb3('0x16'));var db=require(_0x7cb3('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x17c9c0,_0x5b9dc1){_0x5b9dc1=_0x5b9dc1||0xcc;return function(_0x492450){if(_0x492450){return _0x17c9c0['sendStatus'](_0x5b9dc1);}return _0x17c9c0['status'](_0x5b9dc1)['end']();};}function respondWithResult(_0x269c29,_0x558ffb){_0x558ffb=_0x558ffb||0xc8;return function(_0x34e686){if(_0x34e686){return _0x269c29[_0x7cb3('0x18')](_0x558ffb)[_0x7cb3('0x19')](_0x34e686);}};}function respondWithFilteredResult(_0x28425a,_0x19e9d7){return function(_0x2711a5){if(_0x2711a5){var _0x14c5b5=typeof _0x19e9d7[_0x7cb3('0x1a')]===_0x7cb3('0x1b')&&typeof _0x19e9d7[_0x7cb3('0x1c')]===_0x7cb3('0x1b');var _0x38531f=_0x2711a5[_0x7cb3('0x1d')];var _0x4d8d4c=_0x14c5b5?0x0:_0x19e9d7[_0x7cb3('0x1a')];var _0x679606=_0x14c5b5?_0x2711a5[_0x7cb3('0x1d')]:_0x19e9d7['offset']+_0x19e9d7['limit'];var _0x48dc48;if(_0x679606>=_0x38531f){_0x679606=_0x38531f;_0x48dc48=0xc8;}else{_0x48dc48=0xce;}_0x28425a[_0x7cb3('0x18')](_0x48dc48);return _0x28425a[_0x7cb3('0x1e')](_0x7cb3('0x1f'),_0x4d8d4c+'-'+_0x679606+'/'+_0x38531f)['json'](_0x2711a5);}return null;};}function patchUpdates(_0x5690b7){return function(_0x2d7c33){try{jsonpatch[_0x7cb3('0x20')](_0x2d7c33,_0x5690b7,!![]);}catch(_0x5c90de){return BPromise[_0x7cb3('0x21')](_0x5c90de);}return _0x2d7c33[_0x7cb3('0x22')]();};}function saveUpdates(_0x1429ba,_0x5228f9){return function(_0x2e31c9){if(_0x2e31c9){return _0x2e31c9['update'](_0x1429ba)[_0x7cb3('0x23')](function(_0xb43603){return _0xb43603;});}return null;};}function removeEntity(_0x152cd1,_0x20c18a){return function(_0x5d4f75){if(_0x5d4f75){return _0x5d4f75[_0x7cb3('0x24')]()[_0x7cb3('0x23')](function(){_0x152cd1[_0x7cb3('0x18')](0xcc)[_0x7cb3('0x25')]();});}};}function handleEntityNotFound(_0x35db58,_0x698fd2){return function(_0x9d04d8){if(!_0x9d04d8){_0x35db58[_0x7cb3('0x26')](0x194);}return _0x9d04d8;};}function handleError(_0x147c2f,_0x4395ac){_0x4395ac=_0x4395ac||0x1f4;return function(_0x29cdc0){logger[_0x7cb3('0x27')](_0x29cdc0[_0x7cb3('0x28')]);if(_0x29cdc0['name']){delete _0x29cdc0[_0x7cb3('0x29')];}_0x147c2f[_0x7cb3('0x18')](_0x4395ac)['send'](_0x29cdc0);};}exports[_0x7cb3('0x2a')]=function(_0x2c1291,_0x598f78){var _0x3b7bbf={},_0x189aa8={},_0x1c35f4={'count':0x0,'rows':[]};var _0x430457=_['map'](db[_0x7cb3('0x2b')][_0x7cb3('0x2c')],function(_0x2d5caa){return{'name':_0x2d5caa[_0x7cb3('0x2d')],'type':_0x2d5caa['type'][_0x7cb3('0x2e')]};});_0x189aa8[_0x7cb3('0x2f')]=_['map'](_0x430457,_0x7cb3('0x29'));_0x189aa8[_0x7cb3('0x30')]=_[_0x7cb3('0x31')](_0x2c1291[_0x7cb3('0x30')]);_0x189aa8[_0x7cb3('0x32')]=_['intersection'](_0x189aa8[_0x7cb3('0x2f')],_0x189aa8[_0x7cb3('0x30')]);_0x3b7bbf['attributes']=_['intersection'](_0x189aa8[_0x7cb3('0x2f')],qs[_0x7cb3('0x33')](_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x33')]));_0x3b7bbf[_0x7cb3('0x34')]=_0x3b7bbf[_0x7cb3('0x34')][_0x7cb3('0x35')]?_0x3b7bbf['attributes']:_0x189aa8[_0x7cb3('0x2f')];if(!_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x36')](_0x7cb3('0x37'))){_0x3b7bbf[_0x7cb3('0x1c')]=qs[_0x7cb3('0x1c')](_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x1c')]);_0x3b7bbf['offset']=qs['offset'](_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x1a')]);}_0x3b7bbf[_0x7cb3('0x38')]=qs['sort'](_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x39')]);_0x3b7bbf['where']=qs['filters'](_[_0x7cb3('0x3a')](_0x2c1291[_0x7cb3('0x30')],_0x189aa8[_0x7cb3('0x32')]),_0x430457);if(_0x2c1291[_0x7cb3('0x30')]['filter']){_0x3b7bbf[_0x7cb3('0x3b')]=_[_0x7cb3('0x3c')](_0x3b7bbf[_0x7cb3('0x3b')],{'$or':_[_0x7cb3('0x3d')](_0x430457,function(_0x1d5d3c){if(_0x1d5d3c[_0x7cb3('0x3e')]!=='VIRTUAL'){var _0x241a21={};_0x241a21[_0x1d5d3c[_0x7cb3('0x29')]]={'$like':'%'+_0x2c1291[_0x7cb3('0x30')]['filter']+'%'};return _0x241a21;}})});}_0x3b7bbf=_[_0x7cb3('0x3c')]({},_0x3b7bbf,_0x2c1291['options']);var _0x2f0c19={'where':_0x3b7bbf[_0x7cb3('0x3b')]};return db['SugarcrmAccount'][_0x7cb3('0x1d')](_0x2f0c19)[_0x7cb3('0x23')](function(_0x133911){_0x1c35f4[_0x7cb3('0x1d')]=_0x133911;if(_0x2c1291[_0x7cb3('0x30')][_0x7cb3('0x3f')]){_0x3b7bbf['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x7cb3('0x40')](_0x3b7bbf);})['then'](function(_0x101191){_0x1c35f4[_0x7cb3('0x41')]=_0x101191;return _0x1c35f4;})[_0x7cb3('0x23')](respondWithFilteredResult(_0x598f78,_0x3b7bbf))[_0x7cb3('0x42')](handleError(_0x598f78,null));};exports[_0x7cb3('0x43')]=function(_0x219ead,_0x30ee24){var _0x4214df={'raw':![],'where':{'id':_0x219ead[_0x7cb3('0x44')]['id']}},_0x203ec2={};_0x203ec2[_0x7cb3('0x2f')]=_[_0x7cb3('0x31')](db[_0x7cb3('0x2b')][_0x7cb3('0x2c')]);_0x203ec2['query']=_[_0x7cb3('0x31')](_0x219ead[_0x7cb3('0x30')]);_0x203ec2[_0x7cb3('0x32')]=_[_0x7cb3('0x45')](_0x203ec2[_0x7cb3('0x2f')],_0x203ec2[_0x7cb3('0x30')]);_0x4214df[_0x7cb3('0x34')]=_['intersection'](_0x203ec2[_0x7cb3('0x2f')],qs[_0x7cb3('0x33')](_0x219ead[_0x7cb3('0x30')][_0x7cb3('0x33')]));_0x4214df[_0x7cb3('0x34')]=_0x4214df[_0x7cb3('0x34')][_0x7cb3('0x35')]?_0x4214df[_0x7cb3('0x34')]:_0x203ec2[_0x7cb3('0x2f')];if(_0x219ead[_0x7cb3('0x30')][_0x7cb3('0x3f')]){_0x4214df[_0x7cb3('0x46')]=[{'all':!![]}];}_0x4214df=_[_0x7cb3('0x3c')]({},_0x4214df,_0x219ead['options']);return db[_0x7cb3('0x2b')][_0x7cb3('0x47')](_0x4214df)[_0x7cb3('0x23')](handleEntityNotFound(_0x30ee24,null))[_0x7cb3('0x23')](respondWithResult(_0x30ee24,null))['catch'](handleError(_0x30ee24,null));};exports[_0x7cb3('0x48')]=function(_0x2691b7,_0x5e99cb){return db['SugarcrmAccount']['create'](_0x2691b7[_0x7cb3('0x49')],{})['then'](respondWithResult(_0x5e99cb,0xc9))[_0x7cb3('0x42')](handleError(_0x5e99cb,null));};exports[_0x7cb3('0x4a')]=function(_0x38255e,_0x2a7a0b){if(_0x38255e['body']['id']){delete _0x38255e[_0x7cb3('0x49')]['id'];}return db[_0x7cb3('0x2b')][_0x7cb3('0x47')]({'where':{'id':_0x38255e['params']['id']}})['then'](handleEntityNotFound(_0x2a7a0b,null))[_0x7cb3('0x23')](saveUpdates(_0x38255e['body'],null))['then'](respondWithResult(_0x2a7a0b,null))['catch'](handleError(_0x2a7a0b,null));};exports[_0x7cb3('0x24')]=function(_0xd8cd2f,_0x10bc1b){return db[_0x7cb3('0x2b')]['find']({'where':{'id':_0xd8cd2f[_0x7cb3('0x44')]['id']}})[_0x7cb3('0x23')](handleEntityNotFound(_0x10bc1b,null))[_0x7cb3('0x23')](removeEntity(_0x10bc1b,null))['catch'](handleError(_0x10bc1b,null));};exports[_0x7cb3('0x4b')]=function(_0x18ab15,_0x3b929a,_0x491359){var _0x3a99bb={};var _0x8c9425={};var _0x20280e;var _0x151f4a;return db[_0x7cb3('0x2b')][_0x7cb3('0x4c')]({'where':{'id':_0x18ab15[_0x7cb3('0x44')]['id']}})[_0x7cb3('0x23')](handleEntityNotFound(_0x3b929a,null))[_0x7cb3('0x23')](function(_0xcd6c03){if(_0xcd6c03){_0x20280e=_0xcd6c03;_0x8c9425[_0x7cb3('0x2f')]=_[_0x7cb3('0x31')](db[_0x7cb3('0x4d')]['rawAttributes']);_0x8c9425[_0x7cb3('0x30')]=_[_0x7cb3('0x31')](_0x18ab15[_0x7cb3('0x30')]);_0x8c9425[_0x7cb3('0x32')]=_['intersection'](_0x8c9425['model'],_0x8c9425[_0x7cb3('0x30')]);_0x3a99bb[_0x7cb3('0x34')]=_['intersection'](_0x8c9425[_0x7cb3('0x2f')],qs[_0x7cb3('0x33')](_0x18ab15[_0x7cb3('0x30')][_0x7cb3('0x33')]));_0x3a99bb['attributes']=_0x3a99bb[_0x7cb3('0x34')]['length']?_0x3a99bb[_0x7cb3('0x34')]:_0x8c9425['model'];_0x3a99bb[_0x7cb3('0x38')]=qs[_0x7cb3('0x39')](_0x18ab15[_0x7cb3('0x30')][_0x7cb3('0x39')]);_0x3a99bb[_0x7cb3('0x3b')]=qs[_0x7cb3('0x32')](_[_0x7cb3('0x3a')](_0x18ab15['query'],_0x8c9425[_0x7cb3('0x32')]));if(_0x18ab15[_0x7cb3('0x30')][_0x7cb3('0x4e')]){_0x3a99bb['where']=_[_0x7cb3('0x3c')](_0x3a99bb[_0x7cb3('0x3b')],{'$or':_[_0x7cb3('0x3d')](_0x3a99bb[_0x7cb3('0x34')],function(_0x4d63b5){var _0x4b0379={};_0x4b0379[_0x4d63b5]={'$like':'%'+_0x18ab15['query']['filter']+'%'};return _0x4b0379;})});}_0x3a99bb=_[_0x7cb3('0x3c')]({},_0x3a99bb,_0x18ab15[_0x7cb3('0x4f')]);return _0x20280e['getConfigurations'](_0x3a99bb);}})[_0x7cb3('0x23')](function(_0xf1f49c){if(_0xf1f49c){_0x151f4a=_0xf1f49c[_0x7cb3('0x35')];if(!_0x18ab15['query'][_0x7cb3('0x36')](_0x7cb3('0x37'))){_0x3a99bb[_0x7cb3('0x1c')]=qs['limit'](_0x18ab15[_0x7cb3('0x30')][_0x7cb3('0x1c')]);_0x3a99bb[_0x7cb3('0x1a')]=qs[_0x7cb3('0x1a')](_0x18ab15['query'][_0x7cb3('0x1a')]);}return _0x20280e[_0x7cb3('0x4b')](_0x3a99bb);}})[_0x7cb3('0x23')](function(_0x3c1f9a){if(_0x3c1f9a){return _0x3c1f9a?{'count':_0x151f4a,'rows':_0x3c1f9a}:null;}})[_0x7cb3('0x23')](respondWithResult(_0x3b929a,null))[_0x7cb3('0x42')](handleError(_0x3b929a,null));};exports[_0x7cb3('0x50')]=function(_0x3f5b9a,_0x21f037,_0x3c2a2e){if(_0x3f5b9a[_0x7cb3('0x49')]['id']){delete _0x3f5b9a['body']['id'];}return db[_0x7cb3('0x2b')][_0x7cb3('0x4c')]({'where':{'id':_0x3f5b9a[_0x7cb3('0x44')]['id']}})[_0x7cb3('0x23')](handleEntityNotFound(_0x21f037,null))[_0x7cb3('0x23')](function(_0x305a7b){if(_0x305a7b){_0x3f5b9a['body'][_0x7cb3('0x51')]=_0x305a7b['id'];_0x3f5b9a[_0x7cb3('0x49')][_0x7cb3('0x52')]=integrations[_0x7cb3('0x53')](_0x3f5b9a[_0x7cb3('0x49')]['channel'],_0x3f5b9a['body'][_0x7cb3('0x3e')]);_0x3f5b9a[_0x7cb3('0x49')][_0x7cb3('0x54')]=integrations['getDescriptions'](_0x3f5b9a['body'][_0x7cb3('0x55')],_0x3f5b9a[_0x7cb3('0x49')][_0x7cb3('0x3e')]);return db[_0x7cb3('0x4d')][_0x7cb3('0x48')](_0x3f5b9a[_0x7cb3('0x49')],{'include':[{'model':db[_0x7cb3('0x56')],'as':_0x7cb3('0x52')},{'model':db[_0x7cb3('0x56')],'as':_0x7cb3('0x54')}]});}return null;})[_0x7cb3('0x23')](respondWithResult(_0x21f037,null))[_0x7cb3('0x42')](handleError(_0x21f037,null));};exports[_0x7cb3('0x57')]=function(_0x18cd22,_0x4a8aa8,_0x4bcb24){var _0xcc0411='';var _0x46a7f8=['id','name',_0x7cb3('0x58'),_0x7cb3('0x59'),_0x7cb3('0x5a'),_0x7cb3('0x5b'),'duration_hours',_0x7cb3('0x5c'),_0x7cb3('0x5d'),_0x7cb3('0x5e'),'parent_name',_0x7cb3('0x5f')];return db[_0x7cb3('0x2b')][_0x7cb3('0x4c')]({'where':{'id':_0x18cd22[_0x7cb3('0x44')]['id']},'attributes':['id',_0x7cb3('0x60'),_0x7cb3('0x61'),_0x7cb3('0x62')]})[_0x7cb3('0x23')](handleEntityNotFound(_0x4a8aa8,null))[_0x7cb3('0x23')](function(_0xa6f3d2){if(_0xa6f3d2){_0xcc0411=_0xa6f3d2['remoteUri'];var _0x1647d6=_0xcc0411[_0x7cb3('0x63')](-0x1);if(_0x1647d6==='/'){_0xcc0411=_0xcc0411[_0x7cb3('0x64')](0x0,_0xcc0411[_0x7cb3('0x65')](_0x1647d6));}return rp({'method':_0x7cb3('0x66'),'uri':util[_0x7cb3('0x67')](_0x7cb3('0x68'),_0xcc0411,_0x7cb3('0x69')),'json':!![],'form':{'method':'login','input_type':_0x7cb3('0x6a'),'response_type':_0x7cb3('0x6a'),'rest_data':JSON[_0x7cb3('0x6b')]({'user_auth':{'user_name':_0xa6f3d2[_0x7cb3('0x60')],'password':_0xa6f3d2['password'],'encryption':_0x7cb3('0x6c')},'application':_0x7cb3('0x6d')})}});}})['then'](function(_0x467c91){if(_0x467c91&&_0x467c91[_0x7cb3('0x29')]!==_0x7cb3('0x6e')&&_0x467c91['name']!=='Password\x20Expired'){return rp({'method':_0x7cb3('0x66'),'uri':util[_0x7cb3('0x67')](_0x7cb3('0x68'),_0xcc0411,_0x7cb3('0x69')),'json':!![],'form':{'method':_0x7cb3('0x6f'),'input_type':_0x7cb3('0x6a'),'response_type':_0x7cb3('0x6a'),'rest_data':JSON[_0x7cb3('0x6b')]({'session':_0x467c91['id'],'module_name':_0x7cb3('0x70')})}})[_0x7cb3('0x23')](function(_0x16d4b3){if(_0x16d4b3){var _0x3ae433=_[_0x7cb3('0x71')](_0x16d4b3[_0x7cb3('0x72')]);_['remove'](_0x3ae433,function(_0x4dec4c){return _0x46a7f8[_0x7cb3('0x73')](_0x4dec4c[_0x7cb3('0x29')]);});return{'count':_0x3ae433[_0x7cb3('0x35')],'rows':_['map'](_0x3ae433,function(_0x4375df){return{'id':_0x4375df['name'],'name':_0x4375df[_0x7cb3('0x74')],'custom':_['endsWith'](_0x4375df[_0x7cb3('0x29')],'_c')?!![]:![],'options':_0x4375df[_0x7cb3('0x4f')]?_[_0x7cb3('0x3d')](_[_0x7cb3('0x71')](_0x4375df[_0x7cb3('0x4f')]),function(_0x4dd505){return{'name':_0x4dd505[_0x7cb3('0x75')],'value':_0x4dd505[_0x7cb3('0x29')]};}):[]};})};}})[_0x7cb3('0x23')](respondWithResult(_0x4a8aa8,null))[_0x7cb3('0x42')](function(_0x51e9e1){var _0x5cdcae=_0x18cd22[_0x7cb3('0x30')][_0x7cb3('0x76')]?0x1f4:_0x51e9e1['statusCode']||0x1f4;logger[_0x7cb3('0x27')](_0x7cb3('0x77'),'getFields',_0x5cdcae,JSON[_0x7cb3('0x6b')](_0x51e9e1));delete _0x51e9e1[_0x7cb3('0x29')];if(_0x5cdcae===0x191){_0x5cdcae=0x190;}_0x4a8aa8['status'](_0x5cdcae)['send'](_0x18cd22[_0x7cb3('0x30')][_0x7cb3('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x51e9e1['statusCode']}:_0x51e9e1);});}else{var _0x6b9a0=0x1f4;_0x4a8aa8[_0x7cb3('0x18')](_0x6b9a0)['send']({'message':_0x7cb3('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd6ec=['ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','show','params','length','catch','create','update','find','body','getConfigurations','SugarcrmConfiguration','map','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','endsWith','test','statusCode','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x54b050,_0x633614){var _0x45c3bc=function(_0x3994a8){while(--_0x3994a8){_0x54b050['push'](_0x54b050['shift']());}};_0x45c3bc(++_0x633614);}(_0xd6ec,0x6e));var _0xcd6e=function(_0x9f086d,_0xc4d544){_0x9f086d=_0x9f086d-0x0;var _0x5d720f=_0xd6ec[_0x9f086d];return _0x5d720f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd6e('0x0'));var zipdir=require(_0xcd6e('0x1'));var jsonpatch=require(_0xcd6e('0x2'));var rp=require(_0xcd6e('0x3'));var moment=require(_0xcd6e('0x4'));var BPromise=require(_0xcd6e('0x5'));var Mustache=require(_0xcd6e('0x6'));var util=require(_0xcd6e('0x7'));var path=require(_0xcd6e('0x8'));var sox=require(_0xcd6e('0x9'));var csv=require(_0xcd6e('0xa'));var ejs=require(_0xcd6e('0xb'));var fs=require('fs');var fs_extra=require(_0xcd6e('0xc'));var _=require(_0xcd6e('0xd'));var squel=require(_0xcd6e('0xe'));var crypto=require(_0xcd6e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcd6e('0x10'));var toCsv=require(_0xcd6e('0xa'));var querystring=require('querystring');var Papa=require(_0xcd6e('0x11'));var Redis=require(_0xcd6e('0x12'));var authService=require(_0xcd6e('0x13'));var qs=require(_0xcd6e('0x14'));var as=require(_0xcd6e('0x15'));var hardwareService=require(_0xcd6e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xcd6e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49352b,_0x356d9a){_0x356d9a=_0x356d9a||0xcc;return function(_0x268a82){if(_0x268a82){return _0x49352b[_0xcd6e('0x18')](_0x356d9a);}return _0x49352b[_0xcd6e('0x19')](_0x356d9a)[_0xcd6e('0x1a')]();};}function respondWithResult(_0x2ad44a,_0x6ca8b8){_0x6ca8b8=_0x6ca8b8||0xc8;return function(_0x2b9d1f){if(_0x2b9d1f){return _0x2ad44a[_0xcd6e('0x19')](_0x6ca8b8)[_0xcd6e('0x1b')](_0x2b9d1f);}};}function respondWithFilteredResult(_0x206690,_0x185c93){return function(_0x4a1a3c){if(_0x4a1a3c){var _0x457544=typeof _0x185c93[_0xcd6e('0x1c')]===_0xcd6e('0x1d')&&typeof _0x185c93[_0xcd6e('0x1e')]===_0xcd6e('0x1d');var _0x5e00d3=_0x4a1a3c['count'];var _0x53220d=_0x457544?0x0:_0x185c93[_0xcd6e('0x1c')];var _0x599857=_0x457544?_0x4a1a3c[_0xcd6e('0x1f')]:_0x185c93['offset']+_0x185c93['limit'];var _0x4445b2;if(_0x599857>=_0x5e00d3){_0x599857=_0x5e00d3;_0x4445b2=0xc8;}else{_0x4445b2=0xce;}_0x206690[_0xcd6e('0x19')](_0x4445b2);return _0x206690[_0xcd6e('0x20')]('Content-Range',_0x53220d+'-'+_0x599857+'/'+_0x5e00d3)[_0xcd6e('0x1b')](_0x4a1a3c);}return null;};}function patchUpdates(_0x21b934){return function(_0x4944a0){try{jsonpatch['apply'](_0x4944a0,_0x21b934,!![]);}catch(_0x434829){return BPromise[_0xcd6e('0x21')](_0x434829);}return _0x4944a0[_0xcd6e('0x22')]();};}function saveUpdates(_0x4265f9,_0x54124b){return function(_0x4ec5c2){if(_0x4ec5c2){return _0x4ec5c2['update'](_0x4265f9)['then'](function(_0x48d176){return _0x48d176;});}return null;};}function removeEntity(_0x338e00,_0x570afb){return function(_0x399285){if(_0x399285){return _0x399285[_0xcd6e('0x23')]()['then'](function(){_0x338e00[_0xcd6e('0x19')](0xcc)[_0xcd6e('0x1a')]();});}};}function handleEntityNotFound(_0x3624c0,_0x34f0d7){return function(_0x408dda){if(!_0x408dda){_0x3624c0['sendStatus'](0x194);}return _0x408dda;};}function handleError(_0x31cca4,_0x39b4cd){_0x39b4cd=_0x39b4cd||0x1f4;return function(_0xbb7024){logger[_0xcd6e('0x24')](_0xbb7024[_0xcd6e('0x25')]);if(_0xbb7024[_0xcd6e('0x26')]){delete _0xbb7024[_0xcd6e('0x26')];}_0x31cca4[_0xcd6e('0x19')](_0x39b4cd)['send'](_0xbb7024);};}exports[_0xcd6e('0x27')]=function(_0x2e90f4,_0x1be986){var _0x5a87ca={},_0x154719={},_0x47832f={'count':0x0,'rows':[]};var _0x33a108=_['map'](db[_0xcd6e('0x28')][_0xcd6e('0x29')],function(_0x168cc9){return{'name':_0x168cc9[_0xcd6e('0x2a')],'type':_0x168cc9[_0xcd6e('0x2b')][_0xcd6e('0x2c')]};});_0x154719['model']=_['map'](_0x33a108,_0xcd6e('0x26'));_0x154719[_0xcd6e('0x2d')]=_[_0xcd6e('0x2e')](_0x2e90f4[_0xcd6e('0x2d')]);_0x154719[_0xcd6e('0x2f')]=_[_0xcd6e('0x30')](_0x154719[_0xcd6e('0x31')],_0x154719[_0xcd6e('0x2d')]);_0x5a87ca[_0xcd6e('0x32')]=_[_0xcd6e('0x30')](_0x154719[_0xcd6e('0x31')],qs[_0xcd6e('0x33')](_0x2e90f4['query']['fields']));_0x5a87ca[_0xcd6e('0x32')]=_0x5a87ca[_0xcd6e('0x32')]['length']?_0x5a87ca[_0xcd6e('0x32')]:_0x154719[_0xcd6e('0x31')];if(!_0x2e90f4['query'][_0xcd6e('0x34')](_0xcd6e('0x35'))){_0x5a87ca[_0xcd6e('0x1e')]=qs[_0xcd6e('0x1e')](_0x2e90f4[_0xcd6e('0x2d')][_0xcd6e('0x1e')]);_0x5a87ca[_0xcd6e('0x1c')]=qs[_0xcd6e('0x1c')](_0x2e90f4[_0xcd6e('0x2d')][_0xcd6e('0x1c')]);}_0x5a87ca[_0xcd6e('0x36')]=qs[_0xcd6e('0x37')](_0x2e90f4[_0xcd6e('0x2d')]['sort']);_0x5a87ca[_0xcd6e('0x38')]=qs['filters'](_[_0xcd6e('0x39')](_0x2e90f4[_0xcd6e('0x2d')],_0x154719[_0xcd6e('0x2f')]),_0x33a108);if(_0x2e90f4[_0xcd6e('0x2d')][_0xcd6e('0x3a')]){_0x5a87ca[_0xcd6e('0x38')]=_[_0xcd6e('0x3b')](_0x5a87ca['where'],{'$or':_['map'](_0x33a108,function(_0x462bcd){if(_0x462bcd[_0xcd6e('0x2b')]!==_0xcd6e('0x3c')){var _0x49f36e={};_0x49f36e[_0x462bcd[_0xcd6e('0x26')]]={'$like':'%'+_0x2e90f4[_0xcd6e('0x2d')][_0xcd6e('0x3a')]+'%'};return _0x49f36e;}})});}_0x5a87ca=_[_0xcd6e('0x3b')]({},_0x5a87ca,_0x2e90f4[_0xcd6e('0x3d')]);var _0x591254={'where':_0x5a87ca[_0xcd6e('0x38')]};return db[_0xcd6e('0x28')]['count'](_0x591254)[_0xcd6e('0x3e')](function(_0x472343){_0x47832f[_0xcd6e('0x1f')]=_0x472343;if(_0x2e90f4[_0xcd6e('0x2d')][_0xcd6e('0x3f')]){_0x5a87ca[_0xcd6e('0x40')]=[{'all':!![]}];}return db[_0xcd6e('0x28')]['findAll'](_0x5a87ca);})[_0xcd6e('0x3e')](function(_0x386619){_0x47832f[_0xcd6e('0x41')]=_0x386619;return _0x47832f;})[_0xcd6e('0x3e')](respondWithFilteredResult(_0x1be986,_0x5a87ca))['catch'](handleError(_0x1be986,null));};exports[_0xcd6e('0x42')]=function(_0xeb6e9,_0x52d763){var _0x376036={'raw':![],'where':{'id':_0xeb6e9[_0xcd6e('0x43')]['id']}},_0x1fe40c={};_0x1fe40c['model']=_[_0xcd6e('0x2e')](db[_0xcd6e('0x28')][_0xcd6e('0x29')]);_0x1fe40c[_0xcd6e('0x2d')]=_[_0xcd6e('0x2e')](_0xeb6e9[_0xcd6e('0x2d')]);_0x1fe40c['filters']=_[_0xcd6e('0x30')](_0x1fe40c['model'],_0x1fe40c[_0xcd6e('0x2d')]);_0x376036['attributes']=_[_0xcd6e('0x30')](_0x1fe40c['model'],qs[_0xcd6e('0x33')](_0xeb6e9[_0xcd6e('0x2d')][_0xcd6e('0x33')]));_0x376036[_0xcd6e('0x32')]=_0x376036[_0xcd6e('0x32')][_0xcd6e('0x44')]?_0x376036['attributes']:_0x1fe40c[_0xcd6e('0x31')];if(_0xeb6e9['query']['includeAll']){_0x376036['include']=[{'all':!![]}];}_0x376036=_[_0xcd6e('0x3b')]({},_0x376036,_0xeb6e9[_0xcd6e('0x3d')]);return db[_0xcd6e('0x28')]['find'](_0x376036)['then'](handleEntityNotFound(_0x52d763,null))[_0xcd6e('0x3e')](respondWithResult(_0x52d763,null))[_0xcd6e('0x45')](handleError(_0x52d763,null));};exports[_0xcd6e('0x46')]=function(_0x5bca68,_0x1de911){return db[_0xcd6e('0x28')][_0xcd6e('0x46')](_0x5bca68['body'],{})[_0xcd6e('0x3e')](respondWithResult(_0x1de911,0xc9))[_0xcd6e('0x45')](handleError(_0x1de911,null));};exports[_0xcd6e('0x47')]=function(_0x39629a,_0x359f4e){if(_0x39629a['body']['id']){delete _0x39629a['body']['id'];}return db[_0xcd6e('0x28')][_0xcd6e('0x48')]({'where':{'id':_0x39629a[_0xcd6e('0x43')]['id']}})[_0xcd6e('0x3e')](handleEntityNotFound(_0x359f4e,null))[_0xcd6e('0x3e')](saveUpdates(_0x39629a[_0xcd6e('0x49')],null))[_0xcd6e('0x3e')](respondWithResult(_0x359f4e,null))['catch'](handleError(_0x359f4e,null));};exports[_0xcd6e('0x23')]=function(_0x531e20,_0x454f59){return db[_0xcd6e('0x28')]['find']({'where':{'id':_0x531e20[_0xcd6e('0x43')]['id']}})[_0xcd6e('0x3e')](handleEntityNotFound(_0x454f59,null))['then'](removeEntity(_0x454f59,null))[_0xcd6e('0x45')](handleError(_0x454f59,null));};exports[_0xcd6e('0x4a')]=function(_0x420337,_0x5a3b75,_0x1eee0d){var _0x1326b9={};var _0x45924e={};var _0x467522;var _0x49bfaf;return db[_0xcd6e('0x28')]['findOne']({'where':{'id':_0x420337[_0xcd6e('0x43')]['id']}})[_0xcd6e('0x3e')](handleEntityNotFound(_0x5a3b75,null))[_0xcd6e('0x3e')](function(_0x2c6a3f){if(_0x2c6a3f){_0x467522=_0x2c6a3f;_0x45924e[_0xcd6e('0x31')]=_[_0xcd6e('0x2e')](db[_0xcd6e('0x4b')][_0xcd6e('0x29')]);_0x45924e[_0xcd6e('0x2d')]=_[_0xcd6e('0x2e')](_0x420337['query']);_0x45924e[_0xcd6e('0x2f')]=_[_0xcd6e('0x30')](_0x45924e[_0xcd6e('0x31')],_0x45924e[_0xcd6e('0x2d')]);_0x1326b9[_0xcd6e('0x32')]=_['intersection'](_0x45924e[_0xcd6e('0x31')],qs[_0xcd6e('0x33')](_0x420337[_0xcd6e('0x2d')]['fields']));_0x1326b9[_0xcd6e('0x32')]=_0x1326b9[_0xcd6e('0x32')]['length']?_0x1326b9[_0xcd6e('0x32')]:_0x45924e[_0xcd6e('0x31')];_0x1326b9[_0xcd6e('0x36')]=qs[_0xcd6e('0x37')](_0x420337['query'][_0xcd6e('0x37')]);_0x1326b9[_0xcd6e('0x38')]=qs['filters'](_[_0xcd6e('0x39')](_0x420337['query'],_0x45924e[_0xcd6e('0x2f')]));if(_0x420337['query']['filter']){_0x1326b9[_0xcd6e('0x38')]=_[_0xcd6e('0x3b')](_0x1326b9[_0xcd6e('0x38')],{'$or':_[_0xcd6e('0x4c')](_0x1326b9[_0xcd6e('0x32')],function(_0x40a7e1){var _0x2386ec={};_0x2386ec[_0x40a7e1]={'$like':'%'+_0x420337[_0xcd6e('0x2d')]['filter']+'%'};return _0x2386ec;})});}_0x1326b9=_[_0xcd6e('0x3b')]({},_0x1326b9,_0x420337[_0xcd6e('0x3d')]);return _0x467522['getConfigurations'](_0x1326b9);}})[_0xcd6e('0x3e')](function(_0x48b039){if(_0x48b039){_0x49bfaf=_0x48b039[_0xcd6e('0x44')];if(!_0x420337[_0xcd6e('0x2d')][_0xcd6e('0x34')](_0xcd6e('0x35'))){_0x1326b9[_0xcd6e('0x1e')]=qs['limit'](_0x420337[_0xcd6e('0x2d')][_0xcd6e('0x1e')]);_0x1326b9[_0xcd6e('0x1c')]=qs['offset'](_0x420337[_0xcd6e('0x2d')][_0xcd6e('0x1c')]);}return _0x467522[_0xcd6e('0x4a')](_0x1326b9);}})[_0xcd6e('0x3e')](function(_0x26435a){if(_0x26435a){return _0x26435a?{'count':_0x49bfaf,'rows':_0x26435a}:null;}})[_0xcd6e('0x3e')](respondWithResult(_0x5a3b75,null))[_0xcd6e('0x45')](handleError(_0x5a3b75,null));};exports[_0xcd6e('0x4d')]=function(_0x41494b,_0x4262d5,_0x3e0c67){if(_0x41494b['body']['id']){delete _0x41494b['body']['id'];}return db[_0xcd6e('0x28')][_0xcd6e('0x4e')]({'where':{'id':_0x41494b[_0xcd6e('0x43')]['id']}})[_0xcd6e('0x3e')](handleEntityNotFound(_0x4262d5,null))[_0xcd6e('0x3e')](function(_0x9d1860){if(_0x9d1860){_0x41494b[_0xcd6e('0x49')]['AccountId']=_0x9d1860['id'];_0x41494b[_0xcd6e('0x49')][_0xcd6e('0x4f')]=integrations[_0xcd6e('0x50')](_0x41494b[_0xcd6e('0x49')]['channel'],_0x41494b[_0xcd6e('0x49')]['type']);_0x41494b[_0xcd6e('0x49')][_0xcd6e('0x51')]=integrations[_0xcd6e('0x52')](_0x41494b['body'][_0xcd6e('0x53')],_0x41494b['body'][_0xcd6e('0x2b')]);return db['SugarcrmConfiguration'][_0xcd6e('0x46')](_0x41494b['body'],{'include':[{'model':db[_0xcd6e('0x54')],'as':'Subjects'},{'model':db[_0xcd6e('0x54')],'as':_0xcd6e('0x51')}]});}return null;})[_0xcd6e('0x3e')](respondWithResult(_0x4262d5,null))['catch'](handleError(_0x4262d5,null));};exports[_0xcd6e('0x55')]=function(_0x5cc6d4,_0x1e0eba,_0x281749){var _0x2554f9='';var _0x512b2a=['id',_0xcd6e('0x26'),'assigned_user_id',_0xcd6e('0x56'),_0xcd6e('0x57'),_0xcd6e('0x58'),_0xcd6e('0x59'),_0xcd6e('0x5a'),_0xcd6e('0x5b'),_0xcd6e('0x5c'),_0xcd6e('0x5d'),_0xcd6e('0x5e')];return db[_0xcd6e('0x28')]['findOne']({'where':{'id':_0x5cc6d4[_0xcd6e('0x43')]['id']},'attributes':['id',_0xcd6e('0x5f'),_0xcd6e('0x60'),_0xcd6e('0x61')]})['then'](handleEntityNotFound(_0x1e0eba,null))['then'](function(_0xb818ca){if(_0xb818ca){_0x2554f9=_0xb818ca[_0xcd6e('0x61')];var _0x32c5df=_0x2554f9[_0xcd6e('0x62')](-0x1);if(_0x32c5df==='/'){_0x2554f9=_0x2554f9[_0xcd6e('0x63')](0x0,_0x2554f9[_0xcd6e('0x64')](_0x32c5df));}return rp({'method':_0xcd6e('0x65'),'uri':util[_0xcd6e('0x66')](_0xcd6e('0x67'),_0x2554f9,_0xcd6e('0x68')),'json':!![],'form':{'method':_0xcd6e('0x69'),'input_type':_0xcd6e('0x6a'),'response_type':'JSON','rest_data':JSON[_0xcd6e('0x6b')]({'user_auth':{'user_name':_0xb818ca[_0xcd6e('0x5f')],'password':_0xb818ca[_0xcd6e('0x60')],'encryption':_0xcd6e('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xcd6e('0x3e')](function(_0x1e4fa3){if(_0x1e4fa3&&_0x1e4fa3[_0xcd6e('0x26')]!==_0xcd6e('0x6d')&&_0x1e4fa3[_0xcd6e('0x26')]!==_0xcd6e('0x6e')){return rp({'method':'POST','uri':util['format'](_0xcd6e('0x67'),_0x2554f9,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xcd6e('0x6f'),'input_type':_0xcd6e('0x6a'),'response_type':_0xcd6e('0x6a'),'rest_data':JSON[_0xcd6e('0x6b')]({'session':_0x1e4fa3['id'],'module_name':_0xcd6e('0x70')})}})['then'](function(_0x1c70c5){if(_0x1c70c5){var _0x502294=_[_0xcd6e('0x71')](_0x1c70c5[_0xcd6e('0x72')]);_['remove'](_0x502294,function(_0x4d4d19){return _0x512b2a['includes'](_0x4d4d19['name']);});return{'count':_0x502294[_0xcd6e('0x44')],'rows':_[_0xcd6e('0x4c')](_0x502294,function(_0x4a1257){return{'id':_0x4a1257[_0xcd6e('0x26')],'name':_0x4a1257[_0xcd6e('0x73')],'custom':_[_0xcd6e('0x74')](_0x4a1257['name'],'_c')?!![]:![],'options':_0x4a1257['options']?_[_0xcd6e('0x4c')](_[_0xcd6e('0x71')](_0x4a1257['options']),function(_0xb7336e){return{'name':_0xb7336e['value'],'value':_0xb7336e[_0xcd6e('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x1e0eba,null))[_0xcd6e('0x45')](function(_0x43faa9){var _0x54adcf=_0x5cc6d4[_0xcd6e('0x2d')][_0xcd6e('0x75')]?0x1f4:_0x43faa9[_0xcd6e('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xcd6e('0x55'),_0x54adcf,JSON['stringify'](_0x43faa9));delete _0x43faa9[_0xcd6e('0x26')];if(_0x54adcf===0x191){_0x54adcf=0x190;}_0x1e0eba['status'](_0x54adcf)[_0xcd6e('0x77')](_0x5cc6d4[_0xcd6e('0x2d')][_0xcd6e('0x75')]?{'message':_0xcd6e('0x78'),'statusCode':_0x43faa9['statusCode']}:_0x43faa9);});}else{var _0x5d6a59=0x1f4;_0x1e0eba[_0xcd6e('0x19')](_0x5d6a59)[_0xcd6e('0x77')]({'message':_0xcd6e('0x78'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index a136864..6966f83 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 _0x057f=['int_sugarcrm_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x37d701,_0x1508e5){var _0x5158d3=function(_0x5a1e66){while(--_0x5a1e66){_0x37d701['push'](_0x37d701['shift']());}};_0x5158d3(++_0x1508e5);}(_0x057f,0xf1));var _0xf057=function(_0xe5c7b7,_0x27c131){_0xe5c7b7=_0xe5c7b7-0x0;var _0x203f94=_0x057f[_0xe5c7b7];return _0x203f94;};'use strict';var _=require('lodash');var util=require(_0xf057('0x0'));var logger=require(_0xf057('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf057('0x2'));var fs=require('fs');var path=require(_0xf057('0x3'));var rimraf=require(_0xf057('0x4'));var config=require(_0xf057('0x5'));var attributes=require(_0xf057('0x6'));var integrations=require(_0xf057('0x7'));module[_0xf057('0x8')]=function(_0x51ab63,_0x465902){return _0x51ab63[_0xf057('0x9')](_0xf057('0xa'),attributes,{'tableName':_0xf057('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc038=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1ea63a,_0x43fd9f){var _0x1eb374=function(_0x8facd8){while(--_0x8facd8){_0x1ea63a['push'](_0x1ea63a['shift']());}};_0x1eb374(++_0x43fd9f);}(_0xc038,0x17e));var _0x8c03=function(_0x4aaff3,_0x2df319){_0x4aaff3=_0x4aaff3-0x0;var _0x385555=_0xc038[_0x4aaff3];return _0x385555;};'use strict';var _=require(_0x8c03('0x0'));var util=require(_0x8c03('0x1'));var logger=require('../../config/logger')(_0x8c03('0x2'));var moment=require(_0x8c03('0x3'));var BPromise=require(_0x8c03('0x4'));var rp=require(_0x8c03('0x5'));var fs=require('fs');var path=require(_0x8c03('0x6'));var rimraf=require('rimraf');var config=require(_0x8c03('0x7'));var attributes=require(_0x8c03('0x8'));var integrations=require(_0x8c03('0x9'));module['exports']=function(_0x564fa5,_0x2cd839){return _0x564fa5[_0x8c03('0xa')](_0x8c03('0xb'),attributes,{'tableName':_0x8c03('0xc'),'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 7e76092..3cbe641 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 _0x90ef=['catch','ShowSugarcrmAccount','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','map','include','model','attributes','then'];(function(_0x219fef,_0x7fbc27){var _0x472821=function(_0x3ab183){while(--_0x3ab183){_0x219fef['push'](_0x219fef['shift']());}};_0x472821(++_0x7fbc27);}(_0x90ef,0x1d3));var _0xf90e=function(_0x598863,_0x36e2fd){_0x598863=_0x598863-0x0;var _0x5cef37=_0x90ef[_0x598863];return _0x5cef37;};'use strict';var _=require(_0xf90e('0x0'));var util=require('util');var moment=require(_0xf90e('0x1'));var BPromise=require(_0xf90e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf90e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf90e('0x4'));var logger=require('../../config/logger')(_0xf90e('0x5'));var config=require('../../config/environment');var jayson=require(_0xf90e('0x6'));var client=jayson[_0xf90e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97f744,_0x462282,_0x2c5324){return new BPromise(function(_0x11f247,_0x5b1e2d){return client[_0xf90e('0x8')](_0x97f744,_0x2c5324)['then'](function(_0x5288d1){logger[_0xf90e('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x462282,_0xf90e('0xa'));logger[_0xf90e('0xb')](_0xf90e('0xc'),_0x462282,'request\x20sent',JSON[_0xf90e('0xd')](_0x5288d1));if(_0x5288d1[_0xf90e('0xe')]){if(_0x5288d1[_0xf90e('0xe')][_0xf90e('0xf')]===0x1f4){logger[_0xf90e('0xe')](_0xf90e('0x10'),_0x462282,_0x5288d1[_0xf90e('0xe')][_0xf90e('0x11')]);return _0x5b1e2d(_0x5288d1[_0xf90e('0xe')][_0xf90e('0x11')]);}logger[_0xf90e('0xe')](_0xf90e('0x10'),_0x462282,_0x5288d1['error'][_0xf90e('0x11')]);return _0x11f247(_0x5288d1[_0xf90e('0xe')][_0xf90e('0x11')]);}else{logger[_0xf90e('0x9')](_0xf90e('0x10'),_0x462282,_0xf90e('0xa'));_0x11f247(_0x5288d1['result'][_0xf90e('0x11')]);}})['catch'](function(_0x549f43){logger[_0xf90e('0xe')](_0xf90e('0x10'),_0x462282,_0x549f43);_0x5b1e2d(_0x549f43);});});}exports[_0xf90e('0x12')]=function(_0x924889){var _0x39f4b7=this;return new Promise(function(_0x170fb0,_0x26a9fc){return db[_0xf90e('0x13')][_0xf90e('0x14')]({'raw':_0x924889[_0xf90e('0x15')]?_0x924889['options'][_0xf90e('0x16')]===undefined?!![]:![]:!![],'where':_0x924889[_0xf90e('0x15')]?_0x924889['options'][_0xf90e('0x17')]||null:null,'attributes':_0x924889['options']?_0x924889[_0xf90e('0x15')]['attributes']||null:null,'limit':_0x924889[_0xf90e('0x15')]?_0x924889[_0xf90e('0x15')]['limit']||null:null,'include':_0x924889[_0xf90e('0x15')]?_0x924889['options']['include']?_[_0xf90e('0x18')](_0x924889['options'][_0xf90e('0x19')],function(_0x3dd29d){return{'model':db[_0x3dd29d[_0xf90e('0x1a')]],'as':_0x3dd29d['as'],'attributes':_0x3dd29d[_0xf90e('0x1b')],'include':_0x3dd29d[_0xf90e('0x19')]?_['map'](_0x3dd29d[_0xf90e('0x19')],function(_0x324214){return{'model':db[_0x324214[_0xf90e('0x1a')]],'as':_0x324214['as'],'attributes':_0x324214[_0xf90e('0x1b')],'include':_0x324214[_0xf90e('0x19')]?_['map'](_0x324214[_0xf90e('0x19')],function(_0x8e6d78){return{'model':db[_0x8e6d78[_0xf90e('0x1a')]],'as':_0x8e6d78['as'],'attributes':_0x8e6d78[_0xf90e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf90e('0x1c')](function(_0x217a6f){logger[_0xf90e('0x9')](_0xf90e('0x12'),_0x924889);logger[_0xf90e('0xb')]('GetSugarcrmAccount',_0x924889,JSON['stringify'](_0x217a6f));_0x170fb0(_0x217a6f);})[_0xf90e('0x1d')](function(_0x357ee8){logger[_0xf90e('0xe')](_0xf90e('0x12'),_0x357ee8[_0xf90e('0x11')],_0x924889);_0x26a9fc(_0x39f4b7[_0xf90e('0xe')](0x1f4,_0x357ee8[_0xf90e('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x2f4605){var _0x2fffb8=this;return new Promise(function(_0x311728,_0xa66493){return db[_0xf90e('0x13')]['find']({'raw':_0x2f4605[_0xf90e('0x15')]?_0x2f4605[_0xf90e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2f4605[_0xf90e('0x15')]?_0x2f4605[_0xf90e('0x15')][_0xf90e('0x17')]||null:null,'attributes':_0x2f4605[_0xf90e('0x15')]?_0x2f4605[_0xf90e('0x15')][_0xf90e('0x1b')]||null:null,'include':_0x2f4605[_0xf90e('0x15')]?_0x2f4605['options'][_0xf90e('0x19')]?_[_0xf90e('0x18')](_0x2f4605[_0xf90e('0x15')][_0xf90e('0x19')],function(_0x115c70){return{'model':db[_0x115c70[_0xf90e('0x1a')]],'as':_0x115c70['as'],'attributes':_0x115c70[_0xf90e('0x1b')],'include':_0x115c70['include']?_[_0xf90e('0x18')](_0x115c70[_0xf90e('0x19')],function(_0x21ae9b){return{'model':db[_0x21ae9b['model']],'as':_0x21ae9b['as'],'attributes':_0x21ae9b[_0xf90e('0x1b')],'include':_0x21ae9b['include']?_['map'](_0x21ae9b[_0xf90e('0x19')],function(_0x3234b1){return{'model':db[_0x3234b1['model']],'as':_0x3234b1['as'],'attributes':_0x3234b1[_0xf90e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf90e('0x1c')](function(_0x2fcf24){logger[_0xf90e('0x9')]('ShowSugarcrmAccount',_0x2f4605);logger[_0xf90e('0xb')](_0xf90e('0x1e'),_0x2f4605,JSON[_0xf90e('0xd')](_0x2fcf24));_0x311728(_0x2fcf24);})[_0xf90e('0x1d')](function(_0xe4d536){logger[_0xf90e('0xe')]('ShowSugarcrmAccount',_0xe4d536[_0xf90e('0x11')],_0x2f4605);_0xa66493(_0x2fffb8[_0xf90e('0xe')](0x1f4,_0xe4d536[_0xf90e('0x11')]));});});}; \ No newline at end of file +var _0x4cce=['map','model','debug','find','raw','then','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/environment','client','http','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include'];(function(_0x3c059c,_0x3fcdc7){var _0x34e758=function(_0xdff1d6){while(--_0xdff1d6){_0x3c059c['push'](_0x3c059c['shift']());}};_0x34e758(++_0x3fcdc7);}(_0x4cce,0x151));var _0xe4cc=function(_0x5b0018,_0x5275b1){_0x5b0018=_0x5b0018-0x0;var _0xca6b28=_0x4cce[_0x5b0018];return _0xca6b28;};'use strict';var _=require(_0xe4cc('0x0'));var util=require(_0xe4cc('0x1'));var moment=require('moment');var BPromise=require(_0xe4cc('0x2'));var rs=require(_0xe4cc('0x3'));var fs=require('fs');var Redis=require(_0xe4cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe4cc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe4cc('0x6')][_0xe4cc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46d4b6,_0x368b06,_0x37c80f){return new BPromise(function(_0x58a2db,_0xcbd056){return client['request'](_0x46d4b6,_0x37c80f)['then'](function(_0x3dd40b){logger[_0xe4cc('0x8')]('SugarcrmAccount,\x20%s,\x20%s',_0x368b06,_0xe4cc('0x9'));logger['debug'](_0xe4cc('0xa'),_0x368b06,_0xe4cc('0x9'),JSON[_0xe4cc('0xb')](_0x3dd40b));if(_0x3dd40b[_0xe4cc('0xc')]){if(_0x3dd40b[_0xe4cc('0xc')][_0xe4cc('0xd')]===0x1f4){logger[_0xe4cc('0xc')](_0xe4cc('0xe'),_0x368b06,_0x3dd40b[_0xe4cc('0xc')]['message']);return _0xcbd056(_0x3dd40b[_0xe4cc('0xc')][_0xe4cc('0xf')]);}logger['error'](_0xe4cc('0xe'),_0x368b06,_0x3dd40b[_0xe4cc('0xc')][_0xe4cc('0xf')]);return _0x58a2db(_0x3dd40b[_0xe4cc('0xc')][_0xe4cc('0xf')]);}else{logger[_0xe4cc('0x8')](_0xe4cc('0xe'),_0x368b06,'request\x20sent');_0x58a2db(_0x3dd40b[_0xe4cc('0x10')]['message']);}})[_0xe4cc('0x11')](function(_0x1e7b24){logger[_0xe4cc('0xc')](_0xe4cc('0xe'),_0x368b06,_0x1e7b24);_0xcbd056(_0x1e7b24);});});}exports[_0xe4cc('0x12')]=function(_0xbc7b6c){var _0x37cf35=this;return new Promise(function(_0x226b92,_0x2e05cb){return db[_0xe4cc('0x13')][_0xe4cc('0x14')]({'raw':_0xbc7b6c['options']?_0xbc7b6c[_0xe4cc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xbc7b6c['options']?_0xbc7b6c[_0xe4cc('0x15')][_0xe4cc('0x16')]||null:null,'attributes':_0xbc7b6c[_0xe4cc('0x15')]?_0xbc7b6c[_0xe4cc('0x15')][_0xe4cc('0x17')]||null:null,'limit':_0xbc7b6c[_0xe4cc('0x15')]?_0xbc7b6c['options'][_0xe4cc('0x18')]||null:null,'include':_0xbc7b6c[_0xe4cc('0x15')]?_0xbc7b6c['options'][_0xe4cc('0x19')]?_[_0xe4cc('0x1a')](_0xbc7b6c[_0xe4cc('0x15')][_0xe4cc('0x19')],function(_0x5a7640){return{'model':db[_0x5a7640['model']],'as':_0x5a7640['as'],'attributes':_0x5a7640[_0xe4cc('0x17')],'include':_0x5a7640[_0xe4cc('0x19')]?_[_0xe4cc('0x1a')](_0x5a7640[_0xe4cc('0x19')],function(_0xb97dc6){return{'model':db[_0xb97dc6[_0xe4cc('0x1b')]],'as':_0xb97dc6['as'],'attributes':_0xb97dc6[_0xe4cc('0x17')],'include':_0xb97dc6['include']?_[_0xe4cc('0x1a')](_0xb97dc6[_0xe4cc('0x19')],function(_0xb0615a){return{'model':db[_0xb0615a[_0xe4cc('0x1b')]],'as':_0xb0615a['as'],'attributes':_0xb0615a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19bbe0){logger[_0xe4cc('0x8')](_0xe4cc('0x12'),_0xbc7b6c);logger[_0xe4cc('0x1c')](_0xe4cc('0x12'),_0xbc7b6c,JSON['stringify'](_0x19bbe0));_0x226b92(_0x19bbe0);})['catch'](function(_0x2d66f5){logger[_0xe4cc('0xc')]('GetSugarcrmAccount',_0x2d66f5[_0xe4cc('0xf')],_0xbc7b6c);_0x2e05cb(_0x37cf35['error'](0x1f4,_0x2d66f5[_0xe4cc('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x46dbc7){var _0x45595f=this;return new Promise(function(_0x464b62,_0x81101d){return db[_0xe4cc('0x13')][_0xe4cc('0x1d')]({'raw':_0x46dbc7[_0xe4cc('0x15')]?_0x46dbc7[_0xe4cc('0x15')][_0xe4cc('0x1e')]===undefined?!![]:![]:!![],'where':_0x46dbc7['options']?_0x46dbc7[_0xe4cc('0x15')][_0xe4cc('0x16')]||null:null,'attributes':_0x46dbc7['options']?_0x46dbc7[_0xe4cc('0x15')]['attributes']||null:null,'include':_0x46dbc7[_0xe4cc('0x15')]?_0x46dbc7['options'][_0xe4cc('0x19')]?_['map'](_0x46dbc7['options'][_0xe4cc('0x19')],function(_0x4cea90){return{'model':db[_0x4cea90[_0xe4cc('0x1b')]],'as':_0x4cea90['as'],'attributes':_0x4cea90[_0xe4cc('0x17')],'include':_0x4cea90[_0xe4cc('0x19')]?_[_0xe4cc('0x1a')](_0x4cea90[_0xe4cc('0x19')],function(_0x409f5f){return{'model':db[_0x409f5f['model']],'as':_0x409f5f['as'],'attributes':_0x409f5f[_0xe4cc('0x17')],'include':_0x409f5f['include']?_[_0xe4cc('0x1a')](_0x409f5f[_0xe4cc('0x19')],function(_0x12a110){return{'model':db[_0x12a110[_0xe4cc('0x1b')]],'as':_0x12a110['as'],'attributes':_0x12a110['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4cc('0x1f')](function(_0x253a39){logger[_0xe4cc('0x8')](_0xe4cc('0x20'),_0x46dbc7);logger['debug']('ShowSugarcrmAccount',_0x46dbc7,JSON[_0xe4cc('0xb')](_0x253a39));_0x464b62(_0x253a39);})[_0xe4cc('0x11')](function(_0x4090b4){logger[_0xe4cc('0xc')]('ShowSugarcrmAccount',_0x4090b4[_0xe4cc('0xf')],_0x46dbc7);_0x81101d(_0x45595f['error'](0x1f4,_0x4090b4[_0xe4cc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1a9837b..2589a43 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 _0xaf68=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/fields','getFields','getSubjects','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x539965,_0x284d53){var _0x41ec61=function(_0x3bd69b){while(--_0x3bd69b){_0x539965['push'](_0x539965['shift']());}};_0x41ec61(++_0x284d53);}(_0xaf68,0x127));var _0x8af6=function(_0x36ac27,_0x191f23){_0x36ac27=_0x36ac27-0x0;var _0xb6051=_0xaf68[_0x36ac27];return _0xb6051;};'use strict';var multer=require(_0x8af6('0x0'));var util=require(_0x8af6('0x1'));var path=require('path');var timeout=require(_0x8af6('0x2'));var express=require('express');var router=express[_0x8af6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8af6('0x4'));var interaction=require(_0x8af6('0x5'));var config=require(_0x8af6('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x8af6('0x7')](),controller['index']);router[_0x8af6('0x8')](_0x8af6('0x9'),auth[_0x8af6('0x7')](),controller[_0x8af6('0xa')]);router['get'](_0x8af6('0xb'),auth[_0x8af6('0x7')](),controller[_0x8af6('0xc')]);router[_0x8af6('0x8')]('/:id/subjects',auth[_0x8af6('0x7')](),controller[_0x8af6('0xd')]);router[_0x8af6('0x8')]('/:id/descriptions',auth[_0x8af6('0x7')](),controller['getDescriptions']);router[_0x8af6('0xe')]('/',auth['isAuthenticated'](),controller[_0x8af6('0xf')]);router[_0x8af6('0x10')](_0x8af6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x8af6('0x11')](_0x8af6('0x9'),auth['isAuthenticated'](),controller[_0x8af6('0x12')]);module[_0x8af6('0x13')]=router; \ No newline at end of file +var _0x471d=['isAuthenticated','getSubjects','getDescriptions','post','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x471d,0x16e));var _0xd471=function(_0x287010,_0x4fd673){_0x287010=_0x287010-0x0;var _0xdb25f7=_0x471d[_0x287010];return _0xdb25f7;};'use strict';var multer=require(_0xd471('0x0'));var util=require('util');var path=require(_0xd471('0x1'));var timeout=require(_0xd471('0x2'));var express=require(_0xd471('0x3'));var router=express[_0xd471('0x4')]();var fs_extra=require(_0xd471('0x5'));var auth=require(_0xd471('0x6'));var interaction=require(_0xd471('0x7'));var config=require(_0xd471('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd471('0x9')]);router[_0xd471('0xa')](_0xd471('0xb'),auth[_0xd471('0xc')](),controller['show']);router[_0xd471('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0xd471('0xc')](),controller[_0xd471('0xd')]);router[_0xd471('0xa')]('/:id/descriptions',auth[_0xd471('0xc')](),controller[_0xd471('0xe')]);router[_0xd471('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd471('0x10')](_0xd471('0xb'),auth[_0xd471('0xc')](),controller[_0xd471('0x11')]);router['delete'](_0xd471('0xb'),auth[_0xd471('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 85cf43d..79f0462 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 _0xc9e8=['sequelize','exports','STRING'];(function(_0x32f876,_0x43321f){var _0xd464e9=function(_0x1c58e1){while(--_0x1c58e1){_0x32f876['push'](_0x32f876['shift']());}};_0xd464e9(++_0x43321f);}(_0xc9e8,0xa8));var _0x8c9e=function(_0x5067db,_0xf8d2f2){_0x5067db=_0x5067db-0x0;var _0x2771e4=_0xc9e8[_0x5067db];return _0x2771e4;};'use strict';var Sequelize=require(_0x8c9e('0x0'));module[_0x8c9e('0x1')]={'name':{'type':Sequelize[_0x8c9e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xffa8=['exports','STRING'];(function(_0x3232e3,_0x5cbbac){var _0x499208=function(_0x46896e){while(--_0x46896e){_0x3232e3['push'](_0x3232e3['shift']());}};_0x499208(++_0x5cbbac);}(_0xffa8,0xa4));var _0x8ffa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xffa8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x8ffa('0x0')]={'name':{'type':Sequelize[_0x8ffa('0x1')]},'description':{'type':Sequelize[_0x8ffa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 325037d..e7424d4 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 _0xf08a=['findAll','rows','show','length','includeAll','include','catch','create','body','find','params','findOne','SugarcrmField','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration'];(function(_0x2cd59b,_0x5ab031){var _0x33fd26=function(_0x16d5aa){while(--_0x16d5aa){_0x2cd59b['push'](_0x2cd59b['shift']());}};_0x33fd26(++_0x5ab031);}(_0xf08a,0x15d));var _0xaf08=function(_0x387f3e,_0x4ab340){_0x387f3e=_0x387f3e-0x0;var _0x534b5c=_0xf08a[_0x387f3e];return _0x534b5c;};'use strict';var emlformat=require(_0xaf08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf08('0x1'));var jsonpatch=require(_0xaf08('0x2'));var rp=require(_0xaf08('0x3'));var moment=require(_0xaf08('0x4'));var BPromise=require(_0xaf08('0x5'));var Mustache=require(_0xaf08('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaf08('0x7'));var csv=require(_0xaf08('0x8'));var ejs=require(_0xaf08('0x9'));var fs=require('fs');var fs_extra=require(_0xaf08('0xa'));var _=require('lodash');var squel=require(_0xaf08('0xb'));var crypto=require(_0xaf08('0xc'));var jsforce=require(_0xaf08('0xd'));var deskjs=require(_0xaf08('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf08('0xf'));var Papa=require(_0xaf08('0x10'));var Redis=require('ioredis');var authService=require(_0xaf08('0x11'));var qs=require(_0xaf08('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf08('0x13'));var logger=require('../../config/logger')(_0xaf08('0x14'));var utils=require(_0xaf08('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf08('0x16'))['db'];function respondWithStatusCode(_0x10b938,_0x4c14be){_0x4c14be=_0x4c14be||0xcc;return function(_0x1dedb8){if(_0x1dedb8){return _0x10b938[_0xaf08('0x17')](_0x4c14be);}return _0x10b938[_0xaf08('0x18')](_0x4c14be)[_0xaf08('0x19')]();};}function respondWithResult(_0x47e9f8,_0x47404e){_0x47404e=_0x47404e||0xc8;return function(_0x3ca140){if(_0x3ca140){return _0x47e9f8['status'](_0x47404e)[_0xaf08('0x1a')](_0x3ca140);}};}function respondWithFilteredResult(_0x256c21,_0x5f4767){return function(_0x2b9346){if(_0x2b9346){var _0xc4689f=typeof _0x5f4767[_0xaf08('0x1b')]==='undefined'&&typeof _0x5f4767[_0xaf08('0x1c')]===_0xaf08('0x1d');var _0x13d9ed=_0x2b9346[_0xaf08('0x1e')];var _0x1ab07e=_0xc4689f?0x0:_0x5f4767[_0xaf08('0x1b')];var _0x37912b=_0xc4689f?_0x2b9346[_0xaf08('0x1e')]:_0x5f4767[_0xaf08('0x1b')]+_0x5f4767[_0xaf08('0x1c')];var _0x19bea0;if(_0x37912b>=_0x13d9ed){_0x37912b=_0x13d9ed;_0x19bea0=0xc8;}else{_0x19bea0=0xce;}_0x256c21[_0xaf08('0x18')](_0x19bea0);return _0x256c21[_0xaf08('0x1f')](_0xaf08('0x20'),_0x1ab07e+'-'+_0x37912b+'/'+_0x13d9ed)['json'](_0x2b9346);}return null;};}function patchUpdates(_0x1c7ed3){return function(_0x4ed8d2){try{jsonpatch[_0xaf08('0x21')](_0x4ed8d2,_0x1c7ed3,!![]);}catch(_0x4cb430){return BPromise[_0xaf08('0x22')](_0x4cb430);}return _0x4ed8d2[_0xaf08('0x23')]();};}function saveUpdates(_0x45e449,_0xf34c38){return function(_0x567843){if(_0x567843){return _0x567843[_0xaf08('0x24')](_0x45e449)[_0xaf08('0x25')](function(_0x5ee465){return _0x5ee465;});}return null;};}function removeEntity(_0x331c7b,_0x56ee42){return function(_0x48c4c1){if(_0x48c4c1){return _0x48c4c1[_0xaf08('0x26')]()['then'](function(){_0x331c7b[_0xaf08('0x18')](0xcc)[_0xaf08('0x19')]();});}};}function handleEntityNotFound(_0x516842,_0x48a14e){return function(_0x420348){if(!_0x420348){_0x516842[_0xaf08('0x17')](0x194);}return _0x420348;};}function handleError(_0x5a25b8,_0x23ec8a){_0x23ec8a=_0x23ec8a||0x1f4;return function(_0x5d75cd){logger[_0xaf08('0x27')](_0x5d75cd[_0xaf08('0x28')]);if(_0x5d75cd['name']){delete _0x5d75cd['name'];}_0x5a25b8[_0xaf08('0x18')](_0x23ec8a)[_0xaf08('0x29')](_0x5d75cd);};}exports[_0xaf08('0x2a')]=function(_0x2548af,_0x363f8d){var _0x52faef={},_0x212e3d={},_0xce6ec8={'count':0x0,'rows':[]};var _0x32e3ea=_[_0xaf08('0x2b')](db['SugarcrmConfiguration'][_0xaf08('0x2c')],function(_0x514e31){return{'name':_0x514e31[_0xaf08('0x2d')],'type':_0x514e31[_0xaf08('0x2e')][_0xaf08('0x2f')]};});_0x212e3d[_0xaf08('0x30')]=_[_0xaf08('0x2b')](_0x32e3ea,_0xaf08('0x31'));_0x212e3d[_0xaf08('0x32')]=_[_0xaf08('0x33')](_0x2548af[_0xaf08('0x32')]);_0x212e3d[_0xaf08('0x34')]=_[_0xaf08('0x35')](_0x212e3d['model'],_0x212e3d[_0xaf08('0x32')]);_0x52faef[_0xaf08('0x36')]=_[_0xaf08('0x35')](_0x212e3d[_0xaf08('0x30')],qs[_0xaf08('0x37')](_0x2548af[_0xaf08('0x32')][_0xaf08('0x37')]));_0x52faef[_0xaf08('0x36')]=_0x52faef[_0xaf08('0x36')]['length']?_0x52faef[_0xaf08('0x36')]:_0x212e3d[_0xaf08('0x30')];if(!_0x2548af['query']['hasOwnProperty'](_0xaf08('0x38'))){_0x52faef[_0xaf08('0x1c')]=qs[_0xaf08('0x1c')](_0x2548af[_0xaf08('0x32')][_0xaf08('0x1c')]);_0x52faef[_0xaf08('0x1b')]=qs[_0xaf08('0x1b')](_0x2548af['query'][_0xaf08('0x1b')]);}_0x52faef[_0xaf08('0x39')]=qs[_0xaf08('0x3a')](_0x2548af[_0xaf08('0x32')][_0xaf08('0x3a')]);_0x52faef[_0xaf08('0x3b')]=qs[_0xaf08('0x34')](_[_0xaf08('0x3c')](_0x2548af[_0xaf08('0x32')],_0x212e3d[_0xaf08('0x34')]),_0x32e3ea);if(_0x2548af[_0xaf08('0x32')][_0xaf08('0x3d')]){_0x52faef[_0xaf08('0x3b')]=_[_0xaf08('0x3e')](_0x52faef[_0xaf08('0x3b')],{'$or':_[_0xaf08('0x2b')](_0x32e3ea,function(_0x38f23e){if(_0x38f23e[_0xaf08('0x2e')]!==_0xaf08('0x3f')){var _0x340349={};_0x340349[_0x38f23e[_0xaf08('0x31')]]={'$like':'%'+_0x2548af[_0xaf08('0x32')][_0xaf08('0x3d')]+'%'};return _0x340349;}})});}_0x52faef=_[_0xaf08('0x3e')]({},_0x52faef,_0x2548af[_0xaf08('0x40')]);var _0x14d9cc={'where':_0x52faef[_0xaf08('0x3b')]};return db['SugarcrmConfiguration'][_0xaf08('0x1e')](_0x14d9cc)[_0xaf08('0x25')](function(_0x2d1611){_0xce6ec8['count']=_0x2d1611;if(_0x2548af[_0xaf08('0x32')]['includeAll']){_0x52faef['include']=[{'all':!![]}];}return db[_0xaf08('0x41')][_0xaf08('0x42')](_0x52faef);})[_0xaf08('0x25')](function(_0x3626ee){_0xce6ec8[_0xaf08('0x43')]=_0x3626ee;return _0xce6ec8;})['then'](respondWithFilteredResult(_0x363f8d,_0x52faef))['catch'](handleError(_0x363f8d,null));};exports[_0xaf08('0x44')]=function(_0x5e8d57,_0x3b7f8c){var _0xd2105f={'raw':![],'where':{'id':_0x5e8d57['params']['id']}},_0x2f098c={};_0x2f098c['model']=_[_0xaf08('0x33')](db[_0xaf08('0x41')][_0xaf08('0x2c')]);_0x2f098c[_0xaf08('0x32')]=_[_0xaf08('0x33')](_0x5e8d57[_0xaf08('0x32')]);_0x2f098c[_0xaf08('0x34')]=_[_0xaf08('0x35')](_0x2f098c[_0xaf08('0x30')],_0x2f098c[_0xaf08('0x32')]);_0xd2105f[_0xaf08('0x36')]=_[_0xaf08('0x35')](_0x2f098c[_0xaf08('0x30')],qs['fields'](_0x5e8d57[_0xaf08('0x32')][_0xaf08('0x37')]));_0xd2105f[_0xaf08('0x36')]=_0xd2105f[_0xaf08('0x36')][_0xaf08('0x45')]?_0xd2105f['attributes']:_0x2f098c[_0xaf08('0x30')];if(_0x5e8d57[_0xaf08('0x32')][_0xaf08('0x46')]){_0xd2105f[_0xaf08('0x47')]=[{'all':!![]}];}_0xd2105f=_[_0xaf08('0x3e')]({},_0xd2105f,_0x5e8d57[_0xaf08('0x40')]);return db[_0xaf08('0x41')]['find'](_0xd2105f)[_0xaf08('0x25')](handleEntityNotFound(_0x3b7f8c,null))[_0xaf08('0x25')](respondWithResult(_0x3b7f8c,null))[_0xaf08('0x48')](handleError(_0x3b7f8c,null));};exports[_0xaf08('0x49')]=function(_0x4d3dd7,_0xca9925){return db[_0xaf08('0x41')][_0xaf08('0x49')](_0x4d3dd7['body'],{})[_0xaf08('0x25')](respondWithResult(_0xca9925,0xc9))[_0xaf08('0x48')](handleError(_0xca9925,null));};exports[_0xaf08('0x24')]=function(_0x562887,_0x11393d){if(_0x562887[_0xaf08('0x4a')]['id']){delete _0x562887[_0xaf08('0x4a')]['id'];}return db[_0xaf08('0x41')][_0xaf08('0x4b')]({'where':{'id':_0x562887['params']['id']}})[_0xaf08('0x25')](handleEntityNotFound(_0x11393d,null))['then'](saveUpdates(_0x562887[_0xaf08('0x4a')],null))['then'](respondWithResult(_0x11393d,null))[_0xaf08('0x48')](handleError(_0x11393d,null));};exports[_0xaf08('0x26')]=function(_0x2b46b7,_0x505743){return db[_0xaf08('0x41')][_0xaf08('0x4b')]({'where':{'id':_0x2b46b7[_0xaf08('0x4c')]['id']}})['then'](handleEntityNotFound(_0x505743,null))[_0xaf08('0x25')](removeEntity(_0x505743,null))['catch'](handleError(_0x505743,null));};exports['getFields']=function(_0xedc982,_0x264c5b,_0x4ac4da){var _0x4389e9={};var _0x56b843={};var _0x9f2c5d;var _0xe406d2;return db['SugarcrmConfiguration'][_0xaf08('0x4d')]({'where':{'id':_0xedc982[_0xaf08('0x4c')]['id']}})['then'](handleEntityNotFound(_0x264c5b,null))['then'](function(_0x466fad){if(_0x466fad){_0x9f2c5d=_0x466fad;_0x56b843[_0xaf08('0x30')]=_['keys'](db[_0xaf08('0x4e')][_0xaf08('0x2c')]);_0x56b843[_0xaf08('0x32')]=_[_0xaf08('0x33')](_0xedc982[_0xaf08('0x32')]);_0x56b843[_0xaf08('0x34')]=_[_0xaf08('0x35')](_0x56b843[_0xaf08('0x30')],_0x56b843[_0xaf08('0x32')]);_0x4389e9[_0xaf08('0x36')]=_[_0xaf08('0x35')](_0x56b843[_0xaf08('0x30')],qs['fields'](_0xedc982[_0xaf08('0x32')][_0xaf08('0x37')]));_0x4389e9[_0xaf08('0x36')]=_0x4389e9[_0xaf08('0x36')][_0xaf08('0x45')]?_0x4389e9[_0xaf08('0x36')]:_0x56b843['model'];_0x4389e9[_0xaf08('0x39')]=qs['sort'](_0xedc982[_0xaf08('0x32')][_0xaf08('0x3a')]);_0x4389e9[_0xaf08('0x3b')]=qs[_0xaf08('0x34')](_[_0xaf08('0x3c')](_0xedc982[_0xaf08('0x32')],_0x56b843['filters']));if(_0xedc982[_0xaf08('0x32')][_0xaf08('0x3d')]){_0x4389e9[_0xaf08('0x3b')]=_[_0xaf08('0x3e')](_0x4389e9['where'],{'$or':_[_0xaf08('0x2b')](_0x4389e9[_0xaf08('0x36')],function(_0x1bcb40){var _0x287d11={};_0x287d11[_0x1bcb40]={'$like':'%'+_0xedc982[_0xaf08('0x32')]['filter']+'%'};return _0x287d11;})});}_0x4389e9=_[_0xaf08('0x3e')]({},_0x4389e9,_0xedc982[_0xaf08('0x40')]);return _0x9f2c5d['getFields'](_0x4389e9);}})[_0xaf08('0x25')](function(_0x48f38a){if(_0x48f38a){_0xe406d2=_0x48f38a['length'];if(!_0xedc982[_0xaf08('0x32')][_0xaf08('0x4f')](_0xaf08('0x38'))){_0x4389e9[_0xaf08('0x1c')]=qs[_0xaf08('0x1c')](_0xedc982[_0xaf08('0x32')][_0xaf08('0x1c')]);_0x4389e9[_0xaf08('0x1b')]=qs[_0xaf08('0x1b')](_0xedc982[_0xaf08('0x32')][_0xaf08('0x1b')]);}return _0x9f2c5d[_0xaf08('0x50')](_0x4389e9);}})[_0xaf08('0x25')](function(_0x4f51c4){if(_0x4f51c4){return _0x4f51c4?{'count':_0xe406d2,'rows':_0x4f51c4}:null;}})[_0xaf08('0x25')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xaf08('0x51')]=function(_0x5cc23e,_0x34362a,_0x12c4ed){var _0xcf1944={};var _0x42f667={};var _0x5e4a63;var _0x477e55;return db[_0xaf08('0x41')][_0xaf08('0x4d')]({'where':{'id':_0x5cc23e[_0xaf08('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34362a,null))['then'](function(_0x1d1085){if(_0x1d1085){_0x5e4a63=_0x1d1085;_0x42f667['model']=_[_0xaf08('0x33')](db[_0xaf08('0x4e')][_0xaf08('0x2c')]);_0x42f667[_0xaf08('0x32')]=_['keys'](_0x5cc23e[_0xaf08('0x32')]);_0x42f667['filters']=_[_0xaf08('0x35')](_0x42f667[_0xaf08('0x30')],_0x42f667[_0xaf08('0x32')]);_0xcf1944[_0xaf08('0x36')]=_[_0xaf08('0x35')](_0x42f667['model'],qs['fields'](_0x5cc23e['query'][_0xaf08('0x37')]));_0xcf1944['attributes']=_0xcf1944[_0xaf08('0x36')][_0xaf08('0x45')]?_0xcf1944[_0xaf08('0x36')]:_0x42f667[_0xaf08('0x30')];_0xcf1944[_0xaf08('0x39')]=qs[_0xaf08('0x3a')](_0x5cc23e['query'][_0xaf08('0x3a')]);_0xcf1944[_0xaf08('0x3b')]=qs[_0xaf08('0x34')](_[_0xaf08('0x3c')](_0x5cc23e[_0xaf08('0x32')],_0x42f667[_0xaf08('0x34')]));if(_0x5cc23e['query']['filter']){_0xcf1944['where']=_['merge'](_0xcf1944[_0xaf08('0x3b')],{'$or':_['map'](_0xcf1944[_0xaf08('0x36')],function(_0x55914c){var _0x53bd3a={};_0x53bd3a[_0x55914c]={'$like':'%'+_0x5cc23e['query'][_0xaf08('0x3d')]+'%'};return _0x53bd3a;})});}_0xcf1944=_[_0xaf08('0x3e')]({},_0xcf1944,_0x5cc23e[_0xaf08('0x40')]);return _0x5e4a63['getSubjects'](_0xcf1944);}})['then'](function(_0x2beb08){if(_0x2beb08){_0x477e55=_0x2beb08[_0xaf08('0x45')];if(!_0x5cc23e['query'][_0xaf08('0x4f')](_0xaf08('0x38'))){_0xcf1944[_0xaf08('0x1c')]=qs[_0xaf08('0x1c')](_0x5cc23e[_0xaf08('0x32')][_0xaf08('0x1c')]);_0xcf1944[_0xaf08('0x1b')]=qs[_0xaf08('0x1b')](_0x5cc23e[_0xaf08('0x32')][_0xaf08('0x1b')]);}return _0x5e4a63[_0xaf08('0x51')](_0xcf1944);}})['then'](function(_0x5414d7){if(_0x5414d7){return _0x5414d7?{'count':_0x477e55,'rows':_0x5414d7}:null;}})[_0xaf08('0x25')](respondWithResult(_0x34362a,null))[_0xaf08('0x48')](handleError(_0x34362a,null));};exports[_0xaf08('0x52')]=function(_0x3927a2,_0x29a614,_0x329f61){var _0x146f71={};var _0x5d8256={};var _0x403e33;var _0x5dda68;return db[_0xaf08('0x41')]['findOne']({'where':{'id':_0x3927a2[_0xaf08('0x4c')]['id']}})['then'](handleEntityNotFound(_0x29a614,null))[_0xaf08('0x25')](function(_0x41d04b){if(_0x41d04b){_0x403e33=_0x41d04b;_0x5d8256[_0xaf08('0x30')]=_[_0xaf08('0x33')](db[_0xaf08('0x4e')][_0xaf08('0x2c')]);_0x5d8256[_0xaf08('0x32')]=_[_0xaf08('0x33')](_0x3927a2['query']);_0x5d8256['filters']=_[_0xaf08('0x35')](_0x5d8256[_0xaf08('0x30')],_0x5d8256[_0xaf08('0x32')]);_0x146f71[_0xaf08('0x36')]=_[_0xaf08('0x35')](_0x5d8256['model'],qs[_0xaf08('0x37')](_0x3927a2[_0xaf08('0x32')][_0xaf08('0x37')]));_0x146f71[_0xaf08('0x36')]=_0x146f71['attributes'][_0xaf08('0x45')]?_0x146f71[_0xaf08('0x36')]:_0x5d8256[_0xaf08('0x30')];_0x146f71[_0xaf08('0x39')]=qs[_0xaf08('0x3a')](_0x3927a2[_0xaf08('0x32')][_0xaf08('0x3a')]);_0x146f71[_0xaf08('0x3b')]=qs['filters'](_['pick'](_0x3927a2['query'],_0x5d8256[_0xaf08('0x34')]));if(_0x3927a2[_0xaf08('0x32')][_0xaf08('0x3d')]){_0x146f71[_0xaf08('0x3b')]=_['merge'](_0x146f71[_0xaf08('0x3b')],{'$or':_[_0xaf08('0x2b')](_0x146f71['attributes'],function(_0x4a233e){var _0xb1dace={};_0xb1dace[_0x4a233e]={'$like':'%'+_0x3927a2[_0xaf08('0x32')]['filter']+'%'};return _0xb1dace;})});}_0x146f71=_['merge']({},_0x146f71,_0x3927a2['options']);return _0x403e33['getDescriptions'](_0x146f71);}})[_0xaf08('0x25')](function(_0x532fda){if(_0x532fda){_0x5dda68=_0x532fda['length'];if(!_0x3927a2[_0xaf08('0x32')][_0xaf08('0x4f')](_0xaf08('0x38'))){_0x146f71[_0xaf08('0x1c')]=qs[_0xaf08('0x1c')](_0x3927a2[_0xaf08('0x32')]['limit']);_0x146f71[_0xaf08('0x1b')]=qs[_0xaf08('0x1b')](_0x3927a2[_0xaf08('0x32')][_0xaf08('0x1b')]);}return _0x403e33[_0xaf08('0x52')](_0x146f71);}})['then'](function(_0x30eefb){if(_0x30eefb){return _0x30eefb?{'count':_0x5dda68,'rows':_0x30eefb}:null;}})['then'](respondWithResult(_0x29a614,null))['catch'](handleError(_0x29a614,null));}; \ No newline at end of file +var _0xda94=['save','update','destroy','then','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply'];(function(_0x2dbee9,_0x222ffe){var _0x4467b5=function(_0x3e2c0b){while(--_0x3e2c0b){_0x2dbee9['push'](_0x2dbee9['shift']());}};_0x4467b5(++_0x222ffe);}(_0xda94,0x11d));var _0x4da9=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xda94[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x4da9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4da9('0x1'));var jsonpatch=require(_0x4da9('0x2'));var rp=require(_0x4da9('0x3'));var moment=require(_0x4da9('0x4'));var BPromise=require(_0x4da9('0x5'));var Mustache=require(_0x4da9('0x6'));var util=require(_0x4da9('0x7'));var path=require('path');var sox=require(_0x4da9('0x8'));var csv=require(_0x4da9('0x9'));var ejs=require(_0x4da9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4da9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4da9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4da9('0x9'));var querystring=require(_0x4da9('0xd'));var Papa=require(_0x4da9('0xe'));var Redis=require(_0x4da9('0xf'));var authService=require(_0x4da9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4da9('0x11'));var hardwareService=require(_0x4da9('0x12'));var logger=require(_0x4da9('0x13'))(_0x4da9('0x14'));var utils=require(_0x4da9('0x15'));var config=require(_0x4da9('0x16'));var licenseUtil=require(_0x4da9('0x17'));var db=require(_0x4da9('0x18'))['db'];function respondWithStatusCode(_0x2313e3,_0xa969bc){_0xa969bc=_0xa969bc||0xcc;return function(_0x3f1d55){if(_0x3f1d55){return _0x2313e3[_0x4da9('0x19')](_0xa969bc);}return _0x2313e3[_0x4da9('0x1a')](_0xa969bc)[_0x4da9('0x1b')]();};}function respondWithResult(_0x5e5217,_0x27b5b2){_0x27b5b2=_0x27b5b2||0xc8;return function(_0x3e6887){if(_0x3e6887){return _0x5e5217[_0x4da9('0x1a')](_0x27b5b2)[_0x4da9('0x1c')](_0x3e6887);}};}function respondWithFilteredResult(_0x434d0a,_0x4be4b0){return function(_0x4fd696){if(_0x4fd696){var _0x4d0900=typeof _0x4be4b0['offset']===_0x4da9('0x1d')&&typeof _0x4be4b0[_0x4da9('0x1e')]===_0x4da9('0x1d');var _0x15e307=_0x4fd696[_0x4da9('0x1f')];var _0x566bf4=_0x4d0900?0x0:_0x4be4b0[_0x4da9('0x20')];var _0x575fb5=_0x4d0900?_0x4fd696[_0x4da9('0x1f')]:_0x4be4b0[_0x4da9('0x20')]+_0x4be4b0['limit'];var _0x5f14f1;if(_0x575fb5>=_0x15e307){_0x575fb5=_0x15e307;_0x5f14f1=0xc8;}else{_0x5f14f1=0xce;}_0x434d0a['status'](_0x5f14f1);return _0x434d0a['set'](_0x4da9('0x21'),_0x566bf4+'-'+_0x575fb5+'/'+_0x15e307)[_0x4da9('0x1c')](_0x4fd696);}return null;};}function patchUpdates(_0x1d7464){return function(_0x38f1c1){try{jsonpatch[_0x4da9('0x22')](_0x38f1c1,_0x1d7464,!![]);}catch(_0xc148e7){return BPromise['reject'](_0xc148e7);}return _0x38f1c1[_0x4da9('0x23')]();};}function saveUpdates(_0x1e4bdb,_0x1dd68d){return function(_0x5a894b){if(_0x5a894b){return _0x5a894b[_0x4da9('0x24')](_0x1e4bdb)['then'](function(_0x28867a){return _0x28867a;});}return null;};}function removeEntity(_0xa66e79,_0x3caa03){return function(_0x51d900){if(_0x51d900){return _0x51d900[_0x4da9('0x25')]()[_0x4da9('0x26')](function(){_0xa66e79[_0x4da9('0x1a')](0xcc)[_0x4da9('0x1b')]();});}};}function handleEntityNotFound(_0x3196d6,_0x4eea2f){return function(_0xffaeb6){if(!_0xffaeb6){_0x3196d6[_0x4da9('0x19')](0x194);}return _0xffaeb6;};}function handleError(_0x30c833,_0x2fea35){_0x2fea35=_0x2fea35||0x1f4;return function(_0x4b7926){logger['error'](_0x4b7926[_0x4da9('0x27')]);if(_0x4b7926[_0x4da9('0x28')]){delete _0x4b7926[_0x4da9('0x28')];}_0x30c833[_0x4da9('0x1a')](_0x2fea35)[_0x4da9('0x29')](_0x4b7926);};}exports[_0x4da9('0x2a')]=function(_0x1aebf8,_0x590bb0){var _0x203e8b={},_0x596908={},_0x2bd965={'count':0x0,'rows':[]};var _0x2898b4=_[_0x4da9('0x2b')](db[_0x4da9('0x2c')][_0x4da9('0x2d')],function(_0x34f32b){return{'name':_0x34f32b[_0x4da9('0x2e')],'type':_0x34f32b['type']['key']};});_0x596908['model']=_['map'](_0x2898b4,_0x4da9('0x28'));_0x596908[_0x4da9('0x2f')]=_[_0x4da9('0x30')](_0x1aebf8[_0x4da9('0x2f')]);_0x596908[_0x4da9('0x31')]=_[_0x4da9('0x32')](_0x596908[_0x4da9('0x33')],_0x596908[_0x4da9('0x2f')]);_0x203e8b[_0x4da9('0x34')]=_['intersection'](_0x596908['model'],qs[_0x4da9('0x35')](_0x1aebf8['query'][_0x4da9('0x35')]));_0x203e8b[_0x4da9('0x34')]=_0x203e8b['attributes'][_0x4da9('0x36')]?_0x203e8b[_0x4da9('0x34')]:_0x596908[_0x4da9('0x33')];if(!_0x1aebf8[_0x4da9('0x2f')][_0x4da9('0x37')](_0x4da9('0x38'))){_0x203e8b[_0x4da9('0x1e')]=qs['limit'](_0x1aebf8[_0x4da9('0x2f')]['limit']);_0x203e8b[_0x4da9('0x20')]=qs[_0x4da9('0x20')](_0x1aebf8[_0x4da9('0x2f')][_0x4da9('0x20')]);}_0x203e8b[_0x4da9('0x39')]=qs['sort'](_0x1aebf8[_0x4da9('0x2f')][_0x4da9('0x3a')]);_0x203e8b[_0x4da9('0x3b')]=qs[_0x4da9('0x31')](_[_0x4da9('0x3c')](_0x1aebf8[_0x4da9('0x2f')],_0x596908['filters']),_0x2898b4);if(_0x1aebf8['query'][_0x4da9('0x3d')]){_0x203e8b[_0x4da9('0x3b')]=_['merge'](_0x203e8b[_0x4da9('0x3b')],{'$or':_['map'](_0x2898b4,function(_0x20220e){if(_0x20220e[_0x4da9('0x3e')]!=='VIRTUAL'){var _0x33dc42={};_0x33dc42[_0x20220e[_0x4da9('0x28')]]={'$like':'%'+_0x1aebf8[_0x4da9('0x2f')][_0x4da9('0x3d')]+'%'};return _0x33dc42;}})});}_0x203e8b=_[_0x4da9('0x3f')]({},_0x203e8b,_0x1aebf8[_0x4da9('0x40')]);var _0x502032={'where':_0x203e8b['where']};return db[_0x4da9('0x2c')][_0x4da9('0x1f')](_0x502032)[_0x4da9('0x26')](function(_0x380156){_0x2bd965[_0x4da9('0x1f')]=_0x380156;if(_0x1aebf8['query'][_0x4da9('0x41')]){_0x203e8b[_0x4da9('0x42')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4da9('0x43')](_0x203e8b);})[_0x4da9('0x26')](function(_0xb88393){_0x2bd965[_0x4da9('0x44')]=_0xb88393;return _0x2bd965;})[_0x4da9('0x26')](respondWithFilteredResult(_0x590bb0,_0x203e8b))[_0x4da9('0x45')](handleError(_0x590bb0,null));};exports[_0x4da9('0x46')]=function(_0xfdc687,_0x28dfc2){var _0xd3a7c5={'raw':![],'where':{'id':_0xfdc687['params']['id']}},_0x31fbd6={};_0x31fbd6[_0x4da9('0x33')]=_[_0x4da9('0x30')](db[_0x4da9('0x2c')][_0x4da9('0x2d')]);_0x31fbd6[_0x4da9('0x2f')]=_[_0x4da9('0x30')](_0xfdc687[_0x4da9('0x2f')]);_0x31fbd6[_0x4da9('0x31')]=_[_0x4da9('0x32')](_0x31fbd6[_0x4da9('0x33')],_0x31fbd6['query']);_0xd3a7c5['attributes']=_[_0x4da9('0x32')](_0x31fbd6[_0x4da9('0x33')],qs['fields'](_0xfdc687[_0x4da9('0x2f')]['fields']));_0xd3a7c5[_0x4da9('0x34')]=_0xd3a7c5[_0x4da9('0x34')][_0x4da9('0x36')]?_0xd3a7c5[_0x4da9('0x34')]:_0x31fbd6[_0x4da9('0x33')];if(_0xfdc687['query'][_0x4da9('0x41')]){_0xd3a7c5[_0x4da9('0x42')]=[{'all':!![]}];}_0xd3a7c5=_[_0x4da9('0x3f')]({},_0xd3a7c5,_0xfdc687['options']);return db[_0x4da9('0x2c')][_0x4da9('0x47')](_0xd3a7c5)[_0x4da9('0x26')](handleEntityNotFound(_0x28dfc2,null))[_0x4da9('0x26')](respondWithResult(_0x28dfc2,null))['catch'](handleError(_0x28dfc2,null));};exports['create']=function(_0x533efe,_0x3820f0){return db[_0x4da9('0x2c')][_0x4da9('0x48')](_0x533efe[_0x4da9('0x49')],{})[_0x4da9('0x26')](respondWithResult(_0x3820f0,0xc9))[_0x4da9('0x45')](handleError(_0x3820f0,null));};exports[_0x4da9('0x24')]=function(_0x70b953,_0xb895dc){if(_0x70b953['body']['id']){delete _0x70b953['body']['id'];}return db[_0x4da9('0x2c')][_0x4da9('0x47')]({'where':{'id':_0x70b953['params']['id']}})[_0x4da9('0x26')](handleEntityNotFound(_0xb895dc,null))['then'](saveUpdates(_0x70b953['body'],null))['then'](respondWithResult(_0xb895dc,null))[_0x4da9('0x45')](handleError(_0xb895dc,null));};exports[_0x4da9('0x25')]=function(_0x27ca58,_0x529086){return db['SugarcrmConfiguration'][_0x4da9('0x47')]({'where':{'id':_0x27ca58[_0x4da9('0x4a')]['id']}})[_0x4da9('0x26')](handleEntityNotFound(_0x529086,null))[_0x4da9('0x26')](removeEntity(_0x529086,null))[_0x4da9('0x45')](handleError(_0x529086,null));};exports[_0x4da9('0x4b')]=function(_0x4ff8fc,_0x36bbaa,_0xb9f54){var _0x37a51b={};var _0x1e05aa={};var _0xacdd9e;var _0x330b98;return db[_0x4da9('0x2c')][_0x4da9('0x4c')]({'where':{'id':_0x4ff8fc[_0x4da9('0x4a')]['id']}})[_0x4da9('0x26')](handleEntityNotFound(_0x36bbaa,null))['then'](function(_0x2376b7){if(_0x2376b7){_0xacdd9e=_0x2376b7;_0x1e05aa[_0x4da9('0x33')]=_['keys'](db['SugarcrmField'][_0x4da9('0x2d')]);_0x1e05aa[_0x4da9('0x2f')]=_[_0x4da9('0x30')](_0x4ff8fc[_0x4da9('0x2f')]);_0x1e05aa[_0x4da9('0x31')]=_[_0x4da9('0x32')](_0x1e05aa[_0x4da9('0x33')],_0x1e05aa['query']);_0x37a51b['attributes']=_[_0x4da9('0x32')](_0x1e05aa[_0x4da9('0x33')],qs[_0x4da9('0x35')](_0x4ff8fc[_0x4da9('0x2f')][_0x4da9('0x35')]));_0x37a51b[_0x4da9('0x34')]=_0x37a51b['attributes']['length']?_0x37a51b[_0x4da9('0x34')]:_0x1e05aa[_0x4da9('0x33')];_0x37a51b[_0x4da9('0x39')]=qs[_0x4da9('0x3a')](_0x4ff8fc[_0x4da9('0x2f')][_0x4da9('0x3a')]);_0x37a51b[_0x4da9('0x3b')]=qs[_0x4da9('0x31')](_[_0x4da9('0x3c')](_0x4ff8fc[_0x4da9('0x2f')],_0x1e05aa[_0x4da9('0x31')]));if(_0x4ff8fc[_0x4da9('0x2f')]['filter']){_0x37a51b[_0x4da9('0x3b')]=_['merge'](_0x37a51b[_0x4da9('0x3b')],{'$or':_[_0x4da9('0x2b')](_0x37a51b['attributes'],function(_0x141831){var _0x35e699={};_0x35e699[_0x141831]={'$like':'%'+_0x4ff8fc[_0x4da9('0x2f')][_0x4da9('0x3d')]+'%'};return _0x35e699;})});}_0x37a51b=_[_0x4da9('0x3f')]({},_0x37a51b,_0x4ff8fc[_0x4da9('0x40')]);return _0xacdd9e[_0x4da9('0x4b')](_0x37a51b);}})[_0x4da9('0x26')](function(_0x431786){if(_0x431786){_0x330b98=_0x431786[_0x4da9('0x36')];if(!_0x4ff8fc['query'][_0x4da9('0x37')](_0x4da9('0x38'))){_0x37a51b[_0x4da9('0x1e')]=qs[_0x4da9('0x1e')](_0x4ff8fc[_0x4da9('0x2f')][_0x4da9('0x1e')]);_0x37a51b[_0x4da9('0x20')]=qs[_0x4da9('0x20')](_0x4ff8fc['query'][_0x4da9('0x20')]);}return _0xacdd9e[_0x4da9('0x4b')](_0x37a51b);}})['then'](function(_0x1c1425){if(_0x1c1425){return _0x1c1425?{'count':_0x330b98,'rows':_0x1c1425}:null;}})[_0x4da9('0x26')](respondWithResult(_0x36bbaa,null))['catch'](handleError(_0x36bbaa,null));};exports[_0x4da9('0x4d')]=function(_0x11e0ed,_0x21b713,_0x43b4f1){var _0x50fe74={};var _0x50b0df={};var _0x26b1ad;var _0x52d714;return db[_0x4da9('0x2c')]['findOne']({'where':{'id':_0x11e0ed[_0x4da9('0x4a')]['id']}})[_0x4da9('0x26')](handleEntityNotFound(_0x21b713,null))[_0x4da9('0x26')](function(_0x57fad0){if(_0x57fad0){_0x26b1ad=_0x57fad0;_0x50b0df['model']=_['keys'](db[_0x4da9('0x4e')]['rawAttributes']);_0x50b0df[_0x4da9('0x2f')]=_[_0x4da9('0x30')](_0x11e0ed[_0x4da9('0x2f')]);_0x50b0df[_0x4da9('0x31')]=_[_0x4da9('0x32')](_0x50b0df[_0x4da9('0x33')],_0x50b0df[_0x4da9('0x2f')]);_0x50fe74['attributes']=_[_0x4da9('0x32')](_0x50b0df['model'],qs[_0x4da9('0x35')](_0x11e0ed[_0x4da9('0x2f')][_0x4da9('0x35')]));_0x50fe74['attributes']=_0x50fe74['attributes']['length']?_0x50fe74[_0x4da9('0x34')]:_0x50b0df['model'];_0x50fe74[_0x4da9('0x39')]=qs[_0x4da9('0x3a')](_0x11e0ed[_0x4da9('0x2f')][_0x4da9('0x3a')]);_0x50fe74[_0x4da9('0x3b')]=qs[_0x4da9('0x31')](_[_0x4da9('0x3c')](_0x11e0ed[_0x4da9('0x2f')],_0x50b0df[_0x4da9('0x31')]));if(_0x11e0ed[_0x4da9('0x2f')][_0x4da9('0x3d')]){_0x50fe74[_0x4da9('0x3b')]=_[_0x4da9('0x3f')](_0x50fe74[_0x4da9('0x3b')],{'$or':_['map'](_0x50fe74['attributes'],function(_0x29678c){var _0x12f741={};_0x12f741[_0x29678c]={'$like':'%'+_0x11e0ed[_0x4da9('0x2f')][_0x4da9('0x3d')]+'%'};return _0x12f741;})});}_0x50fe74=_[_0x4da9('0x3f')]({},_0x50fe74,_0x11e0ed[_0x4da9('0x40')]);return _0x26b1ad['getSubjects'](_0x50fe74);}})['then'](function(_0x811c33){if(_0x811c33){_0x52d714=_0x811c33['length'];if(!_0x11e0ed['query'][_0x4da9('0x37')]('nolimit')){_0x50fe74[_0x4da9('0x1e')]=qs['limit'](_0x11e0ed[_0x4da9('0x2f')]['limit']);_0x50fe74[_0x4da9('0x20')]=qs[_0x4da9('0x20')](_0x11e0ed['query'][_0x4da9('0x20')]);}return _0x26b1ad['getSubjects'](_0x50fe74);}})[_0x4da9('0x26')](function(_0x36f7c9){if(_0x36f7c9){return _0x36f7c9?{'count':_0x52d714,'rows':_0x36f7c9}:null;}})['then'](respondWithResult(_0x21b713,null))[_0x4da9('0x45')](handleError(_0x21b713,null));};exports[_0x4da9('0x4f')]=function(_0x4642b1,_0x180703,_0x1bbcea){var _0x24d6c7={};var _0xdd4abe={};var _0x1480f2;var _0x14ac50;return db[_0x4da9('0x2c')]['findOne']({'where':{'id':_0x4642b1[_0x4da9('0x4a')]['id']}})[_0x4da9('0x26')](handleEntityNotFound(_0x180703,null))[_0x4da9('0x26')](function(_0x2c1b85){if(_0x2c1b85){_0x1480f2=_0x2c1b85;_0xdd4abe['model']=_[_0x4da9('0x30')](db['SugarcrmField']['rawAttributes']);_0xdd4abe['query']=_[_0x4da9('0x30')](_0x4642b1['query']);_0xdd4abe[_0x4da9('0x31')]=_[_0x4da9('0x32')](_0xdd4abe[_0x4da9('0x33')],_0xdd4abe[_0x4da9('0x2f')]);_0x24d6c7[_0x4da9('0x34')]=_[_0x4da9('0x32')](_0xdd4abe[_0x4da9('0x33')],qs[_0x4da9('0x35')](_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x35')]));_0x24d6c7['attributes']=_0x24d6c7[_0x4da9('0x34')]['length']?_0x24d6c7[_0x4da9('0x34')]:_0xdd4abe[_0x4da9('0x33')];_0x24d6c7[_0x4da9('0x39')]=qs[_0x4da9('0x3a')](_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x3a')]);_0x24d6c7[_0x4da9('0x3b')]=qs[_0x4da9('0x31')](_[_0x4da9('0x3c')](_0x4642b1[_0x4da9('0x2f')],_0xdd4abe[_0x4da9('0x31')]));if(_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x3d')]){_0x24d6c7[_0x4da9('0x3b')]=_['merge'](_0x24d6c7['where'],{'$or':_[_0x4da9('0x2b')](_0x24d6c7[_0x4da9('0x34')],function(_0x2b7fbd){var _0x22974a={};_0x22974a[_0x2b7fbd]={'$like':'%'+_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x3d')]+'%'};return _0x22974a;})});}_0x24d6c7=_[_0x4da9('0x3f')]({},_0x24d6c7,_0x4642b1['options']);return _0x1480f2[_0x4da9('0x4f')](_0x24d6c7);}})[_0x4da9('0x26')](function(_0xb0d462){if(_0xb0d462){_0x14ac50=_0xb0d462[_0x4da9('0x36')];if(!_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x37')](_0x4da9('0x38'))){_0x24d6c7['limit']=qs['limit'](_0x4642b1[_0x4da9('0x2f')]['limit']);_0x24d6c7['offset']=qs[_0x4da9('0x20')](_0x4642b1[_0x4da9('0x2f')][_0x4da9('0x20')]);}return _0x1480f2[_0x4da9('0x4f')](_0x24d6c7);}})[_0x4da9('0x26')](function(_0x5ae9ee){if(_0x5ae9ee){return _0x5ae9ee?{'count':_0x14ac50,'rows':_0x5ae9ee}:null;}})[_0x4da9('0x26')](respondWithResult(_0x180703,null))[_0x4da9('0x45')](handleError(_0x180703,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 471978b..9f6e0ae 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 _0xbc3a=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xbc3a,0x182));var _0xabc3=function(_0x5d2f34,_0xaf59e8){_0x5d2f34=_0x5d2f34-0x0;var _0x14412e=_0xbc3a[_0x5d2f34];return _0x14412e;};'use strict';var _=require(_0xabc3('0x0'));var util=require(_0xabc3('0x1'));var logger=require(_0xabc3('0x2'))(_0xabc3('0x3'));var moment=require(_0xabc3('0x4'));var BPromise=require(_0xabc3('0x5'));var rp=require(_0xabc3('0x6'));var fs=require('fs');var path=require(_0xabc3('0x7'));var rimraf=require(_0xabc3('0x8'));var config=require(_0xabc3('0x9'));var attributes=require(_0xabc3('0xa'));module[_0xabc3('0xb')]=function(_0x4e0c82,_0x522b18){return _0x4e0c82['define'](_0xabc3('0xc'),attributes,{'tableName':_0xabc3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc6=['bluebird','request-promise','../../config/environment','exports','define','SugarcrmConfiguration','lodash','util','api'];(function(_0xa645c6,_0x369f25){var _0x11d71c=function(_0x395cd7){while(--_0x395cd7){_0xa645c6['push'](_0xa645c6['shift']());}};_0x11d71c(++_0x369f25);}(_0x9bc6,0x1da));var _0x69bc=function(_0x4ffa16,_0x420a60){_0x4ffa16=_0x4ffa16-0x0;var _0x3160a5=_0x9bc6[_0x4ffa16];return _0x3160a5;};'use strict';var _=require(_0x69bc('0x0'));var util=require(_0x69bc('0x1'));var logger=require('../../config/logger')(_0x69bc('0x2'));var moment=require('moment');var BPromise=require(_0x69bc('0x3'));var rp=require(_0x69bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x69bc('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x69bc('0x6')]=function(_0x230a16,_0x2835b5){return _0x230a16[_0x69bc('0x7')](_0x69bc('0x8'),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 f28f714..8f3ea9e 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 _0x2044=['request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x2044,0x1d9));var _0x4204=function(_0x501d03,_0x45f5fc){_0x501d03=_0x501d03-0x0;var _0x457dbb=_0x2044[_0x501d03];return _0x457dbb;};'use strict';var _=require('lodash');var util=require(_0x4204('0x0'));var moment=require(_0x4204('0x1'));var BPromise=require('bluebird');var rs=require(_0x4204('0x2'));var fs=require('fs');var Redis=require(_0x4204('0x3'));var db=require(_0x4204('0x4'))['db'];var utils=require(_0x4204('0x5'));var logger=require(_0x4204('0x6'))(_0x4204('0x7'));var config=require('../../config/environment');var jayson=require(_0x4204('0x8'));var client=jayson['client'][_0x4204('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3918b5,_0x4a5812,_0x3edc4f){return new BPromise(function(_0x1128ff,_0x10d4e8){return client[_0x4204('0xa')](_0x3918b5,_0x3edc4f)[_0x4204('0xb')](function(_0x41ee06){logger['info'](_0x4204('0xc'),_0x4a5812,_0x4204('0xd'));logger[_0x4204('0xe')](_0x4204('0xf'),_0x4a5812,'request\x20sent',JSON[_0x4204('0x10')](_0x41ee06));if(_0x41ee06['error']){if(_0x41ee06[_0x4204('0x11')][_0x4204('0x12')]===0x1f4){logger[_0x4204('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a5812,_0x41ee06[_0x4204('0x11')][_0x4204('0x13')]);return _0x10d4e8(_0x41ee06[_0x4204('0x11')][_0x4204('0x13')]);}logger['error'](_0x4204('0xc'),_0x4a5812,_0x41ee06[_0x4204('0x11')]['message']);return _0x1128ff(_0x41ee06[_0x4204('0x11')][_0x4204('0x13')]);}else{logger[_0x4204('0x14')](_0x4204('0xc'),_0x4a5812,_0x4204('0xd'));_0x1128ff(_0x41ee06[_0x4204('0x15')][_0x4204('0x13')]);}})[_0x4204('0x16')](function(_0x57f05e){logger[_0x4204('0x11')](_0x4204('0xc'),_0x4a5812,_0x57f05e);_0x10d4e8(_0x57f05e);});});} \ No newline at end of file +var _0x931a=['info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then'];(function(_0xb58f75,_0x220820){var _0x21cb8d=function(_0x15fde9){while(--_0x15fde9){_0xb58f75['push'](_0xb58f75['shift']());}};_0x21cb8d(++_0x220820);}(_0x931a,0x106));var _0xa931=function(_0x389d49,_0x160a5a){_0x389d49=_0x389d49-0x0;var _0x5e66e6=_0x931a[_0x389d49];return _0x5e66e6;};'use strict';var _=require(_0xa931('0x0'));var util=require('util');var moment=require(_0xa931('0x1'));var BPromise=require(_0xa931('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa931('0x3'));var db=require(_0xa931('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa931('0x5'))('rpc');var config=require(_0xa931('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa931('0x7')][_0xa931('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a6ae9,_0x4931b4,_0x1acf62){return new BPromise(function(_0x5480ec,_0x5b6505){return client[_0xa931('0x9')](_0x1a6ae9,_0x1acf62)[_0xa931('0xa')](function(_0x89809d){logger[_0xa931('0xb')](_0xa931('0xc'),_0x4931b4,'request\x20sent');logger[_0xa931('0xd')](_0xa931('0xe'),_0x4931b4,_0xa931('0xf'),JSON[_0xa931('0x10')](_0x89809d));if(_0x89809d[_0xa931('0x11')]){if(_0x89809d[_0xa931('0x11')]['code']===0x1f4){logger[_0xa931('0x11')](_0xa931('0xc'),_0x4931b4,_0x89809d[_0xa931('0x11')][_0xa931('0x12')]);return _0x5b6505(_0x89809d[_0xa931('0x11')][_0xa931('0x12')]);}logger[_0xa931('0x11')](_0xa931('0xc'),_0x4931b4,_0x89809d['error']['message']);return _0x5480ec(_0x89809d[_0xa931('0x11')][_0xa931('0x12')]);}else{logger['info'](_0xa931('0xc'),_0x4931b4,_0xa931('0xf'));_0x5480ec(_0x89809d[_0xa931('0x13')][_0xa931('0x12')]);}})[_0xa931('0x14')](function(_0x1dde7a){logger[_0xa931('0x11')](_0xa931('0xc'),_0x4931b4,_0x1dde7a);_0x5b6505(_0x1dde7a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e5d6be5..4462190 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 _0x34e2=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x2e99f1,_0x4b7742){var _0xd4008c=function(_0x32efc2){while(--_0x32efc2){_0x2e99f1['push'](_0x2e99f1['shift']());}};_0xd4008c(++_0x4b7742);}(_0x34e2,0x126));var _0x234e=function(_0xde8752,_0x5423d0){_0xde8752=_0xde8752-0x0;var _0x59356a=_0x34e2[_0xde8752];return _0x59356a;};'use strict';var multer=require(_0x234e('0x0'));var util=require('util');var path=require(_0x234e('0x1'));var timeout=require(_0x234e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x234e('0x3'));var interaction=require(_0x234e('0x4'));var config=require(_0x234e('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x234e('0x6')](),controller['index']);router[_0x234e('0x7')](_0x234e('0x8'),auth[_0x234e('0x6')](),controller[_0x234e('0x9')]);router[_0x234e('0xa')]('/',auth[_0x234e('0x6')](),controller[_0x234e('0xb')]);router['put'](_0x234e('0x8'),auth['isAuthenticated'](),controller[_0x234e('0xc')]);router[_0x234e('0xd')](_0x234e('0x8'),auth[_0x234e('0x6')](),controller[_0x234e('0xe')]);module[_0x234e('0xf')]=router; \ No newline at end of file +var _0xc040=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc040,0xa5));var _0x0c04=function(_0x2dddb8,_0x3240d8){_0x2dddb8=_0x2dddb8-0x0;var _0x2a3d91=_0xc040[_0x2dddb8];return _0x2a3d91;};'use strict';var multer=require('multer');var util=require(_0x0c04('0x0'));var path=require(_0x0c04('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c04('0x2'));var router=express[_0x0c04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c04('0x4'));var interaction=require(_0x0c04('0x5'));var config=require('../../config/environment');var controller=require(_0x0c04('0x6'));router['get']('/',auth[_0x0c04('0x7')](),controller[_0x0c04('0x8')]);router[_0x0c04('0x9')]('/:id',auth[_0x0c04('0x7')](),controller[_0x0c04('0xa')]);router[_0x0c04('0xb')]('/',auth[_0x0c04('0x7')](),controller['create']);router[_0x0c04('0xc')](_0x0c04('0xd'),auth['isAuthenticated'](),controller[_0x0c04('0xe')]);router['delete'](_0x0c04('0xd'),auth[_0x0c04('0x7')](),controller['destroy']);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 750ec8e..a71f20a 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 _0x4f5a=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x4f5a,0x1a7));var _0xa4f5=function(_0x264348,_0x50f1f0){_0x264348=_0x264348-0x0;var _0x28c5c0=_0x4f5a[_0x264348];return _0x28c5c0;};'use strict';var Sequelize=require(_0xa4f5('0x0'));module[_0xa4f5('0x1')]={'type':{'type':Sequelize[_0xa4f5('0x2')](_0xa4f5('0x3'),'variable',_0xa4f5('0x4'),_0xa4f5('0x5'),_0xa4f5('0x6')),'defaultValue':_0xa4f5('0x3')},'content':{'type':Sequelize[_0xa4f5('0x7')]},'key':{'type':Sequelize[_0xa4f5('0x7')]},'keyType':{'type':Sequelize[_0xa4f5('0x2')]('string',_0xa4f5('0x8'),_0xa4f5('0x4'))},'keyContent':{'type':Sequelize[_0xa4f5('0x7')]},'idField':{'type':Sequelize[_0xa4f5('0x7')]},'nameField':{'type':Sequelize[_0xa4f5('0x7')]},'customField':{'type':Sequelize[_0xa4f5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa659=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa659,0x175));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9a65('0x0')]={'type':{'type':Sequelize[_0x9a65('0x1')](_0x9a65('0x2'),'variable',_0x9a65('0x3'),_0x9a65('0x4'),_0x9a65('0x5')),'defaultValue':_0x9a65('0x2')},'content':{'type':Sequelize[_0x9a65('0x6')]},'key':{'type':Sequelize[_0x9a65('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9a65('0x2'),_0x9a65('0x7'),_0x9a65('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9a65('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4930156..05d65a8 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 _0x7295=['index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','keys','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x7295,0x12f));var _0x5729=function(_0x4eaa96,_0x53b203){_0x4eaa96=_0x4eaa96-0x0;var _0x390958=_0x7295[_0x4eaa96];return _0x390958;};'use strict';var emlformat=require(_0x5729('0x0'));var rimraf=require(_0x5729('0x1'));var zipdir=require(_0x5729('0x2'));var jsonpatch=require(_0x5729('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5729('0x4'));var util=require(_0x5729('0x5'));var path=require('path');var sox=require(_0x5729('0x6'));var csv=require(_0x5729('0x7'));var ejs=require(_0x5729('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5729('0x9'));var jsforce=require(_0x5729('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5729('0x7'));var querystring=require(_0x5729('0xb'));var Papa=require('papaparse');var Redis=require(_0x5729('0xc'));var authService=require(_0x5729('0xd'));var qs=require(_0x5729('0xe'));var as=require(_0x5729('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5729('0x10'))('api');var utils=require(_0x5729('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5729('0x12'));var db=require(_0x5729('0x13'))['db'];function respondWithStatusCode(_0x155416,_0x14b46e){_0x14b46e=_0x14b46e||0xcc;return function(_0x3a3026){if(_0x3a3026){return _0x155416[_0x5729('0x14')](_0x14b46e);}return _0x155416[_0x5729('0x15')](_0x14b46e)[_0x5729('0x16')]();};}function respondWithResult(_0x3a541c,_0x1bd570){_0x1bd570=_0x1bd570||0xc8;return function(_0x35e10a){if(_0x35e10a){return _0x3a541c['status'](_0x1bd570)[_0x5729('0x17')](_0x35e10a);}};}function respondWithFilteredResult(_0x51473b,_0xeaf915){return function(_0x326b45){if(_0x326b45){var _0x12a571=typeof _0xeaf915[_0x5729('0x18')]===_0x5729('0x19')&&typeof _0xeaf915[_0x5729('0x1a')]===_0x5729('0x19');var _0x1df54f=_0x326b45[_0x5729('0x1b')];var _0x3131fb=_0x12a571?0x0:_0xeaf915[_0x5729('0x18')];var _0x525965=_0x12a571?_0x326b45['count']:_0xeaf915[_0x5729('0x18')]+_0xeaf915['limit'];var _0x23d373;if(_0x525965>=_0x1df54f){_0x525965=_0x1df54f;_0x23d373=0xc8;}else{_0x23d373=0xce;}_0x51473b[_0x5729('0x15')](_0x23d373);return _0x51473b[_0x5729('0x1c')](_0x5729('0x1d'),_0x3131fb+'-'+_0x525965+'/'+_0x1df54f)[_0x5729('0x17')](_0x326b45);}return null;};}function patchUpdates(_0x2abafb){return function(_0x10207f){try{jsonpatch[_0x5729('0x1e')](_0x10207f,_0x2abafb,!![]);}catch(_0x225ffc){return BPromise['reject'](_0x225ffc);}return _0x10207f['save']();};}function saveUpdates(_0x4fa1b6,_0x5db74c){return function(_0x55710a){if(_0x55710a){return _0x55710a[_0x5729('0x1f')](_0x4fa1b6)[_0x5729('0x20')](function(_0x2e46ee){return _0x2e46ee;});}return null;};}function removeEntity(_0x156bab,_0x4e0ec2){return function(_0x29172d){if(_0x29172d){return _0x29172d[_0x5729('0x21')]()[_0x5729('0x20')](function(){_0x156bab[_0x5729('0x15')](0xcc)[_0x5729('0x16')]();});}};}function handleEntityNotFound(_0x5a4a7a,_0x4cd46d){return function(_0x3e55da){if(!_0x3e55da){_0x5a4a7a[_0x5729('0x14')](0x194);}return _0x3e55da;};}function handleError(_0xcea7d5,_0x4bc269){_0x4bc269=_0x4bc269||0x1f4;return function(_0x1c2281){logger['error'](_0x1c2281[_0x5729('0x22')]);if(_0x1c2281[_0x5729('0x23')]){delete _0x1c2281[_0x5729('0x23')];}_0xcea7d5[_0x5729('0x15')](_0x4bc269)[_0x5729('0x24')](_0x1c2281);};}exports[_0x5729('0x25')]=function(_0x433917,_0x2ad26c){var _0x4a144e={},_0x2afc60={},_0x3f47b1={'count':0x0,'rows':[]};var _0x383fc6=_[_0x5729('0x26')](db[_0x5729('0x27')][_0x5729('0x28')],function(_0x5d6083){return{'name':_0x5d6083[_0x5729('0x29')],'type':_0x5d6083[_0x5729('0x2a')][_0x5729('0x2b')]};});_0x2afc60[_0x5729('0x2c')]=_[_0x5729('0x26')](_0x383fc6,_0x5729('0x23'));_0x2afc60[_0x5729('0x2d')]=_['keys'](_0x433917[_0x5729('0x2d')]);_0x2afc60[_0x5729('0x2e')]=_[_0x5729('0x2f')](_0x2afc60[_0x5729('0x2c')],_0x2afc60[_0x5729('0x2d')]);_0x4a144e[_0x5729('0x30')]=_[_0x5729('0x2f')](_0x2afc60[_0x5729('0x2c')],qs[_0x5729('0x31')](_0x433917[_0x5729('0x2d')][_0x5729('0x31')]));_0x4a144e['attributes']=_0x4a144e[_0x5729('0x30')]['length']?_0x4a144e['attributes']:_0x2afc60[_0x5729('0x2c')];if(!_0x433917[_0x5729('0x2d')][_0x5729('0x32')](_0x5729('0x33'))){_0x4a144e['limit']=qs[_0x5729('0x1a')](_0x433917[_0x5729('0x2d')][_0x5729('0x1a')]);_0x4a144e[_0x5729('0x18')]=qs[_0x5729('0x18')](_0x433917[_0x5729('0x2d')][_0x5729('0x18')]);}_0x4a144e['order']=qs[_0x5729('0x34')](_0x433917[_0x5729('0x2d')][_0x5729('0x34')]);_0x4a144e['where']=qs[_0x5729('0x2e')](_['pick'](_0x433917['query'],_0x2afc60[_0x5729('0x2e')]),_0x383fc6);if(_0x433917[_0x5729('0x2d')]['filter']){_0x4a144e[_0x5729('0x35')]=_[_0x5729('0x36')](_0x4a144e[_0x5729('0x35')],{'$or':_[_0x5729('0x26')](_0x383fc6,function(_0x2c8a69){if(_0x2c8a69[_0x5729('0x2a')]!==_0x5729('0x37')){var _0x5bd7f6={};_0x5bd7f6[_0x2c8a69[_0x5729('0x23')]]={'$like':'%'+_0x433917[_0x5729('0x2d')][_0x5729('0x38')]+'%'};return _0x5bd7f6;}})});}_0x4a144e=_[_0x5729('0x36')]({},_0x4a144e,_0x433917['options']);var _0x547325={'where':_0x4a144e['where']};return db[_0x5729('0x27')][_0x5729('0x1b')](_0x547325)[_0x5729('0x20')](function(_0x9ce57b){_0x3f47b1[_0x5729('0x1b')]=_0x9ce57b;if(_0x433917[_0x5729('0x2d')][_0x5729('0x39')]){_0x4a144e[_0x5729('0x3a')]=[{'all':!![]}];}return db['SugarcrmField'][_0x5729('0x3b')](_0x4a144e);})[_0x5729('0x20')](function(_0x41e079){_0x3f47b1['rows']=_0x41e079;return _0x3f47b1;})['then'](respondWithFilteredResult(_0x2ad26c,_0x4a144e))['catch'](handleError(_0x2ad26c,null));};exports[_0x5729('0x3c')]=function(_0x223470,_0x4abb94){var _0x1795f4={'raw':!![],'where':{'id':_0x223470['params']['id']}},_0x3d3d5b={};_0x3d3d5b[_0x5729('0x2c')]=_[_0x5729('0x3d')](db[_0x5729('0x27')]['rawAttributes']);_0x3d3d5b[_0x5729('0x2d')]=_[_0x5729('0x3d')](_0x223470['query']);_0x3d3d5b[_0x5729('0x2e')]=_[_0x5729('0x2f')](_0x3d3d5b['model'],_0x3d3d5b[_0x5729('0x2d')]);_0x1795f4['attributes']=_[_0x5729('0x2f')](_0x3d3d5b[_0x5729('0x2c')],qs['fields'](_0x223470[_0x5729('0x2d')]['fields']));_0x1795f4[_0x5729('0x30')]=_0x1795f4['attributes']['length']?_0x1795f4['attributes']:_0x3d3d5b[_0x5729('0x2c')];if(_0x223470[_0x5729('0x2d')][_0x5729('0x39')]){_0x1795f4['include']=[{'all':!![]}];}_0x1795f4=_[_0x5729('0x36')]({},_0x1795f4,_0x223470[_0x5729('0x3e')]);return db[_0x5729('0x27')][_0x5729('0x3f')](_0x1795f4)[_0x5729('0x20')](handleEntityNotFound(_0x4abb94,null))[_0x5729('0x20')](respondWithResult(_0x4abb94,null))[_0x5729('0x40')](handleError(_0x4abb94,null));};exports[_0x5729('0x41')]=function(_0x1702c7,_0x2be52c){return db['SugarcrmField'][_0x5729('0x41')](_0x1702c7[_0x5729('0x42')],{})[_0x5729('0x20')](respondWithResult(_0x2be52c,0xc9))[_0x5729('0x40')](handleError(_0x2be52c,null));};exports['update']=function(_0x2a2293,_0x8a60db){if(_0x2a2293['body']['id']){delete _0x2a2293[_0x5729('0x42')]['id'];}return db[_0x5729('0x27')][_0x5729('0x3f')]({'where':{'id':_0x2a2293['params']['id']}})[_0x5729('0x20')](handleEntityNotFound(_0x8a60db,null))[_0x5729('0x20')](saveUpdates(_0x2a2293[_0x5729('0x42')],null))[_0x5729('0x20')](respondWithResult(_0x8a60db,null))[_0x5729('0x40')](handleError(_0x8a60db,null));};exports['destroy']=function(_0x32f187,_0xdfadcc){return db[_0x5729('0x27')][_0x5729('0x3f')]({'where':{'id':_0x32f187[_0x5729('0x43')]['id']}})['then'](handleEntityNotFound(_0xdfadcc,null))['then'](removeEntity(_0xdfadcc,null))[_0x5729('0x40')](handleError(_0xdfadcc,null));}; \ No newline at end of file +var _0xec51=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xec51,0xee));var _0x1ec5=function(_0x4664f2,_0x2b0027){_0x4664f2=_0x4664f2-0x0;var _0x12e5f6=_0xec51[_0x4664f2];return _0x12e5f6;};'use strict';var emlformat=require(_0x1ec5('0x0'));var rimraf=require(_0x1ec5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ec5('0x2'));var rp=require(_0x1ec5('0x3'));var moment=require('moment');var BPromise=require(_0x1ec5('0x4'));var Mustache=require('mustache');var util=require(_0x1ec5('0x5'));var path=require(_0x1ec5('0x6'));var sox=require('sox');var csv=require(_0x1ec5('0x7'));var ejs=require(_0x1ec5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ec5('0x9'));var squel=require(_0x1ec5('0xa'));var crypto=require(_0x1ec5('0xb'));var jsforce=require(_0x1ec5('0xc'));var deskjs=require(_0x1ec5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1ec5('0xe'));var Papa=require('papaparse');var Redis=require(_0x1ec5('0xf'));var authService=require(_0x1ec5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1ec5('0x11'));var hardwareService=require(_0x1ec5('0x12'));var logger=require(_0x1ec5('0x13'))(_0x1ec5('0x14'));var utils=require('../../config/utils');var config=require(_0x1ec5('0x15'));var licenseUtil=require(_0x1ec5('0x16'));var db=require(_0x1ec5('0x17'))['db'];function respondWithStatusCode(_0x14dd76,_0x476802){_0x476802=_0x476802||0xcc;return function(_0x126df2){if(_0x126df2){return _0x14dd76[_0x1ec5('0x18')](_0x476802);}return _0x14dd76[_0x1ec5('0x19')](_0x476802)[_0x1ec5('0x1a')]();};}function respondWithResult(_0x5e2e53,_0xd155b7){_0xd155b7=_0xd155b7||0xc8;return function(_0x547fd0){if(_0x547fd0){return _0x5e2e53['status'](_0xd155b7)['json'](_0x547fd0);}};}function respondWithFilteredResult(_0x6e201b,_0x208708){return function(_0x147e59){if(_0x147e59){var _0x4c8871=typeof _0x208708[_0x1ec5('0x1b')]===_0x1ec5('0x1c')&&typeof _0x208708[_0x1ec5('0x1d')]==='undefined';var _0x2e328f=_0x147e59['count'];var _0x4b9508=_0x4c8871?0x0:_0x208708[_0x1ec5('0x1b')];var _0x5d50cf=_0x4c8871?_0x147e59['count']:_0x208708['offset']+_0x208708[_0x1ec5('0x1d')];var _0x401fb3;if(_0x5d50cf>=_0x2e328f){_0x5d50cf=_0x2e328f;_0x401fb3=0xc8;}else{_0x401fb3=0xce;}_0x6e201b['status'](_0x401fb3);return _0x6e201b[_0x1ec5('0x1e')](_0x1ec5('0x1f'),_0x4b9508+'-'+_0x5d50cf+'/'+_0x2e328f)[_0x1ec5('0x20')](_0x147e59);}return null;};}function patchUpdates(_0x3eefd8){return function(_0x249520){try{jsonpatch[_0x1ec5('0x21')](_0x249520,_0x3eefd8,!![]);}catch(_0x347bb1){return BPromise[_0x1ec5('0x22')](_0x347bb1);}return _0x249520['save']();};}function saveUpdates(_0x6b5eb5,_0x38eeac){return function(_0x56224f){if(_0x56224f){return _0x56224f[_0x1ec5('0x23')](_0x6b5eb5)[_0x1ec5('0x24')](function(_0x14d0b4){return _0x14d0b4;});}return null;};}function removeEntity(_0x5a632b,_0x46e675){return function(_0x5bb542){if(_0x5bb542){return _0x5bb542[_0x1ec5('0x25')]()['then'](function(){_0x5a632b[_0x1ec5('0x19')](0xcc)[_0x1ec5('0x1a')]();});}};}function handleEntityNotFound(_0x26902a,_0x59cf71){return function(_0x3b7b2c){if(!_0x3b7b2c){_0x26902a[_0x1ec5('0x18')](0x194);}return _0x3b7b2c;};}function handleError(_0x1be429,_0x40c9d8){_0x40c9d8=_0x40c9d8||0x1f4;return function(_0x2aadb6){logger[_0x1ec5('0x26')](_0x2aadb6[_0x1ec5('0x27')]);if(_0x2aadb6[_0x1ec5('0x28')]){delete _0x2aadb6[_0x1ec5('0x28')];}_0x1be429['status'](_0x40c9d8)[_0x1ec5('0x29')](_0x2aadb6);};}exports['index']=function(_0x52f6eb,_0x1e2426){var _0xf962b3={},_0x124f45={},_0x52a451={'count':0x0,'rows':[]};var _0x220e09=_[_0x1ec5('0x2a')](db[_0x1ec5('0x2b')]['rawAttributes'],function(_0x2af8a0){return{'name':_0x2af8a0[_0x1ec5('0x2c')],'type':_0x2af8a0[_0x1ec5('0x2d')]['key']};});_0x124f45['model']=_[_0x1ec5('0x2a')](_0x220e09,'name');_0x124f45['query']=_[_0x1ec5('0x2e')](_0x52f6eb[_0x1ec5('0x2f')]);_0x124f45[_0x1ec5('0x30')]=_[_0x1ec5('0x31')](_0x124f45[_0x1ec5('0x32')],_0x124f45[_0x1ec5('0x2f')]);_0xf962b3['attributes']=_['intersection'](_0x124f45[_0x1ec5('0x32')],qs[_0x1ec5('0x33')](_0x52f6eb[_0x1ec5('0x2f')]['fields']));_0xf962b3[_0x1ec5('0x34')]=_0xf962b3[_0x1ec5('0x34')][_0x1ec5('0x35')]?_0xf962b3[_0x1ec5('0x34')]:_0x124f45['model'];if(!_0x52f6eb[_0x1ec5('0x2f')][_0x1ec5('0x36')](_0x1ec5('0x37'))){_0xf962b3['limit']=qs[_0x1ec5('0x1d')](_0x52f6eb[_0x1ec5('0x2f')]['limit']);_0xf962b3[_0x1ec5('0x1b')]=qs[_0x1ec5('0x1b')](_0x52f6eb[_0x1ec5('0x2f')]['offset']);}_0xf962b3['order']=qs[_0x1ec5('0x38')](_0x52f6eb[_0x1ec5('0x2f')][_0x1ec5('0x38')]);_0xf962b3['where']=qs[_0x1ec5('0x30')](_['pick'](_0x52f6eb['query'],_0x124f45['filters']),_0x220e09);if(_0x52f6eb['query'][_0x1ec5('0x39')]){_0xf962b3['where']=_[_0x1ec5('0x3a')](_0xf962b3[_0x1ec5('0x3b')],{'$or':_[_0x1ec5('0x2a')](_0x220e09,function(_0x21b1ff){if(_0x21b1ff[_0x1ec5('0x2d')]!==_0x1ec5('0x3c')){var _0x5f403a={};_0x5f403a[_0x21b1ff['name']]={'$like':'%'+_0x52f6eb['query']['filter']+'%'};return _0x5f403a;}})});}_0xf962b3=_[_0x1ec5('0x3a')]({},_0xf962b3,_0x52f6eb[_0x1ec5('0x3d')]);var _0x689b0f={'where':_0xf962b3[_0x1ec5('0x3b')]};return db[_0x1ec5('0x2b')][_0x1ec5('0x3e')](_0x689b0f)[_0x1ec5('0x24')](function(_0x30729d){_0x52a451['count']=_0x30729d;if(_0x52f6eb[_0x1ec5('0x2f')][_0x1ec5('0x3f')]){_0xf962b3['include']=[{'all':!![]}];}return db[_0x1ec5('0x2b')][_0x1ec5('0x40')](_0xf962b3);})['then'](function(_0x14c0ca){_0x52a451[_0x1ec5('0x41')]=_0x14c0ca;return _0x52a451;})['then'](respondWithFilteredResult(_0x1e2426,_0xf962b3))['catch'](handleError(_0x1e2426,null));};exports[_0x1ec5('0x42')]=function(_0x3883d4,_0x47f22b){var _0x1321df={'raw':!![],'where':{'id':_0x3883d4[_0x1ec5('0x43')]['id']}},_0x168a6c={};_0x168a6c['model']=_[_0x1ec5('0x2e')](db[_0x1ec5('0x2b')][_0x1ec5('0x44')]);_0x168a6c['query']=_[_0x1ec5('0x2e')](_0x3883d4[_0x1ec5('0x2f')]);_0x168a6c['filters']=_[_0x1ec5('0x31')](_0x168a6c['model'],_0x168a6c['query']);_0x1321df[_0x1ec5('0x34')]=_[_0x1ec5('0x31')](_0x168a6c[_0x1ec5('0x32')],qs[_0x1ec5('0x33')](_0x3883d4[_0x1ec5('0x2f')]['fields']));_0x1321df[_0x1ec5('0x34')]=_0x1321df[_0x1ec5('0x34')][_0x1ec5('0x35')]?_0x1321df[_0x1ec5('0x34')]:_0x168a6c[_0x1ec5('0x32')];if(_0x3883d4[_0x1ec5('0x2f')]['includeAll']){_0x1321df[_0x1ec5('0x45')]=[{'all':!![]}];}_0x1321df=_[_0x1ec5('0x3a')]({},_0x1321df,_0x3883d4[_0x1ec5('0x3d')]);return db['SugarcrmField']['find'](_0x1321df)[_0x1ec5('0x24')](handleEntityNotFound(_0x47f22b,null))[_0x1ec5('0x24')](respondWithResult(_0x47f22b,null))[_0x1ec5('0x46')](handleError(_0x47f22b,null));};exports[_0x1ec5('0x47')]=function(_0x42d270,_0x495f4c){return db[_0x1ec5('0x2b')]['create'](_0x42d270[_0x1ec5('0x48')],{})[_0x1ec5('0x24')](respondWithResult(_0x495f4c,0xc9))[_0x1ec5('0x46')](handleError(_0x495f4c,null));};exports[_0x1ec5('0x23')]=function(_0x3aa72b,_0x32bd84){if(_0x3aa72b[_0x1ec5('0x48')]['id']){delete _0x3aa72b[_0x1ec5('0x48')]['id'];}return db[_0x1ec5('0x2b')][_0x1ec5('0x49')]({'where':{'id':_0x3aa72b['params']['id']}})['then'](handleEntityNotFound(_0x32bd84,null))[_0x1ec5('0x24')](saveUpdates(_0x3aa72b[_0x1ec5('0x48')],null))[_0x1ec5('0x24')](respondWithResult(_0x32bd84,null))['catch'](handleError(_0x32bd84,null));};exports['destroy']=function(_0x563738,_0x4eedff){return db['SugarcrmField'][_0x1ec5('0x49')]({'where':{'id':_0x563738[_0x1ec5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4eedff,null))[_0x1ec5('0x24')](removeEntity(_0x4eedff,null))['catch'](handleError(_0x4eedff,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ebffcb0..e2afd56 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 _0xc6d3=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index'];(function(_0x5b4917,_0x4da51e){var _0x22297e=function(_0x9a6ea4){while(--_0x9a6ea4){_0x5b4917['push'](_0x5b4917['shift']());}};_0x22297e(++_0x4da51e);}(_0xc6d3,0x1bc));var _0x3c6d=function(_0x47f9e4,_0x5bb136){_0x47f9e4=_0x47f9e4-0x0;var _0x1f3d64=_0xc6d3[_0x47f9e4];return _0x1f3d64;};'use strict';var _=require(_0x3c6d('0x0'));var util=require(_0x3c6d('0x1'));var logger=require(_0x3c6d('0x2'))(_0x3c6d('0x3'));var moment=require(_0x3c6d('0x4'));var BPromise=require(_0x3c6d('0x5'));var rp=require(_0x3c6d('0x6'));var fs=require('fs');var path=require(_0x3c6d('0x7'));var rimraf=require(_0x3c6d('0x8'));var config=require(_0x3c6d('0x9'));var attributes=require(_0x3c6d('0xa'));module[_0x3c6d('0xb')]=function(_0x4cbed2,_0x5132dd){return _0x4cbed2[_0x3c6d('0xc')](_0x3c6d('0xd'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3c6d('0xe'),'fields':[_0x3c6d('0xf'),_0x3c6d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fba=['FieldId','util','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField'];(function(_0x4a5226,_0x1beeac){var _0x1de4ea=function(_0x408755){while(--_0x408755){_0x4a5226['push'](_0x4a5226['shift']());}};_0x1de4ea(++_0x1beeac);}(_0x5fba,0x175));var _0xa5fb=function(_0x1cc0da,_0x416066){_0x1cc0da=_0x1cc0da-0x0;var _0x2e55ed=_0x5fba[_0x1cc0da];return _0x2e55ed;};'use strict';var _=require('lodash');var util=require(_0xa5fb('0x0'));var logger=require('../../config/logger')(_0xa5fb('0x1'));var moment=require(_0xa5fb('0x2'));var BPromise=require(_0xa5fb('0x3'));var rp=require(_0xa5fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5fb('0x5'));var config=require('../../config/environment');var attributes=require(_0xa5fb('0x6'));module[_0xa5fb('0x7')]=function(_0xfdf0c6,_0x1b373c){return _0xfdf0c6[_0xa5fb('0x8')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa5fb('0x9'),'fields':[_0xa5fb('0xa'),_0xa5fb('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f5f4299..7866f76 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 _0xe229=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x196e94,_0x427202){var _0x3cb3a8=function(_0x455683){while(--_0x455683){_0x196e94['push'](_0x196e94['shift']());}};_0x3cb3a8(++_0x427202);}(_0xe229,0x14a));var _0x9e22=function(_0x2c731d,_0x5df5c3){_0x2c731d=_0x2c731d-0x0;var _0x469ae9=_0xe229[_0x2c731d];return _0x469ae9;};'use strict';var _=require(_0x9e22('0x0'));var util=require(_0x9e22('0x1'));var moment=require(_0x9e22('0x2'));var BPromise=require(_0x9e22('0x3'));var rs=require(_0x9e22('0x4'));var fs=require('fs');var Redis=require(_0x9e22('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e22('0x6'))(_0x9e22('0x7'));var config=require(_0x9e22('0x8'));var jayson=require(_0x9e22('0x9'));var client=jayson[_0x9e22('0xa')][_0x9e22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27f593,_0x44f6f7,_0x2ca816){return new BPromise(function(_0x38d11f,_0x4a64a3){return client['request'](_0x27f593,_0x2ca816)['then'](function(_0x3b00fb){logger['info'](_0x9e22('0xc'),_0x44f6f7,_0x9e22('0xd'));logger[_0x9e22('0xe')](_0x9e22('0xf'),_0x44f6f7,_0x9e22('0xd'),JSON[_0x9e22('0x10')](_0x3b00fb));if(_0x3b00fb['error']){if(_0x3b00fb[_0x9e22('0x11')][_0x9e22('0x12')]===0x1f4){logger[_0x9e22('0x11')](_0x9e22('0xc'),_0x44f6f7,_0x3b00fb[_0x9e22('0x11')][_0x9e22('0x13')]);return _0x4a64a3(_0x3b00fb[_0x9e22('0x11')][_0x9e22('0x13')]);}logger[_0x9e22('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x44f6f7,_0x3b00fb['error']['message']);return _0x38d11f(_0x3b00fb[_0x9e22('0x11')][_0x9e22('0x13')]);}else{logger[_0x9e22('0x14')](_0x9e22('0xc'),_0x44f6f7,_0x9e22('0xd'));_0x38d11f(_0x3b00fb[_0x9e22('0x15')]['message']);}})['catch'](function(_0x1e3358){logger[_0x9e22('0x11')](_0x9e22('0xc'),_0x44f6f7,_0x1e3358);_0x4a64a3(_0x1e3358);});});} \ No newline at end of file +var _0xd8d6=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e32c3,_0x4aec3c){var _0x4d295e=function(_0x5d88cb){while(--_0x5d88cb){_0x1e32c3['push'](_0x1e32c3['shift']());}};_0x4d295e(++_0x4aec3c);}(_0xd8d6,0xc3));var _0x6d8d=function(_0x4d3e87,_0x20a513){_0x4d3e87=_0x4d3e87-0x0;var _0x2f140d=_0xd8d6[_0x4d3e87];return _0x2f140d;};'use strict';var _=require(_0x6d8d('0x0'));var util=require(_0x6d8d('0x1'));var moment=require(_0x6d8d('0x2'));var BPromise=require(_0x6d8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d8d('0x5'));var logger=require(_0x6d8d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6d8d('0x7'));var client=jayson[_0x6d8d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101873,_0x3b406e,_0x359308){return new BPromise(function(_0xbfe3ff,_0x37c68e){return client[_0x6d8d('0x9')](_0x101873,_0x359308)[_0x6d8d('0xa')](function(_0x23c02d){logger[_0x6d8d('0xb')](_0x6d8d('0xc'),_0x3b406e,_0x6d8d('0xd'));logger[_0x6d8d('0xe')](_0x6d8d('0xf'),_0x3b406e,'request\x20sent',JSON[_0x6d8d('0x10')](_0x23c02d));if(_0x23c02d[_0x6d8d('0x11')]){if(_0x23c02d[_0x6d8d('0x11')]['code']===0x1f4){logger[_0x6d8d('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x3b406e,_0x23c02d[_0x6d8d('0x11')][_0x6d8d('0x12')]);return _0x37c68e(_0x23c02d[_0x6d8d('0x11')][_0x6d8d('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3b406e,_0x23c02d[_0x6d8d('0x11')][_0x6d8d('0x12')]);return _0xbfe3ff(_0x23c02d['error']['message']);}else{logger[_0x6d8d('0xb')](_0x6d8d('0xc'),_0x3b406e,'request\x20sent');_0xbfe3ff(_0x23c02d[_0x6d8d('0x13')][_0x6d8d('0x12')]);}})[_0x6d8d('0x14')](function(_0x2e63a2){logger['error'](_0x6d8d('0xc'),_0x3b406e,_0x2e63a2);_0x37c68e(_0x2e63a2);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 3b59379..123ade5 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 _0x340c=['index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc340('0x0'));var util=require(_0xc340('0x1'));var path=require(_0xc340('0x2'));var timeout=require(_0xc340('0x3'));var express=require('express');var router=express[_0xc340('0x4')]();var fs_extra=require(_0xc340('0x5'));var auth=require(_0xc340('0x6'));var interaction=require(_0xc340('0x7'));var config=require('../../config/environment');var controller=require(_0xc340('0x8'));router[_0xc340('0x9')]('/',auth[_0xc340('0xa')](),controller[_0xc340('0xb')]);router[_0xc340('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc340('0x9')](_0xc340('0xc'),auth['isAuthenticated'](),controller[_0xc340('0xd')]);router[_0xc340('0x9')](_0xc340('0xe'),auth[_0xc340('0xa')](),controller[_0xc340('0xf')]);router['post']('/',auth[_0xc340('0xa')](),controller[_0xc340('0x10')]);router[_0xc340('0x11')]('/:id/configurations',auth[_0xc340('0xa')](),controller[_0xc340('0x12')]);router[_0xc340('0x13')](_0xc340('0x14'),auth[_0xc340('0xa')](),controller['update']);router[_0xc340('0x15')](_0xc340('0x14'),auth[_0xc340('0xa')](),controller[_0xc340('0x16')]);module[_0xc340('0x17')]=router; \ No newline at end of file +var _0xb701=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x52eb43,_0x59d7ee){var _0x8eec74=function(_0x68255){while(--_0x68255){_0x52eb43['push'](_0x52eb43['shift']());}};_0x8eec74(++_0x59d7ee);}(_0xb701,0x144));var _0x1b70=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb701[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b70('0x2'));var auth=require(_0x1b70('0x3'));var interaction=require(_0x1b70('0x4'));var config=require(_0x1b70('0x5'));var controller=require(_0x1b70('0x6'));router[_0x1b70('0x7')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x9')]);router[_0x1b70('0x7')](_0x1b70('0xa'),auth['isAuthenticated'](),controller[_0x1b70('0xb')]);router[_0x1b70('0x7')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0xd')]);router[_0x1b70('0x7')](_0x1b70('0xe'),auth['isAuthenticated'](),controller[_0x1b70('0xf')]);router[_0x1b70('0x10')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x11')]);router[_0x1b70('0x10')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x12')]);router[_0x1b70('0x13')](_0x1b70('0xa'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x14')]);router[_0x1b70('0x15')]('/:id',auth[_0x1b70('0x8')](),controller[_0x1b70('0x16')]);module[_0x1b70('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0a2b762..43007e6 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 _0xc80b=['sequelize','exports','STRING','HelpDesk'];(function(_0x1abaac,_0x28e8a1){var _0x174a11=function(_0x402401){while(--_0x402401){_0x1abaac['push'](_0x1abaac['shift']());}};_0x174a11(++_0x28e8a1);}(_0xc80b,0x98));var _0xbc80=function(_0x120ba9,_0x37090d){_0x120ba9=_0x120ba9-0x0;var _0x35f49d=_0xc80b[_0x120ba9];return _0x35f49d;};'use strict';var Sequelize=require(_0xbc80('0x0'));module[_0xbc80('0x1')]={'name':{'type':Sequelize[_0xbc80('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbc80('0x2')]},'username':{'type':Sequelize[_0xbc80('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbc80('0x2')],'allowNull':![],'defaultValue':_0xbc80('0x3')},'remoteUri':{'type':Sequelize[_0xbc80('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xbc80('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc8f8=['HelpDesk','sequelize','exports','STRING'];(function(_0x45a5b5,_0x4a644c){var _0x2c4bc8=function(_0x452253){while(--_0x452253){_0x45a5b5['push'](_0x45a5b5['shift']());}};_0x2c4bc8(++_0x4a644c);}(_0xc8f8,0x81));var _0x8c8f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc8f8[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x8c8f('0x0'));module[_0x8c8f('0x1')]={'name':{'type':Sequelize[_0x8c8f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8c8f('0x2')],'allowNull':![],'defaultValue':_0x8c8f('0x3')},'remoteUri':{'type':Sequelize[_0x8c8f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8c8f('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8c8f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index df1422f..0f1bf57 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 _0x7e59=['findOne','VtigerConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','cf_','picklist','picklistValues','label','log','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','getConfigurations'];(function(_0x576fe0,_0x4bcb37){var _0x236f59=function(_0x313258){while(--_0x313258){_0x576fe0['push'](_0x576fe0['shift']());}};_0x236f59(++_0x4bcb37);}(_0x7e59,0x125));var _0x97e5=function(_0x24309a,_0x1d3764){_0x24309a=_0x24309a-0x0;var _0x3eb34f=_0x7e59[_0x24309a];return _0x3eb34f;};'use strict';var emlformat=require(_0x97e5('0x0'));var rimraf=require(_0x97e5('0x1'));var zipdir=require(_0x97e5('0x2'));var jsonpatch=require(_0x97e5('0x3'));var rp=require(_0x97e5('0x4'));var moment=require(_0x97e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x97e5('0x6'));var util=require(_0x97e5('0x7'));var path=require(_0x97e5('0x8'));var sox=require('sox');var csv=require(_0x97e5('0x9'));var ejs=require(_0x97e5('0xa'));var fs=require('fs');var fs_extra=require(_0x97e5('0xb'));var _=require(_0x97e5('0xc'));var squel=require(_0x97e5('0xd'));var crypto=require(_0x97e5('0xe'));var jsforce=require(_0x97e5('0xf'));var deskjs=require(_0x97e5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x97e5('0x11'));var Papa=require(_0x97e5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x97e5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x97e5('0x14'))(_0x97e5('0x15'));var utils=require(_0x97e5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x97e5('0x17'));var db=require(_0x97e5('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x468058,_0x1e66f3){_0x1e66f3=_0x1e66f3||0xcc;return function(_0x4077e7){if(_0x4077e7){return _0x468058[_0x97e5('0x19')](_0x1e66f3);}return _0x468058[_0x97e5('0x1a')](_0x1e66f3)['end']();};}function respondWithResult(_0x253495,_0xf30317){_0xf30317=_0xf30317||0xc8;return function(_0x544ca2){if(_0x544ca2){return _0x253495[_0x97e5('0x1a')](_0xf30317)[_0x97e5('0x1b')](_0x544ca2);}};}function respondWithFilteredResult(_0x291b4b,_0x29a2cf){return function(_0x3a1733){if(_0x3a1733){var _0x44f533=typeof _0x29a2cf['offset']===_0x97e5('0x1c')&&typeof _0x29a2cf[_0x97e5('0x1d')]===_0x97e5('0x1c');var _0x227d85=_0x3a1733[_0x97e5('0x1e')];var _0x43fa78=_0x44f533?0x0:_0x29a2cf[_0x97e5('0x1f')];var _0xd6d2f8=_0x44f533?_0x3a1733['count']:_0x29a2cf[_0x97e5('0x1f')]+_0x29a2cf[_0x97e5('0x1d')];var _0x2be1a4;if(_0xd6d2f8>=_0x227d85){_0xd6d2f8=_0x227d85;_0x2be1a4=0xc8;}else{_0x2be1a4=0xce;}_0x291b4b[_0x97e5('0x1a')](_0x2be1a4);return _0x291b4b[_0x97e5('0x20')](_0x97e5('0x21'),_0x43fa78+'-'+_0xd6d2f8+'/'+_0x227d85)[_0x97e5('0x1b')](_0x3a1733);}return null;};}function patchUpdates(_0xeb29df){return function(_0x3e3b54){try{jsonpatch[_0x97e5('0x22')](_0x3e3b54,_0xeb29df,!![]);}catch(_0x7c9557){return BPromise['reject'](_0x7c9557);}return _0x3e3b54[_0x97e5('0x23')]();};}function saveUpdates(_0x1874a3,_0x52aba2){return function(_0x1e22ad){if(_0x1e22ad){return _0x1e22ad['update'](_0x1874a3)['then'](function(_0x934cd1){return _0x934cd1;});}return null;};}function removeEntity(_0xbae841,_0x50ca11){return function(_0x15a632){if(_0x15a632){return _0x15a632[_0x97e5('0x24')]()['then'](function(){_0xbae841[_0x97e5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454ec5,_0x35de2f){return function(_0x74bb9){if(!_0x74bb9){_0x454ec5[_0x97e5('0x19')](0x194);}return _0x74bb9;};}function handleError(_0x126007,_0x2928bd){_0x2928bd=_0x2928bd||0x1f4;return function(_0x3ce127){logger[_0x97e5('0x25')](_0x3ce127[_0x97e5('0x26')]);if(_0x3ce127[_0x97e5('0x27')]){delete _0x3ce127[_0x97e5('0x27')];}_0x126007[_0x97e5('0x1a')](_0x2928bd)[_0x97e5('0x28')](_0x3ce127);};}exports[_0x97e5('0x29')]=function(_0x2b69ce,_0x189390){var _0x4258a1={},_0x28382b={},_0x30fa66={'count':0x0,'rows':[]};var _0x1f941d=_[_0x97e5('0x2a')](db[_0x97e5('0x2b')]['rawAttributes'],function(_0x1df330){return{'name':_0x1df330[_0x97e5('0x2c')],'type':_0x1df330[_0x97e5('0x2d')]['key']};});_0x28382b[_0x97e5('0x2e')]=_['map'](_0x1f941d,'name');_0x28382b[_0x97e5('0x2f')]=_['keys'](_0x2b69ce[_0x97e5('0x2f')]);_0x28382b['filters']=_[_0x97e5('0x30')](_0x28382b['model'],_0x28382b[_0x97e5('0x2f')]);_0x4258a1['attributes']=_['intersection'](_0x28382b[_0x97e5('0x2e')],qs[_0x97e5('0x31')](_0x2b69ce[_0x97e5('0x2f')][_0x97e5('0x31')]));_0x4258a1[_0x97e5('0x32')]=_0x4258a1[_0x97e5('0x32')][_0x97e5('0x33')]?_0x4258a1[_0x97e5('0x32')]:_0x28382b[_0x97e5('0x2e')];if(!_0x2b69ce[_0x97e5('0x2f')][_0x97e5('0x34')]('nolimit')){_0x4258a1[_0x97e5('0x1d')]=qs[_0x97e5('0x1d')](_0x2b69ce[_0x97e5('0x2f')][_0x97e5('0x1d')]);_0x4258a1['offset']=qs['offset'](_0x2b69ce[_0x97e5('0x2f')]['offset']);}_0x4258a1[_0x97e5('0x35')]=qs[_0x97e5('0x36')](_0x2b69ce[_0x97e5('0x2f')][_0x97e5('0x36')]);_0x4258a1['where']=qs[_0x97e5('0x37')](_[_0x97e5('0x38')](_0x2b69ce[_0x97e5('0x2f')],_0x28382b[_0x97e5('0x37')]),_0x1f941d);if(_0x2b69ce['query'][_0x97e5('0x39')]){_0x4258a1[_0x97e5('0x3a')]=_[_0x97e5('0x3b')](_0x4258a1[_0x97e5('0x3a')],{'$or':_[_0x97e5('0x2a')](_0x1f941d,function(_0x41741b){if(_0x41741b[_0x97e5('0x2d')]!==_0x97e5('0x3c')){var _0x17951a={};_0x17951a[_0x41741b[_0x97e5('0x27')]]={'$like':'%'+_0x2b69ce['query'][_0x97e5('0x39')]+'%'};return _0x17951a;}})});}_0x4258a1=_['merge']({},_0x4258a1,_0x2b69ce[_0x97e5('0x3d')]);var _0x5d84c6={'where':_0x4258a1[_0x97e5('0x3a')]};return db[_0x97e5('0x2b')]['count'](_0x5d84c6)[_0x97e5('0x3e')](function(_0x30e190){_0x30fa66[_0x97e5('0x1e')]=_0x30e190;if(_0x2b69ce['query'][_0x97e5('0x3f')]){_0x4258a1[_0x97e5('0x40')]=[{'all':!![]}];}return db[_0x97e5('0x2b')][_0x97e5('0x41')](_0x4258a1);})['then'](function(_0x359267){_0x30fa66[_0x97e5('0x42')]=_0x359267;return _0x30fa66;})[_0x97e5('0x3e')](respondWithFilteredResult(_0x189390,_0x4258a1))[_0x97e5('0x43')](handleError(_0x189390,null));};exports[_0x97e5('0x44')]=function(_0x19aded,_0x32c305){var _0x4b5e52={'raw':![],'where':{'id':_0x19aded[_0x97e5('0x45')]['id']}},_0x58c417={};_0x58c417[_0x97e5('0x2e')]=_[_0x97e5('0x46')](db[_0x97e5('0x2b')]['rawAttributes']);_0x58c417[_0x97e5('0x2f')]=_[_0x97e5('0x46')](_0x19aded['query']);_0x58c417['filters']=_[_0x97e5('0x30')](_0x58c417[_0x97e5('0x2e')],_0x58c417[_0x97e5('0x2f')]);_0x4b5e52[_0x97e5('0x32')]=_[_0x97e5('0x30')](_0x58c417['model'],qs[_0x97e5('0x31')](_0x19aded['query']['fields']));_0x4b5e52[_0x97e5('0x32')]=_0x4b5e52[_0x97e5('0x32')][_0x97e5('0x33')]?_0x4b5e52['attributes']:_0x58c417[_0x97e5('0x2e')];if(_0x19aded[_0x97e5('0x2f')][_0x97e5('0x3f')]){_0x4b5e52[_0x97e5('0x40')]=[{'all':!![]}];}_0x4b5e52=_[_0x97e5('0x3b')]({},_0x4b5e52,_0x19aded[_0x97e5('0x3d')]);return db[_0x97e5('0x2b')]['find'](_0x4b5e52)[_0x97e5('0x3e')](handleEntityNotFound(_0x32c305,null))[_0x97e5('0x3e')](respondWithResult(_0x32c305,null))[_0x97e5('0x43')](handleError(_0x32c305,null));};exports[_0x97e5('0x47')]=function(_0x4c2225,_0x311156){return db[_0x97e5('0x2b')]['create'](_0x4c2225[_0x97e5('0x48')],{})[_0x97e5('0x3e')](respondWithResult(_0x311156,0xc9))[_0x97e5('0x43')](handleError(_0x311156,null));};exports[_0x97e5('0x49')]=function(_0x287d38,_0x524abb){if(_0x287d38[_0x97e5('0x48')]['id']){delete _0x287d38['body']['id'];}return db[_0x97e5('0x2b')]['find']({'where':{'id':_0x287d38['params']['id']}})[_0x97e5('0x3e')](handleEntityNotFound(_0x524abb,null))['then'](saveUpdates(_0x287d38['body'],null))['then'](respondWithResult(_0x524abb,null))['catch'](handleError(_0x524abb,null));};exports[_0x97e5('0x24')]=function(_0x34c533,_0x3820ca){return db['VtigerAccount'][_0x97e5('0x4a')]({'where':{'id':_0x34c533['params']['id']}})[_0x97e5('0x3e')](handleEntityNotFound(_0x3820ca,null))['then'](removeEntity(_0x3820ca,null))[_0x97e5('0x43')](handleError(_0x3820ca,null));};exports[_0x97e5('0x4b')]=function(_0x19b576,_0x19345c,_0x42960d){var _0x38edc6={};var _0x37762e={};var _0x3011b1;var _0x2b821d;return db[_0x97e5('0x2b')][_0x97e5('0x4c')]({'where':{'id':_0x19b576[_0x97e5('0x45')]['id']}})[_0x97e5('0x3e')](handleEntityNotFound(_0x19345c,null))[_0x97e5('0x3e')](function(_0x4bec72){if(_0x4bec72){_0x3011b1=_0x4bec72;_0x37762e['model']=_[_0x97e5('0x46')](db[_0x97e5('0x4d')][_0x97e5('0x4e')]);_0x37762e[_0x97e5('0x2f')]=_['keys'](_0x19b576[_0x97e5('0x2f')]);_0x37762e[_0x97e5('0x37')]=_[_0x97e5('0x30')](_0x37762e[_0x97e5('0x2e')],_0x37762e[_0x97e5('0x2f')]);_0x38edc6[_0x97e5('0x32')]=_['intersection'](_0x37762e[_0x97e5('0x2e')],qs['fields'](_0x19b576[_0x97e5('0x2f')][_0x97e5('0x31')]));_0x38edc6[_0x97e5('0x32')]=_0x38edc6[_0x97e5('0x32')][_0x97e5('0x33')]?_0x38edc6['attributes']:_0x37762e[_0x97e5('0x2e')];_0x38edc6[_0x97e5('0x35')]=qs[_0x97e5('0x36')](_0x19b576[_0x97e5('0x2f')][_0x97e5('0x36')]);_0x38edc6[_0x97e5('0x3a')]=qs[_0x97e5('0x37')](_[_0x97e5('0x38')](_0x19b576['query'],_0x37762e[_0x97e5('0x37')]));if(_0x19b576['query'][_0x97e5('0x39')]){_0x38edc6[_0x97e5('0x3a')]=_[_0x97e5('0x3b')](_0x38edc6['where'],{'$or':_[_0x97e5('0x2a')](_0x38edc6[_0x97e5('0x32')],function(_0x196ffb){var _0xa9d6dc={};_0xa9d6dc[_0x196ffb]={'$like':'%'+_0x19b576['query'][_0x97e5('0x39')]+'%'};return _0xa9d6dc;})});}_0x38edc6=_['merge']({},_0x38edc6,_0x19b576[_0x97e5('0x3d')]);return _0x3011b1[_0x97e5('0x4b')](_0x38edc6);}})['then'](function(_0x12478c){if(_0x12478c){_0x2b821d=_0x12478c[_0x97e5('0x33')];if(!_0x19b576[_0x97e5('0x2f')][_0x97e5('0x34')](_0x97e5('0x4f'))){_0x38edc6[_0x97e5('0x1d')]=qs[_0x97e5('0x1d')](_0x19b576['query'][_0x97e5('0x1d')]);_0x38edc6[_0x97e5('0x1f')]=qs[_0x97e5('0x1f')](_0x19b576[_0x97e5('0x2f')][_0x97e5('0x1f')]);}return _0x3011b1[_0x97e5('0x4b')](_0x38edc6);}})[_0x97e5('0x3e')](function(_0x12912b){if(_0x12912b){return _0x12912b?{'count':_0x2b821d,'rows':_0x12912b}:null;}})[_0x97e5('0x3e')](respondWithResult(_0x19345c,null))[_0x97e5('0x43')](handleError(_0x19345c,null));};exports[_0x97e5('0x50')]=function(_0x5136bf,_0x334e93,_0x152631){if(_0x5136bf[_0x97e5('0x48')]['id']){delete _0x5136bf['body']['id'];}return db[_0x97e5('0x2b')]['findOne']({'where':{'id':_0x5136bf[_0x97e5('0x45')]['id']}})[_0x97e5('0x3e')](handleEntityNotFound(_0x334e93,null))[_0x97e5('0x3e')](function(_0x3a87c8){if(_0x3a87c8){_0x5136bf[_0x97e5('0x48')][_0x97e5('0x51')]=_0x3a87c8['id'];_0x5136bf[_0x97e5('0x48')][_0x97e5('0x52')]=integrations[_0x97e5('0x53')](_0x5136bf[_0x97e5('0x48')][_0x97e5('0x54')],_0x5136bf[_0x97e5('0x48')][_0x97e5('0x2d')]);_0x5136bf[_0x97e5('0x48')][_0x97e5('0x55')]=integrations[_0x97e5('0x56')](_0x5136bf[_0x97e5('0x48')][_0x97e5('0x54')],_0x5136bf[_0x97e5('0x48')][_0x97e5('0x2d')]);return db['VtigerConfiguration']['create'](_0x5136bf[_0x97e5('0x48')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x97e5('0x57')],'as':_0x97e5('0x55')}]});}return null;})['then'](respondWithResult(_0x334e93,null))[_0x97e5('0x43')](handleError(_0x334e93,null));};var md5=require(_0x97e5('0x58'));exports[_0x97e5('0x59')]=function(_0x5b7717,_0x371800,_0x6f2fc4){var _0x18ac0b=null;var _0x5ee624=null;var _0x23bcd0=null;var _0x4c015e=null;var _0x1bf1c7='';return db[_0x97e5('0x2b')][_0x97e5('0x4c')]({'where':{'id':_0x5b7717['params']['id']},'attributes':['id','name',_0x97e5('0x5a'),'description',_0x97e5('0x5b'),_0x97e5('0x5c'),_0x97e5('0x5d'),_0x97e5('0x5e')]})[_0x97e5('0x3e')](handleEntityNotFound(_0x371800,null))[_0x97e5('0x3e')](function(_0x4efb29){if(_0x4efb29){_0x18ac0b=_0x4efb29[_0x97e5('0x5a')];_0x5ee624=_0x4efb29[_0x97e5('0x5e')];_0x23bcd0=_0x4efb29[_0x97e5('0x5b')];_0x1bf1c7=_0x4efb29[_0x97e5('0x5c')];var _0x781180=_0x1bf1c7['slice'](-0x1);if(_0x781180==='/'){_0x1bf1c7=_0x1bf1c7[_0x97e5('0x5f')](0x0,_0x1bf1c7[_0x97e5('0x60')](_0x781180));}_0x4c015e=util['format'](_0x97e5('0x61'),_0x1bf1c7);var _0x52c7e7={'method':_0x97e5('0x62'),'uri':_0x4c015e,'qs':{'operation':_0x97e5('0x63'),'username':_0x4efb29[_0x97e5('0x5a')]},'json':!![]};return rp(_0x52c7e7);}})[_0x97e5('0x3e')](function(_0x1a45ef){if(_0x1a45ef[_0x97e5('0x64')]){var _0x5751d4={'method':_0x97e5('0x65'),'uri':_0x4c015e,'form':{'operation':_0x97e5('0x66'),'username':_0x18ac0b,'accessKey':md5(_0x1a45ef[_0x97e5('0x67')]['token']+_0x5ee624)},'json':!![]};return rp(_0x5751d4);}})['then'](function(_0x4b1b0f){if(_0x4b1b0f[_0x97e5('0x64')]){var _0x5dc9c9={'method':_0x97e5('0x62'),'uri':_0x4c015e,'qs':{'operation':_0x97e5('0x68'),'username':_0x18ac0b,'sessionName':_0x4b1b0f[_0x97e5('0x67')][_0x97e5('0x69')],'elementType':_0x23bcd0},'json':!![]};return rp(_0x5dc9c9);}})[_0x97e5('0x3e')](function(_0x3339b8){if(_0x3339b8[_0x97e5('0x64')]){var _0x4827c4=[_0x97e5('0x6a'),_0x97e5('0x6b'),_0x97e5('0x6c')];_[_0x97e5('0x6d')](_0x3339b8[_0x97e5('0x67')][_0x97e5('0x31')],function(_0xeaa60a){return _0x4827c4[_0x97e5('0x6e')](_0xeaa60a[_0x97e5('0x2d')][_0x97e5('0x27')]);});_[_0x97e5('0x6d')](_0x3339b8['result'][_0x97e5('0x31')],function(_0x4b1f4f){return _0x4b1f4f[_0x97e5('0x6f')]===_0x97e5('0x70');});return{'count':_0x3339b8[_0x97e5('0x67')]['fields']['length'],'rows':_[_0x97e5('0x2a')](_0x3339b8['result'][_0x97e5('0x31')],function(_0x5251e3){return{'id':_0x5251e3[_0x97e5('0x27')],'name':_0x5251e3['label'],'custom':_['startsWith'](_0x5251e3[_0x97e5('0x27')],_0x97e5('0x71'))?!![]:![],'options':_0x5251e3[_0x97e5('0x2d')][_0x97e5('0x27')]===_0x97e5('0x72')&&_0x5251e3[_0x97e5('0x2d')][_0x97e5('0x73')][_0x97e5('0x33')]>0x0?_[_0x97e5('0x2a')](_0x5251e3[_0x97e5('0x2d')][_0x97e5('0x73')],function(_0x574c85){return{'name':_0x574c85[_0x97e5('0x74')],'value':_0x574c85['value']};}):[]};})};}})[_0x97e5('0x3e')](respondWithResult(_0x371800,null))[_0x97e5('0x43')](function(_0x42e824){console[_0x97e5('0x75')]('vTiger\x20error:\x20'+_0x42e824);var _0x5d88f7=_0x5b7717['query'][_0x97e5('0x76')]?0x1f4:_0x42e824['statusCode']||0x1f4;logger[_0x97e5('0x25')](_0x97e5('0x77'),'getFields',_0x5d88f7,JSON[_0x97e5('0x78')](_0x42e824));delete _0x42e824[_0x97e5('0x27')];if(_0x5d88f7===0x191){_0x5d88f7=0x190;}_0x371800[_0x97e5('0x1a')](_0x5d88f7)[_0x97e5('0x28')](_0x5b7717[_0x97e5('0x2f')]['test']?{'message':_0x97e5('0x79'),'statusCode':_0x42e824[_0x97e5('0x7a')]}:_0x42e824);});}; \ No newline at end of file +var _0x2404=['body','getConfigurations','findOne','VtigerConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','slice','%s/webservice.php','GET','getchallenge','username','success','login','describe','result','sessionName','autogenerated','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','type','VIRTUAL','options','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0x2404,0xa7));var _0x4240=function(_0x16d2f1,_0x2850ee){_0x16d2f1=_0x16d2f1-0x0;var _0xbf5d5f=_0x2404[_0x16d2f1];return _0xbf5d5f;};'use strict';var emlformat=require(_0x4240('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4240('0x1'));var jsonpatch=require(_0x4240('0x2'));var rp=require(_0x4240('0x3'));var moment=require(_0x4240('0x4'));var BPromise=require(_0x4240('0x5'));var Mustache=require('mustache');var util=require(_0x4240('0x6'));var path=require(_0x4240('0x7'));var sox=require('sox');var csv=require(_0x4240('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4240('0x9'));var squel=require(_0x4240('0xa'));var crypto=require(_0x4240('0xb'));var jsforce=require(_0x4240('0xc'));var deskjs=require(_0x4240('0xd'));var toCsv=require(_0x4240('0x8'));var querystring=require(_0x4240('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4240('0xf'));var qs=require(_0x4240('0x10'));var as=require(_0x4240('0x11'));var hardwareService=require(_0x4240('0x12'));var logger=require('../../config/logger')(_0x4240('0x13'));var utils=require(_0x4240('0x14'));var config=require(_0x4240('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4240('0x16'))['db'];var integrations=require(_0x4240('0x17'));function respondWithStatusCode(_0x1411fa,_0x59535c){_0x59535c=_0x59535c||0xcc;return function(_0x1a88f0){if(_0x1a88f0){return _0x1411fa[_0x4240('0x18')](_0x59535c);}return _0x1411fa[_0x4240('0x19')](_0x59535c)[_0x4240('0x1a')]();};}function respondWithResult(_0x8c85e9,_0x3e87d1){_0x3e87d1=_0x3e87d1||0xc8;return function(_0x3d5c5c){if(_0x3d5c5c){return _0x8c85e9['status'](_0x3e87d1)[_0x4240('0x1b')](_0x3d5c5c);}};}function respondWithFilteredResult(_0x44ccea,_0x2365a5){return function(_0x253ec1){if(_0x253ec1){var _0x4a3bec=typeof _0x2365a5[_0x4240('0x1c')]===_0x4240('0x1d')&&typeof _0x2365a5[_0x4240('0x1e')]==='undefined';var _0x2d6589=_0x253ec1[_0x4240('0x1f')];var _0x4a8855=_0x4a3bec?0x0:_0x2365a5['offset'];var _0x41d3d8=_0x4a3bec?_0x253ec1[_0x4240('0x1f')]:_0x2365a5[_0x4240('0x1c')]+_0x2365a5[_0x4240('0x1e')];var _0x40dd5b;if(_0x41d3d8>=_0x2d6589){_0x41d3d8=_0x2d6589;_0x40dd5b=0xc8;}else{_0x40dd5b=0xce;}_0x44ccea[_0x4240('0x19')](_0x40dd5b);return _0x44ccea['set']('Content-Range',_0x4a8855+'-'+_0x41d3d8+'/'+_0x2d6589)['json'](_0x253ec1);}return null;};}function patchUpdates(_0x1d5cc0){return function(_0x43a118){try{jsonpatch[_0x4240('0x20')](_0x43a118,_0x1d5cc0,!![]);}catch(_0xb04f12){return BPromise[_0x4240('0x21')](_0xb04f12);}return _0x43a118['save']();};}function saveUpdates(_0x3b542a,_0x379585){return function(_0x4b8d89){if(_0x4b8d89){return _0x4b8d89[_0x4240('0x22')](_0x3b542a)[_0x4240('0x23')](function(_0x591322){return _0x591322;});}return null;};}function removeEntity(_0x1b24b0,_0x4ac5da){return function(_0x193dbc){if(_0x193dbc){return _0x193dbc[_0x4240('0x24')]()[_0x4240('0x23')](function(){_0x1b24b0['status'](0xcc)[_0x4240('0x1a')]();});}};}function handleEntityNotFound(_0x2cdf1a,_0x503e19){return function(_0x2fb2ae){if(!_0x2fb2ae){_0x2cdf1a['sendStatus'](0x194);}return _0x2fb2ae;};}function handleError(_0x8ee4c1,_0x3fce41){_0x3fce41=_0x3fce41||0x1f4;return function(_0x407f74){logger[_0x4240('0x25')](_0x407f74[_0x4240('0x26')]);if(_0x407f74['name']){delete _0x407f74[_0x4240('0x27')];}_0x8ee4c1['status'](_0x3fce41)['send'](_0x407f74);};}exports['index']=function(_0x10d5ba,_0x15195c){var _0x5b6f0f={},_0x590fb5={},_0x343c8e={'count':0x0,'rows':[]};var _0x43f8d4=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x4b3acc){return{'name':_0x4b3acc[_0x4240('0x28')],'type':_0x4b3acc['type']['key']};});_0x590fb5[_0x4240('0x29')]=_[_0x4240('0x2a')](_0x43f8d4,_0x4240('0x27'));_0x590fb5[_0x4240('0x2b')]=_[_0x4240('0x2c')](_0x10d5ba[_0x4240('0x2b')]);_0x590fb5[_0x4240('0x2d')]=_['intersection'](_0x590fb5['model'],_0x590fb5['query']);_0x5b6f0f['attributes']=_[_0x4240('0x2e')](_0x590fb5[_0x4240('0x29')],qs['fields'](_0x10d5ba[_0x4240('0x2b')][_0x4240('0x2f')]));_0x5b6f0f[_0x4240('0x30')]=_0x5b6f0f[_0x4240('0x30')][_0x4240('0x31')]?_0x5b6f0f[_0x4240('0x30')]:_0x590fb5[_0x4240('0x29')];if(!_0x10d5ba['query']['hasOwnProperty']('nolimit')){_0x5b6f0f[_0x4240('0x1e')]=qs[_0x4240('0x1e')](_0x10d5ba['query']['limit']);_0x5b6f0f['offset']=qs[_0x4240('0x1c')](_0x10d5ba[_0x4240('0x2b')][_0x4240('0x1c')]);}_0x5b6f0f['order']=qs[_0x4240('0x32')](_0x10d5ba[_0x4240('0x2b')][_0x4240('0x32')]);_0x5b6f0f['where']=qs[_0x4240('0x2d')](_[_0x4240('0x33')](_0x10d5ba['query'],_0x590fb5['filters']),_0x43f8d4);if(_0x10d5ba[_0x4240('0x2b')][_0x4240('0x34')]){_0x5b6f0f[_0x4240('0x35')]=_[_0x4240('0x36')](_0x5b6f0f[_0x4240('0x35')],{'$or':_[_0x4240('0x2a')](_0x43f8d4,function(_0x22f5d6){if(_0x22f5d6[_0x4240('0x37')]!==_0x4240('0x38')){var _0x152a95={};_0x152a95[_0x22f5d6[_0x4240('0x27')]]={'$like':'%'+_0x10d5ba[_0x4240('0x2b')][_0x4240('0x34')]+'%'};return _0x152a95;}})});}_0x5b6f0f=_[_0x4240('0x36')]({},_0x5b6f0f,_0x10d5ba[_0x4240('0x39')]);var _0x288dc1={'where':_0x5b6f0f['where']};return db[_0x4240('0x3a')]['count'](_0x288dc1)[_0x4240('0x23')](function(_0x45e56e){_0x343c8e[_0x4240('0x1f')]=_0x45e56e;if(_0x10d5ba[_0x4240('0x2b')][_0x4240('0x3b')]){_0x5b6f0f[_0x4240('0x3c')]=[{'all':!![]}];}return db[_0x4240('0x3a')][_0x4240('0x3d')](_0x5b6f0f);})[_0x4240('0x23')](function(_0x39d54d){_0x343c8e[_0x4240('0x3e')]=_0x39d54d;return _0x343c8e;})[_0x4240('0x23')](respondWithFilteredResult(_0x15195c,_0x5b6f0f))[_0x4240('0x3f')](handleError(_0x15195c,null));};exports[_0x4240('0x40')]=function(_0x48713a,_0x53498a){var _0x1b5fce={'raw':![],'where':{'id':_0x48713a[_0x4240('0x41')]['id']}},_0x35ab47={};_0x35ab47[_0x4240('0x29')]=_[_0x4240('0x2c')](db[_0x4240('0x3a')][_0x4240('0x42')]);_0x35ab47[_0x4240('0x2b')]=_[_0x4240('0x2c')](_0x48713a['query']);_0x35ab47[_0x4240('0x2d')]=_['intersection'](_0x35ab47['model'],_0x35ab47[_0x4240('0x2b')]);_0x1b5fce['attributes']=_[_0x4240('0x2e')](_0x35ab47[_0x4240('0x29')],qs[_0x4240('0x2f')](_0x48713a[_0x4240('0x2b')][_0x4240('0x2f')]));_0x1b5fce[_0x4240('0x30')]=_0x1b5fce[_0x4240('0x30')]['length']?_0x1b5fce['attributes']:_0x35ab47[_0x4240('0x29')];if(_0x48713a['query'][_0x4240('0x3b')]){_0x1b5fce['include']=[{'all':!![]}];}_0x1b5fce=_[_0x4240('0x36')]({},_0x1b5fce,_0x48713a[_0x4240('0x39')]);return db[_0x4240('0x3a')][_0x4240('0x43')](_0x1b5fce)[_0x4240('0x23')](handleEntityNotFound(_0x53498a,null))['then'](respondWithResult(_0x53498a,null))[_0x4240('0x3f')](handleError(_0x53498a,null));};exports[_0x4240('0x44')]=function(_0x44a0a8,_0x13a81b){return db[_0x4240('0x3a')][_0x4240('0x44')](_0x44a0a8[_0x4240('0x45')],{})['then'](respondWithResult(_0x13a81b,0xc9))[_0x4240('0x3f')](handleError(_0x13a81b,null));};exports[_0x4240('0x22')]=function(_0x3b4be3,_0x3c59e6){if(_0x3b4be3['body']['id']){delete _0x3b4be3[_0x4240('0x45')]['id'];}return db[_0x4240('0x3a')][_0x4240('0x43')]({'where':{'id':_0x3b4be3[_0x4240('0x41')]['id']}})[_0x4240('0x23')](handleEntityNotFound(_0x3c59e6,null))[_0x4240('0x23')](saveUpdates(_0x3b4be3['body'],null))[_0x4240('0x23')](respondWithResult(_0x3c59e6,null))[_0x4240('0x3f')](handleError(_0x3c59e6,null));};exports[_0x4240('0x24')]=function(_0x232fb7,_0x1f31c9){return db[_0x4240('0x3a')][_0x4240('0x43')]({'where':{'id':_0x232fb7[_0x4240('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f31c9,null))[_0x4240('0x23')](removeEntity(_0x1f31c9,null))[_0x4240('0x3f')](handleError(_0x1f31c9,null));};exports[_0x4240('0x46')]=function(_0x2e35da,_0x2443d2,_0x394319){var _0x47619f={};var _0x86d450={};var _0x5d30c0;var _0x57f551;return db['VtigerAccount'][_0x4240('0x47')]({'where':{'id':_0x2e35da[_0x4240('0x41')]['id']}})[_0x4240('0x23')](handleEntityNotFound(_0x2443d2,null))[_0x4240('0x23')](function(_0xb91db){if(_0xb91db){_0x5d30c0=_0xb91db;_0x86d450[_0x4240('0x29')]=_['keys'](db[_0x4240('0x48')]['rawAttributes']);_0x86d450[_0x4240('0x2b')]=_['keys'](_0x2e35da['query']);_0x86d450[_0x4240('0x2d')]=_['intersection'](_0x86d450['model'],_0x86d450[_0x4240('0x2b')]);_0x47619f[_0x4240('0x30')]=_[_0x4240('0x2e')](_0x86d450[_0x4240('0x29')],qs[_0x4240('0x2f')](_0x2e35da[_0x4240('0x2b')]['fields']));_0x47619f[_0x4240('0x30')]=_0x47619f['attributes']['length']?_0x47619f[_0x4240('0x30')]:_0x86d450['model'];_0x47619f[_0x4240('0x49')]=qs[_0x4240('0x32')](_0x2e35da[_0x4240('0x2b')][_0x4240('0x32')]);_0x47619f['where']=qs[_0x4240('0x2d')](_['pick'](_0x2e35da[_0x4240('0x2b')],_0x86d450[_0x4240('0x2d')]));if(_0x2e35da[_0x4240('0x2b')][_0x4240('0x34')]){_0x47619f[_0x4240('0x35')]=_[_0x4240('0x36')](_0x47619f[_0x4240('0x35')],{'$or':_[_0x4240('0x2a')](_0x47619f[_0x4240('0x30')],function(_0x411e69){var _0x2df3c5={};_0x2df3c5[_0x411e69]={'$like':'%'+_0x2e35da[_0x4240('0x2b')][_0x4240('0x34')]+'%'};return _0x2df3c5;})});}_0x47619f=_['merge']({},_0x47619f,_0x2e35da[_0x4240('0x39')]);return _0x5d30c0[_0x4240('0x46')](_0x47619f);}})[_0x4240('0x23')](function(_0x3bfe21){if(_0x3bfe21){_0x57f551=_0x3bfe21['length'];if(!_0x2e35da['query']['hasOwnProperty'](_0x4240('0x4a'))){_0x47619f[_0x4240('0x1e')]=qs[_0x4240('0x1e')](_0x2e35da[_0x4240('0x2b')][_0x4240('0x1e')]);_0x47619f['offset']=qs['offset'](_0x2e35da[_0x4240('0x2b')]['offset']);}return _0x5d30c0['getConfigurations'](_0x47619f);}})[_0x4240('0x23')](function(_0x1a6231){if(_0x1a6231){return _0x1a6231?{'count':_0x57f551,'rows':_0x1a6231}:null;}})[_0x4240('0x23')](respondWithResult(_0x2443d2,null))[_0x4240('0x3f')](handleError(_0x2443d2,null));};exports[_0x4240('0x4b')]=function(_0x10276e,_0x455603,_0x4f1a68){if(_0x10276e[_0x4240('0x45')]['id']){delete _0x10276e[_0x4240('0x45')]['id'];}return db[_0x4240('0x3a')][_0x4240('0x47')]({'where':{'id':_0x10276e[_0x4240('0x41')]['id']}})[_0x4240('0x23')](handleEntityNotFound(_0x455603,null))['then'](function(_0x36f534){if(_0x36f534){_0x10276e[_0x4240('0x45')][_0x4240('0x4c')]=_0x36f534['id'];_0x10276e[_0x4240('0x45')][_0x4240('0x4d')]=integrations[_0x4240('0x4e')](_0x10276e[_0x4240('0x45')][_0x4240('0x4f')],_0x10276e[_0x4240('0x45')][_0x4240('0x37')]);_0x10276e['body'][_0x4240('0x50')]=integrations[_0x4240('0x51')](_0x10276e['body'][_0x4240('0x4f')],_0x10276e[_0x4240('0x45')][_0x4240('0x37')]);return db[_0x4240('0x48')][_0x4240('0x44')](_0x10276e[_0x4240('0x45')],{'include':[{'model':db[_0x4240('0x52')],'as':_0x4240('0x4d')},{'model':db[_0x4240('0x52')],'as':_0x4240('0x50')}]});}return null;})[_0x4240('0x23')](respondWithResult(_0x455603,null))['catch'](handleError(_0x455603,null));};var md5=require(_0x4240('0x53'));exports[_0x4240('0x54')]=function(_0x62ebf0,_0x3c6666,_0x2e2a3e){var _0x4edf3c=null;var _0x413e12=null;var _0x1a75e5=null;var _0x55a45d=null;var _0x59ea87='';return db['VtigerAccount'][_0x4240('0x47')]({'where':{'id':_0x62ebf0[_0x4240('0x41')]['id']},'attributes':['id',_0x4240('0x27'),'username',_0x4240('0x55'),_0x4240('0x56'),_0x4240('0x57'),_0x4240('0x58'),_0x4240('0x59')]})[_0x4240('0x23')](handleEntityNotFound(_0x3c6666,null))['then'](function(_0x8c3823){if(_0x8c3823){_0x4edf3c=_0x8c3823['username'];_0x413e12=_0x8c3823[_0x4240('0x59')];_0x1a75e5=_0x8c3823[_0x4240('0x56')];_0x59ea87=_0x8c3823[_0x4240('0x57')];var _0x3c3ffd=_0x59ea87[_0x4240('0x5a')](-0x1);if(_0x3c3ffd==='/'){_0x59ea87=_0x59ea87['substring'](0x0,_0x59ea87['lastIndexOf'](_0x3c3ffd));}_0x55a45d=util['format'](_0x4240('0x5b'),_0x59ea87);var _0x3fe038={'method':_0x4240('0x5c'),'uri':_0x55a45d,'qs':{'operation':_0x4240('0x5d'),'username':_0x8c3823[_0x4240('0x5e')]},'json':!![]};return rp(_0x3fe038);}})[_0x4240('0x23')](function(_0x116961){if(_0x116961[_0x4240('0x5f')]){var _0x2981b9={'method':'POST','uri':_0x55a45d,'form':{'operation':_0x4240('0x60'),'username':_0x4edf3c,'accessKey':md5(_0x116961['result']['token']+_0x413e12)},'json':!![]};return rp(_0x2981b9);}})[_0x4240('0x23')](function(_0x4ad0c5){if(_0x4ad0c5[_0x4240('0x5f')]){var _0x5d8831={'method':_0x4240('0x5c'),'uri':_0x55a45d,'qs':{'operation':_0x4240('0x61'),'username':_0x4edf3c,'sessionName':_0x4ad0c5[_0x4240('0x62')][_0x4240('0x63')],'elementType':_0x1a75e5},'json':!![]};return rp(_0x5d8831);}})[_0x4240('0x23')](function(_0x4914ac){if(_0x4914ac[_0x4240('0x5f')]){var _0x562c49=[_0x4240('0x64'),'reference',_0x4240('0x65')];_[_0x4240('0x66')](_0x4914ac[_0x4240('0x62')][_0x4240('0x2f')],function(_0x106798){return _0x562c49[_0x4240('0x67')](_0x106798[_0x4240('0x37')][_0x4240('0x27')]);});_[_0x4240('0x66')](_0x4914ac[_0x4240('0x62')][_0x4240('0x2f')],function(_0x265786){return _0x265786[_0x4240('0x68')]==='false';});return{'count':_0x4914ac['result'][_0x4240('0x2f')][_0x4240('0x31')],'rows':_[_0x4240('0x2a')](_0x4914ac['result']['fields'],function(_0x3fa3a6){return{'id':_0x3fa3a6[_0x4240('0x27')],'name':_0x3fa3a6[_0x4240('0x69')],'custom':_[_0x4240('0x6a')](_0x3fa3a6['name'],_0x4240('0x6b'))?!![]:![],'options':_0x3fa3a6[_0x4240('0x37')][_0x4240('0x27')]===_0x4240('0x6c')&&_0x3fa3a6[_0x4240('0x37')][_0x4240('0x6d')]['length']>0x0?_[_0x4240('0x2a')](_0x3fa3a6['type'][_0x4240('0x6d')],function(_0x5a0877){return{'name':_0x5a0877['label'],'value':_0x5a0877[_0x4240('0x6e')]};}):[]};})};}})[_0x4240('0x23')](respondWithResult(_0x3c6666,null))[_0x4240('0x3f')](function(_0x2dc384){console[_0x4240('0x6f')](_0x4240('0x70')+_0x2dc384);var _0x409d38=_0x62ebf0[_0x4240('0x2b')]['test']?0x1f4:_0x2dc384[_0x4240('0x71')]||0x1f4;logger[_0x4240('0x25')](_0x4240('0x72'),'getFields',_0x409d38,JSON[_0x4240('0x73')](_0x2dc384));delete _0x2dc384[_0x4240('0x27')];if(_0x409d38===0x191){_0x409d38=0x190;}_0x3c6666[_0x4240('0x19')](_0x409d38)[_0x4240('0x74')](_0x62ebf0[_0x4240('0x2b')][_0x4240('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x2dc384[_0x4240('0x71')]}:_0x2dc384);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index dbb6e40..6b06d05 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 _0xc249=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','api','bluebird'];(function(_0xb43bd3,_0x28c9ab){var _0x3a61f0=function(_0x19910c){while(--_0x19910c){_0xb43bd3['push'](_0xb43bd3['shift']());}};_0x3a61f0(++_0x28c9ab);}(_0xc249,0xbf));var _0x9c24=function(_0x190aab,_0x47b736){_0x190aab=_0x190aab-0x0;var _0x2bb073=_0xc249[_0x190aab];return _0x2bb073;};'use strict';var _=require(_0x9c24('0x0'));var util=require(_0x9c24('0x1'));var logger=require('../../config/logger')(_0x9c24('0x2'));var moment=require('moment');var BPromise=require(_0x9c24('0x3'));var rp=require(_0x9c24('0x4'));var fs=require('fs');var path=require(_0x9c24('0x5'));var rimraf=require(_0x9c24('0x6'));var config=require(_0x9c24('0x7'));var attributes=require(_0x9c24('0x8'));var integrations=require(_0x9c24('0x9'));module[_0x9c24('0xa')]=function(_0x3860f1,_0x48ab34){return _0x3860f1[_0x9c24('0xb')]('VtigerAccount',attributes,{'tableName':_0x9c24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash'];(function(_0xf9217d,_0x1bddf2){var _0x16d595=function(_0x259ed5){while(--_0x259ed5){_0xf9217d['push'](_0xf9217d['shift']());}};_0x16d595(++_0x1bddf2);}(_0x59b4,0x149));var _0x459b=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x59b4[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x459b('0x0'));var util=require(_0x459b('0x1'));var logger=require(_0x459b('0x2'))(_0x459b('0x3'));var moment=require(_0x459b('0x4'));var BPromise=require(_0x459b('0x5'));var rp=require(_0x459b('0x6'));var fs=require('fs');var path=require(_0x459b('0x7'));var rimraf=require(_0x459b('0x8'));var config=require(_0x459b('0x9'));var attributes=require(_0x459b('0xa'));var integrations=require(_0x459b('0xb'));module[_0x459b('0xc')]=function(_0x595b28,_0xe70815){return _0x595b28[_0x459b('0xd')](_0x459b('0xe'),attributes,{'tableName':'int_vtiger_accounts','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 e495586..ece2da0 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 _0x4e81=['find','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','map','include','model','attributes','ShowVtigerAccount'];(function(_0x4db1c5,_0x3c5eb7){var _0x2c7427=function(_0x54d42d){while(--_0x54d42d){_0x4db1c5['push'](_0x4db1c5['shift']());}};_0x2c7427(++_0x3c5eb7);}(_0x4e81,0x1bc));var _0x14e8=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x4e81[_0xe501ff];return _0x17135d;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')]({'raw':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0x10dc8b['options']?_0x10dc8b[_0x14e8('0x18')]['attributes']||null:null,'limit':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x1a')]||null:null,'include':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['include']?_[_0x14e8('0x1b')](_0x10dc8b['options'][_0x14e8('0x1c')],function(_0x185a0e){return{'model':db[_0x185a0e['model']],'as':_0x185a0e['as'],'attributes':_0x185a0e['attributes'],'include':_0x185a0e['include']?_[_0x14e8('0x1b')](_0x185a0e[_0x14e8('0x1c')],function(_0x3eae0b){return{'model':db[_0x3eae0b[_0x14e8('0x1d')]],'as':_0x3eae0b['as'],'attributes':_0x3eae0b[_0x14e8('0x1e')],'include':_0x3eae0b['include']?_[_0x14e8('0x1b')](_0x3eae0b[_0x14e8('0x1c')],function(_0x3c09cb){return{'model':db[_0x3c09cb[_0x14e8('0x1d')]],'as':_0x3c09cb['as'],'attributes':_0x3c09cb[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2813ae){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger[_0x14e8('0xd')](_0x14e8('0x15'),_0x10dc8b,JSON['stringify'](_0x2813ae));_0x5a38c1(_0x2813ae);})['catch'](function(_0x5cacd7){logger[_0x14e8('0x10')](_0x14e8('0x15'),_0x5cacd7['message'],_0x10dc8b);_0x328c5a(_0x462259[_0x14e8('0x10')](0x1f4,_0x5cacd7[_0x14e8('0x13')]));});});};exports[_0x14e8('0x1f')]=function(_0xa83433){var _0x5c2635=this;return new Promise(function(_0x1f1259,_0x260d51){return db[_0x14e8('0x16')][_0x14e8('0x20')]({'raw':_0xa83433[_0x14e8('0x18')]?_0xa83433['options'][_0x14e8('0x21')]===undefined?!![]:![]:!![],'where':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0xa83433['options']?_0xa83433[_0x14e8('0x18')]['attributes']||null:null,'include':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')],function(_0xbe9eab){return{'model':db[_0xbe9eab[_0x14e8('0x1d')]],'as':_0xbe9eab['as'],'attributes':_0xbe9eab[_0x14e8('0x1e')],'include':_0xbe9eab[_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xbe9eab[_0x14e8('0x1c')],function(_0x54e624){return{'model':db[_0x54e624['model']],'as':_0x54e624['as'],'attributes':_0x54e624['attributes'],'include':_0x54e624[_0x14e8('0x1c')]?_['map'](_0x54e624[_0x14e8('0x1c')],function(_0x5bdf42){return{'model':db[_0x5bdf42[_0x14e8('0x1d')]],'as':_0x5bdf42['as'],'attributes':_0x5bdf42[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2fc030){logger['info'](_0x14e8('0x1f'),_0xa83433);logger['debug'](_0x14e8('0x1f'),_0xa83433,JSON[_0x14e8('0xf')](_0x2fc030));_0x1f1259(_0x2fc030);})[_0x14e8('0x14')](function(_0x1fda35){logger[_0x14e8('0x10')](_0x14e8('0x1f'),_0x1fda35['message'],_0xa83433);_0x260d51(_0x5c2635[_0x14e8('0x10')](0x1f4,_0x1fda35['message']));});});}; \ No newline at end of file +var _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x21f6e1,_0x435236){var _0x432d70=function(_0x9f6156){while(--_0x9f6156){_0x21f6e1['push'](_0x21f6e1['shift']());}};_0x432d70(++_0x435236);}(_0x69d3,0xda));var _0x369d=function(_0x2eb8cf,_0x2bcaaa){_0x2eb8cf=_0x2eb8cf-0x0;var _0x52f131=_0x69d3[_0x2eb8cf];return _0x52f131;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3a11a82..a14e0b8 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 _0x4c4d=['index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x401a4d,_0x4bb835){var _0x1faaff=function(_0x57539e){while(--_0x57539e){_0x401a4d['push'](_0x401a4d['shift']());}};_0x1faaff(++_0x4bb835);}(_0x4c4d,0x9b));var _0xd4c4=function(_0x372bb1,_0x23436a){_0x372bb1=_0x372bb1-0x0;var _0x42a417=_0x4c4d[_0x372bb1];return _0x42a417;};'use strict';var multer=require(_0xd4c4('0x0'));var util=require(_0xd4c4('0x1'));var path=require(_0xd4c4('0x2'));var timeout=require(_0xd4c4('0x3'));var express=require(_0xd4c4('0x4'));var router=express[_0xd4c4('0x5')]();var fs_extra=require(_0xd4c4('0x6'));var auth=require(_0xd4c4('0x7'));var interaction=require(_0xd4c4('0x8'));var config=require(_0xd4c4('0x9'));var controller=require(_0xd4c4('0xa'));router[_0xd4c4('0xb')]('/',auth[_0xd4c4('0xc')](),controller[_0xd4c4('0xd')]);router['get']('/:id',auth[_0xd4c4('0xc')](),controller[_0xd4c4('0xe')]);router['get'](_0xd4c4('0xf'),auth[_0xd4c4('0xc')](),controller['getFields']);router[_0xd4c4('0xb')](_0xd4c4('0x10'),auth['isAuthenticated'](),controller[_0xd4c4('0x11')]);router[_0xd4c4('0xb')](_0xd4c4('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xd4c4('0xc')](),controller[_0xd4c4('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd4c4('0x14')]);router[_0xd4c4('0x15')](_0xd4c4('0x16'),auth[_0xd4c4('0xc')](),controller['destroy']);module[_0xd4c4('0x17')]=router; \ No newline at end of file +var _0xd2d2=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0xd2d2,0x1cc));var _0x2d2d=function(_0x4089a1,_0x2a43dc){_0x4089a1=_0x4089a1-0x0;var _0x4cea94=_0xd2d2[_0x4089a1];return _0x4cea94;};'use strict';var multer=require(_0x2d2d('0x0'));var util=require(_0x2d2d('0x1'));var path=require(_0x2d2d('0x2'));var timeout=require(_0x2d2d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d2d('0x4'));var auth=require(_0x2d2d('0x5'));var interaction=require(_0x2d2d('0x6'));var config=require(_0x2d2d('0x7'));var controller=require(_0x2d2d('0x8'));router[_0x2d2d('0x9')]('/',auth['isAuthenticated'](),controller[_0x2d2d('0xa')]);router[_0x2d2d('0x9')](_0x2d2d('0xb'),auth[_0x2d2d('0xc')](),controller[_0x2d2d('0xd')]);router[_0x2d2d('0x9')](_0x2d2d('0xe'),auth[_0x2d2d('0xc')](),controller['getFields']);router[_0x2d2d('0x9')]('/:id/subjects',auth[_0x2d2d('0xc')](),controller['getSubjects']);router[_0x2d2d('0x9')](_0x2d2d('0xf'),auth['isAuthenticated'](),controller[_0x2d2d('0x10')]);router[_0x2d2d('0x11')]('/',auth[_0x2d2d('0xc')](),controller[_0x2d2d('0x12')]);router[_0x2d2d('0x13')](_0x2d2d('0xb'),auth[_0x2d2d('0xc')](),controller['update']);router[_0x2d2d('0x14')](_0x2d2d('0xb'),auth[_0x2d2d('0xc')](),controller['destroy']);module[_0x2d2d('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 293a139..80a7cc8 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 _0x90bb=['STRING','sequelize','exports'];(function(_0x2c65d1,_0x31f12a){var _0xb732dd=function(_0x15fc7d){while(--_0x15fc7d){_0x2c65d1['push'](_0x2c65d1['shift']());}};_0xb732dd(++_0x31f12a);}(_0x90bb,0x13f));var _0xb90b=function(_0x224fe7,_0x677e8c){_0x224fe7=_0x224fe7-0x0;var _0x1e8814=_0x90bb[_0x224fe7];return _0x1e8814;};'use strict';var Sequelize=require(_0xb90b('0x0'));module[_0xb90b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb90b('0x2')]}}; \ No newline at end of file +var _0x31f2=['STRING','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x31f2,0xbd));var _0x231f=function(_0x513c1e,_0x19bc8f){_0x513c1e=_0x513c1e-0x0;var _0x5a2598=_0x31f2[_0x513c1e];return _0x5a2598;};'use strict';var Sequelize=require('sequelize');module[_0x231f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x231f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d928840..f14b661 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 _0x578d=['save','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VtigerConfiguration','include','findAll','rows','catch','params','keys','filters','find','create','body','getFields','findOne','VtigerField','hasOwnProperty','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject'];(function(_0x3d57b2,_0x295e11){var _0x27df6f=function(_0x58bc27){while(--_0x58bc27){_0x3d57b2['push'](_0x3d57b2['shift']());}};_0x27df6f(++_0x295e11);}(_0x578d,0x118));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd578('0x0'));var jsonpatch=require(_0xd578('0x1'));var rp=require(_0xd578('0x2'));var moment=require(_0xd578('0x3'));var BPromise=require(_0xd578('0x4'));var Mustache=require(_0xd578('0x5'));var util=require('util');var path=require(_0xd578('0x6'));var sox=require(_0xd578('0x7'));var csv=require(_0xd578('0x8'));var ejs=require(_0xd578('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd578('0xa'));var squel=require('squel');var crypto=require(_0xd578('0xb'));var jsforce=require(_0xd578('0xc'));var deskjs=require(_0xd578('0xd'));var toCsv=require(_0xd578('0x8'));var querystring=require(_0xd578('0xe'));var Papa=require(_0xd578('0xf'));var Redis=require(_0xd578('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd578('0x11'));var as=require(_0xd578('0x12'));var hardwareService=require(_0xd578('0x13'));var logger=require(_0xd578('0x14'))(_0xd578('0x15'));var utils=require('../../config/utils');var config=require(_0xd578('0x16'));var licenseUtil=require(_0xd578('0x17'));var db=require(_0xd578('0x18'))['db'];function respondWithStatusCode(_0x6bc571,_0xaeef3a){_0xaeef3a=_0xaeef3a||0xcc;return function(_0x1832ea){if(_0x1832ea){return _0x6bc571['sendStatus'](_0xaeef3a);}return _0x6bc571[_0xd578('0x19')](_0xaeef3a)['end']();};}function respondWithResult(_0x47806e,_0x4f6c37){_0x4f6c37=_0x4f6c37||0xc8;return function(_0xbf3f70){if(_0xbf3f70){return _0x47806e[_0xd578('0x19')](_0x4f6c37)[_0xd578('0x1a')](_0xbf3f70);}};}function respondWithFilteredResult(_0x28bef6,_0x6d5f3a){return function(_0x144d69){if(_0x144d69){var _0x1aa369=typeof _0x6d5f3a[_0xd578('0x1b')]===_0xd578('0x1c')&&typeof _0x6d5f3a[_0xd578('0x1d')]===_0xd578('0x1c');var _0x5794cd=_0x144d69['count'];var _0x59eb2c=_0x1aa369?0x0:_0x6d5f3a[_0xd578('0x1b')];var _0x31ceff=_0x1aa369?_0x144d69[_0xd578('0x1e')]:_0x6d5f3a['offset']+_0x6d5f3a[_0xd578('0x1d')];var _0x5f13c2;if(_0x31ceff>=_0x5794cd){_0x31ceff=_0x5794cd;_0x5f13c2=0xc8;}else{_0x5f13c2=0xce;}_0x28bef6['status'](_0x5f13c2);return _0x28bef6['set']('Content-Range',_0x59eb2c+'-'+_0x31ceff+'/'+_0x5794cd)[_0xd578('0x1a')](_0x144d69);}return null;};}function patchUpdates(_0x328da7){return function(_0x1dc063){try{jsonpatch['apply'](_0x1dc063,_0x328da7,!![]);}catch(_0x16f088){return BPromise[_0xd578('0x1f')](_0x16f088);}return _0x1dc063[_0xd578('0x20')]();};}function saveUpdates(_0x47c66b,_0x247f70){return function(_0x665eea){if(_0x665eea){return _0x665eea[_0xd578('0x21')](_0x47c66b)[_0xd578('0x22')](function(_0x45e76f){return _0x45e76f;});}return null;};}function removeEntity(_0x41da75,_0x213fcc){return function(_0x244475){if(_0x244475){return _0x244475[_0xd578('0x23')]()[_0xd578('0x22')](function(){_0x41da75[_0xd578('0x19')](0xcc)[_0xd578('0x24')]();});}};}function handleEntityNotFound(_0x4f9938,_0x5f4ef0){return function(_0x4e0ad2){if(!_0x4e0ad2){_0x4f9938[_0xd578('0x25')](0x194);}return _0x4e0ad2;};}function handleError(_0x58877b,_0x4f2d8e){_0x4f2d8e=_0x4f2d8e||0x1f4;return function(_0x27c7ac){logger[_0xd578('0x26')](_0x27c7ac[_0xd578('0x27')]);if(_0x27c7ac[_0xd578('0x28')]){delete _0x27c7ac[_0xd578('0x28')];}_0x58877b[_0xd578('0x19')](_0x4f2d8e)[_0xd578('0x29')](_0x27c7ac);};}exports['index']=function(_0x56cd93,_0x4bc22f){var _0x47db51={},_0x597ed8={},_0x50d12a={'count':0x0,'rows':[]};var _0x2bae32=_[_0xd578('0x2a')](db['VtigerConfiguration'][_0xd578('0x2b')],function(_0x5af898){return{'name':_0x5af898[_0xd578('0x2c')],'type':_0x5af898['type'][_0xd578('0x2d')]};});_0x597ed8[_0xd578('0x2e')]=_[_0xd578('0x2a')](_0x2bae32,_0xd578('0x28'));_0x597ed8['query']=_['keys'](_0x56cd93[_0xd578('0x2f')]);_0x597ed8['filters']=_['intersection'](_0x597ed8[_0xd578('0x2e')],_0x597ed8[_0xd578('0x2f')]);_0x47db51[_0xd578('0x30')]=_[_0xd578('0x31')](_0x597ed8['model'],qs['fields'](_0x56cd93[_0xd578('0x2f')][_0xd578('0x32')]));_0x47db51[_0xd578('0x30')]=_0x47db51[_0xd578('0x30')][_0xd578('0x33')]?_0x47db51[_0xd578('0x30')]:_0x597ed8['model'];if(!_0x56cd93[_0xd578('0x2f')]['hasOwnProperty'](_0xd578('0x34'))){_0x47db51[_0xd578('0x1d')]=qs[_0xd578('0x1d')](_0x56cd93['query'][_0xd578('0x1d')]);_0x47db51[_0xd578('0x1b')]=qs['offset'](_0x56cd93['query'][_0xd578('0x1b')]);}_0x47db51[_0xd578('0x35')]=qs[_0xd578('0x36')](_0x56cd93[_0xd578('0x2f')][_0xd578('0x36')]);_0x47db51[_0xd578('0x37')]=qs['filters'](_[_0xd578('0x38')](_0x56cd93['query'],_0x597ed8['filters']),_0x2bae32);if(_0x56cd93[_0xd578('0x2f')][_0xd578('0x39')]){_0x47db51[_0xd578('0x37')]=_['merge'](_0x47db51['where'],{'$or':_[_0xd578('0x2a')](_0x2bae32,function(_0x1fd9a3){if(_0x1fd9a3[_0xd578('0x3a')]!==_0xd578('0x3b')){var _0x7851e2={};_0x7851e2[_0x1fd9a3['name']]={'$like':'%'+_0x56cd93[_0xd578('0x2f')][_0xd578('0x39')]+'%'};return _0x7851e2;}})});}_0x47db51=_[_0xd578('0x3c')]({},_0x47db51,_0x56cd93[_0xd578('0x3d')]);var _0x79023b={'where':_0x47db51[_0xd578('0x37')]};return db[_0xd578('0x3e')][_0xd578('0x1e')](_0x79023b)['then'](function(_0xd2d503){_0x50d12a[_0xd578('0x1e')]=_0xd2d503;if(_0x56cd93[_0xd578('0x2f')]['includeAll']){_0x47db51[_0xd578('0x3f')]=[{'all':!![]}];}return db[_0xd578('0x3e')][_0xd578('0x40')](_0x47db51);})['then'](function(_0x5c0eb4){_0x50d12a[_0xd578('0x41')]=_0x5c0eb4;return _0x50d12a;})[_0xd578('0x22')](respondWithFilteredResult(_0x4bc22f,_0x47db51))[_0xd578('0x42')](handleError(_0x4bc22f,null));};exports['show']=function(_0x362983,_0x5e8391){var _0x43da26={'raw':![],'where':{'id':_0x362983[_0xd578('0x43')]['id']}},_0x31a94a={};_0x31a94a[_0xd578('0x2e')]=_['keys'](db[_0xd578('0x3e')]['rawAttributes']);_0x31a94a[_0xd578('0x2f')]=_[_0xd578('0x44')](_0x362983['query']);_0x31a94a[_0xd578('0x45')]=_[_0xd578('0x31')](_0x31a94a[_0xd578('0x2e')],_0x31a94a[_0xd578('0x2f')]);_0x43da26[_0xd578('0x30')]=_[_0xd578('0x31')](_0x31a94a[_0xd578('0x2e')],qs[_0xd578('0x32')](_0x362983['query'][_0xd578('0x32')]));_0x43da26[_0xd578('0x30')]=_0x43da26['attributes'][_0xd578('0x33')]?_0x43da26['attributes']:_0x31a94a[_0xd578('0x2e')];if(_0x362983[_0xd578('0x2f')]['includeAll']){_0x43da26[_0xd578('0x3f')]=[{'all':!![]}];}_0x43da26=_['merge']({},_0x43da26,_0x362983[_0xd578('0x3d')]);return db[_0xd578('0x3e')][_0xd578('0x46')](_0x43da26)[_0xd578('0x22')](handleEntityNotFound(_0x5e8391,null))[_0xd578('0x22')](respondWithResult(_0x5e8391,null))['catch'](handleError(_0x5e8391,null));};exports[_0xd578('0x47')]=function(_0xaf5ba5,_0x185aab){return db[_0xd578('0x3e')][_0xd578('0x47')](_0xaf5ba5[_0xd578('0x48')],{})['then'](respondWithResult(_0x185aab,0xc9))[_0xd578('0x42')](handleError(_0x185aab,null));};exports[_0xd578('0x21')]=function(_0x345575,_0x517a22){if(_0x345575[_0xd578('0x48')]['id']){delete _0x345575[_0xd578('0x48')]['id'];}return db[_0xd578('0x3e')]['find']({'where':{'id':_0x345575['params']['id']}})['then'](handleEntityNotFound(_0x517a22,null))[_0xd578('0x22')](saveUpdates(_0x345575[_0xd578('0x48')],null))[_0xd578('0x22')](respondWithResult(_0x517a22,null))[_0xd578('0x42')](handleError(_0x517a22,null));};exports[_0xd578('0x23')]=function(_0x320edd,_0x434ed0){return db[_0xd578('0x3e')][_0xd578('0x46')]({'where':{'id':_0x320edd[_0xd578('0x43')]['id']}})[_0xd578('0x22')](handleEntityNotFound(_0x434ed0,null))[_0xd578('0x22')](removeEntity(_0x434ed0,null))[_0xd578('0x42')](handleError(_0x434ed0,null));};exports[_0xd578('0x49')]=function(_0x4626b2,_0x463a28,_0x1264cc){var _0x33d14e={};var _0x1df69b={};var _0x1f4c28;var _0x48daef;return db[_0xd578('0x3e')][_0xd578('0x4a')]({'where':{'id':_0x4626b2[_0xd578('0x43')]['id']}})[_0xd578('0x22')](handleEntityNotFound(_0x463a28,null))[_0xd578('0x22')](function(_0x1cd44b){if(_0x1cd44b){_0x1f4c28=_0x1cd44b;_0x1df69b[_0xd578('0x2e')]=_['keys'](db[_0xd578('0x4b')]['rawAttributes']);_0x1df69b['query']=_[_0xd578('0x44')](_0x4626b2[_0xd578('0x2f')]);_0x1df69b['filters']=_[_0xd578('0x31')](_0x1df69b[_0xd578('0x2e')],_0x1df69b['query']);_0x33d14e[_0xd578('0x30')]=_[_0xd578('0x31')](_0x1df69b['model'],qs[_0xd578('0x32')](_0x4626b2[_0xd578('0x2f')]['fields']));_0x33d14e[_0xd578('0x30')]=_0x33d14e['attributes'][_0xd578('0x33')]?_0x33d14e[_0xd578('0x30')]:_0x1df69b[_0xd578('0x2e')];_0x33d14e['order']=qs[_0xd578('0x36')](_0x4626b2[_0xd578('0x2f')]['sort']);_0x33d14e[_0xd578('0x37')]=qs['filters'](_[_0xd578('0x38')](_0x4626b2['query'],_0x1df69b[_0xd578('0x45')]));if(_0x4626b2[_0xd578('0x2f')]['filter']){_0x33d14e['where']=_[_0xd578('0x3c')](_0x33d14e[_0xd578('0x37')],{'$or':_[_0xd578('0x2a')](_0x33d14e[_0xd578('0x30')],function(_0x180a50){var _0x5302ad={};_0x5302ad[_0x180a50]={'$like':'%'+_0x4626b2[_0xd578('0x2f')][_0xd578('0x39')]+'%'};return _0x5302ad;})});}_0x33d14e=_['merge']({},_0x33d14e,_0x4626b2[_0xd578('0x3d')]);return _0x1f4c28['getFields'](_0x33d14e);}})['then'](function(_0x10e5c3){if(_0x10e5c3){_0x48daef=_0x10e5c3[_0xd578('0x33')];if(!_0x4626b2[_0xd578('0x2f')][_0xd578('0x4c')]('nolimit')){_0x33d14e[_0xd578('0x1d')]=qs[_0xd578('0x1d')](_0x4626b2[_0xd578('0x2f')]['limit']);_0x33d14e['offset']=qs[_0xd578('0x1b')](_0x4626b2[_0xd578('0x2f')][_0xd578('0x1b')]);}return _0x1f4c28[_0xd578('0x49')](_0x33d14e);}})[_0xd578('0x22')](function(_0x6db1a9){if(_0x6db1a9){return _0x6db1a9?{'count':_0x48daef,'rows':_0x6db1a9}:null;}})['then'](respondWithResult(_0x463a28,null))[_0xd578('0x42')](handleError(_0x463a28,null));};exports['getSubjects']=function(_0x4cf3df,_0x313913,_0x4e5472){var _0x4f47f6={};var _0xe7ed5f={};var _0x574d81;var _0x46f522;return db[_0xd578('0x3e')][_0xd578('0x4a')]({'where':{'id':_0x4cf3df['params']['id']}})[_0xd578('0x22')](handleEntityNotFound(_0x313913,null))['then'](function(_0x21887f){if(_0x21887f){_0x574d81=_0x21887f;_0xe7ed5f[_0xd578('0x2e')]=_[_0xd578('0x44')](db[_0xd578('0x4b')]['rawAttributes']);_0xe7ed5f[_0xd578('0x2f')]=_[_0xd578('0x44')](_0x4cf3df[_0xd578('0x2f')]);_0xe7ed5f['filters']=_[_0xd578('0x31')](_0xe7ed5f[_0xd578('0x2e')],_0xe7ed5f[_0xd578('0x2f')]);_0x4f47f6[_0xd578('0x30')]=_['intersection'](_0xe7ed5f[_0xd578('0x2e')],qs[_0xd578('0x32')](_0x4cf3df[_0xd578('0x2f')][_0xd578('0x32')]));_0x4f47f6['attributes']=_0x4f47f6[_0xd578('0x30')][_0xd578('0x33')]?_0x4f47f6[_0xd578('0x30')]:_0xe7ed5f[_0xd578('0x2e')];_0x4f47f6['order']=qs[_0xd578('0x36')](_0x4cf3df['query'][_0xd578('0x36')]);_0x4f47f6['where']=qs[_0xd578('0x45')](_[_0xd578('0x38')](_0x4cf3df[_0xd578('0x2f')],_0xe7ed5f[_0xd578('0x45')]));if(_0x4cf3df['query'][_0xd578('0x39')]){_0x4f47f6[_0xd578('0x37')]=_[_0xd578('0x3c')](_0x4f47f6[_0xd578('0x37')],{'$or':_[_0xd578('0x2a')](_0x4f47f6['attributes'],function(_0x1f51cf){var _0x392a9b={};_0x392a9b[_0x1f51cf]={'$like':'%'+_0x4cf3df[_0xd578('0x2f')][_0xd578('0x39')]+'%'};return _0x392a9b;})});}_0x4f47f6=_[_0xd578('0x3c')]({},_0x4f47f6,_0x4cf3df[_0xd578('0x3d')]);return _0x574d81['getSubjects'](_0x4f47f6);}})[_0xd578('0x22')](function(_0x53ea73){if(_0x53ea73){_0x46f522=_0x53ea73[_0xd578('0x33')];if(!_0x4cf3df['query'][_0xd578('0x4c')](_0xd578('0x34'))){_0x4f47f6[_0xd578('0x1d')]=qs['limit'](_0x4cf3df[_0xd578('0x2f')][_0xd578('0x1d')]);_0x4f47f6[_0xd578('0x1b')]=qs[_0xd578('0x1b')](_0x4cf3df[_0xd578('0x2f')][_0xd578('0x1b')]);}return _0x574d81['getSubjects'](_0x4f47f6);}})[_0xd578('0x22')](function(_0x59e447){if(_0x59e447){return _0x59e447?{'count':_0x46f522,'rows':_0x59e447}:null;}})[_0xd578('0x22')](respondWithResult(_0x313913,null))['catch'](handleError(_0x313913,null));};exports[_0xd578('0x4d')]=function(_0x35ec0c,_0x7ae43,_0x290108){var _0x5ddd5d={};var _0x43d38c={};var _0x2ec5bc;var _0x18d7a8;return db['VtigerConfiguration'][_0xd578('0x4a')]({'where':{'id':_0x35ec0c[_0xd578('0x43')]['id']}})[_0xd578('0x22')](handleEntityNotFound(_0x7ae43,null))['then'](function(_0x1ef3da){if(_0x1ef3da){_0x2ec5bc=_0x1ef3da;_0x43d38c['model']=_[_0xd578('0x44')](db[_0xd578('0x4b')][_0xd578('0x2b')]);_0x43d38c[_0xd578('0x2f')]=_[_0xd578('0x44')](_0x35ec0c[_0xd578('0x2f')]);_0x43d38c['filters']=_[_0xd578('0x31')](_0x43d38c[_0xd578('0x2e')],_0x43d38c[_0xd578('0x2f')]);_0x5ddd5d[_0xd578('0x30')]=_[_0xd578('0x31')](_0x43d38c[_0xd578('0x2e')],qs[_0xd578('0x32')](_0x35ec0c[_0xd578('0x2f')]['fields']));_0x5ddd5d[_0xd578('0x30')]=_0x5ddd5d['attributes']['length']?_0x5ddd5d[_0xd578('0x30')]:_0x43d38c[_0xd578('0x2e')];_0x5ddd5d[_0xd578('0x35')]=qs['sort'](_0x35ec0c[_0xd578('0x2f')][_0xd578('0x36')]);_0x5ddd5d[_0xd578('0x37')]=qs[_0xd578('0x45')](_['pick'](_0x35ec0c['query'],_0x43d38c[_0xd578('0x45')]));if(_0x35ec0c[_0xd578('0x2f')][_0xd578('0x39')]){_0x5ddd5d['where']=_[_0xd578('0x3c')](_0x5ddd5d[_0xd578('0x37')],{'$or':_[_0xd578('0x2a')](_0x5ddd5d[_0xd578('0x30')],function(_0x2efbd6){var _0x171a11={};_0x171a11[_0x2efbd6]={'$like':'%'+_0x35ec0c[_0xd578('0x2f')][_0xd578('0x39')]+'%'};return _0x171a11;})});}_0x5ddd5d=_[_0xd578('0x3c')]({},_0x5ddd5d,_0x35ec0c[_0xd578('0x3d')]);return _0x2ec5bc['getDescriptions'](_0x5ddd5d);}})[_0xd578('0x22')](function(_0x314cd4){if(_0x314cd4){_0x18d7a8=_0x314cd4[_0xd578('0x33')];if(!_0x35ec0c['query'][_0xd578('0x4c')](_0xd578('0x34'))){_0x5ddd5d[_0xd578('0x1d')]=qs[_0xd578('0x1d')](_0x35ec0c[_0xd578('0x2f')][_0xd578('0x1d')]);_0x5ddd5d[_0xd578('0x1b')]=qs[_0xd578('0x1b')](_0x35ec0c[_0xd578('0x2f')][_0xd578('0x1b')]);}return _0x2ec5bc[_0xd578('0x4d')](_0x5ddd5d);}})['then'](function(_0x2cabbc){if(_0x2cabbc){return _0x2cabbc?{'count':_0x18d7a8,'rows':_0x2cabbc}:null;}})[_0xd578('0x22')](respondWithResult(_0x7ae43,null))[_0xd578('0x42')](handleError(_0x7ae43,null));}; \ No newline at end of file +var _0x50c1=['where','filters','pick','filter','merge','VIRTUAL','VtigerConfiguration','findAll','rows','show','params','rawAttributes','includeAll','include','options','catch','create','body','find','getFields','VtigerField','nolimit','findOne','order','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort'];(function(_0x2fef36,_0x2d9657){var _0x36cb38=function(_0xe2d130){while(--_0xe2d130){_0x2fef36['push'](_0x2fef36['shift']());}};_0x36cb38(++_0x2d9657);}(_0x50c1,0x1a5));var _0x150c=function(_0x15d368,_0x28acc5){_0x15d368=_0x15d368-0x0;var _0x4b3a43=_0x50c1[_0x15d368];return _0x4b3a43;};'use strict';var emlformat=require(_0x150c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x150c('0x1'));var rp=require(_0x150c('0x2'));var moment=require(_0x150c('0x3'));var BPromise=require(_0x150c('0x4'));var Mustache=require(_0x150c('0x5'));var util=require(_0x150c('0x6'));var path=require(_0x150c('0x7'));var sox=require(_0x150c('0x8'));var csv=require(_0x150c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x150c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x150c('0xb'));var deskjs=require(_0x150c('0xc'));var toCsv=require(_0x150c('0x9'));var querystring=require(_0x150c('0xd'));var Papa=require(_0x150c('0xe'));var Redis=require(_0x150c('0xf'));var authService=require(_0x150c('0x10'));var qs=require(_0x150c('0x11'));var as=require(_0x150c('0x12'));var hardwareService=require(_0x150c('0x13'));var logger=require('../../config/logger')(_0x150c('0x14'));var utils=require(_0x150c('0x15'));var config=require(_0x150c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x150c('0x17'))['db'];function respondWithStatusCode(_0x4e2f73,_0x4c513d){_0x4c513d=_0x4c513d||0xcc;return function(_0x2c9a8a){if(_0x2c9a8a){return _0x4e2f73[_0x150c('0x18')](_0x4c513d);}return _0x4e2f73[_0x150c('0x19')](_0x4c513d)[_0x150c('0x1a')]();};}function respondWithResult(_0x293b98,_0x17205c){_0x17205c=_0x17205c||0xc8;return function(_0x333600){if(_0x333600){return _0x293b98[_0x150c('0x19')](_0x17205c)[_0x150c('0x1b')](_0x333600);}};}function respondWithFilteredResult(_0x3c6772,_0x11bc9e){return function(_0x2c0626){if(_0x2c0626){var _0x5c657f=typeof _0x11bc9e[_0x150c('0x1c')]==='undefined'&&typeof _0x11bc9e[_0x150c('0x1d')]==='undefined';var _0x59ae9e=_0x2c0626[_0x150c('0x1e')];var _0x40c0d0=_0x5c657f?0x0:_0x11bc9e[_0x150c('0x1c')];var _0x3c5a84=_0x5c657f?_0x2c0626['count']:_0x11bc9e[_0x150c('0x1c')]+_0x11bc9e[_0x150c('0x1d')];var _0x9a9d64;if(_0x3c5a84>=_0x59ae9e){_0x3c5a84=_0x59ae9e;_0x9a9d64=0xc8;}else{_0x9a9d64=0xce;}_0x3c6772[_0x150c('0x19')](_0x9a9d64);return _0x3c6772[_0x150c('0x1f')](_0x150c('0x20'),_0x40c0d0+'-'+_0x3c5a84+'/'+_0x59ae9e)['json'](_0x2c0626);}return null;};}function patchUpdates(_0x220c15){return function(_0x365de8){try{jsonpatch['apply'](_0x365de8,_0x220c15,!![]);}catch(_0x12e158){return BPromise['reject'](_0x12e158);}return _0x365de8[_0x150c('0x21')]();};}function saveUpdates(_0x25503b,_0x29a2f){return function(_0x1c41f4){if(_0x1c41f4){return _0x1c41f4[_0x150c('0x22')](_0x25503b)['then'](function(_0x68b03b){return _0x68b03b;});}return null;};}function removeEntity(_0x3f9044,_0x332173){return function(_0x188536){if(_0x188536){return _0x188536[_0x150c('0x23')]()[_0x150c('0x24')](function(){_0x3f9044[_0x150c('0x19')](0xcc)[_0x150c('0x1a')]();});}};}function handleEntityNotFound(_0x3b1ce6,_0x54d11c){return function(_0x54b8dd){if(!_0x54b8dd){_0x3b1ce6[_0x150c('0x18')](0x194);}return _0x54b8dd;};}function handleError(_0x27aba8,_0x29a87c){_0x29a87c=_0x29a87c||0x1f4;return function(_0x5daf46){logger['error'](_0x5daf46[_0x150c('0x25')]);if(_0x5daf46[_0x150c('0x26')]){delete _0x5daf46[_0x150c('0x26')];}_0x27aba8[_0x150c('0x19')](_0x29a87c)[_0x150c('0x27')](_0x5daf46);};}exports[_0x150c('0x28')]=function(_0x420628,_0x522c2e){var _0x4b345f={},_0xbf4922={},_0x4021ea={'count':0x0,'rows':[]};var _0x3234ea=_[_0x150c('0x29')](db['VtigerConfiguration']['rawAttributes'],function(_0x3acbc8){return{'name':_0x3acbc8[_0x150c('0x2a')],'type':_0x3acbc8[_0x150c('0x2b')]['key']};});_0xbf4922[_0x150c('0x2c')]=_['map'](_0x3234ea,_0x150c('0x26'));_0xbf4922[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x420628['query']);_0xbf4922['filters']=_[_0x150c('0x2f')](_0xbf4922['model'],_0xbf4922[_0x150c('0x2d')]);_0x4b345f[_0x150c('0x30')]=_[_0x150c('0x2f')](_0xbf4922[_0x150c('0x2c')],qs[_0x150c('0x31')](_0x420628[_0x150c('0x2d')][_0x150c('0x31')]));_0x4b345f['attributes']=_0x4b345f[_0x150c('0x30')][_0x150c('0x32')]?_0x4b345f['attributes']:_0xbf4922[_0x150c('0x2c')];if(!_0x420628[_0x150c('0x2d')][_0x150c('0x33')]('nolimit')){_0x4b345f[_0x150c('0x1d')]=qs[_0x150c('0x1d')](_0x420628[_0x150c('0x2d')]['limit']);_0x4b345f[_0x150c('0x1c')]=qs['offset'](_0x420628['query'][_0x150c('0x1c')]);}_0x4b345f['order']=qs['sort'](_0x420628[_0x150c('0x2d')][_0x150c('0x34')]);_0x4b345f[_0x150c('0x35')]=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0x420628[_0x150c('0x2d')],_0xbf4922[_0x150c('0x36')]),_0x3234ea);if(_0x420628['query'][_0x150c('0x38')]){_0x4b345f[_0x150c('0x35')]=_[_0x150c('0x39')](_0x4b345f['where'],{'$or':_[_0x150c('0x29')](_0x3234ea,function(_0x401f9c){if(_0x401f9c[_0x150c('0x2b')]!==_0x150c('0x3a')){var _0x36afad={};_0x36afad[_0x401f9c['name']]={'$like':'%'+_0x420628[_0x150c('0x2d')][_0x150c('0x38')]+'%'};return _0x36afad;}})});}_0x4b345f=_[_0x150c('0x39')]({},_0x4b345f,_0x420628['options']);var _0x172787={'where':_0x4b345f[_0x150c('0x35')]};return db[_0x150c('0x3b')][_0x150c('0x1e')](_0x172787)[_0x150c('0x24')](function(_0x534d75){_0x4021ea[_0x150c('0x1e')]=_0x534d75;if(_0x420628['query']['includeAll']){_0x4b345f['include']=[{'all':!![]}];}return db[_0x150c('0x3b')][_0x150c('0x3c')](_0x4b345f);})[_0x150c('0x24')](function(_0x4503d8){_0x4021ea[_0x150c('0x3d')]=_0x4503d8;return _0x4021ea;})[_0x150c('0x24')](respondWithFilteredResult(_0x522c2e,_0x4b345f))['catch'](handleError(_0x522c2e,null));};exports[_0x150c('0x3e')]=function(_0x5c897a,_0x36f85c){var _0x16bc55={'raw':![],'where':{'id':_0x5c897a[_0x150c('0x3f')]['id']}},_0x2a9ce4={};_0x2a9ce4[_0x150c('0x2c')]=_[_0x150c('0x2e')](db[_0x150c('0x3b')][_0x150c('0x40')]);_0x2a9ce4[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x5c897a['query']);_0x2a9ce4['filters']=_['intersection'](_0x2a9ce4['model'],_0x2a9ce4['query']);_0x16bc55[_0x150c('0x30')]=_[_0x150c('0x2f')](_0x2a9ce4[_0x150c('0x2c')],qs['fields'](_0x5c897a[_0x150c('0x2d')]['fields']));_0x16bc55[_0x150c('0x30')]=_0x16bc55[_0x150c('0x30')][_0x150c('0x32')]?_0x16bc55[_0x150c('0x30')]:_0x2a9ce4[_0x150c('0x2c')];if(_0x5c897a[_0x150c('0x2d')][_0x150c('0x41')]){_0x16bc55[_0x150c('0x42')]=[{'all':!![]}];}_0x16bc55=_[_0x150c('0x39')]({},_0x16bc55,_0x5c897a[_0x150c('0x43')]);return db[_0x150c('0x3b')]['find'](_0x16bc55)['then'](handleEntityNotFound(_0x36f85c,null))['then'](respondWithResult(_0x36f85c,null))[_0x150c('0x44')](handleError(_0x36f85c,null));};exports[_0x150c('0x45')]=function(_0xdd0bb,_0x68a748){return db[_0x150c('0x3b')][_0x150c('0x45')](_0xdd0bb[_0x150c('0x46')],{})[_0x150c('0x24')](respondWithResult(_0x68a748,0xc9))[_0x150c('0x44')](handleError(_0x68a748,null));};exports['update']=function(_0x61eaaf,_0x5e5c5d){if(_0x61eaaf[_0x150c('0x46')]['id']){delete _0x61eaaf['body']['id'];}return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x61eaaf[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x5e5c5d,null))['then'](saveUpdates(_0x61eaaf[_0x150c('0x46')],null))[_0x150c('0x24')](respondWithResult(_0x5e5c5d,null))[_0x150c('0x44')](handleError(_0x5e5c5d,null));};exports[_0x150c('0x23')]=function(_0x22f54d,_0x610f61){return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x22f54d[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x610f61,null))[_0x150c('0x24')](removeEntity(_0x610f61,null))[_0x150c('0x44')](handleError(_0x610f61,null));};exports[_0x150c('0x48')]=function(_0x5c9062,_0x5961a5,_0x537c3f){var _0x442c70={};var _0xfb37b6={};var _0x4ffad8;var _0x1dc8c1;return db[_0x150c('0x3b')]['findOne']({'where':{'id':_0x5c9062[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x5961a5,null))[_0x150c('0x24')](function(_0x55daa2){if(_0x55daa2){_0x4ffad8=_0x55daa2;_0xfb37b6[_0x150c('0x2c')]=_[_0x150c('0x2e')](db[_0x150c('0x49')][_0x150c('0x40')]);_0xfb37b6[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x5c9062[_0x150c('0x2d')]);_0xfb37b6[_0x150c('0x36')]=_[_0x150c('0x2f')](_0xfb37b6['model'],_0xfb37b6[_0x150c('0x2d')]);_0x442c70[_0x150c('0x30')]=_[_0x150c('0x2f')](_0xfb37b6[_0x150c('0x2c')],qs[_0x150c('0x31')](_0x5c9062[_0x150c('0x2d')][_0x150c('0x31')]));_0x442c70[_0x150c('0x30')]=_0x442c70[_0x150c('0x30')][_0x150c('0x32')]?_0x442c70[_0x150c('0x30')]:_0xfb37b6[_0x150c('0x2c')];_0x442c70['order']=qs[_0x150c('0x34')](_0x5c9062[_0x150c('0x2d')][_0x150c('0x34')]);_0x442c70['where']=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0x5c9062[_0x150c('0x2d')],_0xfb37b6['filters']));if(_0x5c9062[_0x150c('0x2d')][_0x150c('0x38')]){_0x442c70['where']=_[_0x150c('0x39')](_0x442c70[_0x150c('0x35')],{'$or':_['map'](_0x442c70[_0x150c('0x30')],function(_0x22357d){var _0x6d3511={};_0x6d3511[_0x22357d]={'$like':'%'+_0x5c9062[_0x150c('0x2d')][_0x150c('0x38')]+'%'};return _0x6d3511;})});}_0x442c70=_[_0x150c('0x39')]({},_0x442c70,_0x5c9062[_0x150c('0x43')]);return _0x4ffad8['getFields'](_0x442c70);}})[_0x150c('0x24')](function(_0x2dc489){if(_0x2dc489){_0x1dc8c1=_0x2dc489['length'];if(!_0x5c9062[_0x150c('0x2d')][_0x150c('0x33')](_0x150c('0x4a'))){_0x442c70[_0x150c('0x1d')]=qs[_0x150c('0x1d')](_0x5c9062[_0x150c('0x2d')][_0x150c('0x1d')]);_0x442c70['offset']=qs[_0x150c('0x1c')](_0x5c9062[_0x150c('0x2d')][_0x150c('0x1c')]);}return _0x4ffad8[_0x150c('0x48')](_0x442c70);}})[_0x150c('0x24')](function(_0x3ec441){if(_0x3ec441){return _0x3ec441?{'count':_0x1dc8c1,'rows':_0x3ec441}:null;}})[_0x150c('0x24')](respondWithResult(_0x5961a5,null))[_0x150c('0x44')](handleError(_0x5961a5,null));};exports['getSubjects']=function(_0x4541a0,_0x5836ff,_0x48ee37){var _0x3dd9f8={};var _0x3a8d4a={};var _0x1ba948;var _0x512488;return db['VtigerConfiguration'][_0x150c('0x4b')]({'where':{'id':_0x4541a0[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x5836ff,null))[_0x150c('0x24')](function(_0xbcd736){if(_0xbcd736){_0x1ba948=_0xbcd736;_0x3a8d4a[_0x150c('0x2c')]=_[_0x150c('0x2e')](db[_0x150c('0x49')][_0x150c('0x40')]);_0x3a8d4a[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x4541a0[_0x150c('0x2d')]);_0x3a8d4a['filters']=_[_0x150c('0x2f')](_0x3a8d4a[_0x150c('0x2c')],_0x3a8d4a['query']);_0x3dd9f8[_0x150c('0x30')]=_[_0x150c('0x2f')](_0x3a8d4a[_0x150c('0x2c')],qs[_0x150c('0x31')](_0x4541a0['query'][_0x150c('0x31')]));_0x3dd9f8[_0x150c('0x30')]=_0x3dd9f8[_0x150c('0x30')][_0x150c('0x32')]?_0x3dd9f8[_0x150c('0x30')]:_0x3a8d4a[_0x150c('0x2c')];_0x3dd9f8[_0x150c('0x4c')]=qs['sort'](_0x4541a0[_0x150c('0x2d')]['sort']);_0x3dd9f8[_0x150c('0x35')]=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0x4541a0[_0x150c('0x2d')],_0x3a8d4a[_0x150c('0x36')]));if(_0x4541a0['query'][_0x150c('0x38')]){_0x3dd9f8[_0x150c('0x35')]=_[_0x150c('0x39')](_0x3dd9f8[_0x150c('0x35')],{'$or':_[_0x150c('0x29')](_0x3dd9f8[_0x150c('0x30')],function(_0x534fbd){var _0x2c79ed={};_0x2c79ed[_0x534fbd]={'$like':'%'+_0x4541a0['query']['filter']+'%'};return _0x2c79ed;})});}_0x3dd9f8=_[_0x150c('0x39')]({},_0x3dd9f8,_0x4541a0[_0x150c('0x43')]);return _0x1ba948[_0x150c('0x4d')](_0x3dd9f8);}})[_0x150c('0x24')](function(_0x47deb6){if(_0x47deb6){_0x512488=_0x47deb6[_0x150c('0x32')];if(!_0x4541a0[_0x150c('0x2d')][_0x150c('0x33')](_0x150c('0x4a'))){_0x3dd9f8[_0x150c('0x1d')]=qs[_0x150c('0x1d')](_0x4541a0[_0x150c('0x2d')]['limit']);_0x3dd9f8['offset']=qs[_0x150c('0x1c')](_0x4541a0[_0x150c('0x2d')][_0x150c('0x1c')]);}return _0x1ba948['getSubjects'](_0x3dd9f8);}})[_0x150c('0x24')](function(_0x203bdc){if(_0x203bdc){return _0x203bdc?{'count':_0x512488,'rows':_0x203bdc}:null;}})['then'](respondWithResult(_0x5836ff,null))[_0x150c('0x44')](handleError(_0x5836ff,null));};exports[_0x150c('0x4e')]=function(_0xe069ca,_0x36a0e7,_0xfb44d1){var _0x490737={};var _0x62db14={};var _0x496f83;var _0x44aaef;return db[_0x150c('0x3b')][_0x150c('0x4b')]({'where':{'id':_0xe069ca[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x36a0e7,null))[_0x150c('0x24')](function(_0x1cbd6b){if(_0x1cbd6b){_0x496f83=_0x1cbd6b;_0x62db14['model']=_['keys'](db['VtigerField'][_0x150c('0x40')]);_0x62db14['query']=_[_0x150c('0x2e')](_0xe069ca[_0x150c('0x2d')]);_0x62db14['filters']=_[_0x150c('0x2f')](_0x62db14[_0x150c('0x2c')],_0x62db14[_0x150c('0x2d')]);_0x490737[_0x150c('0x30')]=_[_0x150c('0x2f')](_0x62db14['model'],qs['fields'](_0xe069ca[_0x150c('0x2d')][_0x150c('0x31')]));_0x490737[_0x150c('0x30')]=_0x490737[_0x150c('0x30')][_0x150c('0x32')]?_0x490737['attributes']:_0x62db14['model'];_0x490737[_0x150c('0x4c')]=qs['sort'](_0xe069ca[_0x150c('0x2d')][_0x150c('0x34')]);_0x490737[_0x150c('0x35')]=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0xe069ca[_0x150c('0x2d')],_0x62db14[_0x150c('0x36')]));if(_0xe069ca[_0x150c('0x2d')]['filter']){_0x490737[_0x150c('0x35')]=_['merge'](_0x490737[_0x150c('0x35')],{'$or':_[_0x150c('0x29')](_0x490737[_0x150c('0x30')],function(_0x324637){var _0x234727={};_0x234727[_0x324637]={'$like':'%'+_0xe069ca[_0x150c('0x2d')][_0x150c('0x38')]+'%'};return _0x234727;})});}_0x490737=_['merge']({},_0x490737,_0xe069ca[_0x150c('0x43')]);return _0x496f83['getDescriptions'](_0x490737);}})[_0x150c('0x24')](function(_0x3da31c){if(_0x3da31c){_0x44aaef=_0x3da31c[_0x150c('0x32')];if(!_0xe069ca[_0x150c('0x2d')][_0x150c('0x33')](_0x150c('0x4a'))){_0x490737[_0x150c('0x1d')]=qs['limit'](_0xe069ca[_0x150c('0x2d')][_0x150c('0x1d')]);_0x490737[_0x150c('0x1c')]=qs[_0x150c('0x1c')](_0xe069ca['query'][_0x150c('0x1c')]);}return _0x496f83[_0x150c('0x4e')](_0x490737);}})['then'](function(_0x3834fe){if(_0x3834fe){return _0x3834fe?{'count':_0x44aaef,'rows':_0x3834fe}:null;}})[_0x150c('0x24')](respondWithResult(_0x36a0e7,null))[_0x150c('0x44')](handleError(_0x36a0e7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 359a872..0200e97 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 _0x341b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x28d31d,_0x57a4e6){var _0x2df7c1=function(_0x52601d){while(--_0x52601d){_0x28d31d['push'](_0x28d31d['shift']());}};_0x2df7c1(++_0x57a4e6);}(_0x341b,0x187));var _0xb341=function(_0x2e7492,_0x5e244b){_0x2e7492=_0x2e7492-0x0;var _0x110433=_0x341b[_0x2e7492];return _0x110433;};'use strict';var _=require(_0xb341('0x0'));var util=require(_0xb341('0x1'));var logger=require(_0xb341('0x2'))(_0xb341('0x3'));var moment=require(_0xb341('0x4'));var BPromise=require(_0xb341('0x5'));var rp=require(_0xb341('0x6'));var fs=require('fs');var path=require(_0xb341('0x7'));var rimraf=require('rimraf');var config=require(_0xb341('0x8'));var attributes=require(_0xb341('0x9'));module[_0xb341('0xa')]=function(_0x5312d1,_0x316c9b){return _0x5312d1[_0xb341('0xb')](_0xb341('0xc'),attributes,{'tableName':_0xb341('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef10=['api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','util','../../config/logger'];(function(_0x1f3bfb,_0x2db1b1){var _0xb87807=function(_0x408d65){while(--_0x408d65){_0x1f3bfb['push'](_0x1f3bfb['shift']());}};_0xb87807(++_0x2db1b1);}(_0xef10,0x80));var _0x0ef1=function(_0xf11ab4,_0x486098){_0xf11ab4=_0xf11ab4-0x0;var _0x541acb=_0xef10[_0xf11ab4];return _0x541acb;};'use strict';var _=require('lodash');var util=require(_0x0ef1('0x0'));var logger=require(_0x0ef1('0x1'))(_0x0ef1('0x2'));var moment=require(_0x0ef1('0x3'));var BPromise=require(_0x0ef1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ef1('0x5'));var config=require(_0x0ef1('0x6'));var attributes=require(_0x0ef1('0x7'));module['exports']=function(_0x883789,_0x7bc32d){return _0x883789[_0x0ef1('0x8')](_0x0ef1('0x9'),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 e5804cc..33472c8 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 _0x7e30=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x7e30,0x122));var _0x07e3=function(_0x401560,_0x4e5953){_0x401560=_0x401560-0x0;var _0x12572c=_0x7e30[_0x401560];return _0x12572c;};'use strict';var _=require(_0x07e3('0x0'));var util=require(_0x07e3('0x1'));var moment=require('moment');var BPromise=require(_0x07e3('0x2'));var rs=require(_0x07e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07e3('0x4'))['db'];var utils=require(_0x07e3('0x5'));var logger=require('../../config/logger')(_0x07e3('0x6'));var config=require('../../config/environment');var jayson=require(_0x07e3('0x7'));var client=jayson[_0x07e3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf45c63,_0x5897c8,_0x5e1657){return new BPromise(function(_0xf1e2e6,_0x401dd2){return client[_0x07e3('0x9')](_0xf45c63,_0x5e1657)[_0x07e3('0xa')](function(_0x3b4b7d){logger[_0x07e3('0xb')](_0x07e3('0xc'),_0x5897c8,_0x07e3('0xd'));logger[_0x07e3('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5897c8,_0x07e3('0xd'),JSON[_0x07e3('0xf')](_0x3b4b7d));if(_0x3b4b7d[_0x07e3('0x10')]){if(_0x3b4b7d[_0x07e3('0x10')][_0x07e3('0x11')]===0x1f4){logger[_0x07e3('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5897c8,_0x3b4b7d[_0x07e3('0x10')][_0x07e3('0x12')]);return _0x401dd2(_0x3b4b7d['error'][_0x07e3('0x12')]);}logger[_0x07e3('0x10')](_0x07e3('0xc'),_0x5897c8,_0x3b4b7d[_0x07e3('0x10')][_0x07e3('0x12')]);return _0xf1e2e6(_0x3b4b7d[_0x07e3('0x10')][_0x07e3('0x12')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x5897c8,_0x07e3('0xd'));_0xf1e2e6(_0x3b4b7d['result'][_0x07e3('0x12')]);}})[_0x07e3('0x13')](function(_0xc99703){logger['error'](_0x07e3('0xc'),_0x5897c8,_0xc99703);_0x401dd2(_0xc99703);});});} \ No newline at end of file +var _0x9657=['error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d4f52,_0x5f0f72){var _0x33b491=function(_0x59d4ae){while(--_0x59d4ae){_0x4d4f52['push'](_0x4d4f52['shift']());}};_0x33b491(++_0x5f0f72);}(_0x9657,0x119));var _0x7965=function(_0x387779,_0x5756e8){_0x387779=_0x387779-0x0;var _0x14f4ba=_0x9657[_0x387779];return _0x14f4ba;};'use strict';var _=require('lodash');var util=require(_0x7965('0x0'));var moment=require(_0x7965('0x1'));var BPromise=require(_0x7965('0x2'));var rs=require(_0x7965('0x3'));var fs=require('fs');var Redis=require(_0x7965('0x4'));var db=require(_0x7965('0x5'))['db'];var utils=require(_0x7965('0x6'));var logger=require(_0x7965('0x7'))(_0x7965('0x8'));var config=require(_0x7965('0x9'));var jayson=require(_0x7965('0xa'));var client=jayson[_0x7965('0xb')][_0x7965('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x420265,_0x3e387e,_0x4cdcba){return new BPromise(function(_0x4ccc8e,_0x3913cb){return client[_0x7965('0xd')](_0x420265,_0x4cdcba)[_0x7965('0xe')](function(_0x2a4d5f){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x3e387e,_0x7965('0xf'));logger[_0x7965('0x10')](_0x7965('0x11'),_0x3e387e,'request\x20sent',JSON[_0x7965('0x12')](_0x2a4d5f));if(_0x2a4d5f[_0x7965('0x13')]){if(_0x2a4d5f[_0x7965('0x13')]['code']===0x1f4){logger['error'](_0x7965('0x14'),_0x3e387e,_0x2a4d5f['error'][_0x7965('0x15')]);return _0x3913cb(_0x2a4d5f[_0x7965('0x13')][_0x7965('0x15')]);}logger['error'](_0x7965('0x14'),_0x3e387e,_0x2a4d5f[_0x7965('0x13')][_0x7965('0x15')]);return _0x4ccc8e(_0x2a4d5f[_0x7965('0x13')][_0x7965('0x15')]);}else{logger[_0x7965('0x16')](_0x7965('0x14'),_0x3e387e,_0x7965('0xf'));_0x4ccc8e(_0x2a4d5f[_0x7965('0x17')][_0x7965('0x15')]);}})[_0x7965('0x18')](function(_0x524589){logger[_0x7965('0x13')](_0x7965('0x14'),_0x3e387e,_0x524589);_0x3913cb(_0x524589);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a572f41..6b4280e 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 _0xad5a=['delete','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','show','post','create','update'];(function(_0x1e8df8,_0x301541){var _0x5831a0=function(_0x358174){while(--_0x358174){_0x1e8df8['push'](_0x1e8df8['shift']());}};_0x5831a0(++_0x301541);}(_0xad5a,0x1ea));var _0xaad5=function(_0x36b2a3,_0x44a38a){_0x36b2a3=_0x36b2a3-0x0;var _0x1de476=_0xad5a[_0x36b2a3];return _0x1de476;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaad5('0x0'));var timeout=require(_0xaad5('0x1'));var express=require('express');var router=express[_0xaad5('0x2')]();var fs_extra=require(_0xaad5('0x3'));var auth=require(_0xaad5('0x4'));var interaction=require(_0xaad5('0x5'));var config=require(_0xaad5('0x6'));var controller=require(_0xaad5('0x7'));router['get']('/',auth[_0xaad5('0x8')](),controller[_0xaad5('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaad5('0xa')]);router[_0xaad5('0xb')]('/',auth[_0xaad5('0x8')](),controller[_0xaad5('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaad5('0xd')]);router[_0xaad5('0xe')](_0xaad5('0xf'),auth['isAuthenticated'](),controller[_0xaad5('0x10')]);module[_0xaad5('0x11')]=router; \ No newline at end of file +var _0x0062=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x472581,_0x2142de){var _0xac2666=function(_0x426bf1){while(--_0x426bf1){_0x472581['push'](_0x472581['shift']());}};_0xac2666(++_0x2142de);}(_0x0062,0xe5));var _0x2006=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x0062[_0x26b5ff];return _0x58603e;};'use strict';var multer=require(_0x2006('0x0'));var util=require(_0x2006('0x1'));var path=require(_0x2006('0x2'));var timeout=require(_0x2006('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2006('0x4'));var auth=require(_0x2006('0x5'));var interaction=require(_0x2006('0x6'));var config=require(_0x2006('0x7'));var controller=require(_0x2006('0x8'));router[_0x2006('0x9')]('/',auth[_0x2006('0xa')](),controller[_0x2006('0xb')]);router[_0x2006('0x9')](_0x2006('0xc'),auth[_0x2006('0xa')](),controller['show']);router[_0x2006('0xd')]('/',auth[_0x2006('0xa')](),controller[_0x2006('0xe')]);router['put']('/:id',auth[_0x2006('0xa')](),controller[_0x2006('0xf')]);router['delete'](_0x2006('0xc'),auth['isAuthenticated'](),controller[_0x2006('0x10')]);module[_0x2006('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 521282a..7f4390e 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 _0x0b33=['keyValue','picklist','STRING','ENUM','string','BOOLEAN','exports'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x0b33,0x7d));var _0x30b3=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0x0b33[_0x4db46b];return _0x565be8;};'use strict';var Sequelize=require('sequelize');module[_0x30b3('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0x30b3('0x1'),_0x30b3('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x30b3('0x3')]},'key':{'type':Sequelize[_0x30b3('0x3')]},'keyType':{'type':Sequelize[_0x30b3('0x4')](_0x30b3('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x30b3('0x3')]},'idField':{'type':Sequelize[_0x30b3('0x3')]},'nameField':{'type':Sequelize[_0x30b3('0x3')]},'customField':{'type':Sequelize[_0x30b3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x661b=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x661b,0x16e));var _0xb661=function(_0x5e9ed0,_0x2a0c0f){_0x5e9ed0=_0x5e9ed0-0x0;var _0x379521=_0x661b[_0x5e9ed0];return _0x379521;};'use strict';var Sequelize=require(_0xb661('0x0'));module[_0xb661('0x1')]={'type':{'type':Sequelize[_0xb661('0x2')](_0xb661('0x3'),_0xb661('0x4'),_0xb661('0x5'),_0xb661('0x6'),_0xb661('0x7')),'defaultValue':_0xb661('0x3')},'content':{'type':Sequelize[_0xb661('0x8')]},'key':{'type':Sequelize[_0xb661('0x8')]},'keyType':{'type':Sequelize[_0xb661('0x2')](_0xb661('0x3'),'variable',_0xb661('0x5'))},'keyContent':{'type':Sequelize[_0xb661('0x8')]},'idField':{'type':Sequelize[_0xb661('0x8')]},'nameField':{'type':Sequelize[_0xb661('0x8')]},'customField':{'type':Sequelize[_0xb661('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b31c190..76b5f40 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 _0x9523=['includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x212fe4,_0xd5dcea){var _0x665a11=function(_0x35da89){while(--_0x35da89){_0x212fe4['push'](_0x212fe4['shift']());}};_0x665a11(++_0xd5dcea);}(_0x9523,0x184));var _0x3952=function(_0x54f57a,_0x4f08fb){_0x54f57a=_0x54f57a-0x0;var _0x175896=_0x9523[_0x54f57a];return _0x175896;};'use strict';var emlformat=require(_0x3952('0x0'));var rimraf=require(_0x3952('0x1'));var zipdir=require(_0x3952('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3952('0x3'));var moment=require(_0x3952('0x4'));var BPromise=require(_0x3952('0x5'));var Mustache=require(_0x3952('0x6'));var util=require(_0x3952('0x7'));var path=require(_0x3952('0x8'));var sox=require(_0x3952('0x9'));var csv=require(_0x3952('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3952('0xb'));var _=require(_0x3952('0xc'));var squel=require(_0x3952('0xd'));var crypto=require(_0x3952('0xe'));var jsforce=require(_0x3952('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3952('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3952('0x10'))(_0x3952('0x11'));var utils=require(_0x3952('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3952('0x13'));var db=require(_0x3952('0x14'))['db'];function respondWithStatusCode(_0x51da7b,_0x15b4b5){_0x15b4b5=_0x15b4b5||0xcc;return function(_0x7f54a8){if(_0x7f54a8){return _0x51da7b[_0x3952('0x15')](_0x15b4b5);}return _0x51da7b[_0x3952('0x16')](_0x15b4b5)[_0x3952('0x17')]();};}function respondWithResult(_0x1f370a,_0x1dfef9){_0x1dfef9=_0x1dfef9||0xc8;return function(_0x339ca4){if(_0x339ca4){return _0x1f370a[_0x3952('0x16')](_0x1dfef9)['json'](_0x339ca4);}};}function respondWithFilteredResult(_0xbe8f9d,_0x16350b){return function(_0x2071e5){if(_0x2071e5){var _0x1a40ab=typeof _0x16350b[_0x3952('0x18')]==='undefined'&&typeof _0x16350b['limit']===_0x3952('0x19');var _0xf368ce=_0x2071e5['count'];var _0x319fb9=_0x1a40ab?0x0:_0x16350b[_0x3952('0x18')];var _0x30e8e9=_0x1a40ab?_0x2071e5[_0x3952('0x1a')]:_0x16350b[_0x3952('0x18')]+_0x16350b[_0x3952('0x1b')];var _0x2e9e73;if(_0x30e8e9>=_0xf368ce){_0x30e8e9=_0xf368ce;_0x2e9e73=0xc8;}else{_0x2e9e73=0xce;}_0xbe8f9d[_0x3952('0x16')](_0x2e9e73);return _0xbe8f9d[_0x3952('0x1c')](_0x3952('0x1d'),_0x319fb9+'-'+_0x30e8e9+'/'+_0xf368ce)[_0x3952('0x1e')](_0x2071e5);}return null;};}function patchUpdates(_0x3599ee){return function(_0x5e8d79){try{jsonpatch[_0x3952('0x1f')](_0x5e8d79,_0x3599ee,!![]);}catch(_0x1f7e82){return BPromise[_0x3952('0x20')](_0x1f7e82);}return _0x5e8d79[_0x3952('0x21')]();};}function saveUpdates(_0x43cf60,_0x1910c1){return function(_0x2a404b){if(_0x2a404b){return _0x2a404b['update'](_0x43cf60)[_0x3952('0x22')](function(_0x37989e){return _0x37989e;});}return null;};}function removeEntity(_0x2e0173,_0x2fb0f9){return function(_0x56d65b){if(_0x56d65b){return _0x56d65b['destroy']()[_0x3952('0x22')](function(){_0x2e0173[_0x3952('0x16')](0xcc)[_0x3952('0x17')]();});}};}function handleEntityNotFound(_0x50cc9b,_0x130d90){return function(_0x49900d){if(!_0x49900d){_0x50cc9b[_0x3952('0x15')](0x194);}return _0x49900d;};}function handleError(_0x242f0c,_0x3ffcd6){_0x3ffcd6=_0x3ffcd6||0x1f4;return function(_0x1bbf04){logger[_0x3952('0x23')](_0x1bbf04[_0x3952('0x24')]);if(_0x1bbf04[_0x3952('0x25')]){delete _0x1bbf04[_0x3952('0x25')];}_0x242f0c[_0x3952('0x16')](_0x3ffcd6)['send'](_0x1bbf04);};}exports[_0x3952('0x26')]=function(_0x22ad4c,_0x4e069c){var _0x3391e9={},_0x14118d={},_0x536a41={'count':0x0,'rows':[]};var _0x4ab6cb=_[_0x3952('0x27')](db[_0x3952('0x28')][_0x3952('0x29')],function(_0x2b5f33){return{'name':_0x2b5f33[_0x3952('0x2a')],'type':_0x2b5f33['type'][_0x3952('0x2b')]};});_0x14118d[_0x3952('0x2c')]=_[_0x3952('0x27')](_0x4ab6cb,_0x3952('0x25'));_0x14118d['query']=_['keys'](_0x22ad4c[_0x3952('0x2d')]);_0x14118d[_0x3952('0x2e')]=_[_0x3952('0x2f')](_0x14118d['model'],_0x14118d['query']);_0x3391e9[_0x3952('0x30')]=_[_0x3952('0x2f')](_0x14118d[_0x3952('0x2c')],qs[_0x3952('0x31')](_0x22ad4c[_0x3952('0x2d')][_0x3952('0x31')]));_0x3391e9[_0x3952('0x30')]=_0x3391e9[_0x3952('0x30')][_0x3952('0x32')]?_0x3391e9[_0x3952('0x30')]:_0x14118d['model'];if(!_0x22ad4c[_0x3952('0x2d')][_0x3952('0x33')](_0x3952('0x34'))){_0x3391e9[_0x3952('0x1b')]=qs[_0x3952('0x1b')](_0x22ad4c[_0x3952('0x2d')][_0x3952('0x1b')]);_0x3391e9[_0x3952('0x18')]=qs[_0x3952('0x18')](_0x22ad4c[_0x3952('0x2d')]['offset']);}_0x3391e9[_0x3952('0x35')]=qs[_0x3952('0x36')](_0x22ad4c[_0x3952('0x2d')][_0x3952('0x36')]);_0x3391e9[_0x3952('0x37')]=qs[_0x3952('0x2e')](_[_0x3952('0x38')](_0x22ad4c[_0x3952('0x2d')],_0x14118d[_0x3952('0x2e')]),_0x4ab6cb);if(_0x22ad4c[_0x3952('0x2d')][_0x3952('0x39')]){_0x3391e9[_0x3952('0x37')]=_[_0x3952('0x3a')](_0x3391e9[_0x3952('0x37')],{'$or':_[_0x3952('0x27')](_0x4ab6cb,function(_0x3761c0){if(_0x3761c0[_0x3952('0x3b')]!==_0x3952('0x3c')){var _0x1bae27={};_0x1bae27[_0x3761c0[_0x3952('0x25')]]={'$like':'%'+_0x22ad4c[_0x3952('0x2d')][_0x3952('0x39')]+'%'};return _0x1bae27;}})});}_0x3391e9=_[_0x3952('0x3a')]({},_0x3391e9,_0x22ad4c[_0x3952('0x3d')]);var _0x320752={'where':_0x3391e9[_0x3952('0x37')]};return db['VtigerField'][_0x3952('0x1a')](_0x320752)['then'](function(_0x55fdd2){_0x536a41[_0x3952('0x1a')]=_0x55fdd2;if(_0x22ad4c[_0x3952('0x2d')][_0x3952('0x3e')]){_0x3391e9[_0x3952('0x3f')]=[{'all':!![]}];}return db[_0x3952('0x28')][_0x3952('0x40')](_0x3391e9);})[_0x3952('0x22')](function(_0x54be6a){_0x536a41[_0x3952('0x41')]=_0x54be6a;return _0x536a41;})[_0x3952('0x22')](respondWithFilteredResult(_0x4e069c,_0x3391e9))[_0x3952('0x42')](handleError(_0x4e069c,null));};exports[_0x3952('0x43')]=function(_0x5381bc,_0x1083fd){var _0x3d5a7e={'raw':!![],'where':{'id':_0x5381bc['params']['id']}},_0x4b063b={};_0x4b063b[_0x3952('0x2c')]=_['keys'](db['VtigerField'][_0x3952('0x29')]);_0x4b063b[_0x3952('0x2d')]=_[_0x3952('0x44')](_0x5381bc[_0x3952('0x2d')]);_0x4b063b['filters']=_[_0x3952('0x2f')](_0x4b063b['model'],_0x4b063b['query']);_0x3d5a7e[_0x3952('0x30')]=_[_0x3952('0x2f')](_0x4b063b[_0x3952('0x2c')],qs[_0x3952('0x31')](_0x5381bc[_0x3952('0x2d')][_0x3952('0x31')]));_0x3d5a7e[_0x3952('0x30')]=_0x3d5a7e[_0x3952('0x30')][_0x3952('0x32')]?_0x3d5a7e['attributes']:_0x4b063b[_0x3952('0x2c')];if(_0x5381bc[_0x3952('0x2d')][_0x3952('0x3e')]){_0x3d5a7e[_0x3952('0x3f')]=[{'all':!![]}];}_0x3d5a7e=_[_0x3952('0x3a')]({},_0x3d5a7e,_0x5381bc[_0x3952('0x3d')]);return db[_0x3952('0x28')][_0x3952('0x45')](_0x3d5a7e)[_0x3952('0x22')](handleEntityNotFound(_0x1083fd,null))[_0x3952('0x22')](respondWithResult(_0x1083fd,null))[_0x3952('0x42')](handleError(_0x1083fd,null));};exports[_0x3952('0x46')]=function(_0x4340da,_0x3e68d0){return db[_0x3952('0x28')]['create'](_0x4340da[_0x3952('0x47')],{})['then'](respondWithResult(_0x3e68d0,0xc9))[_0x3952('0x42')](handleError(_0x3e68d0,null));};exports[_0x3952('0x48')]=function(_0x3a977f,_0x18b08a){if(_0x3a977f[_0x3952('0x47')]['id']){delete _0x3a977f['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x3a977f[_0x3952('0x49')]['id']}})['then'](handleEntityNotFound(_0x18b08a,null))[_0x3952('0x22')](saveUpdates(_0x3a977f[_0x3952('0x47')],null))[_0x3952('0x22')](respondWithResult(_0x18b08a,null))['catch'](handleError(_0x18b08a,null));};exports[_0x3952('0x4a')]=function(_0x572847,_0x323405){return db[_0x3952('0x28')][_0x3952('0x45')]({'where':{'id':_0x572847[_0x3952('0x49')]['id']}})[_0x3952('0x22')](handleEntityNotFound(_0x323405,null))[_0x3952('0x22')](removeEntity(_0x323405,null))['catch'](handleError(_0x323405,null));}; \ No newline at end of file +var _0xe99d=['set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','keys','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe99d,0xb2));var _0xde99=function(_0x4518fb,_0x45a0cd){_0x4518fb=_0x4518fb-0x0;var _0x4a4d4a=_0xe99d[_0x4518fb];return _0x4a4d4a;};'use strict';var emlformat=require(_0xde99('0x0'));var rimraf=require(_0xde99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde99('0x2'));var rp=require(_0xde99('0x3'));var moment=require(_0xde99('0x4'));var BPromise=require(_0xde99('0x5'));var Mustache=require(_0xde99('0x6'));var util=require(_0xde99('0x7'));var path=require(_0xde99('0x8'));var sox=require(_0xde99('0x9'));var csv=require('to-csv');var ejs=require(_0xde99('0xa'));var fs=require('fs');var fs_extra=require(_0xde99('0xb'));var _=require(_0xde99('0xc'));var squel=require(_0xde99('0xd'));var crypto=require('crypto');var jsforce=require(_0xde99('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xde99('0xf'));var Papa=require('papaparse');var Redis=require(_0xde99('0x10'));var authService=require(_0xde99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xde99('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde99('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xde99('0x14'));var db=require(_0xde99('0x15'))['db'];function respondWithStatusCode(_0x21ffc4,_0xa5130c){_0xa5130c=_0xa5130c||0xcc;return function(_0x4d1bec){if(_0x4d1bec){return _0x21ffc4['sendStatus'](_0xa5130c);}return _0x21ffc4[_0xde99('0x16')](_0xa5130c)[_0xde99('0x17')]();};}function respondWithResult(_0x383ada,_0x5d03c1){_0x5d03c1=_0x5d03c1||0xc8;return function(_0x427c7f){if(_0x427c7f){return _0x383ada[_0xde99('0x16')](_0x5d03c1)[_0xde99('0x18')](_0x427c7f);}};}function respondWithFilteredResult(_0x5582d2,_0x58dcf4){return function(_0x1907ab){if(_0x1907ab){var _0x13f2c1=typeof _0x58dcf4[_0xde99('0x19')]===_0xde99('0x1a')&&typeof _0x58dcf4[_0xde99('0x1b')]===_0xde99('0x1a');var _0x2cfc3b=_0x1907ab[_0xde99('0x1c')];var _0x26a57e=_0x13f2c1?0x0:_0x58dcf4[_0xde99('0x19')];var _0x31dc87=_0x13f2c1?_0x1907ab['count']:_0x58dcf4[_0xde99('0x19')]+_0x58dcf4[_0xde99('0x1b')];var _0x13e072;if(_0x31dc87>=_0x2cfc3b){_0x31dc87=_0x2cfc3b;_0x13e072=0xc8;}else{_0x13e072=0xce;}_0x5582d2[_0xde99('0x16')](_0x13e072);return _0x5582d2[_0xde99('0x1d')](_0xde99('0x1e'),_0x26a57e+'-'+_0x31dc87+'/'+_0x2cfc3b)[_0xde99('0x18')](_0x1907ab);}return null;};}function patchUpdates(_0x24d46c){return function(_0x579f19){try{jsonpatch['apply'](_0x579f19,_0x24d46c,!![]);}catch(_0x2eade8){return BPromise['reject'](_0x2eade8);}return _0x579f19[_0xde99('0x1f')]();};}function saveUpdates(_0x5c8bfc,_0x474cf0){return function(_0x1abb88){if(_0x1abb88){return _0x1abb88[_0xde99('0x20')](_0x5c8bfc)[_0xde99('0x21')](function(_0x1c6249){return _0x1c6249;});}return null;};}function removeEntity(_0x24adb2,_0x23438d){return function(_0x4eab91){if(_0x4eab91){return _0x4eab91[_0xde99('0x22')]()[_0xde99('0x21')](function(){_0x24adb2[_0xde99('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21eec3,_0x2957c6){return function(_0x20c0bc){if(!_0x20c0bc){_0x21eec3[_0xde99('0x23')](0x194);}return _0x20c0bc;};}function handleError(_0x189f2d,_0x52f810){_0x52f810=_0x52f810||0x1f4;return function(_0x142344){logger[_0xde99('0x24')](_0x142344[_0xde99('0x25')]);if(_0x142344[_0xde99('0x26')]){delete _0x142344[_0xde99('0x26')];}_0x189f2d[_0xde99('0x16')](_0x52f810)[_0xde99('0x27')](_0x142344);};}exports[_0xde99('0x28')]=function(_0x318c93,_0x5b6be3){var _0x5bccc4={},_0x2b9cdc={},_0x57f520={'count':0x0,'rows':[]};var _0x88963e=_[_0xde99('0x29')](db[_0xde99('0x2a')][_0xde99('0x2b')],function(_0x456b52){return{'name':_0x456b52[_0xde99('0x2c')],'type':_0x456b52[_0xde99('0x2d')]['key']};});_0x2b9cdc[_0xde99('0x2e')]=_['map'](_0x88963e,'name');_0x2b9cdc[_0xde99('0x2f')]=_['keys'](_0x318c93[_0xde99('0x2f')]);_0x2b9cdc[_0xde99('0x30')]=_[_0xde99('0x31')](_0x2b9cdc[_0xde99('0x2e')],_0x2b9cdc[_0xde99('0x2f')]);_0x5bccc4['attributes']=_[_0xde99('0x31')](_0x2b9cdc[_0xde99('0x2e')],qs[_0xde99('0x32')](_0x318c93[_0xde99('0x2f')][_0xde99('0x32')]));_0x5bccc4[_0xde99('0x33')]=_0x5bccc4[_0xde99('0x33')][_0xde99('0x34')]?_0x5bccc4['attributes']:_0x2b9cdc[_0xde99('0x2e')];if(!_0x318c93[_0xde99('0x2f')][_0xde99('0x35')](_0xde99('0x36'))){_0x5bccc4[_0xde99('0x1b')]=qs['limit'](_0x318c93[_0xde99('0x2f')][_0xde99('0x1b')]);_0x5bccc4[_0xde99('0x19')]=qs[_0xde99('0x19')](_0x318c93[_0xde99('0x2f')][_0xde99('0x19')]);}_0x5bccc4['order']=qs['sort'](_0x318c93[_0xde99('0x2f')]['sort']);_0x5bccc4[_0xde99('0x37')]=qs[_0xde99('0x30')](_[_0xde99('0x38')](_0x318c93[_0xde99('0x2f')],_0x2b9cdc['filters']),_0x88963e);if(_0x318c93[_0xde99('0x2f')][_0xde99('0x39')]){_0x5bccc4[_0xde99('0x37')]=_[_0xde99('0x3a')](_0x5bccc4[_0xde99('0x37')],{'$or':_[_0xde99('0x29')](_0x88963e,function(_0x43cc46){if(_0x43cc46['type']!==_0xde99('0x3b')){var _0x160a2b={};_0x160a2b[_0x43cc46['name']]={'$like':'%'+_0x318c93['query'][_0xde99('0x39')]+'%'};return _0x160a2b;}})});}_0x5bccc4=_[_0xde99('0x3a')]({},_0x5bccc4,_0x318c93[_0xde99('0x3c')]);var _0x5ef535={'where':_0x5bccc4[_0xde99('0x37')]};return db[_0xde99('0x2a')]['count'](_0x5ef535)['then'](function(_0x498d7b){_0x57f520[_0xde99('0x1c')]=_0x498d7b;if(_0x318c93[_0xde99('0x2f')][_0xde99('0x3d')]){_0x5bccc4[_0xde99('0x3e')]=[{'all':!![]}];}return db[_0xde99('0x2a')]['findAll'](_0x5bccc4);})['then'](function(_0x4091e2){_0x57f520['rows']=_0x4091e2;return _0x57f520;})[_0xde99('0x21')](respondWithFilteredResult(_0x5b6be3,_0x5bccc4))['catch'](handleError(_0x5b6be3,null));};exports['show']=function(_0x50c8e6,_0x33419d){var _0x51f434={'raw':!![],'where':{'id':_0x50c8e6[_0xde99('0x3f')]['id']}},_0x2402f7={};_0x2402f7[_0xde99('0x2e')]=_[_0xde99('0x40')](db[_0xde99('0x2a')][_0xde99('0x2b')]);_0x2402f7['query']=_[_0xde99('0x40')](_0x50c8e6[_0xde99('0x2f')]);_0x2402f7[_0xde99('0x30')]=_[_0xde99('0x31')](_0x2402f7[_0xde99('0x2e')],_0x2402f7[_0xde99('0x2f')]);_0x51f434['attributes']=_[_0xde99('0x31')](_0x2402f7[_0xde99('0x2e')],qs[_0xde99('0x32')](_0x50c8e6['query'][_0xde99('0x32')]));_0x51f434[_0xde99('0x33')]=_0x51f434[_0xde99('0x33')][_0xde99('0x34')]?_0x51f434[_0xde99('0x33')]:_0x2402f7[_0xde99('0x2e')];if(_0x50c8e6[_0xde99('0x2f')][_0xde99('0x3d')]){_0x51f434[_0xde99('0x3e')]=[{'all':!![]}];}_0x51f434=_[_0xde99('0x3a')]({},_0x51f434,_0x50c8e6[_0xde99('0x3c')]);return db[_0xde99('0x2a')][_0xde99('0x41')](_0x51f434)[_0xde99('0x21')](handleEntityNotFound(_0x33419d,null))[_0xde99('0x21')](respondWithResult(_0x33419d,null))[_0xde99('0x42')](handleError(_0x33419d,null));};exports[_0xde99('0x43')]=function(_0x126b0d,_0x5871f6){return db[_0xde99('0x2a')][_0xde99('0x43')](_0x126b0d[_0xde99('0x44')],{})[_0xde99('0x21')](respondWithResult(_0x5871f6,0xc9))[_0xde99('0x42')](handleError(_0x5871f6,null));};exports[_0xde99('0x20')]=function(_0x4f3e61,_0x164625){if(_0x4f3e61[_0xde99('0x44')]['id']){delete _0x4f3e61[_0xde99('0x44')]['id'];}return db[_0xde99('0x2a')][_0xde99('0x41')]({'where':{'id':_0x4f3e61['params']['id']}})[_0xde99('0x21')](handleEntityNotFound(_0x164625,null))[_0xde99('0x21')](saveUpdates(_0x4f3e61[_0xde99('0x44')],null))[_0xde99('0x21')](respondWithResult(_0x164625,null))[_0xde99('0x42')](handleError(_0x164625,null));};exports[_0xde99('0x22')]=function(_0x3734d1,_0x45d3f5){return db[_0xde99('0x2a')][_0xde99('0x41')]({'where':{'id':_0x3734d1[_0xde99('0x3f')]['id']}})[_0xde99('0x21')](handleEntityNotFound(_0x45d3f5,null))[_0xde99('0x21')](removeEntity(_0x45d3f5,null))['catch'](handleError(_0x45d3f5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index df6a1cd..08a7deb 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 _0xc869=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','FieldId','lodash'];(function(_0xbd5bea,_0x4534c6){var _0x5597e4=function(_0x53d27a){while(--_0x53d27a){_0xbd5bea['push'](_0xbd5bea['shift']());}};_0x5597e4(++_0x4534c6);}(_0xc869,0x1e0));var _0x9c86=function(_0x32ab3e,_0x1832c7){_0x32ab3e=_0x32ab3e-0x0;var _0x3fa713=_0xc869[_0x32ab3e];return _0x3fa713;};'use strict';var _=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var logger=require('../../config/logger')(_0x9c86('0x2'));var moment=require(_0x9c86('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c86('0x4'));var fs=require('fs');var path=require(_0x9c86('0x5'));var rimraf=require(_0x9c86('0x6'));var config=require(_0x9c86('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x9c86('0x8')]=function(_0x23a03e,_0x81213d){return _0x23a03e[_0x9c86('0x9')](_0x9c86('0xa'),attributes,{'tableName':_0x9c86('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x9c86('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f71=['int_vtiger_fields','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x42d954,_0x37cfec){var _0x49ee10=function(_0x418722){while(--_0x418722){_0x42d954['push'](_0x42d954['shift']());}};_0x49ee10(++_0x37cfec);}(_0x5f71,0x119));var _0x15f7=function(_0x163426,_0x2a94ba){_0x163426=_0x163426-0x0;var _0x11a01d=_0x5f71[_0x163426];return _0x11a01d;};'use strict';var _=require(_0x15f7('0x0'));var util=require(_0x15f7('0x1'));var logger=require(_0x15f7('0x2'))(_0x15f7('0x3'));var moment=require('moment');var BPromise=require(_0x15f7('0x4'));var rp=require(_0x15f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15f7('0x6'));var config=require(_0x15f7('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x15f7('0x8')]=function(_0x45ea53,_0x1c6db5){return _0x45ea53['define']('VtigerField',attributes,{'tableName':_0x15f7('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 147d891..3b8d098 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 _0xb30f=['message','VtigerField,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x4c5851,_0x578977){var _0x535c3a=function(_0x48957f){while(--_0x48957f){_0x4c5851['push'](_0x4c5851['shift']());}};_0x535c3a(++_0x578977);}(_0xb30f,0x163));var _0xfb30=function(_0x48e044,_0x30f047){_0x48e044=_0x48e044-0x0;var _0x383ff7=_0xb30f[_0x48e044];return _0x383ff7;};'use strict';var _=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var moment=require(_0xfb30('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb30('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb30('0x4'))['db'];var utils=require(_0xfb30('0x5'));var logger=require(_0xfb30('0x6'))(_0xfb30('0x7'));var config=require(_0xfb30('0x8'));var jayson=require(_0xfb30('0x9'));var client=jayson[_0xfb30('0xa')][_0xfb30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427bd0,_0x29c7d5,_0x557eaf){return new BPromise(function(_0x3655c1,_0x2764aa){return client[_0xfb30('0xc')](_0x427bd0,_0x557eaf)[_0xfb30('0xd')](function(_0x28e7db){logger[_0xfb30('0xe')]('VtigerField,\x20%s,\x20%s',_0x29c7d5,'request\x20sent');logger[_0xfb30('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x29c7d5,_0xfb30('0x10'),JSON[_0xfb30('0x11')](_0x28e7db));if(_0x28e7db['error']){if(_0x28e7db[_0xfb30('0x12')]['code']===0x1f4){logger[_0xfb30('0x12')]('VtigerField,\x20%s,\x20%s',_0x29c7d5,_0x28e7db['error']['message']);return _0x2764aa(_0x28e7db[_0xfb30('0x12')][_0xfb30('0x13')]);}logger['error'](_0xfb30('0x14'),_0x29c7d5,_0x28e7db['error'][_0xfb30('0x13')]);return _0x3655c1(_0x28e7db[_0xfb30('0x12')]['message']);}else{logger[_0xfb30('0xe')](_0xfb30('0x14'),_0x29c7d5,'request\x20sent');_0x3655c1(_0x28e7db['result'][_0xfb30('0x13')]);}})[_0xfb30('0x15')](function(_0x11e2d7){logger[_0xfb30('0x12')]('VtigerField,\x20%s,\x20%s',_0x29c7d5,_0x11e2d7);_0x2764aa(_0x11e2d7);});});} \ No newline at end of file +var _0x6abf=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x353eb0,_0x2f1938){var _0x42a3d9=function(_0x5c9bbc){while(--_0x5c9bbc){_0x353eb0['push'](_0x353eb0['shift']());}};_0x42a3d9(++_0x2f1938);}(_0x6abf,0x1b5));var _0xf6ab=function(_0x413ac1,_0x1ec61c){_0x413ac1=_0x413ac1-0x0;var _0x38950d=_0x6abf[_0x413ac1];return _0x38950d;};'use strict';var _=require(_0xf6ab('0x0'));var util=require('util');var moment=require(_0xf6ab('0x1'));var BPromise=require(_0xf6ab('0x2'));var rs=require(_0xf6ab('0x3'));var fs=require('fs');var Redis=require(_0xf6ab('0x4'));var db=require(_0xf6ab('0x5'))['db'];var utils=require(_0xf6ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6ab('0x8')][_0xf6ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d785b,_0x2ef91a,_0x4293f4){return new BPromise(function(_0x226b13,_0x3e3d96){return client['request'](_0x3d785b,_0x4293f4)['then'](function(_0x40e630){logger[_0xf6ab('0xa')](_0xf6ab('0xb'),_0x2ef91a,_0xf6ab('0xc'));logger[_0xf6ab('0xd')](_0xf6ab('0xe'),_0x2ef91a,_0xf6ab('0xc'),JSON[_0xf6ab('0xf')](_0x40e630));if(_0x40e630[_0xf6ab('0x10')]){if(_0x40e630['error']['code']===0x1f4){logger[_0xf6ab('0x10')](_0xf6ab('0xb'),_0x2ef91a,_0x40e630['error'][_0xf6ab('0x11')]);return _0x3e3d96(_0x40e630['error'][_0xf6ab('0x11')]);}logger[_0xf6ab('0x10')](_0xf6ab('0xb'),_0x2ef91a,_0x40e630[_0xf6ab('0x10')][_0xf6ab('0x11')]);return _0x226b13(_0x40e630[_0xf6ab('0x10')]['message']);}else{logger[_0xf6ab('0xa')](_0xf6ab('0xb'),_0x2ef91a,_0xf6ab('0xc'));_0x226b13(_0x40e630[_0xf6ab('0x12')][_0xf6ab('0x11')]);}})[_0xf6ab('0x13')](function(_0x3c1172){logger[_0xf6ab('0x10')](_0xf6ab('0xb'),_0x2ef91a,_0x3c1172);_0x3e3d96(_0x3c1172);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cbc2ebd..3fbee74 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58eb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','util','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x58eb,0x15e));var _0xb58e=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x58eb[_0x47a349];return _0x18ab75;};'use strict';var multer=require('multer');var util=require(_0xb58e('0x0'));var path=require('path');var timeout=require(_0xb58e('0x1'));var express=require(_0xb58e('0x2'));var router=express[_0xb58e('0x3')]();var fs_extra=require(_0xb58e('0x4'));var auth=require(_0xb58e('0x5'));var interaction=require(_0xb58e('0x6'));var config=require(_0xb58e('0x7'));var controller=require(_0xb58e('0x8'));router[_0xb58e('0x9')]('/',auth[_0xb58e('0xa')](),controller['index']);router[_0xb58e('0x9')](_0xb58e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb58e('0x9')]('/:id/configurations',auth[_0xb58e('0xa')](),controller[_0xb58e('0xc')]);router[_0xb58e('0x9')](_0xb58e('0xd'),auth[_0xb58e('0xa')](),controller[_0xb58e('0xe')]);router[_0xb58e('0xf')]('/',auth[_0xb58e('0xa')](),controller[_0xb58e('0x10')]);router[_0xb58e('0xf')](_0xb58e('0x11'),auth[_0xb58e('0xa')](),controller[_0xb58e('0x12')]);router['put'](_0xb58e('0xb'),auth['isAuthenticated'](),controller[_0xb58e('0x13')]);router['delete'](_0xb58e('0xb'),auth[_0xb58e('0xa')](),controller[_0xb58e('0x14')]);module[_0xb58e('0x15')]=router; \ No newline at end of file +var _0xdcd0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x351163,_0x25ce97){var _0x55a47f=function(_0x56f5e2){while(--_0x56f5e2){_0x351163['push'](_0x351163['shift']());}};_0x55a47f(++_0x25ce97);}(_0xdcd0,0x1cf));var _0x0dcd=function(_0x3b6341,_0x5a509e){_0x3b6341=_0x3b6341-0x0;var _0x5e6908=_0xdcd0[_0x3b6341];return _0x5e6908;};'use strict';var multer=require(_0x0dcd('0x0'));var util=require(_0x0dcd('0x1'));var path=require('path');var timeout=require(_0x0dcd('0x2'));var express=require(_0x0dcd('0x3'));var router=express['Router']();var fs_extra=require(_0x0dcd('0x4'));var auth=require(_0x0dcd('0x5'));var interaction=require(_0x0dcd('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x0dcd('0x7')]('/',auth[_0x0dcd('0x8')](),controller['index']);router['get'](_0x0dcd('0x9'),auth['isAuthenticated'](),controller[_0x0dcd('0xa')]);router[_0x0dcd('0x7')](_0x0dcd('0xb'),auth['isAuthenticated'](),controller[_0x0dcd('0xc')]);router['get'](_0x0dcd('0xd'),auth[_0x0dcd('0x8')](),controller['getFields']);router[_0x0dcd('0xe')]('/',auth[_0x0dcd('0x8')](),controller[_0x0dcd('0xf')]);router[_0x0dcd('0xe')]('/:id/configurations',auth[_0x0dcd('0x8')](),controller['addConfiguration']);router[_0x0dcd('0x10')](_0x0dcd('0x9'),auth[_0x0dcd('0x8')](),controller['update']);router['delete'](_0x0dcd('0x9'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index efc8eab..0b3c2bd 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 _0xd046=['password','newTab','integrationTab','exports','STRING','username','ENUM'];(function(_0x57107e,_0x1f62aa){var _0x42c270=function(_0x548a8e){while(--_0x548a8e){_0x57107e['push'](_0x57107e['shift']());}};_0x42c270(++_0x1f62aa);}(_0xd046,0x129));var _0x6d04=function(_0x1c99ee,_0x364105){_0x1c99ee=_0x1c99ee-0x0;var _0x5372e9=_0xd046[_0x1c99ee];return _0x5372e9;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')]},'description':{'type':Sequelize[_0x6d04('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6d04('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6d04('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6d04('0x3')]('password','token'),'defaultValue':_0x6d04('0x4')},'serverUrl':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x6d04('0x5')),'defaultValue':_0x6d04('0x6')}}; \ No newline at end of file +var _0xaf1b=['password','token','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x27f8eb,_0x8eef6b){_0x27f8eb=_0x27f8eb-0x0;var _0x365e7b=_0xaf1b[_0x27f8eb];return _0x365e7b;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')]},'description':{'type':Sequelize[_0xbaf1('0x2')]},'username':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x3')},'password':{'type':Sequelize[_0xbaf1('0x2')]},'token':{'type':Sequelize[_0xbaf1('0x2')]},'remoteUri':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x4')},'authType':{'type':Sequelize[_0xbaf1('0x5')](_0xbaf1('0x6'),_0xbaf1('0x7')),'defaultValue':_0xbaf1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbaf1('0x5')]('integrationTab',_0xbaf1('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 70d1663..504afcd 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 _0x84a0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','show','length','include','find','catch','create','body','update','params','findOne','ZendeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x642589,_0x350f2f){var _0x4d3562=function(_0x2a0869){while(--_0x2a0869){_0x642589['push'](_0x642589['shift']());}};_0x4d3562(++_0x350f2f);}(_0x84a0,0x66));var _0x084a=function(_0x2dfe97,_0x2c9755){_0x2dfe97=_0x2dfe97-0x0;var _0x48c50a=_0x84a0[_0x2dfe97];return _0x48c50a;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];var integrations=require(_0x084a('0x18'));function respondWithStatusCode(_0xec90a5,_0x9245b1){_0x9245b1=_0x9245b1||0xcc;return function(_0x1bdfb8){if(_0x1bdfb8){return _0xec90a5[_0x084a('0x19')](_0x9245b1);}return _0xec90a5[_0x084a('0x1a')](_0x9245b1)[_0x084a('0x1b')]();};}function respondWithResult(_0x5aef40,_0x4277c9){_0x4277c9=_0x4277c9||0xc8;return function(_0x4b9cc5){if(_0x4b9cc5){return _0x5aef40[_0x084a('0x1a')](_0x4277c9)[_0x084a('0x1c')](_0x4b9cc5);}};}function respondWithFilteredResult(_0x366624,_0x2d35b8){return function(_0xd20527){if(_0xd20527){var _0x4cbd16=typeof _0x2d35b8[_0x084a('0x1d')]==='undefined'&&typeof _0x2d35b8[_0x084a('0x1e')]===_0x084a('0x1f');var _0x4af43e=_0xd20527[_0x084a('0x20')];var _0x32c729=_0x4cbd16?0x0:_0x2d35b8[_0x084a('0x1d')];var _0x14bb19=_0x4cbd16?_0xd20527[_0x084a('0x20')]:_0x2d35b8[_0x084a('0x1d')]+_0x2d35b8[_0x084a('0x1e')];var _0x34e86e;if(_0x14bb19>=_0x4af43e){_0x14bb19=_0x4af43e;_0x34e86e=0xc8;}else{_0x34e86e=0xce;}_0x366624[_0x084a('0x1a')](_0x34e86e);return _0x366624[_0x084a('0x21')](_0x084a('0x22'),_0x32c729+'-'+_0x14bb19+'/'+_0x4af43e)[_0x084a('0x1c')](_0xd20527);}return null;};}function patchUpdates(_0x116328){return function(_0x126efb){try{jsonpatch[_0x084a('0x23')](_0x126efb,_0x116328,!![]);}catch(_0x506f71){return BPromise[_0x084a('0x24')](_0x506f71);}return _0x126efb[_0x084a('0x25')]();};}function saveUpdates(_0x41a90f,_0x2d62bf){return function(_0x1c3f6c){if(_0x1c3f6c){return _0x1c3f6c['update'](_0x41a90f)[_0x084a('0x26')](function(_0x288e9e){return _0x288e9e;});}return null;};}function removeEntity(_0x6346a5,_0x1f2c9f){return function(_0x18b43d){if(_0x18b43d){return _0x18b43d[_0x084a('0x27')]()['then'](function(){_0x6346a5[_0x084a('0x1a')](0xcc)[_0x084a('0x1b')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x19')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x28')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x29')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x2a')](db['ZendeskAccount'][_0x084a('0x2b')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2c')][_0x084a('0x2d')]};});_0x3be7a6[_0x084a('0x2e')]=_[_0x084a('0x2a')](_0x378de6,_0x084a('0x28'));_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x4651e6[_0x084a('0x2f')]);_0x3be7a6[_0x084a('0x31')]=_[_0x084a('0x32')](_0x3be7a6[_0x084a('0x2e')],_0x3be7a6[_0x084a('0x2f')]);_0x2c4149[_0x084a('0x33')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x34')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x34')]));_0x2c4149[_0x084a('0x33')]=_0x2c4149[_0x084a('0x33')]['length']?_0x2c4149[_0x084a('0x33')]:_0x3be7a6[_0x084a('0x2e')];if(!_0x4651e6[_0x084a('0x2f')]['hasOwnProperty'](_0x084a('0x35'))){_0x2c4149[_0x084a('0x1e')]=qs[_0x084a('0x1e')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x1d')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x1d')]);}_0x2c4149['order']=qs[_0x084a('0x36')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x36')]);_0x2c4149[_0x084a('0x37')]=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0x4651e6[_0x084a('0x2f')],_0x3be7a6[_0x084a('0x31')]),_0x378de6);if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]){_0x2c4149[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x2c4149[_0x084a('0x37')],{'$or':_[_0x084a('0x2a')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3b')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x28')]]={'$like':'%'+_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x3a')]({},_0x2c4149,_0x4651e6[_0x084a('0x3c')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x37')]};return db['ZendeskAccount'][_0x084a('0x20')](_0x183e10)[_0x084a('0x26')](function(_0x25a081){_0x25a2a1[_0x084a('0x20')]=_0x25a081;if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x26')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x30')](db[_0x084a('0x3e')][_0x084a('0x2b')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xba1081[_0x084a('0x2f')]);_0xfb565c[_0x084a('0x31')]=_[_0x084a('0x32')](_0xfb565c[_0x084a('0x2e')],_0xfb565c[_0x084a('0x2f')]);_0x3e2b92[_0x084a('0x33')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x34')](_0xba1081[_0x084a('0x2f')][_0x084a('0x34')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x33')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x33')]:_0xfb565c[_0x084a('0x2e')];if(_0xba1081[_0x084a('0x2f')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3c')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x48')]=function(_0x31677b,_0x10856d){if(_0x31677b['body']['id']){delete _0x31677b[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x31677b[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x10856d,null))['then'](saveUpdates(_0x31677b[_0x084a('0x47')],null))[_0x084a('0x26')](respondWithResult(_0x10856d,null))[_0x084a('0x45')](handleError(_0x10856d,null));};exports[_0x084a('0x27')]=function(_0xf936e,_0x3b2df4){return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0xf936e[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x3b2df4,null))[_0x084a('0x26')](removeEntity(_0x3b2df4,null))[_0x084a('0x45')](handleError(_0x3b2df4,null));};exports['getConfigurations']=function(_0xcdd5b,_0x37fce4,_0x29fa4b){var _0x39edc1={};var _0x2091b1={};var _0x1c972c;var _0xa5362;return db['ZendeskAccount'][_0x084a('0x4a')]({'where':{'id':_0xcdd5b[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x37fce4,null))['then'](function(_0x54ca1f){if(_0x54ca1f){_0x1c972c=_0x54ca1f;_0x2091b1[_0x084a('0x2e')]=_['keys'](db[_0x084a('0x4b')][_0x084a('0x2b')]);_0x2091b1['query']=_[_0x084a('0x30')](_0xcdd5b['query']);_0x2091b1['filters']=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],_0x2091b1[_0x084a('0x2f')]);_0x39edc1[_0x084a('0x33')]=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],qs[_0x084a('0x34')](_0xcdd5b['query'][_0x084a('0x34')]));_0x39edc1[_0x084a('0x33')]=_0x39edc1[_0x084a('0x33')]['length']?_0x39edc1[_0x084a('0x33')]:_0x2091b1[_0x084a('0x2e')];_0x39edc1[_0x084a('0x4c')]=qs[_0x084a('0x36')](_0xcdd5b['query'][_0x084a('0x36')]);_0x39edc1['where']=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0xcdd5b[_0x084a('0x2f')],_0x2091b1['filters']));if(_0xcdd5b['query'][_0x084a('0x39')]){_0x39edc1[_0x084a('0x37')]=_['merge'](_0x39edc1[_0x084a('0x37')],{'$or':_['map'](_0x39edc1['attributes'],function(_0x195ae2){var _0x3f3fd7={};_0x3f3fd7[_0x195ae2]={'$like':'%'+_0xcdd5b[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x3f3fd7;})});}_0x39edc1=_[_0x084a('0x3a')]({},_0x39edc1,_0xcdd5b[_0x084a('0x3c')]);return _0x1c972c[_0x084a('0x4d')](_0x39edc1);}})[_0x084a('0x26')](function(_0x114aa5){if(_0x114aa5){_0xa5362=_0x114aa5['length'];if(!_0xcdd5b[_0x084a('0x2f')][_0x084a('0x4e')](_0x084a('0x35'))){_0x39edc1['limit']=qs[_0x084a('0x1e')](_0xcdd5b[_0x084a('0x2f')]['limit']);_0x39edc1[_0x084a('0x1d')]=qs['offset'](_0xcdd5b['query'][_0x084a('0x1d')]);}return _0x1c972c['getConfigurations'](_0x39edc1);}})['then'](function(_0x2368f5){if(_0x2368f5){return _0x2368f5?{'count':_0xa5362,'rows':_0x2368f5}:null;}})[_0x084a('0x26')](respondWithResult(_0x37fce4,null))[_0x084a('0x45')](handleError(_0x37fce4,null));};exports['addConfiguration']=function(_0xff6c9e,_0xbd063c,_0x2311f5){if(_0xff6c9e[_0x084a('0x47')]['id']){delete _0xff6c9e[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0xff6c9e['params']['id']}})['then'](handleEntityNotFound(_0xbd063c,null))[_0x084a('0x26')](function(_0x36ba24){if(_0x36ba24){_0xff6c9e['body'][_0x084a('0x4f')]=_0x36ba24['id'];_0xff6c9e[_0x084a('0x47')][_0x084a('0x50')]=integrations[_0x084a('0x51')](_0xff6c9e['body'][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);_0xff6c9e['body']['Descriptions']=integrations[_0x084a('0x53')](_0xff6c9e[_0x084a('0x47')][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);return db[_0x084a('0x4b')][_0x084a('0x46')](_0xff6c9e['body'],{'include':[{'model':db[_0x084a('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x084a('0x55')}]});}return null;})[_0x084a('0x26')](respondWithResult(_0xbd063c,null))[_0x084a('0x45')](handleError(_0xbd063c,null));};exports['getFields']=function(_0x163a5d,_0x57729c,_0x1eb7be){var _0x1054ea='';return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0x163a5d[_0x084a('0x49')]['id']},'attributes':['id',_0x084a('0x56'),'password','token',_0x084a('0x57'),_0x084a('0x58')]})[_0x084a('0x26')](handleEntityNotFound(_0x57729c,null))[_0x084a('0x26')](function(_0x22abf5){if(_0x22abf5){_0x1054ea=_0x22abf5[_0x084a('0x58')];var _0x5c655f=_0x1054ea[_0x084a('0x59')](-0x1);if(_0x5c655f==='/'){_0x1054ea=_0x1054ea[_0x084a('0x5a')](0x0,_0x1054ea[_0x084a('0x5b')](_0x5c655f));}var _0x33c040={'method':_0x084a('0x5c'),'uri':util[_0x084a('0x5d')](_0x084a('0x5e'),_0x1054ea,'ticket_fields'),'json':!![]};switch(_0x22abf5[_0x084a('0x57')]){case _0x084a('0x5f'):_0x33c040[_0x084a('0x60')]={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util[_0x084a('0x5d')](_0x084a('0x62'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x5f')]))[_0x084a('0x63')]('base64'))};break;case'token':_0x33c040['headers']={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util['format'](_0x084a('0x64'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x65')]))[_0x084a('0x63')]('base64'))};break;default:throw new db['Sequelize'][(_0x084a('0x66'))](_0x084a('0x67'));}return rp(_0x33c040);}})[_0x084a('0x26')](function(_0x37d05a){if(_0x37d05a){var _0x155450=[_0x084a('0x68'),_0x084a('0x69'),'group',_0x084a('0x6a')];_[_0x084a('0x6b')](_0x37d05a[_0x084a('0x6c')],function(_0x137bba){return _0x155450[_0x084a('0x6d')](_0x137bba[_0x084a('0x2c')]);});return{'count':_0x37d05a[_0x084a('0x6c')]['length'],'rows':_[_0x084a('0x2a')](_0x37d05a[_0x084a('0x6c')],function(_0x26a88c){return{'id':_0x26a88c['id'],'name':_0x26a88c[_0x084a('0x6e')]>0x7?_0x26a88c[_0x084a('0x6f')]:_0x26a88c[_0x084a('0x2c')],'custom':_0x26a88c[_0x084a('0x6e')]>0x7?!![]:![],'options':_0x26a88c[_0x084a('0x70')]?_0x26a88c[_0x084a('0x70')]:_0x26a88c[_0x084a('0x71')]?_0x26a88c[_0x084a('0x71')]:[]};})};}})['then'](respondWithResult(_0x57729c,null))[_0x084a('0x45')](function(_0x29916a){var _0x4b8f1f=_0x163a5d[_0x084a('0x2f')]['test']?0x1f4:_0x29916a['statusCode']||0x1f4;logger[_0x084a('0x72')](_0x084a('0x73'),'getFields',_0x4b8f1f,JSON[_0x084a('0x74')](_0x29916a));delete _0x29916a[_0x084a('0x28')];if(_0x4b8f1f===0x191){_0x4b8f1f=0x190;}_0x57729c[_0x084a('0x1a')](_0x4b8f1f)[_0x084a('0x75')](_0x163a5d[_0x084a('0x2f')][_0x084a('0x76')]?{'message':_0x084a('0x77'),'statusCode':_0x29916a[_0x084a('0x78')]}:_0x29916a);});}; \ No newline at end of file +var _0x2e54=['position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','intersection','options','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','format','%s/%s','Basic\x20%s','%s:%s','headers','%s/token:%s','toString','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields'];(function(_0x3de79b,_0x554cc9){var _0x2dd0af=function(_0x4bca2c){while(--_0x4bca2c){_0x3de79b['push'](_0x3de79b['shift']());}};_0x2dd0af(++_0x554cc9);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1870cd,_0x1fe3ae){_0x1870cd=_0x1870cd-0x0;var _0xb0666=_0x2e54[_0x1870cd];return _0xb0666;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];var integrations=require(_0x42e5('0x18'));function respondWithStatusCode(_0x4530ba,_0x41598d){_0x41598d=_0x41598d||0xcc;return function(_0x144fb4){if(_0x144fb4){return _0x4530ba[_0x42e5('0x19')](_0x41598d);}return _0x4530ba[_0x42e5('0x1a')](_0x41598d)[_0x42e5('0x1b')]();};}function respondWithResult(_0x447648,_0x23957f){_0x23957f=_0x23957f||0xc8;return function(_0x51b2f4){if(_0x51b2f4){return _0x447648[_0x42e5('0x1a')](_0x23957f)[_0x42e5('0x1c')](_0x51b2f4);}};}function respondWithFilteredResult(_0x4034bd,_0x388300){return function(_0x2f4999){if(_0x2f4999){var _0x263a3d=typeof _0x388300[_0x42e5('0x1d')]===_0x42e5('0x1e')&&typeof _0x388300[_0x42e5('0x1f')]===_0x42e5('0x1e');var _0x22655f=_0x2f4999[_0x42e5('0x20')];var _0x11550e=_0x263a3d?0x0:_0x388300[_0x42e5('0x1d')];var _0x54fcfc=_0x263a3d?_0x2f4999[_0x42e5('0x20')]:_0x388300['offset']+_0x388300['limit'];var _0x14d16d;if(_0x54fcfc>=_0x22655f){_0x54fcfc=_0x22655f;_0x14d16d=0xc8;}else{_0x14d16d=0xce;}_0x4034bd[_0x42e5('0x1a')](_0x14d16d);return _0x4034bd['set'](_0x42e5('0x21'),_0x11550e+'-'+_0x54fcfc+'/'+_0x22655f)[_0x42e5('0x1c')](_0x2f4999);}return null;};}function patchUpdates(_0x1c2169){return function(_0x3fde76){try{jsonpatch[_0x42e5('0x22')](_0x3fde76,_0x1c2169,!![]);}catch(_0xa6825e){return BPromise[_0x42e5('0x23')](_0xa6825e);}return _0x3fde76['save']();};}function saveUpdates(_0x4da508,_0x283d44){return function(_0x52d319){if(_0x52d319){return _0x52d319[_0x42e5('0x24')](_0x4da508)[_0x42e5('0x25')](function(_0x37d10e){return _0x37d10e;});}return null;};}function removeEntity(_0x49490f,_0x32380f){return function(_0x5d6b24){if(_0x5d6b24){return _0x5d6b24[_0x42e5('0x26')]()[_0x42e5('0x25')](function(){_0x49490f[_0x42e5('0x1a')](0xcc)[_0x42e5('0x1b')]();});}};}function handleEntityNotFound(_0x4638bc,_0x4f52b2){return function(_0x4fb147){if(!_0x4fb147){_0x4638bc[_0x42e5('0x19')](0x194);}return _0x4fb147;};}function handleError(_0x534a26,_0x56f812){_0x56f812=_0x56f812||0x1f4;return function(_0x1b60be){logger['error'](_0x1b60be[_0x42e5('0x27')]);if(_0x1b60be[_0x42e5('0x28')]){delete _0x1b60be[_0x42e5('0x28')];}_0x534a26[_0x42e5('0x1a')](_0x56f812)[_0x42e5('0x29')](_0x1b60be);};}exports[_0x42e5('0x2a')]=function(_0x59a46b,_0x3e2ea5){var _0x201d9e={},_0x39f763={},_0x2c53d4={'count':0x0,'rows':[]};var _0x1d22ba=_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')],function(_0x5a4930){return{'name':_0x5a4930[_0x42e5('0x2e')],'type':_0x5a4930[_0x42e5('0x2f')][_0x42e5('0x30')]};});_0x39f763[_0x42e5('0x31')]=_['map'](_0x1d22ba,_0x42e5('0x28'));_0x39f763[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x59a46b[_0x42e5('0x32')]);_0x39f763['filters']=_['intersection'](_0x39f763[_0x42e5('0x31')],_0x39f763['query']);_0x201d9e[_0x42e5('0x34')]=_['intersection'](_0x39f763[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x59a46b[_0x42e5('0x32')]['fields']));_0x201d9e[_0x42e5('0x34')]=_0x201d9e[_0x42e5('0x34')]['length']?_0x201d9e[_0x42e5('0x34')]:_0x39f763['model'];if(!_0x59a46b[_0x42e5('0x32')][_0x42e5('0x36')](_0x42e5('0x37'))){_0x201d9e[_0x42e5('0x1f')]=qs[_0x42e5('0x1f')](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1f')]);_0x201d9e['offset']=qs['offset'](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1d')]);}_0x201d9e[_0x42e5('0x38')]=qs['sort'](_0x59a46b['query']['sort']);_0x201d9e['where']=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x59a46b[_0x42e5('0x32')],_0x39f763[_0x42e5('0x39')]),_0x1d22ba);if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]){_0x201d9e[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x201d9e['where'],{'$or':_[_0x42e5('0x2b')](_0x1d22ba,function(_0x587832){if(_0x587832[_0x42e5('0x2f')]!==_0x42e5('0x3e')){var _0x340caf={};_0x340caf[_0x587832[_0x42e5('0x28')]]={'$like':'%'+_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x340caf;}})});}_0x201d9e=_[_0x42e5('0x3d')]({},_0x201d9e,_0x59a46b['options']);var _0x20f372={'where':_0x201d9e[_0x42e5('0x3c')]};return db['ZendeskAccount'][_0x42e5('0x20')](_0x20f372)['then'](function(_0x53b0bd){_0x2c53d4['count']=_0x53b0bd;if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x201d9e[_0x42e5('0x40')]=[{'all':!![]}];}return db[_0x42e5('0x2c')][_0x42e5('0x41')](_0x201d9e);})[_0x42e5('0x25')](function(_0x1fbde){_0x2c53d4['rows']=_0x1fbde;return _0x2c53d4;})[_0x42e5('0x25')](respondWithFilteredResult(_0x3e2ea5,_0x201d9e))[_0x42e5('0x42')](handleError(_0x3e2ea5,null));};exports['show']=function(_0x398b73,_0x1c697a){var _0x5db771={'raw':![],'where':{'id':_0x398b73[_0x42e5('0x43')]['id']}},_0x33054f={};_0x33054f[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x2c')]['rawAttributes']);_0x33054f[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x398b73[_0x42e5('0x32')]);_0x33054f[_0x42e5('0x39')]=_['intersection'](_0x33054f[_0x42e5('0x31')],_0x33054f[_0x42e5('0x32')]);_0x5db771[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x33054f[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x398b73[_0x42e5('0x32')][_0x42e5('0x35')]));_0x5db771['attributes']=_0x5db771[_0x42e5('0x34')]['length']?_0x5db771['attributes']:_0x33054f[_0x42e5('0x31')];if(_0x398b73[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x5db771[_0x42e5('0x40')]=[{'all':!![]}];}_0x5db771=_[_0x42e5('0x3d')]({},_0x5db771,_0x398b73[_0x42e5('0x45')]);return db[_0x42e5('0x2c')]['find'](_0x5db771)[_0x42e5('0x25')](handleEntityNotFound(_0x1c697a,null))[_0x42e5('0x25')](respondWithResult(_0x1c697a,null))[_0x42e5('0x42')](handleError(_0x1c697a,null));};exports[_0x42e5('0x46')]=function(_0x1086b2,_0xc8de4d){return db[_0x42e5('0x2c')][_0x42e5('0x46')](_0x1086b2['body'],{})[_0x42e5('0x25')](respondWithResult(_0xc8de4d,0xc9))[_0x42e5('0x42')](handleError(_0xc8de4d,null));};exports[_0x42e5('0x24')]=function(_0x48757e,_0x2ab52a){if(_0x48757e[_0x42e5('0x47')]['id']){delete _0x48757e[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x48757e['params']['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x2ab52a,null))['then'](saveUpdates(_0x48757e[_0x42e5('0x47')],null))[_0x42e5('0x25')](respondWithResult(_0x2ab52a,null))[_0x42e5('0x42')](handleError(_0x2ab52a,null));};exports['destroy']=function(_0x50f59c,_0x4f0639){return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x50f59c[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x4f0639,null))['then'](removeEntity(_0x4f0639,null))[_0x42e5('0x42')](handleError(_0x4f0639,null));};exports[_0x42e5('0x49')]=function(_0x18cedc,_0x504110,_0x34e169){var _0x5070aa={};var _0x319088={};var _0x2583cd;var _0x53e29b;return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x18cedc[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x504110,null))[_0x42e5('0x25')](function(_0x3f043f){if(_0x3f043f){_0x2583cd=_0x3f043f;_0x319088[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x4b')][_0x42e5('0x2d')]);_0x319088['query']=_[_0x42e5('0x33')](_0x18cedc[_0x42e5('0x32')]);_0x319088[_0x42e5('0x39')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],_0x319088['query']);_0x5070aa[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x18cedc['query']['fields']));_0x5070aa['attributes']=_0x5070aa[_0x42e5('0x34')][_0x42e5('0x4c')]?_0x5070aa['attributes']:_0x319088[_0x42e5('0x31')];_0x5070aa[_0x42e5('0x38')]=qs[_0x42e5('0x4d')](_0x18cedc[_0x42e5('0x32')][_0x42e5('0x4d')]);_0x5070aa[_0x42e5('0x3c')]=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x18cedc[_0x42e5('0x32')],_0x319088['filters']));if(_0x18cedc[_0x42e5('0x32')]['filter']){_0x5070aa[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x5070aa[_0x42e5('0x3c')],{'$or':_[_0x42e5('0x2b')](_0x5070aa[_0x42e5('0x34')],function(_0x3b46d2){var _0x248cb8={};_0x248cb8[_0x3b46d2]={'$like':'%'+_0x18cedc[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x248cb8;})});}_0x5070aa=_[_0x42e5('0x3d')]({},_0x5070aa,_0x18cedc[_0x42e5('0x45')]);return _0x2583cd['getConfigurations'](_0x5070aa);}})[_0x42e5('0x25')](function(_0x4ff58c){if(_0x4ff58c){_0x53e29b=_0x4ff58c[_0x42e5('0x4c')];if(!_0x18cedc['query'][_0x42e5('0x36')](_0x42e5('0x37'))){_0x5070aa['limit']=qs[_0x42e5('0x1f')](_0x18cedc[_0x42e5('0x32')]['limit']);_0x5070aa[_0x42e5('0x1d')]=qs[_0x42e5('0x1d')](_0x18cedc['query'][_0x42e5('0x1d')]);}return _0x2583cd[_0x42e5('0x49')](_0x5070aa);}})[_0x42e5('0x25')](function(_0x57814b){if(_0x57814b){return _0x57814b?{'count':_0x53e29b,'rows':_0x57814b}:null;}})[_0x42e5('0x25')](respondWithResult(_0x504110,null))[_0x42e5('0x42')](handleError(_0x504110,null));};exports[_0x42e5('0x4e')]=function(_0x78394d,_0x57368e,_0x42db50){if(_0x78394d['body']['id']){delete _0x78394d[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x78394d[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x57368e,null))[_0x42e5('0x25')](function(_0x15ff42){if(_0x15ff42){_0x78394d['body'][_0x42e5('0x4f')]=_0x15ff42['id'];_0x78394d[_0x42e5('0x47')][_0x42e5('0x50')]=integrations[_0x42e5('0x51')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')][_0x42e5('0x2f')]);_0x78394d[_0x42e5('0x47')]['Descriptions']=integrations[_0x42e5('0x53')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')]['type']);return db[_0x42e5('0x4b')][_0x42e5('0x46')](_0x78394d[_0x42e5('0x47')],{'include':[{'model':db[_0x42e5('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x42e5('0x25')](respondWithResult(_0x57368e,null))[_0x42e5('0x42')](handleError(_0x57368e,null));};exports[_0x42e5('0x55')]=function(_0x2ce1d4,_0xb198d,_0x14d111){var _0x1cfe79='';return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x2ce1d4['params']['id']},'attributes':['id',_0x42e5('0x56'),_0x42e5('0x57'),_0x42e5('0x58'),_0x42e5('0x59'),_0x42e5('0x5a')]})[_0x42e5('0x25')](handleEntityNotFound(_0xb198d,null))[_0x42e5('0x25')](function(_0x147613){if(_0x147613){_0x1cfe79=_0x147613['remoteUri'];var _0x548f8a=_0x1cfe79[_0x42e5('0x5b')](-0x1);if(_0x548f8a==='/'){_0x1cfe79=_0x1cfe79[_0x42e5('0x5c')](0x0,_0x1cfe79['lastIndexOf'](_0x548f8a));}var _0x4b9559={'method':'GET','uri':util[_0x42e5('0x5d')](_0x42e5('0x5e'),_0x1cfe79,'ticket_fields'),'json':!![]};switch(_0x147613[_0x42e5('0x59')]){case _0x42e5('0x57'):_0x4b9559['headers']={'Authorization':util[_0x42e5('0x5d')](_0x42e5('0x5f'),new Buffer(util['format'](_0x42e5('0x60'),_0x147613['username'],_0x147613['password']))['toString']('base64'))};break;case _0x42e5('0x58'):_0x4b9559[_0x42e5('0x61')]={'Authorization':util['format'](_0x42e5('0x5f'),new Buffer(util[_0x42e5('0x5d')](_0x42e5('0x62'),_0x147613[_0x42e5('0x56')],_0x147613[_0x42e5('0x58')]))[_0x42e5('0x63')]('base64'))};break;default:throw new db[(_0x42e5('0x64'))][(_0x42e5('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x4b9559);}})['then'](function(_0x2faf9b){if(_0x2faf9b){var _0xfa822e=[_0x42e5('0x66'),_0x42e5('0x67'),_0x42e5('0x68'),_0x42e5('0x69')];_[_0x42e5('0x6a')](_0x2faf9b['ticket_fields'],function(_0x5a1b63){return _0xfa822e['includes'](_0x5a1b63['type']);});return{'count':_0x2faf9b[_0x42e5('0x6b')][_0x42e5('0x4c')],'rows':_['map'](_0x2faf9b[_0x42e5('0x6b')],function(_0x5debb1){return{'id':_0x5debb1['id'],'name':_0x5debb1[_0x42e5('0x6c')]>0x7?_0x5debb1[_0x42e5('0x6d')]:_0x5debb1[_0x42e5('0x2f')],'custom':_0x5debb1[_0x42e5('0x6c')]>0x7?!![]:![],'options':_0x5debb1[_0x42e5('0x6e')]?_0x5debb1[_0x42e5('0x6e')]:_0x5debb1[_0x42e5('0x6f')]?_0x5debb1[_0x42e5('0x6f')]:[]};})};}})[_0x42e5('0x25')](respondWithResult(_0xb198d,null))[_0x42e5('0x42')](function(_0x1ee9b2){var _0x78573b=_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?0x1f4:_0x1ee9b2[_0x42e5('0x71')]||0x1f4;logger[_0x42e5('0x72')](_0x42e5('0x73'),_0x42e5('0x55'),_0x78573b,JSON['stringify'](_0x1ee9b2));delete _0x1ee9b2[_0x42e5('0x28')];if(_0x78573b===0x191){_0x78573b=0x190;}_0xb198d[_0x42e5('0x1a')](_0x78573b)[_0x42e5('0x29')](_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?{'message':_0x42e5('0x74'),'statusCode':_0x1ee9b2[_0x42e5('0x71')]}:_0x1ee9b2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 87bb1b8..8f68b90 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 _0x043e=['exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x421acd,_0xa47dd0){var _0x43cdc2=function(_0x1faeba){while(--_0x1faeba){_0x421acd['push'](_0x421acd['shift']());}};_0x43cdc2(++_0xa47dd0);}(_0x043e,0xe3));var _0xe043=function(_0x28703a,_0xe84594){_0x28703a=_0x28703a-0x0;var _0x19aab6=_0x043e[_0x28703a];return _0x19aab6;};'use strict';var _=require(_0xe043('0x0'));var util=require(_0xe043('0x1'));var logger=require(_0xe043('0x2'))(_0xe043('0x3'));var moment=require(_0xe043('0x4'));var BPromise=require('bluebird');var rp=require(_0xe043('0x5'));var fs=require('fs');var path=require(_0xe043('0x6'));var rimraf=require(_0xe043('0x7'));var config=require(_0xe043('0x8'));var attributes=require(_0xe043('0x9'));var integrations=require(_0xe043('0xa'));module[_0xe043('0xb')]=function(_0xdce4d2,_0x3a40bc){return _0xdce4d2['define'](_0xe043('0xc'),attributes,{'tableName':_0xe043('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2e=['ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xfa2e,0x1c9));var _0xefa2=function(_0x4c79a2,_0x274c3d){_0x4c79a2=_0x4c79a2-0x0;var _0x4c64d8=_0xfa2e[_0x4c79a2];return _0x4c64d8;};'use strict';var _=require(_0xefa2('0x0'));var util=require(_0xefa2('0x1'));var logger=require(_0xefa2('0x2'))(_0xefa2('0x3'));var moment=require('moment');var BPromise=require(_0xefa2('0x4'));var rp=require(_0xefa2('0x5'));var fs=require('fs');var path=require(_0xefa2('0x6'));var rimraf=require(_0xefa2('0x7'));var config=require(_0xefa2('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xefa2('0x9'));module['exports']=function(_0x26f761,_0x53a375){return _0x26f761[_0xefa2('0xa')](_0xefa2('0xb'),attributes,{'tableName':'int_zendesk_accounts','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 d73c909..fca34ee 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 _0xe2c2=['stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowZendeskAccount','ZendeskAccount','find','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xe2c2,0xa1));var _0x2e2c=function(_0x2b58cd,_0x315d78){_0x2b58cd=_0x2b58cd-0x0;var _0x6e6ca6=_0xe2c2[_0x2b58cd];return _0x6e6ca6;};'use strict';var _=require(_0x2e2c('0x0'));var util=require(_0x2e2c('0x1'));var moment=require(_0x2e2c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e2c('0x3'));var db=require(_0x2e2c('0x4'))['db'];var utils=require(_0x2e2c('0x5'));var logger=require(_0x2e2c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2e2c('0x7'));var client=jayson['client'][_0x2e2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35de7b,_0x4b9d37,_0x2da7bc){return new BPromise(function(_0x557ced,_0x599db1){return client[_0x2e2c('0x9')](_0x35de7b,_0x2da7bc)[_0x2e2c('0xa')](function(_0x57cf89){logger['info'](_0x2e2c('0xb'),_0x4b9d37,_0x2e2c('0xc'));logger['debug'](_0x2e2c('0xd'),_0x4b9d37,'request\x20sent',JSON[_0x2e2c('0xe')](_0x57cf89));if(_0x57cf89['error']){if(_0x57cf89[_0x2e2c('0xf')][_0x2e2c('0x10')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4b9d37,_0x57cf89['error'][_0x2e2c('0x11')]);return _0x599db1(_0x57cf89[_0x2e2c('0xf')][_0x2e2c('0x11')]);}logger[_0x2e2c('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x4b9d37,_0x57cf89[_0x2e2c('0xf')][_0x2e2c('0x11')]);return _0x557ced(_0x57cf89[_0x2e2c('0xf')][_0x2e2c('0x11')]);}else{logger[_0x2e2c('0x12')](_0x2e2c('0xb'),_0x4b9d37,_0x2e2c('0xc'));_0x557ced(_0x57cf89[_0x2e2c('0x13')][_0x2e2c('0x11')]);}})[_0x2e2c('0x14')](function(_0x24358d){logger[_0x2e2c('0xf')](_0x2e2c('0xb'),_0x4b9d37,_0x24358d);_0x599db1(_0x24358d);});});}exports[_0x2e2c('0x15')]=function(_0x264eb3){var _0x476259=this;return new Promise(function(_0x172a25,_0x3f6b4e){return db['ZendeskAccount'][_0x2e2c('0x16')]({'raw':_0x264eb3[_0x2e2c('0x17')]?_0x264eb3[_0x2e2c('0x17')][_0x2e2c('0x18')]===undefined?!![]:![]:!![],'where':_0x264eb3[_0x2e2c('0x17')]?_0x264eb3[_0x2e2c('0x17')][_0x2e2c('0x19')]||null:null,'attributes':_0x264eb3[_0x2e2c('0x17')]?_0x264eb3['options'][_0x2e2c('0x1a')]||null:null,'limit':_0x264eb3[_0x2e2c('0x17')]?_0x264eb3[_0x2e2c('0x17')][_0x2e2c('0x1b')]||null:null,'include':_0x264eb3[_0x2e2c('0x17')]?_0x264eb3[_0x2e2c('0x17')]['include']?_[_0x2e2c('0x1c')](_0x264eb3[_0x2e2c('0x17')][_0x2e2c('0x1d')],function(_0x31d3b5){return{'model':db[_0x31d3b5[_0x2e2c('0x1e')]],'as':_0x31d3b5['as'],'attributes':_0x31d3b5[_0x2e2c('0x1a')],'include':_0x31d3b5[_0x2e2c('0x1d')]?_[_0x2e2c('0x1c')](_0x31d3b5['include'],function(_0xcd992a){return{'model':db[_0xcd992a[_0x2e2c('0x1e')]],'as':_0xcd992a['as'],'attributes':_0xcd992a[_0x2e2c('0x1a')],'include':_0xcd992a[_0x2e2c('0x1d')]?_[_0x2e2c('0x1c')](_0xcd992a[_0x2e2c('0x1d')],function(_0x26940c){return{'model':db[_0x26940c[_0x2e2c('0x1e')]],'as':_0x26940c['as'],'attributes':_0x26940c[_0x2e2c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2e2c('0xa')](function(_0x32a6b0){logger[_0x2e2c('0x12')](_0x2e2c('0x15'),_0x264eb3);logger['debug'](_0x2e2c('0x15'),_0x264eb3,JSON[_0x2e2c('0xe')](_0x32a6b0));_0x172a25(_0x32a6b0);})['catch'](function(_0x415654){logger[_0x2e2c('0xf')](_0x2e2c('0x15'),_0x415654[_0x2e2c('0x11')],_0x264eb3);_0x3f6b4e(_0x476259['error'](0x1f4,_0x415654[_0x2e2c('0x11')]));});});};exports[_0x2e2c('0x1f')]=function(_0x712180){var _0x3fde3a=this;return new Promise(function(_0x4607e6,_0x26ecb1){return db[_0x2e2c('0x20')][_0x2e2c('0x21')]({'raw':_0x712180[_0x2e2c('0x17')]?_0x712180['options']['raw']===undefined?!![]:![]:!![],'where':_0x712180[_0x2e2c('0x17')]?_0x712180[_0x2e2c('0x17')][_0x2e2c('0x19')]||null:null,'attributes':_0x712180[_0x2e2c('0x17')]?_0x712180['options'][_0x2e2c('0x1a')]||null:null,'include':_0x712180[_0x2e2c('0x17')]?_0x712180[_0x2e2c('0x17')][_0x2e2c('0x1d')]?_[_0x2e2c('0x1c')](_0x712180['options'][_0x2e2c('0x1d')],function(_0x588060){return{'model':db[_0x588060[_0x2e2c('0x1e')]],'as':_0x588060['as'],'attributes':_0x588060[_0x2e2c('0x1a')],'include':_0x588060[_0x2e2c('0x1d')]?_['map'](_0x588060[_0x2e2c('0x1d')],function(_0x3f7c81){return{'model':db[_0x3f7c81['model']],'as':_0x3f7c81['as'],'attributes':_0x3f7c81[_0x2e2c('0x1a')],'include':_0x3f7c81[_0x2e2c('0x1d')]?_['map'](_0x3f7c81[_0x2e2c('0x1d')],function(_0x10a56d){return{'model':db[_0x10a56d[_0x2e2c('0x1e')]],'as':_0x10a56d['as'],'attributes':_0x10a56d[_0x2e2c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2e2c('0xa')](function(_0x1a6ef7){logger[_0x2e2c('0x12')](_0x2e2c('0x1f'),_0x712180);logger[_0x2e2c('0x22')](_0x2e2c('0x1f'),_0x712180,JSON[_0x2e2c('0xe')](_0x1a6ef7));_0x4607e6(_0x1a6ef7);})[_0x2e2c('0x14')](function(_0x2603c2){logger['error'](_0x2e2c('0x1f'),_0x2603c2['message'],_0x712180);_0x26ecb1(_0x3fde3a['error'](0x1f4,_0x2603c2[_0x2e2c('0x11')]));});});}; \ No newline at end of file +var _0x6994=['stringify','error','code','message','result','catch','ZendeskAccount,\x20%s,\x20%s','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent'];(function(_0x43bfbb,_0x221990){var _0x4cfc09=function(_0x28ce81){while(--_0x28ce81){_0x43bfbb['push'](_0x43bfbb['shift']());}};_0x4cfc09(++_0x221990);}(_0x6994,0x14c));var _0x4699=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x6994[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x4699('0x0'));var util=require(_0x4699('0x1'));var moment=require(_0x4699('0x2'));var BPromise=require(_0x4699('0x3'));var rs=require(_0x4699('0x4'));var fs=require('fs');var Redis=require(_0x4699('0x5'));var db=require(_0x4699('0x6'))['db'];var utils=require(_0x4699('0x7'));var logger=require(_0x4699('0x8'))(_0x4699('0x9'));var config=require(_0x4699('0xa'));var jayson=require(_0x4699('0xb'));var client=jayson[_0x4699('0xc')][_0x4699('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x173ead,_0x44de00,_0x3d3160){return new BPromise(function(_0x544451,_0x4595c5){return client[_0x4699('0xe')](_0x173ead,_0x3d3160)[_0x4699('0xf')](function(_0x57fba1){logger[_0x4699('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x44de00,'request\x20sent');logger[_0x4699('0x11')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x44de00,_0x4699('0x12'),JSON[_0x4699('0x13')](_0x57fba1));if(_0x57fba1[_0x4699('0x14')]){if(_0x57fba1[_0x4699('0x14')][_0x4699('0x15')]===0x1f4){logger[_0x4699('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x44de00,_0x57fba1[_0x4699('0x14')][_0x4699('0x16')]);return _0x4595c5(_0x57fba1[_0x4699('0x14')][_0x4699('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x44de00,_0x57fba1[_0x4699('0x14')][_0x4699('0x16')]);return _0x544451(_0x57fba1[_0x4699('0x14')]['message']);}else{logger[_0x4699('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x44de00,_0x4699('0x12'));_0x544451(_0x57fba1[_0x4699('0x17')][_0x4699('0x16')]);}})[_0x4699('0x18')](function(_0x10726c){logger[_0x4699('0x14')](_0x4699('0x19'),_0x44de00,_0x10726c);_0x4595c5(_0x10726c);});});}exports[_0x4699('0x1a')]=function(_0x34d6f3){var _0x18ccb7=this;return new Promise(function(_0x221a62,_0x11afa4){return db[_0x4699('0x1b')][_0x4699('0x1c')]({'raw':_0x34d6f3[_0x4699('0x1d')]?_0x34d6f3[_0x4699('0x1d')][_0x4699('0x1e')]===undefined?!![]:![]:!![],'where':_0x34d6f3[_0x4699('0x1d')]?_0x34d6f3[_0x4699('0x1d')][_0x4699('0x1f')]||null:null,'attributes':_0x34d6f3[_0x4699('0x1d')]?_0x34d6f3['options'][_0x4699('0x20')]||null:null,'limit':_0x34d6f3[_0x4699('0x1d')]?_0x34d6f3['options'][_0x4699('0x21')]||null:null,'include':_0x34d6f3[_0x4699('0x1d')]?_0x34d6f3['options'][_0x4699('0x22')]?_['map'](_0x34d6f3[_0x4699('0x1d')][_0x4699('0x22')],function(_0x51f10d){return{'model':db[_0x51f10d[_0x4699('0x23')]],'as':_0x51f10d['as'],'attributes':_0x51f10d[_0x4699('0x20')],'include':_0x51f10d[_0x4699('0x22')]?_[_0x4699('0x24')](_0x51f10d[_0x4699('0x22')],function(_0x38f3b3){return{'model':db[_0x38f3b3['model']],'as':_0x38f3b3['as'],'attributes':_0x38f3b3[_0x4699('0x20')],'include':_0x38f3b3[_0x4699('0x22')]?_[_0x4699('0x24')](_0x38f3b3[_0x4699('0x22')],function(_0x40c5a3){return{'model':db[_0x40c5a3['model']],'as':_0x40c5a3['as'],'attributes':_0x40c5a3[_0x4699('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4689){logger['info'](_0x4699('0x1a'),_0x34d6f3);logger[_0x4699('0x11')](_0x4699('0x1a'),_0x34d6f3,JSON[_0x4699('0x13')](_0x1b4689));_0x221a62(_0x1b4689);})[_0x4699('0x18')](function(_0x476645){logger[_0x4699('0x14')]('GetZendeskAccount',_0x476645[_0x4699('0x16')],_0x34d6f3);_0x11afa4(_0x18ccb7[_0x4699('0x14')](0x1f4,_0x476645[_0x4699('0x16')]));});});};exports[_0x4699('0x25')]=function(_0x5d9e8d){var _0x2d81d9=this;return new Promise(function(_0x29cd75,_0x1f271b){return db[_0x4699('0x1b')][_0x4699('0x26')]({'raw':_0x5d9e8d[_0x4699('0x1d')]?_0x5d9e8d['options'][_0x4699('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d9e8d[_0x4699('0x1d')]?_0x5d9e8d[_0x4699('0x1d')][_0x4699('0x1f')]||null:null,'attributes':_0x5d9e8d[_0x4699('0x1d')]?_0x5d9e8d['options'][_0x4699('0x20')]||null:null,'include':_0x5d9e8d['options']?_0x5d9e8d[_0x4699('0x1d')]['include']?_[_0x4699('0x24')](_0x5d9e8d[_0x4699('0x1d')]['include'],function(_0x3663b8){return{'model':db[_0x3663b8[_0x4699('0x23')]],'as':_0x3663b8['as'],'attributes':_0x3663b8['attributes'],'include':_0x3663b8[_0x4699('0x22')]?_[_0x4699('0x24')](_0x3663b8[_0x4699('0x22')],function(_0x83ba49){return{'model':db[_0x83ba49[_0x4699('0x23')]],'as':_0x83ba49['as'],'attributes':_0x83ba49[_0x4699('0x20')],'include':_0x83ba49[_0x4699('0x22')]?_[_0x4699('0x24')](_0x83ba49[_0x4699('0x22')],function(_0x31b822){return{'model':db[_0x31b822[_0x4699('0x23')]],'as':_0x31b822['as'],'attributes':_0x31b822['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55b512){logger[_0x4699('0x10')](_0x4699('0x25'),_0x5d9e8d);logger[_0x4699('0x11')]('ShowZendeskAccount',_0x5d9e8d,JSON['stringify'](_0x55b512));_0x29cd75(_0x55b512);})[_0x4699('0x18')](function(_0x424f35){logger[_0x4699('0x14')](_0x4699('0x25'),_0x424f35[_0x4699('0x16')],_0x5d9e8d);_0x1f271b(_0x2d81d9[_0x4699('0x14')](0x1f4,_0x424f35[_0x4699('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 877a757..a9fd0b4 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x3c809d,_0x5d6d4e){var _0x25d691=function(_0x4b69f8){while(--_0x4b69f8){_0x3c809d['push'](_0x3c809d['shift']());}};_0x25d691(++_0x5d6d4e);}(_0x91a7,0xe7));var _0x791a=function(_0x22b87f,_0x5a1b99){_0x22b87f=_0x22b87f-0x0;var _0x4cd96e=_0x91a7[_0x22b87f];return _0x4cd96e;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 79ce98a..2051fe1 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 _0x4a8e=['STRING','sequelize'];(function(_0x19104e,_0x54dfac){var _0x94c632=function(_0x4e757a){while(--_0x4e757a){_0x19104e['push'](_0x19104e['shift']());}};_0x94c632(++_0x54dfac);}(_0x4a8e,0x1db));var _0xe4a8=function(_0x972085,_0x326033){_0x972085=_0x972085-0x0;var _0x298ece=_0x4a8e[_0x972085];return _0x298ece;};'use strict';var Sequelize=require(_0xe4a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4a8('0x1')]},'description':{'type':Sequelize[_0xe4a8('0x1')]}}; \ No newline at end of file +var _0x6bab=['STRING','sequelize','exports'];(function(_0x48a036,_0x42dd6c){var _0x3981ce=function(_0x3c20a6){while(--_0x3c20a6){_0x48a036['push'](_0x48a036['shift']());}};_0x3981ce(++_0x42dd6c);}(_0x6bab,0x112));var _0xb6ba=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0x6bab[_0x3452a8];return _0x233814;};'use strict';var Sequelize=require(_0xb6ba('0x0'));module[_0xb6ba('0x1')]={'name':{'type':Sequelize[_0xb6ba('0x2')]},'description':{'type':Sequelize[_0xb6ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index da1df0f..6f4bf0a 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 _0xf5b0=['offset','undefined','count','set','apply','reject','save','then','destroy','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','update','body','getFields','findOne','ZendeskField','order','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json'];(function(_0x43b442,_0x316a2d){var _0x3fc998=function(_0x15c13e){while(--_0x15c13e){_0x43b442['push'](_0x43b442['shift']());}};_0x3fc998(++_0x316a2d);}(_0xf5b0,0x185));var _0x0f5b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf5b0[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x0f5b('0x0'));var rimraf=require(_0x0f5b('0x1'));var zipdir=require(_0x0f5b('0x2'));var jsonpatch=require(_0x0f5b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0f5b('0x4'));var path=require(_0x0f5b('0x5'));var sox=require(_0x0f5b('0x6'));var csv=require('to-csv');var ejs=require(_0x0f5b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f5b('0x8'));var squel=require(_0x0f5b('0x9'));var crypto=require('crypto');var jsforce=require(_0x0f5b('0xa'));var deskjs=require(_0x0f5b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0f5b('0xc'));var Papa=require(_0x0f5b('0xd'));var Redis=require(_0x0f5b('0xe'));var authService=require(_0x0f5b('0xf'));var qs=require(_0x0f5b('0x10'));var as=require(_0x0f5b('0x11'));var hardwareService=require(_0x0f5b('0x12'));var logger=require(_0x0f5b('0x13'))(_0x0f5b('0x14'));var utils=require(_0x0f5b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f5b('0x16'))['db'];function respondWithStatusCode(_0xa531a6,_0x5bab39){_0x5bab39=_0x5bab39||0xcc;return function(_0x3963d0){if(_0x3963d0){return _0xa531a6[_0x0f5b('0x17')](_0x5bab39);}return _0xa531a6[_0x0f5b('0x18')](_0x5bab39)['end']();};}function respondWithResult(_0x26ff4b,_0x198949){_0x198949=_0x198949||0xc8;return function(_0x1af3db){if(_0x1af3db){return _0x26ff4b[_0x0f5b('0x18')](_0x198949)[_0x0f5b('0x19')](_0x1af3db);}};}function respondWithFilteredResult(_0x4dc0a9,_0x206814){return function(_0x43734f){if(_0x43734f){var _0x2c7d01=typeof _0x206814[_0x0f5b('0x1a')]==='undefined'&&typeof _0x206814['limit']===_0x0f5b('0x1b');var _0x479daf=_0x43734f[_0x0f5b('0x1c')];var _0x218150=_0x2c7d01?0x0:_0x206814[_0x0f5b('0x1a')];var _0x4a9799=_0x2c7d01?_0x43734f[_0x0f5b('0x1c')]:_0x206814[_0x0f5b('0x1a')]+_0x206814['limit'];var _0x421127;if(_0x4a9799>=_0x479daf){_0x4a9799=_0x479daf;_0x421127=0xc8;}else{_0x421127=0xce;}_0x4dc0a9[_0x0f5b('0x18')](_0x421127);return _0x4dc0a9[_0x0f5b('0x1d')]('Content-Range',_0x218150+'-'+_0x4a9799+'/'+_0x479daf)[_0x0f5b('0x19')](_0x43734f);}return null;};}function patchUpdates(_0x3a3c72){return function(_0x58eb9d){try{jsonpatch[_0x0f5b('0x1e')](_0x58eb9d,_0x3a3c72,!![]);}catch(_0x50d920){return BPromise[_0x0f5b('0x1f')](_0x50d920);}return _0x58eb9d[_0x0f5b('0x20')]();};}function saveUpdates(_0x43c64f,_0x581c67){return function(_0x1a00ec){if(_0x1a00ec){return _0x1a00ec['update'](_0x43c64f)[_0x0f5b('0x21')](function(_0xf2483){return _0xf2483;});}return null;};}function removeEntity(_0x2d0825,_0x1ef7ef){return function(_0x5f2387){if(_0x5f2387){return _0x5f2387[_0x0f5b('0x22')]()[_0x0f5b('0x21')](function(){_0x2d0825[_0x0f5b('0x18')](0xcc)[_0x0f5b('0x23')]();});}};}function handleEntityNotFound(_0x5ea2c4,_0x401523){return function(_0x27602c){if(!_0x27602c){_0x5ea2c4[_0x0f5b('0x17')](0x194);}return _0x27602c;};}function handleError(_0x1240d2,_0x426fd1){_0x426fd1=_0x426fd1||0x1f4;return function(_0x5c4aae){logger[_0x0f5b('0x24')](_0x5c4aae['stack']);if(_0x5c4aae[_0x0f5b('0x25')]){delete _0x5c4aae[_0x0f5b('0x25')];}_0x1240d2['status'](_0x426fd1)[_0x0f5b('0x26')](_0x5c4aae);};}exports[_0x0f5b('0x27')]=function(_0x480ad6,_0x3e5f93){var _0x592c96={},_0x385854={},_0x585003={'count':0x0,'rows':[]};var _0x314d4f=_[_0x0f5b('0x28')](db[_0x0f5b('0x29')][_0x0f5b('0x2a')],function(_0xca8561){return{'name':_0xca8561[_0x0f5b('0x2b')],'type':_0xca8561[_0x0f5b('0x2c')][_0x0f5b('0x2d')]};});_0x385854[_0x0f5b('0x2e')]=_['map'](_0x314d4f,_0x0f5b('0x25'));_0x385854[_0x0f5b('0x2f')]=_[_0x0f5b('0x30')](_0x480ad6[_0x0f5b('0x2f')]);_0x385854[_0x0f5b('0x31')]=_[_0x0f5b('0x32')](_0x385854[_0x0f5b('0x2e')],_0x385854[_0x0f5b('0x2f')]);_0x592c96['attributes']=_[_0x0f5b('0x32')](_0x385854['model'],qs[_0x0f5b('0x33')](_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x33')]));_0x592c96[_0x0f5b('0x34')]=_0x592c96['attributes'][_0x0f5b('0x35')]?_0x592c96['attributes']:_0x385854[_0x0f5b('0x2e')];if(!_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x36')]('nolimit')){_0x592c96[_0x0f5b('0x37')]=qs[_0x0f5b('0x37')](_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x37')]);_0x592c96[_0x0f5b('0x1a')]=qs['offset'](_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x1a')]);}_0x592c96['order']=qs['sort'](_0x480ad6['query'][_0x0f5b('0x38')]);_0x592c96[_0x0f5b('0x39')]=qs[_0x0f5b('0x31')](_[_0x0f5b('0x3a')](_0x480ad6[_0x0f5b('0x2f')],_0x385854[_0x0f5b('0x31')]),_0x314d4f);if(_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x3b')]){_0x592c96[_0x0f5b('0x39')]=_[_0x0f5b('0x3c')](_0x592c96[_0x0f5b('0x39')],{'$or':_[_0x0f5b('0x28')](_0x314d4f,function(_0x333595){if(_0x333595['type']!=='VIRTUAL'){var _0x386c30={};_0x386c30[_0x333595['name']]={'$like':'%'+_0x480ad6['query'][_0x0f5b('0x3b')]+'%'};return _0x386c30;}})});}_0x592c96=_[_0x0f5b('0x3c')]({},_0x592c96,_0x480ad6[_0x0f5b('0x3d')]);var _0x12ce9e={'where':_0x592c96[_0x0f5b('0x39')]};return db[_0x0f5b('0x29')][_0x0f5b('0x1c')](_0x12ce9e)[_0x0f5b('0x21')](function(_0x408371){_0x585003['count']=_0x408371;if(_0x480ad6[_0x0f5b('0x2f')][_0x0f5b('0x3e')]){_0x592c96[_0x0f5b('0x3f')]=[{'all':!![]}];}return db[_0x0f5b('0x29')]['findAll'](_0x592c96);})[_0x0f5b('0x21')](function(_0x5b22d0){_0x585003[_0x0f5b('0x40')]=_0x5b22d0;return _0x585003;})[_0x0f5b('0x21')](respondWithFilteredResult(_0x3e5f93,_0x592c96))[_0x0f5b('0x41')](handleError(_0x3e5f93,null));};exports[_0x0f5b('0x42')]=function(_0xe0bf5d,_0x2bf2bd){var _0x5bb4d0={'raw':![],'where':{'id':_0xe0bf5d[_0x0f5b('0x43')]['id']}},_0x1a44b1={};_0x1a44b1['model']=_['keys'](db[_0x0f5b('0x29')][_0x0f5b('0x2a')]);_0x1a44b1['query']=_['keys'](_0xe0bf5d[_0x0f5b('0x2f')]);_0x1a44b1['filters']=_[_0x0f5b('0x32')](_0x1a44b1[_0x0f5b('0x2e')],_0x1a44b1['query']);_0x5bb4d0[_0x0f5b('0x34')]=_[_0x0f5b('0x32')](_0x1a44b1['model'],qs[_0x0f5b('0x33')](_0xe0bf5d[_0x0f5b('0x2f')]['fields']));_0x5bb4d0[_0x0f5b('0x34')]=_0x5bb4d0[_0x0f5b('0x34')][_0x0f5b('0x35')]?_0x5bb4d0[_0x0f5b('0x34')]:_0x1a44b1['model'];if(_0xe0bf5d[_0x0f5b('0x2f')][_0x0f5b('0x3e')]){_0x5bb4d0['include']=[{'all':!![]}];}_0x5bb4d0=_[_0x0f5b('0x3c')]({},_0x5bb4d0,_0xe0bf5d['options']);return db[_0x0f5b('0x29')][_0x0f5b('0x44')](_0x5bb4d0)[_0x0f5b('0x21')](handleEntityNotFound(_0x2bf2bd,null))[_0x0f5b('0x21')](respondWithResult(_0x2bf2bd,null))[_0x0f5b('0x41')](handleError(_0x2bf2bd,null));};exports[_0x0f5b('0x45')]=function(_0x249ae0,_0x5174f4){return db[_0x0f5b('0x29')][_0x0f5b('0x45')](_0x249ae0['body'],{})['then'](respondWithResult(_0x5174f4,0xc9))[_0x0f5b('0x41')](handleError(_0x5174f4,null));};exports[_0x0f5b('0x46')]=function(_0x78b4b9,_0x271c3c){if(_0x78b4b9[_0x0f5b('0x47')]['id']){delete _0x78b4b9['body']['id'];}return db['ZendeskConfiguration'][_0x0f5b('0x44')]({'where':{'id':_0x78b4b9[_0x0f5b('0x43')]['id']}})[_0x0f5b('0x21')](handleEntityNotFound(_0x271c3c,null))[_0x0f5b('0x21')](saveUpdates(_0x78b4b9[_0x0f5b('0x47')],null))[_0x0f5b('0x21')](respondWithResult(_0x271c3c,null))[_0x0f5b('0x41')](handleError(_0x271c3c,null));};exports[_0x0f5b('0x22')]=function(_0xbd8129,_0x42a30f){return db[_0x0f5b('0x29')][_0x0f5b('0x44')]({'where':{'id':_0xbd8129[_0x0f5b('0x43')]['id']}})[_0x0f5b('0x21')](handleEntityNotFound(_0x42a30f,null))[_0x0f5b('0x21')](removeEntity(_0x42a30f,null))[_0x0f5b('0x41')](handleError(_0x42a30f,null));};exports[_0x0f5b('0x48')]=function(_0x1e9c30,_0x5e622e,_0x37aaf2){var _0xb6c1e9={};var _0x34469e={};var _0x3856e5;var _0x5108d5;return db[_0x0f5b('0x29')][_0x0f5b('0x49')]({'where':{'id':_0x1e9c30[_0x0f5b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e622e,null))[_0x0f5b('0x21')](function(_0x1be03b){if(_0x1be03b){_0x3856e5=_0x1be03b;_0x34469e[_0x0f5b('0x2e')]=_['keys'](db[_0x0f5b('0x4a')][_0x0f5b('0x2a')]);_0x34469e[_0x0f5b('0x2f')]=_[_0x0f5b('0x30')](_0x1e9c30[_0x0f5b('0x2f')]);_0x34469e[_0x0f5b('0x31')]=_[_0x0f5b('0x32')](_0x34469e[_0x0f5b('0x2e')],_0x34469e[_0x0f5b('0x2f')]);_0xb6c1e9[_0x0f5b('0x34')]=_[_0x0f5b('0x32')](_0x34469e[_0x0f5b('0x2e')],qs[_0x0f5b('0x33')](_0x1e9c30[_0x0f5b('0x2f')][_0x0f5b('0x33')]));_0xb6c1e9[_0x0f5b('0x34')]=_0xb6c1e9[_0x0f5b('0x34')][_0x0f5b('0x35')]?_0xb6c1e9[_0x0f5b('0x34')]:_0x34469e[_0x0f5b('0x2e')];_0xb6c1e9[_0x0f5b('0x4b')]=qs[_0x0f5b('0x38')](_0x1e9c30['query'][_0x0f5b('0x38')]);_0xb6c1e9[_0x0f5b('0x39')]=qs[_0x0f5b('0x31')](_[_0x0f5b('0x3a')](_0x1e9c30[_0x0f5b('0x2f')],_0x34469e[_0x0f5b('0x31')]));if(_0x1e9c30[_0x0f5b('0x2f')][_0x0f5b('0x3b')]){_0xb6c1e9[_0x0f5b('0x39')]=_[_0x0f5b('0x3c')](_0xb6c1e9[_0x0f5b('0x39')],{'$or':_['map'](_0xb6c1e9['attributes'],function(_0x1323df){var _0x10425c={};_0x10425c[_0x1323df]={'$like':'%'+_0x1e9c30[_0x0f5b('0x2f')][_0x0f5b('0x3b')]+'%'};return _0x10425c;})});}_0xb6c1e9=_['merge']({},_0xb6c1e9,_0x1e9c30[_0x0f5b('0x3d')]);return _0x3856e5[_0x0f5b('0x48')](_0xb6c1e9);}})['then'](function(_0x4f330e){if(_0x4f330e){_0x5108d5=_0x4f330e[_0x0f5b('0x35')];if(!_0x1e9c30[_0x0f5b('0x2f')]['hasOwnProperty']('nolimit')){_0xb6c1e9['limit']=qs[_0x0f5b('0x37')](_0x1e9c30[_0x0f5b('0x2f')][_0x0f5b('0x37')]);_0xb6c1e9[_0x0f5b('0x1a')]=qs[_0x0f5b('0x1a')](_0x1e9c30[_0x0f5b('0x2f')][_0x0f5b('0x1a')]);}return _0x3856e5[_0x0f5b('0x48')](_0xb6c1e9);}})['then'](function(_0x48362d){if(_0x48362d){return _0x48362d?{'count':_0x5108d5,'rows':_0x48362d}:null;}})['then'](respondWithResult(_0x5e622e,null))[_0x0f5b('0x41')](handleError(_0x5e622e,null));};exports[_0x0f5b('0x4c')]=function(_0x54274f,_0x4a982b,_0x30840c){var _0x17cb9a={};var _0xfe5a1a={};var _0x2adeb6;var _0x3762cd;return db['ZendeskConfiguration'][_0x0f5b('0x49')]({'where':{'id':_0x54274f[_0x0f5b('0x43')]['id']}})[_0x0f5b('0x21')](handleEntityNotFound(_0x4a982b,null))['then'](function(_0x51db2c){if(_0x51db2c){_0x2adeb6=_0x51db2c;_0xfe5a1a[_0x0f5b('0x2e')]=_[_0x0f5b('0x30')](db[_0x0f5b('0x4a')][_0x0f5b('0x2a')]);_0xfe5a1a[_0x0f5b('0x2f')]=_[_0x0f5b('0x30')](_0x54274f['query']);_0xfe5a1a[_0x0f5b('0x31')]=_[_0x0f5b('0x32')](_0xfe5a1a['model'],_0xfe5a1a[_0x0f5b('0x2f')]);_0x17cb9a[_0x0f5b('0x34')]=_['intersection'](_0xfe5a1a[_0x0f5b('0x2e')],qs['fields'](_0x54274f['query'][_0x0f5b('0x33')]));_0x17cb9a[_0x0f5b('0x34')]=_0x17cb9a[_0x0f5b('0x34')][_0x0f5b('0x35')]?_0x17cb9a[_0x0f5b('0x34')]:_0xfe5a1a[_0x0f5b('0x2e')];_0x17cb9a[_0x0f5b('0x4b')]=qs[_0x0f5b('0x38')](_0x54274f[_0x0f5b('0x2f')][_0x0f5b('0x38')]);_0x17cb9a[_0x0f5b('0x39')]=qs['filters'](_[_0x0f5b('0x3a')](_0x54274f[_0x0f5b('0x2f')],_0xfe5a1a['filters']));if(_0x54274f[_0x0f5b('0x2f')][_0x0f5b('0x3b')]){_0x17cb9a[_0x0f5b('0x39')]=_[_0x0f5b('0x3c')](_0x17cb9a['where'],{'$or':_[_0x0f5b('0x28')](_0x17cb9a[_0x0f5b('0x34')],function(_0x405417){var _0x3268b={};_0x3268b[_0x405417]={'$like':'%'+_0x54274f['query'][_0x0f5b('0x3b')]+'%'};return _0x3268b;})});}_0x17cb9a=_[_0x0f5b('0x3c')]({},_0x17cb9a,_0x54274f[_0x0f5b('0x3d')]);return _0x2adeb6['getSubjects'](_0x17cb9a);}})[_0x0f5b('0x21')](function(_0xfb6d5){if(_0xfb6d5){_0x3762cd=_0xfb6d5[_0x0f5b('0x35')];if(!_0x54274f[_0x0f5b('0x2f')][_0x0f5b('0x36')](_0x0f5b('0x4d'))){_0x17cb9a['limit']=qs[_0x0f5b('0x37')](_0x54274f[_0x0f5b('0x2f')][_0x0f5b('0x37')]);_0x17cb9a[_0x0f5b('0x1a')]=qs['offset'](_0x54274f['query'][_0x0f5b('0x1a')]);}return _0x2adeb6[_0x0f5b('0x4c')](_0x17cb9a);}})['then'](function(_0xe50f43){if(_0xe50f43){return _0xe50f43?{'count':_0x3762cd,'rows':_0xe50f43}:null;}})[_0x0f5b('0x21')](respondWithResult(_0x4a982b,null))[_0x0f5b('0x41')](handleError(_0x4a982b,null));};exports[_0x0f5b('0x4e')]=function(_0x5c309c,_0x2ff626,_0x4bc5a3){var _0x59acb0={};var _0x475bb3={};var _0x49d19e;var _0x4cae7c;return db['ZendeskConfiguration'][_0x0f5b('0x49')]({'where':{'id':_0x5c309c[_0x0f5b('0x43')]['id']}})[_0x0f5b('0x21')](handleEntityNotFound(_0x2ff626,null))[_0x0f5b('0x21')](function(_0x16ff5b){if(_0x16ff5b){_0x49d19e=_0x16ff5b;_0x475bb3[_0x0f5b('0x2e')]=_[_0x0f5b('0x30')](db['ZendeskField'][_0x0f5b('0x2a')]);_0x475bb3['query']=_[_0x0f5b('0x30')](_0x5c309c[_0x0f5b('0x2f')]);_0x475bb3['filters']=_['intersection'](_0x475bb3[_0x0f5b('0x2e')],_0x475bb3[_0x0f5b('0x2f')]);_0x59acb0['attributes']=_[_0x0f5b('0x32')](_0x475bb3['model'],qs[_0x0f5b('0x33')](_0x5c309c[_0x0f5b('0x2f')][_0x0f5b('0x33')]));_0x59acb0[_0x0f5b('0x34')]=_0x59acb0[_0x0f5b('0x34')]['length']?_0x59acb0[_0x0f5b('0x34')]:_0x475bb3[_0x0f5b('0x2e')];_0x59acb0[_0x0f5b('0x4b')]=qs[_0x0f5b('0x38')](_0x5c309c[_0x0f5b('0x2f')][_0x0f5b('0x38')]);_0x59acb0[_0x0f5b('0x39')]=qs[_0x0f5b('0x31')](_['pick'](_0x5c309c[_0x0f5b('0x2f')],_0x475bb3['filters']));if(_0x5c309c['query'][_0x0f5b('0x3b')]){_0x59acb0[_0x0f5b('0x39')]=_['merge'](_0x59acb0[_0x0f5b('0x39')],{'$or':_[_0x0f5b('0x28')](_0x59acb0[_0x0f5b('0x34')],function(_0x3eab2c){var _0x5dd045={};_0x5dd045[_0x3eab2c]={'$like':'%'+_0x5c309c['query']['filter']+'%'};return _0x5dd045;})});}_0x59acb0=_[_0x0f5b('0x3c')]({},_0x59acb0,_0x5c309c['options']);return _0x49d19e[_0x0f5b('0x4e')](_0x59acb0);}})[_0x0f5b('0x21')](function(_0x22b299){if(_0x22b299){_0x4cae7c=_0x22b299[_0x0f5b('0x35')];if(!_0x5c309c[_0x0f5b('0x2f')][_0x0f5b('0x36')](_0x0f5b('0x4d'))){_0x59acb0['limit']=qs[_0x0f5b('0x37')](_0x5c309c[_0x0f5b('0x2f')][_0x0f5b('0x37')]);_0x59acb0[_0x0f5b('0x1a')]=qs[_0x0f5b('0x1a')](_0x5c309c[_0x0f5b('0x2f')][_0x0f5b('0x1a')]);}return _0x49d19e[_0x0f5b('0x4e')](_0x59acb0);}})[_0x0f5b('0x21')](function(_0x4655cc){if(_0x4655cc){return _0x4655cc?{'count':_0x4cae7c,'rows':_0x4655cc}:null;}})[_0x0f5b('0x21')](respondWithResult(_0x2ff626,null))[_0x0f5b('0x41')](handleError(_0x2ff626,null));};exports[_0x0f5b('0x4f')]=function(_0x19c569,_0x424d43,_0x307196){var _0x4c1c58={};var _0x46feaf={};var _0x57c3f0;var _0x52f078;return db[_0x0f5b('0x29')][_0x0f5b('0x49')]({'where':{'id':_0x19c569[_0x0f5b('0x43')]['id']}})[_0x0f5b('0x21')](handleEntityNotFound(_0x424d43,null))['then'](function(_0x5b0637){if(_0x5b0637){_0x57c3f0=_0x5b0637;_0x46feaf[_0x0f5b('0x2e')]=_['keys'](db[_0x0f5b('0x50')]['rawAttributes']);_0x46feaf[_0x0f5b('0x2f')]=_[_0x0f5b('0x30')](_0x19c569[_0x0f5b('0x2f')]);_0x46feaf[_0x0f5b('0x31')]=_[_0x0f5b('0x32')](_0x46feaf['model'],_0x46feaf[_0x0f5b('0x2f')]);_0x4c1c58[_0x0f5b('0x34')]=_['intersection'](_0x46feaf[_0x0f5b('0x2e')],qs['fields'](_0x19c569[_0x0f5b('0x2f')]['fields']));_0x4c1c58[_0x0f5b('0x34')]=_0x4c1c58[_0x0f5b('0x34')][_0x0f5b('0x35')]?_0x4c1c58[_0x0f5b('0x34')]:_0x46feaf['model'];_0x4c1c58['order']=qs['sort'](_0x19c569[_0x0f5b('0x2f')][_0x0f5b('0x38')]);_0x4c1c58[_0x0f5b('0x39')]=qs[_0x0f5b('0x31')](_['pick'](_0x19c569['query'],_0x46feaf[_0x0f5b('0x31')]));if(_0x19c569[_0x0f5b('0x2f')]['filter']){_0x4c1c58['where']=_[_0x0f5b('0x3c')](_0x4c1c58['where'],{'$or':_['map'](_0x4c1c58[_0x0f5b('0x34')],function(_0xc36674){var _0x4a3730={};_0x4a3730[_0xc36674]={'$like':'%'+_0x19c569['query']['filter']+'%'};return _0x4a3730;})});}_0x4c1c58=_[_0x0f5b('0x3c')]({},_0x4c1c58,_0x19c569[_0x0f5b('0x3d')]);return _0x57c3f0['getTags'](_0x4c1c58);}})[_0x0f5b('0x21')](function(_0x488485){if(_0x488485){_0x52f078=_0x488485[_0x0f5b('0x35')];if(!_0x19c569['query'][_0x0f5b('0x36')]('nolimit')){_0x4c1c58[_0x0f5b('0x37')]=qs[_0x0f5b('0x37')](_0x19c569[_0x0f5b('0x2f')][_0x0f5b('0x37')]);_0x4c1c58[_0x0f5b('0x1a')]=qs[_0x0f5b('0x1a')](_0x19c569[_0x0f5b('0x2f')]['offset']);}return _0x57c3f0[_0x0f5b('0x4f')](_0x4c1c58);}})['then'](function(_0x4b544f){if(_0x4b544f){return _0x4b544f?{'count':_0x52f078,'rows':_0x4b544f}:null;}})[_0x0f5b('0x21')](respondWithResult(_0x424d43,null))[_0x0f5b('0x41')](handleError(_0x424d43,null));};exports[_0x0f5b('0x51')]=function(_0x58a782,_0xea9ffd,_0xf8b4ec){if(_0x58a782['body']['id']){delete _0x58a782[_0x0f5b('0x47')]['id'];}return db[_0x0f5b('0x29')][_0x0f5b('0x49')]({'where':{'id':_0x58a782[_0x0f5b('0x43')]['id']}})['then'](handleEntityNotFound(_0xea9ffd,null))[_0x0f5b('0x21')](function(_0x209aa2){if(_0x209aa2){return _0x209aa2[_0x0f5b('0x51')](_0x58a782[_0x0f5b('0x47')][_0x0f5b('0x52')]||[]);}return null;})[_0x0f5b('0x21')](respondWithResult(_0xea9ffd,null))[_0x0f5b('0x41')](handleError(_0xea9ffd,null));}; \ No newline at end of file +var _0x0988=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','getFields','ZendeskField','options','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','crypto','desk.js','querystring'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0x0988,0x96));var _0x8098=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0x0988[_0xd307d9];return _0x209bf8;};'use strict';var emlformat=require(_0x8098('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8098('0x1'));var jsonpatch=require(_0x8098('0x2'));var rp=require(_0x8098('0x3'));var moment=require(_0x8098('0x4'));var BPromise=require(_0x8098('0x5'));var Mustache=require(_0x8098('0x6'));var util=require('util');var path=require(_0x8098('0x7'));var sox=require('sox');var csv=require(_0x8098('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(_0x8098('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8098('0xa'));var toCsv=require(_0x8098('0x8'));var querystring=require(_0x8098('0xb'));var Papa=require(_0x8098('0xc'));var Redis=require(_0x8098('0xd'));var authService=require(_0x8098('0xe'));var qs=require(_0x8098('0xf'));var as=require(_0x8098('0x10'));var hardwareService=require(_0x8098('0x11'));var logger=require('../../config/logger')(_0x8098('0x12'));var utils=require(_0x8098('0x13'));var config=require(_0x8098('0x14'));var licenseUtil=require(_0x8098('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1255a5,_0x1dadc7){_0x1dadc7=_0x1dadc7||0xcc;return function(_0x2453f3){if(_0x2453f3){return _0x1255a5[_0x8098('0x16')](_0x1dadc7);}return _0x1255a5[_0x8098('0x17')](_0x1dadc7)[_0x8098('0x18')]();};}function respondWithResult(_0x4278fd,_0x406b35){_0x406b35=_0x406b35||0xc8;return function(_0x24f1ec){if(_0x24f1ec){return _0x4278fd['status'](_0x406b35)['json'](_0x24f1ec);}};}function respondWithFilteredResult(_0x4b9d8d,_0x533f27){return function(_0xca49a2){if(_0xca49a2){var _0x23ca9b=typeof _0x533f27[_0x8098('0x19')]===_0x8098('0x1a')&&typeof _0x533f27[_0x8098('0x1b')]===_0x8098('0x1a');var _0x4456ee=_0xca49a2['count'];var _0x21239c=_0x23ca9b?0x0:_0x533f27[_0x8098('0x19')];var _0x119c81=_0x23ca9b?_0xca49a2[_0x8098('0x1c')]:_0x533f27[_0x8098('0x19')]+_0x533f27[_0x8098('0x1b')];var _0x538887;if(_0x119c81>=_0x4456ee){_0x119c81=_0x4456ee;_0x538887=0xc8;}else{_0x538887=0xce;}_0x4b9d8d[_0x8098('0x17')](_0x538887);return _0x4b9d8d[_0x8098('0x1d')]('Content-Range',_0x21239c+'-'+_0x119c81+'/'+_0x4456ee)['json'](_0xca49a2);}return null;};}function patchUpdates(_0x13764c){return function(_0x5389cd){try{jsonpatch[_0x8098('0x1e')](_0x5389cd,_0x13764c,!![]);}catch(_0x2e8dbf){return BPromise[_0x8098('0x1f')](_0x2e8dbf);}return _0x5389cd['save']();};}function saveUpdates(_0x3673d5,_0x340725){return function(_0x3ea773){if(_0x3ea773){return _0x3ea773[_0x8098('0x20')](_0x3673d5)[_0x8098('0x21')](function(_0x25d5d2){return _0x25d5d2;});}return null;};}function removeEntity(_0x4e8ac3,_0x2e45d5){return function(_0x29b496){if(_0x29b496){return _0x29b496[_0x8098('0x22')]()['then'](function(){_0x4e8ac3[_0x8098('0x17')](0xcc)[_0x8098('0x18')]();});}};}function handleEntityNotFound(_0x21946a,_0x2f91fe){return function(_0x2600ec){if(!_0x2600ec){_0x21946a[_0x8098('0x16')](0x194);}return _0x2600ec;};}function handleError(_0x370dad,_0x378124){_0x378124=_0x378124||0x1f4;return function(_0x4f3b5d){logger[_0x8098('0x23')](_0x4f3b5d[_0x8098('0x24')]);if(_0x4f3b5d[_0x8098('0x25')]){delete _0x4f3b5d['name'];}_0x370dad[_0x8098('0x17')](_0x378124)[_0x8098('0x26')](_0x4f3b5d);};}exports[_0x8098('0x27')]=function(_0x54b194,_0x536423){var _0x15ffd7={},_0x4f9411={},_0x3eee72={'count':0x0,'rows':[]};var _0x3dcf19=_[_0x8098('0x28')](db[_0x8098('0x29')][_0x8098('0x2a')],function(_0x3f946e){return{'name':_0x3f946e[_0x8098('0x2b')],'type':_0x3f946e[_0x8098('0x2c')][_0x8098('0x2d')]};});_0x4f9411[_0x8098('0x2e')]=_['map'](_0x3dcf19,_0x8098('0x25'));_0x4f9411['query']=_[_0x8098('0x2f')](_0x54b194[_0x8098('0x30')]);_0x4f9411[_0x8098('0x31')]=_[_0x8098('0x32')](_0x4f9411[_0x8098('0x2e')],_0x4f9411[_0x8098('0x30')]);_0x15ffd7[_0x8098('0x33')]=_['intersection'](_0x4f9411[_0x8098('0x2e')],qs[_0x8098('0x34')](_0x54b194['query'][_0x8098('0x34')]));_0x15ffd7['attributes']=_0x15ffd7[_0x8098('0x33')]['length']?_0x15ffd7[_0x8098('0x33')]:_0x4f9411['model'];if(!_0x54b194[_0x8098('0x30')]['hasOwnProperty'](_0x8098('0x35'))){_0x15ffd7[_0x8098('0x1b')]=qs['limit'](_0x54b194[_0x8098('0x30')][_0x8098('0x1b')]);_0x15ffd7[_0x8098('0x19')]=qs[_0x8098('0x19')](_0x54b194[_0x8098('0x30')][_0x8098('0x19')]);}_0x15ffd7[_0x8098('0x36')]=qs[_0x8098('0x37')](_0x54b194[_0x8098('0x30')][_0x8098('0x37')]);_0x15ffd7['where']=qs['filters'](_[_0x8098('0x38')](_0x54b194[_0x8098('0x30')],_0x4f9411[_0x8098('0x31')]),_0x3dcf19);if(_0x54b194[_0x8098('0x30')][_0x8098('0x39')]){_0x15ffd7[_0x8098('0x3a')]=_[_0x8098('0x3b')](_0x15ffd7['where'],{'$or':_[_0x8098('0x28')](_0x3dcf19,function(_0x1739ed){if(_0x1739ed[_0x8098('0x2c')]!=='VIRTUAL'){var _0x421421={};_0x421421[_0x1739ed['name']]={'$like':'%'+_0x54b194[_0x8098('0x30')][_0x8098('0x39')]+'%'};return _0x421421;}})});}_0x15ffd7=_[_0x8098('0x3b')]({},_0x15ffd7,_0x54b194['options']);var _0x376ce0={'where':_0x15ffd7['where']};return db['ZendeskConfiguration'][_0x8098('0x1c')](_0x376ce0)[_0x8098('0x21')](function(_0x25f381){_0x3eee72[_0x8098('0x1c')]=_0x25f381;if(_0x54b194[_0x8098('0x30')][_0x8098('0x3c')]){_0x15ffd7[_0x8098('0x3d')]=[{'all':!![]}];}return db[_0x8098('0x29')][_0x8098('0x3e')](_0x15ffd7);})['then'](function(_0x216f0b){_0x3eee72[_0x8098('0x3f')]=_0x216f0b;return _0x3eee72;})[_0x8098('0x21')](respondWithFilteredResult(_0x536423,_0x15ffd7))['catch'](handleError(_0x536423,null));};exports[_0x8098('0x40')]=function(_0x32c81c,_0x35312f){var _0x586124={'raw':![],'where':{'id':_0x32c81c['params']['id']}},_0x7714a7={};_0x7714a7[_0x8098('0x2e')]=_['keys'](db[_0x8098('0x29')][_0x8098('0x2a')]);_0x7714a7[_0x8098('0x30')]=_[_0x8098('0x2f')](_0x32c81c['query']);_0x7714a7[_0x8098('0x31')]=_[_0x8098('0x32')](_0x7714a7[_0x8098('0x2e')],_0x7714a7['query']);_0x586124[_0x8098('0x33')]=_[_0x8098('0x32')](_0x7714a7['model'],qs['fields'](_0x32c81c[_0x8098('0x30')][_0x8098('0x34')]));_0x586124[_0x8098('0x33')]=_0x586124['attributes'][_0x8098('0x41')]?_0x586124[_0x8098('0x33')]:_0x7714a7[_0x8098('0x2e')];if(_0x32c81c[_0x8098('0x30')][_0x8098('0x3c')]){_0x586124[_0x8098('0x3d')]=[{'all':!![]}];}_0x586124=_['merge']({},_0x586124,_0x32c81c['options']);return db[_0x8098('0x29')][_0x8098('0x42')](_0x586124)['then'](handleEntityNotFound(_0x35312f,null))[_0x8098('0x21')](respondWithResult(_0x35312f,null))[_0x8098('0x43')](handleError(_0x35312f,null));};exports[_0x8098('0x44')]=function(_0x45e213,_0x1a9a62){return db[_0x8098('0x29')][_0x8098('0x44')](_0x45e213[_0x8098('0x45')],{})[_0x8098('0x21')](respondWithResult(_0x1a9a62,0xc9))[_0x8098('0x43')](handleError(_0x1a9a62,null));};exports[_0x8098('0x20')]=function(_0x5d5332,_0x465aac){if(_0x5d5332[_0x8098('0x45')]['id']){delete _0x5d5332[_0x8098('0x45')]['id'];}return db[_0x8098('0x29')][_0x8098('0x42')]({'where':{'id':_0x5d5332[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x465aac,null))[_0x8098('0x21')](saveUpdates(_0x5d5332[_0x8098('0x45')],null))[_0x8098('0x21')](respondWithResult(_0x465aac,null))[_0x8098('0x43')](handleError(_0x465aac,null));};exports['destroy']=function(_0x31b030,_0x39c403){return db[_0x8098('0x29')][_0x8098('0x42')]({'where':{'id':_0x31b030[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x39c403,null))['then'](removeEntity(_0x39c403,null))[_0x8098('0x43')](handleError(_0x39c403,null));};exports[_0x8098('0x47')]=function(_0x277cad,_0x1a53e9,_0x1bb841){var _0x32b768={};var _0x1a16d8={};var _0xa7d55f;var _0x35b092;return db[_0x8098('0x29')]['findOne']({'where':{'id':_0x277cad[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x1a53e9,null))[_0x8098('0x21')](function(_0x3144fe){if(_0x3144fe){_0xa7d55f=_0x3144fe;_0x1a16d8[_0x8098('0x2e')]=_[_0x8098('0x2f')](db[_0x8098('0x48')]['rawAttributes']);_0x1a16d8['query']=_[_0x8098('0x2f')](_0x277cad['query']);_0x1a16d8[_0x8098('0x31')]=_[_0x8098('0x32')](_0x1a16d8[_0x8098('0x2e')],_0x1a16d8[_0x8098('0x30')]);_0x32b768['attributes']=_[_0x8098('0x32')](_0x1a16d8['model'],qs[_0x8098('0x34')](_0x277cad[_0x8098('0x30')][_0x8098('0x34')]));_0x32b768['attributes']=_0x32b768[_0x8098('0x33')]['length']?_0x32b768['attributes']:_0x1a16d8['model'];_0x32b768['order']=qs['sort'](_0x277cad[_0x8098('0x30')][_0x8098('0x37')]);_0x32b768[_0x8098('0x3a')]=qs['filters'](_[_0x8098('0x38')](_0x277cad[_0x8098('0x30')],_0x1a16d8[_0x8098('0x31')]));if(_0x277cad[_0x8098('0x30')][_0x8098('0x39')]){_0x32b768[_0x8098('0x3a')]=_['merge'](_0x32b768['where'],{'$or':_[_0x8098('0x28')](_0x32b768[_0x8098('0x33')],function(_0x3e3b49){var _0x259606={};_0x259606[_0x3e3b49]={'$like':'%'+_0x277cad[_0x8098('0x30')][_0x8098('0x39')]+'%'};return _0x259606;})});}_0x32b768=_[_0x8098('0x3b')]({},_0x32b768,_0x277cad[_0x8098('0x49')]);return _0xa7d55f['getFields'](_0x32b768);}})[_0x8098('0x21')](function(_0x2fb790){if(_0x2fb790){_0x35b092=_0x2fb790[_0x8098('0x41')];if(!_0x277cad[_0x8098('0x30')][_0x8098('0x4a')](_0x8098('0x35'))){_0x32b768[_0x8098('0x1b')]=qs[_0x8098('0x1b')](_0x277cad['query']['limit']);_0x32b768['offset']=qs['offset'](_0x277cad[_0x8098('0x30')]['offset']);}return _0xa7d55f[_0x8098('0x47')](_0x32b768);}})[_0x8098('0x21')](function(_0x4f95c6){if(_0x4f95c6){return _0x4f95c6?{'count':_0x35b092,'rows':_0x4f95c6}:null;}})[_0x8098('0x21')](respondWithResult(_0x1a53e9,null))[_0x8098('0x43')](handleError(_0x1a53e9,null));};exports[_0x8098('0x4b')]=function(_0x11ba26,_0x3ee71a,_0x583403){var _0x40ff29={};var _0x70e853={};var _0x18888d;var _0x125ea6;return db[_0x8098('0x29')][_0x8098('0x4c')]({'where':{'id':_0x11ba26[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x3ee71a,null))[_0x8098('0x21')](function(_0x210c16){if(_0x210c16){_0x18888d=_0x210c16;_0x70e853['model']=_[_0x8098('0x2f')](db[_0x8098('0x48')][_0x8098('0x2a')]);_0x70e853[_0x8098('0x30')]=_[_0x8098('0x2f')](_0x11ba26[_0x8098('0x30')]);_0x70e853[_0x8098('0x31')]=_['intersection'](_0x70e853[_0x8098('0x2e')],_0x70e853[_0x8098('0x30')]);_0x40ff29[_0x8098('0x33')]=_[_0x8098('0x32')](_0x70e853['model'],qs[_0x8098('0x34')](_0x11ba26[_0x8098('0x30')]['fields']));_0x40ff29['attributes']=_0x40ff29['attributes'][_0x8098('0x41')]?_0x40ff29[_0x8098('0x33')]:_0x70e853[_0x8098('0x2e')];_0x40ff29[_0x8098('0x36')]=qs[_0x8098('0x37')](_0x11ba26['query']['sort']);_0x40ff29['where']=qs[_0x8098('0x31')](_[_0x8098('0x38')](_0x11ba26[_0x8098('0x30')],_0x70e853['filters']));if(_0x11ba26[_0x8098('0x30')][_0x8098('0x39')]){_0x40ff29[_0x8098('0x3a')]=_[_0x8098('0x3b')](_0x40ff29[_0x8098('0x3a')],{'$or':_[_0x8098('0x28')](_0x40ff29[_0x8098('0x33')],function(_0xe5390c){var _0x50fef2={};_0x50fef2[_0xe5390c]={'$like':'%'+_0x11ba26[_0x8098('0x30')][_0x8098('0x39')]+'%'};return _0x50fef2;})});}_0x40ff29=_['merge']({},_0x40ff29,_0x11ba26['options']);return _0x18888d['getSubjects'](_0x40ff29);}})[_0x8098('0x21')](function(_0x34cff3){if(_0x34cff3){_0x125ea6=_0x34cff3['length'];if(!_0x11ba26[_0x8098('0x30')][_0x8098('0x4a')](_0x8098('0x35'))){_0x40ff29[_0x8098('0x1b')]=qs[_0x8098('0x1b')](_0x11ba26['query'][_0x8098('0x1b')]);_0x40ff29[_0x8098('0x19')]=qs[_0x8098('0x19')](_0x11ba26['query'][_0x8098('0x19')]);}return _0x18888d[_0x8098('0x4b')](_0x40ff29);}})['then'](function(_0x405e3a){if(_0x405e3a){return _0x405e3a?{'count':_0x125ea6,'rows':_0x405e3a}:null;}})['then'](respondWithResult(_0x3ee71a,null))[_0x8098('0x43')](handleError(_0x3ee71a,null));};exports[_0x8098('0x4d')]=function(_0x53d379,_0x1c0357,_0x2ac243){var _0x4219ee={};var _0x405eac={};var _0x22e604;var _0x3441ce;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x53d379[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x1c0357,null))['then'](function(_0x689688){if(_0x689688){_0x22e604=_0x689688;_0x405eac['model']=_[_0x8098('0x2f')](db[_0x8098('0x48')][_0x8098('0x2a')]);_0x405eac[_0x8098('0x30')]=_['keys'](_0x53d379[_0x8098('0x30')]);_0x405eac[_0x8098('0x31')]=_[_0x8098('0x32')](_0x405eac[_0x8098('0x2e')],_0x405eac[_0x8098('0x30')]);_0x4219ee[_0x8098('0x33')]=_[_0x8098('0x32')](_0x405eac[_0x8098('0x2e')],qs[_0x8098('0x34')](_0x53d379[_0x8098('0x30')][_0x8098('0x34')]));_0x4219ee[_0x8098('0x33')]=_0x4219ee[_0x8098('0x33')][_0x8098('0x41')]?_0x4219ee[_0x8098('0x33')]:_0x405eac['model'];_0x4219ee['order']=qs['sort'](_0x53d379[_0x8098('0x30')][_0x8098('0x37')]);_0x4219ee['where']=qs[_0x8098('0x31')](_[_0x8098('0x38')](_0x53d379[_0x8098('0x30')],_0x405eac[_0x8098('0x31')]));if(_0x53d379[_0x8098('0x30')][_0x8098('0x39')]){_0x4219ee['where']=_[_0x8098('0x3b')](_0x4219ee[_0x8098('0x3a')],{'$or':_[_0x8098('0x28')](_0x4219ee[_0x8098('0x33')],function(_0x4071f3){var _0x327e9d={};_0x327e9d[_0x4071f3]={'$like':'%'+_0x53d379[_0x8098('0x30')]['filter']+'%'};return _0x327e9d;})});}_0x4219ee=_[_0x8098('0x3b')]({},_0x4219ee,_0x53d379[_0x8098('0x49')]);return _0x22e604[_0x8098('0x4d')](_0x4219ee);}})['then'](function(_0x3228e1){if(_0x3228e1){_0x3441ce=_0x3228e1['length'];if(!_0x53d379[_0x8098('0x30')][_0x8098('0x4a')](_0x8098('0x35'))){_0x4219ee[_0x8098('0x1b')]=qs[_0x8098('0x1b')](_0x53d379[_0x8098('0x30')][_0x8098('0x1b')]);_0x4219ee[_0x8098('0x19')]=qs[_0x8098('0x19')](_0x53d379[_0x8098('0x30')][_0x8098('0x19')]);}return _0x22e604[_0x8098('0x4d')](_0x4219ee);}})['then'](function(_0xa9549a){if(_0xa9549a){return _0xa9549a?{'count':_0x3441ce,'rows':_0xa9549a}:null;}})[_0x8098('0x21')](respondWithResult(_0x1c0357,null))[_0x8098('0x43')](handleError(_0x1c0357,null));};exports[_0x8098('0x4e')]=function(_0x225a7b,_0x5ab92a,_0x573767){var _0x155e0f={};var _0x54094e={};var _0x2efbca;var _0xd116a1;return db['ZendeskConfiguration'][_0x8098('0x4c')]({'where':{'id':_0x225a7b[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x5ab92a,null))[_0x8098('0x21')](function(_0x1c6261){if(_0x1c6261){_0x2efbca=_0x1c6261;_0x54094e['model']=_['keys'](db[_0x8098('0x4f')][_0x8098('0x2a')]);_0x54094e[_0x8098('0x30')]=_[_0x8098('0x2f')](_0x225a7b[_0x8098('0x30')]);_0x54094e[_0x8098('0x31')]=_['intersection'](_0x54094e[_0x8098('0x2e')],_0x54094e['query']);_0x155e0f[_0x8098('0x33')]=_['intersection'](_0x54094e[_0x8098('0x2e')],qs[_0x8098('0x34')](_0x225a7b[_0x8098('0x30')][_0x8098('0x34')]));_0x155e0f['attributes']=_0x155e0f[_0x8098('0x33')][_0x8098('0x41')]?_0x155e0f[_0x8098('0x33')]:_0x54094e[_0x8098('0x2e')];_0x155e0f[_0x8098('0x36')]=qs[_0x8098('0x37')](_0x225a7b[_0x8098('0x30')][_0x8098('0x37')]);_0x155e0f['where']=qs[_0x8098('0x31')](_[_0x8098('0x38')](_0x225a7b[_0x8098('0x30')],_0x54094e['filters']));if(_0x225a7b[_0x8098('0x30')][_0x8098('0x39')]){_0x155e0f[_0x8098('0x3a')]=_[_0x8098('0x3b')](_0x155e0f[_0x8098('0x3a')],{'$or':_[_0x8098('0x28')](_0x155e0f[_0x8098('0x33')],function(_0x34fb68){var _0x2f1108={};_0x2f1108[_0x34fb68]={'$like':'%'+_0x225a7b[_0x8098('0x30')][_0x8098('0x39')]+'%'};return _0x2f1108;})});}_0x155e0f=_['merge']({},_0x155e0f,_0x225a7b['options']);return _0x2efbca[_0x8098('0x4e')](_0x155e0f);}})['then'](function(_0x350097){if(_0x350097){_0xd116a1=_0x350097['length'];if(!_0x225a7b[_0x8098('0x30')][_0x8098('0x4a')](_0x8098('0x35'))){_0x155e0f[_0x8098('0x1b')]=qs[_0x8098('0x1b')](_0x225a7b[_0x8098('0x30')][_0x8098('0x1b')]);_0x155e0f[_0x8098('0x19')]=qs[_0x8098('0x19')](_0x225a7b[_0x8098('0x30')]['offset']);}return _0x2efbca[_0x8098('0x4e')](_0x155e0f);}})[_0x8098('0x21')](function(_0x2b30ef){if(_0x2b30ef){return _0x2b30ef?{'count':_0xd116a1,'rows':_0x2b30ef}:null;}})[_0x8098('0x21')](respondWithResult(_0x5ab92a,null))[_0x8098('0x43')](handleError(_0x5ab92a,null));};exports['setTags']=function(_0x44bbf4,_0x483716,_0x4145bc){if(_0x44bbf4[_0x8098('0x45')]['id']){delete _0x44bbf4[_0x8098('0x45')]['id'];}return db[_0x8098('0x29')][_0x8098('0x4c')]({'where':{'id':_0x44bbf4[_0x8098('0x46')]['id']}})[_0x8098('0x21')](handleEntityNotFound(_0x483716,null))[_0x8098('0x21')](function(_0x2e10f0){if(_0x2e10f0){return _0x2e10f0['setTags'](_0x44bbf4[_0x8098('0x45')][_0x8098('0x50')]||[]);}return null;})[_0x8098('0x21')](respondWithResult(_0x483716,null))['catch'](handleError(_0x483716,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 29e5f38..4bd4f3e 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 _0xa30a=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var logger=require(_0xaa30('0x2'))('api');var moment=require(_0xaa30('0x3'));var BPromise=require(_0xaa30('0x4'));var rp=require(_0xaa30('0x5'));var fs=require('fs');var path=require(_0xaa30('0x6'));var rimraf=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var attributes=require(_0xaa30('0x9'));module['exports']=function(_0x347cd5,_0x4efe89){return _0x347cd5[_0xaa30('0xa')](_0xaa30('0xb'),attributes,{'tableName':_0xaa30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b4=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment'];(function(_0x2ca805,_0x397244){var _0x1ea430=function(_0x403d96){while(--_0x403d96){_0x2ca805['push'](_0x2ca805['shift']());}};_0x1ea430(++_0x397244);}(_0xf7b4,0x152));var _0x4f7b=function(_0xe8ad1d,_0x45ee4f){_0xe8ad1d=_0xe8ad1d-0x0;var _0x295f1e=_0xf7b4[_0xe8ad1d];return _0x295f1e;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 123e6e3..0aa7bc5 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 _0x1f43=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x1f43,0xa3));var _0x31f4=function(_0x5d4256,_0x181136){_0x5d4256=_0x5d4256-0x0;var _0x20b745=_0x1f43[_0x5d4256];return _0x20b745;};'use strict';var _=require(_0x31f4('0x0'));var util=require(_0x31f4('0x1'));var moment=require(_0x31f4('0x2'));var BPromise=require(_0x31f4('0x3'));var rs=require(_0x31f4('0x4'));var fs=require('fs');var Redis=require(_0x31f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x31f4('0x6'));var config=require('../../config/environment');var jayson=require(_0x31f4('0x7'));var client=jayson[_0x31f4('0x8')][_0x31f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38540f,_0x22800e,_0x48a7d9){return new BPromise(function(_0x1bdb42,_0x3efa93){return client[_0x31f4('0xa')](_0x38540f,_0x48a7d9)[_0x31f4('0xb')](function(_0x429d64){logger[_0x31f4('0xc')](_0x31f4('0xd'),_0x22800e,_0x31f4('0xe'));logger[_0x31f4('0xf')](_0x31f4('0x10'),_0x22800e,_0x31f4('0xe'),JSON[_0x31f4('0x11')](_0x429d64));if(_0x429d64[_0x31f4('0x12')]){if(_0x429d64[_0x31f4('0x12')][_0x31f4('0x13')]===0x1f4){logger['error'](_0x31f4('0xd'),_0x22800e,_0x429d64[_0x31f4('0x12')]['message']);return _0x3efa93(_0x429d64['error'][_0x31f4('0x14')]);}logger[_0x31f4('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x22800e,_0x429d64[_0x31f4('0x12')][_0x31f4('0x14')]);return _0x1bdb42(_0x429d64['error']['message']);}else{logger[_0x31f4('0xc')](_0x31f4('0xd'),_0x22800e,_0x31f4('0xe'));_0x1bdb42(_0x429d64[_0x31f4('0x15')][_0x31f4('0x14')]);}})[_0x31f4('0x16')](function(_0x11f746){logger[_0x31f4('0x12')](_0x31f4('0xd'),_0x22800e,_0x11f746);_0x3efa93(_0x11f746);});});} \ No newline at end of file +var _0x68d6=['info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x44f611,_0x3552a6){var _0x34962d=function(_0x54a85e){while(--_0x54a85e){_0x44f611['push'](_0x44f611['shift']());}};_0x34962d(++_0x3552a6);}(_0x68d6,0x9d));var _0x668d=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x68d6[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x668d('0x0'));var util=require('util');var moment=require(_0x668d('0x1'));var BPromise=require(_0x668d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x668d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x668d('0x4'))(_0x668d('0x5'));var config=require(_0x668d('0x6'));var jayson=require(_0x668d('0x7'));var client=jayson[_0x668d('0x8')][_0x668d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x291b5e,_0x5e5a9d,_0x195a69){return new BPromise(function(_0x13f76c,_0x1c45eb){return client[_0x668d('0xa')](_0x291b5e,_0x195a69)['then'](function(_0x59067b){logger[_0x668d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e5a9d,_0x668d('0xc'));logger[_0x668d('0xd')](_0x668d('0xe'),_0x5e5a9d,_0x668d('0xc'),JSON[_0x668d('0xf')](_0x59067b));if(_0x59067b[_0x668d('0x10')]){if(_0x59067b[_0x668d('0x10')]['code']===0x1f4){logger[_0x668d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e5a9d,_0x59067b['error'][_0x668d('0x11')]);return _0x1c45eb(_0x59067b[_0x668d('0x10')]['message']);}logger[_0x668d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e5a9d,_0x59067b[_0x668d('0x10')][_0x668d('0x11')]);return _0x13f76c(_0x59067b[_0x668d('0x10')]['message']);}else{logger[_0x668d('0xb')](_0x668d('0x12'),_0x5e5a9d,_0x668d('0xc'));_0x13f76c(_0x59067b[_0x668d('0x13')][_0x668d('0x11')]);}})[_0x668d('0x14')](function(_0x22bfc4){logger[_0x668d('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e5a9d,_0x22bfc4);_0x1c45eb(_0x22bfc4);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cddb895..cb1ae5a 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 _0xeda8=['post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ba8bb,_0x38617e){var _0x303e05=function(_0x4dc11e){while(--_0x4dc11e){_0x5ba8bb['push'](_0x5ba8bb['shift']());}};_0x303e05(++_0x38617e);}(_0xeda8,0x146));var _0x8eda=function(_0x3567f5,_0x15ad33){_0x3567f5=_0x3567f5-0x0;var _0x232dba=_0xeda8[_0x3567f5];return _0x232dba;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require(_0x8eda('0x2'));var timeout=require('connect-timeout');var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0x11')]);router['delete'](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller[_0x8eda('0x12')]);module[_0x8eda('0x13')]=router; \ No newline at end of file +var _0x1bc1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x132dc8,_0x299c11){var _0x272384=function(_0x59b7a6){while(--_0x59b7a6){_0x132dc8['push'](_0x132dc8['shift']());}};_0x272384(++_0x299c11);}(_0x1bc1,0x68));var _0x11bc=function(_0x50adb6,_0x282d46){_0x50adb6=_0x50adb6-0x0;var _0x1dbe47=_0x1bc1[_0x50adb6];return _0x1dbe47;};'use strict';var multer=require(_0x11bc('0x0'));var util=require('util');var path=require(_0x11bc('0x1'));var timeout=require(_0x11bc('0x2'));var express=require(_0x11bc('0x3'));var router=express[_0x11bc('0x4')]();var fs_extra=require(_0x11bc('0x5'));var auth=require(_0x11bc('0x6'));var interaction=require(_0x11bc('0x7'));var config=require(_0x11bc('0x8'));var controller=require(_0x11bc('0x9'));router[_0x11bc('0xa')]('/',auth[_0x11bc('0xb')](),controller[_0x11bc('0xc')]);router[_0x11bc('0xa')](_0x11bc('0xd'),auth['isAuthenticated'](),controller[_0x11bc('0xe')]);router[_0x11bc('0xf')]('/',auth[_0x11bc('0xb')](),controller[_0x11bc('0x10')]);router[_0x11bc('0x11')]('/:id',auth[_0x11bc('0xb')](),controller[_0x11bc('0x12')]);router[_0x11bc('0x13')](_0x11bc('0xd'),auth[_0x11bc('0xb')](),controller[_0x11bc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 38225a7..22f9451 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 _0x312f=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2993e4,_0x2af2db){var _0x4167b5=function(_0x2150a5){while(--_0x2150a5){_0x2993e4['push'](_0x2993e4['shift']());}};_0x4167b5(++_0x2af2db);}(_0x312f,0x155));var _0xf312=function(_0x33e479,_0x17072d){_0x33e479=_0x33e479-0x0;var _0x561824=_0x312f[_0x33e479];return _0x561824;};'use strict';var Sequelize=require(_0xf312('0x0'));module[_0xf312('0x1')]={'type':{'type':Sequelize[_0xf312('0x2')](_0xf312('0x3'),_0xf312('0x4'),_0xf312('0x5'),_0xf312('0x6'),_0xf312('0x7')),'defaultValue':_0xf312('0x3')},'content':{'type':Sequelize[_0xf312('0x8')]},'key':{'type':Sequelize[_0xf312('0x8')]},'keyType':{'type':Sequelize[_0xf312('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xf312('0x8')]},'idField':{'type':Sequelize[_0xf312('0x8')]},'nameField':{'type':Sequelize[_0xf312('0x8')]},'customField':{'type':Sequelize[_0xf312('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf312('0x8')]}}; \ No newline at end of file +var _0x0964=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING'];(function(_0xe88661,_0x4cc002){var _0x5d5eec=function(_0x52f218){while(--_0x52f218){_0xe88661['push'](_0xe88661['shift']());}};_0x5d5eec(++_0x4cc002);}(_0x0964,0xb9));var _0x4096=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0964[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4096('0x0'));module[_0x4096('0x1')]={'type':{'type':Sequelize[_0x4096('0x2')]('string',_0x4096('0x3'),'customVariable',_0x4096('0x4'),_0x4096('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4096('0x6')]},'key':{'type':Sequelize[_0x4096('0x6')]},'keyType':{'type':Sequelize[_0x4096('0x2')]('string',_0x4096('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4096('0x6')]},'idField':{'type':Sequelize[_0x4096('0x6')]},'nameField':{'type':Sequelize[_0x4096('0x6')]},'customField':{'type':Sequelize[_0x4096('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4096('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1f1eaf3..2961fca 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 _0x8441=['Content-Range','apply','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','ZendeskField','findAll','rows','catch','show','params','length','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0xd2d138,_0x55d264){var _0x371ae0=function(_0xfe505c){while(--_0xfe505c){_0xd2d138['push'](_0xd2d138['shift']());}};_0x371ae0(++_0x55d264);}(_0x8441,0x1dd));var _0x1844=function(_0x5945fa,_0x5b286c){_0x5945fa=_0x5945fa-0x0;var _0x367090=_0x8441[_0x5945fa];return _0x367090;};'use strict';var emlformat=require(_0x1844('0x0'));var rimraf=require(_0x1844('0x1'));var zipdir=require(_0x1844('0x2'));var jsonpatch=require(_0x1844('0x3'));var rp=require('request-promise');var moment=require(_0x1844('0x4'));var BPromise=require(_0x1844('0x5'));var Mustache=require('mustache');var util=require(_0x1844('0x6'));var path=require('path');var sox=require(_0x1844('0x7'));var csv=require('to-csv');var ejs=require(_0x1844('0x8'));var fs=require('fs');var fs_extra=require(_0x1844('0x9'));var _=require(_0x1844('0xa'));var squel=require(_0x1844('0xb'));var crypto=require(_0x1844('0xc'));var jsforce=require(_0x1844('0xd'));var deskjs=require(_0x1844('0xe'));var toCsv=require(_0x1844('0xf'));var querystring=require(_0x1844('0x10'));var Papa=require(_0x1844('0x11'));var Redis=require(_0x1844('0x12'));var authService=require(_0x1844('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1844('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1844('0x15'))(_0x1844('0x16'));var utils=require(_0x1844('0x17'));var config=require(_0x1844('0x18'));var licenseUtil=require(_0x1844('0x19'));var db=require(_0x1844('0x1a'))['db'];function respondWithStatusCode(_0x4293c9,_0x507794){_0x507794=_0x507794||0xcc;return function(_0x229db9){if(_0x229db9){return _0x4293c9[_0x1844('0x1b')](_0x507794);}return _0x4293c9[_0x1844('0x1c')](_0x507794)[_0x1844('0x1d')]();};}function respondWithResult(_0x10a3b8,_0x27e0cb){_0x27e0cb=_0x27e0cb||0xc8;return function(_0x204e97){if(_0x204e97){return _0x10a3b8[_0x1844('0x1c')](_0x27e0cb)['json'](_0x204e97);}};}function respondWithFilteredResult(_0x45665b,_0x67b9b7){return function(_0x32fe9b){if(_0x32fe9b){var _0x5b94e6=typeof _0x67b9b7[_0x1844('0x1e')]===_0x1844('0x1f')&&typeof _0x67b9b7[_0x1844('0x20')]===_0x1844('0x1f');var _0x586ebb=_0x32fe9b[_0x1844('0x21')];var _0x2935bb=_0x5b94e6?0x0:_0x67b9b7['offset'];var _0x37c49c=_0x5b94e6?_0x32fe9b[_0x1844('0x21')]:_0x67b9b7['offset']+_0x67b9b7['limit'];var _0x9f5705;if(_0x37c49c>=_0x586ebb){_0x37c49c=_0x586ebb;_0x9f5705=0xc8;}else{_0x9f5705=0xce;}_0x45665b[_0x1844('0x1c')](_0x9f5705);return _0x45665b['set'](_0x1844('0x22'),_0x2935bb+'-'+_0x37c49c+'/'+_0x586ebb)['json'](_0x32fe9b);}return null;};}function patchUpdates(_0x4c4b34){return function(_0x4976eb){try{jsonpatch[_0x1844('0x23')](_0x4976eb,_0x4c4b34,!![]);}catch(_0x577a79){return BPromise['reject'](_0x577a79);}return _0x4976eb[_0x1844('0x24')]();};}function saveUpdates(_0x396269,_0x54a297){return function(_0x2bcf28){if(_0x2bcf28){return _0x2bcf28[_0x1844('0x25')](_0x396269)['then'](function(_0x22c1ce){return _0x22c1ce;});}return null;};}function removeEntity(_0x3a2a87,_0x30b56a){return function(_0x8b9b23){if(_0x8b9b23){return _0x8b9b23[_0x1844('0x26')]()[_0x1844('0x27')](function(){_0x3a2a87['status'](0xcc)[_0x1844('0x1d')]();});}};}function handleEntityNotFound(_0x1ec1dc,_0x42caca){return function(_0x235ff8){if(!_0x235ff8){_0x1ec1dc['sendStatus'](0x194);}return _0x235ff8;};}function handleError(_0x19ec21,_0x24c106){_0x24c106=_0x24c106||0x1f4;return function(_0x2d55df){logger['error'](_0x2d55df['stack']);if(_0x2d55df['name']){delete _0x2d55df[_0x1844('0x28')];}_0x19ec21['status'](_0x24c106)['send'](_0x2d55df);};}exports[_0x1844('0x29')]=function(_0x19e971,_0x7f36fe){var _0x3cda77={},_0x2d5b43={},_0xd66651={'count':0x0,'rows':[]};var _0x548a08=_[_0x1844('0x2a')](db['ZendeskField'][_0x1844('0x2b')],function(_0x5ad2c5){return{'name':_0x5ad2c5[_0x1844('0x2c')],'type':_0x5ad2c5[_0x1844('0x2d')]['key']};});_0x2d5b43[_0x1844('0x2e')]=_[_0x1844('0x2a')](_0x548a08,_0x1844('0x28'));_0x2d5b43[_0x1844('0x2f')]=_[_0x1844('0x30')](_0x19e971['query']);_0x2d5b43[_0x1844('0x31')]=_[_0x1844('0x32')](_0x2d5b43['model'],_0x2d5b43[_0x1844('0x2f')]);_0x3cda77[_0x1844('0x33')]=_[_0x1844('0x32')](_0x2d5b43[_0x1844('0x2e')],qs[_0x1844('0x34')](_0x19e971['query'][_0x1844('0x34')]));_0x3cda77['attributes']=_0x3cda77[_0x1844('0x33')]['length']?_0x3cda77[_0x1844('0x33')]:_0x2d5b43[_0x1844('0x2e')];if(!_0x19e971[_0x1844('0x2f')][_0x1844('0x35')]('nolimit')){_0x3cda77[_0x1844('0x20')]=qs[_0x1844('0x20')](_0x19e971['query'][_0x1844('0x20')]);_0x3cda77[_0x1844('0x1e')]=qs[_0x1844('0x1e')](_0x19e971[_0x1844('0x2f')][_0x1844('0x1e')]);}_0x3cda77[_0x1844('0x36')]=qs[_0x1844('0x37')](_0x19e971['query'][_0x1844('0x37')]);_0x3cda77['where']=qs[_0x1844('0x31')](_['pick'](_0x19e971[_0x1844('0x2f')],_0x2d5b43[_0x1844('0x31')]),_0x548a08);if(_0x19e971[_0x1844('0x2f')]['filter']){_0x3cda77[_0x1844('0x38')]=_['merge'](_0x3cda77[_0x1844('0x38')],{'$or':_[_0x1844('0x2a')](_0x548a08,function(_0x246af5){if(_0x246af5[_0x1844('0x2d')]!==_0x1844('0x39')){var _0x4ba2ed={};_0x4ba2ed[_0x246af5[_0x1844('0x28')]]={'$like':'%'+_0x19e971[_0x1844('0x2f')][_0x1844('0x3a')]+'%'};return _0x4ba2ed;}})});}_0x3cda77=_[_0x1844('0x3b')]({},_0x3cda77,_0x19e971['options']);var _0x5a29b0={'where':_0x3cda77[_0x1844('0x38')]};return db[_0x1844('0x3c')][_0x1844('0x21')](_0x5a29b0)[_0x1844('0x27')](function(_0x449b16){_0xd66651['count']=_0x449b16;if(_0x19e971[_0x1844('0x2f')]['includeAll']){_0x3cda77['include']=[{'all':!![]}];}return db['ZendeskField'][_0x1844('0x3d')](_0x3cda77);})[_0x1844('0x27')](function(_0x1e0a1f){_0xd66651[_0x1844('0x3e')]=_0x1e0a1f;return _0xd66651;})[_0x1844('0x27')](respondWithFilteredResult(_0x7f36fe,_0x3cda77))[_0x1844('0x3f')](handleError(_0x7f36fe,null));};exports[_0x1844('0x40')]=function(_0x53a234,_0x3e2812){var _0x369839={'raw':!![],'where':{'id':_0x53a234[_0x1844('0x41')]['id']}},_0x25e650={};_0x25e650[_0x1844('0x2e')]=_[_0x1844('0x30')](db['ZendeskField'][_0x1844('0x2b')]);_0x25e650[_0x1844('0x2f')]=_[_0x1844('0x30')](_0x53a234[_0x1844('0x2f')]);_0x25e650[_0x1844('0x31')]=_[_0x1844('0x32')](_0x25e650[_0x1844('0x2e')],_0x25e650[_0x1844('0x2f')]);_0x369839['attributes']=_[_0x1844('0x32')](_0x25e650[_0x1844('0x2e')],qs['fields'](_0x53a234[_0x1844('0x2f')][_0x1844('0x34')]));_0x369839[_0x1844('0x33')]=_0x369839['attributes'][_0x1844('0x42')]?_0x369839[_0x1844('0x33')]:_0x25e650[_0x1844('0x2e')];if(_0x53a234['query'][_0x1844('0x43')]){_0x369839[_0x1844('0x44')]=[{'all':!![]}];}_0x369839=_[_0x1844('0x3b')]({},_0x369839,_0x53a234[_0x1844('0x45')]);return db[_0x1844('0x3c')][_0x1844('0x46')](_0x369839)[_0x1844('0x27')](handleEntityNotFound(_0x3e2812,null))[_0x1844('0x27')](respondWithResult(_0x3e2812,null))[_0x1844('0x3f')](handleError(_0x3e2812,null));};exports[_0x1844('0x47')]=function(_0x53b97a,_0x17f968){return db['ZendeskField'][_0x1844('0x47')](_0x53b97a[_0x1844('0x48')],{})[_0x1844('0x27')](respondWithResult(_0x17f968,0xc9))[_0x1844('0x3f')](handleError(_0x17f968,null));};exports['update']=function(_0x66d851,_0x3ee23c){if(_0x66d851[_0x1844('0x48')]['id']){delete _0x66d851[_0x1844('0x48')]['id'];}return db[_0x1844('0x3c')][_0x1844('0x46')]({'where':{'id':_0x66d851[_0x1844('0x41')]['id']}})[_0x1844('0x27')](handleEntityNotFound(_0x3ee23c,null))['then'](saveUpdates(_0x66d851['body'],null))[_0x1844('0x27')](respondWithResult(_0x3ee23c,null))[_0x1844('0x3f')](handleError(_0x3ee23c,null));};exports[_0x1844('0x26')]=function(_0x24db01,_0x5a3f8b){return db[_0x1844('0x3c')][_0x1844('0x46')]({'where':{'id':_0x24db01[_0x1844('0x41')]['id']}})[_0x1844('0x27')](handleEntityNotFound(_0x5a3f8b,null))['then'](removeEntity(_0x5a3f8b,null))[_0x1844('0x3f')](handleError(_0x5a3f8b,null));}; \ No newline at end of file +var _0x7323=['includeAll','findAll','rows','find','create','catch','update','body','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x14b523,_0x541598){var _0x5ae99f=function(_0x2b037c){while(--_0x2b037c){_0x14b523['push'](_0x14b523['shift']());}};_0x5ae99f(++_0x541598);}(_0x7323,0x171));var _0x3732=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x7323[_0x3afe18];return _0x19ed1f;};'use strict';var emlformat=require(_0x3732('0x0'));var rimraf=require(_0x3732('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3732('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3732('0x3'));var Mustache=require(_0x3732('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3732('0x5'));var csv=require(_0x3732('0x6'));var ejs=require(_0x3732('0x7'));var fs=require('fs');var fs_extra=require(_0x3732('0x8'));var _=require(_0x3732('0x9'));var squel=require(_0x3732('0xa'));var crypto=require(_0x3732('0xb'));var jsforce=require(_0x3732('0xc'));var deskjs=require(_0x3732('0xd'));var toCsv=require(_0x3732('0x6'));var querystring=require('querystring');var Papa=require(_0x3732('0xe'));var Redis=require(_0x3732('0xf'));var authService=require(_0x3732('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3732('0x11'));var logger=require('../../config/logger')(_0x3732('0x12'));var utils=require(_0x3732('0x13'));var config=require(_0x3732('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3732('0x15'))['db'];function respondWithStatusCode(_0x1b90a1,_0x30f36f){_0x30f36f=_0x30f36f||0xcc;return function(_0x57e55e){if(_0x57e55e){return _0x1b90a1[_0x3732('0x16')](_0x30f36f);}return _0x1b90a1[_0x3732('0x17')](_0x30f36f)['end']();};}function respondWithResult(_0x272daa,_0x1d3ff2){_0x1d3ff2=_0x1d3ff2||0xc8;return function(_0x2f8a50){if(_0x2f8a50){return _0x272daa[_0x3732('0x17')](_0x1d3ff2)[_0x3732('0x18')](_0x2f8a50);}};}function respondWithFilteredResult(_0x49d663,_0x3c0b56){return function(_0xec8efc){if(_0xec8efc){var _0x5c6922=typeof _0x3c0b56[_0x3732('0x19')]==='undefined'&&typeof _0x3c0b56[_0x3732('0x1a')]==='undefined';var _0x59391e=_0xec8efc[_0x3732('0x1b')];var _0x341dd4=_0x5c6922?0x0:_0x3c0b56['offset'];var _0x484a92=_0x5c6922?_0xec8efc[_0x3732('0x1b')]:_0x3c0b56[_0x3732('0x19')]+_0x3c0b56['limit'];var _0x59544c;if(_0x484a92>=_0x59391e){_0x484a92=_0x59391e;_0x59544c=0xc8;}else{_0x59544c=0xce;}_0x49d663[_0x3732('0x17')](_0x59544c);return _0x49d663[_0x3732('0x1c')](_0x3732('0x1d'),_0x341dd4+'-'+_0x484a92+'/'+_0x59391e)[_0x3732('0x18')](_0xec8efc);}return null;};}function patchUpdates(_0x5a7921){return function(_0x51277a){try{jsonpatch[_0x3732('0x1e')](_0x51277a,_0x5a7921,!![]);}catch(_0x2ef4ef){return BPromise['reject'](_0x2ef4ef);}return _0x51277a[_0x3732('0x1f')]();};}function saveUpdates(_0x2c6c4c,_0x12aa45){return function(_0x70db8d){if(_0x70db8d){return _0x70db8d['update'](_0x2c6c4c)[_0x3732('0x20')](function(_0x2780d2){return _0x2780d2;});}return null;};}function removeEntity(_0x9f5623,_0x3e1849){return function(_0x1fb489){if(_0x1fb489){return _0x1fb489[_0x3732('0x21')]()[_0x3732('0x20')](function(){_0x9f5623[_0x3732('0x17')](0xcc)[_0x3732('0x22')]();});}};}function handleEntityNotFound(_0x407b10,_0xa86063){return function(_0x218b40){if(!_0x218b40){_0x407b10[_0x3732('0x16')](0x194);}return _0x218b40;};}function handleError(_0x32d5dc,_0x517532){_0x517532=_0x517532||0x1f4;return function(_0x370edb){logger[_0x3732('0x23')](_0x370edb[_0x3732('0x24')]);if(_0x370edb['name']){delete _0x370edb[_0x3732('0x25')];}_0x32d5dc['status'](_0x517532)[_0x3732('0x26')](_0x370edb);};}exports[_0x3732('0x27')]=function(_0x31b21b,_0x61c638){var _0x4475c2={},_0x45e2f2={},_0x17e650={'count':0x0,'rows':[]};var _0x44dca0=_[_0x3732('0x28')](db[_0x3732('0x29')][_0x3732('0x2a')],function(_0x38ee71){return{'name':_0x38ee71['fieldName'],'type':_0x38ee71[_0x3732('0x2b')][_0x3732('0x2c')]};});_0x45e2f2[_0x3732('0x2d')]=_[_0x3732('0x28')](_0x44dca0,_0x3732('0x25'));_0x45e2f2[_0x3732('0x2e')]=_[_0x3732('0x2f')](_0x31b21b['query']);_0x45e2f2[_0x3732('0x30')]=_['intersection'](_0x45e2f2[_0x3732('0x2d')],_0x45e2f2[_0x3732('0x2e')]);_0x4475c2[_0x3732('0x31')]=_[_0x3732('0x32')](_0x45e2f2['model'],qs[_0x3732('0x33')](_0x31b21b['query'][_0x3732('0x33')]));_0x4475c2[_0x3732('0x31')]=_0x4475c2[_0x3732('0x31')][_0x3732('0x34')]?_0x4475c2[_0x3732('0x31')]:_0x45e2f2[_0x3732('0x2d')];if(!_0x31b21b[_0x3732('0x2e')][_0x3732('0x35')](_0x3732('0x36'))){_0x4475c2[_0x3732('0x1a')]=qs[_0x3732('0x1a')](_0x31b21b[_0x3732('0x2e')]['limit']);_0x4475c2[_0x3732('0x19')]=qs[_0x3732('0x19')](_0x31b21b[_0x3732('0x2e')][_0x3732('0x19')]);}_0x4475c2[_0x3732('0x37')]=qs[_0x3732('0x38')](_0x31b21b[_0x3732('0x2e')][_0x3732('0x38')]);_0x4475c2[_0x3732('0x39')]=qs[_0x3732('0x30')](_[_0x3732('0x3a')](_0x31b21b[_0x3732('0x2e')],_0x45e2f2[_0x3732('0x30')]),_0x44dca0);if(_0x31b21b[_0x3732('0x2e')][_0x3732('0x3b')]){_0x4475c2[_0x3732('0x39')]=_[_0x3732('0x3c')](_0x4475c2['where'],{'$or':_[_0x3732('0x28')](_0x44dca0,function(_0x3c1fe4){if(_0x3c1fe4[_0x3732('0x2b')]!==_0x3732('0x3d')){var _0x589df0={};_0x589df0[_0x3c1fe4[_0x3732('0x25')]]={'$like':'%'+_0x31b21b[_0x3732('0x2e')][_0x3732('0x3b')]+'%'};return _0x589df0;}})});}_0x4475c2=_[_0x3732('0x3c')]({},_0x4475c2,_0x31b21b[_0x3732('0x3e')]);var _0x38ec05={'where':_0x4475c2[_0x3732('0x39')]};return db[_0x3732('0x29')][_0x3732('0x1b')](_0x38ec05)['then'](function(_0x4b6f82){_0x17e650[_0x3732('0x1b')]=_0x4b6f82;if(_0x31b21b['query'][_0x3732('0x3f')]){_0x4475c2['include']=[{'all':!![]}];}return db[_0x3732('0x29')][_0x3732('0x40')](_0x4475c2);})[_0x3732('0x20')](function(_0x5e3c98){_0x17e650[_0x3732('0x41')]=_0x5e3c98;return _0x17e650;})[_0x3732('0x20')](respondWithFilteredResult(_0x61c638,_0x4475c2))['catch'](handleError(_0x61c638,null));};exports['show']=function(_0x4ce4c9,_0x1f0c8a){var _0x33d1ee={'raw':!![],'where':{'id':_0x4ce4c9['params']['id']}},_0x22994a={};_0x22994a['model']=_[_0x3732('0x2f')](db[_0x3732('0x29')][_0x3732('0x2a')]);_0x22994a[_0x3732('0x2e')]=_[_0x3732('0x2f')](_0x4ce4c9['query']);_0x22994a[_0x3732('0x30')]=_['intersection'](_0x22994a['model'],_0x22994a[_0x3732('0x2e')]);_0x33d1ee[_0x3732('0x31')]=_[_0x3732('0x32')](_0x22994a[_0x3732('0x2d')],qs[_0x3732('0x33')](_0x4ce4c9[_0x3732('0x2e')][_0x3732('0x33')]));_0x33d1ee[_0x3732('0x31')]=_0x33d1ee[_0x3732('0x31')][_0x3732('0x34')]?_0x33d1ee[_0x3732('0x31')]:_0x22994a[_0x3732('0x2d')];if(_0x4ce4c9[_0x3732('0x2e')]['includeAll']){_0x33d1ee['include']=[{'all':!![]}];}_0x33d1ee=_[_0x3732('0x3c')]({},_0x33d1ee,_0x4ce4c9[_0x3732('0x3e')]);return db[_0x3732('0x29')][_0x3732('0x42')](_0x33d1ee)[_0x3732('0x20')](handleEntityNotFound(_0x1f0c8a,null))['then'](respondWithResult(_0x1f0c8a,null))['catch'](handleError(_0x1f0c8a,null));};exports[_0x3732('0x43')]=function(_0x1a09b0,_0x178073){return db['ZendeskField'][_0x3732('0x43')](_0x1a09b0['body'],{})[_0x3732('0x20')](respondWithResult(_0x178073,0xc9))[_0x3732('0x44')](handleError(_0x178073,null));};exports[_0x3732('0x45')]=function(_0x1dd109,_0x553fe1){if(_0x1dd109[_0x3732('0x46')]['id']){delete _0x1dd109[_0x3732('0x46')]['id'];}return db[_0x3732('0x29')][_0x3732('0x42')]({'where':{'id':_0x1dd109[_0x3732('0x47')]['id']}})[_0x3732('0x20')](handleEntityNotFound(_0x553fe1,null))[_0x3732('0x20')](saveUpdates(_0x1dd109[_0x3732('0x46')],null))['then'](respondWithResult(_0x553fe1,null))[_0x3732('0x44')](handleError(_0x553fe1,null));};exports[_0x3732('0x21')]=function(_0x49c589,_0xe21ad9){return db[_0x3732('0x29')]['find']({'where':{'id':_0x49c589['params']['id']}})[_0x3732('0x20')](handleEntityNotFound(_0xe21ad9,null))[_0x3732('0x20')](removeEntity(_0xe21ad9,null))['catch'](handleError(_0xe21ad9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fa25254..0fe8334 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 _0x5fb2=['zendesk_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x5fb2,0x7b));var _0x25fb=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0x5fb2[_0x3727a9];return _0xa16806;};'use strict';var _=require(_0x25fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25fb('0x1'));var moment=require(_0x25fb('0x2'));var BPromise=require(_0x25fb('0x3'));var rp=require(_0x25fb('0x4'));var fs=require('fs');var path=require(_0x25fb('0x5'));var rimraf=require(_0x25fb('0x6'));var config=require('../../config/environment');var attributes=require(_0x25fb('0x7'));module[_0x25fb('0x8')]=function(_0x556322,_0xa7a8aa){return _0x556322[_0x25fb('0x9')](_0x25fb('0xa'),attributes,{'tableName':_0x25fb('0xb'),'paranoid':![],'indexes':[{'name':_0x25fb('0xc'),'fields':[_0x25fb('0xd'),_0x25fb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4572=['rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x371ffc,_0x361b2d){var _0x3fa4d3=function(_0x35b57a){while(--_0x35b57a){_0x371ffc['push'](_0x371ffc['shift']());}};_0x3fa4d3(++_0x361b2d);}(_0x4572,0x149));var _0x2457=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x4572[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require('lodash');var util=require(_0x2457('0x0'));var logger=require(_0x2457('0x1'))(_0x2457('0x2'));var moment=require(_0x2457('0x3'));var BPromise=require(_0x2457('0x4'));var rp=require(_0x2457('0x5'));var fs=require('fs');var path=require(_0x2457('0x6'));var rimraf=require(_0x2457('0x7'));var config=require(_0x2457('0x8'));var attributes=require(_0x2457('0x9'));module['exports']=function(_0x5241c6,_0x548874){return _0x5241c6[_0x2457('0xa')](_0x2457('0xb'),attributes,{'tableName':_0x2457('0xc'),'paranoid':![],'indexes':[{'name':_0x2457('0xd'),'fields':[_0x2457('0xe'),_0x2457('0xf')],'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 c18daa9..005ff6c 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 _0x61c0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x61c0,0xc5));var _0x061c=function(_0x4e4bd2,_0x1268dd){_0x4e4bd2=_0x4e4bd2-0x0;var _0x187ae2=_0x61c0[_0x4e4bd2];return _0x187ae2;};'use strict';var _=require('lodash');var util=require(_0x061c('0x0'));var moment=require(_0x061c('0x1'));var BPromise=require(_0x061c('0x2'));var rs=require(_0x061c('0x3'));var fs=require('fs');var Redis=require(_0x061c('0x4'));var db=require(_0x061c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x061c('0x6'))('rpc');var config=require(_0x061c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x061c('0x8')][_0x061c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x465eb2,_0x573a85,_0x173a96){return new BPromise(function(_0x26b5f3,_0x320eff){return client[_0x061c('0xa')](_0x465eb2,_0x173a96)[_0x061c('0xb')](function(_0x5476d9){logger[_0x061c('0xc')](_0x061c('0xd'),_0x573a85,_0x061c('0xe'));logger[_0x061c('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x573a85,'request\x20sent',JSON[_0x061c('0x10')](_0x5476d9));if(_0x5476d9['error']){if(_0x5476d9[_0x061c('0x11')][_0x061c('0x12')]===0x1f4){logger[_0x061c('0x11')](_0x061c('0xd'),_0x573a85,_0x5476d9[_0x061c('0x11')][_0x061c('0x13')]);return _0x320eff(_0x5476d9[_0x061c('0x11')][_0x061c('0x13')]);}logger[_0x061c('0x11')](_0x061c('0xd'),_0x573a85,_0x5476d9['error']['message']);return _0x26b5f3(_0x5476d9['error'][_0x061c('0x13')]);}else{logger[_0x061c('0xc')](_0x061c('0xd'),_0x573a85,_0x061c('0xe'));_0x26b5f3(_0x5476d9[_0x061c('0x14')]['message']);}})[_0x061c('0x15')](function(_0x16e273){logger[_0x061c('0x11')](_0x061c('0xd'),_0x573a85,_0x16e273);_0x320eff(_0x16e273);});});} \ No newline at end of file +var _0xae1e=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x33d369,_0x242433){var _0x119cae=function(_0xa90fd2){while(--_0xa90fd2){_0x33d369['push'](_0x33d369['shift']());}};_0x119cae(++_0x242433);}(_0xae1e,0xc3));var _0xeae1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xae1e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xeae1('0x0'));var util=require(_0xeae1('0x1'));var moment=require(_0xeae1('0x2'));var BPromise=require(_0xeae1('0x3'));var rs=require(_0xeae1('0x4'));var fs=require('fs');var Redis=require(_0xeae1('0x5'));var db=require(_0xeae1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeae1('0x7'))(_0xeae1('0x8'));var config=require(_0xeae1('0x9'));var jayson=require(_0xeae1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5adcd5,_0x989b86,_0x271be3){return new BPromise(function(_0x299463,_0x58d8c4){return client[_0xeae1('0xb')](_0x5adcd5,_0x271be3)['then'](function(_0x5c6961){logger['info'](_0xeae1('0xc'),_0x989b86,_0xeae1('0xd'));logger['debug'](_0xeae1('0xe'),_0x989b86,_0xeae1('0xd'),JSON['stringify'](_0x5c6961));if(_0x5c6961[_0xeae1('0xf')]){if(_0x5c6961[_0xeae1('0xf')]['code']===0x1f4){logger[_0xeae1('0xf')]('ZendeskField,\x20%s,\x20%s',_0x989b86,_0x5c6961[_0xeae1('0xf')][_0xeae1('0x10')]);return _0x58d8c4(_0x5c6961[_0xeae1('0xf')][_0xeae1('0x10')]);}logger[_0xeae1('0xf')](_0xeae1('0xc'),_0x989b86,_0x5c6961[_0xeae1('0xf')][_0xeae1('0x10')]);return _0x299463(_0x5c6961[_0xeae1('0xf')][_0xeae1('0x10')]);}else{logger[_0xeae1('0x11')]('ZendeskField,\x20%s,\x20%s',_0x989b86,_0xeae1('0xd'));_0x299463(_0x5c6961[_0xeae1('0x12')][_0xeae1('0x10')]);}})[_0xeae1('0x13')](function(_0x22d617){logger[_0xeae1('0xf')](_0xeae1('0xc'),_0x989b86,_0x22d617);_0x58d8c4(_0x22d617);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 57dab41..69f0be4 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 _0x2754=['addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','create','post'];(function(_0x4bee6e,_0x1f5859){var _0x4f549b=function(_0x222f54){while(--_0x222f54){_0x4bee6e['push'](_0x4bee6e['shift']());}};_0x4f549b(++_0x1f5859);}(_0x2754,0x1ba));var _0x4275=function(_0x2a92f6,_0x56fd62){_0x2a92f6=_0x2a92f6-0x0;var _0x66b923=_0x2754[_0x2a92f6];return _0x66b923;};'use strict';var multer=require(_0x4275('0x0'));var util=require('util');var path=require(_0x4275('0x1'));var timeout=require(_0x4275('0x2'));var express=require(_0x4275('0x3'));var router=express[_0x4275('0x4')]();var fs_extra=require(_0x4275('0x5'));var auth=require(_0x4275('0x6'));var interaction=require(_0x4275('0x7'));var config=require('../../config/environment');var controller=require(_0x4275('0x8'));router[_0x4275('0x9')]('/',auth['isAuthenticated'](),controller[_0x4275('0xa')]);router[_0x4275('0x9')](_0x4275('0xb'),auth[_0x4275('0xc')](),controller['show']);router[_0x4275('0x9')](_0x4275('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4275('0x9')](_0x4275('0xe'),auth['isAuthenticated'](),controller[_0x4275('0xf')]);router['post']('/',auth[_0x4275('0xc')](),controller[_0x4275('0x10')]);router[_0x4275('0x11')](_0x4275('0xd'),auth['isAuthenticated'](),controller[_0x4275('0x12')]);router[_0x4275('0x13')]('/:id',auth[_0x4275('0xc')](),controller['update']);router[_0x4275('0x14')](_0x4275('0xb'),auth[_0x4275('0xc')](),controller[_0x4275('0x15')]);module[_0x4275('0x16')]=router; \ No newline at end of file +var _0x5364=['util','path','express','fs-extra','../../config/environment','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','delete','destroy','exports','multer'];(function(_0xb38ec8,_0x51e246){var _0x3d3a30=function(_0x4a5a18){while(--_0x4a5a18){_0xb38ec8['push'](_0xb38ec8['shift']());}};_0x3d3a30(++_0x51e246);}(_0x5364,0xb3));var _0x4536=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x5364[_0x26260c];return _0x21f487;};'use strict';var multer=require(_0x4536('0x0'));var util=require(_0x4536('0x1'));var path=require(_0x4536('0x2'));var timeout=require('connect-timeout');var express=require(_0x4536('0x3'));var router=express['Router']();var fs_extra=require(_0x4536('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4536('0x5'));var controller=require(_0x4536('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4536('0x7')]);router[_0x4536('0x8')](_0x4536('0x9'),auth[_0x4536('0xa')](),controller['show']);router[_0x4536('0x8')](_0x4536('0xb'),auth[_0x4536('0xa')](),controller['getConfigurations']);router[_0x4536('0x8')](_0x4536('0xc'),auth[_0x4536('0xa')](),controller[_0x4536('0xd')]);router['post']('/',auth[_0x4536('0xa')](),controller[_0x4536('0xe')]);router[_0x4536('0xf')]('/:id/configurations',auth[_0x4536('0xa')](),controller[_0x4536('0x10')]);router['put'](_0x4536('0x9'),auth[_0x4536('0xa')](),controller['update']);router[_0x4536('0x11')](_0x4536('0x9'),auth[_0x4536('0xa')](),controller[_0x4536('0x12')]);module[_0x4536('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9834c69..4c249a9 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 _0xf4eb=['sequelize','STRING'];(function(_0xe2031c,_0x15f8af){var _0x1f6c24=function(_0x24755c){while(--_0x24755c){_0xe2031c['push'](_0xe2031c['shift']());}};_0x1f6c24(++_0x15f8af);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1736cc,_0x23741a){_0x1736cc=_0x1736cc-0x0;var _0x360f22=_0xf4eb[_0x1736cc];return _0x360f22;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file +var _0x54ef=['STRING','sequelize','exports'];(function(_0x417774,_0x1b95e6){var _0x10015d=function(_0x2526b3){while(--_0x2526b3){_0x417774['push'](_0x417774['shift']());}};_0x10015d(++_0x1b95e6);}(_0x54ef,0x112));var _0xf54e=function(_0x4a636b,_0x2c4931){_0x4a636b=_0x4a636b-0x0;var _0xe67c30=_0x54ef[_0x4a636b];return _0xe67c30;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 19f5db2..11c9d58 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 _0x9a8a=['findOne','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','ZohoConfiguration','getConfigurations','length','addConfiguration'];(function(_0x420444,_0xb8e41c){var _0x26cd50=function(_0x15b417){while(--_0x15b417){_0x420444['push'](_0x420444['shift']());}};_0x26cd50(++_0xb8e41c);}(_0x9a8a,0x1d9));var _0xa9a8=function(_0x3b1ca0,_0x5ae26b){_0x3b1ca0=_0x3b1ca0-0x0;var _0x32990c=_0x9a8a[_0x3b1ca0];return _0x32990c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9a8('0x0'));var zipdir=require(_0xa9a8('0x1'));var jsonpatch=require(_0xa9a8('0x2'));var rp=require('request-promise');var moment=require(_0xa9a8('0x3'));var BPromise=require(_0xa9a8('0x4'));var Mustache=require(_0xa9a8('0x5'));var util=require(_0xa9a8('0x6'));var path=require(_0xa9a8('0x7'));var sox=require(_0xa9a8('0x8'));var csv=require(_0xa9a8('0x9'));var ejs=require(_0xa9a8('0xa'));var fs=require('fs');var fs_extra=require(_0xa9a8('0xb'));var _=require(_0xa9a8('0xc'));var squel=require(_0xa9a8('0xd'));var crypto=require(_0xa9a8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9a8('0xf'));var Papa=require(_0xa9a8('0x10'));var Redis=require(_0xa9a8('0x11'));var authService=require(_0xa9a8('0x12'));var qs=require(_0xa9a8('0x13'));var as=require(_0xa9a8('0x14'));var hardwareService=require(_0xa9a8('0x15'));var logger=require(_0xa9a8('0x16'))(_0xa9a8('0x17'));var utils=require(_0xa9a8('0x18'));var config=require(_0xa9a8('0x19'));var licenseUtil=require(_0xa9a8('0x1a'));var db=require(_0xa9a8('0x1b'))['db'];var integrations=require(_0xa9a8('0x1c'));function respondWithStatusCode(_0xdfa7aa,_0xaff158){_0xaff158=_0xaff158||0xcc;return function(_0xf47fd9){if(_0xf47fd9){return _0xdfa7aa['sendStatus'](_0xaff158);}return _0xdfa7aa[_0xa9a8('0x1d')](_0xaff158)[_0xa9a8('0x1e')]();};}function respondWithResult(_0x1af85d,_0x153a5d){_0x153a5d=_0x153a5d||0xc8;return function(_0x2c74a6){if(_0x2c74a6){return _0x1af85d[_0xa9a8('0x1d')](_0x153a5d)[_0xa9a8('0x1f')](_0x2c74a6);}};}function respondWithFilteredResult(_0x233b36,_0x4304f3){return function(_0x5dcfdf){if(_0x5dcfdf){var _0x1d0260=typeof _0x4304f3[_0xa9a8('0x20')]===_0xa9a8('0x21')&&typeof _0x4304f3[_0xa9a8('0x22')]===_0xa9a8('0x21');var _0x536d4b=_0x5dcfdf['count'];var _0x4dd43f=_0x1d0260?0x0:_0x4304f3['offset'];var _0x81174a=_0x1d0260?_0x5dcfdf[_0xa9a8('0x23')]:_0x4304f3[_0xa9a8('0x20')]+_0x4304f3[_0xa9a8('0x22')];var _0x58550e;if(_0x81174a>=_0x536d4b){_0x81174a=_0x536d4b;_0x58550e=0xc8;}else{_0x58550e=0xce;}_0x233b36[_0xa9a8('0x1d')](_0x58550e);return _0x233b36[_0xa9a8('0x24')]('Content-Range',_0x4dd43f+'-'+_0x81174a+'/'+_0x536d4b)[_0xa9a8('0x1f')](_0x5dcfdf);}return null;};}function patchUpdates(_0x501f47){return function(_0x6959d8){try{jsonpatch[_0xa9a8('0x25')](_0x6959d8,_0x501f47,!![]);}catch(_0x1947ee){return BPromise[_0xa9a8('0x26')](_0x1947ee);}return _0x6959d8[_0xa9a8('0x27')]();};}function saveUpdates(_0x40ffa2,_0x5d53f0){return function(_0xda3b85){if(_0xda3b85){return _0xda3b85['update'](_0x40ffa2)[_0xa9a8('0x28')](function(_0x1c865d){return _0x1c865d;});}return null;};}function removeEntity(_0x4441be,_0x90e240){return function(_0x26dacd){if(_0x26dacd){return _0x26dacd[_0xa9a8('0x29')]()[_0xa9a8('0x28')](function(){_0x4441be['status'](0xcc)[_0xa9a8('0x1e')]();});}};}function handleEntityNotFound(_0x4e9f77,_0xd4b0ca){return function(_0x3726eb){if(!_0x3726eb){_0x4e9f77['sendStatus'](0x194);}return _0x3726eb;};}function handleError(_0x5d0a9e,_0x2e6a9e){_0x2e6a9e=_0x2e6a9e||0x1f4;return function(_0x576643){logger[_0xa9a8('0x2a')](_0x576643[_0xa9a8('0x2b')]);if(_0x576643['name']){delete _0x576643[_0xa9a8('0x2c')];}_0x5d0a9e[_0xa9a8('0x1d')](_0x2e6a9e)[_0xa9a8('0x2d')](_0x576643);};}exports[_0xa9a8('0x2e')]=function(_0x215299,_0x394561){var _0x1293d7={},_0x388396={},_0x50b1be={'count':0x0,'rows':[]};var _0x5b70d9=_['map'](db[_0xa9a8('0x2f')][_0xa9a8('0x30')],function(_0x150159){return{'name':_0x150159[_0xa9a8('0x31')],'type':_0x150159[_0xa9a8('0x32')][_0xa9a8('0x33')]};});_0x388396[_0xa9a8('0x34')]=_[_0xa9a8('0x35')](_0x5b70d9,'name');_0x388396[_0xa9a8('0x36')]=_['keys'](_0x215299['query']);_0x388396[_0xa9a8('0x37')]=_[_0xa9a8('0x38')](_0x388396[_0xa9a8('0x34')],_0x388396['query']);_0x1293d7[_0xa9a8('0x39')]=_['intersection'](_0x388396[_0xa9a8('0x34')],qs[_0xa9a8('0x3a')](_0x215299[_0xa9a8('0x36')]['fields']));_0x1293d7[_0xa9a8('0x39')]=_0x1293d7[_0xa9a8('0x39')]['length']?_0x1293d7[_0xa9a8('0x39')]:_0x388396['model'];if(!_0x215299['query'][_0xa9a8('0x3b')](_0xa9a8('0x3c'))){_0x1293d7[_0xa9a8('0x22')]=qs[_0xa9a8('0x22')](_0x215299[_0xa9a8('0x36')][_0xa9a8('0x22')]);_0x1293d7[_0xa9a8('0x20')]=qs[_0xa9a8('0x20')](_0x215299['query'][_0xa9a8('0x20')]);}_0x1293d7[_0xa9a8('0x3d')]=qs[_0xa9a8('0x3e')](_0x215299['query'][_0xa9a8('0x3e')]);_0x1293d7[_0xa9a8('0x3f')]=qs[_0xa9a8('0x37')](_[_0xa9a8('0x40')](_0x215299['query'],_0x388396['filters']),_0x5b70d9);if(_0x215299[_0xa9a8('0x36')][_0xa9a8('0x41')]){_0x1293d7[_0xa9a8('0x3f')]=_[_0xa9a8('0x42')](_0x1293d7[_0xa9a8('0x3f')],{'$or':_[_0xa9a8('0x35')](_0x5b70d9,function(_0x76819e){if(_0x76819e[_0xa9a8('0x32')]!==_0xa9a8('0x43')){var _0x3435ec={};_0x3435ec[_0x76819e[_0xa9a8('0x2c')]]={'$like':'%'+_0x215299[_0xa9a8('0x36')][_0xa9a8('0x41')]+'%'};return _0x3435ec;}})});}_0x1293d7=_[_0xa9a8('0x42')]({},_0x1293d7,_0x215299['options']);var _0x38046b={'where':_0x1293d7[_0xa9a8('0x3f')]};return db[_0xa9a8('0x2f')][_0xa9a8('0x23')](_0x38046b)['then'](function(_0x2fc1fb){_0x50b1be[_0xa9a8('0x23')]=_0x2fc1fb;if(_0x215299['query'][_0xa9a8('0x44')]){_0x1293d7[_0xa9a8('0x45')]=[{'all':!![]}];}return db[_0xa9a8('0x2f')][_0xa9a8('0x46')](_0x1293d7);})['then'](function(_0x10853e){_0x50b1be[_0xa9a8('0x47')]=_0x10853e;return _0x50b1be;})[_0xa9a8('0x28')](respondWithFilteredResult(_0x394561,_0x1293d7))[_0xa9a8('0x48')](handleError(_0x394561,null));};exports['show']=function(_0x1e2b45,_0x17e378){var _0x99f09f={'raw':![],'where':{'id':_0x1e2b45[_0xa9a8('0x49')]['id']}},_0x42ae06={};_0x42ae06[_0xa9a8('0x34')]=_[_0xa9a8('0x4a')](db['ZohoAccount'][_0xa9a8('0x30')]);_0x42ae06[_0xa9a8('0x36')]=_['keys'](_0x1e2b45[_0xa9a8('0x36')]);_0x42ae06[_0xa9a8('0x37')]=_[_0xa9a8('0x38')](_0x42ae06[_0xa9a8('0x34')],_0x42ae06['query']);_0x99f09f[_0xa9a8('0x39')]=_['intersection'](_0x42ae06[_0xa9a8('0x34')],qs[_0xa9a8('0x3a')](_0x1e2b45[_0xa9a8('0x36')]['fields']));_0x99f09f[_0xa9a8('0x39')]=_0x99f09f[_0xa9a8('0x39')]['length']?_0x99f09f[_0xa9a8('0x39')]:_0x42ae06[_0xa9a8('0x34')];if(_0x1e2b45['query'][_0xa9a8('0x44')]){_0x99f09f[_0xa9a8('0x45')]=[{'all':!![]}];}_0x99f09f=_[_0xa9a8('0x42')]({},_0x99f09f,_0x1e2b45[_0xa9a8('0x4b')]);return db[_0xa9a8('0x2f')]['find'](_0x99f09f)[_0xa9a8('0x28')](handleEntityNotFound(_0x17e378,null))[_0xa9a8('0x28')](respondWithResult(_0x17e378,null))[_0xa9a8('0x48')](handleError(_0x17e378,null));};exports[_0xa9a8('0x4c')]=function(_0x1f3329,_0x2c030d){return db['ZohoAccount'][_0xa9a8('0x4c')](_0x1f3329[_0xa9a8('0x4d')],{})[_0xa9a8('0x28')](respondWithResult(_0x2c030d,0xc9))[_0xa9a8('0x48')](handleError(_0x2c030d,null));};exports['update']=function(_0x2b1ed0,_0x271f2){if(_0x2b1ed0[_0xa9a8('0x4d')]['id']){delete _0x2b1ed0[_0xa9a8('0x4d')]['id'];}return db[_0xa9a8('0x2f')][_0xa9a8('0x4e')]({'where':{'id':_0x2b1ed0[_0xa9a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x271f2,null))[_0xa9a8('0x28')](saveUpdates(_0x2b1ed0[_0xa9a8('0x4d')],null))[_0xa9a8('0x28')](respondWithResult(_0x271f2,null))[_0xa9a8('0x48')](handleError(_0x271f2,null));};exports[_0xa9a8('0x29')]=function(_0x1869ab,_0x4f34c2){return db[_0xa9a8('0x2f')][_0xa9a8('0x4e')]({'where':{'id':_0x1869ab['params']['id']}})[_0xa9a8('0x28')](handleEntityNotFound(_0x4f34c2,null))[_0xa9a8('0x28')](removeEntity(_0x4f34c2,null))[_0xa9a8('0x48')](handleError(_0x4f34c2,null));};exports['getConfigurations']=function(_0xe26d6,_0x483c57,_0x3a7c6e){var _0x18753f={};var _0x54a51a={};var _0x4781f3;var _0x158b55;return db[_0xa9a8('0x2f')]['findOne']({'where':{'id':_0xe26d6[_0xa9a8('0x49')]['id']}})[_0xa9a8('0x28')](handleEntityNotFound(_0x483c57,null))[_0xa9a8('0x28')](function(_0x698108){if(_0x698108){_0x4781f3=_0x698108;_0x54a51a[_0xa9a8('0x34')]=_['keys'](db[_0xa9a8('0x4f')]['rawAttributes']);_0x54a51a[_0xa9a8('0x36')]=_[_0xa9a8('0x4a')](_0xe26d6[_0xa9a8('0x36')]);_0x54a51a['filters']=_[_0xa9a8('0x38')](_0x54a51a[_0xa9a8('0x34')],_0x54a51a['query']);_0x18753f[_0xa9a8('0x39')]=_[_0xa9a8('0x38')](_0x54a51a[_0xa9a8('0x34')],qs[_0xa9a8('0x3a')](_0xe26d6[_0xa9a8('0x36')][_0xa9a8('0x3a')]));_0x18753f[_0xa9a8('0x39')]=_0x18753f[_0xa9a8('0x39')]['length']?_0x18753f[_0xa9a8('0x39')]:_0x54a51a[_0xa9a8('0x34')];_0x18753f['order']=qs[_0xa9a8('0x3e')](_0xe26d6['query']['sort']);_0x18753f[_0xa9a8('0x3f')]=qs['filters'](_[_0xa9a8('0x40')](_0xe26d6['query'],_0x54a51a[_0xa9a8('0x37')]));if(_0xe26d6['query'][_0xa9a8('0x41')]){_0x18753f[_0xa9a8('0x3f')]=_[_0xa9a8('0x42')](_0x18753f['where'],{'$or':_[_0xa9a8('0x35')](_0x18753f[_0xa9a8('0x39')],function(_0x417600){var _0x2355b5={};_0x2355b5[_0x417600]={'$like':'%'+_0xe26d6[_0xa9a8('0x36')][_0xa9a8('0x41')]+'%'};return _0x2355b5;})});}_0x18753f=_[_0xa9a8('0x42')]({},_0x18753f,_0xe26d6[_0xa9a8('0x4b')]);return _0x4781f3[_0xa9a8('0x50')](_0x18753f);}})[_0xa9a8('0x28')](function(_0x4ed98d){if(_0x4ed98d){_0x158b55=_0x4ed98d[_0xa9a8('0x51')];if(!_0xe26d6[_0xa9a8('0x36')][_0xa9a8('0x3b')]('nolimit')){_0x18753f['limit']=qs['limit'](_0xe26d6[_0xa9a8('0x36')][_0xa9a8('0x22')]);_0x18753f['offset']=qs['offset'](_0xe26d6['query']['offset']);}return _0x4781f3[_0xa9a8('0x50')](_0x18753f);}})[_0xa9a8('0x28')](function(_0x52e23a){if(_0x52e23a){return _0x52e23a?{'count':_0x158b55,'rows':_0x52e23a}:null;}})['then'](respondWithResult(_0x483c57,null))['catch'](handleError(_0x483c57,null));};exports[_0xa9a8('0x52')]=function(_0x2b69a5,_0x38dcaf,_0x563139){if(_0x2b69a5['body']['id']){delete _0x2b69a5[_0xa9a8('0x4d')]['id'];}return db['ZohoAccount'][_0xa9a8('0x53')]({'where':{'id':_0x2b69a5['params']['id']}})[_0xa9a8('0x28')](handleEntityNotFound(_0x38dcaf,null))[_0xa9a8('0x28')](function(_0x2ad2e7){if(_0x2ad2e7){_0x2b69a5[_0xa9a8('0x4d')]['AccountId']=_0x2ad2e7['id'];_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x54')]=integrations[_0xa9a8('0x55')](_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x56')],_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x32')]);_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x57')]=integrations['getDescriptions'](_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x56')],_0x2b69a5[_0xa9a8('0x4d')][_0xa9a8('0x32')]);return db[_0xa9a8('0x4f')][_0xa9a8('0x4c')](_0x2b69a5[_0xa9a8('0x4d')],{'include':[{'model':db[_0xa9a8('0x58')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xa9a8('0x57')}]});}return null;})[_0xa9a8('0x28')](respondWithResult(_0x38dcaf,null))[_0xa9a8('0x48')](handleError(_0x38dcaf,null));};function getAccessToken(_0x2183d1){return new Promise(function(_0xaa9e4c,_0x1d5ed8){var _0x3415f0;switch(_0x2183d1[_0xa9a8('0x59')]){case'US':_0x3415f0='https://accounts.zoho.com';break;case'AU':_0x3415f0=_0xa9a8('0x5a');break;case'EU':_0x3415f0=_0xa9a8('0x5b');break;case'IN':_0x3415f0=_0xa9a8('0x5c');break;case'CN':_0x3415f0=_0xa9a8('0x5d');break;default:_0x3415f0=_0xa9a8('0x5b');break;}var _0x140c77={'method':_0xa9a8('0x5e'),'uri':_0x3415f0+_0xa9a8('0x5f'),'qs':{'refresh_token':_0x2183d1[_0xa9a8('0x60')],'client_id':_0x2183d1[_0xa9a8('0x61')],'client_secret':_0x2183d1['clientSecret'],'grant_type':_0xa9a8('0x62')},'json':!![]};return rp(_0x140c77)[_0xa9a8('0x28')](function(_0x1c164f){if(_0x1c164f[_0xa9a8('0x63')]){_0xaa9e4c(_0x1c164f[_0xa9a8('0x63')]);}else{_0x1d5ed8(_0xa9a8('0x64'));}})[_0xa9a8('0x48')](function(_0x25b06c){_0x1d5ed8(_0x25b06c);});});}exports[_0xa9a8('0x65')]=function(_0x5d8d60,_0x6b807,_0x133a4f){var _0x18cd1d,_0x1e3995,_0x36048c,_0x2de0d3,_0x5547eb;return db[_0xa9a8('0x2f')][_0xa9a8('0x53')]({'where':{'id':_0x5d8d60[_0xa9a8('0x49')]['id']},'attributes':['id',_0xa9a8('0x66'),_0xa9a8('0x59'),_0xa9a8('0x61'),_0xa9a8('0x67'),_0xa9a8('0x68'),_0xa9a8('0x69'),'refreshToken']})[_0xa9a8('0x28')](handleEntityNotFound(_0x6b807,null))[_0xa9a8('0x28')](function(_0x42d9cd){_0x5547eb=_0x42d9cd;_0x18cd1d=_0x5547eb['host'];_0x1e3995=_0x18cd1d===_0xa9a8('0x6a')?'eu':'com';_0x36048c=_0x5547eb[_0xa9a8('0x68')];var _0x5e0cdc=_0x36048c[_0xa9a8('0x6b')](-0x1);if(_0x5e0cdc==='/'||_0x5e0cdc==='\x5c'||_0x5e0cdc===':'){_0x36048c=_0x36048c[_0xa9a8('0x6c')](0x0,_0x36048c[_0xa9a8('0x6d')](_0x5e0cdc));}if(!_0x5547eb[_0xa9a8('0x60')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5547eb);})[_0xa9a8('0x28')](function(_0x1d7c7c){if(_0x1d7c7c){return rp({'method':_0xa9a8('0x6e'),'uri':util[_0xa9a8('0x6f')](_0xa9a8('0x70'),_0x1e3995),'qs':{'module':_0xa9a8('0x71')},'headers':{'Authorization':_0xa9a8('0x72')+_0x1d7c7c},'json':!![]});}})[_0xa9a8('0x28')](function(_0x5a6c83){if(_0x5a6c83){if(_0x5a6c83[_0xa9a8('0x73')]&&_0x5a6c83[_0xa9a8('0x73')][_0xa9a8('0x2a')]){throw new Error(_0x5a6c83[_0xa9a8('0x73')]['error'][_0xa9a8('0x74')]);}var _0x631ed9=[];var _0x2735e3=[];var _0x21c963=[_0xa9a8('0x75'),_0xa9a8('0x76'),_0xa9a8('0x77'),_0xa9a8('0x78'),_0xa9a8('0x79'),_0xa9a8('0x7a'),_0xa9a8('0x7b'),_0xa9a8('0x7c')];_0x2735e3=_[_0xa9a8('0x7d')](_0x5a6c83[_0xa9a8('0x3a')],function(_0x5b704a){return _0x21c963[_0xa9a8('0x7e')](_0x5b704a[_0xa9a8('0x7f')]);});for(var _0x577670=0x0;_0x577670<_0x2735e3[_0xa9a8('0x51')];_0x577670++){if(_0x2735e3[_0x577670][_0xa9a8('0x80')]===![]){_0x631ed9[_0xa9a8('0x81')]({'id':_0x2735e3[_0x577670]['id'],'name':_0x2735e3[_0x577670][_0xa9a8('0x82')],'custom':_0x2735e3[_0x577670]['custom_field'],'options':_0x2735e3[_0x577670][_0xa9a8('0x83')]===_0xa9a8('0x84')&&_0x2735e3[_0x577670]['pick_list_values'][_0xa9a8('0x51')]>-0x1?_[_0xa9a8('0x35')](_0x2735e3[_0x577670][_0xa9a8('0x85')],function(_0x52f051){return{'name':_0x52f051,'value':_0x52f051};}):[]});}}return{'count':_0x631ed9[_0xa9a8('0x51')],'rows':_0x631ed9};}else{return{'count':0x0,'rows':[]};}})[_0xa9a8('0x28')](respondWithResult(_0x6b807,null))[_0xa9a8('0x48')](function(_0x437b93){var _0x27ce39=_0x5d8d60[_0xa9a8('0x36')][_0xa9a8('0x86')]?0x1f4:_0x437b93[_0xa9a8('0x87')]||0x1f4;logger[_0xa9a8('0x2a')](_0xa9a8('0x88'),_0xa9a8('0x65'),_0x27ce39,JSON[_0xa9a8('0x89')](_0x437b93));delete _0x437b93[_0xa9a8('0x2c')];if(_0x27ce39===0x191){_0x27ce39=0x190;}_0x6b807[_0xa9a8('0x1d')](_0x27ce39)['send'](_0x5d8d60[_0xa9a8('0x36')][_0xa9a8('0x86')]?{'message':_0xa9a8('0x8a'),'statusCode':_0x437b93[_0xa9a8('0x87')]}:_0x437b93);});}; \ No newline at end of file +var _0xd6b0=['index','ZohoAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','getConfigurations','ZohoConfiguration','order','map','addConfiguration','Subjects','getSubjects','channel','type','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','substring','lastIndexOf','refreshToken','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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','then','destroy','error','name','send'];(function(_0x52f652,_0xa23c23){var _0x5e8491=function(_0x4b2322){while(--_0x4b2322){_0x52f652['push'](_0x52f652['shift']());}};_0x5e8491(++_0xa23c23);}(_0xd6b0,0xce));var _0x0d6b=function(_0x5e5f05,_0x5cb316){_0x5e5f05=_0x5e5f05-0x0;var _0x8147b3=_0xd6b0[_0x5e5f05];return _0x8147b3;};'use strict';var emlformat=require(_0x0d6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d6b('0x1'));var jsonpatch=require(_0x0d6b('0x2'));var rp=require(_0x0d6b('0x3'));var moment=require(_0x0d6b('0x4'));var BPromise=require(_0x0d6b('0x5'));var Mustache=require(_0x0d6b('0x6'));var util=require(_0x0d6b('0x7'));var path=require(_0x0d6b('0x8'));var sox=require(_0x0d6b('0x9'));var csv=require(_0x0d6b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d6b('0xb'));var _=require(_0x0d6b('0xc'));var squel=require('squel');var crypto=require(_0x0d6b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d6b('0xa'));var querystring=require(_0x0d6b('0xe'));var Papa=require(_0x0d6b('0xf'));var Redis=require(_0x0d6b('0x10'));var authService=require(_0x0d6b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d6b('0x12'));var hardwareService=require(_0x0d6b('0x13'));var logger=require('../../config/logger')(_0x0d6b('0x14'));var utils=require(_0x0d6b('0x15'));var config=require(_0x0d6b('0x16'));var licenseUtil=require(_0x0d6b('0x17'));var db=require(_0x0d6b('0x18'))['db'];var integrations=require(_0x0d6b('0x19'));function respondWithStatusCode(_0x4dc1bb,_0x56fc6c){_0x56fc6c=_0x56fc6c||0xcc;return function(_0x1211c9){if(_0x1211c9){return _0x4dc1bb[_0x0d6b('0x1a')](_0x56fc6c);}return _0x4dc1bb[_0x0d6b('0x1b')](_0x56fc6c)[_0x0d6b('0x1c')]();};}function respondWithResult(_0xdbb6a0,_0xfbea1d){_0xfbea1d=_0xfbea1d||0xc8;return function(_0x22cb9f){if(_0x22cb9f){return _0xdbb6a0[_0x0d6b('0x1b')](_0xfbea1d)[_0x0d6b('0x1d')](_0x22cb9f);}};}function respondWithFilteredResult(_0x52a9a3,_0x3308c2){return function(_0xc4fa52){if(_0xc4fa52){var _0x23e3cc=typeof _0x3308c2[_0x0d6b('0x1e')]===_0x0d6b('0x1f')&&typeof _0x3308c2[_0x0d6b('0x20')]===_0x0d6b('0x1f');var _0x5b1122=_0xc4fa52[_0x0d6b('0x21')];var _0xc0a1b0=_0x23e3cc?0x0:_0x3308c2['offset'];var _0x13bc16=_0x23e3cc?_0xc4fa52[_0x0d6b('0x21')]:_0x3308c2[_0x0d6b('0x1e')]+_0x3308c2[_0x0d6b('0x20')];var _0x196d9d;if(_0x13bc16>=_0x5b1122){_0x13bc16=_0x5b1122;_0x196d9d=0xc8;}else{_0x196d9d=0xce;}_0x52a9a3[_0x0d6b('0x1b')](_0x196d9d);return _0x52a9a3['set'](_0x0d6b('0x22'),_0xc0a1b0+'-'+_0x13bc16+'/'+_0x5b1122)['json'](_0xc4fa52);}return null;};}function patchUpdates(_0x49bb00){return function(_0x1ddb71){try{jsonpatch[_0x0d6b('0x23')](_0x1ddb71,_0x49bb00,!![]);}catch(_0x2df3e0){return BPromise[_0x0d6b('0x24')](_0x2df3e0);}return _0x1ddb71[_0x0d6b('0x25')]();};}function saveUpdates(_0x29dfdf,_0x54a225){return function(_0x176454){if(_0x176454){return _0x176454[_0x0d6b('0x26')](_0x29dfdf)[_0x0d6b('0x27')](function(_0x38fa90){return _0x38fa90;});}return null;};}function removeEntity(_0x394bc9,_0x28d42d){return function(_0x4eac7e){if(_0x4eac7e){return _0x4eac7e[_0x0d6b('0x28')]()['then'](function(){_0x394bc9[_0x0d6b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163b06,_0x456870){return function(_0x525e42){if(!_0x525e42){_0x163b06[_0x0d6b('0x1a')](0x194);}return _0x525e42;};}function handleError(_0x153cd8,_0xd2f09f){_0xd2f09f=_0xd2f09f||0x1f4;return function(_0x3c60f1){logger[_0x0d6b('0x29')](_0x3c60f1['stack']);if(_0x3c60f1[_0x0d6b('0x2a')]){delete _0x3c60f1[_0x0d6b('0x2a')];}_0x153cd8['status'](_0xd2f09f)[_0x0d6b('0x2b')](_0x3c60f1);};}exports[_0x0d6b('0x2c')]=function(_0x319d63,_0x2917b3){var _0x55a090={},_0x32f972={},_0x2a52c9={'count':0x0,'rows':[]};var _0x1bccac=_['map'](db[_0x0d6b('0x2d')][_0x0d6b('0x2e')],function(_0x2c679e){return{'name':_0x2c679e[_0x0d6b('0x2f')],'type':_0x2c679e['type'][_0x0d6b('0x30')]};});_0x32f972['model']=_['map'](_0x1bccac,'name');_0x32f972[_0x0d6b('0x31')]=_[_0x0d6b('0x32')](_0x319d63['query']);_0x32f972[_0x0d6b('0x33')]=_[_0x0d6b('0x34')](_0x32f972['model'],_0x32f972[_0x0d6b('0x31')]);_0x55a090['attributes']=_[_0x0d6b('0x34')](_0x32f972[_0x0d6b('0x35')],qs[_0x0d6b('0x36')](_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x36')]));_0x55a090[_0x0d6b('0x37')]=_0x55a090['attributes'][_0x0d6b('0x38')]?_0x55a090[_0x0d6b('0x37')]:_0x32f972[_0x0d6b('0x35')];if(!_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x39')](_0x0d6b('0x3a'))){_0x55a090['limit']=qs[_0x0d6b('0x20')](_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x20')]);_0x55a090[_0x0d6b('0x1e')]=qs[_0x0d6b('0x1e')](_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x1e')]);}_0x55a090['order']=qs[_0x0d6b('0x3b')](_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x3b')]);_0x55a090[_0x0d6b('0x3c')]=qs[_0x0d6b('0x33')](_[_0x0d6b('0x3d')](_0x319d63['query'],_0x32f972['filters']),_0x1bccac);if(_0x319d63[_0x0d6b('0x31')]['filter']){_0x55a090[_0x0d6b('0x3c')]=_[_0x0d6b('0x3e')](_0x55a090[_0x0d6b('0x3c')],{'$or':_['map'](_0x1bccac,function(_0x1fe1e8){if(_0x1fe1e8['type']!==_0x0d6b('0x3f')){var _0x74c44d={};_0x74c44d[_0x1fe1e8[_0x0d6b('0x2a')]]={'$like':'%'+_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x40')]+'%'};return _0x74c44d;}})});}_0x55a090=_[_0x0d6b('0x3e')]({},_0x55a090,_0x319d63['options']);var _0x59478c={'where':_0x55a090[_0x0d6b('0x3c')]};return db[_0x0d6b('0x2d')][_0x0d6b('0x21')](_0x59478c)['then'](function(_0x430a63){_0x2a52c9[_0x0d6b('0x21')]=_0x430a63;if(_0x319d63[_0x0d6b('0x31')][_0x0d6b('0x41')]){_0x55a090[_0x0d6b('0x42')]=[{'all':!![]}];}return db[_0x0d6b('0x2d')]['findAll'](_0x55a090);})['then'](function(_0x153923){_0x2a52c9[_0x0d6b('0x43')]=_0x153923;return _0x2a52c9;})[_0x0d6b('0x27')](respondWithFilteredResult(_0x2917b3,_0x55a090))[_0x0d6b('0x44')](handleError(_0x2917b3,null));};exports[_0x0d6b('0x45')]=function(_0x6e791c,_0x484f74){var _0x1847a1={'raw':![],'where':{'id':_0x6e791c[_0x0d6b('0x46')]['id']}},_0x193a1a={};_0x193a1a['model']=_[_0x0d6b('0x32')](db[_0x0d6b('0x2d')][_0x0d6b('0x2e')]);_0x193a1a[_0x0d6b('0x31')]=_[_0x0d6b('0x32')](_0x6e791c[_0x0d6b('0x31')]);_0x193a1a['filters']=_[_0x0d6b('0x34')](_0x193a1a[_0x0d6b('0x35')],_0x193a1a[_0x0d6b('0x31')]);_0x1847a1[_0x0d6b('0x37')]=_[_0x0d6b('0x34')](_0x193a1a[_0x0d6b('0x35')],qs[_0x0d6b('0x36')](_0x6e791c[_0x0d6b('0x31')][_0x0d6b('0x36')]));_0x1847a1[_0x0d6b('0x37')]=_0x1847a1[_0x0d6b('0x37')][_0x0d6b('0x38')]?_0x1847a1[_0x0d6b('0x37')]:_0x193a1a[_0x0d6b('0x35')];if(_0x6e791c['query'][_0x0d6b('0x41')]){_0x1847a1['include']=[{'all':!![]}];}_0x1847a1=_[_0x0d6b('0x3e')]({},_0x1847a1,_0x6e791c[_0x0d6b('0x47')]);return db['ZohoAccount'][_0x0d6b('0x48')](_0x1847a1)['then'](handleEntityNotFound(_0x484f74,null))['then'](respondWithResult(_0x484f74,null))['catch'](handleError(_0x484f74,null));};exports[_0x0d6b('0x49')]=function(_0xb2d355,_0x697c8c){return db[_0x0d6b('0x2d')]['create'](_0xb2d355[_0x0d6b('0x4a')],{})[_0x0d6b('0x27')](respondWithResult(_0x697c8c,0xc9))[_0x0d6b('0x44')](handleError(_0x697c8c,null));};exports['update']=function(_0x51cbd4,_0x449e0c){if(_0x51cbd4['body']['id']){delete _0x51cbd4[_0x0d6b('0x4a')]['id'];}return db['ZohoAccount'][_0x0d6b('0x48')]({'where':{'id':_0x51cbd4['params']['id']}})[_0x0d6b('0x27')](handleEntityNotFound(_0x449e0c,null))['then'](saveUpdates(_0x51cbd4[_0x0d6b('0x4a')],null))['then'](respondWithResult(_0x449e0c,null))[_0x0d6b('0x44')](handleError(_0x449e0c,null));};exports[_0x0d6b('0x28')]=function(_0x2bed25,_0x2181a3){return db['ZohoAccount'][_0x0d6b('0x48')]({'where':{'id':_0x2bed25[_0x0d6b('0x46')]['id']}})[_0x0d6b('0x27')](handleEntityNotFound(_0x2181a3,null))['then'](removeEntity(_0x2181a3,null))[_0x0d6b('0x44')](handleError(_0x2181a3,null));};exports[_0x0d6b('0x4b')]=function(_0x563e87,_0x3ecef3,_0x8d7f3f){var _0x2d1598={};var _0x1bf1c8={};var _0x46965e;var _0x250aab;return db[_0x0d6b('0x2d')]['findOne']({'where':{'id':_0x563e87[_0x0d6b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ecef3,null))[_0x0d6b('0x27')](function(_0x3722f5){if(_0x3722f5){_0x46965e=_0x3722f5;_0x1bf1c8['model']=_[_0x0d6b('0x32')](db[_0x0d6b('0x4c')][_0x0d6b('0x2e')]);_0x1bf1c8[_0x0d6b('0x31')]=_['keys'](_0x563e87['query']);_0x1bf1c8[_0x0d6b('0x33')]=_[_0x0d6b('0x34')](_0x1bf1c8['model'],_0x1bf1c8['query']);_0x2d1598['attributes']=_[_0x0d6b('0x34')](_0x1bf1c8[_0x0d6b('0x35')],qs['fields'](_0x563e87[_0x0d6b('0x31')][_0x0d6b('0x36')]));_0x2d1598[_0x0d6b('0x37')]=_0x2d1598[_0x0d6b('0x37')][_0x0d6b('0x38')]?_0x2d1598['attributes']:_0x1bf1c8[_0x0d6b('0x35')];_0x2d1598[_0x0d6b('0x4d')]=qs[_0x0d6b('0x3b')](_0x563e87[_0x0d6b('0x31')][_0x0d6b('0x3b')]);_0x2d1598['where']=qs['filters'](_['pick'](_0x563e87[_0x0d6b('0x31')],_0x1bf1c8[_0x0d6b('0x33')]));if(_0x563e87[_0x0d6b('0x31')]['filter']){_0x2d1598[_0x0d6b('0x3c')]=_[_0x0d6b('0x3e')](_0x2d1598[_0x0d6b('0x3c')],{'$or':_[_0x0d6b('0x4e')](_0x2d1598['attributes'],function(_0x5f1aa5){var _0x56dcce={};_0x56dcce[_0x5f1aa5]={'$like':'%'+_0x563e87['query']['filter']+'%'};return _0x56dcce;})});}_0x2d1598=_[_0x0d6b('0x3e')]({},_0x2d1598,_0x563e87['options']);return _0x46965e['getConfigurations'](_0x2d1598);}})[_0x0d6b('0x27')](function(_0x116572){if(_0x116572){_0x250aab=_0x116572[_0x0d6b('0x38')];if(!_0x563e87[_0x0d6b('0x31')][_0x0d6b('0x39')]('nolimit')){_0x2d1598[_0x0d6b('0x20')]=qs[_0x0d6b('0x20')](_0x563e87['query'][_0x0d6b('0x20')]);_0x2d1598[_0x0d6b('0x1e')]=qs[_0x0d6b('0x1e')](_0x563e87[_0x0d6b('0x31')][_0x0d6b('0x1e')]);}return _0x46965e[_0x0d6b('0x4b')](_0x2d1598);}})[_0x0d6b('0x27')](function(_0x5d0298){if(_0x5d0298){return _0x5d0298?{'count':_0x250aab,'rows':_0x5d0298}:null;}})[_0x0d6b('0x27')](respondWithResult(_0x3ecef3,null))['catch'](handleError(_0x3ecef3,null));};exports[_0x0d6b('0x4f')]=function(_0x36a213,_0xaefa72,_0x1b0104){if(_0x36a213[_0x0d6b('0x4a')]['id']){delete _0x36a213[_0x0d6b('0x4a')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x36a213[_0x0d6b('0x46')]['id']}})['then'](handleEntityNotFound(_0xaefa72,null))['then'](function(_0x440856){if(_0x440856){_0x36a213['body']['AccountId']=_0x440856['id'];_0x36a213[_0x0d6b('0x4a')][_0x0d6b('0x50')]=integrations[_0x0d6b('0x51')](_0x36a213[_0x0d6b('0x4a')][_0x0d6b('0x52')],_0x36a213[_0x0d6b('0x4a')][_0x0d6b('0x53')]);_0x36a213['body']['Descriptions']=integrations[_0x0d6b('0x54')](_0x36a213[_0x0d6b('0x4a')]['channel'],_0x36a213[_0x0d6b('0x4a')][_0x0d6b('0x53')]);return db['ZohoConfiguration'][_0x0d6b('0x49')](_0x36a213['body'],{'include':[{'model':db[_0x0d6b('0x55')],'as':_0x0d6b('0x50')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x0d6b('0x27')](respondWithResult(_0xaefa72,null))[_0x0d6b('0x44')](handleError(_0xaefa72,null));};function getAccessToken(_0x1ffd19){return new Promise(function(_0x217818,_0x3f3d00){var _0x438700;switch(_0x1ffd19[_0x0d6b('0x56')]){case'US':_0x438700=_0x0d6b('0x57');break;case'AU':_0x438700=_0x0d6b('0x58');break;case'EU':_0x438700='https://accounts.zoho.eu';break;case'IN':_0x438700=_0x0d6b('0x59');break;case'CN':_0x438700='https://accounts.zoho.com.cn';break;default:_0x438700=_0x0d6b('0x5a');break;}var _0xd6b72f={'method':'POST','uri':_0x438700+_0x0d6b('0x5b'),'qs':{'refresh_token':_0x1ffd19['refreshToken'],'client_id':_0x1ffd19[_0x0d6b('0x5c')],'client_secret':_0x1ffd19[_0x0d6b('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xd6b72f)[_0x0d6b('0x27')](function(_0x3928d1){if(_0x3928d1['access_token']){_0x217818(_0x3928d1[_0x0d6b('0x5e')]);}else{_0x3f3d00(_0x0d6b('0x5f'));}})[_0x0d6b('0x44')](function(_0x4c012f){_0x3f3d00(_0x4c012f);});});}exports[_0x0d6b('0x60')]=function(_0x477408,_0x53deb2,_0x53f8a9){var _0x5c5c83,_0x4afab1,_0x238571,_0x54e786,_0x2068c8;return db[_0x0d6b('0x2d')]['findOne']({'where':{'id':_0x477408[_0x0d6b('0x46')]['id']},'attributes':['id',_0x0d6b('0x61'),_0x0d6b('0x56'),_0x0d6b('0x5c'),_0x0d6b('0x5d'),_0x0d6b('0x62'),_0x0d6b('0x63'),'refreshToken']})[_0x0d6b('0x27')](handleEntityNotFound(_0x53deb2,null))[_0x0d6b('0x27')](function(_0x1b42a6){_0x2068c8=_0x1b42a6;_0x5c5c83=_0x2068c8['host'];_0x4afab1=_0x5c5c83==='zoho.eu'?'eu':_0x0d6b('0x64');_0x238571=_0x2068c8[_0x0d6b('0x62')];var _0x5c5132=_0x238571['slice'](-0x1);if(_0x5c5132==='/'||_0x5c5132==='\x5c'||_0x5c5132===':'){_0x238571=_0x238571[_0x0d6b('0x65')](0x0,_0x238571[_0x0d6b('0x66')](_0x5c5132));}if(!_0x2068c8[_0x0d6b('0x67')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2068c8);})[_0x0d6b('0x27')](function(_0x195f2c){if(_0x195f2c){return rp({'method':'GET','uri':util[_0x0d6b('0x68')](_0x0d6b('0x69'),_0x4afab1),'qs':{'module':'Calls'},'headers':{'Authorization':_0x0d6b('0x6a')+_0x195f2c},'json':!![]});}})['then'](function(_0x584665){if(_0x584665){if(_0x584665['response']&&_0x584665[_0x0d6b('0x6b')][_0x0d6b('0x29')]){throw new Error(_0x584665['response'][_0x0d6b('0x29')][_0x0d6b('0x6c')]);}var _0x3d0a1e=[];var _0x48927a=[];var _0x3cddb5=[_0x0d6b('0x6d'),'Subject','Description','WhoId','Call_Duration',_0x0d6b('0x6e'),'Call_Start_Time',_0x0d6b('0x6f')];_0x48927a=_[_0x0d6b('0x70')](_0x584665[_0x0d6b('0x36')],function(_0x244b6d){return _0x3cddb5['includes'](_0x244b6d[_0x0d6b('0x71')]);});for(var _0xa72d9=0x0;_0xa72d9<_0x48927a[_0x0d6b('0x38')];_0xa72d9++){if(_0x48927a[_0xa72d9][_0x0d6b('0x72')]===![]){_0x3d0a1e[_0x0d6b('0x73')]({'id':_0x48927a[_0xa72d9]['id'],'name':_0x48927a[_0xa72d9][_0x0d6b('0x74')],'custom':_0x48927a[_0xa72d9][_0x0d6b('0x75')],'options':_0x48927a[_0xa72d9][_0x0d6b('0x76')]===_0x0d6b('0x77')&&_0x48927a[_0xa72d9][_0x0d6b('0x78')][_0x0d6b('0x38')]>-0x1?_[_0x0d6b('0x4e')](_0x48927a[_0xa72d9][_0x0d6b('0x78')],function(_0x96bcfa){return{'name':_0x96bcfa,'value':_0x96bcfa};}):[]});}}return{'count':_0x3d0a1e['length'],'rows':_0x3d0a1e};}else{return{'count':0x0,'rows':[]};}})[_0x0d6b('0x27')](respondWithResult(_0x53deb2,null))[_0x0d6b('0x44')](function(_0x36398c){var _0x107d7e=_0x477408[_0x0d6b('0x31')][_0x0d6b('0x79')]?0x1f4:_0x36398c[_0x0d6b('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0d6b('0x60'),_0x107d7e,JSON[_0x0d6b('0x7b')](_0x36398c));delete _0x36398c[_0x0d6b('0x2a')];if(_0x107d7e===0x191){_0x107d7e=0x190;}_0x53deb2['status'](_0x107d7e)['send'](_0x477408[_0x0d6b('0x31')][_0x0d6b('0x79')]?{'message':_0x0d6b('0x7c'),'statusCode':_0x36398c['statusCode']}:_0x36398c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 36e8fd8..0057c0e 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 _0xab0b=['bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','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','inspect','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','catch','lodash','../../config/logger','api','moment'];(function(_0xce5d71,_0x19cd23){var _0x23d652=function(_0x1b0948){while(--_0x1b0948){_0xce5d71['push'](_0xce5d71['shift']());}};_0x23d652(++_0x19cd23);}(_0xab0b,0xd3));var _0xbab0=function(_0x1a635e,_0x241651){_0x1a635e=_0x1a635e-0x0;var _0x5b3345=_0xab0b[_0x1a635e];return _0x5b3345;};'use strict';var _=require(_0xbab0('0x0'));var util=require('util');var logger=require(_0xbab0('0x1'))(_0xbab0('0x2'));var moment=require(_0xbab0('0x3'));var BPromise=require(_0xbab0('0x4'));var rp=require(_0xbab0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbab0('0x6'));var config=require('../../config/environment');var attributes=require(_0xbab0('0x7'));var integrations=require(_0xbab0('0x8'));module['exports']=function(_0x4b94d5,_0x1e1c46){return _0x4b94d5[_0xbab0('0x9')](_0xbab0('0xa'),attributes,{'tableName':_0xbab0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x608b09,_0x5f1c00,_0x59c497){if(_0x608b09[_0xbab0('0xc')](_0xbab0('0xd'))||_0x608b09['changed'](_0xbab0('0xe'))||_0x608b09[_0xbab0('0xc')]('clientId')||_0x608b09['changed'](_0xbab0('0xf'))||_0x608b09[_0xbab0('0xc')](_0xbab0('0x10'))||_0x608b09[_0xbab0('0xc')](_0xbab0('0x11'))){var _0x599f3d,_0x8e68e9;_0x599f3d=_0x608b09[_0xbab0('0xe')];var _0x435fc8=_0x599f3d[_0xbab0('0x12')](-0x1);if(_0x435fc8==='/'||_0x435fc8==='\x5c'||_0x435fc8===':'){_0x599f3d=_0x599f3d['substring'](0x0,_0x599f3d[_0xbab0('0x13')](_0x435fc8));}switch(_0x608b09[_0xbab0('0xd')]){case'US':_0x8e68e9=_0xbab0('0x14');break;case'AU':_0x8e68e9=_0xbab0('0x15');break;case'IN':_0x8e68e9=_0xbab0('0x16');break;case'CN':_0x8e68e9='https://accounts.zoho.com.cn';break;default:_0x8e68e9='https://accounts.zoho.eu';break;}var _0xff0a1b={'method':_0xbab0('0x17'),'uri':_0x8e68e9+_0xbab0('0x18'),'form':{'grant_type':_0xbab0('0x19'),'client_id':_0x608b09[_0xbab0('0x1a')],'client_secret':_0x608b09[_0xbab0('0xf')],'redirect_uri':_0x608b09[_0xbab0('0xe')],'code':_0x608b09['code']},'headers':{'Content-Type':_0xbab0('0x1b')}};return rp(_0xff0a1b)[_0xbab0('0x1c')](function(_0x485e7c){var _0x5dc5fa=JSON[_0xbab0('0x1d')](_0x485e7c);if(_0x5dc5fa[_0xbab0('0x1e')]){_0x608b09['refreshToken']=_0x5dc5fa[_0xbab0('0x1e')];logger[_0xbab0('0x1f')](util[_0xbab0('0x20')](_0xbab0('0x21'),_0x608b09[_0xbab0('0x22')],_0x608b09['id']));}else{logger[_0xbab0('0x23')](util[_0xbab0('0x20')](_0xbab0('0x24'),_0x608b09[_0xbab0('0x22')],_0x608b09['id']),util[_0xbab0('0x25')](_0x5dc5fa,{'showHidden':![],'depth':null}));}return _0x59c497(null,_0x5f1c00);})['catch'](function(_0x6d990a){logger['error'](util[_0xbab0('0x20')](_0xbab0('0x24'),_0x608b09[_0xbab0('0x22')],_0x608b09['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x59c497(_0x6d990a);});}else{return _0x59c497(null,_0x5f1c00);}},'beforeUpdate':function(_0x325fbc,_0x4197a7,_0x1c04c1){if(_0x325fbc[_0xbab0('0xc')](_0xbab0('0xd'))||_0x325fbc[_0xbab0('0xc')]('serverUrl')||_0x325fbc[_0xbab0('0xc')](_0xbab0('0x1a'))||_0x325fbc[_0xbab0('0xc')](_0xbab0('0xf'))||_0x325fbc[_0xbab0('0xc')](_0xbab0('0x10'))||_0x325fbc[_0xbab0('0xc')](_0xbab0('0x11'))){var _0x46f02f,_0x1abcaa;_0x46f02f=_0x325fbc['serverUrl'];var _0x1953b6=_0x46f02f[_0xbab0('0x12')](-0x1);if(_0x1953b6==='/'||_0x1953b6==='\x5c'||_0x1953b6===':'){_0x46f02f=_0x46f02f[_0xbab0('0x26')](0x0,_0x46f02f[_0xbab0('0x13')](_0x1953b6));}switch(_0x325fbc['zone']){case'US':_0x1abcaa='https://accounts.zoho.com';break;case'AU':_0x1abcaa=_0xbab0('0x15');break;case'IN':_0x1abcaa=_0xbab0('0x16');break;case'CN':_0x1abcaa=_0xbab0('0x27');break;default:_0x1abcaa=_0xbab0('0x28');break;}var _0x4d2f4f={'method':_0xbab0('0x17'),'uri':_0x1abcaa+_0xbab0('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x325fbc[_0xbab0('0x1a')],'client_secret':_0x325fbc['clientSecret'],'redirect_uri':_0x325fbc[_0xbab0('0xe')],'code':_0x325fbc['code']},'headers':{'Content-Type':_0xbab0('0x1b')}};return rp(_0x4d2f4f)[_0xbab0('0x1c')](function(_0x10595b){var _0x32c0ba=JSON['parse'](_0x10595b);if(_0x32c0ba[_0xbab0('0x1e')]){_0x325fbc[_0xbab0('0x29')]=_0x32c0ba[_0xbab0('0x1e')];logger[_0xbab0('0x1f')](util['format'](_0xbab0('0x21'),_0x325fbc[_0xbab0('0x22')],_0x325fbc['id']));}else{logger[_0xbab0('0x23')](util[_0xbab0('0x20')](_0xbab0('0x24'),_0x325fbc[_0xbab0('0x22')],_0x325fbc['id']),util[_0xbab0('0x25')](_0x32c0ba,{'showHidden':![],'depth':null}));}return _0x1c04c1(null,_0x4197a7);})[_0xbab0('0x2a')](function(_0x30dd58){logger[_0xbab0('0x23')](util[_0xbab0('0x20')](_0xbab0('0x24'),_0x325fbc[_0xbab0('0x22')],_0x325fbc['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1c04c1(_0x30dd58);});}else{return _0x1c04c1(null,_0x4197a7);}}}});}; \ No newline at end of file +var _0xabae=['clientId','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','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','clientSecret','authorization_code','format','inspect','catch','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl'];(function(_0xf8f6f1,_0x551483){var _0x51db61=function(_0x31f8af){while(--_0x31f8af){_0xf8f6f1['push'](_0xf8f6f1['shift']());}};_0x51db61(++_0x551483);}(_0xabae,0x139));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xeaba('0x0'));var logger=require(_0xeaba('0x1'))(_0xeaba('0x2'));var moment=require(_0xeaba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeaba('0x4'));var config=require(_0xeaba('0x5'));var attributes=require(_0xeaba('0x6'));var integrations=require(_0xeaba('0x7'));module[_0xeaba('0x8')]=function(_0x3eccbf,_0x133c3a){return _0x3eccbf[_0xeaba('0x9')](_0xeaba('0xa'),attributes,{'tableName':_0xeaba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x240d1b,_0x532898,_0x189936){if(_0x240d1b['changed'](_0xeaba('0xc'))||_0x240d1b[_0xeaba('0xd')](_0xeaba('0xe'))||_0x240d1b[_0xeaba('0xd')](_0xeaba('0xf'))||_0x240d1b[_0xeaba('0xd')]('clientSecret')||_0x240d1b[_0xeaba('0xd')](_0xeaba('0x10'))||_0x240d1b[_0xeaba('0xd')](_0xeaba('0x11'))){var _0x21b716,_0x589c55;_0x21b716=_0x240d1b[_0xeaba('0xe')];var _0x2835ca=_0x21b716[_0xeaba('0x12')](-0x1);if(_0x2835ca==='/'||_0x2835ca==='\x5c'||_0x2835ca===':'){_0x21b716=_0x21b716['substring'](0x0,_0x21b716[_0xeaba('0x13')](_0x2835ca));}switch(_0x240d1b[_0xeaba('0xc')]){case'US':_0x589c55=_0xeaba('0x14');break;case'AU':_0x589c55=_0xeaba('0x15');break;case'IN':_0x589c55=_0xeaba('0x16');break;case'CN':_0x589c55=_0xeaba('0x17');break;default:_0x589c55=_0xeaba('0x18');break;}var _0x547497={'method':_0xeaba('0x19'),'uri':_0x589c55+_0xeaba('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x240d1b['clientId'],'client_secret':_0x240d1b['clientSecret'],'redirect_uri':_0x240d1b['serverUrl'],'code':_0x240d1b['code']},'headers':{'Content-Type':_0xeaba('0x1b')}};return rp(_0x547497)['then'](function(_0x583e21){var _0x11af99=JSON[_0xeaba('0x1c')](_0x583e21);if(_0x11af99[_0xeaba('0x1d')]){_0x240d1b[_0xeaba('0x1e')]=_0x11af99[_0xeaba('0x1d')];logger[_0xeaba('0x1f')](util['format'](_0xeaba('0x20'),_0x240d1b[_0xeaba('0x21')],_0x240d1b['id']));}else{logger[_0xeaba('0x22')](util['format'](_0xeaba('0x23'),_0x240d1b[_0xeaba('0x21')],_0x240d1b['id']),util['inspect'](_0x11af99,{'showHidden':![],'depth':null}));}return _0x189936(null,_0x532898);})['catch'](function(_0x2a9de1){logger[_0xeaba('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x240d1b[_0xeaba('0x21')],_0x240d1b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x189936(_0x2a9de1);});}else{return _0x189936(null,_0x532898);}},'beforeUpdate':function(_0x13d81d,_0x48b8ea,_0x38f264){if(_0x13d81d[_0xeaba('0xd')](_0xeaba('0xc'))||_0x13d81d[_0xeaba('0xd')]('serverUrl')||_0x13d81d[_0xeaba('0xd')](_0xeaba('0xf'))||_0x13d81d['changed'](_0xeaba('0x24'))||_0x13d81d[_0xeaba('0xd')](_0xeaba('0x10'))||_0x13d81d[_0xeaba('0xd')](_0xeaba('0x11'))){var _0x592860,_0x3f9282;_0x592860=_0x13d81d['serverUrl'];var _0x3becc4=_0x592860[_0xeaba('0x12')](-0x1);if(_0x3becc4==='/'||_0x3becc4==='\x5c'||_0x3becc4===':'){_0x592860=_0x592860['substring'](0x0,_0x592860[_0xeaba('0x13')](_0x3becc4));}switch(_0x13d81d[_0xeaba('0xc')]){case'US':_0x3f9282=_0xeaba('0x14');break;case'AU':_0x3f9282=_0xeaba('0x15');break;case'IN':_0x3f9282=_0xeaba('0x16');break;case'CN':_0x3f9282='https://accounts.zoho.com.cn';break;default:_0x3f9282=_0xeaba('0x18');break;}var _0x29af20={'method':'POST','uri':_0x3f9282+_0xeaba('0x1a'),'form':{'grant_type':_0xeaba('0x25'),'client_id':_0x13d81d[_0xeaba('0xf')],'client_secret':_0x13d81d[_0xeaba('0x24')],'redirect_uri':_0x13d81d['serverUrl'],'code':_0x13d81d[_0xeaba('0x10')]},'headers':{'Content-Type':_0xeaba('0x1b')}};return rp(_0x29af20)['then'](function(_0x1521c9){var _0x1cdab1=JSON[_0xeaba('0x1c')](_0x1521c9);if(_0x1cdab1[_0xeaba('0x1d')]){_0x13d81d[_0xeaba('0x1e')]=_0x1cdab1[_0xeaba('0x1d')];logger[_0xeaba('0x1f')](util[_0xeaba('0x26')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x13d81d[_0xeaba('0x21')],_0x13d81d['id']));}else{logger[_0xeaba('0x22')](util['format'](_0xeaba('0x23'),_0x13d81d[_0xeaba('0x21')],_0x13d81d['id']),util[_0xeaba('0x27')](_0x1cdab1,{'showHidden':![],'depth':null}));}return _0x38f264(null,_0x48b8ea);})[_0xeaba('0x28')](function(_0x854f71){logger[_0xeaba('0x22')](util[_0xeaba('0x26')](_0xeaba('0x23'),_0x13d81d[_0xeaba('0x21')],_0x13d81d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x38f264(_0x854f71);});}else{return _0x38f264(null,_0x48b8ea);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1435dd6..a06737a 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 _0x86c0=['options','where','attributes','limit','map','model','include','ShowZohoAccount','find','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','GetZohoAccount','ZohoAccount','findAll'];(function(_0x52da21,_0x242123){var _0x12cb79=function(_0xb7f988){while(--_0xb7f988){_0x52da21['push'](_0x52da21['shift']());}};_0x12cb79(++_0x242123);}(_0x86c0,0x133));var _0x086c=function(_0x4338a1,_0x30c46f){_0x4338a1=_0x4338a1-0x0;var _0x1401d0=_0x86c0[_0x4338a1];return _0x1401d0;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('ZohoAccount,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});}exports[_0x086c('0x17')]=function(_0x2add43){var _0x5dc891=this;return new Promise(function(_0x5463d6,_0x3bac0c){return db[_0x086c('0x18')][_0x086c('0x19')]({'raw':_0x2add43[_0x086c('0x1a')]?_0x2add43[_0x086c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2add43['options']?_0x2add43['options'][_0x086c('0x1b')]||null:null,'attributes':_0x2add43[_0x086c('0x1a')]?_0x2add43['options'][_0x086c('0x1c')]||null:null,'limit':_0x2add43['options']?_0x2add43[_0x086c('0x1a')][_0x086c('0x1d')]||null:null,'include':_0x2add43[_0x086c('0x1a')]?_0x2add43[_0x086c('0x1a')]['include']?_[_0x086c('0x1e')](_0x2add43['options']['include'],function(_0x5469d4){return{'model':db[_0x5469d4[_0x086c('0x1f')]],'as':_0x5469d4['as'],'attributes':_0x5469d4['attributes'],'include':_0x5469d4['include']?_[_0x086c('0x1e')](_0x5469d4['include'],function(_0x7884d1){return{'model':db[_0x7884d1[_0x086c('0x1f')]],'as':_0x7884d1['as'],'attributes':_0x7884d1['attributes'],'include':_0x7884d1['include']?_[_0x086c('0x1e')](_0x7884d1[_0x086c('0x20')],function(_0x2ee764){return{'model':db[_0x2ee764[_0x086c('0x1f')]],'as':_0x2ee764['as'],'attributes':_0x2ee764['attributes']};}):[]};}):[]};}):[]:[]})[_0x086c('0xc')](function(_0x24b233){logger['info']('GetZohoAccount',_0x2add43);logger['debug'](_0x086c('0x17'),_0x2add43,JSON[_0x086c('0x10')](_0x24b233));_0x5463d6(_0x24b233);})['catch'](function(_0x23e8e3){logger['error'](_0x086c('0x17'),_0x23e8e3[_0x086c('0x14')],_0x2add43);_0x3bac0c(_0x5dc891[_0x086c('0x11')](0x1f4,_0x23e8e3['message']));});});};exports[_0x086c('0x21')]=function(_0x1988d0){var _0x4b9e4c=this;return new Promise(function(_0x5e3d48,_0x338d4f){return db['ZohoAccount'][_0x086c('0x22')]({'raw':_0x1988d0['options']?_0x1988d0[_0x086c('0x1a')][_0x086c('0x23')]===undefined?!![]:![]:!![],'where':_0x1988d0['options']?_0x1988d0[_0x086c('0x1a')][_0x086c('0x1b')]||null:null,'attributes':_0x1988d0[_0x086c('0x1a')]?_0x1988d0['options']['attributes']||null:null,'include':_0x1988d0['options']?_0x1988d0['options'][_0x086c('0x20')]?_[_0x086c('0x1e')](_0x1988d0['options']['include'],function(_0x3e0a2b){return{'model':db[_0x3e0a2b[_0x086c('0x1f')]],'as':_0x3e0a2b['as'],'attributes':_0x3e0a2b[_0x086c('0x1c')],'include':_0x3e0a2b[_0x086c('0x20')]?_[_0x086c('0x1e')](_0x3e0a2b[_0x086c('0x20')],function(_0x4e20ec){return{'model':db[_0x4e20ec[_0x086c('0x1f')]],'as':_0x4e20ec['as'],'attributes':_0x4e20ec[_0x086c('0x1c')],'include':_0x4e20ec['include']?_['map'](_0x4e20ec['include'],function(_0x44904c){return{'model':db[_0x44904c['model']],'as':_0x44904c['as'],'attributes':_0x44904c[_0x086c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x086c('0xc')](function(_0x47ef5d){logger[_0x086c('0x15')]('ShowZohoAccount',_0x1988d0);logger['debug']('ShowZohoAccount',_0x1988d0,JSON[_0x086c('0x10')](_0x47ef5d));_0x5e3d48(_0x47ef5d);})[_0x086c('0x24')](function(_0x1b55b2){logger[_0x086c('0x11')](_0x086c('0x21'),_0x1b55b2[_0x086c('0x14')],_0x1988d0);_0x338d4f(_0x4b9e4c[_0x086c('0x11')](0x1f4,_0x1b55b2[_0x086c('0x14')]));});});}; \ No newline at end of file +var _0xccef=['http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','include','map','model','attributes','find','where','then','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x457284,_0x228383){var _0x56987f=function(_0x2c2105){while(--_0x2c2105){_0x457284['push'](_0x457284['shift']());}};_0x56987f(++_0x228383);}(_0xccef,0x1d4));var _0xfcce=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xccef[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});}exports[_0xfcce('0x15')]=function(_0x40f6e4){var _0x60cee0=this;return new Promise(function(_0x3a8854,_0x33f5e2){return db[_0xfcce('0x16')][_0xfcce('0x17')]({'raw':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x19')]===undefined?!![]:![]:!![],'where':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')]['where']||null:null,'attributes':_0x40f6e4['options']?_0x40f6e4[_0xfcce('0x18')]['attributes']||null:null,'limit':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')]['limit']||null:null,'include':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x1a')],function(_0x52f3c8){return{'model':db[_0x52f3c8[_0xfcce('0x1c')]],'as':_0x52f3c8['as'],'attributes':_0x52f3c8[_0xfcce('0x1d')],'include':_0x52f3c8[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x52f3c8['include'],function(_0x4ca849){return{'model':db[_0x4ca849[_0xfcce('0x1c')]],'as':_0x4ca849['as'],'attributes':_0x4ca849[_0xfcce('0x1d')],'include':_0x4ca849[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x4ca849['include'],function(_0x428a4e){return{'model':db[_0x428a4e[_0xfcce('0x1c')]],'as':_0x428a4e['as'],'attributes':_0x428a4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413adf){logger[_0xfcce('0xa')](_0xfcce('0x15'),_0x40f6e4);logger[_0xfcce('0xd')](_0xfcce('0x15'),_0x40f6e4,JSON[_0xfcce('0xf')](_0x413adf));_0x3a8854(_0x413adf);})[_0xfcce('0x14')](function(_0x3b7592){logger[_0xfcce('0x10')](_0xfcce('0x15'),_0x3b7592['message'],_0x40f6e4);_0x33f5e2(_0x60cee0[_0xfcce('0x10')](0x1f4,_0x3b7592['message']));});});};exports['ShowZohoAccount']=function(_0x1aaddd){var _0x46d99c=this;return new Promise(function(_0x43dc0a,_0x40c460){return db[_0xfcce('0x16')][_0xfcce('0x1e')]({'raw':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1f')]||null:null,'attributes':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1d')]||null:null,'include':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1a')],function(_0xb6015b){return{'model':db[_0xb6015b[_0xfcce('0x1c')]],'as':_0xb6015b['as'],'attributes':_0xb6015b['attributes'],'include':_0xb6015b[_0xfcce('0x1a')]?_['map'](_0xb6015b[_0xfcce('0x1a')],function(_0x278411){return{'model':db[_0x278411[_0xfcce('0x1c')]],'as':_0x278411['as'],'attributes':_0x278411[_0xfcce('0x1d')],'include':_0x278411[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x278411[_0xfcce('0x1a')],function(_0x3b4efd){return{'model':db[_0x3b4efd[_0xfcce('0x1c')]],'as':_0x3b4efd['as'],'attributes':_0x3b4efd[_0xfcce('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfcce('0x20')](function(_0x12e4fc){logger[_0xfcce('0xa')](_0xfcce('0x21'),_0x1aaddd);logger[_0xfcce('0xd')](_0xfcce('0x21'),_0x1aaddd,JSON['stringify'](_0x12e4fc));_0x43dc0a(_0x12e4fc);})[_0xfcce('0x14')](function(_0x1edf08){logger['error'](_0xfcce('0x21'),_0x1edf08['message'],_0x1aaddd);_0x40c460(_0x46d99c[_0xfcce('0x10')](0x1f4,_0x1edf08[_0xfcce('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 819777f..fa90e6d 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 _0x8796=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','create','update','delete','destroy'];(function(_0x5539db,_0x94fcb5){var _0x343d55=function(_0xd73c9e){while(--_0xd73c9e){_0x5539db['push'](_0x5539db['shift']());}};_0x343d55(++_0x94fcb5);}(_0x8796,0x12c));var _0x6879=function(_0x28ef3f,_0x155f83){_0x28ef3f=_0x28ef3f-0x0;var _0x37e34d=_0x8796[_0x28ef3f];return _0x37e34d;};'use strict';var multer=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var path=require(_0x6879('0x2'));var timeout=require(_0x6879('0x3'));var express=require(_0x6879('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6879('0x5'));var interaction=require(_0x6879('0x6'));var config=require(_0x6879('0x7'));var controller=require(_0x6879('0x8'));router[_0x6879('0x9')]('/',auth[_0x6879('0xa')](),controller[_0x6879('0xb')]);router[_0x6879('0x9')](_0x6879('0xc'),auth[_0x6879('0xa')](),controller[_0x6879('0xd')]);router[_0x6879('0x9')](_0x6879('0xe'),auth[_0x6879('0xa')](),controller['getFields']);router[_0x6879('0x9')]('/:id/subjects',auth[_0x6879('0xa')](),controller[_0x6879('0xf')]);router['get'](_0x6879('0x10'),auth[_0x6879('0xa')](),controller['getDescriptions']);router[_0x6879('0x11')]('/',auth['isAuthenticated'](),controller[_0x6879('0x12')]);router['put']('/:id',auth[_0x6879('0xa')](),controller[_0x6879('0x13')]);router[_0x6879('0x14')](_0x6879('0xc'),auth['isAuthenticated'](),controller[_0x6879('0x15')]);module[_0x6879('0x16')]=router; \ No newline at end of file +var _0x2f00=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x2f00,0x1e1));var _0x02f0=function(_0x36ec22,_0x4b417a){_0x36ec22=_0x36ec22-0x0;var _0x1c5347=_0x2f00[_0x36ec22];return _0x1c5347;};'use strict';var multer=require('multer');var util=require(_0x02f0('0x0'));var path=require(_0x02f0('0x1'));var timeout=require('connect-timeout');var express=require(_0x02f0('0x2'));var router=express[_0x02f0('0x3')]();var fs_extra=require(_0x02f0('0x4'));var auth=require(_0x02f0('0x5'));var interaction=require(_0x02f0('0x6'));var config=require(_0x02f0('0x7'));var controller=require(_0x02f0('0x8'));router[_0x02f0('0x9')]('/',auth['isAuthenticated'](),controller[_0x02f0('0xa')]);router[_0x02f0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x02f0('0xb')]);router[_0x02f0('0x9')](_0x02f0('0xc'),auth[_0x02f0('0xd')](),controller['getFields']);router[_0x02f0('0x9')](_0x02f0('0xe'),auth['isAuthenticated'](),controller[_0x02f0('0xf')]);router[_0x02f0('0x9')](_0x02f0('0x10'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x11')]);router[_0x02f0('0x12')]('/',auth['isAuthenticated'](),controller[_0x02f0('0x13')]);router[_0x02f0('0x14')](_0x02f0('0x15'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x16')]);router['delete'](_0x02f0('0x15'),auth[_0x02f0('0xd')](),controller['destroy']);module[_0x02f0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 79274b8..c46872b 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 _0x3c70=['contact','nothing','ENUM','contact_lead','sequelize','exports','STRING','lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c70,0x10c));var _0x03c7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3c70[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x03c7('0x0'));module[_0x03c7('0x1')]={'name':{'type':Sequelize[_0x03c7('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x03c7('0x3'),_0x03c7('0x4'),_0x03c7('0x5')),'defaultValue':_0x03c7('0x3')},'moduleSearch':{'type':Sequelize[_0x03c7('0x6')](_0x03c7('0x7'),'contact',_0x03c7('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x03c7('0x2')]}}; \ No newline at end of file +var _0xcd65=['contact','contact_lead','STRING','sequelize','exports','ENUM','lead','nothing'];(function(_0x55ca4f,_0x191785){var _0x2aafd4=function(_0x208298){while(--_0x208298){_0x55ca4f['push'](_0x55ca4f['shift']());}};_0x2aafd4(++_0x191785);}(_0xcd65,0x12b));var _0x5cd6=function(_0x98197,_0xea7356){_0x98197=_0x98197-0x0;var _0x5d9199=_0xcd65[_0x98197];return _0x5d9199;};'use strict';var Sequelize=require(_0x5cd6('0x0'));module[_0x5cd6('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x5cd6('0x2')](_0x5cd6('0x3'),'contact',_0x5cd6('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x5cd6('0x5'),_0x5cd6('0x3')),'defaultValue':_0x5cd6('0x6')},'description':{'type':Sequelize[_0x5cd6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b10cfac..4a549c0 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 _0x71d0=['pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','findAll','catch','show','params','find','create','body','destroy','ZohoField'];(function(_0x4fcf28,_0x3026be){var _0x4a7676=function(_0x2fec94){while(--_0x2fec94){_0x4fcf28['push'](_0x4fcf28['shift']());}};_0x4a7676(++_0x3026be);}(_0x71d0,0xec));var _0x071d=function(_0x5d20da,_0x45ba0a){_0x5d20da=_0x5d20da-0x0;var _0x2774ac=_0x71d0[_0x5d20da];return _0x2774ac;};'use strict';var emlformat=require(_0x071d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x071d('0x1'));var jsonpatch=require(_0x071d('0x2'));var rp=require(_0x071d('0x3'));var moment=require(_0x071d('0x4'));var BPromise=require(_0x071d('0x5'));var Mustache=require(_0x071d('0x6'));var util=require('util');var path=require(_0x071d('0x7'));var sox=require(_0x071d('0x8'));var csv=require('to-csv');var ejs=require(_0x071d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x071d('0xa'));var crypto=require('crypto');var jsforce=require(_0x071d('0xb'));var deskjs=require(_0x071d('0xc'));var toCsv=require(_0x071d('0xd'));var querystring=require(_0x071d('0xe'));var Papa=require(_0x071d('0xf'));var Redis=require(_0x071d('0x10'));var authService=require(_0x071d('0x11'));var qs=require(_0x071d('0x12'));var as=require(_0x071d('0x13'));var hardwareService=require(_0x071d('0x14'));var logger=require('../../config/logger')(_0x071d('0x15'));var utils=require(_0x071d('0x16'));var config=require(_0x071d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x071d('0x18'))['db'];function respondWithStatusCode(_0x20e0f7,_0x244097){_0x244097=_0x244097||0xcc;return function(_0x1a3b0b){if(_0x1a3b0b){return _0x20e0f7[_0x071d('0x19')](_0x244097);}return _0x20e0f7[_0x071d('0x1a')](_0x244097)[_0x071d('0x1b')]();};}function respondWithResult(_0xb4671,_0x819e3c){_0x819e3c=_0x819e3c||0xc8;return function(_0x47c76a){if(_0x47c76a){return _0xb4671[_0x071d('0x1a')](_0x819e3c)['json'](_0x47c76a);}};}function respondWithFilteredResult(_0x542b85,_0x1e308b){return function(_0x317e9f){if(_0x317e9f){var _0x6061f0=typeof _0x1e308b[_0x071d('0x1c')]===_0x071d('0x1d')&&typeof _0x1e308b[_0x071d('0x1e')]===_0x071d('0x1d');var _0x11f511=_0x317e9f[_0x071d('0x1f')];var _0x3dab17=_0x6061f0?0x0:_0x1e308b['offset'];var _0x1ae944=_0x6061f0?_0x317e9f['count']:_0x1e308b['offset']+_0x1e308b[_0x071d('0x1e')];var _0xf5a98c;if(_0x1ae944>=_0x11f511){_0x1ae944=_0x11f511;_0xf5a98c=0xc8;}else{_0xf5a98c=0xce;}_0x542b85[_0x071d('0x1a')](_0xf5a98c);return _0x542b85[_0x071d('0x20')]('Content-Range',_0x3dab17+'-'+_0x1ae944+'/'+_0x11f511)[_0x071d('0x21')](_0x317e9f);}return null;};}function patchUpdates(_0x4df52d){return function(_0x3107f9){try{jsonpatch[_0x071d('0x22')](_0x3107f9,_0x4df52d,!![]);}catch(_0x4158ce){return BPromise['reject'](_0x4158ce);}return _0x3107f9[_0x071d('0x23')]();};}function saveUpdates(_0x3da4d2,_0x2f48dd){return function(_0x24bca5){if(_0x24bca5){return _0x24bca5[_0x071d('0x24')](_0x3da4d2)[_0x071d('0x25')](function(_0x32f5be){return _0x32f5be;});}return null;};}function removeEntity(_0x718b5b,_0x260b1d){return function(_0x47019b){if(_0x47019b){return _0x47019b['destroy']()[_0x071d('0x25')](function(){_0x718b5b[_0x071d('0x1a')](0xcc)[_0x071d('0x1b')]();});}};}function handleEntityNotFound(_0x9fb9b1,_0x576a19){return function(_0x4de42f){if(!_0x4de42f){_0x9fb9b1['sendStatus'](0x194);}return _0x4de42f;};}function handleError(_0x8a092e,_0x5afa25){_0x5afa25=_0x5afa25||0x1f4;return function(_0x1b267c){logger['error'](_0x1b267c['stack']);if(_0x1b267c[_0x071d('0x26')]){delete _0x1b267c['name'];}_0x8a092e[_0x071d('0x1a')](_0x5afa25)[_0x071d('0x27')](_0x1b267c);};}exports[_0x071d('0x28')]=function(_0xbd8686,_0x70f98){var _0x1d2152={},_0x3fef85={},_0x24ed24={'count':0x0,'rows':[]};var _0x43c02c=_[_0x071d('0x29')](db['ZohoConfiguration'][_0x071d('0x2a')],function(_0x393ba8){return{'name':_0x393ba8[_0x071d('0x2b')],'type':_0x393ba8['type'][_0x071d('0x2c')]};});_0x3fef85[_0x071d('0x2d')]=_[_0x071d('0x29')](_0x43c02c,'name');_0x3fef85[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0xbd8686[_0x071d('0x2e')]);_0x3fef85[_0x071d('0x30')]=_[_0x071d('0x31')](_0x3fef85[_0x071d('0x2d')],_0x3fef85[_0x071d('0x2e')]);_0x1d2152[_0x071d('0x32')]=_[_0x071d('0x31')](_0x3fef85[_0x071d('0x2d')],qs[_0x071d('0x33')](_0xbd8686['query'][_0x071d('0x33')]));_0x1d2152[_0x071d('0x32')]=_0x1d2152[_0x071d('0x32')][_0x071d('0x34')]?_0x1d2152['attributes']:_0x3fef85[_0x071d('0x2d')];if(!_0xbd8686[_0x071d('0x2e')][_0x071d('0x35')]('nolimit')){_0x1d2152[_0x071d('0x1e')]=qs[_0x071d('0x1e')](_0xbd8686[_0x071d('0x2e')][_0x071d('0x1e')]);_0x1d2152['offset']=qs[_0x071d('0x1c')](_0xbd8686[_0x071d('0x2e')]['offset']);}_0x1d2152[_0x071d('0x36')]=qs[_0x071d('0x37')](_0xbd8686['query']['sort']);_0x1d2152[_0x071d('0x38')]=qs[_0x071d('0x30')](_['pick'](_0xbd8686[_0x071d('0x2e')],_0x3fef85[_0x071d('0x30')]),_0x43c02c);if(_0xbd8686[_0x071d('0x2e')][_0x071d('0x39')]){_0x1d2152[_0x071d('0x38')]=_[_0x071d('0x3a')](_0x1d2152[_0x071d('0x38')],{'$or':_[_0x071d('0x29')](_0x43c02c,function(_0x51d7c4){if(_0x51d7c4['type']!==_0x071d('0x3b')){var _0x2996bf={};_0x2996bf[_0x51d7c4[_0x071d('0x26')]]={'$like':'%'+_0xbd8686[_0x071d('0x2e')]['filter']+'%'};return _0x2996bf;}})});}_0x1d2152=_['merge']({},_0x1d2152,_0xbd8686[_0x071d('0x3c')]);var _0x33e0b9={'where':_0x1d2152[_0x071d('0x38')]};return db[_0x071d('0x3d')][_0x071d('0x1f')](_0x33e0b9)[_0x071d('0x25')](function(_0xf10181){_0x24ed24['count']=_0xf10181;if(_0xbd8686[_0x071d('0x2e')][_0x071d('0x3e')]){_0x1d2152['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x071d('0x3f')](_0x1d2152);})[_0x071d('0x25')](function(_0x405d02){_0x24ed24['rows']=_0x405d02;return _0x24ed24;})[_0x071d('0x25')](respondWithFilteredResult(_0x70f98,_0x1d2152))[_0x071d('0x40')](handleError(_0x70f98,null));};exports[_0x071d('0x41')]=function(_0x27886b,_0x35402b){var _0x181e67={'raw':![],'where':{'id':_0x27886b[_0x071d('0x42')]['id']}},_0x29a28d={};_0x29a28d[_0x071d('0x2d')]=_['keys'](db[_0x071d('0x3d')][_0x071d('0x2a')]);_0x29a28d[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0x27886b[_0x071d('0x2e')]);_0x29a28d[_0x071d('0x30')]=_[_0x071d('0x31')](_0x29a28d[_0x071d('0x2d')],_0x29a28d[_0x071d('0x2e')]);_0x181e67[_0x071d('0x32')]=_[_0x071d('0x31')](_0x29a28d['model'],qs[_0x071d('0x33')](_0x27886b[_0x071d('0x2e')]['fields']));_0x181e67[_0x071d('0x32')]=_0x181e67[_0x071d('0x32')][_0x071d('0x34')]?_0x181e67['attributes']:_0x29a28d[_0x071d('0x2d')];if(_0x27886b[_0x071d('0x2e')][_0x071d('0x3e')]){_0x181e67['include']=[{'all':!![]}];}_0x181e67=_[_0x071d('0x3a')]({},_0x181e67,_0x27886b[_0x071d('0x3c')]);return db['ZohoConfiguration'][_0x071d('0x43')](_0x181e67)[_0x071d('0x25')](handleEntityNotFound(_0x35402b,null))[_0x071d('0x25')](respondWithResult(_0x35402b,null))[_0x071d('0x40')](handleError(_0x35402b,null));};exports[_0x071d('0x44')]=function(_0x14c9ac,_0x2520f8){return db['ZohoConfiguration']['create'](_0x14c9ac[_0x071d('0x45')],{})[_0x071d('0x25')](respondWithResult(_0x2520f8,0xc9))[_0x071d('0x40')](handleError(_0x2520f8,null));};exports['update']=function(_0x35ebfa,_0x191cc9){if(_0x35ebfa[_0x071d('0x45')]['id']){delete _0x35ebfa[_0x071d('0x45')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x35ebfa[_0x071d('0x42')]['id']}})['then'](handleEntityNotFound(_0x191cc9,null))[_0x071d('0x25')](saveUpdates(_0x35ebfa[_0x071d('0x45')],null))['then'](respondWithResult(_0x191cc9,null))['catch'](handleError(_0x191cc9,null));};exports[_0x071d('0x46')]=function(_0x5e653d,_0x5a00f7){return db[_0x071d('0x3d')][_0x071d('0x43')]({'where':{'id':_0x5e653d[_0x071d('0x42')]['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x5a00f7,null))[_0x071d('0x25')](removeEntity(_0x5a00f7,null))['catch'](handleError(_0x5a00f7,null));};exports['getFields']=function(_0x1d6e18,_0x467090,_0x2cd77a){var _0x3aae0e={};var _0x1688b2={};var _0x351bb6;var _0x2e7d69;return db[_0x071d('0x3d')]['findOne']({'where':{'id':_0x1d6e18[_0x071d('0x42')]['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x467090,null))[_0x071d('0x25')](function(_0x1a0325){if(_0x1a0325){_0x351bb6=_0x1a0325;_0x1688b2[_0x071d('0x2d')]=_[_0x071d('0x2f')](db[_0x071d('0x47')][_0x071d('0x2a')]);_0x1688b2['query']=_[_0x071d('0x2f')](_0x1d6e18[_0x071d('0x2e')]);_0x1688b2[_0x071d('0x30')]=_[_0x071d('0x31')](_0x1688b2[_0x071d('0x2d')],_0x1688b2[_0x071d('0x2e')]);_0x3aae0e[_0x071d('0x32')]=_[_0x071d('0x31')](_0x1688b2['model'],qs[_0x071d('0x33')](_0x1d6e18[_0x071d('0x2e')][_0x071d('0x33')]));_0x3aae0e[_0x071d('0x32')]=_0x3aae0e[_0x071d('0x32')]['length']?_0x3aae0e['attributes']:_0x1688b2[_0x071d('0x2d')];_0x3aae0e[_0x071d('0x36')]=qs[_0x071d('0x37')](_0x1d6e18['query'][_0x071d('0x37')]);_0x3aae0e[_0x071d('0x38')]=qs['filters'](_[_0x071d('0x48')](_0x1d6e18[_0x071d('0x2e')],_0x1688b2[_0x071d('0x30')]));if(_0x1d6e18[_0x071d('0x2e')]['filter']){_0x3aae0e[_0x071d('0x38')]=_[_0x071d('0x3a')](_0x3aae0e[_0x071d('0x38')],{'$or':_[_0x071d('0x29')](_0x3aae0e[_0x071d('0x32')],function(_0x1825e3){var _0x4ff315={};_0x4ff315[_0x1825e3]={'$like':'%'+_0x1d6e18['query'][_0x071d('0x39')]+'%'};return _0x4ff315;})});}_0x3aae0e=_[_0x071d('0x3a')]({},_0x3aae0e,_0x1d6e18[_0x071d('0x3c')]);return _0x351bb6['getFields'](_0x3aae0e);}})[_0x071d('0x25')](function(_0x5aec5d){if(_0x5aec5d){_0x2e7d69=_0x5aec5d['length'];if(!_0x1d6e18['query']['hasOwnProperty'](_0x071d('0x49'))){_0x3aae0e[_0x071d('0x1e')]=qs[_0x071d('0x1e')](_0x1d6e18[_0x071d('0x2e')][_0x071d('0x1e')]);_0x3aae0e[_0x071d('0x1c')]=qs[_0x071d('0x1c')](_0x1d6e18[_0x071d('0x2e')][_0x071d('0x1c')]);}return _0x351bb6['getFields'](_0x3aae0e);}})['then'](function(_0x2539e8){if(_0x2539e8){return _0x2539e8?{'count':_0x2e7d69,'rows':_0x2539e8}:null;}})['then'](respondWithResult(_0x467090,null))[_0x071d('0x40')](handleError(_0x467090,null));};exports[_0x071d('0x4a')]=function(_0x25bb9f,_0x4d0d36,_0x6d1743){var _0x3dc3df={};var _0x418bb7={};var _0x21b251;var _0x4184fe;return db[_0x071d('0x3d')][_0x071d('0x4b')]({'where':{'id':_0x25bb9f[_0x071d('0x42')]['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x4d0d36,null))[_0x071d('0x25')](function(_0x1140a5){if(_0x1140a5){_0x21b251=_0x1140a5;_0x418bb7['model']=_[_0x071d('0x2f')](db['ZohoField'][_0x071d('0x2a')]);_0x418bb7[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0x25bb9f['query']);_0x418bb7[_0x071d('0x30')]=_[_0x071d('0x31')](_0x418bb7[_0x071d('0x2d')],_0x418bb7[_0x071d('0x2e')]);_0x3dc3df['attributes']=_[_0x071d('0x31')](_0x418bb7[_0x071d('0x2d')],qs[_0x071d('0x33')](_0x25bb9f[_0x071d('0x2e')][_0x071d('0x33')]));_0x3dc3df[_0x071d('0x32')]=_0x3dc3df[_0x071d('0x32')][_0x071d('0x34')]?_0x3dc3df['attributes']:_0x418bb7[_0x071d('0x2d')];_0x3dc3df['order']=qs['sort'](_0x25bb9f[_0x071d('0x2e')][_0x071d('0x37')]);_0x3dc3df[_0x071d('0x38')]=qs[_0x071d('0x30')](_[_0x071d('0x48')](_0x25bb9f[_0x071d('0x2e')],_0x418bb7['filters']));if(_0x25bb9f[_0x071d('0x2e')][_0x071d('0x39')]){_0x3dc3df[_0x071d('0x38')]=_[_0x071d('0x3a')](_0x3dc3df['where'],{'$or':_[_0x071d('0x29')](_0x3dc3df[_0x071d('0x32')],function(_0x10debc){var _0x549d72={};_0x549d72[_0x10debc]={'$like':'%'+_0x25bb9f[_0x071d('0x2e')][_0x071d('0x39')]+'%'};return _0x549d72;})});}_0x3dc3df=_[_0x071d('0x3a')]({},_0x3dc3df,_0x25bb9f[_0x071d('0x3c')]);return _0x21b251['getSubjects'](_0x3dc3df);}})['then'](function(_0x25b6d7){if(_0x25b6d7){_0x4184fe=_0x25b6d7['length'];if(!_0x25bb9f['query']['hasOwnProperty'](_0x071d('0x49'))){_0x3dc3df[_0x071d('0x1e')]=qs[_0x071d('0x1e')](_0x25bb9f[_0x071d('0x2e')][_0x071d('0x1e')]);_0x3dc3df[_0x071d('0x1c')]=qs[_0x071d('0x1c')](_0x25bb9f['query'][_0x071d('0x1c')]);}return _0x21b251[_0x071d('0x4a')](_0x3dc3df);}})[_0x071d('0x25')](function(_0x29080c){if(_0x29080c){return _0x29080c?{'count':_0x4184fe,'rows':_0x29080c}:null;}})[_0x071d('0x25')](respondWithResult(_0x4d0d36,null))['catch'](handleError(_0x4d0d36,null));};exports['getDescriptions']=function(_0x56d518,_0x3f0436,_0x27a59f){var _0x5dfa20={};var _0x2d2477={};var _0x29d695;var _0x13da98;return db[_0x071d('0x3d')][_0x071d('0x4b')]({'where':{'id':_0x56d518['params']['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x3f0436,null))[_0x071d('0x25')](function(_0x24de9f){if(_0x24de9f){_0x29d695=_0x24de9f;_0x2d2477[_0x071d('0x2d')]=_[_0x071d('0x2f')](db[_0x071d('0x47')][_0x071d('0x2a')]);_0x2d2477[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0x56d518['query']);_0x2d2477[_0x071d('0x30')]=_[_0x071d('0x31')](_0x2d2477[_0x071d('0x2d')],_0x2d2477[_0x071d('0x2e')]);_0x5dfa20[_0x071d('0x32')]=_[_0x071d('0x31')](_0x2d2477[_0x071d('0x2d')],qs[_0x071d('0x33')](_0x56d518[_0x071d('0x2e')][_0x071d('0x33')]));_0x5dfa20['attributes']=_0x5dfa20[_0x071d('0x32')][_0x071d('0x34')]?_0x5dfa20[_0x071d('0x32')]:_0x2d2477[_0x071d('0x2d')];_0x5dfa20[_0x071d('0x36')]=qs['sort'](_0x56d518[_0x071d('0x2e')][_0x071d('0x37')]);_0x5dfa20['where']=qs[_0x071d('0x30')](_[_0x071d('0x48')](_0x56d518[_0x071d('0x2e')],_0x2d2477[_0x071d('0x30')]));if(_0x56d518[_0x071d('0x2e')][_0x071d('0x39')]){_0x5dfa20[_0x071d('0x38')]=_['merge'](_0x5dfa20[_0x071d('0x38')],{'$or':_[_0x071d('0x29')](_0x5dfa20[_0x071d('0x32')],function(_0x1f83bd){var _0x2d7745={};_0x2d7745[_0x1f83bd]={'$like':'%'+_0x56d518[_0x071d('0x2e')][_0x071d('0x39')]+'%'};return _0x2d7745;})});}_0x5dfa20=_[_0x071d('0x3a')]({},_0x5dfa20,_0x56d518['options']);return _0x29d695[_0x071d('0x4c')](_0x5dfa20);}})[_0x071d('0x25')](function(_0x1deda2){if(_0x1deda2){_0x13da98=_0x1deda2[_0x071d('0x34')];if(!_0x56d518[_0x071d('0x2e')]['hasOwnProperty'](_0x071d('0x49'))){_0x5dfa20[_0x071d('0x1e')]=qs['limit'](_0x56d518[_0x071d('0x2e')]['limit']);_0x5dfa20[_0x071d('0x1c')]=qs['offset'](_0x56d518[_0x071d('0x2e')]['offset']);}return _0x29d695[_0x071d('0x4c')](_0x5dfa20);}})[_0x071d('0x25')](function(_0x279335){if(_0x279335){return _0x279335?{'count':_0x13da98,'rows':_0x279335}:null;}})[_0x071d('0x25')](respondWithResult(_0x3f0436,null))[_0x071d('0x40')](handleError(_0x3f0436,null));}; \ No newline at end of file +var _0xa888=['apply','reject','save','update','destroy','error','name','send','index','ZohoConfiguration','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','then','catch','show','params','keys','options','create','body','find','getFields','findOne','ZohoField','order','pick','getSubjects','getDescriptions','eml-format','request-promise','mustache','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json'];(function(_0x462b05,_0x2a6a8d){var _0x53d9c6=function(_0x483d92){while(--_0x483d92){_0x462b05['push'](_0x462b05['shift']());}};_0x53d9c6(++_0x2a6a8d);}(_0xa888,0x113));var _0x8a88=function(_0x4399e1,_0x33c7aa){_0x4399e1=_0x4399e1-0x0;var _0x7294d2=_0xa888[_0x4399e1];return _0x7294d2;};'use strict';var emlformat=require(_0x8a88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a88('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8a88('0x2'));var util=require('util');var path=require(_0x8a88('0x3'));var sox=require(_0x8a88('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a88('0x5'));var _=require(_0x8a88('0x6'));var squel=require('squel');var crypto=require(_0x8a88('0x7'));var jsforce=require(_0x8a88('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x8a88('0x9'));var querystring=require(_0x8a88('0xa'));var Papa=require('papaparse');var Redis=require(_0x8a88('0xb'));var authService=require(_0x8a88('0xc'));var qs=require(_0x8a88('0xd'));var as=require(_0x8a88('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8a88('0xf'));var utils=require(_0x8a88('0x10'));var config=require(_0x8a88('0x11'));var licenseUtil=require(_0x8a88('0x12'));var db=require(_0x8a88('0x13'))['db'];function respondWithStatusCode(_0x5a8395,_0x1c5362){_0x1c5362=_0x1c5362||0xcc;return function(_0x57a5f7){if(_0x57a5f7){return _0x5a8395[_0x8a88('0x14')](_0x1c5362);}return _0x5a8395[_0x8a88('0x15')](_0x1c5362)[_0x8a88('0x16')]();};}function respondWithResult(_0x54c1f5,_0x5e6a04){_0x5e6a04=_0x5e6a04||0xc8;return function(_0x472510){if(_0x472510){return _0x54c1f5[_0x8a88('0x15')](_0x5e6a04)['json'](_0x472510);}};}function respondWithFilteredResult(_0x235814,_0x40d4ab){return function(_0x13847c){if(_0x13847c){var _0x36820f=typeof _0x40d4ab[_0x8a88('0x17')]==='undefined'&&typeof _0x40d4ab[_0x8a88('0x18')]==='undefined';var _0x59feeb=_0x13847c[_0x8a88('0x19')];var _0x1cb575=_0x36820f?0x0:_0x40d4ab['offset'];var _0x5ca025=_0x36820f?_0x13847c[_0x8a88('0x19')]:_0x40d4ab[_0x8a88('0x17')]+_0x40d4ab[_0x8a88('0x18')];var _0x23f7aa;if(_0x5ca025>=_0x59feeb){_0x5ca025=_0x59feeb;_0x23f7aa=0xc8;}else{_0x23f7aa=0xce;}_0x235814[_0x8a88('0x15')](_0x23f7aa);return _0x235814[_0x8a88('0x1a')](_0x8a88('0x1b'),_0x1cb575+'-'+_0x5ca025+'/'+_0x59feeb)[_0x8a88('0x1c')](_0x13847c);}return null;};}function patchUpdates(_0x6458c6){return function(_0x5f0828){try{jsonpatch[_0x8a88('0x1d')](_0x5f0828,_0x6458c6,!![]);}catch(_0x3bfe72){return BPromise[_0x8a88('0x1e')](_0x3bfe72);}return _0x5f0828[_0x8a88('0x1f')]();};}function saveUpdates(_0x3f83bf,_0x593b90){return function(_0x48855a){if(_0x48855a){return _0x48855a[_0x8a88('0x20')](_0x3f83bf)['then'](function(_0xe7b76e){return _0xe7b76e;});}return null;};}function removeEntity(_0x185a1b,_0x479029){return function(_0x158ce0){if(_0x158ce0){return _0x158ce0[_0x8a88('0x21')]()['then'](function(){_0x185a1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eadd9,_0x12427a){return function(_0x908356){if(!_0x908356){_0x3eadd9['sendStatus'](0x194);}return _0x908356;};}function handleError(_0x1747fd,_0xa2650d){_0xa2650d=_0xa2650d||0x1f4;return function(_0x44b906){logger[_0x8a88('0x22')](_0x44b906['stack']);if(_0x44b906[_0x8a88('0x23')]){delete _0x44b906['name'];}_0x1747fd['status'](_0xa2650d)[_0x8a88('0x24')](_0x44b906);};}exports[_0x8a88('0x25')]=function(_0xb599be,_0x574119){var _0x484988={},_0x2e444e={},_0x3e2918={'count':0x0,'rows':[]};var _0x52056e=_['map'](db[_0x8a88('0x26')][_0x8a88('0x27')],function(_0x1a5cd9){return{'name':_0x1a5cd9[_0x8a88('0x28')],'type':_0x1a5cd9['type']['key']};});_0x2e444e['model']=_['map'](_0x52056e,_0x8a88('0x23'));_0x2e444e[_0x8a88('0x29')]=_['keys'](_0xb599be['query']);_0x2e444e[_0x8a88('0x2a')]=_[_0x8a88('0x2b')](_0x2e444e[_0x8a88('0x2c')],_0x2e444e[_0x8a88('0x29')]);_0x484988[_0x8a88('0x2d')]=_[_0x8a88('0x2b')](_0x2e444e[_0x8a88('0x2c')],qs['fields'](_0xb599be[_0x8a88('0x29')][_0x8a88('0x2e')]));_0x484988[_0x8a88('0x2d')]=_0x484988['attributes'][_0x8a88('0x2f')]?_0x484988[_0x8a88('0x2d')]:_0x2e444e[_0x8a88('0x2c')];if(!_0xb599be['query'][_0x8a88('0x30')](_0x8a88('0x31'))){_0x484988[_0x8a88('0x18')]=qs['limit'](_0xb599be[_0x8a88('0x29')][_0x8a88('0x18')]);_0x484988[_0x8a88('0x17')]=qs[_0x8a88('0x17')](_0xb599be[_0x8a88('0x29')]['offset']);}_0x484988['order']=qs[_0x8a88('0x32')](_0xb599be[_0x8a88('0x29')][_0x8a88('0x32')]);_0x484988[_0x8a88('0x33')]=qs['filters'](_['pick'](_0xb599be[_0x8a88('0x29')],_0x2e444e[_0x8a88('0x2a')]),_0x52056e);if(_0xb599be['query'][_0x8a88('0x34')]){_0x484988['where']=_[_0x8a88('0x35')](_0x484988[_0x8a88('0x33')],{'$or':_[_0x8a88('0x36')](_0x52056e,function(_0x252b35){if(_0x252b35[_0x8a88('0x37')]!==_0x8a88('0x38')){var _0x1bdf5a={};_0x1bdf5a[_0x252b35[_0x8a88('0x23')]]={'$like':'%'+_0xb599be[_0x8a88('0x29')][_0x8a88('0x34')]+'%'};return _0x1bdf5a;}})});}_0x484988=_[_0x8a88('0x35')]({},_0x484988,_0xb599be['options']);var _0x57c7e3={'where':_0x484988['where']};return db[_0x8a88('0x26')][_0x8a88('0x19')](_0x57c7e3)['then'](function(_0x490ccd){_0x3e2918[_0x8a88('0x19')]=_0x490ccd;if(_0xb599be[_0x8a88('0x29')][_0x8a88('0x39')]){_0x484988[_0x8a88('0x3a')]=[{'all':!![]}];}return db[_0x8a88('0x26')][_0x8a88('0x3b')](_0x484988);})['then'](function(_0x11146f){_0x3e2918['rows']=_0x11146f;return _0x3e2918;})[_0x8a88('0x3c')](respondWithFilteredResult(_0x574119,_0x484988))[_0x8a88('0x3d')](handleError(_0x574119,null));};exports[_0x8a88('0x3e')]=function(_0x24f0df,_0x5a6364){var _0xba2028={'raw':![],'where':{'id':_0x24f0df[_0x8a88('0x3f')]['id']}},_0x2f114c={};_0x2f114c[_0x8a88('0x2c')]=_[_0x8a88('0x40')](db[_0x8a88('0x26')][_0x8a88('0x27')]);_0x2f114c['query']=_[_0x8a88('0x40')](_0x24f0df[_0x8a88('0x29')]);_0x2f114c[_0x8a88('0x2a')]=_[_0x8a88('0x2b')](_0x2f114c[_0x8a88('0x2c')],_0x2f114c[_0x8a88('0x29')]);_0xba2028['attributes']=_[_0x8a88('0x2b')](_0x2f114c['model'],qs[_0x8a88('0x2e')](_0x24f0df['query']['fields']));_0xba2028[_0x8a88('0x2d')]=_0xba2028[_0x8a88('0x2d')][_0x8a88('0x2f')]?_0xba2028['attributes']:_0x2f114c[_0x8a88('0x2c')];if(_0x24f0df['query'][_0x8a88('0x39')]){_0xba2028['include']=[{'all':!![]}];}_0xba2028=_[_0x8a88('0x35')]({},_0xba2028,_0x24f0df[_0x8a88('0x41')]);return db[_0x8a88('0x26')]['find'](_0xba2028)[_0x8a88('0x3c')](handleEntityNotFound(_0x5a6364,null))[_0x8a88('0x3c')](respondWithResult(_0x5a6364,null))[_0x8a88('0x3d')](handleError(_0x5a6364,null));};exports[_0x8a88('0x42')]=function(_0x2e4684,_0x4208a9){return db['ZohoConfiguration'][_0x8a88('0x42')](_0x2e4684['body'],{})['then'](respondWithResult(_0x4208a9,0xc9))[_0x8a88('0x3d')](handleError(_0x4208a9,null));};exports['update']=function(_0x2be8fc,_0xacc2ec){if(_0x2be8fc[_0x8a88('0x43')]['id']){delete _0x2be8fc[_0x8a88('0x43')]['id'];}return db['ZohoConfiguration'][_0x8a88('0x44')]({'where':{'id':_0x2be8fc['params']['id']}})['then'](handleEntityNotFound(_0xacc2ec,null))['then'](saveUpdates(_0x2be8fc[_0x8a88('0x43')],null))[_0x8a88('0x3c')](respondWithResult(_0xacc2ec,null))[_0x8a88('0x3d')](handleError(_0xacc2ec,null));};exports[_0x8a88('0x21')]=function(_0x4123a4,_0x32f810){return db[_0x8a88('0x26')][_0x8a88('0x44')]({'where':{'id':_0x4123a4[_0x8a88('0x3f')]['id']}})[_0x8a88('0x3c')](handleEntityNotFound(_0x32f810,null))[_0x8a88('0x3c')](removeEntity(_0x32f810,null))[_0x8a88('0x3d')](handleError(_0x32f810,null));};exports[_0x8a88('0x45')]=function(_0x2c54b8,_0x2867d3,_0x80140b){var _0x5d0160={};var _0x369a10={};var _0x383add;var _0x16d9b6;return db[_0x8a88('0x26')][_0x8a88('0x46')]({'where':{'id':_0x2c54b8[_0x8a88('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2867d3,null))['then'](function(_0x139aff){if(_0x139aff){_0x383add=_0x139aff;_0x369a10['model']=_[_0x8a88('0x40')](db[_0x8a88('0x47')][_0x8a88('0x27')]);_0x369a10['query']=_['keys'](_0x2c54b8[_0x8a88('0x29')]);_0x369a10['filters']=_[_0x8a88('0x2b')](_0x369a10['model'],_0x369a10[_0x8a88('0x29')]);_0x5d0160[_0x8a88('0x2d')]=_[_0x8a88('0x2b')](_0x369a10['model'],qs[_0x8a88('0x2e')](_0x2c54b8[_0x8a88('0x29')][_0x8a88('0x2e')]));_0x5d0160[_0x8a88('0x2d')]=_0x5d0160['attributes'][_0x8a88('0x2f')]?_0x5d0160[_0x8a88('0x2d')]:_0x369a10[_0x8a88('0x2c')];_0x5d0160[_0x8a88('0x48')]=qs[_0x8a88('0x32')](_0x2c54b8[_0x8a88('0x29')][_0x8a88('0x32')]);_0x5d0160['where']=qs['filters'](_[_0x8a88('0x49')](_0x2c54b8[_0x8a88('0x29')],_0x369a10[_0x8a88('0x2a')]));if(_0x2c54b8[_0x8a88('0x29')][_0x8a88('0x34')]){_0x5d0160[_0x8a88('0x33')]=_['merge'](_0x5d0160[_0x8a88('0x33')],{'$or':_[_0x8a88('0x36')](_0x5d0160[_0x8a88('0x2d')],function(_0x2028ec){var _0x4be503={};_0x4be503[_0x2028ec]={'$like':'%'+_0x2c54b8['query'][_0x8a88('0x34')]+'%'};return _0x4be503;})});}_0x5d0160=_[_0x8a88('0x35')]({},_0x5d0160,_0x2c54b8[_0x8a88('0x41')]);return _0x383add[_0x8a88('0x45')](_0x5d0160);}})[_0x8a88('0x3c')](function(_0x202fcc){if(_0x202fcc){_0x16d9b6=_0x202fcc['length'];if(!_0x2c54b8[_0x8a88('0x29')]['hasOwnProperty'](_0x8a88('0x31'))){_0x5d0160['limit']=qs[_0x8a88('0x18')](_0x2c54b8[_0x8a88('0x29')][_0x8a88('0x18')]);_0x5d0160[_0x8a88('0x17')]=qs[_0x8a88('0x17')](_0x2c54b8[_0x8a88('0x29')][_0x8a88('0x17')]);}return _0x383add[_0x8a88('0x45')](_0x5d0160);}})[_0x8a88('0x3c')](function(_0x4912d2){if(_0x4912d2){return _0x4912d2?{'count':_0x16d9b6,'rows':_0x4912d2}:null;}})['then'](respondWithResult(_0x2867d3,null))[_0x8a88('0x3d')](handleError(_0x2867d3,null));};exports['getSubjects']=function(_0x31b150,_0x5bbacd,_0x195d63){var _0xfbd9cb={};var _0x730b4d={};var _0x396bb0;var _0x4fc48f;return db[_0x8a88('0x26')][_0x8a88('0x46')]({'where':{'id':_0x31b150[_0x8a88('0x3f')]['id']}})[_0x8a88('0x3c')](handleEntityNotFound(_0x5bbacd,null))['then'](function(_0x555f6e){if(_0x555f6e){_0x396bb0=_0x555f6e;_0x730b4d[_0x8a88('0x2c')]=_[_0x8a88('0x40')](db[_0x8a88('0x47')]['rawAttributes']);_0x730b4d[_0x8a88('0x29')]=_[_0x8a88('0x40')](_0x31b150[_0x8a88('0x29')]);_0x730b4d['filters']=_[_0x8a88('0x2b')](_0x730b4d[_0x8a88('0x2c')],_0x730b4d[_0x8a88('0x29')]);_0xfbd9cb[_0x8a88('0x2d')]=_[_0x8a88('0x2b')](_0x730b4d[_0x8a88('0x2c')],qs[_0x8a88('0x2e')](_0x31b150['query'][_0x8a88('0x2e')]));_0xfbd9cb['attributes']=_0xfbd9cb[_0x8a88('0x2d')]['length']?_0xfbd9cb[_0x8a88('0x2d')]:_0x730b4d[_0x8a88('0x2c')];_0xfbd9cb[_0x8a88('0x48')]=qs[_0x8a88('0x32')](_0x31b150['query']['sort']);_0xfbd9cb[_0x8a88('0x33')]=qs[_0x8a88('0x2a')](_[_0x8a88('0x49')](_0x31b150['query'],_0x730b4d[_0x8a88('0x2a')]));if(_0x31b150[_0x8a88('0x29')][_0x8a88('0x34')]){_0xfbd9cb['where']=_[_0x8a88('0x35')](_0xfbd9cb[_0x8a88('0x33')],{'$or':_[_0x8a88('0x36')](_0xfbd9cb['attributes'],function(_0x31dc07){var _0x341b4e={};_0x341b4e[_0x31dc07]={'$like':'%'+_0x31b150[_0x8a88('0x29')][_0x8a88('0x34')]+'%'};return _0x341b4e;})});}_0xfbd9cb=_[_0x8a88('0x35')]({},_0xfbd9cb,_0x31b150[_0x8a88('0x41')]);return _0x396bb0[_0x8a88('0x4a')](_0xfbd9cb);}})[_0x8a88('0x3c')](function(_0x439ff0){if(_0x439ff0){_0x4fc48f=_0x439ff0['length'];if(!_0x31b150[_0x8a88('0x29')]['hasOwnProperty']('nolimit')){_0xfbd9cb[_0x8a88('0x18')]=qs['limit'](_0x31b150[_0x8a88('0x29')][_0x8a88('0x18')]);_0xfbd9cb['offset']=qs[_0x8a88('0x17')](_0x31b150['query'][_0x8a88('0x17')]);}return _0x396bb0[_0x8a88('0x4a')](_0xfbd9cb);}})[_0x8a88('0x3c')](function(_0x3859b3){if(_0x3859b3){return _0x3859b3?{'count':_0x4fc48f,'rows':_0x3859b3}:null;}})[_0x8a88('0x3c')](respondWithResult(_0x5bbacd,null))[_0x8a88('0x3d')](handleError(_0x5bbacd,null));};exports[_0x8a88('0x4b')]=function(_0x428cf0,_0x4e9982,_0xe5e680){var _0x1e862d={};var _0x1b09d7={};var _0x5994e2;var _0x9ab97;return db[_0x8a88('0x26')]['findOne']({'where':{'id':_0x428cf0[_0x8a88('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e9982,null))[_0x8a88('0x3c')](function(_0x47e994){if(_0x47e994){_0x5994e2=_0x47e994;_0x1b09d7[_0x8a88('0x2c')]=_[_0x8a88('0x40')](db[_0x8a88('0x47')][_0x8a88('0x27')]);_0x1b09d7[_0x8a88('0x29')]=_[_0x8a88('0x40')](_0x428cf0[_0x8a88('0x29')]);_0x1b09d7[_0x8a88('0x2a')]=_[_0x8a88('0x2b')](_0x1b09d7[_0x8a88('0x2c')],_0x1b09d7['query']);_0x1e862d['attributes']=_[_0x8a88('0x2b')](_0x1b09d7[_0x8a88('0x2c')],qs[_0x8a88('0x2e')](_0x428cf0[_0x8a88('0x29')]['fields']));_0x1e862d[_0x8a88('0x2d')]=_0x1e862d[_0x8a88('0x2d')]['length']?_0x1e862d[_0x8a88('0x2d')]:_0x1b09d7[_0x8a88('0x2c')];_0x1e862d[_0x8a88('0x48')]=qs['sort'](_0x428cf0['query']['sort']);_0x1e862d[_0x8a88('0x33')]=qs['filters'](_[_0x8a88('0x49')](_0x428cf0[_0x8a88('0x29')],_0x1b09d7['filters']));if(_0x428cf0[_0x8a88('0x29')][_0x8a88('0x34')]){_0x1e862d[_0x8a88('0x33')]=_[_0x8a88('0x35')](_0x1e862d['where'],{'$or':_[_0x8a88('0x36')](_0x1e862d['attributes'],function(_0x24f5d9){var _0x424996={};_0x424996[_0x24f5d9]={'$like':'%'+_0x428cf0[_0x8a88('0x29')]['filter']+'%'};return _0x424996;})});}_0x1e862d=_['merge']({},_0x1e862d,_0x428cf0[_0x8a88('0x41')]);return _0x5994e2[_0x8a88('0x4b')](_0x1e862d);}})[_0x8a88('0x3c')](function(_0x33b241){if(_0x33b241){_0x9ab97=_0x33b241['length'];if(!_0x428cf0['query'][_0x8a88('0x30')](_0x8a88('0x31'))){_0x1e862d[_0x8a88('0x18')]=qs[_0x8a88('0x18')](_0x428cf0['query'][_0x8a88('0x18')]);_0x1e862d['offset']=qs[_0x8a88('0x17')](_0x428cf0['query'][_0x8a88('0x17')]);}return _0x5994e2[_0x8a88('0x4b')](_0x1e862d);}})[_0x8a88('0x3c')](function(_0x22e11e){if(_0x22e11e){return _0x22e11e?{'count':_0x9ab97,'rows':_0x22e11e}:null;}})[_0x8a88('0x3c')](respondWithResult(_0x4e9982,null))[_0x8a88('0x3d')](handleError(_0x4e9982,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 557898b..15b9c1a 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 _0x7c67=['exports','ZohoConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x2aaa29,_0x4f017c){var _0x41c7b4=function(_0x511608){while(--_0x511608){_0x2aaa29['push'](_0x2aaa29['shift']());}};_0x41c7b4(++_0x4f017c);}(_0x7c67,0x146));var _0x77c6=function(_0x1342c7,_0x2e370a){_0x1342c7=_0x1342c7-0x0;var _0xf21274=_0x7c67[_0x1342c7];return _0xf21274;};'use strict';var _=require(_0x77c6('0x0'));var util=require(_0x77c6('0x1'));var logger=require(_0x77c6('0x2'))(_0x77c6('0x3'));var moment=require(_0x77c6('0x4'));var BPromise=require('bluebird');var rp=require(_0x77c6('0x5'));var fs=require('fs');var path=require(_0x77c6('0x6'));var rimraf=require(_0x77c6('0x7'));var config=require(_0x77c6('0x8'));var attributes=require(_0x77c6('0x9'));module[_0x77c6('0xa')]=function(_0x54fbdc,_0x283d82){return _0x54fbdc['define'](_0x77c6('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd678=['../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd678,0x190));var _0x8d67=function(_0x6d91a,_0x3c06dc){_0x6d91a=_0x6d91a-0x0;var _0x405faf=_0xd678[_0x6d91a];return _0x405faf;};'use strict';var _=require(_0x8d67('0x0'));var util=require(_0x8d67('0x1'));var logger=require(_0x8d67('0x2'))('api');var moment=require(_0x8d67('0x3'));var BPromise=require(_0x8d67('0x4'));var rp=require(_0x8d67('0x5'));var fs=require('fs');var path=require(_0x8d67('0x6'));var rimraf=require('rimraf');var config=require(_0x8d67('0x7'));var attributes=require(_0x8d67('0x8'));module[_0x8d67('0x9')]=function(_0x33a6c1,_0x241096){return _0x33a6c1[_0x8d67('0xa')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','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 936b438..66f98f6 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 _0x295a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','ioredis'];(function(_0x3f3a36,_0x330420){var _0x1aa001=function(_0xed5acf){while(--_0xed5acf){_0x3f3a36['push'](_0x3f3a36['shift']());}};_0x1aa001(++_0x330420);}(_0x295a,0x65));var _0xa295=function(_0x196c86,_0x1ae6a0){_0x196c86=_0x196c86-0x0;var _0x102c08=_0x295a[_0x196c86];return _0x102c08;};'use strict';var _=require(_0xa295('0x0'));var util=require(_0xa295('0x1'));var moment=require(_0xa295('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa295('0x3'));var db=require(_0xa295('0x4'))['db'];var utils=require(_0xa295('0x5'));var logger=require(_0xa295('0x6'))(_0xa295('0x7'));var config=require(_0xa295('0x8'));var jayson=require(_0xa295('0x9'));var client=jayson[_0xa295('0xa')][_0xa295('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20c408,_0xa6aea0,_0x38a852){return new BPromise(function(_0x34f154,_0x4eb0a7){return client['request'](_0x20c408,_0x38a852)['then'](function(_0x2389a4){logger['info'](_0xa295('0xc'),_0xa6aea0,_0xa295('0xd'));logger[_0xa295('0xe')](_0xa295('0xf'),_0xa6aea0,_0xa295('0xd'),JSON['stringify'](_0x2389a4));if(_0x2389a4[_0xa295('0x10')]){if(_0x2389a4[_0xa295('0x10')]['code']===0x1f4){logger[_0xa295('0x10')](_0xa295('0xc'),_0xa6aea0,_0x2389a4[_0xa295('0x10')][_0xa295('0x11')]);return _0x4eb0a7(_0x2389a4[_0xa295('0x10')][_0xa295('0x11')]);}logger[_0xa295('0x10')](_0xa295('0xc'),_0xa6aea0,_0x2389a4[_0xa295('0x10')][_0xa295('0x11')]);return _0x34f154(_0x2389a4[_0xa295('0x10')][_0xa295('0x11')]);}else{logger[_0xa295('0x12')](_0xa295('0xc'),_0xa6aea0,_0xa295('0xd'));_0x34f154(_0x2389a4[_0xa295('0x13')][_0xa295('0x11')]);}})[_0xa295('0x14')](function(_0x4945f5){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0xa6aea0,_0x4945f5);_0x4eb0a7(_0x4945f5);});});} \ No newline at end of file +var _0x1f72=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b9464,_0x59ba3e){var _0x52e1f8=function(_0x1126eb){while(--_0x1126eb){_0x3b9464['push'](_0x3b9464['shift']());}};_0x52e1f8(++_0x59ba3e);}(_0x1f72,0x70));var _0x21f7=function(_0x1cbb43,_0x1ec83f){_0x1cbb43=_0x1cbb43-0x0;var _0x3f4b85=_0x1f72[_0x1cbb43];return _0x3f4b85;};'use strict';var _=require(_0x21f7('0x0'));var util=require(_0x21f7('0x1'));var moment=require(_0x21f7('0x2'));var BPromise=require(_0x21f7('0x3'));var rs=require(_0x21f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21f7('0x5'))['db'];var utils=require(_0x21f7('0x6'));var logger=require(_0x21f7('0x7'))(_0x21f7('0x8'));var config=require(_0x21f7('0x9'));var jayson=require(_0x21f7('0xa'));var client=jayson['client'][_0x21f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x333587,_0x15ab4d,_0x5f3960){return new BPromise(function(_0x1c9cd6,_0x1309fe){return client[_0x21f7('0xc')](_0x333587,_0x5f3960)[_0x21f7('0xd')](function(_0x3dc19e){logger[_0x21f7('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x15ab4d,_0x21f7('0xf'));logger[_0x21f7('0x10')](_0x21f7('0x11'),_0x15ab4d,_0x21f7('0xf'),JSON[_0x21f7('0x12')](_0x3dc19e));if(_0x3dc19e[_0x21f7('0x13')]){if(_0x3dc19e[_0x21f7('0x13')][_0x21f7('0x14')]===0x1f4){logger[_0x21f7('0x13')](_0x21f7('0x15'),_0x15ab4d,_0x3dc19e[_0x21f7('0x13')][_0x21f7('0x16')]);return _0x1309fe(_0x3dc19e[_0x21f7('0x13')]['message']);}logger[_0x21f7('0x13')](_0x21f7('0x15'),_0x15ab4d,_0x3dc19e[_0x21f7('0x13')][_0x21f7('0x16')]);return _0x1c9cd6(_0x3dc19e[_0x21f7('0x13')][_0x21f7('0x16')]);}else{logger['info'](_0x21f7('0x15'),_0x15ab4d,'request\x20sent');_0x1c9cd6(_0x3dc19e['result']['message']);}})[_0x21f7('0x17')](function(_0xd52d8c){logger[_0x21f7('0x13')](_0x21f7('0x15'),_0x15ab4d,_0xd52d8c);_0x1309fe(_0xd52d8c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 20b4e39..b0c065b 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 _0x68b0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0x2b57af,_0x847964){var _0x37ad5a=function(_0x194766){while(--_0x194766){_0x2b57af['push'](_0x2b57af['shift']());}};_0x37ad5a(++_0x847964);}(_0x68b0,0x11d));var _0x068b=function(_0xe37270,_0x18e3c4){_0xe37270=_0xe37270-0x0;var _0x52795e=_0x68b0[_0xe37270];return _0x52795e;};'use strict';var multer=require(_0x068b('0x0'));var util=require(_0x068b('0x1'));var path=require(_0x068b('0x2'));var timeout=require(_0x068b('0x3'));var express=require(_0x068b('0x4'));var router=express[_0x068b('0x5')]();var fs_extra=require(_0x068b('0x6'));var auth=require(_0x068b('0x7'));var interaction=require(_0x068b('0x8'));var config=require(_0x068b('0x9'));var controller=require(_0x068b('0xa'));router[_0x068b('0xb')]('/',auth['isAuthenticated'](),controller[_0x068b('0xc')]);router['get'](_0x068b('0xd'),auth[_0x068b('0xe')](),controller[_0x068b('0xf')]);router[_0x068b('0x10')]('/',auth[_0x068b('0xe')](),controller[_0x068b('0x11')]);router[_0x068b('0x12')](_0x068b('0xd'),auth[_0x068b('0xe')](),controller['update']);router[_0x068b('0x13')](_0x068b('0xd'),auth['isAuthenticated'](),controller[_0x068b('0x14')]);module[_0x068b('0x15')]=router; \ No newline at end of file +var _0xab8d=['./intZohoField.controller','get','index','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x177e6d,_0x382766){var _0x162b9d=function(_0x402d9c){while(--_0x402d9c){_0x177e6d['push'](_0x177e6d['shift']());}};_0x162b9d(++_0x382766);}(_0xab8d,0xbe));var _0xdab8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xab8d[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0xdab8('0x0'));var util=require(_0xdab8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdab8('0x2'));var router=express[_0xdab8('0x3')]();var fs_extra=require(_0xdab8('0x4'));var auth=require(_0xdab8('0x5'));var interaction=require(_0xdab8('0x6'));var config=require(_0xdab8('0x7'));var controller=require(_0xdab8('0x8'));router[_0xdab8('0x9')]('/',auth['isAuthenticated'](),controller[_0xdab8('0xa')]);router['get'](_0xdab8('0xb'),auth[_0xdab8('0xc')](),controller[_0xdab8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdab8('0xe')](_0xdab8('0xb'),auth[_0xdab8('0xc')](),controller['update']);router[_0xdab8('0xf')](_0xdab8('0xb'),auth[_0xdab8('0xc')](),controller[_0xdab8('0x10')]);module[_0xdab8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d8ab930..424dbbe 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 _0x7b8e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b8e,0x1c8));var _0xe7b8=function(_0x53126b,_0xf8c92c){_0x53126b=_0x53126b-0x0;var _0xf79543=_0x7b8e[_0x53126b];return _0xf79543;};'use strict';var Sequelize=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'type':{'type':Sequelize[_0xe7b8('0x2')](_0xe7b8('0x3'),_0xe7b8('0x4'),_0xe7b8('0x5'),_0xe7b8('0x6'),_0xe7b8('0x7')),'defaultValue':_0xe7b8('0x3')},'content':{'type':Sequelize[_0xe7b8('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe7b8('0x2')](_0xe7b8('0x3'),_0xe7b8('0x4'),_0xe7b8('0x5'))},'keyContent':{'type':Sequelize[_0xe7b8('0x8')]},'idField':{'type':Sequelize[_0xe7b8('0x8')]},'nameField':{'type':Sequelize[_0xe7b8('0x8')]},'customField':{'type':Sequelize[_0xe7b8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe7b8('0x8')]}}; \ No newline at end of file +var _0xc604=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x433f44,_0xa365ce){var _0x73664=function(_0x14501b){while(--_0x14501b){_0x433f44['push'](_0x433f44['shift']());}};_0x73664(++_0xa365ce);}(_0xc604,0x18c));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c60('0x0'));module[_0x4c60('0x1')]={'type':{'type':Sequelize[_0x4c60('0x2')](_0x4c60('0x3'),_0x4c60('0x4'),'customVariable',_0x4c60('0x5'),'picklist'),'defaultValue':_0x4c60('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4c60('0x6')]},'keyType':{'type':Sequelize[_0x4c60('0x2')](_0x4c60('0x3'),_0x4c60('0x4'),_0x4c60('0x7'))},'keyContent':{'type':Sequelize[_0x4c60('0x6')]},'idField':{'type':Sequelize[_0x4c60('0x6')]},'nameField':{'type':Sequelize[_0x4c60('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c60('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4b39810..e61d893 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 _0x937d=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','index','ZohoField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x937d,0x1f4));var _0xd937=function(_0xcd3127,_0x304d36){_0xcd3127=_0xcd3127-0x0;var _0x3497cf=_0x937d[_0xcd3127];return _0x3497cf;};'use strict';var emlformat=require(_0xd937('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd937('0x1'));var moment=require(_0xd937('0x2'));var BPromise=require(_0xd937('0x3'));var Mustache=require(_0xd937('0x4'));var util=require(_0xd937('0x5'));var path=require(_0xd937('0x6'));var sox=require('sox');var csv=require(_0xd937('0x7'));var ejs=require(_0xd937('0x8'));var fs=require('fs');var fs_extra=require(_0xd937('0x9'));var _=require('lodash');var squel=require(_0xd937('0xa'));var crypto=require(_0xd937('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd937('0xc'));var toCsv=require(_0xd937('0x7'));var querystring=require(_0xd937('0xd'));var Papa=require(_0xd937('0xe'));var Redis=require(_0xd937('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd937('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd937('0x11'));var logger=require('../../config/logger')(_0xd937('0x12'));var utils=require(_0xd937('0x13'));var config=require(_0xd937('0x14'));var licenseUtil=require(_0xd937('0x15'));var db=require(_0xd937('0x16'))['db'];function respondWithStatusCode(_0x518621,_0xb3a15a){_0xb3a15a=_0xb3a15a||0xcc;return function(_0xa12849){if(_0xa12849){return _0x518621[_0xd937('0x17')](_0xb3a15a);}return _0x518621[_0xd937('0x18')](_0xb3a15a)[_0xd937('0x19')]();};}function respondWithResult(_0x5361d,_0x3e9e5b){_0x3e9e5b=_0x3e9e5b||0xc8;return function(_0x174ddf){if(_0x174ddf){return _0x5361d[_0xd937('0x18')](_0x3e9e5b)[_0xd937('0x1a')](_0x174ddf);}};}function respondWithFilteredResult(_0x5e9642,_0x2f5ef4){return function(_0x10910c){if(_0x10910c){var _0x295a82=typeof _0x2f5ef4['offset']===_0xd937('0x1b')&&typeof _0x2f5ef4[_0xd937('0x1c')]===_0xd937('0x1b');var _0x4e72fe=_0x10910c[_0xd937('0x1d')];var _0x3d6b1c=_0x295a82?0x0:_0x2f5ef4[_0xd937('0x1e')];var _0x1bd7ee=_0x295a82?_0x10910c[_0xd937('0x1d')]:_0x2f5ef4[_0xd937('0x1e')]+_0x2f5ef4[_0xd937('0x1c')];var _0x311f08;if(_0x1bd7ee>=_0x4e72fe){_0x1bd7ee=_0x4e72fe;_0x311f08=0xc8;}else{_0x311f08=0xce;}_0x5e9642[_0xd937('0x18')](_0x311f08);return _0x5e9642[_0xd937('0x1f')](_0xd937('0x20'),_0x3d6b1c+'-'+_0x1bd7ee+'/'+_0x4e72fe)[_0xd937('0x1a')](_0x10910c);}return null;};}function patchUpdates(_0x2c18ea){return function(_0x166cb9){try{jsonpatch[_0xd937('0x21')](_0x166cb9,_0x2c18ea,!![]);}catch(_0x2699e8){return BPromise[_0xd937('0x22')](_0x2699e8);}return _0x166cb9['save']();};}function saveUpdates(_0x7362d9,_0x168f3e){return function(_0x86c492){if(_0x86c492){return _0x86c492[_0xd937('0x23')](_0x7362d9)[_0xd937('0x24')](function(_0x31ff83){return _0x31ff83;});}return null;};}function removeEntity(_0x475080,_0x325e68){return function(_0x194fe5){if(_0x194fe5){return _0x194fe5[_0xd937('0x25')]()[_0xd937('0x24')](function(){_0x475080['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x541ded,_0x22ed55){return function(_0x1d5a26){if(!_0x1d5a26){_0x541ded['sendStatus'](0x194);}return _0x1d5a26;};}function handleError(_0x143f65,_0x2a741b){_0x2a741b=_0x2a741b||0x1f4;return function(_0x15919f){logger['error'](_0x15919f['stack']);if(_0x15919f[_0xd937('0x26')]){delete _0x15919f[_0xd937('0x26')];}_0x143f65[_0xd937('0x18')](_0x2a741b)[_0xd937('0x27')](_0x15919f);};}exports[_0xd937('0x28')]=function(_0x46c855,_0x291fb7){var _0x2d29c0={},_0x40b26b={},_0x33b7d9={'count':0x0,'rows':[]};var _0x11aa02=_['map'](db[_0xd937('0x29')][_0xd937('0x2a')],function(_0xaba6e0){return{'name':_0xaba6e0[_0xd937('0x2b')],'type':_0xaba6e0['type'][_0xd937('0x2c')]};});_0x40b26b[_0xd937('0x2d')]=_[_0xd937('0x2e')](_0x11aa02,_0xd937('0x26'));_0x40b26b[_0xd937('0x2f')]=_[_0xd937('0x30')](_0x46c855[_0xd937('0x2f')]);_0x40b26b[_0xd937('0x31')]=_[_0xd937('0x32')](_0x40b26b[_0xd937('0x2d')],_0x40b26b[_0xd937('0x2f')]);_0x2d29c0[_0xd937('0x33')]=_[_0xd937('0x32')](_0x40b26b[_0xd937('0x2d')],qs['fields'](_0x46c855['query'][_0xd937('0x34')]));_0x2d29c0[_0xd937('0x33')]=_0x2d29c0[_0xd937('0x33')][_0xd937('0x35')]?_0x2d29c0[_0xd937('0x33')]:_0x40b26b[_0xd937('0x2d')];if(!_0x46c855[_0xd937('0x2f')][_0xd937('0x36')](_0xd937('0x37'))){_0x2d29c0[_0xd937('0x1c')]=qs[_0xd937('0x1c')](_0x46c855['query']['limit']);_0x2d29c0['offset']=qs[_0xd937('0x1e')](_0x46c855['query'][_0xd937('0x1e')]);}_0x2d29c0['order']=qs[_0xd937('0x38')](_0x46c855[_0xd937('0x2f')][_0xd937('0x38')]);_0x2d29c0[_0xd937('0x39')]=qs[_0xd937('0x31')](_[_0xd937('0x3a')](_0x46c855[_0xd937('0x2f')],_0x40b26b[_0xd937('0x31')]),_0x11aa02);if(_0x46c855[_0xd937('0x2f')][_0xd937('0x3b')]){_0x2d29c0[_0xd937('0x39')]=_[_0xd937('0x3c')](_0x2d29c0[_0xd937('0x39')],{'$or':_[_0xd937('0x2e')](_0x11aa02,function(_0x203c51){if(_0x203c51[_0xd937('0x3d')]!==_0xd937('0x3e')){var _0x52435f={};_0x52435f[_0x203c51[_0xd937('0x26')]]={'$like':'%'+_0x46c855[_0xd937('0x2f')][_0xd937('0x3b')]+'%'};return _0x52435f;}})});}_0x2d29c0=_[_0xd937('0x3c')]({},_0x2d29c0,_0x46c855[_0xd937('0x3f')]);var _0x20b7c2={'where':_0x2d29c0['where']};return db[_0xd937('0x29')]['count'](_0x20b7c2)[_0xd937('0x24')](function(_0x6ad956){_0x33b7d9[_0xd937('0x1d')]=_0x6ad956;if(_0x46c855[_0xd937('0x2f')]['includeAll']){_0x2d29c0[_0xd937('0x40')]=[{'all':!![]}];}return db[_0xd937('0x29')]['findAll'](_0x2d29c0);})[_0xd937('0x24')](function(_0x3a1eb3){_0x33b7d9[_0xd937('0x41')]=_0x3a1eb3;return _0x33b7d9;})[_0xd937('0x24')](respondWithFilteredResult(_0x291fb7,_0x2d29c0))[_0xd937('0x42')](handleError(_0x291fb7,null));};exports[_0xd937('0x43')]=function(_0x4b8263,_0x58b070){var _0x3d84ce={'raw':!![],'where':{'id':_0x4b8263['params']['id']}},_0x26b615={};_0x26b615['model']=_[_0xd937('0x30')](db['ZohoField'][_0xd937('0x2a')]);_0x26b615[_0xd937('0x2f')]=_[_0xd937('0x30')](_0x4b8263[_0xd937('0x2f')]);_0x26b615[_0xd937('0x31')]=_[_0xd937('0x32')](_0x26b615[_0xd937('0x2d')],_0x26b615[_0xd937('0x2f')]);_0x3d84ce[_0xd937('0x33')]=_[_0xd937('0x32')](_0x26b615['model'],qs[_0xd937('0x34')](_0x4b8263[_0xd937('0x2f')][_0xd937('0x34')]));_0x3d84ce[_0xd937('0x33')]=_0x3d84ce[_0xd937('0x33')]['length']?_0x3d84ce['attributes']:_0x26b615['model'];if(_0x4b8263[_0xd937('0x2f')][_0xd937('0x44')]){_0x3d84ce[_0xd937('0x40')]=[{'all':!![]}];}_0x3d84ce=_[_0xd937('0x3c')]({},_0x3d84ce,_0x4b8263[_0xd937('0x3f')]);return db[_0xd937('0x29')][_0xd937('0x45')](_0x3d84ce)[_0xd937('0x24')](handleEntityNotFound(_0x58b070,null))[_0xd937('0x24')](respondWithResult(_0x58b070,null))['catch'](handleError(_0x58b070,null));};exports['create']=function(_0x3c184f,_0x5cbff6){return db[_0xd937('0x29')][_0xd937('0x46')](_0x3c184f[_0xd937('0x47')],{})[_0xd937('0x24')](respondWithResult(_0x5cbff6,0xc9))[_0xd937('0x42')](handleError(_0x5cbff6,null));};exports[_0xd937('0x23')]=function(_0x27c5eb,_0x463da0){if(_0x27c5eb[_0xd937('0x47')]['id']){delete _0x27c5eb[_0xd937('0x47')]['id'];}return db[_0xd937('0x29')]['find']({'where':{'id':_0x27c5eb[_0xd937('0x48')]['id']}})['then'](handleEntityNotFound(_0x463da0,null))[_0xd937('0x24')](saveUpdates(_0x27c5eb[_0xd937('0x47')],null))[_0xd937('0x24')](respondWithResult(_0x463da0,null))[_0xd937('0x42')](handleError(_0x463da0,null));};exports['destroy']=function(_0x3d2821,_0x45621e){return db[_0xd937('0x29')][_0xd937('0x45')]({'where':{'id':_0x3d2821[_0xd937('0x48')]['id']}})[_0xd937('0x24')](handleEntityNotFound(_0x45621e,null))[_0xd937('0x24')](removeEntity(_0x45621e,null))[_0xd937('0x42')](handleError(_0x45621e,null));}; \ No newline at end of file +var _0xd15f=['ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','ZohoField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x25a754,_0x4aeed9){var _0x281b6b=function(_0x51a39e){while(--_0x51a39e){_0x25a754['push'](_0x25a754['shift']());}};_0x281b6b(++_0x4aeed9);}(_0xd15f,0x1a1));var _0xfd15=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xd15f[_0x388b47];return _0x4859df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd15('0x1'));var rp=require(_0xfd15('0x2'));var moment=require(_0xfd15('0x3'));var BPromise=require(_0xfd15('0x4'));var Mustache=require(_0xfd15('0x5'));var util=require(_0xfd15('0x6'));var path=require(_0xfd15('0x7'));var sox=require(_0xfd15('0x8'));var csv=require('to-csv');var ejs=require(_0xfd15('0x9'));var fs=require('fs');var fs_extra=require(_0xfd15('0xa'));var _=require('lodash');var squel=require(_0xfd15('0xb'));var crypto=require(_0xfd15('0xc'));var jsforce=require(_0xfd15('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd15('0xe'));var Papa=require('papaparse');var Redis=require(_0xfd15('0xf'));var authService=require(_0xfd15('0x10'));var qs=require(_0xfd15('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd15('0x12'))(_0xfd15('0x13'));var utils=require(_0xfd15('0x14'));var config=require(_0xfd15('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd15('0x16'))['db'];function respondWithStatusCode(_0x43ec56,_0x4aa46d){_0x4aa46d=_0x4aa46d||0xcc;return function(_0x108213){if(_0x108213){return _0x43ec56['sendStatus'](_0x4aa46d);}return _0x43ec56[_0xfd15('0x17')](_0x4aa46d)[_0xfd15('0x18')]();};}function respondWithResult(_0x451961,_0x55c70b){_0x55c70b=_0x55c70b||0xc8;return function(_0x5e7eb4){if(_0x5e7eb4){return _0x451961[_0xfd15('0x17')](_0x55c70b)[_0xfd15('0x19')](_0x5e7eb4);}};}function respondWithFilteredResult(_0x562298,_0x1709b3){return function(_0x347e4){if(_0x347e4){var _0xb3ab43=typeof _0x1709b3[_0xfd15('0x1a')]==='undefined'&&typeof _0x1709b3['limit']===_0xfd15('0x1b');var _0x3e2a37=_0x347e4['count'];var _0x265389=_0xb3ab43?0x0:_0x1709b3[_0xfd15('0x1a')];var _0x9fcfe2=_0xb3ab43?_0x347e4[_0xfd15('0x1c')]:_0x1709b3[_0xfd15('0x1a')]+_0x1709b3[_0xfd15('0x1d')];var _0x3f88b8;if(_0x9fcfe2>=_0x3e2a37){_0x9fcfe2=_0x3e2a37;_0x3f88b8=0xc8;}else{_0x3f88b8=0xce;}_0x562298[_0xfd15('0x17')](_0x3f88b8);return _0x562298[_0xfd15('0x1e')]('Content-Range',_0x265389+'-'+_0x9fcfe2+'/'+_0x3e2a37)[_0xfd15('0x19')](_0x347e4);}return null;};}function patchUpdates(_0x5cf17a){return function(_0x3d2e15){try{jsonpatch[_0xfd15('0x1f')](_0x3d2e15,_0x5cf17a,!![]);}catch(_0x436b12){return BPromise[_0xfd15('0x20')](_0x436b12);}return _0x3d2e15['save']();};}function saveUpdates(_0x30a671,_0x2880f3){return function(_0x15ca0e){if(_0x15ca0e){return _0x15ca0e[_0xfd15('0x21')](_0x30a671)[_0xfd15('0x22')](function(_0x32cead){return _0x32cead;});}return null;};}function removeEntity(_0x28b32b,_0x31d5e5){return function(_0x38f6a5){if(_0x38f6a5){return _0x38f6a5[_0xfd15('0x23')]()[_0xfd15('0x22')](function(){_0x28b32b[_0xfd15('0x17')](0xcc)[_0xfd15('0x18')]();});}};}function handleEntityNotFound(_0x55b06a,_0x5f1ca1){return function(_0x1669a6){if(!_0x1669a6){_0x55b06a[_0xfd15('0x24')](0x194);}return _0x1669a6;};}function handleError(_0x408319,_0x3313ad){_0x3313ad=_0x3313ad||0x1f4;return function(_0x5d2870){logger[_0xfd15('0x25')](_0x5d2870['stack']);if(_0x5d2870[_0xfd15('0x26')]){delete _0x5d2870[_0xfd15('0x26')];}_0x408319[_0xfd15('0x17')](_0x3313ad)[_0xfd15('0x27')](_0x5d2870);};}exports[_0xfd15('0x28')]=function(_0x45e872,_0x2ed2a9){var _0x280b51={},_0x5eb3b8={},_0x59e386={'count':0x0,'rows':[]};var _0x17f2b4=_[_0xfd15('0x29')](db[_0xfd15('0x2a')]['rawAttributes'],function(_0x42def7){return{'name':_0x42def7[_0xfd15('0x2b')],'type':_0x42def7[_0xfd15('0x2c')][_0xfd15('0x2d')]};});_0x5eb3b8[_0xfd15('0x2e')]=_['map'](_0x17f2b4,'name');_0x5eb3b8['query']=_[_0xfd15('0x2f')](_0x45e872[_0xfd15('0x30')]);_0x5eb3b8[_0xfd15('0x31')]=_[_0xfd15('0x32')](_0x5eb3b8[_0xfd15('0x2e')],_0x5eb3b8[_0xfd15('0x30')]);_0x280b51[_0xfd15('0x33')]=_[_0xfd15('0x32')](_0x5eb3b8[_0xfd15('0x2e')],qs[_0xfd15('0x34')](_0x45e872['query']['fields']));_0x280b51[_0xfd15('0x33')]=_0x280b51[_0xfd15('0x33')][_0xfd15('0x35')]?_0x280b51['attributes']:_0x5eb3b8[_0xfd15('0x2e')];if(!_0x45e872[_0xfd15('0x30')][_0xfd15('0x36')]('nolimit')){_0x280b51[_0xfd15('0x1d')]=qs[_0xfd15('0x1d')](_0x45e872[_0xfd15('0x30')][_0xfd15('0x1d')]);_0x280b51[_0xfd15('0x1a')]=qs['offset'](_0x45e872[_0xfd15('0x30')]['offset']);}_0x280b51['order']=qs['sort'](_0x45e872[_0xfd15('0x30')][_0xfd15('0x37')]);_0x280b51[_0xfd15('0x38')]=qs[_0xfd15('0x31')](_[_0xfd15('0x39')](_0x45e872[_0xfd15('0x30')],_0x5eb3b8[_0xfd15('0x31')]),_0x17f2b4);if(_0x45e872['query'][_0xfd15('0x3a')]){_0x280b51[_0xfd15('0x38')]=_[_0xfd15('0x3b')](_0x280b51[_0xfd15('0x38')],{'$or':_[_0xfd15('0x29')](_0x17f2b4,function(_0x20b9e4){if(_0x20b9e4['type']!==_0xfd15('0x3c')){var _0x58cef2={};_0x58cef2[_0x20b9e4[_0xfd15('0x26')]]={'$like':'%'+_0x45e872['query'][_0xfd15('0x3a')]+'%'};return _0x58cef2;}})});}_0x280b51=_[_0xfd15('0x3b')]({},_0x280b51,_0x45e872['options']);var _0x43767b={'where':_0x280b51['where']};return db[_0xfd15('0x2a')][_0xfd15('0x1c')](_0x43767b)['then'](function(_0x1fca66){_0x59e386[_0xfd15('0x1c')]=_0x1fca66;if(_0x45e872[_0xfd15('0x30')][_0xfd15('0x3d')]){_0x280b51[_0xfd15('0x3e')]=[{'all':!![]}];}return db[_0xfd15('0x2a')][_0xfd15('0x3f')](_0x280b51);})[_0xfd15('0x22')](function(_0x40dfc8){_0x59e386['rows']=_0x40dfc8;return _0x59e386;})[_0xfd15('0x22')](respondWithFilteredResult(_0x2ed2a9,_0x280b51))[_0xfd15('0x40')](handleError(_0x2ed2a9,null));};exports[_0xfd15('0x41')]=function(_0x5bfe5f,_0x528e47){var _0x3368ff={'raw':!![],'where':{'id':_0x5bfe5f[_0xfd15('0x42')]['id']}},_0x5c8779={};_0x5c8779[_0xfd15('0x2e')]=_[_0xfd15('0x2f')](db[_0xfd15('0x2a')]['rawAttributes']);_0x5c8779[_0xfd15('0x30')]=_[_0xfd15('0x2f')](_0x5bfe5f['query']);_0x5c8779['filters']=_[_0xfd15('0x32')](_0x5c8779[_0xfd15('0x2e')],_0x5c8779[_0xfd15('0x30')]);_0x3368ff[_0xfd15('0x33')]=_['intersection'](_0x5c8779[_0xfd15('0x2e')],qs[_0xfd15('0x34')](_0x5bfe5f[_0xfd15('0x30')][_0xfd15('0x34')]));_0x3368ff[_0xfd15('0x33')]=_0x3368ff[_0xfd15('0x33')][_0xfd15('0x35')]?_0x3368ff[_0xfd15('0x33')]:_0x5c8779[_0xfd15('0x2e')];if(_0x5bfe5f[_0xfd15('0x30')][_0xfd15('0x3d')]){_0x3368ff['include']=[{'all':!![]}];}_0x3368ff=_[_0xfd15('0x3b')]({},_0x3368ff,_0x5bfe5f[_0xfd15('0x43')]);return db[_0xfd15('0x2a')][_0xfd15('0x44')](_0x3368ff)[_0xfd15('0x22')](handleEntityNotFound(_0x528e47,null))[_0xfd15('0x22')](respondWithResult(_0x528e47,null))[_0xfd15('0x40')](handleError(_0x528e47,null));};exports[_0xfd15('0x45')]=function(_0xab5a50,_0x22a6ed){return db[_0xfd15('0x2a')][_0xfd15('0x45')](_0xab5a50[_0xfd15('0x46')],{})['then'](respondWithResult(_0x22a6ed,0xc9))['catch'](handleError(_0x22a6ed,null));};exports[_0xfd15('0x21')]=function(_0x96a2e2,_0xc1d5b){if(_0x96a2e2[_0xfd15('0x46')]['id']){delete _0x96a2e2[_0xfd15('0x46')]['id'];}return db['ZohoField'][_0xfd15('0x44')]({'where':{'id':_0x96a2e2[_0xfd15('0x42')]['id']}})['then'](handleEntityNotFound(_0xc1d5b,null))[_0xfd15('0x22')](saveUpdates(_0x96a2e2['body'],null))[_0xfd15('0x22')](respondWithResult(_0xc1d5b,null))[_0xfd15('0x40')](handleError(_0xc1d5b,null));};exports[_0xfd15('0x23')]=function(_0x4f6fc1,_0xe4732c){return db[_0xfd15('0x2a')]['find']({'where':{'id':_0x4f6fc1[_0xfd15('0x42')]['id']}})[_0xfd15('0x22')](handleEntityNotFound(_0xe4732c,null))[_0xfd15('0x22')](removeEntity(_0xe4732c,null))['catch'](handleError(_0xe4732c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b9dd1a0..b1d4dac 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 _0xc6ac=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x2b839d,_0x546ee5){var _0x4d9d64=function(_0x2ef8cb){while(--_0x2ef8cb){_0x2b839d['push'](_0x2b839d['shift']());}};_0x4d9d64(++_0x546ee5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x45a719,_0x5d4c04){_0x45a719=_0x45a719-0x0;var _0x1e2f58=_0xc6ac[_0x45a719];return _0x1e2f58;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['idField',_0xcc6a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77e6=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','zoho_unique_index'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x77e6,0x1a6));var _0x677e=function(_0xdebefb,_0x22fc67){_0xdebefb=_0xdebefb-0x0;var _0x34ec43=_0x77e6[_0xdebefb];return _0x34ec43;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x677e('0xb'),'fields':[_0x677e('0xc'),_0x677e('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 5433299..5a44849 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 _0x905e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x905e,0x7f));var _0xe905=function(_0x55cb87,_0x6b8feb){_0x55cb87=_0x55cb87-0x0;var _0x3a345c=_0x905e[_0x55cb87];return _0x3a345c;};'use strict';var _=require(_0xe905('0x0'));var util=require(_0xe905('0x1'));var moment=require(_0xe905('0x2'));var BPromise=require(_0xe905('0x3'));var rs=require(_0xe905('0x4'));var fs=require('fs');var Redis=require(_0xe905('0x5'));var db=require(_0xe905('0x6'))['db'];var utils=require(_0xe905('0x7'));var logger=require(_0xe905('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe905('0x9'));var client=jayson[_0xe905('0xa')][_0xe905('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b9776,_0x470db0,_0x2d535e){return new BPromise(function(_0x20c593,_0x318e36){return client[_0xe905('0xc')](_0x1b9776,_0x2d535e)[_0xe905('0xd')](function(_0x199f62){logger[_0xe905('0xe')](_0xe905('0xf'),_0x470db0,_0xe905('0x10'));logger[_0xe905('0x11')](_0xe905('0x12'),_0x470db0,_0xe905('0x10'),JSON[_0xe905('0x13')](_0x199f62));if(_0x199f62['error']){if(_0x199f62['error'][_0xe905('0x14')]===0x1f4){logger[_0xe905('0x15')](_0xe905('0xf'),_0x470db0,_0x199f62[_0xe905('0x15')][_0xe905('0x16')]);return _0x318e36(_0x199f62[_0xe905('0x15')]['message']);}logger[_0xe905('0x15')](_0xe905('0xf'),_0x470db0,_0x199f62[_0xe905('0x15')][_0xe905('0x16')]);return _0x20c593(_0x199f62[_0xe905('0x15')][_0xe905('0x16')]);}else{logger['info'](_0xe905('0xf'),_0x470db0,_0xe905('0x10'));_0x20c593(_0x199f62[_0xe905('0x17')][_0xe905('0x16')]);}})[_0xe905('0x18')](function(_0x31daf6){logger['error']('ZohoField,\x20%s,\x20%s',_0x470db0,_0x31daf6);_0x318e36(_0x31daf6);});});} \ No newline at end of file +var _0x4507=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x4507,0x177));var _0x7450=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4507[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x7450('0x0'));var util=require(_0x7450('0x1'));var moment=require(_0x7450('0x2'));var BPromise=require(_0x7450('0x3'));var rs=require(_0x7450('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7450('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7450('0x6'))(_0x7450('0x7'));var config=require(_0x7450('0x8'));var jayson=require(_0x7450('0x9'));var client=jayson[_0x7450('0xa')][_0x7450('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x485d71,_0x2b505b,_0x4b96d1){return new BPromise(function(_0x2460a5,_0x453c0c){return client['request'](_0x485d71,_0x4b96d1)[_0x7450('0xc')](function(_0x379d24){logger[_0x7450('0xd')](_0x7450('0xe'),_0x2b505b,_0x7450('0xf'));logger[_0x7450('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2b505b,_0x7450('0xf'),JSON[_0x7450('0x11')](_0x379d24));if(_0x379d24[_0x7450('0x12')]){if(_0x379d24[_0x7450('0x12')]['code']===0x1f4){logger[_0x7450('0x12')](_0x7450('0xe'),_0x2b505b,_0x379d24['error'][_0x7450('0x13')]);return _0x453c0c(_0x379d24[_0x7450('0x12')][_0x7450('0x13')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x2b505b,_0x379d24[_0x7450('0x12')][_0x7450('0x13')]);return _0x2460a5(_0x379d24[_0x7450('0x12')][_0x7450('0x13')]);}else{logger[_0x7450('0xd')]('ZohoField,\x20%s,\x20%s',_0x2b505b,_0x7450('0xf'));_0x2460a5(_0x379d24[_0x7450('0x14')]['message']);}})[_0x7450('0x15')](function(_0x5a596f){logger[_0x7450('0x12')](_0x7450('0xe'),_0x2b505b,_0x5a596f);_0x453c0c(_0x5a596f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 14b615d..6b965d2 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b502b,_0x2fb781){var _0x186218=function(_0x4fcac4){while(--_0x4fcac4){_0x3b502b['push'](_0x3b502b['shift']());}};_0x186218(++_0x2fb781);}(_0xe706,0xa3));var _0x6e70=function(_0x561098,_0xdd1933){_0x561098=_0x561098-0x0;var _0x42701a=_0xe706[_0x561098];return _0x42701a;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x10ceef,_0x290db3){var _0x1eb48d=function(_0x361522){while(--_0x361522){_0x10ceef['push'](_0x10ceef['shift']());}};_0x1eb48d(++_0x290db3);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c613f16..9b18789 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64b=['unique_name_and_version','app.js','state','sequelize','STRING'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd64b,0xc1));var _0xbd64=function(_0x5ce4e3,_0x42cb9a){_0x5ce4e3=_0x5ce4e3-0x0;var _0x42248f=_0xd64b[_0x5ce4e3];return _0x42248f;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![],'unique':_0xbd64('0x2')},'main':{'type':Sequelize[_0xbd64('0x1')],'defaultValue':_0xbd64('0x3')},'filename':{'type':Sequelize[_0xbd64('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbd64('0x1')]},'logo':{'type':Sequelize[_0xbd64('0x1')]},'state':{'type':Sequelize[_0xbd64('0x1')],'unique':_0xbd64('0x4')},'description':{'type':Sequelize[_0xbd64('0x1')]},'title':{'type':Sequelize[_0xbd64('0x1')]},'remoteUri':{'type':Sequelize[_0xbd64('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x0bd5=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x0bd5,0x1d5));var _0x50bd=function(_0x5d29bc,_0x34f8b8){_0x5d29bc=_0x5d29bc-0x0;var _0x5b16d8=_0x0bd5[_0x5d29bc];return _0x5b16d8;};'use strict';var Sequelize=require(_0x50bd('0x0'));module[_0x50bd('0x1')]={'name':{'type':Sequelize[_0x50bd('0x2')],'allowNull':![],'unique':_0x50bd('0x3')},'version':{'type':Sequelize[_0x50bd('0x2')],'allowNull':![],'unique':_0x50bd('0x3')},'main':{'type':Sequelize[_0x50bd('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x50bd('0x2')]},'path':{'type':Sequelize[_0x50bd('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x50bd('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x50bd('0x2')]},'state':{'type':Sequelize[_0x50bd('0x2')],'unique':_0x50bd('0x5')},'description':{'type':Sequelize[_0x50bd('0x2')]},'title':{'type':Sequelize[_0x50bd('0x2')]},'remoteUri':{'type':Sequelize[_0x50bd('0x2')]},'link':{'type':Sequelize[_0x50bd('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ed754e1..f9ba705 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 _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x226091,_0x5eefbf){var _0x535f6e=function(_0x3d0a5c){while(--_0x3d0a5c){_0x226091['push'](_0x226091['shift']());}};_0x535f6e(++_0x5eefbf);}(_0x7096,0x10c));var _0x6709=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7096[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file +var _0x9f0e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x140f21,_0x2a1ccd){var _0x51c012=function(_0xe7b930){while(--_0xe7b930){_0x140f21['push'](_0x140f21['shift']());}};_0x51c012(++_0x2a1ccd);}(_0x9f0e,0x116));var _0xe9f0=function(_0x15b743,_0x528cc0){_0x15b743=_0x15b743-0x0;var _0x574054=_0x9f0e[_0x15b743];return _0x574054;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['Integration'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['Integration'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['Integration'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 516c538..3a39c8c 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 _0x2f2b=['moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','api'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x2f2b,0xf9));var _0xb2f2=function(_0xc4503e,_0x2136d6){_0xc4503e=_0xc4503e-0x0;var _0x5482ac=_0x2f2b[_0xc4503e];return _0x5482ac;};'use strict';var _=require(_0xb2f2('0x0'));var util=require(_0xb2f2('0x1'));var logger=require('../../config/logger')(_0xb2f2('0x2'));var moment=require(_0xb2f2('0x3'));var BPromise=require(_0xb2f2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2f2('0x5'));var rimraf=require(_0xb2f2('0x6'));var config=require(_0xb2f2('0x7'));var attributes=require(_0xb2f2('0x8'));module['exports']=function(_0x341d8b,_0x21d707){return _0x341d8b[_0xb2f2('0x9')](_0xb2f2('0xa'),attributes,{'tableName':_0xb2f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c4e=['Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x9b2b94,_0x10528d){var _0x12a89b=function(_0x12ce89){while(--_0x12ce89){_0x9b2b94['push'](_0x9b2b94['shift']());}};_0x12a89b(++_0x10528d);}(_0x1c4e,0x1a4));var _0xe1c4=function(_0xb199dc,_0xdffcbe){_0xb199dc=_0xb199dc-0x0;var _0x2dfb55=_0x1c4e[_0xb199dc];return _0x2dfb55;};'use strict';var _=require(_0xe1c4('0x0'));var util=require(_0xe1c4('0x1'));var logger=require(_0xe1c4('0x2'))(_0xe1c4('0x3'));var moment=require(_0xe1c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xe1c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1c4('0x6'));var config=require(_0xe1c4('0x7'));var attributes=require('./integration.attributes');module['exports']=function(_0x5b62fa,_0x2ce7a8){return _0x5b62fa[_0xe1c4('0x8')](_0xe1c4('0x9'),attributes,{'tableName':_0xe1c4('0xa'),'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 e0feb16..2f1efc5 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d8b04,_0x1c9689){var _0x23924a=function(_0x4500dc){while(--_0x4500dc){_0x5d8b04['push'](_0x5d8b04['shift']());}};_0x23924a(++_0x1c9689);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x438265,_0x4809f9){_0x438265=_0x438265-0x0;var _0x457771=_0xc6ac[_0x438265];return _0x457771;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4975,0x86));var _0x5497=function(_0x15a261,_0x24fe37){_0x15a261=_0x15a261-0x0;var _0x584e7f=_0x4975[_0x15a261];return _0x584e7f;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index acc26d4..d9ff52c 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x17f493,_0x5e4869){var _0x389dff=function(_0x243783){while(--_0x243783){_0x17f493['push'](_0x17f493['shift']());}};_0x389dff(++_0x5e4869);}(_0x955f,0x1eb));var _0xf955=function(_0x1aecb0,_0x3d1c59){_0x1aecb0=_0x1aecb0-0x0;var _0x1cce5e=_0x955f[_0x1aecb0];return _0x1cce5e;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x5b2c50,_0x4db66b){var _0x47f2f9=function(_0xef76e4){while(--_0xef76e4){_0x5b2c50['push'](_0x5b2c50['shift']());}};_0x47f2f9(++_0x4db66b);}(_0x9f0e,0x116));var _0xe9f0=function(_0xcd80f2,_0x1cfe36){_0xcd80f2=_0xcd80f2-0x0;var _0x2f3a0f=_0x9f0e[_0xcd80f2];return _0x2f3a0f;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e4e5dd3..0d4c8f4 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 _0xac9d=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x45cc01,_0x2e635a){var _0x349d47=function(_0x78edc){while(--_0x78edc){_0x45cc01['push'](_0x45cc01['shift']());}};_0x349d47(++_0x2e635a);}(_0xac9d,0x191));var _0xdac9=function(_0x4afe41,_0x22bd75){_0x4afe41=_0x4afe41-0x0;var _0x552f0f=_0xac9d[_0x4afe41];return _0x552f0f;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'integration':{'type':Sequelize[_0xdac9('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xdac9('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdac9('0x2')]},'calleridnum':{'type':Sequelize[_0xdac9('0x2')]},'calleridname':{'type':Sequelize[_0xdac9('0x2')]},'queue':{'type':Sequelize[_0xdac9('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdac9('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xdac9('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdac9('0x3')]},'talktime':{'type':Sequelize[_0xdac9('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdac9('0x4')]},'reason':{'type':Sequelize[_0xdac9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xdac9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xdac9('0x3')]},'agentdump':{'type':Sequelize[_0xdac9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xdac9('0x2')]},'channel':{'type':Sequelize[_0xdac9('0x2')]},'channelstate':{'type':Sequelize[_0xdac9('0x4')]},'channelstatedesc':{'type':Sequelize[_0xdac9('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdac9('0x2')]},'connectedlinename':{'type':Sequelize[_0xdac9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xdac9('0x2')]},'exten':{'type':Sequelize[_0xdac9('0x2')]},'priority':{'type':Sequelize[_0xdac9('0x2')]},'destchannel':{'type':Sequelize[_0xdac9('0x2')]},'destchannelstate':{'type':Sequelize[_0xdac9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xdac9('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdac9('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xdac9('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xdac9('0x2')]},'destcontext':{'type':Sequelize[_0xdac9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xdac9('0x2')]},'destuniqueid':{'type':Sequelize[_0xdac9('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xdac9('0x2')]},'subject':{'type':Sequelize[_0xdac9('0x2')]},'from':{'type':Sequelize[_0xdac9('0x2')]},'to':{'type':Sequelize[_0xdac9('0x2')]},'cc':{'type':Sequelize[_0xdac9('0x2')]},'attachment':{'type':Sequelize[_0xdac9('0x6')]},'html':{'type':Sequelize[_0xdac9('0x6')]},'text':{'type':Sequelize[_0xdac9('0x6')]},'status':{'type':Sequelize[_0xdac9('0x7')](_0xdac9('0x8'),'SENDING',_0xdac9('0x9'),_0xdac9('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc9f9=['SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x563b0f,_0x1057cf){var _0x36aada=function(_0x4347f3){while(--_0x4347f3){_0x563b0f['push'](_0x563b0f['shift']());}};_0x36aada(++_0x1057cf);}(_0xc9f9,0x189));var _0x9c9f=function(_0x2725c2,_0x2d6b4e){_0x2725c2=_0x2725c2-0x0;var _0x1f2343=_0xc9f9[_0x2725c2];return _0x1f2343;};'use strict';var Sequelize=require(_0x9c9f('0x0'));module['exports']={'integration':{'type':Sequelize[_0x9c9f('0x1')]},'eventChannel':{'type':Sequelize[_0x9c9f('0x1')]},'exitStatus':{'type':Sequelize[_0x9c9f('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x9c9f('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9c9f('0x1')]},'calleridname':{'type':Sequelize[_0x9c9f('0x1')]},'queue':{'type':Sequelize[_0x9c9f('0x1')]},'interface':{'type':Sequelize[_0x9c9f('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x9c9f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x9c9f('0x2')]},'agentcomplete':{'type':Sequelize[_0x9c9f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x9c9f('0x2')]},'agentacw':{'type':Sequelize[_0x9c9f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9c9f('0x2')]},'reason':{'type':Sequelize[_0x9c9f('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x9c9f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9c9f('0x3')]},'agentdump':{'type':Sequelize[_0x9c9f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9c9f('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9c9f('0x1')]},'channelstate':{'type':Sequelize[_0x9c9f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9c9f('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9c9f('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9c9f('0x1')]},'context':{'type':Sequelize[_0x9c9f('0x1')]},'exten':{'type':Sequelize[_0x9c9f('0x1')]},'priority':{'type':Sequelize[_0x9c9f('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9c9f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9c9f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9c9f('0x1')]},'destcalleridname':{'type':Sequelize[_0x9c9f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9c9f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9c9f('0x1')]},'destlanguage':{'type':Sequelize[_0x9c9f('0x1')]},'destaccountcode':{'type':Sequelize[_0x9c9f('0x1')]},'destcontext':{'type':Sequelize[_0x9c9f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9c9f('0x1')]},'destuniqueid':{'type':Sequelize[_0x9c9f('0x1')]},'messageId':{'type':Sequelize[_0x9c9f('0x1')]},'inReplyTo':{'type':Sequelize[_0x9c9f('0x1')]},'subject':{'type':Sequelize[_0x9c9f('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9c9f('0x1')]},'cc':{'type':Sequelize[_0x9c9f('0x1')]},'attachment':{'type':Sequelize[_0x9c9f('0x5')]},'html':{'type':Sequelize[_0x9c9f('0x5')]},'text':{'type':Sequelize[_0x9c9f('0x5')]},'status':{'type':Sequelize[_0x9c9f('0x6')](_0x9c9f('0x7'),_0x9c9f('0x8'),_0x9c9f('0x9'),'FAILED')},'url':{'type':Sequelize[_0x9c9f('0x1')]},'app':{'type':Sequelize[_0x9c9f('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2a79b75..b86f76a 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 _0xf5da=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x1c0267,_0x16ad39){var _0x103a94=function(_0x21e270){while(--_0x21e270){_0x1c0267['push'](_0x1c0267['shift']());}};_0x103a94(++_0x16ad39);}(_0xf5da,0x1f0));var _0xaf5d=function(_0x2f31b1,_0x17daa8){_0x2f31b1=_0x2f31b1-0x0;var _0x448988=_0xf5da[_0x2f31b1];return _0x448988;};'use strict';var emlformat=require(_0xaf5d('0x0'));var rimraf=require(_0xaf5d('0x1'));var zipdir=require(_0xaf5d('0x2'));var jsonpatch=require(_0xaf5d('0x3'));var rp=require('request-promise');var moment=require(_0xaf5d('0x4'));var BPromise=require(_0xaf5d('0x5'));var Mustache=require('mustache');var util=require(_0xaf5d('0x6'));var path=require(_0xaf5d('0x7'));var sox=require(_0xaf5d('0x8'));var csv=require(_0xaf5d('0x9'));var ejs=require(_0xaf5d('0xa'));var fs=require('fs');var fs_extra=require(_0xaf5d('0xb'));var _=require(_0xaf5d('0xc'));var squel=require('squel');var crypto=require(_0xaf5d('0xd'));var jsforce=require(_0xaf5d('0xe'));var deskjs=require(_0xaf5d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaf5d('0x10'));var Papa=require(_0xaf5d('0x11'));var Redis=require(_0xaf5d('0x12'));var authService=require(_0xaf5d('0x13'));var qs=require(_0xaf5d('0x14'));var as=require(_0xaf5d('0x15'));var hardwareService=require(_0xaf5d('0x16'));var logger=require(_0xaf5d('0x17'))(_0xaf5d('0x18'));var utils=require(_0xaf5d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaf5d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd90411,_0x3237ec){_0x3237ec=_0x3237ec||0xcc;return function(_0x5beff4){if(_0x5beff4){return _0xd90411[_0xaf5d('0x1b')](_0x3237ec);}return _0xd90411[_0xaf5d('0x1c')](_0x3237ec)[_0xaf5d('0x1d')]();};}function respondWithResult(_0x232eb8,_0x29d11a){_0x29d11a=_0x29d11a||0xc8;return function(_0x1196b8){if(_0x1196b8){return _0x232eb8[_0xaf5d('0x1c')](_0x29d11a)[_0xaf5d('0x1e')](_0x1196b8);}};}function respondWithFilteredResult(_0x1772a6,_0x88e7cc){return function(_0xb4ceb5){if(_0xb4ceb5){var _0x5d2f42=typeof _0x88e7cc['offset']===_0xaf5d('0x1f')&&typeof _0x88e7cc[_0xaf5d('0x20')]==='undefined';var _0x4d2815=_0xb4ceb5['count'];var _0x30481d=_0x5d2f42?0x0:_0x88e7cc[_0xaf5d('0x21')];var _0x39c1b0=_0x5d2f42?_0xb4ceb5[_0xaf5d('0x22')]:_0x88e7cc[_0xaf5d('0x21')]+_0x88e7cc['limit'];var _0x7ac32;if(_0x39c1b0>=_0x4d2815){_0x39c1b0=_0x4d2815;_0x7ac32=0xc8;}else{_0x7ac32=0xce;}_0x1772a6['status'](_0x7ac32);return _0x1772a6['set'](_0xaf5d('0x23'),_0x30481d+'-'+_0x39c1b0+'/'+_0x4d2815)[_0xaf5d('0x1e')](_0xb4ceb5);}return null;};}function patchUpdates(_0x4650fa){return function(_0x22761e){try{jsonpatch[_0xaf5d('0x24')](_0x22761e,_0x4650fa,!![]);}catch(_0x19d7c1){return BPromise[_0xaf5d('0x25')](_0x19d7c1);}return _0x22761e[_0xaf5d('0x26')]();};}function saveUpdates(_0x18901b,_0x48d7ac){return function(_0x3a25d5){if(_0x3a25d5){return _0x3a25d5['update'](_0x18901b)[_0xaf5d('0x27')](function(_0x5177b9){return _0x5177b9;});}return null;};}function removeEntity(_0x59d943,_0xa014a5){return function(_0x4981d2){if(_0x4981d2){return _0x4981d2[_0xaf5d('0x28')]()[_0xaf5d('0x27')](function(){_0x59d943[_0xaf5d('0x1c')](0xcc)[_0xaf5d('0x1d')]();});}};}function handleEntityNotFound(_0x186637,_0x43f913){return function(_0x318863){if(!_0x318863){_0x186637['sendStatus'](0x194);}return _0x318863;};}function handleError(_0x2b3bee,_0x3f3e7b){_0x3f3e7b=_0x3f3e7b||0x1f4;return function(_0x53b6e4){logger[_0xaf5d('0x29')](_0x53b6e4[_0xaf5d('0x2a')]);if(_0x53b6e4[_0xaf5d('0x2b')]){delete _0x53b6e4[_0xaf5d('0x2b')];}_0x2b3bee[_0xaf5d('0x1c')](_0x3f3e7b)[_0xaf5d('0x2c')](_0x53b6e4);};}exports['index']=function(_0x21d682,_0xbd6e3c){var _0x512fe2={},_0x371d72={},_0x37522c={'count':0x0,'rows':[]};var _0x271286=_[_0xaf5d('0x2d')](db['IntegrationReport']['rawAttributes'],function(_0x54b323){return{'name':_0x54b323[_0xaf5d('0x2e')],'type':_0x54b323[_0xaf5d('0x2f')][_0xaf5d('0x30')]};});_0x371d72[_0xaf5d('0x31')]=_[_0xaf5d('0x2d')](_0x271286,_0xaf5d('0x2b'));_0x371d72[_0xaf5d('0x32')]=_['keys'](_0x21d682[_0xaf5d('0x32')]);_0x371d72[_0xaf5d('0x33')]=_['intersection'](_0x371d72[_0xaf5d('0x31')],_0x371d72[_0xaf5d('0x32')]);_0x512fe2[_0xaf5d('0x34')]=_[_0xaf5d('0x35')](_0x371d72[_0xaf5d('0x31')],qs[_0xaf5d('0x36')](_0x21d682[_0xaf5d('0x32')][_0xaf5d('0x36')]));_0x512fe2[_0xaf5d('0x34')]=_0x512fe2['attributes'][_0xaf5d('0x37')]?_0x512fe2[_0xaf5d('0x34')]:_0x371d72['model'];if(!_0x21d682[_0xaf5d('0x32')][_0xaf5d('0x38')](_0xaf5d('0x39'))){_0x512fe2['limit']=qs[_0xaf5d('0x20')](_0x21d682[_0xaf5d('0x32')][_0xaf5d('0x20')]);_0x512fe2['offset']=qs['offset'](_0x21d682['query'][_0xaf5d('0x21')]);}_0x512fe2[_0xaf5d('0x3a')]=qs[_0xaf5d('0x3b')](_0x21d682[_0xaf5d('0x32')][_0xaf5d('0x3b')]);_0x512fe2[_0xaf5d('0x3c')]=qs[_0xaf5d('0x33')](_[_0xaf5d('0x3d')](_0x21d682[_0xaf5d('0x32')],_0x371d72['filters']),_0x271286);if(_0x21d682['query'][_0xaf5d('0x3e')]){_0x512fe2[_0xaf5d('0x3c')]=_[_0xaf5d('0x3f')](_0x512fe2[_0xaf5d('0x3c')],{'$or':_[_0xaf5d('0x2d')](_0x271286,function(_0x425ad7){if(_0x425ad7[_0xaf5d('0x2f')]!==_0xaf5d('0x40')){var _0x17b718={};_0x17b718[_0x425ad7[_0xaf5d('0x2b')]]={'$like':'%'+_0x21d682[_0xaf5d('0x32')]['filter']+'%'};return _0x17b718;}})});}_0x512fe2=_[_0xaf5d('0x3f')]({},_0x512fe2,_0x21d682[_0xaf5d('0x41')]);var _0xf29bec={'where':_0x512fe2['where']};return db[_0xaf5d('0x42')]['count'](_0xf29bec)['then'](function(_0x3721b0){_0x37522c[_0xaf5d('0x22')]=_0x3721b0;if(_0x21d682[_0xaf5d('0x32')][_0xaf5d('0x43')]){_0x512fe2[_0xaf5d('0x44')]=[{'all':!![]}];}return db[_0xaf5d('0x42')]['findAll'](_0x512fe2);})[_0xaf5d('0x27')](function(_0x2ee989){_0x37522c['rows']=_0x2ee989;return _0x37522c;})['then'](respondWithFilteredResult(_0xbd6e3c,_0x512fe2))[_0xaf5d('0x45')](handleError(_0xbd6e3c,null));};exports[_0xaf5d('0x46')]=function(_0x5ca53e,_0xd79a81){var _0x210156={'raw':![],'where':{'id':_0x5ca53e[_0xaf5d('0x47')]['id']}},_0x1caa13={};_0x1caa13[_0xaf5d('0x31')]=_[_0xaf5d('0x48')](db[_0xaf5d('0x42')][_0xaf5d('0x49')]);_0x1caa13[_0xaf5d('0x32')]=_[_0xaf5d('0x48')](_0x5ca53e['query']);_0x1caa13[_0xaf5d('0x33')]=_['intersection'](_0x1caa13[_0xaf5d('0x31')],_0x1caa13[_0xaf5d('0x32')]);_0x210156[_0xaf5d('0x34')]=_[_0xaf5d('0x35')](_0x1caa13[_0xaf5d('0x31')],qs['fields'](_0x5ca53e[_0xaf5d('0x32')]['fields']));_0x210156[_0xaf5d('0x34')]=_0x210156['attributes'][_0xaf5d('0x37')]?_0x210156[_0xaf5d('0x34')]:_0x1caa13[_0xaf5d('0x31')];if(_0x5ca53e[_0xaf5d('0x32')]['includeAll']){_0x210156[_0xaf5d('0x44')]=[{'all':!![]}];}_0x210156=_['merge']({},_0x210156,_0x5ca53e['options']);return db[_0xaf5d('0x42')][_0xaf5d('0x4a')](_0x210156)[_0xaf5d('0x27')](handleEntityNotFound(_0xd79a81,null))['then'](respondWithResult(_0xd79a81,null))['catch'](handleError(_0xd79a81,null));};exports[_0xaf5d('0x4b')]=function(_0x3a1725,_0x48ac88){return db[_0xaf5d('0x42')][_0xaf5d('0x4b')](_0x3a1725[_0xaf5d('0x4c')],{})[_0xaf5d('0x27')](respondWithResult(_0x48ac88,0xc9))[_0xaf5d('0x45')](handleError(_0x48ac88,null));};exports[_0xaf5d('0x4d')]=function(_0x569740,_0x2cf348){if(_0x569740['body']['id']){delete _0x569740[_0xaf5d('0x4c')]['id'];}return db[_0xaf5d('0x42')][_0xaf5d('0x4a')]({'where':{'id':_0x569740[_0xaf5d('0x47')]['id']}})[_0xaf5d('0x27')](handleEntityNotFound(_0x2cf348,null))['then'](saveUpdates(_0x569740[_0xaf5d('0x4c')],null))[_0xaf5d('0x27')](respondWithResult(_0x2cf348,null))[_0xaf5d('0x45')](handleError(_0x2cf348,null));};exports[_0xaf5d('0x28')]=function(_0x3748e6,_0x228973){return db[_0xaf5d('0x42')]['find']({'where':{'id':_0x3748e6[_0xaf5d('0x47')]['id']}})[_0xaf5d('0x27')](handleEntityNotFound(_0x228973,null))[_0xaf5d('0x27')](removeEntity(_0x228973,null))['catch'](handleError(_0x228973,null));};exports[_0xaf5d('0x4e')]=function(_0x596804,_0x40dbd9){return db['IntegrationReport'][_0xaf5d('0x4e')]()[_0xaf5d('0x27')](respondWithResult(_0x40dbd9,null))[_0xaf5d('0x45')](handleError(_0x40dbd9,null));}; \ No newline at end of file +var _0x8232=['reject','save','update','then','destroy','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply'];(function(_0x12169a,_0x1e28fd){var _0x588c8f=function(_0x3d9ecf){while(--_0x3d9ecf){_0x12169a['push'](_0x12169a['shift']());}};_0x588c8f(++_0x1e28fd);}(_0x8232,0x11f));var _0x2823=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8232[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0x2823('0x0'));var rimraf=require(_0x2823('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2823('0x2'));var BPromise=require(_0x2823('0x3'));var Mustache=require(_0x2823('0x4'));var util=require(_0x2823('0x5'));var path=require(_0x2823('0x6'));var sox=require(_0x2823('0x7'));var csv=require(_0x2823('0x8'));var ejs=require(_0x2823('0x9'));var fs=require('fs');var fs_extra=require(_0x2823('0xa'));var _=require('lodash');var squel=require(_0x2823('0xb'));var crypto=require(_0x2823('0xc'));var jsforce=require(_0x2823('0xd'));var deskjs=require(_0x2823('0xe'));var toCsv=require(_0x2823('0x8'));var querystring=require(_0x2823('0xf'));var Papa=require(_0x2823('0x10'));var Redis=require(_0x2823('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2823('0x12'));var as=require(_0x2823('0x13'));var hardwareService=require(_0x2823('0x14'));var logger=require(_0x2823('0x15'))(_0x2823('0x16'));var utils=require(_0x2823('0x17'));var config=require(_0x2823('0x18'));var licenseUtil=require(_0x2823('0x19'));var db=require(_0x2823('0x1a'))['db'];function respondWithStatusCode(_0x100673,_0x39829b){_0x39829b=_0x39829b||0xcc;return function(_0x582006){if(_0x582006){return _0x100673[_0x2823('0x1b')](_0x39829b);}return _0x100673[_0x2823('0x1c')](_0x39829b)['end']();};}function respondWithResult(_0x3ffa26,_0x55ec94){_0x55ec94=_0x55ec94||0xc8;return function(_0x4f5d31){if(_0x4f5d31){return _0x3ffa26[_0x2823('0x1c')](_0x55ec94)['json'](_0x4f5d31);}};}function respondWithFilteredResult(_0x5ceb0a,_0x23bc5b){return function(_0x13d524){if(_0x13d524){var _0x3e02d4=typeof _0x23bc5b[_0x2823('0x1d')]==='undefined'&&typeof _0x23bc5b[_0x2823('0x1e')]===_0x2823('0x1f');var _0x213a85=_0x13d524[_0x2823('0x20')];var _0x10f0bf=_0x3e02d4?0x0:_0x23bc5b[_0x2823('0x1d')];var _0x1f77f7=_0x3e02d4?_0x13d524['count']:_0x23bc5b[_0x2823('0x1d')]+_0x23bc5b[_0x2823('0x1e')];var _0x3de9cb;if(_0x1f77f7>=_0x213a85){_0x1f77f7=_0x213a85;_0x3de9cb=0xc8;}else{_0x3de9cb=0xce;}_0x5ceb0a['status'](_0x3de9cb);return _0x5ceb0a[_0x2823('0x21')](_0x2823('0x22'),_0x10f0bf+'-'+_0x1f77f7+'/'+_0x213a85)[_0x2823('0x23')](_0x13d524);}return null;};}function patchUpdates(_0xbb577a){return function(_0x1bec14){try{jsonpatch[_0x2823('0x24')](_0x1bec14,_0xbb577a,!![]);}catch(_0x40fca8){return BPromise[_0x2823('0x25')](_0x40fca8);}return _0x1bec14[_0x2823('0x26')]();};}function saveUpdates(_0x42b303,_0x1e4755){return function(_0x12ff36){if(_0x12ff36){return _0x12ff36[_0x2823('0x27')](_0x42b303)[_0x2823('0x28')](function(_0x1bf7aa){return _0x1bf7aa;});}return null;};}function removeEntity(_0x2487fd,_0x37dfba){return function(_0x2e2ed2){if(_0x2e2ed2){return _0x2e2ed2[_0x2823('0x29')]()[_0x2823('0x28')](function(){_0x2487fd['status'](0xcc)[_0x2823('0x2a')]();});}};}function handleEntityNotFound(_0x5cb38d,_0x139b9c){return function(_0x5d4b11){if(!_0x5d4b11){_0x5cb38d[_0x2823('0x1b')](0x194);}return _0x5d4b11;};}function handleError(_0x5e0b6e,_0x5c319a){_0x5c319a=_0x5c319a||0x1f4;return function(_0x47d636){logger[_0x2823('0x2b')](_0x47d636[_0x2823('0x2c')]);if(_0x47d636[_0x2823('0x2d')]){delete _0x47d636['name'];}_0x5e0b6e['status'](_0x5c319a)[_0x2823('0x2e')](_0x47d636);};}exports[_0x2823('0x2f')]=function(_0x2b0de2,_0x3e7972){var _0x405e7f={},_0x5bc792={},_0x246c43={'count':0x0,'rows':[]};var _0x484489=_[_0x2823('0x30')](db[_0x2823('0x31')][_0x2823('0x32')],function(_0x31754d){return{'name':_0x31754d[_0x2823('0x33')],'type':_0x31754d[_0x2823('0x34')][_0x2823('0x35')]};});_0x5bc792[_0x2823('0x36')]=_['map'](_0x484489,_0x2823('0x2d'));_0x5bc792[_0x2823('0x37')]=_[_0x2823('0x38')](_0x2b0de2[_0x2823('0x37')]);_0x5bc792[_0x2823('0x39')]=_[_0x2823('0x3a')](_0x5bc792[_0x2823('0x36')],_0x5bc792[_0x2823('0x37')]);_0x405e7f['attributes']=_[_0x2823('0x3a')](_0x5bc792[_0x2823('0x36')],qs[_0x2823('0x3b')](_0x2b0de2[_0x2823('0x37')]['fields']));_0x405e7f[_0x2823('0x3c')]=_0x405e7f['attributes'][_0x2823('0x3d')]?_0x405e7f[_0x2823('0x3c')]:_0x5bc792[_0x2823('0x36')];if(!_0x2b0de2['query']['hasOwnProperty'](_0x2823('0x3e'))){_0x405e7f[_0x2823('0x1e')]=qs['limit'](_0x2b0de2[_0x2823('0x37')]['limit']);_0x405e7f[_0x2823('0x1d')]=qs['offset'](_0x2b0de2[_0x2823('0x37')][_0x2823('0x1d')]);}_0x405e7f[_0x2823('0x3f')]=qs[_0x2823('0x40')](_0x2b0de2[_0x2823('0x37')][_0x2823('0x40')]);_0x405e7f[_0x2823('0x41')]=qs[_0x2823('0x39')](_[_0x2823('0x42')](_0x2b0de2[_0x2823('0x37')],_0x5bc792[_0x2823('0x39')]),_0x484489);if(_0x2b0de2[_0x2823('0x37')]['filter']){_0x405e7f[_0x2823('0x41')]=_[_0x2823('0x43')](_0x405e7f[_0x2823('0x41')],{'$or':_[_0x2823('0x30')](_0x484489,function(_0x28a6ac){if(_0x28a6ac['type']!==_0x2823('0x44')){var _0x3efc26={};_0x3efc26[_0x28a6ac[_0x2823('0x2d')]]={'$like':'%'+_0x2b0de2['query'][_0x2823('0x45')]+'%'};return _0x3efc26;}})});}_0x405e7f=_['merge']({},_0x405e7f,_0x2b0de2['options']);var _0x2aa63={'where':_0x405e7f[_0x2823('0x41')]};return db['IntegrationReport'][_0x2823('0x20')](_0x2aa63)[_0x2823('0x28')](function(_0xb5259d){_0x246c43[_0x2823('0x20')]=_0xb5259d;if(_0x2b0de2[_0x2823('0x37')][_0x2823('0x46')]){_0x405e7f[_0x2823('0x47')]=[{'all':!![]}];}return db['IntegrationReport'][_0x2823('0x48')](_0x405e7f);})['then'](function(_0x4a5c59){_0x246c43[_0x2823('0x49')]=_0x4a5c59;return _0x246c43;})[_0x2823('0x28')](respondWithFilteredResult(_0x3e7972,_0x405e7f))[_0x2823('0x4a')](handleError(_0x3e7972,null));};exports[_0x2823('0x4b')]=function(_0x235150,_0x4449b6){var _0x1e5844={'raw':![],'where':{'id':_0x235150[_0x2823('0x4c')]['id']}},_0x4fb22f={};_0x4fb22f['model']=_[_0x2823('0x38')](db[_0x2823('0x31')][_0x2823('0x32')]);_0x4fb22f[_0x2823('0x37')]=_[_0x2823('0x38')](_0x235150[_0x2823('0x37')]);_0x4fb22f[_0x2823('0x39')]=_['intersection'](_0x4fb22f[_0x2823('0x36')],_0x4fb22f[_0x2823('0x37')]);_0x1e5844[_0x2823('0x3c')]=_[_0x2823('0x3a')](_0x4fb22f[_0x2823('0x36')],qs[_0x2823('0x3b')](_0x235150['query'][_0x2823('0x3b')]));_0x1e5844[_0x2823('0x3c')]=_0x1e5844[_0x2823('0x3c')]['length']?_0x1e5844['attributes']:_0x4fb22f[_0x2823('0x36')];if(_0x235150[_0x2823('0x37')][_0x2823('0x46')]){_0x1e5844[_0x2823('0x47')]=[{'all':!![]}];}_0x1e5844=_['merge']({},_0x1e5844,_0x235150['options']);return db[_0x2823('0x31')][_0x2823('0x4d')](_0x1e5844)['then'](handleEntityNotFound(_0x4449b6,null))['then'](respondWithResult(_0x4449b6,null))[_0x2823('0x4a')](handleError(_0x4449b6,null));};exports['create']=function(_0x2d25d6,_0x8315d8){return db['IntegrationReport'][_0x2823('0x4e')](_0x2d25d6[_0x2823('0x4f')],{})['then'](respondWithResult(_0x8315d8,0xc9))['catch'](handleError(_0x8315d8,null));};exports[_0x2823('0x27')]=function(_0x22c95e,_0x3cd3d1){if(_0x22c95e[_0x2823('0x4f')]['id']){delete _0x22c95e['body']['id'];}return db['IntegrationReport'][_0x2823('0x4d')]({'where':{'id':_0x22c95e[_0x2823('0x4c')]['id']}})[_0x2823('0x28')](handleEntityNotFound(_0x3cd3d1,null))['then'](saveUpdates(_0x22c95e[_0x2823('0x4f')],null))[_0x2823('0x28')](respondWithResult(_0x3cd3d1,null))['catch'](handleError(_0x3cd3d1,null));};exports[_0x2823('0x29')]=function(_0x31e0fb,_0x20ab87){return db['IntegrationReport'][_0x2823('0x4d')]({'where':{'id':_0x31e0fb[_0x2823('0x4c')]['id']}})[_0x2823('0x28')](handleEntityNotFound(_0x20ab87,null))['then'](removeEntity(_0x20ab87,null))['catch'](handleError(_0x20ab87,null));};exports[_0x2823('0x50')]=function(_0x52decc,_0x56b064){return db[_0x2823('0x31')]['describe']()['then'](respondWithResult(_0x56b064,null))[_0x2823('0x4a')](handleError(_0x56b064,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index fe0767b..ba86ae6 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 _0xe8bf=['./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xe8bf,0x88));var _0xfe8b=function(_0x5ddb76,_0x3f070b){_0x5ddb76=_0x5ddb76-0x0;var _0x20f915=_0xe8bf[_0x5ddb76];return _0x20f915;};'use strict';var _=require(_0xfe8b('0x0'));var util=require(_0xfe8b('0x1'));var logger=require(_0xfe8b('0x2'))(_0xfe8b('0x3'));var moment=require(_0xfe8b('0x4'));var BPromise=require(_0xfe8b('0x5'));var rp=require(_0xfe8b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe8b('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe8b('0x8'));module[_0xfe8b('0x9')]=function(_0x36753c,_0x7de8b0){return _0x36753c[_0xfe8b('0xa')](_0xfe8b('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9b=['moment','bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','api'];(function(_0x1656c7,_0xee257b){var _0x5d33e4=function(_0x219ea3){while(--_0x219ea3){_0x1656c7['push'](_0x1656c7['shift']());}};_0x5d33e4(++_0xee257b);}(_0xcb9b,0x8a));var _0xbcb9=function(_0x53149f,_0x57f534){_0x53149f=_0x53149f-0x0;var _0xa6af39=_0xcb9b[_0x53149f];return _0xa6af39;};'use strict';var _=require('lodash');var util=require(_0xbcb9('0x0'));var logger=require('../../config/logger')(_0xbcb9('0x1'));var moment=require(_0xbcb9('0x2'));var BPromise=require(_0xbcb9('0x3'));var rp=require(_0xbcb9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbcb9('0x5'));var attributes=require(_0xbcb9('0x6'));module[_0xbcb9('0x7')]=function(_0x5aa4c7,_0x45594d){return _0x5aa4c7[_0xbcb9('0x8')](_0xbcb9('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 44dfe5a..df29d78 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x233aa2,_0x24f291){var _0x544eeb=function(_0x3dba0b){while(--_0x3dba0b){_0x233aa2['push'](_0x233aa2['shift']());}};_0x544eeb(++_0x24f291);}(_0x187d,0x93));var _0xd187=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x187d[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x4975,0x86));var _0x5497=function(_0x53b2ea,_0x11a342){_0x53b2ea=_0x53b2ea-0x0;var _0x52768e=_0x4975[_0x53b2ea];return _0x52768e;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7d4972f..7b9b434 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 _0xfc9b=['index','/:id','isAuthenticated','post','create','/:id/sub_intervals','addInterval','addIntervals','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get'];(function(_0xd6df5e,_0x4a4e46){var _0x155b12=function(_0x368fb6){while(--_0x368fb6){_0xd6df5e['push'](_0xd6df5e['shift']());}};_0x155b12(++_0x4a4e46);}(_0xfc9b,0x74));var _0xbfc9=function(_0x3c2167,_0xef1b79){_0x3c2167=_0x3c2167-0x0;var _0x4f00c7=_0xfc9b[_0x3c2167];return _0x4f00c7;};'use strict';var multer=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var path=require(_0xbfc9('0x2'));var timeout=require(_0xbfc9('0x3'));var express=require(_0xbfc9('0x4'));var router=express[_0xbfc9('0x5')]();var fs_extra=require(_0xbfc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbfc9('0x7'));var config=require('../../config/environment');var controller=require(_0xbfc9('0x8'));router[_0xbfc9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbfc9('0xa')]);router[_0xbfc9('0x9')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['show']);router[_0xbfc9('0x9')]('/:id/sub_intervals',auth[_0xbfc9('0xc')](),controller['getIntervals']);router[_0xbfc9('0xd')]('/',auth['isAuthenticated'](),controller[_0xbfc9('0xe')]);router[_0xbfc9('0xd')](_0xbfc9('0xf'),auth[_0xbfc9('0xc')](),controller[_0xbfc9('0x10')]);router[_0xbfc9('0xd')]('/:id/sub_intervals/create_many',auth[_0xbfc9('0xc')](),controller[_0xbfc9('0x11')]);router['put'](_0xbfc9('0xb'),auth['isAuthenticated'](),controller[_0xbfc9('0x12')]);router[_0xbfc9('0x13')](_0xbfc9('0xb'),auth[_0xbfc9('0xc')](),controller['destroy']);module[_0xbfc9('0x14')]=router; \ No newline at end of file +var _0xe574=['../../config/environment','./interval.controller','get','isAuthenticated','index','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d602e,_0x56af04){var _0x358eda=function(_0x1a1bc8){while(--_0x1a1bc8){_0x3d602e['push'](_0x3d602e['shift']());}};_0x358eda(++_0x56af04);}(_0xe574,0x100));var _0x4e57=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe574[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x4e57('0x0'));var util=require('util');var path=require(_0x4e57('0x1'));var timeout=require(_0x4e57('0x2'));var express=require(_0x4e57('0x3'));var router=express[_0x4e57('0x4')]();var fs_extra=require(_0x4e57('0x5'));var auth=require(_0x4e57('0x6'));var interaction=require(_0x4e57('0x7'));var config=require(_0x4e57('0x8'));var controller=require(_0x4e57('0x9'));router[_0x4e57('0xa')]('/',auth[_0x4e57('0xb')](),controller[_0x4e57('0xc')]);router['get']('/:id',auth[_0x4e57('0xb')](),controller['show']);router['get'](_0x4e57('0xd'),auth[_0x4e57('0xb')](),controller[_0x4e57('0xe')]);router[_0x4e57('0xf')]('/',auth[_0x4e57('0xb')](),controller['create']);router[_0x4e57('0xf')](_0x4e57('0xd'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x10')]);router[_0x4e57('0xf')](_0x4e57('0x11'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x12')]);router[_0x4e57('0x13')](_0x4e57('0x14'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x15')]);router[_0x4e57('0x16')](_0x4e57('0x14'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9f98156..0b7ad67 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 _0x7d8a=['sequelize','exports','STRING'];(function(_0x2f60e0,_0x311dee){var _0x4603e4=function(_0x42dff9){while(--_0x42dff9){_0x2f60e0['push'](_0x2f60e0['shift']());}};_0x4603e4(++_0x311dee);}(_0x7d8a,0x10b));var _0xa7d8=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x7d8a[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'name':{'type':Sequelize[_0xa7d8('0x2')]},'description':{'type':Sequelize[_0xa7d8('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x903e=['STRING','sequelize','exports'];(function(_0x136d7c,_0x54ce39){var _0x2055cc=function(_0x306825){while(--_0x306825){_0x136d7c['push'](_0x136d7c['shift']());}};_0x2055cc(++_0x54ce39);}(_0x903e,0x1d2));var _0xe903=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x903e[_0x555ebb];return _0x3c0a4a;};'use strict';var Sequelize=require(_0xe903('0x0'));module[_0xe903('0x1')]={'name':{'type':Sequelize[_0xe903('0x2')]},'description':{'type':Sequelize[_0xe903('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 3c93292..7ab3c39 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 _0xff3a=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','Intervals','name','index','Interval','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','findOne','getIntervals','addIntervals','transaction','IntervalId','rimraf'];(function(_0x4521de,_0x255539){var _0x56acc5=function(_0x33f8fd){while(--_0x33f8fd){_0x4521de['push'](_0x4521de['shift']());}};_0x56acc5(++_0x255539);}(_0xff3a,0x14f));var _0xaff3=function(_0x1c52b3,_0x2c3ecf){_0x1c52b3=_0x1c52b3-0x0;var _0x38b25e=_0xff3a[_0x1c52b3];return _0x38b25e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff3('0x0'));var zipdir=require(_0xaff3('0x1'));var jsonpatch=require(_0xaff3('0x2'));var rp=require(_0xaff3('0x3'));var moment=require('moment');var BPromise=require(_0xaff3('0x4'));var Mustache=require(_0xaff3('0x5'));var util=require(_0xaff3('0x6'));var path=require(_0xaff3('0x7'));var sox=require(_0xaff3('0x8'));var csv=require('to-csv');var ejs=require(_0xaff3('0x9'));var fs=require('fs');var fs_extra=require(_0xaff3('0xa'));var _=require(_0xaff3('0xb'));var squel=require(_0xaff3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaff3('0xd'));var querystring=require('querystring');var Papa=require(_0xaff3('0xe'));var Redis=require('ioredis');var authService=require(_0xaff3('0xf'));var qs=require(_0xaff3('0x10'));var as=require(_0xaff3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaff3('0x12'))(_0xaff3('0x13'));var utils=require('../../config/utils');var config=require(_0xaff3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0xaff3('0x15'));function respondWithStatusCode(_0x3ea855,_0xd8641c){_0xd8641c=_0xd8641c||0xcc;return function(_0x2dc6c7){if(_0x2dc6c7){return _0x3ea855[_0xaff3('0x16')](_0xd8641c);}return _0x3ea855['status'](_0xd8641c)['end']();};}function respondWithResult(_0x2ab32b,_0x3c5672){_0x3c5672=_0x3c5672||0xc8;return function(_0x1a18e3){if(_0x1a18e3){return _0x2ab32b[_0xaff3('0x17')](_0x3c5672)[_0xaff3('0x18')](_0x1a18e3);}};}function respondWithFilteredResult(_0x2d5b53,_0x192097){return function(_0x1ade77){if(_0x1ade77){var _0x3bc2eb=typeof _0x192097['offset']===_0xaff3('0x19')&&typeof _0x192097[_0xaff3('0x1a')]===_0xaff3('0x19');var _0x502d18=_0x1ade77[_0xaff3('0x1b')];var _0x2dadef=_0x3bc2eb?0x0:_0x192097['offset'];var _0x3508a9=_0x3bc2eb?_0x1ade77[_0xaff3('0x1b')]:_0x192097['offset']+_0x192097[_0xaff3('0x1a')];var _0x19bc89;if(_0x3508a9>=_0x502d18){_0x3508a9=_0x502d18;_0x19bc89=0xc8;}else{_0x19bc89=0xce;}_0x2d5b53['status'](_0x19bc89);return _0x2d5b53[_0xaff3('0x1c')](_0xaff3('0x1d'),_0x2dadef+'-'+_0x3508a9+'/'+_0x502d18)[_0xaff3('0x18')](_0x1ade77);}return null;};}function patchUpdates(_0x3e9bfe){return function(_0xbc2251){try{jsonpatch[_0xaff3('0x1e')](_0xbc2251,_0x3e9bfe,!![]);}catch(_0x3a5583){return BPromise['reject'](_0x3a5583);}return _0xbc2251[_0xaff3('0x1f')]();};}function saveUpdates(_0x472fce,_0x10f6ed){return function(_0x875045){if(_0x875045){return _0x875045['update'](_0x472fce)[_0xaff3('0x20')](function(_0x6fe8ca){return _0x6fe8ca;});}return null;};}function removeEntity(_0x44ecfb,_0x3b15ba){return function(_0x42839c){if(_0x42839c){return _0x42839c[_0xaff3('0x21')]()[_0xaff3('0x20')](function(){var _0x4e78e5=_0x42839c['get']({'plain':!![]});var _0x47d4a1=_0xaff3('0x22');return db['UserProfileResource'][_0xaff3('0x21')]({'where':{'type':_0x47d4a1,'resourceId':_0x4e78e5['id']}})[_0xaff3('0x20')](function(){return _0x42839c;});})['then'](function(){_0x44ecfb[_0xaff3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f219c,_0x53be18){return function(_0x3c73e5){if(!_0x3c73e5){_0x3f219c[_0xaff3('0x16')](0x194);}return _0x3c73e5;};}function handleError(_0x1c7e30,_0x36e6e){_0x36e6e=_0x36e6e||0x1f4;return function(_0x2fd059){logger['error'](_0x2fd059['stack']);if(_0x2fd059[_0xaff3('0x23')]){delete _0x2fd059['name'];}_0x1c7e30[_0xaff3('0x17')](_0x36e6e)['send'](_0x2fd059);};}exports[_0xaff3('0x24')]=function(_0x4938e5,_0x34efc2){var _0x4b1cf7={},_0x1b94cf={},_0x961d16={'count':0x0,'rows':[]};var _0x146df1=_['map'](db[_0xaff3('0x25')][_0xaff3('0x26')],function(_0xaab3ab){return{'name':_0xaab3ab[_0xaff3('0x27')],'type':_0xaab3ab['type'][_0xaff3('0x28')]};});_0x1b94cf[_0xaff3('0x29')]=_[_0xaff3('0x2a')](_0x146df1,_0xaff3('0x23'));_0x1b94cf[_0xaff3('0x2b')]=_[_0xaff3('0x2c')](_0x4938e5[_0xaff3('0x2b')]);_0x1b94cf[_0xaff3('0x2d')]=_[_0xaff3('0x2e')](_0x1b94cf[_0xaff3('0x29')],_0x1b94cf['query']);_0x4b1cf7[_0xaff3('0x2f')]=_[_0xaff3('0x2e')](_0x1b94cf[_0xaff3('0x29')],qs[_0xaff3('0x30')](_0x4938e5['query'][_0xaff3('0x30')]));_0x4b1cf7[_0xaff3('0x2f')]=_0x4b1cf7['attributes'][_0xaff3('0x31')]?_0x4b1cf7[_0xaff3('0x2f')]:_0x1b94cf[_0xaff3('0x29')];if(!_0x4938e5[_0xaff3('0x2b')][_0xaff3('0x32')](_0xaff3('0x33'))){_0x4b1cf7[_0xaff3('0x1a')]=qs[_0xaff3('0x1a')](_0x4938e5[_0xaff3('0x2b')]['limit']);_0x4b1cf7[_0xaff3('0x34')]=qs[_0xaff3('0x34')](_0x4938e5[_0xaff3('0x2b')][_0xaff3('0x34')]);}_0x4b1cf7[_0xaff3('0x35')]=qs[_0xaff3('0x36')](_0x4938e5[_0xaff3('0x2b')][_0xaff3('0x36')]);_0x4b1cf7[_0xaff3('0x37')]=qs[_0xaff3('0x2d')](_[_0xaff3('0x38')](_0x4938e5[_0xaff3('0x2b')],_0x1b94cf['filters']),_0x146df1);if(_0x4938e5[_0xaff3('0x2b')]['filter']){_0x4b1cf7[_0xaff3('0x37')]=_[_0xaff3('0x39')](_0x4b1cf7[_0xaff3('0x37')],{'$or':_['map'](_0x146df1,function(_0x352b18){if(_0x352b18[_0xaff3('0x3a')]!==_0xaff3('0x3b')){var _0x26f127={};_0x26f127[_0x352b18[_0xaff3('0x23')]]={'$like':'%'+_0x4938e5[_0xaff3('0x2b')][_0xaff3('0x3c')]+'%'};return _0x26f127;}})});}_0x4b1cf7=_[_0xaff3('0x39')]({},_0x4b1cf7,_0x4938e5[_0xaff3('0x3d')]);var _0x467d67={'where':_0x4b1cf7[_0xaff3('0x37')]};return db[_0xaff3('0x25')][_0xaff3('0x1b')](_0x467d67)[_0xaff3('0x20')](function(_0x3ce29f){_0x961d16[_0xaff3('0x1b')]=_0x3ce29f;if(_0x4938e5[_0xaff3('0x2b')][_0xaff3('0x3e')]){_0x4b1cf7['include']=[{'all':!![]}];}return db[_0xaff3('0x25')][_0xaff3('0x3f')](_0x4b1cf7);})[_0xaff3('0x20')](function(_0x373948){_0x961d16[_0xaff3('0x40')]=_0x373948;return _0x961d16;})[_0xaff3('0x20')](respondWithFilteredResult(_0x34efc2,_0x4b1cf7))[_0xaff3('0x41')](handleError(_0x34efc2,null));};exports[_0xaff3('0x42')]=function(_0x4b0d3f,_0x58ab22){var _0x48b32d={'raw':!![],'where':{'id':_0x4b0d3f[_0xaff3('0x43')]['id']}},_0x517828={};_0x517828['model']=_[_0xaff3('0x2c')](db[_0xaff3('0x25')][_0xaff3('0x26')]);_0x517828[_0xaff3('0x2b')]=_[_0xaff3('0x2c')](_0x4b0d3f[_0xaff3('0x2b')]);_0x517828['filters']=_[_0xaff3('0x2e')](_0x517828[_0xaff3('0x29')],_0x517828[_0xaff3('0x2b')]);_0x48b32d[_0xaff3('0x2f')]=_['intersection'](_0x517828[_0xaff3('0x29')],qs[_0xaff3('0x30')](_0x4b0d3f[_0xaff3('0x2b')][_0xaff3('0x30')]));_0x48b32d['attributes']=_0x48b32d['attributes'][_0xaff3('0x31')]?_0x48b32d['attributes']:_0x517828[_0xaff3('0x29')];if(_0x4b0d3f[_0xaff3('0x2b')][_0xaff3('0x3e')]){_0x48b32d['include']=[{'all':!![]}];}_0x48b32d=_[_0xaff3('0x39')]({},_0x48b32d,_0x4b0d3f['options']);return db[_0xaff3('0x25')][_0xaff3('0x44')](_0x48b32d)[_0xaff3('0x20')](handleEntityNotFound(_0x58ab22,null))[_0xaff3('0x20')](respondWithResult(_0x58ab22,null))['catch'](handleError(_0x58ab22,null));};exports[_0xaff3('0x45')]=function(_0x5dd64a,_0x1324af){return db['Interval'][_0xaff3('0x45')](_0x5dd64a[_0xaff3('0x46')],{})[_0xaff3('0x20')](function(_0x3e9c71){var _0x101a25=_0x5dd64a[_0xaff3('0x47')][_0xaff3('0x48')]({'plain':!![]});if(!_0x101a25)throw new Error(_0xaff3('0x49'));if(_0x101a25[_0xaff3('0x4a')]===_0xaff3('0x47')){var _0x687736=_0x3e9c71[_0xaff3('0x48')]({'plain':!![]});var _0x5dff5b=_0xaff3('0x22');return db['UserProfileSection'][_0xaff3('0x44')]({'where':{'name':_0x5dff5b,'userProfileId':_0x101a25['userProfileId']},'raw':!![]})[_0xaff3('0x20')](function(_0x107d37){if(_0x107d37&&_0x107d37[_0xaff3('0x4b')]===0x0){return db['UserProfileResource'][_0xaff3('0x45')]({'name':_0x687736['name'],'resourceId':_0x687736['id'],'type':_0x107d37[_0xaff3('0x23')],'sectionId':_0x107d37['id']},{})[_0xaff3('0x20')](function(){return _0x3e9c71;});}else{return _0x3e9c71;}})[_0xaff3('0x41')](function(_0x3aef23){logger['error'](_0xaff3('0x4c'),_0x3aef23);throw _0x3aef23;});}return _0x3e9c71;})[_0xaff3('0x20')](respondWithResult(_0x1324af,0xc9))[_0xaff3('0x41')](handleError(_0x1324af,null));};exports[_0xaff3('0x4d')]=function(_0x3e08a7,_0xd7fe20){if(_0x3e08a7[_0xaff3('0x46')]['id']){delete _0x3e08a7['body']['id'];}return db[_0xaff3('0x25')][_0xaff3('0x44')]({'where':{'id':_0x3e08a7['params']['id']}})[_0xaff3('0x20')](handleEntityNotFound(_0xd7fe20,null))[_0xaff3('0x20')](saveUpdates(_0x3e08a7[_0xaff3('0x46')],null))['then'](respondWithResult(_0xd7fe20,null))['catch'](handleError(_0xd7fe20,null));};exports[_0xaff3('0x21')]=function(_0x3632ab,_0x14de6b){return db['Interval']['find']({'where':{'id':_0x3632ab[_0xaff3('0x43')]['id']}})['then'](handleEntityNotFound(_0x14de6b,null))[_0xaff3('0x20')](removeEntity(_0x14de6b,null))[_0xaff3('0x41')](handleError(_0x14de6b,null));};exports[_0xaff3('0x4e')]=function(_0x5d3ab8,_0xb12dff,_0x1806d2){if(_0x5d3ab8[_0xaff3('0x46')]['id']){delete _0x5d3ab8[_0xaff3('0x46')]['id'];}return db[_0xaff3('0x25')][_0xaff3('0x44')]({'where':{'id':_0x5d3ab8['params']['id']}})[_0xaff3('0x20')](handleEntityNotFound(_0xb12dff,null))[_0xaff3('0x20')](function(_0x52a490){if(_0x52a490){_0x5d3ab8[_0xaff3('0x46')]['IntervalId']=_0x52a490['id'];return db[_0xaff3('0x25')][_0xaff3('0x45')](_0x5d3ab8[_0xaff3('0x46')]);}})[_0xaff3('0x20')](respondWithResult(_0xb12dff,null))[_0xaff3('0x41')](handleError(_0xb12dff,null));};exports['getIntervals']=function(_0x234822,_0x158bfd,_0x44cb40){var _0xee40b2={};var _0x5c275c={};var _0x5f50c5;var _0x4e9eff;return db[_0xaff3('0x25')][_0xaff3('0x4f')]({'where':{'id':_0x234822[_0xaff3('0x43')]['id']}})[_0xaff3('0x20')](handleEntityNotFound(_0x158bfd,null))[_0xaff3('0x20')](function(_0x290d11){if(_0x290d11){_0x5f50c5=_0x290d11;_0x5c275c[_0xaff3('0x29')]=_[_0xaff3('0x2c')](db[_0xaff3('0x25')][_0xaff3('0x26')]);_0x5c275c[_0xaff3('0x2b')]=_[_0xaff3('0x2c')](_0x234822[_0xaff3('0x2b')]);_0x5c275c[_0xaff3('0x2d')]=_['intersection'](_0x5c275c[_0xaff3('0x29')],_0x5c275c[_0xaff3('0x2b')]);_0xee40b2[_0xaff3('0x2f')]=_[_0xaff3('0x2e')](_0x5c275c[_0xaff3('0x29')],qs[_0xaff3('0x30')](_0x234822[_0xaff3('0x2b')][_0xaff3('0x30')]));_0xee40b2[_0xaff3('0x2f')]=_0xee40b2['attributes'][_0xaff3('0x31')]?_0xee40b2[_0xaff3('0x2f')]:_0x5c275c[_0xaff3('0x29')];_0xee40b2[_0xaff3('0x35')]=qs[_0xaff3('0x36')](_0x234822[_0xaff3('0x2b')][_0xaff3('0x36')]);_0xee40b2[_0xaff3('0x37')]=qs['filters'](_[_0xaff3('0x38')](_0x234822['query'],_0x5c275c[_0xaff3('0x2d')]));if(_0x234822[_0xaff3('0x2b')]['filter']){_0xee40b2['where']=_[_0xaff3('0x39')](_0xee40b2['where'],{'$or':_[_0xaff3('0x2a')](_0xee40b2[_0xaff3('0x2f')],function(_0x9aaf7c){var _0x11cbf8={};_0x11cbf8[_0x9aaf7c]={'$like':'%'+_0x234822[_0xaff3('0x2b')][_0xaff3('0x3c')]+'%'};return _0x11cbf8;})});}_0xee40b2=_[_0xaff3('0x39')]({},_0xee40b2,_0x234822[_0xaff3('0x3d')]);return _0x5f50c5[_0xaff3('0x50')](_0xee40b2);}})['then'](function(_0x201854){if(_0x201854){_0x4e9eff=_0x201854['length'];if(!_0x234822['query'][_0xaff3('0x32')]('nolimit')){_0xee40b2[_0xaff3('0x1a')]=qs[_0xaff3('0x1a')](_0x234822[_0xaff3('0x2b')][_0xaff3('0x1a')]);_0xee40b2[_0xaff3('0x34')]=qs['offset'](_0x234822[_0xaff3('0x2b')][_0xaff3('0x34')]);}return _0x5f50c5[_0xaff3('0x50')](_0xee40b2);}})[_0xaff3('0x20')](function(_0x2ac714){if(_0x2ac714){return _0x2ac714?{'count':_0x4e9eff,'rows':_0x2ac714}:null;}})[_0xaff3('0x20')](respondWithResult(_0x158bfd,null))[_0xaff3('0x41')](handleError(_0x158bfd,null));};exports[_0xaff3('0x51')]=function(_0x1e90cb,_0x312017,_0x63587a){return db[_0xaff3('0x25')][_0xaff3('0x4f')]({'where':{'id':_0x1e90cb[_0xaff3('0x43')]['id']}})['then'](handleEntityNotFound(_0x312017,null))[_0xaff3('0x20')](function(_0x38c640){if(_0x38c640){return db['sequelize'][_0xaff3('0x52')](function(_0x110215){return db[_0xaff3('0x25')][_0xaff3('0x21')]({'where':{'IntervalId':_0x1e90cb[_0xaff3('0x43')]['id']},'transaction':_0x110215})[_0xaff3('0x20')](function(_0x4ea530){var _0x474f42=_[_0xaff3('0x2a')](_0x1e90cb[_0xaff3('0x46')],function(_0x103293){delete _0x103293['id'];_0x103293[_0xaff3('0x53')]=_0x1e90cb['params']['id'];return _0x103293;});return db[_0xaff3('0x25')]['bulkCreate'](_0x474f42,{'transaction':_0x110215});});})['then'](function(){return db[_0xaff3('0x25')][_0xaff3('0x3f')]({'where':{'IntervalId':_0x1e90cb[_0xaff3('0x43')]['id']}});});}})[_0xaff3('0x20')](respondWithResult(_0x312017,null))[_0xaff3('0x41')](handleError(_0x312017,null));}; \ No newline at end of file +var _0xa0b4=['where','pick','filters','filter','type','merge','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','getIntervals','sort','options','hasOwnProperty','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order'];(function(_0x3c98a5,_0x5435f4){var _0x155383=function(_0x5ad7a6){while(--_0x5ad7a6){_0x3c98a5['push'](_0x3c98a5['shift']());}};_0x155383(++_0x5435f4);}(_0xa0b4,0x79));var _0x4a0b=function(_0x23cc21,_0x22911b){_0x23cc21=_0x23cc21-0x0;var _0x5b8491=_0xa0b4[_0x23cc21];return _0x5b8491;};'use strict';var emlformat=require(_0x4a0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a0b('0x2'));var BPromise=require(_0x4a0b('0x3'));var Mustache=require('mustache');var util=require(_0x4a0b('0x4'));var path=require(_0x4a0b('0x5'));var sox=require(_0x4a0b('0x6'));var csv=require(_0x4a0b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a0b('0x8'));var crypto=require('crypto');var jsforce=require(_0x4a0b('0x9'));var deskjs=require(_0x4a0b('0xa'));var toCsv=require(_0x4a0b('0x7'));var querystring=require(_0x4a0b('0xb'));var Papa=require(_0x4a0b('0xc'));var Redis=require(_0x4a0b('0xd'));var authService=require(_0x4a0b('0xe'));var qs=require(_0x4a0b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a0b('0x10'))('api');var utils=require(_0x4a0b('0x11'));var config=require(_0x4a0b('0x12'));var licenseUtil=require(_0x4a0b('0x13'));var db=require(_0x4a0b('0x14'))['db'];var extensions=require(_0x4a0b('0x15'));function respondWithStatusCode(_0x352dda,_0x5d6056){_0x5d6056=_0x5d6056||0xcc;return function(_0x314e80){if(_0x314e80){return _0x352dda['sendStatus'](_0x5d6056);}return _0x352dda[_0x4a0b('0x16')](_0x5d6056)['end']();};}function respondWithResult(_0xe72ea4,_0x424b28){_0x424b28=_0x424b28||0xc8;return function(_0x47bfe1){if(_0x47bfe1){return _0xe72ea4['status'](_0x424b28)[_0x4a0b('0x17')](_0x47bfe1);}};}function respondWithFilteredResult(_0xfea53a,_0x9567e1){return function(_0x566486){if(_0x566486){var _0x3683b0=typeof _0x9567e1[_0x4a0b('0x18')]==='undefined'&&typeof _0x9567e1['limit']===_0x4a0b('0x19');var _0x281103=_0x566486[_0x4a0b('0x1a')];var _0x570a20=_0x3683b0?0x0:_0x9567e1[_0x4a0b('0x18')];var _0x3e33d3=_0x3683b0?_0x566486[_0x4a0b('0x1a')]:_0x9567e1[_0x4a0b('0x18')]+_0x9567e1['limit'];var _0x3e8d12;if(_0x3e33d3>=_0x281103){_0x3e33d3=_0x281103;_0x3e8d12=0xc8;}else{_0x3e8d12=0xce;}_0xfea53a[_0x4a0b('0x16')](_0x3e8d12);return _0xfea53a[_0x4a0b('0x1b')](_0x4a0b('0x1c'),_0x570a20+'-'+_0x3e33d3+'/'+_0x281103)[_0x4a0b('0x17')](_0x566486);}return null;};}function patchUpdates(_0x3e7772){return function(_0x3ebaa3){try{jsonpatch[_0x4a0b('0x1d')](_0x3ebaa3,_0x3e7772,!![]);}catch(_0x363b8d){return BPromise[_0x4a0b('0x1e')](_0x363b8d);}return _0x3ebaa3[_0x4a0b('0x1f')]();};}function saveUpdates(_0x3e041d,_0x39f65e){return function(_0x2260c1){if(_0x2260c1){return _0x2260c1['update'](_0x3e041d)['then'](function(_0x5442b5){return _0x5442b5;});}return null;};}function removeEntity(_0x384223,_0x2c314e){return function(_0x52142f){if(_0x52142f){return _0x52142f[_0x4a0b('0x20')]()[_0x4a0b('0x21')](function(){var _0x2f210b=_0x52142f[_0x4a0b('0x22')]({'plain':!![]});var _0x54fd13=_0x4a0b('0x23');return db[_0x4a0b('0x24')][_0x4a0b('0x20')]({'where':{'type':_0x54fd13,'resourceId':_0x2f210b['id']}})[_0x4a0b('0x21')](function(){return _0x52142f;});})[_0x4a0b('0x21')](function(){_0x384223[_0x4a0b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x251e80,_0x1af485){return function(_0x334675){if(!_0x334675){_0x251e80[_0x4a0b('0x25')](0x194);}return _0x334675;};}function handleError(_0xa22eb1,_0x21c029){_0x21c029=_0x21c029||0x1f4;return function(_0x560b64){logger[_0x4a0b('0x26')](_0x560b64[_0x4a0b('0x27')]);if(_0x560b64[_0x4a0b('0x28')]){delete _0x560b64['name'];}_0xa22eb1['status'](_0x21c029)['send'](_0x560b64);};}exports[_0x4a0b('0x29')]=function(_0x18533c,_0x3ba51e){var _0x5b34c8={},_0x3ee9a7={},_0x451b69={'count':0x0,'rows':[]};var _0xf706db=_[_0x4a0b('0x2a')](db[_0x4a0b('0x2b')][_0x4a0b('0x2c')],function(_0x192d68){return{'name':_0x192d68[_0x4a0b('0x2d')],'type':_0x192d68['type'][_0x4a0b('0x2e')]};});_0x3ee9a7[_0x4a0b('0x2f')]=_[_0x4a0b('0x2a')](_0xf706db,_0x4a0b('0x28'));_0x3ee9a7[_0x4a0b('0x30')]=_[_0x4a0b('0x31')](_0x18533c['query']);_0x3ee9a7['filters']=_[_0x4a0b('0x32')](_0x3ee9a7['model'],_0x3ee9a7[_0x4a0b('0x30')]);_0x5b34c8[_0x4a0b('0x33')]=_['intersection'](_0x3ee9a7[_0x4a0b('0x2f')],qs[_0x4a0b('0x34')](_0x18533c[_0x4a0b('0x30')]['fields']));_0x5b34c8['attributes']=_0x5b34c8['attributes'][_0x4a0b('0x35')]?_0x5b34c8[_0x4a0b('0x33')]:_0x3ee9a7['model'];if(!_0x18533c['query']['hasOwnProperty'](_0x4a0b('0x36'))){_0x5b34c8[_0x4a0b('0x37')]=qs[_0x4a0b('0x37')](_0x18533c[_0x4a0b('0x30')][_0x4a0b('0x37')]);_0x5b34c8[_0x4a0b('0x18')]=qs[_0x4a0b('0x18')](_0x18533c[_0x4a0b('0x30')][_0x4a0b('0x18')]);}_0x5b34c8[_0x4a0b('0x38')]=qs['sort'](_0x18533c['query']['sort']);_0x5b34c8[_0x4a0b('0x39')]=qs['filters'](_[_0x4a0b('0x3a')](_0x18533c[_0x4a0b('0x30')],_0x3ee9a7[_0x4a0b('0x3b')]),_0xf706db);if(_0x18533c[_0x4a0b('0x30')][_0x4a0b('0x3c')]){_0x5b34c8[_0x4a0b('0x39')]=_['merge'](_0x5b34c8[_0x4a0b('0x39')],{'$or':_['map'](_0xf706db,function(_0x132080){if(_0x132080[_0x4a0b('0x3d')]!=='VIRTUAL'){var _0x31a92f={};_0x31a92f[_0x132080[_0x4a0b('0x28')]]={'$like':'%'+_0x18533c[_0x4a0b('0x30')][_0x4a0b('0x3c')]+'%'};return _0x31a92f;}})});}_0x5b34c8=_[_0x4a0b('0x3e')]({},_0x5b34c8,_0x18533c['options']);var _0x377288={'where':_0x5b34c8['where']};return db[_0x4a0b('0x2b')][_0x4a0b('0x1a')](_0x377288)[_0x4a0b('0x21')](function(_0x20378a){_0x451b69['count']=_0x20378a;if(_0x18533c[_0x4a0b('0x30')]['includeAll']){_0x5b34c8[_0x4a0b('0x3f')]=[{'all':!![]}];}return db[_0x4a0b('0x2b')][_0x4a0b('0x40')](_0x5b34c8);})['then'](function(_0x2ce869){_0x451b69[_0x4a0b('0x41')]=_0x2ce869;return _0x451b69;})[_0x4a0b('0x21')](respondWithFilteredResult(_0x3ba51e,_0x5b34c8))[_0x4a0b('0x42')](handleError(_0x3ba51e,null));};exports[_0x4a0b('0x43')]=function(_0x171ab6,_0x575778){var _0x444b02={'raw':!![],'where':{'id':_0x171ab6[_0x4a0b('0x44')]['id']}},_0x3afc53={};_0x3afc53[_0x4a0b('0x2f')]=_[_0x4a0b('0x31')](db[_0x4a0b('0x2b')][_0x4a0b('0x2c')]);_0x3afc53['query']=_['keys'](_0x171ab6[_0x4a0b('0x30')]);_0x3afc53[_0x4a0b('0x3b')]=_[_0x4a0b('0x32')](_0x3afc53[_0x4a0b('0x2f')],_0x3afc53[_0x4a0b('0x30')]);_0x444b02[_0x4a0b('0x33')]=_['intersection'](_0x3afc53[_0x4a0b('0x2f')],qs[_0x4a0b('0x34')](_0x171ab6['query'][_0x4a0b('0x34')]));_0x444b02[_0x4a0b('0x33')]=_0x444b02[_0x4a0b('0x33')][_0x4a0b('0x35')]?_0x444b02[_0x4a0b('0x33')]:_0x3afc53[_0x4a0b('0x2f')];if(_0x171ab6[_0x4a0b('0x30')][_0x4a0b('0x45')]){_0x444b02[_0x4a0b('0x3f')]=[{'all':!![]}];}_0x444b02=_[_0x4a0b('0x3e')]({},_0x444b02,_0x171ab6['options']);return db['Interval'][_0x4a0b('0x46')](_0x444b02)[_0x4a0b('0x21')](handleEntityNotFound(_0x575778,null))[_0x4a0b('0x21')](respondWithResult(_0x575778,null))[_0x4a0b('0x42')](handleError(_0x575778,null));};exports[_0x4a0b('0x47')]=function(_0x3a945b,_0x185d90){return db[_0x4a0b('0x2b')][_0x4a0b('0x47')](_0x3a945b['body'],{})[_0x4a0b('0x21')](function(_0x58e74a){var _0x5b0203=_0x3a945b[_0x4a0b('0x48')]['get']({'plain':!![]});if(!_0x5b0203)throw new Error(_0x4a0b('0x49'));if(_0x5b0203['role']===_0x4a0b('0x48')){var _0x1261d1=_0x58e74a[_0x4a0b('0x22')]({'plain':!![]});var _0xb84cda=_0x4a0b('0x23');return db['UserProfileSection'][_0x4a0b('0x46')]({'where':{'name':_0xb84cda,'userProfileId':_0x5b0203[_0x4a0b('0x4a')]},'raw':!![]})['then'](function(_0x1cfc25){if(_0x1cfc25&&_0x1cfc25[_0x4a0b('0x4b')]===0x0){return db[_0x4a0b('0x24')][_0x4a0b('0x47')]({'name':_0x1261d1[_0x4a0b('0x28')],'resourceId':_0x1261d1['id'],'type':_0x1cfc25[_0x4a0b('0x28')],'sectionId':_0x1cfc25['id']},{})[_0x4a0b('0x21')](function(){return _0x58e74a;});}else{return _0x58e74a;}})[_0x4a0b('0x42')](function(_0x55946e){logger['error'](_0x4a0b('0x4c'),_0x55946e);throw _0x55946e;});}return _0x58e74a;})['then'](respondWithResult(_0x185d90,0xc9))[_0x4a0b('0x42')](handleError(_0x185d90,null));};exports[_0x4a0b('0x4d')]=function(_0x199a47,_0x1b6830){if(_0x199a47['body']['id']){delete _0x199a47[_0x4a0b('0x4e')]['id'];}return db[_0x4a0b('0x2b')][_0x4a0b('0x46')]({'where':{'id':_0x199a47[_0x4a0b('0x44')]['id']}})[_0x4a0b('0x21')](handleEntityNotFound(_0x1b6830,null))['then'](saveUpdates(_0x199a47[_0x4a0b('0x4e')],null))[_0x4a0b('0x21')](respondWithResult(_0x1b6830,null))[_0x4a0b('0x42')](handleError(_0x1b6830,null));};exports[_0x4a0b('0x20')]=function(_0x3ce30b,_0x309a95){return db[_0x4a0b('0x2b')][_0x4a0b('0x46')]({'where':{'id':_0x3ce30b[_0x4a0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x309a95,null))['then'](removeEntity(_0x309a95,null))[_0x4a0b('0x42')](handleError(_0x309a95,null));};exports[_0x4a0b('0x4f')]=function(_0x342bf1,_0x481057,_0x5562d7){if(_0x342bf1[_0x4a0b('0x4e')]['id']){delete _0x342bf1[_0x4a0b('0x4e')]['id'];}return db[_0x4a0b('0x2b')]['find']({'where':{'id':_0x342bf1[_0x4a0b('0x44')]['id']}})[_0x4a0b('0x21')](handleEntityNotFound(_0x481057,null))['then'](function(_0x28ea7b){if(_0x28ea7b){_0x342bf1[_0x4a0b('0x4e')]['IntervalId']=_0x28ea7b['id'];return db[_0x4a0b('0x2b')][_0x4a0b('0x47')](_0x342bf1['body']);}})[_0x4a0b('0x21')](respondWithResult(_0x481057,null))[_0x4a0b('0x42')](handleError(_0x481057,null));};exports[_0x4a0b('0x50')]=function(_0x1e9f50,_0xca5cb6,_0x537951){var _0x33054c={};var _0x2e42f0={};var _0x637d29;var _0xbb945b;return db['Interval']['findOne']({'where':{'id':_0x1e9f50[_0x4a0b('0x44')]['id']}})[_0x4a0b('0x21')](handleEntityNotFound(_0xca5cb6,null))['then'](function(_0x4c7a77){if(_0x4c7a77){_0x637d29=_0x4c7a77;_0x2e42f0[_0x4a0b('0x2f')]=_[_0x4a0b('0x31')](db['Interval'][_0x4a0b('0x2c')]);_0x2e42f0[_0x4a0b('0x30')]=_[_0x4a0b('0x31')](_0x1e9f50[_0x4a0b('0x30')]);_0x2e42f0[_0x4a0b('0x3b')]=_[_0x4a0b('0x32')](_0x2e42f0[_0x4a0b('0x2f')],_0x2e42f0[_0x4a0b('0x30')]);_0x33054c[_0x4a0b('0x33')]=_[_0x4a0b('0x32')](_0x2e42f0[_0x4a0b('0x2f')],qs[_0x4a0b('0x34')](_0x1e9f50[_0x4a0b('0x30')][_0x4a0b('0x34')]));_0x33054c['attributes']=_0x33054c['attributes'][_0x4a0b('0x35')]?_0x33054c[_0x4a0b('0x33')]:_0x2e42f0[_0x4a0b('0x2f')];_0x33054c[_0x4a0b('0x38')]=qs[_0x4a0b('0x51')](_0x1e9f50[_0x4a0b('0x30')][_0x4a0b('0x51')]);_0x33054c['where']=qs[_0x4a0b('0x3b')](_[_0x4a0b('0x3a')](_0x1e9f50[_0x4a0b('0x30')],_0x2e42f0[_0x4a0b('0x3b')]));if(_0x1e9f50['query']['filter']){_0x33054c[_0x4a0b('0x39')]=_[_0x4a0b('0x3e')](_0x33054c[_0x4a0b('0x39')],{'$or':_['map'](_0x33054c[_0x4a0b('0x33')],function(_0x596c9d){var _0x1f2a2c={};_0x1f2a2c[_0x596c9d]={'$like':'%'+_0x1e9f50['query'][_0x4a0b('0x3c')]+'%'};return _0x1f2a2c;})});}_0x33054c=_[_0x4a0b('0x3e')]({},_0x33054c,_0x1e9f50[_0x4a0b('0x52')]);return _0x637d29['getIntervals'](_0x33054c);}})[_0x4a0b('0x21')](function(_0x23fc07){if(_0x23fc07){_0xbb945b=_0x23fc07[_0x4a0b('0x35')];if(!_0x1e9f50[_0x4a0b('0x30')][_0x4a0b('0x53')](_0x4a0b('0x36'))){_0x33054c[_0x4a0b('0x37')]=qs[_0x4a0b('0x37')](_0x1e9f50[_0x4a0b('0x30')]['limit']);_0x33054c[_0x4a0b('0x18')]=qs['offset'](_0x1e9f50[_0x4a0b('0x30')][_0x4a0b('0x18')]);}return _0x637d29['getIntervals'](_0x33054c);}})['then'](function(_0x19d225){if(_0x19d225){return _0x19d225?{'count':_0xbb945b,'rows':_0x19d225}:null;}})[_0x4a0b('0x21')](respondWithResult(_0xca5cb6,null))['catch'](handleError(_0xca5cb6,null));};exports['addIntervals']=function(_0x421577,_0x355f69,_0x128fc2){return db[_0x4a0b('0x2b')][_0x4a0b('0x54')]({'where':{'id':_0x421577[_0x4a0b('0x44')]['id']}})['then'](handleEntityNotFound(_0x355f69,null))[_0x4a0b('0x21')](function(_0x284318){if(_0x284318){return db[_0x4a0b('0x55')][_0x4a0b('0x56')](function(_0x4267ef){return db[_0x4a0b('0x2b')][_0x4a0b('0x20')]({'where':{'IntervalId':_0x421577['params']['id']},'transaction':_0x4267ef})[_0x4a0b('0x21')](function(_0x5e7dab){var _0x5a83b2=_[_0x4a0b('0x2a')](_0x421577[_0x4a0b('0x4e')],function(_0x2c15c2){delete _0x2c15c2['id'];_0x2c15c2[_0x4a0b('0x57')]=_0x421577[_0x4a0b('0x44')]['id'];return _0x2c15c2;});return db[_0x4a0b('0x2b')][_0x4a0b('0x58')](_0x5a83b2,{'transaction':_0x4267ef});});})['then'](function(){return db[_0x4a0b('0x2b')]['findAll']({'where':{'IntervalId':_0x421577['params']['id']}});});}})[_0x4a0b('0x21')](respondWithResult(_0x355f69,null))[_0x4a0b('0x42')](handleError(_0x355f69,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 23503eb..88eecb9 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 _0x3b50=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','Interval','tools_intervals','rewrite','lodash','../../config/logger','api'];(function(_0x592307,_0x2b8719){var _0x244eb8=function(_0x3e7c78){while(--_0x3e7c78){_0x592307['push'](_0x592307['shift']());}};_0x244eb8(++_0x2b8719);}(_0x3b50,0x65));var _0x03b5=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x3b50[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x03b5('0x0'));var util=require('util');var logger=require(_0x03b5('0x1'))(_0x03b5('0x2'));var moment=require('moment');var BPromise=require(_0x03b5('0x3'));var rp=require(_0x03b5('0x4'));var fs=require('fs');var path=require(_0x03b5('0x5'));var rimraf=require(_0x03b5('0x6'));var config=require(_0x03b5('0x7'));var attributes=require(_0x03b5('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x03b5('0x9')]=function(_0x288028,_0x1e723c){return _0x288028['define'](_0x03b5('0xa'),attributes,{'tableName':_0x03b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dca8b,_0x2214d0){extensions[_0x03b5('0xc')](_0x288028,_0x4dca8b);},'afterBulkCreate':function(_0x2bb45f,_0x2fb696,_0x40cde5){_0x40cde5();extensions[_0x03b5('0xc')](_0x288028,_0x2bb45f[0x0]);},'afterUpdate':function(_0x52cee8,_0x2de8bc){extensions[_0x03b5('0xc')](_0x288028,_0x52cee8);},'afterDestroy':function(_0x2db3a1,_0x497c72){extensions[_0x03b5('0xc')](_0x288028,_0x2db3a1);}}});}; \ No newline at end of file +var _0x18d4=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x18d4,0x19e));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x418d('0x0'));var util=require(_0x418d('0x1'));var logger=require(_0x418d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x418d('0x3'));var rp=require(_0x418d('0x4'));var fs=require('fs');var path=require(_0x418d('0x5'));var rimraf=require(_0x418d('0x6'));var config=require(_0x418d('0x7'));var attributes=require(_0x418d('0x8'));var extensions=require(_0x418d('0x9'));module[_0x418d('0xa')]=function(_0x27e1c0,_0x1cae40){return _0x27e1c0[_0x418d('0xb')](_0x418d('0xc'),attributes,{'tableName':_0x418d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x152235,_0xf39286){extensions[_0x418d('0xe')](_0x27e1c0,_0x152235);},'afterBulkCreate':function(_0x32ee36,_0x1da37c,_0x36d694){_0x36d694();extensions[_0x418d('0xe')](_0x27e1c0,_0x32ee36[0x0]);},'afterUpdate':function(_0x3754bf,_0x520a5a){extensions[_0x418d('0xe')](_0x27e1c0,_0x3754bf);},'afterDestroy':function(_0xe209c2,_0x2dd065){extensions[_0x418d('0xe')](_0x27e1c0,_0xe209c2);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index af76be3..a9667b0 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0082166..9b34740 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x23f125,_0x4eaa92){var _0x29d7ab=function(_0x92bebf){while(--_0x92bebf){_0x23f125['push'](_0x23f125['shift']());}};_0x29d7ab(++_0x4eaa92);}(_0x2032,0xd9));var _0x2203=function(_0x3177d4,_0x54b38a){_0x3177d4=_0x3177d4-0x0;var _0xe37a47=_0x2032[_0x3177d4];return _0xe37a47;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x26e12b,_0x70f458){var _0x970c8a=function(_0xb7fd32){while(--_0xb7fd32){_0x26e12b['push'](_0x26e12b['shift']());}};_0x970c8a(++_0x70f458);}(_0xdb28,0x106));var _0x8db2=function(_0x203ca1,_0x513dc6){_0x203ca1=_0x203ca1-0x0;var _0x38fcf8=_0xdb28[_0x203ca1];return _0x38fcf8;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 87ed7fe..3069689 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 _0x8211=['3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','parse','error','json','api.jira','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','https','../../config/logger','api','support'];(function(_0x325301,_0x4bdcc5){var _0x221adb=function(_0xfc40f1){while(--_0xfc40f1){_0x325301['push'](_0x325301['shift']());}};_0x221adb(++_0x4bdcc5);}(_0x8211,0x80));var _0x1821=function(_0xf052b9,_0x514d44){_0xf052b9=_0xf052b9-0x0;var _0x15793b=_0x8211[_0xf052b9];return _0x15793b;};'use strict';var BPromise=require('bluebird');var https=require(_0x1821('0x0'));var logger=require(_0x1821('0x1'))(_0x1821('0x2'));var USERNAME=_0x1821('0x3');var PASSWORD=_0x1821('0x4');function openIssue(_0xa8f48d,_0x3afea2){var _0x4b0c51={'fields':{'project':{'key':_0xa8f48d[_0x1821('0x5')]||'MOTGUI'},'summary':(_0xa8f48d[_0x1821('0x6')]||_0x1821('0x7'))+_0x1821('0x8')+_0xa8f48d['ip'],'description':_0xa8f48d[_0x1821('0x9')]||JSON[_0x1821('0xa')](_0xa8f48d),'issuetype':{'name':_0xa8f48d['issuetype']||_0x1821('0xb')}}};_0x4b0c51[_0x1821('0xc')]['customfield_11500']=_0xa8f48d[_0x1821('0xd')];_0x4b0c51[_0x1821('0xc')][_0x1821('0xe')]=_0xa8f48d[_0x1821('0xf')];_0x4b0c51[_0x1821('0xc')]['customfield_11502']=_0xa8f48d[_0x1821('0x10')];_0x4b0c51[_0x1821('0xc')][_0x1821('0x11')]=_0xa8f48d[_0x1821('0x12')];_0x4b0c51[_0x1821('0xc')][_0x1821('0x13')]=_0xa8f48d[_0x1821('0x14')];_0x4b0c51[_0x1821('0xc')][_0x1821('0x15')]=_0xa8f48d['ip'];var _0x1185a3={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x1821('0x16'),'method':_0x1821('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1821('0x18'),'Authorization':_0x1821('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1821('0x1a')](_0x1821('0x1b'))}};var _0x19532f=JSON['stringify'](_0x4b0c51);var _0x5ba94c=https[_0x1821('0x1c')](_0x1185a3,function(_0x310a64){_0x310a64['setEncoding'](_0x1821('0x1d'));var _0x33c218='';_0x310a64['on'](_0x1821('0x1e'),function(_0x2eb9b4){_0x33c218+=_0x2eb9b4;});_0x310a64['on'](_0x1821('0x1f'),function(){if(_0x3afea2){return _0x3afea2[_0x1821('0x20')](_0x310a64['statusCode'])['json'](JSON[_0x1821('0x21')](_0x33c218));}});});_0x5ba94c['on'](_0x1821('0x22'),function(_0xedb2ce){if(_0x3afea2){return _0x3afea2['status'](0x1f4)[_0x1821('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x1821('0x24')}]});}});_0x5ba94c['write'](_0x19532f);_0x5ba94c[_0x1821('0x1f')]();}exports[_0x1821('0x25')]=openIssue;exports[_0x1821('0x26')]=function(_0x33b834,_0x4cb96c){_0x33b834[_0x1821('0x27')]['ip']=_0x33b834[_0x1821('0x28')][_0x1821('0x29')]||_0x33b834['connection'][_0x1821('0x2a')]||_0x33b834[_0x1821('0x2b')][_0x1821('0x2a')]||_0x33b834['connection'][_0x1821('0x2b')][_0x1821('0x2a')];return openIssue(_0x33b834['body'],_0x4cb96c);}; \ No newline at end of file +var _0x0c35=['error','api.jira','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','issuetype','Bug','email','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end','json','parse'];(function(_0x43c541,_0x4168a8){var _0x8c4785=function(_0x33c0f1){while(--_0x33c0f1){_0x43c541['push'](_0x43c541['shift']());}};_0x8c4785(++_0x4168a8);}(_0x0c35,0x1a2));var _0x50c3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0c35[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x50c3('0x0'));var https=require(_0x50c3('0x1'));var logger=require(_0x50c3('0x2'))(_0x50c3('0x3'));var USERNAME='support';var PASSWORD=_0x50c3('0x4');function openIssue(_0x1e4d47,_0x555ccf){var _0x3b0f94={'fields':{'project':{'key':_0x1e4d47[_0x50c3('0x5')]||_0x50c3('0x6')},'summary':(_0x1e4d47[_0x50c3('0x7')]||'Report')+'\x20from\x20'+_0x1e4d47['ip'],'description':_0x1e4d47['description']||JSON['stringify'](_0x1e4d47),'issuetype':{'name':_0x1e4d47[_0x50c3('0x8')]||_0x50c3('0x9')}}};_0x3b0f94['fields']['customfield_11500']=_0x1e4d47[_0x50c3('0xa')];_0x3b0f94['fields']['customfield_11501']=_0x1e4d47[_0x50c3('0xb')];_0x3b0f94[_0x50c3('0xc')][_0x50c3('0xd')]=_0x1e4d47[_0x50c3('0xe')];_0x3b0f94[_0x50c3('0xc')][_0x50c3('0xf')]=_0x1e4d47[_0x50c3('0x10')];_0x3b0f94[_0x50c3('0xc')][_0x50c3('0x11')]=_0x1e4d47[_0x50c3('0x12')];_0x3b0f94[_0x50c3('0xc')][_0x50c3('0x13')]=_0x1e4d47['ip'];var _0x59f352={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x50c3('0x14'),'method':_0x50c3('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x50c3('0x16'),'Authorization':_0x50c3('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x50c3('0x18')](_0x50c3('0x19'))}};var _0x1e1f7a=JSON[_0x50c3('0x1a')](_0x3b0f94);var _0x10484e=https['request'](_0x59f352,function(_0x29bbba){_0x29bbba[_0x50c3('0x1b')](_0x50c3('0x1c'));var _0x59b788='';_0x29bbba['on'](_0x50c3('0x1d'),function(_0x4860ac){_0x59b788+=_0x4860ac;});_0x29bbba['on'](_0x50c3('0x1e'),function(){if(_0x555ccf){return _0x555ccf['status'](_0x29bbba['statusCode'])[_0x50c3('0x1f')](JSON[_0x50c3('0x20')](_0x59b788));}});});_0x10484e['on'](_0x50c3('0x21'),function(_0x26bcf4){if(_0x555ccf){return _0x555ccf['status'](0x1f4)[_0x50c3('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x50c3('0x22')}]});}});_0x10484e['write'](_0x1e1f7a);_0x10484e[_0x50c3('0x1e')]();}exports[_0x50c3('0x23')]=openIssue;exports['send']=function(_0x10f7e3,_0x29c2bb){_0x10f7e3[_0x50c3('0x24')]['ip']=_0x10f7e3[_0x50c3('0x25')][_0x50c3('0x26')]||_0x10f7e3['connection'][_0x50c3('0x27')]||_0x10f7e3[_0x50c3('0x28')][_0x50c3('0x27')]||_0x10f7e3['connection'][_0x50c3('0x28')][_0x50c3('0x27')];return openIssue(_0x10f7e3[_0x50c3('0x24')],_0x29c2bb);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 29edcfb..0fb1c02 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 _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x326430,_0x2f15b2){var _0x26abe8=function(_0x362978){while(--_0x362978){_0x326430['push'](_0x326430['shift']());}};_0x26abe8(++_0x2f15b2);}(_0x99e9,0xb4));var _0x999e=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x99e9[_0xda501a];return _0x44be3a;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file +var _0x153f=['Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x221a0d,_0x13d575){var _0x24daed=function(_0x42713d){while(--_0x42713d){_0x221a0d['push'](_0x221a0d['shift']());}};_0x24daed(++_0x13d575);}(_0x153f,0x15b));var _0xf153=function(_0x386663,_0x4e236a){_0x386663=_0x386663-0x0;var _0x429c51=_0x153f[_0x386663];return _0x429c51;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('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 e8c0ff3..daff20e 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x3b39ee,_0x1472ee){_0x3b39ee=_0x3b39ee-0x0;var _0x1069ba=_0x7a54[_0x3b39ee];return _0x1069ba;};'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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x2314b5,_0x3aa590){_0x2314b5=_0x2314b5-0x0;var _0x2cf785=_0x7a54[_0x2314b5];return _0x2cf785;};'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 0c4c2a6..707b850 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 _0x3f27=['body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','map','JscriptyAnswerReport','fieldName','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','keys','include','find','catch'];(function(_0x2a17a3,_0x53793b){var _0x1a4646=function(_0x1b9a40){while(--_0x1b9a40){_0x2a17a3['push'](_0x2a17a3['shift']());}};_0x1a4646(++_0x53793b);}(_0x3f27,0x1f4));var _0x73f2=function(_0x4893ce,_0x4fa81b){_0x4893ce=_0x4893ce-0x0;var _0x19debd=_0x3f27[_0x4893ce];return _0x19debd;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['index']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={},_0x21b18={},_0x1a23a4={'count':0x0,'rows':[]};var _0x15a367=_[_0x73f2('0x27')](db[_0x73f2('0x28')]['rawAttributes'],function(_0x3add12){return{'name':_0x3add12[_0x73f2('0x29')],'type':_0x3add12['type']['key']};});_0x21b18[_0x73f2('0x2a')]=_[_0x73f2('0x27')](_0x15a367,_0x73f2('0x25'));_0x21b18['query']=_['keys'](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2b')](_0x21b18['model'],_0x21b18[_0x73f2('0x2c')]);_0x4a90ac[_0x73f2('0x2d')]=_[_0x73f2('0x2b')](_0x21b18[_0x73f2('0x2a')],qs['fields'](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x2e')]));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac['attributes'][_0x73f2('0x2f')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18[_0x73f2('0x2a')];if(!_0x2840f0['query'][_0x73f2('0x30')](_0x73f2('0x31'))){_0x4a90ac[_0x73f2('0x1a')]=qs[_0x73f2('0x1a')](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x1a')]);_0x4a90ac[_0x73f2('0x18')]=qs[_0x73f2('0x18')](_0x2840f0[_0x73f2('0x2c')]['offset']);}_0x4a90ac['order']=qs['sort'](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x32')]);_0x4a90ac[_0x73f2('0x33')]=qs['filters'](_[_0x73f2('0x34')](_0x2840f0[_0x73f2('0x2c')],_0x21b18[_0x73f2('0x35')]),_0x15a367);if(_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x36')]){_0x4a90ac['where']=_[_0x73f2('0x37')](_0x4a90ac[_0x73f2('0x33')],{'$or':_[_0x73f2('0x27')](_0x15a367,function(_0x42e3b5){if(_0x42e3b5[_0x73f2('0x38')]!==_0x73f2('0x39')){var _0x551018={};_0x551018[_0x42e3b5[_0x73f2('0x25')]]={'$like':'%'+_0x2840f0['query'][_0x73f2('0x36')]+'%'};return _0x551018;}})});}_0x4a90ac=_[_0x73f2('0x37')]({},_0x4a90ac,_0x2840f0[_0x73f2('0x3a')]);var _0x19fec4={'where':_0x4a90ac[_0x73f2('0x33')]};return db[_0x73f2('0x28')][_0x73f2('0x1b')](_0x19fec4)[_0x73f2('0x21')](function(_0x42f868){_0x1a23a4[_0x73f2('0x1b')]=_0x42f868;if(_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x3b')]){_0x4a90ac['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x73f2('0x3c')](_0x4a90ac);})['then'](function(_0x58a244){_0x1a23a4[_0x73f2('0x3d')]=_0x58a244;return _0x1a23a4;})[_0x73f2('0x21')](respondWithFilteredResult(_0xf0e828,_0x4a90ac))['catch'](handleError(_0xf0e828,null));};exports['show']=function(_0x3ab04d,_0x1f8640){var _0x37e9cc={'raw':!![],'where':{'id':_0x3ab04d[_0x73f2('0x3e')]['id']}},_0x211e04={};_0x211e04[_0x73f2('0x2a')]=_['keys'](db['JscriptyAnswerReport'][_0x73f2('0x3f')]);_0x211e04[_0x73f2('0x2c')]=_[_0x73f2('0x40')](_0x3ab04d['query']);_0x211e04[_0x73f2('0x35')]=_[_0x73f2('0x2b')](_0x211e04[_0x73f2('0x2a')],_0x211e04[_0x73f2('0x2c')]);_0x37e9cc['attributes']=_[_0x73f2('0x2b')](_0x211e04['model'],qs[_0x73f2('0x2e')](_0x3ab04d['query'][_0x73f2('0x2e')]));_0x37e9cc['attributes']=_0x37e9cc[_0x73f2('0x2d')][_0x73f2('0x2f')]?_0x37e9cc[_0x73f2('0x2d')]:_0x211e04[_0x73f2('0x2a')];if(_0x3ab04d[_0x73f2('0x2c')][_0x73f2('0x3b')]){_0x37e9cc[_0x73f2('0x41')]=[{'all':!![]}];}_0x37e9cc=_[_0x73f2('0x37')]({},_0x37e9cc,_0x3ab04d[_0x73f2('0x3a')]);return db['JscriptyAnswerReport'][_0x73f2('0x42')](_0x37e9cc)['then'](handleEntityNotFound(_0x1f8640,null))[_0x73f2('0x21')](respondWithResult(_0x1f8640,null))[_0x73f2('0x43')](handleError(_0x1f8640,null));};exports['create']=function(_0x5ccf8c,_0x3be20c){return db[_0x73f2('0x28')]['create'](_0x5ccf8c['body'],{})[_0x73f2('0x21')](respondWithResult(_0x3be20c,0xc9))['catch'](handleError(_0x3be20c,null));};exports[_0x73f2('0x20')]=function(_0x4f9dfd,_0xdcdc3b){if(_0x4f9dfd['body']['id']){delete _0x4f9dfd[_0x73f2('0x44')]['id'];}return db[_0x73f2('0x28')][_0x73f2('0x42')]({'where':{'id':_0x4f9dfd[_0x73f2('0x3e')]['id']}})['then'](handleEntityNotFound(_0xdcdc3b,null))[_0x73f2('0x21')](saveUpdates(_0x4f9dfd[_0x73f2('0x44')],null))['then'](respondWithResult(_0xdcdc3b,null))[_0x73f2('0x43')](handleError(_0xdcdc3b,null));};exports[_0x73f2('0x45')]=function(_0x5d5bba,_0x3b2874){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5d5bba[_0x73f2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b2874,null))[_0x73f2('0x21')](removeEntity(_0x3b2874,null))[_0x73f2('0x43')](handleError(_0x3b2874,null));};exports['describe']=function(_0x34ef66,_0x37b21a){return db[_0x73f2('0x28')][_0x73f2('0x46')]()['then'](respondWithResult(_0x37b21a,null))['catch'](handleError(_0x37b21a,null));}; \ No newline at end of file +var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x687b,0x14a));var _0xb687=function(_0x369a41,_0x5ed95c){_0x369a41=_0x369a41-0x0;var _0x16807d=_0x687b[_0x369a41];return _0x16807d;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['JscriptyAnswerReport'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index debf092..85aafe9 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 _0x4843=['path','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','api','moment','bluebird','request-promise'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4843,0x1b5));var _0x3484=function(_0x4c5d40,_0x22f09b){_0x4c5d40=_0x4c5d40-0x0;var _0x9760dc=_0x4843[_0x4c5d40];return _0x9760dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3484('0x0'));var moment=require(_0x3484('0x1'));var BPromise=require(_0x3484('0x2'));var rp=require(_0x3484('0x3'));var fs=require('fs');var path=require(_0x3484('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3484('0x5'));module[_0x3484('0x6')]=function(_0x52aec4,_0x2794a8){return _0x52aec4[_0x3484('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0x3484('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x305a=['JscriptyAnswerReport','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0xaf2c0d,_0x39086c){var _0x119747=function(_0x1bba74){while(--_0x1bba74){_0xaf2c0d['push'](_0xaf2c0d['shift']());}};_0x119747(++_0x39086c);}(_0x305a,0xc1));var _0xa305=function(_0x346c02,_0x1007f7){_0x346c02=_0x346c02-0x0;var _0x48eaf0=_0x305a[_0x346c02];return _0x48eaf0;};'use strict';var _=require('lodash');var util=require(_0xa305('0x0'));var logger=require(_0xa305('0x1'))(_0xa305('0x2'));var moment=require('moment');var BPromise=require(_0xa305('0x3'));var rp=require(_0xa305('0x4'));var fs=require('fs');var path=require(_0xa305('0x5'));var rimraf=require(_0xa305('0x6'));var config=require(_0xa305('0x7'));var attributes=require(_0xa305('0x8'));module[_0xa305('0x9')]=function(_0x3cbbf2,_0x5e14da){return _0x3cbbf2[_0xa305('0xa')](_0xa305('0xb'),attributes,{'tableName':'report_jscripty_answers','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 3841ea3..1951530 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 _0xf5ed=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x32d6a0,_0x2af7da){var _0x327fe9=function(_0x5590fb){while(--_0x5590fb){_0x32d6a0['push'](_0x32d6a0['shift']());}};_0x327fe9(++_0x2af7da);}(_0xf5ed,0x72));var _0xdf5e=function(_0x121695,_0x1385d3){_0x121695=_0x121695-0x0;var _0x236b6c=_0xf5ed[_0x121695];return _0x236b6c;};'use strict';var _=require(_0xdf5e('0x0'));var util=require(_0xdf5e('0x1'));var moment=require(_0xdf5e('0x2'));var BPromise=require(_0xdf5e('0x3'));var rs=require(_0xdf5e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf5e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf5e('0x6'))(_0xdf5e('0x7'));var config=require(_0xdf5e('0x8'));var jayson=require(_0xdf5e('0x9'));var client=jayson[_0xdf5e('0xa')][_0xdf5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b93dc,_0x2a8735,_0xa0bd52){return new BPromise(function(_0x2c3456,_0x508bf7){return client[_0xdf5e('0xc')](_0x3b93dc,_0xa0bd52)['then'](function(_0x12fcf3){logger[_0xdf5e('0xd')](_0xdf5e('0xe'),_0x2a8735,_0xdf5e('0xf'));logger['debug'](_0xdf5e('0x10'),_0x2a8735,'request\x20sent',JSON['stringify'](_0x12fcf3));if(_0x12fcf3[_0xdf5e('0x11')]){if(_0x12fcf3[_0xdf5e('0x11')][_0xdf5e('0x12')]===0x1f4){logger[_0xdf5e('0x11')](_0xdf5e('0xe'),_0x2a8735,_0x12fcf3[_0xdf5e('0x11')][_0xdf5e('0x13')]);return _0x508bf7(_0x12fcf3[_0xdf5e('0x11')][_0xdf5e('0x13')]);}logger[_0xdf5e('0x11')](_0xdf5e('0xe'),_0x2a8735,_0x12fcf3[_0xdf5e('0x11')][_0xdf5e('0x13')]);return _0x2c3456(_0x12fcf3[_0xdf5e('0x11')][_0xdf5e('0x13')]);}else{logger['info'](_0xdf5e('0xe'),_0x2a8735,_0xdf5e('0xf'));_0x2c3456(_0x12fcf3[_0xdf5e('0x14')][_0xdf5e('0x13')]);}})[_0xdf5e('0x15')](function(_0x4b4c95){logger['error'](_0xdf5e('0xe'),_0x2a8735,_0x4b4c95);_0x508bf7(_0x4b4c95);});});} \ No newline at end of file +var _0xd5ff=['error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x146d9c,_0x26b538){var _0x550850=function(_0x2f4145){while(--_0x2f4145){_0x146d9c['push'](_0x146d9c['shift']());}};_0x550850(++_0x26b538);}(_0xd5ff,0xc1));var _0xfd5f=function(_0x26f27b,_0xcb9588){_0x26f27b=_0x26f27b-0x0;var _0x241805=_0xd5ff[_0x26f27b];return _0x241805;};'use strict';var _=require('lodash');var util=require(_0xfd5f('0x0'));var moment=require(_0xfd5f('0x1'));var BPromise=require(_0xfd5f('0x2'));var rs=require(_0xfd5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd5f('0x4'))['db'];var utils=require(_0xfd5f('0x5'));var logger=require(_0xfd5f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd5f('0x7'));var client=jayson['client'][_0xfd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23ce09,_0x255cad,_0x23f7e5){return new BPromise(function(_0xb93398,_0x21c010){return client[_0xfd5f('0x9')](_0x23ce09,_0x23f7e5)[_0xfd5f('0xa')](function(_0x4bfa1e){logger[_0xfd5f('0xb')](_0xfd5f('0xc'),_0x255cad,_0xfd5f('0xd'));logger[_0xfd5f('0xe')](_0xfd5f('0xf'),_0x255cad,_0xfd5f('0xd'),JSON[_0xfd5f('0x10')](_0x4bfa1e));if(_0x4bfa1e[_0xfd5f('0x11')]){if(_0x4bfa1e[_0xfd5f('0x11')]['code']===0x1f4){logger[_0xfd5f('0x11')](_0xfd5f('0xc'),_0x255cad,_0x4bfa1e['error'][_0xfd5f('0x12')]);return _0x21c010(_0x4bfa1e[_0xfd5f('0x11')][_0xfd5f('0x12')]);}logger[_0xfd5f('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x255cad,_0x4bfa1e[_0xfd5f('0x11')][_0xfd5f('0x12')]);return _0xb93398(_0x4bfa1e['error'][_0xfd5f('0x12')]);}else{logger[_0xfd5f('0xb')](_0xfd5f('0xc'),_0x255cad,_0xfd5f('0xd'));_0xb93398(_0x4bfa1e[_0xfd5f('0x13')][_0xfd5f('0x12')]);}})[_0xfd5f('0x14')](function(_0x464ede){logger[_0xfd5f('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x255cad,_0x464ede);_0x21c010(_0x464ede);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7807184..4ce909e 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 _0x7b71=['./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','getAnswers','/:id/summary','30s','post','create','clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment'];(function(_0x13274e,_0x4408c0){var _0x2ffe1b=function(_0x3891f4){while(--_0x3891f4){_0x13274e['push'](_0x13274e['shift']());}};_0x2ffe1b(++_0x4408c0);}(_0x7b71,0x69));var _0x17b7=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x7b71[_0x213518];return _0x1baf75;};'use strict';var multer=require('multer');var util=require(_0x17b7('0x0'));var path=require(_0x17b7('0x1'));var timeout=require(_0x17b7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x17b7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x17b7('0x4'));var controller=require(_0x17b7('0x5'));router[_0x17b7('0x6')]('/',auth[_0x17b7('0x7')](),controller[_0x17b7('0x8')]);router[_0x17b7('0x6')]('/:id',auth[_0x17b7('0x7')](),controller['show']);router[_0x17b7('0x6')](_0x17b7('0x9'),auth[_0x17b7('0x7')](),controller['getSessions']);router['get']('/:id/answers',auth[_0x17b7('0x7')](),controller[_0x17b7('0xa')]);router['get'](_0x17b7('0xb'),auth[_0x17b7('0x7')](),timeout(_0x17b7('0xc')),controller['getSummary']);router[_0x17b7('0xd')]('/',auth[_0x17b7('0x7')](),controller[_0x17b7('0xe')]);router['post']('/:id/clone',auth[_0x17b7('0x7')](),controller[_0x17b7('0xf')]);router[_0x17b7('0x10')](_0x17b7('0x11'),auth[_0x17b7('0x7')](),controller[_0x17b7('0x12')]);router[_0x17b7('0x13')](_0x17b7('0x11'),auth[_0x17b7('0x7')](),controller[_0x17b7('0x14')]);module[_0x17b7('0x15')]=router; \ No newline at end of file +var _0x5d12=['isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','/:id/clone','clone','put','/:id','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d12,0x155));var _0x25d1=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x5d12[_0x36884e];return _0x1cc367;};'use strict';var multer=require('multer');var util=require(_0x25d1('0x0'));var path=require(_0x25d1('0x1'));var timeout=require(_0x25d1('0x2'));var express=require(_0x25d1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x25d1('0x4'));var interaction=require(_0x25d1('0x5'));var config=require(_0x25d1('0x6'));var controller=require(_0x25d1('0x7'));router[_0x25d1('0x8')]('/',auth[_0x25d1('0x9')](),controller[_0x25d1('0xa')]);router[_0x25d1('0x8')]('/:id',auth[_0x25d1('0x9')](),controller[_0x25d1('0xb')]);router[_0x25d1('0x8')](_0x25d1('0xc'),auth[_0x25d1('0x9')](),controller[_0x25d1('0xd')]);router[_0x25d1('0x8')](_0x25d1('0xe'),auth[_0x25d1('0x9')](),controller[_0x25d1('0xf')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x25d1('0x10')),controller['getSummary']);router[_0x25d1('0x11')]('/',auth[_0x25d1('0x9')](),controller['create']);router['post'](_0x25d1('0x12'),auth[_0x25d1('0x9')](),controller[_0x25d1('0x13')]);router[_0x25d1('0x14')](_0x25d1('0x15'),auth['isAuthenticated'](),controller[_0x25d1('0x16')]);router[_0x25d1('0x17')](_0x25d1('0x15'),auth[_0x25d1('0x9')](),controller[_0x25d1('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7fbd8a0..cecfa77 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 _0x2d6f=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d6f,0xc8));var _0xf2d6=function(_0x2350f3,_0x408ae9){_0x2350f3=_0x2350f3-0x0;var _0x456ba0=_0x2d6f[_0x2350f3];return _0x456ba0;};'use strict';var Sequelize=require(_0xf2d6('0x0'));var _=require(_0xf2d6('0x1'));var util=require(_0xf2d6('0x2'));module[_0xf2d6('0x3')]={'name':{'type':Sequelize[_0xf2d6('0x4')],'unique':_0xf2d6('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xf2d6('0x6')](_0xf2d6('0x7')),'set':function(_0x3a411c){if(_[_0xf2d6('0x8')](_0x3a411c)){this[_0xf2d6('0x9')](_0xf2d6('0xa'),JSON[_0xf2d6('0xb')](_0x3a411c));}else if(_[_0xf2d6('0xc')](_0x3a411c)){this['setDataValue']('formData',_0x3a411c);}else{this[_0xf2d6('0x9')](_0xf2d6('0xa'),util[_0xf2d6('0xd')](_0xf2d6('0xe'),this['getDataValue'](_0xf2d6('0x5'))||'',this[_0xf2d6('0xf')](_0xf2d6('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf2d6('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf2d6('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0xe172=['getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0xe172,0x18a));var _0x2e17=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xe172[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x2e17('0x0'));var _=require(_0x2e17('0x1'));var util=require(_0x2e17('0x2'));module[_0x2e17('0x3')]={'name':{'type':Sequelize[_0x2e17('0x4')],'unique':_0x2e17('0x5')},'description':{'type':Sequelize[_0x2e17('0x4')]},'formData':{'type':Sequelize[_0x2e17('0x6')](_0x2e17('0x7')),'set':function(_0x2acab4){if(_[_0x2e17('0x8')](_0x2acab4)){this[_0x2e17('0x9')]('formData',JSON['stringify'](_0x2acab4));}else if(_[_0x2e17('0xa')](_0x2acab4)){this[_0x2e17('0x9')](_0x2e17('0xb'),_0x2acab4);}else{this[_0x2e17('0x9')]('formData',util[_0x2e17('0xc')](_0x2e17('0xd'),this[_0x2e17('0xe')]('name')||'',this[_0x2e17('0xe')](_0x2e17('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2e17('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 894276a..e7ab7c6 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 _0x8769=['getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','role','user','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','UserProfileSection','userProfileId'];(function(_0x2d8fdb,_0x30e70c){var _0x3bc1c2=function(_0x592716){while(--_0x592716){_0x2d8fdb['push'](_0x2d8fdb['shift']());}};_0x3bc1c2(++_0x30e70c);}(_0x8769,0x110));var _0x9876=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8769[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x9876('0x0'));var rimraf=require(_0x9876('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9876('0x2'));var rp=require('request-promise');var moment=require(_0x9876('0x3'));var BPromise=require(_0x9876('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9876('0x5'));var sox=require(_0x9876('0x6'));var csv=require('to-csv');var ejs=require(_0x9876('0x7'));var fs=require('fs');var fs_extra=require(_0x9876('0x8'));var _=require('lodash');var squel=require(_0x9876('0x9'));var crypto=require(_0x9876('0xa'));var jsforce=require(_0x9876('0xb'));var deskjs=require(_0x9876('0xc'));var toCsv=require(_0x9876('0xd'));var querystring=require(_0x9876('0xe'));var Papa=require(_0x9876('0xf'));var Redis=require(_0x9876('0x10'));var authService=require(_0x9876('0x11'));var qs=require(_0x9876('0x12'));var as=require(_0x9876('0x13'));var hardwareService=require(_0x9876('0x14'));var logger=require(_0x9876('0x15'))(_0x9876('0x16'));var utils=require(_0x9876('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9876('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6a6def,_0x34a45a){_0x34a45a=_0x34a45a||0xcc;return function(_0x5485f7){if(_0x5485f7){return _0x6a6def['sendStatus'](_0x34a45a);}return _0x6a6def[_0x9876('0x19')](_0x34a45a)['end']();};}function respondWithResult(_0x427cce,_0x39644e){_0x39644e=_0x39644e||0xc8;return function(_0xce611){if(_0xce611){return _0x427cce[_0x9876('0x19')](_0x39644e)['json'](_0xce611);}};}function respondWithFilteredResult(_0x2a2303,_0x3152a1){return function(_0x2ccd1a){if(_0x2ccd1a){var _0x1ae2e8=typeof _0x3152a1[_0x9876('0x1a')]===_0x9876('0x1b')&&typeof _0x3152a1[_0x9876('0x1c')]===_0x9876('0x1b');var _0x1cdf63=_0x2ccd1a[_0x9876('0x1d')];var _0x5754ed=_0x1ae2e8?0x0:_0x3152a1[_0x9876('0x1a')];var _0x1239ba=_0x1ae2e8?_0x2ccd1a['count']:_0x3152a1[_0x9876('0x1a')]+_0x3152a1[_0x9876('0x1c')];var _0x6d7c94;if(_0x1239ba>=_0x1cdf63){_0x1239ba=_0x1cdf63;_0x6d7c94=0xc8;}else{_0x6d7c94=0xce;}_0x2a2303[_0x9876('0x19')](_0x6d7c94);return _0x2a2303[_0x9876('0x1e')](_0x9876('0x1f'),_0x5754ed+'-'+_0x1239ba+'/'+_0x1cdf63)['json'](_0x2ccd1a);}return null;};}function patchUpdates(_0x1adb6d){return function(_0x2a9b4f){try{jsonpatch[_0x9876('0x20')](_0x2a9b4f,_0x1adb6d,!![]);}catch(_0x2336e6){return BPromise[_0x9876('0x21')](_0x2336e6);}return _0x2a9b4f[_0x9876('0x22')]();};}function saveUpdates(_0x18f0c6,_0x31d167){return function(_0x3b7000){if(_0x3b7000){return _0x3b7000[_0x9876('0x23')](_0x18f0c6)[_0x9876('0x24')](function(_0x4bc9e5){return _0x4bc9e5;});}return null;};}function removeEntity(_0x262d79,_0x34b17a){return function(_0x5626e3){if(_0x5626e3){return _0x5626e3[_0x9876('0x25')]()[_0x9876('0x24')](function(){var _0x1bdee1=_0x5626e3[_0x9876('0x26')]({'plain':!![]});var _0x330507=_0x9876('0x27');return db[_0x9876('0x28')][_0x9876('0x25')]({'where':{'type':_0x330507,'resourceId':_0x1bdee1['id']}})[_0x9876('0x24')](function(){return _0x5626e3;});})[_0x9876('0x24')](function(){_0x262d79[_0x9876('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39bb68,_0x229a6a){return function(_0x5065ba){if(!_0x5065ba){_0x39bb68[_0x9876('0x29')](0x194);}return _0x5065ba;};}function handleError(_0x57dcd5,_0x5dc415){_0x5dc415=_0x5dc415||0x1f4;return function(_0x134b97){logger[_0x9876('0x2a')](_0x134b97[_0x9876('0x2b')]);if(_0x134b97['name']){delete _0x134b97[_0x9876('0x2c')];}_0x57dcd5['status'](_0x5dc415)[_0x9876('0x2d')](_0x134b97);};}exports['index']=function(_0x157806,_0x4ff142){var _0x1487f7={},_0x37537a={},_0x189420={'count':0x0,'rows':[]};var _0x508485=_[_0x9876('0x2e')](db[_0x9876('0x2f')][_0x9876('0x30')],function(_0x598bde){return{'name':_0x598bde[_0x9876('0x31')],'type':_0x598bde['type'][_0x9876('0x32')]};});_0x37537a['model']=_['map'](_0x508485,'name');_0x37537a[_0x9876('0x33')]=_[_0x9876('0x34')](_0x157806['query']);_0x37537a[_0x9876('0x35')]=_[_0x9876('0x36')](_0x37537a[_0x9876('0x37')],_0x37537a[_0x9876('0x33')]);_0x1487f7[_0x9876('0x38')]=_[_0x9876('0x36')](_0x37537a[_0x9876('0x37')],qs['fields'](_0x157806[_0x9876('0x33')]['fields']));_0x1487f7[_0x9876('0x38')]=_0x1487f7[_0x9876('0x38')][_0x9876('0x39')]?_0x1487f7[_0x9876('0x38')]:_0x37537a[_0x9876('0x37')];if(!_0x157806['query'][_0x9876('0x3a')](_0x9876('0x3b'))){_0x1487f7[_0x9876('0x1c')]=qs['limit'](_0x157806[_0x9876('0x33')]['limit']);_0x1487f7[_0x9876('0x1a')]=qs['offset'](_0x157806['query'][_0x9876('0x1a')]);}_0x1487f7['order']=qs[_0x9876('0x3c')](_0x157806[_0x9876('0x33')]['sort']);_0x1487f7[_0x9876('0x3d')]=qs[_0x9876('0x35')](_[_0x9876('0x3e')](_0x157806[_0x9876('0x33')],_0x37537a[_0x9876('0x35')]),_0x508485);if(_0x157806[_0x9876('0x33')][_0x9876('0x3f')]){_0x1487f7[_0x9876('0x3d')]=_[_0x9876('0x40')](_0x1487f7[_0x9876('0x3d')],{'$or':_[_0x9876('0x2e')](_0x508485,function(_0x20eff3){if(_0x20eff3[_0x9876('0x41')]!==_0x9876('0x42')){var _0x20e4e6={};_0x20e4e6[_0x20eff3[_0x9876('0x2c')]]={'$like':'%'+_0x157806[_0x9876('0x33')][_0x9876('0x3f')]+'%'};return _0x20e4e6;}})});}_0x1487f7=_[_0x9876('0x40')]({},_0x1487f7,_0x157806[_0x9876('0x43')]);var _0x36c52d={'where':_0x1487f7['where']};return db[_0x9876('0x2f')][_0x9876('0x1d')](_0x36c52d)[_0x9876('0x24')](function(_0x215684){_0x189420[_0x9876('0x1d')]=_0x215684;if(_0x157806['query']['includeAll']){_0x1487f7[_0x9876('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x9876('0x45')](_0x1487f7);})[_0x9876('0x24')](function(_0x2564a9){_0x189420['rows']=_0x2564a9;return _0x189420;})[_0x9876('0x24')](respondWithFilteredResult(_0x4ff142,_0x1487f7))[_0x9876('0x46')](handleError(_0x4ff142,null));};exports[_0x9876('0x47')]=function(_0x9baad3,_0x377e60){var _0x5f5501={'raw':![],'where':{'id':_0x9baad3[_0x9876('0x48')]['id']}},_0x1cddf1={};_0x1cddf1[_0x9876('0x37')]=_['keys'](db[_0x9876('0x2f')][_0x9876('0x30')]);_0x1cddf1[_0x9876('0x33')]=_[_0x9876('0x34')](_0x9baad3[_0x9876('0x33')]);_0x1cddf1[_0x9876('0x35')]=_[_0x9876('0x36')](_0x1cddf1[_0x9876('0x37')],_0x1cddf1[_0x9876('0x33')]);_0x5f5501['attributes']=_[_0x9876('0x36')](_0x1cddf1[_0x9876('0x37')],qs[_0x9876('0x49')](_0x9baad3[_0x9876('0x33')][_0x9876('0x49')]));_0x5f5501[_0x9876('0x38')]=_0x5f5501[_0x9876('0x38')][_0x9876('0x39')]?_0x5f5501[_0x9876('0x38')]:_0x1cddf1[_0x9876('0x37')];if(_0x9baad3[_0x9876('0x33')][_0x9876('0x4a')]){_0x5f5501[_0x9876('0x44')]=[{'all':!![]}];}_0x5f5501=_['merge']({},_0x5f5501,_0x9baad3[_0x9876('0x43')]);return db['JscriptyProject']['find'](_0x5f5501)['then'](handleEntityNotFound(_0x377e60,null))[_0x9876('0x24')](respondWithResult(_0x377e60,null))[_0x9876('0x46')](handleError(_0x377e60,null));};exports['create']=function(_0x31e6bc,_0x446c94){return db[_0x9876('0x2f')]['create'](_0x31e6bc['body'],{})[_0x9876('0x24')](function(_0x4229c3){var _0x4297a3=_0x31e6bc['user'][_0x9876('0x26')]({'plain':!![]});if(!_0x4297a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4297a3[_0x9876('0x4b')]===_0x9876('0x4c')){var _0x38a946=_0x4229c3[_0x9876('0x26')]({'plain':!![]});var _0x121126=_0x9876('0x27');return db['UserProfileSection'][_0x9876('0x4d')]({'where':{'name':_0x121126,'userProfileId':_0x4297a3['userProfileId']},'raw':!![]})[_0x9876('0x24')](function(_0x532b90){if(_0x532b90&&_0x532b90[_0x9876('0x4e')]===0x0){return db[_0x9876('0x28')][_0x9876('0x4f')]({'name':_0x38a946[_0x9876('0x2c')],'resourceId':_0x38a946['id'],'type':_0x532b90[_0x9876('0x2c')],'sectionId':_0x532b90['id']},{})[_0x9876('0x24')](function(){return _0x4229c3;});}else{return _0x4229c3;}})[_0x9876('0x46')](function(_0x49aa32){logger[_0x9876('0x2a')](_0x9876('0x50'),_0x49aa32);throw _0x49aa32;});}return _0x4229c3;})[_0x9876('0x24')](respondWithResult(_0x446c94,0xc9))[_0x9876('0x46')](handleError(_0x446c94,null));};exports[_0x9876('0x51')]=function(_0x202f80,_0x2b4cbc){var _0x3ec7bb={'where':{'id':_0x202f80[_0x9876('0x48')]['id']}},_0x50b428={};_0x50b428[_0x9876('0x37')]=_[_0x9876('0x34')](db[_0x9876('0x2f')][_0x9876('0x30')]);_0x3ec7bb[_0x9876('0x38')]=_[_0x9876('0x36')](_0x50b428[_0x9876('0x37')],qs['fields'](_0x202f80['query'][_0x9876('0x49')]));_0x3ec7bb['attributes']=_0x3ec7bb[_0x9876('0x38')]['length']?_0x3ec7bb[_0x9876('0x38')]:_0x50b428['model'];if(_0x202f80[_0x9876('0x33')]['includeAll']){_0x3ec7bb['include']=[{'all':!![]}];}_0x3ec7bb=_['merge']({},_0x3ec7bb,_0x202f80['options']);return db[_0x9876('0x2f')][_0x9876('0x4d')](_0x3ec7bb)['then'](handleEntityNotFound(_0x2b4cbc,null))[_0x9876('0x24')](function(_0x3900d7){if(_0x3900d7){var _0x35a3a3=_0x3900d7[_0x9876('0x26')]({'plain':!![]});_0x35a3a3=qs[_0x9876('0x52')](_0x35a3a3,['id',_0x9876('0x53'),_0x9876('0x54')]);_0x202f80[_0x9876('0x55')]=_[_0x9876('0x52')](_0x202f80[_0x9876('0x55')],['id','createdAt',_0x9876('0x54')]);return db[_0x9876('0x2f')][_0x9876('0x4f')](_[_0x9876('0x40')](_0x35a3a3,_0x202f80[_0x9876('0x55')]),{'include':_0x202f80[_0x9876('0x33')][_0x9876('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x1c3b0a){var _0xf4a4f4=_0x202f80[_0x9876('0x4c')][_0x9876('0x26')]({'plain':!![]});if(!_0xf4a4f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4a4f4[_0x9876('0x4b')]===_0x9876('0x4c')){var _0x25ab46=_0x1c3b0a['get']({'plain':!![]});var _0x3fae22=_0x9876('0x27');return db[_0x9876('0x56')][_0x9876('0x4d')]({'where':{'name':_0x3fae22,'userProfileId':_0xf4a4f4[_0x9876('0x57')]},'raw':!![]})[_0x9876('0x24')](function(_0x5b5076){if(_0x5b5076&&_0x5b5076[_0x9876('0x4e')]===0x0){return db[_0x9876('0x28')][_0x9876('0x4f')]({'name':_0x25ab46[_0x9876('0x2c')],'resourceId':_0x25ab46['id'],'type':_0x5b5076[_0x9876('0x2c')],'sectionId':_0x5b5076['id']},{})[_0x9876('0x24')](function(){return _0x1c3b0a;});}else{return _0x1c3b0a;}})[_0x9876('0x46')](function(_0x421cd5){logger[_0x9876('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x421cd5);throw _0x421cd5;});}return _0x1c3b0a;});}})['then'](respondWithResult(_0x2b4cbc,0xc9))[_0x9876('0x46')](handleError(_0x2b4cbc,null));};exports[_0x9876('0x23')]=function(_0x565f72,_0x3a892f){if(_0x565f72[_0x9876('0x55')]['id']){delete _0x565f72[_0x9876('0x55')]['id'];}return db['JscriptyProject'][_0x9876('0x4d')]({'where':{'id':_0x565f72[_0x9876('0x48')]['id']}})[_0x9876('0x24')](handleEntityNotFound(_0x3a892f,null))[_0x9876('0x24')](saveUpdates(_0x565f72['body'],null))[_0x9876('0x24')](respondWithResult(_0x3a892f,null))[_0x9876('0x46')](handleError(_0x3a892f,null));};exports['destroy']=function(_0x3dbec6,_0x4f669e){return db[_0x9876('0x2f')][_0x9876('0x4d')]({'where':{'id':_0x3dbec6[_0x9876('0x48')]['id']}})[_0x9876('0x24')](handleEntityNotFound(_0x4f669e,null))[_0x9876('0x24')](removeEntity(_0x4f669e,null))['catch'](handleError(_0x4f669e,null));};exports[_0x9876('0x58')]=function(_0x610a64,_0x4f06f3,_0x1d5c8f){var _0x54ab2e={'raw':!![],'where':{}};var _0x5c9c6f={};var _0x262bae={'count':0x0,'rows':[]};return db[_0x9876('0x2f')][_0x9876('0x59')]({'where':{'id':_0x610a64[_0x9876('0x48')]['id']}})[_0x9876('0x24')](handleEntityNotFound(_0x4f06f3,null))['then'](function(_0x3848be){if(_0x3848be){_0x5c9c6f[_0x9876('0x37')]=_[_0x9876('0x34')](db[_0x9876('0x5a')][_0x9876('0x30')]);_0x5c9c6f[_0x9876('0x33')]=_[_0x9876('0x34')](_0x610a64[_0x9876('0x33')]);_0x5c9c6f[_0x9876('0x35')]=_['intersection'](_0x5c9c6f[_0x9876('0x37')],_0x5c9c6f[_0x9876('0x33')]);_0x54ab2e[_0x9876('0x38')]=_[_0x9876('0x36')](_0x5c9c6f[_0x9876('0x37')],qs[_0x9876('0x49')](_0x610a64[_0x9876('0x33')][_0x9876('0x49')]));_0x54ab2e[_0x9876('0x38')]=_0x54ab2e['attributes'][_0x9876('0x39')]?_0x54ab2e[_0x9876('0x38')]:_0x5c9c6f[_0x9876('0x37')];if(!_0x610a64['query'][_0x9876('0x3a')](_0x9876('0x3b'))){_0x54ab2e[_0x9876('0x1c')]=qs[_0x9876('0x1c')](_0x610a64[_0x9876('0x33')]['limit']);_0x54ab2e['offset']=qs[_0x9876('0x1a')](_0x610a64[_0x9876('0x33')]['offset']);}_0x54ab2e[_0x9876('0x5b')]=qs['sort'](_0x610a64['query']['sort']);_0x54ab2e[_0x9876('0x3d')]=qs[_0x9876('0x35')](_[_0x9876('0x3e')](_0x610a64[_0x9876('0x33')],_0x5c9c6f[_0x9876('0x35')]));_0x54ab2e[_0x9876('0x3d')][_0x9876('0x5c')]=_0x3848be['id'];if(_0x610a64['query'][_0x9876('0x3f')]){_0x54ab2e[_0x9876('0x3d')]=_[_0x9876('0x40')](_0x54ab2e[_0x9876('0x3d')],{'$or':_[_0x9876('0x2e')](_0x54ab2e[_0x9876('0x38')],function(_0x5630ed){var _0x3fd80e={};_0x3fd80e[_0x5630ed]={'$like':'%'+_0x610a64[_0x9876('0x33')][_0x9876('0x3f')]+'%'};return _0x3fd80e;})});}_0x54ab2e=_[_0x9876('0x40')]({},_0x54ab2e,_0x610a64['options']);return db['JscriptySessionReport'][_0x9876('0x1d')]({'where':_0x54ab2e[_0x9876('0x3d')]})[_0x9876('0x24')](function(_0x1cab5d){_0x262bae[_0x9876('0x1d')]=_0x1cab5d;if(_0x610a64[_0x9876('0x33')]['includeAll']){_0x54ab2e[_0x9876('0x44')]=[{'all':!![]}];}return db[_0x9876('0x5a')][_0x9876('0x45')](_0x54ab2e);})[_0x9876('0x24')](function(_0x30388a){_0x262bae[_0x9876('0x5d')]=_0x30388a;return _0x262bae;});}})['then'](respondWithFilteredResult(_0x4f06f3,_0x54ab2e))[_0x9876('0x46')](handleError(_0x4f06f3,null));};exports[_0x9876('0x5e')]=function(_0x478209,_0x46c39e,_0x2fc14a){var _0x14fe6e={'raw':!![],'where':{}};var _0x3cbd71={};var _0x3a290a={'count':0x0,'rows':[]};return db[_0x9876('0x2f')][_0x9876('0x59')]({'where':{'id':_0x478209[_0x9876('0x48')]['id']}})['then'](handleEntityNotFound(_0x46c39e,null))[_0x9876('0x24')](function(_0x4ac244){if(_0x4ac244){_0x3cbd71[_0x9876('0x37')]=_[_0x9876('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x3cbd71[_0x9876('0x33')]=_[_0x9876('0x34')](_0x478209['query']);_0x3cbd71[_0x9876('0x35')]=_[_0x9876('0x36')](_0x3cbd71[_0x9876('0x37')],_0x3cbd71['query']);_0x14fe6e[_0x9876('0x38')]=_[_0x9876('0x36')](_0x3cbd71['model'],qs[_0x9876('0x49')](_0x478209[_0x9876('0x33')][_0x9876('0x49')]));_0x14fe6e[_0x9876('0x38')]=_0x14fe6e[_0x9876('0x38')]['length']?_0x14fe6e[_0x9876('0x38')]:_0x3cbd71['model'];if(!_0x478209[_0x9876('0x33')]['hasOwnProperty'](_0x9876('0x3b'))){_0x14fe6e[_0x9876('0x1c')]=qs['limit'](_0x478209[_0x9876('0x33')][_0x9876('0x1c')]);_0x14fe6e[_0x9876('0x1a')]=qs[_0x9876('0x1a')](_0x478209['query']['offset']);}_0x14fe6e[_0x9876('0x5b')]=qs[_0x9876('0x3c')](_0x478209[_0x9876('0x33')][_0x9876('0x3c')]);_0x14fe6e[_0x9876('0x3d')]=qs[_0x9876('0x35')](_[_0x9876('0x3e')](_0x478209['query'],_0x3cbd71[_0x9876('0x35')]));_0x14fe6e[_0x9876('0x3d')][_0x9876('0x5c')]=_0x4ac244['id'];if(_0x478209[_0x9876('0x33')]['filter']){_0x14fe6e[_0x9876('0x3d')]=_['merge'](_0x14fe6e['where'],{'$or':_[_0x9876('0x2e')](_0x14fe6e[_0x9876('0x38')],function(_0x6f876){var _0x51e9bd={};_0x51e9bd[_0x6f876]={'$like':'%'+_0x478209[_0x9876('0x33')][_0x9876('0x3f')]+'%'};return _0x51e9bd;})});}_0x14fe6e=_['merge']({},_0x14fe6e,_0x478209['options']);return db[_0x9876('0x5f')][_0x9876('0x1d')]({'where':_0x14fe6e[_0x9876('0x3d')]})['then'](function(_0x5b710a){_0x3a290a[_0x9876('0x1d')]=_0x5b710a;if(_0x478209[_0x9876('0x33')][_0x9876('0x4a')]){_0x14fe6e['include']=[{'all':!![]}];}return db[_0x9876('0x5f')][_0x9876('0x45')](_0x14fe6e);})['then'](function(_0x59b3c6){_0x3a290a[_0x9876('0x5d')]=_0x59b3c6;return _0x3a290a;});}})[_0x9876('0x24')](respondWithFilteredResult(_0x46c39e,_0x14fe6e))[_0x9876('0x46')](handleError(_0x46c39e,null));};function char(_0x490310){return _0x9876('0x60')===typeof _0x490310?String[_0x9876('0x61')][_0x9876('0x20')](null,arguments):_0x490310;}function needsEncapsulation(_0x24a927){return!!_0x24a927&&(_0x24a927[_0x9876('0x62')]()[_0x9876('0x63')](char(0xd))>=0x0||_0x24a927[_0x9876('0x62')]()[_0x9876('0x63')](char(0xa))>=0x0||_0x24a927['toString']()[_0x9876('0x63')](char(0x2c))>=0x0||_0x24a927[_0x9876('0x62')]()[_0x9876('0x63')](char(0x22))>=0x0);}function encapsulate(_0x38be86){var _0x40a155=char(0x22),_0x55d476='\x5c'+char(0x22),_0x244f31=_0x38be86[_0x9876('0x62')]()[_0x9876('0x64')](new RegExp(_0x40a155,'g'),_0x55d476);return _0x40a155+_0x244f31+_0x40a155;}exports[_0x9876('0x65')]=function(_0x1761d3,_0x58dce9,_0x49ab4a){var _0x12126e,_0x391532;var _0x39858a={'where':{'ProjectId':_0x1761d3['params']['id']}};if(_0x1761d3[_0x9876('0x33')]['startTime']){_0x39858a[_0x9876('0x3d')][_0x9876('0x66')]=JSON[_0x9876('0x67')](_0x1761d3[_0x9876('0x33')]['startTime']);}return db[_0x9876('0x5a')][_0x9876('0x45')](_0x39858a)[_0x9876('0x24')](handleEntityNotFound(_0x58dce9,null))[_0x9876('0x24')](function(_0x25394d){if(_0x25394d){_0x12126e=_0x25394d;return db['JscriptyQuestionReport'][_0x9876('0x45')]({'where':{'SessionId':{'$in':_[_0x9876('0x2e')](_0x12126e,'id')},'ProjectId':_0x1761d3[_0x9876('0x48')]['id']},'order':_0x9876('0x68')});}})[_0x9876('0x24')](handleEntityNotFound(_0x58dce9,null))[_0x9876('0x24')](function(_0x556c67){if(_0x556c67){_0x391532=_0x556c67;var _0x32b8d2={};for(var _0x5624e9=0x0,_0x3da74b=_0x391532[_0x9876('0x39')];_0x5624e9<_0x3da74b;_0x5624e9++){if(!_0x32b8d2['hasOwnProperty'](_0x391532[_0x5624e9]['questionId'])){_0x32b8d2[_0x391532[_0x5624e9][_0x9876('0x69')]]=needsEncapsulation(_0x391532[_0x5624e9][_0x9876('0x6a')])?encapsulate(_0x391532[_0x5624e9][_0x9876('0x6a')]):_0x391532[_0x5624e9]['question'];}}var _0x1c667c=[],_0x25f069={};for(var _0x442ed8=0x0,_0x2d9cb1=_0x12126e[_0x9876('0x39')];_0x442ed8<_0x2d9cb1;_0x442ed8++){_0x25f069={'ProjectId':_0x1761d3[_0x9876('0x48')]['id'],'SessionId':_0x12126e[_0x442ed8]['id'],'StartTime':moment(_0x12126e[_0x442ed8][_0x9876('0x66')])['format'](_0x9876('0x6b'))};for(var _0x4122d9=0x0,_0x5e8646=_0x391532[_0x9876('0x39')];_0x4122d9<_0x5e8646;_0x4122d9++){if(_0x391532[_0x4122d9][_0x9876('0x6c')]==_0x12126e[_0x442ed8]['id']&&_0x32b8d2['hasOwnProperty'](_0x391532[_0x4122d9][_0x9876('0x69')])){_0x25f069[_0x32b8d2[_0x391532[_0x4122d9][_0x9876('0x69')]]]=_0x391532[_0x4122d9]['answer'];}}for(var _0x59cf7b in _0x32b8d2){if(!_0x25f069[_0x9876('0x3a')](_0x32b8d2[_0x59cf7b])){_0x25f069[_0x32b8d2[_0x59cf7b]]=null;}}_0x1c667c['push'](_0x25f069);}return _0x1c667c;}})[_0x9876('0x24')](function(_0x411cf5){if(!_[_0x9876('0x6d')](_0x411cf5)){var _0x6c4323=toCsv(_0x411cf5);var _0x40e0f5=Date[_0x9876('0x6e')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1761d3['params']['id'],_0x40e0f5),_0x6c4323);_0x58dce9[_0x9876('0x6f')](_0x9876('0x70'),_0x9876('0x71')+util[_0x9876('0x72')](_0x9876('0x73'),_0x1761d3[_0x9876('0x48')]['id'],_0x40e0f5));_0x58dce9[_0x9876('0x6f')](_0x9876('0x74'),_0x9876('0x75'));return _0x58dce9[_0x9876('0x76')](util[_0x9876('0x72')](_0x9876('0x77'),_0x1761d3[_0x9876('0x48')]['id'],_0x40e0f5));}else{return _0x58dce9[_0x9876('0x29')](0xcc);}})[_0x9876('0x46')](handleError(_0x58dce9,null));}; \ No newline at end of file +var _0x88b5=['clone','params','omit','createdAt','updatedAt','Projects','hasOwnProperty','pick','ProjectId','JscriptySessionReport','findAll','getAnswers','findOne','JscriptyAnswerReport','rows','number','fromCharCode','toString','indexOf','getSummary','startTime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x727a91,_0x361602){var _0x337152=function(_0x5c7722){while(--_0x5c7722){_0x727a91['push'](_0x727a91['shift']());}};_0x337152(++_0x361602);}(_0x88b5,0x10f));var _0x588b=function(_0x3a5482,_0x1d583e){_0x3a5482=_0x3a5482-0x0;var _0x32f020=_0x88b5[_0x3a5482];return _0x32f020;};'use strict';var emlformat=require(_0x588b('0x0'));var rimraf=require(_0x588b('0x1'));var zipdir=require(_0x588b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x588b('0x3'));var moment=require(_0x588b('0x4'));var BPromise=require(_0x588b('0x5'));var Mustache=require(_0x588b('0x6'));var util=require(_0x588b('0x7'));var path=require(_0x588b('0x8'));var sox=require('sox');var csv=require(_0x588b('0x9'));var ejs=require(_0x588b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x588b('0xb'));var crypto=require(_0x588b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x588b('0xd'));var toCsv=require(_0x588b('0x9'));var querystring=require(_0x588b('0xe'));var Papa=require(_0x588b('0xf'));var Redis=require(_0x588b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x588b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x588b('0x12'));var utils=require(_0x588b('0x13'));var config=require(_0x588b('0x14'));var licenseUtil=require(_0x588b('0x15'));var db=require(_0x588b('0x16'))['db'];function respondWithStatusCode(_0x22ee1a,_0x3e360c){_0x3e360c=_0x3e360c||0xcc;return function(_0x4febe0){if(_0x4febe0){return _0x22ee1a[_0x588b('0x17')](_0x3e360c);}return _0x22ee1a[_0x588b('0x18')](_0x3e360c)[_0x588b('0x19')]();};}function respondWithResult(_0x2312e2,_0x6df6ab){_0x6df6ab=_0x6df6ab||0xc8;return function(_0x280fc4){if(_0x280fc4){return _0x2312e2[_0x588b('0x18')](_0x6df6ab)[_0x588b('0x1a')](_0x280fc4);}};}function respondWithFilteredResult(_0xe5e240,_0x18e45c){return function(_0x2efe87){if(_0x2efe87){var _0x414692=typeof _0x18e45c[_0x588b('0x1b')]==='undefined'&&typeof _0x18e45c['limit']===_0x588b('0x1c');var _0x2b9aae=_0x2efe87[_0x588b('0x1d')];var _0x2ef1a2=_0x414692?0x0:_0x18e45c[_0x588b('0x1b')];var _0x640e19=_0x414692?_0x2efe87['count']:_0x18e45c[_0x588b('0x1b')]+_0x18e45c[_0x588b('0x1e')];var _0x6851fd;if(_0x640e19>=_0x2b9aae){_0x640e19=_0x2b9aae;_0x6851fd=0xc8;}else{_0x6851fd=0xce;}_0xe5e240['status'](_0x6851fd);return _0xe5e240[_0x588b('0x1f')](_0x588b('0x20'),_0x2ef1a2+'-'+_0x640e19+'/'+_0x2b9aae)[_0x588b('0x1a')](_0x2efe87);}return null;};}function patchUpdates(_0x11bce3){return function(_0x1ec4a2){try{jsonpatch[_0x588b('0x21')](_0x1ec4a2,_0x11bce3,!![]);}catch(_0x2e17f0){return BPromise['reject'](_0x2e17f0);}return _0x1ec4a2[_0x588b('0x22')]();};}function saveUpdates(_0x4ed54d,_0x2bdeea){return function(_0x232c85){if(_0x232c85){return _0x232c85[_0x588b('0x23')](_0x4ed54d)[_0x588b('0x24')](function(_0x341802){return _0x341802;});}return null;};}function removeEntity(_0x17cfd4,_0x1a9675){return function(_0x445312){if(_0x445312){return _0x445312[_0x588b('0x25')]()[_0x588b('0x24')](function(){var _0x231ebd=_0x445312['get']({'plain':!![]});var _0x13885f='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x13885f,'resourceId':_0x231ebd['id']}})[_0x588b('0x24')](function(){return _0x445312;});})[_0x588b('0x24')](function(){_0x17cfd4[_0x588b('0x18')](0xcc)[_0x588b('0x19')]();});}};}function handleEntityNotFound(_0x524a94,_0x3aa95e){return function(_0x33dd0b){if(!_0x33dd0b){_0x524a94[_0x588b('0x17')](0x194);}return _0x33dd0b;};}function handleError(_0x4ea3bf,_0x15db0c){_0x15db0c=_0x15db0c||0x1f4;return function(_0x13f9c4){logger[_0x588b('0x26')](_0x13f9c4[_0x588b('0x27')]);if(_0x13f9c4[_0x588b('0x28')]){delete _0x13f9c4[_0x588b('0x28')];}_0x4ea3bf[_0x588b('0x18')](_0x15db0c)[_0x588b('0x29')](_0x13f9c4);};}exports['index']=function(_0xddef60,_0x13afeb){var _0x12dcb4={},_0x2b1a26={},_0x59a252={'count':0x0,'rows':[]};var _0x49fcfa=_[_0x588b('0x2a')](db[_0x588b('0x2b')][_0x588b('0x2c')],function(_0x45e54c){return{'name':_0x45e54c[_0x588b('0x2d')],'type':_0x45e54c[_0x588b('0x2e')]['key']};});_0x2b1a26[_0x588b('0x2f')]=_['map'](_0x49fcfa,_0x588b('0x28'));_0x2b1a26[_0x588b('0x30')]=_[_0x588b('0x31')](_0xddef60[_0x588b('0x30')]);_0x2b1a26[_0x588b('0x32')]=_[_0x588b('0x33')](_0x2b1a26[_0x588b('0x2f')],_0x2b1a26[_0x588b('0x30')]);_0x12dcb4[_0x588b('0x34')]=_['intersection'](_0x2b1a26[_0x588b('0x2f')],qs[_0x588b('0x35')](_0xddef60[_0x588b('0x30')][_0x588b('0x35')]));_0x12dcb4['attributes']=_0x12dcb4[_0x588b('0x34')][_0x588b('0x36')]?_0x12dcb4[_0x588b('0x34')]:_0x2b1a26['model'];if(!_0xddef60['query']['hasOwnProperty'](_0x588b('0x37'))){_0x12dcb4['limit']=qs['limit'](_0xddef60[_0x588b('0x30')][_0x588b('0x1e')]);_0x12dcb4[_0x588b('0x1b')]=qs[_0x588b('0x1b')](_0xddef60[_0x588b('0x30')][_0x588b('0x1b')]);}_0x12dcb4[_0x588b('0x38')]=qs[_0x588b('0x39')](_0xddef60['query'][_0x588b('0x39')]);_0x12dcb4[_0x588b('0x3a')]=qs[_0x588b('0x32')](_['pick'](_0xddef60[_0x588b('0x30')],_0x2b1a26[_0x588b('0x32')]),_0x49fcfa);if(_0xddef60['query'][_0x588b('0x3b')]){_0x12dcb4[_0x588b('0x3a')]=_[_0x588b('0x3c')](_0x12dcb4[_0x588b('0x3a')],{'$or':_['map'](_0x49fcfa,function(_0x5a612b){if(_0x5a612b[_0x588b('0x2e')]!==_0x588b('0x3d')){var _0x298b9b={};_0x298b9b[_0x5a612b[_0x588b('0x28')]]={'$like':'%'+_0xddef60[_0x588b('0x30')]['filter']+'%'};return _0x298b9b;}})});}_0x12dcb4=_[_0x588b('0x3c')]({},_0x12dcb4,_0xddef60[_0x588b('0x3e')]);var _0x469a56={'where':_0x12dcb4['where']};return db[_0x588b('0x2b')][_0x588b('0x1d')](_0x469a56)['then'](function(_0x36837e){_0x59a252['count']=_0x36837e;if(_0xddef60[_0x588b('0x30')][_0x588b('0x3f')]){_0x12dcb4[_0x588b('0x40')]=[{'all':!![]}];}return db[_0x588b('0x2b')]['findAll'](_0x12dcb4);})[_0x588b('0x24')](function(_0x33c77f){_0x59a252['rows']=_0x33c77f;return _0x59a252;})['then'](respondWithFilteredResult(_0x13afeb,_0x12dcb4))[_0x588b('0x41')](handleError(_0x13afeb,null));};exports['show']=function(_0x3715a6,_0x230747){var _0x428d0f={'raw':![],'where':{'id':_0x3715a6['params']['id']}},_0x18a9c2={};_0x18a9c2[_0x588b('0x2f')]=_['keys'](db[_0x588b('0x2b')]['rawAttributes']);_0x18a9c2[_0x588b('0x30')]=_[_0x588b('0x31')](_0x3715a6['query']);_0x18a9c2[_0x588b('0x32')]=_['intersection'](_0x18a9c2['model'],_0x18a9c2['query']);_0x428d0f[_0x588b('0x34')]=_[_0x588b('0x33')](_0x18a9c2[_0x588b('0x2f')],qs['fields'](_0x3715a6[_0x588b('0x30')][_0x588b('0x35')]));_0x428d0f[_0x588b('0x34')]=_0x428d0f[_0x588b('0x34')]['length']?_0x428d0f[_0x588b('0x34')]:_0x18a9c2[_0x588b('0x2f')];if(_0x3715a6[_0x588b('0x30')][_0x588b('0x3f')]){_0x428d0f[_0x588b('0x40')]=[{'all':!![]}];}_0x428d0f=_['merge']({},_0x428d0f,_0x3715a6[_0x588b('0x3e')]);return db[_0x588b('0x2b')][_0x588b('0x42')](_0x428d0f)[_0x588b('0x24')](handleEntityNotFound(_0x230747,null))[_0x588b('0x24')](respondWithResult(_0x230747,null))[_0x588b('0x41')](handleError(_0x230747,null));};exports[_0x588b('0x43')]=function(_0x4d0bb1,_0x59ca9c){return db[_0x588b('0x2b')][_0x588b('0x43')](_0x4d0bb1[_0x588b('0x44')],{})[_0x588b('0x24')](function(_0x30c404){var _0x9dbce4=_0x4d0bb1[_0x588b('0x45')]['get']({'plain':!![]});if(!_0x9dbce4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9dbce4[_0x588b('0x46')]===_0x588b('0x45')){var _0xf6109=_0x30c404[_0x588b('0x47')]({'plain':!![]});var _0x211053='Projects';return db[_0x588b('0x48')][_0x588b('0x42')]({'where':{'name':_0x211053,'userProfileId':_0x9dbce4[_0x588b('0x49')]},'raw':!![]})[_0x588b('0x24')](function(_0x2424cd){if(_0x2424cd&&_0x2424cd[_0x588b('0x4a')]===0x0){return db[_0x588b('0x4b')][_0x588b('0x43')]({'name':_0xf6109[_0x588b('0x28')],'resourceId':_0xf6109['id'],'type':_0x2424cd[_0x588b('0x28')],'sectionId':_0x2424cd['id']},{})[_0x588b('0x24')](function(){return _0x30c404;});}else{return _0x30c404;}})[_0x588b('0x41')](function(_0x1c5107){logger[_0x588b('0x26')](_0x588b('0x4c'),_0x1c5107);throw _0x1c5107;});}return _0x30c404;})[_0x588b('0x24')](respondWithResult(_0x59ca9c,0xc9))['catch'](handleError(_0x59ca9c,null));};exports[_0x588b('0x4d')]=function(_0x493fb4,_0x1c8432){var _0x34344c={'where':{'id':_0x493fb4[_0x588b('0x4e')]['id']}},_0x3dba5a={};_0x3dba5a[_0x588b('0x2f')]=_[_0x588b('0x31')](db[_0x588b('0x2b')][_0x588b('0x2c')]);_0x34344c[_0x588b('0x34')]=_['intersection'](_0x3dba5a['model'],qs[_0x588b('0x35')](_0x493fb4[_0x588b('0x30')][_0x588b('0x35')]));_0x34344c['attributes']=_0x34344c[_0x588b('0x34')]['length']?_0x34344c[_0x588b('0x34')]:_0x3dba5a[_0x588b('0x2f')];if(_0x493fb4[_0x588b('0x30')][_0x588b('0x3f')]){_0x34344c[_0x588b('0x40')]=[{'all':!![]}];}_0x34344c=_['merge']({},_0x34344c,_0x493fb4['options']);return db[_0x588b('0x2b')][_0x588b('0x42')](_0x34344c)[_0x588b('0x24')](handleEntityNotFound(_0x1c8432,null))[_0x588b('0x24')](function(_0x5766d8){if(_0x5766d8){var _0x3fb683=_0x5766d8[_0x588b('0x47')]({'plain':!![]});_0x3fb683=qs[_0x588b('0x4f')](_0x3fb683,['id',_0x588b('0x50'),_0x588b('0x51')]);_0x493fb4[_0x588b('0x44')]=_[_0x588b('0x4f')](_0x493fb4[_0x588b('0x44')],['id',_0x588b('0x50'),'updatedAt']);return db['JscriptyProject'][_0x588b('0x43')](_[_0x588b('0x3c')](_0x3fb683,_0x493fb4[_0x588b('0x44')]),{'include':_0x493fb4[_0x588b('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x588b('0x24')](function(_0x5efa86){var _0x37a0d2=_0x493fb4[_0x588b('0x45')][_0x588b('0x47')]({'plain':!![]});if(!_0x37a0d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37a0d2['role']===_0x588b('0x45')){var _0x3ea50d=_0x5efa86[_0x588b('0x47')]({'plain':!![]});var _0x2f447d=_0x588b('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x2f447d,'userProfileId':_0x37a0d2[_0x588b('0x49')]},'raw':!![]})[_0x588b('0x24')](function(_0x1ccbf2){if(_0x1ccbf2&&_0x1ccbf2[_0x588b('0x4a')]===0x0){return db[_0x588b('0x4b')]['create']({'name':_0x3ea50d[_0x588b('0x28')],'resourceId':_0x3ea50d['id'],'type':_0x1ccbf2[_0x588b('0x28')],'sectionId':_0x1ccbf2['id']},{})[_0x588b('0x24')](function(){return _0x5efa86;});}else{return _0x5efa86;}})[_0x588b('0x41')](function(_0x3de71e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de71e);throw _0x3de71e;});}return _0x5efa86;});}})['then'](respondWithResult(_0x1c8432,0xc9))[_0x588b('0x41')](handleError(_0x1c8432,null));};exports[_0x588b('0x23')]=function(_0x33455d,_0x5ee378){if(_0x33455d[_0x588b('0x44')]['id']){delete _0x33455d[_0x588b('0x44')]['id'];}return db[_0x588b('0x2b')][_0x588b('0x42')]({'where':{'id':_0x33455d[_0x588b('0x4e')]['id']}})[_0x588b('0x24')](handleEntityNotFound(_0x5ee378,null))[_0x588b('0x24')](saveUpdates(_0x33455d[_0x588b('0x44')],null))[_0x588b('0x24')](respondWithResult(_0x5ee378,null))[_0x588b('0x41')](handleError(_0x5ee378,null));};exports[_0x588b('0x25')]=function(_0x5747c4,_0x2ccd93){return db['JscriptyProject'][_0x588b('0x42')]({'where':{'id':_0x5747c4['params']['id']}})[_0x588b('0x24')](handleEntityNotFound(_0x2ccd93,null))[_0x588b('0x24')](removeEntity(_0x2ccd93,null))[_0x588b('0x41')](handleError(_0x2ccd93,null));};exports['getSessions']=function(_0x1b6589,_0x1c5c3e,_0x19522c){var _0x31dad3={'raw':!![],'where':{}};var _0xe2a5e4={};var _0x225be0={'count':0x0,'rows':[]};return db[_0x588b('0x2b')]['findOne']({'where':{'id':_0x1b6589[_0x588b('0x4e')]['id']}})[_0x588b('0x24')](handleEntityNotFound(_0x1c5c3e,null))[_0x588b('0x24')](function(_0x57d292){if(_0x57d292){_0xe2a5e4['model']=_[_0x588b('0x31')](db['JscriptySessionReport'][_0x588b('0x2c')]);_0xe2a5e4[_0x588b('0x30')]=_[_0x588b('0x31')](_0x1b6589[_0x588b('0x30')]);_0xe2a5e4[_0x588b('0x32')]=_[_0x588b('0x33')](_0xe2a5e4['model'],_0xe2a5e4['query']);_0x31dad3[_0x588b('0x34')]=_[_0x588b('0x33')](_0xe2a5e4[_0x588b('0x2f')],qs[_0x588b('0x35')](_0x1b6589['query'][_0x588b('0x35')]));_0x31dad3[_0x588b('0x34')]=_0x31dad3[_0x588b('0x34')][_0x588b('0x36')]?_0x31dad3[_0x588b('0x34')]:_0xe2a5e4[_0x588b('0x2f')];if(!_0x1b6589['query'][_0x588b('0x53')](_0x588b('0x37'))){_0x31dad3[_0x588b('0x1e')]=qs[_0x588b('0x1e')](_0x1b6589[_0x588b('0x30')][_0x588b('0x1e')]);_0x31dad3[_0x588b('0x1b')]=qs[_0x588b('0x1b')](_0x1b6589[_0x588b('0x30')][_0x588b('0x1b')]);}_0x31dad3[_0x588b('0x38')]=qs[_0x588b('0x39')](_0x1b6589['query'][_0x588b('0x39')]);_0x31dad3[_0x588b('0x3a')]=qs[_0x588b('0x32')](_[_0x588b('0x54')](_0x1b6589[_0x588b('0x30')],_0xe2a5e4[_0x588b('0x32')]));_0x31dad3['where'][_0x588b('0x55')]=_0x57d292['id'];if(_0x1b6589[_0x588b('0x30')][_0x588b('0x3b')]){_0x31dad3[_0x588b('0x3a')]=_[_0x588b('0x3c')](_0x31dad3[_0x588b('0x3a')],{'$or':_[_0x588b('0x2a')](_0x31dad3[_0x588b('0x34')],function(_0x100c16){var _0x3766c2={};_0x3766c2[_0x100c16]={'$like':'%'+_0x1b6589[_0x588b('0x30')][_0x588b('0x3b')]+'%'};return _0x3766c2;})});}_0x31dad3=_[_0x588b('0x3c')]({},_0x31dad3,_0x1b6589[_0x588b('0x3e')]);return db[_0x588b('0x56')][_0x588b('0x1d')]({'where':_0x31dad3[_0x588b('0x3a')]})[_0x588b('0x24')](function(_0x5c703d){_0x225be0['count']=_0x5c703d;if(_0x1b6589[_0x588b('0x30')][_0x588b('0x3f')]){_0x31dad3['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x588b('0x57')](_0x31dad3);})[_0x588b('0x24')](function(_0x3ee7ab){_0x225be0['rows']=_0x3ee7ab;return _0x225be0;});}})['then'](respondWithFilteredResult(_0x1c5c3e,_0x31dad3))[_0x588b('0x41')](handleError(_0x1c5c3e,null));};exports[_0x588b('0x58')]=function(_0x15d7f5,_0x50a7c4,_0x3fb6e3){var _0xbb9a84={'raw':!![],'where':{}};var _0x452f57={};var _0xcc3947={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x588b('0x59')]({'where':{'id':_0x15d7f5[_0x588b('0x4e')]['id']}})[_0x588b('0x24')](handleEntityNotFound(_0x50a7c4,null))[_0x588b('0x24')](function(_0x3e0f68){if(_0x3e0f68){_0x452f57['model']=_['keys'](db[_0x588b('0x5a')]['rawAttributes']);_0x452f57['query']=_[_0x588b('0x31')](_0x15d7f5[_0x588b('0x30')]);_0x452f57[_0x588b('0x32')]=_[_0x588b('0x33')](_0x452f57[_0x588b('0x2f')],_0x452f57[_0x588b('0x30')]);_0xbb9a84[_0x588b('0x34')]=_[_0x588b('0x33')](_0x452f57['model'],qs['fields'](_0x15d7f5['query'][_0x588b('0x35')]));_0xbb9a84[_0x588b('0x34')]=_0xbb9a84[_0x588b('0x34')]['length']?_0xbb9a84[_0x588b('0x34')]:_0x452f57[_0x588b('0x2f')];if(!_0x15d7f5[_0x588b('0x30')][_0x588b('0x53')](_0x588b('0x37'))){_0xbb9a84[_0x588b('0x1e')]=qs[_0x588b('0x1e')](_0x15d7f5[_0x588b('0x30')]['limit']);_0xbb9a84['offset']=qs['offset'](_0x15d7f5['query'][_0x588b('0x1b')]);}_0xbb9a84['order']=qs['sort'](_0x15d7f5[_0x588b('0x30')][_0x588b('0x39')]);_0xbb9a84[_0x588b('0x3a')]=qs['filters'](_['pick'](_0x15d7f5['query'],_0x452f57[_0x588b('0x32')]));_0xbb9a84[_0x588b('0x3a')]['ProjectId']=_0x3e0f68['id'];if(_0x15d7f5[_0x588b('0x30')][_0x588b('0x3b')]){_0xbb9a84[_0x588b('0x3a')]=_[_0x588b('0x3c')](_0xbb9a84[_0x588b('0x3a')],{'$or':_[_0x588b('0x2a')](_0xbb9a84[_0x588b('0x34')],function(_0x297a4f){var _0x31a785={};_0x31a785[_0x297a4f]={'$like':'%'+_0x15d7f5[_0x588b('0x30')][_0x588b('0x3b')]+'%'};return _0x31a785;})});}_0xbb9a84=_['merge']({},_0xbb9a84,_0x15d7f5[_0x588b('0x3e')]);return db[_0x588b('0x5a')][_0x588b('0x1d')]({'where':_0xbb9a84[_0x588b('0x3a')]})[_0x588b('0x24')](function(_0x557275){_0xcc3947[_0x588b('0x1d')]=_0x557275;if(_0x15d7f5[_0x588b('0x30')][_0x588b('0x3f')]){_0xbb9a84[_0x588b('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0xbb9a84);})['then'](function(_0x35da40){_0xcc3947[_0x588b('0x5b')]=_0x35da40;return _0xcc3947;});}})['then'](respondWithFilteredResult(_0x50a7c4,_0xbb9a84))[_0x588b('0x41')](handleError(_0x50a7c4,null));};function char(_0x3228a4){return _0x588b('0x5c')===typeof _0x3228a4?String[_0x588b('0x5d')][_0x588b('0x21')](null,arguments):_0x3228a4;}function needsEncapsulation(_0x16299c){return!!_0x16299c&&(_0x16299c[_0x588b('0x5e')]()[_0x588b('0x5f')](char(0xd))>=0x0||_0x16299c[_0x588b('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x16299c[_0x588b('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x16299c[_0x588b('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x561fc3){var _0x2ba3ce=char(0x22),_0x1293b6='\x5c'+char(0x22),_0x5bf75e=_0x561fc3['toString']()['replace'](new RegExp(_0x2ba3ce,'g'),_0x1293b6);return _0x2ba3ce+_0x5bf75e+_0x2ba3ce;}exports[_0x588b('0x60')]=function(_0x11408c,_0x112e57,_0x485efd){var _0x1e86b2,_0x4832b1;var _0x138535={'where':{'ProjectId':_0x11408c['params']['id']}};if(_0x11408c[_0x588b('0x30')][_0x588b('0x61')]){_0x138535['where']['starttime']=JSON[_0x588b('0x62')](_0x11408c['query']['startTime']);}return db[_0x588b('0x56')][_0x588b('0x57')](_0x138535)[_0x588b('0x24')](handleEntityNotFound(_0x112e57,null))[_0x588b('0x24')](function(_0x9a04a1){if(_0x9a04a1){_0x1e86b2=_0x9a04a1;return db['JscriptyQuestionReport'][_0x588b('0x57')]({'where':{'SessionId':{'$in':_[_0x588b('0x2a')](_0x1e86b2,'id')},'ProjectId':_0x11408c['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x112e57,null))[_0x588b('0x24')](function(_0x317acd){if(_0x317acd){_0x4832b1=_0x317acd;var _0xffe55c={};for(var _0x424467=0x0,_0x17cea0=_0x4832b1[_0x588b('0x36')];_0x424467<_0x17cea0;_0x424467++){if(!_0xffe55c[_0x588b('0x53')](_0x4832b1[_0x424467][_0x588b('0x63')])){_0xffe55c[_0x4832b1[_0x424467][_0x588b('0x63')]]=needsEncapsulation(_0x4832b1[_0x424467][_0x588b('0x64')])?encapsulate(_0x4832b1[_0x424467][_0x588b('0x64')]):_0x4832b1[_0x424467][_0x588b('0x64')];}}var _0x49cbfb=[],_0x3fea39={};for(var _0x2159f2=0x0,_0x2d7ae5=_0x1e86b2['length'];_0x2159f2<_0x2d7ae5;_0x2159f2++){_0x3fea39={'ProjectId':_0x11408c[_0x588b('0x4e')]['id'],'SessionId':_0x1e86b2[_0x2159f2]['id'],'StartTime':moment(_0x1e86b2[_0x2159f2]['starttime'])[_0x588b('0x65')](_0x588b('0x66'))};for(var _0x1c1d57=0x0,_0x51e3e8=_0x4832b1[_0x588b('0x36')];_0x1c1d57<_0x51e3e8;_0x1c1d57++){if(_0x4832b1[_0x1c1d57][_0x588b('0x67')]==_0x1e86b2[_0x2159f2]['id']&&_0xffe55c[_0x588b('0x53')](_0x4832b1[_0x1c1d57][_0x588b('0x63')])){_0x3fea39[_0xffe55c[_0x4832b1[_0x1c1d57]['questionId']]]=_0x4832b1[_0x1c1d57][_0x588b('0x68')];}}for(var _0x3f090e in _0xffe55c){if(!_0x3fea39['hasOwnProperty'](_0xffe55c[_0x3f090e])){_0x3fea39[_0xffe55c[_0x3f090e]]=null;}}_0x49cbfb[_0x588b('0x69')](_0x3fea39);}return _0x49cbfb;}})[_0x588b('0x24')](function(_0x4e90c4){if(!_[_0x588b('0x6a')](_0x4e90c4)){var _0x707691=toCsv(_0x4e90c4);var _0x561078=Date[_0x588b('0x6b')]();fs[_0x588b('0x6c')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x11408c[_0x588b('0x4e')]['id'],_0x561078),_0x707691);_0x112e57[_0x588b('0x6d')](_0x588b('0x6e'),_0x588b('0x6f')+util[_0x588b('0x65')](_0x588b('0x70'),_0x11408c['params']['id'],_0x561078));_0x112e57[_0x588b('0x6d')](_0x588b('0x71'),_0x588b('0x72'));return _0x112e57[_0x588b('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x11408c[_0x588b('0x4e')]['id'],_0x561078));}else{return _0x112e57[_0x588b('0x17')](0xcc);}})['catch'](handleError(_0x112e57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b652a89..6f3a644 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 _0x7a2d=['api','moment','bluebird','request-promise','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x389c32,_0xe48b5e){var _0x38c203=function(_0x15022b){while(--_0x15022b){_0x389c32['push'](_0x389c32['shift']());}};_0x38c203(++_0xe48b5e);}(_0x7a2d,0x142));var _0xd7a2=function(_0x2350d2,_0xe722b3){_0x2350d2=_0x2350d2-0x0;var _0x415976=_0x7a2d[_0x2350d2];return _0x415976;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04f1=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','bluebird','request-promise','path','define'];(function(_0x118e87,_0x334b5c){var _0x5a9d5e=function(_0x35e3b7){while(--_0x35e3b7){_0x118e87['push'](_0x118e87['shift']());}};_0x5a9d5e(++_0x334b5c);}(_0x04f1,0x92));var _0x104f=function(_0x3e960c,_0x3646df){_0x3e960c=_0x3e960c-0x0;var _0x286a14=_0x04f1[_0x3e960c];return _0x286a14;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var logger=require(_0x104f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x104f('0x3'));var rp=require(_0x104f('0x4'));var fs=require('fs');var path=require(_0x104f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x4e767b,_0x20a746){return _0x4e767b[_0x104f('0x6')](_0x104f('0x7'),attributes,{'tableName':_0x104f('0x8'),'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 d02d8d1..32ea27b 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2566d7,_0x267fc0){var _0x4928eb=function(_0x2b2360){while(--_0x2b2360){_0x2566d7['push'](_0x2566d7['shift']());}};_0x4928eb(++_0x267fc0);}(_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 moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x16b994,_0x22872a){_0x16b994=_0x16b994-0x0;var _0xfc3e0f=_0xbdb7[_0x16b994];return _0xfc3e0f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 418377c..5e08397 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 _0xe6bc=['show','post','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id'];(function(_0x593880,_0x559669){var _0x363d42=function(_0x41c934){while(--_0x41c934){_0x593880['push'](_0x593880['shift']());}};_0x363d42(++_0x559669);}(_0xe6bc,0x116));var _0xce6b=function(_0x326448,_0x130b79){_0x326448=_0x326448-0x0;var _0x220aca=_0xe6bc[_0x326448];return _0x220aca;};'use strict';var multer=require(_0xce6b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xce6b('0x1'));var express=require('express');var router=express[_0xce6b('0x2')]();var fs_extra=require(_0xce6b('0x3'));var auth=require(_0xce6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce6b('0x5'));var controller=require(_0xce6b('0x6'));router[_0xce6b('0x7')]('/',auth[_0xce6b('0x8')](),controller[_0xce6b('0x9')]);router['get']('/describe',auth[_0xce6b('0x8')](),controller['describe']);router[_0xce6b('0x7')](_0xce6b('0xa'),auth[_0xce6b('0x8')](),controller[_0xce6b('0xb')]);router[_0xce6b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce6b('0xd')]('/:id',auth[_0xce6b('0x8')](),controller[_0xce6b('0xe')]);router['delete'](_0xce6b('0xa'),auth['isAuthenticated'](),controller[_0xce6b('0xf')]);module[_0xce6b('0x10')]=router; \ No newline at end of file +var _0xe14a=['./jscriptyQuestionReport.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','multer','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xe14a,0xcd));var _0xae14=function(_0x19a346,_0x4f12f1){_0x19a346=_0x19a346-0x0;var _0x29c71f=_0xe14a[_0x19a346];return _0x29c71f;};'use strict';var multer=require(_0xae14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae14('0x1'));var express=require(_0xae14('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae14('0x3'));var config=require(_0xae14('0x4'));var controller=require(_0xae14('0x5'));router[_0xae14('0x6')]('/',auth['isAuthenticated'](),controller[_0xae14('0x7')]);router[_0xae14('0x6')]('/describe',auth[_0xae14('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xae14('0x9')]);router[_0xae14('0xa')]('/',auth[_0xae14('0x8')](),controller[_0xae14('0xb')]);router[_0xae14('0xc')](_0xae14('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xae14('0xe')](_0xae14('0xd'),auth[_0xae14('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 88d988e..186b8d4 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x434d27,_0x29b09d){_0x434d27=_0x434d27-0x0;var _0x4c80c3=_0x7a54[_0x434d27];return _0x4c80c3;};'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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x22a7cc,_0x1328f0){_0x22a7cc=_0x22a7cc-0x0;var _0xd54a7f=_0x7a54[_0x22a7cc];return _0xd54a7f;};'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 4cf706f..00206f2 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 _0x26b3=['bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','then','findAll','rows','show','params','include','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x420001,_0x2488b5){var _0x1c5ef2=function(_0x143bdc){while(--_0x143bdc){_0x420001['push'](_0x420001['shift']());}};_0x1c5ef2(++_0x2488b5);}(_0x26b3,0x194));var _0x326b=function(_0x2a55dd,_0x2eb8ea){_0x2a55dd=_0x2a55dd-0x0;var _0x3333ad=_0x26b3[_0x2a55dd];return _0x3333ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x326b('0x0'));var zipdir=require(_0x326b('0x1'));var jsonpatch=require(_0x326b('0x2'));var rp=require(_0x326b('0x3'));var moment=require('moment');var BPromise=require(_0x326b('0x4'));var Mustache=require(_0x326b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x326b('0x6'));var ejs=require(_0x326b('0x7'));var fs=require('fs');var fs_extra=require(_0x326b('0x8'));var _=require(_0x326b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x326b('0xa'));var deskjs=require(_0x326b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x326b('0xc'));var Papa=require('papaparse');var Redis=require(_0x326b('0xd'));var authService=require(_0x326b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x326b('0xf'));var logger=require(_0x326b('0x10'))(_0x326b('0x11'));var utils=require(_0x326b('0x12'));var config=require(_0x326b('0x13'));var licenseUtil=require(_0x326b('0x14'));var db=require(_0x326b('0x15'))['db'];function respondWithStatusCode(_0xccd58b,_0x5dd078){_0x5dd078=_0x5dd078||0xcc;return function(_0x1cf056){if(_0x1cf056){return _0xccd58b[_0x326b('0x16')](_0x5dd078);}return _0xccd58b[_0x326b('0x17')](_0x5dd078)[_0x326b('0x18')]();};}function respondWithResult(_0x255e16,_0x165c6b){_0x165c6b=_0x165c6b||0xc8;return function(_0x56f19e){if(_0x56f19e){return _0x255e16[_0x326b('0x17')](_0x165c6b)[_0x326b('0x19')](_0x56f19e);}};}function respondWithFilteredResult(_0x5c19c6,_0x14c459){return function(_0x2af543){if(_0x2af543){var _0xfe4804=typeof _0x14c459[_0x326b('0x1a')]===_0x326b('0x1b')&&typeof _0x14c459[_0x326b('0x1c')]==='undefined';var _0x55f3dd=_0x2af543[_0x326b('0x1d')];var _0x54e840=_0xfe4804?0x0:_0x14c459['offset'];var _0x371fc6=_0xfe4804?_0x2af543[_0x326b('0x1d')]:_0x14c459[_0x326b('0x1a')]+_0x14c459[_0x326b('0x1c')];var _0xdebcae;if(_0x371fc6>=_0x55f3dd){_0x371fc6=_0x55f3dd;_0xdebcae=0xc8;}else{_0xdebcae=0xce;}_0x5c19c6[_0x326b('0x17')](_0xdebcae);return _0x5c19c6['set'](_0x326b('0x1e'),_0x54e840+'-'+_0x371fc6+'/'+_0x55f3dd)[_0x326b('0x19')](_0x2af543);}return null;};}function patchUpdates(_0x40ed8b){return function(_0x377df6){try{jsonpatch['apply'](_0x377df6,_0x40ed8b,!![]);}catch(_0x2a7cde){return BPromise['reject'](_0x2a7cde);}return _0x377df6[_0x326b('0x1f')]();};}function saveUpdates(_0x5c5e99,_0x455bc1){return function(_0x51a444){if(_0x51a444){return _0x51a444[_0x326b('0x20')](_0x5c5e99)['then'](function(_0x49b2cb){return _0x49b2cb;});}return null;};}function removeEntity(_0x60bc56,_0xdb272a){return function(_0x5430be){if(_0x5430be){return _0x5430be['destroy']()['then'](function(){_0x60bc56[_0x326b('0x17')](0xcc)[_0x326b('0x18')]();});}};}function handleEntityNotFound(_0x1c9222,_0xf920a9){return function(_0x1b3d76){if(!_0x1b3d76){_0x1c9222[_0x326b('0x16')](0x194);}return _0x1b3d76;};}function handleError(_0x7a729d,_0x1121c0){_0x1121c0=_0x1121c0||0x1f4;return function(_0x534183){logger['error'](_0x534183['stack']);if(_0x534183[_0x326b('0x21')]){delete _0x534183[_0x326b('0x21')];}_0x7a729d[_0x326b('0x17')](_0x1121c0)[_0x326b('0x22')](_0x534183);};}exports[_0x326b('0x23')]=function(_0x587992,_0x5347ea){var _0x49522a={},_0x410695={},_0xe3c233={'count':0x0,'rows':[]};var _0x31177a=_[_0x326b('0x24')](db[_0x326b('0x25')][_0x326b('0x26')],function(_0x30b562){return{'name':_0x30b562[_0x326b('0x27')],'type':_0x30b562[_0x326b('0x28')][_0x326b('0x29')]};});_0x410695[_0x326b('0x2a')]=_[_0x326b('0x24')](_0x31177a,_0x326b('0x21'));_0x410695[_0x326b('0x2b')]=_[_0x326b('0x2c')](_0x587992['query']);_0x410695[_0x326b('0x2d')]=_[_0x326b('0x2e')](_0x410695[_0x326b('0x2a')],_0x410695[_0x326b('0x2b')]);_0x49522a[_0x326b('0x2f')]=_[_0x326b('0x2e')](_0x410695[_0x326b('0x2a')],qs['fields'](_0x587992[_0x326b('0x2b')][_0x326b('0x30')]));_0x49522a['attributes']=_0x49522a['attributes']['length']?_0x49522a[_0x326b('0x2f')]:_0x410695['model'];if(!_0x587992[_0x326b('0x2b')][_0x326b('0x31')]('nolimit')){_0x49522a['limit']=qs[_0x326b('0x1c')](_0x587992[_0x326b('0x2b')][_0x326b('0x1c')]);_0x49522a[_0x326b('0x1a')]=qs[_0x326b('0x1a')](_0x587992[_0x326b('0x2b')][_0x326b('0x1a')]);}_0x49522a[_0x326b('0x32')]=qs['sort'](_0x587992['query'][_0x326b('0x33')]);_0x49522a[_0x326b('0x34')]=qs['filters'](_[_0x326b('0x35')](_0x587992[_0x326b('0x2b')],_0x410695['filters']),_0x31177a);if(_0x587992[_0x326b('0x2b')]['filter']){_0x49522a['where']=_[_0x326b('0x36')](_0x49522a['where'],{'$or':_[_0x326b('0x24')](_0x31177a,function(_0x1998b9){if(_0x1998b9['type']!==_0x326b('0x37')){var _0x48020c={};_0x48020c[_0x1998b9[_0x326b('0x21')]]={'$like':'%'+_0x587992[_0x326b('0x2b')]['filter']+'%'};return _0x48020c;}})});}_0x49522a=_[_0x326b('0x36')]({},_0x49522a,_0x587992['options']);var _0x30fb8d={'where':_0x49522a[_0x326b('0x34')]};return db[_0x326b('0x25')]['count'](_0x30fb8d)[_0x326b('0x38')](function(_0x53857f){_0xe3c233[_0x326b('0x1d')]=_0x53857f;if(_0x587992[_0x326b('0x2b')]['includeAll']){_0x49522a['include']=[{'all':!![]}];}return db[_0x326b('0x25')][_0x326b('0x39')](_0x49522a);})['then'](function(_0x4fb74c){_0xe3c233[_0x326b('0x3a')]=_0x4fb74c;return _0xe3c233;})['then'](respondWithFilteredResult(_0x5347ea,_0x49522a))['catch'](handleError(_0x5347ea,null));};exports[_0x326b('0x3b')]=function(_0x1e8e3b,_0x17a8ed){var _0x52cde8={'raw':!![],'where':{'id':_0x1e8e3b[_0x326b('0x3c')]['id']}},_0x5d3fac={};_0x5d3fac[_0x326b('0x2a')]=_[_0x326b('0x2c')](db['JscriptyQuestionReport']['rawAttributes']);_0x5d3fac[_0x326b('0x2b')]=_['keys'](_0x1e8e3b[_0x326b('0x2b')]);_0x5d3fac['filters']=_[_0x326b('0x2e')](_0x5d3fac['model'],_0x5d3fac[_0x326b('0x2b')]);_0x52cde8[_0x326b('0x2f')]=_['intersection'](_0x5d3fac[_0x326b('0x2a')],qs[_0x326b('0x30')](_0x1e8e3b[_0x326b('0x2b')]['fields']));_0x52cde8['attributes']=_0x52cde8[_0x326b('0x2f')]['length']?_0x52cde8['attributes']:_0x5d3fac['model'];if(_0x1e8e3b['query']['includeAll']){_0x52cde8[_0x326b('0x3d')]=[{'all':!![]}];}_0x52cde8=_[_0x326b('0x36')]({},_0x52cde8,_0x1e8e3b['options']);return db[_0x326b('0x25')][_0x326b('0x3e')](_0x52cde8)[_0x326b('0x38')](handleEntityNotFound(_0x17a8ed,null))['then'](respondWithResult(_0x17a8ed,null))[_0x326b('0x3f')](handleError(_0x17a8ed,null));};exports[_0x326b('0x40')]=function(_0x3bcad3,_0x196b56){return db['JscriptyQuestionReport'][_0x326b('0x40')](_0x3bcad3[_0x326b('0x41')],{})['then'](respondWithResult(_0x196b56,0xc9))[_0x326b('0x3f')](handleError(_0x196b56,null));};exports[_0x326b('0x20')]=function(_0x2ed90c,_0xf327f9){if(_0x2ed90c['body']['id']){delete _0x2ed90c[_0x326b('0x41')]['id'];}return db['JscriptyQuestionReport'][_0x326b('0x3e')]({'where':{'id':_0x2ed90c[_0x326b('0x3c')]['id']}})['then'](handleEntityNotFound(_0xf327f9,null))[_0x326b('0x38')](saveUpdates(_0x2ed90c[_0x326b('0x41')],null))[_0x326b('0x38')](respondWithResult(_0xf327f9,null))['catch'](handleError(_0xf327f9,null));};exports[_0x326b('0x42')]=function(_0x49ea8c,_0x5efcbf){return db[_0x326b('0x25')][_0x326b('0x3e')]({'where':{'id':_0x49ea8c['params']['id']}})['then'](handleEntityNotFound(_0x5efcbf,null))[_0x326b('0x38')](removeEntity(_0x5efcbf,null))[_0x326b('0x3f')](handleError(_0x5efcbf,null));};exports[_0x326b('0x43')]=function(_0x41a689,_0x5490cb){return db[_0x326b('0x25')]['describe']()[_0x326b('0x38')](respondWithResult(_0x5490cb,null))[_0x326b('0x3f')](handleError(_0x5490cb,null));}; \ No newline at end of file +var _0x6dd6=['sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset'];(function(_0x84e4c7,_0x19cf0a){var _0x236040=function(_0xea1bef){while(--_0xea1bef){_0x84e4c7['push'](_0x84e4c7['shift']());}};_0x236040(++_0x19cf0a);}(_0x6dd6,0x172));var _0x66dd=function(_0x5185cf,_0x18e620){_0x5185cf=_0x5185cf-0x0;var _0x53a6b5=_0x6dd6[_0x5185cf];return _0x53a6b5;};'use strict';var emlformat=require(_0x66dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66dd('0x1'));var jsonpatch=require(_0x66dd('0x2'));var rp=require(_0x66dd('0x3'));var moment=require('moment');var BPromise=require(_0x66dd('0x4'));var Mustache=require(_0x66dd('0x5'));var util=require(_0x66dd('0x6'));var path=require(_0x66dd('0x7'));var sox=require(_0x66dd('0x8'));var csv=require(_0x66dd('0x9'));var ejs=require(_0x66dd('0xa'));var fs=require('fs');var fs_extra=require(_0x66dd('0xb'));var _=require('lodash');var squel=require(_0x66dd('0xc'));var crypto=require(_0x66dd('0xd'));var jsforce=require(_0x66dd('0xe'));var deskjs=require(_0x66dd('0xf'));var toCsv=require(_0x66dd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x66dd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66dd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x66dd('0x12'));var config=require(_0x66dd('0x13'));var licenseUtil=require(_0x66dd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x89c1cc,_0x53bb03){_0x53bb03=_0x53bb03||0xcc;return function(_0x13d9b9){if(_0x13d9b9){return _0x89c1cc[_0x66dd('0x15')](_0x53bb03);}return _0x89c1cc['status'](_0x53bb03)['end']();};}function respondWithResult(_0x3b1381,_0x5290f5){_0x5290f5=_0x5290f5||0xc8;return function(_0x445331){if(_0x445331){return _0x3b1381[_0x66dd('0x16')](_0x5290f5)['json'](_0x445331);}};}function respondWithFilteredResult(_0x25dbed,_0x208e81){return function(_0x5780de){if(_0x5780de){var _0x361852=typeof _0x208e81['offset']===_0x66dd('0x17')&&typeof _0x208e81[_0x66dd('0x18')]==='undefined';var _0xea96ce=_0x5780de[_0x66dd('0x19')];var _0x271642=_0x361852?0x0:_0x208e81['offset'];var _0x2e72ca=_0x361852?_0x5780de[_0x66dd('0x19')]:_0x208e81['offset']+_0x208e81[_0x66dd('0x18')];var _0x1f6959;if(_0x2e72ca>=_0xea96ce){_0x2e72ca=_0xea96ce;_0x1f6959=0xc8;}else{_0x1f6959=0xce;}_0x25dbed['status'](_0x1f6959);return _0x25dbed['set'](_0x66dd('0x1a'),_0x271642+'-'+_0x2e72ca+'/'+_0xea96ce)['json'](_0x5780de);}return null;};}function patchUpdates(_0x3db40a){return function(_0x52d6ce){try{jsonpatch['apply'](_0x52d6ce,_0x3db40a,!![]);}catch(_0x38736f){return BPromise[_0x66dd('0x1b')](_0x38736f);}return _0x52d6ce['save']();};}function saveUpdates(_0x44cbe9,_0x2c0c4b){return function(_0xac777b){if(_0xac777b){return _0xac777b[_0x66dd('0x1c')](_0x44cbe9)[_0x66dd('0x1d')](function(_0x5b9c9f){return _0x5b9c9f;});}return null;};}function removeEntity(_0x44b197,_0x1509c4){return function(_0x332291){if(_0x332291){return _0x332291[_0x66dd('0x1e')]()[_0x66dd('0x1d')](function(){_0x44b197['status'](0xcc)[_0x66dd('0x1f')]();});}};}function handleEntityNotFound(_0x5e0a00,_0x3f9641){return function(_0x26bfe1){if(!_0x26bfe1){_0x5e0a00['sendStatus'](0x194);}return _0x26bfe1;};}function handleError(_0xdbb658,_0xaf2a4f){_0xaf2a4f=_0xaf2a4f||0x1f4;return function(_0x151a75){logger['error'](_0x151a75[_0x66dd('0x20')]);if(_0x151a75[_0x66dd('0x21')]){delete _0x151a75['name'];}_0xdbb658['status'](_0xaf2a4f)[_0x66dd('0x22')](_0x151a75);};}exports[_0x66dd('0x23')]=function(_0x394812,_0x269e3c){var _0xcf07f5={},_0x4e6fa9={},_0x54db1e={'count':0x0,'rows':[]};var _0x5923c7=_[_0x66dd('0x24')](db[_0x66dd('0x25')]['rawAttributes'],function(_0x5d3464){return{'name':_0x5d3464[_0x66dd('0x26')],'type':_0x5d3464[_0x66dd('0x27')][_0x66dd('0x28')]};});_0x4e6fa9[_0x66dd('0x29')]=_[_0x66dd('0x24')](_0x5923c7,_0x66dd('0x21'));_0x4e6fa9[_0x66dd('0x2a')]=_['keys'](_0x394812[_0x66dd('0x2a')]);_0x4e6fa9[_0x66dd('0x2b')]=_[_0x66dd('0x2c')](_0x4e6fa9[_0x66dd('0x29')],_0x4e6fa9['query']);_0xcf07f5[_0x66dd('0x2d')]=_[_0x66dd('0x2c')](_0x4e6fa9[_0x66dd('0x29')],qs['fields'](_0x394812[_0x66dd('0x2a')][_0x66dd('0x2e')]));_0xcf07f5[_0x66dd('0x2d')]=_0xcf07f5['attributes'][_0x66dd('0x2f')]?_0xcf07f5[_0x66dd('0x2d')]:_0x4e6fa9[_0x66dd('0x29')];if(!_0x394812[_0x66dd('0x2a')][_0x66dd('0x30')]('nolimit')){_0xcf07f5['limit']=qs[_0x66dd('0x18')](_0x394812['query'][_0x66dd('0x18')]);_0xcf07f5[_0x66dd('0x31')]=qs[_0x66dd('0x31')](_0x394812[_0x66dd('0x2a')][_0x66dd('0x31')]);}_0xcf07f5['order']=qs['sort'](_0x394812[_0x66dd('0x2a')][_0x66dd('0x32')]);_0xcf07f5[_0x66dd('0x33')]=qs[_0x66dd('0x2b')](_[_0x66dd('0x34')](_0x394812['query'],_0x4e6fa9['filters']),_0x5923c7);if(_0x394812[_0x66dd('0x2a')]['filter']){_0xcf07f5[_0x66dd('0x33')]=_[_0x66dd('0x35')](_0xcf07f5[_0x66dd('0x33')],{'$or':_[_0x66dd('0x24')](_0x5923c7,function(_0x2c7c46){if(_0x2c7c46[_0x66dd('0x27')]!==_0x66dd('0x36')){var _0x5e39fe={};_0x5e39fe[_0x2c7c46[_0x66dd('0x21')]]={'$like':'%'+_0x394812['query'][_0x66dd('0x37')]+'%'};return _0x5e39fe;}})});}_0xcf07f5=_['merge']({},_0xcf07f5,_0x394812['options']);var _0x223cd8={'where':_0xcf07f5[_0x66dd('0x33')]};return db['JscriptyQuestionReport'][_0x66dd('0x19')](_0x223cd8)[_0x66dd('0x1d')](function(_0x58e1fc){_0x54db1e[_0x66dd('0x19')]=_0x58e1fc;if(_0x394812[_0x66dd('0x2a')][_0x66dd('0x38')]){_0xcf07f5['include']=[{'all':!![]}];}return db[_0x66dd('0x25')][_0x66dd('0x39')](_0xcf07f5);})[_0x66dd('0x1d')](function(_0x181467){_0x54db1e[_0x66dd('0x3a')]=_0x181467;return _0x54db1e;})[_0x66dd('0x1d')](respondWithFilteredResult(_0x269e3c,_0xcf07f5))[_0x66dd('0x3b')](handleError(_0x269e3c,null));};exports[_0x66dd('0x3c')]=function(_0x44fb54,_0x2f12d4){var _0x150de7={'raw':!![],'where':{'id':_0x44fb54[_0x66dd('0x3d')]['id']}},_0x44cc27={};_0x44cc27['model']=_[_0x66dd('0x3e')](db[_0x66dd('0x25')][_0x66dd('0x3f')]);_0x44cc27['query']=_[_0x66dd('0x3e')](_0x44fb54[_0x66dd('0x2a')]);_0x44cc27['filters']=_[_0x66dd('0x2c')](_0x44cc27[_0x66dd('0x29')],_0x44cc27['query']);_0x150de7[_0x66dd('0x2d')]=_[_0x66dd('0x2c')](_0x44cc27['model'],qs['fields'](_0x44fb54[_0x66dd('0x2a')][_0x66dd('0x2e')]));_0x150de7[_0x66dd('0x2d')]=_0x150de7[_0x66dd('0x2d')][_0x66dd('0x2f')]?_0x150de7[_0x66dd('0x2d')]:_0x44cc27[_0x66dd('0x29')];if(_0x44fb54[_0x66dd('0x2a')]['includeAll']){_0x150de7[_0x66dd('0x40')]=[{'all':!![]}];}_0x150de7=_[_0x66dd('0x35')]({},_0x150de7,_0x44fb54[_0x66dd('0x41')]);return db[_0x66dd('0x25')][_0x66dd('0x42')](_0x150de7)[_0x66dd('0x1d')](handleEntityNotFound(_0x2f12d4,null))['then'](respondWithResult(_0x2f12d4,null))[_0x66dd('0x3b')](handleError(_0x2f12d4,null));};exports[_0x66dd('0x43')]=function(_0x2630ef,_0x192f6e){return db[_0x66dd('0x25')][_0x66dd('0x43')](_0x2630ef[_0x66dd('0x44')],{})[_0x66dd('0x1d')](respondWithResult(_0x192f6e,0xc9))[_0x66dd('0x3b')](handleError(_0x192f6e,null));};exports['update']=function(_0x5fd674,_0xdbcaf7){if(_0x5fd674[_0x66dd('0x44')]['id']){delete _0x5fd674['body']['id'];}return db[_0x66dd('0x25')][_0x66dd('0x42')]({'where':{'id':_0x5fd674[_0x66dd('0x3d')]['id']}})[_0x66dd('0x1d')](handleEntityNotFound(_0xdbcaf7,null))[_0x66dd('0x1d')](saveUpdates(_0x5fd674[_0x66dd('0x44')],null))['then'](respondWithResult(_0xdbcaf7,null))[_0x66dd('0x3b')](handleError(_0xdbcaf7,null));};exports[_0x66dd('0x1e')]=function(_0xf1a2cb,_0x12cd7e){return db[_0x66dd('0x25')][_0x66dd('0x42')]({'where':{'id':_0xf1a2cb[_0x66dd('0x3d')]['id']}})[_0x66dd('0x1d')](handleEntityNotFound(_0x12cd7e,null))[_0x66dd('0x1d')](removeEntity(_0x12cd7e,null))[_0x66dd('0x3b')](handleError(_0x12cd7e,null));};exports[_0x66dd('0x45')]=function(_0x5034d4,_0x58436d){return db['JscriptyQuestionReport']['describe']()[_0x66dd('0x1d')](respondWithResult(_0x58436d,null))[_0x66dd('0x3b')](handleError(_0x58436d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d378072..942349e 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 _0xfaba=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xfaba,0x83));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xafab('0x0'));var util=require('util');var logger=require(_0xafab('0x1'))('api');var moment=require('moment');var BPromise=require(_0xafab('0x2'));var rp=require(_0xafab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafab('0x4'));var config=require(_0xafab('0x5'));var attributes=require(_0xafab('0x6'));module[_0xafab('0x7')]=function(_0x5aaa23,_0x1fd24c){return _0x5aaa23[_0xafab('0x8')](_0xafab('0x9'),attributes,{'tableName':_0xafab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x301f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x301f,0xa4));var _0xf301=function(_0xc4f429,_0x5ee3f8){_0xc4f429=_0xc4f429-0x0;var _0xafc3a6=_0x301f[_0xc4f429];return _0xafc3a6;};'use strict';var _=require('lodash');var util=require(_0xf301('0x0'));var logger=require(_0xf301('0x1'))(_0xf301('0x2'));var moment=require(_0xf301('0x3'));var BPromise=require(_0xf301('0x4'));var rp=require(_0xf301('0x5'));var fs=require('fs');var path=require(_0xf301('0x6'));var rimraf=require(_0xf301('0x7'));var config=require(_0xf301('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xf301('0x9')]=function(_0x2a6db3,_0x2624a0){return _0x2a6db3[_0xf301('0xa')]('JscriptyQuestionReport',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 6f9b74d..8901ffa 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 _0x1fe9=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1fe9,0xfa));var _0x91fe=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1fe9[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x91fe('0x0'));var util=require(_0x91fe('0x1'));var moment=require(_0x91fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91fe('0x3'));var db=require(_0x91fe('0x4'))['db'];var utils=require(_0x91fe('0x5'));var logger=require(_0x91fe('0x6'))(_0x91fe('0x7'));var config=require(_0x91fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x91fe('0x9')][_0x91fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9c76,_0x587342,_0x5c657f){return new BPromise(function(_0x22bcae,_0x47420e){return client[_0x91fe('0xb')](_0x3b9c76,_0x5c657f)[_0x91fe('0xc')](function(_0x3d6d5c){logger[_0x91fe('0xd')](_0x91fe('0xe'),_0x587342,_0x91fe('0xf'));logger[_0x91fe('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x587342,_0x91fe('0xf'),JSON[_0x91fe('0x11')](_0x3d6d5c));if(_0x3d6d5c[_0x91fe('0x12')]){if(_0x3d6d5c['error']['code']===0x1f4){logger[_0x91fe('0x12')](_0x91fe('0xe'),_0x587342,_0x3d6d5c[_0x91fe('0x12')][_0x91fe('0x13')]);return _0x47420e(_0x3d6d5c['error'][_0x91fe('0x13')]);}logger['error'](_0x91fe('0xe'),_0x587342,_0x3d6d5c['error']['message']);return _0x22bcae(_0x3d6d5c[_0x91fe('0x12')]['message']);}else{logger[_0x91fe('0xd')](_0x91fe('0xe'),_0x587342,_0x91fe('0xf'));_0x22bcae(_0x3d6d5c['result']['message']);}})[_0x91fe('0x14')](function(_0x41c38a){logger[_0x91fe('0x12')](_0x91fe('0xe'),_0x587342,_0x41c38a);_0x47420e(_0x41c38a);});});} \ No newline at end of file +var _0xf837=['then','info','request\x20sent','debug','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x1575b7,_0x475974){var _0x3bbc95=function(_0x1fd3a1){while(--_0x1fd3a1){_0x1575b7['push'](_0x1575b7['shift']());}};_0x3bbc95(++_0x475974);}(_0xf837,0xc6));var _0x7f83=function(_0x207e70,_0x8dbb13){_0x207e70=_0x207e70-0x0;var _0x3d1339=_0xf837[_0x207e70];return _0x3d1339;};'use strict';var _=require(_0x7f83('0x0'));var util=require(_0x7f83('0x1'));var moment=require(_0x7f83('0x2'));var BPromise=require(_0x7f83('0x3'));var rs=require(_0x7f83('0x4'));var fs=require('fs');var Redis=require(_0x7f83('0x5'));var db=require(_0x7f83('0x6'))['db'];var utils=require(_0x7f83('0x7'));var logger=require(_0x7f83('0x8'))('rpc');var config=require(_0x7f83('0x9'));var jayson=require(_0x7f83('0xa'));var client=jayson['client'][_0x7f83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e0492,_0x15a3d7,_0x17af1a){return new BPromise(function(_0x2e93ea,_0x16c9e1){return client['request'](_0x5e0492,_0x17af1a)[_0x7f83('0xc')](function(_0x101f0a){logger[_0x7f83('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x15a3d7,_0x7f83('0xe'));logger[_0x7f83('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x15a3d7,_0x7f83('0xe'),JSON['stringify'](_0x101f0a));if(_0x101f0a[_0x7f83('0x10')]){if(_0x101f0a[_0x7f83('0x10')][_0x7f83('0x11')]===0x1f4){logger[_0x7f83('0x10')](_0x7f83('0x12'),_0x15a3d7,_0x101f0a[_0x7f83('0x10')][_0x7f83('0x13')]);return _0x16c9e1(_0x101f0a['error'][_0x7f83('0x13')]);}logger[_0x7f83('0x10')](_0x7f83('0x12'),_0x15a3d7,_0x101f0a['error'][_0x7f83('0x13')]);return _0x2e93ea(_0x101f0a[_0x7f83('0x10')][_0x7f83('0x13')]);}else{logger[_0x7f83('0xd')](_0x7f83('0x12'),_0x15a3d7,_0x7f83('0xe'));_0x2e93ea(_0x101f0a['result'][_0x7f83('0x13')]);}})[_0x7f83('0x14')](function(_0x33b1e8){logger[_0x7f83('0x10')](_0x7f83('0x12'),_0x15a3d7,_0x33b1e8);_0x16c9e1(_0x33b1e8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2e2ee8d..c729255 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 _0x341a=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create'];(function(_0x308671,_0x237090){var _0x580f26=function(_0x4a20e2){while(--_0x4a20e2){_0x308671['push'](_0x308671['shift']());}};_0x580f26(++_0x237090);}(_0x341a,0x121));var _0xa341=function(_0x31798a,_0x32c784){_0x31798a=_0x31798a-0x0;var _0x3523f7=_0x341a[_0x31798a];return _0x3523f7;};'use strict';var multer=require(_0xa341('0x0'));var util=require(_0xa341('0x1'));var path=require(_0xa341('0x2'));var timeout=require(_0xa341('0x3'));var express=require(_0xa341('0x4'));var router=express['Router']();var fs_extra=require(_0xa341('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa341('0x6'));var config=require(_0xa341('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xa341('0x8')]('/',auth[_0xa341('0x9')](),controller['index']);router['get'](_0xa341('0xa'),auth[_0xa341('0x9')](),controller[_0xa341('0xb')]);router[_0xa341('0x8')](_0xa341('0xc'),auth['isAuthenticated'](),controller[_0xa341('0xd')]);router['get']('/:id/questions',auth[_0xa341('0x9')](),controller['getQuestions']);router['post']('/',auth[_0xa341('0x9')](),controller[_0xa341('0xe')]);router[_0xa341('0xf')](_0xa341('0xc'),auth[_0xa341('0x9')](),controller[_0xa341('0x10')]);router[_0xa341('0x11')](_0xa341('0xc'),auth[_0xa341('0x9')](),controller['destroy']);module[_0xa341('0x12')]=router; \ No newline at end of file +var _0xf583=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','delete'];(function(_0x29769b,_0x1216fc){var _0x338ab7=function(_0x579334){while(--_0x579334){_0x29769b['push'](_0x29769b['shift']());}};_0x338ab7(++_0x1216fc);}(_0xf583,0x18d));var _0x3f58=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xf583[_0x377a6e];return _0x37f751;};'use strict';var multer=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var path=require(_0x3f58('0x2'));var timeout=require(_0x3f58('0x3'));var express=require(_0x3f58('0x4'));var router=express[_0x3f58('0x5')]();var fs_extra=require(_0x3f58('0x6'));var auth=require(_0x3f58('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f58('0x8'));router[_0x3f58('0x9')]('/',auth[_0x3f58('0xa')](),controller['index']);router[_0x3f58('0x9')](_0x3f58('0xb'),auth[_0x3f58('0xa')](),controller[_0x3f58('0xc')]);router['get'](_0x3f58('0xd'),auth[_0x3f58('0xa')](),controller[_0x3f58('0xe')]);router[_0x3f58('0x9')](_0x3f58('0xf'),auth[_0x3f58('0xa')](),controller[_0x3f58('0x10')]);router[_0x3f58('0x11')]('/',auth[_0x3f58('0xa')](),controller[_0x3f58('0x12')]);router[_0x3f58('0x13')](_0x3f58('0xd'),auth[_0x3f58('0xa')](),controller['update']);router[_0x3f58('0x14')](_0x3f58('0xd'),auth[_0x3f58('0xa')](),controller['destroy']);module[_0x3f58('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 69b8eb6..075b2b5 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 _0xbb9d=['setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','starttime'];(function(_0x10eb28,_0x18e358){var _0x2f25f1=function(_0x30c77d){while(--_0x30c77d){_0x10eb28['push'](_0x10eb28['shift']());}};_0x2f25f1(++_0x18e358);}(_0xbb9d,0x113));var _0xdbb9=function(_0x237674,_0x2e8cf3){_0x237674=_0x237674-0x0;var _0x3f8880=_0xbb9d[_0x237674];return _0x3f8880;};'use strict';var moment=require(_0xdbb9('0x0'));var Sequelize=require(_0xdbb9('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xdbb9('0x2')],'set':function(_0xd32b42){this['setDataValue'](_0xdbb9('0x3'),_0xd32b42);this[_0xdbb9('0x4')](_0xdbb9('0x5'),moment()['format'](_0xdbb9('0x6')));}},'endtime':{'type':Sequelize[_0xdbb9('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdbb9('0x7')]},'queue':{'type':Sequelize[_0xdbb9('0x7')]},'uniqueid':{'type':Sequelize[_0xdbb9('0x7')]},'calleridname':{'type':Sequelize[_0xdbb9('0x7')]},'calleridnum':{'type':Sequelize[_0xdbb9('0x7')]},'completed':{'type':Sequelize[_0xdbb9('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xc87d=['STRING','BOOLEAN','moment','sequelize','exports','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x466dee,_0x4c9527){var _0x4997c0=function(_0xc34ef){while(--_0xc34ef){_0x466dee['push'](_0x466dee['shift']());}};_0x4997c0(++_0x4c9527);}(_0xc87d,0xc0));var _0xdc87=function(_0x40f31d,_0x166318){_0x40f31d=_0x40f31d-0x0;var _0x10d4e4=_0xc87d[_0x40f31d];return _0x10d4e4;};'use strict';var moment=require(_0xdc87('0x0'));var Sequelize=require(_0xdc87('0x1'));module[_0xdc87('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3997f3){this['setDataValue'](_0xdc87('0x3'),_0x3997f3);this['setDataValue'](_0xdc87('0x4'),moment()[_0xdc87('0x5')](_0xdc87('0x6')));}},'endtime':{'type':Sequelize[_0xdc87('0x7')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdc87('0x8')]},'uniqueid':{'type':Sequelize[_0xdc87('0x8')]},'calleridname':{'type':Sequelize[_0xdc87('0x8')]},'calleridnum':{'type':Sequelize[_0xdc87('0x8')]},'completed':{'type':Sequelize[_0xdc87('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b3f0ccf..09796ab 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 _0x89eb=['Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','JscriptySessionReport','options','find','create','body','describe','getQuestions','JscriptyQuestionReport','nolimit','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3b53de,_0xb7592f){var _0x48bfd8=function(_0x22981b){while(--_0x22981b){_0x3b53de['push'](_0x3b53de['shift']());}};_0x48bfd8(++_0xb7592f);}(_0x89eb,0x172));var _0xb89e=function(_0x1f0e4f,_0x12be3b){_0x1f0e4f=_0x1f0e4f-0x0;var _0x26fad7=_0x89eb[_0x1f0e4f];return _0x26fad7;};'use strict';var emlformat=require(_0xb89e('0x0'));var rimraf=require(_0xb89e('0x1'));var zipdir=require(_0xb89e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb89e('0x3'));var moment=require(_0xb89e('0x4'));var BPromise=require(_0xb89e('0x5'));var Mustache=require(_0xb89e('0x6'));var util=require(_0xb89e('0x7'));var path=require('path');var sox=require(_0xb89e('0x8'));var csv=require('to-csv');var ejs=require(_0xb89e('0x9'));var fs=require('fs');var fs_extra=require(_0xb89e('0xa'));var _=require('lodash');var squel=require(_0xb89e('0xb'));var crypto=require(_0xb89e('0xc'));var jsforce=require(_0xb89e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb89e('0xe'));var Papa=require(_0xb89e('0xf'));var Redis=require('ioredis');var authService=require(_0xb89e('0x10'));var qs=require(_0xb89e('0x11'));var as=require(_0xb89e('0x12'));var hardwareService=require(_0xb89e('0x13'));var logger=require(_0xb89e('0x14'))(_0xb89e('0x15'));var utils=require(_0xb89e('0x16'));var config=require(_0xb89e('0x17'));var licenseUtil=require(_0xb89e('0x18'));var db=require(_0xb89e('0x19'))['db'];function respondWithStatusCode(_0x4f3afc,_0x46e61f){_0x46e61f=_0x46e61f||0xcc;return function(_0x3102e2){if(_0x3102e2){return _0x4f3afc[_0xb89e('0x1a')](_0x46e61f);}return _0x4f3afc[_0xb89e('0x1b')](_0x46e61f)[_0xb89e('0x1c')]();};}function respondWithResult(_0x20e8a6,_0x2b0177){_0x2b0177=_0x2b0177||0xc8;return function(_0x22fe60){if(_0x22fe60){return _0x20e8a6[_0xb89e('0x1b')](_0x2b0177)[_0xb89e('0x1d')](_0x22fe60);}};}function respondWithFilteredResult(_0x1354d6,_0x2f6bc5){return function(_0x4d456c){if(_0x4d456c){var _0x336129=typeof _0x2f6bc5[_0xb89e('0x1e')]===_0xb89e('0x1f')&&typeof _0x2f6bc5[_0xb89e('0x20')]===_0xb89e('0x1f');var _0x2b9cde=_0x4d456c['count'];var _0x253689=_0x336129?0x0:_0x2f6bc5[_0xb89e('0x1e')];var _0x5e272b=_0x336129?_0x4d456c[_0xb89e('0x21')]:_0x2f6bc5[_0xb89e('0x1e')]+_0x2f6bc5[_0xb89e('0x20')];var _0x1f97f6;if(_0x5e272b>=_0x2b9cde){_0x5e272b=_0x2b9cde;_0x1f97f6=0xc8;}else{_0x1f97f6=0xce;}_0x1354d6[_0xb89e('0x1b')](_0x1f97f6);return _0x1354d6[_0xb89e('0x22')](_0xb89e('0x23'),_0x253689+'-'+_0x5e272b+'/'+_0x2b9cde)[_0xb89e('0x1d')](_0x4d456c);}return null;};}function patchUpdates(_0x448bda){return function(_0x5985f1){try{jsonpatch['apply'](_0x5985f1,_0x448bda,!![]);}catch(_0x4497f3){return BPromise['reject'](_0x4497f3);}return _0x5985f1[_0xb89e('0x24')]();};}function saveUpdates(_0x2eb352,_0x4547d0){return function(_0x488efe){if(_0x488efe){return _0x488efe[_0xb89e('0x25')](_0x2eb352)[_0xb89e('0x26')](function(_0x451cc5){return _0x451cc5;});}return null;};}function removeEntity(_0x14d2aa,_0xfc63fa){return function(_0x4a8fd8){if(_0x4a8fd8){return _0x4a8fd8[_0xb89e('0x27')]()[_0xb89e('0x26')](function(){_0x14d2aa['status'](0xcc)[_0xb89e('0x1c')]();});}};}function handleEntityNotFound(_0x17c50e,_0x37c076){return function(_0x3ea71b){if(!_0x3ea71b){_0x17c50e[_0xb89e('0x1a')](0x194);}return _0x3ea71b;};}function handleError(_0x5d9749,_0x2d39f9){_0x2d39f9=_0x2d39f9||0x1f4;return function(_0x2d0c83){logger['error'](_0x2d0c83[_0xb89e('0x28')]);if(_0x2d0c83[_0xb89e('0x29')]){delete _0x2d0c83[_0xb89e('0x29')];}_0x5d9749['status'](_0x2d39f9)[_0xb89e('0x2a')](_0x2d0c83);};}exports[_0xb89e('0x2b')]=function(_0x51c6d7,_0x4f7440){var _0x12c618={},_0x2f2fed={},_0x2caaac={'count':0x0,'rows':[]};var _0x44dbef=_[_0xb89e('0x2c')](db['JscriptySessionReport'][_0xb89e('0x2d')],function(_0x5f22fe){return{'name':_0x5f22fe[_0xb89e('0x2e')],'type':_0x5f22fe[_0xb89e('0x2f')][_0xb89e('0x30')]};});_0x2f2fed[_0xb89e('0x31')]=_[_0xb89e('0x2c')](_0x44dbef,_0xb89e('0x29'));_0x2f2fed['query']=_[_0xb89e('0x32')](_0x51c6d7[_0xb89e('0x33')]);_0x2f2fed['filters']=_[_0xb89e('0x34')](_0x2f2fed['model'],_0x2f2fed[_0xb89e('0x33')]);_0x12c618[_0xb89e('0x35')]=_['intersection'](_0x2f2fed[_0xb89e('0x31')],qs[_0xb89e('0x36')](_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x36')]));_0x12c618[_0xb89e('0x35')]=_0x12c618[_0xb89e('0x35')][_0xb89e('0x37')]?_0x12c618[_0xb89e('0x35')]:_0x2f2fed[_0xb89e('0x31')];if(!_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x38')]('nolimit')){_0x12c618[_0xb89e('0x20')]=qs[_0xb89e('0x20')](_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x20')]);_0x12c618[_0xb89e('0x1e')]=qs['offset'](_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x1e')]);}_0x12c618[_0xb89e('0x39')]=qs['sort'](_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x3a')]);_0x12c618[_0xb89e('0x3b')]=qs['filters'](_[_0xb89e('0x3c')](_0x51c6d7['query'],_0x2f2fed[_0xb89e('0x3d')]),_0x44dbef);if(_0x51c6d7['query']['filter']){_0x12c618[_0xb89e('0x3b')]=_[_0xb89e('0x3e')](_0x12c618[_0xb89e('0x3b')],{'$or':_['map'](_0x44dbef,function(_0x2f4178){if(_0x2f4178[_0xb89e('0x2f')]!==_0xb89e('0x3f')){var _0x40b544={};_0x40b544[_0x2f4178[_0xb89e('0x29')]]={'$like':'%'+_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x40')]+'%'};return _0x40b544;}})});}_0x12c618=_[_0xb89e('0x3e')]({},_0x12c618,_0x51c6d7['options']);var _0x4295b8={'where':_0x12c618[_0xb89e('0x3b')]};return db['JscriptySessionReport']['count'](_0x4295b8)[_0xb89e('0x26')](function(_0x57766b){_0x2caaac[_0xb89e('0x21')]=_0x57766b;if(_0x51c6d7[_0xb89e('0x33')][_0xb89e('0x41')]){_0x12c618[_0xb89e('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb89e('0x43')](_0x12c618);})[_0xb89e('0x26')](function(_0x32480e){_0x2caaac[_0xb89e('0x44')]=_0x32480e;return _0x2caaac;})['then'](respondWithFilteredResult(_0x4f7440,_0x12c618))[_0xb89e('0x45')](handleError(_0x4f7440,null));};exports['show']=function(_0x45425d,_0x1259d7){var _0x16174a={'raw':!![],'where':{'id':_0x45425d[_0xb89e('0x46')]['id']}},_0x2325cf={};_0x2325cf[_0xb89e('0x31')]=_[_0xb89e('0x32')](db[_0xb89e('0x47')]['rawAttributes']);_0x2325cf['query']=_[_0xb89e('0x32')](_0x45425d['query']);_0x2325cf[_0xb89e('0x3d')]=_['intersection'](_0x2325cf['model'],_0x2325cf[_0xb89e('0x33')]);_0x16174a['attributes']=_[_0xb89e('0x34')](_0x2325cf[_0xb89e('0x31')],qs['fields'](_0x45425d['query']['fields']));_0x16174a['attributes']=_0x16174a[_0xb89e('0x35')][_0xb89e('0x37')]?_0x16174a[_0xb89e('0x35')]:_0x2325cf['model'];if(_0x45425d[_0xb89e('0x33')][_0xb89e('0x41')]){_0x16174a[_0xb89e('0x42')]=[{'all':!![]}];}_0x16174a=_[_0xb89e('0x3e')]({},_0x16174a,_0x45425d[_0xb89e('0x48')]);return db['JscriptySessionReport'][_0xb89e('0x49')](_0x16174a)[_0xb89e('0x26')](handleEntityNotFound(_0x1259d7,null))[_0xb89e('0x26')](respondWithResult(_0x1259d7,null))['catch'](handleError(_0x1259d7,null));};exports[_0xb89e('0x4a')]=function(_0x4f6381,_0x2b62b7){return db[_0xb89e('0x47')]['create'](_0x4f6381[_0xb89e('0x4b')],{})[_0xb89e('0x26')](respondWithResult(_0x2b62b7,0xc9))['catch'](handleError(_0x2b62b7,null));};exports[_0xb89e('0x25')]=function(_0x2b1eaf,_0x43329d){if(_0x2b1eaf['body']['id']){delete _0x2b1eaf[_0xb89e('0x4b')]['id'];}return db['JscriptySessionReport'][_0xb89e('0x49')]({'where':{'id':_0x2b1eaf['params']['id']}})[_0xb89e('0x26')](handleEntityNotFound(_0x43329d,null))[_0xb89e('0x26')](saveUpdates(_0x2b1eaf[_0xb89e('0x4b')],null))['then'](respondWithResult(_0x43329d,null))[_0xb89e('0x45')](handleError(_0x43329d,null));};exports[_0xb89e('0x27')]=function(_0x98da79,_0x431460){return db['JscriptySessionReport'][_0xb89e('0x49')]({'where':{'id':_0x98da79[_0xb89e('0x46')]['id']}})['then'](handleEntityNotFound(_0x431460,null))[_0xb89e('0x26')](removeEntity(_0x431460,null))[_0xb89e('0x45')](handleError(_0x431460,null));};exports[_0xb89e('0x4c')]=function(_0xe55078,_0x19f47d){return db[_0xb89e('0x47')]['describe']()[_0xb89e('0x26')](respondWithResult(_0x19f47d,null))[_0xb89e('0x45')](handleError(_0x19f47d,null));};exports[_0xb89e('0x4d')]=function(_0x595741,_0x59afc4,_0xb92f23){var _0x3cd4bb={'raw':!![],'where':{}};var _0x3f2a39={};var _0x2ed0d2={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x595741[_0xb89e('0x46')]['id']}})['then'](handleEntityNotFound(_0x59afc4,null))[_0xb89e('0x26')](function(_0x1dea0b){if(_0x1dea0b){_0x3f2a39[_0xb89e('0x31')]=_[_0xb89e('0x32')](db[_0xb89e('0x4e')][_0xb89e('0x2d')]);_0x3f2a39[_0xb89e('0x33')]=_['keys'](_0x595741['query']);_0x3f2a39[_0xb89e('0x3d')]=_[_0xb89e('0x34')](_0x3f2a39['model'],_0x3f2a39[_0xb89e('0x33')]);_0x3cd4bb[_0xb89e('0x35')]=_['intersection'](_0x3f2a39[_0xb89e('0x31')],qs['fields'](_0x595741[_0xb89e('0x33')][_0xb89e('0x36')]));_0x3cd4bb[_0xb89e('0x35')]=_0x3cd4bb['attributes'][_0xb89e('0x37')]?_0x3cd4bb[_0xb89e('0x35')]:_0x3f2a39[_0xb89e('0x31')];if(!_0x595741['query'][_0xb89e('0x38')](_0xb89e('0x4f'))){_0x3cd4bb[_0xb89e('0x20')]=qs[_0xb89e('0x20')](_0x595741[_0xb89e('0x33')]['limit']);_0x3cd4bb[_0xb89e('0x1e')]=qs['offset'](_0x595741[_0xb89e('0x33')][_0xb89e('0x1e')]);}_0x3cd4bb['order']=qs[_0xb89e('0x3a')](_0x595741[_0xb89e('0x33')][_0xb89e('0x3a')]);_0x3cd4bb[_0xb89e('0x3b')]=qs[_0xb89e('0x3d')](_[_0xb89e('0x3c')](_0x595741['query'],_0x3f2a39[_0xb89e('0x3d')]));_0x3cd4bb[_0xb89e('0x3b')][_0xb89e('0x50')]=_0x1dea0b['id'];if(_0x595741[_0xb89e('0x33')][_0xb89e('0x40')]){_0x3cd4bb[_0xb89e('0x3b')]=_[_0xb89e('0x3e')](_0x3cd4bb[_0xb89e('0x3b')],{'$or':_[_0xb89e('0x2c')](_0x3cd4bb['attributes'],function(_0x96a74b){var _0x280891={};_0x280891[_0x96a74b]={'$like':'%'+_0x595741['query'][_0xb89e('0x40')]+'%'};return _0x280891;})});}_0x3cd4bb=_[_0xb89e('0x3e')]({},_0x3cd4bb,_0x595741['options']);return db[_0xb89e('0x4e')][_0xb89e('0x21')]({'where':_0x3cd4bb[_0xb89e('0x3b')]})['then'](function(_0x3477a8){_0x2ed0d2[_0xb89e('0x21')]=_0x3477a8;if(_0x595741[_0xb89e('0x33')]['includeAll']){_0x3cd4bb[_0xb89e('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3cd4bb);})[_0xb89e('0x26')](function(_0x3e9085){_0x2ed0d2[_0xb89e('0x44')]=_0x3e9085;return _0x2ed0d2;});}})['then'](respondWithFilteredResult(_0x59afc4,_0x3cd4bb))['catch'](handleError(_0x59afc4,null));}; \ No newline at end of file +var _0x2a4c=['offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','length','hasOwnProperty','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x5d1696,_0x1a2f5b){var _0x49d673=function(_0x201ce8){while(--_0x201ce8){_0x5d1696['push'](_0x5d1696['shift']());}};_0x49d673(++_0x1a2f5b);}(_0x2a4c,0x16d));var _0xc2a4=function(_0x3a1511,_0xbf2de1){_0x3a1511=_0x3a1511-0x0;var _0x58fba0=_0x2a4c[_0x3a1511];return _0x58fba0;};'use strict';var emlformat=require(_0xc2a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc2a4('0x1'));var moment=require('moment');var BPromise=require(_0xc2a4('0x2'));var Mustache=require('mustache');var util=require(_0xc2a4('0x3'));var path=require(_0xc2a4('0x4'));var sox=require(_0xc2a4('0x5'));var csv=require(_0xc2a4('0x6'));var ejs=require(_0xc2a4('0x7'));var fs=require('fs');var fs_extra=require(_0xc2a4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2a4('0x9'));var jsforce=require(_0xc2a4('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc2a4('0xb'));var Redis=require(_0xc2a4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc2a4('0xd'));var as=require(_0xc2a4('0xe'));var hardwareService=require(_0xc2a4('0xf'));var logger=require(_0xc2a4('0x10'))(_0xc2a4('0x11'));var utils=require(_0xc2a4('0x12'));var config=require(_0xc2a4('0x13'));var licenseUtil=require(_0xc2a4('0x14'));var db=require(_0xc2a4('0x15'))['db'];function respondWithStatusCode(_0x3ef286,_0x33dd16){_0x33dd16=_0x33dd16||0xcc;return function(_0x52166a){if(_0x52166a){return _0x3ef286['sendStatus'](_0x33dd16);}return _0x3ef286[_0xc2a4('0x16')](_0x33dd16)[_0xc2a4('0x17')]();};}function respondWithResult(_0x103579,_0x3ed82f){_0x3ed82f=_0x3ed82f||0xc8;return function(_0xf7df02){if(_0xf7df02){return _0x103579[_0xc2a4('0x16')](_0x3ed82f)[_0xc2a4('0x18')](_0xf7df02);}};}function respondWithFilteredResult(_0x1b4984,_0x46d036){return function(_0x39f8ee){if(_0x39f8ee){var _0x39ccf7=typeof _0x46d036[_0xc2a4('0x19')]==='undefined'&&typeof _0x46d036['limit']===_0xc2a4('0x1a');var _0x5051c3=_0x39f8ee[_0xc2a4('0x1b')];var _0x1b737f=_0x39ccf7?0x0:_0x46d036['offset'];var _0x40e196=_0x39ccf7?_0x39f8ee['count']:_0x46d036[_0xc2a4('0x19')]+_0x46d036[_0xc2a4('0x1c')];var _0x3a8ce2;if(_0x40e196>=_0x5051c3){_0x40e196=_0x5051c3;_0x3a8ce2=0xc8;}else{_0x3a8ce2=0xce;}_0x1b4984['status'](_0x3a8ce2);return _0x1b4984['set'](_0xc2a4('0x1d'),_0x1b737f+'-'+_0x40e196+'/'+_0x5051c3)[_0xc2a4('0x18')](_0x39f8ee);}return null;};}function patchUpdates(_0x11bf50){return function(_0x3896ae){try{jsonpatch[_0xc2a4('0x1e')](_0x3896ae,_0x11bf50,!![]);}catch(_0x2fdf3f){return BPromise[_0xc2a4('0x1f')](_0x2fdf3f);}return _0x3896ae[_0xc2a4('0x20')]();};}function saveUpdates(_0x1e0704,_0x5a7bfe){return function(_0x387609){if(_0x387609){return _0x387609[_0xc2a4('0x21')](_0x1e0704)[_0xc2a4('0x22')](function(_0x47438b){return _0x47438b;});}return null;};}function removeEntity(_0x11e5b9,_0x542941){return function(_0x51def8){if(_0x51def8){return _0x51def8[_0xc2a4('0x23')]()[_0xc2a4('0x22')](function(){_0x11e5b9[_0xc2a4('0x16')](0xcc)[_0xc2a4('0x17')]();});}};}function handleEntityNotFound(_0x321d92,_0x30e79e){return function(_0x1a825a){if(!_0x1a825a){_0x321d92[_0xc2a4('0x24')](0x194);}return _0x1a825a;};}function handleError(_0x2dcfa2,_0x1657fe){_0x1657fe=_0x1657fe||0x1f4;return function(_0x1826aa){logger[_0xc2a4('0x25')](_0x1826aa[_0xc2a4('0x26')]);if(_0x1826aa[_0xc2a4('0x27')]){delete _0x1826aa['name'];}_0x2dcfa2[_0xc2a4('0x16')](_0x1657fe)[_0xc2a4('0x28')](_0x1826aa);};}exports['index']=function(_0x36f2e9,_0x50e4bd){var _0x4cc643={},_0x2c4552={},_0x539a89={'count':0x0,'rows':[]};var _0x23245f=_['map'](db[_0xc2a4('0x29')][_0xc2a4('0x2a')],function(_0x59a501){return{'name':_0x59a501[_0xc2a4('0x2b')],'type':_0x59a501[_0xc2a4('0x2c')][_0xc2a4('0x2d')]};});_0x2c4552[_0xc2a4('0x2e')]=_[_0xc2a4('0x2f')](_0x23245f,_0xc2a4('0x27'));_0x2c4552[_0xc2a4('0x30')]=_[_0xc2a4('0x31')](_0x36f2e9[_0xc2a4('0x30')]);_0x2c4552['filters']=_[_0xc2a4('0x32')](_0x2c4552[_0xc2a4('0x2e')],_0x2c4552[_0xc2a4('0x30')]);_0x4cc643['attributes']=_[_0xc2a4('0x32')](_0x2c4552[_0xc2a4('0x2e')],qs[_0xc2a4('0x33')](_0x36f2e9['query'][_0xc2a4('0x33')]));_0x4cc643[_0xc2a4('0x34')]=_0x4cc643[_0xc2a4('0x34')]['length']?_0x4cc643['attributes']:_0x2c4552[_0xc2a4('0x2e')];if(!_0x36f2e9['query']['hasOwnProperty'](_0xc2a4('0x35'))){_0x4cc643['limit']=qs[_0xc2a4('0x1c')](_0x36f2e9['query']['limit']);_0x4cc643[_0xc2a4('0x19')]=qs['offset'](_0x36f2e9[_0xc2a4('0x30')][_0xc2a4('0x19')]);}_0x4cc643[_0xc2a4('0x36')]=qs[_0xc2a4('0x37')](_0x36f2e9[_0xc2a4('0x30')][_0xc2a4('0x37')]);_0x4cc643[_0xc2a4('0x38')]=qs[_0xc2a4('0x39')](_[_0xc2a4('0x3a')](_0x36f2e9[_0xc2a4('0x30')],_0x2c4552[_0xc2a4('0x39')]),_0x23245f);if(_0x36f2e9['query'][_0xc2a4('0x3b')]){_0x4cc643[_0xc2a4('0x38')]=_[_0xc2a4('0x3c')](_0x4cc643[_0xc2a4('0x38')],{'$or':_['map'](_0x23245f,function(_0x5dfcd0){if(_0x5dfcd0[_0xc2a4('0x2c')]!==_0xc2a4('0x3d')){var _0x74bb85={};_0x74bb85[_0x5dfcd0[_0xc2a4('0x27')]]={'$like':'%'+_0x36f2e9[_0xc2a4('0x30')][_0xc2a4('0x3b')]+'%'};return _0x74bb85;}})});}_0x4cc643=_[_0xc2a4('0x3c')]({},_0x4cc643,_0x36f2e9['options']);var _0x5d41c2={'where':_0x4cc643[_0xc2a4('0x38')]};return db['JscriptySessionReport'][_0xc2a4('0x1b')](_0x5d41c2)[_0xc2a4('0x22')](function(_0x5160ed){_0x539a89['count']=_0x5160ed;if(_0x36f2e9[_0xc2a4('0x30')]['includeAll']){_0x4cc643[_0xc2a4('0x3e')]=[{'all':!![]}];}return db[_0xc2a4('0x29')][_0xc2a4('0x3f')](_0x4cc643);})[_0xc2a4('0x22')](function(_0x28261e){_0x539a89[_0xc2a4('0x40')]=_0x28261e;return _0x539a89;})[_0xc2a4('0x22')](respondWithFilteredResult(_0x50e4bd,_0x4cc643))[_0xc2a4('0x41')](handleError(_0x50e4bd,null));};exports[_0xc2a4('0x42')]=function(_0x399db8,_0x18deb7){var _0x2f10c0={'raw':!![],'where':{'id':_0x399db8[_0xc2a4('0x43')]['id']}},_0x58a030={};_0x58a030['model']=_['keys'](db[_0xc2a4('0x29')]['rawAttributes']);_0x58a030['query']=_[_0xc2a4('0x31')](_0x399db8['query']);_0x58a030['filters']=_[_0xc2a4('0x32')](_0x58a030[_0xc2a4('0x2e')],_0x58a030[_0xc2a4('0x30')]);_0x2f10c0[_0xc2a4('0x34')]=_[_0xc2a4('0x32')](_0x58a030[_0xc2a4('0x2e')],qs[_0xc2a4('0x33')](_0x399db8[_0xc2a4('0x30')][_0xc2a4('0x33')]));_0x2f10c0[_0xc2a4('0x34')]=_0x2f10c0[_0xc2a4('0x34')]['length']?_0x2f10c0[_0xc2a4('0x34')]:_0x58a030['model'];if(_0x399db8['query'][_0xc2a4('0x44')]){_0x2f10c0[_0xc2a4('0x3e')]=[{'all':!![]}];}_0x2f10c0=_[_0xc2a4('0x3c')]({},_0x2f10c0,_0x399db8['options']);return db['JscriptySessionReport'][_0xc2a4('0x45')](_0x2f10c0)[_0xc2a4('0x22')](handleEntityNotFound(_0x18deb7,null))['then'](respondWithResult(_0x18deb7,null))[_0xc2a4('0x41')](handleError(_0x18deb7,null));};exports[_0xc2a4('0x46')]=function(_0x2a7695,_0x497d96){return db[_0xc2a4('0x29')][_0xc2a4('0x46')](_0x2a7695[_0xc2a4('0x47')],{})[_0xc2a4('0x22')](respondWithResult(_0x497d96,0xc9))[_0xc2a4('0x41')](handleError(_0x497d96,null));};exports[_0xc2a4('0x21')]=function(_0x43c5ab,_0x2872c6){if(_0x43c5ab['body']['id']){delete _0x43c5ab['body']['id'];}return db['JscriptySessionReport'][_0xc2a4('0x45')]({'where':{'id':_0x43c5ab[_0xc2a4('0x43')]['id']}})[_0xc2a4('0x22')](handleEntityNotFound(_0x2872c6,null))['then'](saveUpdates(_0x43c5ab['body'],null))[_0xc2a4('0x22')](respondWithResult(_0x2872c6,null))['catch'](handleError(_0x2872c6,null));};exports['destroy']=function(_0x140079,_0x13a1d2){return db[_0xc2a4('0x29')]['find']({'where':{'id':_0x140079[_0xc2a4('0x43')]['id']}})[_0xc2a4('0x22')](handleEntityNotFound(_0x13a1d2,null))[_0xc2a4('0x22')](removeEntity(_0x13a1d2,null))[_0xc2a4('0x41')](handleError(_0x13a1d2,null));};exports[_0xc2a4('0x48')]=function(_0x9b1de0,_0x1178a4){return db[_0xc2a4('0x29')]['describe']()[_0xc2a4('0x22')](respondWithResult(_0x1178a4,null))['catch'](handleError(_0x1178a4,null));};exports[_0xc2a4('0x49')]=function(_0x81b870,_0x416f08,_0x2d2fbe){var _0x1e7a6f={'raw':!![],'where':{}};var _0x46ac39={};var _0x539961={'count':0x0,'rows':[]};return db[_0xc2a4('0x29')][_0xc2a4('0x4a')]({'where':{'id':_0x81b870[_0xc2a4('0x43')]['id']}})['then'](handleEntityNotFound(_0x416f08,null))[_0xc2a4('0x22')](function(_0x1c8648){if(_0x1c8648){_0x46ac39[_0xc2a4('0x2e')]=_[_0xc2a4('0x31')](db[_0xc2a4('0x4b')]['rawAttributes']);_0x46ac39[_0xc2a4('0x30')]=_[_0xc2a4('0x31')](_0x81b870[_0xc2a4('0x30')]);_0x46ac39['filters']=_['intersection'](_0x46ac39[_0xc2a4('0x2e')],_0x46ac39['query']);_0x1e7a6f[_0xc2a4('0x34')]=_[_0xc2a4('0x32')](_0x46ac39[_0xc2a4('0x2e')],qs['fields'](_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x33')]));_0x1e7a6f['attributes']=_0x1e7a6f[_0xc2a4('0x34')][_0xc2a4('0x4c')]?_0x1e7a6f[_0xc2a4('0x34')]:_0x46ac39[_0xc2a4('0x2e')];if(!_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x4d')](_0xc2a4('0x35'))){_0x1e7a6f[_0xc2a4('0x1c')]=qs[_0xc2a4('0x1c')](_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x1c')]);_0x1e7a6f['offset']=qs[_0xc2a4('0x19')](_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x19')]);}_0x1e7a6f[_0xc2a4('0x36')]=qs[_0xc2a4('0x37')](_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x37')]);_0x1e7a6f[_0xc2a4('0x38')]=qs['filters'](_['pick'](_0x81b870[_0xc2a4('0x30')],_0x46ac39['filters']));_0x1e7a6f[_0xc2a4('0x38')]['SessionId']=_0x1c8648['id'];if(_0x81b870['query'][_0xc2a4('0x3b')]){_0x1e7a6f['where']=_['merge'](_0x1e7a6f[_0xc2a4('0x38')],{'$or':_['map'](_0x1e7a6f[_0xc2a4('0x34')],function(_0x4dfe73){var _0x41eae8={};_0x41eae8[_0x4dfe73]={'$like':'%'+_0x81b870[_0xc2a4('0x30')][_0xc2a4('0x3b')]+'%'};return _0x41eae8;})});}_0x1e7a6f=_[_0xc2a4('0x3c')]({},_0x1e7a6f,_0x81b870['options']);return db['JscriptyQuestionReport'][_0xc2a4('0x1b')]({'where':_0x1e7a6f[_0xc2a4('0x38')]})[_0xc2a4('0x22')](function(_0x596866){_0x539961[_0xc2a4('0x1b')]=_0x596866;if(_0x81b870['query'][_0xc2a4('0x44')]){_0x1e7a6f[_0xc2a4('0x3e')]=[{'all':!![]}];}return db[_0xc2a4('0x4b')][_0xc2a4('0x3f')](_0x1e7a6f);})[_0xc2a4('0x22')](function(_0x988898){_0x539961[_0xc2a4('0x40')]=_0x988898;return _0x539961;});}})['then'](respondWithFilteredResult(_0x416f08,_0x1e7a6f))['catch'](handleError(_0x416f08,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5493821..d958313 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 _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x302ed4,_0x232afc){var _0x1fccac=function(_0x2210ef){while(--_0x2210ef){_0x302ed4['push'](_0x302ed4['shift']());}};_0x1fccac(++_0x232afc);}(_0x323f,0x1ee));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['request-promise','path','rimraf','exports','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a274f,_0x2ee9c4){var _0x191caf=function(_0x54abb6){while(--_0x54abb6){_0x5a274f['push'](_0x5a274f['shift']());}};_0x191caf(++_0x2ee9c4);}(_0xafb9,0x68));var _0x9afb=function(_0x375724,_0x57a94b){_0x375724=_0x375724-0x0;var _0x57f1a2=_0xafb9[_0x375724];return _0x57f1a2;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x9afb('0x9')]=function(_0x56a139,_0x1ccf93){return _0x56a139['define']('JscriptySessionReport',attributes,{'tableName':_0x9afb('0xa'),'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 ac6cfc3..f089585 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0x2ef3,0xba));var _0x32ef=function(_0x290f31,_0x461490){_0x290f31=_0x290f31-0x0;var _0x3b04e9=_0x2ef3[_0x290f31];return _0x3b04e9;};'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')]('JscriptySessionReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2592b3,_0x34cf6e){var _0x4fc02=function(_0x4fb772){while(--_0x4fb772){_0x2592b3['push'](_0x2592b3['shift']());}};_0x4fc02(++_0x34cf6e);}(_0x1623,0xab));var _0x3162=function(_0x21a1a1,_0x55dea3){_0x21a1a1=_0x21a1a1-0x0;var _0x8309b7=_0x1623[_0x21a1a1];return _0x8309b7;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1927b21..9d52204 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 _0x9ae7=['express','../../components/auth/service','../../components/interaction/service','./license.controller','put','/:id','isAuthenticated','get','/download_log_file','exports','multer','path'];(function(_0x2d17b5,_0x212434){var _0x34ce54=function(_0x3397da){while(--_0x3397da){_0x2d17b5['push'](_0x2d17b5['shift']());}};_0x34ce54(++_0x212434);}(_0x9ae7,0x1de));var _0x79ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ae7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x79ae('0x0'));var util=require('util');var path=require(_0x79ae('0x1'));var timeout=require('connect-timeout');var express=require(_0x79ae('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x79ae('0x3'));var interaction=require(_0x79ae('0x4'));var config=require('../../config/environment');var controller=require(_0x79ae('0x5'));router['get']('/',controller['index']);router[_0x79ae('0x6')](_0x79ae('0x7'),auth[_0x79ae('0x8')](),controller['update']);router[_0x79ae('0x9')](_0x79ae('0xa'),auth[_0x79ae('0x8')](),controller['downloadLogFile']);module[_0x79ae('0xb')]=router; \ No newline at end of file +var _0xc29a=['../../components/auth/service','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path'];(function(_0x5c77af,_0x584a4a){var _0x355e2a=function(_0x541a8f){while(--_0x541a8f){_0x5c77af['push'](_0x5c77af['shift']());}};_0x355e2a(++_0x584a4a);}(_0xc29a,0x6a));var _0xac29=function(_0x21b77d,_0x14c203){_0x21b77d=_0x21b77d-0x0;var _0x5d7252=_0xc29a[_0x21b77d];return _0x5d7252;};'use strict';var multer=require(_0xac29('0x0'));var util=require('util');var path=require(_0xac29('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xac29('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac29('0x3'));router[_0xac29('0x4')]('/',controller[_0xac29('0x5')]);router[_0xac29('0x6')](_0xac29('0x7'),auth[_0xac29('0x8')](),controller[_0xac29('0x9')]);router['get'](_0xac29('0xa'),auth[_0xac29('0x8')](),controller[_0xac29('0xb')]);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 1f838fb..0d97c9f 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 _0xa2ee=['TEXT','STRING','sequelize','exports'];(function(_0x8b519e,_0x4062f3){var _0x2d2919=function(_0x4dfcb5){while(--_0x4dfcb5){_0x8b519e['push'](_0x8b519e['shift']());}};_0x2d2919(++_0x4062f3);}(_0xa2ee,0xe2));var _0xea2e=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0xa2ee[_0x3fa296];return _0x10b19f;};'use strict';var Sequelize=require(_0xea2e('0x0'));module[_0xea2e('0x1')]={'license':{'type':Sequelize[_0xea2e('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xea2e('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5cec=['STRING','INTEGER','sequelize','exports'];(function(_0x3275ea,_0x399e52){var _0x2769e6=function(_0x374a07){while(--_0x374a07){_0x3275ea['push'](_0x3275ea['shift']());}};_0x2769e6(++_0x399e52);}(_0x5cec,0xea));var _0xc5ce=function(_0x5d4391,_0x1ff3c1){_0x5d4391=_0x5d4391-0x0;var _0xe5ad88=_0x5cec[_0x5d4391];return _0xe5ad88;};'use strict';var Sequelize=require(_0xc5ce('0x0'));module[_0xc5ce('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc5ce('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc5ce('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 a891d11..fac326d 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 _0x7140=['set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','../../config/license/util','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','downloadLogFile','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename='];(function(_0x3bfc6e,_0x33ca6e){var _0x1af4ab=function(_0x2f21f6){while(--_0x2f21f6){_0x3bfc6e['push'](_0x3bfc6e['shift']());}};_0x1af4ab(++_0x33ca6e);}(_0x7140,0xd8));var _0x0714=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x7140[_0x4de9e8];return _0x4db0de;};'use strict';var emlformat=require(_0x0714('0x0'));var rimraf=require(_0x0714('0x1'));var zipdir=require(_0x0714('0x2'));var jsonpatch=require(_0x0714('0x3'));var rp=require(_0x0714('0x4'));var moment=require('moment');var BPromise=require(_0x0714('0x5'));var Mustache=require(_0x0714('0x6'));var util=require('util');var path=require(_0x0714('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0714('0x8'));var fs=require('fs');var fs_extra=require(_0x0714('0x9'));var _=require(_0x0714('0xa'));var squel=require('squel');var crypto=require(_0x0714('0xb'));var jsforce=require(_0x0714('0xc'));var deskjs=require(_0x0714('0xd'));var toCsv=require(_0x0714('0xe'));var querystring=require(_0x0714('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0714('0x10'));var qs=require(_0x0714('0x11'));var as=require(_0x0714('0x12'));var hardwareService=require(_0x0714('0x13'));var logger=require('../../config/logger')(_0x0714('0x14'));var utils=require(_0x0714('0x15'));var config=require(_0x0714('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0714('0x17'))['db'];function respondWithStatusCode(_0x211b06,_0x2747f6){_0x2747f6=_0x2747f6||0xcc;return function(_0x3661f8){if(_0x3661f8){return _0x211b06[_0x0714('0x18')](_0x2747f6);}return _0x211b06[_0x0714('0x19')](_0x2747f6)[_0x0714('0x1a')]();};}function respondWithResult(_0x750e7a,_0x16b52f){_0x16b52f=_0x16b52f||0xc8;return function(_0x4a8f17){if(_0x4a8f17){return _0x750e7a[_0x0714('0x19')](_0x16b52f)['json'](_0x4a8f17);}};}function respondWithFilteredResult(_0x3ed2b3,_0x250ba5){return function(_0x3ae76c){if(_0x3ae76c){var _0x590aa8=typeof _0x250ba5[_0x0714('0x1b')]==='undefined'&&typeof _0x250ba5['limit']===_0x0714('0x1c');var _0xdc820d=_0x3ae76c[_0x0714('0x1d')];var _0x59f779=_0x590aa8?0x0:_0x250ba5[_0x0714('0x1b')];var _0x4aba94=_0x590aa8?_0x3ae76c[_0x0714('0x1d')]:_0x250ba5[_0x0714('0x1b')]+_0x250ba5[_0x0714('0x1e')];var _0x52f34a;if(_0x4aba94>=_0xdc820d){_0x4aba94=_0xdc820d;_0x52f34a=0xc8;}else{_0x52f34a=0xce;}_0x3ed2b3['status'](_0x52f34a);return _0x3ed2b3['set'](_0x0714('0x1f'),_0x59f779+'-'+_0x4aba94+'/'+_0xdc820d)['json'](_0x3ae76c);}return null;};}function patchUpdates(_0x387f09){return function(_0x355918){try{jsonpatch['apply'](_0x355918,_0x387f09,!![]);}catch(_0x4f11ee){return BPromise[_0x0714('0x20')](_0x4f11ee);}return _0x355918[_0x0714('0x21')]();};}function saveUpdates(_0x21dbbd,_0x9555af){return function(_0x5ca0ce){if(_0x5ca0ce){return _0x5ca0ce[_0x0714('0x22')](_0x21dbbd)[_0x0714('0x23')](function(_0x35120e){return _0x35120e;});}return null;};}function removeEntity(_0x4066dd,_0x10ef78){return function(_0x37f4ec){if(_0x37f4ec){return _0x37f4ec[_0x0714('0x24')]()[_0x0714('0x23')](function(){_0x4066dd[_0x0714('0x19')](0xcc)[_0x0714('0x1a')]();});}};}function handleEntityNotFound(_0xc8ee1e,_0x1eba44){return function(_0xead189){if(!_0xead189){_0xc8ee1e[_0x0714('0x18')](0x194);}return _0xead189;};}function handleError(_0x48f4f9,_0x39b5cd){_0x39b5cd=_0x39b5cd||0x1f4;return function(_0x1274c0){logger[_0x0714('0x25')](_0x1274c0[_0x0714('0x26')]);if(_0x1274c0[_0x0714('0x27')]){delete _0x1274c0[_0x0714('0x27')];}_0x48f4f9[_0x0714('0x19')](_0x39b5cd)[_0x0714('0x28')](_0x1274c0);};}var utilLicense=require(_0x0714('0x29'));exports['index']=function(_0x3329a3,_0x53b2b9){var _0x5745ce={'raw':!![],'where':{'id':0x1}},_0x4aa684={};_0x4aa684['model']=_['keys'](db['License'][_0x0714('0x2a')]);_0x4aa684[_0x0714('0x2b')]=_['keys'](_0x3329a3[_0x0714('0x2b')]);_0x4aa684[_0x0714('0x2c')]=_[_0x0714('0x2d')](_0x4aa684[_0x0714('0x2e')],_0x4aa684[_0x0714('0x2b')]);_0x5745ce[_0x0714('0x2f')]=_[_0x0714('0x2d')](_0x4aa684[_0x0714('0x2e')],qs[_0x0714('0x30')](_0x3329a3[_0x0714('0x2b')][_0x0714('0x30')]));_0x5745ce[_0x0714('0x2f')]=_0x5745ce[_0x0714('0x2f')][_0x0714('0x31')]?_0x5745ce['attributes']:_0x4aa684[_0x0714('0x2e')];_0x5745ce=_[_0x0714('0x32')]({},_0x5745ce,_0x3329a3[_0x0714('0x33')]);return utilLicense[_0x0714('0x34')](_0x5745ce)['then'](respondWithResult(_0x53b2b9,null))['catch'](handleError(_0x53b2b9,null));};exports[_0x0714('0x22')]=function(_0x4085aa,_0x590f63){if(_0x4085aa[_0x0714('0x35')]['id']){delete _0x4085aa['body']['id'];}return db[_0x0714('0x36')][_0x0714('0x37')]({'where':{'id':_0x4085aa[_0x0714('0x38')]['id']}})[_0x0714('0x23')](handleEntityNotFound(_0x590f63,null))[_0x0714('0x23')](function(_0x48d378){var _0x1dc75b=_0x48d378[_0x0714('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x1dc75b,_0x4085aa[_0x0714('0x35')][_0x0714('0x3a')]);})['then'](function(_0x53e4cb){if(!_0x53e4cb[_0x0714('0x3b')]){return saveUpdates(_0x4085aa[_0x0714('0x35')],null);}return _0x53e4cb;})[_0x0714('0x23')](respondWithResult(_0x590f63,null))[_0x0714('0x3c')](handleError(_0x590f63,null));};exports[_0x0714('0x3d')]=function(_0x10bb30,_0x3181c5){var _0x295e92='license-info.log';var _0x4f17a1=path[_0x0714('0x3e')](_0x0714('0x3f'),'log',_0x0714('0x40'),_0x295e92);_0x3181c5[_0x0714('0x41')](_0x0714('0x42'),_0x0714('0x43')+_0x295e92);_0x3181c5[_0x0714('0x44')](_0x0714('0x45'),'text/plain');_0x3181c5[_0x0714('0x46')](_0x4f17a1);}; \ No newline at end of file +var _0x434b=['join','/var','setHeader','attachment;\x20filename=','set','Content-Type','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','stack','name','../../config/license/util','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','merge','options','catch','body','License','find','get','checkLicense','key','demo','downloadLogFile'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x434b,0x10e));var _0xb434=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x434b[_0x421263];return _0x34e4b5;};'use strict';var emlformat=require(_0xb434('0x0'));var rimraf=require(_0xb434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb434('0x2'));var BPromise=require(_0xb434('0x3'));var Mustache=require(_0xb434('0x4'));var util=require(_0xb434('0x5'));var path=require(_0xb434('0x6'));var sox=require(_0xb434('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb434('0x8'));var _=require('lodash');var squel=require(_0xb434('0x9'));var crypto=require('crypto');var jsforce=require(_0xb434('0xa'));var deskjs=require(_0xb434('0xb'));var toCsv=require(_0xb434('0xc'));var querystring=require(_0xb434('0xd'));var Papa=require(_0xb434('0xe'));var Redis=require(_0xb434('0xf'));var authService=require(_0xb434('0x10'));var qs=require(_0xb434('0x11'));var as=require(_0xb434('0x12'));var hardwareService=require(_0xb434('0x13'));var logger=require(_0xb434('0x14'))(_0xb434('0x15'));var utils=require('../../config/utils');var config=require(_0xb434('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b564b,_0x291040){_0x291040=_0x291040||0xcc;return function(_0x557ea0){if(_0x557ea0){return _0x2b564b[_0xb434('0x17')](_0x291040);}return _0x2b564b['status'](_0x291040)[_0xb434('0x18')]();};}function respondWithResult(_0x541025,_0x4d41fc){_0x4d41fc=_0x4d41fc||0xc8;return function(_0xdff2d0){if(_0xdff2d0){return _0x541025[_0xb434('0x19')](_0x4d41fc)[_0xb434('0x1a')](_0xdff2d0);}};}function respondWithFilteredResult(_0x28c078,_0x36cc40){return function(_0x236e33){if(_0x236e33){var _0x186dad=typeof _0x36cc40['offset']===_0xb434('0x1b')&&typeof _0x36cc40[_0xb434('0x1c')]==='undefined';var _0x30739e=_0x236e33[_0xb434('0x1d')];var _0x27398b=_0x186dad?0x0:_0x36cc40[_0xb434('0x1e')];var _0x2501e4=_0x186dad?_0x236e33[_0xb434('0x1d')]:_0x36cc40[_0xb434('0x1e')]+_0x36cc40[_0xb434('0x1c')];var _0x274f55;if(_0x2501e4>=_0x30739e){_0x2501e4=_0x30739e;_0x274f55=0xc8;}else{_0x274f55=0xce;}_0x28c078['status'](_0x274f55);return _0x28c078['set']('Content-Range',_0x27398b+'-'+_0x2501e4+'/'+_0x30739e)[_0xb434('0x1a')](_0x236e33);}return null;};}function patchUpdates(_0x2b990c){return function(_0x4f9298){try{jsonpatch[_0xb434('0x1f')](_0x4f9298,_0x2b990c,!![]);}catch(_0x5478ca){return BPromise[_0xb434('0x20')](_0x5478ca);}return _0x4f9298[_0xb434('0x21')]();};}function saveUpdates(_0x125b76,_0xf4e3e1){return function(_0x46d1c5){if(_0x46d1c5){return _0x46d1c5[_0xb434('0x22')](_0x125b76)[_0xb434('0x23')](function(_0x264a25){return _0x264a25;});}return null;};}function removeEntity(_0x336a1a,_0x498951){return function(_0x473bec){if(_0x473bec){return _0x473bec[_0xb434('0x24')]()[_0xb434('0x23')](function(){_0x336a1a[_0xb434('0x19')](0xcc)[_0xb434('0x18')]();});}};}function handleEntityNotFound(_0x410144,_0x59a9e7){return function(_0x451a35){if(!_0x451a35){_0x410144[_0xb434('0x17')](0x194);}return _0x451a35;};}function handleError(_0x12967e,_0x7ad8a1){_0x7ad8a1=_0x7ad8a1||0x1f4;return function(_0x13fb92){logger['error'](_0x13fb92[_0xb434('0x25')]);if(_0x13fb92[_0xb434('0x26')]){delete _0x13fb92[_0xb434('0x26')];}_0x12967e[_0xb434('0x19')](_0x7ad8a1)['send'](_0x13fb92);};}var utilLicense=require(_0xb434('0x27'));exports['index']=function(_0x12b29c,_0x562a3a){var _0x516575={'raw':!![],'where':{'id':0x1}},_0x5d2e74={};_0x5d2e74['model']=_['keys'](db['License'][_0xb434('0x28')]);_0x5d2e74[_0xb434('0x29')]=_[_0xb434('0x2a')](_0x12b29c['query']);_0x5d2e74[_0xb434('0x2b')]=_[_0xb434('0x2c')](_0x5d2e74['model'],_0x5d2e74['query']);_0x516575[_0xb434('0x2d')]=_['intersection'](_0x5d2e74[_0xb434('0x2e')],qs['fields'](_0x12b29c[_0xb434('0x29')][_0xb434('0x2f')]));_0x516575[_0xb434('0x2d')]=_0x516575[_0xb434('0x2d')][_0xb434('0x30')]?_0x516575[_0xb434('0x2d')]:_0x5d2e74[_0xb434('0x2e')];_0x516575=_[_0xb434('0x31')]({},_0x516575,_0x12b29c[_0xb434('0x32')]);return utilLicense['getLicense'](_0x516575)[_0xb434('0x23')](respondWithResult(_0x562a3a,null))[_0xb434('0x33')](handleError(_0x562a3a,null));};exports[_0xb434('0x22')]=function(_0x139883,_0x12b1fc){if(_0x139883['body']['id']){delete _0x139883[_0xb434('0x34')]['id'];}return db[_0xb434('0x35')][_0xb434('0x36')]({'where':{'id':_0x139883['params']['id']}})['then'](handleEntityNotFound(_0x12b1fc,null))[_0xb434('0x23')](function(_0x50158f){var _0x231102=_0x50158f[_0xb434('0x37')]({'plain':!![]});return utilLicense[_0xb434('0x38')](_0x231102,_0x139883[_0xb434('0x34')][_0xb434('0x39')]);})[_0xb434('0x23')](function(_0x1a1a04){if(!_0x1a1a04[_0xb434('0x3a')]){return saveUpdates(_0x139883[_0xb434('0x34')],null);}return _0x1a1a04;})[_0xb434('0x23')](respondWithResult(_0x12b1fc,null))['catch'](handleError(_0x12b1fc,null));};exports[_0xb434('0x3b')]=function(_0x30f3a9,_0x142427){var _0x3d2393='license-info.log';var _0x507528=path[_0xb434('0x3c')](_0xb434('0x3d'),'log','xcally',_0x3d2393);_0x142427[_0xb434('0x3e')]('Content-disposition',_0xb434('0x3f')+_0x3d2393);_0x142427[_0xb434('0x40')](_0xb434('0x41'),'text/plain');_0x142427['download'](_0x507528);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0c8748f..2334edb 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 _0x7cfe=['rimraf','../../config/environment','exports','define','license','lodash','api','moment','bluebird','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7cfe,0x94));var _0xe7cf=function(_0x400911,_0xd82c7a){_0x400911=_0x400911-0x0;var _0x1f3b2f=_0x7cfe[_0x400911];return _0x1f3b2f;};'use strict';var _=require(_0xe7cf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe7cf('0x1'));var moment=require(_0xe7cf('0x2'));var BPromise=require(_0xe7cf('0x3'));var rp=require(_0xe7cf('0x4'));var fs=require('fs');var path=require(_0xe7cf('0x5'));var rimraf=require(_0xe7cf('0x6'));var config=require(_0xe7cf('0x7'));var attributes=require('./license.attributes');module[_0xe7cf('0x8')]=function(_0x430d41,_0x3a7764){return _0x430d41[_0xe7cf('0x9')]('License',attributes,{'tableName':_0xe7cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59c2=['./license.attributes','define','License','license','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x45f989,_0x261e8b){var _0x429bfd=function(_0x5edcc2){while(--_0x5edcc2){_0x45f989['push'](_0x45f989['shift']());}};_0x429bfd(++_0x261e8b);}(_0x59c2,0xa0));var _0x259c=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x59c2[_0x3bceea];return _0x30a8d3;};'use strict';var _=require(_0x259c('0x0'));var util=require(_0x259c('0x1'));var logger=require(_0x259c('0x2'))(_0x259c('0x3'));var moment=require(_0x259c('0x4'));var BPromise=require(_0x259c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x259c('0x6'));var rimraf=require(_0x259c('0x7'));var config=require(_0x259c('0x8'));var attributes=require(_0x259c('0x9'));module['exports']=function(_0x4b3f0c,_0x537068){return _0x4b3f0c[_0x259c('0xa')](_0x259c('0xb'),attributes,{'tableName':_0x259c('0xc'),'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 97727d5..5759336 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 _0x7835=['request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','code','error','message','License,\x20%s,\x20%s','catch','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x7835,0x7a));var _0x5783=function(_0x3e6016,_0x46f40f){_0x3e6016=_0x3e6016-0x0;var _0x2f2190=_0x7835[_0x3e6016];return _0x2f2190;};'use strict';var _=require(_0x5783('0x0'));var util=require(_0x5783('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(_0x5783('0x2'));var logger=require(_0x5783('0x3'))(_0x5783('0x4'));var config=require(_0x5783('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5783('0x6')][_0x5783('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x218cec,_0x199cd2,_0x4a8114){return new BPromise(function(_0x1ee5e3,_0x252cac){return client[_0x5783('0x8')](_0x218cec,_0x4a8114)[_0x5783('0x9')](function(_0x524eb7){logger[_0x5783('0xa')]('License,\x20%s,\x20%s',_0x199cd2,_0x5783('0xb'));logger['debug'](_0x5783('0xc'),_0x199cd2,_0x5783('0xb'),JSON[_0x5783('0xd')](_0x524eb7));if(_0x524eb7['error']){if(_0x524eb7['error'][_0x5783('0xe')]===0x1f4){logger[_0x5783('0xf')]('License,\x20%s,\x20%s',_0x199cd2,_0x524eb7[_0x5783('0xf')]['message']);return _0x252cac(_0x524eb7[_0x5783('0xf')][_0x5783('0x10')]);}logger[_0x5783('0xf')](_0x5783('0x11'),_0x199cd2,_0x524eb7[_0x5783('0xf')][_0x5783('0x10')]);return _0x1ee5e3(_0x524eb7[_0x5783('0xf')][_0x5783('0x10')]);}else{logger[_0x5783('0xa')](_0x5783('0x11'),_0x199cd2,_0x5783('0xb'));_0x1ee5e3(_0x524eb7['result'][_0x5783('0x10')]);}})[_0x5783('0x12')](function(_0x34953a){logger[_0x5783('0xf')](_0x5783('0x11'),_0x199cd2,_0x34953a);_0x252cac(_0x34953a);});});} \ No newline at end of file +var _0x6f83=['then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x133921,_0x2322e9){var _0x50d633=function(_0x4dce1d){while(--_0x4dce1d){_0x133921['push'](_0x133921['shift']());}};_0x50d633(++_0x2322e9);}(_0x6f83,0x88));var _0x36f8=function(_0x3955b0,_0x1e21d7){_0x3955b0=_0x3955b0-0x0;var _0x31a2b4=_0x6f83[_0x3955b0];return _0x31a2b4;};'use strict';var _=require(_0x36f8('0x0'));var util=require(_0x36f8('0x1'));var moment=require('moment');var BPromise=require(_0x36f8('0x2'));var rs=require(_0x36f8('0x3'));var fs=require('fs');var Redis=require(_0x36f8('0x4'));var db=require(_0x36f8('0x5'))['db'];var utils=require(_0x36f8('0x6'));var logger=require('../../config/logger')(_0x36f8('0x7'));var config=require(_0x36f8('0x8'));var jayson=require(_0x36f8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae70d,_0x105c72,_0x3450e3){return new BPromise(function(_0xa5778c,_0x34454f){return client[_0x36f8('0xa')](_0x2ae70d,_0x3450e3)[_0x36f8('0xb')](function(_0x44c323){logger[_0x36f8('0xc')](_0x36f8('0xd'),_0x105c72,_0x36f8('0xe'));logger['debug'](_0x36f8('0xf'),_0x105c72,_0x36f8('0xe'),JSON[_0x36f8('0x10')](_0x44c323));if(_0x44c323[_0x36f8('0x11')]){if(_0x44c323[_0x36f8('0x11')]['code']===0x1f4){logger[_0x36f8('0x11')](_0x36f8('0xd'),_0x105c72,_0x44c323['error']['message']);return _0x34454f(_0x44c323['error']['message']);}logger['error'](_0x36f8('0xd'),_0x105c72,_0x44c323[_0x36f8('0x11')][_0x36f8('0x12')]);return _0xa5778c(_0x44c323[_0x36f8('0x11')][_0x36f8('0x12')]);}else{logger[_0x36f8('0xc')](_0x36f8('0xd'),_0x105c72,_0x36f8('0xe'));_0xa5778c(_0x44c323[_0x36f8('0x13')][_0x36f8('0x12')]);}})[_0x36f8('0x14')](function(_0x53ba94){logger[_0x36f8('0x11')](_0x36f8('0xd'),_0x105c72,_0x53ba94);_0x34454f(_0x53ba94);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 97b0fd9..383d1ef 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 _0x75c9=['getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','delete','removeAnswers','removeSmtp','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x75c9,0x1af));var _0x975c=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x75c9[_0x21090b];return _0x3c68d7;};'use strict';var multer=require(_0x975c('0x0'));var util=require(_0x975c('0x1'));var path=require(_0x975c('0x2'));var timeout=require(_0x975c('0x3'));var express=require(_0x975c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x975c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x975c('0x6'));var controller=require('./mailAccount.controller');router[_0x975c('0x7')]('/',auth['isAuthenticated'](),controller[_0x975c('0x8')]);router[_0x975c('0x7')](_0x975c('0x9'),auth['isAuthenticated'](),controller[_0x975c('0xa')]);router[_0x975c('0x7')](_0x975c('0xb'),auth[_0x975c('0xc')](),controller[_0x975c('0xd')]);router[_0x975c('0x7')](_0x975c('0xe'),auth[_0x975c('0xc')](),controller[_0x975c('0xf')]);router[_0x975c('0x7')](_0x975c('0x10'),auth[_0x975c('0xc')](),controller[_0x975c('0x11')]);router[_0x975c('0x7')](_0x975c('0x12'),auth['isAuthenticated'](),controller[_0x975c('0x13')]);router['get'](_0x975c('0x14'),auth['isAuthenticated'](),controller[_0x975c('0x15')]);router[_0x975c('0x7')](_0x975c('0x16'),auth[_0x975c('0xc')](),controller['getInteractions']);router['get'](_0x975c('0x17'),auth[_0x975c('0xc')](),controller[_0x975c('0x18')]);router[_0x975c('0x7')](_0x975c('0x19'),auth[_0x975c('0xc')](),controller[_0x975c('0x1a')]);router[_0x975c('0x7')](_0x975c('0x1b'),auth[_0x975c('0xc')](),controller[_0x975c('0x1c')]);router[_0x975c('0x7')]('/:id/users',auth[_0x975c('0xc')](),controller[_0x975c('0x1d')]);router[_0x975c('0x1e')](_0x975c('0xe'),auth['isAuthenticated'](),controller[_0x975c('0x1f')]);router[_0x975c('0x1e')](_0x975c('0x10'),auth['isAuthenticated'](),controller[_0x975c('0x20')]);router[_0x975c('0x1e')]('/',auth[_0x975c('0xc')](),controller['create']);router[_0x975c('0x1e')](_0x975c('0x12'),auth[_0x975c('0xc')](),controller[_0x975c('0x21')]);router[_0x975c('0x1e')](_0x975c('0x14'),auth[_0x975c('0xc')](),controller[_0x975c('0x22')]);router['post'](_0x975c('0x16'),auth['isAuthenticated'](),controller[_0x975c('0x23')]);router[_0x975c('0x1e')](_0x975c('0x17'),auth[_0x975c('0xc')](),controller[_0x975c('0x24')]);router['post']('/:id/send',auth[_0x975c('0xc')](),controller[_0x975c('0x25')]);router['post'](_0x975c('0x26'),auth[_0x975c('0xc')](),controller[_0x975c('0x27')]);router['put']('/:id',auth[_0x975c('0xc')](),controller[_0x975c('0x28')]);router[_0x975c('0x29')](_0x975c('0xe'),auth[_0x975c('0xc')](),controller['removeDispositions']);router[_0x975c('0x29')](_0x975c('0x10'),auth[_0x975c('0xc')](),controller[_0x975c('0x2a')]);router[_0x975c('0x29')]('/:id/in_servers',auth[_0x975c('0xc')](),controller['removeImap']);router[_0x975c('0x29')](_0x975c('0x14'),auth[_0x975c('0xc')](),controller[_0x975c('0x2b')]);router[_0x975c('0x29')](_0x975c('0xb'),auth[_0x975c('0xc')](),controller['destroy']);router[_0x975c('0x29')](_0x975c('0x26'),auth[_0x975c('0xc')](),controller['removeAgents']);module[_0x975c('0x2c')]=router; \ No newline at end of file +var _0x950a=['/:id/users','getAgents','post','addDisposition','addImap','addSmtp','/:id/interactions','/:id/applications','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/messages','getMessages','/:id/verify','verifySmtp'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x950a,0x1da));var _0xa950=function(_0x4bd928,_0x5279df){_0x4bd928=_0x4bd928-0x0;var _0x5051c2=_0x950a[_0x4bd928];return _0x5051c2;};'use strict';var multer=require(_0xa950('0x0'));var util=require('util');var path=require(_0xa950('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa950('0x2'));var interaction=require(_0xa950('0x3'));var config=require('../../config/environment');var controller=require(_0xa950('0x4'));router[_0xa950('0x5')]('/',auth[_0xa950('0x6')](),controller['index']);router[_0xa950('0x5')]('/describe',auth[_0xa950('0x6')](),controller[_0xa950('0x7')]);router[_0xa950('0x5')](_0xa950('0x8'),auth[_0xa950('0x6')](),controller[_0xa950('0x9')]);router[_0xa950('0x5')](_0xa950('0xa'),auth[_0xa950('0x6')](),controller[_0xa950('0xb')]);router[_0xa950('0x5')](_0xa950('0xc'),auth[_0xa950('0x6')](),controller['getAnswers']);router['get'](_0xa950('0xd'),auth[_0xa950('0x6')](),controller['getImap']);router['get'](_0xa950('0xe'),auth['isAuthenticated'](),controller[_0xa950('0xf')]);router[_0xa950('0x5')]('/:id/interactions',auth[_0xa950('0x6')](),controller['getInteractions']);router[_0xa950('0x5')]('/:id/applications',auth[_0xa950('0x6')](),controller['getApplications']);router['get'](_0xa950('0x10'),auth[_0xa950('0x6')](),controller[_0xa950('0x11')]);router[_0xa950('0x5')](_0xa950('0x12'),auth[_0xa950('0x6')](),controller[_0xa950('0x13')]);router[_0xa950('0x5')](_0xa950('0x14'),auth[_0xa950('0x6')](),controller[_0xa950('0x15')]);router[_0xa950('0x16')](_0xa950('0xa'),auth[_0xa950('0x6')](),controller[_0xa950('0x17')]);router[_0xa950('0x16')](_0xa950('0xc'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xa950('0x16')]('/',auth[_0xa950('0x6')](),controller['create']);router[_0xa950('0x16')](_0xa950('0xd'),auth[_0xa950('0x6')](),controller[_0xa950('0x18')]);router['post'](_0xa950('0xe'),auth[_0xa950('0x6')](),controller[_0xa950('0x19')]);router['post'](_0xa950('0x1a'),auth[_0xa950('0x6')](),controller['addInteraction']);router[_0xa950('0x16')](_0xa950('0x1b'),auth[_0xa950('0x6')](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xa950('0x16')](_0xa950('0x14'),auth[_0xa950('0x6')](),controller[_0xa950('0x1c')]);router[_0xa950('0x1d')]('/:id',auth[_0xa950('0x6')](),controller[_0xa950('0x1e')]);router['delete']('/:id/dispositions',auth[_0xa950('0x6')](),controller[_0xa950('0x1f')]);router[_0xa950('0x20')](_0xa950('0xc'),auth[_0xa950('0x6')](),controller[_0xa950('0x21')]);router['delete'](_0xa950('0xd'),auth['isAuthenticated'](),controller[_0xa950('0x22')]);router[_0xa950('0x20')](_0xa950('0xe'),auth['isAuthenticated'](),controller[_0xa950('0x23')]);router[_0xa950('0x20')](_0xa950('0x8'),auth['isAuthenticated'](),controller[_0xa950('0x24')]);router[_0xa950('0x20')]('/:id/users',auth[_0xa950('0x6')](),controller['removeAgents']);module[_0xa950('0x25')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 49aced9..5c3bf9f 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 _0xfef8=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','yahoo','getDataValue','custom','provider'];(function(_0x54e100,_0x309a9c){var _0x5512b6=function(_0x4bf699){while(--_0x4bf699){_0x54e100['push'](_0x54e100['shift']());}};_0x5512b6(++_0x309a9c);}(_0xfef8,0x17a));var _0x8fef=function(_0x36f806,_0x3df0f2){_0x36f806=_0x36f806-0x0;var _0x4c28d1=_0xfef8[_0x36f806];return _0x4c28d1;};'use strict';var Sequelize=require(_0x8fef('0x0'));module[_0x8fef('0x1')]={'description':{'type':Sequelize[_0x8fef('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8fef('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8fef('0x4')]},'markAsUnread':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8fef('0x2')],'allowNull':![],'defaultValue':_0x8fef('0x5')},'fontSize':{'type':Sequelize[_0x8fef('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8fef('0x4')],'defaultValue':function(){return _0x8fef('0x7');}},'notificationSound':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8fef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8fef('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x8fef('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8fef('0x3')],'defaultValue':![],'comment':_0x8fef('0x9'),'set':function(_0x665894){if(!_0x665894)this[_0x8fef('0xa')](_0x8fef('0xb'),null);this[_0x8fef('0xa')](_0x8fef('0xc'),_0x665894);}},'provider':{'type':Sequelize['ENUM'](_0x8fef('0xd'),'hotmail',_0x8fef('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x8fef('0xf')]('provider'))return _0x8fef('0x10');return this[_0x8fef('0xf')](_0x8fef('0x11'));},'set':function(_0xf15360){if(_0xf15360===_0x8fef('0x10'))_0xf15360=null;return this[_0x8fef('0xa')](_0x8fef('0x11'),_0xf15360);}}}; \ No newline at end of file +var _0xf117=['hotmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf117,0x16e));var _0x7f11=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf117[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x7f11('0x0'));module[_0x7f11('0x1')]={'description':{'type':Sequelize[_0x7f11('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x7f11('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x7f11('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7f11('0x2')],'allowNull':![],'defaultValue':_0x7f11('0x4')},'fontSize':{'type':Sequelize[_0x7f11('0x5')](0x2)[_0x7f11('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7f11('0x7')],'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[_0x7f11('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7f11('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f11('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f11('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f11('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f11('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f11('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x7f11('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7f11('0x9'),'set':function(_0x39d111){if(!_0x39d111)this['setDataValue'](_0x7f11('0xa'),null);this[_0x7f11('0xb')](_0x7f11('0xc'),_0x39d111);}},'provider':{'type':Sequelize[_0x7f11('0xd')]('gmail',_0x7f11('0xe'),_0x7f11('0xf'),_0x7f11('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x7f11('0x11')))return _0x7f11('0x12');return this[_0x7f11('0x13')](_0x7f11('0x11'));},'set':function(_0x1db15a){if(_0x1db15a==='custom')_0x1db15a=null;return this['setDataValue'](_0x7f11('0x11'),_0x1db15a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4381807..b864686 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 _0xf38c=['User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','basename','SendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','update','then','destroy','get','MailAccounts','UserProfileResource','name','gmail','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','yahoo','smtp.mail.yahoo.com','outlook365','smtp.office365.com','username','password','modernAuthentication','CloudProviderId','pass','port','host','service','authentication','user','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','keys','include','find','body','provider','custom','secure','params','MailServerOut','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact'];(function(_0x31f6d4,_0x44e78f){var _0x4c6930=function(_0x2b575d){while(--_0x2b575d){_0x31f6d4['push'](_0x31f6d4['shift']());}};_0x4c6930(++_0x44e78f);}(_0xf38c,0x1bb));var _0xcf38=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf38c[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xcf38('0x0'));var BPromise=require(_0xcf38('0x1'));var util=require(_0xcf38('0x2'));var path=require(_0xcf38('0x3'));var _=require(_0xcf38('0x4'));var juice=require(_0xcf38('0x5'));var Redis=require(_0xcf38('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xcf38('0x7'))(_0xcf38('0x8'));var config=require(_0xcf38('0x9'));var db=require('../../mysqldb')['db'];config[_0xcf38('0xa')]=_['defaults'](config[_0xcf38('0xa')],{'host':_0xcf38('0xb'),'port':0x18eb});var socket=require(_0xcf38('0xc'))(new Redis(config[_0xcf38('0xa')]));require(_0xcf38('0xd'))[_0xcf38('0xe')](socket);var jayson=require(_0xcf38('0xf'));var client=jayson[_0xcf38('0x10')][_0xcf38('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x38cbf8,_0x58ed93,_0x16756f,_0x3ddd6a){return new BPromise(function(_0x2031a1,_0x491988){var _0x15ab16=_0x3ddd6a||client;return _0x15ab16[_0xcf38('0x12')](_0x38cbf8,_0x16756f)['then'](function(_0x1b3566){logger[_0xcf38('0x13')](_0xcf38('0x14'),_0x58ed93,_0xcf38('0x15'));logger[_0xcf38('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x58ed93,_0xcf38('0x15'),JSON['stringify'](_0x1b3566));if(_0x1b3566[_0xcf38('0x17')]){if(_0x1b3566[_0xcf38('0x17')]['code']===0x1f4){logger[_0xcf38('0x17')](_0xcf38('0x14'),_0x58ed93,_0x1b3566['error'][_0xcf38('0x18')]);return _0x491988(_0x1b3566[_0xcf38('0x17')][_0xcf38('0x18')]);}logger[_0xcf38('0x17')]('MailAccount,\x20%s,\x20%s',_0x58ed93,_0x1b3566[_0xcf38('0x17')][_0xcf38('0x18')]);return _0x2031a1(_0x1b3566[_0xcf38('0x17')][_0xcf38('0x18')]);}else{logger['info'](_0xcf38('0x14'),_0x58ed93,_0xcf38('0x15'));_0x2031a1(_0x1b3566[_0xcf38('0x19')][_0xcf38('0x18')]);}})[_0xcf38('0x1a')](function(_0xe10020){logger[_0xcf38('0x17')](_0xcf38('0x14'),_0x58ed93,_0xe10020);_0x491988(_0xe10020);});});}function respondWithStatusCode(_0x5f2eff,_0x13aa2d){_0x13aa2d=_0x13aa2d||0xcc;return function(_0x40ee5c){if(_0x40ee5c){return _0x5f2eff[_0xcf38('0x1b')](_0x13aa2d);}return _0x5f2eff[_0xcf38('0x1c')](_0x13aa2d)['end']();};}function respondWithResult(_0x519549,_0x298ce0){_0x298ce0=_0x298ce0||0xc8;return function(_0x2c0c22){if(_0x2c0c22){return _0x519549['status'](_0x298ce0)['json'](_0x2c0c22);}};}function respondWithFilteredResult(_0x2ecd1a,_0x3a6e92){return function(_0x460061){if(_0x460061){var _0x3cd7b5=typeof _0x3a6e92[_0xcf38('0x1d')]===_0xcf38('0x1e')&&typeof _0x3a6e92[_0xcf38('0x1f')]===_0xcf38('0x1e');var _0x4e1984=_0x460061[_0xcf38('0x20')];var _0x2e8b17=_0x3cd7b5?0x0:_0x3a6e92[_0xcf38('0x1d')];var _0x30e571=_0x3cd7b5?_0x460061['count']:_0x3a6e92[_0xcf38('0x1d')]+_0x3a6e92['limit'];var _0x31ef12;if(_0x30e571>=_0x4e1984){_0x30e571=_0x4e1984;_0x31ef12=0xc8;}else{_0x31ef12=0xce;}_0x2ecd1a['status'](_0x31ef12);return _0x2ecd1a[_0xcf38('0x21')]('Content-Range',_0x2e8b17+'-'+_0x30e571+'/'+_0x4e1984)['json'](_0x460061);}return null;};}function saveUpdates(_0x9cd4f5){return function(_0x4b4d0d){if(_0x4b4d0d){return _0x4b4d0d[_0xcf38('0x22')](_0x9cd4f5)[_0xcf38('0x23')](function(_0x248320){return _0x248320;});}return null;};}function removeEntity(_0x11a7cb){return function(_0x116923){if(_0x116923){return _0x116923[_0xcf38('0x24')]()[_0xcf38('0x23')](function(){var _0x427477=_0x116923[_0xcf38('0x25')]({'plain':!![]});var _0x8be2d0=_0xcf38('0x26');return db[_0xcf38('0x27')][_0xcf38('0x24')]({'where':{'type':_0x8be2d0,'resourceId':_0x427477['id']}})[_0xcf38('0x23')](function(){return _0x116923;});})[_0xcf38('0x23')](function(){_0x11a7cb[_0xcf38('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x867bc1){return function(_0x27bb97){if(!_0x27bb97){_0x867bc1['sendStatus'](0x194);}return _0x27bb97;};}function handleError(_0x3d79c4,_0x58b0ac){_0x58b0ac=_0x58b0ac||0x1f4;return function(_0x4468ed){logger[_0xcf38('0x17')](_0x4468ed['stack']);if(_0x4468ed[_0xcf38('0x28')]){delete _0x4468ed[_0xcf38('0x28')];}_0x3d79c4[_0xcf38('0x1c')](_0x58b0ac)['send'](_0x4468ed);};}function getImapHost(_0x1a172b){switch(_0x1a172b){case _0xcf38('0x29'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0xcf38('0x2a'):return'imap-mail.outlook.com';case'outlook365':return _0xcf38('0x2b');}throw new Error(_0xcf38('0x2c'),_0x1a172b);}function getSmtpHost(_0x26ab52){switch(_0x26ab52){case _0xcf38('0x29'):return'smtp.gmail.com';case _0xcf38('0x2d'):return _0xcf38('0x2e');case'hotmail':return'smtp-mail.outlook.com';case _0xcf38('0x2f'):return _0xcf38('0x30');}throw new Error(_0xcf38('0x2c'),_0x26ab52);}function getAuthenticationOptions(_0x42d150,_0x35ab6a){var _0x262d0b={};var _0x1cace4={};if(_0x42d150){_0x262d0b['user']=_0x1cace4['user']=_0x35ab6a[_0xcf38('0x31')];_0x262d0b[_0xcf38('0x32')]=_0x1cace4['pass']=_0x35ab6a[_0xcf38('0x32')];if(_0x35ab6a[_0xcf38('0x33')]){_0x262d0b[_0xcf38('0x33')]=_0x1cace4[_0xcf38('0x33')]=!![];_0x262d0b[_0xcf38('0x34')]=_0x1cace4['CloudProviderId']=_0x35ab6a['CloudProviderId'];_0x262d0b['password']=_0x1cace4[_0xcf38('0x35')]=null;}else{_0x262d0b['CloudProviderId']=_0x1cace4[_0xcf38('0x34')]=null;}_0x262d0b['host']=getImapHost(_0x42d150);_0x262d0b[_0xcf38('0x36')]=0x3e1;_0x1cace4[_0xcf38('0x37')]=getSmtpHost(_0x42d150);_0x1cace4[_0xcf38('0x36')]=0x24b;_0x1cace4['secure']=![];_0x262d0b['service']=_0x1cace4[_0xcf38('0x38')]=null;}else{if(_0x35ab6a[_0xcf38('0x39')]){_0x262d0b[_0xcf38('0x3a')]=_0x1cace4[_0xcf38('0x3a')]=_0x35ab6a[_0xcf38('0x31')];_0x262d0b['password']=_0x1cace4['pass']=_0x35ab6a[_0xcf38('0x32')];}else{_0x262d0b['authentication']=_0x1cace4[_0xcf38('0x39')]=![];_0x262d0b[_0xcf38('0x3a')]=_0x1cace4['user']=null;_0x262d0b['password']=_0x1cace4[_0xcf38('0x35')]=null;}_0x262d0b[_0xcf38('0x37')]=_0x35ab6a[_0xcf38('0x3b')][_0xcf38('0x37')];_0x262d0b['port']=_0x35ab6a[_0xcf38('0x3b')][_0xcf38('0x36')];_0x1cace4[_0xcf38('0x37')]=_0x35ab6a[_0xcf38('0x3c')][_0xcf38('0x37')];_0x1cace4['port']=_0x35ab6a['Smtp'][_0xcf38('0x36')];}return{'Imap':_0x262d0b,'Smtp':_0x1cace4};}exports['index']=function(_0x2e5c42,_0x2a8cc6){var _0x2c54d5={'include':[{'model':db[_0xcf38('0x3d')],'as':_0xcf38('0x3b')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xcf38('0x3e')],'as':_0xcf38('0x3f')}]},_0x2fe1c7={},_0x437a30={'count':0x0,'rows':[]};var _0x5d739d=_[_0xcf38('0x40')](db[_0xcf38('0x41')][_0xcf38('0x42')],function(_0x2a5df5){return{'name':_0x2a5df5[_0xcf38('0x43')],'type':_0x2a5df5[_0xcf38('0x44')][_0xcf38('0x45')]};});_0x2fe1c7[_0xcf38('0x46')]=_[_0xcf38('0x40')](_0x5d739d,_0xcf38('0x28'));_0x2fe1c7[_0xcf38('0x47')]=_['keys'](_0x2e5c42['query']);_0x2fe1c7['filters']=_[_0xcf38('0x48')](_0x2fe1c7[_0xcf38('0x46')],_0x2fe1c7['query']);_0x2c54d5[_0xcf38('0x49')]=_[_0xcf38('0x48')](_0x2fe1c7[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x4a')]));_0x2c54d5[_0xcf38('0x49')]=_0x2c54d5[_0xcf38('0x49')][_0xcf38('0x4b')]?_0x2c54d5[_0xcf38('0x49')]:_0x2fe1c7[_0xcf38('0x46')];if(!_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x4c')](_0xcf38('0x4d'))){_0x2c54d5[_0xcf38('0x1f')]=qs['limit'](_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x1f')]);_0x2c54d5[_0xcf38('0x1d')]=qs[_0xcf38('0x1d')](_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x1d')]);}_0x2c54d5['order']=qs[_0xcf38('0x4e')](_0x2e5c42[_0xcf38('0x47')]['sort']);_0x2c54d5[_0xcf38('0x4f')]=qs[_0xcf38('0x50')](_[_0xcf38('0x51')](_0x2e5c42['query'],_0x2fe1c7[_0xcf38('0x50')]),_0x5d739d);if(_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x52')]){_0x2c54d5[_0xcf38('0x4f')]=_['merge'](_0x2c54d5[_0xcf38('0x4f')],{'$or':_['map'](_0x5d739d,function(_0x29ba1c){if(_0x29ba1c['type']!==_0xcf38('0x53')){var _0x55e851={};_0x55e851[_0x29ba1c[_0xcf38('0x28')]]={'$like':'%'+_0x2e5c42['query'][_0xcf38('0x52')]+'%'};return _0x55e851;}})});}_0x2c54d5=_[_0xcf38('0x54')]({},_0x2c54d5,_0x2e5c42[_0xcf38('0x55')]);var _0x2b70f2={'where':_0x2c54d5[_0xcf38('0x4f')]};return db[_0xcf38('0x41')][_0xcf38('0x20')](_0x2b70f2)['then'](function(_0x41f25c){_0x437a30[_0xcf38('0x20')]=_0x41f25c;if(_0x2e5c42[_0xcf38('0x47')][_0xcf38('0x56')]){_0x2c54d5['include']=[{'all':!![]}];}return db['MailAccount'][_0xcf38('0x57')](_0x2c54d5);})[_0xcf38('0x23')](function(_0x57f32b){_0x437a30[_0xcf38('0x58')]=_0x57f32b;return _0x437a30;})[_0xcf38('0x23')](respondWithFilteredResult(_0x2a8cc6,_0x2c54d5))[_0xcf38('0x1a')](handleError(_0x2a8cc6,null));};exports['show']=function(_0x270145,_0x1a4736){var _0x2de980={'raw':![],'where':{'id':_0x270145['params']['id']},'include':[{'model':db[_0xcf38('0x3d')],'as':_0xcf38('0x3b')},{'model':db['MailServerOut'],'as':_0xcf38('0x3c')},{'model':db[_0xcf38('0x3e')],'as':_0xcf38('0x3f')}]},_0x17f1a8={};_0x17f1a8['model']=_[_0xcf38('0x59')](db['MailAccount'][_0xcf38('0x42')]);_0x17f1a8[_0xcf38('0x47')]=_['keys'](_0x270145[_0xcf38('0x47')]);_0x17f1a8[_0xcf38('0x50')]=_[_0xcf38('0x48')](_0x17f1a8[_0xcf38('0x46')],_0x17f1a8[_0xcf38('0x47')]);_0x2de980[_0xcf38('0x49')]=_[_0xcf38('0x48')](_0x17f1a8[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x270145[_0xcf38('0x47')][_0xcf38('0x4a')]));_0x2de980[_0xcf38('0x49')]=_0x2de980[_0xcf38('0x49')][_0xcf38('0x4b')]?_0x2de980[_0xcf38('0x49')]:_0x17f1a8[_0xcf38('0x46')];if(_0x270145[_0xcf38('0x47')][_0xcf38('0x56')]){_0x2de980[_0xcf38('0x5a')]=[{'all':!![]}];}_0x2de980=_[_0xcf38('0x54')]({},_0x2de980,_0x270145[_0xcf38('0x55')]);return db[_0xcf38('0x41')][_0xcf38('0x5b')](_0x2de980)[_0xcf38('0x23')](handleEntityNotFound(_0x1a4736,null))[_0xcf38('0x23')](respondWithResult(_0x1a4736,null))[_0xcf38('0x1a')](handleError(_0x1a4736,null));};exports[_0xcf38('0x22')]=function(_0x5bb353,_0x320ba0){if(_0x5bb353[_0xcf38('0x5c')]['id']){delete _0x5bb353[_0xcf38('0x5c')]['id'];}var _0x306f6d=_0x5bb353[_0xcf38('0x5c')][_0xcf38('0x5d')]===_0xcf38('0x5e')?null:_0x5bb353[_0xcf38('0x5c')][_0xcf38('0x5d')];var _0x5e460f=_0x5bb353[_0xcf38('0x5c')]['Imap']||{};var _0x908ce2=_0x5bb353['body'][_0xcf38('0x3c')]||{};if(_0x306f6d){_0x5e460f[_0xcf38('0x37')]=getImapHost(_0x306f6d);_0x5e460f['port']=0x3e1;_0x908ce2['host']=getSmtpHost(_0x306f6d);_0x908ce2['port']=0x24b;_0x908ce2[_0xcf38('0x5f')]=![];}if(_0x908ce2[_0xcf38('0x33')]){_0x908ce2[_0xcf38('0x5f')]=![];}else{_0x908ce2[_0xcf38('0x34')]=null;}if(!_0x5e460f[_0xcf38('0x33')])_0x5e460f[_0xcf38('0x34')]=null;_0x5bb353[_0xcf38('0x5c')][_0xcf38('0x3b')]=_0x5e460f;_0x5bb353[_0xcf38('0x5c')][_0xcf38('0x3c')]=_0x908ce2;return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x5bb353[_0xcf38('0x60')]['id']},'include':[{'model':db[_0xcf38('0x3d')],'as':_0xcf38('0x3b')},{'model':db[_0xcf38('0x61')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xcf38('0x23')](handleEntityNotFound(_0x320ba0,null))['then'](function(_0x4e699d){if(!_0x4e699d)throw new Error(_0xcf38('0x62'));if(_0x4e699d[_0xcf38('0x38')])delete _0x5bb353[_0xcf38('0x5c')]['Imap'];return _0x4e699d;})[_0xcf38('0x23')](saveUpdates(_0x5bb353['body'],null))['then'](function(_0x2ca2af){if(!_0x5bb353[_0xcf38('0x5c')]['Imap'])return _0x2ca2af;return db['MailServerIn'][_0xcf38('0x22')](_0x5bb353['body'][_0xcf38('0x3b')],{'where':{'MailAccountId':_0x2ca2af['id']}})[_0xcf38('0x23')](function(){return _0x2ca2af;});})[_0xcf38('0x23')](function(_0x4560da){if(!_0x5bb353[_0xcf38('0x5c')][_0xcf38('0x3c')])return _0x4560da;return db[_0xcf38('0x61')][_0xcf38('0x22')](_0x5bb353[_0xcf38('0x5c')]['Smtp'],{'where':{'MailAccountId':_0x4560da['id']}})[_0xcf38('0x23')](function(){return _0x4560da;});})[_0xcf38('0x23')](respondWithResult(_0x320ba0,null))[_0xcf38('0x1a')](handleError(_0x320ba0,null));};exports[_0xcf38('0x63')]=function(_0x276c4a,_0x49afeb){return db[_0xcf38('0x41')][_0xcf38('0x63')]()[_0xcf38('0x23')](respondWithResult(_0x49afeb,null))[_0xcf38('0x1a')](handleError(_0x49afeb,null));};exports[_0xcf38('0x64')]=function(_0x2f1593,_0x33904e){if(_0x2f1593[_0xcf38('0x5c')]['id']){delete _0x2f1593[_0xcf38('0x5c')]['id'];}return db['MailAccount'][_0xcf38('0x5b')]({'where':{'id':_0x2f1593[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x33904e,null))[_0xcf38('0x23')](function(_0x45a38f){if(_0x45a38f){_0x2f1593['body']['MailAccountId']=_0x45a38f['id'];return db[_0xcf38('0x65')]['create'](_0x2f1593[_0xcf38('0x5c')]);}})[_0xcf38('0x23')](respondWithResult(_0x33904e,null))[_0xcf38('0x1a')](handleError(_0x33904e,null));};exports[_0xcf38('0x66')]=function(_0x27b28b,_0x3ff005){var _0x2adf5e={'raw':![],'where':{}};var _0x1291de={};var _0x26a7fa={'count':0x0,'rows':[]};return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0x27b28b['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x3ff005,null))['then'](function(_0x400b0f){if(_0x400b0f){_0x1291de[_0xcf38('0x46')]=_[_0xcf38('0x59')](db[_0xcf38('0x65')]['rawAttributes']);_0x1291de[_0xcf38('0x47')]=_[_0xcf38('0x59')](_0x27b28b[_0xcf38('0x47')]);_0x1291de[_0xcf38('0x50')]=_['intersection'](_0x1291de[_0xcf38('0x46')],_0x1291de[_0xcf38('0x47')]);_0x2adf5e[_0xcf38('0x49')]=_['intersection'](_0x1291de[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x27b28b['query'][_0xcf38('0x4a')]));_0x2adf5e[_0xcf38('0x49')]=_0x2adf5e['attributes']['length']?_0x2adf5e['attributes']:_0x1291de[_0xcf38('0x46')];if(!_0x27b28b[_0xcf38('0x47')][_0xcf38('0x4c')](_0xcf38('0x4d'))){_0x2adf5e['limit']=qs[_0xcf38('0x1f')](_0x27b28b[_0xcf38('0x47')]['limit']);_0x2adf5e[_0xcf38('0x1d')]=qs[_0xcf38('0x1d')](_0x27b28b[_0xcf38('0x47')][_0xcf38('0x1d')]);}_0x2adf5e[_0xcf38('0x68')]=qs['sort'](_0x27b28b[_0xcf38('0x47')][_0xcf38('0x4e')]);_0x2adf5e['where']=qs[_0xcf38('0x50')](_[_0xcf38('0x51')](_0x27b28b[_0xcf38('0x47')],_0x1291de[_0xcf38('0x50')]));_0x2adf5e[_0xcf38('0x4f')]['MailAccountId']=_0x400b0f['id'];if(_0x27b28b[_0xcf38('0x47')][_0xcf38('0x52')]){_0x2adf5e[_0xcf38('0x4f')]=_[_0xcf38('0x54')](_0x2adf5e[_0xcf38('0x4f')],{'$or':_[_0xcf38('0x40')](_0x2adf5e['attributes'],function(_0x2b928b){var _0x4c133d={};_0x4c133d[_0x2b928b]={'$like':'%'+_0x27b28b[_0xcf38('0x47')][_0xcf38('0x52')]+'%'};return _0x4c133d;})});}_0x2adf5e=_[_0xcf38('0x54')]({},_0x2adf5e,_0x27b28b['options']);return db[_0xcf38('0x65')][_0xcf38('0x20')]({'where':_0x2adf5e[_0xcf38('0x4f')]})['then'](function(_0x314f56){_0x26a7fa['count']=_0x314f56;if(_0x27b28b[_0xcf38('0x47')][_0xcf38('0x56')]){_0x2adf5e[_0xcf38('0x5a')]=[{'all':!![]}];}return db[_0xcf38('0x65')][_0xcf38('0x57')](_0x2adf5e);})['then'](function(_0x5a0ae8){_0x26a7fa[_0xcf38('0x58')]=_0x5a0ae8;return _0x26a7fa;});}})[_0xcf38('0x23')](respondWithFilteredResult(_0x3ff005,_0x2adf5e))[_0xcf38('0x1a')](handleError(_0x3ff005,null));};exports[_0xcf38('0x69')]=function(_0x3ea3fd,_0x4d8ef2){return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x3ea3fd[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x4d8ef2,null))[_0xcf38('0x23')](function(_0xb9ec3d){if(_0xb9ec3d){return _0xb9ec3d['removeDispositions'](_0x3ea3fd[_0xcf38('0x47')]['ids']);}})[_0xcf38('0x23')](respondWithStatusCode(_0x4d8ef2,null))[_0xcf38('0x1a')](handleError(_0x4d8ef2,null));};exports[_0xcf38('0x6a')]=function(_0x3321ed,_0x5ea76e){if(_0x3321ed['body']['id']){delete _0x3321ed['body']['id'];}return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x3321ed['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x5ea76e,null))[_0xcf38('0x23')](function(_0x292e98){if(_0x292e98){_0x3321ed[_0xcf38('0x5c')][_0xcf38('0x6b')]=_0x292e98['id'];return db[_0xcf38('0x6c')]['create'](_0x3321ed['body']);}})['then'](respondWithResult(_0x5ea76e,null))['catch'](handleError(_0x5ea76e,null));};exports[_0xcf38('0x6d')]=function(_0x468b6b,_0x10053a){var _0x4f9323={'raw':![],'where':{}};var _0x3e8603={};var _0x4eb803={'count':0x0,'rows':[]};return db[_0xcf38('0x41')]['findOne']({'where':{'id':_0x468b6b[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x10053a,null))[_0xcf38('0x23')](function(_0x2d8554){if(_0x2d8554){_0x3e8603[_0xcf38('0x46')]=_[_0xcf38('0x59')](db[_0xcf38('0x6c')][_0xcf38('0x42')]);_0x3e8603[_0xcf38('0x47')]=_[_0xcf38('0x59')](_0x468b6b['query']);_0x3e8603[_0xcf38('0x50')]=_[_0xcf38('0x48')](_0x3e8603[_0xcf38('0x46')],_0x3e8603['query']);_0x4f9323[_0xcf38('0x49')]=_[_0xcf38('0x48')](_0x3e8603[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x468b6b[_0xcf38('0x47')][_0xcf38('0x4a')]));_0x4f9323[_0xcf38('0x49')]=_0x4f9323[_0xcf38('0x49')]['length']?_0x4f9323[_0xcf38('0x49')]:_0x3e8603['model'];if(!_0x468b6b[_0xcf38('0x47')][_0xcf38('0x4c')](_0xcf38('0x4d'))){_0x4f9323['limit']=qs[_0xcf38('0x1f')](_0x468b6b[_0xcf38('0x47')][_0xcf38('0x1f')]);_0x4f9323[_0xcf38('0x1d')]=qs[_0xcf38('0x1d')](_0x468b6b[_0xcf38('0x47')][_0xcf38('0x1d')]);}_0x4f9323[_0xcf38('0x68')]=qs[_0xcf38('0x4e')](_0x468b6b[_0xcf38('0x47')][_0xcf38('0x4e')]);_0x4f9323['where']=qs[_0xcf38('0x50')](_['pick'](_0x468b6b[_0xcf38('0x47')],_0x3e8603[_0xcf38('0x50')]));_0x4f9323[_0xcf38('0x4f')][_0xcf38('0x6b')]=_0x2d8554['id'];if(_0x468b6b[_0xcf38('0x47')][_0xcf38('0x52')]){_0x4f9323[_0xcf38('0x4f')]=_[_0xcf38('0x54')](_0x4f9323['where'],{'$or':_[_0xcf38('0x40')](_0x4f9323[_0xcf38('0x49')],function(_0x1f9bf6){var _0x393432={};_0x393432[_0x1f9bf6]={'$like':'%'+_0x468b6b[_0xcf38('0x47')]['filter']+'%'};return _0x393432;})});}_0x4f9323=_['merge']({},_0x4f9323,_0x468b6b[_0xcf38('0x55')]);return db['CannedAnswer'][_0xcf38('0x20')]({'where':_0x4f9323[_0xcf38('0x4f')]})[_0xcf38('0x23')](function(_0x3e8687){_0x4eb803['count']=_0x3e8687;if(_0x468b6b[_0xcf38('0x47')][_0xcf38('0x56')]){_0x4f9323['include']=[{'all':!![]}];}return db[_0xcf38('0x6c')][_0xcf38('0x57')](_0x4f9323);})[_0xcf38('0x23')](function(_0xd28a4){_0x4eb803['rows']=_0xd28a4;return _0x4eb803;});}})['then'](respondWithFilteredResult(_0x10053a,_0x4f9323))['catch'](handleError(_0x10053a,null));};exports['removeAnswers']=function(_0x55f22d,_0x17380a){return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x55f22d['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x17380a,null))['then'](function(_0x285f4a){if(_0x285f4a){return _0x285f4a[_0xcf38('0x6e')](_0x55f22d[_0xcf38('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x17380a,null))[_0xcf38('0x1a')](handleError(_0x17380a,null));};exports[_0xcf38('0x6f')]=function(_0x29e964,_0x3c2245){var _0x36ce4c={'name':_0x29e964[_0xcf38('0x5c')][_0xcf38('0x28')],'key':_0x29e964['body'][_0xcf38('0x45')],'provider':_0x29e964[_0xcf38('0x5c')][_0xcf38('0x5d')]===_0xcf38('0x5e')?null:_0x29e964[_0xcf38('0x5c')][_0xcf38('0x5d')],'email':_0x29e964[_0xcf38('0x5c')][_0xcf38('0x70')],'ListId':_0x29e964['body'][_0xcf38('0x71')],'active':!_[_0xcf38('0x72')](_0x29e964[_0xcf38('0x5c')]['active'])?_0x29e964[_0xcf38('0x5c')][_0xcf38('0x73')]:!![],'description':_0x29e964[_0xcf38('0x5c')][_0xcf38('0x74')]||null};var _0xd57f7c=getAuthenticationOptions(_0x36ce4c[_0xcf38('0x5d')],_0x29e964[_0xcf38('0x5c')]);_0x36ce4c[_0xcf38('0x3b')]=_0xd57f7c[_0xcf38('0x3b')];_0x36ce4c[_0xcf38('0x3c')]=_0xd57f7c[_0xcf38('0x3c')];return db[_0xcf38('0x41')][_0xcf38('0x6f')](_0x36ce4c,{'include':[{'model':db[_0xcf38('0x61')],'as':_0xcf38('0x3c')},{'model':db[_0xcf38('0x3d')],'as':_0xcf38('0x3b')}]})[_0xcf38('0x23')](function(_0x1389e7){var _0x239f8b=_0x29e964[_0xcf38('0x3a')][_0xcf38('0x25')]({'plain':!![]});if(!_0x239f8b)throw new Error(_0xcf38('0x75'));if(_0x239f8b[_0xcf38('0x76')]==='user'){var _0x221bc1=_0x1389e7[_0xcf38('0x25')]({'plain':!![]});return db[_0xcf38('0x77')][_0xcf38('0x5b')]({'where':{'name':_0xcf38('0x26'),'userProfileId':_0x239f8b[_0xcf38('0x78')]},'raw':!![]})[_0xcf38('0x23')](function(_0xea56b6){if(_0xea56b6&&_0xea56b6['autoAssociation']===0x0){return db['UserProfileResource'][_0xcf38('0x6f')]({'name':_0x221bc1['name'],'resourceId':_0x221bc1['id'],'type':_0xea56b6[_0xcf38('0x28')],'sectionId':_0xea56b6['id']},{})[_0xcf38('0x23')](function(){return _0x1389e7;});}else{return _0x1389e7;}})[_0xcf38('0x1a')](function(_0x57451c){logger[_0xcf38('0x17')](_0xcf38('0x79'),_0x57451c);throw _0x57451c;});}return _0x1389e7;})['then'](respondWithResult(_0x3c2245,0xc9))[_0xcf38('0x1a')](handleError(_0x3c2245,null));};exports[_0xcf38('0x7a')]=function(_0x1325eb,_0x12d9b5){return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0x1325eb[_0xcf38('0x60')]['id']}})['then'](handleEntityNotFound(_0x12d9b5,null))[_0xcf38('0x23')](function(_0x3a016a){if(_0x3a016a){return _0x3a016a['getImap']();}return null;})[_0xcf38('0x23')](respondWithResult(_0x12d9b5,null))[_0xcf38('0x1a')](handleError(_0x12d9b5,null));};exports[_0xcf38('0x7b')]=function(_0x47a89b,_0x5ef975){if(_0x47a89b['body']['id']){delete _0x47a89b['body']['id'];}return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x47a89b[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x5ef975,null))['then'](function(_0x147926){if(_0x147926){_0x47a89b[_0xcf38('0x5c')][_0xcf38('0x6b')]=_0x147926['id'];return db[_0xcf38('0x3d')][_0xcf38('0x6f')](_0x47a89b[_0xcf38('0x5c')]);}})[_0xcf38('0x23')](respondWithResult(_0x5ef975,null))['catch'](handleError(_0x5ef975,null));};exports[_0xcf38('0x7c')]=function(_0x1eedff,_0x507a92){return db['MailAccount']['findOne']({'where':{'id':_0x1eedff[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x507a92,null))[_0xcf38('0x23')](function(_0xea3419){if(_0xea3419){return _0xea3419[_0xcf38('0x7d')](null);}return null;})[_0xcf38('0x23')](respondWithStatusCode(_0x507a92,null))[_0xcf38('0x1a')](handleError(_0x507a92,null));};exports[_0xcf38('0x7e')]=function(_0x5c2d4e,_0x3a3688){return db[_0xcf38('0x41')]['findOne']({'where':{'id':_0x5c2d4e['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x3a3688,null))[_0xcf38('0x23')](function(_0x362cb9){if(_0x362cb9){return _0x362cb9[_0xcf38('0x7e')]();}return null;})[_0xcf38('0x23')](respondWithResult(_0x3a3688,null))[_0xcf38('0x1a')](handleError(_0x3a3688,null));};exports[_0xcf38('0x7f')]=function(_0x13b434,_0x3b243a){if(_0x13b434['body']['id']){delete _0x13b434['body']['id'];}return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x13b434[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x3b243a,null))[_0xcf38('0x23')](function(_0x53b98b){if(_0x53b98b){_0x13b434[_0xcf38('0x5c')][_0xcf38('0x6b')]=_0x53b98b['id'];return db['MailServerOut'][_0xcf38('0x6f')](_0x13b434[_0xcf38('0x5c')]);}})['then'](respondWithResult(_0x3b243a,null))[_0xcf38('0x1a')](handleError(_0x3b243a,null));};exports['removeSmtp']=function(_0xd16975,_0x1ffa6f){return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0xd16975[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x1ffa6f,null))['then'](function(_0x28f1f0){if(_0x28f1f0){return _0x28f1f0[_0xcf38('0x80')](null);}return null;})[_0xcf38('0x23')](respondWithStatusCode(_0x1ffa6f,null))[_0xcf38('0x1a')](handleError(_0x1ffa6f,null));};exports[_0xcf38('0x81')]=function(_0x40d1ab,_0x535d6a){return db[_0xcf38('0x82')][_0xcf38('0x5b')]({'where':{'id':_0x40d1ab[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x535d6a,null))['then'](function(_0x176124){if(_0x176124){return _0x176124[_0xcf38('0x81')](_0x40d1ab[_0xcf38('0x5c')][_0xcf38('0x83')],_[_0xcf38('0x84')](_0x40d1ab[_0xcf38('0x5c')],[_0xcf38('0x83'),'id'])||{});}})['then'](respondWithResult(_0x535d6a,null))['catch'](handleError(_0x535d6a,null));};exports[_0xcf38('0x85')]=function(_0x22a15e,_0x15dfec){var _0x52d7ab={'raw':![],'where':{}};var _0x14d48d={};var _0x5df3f8={'count':0x0,'rows':[]};return db[_0xcf38('0x41')]['findOne']({'where':{'id':_0x22a15e[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x15dfec,null))[_0xcf38('0x23')](function(_0xa05227){if(_0xa05227){_0x14d48d[_0xcf38('0x46')]=_['keys'](db[_0xcf38('0x82')][_0xcf38('0x42')]);_0x14d48d['query']=_['keys'](_0x22a15e[_0xcf38('0x47')]);_0x14d48d[_0xcf38('0x50')]=_[_0xcf38('0x48')](_0x14d48d[_0xcf38('0x46')],_0x14d48d[_0xcf38('0x47')]);_0x52d7ab[_0xcf38('0x49')]=_[_0xcf38('0x48')](_0x14d48d['model'],qs[_0xcf38('0x4a')](_0x22a15e[_0xcf38('0x47')][_0xcf38('0x4a')]));_0x52d7ab[_0xcf38('0x49')]=_0x52d7ab['attributes'][_0xcf38('0x4b')]?_0x52d7ab[_0xcf38('0x49')]:_0x14d48d[_0xcf38('0x46')];if(!_0x22a15e[_0xcf38('0x47')][_0xcf38('0x4c')](_0xcf38('0x4d'))){_0x52d7ab[_0xcf38('0x1f')]=qs['limit'](_0x22a15e['query'][_0xcf38('0x1f')]);_0x52d7ab['offset']=qs[_0xcf38('0x1d')](_0x22a15e['query'][_0xcf38('0x1d')]);}_0x52d7ab[_0xcf38('0x68')]=qs[_0xcf38('0x4e')](_0x22a15e[_0xcf38('0x47')][_0xcf38('0x4e')]);_0x52d7ab['where']=qs['filters'](_['pick'](_0x22a15e['query'],_0x14d48d['filters']));_0x52d7ab[_0xcf38('0x4f')][_0xcf38('0x6b')]=_0xa05227['id'];if(_0x22a15e[_0xcf38('0x47')][_0xcf38('0x52')]){_0x52d7ab[_0xcf38('0x4f')]=_['merge'](_0x52d7ab[_0xcf38('0x4f')],{'$or':_[_0xcf38('0x40')](_0x52d7ab[_0xcf38('0x49')],function(_0x1bcf07){var _0x2576ba={};_0x2576ba[_0x1bcf07]={'$like':'%'+_0x22a15e[_0xcf38('0x47')][_0xcf38('0x52')]+'%'};return _0x2576ba;})});}_0x52d7ab=_['merge']({},_0x52d7ab,_0x22a15e[_0xcf38('0x55')]);return db[_0xcf38('0x82')]['count']({'where':_0x52d7ab[_0xcf38('0x4f')]})[_0xcf38('0x23')](function(_0x43b493){_0x5df3f8[_0xcf38('0x20')]=_0x43b493;if(_0x22a15e[_0xcf38('0x47')]['includeAll']){_0x52d7ab['include']=[{'model':db[_0xcf38('0x86')],'as':_0xcf38('0x87'),'required':![]},{'model':db[_0xcf38('0x88')],'as':'Owner','attributes':[_0xcf38('0x28'),_0xcf38('0x89'),_0xcf38('0x8a')],'required':![]},{'model':db[_0xcf38('0x8b')],'as':_0xcf38('0x8c'),'attributes':['id',_0xcf38('0x28'),_0xcf38('0x8d')],'where':_0x22a15e['query'][_0xcf38('0x8e')]?{'id':_0x22a15e[_0xcf38('0x47')][_0xcf38('0x8e')]}:undefined,'required':_0x22a15e[_0xcf38('0x47')][_0xcf38('0x8e')]?!![]:![]}];}return db[_0xcf38('0x82')]['findAll'](_0x52d7ab);})[_0xcf38('0x23')](function(_0xa33f49){_0x5df3f8['rows']=_0xa33f49;return _0x5df3f8;});}})[_0xcf38('0x23')](respondWithFilteredResult(_0x15dfec,_0x52d7ab))['catch'](handleError(_0x15dfec,null));};exports[_0xcf38('0x8f')]=function addApplications(_0x3e8339,_0x305c5b){var _0x563675=_0x3e8339['params']['id'];var _0x11603e=_0x3e8339[_0xcf38('0x5c')];var _0xf086bc=0xc8;var _0x2938b3=null;return db[_0xcf38('0x90')]['transaction']({'isolationLevel':db['sequelize'][_0xcf38('0x91')][_0xcf38('0x92')][_0xcf38('0x93')]},function(_0x12f420){return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0x563675},'transaction':_0x12f420})[_0xcf38('0x23')](function(_0xa3fe56){if(_0xa3fe56){return db['MailApplication'][_0xcf38('0x24')]({'where':{'MailAccountId':_0x563675},'transaction':_0x12f420})[_0xcf38('0x23')](function(){var _0x5adf60=_['map'](_0x11603e,function(_0x49d04f){_0x49d04f[_0xcf38('0x6b')]=_0x563675;return _0x49d04f;});return db['MailApplication'][_0xcf38('0x94')](_0x5adf60,{'transaction':_0x12f420});});}else{_0xf086bc=0x194;_0x2938b3=[];}});})[_0xcf38('0x23')](function(){if(_0xf086bc!==0x194){return db[_0xcf38('0x95')][_0xcf38('0x96')]({'where':{'MailAccountId':_0x563675},'order':_0xcf38('0x97')})['then'](function(_0x2b07ce){_0x2938b3=_0x2b07ce;});}})[_0xcf38('0x1a')](function(_0x67d475){_0xf086bc=0x1f4;logger[_0xcf38('0x17')](_0x67d475[_0xcf38('0x98')]);if(_0x67d475['name']){delete _0x67d475['name'];}_0x2938b3=_0x67d475;})['finally'](function(){if(_0x2938b3===null){_0x305c5b[_0xcf38('0x1b')](_0xf086bc);}else{if(_0xf086bc===0x1f4){_0x305c5b[_0xcf38('0x1c')](_0xf086bc)[_0xcf38('0x99')](_0x2938b3);}else{_0x305c5b[_0xcf38('0x1c')](_0xf086bc)['json'](_0x2938b3);}}});};exports[_0xcf38('0x9a')]=function(_0x1632c2,_0x2d8b22){var _0xbe76f={};var _0x3cd66d={};var _0x4f8bdb;var _0x5a5f65;return db['MailAccount'][_0xcf38('0x67')]({'where':{'id':_0x1632c2[_0xcf38('0x60')]['id']}})['then'](handleEntityNotFound(_0x2d8b22,null))[_0xcf38('0x23')](function(_0x32c1b0){if(_0x32c1b0){_0x4f8bdb=_0x32c1b0;_0x3cd66d['model']=_[_0xcf38('0x59')](db['MailApplication'][_0xcf38('0x42')]);_0x3cd66d[_0xcf38('0x47')]=_[_0xcf38('0x59')](_0x1632c2[_0xcf38('0x47')]);_0x3cd66d[_0xcf38('0x50')]=_[_0xcf38('0x48')](_0x3cd66d['model'],_0x3cd66d['query']);_0xbe76f['attributes']=_['intersection'](_0x3cd66d[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x1632c2['query'][_0xcf38('0x4a')]));_0xbe76f[_0xcf38('0x49')]=_0xbe76f['attributes'][_0xcf38('0x4b')]?_0xbe76f[_0xcf38('0x49')]:_0x3cd66d[_0xcf38('0x46')];_0xbe76f[_0xcf38('0x68')]=qs['sort'](_0x1632c2[_0xcf38('0x47')][_0xcf38('0x4e')]);_0xbe76f['where']=qs[_0xcf38('0x50')](_[_0xcf38('0x51')](_0x1632c2[_0xcf38('0x47')],_0x3cd66d[_0xcf38('0x50')]));if(_0x1632c2[_0xcf38('0x47')][_0xcf38('0x52')]){_0xbe76f[_0xcf38('0x4f')]=_[_0xcf38('0x54')](_0xbe76f[_0xcf38('0x4f')],{'$or':_['map'](_0xbe76f[_0xcf38('0x49')],function(_0x2ed84f){var _0x58c56e={};_0x58c56e[_0x2ed84f]={'$like':'%'+_0x1632c2[_0xcf38('0x47')][_0xcf38('0x52')]+'%'};return _0x58c56e;})});}_0xbe76f=_[_0xcf38('0x54')]({},_0xbe76f,_0x1632c2[_0xcf38('0x55')]);return _0x4f8bdb[_0xcf38('0x9a')](_0xbe76f);}})[_0xcf38('0x23')](function(_0x1e1864){if(_0x1e1864){_0x5a5f65=_0x1e1864[_0xcf38('0x4b')];if(!_0x1632c2[_0xcf38('0x47')][_0xcf38('0x4c')]('nolimit')){_0xbe76f[_0xcf38('0x1f')]=qs['limit'](_0x1632c2[_0xcf38('0x47')][_0xcf38('0x1f')]);_0xbe76f[_0xcf38('0x1d')]=qs['offset'](_0x1632c2[_0xcf38('0x47')][_0xcf38('0x1d')]);}return _0x4f8bdb[_0xcf38('0x9a')](_0xbe76f);}})[_0xcf38('0x23')](function(_0xd19953){if(_0xd19953){return _0xd19953?{'count':_0x5a5f65,'rows':_0xd19953}:null;}})[_0xcf38('0x23')](respondWithResult(_0x2d8b22,null))[_0xcf38('0x1a')](handleError(_0x2d8b22,null));};exports[_0xcf38('0x9b')]=function(_0x2a634b,_0x17c176){var _0x207fce={'raw':!![],'where':{}};var _0x36553e={};var _0x4a5d97={'count':0x0,'rows':[]};return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0x2a634b['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x17c176,null))[_0xcf38('0x23')](function(_0x10d9ac){if(_0x10d9ac){_0x36553e[_0xcf38('0x46')]=_['keys'](db[_0xcf38('0x9c')][_0xcf38('0x42')]);_0x36553e[_0xcf38('0x47')]=_[_0xcf38('0x59')](_0x2a634b[_0xcf38('0x47')]);_0x36553e['filters']=_['intersection'](_0x36553e[_0xcf38('0x46')],_0x36553e['query']);_0x207fce['attributes']=_[_0xcf38('0x48')](_0x36553e[_0xcf38('0x46')],qs[_0xcf38('0x4a')](_0x2a634b[_0xcf38('0x47')][_0xcf38('0x4a')]));_0x207fce[_0xcf38('0x49')]=_0x207fce['attributes']['length']?_0x207fce[_0xcf38('0x49')]:_0x36553e[_0xcf38('0x46')];if(!_0x2a634b[_0xcf38('0x47')]['hasOwnProperty'](_0xcf38('0x4d'))){_0x207fce[_0xcf38('0x1f')]=qs['limit'](_0x2a634b['query'][_0xcf38('0x1f')]);_0x207fce[_0xcf38('0x1d')]=qs[_0xcf38('0x1d')](_0x2a634b[_0xcf38('0x47')][_0xcf38('0x1d')]);}_0x207fce[_0xcf38('0x68')]=qs[_0xcf38('0x4e')](_0x2a634b[_0xcf38('0x47')][_0xcf38('0x4e')]);_0x207fce[_0xcf38('0x4f')]=qs[_0xcf38('0x50')](_[_0xcf38('0x51')](_0x2a634b['query'],_0x36553e['filters']));_0x207fce['where'][_0xcf38('0x6b')]=_0x10d9ac['id'];if(_0x2a634b[_0xcf38('0x47')][_0xcf38('0x52')]){_0x207fce[_0xcf38('0x4f')]=_[_0xcf38('0x54')](_0x207fce[_0xcf38('0x4f')],{'$or':_[_0xcf38('0x40')](_0x207fce['attributes'],function(_0x3ce813){var _0x198927={};_0x198927[_0x3ce813]={'$like':'%'+_0x2a634b[_0xcf38('0x47')][_0xcf38('0x52')]+'%'};return _0x198927;})});}if(_0x2a634b[_0xcf38('0x47')][_0xcf38('0x9d')]){var _0x392e28=_0x2a634b[_0xcf38('0x47')][_0xcf38('0x9d')][_0xcf38('0x9e')](',');var _0x40972c={};_0x40972c[_0x392e28[0x0]]={'$gte':moment(_0x392e28[0x1])[_0xcf38('0x9f')](_0xcf38('0xa0'))};_0x207fce['where']=_[_0xcf38('0x54')](_0x207fce[_0xcf38('0x4f')],_0x40972c);}_0x207fce=_[_0xcf38('0x54')]({},_0x207fce,_0x2a634b[_0xcf38('0x55')]);return db['MailMessage']['count']({'where':_0x207fce[_0xcf38('0x4f')]})['then'](function(_0xd690fc){_0x4a5d97[_0xcf38('0x20')]=_0xd690fc;if(_0x2a634b[_0xcf38('0x47')]['includeAll']){_0x207fce['include']=[{'all':!![]}];}return db[_0xcf38('0x9c')][_0xcf38('0x57')](_0x207fce);})[_0xcf38('0x23')](function(_0x288ccb){if(_0x2a634b[_0xcf38('0x47')][_0xcf38('0xa1')]==='true'){for(var _0xcb8da0=0x0;_0xcb8da0<_0x288ccb[_0xcf38('0x4b')];_0xcb8da0++){_0x288ccb[_0xcb8da0][_0xcf38('0x5c')]=juice(_0x288ccb[_0xcb8da0]['body']);}}_0x4a5d97[_0xcf38('0x58')]=_0x288ccb;return _0x4a5d97;});}})[_0xcf38('0x23')](respondWithFilteredResult(_0x17c176,_0x207fce))[_0xcf38('0x1a')](handleError(_0x17c176,null));};exports['send']=function(_0x2dfb01,_0x355cc3){var _0xc200d8,_0x4128a5={},_0x43251a;if(_0x2dfb01[_0xcf38('0x5c')]['to']){_0x43251a=_0x2dfb01[_0xcf38('0x5c')]['to'][_0xcf38('0x9e')](',')[0x0];}return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x2dfb01[_0xcf38('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0xcf38('0xa2'),'include':[{'model':db[_0xcf38('0x86')],'as':_0xcf38('0xa3'),'where':{'email':_0x43251a},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcf38('0x61')],'as':_0xcf38('0x3c'),'raw':!![],'include':[{'model':db[_0xcf38('0xa4')],'as':_0xcf38('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x355cc3,null))[_0xcf38('0x23')](function(_0x350202){if(!_0x350202)return;_0xc200d8=_0x350202;if(!_0x350202[_0xcf38('0x3c')])throw new Error(_0xcf38('0xa5'));if(_[_0xcf38('0x72')](_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xa6')])){_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xa6')]=util['format'](_0xcf38('0xa7'),_0x350202[_0xcf38('0x28')],_0x350202['email']||_0x350202['Smtp'][_0xcf38('0x3a')]);}if(_0x2dfb01['body'][_0xcf38('0xa8')]&&_0x2dfb01[_0xcf38('0x5c')]['attachments']['length']){for(var _0x405102=0x0;_0x405102<_0x2dfb01['body'][_0xcf38('0xa8')][_0xcf38('0x4b')];_0x405102+=0x1){_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xa8')][_0x405102]={'filename':_0x2dfb01['body'][_0xcf38('0xa8')][_0x405102]['name'],'path':path[_0xcf38('0xa9')](config['root'],'server/files/attachments',_0x2dfb01['body'][_0xcf38('0xa8')][_0x405102][_0xcf38('0xaa')])};}}var _0x2a9c74=_0x350202['getSmtpOptions']();return respondWithRpcPromise(_0xcf38('0xab'),'sendMail',{'account':_0x2a9c74,'message':_0x2dfb01[_0xcf38('0x5c')]});})['then'](function(_0x4c7e6c){if(!_0x4c7e6c)return;_0x4128a5=_0x4c7e6c;if(!_0xc200d8[_0xcf38('0xa2')])throw new Error(_0xcf38('0xac'));if(_0xc200d8[_0xcf38('0xa2')][_0xcf38('0xa3')][_0xcf38('0x4b')])return _0xc200d8['List'][_0xcf38('0xa3')][0x0];return db[_0xcf38('0x86')]['create'](_[_0xcf38('0xad')](_0x2dfb01['body'],{'firstName':_0x2dfb01[_0xcf38('0x5c')]['to'],'email':_0x2dfb01[_0xcf38('0x5c')]['to'],'phone':_0x2dfb01[_0xcf38('0x5c')]['to'],'ListId':_0xc200d8[_0xcf38('0x71')]}));})['then'](function(_0x3821b8){if(!_0x3821b8)return;var _0x10ee79={'UserId':_0x2dfb01['user']['id'],'ContactId':_0x3821b8['id'],'MailAccountId':_0xc200d8['id'],'inReplyTo':_0x4128a5[_0xcf38('0xae')],'to':_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xa6')],'cc':_0x2dfb01['body']['cc'],'subject':_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xaf')],'attach':_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xb0')],'firstMsgDirection':_0xcf38('0xb1'),'lastMsgAt':moment()[_0xcf38('0x9f')](_0xcf38('0xa0')),'lastMsgDirection':_0xcf38('0xb1'),'Messages':[_['merge'](_0x2dfb01[_0xcf38('0x5c')],{'messageId':_0x4128a5[_0xcf38('0xae')],'sentAt':moment()['format'](_0xcf38('0xa0')),'read':!![],'MailAccountId':_0xc200d8['id'],'UserId':_0x2dfb01[_0xcf38('0x3a')]['id'],'ContactId':_0x3821b8['id']})]};if(_0x2dfb01[_0xcf38('0x5c')][_0xcf38('0xb2')]){_0x10ee79=_[_0xcf38('0x54')](_0x10ee79,_0x2dfb01[_0xcf38('0x5c')]['Interaction']);}return db['MailInteraction'][_0xcf38('0x6f')](_0x10ee79,{'include':[{'model':db['MailMessage'],'as':_0xcf38('0xb3')}]});})[_0xcf38('0x23')](respondWithResult(_0x355cc3,null))[_0xcf38('0x1a')](handleError(_0x355cc3,null));};exports[_0xcf38('0xb4')]=function(_0xd9f64b,_0x552208){return db['MailAccount']['find']({'where':{'id':_0xd9f64b[_0xcf38('0x60')]['id']},'include':[{'model':db[_0xcf38('0x61')],'as':_0xcf38('0x3c'),'raw':!![],'include':[{'model':db[_0xcf38('0xa4')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x552208,null))[_0xcf38('0x23')](function(_0x3314e0){if(!_0x3314e0[_0xcf38('0x3c')])return;var _0x238224=_0x3314e0[_0xcf38('0xb5')]();return respondWithRpcPromise(_0xcf38('0xb6'),_0xcf38('0xb4'),{'account':_0x238224});})[_0xcf38('0x23')](respondWithResult(_0x552208,null))['catch'](handleError(_0x552208,null));};exports[_0xcf38('0x24')]=function(_0x7d7056,_0x248e59){return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x7d7056[_0xcf38('0x60')]['id']}})['then'](handleEntityNotFound(_0x248e59,null))['then'](function(_0x3f6a76){if(_0x3f6a76&&_0x3f6a76['service']){throw new db[(_0xcf38('0xb7'))][(_0xcf38('0xb8'))](_0xcf38('0xb9'));}return _0x3f6a76;})[_0xcf38('0x23')](removeEntity(_0x248e59,null))[_0xcf38('0x1a')](handleError(_0x248e59,null));};exports['addAgents']=function(_0x2abfad,_0x232f29){return db['MailAccount'][_0xcf38('0x5b')]({'where':{'id':_0x2abfad[_0xcf38('0x60')]['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x232f29,null))[_0xcf38('0x23')](function(_0x1b35a7){if(_0x1b35a7){return _0x1b35a7[_0xcf38('0xba')](_0x2abfad[_0xcf38('0x5c')][_0xcf38('0x83')],_[_0xcf38('0x84')](_0x2abfad[_0xcf38('0x5c')],['ids','id'])||{})[_0xcf38('0xbb')](function(_0x47ea3b){for(var _0x3d5c78=0x0;_0x3d5c78<_0x2abfad[_0xcf38('0x5c')][_0xcf38('0x83')][_0xcf38('0x4b')];_0x3d5c78+=0x1){socket[_0xcf38('0xbc')]('userMailAccount:save',{'UserId':Number(_0x2abfad[_0xcf38('0x5c')][_0xcf38('0x83')][_0x3d5c78]),'MailAccountId':Number(_0x2abfad['params']['id'])});}return _0x47ea3b;});}})[_0xcf38('0x23')](respondWithResult(_0x232f29,null))[_0xcf38('0x1a')](handleError(_0x232f29,null));};exports[_0xcf38('0xbd')]=function(_0x5dc85c,_0x5694e8){return db[_0xcf38('0x41')][_0xcf38('0x5b')]({'where':{'id':_0x5dc85c['params']['id']}})[_0xcf38('0x23')](handleEntityNotFound(_0x5694e8,null))[_0xcf38('0x23')](function(_0x4dad06){if(_0x4dad06){return _0x4dad06['removeAgents'](_0x5dc85c[_0xcf38('0x47')][_0xcf38('0x83')])[_0xcf38('0x23')](function(){if(_[_0xcf38('0xbe')](_0x5dc85c['query']['ids'])){for(var _0x4aeb76=0x0;_0x4aeb76<_0x5dc85c[_0xcf38('0x47')][_0xcf38('0x83')]['length'];_0x4aeb76+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x5dc85c[_0xcf38('0x47')]['ids'][_0x4aeb76]),'MailAccountId':Number(_0x5dc85c['params']['id'])});}}else{socket[_0xcf38('0xbc')](_0xcf38('0xbf'),{'UserId':Number(_0x5dc85c[_0xcf38('0x47')][_0xcf38('0x83')]),'MailAccountId':Number(_0x5dc85c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5694e8,null))[_0xcf38('0x1a')](handleError(_0x5694e8,null));};exports[_0xcf38('0xc0')]=function(_0x39fe9e,_0x48d47e){var _0x489b42={};var _0x3d5d97={};var _0x2a44d4;var _0x1f6aeb;return db[_0xcf38('0x41')][_0xcf38('0x67')]({'where':{'id':_0x39fe9e[_0xcf38('0x60')]['id']}})['then'](handleEntityNotFound(_0x48d47e,null))[_0xcf38('0x23')](function(_0x1d4e47){if(_0x1d4e47){_0x2a44d4=_0x1d4e47;_0x3d5d97[_0xcf38('0x46')]=_[_0xcf38('0x59')](db['User'][_0xcf38('0x42')]);_0x3d5d97[_0xcf38('0x47')]=_['keys'](_0x39fe9e['query']);_0x3d5d97[_0xcf38('0x50')]=_['intersection'](_0x3d5d97['model'],_0x3d5d97['query']);_0x489b42[_0xcf38('0x49')]=_[_0xcf38('0x48')](_0x3d5d97[_0xcf38('0x46')],qs['fields'](_0x39fe9e[_0xcf38('0x47')]['fields']));_0x489b42['attributes']=_0x489b42[_0xcf38('0x49')][_0xcf38('0x4b')]?_0x489b42['attributes']:_0x3d5d97[_0xcf38('0x46')];_0x489b42['order']=qs[_0xcf38('0x4e')](_0x39fe9e[_0xcf38('0x47')][_0xcf38('0x4e')]);_0x489b42[_0xcf38('0x4f')]=qs[_0xcf38('0x50')](_[_0xcf38('0x51')](_0x39fe9e[_0xcf38('0x47')],_0x3d5d97[_0xcf38('0x50')]));if(_0x39fe9e['query']['filter']){_0x489b42[_0xcf38('0x4f')]=_[_0xcf38('0x54')](_0x489b42[_0xcf38('0x4f')],{'$or':_['map'](_0x489b42['attributes'],function(_0x5205e2){var _0x69315={};_0x69315[_0x5205e2]={'$like':'%'+_0x39fe9e['query']['filter']+'%'};return _0x69315;})});}_0x489b42=_[_0xcf38('0x54')]({},_0x489b42,_0x39fe9e[_0xcf38('0x55')]);return _0x2a44d4[_0xcf38('0xc0')](_0x489b42);}})[_0xcf38('0x23')](function(_0x18c6e8){if(_0x18c6e8){_0x1f6aeb=_0x18c6e8[_0xcf38('0x4b')];if(!_0x39fe9e[_0xcf38('0x47')][_0xcf38('0x4c')](_0xcf38('0x4d'))){_0x489b42[_0xcf38('0x1f')]=qs[_0xcf38('0x1f')](_0x39fe9e[_0xcf38('0x47')][_0xcf38('0x1f')]);_0x489b42[_0xcf38('0x1d')]=qs[_0xcf38('0x1d')](_0x39fe9e['query'][_0xcf38('0x1d')]);}return _0x2a44d4[_0xcf38('0xc0')](_0x489b42);}})[_0xcf38('0x23')](function(_0xd5f577){if(_0xd5f577){return _0xd5f577?{'count':_0x1f6aeb,'rows':_0xd5f577}:null;}})['then'](respondWithResult(_0x48d47e,null))[_0xcf38('0x1a')](handleError(_0x48d47e,null));}; \ No newline at end of file +var _0xedc8=['isArray','emit','userMailAccount:remove','getAgents','User','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','set','json','update','then','get','MailAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','service','authentication','Imap','Smtp','index','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','MailServerIn','mandatoryDispositionPause','length','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','root','basename','SendMail','sendMail','List\x20not\x20found','Contacts','subject','attach','format','Interaction','Messages','getSmtpOptions','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0xedc8,0x19d));var _0x8edc=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xedc8[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x8edc('0x0'));var BPromise=require(_0x8edc('0x1'));var util=require('util');var path=require('path');var _=require(_0x8edc('0x2'));var juice=require(_0x8edc('0x3'));var Redis=require(_0x8edc('0x4'));var qs=require(_0x8edc('0x5'));var logger=require(_0x8edc('0x6'))(_0x8edc('0x7'));var config=require(_0x8edc('0x8'));var db=require(_0x8edc('0x9'))['db'];config[_0x8edc('0xa')]=_[_0x8edc('0xb')](config[_0x8edc('0xa')],{'host':_0x8edc('0xc'),'port':0x18eb});var socket=require(_0x8edc('0xd'))(new Redis(config['redis']));require(_0x8edc('0xe'))[_0x8edc('0xf')](socket);var jayson=require(_0x8edc('0x10'));var client=jayson[_0x8edc('0x11')][_0x8edc('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x31f644,_0x4b22cc,_0x51b79c,_0x63a303){return new BPromise(function(_0x156d98,_0x16d556){var _0x264444=_0x63a303||client;return _0x264444[_0x8edc('0x13')](_0x31f644,_0x51b79c)['then'](function(_0x2c464a){logger[_0x8edc('0x14')](_0x8edc('0x15'),_0x4b22cc,_0x8edc('0x16'));logger[_0x8edc('0x17')](_0x8edc('0x18'),_0x4b22cc,_0x8edc('0x16'),JSON[_0x8edc('0x19')](_0x2c464a));if(_0x2c464a[_0x8edc('0x1a')]){if(_0x2c464a['error'][_0x8edc('0x1b')]===0x1f4){logger[_0x8edc('0x1a')](_0x8edc('0x15'),_0x4b22cc,_0x2c464a[_0x8edc('0x1a')]['message']);return _0x16d556(_0x2c464a[_0x8edc('0x1a')][_0x8edc('0x1c')]);}logger[_0x8edc('0x1a')]('MailAccount,\x20%s,\x20%s',_0x4b22cc,_0x2c464a[_0x8edc('0x1a')][_0x8edc('0x1c')]);return _0x156d98(_0x2c464a[_0x8edc('0x1a')][_0x8edc('0x1c')]);}else{logger[_0x8edc('0x14')](_0x8edc('0x15'),_0x4b22cc,'request\x20sent');_0x156d98(_0x2c464a[_0x8edc('0x1d')][_0x8edc('0x1c')]);}})[_0x8edc('0x1e')](function(_0x47fe42){logger['error'](_0x8edc('0x15'),_0x4b22cc,_0x47fe42);_0x16d556(_0x47fe42);});});}function respondWithStatusCode(_0x28d61e,_0x1b1939){_0x1b1939=_0x1b1939||0xcc;return function(_0x3cb343){if(_0x3cb343){return _0x28d61e['sendStatus'](_0x1b1939);}return _0x28d61e[_0x8edc('0x1f')](_0x1b1939)[_0x8edc('0x20')]();};}function respondWithResult(_0x5e30f9,_0x2c378e){_0x2c378e=_0x2c378e||0xc8;return function(_0x5e1c4f){if(_0x5e1c4f){return _0x5e30f9['status'](_0x2c378e)['json'](_0x5e1c4f);}};}function respondWithFilteredResult(_0x5e03fe,_0x3fe7a1){return function(_0x558d69){if(_0x558d69){var _0x4634a9=typeof _0x3fe7a1[_0x8edc('0x21')]===_0x8edc('0x22')&&typeof _0x3fe7a1['limit']===_0x8edc('0x22');var _0xe21741=_0x558d69[_0x8edc('0x23')];var _0x2a9e0c=_0x4634a9?0x0:_0x3fe7a1[_0x8edc('0x21')];var _0x5d2046=_0x4634a9?_0x558d69[_0x8edc('0x23')]:_0x3fe7a1[_0x8edc('0x21')]+_0x3fe7a1['limit'];var _0x572db5;if(_0x5d2046>=_0xe21741){_0x5d2046=_0xe21741;_0x572db5=0xc8;}else{_0x572db5=0xce;}_0x5e03fe[_0x8edc('0x1f')](_0x572db5);return _0x5e03fe[_0x8edc('0x24')]('Content-Range',_0x2a9e0c+'-'+_0x5d2046+'/'+_0xe21741)[_0x8edc('0x25')](_0x558d69);}return null;};}function saveUpdates(_0x31c239){return function(_0xf8c93d){if(_0xf8c93d){return _0xf8c93d[_0x8edc('0x26')](_0x31c239)[_0x8edc('0x27')](function(_0x4bb9a4){return _0x4bb9a4;});}return null;};}function removeEntity(_0x2d252e){return function(_0x8d557e){if(_0x8d557e){return _0x8d557e['destroy']()[_0x8edc('0x27')](function(){var _0x2dc33f=_0x8d557e[_0x8edc('0x28')]({'plain':!![]});var _0x10ad5c=_0x8edc('0x29');return db[_0x8edc('0x2a')][_0x8edc('0x2b')]({'where':{'type':_0x10ad5c,'resourceId':_0x2dc33f['id']}})[_0x8edc('0x27')](function(){return _0x8d557e;});})['then'](function(){_0x2d252e[_0x8edc('0x1f')](0xcc)[_0x8edc('0x20')]();});}};}function handleEntityNotFound(_0x1964ee){return function(_0x4cd2f9){if(!_0x4cd2f9){_0x1964ee[_0x8edc('0x2c')](0x194);}return _0x4cd2f9;};}function handleError(_0x216c98,_0xe9076f){_0xe9076f=_0xe9076f||0x1f4;return function(_0x34fa2f){logger[_0x8edc('0x1a')](_0x34fa2f[_0x8edc('0x2d')]);if(_0x34fa2f[_0x8edc('0x2e')]){delete _0x34fa2f[_0x8edc('0x2e')];}_0x216c98[_0x8edc('0x1f')](_0xe9076f)[_0x8edc('0x2f')](_0x34fa2f);};}function getImapHost(_0x10d36f){switch(_0x10d36f){case _0x8edc('0x30'):return _0x8edc('0x31');case _0x8edc('0x32'):return _0x8edc('0x33');case _0x8edc('0x34'):return _0x8edc('0x35');case'outlook365':return _0x8edc('0x36');}throw new Error(_0x8edc('0x37'),_0x10d36f);}function getSmtpHost(_0x2f9fdf){switch(_0x2f9fdf){case'gmail':return _0x8edc('0x38');case'yahoo':return'smtp.mail.yahoo.com';case _0x8edc('0x34'):return _0x8edc('0x39');case _0x8edc('0x3a'):return _0x8edc('0x3b');}throw new Error(_0x8edc('0x37'),_0x2f9fdf);}function getAuthenticationOptions(_0x3d67b9,_0x3ce0bf){var _0x7cda55={};var _0x5438ce={};if(_0x3d67b9){_0x7cda55[_0x8edc('0x3c')]=_0x5438ce[_0x8edc('0x3c')]=_0x3ce0bf['username'];_0x7cda55[_0x8edc('0x3d')]=_0x5438ce['pass']=_0x3ce0bf[_0x8edc('0x3d')];if(_0x3ce0bf[_0x8edc('0x3e')]){_0x7cda55[_0x8edc('0x3e')]=_0x5438ce[_0x8edc('0x3e')]=!![];_0x7cda55[_0x8edc('0x3f')]=_0x5438ce[_0x8edc('0x3f')]=_0x3ce0bf[_0x8edc('0x3f')];_0x7cda55[_0x8edc('0x3d')]=_0x5438ce[_0x8edc('0x40')]=null;}else{_0x7cda55[_0x8edc('0x3f')]=_0x5438ce['CloudProviderId']=null;}_0x7cda55[_0x8edc('0x41')]=getImapHost(_0x3d67b9);_0x7cda55['port']=0x3e1;_0x5438ce[_0x8edc('0x41')]=getSmtpHost(_0x3d67b9);_0x5438ce[_0x8edc('0x42')]=0x24b;_0x5438ce['secure']=![];_0x7cda55[_0x8edc('0x43')]=_0x5438ce[_0x8edc('0x43')]=null;}else{if(_0x3ce0bf[_0x8edc('0x44')]){_0x7cda55[_0x8edc('0x3c')]=_0x5438ce['user']=_0x3ce0bf['username'];_0x7cda55['password']=_0x5438ce[_0x8edc('0x40')]=_0x3ce0bf[_0x8edc('0x3d')];}else{_0x7cda55[_0x8edc('0x44')]=_0x5438ce[_0x8edc('0x44')]=![];_0x7cda55[_0x8edc('0x3c')]=_0x5438ce[_0x8edc('0x3c')]=null;_0x7cda55['password']=_0x5438ce[_0x8edc('0x40')]=null;}_0x7cda55['host']=_0x3ce0bf[_0x8edc('0x45')][_0x8edc('0x41')];_0x7cda55['port']=_0x3ce0bf[_0x8edc('0x45')][_0x8edc('0x42')];_0x5438ce[_0x8edc('0x41')]=_0x3ce0bf[_0x8edc('0x46')][_0x8edc('0x41')];_0x5438ce[_0x8edc('0x42')]=_0x3ce0bf[_0x8edc('0x46')][_0x8edc('0x42')];}return{'Imap':_0x7cda55,'Smtp':_0x5438ce};}exports[_0x8edc('0x47')]=function(_0x50ba46,_0x41a612){var _0x1a8c0a={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8edc('0x48')],'as':_0x8edc('0x46')},{'model':db[_0x8edc('0x49')],'as':'mandatoryDispositionPause'}]},_0xeeec27={},_0x5b7ca0={'count':0x0,'rows':[]};var _0x4cef08=_[_0x8edc('0x4a')](db[_0x8edc('0x4b')][_0x8edc('0x4c')],function(_0x5061a2){return{'name':_0x5061a2[_0x8edc('0x4d')],'type':_0x5061a2['type'][_0x8edc('0x4e')]};});_0xeeec27[_0x8edc('0x4f')]=_[_0x8edc('0x4a')](_0x4cef08,_0x8edc('0x2e'));_0xeeec27[_0x8edc('0x50')]=_[_0x8edc('0x51')](_0x50ba46[_0x8edc('0x50')]);_0xeeec27[_0x8edc('0x52')]=_[_0x8edc('0x53')](_0xeeec27[_0x8edc('0x4f')],_0xeeec27[_0x8edc('0x50')]);_0x1a8c0a['attributes']=_[_0x8edc('0x53')](_0xeeec27[_0x8edc('0x4f')],qs[_0x8edc('0x54')](_0x50ba46[_0x8edc('0x50')]['fields']));_0x1a8c0a[_0x8edc('0x55')]=_0x1a8c0a[_0x8edc('0x55')]['length']?_0x1a8c0a['attributes']:_0xeeec27[_0x8edc('0x4f')];if(!_0x50ba46[_0x8edc('0x50')][_0x8edc('0x56')]('nolimit')){_0x1a8c0a['limit']=qs[_0x8edc('0x57')](_0x50ba46[_0x8edc('0x50')][_0x8edc('0x57')]);_0x1a8c0a[_0x8edc('0x21')]=qs[_0x8edc('0x21')](_0x50ba46['query'][_0x8edc('0x21')]);}_0x1a8c0a[_0x8edc('0x58')]=qs[_0x8edc('0x59')](_0x50ba46['query']['sort']);_0x1a8c0a[_0x8edc('0x5a')]=qs['filters'](_[_0x8edc('0x5b')](_0x50ba46['query'],_0xeeec27[_0x8edc('0x52')]),_0x4cef08);if(_0x50ba46[_0x8edc('0x50')][_0x8edc('0x5c')]){_0x1a8c0a[_0x8edc('0x5a')]=_[_0x8edc('0x5d')](_0x1a8c0a[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0x4cef08,function(_0x2f7de6){if(_0x2f7de6[_0x8edc('0x5e')]!==_0x8edc('0x5f')){var _0x5ac164={};_0x5ac164[_0x2f7de6[_0x8edc('0x2e')]]={'$like':'%'+_0x50ba46[_0x8edc('0x50')][_0x8edc('0x5c')]+'%'};return _0x5ac164;}})});}_0x1a8c0a=_[_0x8edc('0x5d')]({},_0x1a8c0a,_0x50ba46[_0x8edc('0x60')]);var _0x5af1e1={'where':_0x1a8c0a['where']};return db[_0x8edc('0x4b')][_0x8edc('0x23')](_0x5af1e1)['then'](function(_0x36a31d){_0x5b7ca0[_0x8edc('0x23')]=_0x36a31d;if(_0x50ba46[_0x8edc('0x50')][_0x8edc('0x61')]){_0x1a8c0a[_0x8edc('0x62')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1a8c0a);})['then'](function(_0x256eb0){_0x5b7ca0[_0x8edc('0x63')]=_0x256eb0;return _0x5b7ca0;})[_0x8edc('0x27')](respondWithFilteredResult(_0x41a612,_0x1a8c0a))[_0x8edc('0x1e')](handleError(_0x41a612,null));};exports[_0x8edc('0x64')]=function(_0x587333,_0x419a7f){var _0x2119f3={'raw':![],'where':{'id':_0x587333[_0x8edc('0x65')]['id']},'include':[{'model':db[_0x8edc('0x66')],'as':_0x8edc('0x45')},{'model':db[_0x8edc('0x48')],'as':'Smtp'},{'model':db[_0x8edc('0x49')],'as':_0x8edc('0x67')}]},_0x58def8={};_0x58def8[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0x4b')][_0x8edc('0x4c')]);_0x58def8[_0x8edc('0x50')]=_[_0x8edc('0x51')](_0x587333[_0x8edc('0x50')]);_0x58def8[_0x8edc('0x52')]=_[_0x8edc('0x53')](_0x58def8[_0x8edc('0x4f')],_0x58def8['query']);_0x2119f3['attributes']=_['intersection'](_0x58def8[_0x8edc('0x4f')],qs[_0x8edc('0x54')](_0x587333[_0x8edc('0x50')][_0x8edc('0x54')]));_0x2119f3[_0x8edc('0x55')]=_0x2119f3[_0x8edc('0x55')][_0x8edc('0x68')]?_0x2119f3[_0x8edc('0x55')]:_0x58def8[_0x8edc('0x4f')];if(_0x587333[_0x8edc('0x50')][_0x8edc('0x61')]){_0x2119f3[_0x8edc('0x62')]=[{'all':!![]}];}_0x2119f3=_[_0x8edc('0x5d')]({},_0x2119f3,_0x587333[_0x8edc('0x60')]);return db[_0x8edc('0x4b')][_0x8edc('0x69')](_0x2119f3)[_0x8edc('0x27')](handleEntityNotFound(_0x419a7f,null))['then'](respondWithResult(_0x419a7f,null))[_0x8edc('0x1e')](handleError(_0x419a7f,null));};exports[_0x8edc('0x26')]=function(_0x501afb,_0x328382){if(_0x501afb[_0x8edc('0x6a')]['id']){delete _0x501afb[_0x8edc('0x6a')]['id'];}var _0x412125=_0x501afb[_0x8edc('0x6a')][_0x8edc('0x6b')]==='custom'?null:_0x501afb[_0x8edc('0x6a')][_0x8edc('0x6b')];var _0x2e58be=_0x501afb['body'][_0x8edc('0x45')]||{};var _0x151405=_0x501afb[_0x8edc('0x6a')][_0x8edc('0x46')]||{};if(_0x412125){_0x2e58be['host']=getImapHost(_0x412125);_0x2e58be[_0x8edc('0x42')]=0x3e1;_0x151405[_0x8edc('0x41')]=getSmtpHost(_0x412125);_0x151405[_0x8edc('0x42')]=0x24b;_0x151405['secure']=![];}if(_0x151405[_0x8edc('0x3e')]){_0x151405[_0x8edc('0x6c')]=![];}else{_0x151405[_0x8edc('0x3f')]=null;}if(!_0x2e58be[_0x8edc('0x3e')])_0x2e58be[_0x8edc('0x3f')]=null;_0x501afb[_0x8edc('0x6a')][_0x8edc('0x45')]=_0x2e58be;_0x501afb[_0x8edc('0x6a')][_0x8edc('0x46')]=_0x151405;return db['MailAccount'][_0x8edc('0x69')]({'where':{'id':_0x501afb[_0x8edc('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8edc('0x45')},{'model':db[_0x8edc('0x48')],'as':'Smtp'},{'model':db[_0x8edc('0x49')],'as':_0x8edc('0x67')}]})[_0x8edc('0x27')](handleEntityNotFound(_0x328382,null))[_0x8edc('0x27')](function(_0x33e41d){if(!_0x33e41d)throw new Error(_0x8edc('0x6d'));if(_0x33e41d[_0x8edc('0x43')])delete _0x501afb['body'][_0x8edc('0x45')];return _0x33e41d;})[_0x8edc('0x27')](saveUpdates(_0x501afb['body'],null))[_0x8edc('0x27')](function(_0x2f7b08){if(!_0x501afb[_0x8edc('0x6a')]['Imap'])return _0x2f7b08;return db['MailServerIn'][_0x8edc('0x26')](_0x501afb[_0x8edc('0x6a')][_0x8edc('0x45')],{'where':{'MailAccountId':_0x2f7b08['id']}})['then'](function(){return _0x2f7b08;});})[_0x8edc('0x27')](function(_0x4654ac){if(!_0x501afb['body'][_0x8edc('0x46')])return _0x4654ac;return db[_0x8edc('0x48')][_0x8edc('0x26')](_0x501afb[_0x8edc('0x6a')]['Smtp'],{'where':{'MailAccountId':_0x4654ac['id']}})[_0x8edc('0x27')](function(){return _0x4654ac;});})['then'](respondWithResult(_0x328382,null))[_0x8edc('0x1e')](handleError(_0x328382,null));};exports['describe']=function(_0x1d9e94,_0x57461f){return db[_0x8edc('0x4b')][_0x8edc('0x6e')]()[_0x8edc('0x27')](respondWithResult(_0x57461f,null))[_0x8edc('0x1e')](handleError(_0x57461f,null));};exports[_0x8edc('0x6f')]=function(_0x5d9452,_0x26a855){if(_0x5d9452['body']['id']){delete _0x5d9452[_0x8edc('0x6a')]['id'];}return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x5d9452[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x26a855,null))['then'](function(_0x40d148){if(_0x40d148){_0x5d9452[_0x8edc('0x6a')][_0x8edc('0x70')]=_0x40d148['id'];return db[_0x8edc('0x71')][_0x8edc('0x72')](_0x5d9452['body']);}})[_0x8edc('0x27')](respondWithResult(_0x26a855,null))[_0x8edc('0x1e')](handleError(_0x26a855,null));};exports[_0x8edc('0x73')]=function(_0x5dec87,_0x58812a){var _0x201a8e={'raw':![],'where':{}};var _0x7fb676={};var _0x38741e={'count':0x0,'rows':[]};return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0x5dec87[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x58812a,null))[_0x8edc('0x27')](function(_0x15f18b){if(_0x15f18b){_0x7fb676['model']=_['keys'](db[_0x8edc('0x71')]['rawAttributes']);_0x7fb676['query']=_['keys'](_0x5dec87[_0x8edc('0x50')]);_0x7fb676[_0x8edc('0x52')]=_[_0x8edc('0x53')](_0x7fb676['model'],_0x7fb676[_0x8edc('0x50')]);_0x201a8e['attributes']=_[_0x8edc('0x53')](_0x7fb676['model'],qs[_0x8edc('0x54')](_0x5dec87['query'][_0x8edc('0x54')]));_0x201a8e[_0x8edc('0x55')]=_0x201a8e['attributes']['length']?_0x201a8e['attributes']:_0x7fb676[_0x8edc('0x4f')];if(!_0x5dec87[_0x8edc('0x50')][_0x8edc('0x56')](_0x8edc('0x75'))){_0x201a8e[_0x8edc('0x57')]=qs[_0x8edc('0x57')](_0x5dec87[_0x8edc('0x50')][_0x8edc('0x57')]);_0x201a8e[_0x8edc('0x21')]=qs[_0x8edc('0x21')](_0x5dec87[_0x8edc('0x50')][_0x8edc('0x21')]);}_0x201a8e[_0x8edc('0x58')]=qs[_0x8edc('0x59')](_0x5dec87['query']['sort']);_0x201a8e[_0x8edc('0x5a')]=qs['filters'](_[_0x8edc('0x5b')](_0x5dec87[_0x8edc('0x50')],_0x7fb676[_0x8edc('0x52')]));_0x201a8e[_0x8edc('0x5a')][_0x8edc('0x70')]=_0x15f18b['id'];if(_0x5dec87[_0x8edc('0x50')][_0x8edc('0x5c')]){_0x201a8e[_0x8edc('0x5a')]=_[_0x8edc('0x5d')](_0x201a8e[_0x8edc('0x5a')],{'$or':_['map'](_0x201a8e[_0x8edc('0x55')],function(_0x20a8e0){var _0x110532={};_0x110532[_0x20a8e0]={'$like':'%'+_0x5dec87[_0x8edc('0x50')][_0x8edc('0x5c')]+'%'};return _0x110532;})});}_0x201a8e=_[_0x8edc('0x5d')]({},_0x201a8e,_0x5dec87['options']);return db['Disposition'][_0x8edc('0x23')]({'where':_0x201a8e[_0x8edc('0x5a')]})[_0x8edc('0x27')](function(_0x1a83c8){_0x38741e[_0x8edc('0x23')]=_0x1a83c8;if(_0x5dec87[_0x8edc('0x50')][_0x8edc('0x61')]){_0x201a8e[_0x8edc('0x62')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x201a8e);})[_0x8edc('0x27')](function(_0x4fa082){_0x38741e[_0x8edc('0x63')]=_0x4fa082;return _0x38741e;});}})[_0x8edc('0x27')](respondWithFilteredResult(_0x58812a,_0x201a8e))['catch'](handleError(_0x58812a,null));};exports['removeDispositions']=function(_0x4568b7,_0x2d259d){return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x4568b7[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x2d259d,null))[_0x8edc('0x27')](function(_0x5731c5){if(_0x5731c5){return _0x5731c5[_0x8edc('0x76')](_0x4568b7[_0x8edc('0x50')][_0x8edc('0x77')]);}})['then'](respondWithStatusCode(_0x2d259d,null))[_0x8edc('0x1e')](handleError(_0x2d259d,null));};exports[_0x8edc('0x78')]=function(_0x44baac,_0x6df563){if(_0x44baac[_0x8edc('0x6a')]['id']){delete _0x44baac[_0x8edc('0x6a')]['id'];}return db[_0x8edc('0x4b')]['find']({'where':{'id':_0x44baac[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x6df563,null))[_0x8edc('0x27')](function(_0x4a2fa3){if(_0x4a2fa3){_0x44baac[_0x8edc('0x6a')][_0x8edc('0x70')]=_0x4a2fa3['id'];return db[_0x8edc('0x79')]['create'](_0x44baac['body']);}})[_0x8edc('0x27')](respondWithResult(_0x6df563,null))[_0x8edc('0x1e')](handleError(_0x6df563,null));};exports['getAnswers']=function(_0x19c4fb,_0x740c55){var _0x372f97={'raw':![],'where':{}};var _0x3d3e31={};var _0x55cfe3={'count':0x0,'rows':[]};return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0x19c4fb[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0x740c55,null))[_0x8edc('0x27')](function(_0x5c0511){if(_0x5c0511){_0x3d3e31[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0x79')][_0x8edc('0x4c')]);_0x3d3e31[_0x8edc('0x50')]=_[_0x8edc('0x51')](_0x19c4fb['query']);_0x3d3e31[_0x8edc('0x52')]=_['intersection'](_0x3d3e31[_0x8edc('0x4f')],_0x3d3e31['query']);_0x372f97[_0x8edc('0x55')]=_[_0x8edc('0x53')](_0x3d3e31['model'],qs[_0x8edc('0x54')](_0x19c4fb[_0x8edc('0x50')]['fields']));_0x372f97['attributes']=_0x372f97[_0x8edc('0x55')]['length']?_0x372f97[_0x8edc('0x55')]:_0x3d3e31[_0x8edc('0x4f')];if(!_0x19c4fb[_0x8edc('0x50')][_0x8edc('0x56')](_0x8edc('0x75'))){_0x372f97[_0x8edc('0x57')]=qs[_0x8edc('0x57')](_0x19c4fb[_0x8edc('0x50')][_0x8edc('0x57')]);_0x372f97['offset']=qs[_0x8edc('0x21')](_0x19c4fb[_0x8edc('0x50')][_0x8edc('0x21')]);}_0x372f97[_0x8edc('0x58')]=qs[_0x8edc('0x59')](_0x19c4fb[_0x8edc('0x50')][_0x8edc('0x59')]);_0x372f97[_0x8edc('0x5a')]=qs[_0x8edc('0x52')](_[_0x8edc('0x5b')](_0x19c4fb[_0x8edc('0x50')],_0x3d3e31[_0x8edc('0x52')]));_0x372f97[_0x8edc('0x5a')][_0x8edc('0x70')]=_0x5c0511['id'];if(_0x19c4fb[_0x8edc('0x50')][_0x8edc('0x5c')]){_0x372f97[_0x8edc('0x5a')]=_[_0x8edc('0x5d')](_0x372f97[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0x372f97[_0x8edc('0x55')],function(_0x392028){var _0x2f5642={};_0x2f5642[_0x392028]={'$like':'%'+_0x19c4fb['query'][_0x8edc('0x5c')]+'%'};return _0x2f5642;})});}_0x372f97=_[_0x8edc('0x5d')]({},_0x372f97,_0x19c4fb[_0x8edc('0x60')]);return db[_0x8edc('0x79')][_0x8edc('0x23')]({'where':_0x372f97[_0x8edc('0x5a')]})['then'](function(_0x196cc9){_0x55cfe3['count']=_0x196cc9;if(_0x19c4fb['query']['includeAll']){_0x372f97[_0x8edc('0x62')]=[{'all':!![]}];}return db[_0x8edc('0x79')][_0x8edc('0x7a')](_0x372f97);})[_0x8edc('0x27')](function(_0x31fcd1){_0x55cfe3[_0x8edc('0x63')]=_0x31fcd1;return _0x55cfe3;});}})[_0x8edc('0x27')](respondWithFilteredResult(_0x740c55,_0x372f97))[_0x8edc('0x1e')](handleError(_0x740c55,null));};exports[_0x8edc('0x7b')]=function(_0x543081,_0x2cbdc9){return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x543081[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0x2cbdc9,null))[_0x8edc('0x27')](function(_0x18baaa){if(_0x18baaa){return _0x18baaa[_0x8edc('0x7b')](_0x543081[_0x8edc('0x50')][_0x8edc('0x77')]);}})[_0x8edc('0x27')](respondWithStatusCode(_0x2cbdc9,null))['catch'](handleError(_0x2cbdc9,null));};exports[_0x8edc('0x72')]=function(_0x1b5c6d,_0x126014){var _0xd12509={'name':_0x1b5c6d[_0x8edc('0x6a')][_0x8edc('0x2e')],'key':_0x1b5c6d[_0x8edc('0x6a')][_0x8edc('0x4e')],'provider':_0x1b5c6d[_0x8edc('0x6a')]['provider']==='custom'?null:_0x1b5c6d[_0x8edc('0x6a')]['provider'],'email':_0x1b5c6d[_0x8edc('0x6a')][_0x8edc('0x7c')],'ListId':_0x1b5c6d[_0x8edc('0x6a')]['ListId'],'active':!_[_0x8edc('0x7d')](_0x1b5c6d['body'][_0x8edc('0x7e')])?_0x1b5c6d['body']['active']:!![],'description':_0x1b5c6d[_0x8edc('0x6a')][_0x8edc('0x7f')]||null};var _0x5c5f25=getAuthenticationOptions(_0xd12509['provider'],_0x1b5c6d['body']);_0xd12509[_0x8edc('0x45')]=_0x5c5f25[_0x8edc('0x45')];_0xd12509[_0x8edc('0x46')]=_0x5c5f25[_0x8edc('0x46')];return db['MailAccount']['create'](_0xd12509,{'include':[{'model':db[_0x8edc('0x48')],'as':_0x8edc('0x46')},{'model':db[_0x8edc('0x66')],'as':_0x8edc('0x45')}]})[_0x8edc('0x27')](function(_0x4082b8){var _0x2cef88=_0x1b5c6d['user']['get']({'plain':!![]});if(!_0x2cef88)throw new Error(_0x8edc('0x80'));if(_0x2cef88[_0x8edc('0x81')]==='user'){var _0x3a19d7=_0x4082b8[_0x8edc('0x28')]({'plain':!![]});return db[_0x8edc('0x82')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x2cef88[_0x8edc('0x83')]},'raw':!![]})[_0x8edc('0x27')](function(_0x45499d){if(_0x45499d&&_0x45499d[_0x8edc('0x84')]===0x0){return db[_0x8edc('0x2a')][_0x8edc('0x72')]({'name':_0x3a19d7[_0x8edc('0x2e')],'resourceId':_0x3a19d7['id'],'type':_0x45499d[_0x8edc('0x2e')],'sectionId':_0x45499d['id']},{})[_0x8edc('0x27')](function(){return _0x4082b8;});}else{return _0x4082b8;}})[_0x8edc('0x1e')](function(_0x58a168){logger[_0x8edc('0x1a')](_0x8edc('0x85'),_0x58a168);throw _0x58a168;});}return _0x4082b8;})[_0x8edc('0x27')](respondWithResult(_0x126014,0xc9))[_0x8edc('0x1e')](handleError(_0x126014,null));};exports[_0x8edc('0x86')]=function(_0x44b7a4,_0x3bb6dd){return db['MailAccount']['findOne']({'where':{'id':_0x44b7a4[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0x3bb6dd,null))['then'](function(_0x5a6082){if(_0x5a6082){return _0x5a6082[_0x8edc('0x86')]();}return null;})[_0x8edc('0x27')](respondWithResult(_0x3bb6dd,null))['catch'](handleError(_0x3bb6dd,null));};exports[_0x8edc('0x87')]=function(_0x580cf2,_0x219707){if(_0x580cf2['body']['id']){delete _0x580cf2['body']['id'];}return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x580cf2['params']['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x219707,null))['then'](function(_0x3a5d8a){if(_0x3a5d8a){_0x580cf2[_0x8edc('0x6a')][_0x8edc('0x70')]=_0x3a5d8a['id'];return db[_0x8edc('0x66')][_0x8edc('0x72')](_0x580cf2[_0x8edc('0x6a')]);}})[_0x8edc('0x27')](respondWithResult(_0x219707,null))[_0x8edc('0x1e')](handleError(_0x219707,null));};exports[_0x8edc('0x88')]=function(_0x104450,_0x1c1c9e){return db[_0x8edc('0x4b')]['findOne']({'where':{'id':_0x104450[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0x1c1c9e,null))[_0x8edc('0x27')](function(_0x15026e){if(_0x15026e){return _0x15026e[_0x8edc('0x89')](null);}return null;})[_0x8edc('0x27')](respondWithStatusCode(_0x1c1c9e,null))[_0x8edc('0x1e')](handleError(_0x1c1c9e,null));};exports[_0x8edc('0x8a')]=function(_0xebbe70,_0x5894d8){return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0xebbe70[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x5894d8,null))[_0x8edc('0x27')](function(_0x42c6ca){if(_0x42c6ca){return _0x42c6ca['getSmtp']();}return null;})[_0x8edc('0x27')](respondWithResult(_0x5894d8,null))[_0x8edc('0x1e')](handleError(_0x5894d8,null));};exports[_0x8edc('0x8b')]=function(_0x2ee971,_0x1d3be3){if(_0x2ee971['body']['id']){delete _0x2ee971[_0x8edc('0x6a')]['id'];}return db['MailAccount'][_0x8edc('0x69')]({'where':{'id':_0x2ee971[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x1d3be3,null))[_0x8edc('0x27')](function(_0x5de4ef){if(_0x5de4ef){_0x2ee971[_0x8edc('0x6a')][_0x8edc('0x70')]=_0x5de4ef['id'];return db['MailServerOut'][_0x8edc('0x72')](_0x2ee971['body']);}})[_0x8edc('0x27')](respondWithResult(_0x1d3be3,null))['catch'](handleError(_0x1d3be3,null));};exports[_0x8edc('0x8c')]=function(_0x371af6,_0xc86a2e){return db[_0x8edc('0x4b')]['findOne']({'where':{'id':_0x371af6[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0xc86a2e,null))[_0x8edc('0x27')](function(_0x343853){if(_0x343853){return _0x343853[_0x8edc('0x8d')](null);}return null;})[_0x8edc('0x27')](respondWithStatusCode(_0xc86a2e,null))[_0x8edc('0x1e')](handleError(_0xc86a2e,null));};exports[_0x8edc('0x8e')]=function(_0x2cc4ff,_0x58ca0f){return db['MailInteraction'][_0x8edc('0x69')]({'where':{'id':_0x2cc4ff[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x58ca0f,null))[_0x8edc('0x27')](function(_0x4773f8){if(_0x4773f8){return _0x4773f8[_0x8edc('0x8e')](_0x2cc4ff['body'][_0x8edc('0x77')],_[_0x8edc('0x8f')](_0x2cc4ff[_0x8edc('0x6a')],[_0x8edc('0x77'),'id'])||{});}})['then'](respondWithResult(_0x58ca0f,null))[_0x8edc('0x1e')](handleError(_0x58ca0f,null));};exports['getInteractions']=function(_0x5449d8,_0x183b94){var _0x239f77={'raw':![],'where':{}};var _0x2234b5={};var _0x5b0dd4={'count':0x0,'rows':[]};return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0x5449d8[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0x183b94,null))[_0x8edc('0x27')](function(_0x4b145e){if(_0x4b145e){_0x2234b5[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0x90')][_0x8edc('0x4c')]);_0x2234b5['query']=_[_0x8edc('0x51')](_0x5449d8['query']);_0x2234b5['filters']=_['intersection'](_0x2234b5['model'],_0x2234b5[_0x8edc('0x50')]);_0x239f77[_0x8edc('0x55')]=_[_0x8edc('0x53')](_0x2234b5['model'],qs[_0x8edc('0x54')](_0x5449d8[_0x8edc('0x50')]['fields']));_0x239f77[_0x8edc('0x55')]=_0x239f77['attributes'][_0x8edc('0x68')]?_0x239f77['attributes']:_0x2234b5['model'];if(!_0x5449d8[_0x8edc('0x50')]['hasOwnProperty'](_0x8edc('0x75'))){_0x239f77[_0x8edc('0x57')]=qs[_0x8edc('0x57')](_0x5449d8['query'][_0x8edc('0x57')]);_0x239f77[_0x8edc('0x21')]=qs[_0x8edc('0x21')](_0x5449d8[_0x8edc('0x50')][_0x8edc('0x21')]);}_0x239f77[_0x8edc('0x58')]=qs[_0x8edc('0x59')](_0x5449d8[_0x8edc('0x50')][_0x8edc('0x59')]);_0x239f77[_0x8edc('0x5a')]=qs[_0x8edc('0x52')](_[_0x8edc('0x5b')](_0x5449d8[_0x8edc('0x50')],_0x2234b5[_0x8edc('0x52')]));_0x239f77[_0x8edc('0x5a')]['MailAccountId']=_0x4b145e['id'];if(_0x5449d8[_0x8edc('0x50')][_0x8edc('0x5c')]){_0x239f77['where']=_[_0x8edc('0x5d')](_0x239f77[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0x239f77[_0x8edc('0x55')],function(_0x1437d4){var _0x6b24fe={};_0x6b24fe[_0x1437d4]={'$like':'%'+_0x5449d8[_0x8edc('0x50')][_0x8edc('0x5c')]+'%'};return _0x6b24fe;})});}_0x239f77=_[_0x8edc('0x5d')]({},_0x239f77,_0x5449d8[_0x8edc('0x60')]);return db[_0x8edc('0x90')][_0x8edc('0x23')]({'where':_0x239f77[_0x8edc('0x5a')]})['then'](function(_0x22a99b){_0x5b0dd4['count']=_0x22a99b;if(_0x5449d8['query'][_0x8edc('0x61')]){_0x239f77['include']=[{'model':db['CmContact'],'as':_0x8edc('0x91'),'required':![]},{'model':db['User'],'as':_0x8edc('0x92'),'attributes':[_0x8edc('0x2e'),_0x8edc('0x93'),_0x8edc('0x94')],'required':![]},{'model':db[_0x8edc('0x95')],'as':_0x8edc('0x96'),'attributes':['id',_0x8edc('0x2e'),_0x8edc('0x97')],'where':_0x5449d8['query'][_0x8edc('0x98')]?{'id':_0x5449d8[_0x8edc('0x50')][_0x8edc('0x98')]}:undefined,'required':_0x5449d8['query'][_0x8edc('0x98')]?!![]:![]}];}return db[_0x8edc('0x90')][_0x8edc('0x7a')](_0x239f77);})[_0x8edc('0x27')](function(_0x24fc35){_0x5b0dd4[_0x8edc('0x63')]=_0x24fc35;return _0x5b0dd4;});}})[_0x8edc('0x27')](respondWithFilteredResult(_0x183b94,_0x239f77))[_0x8edc('0x1e')](handleError(_0x183b94,null));};exports['addApplications']=function addApplications(_0x22d6f1,_0x360e9a){var _0xc94948=_0x22d6f1[_0x8edc('0x65')]['id'];var _0x18aa03=_0x22d6f1['body'];var _0x1fc59b=0xc8;var _0x17fb75=null;return db[_0x8edc('0x99')][_0x8edc('0x9a')]({'isolationLevel':db[_0x8edc('0x99')][_0x8edc('0x9b')][_0x8edc('0x9c')][_0x8edc('0x9d')]},function(_0x426e35){return db[_0x8edc('0x4b')]['findOne']({'where':{'id':_0xc94948},'transaction':_0x426e35})['then'](function(_0x3759cc){if(_0x3759cc){return db[_0x8edc('0x9e')]['destroy']({'where':{'MailAccountId':_0xc94948},'transaction':_0x426e35})[_0x8edc('0x27')](function(){var _0x40c226=_[_0x8edc('0x4a')](_0x18aa03,function(_0x47ed19){_0x47ed19['MailAccountId']=_0xc94948;return _0x47ed19;});return db[_0x8edc('0x9e')][_0x8edc('0x9f')](_0x40c226,{'transaction':_0x426e35});});}else{_0x1fc59b=0x194;_0x17fb75=[];}});})[_0x8edc('0x27')](function(){if(_0x1fc59b!==0x194){return db[_0x8edc('0x9e')]['findAndCountAll']({'where':{'MailAccountId':_0xc94948},'order':_0x8edc('0xa0')})['then'](function(_0x423a05){_0x17fb75=_0x423a05;});}})[_0x8edc('0x1e')](function(_0x297d05){_0x1fc59b=0x1f4;logger[_0x8edc('0x1a')](_0x297d05[_0x8edc('0x2d')]);if(_0x297d05[_0x8edc('0x2e')]){delete _0x297d05[_0x8edc('0x2e')];}_0x17fb75=_0x297d05;})[_0x8edc('0xa1')](function(){if(_0x17fb75===null){_0x360e9a[_0x8edc('0x2c')](_0x1fc59b);}else{if(_0x1fc59b===0x1f4){_0x360e9a[_0x8edc('0x1f')](_0x1fc59b)['send'](_0x17fb75);}else{_0x360e9a[_0x8edc('0x1f')](_0x1fc59b)[_0x8edc('0x25')](_0x17fb75);}}});};exports[_0x8edc('0xa2')]=function(_0x35a3ce,_0x2b8e8d){var _0xdb1780={};var _0x1ddd7e={};var _0x518e52;var _0xab3b68;return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0x35a3ce[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x2b8e8d,null))[_0x8edc('0x27')](function(_0xd30514){if(_0xd30514){_0x518e52=_0xd30514;_0x1ddd7e[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0x9e')]['rawAttributes']);_0x1ddd7e[_0x8edc('0x50')]=_[_0x8edc('0x51')](_0x35a3ce[_0x8edc('0x50')]);_0x1ddd7e['filters']=_[_0x8edc('0x53')](_0x1ddd7e[_0x8edc('0x4f')],_0x1ddd7e[_0x8edc('0x50')]);_0xdb1780[_0x8edc('0x55')]=_[_0x8edc('0x53')](_0x1ddd7e['model'],qs[_0x8edc('0x54')](_0x35a3ce[_0x8edc('0x50')][_0x8edc('0x54')]));_0xdb1780[_0x8edc('0x55')]=_0xdb1780['attributes'][_0x8edc('0x68')]?_0xdb1780[_0x8edc('0x55')]:_0x1ddd7e['model'];_0xdb1780['order']=qs[_0x8edc('0x59')](_0x35a3ce['query'][_0x8edc('0x59')]);_0xdb1780[_0x8edc('0x5a')]=qs[_0x8edc('0x52')](_[_0x8edc('0x5b')](_0x35a3ce[_0x8edc('0x50')],_0x1ddd7e[_0x8edc('0x52')]));if(_0x35a3ce[_0x8edc('0x50')][_0x8edc('0x5c')]){_0xdb1780['where']=_[_0x8edc('0x5d')](_0xdb1780[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0xdb1780[_0x8edc('0x55')],function(_0x4b328f){var _0x2531ba={};_0x2531ba[_0x4b328f]={'$like':'%'+_0x35a3ce['query']['filter']+'%'};return _0x2531ba;})});}_0xdb1780=_[_0x8edc('0x5d')]({},_0xdb1780,_0x35a3ce[_0x8edc('0x60')]);return _0x518e52[_0x8edc('0xa2')](_0xdb1780);}})['then'](function(_0x128a9f){if(_0x128a9f){_0xab3b68=_0x128a9f[_0x8edc('0x68')];if(!_0x35a3ce['query'][_0x8edc('0x56')](_0x8edc('0x75'))){_0xdb1780[_0x8edc('0x57')]=qs[_0x8edc('0x57')](_0x35a3ce[_0x8edc('0x50')][_0x8edc('0x57')]);_0xdb1780[_0x8edc('0x21')]=qs[_0x8edc('0x21')](_0x35a3ce[_0x8edc('0x50')]['offset']);}return _0x518e52[_0x8edc('0xa2')](_0xdb1780);}})[_0x8edc('0x27')](function(_0x30cc43){if(_0x30cc43){return _0x30cc43?{'count':_0xab3b68,'rows':_0x30cc43}:null;}})['then'](respondWithResult(_0x2b8e8d,null))[_0x8edc('0x1e')](handleError(_0x2b8e8d,null));};exports[_0x8edc('0xa3')]=function(_0x43d587,_0x1a305e){var _0x48860b={'raw':!![],'where':{}};var _0x1f5f15={};var _0x34d561={'count':0x0,'rows':[]};return db[_0x8edc('0x4b')]['findOne']({'where':{'id':_0x43d587[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x1a305e,null))['then'](function(_0x441ca9){if(_0x441ca9){_0x1f5f15[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0xa4')][_0x8edc('0x4c')]);_0x1f5f15[_0x8edc('0x50')]=_['keys'](_0x43d587[_0x8edc('0x50')]);_0x1f5f15['filters']=_['intersection'](_0x1f5f15['model'],_0x1f5f15[_0x8edc('0x50')]);_0x48860b[_0x8edc('0x55')]=_[_0x8edc('0x53')](_0x1f5f15[_0x8edc('0x4f')],qs[_0x8edc('0x54')](_0x43d587['query'][_0x8edc('0x54')]));_0x48860b['attributes']=_0x48860b[_0x8edc('0x55')]['length']?_0x48860b['attributes']:_0x1f5f15[_0x8edc('0x4f')];if(!_0x43d587['query']['hasOwnProperty'](_0x8edc('0x75'))){_0x48860b[_0x8edc('0x57')]=qs[_0x8edc('0x57')](_0x43d587[_0x8edc('0x50')][_0x8edc('0x57')]);_0x48860b[_0x8edc('0x21')]=qs[_0x8edc('0x21')](_0x43d587[_0x8edc('0x50')]['offset']);}_0x48860b[_0x8edc('0x58')]=qs[_0x8edc('0x59')](_0x43d587['query'][_0x8edc('0x59')]);_0x48860b[_0x8edc('0x5a')]=qs['filters'](_[_0x8edc('0x5b')](_0x43d587[_0x8edc('0x50')],_0x1f5f15[_0x8edc('0x52')]));_0x48860b[_0x8edc('0x5a')]['MailAccountId']=_0x441ca9['id'];if(_0x43d587['query'][_0x8edc('0x5c')]){_0x48860b[_0x8edc('0x5a')]=_[_0x8edc('0x5d')](_0x48860b[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0x48860b[_0x8edc('0x55')],function(_0x48aa85){var _0x21129d={};_0x21129d[_0x48aa85]={'$like':'%'+_0x43d587[_0x8edc('0x50')]['filter']+'%'};return _0x21129d;})});}if(_0x43d587['query'][_0x8edc('0xa5')]){var _0x4d9873=_0x43d587[_0x8edc('0x50')]['$gte']['split'](',');var _0x383b58={};_0x383b58[_0x4d9873[0x0]]={'$gte':moment(_0x4d9873[0x1])['format'](_0x8edc('0xa6'))};_0x48860b['where']=_[_0x8edc('0x5d')](_0x48860b['where'],_0x383b58);}_0x48860b=_[_0x8edc('0x5d')]({},_0x48860b,_0x43d587[_0x8edc('0x60')]);return db[_0x8edc('0xa4')]['count']({'where':_0x48860b[_0x8edc('0x5a')]})['then'](function(_0x17be90){_0x34d561['count']=_0x17be90;if(_0x43d587['query'][_0x8edc('0x61')]){_0x48860b['include']=[{'all':!![]}];}return db[_0x8edc('0xa4')][_0x8edc('0x7a')](_0x48860b);})['then'](function(_0x549fe6){if(_0x43d587[_0x8edc('0x50')][_0x8edc('0xa7')]==='true'){for(var _0x2b98c6=0x0;_0x2b98c6<_0x549fe6[_0x8edc('0x68')];_0x2b98c6++){_0x549fe6[_0x2b98c6][_0x8edc('0x6a')]=juice(_0x549fe6[_0x2b98c6]['body']);}}_0x34d561[_0x8edc('0x63')]=_0x549fe6;return _0x34d561;});}})['then'](respondWithFilteredResult(_0x1a305e,_0x48860b))[_0x8edc('0x1e')](handleError(_0x1a305e,null));};exports['send']=function(_0x4a82c9,_0x581055){var _0x1ea24e,_0x4b650f={},_0x36ed56;if(_0x4a82c9[_0x8edc('0x6a')]['to']){_0x36ed56=_0x4a82c9[_0x8edc('0x6a')]['to'][_0x8edc('0xa8')](',')[0x0];}return db['MailAccount'][_0x8edc('0x69')]({'where':{'id':_0x4a82c9['params']['id']},'include':[{'model':db[_0x8edc('0xa9')],'as':_0x8edc('0xaa'),'include':[{'model':db[_0x8edc('0xab')],'as':'Contacts','where':{'email':_0x36ed56},'limit':0x1,'order':[[_0x8edc('0xac'),_0x8edc('0xad')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8edc('0xae')],'as':_0x8edc('0xae'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x581055,null))[_0x8edc('0x27')](function(_0x55cef4){if(!_0x55cef4)return;_0x1ea24e=_0x55cef4;if(!_0x55cef4['Smtp'])throw new Error(_0x8edc('0xaf'));if(_[_0x8edc('0x7d')](_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb0')])){_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb0')]=util['format']('%s\x20<%s>',_0x55cef4[_0x8edc('0x2e')],_0x55cef4[_0x8edc('0x7c')]||_0x55cef4[_0x8edc('0x46')][_0x8edc('0x3c')]);}if(_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb1')]&&_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb1')][_0x8edc('0x68')]){for(var _0x1f8d11=0x0;_0x1f8d11<_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb1')][_0x8edc('0x68')];_0x1f8d11+=0x1){_0x4a82c9[_0x8edc('0x6a')]['attachments'][_0x1f8d11]={'filename':_0x4a82c9['body']['attachments'][_0x1f8d11]['name'],'path':path['join'](config[_0x8edc('0xb2')],'server/files/attachments',_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb1')][_0x1f8d11][_0x8edc('0xb3')])};}}var _0x422509=_0x55cef4['getSmtpOptions']();return respondWithRpcPromise(_0x8edc('0xb4'),_0x8edc('0xb5'),{'account':_0x422509,'message':_0x4a82c9[_0x8edc('0x6a')]});})[_0x8edc('0x27')](function(_0x5cea13){if(!_0x5cea13)return;_0x4b650f=_0x5cea13;if(!_0x1ea24e[_0x8edc('0xaa')])throw new Error(_0x8edc('0xb6'));if(_0x1ea24e[_0x8edc('0xaa')][_0x8edc('0xb7')][_0x8edc('0x68')])return _0x1ea24e[_0x8edc('0xaa')][_0x8edc('0xb7')][0x0];return db[_0x8edc('0xab')][_0x8edc('0x72')](_[_0x8edc('0xb')](_0x4a82c9['body'],{'firstName':_0x4a82c9[_0x8edc('0x6a')]['to'],'email':_0x4a82c9[_0x8edc('0x6a')]['to'],'phone':_0x4a82c9['body']['to'],'ListId':_0x1ea24e['ListId']}));})['then'](function(_0x41025c){if(!_0x41025c)return;var _0x1ab52b={'UserId':_0x4a82c9[_0x8edc('0x3c')]['id'],'ContactId':_0x41025c['id'],'MailAccountId':_0x1ea24e['id'],'inReplyTo':_0x4b650f['messageId'],'to':_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb0')],'cc':_0x4a82c9[_0x8edc('0x6a')]['cc'],'subject':_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb8')],'attach':_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xb9')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8edc('0xba')](_0x8edc('0xa6')),'lastMsgDirection':'out','Messages':[_[_0x8edc('0x5d')](_0x4a82c9[_0x8edc('0x6a')],{'messageId':_0x4b650f['messageId'],'sentAt':moment()[_0x8edc('0xba')](_0x8edc('0xa6')),'read':!![],'MailAccountId':_0x1ea24e['id'],'UserId':_0x4a82c9[_0x8edc('0x3c')]['id'],'ContactId':_0x41025c['id']})]};if(_0x4a82c9[_0x8edc('0x6a')][_0x8edc('0xbb')]){_0x1ab52b=_[_0x8edc('0x5d')](_0x1ab52b,_0x4a82c9[_0x8edc('0x6a')]['Interaction']);}return db['MailInteraction'][_0x8edc('0x72')](_0x1ab52b,{'include':[{'model':db[_0x8edc('0xa4')],'as':_0x8edc('0xbc')}]});})[_0x8edc('0x27')](respondWithResult(_0x581055,null))[_0x8edc('0x1e')](handleError(_0x581055,null));};exports['verifySmtp']=function(_0x569103,_0x4005fe){return db['MailAccount']['find']({'where':{'id':_0x569103['params']['id']},'include':[{'model':db[_0x8edc('0x48')],'as':_0x8edc('0x46'),'raw':!![],'include':[{'model':db[_0x8edc('0xae')],'as':_0x8edc('0xae'),'raw':!![]}]}]})[_0x8edc('0x27')](handleEntityNotFound(_0x4005fe,null))[_0x8edc('0x27')](function(_0x365d27){if(!_0x365d27[_0x8edc('0x46')])return;var _0x2ad03d=_0x365d27[_0x8edc('0xbd')]();return respondWithRpcPromise(_0x8edc('0xbe'),_0x8edc('0xbf'),{'account':_0x2ad03d});})[_0x8edc('0x27')](respondWithResult(_0x4005fe,null))[_0x8edc('0x1e')](handleError(_0x4005fe,null));};exports[_0x8edc('0x2b')]=function(_0x220c72,_0x3177b3){return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x220c72[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x3177b3,null))['then'](function(_0x2bc76c){if(_0x2bc76c&&_0x2bc76c[_0x8edc('0x43')]){throw new db[(_0x8edc('0xc0'))][(_0x8edc('0xc1'))](_0x8edc('0xc2'));}return _0x2bc76c;})['then'](removeEntity(_0x3177b3,null))[_0x8edc('0x1e')](handleError(_0x3177b3,null));};exports['addAgents']=function(_0x462f8a,_0xb768b9){return db[_0x8edc('0x4b')][_0x8edc('0x69')]({'where':{'id':_0x462f8a[_0x8edc('0x65')]['id']}})['then'](handleEntityNotFound(_0xb768b9,null))[_0x8edc('0x27')](function(_0x162fe1){if(_0x162fe1){return _0x162fe1[_0x8edc('0xc3')](_0x462f8a['body']['ids'],_[_0x8edc('0x8f')](_0x462f8a['body'],[_0x8edc('0x77'),'id'])||{})[_0x8edc('0xc4')](function(_0x9803a5){for(var _0x236ebf=0x0;_0x236ebf<_0x462f8a['body']['ids'][_0x8edc('0x68')];_0x236ebf+=0x1){socket['emit'](_0x8edc('0xc5'),{'UserId':Number(_0x462f8a[_0x8edc('0x6a')][_0x8edc('0x77')][_0x236ebf]),'MailAccountId':Number(_0x462f8a[_0x8edc('0x65')]['id'])});}return _0x9803a5;});}})[_0x8edc('0x27')](respondWithResult(_0xb768b9,null))[_0x8edc('0x1e')](handleError(_0xb768b9,null));};exports[_0x8edc('0xc6')]=function(_0x18c5b6,_0x51e333){return db['MailAccount']['find']({'where':{'id':_0x18c5b6[_0x8edc('0x65')]['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x51e333,null))[_0x8edc('0x27')](function(_0x1c1c81){if(_0x1c1c81){return _0x1c1c81[_0x8edc('0xc6')](_0x18c5b6[_0x8edc('0x50')][_0x8edc('0x77')])[_0x8edc('0x27')](function(){if(_[_0x8edc('0xc7')](_0x18c5b6[_0x8edc('0x50')][_0x8edc('0x77')])){for(var _0x53ee91=0x0;_0x53ee91<_0x18c5b6[_0x8edc('0x50')][_0x8edc('0x77')][_0x8edc('0x68')];_0x53ee91+=0x1){socket[_0x8edc('0xc8')](_0x8edc('0xc9'),{'UserId':Number(_0x18c5b6[_0x8edc('0x50')]['ids'][_0x53ee91]),'MailAccountId':Number(_0x18c5b6[_0x8edc('0x65')]['id'])});}}else{socket['emit'](_0x8edc('0xc9'),{'UserId':Number(_0x18c5b6[_0x8edc('0x50')][_0x8edc('0x77')]),'MailAccountId':Number(_0x18c5b6[_0x8edc('0x65')]['id'])});}});}})[_0x8edc('0x27')](respondWithStatusCode(_0x51e333,null))[_0x8edc('0x1e')](handleError(_0x51e333,null));};exports[_0x8edc('0xca')]=function(_0x4463d3,_0x103602){var _0x28e81f={};var _0x1bb8eb={};var _0x59c1b3;var _0x260319;return db[_0x8edc('0x4b')][_0x8edc('0x74')]({'where':{'id':_0x4463d3['params']['id']}})[_0x8edc('0x27')](handleEntityNotFound(_0x103602,null))['then'](function(_0x48e832){if(_0x48e832){_0x59c1b3=_0x48e832;_0x1bb8eb[_0x8edc('0x4f')]=_[_0x8edc('0x51')](db[_0x8edc('0xcb')][_0x8edc('0x4c')]);_0x1bb8eb[_0x8edc('0x50')]=_[_0x8edc('0x51')](_0x4463d3[_0x8edc('0x50')]);_0x1bb8eb[_0x8edc('0x52')]=_[_0x8edc('0x53')](_0x1bb8eb[_0x8edc('0x4f')],_0x1bb8eb['query']);_0x28e81f[_0x8edc('0x55')]=_[_0x8edc('0x53')](_0x1bb8eb[_0x8edc('0x4f')],qs[_0x8edc('0x54')](_0x4463d3[_0x8edc('0x50')][_0x8edc('0x54')]));_0x28e81f['attributes']=_0x28e81f[_0x8edc('0x55')][_0x8edc('0x68')]?_0x28e81f[_0x8edc('0x55')]:_0x1bb8eb[_0x8edc('0x4f')];_0x28e81f[_0x8edc('0x58')]=qs['sort'](_0x4463d3[_0x8edc('0x50')]['sort']);_0x28e81f[_0x8edc('0x5a')]=qs[_0x8edc('0x52')](_[_0x8edc('0x5b')](_0x4463d3[_0x8edc('0x50')],_0x1bb8eb['filters']));if(_0x4463d3[_0x8edc('0x50')][_0x8edc('0x5c')]){_0x28e81f['where']=_[_0x8edc('0x5d')](_0x28e81f[_0x8edc('0x5a')],{'$or':_[_0x8edc('0x4a')](_0x28e81f[_0x8edc('0x55')],function(_0x528934){var _0xdfefd3={};_0xdfefd3[_0x528934]={'$like':'%'+_0x4463d3[_0x8edc('0x50')][_0x8edc('0x5c')]+'%'};return _0xdfefd3;})});}_0x28e81f=_[_0x8edc('0x5d')]({},_0x28e81f,_0x4463d3[_0x8edc('0x60')]);return _0x59c1b3[_0x8edc('0xca')](_0x28e81f);}})['then'](function(_0x55cd6c){if(_0x55cd6c){_0x260319=_0x55cd6c[_0x8edc('0x68')];if(!_0x4463d3[_0x8edc('0x50')][_0x8edc('0x56')](_0x8edc('0x75'))){_0x28e81f['limit']=qs[_0x8edc('0x57')](_0x4463d3[_0x8edc('0x50')]['limit']);_0x28e81f['offset']=qs[_0x8edc('0x21')](_0x4463d3['query'][_0x8edc('0x21')]);}return _0x59c1b3[_0x8edc('0xca')](_0x28e81f);}})[_0x8edc('0x27')](function(_0x44b639){if(_0x44b639){return _0x44b639?{'count':_0x260319,'rows':_0x44b639}:null;}})[_0x8edc('0x27')](respondWithResult(_0x103602,null))[_0x8edc('0x1e')](handleError(_0x103602,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b1b2b34..fd71675 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 _0x7c1a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x3cd901,_0x14d266){var _0x597f49=function(_0x2b3099){while(--_0x2b3099){_0x3cd901['push'](_0x3cd901['shift']());}};_0x597f49(++_0x14d266);}(_0x7c1a,0x159));var _0xa7c1=function(_0x4a1c63,_0x47ca29){_0x4a1c63=_0x4a1c63-0x0;var _0x46b72b=_0x7c1a[_0x4a1c63];return _0x46b72b;};'use strict';var EventEmitter=require(_0xa7c1('0x0'));var MailAccount=require(_0xa7c1('0x1'))['db'][_0xa7c1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa7c1('0x3')](0x0);var events={'afterCreate':_0xa7c1('0x4'),'afterUpdate':_0xa7c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd434f){return function(_0x132b08,_0x506858,_0x135ae7){MailAccountEvents['emit'](_0xd434f+':'+_0x132b08['id'],_0x132b08);MailAccountEvents[_0xa7c1('0x6')](_0xd434f,_0x132b08);_0x135ae7(null);};}for(var e in events){if(events[_0xa7c1('0x7')](e)){var event=events[e];MailAccount[_0xa7c1('0x8')](e,emitEvent(event));}}module[_0xa7c1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xa7c8=['hasOwnProperty','exports','events','MailAccount','setMaxListeners','save','remove','emit'];(function(_0x20763b,_0x4bf4f6){var _0x5066cd=function(_0x149e10){while(--_0x149e10){_0x20763b['push'](_0x20763b['shift']());}};_0x5066cd(++_0x4bf4f6);}(_0xa7c8,0x82));var _0x8a7c=function(_0x21e0af,_0x176e49){_0x21e0af=_0x21e0af-0x0;var _0x57d906=_0xa7c8[_0x21e0af];return _0x57d906;};'use strict';var EventEmitter=require(_0x8a7c('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8a7c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8a7c('0x2')](0x0);var events={'afterCreate':_0x8a7c('0x3'),'afterUpdate':'update','afterDestroy':_0x8a7c('0x4')};function emitEvent(_0x4d4eac){return function(_0xd11d72,_0x15003d,_0x3085c6){MailAccountEvents[_0x8a7c('0x5')](_0x4d4eac+':'+_0xd11d72['id'],_0xd11d72);MailAccountEvents['emit'](_0x4d4eac,_0xd11d72);_0x3085c6(null);};}for(var e in events){if(events[_0x8a7c('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x8a7c('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7762d35..594cc0a 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 _0xbc80=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5'];(function(_0x178dc0,_0x3773b5){var _0x5816b5=function(_0x5ac4f4){while(--_0x5ac4f4){_0x178dc0['push'](_0x178dc0['shift']());}};_0x5816b5(++_0x3773b5);}(_0xbc80,0xf0));var _0x0bc8=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xbc80[_0x5834bc];return _0x3e183a;};'use strict';var attributes=require(_0x0bc8('0x0'));module[_0x0bc8('0x1')]=function(_0x3225b6){return _0x3225b6[_0x0bc8('0x2')](_0x0bc8('0x3'),attributes,{'tableName':_0x0bc8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2f70d6=this;var _0x410044={'id':_0x2f70d6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2f70d6[_0x0bc8('0x5')]!==_0x0bc8('0x6')){_0x410044[_0x0bc8('0x7')]=_0x2f70d6[_0x0bc8('0x5')];}else{_0x410044['host']=_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0x9')];_0x410044['port']=_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xa')];_0x410044[_0x0bc8('0xb')]=_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xb')];}if(_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xc')]){if(_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xd')]){if(!_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xe')])throw new Error(_0x0bc8('0xf'));_0x410044[_0x0bc8('0x10')]={'type':_0x0bc8('0x11'),'user':_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0x12')],'accessToken':_0x2f70d6[_0x0bc8('0x8')][_0x0bc8('0xe')][_0x0bc8('0x13')]};}else{_0x410044[_0x0bc8('0x10')]={'user':_0x2f70d6['Smtp']['user'],'pass':_0x2f70d6['Smtp']['pass']};}}return _0x410044;}}});}; \ No newline at end of file +var _0x9af0=['user','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2'];(function(_0x4033ae,_0x727748){var _0xd8c3e2=function(_0x129974){while(--_0x129974){_0x4033ae['push'](_0x4033ae['shift']());}};_0xd8c3e2(++_0x727748);}(_0x9af0,0x133));var _0x09af=function(_0x54f3f3,_0x37e5c9){_0x54f3f3=_0x54f3f3-0x0;var _0x3e2039=_0x9af0[_0x54f3f3];return _0x3e2039;};'use strict';var attributes=require(_0x09af('0x0'));module[_0x09af('0x1')]=function(_0x2626c5){return _0x2626c5[_0x09af('0x2')](_0x09af('0x3'),attributes,{'tableName':_0x09af('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5d86aa=this;var _0x48b775={'id':_0x5d86aa['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5d86aa[_0x09af('0x5')]!==_0x09af('0x6')){_0x48b775[_0x09af('0x7')]=_0x5d86aa['provider'];}else{_0x48b775['host']=_0x5d86aa[_0x09af('0x8')][_0x09af('0x9')];_0x48b775[_0x09af('0xa')]=_0x5d86aa[_0x09af('0x8')]['port'];_0x48b775[_0x09af('0xb')]=_0x5d86aa['Smtp']['secure'];}if(_0x5d86aa[_0x09af('0x8')][_0x09af('0xc')]){if(_0x5d86aa[_0x09af('0x8')][_0x09af('0xd')]){if(!_0x5d86aa[_0x09af('0x8')][_0x09af('0xe')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x48b775['auth']={'type':_0x09af('0xf'),'user':_0x5d86aa[_0x09af('0x8')][_0x09af('0x10')],'accessToken':_0x5d86aa[_0x09af('0x8')][_0x09af('0xe')]['data5']};}else{_0x48b775[_0x09af('0x11')]={'user':_0x5d86aa[_0x09af('0x8')][_0x09af('0x10')],'pass':_0x5d86aa[_0x09af('0x8')][_0x09af('0x12')]};}}return _0x48b775;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a8e69e1..d7354de 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 _0xe2fe=['list','List','priority','asc','autoclose','push','length','close','Contacts','defaults','ListId','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','MailMessage','originCc','Attachments','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','catch','ShowMailAccount','raw','smtp','smtpOptions','getSmtpOptions','body','mail','keys','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Smtp','CloudProvider','get','omit','Applications','applications'];(function(_0x1d5daf,_0x40f7fd){var _0x5a6e01=function(_0x3bec91){while(--_0x3bec91){_0x1d5daf['push'](_0x1d5daf['shift']());}};_0x5a6e01(++_0x40f7fd);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xee2f('0x1'));var Redis=require('ioredis');var db=require(_0xee2f('0x2'))['db'];var logger=require(_0xee2f('0x3'))(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var jayson=require(_0xee2f('0x6'));var client=jayson['client'][_0xee2f('0x7')]({'port':0x232c});config[_0xee2f('0x8')]=_['defaults'](config[_0xee2f('0x8')],{'host':_0xee2f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee2f('0x8')]));require('./mailAccount.socket')[_0xee2f('0xa')](socket);function respondWithRpcPromise(_0x36920f,_0x53f7dd,_0x3a49bb){return new BPromise(function(_0x43f451,_0x4bf3c3){return client['request'](_0x36920f,_0x3a49bb)['then'](function(_0x56bbea){logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,'request\x20sent');logger['debug'](_0xee2f('0xc'),_0x53f7dd,_0xee2f('0xd'),JSON[_0xee2f('0xe')](_0x56bbea));if(_0x56bbea[_0xee2f('0xf')]){if(_0x56bbea[_0xee2f('0xf')][_0xee2f('0x10')]===0x1f4){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x56bbea['error'][_0xee2f('0x12')]);return _0x4bf3c3(_0x56bbea[_0xee2f('0xf')]['message']);}logger[_0xee2f('0xf')](_0xee2f('0x11'),_0x53f7dd,_0x56bbea[_0xee2f('0xf')][_0xee2f('0x12')]);return _0x43f451(_0x56bbea[_0xee2f('0xf')]['message']);}else{logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,_0xee2f('0xd'));_0x43f451(_0x56bbea[_0xee2f('0x13')]['message']);}})['catch'](function(_0x40b5bc){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x40b5bc);_0x4bf3c3(_0x40b5bc);});});}exports[_0xee2f('0x14')]=function(_0x28549d){var _0x5b83b5=this;return new Promise(function(_0x35e1a4,_0x1e70aa){return db[_0xee2f('0x15')][_0xee2f('0x16')]({'raw':_0x28549d[_0xee2f('0x17')]?_0x28549d['options']['raw']===undefined?!![]:![]:!![],'where':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x18')]||null:null,'attributes':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'limit':_0x28549d[_0xee2f('0x17')]?_0x28549d['options'][_0xee2f('0x1a')]||null:null,'include':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1d')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x19')],'include':_0x13013f[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x13013f[_0xee2f('0x1b')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes'],'include':_0x45c4a0['include']?_[_0xee2f('0x1c')](_0x45c4a0[_0xee2f('0x1b')],function(_0x2cb0cb){return{'model':db[_0x2cb0cb[_0xee2f('0x1d')]],'as':_0x2cb0cb['as'],'attributes':_0x2cb0cb[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x4d8398){logger[_0xee2f('0xb')]('GetMailAccount',_0x28549d);logger[_0xee2f('0x1f')](_0xee2f('0x14'),_0x28549d,JSON[_0xee2f('0xe')](_0x4d8398));_0x35e1a4(_0x4d8398);})[_0xee2f('0x20')](function(_0x3ddbe3){logger['error'](_0xee2f('0x14'),_0x3ddbe3[_0xee2f('0x12')],_0x28549d);_0x1e70aa(_0x5b83b5['error'](0x1f4,_0x3ddbe3['message']));});});};exports[_0xee2f('0x21')]=function(_0x574899){var _0x33c426=this;return new Promise(function(_0xc447e,_0x53d9b7){return db[_0xee2f('0x15')]['find']({'raw':_0x574899['options']?_0x574899['options'][_0xee2f('0x22')]===undefined?!![]:![]:!![],'where':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x18')]||null:null,'attributes':_0x574899[_0xee2f('0x17')]?_0x574899[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'include':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x1b')]?_['map'](_0x574899[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x19')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1c')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1d')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x19')],'include':_0x3e6dcc[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x3e6dcc[_0xee2f('0x1b')],function(_0x24380b){return{'model':db[_0x24380b[_0xee2f('0x1d')]],'as':_0x24380b['as'],'attributes':_0x24380b[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x433547){if(_0x574899['options'][_0xee2f('0x23')]===!![])_0x433547['setDataValue'](_0xee2f('0x24'),_0x433547[_0xee2f('0x25')]());logger[_0xee2f('0xb')](_0xee2f('0x21'),_0x574899);logger[_0xee2f('0x1f')](_0xee2f('0x21'),_0x574899,JSON[_0xee2f('0xe')](_0x433547));_0xc447e(_0x433547);})[_0xee2f('0x20')](function(_0x50ddd2){logger['error']('ShowMailAccount',_0x50ddd2[_0xee2f('0x12')],_0x574899);_0x53d9b7(_0x33c426['error'](0x1f4,_0x50ddd2[_0xee2f('0x12')]));});});};exports['NotifyMailAccount']=function(_0x558aa3){var _0x5027a6=this;return new Promise(function(_0x58e361,_0x430ac1){var _0x692686={'body':_0x558aa3[_0xee2f('0x26')],'channel':_0xee2f('0x27')};var _0x4823a7=_['difference'](_[_0xee2f('0x28')](db['CmContact']['rawAttributes']),[_0xee2f('0x29'),_0xee2f('0x2a'),_0xee2f('0x2b'),'ListId']);var _0x3bc173=![];if(_0x558aa3[_0xee2f('0x26')]['id']){delete _0x558aa3[_0xee2f('0x26')]['id'];}if(_['isNil'](_0x558aa3['body'][_0xee2f('0x2c')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2d')));}if(_[_0xee2f('0x2e')](_0x558aa3['body'][_0xee2f('0x26')])||_0x558aa3[_0xee2f('0x26')][_0xee2f('0x26')]===''){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2f')));}if(_[_0xee2f('0x2e')](_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x31')+_0x4823a7));}if(!_['includes'](_0x4823a7,_0x558aa3['body']['mapKey'])){return _0x430ac1(_0x5027a6['error'](0x1f4,_0xee2f('0x32')+_0x4823a7));}var _0x3e0d7b={};_0x3e0d7b[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3[_0xee2f('0x26')]['from'];return db[_0xee2f('0x15')][_0xee2f('0x33')]({'where':{'id':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db[_0xee2f('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e0d7b,'limit':0x1,'order':[[_0xee2f('0x2a'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xee2f('0x36'),'include':[{'model':db[_0xee2f('0x37')],'as':_0xee2f('0x37')}]}]})['then'](function(_0x22506e){if(_0x22506e&&_0x22506e['List']){var _0x3d95b8=_0x22506e[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x34')]=_[_0xee2f('0x39')](_0x3d95b8,[_0xee2f('0x3a'),'List']);_0x692686['account'][_0xee2f('0x24')]=_0x22506e['getSmtpOptions']();_0x692686[_0xee2f('0x3b')]=_0x3d95b8[_0xee2f('0x3a')];_0x692686[_0xee2f('0x3c')]=_0x3d95b8[_0xee2f('0x3d')];_0x692686['applications']=_['orderBy'](_0x692686[_0xee2f('0x3b')],[_0xee2f('0x3e')],[_0xee2f('0x3f')]);if(_0x692686[_0xee2f('0x34')]&&_0x692686[_0xee2f('0x34')][_0xee2f('0x40')]){_0x692686[_0xee2f('0x3b')][_0xee2f('0x41')]({'id':0x0,'priority':_0x692686[_0xee2f('0x3b')][_0xee2f('0x42')]+0x1,'app':_0xee2f('0x43'),'appdata':_0xee2f('0x40'),'interval':'*,*,*,*'});}if(_0x692686[_0xee2f('0x34')][_0xee2f('0x3a')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3a')];}if(_0x692686['account'][_0xee2f('0x3d')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3d')];}if(_0x3d95b8[_0xee2f('0x3d')][_0xee2f('0x44')]['length']){return _0x3d95b8[_0xee2f('0x3d')]['Contacts'][0x0];}var _0x4db455=_[_0xee2f('0x45')](_0x558aa3[_0xee2f('0x26')],{'firstName':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x2c')],'ListId':_0x3d95b8[_0xee2f('0x46')]});_0x4db455[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3['body'][_0xee2f('0x2c')];return db[_0xee2f('0x47')][_0xee2f('0x48')](_0x4db455);}else{throw new Error(_0xee2f('0x49'));}})[_0xee2f('0x1e')](function(_0x3e1184){_0x692686[_0xee2f('0x4a')]=_0x3e1184;if(_0x3e1184){if(!_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['messageId']){_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4b')]=rs[_0xee2f('0x4c')]()+'\x20'+_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')];}var _0x5ee444={'ContactId':_0x3e1184['id'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3['body']['message']['from'],'cc':_0x558aa3['body']['message']['cc'],'subject':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4d')],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'lastMsgAt':moment()[_0xee2f('0x4f')](_0xee2f('0x50')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0xee2f('0x51'),'attributes':['messageId'],'where':{'messageId':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x52')]}}]})[_0xee2f('0x1e')](function(_0x2f419c){if(_0x2f419c){return[_0x2f419c,![]];}return db['MailInteraction'][_0xee2f('0x48')](_0x5ee444)[_0xee2f('0x1e')](function(_0x3bdfc5){return[_0x3bdfc5,!![]];});});}else{throw new Error(_0xee2f('0x53'));}})[_0xee2f('0x54')](function(_0x486146,_0xf0c721){if(_0x486146){_0x3bc173=_0xf0c721;if(!_0xf0c721){return _0x486146['update']({'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4d')],'attach':_0x486146['attach']?_0x486146[_0xee2f('0x4e')]:_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0xee2f('0x50')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x486146;}}})[_0xee2f('0x1e')](function(_0x46ecac){_0x692686[_0xee2f('0x55')]=_0x46ecac[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x55')]['created']=_0x3bc173;return db[_0xee2f('0x56')][_0xee2f('0x48')]({'body':_0x558aa3[_0xee2f('0x26')]['body'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'MailInteractionId':_0x46ecac['id'],'direction':'in','ContactId':_0x692686[_0xee2f('0x4a')]['id'],'messageId':_0x558aa3['body'][_0xee2f('0x12')][_0xee2f('0x4b')],'from':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['to'],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3['body']['message']['subject'],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'Attachments':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['attachments'],'originTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originTo'],'originCc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x57')],'bcc':_0x558aa3['body'][_0xee2f('0x12')]['bcc'],'ChatWebsiteId':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['ChatWebsiteId']||null,'originChannel':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originChannel']||'Email','ChatOfflineMessageId':_0x558aa3['body'][_0xee2f('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xee2f('0x58')}]});})[_0xee2f('0x1e')](function(_0x50a972){_0x692686[_0xee2f('0x12')]=_0x50a972;if(_0x692686['interaction'][_0xee2f('0x59')]){return db[_0xee2f('0x5a')][_0xee2f('0x33')]({'attributes':['id',_0xee2f('0x5b')],'where':{'id':_0x692686[_0xee2f('0x55')][_0xee2f('0x59')]}})[_0xee2f('0x1e')](function(_0x58da0d){if(_0x58da0d){_0x692686[_0xee2f('0x3b')][_0xee2f('0x5c')]({'id':0x0,'priority':0x0,'app':_0xee2f('0x5d'),'appdata':_0x58da0d[_0xee2f('0x5b')]+','+(_0x692686[_0xee2f('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0xee2f('0x5e')});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);})[_0xee2f('0x1e')](function(_0x4c3b2f){_0x58e361(_0x4c3b2f);})['catch'](function(_0x4051a7){_0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0x4051a7[_0xee2f('0x12')]));});});}; \ No newline at end of file +var _0x4975=['MailMessage','Messages','create','Contact\x20not\x20found','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','User','UserId','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','list','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x4975,0x86));var _0x5497=function(_0x2905d2,_0x51abd0){_0x2905d2=_0x2905d2-0x0;var _0x53547b=_0x4975[_0x2905d2];return _0x53547b;};'use strict';var _=require(_0x5497('0x0'));var moment=require('moment');var BPromise=require(_0x5497('0x1'));var rs=require(_0x5497('0x2'));var Redis=require(_0x5497('0x3'));var db=require(_0x5497('0x4'))['db'];var logger=require(_0x5497('0x5'))(_0x5497('0x6'));var config=require(_0x5497('0x7'));var jayson=require(_0x5497('0x8'));var client=jayson[_0x5497('0x9')][_0x5497('0xa')]({'port':0x232c});config['redis']=_[_0x5497('0xb')](config['redis'],{'host':_0x5497('0xc'),'port':0x18eb});var socket=require(_0x5497('0xd'))(new Redis(config[_0x5497('0xe')]));require('./mailAccount.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x49d94b,_0x1f63d8,_0x29c93f){return new BPromise(function(_0x2ec5a4,_0x32a8a2){return client[_0x5497('0x10')](_0x49d94b,_0x29c93f)[_0x5497('0x11')](function(_0x3e7886){logger[_0x5497('0x12')]('MailAccount,\x20%s,\x20%s',_0x1f63d8,'request\x20sent');logger['debug'](_0x5497('0x13'),_0x1f63d8,_0x5497('0x14'),JSON[_0x5497('0x15')](_0x3e7886));if(_0x3e7886[_0x5497('0x16')]){if(_0x3e7886[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x32a8a2(_0x3e7886['error'][_0x5497('0x19')]);}logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x2ec5a4(_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);}else{logger[_0x5497('0x12')](_0x5497('0x18'),_0x1f63d8,'request\x20sent');_0x2ec5a4(_0x3e7886['result'][_0x5497('0x19')]);}})[_0x5497('0x1a')](function(_0x3a47fd){logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3a47fd);_0x32a8a2(_0x3a47fd);});});}exports[_0x5497('0x1b')]=function(_0x18e8a8){var _0x43da2c=this;return new Promise(function(_0x1b1b43,_0x1f6f18){return db[_0x5497('0x1c')][_0x5497('0x1d')]({'raw':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x18e8a8['options']?_0x18e8a8[_0x5497('0x1e')]['where']||null:null,'attributes':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'limit':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x21')]||null:null,'include':_0x18e8a8['options']?_0x18e8a8['options'][_0x5497('0x22')]?_[_0x5497('0x23')](_0x18e8a8[_0x5497('0x1e')][_0x5497('0x22')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x24')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x22')]?_[_0x5497('0x23')](_0x5223b5[_0x5497('0x22')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x24')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x20')],'include':_0x34a1a5['include']?_[_0x5497('0x23')](_0x34a1a5['include'],function(_0x583d06){return{'model':db[_0x583d06['model']],'as':_0x583d06['as'],'attributes':_0x583d06[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9356){logger[_0x5497('0x12')](_0x5497('0x1b'),_0x18e8a8);logger[_0x5497('0x25')]('GetMailAccount',_0x18e8a8,JSON['stringify'](_0x5e9356));_0x1b1b43(_0x5e9356);})['catch'](function(_0x371874){logger[_0x5497('0x16')](_0x5497('0x1b'),_0x371874['message'],_0x18e8a8);_0x1f6f18(_0x43da2c['error'](0x1f4,_0x371874['message']));});});};exports[_0x5497('0x26')]=function(_0x572460){var _0x438ee4=this;return new Promise(function(_0x258c2d,_0x77c575){return db['MailAccount'][_0x5497('0x27')]({'raw':_0x572460[_0x5497('0x1e')]?_0x572460['options'][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['where']||null:null,'attributes':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'include':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['include']?_[_0x5497('0x23')](_0x572460[_0x5497('0x1e')]['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x24')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x20')],'include':_0x1ffc9b[_0x5497('0x22')]?_[_0x5497('0x23')](_0x1ffc9b[_0x5497('0x22')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x24')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes'],'include':_0x580e86[_0x5497('0x22')]?_[_0x5497('0x23')](_0x580e86[_0x5497('0x22')],function(_0x5ab18c){return{'model':db[_0x5ab18c['model']],'as':_0x5ab18c['as'],'attributes':_0x5ab18c[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5497('0x11')](function(_0x326d48){if(_0x572460[_0x5497('0x1e')][_0x5497('0x28')]===!![])_0x326d48[_0x5497('0x29')]('smtpOptions',_0x326d48[_0x5497('0x2a')]());logger[_0x5497('0x12')](_0x5497('0x26'),_0x572460);logger[_0x5497('0x25')](_0x5497('0x26'),_0x572460,JSON[_0x5497('0x15')](_0x326d48));_0x258c2d(_0x326d48);})[_0x5497('0x1a')](function(_0x179635){logger[_0x5497('0x16')]('ShowMailAccount',_0x179635[_0x5497('0x19')],_0x572460);_0x77c575(_0x438ee4[_0x5497('0x16')](0x1f4,_0x179635[_0x5497('0x19')]));});});};exports[_0x5497('0x2b')]=function(_0x15029d){var _0xa5ebe6=this;return new Promise(function(_0x4299be,_0x59ed13){var _0x3e5f7d={'body':_0x15029d[_0x5497('0x2c')],'channel':_0x5497('0x2d')};var _0x35993c=_[_0x5497('0x2e')](_[_0x5497('0x2f')](db[_0x5497('0x30')]['rawAttributes']),[_0x5497('0x31'),_0x5497('0x32'),_0x5497('0x33'),_0x5497('0x34')]);var _0x20e947=![];if(_0x15029d[_0x5497('0x2c')]['id']){delete _0x15029d[_0x5497('0x2c')]['id'];}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')][_0x5497('0x36')])){return _0x59ed13(_0xa5ebe6['error'](0x1f4,_0x5497('0x37')));}if(_['isNil'](_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')])||_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')]===''){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')]['mapKey'])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35993c));}if(!_[_0x5497('0x38')](_0x35993c,_0x15029d['body'][_0x5497('0x39')])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,_0x5497('0x3a')+_0x35993c));}var _0x3a852a={};_0x3a852a[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body']['from'];return db['MailAccount'][_0x5497('0x27')]({'where':{'id':_0x15029d[_0x5497('0x3b')]['id']},'include':[{'model':db[_0x5497('0x3c')],'as':_0x5497('0x3d'),'include':[{'model':db[_0x5497('0x30')],'as':_0x5497('0x3e'),'where':_0x3a852a,'limit':0x1,'order':[[_0x5497('0x32'),_0x5497('0x3f')]]}]},{'model':db[_0x5497('0x40')],'as':'Applications'},{'model':db[_0x5497('0x41')],'as':_0x5497('0x42'),'include':[{'model':db[_0x5497('0x43')],'as':'CloudProvider'}]}]})[_0x5497('0x11')](function(_0x530475){if(_0x530475&&_0x530475[_0x5497('0x3d')]){var _0x31f1ba=_0x530475[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d['account']=_[_0x5497('0x45')](_0x31f1ba,[_0x5497('0x46'),'List']);_0x3e5f7d[_0x5497('0x3b')]['smtpOptions']=_0x530475[_0x5497('0x2a')]();_0x3e5f7d['applications']=_0x31f1ba[_0x5497('0x46')];_0x3e5f7d[_0x5497('0x47')]=_0x31f1ba[_0x5497('0x3d')];_0x3e5f7d[_0x5497('0x48')]=_[_0x5497('0x49')](_0x3e5f7d[_0x5497('0x48')],[_0x5497('0x4a')],[_0x5497('0x4b')]);if(_0x3e5f7d['account']&&_0x3e5f7d[_0x5497('0x3b')]['autoclose']){_0x3e5f7d['applications'][_0x5497('0x4c')]({'id':0x0,'priority':_0x3e5f7d[_0x5497('0x48')]['length']+0x1,'app':_0x5497('0x4d'),'appdata':_0x5497('0x4e'),'interval':_0x5497('0x4f')});}if(_0x3e5f7d[_0x5497('0x3b')]['Applications']){delete _0x3e5f7d[_0x5497('0x3b')]['Applications'];}if(_0x3e5f7d['account'][_0x5497('0x3d')]){delete _0x3e5f7d[_0x5497('0x3b')][_0x5497('0x3d')];}if(_0x31f1ba['List']['Contacts'][_0x5497('0x50')]){return _0x31f1ba['List'][_0x5497('0x3e')][0x0];}var _0x530431=_[_0x5497('0xb')](_0x15029d['body'],{'firstName':_0x15029d[_0x5497('0x2c')][_0x5497('0x36')],'ListId':_0x31f1ba['ListId']});_0x530431[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body'][_0x5497('0x36')];return db[_0x5497('0x30')]['create'](_0x530431);}else{throw new Error(_0x5497('0x51'));}})[_0x5497('0x11')](function(_0x1dbab2){_0x3e5f7d[_0x5497('0x52')]=_0x1dbab2;if(_0x1dbab2){if(!_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId']){_0x15029d[_0x5497('0x2c')]['message']['messageId']=rs['generate']()+'\x20'+_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')];}var _0x544085={'ContactId':_0x1dbab2['id'],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'inReplyTo':_0x15029d['body']['message'][_0x5497('0x53')],'to':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['attach'],'lastMsgAt':moment()[_0x5497('0x55')](_0x5497('0x56')),'lastMsgDirection':'in'};return db[_0x5497('0x57')][_0x5497('0x27')]({'where':{'closed':![],'MailAccountId':_0x15029d['account']['id']},'include':[{'model':db[_0x5497('0x58')],'as':_0x5497('0x59'),'attributes':[_0x5497('0x53')],'where':{'messageId':_0x15029d['body'][_0x5497('0x19')]['inReplyTo']}}]})['then'](function(_0x53e050){if(_0x53e050){return[_0x53e050,![]];}return db[_0x5497('0x57')][_0x5497('0x5a')](_0x544085)[_0x5497('0x11')](function(_0x4e7d4c){return[_0x4e7d4c,!![]];});});}else{throw new Error(_0x5497('0x5b'));}})[_0x5497('0x5c')](function(_0x3cfebc,_0x35e75a){if(_0x3cfebc){_0x20e947=_0x35e75a;if(!_0x35e75a){return _0x3cfebc['update']({'inReplyTo':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x53')],'to':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x3cfebc['attach']?_0x3cfebc[_0x5497('0x5d')]:_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x5497('0x56')),'lastMsgDirection':'in'});}else{return _0x3cfebc;}}})[_0x5497('0x11')](function(_0x179bbc){_0x3e5f7d['interaction']=_0x179bbc[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x5f')]=_0x20e947;return db[_0x5497('0x58')][_0x5497('0x5a')]({'body':_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'MailInteractionId':_0x179bbc['id'],'direction':'in','ContactId':_0x3e5f7d[_0x5497('0x52')]['id'],'messageId':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId'],'from':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'to':_0x15029d['body'][_0x5497('0x19')]['to'],'cc':_0x15029d['body'][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'Attachments':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x60')],'originTo':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x61')],'originCc':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x62')],'bcc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['bcc'],'ChatWebsiteId':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x63')]||null,'originChannel':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x64')]||_0x5497('0x65'),'ChatOfflineMessageId':_0x15029d[_0x5497('0x2c')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5497('0x66')],'as':_0x5497('0x67')}]});})['then'](function(_0x15ca59){_0x3e5f7d[_0x5497('0x19')]=_0x15ca59;if(_0x3e5f7d[_0x5497('0x5e')]['UserId']){return db[_0x5497('0x68')][_0x5497('0x27')]({'attributes':['id','name'],'where':{'id':_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x69')]}})[_0x5497('0x11')](function(_0x42d745){if(_0x42d745){_0x3e5f7d[_0x5497('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5497('0x6a'),'appdata':_0x42d745[_0x5497('0x6b')]+','+(_0x3e5f7d[_0x5497('0x3b')][_0x5497('0x6c')]||0xa),'interval':_0x5497('0x4f')});}return respondWithRpcPromise('Start',_0x5497('0x6d'),_0x3e5f7d);});}return respondWithRpcPromise(_0x5497('0x6e'),_0x5497('0x6d'),_0x3e5f7d);})[_0x5497('0x11')](function(_0x521d74){_0x4299be(_0x521d74);})[_0x5497('0x1a')](function(_0x21fc4e){_0x59ed13(_0xa5ebe6['error'](0x1f4,_0x21fc4e[_0x5497('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e3707eb..4ed7d62 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 _0x4e19=['length','mailAccount:','./mailAccount.events','remove','update','emit','removeListener','register'];(function(_0x4adaac,_0x3f1eff){var _0x40c0ae=function(_0x114cfb){while(--_0x114cfb){_0x4adaac['push'](_0x4adaac['shift']());}};_0x40c0ae(++_0x3f1eff);}(_0x4e19,0xc2));var _0x94e1=function(_0x56eb89,_0xa70f63){_0x56eb89=_0x56eb89-0x0;var _0x237f9d=_0x4e19[_0x56eb89];return _0x237f9d;};'use strict';var MailAccountEvents=require(_0x94e1('0x0'));var events=['save',_0x94e1('0x1'),_0x94e1('0x2')];function createListener(_0x4542f1,_0x26861a){return function(_0x53e1da){_0x26861a[_0x94e1('0x3')](_0x4542f1,_0x53e1da);};}function removeListener(_0x40a03f,_0x191d74){return function(){MailAccountEvents[_0x94e1('0x4')](_0x40a03f,_0x191d74);};}exports[_0x94e1('0x5')]=function(_0x384f8f){for(var _0x373f11=0x0,_0x4a090f=events[_0x94e1('0x6')];_0x373f11<_0x4a090f;_0x373f11++){var _0x14458d=events[_0x373f11];var _0x3bf47e=createListener(_0x94e1('0x7')+_0x14458d,_0x384f8f);MailAccountEvents['on'](_0x14458d,_0x3bf47e);}}; \ No newline at end of file +var _0xaa5e=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x4144ed,_0x397f07){var _0x560614=function(_0x5e4e6c){while(--_0x5e4e6c){_0x4144ed['push'](_0x4144ed['shift']());}};_0x560614(++_0x397f07);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x36fe86,_0x15bb36){_0x36fe86=_0x36fe86-0x0;var _0xb0b27c=_0xaa5e[_0x36fe86];return _0xb0b27c;};'use strict';var MailAccountEvents=require(_0xeaa5('0x0'));var events=[_0xeaa5('0x1'),'remove',_0xeaa5('0x2')];function createListener(_0x4f3a40,_0x15fc59){return function(_0x168bae){_0x15fc59[_0xeaa5('0x3')](_0x4f3a40,_0x168bae);};}function removeListener(_0x5a1aca,_0x2c111f){return function(){MailAccountEvents[_0xeaa5('0x4')](_0x5a1aca,_0x2c111f);};}exports[_0xeaa5('0x5')]=function(_0x382868){for(var _0x553f20=0x0,_0x4d405e=events[_0xeaa5('0x6')];_0x553f20<_0x4d405e;_0x553f20++){var _0x2c9696=events[_0x553f20];var _0x50cb62=createListener(_0xeaa5('0x7')+_0x2c9696,_0x382868);MailAccountEvents['on'](_0x2c9696,_0x50cb62);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 86a8d9d..db6cbca 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 _0x638b=['isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put'];(function(_0x5cb993,_0x12c6fe){var _0x2422fd=function(_0x894e2e){while(--_0x894e2e){_0x5cb993['push'](_0x5cb993['shift']());}};_0x2422fd(++_0x12c6fe);}(_0x638b,0xb8));var _0xb638=function(_0x1f984e,_0x5dcc32){_0x1f984e=_0x1f984e-0x0;var _0x55738f=_0x638b[_0x1f984e];return _0x55738f;};'use strict';var multer=require(_0xb638('0x0'));var util=require('util');var path=require(_0xb638('0x1'));var timeout=require(_0xb638('0x2'));var express=require('express');var router=express[_0xb638('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb638('0x4'));var config=require(_0xb638('0x5'));var controller=require(_0xb638('0x6'));router[_0xb638('0x7')](_0xb638('0x8'),auth['isAuthenticated'](),controller[_0xb638('0x9')]);router[_0xb638('0xa')](_0xb638('0x8'),auth[_0xb638('0xb')](),controller['update']);router[_0xb638('0xc')](_0xb638('0x8'),auth[_0xb638('0xb')](),controller[_0xb638('0xd')]);module[_0xb638('0xe')]=router; \ No newline at end of file +var _0x1e95=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path'];(function(_0x3719ad,_0x2b09fe){var _0x3dcb77=function(_0x21800d){while(--_0x21800d){_0x3719ad['push'](_0x3719ad['shift']());}};_0x3dcb77(++_0x2b09fe);}(_0x1e95,0x10d));var _0x51e9=function(_0x405b9e,_0xfe69e3){_0x405b9e=_0x405b9e-0x0;var _0x5edcf5=_0x1e95[_0x405b9e];return _0x5edcf5;};'use strict';var multer=require(_0x51e9('0x0'));var util=require(_0x51e9('0x1'));var path=require(_0x51e9('0x2'));var timeout=require(_0x51e9('0x3'));var express=require('express');var router=express[_0x51e9('0x4')]();var fs_extra=require(_0x51e9('0x5'));var auth=require(_0x51e9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51e9('0x7'));var controller=require(_0x51e9('0x8'));router[_0x51e9('0x9')](_0x51e9('0xa'),auth[_0x51e9('0xb')](),controller[_0x51e9('0xc')]);router[_0x51e9('0xd')](_0x51e9('0xa'),auth[_0x51e9('0xb')](),controller['update']);router[_0x51e9('0xe')](_0x51e9('0xa'),auth[_0x51e9('0xb')](),controller[_0x51e9('0xf')]);module[_0x51e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7232d35..1d8898c 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 _0x5de3=['sequelize','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x483e4a,_0x32aa45){var _0x31fba5=function(_0x345bc9){while(--_0x345bc9){_0x483e4a['push'](_0x483e4a['shift']());}};_0x31fba5(++_0x32aa45);}(_0x5de3,0xdc));var _0x35de=function(_0x1fda3c,_0xefd4cb){_0x1fda3c=_0x1fda3c-0x0;var _0x1a2d1e=_0x5de3[_0x1fda3c];return _0x1a2d1e;};'use strict';var Sequelize=require(_0x35de('0x0'));module['exports']={'priority':{'type':Sequelize[_0x35de('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x35de('0x2')]()},'description':{'type':Sequelize[_0x35de('0x3')]},'interval':{'type':Sequelize[_0x35de('0x3')],'defaultValue':_0x35de('0x4')}}; \ No newline at end of file +var _0xdc49=['STRING','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xdc49,0xb2));var _0x9dc4=function(_0xacf875,_0x4eda3a){_0xacf875=_0xacf875-0x0;var _0x36edd5=_0xdc49[_0xacf875];return _0x36edd5;};'use strict';var Sequelize=require('sequelize');module[_0x9dc4('0x0')]={'priority':{'type':Sequelize[_0x9dc4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9dc4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9dc4('0x3')]()},'description':{'type':Sequelize[_0x9dc4('0x2')]},'interval':{'type':Sequelize[_0x9dc4('0x2')],'defaultValue':_0x9dc4('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 15a0e2f..8fc82bf 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x2babd8,_0xdca21a){var _0x48962a=function(_0x49a016){while(--_0x49a016){_0x2babd8['push'](_0x2babd8['shift']());}};_0x48962a(++_0xdca21a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x40c5f8,_0x19e9bb){_0x40c5f8=_0x40c5f8-0x0;var _0x3c7d74=_0xf4eb[_0x40c5f8];return _0x3c7d74;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2ea2ae,_0x310ec9){var _0x4ee455=function(_0x3b586e){while(--_0x3b586e){_0x2ea2ae['push'](_0x2ea2ae['shift']());}};_0x4ee455(++_0x310ec9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ac31504..2fd2ae7 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 _0xa597=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa597,0x143));var _0x7a59=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0xa597[_0x18d8e9];return _0x1b9102;};'use strict';var _=require(_0x7a59('0x0'));var util=require('util');var logger=require(_0x7a59('0x1'))(_0x7a59('0x2'));var moment=require(_0x7a59('0x3'));var BPromise=require(_0x7a59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a59('0x5'));var config=require(_0x7a59('0x6'));var attributes=require(_0x7a59('0x7'));module[_0x7a59('0x8')]=function(_0x3add70,_0x5a6e93){return _0x3add70[_0x7a59('0x9')](_0x7a59('0xa'),attributes,{'tableName':_0x7a59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a59('0xc'),'collate':_0x7a59('0xd')});}; \ No newline at end of file +var _0xceb2=['api','moment','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5e8951,_0x24a362){var _0x3d67ce=function(_0x290daf){while(--_0x290daf){_0x5e8951['push'](_0x5e8951['shift']());}};_0x3d67ce(++_0x24a362);}(_0xceb2,0x131));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ceb('0x0'));var util=require(_0x2ceb('0x1'));var logger=require(_0x2ceb('0x2'))(_0x2ceb('0x3'));var moment=require(_0x2ceb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ceb('0x5'));var rimraf=require(_0x2ceb('0x6'));var config=require(_0x2ceb('0x7'));var attributes=require(_0x2ceb('0x8'));module[_0x2ceb('0x9')]=function(_0x148149,_0x154f53){return _0x148149['define'](_0x2ceb('0xa'),attributes,{'tableName':_0x2ceb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ceb('0xc'),'collate':_0x2ceb('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 16cd34c..43e2364 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 _0xb9a0=['then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailApplication','update','body','options','raw','attributes','limit','UpdateMailApplication','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1e5ccf,_0x5392ac){var _0x5a7571=function(_0x321dc4){while(--_0x321dc4){_0x1e5ccf['push'](_0x1e5ccf['shift']());}};_0x5a7571(++_0x5392ac);}(_0xb9a0,0x186));var _0x0b9a=function(_0x56ed09,_0x47abc8){_0x56ed09=_0x56ed09-0x0;var _0x1d5fae=_0xb9a0[_0x56ed09];return _0x1d5fae;};'use strict';var _=require(_0x0b9a('0x0'));var util=require(_0x0b9a('0x1'));var moment=require(_0x0b9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b9a('0x3'));var fs=require('fs');var Redis=require(_0x0b9a('0x4'));var db=require(_0x0b9a('0x5'))['db'];var utils=require(_0x0b9a('0x6'));var logger=require(_0x0b9a('0x7'))(_0x0b9a('0x8'));var config=require(_0x0b9a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0b9a('0xa')][_0x0b9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x131a2c,_0x457e80,_0xe430f6){return new BPromise(function(_0x33ce5a,_0x1cec71){return client[_0x0b9a('0xc')](_0x131a2c,_0xe430f6)[_0x0b9a('0xd')](function(_0x2f78b8){logger[_0x0b9a('0xe')](_0x0b9a('0xf'),_0x457e80,_0x0b9a('0x10'));logger['debug'](_0x0b9a('0x11'),_0x457e80,'request\x20sent',JSON[_0x0b9a('0x12')](_0x2f78b8));if(_0x2f78b8['error']){if(_0x2f78b8[_0x0b9a('0x13')]['code']===0x1f4){logger['error'](_0x0b9a('0xf'),_0x457e80,_0x2f78b8[_0x0b9a('0x13')][_0x0b9a('0x14')]);return _0x1cec71(_0x2f78b8[_0x0b9a('0x13')]['message']);}logger[_0x0b9a('0x13')](_0x0b9a('0xf'),_0x457e80,_0x2f78b8[_0x0b9a('0x13')][_0x0b9a('0x14')]);return _0x33ce5a(_0x2f78b8[_0x0b9a('0x13')][_0x0b9a('0x14')]);}else{logger[_0x0b9a('0xe')](_0x0b9a('0xf'),_0x457e80,_0x0b9a('0x10'));_0x33ce5a(_0x2f78b8[_0x0b9a('0x15')][_0x0b9a('0x14')]);}})['catch'](function(_0x102d2e){logger[_0x0b9a('0x13')](_0x0b9a('0xf'),_0x457e80,_0x102d2e);_0x1cec71(_0x102d2e);});});}exports['UpdateMailApplication']=function(_0x3fb823){var _0x5f0fd9=this;return new Promise(function(_0x47b9e1,_0x1df5d9){return db[_0x0b9a('0x16')][_0x0b9a('0x17')](_0x3fb823[_0x0b9a('0x18')],{'raw':_0x3fb823[_0x0b9a('0x19')]?_0x3fb823[_0x0b9a('0x19')][_0x0b9a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb823[_0x0b9a('0x19')]?_0x3fb823['options']['where']||null:null,'attributes':_0x3fb823[_0x0b9a('0x19')]?_0x3fb823['options'][_0x0b9a('0x1b')]||null:null,'limit':_0x3fb823[_0x0b9a('0x19')]?_0x3fb823[_0x0b9a('0x19')][_0x0b9a('0x1c')]||null:null})[_0x0b9a('0xd')](function(_0xdb6a0b){logger[_0x0b9a('0xe')](_0x0b9a('0x1d'),_0x3fb823);logger['debug'](_0x0b9a('0x1d'),_0x3fb823,JSON[_0x0b9a('0x12')](_0xdb6a0b));_0x47b9e1(_0xdb6a0b);})[_0x0b9a('0x1e')](function(_0x1f29ac){logger[_0x0b9a('0x13')](_0x0b9a('0x1d'),_0x1f29ac[_0x0b9a('0x14')],_0x3fb823);_0x1df5d9(_0x5f0fd9[_0x0b9a('0x13')](0x1f4,_0x1f29ac['message']));});});}; \ No newline at end of file +var _0x0efe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','stringify','lodash','util','moment','ioredis'];(function(_0x18efc2,_0x35d1cb){var _0x2a92a7=function(_0x11b2ec){while(--_0x11b2ec){_0x18efc2['push'](_0x18efc2['shift']());}};_0x2a92a7(++_0x35d1cb);}(_0x0efe,0xfc));var _0xe0ef=function(_0x426cc1,_0x3e902c){_0x426cc1=_0x426cc1-0x0;var _0x467eec=_0x0efe[_0x426cc1];return _0x467eec;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var moment=require(_0xe0ef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0ef('0x4'));var logger=require(_0xe0ef('0x5'))(_0xe0ef('0x6'));var config=require(_0xe0ef('0x7'));var jayson=require(_0xe0ef('0x8'));var client=jayson[_0xe0ef('0x9')][_0xe0ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50a38e,_0xdf67ff,_0x420034){return new BPromise(function(_0x4578c3,_0x4669f2){return client[_0xe0ef('0xb')](_0x50a38e,_0x420034)[_0xe0ef('0xc')](function(_0x145b9f){logger[_0xe0ef('0xd')](_0xe0ef('0xe'),_0xdf67ff,_0xe0ef('0xf'));logger[_0xe0ef('0x10')](_0xe0ef('0x11'),_0xdf67ff,_0xe0ef('0xf'),JSON['stringify'](_0x145b9f));if(_0x145b9f[_0xe0ef('0x12')]){if(_0x145b9f[_0xe0ef('0x12')][_0xe0ef('0x13')]===0x1f4){logger[_0xe0ef('0x12')]('MailApplication,\x20%s,\x20%s',_0xdf67ff,_0x145b9f[_0xe0ef('0x12')]['message']);return _0x4669f2(_0x145b9f['error'][_0xe0ef('0x14')]);}logger[_0xe0ef('0x12')]('MailApplication,\x20%s,\x20%s',_0xdf67ff,_0x145b9f[_0xe0ef('0x12')]['message']);return _0x4578c3(_0x145b9f['error'][_0xe0ef('0x14')]);}else{logger[_0xe0ef('0xd')](_0xe0ef('0xe'),_0xdf67ff,_0xe0ef('0xf'));_0x4578c3(_0x145b9f[_0xe0ef('0x15')][_0xe0ef('0x14')]);}})['catch'](function(_0x3a213f){logger['error'](_0xe0ef('0xe'),_0xdf67ff,_0x3a213f);_0x4669f2(_0x3a213f);});});}exports['UpdateMailApplication']=function(_0x4a86db){var _0x4a70d7=this;return new Promise(function(_0x50d3f8,_0x396cde){return db[_0xe0ef('0x16')][_0xe0ef('0x17')](_0x4a86db[_0xe0ef('0x18')],{'raw':_0x4a86db[_0xe0ef('0x19')]?_0x4a86db[_0xe0ef('0x19')][_0xe0ef('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a86db[_0xe0ef('0x19')]?_0x4a86db[_0xe0ef('0x19')][_0xe0ef('0x1b')]||null:null,'attributes':_0x4a86db[_0xe0ef('0x19')]?_0x4a86db['options'][_0xe0ef('0x1c')]||null:null,'limit':_0x4a86db['options']?_0x4a86db[_0xe0ef('0x19')][_0xe0ef('0x1d')]||null:null})[_0xe0ef('0xc')](function(_0x3646b1){logger[_0xe0ef('0xd')](_0xe0ef('0x1e'),_0x4a86db);logger['debug'](_0xe0ef('0x1e'),_0x4a86db,JSON[_0xe0ef('0x1f')](_0x3646b1));_0x50d3f8(_0x3646b1);})['catch'](function(_0x1ea544){logger[_0xe0ef('0x12')](_0xe0ef('0x1e'),_0x1ea544['message'],_0x4a86db);_0x396cde(_0x4a70d7[_0xe0ef('0x12')](0x1f4,_0x1ea544['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a640d06..6842132 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 _0x378c=['mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','./mailInteraction.controller','index','/describe','isAuthenticated','describe','get','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','/:id'];(function(_0xa0d36d,_0x80cd5d){var _0x4a7b74=function(_0x132c69){while(--_0x132c69){_0xa0d36d['push'](_0xa0d36d['shift']());}};_0x4a7b74(++_0x80cd5d);}(_0x378c,0x1b8));var _0xc378=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x378c[_0x4c12ec];return _0x3ae42c;};'use strict';var express=require(_0xc378('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xc378('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0xc378('0x2')]);router['get'](_0xc378('0x3'),auth[_0xc378('0x4')](),controller[_0xc378('0x5')]);router[_0xc378('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc378('0x6')](_0xc378('0x7'),auth[_0xc378('0x4')](),controller[_0xc378('0x8')]);router[_0xc378('0x6')](_0xc378('0x9'),auth[_0xc378('0x4')](),controller[_0xc378('0xa')]);router[_0xc378('0xb')]('/',auth[_0xc378('0x4')](),controller[_0xc378('0xc')]);router['post'](_0xc378('0x7'),auth['isAuthenticated'](),controller[_0xc378('0xd')]);router[_0xc378('0xb')](_0xc378('0xe'),auth[_0xc378('0x4')](),interaction[_0xc378('0xf')]('mail','mailinteraction:addtags'),controller[_0xc378('0x10')]);router[_0xc378('0x11')](_0xc378('0x12'),auth['isAuthenticated'](),interaction[_0xc378('0xf')](_0xc378('0x13'),_0xc378('0x14')),controller[_0xc378('0x15')]);router[_0xc378('0x16')](_0xc378('0x12'),auth[_0xc378('0x4')](),interaction[_0xc378('0xf')](_0xc378('0x13'),_0xc378('0x17')),controller[_0xc378('0x18')]);router[_0xc378('0x16')](_0xc378('0xe'),auth[_0xc378('0x4')](),controller[_0xc378('0x19')]);module[_0xc378('0x1a')]=router; \ No newline at end of file +var _0x3273=['describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','update','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x3273,0x80));var _0x3327=function(_0x2657c1,_0x50043d){_0x2657c1=_0x2657c1-0x0;var _0x2a94c3=_0x3273[_0x2657c1];return _0x2a94c3;};'use strict';var express=require(_0x3327('0x0'));var router=express[_0x3327('0x1')]();var auth=require(_0x3327('0x2'));var interaction=require(_0x3327('0x3'));var controller=require('./mailInteraction.controller');router[_0x3327('0x4')]('/',auth['isAuthenticated'](),controller[_0x3327('0x5')]);router[_0x3327('0x4')](_0x3327('0x6'),auth['isAuthenticated'](),controller[_0x3327('0x7')]);router[_0x3327('0x4')](_0x3327('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3327('0x4')](_0x3327('0x9'),auth[_0x3327('0xa')](),controller[_0x3327('0xb')]);router[_0x3327('0x4')](_0x3327('0xc'),auth['isAuthenticated'](),controller[_0x3327('0xd')]);router['post']('/',auth[_0x3327('0xa')](),controller['create']);router[_0x3327('0xe')]('/:id/messages',auth[_0x3327('0xa')](),controller[_0x3327('0xf')]);router['post'](_0x3327('0x10'),auth[_0x3327('0xa')](),interaction['tracked'](_0x3327('0x11'),_0x3327('0x12')),controller['addTags']);router[_0x3327('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0x3327('0x14')]('mail',_0x3327('0x15')),controller[_0x3327('0x16')]);router['delete'](_0x3327('0x8'),auth['isAuthenticated'](),interaction[_0x3327('0x14')]('mail','mailinteraction:destroy'),controller[_0x3327('0x17')]);router[_0x3327('0x18')](_0x3327('0x10'),auth['isAuthenticated'](),controller[_0x3327('0x19')]);module[_0x3327('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 43a1a41..a1b0a4e 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 _0xd445=['sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x6ab305,_0x26ad20){var _0x11d011=function(_0x3abef5){while(--_0x3abef5){_0x6ab305['push'](_0x6ab305['shift']());}};_0x11d011(++_0x26ad20);}(_0xd445,0x10e));var _0x5d44=function(_0x1561b5,_0x241bf5){_0x1561b5=_0x1561b5-0x0;var _0x34587d=_0xd445[_0x1561b5];return _0x34587d;};'use strict';var Sequelize=require(_0x5d44('0x0'));var iconv=require(_0x5d44('0x1'));module[_0x5d44('0x2')]={'closed':{'type':Sequelize[_0x5d44('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5d44('0x4')]},'secondDisposition':{'type':Sequelize[_0x5d44('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5d44('0x4')]},'note':{'type':Sequelize[_0x5d44('0x4')]},'inReplyTo':{'type':Sequelize[_0x5d44('0x4')](0x1fe)},'to':{'type':Sequelize[_0x5d44('0x4')]},'cc':{'type':Sequelize[_0x5d44('0x5')](_0x5d44('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5d44('0x7')]},'substatus':{'type':Sequelize[_0x5d44('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x5d44('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x5d44('0x8')]('in',_0x5d44('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5d44('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x5d44('0x8')]('in',_0x5d44('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5d44('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x038c=['ENUM','out','sequelize','iconv','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x332bf9,_0x4ae9db){var _0xafa554=function(_0x5de230){while(--_0x5de230){_0x332bf9['push'](_0x332bf9['shift']());}};_0xafa554(++_0x4ae9db);}(_0x038c,0x1c4));var _0xc038=function(_0x451745,_0x23e4c6){_0x451745=_0x451745-0x0;var _0x2311f3=_0x038c[_0x451745];return _0x2311f3;};'use strict';var Sequelize=require(_0xc038('0x0'));var iconv=require(_0xc038('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc038('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc038('0x3')]},'secondDisposition':{'type':Sequelize[_0xc038('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc038('0x3')]},'note':{'type':Sequelize[_0xc038('0x3')]},'inReplyTo':{'type':Sequelize[_0xc038('0x3')](0x1fe)},'to':{'type':Sequelize[_0xc038('0x3')]},'cc':{'type':Sequelize[_0xc038('0x4')](_0xc038('0x5'))},'subject':{'type':Sequelize[_0xc038('0x4')]()},'attach':{'type':Sequelize[_0xc038('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc038('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xc038('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xc038('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc038('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xc038('0x7')]('in',_0xc038('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc038('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 ab561e0..e1d1d82 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 _0xb422=['conditions','find','unreadMessages','having','`\x20=\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','MailAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','user','toString','sequelize','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.secondDisposition','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','enableEmailPreview','rows','params','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','format','includeAll','findAll','inlineCss','true','addTags','setTags','emit','removeTags','unix','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','moment','path','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','findOne','out','plainBody','-id','lastMsgText','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','MailInteraction','rawAttributes','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0xb422,0x85));var _0x2b42=function(_0xcbff5,_0x50eb75){_0xcbff5=_0xcbff5-0x0;var _0x13a00a=_0xb422[_0xcbff5];return _0x13a00a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x2b42('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x2b42('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2b42('0x2'));var juice=require('juice');var Redis=require(_0x2b42('0x3'));var qs=require('../../components/parsers/qs');var as=require(_0x2b42('0x4'));var logger=require(_0x2b42('0x5'))(_0x2b42('0x6'));var config=require('../../config/environment');var db=require(_0x2b42('0x7'))['db'];var htmlEntities=require(_0x2b42('0x8'));config[_0x2b42('0x9')]=_['defaults'](config['redis'],{'host':_0x2b42('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b42('0x9')]));require(_0x2b42('0xb'))[_0x2b42('0xc')](socket);function respondWithStatusCode(_0x1ec844,_0x59eeed){_0x59eeed=_0x59eeed||0xcc;return function(_0x191ea2){if(_0x191ea2){return _0x1ec844[_0x2b42('0xd')](_0x59eeed);}return _0x1ec844['status'](_0x59eeed)[_0x2b42('0xe')]();};}function respondWithResult(_0x30a882,_0x22272e){_0x22272e=_0x22272e||0xc8;return function(_0x176efa){if(_0x176efa){return _0x30a882['status'](_0x22272e)['json'](_0x176efa);}};}function respondWithFilteredResult(_0x1c1c37,_0x10cd23){return function(_0x5dec9a){if(_0x5dec9a){var _0x232c58=typeof _0x10cd23[_0x2b42('0xf')]===_0x2b42('0x10')&&typeof _0x10cd23[_0x2b42('0x11')]===_0x2b42('0x10');var _0xc7e610=_0x5dec9a[_0x2b42('0x12')];var _0x1b93d5=_0x232c58?0x0:_0x10cd23[_0x2b42('0xf')];var _0x1f7e7a=_0x232c58?_0x5dec9a['count']:_0x10cd23[_0x2b42('0xf')]+_0x10cd23[_0x2b42('0x11')];var _0x2302dd;if(_0x1f7e7a>=_0xc7e610){_0x1f7e7a=_0xc7e610;_0x2302dd=0xc8;}else{_0x2302dd=0xce;}_0x1c1c37[_0x2b42('0x13')](_0x2302dd);return _0x1c1c37[_0x2b42('0x14')](_0x2b42('0x15'),_0x1b93d5+'-'+_0x1f7e7a+'/'+_0xc7e610)[_0x2b42('0x16')](_0x5dec9a);}return null;};}function saveUpdates(_0x4728f4){return function(_0x490053){if(_0x490053){return _0x490053[_0x2b42('0x17')](_0x4728f4)[_0x2b42('0x18')](function(_0x4d8f3e){return _0x4d8f3e;});}return null;};}function removeEntity(_0x732f9c){return function(_0x5a8cc4){if(_0x5a8cc4){return _0x5a8cc4[_0x2b42('0x19')]()[_0x2b42('0x18')](function(){_0x732f9c[_0x2b42('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591dbd){return function(_0xf9a9cf){if(!_0xf9a9cf){_0x591dbd[_0x2b42('0xd')](0x194);}return _0xf9a9cf;};}function handleError(_0x24ac96,_0x2ee957){_0x2ee957=_0x2ee957||0x1f4;return function(_0x5151d1){logger[_0x2b42('0x1a')](_0x5151d1[_0x2b42('0x1b')]);if(_0x5151d1['name']){delete _0x5151d1[_0x2b42('0x1c')];}_0x24ac96[_0x2b42('0x13')](_0x2ee957)[_0x2b42('0x1d')](_0x5151d1);};}function getInteractionUsers(_0x7b989d,_0x252b8){return new BPromise(function(_0x367064,_0x5367f0){try{if(_0x252b8[_0x7b989d['id']]){_0x7b989d[_0x2b42('0x1e')]=_[_0x2b42('0x1f')](_0x252b8[_0x7b989d['id']],function(_0x477e97){return{'id':_0x477e97['id'],'fullname':_0x477e97[_0x2b42('0x20')]};});}}catch(_0x1d37b9){_0x5367f0(_0x1d37b9);}_0x367064(_0x7b989d);});}function getInteractionTags(_0x807625,_0x130912){return new BPromise(function(_0xd0ed7d,_0x2db5d7){try{if(_0x807625[_0x2b42('0x21')]){_0x807625[_0x2b42('0x22')]=[];_0x807625['TagIds']['split'](',')[_0x2b42('0x23')](function(_0xcb30f5){_0x807625[_0x2b42('0x22')][_0x2b42('0x24')](_0x130912[_0xcb30f5]);});}delete _0x807625['TagIds'];}catch(_0x286223){_0x2db5d7(_0x286223);}_0xd0ed7d(_0x807625);});}function getLastMessageText(_0x466f04){return new BPromise(function(_0x12477c,_0x5ba827){return db['MailMessage'][_0x2b42('0x25')]({'where':{'$and':[{'MailInteractionId':_0x466f04['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2b42('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2b42('0x27')],'order':_0x2b42('0x28'),'raw':!![]})['then'](function(_0x2b4423){if(_0x2b4423&&_0x2b4423[_0x2b42('0x27')]){_0x466f04[_0x2b42('0x29')]=_['trimStart'](_0x2b4423[_0x2b42('0x27')]);}_0x12477c(_0x466f04);})[_0x2b42('0x2a')](function(_0x3e029d){_0x5ba827(_0x3e029d);});});}function updateMailInteraction(_0x2dd942,_0x149465,_0x32a2d2,_0x39a618){return new BPromise(function(_0x200c17,_0x4305bb){return getInteractionUsers(_0x2dd942,_0x32a2d2)[_0x2b42('0x18')](function(_0x68a33e){return getInteractionTags(_0x68a33e,_0x149465);})['then'](function(_0x2b5d28){return getStateInteraction(_0x2b5d28);})['then'](function(_0x49447d){if(_0x39a618){_0x200c17(getLastMessageText(_0x49447d));}else{_0x200c17(_0x49447d);}})[_0x2b42('0x2a')](function(_0x75f09){_0x4305bb(_0x75f09);});});}function getStateInteraction(_0x4af6aa){return new BPromise(function(_0x480315){_0x4af6aa['waiting']=0x0;_0x4af6aa[_0x2b42('0x2b')]=0x0;_0x4af6aa[_0x2b42('0x2c')]=0x0;_0x4af6aa[_0x2b42('0x2d')]=0x0;_0x4af6aa['total']=0x0;if(!_0x4af6aa[_0x2b42('0x2e')]&&!_0x4af6aa[_0x2b42('0x2f')]){_0x4af6aa['waiting']+=0x1;}if(!_0x4af6aa['closed']&&_0x4af6aa[_0x2b42('0x2f')]){_0x4af6aa[_0x2b42('0x2b')]+=0x1;if(_0x4af6aa[_0x2b42('0x30')]){_0x4af6aa['waiting']-=0x1;}}if(_0x4af6aa[_0x2b42('0x2e')]&&_0x4af6aa[_0x2b42('0x2f')]){_0x4af6aa[_0x2b42('0x2c')]+=0x1;if(_0x4af6aa[_0x2b42('0x2b')]){_0x4af6aa[_0x2b42('0x2b')]-=0x1;}}if(_0x4af6aa['closed']&&!_0x4af6aa[_0x2b42('0x2f')]){_0x4af6aa[_0x2b42('0x2d')]+=0x1;if(_0x4af6aa[_0x2b42('0x30')]){_0x4af6aa[_0x2b42('0x30')]-=0x1;}}_0x4af6aa[_0x2b42('0x31')]+=0x1;_0x480315(_0x4af6aa);});}exports[_0x2b42('0x32')]=function(_0x45fb9f,_0x183454){var _0x44da9e={},_0x1e61dd={},_0x4fdd40={'count':0x0,'rows':[]};var _0x53403c=_[_0x2b42('0x1f')](db[_0x2b42('0x33')][_0x2b42('0x34')],function(_0x205b34){return{'name':_0x205b34['fieldName'],'type':_0x205b34[_0x2b42('0x35')][_0x2b42('0x36')]};});_0x1e61dd[_0x2b42('0x37')]=_[_0x2b42('0x1f')](_0x53403c,_0x2b42('0x1c'));_0x1e61dd['query']=_[_0x2b42('0x38')](_0x45fb9f['query']);_0x1e61dd[_0x2b42('0x39')]=_[_0x2b42('0x3a')](_0x1e61dd['model'],_0x1e61dd['query']);_0x44da9e[_0x2b42('0x3b')]=_[_0x2b42('0x3a')](_0x1e61dd['model'],qs['fields'](_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x3d')]));_0x44da9e[_0x2b42('0x3b')]=_0x44da9e[_0x2b42('0x3b')][_0x2b42('0x3e')]?_0x44da9e[_0x2b42('0x3b')]:_0x1e61dd['model'];if(!_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x3f')]('nolimit')){_0x44da9e[_0x2b42('0x11')]=qs[_0x2b42('0x11')](_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x11')]);_0x44da9e[_0x2b42('0xf')]=qs[_0x2b42('0xf')](_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0xf')]);}_0x44da9e[_0x2b42('0x40')]=qs[_0x2b42('0x41')](_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x41')]);_0x44da9e[_0x2b42('0x42')]=qs[_0x2b42('0x39')](_[_0x2b42('0x43')](_0x45fb9f['query'],_0x1e61dd['filters']),_0x53403c);var _0x5c9c32=[];var _0x3e9d1c=squel[_0x2b42('0x44')]()[_0x2b42('0x45')]('id')[_0x2b42('0x45')](_0x2b42('0x1c'))[_0x2b42('0x45')]('color')[_0x2b42('0x46')](_0x2b42('0x47'));var _0x547e0d=squel[_0x2b42('0x44')]()['field'](_0x2b42('0x48'))[_0x2b42('0x45')](_0x2b42('0x49'))[_0x2b42('0x45')](_0x2b42('0x4a'))[_0x2b42('0x46')](_0x2b42('0x4b'),'ui')[_0x2b42('0x4c')]('users','u',_0x2b42('0x4d'));var _0x54f224=squel[_0x2b42('0x44')]()[_0x2b42('0x46')](_0x2b42('0x4e'),'i')['left_join'](_0x2b42('0x4f'),'c',_0x2b42('0x50'))[_0x2b42('0x4c')](_0x2b42('0x51'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x2b42('0x52'),'a',_0x2b42('0x53'))[_0x2b42('0x4c')](_0x2b42('0x54'),'me','me.MailInteractionId\x20=\x20i.id')[_0x2b42('0x4c')](_0x2b42('0x55'),'it',_0x2b42('0x56'))[_0x2b42('0x4c')](_0x2b42('0x47'),'t','t.id\x20=\x20it.TagId');var _0x3e2e09=squel[_0x2b42('0x57')]();var _0x3487d5=[];var _0x7e2575=squel[_0x2b42('0x57')]();var _0x1d557d;if(_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x58')]){_0x1d557d=as[_0x2b42('0x59')](_0x45fb9f['query'][_0x2b42('0x58')]);var _0xfe4368=_0x1d557d[_0x2b42('0x5a')];for(var _0x461263=0x0;_0x461263<_0x1d557d['conditions']['length'];_0x461263++){var _0x43974d=_0x1d557d[_0x2b42('0x5b')][_0x461263];var _0x20cf3a='i';var _0x2f3416=_[_0x2b42('0x5c')](_0x53403c,[_0x2b42('0x1c'),_0x43974d[_0x2b42('0x45')]]);if(!_0x2f3416){switch(_0x43974d[_0x2b42('0x45')]){case _0x2b42('0x5d'):if(_0x43974d['value']==0x1){_0x54f224[_0x2b42('0x5e')]('`'+_0x43974d['field']+_0x2b42('0x5f'));}else{_0x54f224[_0x2b42('0x5e')]('`'+_0x43974d[_0x2b42('0x45')]+'`\x20>\x200');}break;case'Contact':if(_0x43974d['operator']===_0x2b42('0x60')){if(_0x43974d[_0x2b42('0x61')]['split']('\x20')[_0x2b42('0x3e')]>0x1){_0x3e2e09[_0xfe4368](_0x2b42('0x62'),qs[_0x2b42('0x63')](_0x43974d[_0x2b42('0x61')]),null);}else{var _0x5f2f6f='%'+_0x43974d[_0x2b42('0x61')]+'%';_0x3e2e09[_0xfe4368]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5f2f6f,_0x5f2f6f,_0x5f2f6f);}}else{_0x2f3416=_[_0x2b42('0x5c')](_0x53403c,['name',_0x2b42('0x64')]);_0x43974d[_0x2b42('0x45')]='ContactId';_0x42f03b=as[_0x2b42('0x65')](_0x20cf3a,_0x2f3416[_0x2b42('0x35')],_0x43974d);_0x3e2e09[_0xfe4368](_0x42f03b[_0x2b42('0x66')],_0x42f03b[_0x2b42('0x61')]['start'],_0x42f03b[_0x2b42('0x61')][_0x2b42('0xe')]);}break;case _0x2b42('0x67'):var _0x3ad603=_0x43974d['value'][_0x2b42('0x68')](',')[_0x2b42('0x1f')](function(_0x416ddb){return Number(_0x416ddb);});_0x3ad603[_0x2b42('0x23')](function(_0x4e0e4f){_0x7e2575['or'](_0x2b42('0x69'),'%,'+_0x4e0e4f+',%');});_0x3487d5=_[_0x2b42('0x6a')](_0x3487d5,_0x3ad603);break;case'User':if(_0x43974d[_0x2b42('0x6b')]===_0x2b42('0x60')){_0x3e2e09[_0xfe4368](_0x2b42('0x6c'),'%'+_0x43974d[_0x2b42('0x61')]+'%',null);}else{_0x2f3416=_[_0x2b42('0x5c')](_0x53403c,[_0x2b42('0x1c'),_0x2b42('0x2f')]);_0x43974d['field']=_0x2b42('0x2f');_0x42f03b=as[_0x2b42('0x65')](_0x20cf3a,_0x2f3416[_0x2b42('0x35')],_0x43974d);_0x3e2e09[_0xfe4368](_0x42f03b[_0x2b42('0x66')],_0x42f03b[_0x2b42('0x61')][_0x2b42('0x6d')],_0x42f03b[_0x2b42('0x61')][_0x2b42('0xe')]);}break;case _0x2b42('0x27'):_0x42f03b=as['buildExpression']('me',null,_0x43974d);_0x3e2e09[_0xfe4368](_0x42f03b[_0x2b42('0x66')],_0x42f03b[_0x2b42('0x61')]['start'],_0x42f03b['value']['end']);break;}}else{var _0x42f03b=as[_0x2b42('0x65')](_0x20cf3a,_0x2f3416['type'],_0x43974d);_0x3e2e09[_0xfe4368](_0x42f03b[_0x2b42('0x66')],_0x42f03b[_0x2b42('0x61')][_0x2b42('0x6d')],_0x42f03b[_0x2b42('0x61')][_0x2b42('0xe')]);}}}else{var _0x1572be=_(_0x45fb9f[_0x2b42('0x3c')])[_0x2b42('0x38')]()[_0x2b42('0x1f')](function(_0x47868f){return _[_0x2b42('0x6e')](_0x53403c,[_0x2b42('0x1c'),_0x47868f])?_0x47868f:undefined;})[_0x2b42('0x6f')]()[_0x2b42('0x61')]();if(!_[_0x2b42('0x70')](_0x1572be)){_0x1572be[_0x2b42('0x23')](function(_0x39c9f5){if(_0x39c9f5===_0x2b42('0x71')){_0x54f224[_0x2b42('0x42')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x45fb9f[_0x2b42('0x3c')][_0x39c9f5]));}else if(_0x39c9f5===_0x2b42('0x72')){var _0x1d5f43=JSON[_0x2b42('0x73')](_0x45fb9f[_0x2b42('0x3c')][_0x39c9f5])[_0x2b42('0x74')];var _0x5a5071=JSON[_0x2b42('0x73')](_0x45fb9f[_0x2b42('0x3c')][_0x39c9f5])[_0x2b42('0x75')];_0x54f224[_0x2b42('0x42')](_0x2b42('0x76'),_0x1d5f43,_0x5a5071);}else{if(_0x45fb9f[_0x2b42('0x3c')][_0x39c9f5]===_0x2b42('0x77')){_0x54f224['where']('i.'+_0x39c9f5+_0x2b42('0x78'));}else{_0x54f224[_0x2b42('0x42')]('i.'+_0x39c9f5+'\x20=\x20?',_0x45fb9f['query'][_0x39c9f5]);}}});}if(_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x79')]){if(_0x45fb9f[_0x2b42('0x3c')]['read']==0x1){_0x54f224['having'](_0x2b42('0x7a'));}else{_0x54f224[_0x2b42('0x5e')](_0x2b42('0x7b'));}}if(_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x7c')]){_0x3487d5=_[_0x2b42('0x7d')](_0x45fb9f['query'][_0x2b42('0x7c')])?_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x7c')]:new Array(_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x7c')]);_0x3487d5[_0x2b42('0x23')](function(_0x149bcc){_0x7e2575['or'](_0x2b42('0x69'),'%,'+_0x149bcc+',%');});}if(_0x45fb9f['query'][_0x2b42('0x7e')]){var _0x2002f1=_0x45fb9f['query']['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2b42('0x7f')](_0x2002f1)){_0x3e2e09['or'](_0x2b42('0x80'),_0x2002f1+'%');}else if(qs[_0x2b42('0x81')](_0x2002f1)){_0x3e2e09['or']('c.email\x20LIKE\x20?',_0x2002f1+'%');}else{_0x3e2e09['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b42('0x63')](_0x2002f1))['or'](_0x2b42('0x82'),qs[_0x2b42('0x63')](_0x2002f1));}}}_0x54f224[_0x2b42('0x42')](_0x3e2e09);_0x54f224['group'](_0x2b42('0x83'));var _0x5d9c6c={'type':db['Sequelize'][_0x2b42('0x84')][_0x2b42('0x85')],'raw':!![]};var _0x1d79c5=_0x54f224[_0x2b42('0x86')]();_0x1d79c5[_0x2b42('0x45')](_0x2b42('0x83'));_0x1d79c5[_0x2b42('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2b42('0x5d'));if(_0x44da9e[_0x2b42('0x40')]){_0x44da9e['order']['forEach'](function(_0x25e7d8){var _0x40c60b=_0x25e7d8[0x0]==='contactName'?_0x25e7d8[0x0]:'i.'+_0x25e7d8[0x0];_0x54f224[_0x2b42('0x40')](_0x40c60b,_0x25e7d8[0x1]===_0x2b42('0x87')?![]:!![]);});}if(!_[_0x2b42('0x70')](_0x3487d5)){_0x54f224['having'](_0x7e2575);_0x1d79c5[_0x2b42('0x42')](_0x2b42('0x88'),_0x3487d5);}BPromise[_0x2b42('0x89')]()[_0x2b42('0x18')](function(){if(!_0x1d557d){if(_0x45fb9f['query']['MailAccountId'])return;_0x1d79c5[_0x2b42('0x42')](_0x2b42('0x8a'));_0x54f224[_0x2b42('0x42')](_0x2b42('0x8a'));return;}if(_0x45fb9f['user'][_0x2b42('0x8b')]!==_0x2b42('0x8c'))return;return _0x45fb9f['user'][_0x2b42('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4025b3){if(_[_0x2b42('0x70')](_0x4025b3)){_0x1d79c5[_0x2b42('0x42')]('i.MailAccountId\x20IS\x20NULL');_0x54f224['where'](_0x2b42('0x8e'));}else{_0x1d79c5[_0x2b42('0x42')](_0x2b42('0x8f'),_[_0x2b42('0x1f')](_0x4025b3,'id'));_0x54f224[_0x2b42('0x42')](_0x2b42('0x8f'),_[_0x2b42('0x1f')](_0x4025b3,'id'));}});})[_0x2b42('0x18')](function(){if(_0x45fb9f[_0x2b42('0x90')][_0x2b42('0x8b')]===_0x2b42('0x8c')&&!_0x1d557d&&!_0x45fb9f[_0x2b42('0x3c')][_0x2b42('0x71')])return[];return db['sequelize'][_0x2b42('0x3c')](_0x1d79c5[_0x2b42('0x91')](),_0x5d9c6c);})[_0x2b42('0x18')](function(_0x2e1e01){_0x4fdd40[_0x2b42('0x12')]=_0x2e1e01['length'];if(_0x4fdd40[_0x2b42('0x12')]===0x0)return[];return db[_0x2b42('0x92')][_0x2b42('0x3c')](_0x3e9d1c[_0x2b42('0x91')](),_0x5d9c6c)[_0x2b42('0x18')](function(_0x3d0a03){_0x5c9c32=_['keyBy'](_0x3d0a03,'id');_0x5d9c6c=_[_0x2b42('0x93')](_0x5d9c6c,{'model':db[_0x2b42('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x45fb9f['query'][_0x2b42('0x3d')]){_0x44da9e[_0x2b42('0x3b')]['forEach'](function(_0x3bbd29){_0x54f224[_0x2b42('0x45')]('i.'+_0x3bbd29);});}else{_0x54f224[_0x2b42('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2b42('0x5d'));_0x54f224[_0x2b42('0x45')]('a.key',_0x2b42('0x94'));_0x54f224['field'](_0x2b42('0x95'),_0x2b42('0x96'));_0x54f224[_0x2b42('0x45')](_0x2b42('0x97'),_0x2b42('0x98'));_0x54f224[_0x2b42('0x45')](_0x2b42('0x83'));_0x54f224['field'](_0x2b42('0x99'));_0x54f224[_0x2b42('0x45')](_0x2b42('0x9a'));_0x54f224[_0x2b42('0x45')](_0x2b42('0x9b'));_0x54f224[_0x2b42('0x45')](_0x2b42('0x9c'));_0x54f224['field']('i.attach');_0x54f224[_0x2b42('0x45')](_0x2b42('0x9d'));_0x54f224[_0x2b42('0x45')]('i.lastMsgDirection');_0x54f224[_0x2b42('0x45')](_0x2b42('0x9e'));_0x54f224[_0x2b42('0x45')]('i.disposition');_0x54f224['field'](_0x2b42('0x9f'));_0x54f224['field']('i.thirdDisposition');_0x54f224[_0x2b42('0x45')]('i.substatus');_0x54f224['field']('i.to');_0x54f224[_0x2b42('0x45')](_0x2b42('0xa0'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xa1'));_0x54f224[_0x2b42('0x45')]('i.UserId');_0x54f224[_0x2b42('0x45')](_0x2b42('0xa2'),_0x2b42('0xa3'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xa4'),_0x2b42('0xa5'));_0x54f224['field'](_0x2b42('0xa6'),_0x2b42('0xa7'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xa8'),'Contact.phone');_0x54f224[_0x2b42('0x45')](_0x2b42('0xa9'),_0x2b42('0xaa'));_0x54f224['field']('c.fax',_0x2b42('0xab'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xac'),_0x2b42('0xad'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xae'),_0x2b42('0xaf'));_0x54f224[_0x2b42('0x45')](_0x2b42('0xb0'),_0x2b42('0x21'));}if(_0x44da9e[_0x2b42('0x11')])_0x54f224['limit'](_0x44da9e['limit']);if(_0x44da9e[_0x2b42('0xf')])_0x54f224[_0x2b42('0xf')](_0x44da9e['offset']);return db[_0x2b42('0x92')][_0x2b42('0x3c')](_0x54f224[_0x2b42('0x91')](),_0x5d9c6c);})[_0x2b42('0x18')](function(_0x3cde9d){if(_0x3cde9d[_0x2b42('0x3e')]>0x0)_0x547e0d[_0x2b42('0x42')](_0x2b42('0xb1'),_['map'](_0x3cde9d,'id'));return db[_0x2b42('0x92')]['query'](_0x547e0d['toString'](),_0x5d9c6c)[_0x2b42('0x18')](function(_0x3a4f9a){var _0x14f570=_['groupBy'](_0x3a4f9a,_0x2b42('0xb2'));var _0x58dee4=[];return db['Setting'][_0x2b42('0x25')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x26636d){var _0x1e884b=_0x26636d[_0x2b42('0xb3')];_0x3cde9d[_0x2b42('0x23')](function(_0x166690){_0x58dee4[_0x2b42('0x24')](updateMailInteraction(_0x166690,_0x5c9c32,_0x14f570,_0x1e884b));});return BPromise['all'](_0x58dee4);});});});})[_0x2b42('0x18')](function(_0x2cca9a){_0x4fdd40[_0x2b42('0xb4')]=_0x2cca9a;return _0x4fdd40;})[_0x2b42('0x18')](respondWithFilteredResult(_0x183454,_0x44da9e))[_0x2b42('0x2a')](handleError(_0x183454,null));};exports['show']=function(_0x2d6eab,_0x489c23){var _0x25704a={'raw':![],'where':{'id':_0x2d6eab[_0x2b42('0xb5')]['id']}},_0x4c134d={};_0x4c134d[_0x2b42('0x37')]=_[_0x2b42('0x38')](db[_0x2b42('0x33')][_0x2b42('0x34')]);_0x4c134d['query']=_[_0x2b42('0x38')](_0x2d6eab[_0x2b42('0x3c')]);_0x4c134d[_0x2b42('0x39')]=_[_0x2b42('0x3a')](_0x4c134d['model'],_0x4c134d['query']);_0x25704a['attributes']=_['intersection'](_0x4c134d['model'],qs[_0x2b42('0x3d')](_0x2d6eab[_0x2b42('0x3c')]['fields']));_0x25704a[_0x2b42('0x3b')]=_0x25704a[_0x2b42('0x3b')]['length']?_0x25704a[_0x2b42('0x3b')]:_0x4c134d['model'];if(_0x2d6eab['query']['includeAll']){_0x25704a[_0x2b42('0xb6')]=[{'all':!![]}];}_0x25704a=_[_0x2b42('0x93')]({},_0x25704a,_0x2d6eab[_0x2b42('0xb7')]);return db[_0x2b42('0x33')][_0x2b42('0x5c')](_0x25704a)[_0x2b42('0x18')](handleEntityNotFound(_0x489c23,null))['then'](respondWithResult(_0x489c23,null))[_0x2b42('0x2a')](handleError(_0x489c23,null));};exports[_0x2b42('0xb8')]=function(_0x51199e,_0x4f472b){return db[_0x2b42('0x33')]['create'](_0x51199e[_0x2b42('0xb9')],{})[_0x2b42('0x18')](respondWithResult(_0x4f472b,0xc9))['catch'](handleError(_0x4f472b,null));};exports['update']=function(_0x273367,_0x14e417){if(_0x273367[_0x2b42('0xb9')]['id']){delete _0x273367[_0x2b42('0xb9')]['id'];}return db[_0x2b42('0x33')][_0x2b42('0x5c')]({'where':{'id':_0x273367[_0x2b42('0xb5')]['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x14e417,null))[_0x2b42('0x18')](saveUpdates(_0x273367[_0x2b42('0xb9')],null))[_0x2b42('0x18')](respondWithResult(_0x14e417,null))['catch'](handleError(_0x14e417,null));};exports[_0x2b42('0x19')]=function(_0xa5d44f,_0x4dbee4){return db[_0x2b42('0x33')][_0x2b42('0x5c')]({'where':{'id':_0xa5d44f[_0x2b42('0xb5')]['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x4dbee4,null))['then'](removeEntity(_0x4dbee4,null))[_0x2b42('0x2a')](handleError(_0x4dbee4,null));};exports[_0x2b42('0xba')]=function(_0x106824,_0x20bf1a){return db[_0x2b42('0x33')][_0x2b42('0xba')]()[_0x2b42('0x18')](respondWithResult(_0x20bf1a,null))['catch'](handleError(_0x20bf1a,null));};exports[_0x2b42('0xbb')]=function(_0x2930fb,_0x4f1026){return db[_0x2b42('0xbc')]['find']({'where':{'id':_0x2930fb[_0x2b42('0xb5')]['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x4f1026,null))[_0x2b42('0x18')](function(_0x10e2f9){if(_0x10e2f9){return _0x10e2f9['addMessage'](_0x2930fb[_0x2b42('0xb9')][_0x2b42('0xbd')],_[_0x2b42('0xbe')](_0x2930fb[_0x2b42('0xb9')],[_0x2b42('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x4f1026,null))[_0x2b42('0x2a')](handleError(_0x4f1026,null));};exports[_0x2b42('0xbf')]=function(_0x2c19fa,_0x11c3bb){var _0x23c41d={'raw':![],'where':{}};var _0xa30a26={};var _0x107cf6={'count':0x0,'rows':[]};return db['MailInteraction'][_0x2b42('0x25')]({'where':{'id':_0x2c19fa['params']['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x11c3bb,null))[_0x2b42('0x18')](function(_0x43373c){if(_0x43373c){_0xa30a26['model']=_[_0x2b42('0x38')](db['MailMessage'][_0x2b42('0x34')]);_0xa30a26[_0x2b42('0x3c')]=_[_0x2b42('0x38')](_0x2c19fa['query']);_0xa30a26[_0x2b42('0x39')]=_[_0x2b42('0x3a')](_0xa30a26[_0x2b42('0x37')],_0xa30a26[_0x2b42('0x3c')]);_0x23c41d['attributes']=_[_0x2b42('0x3a')](_0xa30a26[_0x2b42('0x37')],qs[_0x2b42('0x3d')](_0x2c19fa['query'][_0x2b42('0x3d')]));_0x23c41d[_0x2b42('0x3b')]=_0x23c41d[_0x2b42('0x3b')][_0x2b42('0x3e')]?_0x23c41d[_0x2b42('0x3b')]:_0xa30a26['model'];if(!_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0x3f')](_0x2b42('0xc0'))){_0x23c41d['limit']=qs['limit'](_0x2c19fa[_0x2b42('0x3c')]['limit']);_0x23c41d['offset']=qs['offset'](_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0xf')]);}_0x23c41d[_0x2b42('0x40')]=qs[_0x2b42('0x41')](_0x2c19fa[_0x2b42('0x3c')]['sort']);_0x23c41d[_0x2b42('0x42')]=qs[_0x2b42('0x39')](_[_0x2b42('0x43')](_0x2c19fa['query'],_0xa30a26[_0x2b42('0x39')]));_0x23c41d[_0x2b42('0x42')][_0x2b42('0xb2')]=_0x43373c['id'];if(_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0x7e')]){_0x23c41d['where']=_[_0x2b42('0x93')](_0x23c41d['where'],{'$or':_[_0x2b42('0x1f')](_0x23c41d['attributes'],function(_0x382a9f){var _0x1d3f07={};_0x1d3f07[_0x382a9f]={'$like':'%'+_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0x7e')]+'%'};return _0x1d3f07;})});}if(_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0x74')]){var _0x244dfd=_0x2c19fa['query'][_0x2b42('0x74')]['split'](',');var _0x20e13a={};_0x20e13a[_0x244dfd[0x0]]={'$gte':moment(_0x244dfd[0x1])[_0x2b42('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23c41d[_0x2b42('0x42')]=_[_0x2b42('0x93')](_0x23c41d[_0x2b42('0x42')],_0x20e13a);}_0x23c41d=_[_0x2b42('0x93')]({},_0x23c41d,_0x2c19fa['options']);return db['MailMessage'][_0x2b42('0x12')]({'where':_0x23c41d[_0x2b42('0x42')]})['then'](function(_0x5ad7f1){_0x107cf6['count']=_0x5ad7f1;if(_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0xc2')]){_0x23c41d[_0x2b42('0xb6')]=[{'all':!![]}];}return db['MailMessage'][_0x2b42('0xc3')](_0x23c41d);})[_0x2b42('0x18')](function(_0x54eb42){if(_0x2c19fa[_0x2b42('0x3c')][_0x2b42('0xc4')]===_0x2b42('0xc5')){for(var _0x480be7=0x0;_0x480be7<_0x54eb42[_0x2b42('0x3e')];_0x480be7++){_0x54eb42[_0x480be7]['body']=juice(_0x54eb42[_0x480be7]['body']);}}_0x107cf6[_0x2b42('0xb4')]=_0x54eb42;return _0x107cf6;});}})[_0x2b42('0x18')](respondWithFilteredResult(_0x11c3bb,_0x23c41d))['catch'](handleError(_0x11c3bb,null));};exports[_0x2b42('0xc6')]=function(_0x5cf219,_0x38636d){return db[_0x2b42('0x33')][_0x2b42('0x5c')]({'where':{'id':_0x5cf219[_0x2b42('0xb5')]['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x38636d,null))[_0x2b42('0x18')](function(_0x25b9e4){if(_0x25b9e4){return _0x25b9e4[_0x2b42('0xc7')](_0x5cf219['body'][_0x2b42('0xbd')],_['omit'](_0x5cf219['body'],[_0x2b42('0xbd'),'id'])||{})['spread'](function(){return db[_0x2b42('0x67')]['findAll']({'attributes':['id',_0x2b42('0x1c'),'color'],'where':{'id':_0x5cf219[_0x2b42('0xb9')][_0x2b42('0xbd')]}});})[_0x2b42('0x18')](function(_0x420eb8){socket[_0x2b42('0xc8')]('mailInteractionTags:save',{'id':Number(_0x5cf219['params']['id']),'tags':_0x420eb8||[]});return{'id':Number(_0x5cf219[_0x2b42('0xb5')]['id']),'tags':_0x420eb8||[]};});}})['then'](respondWithResult(_0x38636d,null))[_0x2b42('0x2a')](handleError(_0x38636d,null));};exports[_0x2b42('0xc9')]=function(_0x3823ff,_0x19d5f1){return db[_0x2b42('0x33')][_0x2b42('0x5c')]({'where':{'id':_0x3823ff[_0x2b42('0xb5')]['id']}})[_0x2b42('0x18')](handleEntityNotFound(_0x19d5f1,null))['then'](function(_0xddaa5b){if(_0xddaa5b){return _0xddaa5b[_0x2b42('0xc9')](_0x3823ff[_0x2b42('0x3c')][_0x2b42('0xbd')]);}})['then'](respondWithStatusCode(_0x19d5f1,null))[_0x2b42('0x2a')](handleError(_0x19d5f1,null));};exports['download']=function(_0x42823c,_0x258f45){var _0x556c05=moment()[_0x2b42('0xca')]()['toString']();var _0x477967=path[_0x2b42('0xcb')](config[_0x2b42('0xcc')],'server',_0x2b42('0xcd'),'tmp');var _0x24f859=path[_0x2b42('0xcb')](config[_0x2b42('0xcc')],'server',_0x2b42('0xcd'),_0x2b42('0xce'));var _0x1cd9a3=path[_0x2b42('0xcb')](_0x477967,_0x556c05);var _0x351593=util[_0x2b42('0xc1')](_0x2b42('0xcf'),_0x42823c[_0x2b42('0xb5')]['id'],_0x556c05);var _0x459edd=path[_0x2b42('0xcb')](_0x477967,_0x351593);var _0x293da4=[];if(_0x42823c[_0x2b42('0x3c')]['attachments']){_0x293da4[_0x2b42('0x24')]({'model':db[_0x2b42('0xd0')],'as':_0x2b42('0xd1'),'raw':!![]});}var _0x47f44a=[{'model':db[_0x2b42('0xbc')],'as':_0x2b42('0xd2'),'attributes':['id',_0x2b42('0xb9'),_0x2b42('0x46'),'to','cc',_0x2b42('0xd3'),'subject',_0x2b42('0x72')],'where':{'secret':![]},'order':qs[_0x2b42('0x41')]('id'),'include':_0x293da4}];return db[_0x2b42('0x33')][_0x2b42('0x5c')]({'where':{'id':_0x42823c[_0x2b42('0xb5')]['id']},'include':_0x47f44a})[_0x2b42('0x18')](handleEntityNotFound(_0x258f45,null))[_0x2b42('0x18')](function(_0x4a376a){if(_0x4a376a&&_0x4a376a[_0x2b42('0xd2')]){var _0x49d040=_0x4a376a['get']({'plain':!![]});fs[_0x2b42('0xd4')](_0x1cd9a3);return BPromise[_0x2b42('0xd5')](_0x49d040[_0x2b42('0xd2')],function(_0x4eaaa4,_0xa23e96){var _0x11db40={'from':_0x4eaaa4[_0x2b42('0x46')],'to':_0x4eaaa4['to'],'subject':_0x4eaaa4['subject'],'html':htmlEntities['decode'](_0x4eaaa4[_0x2b42('0xb9')]),'headers':{'Date':moment(_0x4eaaa4[_0x2b42('0x72')])[_0x2b42('0xc1')](_0x2b42('0xd6'))},'attachments':[]};if(_0x4eaaa4['cc']){_0x11db40[_0x2b42('0xd7')]['Cc']=_0x4eaaa4['cc'];}if(_0x4eaaa4[_0x2b42('0xd3')]){_0x11db40[_0x2b42('0xd7')]['Bcc']=_0x4eaaa4[_0x2b42('0xd3')];}return new BPromise(function(_0x50d8bd,_0x976544){if(_0x4eaaa4[_0x2b42('0xd1')]){for(var _0x7831f2=0x0;_0x7831f2<_0x4eaaa4[_0x2b42('0xd1')][_0x2b42('0x3e')];_0x7831f2++){var _0x5a0294=_0x4eaaa4[_0x2b42('0xd1')][_0x7831f2];var _0x6afa39=path[_0x2b42('0xcb')](_0x24f859,_0x5a0294[_0x2b42('0xd8')]);if(fs[_0x2b42('0xd9')](_0x6afa39)){_0x11db40['attachments'][_0x2b42('0x24')]({'name':_0x5a0294[_0x2b42('0x1c')],'contentType':_0x5a0294[_0x2b42('0x35')],'data':fs[_0x2b42('0xda')](_0x6afa39)});}}}emlformat[_0x2b42('0xdb')](_0x11db40,function(_0x5cbe38,_0x5a641b){if(_0x5cbe38)return _0x976544(_0x5cbe38);fs[_0x2b42('0xdc')](path[_0x2b42('0xcb')](_0x1cd9a3,util[_0x2b42('0xc1')](_0x2b42('0xdd'),_0xa23e96)),_0x5a641b);return _0x50d8bd(_0x5a641b);});});})[_0x2b42('0x18')](function(){return new BPromise(function(_0x5b8d5a,_0x9fe161){zipdir(_0x1cd9a3,{'saveTo':_0x459edd},function(_0x3e0e5b,_0xe4eb82){if(_0x3e0e5b)return _0x9fe161(_0x3e0e5b);return _0x5b8d5a(_0xe4eb82);});})[_0x2b42('0x18')](function(){return new BPromise(function(_0x516e7f,_0x108901){rimraf(_0x1cd9a3,function(_0x271cad){if(_0x271cad)_0x108901(_0x271cad);return _0x516e7f();});});})['then'](function(){return _0x258f45[_0x2b42('0xde')](_0x459edd,_0x351593,function(_0x3dd8ae){if(!_0x3dd8ae)fs[_0x2b42('0xdf')](_0x459edd);});});});}else{return _0x258f45['sendStatus'](0xc8);}})[_0x2b42('0x2a')](handleError(_0x258f45,null));}; \ No newline at end of file +var _0x1261=['unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','params','rawAttributes','includeAll','include','options','create','body','destroy','describe','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','format','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','error','name','Users','map','fullname','Tags','TagIds','forEach','push','MailMessage','-id','lastMsgText','trimStart','catch','waiting','talking','answered','closed','UserId','unmanaged','total','index','MailInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','select','field','color','from','u.id','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','length','find','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','plainBody','start','some','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x1b34b6,_0x43ead0){var _0x4c0f11=function(_0x3e6426){while(--_0x3e6426){_0x1b34b6['push'](_0x1b34b6['shift']());}};_0x4c0f11(++_0x43ead0);}(_0x1261,0x144));var _0x1126=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x1261[_0x4cbf20];return _0x582ae4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var moment=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var util=require(_0x1126('0x4'));var path=require(_0x1126('0x5'));var fs=require('fs');var _=require(_0x1126('0x6'));var squel=require(_0x1126('0x7'));var juice=require(_0x1126('0x8'));var Redis=require(_0x1126('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x1126('0xa'))(_0x1126('0xb'));var config=require('../../config/environment');var db=require(_0x1126('0xc'))['db'];var htmlEntities=require(_0x1126('0xd'));config[_0x1126('0xe')]=_[_0x1126('0xf')](config[_0x1126('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x1126('0x10'))(new Redis(config[_0x1126('0xe')]));require(_0x1126('0x11'))['register'](socket);function respondWithStatusCode(_0x34571c,_0x5d581b){_0x5d581b=_0x5d581b||0xcc;return function(_0x52ef15){if(_0x52ef15){return _0x34571c[_0x1126('0x12')](_0x5d581b);}return _0x34571c['status'](_0x5d581b)[_0x1126('0x13')]();};}function respondWithResult(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xc8;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x14')](_0xd26a32)[_0x1126('0x15')](_0x273896);}};}function respondWithFilteredResult(_0xd8ca42,_0x2048ad){return function(_0x43850b){if(_0x43850b){var _0x53a8f0=typeof _0x2048ad['offset']===_0x1126('0x16')&&typeof _0x2048ad[_0x1126('0x17')]===_0x1126('0x16');var _0x4be0c6=_0x43850b[_0x1126('0x18')];var _0x4794a7=_0x53a8f0?0x0:_0x2048ad[_0x1126('0x19')];var _0x42f379=_0x53a8f0?_0x43850b[_0x1126('0x18')]:_0x2048ad['offset']+_0x2048ad[_0x1126('0x17')];var _0x1695f6;if(_0x42f379>=_0x4be0c6){_0x42f379=_0x4be0c6;_0x1695f6=0xc8;}else{_0x1695f6=0xce;}_0xd8ca42['status'](_0x1695f6);return _0xd8ca42['set'](_0x1126('0x1a'),_0x4794a7+'-'+_0x42f379+'/'+_0x4be0c6)[_0x1126('0x15')](_0x43850b);}return null;};}function saveUpdates(_0x58d11a){return function(_0x548359){if(_0x548359){return _0x548359[_0x1126('0x1b')](_0x58d11a)['then'](function(_0x22ed37){return _0x22ed37;});}return null;};}function removeEntity(_0x1d6d19){return function(_0x2f70ac){if(_0x2f70ac){return _0x2f70ac['destroy']()[_0x1126('0x1c')](function(){_0x1d6d19['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f6b3){return function(_0x3a9bed){if(!_0x3a9bed){_0x30f6b3[_0x1126('0x12')](0x194);}return _0x3a9bed;};}function handleError(_0x36d254,_0x526ca1){_0x526ca1=_0x526ca1||0x1f4;return function(_0x29ab60){logger[_0x1126('0x1d')](_0x29ab60['stack']);if(_0x29ab60[_0x1126('0x1e')]){delete _0x29ab60['name'];}_0x36d254['status'](_0x526ca1)['send'](_0x29ab60);};}function getInteractionUsers(_0x2199d9,_0x15bcc3){return new BPromise(function(_0x329914,_0x34bcf1){try{if(_0x15bcc3[_0x2199d9['id']]){_0x2199d9[_0x1126('0x1f')]=_[_0x1126('0x20')](_0x15bcc3[_0x2199d9['id']],function(_0xea0971){return{'id':_0xea0971['id'],'fullname':_0xea0971[_0x1126('0x21')]};});}}catch(_0x589725){_0x34bcf1(_0x589725);}_0x329914(_0x2199d9);});}function getInteractionTags(_0x35eec3,_0x375e59){return new BPromise(function(_0xa293f4,_0x5ddf63){try{if(_0x35eec3['TagIds']){_0x35eec3[_0x1126('0x22')]=[];_0x35eec3[_0x1126('0x23')]['split'](',')[_0x1126('0x24')](function(_0x23d2bc){_0x35eec3['Tags'][_0x1126('0x25')](_0x375e59[_0x23d2bc]);});}delete _0x35eec3['TagIds'];}catch(_0xc62460){_0x5ddf63(_0xc62460);}_0xa293f4(_0x35eec3);});}function getLastMessageText(_0x4bd50b){return new BPromise(function(_0x771bb8,_0x583ce6){return db[_0x1126('0x26')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4bd50b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x1126('0x27'),'raw':!![]})[_0x1126('0x1c')](function(_0x1cef48){if(_0x1cef48&&_0x1cef48['plainBody']){_0x4bd50b[_0x1126('0x28')]=_[_0x1126('0x29')](_0x1cef48['plainBody']);}_0x771bb8(_0x4bd50b);})[_0x1126('0x2a')](function(_0x1e80aa){_0x583ce6(_0x1e80aa);});});}function updateMailInteraction(_0x2d8127,_0x29fbfa,_0x5836a2,_0x5ecbc3){return new BPromise(function(_0x2a7edc,_0x19e6e4){return getInteractionUsers(_0x2d8127,_0x5836a2)[_0x1126('0x1c')](function(_0x2c67eb){return getInteractionTags(_0x2c67eb,_0x29fbfa);})['then'](function(_0x145314){return getStateInteraction(_0x145314);})[_0x1126('0x1c')](function(_0x313ebe){if(_0x5ecbc3){_0x2a7edc(getLastMessageText(_0x313ebe));}else{_0x2a7edc(_0x313ebe);}})[_0x1126('0x2a')](function(_0x3b0f79){_0x19e6e4(_0x3b0f79);});});}function getStateInteraction(_0x5df232){return new BPromise(function(_0x2a0dfe){_0x5df232[_0x1126('0x2b')]=0x0;_0x5df232[_0x1126('0x2c')]=0x0;_0x5df232[_0x1126('0x2d')]=0x0;_0x5df232['unmanaged']=0x0;_0x5df232['total']=0x0;if(!_0x5df232[_0x1126('0x2e')]&&!_0x5df232[_0x1126('0x2f')]){_0x5df232['waiting']+=0x1;}if(!_0x5df232[_0x1126('0x2e')]&&_0x5df232[_0x1126('0x2f')]){_0x5df232[_0x1126('0x2c')]+=0x1;if(_0x5df232['waiting']){_0x5df232['waiting']-=0x1;}}if(_0x5df232[_0x1126('0x2e')]&&_0x5df232[_0x1126('0x2f')]){_0x5df232[_0x1126('0x2d')]+=0x1;if(_0x5df232[_0x1126('0x2c')]){_0x5df232['talking']-=0x1;}}if(_0x5df232[_0x1126('0x2e')]&&!_0x5df232['UserId']){_0x5df232[_0x1126('0x30')]+=0x1;if(_0x5df232[_0x1126('0x2b')]){_0x5df232[_0x1126('0x2b')]-=0x1;}}_0x5df232[_0x1126('0x31')]+=0x1;_0x2a0dfe(_0x5df232);});}exports[_0x1126('0x32')]=function(_0x5746f6,_0x1da59f){var _0x3ea9de={},_0x2939a9={},_0x397e3b={'count':0x0,'rows':[]};var _0x3469a2=_[_0x1126('0x20')](db[_0x1126('0x33')]['rawAttributes'],function(_0x1c8d8a){return{'name':_0x1c8d8a[_0x1126('0x34')],'type':_0x1c8d8a[_0x1126('0x35')][_0x1126('0x36')]};});_0x2939a9[_0x1126('0x37')]=_['map'](_0x3469a2,'name');_0x2939a9[_0x1126('0x38')]=_[_0x1126('0x39')](_0x5746f6[_0x1126('0x38')]);_0x2939a9[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x2939a9[_0x1126('0x37')],_0x2939a9['query']);_0x3ea9de['attributes']=_['intersection'](_0x2939a9[_0x1126('0x37')],qs['fields'](_0x5746f6[_0x1126('0x38')][_0x1126('0x3c')]));_0x3ea9de[_0x1126('0x3d')]=_0x3ea9de[_0x1126('0x3d')]['length']?_0x3ea9de['attributes']:_0x2939a9[_0x1126('0x37')];if(!_0x5746f6[_0x1126('0x38')][_0x1126('0x3e')]('nolimit')){_0x3ea9de[_0x1126('0x17')]=qs['limit'](_0x5746f6[_0x1126('0x38')]['limit']);_0x3ea9de[_0x1126('0x19')]=qs[_0x1126('0x19')](_0x5746f6[_0x1126('0x38')]['offset']);}_0x3ea9de[_0x1126('0x3f')]=qs[_0x1126('0x40')](_0x5746f6[_0x1126('0x38')]['sort']);_0x3ea9de['where']=qs['filters'](_[_0x1126('0x41')](_0x5746f6['query'],_0x2939a9[_0x1126('0x3a')]),_0x3469a2);var _0x507568=[];var _0x2f45b9=squel[_0x1126('0x42')]()[_0x1126('0x43')]('id')[_0x1126('0x43')](_0x1126('0x1e'))['field'](_0x1126('0x44'))[_0x1126('0x45')]('tools_tags');var _0x1a15f8=squel[_0x1126('0x42')]()['field'](_0x1126('0x46'))[_0x1126('0x43')]('u.fullname')[_0x1126('0x43')](_0x1126('0x47'))[_0x1126('0x45')]('user_has_mail_interactions','ui')[_0x1126('0x48')](_0x1126('0x49'),'u',_0x1126('0x4a'));var _0x5878bb=squel[_0x1126('0x42')]()[_0x1126('0x45')](_0x1126('0x4b'),'i')[_0x1126('0x48')]('cm_contacts','c',_0x1126('0x4c'))['left_join'](_0x1126('0x49'),'o',_0x1126('0x4d'))['left_join']('mail_accounts','a',_0x1126('0x4e'))[_0x1126('0x48')](_0x1126('0x4f'),'me','me.MailInteractionId\x20=\x20i.id')[_0x1126('0x48')](_0x1126('0x50'),'it',_0x1126('0x51'))[_0x1126('0x48')]('tools_tags','t',_0x1126('0x52'));var _0x46551f=squel['expr']();var _0x4bcc08=[];var _0x4abb4d=squel['expr']();var _0x386c10;if(_0x5746f6[_0x1126('0x38')]['search']){_0x386c10=as[_0x1126('0x53')](_0x5746f6[_0x1126('0x38')][_0x1126('0x54')]);var _0x38f521=_0x386c10[_0x1126('0x55')];for(var _0x4e4d49=0x0;_0x4e4d49<_0x386c10[_0x1126('0x56')][_0x1126('0x57')];_0x4e4d49++){var _0x5d6414=_0x386c10[_0x1126('0x56')][_0x4e4d49];var _0x476aca='i';var _0xcc9499=_[_0x1126('0x58')](_0x3469a2,[_0x1126('0x1e'),_0x5d6414['field']]);if(!_0xcc9499){switch(_0x5d6414[_0x1126('0x43')]){case'unreadMessages':if(_0x5d6414[_0x1126('0x59')]==0x1){_0x5878bb[_0x1126('0x5a')]('`'+_0x5d6414[_0x1126('0x43')]+'`\x20=\x200');}else{_0x5878bb[_0x1126('0x5a')]('`'+_0x5d6414[_0x1126('0x43')]+'`\x20>\x200');}break;case _0x1126('0x5b'):if(_0x5d6414[_0x1126('0x5c')]===_0x1126('0x5d')){if(_0x5d6414['value'][_0x1126('0x5e')]('\x20')[_0x1126('0x57')]>0x1){_0x46551f[_0x38f521](_0x1126('0x5f'),qs[_0x1126('0x60')](_0x5d6414[_0x1126('0x59')]),null);}else{var _0x26949c='%'+_0x5d6414[_0x1126('0x59')]+'%';_0x46551f[_0x38f521](_0x1126('0x61'),_0x26949c,_0x26949c,_0x26949c);}}else{_0xcc9499=_['find'](_0x3469a2,[_0x1126('0x1e'),_0x1126('0x62')]);_0x5d6414[_0x1126('0x43')]=_0x1126('0x62');_0x3440c5=as[_0x1126('0x63')](_0x476aca,_0xcc9499['type'],_0x5d6414);_0x46551f[_0x38f521](_0x3440c5[_0x1126('0x64')],_0x3440c5[_0x1126('0x59')]['start'],_0x3440c5[_0x1126('0x59')]['end']);}break;case _0x1126('0x65'):var _0x10ff91=_0x5d6414['value'][_0x1126('0x5e')](',')[_0x1126('0x20')](function(_0x375b76){return Number(_0x375b76);});_0x10ff91['forEach'](function(_0x13394f){_0x4abb4d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13394f+',%');});_0x4bcc08=_['union'](_0x4bcc08,_0x10ff91);break;case _0x1126('0x66'):if(_0x5d6414[_0x1126('0x5c')]===_0x1126('0x5d')){_0x46551f[_0x38f521](_0x1126('0x67'),'%'+_0x5d6414[_0x1126('0x59')]+'%',null);}else{_0xcc9499=_[_0x1126('0x58')](_0x3469a2,[_0x1126('0x1e'),'UserId']);_0x5d6414[_0x1126('0x43')]=_0x1126('0x2f');_0x3440c5=as[_0x1126('0x63')](_0x476aca,_0xcc9499[_0x1126('0x35')],_0x5d6414);_0x46551f[_0x38f521](_0x3440c5[_0x1126('0x64')],_0x3440c5[_0x1126('0x59')]['start'],_0x3440c5['value'][_0x1126('0x13')]);}break;case _0x1126('0x68'):_0x3440c5=as['buildExpression']('me',null,_0x5d6414);_0x46551f[_0x38f521](_0x3440c5['text'],_0x3440c5['value']['start'],_0x3440c5[_0x1126('0x59')][_0x1126('0x13')]);break;}}else{var _0x3440c5=as['buildExpression'](_0x476aca,_0xcc9499[_0x1126('0x35')],_0x5d6414);_0x46551f[_0x38f521](_0x3440c5[_0x1126('0x64')],_0x3440c5[_0x1126('0x59')][_0x1126('0x69')],_0x3440c5[_0x1126('0x59')][_0x1126('0x13')]);}}}else{var _0x131056=_(_0x5746f6['query'])[_0x1126('0x39')]()[_0x1126('0x20')](function(_0x43bd70){return _[_0x1126('0x6a')](_0x3469a2,[_0x1126('0x1e'),_0x43bd70])?_0x43bd70:undefined;})['compact']()['value']();if(!_[_0x1126('0x6b')](_0x131056)){_0x131056[_0x1126('0x24')](function(_0x4f1b61){if(_0x4f1b61===_0x1126('0x6c')){_0x5878bb[_0x1126('0x6d')](_0x1126('0x6e'),[][_0x1126('0x6f')](_0x5746f6[_0x1126('0x38')][_0x4f1b61]));}else if(_0x4f1b61===_0x1126('0x70')){var _0x41ce78=JSON[_0x1126('0x71')](_0x5746f6[_0x1126('0x38')][_0x4f1b61])[_0x1126('0x72')];var _0x16e48a=JSON[_0x1126('0x71')](_0x5746f6[_0x1126('0x38')][_0x4f1b61])['$lte'];_0x5878bb[_0x1126('0x6d')](_0x1126('0x73'),_0x41ce78,_0x16e48a);}else{if(_0x5746f6[_0x1126('0x38')][_0x4f1b61]==='null'){_0x5878bb['where']('i.'+_0x4f1b61+_0x1126('0x74'));}else{_0x5878bb[_0x1126('0x6d')]('i.'+_0x4f1b61+_0x1126('0x75'),_0x5746f6[_0x1126('0x38')][_0x4f1b61]);}}});}if(_0x5746f6['query']['read']){if(_0x5746f6['query'][_0x1126('0x76')]==0x1){_0x5878bb[_0x1126('0x5a')](_0x1126('0x77'));}else{_0x5878bb[_0x1126('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x5746f6[_0x1126('0x38')]['tag']){_0x4bcc08=_[_0x1126('0x78')](_0x5746f6[_0x1126('0x38')][_0x1126('0x79')])?_0x5746f6[_0x1126('0x38')][_0x1126('0x79')]:new Array(_0x5746f6[_0x1126('0x38')][_0x1126('0x79')]);_0x4bcc08['forEach'](function(_0xfd2d9){_0x4abb4d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xfd2d9+',%');});}if(_0x5746f6[_0x1126('0x38')][_0x1126('0x7a')]){var _0x4dd275=_0x5746f6[_0x1126('0x38')][_0x1126('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x1126('0x7b')](/'/g,'\x27\x27');if(qs[_0x1126('0x7c')](_0x4dd275)){_0x46551f['or']('i.id\x20LIKE\x20?',_0x4dd275+'%');}else if(qs['isEmail'](_0x4dd275)){_0x46551f['or'](_0x1126('0x7d'),_0x4dd275+'%');}else{_0x46551f['or'](_0x1126('0x7e'),qs[_0x1126('0x60')](_0x4dd275))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4dd275));}}}_0x5878bb['where'](_0x46551f);_0x5878bb[_0x1126('0x7f')]('i.id');var _0x4cfbed={'type':db[_0x1126('0x80')]['QueryTypes'][_0x1126('0x81')],'raw':!![]};var _0x288a0c=_0x5878bb['clone']();_0x288a0c[_0x1126('0x43')](_0x1126('0x82'));_0x288a0c[_0x1126('0x43')](_0x1126('0x83'),_0x1126('0x84'));if(_0x3ea9de['order']){_0x3ea9de[_0x1126('0x3f')][_0x1126('0x24')](function(_0x5679ec){var _0xd182b1=_0x5679ec[0x0]===_0x1126('0x85')?_0x5679ec[0x0]:'i.'+_0x5679ec[0x0];_0x5878bb[_0x1126('0x3f')](_0xd182b1,_0x5679ec[0x1]===_0x1126('0x86')?![]:!![]);});}if(!_[_0x1126('0x6b')](_0x4bcc08)){_0x5878bb[_0x1126('0x5a')](_0x4abb4d);_0x288a0c[_0x1126('0x6d')](_0x1126('0x87'),_0x4bcc08);}BPromise[_0x1126('0x88')]()[_0x1126('0x1c')](function(){if(!_0x386c10){if(_0x5746f6[_0x1126('0x38')][_0x1126('0x6c')])return;_0x288a0c[_0x1126('0x6d')](_0x1126('0x89'));_0x5878bb[_0x1126('0x6d')](_0x1126('0x89'));return;}if(_0x5746f6['user'][_0x1126('0x8a')]!==_0x1126('0x8b'))return;return _0x5746f6[_0x1126('0x8c')][_0x1126('0x8d')]({'attributes':['id'],'raw':!![]})[_0x1126('0x1c')](function(_0x4e4eb9){if(_[_0x1126('0x6b')](_0x4e4eb9)){_0x288a0c['where']('i.MailAccountId\x20IS\x20NULL');_0x5878bb[_0x1126('0x6d')](_0x1126('0x8e'));}else{_0x288a0c['where']('i.MailAccountId\x20IN\x20?',_[_0x1126('0x20')](_0x4e4eb9,'id'));_0x5878bb[_0x1126('0x6d')](_0x1126('0x6e'),_[_0x1126('0x20')](_0x4e4eb9,'id'));}});})[_0x1126('0x1c')](function(){if(_0x5746f6[_0x1126('0x8c')][_0x1126('0x8a')]===_0x1126('0x8b')&&!_0x386c10&&!_0x5746f6[_0x1126('0x38')]['MailAccountId'])return[];return db[_0x1126('0x8f')][_0x1126('0x38')](_0x288a0c[_0x1126('0x90')](),_0x4cfbed);})[_0x1126('0x1c')](function(_0x23c4ab){_0x397e3b[_0x1126('0x18')]=_0x23c4ab['length'];if(_0x397e3b[_0x1126('0x18')]===0x0)return[];return db[_0x1126('0x8f')][_0x1126('0x38')](_0x2f45b9[_0x1126('0x90')](),_0x4cfbed)[_0x1126('0x1c')](function(_0x1796eb){_0x507568=_[_0x1126('0x91')](_0x1796eb,'id');_0x4cfbed=_[_0x1126('0x92')](_0x4cfbed,{'model':db[_0x1126('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5746f6[_0x1126('0x38')]['fields']){_0x3ea9de['attributes'][_0x1126('0x24')](function(_0x55496f){_0x5878bb[_0x1126('0x43')]('i.'+_0x55496f);});}else{_0x5878bb['field'](_0x1126('0x83'),'unreadMessages');_0x5878bb[_0x1126('0x43')]('a.key','Account.key');_0x5878bb['field'](_0x1126('0x93'),_0x1126('0x94'));_0x5878bb['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x1126('0x85'));_0x5878bb[_0x1126('0x43')](_0x1126('0x82'));_0x5878bb['field']('i.createdAt');_0x5878bb[_0x1126('0x43')]('i.updatedAt');_0x5878bb[_0x1126('0x43')](_0x1126('0x95'));_0x5878bb[_0x1126('0x43')](_0x1126('0x96'));_0x5878bb[_0x1126('0x43')]('i.attach');_0x5878bb['field'](_0x1126('0x97'));_0x5878bb[_0x1126('0x43')](_0x1126('0x98'));_0x5878bb[_0x1126('0x43')](_0x1126('0x99'));_0x5878bb[_0x1126('0x43')](_0x1126('0x9a'));_0x5878bb[_0x1126('0x43')](_0x1126('0x9b'));_0x5878bb[_0x1126('0x43')](_0x1126('0x9c'));_0x5878bb['field'](_0x1126('0x9d'));_0x5878bb['field'](_0x1126('0x9e'));_0x5878bb['field'](_0x1126('0x9f'));_0x5878bb[_0x1126('0x43')](_0x1126('0xa0'));_0x5878bb[_0x1126('0x43')]('i.UserId');_0x5878bb[_0x1126('0x43')](_0x1126('0xa1'),'Contact.firstName');_0x5878bb['field'](_0x1126('0xa2'),_0x1126('0xa3'));_0x5878bb[_0x1126('0x43')]('c.email',_0x1126('0xa4'));_0x5878bb['field'](_0x1126('0xa5'),_0x1126('0xa6'));_0x5878bb['field'](_0x1126('0xa7'),_0x1126('0xa8'));_0x5878bb[_0x1126('0x43')](_0x1126('0xa9'),_0x1126('0xaa'));_0x5878bb['field'](_0x1126('0xab'),_0x1126('0xac'));_0x5878bb[_0x1126('0x43')]('o.internal','Owner.internal');_0x5878bb['field'](_0x1126('0xad'),_0x1126('0x23'));}if(_0x3ea9de[_0x1126('0x17')])_0x5878bb[_0x1126('0x17')](_0x3ea9de['limit']);if(_0x3ea9de[_0x1126('0x19')])_0x5878bb[_0x1126('0x19')](_0x3ea9de[_0x1126('0x19')]);return db[_0x1126('0x8f')][_0x1126('0x38')](_0x5878bb['toString'](),_0x4cfbed);})[_0x1126('0x1c')](function(_0x21c487){if(_0x21c487['length']>0x0)_0x1a15f8[_0x1126('0x6d')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x21c487,'id'));return db[_0x1126('0x8f')]['query'](_0x1a15f8[_0x1126('0x90')](),_0x4cfbed)[_0x1126('0x1c')](function(_0x40384b){var _0x318ef4=_[_0x1126('0xae')](_0x40384b,_0x1126('0xaf'));var _0x2540fd=[];return db[_0x1126('0xb0')][_0x1126('0xb1')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x1126('0x1c')](function(_0x3e2921){var _0x1cda9d=_0x3e2921[_0x1126('0xb2')];_0x21c487['forEach'](function(_0x2b3231){_0x2540fd[_0x1126('0x25')](updateMailInteraction(_0x2b3231,_0x507568,_0x318ef4,_0x1cda9d));});return BPromise[_0x1126('0xb3')](_0x2540fd);});});});})[_0x1126('0x1c')](function(_0x5c10a2){_0x397e3b['rows']=_0x5c10a2;return _0x397e3b;})['then'](respondWithFilteredResult(_0x1da59f,_0x3ea9de))[_0x1126('0x2a')](handleError(_0x1da59f,null));};exports['show']=function(_0x1ce036,_0x3e1627){var _0x4fb59c={'raw':![],'where':{'id':_0x1ce036[_0x1126('0xb4')]['id']}},_0x5ba6f2={};_0x5ba6f2[_0x1126('0x37')]=_['keys'](db[_0x1126('0x33')][_0x1126('0xb5')]);_0x5ba6f2['query']=_[_0x1126('0x39')](_0x1ce036['query']);_0x5ba6f2[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x5ba6f2[_0x1126('0x37')],_0x5ba6f2['query']);_0x4fb59c[_0x1126('0x3d')]=_[_0x1126('0x3b')](_0x5ba6f2[_0x1126('0x37')],qs[_0x1126('0x3c')](_0x1ce036[_0x1126('0x38')][_0x1126('0x3c')]));_0x4fb59c[_0x1126('0x3d')]=_0x4fb59c[_0x1126('0x3d')][_0x1126('0x57')]?_0x4fb59c[_0x1126('0x3d')]:_0x5ba6f2[_0x1126('0x37')];if(_0x1ce036[_0x1126('0x38')][_0x1126('0xb6')]){_0x4fb59c[_0x1126('0xb7')]=[{'all':!![]}];}_0x4fb59c=_[_0x1126('0x92')]({},_0x4fb59c,_0x1ce036[_0x1126('0xb8')]);return db[_0x1126('0x33')]['find'](_0x4fb59c)[_0x1126('0x1c')](handleEntityNotFound(_0x3e1627,null))[_0x1126('0x1c')](respondWithResult(_0x3e1627,null))['catch'](handleError(_0x3e1627,null));};exports['create']=function(_0xd6de57,_0x754d6a){return db[_0x1126('0x33')][_0x1126('0xb9')](_0xd6de57['body'],{})[_0x1126('0x1c')](respondWithResult(_0x754d6a,0xc9))[_0x1126('0x2a')](handleError(_0x754d6a,null));};exports['update']=function(_0x30d952,_0x53bb52){if(_0x30d952[_0x1126('0xba')]['id']){delete _0x30d952[_0x1126('0xba')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x30d952[_0x1126('0xb4')]['id']}})['then'](handleEntityNotFound(_0x53bb52,null))['then'](saveUpdates(_0x30d952[_0x1126('0xba')],null))[_0x1126('0x1c')](respondWithResult(_0x53bb52,null))[_0x1126('0x2a')](handleError(_0x53bb52,null));};exports[_0x1126('0xbb')]=function(_0x4f29ce,_0x4ef74b){return db['MailInteraction'][_0x1126('0x58')]({'where':{'id':_0x4f29ce[_0x1126('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4ef74b,null))[_0x1126('0x1c')](removeEntity(_0x4ef74b,null))[_0x1126('0x2a')](handleError(_0x4ef74b,null));};exports[_0x1126('0xbc')]=function(_0x2f049a,_0x17b25d){return db[_0x1126('0x33')][_0x1126('0xbc')]()[_0x1126('0x1c')](respondWithResult(_0x17b25d,null))[_0x1126('0x2a')](handleError(_0x17b25d,null));};exports[_0x1126('0xbd')]=function(_0x3a4a91,_0x55145f){return db[_0x1126('0x26')]['find']({'where':{'id':_0x3a4a91[_0x1126('0xb4')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x55145f,null))[_0x1126('0x1c')](function(_0x4c7dc7){if(_0x4c7dc7){return _0x4c7dc7[_0x1126('0xbd')](_0x3a4a91[_0x1126('0xba')][_0x1126('0xbe')],_['omit'](_0x3a4a91[_0x1126('0xba')],[_0x1126('0xbe'),'id'])||{});}})[_0x1126('0x1c')](respondWithResult(_0x55145f,null))[_0x1126('0x2a')](handleError(_0x55145f,null));};exports[_0x1126('0xbf')]=function(_0x589d0c,_0x520371){var _0x31d9e1={'raw':![],'where':{}};var _0x439e85={};var _0x3ad805={'count':0x0,'rows':[]};return db[_0x1126('0x33')][_0x1126('0xb1')]({'where':{'id':_0x589d0c[_0x1126('0xb4')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x520371,null))[_0x1126('0x1c')](function(_0x6500dc){if(_0x6500dc){_0x439e85[_0x1126('0x37')]=_[_0x1126('0x39')](db['MailMessage']['rawAttributes']);_0x439e85[_0x1126('0x38')]=_[_0x1126('0x39')](_0x589d0c[_0x1126('0x38')]);_0x439e85['filters']=_['intersection'](_0x439e85[_0x1126('0x37')],_0x439e85[_0x1126('0x38')]);_0x31d9e1[_0x1126('0x3d')]=_['intersection'](_0x439e85[_0x1126('0x37')],qs[_0x1126('0x3c')](_0x589d0c['query'][_0x1126('0x3c')]));_0x31d9e1[_0x1126('0x3d')]=_0x31d9e1[_0x1126('0x3d')][_0x1126('0x57')]?_0x31d9e1[_0x1126('0x3d')]:_0x439e85['model'];if(!_0x589d0c[_0x1126('0x38')][_0x1126('0x3e')]('nolimit')){_0x31d9e1['limit']=qs['limit'](_0x589d0c[_0x1126('0x38')][_0x1126('0x17')]);_0x31d9e1[_0x1126('0x19')]=qs[_0x1126('0x19')](_0x589d0c[_0x1126('0x38')]['offset']);}_0x31d9e1[_0x1126('0x3f')]=qs['sort'](_0x589d0c[_0x1126('0x38')][_0x1126('0x40')]);_0x31d9e1['where']=qs['filters'](_[_0x1126('0x41')](_0x589d0c[_0x1126('0x38')],_0x439e85['filters']));_0x31d9e1['where'][_0x1126('0xaf')]=_0x6500dc['id'];if(_0x589d0c[_0x1126('0x38')][_0x1126('0x7a')]){_0x31d9e1[_0x1126('0x6d')]=_[_0x1126('0x92')](_0x31d9e1[_0x1126('0x6d')],{'$or':_[_0x1126('0x20')](_0x31d9e1[_0x1126('0x3d')],function(_0xb1c408){var _0x1ce21e={};_0x1ce21e[_0xb1c408]={'$like':'%'+_0x589d0c['query']['filter']+'%'};return _0x1ce21e;})});}if(_0x589d0c[_0x1126('0x38')][_0x1126('0x72')]){var _0x1fa4ae=_0x589d0c[_0x1126('0x38')][_0x1126('0x72')][_0x1126('0x5e')](',');var _0x527694={};_0x527694[_0x1fa4ae[0x0]]={'$gte':moment(_0x1fa4ae[0x1])['format'](_0x1126('0xc0'))};_0x31d9e1['where']=_['merge'](_0x31d9e1[_0x1126('0x6d')],_0x527694);}_0x31d9e1=_[_0x1126('0x92')]({},_0x31d9e1,_0x589d0c['options']);return db[_0x1126('0x26')][_0x1126('0x18')]({'where':_0x31d9e1[_0x1126('0x6d')]})[_0x1126('0x1c')](function(_0x56b591){_0x3ad805[_0x1126('0x18')]=_0x56b591;if(_0x589d0c[_0x1126('0x38')][_0x1126('0xb6')]){_0x31d9e1[_0x1126('0xb7')]=[{'all':!![]}];}return db[_0x1126('0x26')][_0x1126('0xc1')](_0x31d9e1);})[_0x1126('0x1c')](function(_0x5725ed){if(_0x589d0c[_0x1126('0x38')][_0x1126('0xc2')]===_0x1126('0xc3')){for(var _0x257c3d=0x0;_0x257c3d<_0x5725ed['length'];_0x257c3d++){_0x5725ed[_0x257c3d][_0x1126('0xba')]=juice(_0x5725ed[_0x257c3d][_0x1126('0xba')]);}}_0x3ad805['rows']=_0x5725ed;return _0x3ad805;});}})[_0x1126('0x1c')](respondWithFilteredResult(_0x520371,_0x31d9e1))[_0x1126('0x2a')](handleError(_0x520371,null));};exports[_0x1126('0xc4')]=function(_0x57be05,_0xc59a80){return db[_0x1126('0x33')][_0x1126('0x58')]({'where':{'id':_0x57be05[_0x1126('0xb4')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0xc59a80,null))[_0x1126('0x1c')](function(_0x47f80a){if(_0x47f80a){return _0x47f80a[_0x1126('0xc5')](_0x57be05[_0x1126('0xba')]['ids'],_[_0x1126('0xc6')](_0x57be05[_0x1126('0xba')],[_0x1126('0xbe'),'id'])||{})[_0x1126('0xc7')](function(){return db[_0x1126('0x65')][_0x1126('0xc1')]({'attributes':['id','name','color'],'where':{'id':_0x57be05[_0x1126('0xba')][_0x1126('0xbe')]}});})[_0x1126('0x1c')](function(_0x12addc){socket[_0x1126('0xc8')](_0x1126('0xc9'),{'id':Number(_0x57be05[_0x1126('0xb4')]['id']),'tags':_0x12addc||[]});return{'id':Number(_0x57be05[_0x1126('0xb4')]['id']),'tags':_0x12addc||[]};});}})[_0x1126('0x1c')](respondWithResult(_0xc59a80,null))[_0x1126('0x2a')](handleError(_0xc59a80,null));};exports[_0x1126('0xca')]=function(_0xf6ef8,_0x13fdfd){return db[_0x1126('0x33')][_0x1126('0x58')]({'where':{'id':_0xf6ef8[_0x1126('0xb4')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x13fdfd,null))[_0x1126('0x1c')](function(_0x176730){if(_0x176730){return _0x176730[_0x1126('0xca')](_0xf6ef8[_0x1126('0x38')][_0x1126('0xbe')]);}})[_0x1126('0x1c')](respondWithStatusCode(_0x13fdfd,null))[_0x1126('0x2a')](handleError(_0x13fdfd,null));};exports[_0x1126('0xcb')]=function(_0x57e10b,_0x1445ca){var _0x593386=moment()[_0x1126('0xcc')]()[_0x1126('0x90')]();var _0x7d4af8=path['join'](config[_0x1126('0xcd')],'server',_0x1126('0xce'),_0x1126('0xcf'));var _0x5cb928=path[_0x1126('0xd0')](config[_0x1126('0xcd')],_0x1126('0xd1'),_0x1126('0xce'),_0x1126('0xd2'));var _0x2ca17d=path[_0x1126('0xd0')](_0x7d4af8,_0x593386);var _0x19cde9=util[_0x1126('0xd3')]('transcript-%d-%s.zip',_0x57e10b[_0x1126('0xb4')]['id'],_0x593386);var _0x3b9781=path[_0x1126('0xd0')](_0x7d4af8,_0x19cde9);var _0x27d566=[];if(_0x57e10b['query']['attachments']){_0x27d566['push']({'model':db['Attachment'],'as':_0x1126('0xd4'),'raw':!![]});}var _0x4f62a1=[{'model':db[_0x1126('0x26')],'as':_0x1126('0xd5'),'attributes':['id',_0x1126('0xba'),_0x1126('0x45'),'to','cc',_0x1126('0xd6'),_0x1126('0xd7'),'createdAt'],'where':{'secret':![]},'order':qs[_0x1126('0x40')]('id'),'include':_0x27d566}];return db['MailInteraction'][_0x1126('0x58')]({'where':{'id':_0x57e10b[_0x1126('0xb4')]['id']},'include':_0x4f62a1})[_0x1126('0x1c')](handleEntityNotFound(_0x1445ca,null))[_0x1126('0x1c')](function(_0xb8e569){if(_0xb8e569&&_0xb8e569[_0x1126('0xd5')]){var _0x331632=_0xb8e569[_0x1126('0xd8')]({'plain':!![]});fs[_0x1126('0xd9')](_0x2ca17d);return BPromise[_0x1126('0xda')](_0x331632[_0x1126('0xd5')],function(_0x5ca18d,_0x40536a){var _0x14e718={'from':_0x5ca18d[_0x1126('0x45')],'to':_0x5ca18d['to'],'subject':_0x5ca18d[_0x1126('0xd7')],'html':htmlEntities[_0x1126('0xdb')](_0x5ca18d[_0x1126('0xba')]),'headers':{'Date':moment(_0x5ca18d[_0x1126('0x70')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5ca18d['cc']){_0x14e718['headers']['Cc']=_0x5ca18d['cc'];}if(_0x5ca18d[_0x1126('0xd6')]){_0x14e718[_0x1126('0xdc')][_0x1126('0xdd')]=_0x5ca18d['bcc'];}return new BPromise(function(_0xc2e582,_0x2aaae9){if(_0x5ca18d['Attachments']){for(var _0x4e2150=0x0;_0x4e2150<_0x5ca18d[_0x1126('0xd4')][_0x1126('0x57')];_0x4e2150++){var _0x13b532=_0x5ca18d[_0x1126('0xd4')][_0x4e2150];var _0x18b3db=path[_0x1126('0xd0')](_0x5cb928,_0x13b532['basename']);if(fs[_0x1126('0xde')](_0x18b3db)){_0x14e718[_0x1126('0xd2')][_0x1126('0x25')]({'name':_0x13b532[_0x1126('0x1e')],'contentType':_0x13b532[_0x1126('0x35')],'data':fs[_0x1126('0xdf')](_0x18b3db)});}}}emlformat[_0x1126('0xe0')](_0x14e718,function(_0x3565fe,_0x482dde){if(_0x3565fe)return _0x2aaae9(_0x3565fe);fs[_0x1126('0xe1')](path[_0x1126('0xd0')](_0x2ca17d,util['format'](_0x1126('0xe2'),_0x40536a)),_0x482dde);return _0xc2e582(_0x482dde);});});})[_0x1126('0x1c')](function(){return new BPromise(function(_0x527e69,_0x3af3df){zipdir(_0x2ca17d,{'saveTo':_0x3b9781},function(_0x41d5de,_0x3939ec){if(_0x41d5de)return _0x3af3df(_0x41d5de);return _0x527e69(_0x3939ec);});})['then'](function(){return new BPromise(function(_0x6f6c0,_0x2e472d){rimraf(_0x2ca17d,function(_0xfb954d){if(_0xfb954d)_0x2e472d(_0xfb954d);return _0x6f6c0();});});})[_0x1126('0x1c')](function(){return _0x1445ca[_0x1126('0xcb')](_0x3b9781,_0x19cde9,function(_0x298480){if(!_0x298480)fs[_0x1126('0xe3')](_0x3b9781);});});});}else{return _0x1445ca[_0x1126('0x12')](0xc8);}})[_0x1126('0x2a')](handleError(_0x1445ca,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2e7a937..750722b 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 _0x86b9=['emit','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','then','Users','map','findAll','setDataValue','length'];(function(_0x228636,_0x51d570){var _0x327b9e=function(_0x38b239){while(--_0x38b239){_0x228636['push'](_0x228636['shift']());}};_0x327b9e(++_0x51d570);}(_0x86b9,0x93));var _0x986b=function(_0x19600d,_0x2a701f){_0x19600d=_0x19600d-0x0;var _0x2ce9ea=_0x86b9[_0x19600d];return _0x2ce9ea;};'use strict';var EventEmitter=require(_0x986b('0x0'));var MailInteraction=require(_0x986b('0x1'))['db'][_0x986b('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x986b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x986b('0x4'),'afterDestroy':_0x986b('0x5')};function emitEvent(_0x10e2b0){return function(_0x43d2d4,_0x41da00,_0x241519){_0x43d2d4[_0x986b('0x6')]({'attributes':['id'],'raw':!![]})[_0x986b('0x7')](function(_0x266190){_0x43d2d4['setDataValue'](_0x986b('0x8'),_0x266190[_0x986b('0x9')](function(_0x277386){return{'id':_0x277386['id']};}));return MailMessage[_0x986b('0xa')]({'where':{'MailInteractionId':_0x43d2d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x986b('0x7')](function(_0x4736ed){_0x43d2d4[_0x986b('0xb')]('unreadMessages',_0x4736ed[_0x986b('0xc')]);MailInteractionEvents['emit'](_0x10e2b0+':'+_0x43d2d4['id'],_0x43d2d4);MailInteractionEvents[_0x986b('0xd')](_0x10e2b0,_0x43d2d4);_0x241519(null);})[_0x986b('0xe')](_0x241519(null));};}for(var e in events){if(events[_0x986b('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x147b=['setDataValue','Users','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x147b,0x171));var _0xb147=function(_0x6dce5e,_0x1fcf30){_0x6dce5e=_0x6dce5e-0x0;var _0x380732=_0x147b[_0x6dce5e];return _0x380732;};'use strict';var EventEmitter=require(_0xb147('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xb147('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb147('0x2')](0x0);var events={'afterCreate':_0xb147('0x3'),'afterUpdate':'update','afterDestroy':_0xb147('0x4')};function emitEvent(_0x276455){return function(_0x58ab3b,_0x445557,_0x2289fd){_0x58ab3b[_0xb147('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x577a21){_0x58ab3b[_0xb147('0x6')](_0xb147('0x7'),_0x577a21['map'](function(_0x306b53){return{'id':_0x306b53['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x58ab3b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb147('0x8')](function(_0x3be34d){_0x58ab3b['setDataValue'](_0xb147('0x9'),_0x3be34d[_0xb147('0xa')]);MailInteractionEvents[_0xb147('0xb')](_0x276455+':'+_0x58ab3b['id'],_0x58ab3b);MailInteractionEvents[_0xb147('0xb')](_0x276455,_0x58ab3b);_0x2289fd(null);})[_0xb147('0xc')](_0x2289fd(null));};}for(var e in events){if(events[_0xb147('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xb147('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e12975d..6485167 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 _0x03a5=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatusAt','changed','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x03a5,0x12a));var _0x503a=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x03a5[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0x503a('0x0'));var util=require(_0x503a('0x1'));var logger=require('../../config/logger')(_0x503a('0x2'));var moment=require('moment');var BPromise=require(_0x503a('0x3'));var rp=require(_0x503a('0x4'));var fs=require('fs');var path=require(_0x503a('0x5'));var rimraf=require(_0x503a('0x6'));var config=require(_0x503a('0x7'));var attributes=require(_0x503a('0x8'));module[_0x503a('0x9')]=function(_0x82b5d7,_0x56cfa2){return _0x82b5d7[_0x503a('0xa')](_0x503a('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x503a('0xc'),'fields':[_0x503a('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e66f4,_0x534ac0,_0x15ab87){if(_0x1e66f4[_0x503a('0xe')]){_0x1e66f4['substatusAt']=moment()[_0x503a('0xf')](_0x503a('0x10'));}if(_0x1e66f4[_0x503a('0x11')]){_0x1e66f4[_0x503a('0x12')]=moment()['format'](_0x503a('0x10'));}_0x15ab87(null,_0x534ac0);},'beforeUpdate':function(_0xc0155f,_0x16528c,_0x555c7a){if(_0xc0155f['changed'](_0x503a('0xe'))){_0xc0155f[_0x503a('0x13')]=_0xc0155f[_0x503a('0xe')]?moment()[_0x503a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xc0155f[_0x503a('0x14')](_0x503a('0x11'))){_0xc0155f[_0x503a('0x12')]=moment()[_0x503a('0xf')](_0x503a('0x10'));_0xc0155f['substatus']=null;_0xc0155f[_0x503a('0x13')]=null;}_0x555c7a(null,_0xc0155f);},'afterUpdate':function(_0x189aeb,_0x3fe638,_0x2f6670){var _0x2c4d9a=_0x82b5d7['models'];var _0x4478fd=_0x189aeb['get']({'plain':!![]});if(_0x4478fd['closed']){return _0x2c4d9a[_0x503a('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x4478fd['id']}})[_0x503a('0x16')](function(){_0x2f6670();})[_0x503a('0x17')](function(_0x1da99a){_0x2f6670(_0x1da99a);});}else{_0x2f6670();}}},'charset':'utf8mb4','collate':_0x503a('0x18')});}; \ No newline at end of file +var _0x1015=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1015,0x96));var _0x5101=function(_0x4955c7,_0x481c87){_0x4955c7=_0x4955c7-0x0;var _0x2c6403=_0x1015[_0x4955c7];return _0x2c6403;};'use strict';var _=require(_0x5101('0x0'));var util=require(_0x5101('0x1'));var logger=require(_0x5101('0x2'))(_0x5101('0x3'));var moment=require(_0x5101('0x4'));var BPromise=require(_0x5101('0x5'));var rp=require(_0x5101('0x6'));var fs=require('fs');var path=require(_0x5101('0x7'));var rimraf=require(_0x5101('0x8'));var config=require(_0x5101('0x9'));var attributes=require(_0x5101('0xa'));module[_0x5101('0xb')]=function(_0x29a3d4,_0x10cedd){return _0x29a3d4['define'](_0x5101('0xc'),attributes,{'tableName':_0x5101('0xd'),'paranoid':![],'indexes':[{'name':_0x5101('0xe'),'fields':[_0x5101('0xf'),'to'],'type':_0x5101('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b0fa8,_0x455f4b,_0x54eafb){if(_0x5b0fa8[_0x5101('0x11')]){_0x5b0fa8[_0x5101('0x12')]=moment()['format'](_0x5101('0x13'));}if(_0x5b0fa8[_0x5101('0x14')]){_0x5b0fa8[_0x5101('0x15')]=moment()[_0x5101('0x16')](_0x5101('0x13'));}_0x54eafb(null,_0x455f4b);},'beforeUpdate':function(_0x371348,_0x5edae8,_0x450b70){if(_0x371348[_0x5101('0x17')](_0x5101('0x11'))){_0x371348[_0x5101('0x12')]=_0x371348[_0x5101('0x11')]?moment()[_0x5101('0x16')](_0x5101('0x13')):null;}if(_0x371348['changed']('closed')){_0x371348[_0x5101('0x15')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x371348['substatus']=null;_0x371348[_0x5101('0x12')]=null;}_0x450b70(null,_0x371348);},'afterUpdate':function(_0x56cfdc,_0x274efa,_0xe8ebac){var _0x368e33=_0x29a3d4[_0x5101('0x18')];var _0x2d1188=_0x56cfdc['get']({'plain':!![]});if(_0x2d1188['closed']){return _0x368e33['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x2d1188['id']}})['then'](function(){_0xe8ebac();})[_0x5101('0x19')](function(_0x5ea4de){_0xe8ebac(_0x5ea4de);});}else{_0xe8ebac();}}},'charset':_0x5101('0x1a'),'collate':_0x5101('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9dccf0b..9e65a39 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 _0x6a52=['MailInteraction,\x20%s,\x20%s','info','result','catch','UpdateMailInteraction','MailInteraction','options','attributes','AddTagsToMailInteraction','where','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x6a52,0x189));var _0x26a5=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x6a52[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x26a5('0x0'));var util=require(_0x26a5('0x1'));var moment=require(_0x26a5('0x2'));var BPromise=require(_0x26a5('0x3'));var rs=require(_0x26a5('0x4'));var fs=require('fs');var Redis=require(_0x26a5('0x5'));var db=require(_0x26a5('0x6'))['db'];var utils=require(_0x26a5('0x7'));var logger=require(_0x26a5('0x8'))(_0x26a5('0x9'));var config=require('../../config/environment');var jayson=require(_0x26a5('0xa'));var client=jayson[_0x26a5('0xb')][_0x26a5('0xc')]({'port':0x232a});config[_0x26a5('0xd')]=_[_0x26a5('0xe')](config['redis'],{'host':_0x26a5('0xf'),'port':0x18eb});var socket=require(_0x26a5('0x10'))(new Redis(config[_0x26a5('0xd')]));require('./mailInteraction.socket')[_0x26a5('0x11')](socket);function respondWithRpcPromise(_0xd52fa9,_0x52cd47,_0x527f51){return new BPromise(function(_0x13f14d,_0x4aab48){return client[_0x26a5('0x12')](_0xd52fa9,_0x527f51)[_0x26a5('0x13')](function(_0x23fcbb){logger['info']('MailInteraction,\x20%s,\x20%s',_0x52cd47,_0x26a5('0x14'));logger[_0x26a5('0x15')](_0x26a5('0x16'),_0x52cd47,_0x26a5('0x14'),JSON[_0x26a5('0x17')](_0x23fcbb));if(_0x23fcbb['error']){if(_0x23fcbb[_0x26a5('0x18')][_0x26a5('0x19')]===0x1f4){logger[_0x26a5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x52cd47,_0x23fcbb['error'][_0x26a5('0x1a')]);return _0x4aab48(_0x23fcbb['error'][_0x26a5('0x1a')]);}logger[_0x26a5('0x18')](_0x26a5('0x1b'),_0x52cd47,_0x23fcbb[_0x26a5('0x18')][_0x26a5('0x1a')]);return _0x13f14d(_0x23fcbb[_0x26a5('0x18')][_0x26a5('0x1a')]);}else{logger[_0x26a5('0x1c')](_0x26a5('0x1b'),_0x52cd47,_0x26a5('0x14'));_0x13f14d(_0x23fcbb[_0x26a5('0x1d')][_0x26a5('0x1a')]);}})[_0x26a5('0x1e')](function(_0x28b9ee){logger['error'](_0x26a5('0x1b'),_0x52cd47,_0x28b9ee);_0x4aab48(_0x28b9ee);});});}exports[_0x26a5('0x1f')]=function(_0x59912f){var _0x160012=this;return new Promise(function(_0x78a972,_0x25b585){return db[_0x26a5('0x20')]['update'](_0x59912f['body'],{'raw':_0x59912f[_0x26a5('0x21')]?_0x59912f[_0x26a5('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59912f['options']?_0x59912f[_0x26a5('0x21')]['where']||null:null,'attributes':_0x59912f[_0x26a5('0x21')]?_0x59912f[_0x26a5('0x21')][_0x26a5('0x22')]||null:null,'limit':_0x59912f[_0x26a5('0x21')]?_0x59912f[_0x26a5('0x21')]['limit']||null:null})[_0x26a5('0x13')](function(_0x5220bd){logger[_0x26a5('0x1c')](_0x26a5('0x1f'),_0x59912f);logger[_0x26a5('0x15')](_0x26a5('0x1f'),_0x59912f,JSON[_0x26a5('0x17')](_0x5220bd));_0x78a972(_0x5220bd);})[_0x26a5('0x1e')](function(_0x1d2a27){logger[_0x26a5('0x18')](_0x26a5('0x1f'),_0x1d2a27['message'],_0x59912f);_0x25b585(_0x160012[_0x26a5('0x18')](0x1f4,_0x1d2a27['message']));});});};exports[_0x26a5('0x23')]=function(_0x490431){return new Promise(function(_0x3d5aaa,_0x165654){return db[_0x26a5('0x20')]['find']({'where':_0x490431['options']?_0x490431[_0x26a5('0x21')][_0x26a5('0x24')]||null:null})[_0x26a5('0x13')](function(_0x1d6dc7){if(_0x1d6dc7){return _0x1d6dc7['addTags'](_0x490431[_0x26a5('0x25')]['ids'],_[_0x26a5('0x26')](_0x490431[_0x26a5('0x25')],[_0x26a5('0x27'),'id'])||{});}})[_0x26a5('0x28')](function(_0x4dab80){logger[_0x26a5('0x1c')]('AddTags',_0x490431);logger[_0x26a5('0x15')](_0x26a5('0x29'),_0x490431,JSON['stringify'](_0x4dab80));_0x3d5aaa(_0x4dab80);})['catch'](function(_0x46f6c7){logger[_0x26a5('0x18')](_0x26a5('0x29'),_0x46f6c7[_0x26a5('0x1a')],_0x490431);_0x165654(_this['error'](0x1f4,_0x46f6c7['message']));});});}; \ No newline at end of file +var _0x67d1=['AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToMailInteraction','MailInteraction','omit','ids','spread'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x67d1,0xf1));var _0x167d=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x67d1[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x167d('0x0'));var moment=require(_0x167d('0x1'));var BPromise=require('bluebird');var rs=require(_0x167d('0x2'));var fs=require('fs');var Redis=require(_0x167d('0x3'));var db=require(_0x167d('0x4'))['db'];var utils=require(_0x167d('0x5'));var logger=require('../../config/logger')(_0x167d('0x6'));var config=require(_0x167d('0x7'));var jayson=require(_0x167d('0x8'));var client=jayson[_0x167d('0x9')]['http']({'port':0x232a});config[_0x167d('0xa')]=_['defaults'](config['redis'],{'host':_0x167d('0xb'),'port':0x18eb});var socket=require(_0x167d('0xc'))(new Redis(config[_0x167d('0xa')]));require(_0x167d('0xd'))[_0x167d('0xe')](socket);function respondWithRpcPromise(_0x43f58f,_0x3bcaab,_0x5904cb){return new BPromise(function(_0x326877,_0x238f44){return client[_0x167d('0xf')](_0x43f58f,_0x5904cb)[_0x167d('0x10')](function(_0x3f0609){logger[_0x167d('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3bcaab,_0x167d('0x12'));logger['debug'](_0x167d('0x13'),_0x3bcaab,_0x167d('0x12'),JSON['stringify'](_0x3f0609));if(_0x3f0609[_0x167d('0x14')]){if(_0x3f0609[_0x167d('0x14')][_0x167d('0x15')]===0x1f4){logger[_0x167d('0x14')](_0x167d('0x16'),_0x3bcaab,_0x3f0609['error']['message']);return _0x238f44(_0x3f0609[_0x167d('0x14')][_0x167d('0x17')]);}logger[_0x167d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x3bcaab,_0x3f0609[_0x167d('0x14')]['message']);return _0x326877(_0x3f0609[_0x167d('0x14')]['message']);}else{logger[_0x167d('0x11')](_0x167d('0x16'),_0x3bcaab,_0x167d('0x12'));_0x326877(_0x3f0609['result'][_0x167d('0x17')]);}})[_0x167d('0x18')](function(_0xdbc186){logger['error'](_0x167d('0x16'),_0x3bcaab,_0xdbc186);_0x238f44(_0xdbc186);});});}exports[_0x167d('0x19')]=function(_0x19dcbb){var _0x20bb90=this;return new Promise(function(_0x2711b2,_0x2b2794){return db['MailInteraction']['update'](_0x19dcbb[_0x167d('0x1a')],{'raw':_0x19dcbb['options']?_0x19dcbb[_0x167d('0x1b')][_0x167d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19dcbb['options']?_0x19dcbb['options'][_0x167d('0x1d')]||null:null,'attributes':_0x19dcbb[_0x167d('0x1b')]?_0x19dcbb[_0x167d('0x1b')][_0x167d('0x1e')]||null:null,'limit':_0x19dcbb['options']?_0x19dcbb[_0x167d('0x1b')][_0x167d('0x1f')]||null:null})[_0x167d('0x10')](function(_0x1e645f){logger['info'](_0x167d('0x19'),_0x19dcbb);logger[_0x167d('0x20')](_0x167d('0x19'),_0x19dcbb,JSON[_0x167d('0x21')](_0x1e645f));_0x2711b2(_0x1e645f);})[_0x167d('0x18')](function(_0x4f09ab){logger[_0x167d('0x14')]('UpdateMailInteraction',_0x4f09ab[_0x167d('0x17')],_0x19dcbb);_0x2b2794(_0x20bb90[_0x167d('0x14')](0x1f4,_0x4f09ab[_0x167d('0x17')]));});});};exports[_0x167d('0x22')]=function(_0x44582e){return new Promise(function(_0x40fda9,_0x581fea){return db[_0x167d('0x23')]['find']({'where':_0x44582e[_0x167d('0x1b')]?_0x44582e[_0x167d('0x1b')]['where']||null:null})[_0x167d('0x10')](function(_0x2bcde0){if(_0x2bcde0){return _0x2bcde0['addTags'](_0x44582e[_0x167d('0x1a')]['ids'],_[_0x167d('0x24')](_0x44582e[_0x167d('0x1a')],[_0x167d('0x25'),'id'])||{});}})[_0x167d('0x26')](function(_0x5abbe2){logger['info'](_0x167d('0x27'),_0x44582e);logger[_0x167d('0x20')](_0x167d('0x27'),_0x44582e,JSON[_0x167d('0x21')](_0x5abbe2));_0x40fda9(_0x5abbe2);})['catch'](function(_0x5d08b0){logger['error'](_0x167d('0x27'),_0x5d08b0[_0x167d('0x17')],_0x44582e);_0x581fea(_this['error'](0x1f4,_0x5d08b0[_0x167d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ec44547..82d1a34 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 _0x7ad4=['removeListener','register','length','./mailInteraction.events','save','remove','update'];(function(_0x290358,_0x38c9b8){var _0x10641c=function(_0x5ac7a9){while(--_0x5ac7a9){_0x290358['push'](_0x290358['shift']());}};_0x10641c(++_0x38c9b8);}(_0x7ad4,0xab));var _0x47ad=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7ad4[_0x501510];return _0x1e6ee5;};'use strict';var MailInteractionEvents=require(_0x47ad('0x0'));var events=[_0x47ad('0x1'),_0x47ad('0x2'),_0x47ad('0x3')];function createListener(_0x587139,_0x3a906d){return function(_0xc004ca){_0x3a906d['emit'](_0x587139,_0xc004ca);};}function removeListener(_0x244845,_0x39624b){return function(){MailInteractionEvents[_0x47ad('0x4')](_0x244845,_0x39624b);};}exports[_0x47ad('0x5')]=function(_0x2593d2){for(var _0x30e58c=0x0,_0x4d83bd=events[_0x47ad('0x6')];_0x30e58c<_0x4d83bd;_0x30e58c++){var _0x14bd04=events[_0x30e58c];var _0x2c912e=createListener('mailInteraction:'+_0x14bd04,_0x2593d2);MailInteractionEvents['on'](_0x14bd04,_0x2c912e);}}; \ No newline at end of file +var _0x6f5f=['register','mailInteraction:','./mailInteraction.events','remove','update','removeListener'];(function(_0x113114,_0x5ebe2c){var _0x1250f4=function(_0x35ce71){while(--_0x35ce71){_0x113114['push'](_0x113114['shift']());}};_0x1250f4(++_0x5ebe2c);}(_0x6f5f,0x10a));var _0xf6f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f5f[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xf6f5('0x0'));var events=['save',_0xf6f5('0x1'),_0xf6f5('0x2')];function createListener(_0x2dad2e,_0x1089ec){return function(_0x4aae46){_0x1089ec['emit'](_0x2dad2e,_0x4aae46);};}function removeListener(_0x3d1609,_0x352c90){return function(){MailInteractionEvents[_0xf6f5('0x3')](_0x3d1609,_0x352c90);};}exports[_0xf6f5('0x4')]=function(_0x175ee4){for(var _0x2e92cf=0x0,_0x291d0d=events['length'];_0x2e92cf<_0x291d0d;_0x2e92cf++){var _0x3da01b=events[_0x2e92cf];var _0x513b97=createListener(_0xf6f5('0x5')+_0x3da01b,_0x175ee4);MailInteractionEvents['on'](_0x3da01b,_0x513b97);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3a5b6f1..53b2c88 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 _0xddb8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','index','get','describe','/:id','show','/:id/download','isAuthenticated','download','tracked','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','util'];(function(_0x5a9c69,_0x49d9a3){var _0x333195=function(_0x357fbe){while(--_0x357fbe){_0x5a9c69['push'](_0x5a9c69['shift']());}};_0x333195(++_0x49d9a3);}(_0xddb8,0xd7));var _0x8ddb=function(_0x4e9382,_0x20ed49){_0x4e9382=_0x4e9382-0x0;var _0x88d9e5=_0xddb8[_0x4e9382];return _0x88d9e5;};'use strict';var multer=require('multer');var util=require(_0x8ddb('0x0'));var path=require(_0x8ddb('0x1'));var timeout=require(_0x8ddb('0x2'));var express=require('express');var router=express[_0x8ddb('0x3')]();var fs_extra=require(_0x8ddb('0x4'));var auth=require(_0x8ddb('0x5'));var interaction=require(_0x8ddb('0x6'));var config=require(_0x8ddb('0x7'));var controller=require(_0x8ddb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ddb('0x9')]);router[_0x8ddb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8ddb('0xb')]);router[_0x8ddb('0xa')](_0x8ddb('0xc'),auth['isAuthenticated'](),controller[_0x8ddb('0xd')]);router[_0x8ddb('0xa')](_0x8ddb('0xe'),auth[_0x8ddb('0xf')](),controller[_0x8ddb('0x10')]);router['post']('/',auth[_0x8ddb('0xf')](),interaction[_0x8ddb('0x11')]('mail',_0x8ddb('0x12')),controller[_0x8ddb('0x13')]);router[_0x8ddb('0x14')](_0x8ddb('0xc'),auth[_0x8ddb('0xf')](),controller[_0x8ddb('0x15')]);router[_0x8ddb('0x14')](_0x8ddb('0x16'),auth[_0x8ddb('0xf')](),controller['accept']);router[_0x8ddb('0x14')](_0x8ddb('0x17'),auth[_0x8ddb('0xf')](),controller[_0x8ddb('0x18')]);router[_0x8ddb('0x19')](_0x8ddb('0xc'),auth[_0x8ddb('0xf')](),controller[_0x8ddb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0194=['describe','/:id','show','/:id/download','post','tracked','create','put','update','/:id/reject','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x3db750,_0x5d66c2){var _0x5427a=function(_0x41fdb8){while(--_0x41fdb8){_0x3db750['push'](_0x3db750['shift']());}};_0x5427a(++_0x5d66c2);}(_0x0194,0xf1));var _0x4019=function(_0x6603fd,_0x41eaad){_0x6603fd=_0x6603fd-0x0;var _0x95482=_0x0194[_0x6603fd];return _0x95482;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4019('0x0'));var timeout=require(_0x4019('0x1'));var express=require(_0x4019('0x2'));var router=express['Router']();var fs_extra=require(_0x4019('0x3'));var auth=require(_0x4019('0x4'));var interaction=require(_0x4019('0x5'));var config=require(_0x4019('0x6'));var controller=require(_0x4019('0x7'));router['get']('/',auth[_0x4019('0x8')](),controller[_0x4019('0x9')]);router[_0x4019('0xa')](_0x4019('0xb'),auth['isAuthenticated'](),controller[_0x4019('0xc')]);router[_0x4019('0xa')](_0x4019('0xd'),auth[_0x4019('0x8')](),controller[_0x4019('0xe')]);router[_0x4019('0xa')](_0x4019('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4019('0x10')]('/',auth[_0x4019('0x8')](),interaction[_0x4019('0x11')]('mail','mailmessage:create'),controller[_0x4019('0x12')]);router[_0x4019('0x13')](_0x4019('0xd'),auth['isAuthenticated'](),controller[_0x4019('0x14')]);router[_0x4019('0x13')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x4019('0x13')](_0x4019('0x15'),auth[_0x4019('0x8')](),controller['reject']);router[_0x4019('0x16')]('/:id',auth[_0x4019('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 46d0004..4178f1b 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 _0xd9fa=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','lodash','exports','long','TEXT'];(function(_0x210a47,_0x4cccf6){var _0x5d6465=function(_0x2a7c94){while(--_0x2a7c94){_0x210a47['push'](_0x210a47['shift']());}};_0x5d6465(++_0x4cccf6);}(_0xd9fa,0xa0));var _0xad9f=function(_0x5af3fa,_0x179d2a){_0x5af3fa=_0x5af3fa-0x0;var _0x2d424d=_0xd9fa[_0x5af3fa];return _0x2d424d;};'use strict';var Sequelize=require(_0xad9f('0x0'));var _=require(_0xad9f('0x1'));module[_0xad9f('0x2')]={'body':{'type':Sequelize['TEXT'](_0xad9f('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xad9f('0x4')](_0xad9f('0x5'))},'read':{'type':Sequelize[_0xad9f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xad9f('0x7')]('in',_0xad9f('0x8')),'defaultValue':_0xad9f('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xad9f('0x9')](0x1fe)},'from':{'type':Sequelize[_0xad9f('0x9')]},'to':{'type':Sequelize[_0xad9f('0x4')](_0xad9f('0x3'))},'cc':{'type':Sequelize[_0xad9f('0x4')](_0xad9f('0x3'))},'bcc':{'type':Sequelize[_0xad9f('0x4')](_0xad9f('0x3'))},'subject':{'type':Sequelize[_0xad9f('0x4')]},'sentAt':{'type':Sequelize[_0xad9f('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xad9f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xad9f('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xad9f('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xad9f('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email','Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x6b74=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','BOOLEAN','ENUM','out','STRING','long'];(function(_0xe03005,_0x42d11e){var _0x11d854=function(_0x191e16){while(--_0x191e16){_0xe03005['push'](_0xe03005['shift']());}};_0x11d854(++_0x42d11e);}(_0x6b74,0x1d8));var _0x46b7=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x6b74[_0x4c7935];return _0x30651d;};'use strict';var Sequelize=require(_0x46b7('0x0'));var _=require(_0x46b7('0x1'));module[_0x46b7('0x2')]={'body':{'type':Sequelize[_0x46b7('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x46b7('0x3')]('medium')},'read':{'type':Sequelize[_0x46b7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x46b7('0x5')]('in',_0x46b7('0x6')),'defaultValue':_0x46b7('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x46b7('0x7')]},'to':{'type':Sequelize[_0x46b7('0x3')](_0x46b7('0x8'))},'cc':{'type':Sequelize['TEXT'](_0x46b7('0x8'))},'bcc':{'type':Sequelize[_0x46b7('0x3')](_0x46b7('0x8'))},'subject':{'type':Sequelize[_0x46b7('0x3')]},'sentAt':{'type':Sequelize[_0x46b7('0x9')]},'attach':{'type':Sequelize[_0x46b7('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x46b7('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x46b7('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x46b7('0x8'))},'originCc':{'type':Sequelize[_0x46b7('0x3')](_0x46b7('0x8'))},'originChannel':{'type':Sequelize[_0x46b7('0x5')](_0x46b7('0xb'),_0x46b7('0xc')),'defaultValue':_0x46b7('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index aca41a3..a305828 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 _0x2d20=['bcc','Bcc','basename','existsSync','push','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','offset','undefined','count','limit','set','Content-Range','json','update','then','end','sendStatus','name','map','MailMessage','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','List','Contacts','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','format','UserId','user','MailInteraction','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','rejectmessage','unix','server','files','tmp','message-%s.eml','from','Attachment','Attachments','subject','decode','headers'];(function(_0x347759,_0x2f4825){var _0x4c5c6d=function(_0x47d982){while(--_0x47d982){_0x347759['push'](_0x347759['shift']());}};_0x4c5c6d(++_0x2f4825);}(_0x2d20,0x148));var _0x02d2=function(_0x2d682c,_0x3f0efe){_0x2d682c=_0x2d682c-0x0;var _0x2d606d=_0x2d20[_0x2d682c];return _0x2d606d;};'use strict';var emlformat=require(_0x02d2('0x0'));var moment=require(_0x02d2('0x1'));var BPromise=require(_0x02d2('0x2'));var util=require('util');var path=require(_0x02d2('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x02d2('0x4'));var htmlToText=require('html-to-text');var qs=require(_0x02d2('0x5'));var logger=require(_0x02d2('0x6'))(_0x02d2('0x7'));var interaction_log=require(_0x02d2('0x6'))('mail-interactions');var config=require(_0x02d2('0x8'));var db=require(_0x02d2('0x9'))['db'];config[_0x02d2('0xa')]=_[_0x02d2('0xb')](config[_0x02d2('0xa')],{'host':_0x02d2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02d2('0xa')]));var htmlEntities=require(_0x02d2('0xd'));require('./mailMessage.socket')[_0x02d2('0xe')](socket);var jayson=require(_0x02d2('0xf'));var client=jayson[_0x02d2('0x10')]['http']({'port':0x232c});var client9003=jayson[_0x02d2('0x10')][_0x02d2('0x11')]({'port':0x232b});var client9002=jayson[_0x02d2('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33f736,_0xaa89d4,_0x4999db,_0x3873ce){return new BPromise(function(_0x4ed0a4,_0x18191e){var _0x311187=_0x3873ce||client;return _0x311187[_0x02d2('0x12')](_0x33f736,_0x4999db)['then'](function(_0x3cfbb){logger[_0x02d2('0x13')](_0x02d2('0x14'),_0xaa89d4,_0x02d2('0x15'));logger[_0x02d2('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xaa89d4,_0x02d2('0x15'),JSON[_0x02d2('0x17')](_0x3cfbb));if(_0x3cfbb['error']){if(_0x3cfbb[_0x02d2('0x18')][_0x02d2('0x19')]===0x1f4){logger['error'](_0x02d2('0x14'),_0xaa89d4,_0x3cfbb[_0x02d2('0x18')]['message']);return _0x18191e(_0x3cfbb[_0x02d2('0x18')][_0x02d2('0x1a')]);}logger[_0x02d2('0x18')]('MailMessage,\x20%s,\x20%s',_0xaa89d4,_0x3cfbb[_0x02d2('0x18')][_0x02d2('0x1a')]);return _0x4ed0a4(_0x3cfbb[_0x02d2('0x18')]['message']);}else{logger['info'](_0x02d2('0x14'),_0xaa89d4,'request\x20sent');_0x4ed0a4(_0x3cfbb[_0x02d2('0x1b')][_0x02d2('0x1a')]);}})['catch'](function(_0x13fb1c){logger[_0x02d2('0x18')](_0x02d2('0x14'),_0xaa89d4,_0x13fb1c);_0x18191e(_0x13fb1c);});});}function respondWithResult(_0x50504c,_0x5c7059){_0x5c7059=_0x5c7059||0xc8;return function(_0x45cbfd){if(_0x45cbfd){return _0x50504c[_0x02d2('0x1c')](_0x5c7059)['json'](_0x45cbfd);}};}function respondWithFilteredResult(_0x26727d,_0x34cc6b){return function(_0x4b9623){if(_0x4b9623){var _0x2421d2=typeof _0x34cc6b[_0x02d2('0x1d')]===_0x02d2('0x1e')&&typeof _0x34cc6b['limit']===_0x02d2('0x1e');var _0x3c19a0=_0x4b9623[_0x02d2('0x1f')];var _0x2c699a=_0x2421d2?0x0:_0x34cc6b[_0x02d2('0x1d')];var _0x38f2b5=_0x2421d2?_0x4b9623[_0x02d2('0x1f')]:_0x34cc6b[_0x02d2('0x1d')]+_0x34cc6b[_0x02d2('0x20')];var _0x17dd26;if(_0x38f2b5>=_0x3c19a0){_0x38f2b5=_0x3c19a0;_0x17dd26=0xc8;}else{_0x17dd26=0xce;}_0x26727d[_0x02d2('0x1c')](_0x17dd26);return _0x26727d[_0x02d2('0x21')](_0x02d2('0x22'),_0x2c699a+'-'+_0x38f2b5+'/'+_0x3c19a0)[_0x02d2('0x23')](_0x4b9623);}return null;};}function saveUpdates(_0x27a5fd){return function(_0x3bd29a){if(_0x3bd29a){return _0x3bd29a[_0x02d2('0x24')](_0x27a5fd)[_0x02d2('0x25')](function(_0x54f5e4){return _0x54f5e4;});}return null;};}function removeEntity(_0x4837b5){return function(_0x4282f7){if(_0x4282f7){return _0x4282f7['destroy']()[_0x02d2('0x25')](function(){_0x4837b5['status'](0xcc)[_0x02d2('0x26')]();});}};}function handleEntityNotFound(_0x5ef80f){return function(_0x9cfa3){if(!_0x9cfa3){_0x5ef80f[_0x02d2('0x27')](0x194);}return _0x9cfa3;};}function handleError(_0x210a45,_0x47dc34){_0x47dc34=_0x47dc34||0x1f4;return function(_0x16291d){logger[_0x02d2('0x18')](_0x16291d['stack']);if(_0x16291d[_0x02d2('0x28')]){delete _0x16291d[_0x02d2('0x28')];}_0x210a45[_0x02d2('0x1c')](_0x47dc34)['send'](_0x16291d);};}exports['index']=function(_0x171d6c,_0x2d6e98){var _0x13c03b={},_0x4f87b1={},_0xe29dc6={'count':0x0,'rows':[]};var _0x4c7d20=_[_0x02d2('0x29')](db[_0x02d2('0x2a')][_0x02d2('0x2b')],function(_0xe065ac){return{'name':_0xe065ac['fieldName'],'type':_0xe065ac['type'][_0x02d2('0x2c')]};});_0x4f87b1[_0x02d2('0x2d')]=_[_0x02d2('0x29')](_0x4c7d20,_0x02d2('0x28'));_0x4f87b1[_0x02d2('0x2e')]=_[_0x02d2('0x2f')](_0x171d6c[_0x02d2('0x2e')]);_0x4f87b1['filters']=_[_0x02d2('0x30')](_0x4f87b1[_0x02d2('0x2d')],_0x4f87b1['query']);_0x13c03b['attributes']=_[_0x02d2('0x30')](_0x4f87b1['model'],qs[_0x02d2('0x31')](_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x31')]));_0x13c03b['attributes']=_0x13c03b[_0x02d2('0x32')][_0x02d2('0x33')]?_0x13c03b['attributes']:_0x4f87b1['model'];if(!_0x171d6c['query'][_0x02d2('0x34')](_0x02d2('0x35'))){_0x13c03b[_0x02d2('0x20')]=qs[_0x02d2('0x20')](_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x20')]);_0x13c03b[_0x02d2('0x1d')]=qs[_0x02d2('0x1d')](_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x1d')]);}_0x13c03b['order']=qs[_0x02d2('0x36')](_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x36')]);_0x13c03b[_0x02d2('0x37')]=qs[_0x02d2('0x38')](_[_0x02d2('0x39')](_0x171d6c[_0x02d2('0x2e')],_0x4f87b1[_0x02d2('0x38')]),_0x4c7d20);if(_0x171d6c[_0x02d2('0x2e')]['filter']){_0x13c03b[_0x02d2('0x37')]=_[_0x02d2('0x3a')](_0x13c03b['where'],{'$or':_[_0x02d2('0x29')](_0x4c7d20,function(_0x4bce5a){if(_0x4bce5a[_0x02d2('0x3b')]!==_0x02d2('0x3c')){var _0x3e1445={};_0x3e1445[_0x4bce5a[_0x02d2('0x28')]]={'$like':'%'+_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x3d')]+'%'};return _0x3e1445;}})});}_0x13c03b=_[_0x02d2('0x3a')]({},_0x13c03b,_0x171d6c[_0x02d2('0x3e')]);var _0x5ab7d2={'where':_0x13c03b[_0x02d2('0x37')]};return db['MailMessage']['count'](_0x5ab7d2)[_0x02d2('0x25')](function(_0x322cc9){_0xe29dc6['count']=_0x322cc9;if(_0x171d6c[_0x02d2('0x2e')][_0x02d2('0x3f')]){_0x13c03b[_0x02d2('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x02d2('0x41')](_0x13c03b);})[_0x02d2('0x25')](function(_0x31cdc6){_0xe29dc6[_0x02d2('0x42')]=_0x31cdc6;return _0xe29dc6;})[_0x02d2('0x25')](respondWithFilteredResult(_0x2d6e98,_0x13c03b))[_0x02d2('0x43')](handleError(_0x2d6e98,null));};exports[_0x02d2('0x44')]=function(_0x22a633,_0x6cccac){var _0xa46d64={'raw':!![],'where':{'id':_0x22a633[_0x02d2('0x45')]['id']}},_0x57c4f2={};_0x57c4f2[_0x02d2('0x2d')]=_['keys'](db['MailMessage'][_0x02d2('0x2b')]);_0x57c4f2[_0x02d2('0x2e')]=_[_0x02d2('0x2f')](_0x22a633[_0x02d2('0x2e')]);_0x57c4f2['filters']=_[_0x02d2('0x30')](_0x57c4f2[_0x02d2('0x2d')],_0x57c4f2['query']);_0xa46d64[_0x02d2('0x32')]=_[_0x02d2('0x30')](_0x57c4f2['model'],qs[_0x02d2('0x31')](_0x22a633['query'][_0x02d2('0x31')]));_0xa46d64[_0x02d2('0x32')]=_0xa46d64[_0x02d2('0x32')][_0x02d2('0x33')]?_0xa46d64[_0x02d2('0x32')]:_0x57c4f2[_0x02d2('0x2d')];if(_0x22a633['query']['includeAll']){_0xa46d64['include']=[{'all':!![]}];}_0xa46d64=_[_0x02d2('0x3a')]({},_0xa46d64,_0x22a633[_0x02d2('0x3e')]);return db[_0x02d2('0x2a')]['find'](_0xa46d64)['then'](handleEntityNotFound(_0x6cccac,null))[_0x02d2('0x25')](respondWithResult(_0x6cccac,null))['catch'](handleError(_0x6cccac,null));};exports[_0x02d2('0x24')]=function(_0x5921b1,_0x5d55ca){if(_0x5921b1['body']['id']){delete _0x5921b1[_0x02d2('0x46')]['id'];}return db['MailMessage'][_0x02d2('0x47')]({'where':{'id':_0x5921b1[_0x02d2('0x45')]['id']}})[_0x02d2('0x25')](handleEntityNotFound(_0x5d55ca,null))[_0x02d2('0x25')](saveUpdates(_0x5921b1[_0x02d2('0x46')],null))[_0x02d2('0x25')](respondWithResult(_0x5d55ca,null))[_0x02d2('0x43')](handleError(_0x5d55ca,null));};exports[_0x02d2('0x48')]=function(_0x3b3220,_0x30c4a1){return db[_0x02d2('0x2a')][_0x02d2('0x47')]({'where':{'id':_0x3b3220[_0x02d2('0x45')]['id']}})[_0x02d2('0x25')](handleEntityNotFound(_0x30c4a1,null))['then'](removeEntity(_0x30c4a1,null))[_0x02d2('0x43')](handleError(_0x30c4a1,null));};exports[_0x02d2('0x49')]=function(_0x421afd,_0x568099){return db['MailMessage']['describe']()[_0x02d2('0x25')](respondWithResult(_0x568099,null))[_0x02d2('0x43')](handleError(_0x568099,null));};exports[_0x02d2('0x4a')]=function(_0x47fb20,_0x4a5690){return db['MailMessage'][_0x02d2('0x4a')](_0x47fb20[_0x02d2('0x46')])['then'](function(_0x4a6547){if(_0x4a6547){if(_0x4a6547[_0x02d2('0x4b')]===_0x02d2('0x4c')&&!_0x4a6547[_0x02d2('0x4d')]){var _0x40ae8e,_0x22c443,_0x538826;if(_0x47fb20['body']['to']){_0x22c443=_0x47fb20[_0x02d2('0x46')]['to'][_0x02d2('0x4e')](',')[0x0];}return db[_0x02d2('0x4f')][_0x02d2('0x50')]({'where':{'id':_0x4a6547[_0x02d2('0x51')]},'include':[{'model':db[_0x02d2('0x52')],'as':'List','include':[{'model':db[_0x02d2('0x53')],'as':'Contacts','where':{'email':_0x22c443},'limit':0x1,'order':[[_0x02d2('0x54'),_0x02d2('0x55')]]}]},{'model':db[_0x02d2('0x56')],'as':_0x02d2('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x02d2('0x58'),'raw':!![]}]}]})['then'](function(_0x3151ce){_0x40ae8e=_0x3151ce;if(!_0x40ae8e||!_0x40ae8e[_0x02d2('0x57')])return;var _0x259a5d=_0x40ae8e[_0x02d2('0x59')]();if(_0x47fb20[_0x02d2('0x46')][_0x02d2('0x5a')]&&_0x47fb20['body'][_0x02d2('0x5a')][_0x02d2('0x33')]){for(var _0x22f2df=0x0;_0x22f2df<_0x47fb20[_0x02d2('0x46')]['attachments']['length'];_0x22f2df+=0x1){_0x47fb20[_0x02d2('0x46')][_0x02d2('0x5a')][_0x22f2df]={'filename':_0x47fb20[_0x02d2('0x46')][_0x02d2('0x5a')][_0x22f2df]['name'],'path':path[_0x02d2('0x5b')](config[_0x02d2('0x5c')],'server/files/attachments',_0x47fb20[_0x02d2('0x46')][_0x02d2('0x5a')][_0x22f2df]['basename'])};}}_0x538826={'account':_0x259a5d,'message':_0x47fb20['body']};return;})[_0x02d2('0x25')](function(){if(_0x40ae8e[_0x02d2('0x5d')]){if(_0x40ae8e['List'][_0x02d2('0x5e')][_0x02d2('0x33')]){return _0x40ae8e[_0x02d2('0x5d')]['Contacts'][0x0];}else{return db[_0x02d2('0x53')][_0x02d2('0x4a')](_[_0x02d2('0xb')](_0x47fb20[_0x02d2('0x46')],{'firstName':_0x47fb20[_0x02d2('0x46')]['to'],'email':_0x47fb20[_0x02d2('0x46')]['to'],'phone':_0x47fb20[_0x02d2('0x46')]['to'],'ListId':_0x40ae8e[_0x02d2('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x02d2('0x25')](function(){if(_0x538826){return respondWithRpcPromise(_0x02d2('0x60'),_0x02d2('0x61'),_0x538826,client9003)['then'](function(_0x59cfb0){return _0x4a6547[_0x02d2('0x24')]({'read':!![],'messageId':_0x59cfb0[_0x02d2('0x62')],'sentAt':moment()['format'](_0x02d2('0x63'))});})[_0x02d2('0x43')](function(_0x4fb3cf){logger[_0x02d2('0x18')]('%s',JSON[_0x02d2('0x17')](_0x4fb3cf));return _0x4a6547;});}return _0x4a6547;});}return _0x4a6547;}})[_0x02d2('0x25')](respondWithResult(_0x4a5690,0xc9))[_0x02d2('0x43')](handleError(_0x4a5690,null));};exports[_0x02d2('0x64')]=function(_0x395c3c,_0x593b75){var _0x5bed0c={'agent':{},'channel':'mail'};if(_0x395c3c[_0x02d2('0x46')]['id']){delete _0x395c3c[_0x02d2('0x46')]['id'];}_0x395c3c[_0x02d2('0x46')]['read']=!![];_0x395c3c[_0x02d2('0x46')][_0x02d2('0x65')]=moment()[_0x02d2('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x395c3c[_0x02d2('0x46')]['UserId']=_0x395c3c[_0x02d2('0x46')][_0x02d2('0x67')]||_0x395c3c[_0x02d2('0x68')]['id'];_0x5bed0c['agent']['id']=_0x395c3c[_0x02d2('0x46')]['UserId'];return db[_0x02d2('0x2a')][_0x02d2('0x47')]({'where':{'id':_0x395c3c[_0x02d2('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x593b75,null))[_0x02d2('0x25')](saveUpdates(_0x395c3c[_0x02d2('0x46')],null))[_0x02d2('0x25')](function(_0x5b02bd){if(_0x5b02bd){_0x5bed0c[_0x02d2('0x1a')]=_0x5b02bd['get']({'plain':!![]});return db[_0x02d2('0x69')][_0x02d2('0x47')]({'where':{'id':_0x5b02bd['MailInteractionId']}});}return null;})[_0x02d2('0x25')](handleEntityNotFound(_0x593b75,null))[_0x02d2('0x25')](function(_0x82cd73){if(_0x82cd73){return _0x82cd73[_0x02d2('0x24')]({'UserId':_0x395c3c['body'][_0x02d2('0x67')],'read1stAt':_['isNil'](_0x82cd73['read1stAt'])?moment()[_0x02d2('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4229c7){if(_0x4229c7){_0x5bed0c[_0x02d2('0x6a')]=_0x4229c7[_0x02d2('0x6b')]({'plain':!![]});interaction_log[_0x02d2('0x13')](_0x02d2('0x6c'),_0x395c3c[_0x02d2('0x68')]['id'],_0x395c3c['user'][_0x02d2('0x28')],_0x395c3c[_0x02d2('0x68')][_0x02d2('0x6d')],_0x5bed0c[_0x02d2('0x6a')]['id'],_0x395c3c[_0x02d2('0x46')]?JSON[_0x02d2('0x17')](_0x395c3c[_0x02d2('0x46')]):_0x02d2('0x6e'));return respondWithRpcPromise(_0x02d2('0x6f'),_0x02d2('0x70'),_0x5bed0c);}return null;})['then'](function(_0x24fbca){var _0x21977a=_0x02d2('0x71')+_0x24fbca[_0x02d2('0x1a')][_0x02d2('0x72')];return db[_0x02d2('0x73')][_0x02d2('0x2e')](_0x21977a,{'type':db[_0x02d2('0x74')][_0x02d2('0x75')][_0x02d2('0x76')],'raw':!![]})['then'](function(_0x1fe09d){return _0x1fe09d;});})[_0x02d2('0x25')](function(_0x5df8d2){if(_0x5df8d2){_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x77')]=_0x5df8d2[0x0];if(!_0x395c3c[_0x02d2('0x46')][_0x02d2('0x67')])return;return db[_0x02d2('0x78')][_0x02d2('0x47')]({'where':{'id':_0x395c3c['body'][_0x02d2('0x67')],'role':_0x02d2('0x79')},'attributes':['id',_0x02d2('0x28'),'fullname','email',_0x02d2('0x7a')],'raw':!![]});}return null;})[_0x02d2('0x25')](function(_0x185e28){if(!_0x185e28)return null;_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x79')]=_0x185e28;return _0x5bed0c;})['then'](function(_0x27687a){if(_0x27687a){if(_0x395c3c['body'][_0x02d2('0x7b')]){_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x7c')]=util['format'](_0x02d2('0x7d'),_0x395c3c[_0x02d2('0x68')][_0x02d2('0x28')]);_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x7e')]=_0x5bed0c[_0x02d2('0x7e')];_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x7f')]=_0x5bed0c[_0x02d2('0x7e')];_0x5bed0c[_0x02d2('0x1a')][_0x02d2('0x80')]='accept';_0x5bed0c['message'][_0x02d2('0x46')]=htmlToText[_0x02d2('0x81')](_0x5bed0c['message'][_0x02d2('0x46')]);return respondWithRpcPromise(_0x02d2('0x82'),_0x02d2('0x82'),{'event':_0x02d2('0x83'),'message':_0x5bed0c[_0x02d2('0x1a')]},client9002)[_0x02d2('0x25')](function(){return _0x5bed0c;});}return _0x5bed0c;}return null;})[_0x02d2('0x25')](respondWithResult(_0x593b75,null))[_0x02d2('0x43')](handleError(_0x593b75,null));};exports[_0x02d2('0x84')]=function(_0x1b56ad,_0x54cbcf){var _0x528838={'agent':{},'channel':_0x02d2('0x85')};if(_0x1b56ad[_0x02d2('0x46')]['id']){delete _0x1b56ad['body']['id'];}_0x1b56ad[_0x02d2('0x46')][_0x02d2('0x67')]=_0x1b56ad[_0x02d2('0x46')][_0x02d2('0x67')]||_0x1b56ad[_0x02d2('0x68')]['id'];_0x528838['agent']['id']=_0x1b56ad[_0x02d2('0x46')]['UserId'];return db[_0x02d2('0x2a')][_0x02d2('0x47')]({'where':{'id':_0x1b56ad[_0x02d2('0x45')]['id'],'UserId':null}})[_0x02d2('0x25')](handleEntityNotFound(_0x54cbcf,null))[_0x02d2('0x25')](function(_0x227a20){if(_0x227a20){_0x528838[_0x02d2('0x1a')]=_0x227a20[_0x02d2('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x227a20[_0x02d2('0x86')]}});}return null;})[_0x02d2('0x25')](handleEntityNotFound(_0x54cbcf,null))['then'](function(_0xa6721){if(_0xa6721){_0x528838[_0x02d2('0x6a')]=_0xa6721[_0x02d2('0x6b')]({'plain':!![]});interaction_log[_0x02d2('0x13')](_0x02d2('0x87'),_0x1b56ad[_0x02d2('0x68')]['id'],_0x1b56ad['user'][_0x02d2('0x28')],_0x1b56ad[_0x02d2('0x68')][_0x02d2('0x6d')],_0x528838[_0x02d2('0x6a')]['id'],_0x1b56ad[_0x02d2('0x46')]?JSON['stringify'](_0x1b56ad[_0x02d2('0x46')]):'null');return respondWithRpcPromise(_0x02d2('0x88'),_0x02d2('0x89'),_0x528838);}return null;})[_0x02d2('0x25')](function(_0x38ebbf){var _0x546ef3=_0x02d2('0x71')+_0x38ebbf[_0x02d2('0x1a')]['ContactId'];return db['sequelize'][_0x02d2('0x2e')](_0x546ef3,{'type':db[_0x02d2('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0x02d2('0x25')](function(_0xd7fe4a){return _0xd7fe4a;});})['then'](function(_0x537593){if(_0x537593){_0x528838[_0x02d2('0x1a')][_0x02d2('0x77')]=_0x537593[0x0];if(!_0x1b56ad[_0x02d2('0x46')][_0x02d2('0x67')])return;return db[_0x02d2('0x78')]['find']({'where':{'id':_0x1b56ad[_0x02d2('0x46')]['UserId'],'role':'agent'},'attributes':['id',_0x02d2('0x28'),_0x02d2('0x8a'),_0x02d2('0x8b'),_0x02d2('0x7a')],'raw':!![]});}return null;})[_0x02d2('0x25')](function(_0x46e8e9){if(!_0x46e8e9)return null;_0x528838[_0x02d2('0x1a')][_0x02d2('0x79')]=_0x46e8e9;return _0x528838;})[_0x02d2('0x25')](function(_0x2c02ac){if(_0x2c02ac){_0x2c02ac[_0x02d2('0x1a')][_0x02d2('0x7c')]=util[_0x02d2('0x66')]('SIP/%s',_0x1b56ad[_0x02d2('0x68')][_0x02d2('0x28')]);_0x2c02ac['message'][_0x02d2('0x7e')]=_0x528838[_0x02d2('0x7e')];_0x2c02ac[_0x02d2('0x1a')][_0x02d2('0x7f')]=_0x528838[_0x02d2('0x7e')];_0x2c02ac[_0x02d2('0x1a')][_0x02d2('0x80')]=_0x02d2('0x84');_0x2c02ac[_0x02d2('0x1a')]['body']=htmlToText[_0x02d2('0x81')](_0x528838[_0x02d2('0x1a')][_0x02d2('0x46')]);respondWithRpcPromise(_0x02d2('0x82'),_0x02d2('0x82'),{'event':_0x02d2('0x8c'),'message':_0x2c02ac[_0x02d2('0x1a')]},client9002);return _0x528838;}return null;})[_0x02d2('0x25')](respondWithResult(_0x54cbcf,null))[_0x02d2('0x43')](handleError(_0x54cbcf,null));};exports['download']=function(_0xf13316,_0x54cd08){var _0x2334ee=moment()[_0x02d2('0x8d')]()['toString']();var _0x277b15=path[_0x02d2('0x5b')](config[_0x02d2('0x5c')],_0x02d2('0x8e'),_0x02d2('0x8f'),_0x02d2('0x90'));var _0x103b56=path['join'](config[_0x02d2('0x5c')],_0x02d2('0x8e'),'files','attachments');var _0x24c36f=util[_0x02d2('0x66')](_0x02d2('0x91'),_0x2334ee);return db[_0x02d2('0x2a')][_0x02d2('0x47')]({'where':{'id':_0xf13316['params']['id']},'attributes':['id',_0x02d2('0x46'),_0x02d2('0x92'),'to','cc','bcc','subject','createdAt'],'include':_0xf13316[_0x02d2('0x2e')][_0x02d2('0x5a')]?[{'model':db[_0x02d2('0x93')],'as':_0x02d2('0x94')}]:undefined})[_0x02d2('0x25')](handleEntityNotFound(_0x54cd08,null))[_0x02d2('0x25')](function(_0x561978){if(_0x561978){var _0x346bb5=_0x561978;var _0x55b9b6={'from':_0x346bb5[_0x02d2('0x92')],'to':_0x346bb5['to'],'subject':_0x346bb5[_0x02d2('0x95')],'html':htmlEntities[_0x02d2('0x96')](_0x346bb5[_0x02d2('0x46')]),'headers':{'Date':moment(_0x346bb5['createdAt'])[_0x02d2('0x66')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x561978['cc']){_0x55b9b6[_0x02d2('0x97')]['Cc']=_0x561978['cc'];}if(_0x561978[_0x02d2('0x98')]){_0x55b9b6[_0x02d2('0x97')][_0x02d2('0x99')]=_0x561978[_0x02d2('0x98')];}return new BPromise(function(_0x92df4,_0x40e2a8){if(_0x561978['Attachments']){for(var _0x688b5b=0x0;_0x688b5b<_0x561978['Attachments'][_0x02d2('0x33')];_0x688b5b++){var _0x3dd818=_0x561978[_0x02d2('0x94')][_0x688b5b];var _0x5c639f=path[_0x02d2('0x5b')](_0x103b56,_0x3dd818[_0x02d2('0x9a')]);if(fs[_0x02d2('0x9b')](_0x5c639f)){_0x55b9b6['attachments'][_0x02d2('0x9c')]({'name':_0x3dd818[_0x02d2('0x28')],'contentType':_0x3dd818['type'],'data':fs['readFileSync'](_0x5c639f)});}}}emlformat['build'](_0x55b9b6,function(_0x87d3c,_0x459013){if(_0x87d3c)return _0x40e2a8(_0x87d3c);fs[_0x02d2('0x9d')](path['join'](_0x277b15,_0x24c36f),_0x459013);return _0x92df4(_0x459013);});});}})[_0x02d2('0x25')](function(_0x4b7554){if(_0x4b7554){return _0x54cd08[_0x02d2('0x9e')](path[_0x02d2('0x5b')](_0x277b15,_0x24c36f),_0x24c36f,function(_0x3e71d4){if(!_0x3e71d4)fs[_0x02d2('0x9f')](path['join'](_0x277b15,_0x24c36f));});}})[_0x02d2('0x43')](handleError(_0x54cd08,null));}; \ No newline at end of file +var _0x063c=['files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','ioredis','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result','catch','status','json','undefined','limit','offset','count','Content-Range','update','then','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','filter','options','includeAll','include','show','params','find','body','destroy','describe','create','out','secret','split','findOne','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','basename','Contacts','ListId','List\x20not\x20found','SendMail','stringify','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','isNil','read1stAt','format','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','reject','MailInteraction','MailInteractionId','RejectMessage','ContactId','rejectmessage','download','unix','toString','server'];(function(_0x1556fc,_0x179b11){var _0x193101=function(_0x53e832){while(--_0x53e832){_0x1556fc['push'](_0x1556fc['shift']());}};_0x193101(++_0x179b11);}(_0x063c,0xa9));var _0xc063=function(_0x6f835a,_0x1a94a5){_0x6f835a=_0x6f835a-0x0;var _0x5c85eb=_0x063c[_0x6f835a];return _0x5c85eb;};'use strict';var emlformat=require(_0xc063('0x0'));var moment=require(_0xc063('0x1'));var BPromise=require(_0xc063('0x2'));var util=require('util');var path=require(_0xc063('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc063('0x4'));var htmlToText=require(_0xc063('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xc063('0x6'))(_0xc063('0x7'));var interaction_log=require(_0xc063('0x6'))('mail-interactions');var config=require(_0xc063('0x8'));var db=require(_0xc063('0x9'))['db'];config[_0xc063('0xa')]=_[_0xc063('0xb')](config[_0xc063('0xa')],{'host':_0xc063('0xc'),'port':0x18eb});var socket=require(_0xc063('0xd'))(new Redis(config[_0xc063('0xa')]));var htmlEntities=require(_0xc063('0xe'));require(_0xc063('0xf'))[_0xc063('0x10')](socket);var jayson=require(_0xc063('0x11'));var client=jayson[_0xc063('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xc063('0x12')][_0xc063('0x13')]({'port':0x232b});var client9002=jayson[_0xc063('0x12')][_0xc063('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x484028,_0x4490bc,_0x37ab7d,_0x312b0e){return new BPromise(function(_0x1f351e,_0x385e74){var _0x5b8e7f=_0x312b0e||client;return _0x5b8e7f['request'](_0x484028,_0x37ab7d)['then'](function(_0x253da7){logger[_0xc063('0x14')](_0xc063('0x15'),_0x4490bc,'request\x20sent');logger[_0xc063('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4490bc,'request\x20sent',JSON['stringify'](_0x253da7));if(_0x253da7['error']){if(_0x253da7['error'][_0xc063('0x17')]===0x1f4){logger[_0xc063('0x18')](_0xc063('0x15'),_0x4490bc,_0x253da7[_0xc063('0x18')][_0xc063('0x19')]);return _0x385e74(_0x253da7[_0xc063('0x18')][_0xc063('0x19')]);}logger[_0xc063('0x18')](_0xc063('0x15'),_0x4490bc,_0x253da7[_0xc063('0x18')][_0xc063('0x19')]);return _0x1f351e(_0x253da7[_0xc063('0x18')][_0xc063('0x19')]);}else{logger[_0xc063('0x14')](_0xc063('0x15'),_0x4490bc,_0xc063('0x1a'));_0x1f351e(_0x253da7[_0xc063('0x1b')][_0xc063('0x19')]);}})[_0xc063('0x1c')](function(_0x424246){logger['error'](_0xc063('0x15'),_0x4490bc,_0x424246);_0x385e74(_0x424246);});});}function respondWithResult(_0x2cf50e,_0x5bdf24){_0x5bdf24=_0x5bdf24||0xc8;return function(_0x2f8318){if(_0x2f8318){return _0x2cf50e[_0xc063('0x1d')](_0x5bdf24)[_0xc063('0x1e')](_0x2f8318);}};}function respondWithFilteredResult(_0x1c0996,_0x4a68ca){return function(_0x237a18){if(_0x237a18){var _0x3e292d=typeof _0x4a68ca['offset']===_0xc063('0x1f')&&typeof _0x4a68ca[_0xc063('0x20')]===_0xc063('0x1f');var _0x337fdd=_0x237a18['count'];var _0x1052a3=_0x3e292d?0x0:_0x4a68ca[_0xc063('0x21')];var _0x3c86c4=_0x3e292d?_0x237a18[_0xc063('0x22')]:_0x4a68ca[_0xc063('0x21')]+_0x4a68ca[_0xc063('0x20')];var _0x3b6da4;if(_0x3c86c4>=_0x337fdd){_0x3c86c4=_0x337fdd;_0x3b6da4=0xc8;}else{_0x3b6da4=0xce;}_0x1c0996[_0xc063('0x1d')](_0x3b6da4);return _0x1c0996['set'](_0xc063('0x23'),_0x1052a3+'-'+_0x3c86c4+'/'+_0x337fdd)[_0xc063('0x1e')](_0x237a18);}return null;};}function saveUpdates(_0x1c59c6){return function(_0x283250){if(_0x283250){return _0x283250[_0xc063('0x24')](_0x1c59c6)['then'](function(_0x238e56){return _0x238e56;});}return null;};}function removeEntity(_0x4398ce){return function(_0x14897b){if(_0x14897b){return _0x14897b['destroy']()[_0xc063('0x25')](function(){_0x4398ce[_0xc063('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392db8){return function(_0x653975){if(!_0x653975){_0x392db8[_0xc063('0x26')](0x194);}return _0x653975;};}function handleError(_0x49138c,_0x43b288){_0x43b288=_0x43b288||0x1f4;return function(_0xeca1da){logger[_0xc063('0x18')](_0xeca1da[_0xc063('0x27')]);if(_0xeca1da[_0xc063('0x28')]){delete _0xeca1da['name'];}_0x49138c[_0xc063('0x1d')](_0x43b288)['send'](_0xeca1da);};}exports[_0xc063('0x29')]=function(_0x285774,_0x3f3ee8){var _0x1d508d={},_0x222f8a={},_0x71897a={'count':0x0,'rows':[]};var _0x5c3f72=_[_0xc063('0x2a')](db[_0xc063('0x2b')][_0xc063('0x2c')],function(_0x5ecb02){return{'name':_0x5ecb02[_0xc063('0x2d')],'type':_0x5ecb02[_0xc063('0x2e')][_0xc063('0x2f')]};});_0x222f8a[_0xc063('0x30')]=_[_0xc063('0x2a')](_0x5c3f72,_0xc063('0x28'));_0x222f8a[_0xc063('0x31')]=_[_0xc063('0x32')](_0x285774[_0xc063('0x31')]);_0x222f8a[_0xc063('0x33')]=_[_0xc063('0x34')](_0x222f8a[_0xc063('0x30')],_0x222f8a[_0xc063('0x31')]);_0x1d508d[_0xc063('0x35')]=_[_0xc063('0x34')](_0x222f8a['model'],qs[_0xc063('0x36')](_0x285774[_0xc063('0x31')]['fields']));_0x1d508d[_0xc063('0x35')]=_0x1d508d[_0xc063('0x35')][_0xc063('0x37')]?_0x1d508d[_0xc063('0x35')]:_0x222f8a[_0xc063('0x30')];if(!_0x285774[_0xc063('0x31')][_0xc063('0x38')](_0xc063('0x39'))){_0x1d508d[_0xc063('0x20')]=qs[_0xc063('0x20')](_0x285774[_0xc063('0x31')][_0xc063('0x20')]);_0x1d508d[_0xc063('0x21')]=qs[_0xc063('0x21')](_0x285774['query'][_0xc063('0x21')]);}_0x1d508d[_0xc063('0x3a')]=qs['sort'](_0x285774[_0xc063('0x31')]['sort']);_0x1d508d['where']=qs['filters'](_[_0xc063('0x3b')](_0x285774['query'],_0x222f8a[_0xc063('0x33')]),_0x5c3f72);if(_0x285774['query']['filter']){_0x1d508d[_0xc063('0x3c')]=_[_0xc063('0x3d')](_0x1d508d[_0xc063('0x3c')],{'$or':_['map'](_0x5c3f72,function(_0x4d2fc6){if(_0x4d2fc6[_0xc063('0x2e')]!=='VIRTUAL'){var _0x4ba52c={};_0x4ba52c[_0x4d2fc6['name']]={'$like':'%'+_0x285774[_0xc063('0x31')][_0xc063('0x3e')]+'%'};return _0x4ba52c;}})});}_0x1d508d=_[_0xc063('0x3d')]({},_0x1d508d,_0x285774[_0xc063('0x3f')]);var _0x50f352={'where':_0x1d508d[_0xc063('0x3c')]};return db[_0xc063('0x2b')]['count'](_0x50f352)[_0xc063('0x25')](function(_0x3722e4){_0x71897a['count']=_0x3722e4;if(_0x285774['query'][_0xc063('0x40')]){_0x1d508d[_0xc063('0x41')]=[{'all':!![]}];}return db[_0xc063('0x2b')]['findAll'](_0x1d508d);})['then'](function(_0x402493){_0x71897a['rows']=_0x402493;return _0x71897a;})[_0xc063('0x25')](respondWithFilteredResult(_0x3f3ee8,_0x1d508d))[_0xc063('0x1c')](handleError(_0x3f3ee8,null));};exports[_0xc063('0x42')]=function(_0x893388,_0x23f040){var _0x1c184a={'raw':!![],'where':{'id':_0x893388[_0xc063('0x43')]['id']}},_0x29068b={};_0x29068b[_0xc063('0x30')]=_[_0xc063('0x32')](db[_0xc063('0x2b')]['rawAttributes']);_0x29068b[_0xc063('0x31')]=_[_0xc063('0x32')](_0x893388['query']);_0x29068b[_0xc063('0x33')]=_[_0xc063('0x34')](_0x29068b[_0xc063('0x30')],_0x29068b['query']);_0x1c184a['attributes']=_[_0xc063('0x34')](_0x29068b['model'],qs[_0xc063('0x36')](_0x893388[_0xc063('0x31')][_0xc063('0x36')]));_0x1c184a[_0xc063('0x35')]=_0x1c184a[_0xc063('0x35')][_0xc063('0x37')]?_0x1c184a[_0xc063('0x35')]:_0x29068b['model'];if(_0x893388['query'][_0xc063('0x40')]){_0x1c184a[_0xc063('0x41')]=[{'all':!![]}];}_0x1c184a=_[_0xc063('0x3d')]({},_0x1c184a,_0x893388[_0xc063('0x3f')]);return db['MailMessage'][_0xc063('0x44')](_0x1c184a)[_0xc063('0x25')](handleEntityNotFound(_0x23f040,null))[_0xc063('0x25')](respondWithResult(_0x23f040,null))[_0xc063('0x1c')](handleError(_0x23f040,null));};exports[_0xc063('0x24')]=function(_0x5203bf,_0x218e44){if(_0x5203bf[_0xc063('0x45')]['id']){delete _0x5203bf[_0xc063('0x45')]['id'];}return db['MailMessage'][_0xc063('0x44')]({'where':{'id':_0x5203bf[_0xc063('0x43')]['id']}})['then'](handleEntityNotFound(_0x218e44,null))[_0xc063('0x25')](saveUpdates(_0x5203bf[_0xc063('0x45')],null))[_0xc063('0x25')](respondWithResult(_0x218e44,null))[_0xc063('0x1c')](handleError(_0x218e44,null));};exports[_0xc063('0x46')]=function(_0x502d76,_0x186834){return db[_0xc063('0x2b')][_0xc063('0x44')]({'where':{'id':_0x502d76['params']['id']}})[_0xc063('0x25')](handleEntityNotFound(_0x186834,null))['then'](removeEntity(_0x186834,null))[_0xc063('0x1c')](handleError(_0x186834,null));};exports[_0xc063('0x47')]=function(_0x15ad24,_0x2bccdc){return db[_0xc063('0x2b')]['describe']()[_0xc063('0x25')](respondWithResult(_0x2bccdc,null))[_0xc063('0x1c')](handleError(_0x2bccdc,null));};exports[_0xc063('0x48')]=function(_0x469eff,_0x3618be){return db['MailMessage']['create'](_0x469eff[_0xc063('0x45')])[_0xc063('0x25')](function(_0x147c55){if(_0x147c55){if(_0x147c55['direction']===_0xc063('0x49')&&!_0x147c55[_0xc063('0x4a')]){var _0xe71831,_0x324014,_0x453e72;if(_0x469eff[_0xc063('0x45')]['to']){_0x324014=_0x469eff[_0xc063('0x45')]['to'][_0xc063('0x4b')](',')[0x0];}return db['MailAccount'][_0xc063('0x4c')]({'where':{'id':_0x147c55['MailAccountId']},'include':[{'model':db[_0xc063('0x4d')],'as':_0xc063('0x4e'),'include':[{'model':db[_0xc063('0x4f')],'as':'Contacts','where':{'email':_0x324014},'limit':0x1,'order':[['updatedAt',_0xc063('0x50')]]}]},{'model':db[_0xc063('0x51')],'as':_0xc063('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc063('0x53'),'raw':!![]}]}]})[_0xc063('0x25')](function(_0x387d00){_0xe71831=_0x387d00;if(!_0xe71831||!_0xe71831[_0xc063('0x52')])return;var _0x175b3b=_0xe71831['getSmtpOptions']();if(_0x469eff[_0xc063('0x45')]['attachments']&&_0x469eff[_0xc063('0x45')][_0xc063('0x54')]['length']){for(var _0x3cb729=0x0;_0x3cb729<_0x469eff[_0xc063('0x45')][_0xc063('0x54')]['length'];_0x3cb729+=0x1){_0x469eff[_0xc063('0x45')][_0xc063('0x54')][_0x3cb729]={'filename':_0x469eff['body'][_0xc063('0x54')][_0x3cb729]['name'],'path':path[_0xc063('0x55')](config[_0xc063('0x56')],'server/files/attachments',_0x469eff[_0xc063('0x45')]['attachments'][_0x3cb729][_0xc063('0x57')])};}}_0x453e72={'account':_0x175b3b,'message':_0x469eff[_0xc063('0x45')]};return;})[_0xc063('0x25')](function(){if(_0xe71831[_0xc063('0x4e')]){if(_0xe71831['List'][_0xc063('0x58')]['length']){return _0xe71831[_0xc063('0x4e')][_0xc063('0x58')][0x0];}else{return db[_0xc063('0x4f')][_0xc063('0x48')](_[_0xc063('0xb')](_0x469eff['body'],{'firstName':_0x469eff[_0xc063('0x45')]['to'],'email':_0x469eff[_0xc063('0x45')]['to'],'phone':_0x469eff[_0xc063('0x45')]['to'],'ListId':_0xe71831[_0xc063('0x59')]}));}}else{throw new Error(_0xc063('0x5a'));}})['then'](function(){if(_0x453e72){return respondWithRpcPromise(_0xc063('0x5b'),'sendMail',_0x453e72,client9003)[_0xc063('0x25')](function(_0x16bdfa){return _0x147c55[_0xc063('0x24')]({'read':!![],'messageId':_0x16bdfa['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc063('0x1c')](function(_0x25e35b){logger[_0xc063('0x18')]('%s',JSON[_0xc063('0x5c')](_0x25e35b));return _0x147c55;});}return _0x147c55;});}return _0x147c55;}})[_0xc063('0x25')](respondWithResult(_0x3618be,0xc9))[_0xc063('0x1c')](handleError(_0x3618be,null));};exports['accept']=function(_0x5f01c2,_0x127bdc){var _0x349af1={'agent':{},'channel':_0xc063('0x5d')};if(_0x5f01c2[_0xc063('0x45')]['id']){delete _0x5f01c2[_0xc063('0x45')]['id'];}_0x5f01c2[_0xc063('0x45')][_0xc063('0x5e')]=!![];_0x5f01c2[_0xc063('0x45')][_0xc063('0x5f')]=moment()['format'](_0xc063('0x60'));_0x5f01c2[_0xc063('0x45')][_0xc063('0x61')]=_0x5f01c2['body'][_0xc063('0x61')]||_0x5f01c2['user']['id'];_0x349af1['agent']['id']=_0x5f01c2[_0xc063('0x45')][_0xc063('0x61')];return db['MailMessage'][_0xc063('0x44')]({'where':{'id':_0x5f01c2[_0xc063('0x43')]['id'],'UserId':null}})[_0xc063('0x25')](handleEntityNotFound(_0x127bdc,null))['then'](saveUpdates(_0x5f01c2[_0xc063('0x45')],null))[_0xc063('0x25')](function(_0x44f563){if(_0x44f563){_0x349af1[_0xc063('0x19')]=_0x44f563[_0xc063('0x62')]({'plain':!![]});return db['MailInteraction'][_0xc063('0x44')]({'where':{'id':_0x44f563['MailInteractionId']}});}return null;})[_0xc063('0x25')](handleEntityNotFound(_0x127bdc,null))[_0xc063('0x25')](function(_0xd0881e){if(_0xd0881e){return _0xd0881e[_0xc063('0x24')]({'UserId':_0x5f01c2[_0xc063('0x45')]['UserId'],'read1stAt':_[_0xc063('0x63')](_0xd0881e[_0xc063('0x64')])?moment()[_0xc063('0x65')](_0xc063('0x60')):undefined});}return null;})[_0xc063('0x25')](function(_0x34dbda){if(_0x34dbda){_0x349af1['interaction']=_0x34dbda[_0xc063('0x62')]({'plain':!![]});interaction_log[_0xc063('0x14')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5f01c2[_0xc063('0x66')]['id'],_0x5f01c2[_0xc063('0x66')]['name'],_0x5f01c2['user'][_0xc063('0x67')],_0x349af1[_0xc063('0x68')]['id'],_0x5f01c2[_0xc063('0x45')]?JSON[_0xc063('0x5c')](_0x5f01c2[_0xc063('0x45')]):_0xc063('0x69'));return respondWithRpcPromise('AcceptMessage',_0xc063('0x6a'),_0x349af1);}return null;})[_0xc063('0x25')](function(_0x599146){var _0x4c9fb1=_0xc063('0x6b')+_0x599146[_0xc063('0x19')]['ContactId'];return db[_0xc063('0x6c')][_0xc063('0x31')](_0x4c9fb1,{'type':db[_0xc063('0x6d')][_0xc063('0x6e')][_0xc063('0x6f')],'raw':!![]})[_0xc063('0x25')](function(_0x71ec21){return _0x71ec21;});})[_0xc063('0x25')](function(_0x2ce597){if(_0x2ce597){_0x349af1[_0xc063('0x19')][_0xc063('0x70')]=_0x2ce597[0x0];if(!_0x5f01c2['body']['UserId'])return;return db[_0xc063('0x71')]['find']({'where':{'id':_0x5f01c2['body'][_0xc063('0x61')],'role':_0xc063('0x72')},'attributes':['id',_0xc063('0x28'),_0xc063('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xc063('0x25')](function(_0x7aee61){if(!_0x7aee61)return null;_0x349af1[_0xc063('0x19')][_0xc063('0x72')]=_0x7aee61;return _0x349af1;})[_0xc063('0x25')](function(_0x1c939c){if(_0x1c939c){if(_0x5f01c2[_0xc063('0x45')][_0xc063('0x74')]){_0x349af1[_0xc063('0x19')][_0xc063('0x75')]=util['format'](_0xc063('0x76'),_0x5f01c2[_0xc063('0x66')][_0xc063('0x28')]);_0x349af1[_0xc063('0x19')]['channel']=_0x349af1[_0xc063('0x77')];_0x349af1['message'][_0xc063('0x78')]=_0x349af1[_0xc063('0x77')];_0x349af1[_0xc063('0x19')][_0xc063('0x79')]=_0xc063('0x7a');_0x349af1[_0xc063('0x19')][_0xc063('0x45')]=htmlToText[_0xc063('0x7b')](_0x349af1[_0xc063('0x19')][_0xc063('0x45')]);return respondWithRpcPromise(_0xc063('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x349af1[_0xc063('0x19')]},client9002)[_0xc063('0x25')](function(){return _0x349af1;});}return _0x349af1;}return null;})[_0xc063('0x25')](respondWithResult(_0x127bdc,null))[_0xc063('0x1c')](handleError(_0x127bdc,null));};exports[_0xc063('0x7d')]=function(_0x5842ee,_0x3012ae){var _0x430a81={'agent':{},'channel':_0xc063('0x5d')};if(_0x5842ee[_0xc063('0x45')]['id']){delete _0x5842ee['body']['id'];}_0x5842ee['body']['UserId']=_0x5842ee['body'][_0xc063('0x61')]||_0x5842ee[_0xc063('0x66')]['id'];_0x430a81[_0xc063('0x72')]['id']=_0x5842ee[_0xc063('0x45')]['UserId'];return db[_0xc063('0x2b')]['find']({'where':{'id':_0x5842ee['params']['id'],'UserId':null}})[_0xc063('0x25')](handleEntityNotFound(_0x3012ae,null))['then'](function(_0x1af0f0){if(_0x1af0f0){_0x430a81[_0xc063('0x19')]=_0x1af0f0[_0xc063('0x62')]({'plain':!![]});return db[_0xc063('0x7e')]['find']({'where':{'id':_0x1af0f0[_0xc063('0x7f')]}});}return null;})[_0xc063('0x25')](handleEntityNotFound(_0x3012ae,null))['then'](function(_0x6a6c7a){if(_0x6a6c7a){_0x430a81['interaction']=_0x6a6c7a['get']({'plain':!![]});interaction_log[_0xc063('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5842ee[_0xc063('0x66')]['id'],_0x5842ee['user'][_0xc063('0x28')],_0x5842ee[_0xc063('0x66')]['role'],_0x430a81[_0xc063('0x68')]['id'],_0x5842ee[_0xc063('0x45')]?JSON[_0xc063('0x5c')](_0x5842ee[_0xc063('0x45')]):_0xc063('0x69'));return respondWithRpcPromise(_0xc063('0x80'),'rejectMessage',_0x430a81);}return null;})['then'](function(_0xbc69fc){var _0x4ee48f=_0xc063('0x6b')+_0xbc69fc[_0xc063('0x19')][_0xc063('0x81')];return db['sequelize'][_0xc063('0x31')](_0x4ee48f,{'type':db['Sequelize'][_0xc063('0x6e')][_0xc063('0x6f')],'raw':!![]})['then'](function(_0x5302d0){return _0x5302d0;});})[_0xc063('0x25')](function(_0x43cb89){if(_0x43cb89){_0x430a81[_0xc063('0x19')][_0xc063('0x70')]=_0x43cb89[0x0];if(!_0x5842ee[_0xc063('0x45')][_0xc063('0x61')])return;return db['User'][_0xc063('0x44')]({'where':{'id':_0x5842ee['body'][_0xc063('0x61')],'role':_0xc063('0x72')},'attributes':['id',_0xc063('0x28'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xc063('0x25')](function(_0x44c01d){if(!_0x44c01d)return null;_0x430a81[_0xc063('0x19')]['agent']=_0x44c01d;return _0x430a81;})['then'](function(_0x274325){if(_0x274325){_0x274325[_0xc063('0x19')][_0xc063('0x75')]=util[_0xc063('0x65')]('SIP/%s',_0x5842ee['user'][_0xc063('0x28')]);_0x274325[_0xc063('0x19')]['channel']=_0x430a81['channel'];_0x274325[_0xc063('0x19')][_0xc063('0x78')]=_0x430a81[_0xc063('0x77')];_0x274325[_0xc063('0x19')][_0xc063('0x79')]=_0xc063('0x7d');_0x274325['message'][_0xc063('0x45')]=htmlToText[_0xc063('0x7b')](_0x430a81[_0xc063('0x19')][_0xc063('0x45')]);respondWithRpcPromise(_0xc063('0x7c'),_0xc063('0x7c'),{'event':_0xc063('0x82'),'message':_0x274325[_0xc063('0x19')]},client9002);return _0x430a81;}return null;})[_0xc063('0x25')](respondWithResult(_0x3012ae,null))[_0xc063('0x1c')](handleError(_0x3012ae,null));};exports[_0xc063('0x83')]=function(_0x300bf8,_0x46e01e){var _0x60944e=moment()[_0xc063('0x84')]()[_0xc063('0x85')]();var _0x51799c=path[_0xc063('0x55')](config[_0xc063('0x56')],_0xc063('0x86'),_0xc063('0x87'),_0xc063('0x88'));var _0x1b5354=path['join'](config[_0xc063('0x56')],_0xc063('0x86'),_0xc063('0x87'),'attachments');var _0x540851=util['format'](_0xc063('0x89'),_0x60944e);return db[_0xc063('0x2b')][_0xc063('0x44')]({'where':{'id':_0x300bf8[_0xc063('0x43')]['id']},'attributes':['id',_0xc063('0x45'),_0xc063('0x8a'),'to','cc',_0xc063('0x8b'),_0xc063('0x8c'),'createdAt'],'include':_0x300bf8[_0xc063('0x31')][_0xc063('0x54')]?[{'model':db[_0xc063('0x8d')],'as':_0xc063('0x8e')}]:undefined})[_0xc063('0x25')](handleEntityNotFound(_0x46e01e,null))[_0xc063('0x25')](function(_0x9b6f69){if(_0x9b6f69){var _0xf9fb2a=_0x9b6f69;var _0x3974da={'from':_0xf9fb2a[_0xc063('0x8a')],'to':_0xf9fb2a['to'],'subject':_0xf9fb2a['subject'],'html':htmlEntities[_0xc063('0x8f')](_0xf9fb2a[_0xc063('0x45')]),'headers':{'Date':moment(_0xf9fb2a['createdAt'])[_0xc063('0x65')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x9b6f69['cc']){_0x3974da[_0xc063('0x90')]['Cc']=_0x9b6f69['cc'];}if(_0x9b6f69[_0xc063('0x8b')]){_0x3974da[_0xc063('0x90')][_0xc063('0x91')]=_0x9b6f69[_0xc063('0x8b')];}return new BPromise(function(_0x585ffb,_0x26b071){if(_0x9b6f69[_0xc063('0x8e')]){for(var _0x1e4ab5=0x0;_0x1e4ab5<_0x9b6f69[_0xc063('0x8e')][_0xc063('0x37')];_0x1e4ab5++){var _0x1bf3d5=_0x9b6f69[_0xc063('0x8e')][_0x1e4ab5];var _0x3b7bfb=path[_0xc063('0x55')](_0x1b5354,_0x1bf3d5['basename']);if(fs[_0xc063('0x92')](_0x3b7bfb)){_0x3974da['attachments'][_0xc063('0x93')]({'name':_0x1bf3d5[_0xc063('0x28')],'contentType':_0x1bf3d5['type'],'data':fs[_0xc063('0x94')](_0x3b7bfb)});}}}emlformat[_0xc063('0x95')](_0x3974da,function(_0x4a3446,_0x29470b){if(_0x4a3446)return _0x26b071(_0x4a3446);fs[_0xc063('0x96')](path[_0xc063('0x55')](_0x51799c,_0x540851),_0x29470b);return _0x585ffb(_0x29470b);});});}})[_0xc063('0x25')](function(_0x3c22c3){if(_0x3c22c3){return _0x46e01e[_0xc063('0x83')](path[_0xc063('0x55')](_0x51799c,_0x540851),_0x540851,function(_0x30ce36){if(!_0x30ce36)fs[_0xc063('0x97')](path['join'](_0x51799c,_0x540851));});}})[_0xc063('0x1c')](handleError(_0x46e01e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 841ed19..76b418b 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 _0x41fa=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x4393a9,_0x5357c6){var _0x54a13e=function(_0x59a1e0){while(--_0x59a1e0){_0x4393a9['push'](_0x4393a9['shift']());}};_0x54a13e(++_0x5357c6);}(_0x41fa,0xa0));var _0xa41f=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x41fa[_0x58c851];return _0x534d8a;};'use strict';var EventEmitter=require(_0xa41f('0x0'));var MailMessage=require(_0xa41f('0x1'))['db'][_0xa41f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa41f('0x3')](0x0);var events={'afterCreate':_0xa41f('0x4'),'afterUpdate':_0xa41f('0x5'),'afterDestroy':_0xa41f('0x6')};function emitEvent(_0x25d378){return function(_0x568b2d,_0x468d00,_0x35bda1){MailMessageEvents['emit'](_0x25d378+':'+_0x568b2d['id'],_0x568b2d);MailMessageEvents[_0xa41f('0x7')](_0x25d378,_0x568b2d);_0x35bda1(null);};}for(var e in events){if(events[_0xa41f('0x8')](e)){var event=events[e];MailMessage[_0xa41f('0x9')](e,emitEvent(event));}}module[_0xa41f('0xa')]=MailMessageEvents; \ No newline at end of file +var _0xeb79=['save','update','remove','hook','events','MailMessage','setMaxListeners'];(function(_0x22204e,_0x2a5343){var _0x446396=function(_0x843e43){while(--_0x843e43){_0x22204e['push'](_0x22204e['shift']());}};_0x446396(++_0x2a5343);}(_0xeb79,0x18c));var _0x9eb7=function(_0x410b1d,_0x331cbd){_0x410b1d=_0x410b1d-0x0;var _0x5b9a89=_0xeb79[_0x410b1d];return _0x5b9a89;};'use strict';var EventEmitter=require(_0x9eb7('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x9eb7('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9eb7('0x2')](0x0);var events={'afterCreate':_0x9eb7('0x3'),'afterUpdate':_0x9eb7('0x4'),'afterDestroy':_0x9eb7('0x5')};function emitEvent(_0x56af88){return function(_0x999b20,_0x192e0d,_0x27766a){MailMessageEvents['emit'](_0x56af88+':'+_0x999b20['id'],_0x999b20);MailMessageEvents['emit'](_0x56af88,_0x999b20);_0x27766a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9eb7('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 87ad8c4..48dbe22 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 _0x926e=['moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','createdAt','error','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x189d30,_0x4854d0){var _0x5bb07e=function(_0x3495c9){while(--_0x3495c9){_0x189d30['push'](_0x189d30['shift']());}};_0x5bb07e(++_0x4854d0);}(_0x926e,0x11f));var _0xe926=function(_0x217cf5,_0x38598e){_0x217cf5=_0x217cf5-0x0;var _0x1be1c2=_0x926e[_0x217cf5];return _0x1be1c2;};'use strict';var _=require(_0xe926('0x0'));var util=require('util');var logger=require(_0xe926('0x1'))(_0xe926('0x2'));var moment=require(_0xe926('0x3'));var BPromise=require('bluebird');var rp=require(_0xe926('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe926('0x5'));var rimraf=require(_0xe926('0x6'));var config=require(_0xe926('0x7'));var attributes=require(_0xe926('0x8'));module[_0xe926('0x9')]=function(_0x202d1e,_0x21e719){return _0x202d1e['define'](_0xe926('0xa'),attributes,{'tableName':_0xe926('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xe926('0xc'),'fields':[_0xe926('0xd'),_0xe926('0xe')],'type':_0xe926('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x262b23,_0x23516e,_0x589852){if(_0x262b23['body']){_0x262b23[_0xe926('0xd')]=htmlToText['fromString'](_0x262b23[_0xe926('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x589852(null,_0x23516e);},'afterCreate':function(_0x4eda54,_0x9645c5,_0x29c818){var _0x1fe92e=_0x202d1e['models'];var _0x2a1869=_0x4eda54[_0xe926('0x11')]({'plain':!![]});if(_0x2a1869[_0xe926('0x12')]['toLowerCase']()==='in'||_0x2a1869[_0xe926('0x12')][_0xe926('0x13')]()===_0xe926('0x14')&&!_0x2a1869[_0xe926('0x15')]&&!_[_0xe926('0x16')](_0x2a1869['UserId'])){_0x1fe92e[_0xe926('0x17')][_0xe926('0x18')]({'where':{'id':_0x2a1869[_0xe926('0x19')]}})['then'](function(_0x1403cf){if(_0x1403cf){_0x1403cf['update']({'lastMsgAt':_0x2a1869[_0xe926('0x1a')],'lastMsgDirection':_0x2a1869[_0xe926('0x12')][_0xe926('0x13')]()});}})['catch'](function(_0xb33fff){console[_0xe926('0x1b')](_0xb33fff);});}_0x29c818();}},'charset':'utf8mb4','collate':_0xe926('0x1c')});}; \ No newline at end of file +var _0x15fc=['plainBody','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','FULLTEXT','body'];(function(_0x9a138c,_0x2607f8){var _0x3771a3=function(_0x22ebbb){while(--_0x22ebbb){_0x9a138c['push'](_0x9a138c['shift']());}};_0x3771a3(++_0x2607f8);}(_0x15fc,0x70));var _0xc15f=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x15fc[_0x5b64a1];return _0x4b6f55;};'use strict';var _=require(_0xc15f('0x0'));var util=require(_0xc15f('0x1'));var logger=require(_0xc15f('0x2'))(_0xc15f('0x3'));var moment=require(_0xc15f('0x4'));var BPromise=require(_0xc15f('0x5'));var rp=require('request-promise');var htmlToText=require(_0xc15f('0x6'));var fs=require('fs');var path=require(_0xc15f('0x7'));var rimraf=require(_0xc15f('0x8'));var config=require('../../config/environment');var attributes=require(_0xc15f('0x9'));module[_0xc15f('0xa')]=function(_0x12349b,_0x1f0743){return _0x12349b['define'](_0xc15f('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xc15f('0xc'),'fields':[_0xc15f('0xc')]},{'name':_0xc15f('0xd'),'fields':['plainBody','subject'],'type':_0xc15f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x427833,_0x415f7b,_0x2bee09){if(_0x427833[_0xc15f('0xf')]){_0x427833[_0xc15f('0x10')]=htmlToText['fromString'](_0x427833[_0xc15f('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2bee09(null,_0x415f7b);},'afterCreate':function(_0x8e8069,_0xd580ec,_0x11b2af){var _0x4f06c2=_0x12349b['models'];var _0x35b633=_0x8e8069[_0xc15f('0x11')]({'plain':!![]});if(_0x35b633[_0xc15f('0x12')]['toLowerCase']()==='in'||_0x35b633[_0xc15f('0x12')][_0xc15f('0x13')]()===_0xc15f('0x14')&&!_0x35b633[_0xc15f('0x15')]&&!_[_0xc15f('0x16')](_0x35b633[_0xc15f('0x17')])){_0x4f06c2['MailInteraction'][_0xc15f('0x18')]({'where':{'id':_0x35b633[_0xc15f('0x19')]}})[_0xc15f('0x1a')](function(_0x3b6cd2){if(_0x3b6cd2){_0x3b6cd2[_0xc15f('0x1b')]({'lastMsgAt':_0x35b633[_0xc15f('0x1c')],'lastMsgDirection':_0x35b633[_0xc15f('0x12')][_0xc15f('0x13')]()});}})['catch'](function(_0x3cde35){console[_0xc15f('0x1d')](_0x3cde35);});}_0x11b2af();}},'charset':_0xc15f('0x1e'),'collate':_0xc15f('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 99c6f23..d604966 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 _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a89a8,_0x2ea1a3){var _0x5f19da=function(_0x58bc12){while(--_0x58bc12){_0x3a89a8['push'](_0x3a89a8['shift']());}};_0x5f19da(++_0x2ea1a3);}(_0x7d25,0x8a));var _0x57d2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x7d25[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file +var _0xd914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash'];(function(_0x18063f,_0x3efbaf){var _0x116771=function(_0x366444){while(--_0x366444){_0x18063f['push'](_0x18063f['shift']());}};_0x116771(++_0x3efbaf);}(_0xd914,0x17f));var _0x4d91=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xd914[_0x26bf51];return _0x503415;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});config[_0x4d91('0xb')]=_[_0x4d91('0xc')](config[_0x4d91('0xb')],{'host':_0x4d91('0xd'),'port':0x18eb});var socket=require(_0x4d91('0xe'))(new Redis(config[_0x4d91('0xb')]));require('./mailMessage.socket')[_0x4d91('0xf')](socket);function respondWithRpcPromise(_0xa4bb25,_0xc07c64,_0x278648){return new BPromise(function(_0xb234d2,_0x266b31){return client['request'](_0xa4bb25,_0x278648)['then'](function(_0x2ccd08){logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));logger[_0x4d91('0x13')](_0x4d91('0x14'),_0xc07c64,'request\x20sent',JSON['stringify'](_0x2ccd08));if(_0x2ccd08[_0x4d91('0x15')]){if(_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x16')]===0x1f4){logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0x266b31(_0x2ccd08['error'][_0x4d91('0x17')]);}logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0xb234d2(_0x2ccd08['error'][_0x4d91('0x17')]);}else{logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));_0xb234d2(_0x2ccd08['result'][_0x4d91('0x17')]);}})[_0x4d91('0x18')](function(_0x13254c){logger['error'](_0x4d91('0x11'),_0xc07c64,_0x13254c);_0x266b31(_0x13254c);});});}exports[_0x4d91('0x19')]=function(_0x351388){var _0xd59fe=this;return new Promise(function(_0x10b767,_0x40cde4){return db[_0x4d91('0x1a')][_0x4d91('0x1b')](_0x351388[_0x4d91('0x1c')],{'raw':_0x351388[_0x4d91('0x1d')]?_0x351388['options'][_0x4d91('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x57913e){logger[_0x4d91('0x10')](_0x4d91('0x19'),_0x351388);logger[_0x4d91('0x13')](_0x4d91('0x19'),_0x351388,JSON[_0x4d91('0x1f')](_0x57913e));_0x10b767(_0x57913e);})[_0x4d91('0x18')](function(_0x100cd4){logger[_0x4d91('0x15')]('CreateMailMessage',_0x100cd4['message'],_0x351388);_0x40cde4(_0xd59fe[_0x4d91('0x15')](0x1f4,_0x100cd4[_0x4d91('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 384927d..1b01e3c 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 _0xa30d=['remove','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x5524a2,_0x130dfd){var _0x1abb56=function(_0x357a98){while(--_0x357a98){_0x5524a2['push'](_0x5524a2['shift']());}};_0x1abb56(++_0x130dfd);}(_0xa30d,0x1e9));var _0xda30=function(_0x41eba9,_0x104cd1){_0x41eba9=_0x41eba9-0x0;var _0x1f4554=_0xa30d[_0x41eba9];return _0x1f4554;};'use strict';var MailMessageEvents=require(_0xda30('0x0'));var events=['save',_0xda30('0x1'),'update'];function createListener(_0x3f4e06,_0x320689){return function(_0x1c38b1){_0x320689[_0xda30('0x2')](_0x3f4e06,_0x1c38b1);};}function removeListener(_0x417353,_0x43370a){return function(){MailMessageEvents[_0xda30('0x3')](_0x417353,_0x43370a);};}exports[_0xda30('0x4')]=function(_0x4ae145){for(var _0x47f74f=0x0,_0x2bd3a6=events[_0xda30('0x5')];_0x47f74f<_0x2bd3a6;_0x47f74f++){var _0x5bcbe1=events[_0x47f74f];var _0x5cc3ee=createListener(_0xda30('0x6')+_0x5bcbe1,_0x4ae145);MailMessageEvents['on'](_0x5bcbe1,_0x5cc3ee);}}; \ No newline at end of file +var _0x9fd0=['length','./mailMessage.events','save','emit','removeListener','register'];(function(_0x536429,_0x4bee75){var _0x450a77=function(_0x2aa1fd){while(--_0x2aa1fd){_0x536429['push'](_0x536429['shift']());}};_0x450a77(++_0x4bee75);}(_0x9fd0,0x9d));var _0x09fd=function(_0xa9d6d1,_0x3762b2){_0xa9d6d1=_0xa9d6d1-0x0;var _0x53a4cb=_0x9fd0[_0xa9d6d1];return _0x53a4cb;};'use strict';var MailMessageEvents=require(_0x09fd('0x0'));var events=[_0x09fd('0x1'),'remove','update'];function createListener(_0x9feaae,_0x2c96ee){return function(_0x307570){_0x2c96ee[_0x09fd('0x2')](_0x9feaae,_0x307570);};}function removeListener(_0x106809,_0x1f0987){return function(){MailMessageEvents[_0x09fd('0x3')](_0x106809,_0x1f0987);};}exports[_0x09fd('0x4')]=function(_0x819b69){for(var _0x2ec740=0x0,_0x4120c0=events[_0x09fd('0x5')];_0x2ec740<_0x4120c0;_0x2ec740++){var _0x2a99ed=events[_0x2ec740];var _0x7a5af2=createListener('mailMessage:'+_0x2a99ed,_0x819b69);MailMessageEvents['on'](_0x2a99ed,_0x7a5af2);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6d95846..0b6d3dc 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 _0x141d=['update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/members','/:id/teams','getAgents','post','addTeams','addAgents','put'];(function(_0x490601,_0xa8a348){var _0x10f9b2=function(_0x7c3bf0){while(--_0x7c3bf0){_0x490601['push'](_0x490601['shift']());}};_0x10f9b2(++_0xa8a348);}(_0x141d,0x165));var _0xd141=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x141d[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0xd141('0x0'));var util=require(_0xd141('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd141('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd141('0x3'));var interaction=require(_0xd141('0x4'));var config=require(_0xd141('0x5'));var controller=require('./mailQueue.controller');router[_0xd141('0x6')]('/',auth[_0xd141('0x7')](),controller[_0xd141('0x8')]);router[_0xd141('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd141('0x9')]);router[_0xd141('0x6')](_0xd141('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd141('0x6')](_0xd141('0xb'),auth[_0xd141('0x7')](),controller['getMembers']);router['get'](_0xd141('0xc'),auth[_0xd141('0x7')](),controller['getTeams']);router[_0xd141('0x6')]('/:id/users',auth[_0xd141('0x7')](),controller[_0xd141('0xd')]);router[_0xd141('0xe')]('/',auth[_0xd141('0x7')](),controller['create']);router['post'](_0xd141('0xc'),auth['isAuthenticated'](),controller[_0xd141('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xd141('0x10')]);router[_0xd141('0x11')](_0xd141('0xa'),auth[_0xd141('0x7')](),controller[_0xd141('0x12')]);router[_0xd141('0x13')]('/:id',auth[_0xd141('0x7')](),controller[_0xd141('0x14')]);router[_0xd141('0x13')](_0xd141('0xc'),auth[_0xd141('0x7')](),controller[_0xd141('0x15')]);router[_0xd141('0x13')](_0xd141('0x16'),auth['isAuthenticated'](),controller[_0xd141('0x17')]);module[_0xd141('0x18')]=router; \ No newline at end of file +var _0x25d5=['fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path'];(function(_0x4fb5ca,_0x3cf9ba){var _0xebce6b=function(_0x55f8c2){while(--_0x55f8c2){_0x4fb5ca['push'](_0x4fb5ca['shift']());}};_0xebce6b(++_0x3cf9ba);}(_0x25d5,0x1ae));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x525d('0x0'));var util=require('util');var path=require(_0x525d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x525d('0x2'));var auth=require(_0x525d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x525d('0x4'));var controller=require(_0x525d('0x5'));router[_0x525d('0x6')]('/',auth[_0x525d('0x7')](),controller[_0x525d('0x8')]);router[_0x525d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x525d('0x9')]);router[_0x525d('0x6')](_0x525d('0xa'),auth[_0x525d('0x7')](),controller[_0x525d('0xb')]);router['get'](_0x525d('0xc'),auth['isAuthenticated'](),controller[_0x525d('0xd')]);router[_0x525d('0x6')](_0x525d('0xe'),auth[_0x525d('0x7')](),controller[_0x525d('0xf')]);router['get'](_0x525d('0x10'),auth[_0x525d('0x7')](),controller[_0x525d('0x11')]);router[_0x525d('0x12')]('/',auth[_0x525d('0x7')](),controller[_0x525d('0x13')]);router['post'](_0x525d('0xe'),auth[_0x525d('0x7')](),controller['addTeams']);router[_0x525d('0x12')](_0x525d('0x10'),auth[_0x525d('0x7')](),controller[_0x525d('0x14')]);router[_0x525d('0x15')](_0x525d('0xa'),auth['isAuthenticated'](),controller[_0x525d('0x16')]);router[_0x525d('0x17')](_0x525d('0xa'),auth['isAuthenticated'](),controller[_0x525d('0x18')]);router[_0x525d('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x525d('0x19')]);router['delete'](_0x525d('0x10'),auth[_0x525d('0x7')](),controller['removeAgents']);module[_0x525d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1574c3e..42f9064 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 _0x2eeb=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x3194c0,_0x17665b){var _0x2eb6f5=function(_0x248937){while(--_0x248937){_0x3194c0['push'](_0x3194c0['shift']());}};_0x2eb6f5(++_0x17665b);}(_0x2eeb,0x77));var _0xb2ee=function(_0x323cd8,_0x5672be){_0x323cd8=_0x323cd8-0x0;var _0x1d3e5b=_0x2eeb[_0x323cd8];return _0x1d3e5b;};'use strict';var Sequelize=require(_0xb2ee('0x0'));module[_0xb2ee('0x1')]={'name':{'type':Sequelize[_0xb2ee('0x2')],'unique':_0xb2ee('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb2ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb2ee('0x5'),'beepall',_0xb2ee('0x6'))}}; \ No newline at end of file +var _0xc097=['STRING','name','INTEGER','beepall','roundrobin','exports'];(function(_0x3e2af6,_0x98c3df){var _0x3ee7af=function(_0x2ec8bd){while(--_0x2ec8bd){_0x3e2af6['push'](_0x3e2af6['shift']());}};_0x3ee7af(++_0x98c3df);}(_0xc097,0x155));var _0x7c09=function(_0x5a8fcc,_0x22da25){_0x5a8fcc=_0x5a8fcc-0x0;var _0x53c9b3=_0xc097[_0x5a8fcc];return _0x53c9b3;};'use strict';var Sequelize=require('sequelize');module[_0x7c09('0x0')]={'name':{'type':Sequelize[_0x7c09('0x1')],'unique':_0x7c09('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7c09('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7c09('0x4'),_0x7c09('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8046762..605d4e9 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 _0xbe5d=['fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','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','getMembers','findOne','nolimit','order','pick','MailQueueId','UserMailQueue','User','agent','mailPause','updatedAt','createdAt','%s/%s','Team','getTeams','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','union','compact','isEmpty','removeAgents','emit','addAgents','omit','spread','userMailQueue:save','userMailQueue:remove','getAgents','rawAttributes','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0x9bab6a,_0x6992ea){var _0x1ff6e2=function(_0x2cccd8){while(--_0x2cccd8){_0x9bab6a['push'](_0x9bab6a['shift']());}};_0x1ff6e2(++_0x6992ea);}(_0xbe5d,0xd4));var _0xdbe5=function(_0x1df16b,_0x47cdef){_0x1df16b=_0x1df16b-0x0;var _0x449165=_0xbe5d[_0x1df16b];return _0x449165;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbe5('0x0'));var zipdir=require(_0xdbe5('0x1'));var jsonpatch=require(_0xdbe5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbe5('0x3'));var util=require(_0xdbe5('0x4'));var path=require(_0xdbe5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbe5('0x6'));var _=require(_0xdbe5('0x7'));var squel=require(_0xdbe5('0x8'));var crypto=require(_0xdbe5('0x9'));var jsforce=require(_0xdbe5('0xa'));var deskjs=require(_0xdbe5('0xb'));var toCsv=require(_0xdbe5('0xc'));var querystring=require(_0xdbe5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbe5('0xe'));var qs=require(_0xdbe5('0xf'));var as=require(_0xdbe5('0x10'));var hardwareService=require(_0xdbe5('0x11'));var logger=require('../../config/logger')(_0xdbe5('0x12'));var utils=require(_0xdbe5('0x13'));var config=require(_0xdbe5('0x14'));var licenseUtil=require(_0xdbe5('0x15'));var db=require(_0xdbe5('0x16'))['db'];config['redis']=_['defaults'](config[_0xdbe5('0x17')],{'host':_0xdbe5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbe5('0x17')]));require(_0xdbe5('0x19'))[_0xdbe5('0x1a')](socket);function respondWithStatusCode(_0x2802ba,_0x1c17ce){_0x1c17ce=_0x1c17ce||0xcc;return function(_0x2375fa){if(_0x2375fa){return _0x2802ba[_0xdbe5('0x1b')](_0x1c17ce);}return _0x2802ba[_0xdbe5('0x1c')](_0x1c17ce)['end']();};}function respondWithResult(_0x50c748,_0x1f09ec){_0x1f09ec=_0x1f09ec||0xc8;return function(_0x1fcdaf){if(_0x1fcdaf){return _0x50c748[_0xdbe5('0x1c')](_0x1f09ec)[_0xdbe5('0x1d')](_0x1fcdaf);}};}function respondWithFilteredResult(_0x539115,_0x18bacc){return function(_0x2033a3){if(_0x2033a3){var _0x408a92=typeof _0x18bacc[_0xdbe5('0x1e')]===_0xdbe5('0x1f')&&typeof _0x18bacc[_0xdbe5('0x20')]===_0xdbe5('0x1f');var _0x18802f=_0x2033a3[_0xdbe5('0x21')];var _0x3be20f=_0x408a92?0x0:_0x18bacc[_0xdbe5('0x1e')];var _0x64952c=_0x408a92?_0x2033a3[_0xdbe5('0x21')]:_0x18bacc[_0xdbe5('0x1e')]+_0x18bacc[_0xdbe5('0x20')];var _0x58eb2d;if(_0x64952c>=_0x18802f){_0x64952c=_0x18802f;_0x58eb2d=0xc8;}else{_0x58eb2d=0xce;}_0x539115['status'](_0x58eb2d);return _0x539115[_0xdbe5('0x22')](_0xdbe5('0x23'),_0x3be20f+'-'+_0x64952c+'/'+_0x18802f)['json'](_0x2033a3);}return null;};}function patchUpdates(_0x1ce2da){return function(_0x4c37d3){try{jsonpatch['apply'](_0x4c37d3,_0x1ce2da,!![]);}catch(_0x30bcaf){return BPromise[_0xdbe5('0x24')](_0x30bcaf);}return _0x4c37d3[_0xdbe5('0x25')]();};}function saveUpdates(_0x1fb509,_0x138006){return function(_0x504fd5){if(_0x504fd5){return _0x504fd5[_0xdbe5('0x26')](_0x1fb509)[_0xdbe5('0x27')](function(_0x230ac3){return _0x230ac3;});}return null;};}function removeEntity(_0x30c12d,_0x33e838){return function(_0x51f974){if(_0x51f974){return _0x51f974[_0xdbe5('0x28')]()[_0xdbe5('0x27')](function(){var _0x5a7531=_0x51f974[_0xdbe5('0x29')]({'plain':!![]});var _0xd10441=_0xdbe5('0x2a');return db[_0xdbe5('0x2b')][_0xdbe5('0x28')]({'where':{'type':_0xd10441,'resourceId':_0x5a7531['id']}})[_0xdbe5('0x27')](function(){return _0x51f974;});})[_0xdbe5('0x27')](function(){_0x30c12d[_0xdbe5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2483a7,_0x355cd8){return function(_0xcab060){if(!_0xcab060){_0x2483a7[_0xdbe5('0x1b')](0x194);}return _0xcab060;};}function handleError(_0x15e7d7,_0x4dc8f1){_0x4dc8f1=_0x4dc8f1||0x1f4;return function(_0x10ef5a){logger[_0xdbe5('0x2c')](_0x10ef5a[_0xdbe5('0x2d')]);if(_0x10ef5a[_0xdbe5('0x2e')]){delete _0x10ef5a[_0xdbe5('0x2e')];}_0x15e7d7[_0xdbe5('0x1c')](_0x4dc8f1)['send'](_0x10ef5a);};}exports[_0xdbe5('0x2f')]=function(_0x1e6949,_0x150490){var _0x4f7b02={},_0xe93271={},_0x2fe080={'count':0x0,'rows':[]};var _0x33c6e1=_[_0xdbe5('0x30')](db[_0xdbe5('0x31')]['rawAttributes'],function(_0x3be595){return{'name':_0x3be595[_0xdbe5('0x32')],'type':_0x3be595['type'][_0xdbe5('0x33')]};});_0xe93271[_0xdbe5('0x34')]=_[_0xdbe5('0x30')](_0x33c6e1,_0xdbe5('0x2e'));_0xe93271[_0xdbe5('0x35')]=_[_0xdbe5('0x36')](_0x1e6949[_0xdbe5('0x35')]);_0xe93271[_0xdbe5('0x37')]=_['intersection'](_0xe93271['model'],_0xe93271[_0xdbe5('0x35')]);_0x4f7b02[_0xdbe5('0x38')]=_[_0xdbe5('0x39')](_0xe93271[_0xdbe5('0x34')],qs[_0xdbe5('0x3a')](_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x3a')]));_0x4f7b02[_0xdbe5('0x38')]=_0x4f7b02[_0xdbe5('0x38')]['length']?_0x4f7b02['attributes']:_0xe93271['model'];if(!_0x1e6949['query'][_0xdbe5('0x3b')]('nolimit')){_0x4f7b02[_0xdbe5('0x20')]=qs[_0xdbe5('0x20')](_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x20')]);_0x4f7b02[_0xdbe5('0x1e')]=qs[_0xdbe5('0x1e')](_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x1e')]);}_0x4f7b02['order']=qs[_0xdbe5('0x3c')](_0x1e6949['query']['sort']);_0x4f7b02[_0xdbe5('0x3d')]=qs[_0xdbe5('0x37')](_['pick'](_0x1e6949['query'],_0xe93271[_0xdbe5('0x37')]),_0x33c6e1);if(_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x3e')]){_0x4f7b02[_0xdbe5('0x3d')]=_[_0xdbe5('0x3f')](_0x4f7b02[_0xdbe5('0x3d')],{'$or':_[_0xdbe5('0x30')](_0x33c6e1,function(_0x19da60){if(_0x19da60['type']!==_0xdbe5('0x40')){var _0x401230={};_0x401230[_0x19da60[_0xdbe5('0x2e')]]={'$like':'%'+_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x3e')]+'%'};return _0x401230;}})});}_0x4f7b02=_[_0xdbe5('0x3f')]({},_0x4f7b02,_0x1e6949['options']);var _0x171145={'where':_0x4f7b02[_0xdbe5('0x3d')]};return db[_0xdbe5('0x31')][_0xdbe5('0x21')](_0x171145)[_0xdbe5('0x27')](function(_0x2311f4){_0x2fe080[_0xdbe5('0x21')]=_0x2311f4;if(_0x1e6949[_0xdbe5('0x35')][_0xdbe5('0x41')]){_0x4f7b02[_0xdbe5('0x42')]=[{'all':!![]}];}return db[_0xdbe5('0x31')][_0xdbe5('0x43')](_0x4f7b02);})['then'](function(_0x1a4c50){_0x2fe080[_0xdbe5('0x44')]=_0x1a4c50;return _0x2fe080;})[_0xdbe5('0x27')](respondWithFilteredResult(_0x150490,_0x4f7b02))[_0xdbe5('0x45')](handleError(_0x150490,null));};exports[_0xdbe5('0x46')]=function(_0x4091af,_0x219ca5){var _0x411292={'raw':!![],'where':{'id':_0x4091af['params']['id']}},_0x4bfdae={};_0x4bfdae['model']=_[_0xdbe5('0x36')](db[_0xdbe5('0x31')]['rawAttributes']);_0x4bfdae[_0xdbe5('0x35')]=_[_0xdbe5('0x36')](_0x4091af['query']);_0x4bfdae['filters']=_[_0xdbe5('0x39')](_0x4bfdae[_0xdbe5('0x34')],_0x4bfdae['query']);_0x411292['attributes']=_[_0xdbe5('0x39')](_0x4bfdae['model'],qs[_0xdbe5('0x3a')](_0x4091af['query']['fields']));_0x411292[_0xdbe5('0x38')]=_0x411292[_0xdbe5('0x38')][_0xdbe5('0x47')]?_0x411292[_0xdbe5('0x38')]:_0x4bfdae[_0xdbe5('0x34')];if(_0x4091af[_0xdbe5('0x35')][_0xdbe5('0x41')]){_0x411292[_0xdbe5('0x42')]=[{'all':!![]}];}_0x411292=_[_0xdbe5('0x3f')]({},_0x411292,_0x4091af[_0xdbe5('0x48')]);return db['MailQueue'][_0xdbe5('0x49')](_0x411292)[_0xdbe5('0x27')](handleEntityNotFound(_0x219ca5,null))[_0xdbe5('0x27')](respondWithResult(_0x219ca5,null))[_0xdbe5('0x45')](handleError(_0x219ca5,null));};exports['create']=function(_0x5a4bf7,_0x25d026){return db[_0xdbe5('0x31')][_0xdbe5('0x4a')](_0x5a4bf7['body'],{})[_0xdbe5('0x27')](function(_0x13aca1){var _0x17aa08=_0x5a4bf7[_0xdbe5('0x4b')][_0xdbe5('0x29')]({'plain':!![]});if(!_0x17aa08)throw new Error(_0xdbe5('0x4c'));if(_0x17aa08[_0xdbe5('0x4d')]==='user'){var _0x111a02=_0x13aca1[_0xdbe5('0x29')]({'plain':!![]});var _0x4c5dc3=_0xdbe5('0x2a');return db[_0xdbe5('0x4e')][_0xdbe5('0x49')]({'where':{'name':_0x4c5dc3,'userProfileId':_0x17aa08[_0xdbe5('0x4f')]},'raw':!![]})[_0xdbe5('0x27')](function(_0x34d7a4){if(_0x34d7a4&&_0x34d7a4[_0xdbe5('0x50')]===0x0){return db[_0xdbe5('0x2b')][_0xdbe5('0x4a')]({'name':_0x111a02['name'],'resourceId':_0x111a02['id'],'type':_0x34d7a4[_0xdbe5('0x2e')],'sectionId':_0x34d7a4['id']},{})[_0xdbe5('0x27')](function(){return _0x13aca1;});}else{return _0x13aca1;}})['catch'](function(_0x279a1a){logger[_0xdbe5('0x2c')](_0xdbe5('0x51'),_0x279a1a);throw _0x279a1a;});}return _0x13aca1;})[_0xdbe5('0x27')](respondWithResult(_0x25d026,0xc9))[_0xdbe5('0x45')](handleError(_0x25d026,null));};exports[_0xdbe5('0x26')]=function(_0x3708f7,_0x4b66f6){if(_0x3708f7[_0xdbe5('0x52')]['id']){delete _0x3708f7[_0xdbe5('0x52')]['id'];}return db[_0xdbe5('0x31')][_0xdbe5('0x49')]({'where':{'id':_0x3708f7[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x4b66f6,null))[_0xdbe5('0x27')](saveUpdates(_0x3708f7[_0xdbe5('0x52')],null))[_0xdbe5('0x27')](respondWithResult(_0x4b66f6,null))['catch'](handleError(_0x4b66f6,null));};exports['destroy']=function(_0xf0dad8,_0x301415){return db[_0xdbe5('0x31')][_0xdbe5('0x49')]({'where':{'id':_0xf0dad8[_0xdbe5('0x53')]['id']}})['then'](handleEntityNotFound(_0x301415,null))['then'](removeEntity(_0x301415,null))[_0xdbe5('0x45')](handleError(_0x301415,null));};exports[_0xdbe5('0x54')]=function(_0xf067f6,_0x584509){return db['MailQueue']['describe']()[_0xdbe5('0x27')](respondWithResult(_0x584509,null))['catch'](handleError(_0x584509,null));};exports[_0xdbe5('0x55')]=function(_0x1550b0,_0x2b5630,_0x113022){var _0x5f388f={'raw':!![],'where':{}},_0x539860={},_0x181edb;return db[_0xdbe5('0x31')][_0xdbe5('0x56')]({'where':{'id':_0x1550b0[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x2b5630,null))[_0xdbe5('0x27')](function(_0x219bbc){if(_0x219bbc){_0x181edb=_0x219bbc[_0xdbe5('0x29')]({'plain':!![]});_0x539860['model']=_[_0xdbe5('0x36')](db['UserMailQueue']['rawAttributes']);_0x539860[_0xdbe5('0x35')]=_[_0xdbe5('0x36')](_0x1550b0[_0xdbe5('0x35')]);_0x539860[_0xdbe5('0x37')]=_[_0xdbe5('0x39')](_0x539860[_0xdbe5('0x34')],_0x539860[_0xdbe5('0x35')]);_0x5f388f[_0xdbe5('0x38')]=_[_0xdbe5('0x39')](_0x539860['model'],qs[_0xdbe5('0x3a')](_0x1550b0[_0xdbe5('0x35')][_0xdbe5('0x3a')]));_0x5f388f['attributes']=_0x5f388f[_0xdbe5('0x38')][_0xdbe5('0x47')]?_0x5f388f[_0xdbe5('0x38')]:_0x539860[_0xdbe5('0x34')];if(!_0x1550b0[_0xdbe5('0x35')][_0xdbe5('0x3b')](_0xdbe5('0x57'))){_0x5f388f[_0xdbe5('0x20')]=qs[_0xdbe5('0x20')](_0x1550b0[_0xdbe5('0x35')][_0xdbe5('0x20')]);_0x5f388f[_0xdbe5('0x1e')]=qs[_0xdbe5('0x1e')](_0x1550b0['query'][_0xdbe5('0x1e')]);}_0x5f388f[_0xdbe5('0x58')]=qs['sort'](_0x1550b0[_0xdbe5('0x35')][_0xdbe5('0x3c')]);_0x5f388f[_0xdbe5('0x3d')]=qs[_0xdbe5('0x37')](_[_0xdbe5('0x59')](_0x1550b0[_0xdbe5('0x35')],_0x539860['filters']));_0x5f388f['where'][_0xdbe5('0x5a')]=_0x219bbc['id'];if(_0x1550b0[_0xdbe5('0x35')][_0xdbe5('0x3e')]){_0x5f388f[_0xdbe5('0x3d')]=_['merge'](_0x5f388f[_0xdbe5('0x3d')],{'$or':_['map'](_0x5f388f[_0xdbe5('0x38')],function(_0x5199ef){var _0x21bae7={};_0x21bae7[_0x5199ef]={'$like':'%'+_0x1550b0['query'][_0xdbe5('0x3e')]+'%'};return _0x21bae7;})});}_0x5f388f=_['merge']({},_0x5f388f,_0x1550b0[_0xdbe5('0x48')]);return db[_0xdbe5('0x5b')][_0xdbe5('0x43')](_0x5f388f);}})[_0xdbe5('0x27')](function(_0x301eec){if(_0x301eec){return db[_0xdbe5('0x5c')]['findAndCountAll']({'where':{'id':_[_0xdbe5('0x30')](_0x301eec,'UserId'),'role':_0xdbe5('0x5d')},'attributes':['id',_0xdbe5('0x2e'),_0xdbe5('0x5e'),_0xdbe5('0x5f'),_0xdbe5('0x60')]});}})[_0xdbe5('0x27')](function(_0x4c1d57){if(_0x4c1d57){return{'count':_0x4c1d57[_0xdbe5('0x21')],'rows':_['map'](_0x4c1d57[_0xdbe5('0x44')],function(_0x24ec17){return{'membername':_0x24ec17[_0xdbe5('0x2e')],'UserId':_0x24ec17['id'],'queue_name':_0x181edb['name'],'MailQueueId':_0x181edb['id'],'interface':util['format'](_0xdbe5('0x61'),'SIP',_0x24ec17['name']),'penalty':0x0,'paused':_0x24ec17[_0xdbe5('0x5e')],'createdAt':_0x24ec17['createdAt'],'updatedAt':_0x24ec17['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdbe5('0x27')](respondWithFilteredResult(_0x2b5630,_0x5f388f))[_0xdbe5('0x45')](handleError(_0x2b5630,null));};exports['getTeams']=function(_0x2db173,_0x758fa6,_0xd764e5){var _0x28024c={};var _0xf63fe4={};var _0x441b7a;var _0x325595;return db['MailQueue'][_0xdbe5('0x56')]({'where':{'id':_0x2db173[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x758fa6,null))[_0xdbe5('0x27')](function(_0x5ef608){if(_0x5ef608){_0x441b7a=_0x5ef608;_0xf63fe4[_0xdbe5('0x34')]=_[_0xdbe5('0x36')](db[_0xdbe5('0x62')]['rawAttributes']);_0xf63fe4[_0xdbe5('0x35')]=_[_0xdbe5('0x36')](_0x2db173['query']);_0xf63fe4[_0xdbe5('0x37')]=_[_0xdbe5('0x39')](_0xf63fe4[_0xdbe5('0x34')],_0xf63fe4['query']);_0x28024c[_0xdbe5('0x38')]=_['intersection'](_0xf63fe4[_0xdbe5('0x34')],qs[_0xdbe5('0x3a')](_0x2db173['query']['fields']));_0x28024c[_0xdbe5('0x38')]=_0x28024c[_0xdbe5('0x38')][_0xdbe5('0x47')]?_0x28024c[_0xdbe5('0x38')]:_0xf63fe4[_0xdbe5('0x34')];_0x28024c[_0xdbe5('0x58')]=qs[_0xdbe5('0x3c')](_0x2db173['query'][_0xdbe5('0x3c')]);_0x28024c[_0xdbe5('0x3d')]=qs[_0xdbe5('0x37')](_[_0xdbe5('0x59')](_0x2db173['query'],_0xf63fe4[_0xdbe5('0x37')]));if(_0x2db173[_0xdbe5('0x35')]['filter']){_0x28024c['where']=_[_0xdbe5('0x3f')](_0x28024c[_0xdbe5('0x3d')],{'$or':_[_0xdbe5('0x30')](_0x28024c['attributes'],function(_0x5d8de3){var _0x364c8d={};_0x364c8d[_0x5d8de3]={'$like':'%'+_0x2db173[_0xdbe5('0x35')][_0xdbe5('0x3e')]+'%'};return _0x364c8d;})});}_0x28024c=_[_0xdbe5('0x3f')]({},_0x28024c,_0x2db173[_0xdbe5('0x48')]);return _0x441b7a[_0xdbe5('0x63')](_0x28024c);}})[_0xdbe5('0x27')](function(_0x1d0997){if(_0x1d0997){_0x325595=_0x1d0997[_0xdbe5('0x47')];if(!_0x2db173['query'][_0xdbe5('0x3b')](_0xdbe5('0x57'))){_0x28024c['limit']=qs[_0xdbe5('0x20')](_0x2db173['query'][_0xdbe5('0x20')]);_0x28024c['offset']=qs[_0xdbe5('0x1e')](_0x2db173[_0xdbe5('0x35')]['offset']);}return _0x441b7a[_0xdbe5('0x63')](_0x28024c);}})[_0xdbe5('0x27')](function(_0x45deb8){if(_0x45deb8){return _0x45deb8?{'count':_0x325595,'rows':_0x45deb8}:null;}})[_0xdbe5('0x27')](respondWithResult(_0x758fa6,null))[_0xdbe5('0x45')](handleError(_0x758fa6,null));};exports['addTeams']=function(_0x54b7fb,_0x417b68,_0xf9bc6d){var _0x126c6e=_0x54b7fb[_0xdbe5('0x52')][_0xdbe5('0x64')];return db[_0xdbe5('0x62')][_0xdbe5('0x43')]({'where':{'id':_0x126c6e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdbe5('0x65'),'attributes':['id','name','online','voicePause',_0xdbe5('0x66')],'raw':!![]}]})[_0xdbe5('0x27')](function(_0x3b89d4){if(_0x3b89d4){var _0x50c62c=_[_0xdbe5('0x67')](_0x3b89d4,function(_0x287b17){var _0x1d7c65=_0x287b17[_0xdbe5('0x29')]({'plain':!![]});return _0x1d7c65[_0xdbe5('0x65')];});return db[_0xdbe5('0x31')][_0xdbe5('0x49')]({'where':{'id':_0x54b7fb['params']['id']}})[_0xdbe5('0x27')](function(_0x30606f){return db[_0xdbe5('0x68')][_0xdbe5('0x69')](function(_0x2ad043){return _0x30606f[_0xdbe5('0x6a')](_0x126c6e,{'transaction':_0x2ad043})[_0xdbe5('0x27')](function(){return BPromise[_0xdbe5('0x6b')](_0x50c62c,function(_0xa94700){return db[_0xdbe5('0x5b')][_0xdbe5('0x6c')]({'where':{'UserId':_0xa94700['id'],'MailQueueId':_0x54b7fb['params']['id']},'transaction':_0x2ad043});});})[_0xdbe5('0x27')](function(){_0x50c62c[_0xdbe5('0x6d')](function(_0x26daa6){socket['emit']('userMailQueue:save',{'UserId':_0x26daa6['id'],'MailQueueId':_0x30606f['id']});});});});});}})[_0xdbe5('0x27')](respondWithStatusCode(_0x417b68,null))[_0xdbe5('0x45')](handleError(_0x417b68,null));};exports[_0xdbe5('0x6e')]=function(_0x59f8a6,_0x525e86,_0x4d1de8){return db['Team'][_0xdbe5('0x43')]({'where':{'id':_0x59f8a6[_0xdbe5('0x35')][_0xdbe5('0x64')]},'attributes':['id'],'include':[{'model':db[_0xdbe5('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdbe5('0x27')](handleEntityNotFound(_0x525e86,null))['then'](function(_0x297040){var _0x36f13a=_['map'](_0x297040,'id');var _0x529f2e=[];var _0x90abda=[];var _0x14138e=squel['select']();_0x14138e[_0xdbe5('0x6f')](_0xdbe5('0x70'))[_0xdbe5('0x71')](_0xdbe5('0x72'),'tq')[_0xdbe5('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdbe5('0x3d')](_0xdbe5('0x74'),_0x59f8a6[_0xdbe5('0x53')]['id']);for(var _0x5a7102=0x0;_0x5a7102<_0x297040[_0xdbe5('0x47')];_0x5a7102+=0x1){let _0x5e66ca=_0x297040[_0x5a7102];for(var _0x1e4492=0x0;_0x1e4492<_0x5e66ca[_0xdbe5('0x65')]['length'];_0x1e4492+=0x1){let _0x1497f2=_0x5e66ca['Agents'][_0x1e4492];var _0x2afb6d=_0x14138e[_0xdbe5('0x75')]();_0x2afb6d[_0xdbe5('0x3d')](_0xdbe5('0x76'),_0x1497f2['id']);_0x90abda['push'](db[_0xdbe5('0x68')][_0xdbe5('0x35')](_0x2afb6d[_0xdbe5('0x77')](),{'type':db[_0xdbe5('0x68')]['QueryTypes']['SELECT']})[_0xdbe5('0x27')](function(_0x3871ce){if(_0x3871ce[_0xdbe5('0x47')]===0x1){return _0x1497f2['id'];}else{var _0x2ddce8=_[_0xdbe5('0x78')](_[_0xdbe5('0x30')](_0x3871ce,_0xdbe5('0x79')),function(_0x3df0e5){return _[_0xdbe5('0x7a')](_0x36f13a,_0x3df0e5);});if(_0x2ddce8){return _0x1497f2['id'];}}}));}}return BPromise['all'](_0x90abda)['then'](function(_0x4c3eaf){_0x529f2e=_(_0x529f2e)[_0xdbe5('0x7b')](_0x4c3eaf)[_0xdbe5('0x7c')]()['value']();return db[_0xdbe5('0x31')][_0xdbe5('0x49')]({'where':{'id':_0x59f8a6[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](function(_0x328acf){return db['sequelize']['transaction'](function(_0x2c6b2c){return _0x328acf[_0xdbe5('0x6e')](_0x59f8a6[_0xdbe5('0x35')]['ids'],{'transaction':_0x2c6b2c})['then'](function(){if(!_[_0xdbe5('0x7d')](_0x529f2e)){return _0x328acf[_0xdbe5('0x7e')](_0x529f2e,{'transaction':_0x2c6b2c});}})[_0xdbe5('0x27')](function(){_0x529f2e[_0xdbe5('0x6d')](function(_0x2aa8a8){socket[_0xdbe5('0x7f')]('userMailQueue:remove',{'UserId':_0x2aa8a8,'MailQueueId':_0x328acf['id']});});});});});});})['then'](respondWithStatusCode(_0x525e86,null))['catch'](handleError(_0x525e86,null));};exports['addAgents']=function(_0x51b76e,_0x587198,_0x5d1ed1){return db[_0xdbe5('0x31')]['find']({'where':{'id':_0x51b76e[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x587198,null))[_0xdbe5('0x27')](function(_0x26dee4){if(_0x26dee4){return _0x26dee4[_0xdbe5('0x80')](_0x51b76e['body'][_0xdbe5('0x64')],_[_0xdbe5('0x81')](_0x51b76e['body'],['ids','id'])||{})[_0xdbe5('0x82')](function(_0x46ea6e){for(var _0x837922=0x0;_0x837922<_0x51b76e['body'][_0xdbe5('0x64')]['length'];_0x837922+=0x1){socket['emit'](_0xdbe5('0x83'),{'UserId':Number(_0x51b76e[_0xdbe5('0x52')][_0xdbe5('0x64')][_0x837922]),'MailQueueId':Number(_0x51b76e[_0xdbe5('0x53')]['id'])});}return _0x46ea6e;});}})['then'](respondWithResult(_0x587198,null))[_0xdbe5('0x45')](handleError(_0x587198,null));};exports[_0xdbe5('0x7e')]=function(_0xa61cca,_0x1de902,_0x39d0fa){return db[_0xdbe5('0x31')][_0xdbe5('0x49')]({'where':{'id':_0xa61cca[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x1de902,null))[_0xdbe5('0x27')](function(_0x34ee31){if(_0x34ee31){return _0x34ee31['removeAgents'](_0xa61cca[_0xdbe5('0x35')][_0xdbe5('0x64')])[_0xdbe5('0x27')](function(){if(_['isArray'](_0xa61cca[_0xdbe5('0x35')][_0xdbe5('0x64')])){for(var _0x109056=0x0;_0x109056<_0xa61cca[_0xdbe5('0x35')][_0xdbe5('0x64')][_0xdbe5('0x47')];_0x109056+=0x1){socket[_0xdbe5('0x7f')](_0xdbe5('0x84'),{'UserId':Number(_0xa61cca[_0xdbe5('0x35')][_0xdbe5('0x64')][_0x109056]),'MailQueueId':Number(_0xa61cca[_0xdbe5('0x53')]['id'])});}}else{socket[_0xdbe5('0x7f')]('userMailQueue:remove',{'UserId':Number(_0xa61cca[_0xdbe5('0x35')][_0xdbe5('0x64')]),'MailQueueId':Number(_0xa61cca[_0xdbe5('0x53')]['id'])});}});}})[_0xdbe5('0x27')](respondWithStatusCode(_0x1de902,null))[_0xdbe5('0x45')](handleError(_0x1de902,null));};exports[_0xdbe5('0x85')]=function(_0x2a23c8,_0x165eae,_0x50d088){var _0x3e6b32={};var _0x36d41b={};var _0x4814e0;var _0x24283a;return db[_0xdbe5('0x31')][_0xdbe5('0x56')]({'where':{'id':_0x2a23c8[_0xdbe5('0x53')]['id']}})[_0xdbe5('0x27')](handleEntityNotFound(_0x165eae,null))[_0xdbe5('0x27')](function(_0x3e27ff){if(_0x3e27ff){_0x4814e0=_0x3e27ff;_0x36d41b[_0xdbe5('0x34')]=_[_0xdbe5('0x36')](db[_0xdbe5('0x5c')][_0xdbe5('0x86')]);_0x36d41b['query']=_['keys'](_0x2a23c8['query']);_0x36d41b[_0xdbe5('0x37')]=_[_0xdbe5('0x39')](_0x36d41b[_0xdbe5('0x34')],_0x36d41b[_0xdbe5('0x35')]);_0x3e6b32[_0xdbe5('0x38')]=_[_0xdbe5('0x39')](_0x36d41b[_0xdbe5('0x34')],qs[_0xdbe5('0x3a')](_0x2a23c8[_0xdbe5('0x35')]['fields']));_0x3e6b32[_0xdbe5('0x38')]=_0x3e6b32[_0xdbe5('0x38')][_0xdbe5('0x47')]?_0x3e6b32[_0xdbe5('0x38')]:_0x36d41b[_0xdbe5('0x34')];_0x3e6b32[_0xdbe5('0x58')]=qs['sort'](_0x2a23c8[_0xdbe5('0x35')][_0xdbe5('0x3c')]);_0x3e6b32[_0xdbe5('0x3d')]=qs[_0xdbe5('0x37')](_[_0xdbe5('0x59')](_0x2a23c8[_0xdbe5('0x35')],_0x36d41b[_0xdbe5('0x37')]));if(_0x2a23c8['query'][_0xdbe5('0x3e')]){_0x3e6b32['where']=_['merge'](_0x3e6b32['where'],{'$or':_[_0xdbe5('0x30')](_0x3e6b32[_0xdbe5('0x38')],function(_0x4c742b){var _0x85e5ef={};_0x85e5ef[_0x4c742b]={'$like':'%'+_0x2a23c8[_0xdbe5('0x35')][_0xdbe5('0x3e')]+'%'};return _0x85e5ef;})});}_0x3e6b32=_[_0xdbe5('0x3f')]({},_0x3e6b32,_0x2a23c8[_0xdbe5('0x48')]);return _0x4814e0[_0xdbe5('0x85')](_0x3e6b32);}})[_0xdbe5('0x27')](function(_0x869652){if(_0x869652){_0x24283a=_0x869652[_0xdbe5('0x47')];if(!_0x2a23c8[_0xdbe5('0x35')][_0xdbe5('0x3b')](_0xdbe5('0x57'))){_0x3e6b32[_0xdbe5('0x20')]=qs[_0xdbe5('0x20')](_0x2a23c8[_0xdbe5('0x35')][_0xdbe5('0x20')]);_0x3e6b32['offset']=qs[_0xdbe5('0x1e')](_0x2a23c8[_0xdbe5('0x35')][_0xdbe5('0x1e')]);}return _0x4814e0[_0xdbe5('0x85')](_0x3e6b32);}})[_0xdbe5('0x27')](function(_0x4e0f0b){if(_0x4e0f0b){return _0x4e0f0b?{'count':_0x24283a,'rows':_0x4e0f0b}:null;}})['then'](respondWithResult(_0x165eae,null))[_0xdbe5('0x45')](handleError(_0x165eae,null));}; \ No newline at end of file +var _0x87d1=['all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','stack','name','index','MailQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','order','MailQueueId','map','UserMailQueue','User','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId'];(function(_0x20bc1b,_0x16a93d){var _0x374f40=function(_0xde0c2f){while(--_0xde0c2f){_0x20bc1b['push'](_0x20bc1b['shift']());}};_0x374f40(++_0x16a93d);}(_0x87d1,0x1a1));var _0x187d=function(_0x59bb92,_0x5a0a0f){_0x59bb92=_0x59bb92-0x0;var _0x53eac4=_0x87d1[_0x59bb92];return _0x53eac4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x187d('0x0'));var rp=require(_0x187d('0x1'));var moment=require(_0x187d('0x2'));var BPromise=require(_0x187d('0x3'));var Mustache=require(_0x187d('0x4'));var util=require(_0x187d('0x5'));var path=require(_0x187d('0x6'));var sox=require(_0x187d('0x7'));var csv=require(_0x187d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x187d('0x9'));var _=require(_0x187d('0xa'));var squel=require(_0x187d('0xb'));var crypto=require(_0x187d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x187d('0xd'));var toCsv=require(_0x187d('0x8'));var querystring=require('querystring');var Papa=require(_0x187d('0xe'));var Redis=require(_0x187d('0xf'));var authService=require(_0x187d('0x10'));var qs=require(_0x187d('0x11'));var as=require(_0x187d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x187d('0x13'))(_0x187d('0x14'));var utils=require('../../config/utils');var config=require(_0x187d('0x15'));var licenseUtil=require(_0x187d('0x16'));var db=require(_0x187d('0x17'))['db'];config[_0x187d('0x18')]=_[_0x187d('0x19')](config[_0x187d('0x18')],{'host':_0x187d('0x1a'),'port':0x18eb});var socket=require(_0x187d('0x1b'))(new Redis(config[_0x187d('0x18')]));require(_0x187d('0x1c'))[_0x187d('0x1d')](socket);function respondWithStatusCode(_0x4811a6,_0x403743){_0x403743=_0x403743||0xcc;return function(_0x37d3d0){if(_0x37d3d0){return _0x4811a6[_0x187d('0x1e')](_0x403743);}return _0x4811a6[_0x187d('0x1f')](_0x403743)[_0x187d('0x20')]();};}function respondWithResult(_0x191671,_0xf27b3e){_0xf27b3e=_0xf27b3e||0xc8;return function(_0x122cfc){if(_0x122cfc){return _0x191671[_0x187d('0x1f')](_0xf27b3e)['json'](_0x122cfc);}};}function respondWithFilteredResult(_0x5a4272,_0x2f76a3){return function(_0x511c6f){if(_0x511c6f){var _0x152d28=typeof _0x2f76a3[_0x187d('0x21')]===_0x187d('0x22')&&typeof _0x2f76a3[_0x187d('0x23')]===_0x187d('0x22');var _0x4d679a=_0x511c6f[_0x187d('0x24')];var _0x4ab070=_0x152d28?0x0:_0x2f76a3['offset'];var _0x15e089=_0x152d28?_0x511c6f[_0x187d('0x24')]:_0x2f76a3[_0x187d('0x21')]+_0x2f76a3[_0x187d('0x23')];var _0x4568c1;if(_0x15e089>=_0x4d679a){_0x15e089=_0x4d679a;_0x4568c1=0xc8;}else{_0x4568c1=0xce;}_0x5a4272[_0x187d('0x1f')](_0x4568c1);return _0x5a4272[_0x187d('0x25')]('Content-Range',_0x4ab070+'-'+_0x15e089+'/'+_0x4d679a)['json'](_0x511c6f);}return null;};}function patchUpdates(_0x2f627f){return function(_0x5420e1){try{jsonpatch[_0x187d('0x26')](_0x5420e1,_0x2f627f,!![]);}catch(_0x49b56d){return BPromise[_0x187d('0x27')](_0x49b56d);}return _0x5420e1[_0x187d('0x28')]();};}function saveUpdates(_0x24e104,_0x5b4aed){return function(_0x51f898){if(_0x51f898){return _0x51f898[_0x187d('0x29')](_0x24e104)[_0x187d('0x2a')](function(_0x335c64){return _0x335c64;});}return null;};}function removeEntity(_0x51ea36,_0x2ab664){return function(_0x497432){if(_0x497432){return _0x497432['destroy']()[_0x187d('0x2a')](function(){var _0x2c34e8=_0x497432[_0x187d('0x2b')]({'plain':!![]});var _0x98efb5=_0x187d('0x2c');return db[_0x187d('0x2d')][_0x187d('0x2e')]({'where':{'type':_0x98efb5,'resourceId':_0x2c34e8['id']}})['then'](function(){return _0x497432;});})[_0x187d('0x2a')](function(){_0x51ea36[_0x187d('0x1f')](0xcc)[_0x187d('0x20')]();});}};}function handleEntityNotFound(_0x21d724,_0x169264){return function(_0x44f194){if(!_0x44f194){_0x21d724[_0x187d('0x1e')](0x194);}return _0x44f194;};}function handleError(_0x4b65a0,_0x25dcbf){_0x25dcbf=_0x25dcbf||0x1f4;return function(_0x11d4e9){logger['error'](_0x11d4e9[_0x187d('0x2f')]);if(_0x11d4e9[_0x187d('0x30')]){delete _0x11d4e9[_0x187d('0x30')];}_0x4b65a0[_0x187d('0x1f')](_0x25dcbf)['send'](_0x11d4e9);};}exports[_0x187d('0x31')]=function(_0x5114d2,_0x2c776b){var _0x3033e5={},_0x519f8d={},_0x1bc765={'count':0x0,'rows':[]};var _0x4251ea=_['map'](db[_0x187d('0x32')][_0x187d('0x33')],function(_0x4b17d6){return{'name':_0x4b17d6[_0x187d('0x34')],'type':_0x4b17d6['type']['key']};});_0x519f8d['model']=_['map'](_0x4251ea,'name');_0x519f8d[_0x187d('0x35')]=_[_0x187d('0x36')](_0x5114d2[_0x187d('0x35')]);_0x519f8d[_0x187d('0x37')]=_[_0x187d('0x38')](_0x519f8d['model'],_0x519f8d[_0x187d('0x35')]);_0x3033e5['attributes']=_['intersection'](_0x519f8d[_0x187d('0x39')],qs['fields'](_0x5114d2['query'][_0x187d('0x3a')]));_0x3033e5[_0x187d('0x3b')]=_0x3033e5[_0x187d('0x3b')]['length']?_0x3033e5[_0x187d('0x3b')]:_0x519f8d[_0x187d('0x39')];if(!_0x5114d2[_0x187d('0x35')][_0x187d('0x3c')](_0x187d('0x3d'))){_0x3033e5[_0x187d('0x23')]=qs[_0x187d('0x23')](_0x5114d2[_0x187d('0x35')][_0x187d('0x23')]);_0x3033e5[_0x187d('0x21')]=qs[_0x187d('0x21')](_0x5114d2['query'][_0x187d('0x21')]);}_0x3033e5['order']=qs[_0x187d('0x3e')](_0x5114d2[_0x187d('0x35')][_0x187d('0x3e')]);_0x3033e5[_0x187d('0x3f')]=qs['filters'](_[_0x187d('0x40')](_0x5114d2['query'],_0x519f8d[_0x187d('0x37')]),_0x4251ea);if(_0x5114d2['query'][_0x187d('0x41')]){_0x3033e5[_0x187d('0x3f')]=_['merge'](_0x3033e5['where'],{'$or':_['map'](_0x4251ea,function(_0x490970){if(_0x490970[_0x187d('0x42')]!=='VIRTUAL'){var _0x4d87e2={};_0x4d87e2[_0x490970[_0x187d('0x30')]]={'$like':'%'+_0x5114d2[_0x187d('0x35')][_0x187d('0x41')]+'%'};return _0x4d87e2;}})});}_0x3033e5=_[_0x187d('0x43')]({},_0x3033e5,_0x5114d2[_0x187d('0x44')]);var _0x5baa37={'where':_0x3033e5['where']};return db[_0x187d('0x32')][_0x187d('0x24')](_0x5baa37)['then'](function(_0x259beb){_0x1bc765[_0x187d('0x24')]=_0x259beb;if(_0x5114d2[_0x187d('0x35')][_0x187d('0x45')]){_0x3033e5[_0x187d('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x187d('0x47')](_0x3033e5);})[_0x187d('0x2a')](function(_0x1d46cf){_0x1bc765[_0x187d('0x48')]=_0x1d46cf;return _0x1bc765;})[_0x187d('0x2a')](respondWithFilteredResult(_0x2c776b,_0x3033e5))['catch'](handleError(_0x2c776b,null));};exports[_0x187d('0x49')]=function(_0x9bb2d4,_0x5794cd){var _0x2b6a7b={'raw':!![],'where':{'id':_0x9bb2d4['params']['id']}},_0x4e52f2={};_0x4e52f2[_0x187d('0x39')]=_[_0x187d('0x36')](db[_0x187d('0x32')][_0x187d('0x33')]);_0x4e52f2['query']=_['keys'](_0x9bb2d4[_0x187d('0x35')]);_0x4e52f2[_0x187d('0x37')]=_['intersection'](_0x4e52f2[_0x187d('0x39')],_0x4e52f2[_0x187d('0x35')]);_0x2b6a7b[_0x187d('0x3b')]=_['intersection'](_0x4e52f2[_0x187d('0x39')],qs[_0x187d('0x3a')](_0x9bb2d4[_0x187d('0x35')][_0x187d('0x3a')]));_0x2b6a7b[_0x187d('0x3b')]=_0x2b6a7b[_0x187d('0x3b')][_0x187d('0x4a')]?_0x2b6a7b[_0x187d('0x3b')]:_0x4e52f2['model'];if(_0x9bb2d4['query'][_0x187d('0x45')]){_0x2b6a7b[_0x187d('0x46')]=[{'all':!![]}];}_0x2b6a7b=_[_0x187d('0x43')]({},_0x2b6a7b,_0x9bb2d4[_0x187d('0x44')]);return db[_0x187d('0x32')][_0x187d('0x4b')](_0x2b6a7b)[_0x187d('0x2a')](handleEntityNotFound(_0x5794cd,null))[_0x187d('0x2a')](respondWithResult(_0x5794cd,null))[_0x187d('0x4c')](handleError(_0x5794cd,null));};exports[_0x187d('0x4d')]=function(_0x4027ac,_0xf14b85){return db['MailQueue'][_0x187d('0x4d')](_0x4027ac['body'],{})[_0x187d('0x2a')](function(_0x24238b){var _0x2e8c5d=_0x4027ac[_0x187d('0x4e')]['get']({'plain':!![]});if(!_0x2e8c5d)throw new Error(_0x187d('0x4f'));if(_0x2e8c5d[_0x187d('0x50')]==='user'){var _0x4f408=_0x24238b[_0x187d('0x2b')]({'plain':!![]});var _0x5917c4=_0x187d('0x2c');return db[_0x187d('0x51')][_0x187d('0x4b')]({'where':{'name':_0x5917c4,'userProfileId':_0x2e8c5d[_0x187d('0x52')]},'raw':!![]})[_0x187d('0x2a')](function(_0x18c9e7){if(_0x18c9e7&&_0x18c9e7[_0x187d('0x53')]===0x0){return db[_0x187d('0x2d')][_0x187d('0x4d')]({'name':_0x4f408[_0x187d('0x30')],'resourceId':_0x4f408['id'],'type':_0x18c9e7[_0x187d('0x30')],'sectionId':_0x18c9e7['id']},{})[_0x187d('0x2a')](function(){return _0x24238b;});}else{return _0x24238b;}})['catch'](function(_0x49d087){logger[_0x187d('0x54')](_0x187d('0x55'),_0x49d087);throw _0x49d087;});}return _0x24238b;})[_0x187d('0x2a')](respondWithResult(_0xf14b85,0xc9))['catch'](handleError(_0xf14b85,null));};exports[_0x187d('0x29')]=function(_0x526555,_0xcf7c08){if(_0x526555[_0x187d('0x56')]['id']){delete _0x526555[_0x187d('0x56')]['id'];}return db[_0x187d('0x32')][_0x187d('0x4b')]({'where':{'id':_0x526555[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0xcf7c08,null))['then'](saveUpdates(_0x526555['body'],null))[_0x187d('0x2a')](respondWithResult(_0xcf7c08,null))[_0x187d('0x4c')](handleError(_0xcf7c08,null));};exports[_0x187d('0x2e')]=function(_0x5c852c,_0x580d80){return db['MailQueue'][_0x187d('0x4b')]({'where':{'id':_0x5c852c[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0x580d80,null))['then'](removeEntity(_0x580d80,null))[_0x187d('0x4c')](handleError(_0x580d80,null));};exports[_0x187d('0x58')]=function(_0x5f59e0,_0x4c869f){return db[_0x187d('0x32')]['describe']()[_0x187d('0x2a')](respondWithResult(_0x4c869f,null))[_0x187d('0x4c')](handleError(_0x4c869f,null));};exports['getMembers']=function(_0xb7c23,_0x5d7b61,_0x21a545){var _0x3dd352={'raw':!![],'where':{}},_0x5f1e4a={},_0x3e649b;return db['MailQueue'][_0x187d('0x59')]({'where':{'id':_0xb7c23[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0x5d7b61,null))[_0x187d('0x2a')](function(_0x12c2ce){if(_0x12c2ce){_0x3e649b=_0x12c2ce[_0x187d('0x2b')]({'plain':!![]});_0x5f1e4a[_0x187d('0x39')]=_[_0x187d('0x36')](db['UserMailQueue'][_0x187d('0x33')]);_0x5f1e4a[_0x187d('0x35')]=_[_0x187d('0x36')](_0xb7c23[_0x187d('0x35')]);_0x5f1e4a[_0x187d('0x37')]=_['intersection'](_0x5f1e4a[_0x187d('0x39')],_0x5f1e4a['query']);_0x3dd352[_0x187d('0x3b')]=_['intersection'](_0x5f1e4a['model'],qs[_0x187d('0x3a')](_0xb7c23['query']['fields']));_0x3dd352[_0x187d('0x3b')]=_0x3dd352[_0x187d('0x3b')][_0x187d('0x4a')]?_0x3dd352['attributes']:_0x5f1e4a[_0x187d('0x39')];if(!_0xb7c23[_0x187d('0x35')][_0x187d('0x3c')](_0x187d('0x3d'))){_0x3dd352['limit']=qs[_0x187d('0x23')](_0xb7c23['query'][_0x187d('0x23')]);_0x3dd352['offset']=qs[_0x187d('0x21')](_0xb7c23[_0x187d('0x35')][_0x187d('0x21')]);}_0x3dd352[_0x187d('0x5a')]=qs[_0x187d('0x3e')](_0xb7c23['query']['sort']);_0x3dd352[_0x187d('0x3f')]=qs['filters'](_[_0x187d('0x40')](_0xb7c23[_0x187d('0x35')],_0x5f1e4a[_0x187d('0x37')]));_0x3dd352['where'][_0x187d('0x5b')]=_0x12c2ce['id'];if(_0xb7c23[_0x187d('0x35')][_0x187d('0x41')]){_0x3dd352[_0x187d('0x3f')]=_[_0x187d('0x43')](_0x3dd352[_0x187d('0x3f')],{'$or':_[_0x187d('0x5c')](_0x3dd352['attributes'],function(_0x34ef18){var _0x1d9354={};_0x1d9354[_0x34ef18]={'$like':'%'+_0xb7c23[_0x187d('0x35')][_0x187d('0x41')]+'%'};return _0x1d9354;})});}_0x3dd352=_[_0x187d('0x43')]({},_0x3dd352,_0xb7c23[_0x187d('0x44')]);return db[_0x187d('0x5d')][_0x187d('0x47')](_0x3dd352);}})[_0x187d('0x2a')](function(_0x55807c){if(_0x55807c){return db[_0x187d('0x5e')]['findAndCountAll']({'where':{'id':_[_0x187d('0x5c')](_0x55807c,_0x187d('0x5f')),'role':'agent'},'attributes':['id','name',_0x187d('0x60'),_0x187d('0x61'),_0x187d('0x62')]});}})[_0x187d('0x2a')](function(_0x3f2ce7){if(_0x3f2ce7){return{'count':_0x3f2ce7[_0x187d('0x24')],'rows':_[_0x187d('0x5c')](_0x3f2ce7[_0x187d('0x48')],function(_0x3ce2fb){return{'membername':_0x3ce2fb['name'],'UserId':_0x3ce2fb['id'],'queue_name':_0x3e649b['name'],'MailQueueId':_0x3e649b['id'],'interface':util['format'](_0x187d('0x63'),_0x187d('0x64'),_0x3ce2fb[_0x187d('0x30')]),'penalty':0x0,'paused':_0x3ce2fb[_0x187d('0x60')],'createdAt':_0x3ce2fb[_0x187d('0x62')],'updatedAt':_0x3ce2fb[_0x187d('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x187d('0x2a')](respondWithFilteredResult(_0x5d7b61,_0x3dd352))[_0x187d('0x4c')](handleError(_0x5d7b61,null));};exports[_0x187d('0x65')]=function(_0x47bb67,_0xf839d5,_0x53c06d){var _0x3cb8e9={};var _0x5134ee={};var _0x582147;var _0x1cf17a;return db[_0x187d('0x32')]['findOne']({'where':{'id':_0x47bb67[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0xf839d5,null))[_0x187d('0x2a')](function(_0x57ee7){if(_0x57ee7){_0x582147=_0x57ee7;_0x5134ee['model']=_['keys'](db[_0x187d('0x66')][_0x187d('0x33')]);_0x5134ee['query']=_[_0x187d('0x36')](_0x47bb67[_0x187d('0x35')]);_0x5134ee['filters']=_[_0x187d('0x38')](_0x5134ee[_0x187d('0x39')],_0x5134ee[_0x187d('0x35')]);_0x3cb8e9[_0x187d('0x3b')]=_[_0x187d('0x38')](_0x5134ee[_0x187d('0x39')],qs['fields'](_0x47bb67[_0x187d('0x35')]['fields']));_0x3cb8e9[_0x187d('0x3b')]=_0x3cb8e9[_0x187d('0x3b')][_0x187d('0x4a')]?_0x3cb8e9[_0x187d('0x3b')]:_0x5134ee['model'];_0x3cb8e9[_0x187d('0x5a')]=qs[_0x187d('0x3e')](_0x47bb67['query']['sort']);_0x3cb8e9[_0x187d('0x3f')]=qs[_0x187d('0x37')](_['pick'](_0x47bb67[_0x187d('0x35')],_0x5134ee['filters']));if(_0x47bb67[_0x187d('0x35')][_0x187d('0x41')]){_0x3cb8e9['where']=_['merge'](_0x3cb8e9[_0x187d('0x3f')],{'$or':_[_0x187d('0x5c')](_0x3cb8e9[_0x187d('0x3b')],function(_0x46f026){var _0x5c0752={};_0x5c0752[_0x46f026]={'$like':'%'+_0x47bb67[_0x187d('0x35')][_0x187d('0x41')]+'%'};return _0x5c0752;})});}_0x3cb8e9=_[_0x187d('0x43')]({},_0x3cb8e9,_0x47bb67[_0x187d('0x44')]);return _0x582147[_0x187d('0x65')](_0x3cb8e9);}})[_0x187d('0x2a')](function(_0x4ba2cd){if(_0x4ba2cd){_0x1cf17a=_0x4ba2cd[_0x187d('0x4a')];if(!_0x47bb67['query']['hasOwnProperty'](_0x187d('0x3d'))){_0x3cb8e9['limit']=qs['limit'](_0x47bb67[_0x187d('0x35')][_0x187d('0x23')]);_0x3cb8e9['offset']=qs[_0x187d('0x21')](_0x47bb67['query']['offset']);}return _0x582147[_0x187d('0x65')](_0x3cb8e9);}})[_0x187d('0x2a')](function(_0x269745){if(_0x269745){return _0x269745?{'count':_0x1cf17a,'rows':_0x269745}:null;}})[_0x187d('0x2a')](respondWithResult(_0xf839d5,null))[_0x187d('0x4c')](handleError(_0xf839d5,null));};exports[_0x187d('0x67')]=function(_0x18235b,_0x46375c,_0x52c4a7){var _0x3b5071=_0x18235b[_0x187d('0x56')][_0x187d('0x68')];return db['Team'][_0x187d('0x47')]({'where':{'id':_0x3b5071},'attributes':['id'],'include':[{'model':db[_0x187d('0x5e')],'as':_0x187d('0x69'),'attributes':['id','name','online',_0x187d('0x6a'),'interface'],'raw':!![]}]})[_0x187d('0x2a')](function(_0x1f3871){if(_0x1f3871){var _0x1fe6a2=_[_0x187d('0x6b')](_0x1f3871,function(_0xc2166b){var _0x648df8=_0xc2166b[_0x187d('0x2b')]({'plain':!![]});return _0x648df8['Agents'];});return db[_0x187d('0x32')][_0x187d('0x4b')]({'where':{'id':_0x18235b[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](function(_0x4fce10){return db[_0x187d('0x6c')][_0x187d('0x6d')](function(_0x46fb88){return _0x4fce10[_0x187d('0x67')](_0x3b5071,{'transaction':_0x46fb88})[_0x187d('0x2a')](function(){return BPromise[_0x187d('0x6e')](_0x1fe6a2,function(_0x19853f){return db[_0x187d('0x5d')][_0x187d('0x6f')]({'where':{'UserId':_0x19853f['id'],'MailQueueId':_0x18235b[_0x187d('0x57')]['id']},'transaction':_0x46fb88});});})['then'](function(){_0x1fe6a2[_0x187d('0x70')](function(_0x31fbc3){socket[_0x187d('0x71')](_0x187d('0x72'),{'UserId':_0x31fbc3['id'],'MailQueueId':_0x4fce10['id']});});});});});}})[_0x187d('0x2a')](respondWithStatusCode(_0x46375c,null))[_0x187d('0x4c')](handleError(_0x46375c,null));};exports[_0x187d('0x73')]=function(_0x161891,_0x52485f,_0x4c4513){return db[_0x187d('0x66')][_0x187d('0x47')]({'where':{'id':_0x161891[_0x187d('0x35')][_0x187d('0x68')]},'attributes':['id'],'include':[{'model':db[_0x187d('0x5e')],'as':_0x187d('0x69'),'attributes':['id'],'raw':!![]}]})[_0x187d('0x2a')](handleEntityNotFound(_0x52485f,null))[_0x187d('0x2a')](function(_0x10b0ce){var _0x3e708d=_[_0x187d('0x5c')](_0x10b0ce,'id');var _0x9c5385=[];var _0x4ae20b=[];var _0x1bf83b=squel['select']();_0x1bf83b[_0x187d('0x74')](_0x187d('0x75'))['from'](_0x187d('0x76'),'tq')[_0x187d('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x187d('0x78'),_0x161891[_0x187d('0x57')]['id']);for(var _0x2c6107=0x0;_0x2c6107<_0x10b0ce[_0x187d('0x4a')];_0x2c6107+=0x1){let _0x56a321=_0x10b0ce[_0x2c6107];for(var _0x4c5bbb=0x0;_0x4c5bbb<_0x56a321[_0x187d('0x69')][_0x187d('0x4a')];_0x4c5bbb+=0x1){let _0x20f869=_0x56a321[_0x187d('0x69')][_0x4c5bbb];var _0x221cb8=_0x1bf83b[_0x187d('0x79')]();_0x221cb8[_0x187d('0x3f')](_0x187d('0x7a'),_0x20f869['id']);_0x4ae20b[_0x187d('0x7b')](db[_0x187d('0x6c')]['query'](_0x221cb8['toString'](),{'type':db[_0x187d('0x6c')]['QueryTypes'][_0x187d('0x7c')]})['then'](function(_0x4ab9a1){if(_0x4ab9a1[_0x187d('0x4a')]===0x1){return _0x20f869['id'];}else{var _0xade3d5=_[_0x187d('0x7d')](_[_0x187d('0x5c')](_0x4ab9a1,_0x187d('0x7e')),function(_0x235544){return _['includes'](_0x3e708d,_0x235544);});if(_0xade3d5){return _0x20f869['id'];}}}));}}return BPromise[_0x187d('0x7f')](_0x4ae20b)[_0x187d('0x2a')](function(_0x57408f){_0x9c5385=_(_0x9c5385)['union'](_0x57408f)[_0x187d('0x80')]()[_0x187d('0x81')]();return db[_0x187d('0x32')][_0x187d('0x4b')]({'where':{'id':_0x161891[_0x187d('0x57')]['id']}})['then'](function(_0x7002a){return db[_0x187d('0x6c')][_0x187d('0x6d')](function(_0x2ac89d){return _0x7002a[_0x187d('0x73')](_0x161891[_0x187d('0x35')][_0x187d('0x68')],{'transaction':_0x2ac89d})['then'](function(){if(!_[_0x187d('0x82')](_0x9c5385)){return _0x7002a[_0x187d('0x83')](_0x9c5385,{'transaction':_0x2ac89d});}})['then'](function(){_0x9c5385[_0x187d('0x70')](function(_0x57ea33){socket[_0x187d('0x71')](_0x187d('0x84'),{'UserId':_0x57ea33,'MailQueueId':_0x7002a['id']});});});});});});})[_0x187d('0x2a')](respondWithStatusCode(_0x52485f,null))['catch'](handleError(_0x52485f,null));};exports[_0x187d('0x85')]=function(_0x273376,_0x255dd8,_0x5ab24a){return db['MailQueue'][_0x187d('0x4b')]({'where':{'id':_0x273376['params']['id']}})['then'](handleEntityNotFound(_0x255dd8,null))['then'](function(_0x573df9){if(_0x573df9){return _0x573df9[_0x187d('0x85')](_0x273376['body'][_0x187d('0x68')],_['omit'](_0x273376[_0x187d('0x56')],[_0x187d('0x68'),'id'])||{})['spread'](function(_0x5c3d32){for(var _0x857dc7=0x0;_0x857dc7<_0x273376[_0x187d('0x56')][_0x187d('0x68')]['length'];_0x857dc7+=0x1){socket[_0x187d('0x71')](_0x187d('0x72'),{'UserId':Number(_0x273376['body'][_0x187d('0x68')][_0x857dc7]),'MailQueueId':Number(_0x273376[_0x187d('0x57')]['id'])});}return _0x5c3d32;});}})[_0x187d('0x2a')](respondWithResult(_0x255dd8,null))[_0x187d('0x4c')](handleError(_0x255dd8,null));};exports[_0x187d('0x83')]=function(_0x4d1ede,_0x3d043f,_0x2e5706){return db['MailQueue']['find']({'where':{'id':_0x4d1ede[_0x187d('0x57')]['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0x3d043f,null))['then'](function(_0x14ecd4){if(_0x14ecd4){return _0x14ecd4[_0x187d('0x83')](_0x4d1ede[_0x187d('0x35')][_0x187d('0x68')])[_0x187d('0x2a')](function(){if(_[_0x187d('0x86')](_0x4d1ede[_0x187d('0x35')][_0x187d('0x68')])){for(var _0x2b4915=0x0;_0x2b4915<_0x4d1ede[_0x187d('0x35')]['ids'][_0x187d('0x4a')];_0x2b4915+=0x1){socket[_0x187d('0x71')]('userMailQueue:remove',{'UserId':Number(_0x4d1ede[_0x187d('0x35')][_0x187d('0x68')][_0x2b4915]),'MailQueueId':Number(_0x4d1ede['params']['id'])});}}else{socket[_0x187d('0x71')](_0x187d('0x84'),{'UserId':Number(_0x4d1ede['query'][_0x187d('0x68')]),'MailQueueId':Number(_0x4d1ede[_0x187d('0x57')]['id'])});}});}})[_0x187d('0x2a')](respondWithStatusCode(_0x3d043f,null))['catch'](handleError(_0x3d043f,null));};exports[_0x187d('0x87')]=function(_0x4c1101,_0x350b20,_0x13890e){var _0x2aeb11={};var _0x396771={};var _0x4ec8f1;var _0x239dac;return db[_0x187d('0x32')][_0x187d('0x59')]({'where':{'id':_0x4c1101['params']['id']}})[_0x187d('0x2a')](handleEntityNotFound(_0x350b20,null))[_0x187d('0x2a')](function(_0x5508c4){if(_0x5508c4){_0x4ec8f1=_0x5508c4;_0x396771[_0x187d('0x39')]=_[_0x187d('0x36')](db['User'][_0x187d('0x33')]);_0x396771[_0x187d('0x35')]=_[_0x187d('0x36')](_0x4c1101['query']);_0x396771[_0x187d('0x37')]=_[_0x187d('0x38')](_0x396771[_0x187d('0x39')],_0x396771[_0x187d('0x35')]);_0x2aeb11[_0x187d('0x3b')]=_[_0x187d('0x38')](_0x396771[_0x187d('0x39')],qs[_0x187d('0x3a')](_0x4c1101[_0x187d('0x35')][_0x187d('0x3a')]));_0x2aeb11[_0x187d('0x3b')]=_0x2aeb11[_0x187d('0x3b')][_0x187d('0x4a')]?_0x2aeb11[_0x187d('0x3b')]:_0x396771[_0x187d('0x39')];_0x2aeb11['order']=qs[_0x187d('0x3e')](_0x4c1101[_0x187d('0x35')][_0x187d('0x3e')]);_0x2aeb11[_0x187d('0x3f')]=qs[_0x187d('0x37')](_[_0x187d('0x40')](_0x4c1101['query'],_0x396771['filters']));if(_0x4c1101[_0x187d('0x35')][_0x187d('0x41')]){_0x2aeb11[_0x187d('0x3f')]=_[_0x187d('0x43')](_0x2aeb11[_0x187d('0x3f')],{'$or':_[_0x187d('0x5c')](_0x2aeb11[_0x187d('0x3b')],function(_0x1a78a8){var _0x40756b={};_0x40756b[_0x1a78a8]={'$like':'%'+_0x4c1101[_0x187d('0x35')]['filter']+'%'};return _0x40756b;})});}_0x2aeb11=_[_0x187d('0x43')]({},_0x2aeb11,_0x4c1101['options']);return _0x4ec8f1[_0x187d('0x87')](_0x2aeb11);}})['then'](function(_0x23e08d){if(_0x23e08d){_0x239dac=_0x23e08d['length'];if(!_0x4c1101[_0x187d('0x35')][_0x187d('0x3c')](_0x187d('0x3d'))){_0x2aeb11[_0x187d('0x23')]=qs['limit'](_0x4c1101[_0x187d('0x35')][_0x187d('0x23')]);_0x2aeb11[_0x187d('0x21')]=qs[_0x187d('0x21')](_0x4c1101[_0x187d('0x35')][_0x187d('0x21')]);}return _0x4ec8f1[_0x187d('0x87')](_0x2aeb11);}})[_0x187d('0x2a')](function(_0x3d6069){if(_0x3d6069){return _0x3d6069?{'count':_0x239dac,'rows':_0x3d6069}:null;}})[_0x187d('0x2a')](respondWithResult(_0x350b20,null))[_0x187d('0x4c')](handleError(_0x350b20,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c0c2271..0f5b813 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 _0xb978=['../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x595c4e,_0x444249){var _0x1e224c=function(_0x3c46d0){while(--_0x3c46d0){_0x595c4e['push'](_0x595c4e['shift']());}};_0x1e224c(++_0x444249);}(_0xb978,0x8b));var _0x8b97=function(_0x23918b,_0x30e270){_0x23918b=_0x23918b-0x0;var _0x5d7f4b=_0xb978[_0x23918b];return _0x5d7f4b;};'use strict';var EventEmitter=require(_0x8b97('0x0'));var MailQueue=require(_0x8b97('0x1'))['db'][_0x8b97('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8b97('0x3')](0x0);var events={'afterCreate':_0x8b97('0x4'),'afterUpdate':_0x8b97('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c2536){return function(_0x3ec9fd,_0x543313,_0x1d3ec4){MailQueueEvents[_0x8b97('0x6')](_0x4c2536+':'+_0x3ec9fd['id'],_0x3ec9fd);MailQueueEvents['emit'](_0x4c2536,_0x3ec9fd);_0x1d3ec4(null);};}for(var e in events){if(events[_0x8b97('0x7')](e)){var event=events[e];MailQueue[_0x8b97('0x8')](e,emitEvent(event));}}module[_0x8b97('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x22a8=['exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x3b5eb5,_0x45ba7b){var _0x3cdcb1=function(_0x5cc269){while(--_0x5cc269){_0x3b5eb5['push'](_0x3b5eb5['shift']());}};_0x3cdcb1(++_0x45ba7b);}(_0x22a8,0x64));var _0x822a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x22a8[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x822a('0x0'))['db'][_0x822a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x822a('0x2')](0x0);var events={'afterCreate':_0x822a('0x3'),'afterUpdate':_0x822a('0x4'),'afterDestroy':_0x822a('0x5')};function emitEvent(_0x47009c){return function(_0x55ae2b,_0x31bda3,_0x515fdd){MailQueueEvents['emit'](_0x47009c+':'+_0x55ae2b['id'],_0x55ae2b);MailQueueEvents['emit'](_0x47009c,_0x55ae2b);_0x515fdd(null);};}for(var e in events){if(events[_0x822a('0x6')](e)){var event=events[e];MailQueue[_0x822a('0x7')](e,emitEvent(event));}}module[_0x822a('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index edfac1d..f176a6b 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 _0x51f1=['MailQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define'];(function(_0x459be9,_0x3d3b14){var _0x36ea0a=function(_0x12d113){while(--_0x12d113){_0x459be9['push'](_0x459be9['shift']());}};_0x36ea0a(++_0x3d3b14);}(_0x51f1,0x9d));var _0x151f=function(_0x1bff41,_0x386880){_0x1bff41=_0x1bff41-0x0;var _0x4db66b=_0x51f1[_0x1bff41];return _0x4db66b;};'use strict';var _=require(_0x151f('0x0'));var util=require(_0x151f('0x1'));var logger=require(_0x151f('0x2'))('api');var moment=require(_0x151f('0x3'));var BPromise=require(_0x151f('0x4'));var rp=require(_0x151f('0x5'));var fs=require('fs');var path=require(_0x151f('0x6'));var rimraf=require(_0x151f('0x7'));var config=require(_0x151f('0x8'));var attributes=require(_0x151f('0x9'));module['exports']=function(_0x4855da,_0x144ff5){return _0x4855da[_0x151f('0xa')](_0x151f('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc32d=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailQueue.attributes','define'];(function(_0x543065,_0xe81fdc){var _0x38c5ae=function(_0x3bdaa1){while(--_0x3bdaa1){_0x543065['push'](_0x543065['shift']());}};_0x38c5ae(++_0xe81fdc);}(_0xc32d,0x19a));var _0xdc32=function(_0x5c403f,_0x6a49b2){_0x5c403f=_0x5c403f-0x0;var _0x274ee4=_0xc32d[_0x5c403f];return _0x274ee4;};'use strict';var _=require(_0xdc32('0x0'));var util=require(_0xdc32('0x1'));var logger=require(_0xdc32('0x2'))(_0xdc32('0x3'));var moment=require(_0xdc32('0x4'));var BPromise=require(_0xdc32('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc32('0x6'));var rimraf=require(_0xdc32('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc32('0x8'));module['exports']=function(_0x542cb4,_0x3ce5ea){return _0x542cb4[_0xdc32('0x9')](_0xdc32('0xa'),attributes,{'tableName':_0xdc32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index f6845ff..ed4b732 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 _0xc87e=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','MailQueue','findAll','options','where','attributes','map','include','model','GetMailQueue','debug','stringify','catch','ShowMailQueue','find'];(function(_0x117973,_0xe17e9d){var _0x154ec1=function(_0x50e245){while(--_0x50e245){_0x117973['push'](_0x117973['shift']());}};_0x154ec1(++_0xe17e9d);}(_0xc87e,0x17b));var _0xec87=function(_0x50b28f,_0x4aac2c){_0x50b28f=_0x50b28f-0x0;var _0x378b8a=_0xc87e[_0x50b28f];return _0x378b8a;};'use strict';var _=require(_0xec87('0x0'));var util=require(_0xec87('0x1'));var moment=require(_0xec87('0x2'));var BPromise=require(_0xec87('0x3'));var rs=require(_0xec87('0x4'));var fs=require('fs');var Redis=require(_0xec87('0x5'));var db=require(_0xec87('0x6'))['db'];var utils=require(_0xec87('0x7'));var logger=require(_0xec87('0x8'))('rpc');var config=require(_0xec87('0x9'));var jayson=require(_0xec87('0xa'));var client=jayson[_0xec87('0xb')]['http']({'port':0x232a});config['redis']=_[_0xec87('0xc')](config[_0xec87('0xd')],{'host':_0xec87('0xe'),'port':0x18eb});var socket=require(_0xec87('0xf'))(new Redis(config[_0xec87('0xd')]));require(_0xec87('0x10'))['register'](socket);function respondWithRpcPromise(_0xa74096,_0x5588f8,_0x229d81){return new BPromise(function(_0x5423d5,_0x31aade){return client[_0xec87('0x11')](_0xa74096,_0x229d81)[_0xec87('0x12')](function(_0x2afcea){logger[_0xec87('0x13')](_0xec87('0x14'),_0x5588f8,_0xec87('0x15'));logger['debug'](_0xec87('0x16'),_0x5588f8,_0xec87('0x15'),JSON['stringify'](_0x2afcea));if(_0x2afcea[_0xec87('0x17')]){if(_0x2afcea[_0xec87('0x17')][_0xec87('0x18')]===0x1f4){logger[_0xec87('0x17')](_0xec87('0x14'),_0x5588f8,_0x2afcea[_0xec87('0x17')][_0xec87('0x19')]);return _0x31aade(_0x2afcea[_0xec87('0x17')][_0xec87('0x19')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x5588f8,_0x2afcea[_0xec87('0x17')]['message']);return _0x5423d5(_0x2afcea['error']['message']);}else{logger[_0xec87('0x13')]('MailQueue,\x20%s,\x20%s',_0x5588f8,_0xec87('0x15'));_0x5423d5(_0x2afcea[_0xec87('0x1a')][_0xec87('0x19')]);}})['catch'](function(_0x62b32c){logger['error'](_0xec87('0x14'),_0x5588f8,_0x62b32c);_0x31aade(_0x62b32c);});});}exports['GetMailQueue']=function(_0x18d6d2){var _0x5644ed=this;return new Promise(function(_0x337b31,_0x2770c0){return db[_0xec87('0x1b')][_0xec87('0x1c')]({'raw':_0x18d6d2[_0xec87('0x1d')]?_0x18d6d2[_0xec87('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x18d6d2[_0xec87('0x1d')]?_0x18d6d2[_0xec87('0x1d')][_0xec87('0x1e')]||null:null,'attributes':_0x18d6d2[_0xec87('0x1d')]?_0x18d6d2[_0xec87('0x1d')][_0xec87('0x1f')]||null:null,'limit':_0x18d6d2[_0xec87('0x1d')]?_0x18d6d2[_0xec87('0x1d')]['limit']||null:null,'include':_0x18d6d2[_0xec87('0x1d')]?_0x18d6d2[_0xec87('0x1d')]['include']?_[_0xec87('0x20')](_0x18d6d2[_0xec87('0x1d')][_0xec87('0x21')],function(_0x1406b2){return{'model':db[_0x1406b2[_0xec87('0x22')]],'as':_0x1406b2['as'],'attributes':_0x1406b2[_0xec87('0x1f')],'include':_0x1406b2[_0xec87('0x21')]?_[_0xec87('0x20')](_0x1406b2['include'],function(_0x5eaa92){return{'model':db[_0x5eaa92[_0xec87('0x22')]],'as':_0x5eaa92['as'],'attributes':_0x5eaa92['attributes'],'include':_0x5eaa92[_0xec87('0x21')]?_['map'](_0x5eaa92[_0xec87('0x21')],function(_0x344751){return{'model':db[_0x344751['model']],'as':_0x344751['as'],'attributes':_0x344751[_0xec87('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xec87('0x12')](function(_0x3554bc){logger[_0xec87('0x13')](_0xec87('0x23'),_0x18d6d2);logger[_0xec87('0x24')](_0xec87('0x23'),_0x18d6d2,JSON[_0xec87('0x25')](_0x3554bc));_0x337b31(_0x3554bc);})[_0xec87('0x26')](function(_0x434337){logger['error'](_0xec87('0x23'),_0x434337['message'],_0x18d6d2);_0x2770c0(_0x5644ed[_0xec87('0x17')](0x1f4,_0x434337['message']));});});};exports[_0xec87('0x27')]=function(_0x3f3de9){var _0x2e3eee=this;return new Promise(function(_0x467a00,_0x3fbf16){return db[_0xec87('0x1b')][_0xec87('0x28')]({'raw':_0x3f3de9[_0xec87('0x1d')]?_0x3f3de9[_0xec87('0x1d')][_0xec87('0x29')]===undefined?!![]:![]:!![],'where':_0x3f3de9[_0xec87('0x1d')]?_0x3f3de9[_0xec87('0x1d')][_0xec87('0x1e')]||null:null,'attributes':_0x3f3de9[_0xec87('0x1d')]?_0x3f3de9[_0xec87('0x1d')][_0xec87('0x1f')]||null:null,'include':_0x3f3de9[_0xec87('0x1d')]?_0x3f3de9[_0xec87('0x1d')][_0xec87('0x21')]?_[_0xec87('0x20')](_0x3f3de9[_0xec87('0x1d')]['include'],function(_0x24dd7c){return{'model':db[_0x24dd7c[_0xec87('0x22')]],'as':_0x24dd7c['as'],'attributes':_0x24dd7c[_0xec87('0x1f')],'include':_0x24dd7c[_0xec87('0x21')]?_[_0xec87('0x20')](_0x24dd7c[_0xec87('0x21')],function(_0x565511){return{'model':db[_0x565511['model']],'as':_0x565511['as'],'attributes':_0x565511['attributes'],'include':_0x565511[_0xec87('0x21')]?_['map'](_0x565511[_0xec87('0x21')],function(_0x50a774){return{'model':db[_0x50a774[_0xec87('0x22')]],'as':_0x50a774['as'],'attributes':_0x50a774[_0xec87('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xec87('0x12')](function(_0x39de8a){logger['info'](_0xec87('0x27'),_0x3f3de9);logger['debug'](_0xec87('0x27'),_0x3f3de9,JSON[_0xec87('0x25')](_0x39de8a));_0x467a00(_0x39de8a);})[_0xec87('0x26')](function(_0x5333ee){logger[_0xec87('0x17')](_0xec87('0x27'),_0x5333ee[_0xec87('0x19')],_0x3f3de9);_0x3fbf16(_0x2e3eee[_0xec87('0x17')](0x1f4,_0x5333ee[_0xec87('0x19')]));});});}; \ No newline at end of file +var _0x863e=['find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowMailQueue'];(function(_0x26bb1b,_0x51b8b1){var _0x511b03=function(_0x1d24e3){while(--_0x1d24e3){_0x26bb1b['push'](_0x26bb1b['shift']());}};_0x511b03(++_0x51b8b1);}(_0x863e,0x1f1));var _0xe863=function(_0x14d643,_0x1c7727){_0x14d643=_0x14d643-0x0;var _0x3a4451=_0x863e[_0x14d643];return _0x3a4451;};'use strict';var _=require(_0xe863('0x0'));var util=require(_0xe863('0x1'));var moment=require(_0xe863('0x2'));var BPromise=require(_0xe863('0x3'));var rs=require(_0xe863('0x4'));var fs=require('fs');var Redis=require(_0xe863('0x5'));var db=require(_0xe863('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe863('0x7'))(_0xe863('0x8'));var config=require(_0xe863('0x9'));var jayson=require(_0xe863('0xa'));var client=jayson[_0xe863('0xb')][_0xe863('0xc')]({'port':0x232a});config[_0xe863('0xd')]=_[_0xe863('0xe')](config['redis'],{'host':_0xe863('0xf'),'port':0x18eb});var socket=require(_0xe863('0x10'))(new Redis(config[_0xe863('0xd')]));require(_0xe863('0x11'))[_0xe863('0x12')](socket);function respondWithRpcPromise(_0x19868f,_0x4c1b0d,_0x1ad1ac){return new BPromise(function(_0x206c69,_0x2cbf1d){return client[_0xe863('0x13')](_0x19868f,_0x1ad1ac)[_0xe863('0x14')](function(_0x31c21c){logger['info']('MailQueue,\x20%s,\x20%s',_0x4c1b0d,_0xe863('0x15'));logger['debug'](_0xe863('0x16'),_0x4c1b0d,_0xe863('0x15'),JSON[_0xe863('0x17')](_0x31c21c));if(_0x31c21c[_0xe863('0x18')]){if(_0x31c21c[_0xe863('0x18')][_0xe863('0x19')]===0x1f4){logger['error'](_0xe863('0x1a'),_0x4c1b0d,_0x31c21c['error'][_0xe863('0x1b')]);return _0x2cbf1d(_0x31c21c['error'][_0xe863('0x1b')]);}logger[_0xe863('0x18')](_0xe863('0x1a'),_0x4c1b0d,_0x31c21c[_0xe863('0x18')][_0xe863('0x1b')]);return _0x206c69(_0x31c21c['error'][_0xe863('0x1b')]);}else{logger[_0xe863('0x1c')](_0xe863('0x1a'),_0x4c1b0d,'request\x20sent');_0x206c69(_0x31c21c[_0xe863('0x1d')][_0xe863('0x1b')]);}})[_0xe863('0x1e')](function(_0x2f19de){logger[_0xe863('0x18')](_0xe863('0x1a'),_0x4c1b0d,_0x2f19de);_0x2cbf1d(_0x2f19de);});});}exports[_0xe863('0x1f')]=function(_0x571dff){var _0x5f24e4=this;return new Promise(function(_0x2ce50b,_0x1fa45e){return db[_0xe863('0x20')][_0xe863('0x21')]({'raw':_0x571dff[_0xe863('0x22')]?_0x571dff[_0xe863('0x22')][_0xe863('0x23')]===undefined?!![]:![]:!![],'where':_0x571dff[_0xe863('0x22')]?_0x571dff[_0xe863('0x22')]['where']||null:null,'attributes':_0x571dff[_0xe863('0x22')]?_0x571dff['options'][_0xe863('0x24')]||null:null,'limit':_0x571dff[_0xe863('0x22')]?_0x571dff[_0xe863('0x22')][_0xe863('0x25')]||null:null,'include':_0x571dff[_0xe863('0x22')]?_0x571dff[_0xe863('0x22')][_0xe863('0x26')]?_[_0xe863('0x27')](_0x571dff[_0xe863('0x22')]['include'],function(_0x36a4f8){return{'model':db[_0x36a4f8[_0xe863('0x28')]],'as':_0x36a4f8['as'],'attributes':_0x36a4f8[_0xe863('0x24')],'include':_0x36a4f8[_0xe863('0x26')]?_[_0xe863('0x27')](_0x36a4f8[_0xe863('0x26')],function(_0x590cd0){return{'model':db[_0x590cd0['model']],'as':_0x590cd0['as'],'attributes':_0x590cd0[_0xe863('0x24')],'include':_0x590cd0[_0xe863('0x26')]?_[_0xe863('0x27')](_0x590cd0[_0xe863('0x26')],function(_0x52ab4b){return{'model':db[_0x52ab4b[_0xe863('0x28')]],'as':_0x52ab4b['as'],'attributes':_0x52ab4b[_0xe863('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe863('0x14')](function(_0x436ecb){logger[_0xe863('0x1c')]('GetMailQueue',_0x571dff);logger[_0xe863('0x29')](_0xe863('0x1f'),_0x571dff,JSON[_0xe863('0x17')](_0x436ecb));_0x2ce50b(_0x436ecb);})[_0xe863('0x1e')](function(_0x2df01c){logger[_0xe863('0x18')]('GetMailQueue',_0x2df01c['message'],_0x571dff);_0x1fa45e(_0x5f24e4[_0xe863('0x18')](0x1f4,_0x2df01c[_0xe863('0x1b')]));});});};exports[_0xe863('0x2a')]=function(_0x43a566){var _0x3f9f73=this;return new Promise(function(_0x44794a,_0x2d3668){return db['MailQueue'][_0xe863('0x2b')]({'raw':_0x43a566['options']?_0x43a566[_0xe863('0x22')][_0xe863('0x23')]===undefined?!![]:![]:!![],'where':_0x43a566[_0xe863('0x22')]?_0x43a566[_0xe863('0x22')][_0xe863('0x2c')]||null:null,'attributes':_0x43a566[_0xe863('0x22')]?_0x43a566[_0xe863('0x22')][_0xe863('0x24')]||null:null,'include':_0x43a566[_0xe863('0x22')]?_0x43a566['options']['include']?_[_0xe863('0x27')](_0x43a566[_0xe863('0x22')]['include'],function(_0xd98b16){return{'model':db[_0xd98b16[_0xe863('0x28')]],'as':_0xd98b16['as'],'attributes':_0xd98b16[_0xe863('0x24')],'include':_0xd98b16[_0xe863('0x26')]?_[_0xe863('0x27')](_0xd98b16[_0xe863('0x26')],function(_0x572c2b){return{'model':db[_0x572c2b[_0xe863('0x28')]],'as':_0x572c2b['as'],'attributes':_0x572c2b[_0xe863('0x24')],'include':_0x572c2b[_0xe863('0x26')]?_[_0xe863('0x27')](_0x572c2b[_0xe863('0x26')],function(_0x6bc1d6){return{'model':db[_0x6bc1d6[_0xe863('0x28')]],'as':_0x6bc1d6['as'],'attributes':_0x6bc1d6[_0xe863('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe863('0x14')](function(_0x1939a3){logger[_0xe863('0x1c')](_0xe863('0x2a'),_0x43a566);logger[_0xe863('0x29')](_0xe863('0x2a'),_0x43a566,JSON['stringify'](_0x1939a3));_0x44794a(_0x1939a3);})[_0xe863('0x1e')](function(_0x2b908e){logger['error'](_0xe863('0x2a'),_0x2b908e['message'],_0x43a566);_0x2d3668(_0x3f9f73[_0xe863('0x18')](0x1f4,_0x2b908e[_0xe863('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fd82d13..1f1a0c6 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 _0xca7b=['update','register','length','mailQueue:','remove'];(function(_0x5c35f1,_0x4a72b4){var _0x53e5b5=function(_0x3bdb78){while(--_0x3bdb78){_0x5c35f1['push'](_0x5c35f1['shift']());}};_0x53e5b5(++_0x4a72b4);}(_0xca7b,0x14e));var _0xbca7=function(_0x3adf83,_0xb28537){_0x3adf83=_0x3adf83-0x0;var _0x49c2ee=_0xca7b[_0x3adf83];return _0x49c2ee;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xbca7('0x0'),_0xbca7('0x1')];function createListener(_0x5a5ed4,_0xf9ebde){return function(_0x426f96){_0xf9ebde['emit'](_0x5a5ed4,_0x426f96);};}function removeListener(_0x845399,_0x5cb05a){return function(){MailQueueEvents['removeListener'](_0x845399,_0x5cb05a);};}exports[_0xbca7('0x2')]=function(_0x4dec5a){for(var _0x8ff5ea=0x0,_0x53e0e6=events[_0xbca7('0x3')];_0x8ff5ea<_0x53e0e6;_0x8ff5ea++){var _0x140a73=events[_0x8ff5ea];var _0x438f99=createListener(_0xbca7('0x4')+_0x140a73,_0x4dec5a);MailQueueEvents['on'](_0x140a73,_0x438f99);}}; \ No newline at end of file +var _0xf93a=['update','emit','removeListener','register','length','mailQueue:','save','remove'];(function(_0xa036b1,_0x124367){var _0x477f70=function(_0x5331f0){while(--_0x5331f0){_0xa036b1['push'](_0xa036b1['shift']());}};_0x477f70(++_0x124367);}(_0xf93a,0x156));var _0xaf93=function(_0x5c5630,_0xf0518d){_0x5c5630=_0x5c5630-0x0;var _0x4cc26e=_0xf93a[_0x5c5630];return _0x4cc26e;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xaf93('0x0'),_0xaf93('0x1'),_0xaf93('0x2')];function createListener(_0xf0944b,_0x4d17f2){return function(_0x18b9e8){_0x4d17f2[_0xaf93('0x3')](_0xf0944b,_0x18b9e8);};}function removeListener(_0xe7fa27,_0x4d74b9){return function(){MailQueueEvents[_0xaf93('0x4')](_0xe7fa27,_0x4d74b9);};}exports[_0xaf93('0x5')]=function(_0x5bd569){for(var _0x4a039c=0x0,_0x19cc12=events[_0xaf93('0x6')];_0x4a039c<_0x19cc12;_0x4a039c++){var _0x501f90=events[_0x4a039c];var _0x5bde55=createListener(_0xaf93('0x7')+_0x501f90,_0x5bd569);MailQueueEvents['on'](_0x501f90,_0x5bde55);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 78bf632..65b70c1 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 _0x8968=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','post'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8968,0x16d));var _0x8896=function(_0x54b543,_0x5580ff){_0x54b543=_0x54b543-0x0;var _0x344a29=_0x8968[_0x54b543];return _0x344a29;};'use strict';var multer=require(_0x8896('0x0'));var util=require(_0x8896('0x1'));var path=require(_0x8896('0x2'));var timeout=require(_0x8896('0x3'));var express=require(_0x8896('0x4'));var router=express[_0x8896('0x5')]();var fs_extra=require(_0x8896('0x6'));var auth=require(_0x8896('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8896('0x8'));var controller=require(_0x8896('0x9'));router['get']('/',auth[_0x8896('0xa')](),controller['index']);router[_0x8896('0xb')](_0x8896('0xc'),auth['isAuthenticated'](),controller[_0x8896('0xd')]);router[_0x8896('0xb')]('/:id',auth[_0x8896('0xa')](),controller['show']);router[_0x8896('0xe')]('/',auth[_0x8896('0xa')](),controller['create']);router[_0x8896('0xf')](_0x8896('0x10'),auth[_0x8896('0xa')](),controller[_0x8896('0x11')]);router[_0x8896('0x12')](_0x8896('0x10'),auth[_0x8896('0xa')](),controller[_0x8896('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc41b=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','put','exports','multer','util'];(function(_0xe3b0a9,_0x408ac4){var _0x3b64db=function(_0x41effd){while(--_0x41effd){_0xe3b0a9['push'](_0xe3b0a9['shift']());}};_0x3b64db(++_0x408ac4);}(_0xc41b,0x7c));var _0xbc41=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc41b[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xbc41('0x0'));var util=require(_0xbc41('0x1'));var path=require(_0xbc41('0x2'));var timeout=require(_0xbc41('0x3'));var express=require('express');var router=express[_0xbc41('0x4')]();var fs_extra=require(_0xbc41('0x5'));var auth=require(_0xbc41('0x6'));var interaction=require(_0xbc41('0x7'));var config=require(_0xbc41('0x8'));var controller=require(_0xbc41('0x9'));router[_0xbc41('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbc41('0xb'),auth[_0xbc41('0xc')](),controller[_0xbc41('0xd')]);router[_0xbc41('0xa')](_0xbc41('0xe'),auth[_0xbc41('0xc')](),controller[_0xbc41('0xf')]);router['post']('/',auth[_0xbc41('0xc')](),controller['create']);router[_0xbc41('0x10')]('/:id',auth[_0xbc41('0xc')](),controller['update']);router['delete'](_0xbc41('0xe'),auth[_0xbc41('0xc')](),controller['destroy']);module[_0xbc41('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 6a51180..84fd721 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 _0xb894=['DATE','moment','sequelize','STRING'];(function(_0x53c0e9,_0x175c7b){var _0x39686d=function(_0x4369c8){while(--_0x4369c8){_0x53c0e9['push'](_0x53c0e9['shift']());}};_0x39686d(++_0x175c7b);}(_0xb894,0x171));var _0x4b89=function(_0x25315d,_0x526bb2){_0x25315d=_0x25315d-0x0;var _0x15fe6b=_0xb894[_0x25315d];return _0x15fe6b;};'use strict';var moment=require(_0x4b89('0x0'));var Sequelize=require(_0x4b89('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4b89('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4b89('0x3')]},'exitAt':{'type':Sequelize[_0x4b89('0x3')]},'reason':{'type':Sequelize[_0x4b89('0x2')]}}; \ No newline at end of file +var _0xab3f=['STRING','DATE','moment','sequelize','exports'];(function(_0x525790,_0x1064af){var _0x3e82db=function(_0x214308){while(--_0x214308){_0x525790['push'](_0x525790['shift']());}};_0x3e82db(++_0x1064af);}(_0xab3f,0x17e));var _0xfab3=function(_0x58b94b,_0x59eaea){_0x58b94b=_0x58b94b-0x0;var _0x56f981=_0xab3f[_0x58b94b];return _0x56f981;};'use strict';var moment=require(_0xfab3('0x0'));var Sequelize=require(_0xfab3('0x1'));module[_0xfab3('0x2')]={'uniqueid':{'type':Sequelize[_0xfab3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfab3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfab3('0x4')]},'exitAt':{'type':Sequelize[_0xfab3('0x4')]},'reason':{'type':Sequelize[_0xfab3('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8becde0..3c75a62 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 _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x3c3e09,_0x1bd248){var _0x219393=function(_0x291ce3){while(--_0x291ce3){_0x3c3e09['push'](_0x3c3e09['shift']());}};_0x219393(++_0x1bd248);}(_0x81c6,0x1d5));var _0x681c=function(_0x32b894,_0x14c458){_0x32b894=_0x32b894-0x0;var _0x1f4d76=_0x81c6[_0x32b894];return _0x1f4d76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x2539ea,_0x3a6828){var _0x3b5e02=function(_0x29bf72){while(--_0x29bf72){_0x2539ea['push'](_0x2539ea['shift']());}};_0x3b5e02(++_0x3a6828);}(_0x47c5,0x165));var _0x547c=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0x47c5[_0xb1ee0e];return _0x376116;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f769fe9..27328c3 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 _0x24ee=['report_mail_queue','uniqueid','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x2bd0bd,_0x247630){var _0x5f478a=function(_0x14d983){while(--_0x14d983){_0x2bd0bd['push'](_0x2bd0bd['shift']());}};_0x5f478a(++_0x247630);}(_0x24ee,0x1b2));var _0xe24e=function(_0xef9f7f,_0x259a17){_0xef9f7f=_0xef9f7f-0x0;var _0x6ca606=_0x24ee[_0xef9f7f];return _0x6ca606;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe24e('0x0'));var BPromise=require(_0xe24e('0x1'));var rp=require(_0xe24e('0x2'));var fs=require('fs');var path=require(_0xe24e('0x3'));var rimraf=require(_0xe24e('0x4'));var config=require(_0xe24e('0x5'));var attributes=require(_0xe24e('0x6'));module[_0xe24e('0x7')]=function(_0x4d7d92,_0x196805){return _0x4d7d92[_0xe24e('0x8')](_0xe24e('0x9'),attributes,{'tableName':_0xe24e('0xa'),'paranoid':![],'indexes':[{'name':_0xe24e('0xb'),'fields':[_0xe24e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8993=['rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','util','api','bluebird','request-promise','path'];(function(_0x1a99a4,_0x7f28cc){var _0x49ff7f=function(_0x10fc4b){while(--_0x10fc4b){_0x1a99a4['push'](_0x1a99a4['shift']());}};_0x49ff7f(++_0x7f28cc);}(_0x8993,0x19f));var _0x3899=function(_0x29309d,_0x51496b){_0x29309d=_0x29309d-0x0;var _0x56ca56=_0x8993[_0x29309d];return _0x56ca56;};'use strict';var _=require('lodash');var util=require(_0x3899('0x0'));var logger=require('../../config/logger')(_0x3899('0x1'));var moment=require('moment');var BPromise=require(_0x3899('0x2'));var rp=require(_0x3899('0x3'));var fs=require('fs');var path=require(_0x3899('0x4'));var rimraf=require(_0x3899('0x5'));var config=require(_0x3899('0x6'));var attributes=require(_0x3899('0x7'));module['exports']=function(_0x275fe6,_0x30c890){return _0x275fe6['define'](_0x3899('0x8'),attributes,{'tableName':_0x3899('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6fa6c28..dd0e4e6 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x918eb4,_0x1e2eca){var _0x5b07db=function(_0x4143c8){while(--_0x4143c8){_0x918eb4['push'](_0x918eb4['shift']());}};_0x5b07db(++_0x1e2eca);}(_0xdb28,0x106));var _0x8db2=function(_0x426669,_0x36d941){_0x426669=_0x426669-0x0;var _0x533b37=_0xdb28[_0x426669];return _0x533b37;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +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(_0x14293b,_0xd761f6){var _0x13026a=function(_0x282d9b){while(--_0x282d9b){_0x14293b['push'](_0x14293b['shift']());}};_0x13026a(++_0xd761f6);}(_0xadb5,0xad));var _0x5adb=function(_0xecb0cf,_0x280fc3){_0xecb0cf=_0xecb0cf-0x0;var _0x3662d0=_0xadb5[_0xecb0cf];return _0x3662d0;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dc00bcc..4aafccb 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a66a2,_0x4bbb8d){var _0x37ca00=function(_0x1a8301){while(--_0x1a8301){_0x2a66a2['push'](_0x2a66a2['shift']());}};_0x37ca00(++_0x4bbb8d);}(_0x70e0,0x17b));var _0x070e=function(_0x3aa7ad,_0x453815){_0x3aa7ad=_0x3aa7ad-0x0;var _0xfc15ef=_0x70e0[_0x3aa7ad];return _0xfc15ef;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 555a014..916737a 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 _0xb344=['INBOX','INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb344,0x152));var _0x4b34=function(_0x374b9f,_0x35d296){_0x374b9f=_0x374b9f-0x0;var _0x4e6423=_0xb344[_0x374b9f];return _0x4e6423;};'use strict';var Sequelize=require(_0x4b34('0x0'));module[_0x4b34('0x1')]={'description':{'type':Sequelize[_0x4b34('0x2')]},'host':{'type':Sequelize[_0x4b34('0x2')]},'authentication':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4b34('0x2')]},'password':{'type':Sequelize[_0x4b34('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4b34('0x2')],'defaultValue':_0x4b34('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4b34('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4b34('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb356=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x302167,_0x579146){var _0x270438=function(_0x4cf888){while(--_0x4cf888){_0x302167['push'](_0x302167['shift']());}};_0x270438(++_0x579146);}(_0xb356,0x134));var _0x6b35=function(_0x46d922,_0x15ef95){_0x46d922=_0x46d922-0x0;var _0x2bbd5b=_0xb356[_0x46d922];return _0x2bbd5b;};'use strict';var Sequelize=require(_0x6b35('0x0'));module['exports']={'description':{'type':Sequelize[_0x6b35('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x6b35('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6b35('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6b35('0x3')]},'tls':{'type':Sequelize[_0x6b35('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6b35('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x6b35('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6b35('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x6b35('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 d2896c2..cec4f52 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 _0x37fd=['moment','request-promise','rimraf','../../config/environment','MailServerIn','mail_servers_in','lodash','util','api'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x37fd,0x16e));var _0xd37f=function(_0x4c58fd,_0x34e817){_0x4c58fd=_0x4c58fd-0x0;var _0x5eef21=_0x37fd[_0x4c58fd];return _0x5eef21;};'use strict';var _=require(_0xd37f('0x0'));var util=require(_0xd37f('0x1'));var logger=require('../../config/logger')(_0xd37f('0x2'));var moment=require(_0xd37f('0x3'));var BPromise=require('bluebird');var rp=require(_0xd37f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd37f('0x5'));var config=require(_0xd37f('0x6'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x8c3d2a,_0x3f1a44){return _0x8c3d2a['define'](_0xd37f('0x7'),attributes,{'tableName':_0xd37f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1598=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in','lodash','util','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1598,0x69));var _0x8159=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1598[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8159('0x0'));var util=require(_0x8159('0x1'));var logger=require('../../config/logger')(_0x8159('0x2'));var moment=require(_0x8159('0x3'));var BPromise=require(_0x8159('0x4'));var rp=require(_0x8159('0x5'));var fs=require('fs');var path=require(_0x8159('0x6'));var rimraf=require(_0x8159('0x7'));var config=require(_0x8159('0x8'));var attributes=require(_0x8159('0x9'));module['exports']=function(_0x4e13c6,_0x3d8766){return _0x4e13c6[_0x8159('0xa')]('MailServerIn',attributes,{'tableName':_0x8159('0xb'),'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 e9791a0..a848452 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 _0x35ba=['result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4a3001,_0xb66842){var _0x38c2ce=function(_0x4fbde5){while(--_0x4fbde5){_0x4a3001['push'](_0x4a3001['shift']());}};_0x38c2ce(++_0xb66842);}(_0x35ba,0x8c));var _0xa35b=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x35ba[_0xcf581b];return _0x4f454d;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var moment=require(_0xa35b('0x2'));var BPromise=require(_0xa35b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa35b('0x4'));var db=require(_0xa35b('0x5'))['db'];var utils=require(_0xa35b('0x6'));var logger=require(_0xa35b('0x7'))(_0xa35b('0x8'));var config=require(_0xa35b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa35b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f0063,_0x121c8b,_0x2be599){return new BPromise(function(_0x42da91,_0x3ceb59){return client['request'](_0x7f0063,_0x2be599)[_0xa35b('0xb')](function(_0x24a4cf){logger[_0xa35b('0xc')](_0xa35b('0xd'),_0x121c8b,_0xa35b('0xe'));logger[_0xa35b('0xf')](_0xa35b('0x10'),_0x121c8b,_0xa35b('0xe'),JSON[_0xa35b('0x11')](_0x24a4cf));if(_0x24a4cf['error']){if(_0x24a4cf[_0xa35b('0x12')]['code']===0x1f4){logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x121c8b,_0x24a4cf[_0xa35b('0x12')][_0xa35b('0x13')]);return _0x3ceb59(_0x24a4cf[_0xa35b('0x12')]['message']);}logger[_0xa35b('0x12')]('MailServerIn,\x20%s,\x20%s',_0x121c8b,_0x24a4cf[_0xa35b('0x12')]['message']);return _0x42da91(_0x24a4cf[_0xa35b('0x12')][_0xa35b('0x13')]);}else{logger['info'](_0xa35b('0xd'),_0x121c8b,_0xa35b('0xe'));_0x42da91(_0x24a4cf[_0xa35b('0x14')][_0xa35b('0x13')]);}})[_0xa35b('0x15')](function(_0x3f1c6f){logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x121c8b,_0x3f1c6f);_0x3ceb59(_0x3f1c6f);});});}exports[_0xa35b('0x16')]=function(_0x362dd1){var _0xc4d38a=this;return new Promise(function(_0x4ca1ed,_0x4ab9ab){return db[_0xa35b('0x17')]['findAll']({'raw':_0x362dd1[_0xa35b('0x18')]?_0x362dd1[_0xa35b('0x18')][_0xa35b('0x19')]===undefined?!![]:![]:!![],'where':_0x362dd1[_0xa35b('0x18')]?_0x362dd1[_0xa35b('0x18')][_0xa35b('0x1a')]||null:null,'attributes':_0x362dd1[_0xa35b('0x18')]?_0x362dd1[_0xa35b('0x18')][_0xa35b('0x1b')]||null:null,'limit':_0x362dd1[_0xa35b('0x18')]?_0x362dd1[_0xa35b('0x18')][_0xa35b('0x1c')]||null:null,'include':_0x362dd1['options']?_0x362dd1[_0xa35b('0x18')][_0xa35b('0x1d')]?_['map'](_0x362dd1[_0xa35b('0x18')][_0xa35b('0x1d')],function(_0x21896d){return{'model':db[_0x21896d['model']],'as':_0x21896d['as'],'attributes':_0x21896d[_0xa35b('0x1b')],'include':_0x21896d[_0xa35b('0x1d')]?_[_0xa35b('0x1e')](_0x21896d['include'],function(_0x19a3cb){return{'model':db[_0x19a3cb[_0xa35b('0x1f')]],'as':_0x19a3cb['as'],'attributes':_0x19a3cb[_0xa35b('0x1b')],'include':_0x19a3cb[_0xa35b('0x1d')]?_['map'](_0x19a3cb[_0xa35b('0x1d')],function(_0x33da60){return{'model':db[_0x33da60['model']],'as':_0x33da60['as'],'attributes':_0x33da60[_0xa35b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa35b('0xb')](function(_0xd5dfaa){logger[_0xa35b('0xc')](_0xa35b('0x16'),_0x362dd1);logger[_0xa35b('0xf')](_0xa35b('0x16'),_0x362dd1,JSON[_0xa35b('0x11')](_0xd5dfaa));_0x4ca1ed(_0xd5dfaa);})['catch'](function(_0x130dae){logger[_0xa35b('0x12')](_0xa35b('0x16'),_0x130dae[_0xa35b('0x13')],_0x362dd1);_0x4ab9ab(_0xc4d38a[_0xa35b('0x12')](0x1f4,_0x130dae['message']));});});}; \ No newline at end of file +var _0x8e44=['catch','GetMailServerIn','findAll','raw','options','where','limit','include','map','model','attributes','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x7a9beb,_0x4fc7a4){var _0x43533e=function(_0xf09eff){while(--_0xf09eff){_0x7a9beb['push'](_0x7a9beb['shift']());}};_0x43533e(++_0x4fc7a4);}(_0x8e44,0x1ac));var _0x48e4=function(_0x1f8ec0,_0x933b58){_0x1f8ec0=_0x1f8ec0-0x0;var _0x5f4c0e=_0x8e44[_0x1f8ec0];return _0x5f4c0e;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2c12,_0x26c5de,_0xfd30df){return new BPromise(function(_0x552cb1,_0x1ae7a7){return client[_0x48e4('0xa')](_0x4e2c12,_0xfd30df)[_0x48e4('0xb')](function(_0x2ba319){logger[_0x48e4('0xc')](_0x48e4('0xd'),_0x26c5de,'request\x20sent');logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x26c5de,_0x48e4('0x10'),JSON['stringify'](_0x2ba319));if(_0x2ba319['error']){if(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x12')]===0x1f4){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319['error'][_0x48e4('0x13')]);return _0x1ae7a7(_0x2ba319['error'][_0x48e4('0x13')]);}logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);return _0x552cb1(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);}else{logger['info'](_0x48e4('0xd'),_0x26c5de,_0x48e4('0x10'));_0x552cb1(_0x2ba319['result'][_0x48e4('0x13')]);}})[_0x48e4('0x14')](function(_0x4dc92e){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x4dc92e);_0x1ae7a7(_0x4dc92e);});});}exports[_0x48e4('0x15')]=function(_0x4ffc0d){var _0x231dcd=this;return new Promise(function(_0x16e405,_0x4e3943){return db['MailServerIn'][_0x48e4('0x16')]({'raw':_0x4ffc0d['options']?_0x4ffc0d['options'][_0x48e4('0x17')]===undefined?!![]:![]:!![],'where':_0x4ffc0d[_0x48e4('0x18')]?_0x4ffc0d[_0x48e4('0x18')][_0x48e4('0x19')]||null:null,'attributes':_0x4ffc0d[_0x48e4('0x18')]?_0x4ffc0d['options']['attributes']||null:null,'limit':_0x4ffc0d[_0x48e4('0x18')]?_0x4ffc0d[_0x48e4('0x18')][_0x48e4('0x1a')]||null:null,'include':_0x4ffc0d[_0x48e4('0x18')]?_0x4ffc0d[_0x48e4('0x18')][_0x48e4('0x1b')]?_[_0x48e4('0x1c')](_0x4ffc0d[_0x48e4('0x18')][_0x48e4('0x1b')],function(_0x3c0082){return{'model':db[_0x3c0082[_0x48e4('0x1d')]],'as':_0x3c0082['as'],'attributes':_0x3c0082['attributes'],'include':_0x3c0082[_0x48e4('0x1b')]?_[_0x48e4('0x1c')](_0x3c0082['include'],function(_0x2beac2){return{'model':db[_0x2beac2[_0x48e4('0x1d')]],'as':_0x2beac2['as'],'attributes':_0x2beac2['attributes'],'include':_0x2beac2[_0x48e4('0x1b')]?_[_0x48e4('0x1c')](_0x2beac2[_0x48e4('0x1b')],function(_0xc113e3){return{'model':db[_0xc113e3[_0x48e4('0x1d')]],'as':_0xc113e3['as'],'attributes':_0xc113e3[_0x48e4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x48e4('0xb')](function(_0x4ae6ba){logger[_0x48e4('0xc')](_0x48e4('0x15'),_0x4ffc0d);logger['debug']('GetMailServerIn',_0x4ffc0d,JSON[_0x48e4('0x1f')](_0x4ae6ba));_0x16e405(_0x4ae6ba);})['catch'](function(_0x346765){logger[_0x48e4('0x11')]('GetMailServerIn',_0x346765[_0x48e4('0x13')],_0x4ffc0d);_0x4e3943(_0x231dcd[_0x48e4('0x11')](0x1f4,_0x346765[_0x48e4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 902468e..bb50564 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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0x131930,_0x43160d){_0x131930=_0x131930-0x0;var _0x274c64=_0x7a54[_0x131930];return _0x274c64;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0xdf1a1c,_0x4fa1ae){_0xdf1a1c=_0xdf1a1c-0x0;var _0x330c10=_0x7a54[_0xdf1a1c];return _0x330c10;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5457287..fcb5e92 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 _0xe706=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x404b28,_0x5f3e10){var _0x374ee0=function(_0x506702){while(--_0x506702){_0x404b28['push'](_0x404b28['shift']());}};_0x374ee0(++_0x5f3e10);}(_0xe706,0xa3));var _0x6e70=function(_0x24ffa5,_0x119b94){_0x24ffa5=_0x24ffa5-0x0;var _0x1f0a5f=_0xe706[_0x24ffa5];return _0x1f0a5f;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'description':{'type':Sequelize[_0x6e70('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6e70('0x2')]},'pass':{'type':Sequelize[_0x6e70('0x2')]},'port':{'type':Sequelize[_0x6e70('0x3')]},'secure':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6e70('0x2')]},'authentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x47a5ee,_0x57a304){var _0x2176cd=function(_0x5efba7){while(--_0x5efba7){_0x47a5ee['push'](_0x47a5ee['shift']());}};_0x2176cd(++_0x57a304);}(_0x351d,0x90));var _0xd351=function(_0x3466ec,_0x2a58cf){_0x3466ec=_0x3466ec-0x0;var _0x57de88=_0x351d[_0x3466ec];return _0x57de88;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'description':{'type':Sequelize[_0xd351('0x1')]},'host':{'type':Sequelize[_0xd351('0x1')]},'user':{'type':Sequelize[_0xd351('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd351('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xd351('0x1')]},'authentication':{'type':Sequelize[_0xd351('0x3')],'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 ec0636b..09210be 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 _0x1b41=['map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','sort','filters','where','merge','VIRTUAL','name','filter','options','MailServerOut','count','includeAll','findAll','rows','catch','params','keys','include','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','send'];(function(_0x351961,_0x50abe5){var _0x22d718=function(_0x2c1c14){while(--_0x2c1c14){_0x351961['push'](_0x351961['shift']());}};_0x22d718(++_0x50abe5);}(_0x1b41,0x69));var _0x11b4=function(_0x9b1166,_0x384402){_0x9b1166=_0x9b1166-0x0;var _0x2ad057=_0x1b41[_0x9b1166];return _0x2ad057;};'use strict';var emlformat=require(_0x11b4('0x0'));var rimraf=require(_0x11b4('0x1'));var zipdir=require(_0x11b4('0x2'));var jsonpatch=require(_0x11b4('0x3'));var rp=require(_0x11b4('0x4'));var moment=require(_0x11b4('0x5'));var BPromise=require(_0x11b4('0x6'));var Mustache=require(_0x11b4('0x7'));var util=require(_0x11b4('0x8'));var path=require('path');var sox=require(_0x11b4('0x9'));var csv=require('to-csv');var ejs=require(_0x11b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11b4('0xb'));var squel=require('squel');var crypto=require(_0x11b4('0xc'));var jsforce=require(_0x11b4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x11b4('0xe'));var querystring=require(_0x11b4('0xf'));var Papa=require(_0x11b4('0x10'));var Redis=require(_0x11b4('0x11'));var authService=require(_0x11b4('0x12'));var qs=require(_0x11b4('0x13'));var as=require(_0x11b4('0x14'));var hardwareService=require(_0x11b4('0x15'));var logger=require(_0x11b4('0x16'))(_0x11b4('0x17'));var utils=require(_0x11b4('0x18'));var config=require(_0x11b4('0x19'));var licenseUtil=require(_0x11b4('0x1a'));var db=require(_0x11b4('0x1b'))['db'];function respondWithStatusCode(_0x3da96e,_0x3385b0){_0x3385b0=_0x3385b0||0xcc;return function(_0x55c9a2){if(_0x55c9a2){return _0x3da96e['sendStatus'](_0x3385b0);}return _0x3da96e[_0x11b4('0x1c')](_0x3385b0)[_0x11b4('0x1d')]();};}function respondWithResult(_0x8bb8fd,_0x467409){_0x467409=_0x467409||0xc8;return function(_0x11e8f1){if(_0x11e8f1){return _0x8bb8fd[_0x11b4('0x1c')](_0x467409)[_0x11b4('0x1e')](_0x11e8f1);}};}function respondWithFilteredResult(_0xd0bebc,_0x370d4c){return function(_0x28c91d){if(_0x28c91d){var _0x1aa3c4=typeof _0x370d4c[_0x11b4('0x1f')]===_0x11b4('0x20')&&typeof _0x370d4c[_0x11b4('0x21')]===_0x11b4('0x20');var _0x1eaa02=_0x28c91d['count'];var _0x198930=_0x1aa3c4?0x0:_0x370d4c[_0x11b4('0x1f')];var _0x235b98=_0x1aa3c4?_0x28c91d['count']:_0x370d4c['offset']+_0x370d4c[_0x11b4('0x21')];var _0x2bc36e;if(_0x235b98>=_0x1eaa02){_0x235b98=_0x1eaa02;_0x2bc36e=0xc8;}else{_0x2bc36e=0xce;}_0xd0bebc['status'](_0x2bc36e);return _0xd0bebc[_0x11b4('0x22')](_0x11b4('0x23'),_0x198930+'-'+_0x235b98+'/'+_0x1eaa02)[_0x11b4('0x1e')](_0x28c91d);}return null;};}function patchUpdates(_0x649c92){return function(_0x538ef2){try{jsonpatch[_0x11b4('0x24')](_0x538ef2,_0x649c92,!![]);}catch(_0x18a94b){return BPromise[_0x11b4('0x25')](_0x18a94b);}return _0x538ef2['save']();};}function saveUpdates(_0x3ef18c,_0x454f29){return function(_0x199237){if(_0x199237){return _0x199237['update'](_0x3ef18c)[_0x11b4('0x26')](function(_0x39bee8){return _0x39bee8;});}return null;};}function removeEntity(_0xf9400f,_0x1d6f1d){return function(_0x41f150){if(_0x41f150){return _0x41f150[_0x11b4('0x27')]()[_0x11b4('0x26')](function(){_0xf9400f[_0x11b4('0x1c')](0xcc)[_0x11b4('0x1d')]();});}};}function handleEntityNotFound(_0x5996a6,_0x41e2fe){return function(_0xc3d01b){if(!_0xc3d01b){_0x5996a6['sendStatus'](0x194);}return _0xc3d01b;};}function handleError(_0x68f8e3,_0x3b644d){_0x3b644d=_0x3b644d||0x1f4;return function(_0xef2b91){logger[_0x11b4('0x28')](_0xef2b91[_0x11b4('0x29')]);if(_0xef2b91['name']){delete _0xef2b91['name'];}_0x68f8e3[_0x11b4('0x1c')](_0x3b644d)[_0x11b4('0x2a')](_0xef2b91);};}exports['index']=function(_0x7ab8cd,_0x119e40){var _0x1f15b2={},_0x4354bd={},_0x3f89fc={'count':0x0,'rows':[]};var _0x73f333=_[_0x11b4('0x2b')](db['MailServerOut'][_0x11b4('0x2c')],function(_0x4e5393){return{'name':_0x4e5393[_0x11b4('0x2d')],'type':_0x4e5393['type']['key']};});_0x4354bd[_0x11b4('0x2e')]=_[_0x11b4('0x2b')](_0x73f333,'name');_0x4354bd[_0x11b4('0x2f')]=_['keys'](_0x7ab8cd['query']);_0x4354bd['filters']=_[_0x11b4('0x30')](_0x4354bd[_0x11b4('0x2e')],_0x4354bd['query']);_0x1f15b2[_0x11b4('0x31')]=_[_0x11b4('0x30')](_0x4354bd[_0x11b4('0x2e')],qs[_0x11b4('0x32')](_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x32')]));_0x1f15b2['attributes']=_0x1f15b2[_0x11b4('0x31')][_0x11b4('0x33')]?_0x1f15b2[_0x11b4('0x31')]:_0x4354bd[_0x11b4('0x2e')];if(!_0x7ab8cd[_0x11b4('0x2f')]['hasOwnProperty'](_0x11b4('0x34'))){_0x1f15b2['limit']=qs['limit'](_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x21')]);_0x1f15b2['offset']=qs[_0x11b4('0x1f')](_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x1f')]);}_0x1f15b2['order']=qs[_0x11b4('0x35')](_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x35')]);_0x1f15b2['where']=qs[_0x11b4('0x36')](_['pick'](_0x7ab8cd['query'],_0x4354bd[_0x11b4('0x36')]),_0x73f333);if(_0x7ab8cd[_0x11b4('0x2f')]['filter']){_0x1f15b2[_0x11b4('0x37')]=_[_0x11b4('0x38')](_0x1f15b2[_0x11b4('0x37')],{'$or':_[_0x11b4('0x2b')](_0x73f333,function(_0x74bcf1){if(_0x74bcf1['type']!==_0x11b4('0x39')){var _0x1d5c98={};_0x1d5c98[_0x74bcf1[_0x11b4('0x3a')]]={'$like':'%'+_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x3b')]+'%'};return _0x1d5c98;}})});}_0x1f15b2=_[_0x11b4('0x38')]({},_0x1f15b2,_0x7ab8cd[_0x11b4('0x3c')]);var _0x5d6e67={'where':_0x1f15b2[_0x11b4('0x37')]};return db[_0x11b4('0x3d')][_0x11b4('0x3e')](_0x5d6e67)[_0x11b4('0x26')](function(_0x5b4c40){_0x3f89fc['count']=_0x5b4c40;if(_0x7ab8cd[_0x11b4('0x2f')][_0x11b4('0x3f')]){_0x1f15b2['include']=[{'all':!![]}];}return db[_0x11b4('0x3d')][_0x11b4('0x40')](_0x1f15b2);})[_0x11b4('0x26')](function(_0x1ec469){_0x3f89fc[_0x11b4('0x41')]=_0x1ec469;return _0x3f89fc;})[_0x11b4('0x26')](respondWithFilteredResult(_0x119e40,_0x1f15b2))[_0x11b4('0x42')](handleError(_0x119e40,null));};exports['show']=function(_0x38af3,_0x183914){var _0x1a4d86={'raw':!![],'where':{'id':_0x38af3[_0x11b4('0x43')]['id']}},_0x18712={};_0x18712[_0x11b4('0x2e')]=_[_0x11b4('0x44')](db[_0x11b4('0x3d')][_0x11b4('0x2c')]);_0x18712[_0x11b4('0x2f')]=_[_0x11b4('0x44')](_0x38af3['query']);_0x18712[_0x11b4('0x36')]=_['intersection'](_0x18712['model'],_0x18712[_0x11b4('0x2f')]);_0x1a4d86[_0x11b4('0x31')]=_['intersection'](_0x18712['model'],qs[_0x11b4('0x32')](_0x38af3[_0x11b4('0x2f')]['fields']));_0x1a4d86[_0x11b4('0x31')]=_0x1a4d86[_0x11b4('0x31')][_0x11b4('0x33')]?_0x1a4d86[_0x11b4('0x31')]:_0x18712[_0x11b4('0x2e')];if(_0x38af3[_0x11b4('0x2f')][_0x11b4('0x3f')]){_0x1a4d86[_0x11b4('0x45')]=[{'all':!![]}];}_0x1a4d86=_[_0x11b4('0x38')]({},_0x1a4d86,_0x38af3[_0x11b4('0x3c')]);return db[_0x11b4('0x3d')]['find'](_0x1a4d86)['then'](handleEntityNotFound(_0x183914,null))[_0x11b4('0x26')](respondWithResult(_0x183914,null))['catch'](handleError(_0x183914,null));};exports[_0x11b4('0x46')]=function(_0xdd2412,_0x1f5a18){return db[_0x11b4('0x3d')][_0x11b4('0x46')](_0xdd2412[_0x11b4('0x47')],{})['then'](respondWithResult(_0x1f5a18,0xc9))[_0x11b4('0x42')](handleError(_0x1f5a18,null));};exports[_0x11b4('0x48')]=function(_0x5ec6d5,_0x5cd219){if(_0x5ec6d5['body']['id']){delete _0x5ec6d5[_0x11b4('0x47')]['id'];}return db[_0x11b4('0x3d')][_0x11b4('0x49')]({'where':{'id':_0x5ec6d5[_0x11b4('0x43')]['id']}})[_0x11b4('0x26')](handleEntityNotFound(_0x5cd219,null))['then'](saveUpdates(_0x5ec6d5['body'],null))['then'](respondWithResult(_0x5cd219,null))[_0x11b4('0x42')](handleError(_0x5cd219,null));};exports[_0x11b4('0x27')]=function(_0x11c53c,_0x284d13){return db[_0x11b4('0x3d')][_0x11b4('0x49')]({'where':{'id':_0x11c53c[_0x11b4('0x43')]['id']}})[_0x11b4('0x26')](handleEntityNotFound(_0x284d13,null))[_0x11b4('0x26')](removeEntity(_0x284d13,null))['catch'](handleError(_0x284d13,null));}; \ No newline at end of file +var _0x4890=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','rimraf','zip-dir'];(function(_0x413986,_0x508842){var _0x25a8ad=function(_0x386d2a){while(--_0x386d2a){_0x413986['push'](_0x413986['shift']());}};_0x25a8ad(++_0x508842);}(_0x4890,0x1ba));var _0x0489=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4890[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0489('0x0'));var zipdir=require(_0x0489('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0489('0x2'));var moment=require(_0x0489('0x3'));var BPromise=require(_0x0489('0x4'));var Mustache=require(_0x0489('0x5'));var util=require(_0x0489('0x6'));var path=require(_0x0489('0x7'));var sox=require('sox');var csv=require(_0x0489('0x8'));var ejs=require(_0x0489('0x9'));var fs=require('fs');var fs_extra=require(_0x0489('0xa'));var _=require(_0x0489('0xb'));var squel=require(_0x0489('0xc'));var crypto=require(_0x0489('0xd'));var jsforce=require(_0x0489('0xe'));var deskjs=require(_0x0489('0xf'));var toCsv=require(_0x0489('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0489('0x10'));var authService=require(_0x0489('0x11'));var qs=require(_0x0489('0x12'));var as=require(_0x0489('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0489('0x14'));var utils=require(_0x0489('0x15'));var config=require(_0x0489('0x16'));var licenseUtil=require(_0x0489('0x17'));var db=require(_0x0489('0x18'))['db'];function respondWithStatusCode(_0x370d9e,_0x519fd4){_0x519fd4=_0x519fd4||0xcc;return function(_0x14a05b){if(_0x14a05b){return _0x370d9e[_0x0489('0x19')](_0x519fd4);}return _0x370d9e[_0x0489('0x1a')](_0x519fd4)[_0x0489('0x1b')]();};}function respondWithResult(_0x23188a,_0x844eb1){_0x844eb1=_0x844eb1||0xc8;return function(_0x3143cc){if(_0x3143cc){return _0x23188a[_0x0489('0x1a')](_0x844eb1)['json'](_0x3143cc);}};}function respondWithFilteredResult(_0x24bd6b,_0x10241c){return function(_0x1481eb){if(_0x1481eb){var _0x121590=typeof _0x10241c[_0x0489('0x1c')]===_0x0489('0x1d')&&typeof _0x10241c[_0x0489('0x1e')]===_0x0489('0x1d');var _0x487e52=_0x1481eb[_0x0489('0x1f')];var _0x273afe=_0x121590?0x0:_0x10241c['offset'];var _0x5233bd=_0x121590?_0x1481eb[_0x0489('0x1f')]:_0x10241c[_0x0489('0x1c')]+_0x10241c[_0x0489('0x1e')];var _0x20a154;if(_0x5233bd>=_0x487e52){_0x5233bd=_0x487e52;_0x20a154=0xc8;}else{_0x20a154=0xce;}_0x24bd6b[_0x0489('0x1a')](_0x20a154);return _0x24bd6b[_0x0489('0x20')](_0x0489('0x21'),_0x273afe+'-'+_0x5233bd+'/'+_0x487e52)[_0x0489('0x22')](_0x1481eb);}return null;};}function patchUpdates(_0x33d72e){return function(_0x4473d4){try{jsonpatch[_0x0489('0x23')](_0x4473d4,_0x33d72e,!![]);}catch(_0x3424f9){return BPromise['reject'](_0x3424f9);}return _0x4473d4['save']();};}function saveUpdates(_0x44847c,_0x2f0710){return function(_0x38654e){if(_0x38654e){return _0x38654e[_0x0489('0x24')](_0x44847c)['then'](function(_0x228668){return _0x228668;});}return null;};}function removeEntity(_0x3c585f,_0xf6cb2d){return function(_0xae7bed){if(_0xae7bed){return _0xae7bed[_0x0489('0x25')]()[_0x0489('0x26')](function(){_0x3c585f[_0x0489('0x1a')](0xcc)[_0x0489('0x1b')]();});}};}function handleEntityNotFound(_0x334c12,_0x177c18){return function(_0x2c6046){if(!_0x2c6046){_0x334c12[_0x0489('0x19')](0x194);}return _0x2c6046;};}function handleError(_0x5e68e1,_0x1e6f9a){_0x1e6f9a=_0x1e6f9a||0x1f4;return function(_0x30e4f5){logger['error'](_0x30e4f5[_0x0489('0x27')]);if(_0x30e4f5['name']){delete _0x30e4f5[_0x0489('0x28')];}_0x5e68e1['status'](_0x1e6f9a)[_0x0489('0x29')](_0x30e4f5);};}exports[_0x0489('0x2a')]=function(_0x289c71,_0x127613){var _0x4915f9={},_0x53ec48={},_0x11b808={'count':0x0,'rows':[]};var _0x59991e=_[_0x0489('0x2b')](db[_0x0489('0x2c')][_0x0489('0x2d')],function(_0x440cd5){return{'name':_0x440cd5[_0x0489('0x2e')],'type':_0x440cd5[_0x0489('0x2f')][_0x0489('0x30')]};});_0x53ec48[_0x0489('0x31')]=_['map'](_0x59991e,_0x0489('0x28'));_0x53ec48[_0x0489('0x32')]=_[_0x0489('0x33')](_0x289c71[_0x0489('0x32')]);_0x53ec48[_0x0489('0x34')]=_['intersection'](_0x53ec48[_0x0489('0x31')],_0x53ec48[_0x0489('0x32')]);_0x4915f9[_0x0489('0x35')]=_['intersection'](_0x53ec48[_0x0489('0x31')],qs[_0x0489('0x36')](_0x289c71[_0x0489('0x32')][_0x0489('0x36')]));_0x4915f9[_0x0489('0x35')]=_0x4915f9[_0x0489('0x35')][_0x0489('0x37')]?_0x4915f9[_0x0489('0x35')]:_0x53ec48[_0x0489('0x31')];if(!_0x289c71['query'][_0x0489('0x38')](_0x0489('0x39'))){_0x4915f9[_0x0489('0x1e')]=qs[_0x0489('0x1e')](_0x289c71[_0x0489('0x32')][_0x0489('0x1e')]);_0x4915f9[_0x0489('0x1c')]=qs[_0x0489('0x1c')](_0x289c71[_0x0489('0x32')][_0x0489('0x1c')]);}_0x4915f9[_0x0489('0x3a')]=qs['sort'](_0x289c71[_0x0489('0x32')]['sort']);_0x4915f9[_0x0489('0x3b')]=qs[_0x0489('0x34')](_[_0x0489('0x3c')](_0x289c71[_0x0489('0x32')],_0x53ec48[_0x0489('0x34')]),_0x59991e);if(_0x289c71['query'][_0x0489('0x3d')]){_0x4915f9['where']=_[_0x0489('0x3e')](_0x4915f9[_0x0489('0x3b')],{'$or':_[_0x0489('0x2b')](_0x59991e,function(_0x16ba85){if(_0x16ba85[_0x0489('0x2f')]!=='VIRTUAL'){var _0x3a12f9={};_0x3a12f9[_0x16ba85[_0x0489('0x28')]]={'$like':'%'+_0x289c71[_0x0489('0x32')][_0x0489('0x3d')]+'%'};return _0x3a12f9;}})});}_0x4915f9=_[_0x0489('0x3e')]({},_0x4915f9,_0x289c71['options']);var _0x178029={'where':_0x4915f9[_0x0489('0x3b')]};return db[_0x0489('0x2c')][_0x0489('0x1f')](_0x178029)[_0x0489('0x26')](function(_0xafa282){_0x11b808[_0x0489('0x1f')]=_0xafa282;if(_0x289c71[_0x0489('0x32')][_0x0489('0x3f')]){_0x4915f9[_0x0489('0x40')]=[{'all':!![]}];}return db[_0x0489('0x2c')][_0x0489('0x41')](_0x4915f9);})[_0x0489('0x26')](function(_0x1720b4){_0x11b808[_0x0489('0x42')]=_0x1720b4;return _0x11b808;})[_0x0489('0x26')](respondWithFilteredResult(_0x127613,_0x4915f9))[_0x0489('0x43')](handleError(_0x127613,null));};exports[_0x0489('0x44')]=function(_0x255549,_0x562ba4){var _0x527f94={'raw':!![],'where':{'id':_0x255549[_0x0489('0x45')]['id']}},_0x320ada={};_0x320ada['model']=_[_0x0489('0x33')](db[_0x0489('0x2c')]['rawAttributes']);_0x320ada[_0x0489('0x32')]=_['keys'](_0x255549[_0x0489('0x32')]);_0x320ada[_0x0489('0x34')]=_[_0x0489('0x46')](_0x320ada['model'],_0x320ada[_0x0489('0x32')]);_0x527f94['attributes']=_['intersection'](_0x320ada['model'],qs[_0x0489('0x36')](_0x255549[_0x0489('0x32')][_0x0489('0x36')]));_0x527f94[_0x0489('0x35')]=_0x527f94[_0x0489('0x35')][_0x0489('0x37')]?_0x527f94[_0x0489('0x35')]:_0x320ada[_0x0489('0x31')];if(_0x255549[_0x0489('0x32')][_0x0489('0x3f')]){_0x527f94[_0x0489('0x40')]=[{'all':!![]}];}_0x527f94=_[_0x0489('0x3e')]({},_0x527f94,_0x255549['options']);return db[_0x0489('0x2c')][_0x0489('0x47')](_0x527f94)[_0x0489('0x26')](handleEntityNotFound(_0x562ba4,null))['then'](respondWithResult(_0x562ba4,null))[_0x0489('0x43')](handleError(_0x562ba4,null));};exports[_0x0489('0x48')]=function(_0x48a78e,_0x3665e4){return db[_0x0489('0x2c')][_0x0489('0x48')](_0x48a78e['body'],{})[_0x0489('0x26')](respondWithResult(_0x3665e4,0xc9))['catch'](handleError(_0x3665e4,null));};exports['update']=function(_0x3392ac,_0x4403ef){if(_0x3392ac[_0x0489('0x49')]['id']){delete _0x3392ac['body']['id'];}return db[_0x0489('0x2c')][_0x0489('0x47')]({'where':{'id':_0x3392ac[_0x0489('0x45')]['id']}})[_0x0489('0x26')](handleEntityNotFound(_0x4403ef,null))['then'](saveUpdates(_0x3392ac[_0x0489('0x49')],null))[_0x0489('0x26')](respondWithResult(_0x4403ef,null))[_0x0489('0x43')](handleError(_0x4403ef,null));};exports['destroy']=function(_0x50619c,_0x2661a8){return db[_0x0489('0x2c')][_0x0489('0x47')]({'where':{'id':_0x50619c['params']['id']}})[_0x0489('0x26')](handleEntityNotFound(_0x2661a8,null))['then'](removeEntity(_0x2661a8,null))[_0x0489('0x43')](handleError(_0x2661a8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5fdd9d5..e93495d 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 _0x54e1=['util','api','moment','request-promise','path','rimraf','../../config/environment','define','MailServerOut','mail_servers_out'];(function(_0x4c9024,_0x32d1c4){var _0x378664=function(_0x56dfa9){while(--_0x56dfa9){_0x4c9024['push'](_0x4c9024['shift']());}};_0x378664(++_0x32d1c4);}(_0x54e1,0xb4));var _0x154e=function(_0x120d22,_0x25aa55){_0x120d22=_0x120d22-0x0;var _0xb93200=_0x54e1[_0x120d22];return _0xb93200;};'use strict';var _=require('lodash');var util=require(_0x154e('0x0'));var logger=require('../../config/logger')(_0x154e('0x1'));var moment=require(_0x154e('0x2'));var BPromise=require('bluebird');var rp=require(_0x154e('0x3'));var fs=require('fs');var path=require(_0x154e('0x4'));var rimraf=require(_0x154e('0x5'));var config=require(_0x154e('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x5ae60d,_0x4fac73){return _0x5ae60d[_0x154e('0x7')](_0x154e('0x8'),attributes,{'tableName':_0x154e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a16=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x5206fc,_0x2eec61){var _0x12acf6=function(_0x21c5aa){while(--_0x21c5aa){_0x5206fc['push'](_0x5206fc['shift']());}};_0x12acf6(++_0x2eec61);}(_0x1a16,0x1ee));var _0x61a1=function(_0x727ef5,_0x5163f1){_0x727ef5=_0x727ef5-0x0;var _0x209b60=_0x1a16[_0x727ef5];return _0x209b60;};'use strict';var _=require('lodash');var util=require(_0x61a1('0x0'));var logger=require(_0x61a1('0x1'))(_0x61a1('0x2'));var moment=require(_0x61a1('0x3'));var BPromise=require(_0x61a1('0x4'));var rp=require(_0x61a1('0x5'));var fs=require('fs');var path=require(_0x61a1('0x6'));var rimraf=require(_0x61a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x61a1('0x8'));module[_0x61a1('0x9')]=function(_0x431464,_0x3b9094){return _0x431464[_0x61a1('0xa')](_0x61a1('0xb'),attributes,{'tableName':_0x61a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 04ae2d1..16e6670 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x59cc38,_0x5aa8ce){_0x59cc38=_0x59cc38-0x0;var _0x306c20=_0x7a54[_0x59cc38];return _0x306c20;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xadb5,0xad));var _0x5adb=function(_0x4d52b6,_0x407e64){_0x4d52b6=_0x4d52b6-0x0;var _0x17186b=_0xadb5[_0x4d52b6];return _0x17186b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 15a1033..9dfcbc6 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 _0x7eb0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x42a99d,_0x564919){var _0x3d37fe=function(_0x5d0d25){while(--_0x5d0d25){_0x42a99d['push'](_0x42a99d['shift']());}};_0x3d37fe(++_0x564919);}(_0x7eb0,0x72));var _0x07eb=function(_0x1b5200,_0x15a7d3){_0x1b5200=_0x1b5200-0x0;var _0x2c7ae8=_0x7eb0[_0x1b5200];return _0x2c7ae8;};'use strict';var multer=require(_0x07eb('0x0'));var util=require(_0x07eb('0x1'));var path=require(_0x07eb('0x2'));var timeout=require(_0x07eb('0x3'));var express=require(_0x07eb('0x4'));var router=express[_0x07eb('0x5')]();var fs_extra=require(_0x07eb('0x6'));var auth=require(_0x07eb('0x7'));var interaction=require(_0x07eb('0x8'));var config=require(_0x07eb('0x9'));var controller=require(_0x07eb('0xa'));router['get']('/',auth[_0x07eb('0xb')](),controller['index']);router['get'](_0x07eb('0xc'),auth[_0x07eb('0xb')](),controller['describe']);router['get'](_0x07eb('0xd'),auth[_0x07eb('0xb')](),controller[_0x07eb('0xe')]);router[_0x07eb('0xf')]('/',auth[_0x07eb('0xb')](),controller['create']);router['put']('/:id',auth[_0x07eb('0xb')](),controller[_0x07eb('0x10')]);router[_0x07eb('0x11')](_0x07eb('0xd'),auth['isAuthenticated'](),controller[_0x07eb('0x12')]);module[_0x07eb('0x13')]=router; \ No newline at end of file +var _0x1c8f=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','describe','isAuthenticated','show','post'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x1c8f,0x9a));var _0xf1c8=function(_0xaaa84b,_0x16ae07){_0xaaa84b=_0xaaa84b-0x0;var _0x9fff37=_0x1c8f[_0xaaa84b];return _0x9fff37;};'use strict';var multer=require(_0xf1c8('0x0'));var util=require(_0xf1c8('0x1'));var path=require('path');var timeout=require(_0xf1c8('0x2'));var express=require(_0xf1c8('0x3'));var router=express[_0xf1c8('0x4')]();var fs_extra=require(_0xf1c8('0x5'));var auth=require(_0xf1c8('0x6'));var interaction=require(_0xf1c8('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xf1c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xf1c8('0x9')]);router[_0xf1c8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf1c8('0xa')]);router['get']('/:id',auth[_0xf1c8('0xb')](),controller[_0xf1c8('0xc')]);router[_0xf1c8('0xd')]('/',auth[_0xf1c8('0xb')](),controller[_0xf1c8('0xe')]);router[_0xf1c8('0xf')](_0xf1c8('0x10'),auth[_0xf1c8('0xb')](),controller[_0xf1c8('0x11')]);router[_0xf1c8('0x12')](_0xf1c8('0x10'),auth['isAuthenticated'](),controller[_0xf1c8('0x13')]);module[_0xf1c8('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 82ebfd0..fa8fa8e 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 _0x4317=['name','exports','STRING'];(function(_0x582d97,_0x4ebd54){var _0x23caca=function(_0x12a9a5){while(--_0x12a9a5){_0x582d97['push'](_0x582d97['shift']());}};_0x23caca(++_0x4ebd54);}(_0x4317,0x7c));var _0x7431=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4317[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x7431('0x0')]={'name':{'type':Sequelize[_0x7431('0x1')],'unique':_0x7431('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c95bab1..e94bde8 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 _0xeb39=['then','error','stack','name','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x597bcd,_0x37e32a){var _0x5a7227=function(_0x2ea8db){while(--_0x2ea8db){_0x597bcd['push'](_0x597bcd['shift']());}};_0x5a7227(++_0x37e32a);}(_0xeb39,0x19c));var _0x9eb3=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xeb39[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x9eb3('0x0'));var rimraf=require(_0x9eb3('0x1'));var zipdir=require(_0x9eb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9eb3('0x3'));var moment=require(_0x9eb3('0x4'));var BPromise=require(_0x9eb3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9eb3('0x6'));var sox=require('sox');var csv=require(_0x9eb3('0x7'));var ejs=require(_0x9eb3('0x8'));var fs=require('fs');var fs_extra=require(_0x9eb3('0x9'));var _=require(_0x9eb3('0xa'));var squel=require(_0x9eb3('0xb'));var crypto=require(_0x9eb3('0xc'));var jsforce=require(_0x9eb3('0xd'));var deskjs=require(_0x9eb3('0xe'));var toCsv=require(_0x9eb3('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9eb3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9eb3('0x10'));var as=require(_0x9eb3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9eb3('0x12'))(_0x9eb3('0x13'));var utils=require(_0x9eb3('0x14'));var config=require(_0x9eb3('0x15'));var licenseUtil=require(_0x9eb3('0x16'));var db=require(_0x9eb3('0x17'))['db'];function respondWithStatusCode(_0x3fe2f1,_0x2da1ce){_0x2da1ce=_0x2da1ce||0xcc;return function(_0x3100d0){if(_0x3100d0){return _0x3fe2f1[_0x9eb3('0x18')](_0x2da1ce);}return _0x3fe2f1[_0x9eb3('0x19')](_0x2da1ce)[_0x9eb3('0x1a')]();};}function respondWithResult(_0x2cced3,_0x44623a){_0x44623a=_0x44623a||0xc8;return function(_0x19359c){if(_0x19359c){return _0x2cced3['status'](_0x44623a)[_0x9eb3('0x1b')](_0x19359c);}};}function respondWithFilteredResult(_0x55d1fe,_0x3531f1){return function(_0x2f5aad){if(_0x2f5aad){var _0x74527f=typeof _0x3531f1[_0x9eb3('0x1c')]===_0x9eb3('0x1d')&&typeof _0x3531f1[_0x9eb3('0x1e')]===_0x9eb3('0x1d');var _0x21ef5c=_0x2f5aad[_0x9eb3('0x1f')];var _0x4f0f67=_0x74527f?0x0:_0x3531f1[_0x9eb3('0x1c')];var _0x303291=_0x74527f?_0x2f5aad[_0x9eb3('0x1f')]:_0x3531f1[_0x9eb3('0x1c')]+_0x3531f1[_0x9eb3('0x1e')];var _0xa69240;if(_0x303291>=_0x21ef5c){_0x303291=_0x21ef5c;_0xa69240=0xc8;}else{_0xa69240=0xce;}_0x55d1fe[_0x9eb3('0x19')](_0xa69240);return _0x55d1fe[_0x9eb3('0x20')](_0x9eb3('0x21'),_0x4f0f67+'-'+_0x303291+'/'+_0x21ef5c)[_0x9eb3('0x1b')](_0x2f5aad);}return null;};}function patchUpdates(_0x3545af){return function(_0x4d10db){try{jsonpatch[_0x9eb3('0x22')](_0x4d10db,_0x3545af,!![]);}catch(_0x310ec2){return BPromise[_0x9eb3('0x23')](_0x310ec2);}return _0x4d10db[_0x9eb3('0x24')]();};}function saveUpdates(_0x4f6e4a,_0x11d628){return function(_0x3e1853){if(_0x3e1853){return _0x3e1853[_0x9eb3('0x25')](_0x4f6e4a)[_0x9eb3('0x26')](function(_0x1f7645){return _0x1f7645;});}return null;};}function removeEntity(_0xcfbbd4,_0x3f133a){return function(_0xf747ff){if(_0xf747ff){return _0xf747ff['destroy']()[_0x9eb3('0x26')](function(){_0xcfbbd4[_0x9eb3('0x19')](0xcc)[_0x9eb3('0x1a')]();});}};}function handleEntityNotFound(_0x1e42a,_0x10417a){return function(_0x1e4c95){if(!_0x1e4c95){_0x1e42a['sendStatus'](0x194);}return _0x1e4c95;};}function handleError(_0x431c74,_0xdfe5a2){_0xdfe5a2=_0xdfe5a2||0x1f4;return function(_0x181e93){logger[_0x9eb3('0x27')](_0x181e93[_0x9eb3('0x28')]);if(_0x181e93[_0x9eb3('0x29')]){delete _0x181e93['name'];}_0x431c74[_0x9eb3('0x19')](_0xdfe5a2)['send'](_0x181e93);};}exports['index']=function(_0x380ab5,_0x1447b7){var _0x4d654f={},_0x5dbac6={},_0x239687={'count':0x0,'rows':[]};var _0x17afa2=_[_0x9eb3('0x2a')](db[_0x9eb3('0x2b')][_0x9eb3('0x2c')],function(_0x2c3a1e){return{'name':_0x2c3a1e[_0x9eb3('0x2d')],'type':_0x2c3a1e[_0x9eb3('0x2e')][_0x9eb3('0x2f')]};});_0x5dbac6[_0x9eb3('0x30')]=_[_0x9eb3('0x2a')](_0x17afa2,'name');_0x5dbac6[_0x9eb3('0x31')]=_['keys'](_0x380ab5[_0x9eb3('0x31')]);_0x5dbac6[_0x9eb3('0x32')]=_[_0x9eb3('0x33')](_0x5dbac6[_0x9eb3('0x30')],_0x5dbac6[_0x9eb3('0x31')]);_0x4d654f[_0x9eb3('0x34')]=_[_0x9eb3('0x33')](_0x5dbac6[_0x9eb3('0x30')],qs[_0x9eb3('0x35')](_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x35')]));_0x4d654f['attributes']=_0x4d654f[_0x9eb3('0x34')][_0x9eb3('0x36')]?_0x4d654f[_0x9eb3('0x34')]:_0x5dbac6['model'];if(!_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x37')]('nolimit')){_0x4d654f[_0x9eb3('0x1e')]=qs[_0x9eb3('0x1e')](_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x1e')]);_0x4d654f[_0x9eb3('0x1c')]=qs[_0x9eb3('0x1c')](_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x1c')]);}_0x4d654f[_0x9eb3('0x38')]=qs['sort'](_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x39')]);_0x4d654f['where']=qs[_0x9eb3('0x32')](_['pick'](_0x380ab5[_0x9eb3('0x31')],_0x5dbac6[_0x9eb3('0x32')]),_0x17afa2);if(_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x3a')]){_0x4d654f['where']=_[_0x9eb3('0x3b')](_0x4d654f[_0x9eb3('0x3c')],{'$or':_[_0x9eb3('0x2a')](_0x17afa2,function(_0x2e924a){if(_0x2e924a[_0x9eb3('0x2e')]!==_0x9eb3('0x3d')){var _0xdd75cf={};_0xdd75cf[_0x2e924a['name']]={'$like':'%'+_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x3a')]+'%'};return _0xdd75cf;}})});}_0x4d654f=_[_0x9eb3('0x3b')]({},_0x4d654f,_0x380ab5[_0x9eb3('0x3e')]);var _0x34805f={'where':_0x4d654f[_0x9eb3('0x3c')]};return db[_0x9eb3('0x2b')][_0x9eb3('0x1f')](_0x34805f)[_0x9eb3('0x26')](function(_0x2e70d3){_0x239687['count']=_0x2e70d3;if(_0x380ab5[_0x9eb3('0x31')][_0x9eb3('0x3f')]){_0x4d654f['include']=[{'all':!![]}];}return db[_0x9eb3('0x2b')][_0x9eb3('0x40')](_0x4d654f);})[_0x9eb3('0x26')](function(_0xd08b09){_0x239687[_0x9eb3('0x41')]=_0xd08b09;return _0x239687;})['then'](respondWithFilteredResult(_0x1447b7,_0x4d654f))['catch'](handleError(_0x1447b7,null));};exports['show']=function(_0x1d4e3d,_0x456831){var _0x202df7={'raw':!![],'where':{'id':_0x1d4e3d[_0x9eb3('0x42')]['id']}},_0x19c16d={};_0x19c16d['model']=_[_0x9eb3('0x43')](db[_0x9eb3('0x2b')][_0x9eb3('0x2c')]);_0x19c16d[_0x9eb3('0x31')]=_[_0x9eb3('0x43')](_0x1d4e3d[_0x9eb3('0x31')]);_0x19c16d[_0x9eb3('0x32')]=_[_0x9eb3('0x33')](_0x19c16d[_0x9eb3('0x30')],_0x19c16d[_0x9eb3('0x31')]);_0x202df7[_0x9eb3('0x34')]=_['intersection'](_0x19c16d[_0x9eb3('0x30')],qs[_0x9eb3('0x35')](_0x1d4e3d['query'][_0x9eb3('0x35')]));_0x202df7[_0x9eb3('0x34')]=_0x202df7['attributes']['length']?_0x202df7['attributes']:_0x19c16d[_0x9eb3('0x30')];if(_0x1d4e3d[_0x9eb3('0x31')][_0x9eb3('0x3f')]){_0x202df7[_0x9eb3('0x44')]=[{'all':!![]}];}_0x202df7=_[_0x9eb3('0x3b')]({},_0x202df7,_0x1d4e3d['options']);return db[_0x9eb3('0x2b')][_0x9eb3('0x45')](_0x202df7)['then'](handleEntityNotFound(_0x456831,null))[_0x9eb3('0x26')](respondWithResult(_0x456831,null))[_0x9eb3('0x46')](handleError(_0x456831,null));};exports[_0x9eb3('0x47')]=function(_0x1f9101,_0x3e100c){return db[_0x9eb3('0x2b')][_0x9eb3('0x47')](_0x1f9101[_0x9eb3('0x48')],{})[_0x9eb3('0x26')](respondWithResult(_0x3e100c,0xc9))[_0x9eb3('0x46')](handleError(_0x3e100c,null));};exports[_0x9eb3('0x25')]=function(_0x3b95da,_0x90d27b){if(_0x3b95da['body']['id']){delete _0x3b95da[_0x9eb3('0x48')]['id'];}return db[_0x9eb3('0x2b')][_0x9eb3('0x45')]({'where':{'id':_0x3b95da['params']['id']}})['then'](handleEntityNotFound(_0x90d27b,null))[_0x9eb3('0x26')](saveUpdates(_0x3b95da[_0x9eb3('0x48')],null))[_0x9eb3('0x26')](respondWithResult(_0x90d27b,null))[_0x9eb3('0x46')](handleError(_0x90d27b,null));};exports[_0x9eb3('0x49')]=function(_0x5687e5,_0x550bd8){return db[_0x9eb3('0x2b')][_0x9eb3('0x45')]({'where':{'id':_0x5687e5[_0x9eb3('0x42')]['id']}})[_0x9eb3('0x26')](handleEntityNotFound(_0x550bd8,null))[_0x9eb3('0x26')](removeEntity(_0x550bd8,null))[_0x9eb3('0x46')](handleError(_0x550bd8,null));};exports[_0x9eb3('0x4a')]=function(_0x483b92,_0x3744e0){return db[_0x9eb3('0x2b')][_0x9eb3('0x4a')]()['then'](respondWithResult(_0x3744e0,null))[_0x9eb3('0x46')](handleError(_0x3744e0,null));}; \ No newline at end of file +var _0x82eb=['reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailSubstatus','include','findAll','params','includeAll','find','catch','create','body','describe','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply'];(function(_0xb7097e,_0x25d454){var _0x5494f4=function(_0x24d144){while(--_0x24d144){_0xb7097e['push'](_0xb7097e['shift']());}};_0x5494f4(++_0x25d454);}(_0x82eb,0x19d));var _0xb82e=function(_0x222b6b,_0x3dffd6){_0x222b6b=_0x222b6b-0x0;var _0x8a5e6c=_0x82eb[_0x222b6b];return _0x8a5e6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb82e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb82e('0x1'));var moment=require(_0xb82e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb82e('0x3'));var util=require(_0xb82e('0x4'));var path=require(_0xb82e('0x5'));var sox=require('sox');var csv=require(_0xb82e('0x6'));var ejs=require(_0xb82e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb82e('0x8'));var squel=require(_0xb82e('0x9'));var crypto=require(_0xb82e('0xa'));var jsforce=require(_0xb82e('0xb'));var deskjs=require(_0xb82e('0xc'));var toCsv=require(_0xb82e('0x6'));var querystring=require(_0xb82e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb82e('0xe'));var as=require(_0xb82e('0xf'));var hardwareService=require(_0xb82e('0x10'));var logger=require(_0xb82e('0x11'))(_0xb82e('0x12'));var utils=require(_0xb82e('0x13'));var config=require(_0xb82e('0x14'));var licenseUtil=require(_0xb82e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41d32a,_0x330936){_0x330936=_0x330936||0xcc;return function(_0x4be938){if(_0x4be938){return _0x41d32a[_0xb82e('0x16')](_0x330936);}return _0x41d32a[_0xb82e('0x17')](_0x330936)['end']();};}function respondWithResult(_0x2c9c18,_0x12ba7a){_0x12ba7a=_0x12ba7a||0xc8;return function(_0x26e131){if(_0x26e131){return _0x2c9c18['status'](_0x12ba7a)['json'](_0x26e131);}};}function respondWithFilteredResult(_0x3e0b43,_0x421e54){return function(_0x31b323){if(_0x31b323){var _0x37d368=typeof _0x421e54[_0xb82e('0x18')]===_0xb82e('0x19')&&typeof _0x421e54['limit']===_0xb82e('0x19');var _0x555e8e=_0x31b323[_0xb82e('0x1a')];var _0xbdce2=_0x37d368?0x0:_0x421e54['offset'];var _0x36b0a3=_0x37d368?_0x31b323['count']:_0x421e54[_0xb82e('0x18')]+_0x421e54['limit'];var _0x2cf03d;if(_0x36b0a3>=_0x555e8e){_0x36b0a3=_0x555e8e;_0x2cf03d=0xc8;}else{_0x2cf03d=0xce;}_0x3e0b43[_0xb82e('0x17')](_0x2cf03d);return _0x3e0b43[_0xb82e('0x1b')](_0xb82e('0x1c'),_0xbdce2+'-'+_0x36b0a3+'/'+_0x555e8e)[_0xb82e('0x1d')](_0x31b323);}return null;};}function patchUpdates(_0xb92a79){return function(_0x4cffd8){try{jsonpatch[_0xb82e('0x1e')](_0x4cffd8,_0xb92a79,!![]);}catch(_0x81f30b){return BPromise[_0xb82e('0x1f')](_0x81f30b);}return _0x4cffd8[_0xb82e('0x20')]();};}function saveUpdates(_0x118c23,_0x63cab5){return function(_0x1fa9e4){if(_0x1fa9e4){return _0x1fa9e4[_0xb82e('0x21')](_0x118c23)[_0xb82e('0x22')](function(_0x3a29f8){return _0x3a29f8;});}return null;};}function removeEntity(_0x151ab3,_0x56adf4){return function(_0x4fc471){if(_0x4fc471){return _0x4fc471[_0xb82e('0x23')]()['then'](function(){_0x151ab3[_0xb82e('0x17')](0xcc)[_0xb82e('0x24')]();});}};}function handleEntityNotFound(_0x442de8,_0x2f8aae){return function(_0x52f6aa){if(!_0x52f6aa){_0x442de8['sendStatus'](0x194);}return _0x52f6aa;};}function handleError(_0x3ef33c,_0x3b81c2){_0x3b81c2=_0x3b81c2||0x1f4;return function(_0x5efd8b){logger[_0xb82e('0x25')](_0x5efd8b['stack']);if(_0x5efd8b[_0xb82e('0x26')]){delete _0x5efd8b[_0xb82e('0x26')];}_0x3ef33c[_0xb82e('0x17')](_0x3b81c2)[_0xb82e('0x27')](_0x5efd8b);};}exports[_0xb82e('0x28')]=function(_0x15b0ec,_0x72d1e5){var _0x2f5a03={},_0x1e03f4={},_0x2a305d={'count':0x0,'rows':[]};var _0x89eead=_[_0xb82e('0x29')](db['MailSubstatus'][_0xb82e('0x2a')],function(_0xa57ca7){return{'name':_0xa57ca7['fieldName'],'type':_0xa57ca7[_0xb82e('0x2b')][_0xb82e('0x2c')]};});_0x1e03f4['model']=_[_0xb82e('0x29')](_0x89eead,_0xb82e('0x26'));_0x1e03f4[_0xb82e('0x2d')]=_[_0xb82e('0x2e')](_0x15b0ec[_0xb82e('0x2d')]);_0x1e03f4[_0xb82e('0x2f')]=_['intersection'](_0x1e03f4['model'],_0x1e03f4[_0xb82e('0x2d')]);_0x2f5a03[_0xb82e('0x30')]=_[_0xb82e('0x31')](_0x1e03f4[_0xb82e('0x32')],qs[_0xb82e('0x33')](_0x15b0ec[_0xb82e('0x2d')]['fields']));_0x2f5a03[_0xb82e('0x30')]=_0x2f5a03[_0xb82e('0x30')][_0xb82e('0x34')]?_0x2f5a03[_0xb82e('0x30')]:_0x1e03f4[_0xb82e('0x32')];if(!_0x15b0ec['query'][_0xb82e('0x35')](_0xb82e('0x36'))){_0x2f5a03[_0xb82e('0x37')]=qs[_0xb82e('0x37')](_0x15b0ec[_0xb82e('0x2d')]['limit']);_0x2f5a03['offset']=qs['offset'](_0x15b0ec[_0xb82e('0x2d')][_0xb82e('0x18')]);}_0x2f5a03[_0xb82e('0x38')]=qs['sort'](_0x15b0ec['query'][_0xb82e('0x39')]);_0x2f5a03['where']=qs[_0xb82e('0x2f')](_[_0xb82e('0x3a')](_0x15b0ec[_0xb82e('0x2d')],_0x1e03f4['filters']),_0x89eead);if(_0x15b0ec[_0xb82e('0x2d')][_0xb82e('0x3b')]){_0x2f5a03[_0xb82e('0x3c')]=_[_0xb82e('0x3d')](_0x2f5a03[_0xb82e('0x3c')],{'$or':_['map'](_0x89eead,function(_0x158807){if(_0x158807[_0xb82e('0x2b')]!==_0xb82e('0x3e')){var _0x2b11a2={};_0x2b11a2[_0x158807[_0xb82e('0x26')]]={'$like':'%'+_0x15b0ec[_0xb82e('0x2d')][_0xb82e('0x3b')]+'%'};return _0x2b11a2;}})});}_0x2f5a03=_[_0xb82e('0x3d')]({},_0x2f5a03,_0x15b0ec[_0xb82e('0x3f')]);var _0x1476df={'where':_0x2f5a03[_0xb82e('0x3c')]};return db[_0xb82e('0x40')][_0xb82e('0x1a')](_0x1476df)[_0xb82e('0x22')](function(_0x25fab7){_0x2a305d[_0xb82e('0x1a')]=_0x25fab7;if(_0x15b0ec[_0xb82e('0x2d')]['includeAll']){_0x2f5a03[_0xb82e('0x41')]=[{'all':!![]}];}return db[_0xb82e('0x40')][_0xb82e('0x42')](_0x2f5a03);})[_0xb82e('0x22')](function(_0x25901d){_0x2a305d['rows']=_0x25901d;return _0x2a305d;})[_0xb82e('0x22')](respondWithFilteredResult(_0x72d1e5,_0x2f5a03))['catch'](handleError(_0x72d1e5,null));};exports['show']=function(_0x433524,_0x95b771){var _0x2940c6={'raw':!![],'where':{'id':_0x433524[_0xb82e('0x43')]['id']}},_0x5964c8={};_0x5964c8[_0xb82e('0x32')]=_[_0xb82e('0x2e')](db['MailSubstatus'][_0xb82e('0x2a')]);_0x5964c8[_0xb82e('0x2d')]=_[_0xb82e('0x2e')](_0x433524[_0xb82e('0x2d')]);_0x5964c8[_0xb82e('0x2f')]=_[_0xb82e('0x31')](_0x5964c8[_0xb82e('0x32')],_0x5964c8['query']);_0x2940c6[_0xb82e('0x30')]=_[_0xb82e('0x31')](_0x5964c8[_0xb82e('0x32')],qs[_0xb82e('0x33')](_0x433524[_0xb82e('0x2d')]['fields']));_0x2940c6[_0xb82e('0x30')]=_0x2940c6[_0xb82e('0x30')][_0xb82e('0x34')]?_0x2940c6[_0xb82e('0x30')]:_0x5964c8['model'];if(_0x433524[_0xb82e('0x2d')][_0xb82e('0x44')]){_0x2940c6['include']=[{'all':!![]}];}_0x2940c6=_[_0xb82e('0x3d')]({},_0x2940c6,_0x433524['options']);return db[_0xb82e('0x40')][_0xb82e('0x45')](_0x2940c6)['then'](handleEntityNotFound(_0x95b771,null))[_0xb82e('0x22')](respondWithResult(_0x95b771,null))[_0xb82e('0x46')](handleError(_0x95b771,null));};exports[_0xb82e('0x47')]=function(_0x1d6f7d,_0x4f0cac){return db[_0xb82e('0x40')][_0xb82e('0x47')](_0x1d6f7d['body'],{})[_0xb82e('0x22')](respondWithResult(_0x4f0cac,0xc9))[_0xb82e('0x46')](handleError(_0x4f0cac,null));};exports[_0xb82e('0x21')]=function(_0x5d0b82,_0x116cf4){if(_0x5d0b82[_0xb82e('0x48')]['id']){delete _0x5d0b82[_0xb82e('0x48')]['id'];}return db[_0xb82e('0x40')]['find']({'where':{'id':_0x5d0b82[_0xb82e('0x43')]['id']}})['then'](handleEntityNotFound(_0x116cf4,null))['then'](saveUpdates(_0x5d0b82[_0xb82e('0x48')],null))[_0xb82e('0x22')](respondWithResult(_0x116cf4,null))['catch'](handleError(_0x116cf4,null));};exports[_0xb82e('0x23')]=function(_0x8a78ca,_0x2ebd39){return db[_0xb82e('0x40')]['find']({'where':{'id':_0x8a78ca[_0xb82e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ebd39,null))[_0xb82e('0x22')](removeEntity(_0x2ebd39,null))[_0xb82e('0x46')](handleError(_0x2ebd39,null));};exports['describe']=function(_0x43e78d,_0xeb357b){return db[_0xb82e('0x40')][_0xb82e('0x49')]()[_0xb82e('0x22')](respondWithResult(_0xeb357b,null))[_0xb82e('0x46')](handleError(_0xeb357b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 9525a6b..821e0f6 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 _0xac85=['hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3d3fe5,_0x2fcf2b){var _0xb4ce88=function(_0x2fdb90){while(--_0x2fdb90){_0x3d3fe5['push'](_0x3d3fe5['shift']());}};_0xb4ce88(++_0x2fcf2b);}(_0xac85,0x79));var _0x5ac8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xac85[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x5ac8('0x0'));var MailSubstatus=require(_0x5ac8('0x1'))['db'][_0x5ac8('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5ac8('0x3')](0x0);var events={'afterUpdate':_0x5ac8('0x4')};function emitEvent(_0x4a2b6c){return function(_0x59c0c5,_0x35055f,_0x3f28ad){MailSubstatusEvents[_0x5ac8('0x5')](_0x4a2b6c+':'+_0x59c0c5['id'],_0x59c0c5);MailSubstatusEvents[_0x5ac8('0x5')](_0x4a2b6c,_0x59c0c5);_0x3f28ad(null);};}for(var e in events){if(events[_0x5ac8('0x6')](e)){var event=events[e];MailSubstatus[_0x5ac8('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x366b=['hook','exports','../../mysqldb','MailSubstatus','update','emit','hasOwnProperty'];(function(_0x18ceea,_0x53fc79){var _0x3b36e8=function(_0x5220d6){while(--_0x5220d6){_0x18ceea['push'](_0x18ceea['shift']());}};_0x3b36e8(++_0x53fc79);}(_0x366b,0x144));var _0xb366=function(_0x2f8fd5,_0x3237d0){_0x2f8fd5=_0x2f8fd5-0x0;var _0x402861=_0x366b[_0x2f8fd5];return _0x402861;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xb366('0x0'))['db'][_0xb366('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb366('0x2')};function emitEvent(_0x34cd48){return function(_0xba7838,_0x1a38bb,_0x509834){MailSubstatusEvents[_0xb366('0x3')](_0x34cd48+':'+_0xba7838['id'],_0xba7838);MailSubstatusEvents[_0xb366('0x3')](_0x34cd48,_0xba7838);_0x509834(null);};}for(var e in events){if(events[_0xb366('0x4')](e)){var event=events[e];MailSubstatus[_0xb366('0x5')](e,emitEvent(event));}}module[_0xb366('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7ac31f3..0e4ff38 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 _0x24aa=['define','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','exports','models'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x24aa,0x1d7));var _0xa24a=function(_0x195bf4,_0x4fbfd2){_0x195bf4=_0x195bf4-0x0;var _0x21b129=_0x24aa[_0x195bf4];return _0x21b129;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xa24a('0x0')]=function(_0x207a9d){var _0x336d98=_0x207a9d[_0xa24a('0x1')];return _0x207a9d[_0xa24a('0x2')]('MailSubstatus',attributes,{'tableName':_0xa24a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x43153c,_0x12fd71,_0x65cb6e){return _0x336d98[_0xa24a('0x4')][_0xa24a('0x5')]({'value':_0x43153c['name']},{'where':{'field':_0xa24a('0x6'),'value':_0x43153c[_0xa24a('0x7')][_0xa24a('0x8')]}})[_0xa24a('0x9')](function(){_0x65cb6e();})[_0xa24a('0xa')](function(_0xc11108){_0x65cb6e(_0xc11108);});}}});}; \ No newline at end of file +var _0xe855=['_previousDataValues','then','catch','models','Condition','update','name','mailSubstatus'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe855,0x1a3));var _0x5e85=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0xe855[_0xe1063b];return _0x3f79b1;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x2486d3){var _0x4885aa=_0x2486d3[_0x5e85('0x0')];return _0x2486d3['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xe0ed1,_0x59bd28,_0x8e9421){return _0x4885aa[_0x5e85('0x1')][_0x5e85('0x2')]({'value':_0xe0ed1[_0x5e85('0x3')]},{'where':{'field':_0x5e85('0x4'),'value':_0xe0ed1[_0x5e85('0x5')][_0x5e85('0x3')]}})[_0x5e85('0x6')](function(){_0x8e9421();})[_0x5e85('0x7')](function(_0x8faa66){_0x8e9421(_0x8faa66);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 208559b..cef553a 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 _0xddce=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x1d1af1,_0x4a8829){var _0x11e46e=function(_0x3e2b3){while(--_0x3e2b3){_0x1d1af1['push'](_0x1d1af1['shift']());}};_0x11e46e(++_0x4a8829);}(_0xddce,0x1ed));var _0xeddc=function(_0x1d2a3b,_0x279544){_0x1d2a3b=_0x1d2a3b-0x0;var _0x186695=_0xddce[_0x1d2a3b];return _0x186695;};'use strict';var _=require(_0xeddc('0x0'));var util=require('util');var moment=require(_0xeddc('0x1'));var BPromise=require(_0xeddc('0x2'));var rs=require(_0xeddc('0x3'));var fs=require('fs');var Redis=require(_0xeddc('0x4'));var db=require(_0xeddc('0x5'))['db'];var utils=require(_0xeddc('0x6'));var logger=require(_0xeddc('0x7'))(_0xeddc('0x8'));var config=require(_0xeddc('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xca5736,_0x383041,_0x4693b0){return new BPromise(function(_0x5a053d,_0x22874a){return client[_0xeddc('0xa')](_0xca5736,_0x4693b0)['then'](function(_0x12a991){logger[_0xeddc('0xb')](_0xeddc('0xc'),_0x383041,_0xeddc('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x383041,_0xeddc('0xd'),JSON['stringify'](_0x12a991));if(_0x12a991[_0xeddc('0xe')]){if(_0x12a991[_0xeddc('0xe')][_0xeddc('0xf')]===0x1f4){logger[_0xeddc('0xe')](_0xeddc('0xc'),_0x383041,_0x12a991['error'][_0xeddc('0x10')]);return _0x22874a(_0x12a991[_0xeddc('0xe')][_0xeddc('0x10')]);}logger[_0xeddc('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x383041,_0x12a991[_0xeddc('0xe')][_0xeddc('0x10')]);return _0x5a053d(_0x12a991[_0xeddc('0xe')]['message']);}else{logger['info'](_0xeddc('0xc'),_0x383041,_0xeddc('0xd'));_0x5a053d(_0x12a991['result'][_0xeddc('0x10')]);}})[_0xeddc('0x11')](function(_0x4f3fb3){logger['error'](_0xeddc('0xc'),_0x383041,_0x4f3fb3);_0x22874a(_0x4f3fb3);});});} \ No newline at end of file +var _0xec8b=['MailSubstatus,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','code'];(function(_0x482e0a,_0x59e082){var _0x4a988f=function(_0x5812c7){while(--_0x5812c7){_0x482e0a['push'](_0x482e0a['shift']());}};_0x4a988f(++_0x59e082);}(_0xec8b,0x15b));var _0xbec8=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xec8b[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xbec8('0x0'));var util=require(_0xbec8('0x1'));var moment=require('moment');var BPromise=require(_0xbec8('0x2'));var rs=require(_0xbec8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbec8('0x4'))['db'];var utils=require(_0xbec8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbec8('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3211f4,_0x5f5236,_0x4ffb0f){return new BPromise(function(_0x23ad21,_0x53801d){return client[_0xbec8('0x7')](_0x3211f4,_0x4ffb0f)[_0xbec8('0x8')](function(_0x17a3ae){logger[_0xbec8('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x5f5236,_0xbec8('0xa'));logger[_0xbec8('0xb')](_0xbec8('0xc'),_0x5f5236,_0xbec8('0xa'),JSON['stringify'](_0x17a3ae));if(_0x17a3ae['error']){if(_0x17a3ae['error'][_0xbec8('0xd')]===0x1f4){logger['error'](_0xbec8('0xe'),_0x5f5236,_0x17a3ae[_0xbec8('0xf')][_0xbec8('0x10')]);return _0x53801d(_0x17a3ae[_0xbec8('0xf')][_0xbec8('0x10')]);}logger['error'](_0xbec8('0xe'),_0x5f5236,_0x17a3ae[_0xbec8('0xf')][_0xbec8('0x10')]);return _0x23ad21(_0x17a3ae[_0xbec8('0xf')][_0xbec8('0x10')]);}else{logger[_0xbec8('0x9')](_0xbec8('0xe'),_0x5f5236,_0xbec8('0xa'));_0x23ad21(_0x17a3ae[_0xbec8('0x11')][_0xbec8('0x10')]);}})[_0xbec8('0x12')](function(_0x151458){logger[_0xbec8('0xf')](_0xbec8('0xe'),_0x5f5236,_0x151458);_0x53801d(_0x151458);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index da1fde4..7787c04 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 _0x6ac4=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ac4,0xe1));var _0x46ac=function(_0x3f831c,_0x5dc48c){_0x3f831c=_0x3f831c-0x0;var _0x408a85=_0x6ac4[_0x3f831c];return _0x408a85;};'use strict';var multer=require('multer');var util=require(_0x46ac('0x0'));var path=require(_0x46ac('0x1'));var timeout=require(_0x46ac('0x2'));var express=require(_0x46ac('0x3'));var router=express[_0x46ac('0x4')]();var fs_extra=require(_0x46ac('0x5'));var auth=require(_0x46ac('0x6'));var interaction=require(_0x46ac('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x46ac('0x8')](),controller[_0x46ac('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x46ac('0xa')]);router['get'](_0x46ac('0xb'),auth[_0x46ac('0x8')](),controller[_0x46ac('0xc')]);router[_0x46ac('0xd')]('/',auth[_0x46ac('0x8')](),controller[_0x46ac('0xe')]);router[_0x46ac('0xf')]('/:id',auth[_0x46ac('0x8')](),controller[_0x46ac('0x10')]);router[_0x46ac('0x11')](_0x46ac('0xb'),auth[_0x46ac('0x8')](),controller[_0x46ac('0x12')]);module[_0x46ac('0x13')]=router; \ No newline at end of file +var _0x008e=['create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x3a5eec,_0x3abbcf){var _0x234d14=function(_0x5d9198){while(--_0x5d9198){_0x3a5eec['push'](_0x3a5eec['shift']());}};_0x234d14(++_0x3abbcf);}(_0x008e,0xf4));var _0xe008=function(_0x2dd188,_0x47b65d){_0x2dd188=_0x2dd188-0x0;var _0x4d36b8=_0x008e[_0x2dd188];return _0x4d36b8;};'use strict';var multer=require(_0xe008('0x0'));var util=require(_0xe008('0x1'));var path=require(_0xe008('0x2'));var timeout=require(_0xe008('0x3'));var express=require(_0xe008('0x4'));var router=express['Router']();var fs_extra=require(_0xe008('0x5'));var auth=require(_0xe008('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe008('0x7'));var controller=require(_0xe008('0x8'));router['get']('/',auth[_0xe008('0x9')](),controller[_0xe008('0xa')]);router[_0xe008('0xb')](_0xe008('0xc'),auth[_0xe008('0x9')](),controller[_0xe008('0xd')]);router[_0xe008('0xb')](_0xe008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xe008('0xf')]('/',auth[_0xe008('0x9')](),controller[_0xe008('0x10')]);router[_0xe008('0x11')](_0xe008('0xe'),auth[_0xe008('0x9')](),controller[_0xe008('0x12')]);router[_0xe008('0x13')](_0xe008('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 31e13e4..f500a9d 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x54ef,0x112));var _0xf54e=function(_0x5c2e2d,_0x3b34c9){_0x5c2e2d=_0x5c2e2d-0x0;var _0x427ad0=_0x54ef[_0x5c2e2d];return _0x427ad0;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4eee57,_0x1ba72d){var _0x5ab281=function(_0x4c18e0){while(--_0x4c18e0){_0x4eee57['push'](_0x4eee57['shift']());}};_0x5ab281(++_0x1ba72d);}(_0xe706,0xa3));var _0x6e70=function(_0x43e19a,_0x3127f2){_0x43e19a=_0x43e19a-0x0;var _0x35099e=_0xe706[_0x43e19a];return _0x35099e;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index edf80d5..9876b39 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 _0xcc46=['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/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','MailTransferReport','fieldName','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x26db8f,_0x33d0bb){var _0x137b56=function(_0x16e3e1){while(--_0x16e3e1){_0x26db8f['push'](_0x26db8f['shift']());}};_0x137b56(++_0x33d0bb);}(_0xcc46,0x18e));var _0x6cc4=function(_0x66015b,_0x5dfe3){_0x66015b=_0x66015b-0x0;var _0x49ac7c=_0xcc46[_0x66015b];return _0x49ac7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cc4('0x0'));var zipdir=require(_0x6cc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cc4('0x2'));var moment=require('moment');var BPromise=require(_0x6cc4('0x3'));var Mustache=require(_0x6cc4('0x4'));var util=require(_0x6cc4('0x5'));var path=require(_0x6cc4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cc4('0x7'));var fs=require('fs');var fs_extra=require(_0x6cc4('0x8'));var _=require(_0x6cc4('0x9'));var squel=require(_0x6cc4('0xa'));var crypto=require(_0x6cc4('0xb'));var jsforce=require(_0x6cc4('0xc'));var deskjs=require(_0x6cc4('0xd'));var toCsv=require(_0x6cc4('0xe'));var querystring=require(_0x6cc4('0xf'));var Papa=require(_0x6cc4('0x10'));var Redis=require(_0x6cc4('0x11'));var authService=require(_0x6cc4('0x12'));var qs=require(_0x6cc4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cc4('0x14'));var logger=require(_0x6cc4('0x15'))(_0x6cc4('0x16'));var utils=require(_0x6cc4('0x17'));var config=require(_0x6cc4('0x18'));var licenseUtil=require(_0x6cc4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8ae0,_0x444e48){_0x444e48=_0x444e48||0xcc;return function(_0xfa7428){if(_0xfa7428){return _0x5a8ae0[_0x6cc4('0x1a')](_0x444e48);}return _0x5a8ae0[_0x6cc4('0x1b')](_0x444e48)['end']();};}function respondWithResult(_0xa70990,_0x43a44a){_0x43a44a=_0x43a44a||0xc8;return function(_0x43d130){if(_0x43d130){return _0xa70990[_0x6cc4('0x1b')](_0x43a44a)['json'](_0x43d130);}};}function respondWithFilteredResult(_0x384f71,_0x4c727d){return function(_0x28350f){if(_0x28350f){var _0x412c67=typeof _0x4c727d[_0x6cc4('0x1c')]===_0x6cc4('0x1d')&&typeof _0x4c727d[_0x6cc4('0x1e')]===_0x6cc4('0x1d');var _0x31aad0=_0x28350f['count'];var _0x3d1160=_0x412c67?0x0:_0x4c727d[_0x6cc4('0x1c')];var _0x26615d=_0x412c67?_0x28350f[_0x6cc4('0x1f')]:_0x4c727d[_0x6cc4('0x1c')]+_0x4c727d['limit'];var _0x53c2ca;if(_0x26615d>=_0x31aad0){_0x26615d=_0x31aad0;_0x53c2ca=0xc8;}else{_0x53c2ca=0xce;}_0x384f71['status'](_0x53c2ca);return _0x384f71[_0x6cc4('0x20')](_0x6cc4('0x21'),_0x3d1160+'-'+_0x26615d+'/'+_0x31aad0)['json'](_0x28350f);}return null;};}function patchUpdates(_0x339a6c){return function(_0xd45ad9){try{jsonpatch[_0x6cc4('0x22')](_0xd45ad9,_0x339a6c,!![]);}catch(_0x49e061){return BPromise[_0x6cc4('0x23')](_0x49e061);}return _0xd45ad9[_0x6cc4('0x24')]();};}function saveUpdates(_0x52ed5e,_0x1b4f62){return function(_0x19f1d6){if(_0x19f1d6){return _0x19f1d6['update'](_0x52ed5e)[_0x6cc4('0x25')](function(_0x52e421){return _0x52e421;});}return null;};}function removeEntity(_0x1f1346,_0x202023){return function(_0x4ed0a4){if(_0x4ed0a4){return _0x4ed0a4[_0x6cc4('0x26')]()['then'](function(){_0x1f1346['status'](0xcc)[_0x6cc4('0x27')]();});}};}function handleEntityNotFound(_0xeb6a9e,_0x10baae){return function(_0x257f56){if(!_0x257f56){_0xeb6a9e[_0x6cc4('0x1a')](0x194);}return _0x257f56;};}function handleError(_0x2e4ef6,_0x2c40c8){_0x2c40c8=_0x2c40c8||0x1f4;return function(_0x40c3ae){logger[_0x6cc4('0x28')](_0x40c3ae[_0x6cc4('0x29')]);if(_0x40c3ae[_0x6cc4('0x2a')]){delete _0x40c3ae[_0x6cc4('0x2a')];}_0x2e4ef6[_0x6cc4('0x1b')](_0x2c40c8)[_0x6cc4('0x2b')](_0x40c3ae);};}exports[_0x6cc4('0x2c')]=function(_0x4f613e,_0x314e32){var _0x1be84d={},_0x30710e={},_0x234d48={'count':0x0,'rows':[]};var _0x3d9fc3=_['map'](db[_0x6cc4('0x2d')]['rawAttributes'],function(_0xad75dc){return{'name':_0xad75dc[_0x6cc4('0x2e')],'type':_0xad75dc['type'][_0x6cc4('0x2f')]};});_0x30710e[_0x6cc4('0x30')]=_[_0x6cc4('0x31')](_0x3d9fc3,_0x6cc4('0x2a'));_0x30710e['query']=_[_0x6cc4('0x32')](_0x4f613e['query']);_0x30710e['filters']=_[_0x6cc4('0x33')](_0x30710e[_0x6cc4('0x30')],_0x30710e[_0x6cc4('0x34')]);_0x1be84d[_0x6cc4('0x35')]=_[_0x6cc4('0x33')](_0x30710e[_0x6cc4('0x30')],qs[_0x6cc4('0x36')](_0x4f613e['query'][_0x6cc4('0x36')]));_0x1be84d['attributes']=_0x1be84d[_0x6cc4('0x35')][_0x6cc4('0x37')]?_0x1be84d[_0x6cc4('0x35')]:_0x30710e[_0x6cc4('0x30')];if(!_0x4f613e['query'][_0x6cc4('0x38')](_0x6cc4('0x39'))){_0x1be84d[_0x6cc4('0x1e')]=qs[_0x6cc4('0x1e')](_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x1e')]);_0x1be84d['offset']=qs[_0x6cc4('0x1c')](_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x1c')]);}_0x1be84d[_0x6cc4('0x3a')]=qs[_0x6cc4('0x3b')](_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x3b')]);_0x1be84d[_0x6cc4('0x3c')]=qs['filters'](_[_0x6cc4('0x3d')](_0x4f613e[_0x6cc4('0x34')],_0x30710e[_0x6cc4('0x3e')]),_0x3d9fc3);if(_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x3f')]){_0x1be84d['where']=_[_0x6cc4('0x40')](_0x1be84d[_0x6cc4('0x3c')],{'$or':_[_0x6cc4('0x31')](_0x3d9fc3,function(_0x1c2dc9){if(_0x1c2dc9[_0x6cc4('0x41')]!==_0x6cc4('0x42')){var _0x5e7c57={};_0x5e7c57[_0x1c2dc9['name']]={'$like':'%'+_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x3f')]+'%'};return _0x5e7c57;}})});}_0x1be84d=_[_0x6cc4('0x40')]({},_0x1be84d,_0x4f613e[_0x6cc4('0x43')]);var _0x37333c={'where':_0x1be84d[_0x6cc4('0x3c')]};return db[_0x6cc4('0x2d')]['count'](_0x37333c)['then'](function(_0x2abfcc){_0x234d48[_0x6cc4('0x1f')]=_0x2abfcc;if(_0x4f613e[_0x6cc4('0x34')][_0x6cc4('0x44')]){_0x1be84d[_0x6cc4('0x45')]=[{'all':!![]}];}return db[_0x6cc4('0x2d')][_0x6cc4('0x46')](_0x1be84d);})['then'](function(_0x2ae6d6){_0x234d48[_0x6cc4('0x47')]=_0x2ae6d6;return _0x234d48;})[_0x6cc4('0x25')](respondWithFilteredResult(_0x314e32,_0x1be84d))[_0x6cc4('0x48')](handleError(_0x314e32,null));};exports[_0x6cc4('0x49')]=function(_0x538ba2,_0x2613a0){var _0xab3b7b={'raw':!![],'where':{'id':_0x538ba2[_0x6cc4('0x4a')]['id']}},_0x562717={};_0x562717['model']=_['keys'](db[_0x6cc4('0x2d')][_0x6cc4('0x4b')]);_0x562717[_0x6cc4('0x34')]=_[_0x6cc4('0x32')](_0x538ba2['query']);_0x562717['filters']=_[_0x6cc4('0x33')](_0x562717['model'],_0x562717[_0x6cc4('0x34')]);_0xab3b7b[_0x6cc4('0x35')]=_[_0x6cc4('0x33')](_0x562717[_0x6cc4('0x30')],qs[_0x6cc4('0x36')](_0x538ba2[_0x6cc4('0x34')][_0x6cc4('0x36')]));_0xab3b7b[_0x6cc4('0x35')]=_0xab3b7b[_0x6cc4('0x35')][_0x6cc4('0x37')]?_0xab3b7b[_0x6cc4('0x35')]:_0x562717[_0x6cc4('0x30')];if(_0x538ba2[_0x6cc4('0x34')][_0x6cc4('0x44')]){_0xab3b7b['include']=[{'all':!![]}];}_0xab3b7b=_[_0x6cc4('0x40')]({},_0xab3b7b,_0x538ba2[_0x6cc4('0x43')]);return db[_0x6cc4('0x2d')][_0x6cc4('0x4c')](_0xab3b7b)[_0x6cc4('0x25')](handleEntityNotFound(_0x2613a0,null))[_0x6cc4('0x25')](respondWithResult(_0x2613a0,null))[_0x6cc4('0x48')](handleError(_0x2613a0,null));};exports[_0x6cc4('0x4d')]=function(_0x390fd6,_0x4f8b54){return db[_0x6cc4('0x2d')][_0x6cc4('0x4d')](_0x390fd6[_0x6cc4('0x4e')],{})['then'](respondWithResult(_0x4f8b54,0xc9))[_0x6cc4('0x48')](handleError(_0x4f8b54,null));};exports[_0x6cc4('0x4f')]=function(_0x3cdefd,_0x48e102){if(_0x3cdefd[_0x6cc4('0x4e')]['id']){delete _0x3cdefd[_0x6cc4('0x4e')]['id'];}return db[_0x6cc4('0x2d')][_0x6cc4('0x4c')]({'where':{'id':_0x3cdefd[_0x6cc4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48e102,null))[_0x6cc4('0x25')](saveUpdates(_0x3cdefd[_0x6cc4('0x4e')],null))[_0x6cc4('0x25')](respondWithResult(_0x48e102,null))['catch'](handleError(_0x48e102,null));};exports[_0x6cc4('0x26')]=function(_0xcc8230,_0x593414){return db[_0x6cc4('0x2d')][_0x6cc4('0x4c')]({'where':{'id':_0xcc8230[_0x6cc4('0x4a')]['id']}})[_0x6cc4('0x25')](handleEntityNotFound(_0x593414,null))[_0x6cc4('0x25')](removeEntity(_0x593414,null))['catch'](handleError(_0x593414,null));};exports[_0x6cc4('0x50')]=function(_0x1e3e73,_0x1b7b8a){return db[_0x6cc4('0x2d')]['describe']()[_0x6cc4('0x25')](respondWithResult(_0x1b7b8a,null))['catch'](handleError(_0x1b7b8a,null));}; \ No newline at end of file +var _0x03c1=['MailTransferReport','length','create','body','update','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x23ab42,_0x509930){var _0x31c1eb=function(_0x4cb83d){while(--_0x4cb83d){_0x23ab42['push'](_0x23ab42['shift']());}};_0x31c1eb(++_0x509930);}(_0x03c1,0x160));var _0x103c=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x03c1[_0x2ab3d9];return _0x210a54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x103c('0x0'));var jsonpatch=require(_0x103c('0x1'));var rp=require(_0x103c('0x2'));var moment=require(_0x103c('0x3'));var BPromise=require(_0x103c('0x4'));var Mustache=require(_0x103c('0x5'));var util=require(_0x103c('0x6'));var path=require(_0x103c('0x7'));var sox=require(_0x103c('0x8'));var csv=require('to-csv');var ejs=require(_0x103c('0x9'));var fs=require('fs');var fs_extra=require(_0x103c('0xa'));var _=require('lodash');var squel=require(_0x103c('0xb'));var crypto=require(_0x103c('0xc'));var jsforce=require(_0x103c('0xd'));var deskjs=require(_0x103c('0xe'));var toCsv=require(_0x103c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x103c('0x10'));var authService=require(_0x103c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x103c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x103c('0x13'));var utils=require(_0x103c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x103c('0x15'))['db'];function respondWithStatusCode(_0x62e38e,_0x443720){_0x443720=_0x443720||0xcc;return function(_0x58f399){if(_0x58f399){return _0x62e38e[_0x103c('0x16')](_0x443720);}return _0x62e38e[_0x103c('0x17')](_0x443720)[_0x103c('0x18')]();};}function respondWithResult(_0x55bd03,_0x3c169a){_0x3c169a=_0x3c169a||0xc8;return function(_0x5be202){if(_0x5be202){return _0x55bd03[_0x103c('0x17')](_0x3c169a)[_0x103c('0x19')](_0x5be202);}};}function respondWithFilteredResult(_0x3527fc,_0x5106b2){return function(_0x4cbd8c){if(_0x4cbd8c){var _0x433f77=typeof _0x5106b2[_0x103c('0x1a')]===_0x103c('0x1b')&&typeof _0x5106b2[_0x103c('0x1c')]===_0x103c('0x1b');var _0x219084=_0x4cbd8c[_0x103c('0x1d')];var _0x342bff=_0x433f77?0x0:_0x5106b2[_0x103c('0x1a')];var _0x701700=_0x433f77?_0x4cbd8c[_0x103c('0x1d')]:_0x5106b2['offset']+_0x5106b2[_0x103c('0x1c')];var _0x47d2fd;if(_0x701700>=_0x219084){_0x701700=_0x219084;_0x47d2fd=0xc8;}else{_0x47d2fd=0xce;}_0x3527fc[_0x103c('0x17')](_0x47d2fd);return _0x3527fc['set']('Content-Range',_0x342bff+'-'+_0x701700+'/'+_0x219084)[_0x103c('0x19')](_0x4cbd8c);}return null;};}function patchUpdates(_0x393105){return function(_0x127222){try{jsonpatch['apply'](_0x127222,_0x393105,!![]);}catch(_0x4c291d){return BPromise['reject'](_0x4c291d);}return _0x127222[_0x103c('0x1e')]();};}function saveUpdates(_0x27a35a,_0x13d9f2){return function(_0x56e1f2){if(_0x56e1f2){return _0x56e1f2['update'](_0x27a35a)[_0x103c('0x1f')](function(_0x2eb5a0){return _0x2eb5a0;});}return null;};}function removeEntity(_0x32e43b,_0x191710){return function(_0x207cb7){if(_0x207cb7){return _0x207cb7[_0x103c('0x20')]()[_0x103c('0x1f')](function(){_0x32e43b[_0x103c('0x17')](0xcc)[_0x103c('0x18')]();});}};}function handleEntityNotFound(_0x1af2e4,_0x3240be){return function(_0x22d6c7){if(!_0x22d6c7){_0x1af2e4['sendStatus'](0x194);}return _0x22d6c7;};}function handleError(_0x568e91,_0x7e721c){_0x7e721c=_0x7e721c||0x1f4;return function(_0x20a8ea){logger['error'](_0x20a8ea['stack']);if(_0x20a8ea[_0x103c('0x21')]){delete _0x20a8ea[_0x103c('0x21')];}_0x568e91[_0x103c('0x17')](_0x7e721c)[_0x103c('0x22')](_0x20a8ea);};}exports['index']=function(_0x1568c8,_0x524701){var _0x42956f={},_0x24b3db={},_0x5d256d={'count':0x0,'rows':[]};var _0x5c1700=_[_0x103c('0x23')](db['MailTransferReport'][_0x103c('0x24')],function(_0x5ac72e){return{'name':_0x5ac72e[_0x103c('0x25')],'type':_0x5ac72e[_0x103c('0x26')][_0x103c('0x27')]};});_0x24b3db[_0x103c('0x28')]=_[_0x103c('0x23')](_0x5c1700,'name');_0x24b3db[_0x103c('0x29')]=_[_0x103c('0x2a')](_0x1568c8[_0x103c('0x29')]);_0x24b3db['filters']=_[_0x103c('0x2b')](_0x24b3db['model'],_0x24b3db[_0x103c('0x29')]);_0x42956f[_0x103c('0x2c')]=_[_0x103c('0x2b')](_0x24b3db[_0x103c('0x28')],qs[_0x103c('0x2d')](_0x1568c8[_0x103c('0x29')][_0x103c('0x2d')]));_0x42956f['attributes']=_0x42956f[_0x103c('0x2c')]['length']?_0x42956f[_0x103c('0x2c')]:_0x24b3db['model'];if(!_0x1568c8[_0x103c('0x29')][_0x103c('0x2e')](_0x103c('0x2f'))){_0x42956f[_0x103c('0x1c')]=qs['limit'](_0x1568c8[_0x103c('0x29')][_0x103c('0x1c')]);_0x42956f[_0x103c('0x1a')]=qs['offset'](_0x1568c8[_0x103c('0x29')][_0x103c('0x1a')]);}_0x42956f['order']=qs[_0x103c('0x30')](_0x1568c8['query']['sort']);_0x42956f[_0x103c('0x31')]=qs[_0x103c('0x32')](_['pick'](_0x1568c8[_0x103c('0x29')],_0x24b3db['filters']),_0x5c1700);if(_0x1568c8[_0x103c('0x29')][_0x103c('0x33')]){_0x42956f[_0x103c('0x31')]=_['merge'](_0x42956f[_0x103c('0x31')],{'$or':_[_0x103c('0x23')](_0x5c1700,function(_0x35e184){if(_0x35e184[_0x103c('0x26')]!==_0x103c('0x34')){var _0x2c9acb={};_0x2c9acb[_0x35e184[_0x103c('0x21')]]={'$like':'%'+_0x1568c8[_0x103c('0x29')][_0x103c('0x33')]+'%'};return _0x2c9acb;}})});}_0x42956f=_[_0x103c('0x35')]({},_0x42956f,_0x1568c8[_0x103c('0x36')]);var _0x11e55c={'where':_0x42956f['where']};return db['MailTransferReport'][_0x103c('0x1d')](_0x11e55c)['then'](function(_0xe1c629){_0x5d256d[_0x103c('0x1d')]=_0xe1c629;if(_0x1568c8[_0x103c('0x29')][_0x103c('0x37')]){_0x42956f[_0x103c('0x38')]=[{'all':!![]}];}return db['MailTransferReport'][_0x103c('0x39')](_0x42956f);})[_0x103c('0x1f')](function(_0x502e6e){_0x5d256d[_0x103c('0x3a')]=_0x502e6e;return _0x5d256d;})[_0x103c('0x1f')](respondWithFilteredResult(_0x524701,_0x42956f))[_0x103c('0x3b')](handleError(_0x524701,null));};exports[_0x103c('0x3c')]=function(_0x1157b1,_0x3141ac){var _0x257146={'raw':!![],'where':{'id':_0x1157b1[_0x103c('0x3d')]['id']}},_0x267fff={};_0x267fff['model']=_[_0x103c('0x2a')](db[_0x103c('0x3e')][_0x103c('0x24')]);_0x267fff[_0x103c('0x29')]=_['keys'](_0x1157b1[_0x103c('0x29')]);_0x267fff[_0x103c('0x32')]=_[_0x103c('0x2b')](_0x267fff[_0x103c('0x28')],_0x267fff[_0x103c('0x29')]);_0x257146[_0x103c('0x2c')]=_[_0x103c('0x2b')](_0x267fff[_0x103c('0x28')],qs['fields'](_0x1157b1[_0x103c('0x29')][_0x103c('0x2d')]));_0x257146[_0x103c('0x2c')]=_0x257146['attributes'][_0x103c('0x3f')]?_0x257146[_0x103c('0x2c')]:_0x267fff['model'];if(_0x1157b1[_0x103c('0x29')][_0x103c('0x37')]){_0x257146[_0x103c('0x38')]=[{'all':!![]}];}_0x257146=_[_0x103c('0x35')]({},_0x257146,_0x1157b1['options']);return db[_0x103c('0x3e')]['find'](_0x257146)['then'](handleEntityNotFound(_0x3141ac,null))[_0x103c('0x1f')](respondWithResult(_0x3141ac,null))[_0x103c('0x3b')](handleError(_0x3141ac,null));};exports[_0x103c('0x40')]=function(_0x51a292,_0x52b826){return db[_0x103c('0x3e')][_0x103c('0x40')](_0x51a292[_0x103c('0x41')],{})[_0x103c('0x1f')](respondWithResult(_0x52b826,0xc9))[_0x103c('0x3b')](handleError(_0x52b826,null));};exports[_0x103c('0x42')]=function(_0x39a695,_0x52316d){if(_0x39a695['body']['id']){delete _0x39a695[_0x103c('0x41')]['id'];}return db[_0x103c('0x3e')][_0x103c('0x43')]({'where':{'id':_0x39a695[_0x103c('0x3d')]['id']}})[_0x103c('0x1f')](handleEntityNotFound(_0x52316d,null))[_0x103c('0x1f')](saveUpdates(_0x39a695[_0x103c('0x41')],null))[_0x103c('0x1f')](respondWithResult(_0x52316d,null))[_0x103c('0x3b')](handleError(_0x52316d,null));};exports['destroy']=function(_0x361219,_0x589fde){return db[_0x103c('0x3e')][_0x103c('0x43')]({'where':{'id':_0x361219[_0x103c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x589fde,null))['then'](removeEntity(_0x589fde,null))[_0x103c('0x3b')](handleError(_0x589fde,null));};exports[_0x103c('0x44')]=function(_0x4876c4,_0x58b21e){return db[_0x103c('0x3e')][_0x103c('0x44')]()[_0x103c('0x1f')](respondWithResult(_0x58b21e,null))[_0x103c('0x3b')](handleError(_0x58b21e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 76d9498..0475389 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 _0x5f10=['./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x5f10,0xd5));var _0x05f1=function(_0x67d2b,_0xc3be07){_0x67d2b=_0x67d2b-0x0;var _0x23e7c1=_0x5f10[_0x67d2b];return _0x23e7c1;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x05f1('0x2'));var rp=require(_0x05f1('0x3'));var fs=require('fs');var path=require(_0x05f1('0x4'));var rimraf=require(_0x05f1('0x5'));var config=require(_0x05f1('0x6'));var attributes=require(_0x05f1('0x7'));module['exports']=function(_0x126662,_0x462faa){return _0x126662[_0x05f1('0x8')]('MailTransferReport',attributes,{'tableName':_0x05f1('0x9'),'paranoid':![],'indexes':[{'name':_0x05f1('0xa'),'fields':[_0x05f1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x2da3b9,_0x43f25e){var _0x759774=function(_0x514354){while(--_0x514354){_0x2da3b9['push'](_0x2da3b9['shift']());}};_0x759774(++_0x43f25e);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'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':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 584b821..f73471d 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 _0x9023=['stringify','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x213ca7,_0x3fb562){var _0x2d0e49=function(_0x39b336){while(--_0x39b336){_0x213ca7['push'](_0x213ca7['shift']());}};_0x2d0e49(++_0x3fb562);}(_0x9023,0x115));var _0x3902=function(_0x53cba9,_0x4fefc2){_0x53cba9=_0x53cba9-0x0;var _0x289187=_0x9023[_0x53cba9];return _0x289187;};'use strict';var _=require(_0x3902('0x0'));var util=require(_0x3902('0x1'));var moment=require(_0x3902('0x2'));var BPromise=require(_0x3902('0x3'));var rs=require(_0x3902('0x4'));var fs=require('fs');var Redis=require(_0x3902('0x5'));var db=require(_0x3902('0x6'))['db'];var utils=require(_0x3902('0x7'));var logger=require('../../config/logger')(_0x3902('0x8'));var config=require(_0x3902('0x9'));var jayson=require(_0x3902('0xa'));var client=jayson[_0x3902('0xb')][_0x3902('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x491836,_0x3d4def,_0x2d03bf){return new BPromise(function(_0x4e40e1,_0x320d48){return client['request'](_0x491836,_0x2d03bf)[_0x3902('0xd')](function(_0x3cf703){logger['info'](_0x3902('0xe'),_0x3d4def,_0x3902('0xf'));logger[_0x3902('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3d4def,'request\x20sent',JSON[_0x3902('0x11')](_0x3cf703));if(_0x3cf703['error']){if(_0x3cf703['error']['code']===0x1f4){logger[_0x3902('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3d4def,_0x3cf703[_0x3902('0x12')]['message']);return _0x320d48(_0x3cf703[_0x3902('0x12')][_0x3902('0x13')]);}logger[_0x3902('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3d4def,_0x3cf703['error'][_0x3902('0x13')]);return _0x4e40e1(_0x3cf703[_0x3902('0x12')][_0x3902('0x13')]);}else{logger[_0x3902('0x14')](_0x3902('0xe'),_0x3d4def,_0x3902('0xf'));_0x4e40e1(_0x3cf703['result'][_0x3902('0x13')]);}})['catch'](function(_0x3a3c7e){logger[_0x3902('0x12')](_0x3902('0xe'),_0x3d4def,_0x3a3c7e);_0x320d48(_0x3a3c7e);});});} \ No newline at end of file +var _0x700a=['../../config/environment','jayson/promise','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x223a99,_0x1a0dfe){var _0x27712d=function(_0x5416bf){while(--_0x5416bf){_0x223a99['push'](_0x223a99['shift']());}};_0x27712d(++_0x1a0dfe);}(_0x700a,0xb0));var _0xa700=function(_0x805a37,_0x248b5f){_0x805a37=_0x805a37-0x0;var _0x108afb=_0x700a[_0x805a37];return _0x108afb;};'use strict';var _=require('lodash');var util=require(_0xa700('0x0'));var moment=require(_0xa700('0x1'));var BPromise=require(_0xa700('0x2'));var rs=require(_0xa700('0x3'));var fs=require('fs');var Redis=require(_0xa700('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa700('0x5'));var logger=require(_0xa700('0x6'))(_0xa700('0x7'));var config=require(_0xa700('0x8'));var jayson=require(_0xa700('0x9'));var client=jayson['client'][_0xa700('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9d6d,_0x5e9e87,_0x3b56eb){return new BPromise(function(_0x4ff028,_0x585845){return client[_0xa700('0xb')](_0x4b9d6d,_0x3b56eb)[_0xa700('0xc')](function(_0x3f5db1){logger['info'](_0xa700('0xd'),_0x5e9e87,_0xa700('0xe'));logger[_0xa700('0xf')](_0xa700('0x10'),_0x5e9e87,_0xa700('0xe'),JSON[_0xa700('0x11')](_0x3f5db1));if(_0x3f5db1[_0xa700('0x12')]){if(_0x3f5db1[_0xa700('0x12')][_0xa700('0x13')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5e9e87,_0x3f5db1[_0xa700('0x12')]['message']);return _0x585845(_0x3f5db1[_0xa700('0x12')][_0xa700('0x14')]);}logger['error'](_0xa700('0xd'),_0x5e9e87,_0x3f5db1['error'][_0xa700('0x14')]);return _0x4ff028(_0x3f5db1[_0xa700('0x12')][_0xa700('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5e9e87,_0xa700('0xe'));_0x4ff028(_0x3f5db1[_0xa700('0x15')][_0xa700('0x14')]);}})[_0xa700('0x16')](function(_0x220591){logger[_0xa700('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x5e9e87,_0x220591);_0x585845(_0x220591);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aeb04a2..fa29752 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 _0xfc49=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x4878c3,_0x29a1c7){var _0x3e7c9f=function(_0x4dfa4f){while(--_0x4dfa4f){_0x4878c3['push'](_0x4878c3['shift']());}};_0x3e7c9f(++_0x29a1c7);}(_0xfc49,0x10d));var _0x9fc4=function(_0x536f18,_0x1b2e3e){_0x536f18=_0x536f18-0x0;var _0x3ebbec=_0xfc49[_0x536f18];return _0x3ebbec;};'use strict';var multer=require(_0x9fc4('0x0'));var util=require(_0x9fc4('0x1'));var path=require(_0x9fc4('0x2'));var timeout=require(_0x9fc4('0x3'));var express=require('express');var router=express[_0x9fc4('0x4')]();var fs_extra=require(_0x9fc4('0x5'));var auth=require(_0x9fc4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9fc4('0x7'));var controller=require(_0x9fc4('0x8'));router[_0x9fc4('0x9')]('/',auth[_0x9fc4('0xa')](),controller[_0x9fc4('0xb')]);router[_0x9fc4('0x9')](_0x9fc4('0xc'),auth['isAuthenticated'](),controller[_0x9fc4('0xd')]);router[_0x9fc4('0x9')](_0x9fc4('0xe'),auth[_0x9fc4('0xa')](),controller[_0x9fc4('0xf')]);router[_0x9fc4('0x10')]('/',auth[_0x9fc4('0xa')](),controller[_0x9fc4('0x11')]);router[_0x9fc4('0x12')](_0x9fc4('0xe'),auth['isAuthenticated'](),controller[_0x9fc4('0x13')]);router['delete'](_0x9fc4('0xe'),auth[_0x9fc4('0xa')](),controller[_0x9fc4('0x14')]);module[_0x9fc4('0x15')]=router; \ No newline at end of file +var _0x0b8b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','describe','show','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x303eda,_0x2ceaa7){var _0x36e4f4=function(_0x3e46de){while(--_0x3e46de){_0x303eda['push'](_0x303eda['shift']());}};_0x36e4f4(++_0x2ceaa7);}(_0x0b8b,0xba));var _0xb0b8=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x0b8b[_0xfed299];return _0x4ef1f2;};'use strict';var multer=require(_0xb0b8('0x0'));var util=require(_0xb0b8('0x1'));var path=require(_0xb0b8('0x2'));var timeout=require(_0xb0b8('0x3'));var express=require(_0xb0b8('0x4'));var router=express[_0xb0b8('0x5')]();var fs_extra=require(_0xb0b8('0x6'));var auth=require(_0xb0b8('0x7'));var interaction=require(_0xb0b8('0x8'));var config=require(_0xb0b8('0x9'));var controller=require(_0xb0b8('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0b8('0xb')]);router[_0xb0b8('0xc')]('/describe',auth[_0xb0b8('0xd')](),controller[_0xb0b8('0xe')]);router['get']('/:id',auth[_0xb0b8('0xd')](),controller[_0xb0b8('0xf')]);router['post']('/',auth[_0xb0b8('0xd')](),controller['create']);router[_0xb0b8('0x10')](_0xb0b8('0x11'),auth[_0xb0b8('0xd')](),controller[_0xb0b8('0x12')]);router[_0xb0b8('0x13')](_0xb0b8('0x11'),auth['isAuthenticated'](),controller[_0xb0b8('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 066b3c1..edd2ace 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 _0x9c85=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]'];(function(_0xd896b4,_0x5ee21e){var _0x577a9e=function(_0x8ee139){while(--_0x8ee139){_0xd896b4['push'](_0xd896b4['shift']());}};_0x577a9e(++_0x5ee21e);}(_0x9c85,0x1ed));var _0x59c8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9c85[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x59c8('0x0'));var moment=require(_0x59c8('0x1'));module[_0x59c8('0x2')]={'channel':{'type':Sequelize[_0x59c8('0x3')]},'membername':{'type':Sequelize[_0x59c8('0x3')]},'interface':{'type':Sequelize[_0x59c8('0x3')]},'type':{'type':Sequelize[_0x59c8('0x3')],'defaultValue':_0x59c8('0x4'),'comment':_0x59c8('0x5')},'duration':{'type':Sequelize[_0x59c8('0x6')]},'enterAt':{'type':Sequelize[_0x59c8('0x7')]},'exitAt':{'type':Sequelize[_0x59c8('0x7')],'set':function(_0x231531){var _0x5a95c9=moment(_0x231531);var _0x501e86=moment(this[_0x59c8('0x8')](_0x59c8('0x9')));var _0x55a4ec=_0x5a95c9['diff'](_0x501e86,'seconds');this[_0x59c8('0xa')](_0x59c8('0xb'),_0x231531);this[_0x59c8('0xa')](_0x59c8('0xc'),_0x55a4ec>=0x0?_0x55a4ec:null);}},'data1':{'type':Sequelize[_0x59c8('0x3')],'comment':_0x59c8('0xd')},'data2':{'type':Sequelize[_0x59c8('0x3')],'comment':_0x59c8('0xe')},'data3':{'type':Sequelize[_0x59c8('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x59c8('0x3')],'comment':_0x59c8('0xf')},'data5':{'type':Sequelize[_0x59c8('0x3')],'comment':_0x59c8('0x10')},'role':{'type':Sequelize[_0x59c8('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x59c8('0x3')]}}; \ No newline at end of file +var _0x081b=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x29030e,_0x17382b){var _0xb6d20b=function(_0x215ef5){while(--_0x215ef5){_0x29030e['push'](_0x29030e['shift']());}};_0xb6d20b(++_0x17382b);}(_0x081b,0xbf));var _0xb081=function(_0x2a8e84,_0x3084ae){_0x2a8e84=_0x2a8e84-0x0;var _0x11e05c=_0x081b[_0x2a8e84];return _0x11e05c;};'use strict';var Sequelize=require(_0xb081('0x0'));var moment=require(_0xb081('0x1'));module['exports']={'channel':{'type':Sequelize[_0xb081('0x2')]},'membername':{'type':Sequelize[_0xb081('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb081('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xb081('0x3')},'duration':{'type':Sequelize[_0xb081('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb081('0x5')],'set':function(_0x156b03){var _0x444abf=moment(_0x156b03);var _0xf9bb07=moment(this[_0xb081('0x6')](_0xb081('0x7')));var _0x10d159=_0x444abf[_0xb081('0x8')](_0xf9bb07,_0xb081('0x9'));this[_0xb081('0xa')](_0xb081('0xb'),_0x156b03);this[_0xb081('0xa')](_0xb081('0xc'),_0x10d159>=0x0?_0x10d159:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xb081('0xd')},'data2':{'type':Sequelize[_0xb081('0x2')],'comment':_0xb081('0xe')},'data3':{'type':Sequelize[_0xb081('0x2')],'comment':_0xb081('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xb081('0x10')},'data5':{'type':Sequelize[_0xb081('0x2')],'comment':_0xb081('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xb081('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 14129e6..418ea70 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x4cc815,_0x1d6f0c){var _0x34731e=function(_0x4a4eec){while(--_0x4a4eec){_0x4cc815['push'](_0x4cc815['shift']());}};_0x34731e(++_0x1d6f0c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +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(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x34e8,0x12c));var _0x834e=function(_0x2cd00d,_0xf13db8){_0x2cd00d=_0x2cd00d-0x0;var _0x140a45=_0x34e8[_0x2cd00d];return _0x140a45;};'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 338dedd..8cfae74 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 _0x034b=['request-promise','exports','MemberReport','membername_interface','membername','interface','util','../../config/logger','api','bluebird'];(function(_0x4f8b47,_0x2aaa88){var _0x9a3dd8=function(_0x36e41b){while(--_0x36e41b){_0x4f8b47['push'](_0x4f8b47['shift']());}};_0x9a3dd8(++_0x2aaa88);}(_0x034b,0x1b4));var _0xb034=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x034b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xb034('0x0'));var logger=require(_0xb034('0x1'))(_0xb034('0x2'));var moment=require('moment');var BPromise=require(_0xb034('0x3'));var rp=require(_0xb034('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xb034('0x5')]=function(_0x201fb2,_0x48ae7b){return _0x201fb2['define'](_0xb034('0x6'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xb034('0x7'),'fields':[_0xb034('0x8'),_0xb034('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91f8=['define','report_member','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91f8,0x13f));var _0x891f=function(_0x1915e2,_0x51f382){_0x1915e2=_0x1915e2-0x0;var _0x550ab2=_0x91f8[_0x1915e2];return _0x550ab2;};'use strict';var _=require(_0x891f('0x0'));var util=require(_0x891f('0x1'));var logger=require(_0x891f('0x2'))(_0x891f('0x3'));var moment=require(_0x891f('0x4'));var BPromise=require(_0x891f('0x5'));var rp=require(_0x891f('0x6'));var fs=require('fs');var path=require(_0x891f('0x7'));var rimraf=require('rimraf');var config=require(_0x891f('0x8'));var attributes=require(_0x891f('0x9'));module[_0x891f('0xa')]=function(_0x892594,_0x59a2e4){return _0x892594[_0x891f('0xb')]('MemberReport',attributes,{'tableName':_0x891f('0xc'),'paranoid':![],'indexes':[{'name':_0x891f('0xd'),'fields':[_0x891f('0xe'),'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 2b52e5d..b9736ce 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 _0x0689=['where','attributes','map','include','model','create','body','CreateMemberReport','UpdateMemberReport','update','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x548d58,_0x52f7f6){var _0x3ad077=function(_0x43f387){while(--_0x43f387){_0x548d58['push'](_0x548d58['shift']());}};_0x3ad077(++_0x52f7f6);}(_0x0689,0x161));var _0x9068=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0x0689[_0x1f94b0];return _0x5cba72;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require('moment');var BPromise=require(_0x9068('0x1'));var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var jayson=require(_0x9068('0x9'));var client=jayson[_0x9068('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb67,_0x5c833f,_0x4bdd1b){return new BPromise(function(_0x17bc63,_0x184746){return client[_0x9068('0xb')](_0x34cb67,_0x4bdd1b)[_0x9068('0xc')](function(_0x1c63d2){logger[_0x9068('0xd')](_0x9068('0xe'),_0x5c833f,_0x9068('0xf'));logger[_0x9068('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'),JSON[_0x9068('0x11')](_0x1c63d2));if(_0x1c63d2[_0x9068('0x12')]){if(_0x1c63d2[_0x9068('0x12')]['code']===0x1f4){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x1c63d2[_0x9068('0x12')]['message']);return _0x184746(_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);}logger[_0x9068('0x12')]('MemberReport,\x20%s,\x20%s',_0x5c833f,_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);return _0x17bc63(_0x1c63d2['error'][_0x9068('0x13')]);}else{logger[_0x9068('0xd')]('MemberReport,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'));_0x17bc63(_0x1c63d2[_0x9068('0x14')][_0x9068('0x13')]);}})[_0x9068('0x15')](function(_0x576b34){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x576b34);_0x184746(_0x576b34);});});}exports[_0x9068('0x16')]=function(_0x36d591){var _0x3e3a1c=this;return new Promise(function(_0x1d09bf,_0xebe833){return db[_0x9068('0x17')][_0x9068('0x18')]({'raw':_0x36d591['options']?_0x36d591[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![],'where':_0x36d591[_0x9068('0x19')]?_0x36d591[_0x9068('0x19')][_0x9068('0x1b')]||null:null,'attributes':_0x36d591[_0x9068('0x19')]?_0x36d591[_0x9068('0x19')][_0x9068('0x1c')]||null:null,'limit':_0x36d591['options']?_0x36d591['options']['limit']||null:null,'include':_0x36d591[_0x9068('0x19')]?_0x36d591['options']['include']?_[_0x9068('0x1d')](_0x36d591[_0x9068('0x19')][_0x9068('0x1e')],function(_0x3673b9){return{'model':db[_0x3673b9['model']],'as':_0x3673b9['as'],'attributes':_0x3673b9[_0x9068('0x1c')],'include':_0x3673b9[_0x9068('0x1e')]?_[_0x9068('0x1d')](_0x3673b9[_0x9068('0x1e')],function(_0x12f17f){return{'model':db[_0x12f17f[_0x9068('0x1f')]],'as':_0x12f17f['as'],'attributes':_0x12f17f['attributes'],'include':_0x12f17f[_0x9068('0x1e')]?_[_0x9068('0x1d')](_0x12f17f['include'],function(_0x12369a){return{'model':db[_0x12369a[_0x9068('0x1f')]],'as':_0x12369a['as'],'attributes':_0x12369a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23b31d){logger['info'](_0x9068('0x16'),_0x36d591);logger[_0x9068('0x10')](_0x9068('0x16'),_0x36d591,JSON[_0x9068('0x11')](_0x23b31d));_0x1d09bf(_0x23b31d);})[_0x9068('0x15')](function(_0x4fd2e2){logger[_0x9068('0x12')](_0x9068('0x16'),_0x4fd2e2[_0x9068('0x13')],_0x36d591);_0xebe833(_0x3e3a1c[_0x9068('0x12')](0x1f4,_0x4fd2e2['message']));});});};exports['CreateMemberReport']=function(_0x19262a){var _0x318964=this;return new Promise(function(_0xb58f9,_0x22e718){return db[_0x9068('0x17')][_0x9068('0x20')](_0x19262a[_0x9068('0x21')],{'raw':_0x19262a[_0x9068('0x19')]?_0x19262a[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xe94cb5){logger[_0x9068('0xd')](_0x9068('0x22'),_0x19262a);logger['debug'](_0x9068('0x22'),_0x19262a,JSON[_0x9068('0x11')](_0xe94cb5));_0xb58f9(_0xe94cb5);})[_0x9068('0x15')](function(_0x1a8026){logger['error'](_0x9068('0x22'),_0x1a8026['message'],_0x19262a);_0x22e718(_0x318964[_0x9068('0x12')](0x1f4,_0x1a8026['message']));});});};exports[_0x9068('0x23')]=function(_0xe64fb4){var _0x124086=this;return new Promise(function(_0x526c3a,_0x9f33d4){return db['MemberReport'][_0x9068('0x24')](_0xe64fb4[_0x9068('0x21')],{'raw':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x1b')]||null:null,'attributes':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4['options'][_0x9068('0x1c')]||null:null,'limit':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x25')]||null:null})['then'](function(_0x5d0dab){logger[_0x9068('0xd')](_0x9068('0x23'),_0xe64fb4);logger[_0x9068('0x10')](_0x9068('0x23'),_0xe64fb4,JSON[_0x9068('0x11')](_0x5d0dab));_0x526c3a(_0x5d0dab);})[_0x9068('0x15')](function(_0x1b552f){logger[_0x9068('0x12')](_0x9068('0x23'),_0x1b552f[_0x9068('0x13')],_0xe64fb4);_0x9f33d4(_0x124086[_0x9068('0x12')](0x1f4,_0x1b552f[_0x9068('0x13')]));});});}; \ No newline at end of file +var _0x36b2=['rpc','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MemberReport','options','where','attributes','limit','include','model','map','info','GetMemberReport','create','body','raw','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x93dd7c,_0x4cf5f7){var _0xbb5d73=function(_0x482a7b){while(--_0x482a7b){_0x93dd7c['push'](_0x93dd7c['shift']());}};_0xbb5d73(++_0x4cf5f7);}(_0x36b2,0x6b));var _0x236b=function(_0x1f09b0,_0x371be4){_0x1f09b0=_0x1f09b0-0x0;var _0x38dcea=_0x36b2[_0x1f09b0];return _0x38dcea;};'use strict';var _=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var moment=require(_0x236b('0x2'));var BPromise=require('bluebird');var rs=require(_0x236b('0x3'));var fs=require('fs');var Redis=require(_0x236b('0x4'));var db=require(_0x236b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x236b('0x6'))(_0x236b('0x7'));var config=require('../../config/environment');var jayson=require(_0x236b('0x8'));var client=jayson[_0x236b('0x9')][_0x236b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9e1345,_0x40b9ab,_0x2ff02e){return new BPromise(function(_0x52b043,_0x21ad4e){return client[_0x236b('0xb')](_0x9e1345,_0x2ff02e)[_0x236b('0xc')](function(_0x318581){logger['info'](_0x236b('0xd'),_0x40b9ab,_0x236b('0xe'));logger[_0x236b('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x40b9ab,_0x236b('0xe'),JSON[_0x236b('0x10')](_0x318581));if(_0x318581[_0x236b('0x11')]){if(_0x318581['error'][_0x236b('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x40b9ab,_0x318581[_0x236b('0x11')]['message']);return _0x21ad4e(_0x318581[_0x236b('0x11')][_0x236b('0x13')]);}logger[_0x236b('0x11')](_0x236b('0xd'),_0x40b9ab,_0x318581[_0x236b('0x11')][_0x236b('0x13')]);return _0x52b043(_0x318581[_0x236b('0x11')]['message']);}else{logger['info'](_0x236b('0xd'),_0x40b9ab,_0x236b('0xe'));_0x52b043(_0x318581[_0x236b('0x14')][_0x236b('0x13')]);}})[_0x236b('0x15')](function(_0x4f0152){logger['error'](_0x236b('0xd'),_0x40b9ab,_0x4f0152);_0x21ad4e(_0x4f0152);});});}exports['GetMemberReport']=function(_0x18878f){var _0x183191=this;return new Promise(function(_0x5a6c07,_0x4d5f86){return db[_0x236b('0x16')]['findAll']({'raw':_0x18878f[_0x236b('0x17')]?_0x18878f['options']['raw']===undefined?!![]:![]:!![],'where':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x18')]||null:null,'attributes':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x19')]||null:null,'limit':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x1a')]||null:null,'include':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x1b')]?_['map'](_0x18878f[_0x236b('0x17')][_0x236b('0x1b')],function(_0x5711a9){return{'model':db[_0x5711a9[_0x236b('0x1c')]],'as':_0x5711a9['as'],'attributes':_0x5711a9[_0x236b('0x19')],'include':_0x5711a9[_0x236b('0x1b')]?_['map'](_0x5711a9[_0x236b('0x1b')],function(_0x1617f8){return{'model':db[_0x1617f8[_0x236b('0x1c')]],'as':_0x1617f8['as'],'attributes':_0x1617f8[_0x236b('0x19')],'include':_0x1617f8[_0x236b('0x1b')]?_[_0x236b('0x1d')](_0x1617f8[_0x236b('0x1b')],function(_0x4d319e){return{'model':db[_0x4d319e[_0x236b('0x1c')]],'as':_0x4d319e['as'],'attributes':_0x4d319e[_0x236b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x236b('0xc')](function(_0x462eea){logger[_0x236b('0x1e')](_0x236b('0x1f'),_0x18878f);logger[_0x236b('0xf')](_0x236b('0x1f'),_0x18878f,JSON[_0x236b('0x10')](_0x462eea));_0x5a6c07(_0x462eea);})[_0x236b('0x15')](function(_0x15a520){logger[_0x236b('0x11')](_0x236b('0x1f'),_0x15a520[_0x236b('0x13')],_0x18878f);_0x4d5f86(_0x183191[_0x236b('0x11')](0x1f4,_0x15a520[_0x236b('0x13')]));});});};exports['CreateMemberReport']=function(_0x1795cc){var _0x24abb8=this;return new Promise(function(_0x3d18b7,_0x5581fd){return db[_0x236b('0x16')][_0x236b('0x20')](_0x1795cc[_0x236b('0x21')],{'raw':_0x1795cc[_0x236b('0x17')]?_0x1795cc[_0x236b('0x17')][_0x236b('0x22')]===undefined?!![]:![]:!![]})[_0x236b('0xc')](function(_0x34317e){logger[_0x236b('0x1e')](_0x236b('0x23'),_0x1795cc);logger[_0x236b('0xf')](_0x236b('0x23'),_0x1795cc,JSON[_0x236b('0x10')](_0x34317e));_0x3d18b7(_0x34317e);})[_0x236b('0x15')](function(_0x146f6a){logger['error'](_0x236b('0x23'),_0x146f6a['message'],_0x1795cc);_0x5581fd(_0x24abb8['error'](0x1f4,_0x146f6a[_0x236b('0x13')]));});});};exports[_0x236b('0x24')]=function(_0x11806d){var _0x396b46=this;return new Promise(function(_0x6fb705,_0x1aafd8){return db['MemberReport'][_0x236b('0x25')](_0x11806d['body'],{'raw':_0x11806d['options']?_0x11806d[_0x236b('0x17')][_0x236b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11806d[_0x236b('0x17')]?_0x11806d[_0x236b('0x17')][_0x236b('0x18')]||null:null,'attributes':_0x11806d['options']?_0x11806d[_0x236b('0x17')][_0x236b('0x19')]||null:null,'limit':_0x11806d[_0x236b('0x17')]?_0x11806d[_0x236b('0x17')][_0x236b('0x1a')]||null:null})[_0x236b('0xc')](function(_0x2e96ac){logger[_0x236b('0x1e')](_0x236b('0x24'),_0x11806d);logger[_0x236b('0xf')](_0x236b('0x24'),_0x11806d,JSON[_0x236b('0x10')](_0x2e96ac));_0x6fb705(_0x2e96ac);})[_0x236b('0x15')](function(_0x14a756){logger[_0x236b('0x11')](_0x236b('0x24'),_0x14a756[_0x236b('0x13')],_0x11806d);_0x1aafd8(_0x396b46[_0x236b('0x11')](0x1f4,_0x14a756[_0x236b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e9cef91..21e694b 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 _0xadb5=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports'];(function(_0x47d348,_0x7066d9){var _0x1769ad=function(_0x4468e8){while(--_0x4468e8){_0x47d348['push'](_0x47d348['shift']());}};_0x1769ad(++_0x7066d9);}(_0xadb5,0x1c2));var _0x5adb=function(_0x1b40c8,_0x373ceb){_0x1b40c8=_0x1b40c8-0x0;var _0x24e0a6=_0xadb5[_0x1b40c8];return _0x24e0a6;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require(_0x5adb('0x1'));var timeout=require('connect-timeout');var express=require(_0x5adb('0x2'));var router=express['Router']();var fs_extra=require(_0x5adb('0x3'));var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require(_0x5adb('0x7'));router[_0x5adb('0x8')]('/',controller['index']);module[_0x5adb('0x9')]=router; \ No newline at end of file +var _0x043b=['connect-timeout','express','Router','fs-extra','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x043b,0x15d));var _0xb043=function(_0xdf7b47,_0x47c2b5){_0xdf7b47=_0xdf7b47-0x0;var _0x18f11d=_0x043b[_0xdf7b47];return _0x18f11d;};'use strict';var multer=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var path=require(_0xb043('0x2'));var timeout=require(_0xb043('0x3'));var express=require(_0xb043('0x4'));var router=express[_0xb043('0x5')]();var fs_extra=require(_0xb043('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb043('0x7'));var controller=require(_0xb043('0x8'));router[_0xb043('0x9')]('/',controller[_0xb043('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index f19c264..507f79d 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 _0xc868=['exports','STRING','version','sequelize'];(function(_0x374325,_0x36b5ba){var _0xc6402f=function(_0x3c281c){while(--_0x3c281c){_0x374325['push'](_0x374325['shift']());}};_0xc6402f(++_0x36b5ba);}(_0xc868,0x93));var _0x8c86=function(_0x29ede1,_0x2419b9){_0x29ede1=_0x29ede1-0x0;var _0x1cb5d7=_0xc868[_0x29ede1];return _0x1cb5d7;};'use strict';var Sequelize=require(_0x8c86('0x0'));module[_0x8c86('0x1')]={'version':{'type':Sequelize[_0x8c86('0x2')],'unique':_0x8c86('0x3')}}; \ No newline at end of file +var _0x44dd=['STRING','version','sequelize'];(function(_0x5dd924,_0x2245f0){var _0x31070c=function(_0x5728ca){while(--_0x5728ca){_0x5dd924['push'](_0x5dd924['shift']());}};_0x31070c(++_0x2245f0);}(_0x44dd,0x12b));var _0xd44d=function(_0x2a76be,_0x267372){_0x2a76be=_0x2a76be-0x0;var _0x18436a=_0x44dd[_0x2a76be];return _0x18436a;};'use strict';var Sequelize=require(_0xd44d('0x0'));module['exports']={'version':{'type':Sequelize[_0xd44d('0x1')],'unique':_0xd44d('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2390b5b..a298732 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 _0x87c9=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','stack','name','send','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','type','options','includeAll','include','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse'];(function(_0x33fddd,_0x4ca1d0){var _0x3cd9ec=function(_0x7b01ca){while(--_0x7b01ca){_0x33fddd['push'](_0x33fddd['shift']());}};_0x3cd9ec(++_0x4ca1d0);}(_0x87c9,0x196));var _0x987c=function(_0x1c0f22,_0x262e9e){_0x1c0f22=_0x1c0f22-0x0;var _0x33c230=_0x87c9[_0x1c0f22];return _0x33c230;};'use strict';var emlformat=require(_0x987c('0x0'));var rimraf=require(_0x987c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x987c('0x2'));var rp=require(_0x987c('0x3'));var moment=require(_0x987c('0x4'));var BPromise=require(_0x987c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x987c('0x6'));var ejs=require(_0x987c('0x7'));var fs=require('fs');var fs_extra=require(_0x987c('0x8'));var _=require('lodash');var squel=require(_0x987c('0x9'));var crypto=require(_0x987c('0xa'));var jsforce=require(_0x987c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x987c('0xc'));var Papa=require(_0x987c('0xd'));var Redis=require(_0x987c('0xe'));var authService=require(_0x987c('0xf'));var qs=require(_0x987c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x987c('0x11'))(_0x987c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x987c('0x13'));var db=require(_0x987c('0x14'))['db'];function respondWithStatusCode(_0x179672,_0x166c46){_0x166c46=_0x166c46||0xcc;return function(_0x4b7fd2){if(_0x4b7fd2){return _0x179672[_0x987c('0x15')](_0x166c46);}return _0x179672[_0x987c('0x16')](_0x166c46)[_0x987c('0x17')]();};}function respondWithResult(_0x304a94,_0x423344){_0x423344=_0x423344||0xc8;return function(_0x580219){if(_0x580219){return _0x304a94[_0x987c('0x16')](_0x423344)['json'](_0x580219);}};}function respondWithFilteredResult(_0x449cb1,_0x51a85f){return function(_0x2dd95f){if(_0x2dd95f){var _0x4faac9=typeof _0x51a85f['offset']===_0x987c('0x18')&&typeof _0x51a85f[_0x987c('0x19')]===_0x987c('0x18');var _0x30b8be=_0x2dd95f[_0x987c('0x1a')];var _0x5ebb7b=_0x4faac9?0x0:_0x51a85f[_0x987c('0x1b')];var _0x4a1302=_0x4faac9?_0x2dd95f[_0x987c('0x1a')]:_0x51a85f[_0x987c('0x1b')]+_0x51a85f['limit'];var _0x41d6e1;if(_0x4a1302>=_0x30b8be){_0x4a1302=_0x30b8be;_0x41d6e1=0xc8;}else{_0x41d6e1=0xce;}_0x449cb1[_0x987c('0x16')](_0x41d6e1);return _0x449cb1[_0x987c('0x1c')](_0x987c('0x1d'),_0x5ebb7b+'-'+_0x4a1302+'/'+_0x30b8be)[_0x987c('0x1e')](_0x2dd95f);}return null;};}function patchUpdates(_0x2ae2d7){return function(_0x1a6cb8){try{jsonpatch[_0x987c('0x1f')](_0x1a6cb8,_0x2ae2d7,!![]);}catch(_0x10c4d4){return BPromise['reject'](_0x10c4d4);}return _0x1a6cb8['save']();};}function saveUpdates(_0x53aeca,_0x32391a){return function(_0x466ac4){if(_0x466ac4){return _0x466ac4[_0x987c('0x20')](_0x53aeca)[_0x987c('0x21')](function(_0x3c68cc){return _0x3c68cc;});}return null;};}function removeEntity(_0x57f95c,_0x109a6e){return function(_0x120ed2){if(_0x120ed2){return _0x120ed2['destroy']()[_0x987c('0x21')](function(){_0x57f95c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4889dc,_0x14c048){return function(_0x2bdea5){if(!_0x2bdea5){_0x4889dc[_0x987c('0x15')](0x194);}return _0x2bdea5;};}function handleError(_0xfbb92c,_0x12cd1f){_0x12cd1f=_0x12cd1f||0x1f4;return function(_0x5ebae8){logger['error'](_0x5ebae8[_0x987c('0x22')]);if(_0x5ebae8[_0x987c('0x23')]){delete _0x5ebae8[_0x987c('0x23')];}_0xfbb92c[_0x987c('0x16')](_0x12cd1f)[_0x987c('0x24')](_0x5ebae8);};}exports['index']=function(_0x41a963,_0x4c29fb){var _0x29f88f={},_0x2c0a48={},_0x54cf25={'count':0x0,'rows':[]};var _0x1f58a9=_[_0x987c('0x25')](db[_0x987c('0x26')][_0x987c('0x27')],function(_0x11b5a1){return{'name':_0x11b5a1[_0x987c('0x28')],'type':_0x11b5a1['type'][_0x987c('0x29')]};});_0x2c0a48[_0x987c('0x2a')]=_[_0x987c('0x25')](_0x1f58a9,_0x987c('0x23'));_0x2c0a48[_0x987c('0x2b')]=_[_0x987c('0x2c')](_0x41a963['query']);_0x2c0a48['filters']=_[_0x987c('0x2d')](_0x2c0a48[_0x987c('0x2a')],_0x2c0a48[_0x987c('0x2b')]);_0x29f88f[_0x987c('0x2e')]=_[_0x987c('0x2d')](_0x2c0a48[_0x987c('0x2a')],qs[_0x987c('0x2f')](_0x41a963['query'][_0x987c('0x2f')]));_0x29f88f['attributes']=_0x29f88f[_0x987c('0x2e')]['length']?_0x29f88f[_0x987c('0x2e')]:_0x2c0a48[_0x987c('0x2a')];if(!_0x41a963['query'][_0x987c('0x30')]('nolimit')){_0x29f88f[_0x987c('0x19')]=qs[_0x987c('0x19')](_0x41a963['query']['limit']);_0x29f88f['offset']=qs['offset'](_0x41a963[_0x987c('0x2b')]['offset']);}_0x29f88f[_0x987c('0x31')]=qs[_0x987c('0x32')](_0x41a963['query'][_0x987c('0x32')]);_0x29f88f['where']=qs[_0x987c('0x33')](_['pick'](_0x41a963[_0x987c('0x2b')],_0x2c0a48['filters']),_0x1f58a9);if(_0x41a963[_0x987c('0x2b')][_0x987c('0x34')]){_0x29f88f[_0x987c('0x35')]=_[_0x987c('0x36')](_0x29f88f[_0x987c('0x35')],{'$or':_['map'](_0x1f58a9,function(_0x448b31){if(_0x448b31[_0x987c('0x37')]!=='VIRTUAL'){var _0x29d79b={};_0x29d79b[_0x448b31[_0x987c('0x23')]]={'$like':'%'+_0x41a963[_0x987c('0x2b')][_0x987c('0x34')]+'%'};return _0x29d79b;}})});}_0x29f88f=_['merge']({},_0x29f88f,_0x41a963[_0x987c('0x38')]);var _0x3a84ec={'where':_0x29f88f[_0x987c('0x35')]};return db[_0x987c('0x26')]['count'](_0x3a84ec)[_0x987c('0x21')](function(_0x4e8377){_0x54cf25[_0x987c('0x1a')]=_0x4e8377;if(_0x41a963['query'][_0x987c('0x39')]){_0x29f88f[_0x987c('0x3a')]=[{'all':!![]}];}return db[_0x987c('0x26')]['findAll'](_0x29f88f);})['then'](function(_0x86ffc2){_0x54cf25[_0x987c('0x3b')]=_0x86ffc2;return _0x54cf25;})[_0x987c('0x21')](respondWithFilteredResult(_0x4c29fb,_0x29f88f))['catch'](handleError(_0x4c29fb,null));}; \ No newline at end of file +var _0x7295=['options','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','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','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type'];(function(_0x5b764f,_0x377412){var _0xf0153b=function(_0x38b8c5){while(--_0x38b8c5){_0x5b764f['push'](_0x5b764f['shift']());}};_0xf0153b(++_0x377412);}(_0x7295,0x125));var _0x5729=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x7295[_0x5a4b42];return _0x5e81d6;};'use strict';var emlformat=require(_0x5729('0x0'));var rimraf=require(_0x5729('0x1'));var zipdir=require(_0x5729('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5729('0x3'));var moment=require('moment');var BPromise=require(_0x5729('0x4'));var Mustache=require(_0x5729('0x5'));var util=require(_0x5729('0x6'));var path=require(_0x5729('0x7'));var sox=require(_0x5729('0x8'));var csv=require('to-csv');var ejs=require(_0x5729('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5729('0xa'));var squel=require(_0x5729('0xb'));var crypto=require(_0x5729('0xc'));var jsforce=require(_0x5729('0xd'));var deskjs=require(_0x5729('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5729('0xf'));var Papa=require(_0x5729('0x10'));var Redis=require('ioredis');var authService=require(_0x5729('0x11'));var qs=require(_0x5729('0x12'));var as=require(_0x5729('0x13'));var hardwareService=require(_0x5729('0x14'));var logger=require('../../config/logger')(_0x5729('0x15'));var utils=require(_0x5729('0x16'));var config=require(_0x5729('0x17'));var licenseUtil=require(_0x5729('0x18'));var db=require(_0x5729('0x19'))['db'];function respondWithStatusCode(_0x146584,_0x606865){_0x606865=_0x606865||0xcc;return function(_0x3e2712){if(_0x3e2712){return _0x146584['sendStatus'](_0x606865);}return _0x146584['status'](_0x606865)[_0x5729('0x1a')]();};}function respondWithResult(_0x1d4491,_0x557e92){_0x557e92=_0x557e92||0xc8;return function(_0x1605db){if(_0x1605db){return _0x1d4491['status'](_0x557e92)[_0x5729('0x1b')](_0x1605db);}};}function respondWithFilteredResult(_0x209c85,_0x10ce4b){return function(_0x114e09){if(_0x114e09){var _0x3ec799=typeof _0x10ce4b[_0x5729('0x1c')]===_0x5729('0x1d')&&typeof _0x10ce4b[_0x5729('0x1e')]===_0x5729('0x1d');var _0x548321=_0x114e09['count'];var _0x54fd10=_0x3ec799?0x0:_0x10ce4b['offset'];var _0x2a5f32=_0x3ec799?_0x114e09[_0x5729('0x1f')]:_0x10ce4b[_0x5729('0x1c')]+_0x10ce4b[_0x5729('0x1e')];var _0x2f016b;if(_0x2a5f32>=_0x548321){_0x2a5f32=_0x548321;_0x2f016b=0xc8;}else{_0x2f016b=0xce;}_0x209c85[_0x5729('0x20')](_0x2f016b);return _0x209c85[_0x5729('0x21')](_0x5729('0x22'),_0x54fd10+'-'+_0x2a5f32+'/'+_0x548321)[_0x5729('0x1b')](_0x114e09);}return null;};}function patchUpdates(_0x3c4ba4){return function(_0x34824e){try{jsonpatch[_0x5729('0x23')](_0x34824e,_0x3c4ba4,!![]);}catch(_0x3b87c7){return BPromise[_0x5729('0x24')](_0x3b87c7);}return _0x34824e[_0x5729('0x25')]();};}function saveUpdates(_0x26e177,_0x228224){return function(_0x2681d7){if(_0x2681d7){return _0x2681d7[_0x5729('0x26')](_0x26e177)[_0x5729('0x27')](function(_0x43374f){return _0x43374f;});}return null;};}function removeEntity(_0x1ba09c,_0x8c950c){return function(_0x5f44da){if(_0x5f44da){return _0x5f44da[_0x5729('0x28')]()[_0x5729('0x27')](function(){_0x1ba09c[_0x5729('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4227,_0xf3d4ca){return function(_0x50374d){if(!_0x50374d){_0x3d4227[_0x5729('0x29')](0x194);}return _0x50374d;};}function handleError(_0x4f113e,_0x1b925c){_0x1b925c=_0x1b925c||0x1f4;return function(_0x47831e){logger['error'](_0x47831e[_0x5729('0x2a')]);if(_0x47831e['name']){delete _0x47831e[_0x5729('0x2b')];}_0x4f113e[_0x5729('0x20')](_0x1b925c)[_0x5729('0x2c')](_0x47831e);};}exports[_0x5729('0x2d')]=function(_0x21c6b2,_0x3a26ba){var _0x2c3866={},_0x339db7={},_0xc2e615={'count':0x0,'rows':[]};var _0x22dc49=_[_0x5729('0x2e')](db[_0x5729('0x2f')][_0x5729('0x30')],function(_0xd821e){return{'name':_0xd821e[_0x5729('0x31')],'type':_0xd821e['type'][_0x5729('0x32')]};});_0x339db7['model']=_[_0x5729('0x2e')](_0x22dc49,_0x5729('0x2b'));_0x339db7['query']=_[_0x5729('0x33')](_0x21c6b2['query']);_0x339db7[_0x5729('0x34')]=_[_0x5729('0x35')](_0x339db7['model'],_0x339db7[_0x5729('0x36')]);_0x2c3866[_0x5729('0x37')]=_[_0x5729('0x35')](_0x339db7['model'],qs['fields'](_0x21c6b2[_0x5729('0x36')][_0x5729('0x38')]));_0x2c3866[_0x5729('0x37')]=_0x2c3866[_0x5729('0x37')][_0x5729('0x39')]?_0x2c3866['attributes']:_0x339db7[_0x5729('0x3a')];if(!_0x21c6b2[_0x5729('0x36')][_0x5729('0x3b')](_0x5729('0x3c'))){_0x2c3866[_0x5729('0x1e')]=qs[_0x5729('0x1e')](_0x21c6b2[_0x5729('0x36')][_0x5729('0x1e')]);_0x2c3866[_0x5729('0x1c')]=qs[_0x5729('0x1c')](_0x21c6b2[_0x5729('0x36')][_0x5729('0x1c')]);}_0x2c3866['order']=qs[_0x5729('0x3d')](_0x21c6b2[_0x5729('0x36')][_0x5729('0x3d')]);_0x2c3866[_0x5729('0x3e')]=qs[_0x5729('0x34')](_[_0x5729('0x3f')](_0x21c6b2[_0x5729('0x36')],_0x339db7[_0x5729('0x34')]),_0x22dc49);if(_0x21c6b2[_0x5729('0x36')][_0x5729('0x40')]){_0x2c3866[_0x5729('0x3e')]=_[_0x5729('0x41')](_0x2c3866[_0x5729('0x3e')],{'$or':_[_0x5729('0x2e')](_0x22dc49,function(_0x41e8f6){if(_0x41e8f6[_0x5729('0x42')]!=='VIRTUAL'){var _0x1a678e={};_0x1a678e[_0x41e8f6[_0x5729('0x2b')]]={'$like':'%'+_0x21c6b2['query'][_0x5729('0x40')]+'%'};return _0x1a678e;}})});}_0x2c3866=_[_0x5729('0x41')]({},_0x2c3866,_0x21c6b2[_0x5729('0x43')]);var _0x509223={'where':_0x2c3866[_0x5729('0x3e')]};return db['Migration'][_0x5729('0x1f')](_0x509223)['then'](function(_0x19dc21){_0xc2e615[_0x5729('0x1f')]=_0x19dc21;if(_0x21c6b2[_0x5729('0x36')][_0x5729('0x44')]){_0x2c3866[_0x5729('0x45')]=[{'all':!![]}];}return db[_0x5729('0x2f')][_0x5729('0x46')](_0x2c3866);})['then'](function(_0x49e3d2){_0xc2e615[_0x5729('0x47')]=_0x49e3d2;return _0xc2e615;})[_0x5729('0x27')](respondWithFilteredResult(_0x3a26ba,_0x2c3866))['catch'](handleError(_0x3a26ba,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7fe088b..190e96a 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 _0xda7a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda7a,0x11c));var _0xada7=function(_0x95c948,_0x454c38){_0x95c948=_0x95c948-0x0;var _0x599e58=_0xda7a[_0x95c948];return _0x599e58;};'use strict';var _=require(_0xada7('0x0'));var util=require(_0xada7('0x1'));var logger=require(_0xada7('0x2'))(_0xada7('0x3'));var moment=require(_0xada7('0x4'));var BPromise=require(_0xada7('0x5'));var rp=require(_0xada7('0x6'));var fs=require('fs');var path=require(_0xada7('0x7'));var rimraf=require(_0xada7('0x8'));var config=require(_0xada7('0x9'));var attributes=require(_0xada7('0xa'));module[_0xada7('0xb')]=function(_0x5bfc14,_0x531089){return _0x5bfc14['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3397=['request-promise','path','rimraf','./migration.attributes','define','Migration','migrations','util','../../config/logger','api','bluebird'];(function(_0x298f02,_0x1f7a03){var _0x173abd=function(_0x3b5ef1){while(--_0x3b5ef1){_0x298f02['push'](_0x298f02['shift']());}};_0x173abd(++_0x1f7a03);}(_0x3397,0x104));var _0x7339=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x3397[_0x231dda];return _0x3f88cb;};'use strict';var _=require('lodash');var util=require(_0x7339('0x0'));var logger=require(_0x7339('0x1'))(_0x7339('0x2'));var moment=require('moment');var BPromise=require(_0x7339('0x3'));var rp=require(_0x7339('0x4'));var fs=require('fs');var path=require(_0x7339('0x5'));var rimraf=require(_0x7339('0x6'));var config=require('../../config/environment');var attributes=require(_0x7339('0x7'));module['exports']=function(_0x4bbb27,_0x170b21){return _0x4bbb27[_0x7339('0x8')](_0x7339('0x9'),attributes,{'tableName':_0x7339('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 6a20d0e..fb13311 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 _0x8a55=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4af4c0,_0x4346db){var _0x22938e=function(_0x4f220b){while(--_0x4f220b){_0x4af4c0['push'](_0x4af4c0['shift']());}};_0x22938e(++_0x4346db);}(_0x8a55,0x185));var _0x58a5=function(_0x46d5d3,_0x2a5005){_0x46d5d3=_0x46d5d3-0x0;var _0x5a9bba=_0x8a55[_0x46d5d3];return _0x5a9bba;};'use strict';var _=require(_0x58a5('0x0'));var util=require(_0x58a5('0x1'));var moment=require(_0x58a5('0x2'));var BPromise=require(_0x58a5('0x3'));var rs=require(_0x58a5('0x4'));var fs=require('fs');var Redis=require(_0x58a5('0x5'));var db=require(_0x58a5('0x6'))['db'];var utils=require(_0x58a5('0x7'));var logger=require('../../config/logger')(_0x58a5('0x8'));var config=require(_0x58a5('0x9'));var jayson=require(_0x58a5('0xa'));var client=jayson[_0x58a5('0xb')][_0x58a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1690bc,_0x1f135e,_0xd63fc7){return new BPromise(function(_0x36d8a4,_0x59860d){return client[_0x58a5('0xd')](_0x1690bc,_0xd63fc7)[_0x58a5('0xe')](function(_0x2cca61){logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,_0x58a5('0x11'));logger[_0x58a5('0x12')](_0x58a5('0x13'),_0x1f135e,_0x58a5('0x11'),JSON[_0x58a5('0x14')](_0x2cca61));if(_0x2cca61[_0x58a5('0x15')]){if(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x16')]===0x1f4){logger[_0x58a5('0x15')]('Migration,\x20%s,\x20%s',_0x1f135e,_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);return _0x59860d(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}logger[_0x58a5('0x15')]('Migration,\x20%s,\x20%s',_0x1f135e,_0x2cca61['error'][_0x58a5('0x17')]);return _0x36d8a4(_0x2cca61[_0x58a5('0x15')][_0x58a5('0x17')]);}else{logger[_0x58a5('0xf')](_0x58a5('0x10'),_0x1f135e,'request\x20sent');_0x36d8a4(_0x2cca61[_0x58a5('0x18')][_0x58a5('0x17')]);}})['catch'](function(_0x2594e3){logger[_0x58a5('0x15')]('Migration,\x20%s,\x20%s',_0x1f135e,_0x2594e3);_0x59860d(_0x2594e3);});});} \ No newline at end of file +var _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x6308[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('Migration,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('Migration,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('Migration,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 22cdd6f..38fb2c6 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 _0xc3ed=['show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xc3ed,0x111));var _0xdc3e=function(_0x3f6c0b,_0x89325d){_0x3f6c0b=_0x3f6c0b-0x0;var _0x260a1e=_0xc3ed[_0x3f6c0b];return _0x260a1e;};'use strict';var multer=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var path=require('path');var timeout=require(_0xdc3e('0x2'));var express=require(_0xdc3e('0x3'));var router=express[_0xdc3e('0x4')]();var fs_extra=require(_0xdc3e('0x5'));var auth=require(_0xdc3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3e('0x7'));var controller=require('./network.controller');router[_0xdc3e('0x8')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xa')]);router[_0xdc3e('0x8')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xc')]);router[_0xdc3e('0xd')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xe')]);router[_0xdc3e('0xf')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x10')]);router[_0xdc3e('0x11')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller['destroy']);module[_0xdc3e('0x12')]=router; \ No newline at end of file +var _0xb2ed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0xb2ed,0x86));var _0xdb2e=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0xb2ed[_0x4605dc];return _0x5d3e81;};'use strict';var multer=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var path=require('path');var timeout=require(_0xdb2e('0x2'));var express=require(_0xdb2e('0x3'));var router=express[_0xdb2e('0x4')]();var fs_extra=require(_0xdb2e('0x5'));var auth=require(_0xdb2e('0x6'));var interaction=require(_0xdb2e('0x7'));var config=require(_0xdb2e('0x8'));var controller=require(_0xdb2e('0x9'));router['get']('/',auth[_0xdb2e('0xa')](),controller[_0xdb2e('0xb')]);router[_0xdb2e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xdb2e('0xd')]);router[_0xdb2e('0xe')]('/',auth['isAuthenticated'](),controller[_0xdb2e('0xf')]);router[_0xdb2e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdb2e('0x11')]);router[_0xdb2e('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdb2e('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 340d251..4a853c3 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 _0x512c=['turn','STRING','exports','localnet','stun'];(function(_0x42dcbb,_0x3bab87){var _0x597f5d=function(_0x3c93c6){while(--_0x3c93c6){_0x42dcbb['push'](_0x42dcbb['shift']());}};_0x597f5d(++_0x3bab87);}(_0x512c,0x7a));var _0xc512=function(_0x134b80,_0x10b054){_0x134b80=_0x134b80-0x0;var _0x10724d=_0x512c[_0x134b80];return _0x10724d;};'use strict';var Sequelize=require('sequelize');module[_0xc512('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc512('0x1'),'externip',_0xc512('0x2'),_0xc512('0x3'))},'value':{'type':Sequelize[_0xc512('0x4')]},'username':{'type':Sequelize[_0xc512('0x4')]},'password':{'type':Sequelize[_0xc512('0x4')]}}; \ No newline at end of file +var _0x1436=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x1b5f00,_0x2bba5a){var _0x235948=function(_0x367ee1){while(--_0x367ee1){_0x1b5f00['push'](_0x1b5f00['shift']());}};_0x235948(++_0x2bba5a);}(_0x1436,0x117));var _0x6143=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1436[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x6143('0x0')]={'type':{'type':Sequelize[_0x6143('0x1')](_0x6143('0x2'),_0x6143('0x3'),_0x6143('0x4'),_0x6143('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6143('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d41eb3c..15744fb 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 _0x89b1=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','end','name','index','map','Network','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','count','includeAll','findAll','show','params','length','include','merge','find','create','sequelize','transaction','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_%s.conf','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Network,\x20%s,\x20%s'];(function(_0x2e95f9,_0x87f8e9){var _0x47f6ee=function(_0x394dc1){while(--_0x394dc1){_0x2e95f9['push'](_0x2e95f9['shift']());}};_0x47f6ee(++_0x87f8e9);}(_0x89b1,0x122));var _0x189b=function(_0xb41283,_0x42775f){_0xb41283=_0xb41283-0x0;var _0x524ef0=_0x89b1[_0xb41283];return _0x524ef0;};'use strict';var emlformat=require(_0x189b('0x0'));var rimraf=require(_0x189b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x189b('0x2'));var rp=require(_0x189b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x189b('0x4'));var util=require(_0x189b('0x5'));var path=require(_0x189b('0x6'));var sox=require(_0x189b('0x7'));var csv=require(_0x189b('0x8'));var ejs=require(_0x189b('0x9'));var fs=require('fs');var fs_extra=require(_0x189b('0xa'));var _=require('lodash');var squel=require(_0x189b('0xb'));var crypto=require(_0x189b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x189b('0xd'));var toCsv=require(_0x189b('0x8'));var querystring=require(_0x189b('0xe'));var Papa=require(_0x189b('0xf'));var Redis=require(_0x189b('0x10'));var authService=require(_0x189b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x189b('0x12'));var hardwareService=require(_0x189b('0x13'));var logger=require(_0x189b('0x14'))(_0x189b('0x15'));var utils=require(_0x189b('0x16'));var config=require(_0x189b('0x17'));var licenseUtil=require(_0x189b('0x18'));var db=require(_0x189b('0x19'))['db'];var jayson=require(_0x189b('0x1a'));var client=jayson['client'][_0x189b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x80c70a,_0x39716a,_0x54cada,_0x4cd5fc){return new BPromise(function(_0x51da2b,_0x388698){var _0x1065eb=_0x4cd5fc||client;return _0x1065eb['request'](_0x80c70a,_0x54cada)[_0x189b('0x1c')](function(_0x55e610){logger[_0x189b('0x1d')](_0x189b('0x1e'),_0x39716a,_0x189b('0x1f'));logger[_0x189b('0x20')](_0x189b('0x21'),_0x39716a,'request\x20sent',JSON[_0x189b('0x22')](_0x55e610));if(_0x55e610[_0x189b('0x23')]){if(_0x55e610[_0x189b('0x23')][_0x189b('0x24')]===0x1f4){logger[_0x189b('0x23')]('Network,\x20%s,\x20%s',_0x39716a,_0x55e610['error'][_0x189b('0x25')]);return _0x388698(_0x55e610[_0x189b('0x23')]['message']);}logger[_0x189b('0x23')](_0x189b('0x1e'),_0x39716a,_0x55e610[_0x189b('0x23')][_0x189b('0x25')]);return _0x51da2b(_0x55e610['error'][_0x189b('0x25')]);}else{logger[_0x189b('0x1d')](_0x189b('0x1e'),_0x39716a,_0x189b('0x1f'));_0x51da2b(_0x55e610[_0x189b('0x26')][_0x189b('0x25')]);}})[_0x189b('0x27')](function(_0x51f718){logger[_0x189b('0x23')]('Network,\x20%s,\x20%s',_0x39716a,_0x51f718);_0x388698(_0x51f718);});});}function respondWithStatusCode(_0x1a986b,_0x5d19c3){_0x5d19c3=_0x5d19c3||0xcc;return function(_0x13bb26){if(_0x13bb26){return _0x1a986b['sendStatus'](_0x5d19c3);}return _0x1a986b['status'](_0x5d19c3)['end']();};}function respondWithResult(_0x234ef0,_0x3ddcc7){_0x3ddcc7=_0x3ddcc7||0xc8;return function(_0xe10262){if(_0xe10262){return _0x234ef0[_0x189b('0x28')](_0x3ddcc7)[_0x189b('0x29')](_0xe10262);}};}function respondWithFilteredResult(_0x37a167,_0x5d75b7){return function(_0x5f19af){if(_0x5f19af){var _0x39e009=typeof _0x5d75b7[_0x189b('0x2a')]===_0x189b('0x2b')&&typeof _0x5d75b7[_0x189b('0x2c')]==='undefined';var _0xd2c9aa=_0x5f19af['count'];var _0x3ff3b3=_0x39e009?0x0:_0x5d75b7['offset'];var _0x3462a2=_0x39e009?_0x5f19af['count']:_0x5d75b7['offset']+_0x5d75b7['limit'];var _0x1e2b87;if(_0x3462a2>=_0xd2c9aa){_0x3462a2=_0xd2c9aa;_0x1e2b87=0xc8;}else{_0x1e2b87=0xce;}_0x37a167['status'](_0x1e2b87);return _0x37a167['set'](_0x189b('0x2d'),_0x3ff3b3+'-'+_0x3462a2+'/'+_0xd2c9aa)[_0x189b('0x29')](_0x5f19af);}return null;};}function patchUpdates(_0x5d4778){return function(_0x52431a){try{jsonpatch[_0x189b('0x2e')](_0x52431a,_0x5d4778,!![]);}catch(_0x3597b8){return BPromise[_0x189b('0x2f')](_0x3597b8);}return _0x52431a[_0x189b('0x30')]();};}function saveUpdates(_0x41d8b3,_0x2d98c2){return function(_0x33fb2d){if(_0x33fb2d){return _0x33fb2d[_0x189b('0x31')](_0x41d8b3)['then'](function(_0x5c6d8c){return _0x5c6d8c;});}return null;};}function removeEntity(_0x2366f8,_0x4e840d){return function(_0x12a919){if(_0x12a919){return _0x12a919['destroy']()['then'](function(){_0x2366f8[_0x189b('0x28')](0xcc)[_0x189b('0x32')]();});}};}function handleEntityNotFound(_0x2a6c33,_0x503da6){return function(_0x1b5f7c){if(!_0x1b5f7c){_0x2a6c33['sendStatus'](0x194);}return _0x1b5f7c;};}function handleError(_0x1017a4,_0x3ff2e8){_0x3ff2e8=_0x3ff2e8||0x1f4;return function(_0x4c12bf){logger[_0x189b('0x23')](_0x4c12bf['stack']);if(_0x4c12bf[_0x189b('0x33')]){delete _0x4c12bf[_0x189b('0x33')];}_0x1017a4[_0x189b('0x28')](_0x3ff2e8)['send'](_0x4c12bf);};}exports[_0x189b('0x34')]=function(_0x3ce5e4,_0x4ac912){var _0x23dd62={},_0x1efdb7={},_0x35ad72={'count':0x0,'rows':[]};var _0x4663c2=_[_0x189b('0x35')](db[_0x189b('0x36')][_0x189b('0x37')],function(_0x4b2100){return{'name':_0x4b2100['fieldName'],'type':_0x4b2100['type'][_0x189b('0x38')]};});_0x1efdb7[_0x189b('0x39')]=_[_0x189b('0x35')](_0x4663c2,_0x189b('0x33'));_0x1efdb7[_0x189b('0x3a')]=_[_0x189b('0x3b')](_0x3ce5e4['query']);_0x1efdb7[_0x189b('0x3c')]=_[_0x189b('0x3d')](_0x1efdb7[_0x189b('0x39')],_0x1efdb7['query']);_0x23dd62[_0x189b('0x3e')]=_[_0x189b('0x3d')](_0x1efdb7[_0x189b('0x39')],qs[_0x189b('0x3f')](_0x3ce5e4['query']['fields']));_0x23dd62[_0x189b('0x3e')]=_0x23dd62['attributes']['length']?_0x23dd62[_0x189b('0x3e')]:_0x1efdb7[_0x189b('0x39')];if(!_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x40')](_0x189b('0x41'))){_0x23dd62[_0x189b('0x2c')]=qs['limit'](_0x3ce5e4[_0x189b('0x3a')]['limit']);_0x23dd62[_0x189b('0x2a')]=qs['offset'](_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x2a')]);}_0x23dd62[_0x189b('0x42')]=qs['sort'](_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x43')]);_0x23dd62['where']=qs[_0x189b('0x3c')](_[_0x189b('0x44')](_0x3ce5e4[_0x189b('0x3a')],_0x1efdb7[_0x189b('0x3c')]),_0x4663c2);if(_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x45')]){_0x23dd62[_0x189b('0x46')]=_['merge'](_0x23dd62[_0x189b('0x46')],{'$or':_['map'](_0x4663c2,function(_0x294092){if(_0x294092[_0x189b('0x47')]!==_0x189b('0x48')){var _0x5e32e5={};_0x5e32e5[_0x294092[_0x189b('0x33')]]={'$like':'%'+_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x45')]+'%'};return _0x5e32e5;}})});}_0x23dd62=_['merge']({},_0x23dd62,_0x3ce5e4[_0x189b('0x49')]);var _0x2f3d04={'where':_0x23dd62[_0x189b('0x46')]};return db['Network'][_0x189b('0x4a')](_0x2f3d04)['then'](function(_0xb02f20){_0x35ad72[_0x189b('0x4a')]=_0xb02f20;if(_0x3ce5e4[_0x189b('0x3a')][_0x189b('0x4b')]){_0x23dd62['include']=[{'all':!![]}];}return db[_0x189b('0x36')][_0x189b('0x4c')](_0x23dd62);})[_0x189b('0x1c')](function(_0x2f32be){_0x35ad72['rows']=_0x2f32be;return _0x35ad72;})['then'](respondWithFilteredResult(_0x4ac912,_0x23dd62))[_0x189b('0x27')](handleError(_0x4ac912,null));};exports[_0x189b('0x4d')]=function(_0x76be59,_0x28aef1){var _0x267ee7={'raw':!![],'where':{'id':_0x76be59[_0x189b('0x4e')]['id']}},_0x48f8dd={};_0x48f8dd['model']=_[_0x189b('0x3b')](db[_0x189b('0x36')][_0x189b('0x37')]);_0x48f8dd[_0x189b('0x3a')]=_[_0x189b('0x3b')](_0x76be59[_0x189b('0x3a')]);_0x48f8dd[_0x189b('0x3c')]=_[_0x189b('0x3d')](_0x48f8dd[_0x189b('0x39')],_0x48f8dd['query']);_0x267ee7[_0x189b('0x3e')]=_[_0x189b('0x3d')](_0x48f8dd[_0x189b('0x39')],qs[_0x189b('0x3f')](_0x76be59['query']['fields']));_0x267ee7[_0x189b('0x3e')]=_0x267ee7[_0x189b('0x3e')][_0x189b('0x4f')]?_0x267ee7[_0x189b('0x3e')]:_0x48f8dd[_0x189b('0x39')];if(_0x76be59[_0x189b('0x3a')][_0x189b('0x4b')]){_0x267ee7[_0x189b('0x50')]=[{'all':!![]}];}_0x267ee7=_[_0x189b('0x51')]({},_0x267ee7,_0x76be59[_0x189b('0x49')]);return db[_0x189b('0x36')][_0x189b('0x52')](_0x267ee7)[_0x189b('0x1c')](handleEntityNotFound(_0x28aef1,null))[_0x189b('0x1c')](respondWithResult(_0x28aef1,null))[_0x189b('0x27')](handleError(_0x28aef1,null));};exports[_0x189b('0x53')]=function(_0x205aeb,_0x4bd2c9,_0x2ead80){var _0x2b9e45;return db[_0x189b('0x54')][_0x189b('0x55')](function(_0x5a5eea){return db[_0x189b('0x36')][_0x189b('0x53')](_0x205aeb[_0x189b('0x56')],{'raw':!![]})['then'](function(_0x35e6a5){_0x2b9e45=_0x35e6a5;return db['Network'][_0x189b('0x4c')]({'where':{'type':_0x205aeb[_0x189b('0x56')]['type']},'raw':!![]});})['then'](function(_0x2ea3ba){if(_0x2b9e45['type'][_0x189b('0x57')]()==_0x189b('0x58')){var _0x358de7=fs['readFileSync'](path['join'](config[_0x189b('0x59')],_0x189b('0x5a')),_0x189b('0x5b'));var _0x201f18=ejs['render'](_0x358de7,{'networks':_0x2ea3ba||[]});fs[_0x189b('0x5c')](_0x189b('0x5d'),_0x201f18);return respondWithRpcPromise(_0x189b('0x5e'),'create',{'module':_0x189b('0x5f')});}else if(_0x2b9e45[_0x189b('0x47')][_0x189b('0x57')]()==_0x189b('0x60')){var _0x5d9ec8=fs['readFileSync'](path[_0x189b('0x61')](config['root'],_0x189b('0x62')),'utf8');var _0x2f50d8=ejs[_0x189b('0x63')](_0x5d9ec8,{'networks':_0x2ea3ba||[]});fs[_0x189b('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2f50d8);return respondWithRpcPromise(_0x189b('0x5e'),_0x189b('0x53'),{'module':_0x189b('0x5f')});}else{var _0x131838=fs['readFileSync'](path[_0x189b('0x61')](config['root'],_0x189b('0x64')),_0x189b('0x5b'));var _0x26b174=ejs['render'](_0x131838,{'networks':_0x2ea3ba||[]});fs[_0x189b('0x5c')](util[_0x189b('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x205aeb[_0x189b('0x56')][_0x189b('0x47')][_0x189b('0x66')]()),_0x26b174);return respondWithRpcPromise('Reload',_0x189b('0x53'),{'module':_0x189b('0x67')});}return null;})[_0x189b('0x1c')](function(){return _0x2b9e45;});})[_0x189b('0x1c')](respondWithResult(_0x4bd2c9,0xc9))[_0x189b('0x27')](handleError(_0x4bd2c9,null));};exports[_0x189b('0x31')]=function(_0x447136,_0x4efd5d,_0x48451e){var _0x5214f7;return db[_0x189b('0x54')]['transaction'](function(_0x142f83){return db[_0x189b('0x36')][_0x189b('0x52')]({'where':{'id':_0x447136[_0x189b('0x4e')]['id']}})[_0x189b('0x1c')](handleEntityNotFound(_0x4efd5d,null))['then'](saveUpdates(_0x447136[_0x189b('0x56')],null))[_0x189b('0x1c')](function(_0x2cea8f){if(_0x2cea8f){_0x5214f7=_0x2cea8f;return db[_0x189b('0x36')][_0x189b('0x4c')]({'where':{'type':_0x5214f7[_0x189b('0x47')]},'raw':!![]});}return null;})[_0x189b('0x1c')](function(_0x35791b){if(_0x5214f7[_0x189b('0x47')][_0x189b('0x57')]()=='STUN'){var _0x140bbb=fs['readFileSync'](path[_0x189b('0x61')](config[_0x189b('0x59')],'server/files/templates/stun_multiple.ejs'),_0x189b('0x5b'));var _0x28ac21=ejs[_0x189b('0x63')](_0x140bbb,{'networks':_0x35791b||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x28ac21);return respondWithRpcPromise(_0x189b('0x5e'),'update',{'module':_0x189b('0x5f')});}else if(_0x5214f7[_0x189b('0x47')]['toUpperCase']()==_0x189b('0x60')){var _0x333fab=fs[_0x189b('0x68')](path[_0x189b('0x61')](config[_0x189b('0x59')],'server/files/templates/turn_multiple.ejs'),_0x189b('0x5b'));var _0x16c271=ejs[_0x189b('0x63')](_0x333fab,{'networks':_0x35791b||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x16c271);return respondWithRpcPromise(_0x189b('0x5e'),_0x189b('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x296e4e=fs[_0x189b('0x68')](path[_0x189b('0x61')](config[_0x189b('0x59')],'server/files/templates/network.ejs'),_0x189b('0x5b'));var _0x34dedb=ejs[_0x189b('0x63')](_0x296e4e,{'networks':_0x35791b||[]});fs['writeFileSync'](util['format'](_0x189b('0x69'),_0x447136[_0x189b('0x56')][_0x189b('0x47')][_0x189b('0x66')]()),_0x34dedb);return respondWithRpcPromise(_0x189b('0x5e'),_0x189b('0x31'),{'module':'chan_sip.so'});}return null;})[_0x189b('0x1c')](function(_0x44bb85){if(_0x44bb85){return _0x5214f7;}return null;});})['then'](respondWithResult(_0x4efd5d,null))['catch'](handleError(_0x4efd5d,null));};exports[_0x189b('0x6a')]=function(_0x21d8b7,_0xaeb9b1,_0x2233a6){var _0x717201;return db['Network'][_0x189b('0x52')]({'where':{'id':_0x21d8b7[_0x189b('0x4e')]['id']}})[_0x189b('0x1c')](function(_0x3d0186){_0x717201=_0x3d0186;return _0x3d0186;})['then'](handleEntityNotFound(_0xaeb9b1,null))[_0x189b('0x1c')](removeEntity(_0xaeb9b1,null))[_0x189b('0x1c')](function(){if(_0x717201){return db[_0x189b('0x36')][_0x189b('0x4c')]({'where':{'type':_0x717201['type']},'raw':!![]});}})[_0x189b('0x1c')](function(_0x4fb779){if(_0x717201['type'][_0x189b('0x57')]()==_0x189b('0x58')){var _0x11d406=fs['readFileSync'](path[_0x189b('0x61')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x189b('0x5b'));var _0x4ecea6=ejs[_0x189b('0x63')](_0x11d406,{'networks':_0x4fb779||[]});fs['writeFileSync'](_0x189b('0x5d'),_0x4ecea6);return respondWithRpcPromise(_0x189b('0x5e'),'destroy',{'module':_0x189b('0x5f')});}else if(_0x717201[_0x189b('0x47')][_0x189b('0x57')]()==_0x189b('0x60')){var _0xb923e7=fs[_0x189b('0x68')](path[_0x189b('0x61')](config[_0x189b('0x59')],_0x189b('0x62')),_0x189b('0x5b'));var _0x105e07=ejs[_0x189b('0x63')](_0xb923e7,{'networks':_0x4fb779||[]});fs[_0x189b('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x105e07);return respondWithRpcPromise(_0x189b('0x5e'),_0x189b('0x6a'),{'module':_0x189b('0x5f')});}else{var _0x5db76e=fs['readFileSync'](path['join'](config[_0x189b('0x59')],_0x189b('0x64')),_0x189b('0x5b'));var _0xb121ff=ejs[_0x189b('0x63')](_0x5db76e,{'networks':_0x4fb779||[]});fs['writeFileSync'](util[_0x189b('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x21d8b7[_0x189b('0x56')][_0x189b('0x47')][_0x189b('0x66')]()),_0xb121ff);return respondWithRpcPromise(_0x189b('0x5e'),'destroy',{'module':_0x189b('0x67')});}return null;})[_0x189b('0x27')](handleError(_0xaeb9b1,null));}; \ No newline at end of file +var _0x86db=['where','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','length','include','find','create','sequelize','transaction','body','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','destroy','stack','name','index','map','Network','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','nolimit','limit','order','sort','pick','filter','merge'];(function(_0x587830,_0x84fe44){var _0x2ea43e=function(_0x45f7f2){while(--_0x45f7f2){_0x587830['push'](_0x587830['shift']());}};_0x2ea43e(++_0x84fe44);}(_0x86db,0xf4));var _0xb86d=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0x86db[_0x3252b1];return _0x5f189d;};'use strict';var emlformat=require(_0xb86d('0x0'));var rimraf=require(_0xb86d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb86d('0x2'));var rp=require(_0xb86d('0x3'));var moment=require(_0xb86d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb86d('0x5'));var path=require(_0xb86d('0x6'));var sox=require(_0xb86d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb86d('0x8'));var _=require(_0xb86d('0x9'));var squel=require(_0xb86d('0xa'));var crypto=require(_0xb86d('0xb'));var jsforce=require(_0xb86d('0xc'));var deskjs=require(_0xb86d('0xd'));var toCsv=require(_0xb86d('0xe'));var querystring=require(_0xb86d('0xf'));var Papa=require(_0xb86d('0x10'));var Redis=require(_0xb86d('0x11'));var authService=require(_0xb86d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb86d('0x13'));var logger=require('../../config/logger')(_0xb86d('0x14'));var utils=require(_0xb86d('0x15'));var config=require(_0xb86d('0x16'));var licenseUtil=require(_0xb86d('0x17'));var db=require(_0xb86d('0x18'))['db'];var jayson=require(_0xb86d('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x570d2f,_0x56ae1a,_0x7c1762,_0x1fe65c){return new BPromise(function(_0x4dd991,_0x135d70){var _0x4bf04d=_0x1fe65c||client;return _0x4bf04d['request'](_0x570d2f,_0x7c1762)[_0xb86d('0x1a')](function(_0x17700b){logger[_0xb86d('0x1b')](_0xb86d('0x1c'),_0x56ae1a,_0xb86d('0x1d'));logger[_0xb86d('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x56ae1a,_0xb86d('0x1d'),JSON[_0xb86d('0x1f')](_0x17700b));if(_0x17700b[_0xb86d('0x20')]){if(_0x17700b[_0xb86d('0x20')][_0xb86d('0x21')]===0x1f4){logger[_0xb86d('0x20')](_0xb86d('0x1c'),_0x56ae1a,_0x17700b[_0xb86d('0x20')]['message']);return _0x135d70(_0x17700b[_0xb86d('0x20')][_0xb86d('0x22')]);}logger['error'](_0xb86d('0x1c'),_0x56ae1a,_0x17700b['error'][_0xb86d('0x22')]);return _0x4dd991(_0x17700b[_0xb86d('0x20')]['message']);}else{logger[_0xb86d('0x1b')](_0xb86d('0x1c'),_0x56ae1a,'request\x20sent');_0x4dd991(_0x17700b[_0xb86d('0x23')][_0xb86d('0x22')]);}})[_0xb86d('0x24')](function(_0x31a476){logger[_0xb86d('0x20')](_0xb86d('0x1c'),_0x56ae1a,_0x31a476);_0x135d70(_0x31a476);});});}function respondWithStatusCode(_0x3a6887,_0x14bfd4){_0x14bfd4=_0x14bfd4||0xcc;return function(_0x428a98){if(_0x428a98){return _0x3a6887[_0xb86d('0x25')](_0x14bfd4);}return _0x3a6887[_0xb86d('0x26')](_0x14bfd4)[_0xb86d('0x27')]();};}function respondWithResult(_0x5e0f3d,_0x3f770f){_0x3f770f=_0x3f770f||0xc8;return function(_0x1b8d45){if(_0x1b8d45){return _0x5e0f3d['status'](_0x3f770f)[_0xb86d('0x28')](_0x1b8d45);}};}function respondWithFilteredResult(_0x5109a2,_0xa50259){return function(_0x36b061){if(_0x36b061){var _0x232c90=typeof _0xa50259[_0xb86d('0x29')]===_0xb86d('0x2a')&&typeof _0xa50259['limit']===_0xb86d('0x2a');var _0x1f6b4d=_0x36b061[_0xb86d('0x2b')];var _0x244e4d=_0x232c90?0x0:_0xa50259['offset'];var _0x3a0960=_0x232c90?_0x36b061[_0xb86d('0x2b')]:_0xa50259['offset']+_0xa50259['limit'];var _0x4ee8e9;if(_0x3a0960>=_0x1f6b4d){_0x3a0960=_0x1f6b4d;_0x4ee8e9=0xc8;}else{_0x4ee8e9=0xce;}_0x5109a2[_0xb86d('0x26')](_0x4ee8e9);return _0x5109a2['set'](_0xb86d('0x2c'),_0x244e4d+'-'+_0x3a0960+'/'+_0x1f6b4d)[_0xb86d('0x28')](_0x36b061);}return null;};}function patchUpdates(_0xe97cef){return function(_0x53cff2){try{jsonpatch[_0xb86d('0x2d')](_0x53cff2,_0xe97cef,!![]);}catch(_0x3b319d){return BPromise['reject'](_0x3b319d);}return _0x53cff2['save']();};}function saveUpdates(_0x2390a9,_0x14a0a3){return function(_0x352e34){if(_0x352e34){return _0x352e34['update'](_0x2390a9)[_0xb86d('0x1a')](function(_0x8bec2c){return _0x8bec2c;});}return null;};}function removeEntity(_0x49466e,_0x559dd4){return function(_0x16cb61){if(_0x16cb61){return _0x16cb61[_0xb86d('0x2e')]()[_0xb86d('0x1a')](function(){_0x49466e[_0xb86d('0x26')](0xcc)[_0xb86d('0x27')]();});}};}function handleEntityNotFound(_0x4d43cd,_0x57d1ca){return function(_0x314341){if(!_0x314341){_0x4d43cd[_0xb86d('0x25')](0x194);}return _0x314341;};}function handleError(_0x26cc04,_0x1c83b4){_0x1c83b4=_0x1c83b4||0x1f4;return function(_0x35671d){logger[_0xb86d('0x20')](_0x35671d[_0xb86d('0x2f')]);if(_0x35671d[_0xb86d('0x30')]){delete _0x35671d[_0xb86d('0x30')];}_0x26cc04['status'](_0x1c83b4)['send'](_0x35671d);};}exports[_0xb86d('0x31')]=function(_0x55aa0c,_0x49ec5e){var _0x1d2cf7={},_0xbaa31={},_0x542dfa={'count':0x0,'rows':[]};var _0x184bec=_[_0xb86d('0x32')](db[_0xb86d('0x33')][_0xb86d('0x34')],function(_0x33933e){return{'name':_0x33933e[_0xb86d('0x35')],'type':_0x33933e[_0xb86d('0x36')]['key']};});_0xbaa31['model']=_['map'](_0x184bec,_0xb86d('0x30'));_0xbaa31[_0xb86d('0x37')]=_[_0xb86d('0x38')](_0x55aa0c['query']);_0xbaa31[_0xb86d('0x39')]=_[_0xb86d('0x3a')](_0xbaa31[_0xb86d('0x3b')],_0xbaa31['query']);_0x1d2cf7[_0xb86d('0x3c')]=_[_0xb86d('0x3a')](_0xbaa31[_0xb86d('0x3b')],qs['fields'](_0x55aa0c[_0xb86d('0x37')]['fields']));_0x1d2cf7[_0xb86d('0x3c')]=_0x1d2cf7[_0xb86d('0x3c')]['length']?_0x1d2cf7[_0xb86d('0x3c')]:_0xbaa31[_0xb86d('0x3b')];if(!_0x55aa0c[_0xb86d('0x37')]['hasOwnProperty'](_0xb86d('0x3d'))){_0x1d2cf7[_0xb86d('0x3e')]=qs[_0xb86d('0x3e')](_0x55aa0c[_0xb86d('0x37')][_0xb86d('0x3e')]);_0x1d2cf7[_0xb86d('0x29')]=qs[_0xb86d('0x29')](_0x55aa0c[_0xb86d('0x37')][_0xb86d('0x29')]);}_0x1d2cf7[_0xb86d('0x3f')]=qs[_0xb86d('0x40')](_0x55aa0c['query'][_0xb86d('0x40')]);_0x1d2cf7['where']=qs[_0xb86d('0x39')](_[_0xb86d('0x41')](_0x55aa0c[_0xb86d('0x37')],_0xbaa31[_0xb86d('0x39')]),_0x184bec);if(_0x55aa0c[_0xb86d('0x37')][_0xb86d('0x42')]){_0x1d2cf7['where']=_[_0xb86d('0x43')](_0x1d2cf7[_0xb86d('0x44')],{'$or':_['map'](_0x184bec,function(_0x44a215){if(_0x44a215['type']!==_0xb86d('0x45')){var _0x1005a1={};_0x1005a1[_0x44a215[_0xb86d('0x30')]]={'$like':'%'+_0x55aa0c[_0xb86d('0x37')]['filter']+'%'};return _0x1005a1;}})});}_0x1d2cf7=_[_0xb86d('0x43')]({},_0x1d2cf7,_0x55aa0c[_0xb86d('0x46')]);var _0xde14d4={'where':_0x1d2cf7['where']};return db['Network'][_0xb86d('0x2b')](_0xde14d4)[_0xb86d('0x1a')](function(_0x211f66){_0x542dfa['count']=_0x211f66;if(_0x55aa0c['query'][_0xb86d('0x47')]){_0x1d2cf7['include']=[{'all':!![]}];}return db[_0xb86d('0x33')][_0xb86d('0x48')](_0x1d2cf7);})[_0xb86d('0x1a')](function(_0x3b82ac){_0x542dfa[_0xb86d('0x49')]=_0x3b82ac;return _0x542dfa;})[_0xb86d('0x1a')](respondWithFilteredResult(_0x49ec5e,_0x1d2cf7))[_0xb86d('0x24')](handleError(_0x49ec5e,null));};exports[_0xb86d('0x4a')]=function(_0x53b1c9,_0x5ab2ea){var _0x2f637d={'raw':!![],'where':{'id':_0x53b1c9[_0xb86d('0x4b')]['id']}},_0x4ba903={};_0x4ba903[_0xb86d('0x3b')]=_[_0xb86d('0x38')](db[_0xb86d('0x33')][_0xb86d('0x34')]);_0x4ba903[_0xb86d('0x37')]=_['keys'](_0x53b1c9[_0xb86d('0x37')]);_0x4ba903[_0xb86d('0x39')]=_['intersection'](_0x4ba903[_0xb86d('0x3b')],_0x4ba903[_0xb86d('0x37')]);_0x2f637d['attributes']=_[_0xb86d('0x3a')](_0x4ba903[_0xb86d('0x3b')],qs[_0xb86d('0x4c')](_0x53b1c9[_0xb86d('0x37')]['fields']));_0x2f637d[_0xb86d('0x3c')]=_0x2f637d[_0xb86d('0x3c')][_0xb86d('0x4d')]?_0x2f637d[_0xb86d('0x3c')]:_0x4ba903[_0xb86d('0x3b')];if(_0x53b1c9[_0xb86d('0x37')][_0xb86d('0x47')]){_0x2f637d[_0xb86d('0x4e')]=[{'all':!![]}];}_0x2f637d=_[_0xb86d('0x43')]({},_0x2f637d,_0x53b1c9[_0xb86d('0x46')]);return db[_0xb86d('0x33')][_0xb86d('0x4f')](_0x2f637d)[_0xb86d('0x1a')](handleEntityNotFound(_0x5ab2ea,null))[_0xb86d('0x1a')](respondWithResult(_0x5ab2ea,null))['catch'](handleError(_0x5ab2ea,null));};exports[_0xb86d('0x50')]=function(_0x4fb79e,_0x305499,_0x11f445){var _0xcabf27;return db[_0xb86d('0x51')][_0xb86d('0x52')](function(_0x442091){return db['Network']['create'](_0x4fb79e[_0xb86d('0x53')],{'raw':!![]})[_0xb86d('0x1a')](function(_0x42111b){_0xcabf27=_0x42111b;return db[_0xb86d('0x33')][_0xb86d('0x48')]({'where':{'type':_0x4fb79e[_0xb86d('0x53')][_0xb86d('0x36')]},'raw':!![]});})['then'](function(_0x876729){if(_0xcabf27[_0xb86d('0x36')]['toUpperCase']()==_0xb86d('0x54')){var _0x2bcf16=fs[_0xb86d('0x55')](path[_0xb86d('0x56')](config[_0xb86d('0x57')],'server/files/templates/stun_multiple.ejs'),_0xb86d('0x58'));var _0x31894e=ejs[_0xb86d('0x59')](_0x2bcf16,{'networks':_0x876729||[]});fs[_0xb86d('0x5a')](_0xb86d('0x5b'),_0x31894e);return respondWithRpcPromise(_0xb86d('0x5c'),_0xb86d('0x50'),{'module':_0xb86d('0x5d')});}else if(_0xcabf27['type'][_0xb86d('0x5e')]()==_0xb86d('0x5f')){var _0x166eba=fs[_0xb86d('0x55')](path[_0xb86d('0x56')](config[_0xb86d('0x57')],_0xb86d('0x60')),_0xb86d('0x58'));var _0x30f7e9=ejs['render'](_0x166eba,{'networks':_0x876729||[]});fs['writeFileSync'](_0xb86d('0x61'),_0x30f7e9);return respondWithRpcPromise('Reload','create',{'module':_0xb86d('0x5d')});}else{var _0x526b6f=fs['readFileSync'](path['join'](config[_0xb86d('0x57')],_0xb86d('0x62')),_0xb86d('0x58'));var _0x3462d8=ejs[_0xb86d('0x59')](_0x526b6f,{'networks':_0x876729||[]});fs[_0xb86d('0x5a')](util[_0xb86d('0x63')](_0xb86d('0x64'),_0x4fb79e[_0xb86d('0x53')][_0xb86d('0x36')][_0xb86d('0x65')]()),_0x3462d8);return respondWithRpcPromise(_0xb86d('0x5c'),_0xb86d('0x50'),{'module':_0xb86d('0x66')});}return null;})[_0xb86d('0x1a')](function(){return _0xcabf27;});})[_0xb86d('0x1a')](respondWithResult(_0x305499,0xc9))[_0xb86d('0x24')](handleError(_0x305499,null));};exports[_0xb86d('0x67')]=function(_0xfde326,_0x271cde,_0xb29aa6){var _0x239718;return db[_0xb86d('0x51')][_0xb86d('0x52')](function(_0x39f888){return db[_0xb86d('0x33')][_0xb86d('0x4f')]({'where':{'id':_0xfde326[_0xb86d('0x4b')]['id']}})[_0xb86d('0x1a')](handleEntityNotFound(_0x271cde,null))[_0xb86d('0x1a')](saveUpdates(_0xfde326[_0xb86d('0x53')],null))[_0xb86d('0x1a')](function(_0x41ee3b){if(_0x41ee3b){_0x239718=_0x41ee3b;return db[_0xb86d('0x33')][_0xb86d('0x48')]({'where':{'type':_0x239718['type']},'raw':!![]});}return null;})[_0xb86d('0x1a')](function(_0x11484e){if(_0x239718['type'][_0xb86d('0x5e')]()==_0xb86d('0x54')){var _0x286ed8=fs[_0xb86d('0x55')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2a0300=ejs[_0xb86d('0x59')](_0x286ed8,{'networks':_0x11484e||[]});fs['writeFileSync'](_0xb86d('0x5b'),_0x2a0300);return respondWithRpcPromise('Reload',_0xb86d('0x67'),{'module':_0xb86d('0x5d')});}else if(_0x239718[_0xb86d('0x36')]['toUpperCase']()==_0xb86d('0x5f')){var _0x132fa0=fs[_0xb86d('0x55')](path[_0xb86d('0x56')](config[_0xb86d('0x57')],_0xb86d('0x60')),_0xb86d('0x58'));var _0x1cf211=ejs['render'](_0x132fa0,{'networks':_0x11484e||[]});fs[_0xb86d('0x5a')](_0xb86d('0x61'),_0x1cf211);return respondWithRpcPromise(_0xb86d('0x5c'),'update',{'module':_0xb86d('0x5d')});}else{var _0x4e8092=fs[_0xb86d('0x55')](path['join'](config[_0xb86d('0x57')],_0xb86d('0x62')),_0xb86d('0x58'));var _0x3eefb0=ejs[_0xb86d('0x59')](_0x4e8092,{'networks':_0x11484e||[]});fs[_0xb86d('0x5a')](util[_0xb86d('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0xfde326[_0xb86d('0x53')][_0xb86d('0x36')][_0xb86d('0x65')]()),_0x3eefb0);return respondWithRpcPromise(_0xb86d('0x5c'),'update',{'module':'chan_sip.so'});}return null;})[_0xb86d('0x1a')](function(_0x1694ec){if(_0x1694ec){return _0x239718;}return null;});})['then'](respondWithResult(_0x271cde,null))[_0xb86d('0x24')](handleError(_0x271cde,null));};exports[_0xb86d('0x2e')]=function(_0x2a720f,_0x5013e5,_0x487a45){var _0x1d7eba;return db['Network']['find']({'where':{'id':_0x2a720f['params']['id']}})[_0xb86d('0x1a')](function(_0x3a2a4a){_0x1d7eba=_0x3a2a4a;return _0x3a2a4a;})[_0xb86d('0x1a')](handleEntityNotFound(_0x5013e5,null))['then'](removeEntity(_0x5013e5,null))[_0xb86d('0x1a')](function(){if(_0x1d7eba){return db[_0xb86d('0x33')]['findAll']({'where':{'type':_0x1d7eba[_0xb86d('0x36')]},'raw':!![]});}})[_0xb86d('0x1a')](function(_0x21153f){if(_0x1d7eba['type'][_0xb86d('0x5e')]()==_0xb86d('0x54')){var _0x532bfc=fs[_0xb86d('0x55')](path[_0xb86d('0x56')](config[_0xb86d('0x57')],'server/files/templates/stun_multiple.ejs'),_0xb86d('0x58'));var _0x17a875=ejs['render'](_0x532bfc,{'networks':_0x21153f||[]});fs['writeFileSync'](_0xb86d('0x5b'),_0x17a875);return respondWithRpcPromise(_0xb86d('0x5c'),_0xb86d('0x2e'),{'module':_0xb86d('0x5d')});}else if(_0x1d7eba[_0xb86d('0x36')][_0xb86d('0x5e')]()=='TURN'){var _0x2c979b=fs[_0xb86d('0x55')](path[_0xb86d('0x56')](config[_0xb86d('0x57')],_0xb86d('0x60')),'utf8');var _0x2db9bb=ejs['render'](_0x2c979b,{'networks':_0x21153f||[]});fs[_0xb86d('0x5a')](_0xb86d('0x61'),_0x2db9bb);return respondWithRpcPromise(_0xb86d('0x5c'),_0xb86d('0x2e'),{'module':_0xb86d('0x5d')});}else{var _0x55f011=fs['readFileSync'](path[_0xb86d('0x56')](config[_0xb86d('0x57')],_0xb86d('0x62')),_0xb86d('0x58'));var _0x4b4ea2=ejs['render'](_0x55f011,{'networks':_0x21153f||[]});fs[_0xb86d('0x5a')](util['format'](_0xb86d('0x64'),_0x2a720f[_0xb86d('0x53')][_0xb86d('0x36')][_0xb86d('0x65')]()),_0x4b4ea2);return respondWithRpcPromise(_0xb86d('0x5c'),_0xb86d('0x2e'),{'module':_0xb86d('0x66')});}return null;})[_0xb86d('0x24')](handleError(_0x5013e5,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 473ed5e..19306a1 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 _0xbec5=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','api','moment','bluebird'];(function(_0x538741,_0x225f5c){var _0x2a35c5=function(_0x1b3478){while(--_0x1b3478){_0x538741['push'](_0x538741['shift']());}};_0x2a35c5(++_0x225f5c);}(_0xbec5,0xe5));var _0x5bec=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xbec5[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd382=['request-promise','path','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x10378d,_0x28a330){_0x10378d=_0x10378d-0x0;var _0x436326=_0xd382[_0x10378d];return _0x436326;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('Network',attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 5b1cfb1..176567e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x456952,_0x5b09be){var _0x6e0c2a=function(_0x3b1050){while(--_0x3b1050){_0x456952['push'](_0x456952['shift']());}};_0x6e0c2a(++_0x5b09be);}(_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 +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x57e0e0,_0x30adf4){_0x57e0e0=_0x57e0e0-0x0;var _0x19d8f3=_0x7a54[_0x57e0e0];return _0x19d8f3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f29ddb1..37f9c32 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 _0x60d3=['getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','addApplications','addAgents','send','put','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications'];(function(_0x434760,_0x428499){var _0x22c48e=function(_0x588397){while(--_0x588397){_0x434760['push'](_0x434760['shift']());}};_0x22c48e(++_0x428499);}(_0x60d3,0x19a));var _0x360d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x60d3[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x360d('0x0'));var util=require(_0x360d('0x1'));var path=require(_0x360d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x360d('0x3')]();var fs_extra=require(_0x360d('0x4'));var auth=require(_0x360d('0x5'));var interaction=require(_0x360d('0x6'));var config=require(_0x360d('0x7'));var controller=require(_0x360d('0x8'));router['get']('/',auth[_0x360d('0x9')](),controller[_0x360d('0xa')]);router[_0x360d('0xb')](_0x360d('0xc'),auth[_0x360d('0x9')](),controller[_0x360d('0xd')]);router[_0x360d('0xb')](_0x360d('0xe'),auth[_0x360d('0x9')](),controller[_0x360d('0xf')]);router['get'](_0x360d('0x10'),auth[_0x360d('0x9')](),controller[_0x360d('0x11')]);router[_0x360d('0xb')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x360d('0xb')](_0x360d('0x12'),auth[_0x360d('0x9')](),controller[_0x360d('0x13')]);router[_0x360d('0xb')](_0x360d('0x14'),auth['isAuthenticated'](),controller[_0x360d('0x15')]);router[_0x360d('0xb')](_0x360d('0x16'),auth[_0x360d('0x9')](),controller[_0x360d('0x17')]);router[_0x360d('0x18')]('/',auth[_0x360d('0x9')](),controller[_0x360d('0x19')]);router[_0x360d('0x18')](_0x360d('0x10'),auth[_0x360d('0x9')](),controller['addDisposition']);router[_0x360d('0x18')](_0x360d('0x1a'),auth['isAuthenticated'](),controller[_0x360d('0x1b')]);router[_0x360d('0x18')](_0x360d('0x1c'),controller['notify']);router[_0x360d('0x18')]('/:id/applications',auth[_0x360d('0x9')](),controller[_0x360d('0x1d')]);router['post'](_0x360d('0x16'),auth['isAuthenticated'](),controller[_0x360d('0x1e')]);router['post']('/:id/send',auth[_0x360d('0x9')](),controller[_0x360d('0x1f')]);router[_0x360d('0x20')](_0x360d('0xe'),auth[_0x360d('0x9')](),controller['update']);router['delete'](_0x360d('0xe'),auth[_0x360d('0x9')](),controller[_0x360d('0x21')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x360d('0x22')]);router[_0x360d('0x23')](_0x360d('0x1a'),auth[_0x360d('0x9')](),controller[_0x360d('0x24')]);router[_0x360d('0x23')]('/:id/users',auth[_0x360d('0x9')](),controller[_0x360d('0x25')]);module[_0x360d('0x26')]=router; \ No newline at end of file +var _0x4c16=['/:id/users','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4c16,0x113));var _0x64c1=function(_0x5d6392,_0x271a01){_0x5d6392=_0x5d6392-0x0;var _0x5808ab=_0x4c16[_0x5d6392];return _0x5808ab;};'use strict';var multer=require(_0x64c1('0x0'));var util=require('util');var path=require(_0x64c1('0x1'));var timeout=require(_0x64c1('0x2'));var express=require(_0x64c1('0x3'));var router=express[_0x64c1('0x4')]();var fs_extra=require(_0x64c1('0x5'));var auth=require(_0x64c1('0x6'));var interaction=require(_0x64c1('0x7'));var config=require('../../config/environment');var controller=require(_0x64c1('0x8'));router[_0x64c1('0x9')]('/',auth[_0x64c1('0xa')](),controller[_0x64c1('0xb')]);router[_0x64c1('0x9')](_0x64c1('0xc'),auth['isAuthenticated'](),controller[_0x64c1('0xd')]);router[_0x64c1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x64c1('0xe')]);router[_0x64c1('0x9')]('/:id/dispositions',auth[_0x64c1('0xa')](),controller['getDispositions']);router[_0x64c1('0x9')](_0x64c1('0xf'),auth[_0x64c1('0xa')](),controller['getAnswers']);router[_0x64c1('0x9')](_0x64c1('0x10'),auth[_0x64c1('0xa')](),controller[_0x64c1('0x11')]);router[_0x64c1('0x9')](_0x64c1('0x12'),auth['isAuthenticated'](),controller[_0x64c1('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x64c1('0x14')]);router[_0x64c1('0x15')]('/',auth[_0x64c1('0xa')](),controller[_0x64c1('0x16')]);router['post'](_0x64c1('0x17'),auth[_0x64c1('0xa')](),controller[_0x64c1('0x18')]);router['post'](_0x64c1('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x64c1('0x15')](_0x64c1('0x19'),controller[_0x64c1('0x1a')]);router[_0x64c1('0x15')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x64c1('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x64c1('0x1b')]);router[_0x64c1('0x15')](_0x64c1('0x1c'),auth[_0x64c1('0xa')](),controller[_0x64c1('0x1d')]);router[_0x64c1('0x1e')](_0x64c1('0x1f'),auth[_0x64c1('0xa')](),controller[_0x64c1('0x20')]);router[_0x64c1('0x21')](_0x64c1('0x1f'),auth['isAuthenticated'](),controller[_0x64c1('0x22')]);router[_0x64c1('0x21')]('/:id/dispositions',auth[_0x64c1('0xa')](),controller[_0x64c1('0x23')]);router[_0x64c1('0x21')]('/:id/canned_answers',auth[_0x64c1('0xa')](),controller[_0x64c1('0x24')]);router[_0x64c1('0x21')](_0x64c1('0x25'),auth[_0x64c1('0xa')](),controller['removeAgents']);module[_0x64c1('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b53c325..fa61596 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 _0xaf45=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate'];(function(_0x4240c8,_0x4e2c4b){var _0x32932b=function(_0x202803){while(--_0x202803){_0x4240c8['push'](_0x4240c8['shift']());}};_0x32932b(++_0x4e2c4b);}(_0xaf45,0x124));var _0x5af4=function(_0x1cb581,_0x58507b){_0x1cb581=_0x1cb581-0x0;var _0xbd2a2=_0xaf45[_0x1cb581];return _0xbd2a2;};'use strict';var Sequelize=require(_0x5af4('0x0'));var rs=require('randomstring');module[_0x5af4('0x1')]={'name':{'type':Sequelize[_0x5af4('0x2')],'unique':_0x5af4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5af4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5af4('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5af4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5af4('0x5');}},'notificationSound':{'type':Sequelize[_0x5af4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5af4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5af4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5af4('0x2')]},'queueTransfer':{'type':Sequelize[_0x5af4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5af4('0x7')],'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[_0x5af4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5af4('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3b2cb6){if(!_0x3b2cb6)this[_0x5af4('0x9')](_0x5af4('0xa'),null);this[_0x5af4('0x9')]('mandatoryDisposition',_0x3b2cb6);}}}; \ No newline at end of file +var _0x5eb9=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x3cd774,_0x1c01b1){var _0x1f4922=function(_0x35eccb){while(--_0x35eccb){_0x3cd774['push'](_0x3cd774['shift']());}};_0x1f4922(++_0x1c01b1);}(_0x5eb9,0x6f));var _0x95eb=function(_0x3cc81e,_0x435f44){_0x3cc81e=_0x3cc81e-0x0;var _0x5b15e3=_0x5eb9[_0x3cc81e];return _0x5b15e3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x95eb('0x0'));module[_0x95eb('0x1')]={'name':{'type':Sequelize[_0x95eb('0x2')],'unique':_0x95eb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x95eb('0x2')]},'token':{'type':Sequelize[_0x95eb('0x2')],'defaultValue':function(){return rs[_0x95eb('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x95eb('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x95eb('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x95eb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x95eb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x95eb('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x95eb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x95eb('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x95eb('0x9'),'set':function(_0x9d7ab8){if(!_0x9d7ab8)this[_0x95eb('0xa')](_0x95eb('0xb'),null);this[_0x95eb('0xa')](_0x95eb('0xc'),_0x9d7ab8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f028d42..918cedd 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 _0x3117=['describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','CannedAnswer','getAnswers','order','removeAnswers','ids','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','Contacts','ListId','CmContact','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','*,*,*,*','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','count','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x558b1e,_0x5ebf0d){var _0x418ba8=function(_0xef056a){while(--_0xef056a){_0x558b1e['push'](_0x558b1e['shift']());}};_0x418ba8(++_0x5ebf0d);}(_0x3117,0x1dd));var _0x7311=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x3117[_0x5e4563];return _0x8d1bf5;};'use strict';var emlformat=require(_0x7311('0x0'));var rimraf=require(_0x7311('0x1'));var zipdir=require(_0x7311('0x2'));var jsonpatch=require(_0x7311('0x3'));var rp=require(_0x7311('0x4'));var moment=require(_0x7311('0x5'));var BPromise=require(_0x7311('0x6'));var Mustache=require(_0x7311('0x7'));var util=require(_0x7311('0x8'));var path=require(_0x7311('0x9'));var sox=require('sox');var csv=require(_0x7311('0xa'));var ejs=require(_0x7311('0xb'));var fs=require('fs');var fs_extra=require(_0x7311('0xc'));var _=require(_0x7311('0xd'));var squel=require(_0x7311('0xe'));var crypto=require(_0x7311('0xf'));var jsforce=require(_0x7311('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7311('0x11'));var Redis=require(_0x7311('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7311('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7311('0x14'))(_0x7311('0x15'));var utils=require(_0x7311('0x16'));var config=require(_0x7311('0x17'));var licenseUtil=require(_0x7311('0x18'));var db=require('../../mysqldb')['db'];config[_0x7311('0x19')]=_[_0x7311('0x1a')](config[_0x7311('0x19')],{'host':_0x7311('0x1b'),'port':0x18eb});var socket=require(_0x7311('0x1c'))(new Redis(config[_0x7311('0x19')]));require(_0x7311('0x1d'))[_0x7311('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7311('0x1f')]({'port':0x232c});var client9002=jayson[_0x7311('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ba37,_0x53e45c,_0x566124,_0x599dd4){return new BPromise(function(_0xc9e5cf,_0x20d19c){var _0x38269e=_0x599dd4||client;return _0x38269e[_0x7311('0x21')](_0x13ba37,_0x566124)[_0x7311('0x22')](function(_0x34ae03){logger[_0x7311('0x23')](_0x7311('0x24'),_0x53e45c,'request\x20sent');logger[_0x7311('0x25')](_0x7311('0x26'),_0x53e45c,'request\x20sent',JSON[_0x7311('0x27')](_0x34ae03));if(_0x34ae03[_0x7311('0x28')]){if(_0x34ae03[_0x7311('0x28')][_0x7311('0x29')]===0x1f4){logger[_0x7311('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x53e45c,_0x34ae03['error'][_0x7311('0x2a')]);return _0x20d19c(_0x34ae03[_0x7311('0x28')]['message']);}logger[_0x7311('0x28')](_0x7311('0x24'),_0x53e45c,_0x34ae03['error']['message']);return _0xc9e5cf(_0x34ae03[_0x7311('0x28')][_0x7311('0x2a')]);}else{logger[_0x7311('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x53e45c,'request\x20sent');_0xc9e5cf(_0x34ae03[_0x7311('0x2b')][_0x7311('0x2a')]);}})['catch'](function(_0x4435d1){logger[_0x7311('0x28')](_0x7311('0x24'),_0x53e45c,_0x4435d1);_0x20d19c(_0x4435d1);});});}function respondWithStatusCode(_0x4351bf,_0x4daa7d){_0x4daa7d=_0x4daa7d||0xcc;return function(_0x4bfe92){if(_0x4bfe92){return _0x4351bf[_0x7311('0x2c')](_0x4daa7d);}return _0x4351bf[_0x7311('0x2d')](_0x4daa7d)[_0x7311('0x2e')]();};}function respondWithResult(_0x38bcd6,_0x4ad91c){_0x4ad91c=_0x4ad91c||0xc8;return function(_0x3b771b){if(_0x3b771b){return _0x38bcd6[_0x7311('0x2d')](_0x4ad91c)[_0x7311('0x2f')](_0x3b771b);}};}function respondWithFilteredResult(_0x3729b5,_0x154aec){return function(_0x406f6a){if(_0x406f6a){var _0x5273aa=typeof _0x154aec[_0x7311('0x30')]===_0x7311('0x31')&&typeof _0x154aec[_0x7311('0x32')]===_0x7311('0x31');var _0x3c8808=_0x406f6a['count'];var _0x4622a4=_0x5273aa?0x0:_0x154aec[_0x7311('0x30')];var _0x350e5b=_0x5273aa?_0x406f6a['count']:_0x154aec[_0x7311('0x30')]+_0x154aec[_0x7311('0x32')];var _0x5ebee2;if(_0x350e5b>=_0x3c8808){_0x350e5b=_0x3c8808;_0x5ebee2=0xc8;}else{_0x5ebee2=0xce;}_0x3729b5[_0x7311('0x2d')](_0x5ebee2);return _0x3729b5[_0x7311('0x33')](_0x7311('0x34'),_0x4622a4+'-'+_0x350e5b+'/'+_0x3c8808)[_0x7311('0x2f')](_0x406f6a);}return null;};}function patchUpdates(_0x4047de){return function(_0x27cb5d){try{jsonpatch[_0x7311('0x35')](_0x27cb5d,_0x4047de,!![]);}catch(_0x3b963c){return BPromise[_0x7311('0x36')](_0x3b963c);}return _0x27cb5d[_0x7311('0x37')]();};}function saveUpdates(_0x14b982,_0x2e09d2){return function(_0x35b241){if(_0x35b241){return _0x35b241[_0x7311('0x38')](_0x14b982)[_0x7311('0x22')](function(_0x182b0d){return _0x182b0d;});}return null;};}function removeEntity(_0x101397,_0x49a6b7){return function(_0x100b83){if(_0x100b83){return _0x100b83['destroy']()[_0x7311('0x22')](function(){var _0x5710c0=_0x100b83[_0x7311('0x39')]({'plain':!![]});var _0x98e961=_0x7311('0x3a');return db[_0x7311('0x3b')][_0x7311('0x3c')]({'where':{'type':_0x98e961,'resourceId':_0x5710c0['id']}})['then'](function(){return _0x100b83;});})[_0x7311('0x22')](function(){_0x101397[_0x7311('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445930,_0x1ee4fe){return function(_0x44b3ce){if(!_0x44b3ce){_0x445930[_0x7311('0x2c')](0x194);}return _0x44b3ce;};}function handleError(_0x3fecb3,_0x3dc9e2){_0x3dc9e2=_0x3dc9e2||0x1f4;return function(_0xefedc2){logger[_0x7311('0x28')](_0xefedc2[_0x7311('0x3d')]);if(_0xefedc2['name']){delete _0xefedc2[_0x7311('0x3e')];}_0x3fecb3[_0x7311('0x2d')](_0x3dc9e2)[_0x7311('0x3f')](_0xefedc2);};}exports[_0x7311('0x40')]=function(_0xf4dada,_0x32c9a3){var _0x42f7b8={'include':[{'model':db[_0x7311('0x41')],'as':_0x7311('0x42')}]},_0xdad2b2={},_0x329eff={'count':0x0,'rows':[]};var _0x1a6d08=_[_0x7311('0x43')](db['OpenchannelAccount'][_0x7311('0x44')],function(_0x43d315){return{'name':_0x43d315[_0x7311('0x45')],'type':_0x43d315[_0x7311('0x46')][_0x7311('0x47')]};});_0xdad2b2[_0x7311('0x48')]=_[_0x7311('0x43')](_0x1a6d08,_0x7311('0x3e'));_0xdad2b2[_0x7311('0x49')]=_[_0x7311('0x4a')](_0xf4dada[_0x7311('0x49')]);_0xdad2b2[_0x7311('0x4b')]=_[_0x7311('0x4c')](_0xdad2b2[_0x7311('0x48')],_0xdad2b2[_0x7311('0x49')]);_0x42f7b8[_0x7311('0x4d')]=_['intersection'](_0xdad2b2[_0x7311('0x48')],qs[_0x7311('0x4e')](_0xf4dada[_0x7311('0x49')][_0x7311('0x4e')]));_0x42f7b8['attributes']=_0x42f7b8[_0x7311('0x4d')][_0x7311('0x4f')]?_0x42f7b8['attributes']:_0xdad2b2[_0x7311('0x48')];if(!_0xf4dada[_0x7311('0x49')][_0x7311('0x50')](_0x7311('0x51'))){_0x42f7b8['limit']=qs['limit'](_0xf4dada['query'][_0x7311('0x32')]);_0x42f7b8[_0x7311('0x30')]=qs[_0x7311('0x30')](_0xf4dada['query']['offset']);}_0x42f7b8['order']=qs[_0x7311('0x52')](_0xf4dada[_0x7311('0x49')]['sort']);_0x42f7b8['where']=qs[_0x7311('0x4b')](_['pick'](_0xf4dada[_0x7311('0x49')],_0xdad2b2[_0x7311('0x4b')]),_0x1a6d08);if(_0xf4dada[_0x7311('0x49')][_0x7311('0x53')]){_0x42f7b8[_0x7311('0x54')]=_['merge'](_0x42f7b8[_0x7311('0x54')],{'$or':_[_0x7311('0x43')](_0x1a6d08,function(_0x56abe1){if(_0x56abe1[_0x7311('0x46')]!=='VIRTUAL'){var _0x1133ff={};_0x1133ff[_0x56abe1[_0x7311('0x3e')]]={'$like':'%'+_0xf4dada[_0x7311('0x49')][_0x7311('0x53')]+'%'};return _0x1133ff;}})});}_0x42f7b8=_[_0x7311('0x55')]({},_0x42f7b8,_0xf4dada[_0x7311('0x56')]);var _0x49ffbc={'where':_0x42f7b8[_0x7311('0x54')]};return db['OpenchannelAccount'][_0x7311('0x57')](_0x49ffbc)['then'](function(_0x12cfa7){_0x329eff[_0x7311('0x57')]=_0x12cfa7;if(_0xf4dada[_0x7311('0x49')][_0x7311('0x58')]){_0x42f7b8[_0x7311('0x59')]=[{'all':!![]}];}return db[_0x7311('0x5a')][_0x7311('0x5b')](_0x42f7b8);})[_0x7311('0x22')](function(_0x3e9624){_0x329eff[_0x7311('0x5c')]=_0x3e9624;return _0x329eff;})['then'](respondWithFilteredResult(_0x32c9a3,_0x42f7b8))[_0x7311('0x5d')](handleError(_0x32c9a3,null));};exports[_0x7311('0x5e')]=function(_0x25fd02,_0x4fabc7){var _0x52ce36={'raw':![],'where':{'id':_0x25fd02[_0x7311('0x5f')]['id']},'include':[{'model':db[_0x7311('0x41')],'as':_0x7311('0x42')}]},_0x162c06={};_0x162c06['model']=_[_0x7311('0x4a')](db[_0x7311('0x5a')][_0x7311('0x44')]);_0x162c06['query']=_[_0x7311('0x4a')](_0x25fd02[_0x7311('0x49')]);_0x162c06[_0x7311('0x4b')]=_[_0x7311('0x4c')](_0x162c06['model'],_0x162c06[_0x7311('0x49')]);_0x52ce36[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x162c06[_0x7311('0x48')],qs[_0x7311('0x4e')](_0x25fd02[_0x7311('0x49')][_0x7311('0x4e')]));_0x52ce36['attributes']=_0x52ce36[_0x7311('0x4d')]['length']?_0x52ce36[_0x7311('0x4d')]:_0x162c06[_0x7311('0x48')];if(_0x25fd02[_0x7311('0x49')]['includeAll']){_0x52ce36[_0x7311('0x59')]=[{'all':!![]}];}_0x52ce36=_[_0x7311('0x55')]({},_0x52ce36,_0x25fd02['options']);return db[_0x7311('0x5a')]['find'](_0x52ce36)[_0x7311('0x22')](handleEntityNotFound(_0x4fabc7,null))['then'](respondWithResult(_0x4fabc7,null))[_0x7311('0x5d')](handleError(_0x4fabc7,null));};exports[_0x7311('0x60')]=function(_0x18562c,_0x4994d8){return db[_0x7311('0x5a')]['create'](_0x18562c[_0x7311('0x61')],{})[_0x7311('0x22')](function(_0x400bca){var _0x3a8550=_0x18562c[_0x7311('0x62')][_0x7311('0x39')]({'plain':!![]});if(!_0x3a8550)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a8550[_0x7311('0x63')]==='user'){var _0x5da019=_0x400bca['get']({'plain':!![]});var _0x1ca09f=_0x7311('0x3a');return db[_0x7311('0x64')][_0x7311('0x65')]({'where':{'name':_0x1ca09f,'userProfileId':_0x3a8550[_0x7311('0x66')]},'raw':!![]})[_0x7311('0x22')](function(_0x340594){if(_0x340594&&_0x340594[_0x7311('0x67')]===0x0){return db[_0x7311('0x3b')][_0x7311('0x60')]({'name':_0x5da019['name'],'resourceId':_0x5da019['id'],'type':_0x340594[_0x7311('0x3e')],'sectionId':_0x340594['id']},{})[_0x7311('0x22')](function(){return _0x400bca;});}else{return _0x400bca;}})[_0x7311('0x5d')](function(_0x131cd1){logger[_0x7311('0x28')](_0x7311('0x68'),_0x131cd1);throw _0x131cd1;});}return _0x400bca;})[_0x7311('0x22')](respondWithResult(_0x4994d8,0xc9))[_0x7311('0x5d')](handleError(_0x4994d8,null));};exports[_0x7311('0x38')]=function(_0x4a1a6e,_0x3b9ceb){if(_0x4a1a6e[_0x7311('0x61')]['id']){delete _0x4a1a6e[_0x7311('0x61')]['id'];}return db['OpenchannelAccount'][_0x7311('0x65')]({'where':{'id':_0x4a1a6e[_0x7311('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x7311('0x42')}]})[_0x7311('0x22')](handleEntityNotFound(_0x3b9ceb,null))[_0x7311('0x22')](saveUpdates(_0x4a1a6e[_0x7311('0x61')],null))[_0x7311('0x22')](respondWithResult(_0x3b9ceb,null))[_0x7311('0x5d')](handleError(_0x3b9ceb,null));};exports['destroy']=function(_0x5ad00b,_0x2af167){return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x5ad00b[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x2af167,null))[_0x7311('0x22')](removeEntity(_0x2af167,null))[_0x7311('0x5d')](handleError(_0x2af167,null));};exports['describe']=function(_0x1c89e9,_0x55dca5){return db[_0x7311('0x5a')][_0x7311('0x69')]()[_0x7311('0x22')](respondWithResult(_0x55dca5,null))[_0x7311('0x5d')](handleError(_0x55dca5,null));};exports[_0x7311('0x6a')]=function(_0xe1d132,_0x51c0d8,_0x54c6b4){if(_0xe1d132[_0x7311('0x61')]['id']){delete _0xe1d132['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xe1d132['params']['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x51c0d8,null))[_0x7311('0x22')](function(_0x12634d){if(_0x12634d){_0xe1d132['body'][_0x7311('0x6b')]=_0x12634d['id'];return db[_0x7311('0x6c')]['create'](_0xe1d132['body']);}})[_0x7311('0x22')](respondWithResult(_0x51c0d8,null))[_0x7311('0x5d')](handleError(_0x51c0d8,null));};exports[_0x7311('0x6d')]=function(_0x2a2606,_0x20a27a,_0x527f74){var _0xa6e153={'raw':![],'where':{}};var _0x5da33f={};var _0x9174e0={'count':0x0,'rows':[]};return db[_0x7311('0x5a')][_0x7311('0x6e')]({'where':{'id':_0x2a2606[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x20a27a,null))[_0x7311('0x22')](function(_0x3cc857){if(_0x3cc857){_0x5da33f['model']=_[_0x7311('0x4a')](db[_0x7311('0x6c')]['rawAttributes']);_0x5da33f[_0x7311('0x49')]=_[_0x7311('0x4a')](_0x2a2606[_0x7311('0x49')]);_0x5da33f[_0x7311('0x4b')]=_[_0x7311('0x4c')](_0x5da33f[_0x7311('0x48')],_0x5da33f[_0x7311('0x49')]);_0xa6e153[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x5da33f[_0x7311('0x48')],qs['fields'](_0x2a2606[_0x7311('0x49')]['fields']));_0xa6e153[_0x7311('0x4d')]=_0xa6e153[_0x7311('0x4d')][_0x7311('0x4f')]?_0xa6e153[_0x7311('0x4d')]:_0x5da33f[_0x7311('0x48')];if(!_0x2a2606['query'][_0x7311('0x50')]('nolimit')){_0xa6e153[_0x7311('0x32')]=qs['limit'](_0x2a2606['query'][_0x7311('0x32')]);_0xa6e153[_0x7311('0x30')]=qs[_0x7311('0x30')](_0x2a2606[_0x7311('0x49')][_0x7311('0x30')]);}_0xa6e153['order']=qs[_0x7311('0x52')](_0x2a2606[_0x7311('0x49')][_0x7311('0x52')]);_0xa6e153[_0x7311('0x54')]=qs['filters'](_[_0x7311('0x6f')](_0x2a2606[_0x7311('0x49')],_0x5da33f[_0x7311('0x4b')]));_0xa6e153[_0x7311('0x54')]['OpenchannelAccountId']=_0x3cc857['id'];if(_0x2a2606['query']['filter']){_0xa6e153[_0x7311('0x54')]=_[_0x7311('0x55')](_0xa6e153['where'],{'$or':_[_0x7311('0x43')](_0xa6e153['attributes'],function(_0x5f3b5f){var _0x183f8c={};_0x183f8c[_0x5f3b5f]={'$like':'%'+_0x2a2606[_0x7311('0x49')]['filter']+'%'};return _0x183f8c;})});}_0xa6e153=_[_0x7311('0x55')]({},_0xa6e153,_0x2a2606['options']);return db['Disposition'][_0x7311('0x57')]({'where':_0xa6e153['where']})['then'](function(_0x54a787){_0x9174e0[_0x7311('0x57')]=_0x54a787;if(_0x2a2606[_0x7311('0x49')][_0x7311('0x58')]){_0xa6e153[_0x7311('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x7311('0x5b')](_0xa6e153);})['then'](function(_0x2ebd5d){_0x9174e0[_0x7311('0x5c')]=_0x2ebd5d;return _0x9174e0;});}})[_0x7311('0x22')](respondWithFilteredResult(_0x20a27a,_0xa6e153))[_0x7311('0x5d')](handleError(_0x20a27a,null));};exports[_0x7311('0x70')]=function(_0x147b11,_0x5520bf,_0x1e8840){return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x147b11[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x5520bf,null))[_0x7311('0x22')](function(_0x29328d){if(_0x29328d){return _0x29328d[_0x7311('0x70')](_0x147b11[_0x7311('0x49')]['ids']);}})[_0x7311('0x22')](respondWithStatusCode(_0x5520bf,null))[_0x7311('0x5d')](handleError(_0x5520bf,null));};exports['addAnswer']=function(_0x435497,_0x23f6d6,_0x458c09){if(_0x435497[_0x7311('0x61')]['id']){delete _0x435497['body']['id'];}return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x435497[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x23f6d6,null))[_0x7311('0x22')](function(_0xf364a5){if(_0xf364a5){_0x435497[_0x7311('0x61')][_0x7311('0x6b')]=_0xf364a5['id'];return db[_0x7311('0x71')][_0x7311('0x60')](_0x435497[_0x7311('0x61')]);}})[_0x7311('0x22')](respondWithResult(_0x23f6d6,null))['catch'](handleError(_0x23f6d6,null));};exports[_0x7311('0x72')]=function(_0x5b79d9,_0x2cd828,_0x2e2dd7){var _0x3132dc={'raw':![],'where':{}};var _0x54825a={};var _0x186664={'count':0x0,'rows':[]};return db[_0x7311('0x5a')]['findOne']({'where':{'id':_0x5b79d9[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x2cd828,null))[_0x7311('0x22')](function(_0x48605b){if(_0x48605b){_0x54825a[_0x7311('0x48')]=_[_0x7311('0x4a')](db[_0x7311('0x71')]['rawAttributes']);_0x54825a[_0x7311('0x49')]=_[_0x7311('0x4a')](_0x5b79d9[_0x7311('0x49')]);_0x54825a[_0x7311('0x4b')]=_[_0x7311('0x4c')](_0x54825a[_0x7311('0x48')],_0x54825a['query']);_0x3132dc[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x54825a[_0x7311('0x48')],qs[_0x7311('0x4e')](_0x5b79d9[_0x7311('0x49')][_0x7311('0x4e')]));_0x3132dc[_0x7311('0x4d')]=_0x3132dc[_0x7311('0x4d')][_0x7311('0x4f')]?_0x3132dc[_0x7311('0x4d')]:_0x54825a[_0x7311('0x48')];if(!_0x5b79d9[_0x7311('0x49')]['hasOwnProperty']('nolimit')){_0x3132dc[_0x7311('0x32')]=qs[_0x7311('0x32')](_0x5b79d9['query']['limit']);_0x3132dc[_0x7311('0x30')]=qs[_0x7311('0x30')](_0x5b79d9[_0x7311('0x49')][_0x7311('0x30')]);}_0x3132dc[_0x7311('0x73')]=qs[_0x7311('0x52')](_0x5b79d9[_0x7311('0x49')]['sort']);_0x3132dc['where']=qs[_0x7311('0x4b')](_['pick'](_0x5b79d9[_0x7311('0x49')],_0x54825a[_0x7311('0x4b')]));_0x3132dc['where'][_0x7311('0x6b')]=_0x48605b['id'];if(_0x5b79d9[_0x7311('0x49')][_0x7311('0x53')]){_0x3132dc['where']=_['merge'](_0x3132dc['where'],{'$or':_[_0x7311('0x43')](_0x3132dc[_0x7311('0x4d')],function(_0x3030a2){var _0x357f2e={};_0x357f2e[_0x3030a2]={'$like':'%'+_0x5b79d9['query']['filter']+'%'};return _0x357f2e;})});}_0x3132dc=_[_0x7311('0x55')]({},_0x3132dc,_0x5b79d9[_0x7311('0x56')]);return db[_0x7311('0x71')][_0x7311('0x57')]({'where':_0x3132dc[_0x7311('0x54')]})[_0x7311('0x22')](function(_0x13e94e){_0x186664[_0x7311('0x57')]=_0x13e94e;if(_0x5b79d9[_0x7311('0x49')][_0x7311('0x58')]){_0x3132dc[_0x7311('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3132dc);})[_0x7311('0x22')](function(_0x2f4cb1){_0x186664['rows']=_0x2f4cb1;return _0x186664;});}})[_0x7311('0x22')](respondWithFilteredResult(_0x2cd828,_0x3132dc))[_0x7311('0x5d')](handleError(_0x2cd828,null));};exports[_0x7311('0x74')]=function(_0x53573c,_0xb9d3b6,_0x12f002){return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x53573c[_0x7311('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb9d3b6,null))[_0x7311('0x22')](function(_0x56ea0c){if(_0x56ea0c){return _0x56ea0c[_0x7311('0x74')](_0x53573c['query'][_0x7311('0x75')]);}})['then'](respondWithStatusCode(_0xb9d3b6,null))[_0x7311('0x5d')](handleError(_0xb9d3b6,null));};exports[_0x7311('0x76')]=function(_0x24b4a8,_0x484cd3,_0x432c4b){var _0x47c7e5={'body':_0x24b4a8[_0x7311('0x61')],'channel':_0x7311('0x77')};var _0x4a37a9=[];var _0x2d81fe=[];var _0x540c43={};var _0x1ab2a6=![];return db['CmContact']['describe']()[_0x7311('0x22')](function(_0x4dd648){if(!_0x4dd648){throw new db['Sequelize'][(_0x7311('0x78'))](_0x7311('0x79'));}_0x4a37a9=_[_0x7311('0x7a')](_['keys'](_0x4dd648),[_0x7311('0x7b'),_0x7311('0x7c')]);_0x2d81fe=_[_0x7311('0x7a')](_[_0x7311('0x4a')](_0x4dd648),['createdAt',_0x7311('0x7c'),'CompanyId','ListId']);if(_0x24b4a8[_0x7311('0x61')]['id']){delete _0x24b4a8['body']['id'];}if(_[_0x7311('0x7d')](_0x24b4a8[_0x7311('0x61')][_0x7311('0x7e')])){throw new db['Sequelize'][(_0x7311('0x78'))]('from\x20is\x20mandatory');}if(_[_0x7311('0x7d')](_0x24b4a8[_0x7311('0x61')][_0x7311('0x61')])||_0x24b4a8[_0x7311('0x61')]['body']===''){throw new db[(_0x7311('0x7f'))][(_0x7311('0x78'))](_0x7311('0x80'));}if(_['isNil'](_0x24b4a8[_0x7311('0x61')][_0x7311('0x81')])){throw new db[(_0x7311('0x7f'))][(_0x7311('0x78'))](_0x7311('0x82')+_0x2d81fe);}if(!_[_0x7311('0x83')](_0x2d81fe,_0x24b4a8[_0x7311('0x61')][_0x7311('0x81')])){throw new db[(_0x7311('0x7f'))][(_0x7311('0x78'))](_0x7311('0x84')+_0x2d81fe);}_0x540c43[_0x24b4a8[_0x7311('0x61')]['mapKey']]=_0x24b4a8[_0x7311('0x61')][_0x7311('0x7e')];})['then'](function(){return db[_0x7311('0x5a')]['find']({'where':{'id':_0x24b4a8[_0x7311('0x5f')]['id']},'include':[{'model':db[_0x7311('0x85')],'as':_0x7311('0x86'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x540c43,'limit':0x1,'order':[[_0x7311('0x7c'),'DESC']]}]},{'model':db[_0x7311('0x87')],'as':_0x7311('0x88')}]});})[_0x7311('0x22')](handleEntityNotFound(_0x484cd3,null))[_0x7311('0x22')](function(_0x3eb538){if(_0x3eb538&&_0x3eb538[_0x7311('0x86')]){_0x47c7e5['account']=_0x3eb538;_0x47c7e5['applications']=_0x3eb538[_0x7311('0x88')];_0x47c7e5['list']=_0x3eb538['List'];_0x47c7e5[_0x7311('0x89')]=_[_0x7311('0x8a')](_0x47c7e5['applications'],[_0x7311('0x8b')],[_0x7311('0x8c')]);if(_0x47c7e5[_0x7311('0x8d')][_0x7311('0x88')]){delete _0x47c7e5[_0x7311('0x8d')]['Applications'];}if(_0x47c7e5['account'][_0x7311('0x86')]&&_0x47c7e5['account'][_0x7311('0x86')][_0x7311('0x8e')][_0x7311('0x4f')]){return _0x47c7e5[_0x7311('0x8d')]['List'][_0x7311('0x8e')][0x0];}var _0x1d5e33=_[_0x7311('0x1a')](_0x24b4a8['body'],{'firstName':_0x24b4a8[_0x7311('0x61')][_0x7311('0x7e')],'ListId':_0x3eb538[_0x7311('0x8f')]});_0x1d5e33[_0x24b4a8[_0x7311('0x61')][_0x7311('0x81')]]=_0x24b4a8[_0x7311('0x61')][_0x7311('0x7e')];return db[_0x7311('0x90')][_0x7311('0x60')](_0x1d5e33,{'fields':_0x4a37a9,'raw':!![]});}})[_0x7311('0x22')](handleEntityNotFound(_0x484cd3,null))['then'](function(_0x3aeb8b){_0x47c7e5[_0x7311('0x91')]=_0x3aeb8b;if(_0x3aeb8b){var _0x52810e={'ContactId':_0x3aeb8b['id'],'OpenchannelAccountId':_0x24b4a8[_0x7311('0x5f')]['id'],'from':(_0x3aeb8b['firstName']||'')+'\x20'+(_0x3aeb8b['lastName']||'')};var _0x2f03dd={'OpenchannelAccountId':_0x24b4a8[_0x7311('0x5f')]['id'],'closed':![]};if(_0x24b4a8[_0x7311('0x61')][_0x7311('0x92')]){_0x2f03dd['threadId']=_0x24b4a8['body']['threadId'];return db[_0x7311('0x93')][_0x7311('0x65')]({'where':_0x2f03dd})[_0x7311('0x22')](function(_0x2b38ea){if(_0x2b38ea){return[_0x2b38ea,![]];}_0x52810e[_0x7311('0x92')]=_0x24b4a8[_0x7311('0x61')][_0x7311('0x92')];_0x52810e[_0x7311('0x94')]=_0x24b4a8['body']['externalUrl'];return db[_0x7311('0x93')][_0x7311('0x60')](_0x52810e)['then'](function(_0x35d8c1){return[_0x35d8c1,!![]];});});}else{_0x2f03dd[_0x7311('0x92')]=null;}_0x2f03dd[_0x7311('0x95')]=_0x3aeb8b['id'];return db[_0x7311('0x93')]['find']({'where':_0x2f03dd})[_0x7311('0x22')](function(_0x1ff3dc){if(_0x1ff3dc){return[_0x1ff3dc,![]];}return db['OpenchannelInteraction']['create'](_0x52810e)[_0x7311('0x22')](function(_0x264c41){return[_0x264c41,!![]];});});}})[_0x7311('0x96')](function(_0x38cb39,_0x176991){if(_0x38cb39){_0x1ab2a6=_0x176991;if(!_0x176991){var _0x42548a={'from':(_0x47c7e5[_0x7311('0x91')][_0x7311('0x97')]||'')+'\x20'+(_0x47c7e5[_0x7311('0x91')]['lastName']||'')};if(_0x24b4a8['body'][_0x7311('0x92')]&&_0x24b4a8[_0x7311('0x61')][_0x7311('0x98')]&&_0x24b4a8[_0x7311('0x61')][_0x7311('0x92')]!=_0x24b4a8['body'][_0x7311('0x98')]){_0x42548a[_0x7311('0x92')]=_0x24b4a8[_0x7311('0x61')][_0x7311('0x98')];}return _0x38cb39[_0x7311('0x38')](_0x42548a);}else{return _0x38cb39;}}})[_0x7311('0x22')](function(_0x515b48){_0x47c7e5['interaction']=_0x515b48[_0x7311('0x39')]({'plain':!![]});_0x47c7e5[_0x7311('0x99')][_0x7311('0x9a')]=_0x1ab2a6;if(_0x47c7e5[_0x7311('0x99')][_0x7311('0x9a')]){if(_0x47c7e5[_0x7311('0x8d')][_0x7311('0x9b')]){_0x47c7e5[_0x7311('0x89')][_0x7311('0x9c')]({'id':0x0,'priority':_0x47c7e5['applications'][_0x7311('0x4f')]+0x1,'app':_0x7311('0x9d'),'appdata':'unmanaged','interval':_0x7311('0x9e')});}}return db['OpenchannelMessage'][_0x7311('0x60')]({'body':_0x24b4a8[_0x7311('0x61')][_0x7311('0x61')],'OpenchannelAccountId':_0x24b4a8[_0x7311('0x5f')]['id'],'OpenchannelInteractionId':_0x515b48['id'],'direction':'in','ContactId':_0x47c7e5[_0x7311('0x91')]['id'],'AttachmentId':_0x24b4a8['body']['AttachmentId']});})['then'](function(_0xe2cf61){_0x47c7e5[_0x7311('0x2a')]=_0xe2cf61;if(_0x47c7e5[_0x7311('0x99')]['UserId']){return db[_0x7311('0x9f')][_0x7311('0x65')]({'attributes':['id',_0x7311('0x3e')],'where':{'id':_0x47c7e5['interaction'][_0x7311('0xa0')]}})[_0x7311('0x22')](function(_0xfb5888){if(_0xfb5888){_0x47c7e5['applications'][_0x7311('0xa1')]({'id':0x0,'priority':0x0,'app':_0x7311('0xa2'),'appdata':_0xfb5888[_0x7311('0x3e')]+','+(_0x47c7e5[_0x7311('0x8d')][_0x7311('0xa3')]||0xa),'interval':_0x7311('0x9e')});_0x47c7e5[_0x7311('0xa4')]=![];}return respondWithRpcPromise('Start',_0x7311('0xa5'),_0x47c7e5);});}return respondWithRpcPromise(_0x7311('0xa6'),_0x7311('0xa5'),_0x47c7e5);})[_0x7311('0x22')](function(_0x126ef8){respondWithRpcPromise('EventManager',_0x7311('0xa7'),{'event':'notify','message':_0x126ef8},client9002);return _0x126ef8;})[_0x7311('0x22')](respondWithResult(_0x484cd3,null))[_0x7311('0x5d')](handleError(_0x484cd3,null));};exports[_0x7311('0xa8')]=function(_0x37c301,_0x2baec7){var _0x2916de=_0x37c301[_0x7311('0x5f')]['id'];var _0x5b1ca8=_0x37c301[_0x7311('0x61')];var _0x54db13=0xc8;var _0x42bb74=null;return db[_0x7311('0xa9')]['transaction']({'isolationLevel':db[_0x7311('0xa9')]['Transaction'][_0x7311('0xaa')][_0x7311('0xab')]},function(_0x22648c){return db[_0x7311('0x5a')]['findOne']({'where':{'id':_0x2916de},'transaction':_0x22648c})[_0x7311('0x22')](function(_0x30bd7b){if(_0x30bd7b){return db[_0x7311('0x87')][_0x7311('0x3c')]({'where':{'OpenchannelAccountId':_0x2916de},'transaction':_0x22648c})['then'](function(){var _0x27d901=_['map'](_0x5b1ca8,function(_0x2fb539){_0x2fb539[_0x7311('0x6b')]=_0x2916de;return _0x2fb539;});return db[_0x7311('0x87')][_0x7311('0xac')](_0x27d901,{'transaction':_0x22648c});});}else{_0x54db13=0x194;_0x42bb74=[];}});})[_0x7311('0x22')](function(){if(_0x54db13!==0x194){return db[_0x7311('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2916de},'order':_0x7311('0x8b')})[_0x7311('0x22')](function(_0x54bf0c){_0x42bb74=_0x54bf0c;});}})[_0x7311('0x5d')](function(_0x39f6d1){_0x54db13=0x1f4;logger[_0x7311('0x28')](_0x39f6d1[_0x7311('0x3d')]);if(_0x39f6d1['name']){delete _0x39f6d1[_0x7311('0x3e')];}_0x42bb74=_0x39f6d1;})[_0x7311('0xad')](function(){if(_0x42bb74===null){_0x2baec7[_0x7311('0x2c')](_0x54db13);}else{if(_0x54db13===0x1f4){_0x2baec7[_0x7311('0x2d')](_0x54db13)[_0x7311('0x3f')](_0x42bb74);}else{_0x2baec7[_0x7311('0x2d')](_0x54db13)[_0x7311('0x2f')](_0x42bb74);}}});};exports[_0x7311('0xae')]=function(_0x33f04f,_0x21e9cf,_0x1c1974){var _0x4da8ea={};var _0x1e9546={};var _0x5806b3;var _0x5b8acd;return db[_0x7311('0x5a')]['findOne']({'where':{'id':_0x33f04f[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x21e9cf,null))[_0x7311('0x22')](function(_0x4ea81c){if(_0x4ea81c){_0x5806b3=_0x4ea81c;_0x1e9546[_0x7311('0x48')]=_[_0x7311('0x4a')](db[_0x7311('0x87')][_0x7311('0x44')]);_0x1e9546[_0x7311('0x49')]=_[_0x7311('0x4a')](_0x33f04f[_0x7311('0x49')]);_0x1e9546['filters']=_[_0x7311('0x4c')](_0x1e9546['model'],_0x1e9546[_0x7311('0x49')]);_0x4da8ea[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x1e9546[_0x7311('0x48')],qs[_0x7311('0x4e')](_0x33f04f[_0x7311('0x49')][_0x7311('0x4e')]));_0x4da8ea[_0x7311('0x4d')]=_0x4da8ea[_0x7311('0x4d')]['length']?_0x4da8ea[_0x7311('0x4d')]:_0x1e9546['model'];_0x4da8ea[_0x7311('0x73')]=qs[_0x7311('0x52')](_0x33f04f['query']['sort']);_0x4da8ea['where']=qs[_0x7311('0x4b')](_[_0x7311('0x6f')](_0x33f04f[_0x7311('0x49')],_0x1e9546[_0x7311('0x4b')]));if(_0x33f04f[_0x7311('0x49')][_0x7311('0x53')]){_0x4da8ea[_0x7311('0x54')]=_[_0x7311('0x55')](_0x4da8ea[_0x7311('0x54')],{'$or':_['map'](_0x4da8ea['attributes'],function(_0x15b466){var _0x1261f4={};_0x1261f4[_0x15b466]={'$like':'%'+_0x33f04f[_0x7311('0x49')][_0x7311('0x53')]+'%'};return _0x1261f4;})});}_0x4da8ea=_['merge']({},_0x4da8ea,_0x33f04f[_0x7311('0x56')]);return _0x5806b3[_0x7311('0xae')](_0x4da8ea);}})[_0x7311('0x22')](function(_0x42726e){if(_0x42726e){_0x5b8acd=_0x42726e[_0x7311('0x4f')];if(!_0x33f04f[_0x7311('0x49')][_0x7311('0x50')](_0x7311('0x51'))){_0x4da8ea[_0x7311('0x32')]=qs[_0x7311('0x32')](_0x33f04f['query'][_0x7311('0x32')]);_0x4da8ea[_0x7311('0x30')]=qs['offset'](_0x33f04f[_0x7311('0x49')][_0x7311('0x30')]);}return _0x5806b3[_0x7311('0xae')](_0x4da8ea);}})['then'](function(_0x39466f){if(_0x39466f){return _0x39466f?{'count':_0x5b8acd,'rows':_0x39466f}:null;}})[_0x7311('0x22')](respondWithResult(_0x21e9cf,null))[_0x7311('0x5d')](handleError(_0x21e9cf,null));};exports[_0x7311('0xaf')]=function(_0x382470,_0xc21b7f,_0x11b6df){var _0x2a553f={'raw':![],'where':{}};var _0x4fea64={};var _0x16fee9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7311('0x6e')]({'where':{'id':_0x382470[_0x7311('0x5f')]['id']}})['then'](handleEntityNotFound(_0xc21b7f,null))['then'](function(_0xd526aa){if(_0xd526aa){_0x4fea64[_0x7311('0x48')]=_[_0x7311('0x4a')](db[_0x7311('0x93')][_0x7311('0x44')]);_0x4fea64[_0x7311('0x49')]=_['keys'](_0x382470[_0x7311('0x49')]);_0x4fea64['filters']=_[_0x7311('0x4c')](_0x4fea64['model'],_0x4fea64[_0x7311('0x49')]);_0x2a553f[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x4fea64[_0x7311('0x48')],qs[_0x7311('0x4e')](_0x382470[_0x7311('0x49')][_0x7311('0x4e')]));_0x2a553f[_0x7311('0x4d')]=_0x2a553f[_0x7311('0x4d')][_0x7311('0x4f')]?_0x2a553f[_0x7311('0x4d')]:_0x4fea64[_0x7311('0x48')];if(!_0x382470[_0x7311('0x49')][_0x7311('0x50')](_0x7311('0x51'))){_0x2a553f[_0x7311('0x32')]=qs['limit'](_0x382470[_0x7311('0x49')][_0x7311('0x32')]);_0x2a553f[_0x7311('0x30')]=qs[_0x7311('0x30')](_0x382470[_0x7311('0x49')][_0x7311('0x30')]);}_0x2a553f['order']=qs[_0x7311('0x52')](_0x382470[_0x7311('0x49')][_0x7311('0x52')]);_0x2a553f[_0x7311('0x54')]=qs[_0x7311('0x4b')](_[_0x7311('0x6f')](_0x382470['query'],_0x4fea64[_0x7311('0x4b')]));_0x2a553f[_0x7311('0x54')]['OpenchannelAccountId']=_0xd526aa['id'];if(_0x382470[_0x7311('0x49')]['filter']){_0x2a553f[_0x7311('0x54')]=_[_0x7311('0x55')](_0x2a553f['where'],{'$or':_[_0x7311('0x43')](_0x2a553f[_0x7311('0x4d')],function(_0x50c16c){var _0x277dfc={};_0x277dfc[_0x50c16c]={'$like':'%'+_0x382470['query'][_0x7311('0x53')]+'%'};return _0x277dfc;})});}_0x2a553f=_[_0x7311('0x55')]({},_0x2a553f,_0x382470['options']);return db[_0x7311('0x93')][_0x7311('0x57')]({'where':_0x2a553f[_0x7311('0x54')]})[_0x7311('0x22')](function(_0x483142){_0x16fee9[_0x7311('0x57')]=_0x483142;if(_0x382470[_0x7311('0x49')][_0x7311('0x58')]){_0x2a553f['include']=[{'model':db[_0x7311('0x90')],'as':_0x7311('0xb0'),'required':![]},{'model':db[_0x7311('0x9f')],'as':'Owner','attributes':[_0x7311('0x3e'),'fullname',_0x7311('0xb1')],'required':![]},{'model':db[_0x7311('0xb2')],'as':_0x7311('0xb3'),'attributes':['id',_0x7311('0x3e'),_0x7311('0xb4')],'where':_0x382470[_0x7311('0x49')][_0x7311('0xb5')]?{'id':_0x382470[_0x7311('0x49')][_0x7311('0xb5')]}:undefined,'required':_0x382470[_0x7311('0x49')][_0x7311('0xb5')]?!![]:![]}];}return db[_0x7311('0x93')][_0x7311('0x5b')](_0x2a553f);})[_0x7311('0x22')](function(_0x12972c){_0x16fee9[_0x7311('0x5c')]=_0x12972c;return _0x16fee9;});}})[_0x7311('0x22')](respondWithFilteredResult(_0xc21b7f,_0x2a553f))[_0x7311('0x5d')](handleError(_0xc21b7f,null));};exports[_0x7311('0xb6')]=function(_0x36c541,_0x1195d7,_0x5d3b27){return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x36c541[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x1195d7,null))[_0x7311('0x22')](function(_0x193438){if(_0x193438){return _0x193438['addAgents'](_0x36c541['body'][_0x7311('0x75')],_[_0x7311('0xb7')](_0x36c541[_0x7311('0x61')],[_0x7311('0x75'),'id'])||{})[_0x7311('0x96')](function(_0x4f0342){for(var _0x1f2717=0x0;_0x1f2717<_0x36c541[_0x7311('0x61')][_0x7311('0x75')][_0x7311('0x4f')];_0x1f2717+=0x1){socket[_0x7311('0xb8')](_0x7311('0xb9'),{'UserId':Number(_0x36c541[_0x7311('0x61')][_0x7311('0x75')][_0x1f2717]),'OpenchannelAccountId':Number(_0x36c541[_0x7311('0x5f')]['id'])});}return _0x4f0342;});}})[_0x7311('0x22')](respondWithResult(_0x1195d7,null))[_0x7311('0x5d')](handleError(_0x1195d7,null));};exports[_0x7311('0xba')]=function(_0x413390,_0xb0d325,_0x29c621){return db[_0x7311('0x5a')][_0x7311('0x65')]({'where':{'id':_0x413390[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0xb0d325,null))[_0x7311('0x22')](function(_0x1123fa){if(_0x1123fa){return _0x1123fa['removeAgents'](_0x413390[_0x7311('0x49')][_0x7311('0x75')])[_0x7311('0x22')](function(){if(_['isArray'](_0x413390['query'][_0x7311('0x75')])){for(var _0x16ab4f=0x0;_0x16ab4f<_0x413390[_0x7311('0x49')][_0x7311('0x75')]['length'];_0x16ab4f+=0x1){socket['emit'](_0x7311('0xbb'),{'UserId':Number(_0x413390[_0x7311('0x49')][_0x7311('0x75')][_0x16ab4f]),'OpenchannelAccountId':Number(_0x413390[_0x7311('0x5f')]['id'])});}}else{socket[_0x7311('0xb8')](_0x7311('0xbb'),{'UserId':Number(_0x413390[_0x7311('0x49')][_0x7311('0x75')]),'OpenchannelAccountId':Number(_0x413390['params']['id'])});}});}})['then'](respondWithStatusCode(_0xb0d325,null))[_0x7311('0x5d')](handleError(_0xb0d325,null));};exports[_0x7311('0xbc')]=function(_0x516f38,_0xa69d48,_0x3ede40){var _0x47e9c9={};var _0x1cfd8a={};var _0x286cd7;var _0x1b75dd;return db[_0x7311('0x5a')][_0x7311('0x6e')]({'where':{'id':_0x516f38[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0xa69d48,null))[_0x7311('0x22')](function(_0x39e38c){if(_0x39e38c){_0x286cd7=_0x39e38c;_0x1cfd8a[_0x7311('0x48')]=_['keys'](db['User'][_0x7311('0x44')]);_0x1cfd8a[_0x7311('0x49')]=_['keys'](_0x516f38[_0x7311('0x49')]);_0x1cfd8a['filters']=_[_0x7311('0x4c')](_0x1cfd8a[_0x7311('0x48')],_0x1cfd8a[_0x7311('0x49')]);_0x47e9c9[_0x7311('0x4d')]=_[_0x7311('0x4c')](_0x1cfd8a[_0x7311('0x48')],qs[_0x7311('0x4e')](_0x516f38[_0x7311('0x49')]['fields']));_0x47e9c9['attributes']=_0x47e9c9[_0x7311('0x4d')]['length']?_0x47e9c9[_0x7311('0x4d')]:_0x1cfd8a['model'];_0x47e9c9['order']=qs['sort'](_0x516f38[_0x7311('0x49')][_0x7311('0x52')]);_0x47e9c9['where']=qs[_0x7311('0x4b')](_[_0x7311('0x6f')](_0x516f38[_0x7311('0x49')],_0x1cfd8a[_0x7311('0x4b')]));if(_0x516f38['query'][_0x7311('0x53')]){_0x47e9c9[_0x7311('0x54')]=_['merge'](_0x47e9c9['where'],{'$or':_[_0x7311('0x43')](_0x47e9c9['attributes'],function(_0x57617f){var _0x1ae88c={};_0x1ae88c[_0x57617f]={'$like':'%'+_0x516f38[_0x7311('0x49')][_0x7311('0x53')]+'%'};return _0x1ae88c;})});}_0x47e9c9=_[_0x7311('0x55')]({},_0x47e9c9,_0x516f38['options']);return _0x286cd7[_0x7311('0xbc')](_0x47e9c9);}})[_0x7311('0x22')](function(_0x1e9293){if(_0x1e9293){_0x1b75dd=_0x1e9293[_0x7311('0x4f')];if(!_0x516f38[_0x7311('0x49')][_0x7311('0x50')]('nolimit')){_0x47e9c9[_0x7311('0x32')]=qs['limit'](_0x516f38[_0x7311('0x49')][_0x7311('0x32')]);_0x47e9c9[_0x7311('0x30')]=qs[_0x7311('0x30')](_0x516f38[_0x7311('0x49')][_0x7311('0x30')]);}return _0x286cd7[_0x7311('0xbc')](_0x47e9c9);}})[_0x7311('0x22')](function(_0x1f0f5a){if(_0x1f0f5a){return _0x1f0f5a?{'count':_0x1b75dd,'rows':_0x1f0f5a}:null;}})[_0x7311('0x22')](respondWithResult(_0xa69d48,null))[_0x7311('0x5d')](handleError(_0xa69d48,null));};exports[_0x7311('0x3f')]=function(_0x1146f4,_0x5b0325,_0xe295b7){var _0xf0f37e,_0x35da99,_0x2e60a8;if(_[_0x7311('0x7d')](_0x1146f4[_0x7311('0x61')][_0x7311('0x61')])||_0x1146f4[_0x7311('0x61')][_0x7311('0x61')]===''){throw new db[(_0x7311('0x7f'))][(_0x7311('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7311('0x7d')](_0x1146f4[_0x7311('0x61')]['to'])){}_0xf0f37e=_0x1146f4[_0x7311('0x61')]['to'];return db['OpenchannelAccount'][_0x7311('0x6e')]({'where':{'id':_0x1146f4[_0x7311('0x5f')]['id']}})[_0x7311('0x22')](handleEntityNotFound(_0x5b0325,null))[_0x7311('0x22')](function(_0x3d64f3){if(_0x3d64f3){return db[_0x7311('0x5a')]['find']({'where':{'id':_0x3d64f3['id']},'include':[{'model':db[_0x7311('0x85')],'as':_0x7311('0x86'),'include':[{'model':db[_0x7311('0x90')],'as':_0x7311('0x8e'),'where':{[_0x3d64f3['mapKey']]:_0xf0f37e},'limit':0x1,'order':[[_0x7311('0x7c'),_0x7311('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x5b0325,null))[_0x7311('0x22')](function(_0x1a5514){if(_0x1a5514&&_0x1a5514['List']){_0x35da99=_0x1a5514['get']({'plain':!![]});if(_0x35da99[_0x7311('0x86')]&&_0x35da99[_0x7311('0x86')]['Contacts'][_0x7311('0x4f')]){return _0x35da99[_0x7311('0x86')][_0x7311('0x8e')][0x0];}return db[_0x7311('0x90')][_0x7311('0x60')](_['defaults'](_0x1146f4['body'],{'firstName':_0xf0f37e,[_0x1a5514['mapKey']]:_0xf0f37e,'phone':_0xf0f37e,'ListId':_0x35da99[_0x7311('0x8f')]}));}})[_0x7311('0x22')](handleEntityNotFound(_0x5b0325,null))['then'](function(_0x5a7ba2){if(_0x5a7ba2){_0x2e60a8=_0x5a7ba2;return db[_0x7311('0x93')][_0x7311('0x65')]({'where':{'ContactId':_0x2e60a8['id'],'closed':![],'OpenchannelAccountId':_0x35da99['id']}})[_0x7311('0x22')](function(_0x167abc){if(_0x167abc){return[_0x167abc,![]];}return db[_0x7311('0x93')][_0x7311('0x60')]({'UserId':_0x1146f4[_0x7311('0x62')]['id'],'ContactId':_0x2e60a8['id'],'OpenchannelAccountId':_0x35da99['id'],'lastMsgDirection':_0x7311('0xbe'),'Messages':[_[_0x7311('0x55')](_0x1146f4[_0x7311('0x61')],{'read':![],'body':_0x1146f4[_0x7311('0x61')][_0x7311('0x61')],'OpenchannelAccountId':_0x35da99['id'],'UserId':_0x1146f4['user']['id'],'ContactId':_0x2e60a8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x7311('0xbf')}]})[_0x7311('0x22')](function(_0x3f94e0){return[_0x3f94e0,!![]];});});}})['spread'](function(_0x4e3630,_0x2c394c){if(_0x2c394c){return _0x4e3630;}return db[_0x7311('0xc0')][_0x7311('0x60')](_['merge'](_0x1146f4[_0x7311('0x61')],{'read':![],'body':_0x1146f4['body'][_0x7311('0x61')],'OpenchannelAccountId':_0x35da99['id'],'OpenchannelInteractionId':_0x4e3630['id'],'UserId':_0x1146f4[_0x7311('0x62')]['id'],'ContactId':_0x2e60a8['id']}))[_0x7311('0x22')](function(_0x19c782){_0x4e3630[_0x7311('0xc1')]['Messages']=[];_0x4e3630['dataValues'][_0x7311('0xbf')][_0x7311('0x9c')](_0x19c782['dataValues']);return _0x4e3630;});});}})[_0x7311('0x22')](respondWithResult(_0x5b0325,null))['catch'](handleError(_0x5b0325,null));}; \ No newline at end of file +var _0xf86b=['rows','show','params','mandatoryDispositionPause','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','find','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','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','from','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelAccount','includeAll','include','findAll'];(function(_0x30507b,_0x45cdc7){var _0x41d688=function(_0x2c3b8c){while(--_0x2c3b8c){_0x30507b['push'](_0x30507b['shift']());}};_0x41d688(++_0x45cdc7);}(_0xf86b,0x129));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbf86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf86('0x1'));var jsonpatch=require(_0xbf86('0x2'));var rp=require(_0xbf86('0x3'));var moment=require(_0xbf86('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbf86('0x5'));var util=require('util');var path=require(_0xbf86('0x6'));var sox=require(_0xbf86('0x7'));var csv=require(_0xbf86('0x8'));var ejs=require(_0xbf86('0x9'));var fs=require('fs');var fs_extra=require(_0xbf86('0xa'));var _=require(_0xbf86('0xb'));var squel=require(_0xbf86('0xc'));var crypto=require(_0xbf86('0xd'));var jsforce=require(_0xbf86('0xe'));var deskjs=require(_0xbf86('0xf'));var toCsv=require(_0xbf86('0x8'));var querystring=require(_0xbf86('0x10'));var Papa=require('papaparse');var Redis=require(_0xbf86('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbf86('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf86('0x13'))(_0xbf86('0x14'));var utils=require('../../config/utils');var config=require(_0xbf86('0x15'));var licenseUtil=require(_0xbf86('0x16'));var db=require(_0xbf86('0x17'))['db'];config['redis']=_[_0xbf86('0x18')](config[_0xbf86('0x19')],{'host':_0xbf86('0x1a'),'port':0x18eb});var socket=require(_0xbf86('0x1b'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xbf86('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbf86('0x1d')][_0xbf86('0x1e')]({'port':0x232c});var client9002=jayson[_0xbf86('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127139,_0x297b67,_0x55a71b,_0x551362){return new BPromise(function(_0x1df2c1,_0x2e8edc){var _0x22a184=_0x551362||client;return _0x22a184['request'](_0x127139,_0x55a71b)['then'](function(_0x5cd319){logger[_0xbf86('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x297b67,_0xbf86('0x20'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x297b67,'request\x20sent',JSON[_0xbf86('0x21')](_0x5cd319));if(_0x5cd319['error']){if(_0x5cd319[_0xbf86('0x22')][_0xbf86('0x23')]===0x1f4){logger[_0xbf86('0x22')](_0xbf86('0x24'),_0x297b67,_0x5cd319[_0xbf86('0x22')][_0xbf86('0x25')]);return _0x2e8edc(_0x5cd319[_0xbf86('0x22')][_0xbf86('0x25')]);}logger[_0xbf86('0x22')](_0xbf86('0x24'),_0x297b67,_0x5cd319[_0xbf86('0x22')]['message']);return _0x1df2c1(_0x5cd319[_0xbf86('0x22')]['message']);}else{logger[_0xbf86('0x1f')](_0xbf86('0x24'),_0x297b67,'request\x20sent');_0x1df2c1(_0x5cd319[_0xbf86('0x26')][_0xbf86('0x25')]);}})[_0xbf86('0x27')](function(_0x571400){logger[_0xbf86('0x22')](_0xbf86('0x24'),_0x297b67,_0x571400);_0x2e8edc(_0x571400);});});}function respondWithStatusCode(_0x1f476b,_0x108c66){_0x108c66=_0x108c66||0xcc;return function(_0x21756f){if(_0x21756f){return _0x1f476b[_0xbf86('0x28')](_0x108c66);}return _0x1f476b[_0xbf86('0x29')](_0x108c66)[_0xbf86('0x2a')]();};}function respondWithResult(_0x4af434,_0x3f7010){_0x3f7010=_0x3f7010||0xc8;return function(_0x4afce1){if(_0x4afce1){return _0x4af434[_0xbf86('0x29')](_0x3f7010)[_0xbf86('0x2b')](_0x4afce1);}};}function respondWithFilteredResult(_0x22aed9,_0x573dc1){return function(_0x3a8dbf){if(_0x3a8dbf){var _0x1dd6f0=typeof _0x573dc1[_0xbf86('0x2c')]===_0xbf86('0x2d')&&typeof _0x573dc1['limit']===_0xbf86('0x2d');var _0x144952=_0x3a8dbf[_0xbf86('0x2e')];var _0x1853e7=_0x1dd6f0?0x0:_0x573dc1[_0xbf86('0x2c')];var _0x3455ef=_0x1dd6f0?_0x3a8dbf['count']:_0x573dc1[_0xbf86('0x2c')]+_0x573dc1[_0xbf86('0x2f')];var _0x527d90;if(_0x3455ef>=_0x144952){_0x3455ef=_0x144952;_0x527d90=0xc8;}else{_0x527d90=0xce;}_0x22aed9[_0xbf86('0x29')](_0x527d90);return _0x22aed9[_0xbf86('0x30')](_0xbf86('0x31'),_0x1853e7+'-'+_0x3455ef+'/'+_0x144952)['json'](_0x3a8dbf);}return null;};}function patchUpdates(_0x28659c){return function(_0x21005a){try{jsonpatch[_0xbf86('0x32')](_0x21005a,_0x28659c,!![]);}catch(_0x2caaea){return BPromise[_0xbf86('0x33')](_0x2caaea);}return _0x21005a[_0xbf86('0x34')]();};}function saveUpdates(_0x33e63e,_0x51aa56){return function(_0x142fa0){if(_0x142fa0){return _0x142fa0[_0xbf86('0x35')](_0x33e63e)[_0xbf86('0x36')](function(_0x355640){return _0x355640;});}return null;};}function removeEntity(_0x637397,_0x485468){return function(_0x4f2a1c){if(_0x4f2a1c){return _0x4f2a1c['destroy']()[_0xbf86('0x36')](function(){var _0x1c7ec7=_0x4f2a1c[_0xbf86('0x37')]({'plain':!![]});var _0x431b3c=_0xbf86('0x38');return db[_0xbf86('0x39')][_0xbf86('0x3a')]({'where':{'type':_0x431b3c,'resourceId':_0x1c7ec7['id']}})[_0xbf86('0x36')](function(){return _0x4f2a1c;});})[_0xbf86('0x36')](function(){_0x637397[_0xbf86('0x29')](0xcc)[_0xbf86('0x2a')]();});}};}function handleEntityNotFound(_0x60c466,_0x596ee6){return function(_0x56f5b1){if(!_0x56f5b1){_0x60c466[_0xbf86('0x28')](0x194);}return _0x56f5b1;};}function handleError(_0x449363,_0x5964fb){_0x5964fb=_0x5964fb||0x1f4;return function(_0x3bb708){logger[_0xbf86('0x22')](_0x3bb708[_0xbf86('0x3b')]);if(_0x3bb708['name']){delete _0x3bb708[_0xbf86('0x3c')];}_0x449363[_0xbf86('0x29')](_0x5964fb)[_0xbf86('0x3d')](_0x3bb708);};}exports[_0xbf86('0x3e')]=function(_0x4b6853,_0x10518d){var _0x9e496a={'include':[{'model':db[_0xbf86('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1d54fc={},_0x2ac2db={'count':0x0,'rows':[]};var _0x189cbd=_[_0xbf86('0x40')](db['OpenchannelAccount'][_0xbf86('0x41')],function(_0x27b434){return{'name':_0x27b434[_0xbf86('0x42')],'type':_0x27b434['type'][_0xbf86('0x43')]};});_0x1d54fc[_0xbf86('0x44')]=_[_0xbf86('0x40')](_0x189cbd,'name');_0x1d54fc['query']=_[_0xbf86('0x45')](_0x4b6853[_0xbf86('0x46')]);_0x1d54fc[_0xbf86('0x47')]=_[_0xbf86('0x48')](_0x1d54fc[_0xbf86('0x44')],_0x1d54fc[_0xbf86('0x46')]);_0x9e496a[_0xbf86('0x49')]=_['intersection'](_0x1d54fc[_0xbf86('0x44')],qs['fields'](_0x4b6853['query'][_0xbf86('0x4a')]));_0x9e496a[_0xbf86('0x49')]=_0x9e496a['attributes'][_0xbf86('0x4b')]?_0x9e496a[_0xbf86('0x49')]:_0x1d54fc[_0xbf86('0x44')];if(!_0x4b6853[_0xbf86('0x46')][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x9e496a[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0x4b6853[_0xbf86('0x46')][_0xbf86('0x2f')]);_0x9e496a[_0xbf86('0x2c')]=qs[_0xbf86('0x2c')](_0x4b6853['query'][_0xbf86('0x2c')]);}_0x9e496a[_0xbf86('0x4e')]=qs[_0xbf86('0x4f')](_0x4b6853[_0xbf86('0x46')]['sort']);_0x9e496a[_0xbf86('0x50')]=qs[_0xbf86('0x47')](_[_0xbf86('0x51')](_0x4b6853[_0xbf86('0x46')],_0x1d54fc[_0xbf86('0x47')]),_0x189cbd);if(_0x4b6853[_0xbf86('0x46')][_0xbf86('0x52')]){_0x9e496a[_0xbf86('0x50')]=_[_0xbf86('0x53')](_0x9e496a[_0xbf86('0x50')],{'$or':_[_0xbf86('0x40')](_0x189cbd,function(_0xe1b6f8){if(_0xe1b6f8['type']!=='VIRTUAL'){var _0x50c155={};_0x50c155[_0xe1b6f8[_0xbf86('0x3c')]]={'$like':'%'+_0x4b6853[_0xbf86('0x46')][_0xbf86('0x52')]+'%'};return _0x50c155;}})});}_0x9e496a=_['merge']({},_0x9e496a,_0x4b6853[_0xbf86('0x54')]);var _0x1fde36={'where':_0x9e496a[_0xbf86('0x50')]};return db[_0xbf86('0x55')][_0xbf86('0x2e')](_0x1fde36)['then'](function(_0x354527){_0x2ac2db[_0xbf86('0x2e')]=_0x354527;if(_0x4b6853[_0xbf86('0x46')][_0xbf86('0x56')]){_0x9e496a[_0xbf86('0x57')]=[{'all':!![]}];}return db[_0xbf86('0x55')][_0xbf86('0x58')](_0x9e496a);})[_0xbf86('0x36')](function(_0x5cca75){_0x2ac2db[_0xbf86('0x59')]=_0x5cca75;return _0x2ac2db;})[_0xbf86('0x36')](respondWithFilteredResult(_0x10518d,_0x9e496a))[_0xbf86('0x27')](handleError(_0x10518d,null));};exports[_0xbf86('0x5a')]=function(_0x9e2fbf,_0x2f5c96){var _0x4e598e={'raw':![],'where':{'id':_0x9e2fbf[_0xbf86('0x5b')]['id']},'include':[{'model':db[_0xbf86('0x3f')],'as':_0xbf86('0x5c')}]},_0x4cee9f={};_0x4cee9f[_0xbf86('0x44')]=_[_0xbf86('0x45')](db[_0xbf86('0x55')][_0xbf86('0x41')]);_0x4cee9f[_0xbf86('0x46')]=_[_0xbf86('0x45')](_0x9e2fbf[_0xbf86('0x46')]);_0x4cee9f[_0xbf86('0x47')]=_[_0xbf86('0x48')](_0x4cee9f[_0xbf86('0x44')],_0x4cee9f[_0xbf86('0x46')]);_0x4e598e[_0xbf86('0x49')]=_[_0xbf86('0x48')](_0x4cee9f['model'],qs[_0xbf86('0x4a')](_0x9e2fbf[_0xbf86('0x46')]['fields']));_0x4e598e[_0xbf86('0x49')]=_0x4e598e[_0xbf86('0x49')][_0xbf86('0x4b')]?_0x4e598e[_0xbf86('0x49')]:_0x4cee9f['model'];if(_0x9e2fbf['query']['includeAll']){_0x4e598e[_0xbf86('0x57')]=[{'all':!![]}];}_0x4e598e=_[_0xbf86('0x53')]({},_0x4e598e,_0x9e2fbf['options']);return db[_0xbf86('0x55')]['find'](_0x4e598e)[_0xbf86('0x36')](handleEntityNotFound(_0x2f5c96,null))['then'](respondWithResult(_0x2f5c96,null))[_0xbf86('0x27')](handleError(_0x2f5c96,null));};exports['create']=function(_0x5ea4c3,_0x3c9a44){return db[_0xbf86('0x55')]['create'](_0x5ea4c3[_0xbf86('0x5d')],{})[_0xbf86('0x36')](function(_0x43337a){var _0x4912f3=_0x5ea4c3[_0xbf86('0x5e')][_0xbf86('0x37')]({'plain':!![]});if(!_0x4912f3)throw new Error(_0xbf86('0x5f'));if(_0x4912f3[_0xbf86('0x60')]===_0xbf86('0x5e')){var _0x47c6ec=_0x43337a[_0xbf86('0x37')]({'plain':!![]});var _0x1f99ba=_0xbf86('0x38');return db[_0xbf86('0x61')]['find']({'where':{'name':_0x1f99ba,'userProfileId':_0x4912f3[_0xbf86('0x62')]},'raw':!![]})[_0xbf86('0x36')](function(_0x1ab227){if(_0x1ab227&&_0x1ab227['autoAssociation']===0x0){return db[_0xbf86('0x39')]['create']({'name':_0x47c6ec['name'],'resourceId':_0x47c6ec['id'],'type':_0x1ab227[_0xbf86('0x3c')],'sectionId':_0x1ab227['id']},{})[_0xbf86('0x36')](function(){return _0x43337a;});}else{return _0x43337a;}})[_0xbf86('0x27')](function(_0x418af4){logger[_0xbf86('0x22')](_0xbf86('0x63'),_0x418af4);throw _0x418af4;});}return _0x43337a;})['then'](respondWithResult(_0x3c9a44,0xc9))[_0xbf86('0x27')](handleError(_0x3c9a44,null));};exports[_0xbf86('0x35')]=function(_0x373541,_0x3b1550){if(_0x373541[_0xbf86('0x5d')]['id']){delete _0x373541[_0xbf86('0x5d')]['id'];}return db[_0xbf86('0x55')]['find']({'where':{'id':_0x373541[_0xbf86('0x5b')]['id']},'include':[{'model':db[_0xbf86('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xbf86('0x36')](handleEntityNotFound(_0x3b1550,null))[_0xbf86('0x36')](saveUpdates(_0x373541['body'],null))[_0xbf86('0x36')](respondWithResult(_0x3b1550,null))['catch'](handleError(_0x3b1550,null));};exports[_0xbf86('0x3a')]=function(_0x4b5e08,_0x27e4c7){return db[_0xbf86('0x55')]['find']({'where':{'id':_0x4b5e08['params']['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x27e4c7,null))['then'](removeEntity(_0x27e4c7,null))['catch'](handleError(_0x27e4c7,null));};exports['describe']=function(_0x5769b3,_0x1bda3c){return db[_0xbf86('0x55')][_0xbf86('0x64')]()[_0xbf86('0x36')](respondWithResult(_0x1bda3c,null))[_0xbf86('0x27')](handleError(_0x1bda3c,null));};exports['addDisposition']=function(_0x5ae807,_0xa95e5c,_0x37ffbe){if(_0x5ae807[_0xbf86('0x5d')]['id']){delete _0x5ae807[_0xbf86('0x5d')]['id'];}return db[_0xbf86('0x55')]['find']({'where':{'id':_0x5ae807['params']['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0xa95e5c,null))['then'](function(_0x3ab9a4){if(_0x3ab9a4){_0x5ae807['body'][_0xbf86('0x65')]=_0x3ab9a4['id'];return db[_0xbf86('0x66')]['create'](_0x5ae807[_0xbf86('0x5d')]);}})[_0xbf86('0x36')](respondWithResult(_0xa95e5c,null))['catch'](handleError(_0xa95e5c,null));};exports[_0xbf86('0x67')]=function(_0x4eed2e,_0x56e01d,_0x3ed353){var _0x399d33={'raw':![],'where':{}};var _0x115178={};var _0x2c72bb={'count':0x0,'rows':[]};return db[_0xbf86('0x55')][_0xbf86('0x68')]({'where':{'id':_0x4eed2e[_0xbf86('0x5b')]['id']}})['then'](handleEntityNotFound(_0x56e01d,null))[_0xbf86('0x36')](function(_0x29ddd1){if(_0x29ddd1){_0x115178[_0xbf86('0x44')]=_[_0xbf86('0x45')](db[_0xbf86('0x66')][_0xbf86('0x41')]);_0x115178['query']=_['keys'](_0x4eed2e[_0xbf86('0x46')]);_0x115178['filters']=_['intersection'](_0x115178['model'],_0x115178[_0xbf86('0x46')]);_0x399d33[_0xbf86('0x49')]=_[_0xbf86('0x48')](_0x115178[_0xbf86('0x44')],qs[_0xbf86('0x4a')](_0x4eed2e[_0xbf86('0x46')]['fields']));_0x399d33['attributes']=_0x399d33['attributes'][_0xbf86('0x4b')]?_0x399d33[_0xbf86('0x49')]:_0x115178[_0xbf86('0x44')];if(!_0x4eed2e[_0xbf86('0x46')][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x399d33[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0x4eed2e[_0xbf86('0x46')][_0xbf86('0x2f')]);_0x399d33[_0xbf86('0x2c')]=qs[_0xbf86('0x2c')](_0x4eed2e['query']['offset']);}_0x399d33[_0xbf86('0x4e')]=qs[_0xbf86('0x4f')](_0x4eed2e[_0xbf86('0x46')]['sort']);_0x399d33['where']=qs['filters'](_[_0xbf86('0x51')](_0x4eed2e['query'],_0x115178[_0xbf86('0x47')]));_0x399d33[_0xbf86('0x50')]['OpenchannelAccountId']=_0x29ddd1['id'];if(_0x4eed2e[_0xbf86('0x46')]['filter']){_0x399d33[_0xbf86('0x50')]=_[_0xbf86('0x53')](_0x399d33[_0xbf86('0x50')],{'$or':_[_0xbf86('0x40')](_0x399d33[_0xbf86('0x49')],function(_0x4f4fc8){var _0x547a5e={};_0x547a5e[_0x4f4fc8]={'$like':'%'+_0x4eed2e[_0xbf86('0x46')][_0xbf86('0x52')]+'%'};return _0x547a5e;})});}_0x399d33=_[_0xbf86('0x53')]({},_0x399d33,_0x4eed2e[_0xbf86('0x54')]);return db[_0xbf86('0x66')][_0xbf86('0x2e')]({'where':_0x399d33[_0xbf86('0x50')]})[_0xbf86('0x36')](function(_0x184e9f){_0x2c72bb[_0xbf86('0x2e')]=_0x184e9f;if(_0x4eed2e[_0xbf86('0x46')]['includeAll']){_0x399d33['include']=[{'all':!![]}];}return db[_0xbf86('0x66')][_0xbf86('0x58')](_0x399d33);})[_0xbf86('0x36')](function(_0x5700ad){_0x2c72bb[_0xbf86('0x59')]=_0x5700ad;return _0x2c72bb;});}})[_0xbf86('0x36')](respondWithFilteredResult(_0x56e01d,_0x399d33))['catch'](handleError(_0x56e01d,null));};exports['removeDispositions']=function(_0x4603da,_0x46b7a5,_0x2906b5){return db[_0xbf86('0x55')][_0xbf86('0x69')]({'where':{'id':_0x4603da[_0xbf86('0x5b')]['id']}})['then'](handleEntityNotFound(_0x46b7a5,null))['then'](function(_0x220248){if(_0x220248){return _0x220248[_0xbf86('0x6a')](_0x4603da[_0xbf86('0x46')][_0xbf86('0x6b')]);}})[_0xbf86('0x36')](respondWithStatusCode(_0x46b7a5,null))[_0xbf86('0x27')](handleError(_0x46b7a5,null));};exports[_0xbf86('0x6c')]=function(_0x10e0e8,_0x3f2592,_0x22e93f){if(_0x10e0e8[_0xbf86('0x5d')]['id']){delete _0x10e0e8[_0xbf86('0x5d')]['id'];}return db['OpenchannelAccount'][_0xbf86('0x69')]({'where':{'id':_0x10e0e8[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x3f2592,null))['then'](function(_0x201302){if(_0x201302){_0x10e0e8[_0xbf86('0x5d')]['OpenchannelAccountId']=_0x201302['id'];return db[_0xbf86('0x6d')][_0xbf86('0x6e')](_0x10e0e8['body']);}})[_0xbf86('0x36')](respondWithResult(_0x3f2592,null))[_0xbf86('0x27')](handleError(_0x3f2592,null));};exports[_0xbf86('0x6f')]=function(_0xbf280e,_0x378b32,_0xe7c098){var _0x3b0c42={'raw':![],'where':{}};var _0x59681e={};var _0x618f81={'count':0x0,'rows':[]};return db[_0xbf86('0x55')][_0xbf86('0x68')]({'where':{'id':_0xbf280e['params']['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x378b32,null))[_0xbf86('0x36')](function(_0x3d619c){if(_0x3d619c){_0x59681e[_0xbf86('0x44')]=_[_0xbf86('0x45')](db[_0xbf86('0x6d')][_0xbf86('0x41')]);_0x59681e[_0xbf86('0x46')]=_[_0xbf86('0x45')](_0xbf280e['query']);_0x59681e[_0xbf86('0x47')]=_['intersection'](_0x59681e[_0xbf86('0x44')],_0x59681e['query']);_0x3b0c42[_0xbf86('0x49')]=_['intersection'](_0x59681e['model'],qs[_0xbf86('0x4a')](_0xbf280e['query'][_0xbf86('0x4a')]));_0x3b0c42[_0xbf86('0x49')]=_0x3b0c42['attributes']['length']?_0x3b0c42[_0xbf86('0x49')]:_0x59681e['model'];if(!_0xbf280e['query'][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x3b0c42[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0xbf280e[_0xbf86('0x46')][_0xbf86('0x2f')]);_0x3b0c42[_0xbf86('0x2c')]=qs[_0xbf86('0x2c')](_0xbf280e[_0xbf86('0x46')]['offset']);}_0x3b0c42[_0xbf86('0x4e')]=qs[_0xbf86('0x4f')](_0xbf280e[_0xbf86('0x46')][_0xbf86('0x4f')]);_0x3b0c42[_0xbf86('0x50')]=qs[_0xbf86('0x47')](_[_0xbf86('0x51')](_0xbf280e[_0xbf86('0x46')],_0x59681e[_0xbf86('0x47')]));_0x3b0c42[_0xbf86('0x50')]['OpenchannelAccountId']=_0x3d619c['id'];if(_0xbf280e['query']['filter']){_0x3b0c42['where']=_['merge'](_0x3b0c42[_0xbf86('0x50')],{'$or':_[_0xbf86('0x40')](_0x3b0c42[_0xbf86('0x49')],function(_0xae3f49){var _0x5eb3c8={};_0x5eb3c8[_0xae3f49]={'$like':'%'+_0xbf280e['query'][_0xbf86('0x52')]+'%'};return _0x5eb3c8;})});}_0x3b0c42=_[_0xbf86('0x53')]({},_0x3b0c42,_0xbf280e[_0xbf86('0x54')]);return db[_0xbf86('0x6d')][_0xbf86('0x2e')]({'where':_0x3b0c42[_0xbf86('0x50')]})[_0xbf86('0x36')](function(_0x33481b){_0x618f81[_0xbf86('0x2e')]=_0x33481b;if(_0xbf280e['query'][_0xbf86('0x56')]){_0x3b0c42[_0xbf86('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbf86('0x58')](_0x3b0c42);})[_0xbf86('0x36')](function(_0x569c7e){_0x618f81[_0xbf86('0x59')]=_0x569c7e;return _0x618f81;});}})[_0xbf86('0x36')](respondWithFilteredResult(_0x378b32,_0x3b0c42))['catch'](handleError(_0x378b32,null));};exports[_0xbf86('0x70')]=function(_0x1ff0f7,_0xace5cb,_0x291961){return db[_0xbf86('0x55')][_0xbf86('0x69')]({'where':{'id':_0x1ff0f7[_0xbf86('0x5b')]['id']}})['then'](handleEntityNotFound(_0xace5cb,null))[_0xbf86('0x36')](function(_0x4f1b35){if(_0x4f1b35){return _0x4f1b35[_0xbf86('0x70')](_0x1ff0f7[_0xbf86('0x46')][_0xbf86('0x6b')]);}})[_0xbf86('0x36')](respondWithStatusCode(_0xace5cb,null))[_0xbf86('0x27')](handleError(_0xace5cb,null));};exports['notify']=function(_0x247d96,_0x59fae7,_0xbe7119){var _0x1bec8c={'body':_0x247d96[_0xbf86('0x5d')],'channel':_0xbf86('0x71')};var _0x14c7d0=[];var _0x398495=[];var _0xf3cc83={};var _0x2810a4=![];return db[_0xbf86('0x72')][_0xbf86('0x64')]()[_0xbf86('0x36')](function(_0x33f9f4){if(!_0x33f9f4){throw new db[(_0xbf86('0x73'))][(_0xbf86('0x74'))](_0xbf86('0x75'));}_0x14c7d0=_['difference'](_[_0xbf86('0x45')](_0x33f9f4),[_0xbf86('0x76'),'updatedAt']);_0x398495=_[_0xbf86('0x77')](_[_0xbf86('0x45')](_0x33f9f4),['createdAt',_0xbf86('0x78'),'CompanyId',_0xbf86('0x79')]);if(_0x247d96[_0xbf86('0x5d')]['id']){delete _0x247d96[_0xbf86('0x5d')]['id'];}if(_[_0xbf86('0x7a')](_0x247d96[_0xbf86('0x5d')]['from'])){throw new db[(_0xbf86('0x73'))][(_0xbf86('0x74'))](_0xbf86('0x7b'));}if(_[_0xbf86('0x7a')](_0x247d96[_0xbf86('0x5d')]['body'])||_0x247d96[_0xbf86('0x5d')][_0xbf86('0x5d')]===''){throw new db[(_0xbf86('0x73'))][(_0xbf86('0x74'))](_0xbf86('0x7c'));}if(_[_0xbf86('0x7a')](_0x247d96['body'][_0xbf86('0x7d')])){throw new db[(_0xbf86('0x73'))]['ValidationError'](_0xbf86('0x7e')+_0x398495);}if(!_[_0xbf86('0x7f')](_0x398495,_0x247d96['body'][_0xbf86('0x7d')])){throw new db[(_0xbf86('0x73'))]['ValidationError'](_0xbf86('0x80')+_0x398495);}_0xf3cc83[_0x247d96[_0xbf86('0x5d')][_0xbf86('0x7d')]]=_0x247d96['body'][_0xbf86('0x81')];})[_0xbf86('0x36')](function(){return db[_0xbf86('0x55')]['find']({'where':{'id':_0x247d96['params']['id']},'include':[{'model':db[_0xbf86('0x82')],'as':_0xbf86('0x83'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf3cc83,'limit':0x1,'order':[[_0xbf86('0x78'),_0xbf86('0x84')]]}]},{'model':db[_0xbf86('0x85')],'as':_0xbf86('0x86')}]});})[_0xbf86('0x36')](handleEntityNotFound(_0x59fae7,null))[_0xbf86('0x36')](function(_0x357fc6){if(_0x357fc6&&_0x357fc6[_0xbf86('0x83')]){_0x1bec8c[_0xbf86('0x87')]=_0x357fc6;_0x1bec8c[_0xbf86('0x88')]=_0x357fc6['Applications'];_0x1bec8c[_0xbf86('0x89')]=_0x357fc6[_0xbf86('0x83')];_0x1bec8c['applications']=_[_0xbf86('0x8a')](_0x1bec8c[_0xbf86('0x88')],[_0xbf86('0x8b')],[_0xbf86('0x8c')]);if(_0x1bec8c[_0xbf86('0x87')]['Applications']){delete _0x1bec8c[_0xbf86('0x87')][_0xbf86('0x86')];}if(_0x1bec8c[_0xbf86('0x87')][_0xbf86('0x83')]&&_0x1bec8c[_0xbf86('0x87')][_0xbf86('0x83')]['Contacts']['length']){return _0x1bec8c[_0xbf86('0x87')][_0xbf86('0x83')][_0xbf86('0x8d')][0x0];}var _0x3c18a3=_['defaults'](_0x247d96[_0xbf86('0x5d')],{'firstName':_0x247d96[_0xbf86('0x5d')][_0xbf86('0x81')],'ListId':_0x357fc6[_0xbf86('0x79')]});_0x3c18a3[_0x247d96[_0xbf86('0x5d')][_0xbf86('0x7d')]]=_0x247d96[_0xbf86('0x5d')]['from'];return db[_0xbf86('0x72')]['create'](_0x3c18a3,{'fields':_0x14c7d0,'raw':!![]});}})[_0xbf86('0x36')](handleEntityNotFound(_0x59fae7,null))[_0xbf86('0x36')](function(_0x1e800f){_0x1bec8c['contact']=_0x1e800f;if(_0x1e800f){var _0x954b6d={'ContactId':_0x1e800f['id'],'OpenchannelAccountId':_0x247d96[_0xbf86('0x5b')]['id'],'from':(_0x1e800f['firstName']||'')+'\x20'+(_0x1e800f[_0xbf86('0x8e')]||'')};var _0x425da5={'OpenchannelAccountId':_0x247d96['params']['id'],'closed':![]};if(_0x247d96['body'][_0xbf86('0x8f')]){_0x425da5[_0xbf86('0x8f')]=_0x247d96[_0xbf86('0x5d')][_0xbf86('0x8f')];return db[_0xbf86('0x90')]['find']({'where':_0x425da5})[_0xbf86('0x36')](function(_0xb5ea00){if(_0xb5ea00){return[_0xb5ea00,![]];}_0x954b6d[_0xbf86('0x8f')]=_0x247d96[_0xbf86('0x5d')][_0xbf86('0x8f')];_0x954b6d[_0xbf86('0x91')]=_0x247d96[_0xbf86('0x5d')][_0xbf86('0x91')];return db[_0xbf86('0x90')][_0xbf86('0x6e')](_0x954b6d)[_0xbf86('0x36')](function(_0x2f216e){return[_0x2f216e,!![]];});});}else{_0x425da5['threadId']=null;}_0x425da5[_0xbf86('0x92')]=_0x1e800f['id'];return db[_0xbf86('0x90')][_0xbf86('0x69')]({'where':_0x425da5})[_0xbf86('0x36')](function(_0x4ac0dd){if(_0x4ac0dd){return[_0x4ac0dd,![]];}return db['OpenchannelInteraction'][_0xbf86('0x6e')](_0x954b6d)[_0xbf86('0x36')](function(_0xdb9550){return[_0xdb9550,!![]];});});}})[_0xbf86('0x93')](function(_0x40837d,_0x36374e){if(_0x40837d){_0x2810a4=_0x36374e;if(!_0x36374e){var _0x2d1ab3={'from':(_0x1bec8c[_0xbf86('0x94')][_0xbf86('0x95')]||'')+'\x20'+(_0x1bec8c[_0xbf86('0x94')]['lastName']||'')};if(_0x247d96[_0xbf86('0x5d')][_0xbf86('0x8f')]&&_0x247d96[_0xbf86('0x5d')][_0xbf86('0x96')]&&_0x247d96[_0xbf86('0x5d')][_0xbf86('0x8f')]!=_0x247d96['body']['messageId']){_0x2d1ab3['threadId']=_0x247d96[_0xbf86('0x5d')][_0xbf86('0x96')];}return _0x40837d[_0xbf86('0x35')](_0x2d1ab3);}else{return _0x40837d;}}})[_0xbf86('0x36')](function(_0x15e83d){_0x1bec8c[_0xbf86('0x97')]=_0x15e83d[_0xbf86('0x37')]({'plain':!![]});_0x1bec8c[_0xbf86('0x97')][_0xbf86('0x98')]=_0x2810a4;if(_0x1bec8c[_0xbf86('0x97')][_0xbf86('0x98')]){if(_0x1bec8c[_0xbf86('0x87')]['autoclose']){_0x1bec8c[_0xbf86('0x88')][_0xbf86('0x99')]({'id':0x0,'priority':_0x1bec8c[_0xbf86('0x88')]['length']+0x1,'app':_0xbf86('0x9a'),'appdata':_0xbf86('0x9b'),'interval':_0xbf86('0x9c')});}}return db[_0xbf86('0x9d')]['create']({'body':_0x247d96[_0xbf86('0x5d')][_0xbf86('0x5d')],'OpenchannelAccountId':_0x247d96[_0xbf86('0x5b')]['id'],'OpenchannelInteractionId':_0x15e83d['id'],'direction':'in','ContactId':_0x1bec8c[_0xbf86('0x94')]['id'],'AttachmentId':_0x247d96[_0xbf86('0x5d')][_0xbf86('0x9e')]});})[_0xbf86('0x36')](function(_0x527669){_0x1bec8c[_0xbf86('0x25')]=_0x527669;if(_0x1bec8c['interaction'][_0xbf86('0x9f')]){return db[_0xbf86('0xa0')][_0xbf86('0x69')]({'attributes':['id',_0xbf86('0x3c')],'where':{'id':_0x1bec8c[_0xbf86('0x97')]['UserId']}})[_0xbf86('0x36')](function(_0x9f5f51){if(_0x9f5f51){_0x1bec8c[_0xbf86('0x88')][_0xbf86('0xa1')]({'id':0x0,'priority':0x0,'app':_0xbf86('0xa2'),'appdata':_0x9f5f51['name']+','+(_0x1bec8c[_0xbf86('0x87')][_0xbf86('0xa3')]||0xa),'interval':'*,*,*,*'});_0x1bec8c[_0xbf86('0xa4')]=![];}return respondWithRpcPromise('Start',_0xbf86('0xa5'),_0x1bec8c);});}return respondWithRpcPromise(_0xbf86('0xa6'),_0xbf86('0xa5'),_0x1bec8c);})[_0xbf86('0x36')](function(_0x4f4fe4){respondWithRpcPromise(_0xbf86('0xa7'),'EventManager',{'event':'notify','message':_0x4f4fe4},client9002);return _0x4f4fe4;})[_0xbf86('0x36')](respondWithResult(_0x59fae7,null))[_0xbf86('0x27')](handleError(_0x59fae7,null));};exports[_0xbf86('0xa8')]=function(_0x27cc56,_0x40d0e1){var _0x40e121=_0x27cc56[_0xbf86('0x5b')]['id'];var _0x30945c=_0x27cc56[_0xbf86('0x5d')];var _0x34bbbe=0xc8;var _0x431570=null;return db[_0xbf86('0xa9')][_0xbf86('0xaa')]({'isolationLevel':db[_0xbf86('0xa9')]['Transaction'][_0xbf86('0xab')][_0xbf86('0xac')]},function(_0x28490b){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x40e121},'transaction':_0x28490b})['then'](function(_0xf8daaf){if(_0xf8daaf){return db[_0xbf86('0x85')][_0xbf86('0x3a')]({'where':{'OpenchannelAccountId':_0x40e121},'transaction':_0x28490b})[_0xbf86('0x36')](function(){var _0x5a49c1=_['map'](_0x30945c,function(_0x2f58da){_0x2f58da[_0xbf86('0x65')]=_0x40e121;return _0x2f58da;});return db[_0xbf86('0x85')][_0xbf86('0xad')](_0x5a49c1,{'transaction':_0x28490b});});}else{_0x34bbbe=0x194;_0x431570=[];}});})['then'](function(){if(_0x34bbbe!==0x194){return db[_0xbf86('0x85')][_0xbf86('0xae')]({'where':{'OpenchannelAccountId':_0x40e121},'order':'priority'})[_0xbf86('0x36')](function(_0x2ebe55){_0x431570=_0x2ebe55;});}})['catch'](function(_0x852d6d){_0x34bbbe=0x1f4;logger['error'](_0x852d6d['stack']);if(_0x852d6d[_0xbf86('0x3c')]){delete _0x852d6d[_0xbf86('0x3c')];}_0x431570=_0x852d6d;})[_0xbf86('0xaf')](function(){if(_0x431570===null){_0x40d0e1['sendStatus'](_0x34bbbe);}else{if(_0x34bbbe===0x1f4){_0x40d0e1['status'](_0x34bbbe)[_0xbf86('0x3d')](_0x431570);}else{_0x40d0e1['status'](_0x34bbbe)[_0xbf86('0x2b')](_0x431570);}}});};exports[_0xbf86('0xb0')]=function(_0x133849,_0x4edf9c,_0x4f09b1){var _0x4c61d5={};var _0x36c14f={};var _0xfb8f3d;var _0x22e401;return db[_0xbf86('0x55')][_0xbf86('0x68')]({'where':{'id':_0x133849['params']['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x4edf9c,null))[_0xbf86('0x36')](function(_0x18e7a2){if(_0x18e7a2){_0xfb8f3d=_0x18e7a2;_0x36c14f[_0xbf86('0x44')]=_['keys'](db[_0xbf86('0x85')][_0xbf86('0x41')]);_0x36c14f[_0xbf86('0x46')]=_['keys'](_0x133849[_0xbf86('0x46')]);_0x36c14f['filters']=_[_0xbf86('0x48')](_0x36c14f[_0xbf86('0x44')],_0x36c14f[_0xbf86('0x46')]);_0x4c61d5[_0xbf86('0x49')]=_['intersection'](_0x36c14f['model'],qs['fields'](_0x133849[_0xbf86('0x46')][_0xbf86('0x4a')]));_0x4c61d5['attributes']=_0x4c61d5[_0xbf86('0x49')][_0xbf86('0x4b')]?_0x4c61d5[_0xbf86('0x49')]:_0x36c14f['model'];_0x4c61d5[_0xbf86('0x4e')]=qs[_0xbf86('0x4f')](_0x133849['query']['sort']);_0x4c61d5[_0xbf86('0x50')]=qs[_0xbf86('0x47')](_[_0xbf86('0x51')](_0x133849[_0xbf86('0x46')],_0x36c14f[_0xbf86('0x47')]));if(_0x133849[_0xbf86('0x46')][_0xbf86('0x52')]){_0x4c61d5['where']=_[_0xbf86('0x53')](_0x4c61d5[_0xbf86('0x50')],{'$or':_[_0xbf86('0x40')](_0x4c61d5['attributes'],function(_0x31652e){var _0x419ea7={};_0x419ea7[_0x31652e]={'$like':'%'+_0x133849[_0xbf86('0x46')]['filter']+'%'};return _0x419ea7;})});}_0x4c61d5=_['merge']({},_0x4c61d5,_0x133849[_0xbf86('0x54')]);return _0xfb8f3d['getApplications'](_0x4c61d5);}})[_0xbf86('0x36')](function(_0x1755a7){if(_0x1755a7){_0x22e401=_0x1755a7[_0xbf86('0x4b')];if(!_0x133849[_0xbf86('0x46')][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x4c61d5[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0x133849[_0xbf86('0x46')]['limit']);_0x4c61d5['offset']=qs['offset'](_0x133849[_0xbf86('0x46')][_0xbf86('0x2c')]);}return _0xfb8f3d[_0xbf86('0xb0')](_0x4c61d5);}})[_0xbf86('0x36')](function(_0x16eb2e){if(_0x16eb2e){return _0x16eb2e?{'count':_0x22e401,'rows':_0x16eb2e}:null;}})['then'](respondWithResult(_0x4edf9c,null))['catch'](handleError(_0x4edf9c,null));};exports[_0xbf86('0xb1')]=function(_0xb59ab3,_0x2169c3,_0x33ae40){var _0x1d4eb7={'raw':![],'where':{}};var _0x3c022f={};var _0x368c9c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xbf86('0x68')]({'where':{'id':_0xb59ab3[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x2169c3,null))[_0xbf86('0x36')](function(_0x5eac9b){if(_0x5eac9b){_0x3c022f[_0xbf86('0x44')]=_[_0xbf86('0x45')](db[_0xbf86('0x90')]['rawAttributes']);_0x3c022f[_0xbf86('0x46')]=_[_0xbf86('0x45')](_0xb59ab3[_0xbf86('0x46')]);_0x3c022f[_0xbf86('0x47')]=_['intersection'](_0x3c022f[_0xbf86('0x44')],_0x3c022f[_0xbf86('0x46')]);_0x1d4eb7['attributes']=_[_0xbf86('0x48')](_0x3c022f[_0xbf86('0x44')],qs['fields'](_0xb59ab3[_0xbf86('0x46')]['fields']));_0x1d4eb7[_0xbf86('0x49')]=_0x1d4eb7[_0xbf86('0x49')][_0xbf86('0x4b')]?_0x1d4eb7[_0xbf86('0x49')]:_0x3c022f['model'];if(!_0xb59ab3[_0xbf86('0x46')][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x1d4eb7[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0xb59ab3[_0xbf86('0x46')][_0xbf86('0x2f')]);_0x1d4eb7[_0xbf86('0x2c')]=qs[_0xbf86('0x2c')](_0xb59ab3[_0xbf86('0x46')][_0xbf86('0x2c')]);}_0x1d4eb7[_0xbf86('0x4e')]=qs[_0xbf86('0x4f')](_0xb59ab3[_0xbf86('0x46')][_0xbf86('0x4f')]);_0x1d4eb7[_0xbf86('0x50')]=qs[_0xbf86('0x47')](_[_0xbf86('0x51')](_0xb59ab3[_0xbf86('0x46')],_0x3c022f[_0xbf86('0x47')]));_0x1d4eb7[_0xbf86('0x50')]['OpenchannelAccountId']=_0x5eac9b['id'];if(_0xb59ab3['query']['filter']){_0x1d4eb7['where']=_[_0xbf86('0x53')](_0x1d4eb7[_0xbf86('0x50')],{'$or':_[_0xbf86('0x40')](_0x1d4eb7[_0xbf86('0x49')],function(_0x453d9c){var _0x44c8e2={};_0x44c8e2[_0x453d9c]={'$like':'%'+_0xb59ab3[_0xbf86('0x46')][_0xbf86('0x52')]+'%'};return _0x44c8e2;})});}_0x1d4eb7=_[_0xbf86('0x53')]({},_0x1d4eb7,_0xb59ab3[_0xbf86('0x54')]);return db[_0xbf86('0x90')][_0xbf86('0x2e')]({'where':_0x1d4eb7[_0xbf86('0x50')]})['then'](function(_0x999357){_0x368c9c[_0xbf86('0x2e')]=_0x999357;if(_0xb59ab3['query']['includeAll']){_0x1d4eb7['include']=[{'model':db[_0xbf86('0x72')],'as':_0xbf86('0xb2'),'required':![]},{'model':db[_0xbf86('0xa0')],'as':_0xbf86('0xb3'),'attributes':['name',_0xbf86('0xb4'),'internal'],'required':![]},{'model':db[_0xbf86('0xb5')],'as':'Tags','attributes':['id','name','color'],'where':_0xb59ab3[_0xbf86('0x46')]['tag']?{'id':_0xb59ab3[_0xbf86('0x46')][_0xbf86('0xb6')]}:undefined,'required':_0xb59ab3[_0xbf86('0x46')][_0xbf86('0xb6')]?!![]:![]}];}return db[_0xbf86('0x90')][_0xbf86('0x58')](_0x1d4eb7);})[_0xbf86('0x36')](function(_0x116ebd){_0x368c9c[_0xbf86('0x59')]=_0x116ebd;return _0x368c9c;});}})[_0xbf86('0x36')](respondWithFilteredResult(_0x2169c3,_0x1d4eb7))[_0xbf86('0x27')](handleError(_0x2169c3,null));};exports[_0xbf86('0xb7')]=function(_0x51724b,_0x5e9656,_0x293f88){return db[_0xbf86('0x55')]['find']({'where':{'id':_0x51724b[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x5e9656,null))[_0xbf86('0x36')](function(_0x433435){if(_0x433435){return _0x433435[_0xbf86('0xb7')](_0x51724b[_0xbf86('0x5d')][_0xbf86('0x6b')],_[_0xbf86('0xb8')](_0x51724b['body'],[_0xbf86('0x6b'),'id'])||{})[_0xbf86('0x93')](function(_0x586dbb){for(var _0x57a8d4=0x0;_0x57a8d4<_0x51724b['body'][_0xbf86('0x6b')]['length'];_0x57a8d4+=0x1){socket[_0xbf86('0xb9')](_0xbf86('0xba'),{'UserId':Number(_0x51724b[_0xbf86('0x5d')]['ids'][_0x57a8d4]),'OpenchannelAccountId':Number(_0x51724b[_0xbf86('0x5b')]['id'])});}return _0x586dbb;});}})[_0xbf86('0x36')](respondWithResult(_0x5e9656,null))[_0xbf86('0x27')](handleError(_0x5e9656,null));};exports[_0xbf86('0xbb')]=function(_0x3dc7f3,_0x293ce5,_0x2aa47b){return db[_0xbf86('0x55')][_0xbf86('0x69')]({'where':{'id':_0x3dc7f3[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x293ce5,null))[_0xbf86('0x36')](function(_0x196f1f){if(_0x196f1f){return _0x196f1f[_0xbf86('0xbb')](_0x3dc7f3[_0xbf86('0x46')][_0xbf86('0x6b')])[_0xbf86('0x36')](function(){if(_[_0xbf86('0xbc')](_0x3dc7f3[_0xbf86('0x46')]['ids'])){for(var _0x44efe6=0x0;_0x44efe6<_0x3dc7f3[_0xbf86('0x46')][_0xbf86('0x6b')][_0xbf86('0x4b')];_0x44efe6+=0x1){socket[_0xbf86('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3dc7f3[_0xbf86('0x46')]['ids'][_0x44efe6]),'OpenchannelAccountId':Number(_0x3dc7f3['params']['id'])});}}else{socket[_0xbf86('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3dc7f3[_0xbf86('0x46')]['ids']),'OpenchannelAccountId':Number(_0x3dc7f3[_0xbf86('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x293ce5,null))[_0xbf86('0x27')](handleError(_0x293ce5,null));};exports[_0xbf86('0xbd')]=function(_0x5e0899,_0x15faea,_0x388c59){var _0x235860={};var _0x46d4d4={};var _0x3d4f14;var _0x5139c5;return db[_0xbf86('0x55')][_0xbf86('0x68')]({'where':{'id':_0x5e0899[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x15faea,null))[_0xbf86('0x36')](function(_0x2001b0){if(_0x2001b0){_0x3d4f14=_0x2001b0;_0x46d4d4['model']=_[_0xbf86('0x45')](db['User'][_0xbf86('0x41')]);_0x46d4d4['query']=_[_0xbf86('0x45')](_0x5e0899['query']);_0x46d4d4[_0xbf86('0x47')]=_['intersection'](_0x46d4d4[_0xbf86('0x44')],_0x46d4d4[_0xbf86('0x46')]);_0x235860[_0xbf86('0x49')]=_['intersection'](_0x46d4d4[_0xbf86('0x44')],qs['fields'](_0x5e0899[_0xbf86('0x46')][_0xbf86('0x4a')]));_0x235860[_0xbf86('0x49')]=_0x235860[_0xbf86('0x49')][_0xbf86('0x4b')]?_0x235860[_0xbf86('0x49')]:_0x46d4d4[_0xbf86('0x44')];_0x235860['order']=qs[_0xbf86('0x4f')](_0x5e0899['query']['sort']);_0x235860[_0xbf86('0x50')]=qs[_0xbf86('0x47')](_[_0xbf86('0x51')](_0x5e0899[_0xbf86('0x46')],_0x46d4d4[_0xbf86('0x47')]));if(_0x5e0899[_0xbf86('0x46')][_0xbf86('0x52')]){_0x235860[_0xbf86('0x50')]=_['merge'](_0x235860['where'],{'$or':_[_0xbf86('0x40')](_0x235860[_0xbf86('0x49')],function(_0x1f7498){var _0x22bdca={};_0x22bdca[_0x1f7498]={'$like':'%'+_0x5e0899['query'][_0xbf86('0x52')]+'%'};return _0x22bdca;})});}_0x235860=_[_0xbf86('0x53')]({},_0x235860,_0x5e0899[_0xbf86('0x54')]);return _0x3d4f14[_0xbf86('0xbd')](_0x235860);}})['then'](function(_0x31ac68){if(_0x31ac68){_0x5139c5=_0x31ac68['length'];if(!_0x5e0899['query'][_0xbf86('0x4c')](_0xbf86('0x4d'))){_0x235860[_0xbf86('0x2f')]=qs[_0xbf86('0x2f')](_0x5e0899[_0xbf86('0x46')][_0xbf86('0x2f')]);_0x235860[_0xbf86('0x2c')]=qs[_0xbf86('0x2c')](_0x5e0899['query'][_0xbf86('0x2c')]);}return _0x3d4f14[_0xbf86('0xbd')](_0x235860);}})['then'](function(_0x399047){if(_0x399047){return _0x399047?{'count':_0x5139c5,'rows':_0x399047}:null;}})[_0xbf86('0x36')](respondWithResult(_0x15faea,null))[_0xbf86('0x27')](handleError(_0x15faea,null));};exports[_0xbf86('0x3d')]=function(_0x1597ca,_0x17e098,_0x1dead6){var _0x25ac4a,_0x522c68,_0x14dac9;if(_[_0xbf86('0x7a')](_0x1597ca['body']['body'])||_0x1597ca['body'][_0xbf86('0x5d')]===''){throw new db[(_0xbf86('0x73'))][(_0xbf86('0x74'))](_0xbf86('0x7c'));}if(_[_0xbf86('0x7a')](_0x1597ca[_0xbf86('0x5d')]['to'])){}_0x25ac4a=_0x1597ca['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1597ca[_0xbf86('0x5b')]['id']}})[_0xbf86('0x36')](handleEntityNotFound(_0x17e098,null))['then'](function(_0x35fc5f){if(_0x35fc5f){return db['OpenchannelAccount']['find']({'where':{'id':_0x35fc5f['id']},'include':[{'model':db['CmList'],'as':_0xbf86('0x83'),'include':[{'model':db[_0xbf86('0x72')],'as':'Contacts','where':{[_0x35fc5f[_0xbf86('0x7d')]]:_0x25ac4a},'limit':0x1,'order':[[_0xbf86('0x78'),'DESC']]}]}]})[_0xbf86('0x36')](handleEntityNotFound(_0x17e098,null))[_0xbf86('0x36')](function(_0x3bcd3b){if(_0x3bcd3b&&_0x3bcd3b[_0xbf86('0x83')]){_0x522c68=_0x3bcd3b[_0xbf86('0x37')]({'plain':!![]});if(_0x522c68['List']&&_0x522c68[_0xbf86('0x83')]['Contacts'][_0xbf86('0x4b')]){return _0x522c68[_0xbf86('0x83')]['Contacts'][0x0];}return db['CmContact'][_0xbf86('0x6e')](_[_0xbf86('0x18')](_0x1597ca[_0xbf86('0x5d')],{'firstName':_0x25ac4a,[_0x3bcd3b[_0xbf86('0x7d')]]:_0x25ac4a,'phone':_0x25ac4a,'ListId':_0x522c68[_0xbf86('0x79')]}));}})[_0xbf86('0x36')](handleEntityNotFound(_0x17e098,null))[_0xbf86('0x36')](function(_0xf775b5){if(_0xf775b5){_0x14dac9=_0xf775b5;return db[_0xbf86('0x90')][_0xbf86('0x69')]({'where':{'ContactId':_0x14dac9['id'],'closed':![],'OpenchannelAccountId':_0x522c68['id']}})[_0xbf86('0x36')](function(_0x50c1ea){if(_0x50c1ea){return[_0x50c1ea,![]];}return db[_0xbf86('0x90')]['create']({'UserId':_0x1597ca[_0xbf86('0x5e')]['id'],'ContactId':_0x14dac9['id'],'OpenchannelAccountId':_0x522c68['id'],'lastMsgDirection':_0xbf86('0xbe'),'Messages':[_[_0xbf86('0x53')](_0x1597ca[_0xbf86('0x5d')],{'read':![],'body':_0x1597ca[_0xbf86('0x5d')]['body'],'OpenchannelAccountId':_0x522c68['id'],'UserId':_0x1597ca[_0xbf86('0x5e')]['id'],'ContactId':_0x14dac9['id']})]},{'include':[{'model':db[_0xbf86('0x9d')],'as':_0xbf86('0xbf')}]})[_0xbf86('0x36')](function(_0x531ac9){return[_0x531ac9,!![]];});});}})[_0xbf86('0x93')](function(_0x309adc,_0x1fdda7){if(_0x1fdda7){return _0x309adc;}return db[_0xbf86('0x9d')]['create'](_[_0xbf86('0x53')](_0x1597ca['body'],{'read':![],'body':_0x1597ca[_0xbf86('0x5d')]['body'],'OpenchannelAccountId':_0x522c68['id'],'OpenchannelInteractionId':_0x309adc['id'],'UserId':_0x1597ca['user']['id'],'ContactId':_0x14dac9['id']}))[_0xbf86('0x36')](function(_0x1f2eae){_0x309adc['dataValues'][_0xbf86('0xbf')]=[];_0x309adc[_0xbf86('0xc0')][_0xbf86('0xbf')]['push'](_0x1f2eae[_0xbf86('0xc0')]);return _0x309adc;});});}})[_0xbf86('0x36')](respondWithResult(_0x17e098,null))['catch'](handleError(_0x17e098,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1a057b5..8ff352c 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xb688,0xcf));var _0x8b68=function(_0x38674e,_0x170f1e){_0x38674e=_0x38674e-0x0;var _0x282a8a=_0xb688[_0x38674e];return _0x282a8a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x0bb5,0x148));var _0x50bb=function(_0x9f475,_0x58e07d){_0x9f475=_0x9f475-0x0;var _0x54c32a=_0x0bb5[_0x9f475];return _0x54c32a;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4dec48c..232f80f 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(_0x33bcc8,_0x3202bd){var _0x2c1d9e=function(_0x57ecc2){while(--_0x57ecc2){_0x33bcc8['push'](_0x33bcc8['shift']());}};_0x2c1d9e(++_0x3202bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4c91f9,_0x2af9f2){var _0x5aade6=function(_0x3dafec){while(--_0x3dafec){_0x4c91f9['push'](_0x4c91f9['shift']());}};_0x5aade6(++_0x2af9f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 88acf45..18bdf3c 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 _0x91a7=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x24ec36,_0x45a859){var _0x36d9e5=function(_0x8a976a){while(--_0x8a976a){_0x24ec36['push'](_0x24ec36['shift']());}};_0x36d9e5(++_0x45a859);}(_0x91a7,0xe7));var _0x791a=function(_0x68a527,_0x1fd67f){_0x68a527=_0x68a527-0x0;var _0x4cf8b9=_0x91a7[_0x68a527];return _0x4cf8b9;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});config['redis']=_[_0x791a('0x8')](config[_0x791a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x791a('0xa'))(new Redis(config[_0x791a('0x9')]));require(_0x791a('0xb'))[_0x791a('0xc')](socket);function respondWithRpcPromise(_0x266e4b,_0x5249d5,_0x21f0e0){return new BPromise(function(_0x38f7c2,_0x57e99c){return client[_0x791a('0xd')](_0x266e4b,_0x21f0e0)[_0x791a('0xe')](function(_0x167bc4){logger[_0x791a('0xf')](_0x791a('0x10'),_0x5249d5,_0x791a('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5249d5,_0x791a('0x11'),JSON[_0x791a('0x12')](_0x167bc4));if(_0x167bc4['error']){if(_0x167bc4[_0x791a('0x13')][_0x791a('0x14')]===0x1f4){logger['error'](_0x791a('0x10'),_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x57e99c(_0x167bc4[_0x791a('0x13')]['message']);}logger[_0x791a('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x38f7c2(_0x167bc4['error'][_0x791a('0x15')]);}else{logger['info'](_0x791a('0x10'),_0x5249d5,'request\x20sent');_0x38f7c2(_0x167bc4['result']['message']);}})[_0x791a('0x16')](function(_0x52fa43){logger['error'](_0x791a('0x10'),_0x5249d5,_0x52fa43);_0x57e99c(_0x52fa43);});});} \ No newline at end of file +var _0xa5fa=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x44d797,_0x276017){_0x44d797=_0x44d797-0x0;var _0x4005c2=_0xa5fa[_0x44d797];return _0x4005c2;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./openchannelAccount.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 53db8ef..8ff2349 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 _0x238f=['emit','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x1c44f6,_0x474d54){var _0x2dcceb=function(_0x183658){while(--_0x183658){_0x1c44f6['push'](_0x1c44f6['shift']());}};_0x2dcceb(++_0x474d54);}(_0x238f,0xa5));var _0xf238=function(_0x5043b2,_0x2918b2){_0x5043b2=_0x5043b2-0x0;var _0x8ad2dd=_0x238f[_0x5043b2];return _0x8ad2dd;};'use strict';var OpenchannelAccountEvents=require(_0xf238('0x0'));var events=[_0xf238('0x1'),_0xf238('0x2'),'update'];function createListener(_0x39ae5c,_0x1cfe0e){return function(_0xae5dfd){_0x1cfe0e[_0xf238('0x3')](_0x39ae5c,_0xae5dfd);};}function removeListener(_0x1bd4aa,_0xfcef92){return function(){OpenchannelAccountEvents['removeListener'](_0x1bd4aa,_0xfcef92);};}exports[_0xf238('0x4')]=function(_0x2b9e9f){for(var _0x4e4685=0x0,_0x549a61=events[_0xf238('0x5')];_0x4e4685<_0x549a61;_0x4e4685++){var _0x5432d0=events[_0x4e4685];var _0x430297=createListener(_0xf238('0x6')+_0x5432d0,_0x2b9e9f);OpenchannelAccountEvents['on'](_0x5432d0,_0x430297);}}; \ No newline at end of file +var _0x24a6=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x1bc5a1,_0x56c77b){var _0x43385d=function(_0x59954b){while(--_0x59954b){_0x1bc5a1['push'](_0x1bc5a1['shift']());}};_0x43385d(++_0x56c77b);}(_0x24a6,0x14f));var _0x624a=function(_0x208413,_0x309b03){_0x208413=_0x208413-0x0;var _0x539e4b=_0x24a6[_0x208413];return _0x539e4b;};'use strict';var OpenchannelAccountEvents=require(_0x624a('0x0'));var events=['save',_0x624a('0x1'),_0x624a('0x2')];function createListener(_0x1d3f5e,_0x346672){return function(_0x3074cb){_0x346672[_0x624a('0x3')](_0x1d3f5e,_0x3074cb);};}function removeListener(_0x389f10,_0x1355d3){return function(){OpenchannelAccountEvents[_0x624a('0x4')](_0x389f10,_0x1355d3);};}exports[_0x624a('0x5')]=function(_0x14fc3e){for(var _0x325aea=0x0,_0x1af370=events[_0x624a('0x6')];_0x325aea<_0x1af370;_0x325aea++){var _0x58243=events[_0x325aea];var _0x40cb85=createListener(_0x624a('0x7')+_0x58243,_0x14fc3e);OpenchannelAccountEvents['on'](_0x58243,_0x40cb85);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2bd02ab..224cf7a 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 _0x56f2=['post','create','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3503be,_0x38966c){var _0xec5211=function(_0x2cd96a){while(--_0x2cd96a){_0x3503be['push'](_0x3503be['shift']());}};_0xec5211(++_0x38966c);}(_0x56f2,0x70));var _0x256f=function(_0x4d2de1,_0x195d9e){_0x4d2de1=_0x4d2de1-0x0;var _0x4ef2a3=_0x56f2[_0x4d2de1];return _0x4ef2a3;};'use strict';var multer=require(_0x256f('0x0'));var util=require('util');var path=require(_0x256f('0x1'));var timeout=require(_0x256f('0x2'));var express=require(_0x256f('0x3'));var router=express[_0x256f('0x4')]();var fs_extra=require(_0x256f('0x5'));var auth=require(_0x256f('0x6'));var interaction=require(_0x256f('0x7'));var config=require(_0x256f('0x8'));var controller=require(_0x256f('0x9'));router[_0x256f('0xa')]('/',auth['isAuthenticated'](),controller[_0x256f('0xb')]);router[_0x256f('0xa')](_0x256f('0xc'),auth[_0x256f('0xd')](),controller['show']);router[_0x256f('0xe')]('/',auth[_0x256f('0xd')](),controller[_0x256f('0xf')]);router['put'](_0x256f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x256f('0x10')](_0x256f('0xc'),auth[_0x256f('0xd')](),controller['destroy']);module[_0x256f('0x11')]=router; \ No newline at end of file +var _0xa0db=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','/:id','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0db,0x114));var _0xba0d=function(_0x26bcf4,_0xfbf0e2){_0x26bcf4=_0x26bcf4-0x0;var _0x23d021=_0xa0db[_0x26bcf4];return _0x23d021;};'use strict';var multer=require(_0xba0d('0x0'));var util=require('util');var path=require(_0xba0d('0x1'));var timeout=require(_0xba0d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba0d('0x3'));var interaction=require(_0xba0d('0x4'));var config=require(_0xba0d('0x5'));var controller=require('./openchannelApplication.controller');router[_0xba0d('0x6')]('/',auth[_0xba0d('0x7')](),controller[_0xba0d('0x8')]);router['get']('/:id',auth[_0xba0d('0x7')](),controller['show']);router['post']('/',auth[_0xba0d('0x7')](),controller[_0xba0d('0x9')]);router['put'](_0xba0d('0xa'),auth[_0xba0d('0x7')](),controller[_0xba0d('0xb')]);router[_0xba0d('0xc')]('/:id',auth[_0xba0d('0x7')](),controller[_0xba0d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 21c185c..513cdfd 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 _0xba70=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xba70,0x183));var _0x0ba7=function(_0x149f86,_0x373607){_0x149f86=_0x149f86-0x0;var _0x596e2c=_0xba70[_0x149f86];return _0x596e2c;};'use strict';var Sequelize=require(_0x0ba7('0x0'));module[_0x0ba7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0ba7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0ba7('0x3')]()},'description':{'type':Sequelize[_0x0ba7('0x2')]},'interval':{'type':Sequelize[_0x0ba7('0x2')],'defaultValue':_0x0ba7('0x4')}}; \ No newline at end of file +var _0x13d1=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x4e37bc,_0x8174e7){var _0x48a8b7=function(_0x458409){while(--_0x458409){_0x4e37bc['push'](_0x4e37bc['shift']());}};_0x48a8b7(++_0x8174e7);}(_0x13d1,0x8a));var _0x113d=function(_0x59b395,_0x3715d7){_0x59b395=_0x59b395-0x0;var _0x319507=_0x13d1[_0x59b395];return _0x319507;};'use strict';var Sequelize=require(_0x113d('0x0'));module[_0x113d('0x1')]={'priority':{'type':Sequelize[_0x113d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x113d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x113d('0x4')]()},'description':{'type':Sequelize[_0x113d('0x3')]},'interval':{'type':Sequelize[_0x113d('0x3')],'defaultValue':_0x113d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 66f27e2..a64d030 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 _0x697e=['stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','map','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','keys','include','catch','body','params','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x1dfe19,_0x598e52){var _0x397646=function(_0x535546){while(--_0x535546){_0x1dfe19['push'](_0x1dfe19['shift']());}};_0x397646(++_0x598e52);}(_0x697e,0x190));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe697('0x0'));var rimraf=require(_0xe697('0x1'));var zipdir=require(_0xe697('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe697('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe697('0x4'));var util=require(_0xe697('0x5'));var path=require(_0xe697('0x6'));var sox=require(_0xe697('0x7'));var csv=require(_0xe697('0x8'));var ejs=require(_0xe697('0x9'));var fs=require('fs');var fs_extra=require(_0xe697('0xa'));var _=require('lodash');var squel=require(_0xe697('0xb'));var crypto=require(_0xe697('0xc'));var jsforce=require(_0xe697('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe697('0xe'));var Papa=require(_0xe697('0xf'));var Redis=require(_0xe697('0x10'));var authService=require(_0xe697('0x11'));var qs=require(_0xe697('0x12'));var as=require(_0xe697('0x13'));var hardwareService=require(_0xe697('0x14'));var logger=require(_0xe697('0x15'))('api');var utils=require(_0xe697('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe697('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a6c83,_0x554105){_0x554105=_0x554105||0xcc;return function(_0x5a7b25){if(_0x5a7b25){return _0x4a6c83['sendStatus'](_0x554105);}return _0x4a6c83[_0xe697('0x18')](_0x554105)['end']();};}function respondWithResult(_0x5750cf,_0x5cfb67){_0x5cfb67=_0x5cfb67||0xc8;return function(_0xef3a0f){if(_0xef3a0f){return _0x5750cf[_0xe697('0x18')](_0x5cfb67)[_0xe697('0x19')](_0xef3a0f);}};}function respondWithFilteredResult(_0x484a3b,_0x3523ac){return function(_0x593cdd){if(_0x593cdd){var _0xa867b3=typeof _0x3523ac[_0xe697('0x1a')]==='undefined'&&typeof _0x3523ac['limit']===_0xe697('0x1b');var _0x4de670=_0x593cdd[_0xe697('0x1c')];var _0x3cd905=_0xa867b3?0x0:_0x3523ac[_0xe697('0x1a')];var _0xfbd55e=_0xa867b3?_0x593cdd[_0xe697('0x1c')]:_0x3523ac[_0xe697('0x1a')]+_0x3523ac[_0xe697('0x1d')];var _0x242e6a;if(_0xfbd55e>=_0x4de670){_0xfbd55e=_0x4de670;_0x242e6a=0xc8;}else{_0x242e6a=0xce;}_0x484a3b[_0xe697('0x18')](_0x242e6a);return _0x484a3b[_0xe697('0x1e')](_0xe697('0x1f'),_0x3cd905+'-'+_0xfbd55e+'/'+_0x4de670)[_0xe697('0x19')](_0x593cdd);}return null;};}function patchUpdates(_0x24017c){return function(_0x1d14c1){try{jsonpatch[_0xe697('0x20')](_0x1d14c1,_0x24017c,!![]);}catch(_0x1fae95){return BPromise[_0xe697('0x21')](_0x1fae95);}return _0x1d14c1['save']();};}function saveUpdates(_0x5c7d0e,_0x40a090){return function(_0x34b46e){if(_0x34b46e){return _0x34b46e[_0xe697('0x22')](_0x5c7d0e)[_0xe697('0x23')](function(_0x4c267a){return _0x4c267a;});}return null;};}function removeEntity(_0x56729f,_0x137b9d){return function(_0x25ded0){if(_0x25ded0){return _0x25ded0[_0xe697('0x24')]()[_0xe697('0x23')](function(){_0x56729f['status'](0xcc)[_0xe697('0x25')]();});}};}function handleEntityNotFound(_0x680bf8,_0x21ef78){return function(_0x1f8083){if(!_0x1f8083){_0x680bf8['sendStatus'](0x194);}return _0x1f8083;};}function handleError(_0x446a1c,_0x179424){_0x179424=_0x179424||0x1f4;return function(_0x28f6f9){logger['error'](_0x28f6f9[_0xe697('0x26')]);if(_0x28f6f9[_0xe697('0x27')]){delete _0x28f6f9[_0xe697('0x27')];}_0x446a1c[_0xe697('0x18')](_0x179424)[_0xe697('0x28')](_0x28f6f9);};}exports[_0xe697('0x29')]=function(_0x8156c2,_0x533ef9){var _0x26f3cd={},_0x2bc81={},_0x1d8037={'count':0x0,'rows':[]};var _0x567096=_['map'](db[_0xe697('0x2a')][_0xe697('0x2b')],function(_0x17f14c){return{'name':_0x17f14c[_0xe697('0x2c')],'type':_0x17f14c[_0xe697('0x2d')][_0xe697('0x2e')]};});_0x2bc81['model']=_[_0xe697('0x2f')](_0x567096,'name');_0x2bc81['query']=_['keys'](_0x8156c2[_0xe697('0x30')]);_0x2bc81['filters']=_[_0xe697('0x31')](_0x2bc81['model'],_0x2bc81['query']);_0x26f3cd[_0xe697('0x32')]=_['intersection'](_0x2bc81['model'],qs[_0xe697('0x33')](_0x8156c2[_0xe697('0x30')][_0xe697('0x33')]));_0x26f3cd['attributes']=_0x26f3cd[_0xe697('0x32')][_0xe697('0x34')]?_0x26f3cd[_0xe697('0x32')]:_0x2bc81[_0xe697('0x35')];if(!_0x8156c2[_0xe697('0x30')][_0xe697('0x36')](_0xe697('0x37'))){_0x26f3cd[_0xe697('0x1d')]=qs['limit'](_0x8156c2['query'][_0xe697('0x1d')]);_0x26f3cd[_0xe697('0x1a')]=qs['offset'](_0x8156c2[_0xe697('0x30')][_0xe697('0x1a')]);}_0x26f3cd['order']=qs[_0xe697('0x38')](_0x8156c2[_0xe697('0x30')][_0xe697('0x38')]);_0x26f3cd['where']=qs['filters'](_[_0xe697('0x39')](_0x8156c2[_0xe697('0x30')],_0x2bc81[_0xe697('0x3a')]),_0x567096);if(_0x8156c2[_0xe697('0x30')][_0xe697('0x3b')]){_0x26f3cd[_0xe697('0x3c')]=_[_0xe697('0x3d')](_0x26f3cd['where'],{'$or':_[_0xe697('0x2f')](_0x567096,function(_0x3b1a48){if(_0x3b1a48['type']!==_0xe697('0x3e')){var _0x54a52e={};_0x54a52e[_0x3b1a48[_0xe697('0x27')]]={'$like':'%'+_0x8156c2[_0xe697('0x30')][_0xe697('0x3b')]+'%'};return _0x54a52e;}})});}_0x26f3cd=_[_0xe697('0x3d')]({},_0x26f3cd,_0x8156c2[_0xe697('0x3f')]);var _0x26e0d6={'where':_0x26f3cd['where']};return db[_0xe697('0x2a')][_0xe697('0x1c')](_0x26e0d6)[_0xe697('0x23')](function(_0x558253){_0x1d8037[_0xe697('0x1c')]=_0x558253;if(_0x8156c2['query'][_0xe697('0x40')]){_0x26f3cd['include']=[{'all':!![]}];}return db[_0xe697('0x2a')][_0xe697('0x41')](_0x26f3cd);})['then'](function(_0x32dbc7){_0x1d8037['rows']=_0x32dbc7;return _0x1d8037;})['then'](respondWithFilteredResult(_0x533ef9,_0x26f3cd))['catch'](handleError(_0x533ef9,null));};exports[_0xe697('0x42')]=function(_0xb93555,_0x23f9cd){var _0x35553d={'raw':!![],'where':{'id':_0xb93555['params']['id']}},_0x58d076={};_0x58d076[_0xe697('0x35')]=_['keys'](db[_0xe697('0x2a')][_0xe697('0x2b')]);_0x58d076[_0xe697('0x30')]=_[_0xe697('0x43')](_0xb93555['query']);_0x58d076[_0xe697('0x3a')]=_[_0xe697('0x31')](_0x58d076[_0xe697('0x35')],_0x58d076[_0xe697('0x30')]);_0x35553d[_0xe697('0x32')]=_[_0xe697('0x31')](_0x58d076[_0xe697('0x35')],qs['fields'](_0xb93555[_0xe697('0x30')][_0xe697('0x33')]));_0x35553d['attributes']=_0x35553d[_0xe697('0x32')]['length']?_0x35553d[_0xe697('0x32')]:_0x58d076[_0xe697('0x35')];if(_0xb93555['query'][_0xe697('0x40')]){_0x35553d[_0xe697('0x44')]=[{'all':!![]}];}_0x35553d=_[_0xe697('0x3d')]({},_0x35553d,_0xb93555['options']);return db[_0xe697('0x2a')]['find'](_0x35553d)[_0xe697('0x23')](handleEntityNotFound(_0x23f9cd,null))[_0xe697('0x23')](respondWithResult(_0x23f9cd,null))[_0xe697('0x45')](handleError(_0x23f9cd,null));};exports['create']=function(_0x318ea3,_0x5178e9){return db['OpenchannelApplication']['create'](_0x318ea3[_0xe697('0x46')],{})[_0xe697('0x23')](respondWithResult(_0x5178e9,0xc9))['catch'](handleError(_0x5178e9,null));};exports['update']=function(_0x5351db,_0xf2d4a4){if(_0x5351db['body']['id']){delete _0x5351db['body']['id'];}return db[_0xe697('0x2a')]['find']({'where':{'id':_0x5351db[_0xe697('0x47')]['id']}})[_0xe697('0x23')](handleEntityNotFound(_0xf2d4a4,null))[_0xe697('0x23')](saveUpdates(_0x5351db[_0xe697('0x46')],null))[_0xe697('0x23')](respondWithResult(_0xf2d4a4,null))['catch'](handleError(_0xf2d4a4,null));};exports[_0xe697('0x24')]=function(_0x22416b,_0x19fc15){return db[_0xe697('0x2a')][_0xe697('0x48')]({'where':{'id':_0x22416b[_0xe697('0x47')]['id']}})['then'](handleEntityNotFound(_0x19fc15,null))['then'](removeEntity(_0x19fc15,null))[_0xe697('0x45')](handleError(_0x19fc15,null));}; \ No newline at end of file +var _0xbfda=['index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','request-promise','moment','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name'];(function(_0x1c23a8,_0x6c16d){var _0x5313bc=function(_0x3a870f){while(--_0x3a870f){_0x1c23a8['push'](_0x1c23a8['shift']());}};_0x5313bc(++_0x6c16d);}(_0xbfda,0xba));var _0xabfd=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0xbfda[_0x68c4d9];return _0x62da93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabfd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xabfd('0x1'));var moment=require(_0xabfd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xabfd('0x3'));var util=require(_0xabfd('0x4'));var path=require(_0xabfd('0x5'));var sox=require(_0xabfd('0x6'));var csv=require('to-csv');var ejs=require(_0xabfd('0x7'));var fs=require('fs');var fs_extra=require(_0xabfd('0x8'));var _=require(_0xabfd('0x9'));var squel=require(_0xabfd('0xa'));var crypto=require(_0xabfd('0xb'));var jsforce=require(_0xabfd('0xc'));var deskjs=require(_0xabfd('0xd'));var toCsv=require(_0xabfd('0xe'));var querystring=require(_0xabfd('0xf'));var Papa=require(_0xabfd('0x10'));var Redis=require(_0xabfd('0x11'));var authService=require(_0xabfd('0x12'));var qs=require(_0xabfd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xabfd('0x14'))(_0xabfd('0x15'));var utils=require(_0xabfd('0x16'));var config=require(_0xabfd('0x17'));var licenseUtil=require(_0xabfd('0x18'));var db=require(_0xabfd('0x19'))['db'];function respondWithStatusCode(_0x11215a,_0x5d7ebb){_0x5d7ebb=_0x5d7ebb||0xcc;return function(_0x258bbf){if(_0x258bbf){return _0x11215a['sendStatus'](_0x5d7ebb);}return _0x11215a[_0xabfd('0x1a')](_0x5d7ebb)[_0xabfd('0x1b')]();};}function respondWithResult(_0x4f2690,_0x2e22d2){_0x2e22d2=_0x2e22d2||0xc8;return function(_0x10b5d0){if(_0x10b5d0){return _0x4f2690['status'](_0x2e22d2)['json'](_0x10b5d0);}};}function respondWithFilteredResult(_0xc1b05f,_0x3b76ab){return function(_0x536258){if(_0x536258){var _0x1fc6bf=typeof _0x3b76ab[_0xabfd('0x1c')]===_0xabfd('0x1d')&&typeof _0x3b76ab[_0xabfd('0x1e')]==='undefined';var _0x1ff6f5=_0x536258[_0xabfd('0x1f')];var _0x356623=_0x1fc6bf?0x0:_0x3b76ab[_0xabfd('0x1c')];var _0x103a49=_0x1fc6bf?_0x536258['count']:_0x3b76ab[_0xabfd('0x1c')]+_0x3b76ab[_0xabfd('0x1e')];var _0x343866;if(_0x103a49>=_0x1ff6f5){_0x103a49=_0x1ff6f5;_0x343866=0xc8;}else{_0x343866=0xce;}_0xc1b05f[_0xabfd('0x1a')](_0x343866);return _0xc1b05f[_0xabfd('0x20')](_0xabfd('0x21'),_0x356623+'-'+_0x103a49+'/'+_0x1ff6f5)['json'](_0x536258);}return null;};}function patchUpdates(_0x4f27d0){return function(_0x1aa041){try{jsonpatch[_0xabfd('0x22')](_0x1aa041,_0x4f27d0,!![]);}catch(_0x4c03af){return BPromise[_0xabfd('0x23')](_0x4c03af);}return _0x1aa041['save']();};}function saveUpdates(_0x4d88db,_0x15b50c){return function(_0x4dbc70){if(_0x4dbc70){return _0x4dbc70[_0xabfd('0x24')](_0x4d88db)[_0xabfd('0x25')](function(_0x4bbc00){return _0x4bbc00;});}return null;};}function removeEntity(_0x3fa42,_0xd7ed8){return function(_0x3fd8d6){if(_0x3fd8d6){return _0x3fd8d6[_0xabfd('0x26')]()[_0xabfd('0x25')](function(){_0x3fa42[_0xabfd('0x1a')](0xcc)[_0xabfd('0x1b')]();});}};}function handleEntityNotFound(_0x2f4187,_0x2cef2f){return function(_0x1c8734){if(!_0x1c8734){_0x2f4187[_0xabfd('0x27')](0x194);}return _0x1c8734;};}function handleError(_0x17a217,_0x4884f4){_0x4884f4=_0x4884f4||0x1f4;return function(_0x3527ad){logger[_0xabfd('0x28')](_0x3527ad['stack']);if(_0x3527ad[_0xabfd('0x29')]){delete _0x3527ad[_0xabfd('0x29')];}_0x17a217[_0xabfd('0x1a')](_0x4884f4)['send'](_0x3527ad);};}exports[_0xabfd('0x2a')]=function(_0x379f64,_0x4b9f28){var _0x40bae2={},_0x4366bf={},_0x4a8eaf={'count':0x0,'rows':[]};var _0x420503=_[_0xabfd('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x4ab723){return{'name':_0x4ab723[_0xabfd('0x2c')],'type':_0x4ab723[_0xabfd('0x2d')][_0xabfd('0x2e')]};});_0x4366bf['model']=_['map'](_0x420503,'name');_0x4366bf[_0xabfd('0x2f')]=_[_0xabfd('0x30')](_0x379f64[_0xabfd('0x2f')]);_0x4366bf[_0xabfd('0x31')]=_[_0xabfd('0x32')](_0x4366bf[_0xabfd('0x33')],_0x4366bf['query']);_0x40bae2['attributes']=_[_0xabfd('0x32')](_0x4366bf[_0xabfd('0x33')],qs[_0xabfd('0x34')](_0x379f64[_0xabfd('0x2f')][_0xabfd('0x34')]));_0x40bae2[_0xabfd('0x35')]=_0x40bae2[_0xabfd('0x35')][_0xabfd('0x36')]?_0x40bae2[_0xabfd('0x35')]:_0x4366bf[_0xabfd('0x33')];if(!_0x379f64[_0xabfd('0x2f')][_0xabfd('0x37')]('nolimit')){_0x40bae2[_0xabfd('0x1e')]=qs[_0xabfd('0x1e')](_0x379f64['query']['limit']);_0x40bae2[_0xabfd('0x1c')]=qs[_0xabfd('0x1c')](_0x379f64[_0xabfd('0x2f')][_0xabfd('0x1c')]);}_0x40bae2[_0xabfd('0x38')]=qs[_0xabfd('0x39')](_0x379f64[_0xabfd('0x2f')][_0xabfd('0x39')]);_0x40bae2['where']=qs[_0xabfd('0x31')](_[_0xabfd('0x3a')](_0x379f64['query'],_0x4366bf['filters']),_0x420503);if(_0x379f64[_0xabfd('0x2f')][_0xabfd('0x3b')]){_0x40bae2[_0xabfd('0x3c')]=_[_0xabfd('0x3d')](_0x40bae2[_0xabfd('0x3c')],{'$or':_['map'](_0x420503,function(_0x302ffc){if(_0x302ffc['type']!==_0xabfd('0x3e')){var _0x32414e={};_0x32414e[_0x302ffc[_0xabfd('0x29')]]={'$like':'%'+_0x379f64[_0xabfd('0x2f')][_0xabfd('0x3b')]+'%'};return _0x32414e;}})});}_0x40bae2=_['merge']({},_0x40bae2,_0x379f64[_0xabfd('0x3f')]);var _0x1ca9c5={'where':_0x40bae2['where']};return db[_0xabfd('0x40')]['count'](_0x1ca9c5)[_0xabfd('0x25')](function(_0x2226bc){_0x4a8eaf[_0xabfd('0x1f')]=_0x2226bc;if(_0x379f64[_0xabfd('0x2f')][_0xabfd('0x41')]){_0x40bae2[_0xabfd('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xabfd('0x43')](_0x40bae2);})[_0xabfd('0x25')](function(_0x48370d){_0x4a8eaf[_0xabfd('0x44')]=_0x48370d;return _0x4a8eaf;})[_0xabfd('0x25')](respondWithFilteredResult(_0x4b9f28,_0x40bae2))[_0xabfd('0x45')](handleError(_0x4b9f28,null));};exports[_0xabfd('0x46')]=function(_0x3c8df9,_0x9c1f67){var _0x4ea884={'raw':!![],'where':{'id':_0x3c8df9[_0xabfd('0x47')]['id']}},_0x7427db={};_0x7427db[_0xabfd('0x33')]=_[_0xabfd('0x30')](db[_0xabfd('0x40')][_0xabfd('0x48')]);_0x7427db[_0xabfd('0x2f')]=_[_0xabfd('0x30')](_0x3c8df9['query']);_0x7427db[_0xabfd('0x31')]=_[_0xabfd('0x32')](_0x7427db[_0xabfd('0x33')],_0x7427db[_0xabfd('0x2f')]);_0x4ea884[_0xabfd('0x35')]=_[_0xabfd('0x32')](_0x7427db['model'],qs[_0xabfd('0x34')](_0x3c8df9[_0xabfd('0x2f')][_0xabfd('0x34')]));_0x4ea884['attributes']=_0x4ea884['attributes'][_0xabfd('0x36')]?_0x4ea884[_0xabfd('0x35')]:_0x7427db[_0xabfd('0x33')];if(_0x3c8df9[_0xabfd('0x2f')][_0xabfd('0x41')]){_0x4ea884[_0xabfd('0x42')]=[{'all':!![]}];}_0x4ea884=_[_0xabfd('0x3d')]({},_0x4ea884,_0x3c8df9[_0xabfd('0x3f')]);return db[_0xabfd('0x40')][_0xabfd('0x49')](_0x4ea884)['then'](handleEntityNotFound(_0x9c1f67,null))['then'](respondWithResult(_0x9c1f67,null))[_0xabfd('0x45')](handleError(_0x9c1f67,null));};exports['create']=function(_0x7e49a1,_0x82c8c){return db[_0xabfd('0x40')][_0xabfd('0x4a')](_0x7e49a1['body'],{})['then'](respondWithResult(_0x82c8c,0xc9))['catch'](handleError(_0x82c8c,null));};exports[_0xabfd('0x24')]=function(_0x4d23b2,_0x247f82){if(_0x4d23b2[_0xabfd('0x4b')]['id']){delete _0x4d23b2[_0xabfd('0x4b')]['id'];}return db['OpenchannelApplication'][_0xabfd('0x49')]({'where':{'id':_0x4d23b2[_0xabfd('0x47')]['id']}})[_0xabfd('0x25')](handleEntityNotFound(_0x247f82,null))['then'](saveUpdates(_0x4d23b2[_0xabfd('0x4b')],null))[_0xabfd('0x25')](respondWithResult(_0x247f82,null))[_0xabfd('0x45')](handleError(_0x247f82,null));};exports[_0xabfd('0x26')]=function(_0x29357c,_0x43bc84){return db[_0xabfd('0x40')][_0xabfd('0x49')]({'where':{'id':_0x29357c[_0xabfd('0x47')]['id']}})[_0xabfd('0x25')](handleEntityNotFound(_0x43bc84,null))[_0xabfd('0x25')](removeEntity(_0x43bc84,null))[_0xabfd('0x45')](handleError(_0x43bc84,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index aafd737..7e58786 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 _0x868c=['../../config/environment','./openchannelApplication.attributes','exports','define','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x868c,0x13d));var _0xc868=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x868c[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xc868('0x0'));var util=require('util');var logger=require(_0xc868('0x1'))(_0xc868('0x2'));var moment=require('moment');var BPromise=require(_0xc868('0x3'));var rp=require(_0xc868('0x4'));var fs=require('fs');var path=require(_0xc868('0x5'));var rimraf=require(_0xc868('0x6'));var config=require(_0xc868('0x7'));var attributes=require(_0xc868('0x8'));module[_0xc868('0x9')]=function(_0x11dec5,_0x1c5988){return _0x11dec5[_0xc868('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc868('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7486=['moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x7486,0x173));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6748('0x0'));var util=require(_0x6748('0x1'));var logger=require(_0x6748('0x2'))(_0x6748('0x3'));var moment=require(_0x6748('0x4'));var BPromise=require(_0x6748('0x5'));var rp=require(_0x6748('0x6'));var fs=require('fs');var path=require(_0x6748('0x7'));var rimraf=require('rimraf');var config=require(_0x6748('0x8'));var attributes=require(_0x6748('0x9'));module[_0x6748('0xa')]=function(_0x1c0f5b,_0x48a20b){return _0x1c0f5b[_0x6748('0xb')](_0x6748('0xc'),attributes,{'tableName':_0x6748('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6748('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f137d5c..696997b 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 _0xfb72=['UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x24bcce,_0x4d51bc){var _0x2c7d29=function(_0x3ae650){while(--_0x3ae650){_0x24bcce['push'](_0x24bcce['shift']());}};_0x2c7d29(++_0x4d51bc);}(_0xfb72,0x67));var _0x2fb7=function(_0x47f395,_0x18a997){_0x47f395=_0x47f395-0x0;var _0x577a61=_0xfb72[_0x47f395];return _0x577a61;};'use strict';var _=require(_0x2fb7('0x0'));var util=require('util');var moment=require(_0x2fb7('0x1'));var BPromise=require(_0x2fb7('0x2'));var rs=require(_0x2fb7('0x3'));var fs=require('fs');var Redis=require(_0x2fb7('0x4'));var db=require(_0x2fb7('0x5'))['db'];var utils=require(_0x2fb7('0x6'));var logger=require(_0x2fb7('0x7'))(_0x2fb7('0x8'));var config=require(_0x2fb7('0x9'));var jayson=require(_0x2fb7('0xa'));var client=jayson[_0x2fb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c64cd,_0x3595b7,_0x281382){return new BPromise(function(_0x2f1c06,_0x59688f){return client[_0x2fb7('0xc')](_0x6c64cd,_0x281382)[_0x2fb7('0xd')](function(_0x4a8fd1){logger[_0x2fb7('0xe')](_0x2fb7('0xf'),_0x3595b7,'request\x20sent');logger[_0x2fb7('0x10')](_0x2fb7('0x11'),_0x3595b7,_0x2fb7('0x12'),JSON[_0x2fb7('0x13')](_0x4a8fd1));if(_0x4a8fd1[_0x2fb7('0x14')]){if(_0x4a8fd1[_0x2fb7('0x14')][_0x2fb7('0x15')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3595b7,_0x4a8fd1[_0x2fb7('0x14')][_0x2fb7('0x16')]);return _0x59688f(_0x4a8fd1[_0x2fb7('0x14')][_0x2fb7('0x16')]);}logger[_0x2fb7('0x14')](_0x2fb7('0xf'),_0x3595b7,_0x4a8fd1[_0x2fb7('0x14')][_0x2fb7('0x16')]);return _0x2f1c06(_0x4a8fd1[_0x2fb7('0x14')][_0x2fb7('0x16')]);}else{logger[_0x2fb7('0xe')](_0x2fb7('0xf'),_0x3595b7,'request\x20sent');_0x2f1c06(_0x4a8fd1[_0x2fb7('0x17')][_0x2fb7('0x16')]);}})[_0x2fb7('0x18')](function(_0x22d8c8){logger[_0x2fb7('0x14')](_0x2fb7('0xf'),_0x3595b7,_0x22d8c8);_0x59688f(_0x22d8c8);});});}exports[_0x2fb7('0x19')]=function(_0x10925a){var _0x365102=this;return new Promise(function(_0x1954da,_0x35bc00){return db[_0x2fb7('0x1a')]['update'](_0x10925a[_0x2fb7('0x1b')],{'raw':_0x10925a[_0x2fb7('0x1c')]?_0x10925a[_0x2fb7('0x1c')][_0x2fb7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10925a[_0x2fb7('0x1c')]?_0x10925a['options'][_0x2fb7('0x1e')]||null:null,'attributes':_0x10925a[_0x2fb7('0x1c')]?_0x10925a[_0x2fb7('0x1c')]['attributes']||null:null,'limit':_0x10925a['options']?_0x10925a[_0x2fb7('0x1c')][_0x2fb7('0x1f')]||null:null})[_0x2fb7('0xd')](function(_0x10f6ec){logger[_0x2fb7('0xe')](_0x2fb7('0x19'),_0x10925a);logger['debug'](_0x2fb7('0x19'),_0x10925a,JSON[_0x2fb7('0x13')](_0x10f6ec));_0x1954da(_0x10f6ec);})[_0x2fb7('0x18')](function(_0x34ad4e){logger[_0x2fb7('0x14')](_0x2fb7('0x19'),_0x34ad4e[_0x2fb7('0x16')],_0x10925a);_0x35bc00(_0x365102['error'](0x1f4,_0x34ad4e['message']));});});}; \ No newline at end of file +var _0x3c61=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','limit','then','lodash','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3c61,0xc8));var _0x13c6=function(_0xfdaef0,_0x2c321e){_0xfdaef0=_0xfdaef0-0x0;var _0x34e9d8=_0x3c61[_0xfdaef0];return _0x34e9d8;};'use strict';var _=require(_0x13c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13c6('0x1'));var rs=require(_0x13c6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c6('0x3'));var config=require(_0x13c6('0x4'));var jayson=require(_0x13c6('0x5'));var client=jayson[_0x13c6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x201f52,_0x365ddc,_0xbe8bb0){return new BPromise(function(_0x59c38e,_0x38f1fd){return client[_0x13c6('0x7')](_0x201f52,_0xbe8bb0)['then'](function(_0x583b5d){logger[_0x13c6('0x8')](_0x13c6('0x9'),_0x365ddc,_0x13c6('0xa'));logger[_0x13c6('0xb')](_0x13c6('0xc'),_0x365ddc,_0x13c6('0xa'),JSON[_0x13c6('0xd')](_0x583b5d));if(_0x583b5d[_0x13c6('0xe')]){if(_0x583b5d['error'][_0x13c6('0xf')]===0x1f4){logger[_0x13c6('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x365ddc,_0x583b5d[_0x13c6('0xe')][_0x13c6('0x10')]);return _0x38f1fd(_0x583b5d[_0x13c6('0xe')][_0x13c6('0x10')]);}logger[_0x13c6('0xe')](_0x13c6('0x9'),_0x365ddc,_0x583b5d['error'][_0x13c6('0x10')]);return _0x59c38e(_0x583b5d[_0x13c6('0xe')][_0x13c6('0x10')]);}else{logger[_0x13c6('0x8')](_0x13c6('0x9'),_0x365ddc,_0x13c6('0xa'));_0x59c38e(_0x583b5d[_0x13c6('0x11')][_0x13c6('0x10')]);}})[_0x13c6('0x12')](function(_0x383022){logger[_0x13c6('0xe')](_0x13c6('0x9'),_0x365ddc,_0x383022);_0x38f1fd(_0x383022);});});}exports[_0x13c6('0x13')]=function(_0x3e66d7){var _0x598dfb=this;return new Promise(function(_0x4e35b7,_0x2d6c55){return db[_0x13c6('0x14')][_0x13c6('0x15')](_0x3e66d7['body'],{'raw':_0x3e66d7['options']?_0x3e66d7[_0x13c6('0x16')][_0x13c6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e66d7[_0x13c6('0x16')]?_0x3e66d7[_0x13c6('0x16')]['where']||null:null,'attributes':_0x3e66d7[_0x13c6('0x16')]?_0x3e66d7[_0x13c6('0x16')]['attributes']||null:null,'limit':_0x3e66d7['options']?_0x3e66d7[_0x13c6('0x16')][_0x13c6('0x18')]||null:null})[_0x13c6('0x19')](function(_0x12d42b){logger[_0x13c6('0x8')](_0x13c6('0x13'),_0x3e66d7);logger[_0x13c6('0xb')](_0x13c6('0x13'),_0x3e66d7,JSON['stringify'](_0x12d42b));_0x4e35b7(_0x12d42b);})['catch'](function(_0x24b039){logger[_0x13c6('0xe')](_0x13c6('0x13'),_0x24b039['message'],_0x3e66d7);_0x2d6c55(_0x598dfb[_0x13c6('0xe')](0x1f4,_0x24b039['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1bb0cfd..2a7fbdf 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 _0x4697=['put','tracked','openchannelinteraction:update','delete','/:id','destroy','/:id/tags','removeTags','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x4697,0x84));var _0x7469=function(_0x4372f4,_0x1527c4){_0x4372f4=_0x4372f4-0x0;var _0x5d1d6a=_0x4697[_0x4372f4];return _0x5d1d6a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7469('0x0'));var express=require(_0x7469('0x1'));var router=express[_0x7469('0x2')]();var fs_extra=require(_0x7469('0x3'));var auth=require(_0x7469('0x4'));var interaction=require(_0x7469('0x5'));var config=require(_0x7469('0x6'));var controller=require(_0x7469('0x7'));router[_0x7469('0x8')]('/',auth['isAuthenticated'](),controller[_0x7469('0x9')]);router[_0x7469('0x8')](_0x7469('0xa'),auth[_0x7469('0xb')](),controller[_0x7469('0xc')]);router[_0x7469('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7469('0xd')]);router[_0x7469('0x8')](_0x7469('0xe'),auth[_0x7469('0xb')](),controller[_0x7469('0xf')]);router[_0x7469('0x8')](_0x7469('0x10'),auth['isAuthenticated'](),controller[_0x7469('0x11')]);router[_0x7469('0x12')]('/',auth[_0x7469('0xb')](),controller[_0x7469('0x13')]);router['post']('/:id/messages',auth[_0x7469('0xb')](),controller[_0x7469('0x14')]);router[_0x7469('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x7469('0x15'),_0x7469('0x16')),controller['addTags']);router[_0x7469('0x17')]('/:id',auth[_0x7469('0xb')](),interaction[_0x7469('0x18')]('openchannel',_0x7469('0x19')),controller['update']);router[_0x7469('0x1a')](_0x7469('0x1b'),auth[_0x7469('0xb')](),interaction['tracked'](_0x7469('0x15'),'openchannelinteraction:destroy'),controller[_0x7469('0x1c')]);router[_0x7469('0x1a')](_0x7469('0x1d'),auth['isAuthenticated'](),controller[_0x7469('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xafca=['delete','destroy','/:id/tags','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','download','post','create','addMessage','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update'];(function(_0x3aa52f,_0x2f98cb){var _0x5eb798=function(_0x5b1357){while(--_0x5b1357){_0x3aa52f['push'](_0x3aa52f['shift']());}};_0x5eb798(++_0x2f98cb);}(_0xafca,0xb3));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xaafc('0x0'));var path=require(_0xaafc('0x1'));var timeout=require('connect-timeout');var express=require(_0xaafc('0x2'));var router=express[_0xaafc('0x3')]();var fs_extra=require(_0xaafc('0x4'));var auth=require(_0xaafc('0x5'));var interaction=require(_0xaafc('0x6'));var config=require('../../config/environment');var controller=require(_0xaafc('0x7'));router[_0xaafc('0x8')]('/',auth[_0xaafc('0x9')](),controller[_0xaafc('0xa')]);router[_0xaafc('0x8')]('/describe',auth[_0xaafc('0x9')](),controller['describe']);router[_0xaafc('0x8')]('/:id',auth[_0xaafc('0x9')](),controller[_0xaafc('0xb')]);router[_0xaafc('0x8')](_0xaafc('0xc'),auth[_0xaafc('0x9')](),controller[_0xaafc('0xd')]);router[_0xaafc('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaafc('0xe')]);router[_0xaafc('0xf')]('/',auth[_0xaafc('0x9')](),controller[_0xaafc('0x10')]);router[_0xaafc('0xf')](_0xaafc('0xc'),auth[_0xaafc('0x9')](),controller[_0xaafc('0x11')]);router[_0xaafc('0xf')]('/:id/tags',auth[_0xaafc('0x9')](),interaction[_0xaafc('0x12')](_0xaafc('0x13'),'openchannelinteraction:addtags'),controller[_0xaafc('0x14')]);router[_0xaafc('0x15')](_0xaafc('0x16'),auth[_0xaafc('0x9')](),interaction['tracked'](_0xaafc('0x13'),_0xaafc('0x17')),controller['update']);router[_0xaafc('0x18')](_0xaafc('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0xaafc('0x13'),'openchannelinteraction:destroy'),controller[_0xaafc('0x19')]);router['delete'](_0xaafc('0x1a'),auth[_0xaafc('0x9')](),controller[_0xaafc('0x1b')]);module[_0xaafc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index fe64195..0f1164a 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 _0xb205=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xb205,0xf0));var _0x5b20=function(_0x5c00bc,_0x32484a){_0x5c00bc=_0x5c00bc-0x0;var _0x450575=_0xb205[_0x5c00bc];return _0x450575;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'closed':{'type':Sequelize[_0x5b20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b20('0x3')]},'disposition':{'type':Sequelize[_0x5b20('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b20('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x5b20('0x4')]},'externalUrl':{'type':Sequelize[_0x5b20('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5b20('0x5')]('in',_0x5b20('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5b20('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9f3c=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x5d8d46,_0x34b17d){var _0x48dfd0=function(_0x5b5e33){while(--_0x5b5e33){_0x5d8d46['push'](_0x5d8d46['shift']());}};_0x48dfd0(++_0x34b17d);}(_0x9f3c,0x12b));var _0xc9f3=function(_0x36f87f,_0xc7b141){_0x36f87f=_0x36f87f-0x0;var _0x3dd585=_0x9f3c[_0x36f87f];return _0x3dd585;};'use strict';var Sequelize=require(_0xc9f3('0x0'));module[_0xc9f3('0x1')]={'closed':{'type':Sequelize[_0xc9f3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc9f3('0x3')]},'secondDisposition':{'type':Sequelize[_0xc9f3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc9f3('0x3')]},'read1stAt':{'type':Sequelize[_0xc9f3('0x4')]},'threadId':{'type':Sequelize[_0xc9f3('0x3')]},'externalUrl':{'type':Sequelize[_0xc9f3('0x3')]},'lastMsgAt':{'type':Sequelize[_0xc9f3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc9f3('0x5')]('in',_0xc9f3('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc9f3('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xc9f3('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 a040df7..64688c6 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 _0xc1c4=['agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','filters','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','$gte','format','includeAll','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','get','Openchannel','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','views','downloadInteraction.ejs','transcript-','.pdf','log','err','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','papaparse','../../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','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role'];(function(_0x5baed9,_0x409757){var _0x43aad3=function(_0x4e6713){while(--_0x4e6713){_0x5baed9['push'](_0x5baed9['shift']());}};_0x43aad3(++_0x409757);}(_0xc1c4,0x142));var _0x4c1c=function(_0x5234bc,_0x55c651){_0x5234bc=_0x5234bc-0x0;var _0x586fc9=_0xc1c4[_0x5234bc];return _0x586fc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c1c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c1c('0x1'));var rp=require('request-promise');var moment=require(_0x4c1c('0x2'));var BPromise=require(_0x4c1c('0x3'));var Mustache=require(_0x4c1c('0x4'));var util=require(_0x4c1c('0x5'));var path=require(_0x4c1c('0x6'));var sox=require(_0x4c1c('0x7'));var csv=require(_0x4c1c('0x8'));var ejs=require(_0x4c1c('0x9'));var fs=require('fs');var fs_extra=require(_0x4c1c('0xa'));var _=require('lodash');var squel=require(_0x4c1c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c1c('0x8'));var querystring=require('querystring');var Papa=require(_0x4c1c('0xc'));var Redis=require('ioredis');var authService=require(_0x4c1c('0xd'));var qs=require(_0x4c1c('0xe'));var as=require(_0x4c1c('0xf'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x4c1c('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4c1c('0x11'));var config=require(_0x4c1c('0x12'));var licenseUtil=require(_0x4c1c('0x13'));var db=require(_0x4c1c('0x14'))['db'];config[_0x4c1c('0x15')]=_[_0x4c1c('0x16')](config[_0x4c1c('0x15')],{'host':_0x4c1c('0x17'),'port':0x18eb});var socket=require(_0x4c1c('0x18'))(new Redis(config[_0x4c1c('0x15')]));require('./openchannelInteraction.socket')[_0x4c1c('0x19')](socket);function respondWithStatusCode(_0x4459a9,_0x50011a){_0x50011a=_0x50011a||0xcc;return function(_0x5dd26d){if(_0x5dd26d){return _0x4459a9['sendStatus'](_0x50011a);}return _0x4459a9[_0x4c1c('0x1a')](_0x50011a)[_0x4c1c('0x1b')]();};}function respondWithResult(_0x172f4f,_0x1d79b2){_0x1d79b2=_0x1d79b2||0xc8;return function(_0x23f8ab){if(_0x23f8ab){return _0x172f4f['status'](_0x1d79b2)[_0x4c1c('0x1c')](_0x23f8ab);}};}function respondWithFilteredResult(_0xa3320c,_0x41c4e7){return function(_0x4a0775){if(_0x4a0775){var _0x357ad4=typeof _0x41c4e7[_0x4c1c('0x1d')]===_0x4c1c('0x1e')&&typeof _0x41c4e7[_0x4c1c('0x1f')]===_0x4c1c('0x1e');var _0x4f7937=_0x4a0775[_0x4c1c('0x20')];var _0x41a98a=_0x357ad4?0x0:_0x41c4e7['offset'];var _0x46e802=_0x357ad4?_0x4a0775[_0x4c1c('0x20')]:_0x41c4e7[_0x4c1c('0x1d')]+_0x41c4e7['limit'];var _0x4d9e3c;if(_0x46e802>=_0x4f7937){_0x46e802=_0x4f7937;_0x4d9e3c=0xc8;}else{_0x4d9e3c=0xce;}_0xa3320c[_0x4c1c('0x1a')](_0x4d9e3c);return _0xa3320c[_0x4c1c('0x21')](_0x4c1c('0x22'),_0x41a98a+'-'+_0x46e802+'/'+_0x4f7937)[_0x4c1c('0x1c')](_0x4a0775);}return null;};}function patchUpdates(_0xd80e58){return function(_0x3a7336){try{jsonpatch['apply'](_0x3a7336,_0xd80e58,!![]);}catch(_0x3e37c1){return BPromise[_0x4c1c('0x23')](_0x3e37c1);}return _0x3a7336[_0x4c1c('0x24')]();};}function saveUpdates(_0xfc7303,_0x1eadc8){return function(_0x4cb629){if(_0x4cb629){return _0x4cb629[_0x4c1c('0x25')](_0xfc7303)[_0x4c1c('0x26')](function(_0x14c5f5){return _0x14c5f5;});}return null;};}function removeEntity(_0x4e9437,_0x5db4fa){return function(_0x586f7c){if(_0x586f7c){return _0x586f7c[_0x4c1c('0x27')]()['then'](function(){_0x4e9437[_0x4c1c('0x1a')](0xcc)[_0x4c1c('0x1b')]();});}};}function handleEntityNotFound(_0xc563bd,_0x2ae4b1){return function(_0x3113ed){if(!_0x3113ed){_0xc563bd[_0x4c1c('0x28')](0x194);}return _0x3113ed;};}function handleError(_0x498e96,_0x24cf86){_0x24cf86=_0x24cf86||0x1f4;return function(_0x97caae){logger[_0x4c1c('0x29')](_0x97caae[_0x4c1c('0x2a')]);if(_0x97caae[_0x4c1c('0x2b')]){delete _0x97caae[_0x4c1c('0x2b')];}_0x498e96[_0x4c1c('0x1a')](_0x24cf86)[_0x4c1c('0x2c')](_0x97caae);};}function getInteractionUsers(_0x15c3ea,_0x48fc61){return new BPromise(function(_0x202ca3,_0x515df7){try{if(_0x48fc61[_0x15c3ea['id']]){_0x15c3ea[_0x4c1c('0x2d')]=_[_0x4c1c('0x2e')](_0x48fc61[_0x15c3ea['id']],function(_0x373b41){return{'id':_0x373b41['id'],'fullname':_0x373b41[_0x4c1c('0x2f')]};});}}catch(_0x174628){_0x515df7(_0x174628);}_0x202ca3(_0x15c3ea);});}function getInteractionTags(_0x49cdae,_0xbfeb61){return new BPromise(function(_0x18f58a,_0x21bd93){try{if(_0x49cdae[_0x4c1c('0x30')]){_0x49cdae[_0x4c1c('0x31')]=[];_0x49cdae[_0x4c1c('0x30')][_0x4c1c('0x32')](',')[_0x4c1c('0x33')](function(_0x48ec35){_0x49cdae[_0x4c1c('0x31')][_0x4c1c('0x34')](_0xbfeb61[_0x48ec35]);});}delete _0x49cdae[_0x4c1c('0x30')];}catch(_0x57f0e6){_0x21bd93(_0x57f0e6);}_0x18f58a(_0x49cdae);});}function updateOpenchannelInteraction(_0x20eb97,_0x148da4,_0x171a49){return new BPromise(function(_0x179e5b,_0x25f8c9){return getInteractionUsers(_0x20eb97,_0x171a49)[_0x4c1c('0x26')](function(_0x519b31){return getInteractionTags(_0x519b31,_0x148da4);})['then'](function(_0x1161bd){return getStateInteraction(_0x1161bd);})[_0x4c1c('0x26')](function(_0x395f9c){_0x179e5b(_0x395f9c);})['catch'](function(_0x14aa25){_0x25f8c9(_0x14aa25);});});}function getStateInteraction(_0x3d6ad1){return new BPromise(function(_0x223ac3){_0x3d6ad1[_0x4c1c('0x35')]=0x0;_0x3d6ad1[_0x4c1c('0x36')]=0x0;_0x3d6ad1[_0x4c1c('0x37')]=0x0;_0x3d6ad1[_0x4c1c('0x38')]=0x0;_0x3d6ad1[_0x4c1c('0x39')]=0x0;if(!_0x3d6ad1[_0x4c1c('0x3a')]&&!_0x3d6ad1[_0x4c1c('0x3b')]){_0x3d6ad1[_0x4c1c('0x35')]+=0x1;}if(!_0x3d6ad1[_0x4c1c('0x3a')]&&_0x3d6ad1[_0x4c1c('0x3b')]){_0x3d6ad1[_0x4c1c('0x36')]+=0x1;if(_0x3d6ad1[_0x4c1c('0x35')]){_0x3d6ad1[_0x4c1c('0x35')]-=0x1;}}if(_0x3d6ad1[_0x4c1c('0x3a')]&&_0x3d6ad1[_0x4c1c('0x3b')]){_0x3d6ad1[_0x4c1c('0x37')]+=0x1;if(_0x3d6ad1[_0x4c1c('0x36')]){_0x3d6ad1[_0x4c1c('0x36')]-=0x1;}}if(_0x3d6ad1[_0x4c1c('0x3a')]&&!_0x3d6ad1[_0x4c1c('0x3b')]){_0x3d6ad1[_0x4c1c('0x38')]+=0x1;if(_0x3d6ad1[_0x4c1c('0x35')]){_0x3d6ad1[_0x4c1c('0x35')]-=0x1;}}_0x3d6ad1[_0x4c1c('0x39')]+=0x1;_0x223ac3(_0x3d6ad1);});}exports[_0x4c1c('0x3c')]=function(_0x297eb2,_0x4afeec){var _0x51e183={},_0xfa5919={},_0x2689d7={'count':0x0,'rows':[]};var _0x527349=_[_0x4c1c('0x2e')](db[_0x4c1c('0x3d')][_0x4c1c('0x3e')],function(_0x3cb019){return{'name':_0x3cb019[_0x4c1c('0x3f')],'type':_0x3cb019[_0x4c1c('0x40')][_0x4c1c('0x41')]};});_0xfa5919[_0x4c1c('0x42')]=_[_0x4c1c('0x2e')](_0x527349,_0x4c1c('0x2b'));_0xfa5919['query']=_[_0x4c1c('0x43')](_0x297eb2[_0x4c1c('0x44')]);_0xfa5919['filters']=_[_0x4c1c('0x45')](_0xfa5919[_0x4c1c('0x42')],_0xfa5919[_0x4c1c('0x44')]);_0x51e183[_0x4c1c('0x46')]=_[_0x4c1c('0x45')](_0xfa5919[_0x4c1c('0x42')],qs['fields'](_0x297eb2['query'][_0x4c1c('0x47')]));_0x51e183[_0x4c1c('0x46')]=_0x51e183[_0x4c1c('0x46')][_0x4c1c('0x48')]?_0x51e183['attributes']:_0xfa5919[_0x4c1c('0x42')];if(!_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x49')](_0x4c1c('0x4a'))){_0x51e183[_0x4c1c('0x1f')]=qs[_0x4c1c('0x1f')](_0x297eb2['query'][_0x4c1c('0x1f')]);_0x51e183[_0x4c1c('0x1d')]=qs['offset'](_0x297eb2[_0x4c1c('0x44')]['offset']);}_0x51e183['order']=qs[_0x4c1c('0x4b')](_0x297eb2['query'][_0x4c1c('0x4b')]);_0x51e183[_0x4c1c('0x4c')]=qs['filters'](_[_0x4c1c('0x4d')](_0x297eb2['query'],_0xfa5919['filters']),_0x527349);var _0x12f695=[];var _0x2803e7=squel[_0x4c1c('0x4e')]()[_0x4c1c('0x4f')]('id')[_0x4c1c('0x4f')](_0x4c1c('0x2b'))[_0x4c1c('0x4f')](_0x4c1c('0x50'))[_0x4c1c('0x51')](_0x4c1c('0x52'));var _0x2b7785=squel['select']()[_0x4c1c('0x4f')](_0x4c1c('0x53'))['field'](_0x4c1c('0x54'))[_0x4c1c('0x4f')](_0x4c1c('0x55'))[_0x4c1c('0x51')](_0x4c1c('0x56'),'ui')[_0x4c1c('0x57')](_0x4c1c('0x58'),'u',_0x4c1c('0x59'));var _0x326142=squel[_0x4c1c('0x4e')]()[_0x4c1c('0x51')]('openchannel_interactions','i')['left_join'](_0x4c1c('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4c1c('0x57')](_0x4c1c('0x58'),'o','o.id\x20=\x20i.UserId')[_0x4c1c('0x57')](_0x4c1c('0x5b'),'a',_0x4c1c('0x5c'))['left_join'](_0x4c1c('0x5d'),'me',_0x4c1c('0x5e'))[_0x4c1c('0x57')](_0x4c1c('0x5f'),'it',_0x4c1c('0x60'))[_0x4c1c('0x57')](_0x4c1c('0x52'),'t',_0x4c1c('0x61'));var _0x299ff9=squel[_0x4c1c('0x62')]();var _0x49b184=[];var _0x4cfdde=squel[_0x4c1c('0x62')]();var _0x471ca0;if(_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x63')]){_0x471ca0=as[_0x4c1c('0x64')](_0x297eb2[_0x4c1c('0x44')]['search']);var _0x475ac7=_0x471ca0['sqlOperator'];for(var _0x5442bd=0x0;_0x5442bd<_0x471ca0['conditions'][_0x4c1c('0x48')];_0x5442bd++){var _0x4f7e83=_0x471ca0[_0x4c1c('0x65')][_0x5442bd];var _0x507f08='i';var _0x1172ed=_[_0x4c1c('0x66')](_0x527349,['name',_0x4f7e83[_0x4c1c('0x4f')]]);if(!_0x1172ed){switch(_0x4f7e83[_0x4c1c('0x4f')]){case _0x4c1c('0x67'):if(_0x4f7e83[_0x4c1c('0x68')]==0x1){_0x326142[_0x4c1c('0x69')]('`'+_0x4f7e83[_0x4c1c('0x4f')]+_0x4c1c('0x6a'));}else{_0x326142[_0x4c1c('0x69')]('`'+_0x4f7e83[_0x4c1c('0x4f')]+_0x4c1c('0x6b'));}break;case _0x4c1c('0x6c'):if(_0x4f7e83[_0x4c1c('0x6d')]===_0x4c1c('0x6e')){if(_0x4f7e83[_0x4c1c('0x68')][_0x4c1c('0x32')]('\x20')[_0x4c1c('0x48')]>0x1){_0x299ff9[_0x475ac7](_0x4c1c('0x6f'),qs[_0x4c1c('0x70')](_0x4f7e83[_0x4c1c('0x68')]),null);}else{var _0x302794='%'+_0x4f7e83[_0x4c1c('0x68')]+'%';_0x299ff9[_0x475ac7](_0x4c1c('0x71'),_0x302794,_0x302794,_0x302794);}}else{_0x1172ed=_[_0x4c1c('0x66')](_0x527349,[_0x4c1c('0x2b'),_0x4c1c('0x72')]);_0x4f7e83[_0x4c1c('0x4f')]=_0x4c1c('0x72');_0x3415c2=as['buildExpression'](_0x507f08,_0x1172ed['type'],_0x4f7e83);_0x299ff9[_0x475ac7](_0x3415c2[_0x4c1c('0x73')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x74')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x1b')]);}break;case _0x4c1c('0x75'):var _0x20b111=_0x4f7e83[_0x4c1c('0x68')][_0x4c1c('0x32')](',')[_0x4c1c('0x2e')](function(_0x4a51c9){return Number(_0x4a51c9);});_0x20b111[_0x4c1c('0x33')](function(_0x345d78){_0x4cfdde['or'](_0x4c1c('0x76'),'%,'+_0x345d78+',%');});_0x49b184=_[_0x4c1c('0x77')](_0x49b184,_0x20b111);break;case _0x4c1c('0x78'):if(_0x4f7e83[_0x4c1c('0x6d')]===_0x4c1c('0x6e')){_0x299ff9[_0x475ac7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4f7e83[_0x4c1c('0x68')]+'%',null);}else{_0x1172ed=_[_0x4c1c('0x66')](_0x527349,['name',_0x4c1c('0x3b')]);_0x4f7e83[_0x4c1c('0x4f')]='UserId';_0x3415c2=as[_0x4c1c('0x79')](_0x507f08,_0x1172ed[_0x4c1c('0x40')],_0x4f7e83);_0x299ff9[_0x475ac7](_0x3415c2[_0x4c1c('0x73')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x74')],_0x3415c2['value']['end']);}break;case'body':_0x3415c2=as[_0x4c1c('0x79')]('me',null,_0x4f7e83);_0x299ff9[_0x475ac7](_0x3415c2[_0x4c1c('0x73')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x74')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x1b')]);break;}}else{var _0x3415c2=as['buildExpression'](_0x507f08,_0x1172ed[_0x4c1c('0x40')],_0x4f7e83);_0x299ff9[_0x475ac7](_0x3415c2[_0x4c1c('0x73')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x74')],_0x3415c2[_0x4c1c('0x68')][_0x4c1c('0x1b')]);}}}else{var _0xe3d5f2=_(_0x297eb2[_0x4c1c('0x44')])[_0x4c1c('0x43')]()[_0x4c1c('0x2e')](function(_0x10a25c){return _[_0x4c1c('0x7a')](_0x527349,[_0x4c1c('0x2b'),_0x10a25c])?_0x10a25c:undefined;})[_0x4c1c('0x7b')]()[_0x4c1c('0x68')]();if(!_['isEmpty'](_0xe3d5f2)){_0xe3d5f2[_0x4c1c('0x33')](function(_0x3d1d16){if(_0x3d1d16===_0x4c1c('0x7c')){_0x326142[_0x4c1c('0x4c')](_0x4c1c('0x7d'),[][_0x4c1c('0x7e')](_0x297eb2[_0x4c1c('0x44')][_0x3d1d16]));}else if(_0x3d1d16==='createdAt'){var _0x3e1cb8=JSON[_0x4c1c('0x7f')](_0x297eb2[_0x4c1c('0x44')][_0x3d1d16])['$gte'];var _0x496c2c=JSON[_0x4c1c('0x7f')](_0x297eb2[_0x4c1c('0x44')][_0x3d1d16])[_0x4c1c('0x80')];_0x326142['where'](_0x4c1c('0x81'),_0x3e1cb8,_0x496c2c);}else{if(_0x297eb2['query'][_0x3d1d16]===_0x4c1c('0x82')){_0x326142[_0x4c1c('0x4c')]('i.'+_0x3d1d16+'\x20IS\x20NULL');}else{_0x326142[_0x4c1c('0x4c')]('i.'+_0x3d1d16+_0x4c1c('0x83'),_0x297eb2[_0x4c1c('0x44')][_0x3d1d16]);}}});}if(_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x84')]){if(_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x84')]==0x1){_0x326142[_0x4c1c('0x69')](_0x4c1c('0x85'));}else{_0x326142[_0x4c1c('0x69')](_0x4c1c('0x86'));}}if(_0x297eb2[_0x4c1c('0x44')]['tag']){_0x49b184=_[_0x4c1c('0x87')](_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x88')])?_0x297eb2['query']['tag']:new Array(_0x297eb2[_0x4c1c('0x44')]['tag']);_0x49b184[_0x4c1c('0x33')](function(_0x372cf6){_0x4cfdde['or'](_0x4c1c('0x76'),'%,'+_0x372cf6+',%');});}if(_0x297eb2['query']['filter']){var _0x17795b=_0x297eb2['query'][_0x4c1c('0x89')]['replace']('\x5c','\x5c\x5c')[_0x4c1c('0x8a')](/'/g,'\x27\x27');if(qs[_0x4c1c('0x8b')](_0x17795b)){_0x299ff9['or'](_0x4c1c('0x8c'),_0x17795b+'%');}else{_0x299ff9['or'](_0x4c1c('0x8d'),qs[_0x4c1c('0x70')](_0x17795b))['or'](_0x4c1c('0x8e'),_0x17795b+'%')['or'](_0x4c1c('0x8f'),_0x17795b+'%');}}}_0x326142[_0x4c1c('0x4c')](_0x299ff9);_0x326142['group'](_0x4c1c('0x90'));var _0x4a8eac={'type':db[_0x4c1c('0x91')][_0x4c1c('0x92')][_0x4c1c('0x93')],'raw':!![]};var _0x142787=_0x326142[_0x4c1c('0x94')]();_0x142787[_0x4c1c('0x4f')](_0x4c1c('0x90'));_0x142787[_0x4c1c('0x4f')](_0x4c1c('0x95'),_0x4c1c('0x67'));if(_0x51e183[_0x4c1c('0x96')]){_0x51e183[_0x4c1c('0x96')]['forEach'](function(_0x1b2f20){var _0x2b00d3=_0x1b2f20[0x0]===_0x4c1c('0x97')?_0x1b2f20[0x0]:'i.'+_0x1b2f20[0x0];_0x326142[_0x4c1c('0x96')](_0x2b00d3,_0x1b2f20[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x49b184)){_0x326142[_0x4c1c('0x69')](_0x4cfdde);_0x142787[_0x4c1c('0x4c')]('t.id\x20IN\x20?',_0x49b184);}BPromise['resolve']()['then'](function(){if(!_0x471ca0){if(_0x297eb2['query']['OpenchannelAccountId'])return;_0x142787[_0x4c1c('0x4c')](_0x4c1c('0x98'));_0x326142[_0x4c1c('0x4c')](_0x4c1c('0x98'));return;}if(_0x297eb2['user'][_0x4c1c('0x99')]!==_0x4c1c('0x9a'))return;return _0x297eb2[_0x4c1c('0x9b')][_0x4c1c('0x9c')]({'attributes':['id'],'raw':!![]})[_0x4c1c('0x26')](function(_0x1e65cd){if(_['isEmpty'](_0x1e65cd)){_0x142787[_0x4c1c('0x4c')](_0x4c1c('0x9d'));_0x326142['where'](_0x4c1c('0x9d'));}else{_0x142787[_0x4c1c('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x1e65cd,'id'));_0x326142[_0x4c1c('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x1e65cd,'id'));}});})[_0x4c1c('0x26')](function(){if(_0x297eb2[_0x4c1c('0x9b')][_0x4c1c('0x99')]===_0x4c1c('0x9a')&&!_0x471ca0&&!_0x297eb2[_0x4c1c('0x44')][_0x4c1c('0x7c')])return[];return db[_0x4c1c('0x9e')][_0x4c1c('0x44')](_0x142787['toString'](),_0x4a8eac);})[_0x4c1c('0x26')](function(_0x25abb3){_0x2689d7['count']=_0x25abb3[_0x4c1c('0x48')];if(_0x2689d7[_0x4c1c('0x20')]===0x0)return[];return db[_0x4c1c('0x9e')][_0x4c1c('0x44')](_0x2803e7[_0x4c1c('0x9f')](),_0x4a8eac)[_0x4c1c('0x26')](function(_0x117e13){_0x12f695=_['keyBy'](_0x117e13,'id');_0x4a8eac=_[_0x4c1c('0xa0')](_0x4a8eac,{'model':db[_0x4c1c('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x297eb2['query'][_0x4c1c('0x47')]){_0x51e183[_0x4c1c('0x46')][_0x4c1c('0x33')](function(_0xd8642f){_0x326142[_0x4c1c('0x4f')]('i.'+_0xd8642f);});}else{_0x326142[_0x4c1c('0x4f')](_0x4c1c('0x95'),_0x4c1c('0x67'));_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xa1'),_0x4c1c('0xa2'));_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xa3'),'Account.mandatoryDisposition');_0x326142[_0x4c1c('0x4f')]('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','contactName');_0x326142['field'](_0x4c1c('0xa4'));_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xa5'),'Contact.firstName');_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xa6'),_0x4c1c('0xa7'));_0x326142['field']('c.email','Contact.email');_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xa8'),'Contact.phone');_0x326142[_0x4c1c('0x4f')]('c.mobile',_0x4c1c('0xa9'));_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xaa'),_0x4c1c('0xab'));_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xac'),'Owner.fullname');_0x326142[_0x4c1c('0x4f')](_0x4c1c('0xad'),_0x4c1c('0xae'));_0x326142[_0x4c1c('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4c1c('0x30'));}if(_0x51e183[_0x4c1c('0x1f')])_0x326142['limit'](_0x51e183['limit']);if(_0x51e183[_0x4c1c('0x1d')])_0x326142[_0x4c1c('0x1d')](_0x51e183[_0x4c1c('0x1d')]);return db[_0x4c1c('0x9e')]['query'](_0x326142[_0x4c1c('0x9f')](),_0x4a8eac);})[_0x4c1c('0x26')](function(_0xfee862){if(_0xfee862[_0x4c1c('0x48')]>0x0)_0x2b7785[_0x4c1c('0x4c')](_0x4c1c('0xaf'),_[_0x4c1c('0x2e')](_0xfee862,'id'));return db[_0x4c1c('0x9e')][_0x4c1c('0x44')](_0x2b7785[_0x4c1c('0x9f')](),_0x4a8eac)[_0x4c1c('0x26')](function(_0x265ef6){var _0x10e93b=_[_0x4c1c('0xb0')](_0x265ef6,_0x4c1c('0xb1'));var _0x204810=[];_0xfee862[_0x4c1c('0x33')](function(_0x3b169f){_0x204810['push'](updateOpenchannelInteraction(_0x3b169f,_0x12f695,_0x10e93b));});return BPromise[_0x4c1c('0xb2')](_0x204810);});});})[_0x4c1c('0x26')](function(_0x60c9c7){_0x2689d7[_0x4c1c('0xb3')]=_0x60c9c7;return _0x2689d7;})[_0x4c1c('0x26')](respondWithFilteredResult(_0x4afeec,_0x51e183))[_0x4c1c('0xb4')](handleError(_0x4afeec,null));};exports[_0x4c1c('0xb5')]=function(_0xcf0989,_0x565fb7){var _0x5e373b={};if(_0xcf0989['query']['type']&&_0xcf0989[_0x4c1c('0x44')][_0x4c1c('0x40')]===_0x4c1c('0x51')){_0x5e373b[_0x4c1c('0x51')]=_0xcf0989[_0x4c1c('0xb6')]['id'];}else{_0x5e373b['id']=_0xcf0989['params']['id'];}var _0x3395b2={'raw':![],'where':_0x5e373b},_0x1f0fdd={};_0x1f0fdd['model']=_[_0x4c1c('0x43')](db[_0x4c1c('0x3d')][_0x4c1c('0x3e')]);_0x1f0fdd['query']=_[_0x4c1c('0x43')](_0xcf0989['query']);_0x1f0fdd[_0x4c1c('0xb7')]=_[_0x4c1c('0x45')](_0x1f0fdd[_0x4c1c('0x42')],_0x1f0fdd[_0x4c1c('0x44')]);_0x3395b2[_0x4c1c('0x46')]=_[_0x4c1c('0x45')](_0x1f0fdd[_0x4c1c('0x42')],qs[_0x4c1c('0x47')](_0xcf0989[_0x4c1c('0x44')][_0x4c1c('0x47')]));_0x3395b2[_0x4c1c('0x46')]=_0x3395b2['attributes'][_0x4c1c('0x48')]?_0x3395b2[_0x4c1c('0x46')]:_0x1f0fdd[_0x4c1c('0x42')];if(_0xcf0989[_0x4c1c('0x44')]['includeAll']){_0x3395b2[_0x4c1c('0xb8')]=[{'all':!![]}];}_0x3395b2=_[_0x4c1c('0xa0')]({},_0x3395b2,_0xcf0989[_0x4c1c('0xb9')]);return db[_0x4c1c('0x3d')][_0x4c1c('0x66')](_0x3395b2)[_0x4c1c('0x26')](handleEntityNotFound(_0x565fb7,null))['then'](respondWithResult(_0x565fb7,null))[_0x4c1c('0xb4')](handleError(_0x565fb7,null));};exports[_0x4c1c('0xba')]=function(_0x2f7137,_0x1e3ed0){return db[_0x4c1c('0x3d')][_0x4c1c('0xba')](_0x2f7137['body'],{})[_0x4c1c('0x26')](respondWithResult(_0x1e3ed0,0xc9))[_0x4c1c('0xb4')](handleError(_0x1e3ed0,null));};exports[_0x4c1c('0x25')]=function(_0x2b369e,_0x346b15){if(_0x2b369e[_0x4c1c('0xbb')]['id']){delete _0x2b369e['body']['id'];}return db[_0x4c1c('0x3d')][_0x4c1c('0x66')]({'where':{'id':_0x2b369e[_0x4c1c('0xb6')]['id']}})[_0x4c1c('0x26')](handleEntityNotFound(_0x346b15,null))[_0x4c1c('0x26')](saveUpdates(_0x2b369e['body'],null))[_0x4c1c('0x26')](respondWithResult(_0x346b15,null))[_0x4c1c('0xb4')](handleError(_0x346b15,null));};exports[_0x4c1c('0x27')]=function(_0x11e79e,_0x2a6120){return db[_0x4c1c('0x3d')][_0x4c1c('0x66')]({'where':{'id':_0x11e79e['params']['id']}})[_0x4c1c('0x26')](handleEntityNotFound(_0x2a6120,null))[_0x4c1c('0x26')](removeEntity(_0x2a6120,null))[_0x4c1c('0xb4')](handleError(_0x2a6120,null));};exports['describe']=function(_0x21e0cb,_0x594b46){return db[_0x4c1c('0x3d')][_0x4c1c('0xbc')]()['then'](respondWithResult(_0x594b46,null))['catch'](handleError(_0x594b46,null));};exports[_0x4c1c('0xbd')]=function(_0x20e138,_0x1b629d,_0x33fe1e){return db[_0x4c1c('0xbe')][_0x4c1c('0x66')]({'where':{'id':_0x20e138['params']['id']}})['then'](handleEntityNotFound(_0x1b629d,null))[_0x4c1c('0x26')](function(_0x5e9739){if(_0x5e9739){return _0x5e9739[_0x4c1c('0xbd')](_0x20e138[_0x4c1c('0xbb')][_0x4c1c('0xbf')],_[_0x4c1c('0xc0')](_0x20e138['body'],[_0x4c1c('0xbf'),'id'])||{});}})[_0x4c1c('0x26')](respondWithResult(_0x1b629d,null))[_0x4c1c('0xb4')](handleError(_0x1b629d,null));};exports['getMessages']=function(_0x53b294,_0x36b6ea,_0x4aafbc){var _0x171ffa={'raw':![],'where':{}};var _0x367d73={};var _0x3528fb={'count':0x0,'rows':[]};return db[_0x4c1c('0x3d')][_0x4c1c('0xc1')]({'where':{'id':_0x53b294[_0x4c1c('0xb6')]['id']}})[_0x4c1c('0x26')](handleEntityNotFound(_0x36b6ea,null))['then'](function(_0x54cb37){if(_0x54cb37){_0x367d73['model']=_['keys'](db[_0x4c1c('0xbe')][_0x4c1c('0x3e')]);_0x367d73[_0x4c1c('0x44')]=_[_0x4c1c('0x43')](_0x53b294[_0x4c1c('0x44')]);_0x367d73[_0x4c1c('0xb7')]=_[_0x4c1c('0x45')](_0x367d73[_0x4c1c('0x42')],_0x367d73[_0x4c1c('0x44')]);_0x171ffa[_0x4c1c('0x46')]=_[_0x4c1c('0x45')](_0x367d73[_0x4c1c('0x42')],qs[_0x4c1c('0x47')](_0x53b294[_0x4c1c('0x44')][_0x4c1c('0x47')]));_0x171ffa[_0x4c1c('0x46')]=_0x171ffa[_0x4c1c('0x46')][_0x4c1c('0x48')]?_0x171ffa['attributes']:_0x367d73[_0x4c1c('0x42')];if(!_0x53b294[_0x4c1c('0x44')][_0x4c1c('0x49')](_0x4c1c('0x4a'))){_0x171ffa[_0x4c1c('0x1f')]=qs[_0x4c1c('0x1f')](_0x53b294[_0x4c1c('0x44')][_0x4c1c('0x1f')]);_0x171ffa['offset']=qs[_0x4c1c('0x1d')](_0x53b294[_0x4c1c('0x44')][_0x4c1c('0x1d')]);}_0x171ffa[_0x4c1c('0x96')]=qs['sort'](_0x53b294[_0x4c1c('0x44')]['sort']);_0x171ffa[_0x4c1c('0x4c')]=qs[_0x4c1c('0xb7')](_[_0x4c1c('0x4d')](_0x53b294[_0x4c1c('0x44')],_0x367d73['filters']));_0x171ffa['where'][_0x4c1c('0xb1')]=_0x54cb37['id'];if(_0x53b294[_0x4c1c('0x44')][_0x4c1c('0x89')]){_0x171ffa[_0x4c1c('0x4c')]=_[_0x4c1c('0xa0')](_0x171ffa[_0x4c1c('0x4c')],{'$or':_['map'](_0x171ffa[_0x4c1c('0x46')],function(_0x3cfe4e){var _0x471ec6={};_0x471ec6[_0x3cfe4e]={'$like':'%'+_0x53b294['query'][_0x4c1c('0x89')]+'%'};return _0x471ec6;})});}if(_0x53b294['query'][_0x4c1c('0xc2')]){var _0x12a104=_0x53b294['query'][_0x4c1c('0xc2')][_0x4c1c('0x32')](',');var _0x15899c={};_0x15899c[_0x12a104[0x0]]={'$gte':moment(_0x12a104[0x1])[_0x4c1c('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x171ffa[_0x4c1c('0x4c')]=_[_0x4c1c('0xa0')](_0x171ffa['where'],_0x15899c);}_0x171ffa=_[_0x4c1c('0xa0')]({},_0x171ffa,_0x53b294[_0x4c1c('0xb9')]);return db[_0x4c1c('0xbe')][_0x4c1c('0x20')]({'where':_0x171ffa[_0x4c1c('0x4c')]})[_0x4c1c('0x26')](function(_0xcd21b8){_0x3528fb[_0x4c1c('0x20')]=_0xcd21b8;if(_0x53b294['query'][_0x4c1c('0xc4')]){_0x171ffa[_0x4c1c('0xb8')]=[{'all':!![]}];}return db[_0x4c1c('0xbe')][_0x4c1c('0xc5')](_0x171ffa);})['then'](function(_0x1ae103){_0x3528fb[_0x4c1c('0xb3')]=_0x1ae103;return _0x3528fb;});}})[_0x4c1c('0x26')](respondWithFilteredResult(_0x36b6ea,_0x171ffa))['catch'](handleError(_0x36b6ea,null));};exports['addTags']=function(_0x151fdb,_0x3438e5,_0x21805e){return db['OpenchannelInteraction']['find']({'where':{'id':_0x151fdb[_0x4c1c('0xb6')]['id']}})[_0x4c1c('0x26')](handleEntityNotFound(_0x3438e5,null))[_0x4c1c('0x26')](function(_0x231aea){if(_0x231aea){return _0x231aea['setTags'](_0x151fdb['body'][_0x4c1c('0xbf')],_[_0x4c1c('0xc0')](_0x151fdb['body'],['ids','id'])||{})['spread'](function(){return db[_0x4c1c('0x75')][_0x4c1c('0xc5')]({'attributes':['id',_0x4c1c('0x2b'),_0x4c1c('0x50')],'where':{'id':_0x151fdb[_0x4c1c('0xbb')]['ids']}});})[_0x4c1c('0x26')](function(_0x1a5f55){socket[_0x4c1c('0xc6')]('openchannelInteractionTags:save',{'id':Number(_0x151fdb[_0x4c1c('0xb6')]['id']),'tags':_0x1a5f55||[]});return{'id':Number(_0x151fdb[_0x4c1c('0xb6')]['id']),'tags':_0x1a5f55||[]};});}})[_0x4c1c('0x26')](respondWithResult(_0x3438e5,null))['catch'](handleError(_0x3438e5,null));};exports['removeTags']=function(_0x3104b8,_0xaff1f9,_0xc6121e){return db[_0x4c1c('0x3d')][_0x4c1c('0x66')]({'where':{'id':_0x3104b8[_0x4c1c('0xb6')]['id']}})['then'](handleEntityNotFound(_0xaff1f9,null))[_0x4c1c('0x26')](function(_0x2fd70e){if(_0x2fd70e){return _0x2fd70e[_0x4c1c('0xc7')](_0x3104b8[_0x4c1c('0x44')]['ids']);}})[_0x4c1c('0x26')](respondWithStatusCode(_0xaff1f9,null))[_0x4c1c('0xb4')](handleError(_0xaff1f9,null));};exports[_0x4c1c('0xc8')]=function(_0x4decb0,_0x35389e){var _0xee7446=moment()[_0x4c1c('0xc9')]()[_0x4c1c('0x9f')]();var _0x4230bb=path[_0x4c1c('0xca')](config[_0x4c1c('0xcb')],_0x4c1c('0xcc'),_0x4c1c('0xcd'),_0x4c1c('0xce'));var _0x31dca5=path['join'](config[_0x4c1c('0xcb')],'server',_0x4c1c('0xcd'),_0x4c1c('0xcf'));var _0x49d356=path[_0x4c1c('0xca')](_0x4230bb,_0xee7446);var _0x4661c2=util['format'](_0x4c1c('0xd0'),_0x4decb0['params']['id'],_0xee7446);var _0x5af965=path['join'](_0x4230bb,_0x4661c2);var _0x5c3d73=[];_0x5c3d73[_0x4c1c('0x34')]({'model':db[_0x4c1c('0x78')],'as':_0x4c1c('0x78'),'attributes':['id',_0x4c1c('0x2f')],'raw':!![]});_0x5c3d73[_0x4c1c('0x34')]({'model':db['CmContact'],'as':_0x4c1c('0x6c'),'attributes':['id',_0x4c1c('0xd1'),_0x4c1c('0xd2')],'raw':!![]});if(_0x4decb0[_0x4c1c('0x44')]['attachments']){_0x5c3d73[_0x4c1c('0x34')]({'model':db['Attachment'],'as':_0x4c1c('0xd3'),'raw':!![]});}var _0x30f721=[{'model':db[_0x4c1c('0xbe')],'as':'Messages','attributes':['id',_0x4c1c('0xbb'),_0x4c1c('0xd4'),_0x4c1c('0xd5'),_0x4c1c('0xd6'),_0x4c1c('0x84')],'include':_0x5c3d73}];_0x30f721[_0x4c1c('0x34')]({'model':db[_0x4c1c('0xd7')],'as':_0x4c1c('0xd8'),'attributes':['id','name']});_0x30f721[_0x4c1c('0x34')]({'model':db[_0x4c1c('0x78')],'as':'Owner','attributes':['id',_0x4c1c('0x2f')]});return db[_0x4c1c('0x3d')][_0x4c1c('0x66')]({'where':{'id':_0x4decb0[_0x4c1c('0xb6')]['id']},'include':_0x30f721})[_0x4c1c('0x26')](handleEntityNotFound(_0x35389e,null))[_0x4c1c('0x26')](function(_0x37f1bd){if(_0x37f1bd){var _0x249f4f=_0x37f1bd[_0x4c1c('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x49d356);var _0x4a0a40={'channel':_0x4c1c('0xda'),'account':_0x249f4f[_0x4c1c('0xd8')][_0x4c1c('0x2b')],'agent':_0x249f4f[_0x4c1c('0xdb')]?_0x249f4f[_0x4c1c('0xdb')][_0x4c1c('0x2f')]:'N.A.','createdAt':moment(_0x249f4f[_0x4c1c('0xd4')])[_0x4c1c('0xc3')](_0x4c1c('0xdc'))[_0x4c1c('0x9f')](),'closedAt':_0x249f4f[_0x4c1c('0x3a')]?moment(_0x249f4f[_0x4c1c('0xdd')])[_0x4c1c('0xc3')](_0x4c1c('0xdc'))[_0x4c1c('0x9f')]():'','disposition':_0x249f4f[_0x4c1c('0xde')],'visibility':_0x249f4f['threadId']?_0x4c1c('0xdf'):_0x4c1c('0xe0'),'messages':_(_0x249f4f[_0x4c1c('0xe1')])[_0x4c1c('0x89')]({'secret':![]})[_0x4c1c('0x2e')](function(_0x432662){if(_0x432662['Attachment']){var _0x3bf11e=path[_0x4c1c('0xca')](_0x31dca5,_0x432662['Attachment'][_0x4c1c('0xe2')]);if(fs[_0x4c1c('0xe3')](_0x3bf11e)){fs[_0x4c1c('0xe4')](_0x3bf11e)[_0x4c1c('0xe5')](fs[_0x4c1c('0xe6')](path[_0x4c1c('0xca')](_0x49d356,_0x432662['Attachment']['basename'])));}}return{'date':moment(_0x432662[_0x4c1c('0xd4')])['format'](_0x4c1c('0xdc'))[_0x4c1c('0x9f')](),'sender':_0x432662[_0x4c1c('0xd5')]===_0x4c1c('0xe7')?_0x432662['User']?_0x432662['User'][_0x4c1c('0x2f')]:'System':_0x432662[_0x4c1c('0x6c')]['firstName']+(_0x432662['Contact'][_0x4c1c('0xd2')]?'\x20'+_0x432662[_0x4c1c('0x6c')][_0x4c1c('0xd2')]:''),'body':_0x432662[_0x4c1c('0xd3')]?_0x432662[_0x4c1c('0xd3')]['basename']:_0x432662[_0x4c1c('0xbb')],'direction':_0x432662['direction']==='out'?'A':'C','secret':_0x432662[_0x4c1c('0xd6')],'read':_0x432662[_0x4c1c('0x84')],'attachment':_0x432662[_0x4c1c('0xd3')]};})[_0x4c1c('0x68')]()};return ejs['renderFile'](path['join'](config[_0x4c1c('0xcb')],_0x4c1c('0xcc'),_0x4c1c('0xe8'),_0x4c1c('0xe9')),{'interaction':_0x4a0a40})['then'](function(_0x589f5a){var _0x35aecf=path['join'](_0x49d356,_0x4c1c('0xea')+_0x249f4f['id']+'-'+_0xee7446+_0x4c1c('0xeb'));var _0x6c2b77={'path':_0x35aecf,'channel':'Openchannel','interactionId':_0x249f4f['id']};return pdf['createPdfFromHTML'](_0x589f5a,_0x6c2b77);})[_0x4c1c('0x26')](function(){return new BPromise(function(_0x4c367c,_0x578165){zipdir(_0x49d356,{'saveTo':_0x5af965},function(_0xd8902,_0x529729){if(_0xd8902)return _0x578165(_0xd8902);return _0x4c367c(_0x529729);});})[_0x4c1c('0x26')](function(){return new BPromise(function(_0x1ee698,_0x44854a){rimraf(_0x49d356,function(_0xc26e8d){if(_0xc26e8d)_0x44854a(_0xc26e8d);return _0x1ee698();});});})[_0x4c1c('0x26')](function(){return _0x35389e[_0x4c1c('0xc8')](_0x5af965,_0x4661c2,function(_0x99007a){if(_0x99007a){console[_0x4c1c('0xec')](_0x4c1c('0xed'),_0x99007a);}else{fs['unlinkSync'](_0x5af965);}});});});}else{return _0x35389e[_0x4c1c('0x28')](0xc8);}})[_0x4c1c('0xb4')](handleError(_0x35389e,null));}; \ No newline at end of file +var _0xd39e=['../../config/license/util','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','Tags','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','OpenchannelInteraction','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','text','start','Tag','forEach','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','emit','openchannelInteractionTags:save','removeTags','join','root','server','files','attachments','User','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','views','downloadInteraction.ejs','transcript-','.pdf','download','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xd39e,0xdb));var _0xed39=function(_0x3ffd40,_0x4c65b8){_0x3ffd40=_0x3ffd40-0x0;var _0x14309d=_0xd39e[_0x3ffd40];return _0x14309d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed39('0x0'));var zipdir=require(_0xed39('0x1'));var jsonpatch=require(_0xed39('0x2'));var rp=require('request-promise');var moment=require(_0xed39('0x3'));var BPromise=require(_0xed39('0x4'));var Mustache=require(_0xed39('0x5'));var util=require(_0xed39('0x6'));var path=require(_0xed39('0x7'));var sox=require('sox');var csv=require(_0xed39('0x8'));var ejs=require(_0xed39('0x9'));var fs=require('fs');var fs_extra=require(_0xed39('0xa'));var _=require('lodash');var squel=require(_0xed39('0xb'));var crypto=require(_0xed39('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed39('0xd'));var toCsv=require(_0xed39('0x8'));var querystring=require('querystring');var Papa=require(_0xed39('0xe'));var Redis=require(_0xed39('0xf'));var authService=require(_0xed39('0x10'));var qs=require(_0xed39('0x11'));var as=require(_0xed39('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed39('0x13'))(_0xed39('0x14'));var utils=require(_0xed39('0x15'));var config=require(_0xed39('0x16'));var licenseUtil=require(_0xed39('0x17'));var db=require('../../mysqldb')['db'];config[_0xed39('0x18')]=_['defaults'](config[_0xed39('0x18')],{'host':_0xed39('0x19'),'port':0x18eb});var socket=require(_0xed39('0x1a'))(new Redis(config[_0xed39('0x18')]));require(_0xed39('0x1b'))[_0xed39('0x1c')](socket);function respondWithStatusCode(_0x4c12e2,_0x4c8dd0){_0x4c8dd0=_0x4c8dd0||0xcc;return function(_0x4cd374){if(_0x4cd374){return _0x4c12e2['sendStatus'](_0x4c8dd0);}return _0x4c12e2[_0xed39('0x1d')](_0x4c8dd0)[_0xed39('0x1e')]();};}function respondWithResult(_0x3aff1e,_0x3f8ca7){_0x3f8ca7=_0x3f8ca7||0xc8;return function(_0x174e58){if(_0x174e58){return _0x3aff1e['status'](_0x3f8ca7)[_0xed39('0x1f')](_0x174e58);}};}function respondWithFilteredResult(_0x9216b,_0x2d4a2c){return function(_0x4ee208){if(_0x4ee208){var _0x56a45c=typeof _0x2d4a2c['offset']===_0xed39('0x20')&&typeof _0x2d4a2c['limit']===_0xed39('0x20');var _0x200f4e=_0x4ee208[_0xed39('0x21')];var _0x575550=_0x56a45c?0x0:_0x2d4a2c[_0xed39('0x22')];var _0x40ccfe=_0x56a45c?_0x4ee208[_0xed39('0x21')]:_0x2d4a2c[_0xed39('0x22')]+_0x2d4a2c[_0xed39('0x23')];var _0x540224;if(_0x40ccfe>=_0x200f4e){_0x40ccfe=_0x200f4e;_0x540224=0xc8;}else{_0x540224=0xce;}_0x9216b['status'](_0x540224);return _0x9216b[_0xed39('0x24')]('Content-Range',_0x575550+'-'+_0x40ccfe+'/'+_0x200f4e)[_0xed39('0x1f')](_0x4ee208);}return null;};}function patchUpdates(_0x17f8af){return function(_0x3a7e34){try{jsonpatch[_0xed39('0x25')](_0x3a7e34,_0x17f8af,!![]);}catch(_0x2a08d2){return BPromise[_0xed39('0x26')](_0x2a08d2);}return _0x3a7e34['save']();};}function saveUpdates(_0x2b522a,_0x288e66){return function(_0x58fc87){if(_0x58fc87){return _0x58fc87[_0xed39('0x27')](_0x2b522a)[_0xed39('0x28')](function(_0x20f384){return _0x20f384;});}return null;};}function removeEntity(_0x51597d,_0x4b1b7b){return function(_0x5f1b66){if(_0x5f1b66){return _0x5f1b66['destroy']()[_0xed39('0x28')](function(){_0x51597d[_0xed39('0x1d')](0xcc)[_0xed39('0x1e')]();});}};}function handleEntityNotFound(_0x11c04f,_0x1a1561){return function(_0x25dee4){if(!_0x25dee4){_0x11c04f[_0xed39('0x29')](0x194);}return _0x25dee4;};}function handleError(_0x38d5a2,_0x4fb6f6){_0x4fb6f6=_0x4fb6f6||0x1f4;return function(_0x4c1283){logger[_0xed39('0x2a')](_0x4c1283[_0xed39('0x2b')]);if(_0x4c1283[_0xed39('0x2c')]){delete _0x4c1283[_0xed39('0x2c')];}_0x38d5a2[_0xed39('0x1d')](_0x4fb6f6)[_0xed39('0x2d')](_0x4c1283);};}function getInteractionUsers(_0x22593a,_0x2cdce8){return new BPromise(function(_0x55ccd0,_0x2a5fa1){try{if(_0x2cdce8[_0x22593a['id']]){_0x22593a[_0xed39('0x2e')]=_[_0xed39('0x2f')](_0x2cdce8[_0x22593a['id']],function(_0x5a1cad){return{'id':_0x5a1cad['id'],'fullname':_0x5a1cad[_0xed39('0x30')]};});}}catch(_0x29ffad){_0x2a5fa1(_0x29ffad);}_0x55ccd0(_0x22593a);});}function getInteractionTags(_0x3010bb,_0x505ef1){return new BPromise(function(_0x54a04a,_0x93abe7){try{if(_0x3010bb[_0xed39('0x31')]){_0x3010bb['Tags']=[];_0x3010bb[_0xed39('0x31')][_0xed39('0x32')](',')['forEach'](function(_0x1ec72c){_0x3010bb[_0xed39('0x33')]['push'](_0x505ef1[_0x1ec72c]);});}delete _0x3010bb[_0xed39('0x31')];}catch(_0x3663ce){_0x93abe7(_0x3663ce);}_0x54a04a(_0x3010bb);});}function updateOpenchannelInteraction(_0x1180cf,_0x24f8b8,_0x187117){return new BPromise(function(_0x1e0d34,_0x16b743){return getInteractionUsers(_0x1180cf,_0x187117)[_0xed39('0x28')](function(_0x5934d6){return getInteractionTags(_0x5934d6,_0x24f8b8);})['then'](function(_0x5d92ea){return getStateInteraction(_0x5d92ea);})[_0xed39('0x28')](function(_0x37d76e){_0x1e0d34(_0x37d76e);})[_0xed39('0x34')](function(_0x212525){_0x16b743(_0x212525);});});}function getStateInteraction(_0x43917e){return new BPromise(function(_0x5461a){_0x43917e[_0xed39('0x35')]=0x0;_0x43917e[_0xed39('0x36')]=0x0;_0x43917e['answered']=0x0;_0x43917e[_0xed39('0x37')]=0x0;_0x43917e[_0xed39('0x38')]=0x0;if(!_0x43917e[_0xed39('0x39')]&&!_0x43917e[_0xed39('0x3a')]){_0x43917e[_0xed39('0x35')]+=0x1;}if(!_0x43917e[_0xed39('0x39')]&&_0x43917e['UserId']){_0x43917e[_0xed39('0x36')]+=0x1;if(_0x43917e[_0xed39('0x35')]){_0x43917e['waiting']-=0x1;}}if(_0x43917e['closed']&&_0x43917e['UserId']){_0x43917e[_0xed39('0x3b')]+=0x1;if(_0x43917e['talking']){_0x43917e[_0xed39('0x36')]-=0x1;}}if(_0x43917e['closed']&&!_0x43917e[_0xed39('0x3a')]){_0x43917e[_0xed39('0x37')]+=0x1;if(_0x43917e[_0xed39('0x35')]){_0x43917e[_0xed39('0x35')]-=0x1;}}_0x43917e[_0xed39('0x38')]+=0x1;_0x5461a(_0x43917e);});}exports[_0xed39('0x3c')]=function(_0x562efc,_0x43fe77){var _0x60ee30={},_0x27d11b={},_0x42e57c={'count':0x0,'rows':[]};var _0x326205=_[_0xed39('0x2f')](db[_0xed39('0x3d')][_0xed39('0x3e')],function(_0x4a85bc){return{'name':_0x4a85bc['fieldName'],'type':_0x4a85bc['type'][_0xed39('0x3f')]};});_0x27d11b['model']=_['map'](_0x326205,_0xed39('0x2c'));_0x27d11b[_0xed39('0x40')]=_[_0xed39('0x41')](_0x562efc['query']);_0x27d11b[_0xed39('0x42')]=_[_0xed39('0x43')](_0x27d11b['model'],_0x27d11b['query']);_0x60ee30[_0xed39('0x44')]=_[_0xed39('0x43')](_0x27d11b[_0xed39('0x45')],qs[_0xed39('0x46')](_0x562efc['query'][_0xed39('0x46')]));_0x60ee30[_0xed39('0x44')]=_0x60ee30[_0xed39('0x44')]['length']?_0x60ee30[_0xed39('0x44')]:_0x27d11b[_0xed39('0x45')];if(!_0x562efc[_0xed39('0x40')][_0xed39('0x47')](_0xed39('0x48'))){_0x60ee30[_0xed39('0x23')]=qs[_0xed39('0x23')](_0x562efc['query']['limit']);_0x60ee30[_0xed39('0x22')]=qs[_0xed39('0x22')](_0x562efc[_0xed39('0x40')][_0xed39('0x22')]);}_0x60ee30[_0xed39('0x49')]=qs[_0xed39('0x4a')](_0x562efc[_0xed39('0x40')]['sort']);_0x60ee30[_0xed39('0x4b')]=qs['filters'](_[_0xed39('0x4c')](_0x562efc[_0xed39('0x40')],_0x27d11b[_0xed39('0x42')]),_0x326205);var _0x2ae219=[];var _0x44c739=squel['select']()['field']('id')['field'](_0xed39('0x2c'))[_0xed39('0x4d')](_0xed39('0x4e'))['from'](_0xed39('0x4f'));var _0xbba084=squel['select']()['field'](_0xed39('0x50'))['field'](_0xed39('0x51'))[_0xed39('0x4d')]('ui.OpenchannelInteractionId')['from'](_0xed39('0x52'),'ui')['left_join'](_0xed39('0x53'),'u',_0xed39('0x54'));var _0x41e2d2=squel['select']()[_0xed39('0x55')](_0xed39('0x56'),'i')[_0xed39('0x57')](_0xed39('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xed39('0x57')](_0xed39('0x53'),'o',_0xed39('0x59'))[_0xed39('0x57')](_0xed39('0x5a'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xed39('0x5b'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join']('openchannel_interaction_has_tags','it',_0xed39('0x5c'))[_0xed39('0x57')]('tools_tags','t',_0xed39('0x5d'));var _0x28ed9c=squel['expr']();var _0x1ce6d6=[];var _0x49fe66=squel[_0xed39('0x5e')]();var _0x3104e4;if(_0x562efc[_0xed39('0x40')][_0xed39('0x5f')]){_0x3104e4=as[_0xed39('0x60')](_0x562efc['query']['search']);var _0x5c92f7=_0x3104e4[_0xed39('0x61')];for(var _0x1c52b8=0x0;_0x1c52b8<_0x3104e4[_0xed39('0x62')]['length'];_0x1c52b8++){var _0x578c67=_0x3104e4[_0xed39('0x62')][_0x1c52b8];var _0x429d6c='i';var _0x4c6242=_[_0xed39('0x63')](_0x326205,[_0xed39('0x2c'),_0x578c67['field']]);if(!_0x4c6242){switch(_0x578c67[_0xed39('0x4d')]){case _0xed39('0x64'):if(_0x578c67[_0xed39('0x65')]==0x1){_0x41e2d2['having']('`'+_0x578c67[_0xed39('0x4d')]+_0xed39('0x66'));}else{_0x41e2d2['having']('`'+_0x578c67[_0xed39('0x4d')]+_0xed39('0x67'));}break;case _0xed39('0x68'):if(_0x578c67['operator']===_0xed39('0x69')){if(_0x578c67[_0xed39('0x65')][_0xed39('0x32')]('\x20')[_0xed39('0x6a')]>0x1){_0x28ed9c[_0x5c92f7](_0xed39('0x6b'),qs[_0xed39('0x6c')](_0x578c67[_0xed39('0x65')]),null);}else{var _0x3134b2='%'+_0x578c67[_0xed39('0x65')]+'%';_0x28ed9c[_0x5c92f7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3134b2,_0x3134b2,_0x3134b2);}}else{_0x4c6242=_['find'](_0x326205,[_0xed39('0x2c'),_0xed39('0x6d')]);_0x578c67[_0xed39('0x4d')]=_0xed39('0x6d');_0x713b0b=as['buildExpression'](_0x429d6c,_0x4c6242[_0xed39('0x6e')],_0x578c67);_0x28ed9c[_0x5c92f7](_0x713b0b[_0xed39('0x6f')],_0x713b0b[_0xed39('0x65')][_0xed39('0x70')],_0x713b0b[_0xed39('0x65')][_0xed39('0x1e')]);}break;case _0xed39('0x71'):var _0x2cdcb1=_0x578c67[_0xed39('0x65')]['split'](',')[_0xed39('0x2f')](function(_0x2ffa94){return Number(_0x2ffa94);});_0x2cdcb1[_0xed39('0x72')](function(_0x4df528){_0x49fe66['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4df528+',%');});_0x1ce6d6=_['union'](_0x1ce6d6,_0x2cdcb1);break;case'User':if(_0x578c67[_0xed39('0x73')]===_0xed39('0x69')){_0x28ed9c[_0x5c92f7](_0xed39('0x74'),'%'+_0x578c67[_0xed39('0x65')]+'%',null);}else{_0x4c6242=_[_0xed39('0x63')](_0x326205,[_0xed39('0x2c'),_0xed39('0x3a')]);_0x578c67[_0xed39('0x4d')]=_0xed39('0x3a');_0x713b0b=as[_0xed39('0x75')](_0x429d6c,_0x4c6242[_0xed39('0x6e')],_0x578c67);_0x28ed9c[_0x5c92f7](_0x713b0b[_0xed39('0x6f')],_0x713b0b[_0xed39('0x65')][_0xed39('0x70')],_0x713b0b['value'][_0xed39('0x1e')]);}break;case _0xed39('0x76'):_0x713b0b=as[_0xed39('0x75')]('me',null,_0x578c67);_0x28ed9c[_0x5c92f7](_0x713b0b[_0xed39('0x6f')],_0x713b0b[_0xed39('0x65')]['start'],_0x713b0b[_0xed39('0x65')][_0xed39('0x1e')]);break;}}else{var _0x713b0b=as[_0xed39('0x75')](_0x429d6c,_0x4c6242[_0xed39('0x6e')],_0x578c67);_0x28ed9c[_0x5c92f7](_0x713b0b[_0xed39('0x6f')],_0x713b0b['value'][_0xed39('0x70')],_0x713b0b[_0xed39('0x65')][_0xed39('0x1e')]);}}}else{var _0x49b4c5=_(_0x562efc['query'])[_0xed39('0x41')]()[_0xed39('0x2f')](function(_0x2ad287){return _[_0xed39('0x77')](_0x326205,[_0xed39('0x2c'),_0x2ad287])?_0x2ad287:undefined;})['compact']()[_0xed39('0x65')]();if(!_[_0xed39('0x78')](_0x49b4c5)){_0x49b4c5[_0xed39('0x72')](function(_0x5a7c98){if(_0x5a7c98===_0xed39('0x79')){_0x41e2d2['where'](_0xed39('0x7a'),[][_0xed39('0x7b')](_0x562efc[_0xed39('0x40')][_0x5a7c98]));}else if(_0x5a7c98===_0xed39('0x7c')){var _0x223547=JSON[_0xed39('0x7d')](_0x562efc[_0xed39('0x40')][_0x5a7c98])['$gte'];var _0x512bd7=JSON[_0xed39('0x7d')](_0x562efc['query'][_0x5a7c98])['$lte'];_0x41e2d2[_0xed39('0x4b')](_0xed39('0x7e'),_0x223547,_0x512bd7);}else{if(_0x562efc[_0xed39('0x40')][_0x5a7c98]===_0xed39('0x7f')){_0x41e2d2['where']('i.'+_0x5a7c98+_0xed39('0x80'));}else{_0x41e2d2['where']('i.'+_0x5a7c98+_0xed39('0x81'),_0x562efc[_0xed39('0x40')][_0x5a7c98]);}}});}if(_0x562efc[_0xed39('0x40')]['read']){if(_0x562efc[_0xed39('0x40')][_0xed39('0x82')]==0x1){_0x41e2d2[_0xed39('0x83')](_0xed39('0x84'));}else{_0x41e2d2[_0xed39('0x83')](_0xed39('0x85'));}}if(_0x562efc['query'][_0xed39('0x86')]){_0x1ce6d6=_[_0xed39('0x87')](_0x562efc[_0xed39('0x40')]['tag'])?_0x562efc[_0xed39('0x40')][_0xed39('0x86')]:new Array(_0x562efc[_0xed39('0x40')]['tag']);_0x1ce6d6[_0xed39('0x72')](function(_0x556b85){_0x49fe66['or'](_0xed39('0x88'),'%,'+_0x556b85+',%');});}if(_0x562efc[_0xed39('0x40')]['filter']){var _0x7ad02d=_0x562efc[_0xed39('0x40')][_0xed39('0x89')][_0xed39('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x7ad02d)){_0x28ed9c['or'](_0xed39('0x8b'),_0x7ad02d+'%');}else{_0x28ed9c['or'](_0xed39('0x8c'),qs[_0xed39('0x6c')](_0x7ad02d))['or']('i.from\x20LIKE\x20?',_0x7ad02d+'%')['or'](_0xed39('0x8d'),_0x7ad02d+'%');}}}_0x41e2d2[_0xed39('0x4b')](_0x28ed9c);_0x41e2d2['group'](_0xed39('0x8e'));var _0x84d75f={'type':db['Sequelize'][_0xed39('0x8f')][_0xed39('0x90')],'raw':!![]};var _0x476c85=_0x41e2d2[_0xed39('0x91')]();_0x476c85[_0xed39('0x4d')](_0xed39('0x8e'));_0x476c85[_0xed39('0x4d')](_0xed39('0x92'),_0xed39('0x64'));if(_0x60ee30['order']){_0x60ee30[_0xed39('0x49')][_0xed39('0x72')](function(_0xf10264){var _0x8be913=_0xf10264[0x0]===_0xed39('0x93')?_0xf10264[0x0]:'i.'+_0xf10264[0x0];_0x41e2d2[_0xed39('0x49')](_0x8be913,_0xf10264[0x1]===_0xed39('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x1ce6d6)){_0x41e2d2['having'](_0x49fe66);_0x476c85[_0xed39('0x4b')](_0xed39('0x95'),_0x1ce6d6);}BPromise[_0xed39('0x96')]()[_0xed39('0x28')](function(){if(!_0x3104e4){if(_0x562efc[_0xed39('0x40')][_0xed39('0x79')])return;_0x476c85[_0xed39('0x4b')](_0xed39('0x97'));_0x41e2d2[_0xed39('0x4b')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x562efc['user']['role']!==_0xed39('0x98'))return;return _0x562efc[_0xed39('0x99')][_0xed39('0x9a')]({'attributes':['id'],'raw':!![]})[_0xed39('0x28')](function(_0x169479){if(_[_0xed39('0x78')](_0x169479)){_0x476c85['where'](_0xed39('0x9b'));_0x41e2d2[_0xed39('0x4b')](_0xed39('0x9b'));}else{_0x476c85[_0xed39('0x4b')](_0xed39('0x7a'),_[_0xed39('0x2f')](_0x169479,'id'));_0x41e2d2['where'](_0xed39('0x7a'),_[_0xed39('0x2f')](_0x169479,'id'));}});})[_0xed39('0x28')](function(){if(_0x562efc[_0xed39('0x99')][_0xed39('0x9c')]===_0xed39('0x98')&&!_0x3104e4&&!_0x562efc[_0xed39('0x40')][_0xed39('0x79')])return[];return db[_0xed39('0x9d')]['query'](_0x476c85['toString'](),_0x84d75f);})[_0xed39('0x28')](function(_0x217491){_0x42e57c['count']=_0x217491['length'];if(_0x42e57c[_0xed39('0x21')]===0x0)return[];return db[_0xed39('0x9d')][_0xed39('0x40')](_0x44c739[_0xed39('0x9e')](),_0x84d75f)[_0xed39('0x28')](function(_0x228498){_0x2ae219=_[_0xed39('0x9f')](_0x228498,'id');_0x84d75f=_[_0xed39('0xa0')](_0x84d75f,{'model':db[_0xed39('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x562efc[_0xed39('0x40')][_0xed39('0x46')]){_0x60ee30[_0xed39('0x44')][_0xed39('0x72')](function(_0x45e88c){_0x41e2d2[_0xed39('0x4d')]('i.'+_0x45e88c);});}else{_0x41e2d2[_0xed39('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xed39('0x64'));_0x41e2d2['field']('a.key',_0xed39('0xa1'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xa2'),_0xed39('0xa3'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xa4'),_0xed39('0x93'));_0x41e2d2['field'](_0xed39('0xa5'));_0x41e2d2['field'](_0xed39('0xa6'),'Contact.firstName');_0x41e2d2[_0xed39('0x4d')]('c.lastName',_0xed39('0xa7'));_0x41e2d2['field']('c.email','Contact.email');_0x41e2d2['field']('c.phone',_0xed39('0xa8'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xa9'),_0xed39('0xaa'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xab'),_0xed39('0xac'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xad'),_0xed39('0xae'));_0x41e2d2['field'](_0xed39('0xaf'),_0xed39('0xb0'));_0x41e2d2[_0xed39('0x4d')](_0xed39('0xb1'),'TagIds');}if(_0x60ee30[_0xed39('0x23')])_0x41e2d2['limit'](_0x60ee30[_0xed39('0x23')]);if(_0x60ee30[_0xed39('0x22')])_0x41e2d2[_0xed39('0x22')](_0x60ee30[_0xed39('0x22')]);return db['sequelize'][_0xed39('0x40')](_0x41e2d2[_0xed39('0x9e')](),_0x84d75f);})[_0xed39('0x28')](function(_0xaeb22a){if(_0xaeb22a[_0xed39('0x6a')]>0x0)_0xbba084[_0xed39('0x4b')](_0xed39('0xb2'),_[_0xed39('0x2f')](_0xaeb22a,'id'));return db[_0xed39('0x9d')][_0xed39('0x40')](_0xbba084[_0xed39('0x9e')](),_0x84d75f)[_0xed39('0x28')](function(_0x5735d7){var _0x562521=_[_0xed39('0xb3')](_0x5735d7,'OpenchannelInteractionId');var _0x2f34b8=[];_0xaeb22a[_0xed39('0x72')](function(_0x2cb39b){_0x2f34b8[_0xed39('0xb4')](updateOpenchannelInteraction(_0x2cb39b,_0x2ae219,_0x562521));});return BPromise[_0xed39('0xb5')](_0x2f34b8);});});})['then'](function(_0x15ff9b){_0x42e57c[_0xed39('0xb6')]=_0x15ff9b;return _0x42e57c;})[_0xed39('0x28')](respondWithFilteredResult(_0x43fe77,_0x60ee30))[_0xed39('0x34')](handleError(_0x43fe77,null));};exports[_0xed39('0xb7')]=function(_0x1bae70,_0x5234cc){var _0x22f4a5={};if(_0x1bae70['query'][_0xed39('0x6e')]&&_0x1bae70[_0xed39('0x40')][_0xed39('0x6e')]===_0xed39('0x55')){_0x22f4a5[_0xed39('0x55')]=_0x1bae70[_0xed39('0xb8')]['id'];}else{_0x22f4a5['id']=_0x1bae70['params']['id'];}var _0x30b1ef={'raw':![],'where':_0x22f4a5},_0x2d5f93={};_0x2d5f93[_0xed39('0x45')]=_[_0xed39('0x41')](db[_0xed39('0x3d')][_0xed39('0x3e')]);_0x2d5f93[_0xed39('0x40')]=_[_0xed39('0x41')](_0x1bae70['query']);_0x2d5f93[_0xed39('0x42')]=_[_0xed39('0x43')](_0x2d5f93[_0xed39('0x45')],_0x2d5f93[_0xed39('0x40')]);_0x30b1ef[_0xed39('0x44')]=_[_0xed39('0x43')](_0x2d5f93['model'],qs[_0xed39('0x46')](_0x1bae70['query'][_0xed39('0x46')]));_0x30b1ef[_0xed39('0x44')]=_0x30b1ef[_0xed39('0x44')][_0xed39('0x6a')]?_0x30b1ef[_0xed39('0x44')]:_0x2d5f93[_0xed39('0x45')];if(_0x1bae70[_0xed39('0x40')][_0xed39('0xb9')]){_0x30b1ef['include']=[{'all':!![]}];}_0x30b1ef=_[_0xed39('0xa0')]({},_0x30b1ef,_0x1bae70['options']);return db[_0xed39('0x3d')][_0xed39('0x63')](_0x30b1ef)[_0xed39('0x28')](handleEntityNotFound(_0x5234cc,null))[_0xed39('0x28')](respondWithResult(_0x5234cc,null))[_0xed39('0x34')](handleError(_0x5234cc,null));};exports[_0xed39('0xba')]=function(_0x40c208,_0x2874cd){return db[_0xed39('0x3d')][_0xed39('0xba')](_0x40c208[_0xed39('0x76')],{})['then'](respondWithResult(_0x2874cd,0xc9))[_0xed39('0x34')](handleError(_0x2874cd,null));};exports[_0xed39('0x27')]=function(_0x794183,_0x7392d8){if(_0x794183[_0xed39('0x76')]['id']){delete _0x794183['body']['id'];}return db[_0xed39('0x3d')][_0xed39('0x63')]({'where':{'id':_0x794183[_0xed39('0xb8')]['id']}})[_0xed39('0x28')](handleEntityNotFound(_0x7392d8,null))[_0xed39('0x28')](saveUpdates(_0x794183['body'],null))[_0xed39('0x28')](respondWithResult(_0x7392d8,null))[_0xed39('0x34')](handleError(_0x7392d8,null));};exports[_0xed39('0xbb')]=function(_0x438d26,_0x1a5af5){return db[_0xed39('0x3d')][_0xed39('0x63')]({'where':{'id':_0x438d26[_0xed39('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1a5af5,null))[_0xed39('0x28')](removeEntity(_0x1a5af5,null))[_0xed39('0x34')](handleError(_0x1a5af5,null));};exports[_0xed39('0xbc')]=function(_0x3033bc,_0x32b482){return db['OpenchannelInteraction'][_0xed39('0xbc')]()[_0xed39('0x28')](respondWithResult(_0x32b482,null))['catch'](handleError(_0x32b482,null));};exports[_0xed39('0xbd')]=function(_0x4f3ee9,_0x140a97,_0x48ca6a){return db[_0xed39('0xbe')][_0xed39('0x63')]({'where':{'id':_0x4f3ee9[_0xed39('0xb8')]['id']}})['then'](handleEntityNotFound(_0x140a97,null))[_0xed39('0x28')](function(_0xb7ff6c){if(_0xb7ff6c){return _0xb7ff6c[_0xed39('0xbd')](_0x4f3ee9[_0xed39('0x76')][_0xed39('0xbf')],_[_0xed39('0xc0')](_0x4f3ee9[_0xed39('0x76')],[_0xed39('0xbf'),'id'])||{});}})[_0xed39('0x28')](respondWithResult(_0x140a97,null))[_0xed39('0x34')](handleError(_0x140a97,null));};exports[_0xed39('0xc1')]=function(_0x4aaea3,_0x1bde85,_0x40dba9){var _0x264396={'raw':![],'where':{}};var _0x10af8d={};var _0x4da787={'count':0x0,'rows':[]};return db[_0xed39('0x3d')][_0xed39('0xc2')]({'where':{'id':_0x4aaea3['params']['id']}})[_0xed39('0x28')](handleEntityNotFound(_0x1bde85,null))['then'](function(_0xcabec0){if(_0xcabec0){_0x10af8d[_0xed39('0x45')]=_[_0xed39('0x41')](db[_0xed39('0xbe')][_0xed39('0x3e')]);_0x10af8d[_0xed39('0x40')]=_[_0xed39('0x41')](_0x4aaea3['query']);_0x10af8d[_0xed39('0x42')]=_[_0xed39('0x43')](_0x10af8d[_0xed39('0x45')],_0x10af8d[_0xed39('0x40')]);_0x264396[_0xed39('0x44')]=_[_0xed39('0x43')](_0x10af8d[_0xed39('0x45')],qs[_0xed39('0x46')](_0x4aaea3['query'][_0xed39('0x46')]));_0x264396[_0xed39('0x44')]=_0x264396[_0xed39('0x44')]['length']?_0x264396[_0xed39('0x44')]:_0x10af8d[_0xed39('0x45')];if(!_0x4aaea3[_0xed39('0x40')]['hasOwnProperty'](_0xed39('0x48'))){_0x264396[_0xed39('0x23')]=qs[_0xed39('0x23')](_0x4aaea3[_0xed39('0x40')][_0xed39('0x23')]);_0x264396['offset']=qs[_0xed39('0x22')](_0x4aaea3[_0xed39('0x40')][_0xed39('0x22')]);}_0x264396['order']=qs['sort'](_0x4aaea3['query'][_0xed39('0x4a')]);_0x264396[_0xed39('0x4b')]=qs[_0xed39('0x42')](_[_0xed39('0x4c')](_0x4aaea3['query'],_0x10af8d['filters']));_0x264396[_0xed39('0x4b')][_0xed39('0xc3')]=_0xcabec0['id'];if(_0x4aaea3[_0xed39('0x40')][_0xed39('0x89')]){_0x264396['where']=_['merge'](_0x264396[_0xed39('0x4b')],{'$or':_[_0xed39('0x2f')](_0x264396[_0xed39('0x44')],function(_0x13927b){var _0x310b9e={};_0x310b9e[_0x13927b]={'$like':'%'+_0x4aaea3['query'][_0xed39('0x89')]+'%'};return _0x310b9e;})});}if(_0x4aaea3[_0xed39('0x40')]['$gte']){var _0x52e2e6=_0x4aaea3[_0xed39('0x40')]['$gte']['split'](',');var _0x289cda={};_0x289cda[_0x52e2e6[0x0]]={'$gte':moment(_0x52e2e6[0x1])[_0xed39('0xc4')](_0xed39('0xc5'))};_0x264396[_0xed39('0x4b')]=_['merge'](_0x264396[_0xed39('0x4b')],_0x289cda);}_0x264396=_[_0xed39('0xa0')]({},_0x264396,_0x4aaea3[_0xed39('0xc6')]);return db['OpenchannelMessage'][_0xed39('0x21')]({'where':_0x264396[_0xed39('0x4b')]})[_0xed39('0x28')](function(_0x86a93b){_0x4da787[_0xed39('0x21')]=_0x86a93b;if(_0x4aaea3['query'][_0xed39('0xb9')]){_0x264396[_0xed39('0xc7')]=[{'all':!![]}];}return db[_0xed39('0xbe')][_0xed39('0xc8')](_0x264396);})[_0xed39('0x28')](function(_0x495da5){_0x4da787[_0xed39('0xb6')]=_0x495da5;return _0x4da787;});}})[_0xed39('0x28')](respondWithFilteredResult(_0x1bde85,_0x264396))[_0xed39('0x34')](handleError(_0x1bde85,null));};exports[_0xed39('0xc9')]=function(_0x431bc6,_0xde63f5,_0x522543){return db['OpenchannelInteraction']['find']({'where':{'id':_0x431bc6[_0xed39('0xb8')]['id']}})[_0xed39('0x28')](handleEntityNotFound(_0xde63f5,null))[_0xed39('0x28')](function(_0x21daf8){if(_0x21daf8){return _0x21daf8[_0xed39('0xca')](_0x431bc6[_0xed39('0x76')][_0xed39('0xbf')],_[_0xed39('0xc0')](_0x431bc6[_0xed39('0x76')],['ids','id'])||{})['spread'](function(){return db[_0xed39('0x71')][_0xed39('0xc8')]({'attributes':['id',_0xed39('0x2c'),_0xed39('0x4e')],'where':{'id':_0x431bc6[_0xed39('0x76')]['ids']}});})[_0xed39('0x28')](function(_0x505251){socket[_0xed39('0xcb')](_0xed39('0xcc'),{'id':Number(_0x431bc6[_0xed39('0xb8')]['id']),'tags':_0x505251||[]});return{'id':Number(_0x431bc6['params']['id']),'tags':_0x505251||[]};});}})[_0xed39('0x28')](respondWithResult(_0xde63f5,null))[_0xed39('0x34')](handleError(_0xde63f5,null));};exports['removeTags']=function(_0x76b9cd,_0x29f872,_0x205afa){return db[_0xed39('0x3d')][_0xed39('0x63')]({'where':{'id':_0x76b9cd[_0xed39('0xb8')]['id']}})[_0xed39('0x28')](handleEntityNotFound(_0x29f872,null))[_0xed39('0x28')](function(_0x12adb0){if(_0x12adb0){return _0x12adb0[_0xed39('0xcd')](_0x76b9cd[_0xed39('0x40')]['ids']);}})[_0xed39('0x28')](respondWithStatusCode(_0x29f872,null))[_0xed39('0x34')](handleError(_0x29f872,null));};exports['download']=function(_0x3639f9,_0x45efd7){var _0x3879a2=moment()['unix']()[_0xed39('0x9e')]();var _0x5310c7=path[_0xed39('0xce')](config[_0xed39('0xcf')],_0xed39('0xd0'),_0xed39('0xd1'),'tmp');var _0x31d032=path[_0xed39('0xce')](config[_0xed39('0xcf')],_0xed39('0xd0'),'files',_0xed39('0xd2'));var _0xe9e7a=path[_0xed39('0xce')](_0x5310c7,_0x3879a2);var _0x1d4a58=util[_0xed39('0xc4')]('transcript-%d-%s.zip',_0x3639f9['params']['id'],_0x3879a2);var _0x4095f0=path[_0xed39('0xce')](_0x5310c7,_0x1d4a58);var _0x5a5966=[];_0x5a5966[_0xed39('0xb4')]({'model':db[_0xed39('0xd3')],'as':_0xed39('0xd3'),'attributes':['id',_0xed39('0x30')],'raw':!![]});_0x5a5966[_0xed39('0xb4')]({'model':db[_0xed39('0xd4')],'as':_0xed39('0x68'),'attributes':['id',_0xed39('0xd5'),_0xed39('0xd6')],'raw':!![]});if(_0x3639f9[_0xed39('0x40')]['attachments']){_0x5a5966['push']({'model':db[_0xed39('0xd7')],'as':_0xed39('0xd7'),'raw':!![]});}var _0x8231f4=[{'model':db[_0xed39('0xbe')],'as':_0xed39('0xd8'),'attributes':['id','body',_0xed39('0x7c'),'direction',_0xed39('0xd9'),_0xed39('0x82')],'include':_0x5a5966}];_0x8231f4[_0xed39('0xb4')]({'model':db[_0xed39('0xda')],'as':_0xed39('0xdb'),'attributes':['id',_0xed39('0x2c')]});_0x8231f4['push']({'model':db[_0xed39('0xd3')],'as':_0xed39('0xdc'),'attributes':['id',_0xed39('0x30')]});return db['OpenchannelInteraction'][_0xed39('0x63')]({'where':{'id':_0x3639f9['params']['id']},'include':_0x8231f4})[_0xed39('0x28')](handleEntityNotFound(_0x45efd7,null))[_0xed39('0x28')](function(_0x1a0f87){if(_0x1a0f87){var _0x5a923a=_0x1a0f87[_0xed39('0xdd')]({'plain':!![]});fs[_0xed39('0xde')](_0xe9e7a);var _0x554361={'channel':'Openchannel','account':_0x5a923a[_0xed39('0xdb')][_0xed39('0x2c')],'agent':_0x5a923a[_0xed39('0xdc')]?_0x5a923a[_0xed39('0xdc')][_0xed39('0x30')]:_0xed39('0xdf'),'createdAt':moment(_0x5a923a[_0xed39('0x7c')])[_0xed39('0xc4')](_0xed39('0xc5'))[_0xed39('0x9e')](),'closedAt':_0x5a923a[_0xed39('0x39')]?moment(_0x5a923a[_0xed39('0xe0')])[_0xed39('0xc4')](_0xed39('0xc5'))[_0xed39('0x9e')]():'','disposition':_0x5a923a[_0xed39('0xe1')],'visibility':_0x5a923a[_0xed39('0xe2')]?_0xed39('0xe3'):_0xed39('0xe4'),'messages':_(_0x5a923a['Messages'])[_0xed39('0x89')]({'secret':![]})[_0xed39('0x2f')](function(_0x1fb801){if(_0x1fb801[_0xed39('0xd7')]){var _0x1b2619=path[_0xed39('0xce')](_0x31d032,_0x1fb801['Attachment']['basename']);if(fs[_0xed39('0xe5')](_0x1b2619)){fs[_0xed39('0xe6')](_0x1b2619)[_0xed39('0xe7')](fs[_0xed39('0xe8')](path['join'](_0xe9e7a,_0x1fb801['Attachment'][_0xed39('0xe9')])));}}return{'date':moment(_0x1fb801[_0xed39('0x7c')])[_0xed39('0xc4')](_0xed39('0xc5'))[_0xed39('0x9e')](),'sender':_0x1fb801[_0xed39('0xea')]===_0xed39('0xeb')?_0x1fb801[_0xed39('0xd3')]?_0x1fb801[_0xed39('0xd3')][_0xed39('0x30')]:'System':_0x1fb801[_0xed39('0x68')][_0xed39('0xd5')]+(_0x1fb801['Contact'][_0xed39('0xd6')]?'\x20'+_0x1fb801[_0xed39('0x68')]['lastName']:''),'body':_0x1fb801['Attachment']?_0x1fb801[_0xed39('0xd7')]['basename']:_0x1fb801[_0xed39('0x76')],'direction':_0x1fb801['direction']===_0xed39('0xeb')?'A':'C','secret':_0x1fb801[_0xed39('0xd9')],'read':_0x1fb801[_0xed39('0x82')],'attachment':_0x1fb801[_0xed39('0xd7')]};})[_0xed39('0x65')]()};return ejs['renderFile'](path[_0xed39('0xce')](config[_0xed39('0xcf')],_0xed39('0xd0'),_0xed39('0xec'),_0xed39('0xed')),{'interaction':_0x554361})[_0xed39('0x28')](function(_0x59dd68){var _0x4feb92=path[_0xed39('0xce')](_0xe9e7a,_0xed39('0xee')+_0x5a923a['id']+'-'+_0x3879a2+_0xed39('0xef'));var _0x7a6fa1={'path':_0x4feb92,'channel':'Openchannel','interactionId':_0x5a923a['id']};return pdf['createPdfFromHTML'](_0x59dd68,_0x7a6fa1);})[_0xed39('0x28')](function(){return new BPromise(function(_0x26220c,_0x3075ee){zipdir(_0xe9e7a,{'saveTo':_0x4095f0},function(_0x4db8ee,_0x283e32){if(_0x4db8ee)return _0x3075ee(_0x4db8ee);return _0x26220c(_0x283e32);});})[_0xed39('0x28')](function(){return new BPromise(function(_0x48ca5c,_0x582fb1){rimraf(_0xe9e7a,function(_0x8494db){if(_0x8494db)_0x582fb1(_0x8494db);return _0x48ca5c();});});})[_0xed39('0x28')](function(){return _0x45efd7[_0xed39('0xf0')](_0x4095f0,_0x1d4a58,function(_0x2f4d45){if(_0x2f4d45){console['log']('err',_0x2f4d45);}else{fs[_0xed39('0xf1')](_0x4095f0);}});});});}else{return _0x45efd7[_0xed39('0x29')](0xc8);}})[_0xed39('0x34')](handleError(_0x45efd7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b831f11..9defda3 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 _0x8639=['save','remove','getUsers','then','Users','map','findAll','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x51ddee,_0x1e0baf){var _0x875f0c=function(_0x14824d){while(--_0x14824d){_0x51ddee['push'](_0x51ddee['shift']());}};_0x875f0c(++_0x1e0baf);}(_0x8639,0x18c));var _0x9863=function(_0xe8cb76,_0xa17a3e){_0xe8cb76=_0xe8cb76-0x0;var _0x1d8d33=_0x8639[_0xe8cb76];return _0x1d8d33;};'use strict';var EventEmitter=require(_0x9863('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x9863('0x1'))['db'][_0x9863('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9863('0x3')](0x0);var events={'afterCreate':_0x9863('0x4'),'afterUpdate':'update','afterDestroy':_0x9863('0x5')};function emitEvent(_0x144148){return function(_0x52fad5,_0x5c6501,_0x1fc229){_0x52fad5[_0x9863('0x6')]({'attributes':['id'],'raw':!![]})[_0x9863('0x7')](function(_0x4993c5){_0x52fad5['setDataValue'](_0x9863('0x8'),_0x4993c5[_0x9863('0x9')](function(_0x51d8b7){return{'id':_0x51d8b7['id']};}));return OpenchannelMessage[_0x9863('0xa')]({'where':{'OpenchannelInteractionId':_0x52fad5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9863('0x7')](function(_0x4b2b05){_0x52fad5['setDataValue'](_0x9863('0xb'),_0x4b2b05[_0x9863('0xc')]);OpenchannelInteractionEvents['emit'](_0x144148+':'+_0x52fad5['id'],_0x52fad5);OpenchannelInteractionEvents['emit'](_0x144148,_0x52fad5);_0x1fc229(null);})['catch'](_0x1fc229(null));};}for(var e in events){if(events[_0x9863('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x9863('0xe')](e,emitEvent(event));}}module[_0x9863('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xde84=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x25231a,_0x4cd16e){var _0x1e88e7=function(_0x4e636c){while(--_0x4e636c){_0x25231a['push'](_0x25231a['shift']());}};_0x1e88e7(++_0x4cd16e);}(_0xde84,0x112));var _0x4de8=function(_0x2fa164,_0x489302){_0x2fa164=_0x2fa164-0x0;var _0x5e9ae5=_0xde84[_0x2fa164];return _0x5e9ae5;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x4de8('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x4de8('0x0'))['db'][_0x4de8('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4de8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4de8('0x3'),'afterDestroy':_0x4de8('0x4')};function emitEvent(_0x300e56){return function(_0x584d3e,_0x24394b,_0x4bbf5a){_0x584d3e[_0x4de8('0x5')]({'attributes':['id'],'raw':!![]})[_0x4de8('0x6')](function(_0x164c14){_0x584d3e[_0x4de8('0x7')](_0x4de8('0x8'),_0x164c14[_0x4de8('0x9')](function(_0x2293ff){return{'id':_0x2293ff['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x584d3e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4de8('0x6')](function(_0x1739db){_0x584d3e[_0x4de8('0x7')](_0x4de8('0xa'),_0x1739db['length']);OpenchannelInteractionEvents[_0x4de8('0xb')](_0x300e56+':'+_0x584d3e['id'],_0x584d3e);OpenchannelInteractionEvents[_0x4de8('0xb')](_0x300e56,_0x584d3e);_0x4bbf5a(null);})['catch'](_0x4bbf5a(null));};}for(var e in events){if(events[_0x4de8('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x4de8('0xd')](e,emitEvent(event));}}module[_0x4de8('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3e043c1..8123bd4 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 _0xcbff=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3f34bf,_0x3ec8b5){var _0x50d7ea=function(_0x1411f7){while(--_0x1411f7){_0x3f34bf['push'](_0x3f34bf['shift']());}};_0x50d7ea(++_0x3ec8b5);}(_0xcbff,0x1c6));var _0xfcbf=function(_0x86ca04,_0x77ec8c){_0x86ca04=_0x86ca04-0x0;var _0x3c4a3b=_0xcbff[_0x86ca04];return _0x3c4a3b;};'use strict';var _=require(_0xfcbf('0x0'));var util=require(_0xfcbf('0x1'));var logger=require('../../config/logger')(_0xfcbf('0x2'));var moment=require(_0xfcbf('0x3'));var BPromise=require(_0xfcbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcbf('0x5'));var rimraf=require(_0xfcbf('0x6'));var config=require(_0xfcbf('0x7'));var attributes=require(_0xfcbf('0x8'));module[_0xfcbf('0x9')]=function(_0x5d11f7,_0x5e3962){return _0x5d11f7['define'](_0xfcbf('0xa'),attributes,{'tableName':_0xfcbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfcbf('0xc'),'collate':_0xfcbf('0xd'),'hooks':{'beforeUpdate':function(_0x5ae120,_0x462e7c,_0x35763f){if(_0x5ae120[_0xfcbf('0xe')]('closed')){_0x5ae120[_0xfcbf('0xf')]=moment()[_0xfcbf('0x10')](_0xfcbf('0x11'));}_0x35763f(null,_0x5ae120);}}});}; \ No newline at end of file +var _0xa100=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xa100,0x78));var _0x0a10=function(_0x39da12,_0x2365e3){_0x39da12=_0x39da12-0x0;var _0x3c68a3=_0xa100[_0x39da12];return _0x3c68a3;};'use strict';var _=require('lodash');var util=require(_0x0a10('0x0'));var logger=require(_0x0a10('0x1'))(_0x0a10('0x2'));var moment=require(_0x0a10('0x3'));var BPromise=require(_0x0a10('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a10('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a10('0x6'));module[_0x0a10('0x7')]=function(_0x1ad1dc,_0x1dbfd7){return _0x1ad1dc[_0x0a10('0x8')](_0x0a10('0x9'),attributes,{'tableName':_0x0a10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0a10('0xb'),'collate':_0x0a10('0xc'),'hooks':{'beforeUpdate':function(_0x114c2b,_0xcb9982,_0x972cf2){if(_0x114c2b[_0x0a10('0xd')](_0x0a10('0xe'))){_0x114c2b[_0x0a10('0xf')]=moment()[_0x0a10('0x10')](_0x0a10('0x11'));}_0x972cf2(null,_0x114c2b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 125824e..26076c9 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 _0x46a2=['request\x20sent','debug','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','then','stringify','AddTagsToOpenchannelInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46a2,0x100));var _0x246a=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x46a2[_0x1bd3ab];return _0x37e394;};'use strict';var _=require(_0x246a('0x0'));var util=require(_0x246a('0x1'));var moment=require(_0x246a('0x2'));var BPromise=require(_0x246a('0x3'));var rs=require(_0x246a('0x4'));var fs=require('fs');var Redis=require(_0x246a('0x5'));var db=require(_0x246a('0x6'))['db'];var utils=require(_0x246a('0x7'));var logger=require(_0x246a('0x8'))(_0x246a('0x9'));var config=require('../../config/environment');var jayson=require(_0x246a('0xa'));var client=jayson['client'][_0x246a('0xb')]({'port':0x232a});config['redis']=_[_0x246a('0xc')](config[_0x246a('0xd')],{'host':_0x246a('0xe'),'port':0x18eb});var socket=require(_0x246a('0xf'))(new Redis(config['redis']));require(_0x246a('0x10'))[_0x246a('0x11')](socket);function respondWithRpcPromise(_0x17563b,_0x55a638,_0x90e3a5){return new BPromise(function(_0x30b071,_0x4f5ac1){return client[_0x246a('0x12')](_0x17563b,_0x90e3a5)['then'](function(_0x458288){logger[_0x246a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x55a638,_0x246a('0x14'));logger[_0x246a('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x55a638,_0x246a('0x14'),JSON['stringify'](_0x458288));if(_0x458288[_0x246a('0x16')]){if(_0x458288[_0x246a('0x16')][_0x246a('0x17')]===0x1f4){logger[_0x246a('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x55a638,_0x458288[_0x246a('0x16')][_0x246a('0x18')]);return _0x4f5ac1(_0x458288[_0x246a('0x16')]['message']);}logger[_0x246a('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x55a638,_0x458288[_0x246a('0x16')][_0x246a('0x18')]);return _0x30b071(_0x458288[_0x246a('0x16')]['message']);}else{logger[_0x246a('0x13')](_0x246a('0x19'),_0x55a638,'request\x20sent');_0x30b071(_0x458288[_0x246a('0x1a')][_0x246a('0x18')]);}})[_0x246a('0x1b')](function(_0x8d9c69){logger['error'](_0x246a('0x19'),_0x55a638,_0x8d9c69);_0x4f5ac1(_0x8d9c69);});});}exports[_0x246a('0x1c')]=function(_0x4fc4e8){var _0x4735cc=this;return new Promise(function(_0x85cf80,_0x10b93c){return db[_0x246a('0x1d')][_0x246a('0x1e')](_0x4fc4e8['body'],{'raw':_0x4fc4e8[_0x246a('0x1f')]?_0x4fc4e8[_0x246a('0x1f')][_0x246a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc4e8[_0x246a('0x1f')]?_0x4fc4e8[_0x246a('0x1f')][_0x246a('0x21')]||null:null,'attributes':_0x4fc4e8[_0x246a('0x1f')]?_0x4fc4e8[_0x246a('0x1f')][_0x246a('0x22')]||null:null,'limit':_0x4fc4e8[_0x246a('0x1f')]?_0x4fc4e8[_0x246a('0x1f')][_0x246a('0x23')]||null:null})[_0x246a('0x24')](function(_0x1337da){logger[_0x246a('0x13')](_0x246a('0x1c'),_0x4fc4e8);logger[_0x246a('0x15')](_0x246a('0x1c'),_0x4fc4e8,JSON[_0x246a('0x25')](_0x1337da));_0x85cf80(_0x1337da);})[_0x246a('0x1b')](function(_0x77a1dc){logger[_0x246a('0x16')]('UpdateOpenchannelInteraction',_0x77a1dc['message'],_0x4fc4e8);_0x10b93c(_0x4735cc[_0x246a('0x16')](0x1f4,_0x77a1dc['message']));});});};exports[_0x246a('0x26')]=function(_0x1c31c7){return new Promise(function(_0x5d8b63,_0x1ac825){return db[_0x246a('0x1d')][_0x246a('0x27')]({'where':_0x1c31c7[_0x246a('0x1f')]?_0x1c31c7['options'][_0x246a('0x21')]||null:null})['then'](function(_0x563d38){if(_0x563d38){return _0x563d38[_0x246a('0x28')](_0x1c31c7['body']['ids'],_[_0x246a('0x29')](_0x1c31c7[_0x246a('0x2a')],[_0x246a('0x2b'),'id'])||{});}})[_0x246a('0x2c')](function(_0x300bf3){logger[_0x246a('0x13')](_0x246a('0x2d'),_0x1c31c7);logger[_0x246a('0x15')](_0x246a('0x2d'),_0x1c31c7,JSON[_0x246a('0x25')](_0x300bf3));_0x5d8b63(_0x300bf3);})['catch'](function(_0x1e6e54){logger['error'](_0x246a('0x2d'),_0x1e6e54[_0x246a('0x18')],_0x1c31c7);_0x1ac825(_this['error'](0x1f4,_0x1e6e54[_0x246a('0x18')]));});});}; \ No newline at end of file +var _0x2485=['info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','AddTagsToOpenchannelInteraction','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5c620a,_0x200a52){var _0x5e6424=function(_0x34ae11){while(--_0x34ae11){_0x5c620a['push'](_0x5c620a['shift']());}};_0x5e6424(++_0x200a52);}(_0x2485,0x1d6));var _0x5248=function(_0x33220b,_0x557d47){_0x33220b=_0x33220b-0x0;var _0xbc4404=_0x2485[_0x33220b];return _0xbc4404;};'use strict';var _=require(_0x5248('0x0'));var util=require('util');var moment=require(_0x5248('0x1'));var BPromise=require(_0x5248('0x2'));var rs=require(_0x5248('0x3'));var fs=require('fs');var Redis=require(_0x5248('0x4'));var db=require(_0x5248('0x5'))['db'];var utils=require(_0x5248('0x6'));var logger=require(_0x5248('0x7'))('rpc');var config=require(_0x5248('0x8'));var jayson=require(_0x5248('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5248('0xa')]=_['defaults'](config[_0x5248('0xa')],{'host':_0x5248('0xb'),'port':0x18eb});var socket=require(_0x5248('0xc'))(new Redis(config[_0x5248('0xa')]));require(_0x5248('0xd'))[_0x5248('0xe')](socket);function respondWithRpcPromise(_0x50ba69,_0x390981,_0x3b25a8){return new BPromise(function(_0x5e9956,_0x4169b5){return client['request'](_0x50ba69,_0x3b25a8)[_0x5248('0xf')](function(_0x154e22){logger['info'](_0x5248('0x10'),_0x390981,_0x5248('0x11'));logger[_0x5248('0x12')](_0x5248('0x13'),_0x390981,_0x5248('0x11'),JSON[_0x5248('0x14')](_0x154e22));if(_0x154e22[_0x5248('0x15')]){if(_0x154e22['error'][_0x5248('0x16')]===0x1f4){logger[_0x5248('0x15')](_0x5248('0x10'),_0x390981,_0x154e22['error'][_0x5248('0x17')]);return _0x4169b5(_0x154e22['error'][_0x5248('0x17')]);}logger['error'](_0x5248('0x10'),_0x390981,_0x154e22[_0x5248('0x15')][_0x5248('0x17')]);return _0x5e9956(_0x154e22['error'][_0x5248('0x17')]);}else{logger[_0x5248('0x18')](_0x5248('0x10'),_0x390981,_0x5248('0x11'));_0x5e9956(_0x154e22[_0x5248('0x19')]['message']);}})[_0x5248('0x1a')](function(_0x314208){logger[_0x5248('0x15')](_0x5248('0x10'),_0x390981,_0x314208);_0x4169b5(_0x314208);});});}exports[_0x5248('0x1b')]=function(_0x4b7f36){var _0x3d3d5f=this;return new Promise(function(_0xf7ad93,_0x566a07){return db[_0x5248('0x1c')][_0x5248('0x1d')](_0x4b7f36[_0x5248('0x1e')],{'raw':_0x4b7f36[_0x5248('0x1f')]?_0x4b7f36[_0x5248('0x1f')][_0x5248('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b7f36['options']?_0x4b7f36[_0x5248('0x1f')][_0x5248('0x21')]||null:null,'attributes':_0x4b7f36[_0x5248('0x1f')]?_0x4b7f36['options']['attributes']||null:null,'limit':_0x4b7f36['options']?_0x4b7f36[_0x5248('0x1f')]['limit']||null:null})[_0x5248('0xf')](function(_0x3f1aa1){logger[_0x5248('0x18')](_0x5248('0x1b'),_0x4b7f36);logger[_0x5248('0x12')](_0x5248('0x1b'),_0x4b7f36,JSON[_0x5248('0x14')](_0x3f1aa1));_0xf7ad93(_0x3f1aa1);})[_0x5248('0x1a')](function(_0x49d363){logger[_0x5248('0x15')](_0x5248('0x1b'),_0x49d363[_0x5248('0x17')],_0x4b7f36);_0x566a07(_0x3d3d5f[_0x5248('0x15')](0x1f4,_0x49d363[_0x5248('0x17')]));});});};exports[_0x5248('0x22')]=function(_0x37be79){return new Promise(function(_0x240ed8,_0x3b3970){return db[_0x5248('0x1c')]['find']({'where':_0x37be79['options']?_0x37be79['options'][_0x5248('0x21')]||null:null})['then'](function(_0x378764){if(_0x378764){return _0x378764['addTags'](_0x37be79[_0x5248('0x1e')][_0x5248('0x23')],_['omit'](_0x37be79[_0x5248('0x1e')],[_0x5248('0x23'),'id'])||{});}})[_0x5248('0x24')](function(_0x208889){logger[_0x5248('0x18')]('AddTags',_0x37be79);logger[_0x5248('0x12')]('AddTags',_0x37be79,JSON[_0x5248('0x14')](_0x208889));_0x240ed8(_0x208889);})[_0x5248('0x1a')](function(_0x1c4c6b){logger[_0x5248('0x15')](_0x5248('0x25'),_0x1c4c6b[_0x5248('0x17')],_0x37be79);_0x3b3970(_this['error'](0x1f4,_0x1c4c6b[_0x5248('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8bfec98..ab8eb0f 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 _0x18eb=['emit','register','./openchannelInteraction.events','remove','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x18eb,0xa7));var _0xb18e=function(_0x3ea55c,_0x41ac72){_0x3ea55c=_0x3ea55c-0x0;var _0x2b632b=_0x18eb[_0x3ea55c];return _0x2b632b;};'use strict';var OpenchannelInteractionEvents=require(_0xb18e('0x0'));var events=['save',_0xb18e('0x1'),_0xb18e('0x2')];function createListener(_0x16d16f,_0x154405){return function(_0x203d48){_0x154405[_0xb18e('0x3')](_0x16d16f,_0x203d48);};}function removeListener(_0xe751a4,_0x4f1c09){return function(){OpenchannelInteractionEvents['removeListener'](_0xe751a4,_0x4f1c09);};}exports[_0xb18e('0x4')]=function(_0x5368ec){for(var _0x1de61b=0x0,_0x3e9c37=events['length'];_0x1de61b<_0x3e9c37;_0x1de61b++){var _0x76e04a=events[_0x1de61b];var _0x36e0be=createListener('openchannelInteraction:'+_0x76e04a,_0x5368ec);OpenchannelInteractionEvents['on'](_0x76e04a,_0x36e0be);}}; \ No newline at end of file +var _0x2464=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x295849,_0x42b3eb){var _0x27d8d4=function(_0x375ae0){while(--_0x375ae0){_0x295849['push'](_0x295849['shift']());}};_0x27d8d4(++_0x42b3eb);}(_0x2464,0xf0));var _0x4246=function(_0x248f1a,_0x53df6d){_0x248f1a=_0x248f1a-0x0;var _0x5bbe2e=_0x2464[_0x248f1a];return _0x5bbe2e;};'use strict';var OpenchannelInteractionEvents=require(_0x4246('0x0'));var events=[_0x4246('0x1'),_0x4246('0x2'),_0x4246('0x3')];function createListener(_0x117692,_0x5493b3){return function(_0x1c380a){_0x5493b3[_0x4246('0x4')](_0x117692,_0x1c380a);};}function removeListener(_0x49698d,_0x66ae8){return function(){OpenchannelInteractionEvents[_0x4246('0x5')](_0x49698d,_0x66ae8);};}exports[_0x4246('0x6')]=function(_0x56b049){for(var _0x422262=0x0,_0x492703=events[_0x4246('0x7')];_0x422262<_0x492703;_0x422262++){var _0x1466a4=events[_0x422262];var _0xea8ae7=createListener('openchannelInteraction:'+_0x1466a4,_0x56b049);OpenchannelInteractionEvents['on'](_0x1466a4,_0xea8ae7);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bbbd189..5850172 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x115fc9,_0x22021c){var _0x2d4bc2=function(_0x43ce79){while(--_0x43ce79){_0x115fc9['push'](_0x115fc9['shift']());}};_0x2d4bc2(++_0x22021c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcb91[_0x34d275];return _0x1379cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x4b0f46,_0x49ab2d){_0x4b0f46=_0x4b0f46-0x0;var _0x1b6d18=_0x70e0[_0x4b0f46];return _0x1b6d18;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 236e01c..7f92e4c 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 _0xb91a=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x50499c,_0x188984){var _0xd422b3=function(_0x35e6cf){while(--_0x35e6cf){_0x50499c['push'](_0x50499c['shift']());}};_0xd422b3(++_0x188984);}(_0xb91a,0xe5));var _0xab91=function(_0x3ac5ab,_0x53a508){_0x3ac5ab=_0x3ac5ab-0x0;var _0x3a9f55=_0xb91a[_0x3ac5ab];return _0x3a9f55;};'use strict';var Sequelize=require('sequelize');module[_0xab91('0x0')]={'body':{'type':Sequelize[_0xab91('0x1')](_0xab91('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xab91('0x4')]('in',_0xab91('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xab91('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0cfa=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x32cd19,_0x31987c){var _0x252f44=function(_0x928b1e){while(--_0x928b1e){_0x32cd19['push'](_0x32cd19['shift']());}};_0x252f44(++_0x31987c);}(_0x0cfa,0x73));var _0xa0cf=function(_0x3a8439,_0x571dcb){_0x3a8439=_0x3a8439-0x0;var _0xaab816=_0x0cfa[_0x3a8439];return _0xaab816;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'body':{'type':Sequelize[_0xa0cf('0x2')](_0xa0cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa0cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa0cf('0x6')]},'providerName':{'type':Sequelize[_0xa0cf('0x7')]},'providerResponse':{'type':Sequelize[_0xa0cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 542c9d6..d0d7dd0 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 _0x5309=['UserId','user','agent','find','get','OpenchannelInteraction','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','sequelize','Sequelize','SELECT','contact','User','fullname','interface','channel','acceptmessage','OpenchannelInteractionId','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','email','internal','SIP/%s','motionChannel','EventManager','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','create','update','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58a342,_0x36d779){var _0x5d1e94=function(_0x113735){while(--_0x113735){_0x58a342['push'](_0x58a342['shift']());}};_0x5d1e94(++_0x36d779);}(_0x5309,0x125));var _0x9530=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x5309[_0x1c7137];return _0xeb4432;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9530('0x0'));var zipdir=require(_0x9530('0x1'));var jsonpatch=require(_0x9530('0x2'));var rp=require(_0x9530('0x3'));var moment=require(_0x9530('0x4'));var BPromise=require(_0x9530('0x5'));var Mustache=require(_0x9530('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9530('0x7'));var csv=require(_0x9530('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9530('0x9'));var _=require(_0x9530('0xa'));var squel=require(_0x9530('0xb'));var crypto=require(_0x9530('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9530('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9530('0xe'));var Papa=require(_0x9530('0xf'));var Redis=require(_0x9530('0x10'));var authService=require(_0x9530('0x11'));var qs=require(_0x9530('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9530('0x13'));var logger=require(_0x9530('0x14'))(_0x9530('0x15'));var utils=require('../../config/utils');var config=require(_0x9530('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9530('0x17'))['db'];config[_0x9530('0x18')]=_[_0x9530('0x19')](config['redis'],{'host':_0x9530('0x1a'),'port':0x18eb});var socket=require(_0x9530('0x1b'))(new Redis(config[_0x9530('0x18')]));require(_0x9530('0x1c'))[_0x9530('0x1d')](socket);var jayson=require(_0x9530('0x1e'));var client=jayson[_0x9530('0x1f')][_0x9530('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x9530('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2df9a1,_0x3d3906,_0x4fa991,_0x3933b2){return new BPromise(function(_0x29ec4d,_0x23af5e){var _0x58abb8=_0x3933b2||client;return _0x58abb8[_0x9530('0x21')](_0x2df9a1,_0x4fa991)[_0x9530('0x22')](function(_0xee0efb){logger[_0x9530('0x23')](_0x9530('0x24'),_0x3d3906,_0x9530('0x25'));logger[_0x9530('0x26')](_0x9530('0x27'),_0x3d3906,_0x9530('0x25'),JSON[_0x9530('0x28')](_0xee0efb));if(_0xee0efb['error']){if(_0xee0efb['error']['code']===0x1f4){logger[_0x9530('0x29')](_0x9530('0x24'),_0x3d3906,_0xee0efb[_0x9530('0x29')]['message']);return _0x23af5e(_0xee0efb[_0x9530('0x29')][_0x9530('0x2a')]);}logger[_0x9530('0x29')](_0x9530('0x24'),_0x3d3906,_0xee0efb[_0x9530('0x29')]['message']);return _0x29ec4d(_0xee0efb[_0x9530('0x29')][_0x9530('0x2a')]);}else{logger['info'](_0x9530('0x24'),_0x3d3906,'request\x20sent');_0x29ec4d(_0xee0efb[_0x9530('0x2b')][_0x9530('0x2a')]);}})['catch'](function(_0x2121c0){logger['error'](_0x9530('0x24'),_0x3d3906,_0x2121c0);_0x23af5e(_0x2121c0);});});}function respondWithStatusCode(_0x582930,_0x4ff6f5){_0x4ff6f5=_0x4ff6f5||0xcc;return function(_0x592d7b){if(_0x592d7b){return _0x582930[_0x9530('0x2c')](_0x4ff6f5);}return _0x582930[_0x9530('0x2d')](_0x4ff6f5)['end']();};}function respondWithResult(_0xd1caeb,_0x3679e){_0x3679e=_0x3679e||0xc8;return function(_0x1e6b68){if(_0x1e6b68){return _0xd1caeb[_0x9530('0x2d')](_0x3679e)['json'](_0x1e6b68);}};}function respondWithFilteredResult(_0x29489f,_0x13c4b8){return function(_0x3e5e1f){if(_0x3e5e1f){var _0x371d89=typeof _0x13c4b8[_0x9530('0x2e')]===_0x9530('0x2f')&&typeof _0x13c4b8['limit']===_0x9530('0x2f');var _0x21e961=_0x3e5e1f[_0x9530('0x30')];var _0x480e7f=_0x371d89?0x0:_0x13c4b8[_0x9530('0x2e')];var _0x5af477=_0x371d89?_0x3e5e1f[_0x9530('0x30')]:_0x13c4b8[_0x9530('0x2e')]+_0x13c4b8[_0x9530('0x31')];var _0x1868de;if(_0x5af477>=_0x21e961){_0x5af477=_0x21e961;_0x1868de=0xc8;}else{_0x1868de=0xce;}_0x29489f[_0x9530('0x2d')](_0x1868de);return _0x29489f[_0x9530('0x32')]('Content-Range',_0x480e7f+'-'+_0x5af477+'/'+_0x21e961)[_0x9530('0x33')](_0x3e5e1f);}return null;};}function patchUpdates(_0x24fa25){return function(_0x3458aa){try{jsonpatch[_0x9530('0x34')](_0x3458aa,_0x24fa25,!![]);}catch(_0x57e1ae){return BPromise[_0x9530('0x35')](_0x57e1ae);}return _0x3458aa[_0x9530('0x36')]();};}function saveUpdates(_0x487dff,_0x329de1){return function(_0x28db4a){if(_0x28db4a){return _0x28db4a['update'](_0x487dff)[_0x9530('0x22')](function(_0x2b0f49){return _0x2b0f49;});}return null;};}function removeEntity(_0xf7bea3,_0x51826d){return function(_0x582c2d){if(_0x582c2d){return _0x582c2d[_0x9530('0x37')]()[_0x9530('0x22')](function(){_0xf7bea3['status'](0xcc)[_0x9530('0x38')]();});}};}function handleEntityNotFound(_0x1337fc,_0x7e91f8){return function(_0x331301){if(!_0x331301){_0x1337fc[_0x9530('0x2c')](0x194);}return _0x331301;};}function handleError(_0x35725a,_0x1ca932){_0x1ca932=_0x1ca932||0x1f4;return function(_0x2675f6){logger['error'](_0x2675f6[_0x9530('0x39')]);if(_0x2675f6[_0x9530('0x3a')]){delete _0x2675f6[_0x9530('0x3a')];}_0x35725a[_0x9530('0x2d')](_0x1ca932)[_0x9530('0x3b')](_0x2675f6);};}exports[_0x9530('0x3c')]=function(_0x351fad,_0x3f01a7){var _0x3a6b42={},_0x20b865={},_0x53e945={'count':0x0,'rows':[]};var _0x43dd47=_[_0x9530('0x3d')](db[_0x9530('0x3e')][_0x9530('0x3f')],function(_0x44c99c){return{'name':_0x44c99c['fieldName'],'type':_0x44c99c[_0x9530('0x40')][_0x9530('0x41')]};});_0x20b865[_0x9530('0x42')]=_[_0x9530('0x3d')](_0x43dd47,_0x9530('0x3a'));_0x20b865[_0x9530('0x43')]=_[_0x9530('0x44')](_0x351fad['query']);_0x20b865[_0x9530('0x45')]=_[_0x9530('0x46')](_0x20b865['model'],_0x20b865[_0x9530('0x43')]);_0x3a6b42[_0x9530('0x47')]=_['intersection'](_0x20b865['model'],qs[_0x9530('0x48')](_0x351fad[_0x9530('0x43')][_0x9530('0x48')]));_0x3a6b42['attributes']=_0x3a6b42['attributes'][_0x9530('0x49')]?_0x3a6b42[_0x9530('0x47')]:_0x20b865[_0x9530('0x42')];if(!_0x351fad[_0x9530('0x43')]['hasOwnProperty']('nolimit')){_0x3a6b42[_0x9530('0x31')]=qs['limit'](_0x351fad['query'][_0x9530('0x31')]);_0x3a6b42[_0x9530('0x2e')]=qs[_0x9530('0x2e')](_0x351fad[_0x9530('0x43')]['offset']);}_0x3a6b42[_0x9530('0x4a')]=qs['sort'](_0x351fad[_0x9530('0x43')][_0x9530('0x4b')]);_0x3a6b42[_0x9530('0x4c')]=qs[_0x9530('0x45')](_[_0x9530('0x4d')](_0x351fad[_0x9530('0x43')],_0x20b865['filters']),_0x43dd47);if(_0x351fad[_0x9530('0x43')]['filter']){_0x3a6b42['where']=_[_0x9530('0x4e')](_0x3a6b42[_0x9530('0x4c')],{'$or':_[_0x9530('0x3d')](_0x43dd47,function(_0x1966ea){if(_0x1966ea[_0x9530('0x40')]!=='VIRTUAL'){var _0x1b6cda={};_0x1b6cda[_0x1966ea['name']]={'$like':'%'+_0x351fad[_0x9530('0x43')][_0x9530('0x4f')]+'%'};return _0x1b6cda;}})});}_0x3a6b42=_['merge']({},_0x3a6b42,_0x351fad[_0x9530('0x50')]);var _0x4f816b={'where':_0x3a6b42[_0x9530('0x4c')]};return db[_0x9530('0x3e')][_0x9530('0x30')](_0x4f816b)[_0x9530('0x22')](function(_0x42cf41){_0x53e945['count']=_0x42cf41;if(_0x351fad[_0x9530('0x43')][_0x9530('0x51')]){_0x3a6b42['include']=[{'all':!![]}];}return db[_0x9530('0x3e')][_0x9530('0x52')](_0x3a6b42);})[_0x9530('0x22')](function(_0xa4d609){_0x53e945[_0x9530('0x53')]=_0xa4d609;return _0x53e945;})[_0x9530('0x22')](respondWithFilteredResult(_0x3f01a7,_0x3a6b42))[_0x9530('0x54')](handleError(_0x3f01a7,null));};exports[_0x9530('0x55')]=function(_0x55a133,_0x2e05e1){var _0x361425={'raw':!![],'where':{'id':_0x55a133[_0x9530('0x56')]['id']}},_0x1379cf={};_0x1379cf[_0x9530('0x42')]=_['keys'](db[_0x9530('0x3e')][_0x9530('0x3f')]);_0x1379cf[_0x9530('0x43')]=_[_0x9530('0x44')](_0x55a133['query']);_0x1379cf[_0x9530('0x45')]=_[_0x9530('0x46')](_0x1379cf[_0x9530('0x42')],_0x1379cf['query']);_0x361425[_0x9530('0x47')]=_['intersection'](_0x1379cf[_0x9530('0x42')],qs[_0x9530('0x48')](_0x55a133[_0x9530('0x43')]['fields']));_0x361425[_0x9530('0x47')]=_0x361425[_0x9530('0x47')]['length']?_0x361425[_0x9530('0x47')]:_0x1379cf['model'];if(_0x55a133['query']['includeAll']){_0x361425['include']=[{'all':!![]}];}_0x361425=_[_0x9530('0x4e')]({},_0x361425,_0x55a133['options']);return db[_0x9530('0x3e')]['find'](_0x361425)[_0x9530('0x22')](handleEntityNotFound(_0x2e05e1,null))[_0x9530('0x22')](respondWithResult(_0x2e05e1,null))[_0x9530('0x54')](handleError(_0x2e05e1,null));};exports[_0x9530('0x57')]=function(_0xff871a,_0x2a7c17){return db[_0x9530('0x3e')]['create'](_0xff871a['body'],{})['then'](respondWithResult(_0x2a7c17,0xc9))[_0x9530('0x54')](handleError(_0x2a7c17,null));};exports[_0x9530('0x58')]=function(_0x3b7369,_0x414437){if(_0x3b7369[_0x9530('0x59')]['id']){delete _0x3b7369[_0x9530('0x59')]['id'];}return db[_0x9530('0x3e')]['find']({'where':{'id':_0x3b7369[_0x9530('0x56')]['id']}})[_0x9530('0x22')](handleEntityNotFound(_0x414437,null))[_0x9530('0x22')](saveUpdates(_0x3b7369['body'],null))[_0x9530('0x22')](respondWithResult(_0x414437,null))[_0x9530('0x54')](handleError(_0x414437,null));};exports[_0x9530('0x37')]=function(_0x3be263,_0x41d0c6){return db[_0x9530('0x3e')]['find']({'where':{'id':_0x3be263[_0x9530('0x56')]['id']}})[_0x9530('0x22')](handleEntityNotFound(_0x41d0c6,null))[_0x9530('0x22')](removeEntity(_0x41d0c6,null))['catch'](handleError(_0x41d0c6,null));};exports['describe']=function(_0xbfe260,_0xc30f9a){return db[_0x9530('0x3e')][_0x9530('0x5a')]()[_0x9530('0x22')](respondWithResult(_0xc30f9a,null))[_0x9530('0x54')](handleError(_0xc30f9a,null));};var interaction_log=require('../../config/logger')(_0x9530('0x5b'));exports[_0x9530('0x5c')]=function(_0x439b2a,_0x57b8ca,_0x6aee55){var _0x5f4e44={'agent':{},'channel':_0x9530('0x5d')};if(_0x439b2a['body']['id']){delete _0x439b2a[_0x9530('0x59')]['id'];}_0x439b2a[_0x9530('0x59')][_0x9530('0x5e')]=!![];_0x439b2a[_0x9530('0x59')][_0x9530('0x5f')]=moment()['format'](_0x9530('0x60'));_0x439b2a[_0x9530('0x59')][_0x9530('0x61')]=_0x439b2a[_0x9530('0x59')][_0x9530('0x61')]||_0x439b2a[_0x9530('0x62')]['id'];_0x5f4e44[_0x9530('0x63')]['id']=_0x439b2a[_0x9530('0x59')][_0x9530('0x61')];return db[_0x9530('0x3e')][_0x9530('0x64')]({'where':{'id':_0x439b2a['params']['id'],'UserId':null}})[_0x9530('0x22')](handleEntityNotFound(_0x57b8ca,null))[_0x9530('0x22')](saveUpdates(_0x439b2a['body'],null))[_0x9530('0x22')](function(_0x2cdaf2){if(_0x2cdaf2){_0x5f4e44[_0x9530('0x2a')]=_0x2cdaf2[_0x9530('0x65')]({'plain':!![]});return db[_0x9530('0x66')][_0x9530('0x64')]({'where':{'id':_0x2cdaf2['OpenchannelInteractionId']}});}return null;})[_0x9530('0x22')](handleEntityNotFound(_0x57b8ca,null))[_0x9530('0x22')](function(_0x29c548){if(_0x29c548){return _0x29c548[_0x9530('0x58')]({'UserId':_0x439b2a[_0x9530('0x59')][_0x9530('0x61')],'read1stAt':_['isNil'](_0x29c548[_0x9530('0x67')])?moment()[_0x9530('0x68')](_0x9530('0x60')):undefined});}return null;})[_0x9530('0x22')](function(_0x64fe49){if(_0x64fe49){_0x5f4e44[_0x9530('0x69')]=_0x64fe49['get']({'plain':!![]});interaction_log[_0x9530('0x23')](_0x9530('0x6a'),_0x439b2a[_0x9530('0x62')]['id'],_0x439b2a[_0x9530('0x62')][_0x9530('0x3a')],_0x439b2a['user'][_0x9530('0x6b')],_0x5f4e44[_0x9530('0x69')]['id'],_0x439b2a[_0x9530('0x59')]?JSON[_0x9530('0x28')](_0x439b2a[_0x9530('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0x9530('0x6c'),_0x5f4e44);}return null;})[_0x9530('0x22')](function(_0x28e30e){var _0x6cbacb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28e30e[_0x9530('0x2a')]['ContactId'];return db[_0x9530('0x6d')][_0x9530('0x43')](_0x6cbacb,{'type':db[_0x9530('0x6e')]['QueryTypes'][_0x9530('0x6f')],'raw':!![]})['then'](function(_0x155cf5){return _0x155cf5;});})[_0x9530('0x22')](function(_0x3d8596){if(_0x3d8596){_0x5f4e44[_0x9530('0x2a')][_0x9530('0x70')]=_0x3d8596[0x0];if(!_0x439b2a[_0x9530('0x59')]['UserId'])return;return db[_0x9530('0x71')][_0x9530('0x64')]({'where':{'id':_0x439b2a['body'][_0x9530('0x61')],'role':_0x9530('0x63')},'attributes':['id',_0x9530('0x3a'),_0x9530('0x72'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x343723){if(!_0x343723)return null;_0x5f4e44[_0x9530('0x2a')][_0x9530('0x63')]=_0x343723;return _0x5f4e44;})[_0x9530('0x22')](function(_0x229922){if(_0x229922){if(_0x439b2a['body']['manual']){_0x5f4e44[_0x9530('0x2a')][_0x9530('0x73')]=util[_0x9530('0x68')]('SIP/%s',_0x439b2a[_0x9530('0x62')][_0x9530('0x3a')]);_0x5f4e44['message'][_0x9530('0x74')]=_0x5f4e44[_0x9530('0x74')];_0x5f4e44[_0x9530('0x2a')]['motionChannel']=_0x5f4e44[_0x9530('0x74')];_0x5f4e44[_0x9530('0x2a')]['event']=_0x9530('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9530('0x75'),'message':_0x5f4e44[_0x9530('0x2a')]},client9002)[_0x9530('0x22')](function(){return _0x5f4e44;});}return _0x5f4e44;}return null;})['then'](respondWithResult(_0x57b8ca,null))[_0x9530('0x54')](handleError(_0x57b8ca,null));};var interaction_log=require(_0x9530('0x14'))('openchannel-interactions');exports[_0x9530('0x35')]=function(_0xe4e54a,_0x18aeeb,_0x1a505b){var _0x49f332={'agent':{},'channel':_0x9530('0x5d')};if(_0xe4e54a[_0x9530('0x59')]['id']){delete _0xe4e54a[_0x9530('0x59')]['id'];}_0xe4e54a[_0x9530('0x59')][_0x9530('0x61')]=_0xe4e54a['body'][_0x9530('0x61')]||_0xe4e54a[_0x9530('0x62')]['id'];_0x49f332[_0x9530('0x63')]['id']=_0xe4e54a['body']['UserId'];return db[_0x9530('0x3e')][_0x9530('0x64')]({'where':{'id':_0xe4e54a[_0x9530('0x56')]['id'],'UserId':null}})[_0x9530('0x22')](handleEntityNotFound(_0x18aeeb,null))[_0x9530('0x22')](function(_0x1369b){if(_0x1369b){_0x49f332[_0x9530('0x2a')]=_0x1369b[_0x9530('0x65')]({'plain':!![]});return db[_0x9530('0x66')][_0x9530('0x64')]({'where':{'id':_0x1369b[_0x9530('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x18aeeb,null))[_0x9530('0x22')](function(_0x59dac3){if(_0x59dac3){_0x49f332[_0x9530('0x69')]=_0x59dac3['get']({'plain':!![]});interaction_log[_0x9530('0x23')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4e54a[_0x9530('0x62')]['id'],_0xe4e54a[_0x9530('0x62')]['name'],_0xe4e54a['user'][_0x9530('0x6b')],_0x49f332['interaction']['id'],_0xe4e54a[_0x9530('0x59')]?JSON['stringify'](_0xe4e54a['body']):_0x9530('0x77'));return respondWithRpcPromise(_0x9530('0x78'),'rejectMessage',_0x49f332);}return null;})[_0x9530('0x22')](function(_0x15d20c){var _0x24c241=_0x9530('0x79')+_0x15d20c['message'][_0x9530('0x7a')];return db[_0x9530('0x6d')]['query'](_0x24c241,{'type':db[_0x9530('0x6e')][_0x9530('0x7b')][_0x9530('0x6f')],'raw':!![]})[_0x9530('0x22')](function(_0x7156a0){return _0x7156a0;});})[_0x9530('0x22')](function(_0x535af5){if(_0x535af5){_0x49f332[_0x9530('0x2a')]['contact']=_0x535af5[0x0];if(!_0xe4e54a[_0x9530('0x59')]['UserId'])return;return db['User']['find']({'where':{'id':_0xe4e54a[_0x9530('0x59')][_0x9530('0x61')],'role':_0x9530('0x63')},'attributes':['id',_0x9530('0x3a'),_0x9530('0x72'),_0x9530('0x7c'),_0x9530('0x7d')],'raw':!![]});}return null;})['then'](function(_0xbe6a0){if(!_0xbe6a0)return null;_0x49f332[_0x9530('0x2a')][_0x9530('0x63')]=_0xbe6a0;return _0x49f332;})[_0x9530('0x22')](function(_0x19ee17){if(_0x19ee17){_0x19ee17[_0x9530('0x2a')]['interface']=util[_0x9530('0x68')](_0x9530('0x7e'),_0xe4e54a['user'][_0x9530('0x3a')]);_0x19ee17['message'][_0x9530('0x74')]=_0x49f332[_0x9530('0x74')];_0x19ee17[_0x9530('0x2a')][_0x9530('0x7f')]=_0x49f332[_0x9530('0x74')];_0x19ee17[_0x9530('0x2a')]['event']=_0x9530('0x35');respondWithRpcPromise(_0x9530('0x80'),_0x9530('0x80'),{'event':_0x9530('0x81'),'message':_0x19ee17[_0x9530('0x2a')]},client9002);return _0x49f332;}return null;})[_0x9530('0x22')](respondWithResult(_0x18aeeb,null))[_0x9530('0x54')](handleError(_0x18aeeb,null));}; \ No newline at end of file +var _0xc398=['message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','intersection','model','attributes','fields','query','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','role','interaction','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','agent','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','event','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x236b40,_0xdf2212){var _0x546413=function(_0x3bb994){while(--_0x3bb994){_0x236b40['push'](_0x236b40['shift']());}};_0x546413(++_0xdf2212);}(_0xc398,0x1f0));var _0x8c39=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xc398[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require(_0x8c39('0x0'));var rimraf=require(_0x8c39('0x1'));var zipdir=require(_0x8c39('0x2'));var jsonpatch=require(_0x8c39('0x3'));var rp=require(_0x8c39('0x4'));var moment=require(_0x8c39('0x5'));var BPromise=require(_0x8c39('0x6'));var Mustache=require(_0x8c39('0x7'));var util=require(_0x8c39('0x8'));var path=require(_0x8c39('0x9'));var sox=require(_0x8c39('0xa'));var csv=require(_0x8c39('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c39('0xc'));var squel=require(_0x8c39('0xd'));var crypto=require(_0x8c39('0xe'));var jsforce=require(_0x8c39('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c39('0x10'));var Redis=require(_0x8c39('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c39('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c39('0x13'));var utils=require('../../config/utils');var config=require(_0x8c39('0x14'));var licenseUtil=require(_0x8c39('0x15'));var db=require(_0x8c39('0x16'))['db'];config['redis']=_[_0x8c39('0x17')](config[_0x8c39('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c39('0x19'))(new Redis(config[_0x8c39('0x18')]));require(_0x8c39('0x1a'))[_0x8c39('0x1b')](socket);var jayson=require(_0x8c39('0x1c'));var client=jayson[_0x8c39('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x8c39('0x1d')][_0x8c39('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x33b625,_0x5dc18f,_0xab5527,_0xbbdb24){return new BPromise(function(_0x3682aa,_0x1dbed6){var _0x105842=_0xbbdb24||client;return _0x105842[_0x8c39('0x1f')](_0x33b625,_0xab5527)[_0x8c39('0x20')](function(_0x53f04c){logger[_0x8c39('0x21')](_0x8c39('0x22'),_0x5dc18f,_0x8c39('0x23'));logger[_0x8c39('0x24')](_0x8c39('0x25'),_0x5dc18f,'request\x20sent',JSON['stringify'](_0x53f04c));if(_0x53f04c[_0x8c39('0x26')]){if(_0x53f04c[_0x8c39('0x26')][_0x8c39('0x27')]===0x1f4){logger[_0x8c39('0x26')](_0x8c39('0x22'),_0x5dc18f,_0x53f04c[_0x8c39('0x26')]['message']);return _0x1dbed6(_0x53f04c[_0x8c39('0x26')][_0x8c39('0x28')]);}logger[_0x8c39('0x26')](_0x8c39('0x22'),_0x5dc18f,_0x53f04c[_0x8c39('0x26')][_0x8c39('0x28')]);return _0x3682aa(_0x53f04c[_0x8c39('0x26')][_0x8c39('0x28')]);}else{logger[_0x8c39('0x21')](_0x8c39('0x22'),_0x5dc18f,_0x8c39('0x23'));_0x3682aa(_0x53f04c[_0x8c39('0x29')][_0x8c39('0x28')]);}})[_0x8c39('0x2a')](function(_0x4f8ae1){logger[_0x8c39('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x5dc18f,_0x4f8ae1);_0x1dbed6(_0x4f8ae1);});});}function respondWithStatusCode(_0x2aeb94,_0x4faa66){_0x4faa66=_0x4faa66||0xcc;return function(_0x5f2754){if(_0x5f2754){return _0x2aeb94[_0x8c39('0x2b')](_0x4faa66);}return _0x2aeb94['status'](_0x4faa66)[_0x8c39('0x2c')]();};}function respondWithResult(_0x306730,_0x289d4b){_0x289d4b=_0x289d4b||0xc8;return function(_0x5f1077){if(_0x5f1077){return _0x306730[_0x8c39('0x2d')](_0x289d4b)['json'](_0x5f1077);}};}function respondWithFilteredResult(_0x30a50c,_0x108a7e){return function(_0x4366b4){if(_0x4366b4){var _0x6fc929=typeof _0x108a7e[_0x8c39('0x2e')]==='undefined'&&typeof _0x108a7e[_0x8c39('0x2f')]===_0x8c39('0x30');var _0x23eaf9=_0x4366b4['count'];var _0x5f1b3a=_0x6fc929?0x0:_0x108a7e[_0x8c39('0x2e')];var _0x4fbee7=_0x6fc929?_0x4366b4[_0x8c39('0x31')]:_0x108a7e[_0x8c39('0x2e')]+_0x108a7e['limit'];var _0x1a852a;if(_0x4fbee7>=_0x23eaf9){_0x4fbee7=_0x23eaf9;_0x1a852a=0xc8;}else{_0x1a852a=0xce;}_0x30a50c[_0x8c39('0x2d')](_0x1a852a);return _0x30a50c[_0x8c39('0x32')](_0x8c39('0x33'),_0x5f1b3a+'-'+_0x4fbee7+'/'+_0x23eaf9)[_0x8c39('0x34')](_0x4366b4);}return null;};}function patchUpdates(_0x12d190){return function(_0x382a81){try{jsonpatch[_0x8c39('0x35')](_0x382a81,_0x12d190,!![]);}catch(_0x755da7){return BPromise[_0x8c39('0x36')](_0x755da7);}return _0x382a81[_0x8c39('0x37')]();};}function saveUpdates(_0x258733,_0x259e92){return function(_0x4ba4ff){if(_0x4ba4ff){return _0x4ba4ff['update'](_0x258733)[_0x8c39('0x20')](function(_0x430ed7){return _0x430ed7;});}return null;};}function removeEntity(_0x7b7c51,_0x4ee049){return function(_0x10d789){if(_0x10d789){return _0x10d789[_0x8c39('0x38')]()[_0x8c39('0x20')](function(){_0x7b7c51[_0x8c39('0x2d')](0xcc)[_0x8c39('0x2c')]();});}};}function handleEntityNotFound(_0x4f5ee2,_0x3d5068){return function(_0x34ce25){if(!_0x34ce25){_0x4f5ee2[_0x8c39('0x2b')](0x194);}return _0x34ce25;};}function handleError(_0x3665f3,_0x1e587c){_0x1e587c=_0x1e587c||0x1f4;return function(_0xf00cd0){logger[_0x8c39('0x26')](_0xf00cd0[_0x8c39('0x39')]);if(_0xf00cd0[_0x8c39('0x3a')]){delete _0xf00cd0[_0x8c39('0x3a')];}_0x3665f3[_0x8c39('0x2d')](_0x1e587c)[_0x8c39('0x3b')](_0xf00cd0);};}exports[_0x8c39('0x3c')]=function(_0x363824,_0x398005){var _0x2795d8={},_0x23ff1b={},_0x21bded={'count':0x0,'rows':[]};var _0x9f7319=_[_0x8c39('0x3d')](db[_0x8c39('0x3e')][_0x8c39('0x3f')],function(_0x4c9a0e){return{'name':_0x4c9a0e[_0x8c39('0x40')],'type':_0x4c9a0e['type'][_0x8c39('0x41')]};});_0x23ff1b['model']=_[_0x8c39('0x3d')](_0x9f7319,'name');_0x23ff1b['query']=_[_0x8c39('0x42')](_0x363824['query']);_0x23ff1b['filters']=_[_0x8c39('0x43')](_0x23ff1b[_0x8c39('0x44')],_0x23ff1b['query']);_0x2795d8[_0x8c39('0x45')]=_[_0x8c39('0x43')](_0x23ff1b['model'],qs[_0x8c39('0x46')](_0x363824[_0x8c39('0x47')][_0x8c39('0x46')]));_0x2795d8[_0x8c39('0x45')]=_0x2795d8[_0x8c39('0x45')]['length']?_0x2795d8[_0x8c39('0x45')]:_0x23ff1b[_0x8c39('0x44')];if(!_0x363824[_0x8c39('0x47')]['hasOwnProperty'](_0x8c39('0x48'))){_0x2795d8[_0x8c39('0x2f')]=qs[_0x8c39('0x2f')](_0x363824[_0x8c39('0x47')][_0x8c39('0x2f')]);_0x2795d8[_0x8c39('0x2e')]=qs[_0x8c39('0x2e')](_0x363824[_0x8c39('0x47')][_0x8c39('0x2e')]);}_0x2795d8[_0x8c39('0x49')]=qs[_0x8c39('0x4a')](_0x363824['query'][_0x8c39('0x4a')]);_0x2795d8[_0x8c39('0x4b')]=qs['filters'](_[_0x8c39('0x4c')](_0x363824[_0x8c39('0x47')],_0x23ff1b[_0x8c39('0x4d')]),_0x9f7319);if(_0x363824['query'][_0x8c39('0x4e')]){_0x2795d8[_0x8c39('0x4b')]=_[_0x8c39('0x4f')](_0x2795d8[_0x8c39('0x4b')],{'$or':_[_0x8c39('0x3d')](_0x9f7319,function(_0x4ff8b7){if(_0x4ff8b7[_0x8c39('0x50')]!==_0x8c39('0x51')){var _0x460ece={};_0x460ece[_0x4ff8b7[_0x8c39('0x3a')]]={'$like':'%'+_0x363824[_0x8c39('0x47')]['filter']+'%'};return _0x460ece;}})});}_0x2795d8=_['merge']({},_0x2795d8,_0x363824[_0x8c39('0x52')]);var _0x1db45c={'where':_0x2795d8[_0x8c39('0x4b')]};return db['OpenchannelMessage'][_0x8c39('0x31')](_0x1db45c)['then'](function(_0x50936c){_0x21bded['count']=_0x50936c;if(_0x363824['query'][_0x8c39('0x53')]){_0x2795d8[_0x8c39('0x54')]=[{'all':!![]}];}return db[_0x8c39('0x3e')][_0x8c39('0x55')](_0x2795d8);})[_0x8c39('0x20')](function(_0x3eb4d1){_0x21bded[_0x8c39('0x56')]=_0x3eb4d1;return _0x21bded;})[_0x8c39('0x20')](respondWithFilteredResult(_0x398005,_0x2795d8))[_0x8c39('0x2a')](handleError(_0x398005,null));};exports[_0x8c39('0x57')]=function(_0x393191,_0x172d0c){var _0x33eb29={'raw':!![],'where':{'id':_0x393191['params']['id']}},_0x2bbd12={};_0x2bbd12[_0x8c39('0x44')]=_[_0x8c39('0x42')](db[_0x8c39('0x3e')][_0x8c39('0x3f')]);_0x2bbd12[_0x8c39('0x47')]=_[_0x8c39('0x42')](_0x393191['query']);_0x2bbd12[_0x8c39('0x4d')]=_[_0x8c39('0x43')](_0x2bbd12['model'],_0x2bbd12['query']);_0x33eb29[_0x8c39('0x45')]=_[_0x8c39('0x43')](_0x2bbd12['model'],qs[_0x8c39('0x46')](_0x393191[_0x8c39('0x47')][_0x8c39('0x46')]));_0x33eb29[_0x8c39('0x45')]=_0x33eb29[_0x8c39('0x45')][_0x8c39('0x58')]?_0x33eb29[_0x8c39('0x45')]:_0x2bbd12[_0x8c39('0x44')];if(_0x393191[_0x8c39('0x47')]['includeAll']){_0x33eb29['include']=[{'all':!![]}];}_0x33eb29=_[_0x8c39('0x4f')]({},_0x33eb29,_0x393191[_0x8c39('0x52')]);return db[_0x8c39('0x3e')][_0x8c39('0x59')](_0x33eb29)[_0x8c39('0x20')](handleEntityNotFound(_0x172d0c,null))['then'](respondWithResult(_0x172d0c,null))[_0x8c39('0x2a')](handleError(_0x172d0c,null));};exports[_0x8c39('0x5a')]=function(_0x9aab6d,_0x16da6e){return db[_0x8c39('0x3e')][_0x8c39('0x5a')](_0x9aab6d[_0x8c39('0x5b')],{})[_0x8c39('0x20')](respondWithResult(_0x16da6e,0xc9))[_0x8c39('0x2a')](handleError(_0x16da6e,null));};exports[_0x8c39('0x5c')]=function(_0x4c245a,_0x632100){if(_0x4c245a[_0x8c39('0x5b')]['id']){delete _0x4c245a[_0x8c39('0x5b')]['id'];}return db[_0x8c39('0x3e')]['find']({'where':{'id':_0x4c245a['params']['id']}})[_0x8c39('0x20')](handleEntityNotFound(_0x632100,null))[_0x8c39('0x20')](saveUpdates(_0x4c245a[_0x8c39('0x5b')],null))[_0x8c39('0x20')](respondWithResult(_0x632100,null))[_0x8c39('0x2a')](handleError(_0x632100,null));};exports[_0x8c39('0x38')]=function(_0x3b44be,_0xe1c844){return db[_0x8c39('0x3e')][_0x8c39('0x59')]({'where':{'id':_0x3b44be['params']['id']}})['then'](handleEntityNotFound(_0xe1c844,null))[_0x8c39('0x20')](removeEntity(_0xe1c844,null))['catch'](handleError(_0xe1c844,null));};exports[_0x8c39('0x5d')]=function(_0x244f5b,_0x4717d5){return db[_0x8c39('0x3e')][_0x8c39('0x5d')]()[_0x8c39('0x20')](respondWithResult(_0x4717d5,null))['catch'](handleError(_0x4717d5,null));};var interaction_log=require(_0x8c39('0x5e'))(_0x8c39('0x5f'));exports[_0x8c39('0x60')]=function(_0x522bb1,_0x3cb6f5,_0x1e064b){var _0xd1c238={'agent':{},'channel':_0x8c39('0x61')};if(_0x522bb1[_0x8c39('0x5b')]['id']){delete _0x522bb1[_0x8c39('0x5b')]['id'];}_0x522bb1[_0x8c39('0x5b')][_0x8c39('0x62')]=!![];_0x522bb1[_0x8c39('0x5b')]['readAt']=moment()[_0x8c39('0x63')](_0x8c39('0x64'));_0x522bb1[_0x8c39('0x5b')]['UserId']=_0x522bb1[_0x8c39('0x5b')][_0x8c39('0x65')]||_0x522bb1[_0x8c39('0x66')]['id'];_0xd1c238['agent']['id']=_0x522bb1[_0x8c39('0x5b')][_0x8c39('0x65')];return db['OpenchannelMessage']['find']({'where':{'id':_0x522bb1[_0x8c39('0x67')]['id'],'UserId':null}})[_0x8c39('0x20')](handleEntityNotFound(_0x3cb6f5,null))[_0x8c39('0x20')](saveUpdates(_0x522bb1[_0x8c39('0x5b')],null))[_0x8c39('0x20')](function(_0x480644){if(_0x480644){_0xd1c238['message']=_0x480644[_0x8c39('0x68')]({'plain':!![]});return db[_0x8c39('0x69')][_0x8c39('0x59')]({'where':{'id':_0x480644[_0x8c39('0x6a')]}});}return null;})[_0x8c39('0x20')](handleEntityNotFound(_0x3cb6f5,null))[_0x8c39('0x20')](function(_0xac5744){if(_0xac5744){return _0xac5744[_0x8c39('0x5c')]({'UserId':_0x522bb1['body'][_0x8c39('0x65')],'read1stAt':_[_0x8c39('0x6b')](_0xac5744[_0x8c39('0x6c')])?moment()[_0x8c39('0x63')](_0x8c39('0x64')):undefined});}return null;})[_0x8c39('0x20')](function(_0x1b9bcf){if(_0x1b9bcf){_0xd1c238['interaction']=_0x1b9bcf[_0x8c39('0x68')]({'plain':!![]});interaction_log[_0x8c39('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x522bb1['user']['id'],_0x522bb1[_0x8c39('0x66')][_0x8c39('0x3a')],_0x522bb1[_0x8c39('0x66')][_0x8c39('0x6d')],_0xd1c238[_0x8c39('0x6e')]['id'],_0x522bb1[_0x8c39('0x5b')]?JSON[_0x8c39('0x6f')](_0x522bb1[_0x8c39('0x5b')]):_0x8c39('0x70'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xd1c238);}return null;})[_0x8c39('0x20')](function(_0x1c12c5){var _0x17dd81=_0x8c39('0x71')+_0x1c12c5['message']['ContactId'];return db[_0x8c39('0x72')][_0x8c39('0x47')](_0x17dd81,{'type':db[_0x8c39('0x73')]['QueryTypes'][_0x8c39('0x74')],'raw':!![]})[_0x8c39('0x20')](function(_0x560755){return _0x560755;});})[_0x8c39('0x20')](function(_0x3e1e25){if(_0x3e1e25){_0xd1c238[_0x8c39('0x28')]['contact']=_0x3e1e25[0x0];if(!_0x522bb1[_0x8c39('0x5b')][_0x8c39('0x65')])return;return db[_0x8c39('0x75')]['find']({'where':{'id':_0x522bb1['body']['UserId'],'role':'agent'},'attributes':['id',_0x8c39('0x3a'),_0x8c39('0x76'),_0x8c39('0x77'),_0x8c39('0x78')],'raw':!![]});}return null;})[_0x8c39('0x20')](function(_0xda252b){if(!_0xda252b)return null;_0xd1c238[_0x8c39('0x28')][_0x8c39('0x79')]=_0xda252b;return _0xd1c238;})[_0x8c39('0x20')](function(_0x498b44){if(_0x498b44){if(_0x522bb1[_0x8c39('0x5b')]['manual']){_0xd1c238['message'][_0x8c39('0x7a')]=util[_0x8c39('0x63')](_0x8c39('0x7b'),_0x522bb1[_0x8c39('0x66')][_0x8c39('0x3a')]);_0xd1c238[_0x8c39('0x28')][_0x8c39('0x7c')]=_0xd1c238[_0x8c39('0x7c')];_0xd1c238[_0x8c39('0x28')][_0x8c39('0x7d')]=_0xd1c238[_0x8c39('0x7c')];_0xd1c238[_0x8c39('0x28')]['event']=_0x8c39('0x60');return respondWithRpcPromise(_0x8c39('0x7e'),'EventManager',{'event':_0x8c39('0x7f'),'message':_0xd1c238[_0x8c39('0x28')]},client9002)[_0x8c39('0x20')](function(){return _0xd1c238;});}return _0xd1c238;}return null;})['then'](respondWithResult(_0x3cb6f5,null))[_0x8c39('0x2a')](handleError(_0x3cb6f5,null));};var interaction_log=require(_0x8c39('0x5e'))(_0x8c39('0x5f'));exports['reject']=function(_0x129a19,_0x1f6b9e,_0x456a94){var _0x4d5d0c={'agent':{},'channel':_0x8c39('0x61')};if(_0x129a19[_0x8c39('0x5b')]['id']){delete _0x129a19['body']['id'];}_0x129a19[_0x8c39('0x5b')][_0x8c39('0x65')]=_0x129a19['body']['UserId']||_0x129a19[_0x8c39('0x66')]['id'];_0x4d5d0c[_0x8c39('0x79')]['id']=_0x129a19[_0x8c39('0x5b')][_0x8c39('0x65')];return db[_0x8c39('0x3e')]['find']({'where':{'id':_0x129a19[_0x8c39('0x67')]['id'],'UserId':null}})[_0x8c39('0x20')](handleEntityNotFound(_0x1f6b9e,null))[_0x8c39('0x20')](function(_0x303e90){if(_0x303e90){_0x4d5d0c['message']=_0x303e90[_0x8c39('0x68')]({'plain':!![]});return db[_0x8c39('0x69')]['find']({'where':{'id':_0x303e90['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1f6b9e,null))[_0x8c39('0x20')](function(_0x97c403){if(_0x97c403){_0x4d5d0c[_0x8c39('0x6e')]=_0x97c403['get']({'plain':!![]});interaction_log[_0x8c39('0x21')](_0x8c39('0x80'),_0x129a19[_0x8c39('0x66')]['id'],_0x129a19['user'][_0x8c39('0x3a')],_0x129a19['user'][_0x8c39('0x6d')],_0x4d5d0c[_0x8c39('0x6e')]['id'],_0x129a19[_0x8c39('0x5b')]?JSON['stringify'](_0x129a19['body']):_0x8c39('0x70'));return respondWithRpcPromise(_0x8c39('0x81'),_0x8c39('0x82'),_0x4d5d0c);}return null;})[_0x8c39('0x20')](function(_0x43574a){var _0x94957d=_0x8c39('0x71')+_0x43574a[_0x8c39('0x28')][_0x8c39('0x83')];return db[_0x8c39('0x72')][_0x8c39('0x47')](_0x94957d,{'type':db[_0x8c39('0x73')]['QueryTypes'][_0x8c39('0x74')],'raw':!![]})[_0x8c39('0x20')](function(_0xf18229){return _0xf18229;});})['then'](function(_0x321f44){if(_0x321f44){_0x4d5d0c['message'][_0x8c39('0x84')]=_0x321f44[0x0];if(!_0x129a19[_0x8c39('0x5b')]['UserId'])return;return db[_0x8c39('0x75')][_0x8c39('0x59')]({'where':{'id':_0x129a19[_0x8c39('0x5b')][_0x8c39('0x65')],'role':'agent'},'attributes':['id',_0x8c39('0x3a'),'fullname',_0x8c39('0x77'),'internal'],'raw':!![]});}return null;})[_0x8c39('0x20')](function(_0x168a98){if(!_0x168a98)return null;_0x4d5d0c['message'][_0x8c39('0x79')]=_0x168a98;return _0x4d5d0c;})[_0x8c39('0x20')](function(_0x1fee85){if(_0x1fee85){_0x1fee85[_0x8c39('0x28')][_0x8c39('0x7a')]=util[_0x8c39('0x63')](_0x8c39('0x7b'),_0x129a19[_0x8c39('0x66')][_0x8c39('0x3a')]);_0x1fee85['message'][_0x8c39('0x7c')]=_0x4d5d0c['channel'];_0x1fee85[_0x8c39('0x28')][_0x8c39('0x7d')]=_0x4d5d0c[_0x8c39('0x7c')];_0x1fee85['message'][_0x8c39('0x85')]='reject';respondWithRpcPromise('EventManager',_0x8c39('0x7e'),{'event':'rejectmessage','message':_0x1fee85[_0x8c39('0x28')]},client9002);return _0x4d5d0c;}return null;})[_0x8c39('0x20')](respondWithResult(_0x1f6b9e,null))['catch'](handleError(_0x1f6b9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 480e9a3..62b1cb7 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 _0xbc60=['remove','emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xbc60,0x151));var _0x0bc6=function(_0x35f020,_0x277b67){_0x35f020=_0x35f020-0x0;var _0x5d576d=_0xbc60[_0x35f020];return _0x5d576d;};'use strict';var EventEmitter=require(_0x0bc6('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x0bc6('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0bc6('0x2')](0x0);var events={'afterCreate':_0x0bc6('0x3'),'afterUpdate':_0x0bc6('0x4'),'afterDestroy':_0x0bc6('0x5')};function emitEvent(_0x30178a){return function(_0x2a0e61,_0x26a691,_0x434a95){OpenchannelMessageEvents['emit'](_0x30178a+':'+_0x2a0e61['id'],_0x2a0e61);OpenchannelMessageEvents[_0x0bc6('0x6')](_0x30178a,_0x2a0e61);_0x434a95(null);};}for(var e in events){if(events[_0x0bc6('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0bc6('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xdb54=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x348f1f,_0x272f92){var _0x55a536=function(_0x551865){while(--_0x551865){_0x348f1f['push'](_0x348f1f['shift']());}};_0x55a536(++_0x272f92);}(_0xdb54,0x1a5));var _0x4db5=function(_0x5ada87,_0x596cfd){_0x5ada87=_0x5ada87-0x0;var _0x424d8e=_0xdb54[_0x5ada87];return _0x424d8e;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4db5('0x0'))['db'][_0x4db5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4db5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14f0ab){return function(_0x52bd4f,_0x5f4109,_0x4bc515){OpenchannelMessageEvents[_0x4db5('0x3')](_0x14f0ab+':'+_0x52bd4f['id'],_0x52bd4f);OpenchannelMessageEvents[_0x4db5('0x3')](_0x14f0ab,_0x52bd4f);_0x4bc515(null);};}for(var e in events){if(events[_0x4db5('0x4')](e)){var event=events[e];OpenchannelMessage[_0x4db5('0x5')](e,emitEvent(event));}}module[_0x4db5('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 108a601..b10e76f 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 _0xdd4f=['OpenchannelMessage','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','body','OpenchannelMessage,\x20%s,\x20%s','threadId','update','inspect','utf8mb4_unicode_ci','lodash','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x422c45,_0x2301f3){_0x422c45=_0x422c45-0x0;var _0x48feaf=_0xdd4f[_0x422c45];return _0x48feaf;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xfdd4('0x9'),'fields':['body'],'type':_0xfdd4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25470a,_0x1e823e,_0x4ee02f){var _0x3d06c9=_0x43cbcf['models'];var _0x27a9f3=_0x25470a[_0xfdd4('0xb')]({'plain':!![]});if(_0x27a9f3[_0xfdd4('0xc')][_0xfdd4('0xd')]()==='in'||_0x27a9f3[_0xfdd4('0xc')][_0xfdd4('0xd')]()===_0xfdd4('0xe')&&!_0x27a9f3[_0xfdd4('0xf')]&&!_[_0xfdd4('0x10')](_0x27a9f3[_0xfdd4('0x11')])){_0x3d06c9[_0xfdd4('0x12')]['findOne']({'where':{'id':_0x27a9f3[_0xfdd4('0x13')]}})[_0xfdd4('0x14')](function(_0x227099){if(_0x227099){_0x227099['update']({'lastMsgAt':_0x27a9f3[_0xfdd4('0x15')],'lastMsgDirection':_0x27a9f3['direction'][_0xfdd4('0xd')]()});}})[_0xfdd4('0x16')](function(_0x2f34ec){console[_0xfdd4('0x17')](_0x2f34ec);});}if(_0x27a9f3[_0xfdd4('0xc')]==='out'&&!_0x27a9f3['secret']){var _0x559c77;_0x3d06c9[_0xfdd4('0x18')][_0xfdd4('0x19')]()[_0xfdd4('0x14')](function(_0x2ccc88){return _0x3d06c9[_0xfdd4('0x1a')][_0xfdd4('0x1b')]({'where':{'id':_0x27a9f3[_0xfdd4('0x1c')]},'include':[{'model':_0x3d06c9[_0xfdd4('0x12')],'as':_0xfdd4('0x1d'),'where':{'id':_0x27a9f3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3d06c9[_0xfdd4('0x18')],'as':_0xfdd4('0x1e'),'attributes':_[_0xfdd4('0x1f')](_0x2ccc88)}]}]});})[_0xfdd4('0x14')](function(_0x1454f1){_0x559c77=_0x1454f1[_0xfdd4('0xb')]({'plain':!![]});if(_0x559c77&&_0x559c77[_0xfdd4('0x20')]){logger[_0xfdd4('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xfdd4('0x22'),util[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x27a9f3['id'],_0x559c77[_0xfdd4('0x20')]));if(_0x559c77[_0xfdd4('0x1d')]&&_0x559c77[_0xfdd4('0x1d')][_0xfdd4('0x25')]){_0x27a9f3[_0xfdd4('0x26')]=_['omit'](_0x559c77[_0xfdd4('0x1d')][0x0],_0xfdd4('0x1e'));_0x27a9f3[_0xfdd4('0x1e')]=_0x559c77['Interactions'][0x0][_0xfdd4('0x1e')];}var _0x1e823e={'method':_0xfdd4('0x27'),'uri':encodeURI(_0x559c77[_0xfdd4('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1e823e[_0xfdd4('0x28')]){case'GET':_0x1e823e['qs']=_0x27a9f3;break;case _0xfdd4('0x27'):_0x1e823e[_0xfdd4('0x29')]=_0x27a9f3;break;}return rp(_0x1e823e)[_0xfdd4('0x14')](function(_0x31e053){logger[_0xfdd4('0x21')](_0xfdd4('0x2a'),_0xfdd4('0x22'),util[_0xfdd4('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x27a9f3['id'],_0x559c77[_0xfdd4('0x20')]));if(_0x31e053[_0xfdd4('0x29')][_0xfdd4('0x2b')]&&_0x31e053[_0xfdd4('0x29')][_0xfdd4('0x2b')]!=_0x27a9f3['Interaction'][_0xfdd4('0x2b')]){return _0x3d06c9[_0xfdd4('0x12')][_0xfdd4('0x2c')]({'threadId':_0x31e053[_0xfdd4('0x29')][_0xfdd4('0x2b')]},{'logging':!![],'where':{'id':_0x27a9f3['Interaction']['id']}});}else{return;}})[_0xfdd4('0x14')](function(){return _0x25470a[_0xfdd4('0x2c')]({'read':!![]});})[_0xfdd4('0x16')](function(_0x5ba4e8){logger[_0xfdd4('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xfdd4('0x22'),util[_0xfdd4('0x2d')](_0x5ba4e8,{'showHidden':![],'depth':null}));_0x4ee02f();});}else{_0x4ee02f();}})['finally'](function(){_0x4ee02f();});}else{_0x4ee02f();}}},'charset':'utf8mb4','collate':_0xfdd4('0x2e')});}; \ No newline at end of file +var _0x6cb4=['define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes'];(function(_0x42234d,_0x1e7fda){var _0x54a22b=function(_0x1d18aa){while(--_0x1d18aa){_0x42234d['push'](_0x42234d['shift']());}};_0x54a22b(++_0x1e7fda);}(_0x6cb4,0xff));var _0x46cb=function(_0x41dbcc,_0x8e7ba7){_0x41dbcc=_0x41dbcc-0x0;var _0xf43185=_0x6cb4[_0x41dbcc];return _0xf43185;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[{'name':_0x46cb('0xd'),'fields':[_0x46cb('0xe')],'type':_0x46cb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56258a,_0x3d7663,_0x34f9e9){var _0x48101c=_0x3d9d3c[_0x46cb('0x10')];var _0x106a87=_0x56258a['get']({'plain':!![]});if(_0x106a87[_0x46cb('0x11')][_0x46cb('0x12')]()==='in'||_0x106a87['direction']['toLowerCase']()==='out'&&!_0x106a87[_0x46cb('0x13')]&&!_[_0x46cb('0x14')](_0x106a87[_0x46cb('0x15')])){_0x48101c[_0x46cb('0x16')]['findOne']({'where':{'id':_0x106a87[_0x46cb('0x17')]}})[_0x46cb('0x18')](function(_0x2a1f9d){if(_0x2a1f9d){_0x2a1f9d[_0x46cb('0x19')]({'lastMsgAt':_0x106a87[_0x46cb('0x1a')],'lastMsgDirection':_0x106a87[_0x46cb('0x11')][_0x46cb('0x12')]()});}})[_0x46cb('0x1b')](function(_0x37d368){console[_0x46cb('0x1c')](_0x37d368);});}if(_0x106a87[_0x46cb('0x11')]==='out'&&!_0x106a87[_0x46cb('0x13')]){var _0x5796d2;_0x48101c[_0x46cb('0x1d')]['describe']()['then'](function(_0x4e3454){return _0x48101c[_0x46cb('0x1e')][_0x46cb('0x1f')]({'where':{'id':_0x106a87[_0x46cb('0x20')]},'include':[{'model':_0x48101c[_0x46cb('0x16')],'as':_0x46cb('0x21'),'where':{'id':_0x106a87[_0x46cb('0x17')]},'limit':0x1,'include':[{'model':_0x48101c[_0x46cb('0x1d')],'as':_0x46cb('0x22'),'attributes':_[_0x46cb('0x23')](_0x4e3454)}]}]});})[_0x46cb('0x18')](function(_0x149483){_0x5796d2=_0x149483[_0x46cb('0x24')]({'plain':!![]});if(_0x5796d2&&_0x5796d2[_0x46cb('0x25')]){logger[_0x46cb('0x26')](_0x46cb('0x27'),_0x46cb('0x28'),util[_0x46cb('0x29')](_0x46cb('0x2a'),_0x106a87['id'],_0x5796d2[_0x46cb('0x25')]));if(_0x5796d2[_0x46cb('0x21')]&&_0x5796d2[_0x46cb('0x21')][_0x46cb('0x2b')]){_0x106a87[_0x46cb('0x2c')]=_[_0x46cb('0x2d')](_0x5796d2[_0x46cb('0x21')][0x0],'Contact');_0x106a87['Contact']=_0x5796d2[_0x46cb('0x21')][0x0][_0x46cb('0x22')];}var _0x3d7663={'method':_0x46cb('0x2e'),'uri':encodeURI(_0x5796d2[_0x46cb('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3d7663['method']){case _0x46cb('0x2f'):_0x3d7663['qs']=_0x106a87;break;case'POST':_0x3d7663['body']=_0x106a87;break;}return rp(_0x3d7663)['then'](function(_0x180ce1){logger[_0x46cb('0x26')](_0x46cb('0x27'),_0x46cb('0x28'),util[_0x46cb('0x29')](_0x46cb('0x30'),_0x106a87['id'],_0x5796d2[_0x46cb('0x25')]));if(_0x180ce1[_0x46cb('0xe')][_0x46cb('0x31')]&&_0x180ce1[_0x46cb('0xe')][_0x46cb('0x31')]!=_0x106a87['Interaction'][_0x46cb('0x31')]){return _0x48101c[_0x46cb('0x16')]['update']({'threadId':_0x180ce1['body'][_0x46cb('0x31')]},{'logging':!![],'where':{'id':_0x106a87['Interaction']['id']}});}else{return;}})[_0x46cb('0x18')](function(){return _0x56258a[_0x46cb('0x19')]({'read':!![]});})[_0x46cb('0x1b')](function(_0xd96713){logger[_0x46cb('0x1c')](_0x46cb('0x27'),'afterCreate',util[_0x46cb('0x32')](_0xd96713,{'showHidden':![],'depth':null}));_0x34f9e9();});}else{_0x34f9e9();}})['finally'](function(){_0x34f9e9();});}else{_0x34f9e9();}}},'charset':_0x46cb('0x33'),'collate':_0x46cb('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2930fb2..81b3645 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0xdb28,0x106));var _0x8db2=function(_0x10f1a6,_0x3a404f){_0x10f1a6=_0x10f1a6-0x0;var _0x404d88=_0xdb28[_0x10f1a6];return _0x404d88;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x405254,_0x3ae2e9){var _0x40d2fd=function(_0x402b00){while(--_0x402b00){_0x405254['push'](_0x405254['shift']());}};_0x40d2fd(++_0x3ae2e9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2abd1b,_0x902882){_0x2abd1b=_0x2abd1b-0x0;var _0x2e4084=_0x5f2f[_0x2abd1b];return _0x2e4084;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 18c6dab..3c30374 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 _0x5e61=['update','emit','removeListener','length','./openchannelMessage.events','save','remove'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0x5e61,0x1e0));var _0x15e6=function(_0x3b0f77,_0x49f807){_0x3b0f77=_0x3b0f77-0x0;var _0x3ea254=_0x5e61[_0x3b0f77];return _0x3ea254;};'use strict';var OpenchannelMessageEvents=require(_0x15e6('0x0'));var events=[_0x15e6('0x1'),_0x15e6('0x2'),_0x15e6('0x3')];function createListener(_0x179c93,_0x1eaa7d){return function(_0x405ee6){_0x1eaa7d[_0x15e6('0x4')](_0x179c93,_0x405ee6);};}function removeListener(_0x4255d3,_0x3e2a93){return function(){OpenchannelMessageEvents[_0x15e6('0x5')](_0x4255d3,_0x3e2a93);};}exports['register']=function(_0x5daa6a){for(var _0x382aff=0x0,_0x21e36a=events[_0x15e6('0x6')];_0x382aff<_0x21e36a;_0x382aff++){var _0x5224a3=events[_0x382aff];var _0x1dad95=createListener('openchannelMessage:'+_0x5224a3,_0x5daa6a);OpenchannelMessageEvents['on'](_0x5224a3,_0x1dad95);}}; \ No newline at end of file +var _0x99ce=['register','length','openchannelMessage:','./openchannelMessage.events','remove','update','emit'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x99ce,0x168));var _0xe99c=function(_0x1cff93,_0x132b43){_0x1cff93=_0x1cff93-0x0;var _0x2ececc=_0x99ce[_0x1cff93];return _0x2ececc;};'use strict';var OpenchannelMessageEvents=require(_0xe99c('0x0'));var events=['save',_0xe99c('0x1'),_0xe99c('0x2')];function createListener(_0x226ddc,_0x659e71){return function(_0x4559a8){_0x659e71[_0xe99c('0x3')](_0x226ddc,_0x4559a8);};}function removeListener(_0x2b7a8c,_0x577c49){return function(){OpenchannelMessageEvents['removeListener'](_0x2b7a8c,_0x577c49);};}exports[_0xe99c('0x4')]=function(_0x37d978){for(var _0x2f7d1b=0x0,_0x392764=events[_0xe99c('0x5')];_0x2f7d1b<_0x392764;_0x2f7d1b++){var _0x27a41c=events[_0x2f7d1b];var _0xbc031a=createListener(_0xe99c('0x6')+_0x27a41c,_0x37d978);OpenchannelMessageEvents['on'](_0x27a41c,_0xbc031a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9218e24..a23c99f 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 _0xfd62=['/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','./openchannelQueue.controller','isAuthenticated','index','get'];(function(_0x5b1f02,_0x2ae95d){var _0x51381b=function(_0x3a266b){while(--_0x3a266b){_0x5b1f02['push'](_0x5b1f02['shift']());}};_0x51381b(++_0x2ae95d);}(_0xfd62,0x161));var _0x2fd6=function(_0x53861f,_0x140017){_0x53861f=_0x53861f-0x0;var _0x12b5f8=_0xfd62[_0x53861f];return _0x12b5f8;};'use strict';var multer=require(_0x2fd6('0x0'));var util=require(_0x2fd6('0x1'));var path=require(_0x2fd6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fd6('0x3'));var router=express[_0x2fd6('0x4')]();var fs_extra=require(_0x2fd6('0x5'));var auth=require(_0x2fd6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2fd6('0x7'));router['get']('/',auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x9')]);router[_0x2fd6('0xa')](_0x2fd6('0xb'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0xc')]);router[_0x2fd6('0xa')]('/:id',auth[_0x2fd6('0x8')](),controller[_0x2fd6('0xd')]);router[_0x2fd6('0xa')](_0x2fd6('0xe'),auth[_0x2fd6('0x8')](),controller['getMembers']);router[_0x2fd6('0xa')](_0x2fd6('0xf'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x10')]);router[_0x2fd6('0xa')](_0x2fd6('0x11'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x12')]);router[_0x2fd6('0x13')]('/',auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x14')]);router['post'](_0x2fd6('0xf'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x15')]);router[_0x2fd6('0x13')](_0x2fd6('0x11'),auth['isAuthenticated'](),controller[_0x2fd6('0x16')]);router['put'](_0x2fd6('0x17'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x18')]);router[_0x2fd6('0x19')](_0x2fd6('0x17'),auth[_0x2fd6('0x8')](),controller[_0x2fd6('0x1a')]);router[_0x2fd6('0x19')](_0x2fd6('0xf'),auth[_0x2fd6('0x8')](),controller['removeTeams']);router[_0x2fd6('0x19')](_0x2fd6('0x11'),auth['isAuthenticated'](),controller[_0x2fd6('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x49c5=['removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','/:id','destroy'];(function(_0x212856,_0x1a505a){var _0x26f0c1=function(_0x1eb165){while(--_0x1eb165){_0x212856['push'](_0x212856['shift']());}};_0x26f0c1(++_0x1a505a);}(_0x49c5,0x17b));var _0x549c=function(_0x3975ce,_0x38c1d3){_0x3975ce=_0x3975ce-0x0;var _0x5485e8=_0x49c5[_0x3975ce];return _0x5485e8;};'use strict';var multer=require(_0x549c('0x0'));var util=require(_0x549c('0x1'));var path=require(_0x549c('0x2'));var timeout=require(_0x549c('0x3'));var express=require('express');var router=express[_0x549c('0x4')]();var fs_extra=require(_0x549c('0x5'));var auth=require(_0x549c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x549c('0x7'));var controller=require(_0x549c('0x8'));router[_0x549c('0x9')]('/',auth[_0x549c('0xa')](),controller[_0x549c('0xb')]);router[_0x549c('0x9')](_0x549c('0xc'),auth[_0x549c('0xa')](),controller[_0x549c('0xd')]);router[_0x549c('0x9')]('/:id',auth[_0x549c('0xa')](),controller[_0x549c('0xe')]);router[_0x549c('0x9')]('/:id/members',auth[_0x549c('0xa')](),controller['getMembers']);router[_0x549c('0x9')](_0x549c('0xf'),auth[_0x549c('0xa')](),controller[_0x549c('0x10')]);router[_0x549c('0x9')](_0x549c('0x11'),auth[_0x549c('0xa')](),controller[_0x549c('0x12')]);router[_0x549c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x549c('0x13')](_0x549c('0xf'),auth['isAuthenticated'](),controller[_0x549c('0x14')]);router[_0x549c('0x13')](_0x549c('0x11'),auth['isAuthenticated'](),controller[_0x549c('0x15')]);router[_0x549c('0x16')]('/:id',auth[_0x549c('0xa')](),controller[_0x549c('0x17')]);router[_0x549c('0x18')](_0x549c('0x19'),auth[_0x549c('0xa')](),controller[_0x549c('0x1a')]);router['delete'](_0x549c('0xf'),auth[_0x549c('0xa')](),controller[_0x549c('0x1b')]);router[_0x549c('0x18')](_0x549c('0x11'),auth[_0x549c('0xa')](),controller[_0x549c('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index f829505..fa9c34f 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 _0x7b4e=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x38da1b,_0x19ffeb){var _0x2a6f9b=function(_0x227b3f){while(--_0x227b3f){_0x38da1b['push'](_0x38da1b['shift']());}};_0x2a6f9b(++_0x19ffeb);}(_0x7b4e,0x1d9));var _0xe7b4=function(_0x77578f,_0x499b98){_0x77578f=_0x77578f-0x0;var _0x36d365=_0x7b4e[_0x77578f];return _0x36d365;};'use strict';var Sequelize=require(_0xe7b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7b4('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe7b4('0x1')]},'timeout':{'type':Sequelize[_0xe7b4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe7b4('0x3')](_0xe7b4('0x4'),_0xe7b4('0x5'),_0xe7b4('0x6'))}}; \ No newline at end of file +var _0x9984=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x38be32,_0x32c17a){var _0x2e0402=function(_0x17cc3a){while(--_0x17cc3a){_0x38be32['push'](_0x38be32['shift']());}};_0x2e0402(++_0x32c17a);}(_0x9984,0x8b));var _0x4998=function(_0x4af7a6,_0x11960b){_0x4af7a6=_0x4af7a6-0x0;var _0x506249=_0x9984[_0x4af7a6];return _0x506249;};'use strict';var Sequelize=require(_0x4998('0x0'));module[_0x4998('0x1')]={'name':{'type':Sequelize[_0x4998('0x2')],'unique':_0x4998('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4998('0x2')]},'timeout':{'type':Sequelize[_0x4998('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4998('0x5')](_0x4998('0x6'),'beepall',_0x4998('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 193167a..541175b 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 _0x60bd=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','index','map','OpenchannelQueue','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','Team','pick','getTeams','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs'];(function(_0x1e9968,_0x331938){var _0x384017=function(_0x1ef931){while(--_0x1ef931){_0x1e9968['push'](_0x1e9968['shift']());}};_0x384017(++_0x331938);}(_0x60bd,0x87));var _0xd60b=function(_0x3eb3bc,_0x5ab8e9){_0x3eb3bc=_0x3eb3bc-0x0;var _0x43b7f5=_0x60bd[_0x3eb3bc];return _0x43b7f5;};'use strict';var emlformat=require(_0xd60b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd60b('0x1'));var jsonpatch=require(_0xd60b('0x2'));var rp=require(_0xd60b('0x3'));var moment=require(_0xd60b('0x4'));var BPromise=require(_0xd60b('0x5'));var Mustache=require(_0xd60b('0x6'));var util=require(_0xd60b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd60b('0x8'));var ejs=require(_0xd60b('0x9'));var fs=require('fs');var fs_extra=require(_0xd60b('0xa'));var _=require(_0xd60b('0xb'));var squel=require(_0xd60b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd60b('0xd'));var deskjs=require(_0xd60b('0xe'));var toCsv=require(_0xd60b('0x8'));var querystring=require(_0xd60b('0xf'));var Papa=require(_0xd60b('0x10'));var Redis=require(_0xd60b('0x11'));var authService=require(_0xd60b('0x12'));var qs=require(_0xd60b('0x13'));var as=require(_0xd60b('0x14'));var hardwareService=require(_0xd60b('0x15'));var logger=require(_0xd60b('0x16'))(_0xd60b('0x17'));var utils=require(_0xd60b('0x18'));var config=require(_0xd60b('0x19'));var licenseUtil=require(_0xd60b('0x1a'));var db=require(_0xd60b('0x1b'))['db'];config[_0xd60b('0x1c')]=_[_0xd60b('0x1d')](config[_0xd60b('0x1c')],{'host':_0xd60b('0x1e'),'port':0x18eb});var socket=require(_0xd60b('0x1f'))(new Redis(config[_0xd60b('0x1c')]));require(_0xd60b('0x20'))[_0xd60b('0x21')](socket);function respondWithStatusCode(_0x11772c,_0x234128){_0x234128=_0x234128||0xcc;return function(_0x2778a4){if(_0x2778a4){return _0x11772c[_0xd60b('0x22')](_0x234128);}return _0x11772c[_0xd60b('0x23')](_0x234128)[_0xd60b('0x24')]();};}function respondWithResult(_0x556aaa,_0x968b6d){_0x968b6d=_0x968b6d||0xc8;return function(_0x2f21e5){if(_0x2f21e5){return _0x556aaa[_0xd60b('0x23')](_0x968b6d)[_0xd60b('0x25')](_0x2f21e5);}};}function respondWithFilteredResult(_0x421cb0,_0x28ba0a){return function(_0x2db4f1){if(_0x2db4f1){var _0x398660=typeof _0x28ba0a[_0xd60b('0x26')]==='undefined'&&typeof _0x28ba0a[_0xd60b('0x27')]===_0xd60b('0x28');var _0x57d703=_0x2db4f1['count'];var _0x73d0c2=_0x398660?0x0:_0x28ba0a[_0xd60b('0x26')];var _0x7c708d=_0x398660?_0x2db4f1[_0xd60b('0x29')]:_0x28ba0a['offset']+_0x28ba0a[_0xd60b('0x27')];var _0x4c2420;if(_0x7c708d>=_0x57d703){_0x7c708d=_0x57d703;_0x4c2420=0xc8;}else{_0x4c2420=0xce;}_0x421cb0[_0xd60b('0x23')](_0x4c2420);return _0x421cb0['set'](_0xd60b('0x2a'),_0x73d0c2+'-'+_0x7c708d+'/'+_0x57d703)[_0xd60b('0x25')](_0x2db4f1);}return null;};}function patchUpdates(_0xaa5315){return function(_0x4d711f){try{jsonpatch[_0xd60b('0x2b')](_0x4d711f,_0xaa5315,!![]);}catch(_0x9bf6e1){return BPromise[_0xd60b('0x2c')](_0x9bf6e1);}return _0x4d711f['save']();};}function saveUpdates(_0x315c8e,_0x5b5ba0){return function(_0x502ddc){if(_0x502ddc){return _0x502ddc['update'](_0x315c8e)[_0xd60b('0x2d')](function(_0x42d85a){return _0x42d85a;});}return null;};}function removeEntity(_0x32e6f1,_0x5b8ec9){return function(_0xde0346){if(_0xde0346){return _0xde0346['destroy']()[_0xd60b('0x2d')](function(){var _0x58102c=_0xde0346[_0xd60b('0x2e')]({'plain':!![]});var _0x34970a=_0xd60b('0x2f');return db[_0xd60b('0x30')][_0xd60b('0x31')]({'where':{'type':_0x34970a,'resourceId':_0x58102c['id']}})[_0xd60b('0x2d')](function(){return _0xde0346;});})[_0xd60b('0x2d')](function(){_0x32e6f1[_0xd60b('0x23')](0xcc)[_0xd60b('0x24')]();});}};}function handleEntityNotFound(_0x13e35f,_0xd6a6d8){return function(_0x1b3ff1){if(!_0x1b3ff1){_0x13e35f[_0xd60b('0x22')](0x194);}return _0x1b3ff1;};}function handleError(_0x1147df,_0x60ab9a){_0x60ab9a=_0x60ab9a||0x1f4;return function(_0xe19a96){logger[_0xd60b('0x32')](_0xe19a96['stack']);if(_0xe19a96[_0xd60b('0x33')]){delete _0xe19a96[_0xd60b('0x33')];}_0x1147df[_0xd60b('0x23')](_0x60ab9a)['send'](_0xe19a96);};}exports[_0xd60b('0x34')]=function(_0x548148,_0x6181e7){var _0x206d91={},_0x4de366={},_0x38fdda={'count':0x0,'rows':[]};var _0x3a926=_[_0xd60b('0x35')](db[_0xd60b('0x36')][_0xd60b('0x37')],function(_0x199ef0){return{'name':_0x199ef0['fieldName'],'type':_0x199ef0[_0xd60b('0x38')][_0xd60b('0x39')]};});_0x4de366['model']=_['map'](_0x3a926,_0xd60b('0x33'));_0x4de366[_0xd60b('0x3a')]=_[_0xd60b('0x3b')](_0x548148[_0xd60b('0x3a')]);_0x4de366['filters']=_['intersection'](_0x4de366[_0xd60b('0x3c')],_0x4de366[_0xd60b('0x3a')]);_0x206d91[_0xd60b('0x3d')]=_[_0xd60b('0x3e')](_0x4de366['model'],qs[_0xd60b('0x3f')](_0x548148['query']['fields']));_0x206d91[_0xd60b('0x3d')]=_0x206d91['attributes'][_0xd60b('0x40')]?_0x206d91[_0xd60b('0x3d')]:_0x4de366[_0xd60b('0x3c')];if(!_0x548148['query'][_0xd60b('0x41')](_0xd60b('0x42'))){_0x206d91[_0xd60b('0x27')]=qs['limit'](_0x548148[_0xd60b('0x3a')][_0xd60b('0x27')]);_0x206d91[_0xd60b('0x26')]=qs[_0xd60b('0x26')](_0x548148[_0xd60b('0x3a')][_0xd60b('0x26')]);}_0x206d91[_0xd60b('0x43')]=qs[_0xd60b('0x44')](_0x548148[_0xd60b('0x3a')]['sort']);_0x206d91[_0xd60b('0x45')]=qs[_0xd60b('0x46')](_['pick'](_0x548148[_0xd60b('0x3a')],_0x4de366['filters']),_0x3a926);if(_0x548148[_0xd60b('0x3a')][_0xd60b('0x47')]){_0x206d91[_0xd60b('0x45')]=_[_0xd60b('0x48')](_0x206d91[_0xd60b('0x45')],{'$or':_[_0xd60b('0x35')](_0x3a926,function(_0x46d196){if(_0x46d196[_0xd60b('0x38')]!==_0xd60b('0x49')){var _0x56fd9b={};_0x56fd9b[_0x46d196[_0xd60b('0x33')]]={'$like':'%'+_0x548148[_0xd60b('0x3a')][_0xd60b('0x47')]+'%'};return _0x56fd9b;}})});}_0x206d91=_[_0xd60b('0x48')]({},_0x206d91,_0x548148[_0xd60b('0x4a')]);var _0x49a7b1={'where':_0x206d91['where']};return db[_0xd60b('0x36')][_0xd60b('0x29')](_0x49a7b1)[_0xd60b('0x2d')](function(_0x1332a6){_0x38fdda['count']=_0x1332a6;if(_0x548148[_0xd60b('0x3a')][_0xd60b('0x4b')]){_0x206d91['include']=[{'all':!![]}];}return db[_0xd60b('0x36')][_0xd60b('0x4c')](_0x206d91);})[_0xd60b('0x2d')](function(_0x5edd42){_0x38fdda[_0xd60b('0x4d')]=_0x5edd42;return _0x38fdda;})['then'](respondWithFilteredResult(_0x6181e7,_0x206d91))['catch'](handleError(_0x6181e7,null));};exports['show']=function(_0x49497d,_0x7b1027){var _0x45776e={'raw':!![],'where':{'id':_0x49497d[_0xd60b('0x4e')]['id']}},_0x1f25fe={};_0x1f25fe[_0xd60b('0x3c')]=_['keys'](db['OpenchannelQueue'][_0xd60b('0x37')]);_0x1f25fe['query']=_[_0xd60b('0x3b')](_0x49497d['query']);_0x1f25fe[_0xd60b('0x46')]=_['intersection'](_0x1f25fe['model'],_0x1f25fe[_0xd60b('0x3a')]);_0x45776e['attributes']=_[_0xd60b('0x3e')](_0x1f25fe[_0xd60b('0x3c')],qs[_0xd60b('0x3f')](_0x49497d[_0xd60b('0x3a')][_0xd60b('0x3f')]));_0x45776e[_0xd60b('0x3d')]=_0x45776e[_0xd60b('0x3d')]['length']?_0x45776e['attributes']:_0x1f25fe[_0xd60b('0x3c')];if(_0x49497d[_0xd60b('0x3a')]['includeAll']){_0x45776e['include']=[{'all':!![]}];}_0x45776e=_[_0xd60b('0x48')]({},_0x45776e,_0x49497d[_0xd60b('0x4a')]);return db[_0xd60b('0x36')][_0xd60b('0x4f')](_0x45776e)[_0xd60b('0x2d')](handleEntityNotFound(_0x7b1027,null))['then'](respondWithResult(_0x7b1027,null))[_0xd60b('0x50')](handleError(_0x7b1027,null));};exports['create']=function(_0x4ed0fd,_0x397ba9){return db[_0xd60b('0x36')]['create'](_0x4ed0fd[_0xd60b('0x51')],{})[_0xd60b('0x2d')](function(_0x1d1aa1){var _0x75fc3d=_0x4ed0fd[_0xd60b('0x52')][_0xd60b('0x2e')]({'plain':!![]});if(!_0x75fc3d)throw new Error(_0xd60b('0x53'));if(_0x75fc3d[_0xd60b('0x54')]===_0xd60b('0x52')){var _0xb786b7=_0x1d1aa1[_0xd60b('0x2e')]({'plain':!![]});var _0x41d527='OpenchannelQueues';return db[_0xd60b('0x55')][_0xd60b('0x4f')]({'where':{'name':_0x41d527,'userProfileId':_0x75fc3d[_0xd60b('0x56')]},'raw':!![]})[_0xd60b('0x2d')](function(_0x5b242d){if(_0x5b242d&&_0x5b242d['autoAssociation']===0x0){return db[_0xd60b('0x30')][_0xd60b('0x57')]({'name':_0xb786b7['name'],'resourceId':_0xb786b7['id'],'type':_0x5b242d[_0xd60b('0x33')],'sectionId':_0x5b242d['id']},{})[_0xd60b('0x2d')](function(){return _0x1d1aa1;});}else{return _0x1d1aa1;}})[_0xd60b('0x50')](function(_0xb19252){logger['error'](_0xd60b('0x58'),_0xb19252);throw _0xb19252;});}return _0x1d1aa1;})[_0xd60b('0x2d')](respondWithResult(_0x397ba9,0xc9))[_0xd60b('0x50')](handleError(_0x397ba9,null));};exports[_0xd60b('0x59')]=function(_0x5928c7,_0x130a5a){if(_0x5928c7[_0xd60b('0x51')]['id']){delete _0x5928c7[_0xd60b('0x51')]['id'];}return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0x5928c7[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x130a5a,null))[_0xd60b('0x2d')](saveUpdates(_0x5928c7[_0xd60b('0x51')],null))['then'](respondWithResult(_0x130a5a,null))[_0xd60b('0x50')](handleError(_0x130a5a,null));};exports[_0xd60b('0x31')]=function(_0x2af189,_0x3c6bdf){return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0x2af189[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x3c6bdf,null))['then'](removeEntity(_0x3c6bdf,null))[_0xd60b('0x50')](handleError(_0x3c6bdf,null));};exports[_0xd60b('0x5a')]=function(_0x4c85e6,_0x417b97){return db[_0xd60b('0x36')][_0xd60b('0x5a')]()[_0xd60b('0x2d')](respondWithResult(_0x417b97,null))[_0xd60b('0x50')](handleError(_0x417b97,null));};exports['getMembers']=function(_0x47626e,_0x47b3fb,_0x28eadc){var _0x4f0436={'raw':!![],'where':{}},_0x419fbc={},_0x2fb56f;return db[_0xd60b('0x36')][_0xd60b('0x5b')]({'where':{'id':_0x47626e[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x47b3fb,null))[_0xd60b('0x2d')](function(_0x20a367){if(_0x20a367){_0x2fb56f=_0x20a367[_0xd60b('0x2e')]({'plain':!![]});_0x419fbc[_0xd60b('0x3c')]=_['keys'](db[_0xd60b('0x5c')]['rawAttributes']);_0x419fbc[_0xd60b('0x3a')]=_[_0xd60b('0x3b')](_0x47626e['query']);_0x419fbc[_0xd60b('0x46')]=_[_0xd60b('0x3e')](_0x419fbc['model'],_0x419fbc[_0xd60b('0x3a')]);_0x4f0436[_0xd60b('0x3d')]=_[_0xd60b('0x3e')](_0x419fbc[_0xd60b('0x3c')],qs[_0xd60b('0x3f')](_0x47626e['query'][_0xd60b('0x3f')]));_0x4f0436[_0xd60b('0x3d')]=_0x4f0436[_0xd60b('0x3d')][_0xd60b('0x40')]?_0x4f0436[_0xd60b('0x3d')]:_0x419fbc[_0xd60b('0x3c')];if(!_0x47626e[_0xd60b('0x3a')][_0xd60b('0x41')](_0xd60b('0x42'))){_0x4f0436[_0xd60b('0x27')]=qs[_0xd60b('0x27')](_0x47626e[_0xd60b('0x3a')][_0xd60b('0x27')]);_0x4f0436[_0xd60b('0x26')]=qs[_0xd60b('0x26')](_0x47626e['query']['offset']);}_0x4f0436[_0xd60b('0x43')]=qs['sort'](_0x47626e[_0xd60b('0x3a')][_0xd60b('0x44')]);_0x4f0436['where']=qs[_0xd60b('0x46')](_['pick'](_0x47626e[_0xd60b('0x3a')],_0x419fbc[_0xd60b('0x46')]));_0x4f0436[_0xd60b('0x45')][_0xd60b('0x5d')]=_0x20a367['id'];if(_0x47626e['query']['filter']){_0x4f0436['where']=_[_0xd60b('0x48')](_0x4f0436['where'],{'$or':_[_0xd60b('0x35')](_0x4f0436['attributes'],function(_0x4c49d0){var _0x2bcf75={};_0x2bcf75[_0x4c49d0]={'$like':'%'+_0x47626e[_0xd60b('0x3a')][_0xd60b('0x47')]+'%'};return _0x2bcf75;})});}_0x4f0436=_[_0xd60b('0x48')]({},_0x4f0436,_0x47626e['options']);return db['UserOpenchannelQueue']['findAll'](_0x4f0436);}})[_0xd60b('0x2d')](function(_0x315f44){if(_0x315f44){return db[_0xd60b('0x5e')][_0xd60b('0x5f')]({'where':{'id':_[_0xd60b('0x35')](_0x315f44,_0xd60b('0x60')),'role':_0xd60b('0x61')},'attributes':['id','name','openchannelPause',_0xd60b('0x62'),_0xd60b('0x63')]});}})[_0xd60b('0x2d')](function(_0x96967d){if(_0x96967d){return{'count':_0x96967d[_0xd60b('0x29')],'rows':_[_0xd60b('0x35')](_0x96967d['rows'],function(_0x54133e){return{'membername':_0x54133e[_0xd60b('0x33')],'UserId':_0x54133e['id'],'queue_name':_0x2fb56f[_0xd60b('0x33')],'OpenchannelQueueId':_0x2fb56f['id'],'interface':util[_0xd60b('0x64')](_0xd60b('0x65'),_0xd60b('0x66'),_0x54133e['name']),'penalty':0x0,'paused':_0x54133e[_0xd60b('0x67')],'createdAt':_0x54133e[_0xd60b('0x63')],'updatedAt':_0x54133e[_0xd60b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47b3fb,_0x4f0436))[_0xd60b('0x50')](handleError(_0x47b3fb,null));};exports['getTeams']=function(_0x56dcea,_0x3f0796,_0x3f6331){var _0x1d8d2b={};var _0x1bb141={};var _0x5415a5;var _0x263a7a;return db[_0xd60b('0x36')][_0xd60b('0x5b')]({'where':{'id':_0x56dcea['params']['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x3f0796,null))[_0xd60b('0x2d')](function(_0xb22838){if(_0xb22838){_0x5415a5=_0xb22838;_0x1bb141['model']=_['keys'](db[_0xd60b('0x68')]['rawAttributes']);_0x1bb141['query']=_['keys'](_0x56dcea['query']);_0x1bb141[_0xd60b('0x46')]=_[_0xd60b('0x3e')](_0x1bb141[_0xd60b('0x3c')],_0x1bb141[_0xd60b('0x3a')]);_0x1d8d2b[_0xd60b('0x3d')]=_[_0xd60b('0x3e')](_0x1bb141[_0xd60b('0x3c')],qs[_0xd60b('0x3f')](_0x56dcea['query'][_0xd60b('0x3f')]));_0x1d8d2b[_0xd60b('0x3d')]=_0x1d8d2b['attributes']['length']?_0x1d8d2b[_0xd60b('0x3d')]:_0x1bb141[_0xd60b('0x3c')];_0x1d8d2b['order']=qs['sort'](_0x56dcea[_0xd60b('0x3a')]['sort']);_0x1d8d2b[_0xd60b('0x45')]=qs[_0xd60b('0x46')](_[_0xd60b('0x69')](_0x56dcea['query'],_0x1bb141[_0xd60b('0x46')]));if(_0x56dcea[_0xd60b('0x3a')]['filter']){_0x1d8d2b['where']=_[_0xd60b('0x48')](_0x1d8d2b['where'],{'$or':_['map'](_0x1d8d2b[_0xd60b('0x3d')],function(_0x437a0a){var _0x53afe1={};_0x53afe1[_0x437a0a]={'$like':'%'+_0x56dcea[_0xd60b('0x3a')][_0xd60b('0x47')]+'%'};return _0x53afe1;})});}_0x1d8d2b=_[_0xd60b('0x48')]({},_0x1d8d2b,_0x56dcea[_0xd60b('0x4a')]);return _0x5415a5[_0xd60b('0x6a')](_0x1d8d2b);}})['then'](function(_0x3a7997){if(_0x3a7997){_0x263a7a=_0x3a7997[_0xd60b('0x40')];if(!_0x56dcea[_0xd60b('0x3a')][_0xd60b('0x41')](_0xd60b('0x42'))){_0x1d8d2b[_0xd60b('0x27')]=qs[_0xd60b('0x27')](_0x56dcea[_0xd60b('0x3a')][_0xd60b('0x27')]);_0x1d8d2b['offset']=qs['offset'](_0x56dcea[_0xd60b('0x3a')][_0xd60b('0x26')]);}return _0x5415a5[_0xd60b('0x6a')](_0x1d8d2b);}})['then'](function(_0x3ebe4f){if(_0x3ebe4f){return _0x3ebe4f?{'count':_0x263a7a,'rows':_0x3ebe4f}:null;}})[_0xd60b('0x2d')](respondWithResult(_0x3f0796,null))[_0xd60b('0x50')](handleError(_0x3f0796,null));};exports['addTeams']=function(_0x2c8579,_0x211061,_0x5d9b94){var _0x2cc7ff=_0x2c8579[_0xd60b('0x51')][_0xd60b('0x6b')];return db[_0xd60b('0x68')][_0xd60b('0x4c')]({'where':{'id':_0x2cc7ff},'attributes':['id'],'include':[{'model':db[_0xd60b('0x5e')],'as':_0xd60b('0x6c'),'attributes':['id',_0xd60b('0x33'),'online',_0xd60b('0x6d'),_0xd60b('0x6e')],'raw':!![]}]})[_0xd60b('0x2d')](function(_0x34540b){if(_0x34540b){var _0x2aa2d4=_[_0xd60b('0x6f')](_0x34540b,function(_0x4f117c){var _0xade330=_0x4f117c[_0xd60b('0x2e')]({'plain':!![]});return _0xade330[_0xd60b('0x6c')];});return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0x2c8579[_0xd60b('0x4e')]['id']}})['then'](function(_0x2d2cef){return db['sequelize'][_0xd60b('0x70')](function(_0x4e58e6){return _0x2d2cef[_0xd60b('0x71')](_0x2cc7ff,{'transaction':_0x4e58e6})[_0xd60b('0x2d')](function(){return BPromise['each'](_0x2aa2d4,function(_0x455ab0){return db['UserOpenchannelQueue'][_0xd60b('0x72')]({'where':{'UserId':_0x455ab0['id'],'OpenchannelQueueId':_0x2c8579['params']['id']},'transaction':_0x4e58e6});});})['then'](function(){_0x2aa2d4[_0xd60b('0x73')](function(_0x43fb0f){socket[_0xd60b('0x74')](_0xd60b('0x75'),{'UserId':_0x43fb0f['id'],'OpenchannelQueueId':_0x2d2cef['id']});});});});});}})[_0xd60b('0x2d')](respondWithStatusCode(_0x211061,null))[_0xd60b('0x50')](handleError(_0x211061,null));};exports[_0xd60b('0x76')]=function(_0xd2655,_0x590258,_0x42e9b3){return db[_0xd60b('0x68')][_0xd60b('0x4c')]({'where':{'id':_0xd2655['query'][_0xd60b('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd60b('0x5e')],'as':_0xd60b('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xd60b('0x2d')](handleEntityNotFound(_0x590258,null))['then'](function(_0x5d164b){var _0x2d5440=_[_0xd60b('0x35')](_0x5d164b,'id');var _0x380dff=[];var _0x4c2713=[];var _0x15a7a4=squel[_0xd60b('0x77')]();_0x15a7a4[_0xd60b('0x78')](_0xd60b('0x79'))['from'](_0xd60b('0x7a'),'tq')[_0xd60b('0x7b')](_0xd60b('0x7c'),'ut',_0xd60b('0x7d'))[_0xd60b('0x45')]('OpenchannelQueueId\x20=\x20?',_0xd2655['params']['id']);for(var _0x5191e2=0x0;_0x5191e2<_0x5d164b[_0xd60b('0x40')];_0x5191e2+=0x1){let _0x2cab1d=_0x5d164b[_0x5191e2];for(var _0x377f1a=0x0;_0x377f1a<_0x2cab1d[_0xd60b('0x6c')][_0xd60b('0x40')];_0x377f1a+=0x1){let _0x3e90a0=_0x2cab1d['Agents'][_0x377f1a];var _0x3ebaf5=_0x15a7a4[_0xd60b('0x7e')]();_0x3ebaf5[_0xd60b('0x45')](_0xd60b('0x7f'),_0x3e90a0['id']);_0x4c2713[_0xd60b('0x80')](db[_0xd60b('0x81')][_0xd60b('0x3a')](_0x3ebaf5[_0xd60b('0x82')](),{'type':db['sequelize'][_0xd60b('0x83')]['SELECT']})[_0xd60b('0x2d')](function(_0x4c109d){if(_0x4c109d[_0xd60b('0x40')]===0x1){return _0x3e90a0['id'];}else{var _0x62252c=_[_0xd60b('0x84')](_[_0xd60b('0x35')](_0x4c109d,_0xd60b('0x85')),function(_0x5e5cbd){return _[_0xd60b('0x86')](_0x2d5440,_0x5e5cbd);});if(_0x62252c){return _0x3e90a0['id'];}}}));}}return BPromise[_0xd60b('0x87')](_0x4c2713)[_0xd60b('0x2d')](function(_0x375117){_0x380dff=_(_0x380dff)[_0xd60b('0x88')](_0x375117)[_0xd60b('0x89')]()[_0xd60b('0x8a')]();return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0xd2655[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](function(_0x3ee892){return db['sequelize'][_0xd60b('0x70')](function(_0x4df331){return _0x3ee892[_0xd60b('0x76')](_0xd2655[_0xd60b('0x3a')]['ids'],{'transaction':_0x4df331})[_0xd60b('0x2d')](function(){if(!_[_0xd60b('0x8b')](_0x380dff)){return _0x3ee892[_0xd60b('0x8c')](_0x380dff,{'transaction':_0x4df331});}})[_0xd60b('0x2d')](function(){_0x380dff[_0xd60b('0x73')](function(_0x39cf26){socket[_0xd60b('0x74')](_0xd60b('0x8d'),{'UserId':_0x39cf26,'OpenchannelQueueId':_0x3ee892['id']});});});});});});})[_0xd60b('0x2d')](respondWithStatusCode(_0x590258,null))[_0xd60b('0x50')](handleError(_0x590258,null));};exports[_0xd60b('0x8e')]=function(_0x426c0f,_0x473612,_0x736ac2){return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0x426c0f[_0xd60b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x473612,null))[_0xd60b('0x2d')](function(_0x3d32ab){if(_0x3d32ab){return _0x3d32ab[_0xd60b('0x8e')](_0x426c0f[_0xd60b('0x51')][_0xd60b('0x6b')],_['omit'](_0x426c0f[_0xd60b('0x51')],[_0xd60b('0x6b'),'id'])||{})[_0xd60b('0x8f')](function(_0xa4284e){for(var _0x365252=0x0;_0x365252<_0x426c0f[_0xd60b('0x51')][_0xd60b('0x6b')][_0xd60b('0x40')];_0x365252+=0x1){socket[_0xd60b('0x74')]('userOpenchannelQueue:save',{'UserId':Number(_0x426c0f['body']['ids'][_0x365252]),'OpenchannelQueueId':Number(_0x426c0f[_0xd60b('0x4e')]['id'])});}return _0xa4284e;});}})[_0xd60b('0x2d')](respondWithResult(_0x473612,null))[_0xd60b('0x50')](handleError(_0x473612,null));};exports[_0xd60b('0x8c')]=function(_0x8f2f2f,_0x52b6ca,_0x3b6c35){return db[_0xd60b('0x36')][_0xd60b('0x4f')]({'where':{'id':_0x8f2f2f[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x52b6ca,null))[_0xd60b('0x2d')](function(_0x170bdc){if(_0x170bdc){return _0x170bdc[_0xd60b('0x8c')](_0x8f2f2f[_0xd60b('0x3a')][_0xd60b('0x6b')])[_0xd60b('0x2d')](function(){if(_[_0xd60b('0x90')](_0x8f2f2f['query']['ids'])){for(var _0x64e04d=0x0;_0x64e04d<_0x8f2f2f[_0xd60b('0x3a')]['ids'][_0xd60b('0x40')];_0x64e04d+=0x1){socket[_0xd60b('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x8f2f2f['query'][_0xd60b('0x6b')][_0x64e04d]),'OpenchannelQueueId':Number(_0x8f2f2f[_0xd60b('0x4e')]['id'])});}}else{socket[_0xd60b('0x74')](_0xd60b('0x8d'),{'UserId':Number(_0x8f2f2f[_0xd60b('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x8f2f2f['params']['id'])});}});}})[_0xd60b('0x2d')](respondWithStatusCode(_0x52b6ca,null))['catch'](handleError(_0x52b6ca,null));};exports['getAgents']=function(_0x63218b,_0x1dde8f,_0x1fecd2){var _0x439d0d={};var _0x360d91={};var _0x350da4;var _0x24932f;return db[_0xd60b('0x36')][_0xd60b('0x5b')]({'where':{'id':_0x63218b[_0xd60b('0x4e')]['id']}})[_0xd60b('0x2d')](handleEntityNotFound(_0x1dde8f,null))[_0xd60b('0x2d')](function(_0x10926d){if(_0x10926d){_0x350da4=_0x10926d;_0x360d91[_0xd60b('0x3c')]=_[_0xd60b('0x3b')](db['User']['rawAttributes']);_0x360d91[_0xd60b('0x3a')]=_[_0xd60b('0x3b')](_0x63218b['query']);_0x360d91[_0xd60b('0x46')]=_[_0xd60b('0x3e')](_0x360d91['model'],_0x360d91[_0xd60b('0x3a')]);_0x439d0d[_0xd60b('0x3d')]=_[_0xd60b('0x3e')](_0x360d91[_0xd60b('0x3c')],qs['fields'](_0x63218b[_0xd60b('0x3a')][_0xd60b('0x3f')]));_0x439d0d['attributes']=_0x439d0d[_0xd60b('0x3d')]['length']?_0x439d0d[_0xd60b('0x3d')]:_0x360d91[_0xd60b('0x3c')];_0x439d0d[_0xd60b('0x43')]=qs[_0xd60b('0x44')](_0x63218b['query'][_0xd60b('0x44')]);_0x439d0d[_0xd60b('0x45')]=qs[_0xd60b('0x46')](_[_0xd60b('0x69')](_0x63218b[_0xd60b('0x3a')],_0x360d91[_0xd60b('0x46')]));if(_0x63218b[_0xd60b('0x3a')]['filter']){_0x439d0d['where']=_[_0xd60b('0x48')](_0x439d0d[_0xd60b('0x45')],{'$or':_[_0xd60b('0x35')](_0x439d0d['attributes'],function(_0x1c90ad){var _0x58452e={};_0x58452e[_0x1c90ad]={'$like':'%'+_0x63218b[_0xd60b('0x3a')]['filter']+'%'};return _0x58452e;})});}_0x439d0d=_['merge']({},_0x439d0d,_0x63218b[_0xd60b('0x4a')]);return _0x350da4['getAgents'](_0x439d0d);}})[_0xd60b('0x2d')](function(_0x2c3da6){if(_0x2c3da6){_0x24932f=_0x2c3da6[_0xd60b('0x40')];if(!_0x63218b['query'][_0xd60b('0x41')](_0xd60b('0x42'))){_0x439d0d[_0xd60b('0x27')]=qs[_0xd60b('0x27')](_0x63218b['query']['limit']);_0x439d0d[_0xd60b('0x26')]=qs[_0xd60b('0x26')](_0x63218b[_0xd60b('0x3a')][_0xd60b('0x26')]);}return _0x350da4['getAgents'](_0x439d0d);}})[_0xd60b('0x2d')](function(_0x510fcc){if(_0x510fcc){return _0x510fcc?{'count':_0x24932f,'rows':_0x510fcc}:null;}})[_0xd60b('0x2d')](respondWithResult(_0x1dde8f,null))['catch'](handleError(_0x1dde8f,null));}; \ No newline at end of file +var _0xb337=['sequelize','transaction','UserOpenchannelQueue','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','union','compact','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','redis','./openchannelQueue.socket','status','end','undefined','limit','offset','Content-Range','reject','update','then','OpenchannelQueues','UserProfileResource','destroy','sendStatus','error','stack','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','order','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','openchannelPause','Team','getTeams','addTeams','online','voicePause','Agents'];(function(_0x569f67,_0x53d5d0){var _0x236231=function(_0x1c81f7){while(--_0x1c81f7){_0x569f67['push'](_0x569f67['shift']());}};_0x236231(++_0x53d5d0);}(_0xb337,0xa8));var _0x7b33=function(_0x36e8c5,_0x287662){_0x36e8c5=_0x36e8c5-0x0;var _0x230ccc=_0xb337[_0x36e8c5];return _0x230ccc;};'use strict';var emlformat=require(_0x7b33('0x0'));var rimraf=require(_0x7b33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b33('0x2'));var rp=require(_0x7b33('0x3'));var moment=require(_0x7b33('0x4'));var BPromise=require(_0x7b33('0x5'));var Mustache=require(_0x7b33('0x6'));var util=require(_0x7b33('0x7'));var path=require(_0x7b33('0x8'));var sox=require(_0x7b33('0x9'));var csv=require(_0x7b33('0xa'));var ejs=require(_0x7b33('0xb'));var fs=require('fs');var fs_extra=require(_0x7b33('0xc'));var _=require(_0x7b33('0xd'));var squel=require('squel');var crypto=require(_0x7b33('0xe'));var jsforce=require(_0x7b33('0xf'));var deskjs=require(_0x7b33('0x10'));var toCsv=require(_0x7b33('0xa'));var querystring=require(_0x7b33('0x11'));var Papa=require(_0x7b33('0x12'));var Redis=require('ioredis');var authService=require(_0x7b33('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7b33('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b33('0x15'));var utils=require(_0x7b33('0x16'));var config=require(_0x7b33('0x17'));var licenseUtil=require(_0x7b33('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7b33('0x19')](config['redis'],{'host':_0x7b33('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b33('0x1b')]));require(_0x7b33('0x1c'))['register'](socket);function respondWithStatusCode(_0x1c985d,_0x4fffa3){_0x4fffa3=_0x4fffa3||0xcc;return function(_0x408ae9){if(_0x408ae9){return _0x1c985d['sendStatus'](_0x4fffa3);}return _0x1c985d[_0x7b33('0x1d')](_0x4fffa3)[_0x7b33('0x1e')]();};}function respondWithResult(_0x80bce1,_0x1f249a){_0x1f249a=_0x1f249a||0xc8;return function(_0x16cf51){if(_0x16cf51){return _0x80bce1[_0x7b33('0x1d')](_0x1f249a)['json'](_0x16cf51);}};}function respondWithFilteredResult(_0xab37ff,_0x265463){return function(_0x5bc117){if(_0x5bc117){var _0x38ee76=typeof _0x265463['offset']===_0x7b33('0x1f')&&typeof _0x265463[_0x7b33('0x20')]===_0x7b33('0x1f');var _0x431d8c=_0x5bc117['count'];var _0x12c4fb=_0x38ee76?0x0:_0x265463[_0x7b33('0x21')];var _0x30c1f1=_0x38ee76?_0x5bc117['count']:_0x265463['offset']+_0x265463['limit'];var _0xb70798;if(_0x30c1f1>=_0x431d8c){_0x30c1f1=_0x431d8c;_0xb70798=0xc8;}else{_0xb70798=0xce;}_0xab37ff[_0x7b33('0x1d')](_0xb70798);return _0xab37ff['set'](_0x7b33('0x22'),_0x12c4fb+'-'+_0x30c1f1+'/'+_0x431d8c)['json'](_0x5bc117);}return null;};}function patchUpdates(_0x5577d5){return function(_0x39b531){try{jsonpatch['apply'](_0x39b531,_0x5577d5,!![]);}catch(_0x296661){return BPromise[_0x7b33('0x23')](_0x296661);}return _0x39b531['save']();};}function saveUpdates(_0x34fd89,_0x222071){return function(_0x4e2bd0){if(_0x4e2bd0){return _0x4e2bd0[_0x7b33('0x24')](_0x34fd89)['then'](function(_0x429456){return _0x429456;});}return null;};}function removeEntity(_0xd93534,_0x5686d2){return function(_0x13645e){if(_0x13645e){return _0x13645e['destroy']()[_0x7b33('0x25')](function(){var _0x38e648=_0x13645e['get']({'plain':!![]});var _0x555735=_0x7b33('0x26');return db[_0x7b33('0x27')][_0x7b33('0x28')]({'where':{'type':_0x555735,'resourceId':_0x38e648['id']}})[_0x7b33('0x25')](function(){return _0x13645e;});})[_0x7b33('0x25')](function(){_0xd93534[_0x7b33('0x1d')](0xcc)[_0x7b33('0x1e')]();});}};}function handleEntityNotFound(_0x180425,_0x235a3d){return function(_0x4ff92c){if(!_0x4ff92c){_0x180425[_0x7b33('0x29')](0x194);}return _0x4ff92c;};}function handleError(_0x4facfa,_0xeed47){_0xeed47=_0xeed47||0x1f4;return function(_0x539b21){logger[_0x7b33('0x2a')](_0x539b21[_0x7b33('0x2b')]);if(_0x539b21['name']){delete _0x539b21['name'];}_0x4facfa['status'](_0xeed47)['send'](_0x539b21);};}exports[_0x7b33('0x2c')]=function(_0x4bbb81,_0x1f0f59){var _0xf50c71={},_0xa577b1={},_0x23aa56={'count':0x0,'rows':[]};var _0x52f9a5=_[_0x7b33('0x2d')](db[_0x7b33('0x2e')][_0x7b33('0x2f')],function(_0x143dcf){return{'name':_0x143dcf[_0x7b33('0x30')],'type':_0x143dcf[_0x7b33('0x31')][_0x7b33('0x32')]};});_0xa577b1[_0x7b33('0x33')]=_[_0x7b33('0x2d')](_0x52f9a5,_0x7b33('0x34'));_0xa577b1[_0x7b33('0x35')]=_[_0x7b33('0x36')](_0x4bbb81['query']);_0xa577b1[_0x7b33('0x37')]=_[_0x7b33('0x38')](_0xa577b1['model'],_0xa577b1[_0x7b33('0x35')]);_0xf50c71[_0x7b33('0x39')]=_[_0x7b33('0x38')](_0xa577b1[_0x7b33('0x33')],qs[_0x7b33('0x3a')](_0x4bbb81[_0x7b33('0x35')][_0x7b33('0x3a')]));_0xf50c71[_0x7b33('0x39')]=_0xf50c71[_0x7b33('0x39')]['length']?_0xf50c71[_0x7b33('0x39')]:_0xa577b1[_0x7b33('0x33')];if(!_0x4bbb81[_0x7b33('0x35')][_0x7b33('0x3b')](_0x7b33('0x3c'))){_0xf50c71[_0x7b33('0x20')]=qs['limit'](_0x4bbb81['query']['limit']);_0xf50c71[_0x7b33('0x21')]=qs[_0x7b33('0x21')](_0x4bbb81[_0x7b33('0x35')][_0x7b33('0x21')]);}_0xf50c71['order']=qs[_0x7b33('0x3d')](_0x4bbb81['query'][_0x7b33('0x3d')]);_0xf50c71['where']=qs[_0x7b33('0x37')](_[_0x7b33('0x3e')](_0x4bbb81[_0x7b33('0x35')],_0xa577b1['filters']),_0x52f9a5);if(_0x4bbb81[_0x7b33('0x35')]['filter']){_0xf50c71[_0x7b33('0x3f')]=_[_0x7b33('0x40')](_0xf50c71['where'],{'$or':_['map'](_0x52f9a5,function(_0x3a9ae0){if(_0x3a9ae0[_0x7b33('0x31')]!==_0x7b33('0x41')){var _0x44eb5f={};_0x44eb5f[_0x3a9ae0[_0x7b33('0x34')]]={'$like':'%'+_0x4bbb81[_0x7b33('0x35')][_0x7b33('0x42')]+'%'};return _0x44eb5f;}})});}_0xf50c71=_['merge']({},_0xf50c71,_0x4bbb81[_0x7b33('0x43')]);var _0x1bf311={'where':_0xf50c71['where']};return db[_0x7b33('0x2e')][_0x7b33('0x44')](_0x1bf311)[_0x7b33('0x25')](function(_0x42d189){_0x23aa56[_0x7b33('0x44')]=_0x42d189;if(_0x4bbb81['query'][_0x7b33('0x45')]){_0xf50c71[_0x7b33('0x46')]=[{'all':!![]}];}return db[_0x7b33('0x2e')]['findAll'](_0xf50c71);})[_0x7b33('0x25')](function(_0x411326){_0x23aa56[_0x7b33('0x47')]=_0x411326;return _0x23aa56;})[_0x7b33('0x25')](respondWithFilteredResult(_0x1f0f59,_0xf50c71))[_0x7b33('0x48')](handleError(_0x1f0f59,null));};exports['show']=function(_0x103c2f,_0x356428){var _0x2f4f81={'raw':!![],'where':{'id':_0x103c2f[_0x7b33('0x49')]['id']}},_0x4691e8={};_0x4691e8[_0x7b33('0x33')]=_[_0x7b33('0x36')](db[_0x7b33('0x2e')][_0x7b33('0x2f')]);_0x4691e8['query']=_[_0x7b33('0x36')](_0x103c2f[_0x7b33('0x35')]);_0x4691e8[_0x7b33('0x37')]=_[_0x7b33('0x38')](_0x4691e8[_0x7b33('0x33')],_0x4691e8['query']);_0x2f4f81['attributes']=_[_0x7b33('0x38')](_0x4691e8['model'],qs[_0x7b33('0x3a')](_0x103c2f[_0x7b33('0x35')]['fields']));_0x2f4f81[_0x7b33('0x39')]=_0x2f4f81[_0x7b33('0x39')]['length']?_0x2f4f81['attributes']:_0x4691e8[_0x7b33('0x33')];if(_0x103c2f['query'][_0x7b33('0x45')]){_0x2f4f81['include']=[{'all':!![]}];}_0x2f4f81=_[_0x7b33('0x40')]({},_0x2f4f81,_0x103c2f[_0x7b33('0x43')]);return db[_0x7b33('0x2e')][_0x7b33('0x4a')](_0x2f4f81)['then'](handleEntityNotFound(_0x356428,null))[_0x7b33('0x25')](respondWithResult(_0x356428,null))[_0x7b33('0x48')](handleError(_0x356428,null));};exports[_0x7b33('0x4b')]=function(_0x7e637b,_0x26927d){return db['OpenchannelQueue'][_0x7b33('0x4b')](_0x7e637b[_0x7b33('0x4c')],{})[_0x7b33('0x25')](function(_0x1b4376){var _0xf243e4=_0x7e637b[_0x7b33('0x4d')][_0x7b33('0x4e')]({'plain':!![]});if(!_0xf243e4)throw new Error(_0x7b33('0x4f'));if(_0xf243e4[_0x7b33('0x50')]===_0x7b33('0x4d')){var _0x4c5574=_0x1b4376[_0x7b33('0x4e')]({'plain':!![]});var _0x42bb57=_0x7b33('0x26');return db[_0x7b33('0x51')]['find']({'where':{'name':_0x42bb57,'userProfileId':_0xf243e4[_0x7b33('0x52')]},'raw':!![]})['then'](function(_0x2254a7){if(_0x2254a7&&_0x2254a7['autoAssociation']===0x0){return db[_0x7b33('0x27')]['create']({'name':_0x4c5574[_0x7b33('0x34')],'resourceId':_0x4c5574['id'],'type':_0x2254a7[_0x7b33('0x34')],'sectionId':_0x2254a7['id']},{})[_0x7b33('0x25')](function(){return _0x1b4376;});}else{return _0x1b4376;}})[_0x7b33('0x48')](function(_0x167fec){logger[_0x7b33('0x2a')](_0x7b33('0x53'),_0x167fec);throw _0x167fec;});}return _0x1b4376;})[_0x7b33('0x25')](respondWithResult(_0x26927d,0xc9))['catch'](handleError(_0x26927d,null));};exports[_0x7b33('0x24')]=function(_0x3acdd7,_0x2f67d1){if(_0x3acdd7[_0x7b33('0x4c')]['id']){delete _0x3acdd7[_0x7b33('0x4c')]['id'];}return db['OpenchannelQueue'][_0x7b33('0x4a')]({'where':{'id':_0x3acdd7[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x2f67d1,null))[_0x7b33('0x25')](saveUpdates(_0x3acdd7['body'],null))[_0x7b33('0x25')](respondWithResult(_0x2f67d1,null))[_0x7b33('0x48')](handleError(_0x2f67d1,null));};exports[_0x7b33('0x28')]=function(_0x511ec2,_0x9e85c7){return db[_0x7b33('0x2e')]['find']({'where':{'id':_0x511ec2[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x9e85c7,null))[_0x7b33('0x25')](removeEntity(_0x9e85c7,null))[_0x7b33('0x48')](handleError(_0x9e85c7,null));};exports[_0x7b33('0x54')]=function(_0x39b36e,_0x462791){return db[_0x7b33('0x2e')]['describe']()[_0x7b33('0x25')](respondWithResult(_0x462791,null))[_0x7b33('0x48')](handleError(_0x462791,null));};exports[_0x7b33('0x55')]=function(_0x1d343f,_0x1a78b4,_0x82e68e){var _0x50bc7d={'raw':!![],'where':{}},_0x1d6a0b={},_0x79941;return db['OpenchannelQueue'][_0x7b33('0x56')]({'where':{'id':_0x1d343f[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x1a78b4,null))[_0x7b33('0x25')](function(_0x331bf5){if(_0x331bf5){_0x79941=_0x331bf5[_0x7b33('0x4e')]({'plain':!![]});_0x1d6a0b['model']=_[_0x7b33('0x36')](db['UserOpenchannelQueue'][_0x7b33('0x2f')]);_0x1d6a0b['query']=_[_0x7b33('0x36')](_0x1d343f[_0x7b33('0x35')]);_0x1d6a0b[_0x7b33('0x37')]=_[_0x7b33('0x38')](_0x1d6a0b[_0x7b33('0x33')],_0x1d6a0b[_0x7b33('0x35')]);_0x50bc7d[_0x7b33('0x39')]=_[_0x7b33('0x38')](_0x1d6a0b[_0x7b33('0x33')],qs['fields'](_0x1d343f[_0x7b33('0x35')][_0x7b33('0x3a')]));_0x50bc7d[_0x7b33('0x39')]=_0x50bc7d[_0x7b33('0x39')][_0x7b33('0x57')]?_0x50bc7d[_0x7b33('0x39')]:_0x1d6a0b[_0x7b33('0x33')];if(!_0x1d343f[_0x7b33('0x35')][_0x7b33('0x3b')](_0x7b33('0x3c'))){_0x50bc7d['limit']=qs[_0x7b33('0x20')](_0x1d343f[_0x7b33('0x35')]['limit']);_0x50bc7d[_0x7b33('0x21')]=qs[_0x7b33('0x21')](_0x1d343f[_0x7b33('0x35')][_0x7b33('0x21')]);}_0x50bc7d[_0x7b33('0x58')]=qs[_0x7b33('0x3d')](_0x1d343f['query'][_0x7b33('0x3d')]);_0x50bc7d['where']=qs[_0x7b33('0x37')](_[_0x7b33('0x3e')](_0x1d343f[_0x7b33('0x35')],_0x1d6a0b['filters']));_0x50bc7d['where'][_0x7b33('0x59')]=_0x331bf5['id'];if(_0x1d343f[_0x7b33('0x35')]['filter']){_0x50bc7d[_0x7b33('0x3f')]=_[_0x7b33('0x40')](_0x50bc7d[_0x7b33('0x3f')],{'$or':_[_0x7b33('0x2d')](_0x50bc7d[_0x7b33('0x39')],function(_0x44498b){var _0x37ec30={};_0x37ec30[_0x44498b]={'$like':'%'+_0x1d343f[_0x7b33('0x35')][_0x7b33('0x42')]+'%'};return _0x37ec30;})});}_0x50bc7d=_[_0x7b33('0x40')]({},_0x50bc7d,_0x1d343f['options']);return db['UserOpenchannelQueue'][_0x7b33('0x5a')](_0x50bc7d);}})[_0x7b33('0x25')](function(_0x343721){if(_0x343721){return db[_0x7b33('0x5b')][_0x7b33('0x5c')]({'where':{'id':_[_0x7b33('0x2d')](_0x343721,_0x7b33('0x5d')),'role':_0x7b33('0x5e')},'attributes':['id',_0x7b33('0x34'),'openchannelPause','updatedAt',_0x7b33('0x5f')]});}})[_0x7b33('0x25')](function(_0x307491){if(_0x307491){return{'count':_0x307491['count'],'rows':_[_0x7b33('0x2d')](_0x307491[_0x7b33('0x47')],function(_0x1ad397){return{'membername':_0x1ad397[_0x7b33('0x34')],'UserId':_0x1ad397['id'],'queue_name':_0x79941[_0x7b33('0x34')],'OpenchannelQueueId':_0x79941['id'],'interface':util[_0x7b33('0x60')](_0x7b33('0x61'),_0x7b33('0x62'),_0x1ad397['name']),'penalty':0x0,'paused':_0x1ad397[_0x7b33('0x63')],'createdAt':_0x1ad397[_0x7b33('0x5f')],'updatedAt':_0x1ad397['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1a78b4,_0x50bc7d))[_0x7b33('0x48')](handleError(_0x1a78b4,null));};exports['getTeams']=function(_0x1b3729,_0x3bf0e4,_0x8f2ff8){var _0x2daf41={};var _0x208d7d={};var _0x2f56a6;var _0x7a40fe;return db[_0x7b33('0x2e')]['findOne']({'where':{'id':_0x1b3729[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x3bf0e4,null))[_0x7b33('0x25')](function(_0xdf452d){if(_0xdf452d){_0x2f56a6=_0xdf452d;_0x208d7d[_0x7b33('0x33')]=_[_0x7b33('0x36')](db[_0x7b33('0x64')][_0x7b33('0x2f')]);_0x208d7d[_0x7b33('0x35')]=_[_0x7b33('0x36')](_0x1b3729[_0x7b33('0x35')]);_0x208d7d[_0x7b33('0x37')]=_[_0x7b33('0x38')](_0x208d7d['model'],_0x208d7d['query']);_0x2daf41[_0x7b33('0x39')]=_['intersection'](_0x208d7d['model'],qs[_0x7b33('0x3a')](_0x1b3729[_0x7b33('0x35')][_0x7b33('0x3a')]));_0x2daf41[_0x7b33('0x39')]=_0x2daf41[_0x7b33('0x39')][_0x7b33('0x57')]?_0x2daf41[_0x7b33('0x39')]:_0x208d7d[_0x7b33('0x33')];_0x2daf41['order']=qs[_0x7b33('0x3d')](_0x1b3729[_0x7b33('0x35')]['sort']);_0x2daf41[_0x7b33('0x3f')]=qs[_0x7b33('0x37')](_[_0x7b33('0x3e')](_0x1b3729[_0x7b33('0x35')],_0x208d7d[_0x7b33('0x37')]));if(_0x1b3729[_0x7b33('0x35')]['filter']){_0x2daf41[_0x7b33('0x3f')]=_[_0x7b33('0x40')](_0x2daf41[_0x7b33('0x3f')],{'$or':_['map'](_0x2daf41['attributes'],function(_0xd809aa){var _0x5e0e8f={};_0x5e0e8f[_0xd809aa]={'$like':'%'+_0x1b3729['query']['filter']+'%'};return _0x5e0e8f;})});}_0x2daf41=_[_0x7b33('0x40')]({},_0x2daf41,_0x1b3729[_0x7b33('0x43')]);return _0x2f56a6['getTeams'](_0x2daf41);}})[_0x7b33('0x25')](function(_0x33068d){if(_0x33068d){_0x7a40fe=_0x33068d[_0x7b33('0x57')];if(!_0x1b3729[_0x7b33('0x35')][_0x7b33('0x3b')](_0x7b33('0x3c'))){_0x2daf41['limit']=qs[_0x7b33('0x20')](_0x1b3729[_0x7b33('0x35')][_0x7b33('0x20')]);_0x2daf41[_0x7b33('0x21')]=qs[_0x7b33('0x21')](_0x1b3729[_0x7b33('0x35')][_0x7b33('0x21')]);}return _0x2f56a6[_0x7b33('0x65')](_0x2daf41);}})[_0x7b33('0x25')](function(_0x56576e){if(_0x56576e){return _0x56576e?{'count':_0x7a40fe,'rows':_0x56576e}:null;}})[_0x7b33('0x25')](respondWithResult(_0x3bf0e4,null))[_0x7b33('0x48')](handleError(_0x3bf0e4,null));};exports[_0x7b33('0x66')]=function(_0x249096,_0x356848,_0x10ca2e){var _0x482ef4=_0x249096[_0x7b33('0x4c')]['ids'];return db[_0x7b33('0x64')]['findAll']({'where':{'id':_0x482ef4},'attributes':['id'],'include':[{'model':db[_0x7b33('0x5b')],'as':'Agents','attributes':['id',_0x7b33('0x34'),_0x7b33('0x67'),_0x7b33('0x68'),'interface'],'raw':!![]}]})[_0x7b33('0x25')](function(_0x128e66){if(_0x128e66){var _0x4ab9cc=_['flatMap'](_0x128e66,function(_0x4f0181){var _0x908e49=_0x4f0181[_0x7b33('0x4e')]({'plain':!![]});return _0x908e49[_0x7b33('0x69')];});return db[_0x7b33('0x2e')][_0x7b33('0x4a')]({'where':{'id':_0x249096[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](function(_0x15d01c){return db[_0x7b33('0x6a')][_0x7b33('0x6b')](function(_0x41e974){return _0x15d01c[_0x7b33('0x66')](_0x482ef4,{'transaction':_0x41e974})['then'](function(){return BPromise['each'](_0x4ab9cc,function(_0x4dd8d9){return db[_0x7b33('0x6c')]['findOrCreate']({'where':{'UserId':_0x4dd8d9['id'],'OpenchannelQueueId':_0x249096['params']['id']},'transaction':_0x41e974});});})[_0x7b33('0x25')](function(){_0x4ab9cc[_0x7b33('0x6d')](function(_0x398c40){socket[_0x7b33('0x6e')](_0x7b33('0x6f'),{'UserId':_0x398c40['id'],'OpenchannelQueueId':_0x15d01c['id']});});});});});}})[_0x7b33('0x25')](respondWithStatusCode(_0x356848,null))[_0x7b33('0x48')](handleError(_0x356848,null));};exports[_0x7b33('0x70')]=function(_0x4a4e30,_0x54e8ad,_0x3348e6){return db[_0x7b33('0x64')]['findAll']({'where':{'id':_0x4a4e30[_0x7b33('0x35')][_0x7b33('0x71')]},'attributes':['id'],'include':[{'model':db[_0x7b33('0x5b')],'as':_0x7b33('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7b33('0x25')](handleEntityNotFound(_0x54e8ad,null))[_0x7b33('0x25')](function(_0x161bf1){var _0x359ba9=_[_0x7b33('0x2d')](_0x161bf1,'id');var _0x3cd9d5=[];var _0x221790=[];var _0x5c972d=squel[_0x7b33('0x72')]();_0x5c972d[_0x7b33('0x73')]('tq.TeamId')['from'](_0x7b33('0x74'),'tq')[_0x7b33('0x75')](_0x7b33('0x76'),'ut',_0x7b33('0x77'))[_0x7b33('0x3f')](_0x7b33('0x78'),_0x4a4e30[_0x7b33('0x49')]['id']);for(var _0x173d24=0x0;_0x173d24<_0x161bf1[_0x7b33('0x57')];_0x173d24+=0x1){let _0x251de6=_0x161bf1[_0x173d24];for(var _0x5e2ffb=0x0;_0x5e2ffb<_0x251de6[_0x7b33('0x69')][_0x7b33('0x57')];_0x5e2ffb+=0x1){let _0x1c1ae1=_0x251de6['Agents'][_0x5e2ffb];var _0xd2dadd=_0x5c972d[_0x7b33('0x79')]();_0xd2dadd[_0x7b33('0x3f')](_0x7b33('0x7a'),_0x1c1ae1['id']);_0x221790['push'](db[_0x7b33('0x6a')][_0x7b33('0x35')](_0xd2dadd[_0x7b33('0x7b')](),{'type':db['sequelize'][_0x7b33('0x7c')][_0x7b33('0x7d')]})[_0x7b33('0x25')](function(_0x32be4f){if(_0x32be4f['length']===0x1){return _0x1c1ae1['id'];}else{var _0x495e44=_['every'](_[_0x7b33('0x2d')](_0x32be4f,_0x7b33('0x7e')),function(_0x5987d2){return _['includes'](_0x359ba9,_0x5987d2);});if(_0x495e44){return _0x1c1ae1['id'];}}}));}}return BPromise[_0x7b33('0x7f')](_0x221790)['then'](function(_0x471bc2){_0x3cd9d5=_(_0x3cd9d5)[_0x7b33('0x80')](_0x471bc2)[_0x7b33('0x81')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x4a4e30[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](function(_0x516770){return db[_0x7b33('0x6a')][_0x7b33('0x6b')](function(_0x207743){return _0x516770[_0x7b33('0x70')](_0x4a4e30['query']['ids'],{'transaction':_0x207743})[_0x7b33('0x25')](function(){if(!_['isEmpty'](_0x3cd9d5)){return _0x516770[_0x7b33('0x82')](_0x3cd9d5,{'transaction':_0x207743});}})[_0x7b33('0x25')](function(){_0x3cd9d5['forEach'](function(_0x25893a){socket[_0x7b33('0x6e')]('userOpenchannelQueue:remove',{'UserId':_0x25893a,'OpenchannelQueueId':_0x516770['id']});});});});});});})[_0x7b33('0x25')](respondWithStatusCode(_0x54e8ad,null))[_0x7b33('0x48')](handleError(_0x54e8ad,null));};exports['addAgents']=function(_0x22d976,_0x2bf441,_0x20ec43){return db[_0x7b33('0x2e')][_0x7b33('0x4a')]({'where':{'id':_0x22d976[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x2bf441,null))['then'](function(_0x4609a6){if(_0x4609a6){return _0x4609a6[_0x7b33('0x83')](_0x22d976[_0x7b33('0x4c')][_0x7b33('0x71')],_[_0x7b33('0x84')](_0x22d976['body'],[_0x7b33('0x71'),'id'])||{})[_0x7b33('0x85')](function(_0x181576){for(var _0x279e6e=0x0;_0x279e6e<_0x22d976[_0x7b33('0x4c')]['ids']['length'];_0x279e6e+=0x1){socket[_0x7b33('0x6e')](_0x7b33('0x6f'),{'UserId':Number(_0x22d976[_0x7b33('0x4c')][_0x7b33('0x71')][_0x279e6e]),'OpenchannelQueueId':Number(_0x22d976[_0x7b33('0x49')]['id'])});}return _0x181576;});}})[_0x7b33('0x25')](respondWithResult(_0x2bf441,null))[_0x7b33('0x48')](handleError(_0x2bf441,null));};exports[_0x7b33('0x82')]=function(_0x566ad2,_0xe9b92e,_0x186bc6){return db[_0x7b33('0x2e')][_0x7b33('0x4a')]({'where':{'id':_0x566ad2['params']['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0xe9b92e,null))[_0x7b33('0x25')](function(_0x4e9744){if(_0x4e9744){return _0x4e9744['removeAgents'](_0x566ad2[_0x7b33('0x35')][_0x7b33('0x71')])[_0x7b33('0x25')](function(){if(_[_0x7b33('0x86')](_0x566ad2[_0x7b33('0x35')][_0x7b33('0x71')])){for(var _0x4e2d50=0x0;_0x4e2d50<_0x566ad2[_0x7b33('0x35')][_0x7b33('0x71')][_0x7b33('0x57')];_0x4e2d50+=0x1){socket[_0x7b33('0x6e')](_0x7b33('0x87'),{'UserId':Number(_0x566ad2[_0x7b33('0x35')]['ids'][_0x4e2d50]),'OpenchannelQueueId':Number(_0x566ad2[_0x7b33('0x49')]['id'])});}}else{socket[_0x7b33('0x6e')](_0x7b33('0x87'),{'UserId':Number(_0x566ad2[_0x7b33('0x35')][_0x7b33('0x71')]),'OpenchannelQueueId':Number(_0x566ad2[_0x7b33('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0xe9b92e,null))[_0x7b33('0x48')](handleError(_0xe9b92e,null));};exports['getAgents']=function(_0x62ebea,_0x17e9b6,_0x4b525a){var _0x46b446={};var _0x3be608={};var _0x203b69;var _0x8b088d;return db[_0x7b33('0x2e')]['findOne']({'where':{'id':_0x62ebea[_0x7b33('0x49')]['id']}})[_0x7b33('0x25')](handleEntityNotFound(_0x17e9b6,null))[_0x7b33('0x25')](function(_0x3fcf65){if(_0x3fcf65){_0x203b69=_0x3fcf65;_0x3be608[_0x7b33('0x33')]=_[_0x7b33('0x36')](db[_0x7b33('0x5b')][_0x7b33('0x2f')]);_0x3be608['query']=_[_0x7b33('0x36')](_0x62ebea[_0x7b33('0x35')]);_0x3be608[_0x7b33('0x37')]=_['intersection'](_0x3be608['model'],_0x3be608[_0x7b33('0x35')]);_0x46b446[_0x7b33('0x39')]=_['intersection'](_0x3be608[_0x7b33('0x33')],qs[_0x7b33('0x3a')](_0x62ebea['query'][_0x7b33('0x3a')]));_0x46b446[_0x7b33('0x39')]=_0x46b446[_0x7b33('0x39')][_0x7b33('0x57')]?_0x46b446['attributes']:_0x3be608['model'];_0x46b446[_0x7b33('0x58')]=qs[_0x7b33('0x3d')](_0x62ebea[_0x7b33('0x35')]['sort']);_0x46b446[_0x7b33('0x3f')]=qs['filters'](_['pick'](_0x62ebea[_0x7b33('0x35')],_0x3be608[_0x7b33('0x37')]));if(_0x62ebea[_0x7b33('0x35')][_0x7b33('0x42')]){_0x46b446['where']=_[_0x7b33('0x40')](_0x46b446[_0x7b33('0x3f')],{'$or':_[_0x7b33('0x2d')](_0x46b446[_0x7b33('0x39')],function(_0x3383f2){var _0x124489={};_0x124489[_0x3383f2]={'$like':'%'+_0x62ebea['query'][_0x7b33('0x42')]+'%'};return _0x124489;})});}_0x46b446=_[_0x7b33('0x40')]({},_0x46b446,_0x62ebea['options']);return _0x203b69[_0x7b33('0x88')](_0x46b446);}})[_0x7b33('0x25')](function(_0x59f2c3){if(_0x59f2c3){_0x8b088d=_0x59f2c3[_0x7b33('0x57')];if(!_0x62ebea[_0x7b33('0x35')][_0x7b33('0x3b')]('nolimit')){_0x46b446['limit']=qs[_0x7b33('0x20')](_0x62ebea[_0x7b33('0x35')]['limit']);_0x46b446[_0x7b33('0x21')]=qs['offset'](_0x62ebea['query'][_0x7b33('0x21')]);}return _0x203b69[_0x7b33('0x88')](_0x46b446);}})[_0x7b33('0x25')](function(_0x1057fd){if(_0x1057fd){return _0x1057fd?{'count':_0x8b088d,'rows':_0x1057fd}:null;}})[_0x7b33('0x25')](respondWithResult(_0x17e9b6,null))['catch'](handleError(_0x17e9b6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ef74608..fa4db2a 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 _0xb802=['remove','hasOwnProperty','exports','events','setMaxListeners','update'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0xb802,0x13b));var _0x2b80=function(_0x4d5410,_0x271d8a){_0x4d5410=_0x4d5410-0x0;var _0x2e67dc=_0xb802[_0x4d5410];return _0x2e67dc;};'use strict';var EventEmitter=require(_0x2b80('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2b80('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b80('0x2'),'afterDestroy':_0x2b80('0x3')};function emitEvent(_0x42a49b){return function(_0x4e6e5d,_0x3648cc,_0x11ede3){OpenchannelQueueEvents['emit'](_0x42a49b+':'+_0x4e6e5d['id'],_0x4e6e5d);OpenchannelQueueEvents['emit'](_0x42a49b,_0x4e6e5d);_0x11ede3(null);};}for(var e in events){if(events[_0x2b80('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2b80('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xaf0a=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4c0d5c,_0x3a4761){var _0x574ea7=function(_0x2b8fab){while(--_0x2b8fab){_0x4c0d5c['push'](_0x4c0d5c['shift']());}};_0x574ea7(++_0x3a4761);}(_0xaf0a,0xcc));var _0xaaf0=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xaf0a[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xaaf0('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaaf0('0x1')](0x0);var events={'afterCreate':_0xaaf0('0x2'),'afterUpdate':'update','afterDestroy':_0xaaf0('0x3')};function emitEvent(_0x1677e2){return function(_0x25c1c3,_0x431b13,_0x4c5674){OpenchannelQueueEvents[_0xaaf0('0x4')](_0x1677e2+':'+_0x25c1c3['id'],_0x25c1c3);OpenchannelQueueEvents[_0xaaf0('0x4')](_0x1677e2,_0x25c1c3);_0x4c5674(null);};}for(var e in events){if(events[_0xaaf0('0x5')](e)){var event=events[e];OpenchannelQueue[_0xaaf0('0x6')](e,emitEvent(event));}}module[_0xaaf0('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 64c9fa7..85c57ef 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 _0x25b1=['../../config/logger','api','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x18f5d3,_0x58e36b){var _0x13b800=function(_0x32224d){while(--_0x32224d){_0x18f5d3['push'](_0x18f5d3['shift']());}};_0x13b800(++_0x58e36b);}(_0x25b1,0x12b));var _0x125b=function(_0x23bc53,_0x322e36){_0x23bc53=_0x23bc53-0x0;var _0x347720=_0x25b1[_0x23bc53];return _0x347720;};'use strict';var _=require(_0x125b('0x0'));var util=require('util');var logger=require(_0x125b('0x1'))(_0x125b('0x2'));var moment=require('moment');var BPromise=require(_0x125b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x125b('0x4'));var config=require(_0x125b('0x5'));var attributes=require(_0x125b('0x6'));module['exports']=function(_0x336015,_0x1716f9){return _0x336015[_0x125b('0x7')](_0x125b('0x8'),attributes,{'tableName':_0x125b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a08=['define','openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x541713,_0x28f642){var _0x3a42a0=function(_0x50bdd5){while(--_0x50bdd5){_0x541713['push'](_0x541713['shift']());}};_0x3a42a0(++_0x28f642);}(_0x4a08,0x1be));var _0x84a0=function(_0x2078e2,_0x736bbc){_0x2078e2=_0x2078e2-0x0;var _0x569a72=_0x4a08[_0x2078e2];return _0x569a72;};'use strict';var _=require(_0x84a0('0x0'));var util=require(_0x84a0('0x1'));var logger=require('../../config/logger')(_0x84a0('0x2'));var moment=require('moment');var BPromise=require(_0x84a0('0x3'));var rp=require(_0x84a0('0x4'));var fs=require('fs');var path=require(_0x84a0('0x5'));var rimraf=require(_0x84a0('0x6'));var config=require(_0x84a0('0x7'));var attributes=require(_0x84a0('0x8'));module[_0x84a0('0x9')]=function(_0x2ce24a,_0x4734b9){return _0x2ce24a[_0x84a0('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x84a0('0xb'),'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 cd57d5f..07e0914 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 _0x46df=['include','map','model','ShowOpenchannelQueue','find','where','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit'];(function(_0x277531,_0x1615d0){var _0x1c231d=function(_0x21dcb8){while(--_0x21dcb8){_0x277531['push'](_0x277531['shift']());}};_0x1c231d(++_0x1615d0);}(_0x46df,0x75));var _0xf46d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x46df[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf46d('0x0'));var fs=require('fs');var Redis=require(_0xf46d('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf46d('0x2'))(_0xf46d('0x3'));var config=require(_0xf46d('0x4'));var jayson=require(_0xf46d('0x5'));var client=jayson[_0xf46d('0x6')][_0xf46d('0x7')]({'port':0x232a});config[_0xf46d('0x8')]=_[_0xf46d('0x9')](config['redis'],{'host':_0xf46d('0xa'),'port':0x18eb});var socket=require(_0xf46d('0xb'))(new Redis(config['redis']));require(_0xf46d('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c0596,_0x4e01c6,_0x44dc6d){return new BPromise(function(_0x57a4cc,_0x3acae3){return client[_0xf46d('0xd')](_0x4c0596,_0x44dc6d)[_0xf46d('0xe')](function(_0x2e04dd){logger['info'](_0xf46d('0xf'),_0x4e01c6,_0xf46d('0x10'));logger[_0xf46d('0x11')](_0xf46d('0x12'),_0x4e01c6,_0xf46d('0x10'),JSON[_0xf46d('0x13')](_0x2e04dd));if(_0x2e04dd['error']){if(_0x2e04dd[_0xf46d('0x14')][_0xf46d('0x15')]===0x1f4){logger[_0xf46d('0x14')](_0xf46d('0xf'),_0x4e01c6,_0x2e04dd['error']['message']);return _0x3acae3(_0x2e04dd[_0xf46d('0x14')][_0xf46d('0x16')]);}logger['error'](_0xf46d('0xf'),_0x4e01c6,_0x2e04dd[_0xf46d('0x14')]['message']);return _0x57a4cc(_0x2e04dd[_0xf46d('0x14')][_0xf46d('0x16')]);}else{logger[_0xf46d('0x17')](_0xf46d('0xf'),_0x4e01c6,_0xf46d('0x10'));_0x57a4cc(_0x2e04dd['result'][_0xf46d('0x16')]);}})[_0xf46d('0x18')](function(_0x485fa7){logger['error'](_0xf46d('0xf'),_0x4e01c6,_0x485fa7);_0x3acae3(_0x485fa7);});});}exports[_0xf46d('0x19')]=function(_0x2917bd){var _0x26a727=this;return new Promise(function(_0x20bf55,_0xd27d86){return db[_0xf46d('0x1a')]['findAll']({'raw':_0x2917bd[_0xf46d('0x1b')]?_0x2917bd[_0xf46d('0x1b')][_0xf46d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2917bd[_0xf46d('0x1b')]?_0x2917bd[_0xf46d('0x1b')]['where']||null:null,'attributes':_0x2917bd['options']?_0x2917bd[_0xf46d('0x1b')][_0xf46d('0x1d')]||null:null,'limit':_0x2917bd[_0xf46d('0x1b')]?_0x2917bd[_0xf46d('0x1b')][_0xf46d('0x1e')]||null:null,'include':_0x2917bd[_0xf46d('0x1b')]?_0x2917bd[_0xf46d('0x1b')]['include']?_['map'](_0x2917bd[_0xf46d('0x1b')]['include'],function(_0x1d2545){return{'model':db[_0x1d2545['model']],'as':_0x1d2545['as'],'attributes':_0x1d2545['attributes'],'include':_0x1d2545[_0xf46d('0x1f')]?_[_0xf46d('0x20')](_0x1d2545[_0xf46d('0x1f')],function(_0x3586c2){return{'model':db[_0x3586c2[_0xf46d('0x21')]],'as':_0x3586c2['as'],'attributes':_0x3586c2['attributes'],'include':_0x3586c2[_0xf46d('0x1f')]?_['map'](_0x3586c2[_0xf46d('0x1f')],function(_0x5f2de1){return{'model':db[_0x5f2de1[_0xf46d('0x21')]],'as':_0x5f2de1['as'],'attributes':_0x5f2de1[_0xf46d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf46d('0xe')](function(_0x4c1ae1){logger['info'](_0xf46d('0x19'),_0x2917bd);logger[_0xf46d('0x11')](_0xf46d('0x19'),_0x2917bd,JSON[_0xf46d('0x13')](_0x4c1ae1));_0x20bf55(_0x4c1ae1);})[_0xf46d('0x18')](function(_0x245e5d){logger[_0xf46d('0x14')]('GetOpenchannelQueue',_0x245e5d[_0xf46d('0x16')],_0x2917bd);_0xd27d86(_0x26a727[_0xf46d('0x14')](0x1f4,_0x245e5d[_0xf46d('0x16')]));});});};exports[_0xf46d('0x22')]=function(_0x3560d2){var _0x2ed690=this;return new Promise(function(_0x24b438,_0x104727){return db[_0xf46d('0x1a')][_0xf46d('0x23')]({'raw':_0x3560d2['options']?_0x3560d2['options'][_0xf46d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3560d2[_0xf46d('0x1b')]?_0x3560d2[_0xf46d('0x1b')][_0xf46d('0x24')]||null:null,'attributes':_0x3560d2['options']?_0x3560d2['options']['attributes']||null:null,'include':_0x3560d2['options']?_0x3560d2[_0xf46d('0x1b')][_0xf46d('0x1f')]?_[_0xf46d('0x20')](_0x3560d2[_0xf46d('0x1b')][_0xf46d('0x1f')],function(_0x2a0f2c){return{'model':db[_0x2a0f2c[_0xf46d('0x21')]],'as':_0x2a0f2c['as'],'attributes':_0x2a0f2c[_0xf46d('0x1d')],'include':_0x2a0f2c[_0xf46d('0x1f')]?_[_0xf46d('0x20')](_0x2a0f2c[_0xf46d('0x1f')],function(_0x440913){return{'model':db[_0x440913[_0xf46d('0x21')]],'as':_0x440913['as'],'attributes':_0x440913[_0xf46d('0x1d')],'include':_0x440913[_0xf46d('0x1f')]?_[_0xf46d('0x20')](_0x440913['include'],function(_0x5c7dfb){return{'model':db[_0x5c7dfb[_0xf46d('0x21')]],'as':_0x5c7dfb['as'],'attributes':_0x5c7dfb[_0xf46d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf46d('0xe')](function(_0x569e89){logger[_0xf46d('0x17')]('ShowOpenchannelQueue',_0x3560d2);logger[_0xf46d('0x11')]('ShowOpenchannelQueue',_0x3560d2,JSON[_0xf46d('0x13')](_0x569e89));_0x24b438(_0x569e89);})['catch'](function(_0x85d036){logger['error'](_0xf46d('0x22'),_0x85d036[_0xf46d('0x16')],_0x3560d2);_0x104727(_0x2ed690['error'](0x1f4,_0x85d036[_0xf46d('0x16')]));});});}; \ No newline at end of file +var _0x8ebb=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','options','raw','limit','include','map','attributes','model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','OpenchannelQueue','where','lodash','moment','bluebird'];(function(_0x28e020,_0xf3fab5){var _0x5f1aa1=function(_0x59df29){while(--_0x59df29){_0x28e020['push'](_0x28e020['shift']());}};_0x5f1aa1(++_0xf3fab5);}(_0x8ebb,0x1b9));var _0xb8eb=function(_0x48ad11,_0x52a7f1){_0x48ad11=_0x48ad11-0x0;var _0x5a0be9=_0x8ebb[_0x48ad11];return _0x5a0be9;};'use strict';var _=require(_0xb8eb('0x0'));var util=require('util');var moment=require(_0xb8eb('0x1'));var BPromise=require(_0xb8eb('0x2'));var rs=require(_0xb8eb('0x3'));var fs=require('fs');var Redis=require(_0xb8eb('0x4'));var db=require(_0xb8eb('0x5'))['db'];var utils=require(_0xb8eb('0x6'));var logger=require(_0xb8eb('0x7'))(_0xb8eb('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8eb('0x9'));var client=jayson[_0xb8eb('0xa')]['http']({'port':0x232a});config['redis']=_[_0xb8eb('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb8eb('0xc'))[_0xb8eb('0xd')](socket);function respondWithRpcPromise(_0x49a39c,_0x2b889a,_0x52fb7a){return new BPromise(function(_0x109a7c,_0x15a15e){return client[_0xb8eb('0xe')](_0x49a39c,_0x52fb7a)[_0xb8eb('0xf')](function(_0x4986f3){logger[_0xb8eb('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b889a,_0xb8eb('0x11'));logger[_0xb8eb('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2b889a,_0xb8eb('0x11'),JSON[_0xb8eb('0x13')](_0x4986f3));if(_0x4986f3[_0xb8eb('0x14')]){if(_0x4986f3['error'][_0xb8eb('0x15')]===0x1f4){logger[_0xb8eb('0x14')](_0xb8eb('0x16'),_0x2b889a,_0x4986f3[_0xb8eb('0x14')][_0xb8eb('0x17')]);return _0x15a15e(_0x4986f3[_0xb8eb('0x14')][_0xb8eb('0x17')]);}logger['error'](_0xb8eb('0x16'),_0x2b889a,_0x4986f3[_0xb8eb('0x14')]['message']);return _0x109a7c(_0x4986f3['error'][_0xb8eb('0x17')]);}else{logger[_0xb8eb('0x10')](_0xb8eb('0x16'),_0x2b889a,_0xb8eb('0x11'));_0x109a7c(_0x4986f3[_0xb8eb('0x18')][_0xb8eb('0x17')]);}})['catch'](function(_0x5ad878){logger[_0xb8eb('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b889a,_0x5ad878);_0x15a15e(_0x5ad878);});});}exports['GetOpenchannelQueue']=function(_0x4fdb62){var _0xf3ab63=this;return new Promise(function(_0x2e431c,_0x3309fa){return db['OpenchannelQueue']['findAll']({'raw':_0x4fdb62['options']?_0x4fdb62[_0xb8eb('0x19')][_0xb8eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fdb62['options']?_0x4fdb62[_0xb8eb('0x19')]['where']||null:null,'attributes':_0x4fdb62[_0xb8eb('0x19')]?_0x4fdb62[_0xb8eb('0x19')]['attributes']||null:null,'limit':_0x4fdb62[_0xb8eb('0x19')]?_0x4fdb62['options'][_0xb8eb('0x1b')]||null:null,'include':_0x4fdb62['options']?_0x4fdb62[_0xb8eb('0x19')][_0xb8eb('0x1c')]?_[_0xb8eb('0x1d')](_0x4fdb62[_0xb8eb('0x19')][_0xb8eb('0x1c')],function(_0xd8cdb1){return{'model':db[_0xd8cdb1['model']],'as':_0xd8cdb1['as'],'attributes':_0xd8cdb1[_0xb8eb('0x1e')],'include':_0xd8cdb1[_0xb8eb('0x1c')]?_[_0xb8eb('0x1d')](_0xd8cdb1[_0xb8eb('0x1c')],function(_0x59c730){return{'model':db[_0x59c730[_0xb8eb('0x1f')]],'as':_0x59c730['as'],'attributes':_0x59c730[_0xb8eb('0x1e')],'include':_0x59c730[_0xb8eb('0x1c')]?_[_0xb8eb('0x1d')](_0x59c730[_0xb8eb('0x1c')],function(_0x4f179f){return{'model':db[_0x4f179f[_0xb8eb('0x1f')]],'as':_0x4f179f['as'],'attributes':_0x4f179f[_0xb8eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb8eb('0xf')](function(_0x408b95){logger['info'](_0xb8eb('0x20'),_0x4fdb62);logger[_0xb8eb('0x12')]('GetOpenchannelQueue',_0x4fdb62,JSON[_0xb8eb('0x13')](_0x408b95));_0x2e431c(_0x408b95);})[_0xb8eb('0x21')](function(_0x4ae2b4){logger[_0xb8eb('0x14')](_0xb8eb('0x20'),_0x4ae2b4['message'],_0x4fdb62);_0x3309fa(_0xf3ab63[_0xb8eb('0x14')](0x1f4,_0x4ae2b4['message']));});});};exports[_0xb8eb('0x22')]=function(_0x111aa7){var _0x537bcf=this;return new Promise(function(_0x4327ee,_0x189847){return db[_0xb8eb('0x23')]['find']({'raw':_0x111aa7[_0xb8eb('0x19')]?_0x111aa7[_0xb8eb('0x19')][_0xb8eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x111aa7[_0xb8eb('0x19')]?_0x111aa7[_0xb8eb('0x19')][_0xb8eb('0x24')]||null:null,'attributes':_0x111aa7[_0xb8eb('0x19')]?_0x111aa7[_0xb8eb('0x19')][_0xb8eb('0x1e')]||null:null,'include':_0x111aa7[_0xb8eb('0x19')]?_0x111aa7[_0xb8eb('0x19')][_0xb8eb('0x1c')]?_[_0xb8eb('0x1d')](_0x111aa7[_0xb8eb('0x19')]['include'],function(_0x29f99d){return{'model':db[_0x29f99d[_0xb8eb('0x1f')]],'as':_0x29f99d['as'],'attributes':_0x29f99d[_0xb8eb('0x1e')],'include':_0x29f99d['include']?_['map'](_0x29f99d[_0xb8eb('0x1c')],function(_0x2a799a){return{'model':db[_0x2a799a[_0xb8eb('0x1f')]],'as':_0x2a799a['as'],'attributes':_0x2a799a[_0xb8eb('0x1e')],'include':_0x2a799a[_0xb8eb('0x1c')]?_[_0xb8eb('0x1d')](_0x2a799a[_0xb8eb('0x1c')],function(_0x112799){return{'model':db[_0x112799[_0xb8eb('0x1f')]],'as':_0x112799['as'],'attributes':_0x112799[_0xb8eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb8eb('0xf')](function(_0x1cf4d3){logger[_0xb8eb('0x10')](_0xb8eb('0x22'),_0x111aa7);logger['debug'](_0xb8eb('0x22'),_0x111aa7,JSON[_0xb8eb('0x13')](_0x1cf4d3));_0x4327ee(_0x1cf4d3);})[_0xb8eb('0x21')](function(_0x54c516){logger[_0xb8eb('0x14')](_0xb8eb('0x22'),_0x54c516[_0xb8eb('0x17')],_0x111aa7);_0x189847(_0x537bcf[_0xb8eb('0x14')](0x1f4,_0x54c516['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d9ad7da..89b38e1 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 _0xd16e=['./openchannelQueue.events','remove','emit','removeListener','register','length','openchannelQueue:'];(function(_0x2fe59b,_0x5c2949){var _0x2419dd=function(_0x291183){while(--_0x291183){_0x2fe59b['push'](_0x2fe59b['shift']());}};_0x2419dd(++_0x5c2949);}(_0xd16e,0x196));var _0xed16=function(_0x3e9c87,_0x3f8a95){_0x3e9c87=_0x3e9c87-0x0;var _0x2288f1=_0xd16e[_0x3e9c87];return _0x2288f1;};'use strict';var OpenchannelQueueEvents=require(_0xed16('0x0'));var events=['save',_0xed16('0x1'),'update'];function createListener(_0x1f462f,_0x32f654){return function(_0x466f7b){_0x32f654[_0xed16('0x2')](_0x1f462f,_0x466f7b);};}function removeListener(_0x195fac,_0x31f83c){return function(){OpenchannelQueueEvents[_0xed16('0x3')](_0x195fac,_0x31f83c);};}exports[_0xed16('0x4')]=function(_0x51f36f){for(var _0x28c6d8=0x0,_0x2ad293=events[_0xed16('0x5')];_0x28c6d8<_0x2ad293;_0x28c6d8++){var _0x45ad05=events[_0x28c6d8];var _0xa3a76b=createListener(_0xed16('0x6')+_0x45ad05,_0x51f36f);OpenchannelQueueEvents['on'](_0x45ad05,_0xa3a76b);}}; \ No newline at end of file +var _0x9406=['length','./openchannelQueue.events','save','remove','removeListener','register'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x9406,0x6d));var _0x6940=function(_0x592726,_0x4430eb){_0x592726=_0x592726-0x0;var _0x436a50=_0x9406[_0x592726];return _0x436a50;};'use strict';var OpenchannelQueueEvents=require(_0x6940('0x0'));var events=[_0x6940('0x1'),_0x6940('0x2'),'update'];function createListener(_0x4573f4,_0x4a1def){return function(_0x250ff6){_0x4a1def['emit'](_0x4573f4,_0x250ff6);};}function removeListener(_0x14b75d,_0x239186){return function(){OpenchannelQueueEvents[_0x6940('0x3')](_0x14b75d,_0x239186);};}exports[_0x6940('0x4')]=function(_0x4ea109){for(var _0x31bb43=0x0,_0x5bc9dc=events[_0x6940('0x5')];_0x31bb43<_0x5bc9dc;_0x31bb43++){var _0x222280=events[_0x31bb43];var _0x27cc1a=createListener('openchannelQueue:'+_0x222280,_0x4ea109);OpenchannelQueueEvents['on'](_0x222280,_0x27cc1a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 0d9e6f8..72124a9 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 _0x8d77=['Router','fs-extra','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x41bcb2,_0x3853fe){var _0x5837d2=function(_0x4bfe33){while(--_0x4bfe33){_0x41bcb2['push'](_0x41bcb2['shift']());}};_0x5837d2(++_0x3853fe);}(_0x8d77,0x1a7));var _0x78d7=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8d77[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require(_0x78d7('0x0'));var util=require('util');var path=require(_0x78d7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78d7('0x2')]();var fs_extra=require(_0x78d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x78d7('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x78d7('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x78d7('0x5')](_0x78d7('0x6'),auth[_0x78d7('0x7')](),controller[_0x78d7('0x8')]);router[_0x78d7('0x5')](_0x78d7('0x9'),auth[_0x78d7('0x7')](),controller[_0x78d7('0xa')]);router['post']('/',auth[_0x78d7('0x7')](),controller[_0x78d7('0xb')]);router[_0x78d7('0xc')](_0x78d7('0x9'),auth['isAuthenticated'](),controller[_0x78d7('0xd')]);router[_0x78d7('0xe')](_0x78d7('0x9'),auth[_0x78d7('0x7')](),controller[_0x78d7('0xf')]);module[_0x78d7('0x10')]=router; \ No newline at end of file +var _0x82f8=['describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x82f8,0x15e));var _0x882f=function(_0x5cd291,_0x1f27d8){_0x5cd291=_0x5cd291-0x0;var _0x1d94e8=_0x82f8[_0x5cd291];return _0x1d94e8;};'use strict';var multer=require(_0x882f('0x0'));var util=require(_0x882f('0x1'));var path=require('path');var timeout=require(_0x882f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x882f('0x3'));var interaction=require(_0x882f('0x4'));var config=require(_0x882f('0x5'));var controller=require(_0x882f('0x6'));router[_0x882f('0x7')]('/',auth['isAuthenticated'](),controller[_0x882f('0x8')]);router[_0x882f('0x7')](_0x882f('0x9'),auth['isAuthenticated'](),controller[_0x882f('0xa')]);router['get'](_0x882f('0xb'),auth[_0x882f('0xc')](),controller[_0x882f('0xd')]);router[_0x882f('0xe')]('/',auth['isAuthenticated'](),controller[_0x882f('0xf')]);router['put'](_0x882f('0xb'),auth['isAuthenticated'](),controller[_0x882f('0x10')]);router[_0x882f('0x11')]('/:id',auth[_0x882f('0xc')](),controller[_0x882f('0x12')]);module[_0x882f('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index be55960..a497cfa 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 _0x8981=['exports','STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8981,0x76));var _0x1898=function(_0x559a04,_0x24fa28){_0x559a04=_0x559a04-0x0;var _0x1b9c14=_0x8981[_0x559a04];return _0x1b9c14;};'use strict';var moment=require(_0x1898('0x0'));var Sequelize=require(_0x1898('0x1'));module[_0x1898('0x2')]={'uniqueid':{'type':Sequelize[_0x1898('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1898('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1898('0x4')]},'acceptAt':{'type':Sequelize[_0x1898('0x4')]},'exitAt':{'type':Sequelize[_0x1898('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9eb0=['DATE','moment','sequelize','exports','STRING'];(function(_0x1963bc,_0x217a50){var _0x5392c0=function(_0x71780d){while(--_0x71780d){_0x1963bc['push'](_0x1963bc['shift']());}};_0x5392c0(++_0x217a50);}(_0x9eb0,0x1f0));var _0x09eb=function(_0x392cf5,_0x245710){_0x392cf5=_0x392cf5-0x0;var _0x466d83=_0x9eb0[_0x392cf5];return _0x466d83;};'use strict';var moment=require(_0x09eb('0x0'));var Sequelize=require(_0x09eb('0x1'));module[_0x09eb('0x2')]={'uniqueid':{'type':Sequelize[_0x09eb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x09eb('0x3')]},'joinAt':{'type':Sequelize[_0x09eb('0x4')]},'leaveAt':{'type':Sequelize[_0x09eb('0x4')]},'acceptAt':{'type':Sequelize[_0x09eb('0x4')]},'exitAt':{'type':Sequelize[_0x09eb('0x4')]},'reason':{'type':Sequelize[_0x09eb('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cf3ae33..5489e11 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 _0xdd63=['reject','save','update','then','name','send','index','OpenchannelQueueReport','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x482ce2,_0x48b227){var _0x47fc6e=function(_0x1264c7){while(--_0x1264c7){_0x482ce2['push'](_0x482ce2['shift']());}};_0x47fc6e(++_0x48b227);}(_0xdd63,0x6f));var _0x3dd6=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xdd63[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x3dd6('0x0'));var rimraf=require(_0x3dd6('0x1'));var zipdir=require(_0x3dd6('0x2'));var jsonpatch=require(_0x3dd6('0x3'));var rp=require(_0x3dd6('0x4'));var moment=require(_0x3dd6('0x5'));var BPromise=require(_0x3dd6('0x6'));var Mustache=require('mustache');var util=require(_0x3dd6('0x7'));var path=require(_0x3dd6('0x8'));var sox=require('sox');var csv=require(_0x3dd6('0x9'));var ejs=require(_0x3dd6('0xa'));var fs=require('fs');var fs_extra=require(_0x3dd6('0xb'));var _=require(_0x3dd6('0xc'));var squel=require(_0x3dd6('0xd'));var crypto=require(_0x3dd6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3dd6('0xf'));var toCsv=require(_0x3dd6('0x9'));var querystring=require('querystring');var Papa=require(_0x3dd6('0x10'));var Redis=require(_0x3dd6('0x11'));var authService=require(_0x3dd6('0x12'));var qs=require(_0x3dd6('0x13'));var as=require(_0x3dd6('0x14'));var hardwareService=require(_0x3dd6('0x15'));var logger=require('../../config/logger')(_0x3dd6('0x16'));var utils=require(_0x3dd6('0x17'));var config=require(_0x3dd6('0x18'));var licenseUtil=require(_0x3dd6('0x19'));var db=require(_0x3dd6('0x1a'))['db'];function respondWithStatusCode(_0x4c5ec8,_0x300ad7){_0x300ad7=_0x300ad7||0xcc;return function(_0x27271b){if(_0x27271b){return _0x4c5ec8[_0x3dd6('0x1b')](_0x300ad7);}return _0x4c5ec8[_0x3dd6('0x1c')](_0x300ad7)[_0x3dd6('0x1d')]();};}function respondWithResult(_0x4fc58e,_0x8ec0b8){_0x8ec0b8=_0x8ec0b8||0xc8;return function(_0x1956f4){if(_0x1956f4){return _0x4fc58e[_0x3dd6('0x1c')](_0x8ec0b8)['json'](_0x1956f4);}};}function respondWithFilteredResult(_0x31fff0,_0x508804){return function(_0x563a79){if(_0x563a79){var _0x529669=typeof _0x508804[_0x3dd6('0x1e')]===_0x3dd6('0x1f')&&typeof _0x508804[_0x3dd6('0x20')]===_0x3dd6('0x1f');var _0x533c38=_0x563a79[_0x3dd6('0x21')];var _0xb0dbe7=_0x529669?0x0:_0x508804[_0x3dd6('0x1e')];var _0x3bfbc3=_0x529669?_0x563a79[_0x3dd6('0x21')]:_0x508804['offset']+_0x508804[_0x3dd6('0x20')];var _0x4e129f;if(_0x3bfbc3>=_0x533c38){_0x3bfbc3=_0x533c38;_0x4e129f=0xc8;}else{_0x4e129f=0xce;}_0x31fff0[_0x3dd6('0x1c')](_0x4e129f);return _0x31fff0[_0x3dd6('0x22')](_0x3dd6('0x23'),_0xb0dbe7+'-'+_0x3bfbc3+'/'+_0x533c38)[_0x3dd6('0x24')](_0x563a79);}return null;};}function patchUpdates(_0xb1ac59){return function(_0x527dcf){try{jsonpatch['apply'](_0x527dcf,_0xb1ac59,!![]);}catch(_0x121e27){return BPromise[_0x3dd6('0x25')](_0x121e27);}return _0x527dcf[_0x3dd6('0x26')]();};}function saveUpdates(_0x1841f6,_0x907750){return function(_0x2b8bc7){if(_0x2b8bc7){return _0x2b8bc7[_0x3dd6('0x27')](_0x1841f6)[_0x3dd6('0x28')](function(_0x3e589a){return _0x3e589a;});}return null;};}function removeEntity(_0xd1c395,_0x2f0424){return function(_0x1ecfa0){if(_0x1ecfa0){return _0x1ecfa0['destroy']()[_0x3dd6('0x28')](function(){_0xd1c395[_0x3dd6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ce849,_0x380222){return function(_0x27fcdc){if(!_0x27fcdc){_0x1ce849['sendStatus'](0x194);}return _0x27fcdc;};}function handleError(_0xb16d9b,_0x3ce801){_0x3ce801=_0x3ce801||0x1f4;return function(_0x156705){logger['error'](_0x156705['stack']);if(_0x156705[_0x3dd6('0x29')]){delete _0x156705[_0x3dd6('0x29')];}_0xb16d9b['status'](_0x3ce801)[_0x3dd6('0x2a')](_0x156705);};}exports[_0x3dd6('0x2b')]=function(_0x32434d,_0x3af904){var _0x13b97f={},_0x18584a={},_0x530233={'count':0x0,'rows':[]};var _0x23ddda=_['map'](db[_0x3dd6('0x2c')]['rawAttributes'],function(_0x3755d6){return{'name':_0x3755d6[_0x3dd6('0x2d')],'type':_0x3755d6['type']['key']};});_0x18584a[_0x3dd6('0x2e')]=_['map'](_0x23ddda,_0x3dd6('0x29'));_0x18584a[_0x3dd6('0x2f')]=_[_0x3dd6('0x30')](_0x32434d[_0x3dd6('0x2f')]);_0x18584a[_0x3dd6('0x31')]=_['intersection'](_0x18584a['model'],_0x18584a[_0x3dd6('0x2f')]);_0x13b97f['attributes']=_[_0x3dd6('0x32')](_0x18584a['model'],qs[_0x3dd6('0x33')](_0x32434d['query']['fields']));_0x13b97f[_0x3dd6('0x34')]=_0x13b97f[_0x3dd6('0x34')][_0x3dd6('0x35')]?_0x13b97f[_0x3dd6('0x34')]:_0x18584a[_0x3dd6('0x2e')];if(!_0x32434d[_0x3dd6('0x2f')]['hasOwnProperty'](_0x3dd6('0x36'))){_0x13b97f['limit']=qs[_0x3dd6('0x20')](_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x20')]);_0x13b97f[_0x3dd6('0x1e')]=qs[_0x3dd6('0x1e')](_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x1e')]);}_0x13b97f[_0x3dd6('0x37')]=qs['sort'](_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x38')]);_0x13b97f['where']=qs[_0x3dd6('0x31')](_[_0x3dd6('0x39')](_0x32434d[_0x3dd6('0x2f')],_0x18584a[_0x3dd6('0x31')]),_0x23ddda);if(_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x3a')]){_0x13b97f[_0x3dd6('0x3b')]=_[_0x3dd6('0x3c')](_0x13b97f[_0x3dd6('0x3b')],{'$or':_[_0x3dd6('0x3d')](_0x23ddda,function(_0x23e54e){if(_0x23e54e['type']!==_0x3dd6('0x3e')){var _0x99e731={};_0x99e731[_0x23e54e[_0x3dd6('0x29')]]={'$like':'%'+_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x3a')]+'%'};return _0x99e731;}})});}_0x13b97f=_[_0x3dd6('0x3c')]({},_0x13b97f,_0x32434d[_0x3dd6('0x3f')]);var _0x3b76a9={'where':_0x13b97f['where']};return db[_0x3dd6('0x2c')][_0x3dd6('0x21')](_0x3b76a9)[_0x3dd6('0x28')](function(_0x442f1e){_0x530233[_0x3dd6('0x21')]=_0x442f1e;if(_0x32434d[_0x3dd6('0x2f')][_0x3dd6('0x40')]){_0x13b97f[_0x3dd6('0x41')]=[{'all':!![]}];}return db[_0x3dd6('0x2c')][_0x3dd6('0x42')](_0x13b97f);})['then'](function(_0x4b7395){_0x530233['rows']=_0x4b7395;return _0x530233;})[_0x3dd6('0x28')](respondWithFilteredResult(_0x3af904,_0x13b97f))[_0x3dd6('0x43')](handleError(_0x3af904,null));};exports[_0x3dd6('0x44')]=function(_0x54f37c,_0x421b05){var _0x3ba130={'raw':!![],'where':{'id':_0x54f37c[_0x3dd6('0x45')]['id']}},_0x135a27={};_0x135a27[_0x3dd6('0x2e')]=_[_0x3dd6('0x30')](db['OpenchannelQueueReport']['rawAttributes']);_0x135a27['query']=_['keys'](_0x54f37c[_0x3dd6('0x2f')]);_0x135a27[_0x3dd6('0x31')]=_['intersection'](_0x135a27[_0x3dd6('0x2e')],_0x135a27[_0x3dd6('0x2f')]);_0x3ba130[_0x3dd6('0x34')]=_[_0x3dd6('0x32')](_0x135a27['model'],qs[_0x3dd6('0x33')](_0x54f37c[_0x3dd6('0x2f')][_0x3dd6('0x33')]));_0x3ba130[_0x3dd6('0x34')]=_0x3ba130[_0x3dd6('0x34')]['length']?_0x3ba130[_0x3dd6('0x34')]:_0x135a27['model'];if(_0x54f37c[_0x3dd6('0x2f')][_0x3dd6('0x40')]){_0x3ba130[_0x3dd6('0x41')]=[{'all':!![]}];}_0x3ba130=_['merge']({},_0x3ba130,_0x54f37c[_0x3dd6('0x3f')]);return db['OpenchannelQueueReport'][_0x3dd6('0x46')](_0x3ba130)[_0x3dd6('0x28')](handleEntityNotFound(_0x421b05,null))[_0x3dd6('0x28')](respondWithResult(_0x421b05,null))['catch'](handleError(_0x421b05,null));};exports['create']=function(_0x18a9cc,_0x43a752){return db[_0x3dd6('0x2c')]['create'](_0x18a9cc['body'],{})[_0x3dd6('0x28')](respondWithResult(_0x43a752,0xc9))['catch'](handleError(_0x43a752,null));};exports['update']=function(_0x3b31e0,_0x2e2a19){if(_0x3b31e0[_0x3dd6('0x47')]['id']){delete _0x3b31e0[_0x3dd6('0x47')]['id'];}return db[_0x3dd6('0x2c')][_0x3dd6('0x46')]({'where':{'id':_0x3b31e0[_0x3dd6('0x45')]['id']}})[_0x3dd6('0x28')](handleEntityNotFound(_0x2e2a19,null))[_0x3dd6('0x28')](saveUpdates(_0x3b31e0[_0x3dd6('0x47')],null))[_0x3dd6('0x28')](respondWithResult(_0x2e2a19,null))[_0x3dd6('0x43')](handleError(_0x2e2a19,null));};exports[_0x3dd6('0x48')]=function(_0x1d8144,_0x2027ce){return db[_0x3dd6('0x2c')][_0x3dd6('0x46')]({'where':{'id':_0x1d8144[_0x3dd6('0x45')]['id']}})[_0x3dd6('0x28')](handleEntityNotFound(_0x2027ce,null))[_0x3dd6('0x28')](removeEntity(_0x2027ce,null))['catch'](handleError(_0x2027ce,null));};exports[_0x3dd6('0x49')]=function(_0x4f1ab7,_0x6f2633){return db[_0x3dd6('0x2c')][_0x3dd6('0x49')]()[_0x3dd6('0x28')](respondWithResult(_0x6f2633,null))[_0x3dd6('0x43')](handleError(_0x6f2633,null));}; \ No newline at end of file +var _0x8279=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x58761c,_0x4b25dc){var _0x9341dc=function(_0x414ac1){while(--_0x414ac1){_0x58761c['push'](_0x58761c['shift']());}};_0x9341dc(++_0x4b25dc);}(_0x8279,0x84));var _0x9827=function(_0x3f2043,_0x1703e2){_0x3f2043=_0x3f2043-0x0;var _0x56ddd2=_0x8279[_0x3f2043];return _0x56ddd2;};'use strict';var emlformat=require(_0x9827('0x0'));var rimraf=require(_0x9827('0x1'));var zipdir=require(_0x9827('0x2'));var jsonpatch=require(_0x9827('0x3'));var rp=require('request-promise');var moment=require(_0x9827('0x4'));var BPromise=require(_0x9827('0x5'));var Mustache=require(_0x9827('0x6'));var util=require('util');var path=require(_0x9827('0x7'));var sox=require(_0x9827('0x8'));var csv=require(_0x9827('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9827('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9827('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9827('0x9'));var querystring=require(_0x9827('0xc'));var Papa=require('papaparse');var Redis=require(_0x9827('0xd'));var authService=require(_0x9827('0xe'));var qs=require(_0x9827('0xf'));var as=require(_0x9827('0x10'));var hardwareService=require(_0x9827('0x11'));var logger=require(_0x9827('0x12'))(_0x9827('0x13'));var utils=require(_0x9827('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9827('0x15'));var db=require(_0x9827('0x16'))['db'];function respondWithStatusCode(_0x3d6f92,_0x11d938){_0x11d938=_0x11d938||0xcc;return function(_0x410521){if(_0x410521){return _0x3d6f92['sendStatus'](_0x11d938);}return _0x3d6f92[_0x9827('0x17')](_0x11d938)[_0x9827('0x18')]();};}function respondWithResult(_0x39be58,_0x210365){_0x210365=_0x210365||0xc8;return function(_0x51a9c9){if(_0x51a9c9){return _0x39be58[_0x9827('0x17')](_0x210365)[_0x9827('0x19')](_0x51a9c9);}};}function respondWithFilteredResult(_0x2cf09f,_0x1190dd){return function(_0x5f1e5f){if(_0x5f1e5f){var _0xdcce2a=typeof _0x1190dd['offset']===_0x9827('0x1a')&&typeof _0x1190dd['limit']==='undefined';var _0x4b9a56=_0x5f1e5f[_0x9827('0x1b')];var _0x168cc4=_0xdcce2a?0x0:_0x1190dd[_0x9827('0x1c')];var _0x4c1348=_0xdcce2a?_0x5f1e5f[_0x9827('0x1b')]:_0x1190dd[_0x9827('0x1c')]+_0x1190dd['limit'];var _0xc8db0c;if(_0x4c1348>=_0x4b9a56){_0x4c1348=_0x4b9a56;_0xc8db0c=0xc8;}else{_0xc8db0c=0xce;}_0x2cf09f[_0x9827('0x17')](_0xc8db0c);return _0x2cf09f[_0x9827('0x1d')]('Content-Range',_0x168cc4+'-'+_0x4c1348+'/'+_0x4b9a56)[_0x9827('0x19')](_0x5f1e5f);}return null;};}function patchUpdates(_0x2e6523){return function(_0x5ac363){try{jsonpatch['apply'](_0x5ac363,_0x2e6523,!![]);}catch(_0x22772a){return BPromise[_0x9827('0x1e')](_0x22772a);}return _0x5ac363[_0x9827('0x1f')]();};}function saveUpdates(_0x41f682,_0x428dc5){return function(_0x39484f){if(_0x39484f){return _0x39484f[_0x9827('0x20')](_0x41f682)[_0x9827('0x21')](function(_0x188b9f){return _0x188b9f;});}return null;};}function removeEntity(_0x3b3ca6,_0x567687){return function(_0x5ed2e7){if(_0x5ed2e7){return _0x5ed2e7[_0x9827('0x22')]()[_0x9827('0x21')](function(){_0x3b3ca6['status'](0xcc)[_0x9827('0x18')]();});}};}function handleEntityNotFound(_0x267343,_0x421c87){return function(_0x22d03b){if(!_0x22d03b){_0x267343[_0x9827('0x23')](0x194);}return _0x22d03b;};}function handleError(_0xf2f9be,_0xc8568d){_0xc8568d=_0xc8568d||0x1f4;return function(_0x398c47){logger[_0x9827('0x24')](_0x398c47['stack']);if(_0x398c47[_0x9827('0x25')]){delete _0x398c47[_0x9827('0x25')];}_0xf2f9be['status'](_0xc8568d)[_0x9827('0x26')](_0x398c47);};}exports[_0x9827('0x27')]=function(_0x36b130,_0x2e7a7b){var _0x3caade={},_0x2972e7={},_0x5a4f41={'count':0x0,'rows':[]};var _0x2e355b=_['map'](db[_0x9827('0x28')][_0x9827('0x29')],function(_0x2b4bd1){return{'name':_0x2b4bd1[_0x9827('0x2a')],'type':_0x2b4bd1['type'][_0x9827('0x2b')]};});_0x2972e7['model']=_[_0x9827('0x2c')](_0x2e355b,_0x9827('0x25'));_0x2972e7[_0x9827('0x2d')]=_[_0x9827('0x2e')](_0x36b130[_0x9827('0x2d')]);_0x2972e7[_0x9827('0x2f')]=_[_0x9827('0x30')](_0x2972e7[_0x9827('0x31')],_0x2972e7[_0x9827('0x2d')]);_0x3caade[_0x9827('0x32')]=_[_0x9827('0x30')](_0x2972e7[_0x9827('0x31')],qs[_0x9827('0x33')](_0x36b130[_0x9827('0x2d')][_0x9827('0x33')]));_0x3caade[_0x9827('0x32')]=_0x3caade[_0x9827('0x32')][_0x9827('0x34')]?_0x3caade[_0x9827('0x32')]:_0x2972e7[_0x9827('0x31')];if(!_0x36b130[_0x9827('0x2d')][_0x9827('0x35')](_0x9827('0x36'))){_0x3caade[_0x9827('0x37')]=qs[_0x9827('0x37')](_0x36b130['query'][_0x9827('0x37')]);_0x3caade[_0x9827('0x1c')]=qs[_0x9827('0x1c')](_0x36b130[_0x9827('0x2d')][_0x9827('0x1c')]);}_0x3caade[_0x9827('0x38')]=qs[_0x9827('0x39')](_0x36b130['query'][_0x9827('0x39')]);_0x3caade[_0x9827('0x3a')]=qs[_0x9827('0x2f')](_[_0x9827('0x3b')](_0x36b130[_0x9827('0x2d')],_0x2972e7[_0x9827('0x2f')]),_0x2e355b);if(_0x36b130[_0x9827('0x2d')][_0x9827('0x3c')]){_0x3caade[_0x9827('0x3a')]=_[_0x9827('0x3d')](_0x3caade[_0x9827('0x3a')],{'$or':_[_0x9827('0x2c')](_0x2e355b,function(_0x385f33){if(_0x385f33[_0x9827('0x3e')]!==_0x9827('0x3f')){var _0x5e57d3={};_0x5e57d3[_0x385f33['name']]={'$like':'%'+_0x36b130[_0x9827('0x2d')][_0x9827('0x3c')]+'%'};return _0x5e57d3;}})});}_0x3caade=_[_0x9827('0x3d')]({},_0x3caade,_0x36b130[_0x9827('0x40')]);var _0x43763f={'where':_0x3caade[_0x9827('0x3a')]};return db[_0x9827('0x28')][_0x9827('0x1b')](_0x43763f)['then'](function(_0xa16e45){_0x5a4f41[_0x9827('0x1b')]=_0xa16e45;if(_0x36b130[_0x9827('0x2d')][_0x9827('0x41')]){_0x3caade[_0x9827('0x42')]=[{'all':!![]}];}return db[_0x9827('0x28')][_0x9827('0x43')](_0x3caade);})[_0x9827('0x21')](function(_0x1d5ccb){_0x5a4f41[_0x9827('0x44')]=_0x1d5ccb;return _0x5a4f41;})[_0x9827('0x21')](respondWithFilteredResult(_0x2e7a7b,_0x3caade))[_0x9827('0x45')](handleError(_0x2e7a7b,null));};exports['show']=function(_0x265aa2,_0x55374d){var _0x28c38d={'raw':!![],'where':{'id':_0x265aa2[_0x9827('0x46')]['id']}},_0x4c2b90={};_0x4c2b90[_0x9827('0x31')]=_[_0x9827('0x2e')](db[_0x9827('0x28')][_0x9827('0x29')]);_0x4c2b90[_0x9827('0x2d')]=_[_0x9827('0x2e')](_0x265aa2['query']);_0x4c2b90[_0x9827('0x2f')]=_[_0x9827('0x30')](_0x4c2b90['model'],_0x4c2b90[_0x9827('0x2d')]);_0x28c38d[_0x9827('0x32')]=_[_0x9827('0x30')](_0x4c2b90[_0x9827('0x31')],qs[_0x9827('0x33')](_0x265aa2[_0x9827('0x2d')][_0x9827('0x33')]));_0x28c38d[_0x9827('0x32')]=_0x28c38d[_0x9827('0x32')][_0x9827('0x34')]?_0x28c38d[_0x9827('0x32')]:_0x4c2b90[_0x9827('0x31')];if(_0x265aa2['query'][_0x9827('0x41')]){_0x28c38d['include']=[{'all':!![]}];}_0x28c38d=_[_0x9827('0x3d')]({},_0x28c38d,_0x265aa2[_0x9827('0x40')]);return db[_0x9827('0x28')]['find'](_0x28c38d)[_0x9827('0x21')](handleEntityNotFound(_0x55374d,null))['then'](respondWithResult(_0x55374d,null))['catch'](handleError(_0x55374d,null));};exports[_0x9827('0x47')]=function(_0x1e62f3,_0x260cd8){return db['OpenchannelQueueReport'][_0x9827('0x47')](_0x1e62f3[_0x9827('0x48')],{})[_0x9827('0x21')](respondWithResult(_0x260cd8,0xc9))[_0x9827('0x45')](handleError(_0x260cd8,null));};exports[_0x9827('0x20')]=function(_0x5e5445,_0x10bb2c){if(_0x5e5445[_0x9827('0x48')]['id']){delete _0x5e5445['body']['id'];}return db[_0x9827('0x28')][_0x9827('0x49')]({'where':{'id':_0x5e5445[_0x9827('0x46')]['id']}})['then'](handleEntityNotFound(_0x10bb2c,null))[_0x9827('0x21')](saveUpdates(_0x5e5445[_0x9827('0x48')],null))['then'](respondWithResult(_0x10bb2c,null))[_0x9827('0x45')](handleError(_0x10bb2c,null));};exports[_0x9827('0x22')]=function(_0xe74346,_0x4ffcfa){return db['OpenchannelQueueReport'][_0x9827('0x49')]({'where':{'id':_0xe74346[_0x9827('0x46')]['id']}})[_0x9827('0x21')](handleEntityNotFound(_0x4ffcfa,null))[_0x9827('0x21')](removeEntity(_0x4ffcfa,null))[_0x9827('0x45')](handleError(_0x4ffcfa,null));};exports[_0x9827('0x4a')]=function(_0x248c43,_0x3395f3){return db['OpenchannelQueueReport'][_0x9827('0x4a')]()[_0x9827('0x21')](respondWithResult(_0x3395f3,null))[_0x9827('0x45')](handleError(_0x3395f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8ac109e..0110875 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x27064e,_0x34e92b){var _0x270d37=function(_0x5941db){while(--_0x5941db){_0x27064e['push'](_0x27064e['shift']());}};_0x270d37(++_0x34e92b);}(_0xe14b,0x93));var _0xbe14=function(_0x1b2805,_0x484ee9){_0x1b2805=_0x1b2805-0x0;var _0x2aece3=_0xe14b[_0x1b2805];return _0x2aece3;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x7bb36b,_0x3cbf36){var _0x3ffbfd=function(_0x5434d3){while(--_0x5434d3){_0x7bb36b['push'](_0x7bb36b['shift']());}};_0x3ffbfd(++_0x3cbf36);}(_0x326f,0xd1));var _0xf326=function(_0x25ca0d,_0x17cc4d){_0x25ca0d=_0x25ca0d-0x0;var _0x5ceefb=_0x326f[_0x25ca0d];return _0x5ceefb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 0c4c902..659044d 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 _0xbb59=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateOpenchannelQueueReport','body','options','catch','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xbb59,0xec));var _0x9bb5=function(_0x88db88,_0x426e37){_0x88db88=_0x88db88-0x0;var _0x2e52e6=_0xbb59[_0x88db88];return _0x2e52e6;};'use strict';var _=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var moment=require(_0x9bb5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bb5('0x3'));var db=require(_0x9bb5('0x4'))['db'];var utils=require(_0x9bb5('0x5'));var logger=require(_0x9bb5('0x6'))(_0x9bb5('0x7'));var config=require('../../config/environment');var jayson=require(_0x9bb5('0x8'));var client=jayson[_0x9bb5('0x9')][_0x9bb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df722,_0xe362e0,_0x83fd10){return new BPromise(function(_0x2d6cce,_0x4e3857){return client[_0x9bb5('0xb')](_0x2df722,_0x83fd10)[_0x9bb5('0xc')](function(_0x2fdbcb){logger[_0x9bb5('0xd')](_0x9bb5('0xe'),_0xe362e0,'request\x20sent');logger[_0x9bb5('0xf')](_0x9bb5('0x10'),_0xe362e0,_0x9bb5('0x11'),JSON[_0x9bb5('0x12')](_0x2fdbcb));if(_0x2fdbcb[_0x9bb5('0x13')]){if(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x14')]===0x1f4){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);return _0x4e3857(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);}logger[_0x9bb5('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe362e0,_0x2fdbcb['error'][_0x9bb5('0x15')]);return _0x2d6cce(_0x2fdbcb['error']['message']);}else{logger[_0x9bb5('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe362e0,_0x9bb5('0x11'));_0x2d6cce(_0x2fdbcb[_0x9bb5('0x16')][_0x9bb5('0x15')]);}})['catch'](function(_0xb471e){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0xb471e);_0x4e3857(_0xb471e);});});}exports[_0x9bb5('0x17')]=function(_0xba8392){var _0x19d1e9=this;return new Promise(function(_0x162815,_0xe44bdd){return db['OpenchannelQueueReport']['create'](_0xba8392[_0x9bb5('0x18')],{'raw':_0xba8392[_0x9bb5('0x19')]?_0xba8392['options']['raw']===undefined?!![]:![]:!![]})[_0x9bb5('0xc')](function(_0x182966){logger[_0x9bb5('0xd')]('CreateOpenchannelQueueReport',_0xba8392);logger[_0x9bb5('0xf')](_0x9bb5('0x17'),_0xba8392,JSON[_0x9bb5('0x12')](_0x182966));_0x162815(_0x182966);})[_0x9bb5('0x1a')](function(_0x51fa34){logger[_0x9bb5('0x13')](_0x9bb5('0x17'),_0x51fa34['message'],_0xba8392);_0xe44bdd(_0x19d1e9[_0x9bb5('0x13')](0x1f4,_0x51fa34['message']));});});};exports[_0x9bb5('0x1b')]=function(_0x5357e9){var _0x4be52b=this;return new Promise(function(_0x1d7195,_0x16db23){return db['OpenchannelQueueReport'][_0x9bb5('0x1c')](_0x5357e9[_0x9bb5('0x18')],{'raw':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9[_0x9bb5('0x19')][_0x9bb5('0x1d')]||null:null,'attributes':_0x5357e9['options']?_0x5357e9[_0x9bb5('0x19')][_0x9bb5('0x1e')]||null:null,'limit':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9['options']['limit']||null:null})['then'](function(_0x1ad67b){logger[_0x9bb5('0xd')](_0x9bb5('0x1b'),_0x5357e9);logger[_0x9bb5('0xf')](_0x9bb5('0x1b'),_0x5357e9,JSON['stringify'](_0x1ad67b));_0x1d7195(_0x1ad67b);})['catch'](function(_0x59ef00){logger[_0x9bb5('0x13')](_0x9bb5('0x1b'),_0x59ef00[_0x9bb5('0x15')],_0x5357e9);_0x16db23(_0x4be52b['error'](0x1f4,_0x59ef00['message']));});});}; \ No newline at end of file +var _0x955f=['../../mysqldb','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x955f,0x1eb));var _0xf955=function(_0x377c14,_0x4fde07){_0x377c14=_0x377c14-0x0;var _0x23a23e=_0x955f[_0x377c14];return _0x23a23e;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['CreateOpenchannelQueueReport']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['OpenchannelQueueReport'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x17d86a){logger[_0xf955('0xc')](_0xf955('0x19'),_0x5ac6cb);logger['debug'](_0xf955('0x19'),_0x5ac6cb,JSON['stringify'](_0x17d86a));_0xe6de5c(_0x17d86a);})[_0xf955('0x14')](function(_0x43b078){logger[_0xf955('0x11')](_0xf955('0x19'),_0x43b078[_0xf955('0x12')],_0x5ac6cb);_0x3c49c0(_0x1e20d1['error'](0x1f4,_0x43b078[_0xf955('0x12')]));});});};exports[_0xf955('0x1a')]=function(_0x3585c7){var _0x13a1a7=this;return new Promise(function(_0x17dec2,_0x102e36){return db[_0xf955('0x1b')]['update'](_0x3585c7[_0xf955('0x16')],{'raw':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x1c')]||null:null,'attributes':_0x3585c7['options']?_0x3585c7[_0xf955('0x17')][_0xf955('0x1d')]||null:null,'limit':_0x3585c7[_0xf955('0x17')]?_0x3585c7[_0xf955('0x17')][_0xf955('0x1e')]||null:null})[_0xf955('0xb')](function(_0x4d4af0){logger[_0xf955('0xc')](_0xf955('0x1a'),_0x3585c7);logger['debug'](_0xf955('0x1a'),_0x3585c7,JSON[_0xf955('0x10')](_0x4d4af0));_0x17dec2(_0x4d4af0);})[_0xf955('0x14')](function(_0x1ef794){logger['error'](_0xf955('0x1a'),_0x1ef794['message'],_0x3585c7);_0x102e36(_0x13a1a7[_0xf955('0x11')](0x1f4,_0x1ef794[_0xf955('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6194524..eb343d4 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 _0x712c=['./openchannelTransferReport.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5c687c,_0x8ed3a1){var _0x386f67=function(_0x57322c){while(--_0x57322c){_0x5c687c['push'](_0x5c687c['shift']());}};_0x386f67(++_0x8ed3a1);}(_0x712c,0x109));var _0xc712=function(_0x32235e,_0x5eab3a){_0x32235e=_0x32235e-0x0;var _0x55625d=_0x712c[_0x32235e];return _0x55625d;};'use strict';var multer=require(_0xc712('0x0'));var util=require('util');var path=require(_0xc712('0x1'));var timeout=require(_0xc712('0x2'));var express=require(_0xc712('0x3'));var router=express['Router']();var fs_extra=require(_0xc712('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc712('0x5'));var config=require(_0xc712('0x6'));var controller=require(_0xc712('0x7'));router[_0xc712('0x8')]('/',auth[_0xc712('0x9')](),controller['index']);router[_0xc712('0x8')]('/describe',auth[_0xc712('0x9')](),controller['describe']);router[_0xc712('0x8')](_0xc712('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc712('0xb')]('/',auth[_0xc712('0x9')](),controller[_0xc712('0xc')]);router[_0xc712('0xd')](_0xc712('0xa'),auth[_0xc712('0x9')](),controller[_0xc712('0xe')]);router['delete'](_0xc712('0xa'),auth[_0xc712('0x9')](),controller[_0xc712('0xf')]);module[_0xc712('0x10')]=router; \ No newline at end of file +var _0x7fae=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','update','destroy','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7fae,0x187));var _0xe7fa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7fae[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fa('0x0'));var timeout=require(_0xe7fa('0x1'));var express=require('express');var router=express[_0xe7fa('0x2')]();var fs_extra=require(_0xe7fa('0x3'));var auth=require(_0xe7fa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe7fa('0x5'));var controller=require(_0xe7fa('0x6'));router[_0xe7fa('0x7')]('/',auth['isAuthenticated'](),controller[_0xe7fa('0x8')]);router[_0xe7fa('0x7')](_0xe7fa('0x9'),auth[_0xe7fa('0xa')](),controller[_0xe7fa('0xb')]);router['get'](_0xe7fa('0xc'),auth[_0xe7fa('0xa')](),controller['show']);router['post']('/',auth[_0xe7fa('0xa')](),controller[_0xe7fa('0xd')]);router['put'](_0xe7fa('0xc'),auth['isAuthenticated'](),controller[_0xe7fa('0xe')]);router['delete'](_0xe7fa('0xc'),auth[_0xe7fa('0xa')](),controller[_0xe7fa('0xf')]);module[_0xe7fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 253cedb..bc7a030 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x132887,_0x8a429e){var _0x4edd79=function(_0x58096b){while(--_0x58096b){_0x132887['push'](_0x132887['shift']());}};_0x4edd79(++_0x8a429e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x279ab5,_0x35ab64){var _0x3d5a72=function(_0x48f8c5){while(--_0x48f8c5){_0x279ab5['push'](_0x279ab5['shift']());}};_0x3d5a72(++_0x35ab64);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index af3183f..602fff5 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 _0x2ae6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','error','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','OpenchannelTransferReport','then','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x381cbe,_0x17511b){var _0x1a615d=function(_0x2433d4){while(--_0x2433d4){_0x381cbe['push'](_0x381cbe['shift']());}};_0x1a615d(++_0x17511b);}(_0x2ae6,0xd0));var _0x62ae=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x2ae6[_0x11ca63];return _0x41f1f6;};'use strict';var emlformat=require(_0x62ae('0x0'));var rimraf=require(_0x62ae('0x1'));var zipdir=require(_0x62ae('0x2'));var jsonpatch=require(_0x62ae('0x3'));var rp=require(_0x62ae('0x4'));var moment=require(_0x62ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62ae('0x6'));var util=require(_0x62ae('0x7'));var path=require('path');var sox=require(_0x62ae('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62ae('0x9'));var _=require(_0x62ae('0xa'));var squel=require(_0x62ae('0xb'));var crypto=require(_0x62ae('0xc'));var jsforce=require(_0x62ae('0xd'));var deskjs=require(_0x62ae('0xe'));var toCsv=require(_0x62ae('0xf'));var querystring=require(_0x62ae('0x10'));var Papa=require(_0x62ae('0x11'));var Redis=require(_0x62ae('0x12'));var authService=require(_0x62ae('0x13'));var qs=require(_0x62ae('0x14'));var as=require(_0x62ae('0x15'));var hardwareService=require(_0x62ae('0x16'));var logger=require(_0x62ae('0x17'))('api');var utils=require(_0x62ae('0x18'));var config=require(_0x62ae('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x62ae('0x1a'))['db'];function respondWithStatusCode(_0x38f74f,_0x5059a7){_0x5059a7=_0x5059a7||0xcc;return function(_0x2e36b6){if(_0x2e36b6){return _0x38f74f[_0x62ae('0x1b')](_0x5059a7);}return _0x38f74f[_0x62ae('0x1c')](_0x5059a7)[_0x62ae('0x1d')]();};}function respondWithResult(_0x4a2aad,_0x6feaec){_0x6feaec=_0x6feaec||0xc8;return function(_0x507c52){if(_0x507c52){return _0x4a2aad[_0x62ae('0x1c')](_0x6feaec)[_0x62ae('0x1e')](_0x507c52);}};}function respondWithFilteredResult(_0x130d3b,_0x38181e){return function(_0x3932ff){if(_0x3932ff){var _0x4e9275=typeof _0x38181e[_0x62ae('0x1f')]===_0x62ae('0x20')&&typeof _0x38181e[_0x62ae('0x21')]===_0x62ae('0x20');var _0xdc46=_0x3932ff[_0x62ae('0x22')];var _0x5628a8=_0x4e9275?0x0:_0x38181e[_0x62ae('0x1f')];var _0x64662a=_0x4e9275?_0x3932ff['count']:_0x38181e[_0x62ae('0x1f')]+_0x38181e[_0x62ae('0x21')];var _0x264252;if(_0x64662a>=_0xdc46){_0x64662a=_0xdc46;_0x264252=0xc8;}else{_0x264252=0xce;}_0x130d3b['status'](_0x264252);return _0x130d3b[_0x62ae('0x23')]('Content-Range',_0x5628a8+'-'+_0x64662a+'/'+_0xdc46)[_0x62ae('0x1e')](_0x3932ff);}return null;};}function patchUpdates(_0x5bbc5f){return function(_0x1b98c8){try{jsonpatch['apply'](_0x1b98c8,_0x5bbc5f,!![]);}catch(_0x59b270){return BPromise[_0x62ae('0x24')](_0x59b270);}return _0x1b98c8[_0x62ae('0x25')]();};}function saveUpdates(_0x3e9f01,_0x27890b){return function(_0x15e4e){if(_0x15e4e){return _0x15e4e['update'](_0x3e9f01)['then'](function(_0x11aafc){return _0x11aafc;});}return null;};}function removeEntity(_0x3aea2b,_0xafa921){return function(_0x545c78){if(_0x545c78){return _0x545c78[_0x62ae('0x26')]()['then'](function(){_0x3aea2b[_0x62ae('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10d10e,_0x4f4075){return function(_0x440d46){if(!_0x440d46){_0x10d10e['sendStatus'](0x194);}return _0x440d46;};}function handleError(_0x23e8b2,_0x450c6e){_0x450c6e=_0x450c6e||0x1f4;return function(_0x224f77){logger[_0x62ae('0x27')](_0x224f77['stack']);if(_0x224f77[_0x62ae('0x28')]){delete _0x224f77[_0x62ae('0x28')];}_0x23e8b2[_0x62ae('0x1c')](_0x450c6e)['send'](_0x224f77);};}exports['index']=function(_0x2c2c88,_0xd0cc89){var _0x296775={},_0x12e6c1={},_0xdb95bd={'count':0x0,'rows':[]};var _0x5ca7cc=_[_0x62ae('0x29')](db['OpenchannelTransferReport'][_0x62ae('0x2a')],function(_0x2cd711){return{'name':_0x2cd711[_0x62ae('0x2b')],'type':_0x2cd711['type'][_0x62ae('0x2c')]};});_0x12e6c1[_0x62ae('0x2d')]=_['map'](_0x5ca7cc,'name');_0x12e6c1[_0x62ae('0x2e')]=_[_0x62ae('0x2f')](_0x2c2c88['query']);_0x12e6c1[_0x62ae('0x30')]=_[_0x62ae('0x31')](_0x12e6c1['model'],_0x12e6c1[_0x62ae('0x2e')]);_0x296775[_0x62ae('0x32')]=_[_0x62ae('0x31')](_0x12e6c1[_0x62ae('0x2d')],qs[_0x62ae('0x33')](_0x2c2c88[_0x62ae('0x2e')][_0x62ae('0x33')]));_0x296775[_0x62ae('0x32')]=_0x296775[_0x62ae('0x32')][_0x62ae('0x34')]?_0x296775['attributes']:_0x12e6c1[_0x62ae('0x2d')];if(!_0x2c2c88[_0x62ae('0x2e')][_0x62ae('0x35')]('nolimit')){_0x296775[_0x62ae('0x21')]=qs['limit'](_0x2c2c88['query'][_0x62ae('0x21')]);_0x296775[_0x62ae('0x1f')]=qs[_0x62ae('0x1f')](_0x2c2c88[_0x62ae('0x2e')][_0x62ae('0x1f')]);}_0x296775[_0x62ae('0x36')]=qs[_0x62ae('0x37')](_0x2c2c88['query'][_0x62ae('0x37')]);_0x296775[_0x62ae('0x38')]=qs[_0x62ae('0x30')](_[_0x62ae('0x39')](_0x2c2c88['query'],_0x12e6c1[_0x62ae('0x30')]),_0x5ca7cc);if(_0x2c2c88['query'][_0x62ae('0x3a')]){_0x296775['where']=_['merge'](_0x296775[_0x62ae('0x38')],{'$or':_[_0x62ae('0x29')](_0x5ca7cc,function(_0x250ddf){if(_0x250ddf['type']!==_0x62ae('0x3b')){var _0x2a789d={};_0x2a789d[_0x250ddf[_0x62ae('0x28')]]={'$like':'%'+_0x2c2c88['query']['filter']+'%'};return _0x2a789d;}})});}_0x296775=_['merge']({},_0x296775,_0x2c2c88[_0x62ae('0x3c')]);var _0x253aad={'where':_0x296775[_0x62ae('0x38')]};return db[_0x62ae('0x3d')][_0x62ae('0x22')](_0x253aad)[_0x62ae('0x3e')](function(_0xbc318c){_0xdb95bd[_0x62ae('0x22')]=_0xbc318c;if(_0x2c2c88[_0x62ae('0x2e')][_0x62ae('0x3f')]){_0x296775[_0x62ae('0x40')]=[{'all':!![]}];}return db[_0x62ae('0x3d')][_0x62ae('0x41')](_0x296775);})[_0x62ae('0x3e')](function(_0x19edee){_0xdb95bd[_0x62ae('0x42')]=_0x19edee;return _0xdb95bd;})['then'](respondWithFilteredResult(_0xd0cc89,_0x296775))[_0x62ae('0x43')](handleError(_0xd0cc89,null));};exports[_0x62ae('0x44')]=function(_0x2d42b6,_0x58459d){var _0x597d25={'raw':!![],'where':{'id':_0x2d42b6[_0x62ae('0x45')]['id']}},_0x158f26={};_0x158f26[_0x62ae('0x2d')]=_[_0x62ae('0x2f')](db[_0x62ae('0x3d')]['rawAttributes']);_0x158f26[_0x62ae('0x2e')]=_[_0x62ae('0x2f')](_0x2d42b6[_0x62ae('0x2e')]);_0x158f26[_0x62ae('0x30')]=_[_0x62ae('0x31')](_0x158f26[_0x62ae('0x2d')],_0x158f26[_0x62ae('0x2e')]);_0x597d25['attributes']=_[_0x62ae('0x31')](_0x158f26[_0x62ae('0x2d')],qs['fields'](_0x2d42b6[_0x62ae('0x2e')][_0x62ae('0x33')]));_0x597d25[_0x62ae('0x32')]=_0x597d25['attributes']['length']?_0x597d25['attributes']:_0x158f26[_0x62ae('0x2d')];if(_0x2d42b6[_0x62ae('0x2e')][_0x62ae('0x3f')]){_0x597d25[_0x62ae('0x40')]=[{'all':!![]}];}_0x597d25=_[_0x62ae('0x46')]({},_0x597d25,_0x2d42b6[_0x62ae('0x3c')]);return db[_0x62ae('0x3d')][_0x62ae('0x47')](_0x597d25)[_0x62ae('0x3e')](handleEntityNotFound(_0x58459d,null))['then'](respondWithResult(_0x58459d,null))[_0x62ae('0x43')](handleError(_0x58459d,null));};exports['create']=function(_0x33510b,_0x580d38){return db['OpenchannelTransferReport'][_0x62ae('0x48')](_0x33510b[_0x62ae('0x49')],{})[_0x62ae('0x3e')](respondWithResult(_0x580d38,0xc9))[_0x62ae('0x43')](handleError(_0x580d38,null));};exports[_0x62ae('0x4a')]=function(_0x4293a6,_0x2b273d){if(_0x4293a6['body']['id']){delete _0x4293a6[_0x62ae('0x49')]['id'];}return db[_0x62ae('0x3d')][_0x62ae('0x47')]({'where':{'id':_0x4293a6['params']['id']}})[_0x62ae('0x3e')](handleEntityNotFound(_0x2b273d,null))[_0x62ae('0x3e')](saveUpdates(_0x4293a6[_0x62ae('0x49')],null))['then'](respondWithResult(_0x2b273d,null))[_0x62ae('0x43')](handleError(_0x2b273d,null));};exports['destroy']=function(_0x1df073,_0x344329){return db[_0x62ae('0x3d')]['find']({'where':{'id':_0x1df073[_0x62ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x344329,null))[_0x62ae('0x3e')](removeEntity(_0x344329,null))[_0x62ae('0x43')](handleError(_0x344329,null));};exports['describe']=function(_0x49ead7,_0x5456a0){return db['OpenchannelTransferReport']['describe']()[_0x62ae('0x3e')](respondWithResult(_0x5456a0,null))['catch'](handleError(_0x5456a0,null));}; \ No newline at end of file +var _0x1d87=['bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','name','map','OpenchannelTransferReport','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','merge','VIRTUAL','filter','options','rows','show','params','includeAll','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3bdc60,_0x1097ed){var _0x3358a3=function(_0x3687f1){while(--_0x3687f1){_0x3bdc60['push'](_0x3bdc60['shift']());}};_0x3358a3(++_0x1097ed);}(_0x1d87,0x1a5));var _0x71d8=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0x1d87[_0x56b138];return _0x3df878;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71d8('0x0'));var zipdir=require(_0x71d8('0x1'));var jsonpatch=require(_0x71d8('0x2'));var rp=require(_0x71d8('0x3'));var moment=require(_0x71d8('0x4'));var BPromise=require(_0x71d8('0x5'));var Mustache=require(_0x71d8('0x6'));var util=require(_0x71d8('0x7'));var path=require('path');var sox=require(_0x71d8('0x8'));var csv=require('to-csv');var ejs=require(_0x71d8('0x9'));var fs=require('fs');var fs_extra=require(_0x71d8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x71d8('0xb'));var jsforce=require(_0x71d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x71d8('0xd'));var querystring=require(_0x71d8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x71d8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x71d8('0x10'));var hardwareService=require(_0x71d8('0x11'));var logger=require(_0x71d8('0x12'))(_0x71d8('0x13'));var utils=require(_0x71d8('0x14'));var config=require(_0x71d8('0x15'));var licenseUtil=require(_0x71d8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29fd8a,_0x4512e0){_0x4512e0=_0x4512e0||0xcc;return function(_0x5cfad7){if(_0x5cfad7){return _0x29fd8a['sendStatus'](_0x4512e0);}return _0x29fd8a[_0x71d8('0x17')](_0x4512e0)['end']();};}function respondWithResult(_0xb1763c,_0xaf3f32){_0xaf3f32=_0xaf3f32||0xc8;return function(_0x232c1c){if(_0x232c1c){return _0xb1763c[_0x71d8('0x17')](_0xaf3f32)[_0x71d8('0x18')](_0x232c1c);}};}function respondWithFilteredResult(_0x968a8e,_0x43f557){return function(_0x13ab88){if(_0x13ab88){var _0x21e9fb=typeof _0x43f557[_0x71d8('0x19')]===_0x71d8('0x1a')&&typeof _0x43f557[_0x71d8('0x1b')]===_0x71d8('0x1a');var _0x4fd2ea=_0x13ab88[_0x71d8('0x1c')];var _0x4f11a3=_0x21e9fb?0x0:_0x43f557[_0x71d8('0x19')];var _0x19f55e=_0x21e9fb?_0x13ab88[_0x71d8('0x1c')]:_0x43f557[_0x71d8('0x19')]+_0x43f557[_0x71d8('0x1b')];var _0x1f126f;if(_0x19f55e>=_0x4fd2ea){_0x19f55e=_0x4fd2ea;_0x1f126f=0xc8;}else{_0x1f126f=0xce;}_0x968a8e[_0x71d8('0x17')](_0x1f126f);return _0x968a8e[_0x71d8('0x1d')](_0x71d8('0x1e'),_0x4f11a3+'-'+_0x19f55e+'/'+_0x4fd2ea)[_0x71d8('0x18')](_0x13ab88);}return null;};}function patchUpdates(_0x3f9118){return function(_0x2b3014){try{jsonpatch['apply'](_0x2b3014,_0x3f9118,!![]);}catch(_0xf42e8c){return BPromise[_0x71d8('0x1f')](_0xf42e8c);}return _0x2b3014['save']();};}function saveUpdates(_0x367387,_0x3f10e){return function(_0x3706c8){if(_0x3706c8){return _0x3706c8[_0x71d8('0x20')](_0x367387)['then'](function(_0x6db3fb){return _0x6db3fb;});}return null;};}function removeEntity(_0x3f1cc5,_0x5060dc){return function(_0x5ea05f){if(_0x5ea05f){return _0x5ea05f[_0x71d8('0x21')]()[_0x71d8('0x22')](function(){_0x3f1cc5['status'](0xcc)[_0x71d8('0x23')]();});}};}function handleEntityNotFound(_0x1e59d6,_0x10c838){return function(_0x41e5e6){if(!_0x41e5e6){_0x1e59d6[_0x71d8('0x24')](0x194);}return _0x41e5e6;};}function handleError(_0x54de6f,_0x2cead2){_0x2cead2=_0x2cead2||0x1f4;return function(_0x3f1933){logger[_0x71d8('0x25')](_0x3f1933[_0x71d8('0x26')]);if(_0x3f1933[_0x71d8('0x27')]){delete _0x3f1933['name'];}_0x54de6f[_0x71d8('0x17')](_0x2cead2)['send'](_0x3f1933);};}exports['index']=function(_0x5b0c75,_0x3df063){var _0x2eebe4={},_0x3d20a9={},_0x7f18ff={'count':0x0,'rows':[]};var _0x10c50e=_[_0x71d8('0x28')](db[_0x71d8('0x29')][_0x71d8('0x2a')],function(_0x38dbb2){return{'name':_0x38dbb2['fieldName'],'type':_0x38dbb2[_0x71d8('0x2b')]['key']};});_0x3d20a9['model']=_[_0x71d8('0x28')](_0x10c50e,_0x71d8('0x27'));_0x3d20a9[_0x71d8('0x2c')]=_[_0x71d8('0x2d')](_0x5b0c75[_0x71d8('0x2c')]);_0x3d20a9['filters']=_[_0x71d8('0x2e')](_0x3d20a9[_0x71d8('0x2f')],_0x3d20a9[_0x71d8('0x2c')]);_0x2eebe4[_0x71d8('0x30')]=_[_0x71d8('0x2e')](_0x3d20a9['model'],qs[_0x71d8('0x31')](_0x5b0c75['query'][_0x71d8('0x31')]));_0x2eebe4[_0x71d8('0x30')]=_0x2eebe4[_0x71d8('0x30')][_0x71d8('0x32')]?_0x2eebe4[_0x71d8('0x30')]:_0x3d20a9[_0x71d8('0x2f')];if(!_0x5b0c75['query'][_0x71d8('0x33')](_0x71d8('0x34'))){_0x2eebe4['limit']=qs[_0x71d8('0x1b')](_0x5b0c75[_0x71d8('0x2c')][_0x71d8('0x1b')]);_0x2eebe4[_0x71d8('0x19')]=qs[_0x71d8('0x19')](_0x5b0c75[_0x71d8('0x2c')][_0x71d8('0x19')]);}_0x2eebe4[_0x71d8('0x35')]=qs['sort'](_0x5b0c75['query']['sort']);_0x2eebe4[_0x71d8('0x36')]=qs['filters'](_[_0x71d8('0x37')](_0x5b0c75['query'],_0x3d20a9[_0x71d8('0x38')]),_0x10c50e);if(_0x5b0c75[_0x71d8('0x2c')]['filter']){_0x2eebe4[_0x71d8('0x36')]=_[_0x71d8('0x39')](_0x2eebe4[_0x71d8('0x36')],{'$or':_[_0x71d8('0x28')](_0x10c50e,function(_0x4e862b){if(_0x4e862b[_0x71d8('0x2b')]!==_0x71d8('0x3a')){var _0x13c435={};_0x13c435[_0x4e862b[_0x71d8('0x27')]]={'$like':'%'+_0x5b0c75[_0x71d8('0x2c')][_0x71d8('0x3b')]+'%'};return _0x13c435;}})});}_0x2eebe4=_[_0x71d8('0x39')]({},_0x2eebe4,_0x5b0c75[_0x71d8('0x3c')]);var _0x46861f={'where':_0x2eebe4[_0x71d8('0x36')]};return db['OpenchannelTransferReport'][_0x71d8('0x1c')](_0x46861f)[_0x71d8('0x22')](function(_0x2c46d8){_0x7f18ff['count']=_0x2c46d8;if(_0x5b0c75[_0x71d8('0x2c')]['includeAll']){_0x2eebe4['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x2eebe4);})[_0x71d8('0x22')](function(_0x1ea408){_0x7f18ff[_0x71d8('0x3d')]=_0x1ea408;return _0x7f18ff;})['then'](respondWithFilteredResult(_0x3df063,_0x2eebe4))['catch'](handleError(_0x3df063,null));};exports[_0x71d8('0x3e')]=function(_0x15f018,_0x2deb25){var _0x2caf6e={'raw':!![],'where':{'id':_0x15f018[_0x71d8('0x3f')]['id']}},_0x105a53={};_0x105a53['model']=_[_0x71d8('0x2d')](db['OpenchannelTransferReport']['rawAttributes']);_0x105a53[_0x71d8('0x2c')]=_[_0x71d8('0x2d')](_0x15f018[_0x71d8('0x2c')]);_0x105a53[_0x71d8('0x38')]=_[_0x71d8('0x2e')](_0x105a53[_0x71d8('0x2f')],_0x105a53[_0x71d8('0x2c')]);_0x2caf6e[_0x71d8('0x30')]=_[_0x71d8('0x2e')](_0x105a53[_0x71d8('0x2f')],qs[_0x71d8('0x31')](_0x15f018[_0x71d8('0x2c')][_0x71d8('0x31')]));_0x2caf6e['attributes']=_0x2caf6e['attributes'][_0x71d8('0x32')]?_0x2caf6e[_0x71d8('0x30')]:_0x105a53[_0x71d8('0x2f')];if(_0x15f018['query'][_0x71d8('0x40')]){_0x2caf6e[_0x71d8('0x41')]=[{'all':!![]}];}_0x2caf6e=_[_0x71d8('0x39')]({},_0x2caf6e,_0x15f018['options']);return db[_0x71d8('0x29')][_0x71d8('0x42')](_0x2caf6e)['then'](handleEntityNotFound(_0x2deb25,null))['then'](respondWithResult(_0x2deb25,null))[_0x71d8('0x43')](handleError(_0x2deb25,null));};exports[_0x71d8('0x44')]=function(_0x4f17a6,_0xbc3ea1){return db[_0x71d8('0x29')][_0x71d8('0x44')](_0x4f17a6[_0x71d8('0x45')],{})[_0x71d8('0x22')](respondWithResult(_0xbc3ea1,0xc9))['catch'](handleError(_0xbc3ea1,null));};exports[_0x71d8('0x20')]=function(_0x9727d1,_0x3ec4ab){if(_0x9727d1[_0x71d8('0x45')]['id']){delete _0x9727d1[_0x71d8('0x45')]['id'];}return db[_0x71d8('0x29')]['find']({'where':{'id':_0x9727d1[_0x71d8('0x3f')]['id']}})[_0x71d8('0x22')](handleEntityNotFound(_0x3ec4ab,null))[_0x71d8('0x22')](saveUpdates(_0x9727d1[_0x71d8('0x45')],null))[_0x71d8('0x22')](respondWithResult(_0x3ec4ab,null))[_0x71d8('0x43')](handleError(_0x3ec4ab,null));};exports[_0x71d8('0x21')]=function(_0x362d9e,_0x5366d5){return db[_0x71d8('0x29')][_0x71d8('0x42')]({'where':{'id':_0x362d9e[_0x71d8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5366d5,null))[_0x71d8('0x22')](removeEntity(_0x5366d5,null))['catch'](handleError(_0x5366d5,null));};exports['describe']=function(_0x401813,_0x424996){return db[_0x71d8('0x29')][_0x71d8('0x46')]()['then'](respondWithResult(_0x424996,null))['catch'](handleError(_0x424996,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9af4504..6325a0d 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 _0x3f21=['exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x71763a,_0xfb6b80){var _0x4562df=function(_0x5ee596){while(--_0x5ee596){_0x71763a['push'](_0x71763a['shift']());}};_0x4562df(++_0xfb6b80);}(_0x3f21,0x86));var _0x13f2=function(_0x556993,_0x14badb){_0x556993=_0x556993-0x0;var _0x65c46f=_0x3f21[_0x556993];return _0x65c46f;};'use strict';var _=require('lodash');var util=require(_0x13f2('0x0'));var logger=require(_0x13f2('0x1'))('api');var moment=require(_0x13f2('0x2'));var BPromise=require(_0x13f2('0x3'));var rp=require(_0x13f2('0x4'));var fs=require('fs');var path=require(_0x13f2('0x5'));var rimraf=require(_0x13f2('0x6'));var config=require(_0x13f2('0x7'));var attributes=require(_0x13f2('0x8'));module[_0x13f2('0x9')]=function(_0x40c231,_0x153538){return _0x40c231[_0x13f2('0xa')](_0x13f2('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x13f2('0xc'),'fields':[_0x13f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c80=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes'];(function(_0x41c10a,_0x402241){var _0x45ce43=function(_0x1e3914){while(--_0x1e3914){_0x41c10a['push'](_0x41c10a['shift']());}};_0x45ce43(++_0x402241);}(_0x0c80,0xbb));var _0x00c8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0c80[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x00c8('0x0'));var util=require(_0x00c8('0x1'));var logger=require(_0x00c8('0x2'))(_0x00c8('0x3'));var moment=require(_0x00c8('0x4'));var BPromise=require(_0x00c8('0x5'));var rp=require(_0x00c8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00c8('0x7'));var config=require('../../config/environment');var attributes=require(_0x00c8('0x8'));module[_0x00c8('0x9')]=function(_0xd4792f,_0x57f90f){return _0xd4792f[_0x00c8('0xa')](_0x00c8('0xb'),attributes,{'tableName':_0x00c8('0xc'),'paranoid':![],'indexes':[{'name':_0x00c8('0xd'),'fields':[_0x00c8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a47e731..01a9df7 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 _0xeb0d=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x10b1bb,_0x2a5815){var _0x2d4e05=function(_0xc13643){while(--_0xc13643){_0x10b1bb['push'](_0x10b1bb['shift']());}};_0x2d4e05(++_0x2a5815);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x559adf,_0x5989cc){_0x559adf=_0x559adf-0x0;var _0x53f28f=_0xeb0d[_0x559adf];return _0x53f28f;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeb0('0x1'));var fs=require('fs');var Redis=require(_0xdeb0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x3'));var logger=require(_0xdeb0('0x4'))(_0xdeb0('0x5'));var config=require(_0xdeb0('0x6'));var jayson=require(_0xdeb0('0x7'));var client=jayson[_0xdeb0('0x8')][_0xdeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ebaa,_0x55ffce,_0x28a1a4){return new BPromise(function(_0x16b36b,_0x541d8b){return client[_0xdeb0('0xa')](_0x27ebaa,_0x28a1a4)[_0xdeb0('0xb')](function(_0x3336a6){logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,_0xdeb0('0xe'));logger[_0xdeb0('0xf')](_0xdeb0('0x10'),_0x55ffce,'request\x20sent',JSON['stringify'](_0x3336a6));if(_0x3336a6[_0xdeb0('0x11')]){if(_0x3336a6['error'][_0xdeb0('0x12')]===0x1f4){logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);return _0x541d8b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6['error'][_0xdeb0('0x13')]);return _0x16b36b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,'request\x20sent');_0x16b36b(_0x3336a6[_0xdeb0('0x14')]['message']);}})[_0xdeb0('0x15')](function(_0x473fb9){logger[_0xdeb0('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x55ffce,_0x473fb9);_0x541d8b(_0x473fb9);});});} \ No newline at end of file +var _0x423b=['bluebird','ioredis','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x4dbd20,_0x22eb96){var _0x5ebbe0=function(_0x45a3e3){while(--_0x45a3e3){_0x4dbd20['push'](_0x4dbd20['shift']());}};_0x5ebbe0(++_0x22eb96);}(_0x423b,0x12b));var _0xb423=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x423b[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var moment=require('moment');var BPromise=require(_0xb423('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb423('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb423('0x3'));var config=require(_0xb423('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb423('0x5')][_0xb423('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49eabb,_0x28947d,_0x573e95){return new BPromise(function(_0x4119d7,_0x3ac522){return client[_0xb423('0x7')](_0x49eabb,_0x573e95)[_0xb423('0x8')](function(_0x27dcf3){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x28947d,_0xb423('0x9'));logger[_0xb423('0xa')](_0xb423('0xb'),_0x28947d,_0xb423('0x9'),JSON[_0xb423('0xc')](_0x27dcf3));if(_0x27dcf3['error']){if(_0x27dcf3[_0xb423('0xd')][_0xb423('0xe')]===0x1f4){logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3[_0xb423('0xd')][_0xb423('0x10')]);return _0x3ac522(_0x27dcf3['error'][_0xb423('0x10')]);}logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3['error']['message']);return _0x4119d7(_0x27dcf3['error'][_0xb423('0x10')]);}else{logger[_0xb423('0x11')](_0xb423('0xf'),_0x28947d,'request\x20sent');_0x4119d7(_0x27dcf3[_0xb423('0x12')][_0xb423('0x10')]);}})[_0xb423('0x13')](function(_0x39edac){logger['error'](_0xb423('0xf'),_0x28947d,_0x39edac);_0x3ac522(_0x39edac);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c237099..43c7e6f 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 _0x740a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x740a,0x136));var _0xa740=function(_0x579626,_0x580b94){_0x579626=_0x579626-0x0;var _0x33268b=_0x740a[_0x579626];return _0x33268b;};'use strict';var multer=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa740('0x2'));var router=express[_0xa740('0x3')]();var fs_extra=require(_0xa740('0x4'));var auth=require(_0xa740('0x5'));var interaction=require(_0xa740('0x6'));var config=require(_0xa740('0x7'));var controller=require(_0xa740('0x8'));router[_0xa740('0x9')]('/',auth[_0xa740('0xa')](),controller[_0xa740('0xb')]);router['get']('/:id',auth[_0xa740('0xa')](),controller[_0xa740('0xc')]);router[_0xa740('0xd')]('/',auth[_0xa740('0xa')](),controller[_0xa740('0xe')]);router[_0xa740('0xf')](_0xa740('0x10'),auth['isAuthenticated'](),controller[_0xa740('0x11')]);router[_0xa740('0x12')]('/:id',auth[_0xa740('0xa')](),controller[_0xa740('0x13')]);module[_0xa740('0x14')]=router; \ No newline at end of file +var _0x4eb1=['util','path','connect-timeout','express','../../components/auth/service','./pause.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2a9fc4,_0x547d96){var _0x49738f=function(_0x48639a){while(--_0x48639a){_0x2a9fc4['push'](_0x2a9fc4['shift']());}};_0x49738f(++_0x547d96);}(_0x4eb1,0x71));var _0x14eb=function(_0x1dec8a,_0x2e4816){_0x1dec8a=_0x1dec8a-0x0;var _0x48c6ef=_0x4eb1[_0x1dec8a];return _0x48c6ef;};'use strict';var multer=require(_0x14eb('0x0'));var util=require(_0x14eb('0x1'));var path=require(_0x14eb('0x2'));var timeout=require(_0x14eb('0x3'));var express=require(_0x14eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x14eb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x14eb('0x6'));router[_0x14eb('0x7')]('/',auth[_0x14eb('0x8')](),controller[_0x14eb('0x9')]);router[_0x14eb('0x7')]('/:id',auth[_0x14eb('0x8')](),controller[_0x14eb('0xa')]);router[_0x14eb('0xb')]('/',auth['isAuthenticated'](),controller[_0x14eb('0xc')]);router[_0x14eb('0xd')](_0x14eb('0xe'),auth[_0x14eb('0x8')](),controller[_0x14eb('0xf')]);router[_0x14eb('0x10')](_0x14eb('0xe'),auth['isAuthenticated'](),controller[_0x14eb('0x11')]);module[_0x14eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f0d5f62..39ce475 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 _0xac27=['name','STRING','sequelize'];(function(_0x49fbc7,_0x48e974){var _0x1b14b2=function(_0x26a94d){while(--_0x26a94d){_0x49fbc7['push'](_0x49fbc7['shift']());}};_0x1b14b2(++_0x48e974);}(_0xac27,0x143));var _0x7ac2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xac27[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7ac2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7ac2('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x7ac2('0x2')]}}; \ No newline at end of file +var _0x417a=['exports','STRING','sequelize'];(function(_0x1744f4,_0x34e39){var _0x508288=function(_0x35ad3d){while(--_0x35ad3d){_0x1744f4['push'](_0x1744f4['shift']());}};_0x508288(++_0x34e39);}(_0x417a,0x7d));var _0xa417=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x417a[_0x57fa7e];return _0x320671;};'use strict';var Sequelize=require(_0xa417('0x0'));module[_0xa417('0x1')]={'name':{'type':Sequelize[_0xa417('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3c846c0..c400e17 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 _0x6278=['undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Pauses','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Pause','includeAll','include','findAll','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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(_0x3bbe43,_0x221dbf){var _0x300cd1=function(_0x5803d6){while(--_0x5803d6){_0x3bbe43['push'](_0x3bbe43['shift']());}};_0x300cd1(++_0x221dbf);}(_0x6278,0x91));var _0x8627=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0x6278[_0x1aae33];return _0x2e91e9;};'use strict';var emlformat=require(_0x8627('0x0'));var rimraf=require(_0x8627('0x1'));var zipdir=require(_0x8627('0x2'));var jsonpatch=require(_0x8627('0x3'));var rp=require(_0x8627('0x4'));var moment=require(_0x8627('0x5'));var BPromise=require(_0x8627('0x6'));var Mustache=require(_0x8627('0x7'));var util=require(_0x8627('0x8'));var path=require(_0x8627('0x9'));var sox=require(_0x8627('0xa'));var csv=require(_0x8627('0xb'));var ejs=require(_0x8627('0xc'));var fs=require('fs');var fs_extra=require(_0x8627('0xd'));var _=require(_0x8627('0xe'));var squel=require('squel');var crypto=require(_0x8627('0xf'));var jsforce=require(_0x8627('0x10'));var deskjs=require(_0x8627('0x11'));var toCsv=require(_0x8627('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8627('0x12'));var as=require(_0x8627('0x13'));var hardwareService=require(_0x8627('0x14'));var logger=require(_0x8627('0x15'))(_0x8627('0x16'));var utils=require(_0x8627('0x17'));var config=require(_0x8627('0x18'));var licenseUtil=require(_0x8627('0x19'));var db=require(_0x8627('0x1a'))['db'];function respondWithStatusCode(_0x42b9d6,_0x794796){_0x794796=_0x794796||0xcc;return function(_0x16eb99){if(_0x16eb99){return _0x42b9d6[_0x8627('0x1b')](_0x794796);}return _0x42b9d6['status'](_0x794796)['end']();};}function respondWithResult(_0xdd518d,_0x77fc11){_0x77fc11=_0x77fc11||0xc8;return function(_0x57607a){if(_0x57607a){return _0xdd518d[_0x8627('0x1c')](_0x77fc11)[_0x8627('0x1d')](_0x57607a);}};}function respondWithFilteredResult(_0x2e2bcd,_0x226593){return function(_0x3103cc){if(_0x3103cc){var _0x12529c=typeof _0x226593[_0x8627('0x1e')]===_0x8627('0x1f')&&typeof _0x226593[_0x8627('0x20')]===_0x8627('0x1f');var _0x1c269f=_0x3103cc[_0x8627('0x21')];var _0xdc04b1=_0x12529c?0x0:_0x226593['offset'];var _0xa74422=_0x12529c?_0x3103cc[_0x8627('0x21')]:_0x226593[_0x8627('0x1e')]+_0x226593[_0x8627('0x20')];var _0x43f28a;if(_0xa74422>=_0x1c269f){_0xa74422=_0x1c269f;_0x43f28a=0xc8;}else{_0x43f28a=0xce;}_0x2e2bcd[_0x8627('0x1c')](_0x43f28a);return _0x2e2bcd[_0x8627('0x22')](_0x8627('0x23'),_0xdc04b1+'-'+_0xa74422+'/'+_0x1c269f)[_0x8627('0x1d')](_0x3103cc);}return null;};}function patchUpdates(_0x125c93){return function(_0x241e79){try{jsonpatch[_0x8627('0x24')](_0x241e79,_0x125c93,!![]);}catch(_0x38a084){return BPromise[_0x8627('0x25')](_0x38a084);}return _0x241e79[_0x8627('0x26')]();};}function saveUpdates(_0x57ae09,_0x323199){return function(_0x4b514d){if(_0x4b514d){return _0x4b514d['update'](_0x57ae09)['then'](function(_0x466396){return _0x466396;});}return null;};}function removeEntity(_0x332485,_0xf2def3){return function(_0x2f2d24){if(_0x2f2d24){return _0x2f2d24[_0x8627('0x27')]()[_0x8627('0x28')](function(){var _0x488ce8=_0x2f2d24[_0x8627('0x29')]({'plain':!![]});var _0x32d084=_0x8627('0x2a');return db[_0x8627('0x2b')][_0x8627('0x27')]({'where':{'type':_0x32d084,'resourceId':_0x488ce8['id']}})[_0x8627('0x28')](function(){return _0x2f2d24;});})['then'](function(){_0x332485['status'](0xcc)[_0x8627('0x2c')]();});}};}function handleEntityNotFound(_0x465f48,_0x4e7d79){return function(_0x417db8){if(!_0x417db8){_0x465f48[_0x8627('0x1b')](0x194);}return _0x417db8;};}function handleError(_0x26a28c,_0x10d359){_0x10d359=_0x10d359||0x1f4;return function(_0x38c9af){logger['error'](_0x38c9af[_0x8627('0x2d')]);if(_0x38c9af[_0x8627('0x2e')]){delete _0x38c9af[_0x8627('0x2e')];}_0x26a28c[_0x8627('0x1c')](_0x10d359)[_0x8627('0x2f')](_0x38c9af);};}exports[_0x8627('0x30')]=function(_0x441028,_0x1f1194){var _0x4bf1c1={},_0x3a5c08={},_0x224cba={'count':0x0,'rows':[]};var _0x5f1de8=_['map'](db['Pause'][_0x8627('0x31')],function(_0x3ad346){return{'name':_0x3ad346[_0x8627('0x32')],'type':_0x3ad346['type'][_0x8627('0x33')]};});_0x3a5c08['model']=_[_0x8627('0x34')](_0x5f1de8,'name');_0x3a5c08['query']=_[_0x8627('0x35')](_0x441028[_0x8627('0x36')]);_0x3a5c08[_0x8627('0x37')]=_[_0x8627('0x38')](_0x3a5c08[_0x8627('0x39')],_0x3a5c08[_0x8627('0x36')]);_0x4bf1c1['attributes']=_[_0x8627('0x38')](_0x3a5c08[_0x8627('0x39')],qs[_0x8627('0x3a')](_0x441028['query'][_0x8627('0x3a')]));_0x4bf1c1[_0x8627('0x3b')]=_0x4bf1c1[_0x8627('0x3b')][_0x8627('0x3c')]?_0x4bf1c1[_0x8627('0x3b')]:_0x3a5c08[_0x8627('0x39')];if(!_0x441028[_0x8627('0x36')][_0x8627('0x3d')](_0x8627('0x3e'))){_0x4bf1c1['limit']=qs[_0x8627('0x20')](_0x441028[_0x8627('0x36')][_0x8627('0x20')]);_0x4bf1c1[_0x8627('0x1e')]=qs['offset'](_0x441028[_0x8627('0x36')][_0x8627('0x1e')]);}_0x4bf1c1[_0x8627('0x3f')]=qs[_0x8627('0x40')](_0x441028[_0x8627('0x36')][_0x8627('0x40')]);_0x4bf1c1[_0x8627('0x41')]=qs[_0x8627('0x37')](_[_0x8627('0x42')](_0x441028[_0x8627('0x36')],_0x3a5c08['filters']),_0x5f1de8);if(_0x441028[_0x8627('0x36')][_0x8627('0x43')]){_0x4bf1c1[_0x8627('0x41')]=_[_0x8627('0x44')](_0x4bf1c1[_0x8627('0x41')],{'$or':_['map'](_0x5f1de8,function(_0x196314){if(_0x196314[_0x8627('0x45')]!==_0x8627('0x46')){var _0x5d6b53={};_0x5d6b53[_0x196314[_0x8627('0x2e')]]={'$like':'%'+_0x441028[_0x8627('0x36')][_0x8627('0x43')]+'%'};return _0x5d6b53;}})});}_0x4bf1c1=_[_0x8627('0x44')]({},_0x4bf1c1,_0x441028[_0x8627('0x47')]);var _0x2715bf={'where':_0x4bf1c1[_0x8627('0x41')]};return db[_0x8627('0x48')][_0x8627('0x21')](_0x2715bf)[_0x8627('0x28')](function(_0x1c041a){_0x224cba[_0x8627('0x21')]=_0x1c041a;if(_0x441028[_0x8627('0x36')][_0x8627('0x49')]){_0x4bf1c1[_0x8627('0x4a')]=[{'all':!![]}];}return db[_0x8627('0x48')][_0x8627('0x4b')](_0x4bf1c1);})[_0x8627('0x28')](function(_0x1c79bb){_0x224cba['rows']=_0x1c79bb;return _0x224cba;})[_0x8627('0x28')](respondWithFilteredResult(_0x1f1194,_0x4bf1c1))[_0x8627('0x4c')](handleError(_0x1f1194,null));};exports['show']=function(_0x52620b,_0x5abf5f){var _0x4ea609={'raw':!![],'where':{'id':_0x52620b['params']['id']}},_0x3ea5fe={};_0x3ea5fe[_0x8627('0x39')]=_[_0x8627('0x35')](db[_0x8627('0x48')]['rawAttributes']);_0x3ea5fe[_0x8627('0x36')]=_[_0x8627('0x35')](_0x52620b[_0x8627('0x36')]);_0x3ea5fe[_0x8627('0x37')]=_['intersection'](_0x3ea5fe[_0x8627('0x39')],_0x3ea5fe[_0x8627('0x36')]);_0x4ea609[_0x8627('0x3b')]=_['intersection'](_0x3ea5fe['model'],qs[_0x8627('0x3a')](_0x52620b[_0x8627('0x36')]['fields']));_0x4ea609['attributes']=_0x4ea609['attributes'][_0x8627('0x3c')]?_0x4ea609[_0x8627('0x3b')]:_0x3ea5fe['model'];if(_0x52620b[_0x8627('0x36')][_0x8627('0x49')]){_0x4ea609[_0x8627('0x4a')]=[{'all':!![]}];}_0x4ea609=_[_0x8627('0x44')]({},_0x4ea609,_0x52620b[_0x8627('0x47')]);return db[_0x8627('0x48')][_0x8627('0x4d')](_0x4ea609)[_0x8627('0x28')](handleEntityNotFound(_0x5abf5f,null))[_0x8627('0x28')](respondWithResult(_0x5abf5f,null))[_0x8627('0x4c')](handleError(_0x5abf5f,null));};exports[_0x8627('0x4e')]=function(_0x2fedbe,_0x1b9756){return db[_0x8627('0x48')][_0x8627('0x4e')](_0x2fedbe['body'],{})[_0x8627('0x28')](function(_0x1713e7){var _0x261b26=_0x2fedbe[_0x8627('0x4f')][_0x8627('0x29')]({'plain':!![]});if(!_0x261b26)throw new Error(_0x8627('0x50'));if(_0x261b26[_0x8627('0x51')]===_0x8627('0x4f')){var _0x5db8a1=_0x1713e7[_0x8627('0x29')]({'plain':!![]});var _0x1dfd20=_0x8627('0x2a');return db[_0x8627('0x52')][_0x8627('0x4d')]({'where':{'name':_0x1dfd20,'userProfileId':_0x261b26[_0x8627('0x53')]},'raw':!![]})['then'](function(_0x2cdc45){if(_0x2cdc45&&_0x2cdc45['autoAssociation']===0x0){return db['UserProfileResource'][_0x8627('0x4e')]({'name':_0x5db8a1[_0x8627('0x2e')],'resourceId':_0x5db8a1['id'],'type':_0x2cdc45[_0x8627('0x2e')],'sectionId':_0x2cdc45['id']},{})[_0x8627('0x28')](function(){return _0x1713e7;});}else{return _0x1713e7;}})[_0x8627('0x4c')](function(_0x3b4e38){logger[_0x8627('0x54')](_0x8627('0x55'),_0x3b4e38);throw _0x3b4e38;});}return _0x1713e7;})[_0x8627('0x28')](respondWithResult(_0x1b9756,0xc9))[_0x8627('0x4c')](handleError(_0x1b9756,null));};exports[_0x8627('0x56')]=function(_0x2350e3,_0x5be47b){if(_0x2350e3[_0x8627('0x57')]['id']){delete _0x2350e3[_0x8627('0x57')]['id'];}return db[_0x8627('0x48')][_0x8627('0x4d')]({'where':{'id':_0x2350e3['params']['id']}})[_0x8627('0x28')](handleEntityNotFound(_0x5be47b,null))[_0x8627('0x28')](saveUpdates(_0x2350e3[_0x8627('0x57')],null))[_0x8627('0x28')](respondWithResult(_0x5be47b,null))[_0x8627('0x4c')](handleError(_0x5be47b,null));};exports[_0x8627('0x27')]=function(_0x35f93e,_0x249aaf){return db[_0x8627('0x48')]['find']({'where':{'id':_0x35f93e['params']['id']}})['then'](handleEntityNotFound(_0x249aaf,null))['then'](removeEntity(_0x249aaf,null))[_0x8627('0x4c')](handleError(_0x249aaf,null));}; \ No newline at end of file +var _0x885f=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','crypto'];(function(_0x607a79,_0x1af652){var _0x50d334=function(_0x157b24){while(--_0x157b24){_0x607a79['push'](_0x607a79['shift']());}};_0x50d334(++_0x1af652);}(_0x885f,0x1e1));var _0xf885=function(_0x43df87,_0x59bac7){_0x43df87=_0x43df87-0x0;var _0x49caaf=_0x885f[_0x43df87];return _0x49caaf;};'use strict';var emlformat=require(_0xf885('0x0'));var rimraf=require(_0xf885('0x1'));var zipdir=require(_0xf885('0x2'));var jsonpatch=require(_0xf885('0x3'));var rp=require('request-promise');var moment=require(_0xf885('0x4'));var BPromise=require(_0xf885('0x5'));var Mustache=require(_0xf885('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf885('0x7'));var csv=require('to-csv');var ejs=require(_0xf885('0x8'));var fs=require('fs');var fs_extra=require(_0xf885('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf885('0xa'));var jsforce=require(_0xf885('0xb'));var deskjs=require(_0xf885('0xc'));var toCsv=require(_0xf885('0xd'));var querystring=require(_0xf885('0xe'));var Papa=require(_0xf885('0xf'));var Redis=require(_0xf885('0x10'));var authService=require(_0xf885('0x11'));var qs=require(_0xf885('0x12'));var as=require(_0xf885('0x13'));var hardwareService=require(_0xf885('0x14'));var logger=require(_0xf885('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf885('0x16'));var db=require(_0xf885('0x17'))['db'];function respondWithStatusCode(_0x3c803d,_0x3e7522){_0x3e7522=_0x3e7522||0xcc;return function(_0x273c13){if(_0x273c13){return _0x3c803d[_0xf885('0x18')](_0x3e7522);}return _0x3c803d[_0xf885('0x19')](_0x3e7522)[_0xf885('0x1a')]();};}function respondWithResult(_0x58e03d,_0x25abb9){_0x25abb9=_0x25abb9||0xc8;return function(_0x1436fc){if(_0x1436fc){return _0x58e03d['status'](_0x25abb9)[_0xf885('0x1b')](_0x1436fc);}};}function respondWithFilteredResult(_0x11157b,_0x590ac0){return function(_0x5d6de9){if(_0x5d6de9){var _0x56c4d0=typeof _0x590ac0[_0xf885('0x1c')]==='undefined'&&typeof _0x590ac0[_0xf885('0x1d')]===_0xf885('0x1e');var _0x2b1033=_0x5d6de9['count'];var _0x5ef637=_0x56c4d0?0x0:_0x590ac0['offset'];var _0x458b59=_0x56c4d0?_0x5d6de9[_0xf885('0x1f')]:_0x590ac0['offset']+_0x590ac0[_0xf885('0x1d')];var _0x20b1ff;if(_0x458b59>=_0x2b1033){_0x458b59=_0x2b1033;_0x20b1ff=0xc8;}else{_0x20b1ff=0xce;}_0x11157b['status'](_0x20b1ff);return _0x11157b[_0xf885('0x20')](_0xf885('0x21'),_0x5ef637+'-'+_0x458b59+'/'+_0x2b1033)[_0xf885('0x1b')](_0x5d6de9);}return null;};}function patchUpdates(_0x2f13a2){return function(_0x46b0b0){try{jsonpatch[_0xf885('0x22')](_0x46b0b0,_0x2f13a2,!![]);}catch(_0x39a930){return BPromise['reject'](_0x39a930);}return _0x46b0b0[_0xf885('0x23')]();};}function saveUpdates(_0x263143,_0x3e8250){return function(_0x56a6f5){if(_0x56a6f5){return _0x56a6f5[_0xf885('0x24')](_0x263143)[_0xf885('0x25')](function(_0x27f4b1){return _0x27f4b1;});}return null;};}function removeEntity(_0x4efb0a,_0x41af91){return function(_0x12ff1d){if(_0x12ff1d){return _0x12ff1d['destroy']()[_0xf885('0x25')](function(){var _0x17277b=_0x12ff1d[_0xf885('0x26')]({'plain':!![]});var _0x35b00b='Pauses';return db[_0xf885('0x27')]['destroy']({'where':{'type':_0x35b00b,'resourceId':_0x17277b['id']}})['then'](function(){return _0x12ff1d;});})[_0xf885('0x25')](function(){_0x4efb0a[_0xf885('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b6cc,_0x235304){return function(_0x3f6d39){if(!_0x3f6d39){_0x36b6cc['sendStatus'](0x194);}return _0x3f6d39;};}function handleError(_0x464bbc,_0x1e1a95){_0x1e1a95=_0x1e1a95||0x1f4;return function(_0x1e680a){logger[_0xf885('0x28')](_0x1e680a[_0xf885('0x29')]);if(_0x1e680a[_0xf885('0x2a')]){delete _0x1e680a[_0xf885('0x2a')];}_0x464bbc[_0xf885('0x19')](_0x1e1a95)['send'](_0x1e680a);};}exports['index']=function(_0x396b50,_0x1f5bb1){var _0xc8ec1={},_0x3974e1={},_0x3dc6d9={'count':0x0,'rows':[]};var _0x187d4a=_[_0xf885('0x2b')](db[_0xf885('0x2c')][_0xf885('0x2d')],function(_0x4cd0a8){return{'name':_0x4cd0a8[_0xf885('0x2e')],'type':_0x4cd0a8[_0xf885('0x2f')][_0xf885('0x30')]};});_0x3974e1['model']=_[_0xf885('0x2b')](_0x187d4a,_0xf885('0x2a'));_0x3974e1[_0xf885('0x31')]=_[_0xf885('0x32')](_0x396b50[_0xf885('0x31')]);_0x3974e1[_0xf885('0x33')]=_[_0xf885('0x34')](_0x3974e1[_0xf885('0x35')],_0x3974e1[_0xf885('0x31')]);_0xc8ec1[_0xf885('0x36')]=_[_0xf885('0x34')](_0x3974e1[_0xf885('0x35')],qs[_0xf885('0x37')](_0x396b50[_0xf885('0x31')][_0xf885('0x37')]));_0xc8ec1[_0xf885('0x36')]=_0xc8ec1[_0xf885('0x36')][_0xf885('0x38')]?_0xc8ec1[_0xf885('0x36')]:_0x3974e1['model'];if(!_0x396b50[_0xf885('0x31')][_0xf885('0x39')](_0xf885('0x3a'))){_0xc8ec1[_0xf885('0x1d')]=qs[_0xf885('0x1d')](_0x396b50['query'][_0xf885('0x1d')]);_0xc8ec1[_0xf885('0x1c')]=qs['offset'](_0x396b50[_0xf885('0x31')]['offset']);}_0xc8ec1[_0xf885('0x3b')]=qs[_0xf885('0x3c')](_0x396b50[_0xf885('0x31')][_0xf885('0x3c')]);_0xc8ec1[_0xf885('0x3d')]=qs[_0xf885('0x33')](_[_0xf885('0x3e')](_0x396b50[_0xf885('0x31')],_0x3974e1[_0xf885('0x33')]),_0x187d4a);if(_0x396b50[_0xf885('0x31')][_0xf885('0x3f')]){_0xc8ec1['where']=_[_0xf885('0x40')](_0xc8ec1['where'],{'$or':_[_0xf885('0x2b')](_0x187d4a,function(_0x26aef5){if(_0x26aef5[_0xf885('0x2f')]!=='VIRTUAL'){var _0x15908b={};_0x15908b[_0x26aef5['name']]={'$like':'%'+_0x396b50[_0xf885('0x31')][_0xf885('0x3f')]+'%'};return _0x15908b;}})});}_0xc8ec1=_[_0xf885('0x40')]({},_0xc8ec1,_0x396b50[_0xf885('0x41')]);var _0x2b5d9a={'where':_0xc8ec1['where']};return db[_0xf885('0x2c')][_0xf885('0x1f')](_0x2b5d9a)[_0xf885('0x25')](function(_0x5efee5){_0x3dc6d9[_0xf885('0x1f')]=_0x5efee5;if(_0x396b50[_0xf885('0x31')][_0xf885('0x42')]){_0xc8ec1[_0xf885('0x43')]=[{'all':!![]}];}return db[_0xf885('0x2c')][_0xf885('0x44')](_0xc8ec1);})[_0xf885('0x25')](function(_0x175046){_0x3dc6d9['rows']=_0x175046;return _0x3dc6d9;})[_0xf885('0x25')](respondWithFilteredResult(_0x1f5bb1,_0xc8ec1))['catch'](handleError(_0x1f5bb1,null));};exports[_0xf885('0x45')]=function(_0x587748,_0x2f09cc){var _0x225edb={'raw':!![],'where':{'id':_0x587748['params']['id']}},_0x1a632f={};_0x1a632f[_0xf885('0x35')]=_[_0xf885('0x32')](db[_0xf885('0x2c')][_0xf885('0x2d')]);_0x1a632f[_0xf885('0x31')]=_[_0xf885('0x32')](_0x587748[_0xf885('0x31')]);_0x1a632f[_0xf885('0x33')]=_[_0xf885('0x34')](_0x1a632f['model'],_0x1a632f[_0xf885('0x31')]);_0x225edb[_0xf885('0x36')]=_['intersection'](_0x1a632f[_0xf885('0x35')],qs[_0xf885('0x37')](_0x587748[_0xf885('0x31')][_0xf885('0x37')]));_0x225edb[_0xf885('0x36')]=_0x225edb[_0xf885('0x36')][_0xf885('0x38')]?_0x225edb[_0xf885('0x36')]:_0x1a632f['model'];if(_0x587748[_0xf885('0x31')][_0xf885('0x42')]){_0x225edb[_0xf885('0x43')]=[{'all':!![]}];}_0x225edb=_[_0xf885('0x40')]({},_0x225edb,_0x587748[_0xf885('0x41')]);return db[_0xf885('0x2c')][_0xf885('0x46')](_0x225edb)['then'](handleEntityNotFound(_0x2f09cc,null))[_0xf885('0x25')](respondWithResult(_0x2f09cc,null))[_0xf885('0x47')](handleError(_0x2f09cc,null));};exports['create']=function(_0x3acc98,_0x418b45){return db[_0xf885('0x2c')][_0xf885('0x48')](_0x3acc98[_0xf885('0x49')],{})[_0xf885('0x25')](function(_0x5f2a04){var _0x332444=_0x3acc98['user'][_0xf885('0x26')]({'plain':!![]});if(!_0x332444)throw new Error(_0xf885('0x4a'));if(_0x332444[_0xf885('0x4b')]==='user'){var _0x2205ef=_0x5f2a04[_0xf885('0x26')]({'plain':!![]});var _0x1c947c=_0xf885('0x4c');return db['UserProfileSection'][_0xf885('0x46')]({'where':{'name':_0x1c947c,'userProfileId':_0x332444[_0xf885('0x4d')]},'raw':!![]})[_0xf885('0x25')](function(_0xf02fdb){if(_0xf02fdb&&_0xf02fdb[_0xf885('0x4e')]===0x0){return db[_0xf885('0x27')][_0xf885('0x48')]({'name':_0x2205ef['name'],'resourceId':_0x2205ef['id'],'type':_0xf02fdb['name'],'sectionId':_0xf02fdb['id']},{})[_0xf885('0x25')](function(){return _0x5f2a04;});}else{return _0x5f2a04;}})['catch'](function(_0x5079a0){logger[_0xf885('0x28')](_0xf885('0x4f'),_0x5079a0);throw _0x5079a0;});}return _0x5f2a04;})[_0xf885('0x25')](respondWithResult(_0x418b45,0xc9))[_0xf885('0x47')](handleError(_0x418b45,null));};exports[_0xf885('0x24')]=function(_0x168b17,_0x4149f1){if(_0x168b17[_0xf885('0x49')]['id']){delete _0x168b17[_0xf885('0x49')]['id'];}return db[_0xf885('0x2c')][_0xf885('0x46')]({'where':{'id':_0x168b17[_0xf885('0x50')]['id']}})[_0xf885('0x25')](handleEntityNotFound(_0x4149f1,null))['then'](saveUpdates(_0x168b17['body'],null))[_0xf885('0x25')](respondWithResult(_0x4149f1,null))['catch'](handleError(_0x4149f1,null));};exports[_0xf885('0x51')]=function(_0x2c4c54,_0x5f38bc){return db['Pause'][_0xf885('0x46')]({'where':{'id':_0x2c4c54[_0xf885('0x50')]['id']}})[_0xf885('0x25')](handleEntityNotFound(_0x5f38bc,null))[_0xf885('0x25')](removeEntity(_0x5f38bc,null))[_0xf885('0x47')](handleError(_0x5f38bc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6f32ad5..f8374b7 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x490c63,_0x2d2a){var _0x3aee6b=function(_0x2acd92){while(--_0x2acd92){_0x490c63['push'](_0x490c63['shift']());}};_0x3aee6b(++_0x2d2a);}(_0x814b,0x1a2));var _0xb814=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0x814b[_0xf3e4a0];return _0x43f1cc;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3247182..aa3cc44 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(_0x2a7f2b,_0x5e547e){var _0x2f8f09=function(_0x15562c){while(--_0x15562c){_0x2a7f2b['push'](_0x2a7f2b['shift']());}};_0x2f8f09(++_0x5e547e);}(_0xb10b,0x12a));var _0xbb10=function(_0x254c9e,_0xab8a1b){_0x254c9e=_0x254c9e-0x0;var _0x2d4cb6=_0xb10b[_0x254c9e];return _0x2d4cb6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x563742,_0xea3ffa){var _0x34400c=function(_0xeff2c1){while(--_0xeff2c1){_0x563742['push'](_0x563742['shift']());}};_0x34400c(++_0xea3ffa);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e3191,_0x47fe85){_0x5e3191=_0x5e3191-0x0;var _0xc8d5e6=_0xb10b[_0x5e3191];return _0xc8d5e6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e0bf6c6..90df68b 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 _0xc978=['isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x2e2a67,_0xda2d45){var _0x394c02=function(_0x27ad08){while(--_0x27ad08){_0x2e2a67['push'](_0x2e2a67['shift']());}};_0x394c02(++_0xda2d45);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0xa')]('/:id/download',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);var upload=multer({'storage':multer[_0x8c97('0x12')]({'destination':function(_0x3a34b2,_0x400eb6,_0x949a83){_0x949a83(null,path[_0x8c97('0x13')](config[_0x8c97('0x14')],_0x8c97('0x15')));},'filename':function(_0x5cf392,_0x44611a,_0x346274){_0x44611a['originalname']=_0x44611a[_0x8c97('0x16')][_0x8c97('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x346274(null,util['format'](_0x8c97('0x18'),path['basename'](_0x44611a['originalname'],path['extname'](_0x44611a[_0x8c97('0x16')])),Date[_0x8c97('0x19')](),path[_0x8c97('0x1a')](_0x44611a[_0x8c97('0x16')])));}})});router[_0x8c97('0x1b')]('/',upload[_0x8c97('0x1c')](_0x8c97('0x1d')),controller[_0x8c97('0x1e')]);router[_0x8c97('0x1b')]('/webhook',controller[_0x8c97('0x1f')]);router[_0x8c97('0x20')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x21')]);router[_0x8c97('0x22')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x22')]);module[_0x8c97('0x23')]=router; \ No newline at end of file +var _0x0ba7=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','diskStorage','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47b78c,_0x1b6295){var _0x230522=function(_0x3a26a4){while(--_0x3a26a4){_0x47b78c['push'](_0x47b78c['shift']());}};_0x230522(++_0x1b6295);}(_0x0ba7,0x16d));var _0x70ba=function(_0x475630,_0x2498b0){_0x475630=_0x475630-0x0;var _0x2569d2=_0x0ba7[_0x475630];return _0x2569d2;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),controller[_0x70ba('0xd')]);router[_0x70ba('0x9')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x9')]('/:id/download',auth[_0x70ba('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x70ba('0x10')]({'destination':function(_0x258604,_0xfc4de3,_0x3cf8ab){_0x3cf8ab(null,path['join'](config['root'],_0x70ba('0x11')));},'filename':function(_0x4a2c2e,_0xd6580e,_0x5e94c7){_0xd6580e[_0x70ba('0x12')]=_0xd6580e[_0x70ba('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e94c7(null,util[_0x70ba('0x13')]('%s-%s%s',path[_0x70ba('0x14')](_0xd6580e[_0x70ba('0x12')],path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])),Date[_0x70ba('0x16')](),path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])));}})});router[_0x70ba('0x17')]('/',upload[_0x70ba('0x18')](_0x70ba('0x19')),controller[_0x70ba('0x1a')]);router[_0x70ba('0x17')](_0x70ba('0xc'),controller[_0x70ba('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x1c')]);router[_0x70ba('0x1d')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x1d')]);module[_0x70ba('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 52c047b..530307e 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 _0x2dc1=['sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly','always','never'];(function(_0x1ad074,_0x40e717){var _0x2c98b4=function(_0x2ccaad){while(--_0x2ccaad){_0x1ad074['push'](_0x1ad074['shift']());}};_0x2c98b4(++_0x40e717);}(_0x2dc1,0xe4));var _0x12dc=function(_0x7f94f1,_0x5047b5){_0x7f94f1=_0x7f94f1-0x0;var _0x308b07=_0x2dc1[_0x7f94f1];return _0x308b07;};'use strict';var Sequelize=require(_0x12dc('0x0'));module[_0x12dc('0x1')]={'name':{'type':Sequelize[_0x12dc('0x2')]},'type':{'type':Sequelize[_0x12dc('0x3')](_0x12dc('0x4'),_0x12dc('0x5'))},'description':{'type':Sequelize[_0x12dc('0x6')]},'version':{'type':Sequelize[_0x12dc('0x6')]},'path':{'type':Sequelize[_0x12dc('0x2')],'comment':_0x12dc('0x7')},'active':{'type':Sequelize[_0x12dc('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x12dc('0x3')]('adminOnly',_0x12dc('0x9'),_0x12dc('0xa'),_0x12dc('0xb')),'defaultValue':_0x12dc('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x12dc('0x2')]},'adminUrl':{'type':Sequelize[_0x12dc('0x2')]},'agentUrl':{'type':Sequelize[_0x12dc('0x2')]},'scriptName':{'type':Sequelize[_0x12dc('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7851=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0xfc2040,_0x46b4b4){var _0x4a900b=function(_0x45de76){while(--_0x45de76){_0xfc2040['push'](_0xfc2040['shift']());}};_0x4a900b(++_0x46b4b4);}(_0x7851,0x90));var _0x1785=function(_0x4da8d5,_0x1777a6){_0x4da8d5=_0x4da8d5-0x0;var _0x56ed76=_0x7851[_0x4da8d5];return _0x56ed76;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1785('0x0')]},'type':{'type':Sequelize[_0x1785('0x1')](_0x1785('0x2'),_0x1785('0x3'))},'description':{'type':Sequelize[_0x1785('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x1785('0x5')},'active':{'type':Sequelize[_0x1785('0x6')],'defaultValue':0x0,'comment':_0x1785('0x7')},'sidebar':{'type':Sequelize[_0x1785('0x1')](_0x1785('0x8'),_0x1785('0x9'),_0x1785('0xa'),_0x1785('0xb')),'defaultValue':_0x1785('0xa'),'comment':_0x1785('0xc')},'icon':{'type':Sequelize[_0x1785('0x0')]},'adminUrl':{'type':Sequelize[_0x1785('0x0')]},'agentUrl':{'type':Sequelize[_0x1785('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1785('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0e82819..aa15d37 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 _0x5647=['to-csv','ejs','fs-extra','lodash','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','stack','name','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','download','join','server/files/plugins','format','%s.zip','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','fast-json-patch','moment','util','path','sox'];(function(_0x4e9f60,_0x142d5d){var _0x5a6863=function(_0x2034fa){while(--_0x2034fa){_0x4e9f60['push'](_0x4e9f60['shift']());}};_0x5a6863(++_0x142d5d);}(_0x5647,0xa0));var _0x7564=function(_0x1d31d4,_0x38e515){_0x1d31d4=_0x1d31d4-0x0;var _0x58aa03=_0x5647[_0x1d31d4];return _0x58aa03;};'use strict';var emlformat=require(_0x7564('0x0'));var rimraf=require(_0x7564('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7564('0x2'));var rp=require('request-promise');var moment=require(_0x7564('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7564('0x4'));var path=require(_0x7564('0x5'));var sox=require(_0x7564('0x6'));var csv=require(_0x7564('0x7'));var ejs=require(_0x7564('0x8'));var fs=require('fs');var fs_extra=require(_0x7564('0x9'));var _=require(_0x7564('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7564('0x7'));var querystring=require(_0x7564('0xb'));var Papa=require(_0x7564('0xc'));var extract=require(_0x7564('0xd'));var rimraf=require(_0x7564('0x1'));var archiver=require('archiver');var Redis=require(_0x7564('0xe'));var authService=require(_0x7564('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7564('0x10'));var hardwareService=require(_0x7564('0x11'));var logger=require(_0x7564('0x12'))(_0x7564('0x13'));var utils=require(_0x7564('0x14'));var config=require(_0x7564('0x15'));var licenseUtil=require(_0x7564('0x16'));var db=require(_0x7564('0x17'))['db'];config[_0x7564('0x18')]=_[_0x7564('0x19')](config[_0x7564('0x18')],{'host':_0x7564('0x1a'),'port':0x18eb});var socket=require(_0x7564('0x1b'))(new Redis(config[_0x7564('0x18')]));require('./plugin.socket')[_0x7564('0x1c')](socket);function respondWithStatusCode(_0x549ee5,_0x4bac46){_0x4bac46=_0x4bac46||0xcc;return function(_0x50ff59){if(_0x50ff59){return _0x549ee5[_0x7564('0x1d')](_0x4bac46);}return _0x549ee5[_0x7564('0x1e')](_0x4bac46)['end']();};}function respondWithResult(_0x1fe2b2,_0x545295){_0x545295=_0x545295||0xc8;return function(_0x20fd0a){if(_0x20fd0a){return _0x1fe2b2['status'](_0x545295)[_0x7564('0x1f')](_0x20fd0a);}};}function respondWithFilteredResult(_0xa45551,_0x3c7e98){return function(_0x47a8e6){if(_0x47a8e6){var _0x298bce=typeof _0x3c7e98[_0x7564('0x20')]===_0x7564('0x21')&&typeof _0x3c7e98[_0x7564('0x22')]===_0x7564('0x21');var _0x6efeee=_0x47a8e6[_0x7564('0x23')];var _0x54370=_0x298bce?0x0:_0x3c7e98[_0x7564('0x20')];var _0x2c9878=_0x298bce?_0x47a8e6[_0x7564('0x23')]:_0x3c7e98[_0x7564('0x20')]+_0x3c7e98['limit'];var _0x3a0ce7;if(_0x2c9878>=_0x6efeee){_0x2c9878=_0x6efeee;_0x3a0ce7=0xc8;}else{_0x3a0ce7=0xce;}_0xa45551[_0x7564('0x1e')](_0x3a0ce7);return _0xa45551[_0x7564('0x24')](_0x7564('0x25'),_0x54370+'-'+_0x2c9878+'/'+_0x6efeee)[_0x7564('0x1f')](_0x47a8e6);}return null;};}function patchUpdates(_0x45dd1c){return function(_0x1539e4){try{jsonpatch[_0x7564('0x26')](_0x1539e4,_0x45dd1c,!![]);}catch(_0x5d920d){return BPromise[_0x7564('0x27')](_0x5d920d);}return _0x1539e4['save']();};}function saveUpdates(_0x5e30ae,_0x4db1b6){return function(_0x304752){if(_0x304752){return _0x304752[_0x7564('0x28')](_0x5e30ae)[_0x7564('0x29')](function(_0x1de7a7){return _0x1de7a7;});}return null;};}function removeEntity(_0x5dbe67,_0xd02e58){return function(_0xf6b9f2){if(_0xf6b9f2){return _0xf6b9f2[_0x7564('0x2a')]()[_0x7564('0x29')](function(){var _0x3c9642=_0xf6b9f2[_0x7564('0x2b')]({'plain':!![]});var _0x417558='Plugins';return db[_0x7564('0x2c')][_0x7564('0x2a')]({'where':{'type':_0x417558,'resourceId':_0x3c9642['id']}})[_0x7564('0x29')](function(){return _0xf6b9f2;});})['then'](function(){_0x5dbe67[_0x7564('0x1e')](0xcc)[_0x7564('0x2d')]();});}};}function handleEntityNotFound(_0x1ac004,_0x14930a){return function(_0x1a3486){if(!_0x1a3486){_0x1ac004[_0x7564('0x1d')](0x194);}return _0x1a3486;};}function handleError(_0x55f6e8,_0x155a0c){_0x155a0c=_0x155a0c||0x1f4;return function(_0x2251b6){logger['error'](_0x2251b6[_0x7564('0x2e')]);if(_0x2251b6[_0x7564('0x2f')]){delete _0x2251b6['name'];}_0x55f6e8[_0x7564('0x1e')](_0x155a0c)['send'](_0x2251b6);};}exports['index']=function(_0x27a94c,_0x10ddc3){var _0x54d1f2={},_0x4cddd6={},_0x2a893a={'count':0x0,'rows':[]};var _0x4fd75b=_['map'](db[_0x7564('0x30')][_0x7564('0x31')],function(_0x13bac3){return{'name':_0x13bac3[_0x7564('0x32')],'type':_0x13bac3[_0x7564('0x33')][_0x7564('0x34')]};});_0x4cddd6[_0x7564('0x35')]=_[_0x7564('0x36')](_0x4fd75b,'name');_0x4cddd6['query']=_[_0x7564('0x37')](_0x27a94c[_0x7564('0x38')]);_0x4cddd6['filters']=_[_0x7564('0x39')](_0x4cddd6[_0x7564('0x35')],_0x4cddd6[_0x7564('0x38')]);_0x54d1f2[_0x7564('0x3a')]=_['intersection'](_0x4cddd6[_0x7564('0x35')],qs[_0x7564('0x3b')](_0x27a94c[_0x7564('0x38')][_0x7564('0x3b')]));_0x54d1f2[_0x7564('0x3a')]=_0x54d1f2['attributes'][_0x7564('0x3c')]?_0x54d1f2[_0x7564('0x3a')]:_0x4cddd6['model'];if(!_0x27a94c['query'][_0x7564('0x3d')](_0x7564('0x3e'))){_0x54d1f2[_0x7564('0x22')]=qs[_0x7564('0x22')](_0x27a94c['query']['limit']);_0x54d1f2[_0x7564('0x20')]=qs[_0x7564('0x20')](_0x27a94c['query']['offset']);}_0x54d1f2[_0x7564('0x3f')]=qs[_0x7564('0x40')](_0x27a94c[_0x7564('0x38')][_0x7564('0x40')]);_0x54d1f2[_0x7564('0x41')]=qs[_0x7564('0x42')](_['pick'](_0x27a94c[_0x7564('0x38')],_0x4cddd6[_0x7564('0x42')]),_0x4fd75b);if(_0x27a94c[_0x7564('0x38')][_0x7564('0x43')]){_0x54d1f2[_0x7564('0x41')]=_[_0x7564('0x44')](_0x54d1f2['where'],{'$or':_['map'](_0x4fd75b,function(_0x238132){if(_0x238132['type']!==_0x7564('0x45')){var _0x284dd9={};_0x284dd9[_0x238132[_0x7564('0x2f')]]={'$like':'%'+_0x27a94c[_0x7564('0x38')][_0x7564('0x43')]+'%'};return _0x284dd9;}})});}_0x54d1f2=_[_0x7564('0x44')]({},_0x54d1f2,_0x27a94c[_0x7564('0x46')]);var _0x2dec3b={'where':_0x54d1f2[_0x7564('0x41')]};return db['Plugin']['count'](_0x2dec3b)[_0x7564('0x29')](function(_0x4229e3){_0x2a893a['count']=_0x4229e3;if(_0x27a94c['query'][_0x7564('0x47')]){_0x54d1f2[_0x7564('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x7564('0x49')](_0x54d1f2);})['then'](function(_0x30386b){_0x2a893a[_0x7564('0x4a')]=_0x30386b;return _0x2a893a;})[_0x7564('0x29')](respondWithFilteredResult(_0x10ddc3,_0x54d1f2))[_0x7564('0x4b')](handleError(_0x10ddc3,null));};exports[_0x7564('0x4c')]=function(_0x4bb59a,_0x5b8a4a){var _0xc336ce={'raw':!![],'where':{'id':_0x4bb59a[_0x7564('0x4d')]['id']}},_0x5e08ff={};_0x5e08ff[_0x7564('0x35')]=_[_0x7564('0x37')](db[_0x7564('0x30')][_0x7564('0x31')]);_0x5e08ff[_0x7564('0x38')]=_['keys'](_0x4bb59a['query']);_0x5e08ff[_0x7564('0x42')]=_[_0x7564('0x39')](_0x5e08ff['model'],_0x5e08ff['query']);_0xc336ce['attributes']=_['intersection'](_0x5e08ff[_0x7564('0x35')],qs[_0x7564('0x3b')](_0x4bb59a[_0x7564('0x38')][_0x7564('0x3b')]));_0xc336ce[_0x7564('0x3a')]=_0xc336ce['attributes'][_0x7564('0x3c')]?_0xc336ce['attributes']:_0x5e08ff[_0x7564('0x35')];if(_0x4bb59a[_0x7564('0x38')][_0x7564('0x47')]){_0xc336ce['include']=[{'all':!![]}];}_0xc336ce=_[_0x7564('0x44')]({},_0xc336ce,_0x4bb59a[_0x7564('0x46')]);return db[_0x7564('0x30')]['find'](_0xc336ce)[_0x7564('0x29')](handleEntityNotFound(_0x5b8a4a,null))[_0x7564('0x29')](respondWithResult(_0x5b8a4a,null))[_0x7564('0x4b')](handleError(_0x5b8a4a,null));};exports[_0x7564('0x4e')]=function(_0x59ca6b,_0x46729a,_0x366a15){return db[_0x7564('0x30')]['find']({'where':{'id':_0x59ca6b[_0x7564('0x4d')]['id']},'attributes':[_0x7564('0x2f'),'path'],'raw':!![]})[_0x7564('0x29')](handleEntityNotFound(_0x46729a,null))['then'](function(_0x126c00){if(_0x126c00){var _0x44b346=path[_0x7564('0x4f')](config['root'],_0x7564('0x50'),util[_0x7564('0x51')](_0x7564('0x52'),path['basename'](_0x126c00[_0x7564('0x5')])));var _0x5a6c3e=fs['createWriteStream'](_0x44b346);var _0x137231=archiver('zip',{'zlib':{'level':0x9}});_0x137231['on']('warning',function(_0x4ecc64){if(_0x4ecc64['code']===_0x7564('0x53')){logger[_0x7564('0x54')](_0x4ecc64);}else{throw new db['Sequelize'][(_0x7564('0x55'))](_0x7564('0x56'));}});_0x137231['on'](_0x7564('0x54'),function(_0x4cf003){throw new db['Sequelize'][(_0x7564('0x55'))](_0x7564('0x56'));});_0x137231['pipe'](_0x5a6c3e);_0x137231[_0x7564('0x57')](_0x7564('0x58'),{'cwd':path[_0x7564('0x4f')](config[_0x7564('0x59')],_0x7564('0x50'),path[_0x7564('0x5a')](_0x126c00[_0x7564('0x5')])),'ignore':[path[_0x7564('0x4f')](path[_0x7564('0x5b')](_0x126c00[_0x7564('0x5')]),_0x7564('0x5c')),path['join'](path[_0x7564('0x5b')](_0x126c00[_0x7564('0x5')]),_0x7564('0x5d'))],'nodir':!![]})[_0x7564('0x5e')]();_0x5a6c3e['on'](_0x7564('0x5f'),function(){if(!fs[_0x7564('0x60')](_0x44b346)){throw new db[(_0x7564('0x61'))][(_0x7564('0x55'))]('Plugin\x20not\x20found');}return _0x46729a[_0x7564('0x4e')](_0x44b346,util[_0x7564('0x51')](_0x7564('0x52'),path['basename'](_0x126c00[_0x7564('0x5')])),function(_0x56d98a){if(_0x56d98a){throw new db[(_0x7564('0x61'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x7564('0x62')](_0x44b346);logger[_0x7564('0x63')]('Download\x20completed');logger[_0x7564('0x63')](_0x7564('0x64'));});});}return null;})[_0x7564('0x4b')](handleError(_0x46729a,null));};exports[_0x7564('0x65')]=function(_0x25b005,_0x5d3c07,_0x539fd6){var _0x1f6e64=path['basename'](_0x25b005['file']['filename'],path[_0x7564('0x66')](_0x25b005['file']['filename']));var _0x4dcaa0=path[_0x7564('0x4f')](config[_0x7564('0x59')],'server/files/plugins',_0x25b005[_0x7564('0x67')]['filename']);var _0x2aa337=path[_0x7564('0x4f')](config['root'],_0x7564('0x50'),_0x1f6e64);logger[_0x7564('0x63')](_0x7564('0x68'),_0x4dcaa0);logger[_0x7564('0x63')](_0x7564('0x69'),_0x2aa337);try{fs[_0x7564('0x6a')](_0x4dcaa0,parseInt(_0x7564('0x6b'),0x8));extract(_0x4dcaa0,{'dir':_0x2aa337},function(_0x24c369){if(_0x24c369){logger[_0x7564('0x54')](_0x24c369);handleError(_0x24c369,!![]);};var _0x472817=fs[_0x7564('0x6c')](_0x2aa337);if(_0x472817[_0x7564('0x3c')]>0x1){removeReferences(_0x4dcaa0,_0x2aa337);logger[_0x7564('0x54')](_0x7564('0x6d'));return _0x539fd6(new Error(_0x7564('0x6d')));}var _0x453d83=fs[_0x7564('0x6e')](path[_0x7564('0x4f')](_0x2aa337,_0x472817[0x0]));if(_0x453d83['isFile']()){removeReferences(_0x4dcaa0,_0x2aa337);logger[_0x7564('0x54')](_0x7564('0x6d'));return _0x539fd6(new Error(_0x7564('0x6d')));}if(_0x453d83[_0x7564('0x6f')]()){var _0x2d2380=fs[_0x7564('0x6c')](path[_0x7564('0x4f')](_0x2aa337,_0x472817[0x0]));if(_0x2d2380[_0x7564('0x3c')]===0x0){removeReferences(_0x4dcaa0,_0x2aa337);logger[_0x7564('0x54')](_0x7564('0x6d'));return _0x539fd6(new Error(_0x7564('0x6d')));}var _0xd0802e=_0x2d2380[_0x7564('0x70')](function(_0x2c415e){return _0x2c415e===_0x7564('0x71');});if(!_0xd0802e){return _0x539fd6(new Error(_0x7564('0x72')));}var _0x4e39ec=fs[_0x7564('0x73')](path[_0x7564('0x4f')](_0x2aa337,_0x472817[0x0],_0x7564('0x71')));var _0x4c3521=JSON[_0x7564('0x74')](_0x4e39ec);if(_0x7564('0x21')==typeof _0x4c3521[_0x7564('0x2f')]){return _0x539fd6(new Error(_0x7564('0x75')));}if(_0x7564('0x21')==typeof _0x4c3521['type']){return _0x539fd6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4c3521[_0x7564('0x76')]){return _0x539fd6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x7564('0x21')==typeof _0x4c3521[_0x7564('0x77')]){return _0x539fd6(new Error(_0x7564('0x78')));}if(_0x4c3521[_0x7564('0x33')]===_0x7564('0x79')){if('undefined'==typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')]){return _0x539fd6(new Error(_0x7564('0x7b')));}if(_0x7564('0x21')==typeof _0x4c3521[_0x7564('0x77')]['views'][_0x7564('0x7c')]&&'undefined'==typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7d')]){return _0x539fd6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4c3521[_0x7564('0x33')]===_0x7564('0x7e')){if(_0x7564('0x21')==typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7f')]){return _0x539fd6(new Error(_0x7564('0x80')));}if(_0x7564('0x21')==typeof _0x4c3521[_0x7564('0x77')]['scriptPath']){return _0x539fd6(new Error(_0x7564('0x81')));}}else{return _0x539fd6(new Error(_0x7564('0x82')));}var _0x4d43b1=_0x4c3521[_0x7564('0x2f')];var _0x5c73df=_0x4c3521['description'];var _0x461289=_0x4c3521['type'];var _0x1d93ac=_0x4c3521['sidebar']?_0x4c3521[_0x7564('0x83')]:_0x7564('0x84');var _0x310f74=_0x4c3521[_0x7564('0x85')]?_0x4c3521[_0x7564('0x85')]:_0x7564('0x86');var _0x58d11d='';var _0x377782='';var _0x2837b6='';var _0x37a7b4='';var _0x3f8751=_0x4c3521[_0x7564('0x76')];if(_0x461289===_0x7564('0x79')){if(_0x7564('0x21')!=typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7c')]){var _0x5b0371=_0x4c3521['parameters'][_0x7564('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b0371)){_0x58d11d=path[_0x7564('0x4f')](_0x7564('0x87'),_0x1f6e64,_0x472817[0x0],_0x5b0371);}else{_0x58d11d=_0x5b0371;}}else{logger[_0x7564('0x63')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7564('0x21')!=typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7d')]){var _0x547189=_0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7564('0x88')](_0x547189)){_0x377782=path[_0x7564('0x4f')](_0x7564('0x87'),_0x1f6e64,_0x472817[0x0],_0x547189);}else{_0x377782=_0x547189;}}else{logger['info'](_0x7564('0x89'));}}else if(_0x461289===_0x7564('0x7e')){_0x2837b6=_0x4c3521[_0x7564('0x77')][_0x7564('0x7f')];_0x37a7b4=_0x4c3521[_0x7564('0x77')][_0x7564('0x8a')];if('undefined'!=typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')]){if(_0x7564('0x21')!=typeof _0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7c')]){var _0x5b0371=_0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x7564('0x88')](_0x5b0371)){_0x58d11d=path[_0x7564('0x4f')](_0x7564('0x87'),_0x1f6e64,_0x472817[0x0],_0x5b0371);}else{_0x58d11d=_0x5b0371;}}if(_0x7564('0x21')!=typeof _0x4c3521['parameters'][_0x7564('0x7a')][_0x7564('0x7d')]){var _0x547189=_0x4c3521[_0x7564('0x77')][_0x7564('0x7a')][_0x7564('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7564('0x88')](_0x547189)){_0x377782=path[_0x7564('0x4f')](_0x7564('0x87'),_0x1f6e64,_0x472817[0x0],_0x547189);}else{_0x377782=_0x547189;}}}}var _0x436a78={'name':_0x4d43b1,'description':_0x5c73df,'path':path['join'](_0x1f6e64,_0x472817[0x0]),'type':_0x461289,'sidebar':_0x1d93ac,'icon':_0x310f74,'adminUrl':_0x58d11d,'agentUrl':_0x377782,'scriptName':_0x2837b6,'scriptPath':_0x37a7b4,'version':_0x3f8751};removeReferences(_0x4dcaa0,null);return db['Plugin'][_0x7564('0x8b')](_0x436a78)[_0x7564('0x29')](function(_0x4f788c){var _0x1c198b={'role':_0x25b005[_0x7564('0x8c')]['role'],'userProfileId':_0x25b005['body'][_0x7564('0x8d')]};if(!_0x1c198b)throw new Error(_0x7564('0x8e'));if(_0x1c198b[_0x7564('0x8f')]===_0x7564('0x90')){var _0x2e7cfd=_0x4f788c[_0x7564('0x2b')]({'plain':!![]});return db[_0x7564('0x91')][_0x7564('0x92')]({'where':{'name':_0x7564('0x93'),'userProfileId':_0x1c198b[_0x7564('0x8d')]},'raw':!![]})[_0x7564('0x29')](function(_0x197558){if(_0x197558&&_0x197558[_0x7564('0x94')]===0x0){return db['UserProfileResource'][_0x7564('0x8b')]({'name':_0x2e7cfd[_0x7564('0x2f')],'resourceId':_0x2e7cfd['id'],'type':_0x197558[_0x7564('0x2f')],'sectionId':_0x197558['id']},{})[_0x7564('0x29')](function(){return _0x4f788c;});}else{return _0x4f788c;}})[_0x7564('0x4b')](function(_0x3c4528){logger[_0x7564('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c4528);throw _0x3c4528;});}return _0x4f788c;})['then'](respondWithResult(_0x5d3c07,null))[_0x7564('0x4b')](handleError(_0x5d3c07,null));}});}catch(_0x381aa6){_0x5d3c07[_0x7564('0x1e')](0x1f4)['send'](_0x381aa6);}};function removeReferences(_0x9a011e,_0x990eb1){try{if(_0x9a011e){fs[_0x7564('0x62')](_0x9a011e);logger[_0x7564('0x63')](_0x7564('0x95'));}if(_0x990eb1){rimraf(_0x990eb1,function(){});logger[_0x7564('0x63')](_0x7564('0x96'));}}catch(_0x6e18d){logger[_0x7564('0x54')](_0x6e18d);}}exports[_0x7564('0x28')]=function(_0x26cdf4,_0x954410,_0x1fa5e3){return db[_0x7564('0x30')]['find']({'where':{'id':_0x26cdf4[_0x7564('0x4d')]['id']}})[_0x7564('0x29')](handleEntityNotFound(_0x954410,null))[_0x7564('0x29')](saveUpdates(_0x26cdf4[_0x7564('0x8c')],null))[_0x7564('0x29')](respondWithResult(_0x954410,null))[_0x7564('0x4b')](handleError(_0x954410,null));};exports['delete']=function(_0x2d74b6,_0x2a4260,_0x2a6996){return db[_0x7564('0x30')]['find']({'where':{'id':_0x2d74b6['params']['id']}})[_0x7564('0x29')](function(_0x5cf634){if(_0x5cf634){return _0x5cf634[_0x7564('0x2a')]();}})[_0x7564('0x29')](function(_0x49c750){rimraf(path[_0x7564('0x4f')](config[_0x7564('0x59')],_0x7564('0x50'),path[_0x7564('0x5a')](_0x49c750[_0x7564('0x5')])),function(){});return _0x49c750;})[_0x7564('0x29')](handleEntityNotFound(_0x2a4260,null))['then'](respondWithStatusCode(_0x2a4260,null))[_0x7564('0x4b')](handleError(_0x2a4260,null));};exports[_0x7564('0x97')]=function(_0x35ef51,_0xcaf882,_0x5439a2){return BPromise[_0x7564('0x98')]()[_0x7564('0x29')](function(){if(!_0x35ef51[_0x7564('0x38')][_0x7564('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x35ef51[_0x7564('0x38')]['port']){throw new Error(_0x7564('0x99'));}var _0x543c4b=_0x35ef51[_0x7564('0x38')]['hostname']?_0x35ef51[_0x7564('0x38')][_0x7564('0x9a')]+':'+_0x35ef51['query'][_0x7564('0x9b')]:_0x7564('0x9c')+_0x35ef51[_0x7564('0x38')][_0x7564('0x9b')];var _0x3f88a4=_0x35ef51['query']['json']?_0x35ef51[_0x7564('0x38')][_0x7564('0x1f')]:!![];var _0xf4e5fd=_0x35ef51[_0x7564('0x38')][_0x7564('0x9d')]?_0x35ef51[_0x7564('0x38')][_0x7564('0x9d')]:null;var _0x4ceb55={'method':_0x35ef51[_0x7564('0x9e')],'uri':util[_0x7564('0x51')]('%s%s',_0x543c4b,_0x35ef51['query'][_0x7564('0x5')]),'json':_0x3f88a4,'resolveWithFullResponse':!![],'encoding':_0xf4e5fd,'qs':_0x35ef51[_0x7564('0x38')]};if(_0x35ef51[_0x7564('0x9f')]){_0x4ceb55[_0x7564('0x9f')]=_0x35ef51['headers'];if(_0x4ceb55[_0x7564('0x9f')]['content-length']){delete _0x4ceb55[_0x7564('0x9f')][_0x7564('0xa0')];}}if(_0x4ceb55[_0x7564('0x9f')]['content-type']){delete _0x4ceb55[_0x7564('0x9f')][_0x7564('0xa1')];}return rp(_0x4ceb55);})['then'](function(_0x19463f){if(_0x19463f){_0xcaf882['set'](_0x19463f[_0x7564('0x9f')]);logger['info'](_0x19463f[_0x7564('0x8c')]);if(_[_0x7564('0xa2')](_0x35ef51[_0x7564('0x38')][_0x7564('0x5')],_0x7564('0x4e'))&&_0x19463f['statusCode']==0x1f4){return _0xcaf882[_0x7564('0x1d')](_0x19463f['statusCode']);}else{return _0xcaf882[_0x7564('0x1e')](_0x19463f[_0x7564('0xa3')])[_0x7564('0xa4')](_0x19463f['body']);}}else{return _0xcaf882[_0x7564('0x1d')](0xc8);}})[_0x7564('0x4b')](handleError(_0xcaf882,null));};exports[_0x7564('0xa5')]=function(_0x5eb1d2,_0x55e499,_0x1f6a2b){return BPromise[_0x7564('0x98')]()['then'](function(){if(!_0x5eb1d2[_0x7564('0x38')][_0x7564('0x5')]){throw new Error(_0x7564('0xa6'));}if(!_0x5eb1d2[_0x7564('0x38')][_0x7564('0x9b')]){throw new Error(_0x7564('0x99'));}var _0x216519=_0x5eb1d2['query'][_0x7564('0x9a')]?_0x5eb1d2[_0x7564('0x38')][_0x7564('0x9a')]+':'+_0x5eb1d2[_0x7564('0x38')][_0x7564('0x9b')]:'http://localhost:'+_0x5eb1d2[_0x7564('0x38')]['port'];var _0xd3d919=_0x5eb1d2[_0x7564('0x38')][_0x7564('0x1f')]?_0x5eb1d2[_0x7564('0x38')][_0x7564('0x1f')]:!![];var _0x2d7217=_0x5eb1d2[_0x7564('0x38')][_0x7564('0x9d')]?_0x5eb1d2[_0x7564('0x38')][_0x7564('0x9d')]:null;var _0x2bff54={'method':_0x5eb1d2[_0x7564('0x9e')],'uri':util['format']('%s%s',_0x216519,_0x5eb1d2['query']['path']),'json':_0xd3d919,'resolveWithFullResponse':!![],'encoding':_0x2d7217,'body':_0x5eb1d2[_0x7564('0x8c')]};if(_0x5eb1d2[_0x7564('0x9f')]){_0x2bff54[_0x7564('0x9f')]=_0x5eb1d2['headers'];if(_0x2bff54['headers'][_0x7564('0xa0')]){delete _0x2bff54[_0x7564('0x9f')]['content-length'];}}if(_0x2bff54[_0x7564('0x9f')][_0x7564('0xa1')]){delete _0x2bff54[_0x7564('0x9f')][_0x7564('0xa1')];}return rp(_0x2bff54);})['then'](function(_0x14e10c){if(_0x14e10c){_0x55e499[_0x7564('0x24')](_0x14e10c[_0x7564('0x9f')]);logger['info'](_0x14e10c['body']);return _0x55e499[_0x7564('0x1e')](_0x14e10c[_0x7564('0xa3')])[_0x7564('0xa4')](_0x14e10c['body']);}else{return _0x55e499[_0x7564('0x1d')](0xc8);}})[_0x7564('0x4b')](handleError(_0x55e499,null));}; \ No newline at end of file +var _0x88a2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','then','get','Plugins','UserProfileResource','destroy','error','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','server/files/plugins','dirname','attachments/**/*','finalize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create'];(function(_0x245d53,_0x132e3a){var _0x39436c=function(_0x54fc13){while(--_0x54fc13){_0x245d53['push'](_0x245d53['shift']());}};_0x39436c(++_0x132e3a);}(_0x88a2,0xb6));var _0x288a=function(_0x2540a6,_0x291ec2){_0x2540a6=_0x2540a6-0x0;var _0x4a8786=_0x88a2[_0x2540a6];return _0x4a8786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x288a('0x0'));var zipdir=require(_0x288a('0x1'));var jsonpatch=require(_0x288a('0x2'));var rp=require(_0x288a('0x3'));var moment=require(_0x288a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x288a('0x5'));var util=require(_0x288a('0x6'));var path=require(_0x288a('0x7'));var sox=require(_0x288a('0x8'));var csv=require(_0x288a('0x9'));var ejs=require(_0x288a('0xa'));var fs=require('fs');var fs_extra=require(_0x288a('0xb'));var _=require(_0x288a('0xc'));var squel=require(_0x288a('0xd'));var crypto=require('crypto');var jsforce=require(_0x288a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x288a('0x9'));var querystring=require(_0x288a('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x288a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x288a('0x11'));var as=require(_0x288a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x288a('0x13'));var config=require(_0x288a('0x14'));var licenseUtil=require(_0x288a('0x15'));var db=require(_0x288a('0x16'))['db'];config[_0x288a('0x17')]=_[_0x288a('0x18')](config['redis'],{'host':_0x288a('0x19'),'port':0x18eb});var socket=require(_0x288a('0x1a'))(new Redis(config[_0x288a('0x17')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x509b56,_0x1b85cd){_0x1b85cd=_0x1b85cd||0xcc;return function(_0x2d3349){if(_0x2d3349){return _0x509b56[_0x288a('0x1b')](_0x1b85cd);}return _0x509b56[_0x288a('0x1c')](_0x1b85cd)[_0x288a('0x1d')]();};}function respondWithResult(_0x189ec8,_0x52e63b){_0x52e63b=_0x52e63b||0xc8;return function(_0x141d04){if(_0x141d04){return _0x189ec8[_0x288a('0x1c')](_0x52e63b)['json'](_0x141d04);}};}function respondWithFilteredResult(_0x421e1c,_0x3ff499){return function(_0x53d82e){if(_0x53d82e){var _0x55b658=typeof _0x3ff499[_0x288a('0x1e')]===_0x288a('0x1f')&&typeof _0x3ff499[_0x288a('0x20')]==='undefined';var _0x404203=_0x53d82e[_0x288a('0x21')];var _0x4aec08=_0x55b658?0x0:_0x3ff499[_0x288a('0x1e')];var _0x566762=_0x55b658?_0x53d82e[_0x288a('0x21')]:_0x3ff499['offset']+_0x3ff499[_0x288a('0x20')];var _0xd445d3;if(_0x566762>=_0x404203){_0x566762=_0x404203;_0xd445d3=0xc8;}else{_0xd445d3=0xce;}_0x421e1c[_0x288a('0x1c')](_0xd445d3);return _0x421e1c['set']('Content-Range',_0x4aec08+'-'+_0x566762+'/'+_0x404203)['json'](_0x53d82e);}return null;};}function patchUpdates(_0xc46b72){return function(_0x43893b){try{jsonpatch[_0x288a('0x22')](_0x43893b,_0xc46b72,!![]);}catch(_0x2179b0){return BPromise[_0x288a('0x23')](_0x2179b0);}return _0x43893b[_0x288a('0x24')]();};}function saveUpdates(_0x1c6dc3,_0x93ba8d){return function(_0x5b2b7e){if(_0x5b2b7e){return _0x5b2b7e['update'](_0x1c6dc3)[_0x288a('0x25')](function(_0x258b48){return _0x258b48;});}return null;};}function removeEntity(_0x22492e,_0x47a277){return function(_0x36182c){if(_0x36182c){return _0x36182c['destroy']()[_0x288a('0x25')](function(){var _0x1a030c=_0x36182c[_0x288a('0x26')]({'plain':!![]});var _0x47f41c=_0x288a('0x27');return db[_0x288a('0x28')][_0x288a('0x29')]({'where':{'type':_0x47f41c,'resourceId':_0x1a030c['id']}})['then'](function(){return _0x36182c;});})['then'](function(){_0x22492e['status'](0xcc)[_0x288a('0x1d')]();});}};}function handleEntityNotFound(_0x2613e0,_0x237617){return function(_0xcaf0ac){if(!_0xcaf0ac){_0x2613e0['sendStatus'](0x194);}return _0xcaf0ac;};}function handleError(_0x3b2cd3,_0x43f0f5){_0x43f0f5=_0x43f0f5||0x1f4;return function(_0x2dd899){logger[_0x288a('0x2a')](_0x2dd899['stack']);if(_0x2dd899[_0x288a('0x2b')]){delete _0x2dd899[_0x288a('0x2b')];}_0x3b2cd3[_0x288a('0x1c')](_0x43f0f5)[_0x288a('0x2c')](_0x2dd899);};}exports['index']=function(_0x3adf90,_0x3037cf){var _0x672866={},_0x1ceab8={},_0x3f8ef9={'count':0x0,'rows':[]};var _0x2447e2=_['map'](db['Plugin'][_0x288a('0x2d')],function(_0x3a6ac5){return{'name':_0x3a6ac5[_0x288a('0x2e')],'type':_0x3a6ac5['type'][_0x288a('0x2f')]};});_0x1ceab8[_0x288a('0x30')]=_[_0x288a('0x31')](_0x2447e2,_0x288a('0x2b'));_0x1ceab8[_0x288a('0x32')]=_[_0x288a('0x33')](_0x3adf90[_0x288a('0x32')]);_0x1ceab8[_0x288a('0x34')]=_[_0x288a('0x35')](_0x1ceab8[_0x288a('0x30')],_0x1ceab8[_0x288a('0x32')]);_0x672866[_0x288a('0x36')]=_[_0x288a('0x35')](_0x1ceab8[_0x288a('0x30')],qs[_0x288a('0x37')](_0x3adf90[_0x288a('0x32')][_0x288a('0x37')]));_0x672866[_0x288a('0x36')]=_0x672866[_0x288a('0x36')][_0x288a('0x38')]?_0x672866['attributes']:_0x1ceab8[_0x288a('0x30')];if(!_0x3adf90[_0x288a('0x32')][_0x288a('0x39')](_0x288a('0x3a'))){_0x672866['limit']=qs['limit'](_0x3adf90[_0x288a('0x32')]['limit']);_0x672866['offset']=qs[_0x288a('0x1e')](_0x3adf90[_0x288a('0x32')][_0x288a('0x1e')]);}_0x672866['order']=qs[_0x288a('0x3b')](_0x3adf90['query'][_0x288a('0x3b')]);_0x672866[_0x288a('0x3c')]=qs[_0x288a('0x34')](_[_0x288a('0x3d')](_0x3adf90[_0x288a('0x32')],_0x1ceab8[_0x288a('0x34')]),_0x2447e2);if(_0x3adf90[_0x288a('0x32')]['filter']){_0x672866[_0x288a('0x3c')]=_[_0x288a('0x3e')](_0x672866[_0x288a('0x3c')],{'$or':_[_0x288a('0x31')](_0x2447e2,function(_0x355721){if(_0x355721[_0x288a('0x3f')]!==_0x288a('0x40')){var _0x2ec629={};_0x2ec629[_0x355721[_0x288a('0x2b')]]={'$like':'%'+_0x3adf90[_0x288a('0x32')][_0x288a('0x41')]+'%'};return _0x2ec629;}})});}_0x672866=_[_0x288a('0x3e')]({},_0x672866,_0x3adf90[_0x288a('0x42')]);var _0xead08c={'where':_0x672866[_0x288a('0x3c')]};return db[_0x288a('0x43')]['count'](_0xead08c)['then'](function(_0x1575dd){_0x3f8ef9[_0x288a('0x21')]=_0x1575dd;if(_0x3adf90['query'][_0x288a('0x44')]){_0x672866[_0x288a('0x45')]=[{'all':!![]}];}return db[_0x288a('0x43')][_0x288a('0x46')](_0x672866);})['then'](function(_0x339efd){_0x3f8ef9[_0x288a('0x47')]=_0x339efd;return _0x3f8ef9;})[_0x288a('0x25')](respondWithFilteredResult(_0x3037cf,_0x672866))[_0x288a('0x48')](handleError(_0x3037cf,null));};exports[_0x288a('0x49')]=function(_0x3a3746,_0x525127){var _0x116b1c={'raw':!![],'where':{'id':_0x3a3746[_0x288a('0x4a')]['id']}},_0x39509a={};_0x39509a[_0x288a('0x30')]=_[_0x288a('0x33')](db[_0x288a('0x43')]['rawAttributes']);_0x39509a[_0x288a('0x32')]=_[_0x288a('0x33')](_0x3a3746[_0x288a('0x32')]);_0x39509a[_0x288a('0x34')]=_[_0x288a('0x35')](_0x39509a['model'],_0x39509a[_0x288a('0x32')]);_0x116b1c[_0x288a('0x36')]=_['intersection'](_0x39509a[_0x288a('0x30')],qs[_0x288a('0x37')](_0x3a3746[_0x288a('0x32')]['fields']));_0x116b1c[_0x288a('0x36')]=_0x116b1c[_0x288a('0x36')][_0x288a('0x38')]?_0x116b1c[_0x288a('0x36')]:_0x39509a[_0x288a('0x30')];if(_0x3a3746[_0x288a('0x32')][_0x288a('0x44')]){_0x116b1c[_0x288a('0x45')]=[{'all':!![]}];}_0x116b1c=_[_0x288a('0x3e')]({},_0x116b1c,_0x3a3746['options']);return db['Plugin'][_0x288a('0x4b')](_0x116b1c)[_0x288a('0x25')](handleEntityNotFound(_0x525127,null))[_0x288a('0x25')](respondWithResult(_0x525127,null))['catch'](handleError(_0x525127,null));};exports['download']=function(_0x232a54,_0x29b966,_0x3e7f56){return db[_0x288a('0x43')][_0x288a('0x4b')]({'where':{'id':_0x232a54['params']['id']},'attributes':[_0x288a('0x2b'),_0x288a('0x7')],'raw':!![]})[_0x288a('0x25')](handleEntityNotFound(_0x29b966,null))[_0x288a('0x25')](function(_0x3c6a31){if(_0x3c6a31){var _0x5b60ad=path[_0x288a('0x4c')](config[_0x288a('0x4d')],'server/files/plugins',util[_0x288a('0x4e')](_0x288a('0x4f'),path[_0x288a('0x50')](_0x3c6a31['path'])));var _0x54cf3d=fs[_0x288a('0x51')](_0x5b60ad);var _0x464d68=archiver(_0x288a('0x52'),{'zlib':{'level':0x9}});_0x464d68['on'](_0x288a('0x53'),function(_0x273da4){if(_0x273da4[_0x288a('0x54')]==='ENOENT'){logger['error'](_0x273da4);}else{throw new db['Sequelize'][(_0x288a('0x55'))](_0x288a('0x56'));}});_0x464d68['on'](_0x288a('0x2a'),function(_0x494251){throw new db[(_0x288a('0x57'))][(_0x288a('0x55'))](_0x288a('0x56'));});_0x464d68[_0x288a('0x58')](_0x54cf3d);_0x464d68['glob'](_0x288a('0x59'),{'cwd':path[_0x288a('0x4c')](config[_0x288a('0x4d')],_0x288a('0x5a'),path[_0x288a('0x5b')](_0x3c6a31[_0x288a('0x7')])),'ignore':[path[_0x288a('0x4c')](path[_0x288a('0x50')](_0x3c6a31[_0x288a('0x7')]),'node_modules/**/*'),path['join'](path[_0x288a('0x50')](_0x3c6a31['path']),_0x288a('0x5c'))],'nodir':!![]})[_0x288a('0x5d')]();_0x54cf3d['on']('close',function(){if(!fs['existsSync'](_0x5b60ad)){throw new db[(_0x288a('0x57'))][(_0x288a('0x55'))]('Plugin\x20not\x20found');}return _0x29b966['download'](_0x5b60ad,util['format']('%s.zip',path[_0x288a('0x50')](_0x3c6a31[_0x288a('0x7')])),function(_0x345fc1){if(_0x345fc1){throw new db[(_0x288a('0x57'))]['Error'](_0x288a('0x5e'));}fs[_0x288a('0x5f')](_0x5b60ad);logger[_0x288a('0x60')]('Download\x20completed');logger[_0x288a('0x60')](_0x288a('0x61'));});});}return null;})[_0x288a('0x48')](handleError(_0x29b966,null));};exports['upload']=function(_0x3b7257,_0x423a4a,_0x527bad){var _0x10bcc7=path[_0x288a('0x50')](_0x3b7257['file']['filename'],path[_0x288a('0x62')](_0x3b7257[_0x288a('0x63')][_0x288a('0x64')]));var _0x31eb53=path['join'](config[_0x288a('0x4d')],'server/files/plugins',_0x3b7257[_0x288a('0x63')][_0x288a('0x64')]);var _0x422ac4=path[_0x288a('0x4c')](config[_0x288a('0x4d')],_0x288a('0x5a'),_0x10bcc7);logger[_0x288a('0x60')](_0x288a('0x65'),_0x31eb53);logger[_0x288a('0x60')](_0x288a('0x66'),_0x422ac4);try{fs[_0x288a('0x67')](_0x31eb53,parseInt(_0x288a('0x68'),0x8));extract(_0x31eb53,{'dir':_0x422ac4},function(_0x3c1b8a){if(_0x3c1b8a){logger['error'](_0x3c1b8a);handleError(_0x3c1b8a,!![]);};var _0x481022=fs[_0x288a('0x69')](_0x422ac4);if(_0x481022['length']>0x1){removeReferences(_0x31eb53,_0x422ac4);logger[_0x288a('0x2a')](_0x288a('0x6a'));return _0x527bad(new Error(_0x288a('0x6a')));}var _0x4f9c52=fs[_0x288a('0x6b')](path['join'](_0x422ac4,_0x481022[0x0]));if(_0x4f9c52[_0x288a('0x6c')]()){removeReferences(_0x31eb53,_0x422ac4);logger[_0x288a('0x2a')](_0x288a('0x6a'));return _0x527bad(new Error(_0x288a('0x6a')));}if(_0x4f9c52[_0x288a('0x6d')]()){var _0xcfc16a=fs[_0x288a('0x69')](path[_0x288a('0x4c')](_0x422ac4,_0x481022[0x0]));if(_0xcfc16a[_0x288a('0x38')]===0x0){removeReferences(_0x31eb53,_0x422ac4);logger['error'](_0x288a('0x6a'));return _0x527bad(new Error(_0x288a('0x6a')));}var _0x34743d=_0xcfc16a['some'](function(_0x33e689){return _0x33e689===_0x288a('0x6e');});if(!_0x34743d){return _0x527bad(new Error(_0x288a('0x6f')));}var _0x1832c7=fs['readFileSync'](path[_0x288a('0x4c')](_0x422ac4,_0x481022[0x0],_0x288a('0x6e')));var _0x363d2f=JSON['parse'](_0x1832c7);if(_0x288a('0x1f')==typeof _0x363d2f['name']){return _0x527bad(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x363d2f['type']){return _0x527bad(new Error(_0x288a('0x70')));}if('undefined'==typeof _0x363d2f[_0x288a('0x71')]){return _0x527bad(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x288a('0x1f')==typeof _0x363d2f[_0x288a('0x72')]){return _0x527bad(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x363d2f[_0x288a('0x3f')]===_0x288a('0x73')){if(_0x288a('0x1f')==typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x74')]){return _0x527bad(new Error(_0x288a('0x75')));}if(_0x288a('0x1f')==typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x74')][_0x288a('0x76')]&&_0x288a('0x1f')==typeof _0x363d2f[_0x288a('0x72')]['views'][_0x288a('0x77')]){return _0x527bad(new Error(_0x288a('0x78')));}}else if(_0x363d2f[_0x288a('0x3f')]===_0x288a('0x79')){if('undefined'==typeof _0x363d2f[_0x288a('0x72')]['scriptName']){return _0x527bad(new Error(_0x288a('0x7a')));}if(_0x288a('0x1f')==typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x7b')]){return _0x527bad(new Error(_0x288a('0x7c')));}}else{return _0x527bad(new Error(_0x288a('0x7d')));}var _0x27894b=_0x363d2f['name'];var _0x374b74=_0x363d2f['description'];var _0xec67af=_0x363d2f[_0x288a('0x3f')];var _0x2e4fd3=_0x363d2f[_0x288a('0x7e')]?_0x363d2f['sidebar']:_0x288a('0x7f');var _0x252a19=_0x363d2f['icon']?_0x363d2f['icon']:'icon-apps';var _0x18bdcd='';var _0x244f75='';var _0x2fa7a3='';var _0x1035c3='';var _0x14c398=_0x363d2f['version'];if(_0xec67af===_0x288a('0x73')){if('undefined'!=typeof _0x363d2f[_0x288a('0x72')]['views'][_0x288a('0x76')]){var _0x3869c6=_0x363d2f[_0x288a('0x72')][_0x288a('0x74')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3869c6)){_0x18bdcd=path[_0x288a('0x4c')](_0x288a('0x80'),_0x10bcc7,_0x481022[0x0],_0x3869c6);}else{_0x18bdcd=_0x3869c6;}}else{logger[_0x288a('0x60')](_0x288a('0x81'));}if('undefined'!=typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x74')]['agent']){var _0x1e811e=_0x363d2f[_0x288a('0x72')][_0x288a('0x74')][_0x288a('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1e811e)){_0x244f75=path['join'](_0x288a('0x80'),_0x10bcc7,_0x481022[0x0],_0x1e811e);}else{_0x244f75=_0x1e811e;}}else{logger[_0x288a('0x60')](_0x288a('0x82'));}}else if(_0xec67af==='script'){_0x2fa7a3=_0x363d2f['parameters']['scriptName'];_0x1035c3=_0x363d2f[_0x288a('0x72')]['scriptPath'];if(_0x288a('0x1f')!=typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x74')]){if(_0x288a('0x1f')!=typeof _0x363d2f[_0x288a('0x72')][_0x288a('0x74')][_0x288a('0x76')]){var _0x3869c6=_0x363d2f['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x288a('0x83')](_0x3869c6)){_0x18bdcd=path[_0x288a('0x4c')](_0x288a('0x80'),_0x10bcc7,_0x481022[0x0],_0x3869c6);}else{_0x18bdcd=_0x3869c6;}}if('undefined'!=typeof _0x363d2f['parameters'][_0x288a('0x74')][_0x288a('0x77')]){var _0x1e811e=_0x363d2f[_0x288a('0x72')][_0x288a('0x74')][_0x288a('0x77')];if(!/^(f|ht)tps?:\/\//i[_0x288a('0x83')](_0x1e811e)){_0x244f75=path[_0x288a('0x4c')]('plugins',_0x10bcc7,_0x481022[0x0],_0x1e811e);}else{_0x244f75=_0x1e811e;}}}}var _0x165d75={'name':_0x27894b,'description':_0x374b74,'path':path[_0x288a('0x4c')](_0x10bcc7,_0x481022[0x0]),'type':_0xec67af,'sidebar':_0x2e4fd3,'icon':_0x252a19,'adminUrl':_0x18bdcd,'agentUrl':_0x244f75,'scriptName':_0x2fa7a3,'scriptPath':_0x1035c3,'version':_0x14c398};removeReferences(_0x31eb53,null);return db[_0x288a('0x43')]['create'](_0x165d75)[_0x288a('0x25')](function(_0x3471a9){var _0x311960={'role':_0x3b7257['body']['role'],'userProfileId':_0x3b7257[_0x288a('0x84')][_0x288a('0x85')]};if(!_0x311960)throw new Error(_0x288a('0x86'));if(_0x311960[_0x288a('0x87')]===_0x288a('0x88')){var _0x32f986=_0x3471a9[_0x288a('0x26')]({'plain':!![]});return db[_0x288a('0x89')][_0x288a('0x4b')]({'where':{'name':_0x288a('0x27'),'userProfileId':_0x311960[_0x288a('0x85')]},'raw':!![]})[_0x288a('0x25')](function(_0x5940c3){if(_0x5940c3&&_0x5940c3[_0x288a('0x8a')]===0x0){return db[_0x288a('0x28')][_0x288a('0x8b')]({'name':_0x32f986[_0x288a('0x2b')],'resourceId':_0x32f986['id'],'type':_0x5940c3[_0x288a('0x2b')],'sectionId':_0x5940c3['id']},{})[_0x288a('0x25')](function(){return _0x3471a9;});}else{return _0x3471a9;}})[_0x288a('0x48')](function(_0x583eac){logger[_0x288a('0x2a')](_0x288a('0x8c'),_0x583eac);throw _0x583eac;});}return _0x3471a9;})['then'](respondWithResult(_0x423a4a,null))[_0x288a('0x48')](handleError(_0x423a4a,null));}});}catch(_0x38a465){_0x423a4a['status'](0x1f4)[_0x288a('0x2c')](_0x38a465);}};function removeReferences(_0x49a959,_0x2af036){try{if(_0x49a959){fs[_0x288a('0x5f')](_0x49a959);logger['info'](_0x288a('0x8d'));}if(_0x2af036){rimraf(_0x2af036,function(){});logger['info'](_0x288a('0x8e'));}}catch(_0x151355){logger[_0x288a('0x2a')](_0x151355);}}exports[_0x288a('0x8f')]=function(_0x591bf1,_0x1ce1ec,_0x14c211){return db[_0x288a('0x43')]['find']({'where':{'id':_0x591bf1[_0x288a('0x4a')]['id']}})[_0x288a('0x25')](handleEntityNotFound(_0x1ce1ec,null))['then'](saveUpdates(_0x591bf1['body'],null))[_0x288a('0x25')](respondWithResult(_0x1ce1ec,null))[_0x288a('0x48')](handleError(_0x1ce1ec,null));};exports['delete']=function(_0x409dcd,_0x41388b,_0x3acb53){return db[_0x288a('0x43')]['find']({'where':{'id':_0x409dcd[_0x288a('0x4a')]['id']}})[_0x288a('0x25')](function(_0x1e41a4){if(_0x1e41a4){return _0x1e41a4[_0x288a('0x29')]();}})[_0x288a('0x25')](function(_0x340fd1){rimraf(path['join'](config['root'],_0x288a('0x5a'),path[_0x288a('0x5b')](_0x340fd1[_0x288a('0x7')])),function(){});return _0x340fd1;})[_0x288a('0x25')](handleEntityNotFound(_0x41388b,null))[_0x288a('0x25')](respondWithStatusCode(_0x41388b,null))[_0x288a('0x48')](handleError(_0x41388b,null));};exports[_0x288a('0x90')]=function(_0x209ca5,_0x2fa44d,_0x5f1aa8){return BPromise[_0x288a('0x91')]()[_0x288a('0x25')](function(){if(!_0x209ca5['query']['path']){throw new Error(_0x288a('0x92'));}if(!_0x209ca5['query'][_0x288a('0x93')]){throw new Error(_0x288a('0x94'));}var _0x14886c=_0x209ca5['query'][_0x288a('0x95')]?_0x209ca5[_0x288a('0x32')][_0x288a('0x95')]+':'+_0x209ca5[_0x288a('0x32')]['port']:'http://localhost:'+_0x209ca5[_0x288a('0x32')][_0x288a('0x93')];var _0x3e4e5b=_0x209ca5[_0x288a('0x32')][_0x288a('0x96')]?_0x209ca5[_0x288a('0x32')][_0x288a('0x96')]:!![];var _0x296d89=_0x209ca5[_0x288a('0x32')][_0x288a('0x97')]?_0x209ca5['query'][_0x288a('0x97')]:null;var _0x5af4d2={'method':_0x209ca5[_0x288a('0x98')],'uri':util[_0x288a('0x4e')](_0x288a('0x99'),_0x14886c,_0x209ca5['query'][_0x288a('0x7')]),'json':_0x3e4e5b,'resolveWithFullResponse':!![],'encoding':_0x296d89,'qs':_0x209ca5['query']};if(_0x209ca5[_0x288a('0x9a')]){_0x5af4d2[_0x288a('0x9a')]=_0x209ca5[_0x288a('0x9a')];if(_0x5af4d2[_0x288a('0x9a')][_0x288a('0x9b')]){delete _0x5af4d2[_0x288a('0x9a')]['content-length'];}}if(_0x5af4d2[_0x288a('0x9a')][_0x288a('0x9c')]){delete _0x5af4d2[_0x288a('0x9a')][_0x288a('0x9c')];}return rp(_0x5af4d2);})['then'](function(_0x530a30){if(_0x530a30){_0x2fa44d[_0x288a('0x9d')](_0x530a30[_0x288a('0x9a')]);logger[_0x288a('0x60')](_0x530a30['body']);if(_[_0x288a('0x9e')](_0x209ca5[_0x288a('0x32')]['path'],'download')&&_0x530a30[_0x288a('0x9f')]==0x1f4){return _0x2fa44d[_0x288a('0x1b')](_0x530a30['statusCode']);}else{return _0x2fa44d['status'](_0x530a30['statusCode'])[_0x288a('0x2c')](_0x530a30['body']);}}else{return _0x2fa44d['sendStatus'](0xc8);}})['catch'](handleError(_0x2fa44d,null));};exports[_0x288a('0xa0')]=function(_0x31a9e1,_0x7d48b8,_0x4a40ad){return BPromise[_0x288a('0x91')]()[_0x288a('0x25')](function(){if(!_0x31a9e1[_0x288a('0x32')][_0x288a('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x31a9e1[_0x288a('0x32')][_0x288a('0x93')]){throw new Error(_0x288a('0x94'));}var _0x151ee9=_0x31a9e1[_0x288a('0x32')][_0x288a('0x95')]?_0x31a9e1[_0x288a('0x32')][_0x288a('0x95')]+':'+_0x31a9e1['query'][_0x288a('0x93')]:'http://localhost:'+_0x31a9e1[_0x288a('0x32')][_0x288a('0x93')];var _0x7fb9b=_0x31a9e1[_0x288a('0x32')][_0x288a('0x96')]?_0x31a9e1[_0x288a('0x32')][_0x288a('0x96')]:!![];var _0x22fa26=_0x31a9e1[_0x288a('0x32')][_0x288a('0x97')]?_0x31a9e1[_0x288a('0x32')][_0x288a('0x97')]:null;var _0x130c97={'method':_0x31a9e1[_0x288a('0x98')],'uri':util['format'](_0x288a('0x99'),_0x151ee9,_0x31a9e1['query'][_0x288a('0x7')]),'json':_0x7fb9b,'resolveWithFullResponse':!![],'encoding':_0x22fa26,'body':_0x31a9e1['body']};if(_0x31a9e1[_0x288a('0x9a')]){_0x130c97[_0x288a('0x9a')]=_0x31a9e1['headers'];if(_0x130c97['headers'][_0x288a('0x9b')]){delete _0x130c97['headers'][_0x288a('0x9b')];}}if(_0x130c97[_0x288a('0x9a')][_0x288a('0x9c')]){delete _0x130c97[_0x288a('0x9a')][_0x288a('0x9c')];}return rp(_0x130c97);})[_0x288a('0x25')](function(_0x28687f){if(_0x28687f){_0x7d48b8[_0x288a('0x9d')](_0x28687f['headers']);logger[_0x288a('0x60')](_0x28687f[_0x288a('0x84')]);return _0x7d48b8[_0x288a('0x1c')](_0x28687f[_0x288a('0x9f')])['send'](_0x28687f[_0x288a('0x84')]);}else{return _0x7d48b8[_0x288a('0x1b')](0xc8);}})[_0x288a('0x48')](handleError(_0x7d48b8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a90cc67..d12a0e6 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 _0xa49e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x2e89a5,_0x4f2f4c){var _0x2ba1e4=function(_0x32f1e7){while(--_0x32f1e7){_0x2e89a5['push'](_0x2e89a5['shift']());}};_0x2ba1e4(++_0x4f2f4c);}(_0xa49e,0x1de));var _0xea49=function(_0x309bde,_0x3ef7f5){_0x309bde=_0x309bde-0x0;var _0x5fa8bc=_0xa49e[_0x309bde];return _0x5fa8bc;};'use strict';var EventEmitter=require(_0xea49('0x0'));var Plugin=require(_0xea49('0x1'))['db'][_0xea49('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xea49('0x3')](0x0);var events={'afterCreate':_0xea49('0x4'),'afterUpdate':_0xea49('0x5'),'afterDestroy':_0xea49('0x6')};function emitEvent(_0x228052){return function(_0x5e12d0,_0x2ef1ec,_0x439b3d){PluginEvents[_0xea49('0x7')](_0x228052+':'+_0x5e12d0['id'],_0x5e12d0);PluginEvents['emit'](_0x228052,_0x5e12d0);_0x439b3d(null);};}for(var e in events){if(events[_0xea49('0x8')](e)){var event=events[e];Plugin[_0xea49('0x9')](e,emitEvent(event));}}module[_0xea49('0xa')]=PluginEvents; \ No newline at end of file +var _0xde81=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0xfa19c0,_0xb2d25a){var _0x4ba391=function(_0x2d1b2a){while(--_0x2d1b2a){_0xfa19c0['push'](_0xfa19c0['shift']());}};_0x4ba391(++_0xb2d25a);}(_0xde81,0x109));var _0x1de8=function(_0x14bbdc,_0x49b365){_0x14bbdc=_0x14bbdc-0x0;var _0x5eac57=_0xde81[_0x14bbdc];return _0x5eac57;};'use strict';var EventEmitter=require(_0x1de8('0x0'));var Plugin=require(_0x1de8('0x1'))['db'][_0x1de8('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1de8('0x3')](0x0);var events={'afterCreate':_0x1de8('0x4'),'afterUpdate':_0x1de8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x547821){return function(_0xebfcf9,_0x5953a6,_0x1421ce){PluginEvents[_0x1de8('0x6')](_0x547821+':'+_0xebfcf9['id'],_0xebfcf9);PluginEvents[_0x1de8('0x6')](_0x547821,_0xebfcf9);_0x1421ce(null);};}for(var e in events){if(events[_0x1de8('0x7')](e)){var event=events[e];Plugin[_0x1de8('0x8')](e,emitEvent(event));}}module[_0x1de8('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d58727c..1180904 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 _0x1af1=['rimraf','../../config/environment','exports','Plugin','plugins','lodash','util','moment','bluebird','request-promise','path'];(function(_0x437d14,_0x22b0c6){var _0x51c1c1=function(_0x3f9dac){while(--_0x3f9dac){_0x437d14['push'](_0x437d14['shift']());}};_0x51c1c1(++_0x22b0c6);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rp=require(_0x11af('0x4'));var fs=require('fs');var path=require(_0x11af('0x5'));var rimraf=require(_0x11af('0x6'));var config=require(_0x11af('0x7'));var attributes=require('./plugin.attributes');module[_0x11af('0x8')]=function(_0x1534f0,_0x17830a){return _0x1534f0['define'](_0x11af('0x9'),attributes,{'tableName':_0x11af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8091=['./plugin.attributes','define','Plugin','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x8091,0x67));var _0x1809=function(_0xae3c49,_0x128b14){_0xae3c49=_0xae3c49-0x0;var _0x389a3a=_0x8091[_0xae3c49];return _0x389a3a;};'use strict';var _=require(_0x1809('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1809('0x1'));var moment=require(_0x1809('0x2'));var BPromise=require('bluebird');var rp=require(_0x1809('0x3'));var fs=require('fs');var path=require(_0x1809('0x4'));var rimraf=require(_0x1809('0x5'));var config=require(_0x1809('0x6'));var attributes=require(_0x1809('0x7'));module['exports']=function(_0x490843,_0x4dbf8a){return _0x490843[_0x1809('0x8')](_0x1809('0x9'),attributes,{'tableName':'plugins','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 967435d..fd9ffd2 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 _0xa004=['../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreatePlugin','Plugin','body','options','raw','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa004,0x143));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a00('0x0'));var BPromise=require('bluebird');var rs=require(_0x4a00('0x1'));var fs=require('fs');var Redis=require(_0x4a00('0x2'));var db=require(_0x4a00('0x3'))['db'];var utils=require(_0x4a00('0x4'));var logger=require(_0x4a00('0x5'))(_0x4a00('0x6'));var config=require(_0x4a00('0x7'));var jayson=require(_0x4a00('0x8'));var client=jayson[_0x4a00('0x9')]['http']({'port':0x232a});config[_0x4a00('0xa')]=_['defaults'](config[_0x4a00('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a00('0xb'))(new Redis(config[_0x4a00('0xa')]));require('./plugin.socket')[_0x4a00('0xc')](socket);function respondWithRpcPromise(_0x3f57d7,_0x49aaea,_0x170fb6){return new BPromise(function(_0x4a2f77,_0x5314c4){return client[_0x4a00('0xd')](_0x3f57d7,_0x170fb6)[_0x4a00('0xe')](function(_0x1db72c){logger[_0x4a00('0xf')](_0x4a00('0x10'),_0x49aaea,'request\x20sent');logger[_0x4a00('0x11')](_0x4a00('0x12'),_0x49aaea,_0x4a00('0x13'),JSON['stringify'](_0x1db72c));if(_0x1db72c['error']){if(_0x1db72c[_0x4a00('0x14')][_0x4a00('0x15')]===0x1f4){logger[_0x4a00('0x14')](_0x4a00('0x10'),_0x49aaea,_0x1db72c['error'][_0x4a00('0x16')]);return _0x5314c4(_0x1db72c[_0x4a00('0x14')]['message']);}logger[_0x4a00('0x14')]('Plugin,\x20%s,\x20%s',_0x49aaea,_0x1db72c[_0x4a00('0x14')][_0x4a00('0x16')]);return _0x4a2f77(_0x1db72c[_0x4a00('0x14')][_0x4a00('0x16')]);}else{logger[_0x4a00('0xf')]('Plugin,\x20%s,\x20%s',_0x49aaea,_0x4a00('0x13'));_0x4a2f77(_0x1db72c['result']['message']);}})[_0x4a00('0x17')](function(_0x458110){logger['error']('Plugin,\x20%s,\x20%s',_0x49aaea,_0x458110);_0x5314c4(_0x458110);});});}exports[_0x4a00('0x18')]=function(_0x4f479e){var _0x577dbd=this;return new Promise(function(_0x2f1fdb,_0x5cbab0){return db[_0x4a00('0x19')]['create'](_0x4f479e[_0x4a00('0x1a')],{'raw':_0x4f479e['options']?_0x4f479e[_0x4a00('0x1b')][_0x4a00('0x1c')]===undefined?!![]:![]:!![]})[_0x4a00('0xe')](function(_0x2b9f0e){logger[_0x4a00('0xf')](_0x4a00('0x18'),_0x4f479e);logger['debug'](_0x4a00('0x18'),_0x4f479e,JSON[_0x4a00('0x1d')](_0x2b9f0e));_0x2f1fdb(_0x2b9f0e);})[_0x4a00('0x17')](function(_0x470173){logger[_0x4a00('0x14')](_0x4a00('0x18'),_0x470173[_0x4a00('0x16')],_0x4f479e);_0x5cbab0(_0x577dbd['error'](0x1f4,_0x470173[_0x4a00('0x16')]));});});}; \ No newline at end of file +var _0x811a=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreatePlugin','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./plugin.socket'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x811a,0x147));var _0xa811=function(_0x5714b9,_0xd2027){_0x5714b9=_0x5714b9-0x0;var _0x3a59db=_0x811a[_0x5714b9];return _0x3a59db;};'use strict';var _=require(_0xa811('0x0'));var util=require(_0xa811('0x1'));var moment=require(_0xa811('0x2'));var BPromise=require(_0xa811('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa811('0x4'));var db=require(_0xa811('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa811('0x6'));var config=require(_0xa811('0x7'));var jayson=require(_0xa811('0x8'));var client=jayson[_0xa811('0x9')]['http']({'port':0x232a});config[_0xa811('0xa')]=_[_0xa811('0xb')](config[_0xa811('0xa')],{'host':_0xa811('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa811('0xa')]));require(_0xa811('0xd'))[_0xa811('0xe')](socket);function respondWithRpcPromise(_0x31ac99,_0x46a5ff,_0xd7b405){return new BPromise(function(_0x30a6e2,_0x3cbb22){return client[_0xa811('0xf')](_0x31ac99,_0xd7b405)[_0xa811('0x10')](function(_0x5c6c9d){logger[_0xa811('0x11')](_0xa811('0x12'),_0x46a5ff,_0xa811('0x13'));logger[_0xa811('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x46a5ff,'request\x20sent',JSON[_0xa811('0x15')](_0x5c6c9d));if(_0x5c6c9d[_0xa811('0x16')]){if(_0x5c6c9d[_0xa811('0x16')]['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x46a5ff,_0x5c6c9d[_0xa811('0x16')][_0xa811('0x17')]);return _0x3cbb22(_0x5c6c9d[_0xa811('0x16')][_0xa811('0x17')]);}logger['error'](_0xa811('0x12'),_0x46a5ff,_0x5c6c9d[_0xa811('0x16')][_0xa811('0x17')]);return _0x30a6e2(_0x5c6c9d[_0xa811('0x16')]['message']);}else{logger['info'](_0xa811('0x12'),_0x46a5ff,'request\x20sent');_0x30a6e2(_0x5c6c9d[_0xa811('0x18')][_0xa811('0x17')]);}})[_0xa811('0x19')](function(_0x5e04cf){logger[_0xa811('0x16')](_0xa811('0x12'),_0x46a5ff,_0x5e04cf);_0x3cbb22(_0x5e04cf);});});}exports[_0xa811('0x1a')]=function(_0x4eccb8){var _0x393d84=this;return new Promise(function(_0x3de9c2,_0x2063a1){return db['Plugin'][_0xa811('0x1b')](_0x4eccb8[_0xa811('0x1c')],{'raw':_0x4eccb8[_0xa811('0x1d')]?_0x4eccb8[_0xa811('0x1d')][_0xa811('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x32b7c4){logger['info'](_0xa811('0x1a'),_0x4eccb8);logger[_0xa811('0x14')](_0xa811('0x1a'),_0x4eccb8,JSON[_0xa811('0x15')](_0x32b7c4));_0x3de9c2(_0x32b7c4);})['catch'](function(_0x2dbad4){logger[_0xa811('0x16')](_0xa811('0x1a'),_0x2dbad4[_0xa811('0x17')],_0x4eccb8);_0x2063a1(_0x393d84['error'](0x1f4,_0x2dbad4[_0xa811('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 89ea9b3..5dd2ccb 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 _0xe403=['removeListener','register','length','plugin:','./plugin.events','remove'];(function(_0x19b357,_0x1de97e){var _0x1d6ead=function(_0x42447f){while(--_0x42447f){_0x19b357['push'](_0x19b357['shift']());}};_0x1d6ead(++_0x1de97e);}(_0xe403,0x13c));var _0x3e40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe403[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x3e40('0x0'));var events=['save',_0x3e40('0x1'),'update'];function createListener(_0x5cd15d,_0x22b86f){return function(_0x29f82f){_0x22b86f['emit'](_0x5cd15d,_0x29f82f);};}function removeListener(_0x543046,_0x17b0fb){return function(){PluginEvents[_0x3e40('0x2')](_0x543046,_0x17b0fb);};}exports[_0x3e40('0x3')]=function(_0x3922fc){for(var _0x109469=0x0,_0x2ac268=events[_0x3e40('0x4')];_0x109469<_0x2ac268;_0x109469++){var _0x4d07b4=events[_0x109469];var _0x1ef01b=createListener(_0x3e40('0x5')+_0x4d07b4,_0x3922fc);PluginEvents['on'](_0x4d07b4,_0x1ef01b);}}; \ No newline at end of file +var _0x2016=['remove','update','emit','removeListener','register','length','save'];(function(_0x1f449d,_0x215910){var _0x30daf0=function(_0x30581c){while(--_0x30581c){_0x1f449d['push'](_0x1f449d['shift']());}};_0x30daf0(++_0x215910);}(_0x2016,0x15d));var _0x6201=function(_0x590b59,_0x513ff1){_0x590b59=_0x590b59-0x0;var _0x4f8fe8=_0x2016[_0x590b59];return _0x4f8fe8;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x6201('0x0'),_0x6201('0x1'),_0x6201('0x2')];function createListener(_0x14778d,_0x33c98f){return function(_0x14e278){_0x33c98f[_0x6201('0x3')](_0x14778d,_0x14e278);};}function removeListener(_0x3fb25f,_0x221b30){return function(){PluginEvents[_0x6201('0x4')](_0x3fb25f,_0x221b30);};}exports[_0x6201('0x5')]=function(_0x5e8029){for(var _0xe99768=0x0,_0xb13e5b=events[_0x6201('0x6')];_0xe99768<_0xb13e5b;_0xe99768++){var _0x4244af=events[_0xe99768];var _0x23f04f=createListener('plugin:'+_0x4244af,_0x5e8029);PluginEvents['on'](_0x4244af,_0x23f04f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 449c7a5..73a8bb9 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(_0x264204,_0x44466b){var _0x1d310c=function(_0x39fde0){while(--_0x39fde0){_0x264204['push'](_0x264204['shift']());}};_0x1d310c(++_0x44466b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x44b23a,_0x4623df){var _0x1b2bfd=function(_0x1ad8b3){while(--_0x1ad8b3){_0x44b23a['push'](_0x44b23a['shift']());}};_0x1b2bfd(++_0x4623df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 ea33184..909e8e1 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 _0x4ded=['name','express','motion2','catch','show','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','info','index','list','then','reject'];(function(_0x5ea11a,_0x25161c){var _0x2bb1c6=function(_0x24ec34){while(--_0x24ec34){_0x5ea11a['push'](_0x5ea11a['shift']());}};_0x2bb1c6(++_0x25161c);}(_0x4ded,0x116));var _0xd4de=function(_0x2623ad,_0x49ecb6){_0x2623ad=_0x2623ad-0x0;var _0x461be7=_0x4ded[_0x2623ad];return _0x461be7;};'use strict';var _=require(_0xd4de('0x0'));var pm2=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var path=require(_0xd4de('0x4'));var exec=require(_0xd4de('0x5'))[_0xd4de('0x6')];var BPromise=require(_0xd4de('0x7'));function handleEntityNotFound(_0x20930f,_0x36d4dd){return function(_0x2e8d86){if(!_0x2e8d86){_0x20930f[_0xd4de('0x8')](0x194);;}return _0x2e8d86;};}function respondWithResult(_0x554a51,_0x23e5b9){_0x23e5b9=_0x23e5b9||0xc8;return function(_0x2433b8){if(_0x2433b8){return _0x554a51[_0xd4de('0x9')](_0x23e5b9)[_0xd4de('0xa')](_0x2433b8);}return null;};}function handleError(_0x4453c2,_0x1e8c35){_0x1e8c35=_0x1e8c35||0x1f4;return function(_0x5c612f){logger[_0xd4de('0xb')](_0x5c612f['stack']);if(_0x5c612f['name']){delete _0x5c612f['name'];}_0x4453c2[_0xd4de('0x9')](_0x1e8c35)[_0xd4de('0xc')](_0x5c612f);};}function execChildProcess(){return new BPromise(function(_0x4e5b10,_0x5b6dc4){exec('npm\x20install',function(_0x29e265,_0x49d931,_0x38ac13){logger[_0xd4de('0xd')](_0x49d931);logger[_0xd4de('0xd')](_0x38ac13);if(_0x29e265){logger[_0xd4de('0xb')](_0x29e265);return _0x5b6dc4(_0x29e265);}return _0x4e5b10(_0x49d931);});});}exports[_0xd4de('0xe')]=function(_0x3af6e0,_0x1dc9d5){return pm2[_0xd4de('0xf')]()[_0xd4de('0x10')](function(_0x37cb9f){if(_0x37cb9f){var _0x691ba9=_[_0xd4de('0x11')](_0x37cb9f,function(_0x164ca0){return _0x164ca0[_0xd4de('0x12')]===_0xd4de('0x13')||_0x164ca0[_0xd4de('0x12')]===_0xd4de('0x14');});return{'rows':_0x691ba9,'count':_0x691ba9['length']};}return null;})['then'](respondWithResult(_0x1dc9d5,null))[_0xd4de('0x15')](handleError(_0x1dc9d5,null));};exports[_0xd4de('0x16')]=function(_0x17b377,_0x428aa2){return pm2['describe'](_0x17b377['params']['id'])[_0xd4de('0x10')](respondWithResult(_0x428aa2,null))['then'](handleEntityNotFound(_0x428aa2,null))[_0xd4de('0x15')](handleError(_0x428aa2,null));};exports[_0xd4de('0x17')]=function(_0x50b9e3,_0xc15081){if(_0x50b9e3['body'][_0xd4de('0x12')]&&_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]){var _0x8e8712=path['join'](__dirname,_0xd4de('0x1a'),_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]);var _0xdb3fc=process[_0xd4de('0x1b')]();process[_0xd4de('0x1c')](path[_0xd4de('0x1d')](_0x8e8712));return execChildProcess()[_0xd4de('0x10')](function(_0x2f9de6){process[_0xd4de('0x1c')](_0xdb3fc);return pm2['start']({'name':_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x12')],'script':_0x8e8712});})[_0xd4de('0x10')](function(_0x22970c){pm2[_0xd4de('0x1e')]();return _0x22970c[0x0];})[_0xd4de('0x10')](respondWithResult(_0xc15081,0xc9))[_0xd4de('0x15')](handleError(_0xc15081,null));}else{return _0xc15081[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':_0xd4de('0x1f')});}};exports[_0xd4de('0x20')]=function(_0xb2d8a1,_0x586126){if(_0xb2d8a1[_0xd4de('0x18')]['id']){delete _0xb2d8a1[_0xd4de('0x18')]['id'];}var _0x5005b0={'online':_0xd4de('0x21'),'stopped':'stop'};if(_0x5005b0[_0xd4de('0x22')](_0xb2d8a1[_0xd4de('0x18')][_0xd4de('0x9')])){return pm2[_0x5005b0[_0xb2d8a1['body'][_0xd4de('0x9')]]](_0xb2d8a1[_0xd4de('0x23')]['id'])[_0xd4de('0x10')](respondWithResult(_0x586126,0xc8))['catch'](handleError(_0x586126,null));}else{return _0x586126[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x5706fe,_0x3f6491){if(_0x5706fe['body']['id']){delete _0x5706fe[_0xd4de('0x18')]['id'];}if(_0x5706fe[_0xd4de('0x23')]['id']){return pm2[_0xd4de('0x24')](_0x5706fe[_0xd4de('0x23')]['id'])['then'](function(_0x3fe6c8){pm2[_0xd4de('0x1e')]();return _0x3fe6c8[0x0];})['then'](respondWithResult(_0x3f6491,null))[_0xd4de('0x15')](handleError(_0x3f6491,null));}else{return _0x3f6491[_0xd4de('0x9')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x6c76=['status','npm\x20install','info','error','index','list','then','reject','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','send','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','stack','name'];(function(_0xf83492,_0x422524){var _0x5f4e03=function(_0x3824c8){while(--_0x3824c8){_0xf83492['push'](_0xf83492['shift']());}};_0x5f4e03(++_0x422524);}(_0x6c76,0x184));var _0x66c7=function(_0x5e25b8,_0x19bd6f){_0x5e25b8=_0x5e25b8-0x0;var _0x123ce4=_0x6c76[_0x5e25b8];return _0x123ce4;};'use strict';var _=require(_0x66c7('0x0'));var pm2=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var path=require(_0x66c7('0x3'));var exec=require(_0x66c7('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2f6db7,_0x2b7cf3){return function(_0x49d437){if(!_0x49d437){_0x2f6db7[_0x66c7('0x5')](0x194);;}return _0x49d437;};}function respondWithResult(_0x45b0a5,_0x52f71b){_0x52f71b=_0x52f71b||0xc8;return function(_0x23408c){if(_0x23408c){return _0x45b0a5['status'](_0x52f71b)['json'](_0x23408c);}return null;};}function handleError(_0x208d06,_0x2b0065){_0x2b0065=_0x2b0065||0x1f4;return function(_0x24349f){logger['error'](_0x24349f[_0x66c7('0x6')]);if(_0x24349f[_0x66c7('0x7')]){delete _0x24349f[_0x66c7('0x7')];}_0x208d06[_0x66c7('0x8')](_0x2b0065)['send'](_0x24349f);};}function execChildProcess(){return new BPromise(function(_0x464085,_0x45db57){exec(_0x66c7('0x9'),function(_0x187e00,_0x21fb64,_0x406e41){logger[_0x66c7('0xa')](_0x21fb64);logger['info'](_0x406e41);if(_0x187e00){logger[_0x66c7('0xb')](_0x187e00);return _0x45db57(_0x187e00);}return _0x464085(_0x21fb64);});});}exports[_0x66c7('0xc')]=function(_0x35cbc2,_0xea3f56){return pm2[_0x66c7('0xd')]()[_0x66c7('0xe')](function(_0x618bd7){if(_0x618bd7){var _0xf3b04=_[_0x66c7('0xf')](_0x618bd7,function(_0x5d44e1){return _0x5d44e1[_0x66c7('0x7')]==='express'||_0x5d44e1[_0x66c7('0x7')]===_0x66c7('0x10');});return{'rows':_0xf3b04,'count':_0xf3b04[_0x66c7('0x11')]};}return null;})[_0x66c7('0xe')](respondWithResult(_0xea3f56,null))[_0x66c7('0x12')](handleError(_0xea3f56,null));};exports['show']=function(_0x5cf913,_0x53fb36){return pm2['describe'](_0x5cf913[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x53fb36,null))['then'](handleEntityNotFound(_0x53fb36,null))['catch'](handleError(_0x53fb36,null));};exports[_0x66c7('0x14')]=function(_0x9b65cf,_0x4756f7){if(_0x9b65cf[_0x66c7('0x15')]['name']&&_0x9b65cf['body'][_0x66c7('0x16')]){var _0x237177=path[_0x66c7('0x17')](__dirname,_0x66c7('0x18'),_0x9b65cf[_0x66c7('0x15')][_0x66c7('0x16')]);var _0x4804cf=process[_0x66c7('0x19')]();process[_0x66c7('0x1a')](path['dirname'](_0x237177));return execChildProcess()[_0x66c7('0xe')](function(_0x8b96b1){process[_0x66c7('0x1a')](_0x4804cf);return pm2[_0x66c7('0x1b')]({'name':_0x9b65cf['body'][_0x66c7('0x7')],'script':_0x237177});})[_0x66c7('0xe')](function(_0x5b28e6){pm2[_0x66c7('0x1c')]();return _0x5b28e6[0x0];})[_0x66c7('0xe')](respondWithResult(_0x4756f7,0xc9))[_0x66c7('0x12')](handleError(_0x4756f7,null));}else{return _0x4756f7[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4e514a,_0x2dd131){if(_0x4e514a[_0x66c7('0x15')]['id']){delete _0x4e514a['body']['id'];}var _0x9afd50={'online':_0x66c7('0x1e'),'stopped':_0x66c7('0x1f')};if(_0x9afd50[_0x66c7('0x20')](_0x4e514a[_0x66c7('0x15')][_0x66c7('0x8')])){return pm2[_0x9afd50[_0x4e514a['body'][_0x66c7('0x8')]]](_0x4e514a[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x2dd131,0xc8))[_0x66c7('0x12')](handleError(_0x2dd131,null));}else{return _0x2dd131[_0x66c7('0x8')](0x1f4)['send']({'message':_0x66c7('0x21')});}};exports['destroy']=function(_0xfbd97,_0x543fbf){if(_0xfbd97[_0x66c7('0x15')]['id']){delete _0xfbd97[_0x66c7('0x15')]['id'];}if(_0xfbd97[_0x66c7('0x13')]['id']){return pm2[_0x66c7('0x22')](_0xfbd97[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](function(_0x559ab9){pm2['dump']();return _0x559ab9[0x0];})[_0x66c7('0xe')](respondWithResult(_0x543fbf,null))[_0x66c7('0x12')](handleError(_0x543fbf,null));}else{return _0x543fbf[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':_0x66c7('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 854da1f..c1ff9c3 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 _0xe9a3=['/queues','isAuthenticated','getQueues','express','Router','getAgents'];(function(_0x43d883,_0x3655d8){var _0x307541=function(_0x2ee426){while(--_0x2ee426){_0x43d883['push'](_0x43d883['shift']());}};_0x307541(++_0x3655d8);}(_0xe9a3,0xf3));var _0x3e9a=function(_0x369224,_0x1feb70){_0x369224=_0x369224-0x0;var _0x328420=_0xe9a3[_0x369224];return _0x328420;};'use strict';var express=require(_0x3e9a('0x0'));var router=express[_0x3e9a('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get']('/agents',auth['isAuthenticated'](),controller[_0x3e9a('0x2')]);router['get'](_0x3e9a('0x3'),auth[_0x3e9a('0x4')](),controller[_0x3e9a('0x5')]);module['exports']=router; \ No newline at end of file +var _0xce34=['/queues','getQueues','exports','express','./realtime.controller','/agents','isAuthenticated','getAgents','get'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xce34,0xc0));var _0x4ce3=function(_0x48f313,_0x469959){_0x48f313=_0x48f313-0x0;var _0x4cf0cf=_0xce34[_0x48f313];return _0x4cf0cf;};'use strict';var express=require(_0x4ce3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4ce3('0x1'));router['get'](_0x4ce3('0x2'),auth[_0x4ce3('0x3')](),controller[_0x4ce3('0x4')]);router[_0x4ce3('0x5')](_0x4ce3('0x6'),auth['isAuthenticated'](),controller[_0x4ce3('0x7')]);module[_0x4ce3('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 4b1aa97..7122f52 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 _0x6582=['request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','voice','outbound','push','pTalking','originated','message','dialActive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','talking','busy','merge','pick','connectedlinenum','toString','find','getMembers','length','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','QueueId','agents','unknown','unavailable','isNil','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','idle','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','lastPauseAt','address','mailPause','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','query','sort','includes','rawAttributes','fieldName','type','key','role','agent','raw','user','nolimit','filter','UserProfile','getResources','rows','omit','globalStatus','orderBy','asc','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','resolve','channel','toLowerCase','getOptions','QueueCampaigns','findAndCountAll','all','util','jayson/promise','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','json','error','stack','name','send'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6582,0x1b3));var _0x2658=function(_0x38a653,_0x1a5872){_0x38a653=_0x38a653-0x0;var _0x370492=_0x6582[_0x38a653];return _0x370492;};'use strict';var util=require(_0x2658('0x0'));var _=require('lodash');var jayson=require(_0x2658('0x1'));var qs=require(_0x2658('0x2'));var logger=require('../../config/logger')(_0x2658('0x3'));var db=require(_0x2658('0x4'))['db'];var amiClient=jayson[_0x2658('0x5')][_0x2658('0x6')]({'port':0x232a});var routingClient=jayson[_0x2658('0x5')][_0x2658('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xb70392,_0x20c6ef){return function(_0x34e5c1){if(_0x34e5c1){var _0x306074=typeof _0x20c6ef[_0x2658('0x7')]===_0x2658('0x8')&&typeof _0x20c6ef[_0x2658('0x9')]===_0x2658('0x8');var _0x5e2135=_0x34e5c1[_0x2658('0xa')];var _0x1f11f5=_0x306074?0x0:_0x20c6ef['offset'];var _0x24925b=_0x306074?_0x34e5c1[_0x2658('0xa')]:_0x20c6ef[_0x2658('0x7')]+_0x20c6ef[_0x2658('0x9')];var _0x4f6c8b;if(_0x24925b>=_0x5e2135){_0x24925b=_0x5e2135;_0x4f6c8b=0xc8;}else{_0x4f6c8b=0xce;}_0xb70392[_0x2658('0xb')](_0x4f6c8b);return _0xb70392[_0x2658('0xc')]('Content-Range',_0x1f11f5+'-'+_0x24925b+'/'+_0x5e2135)[_0x2658('0xd')](_0x34e5c1);}return null;};}function handleError(_0x13edb0,_0x279acd){_0x279acd=_0x279acd||0x1f4;return function(_0x461898){logger[_0x2658('0xe')](_0x461898[_0x2658('0xf')]);if(_0x461898[_0x2658('0x10')]){delete _0x461898[_0x2658('0x10')];}_0x13edb0[_0x2658('0xb')](_0x279acd)[_0x2658('0x11')](_0x461898);};}function getRealtimeAgents(){return new Promise(function(_0x4549a6,_0x24c602){return amiClient[_0x2658('0x12')](_0x2658('0x13'),{})[_0x2658('0x14')](function(_0x19b916){if(_0x19b916[_0x2658('0xe')])throw new Error(_0x2658('0x15'));var _0x34827b=_0x19b916[_0x2658('0x16')];return routingClient[_0x2658('0x12')]('Agents',{})['then'](function(_0x3ca8de){if(_0x3ca8de[_0x2658('0xe')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0xf17559=_0x3ca8de[_0x2658('0x16')];return _0x4549a6(_['merge']({},_0x34827b,_0xf17559));});})[_0x2658('0x17')](function(_0xc29b3e){_0x24c602(_0xc29b3e);});});}function getRealtimeQueues(_0x3e8cf5,_0x1cd8f2){return new Promise(function(_0x5d53a5,_0x96c518){var _0x75f2ec=_0x1cd8f2==='voice'?amiClient:routingClient;return _0x75f2ec['request'](_[_0x2658('0x18')](_0x1cd8f2)+_0x2658('0x19'),_0x3e8cf5)[_0x2658('0x14')](function(_0x5a1a84){if(_0x5a1a84[_0x2658('0xe')])throw new Error(util[_0x2658('0x1a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1cd8f2));return _0x5d53a5(_0x5a1a84['result']);})[_0x2658('0x17')](function(_0x6ef04a){_0x96c518(_0x6ef04a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x322039,_0xb9ca6){return amiClient[_0x2658('0x12')]('VoiceQueuesChannels',{})[_0x2658('0x14')](function(_0x4270d6){if(_0x4270d6[_0x2658('0xe')])throw new Error(_0x2658('0x1b'));return _0x322039(_0x4270d6[_0x2658('0x16')]);})[_0x2658('0x17')](function(_0x5edda9){_0xb9ca6(_0x5edda9);});});}function initializeQueues(_0x2ad3b2,_0x3f64a9,_0x504c73,_0x846c5){var _0x45e8ee=[_0x2658('0x1c'),_0x2658('0x1d'),_0x2658('0x1e'),'talking',_0x2658('0x1f')];if(_0x504c73===_0x2658('0x20')&&_0x846c5===_0x2658('0x21')){_0x45e8ee[_0x2658('0x22')](_0x2658('0x23'),_0x2658('0x24'),_0x2658('0x25'),_0x2658('0x26'),'dialMethod','Trunk','startPredictive',_0x2658('0x27'),_0x2658('0x28'),_0x2658('0x29'),_0x2658('0x2a'),_0x2658('0x2b'),_0x2658('0x2c'),_0x2658('0x2d'),_0x2658('0x2e'),_0x2658('0x2f'),_0x2658('0x30'),_0x2658('0x31'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x2658('0x32'),_0x2658('0x33'));}return _0x2ad3b2[_0x2658('0x34')](function(_0x1d0660){var _0x36997d=_0x1d0660[_0x2658('0x35')]({'plain':!![]});_0x36997d['agents']=[];_0x36997d[_0x2658('0x1f')]=0x0;_0x36997d[_0x2658('0x36')]=0x0;_0x36997d[_0x2658('0x1c')]=0x0;_0x36997d[_0x2658('0x1d')]=0x0;_0x36997d[_0x2658('0x1e')]=0x0;if(_0x504c73==='voice'){_0x36997d[_0x2658('0x37')]=0x0;_0x36997d[_0x2658('0x38')]=0x0;if(_0x846c5===_0x2658('0x21')){_0x36997d[_0x2658('0x23')]=0x0;_0x36997d['originated']=0x0;}}var _0x2c7339=_['find'](_0x3f64a9,['id',_0x36997d['id']]);if(_0x2c7339)_[_0x2658('0x39')](_0x36997d,_[_0x2658('0x3a')](_0x2c7339,_0x45e8ee));return _0x36997d;});}function updateAgentVoiceStatus(_0x224f34,_0x20f266,_0x35c78d){var _0x601fea=_['filter'](_0x35c78d,['queue',_0x20f266[_0x2658('0x10')]]);if(_0x601fea['length']===0x0)return _0x224f34[_0x2658('0x38')]=!![];if(_['some'](_0x601fea,[_0x2658('0x3b'),_0x224f34['internal'][_0x2658('0x3c')]()]))return _0x224f34[_0x2658('0x37')]=!![];if(!_0x224f34['talking'])return _0x224f34[_0x2658('0x38')]=!![];}function getVoiceQueueAgents(_0x4c33ff,_0x358d00,_0x59c75f,_0x4a335e){var _0x18898e=_[_0x2658('0x3d')](_0x358d00,['id',_0x4c33ff['id']]);if(!_0x18898e)return _0x4c33ff;return _0x18898e[_0x2658('0x3e')]({'raw':!![]})[_0x2658('0x14')](function(_0x4aabaf){for(var _0x52535c=0x0;_0x52535c<_0x4aabaf[_0x2658('0x3f')];_0x52535c++){var _0x5e15e7=_[_0x2658('0x3d')](_0x59c75f,['id',_0x4aabaf[_0x52535c][_0x2658('0x40')]]);if(!_0x5e15e7){_0x5e15e7={'id':_0x4aabaf[_0x52535c][_0x2658('0x40')],'name':_0x4aabaf[_0x52535c]['UserId'],'accountcode':'','online':![]};}var _0x4337e2={'id':_0x5e15e7['id'],'name':_0x5e15e7[_0x2658('0x10')],'internal':_0x5e15e7[_0x2658('0x41')],'online':Boolean(_0x5e15e7[_0x2658('0x42')]),'paused':Boolean(_0x4aabaf[_0x52535c][_0x2658('0x1f')])};if(_0x5e15e7[_0x2658('0x43')]===_0x2658('0x37'))updateAgentVoiceStatus(_0x4337e2,_0x4c33ff,_0x4a335e);if(_0x4337e2['online'])_0x4c33ff[_0x2658('0x36')]++;if(_0x4337e2['busy'])_0x4c33ff['busy']++;if(_0x4337e2['paused']&&!_0x4337e2[_0x2658('0x38')]&&!_0x4337e2[_0x2658('0x37')])_0x4c33ff[_0x2658('0x1f')]++;_0x4c33ff['agents'][_0x2658('0x22')](_0x4337e2);}return _0x4c33ff;});}function getQueueAgents(_0x3f9cd4,_0x379846,_0x27480b){var _0x577b0a=_0x2658('0x44')+_[_0x2658('0x18')](_0x27480b)+_0x2658('0x45');var _0x585d46=_0x27480b+_0x2658('0x46');return db[_0x577b0a][_0x2658('0x47')]({'where':{[_[_0x2658('0x18')](_0x27480b)+_0x2658('0x48')]:_0x3f9cd4['id']},'raw':!![]})[_0x2658('0x14')](function(_0x11c288){for(var _0x1c1f7d=0x0;_0x1c1f7d<_0x11c288[_0x2658('0x3f')];_0x1c1f7d++){var _0x58d202=_[_0x2658('0x3d')](_0x379846,['id',_0x11c288[_0x1c1f7d][_0x2658('0x40')]]);if(!_0x58d202){_0x58d202={'id':_0x11c288[_0x1c1f7d][_0x2658('0x40')],'name':_0x11c288[_0x1c1f7d][_0x2658('0x40')],'online':![],['pauseField']:![]};}var _0x53bf8a={'id':_0x58d202['id'],'name':_0x58d202['name'],'online':Boolean(_0x58d202[_0x2658('0x42')]),'paused':Boolean(_0x58d202[_0x585d46])};if(_0x53bf8a[_0x2658('0x42')])_0x3f9cd4[_0x2658('0x36')]++;_0x3f9cd4[_0x2658('0x49')][_0x2658('0x22')](_0x53bf8a);}return _0x3f9cd4;});}function isIdle(_0x4465e4){return _0x4465e4==='idle'||_0x4465e4===_0x2658('0x4a')||_0x4465e4===_0x2658('0x4b')||_0x4465e4==='ringing'||_[_0x2658('0x4c')](_0x4465e4);}function isAgentPaused(_0x24e199,_0x1f9fa6){var _0x463d73=[_0x24e199[_0x2658('0x4d')],_0x24e199[_0x2658('0x4e')],_0x24e199['mailPause'],_0x24e199[_0x2658('0x4f')],_0x24e199[_0x2658('0x50')],_0x24e199[_0x2658('0x51')],_0x24e199[_0x2658('0x52')]];if(!_0x1f9fa6)return _['every'](_0x463d73);var _0x6592d=_['filter'](_0x463d73);return _0x6592d[_0x2658('0x3f')]>0x0&&_0x6592d[_0x2658('0x3f')]<_0x463d73['length']?!![]:![];}function isAgentIdle(_0x2a3bf5){if(_0x2a3bf5[_0x2658('0x43')]!==_0x2658('0x53')&&_0x2a3bf5[_0x2658('0x51')]){_0x2a3bf5[_0x2658('0x43')]=_0x2658('0x54');return![];}return _[_0x2658('0x55')]([_0x2a3bf5[_0x2658('0x56')],_0x2a3bf5[_0x2658('0x57')],_0x2a3bf5[_0x2658('0x58')],_0x2a3bf5[_0x2658('0x59')],_0x2a3bf5['smsStatus'],_0x2a3bf5['voiceStatus'],_0x2a3bf5[_0x2658('0x5a')]],isIdle);}function getAgentStatus(_0x327d7e){var _0x4a149d=_0x2658('0x4a');if(isAgentPaused(_0x327d7e))_0x4a149d=_0x2658('0x54');else if(isAgentPaused(_0x327d7e,!![]))_0x4a149d=_0x2658('0x5b');else if(isAgentIdle(_0x327d7e))_0x4a149d='idle';else _0x4a149d=_0x2658('0x38');return _0x4a149d;}exports['getAgents']=function(_0xfd88c4,_0x5e90f0){var _0x3eb373='';var _0x4a5f4a={'count':0x0,'rows':[]},_0x15d870={},_0x2ea8e9,_0x32ef1c,_0x1c7f56=['userpic',_0x2658('0x42'),'lastLoginAt',_0x2658('0x5c'),'pauseType',_0x2658('0x5c'),'internal',_0x2658('0x5d'),_0x2658('0x4d'),_0x2658('0x4f'),_0x2658('0x5e'),_0x2658('0x50'),_0x2658('0x52'),'faxPause',_0x2658('0x51'),'chatCapacity',_0x2658('0x5f'),_0x2658('0x60'),_0x2658('0x61'),'whatsappCapacity',_0x2658('0x62'),_0x2658('0x63'),_0x2658('0x64'),_0x2658('0x65'),_0x2658('0x66'),_0x2658('0x67'),_0x2658('0x68'),_0x2658('0x56'),_0x2658('0x59'),_0x2658('0x58'),_0x2658('0x69'),_0x2658('0x5a'),_0x2658('0x57'),_0x2658('0x43'),_0x2658('0x6a'),_0x2658('0x6b'),_0x2658('0x6c'),'smsStatusTime',_0x2658('0x6d'),_0x2658('0x6e'),_0x2658('0x6f'),_0x2658('0x70'),'destconnectedlinenum','screenrecording',_0x2658('0x71'),'phoneBarEnableAutomaticScreenRecording','routealias'],_0x3e7db6=['chatPause',_0x2658('0x4f'),_0x2658('0x5e'),_0x2658('0x50'),_0x2658('0x52'),'faxPause',_0x2658('0x51'),_0x2658('0x42')];if(_0xfd88c4[_0x2658('0x72')][_0x2658('0x73')]&&_0xfd88c4['query'][_0x2658('0x73')][_0x2658('0x74')]('globalStatus')){_0x3eb373=_0xfd88c4['query']['sort'];_0xfd88c4['query'][_0x2658('0x73')]='';}Promise['resolve']()[_0x2658('0x14')](function(){var _0x13656a=_['map'](db[_0x2658('0x44')][_0x2658('0x75')],function(_0xe760ee){return{'name':_0xe760ee[_0x2658('0x76')],'type':_0xe760ee[_0x2658('0x77')][_0x2658('0x78')]};});_0xfd88c4[_0x2658('0x72')][_0x2658('0x79')]=_0x2658('0x7a');_0xfd88c4[_0x2658('0x72')][_0x2658('0x42')]=!![];_0x15d870=qs['getOptions'](_0x13656a,_0xfd88c4);_0x15d870[_0x2658('0x7b')]=!![];if(_0xfd88c4[_0x2658('0x7c')][_0x2658('0x79')]===_0x2658('0x7c')){var _0x5c3586={'params':{'id':_0xfd88c4[_0x2658('0x7c')]['userProfileId']},'query':{'section':_0x2658('0x13'),'role':_0x2658('0x7a'),'online':!![],'nolimit':_0xfd88c4[_0x2658('0x72')][_0x2658('0x7d')],'sort':_0xfd88c4[_0x2658('0x72')][_0x2658('0x73')],'filter':_0xfd88c4[_0x2658('0x72')][_0x2658('0x7e')],'raw':!![]}};return db[_0x2658('0x7f')][_0x2658('0x80')](_0x5c3586);}return db['User']['findAndCountAll'](_0x15d870);})[_0x2658('0x14')](function(_0x3dc518){_0x4a5f4a['count']=_0x3dc518[_0x2658('0xa')];_0x2ea8e9=_0x3dc518['rows'];return getRealtimeAgents();})[_0x2658('0x14')](function(_0x270dcf){_0x32ef1c=_0x270dcf[_0x2658('0x81')];return _0x2ea8e9[_0x2658('0x34')](function(_0x3836a7){var _0x21624d=_[_0x2658('0x3d')](_0x32ef1c,['id',_0x3836a7['id']]);if(_0x21624d)_[_0x2658('0x39')](_0x3836a7,_[_0x2658('0x3a')](_[_0x2658('0x82')](_0x21624d,_0x3e7db6),_0x1c7f56));_0x3836a7[_0x2658('0x83')]=getAgentStatus(_0x3836a7);return _0x3836a7;});})[_0x2658('0x14')](function(_0x150ca6){if(_0x3eb373[_0x2658('0x74')](_0x2658('0x83'))){var _0x253f23;if(_0x3eb373[_0x2658('0x74')]('-'))_0x253f23=_[_0x2658('0x84')](_0x150ca6,_0x2658('0x83'),'desc');else _0x253f23=_[_0x2658('0x84')](_0x150ca6,'globalStatus',_0x2658('0x85'));return _0x253f23;}return _0x150ca6;})[_0x2658('0x14')](function(_0x26fe53){if(_0xfd88c4[_0x2658('0x72')][_0x2658('0x86')]){var _0x582b8b=_[_0x2658('0x7e')](_0x26fe53,[_0x2658('0x83'),_0xfd88c4[_0x2658('0x72')][_0x2658('0x86')]]);if(_0xfd88c4[_0x2658('0x72')][_0x2658('0x87')]){_0x582b8b=_['filter'](_0x582b8b,[_0x2658('0x88'),_0xfd88c4[_0x2658('0x72')]['pauseTypeFilter']]);}}_0x4a5f4a[_0x2658('0x81')]=_0x582b8b||_0x26fe53;return _0x4a5f4a;})['then'](respondWithFilteredResult(_0x5e90f0,_0x15d870))[_0x2658('0x17')](handleError(_0x5e90f0,null));};exports[_0x2658('0x89')]=function(_0xe5efe7,_0x35376b){var _0x51244b=[_0x2658('0x8a'),_0x2658('0x8b'),_0x2658('0x8c'),_0x2658('0x8d'),_0x2658('0x8e'),_0x2658('0x8f'),_0x2658('0x20')];var _0x141a5c={'count':0x0,'rows':[]},_0x10dfd4={},_0x213b6a,_0x3f8687,_0x1c45fe,_0x507c75,_0x3582ef;Promise[_0x2658('0x90')]()[_0x2658('0x14')](function(){if(_0xe5efe7['query'][_0x2658('0x91')]){if(!_[_0x2658('0x74')](_0x51244b,_0xe5efe7[_0x2658('0x72')][_0x2658('0x91')][_0x2658('0x92')]()))throw new Error('Invalid\x20channel');_0x213b6a=_0xe5efe7[_0x2658('0x72')][_0x2658('0x91')][_0x2658('0x92')]();}var _0x297c7c=_[_0x2658('0x18')](_0x213b6a)+'Queue';var _0x2769b9=_[_0x2658('0x34')](db[_0x297c7c][_0x2658('0x75')],function(_0x3079e9){return{'name':_0x3079e9[_0x2658('0x76')],'type':_0x3079e9[_0x2658('0x77')][_0x2658('0x78')]};});_0x10dfd4=qs[_0x2658('0x93')](_0x2769b9,_0xe5efe7);if(_0xe5efe7['user'][_0x2658('0x79')]==='user'){var _0x5ea88c={'params':{'id':_0xe5efe7[_0x2658('0x7c')]['userProfileId']},'query':{'section':_0x213b6a===_0x2658('0x20')&&_0xe5efe7[_0x2658('0x72')][_0x2658('0x77')]===_0x2658('0x21')?_0x2658('0x94'):_[_0x2658('0x18')](_0x213b6a)+_0x2658('0x19'),'type':_0xe5efe7[_0x2658('0x72')][_0x2658('0x77')],'nolimit':!![],'sort':_0x2658('0x10'),'filter':_0xe5efe7['query'][_0x2658('0x7e')]}};return db[_0x2658('0x7f')][_0x2658('0x80')](_0x5ea88c);}return db[_0x297c7c][_0x2658('0x95')](_0x10dfd4);})[_0x2658('0x14')](function(_0x59018c){_0x141a5c['count']=_0x59018c[_0x2658('0xa')];_0x3f8687=_0x59018c['rows'];return getRealtimeQueues(_0xe5efe7,_0x213b6a);})[_0x2658('0x14')](function(_0x155d13){_0x507c75=_0x155d13[_0x2658('0x81')];return getRealtimeAgents();})[_0x2658('0x14')](function(_0x1d4922){_0x1c45fe=_0x1d4922[_0x2658('0x81')];if(_0x213b6a!=_0x2658('0x20'))return;return getRealtimeVoiceQueueChannels();})[_0x2658('0x14')](function(_0x1b7cb6){_0x3582ef=_0x1b7cb6?_0x1b7cb6[_0x2658('0x81')]:[];return initializeQueues(_0x3f8687,_0x507c75,_0x213b6a,_0xe5efe7[_0x2658('0x72')]['type']);})[_0x2658('0x14')](function(_0xdcda23){var _0x4b5f18=_0xdcda23[_0x2658('0x34')](function(_0x472a43){if(_0x213b6a===_0x2658('0x20'))return getVoiceQueueAgents(_0x472a43,_0x3f8687,_0x1c45fe,_0x3582ef);else return getQueueAgents(_0x472a43,_0x1c45fe,_0x213b6a);});return Promise[_0x2658('0x96')](_0x4b5f18);})[_0x2658('0x14')](function(_0x20968e){_0x141a5c[_0x2658('0x81')]=_0x20968e;return _0x141a5c;})['then'](respondWithFilteredResult(_0x35376b,_0x10dfd4))[_0x2658('0x17')](handleError(_0x35376b,null));}; \ No newline at end of file +var _0x1ed5=['loggedInDb','loggedIn','waiting','busy','find','merge','pick','queue','some','internal','getMembers','UserId','accountcode','online','agents','User','Queue','Pause','QueueId','length','idle','ringing','isNil','faxPause','mailPause','smsPause','whatsappPause','every','filter','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','*pause','getAgents','userpic','lastPauseAt','address','voicePause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','chatPause','openchannelPause','query','sort','includes','globalStatus','resolve','rawAttributes','fieldName','key','role','agent','getOptions','raw','user','userProfileId','nolimit','UserProfile','getResources','rows','omit','desc','orderBy','asc','globalStatusFilter','pauseType','pauseTypeFilter','getQueues','mail','chat','fax','whatsapp','channel','toLowerCase','Invalid\x20channel','type','QueueCampaigns','Queues','findAndCountAll','all','lodash','jayson/promise','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','voice','startCase','format','VoiceQueuesChannels','available','talking','paused','outbound','push','pTalking','originated','message','dialMethod','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x1ed5,0x19e));var _0x51ed=function(_0x3cfd57,_0x537cf5){_0x3cfd57=_0x3cfd57-0x0;var _0x527d26=_0x1ed5[_0x3cfd57];return _0x527d26;};'use strict';var util=require('util');var _=require(_0x51ed('0x0'));var jayson=require(_0x51ed('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x51ed('0x2'))(_0x51ed('0x3'));var db=require(_0x51ed('0x4'))['db'];var amiClient=jayson[_0x51ed('0x5')][_0x51ed('0x6')]({'port':0x232a});var routingClient=jayson[_0x51ed('0x5')][_0x51ed('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x23a372,_0x5cd91c){return function(_0x1c9b91){if(_0x1c9b91){var _0x431570=typeof _0x5cd91c['offset']==='undefined'&&typeof _0x5cd91c[_0x51ed('0x7')]===_0x51ed('0x8');var _0x560152=_0x1c9b91[_0x51ed('0x9')];var _0x5d246e=_0x431570?0x0:_0x5cd91c['offset'];var _0x539433=_0x431570?_0x1c9b91[_0x51ed('0x9')]:_0x5cd91c['offset']+_0x5cd91c['limit'];var _0x54b684;if(_0x539433>=_0x560152){_0x539433=_0x560152;_0x54b684=0xc8;}else{_0x54b684=0xce;}_0x23a372[_0x51ed('0xa')](_0x54b684);return _0x23a372[_0x51ed('0xb')](_0x51ed('0xc'),_0x5d246e+'-'+_0x539433+'/'+_0x560152)[_0x51ed('0xd')](_0x1c9b91);}return null;};}function handleError(_0x33fbb2,_0x40c600){_0x40c600=_0x40c600||0x1f4;return function(_0x233edf){logger[_0x51ed('0xe')](_0x233edf[_0x51ed('0xf')]);if(_0x233edf[_0x51ed('0x10')]){delete _0x233edf['name'];}_0x33fbb2[_0x51ed('0xa')](_0x40c600)[_0x51ed('0x11')](_0x233edf);};}function getRealtimeAgents(){return new Promise(function(_0x4d2d60,_0x1aa281){return amiClient[_0x51ed('0x12')](_0x51ed('0x13'),{})[_0x51ed('0x14')](function(_0x2f5a49){if(_0x2f5a49[_0x51ed('0xe')])throw new Error(_0x51ed('0x15'));var _0x49da8a=_0x2f5a49['result'];return routingClient[_0x51ed('0x12')](_0x51ed('0x13'),{})['then'](function(_0x3334ec){if(_0x3334ec[_0x51ed('0xe')])throw new Error(_0x51ed('0x16'));var _0x1366e2=_0x3334ec[_0x51ed('0x17')];return _0x4d2d60(_['merge']({},_0x49da8a,_0x1366e2));});})[_0x51ed('0x18')](function(_0x46c120){_0x1aa281(_0x46c120);});});}function getRealtimeQueues(_0x4e01f1,_0x2ae569){return new Promise(function(_0x1a6f48,_0x4f6758){var _0x2219fc=_0x2ae569===_0x51ed('0x19')?amiClient:routingClient;return _0x2219fc[_0x51ed('0x12')](_[_0x51ed('0x1a')](_0x2ae569)+'Queues',_0x4e01f1)[_0x51ed('0x14')](function(_0x8f0694){if(_0x8f0694[_0x51ed('0xe')])throw new Error(util[_0x51ed('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x2ae569));return _0x1a6f48(_0x8f0694[_0x51ed('0x17')]);})[_0x51ed('0x18')](function(_0xd7e766){_0x4f6758(_0xd7e766);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x44ca61,_0x24269b){return amiClient[_0x51ed('0x12')](_0x51ed('0x1c'),{})['then'](function(_0x213d92){if(_0x213d92['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x44ca61(_0x213d92[_0x51ed('0x17')]);})['catch'](function(_0x1c09aa){_0x24269b(_0x1c09aa);});});}function initializeQueues(_0x5b7c68,_0x245b08,_0x11140f,_0x70399e){var _0x5e1cc3=['loggedIn',_0x51ed('0x1d'),'waiting',_0x51ed('0x1e'),_0x51ed('0x1f')];if(_0x11140f===_0x51ed('0x19')&&_0x70399e===_0x51ed('0x20')){_0x5e1cc3[_0x51ed('0x21')](_0x51ed('0x22'),_0x51ed('0x23'),_0x51ed('0x24'),'dialActive',_0x51ed('0x25'),_0x51ed('0x26'),'startPredictive',_0x51ed('0x27'),_0x51ed('0x28'),'erlangCallToSecond',_0x51ed('0x29'),_0x51ed('0x2a'),'dialPredictiveInterval',_0x51ed('0x2b'),_0x51ed('0x2c'),_0x51ed('0x2d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x51ed('0x2e'),_0x51ed('0x2f'),_0x51ed('0x30'));}return _0x5b7c68[_0x51ed('0x31')](function(_0x3c3f5a){var _0x5d7f9e=_0x3c3f5a[_0x51ed('0x32')]({'plain':!![]});_0x5d7f9e['agents']=[];_0x5d7f9e[_0x51ed('0x1f')]=0x0;_0x5d7f9e[_0x51ed('0x33')]=0x0;_0x5d7f9e[_0x51ed('0x34')]=0x0;_0x5d7f9e[_0x51ed('0x1d')]=0x0;_0x5d7f9e[_0x51ed('0x35')]=0x0;if(_0x11140f===_0x51ed('0x19')){_0x5d7f9e[_0x51ed('0x1e')]=0x0;_0x5d7f9e[_0x51ed('0x36')]=0x0;if(_0x70399e===_0x51ed('0x20')){_0x5d7f9e['pTalking']=0x0;_0x5d7f9e['originated']=0x0;}}var _0x4e9eed=_[_0x51ed('0x37')](_0x245b08,['id',_0x5d7f9e['id']]);if(_0x4e9eed)_[_0x51ed('0x38')](_0x5d7f9e,_[_0x51ed('0x39')](_0x4e9eed,_0x5e1cc3));return _0x5d7f9e;});}function updateAgentVoiceStatus(_0x49d61f,_0x2f2ef0,_0x374981){var _0x29eb7e=_['filter'](_0x374981,[_0x51ed('0x3a'),_0x2f2ef0['name']]);if(_0x29eb7e['length']===0x0)return _0x49d61f[_0x51ed('0x36')]=!![];if(_[_0x51ed('0x3b')](_0x29eb7e,['connectedlinenum',_0x49d61f[_0x51ed('0x3c')]['toString']()]))return _0x49d61f[_0x51ed('0x1e')]=!![];if(!_0x49d61f[_0x51ed('0x1e')])return _0x49d61f[_0x51ed('0x36')]=!![];}function getVoiceQueueAgents(_0x4b51a6,_0x4927fa,_0x5e9271,_0x59c06f){var _0x46208f=_[_0x51ed('0x37')](_0x4927fa,['id',_0x4b51a6['id']]);if(!_0x46208f)return _0x4b51a6;return _0x46208f[_0x51ed('0x3d')]({'raw':!![]})[_0x51ed('0x14')](function(_0x25fed5){for(var _0x3ae335=0x0;_0x3ae335<_0x25fed5['length'];_0x3ae335++){var _0x48c2aa=_[_0x51ed('0x37')](_0x5e9271,['id',_0x25fed5[_0x3ae335][_0x51ed('0x3e')]]);if(!_0x48c2aa){_0x48c2aa={'id':_0x25fed5[_0x3ae335]['UserId'],'name':_0x25fed5[_0x3ae335][_0x51ed('0x3e')],'accountcode':'','online':![]};}var _0x246117={'id':_0x48c2aa['id'],'name':_0x48c2aa[_0x51ed('0x10')],'internal':_0x48c2aa[_0x51ed('0x3f')],'online':Boolean(_0x48c2aa[_0x51ed('0x40')]),'paused':Boolean(_0x25fed5[_0x3ae335]['paused'])};if(_0x48c2aa['voiceStatus']===_0x51ed('0x1e'))updateAgentVoiceStatus(_0x246117,_0x4b51a6,_0x59c06f);if(_0x246117[_0x51ed('0x40')])_0x4b51a6['loggedInDb']++;if(_0x246117['busy'])_0x4b51a6[_0x51ed('0x36')]++;if(_0x246117['paused']&&!_0x246117[_0x51ed('0x36')]&&!_0x246117[_0x51ed('0x1e')])_0x4b51a6[_0x51ed('0x1f')]++;_0x4b51a6[_0x51ed('0x41')][_0x51ed('0x21')](_0x246117);}return _0x4b51a6;});}function getQueueAgents(_0x34cb46,_0x412b8b,_0x186e77){var _0x4a67dd=_0x51ed('0x42')+_['startCase'](_0x186e77)+_0x51ed('0x43');var _0x6df4b7=_0x186e77+_0x51ed('0x44');return db[_0x4a67dd]['findAll']({'where':{[_['startCase'](_0x186e77)+_0x51ed('0x45')]:_0x34cb46['id']},'raw':!![]})[_0x51ed('0x14')](function(_0x22fcd3){for(var _0x42271c=0x0;_0x42271c<_0x22fcd3[_0x51ed('0x46')];_0x42271c++){var _0x279685=_[_0x51ed('0x37')](_0x412b8b,['id',_0x22fcd3[_0x42271c][_0x51ed('0x3e')]]);if(!_0x279685){_0x279685={'id':_0x22fcd3[_0x42271c][_0x51ed('0x3e')],'name':_0x22fcd3[_0x42271c][_0x51ed('0x3e')],'online':![],['pauseField']:![]};}var _0xde4cb={'id':_0x279685['id'],'name':_0x279685['name'],'online':Boolean(_0x279685['online']),'paused':Boolean(_0x279685[_0x6df4b7])};if(_0xde4cb[_0x51ed('0x40')])_0x34cb46[_0x51ed('0x33')]++;_0x34cb46[_0x51ed('0x41')][_0x51ed('0x21')](_0xde4cb);}return _0x34cb46;});}function isIdle(_0x33ad3c){return _0x33ad3c===_0x51ed('0x47')||_0x33ad3c==='unknown'||_0x33ad3c==='unavailable'||_0x33ad3c===_0x51ed('0x48')||_[_0x51ed('0x49')](_0x33ad3c);}function isAgentPaused(_0x55e277,_0xba81b2){var _0x116df0=[_0x55e277['chatPause'],_0x55e277[_0x51ed('0x4a')],_0x55e277[_0x51ed('0x4b')],_0x55e277['openchannelPause'],_0x55e277[_0x51ed('0x4c')],_0x55e277['voicePause'],_0x55e277[_0x51ed('0x4d')]];if(!_0xba81b2)return _[_0x51ed('0x4e')](_0x116df0);var _0x1bd35b=_[_0x51ed('0x4f')](_0x116df0);return _0x1bd35b[_0x51ed('0x46')]>0x0&&_0x1bd35b[_0x51ed('0x46')]<_0x116df0[_0x51ed('0x46')]?!![]:![];}function isAgentIdle(_0x4fd02d){if(_0x4fd02d[_0x51ed('0x50')]!=='idle'&&_0x4fd02d['voicePause']){_0x4fd02d[_0x51ed('0x50')]=_0x51ed('0x51');return![];}return _['every']([_0x4fd02d[_0x51ed('0x52')],_0x4fd02d[_0x51ed('0x53')],_0x4fd02d[_0x51ed('0x54')],_0x4fd02d[_0x51ed('0x55')],_0x4fd02d[_0x51ed('0x56')],_0x4fd02d[_0x51ed('0x50')],_0x4fd02d['whatsappStatus']],isIdle);}function getAgentStatus(_0x2ee208){var _0x4cd884='unknown';if(isAgentPaused(_0x2ee208))_0x4cd884=_0x51ed('0x51');else if(isAgentPaused(_0x2ee208,!![]))_0x4cd884=_0x51ed('0x57');else if(isAgentIdle(_0x2ee208))_0x4cd884=_0x51ed('0x47');else _0x4cd884=_0x51ed('0x36');return _0x4cd884;}exports[_0x51ed('0x58')]=function(_0x22687a,_0x351584){var _0x42ecd2='';var _0x44efa5={'count':0x0,'rows':[]},_0x12b340={},_0x28ea0b,_0x1e7efe,_0x4ea01a=[_0x51ed('0x59'),'online','lastLoginAt',_0x51ed('0x5a'),'pauseType',_0x51ed('0x5a'),_0x51ed('0x3c'),_0x51ed('0x5b'),'chatPause','openchannelPause',_0x51ed('0x4b'),'smsPause',_0x51ed('0x4d'),_0x51ed('0x4a'),_0x51ed('0x5c'),_0x51ed('0x5d'),_0x51ed('0x5e'),'mailCapacity',_0x51ed('0x5f'),_0x51ed('0x60'),_0x51ed('0x61'),_0x51ed('0x62'),_0x51ed('0x63'),_0x51ed('0x64'),_0x51ed('0x65'),_0x51ed('0x66'),_0x51ed('0x67'),_0x51ed('0x52'),'openchannelStatus','mailStatus',_0x51ed('0x56'),_0x51ed('0x68'),_0x51ed('0x53'),_0x51ed('0x50'),_0x51ed('0x69'),_0x51ed('0x6a'),_0x51ed('0x6b'),_0x51ed('0x6c'),_0x51ed('0x6d'),'faxStatusTime',_0x51ed('0x6e'),_0x51ed('0x3a'),'destconnectedlinenum',_0x51ed('0x6f'),_0x51ed('0x70'),_0x51ed('0x71'),_0x51ed('0x72')],_0x143d1a=[_0x51ed('0x73'),_0x51ed('0x74'),_0x51ed('0x4b'),_0x51ed('0x4c'),_0x51ed('0x4d'),_0x51ed('0x4a'),_0x51ed('0x5c'),_0x51ed('0x40')];if(_0x22687a[_0x51ed('0x75')]['sort']&&_0x22687a['query'][_0x51ed('0x76')][_0x51ed('0x77')](_0x51ed('0x78'))){_0x42ecd2=_0x22687a[_0x51ed('0x75')][_0x51ed('0x76')];_0x22687a['query']['sort']='';}Promise[_0x51ed('0x79')]()[_0x51ed('0x14')](function(){var _0x181f14=_[_0x51ed('0x31')](db['User'][_0x51ed('0x7a')],function(_0x225a71){return{'name':_0x225a71[_0x51ed('0x7b')],'type':_0x225a71['type'][_0x51ed('0x7c')]};});_0x22687a[_0x51ed('0x75')][_0x51ed('0x7d')]=_0x51ed('0x7e');_0x22687a[_0x51ed('0x75')][_0x51ed('0x40')]=!![];_0x12b340=qs[_0x51ed('0x7f')](_0x181f14,_0x22687a);_0x12b340[_0x51ed('0x80')]=!![];if(_0x22687a[_0x51ed('0x81')][_0x51ed('0x7d')]===_0x51ed('0x81')){var _0x27a77b={'params':{'id':_0x22687a['user'][_0x51ed('0x82')]},'query':{'section':'Agents','role':_0x51ed('0x7e'),'online':!![],'nolimit':_0x22687a[_0x51ed('0x75')][_0x51ed('0x83')],'sort':_0x22687a[_0x51ed('0x75')][_0x51ed('0x76')],'filter':_0x22687a['query'][_0x51ed('0x4f')],'raw':!![]}};return db[_0x51ed('0x84')][_0x51ed('0x85')](_0x27a77b);}return db[_0x51ed('0x42')]['findAndCountAll'](_0x12b340);})[_0x51ed('0x14')](function(_0x12070e){_0x44efa5[_0x51ed('0x9')]=_0x12070e[_0x51ed('0x9')];_0x28ea0b=_0x12070e['rows'];return getRealtimeAgents();})[_0x51ed('0x14')](function(_0x1489e8){_0x1e7efe=_0x1489e8[_0x51ed('0x86')];return _0x28ea0b[_0x51ed('0x31')](function(_0x51976b){var _0x2565bd=_[_0x51ed('0x37')](_0x1e7efe,['id',_0x51976b['id']]);if(_0x2565bd)_['merge'](_0x51976b,_[_0x51ed('0x39')](_[_0x51ed('0x87')](_0x2565bd,_0x143d1a),_0x4ea01a));_0x51976b[_0x51ed('0x78')]=getAgentStatus(_0x51976b);return _0x51976b;});})['then'](function(_0x101b9c){if(_0x42ecd2[_0x51ed('0x77')](_0x51ed('0x78'))){var _0x2c4736;if(_0x42ecd2['includes']('-'))_0x2c4736=_['orderBy'](_0x101b9c,_0x51ed('0x78'),_0x51ed('0x88'));else _0x2c4736=_[_0x51ed('0x89')](_0x101b9c,_0x51ed('0x78'),_0x51ed('0x8a'));return _0x2c4736;}return _0x101b9c;})[_0x51ed('0x14')](function(_0x1435ec){if(_0x22687a[_0x51ed('0x75')][_0x51ed('0x8b')]){var _0x30c6f8=_[_0x51ed('0x4f')](_0x1435ec,[_0x51ed('0x78'),_0x22687a[_0x51ed('0x75')]['globalStatusFilter']]);if(_0x22687a[_0x51ed('0x75')]['pauseTypeFilter']){_0x30c6f8=_[_0x51ed('0x4f')](_0x30c6f8,[_0x51ed('0x8c'),_0x22687a[_0x51ed('0x75')][_0x51ed('0x8d')]]);}}_0x44efa5[_0x51ed('0x86')]=_0x30c6f8||_0x1435ec;return _0x44efa5;})[_0x51ed('0x14')](respondWithFilteredResult(_0x351584,_0x12b340))[_0x51ed('0x18')](handleError(_0x351584,null));};exports[_0x51ed('0x8e')]=function(_0x560a57,_0xd199c1){var _0x44efd8=[_0x51ed('0x8f'),_0x51ed('0x90'),'sms','openchannel',_0x51ed('0x91'),_0x51ed('0x92'),_0x51ed('0x19')];var _0x48f1dd={'count':0x0,'rows':[]},_0x40df46={},_0x48f976,_0x9d9197,_0x434755,_0x661ead,_0x48d80b;Promise[_0x51ed('0x79')]()['then'](function(){if(_0x560a57[_0x51ed('0x75')][_0x51ed('0x93')]){if(!_[_0x51ed('0x77')](_0x44efd8,_0x560a57[_0x51ed('0x75')][_0x51ed('0x93')][_0x51ed('0x94')]()))throw new Error(_0x51ed('0x95'));_0x48f976=_0x560a57[_0x51ed('0x75')][_0x51ed('0x93')][_0x51ed('0x94')]();}var _0x5bc616=_['startCase'](_0x48f976)+'Queue';var _0x372509=_[_0x51ed('0x31')](db[_0x5bc616][_0x51ed('0x7a')],function(_0x2fb6b1){return{'name':_0x2fb6b1['fieldName'],'type':_0x2fb6b1[_0x51ed('0x96')][_0x51ed('0x7c')]};});_0x40df46=qs[_0x51ed('0x7f')](_0x372509,_0x560a57);if(_0x560a57[_0x51ed('0x81')][_0x51ed('0x7d')]===_0x51ed('0x81')){var _0x26d376={'params':{'id':_0x560a57[_0x51ed('0x81')][_0x51ed('0x82')]},'query':{'section':_0x48f976===_0x51ed('0x19')&&_0x560a57[_0x51ed('0x75')][_0x51ed('0x96')]==='outbound'?_0x51ed('0x97'):_[_0x51ed('0x1a')](_0x48f976)+_0x51ed('0x98'),'type':_0x560a57[_0x51ed('0x75')][_0x51ed('0x96')],'nolimit':!![],'sort':_0x51ed('0x10'),'filter':_0x560a57['query']['filter']}};return db[_0x51ed('0x84')][_0x51ed('0x85')](_0x26d376);}return db[_0x5bc616][_0x51ed('0x99')](_0x40df46);})[_0x51ed('0x14')](function(_0x13d716){_0x48f1dd[_0x51ed('0x9')]=_0x13d716['count'];_0x9d9197=_0x13d716[_0x51ed('0x86')];return getRealtimeQueues(_0x560a57,_0x48f976);})[_0x51ed('0x14')](function(_0x103cd1){_0x661ead=_0x103cd1['rows'];return getRealtimeAgents();})[_0x51ed('0x14')](function(_0x182954){_0x434755=_0x182954[_0x51ed('0x86')];if(_0x48f976!=_0x51ed('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0x51ed('0x14')](function(_0x391839){_0x48d80b=_0x391839?_0x391839[_0x51ed('0x86')]:[];return initializeQueues(_0x9d9197,_0x661ead,_0x48f976,_0x560a57[_0x51ed('0x75')][_0x51ed('0x96')]);})[_0x51ed('0x14')](function(_0x520886){var _0x1238af=_0x520886['map'](function(_0x5d5c24){if(_0x48f976===_0x51ed('0x19'))return getVoiceQueueAgents(_0x5d5c24,_0x9d9197,_0x434755,_0x48d80b);else return getQueueAgents(_0x5d5c24,_0x434755,_0x48f976);});return Promise[_0x51ed('0x9a')](_0x1238af);})[_0x51ed('0x14')](function(_0x106e38){_0x48f1dd[_0x51ed('0x86')]=_0x106e38;return _0x48f1dd;})[_0x51ed('0x14')](respondWithFilteredResult(_0xd199c1,_0x40df46))[_0x51ed('0x18')](handleError(_0xd199c1,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d613e21..52b45aa 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x17543f,_0x34a3aa){var _0x479c57=function(_0x10207e){while(--_0x10207e){_0x17543f['push'](_0x17543f['shift']());}};_0x479c57(++_0x34a3aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x101842,_0x4db31b){var _0x45ce04=function(_0x1754a3){while(--_0x1754a3){_0x101842['push'](_0x101842['shift']());}};_0x45ce04(++_0x4db31b);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3c4b0ed..11e7501 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 _0x68f5=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x1325b3,_0x110e5c){var _0x2c2d1b=function(_0x196b39){while(--_0x196b39){_0x1325b3['push'](_0x1325b3['shift']());}};_0x2c2d1b(++_0x110e5c);}(_0x68f5,0x11a));var _0x568f=function(_0x25c73d,_0x986f2b){_0x25c73d=_0x25c73d-0x0;var _0x4c0313=_0x68f5[_0x25c73d];return _0x4c0313;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'state':{'type':Sequelize[_0x568f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x568f('0x3')]},'uniqueid':{'type':Sequelize[_0x568f('0x4')]},'starttime':{'type':Sequelize[_0x568f('0x3')]},'responsetime':{'type':Sequelize[_0x568f('0x3')]},'ringtime':{'type':Sequelize[_0x568f('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x568f('0x4')]},'membername':{'type':Sequelize[_0x568f('0x4')]}}; \ No newline at end of file +var _0x4cb5=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cb5,0x8f));var _0x54cb=function(_0x219d15,_0x22b197){_0x219d15=_0x219d15-0x0;var _0x213946=_0x4cb5[_0x219d15];return _0x213946;};'use strict';var Sequelize=require(_0x54cb('0x0'));module[_0x54cb('0x1')]={'state':{'type':Sequelize[_0x54cb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x54cb('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x54cb('0x3')]},'starttime':{'type':Sequelize[_0x54cb('0x4')]},'responsetime':{'type':Sequelize[_0x54cb('0x4')]},'ringtime':{'type':Sequelize[_0x54cb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x54cb('0x3')]},'campaigntype':{'type':Sequelize[_0x54cb('0x3')]},'membername':{'type':Sequelize[_0x54cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6eda759..ba029f5 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 _0x3ff4=['moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x3ff4,0x1a9));var _0x43ff=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3ff4[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x43ff('0x0'));var util=require(_0x43ff('0x1'));var logger=require(_0x43ff('0x2'))(_0x43ff('0x3'));var moment=require(_0x43ff('0x4'));var BPromise=require(_0x43ff('0x5'));var rp=require(_0x43ff('0x6'));var fs=require('fs');var path=require(_0x43ff('0x7'));var rimraf=require('rimraf');var config=require(_0x43ff('0x8'));var attributes=require(_0x43ff('0x9'));module[_0x43ff('0xa')]=function(_0xd73480,_0x14e902){return _0xd73480['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf06=['bluebird','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0xaf06,0xd7));var _0x6af0=function(_0x3a6eba,_0x7db8ac){_0x3a6eba=_0x3a6eba-0x0;var _0x531c0a=_0xaf06[_0x3a6eba];return _0x531c0a;};'use strict';var _=require(_0x6af0('0x0'));var util=require(_0x6af0('0x1'));var logger=require(_0x6af0('0x2'))(_0x6af0('0x3'));var moment=require(_0x6af0('0x4'));var BPromise=require(_0x6af0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6af0('0x6'));var config=require('../../config/environment');var attributes=require(_0x6af0('0x7'));module[_0x6af0('0x8')]=function(_0x44f079,_0xa1bede){return _0x44f079[_0x6af0('0x9')](_0x6af0('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 3beed61..fc85b3b 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 _0x5c41=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x13b40b,_0x4d2e5e){var _0x203b91=function(_0x27d65e){while(--_0x27d65e){_0x13b40b['push'](_0x13b40b['shift']());}};_0x203b91(++_0x4d2e5e);}(_0x5c41,0x13a));var _0x15c4=function(_0x49c35b,_0xa0ca1f){_0x49c35b=_0x49c35b-0x0;var _0x5683be=_0x5c41[_0x49c35b];return _0x5683be;};'use strict';var _=require(_0x15c4('0x0'));var util=require('util');var moment=require(_0x15c4('0x1'));var BPromise=require(_0x15c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x15c4('0x4'));var logger=require(_0x15c4('0x5'))('rpc');var config=require(_0x15c4('0x6'));var jayson=require(_0x15c4('0x7'));var client=jayson[_0x15c4('0x8')][_0x15c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x268533,_0x19d485,_0x2e48a2){return new BPromise(function(_0x4709a7,_0x5862c7){return client[_0x15c4('0xa')](_0x268533,_0x2e48a2)[_0x15c4('0xb')](function(_0x120236){logger[_0x15c4('0xc')](_0x15c4('0xd'),_0x19d485,_0x15c4('0xe'));logger[_0x15c4('0xf')](_0x15c4('0x10'),_0x19d485,'request\x20sent',JSON['stringify'](_0x120236));if(_0x120236['error']){if(_0x120236[_0x15c4('0x11')][_0x15c4('0x12')]===0x1f4){logger[_0x15c4('0x11')](_0x15c4('0xd'),_0x19d485,_0x120236[_0x15c4('0x11')][_0x15c4('0x13')]);return _0x5862c7(_0x120236[_0x15c4('0x11')][_0x15c4('0x13')]);}logger['error'](_0x15c4('0xd'),_0x19d485,_0x120236['error'][_0x15c4('0x13')]);return _0x4709a7(_0x120236[_0x15c4('0x11')][_0x15c4('0x13')]);}else{logger[_0x15c4('0xc')](_0x15c4('0xd'),_0x19d485,'request\x20sent');_0x4709a7(_0x120236[_0x15c4('0x14')][_0x15c4('0x13')]);}})[_0x15c4('0x15')](function(_0x4e30fd){logger[_0x15c4('0x11')](_0x15c4('0xd'),_0x19d485,_0x4e30fd);_0x5862c7(_0x4e30fd);});});}exports[_0x15c4('0x16')]=function(_0x2056d4){var _0x2da622=this;return new Promise(function(_0x1d769a,_0x2ad76f){return db[_0x15c4('0x17')][_0x15c4('0x18')](_0x2056d4[_0x15c4('0x19')],{'raw':_0x2056d4[_0x15c4('0x1a')]?_0x2056d4[_0x15c4('0x1a')][_0x15c4('0x1b')]===undefined?!![]:![]:!![]})[_0x15c4('0xb')](function(_0x49f894){logger['info'](_0x15c4('0x16'),_0x2056d4);logger['debug'](_0x15c4('0x16'),_0x2056d4,JSON[_0x15c4('0x1c')](_0x49f894));_0x1d769a(_0x49f894);})['catch'](function(_0x3a2e58){logger[_0x15c4('0x11')](_0x15c4('0x16'),_0x3a2e58['message'],_0x2056d4);_0x2ad76f(_0x2da622[_0x15c4('0x11')](0x1f4,_0x3a2e58[_0x15c4('0x13')]));});});}; \ No newline at end of file +var _0x3456=['ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x3456,0x193));var _0x6345=function(_0x5a77fb,_0x2d2d59){_0x5a77fb=_0x5a77fb-0x0;var _0x6ca4fb=_0x3456[_0x5a77fb];return _0x6ca4fb;};'use strict';var _=require('lodash');var util=require(_0x6345('0x0'));var moment=require('moment');var BPromise=require(_0x6345('0x1'));var rs=require(_0x6345('0x2'));var fs=require('fs');var Redis=require(_0x6345('0x3'));var db=require(_0x6345('0x4'))['db'];var utils=require(_0x6345('0x5'));var logger=require(_0x6345('0x6'))(_0x6345('0x7'));var config=require(_0x6345('0x8'));var jayson=require(_0x6345('0x9'));var client=jayson[_0x6345('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468b9b,_0x3d2f15,_0x5b59dd){return new BPromise(function(_0x2a9926,_0x2748f2){return client[_0x6345('0xb')](_0x468b9b,_0x5b59dd)['then'](function(_0x2dec39){logger[_0x6345('0xc')](_0x6345('0xd'),_0x3d2f15,'request\x20sent');logger['debug'](_0x6345('0xe'),_0x3d2f15,'request\x20sent',JSON[_0x6345('0xf')](_0x2dec39));if(_0x2dec39[_0x6345('0x10')]){if(_0x2dec39[_0x6345('0x10')][_0x6345('0x11')]===0x1f4){logger['error'](_0x6345('0xd'),_0x3d2f15,_0x2dec39['error'][_0x6345('0x12')]);return _0x2748f2(_0x2dec39[_0x6345('0x10')][_0x6345('0x12')]);}logger['error'](_0x6345('0xd'),_0x3d2f15,_0x2dec39[_0x6345('0x10')][_0x6345('0x12')]);return _0x2a9926(_0x2dec39[_0x6345('0x10')][_0x6345('0x12')]);}else{logger[_0x6345('0xc')](_0x6345('0xd'),_0x3d2f15,'request\x20sent');_0x2a9926(_0x2dec39[_0x6345('0x13')]['message']);}})[_0x6345('0x14')](function(_0xe7e635){logger[_0x6345('0x10')](_0x6345('0xd'),_0x3d2f15,_0xe7e635);_0x2748f2(_0xe7e635);});});}exports[_0x6345('0x15')]=function(_0x13f424){var _0x35d5ea=this;return new Promise(function(_0x2e049d,_0x2d3978){return db[_0x6345('0x16')]['create'](_0x13f424[_0x6345('0x17')],{'raw':_0x13f424[_0x6345('0x18')]?_0x13f424['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb1bf9d){logger[_0x6345('0xc')](_0x6345('0x15'),_0x13f424);logger[_0x6345('0x19')](_0x6345('0x15'),_0x13f424,JSON[_0x6345('0xf')](_0xb1bf9d));_0x2e049d(_0xb1bf9d);})[_0x6345('0x14')](function(_0x3300f4){logger[_0x6345('0x10')](_0x6345('0x15'),_0x3300f4[_0x6345('0x12')],_0x13f424);_0x2d3978(_0x35d5ea[_0x6345('0x10')](0x1f4,_0x3300f4[_0x6345('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3967db7..2506afb 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 _0xa52b=['openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','agentCapacity','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa52b,0x6c));var _0xba52=function(_0x150266,_0x49da37){_0x150266=_0x150266-0x0;var _0x2170fb=_0xa52b[_0x150266];return _0x2170fb;};'use strict';var multer=require(_0xba52('0x0'));var util=require(_0xba52('0x1'));var path=require(_0xba52('0x2'));var express=require(_0xba52('0x3'));var router=express[_0xba52('0x4')]();var auth=require(_0xba52('0x5'));var controller=require(_0xba52('0x6'));router[_0xba52('0x7')]('/voice/channels',auth[_0xba52('0x8')](),controller[_0xba52('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xba52('0x8')](),controller[_0xba52('0xa')]);router[_0xba52('0x7')](_0xba52('0xb'),auth[_0xba52('0x8')](),controller[_0xba52('0xc')]);router[_0xba52('0x7')](_0xba52('0xd'),auth[_0xba52('0x8')](),controller[_0xba52('0xe')]);router[_0xba52('0x7')](_0xba52('0xf'),auth[_0xba52('0x8')](),controller[_0xba52('0x10')]);router['get'](_0xba52('0x11'),auth[_0xba52('0x8')](),controller['mailQueues']);router[_0xba52('0x7')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xba52('0x12')]);router[_0xba52('0x7')](_0xba52('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xba52('0x7')]('/sms/queues',auth[_0xba52('0x8')](),controller[_0xba52('0x14')]);router[_0xba52('0x7')](_0xba52('0x15'),auth['isAuthenticated'](),controller[_0xba52('0x16')]);router[_0xba52('0x7')](_0xba52('0x17'),auth[_0xba52('0x8')](),controller['faxQueues']);router[_0xba52('0x7')](_0xba52('0x18'),auth[_0xba52('0x8')](),controller[_0xba52('0x19')]);router[_0xba52('0x7')]('/voice/queues/channels',auth[_0xba52('0x8')](),controller[_0xba52('0x1a')]);router[_0xba52('0x7')](_0xba52('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xba52('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xba52('0x1c')]);router[_0xba52('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xba52('0x8')](),controller[_0xba52('0x1d')]);router[_0xba52('0x7')](_0xba52('0x1e'),auth[_0xba52('0x8')](),controller['showVoiceQueues']);router[_0xba52('0x1f')](_0xba52('0x1e'),auth['isAuthenticated'](),controller[_0xba52('0x20')]);router[_0xba52('0x7')](_0xba52('0x21'),auth['isAuthenticated'](),controller[_0xba52('0x22')]);router[_0xba52('0x7')](_0xba52('0x23'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0xba52('0x7')](_0xba52('0x24'),auth['isAuthenticated'](),controller[_0xba52('0x25')]);router[_0xba52('0x1f')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xba52('0x26')]);router['get']('/telephones',auth['isAuthenticated'](),controller[_0xba52('0x27')]);router[_0xba52('0x7')](_0xba52('0x28'),auth[_0xba52('0x8')](),controller[_0xba52('0x29')]);router[_0xba52('0x7')]('/campaigns',auth[_0xba52('0x8')](),controller[_0xba52('0x2a')]);router[_0xba52('0x7')](_0xba52('0x2b'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0xba52('0x7')](_0xba52('0x2c'),auth[_0xba52('0x8')](),controller[_0xba52('0x2d')]);router[_0xba52('0x7')](_0xba52('0x2e'),auth[_0xba52('0x8')](),controller[_0xba52('0x2f')]);router[_0xba52('0x7')](_0xba52('0x30'),auth[_0xba52('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xba52('0x7')](_0xba52('0x31'),auth[_0xba52('0x8')](),controller[_0xba52('0x32')]);router[_0xba52('0x7')](_0xba52('0x33'),auth[_0xba52('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xba52('0x7')](_0xba52('0x34'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xba52('0x35'),auth[_0xba52('0x8')](),controller[_0xba52('0x36')]);router[_0xba52('0x37')](_0xba52('0x38'),auth[_0xba52('0x8')](),controller[_0xba52('0x39')](_0xba52('0x3a')));router[_0xba52('0x7')](_0xba52('0x3b'),auth[_0xba52('0x8')](),controller[_0xba52('0x3c')]);router[_0xba52('0x37')](_0xba52('0x3d'),auth[_0xba52('0x8')](),controller['queueNotify'](_0xba52('0x3e')));router[_0xba52('0x7')](_0xba52('0x3f'),auth[_0xba52('0x8')](),controller['showChatQueues']);router[_0xba52('0x37')](_0xba52('0x40'),auth['isAuthenticated'](),controller[_0xba52('0x39')](_0xba52('0x41')));router[_0xba52('0x7')](_0xba52('0x42'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xba52('0x37')]('/openchannel/queues/:id/notify',auth[_0xba52('0x8')](),controller[_0xba52('0x39')]('openchannel'));router[_0xba52('0x7')](_0xba52('0x43'),auth[_0xba52('0x8')](),controller[_0xba52('0x44')]);router['post'](_0xba52('0x45'),auth[_0xba52('0x8')](),controller['queueNotify'](_0xba52('0x46')));router[_0xba52('0x37')](_0xba52('0x47'),auth['isAuthenticated'](),controller[_0xba52('0x39')](_0xba52('0x48')));router[_0xba52('0x7')](_0xba52('0x49'),auth[_0xba52('0x8')](),controller[_0xba52('0x4a')]);router['get'](_0xba52('0x4b'),auth[_0xba52('0x8')](),controller['showWhatsappQueues']);router['post'](_0xba52('0x4c'),auth[_0xba52('0x8')](),controller[_0xba52('0x4d')]);module[_0xba52('0x4e')]=router; \ No newline at end of file +var _0x7d3f=['openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','/agents','put','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions'];(function(_0x2f58d6,_0xf21881){var _0x1e1594=function(_0x517296){while(--_0x517296){_0x2f58d6['push'](_0x2f58d6['shift']());}};_0x1e1594(++_0xf21881);}(_0x7d3f,0x71));var _0xf7d3=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x7d3f[_0x113e32];return _0x4ff939;};'use strict';var multer=require(_0xf7d3('0x0'));var util=require('util');var path=require(_0xf7d3('0x1'));var express=require(_0xf7d3('0x2'));var router=express[_0xf7d3('0x3')]();var auth=require(_0xf7d3('0x4'));var controller=require(_0xf7d3('0x5'));router[_0xf7d3('0x6')](_0xf7d3('0x7'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xf7d3('0xa')]);router[_0xf7d3('0x6')](_0xf7d3('0xb'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0xc')]);router['get']('/voice/queues',auth[_0xf7d3('0x8')](),controller['voiceQueues']);router[_0xf7d3('0x6')](_0xf7d3('0xd'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0xe')]);router[_0xf7d3('0x6')](_0xf7d3('0xf'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x10')]);router[_0xf7d3('0x6')]('/mail/accounts',auth[_0xf7d3('0x8')](),controller['mailAccounts']);router[_0xf7d3('0x6')](_0xf7d3('0x11'),auth['isAuthenticated'](),controller[_0xf7d3('0x12')]);router[_0xf7d3('0x6')]('/sms/queues',auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x13')]);router['get'](_0xf7d3('0x14'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x15')]);router[_0xf7d3('0x6')](_0xf7d3('0x16'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x17')]);router[_0xf7d3('0x6')](_0xf7d3('0x18'),auth[_0xf7d3('0x8')](),controller['voiceQueuesPreview']);router[_0xf7d3('0x6')](_0xf7d3('0x19'),auth['isAuthenticated'](),controller[_0xf7d3('0x1a')]);router[_0xf7d3('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xf7d3('0x1b')]);router[_0xf7d3('0x6')](_0xf7d3('0x1c'),auth[_0xf7d3('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xf7d3('0x6')](_0xf7d3('0x1d'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x1e')]);router[_0xf7d3('0x6')](_0xf7d3('0x1f'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x20')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xf7d3('0x6')](_0xf7d3('0x21'),auth['isAuthenticated'](),controller['outbound']);router[_0xf7d3('0x6')](_0xf7d3('0x22'),auth[_0xf7d3('0x8')](),controller['outboundChannels']);router[_0xf7d3('0x6')](_0xf7d3('0x23'),auth[_0xf7d3('0x8')](),controller['agents']);router[_0xf7d3('0x24')]('/agents/:id/capacity',auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x25')]);router['get']('/telephones',auth['isAuthenticated'](),controller[_0xf7d3('0x26')]);router[_0xf7d3('0x6')](_0xf7d3('0x27'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x28')]);router[_0xf7d3('0x6')](_0xf7d3('0x29'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x2a')]);router[_0xf7d3('0x6')](_0xf7d3('0x2b'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x2c')]);router[_0xf7d3('0x6')]('/chat/queues/waitinginteractions',auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x2d')]);router[_0xf7d3('0x6')](_0xf7d3('0x2e'),auth[_0xf7d3('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xf7d3('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x2f')]);router[_0xf7d3('0x6')](_0xf7d3('0x30'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x31')]);router[_0xf7d3('0x6')](_0xf7d3('0x32'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x33')]);router[_0xf7d3('0x6')](_0xf7d3('0x34'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x35')]);router['get'](_0xf7d3('0x36'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x37')]);router[_0xf7d3('0x38')]('/mail/queues/:id/notify',auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x39')](_0xf7d3('0x3a')));router[_0xf7d3('0x6')](_0xf7d3('0x3b'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x3c')]);router[_0xf7d3('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf7d3('0x39')](_0xf7d3('0x3d')));router[_0xf7d3('0x6')](_0xf7d3('0x3e'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x3f')]);router[_0xf7d3('0x38')](_0xf7d3('0x40'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x39')](_0xf7d3('0x41')));router['get'](_0xf7d3('0x42'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x43')]);router[_0xf7d3('0x38')](_0xf7d3('0x44'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x39')](_0xf7d3('0x45')));router[_0xf7d3('0x6')](_0xf7d3('0x46'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x47')]);router[_0xf7d3('0x38')](_0xf7d3('0x48'),auth[_0xf7d3('0x8')](),controller[_0xf7d3('0x39')]('sms'));router[_0xf7d3('0x38')](_0xf7d3('0x49'),auth['isAuthenticated'](),controller[_0xf7d3('0x39')](_0xf7d3('0x4a')));router[_0xf7d3('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xf7d3('0x4b')]);router['get'](_0xf7d3('0x4c'),auth['isAuthenticated'](),controller[_0xf7d3('0x4d')]);router[_0xf7d3('0x38')](_0xf7d3('0x4e'),auth[_0xf7d3('0x8')](),controller['agentNotify']);module[_0xf7d3('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 15d7068..6061836 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 _0x326f=['VoiceQueuesChannelHangup','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','AgentCapacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','MessageId','From','agentTransferTimeout','bluebird','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup'];(function(_0x54e579,_0x1000c6){var _0x4013c4=function(_0x216b02){while(--_0x216b02){_0x54e579['push'](_0x54e579['shift']());}};_0x4013c4(++_0x1000c6);}(_0x326f,0xd1));var _0xf326=function(_0x5971d3,_0x207516){_0x5971d3=_0x5971d3-0x0;var _0x38bfc9=_0x326f[_0x5971d3];return _0x38bfc9;};'use strict';var BPromise=require(_0xf326('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0xf326('0x1'));var db=require(_0xf326('0x2'))['db'];var logger=require(_0xf326('0x3'))(_0xf326('0x4'));var jayson=require(_0xf326('0x5'));var amiClient=jayson[_0xf326('0x6')][_0xf326('0x7')]({'port':0x232a});var mailClient=jayson[_0xf326('0x6')][_0xf326('0x7')]({'port':0x232b});var routingClient=jayson[_0xf326('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){var _0x4c206c=_0x165f95?_0x165f95:amiClient;return _0x4c206c['request'](_0x3c254d,_0x3851eb)[_0xf326('0x8')](function(_0x1fc80e){if(_0x1fc80e[_0xf326('0x9')]){if(_0x1fc80e[_0xf326('0x9')][_0xf326('0xa')]===0x1f4){return _0x515bfa(_0x1fc80e['error'][_0xf326('0xb')]);}return _0x1e7b8a(_0x1fc80e['error'][_0xf326('0xb')]);}else{_0x1e7b8a(_0x1fc80e['result']);}})[_0xf326('0xc')](function(_0x518ab5){_0x515bfa(_0x518ab5);});});}function respondWithResult(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xc8;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0xd')](_0x9ed463)[_0xf326('0xe')](_0x4b3966);}return _0x3162f9[_0xf326('0xf')](0x194);};}function handleError(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0x1f4;return function(_0x45c1b6){logger['error'](_0x45c1b6['stack']);if(_0x45c1b6[_0xf326('0x10')]){delete _0x45c1b6[_0xf326('0x10')];}_0x17a098[_0xf326('0xd')](_0x5c8483)[_0xf326('0x11')](_0x45c1b6);};}function findById(_0x292f4b){return function(_0x287a2a){if(!_[_0xf326('0x12')](_0x292f4b)&&!_[_0xf326('0x12')](_0x287a2a)&&!_['isNil'](_0x287a2a[_0xf326('0x13')])){return _[_0xf326('0x14')](_0x287a2a[_0xf326('0x13')],function(_0x31ffb9){return _0x31ffb9['id']==_0x292f4b;});}return null;};}exports[_0xf326('0x15')]=function(_0x311af0,_0x4d3d41){return respondWithRpcPromise('VoiceChannels',_0x311af0['query'])[_0xf326('0x8')](respondWithResult(_0x4d3d41,null))[_0xf326('0xc')](handleError(_0x4d3d41,null));};exports['voiceChannelMixMonitor']=function(_0x4cabce,_0x128c68){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x4cabce[_0xf326('0x16')],_0x4cabce[_0xf326('0x17')]))['then'](respondWithResult(_0x128c68,null))['catch'](handleError(_0x128c68,null));};exports[_0xf326('0x18')]=function(_0xb1efcf,_0x5f21a2){return respondWithRpcPromise(_0xf326('0x19'),_[_0xf326('0x1a')](_0xb1efcf[_0xf326('0x16')],_0xb1efcf[_0xf326('0x17')]))[_0xf326('0x8')](respondWithResult(_0x5f21a2,null))[_0xf326('0xc')](handleError(_0x5f21a2,null));};exports['voiceQueues']=function(_0x55b9f4,_0x4f31f6){return respondWithRpcPromise(_0xf326('0x1b'),_0x55b9f4[_0xf326('0x16')])[_0xf326('0x8')](respondWithResult(_0x4f31f6,null))[_0xf326('0xc')](handleError(_0x4f31f6,null));};exports[_0xf326('0x1c')]=function(_0x410237,_0x5217d4){return respondWithRpcPromise(_0xf326('0x1b'),_0x410237[_0xf326('0x16')])[_0xf326('0x8')](findById(_0x410237['params']['id']))[_0xf326('0x8')](respondWithResult(_0x5217d4,null))['catch'](handleError(_0x5217d4,null));};exports['updateVoiceQueue']=function(_0x6a8e89,_0x1ae23a){return respondWithRpcPromise(_0xf326('0x1d'),_['merge'](_0x6a8e89[_0xf326('0x1e')],_0x6a8e89[_0xf326('0x17')]))['then'](respondWithResult(_0x1ae23a,null))[_0xf326('0xc')](handleError(_0x1ae23a,null));};exports[_0xf326('0x1f')]=function(_0xd77aba,_0x18d110){return respondWithRpcPromise(_0xf326('0x20'),_[_0xf326('0x1a')](_0xd77aba[_0xf326('0x16')],_0xd77aba[_0xf326('0x17')]))[_0xf326('0x8')](respondWithResult(_0x18d110,null))[_0xf326('0xc')](handleError(_0x18d110,null));};exports['voiceQueuesChannels']=function(_0x1035ed,_0x424104){return respondWithRpcPromise(_0xf326('0x21'),_0x1035ed['query'])[_0xf326('0x8')](respondWithResult(_0x424104,null))[_0xf326('0xc')](handleError(_0x424104,null));};exports[_0xf326('0x22')]=function(_0x4df451,_0x5b101d){return respondWithRpcPromise(_0xf326('0x23'),_[_0xf326('0x1a')](_0x4df451[_0xf326('0x16')],_0x4df451[_0xf326('0x17')]))[_0xf326('0x8')](respondWithResult(_0x5b101d,null))[_0xf326('0xc')](handleError(_0x5b101d,null));};exports[_0xf326('0x24')]=function(_0x2d5f20,_0x580374){return respondWithRpcPromise(_0xf326('0x25'),_[_0xf326('0x1a')](_0x2d5f20['query'],_0x2d5f20[_0xf326('0x17')]))['then'](respondWithResult(_0x580374,null))[_0xf326('0xc')](handleError(_0x580374,null));};exports['voiceQueuesChannelRedirect']=function(_0x51f147,_0xadb020){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xf326('0x1a')](_0x51f147['query'],_0x51f147[_0xf326('0x17')]))[_0xf326('0x8')](respondWithResult(_0xadb020,null))[_0xf326('0xc')](handleError(_0xadb020,null));};exports['outbound']=function(_0x3dcc7e,_0x4095e6){return respondWithRpcPromise('Outbound',_0x3dcc7e[_0xf326('0x16')])[_0xf326('0x8')](respondWithResult(_0x4095e6,null))[_0xf326('0xc')](handleError(_0x4095e6,null));};exports[_0xf326('0x26')]=function(_0x51076c,_0x2c4416){return respondWithRpcPromise(_0xf326('0x27'),_0x51076c[_0xf326('0x16')])[_0xf326('0x8')](respondWithResult(_0x2c4416,null))[_0xf326('0xc')](handleError(_0x2c4416,null));};exports['agents']=function(_0x3e830d,_0x1b7bf6){var _0x5cfb97;return respondWithRpcPromise('Agents',_0x3e830d[_0xf326('0x16')])['then'](function(_0x55dfa8){_0x5cfb97=_0x55dfa8;return respondWithRpcPromise(_0xf326('0x28'),_0x3e830d['query'],routingClient);})[_0xf326('0x8')](function(_0x37a95b){return _[_0xf326('0x1a')]({},_0x37a95b,_0x5cfb97);})[_0xf326('0x8')](respondWithResult(_0x1b7bf6,null))['catch'](handleError(_0x1b7bf6,null));};exports[_0xf326('0x29')]=function(_0x45d344,_0x347e7b){if(_0x45d344[_0xf326('0x1e')]&&_0x45d344[_0xf326('0x1e')][_0xf326('0x2a')]&&_0x45d344[_0xf326('0x2b')]&&_0x45d344[_0xf326('0x2b')][_0xf326('0x10')]){for(var _0x1227d3 in _0x45d344[_0xf326('0x1e')][_0xf326('0x2a')]){if(_0x45d344['body'][_0xf326('0x2a')][_0xf326('0x2c')](_0x1227d3)){db[_0xf326('0x2d')][_0xf326('0x2e')]({'where':{'channel':_0x1227d3,'membername':_0x45d344[_0xf326('0x2b')][_0xf326('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x45d344[_0xf326('0x1e')][_0xf326('0x2a')][_0x1227d3]&&_0x45d344['body'][_0xf326('0x2a')][_0x1227d3][_0xf326('0x2f')]?{'$notIn':_0x45d344[_0xf326('0x1e')][_0xf326('0x2a')][_0x1227d3]}:{'$ne':null}}})[_0xf326('0x8')](function(_0x55361f){var _0x505344=moment()[_0xf326('0x30')](_0xf326('0x31'));for(var _0x5ed62e=0x0,_0x4bd865=_0x55361f[_0xf326('0x2f')];_0x5ed62e<_0x4bd865;_0x5ed62e+=0x1){_0x55361f[_0x5ed62e][_0xf326('0x32')]({'exitAt':_0x505344});}});for(var _0x21c98e=0x0;_0x21c98e<_0x45d344['body'][_0xf326('0x2a')][_0x1227d3][_0xf326('0x2f')];_0x21c98e+=0x1){db[_0xf326('0x2d')][_0xf326('0x33')]({'where':{'channel':_0x1227d3,'membername':_0x45d344[_0xf326('0x2b')][_0xf326('0x10')],'type':_0xf326('0x34'),'uniqueid':_0x45d344[_0xf326('0x1e')][_0xf326('0x2a')][_0x1227d3][_0x21c98e],'exitAt':null},'defaults':{'channel':_0x1227d3,'membername':_0x45d344[_0xf326('0x2b')][_0xf326('0x10')],'interface':_[_0xf326('0x12')](_0x45d344[_0xf326('0x2b')][_0xf326('0x35')])?util[_0xf326('0x30')]('SIP/%s',_0x45d344[_0xf326('0x2b')][_0xf326('0x10')]):_0x45d344[_0xf326('0x2b')][_0xf326('0x35')],'type':'INTERACTION','enterAt':moment()[_0xf326('0x30')](_0xf326('0x31')),'role':_0xf326('0x36'),'internal':_0x45d344[_0xf326('0x2b')]['internal'],'uniqueid':_0x45d344[_0xf326('0x1e')][_0xf326('0x2a')][_0x1227d3][_0x21c98e]}});}}}}return respondWithRpcPromise(_0xf326('0x37'),{'id':_0x45d344[_0xf326('0x17')]['id'],'capacity':_0x45d344[_0xf326('0x1e')]['capacity']},routingClient)['then'](respondWithResult(_0x347e7b,null))[_0xf326('0xc')](handleError(_0x347e7b,null));};exports[_0xf326('0x38')]=function(_0x2ff126,_0x4cb25b){return respondWithRpcPromise(_0xf326('0x39'),_0x2ff126[_0xf326('0x16')])[_0xf326('0x8')](respondWithResult(_0x4cb25b,null))['catch'](handleError(_0x4cb25b,null));};exports['trunks']=function(_0x36ef89,_0x5b4832){return respondWithRpcPromise(_0xf326('0x3a'),_0x36ef89['query'])[_0xf326('0x8')](respondWithResult(_0x5b4832,null))[_0xf326('0xc')](handleError(_0x5b4832,null));};exports[_0xf326('0x3b')]=function(_0x25e091,_0x212594){return respondWithRpcPromise(_0xf326('0x3c'),_0x25e091[_0xf326('0x16')])['then'](respondWithResult(_0x212594,null))[_0xf326('0xc')](handleError(_0x212594,null));};exports[_0xf326('0x3d')]=function(_0x424d24,_0x4b0d8e){return respondWithRpcPromise(_0xf326('0x3e'),_0x424d24[_0xf326('0x16')],routingClient)[_0xf326('0x8')](respondWithResult(_0x4b0d8e,null))[_0xf326('0xc')](handleError(_0x4b0d8e,null));};exports[_0xf326('0x3f')]=function(_0x58fcf0,_0x161fb3){return respondWithRpcPromise(_0xf326('0x3e'),_0x58fcf0[_0xf326('0x16')],routingClient)[_0xf326('0x8')](findById(_0x58fcf0['params']['id']))[_0xf326('0x8')](respondWithResult(_0x161fb3,null))[_0xf326('0xc')](handleError(_0x161fb3,null));};exports[_0xf326('0x40')]=function(_0x29e52e,_0x4d3b9e){return respondWithRpcPromise('MailQueues',_0x29e52e[_0xf326('0x16')],routingClient)[_0xf326('0x8')](respondWithResult(_0x4d3b9e,null))['catch'](handleError(_0x4d3b9e,null));};exports[_0xf326('0x41')]=function(_0x29de71,_0x316609){return respondWithRpcPromise(_0xf326('0x42'),_0x29de71['query'],routingClient)[_0xf326('0x8')](findById(_0x29de71['params']['id']))['then'](respondWithResult(_0x316609,null))[_0xf326('0xc')](handleError(_0x316609,null));};exports['mailAccounts']=function(_0x173760,_0x52fb95){return respondWithRpcPromise(_0xf326('0x43'),_0x173760['query'],mailClient)['then'](respondWithResult(_0x52fb95,null))[_0xf326('0xc')](handleError(_0x52fb95,null));};exports[_0xf326('0x44')]=function(_0x33b259,_0x5d0177){return respondWithRpcPromise(_0xf326('0x45'),_0x33b259['query'],routingClient)[_0xf326('0x8')](respondWithResult(_0x5d0177,null))[_0xf326('0xc')](handleError(_0x5d0177,null));};exports[_0xf326('0x46')]=function(_0x217897,_0xbd3a01){return respondWithRpcPromise(_0xf326('0x45'),_0x217897[_0xf326('0x16')],routingClient)[_0xf326('0x8')](findById(_0x217897[_0xf326('0x17')]['id']))[_0xf326('0x8')](respondWithResult(_0xbd3a01,null))[_0xf326('0xc')](handleError(_0xbd3a01,null));};exports[_0xf326('0x47')]=function(_0x40f7cb,_0x4ca1b8){return respondWithRpcPromise(_0xf326('0x48'),_0x40f7cb['query'],routingClient)[_0xf326('0x8')](respondWithResult(_0x4ca1b8,null))[_0xf326('0xc')](handleError(_0x4ca1b8,null));};exports['showSmsQueues']=function(_0x2b770c,_0x5283da){return respondWithRpcPromise(_0xf326('0x48'),_0x2b770c[_0xf326('0x16')],routingClient)[_0xf326('0x8')](findById(_0x2b770c[_0xf326('0x17')]['id']))[_0xf326('0x8')](respondWithResult(_0x5283da,null))['catch'](handleError(_0x5283da,null));};exports['whatsappQueues']=function(_0x1209ca,_0x32fe3a){return respondWithRpcPromise(_0xf326('0x49'),_0x1209ca[_0xf326('0x16')],routingClient)[_0xf326('0x8')](respondWithResult(_0x32fe3a,null))['catch'](handleError(_0x32fe3a,null));};exports[_0xf326('0x4a')]=function(_0x471da8,_0x4aadc9){return respondWithRpcPromise('WhatsappQueues',_0x471da8['query'],routingClient)[_0xf326('0x8')](findById(_0x471da8[_0xf326('0x17')]['id']))[_0xf326('0x8')](respondWithResult(_0x4aadc9,null))[_0xf326('0xc')](handleError(_0x4aadc9,null));};exports[_0xf326('0x4b')]=function(_0x23a56e,_0x230aea){return respondWithRpcPromise('FaxQueues',_0x23a56e[_0xf326('0x16')],routingClient)[_0xf326('0x8')](respondWithResult(_0x230aea,null))[_0xf326('0xc')](handleError(_0x230aea,null));};exports[_0xf326('0x4c')]=function(_0x58de1e,_0x3717fe){return respondWithRpcPromise('FaxQueues',_0x58de1e['query'],routingClient)[_0xf326('0x8')](findById(_0x58de1e['params']['id']))[_0xf326('0x8')](respondWithResult(_0x3717fe,null))[_0xf326('0xc')](handleError(_0x3717fe,null));};exports[_0xf326('0x4d')]=function(_0x2ea5a2,_0x17cd36){return respondWithRpcPromise('FaxAccounts',_0x2ea5a2['query'])['then'](respondWithResult(_0x17cd36,null))[_0xf326('0xc')](handleError(_0x17cd36,null));};exports[_0xf326('0x4e')]=function(_0x229a34,_0x180616){return respondWithRpcPromise(_0xf326('0x4f'),_0x229a34['query'],routingClient)[_0xf326('0x8')](respondWithResult(_0x180616,null))[_0xf326('0xc')](handleError(_0x180616,null));};exports[_0xf326('0x50')]=function(_0x4f9a6a,_0x567492){return respondWithRpcPromise(_0xf326('0x51'),_0x4f9a6a[_0xf326('0x16')],routingClient)['then'](respondWithResult(_0x567492,null))['catch'](handleError(_0x567492,null));};exports[_0xf326('0x52')]=function(_0x5ba28d,_0xc3a897){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ba28d['query'],routingClient)['then'](respondWithResult(_0xc3a897,null))[_0xf326('0xc')](handleError(_0xc3a897,null));};exports[_0xf326('0x53')]=function(_0xd44071,_0x4838d5){return respondWithRpcPromise(_0xf326('0x54'),_0xd44071[_0xf326('0x16')],routingClient)[_0xf326('0x8')](function(_0x457f3d){if(_0xd44071[_0xf326('0x16')][_0xf326('0x55')]!==undefined){var _0x7f6d0e=_(_0x457f3d[_0xf326('0x13')])[_0xf326('0x56')]([_0xd44071['query'][_0xf326('0x55')],_0xd44071['params']['id']])[_0xf326('0x57')](_0xf326('0x58'))[_0xf326('0x59')]()['value']();return _0x457f3d[_0xf326('0x13')][_0xf326('0x56')](function(_0x39c90d){return _0x7f6d0e['indexOf'](_0x39c90d[_0xf326('0x58')])>-0x1;});}else{return _0x457f3d[_0xf326('0x13')][_0xf326('0x56')](function(_0x42c7cf){return _0x42c7cf['queue_id']===parseInt(_0xd44071[_0xf326('0x17')]['id']);});}})['then'](respondWithResult(_0x4838d5,null))['catch'](handleError(_0x4838d5,null));};exports[_0xf326('0x5a')]=function(_0x2c36d3,_0x5af6b7){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c36d3['query'],routingClient)[_0xf326('0x8')](respondWithResult(_0x5af6b7,null))['catch'](handleError(_0x5af6b7,null));};exports[_0xf326('0x5b')]=function(_0x37a564,_0x3434b2){return respondWithRpcPromise(_0xf326('0x5c'),_0x37a564[_0xf326('0x16')],routingClient)[_0xf326('0x8')](respondWithResult(_0x3434b2,null))['catch'](handleError(_0x3434b2,null));};exports[_0xf326('0x5d')]=function(_0x323926,_0x5f1724){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x323926[_0xf326('0x16')],routingClient)['then'](respondWithResult(_0x5f1724,null))[_0xf326('0xc')](handleError(_0x5f1724,null));};exports[_0xf326('0x5e')]=function(_0x153027){return function(_0x363e64,_0x19d676){var _0x6e662,_0x293600;var _0x8ca46f=_[_0xf326('0x5f')](_0x153027);var _0x499cbd=_0x153027===_0xf326('0x60')?_0xf326('0x61'):'Account';return db[_0x8ca46f+_0xf326('0x62')]['findOne']({'raw':!![],'where':{'id':_0x363e64[_0xf326('0x17')]['id']}})[_0xf326('0x8')](function(_0x14e8c0){if(_['isNil'](_0x14e8c0)){throw new Error(_0x8ca46f+_0xf326('0x63'));}_0x6e662=_0x14e8c0;return db[_0x8ca46f+_0xf326('0x64')][_0xf326('0x65')]({'where':{'id':_0x363e64[_0xf326('0x1e')][_0xf326('0x66')]},'include':[{'model':db[_0x8ca46f+_0xf326('0x67')],'as':_0xf326('0x67')},{'model':db[_0x8ca46f+_0x499cbd],'as':_0xf326('0x68')}]});})[_0xf326('0x8')](function(_0x38b696){if(_[_0xf326('0x12')](_0x38b696)){throw new Error(_0x8ca46f+_0xf326('0x69'));}_0x293600=_0x38b696;return _0x38b696[_0xf326('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf326('0x8')](function(){var _0x1f990d={'uniqueid':_0x153027+'.'+_0x293600['id']+'.'+_0x293600['Interaction']['id'],'FromUserId':_0x363e64[_0xf326('0x2b')]['id'],'type':_0xf326('0x6b')};_0x1f990d[_0x8ca46f+'MessageId']=_0x293600['id'];_0x1f990d[_0x8ca46f+_0xf326('0x6c')]=_0x293600[_0xf326('0x67')]['id'];_0x1f990d['From'+_0x8ca46f+_0x499cbd+'Id']=_0x293600[_0xf326('0x68')]['id'];_0x1f990d['To'+_0x8ca46f+_0xf326('0x6d')]=_0x6e662['id'];return db[_0x8ca46f+_0xf326('0x6e')][_0xf326('0x6f')](_0x1f990d);})[_0xf326('0x8')](function(){return respondWithRpcPromise(_0xf326('0x70'),{'channel':_0x153027,'interaction':_0x293600[_0xf326('0x67')],'message':_0x293600,'account':_0x293600['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf326('0x6b'),'appdata':_0x6e662[_0xf326('0x10')]+','+(_0x293600[_0xf326('0x68')][_0xf326('0x71')]||0x12c),'interval':_0xf326('0x72')}]},routingClient);})[_0xf326('0x8')](respondWithResult(_0x19d676,null))[_0xf326('0xc')](handleError(_0x19d676,null));};};exports[_0xf326('0x73')]=function(_0x486e64,_0xa8e05b){var _0x2e2103,_0x49c3da;if(_[_0xf326('0x12')](_0x486e64['body'][_0xf326('0x74')])){throw new Error(_0xf326('0x75'));}var _0x16bc97=_0x486e64[_0xf326('0x1e')][_0xf326('0x74')];var _0x3097cf=_[_0xf326('0x5f')](_0x16bc97);var _0x1eb29d=_0x16bc97===_0xf326('0x60')?_0xf326('0x61'):_0xf326('0x68');return db[_0xf326('0x76')][_0xf326('0x65')]({'raw':!![],'where':{'id':_0x486e64[_0xf326('0x17')]['id'],'role':'agent'}})[_0xf326('0x8')](function(_0xdb6e40){if(_[_0xf326('0x12')](_0xdb6e40)){throw new Error(_0xf326('0x77'));}_0x2e2103=_0xdb6e40;return db[_0x3097cf+_0xf326('0x64')]['findOne']({'where':{'id':_0x486e64[_0xf326('0x1e')][_0xf326('0x66')]},'include':[{'model':db[_0x3097cf+_0xf326('0x67')],'as':_0xf326('0x67')},{'model':db[_0x3097cf+_0x1eb29d],'as':_0xf326('0x68')}]});})['then'](function(_0x4b6ec0){if(_[_0xf326('0x12')](_0x4b6ec0)){throw new Error(_0x3097cf+'\x20Message\x20not\x20found');}_0x49c3da=_0x4b6ec0;return _0x4b6ec0[_0xf326('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf326('0x8')](function(){var _0x29610a={'uniqueid':_0x16bc97+'.'+_0x49c3da['id']+'.'+_0x49c3da['Interaction']['id'],'FromUserId':_0x486e64['user']['id'],'type':_0xf326('0x6b'),'ToUserId':_0x2e2103['id']};_0x29610a[_0x3097cf+_0xf326('0x78')]=_0x49c3da['id'];_0x29610a[_0x3097cf+_0xf326('0x6c')]=_0x49c3da[_0xf326('0x67')]['id'];_0x29610a[_0xf326('0x79')+_0x3097cf+_0x1eb29d+'Id']=_0x49c3da['Account']['id'];return db[_0x3097cf+_0xf326('0x6e')][_0xf326('0x6f')](_0x29610a);})[_0xf326('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x16bc97,'interaction':_0x49c3da['Interaction'],'message':_0x49c3da,'account':_0x49c3da['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf326('0x36'),'appdata':_0x2e2103[_0xf326('0x10')]+','+(_0x49c3da[_0xf326('0x68')][_0xf326('0x7a')]||0x12c),'interval':_0xf326('0x72')}]},routingClient);})[_0xf326('0x8')](respondWithResult(_0xa8e05b,null))[_0xf326('0xc')](handleError(_0xa8e05b,null));}; \ No newline at end of file +var _0x7fbe=['VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','user','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','From','TransferReport','Start','agentTransferTimeout','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','stack','name','send','isNil','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','then','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0x7fbe[_0x3b826d];return _0x38e1b3;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var db=require(_0xe7fb('0x2'))['db'];var logger=require(_0xe7fb('0x3'))(_0xe7fb('0x4'));var jayson=require(_0xe7fb('0x5'));var amiClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232a});var mailClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232b});var routingClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){var _0x1d0741=_0x5ad75b?_0x5ad75b:amiClient;return _0x1d0741[_0xe7fb('0x8')](_0x24cd67,_0x1f943f)['then'](function(_0x558857){if(_0x558857[_0xe7fb('0x9')]){if(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xa')]===0x1f4){return _0x228f6b(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}return _0x213ebc(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}else{_0x213ebc(_0x558857[_0xe7fb('0xc')]);}})[_0xe7fb('0xd')](function(_0x2fe8ab){_0x228f6b(_0x2fe8ab);});});}function respondWithResult(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xc8;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0xe')](_0x188e1d)[_0xe7fb('0xf')](_0xdf9760);}return _0x2437d4['sendStatus'](0x194);};}function handleError(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0x1f4;return function(_0x5573ab){logger[_0xe7fb('0x9')](_0x5573ab[_0xe7fb('0x10')]);if(_0x5573ab['name']){delete _0x5573ab[_0xe7fb('0x11')];}_0x278b75['status'](_0x2225e5)[_0xe7fb('0x12')](_0x5573ab);};}function findById(_0x18d23c){return function(_0x12603d){if(!_[_0xe7fb('0x13')](_0x18d23c)&&!_['isNil'](_0x12603d)&&!_[_0xe7fb('0x13')](_0x12603d['rows'])){return _[_0xe7fb('0x14')](_0x12603d['rows'],function(_0x1e77fd){return _0x1e77fd['id']==_0x18d23c;});}return null;};}exports[_0xe7fb('0x15')]=function(_0x3f96a7,_0x182269){return respondWithRpcPromise('VoiceChannels',_0x3f96a7[_0xe7fb('0x16')])['then'](respondWithResult(_0x182269,null))[_0xe7fb('0xd')](handleError(_0x182269,null));};exports['voiceChannelMixMonitor']=function(_0x15f7a4,_0x4ea664){return respondWithRpcPromise(_0xe7fb('0x17'),_[_0xe7fb('0x18')](_0x15f7a4['query'],_0x15f7a4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x4ea664,null))[_0xe7fb('0xd')](handleError(_0x4ea664,null));};exports['voiceChannelStopMixMonitor']=function(_0x469d50,_0x469ead){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x469d50['query'],_0x469d50[_0xe7fb('0x19')]))['then'](respondWithResult(_0x469ead,null))['catch'](handleError(_0x469ead,null));};exports[_0xe7fb('0x1b')]=function(_0x32e8b2,_0x2996ae){return respondWithRpcPromise('VoiceQueues',_0x32e8b2[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2996ae,null))[_0xe7fb('0xd')](handleError(_0x2996ae,null));};exports[_0xe7fb('0x1c')]=function(_0x392d75,_0x16237a){return respondWithRpcPromise(_0xe7fb('0x1d'),_0x392d75['query'])['then'](findById(_0x392d75[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x16237a,null))[_0xe7fb('0xd')](handleError(_0x16237a,null));};exports['updateVoiceQueue']=function(_0xb1f2f4,_0x251807){return respondWithRpcPromise(_0xe7fb('0x1e'),_[_0xe7fb('0x18')](_0xb1f2f4[_0xe7fb('0x1f')],_0xb1f2f4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x251807,null))[_0xe7fb('0xd')](handleError(_0x251807,null));};exports['voiceQueuesPreview']=function(_0x3d1fb5,_0x1742f3){return respondWithRpcPromise(_0xe7fb('0x20'),_['merge'](_0x3d1fb5['query'],_0x3d1fb5[_0xe7fb('0x19')]))['then'](respondWithResult(_0x1742f3,null))[_0xe7fb('0xd')](handleError(_0x1742f3,null));};exports[_0xe7fb('0x21')]=function(_0xe49053,_0x2a4745){return respondWithRpcPromise('VoiceQueuesChannels',_0xe49053[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2a4745,null))[_0xe7fb('0xd')](handleError(_0x2a4745,null));};exports[_0xe7fb('0x22')]=function(_0x2d650d,_0x480819){return respondWithRpcPromise(_0xe7fb('0x23'),_[_0xe7fb('0x18')](_0x2d650d[_0xe7fb('0x16')],_0x2d650d[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x480819,null))[_0xe7fb('0xd')](handleError(_0x480819,null));};exports[_0xe7fb('0x24')]=function(_0x147eb1,_0x389903){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xe7fb('0x18')](_0x147eb1[_0xe7fb('0x16')],_0x147eb1[_0xe7fb('0x19')]))['then'](respondWithResult(_0x389903,null))[_0xe7fb('0xd')](handleError(_0x389903,null));};exports[_0xe7fb('0x25')]=function(_0x4218bc,_0x1530b1){return respondWithRpcPromise(_0xe7fb('0x26'),_[_0xe7fb('0x18')](_0x4218bc[_0xe7fb('0x16')],_0x4218bc[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x1530b1,null))[_0xe7fb('0xd')](handleError(_0x1530b1,null));};exports[_0xe7fb('0x27')]=function(_0x3c4f4b,_0x1544f2){return respondWithRpcPromise(_0xe7fb('0x28'),_0x3c4f4b[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1544f2,null))[_0xe7fb('0xd')](handleError(_0x1544f2,null));};exports[_0xe7fb('0x29')]=function(_0x21e35c,_0x4d6fe6){return respondWithRpcPromise(_0xe7fb('0x2a'),_0x21e35c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x4d6fe6,null))[_0xe7fb('0xd')](handleError(_0x4d6fe6,null));};exports['agents']=function(_0x3426a9,_0x186418){var _0xd472d;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9['query'])[_0xe7fb('0x1a')](function(_0x451a6c){_0xd472d=_0x451a6c;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9[_0xe7fb('0x16')],routingClient);})[_0xe7fb('0x1a')](function(_0xb729fc){return _['merge']({},_0xb729fc,_0xd472d);})[_0xe7fb('0x1a')](respondWithResult(_0x186418,null))[_0xe7fb('0xd')](handleError(_0x186418,null));};exports[_0xe7fb('0x2c')]=function(_0x4b263d,_0x36a341){if(_0x4b263d[_0xe7fb('0x1f')]&&_0x4b263d['body']['interaction']&&_0x4b263d['user']&&_0x4b263d['user']['name']){for(var _0x900d67 in _0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')]){if(_0x4b263d['body'][_0xe7fb('0x2d')]['hasOwnProperty'](_0x900d67)){db[_0xe7fb('0x2e')][_0xe7fb('0x2f')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'type':_0xe7fb('0x30'),'exitAt':null,'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67]&&_0x4b263d['body'][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')]?{'$notIn':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67]}:{'$ne':null}}})[_0xe7fb('0x1a')](function(_0x6eb1ab){var _0x13b17f=moment()[_0xe7fb('0x32')](_0xe7fb('0x33'));for(var _0x5a1ce1=0x0,_0x2eb999=_0x6eb1ab['length'];_0x5a1ce1<_0x2eb999;_0x5a1ce1+=0x1){_0x6eb1ab[_0x5a1ce1][_0xe7fb('0x34')]({'exitAt':_0x13b17f});}});for(var _0x468c62=0x0;_0x468c62<_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')];_0x468c62+=0x1){db['MemberReport'][_0xe7fb('0x35')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user']['name'],'type':_0xe7fb('0x30'),'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0x468c62],'exitAt':null},'defaults':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'interface':_[_0xe7fb('0x13')](_0x4b263d['user']['interface'])?util[_0xe7fb('0x32')](_0xe7fb('0x36'),_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x11')]):_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x38')],'type':_0xe7fb('0x30'),'enterAt':moment()[_0xe7fb('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe7fb('0x39'),'internal':_0x4b263d['user'][_0xe7fb('0x3a')],'uniqueid':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67][_0x468c62]}});}}}}return respondWithRpcPromise(_0xe7fb('0x3b'),{'id':_0x4b263d['params']['id'],'capacity':_0x4b263d[_0xe7fb('0x1f')]['capacity']},routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x36a341,null))['catch'](handleError(_0x36a341,null));};exports[_0xe7fb('0x3c')]=function(_0x59158c,_0x1fff6c){return respondWithRpcPromise(_0xe7fb('0x3d'),_0x59158c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1fff6c,null))[_0xe7fb('0xd')](handleError(_0x1fff6c,null));};exports[_0xe7fb('0x3e')]=function(_0x2f4760,_0x582a4a){return respondWithRpcPromise('Trunks',_0x2f4760[_0xe7fb('0x16')])['then'](respondWithResult(_0x582a4a,null))['catch'](handleError(_0x582a4a,null));};exports['campaigns']=function(_0x50b8df,_0x539252){return respondWithRpcPromise(_0xe7fb('0x3f'),_0x50b8df[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x539252,null))[_0xe7fb('0xd')](handleError(_0x539252,null));};exports['chatQueues']=function(_0x37af37,_0x236b35){return respondWithRpcPromise(_0xe7fb('0x40'),_0x37af37['query'],routingClient)['then'](respondWithResult(_0x236b35,null))[_0xe7fb('0xd')](handleError(_0x236b35,null));};exports[_0xe7fb('0x41')]=function(_0x300b8e,_0x4f4ba3){return respondWithRpcPromise(_0xe7fb('0x40'),_0x300b8e[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x300b8e[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x4f4ba3,null))['catch'](handleError(_0x4f4ba3,null));};exports[_0xe7fb('0x42')]=function(_0x3104c2,_0x1f16b2){return respondWithRpcPromise(_0xe7fb('0x43'),_0x3104c2[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x1f16b2,null))[_0xe7fb('0xd')](handleError(_0x1f16b2,null));};exports[_0xe7fb('0x44')]=function(_0x23755b,_0x590d7a){return respondWithRpcPromise('MailQueues',_0x23755b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x23755b[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x590d7a,null))[_0xe7fb('0xd')](handleError(_0x590d7a,null));};exports[_0xe7fb('0x45')]=function(_0x585b7c,_0x1e21e4){return respondWithRpcPromise(_0xe7fb('0x46'),_0x585b7c[_0xe7fb('0x16')],mailClient)[_0xe7fb('0x1a')](respondWithResult(_0x1e21e4,null))[_0xe7fb('0xd')](handleError(_0x1e21e4,null));};exports[_0xe7fb('0x47')]=function(_0x554092,_0x2e457c){return respondWithRpcPromise('OpenchannelQueues',_0x554092[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2e457c,null))[_0xe7fb('0xd')](handleError(_0x2e457c,null));};exports[_0xe7fb('0x48')]=function(_0x5925e6,_0x47ac92){return respondWithRpcPromise(_0xe7fb('0x49'),_0x5925e6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5925e6[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x47ac92,null))['catch'](handleError(_0x47ac92,null));};exports[_0xe7fb('0x4a')]=function(_0x58d4ec,_0x127b0e){return respondWithRpcPromise('SmsQueues',_0x58d4ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x127b0e,null))[_0xe7fb('0xd')](handleError(_0x127b0e,null));};exports[_0xe7fb('0x4b')]=function(_0x5da884,_0x475716){return respondWithRpcPromise(_0xe7fb('0x4c'),_0x5da884[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5da884[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x475716,null))[_0xe7fb('0xd')](handleError(_0x475716,null));};exports[_0xe7fb('0x4d')]=function(_0x5151ec,_0x4136ae){return respondWithRpcPromise(_0xe7fb('0x4e'),_0x5151ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x4136ae,null))['catch'](handleError(_0x4136ae,null));};exports[_0xe7fb('0x4f')]=function(_0x1dc9c1,_0xa93f35){return respondWithRpcPromise('WhatsappQueues',_0x1dc9c1[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x1dc9c1[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0xa93f35,null))[_0xe7fb('0xd')](handleError(_0xa93f35,null));};exports[_0xe7fb('0x50')]=function(_0xcdc72e,_0x187040){return respondWithRpcPromise('FaxQueues',_0xcdc72e['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x187040,null))[_0xe7fb('0xd')](handleError(_0x187040,null));};exports[_0xe7fb('0x51')]=function(_0x50c705,_0x519c5f){return respondWithRpcPromise(_0xe7fb('0x52'),_0x50c705[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x50c705[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x519c5f,null))[_0xe7fb('0xd')](handleError(_0x519c5f,null));};exports[_0xe7fb('0x53')]=function(_0x3f11f1,_0xb06693){return respondWithRpcPromise(_0xe7fb('0x54'),_0x3f11f1[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0xb06693,null))[_0xe7fb('0xd')](handleError(_0xb06693,null));};exports['chatQueuesWaitingInteractions']=function(_0x4fa142,_0x125427){return respondWithRpcPromise(_0xe7fb('0x55'),_0x4fa142[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x125427,null))[_0xe7fb('0xd')](handleError(_0x125427,null));};exports['mailQueuesWaitingInteractions']=function(_0x43f14b,_0x1beb13){return respondWithRpcPromise(_0xe7fb('0x56'),_0x43f14b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x1beb13,null))[_0xe7fb('0xd')](handleError(_0x1beb13,null));};exports[_0xe7fb('0x57')]=function(_0x1e6256,_0xa7fa61){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e6256[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0xa7fa61,null))[_0xe7fb('0xd')](handleError(_0xa7fa61,null));};exports[_0xe7fb('0x58')]=function(_0x2a2079,_0x31c159){return respondWithRpcPromise(_0xe7fb('0x59'),_0x2a2079['query'],routingClient)[_0xe7fb('0x1a')](function(_0x38e66a){if(_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')]!==undefined){var _0x15d881=_(_0x38e66a[_0xe7fb('0x5b')])[_0xe7fb('0x5c')]([_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')],_0x2a2079[_0xe7fb('0x19')]['id']])[_0xe7fb('0x5d')](_0xe7fb('0x5e'))[_0xe7fb('0x5f')]()[_0xe7fb('0x60')]();return _0x38e66a['rows']['filter'](function(_0x48a015){return _0x15d881[_0xe7fb('0x61')](_0x48a015[_0xe7fb('0x5e')])>-0x1;});}else{return _0x38e66a[_0xe7fb('0x5b')][_0xe7fb('0x5c')](function(_0x535e8b){return _0x535e8b[_0xe7fb('0x5e')]===parseInt(_0x2a2079[_0xe7fb('0x19')]['id']);});}})[_0xe7fb('0x1a')](respondWithResult(_0x31c159,null))[_0xe7fb('0xd')](handleError(_0x31c159,null));};exports['smsQueuesWaitingInteractions']=function(_0x2f7fa6,_0x5650c6){return respondWithRpcPromise(_0xe7fb('0x62'),_0x2f7fa6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x5650c6,null))[_0xe7fb('0xd')](handleError(_0x5650c6,null));};exports[_0xe7fb('0x63')]=function(_0x4ab541,_0x3ffd6c){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4ab541[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x3ffd6c,null))[_0xe7fb('0xd')](handleError(_0x3ffd6c,null));};exports[_0xe7fb('0x64')]=function(_0x4c37cd,_0x2b6d69){return respondWithRpcPromise(_0xe7fb('0x65'),_0x4c37cd[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2b6d69,null))['catch'](handleError(_0x2b6d69,null));};exports[_0xe7fb('0x66')]=function(_0x277335){return function(_0x1412e2,_0x4d0eed){var _0x11d5b6,_0x4b2cc4;var _0x5b1e28=_['capitalize'](_0x277335);var _0x3c99e7=_0x277335===_0xe7fb('0x67')?'Website':_0xe7fb('0x68');return db[_0x5b1e28+_0xe7fb('0x69')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0x1412e2[_0xe7fb('0x19')]['id']}})[_0xe7fb('0x1a')](function(_0x1cc21d){if(_[_0xe7fb('0x13')](_0x1cc21d)){throw new Error(_0x5b1e28+_0xe7fb('0x6b'));}_0x11d5b6=_0x1cc21d;return db[_0x5b1e28+_0xe7fb('0x6c')][_0xe7fb('0x6a')]({'where':{'id':_0x1412e2[_0xe7fb('0x1f')][_0xe7fb('0x6d')]},'include':[{'model':db[_0x5b1e28+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x5b1e28+_0x3c99e7],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x3c5bd9){if(_[_0xe7fb('0x13')](_0x3c5bd9)){throw new Error(_0x5b1e28+_0xe7fb('0x6f'));}_0x4b2cc4=_0x3c5bd9;return _0x3c5bd9[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x47568c={'uniqueid':_0x277335+'.'+_0x4b2cc4['id']+'.'+_0x4b2cc4[_0xe7fb('0x6e')]['id'],'FromUserId':_0x1412e2[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71')};_0x47568c[_0x5b1e28+_0xe7fb('0x72')]=_0x4b2cc4['id'];_0x47568c[_0x5b1e28+_0xe7fb('0x73')]=_0x4b2cc4[_0xe7fb('0x6e')]['id'];_0x47568c['From'+_0x5b1e28+_0x3c99e7+'Id']=_0x4b2cc4['Account']['id'];_0x47568c['To'+_0x5b1e28+_0xe7fb('0x74')]=_0x11d5b6['id'];return db[_0x5b1e28+'TransferReport'][_0xe7fb('0x75')](_0x47568c);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise('Start',{'channel':_0x277335,'interaction':_0x4b2cc4[_0xe7fb('0x6e')],'message':_0x4b2cc4,'account':_0x4b2cc4[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x71'),'appdata':_0x11d5b6[_0xe7fb('0x11')]+','+(_0x4b2cc4[_0xe7fb('0x68')][_0xe7fb('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x4d0eed,null))[_0xe7fb('0xd')](handleError(_0x4d0eed,null));};};exports[_0xe7fb('0x77')]=function(_0xae9441,_0x276c28){var _0xd5a417,_0x48de0c;if(_['isNil'](_0xae9441['body'][_0xe7fb('0x78')])){throw new Error(_0xe7fb('0x79'));}var _0x2b0600=_0xae9441['body'][_0xe7fb('0x78')];var _0x57ee3b=_[_0xe7fb('0x7a')](_0x2b0600);var _0x278a6c=_0x2b0600===_0xe7fb('0x67')?_0xe7fb('0x7b'):'Account';return db[_0xe7fb('0x7c')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0xae9441[_0xe7fb('0x19')]['id'],'role':_0xe7fb('0x39')}})[_0xe7fb('0x1a')](function(_0x33262f){if(_[_0xe7fb('0x13')](_0x33262f)){throw new Error(_0xe7fb('0x7d'));}_0xd5a417=_0x33262f;return db[_0x57ee3b+'Message']['findOne']({'where':{'id':_0xae9441[_0xe7fb('0x1f')]['messageId']},'include':[{'model':db[_0x57ee3b+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x57ee3b+_0x278a6c],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x58352d){if(_['isNil'](_0x58352d)){throw new Error(_0x57ee3b+_0xe7fb('0x6f'));}_0x48de0c=_0x58352d;return _0x58352d[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21cb12={'uniqueid':_0x2b0600+'.'+_0x48de0c['id']+'.'+_0x48de0c[_0xe7fb('0x6e')]['id'],'FromUserId':_0xae9441[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71'),'ToUserId':_0xd5a417['id']};_0x21cb12[_0x57ee3b+_0xe7fb('0x72')]=_0x48de0c['id'];_0x21cb12[_0x57ee3b+_0xe7fb('0x73')]=_0x48de0c['Interaction']['id'];_0x21cb12[_0xe7fb('0x7e')+_0x57ee3b+_0x278a6c+'Id']=_0x48de0c[_0xe7fb('0x68')]['id'];return db[_0x57ee3b+_0xe7fb('0x7f')][_0xe7fb('0x75')](_0x21cb12);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise(_0xe7fb('0x80'),{'channel':_0x2b0600,'interaction':_0x48de0c[_0xe7fb('0x6e')],'message':_0x48de0c,'account':_0x48de0c[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x39'),'appdata':_0xd5a417[_0xe7fb('0x11')]+','+(_0x48de0c[_0xe7fb('0x68')][_0xe7fb('0x81')]||0x12c),'interval':_0xe7fb('0x82')}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x276c28,null))[_0xe7fb('0xd')](handleError(_0x276c28,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 56d9069..148c9fd 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 _0x9ef3=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','multer'];(function(_0x34119a,_0x37376a){var _0x3b2561=function(_0x389a47){while(--_0x389a47){_0x34119a['push'](_0x34119a['shift']());}};_0x3b2561(++_0x37376a);}(_0x9ef3,0x175));var _0x39ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ef3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x39ef('0x0'));var util=require('util');var path=require(_0x39ef('0x1'));var timeout=require(_0x39ef('0x2'));var express=require(_0x39ef('0x3'));var router=express['Router']();var fs_extra=require(_0x39ef('0x4'));var auth=require(_0x39ef('0x5'));var interaction=require(_0x39ef('0x6'));var config=require(_0x39ef('0x7'));var controller=require(_0x39ef('0x8'));router[_0x39ef('0x9')]('/',auth[_0x39ef('0xa')](),controller[_0x39ef('0xb')]);router['get'](_0x39ef('0xc'),auth[_0x39ef('0xa')](),controller[_0x39ef('0xd')]);router[_0x39ef('0x9')](_0x39ef('0xe'),auth[_0x39ef('0xa')](),controller[_0x39ef('0xf')]);router['post']('/',auth[_0x39ef('0xa')](),controller[_0x39ef('0x10')]);router[_0x39ef('0x11')](_0x39ef('0xc'),auth[_0x39ef('0xa')](),controller[_0x39ef('0x12')]);router[_0x39ef('0x13')](_0x39ef('0xc'),auth['isAuthenticated'](),controller[_0x39ef('0x14')]);module[_0x39ef('0x15')]=router; \ No newline at end of file +var _0x9ec5=['/:id/run','run','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x9ec5,0x1d7));var _0x59ec=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x9ec5[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0x59ec('0x0'));var util=require(_0x59ec('0x1'));var path=require(_0x59ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x59ec('0x3'));var router=express[_0x59ec('0x4')]();var fs_extra=require(_0x59ec('0x5'));var auth=require(_0x59ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x59ec('0x7'));var controller=require(_0x59ec('0x8'));router[_0x59ec('0x9')]('/',auth[_0x59ec('0xa')](),controller[_0x59ec('0xb')]);router['get']('/:id',auth[_0x59ec('0xa')](),controller[_0x59ec('0xc')]);router[_0x59ec('0x9')](_0x59ec('0xd'),auth[_0x59ec('0xa')](),controller[_0x59ec('0xe')]);router[_0x59ec('0xf')]('/',auth['isAuthenticated'](),controller[_0x59ec('0x10')]);router[_0x59ec('0x11')](_0x59ec('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x59ec('0x13')](_0x59ec('0x12'),auth[_0x59ec('0xa')](),controller[_0x59ec('0x14')]);module[_0x59ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7c9f7ce..421fc8b 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 _0x56e2=['minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0x56e2,0xd9));var _0x256e=function(_0x2dba05,_0x3c1773){_0x2dba05=_0x2dba05-0x0;var _0x1df45f=_0x56e2[_0x2dba05];return _0x1df45f;};'use strict';var Sequelize=require(_0x256e('0x0'));module[_0x256e('0x1')]={'name':{'type':Sequelize[_0x256e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x256e('0x2')]},'active':{'type':Sequelize[_0x256e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x256e('0x2')],'allowNull':![],'defaultValue':_0x256e('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x256e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x256e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x256e('0x7')](_0x256e('0x8'),_0x256e('0x9'),_0x256e('0xa'),_0x256e('0xb'),_0x256e('0xc'),_0x256e('0xd'),_0x256e('0xe')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x256e('0x7')](_0x256e('0xf'),_0x256e('0x10'),_0x256e('0x11')),'allowNull':![],'defaultValue':_0x256e('0xf')},'type':{'type':Sequelize[_0x256e('0x7')](_0x256e('0x12'),_0x256e('0x13')),'allowNull':![],'defaultValue':_0x256e('0x12')},'sendMail':{'type':Sequelize[_0x256e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x256e('0x2')]},'cc':{'type':Sequelize[_0x256e('0x14')]},'bcc':{'type':Sequelize[_0x256e('0x14')]},'sendIfEmpty':{'type':Sequelize[_0x256e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9491=['xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','hours','minutes','days','csv'];(function(_0x3e7f73,_0x17f66c){var _0x37bc15=function(_0xb74b72){while(--_0xb74b72){_0x3e7f73['push'](_0x3e7f73['shift']());}};_0x37bc15(++_0x17f66c);}(_0x9491,0x1df));var _0x1949=function(_0x1a23c1,_0x373018){_0x1a23c1=_0x1a23c1-0x0;var _0x10cb16=_0x9491[_0x1a23c1];return _0x10cb16;};'use strict';var Sequelize=require(_0x1949('0x0'));module[_0x1949('0x1')]={'name':{'type':Sequelize[_0x1949('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1949('0x2')]},'active':{'type':Sequelize[_0x1949('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1949('0x2')],'allowNull':![],'defaultValue':_0x1949('0x4')},'startAt':{'type':Sequelize[_0x1949('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1949('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1949('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1949('0x7')]('years',_0x1949('0x8'),_0x1949('0x9'),_0x1949('0xa'),'days',_0x1949('0xb'),_0x1949('0xc')),'allowNull':![],'defaultValue':_0x1949('0xd')},'output':{'type':Sequelize[_0x1949('0x7')](_0x1949('0xe'),'pdf',_0x1949('0xf')),'allowNull':![],'defaultValue':_0x1949('0xe')},'type':{'type':Sequelize[_0x1949('0x7')](_0x1949('0x10'),_0x1949('0x11')),'allowNull':![],'defaultValue':_0x1949('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1949('0x2')]},'cc':{'type':Sequelize[_0x1949('0x12')]},'bcc':{'type':Sequelize[_0x1949('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x1949('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7a7bfd9..63b15be 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 _0x1edc=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','rimraf','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','end','error','stack','name','index','map','Schedule','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1edc,0x1a5));var _0xc1ed=function(_0x23209c,_0x2fdc05){_0x23209c=_0x23209c-0x0;var _0x30f270=_0x1edc[_0x23209c];return _0x30f270;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ed('0x1'));var rp=require('request-promise');var moment=require(_0xc1ed('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1ed('0x3'));var path=require(_0xc1ed('0x4'));var sox=require(_0xc1ed('0x5'));var csv=require(_0xc1ed('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1ed('0x7'));var _=require(_0xc1ed('0x8'));var squel=require(_0xc1ed('0x9'));var crypto=require(_0xc1ed('0xa'));var jsforce=require(_0xc1ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc1ed('0x6'));var querystring=require(_0xc1ed('0xc'));var Papa=require(_0xc1ed('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1ed('0xe'));var hardwareService=require(_0xc1ed('0xf'));var logger=require(_0xc1ed('0x10'))(_0xc1ed('0x11'));var utils=require(_0xc1ed('0x12'));var config=require(_0xc1ed('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1ed('0x14'))['db'];function respondWithStatusCode(_0x3a21fd,_0x18eaa0){_0x18eaa0=_0x18eaa0||0xcc;return function(_0x531fbc){if(_0x531fbc){return _0x3a21fd[_0xc1ed('0x15')](_0x18eaa0);}return _0x3a21fd[_0xc1ed('0x16')](_0x18eaa0)['end']();};}function respondWithResult(_0x2af112,_0x47c28d){_0x47c28d=_0x47c28d||0xc8;return function(_0x3fa67d){if(_0x3fa67d){return _0x2af112[_0xc1ed('0x16')](_0x47c28d)[_0xc1ed('0x17')](_0x3fa67d);}};}function respondWithFilteredResult(_0x2d7079,_0x461b20){return function(_0x16932c){if(_0x16932c){var _0x355ec2=typeof _0x461b20[_0xc1ed('0x18')]===_0xc1ed('0x19')&&typeof _0x461b20[_0xc1ed('0x1a')]===_0xc1ed('0x19');var _0x17909d=_0x16932c[_0xc1ed('0x1b')];var _0x3edc76=_0x355ec2?0x0:_0x461b20[_0xc1ed('0x18')];var _0x182991=_0x355ec2?_0x16932c[_0xc1ed('0x1b')]:_0x461b20[_0xc1ed('0x18')]+_0x461b20[_0xc1ed('0x1a')];var _0x39e346;if(_0x182991>=_0x17909d){_0x182991=_0x17909d;_0x39e346=0xc8;}else{_0x39e346=0xce;}_0x2d7079[_0xc1ed('0x16')](_0x39e346);return _0x2d7079[_0xc1ed('0x1c')]('Content-Range',_0x3edc76+'-'+_0x182991+'/'+_0x17909d)[_0xc1ed('0x17')](_0x16932c);}return null;};}function patchUpdates(_0x21f485){return function(_0x19c376){try{jsonpatch['apply'](_0x19c376,_0x21f485,!![]);}catch(_0x121edc){return BPromise[_0xc1ed('0x1d')](_0x121edc);}return _0x19c376[_0xc1ed('0x1e')]();};}function saveUpdates(_0x2eb70d,_0xf58849){return function(_0x229ea0){if(_0x229ea0){return _0x229ea0[_0xc1ed('0x1f')](_0x2eb70d)[_0xc1ed('0x20')](function(_0xf3f23d){return _0xf3f23d;});}return null;};}function removeEntity(_0xce0240,_0x2087bb){return function(_0x3785a5){if(_0x3785a5){return _0x3785a5['destroy']()[_0xc1ed('0x20')](function(){var _0x1499ab=_0x3785a5[_0xc1ed('0x21')]({'plain':!![]});var _0x2c4c33=_0xc1ed('0x22');return db[_0xc1ed('0x23')][_0xc1ed('0x24')]({'where':{'type':_0x2c4c33,'resourceId':_0x1499ab['id']}})[_0xc1ed('0x20')](function(){return _0x3785a5;});})['then'](function(){_0xce0240[_0xc1ed('0x16')](0xcc)[_0xc1ed('0x25')]();});}};}function handleEntityNotFound(_0x4eafd1,_0x54fbbe){return function(_0x479ad0){if(!_0x479ad0){_0x4eafd1[_0xc1ed('0x15')](0x194);}return _0x479ad0;};}function handleError(_0x5207cb,_0x56f9bb){_0x56f9bb=_0x56f9bb||0x1f4;return function(_0x545019){logger[_0xc1ed('0x26')](_0x545019[_0xc1ed('0x27')]);if(_0x545019[_0xc1ed('0x28')]){delete _0x545019[_0xc1ed('0x28')];}_0x5207cb[_0xc1ed('0x16')](_0x56f9bb)['send'](_0x545019);};}exports[_0xc1ed('0x29')]=function(_0x4490a9,_0x25d9d6){var _0x125836={},_0x6f2772={},_0x5ec0e6={'count':0x0,'rows':[]};var _0x302272=_[_0xc1ed('0x2a')](db[_0xc1ed('0x2b')]['rawAttributes'],function(_0x45f09c){return{'name':_0x45f09c['fieldName'],'type':_0x45f09c[_0xc1ed('0x2c')][_0xc1ed('0x2d')]};});_0x6f2772['model']=_[_0xc1ed('0x2a')](_0x302272,'name');_0x6f2772[_0xc1ed('0x2e')]=_[_0xc1ed('0x2f')](_0x4490a9['query']);_0x6f2772[_0xc1ed('0x30')]=_[_0xc1ed('0x31')](_0x6f2772[_0xc1ed('0x32')],_0x6f2772[_0xc1ed('0x2e')]);_0x125836[_0xc1ed('0x33')]=_[_0xc1ed('0x31')](_0x6f2772['model'],qs['fields'](_0x4490a9[_0xc1ed('0x2e')][_0xc1ed('0x34')]));_0x125836['attributes']=_0x125836[_0xc1ed('0x33')][_0xc1ed('0x35')]?_0x125836[_0xc1ed('0x33')]:_0x6f2772['model'];if(!_0x4490a9[_0xc1ed('0x2e')][_0xc1ed('0x36')](_0xc1ed('0x37'))){_0x125836['limit']=qs[_0xc1ed('0x1a')](_0x4490a9['query']['limit']);_0x125836['offset']=qs[_0xc1ed('0x18')](_0x4490a9[_0xc1ed('0x2e')]['offset']);}_0x125836[_0xc1ed('0x38')]=qs[_0xc1ed('0x39')](_0x4490a9[_0xc1ed('0x2e')][_0xc1ed('0x39')]);_0x125836[_0xc1ed('0x3a')]=qs[_0xc1ed('0x30')](_[_0xc1ed('0x3b')](_0x4490a9[_0xc1ed('0x2e')],_0x6f2772['filters']),_0x302272);if(_0x4490a9['query'][_0xc1ed('0x3c')]){_0x125836[_0xc1ed('0x3a')]=_[_0xc1ed('0x3d')](_0x125836['where'],{'$or':_[_0xc1ed('0x2a')](_0x302272,function(_0x2dc0bc){if(_0x2dc0bc[_0xc1ed('0x2c')]!==_0xc1ed('0x3e')){var _0x54e4f7={};_0x54e4f7[_0x2dc0bc['name']]={'$like':'%'+_0x4490a9[_0xc1ed('0x2e')][_0xc1ed('0x3c')]+'%'};return _0x54e4f7;}})});}_0x125836=_[_0xc1ed('0x3d')]({},_0x125836,_0x4490a9[_0xc1ed('0x3f')]);var _0x4c0ba1={'where':_0x125836['where']};return db[_0xc1ed('0x2b')][_0xc1ed('0x1b')](_0x4c0ba1)[_0xc1ed('0x20')](function(_0x159525){_0x5ec0e6['count']=_0x159525;if(_0x4490a9[_0xc1ed('0x2e')][_0xc1ed('0x40')]){_0x125836['include']=[{'all':!![]}];}return db[_0xc1ed('0x2b')][_0xc1ed('0x41')](_0x125836);})[_0xc1ed('0x20')](function(_0x5b371c){_0x5ec0e6['rows']=_0x5b371c;return _0x5ec0e6;})[_0xc1ed('0x20')](respondWithFilteredResult(_0x25d9d6,_0x125836))[_0xc1ed('0x42')](handleError(_0x25d9d6,null));};exports[_0xc1ed('0x43')]=function(_0x4dfc90,_0x14452c){var _0x4a8a3c={'raw':![],'where':{'id':_0x4dfc90['params']['id']}},_0x42806b={};_0x42806b[_0xc1ed('0x32')]=_[_0xc1ed('0x2f')](db['Schedule']['rawAttributes']);_0x42806b['query']=_[_0xc1ed('0x2f')](_0x4dfc90[_0xc1ed('0x2e')]);_0x42806b[_0xc1ed('0x30')]=_['intersection'](_0x42806b['model'],_0x42806b['query']);_0x4a8a3c[_0xc1ed('0x33')]=_[_0xc1ed('0x31')](_0x42806b['model'],qs[_0xc1ed('0x34')](_0x4dfc90[_0xc1ed('0x2e')]['fields']));_0x4a8a3c[_0xc1ed('0x33')]=_0x4a8a3c['attributes'][_0xc1ed('0x35')]?_0x4a8a3c['attributes']:_0x42806b[_0xc1ed('0x32')];if(_0x4dfc90['query'][_0xc1ed('0x40')]){_0x4a8a3c[_0xc1ed('0x44')]=[{'all':!![]}];}_0x4a8a3c=_[_0xc1ed('0x3d')]({},_0x4a8a3c,_0x4dfc90[_0xc1ed('0x3f')]);return db[_0xc1ed('0x2b')][_0xc1ed('0x45')](_0x4a8a3c)[_0xc1ed('0x20')](handleEntityNotFound(_0x14452c,null))[_0xc1ed('0x20')](respondWithResult(_0x14452c,null))['catch'](handleError(_0x14452c,null));};exports[_0xc1ed('0x46')]=function(_0x555749,_0x266788){return db[_0xc1ed('0x2b')][_0xc1ed('0x46')](_0x555749['body'],{})[_0xc1ed('0x20')](function(_0x2ce67f){var _0x118921=_0x555749[_0xc1ed('0x47')][_0xc1ed('0x21')]({'plain':!![]});if(!_0x118921)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x118921[_0xc1ed('0x48')]===_0xc1ed('0x47')){var _0x492cec=_0x2ce67f[_0xc1ed('0x21')]({'plain':!![]});var _0xe91fba=_0xc1ed('0x22');return db['UserProfileSection'][_0xc1ed('0x45')]({'where':{'name':_0xe91fba,'userProfileId':_0x118921[_0xc1ed('0x49')]},'raw':!![]})['then'](function(_0x4a933d){if(_0x4a933d&&_0x4a933d[_0xc1ed('0x4a')]===0x0){return db['UserProfileResource'][_0xc1ed('0x46')]({'name':_0x492cec[_0xc1ed('0x28')],'resourceId':_0x492cec['id'],'type':_0x4a933d[_0xc1ed('0x28')],'sectionId':_0x4a933d['id']},{})[_0xc1ed('0x20')](function(){return _0x2ce67f;});}else{return _0x2ce67f;}})[_0xc1ed('0x42')](function(_0x17e9c5){logger[_0xc1ed('0x26')](_0xc1ed('0x4b'),_0x17e9c5);throw _0x17e9c5;});}return _0x2ce67f;})[_0xc1ed('0x20')](respondWithResult(_0x266788,0xc9))[_0xc1ed('0x42')](handleError(_0x266788,null));};exports['update']=function(_0x41042f,_0x244ab8){if(_0x41042f[_0xc1ed('0x4c')]['id']){delete _0x41042f[_0xc1ed('0x4c')]['id'];}return db[_0xc1ed('0x2b')][_0xc1ed('0x45')]({'where':{'id':_0x41042f[_0xc1ed('0x4d')]['id']}})[_0xc1ed('0x20')](handleEntityNotFound(_0x244ab8,null))[_0xc1ed('0x20')](saveUpdates(_0x41042f[_0xc1ed('0x4c')],null))['then'](respondWithResult(_0x244ab8,null))['catch'](handleError(_0x244ab8,null));};exports[_0xc1ed('0x24')]=function(_0x1198ab,_0x55bd41){return db['Schedule']['find']({'where':{'id':_0x1198ab[_0xc1ed('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55bd41,null))[_0xc1ed('0x20')](removeEntity(_0x55bd41,null))['catch'](handleError(_0x55bd41,null));};exports[_0xc1ed('0x4e')]=function(_0xf6992b,_0xb15f5b,_0x31c9e3){var _0x376af4=require('../../config/schedule');return db['Schedule'][_0xc1ed('0x45')]({'where':{'id':_0xf6992b[_0xc1ed('0x4d')]['id']},'raw':!![]})[_0xc1ed('0x20')](handleEntityNotFound(_0xb15f5b,null))[_0xc1ed('0x20')](function(){_0x376af4[_0xc1ed('0x4e')](_0xf6992b[_0xc1ed('0x4d')]['id']);})[_0xc1ed('0x20')](respondWithStatusCode(_0xb15f5b,null))[_0xc1ed('0x42')](handleError(_0xb15f5b,null));}; \ No newline at end of file +var _0x9cb6=['include','merge','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','includeAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9cb6,0x1bb));var _0x69cb=function(_0x12bb5b,_0x3c4bcd){_0x12bb5b=_0x12bb5b-0x0;var _0x2e87fa=_0x9cb6[_0x12bb5b];return _0x2e87fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69cb('0x1'));var rp=require(_0x69cb('0x2'));var moment=require(_0x69cb('0x3'));var BPromise=require(_0x69cb('0x4'));var Mustache=require(_0x69cb('0x5'));var util=require(_0x69cb('0x6'));var path=require(_0x69cb('0x7'));var sox=require(_0x69cb('0x8'));var csv=require(_0x69cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69cb('0xa'));var _=require(_0x69cb('0xb'));var squel=require('squel');var crypto=require(_0x69cb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x69cb('0x9'));var querystring=require(_0x69cb('0xd'));var Papa=require(_0x69cb('0xe'));var Redis=require(_0x69cb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x69cb('0x10'));var as=require(_0x69cb('0x11'));var hardwareService=require(_0x69cb('0x12'));var logger=require(_0x69cb('0x13'))(_0x69cb('0x14'));var utils=require(_0x69cb('0x15'));var config=require(_0x69cb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283fed,_0x252123){_0x252123=_0x252123||0xcc;return function(_0x1f11a2){if(_0x1f11a2){return _0x283fed['sendStatus'](_0x252123);}return _0x283fed[_0x69cb('0x17')](_0x252123)[_0x69cb('0x18')]();};}function respondWithResult(_0x7ee9e2,_0x42e67b){_0x42e67b=_0x42e67b||0xc8;return function(_0x38eb0e){if(_0x38eb0e){return _0x7ee9e2[_0x69cb('0x17')](_0x42e67b)[_0x69cb('0x19')](_0x38eb0e);}};}function respondWithFilteredResult(_0x520038,_0xc83320){return function(_0x4a4e40){if(_0x4a4e40){var _0x2b9cd6=typeof _0xc83320[_0x69cb('0x1a')]===_0x69cb('0x1b')&&typeof _0xc83320[_0x69cb('0x1c')]==='undefined';var _0x5e5de7=_0x4a4e40[_0x69cb('0x1d')];var _0x4bcc4d=_0x2b9cd6?0x0:_0xc83320[_0x69cb('0x1a')];var _0x571115=_0x2b9cd6?_0x4a4e40[_0x69cb('0x1d')]:_0xc83320['offset']+_0xc83320[_0x69cb('0x1c')];var _0x4d791f;if(_0x571115>=_0x5e5de7){_0x571115=_0x5e5de7;_0x4d791f=0xc8;}else{_0x4d791f=0xce;}_0x520038[_0x69cb('0x17')](_0x4d791f);return _0x520038[_0x69cb('0x1e')](_0x69cb('0x1f'),_0x4bcc4d+'-'+_0x571115+'/'+_0x5e5de7)[_0x69cb('0x19')](_0x4a4e40);}return null;};}function patchUpdates(_0x59b223){return function(_0x3cfe28){try{jsonpatch[_0x69cb('0x20')](_0x3cfe28,_0x59b223,!![]);}catch(_0x66bb57){return BPromise[_0x69cb('0x21')](_0x66bb57);}return _0x3cfe28[_0x69cb('0x22')]();};}function saveUpdates(_0x298c41,_0x5ddc21){return function(_0x16e542){if(_0x16e542){return _0x16e542[_0x69cb('0x23')](_0x298c41)[_0x69cb('0x24')](function(_0x388b73){return _0x388b73;});}return null;};}function removeEntity(_0x152f2c,_0x2936ae){return function(_0xe2f4b8){if(_0xe2f4b8){return _0xe2f4b8[_0x69cb('0x25')]()[_0x69cb('0x24')](function(){var _0x461afe=_0xe2f4b8[_0x69cb('0x26')]({'plain':!![]});var _0x4765c1=_0x69cb('0x27');return db[_0x69cb('0x28')][_0x69cb('0x25')]({'where':{'type':_0x4765c1,'resourceId':_0x461afe['id']}})[_0x69cb('0x24')](function(){return _0xe2f4b8;});})[_0x69cb('0x24')](function(){_0x152f2c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a6cc6,_0x2c0af9){return function(_0x33caa0){if(!_0x33caa0){_0x5a6cc6[_0x69cb('0x29')](0x194);}return _0x33caa0;};}function handleError(_0x1d0dcc,_0x5c49ad){_0x5c49ad=_0x5c49ad||0x1f4;return function(_0x12a3a5){logger['error'](_0x12a3a5[_0x69cb('0x2a')]);if(_0x12a3a5[_0x69cb('0x2b')]){delete _0x12a3a5[_0x69cb('0x2b')];}_0x1d0dcc['status'](_0x5c49ad)[_0x69cb('0x2c')](_0x12a3a5);};}exports['index']=function(_0x3a3e02,_0x3382ba){var _0xf7f99d={},_0x34952e={},_0x540942={'count':0x0,'rows':[]};var _0x4c9eed=_[_0x69cb('0x2d')](db[_0x69cb('0x2e')][_0x69cb('0x2f')],function(_0xa3319e){return{'name':_0xa3319e[_0x69cb('0x30')],'type':_0xa3319e[_0x69cb('0x31')][_0x69cb('0x32')]};});_0x34952e['model']=_[_0x69cb('0x2d')](_0x4c9eed,_0x69cb('0x2b'));_0x34952e[_0x69cb('0x33')]=_[_0x69cb('0x34')](_0x3a3e02['query']);_0x34952e[_0x69cb('0x35')]=_[_0x69cb('0x36')](_0x34952e['model'],_0x34952e[_0x69cb('0x33')]);_0xf7f99d['attributes']=_['intersection'](_0x34952e['model'],qs[_0x69cb('0x37')](_0x3a3e02['query'][_0x69cb('0x37')]));_0xf7f99d[_0x69cb('0x38')]=_0xf7f99d[_0x69cb('0x38')][_0x69cb('0x39')]?_0xf7f99d[_0x69cb('0x38')]:_0x34952e[_0x69cb('0x3a')];if(!_0x3a3e02[_0x69cb('0x33')]['hasOwnProperty'](_0x69cb('0x3b'))){_0xf7f99d[_0x69cb('0x1c')]=qs[_0x69cb('0x1c')](_0x3a3e02['query']['limit']);_0xf7f99d[_0x69cb('0x1a')]=qs[_0x69cb('0x1a')](_0x3a3e02[_0x69cb('0x33')][_0x69cb('0x1a')]);}_0xf7f99d[_0x69cb('0x3c')]=qs[_0x69cb('0x3d')](_0x3a3e02['query']['sort']);_0xf7f99d[_0x69cb('0x3e')]=qs[_0x69cb('0x35')](_[_0x69cb('0x3f')](_0x3a3e02[_0x69cb('0x33')],_0x34952e['filters']),_0x4c9eed);if(_0x3a3e02['query'][_0x69cb('0x40')]){_0xf7f99d[_0x69cb('0x3e')]=_['merge'](_0xf7f99d[_0x69cb('0x3e')],{'$or':_[_0x69cb('0x2d')](_0x4c9eed,function(_0x5e79a8){if(_0x5e79a8[_0x69cb('0x31')]!==_0x69cb('0x41')){var _0x5551fc={};_0x5551fc[_0x5e79a8['name']]={'$like':'%'+_0x3a3e02[_0x69cb('0x33')][_0x69cb('0x40')]+'%'};return _0x5551fc;}})});}_0xf7f99d=_['merge']({},_0xf7f99d,_0x3a3e02[_0x69cb('0x42')]);var _0x3b493b={'where':_0xf7f99d[_0x69cb('0x3e')]};return db[_0x69cb('0x2e')][_0x69cb('0x1d')](_0x3b493b)[_0x69cb('0x24')](function(_0x5ecfb1){_0x540942[_0x69cb('0x1d')]=_0x5ecfb1;if(_0x3a3e02['query']['includeAll']){_0xf7f99d['include']=[{'all':!![]}];}return db['Schedule'][_0x69cb('0x43')](_0xf7f99d);})[_0x69cb('0x24')](function(_0x2e532d){_0x540942[_0x69cb('0x44')]=_0x2e532d;return _0x540942;})[_0x69cb('0x24')](respondWithFilteredResult(_0x3382ba,_0xf7f99d))[_0x69cb('0x45')](handleError(_0x3382ba,null));};exports[_0x69cb('0x46')]=function(_0xb0a44e,_0x4151ec){var _0x30a861={'raw':![],'where':{'id':_0xb0a44e[_0x69cb('0x47')]['id']}},_0xe154c9={};_0xe154c9['model']=_[_0x69cb('0x34')](db[_0x69cb('0x2e')][_0x69cb('0x2f')]);_0xe154c9[_0x69cb('0x33')]=_[_0x69cb('0x34')](_0xb0a44e[_0x69cb('0x33')]);_0xe154c9[_0x69cb('0x35')]=_['intersection'](_0xe154c9[_0x69cb('0x3a')],_0xe154c9[_0x69cb('0x33')]);_0x30a861['attributes']=_[_0x69cb('0x36')](_0xe154c9['model'],qs[_0x69cb('0x37')](_0xb0a44e['query'][_0x69cb('0x37')]));_0x30a861[_0x69cb('0x38')]=_0x30a861[_0x69cb('0x38')]['length']?_0x30a861[_0x69cb('0x38')]:_0xe154c9[_0x69cb('0x3a')];if(_0xb0a44e[_0x69cb('0x33')][_0x69cb('0x48')]){_0x30a861[_0x69cb('0x49')]=[{'all':!![]}];}_0x30a861=_[_0x69cb('0x4a')]({},_0x30a861,_0xb0a44e['options']);return db[_0x69cb('0x2e')][_0x69cb('0x4b')](_0x30a861)[_0x69cb('0x24')](handleEntityNotFound(_0x4151ec,null))['then'](respondWithResult(_0x4151ec,null))[_0x69cb('0x45')](handleError(_0x4151ec,null));};exports[_0x69cb('0x4c')]=function(_0x2b4fa2,_0x42812d){return db[_0x69cb('0x2e')][_0x69cb('0x4c')](_0x2b4fa2[_0x69cb('0x4d')],{})[_0x69cb('0x24')](function(_0x50395e){var _0x2d83d7=_0x2b4fa2[_0x69cb('0x4e')][_0x69cb('0x26')]({'plain':!![]});if(!_0x2d83d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d83d7['role']===_0x69cb('0x4e')){var _0x2fc2fd=_0x50395e[_0x69cb('0x26')]({'plain':!![]});var _0x1ca54f='Scheduler';return db[_0x69cb('0x4f')][_0x69cb('0x4b')]({'where':{'name':_0x1ca54f,'userProfileId':_0x2d83d7[_0x69cb('0x50')]},'raw':!![]})[_0x69cb('0x24')](function(_0xeb8072){if(_0xeb8072&&_0xeb8072[_0x69cb('0x51')]===0x0){return db[_0x69cb('0x28')][_0x69cb('0x4c')]({'name':_0x2fc2fd['name'],'resourceId':_0x2fc2fd['id'],'type':_0xeb8072[_0x69cb('0x2b')],'sectionId':_0xeb8072['id']},{})[_0x69cb('0x24')](function(){return _0x50395e;});}else{return _0x50395e;}})[_0x69cb('0x45')](function(_0x2162d4){logger[_0x69cb('0x52')](_0x69cb('0x53'),_0x2162d4);throw _0x2162d4;});}return _0x50395e;})[_0x69cb('0x24')](respondWithResult(_0x42812d,0xc9))[_0x69cb('0x45')](handleError(_0x42812d,null));};exports[_0x69cb('0x23')]=function(_0x45153f,_0x1a26c4){if(_0x45153f[_0x69cb('0x4d')]['id']){delete _0x45153f['body']['id'];}return db[_0x69cb('0x2e')][_0x69cb('0x4b')]({'where':{'id':_0x45153f[_0x69cb('0x47')]['id']}})[_0x69cb('0x24')](handleEntityNotFound(_0x1a26c4,null))[_0x69cb('0x24')](saveUpdates(_0x45153f[_0x69cb('0x4d')],null))[_0x69cb('0x24')](respondWithResult(_0x1a26c4,null))[_0x69cb('0x45')](handleError(_0x1a26c4,null));};exports[_0x69cb('0x25')]=function(_0x4d6b01,_0x4ead3f){return db[_0x69cb('0x2e')][_0x69cb('0x4b')]({'where':{'id':_0x4d6b01[_0x69cb('0x47')]['id']}})[_0x69cb('0x24')](handleEntityNotFound(_0x4ead3f,null))['then'](removeEntity(_0x4ead3f,null))[_0x69cb('0x45')](handleError(_0x4ead3f,null));};exports[_0x69cb('0x54')]=function(_0x1112ae,_0xf9e964,_0x17c63b){var _0x550dc2=require(_0x69cb('0x55'));return db['Schedule'][_0x69cb('0x4b')]({'where':{'id':_0x1112ae[_0x69cb('0x47')]['id']},'raw':!![]})[_0x69cb('0x24')](handleEntityNotFound(_0xf9e964,null))[_0x69cb('0x24')](function(){_0x550dc2[_0x69cb('0x54')](_0x1112ae[_0x69cb('0x47')]['id']);})['then'](respondWithStatusCode(_0xf9e964,null))['catch'](handleError(_0xf9e964,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 406473c..b9ded7b 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 _0xbeb1=['moment','request-promise','path','rimraf','../../config/environment','exports','define','tools_schedules','../../config/logger'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xbeb1,0xe9));var _0x1beb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbeb1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1beb('0x0'))('api');var moment=require(_0x1beb('0x1'));var BPromise=require('bluebird');var rp=require(_0x1beb('0x2'));var fs=require('fs');var path=require(_0x1beb('0x3'));var rimraf=require(_0x1beb('0x4'));var config=require(_0x1beb('0x5'));var attributes=require('./schedule.attributes');module[_0x1beb('0x6')]=function(_0x7adc5e,_0x36d743){return _0x7adc5e[_0x1beb('0x7')]('Schedule',attributes,{'tableName':_0x1beb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cd7=['../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2bd4c3,_0x49b2a0){var _0x358508=function(_0xf94b2a){while(--_0xf94b2a){_0x2bd4c3['push'](_0x2bd4c3['shift']());}};_0x358508(++_0x49b2a0);}(_0x9cd7,0x17e));var _0x79cd=function(_0x27acbf,_0xe7afec){_0x27acbf=_0x27acbf-0x0;var _0xf93fc8=_0x9cd7[_0x27acbf];return _0xf93fc8;};'use strict';var _=require(_0x79cd('0x0'));var util=require(_0x79cd('0x1'));var logger=require(_0x79cd('0x2'))(_0x79cd('0x3'));var moment=require(_0x79cd('0x4'));var BPromise=require(_0x79cd('0x5'));var rp=require(_0x79cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79cd('0x7'));var config=require(_0x79cd('0x8'));var attributes=require(_0x79cd('0x9'));module[_0x79cd('0xa')]=function(_0x12f8a2,_0x815738){return _0x12f8a2[_0x79cd('0xb')](_0x79cd('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 08864a4..fb1d238 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 _0x34ca=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0xf466fc,_0xe6b550){var _0x1e6330=function(_0x3ccf87){while(--_0x3ccf87){_0xf466fc['push'](_0xf466fc['shift']());}};_0x1e6330(++_0xe6b550);}(_0x34ca,0xe7));var _0xa34c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x34ca[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xa34c('0x0'));var util=require(_0xa34c('0x1'));var moment=require('moment');var BPromise=require(_0xa34c('0x2'));var rs=require(_0xa34c('0x3'));var fs=require('fs');var Redis=require(_0xa34c('0x4'));var db=require(_0xa34c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa34c('0x6'))(_0xa34c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa34c('0x8')][_0xa34c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a3d0,_0x59df07,_0x565064){return new BPromise(function(_0x3768e2,_0x26aa76){return client[_0xa34c('0xa')](_0x52a3d0,_0x565064)[_0xa34c('0xb')](function(_0x226484){logger[_0xa34c('0xc')](_0xa34c('0xd'),_0x59df07,_0xa34c('0xe'));logger[_0xa34c('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x59df07,_0xa34c('0xe'),JSON['stringify'](_0x226484));if(_0x226484[_0xa34c('0x10')]){if(_0x226484[_0xa34c('0x10')][_0xa34c('0x11')]===0x1f4){logger[_0xa34c('0x10')]('Schedule,\x20%s,\x20%s',_0x59df07,_0x226484[_0xa34c('0x10')][_0xa34c('0x12')]);return _0x26aa76(_0x226484[_0xa34c('0x10')][_0xa34c('0x12')]);}logger[_0xa34c('0x10')](_0xa34c('0xd'),_0x59df07,_0x226484[_0xa34c('0x10')][_0xa34c('0x12')]);return _0x3768e2(_0x226484[_0xa34c('0x10')][_0xa34c('0x12')]);}else{logger[_0xa34c('0xc')](_0xa34c('0xd'),_0x59df07,'request\x20sent');_0x3768e2(_0x226484[_0xa34c('0x13')][_0xa34c('0x12')]);}})[_0xa34c('0x14')](function(_0x7c8b92){logger[_0xa34c('0x10')]('Schedule,\x20%s,\x20%s',_0x59df07,_0x7c8b92);_0x26aa76(_0x7c8b92);});});} \ No newline at end of file +var _0x3f26=['message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2f3ba3,_0x5dcde5){var _0x39d388=function(_0x36b63c){while(--_0x36b63c){_0x2f3ba3['push'](_0x2f3ba3['shift']());}};_0x39d388(++_0x5dcde5);}(_0x3f26,0x7a));var _0x63f2=function(_0x2be770,_0x46c49e){_0x2be770=_0x2be770-0x0;var _0x504084=_0x3f26[_0x2be770];return _0x504084;};'use strict';var _=require('lodash');var util=require(_0x63f2('0x0'));var moment=require(_0x63f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x63f2('0x2'));var fs=require('fs');var Redis=require(_0x63f2('0x3'));var db=require(_0x63f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x63f2('0x5'))('rpc');var config=require(_0x63f2('0x6'));var jayson=require(_0x63f2('0x7'));var client=jayson[_0x63f2('0x8')][_0x63f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x376b17,_0x30cefd,_0x4704ec){return new BPromise(function(_0x29316c,_0x164979){return client['request'](_0x376b17,_0x4704ec)[_0x63f2('0xa')](function(_0x43ef8d){logger[_0x63f2('0xb')](_0x63f2('0xc'),_0x30cefd,_0x63f2('0xd'));logger[_0x63f2('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x30cefd,_0x63f2('0xd'),JSON[_0x63f2('0xf')](_0x43ef8d));if(_0x43ef8d[_0x63f2('0x10')]){if(_0x43ef8d['error'][_0x63f2('0x11')]===0x1f4){logger[_0x63f2('0x10')]('Schedule,\x20%s,\x20%s',_0x30cefd,_0x43ef8d[_0x63f2('0x10')]['message']);return _0x164979(_0x43ef8d[_0x63f2('0x10')]['message']);}logger['error'](_0x63f2('0xc'),_0x30cefd,_0x43ef8d[_0x63f2('0x10')][_0x63f2('0x12')]);return _0x29316c(_0x43ef8d[_0x63f2('0x10')]['message']);}else{logger['info'](_0x63f2('0xc'),_0x30cefd,_0x63f2('0xd'));_0x29316c(_0x43ef8d[_0x63f2('0x13')][_0x63f2('0x12')]);}})['catch'](function(_0x17b97b){logger[_0x63f2('0x10')](_0x63f2('0xc'),_0x30cefd,_0x17b97b);_0x164979(_0x17b97b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3756b5e..836aef5 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 _0x8525=['/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x2aa22e,_0x69ec01){var _0x12bc07=function(_0x194778){while(--_0x194778){_0x2aa22e['push'](_0x2aa22e['shift']());}};_0x12bc07(++_0x69ec01);}(_0x8525,0xc7));var _0x5852=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8525[_0x4e676e];return _0x336a3c;};'use strict';var multer=require('multer');var util=require(_0x5852('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5852('0x1'));var router=express[_0x5852('0x2')]();var fs_extra=require(_0x5852('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5852('0x4'));var config=require(_0x5852('0x5'));var controller=require('./screenRecording.controller');router[_0x5852('0x6')]('/',auth[_0x5852('0x7')](),controller[_0x5852('0x8')]);router[_0x5852('0x6')](_0x5852('0x9'),auth[_0x5852('0x7')](),controller[_0x5852('0xa')]);router['get'](_0x5852('0xb'),auth['isAuthenticated'](),controller[_0x5852('0xc')]);router[_0x5852('0x6')](_0x5852('0xd'),auth[_0x5852('0x7')](),controller[_0x5852('0xe')]);router[_0x5852('0xf')]('/',auth[_0x5852('0x7')](),controller['create']);router[_0x5852('0x10')](_0x5852('0xb'),auth[_0x5852('0x7')](),controller[_0x5852('0x11')]);router[_0x5852('0x12')](_0x5852('0xb'),auth[_0x5852('0x7')](),controller[_0x5852('0x13')]);module[_0x5852('0x14')]=router; \ No newline at end of file +var _0x6662=['show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x22c05a,_0x1a2dd8){var _0x3dc503=function(_0x3551fe){while(--_0x3551fe){_0x22c05a['push'](_0x22c05a['shift']());}};_0x3dc503(++_0x1a2dd8);}(_0x6662,0x65));var _0x2666=function(_0x102470,_0x199a01){_0x102470=_0x102470-0x0;var _0x558eaa=_0x6662[_0x102470];return _0x558eaa;};'use strict';var multer=require('multer');var util=require(_0x2666('0x0'));var path=require(_0x2666('0x1'));var timeout=require(_0x2666('0x2'));var express=require(_0x2666('0x3'));var router=express[_0x2666('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2666('0x5'));var interaction=require(_0x2666('0x6'));var config=require(_0x2666('0x7'));var controller=require(_0x2666('0x8'));router[_0x2666('0x9')]('/',auth[_0x2666('0xa')](),controller[_0x2666('0xb')]);router[_0x2666('0x9')](_0x2666('0xc'),auth['isAuthenticated'](),controller[_0x2666('0xd')]);router[_0x2666('0x9')]('/:id',auth[_0x2666('0xa')](),controller[_0x2666('0xe')]);router[_0x2666('0x9')](_0x2666('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x2666('0x10')]('/',auth['isAuthenticated'](),controller[_0x2666('0x11')]);router['put'](_0x2666('0x12'),auth[_0x2666('0xa')](),controller[_0x2666('0x13')]);router[_0x2666('0x14')](_0x2666('0x12'),auth['isAuthenticated'](),controller[_0x2666('0x15')]);module[_0x2666('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cd67d64..ad18c0f 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 _0x88c3=['subtract','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','path','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','INTEGER'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x88c3,0x1ee));var _0x388c=function(_0x3b71a9,_0x144717){_0x3b71a9=_0x3b71a9-0x0;var _0xab68ea=_0x88c3[_0x3b71a9];return _0xab68ea;};'use strict';var Sequelize=require(_0x388c('0x0'));var moment=require('moment');var path=require(_0x388c('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x388c('0x2')],'get':function(){return this['getDataValue']('value')?path[_0x388c('0x3')](this[_0x388c('0x4')](_0x388c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x388c('0x6')]},'channel':{'type':Sequelize[_0x388c('0x6')]},'value':{'type':Sequelize[_0x388c('0x6')],'set':function(_0x5a1c0d){var _0x3e79d8=_0x5a1c0d[_0x388c('0x7')](/\\/g,'/');this[_0x388c('0x8')](_0x388c('0x5'),_0x3e79d8);}},'rating':{'type':Sequelize[_0x388c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x388c('0x9')],'set':function(_0x2debe9){this[_0x388c('0x8')]('startedAt',moment()[_0x388c('0xa')](_0x2debe9,'ms'));this['setDataValue']('closedAt',moment());this[_0x388c('0x8')](_0x388c('0xb'),_0x2debe9);}},'startedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this[_0x388c('0x4')](_0x388c('0xd')))[_0x388c('0xe')](_0x388c('0xf'))[_0x388c('0x10')]();}},'closedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0x388c('0xf'))[_0x388c('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x388c('0x4')](_0x388c('0x11')))['format']('MM-DD-YYYY\x20HH:mm')[_0x388c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x388c('0xc')],'get':function(){return moment(this[_0x388c('0x4')]('updatedAt'))[_0x388c('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x388c('0x10')]();}}}; \ No newline at end of file +var _0x9d56=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace'];(function(_0x26e861,_0x338e52){var _0x1bb744=function(_0x4ebdb8){while(--_0x4ebdb8){_0x26e861['push'](_0x26e861['shift']());}};_0x1bb744(++_0x338e52);}(_0x9d56,0x122));var _0x69d5=function(_0x3bd575,_0x3d235e){_0x3bd575=_0x3bd575-0x0;var _0x428536=_0x9d56[_0x3bd575];return _0x428536;};'use strict';var Sequelize=require(_0x69d5('0x0'));var moment=require(_0x69d5('0x1'));var path=require(_0x69d5('0x2'));var config=require(_0x69d5('0x3'));module['exports']={'format':{'type':Sequelize[_0x69d5('0x4')],'get':function(){return this[_0x69d5('0x5')](_0x69d5('0x6'))?path[_0x69d5('0x7')](this[_0x69d5('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x69d5('0x8')]},'channel':{'type':Sequelize[_0x69d5('0x8')]},'value':{'type':Sequelize[_0x69d5('0x8')],'set':function(_0x1ca8b8){var _0x9051a=_0x1ca8b8[_0x69d5('0x9')](/\\/g,'/');this[_0x69d5('0xa')](_0x69d5('0x6'),_0x9051a);}},'rating':{'type':Sequelize[_0x69d5('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x69d5('0xb')],'set':function(_0x38e5fc){this[_0x69d5('0xa')](_0x69d5('0xc'),moment()[_0x69d5('0xd')](_0x38e5fc,'ms'));this[_0x69d5('0xa')](_0x69d5('0xe'),moment());this[_0x69d5('0xa')](_0x69d5('0xf'),_0x38e5fc);}},'startedAt':{'type':Sequelize[_0x69d5('0x10')],'get':function(){return moment(this['getDataValue'](_0x69d5('0xc')))[_0x69d5('0x11')](_0x69d5('0x12'))[_0x69d5('0x13')]();}},'closedAt':{'type':Sequelize[_0x69d5('0x10')],'get':function(){return moment(this['getDataValue'](_0x69d5('0xe')))[_0x69d5('0x11')](_0x69d5('0x12'))[_0x69d5('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x69d5('0x11')](_0x69d5('0x12'))[_0x69d5('0x13')]();}},'updatedAt':{'type':Sequelize[_0x69d5('0x10')],'get':function(){return moment(this[_0x69d5('0x5')]('updatedAt'))[_0x69d5('0x11')](_0x69d5('0x12'))[_0x69d5('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 18f6742..217fac8 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','params','include','find','catch','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname'];(function(_0x4287b0,_0x5e551c){var _0x1e6a1e=function(_0x1b2735){while(--_0x1b2735){_0x4287b0['push'](_0x4287b0['shift']());}};_0x1e6a1e(++_0x5e551c);}(_0xa41a,0x6b));var _0xaa41=function(_0x4280d9,_0x20b283){_0x4280d9=_0x4280d9-0x0;var _0xaa5148=_0xa41a[_0x4280d9];return _0xaa5148;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={},_0x1d8c2b={},_0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x2a')](db['ScreenRecording'][_0xaa41('0x2b')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x1d8c2b['model']=_[_0xaa41('0x2e')](_[_0xaa41('0x2a')](_0x30f88e,'name'),['format']);_0x1d8c2b['query']=_[_0xaa41('0x2f')](_0x1f0275[_0xaa41('0x30')]);_0x1d8c2b[_0xaa41('0x31')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],_0x1d8c2b[_0xaa41('0x30')]);_0x9a16e3[_0xaa41('0x33')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],qs[_0xaa41('0x34')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x34')]));_0x9a16e3['attributes']=_0x9a16e3[_0xaa41('0x33')][_0xaa41('0x35')]?_0x9a16e3['attributes']:_0x1d8c2b[_0xaa41('0x36')];if(!_0x1f0275[_0xaa41('0x30')][_0xaa41('0x37')]('nolimit')){_0x9a16e3[_0xaa41('0x1e')]=qs['limit'](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x1e')]);_0x9a16e3[_0xaa41('0x20')]=qs['offset'](_0x1f0275['query']['offset']);}_0x9a16e3[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x39')]);_0x9a16e3['where']=qs['filters'](_[_0xaa41('0x3a')](_0x1f0275[_0xaa41('0x30')],_0x1d8c2b[_0xaa41('0x31')]),_0x30f88e);if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]){_0x9a16e3[_0xaa41('0x3c')]=_[_0xaa41('0x3d')](_0x9a16e3['where'],{'$or':_[_0xaa41('0x2a')](_0x30f88e,function(_0x5cf689){if(_0x5cf689[_0xaa41('0x2c')]!==_0xaa41('0x3e')){var _0x57f1bf={};_0x57f1bf[_0x5cf689['name']]={'$like':'%'+_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]+'%'};return _0x57f1bf;}})});}_0x9a16e3=_['merge']({},_0x9a16e3,_0x1f0275[_0xaa41('0x3f')]);var _0x563687={'where':_0x9a16e3[_0xaa41('0x3c')]};return db[_0xaa41('0x40')][_0xaa41('0x1f')](_0x563687)[_0xaa41('0x25')](function(_0x3e6cac){_0x4466a3[_0xaa41('0x1f')]=_0x3e6cac;if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x41')]){_0x9a16e3['include']=[{'all':!![]}];}return db[_0xaa41('0x40')][_0xaa41('0x42')](_0x9a16e3);})[_0xaa41('0x25')](function(_0x398c35){_0x4466a3[_0xaa41('0x43')]=_0x398c35;return _0x4466a3;})[_0xaa41('0x25')](respondWithFilteredResult(_0x63c18c,_0x9a16e3))['catch'](handleError(_0x63c18c,null));};exports['show']=function(_0x87e2f4,_0x4f9086){var _0x1ed366={'raw':![],'where':{'id':_0x87e2f4[_0xaa41('0x44')]['id']}},_0x215896={};_0x215896[_0xaa41('0x36')]=_[_0xaa41('0x2f')](db[_0xaa41('0x40')][_0xaa41('0x2b')]);_0x215896['query']=_[_0xaa41('0x2f')](_0x87e2f4['query']);_0x215896['filters']=_[_0xaa41('0x32')](_0x215896['model'],_0x215896['query']);_0x1ed366['attributes']=_[_0xaa41('0x32')](_0x215896['model'],qs[_0xaa41('0x34')](_0x87e2f4[_0xaa41('0x30')]['fields']));_0x1ed366['attributes']=_0x1ed366[_0xaa41('0x33')][_0xaa41('0x35')]?_0x1ed366[_0xaa41('0x33')]:_0x215896[_0xaa41('0x36')];if(_0x87e2f4[_0xaa41('0x30')][_0xaa41('0x41')]){_0x1ed366[_0xaa41('0x45')]=[{'all':!![]}];}_0x1ed366=_[_0xaa41('0x3d')]({},_0x1ed366,_0x87e2f4[_0xaa41('0x3f')]);return db['ScreenRecording'][_0xaa41('0x46')](_0x1ed366)[_0xaa41('0x25')](handleEntityNotFound(_0x4f9086,null))[_0xaa41('0x25')](respondWithResult(_0x4f9086,null))[_0xaa41('0x47')](handleError(_0x4f9086,null));};exports[_0xaa41('0x48')]=function(_0x1d6112,_0x538b12){return db[_0xaa41('0x40')][_0xaa41('0x48')](_0x1d6112[_0xaa41('0x49')],{})[_0xaa41('0x25')](respondWithResult(_0x538b12,0xc9))['catch'](handleError(_0x538b12,null));};exports[_0xaa41('0x23')]=function(_0x5787f3,_0x49fedd){if(_0x5787f3[_0xaa41('0x49')]['id']){delete _0x5787f3[_0xaa41('0x49')]['id'];}delete _0x5787f3[_0xaa41('0x49')]['duration'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4a')];delete _0x5787f3[_0xaa41('0x49')]['closedAt'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4b')];return db[_0xaa41('0x40')][_0xaa41('0x46')]({'where':{'id':_0x5787f3[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x49fedd,null))[_0xaa41('0x25')](saveUpdates(_0x5787f3[_0xaa41('0x49')],null))['then'](respondWithResult(_0x49fedd,null))[_0xaa41('0x47')](handleError(_0x49fedd,null));};exports['describe']=function(_0x5ae65e,_0x1bdcd6){return db[_0xaa41('0x40')][_0xaa41('0x4c')]()[_0xaa41('0x25')](respondWithResult(_0x1bdcd6,null))[_0xaa41('0x47')](handleError(_0x1bdcd6,null));};exports[_0xaa41('0x4d')]=function(_0x48c4c7,_0x3c5082,_0x519e39){var _0xecb54=require(_0xaa41('0x4e'));var _0x1d518f=![];var _0x4f9e92={};if(_0x48c4c7[_0xaa41('0x30')][_0xaa41('0x2c')]&&_0x48c4c7['query'][_0xaa41('0x2c')]===_0xaa41('0x4f')){_0x4f9e92[_0xaa41('0x4f')]=_0x48c4c7['params']['id'];}else{_0x4f9e92['id']=_0x48c4c7[_0xaa41('0x44')]['id'];}return db[_0xaa41('0x40')]['find']({'where':_0x4f9e92,'attributes':['id','value'],'raw':!![]})[_0xaa41('0x25')](handleEntityNotFound(_0x3c5082,null))[_0xaa41('0x25')](function(_0x3a29d2){if(_0x3a29d2){var _0x4d20c6=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x3a29d2[_0xaa41('0x4b')]);var _0x2abb78=util['format'](_0xaa41('0x53'),_0x4d20c6);if(fs['existsSync'](_0x2abb78)){_0x1d518f=!![];return _0xecb54['decryptFile'](_0x2abb78,_0x4d20c6,config[_0xaa41('0x54')]['recording'])[_0xaa41('0x25')](function(){return _0x3a29d2;});}return _0x3a29d2;}})[_0xaa41('0x25')](function(_0x169ddf){if(_0x169ddf){var _0x5e83e1=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x169ddf[_0xaa41('0x4b')]);if(!fs[_0xaa41('0x55')](_0x5e83e1)){throw new db[(_0xaa41('0x56'))][(_0xaa41('0x57'))](_0xaa41('0x58'));}if(_0x169ddf[_0xaa41('0x59')]){return _0x3c5082['download'](_0x5e83e1,_0x169ddf[_0xaa41('0x59')]+path[_0xaa41('0x5a')](_0x5e83e1),function(){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}else{return _0x3c5082['download'](_0x5e83e1,function(_0x3fe47a){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}}})[_0xaa41('0x47')](function(_0x134579){if(_0x134579[_0xaa41('0x5c')]===_0xaa41('0x58')){_0x3c5082[_0xaa41('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x3c5082,null);}});};exports['destroy']=function(_0x540325,_0x4ec357){return db['ScreenRecording'][_0xaa41('0x46')]({'where':{'id':_0x540325['params']['id']}})['then'](function(_0x24c6f3){if(_[_0xaa41('0x5d')](_0x24c6f3)){throw new ReferenceError(_0xaa41('0x5e'));}return _0x24c6f3;})[_0xaa41('0x25')](function(_0x5cabc4){var _0x244d41=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x5cabc4[_0xaa41('0x4b')]);logger[_0xaa41('0x5f')](_0xaa41('0x60'),_0x244d41);if(!_[_0xaa41('0x5d')](_0x5cabc4[_0xaa41('0x4b')])&&fs['existsSync'](_0x244d41)){logger[_0xaa41('0x5f')](_0xaa41('0x61')+_0x244d41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x244d41);}_0x244d41=_0x244d41+'.cypher';if(!_[_0xaa41('0x5d')](_0x5cabc4['value'])&&fs[_0xaa41('0x55')](_0x244d41)){logger['info'](_0xaa41('0x61')+_0x244d41+_0xaa41('0x62'));fs['unlinkSync'](_0x244d41);}return _0x5cabc4;})[_0xaa41('0x25')](function(_0x33efc5){if(!_0x33efc5)throw new InternalError();return _0x33efc5[_0xaa41('0x24')]();})[_0xaa41('0x25')](function(){_0x4ec357['status'](0xcc)['end']();})[_0xaa41('0x47')](handleError(_0x4ec357,null));}; \ No newline at end of file +var _0x8d0e=['name','send','map','fieldName','type','key','format','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','includeAll','include','ScreenRecording','find','create','body','duration','value','params','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','filename','unlink','ScreenRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack'];(function(_0x2e36e8,_0x108d90){var _0x302c27=function(_0x2e3125){while(--_0x2e3125){_0x2e36e8['push'](_0x2e36e8['shift']());}};_0x302c27(++_0x108d90);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x30478d,_0x84bbef){_0x30478d=_0x30478d-0x0;var _0x4619fc=_0x8d0e[_0x30478d];return _0x4619fc;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){_0x9f747[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();});}};}function handleEntityNotFound(_0x149dfd,_0x31519b){return function(_0x32f0c1){if(!_0x32f0c1){_0x149dfd[_0xe8d0('0x29')](0x194);}return _0x32f0c1;};}function handleError(_0x2dee67,_0x264de4){_0x264de4=_0x264de4||0x1f4;return function(_0x539548){logger[_0xe8d0('0x2a')](_0x539548[_0xe8d0('0x2b')]);if(_0x539548[_0xe8d0('0x2c')]){delete _0x539548['name'];}_0x2dee67[_0xe8d0('0x1b')](_0x264de4)[_0xe8d0('0x2d')](_0x539548);};}exports['index']=function(_0x1519e2,_0x3ffcb7){var _0x11fcf2={},_0x9eec0e={},_0x3cf3d6={'count':0x0,'rows':[]};var _0x495064=_[_0xe8d0('0x2e')](db['ScreenRecording']['rawAttributes'],function(_0x50ad3c){return{'name':_0x50ad3c[_0xe8d0('0x2f')],'type':_0x50ad3c[_0xe8d0('0x30')][_0xe8d0('0x31')]};});_0x9eec0e['model']=_['differenceBy'](_[_0xe8d0('0x2e')](_0x495064,'name'),[_0xe8d0('0x32')]);_0x9eec0e[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x1519e2[_0xe8d0('0x33')]);_0x9eec0e[_0xe8d0('0x35')]=_['intersection'](_0x9eec0e[_0xe8d0('0x36')],_0x9eec0e[_0xe8d0('0x33')]);_0x11fcf2[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x9eec0e['model'],qs[_0xe8d0('0x39')](_0x1519e2[_0xe8d0('0x33')]['fields']));_0x11fcf2[_0xe8d0('0x37')]=_0x11fcf2['attributes'][_0xe8d0('0x3a')]?_0x11fcf2['attributes']:_0x9eec0e[_0xe8d0('0x36')];if(!_0x1519e2['query'][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x11fcf2[_0xe8d0('0x1e')]=qs[_0xe8d0('0x1e')](_0x1519e2['query'][_0xe8d0('0x1e')]);_0x11fcf2[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x1519e2['query'][_0xe8d0('0x1f')]);}_0x11fcf2[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x3e')]);_0x11fcf2['where']=qs[_0xe8d0('0x35')](_[_0xe8d0('0x3f')](_0x1519e2[_0xe8d0('0x33')],_0x9eec0e[_0xe8d0('0x35')]),_0x495064);if(_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x40')]){_0x11fcf2[_0xe8d0('0x41')]=_[_0xe8d0('0x42')](_0x11fcf2['where'],{'$or':_['map'](_0x495064,function(_0xdca203){if(_0xdca203[_0xe8d0('0x30')]!==_0xe8d0('0x43')){var _0x377dc1={};_0x377dc1[_0xdca203[_0xe8d0('0x2c')]]={'$like':'%'+_0x1519e2['query'][_0xe8d0('0x40')]+'%'};return _0x377dc1;}})});}_0x11fcf2=_['merge']({},_0x11fcf2,_0x1519e2[_0xe8d0('0x44')]);var _0x458294={'where':_0x11fcf2[_0xe8d0('0x41')]};return db['ScreenRecording'][_0xe8d0('0x20')](_0x458294)[_0xe8d0('0x27')](function(_0x731382){_0x3cf3d6[_0xe8d0('0x20')]=_0x731382;if(_0x1519e2[_0xe8d0('0x33')]['includeAll']){_0x11fcf2['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x11fcf2);})[_0xe8d0('0x27')](function(_0x52f288){_0x3cf3d6[_0xe8d0('0x45')]=_0x52f288;return _0x3cf3d6;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x3ffcb7,_0x11fcf2))[_0xe8d0('0x46')](handleError(_0x3ffcb7,null));};exports[_0xe8d0('0x47')]=function(_0x2fd21e,_0x1156da){var _0x1b41c7={'raw':![],'where':{'id':_0x2fd21e['params']['id']}},_0x3cbca5={};_0x3cbca5[_0xe8d0('0x36')]=_[_0xe8d0('0x34')](db['ScreenRecording']['rawAttributes']);_0x3cbca5[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x2fd21e[_0xe8d0('0x33')]);_0x3cbca5['filters']=_[_0xe8d0('0x38')](_0x3cbca5[_0xe8d0('0x36')],_0x3cbca5['query']);_0x1b41c7[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x3cbca5['model'],qs[_0xe8d0('0x39')](_0x2fd21e[_0xe8d0('0x33')][_0xe8d0('0x39')]));_0x1b41c7[_0xe8d0('0x37')]=_0x1b41c7[_0xe8d0('0x37')][_0xe8d0('0x3a')]?_0x1b41c7[_0xe8d0('0x37')]:_0x3cbca5[_0xe8d0('0x36')];if(_0x2fd21e['query'][_0xe8d0('0x48')]){_0x1b41c7[_0xe8d0('0x49')]=[{'all':!![]}];}_0x1b41c7=_[_0xe8d0('0x42')]({},_0x1b41c7,_0x2fd21e[_0xe8d0('0x44')]);return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')](_0x1b41c7)[_0xe8d0('0x27')](handleEntityNotFound(_0x1156da,null))[_0xe8d0('0x27')](respondWithResult(_0x1156da,null))[_0xe8d0('0x46')](handleError(_0x1156da,null));};exports[_0xe8d0('0x4c')]=function(_0x361e3d,_0x3a5987){return db['ScreenRecording'][_0xe8d0('0x4c')](_0x361e3d[_0xe8d0('0x4d')],{})[_0xe8d0('0x27')](respondWithResult(_0x3a5987,0xc9))[_0xe8d0('0x46')](handleError(_0x3a5987,null));};exports[_0xe8d0('0x25')]=function(_0x2e4caf,_0x5a0c7e){if(_0x2e4caf['body']['id']){delete _0x2e4caf[_0xe8d0('0x4d')]['id'];}delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4e')];delete _0x2e4caf[_0xe8d0('0x4d')]['createdAt'];delete _0x2e4caf[_0xe8d0('0x4d')]['closedAt'];delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4f')];return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x2e4caf[_0xe8d0('0x50')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x5a0c7e,null))[_0xe8d0('0x27')](saveUpdates(_0x2e4caf['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x5a0c7e,null))['catch'](handleError(_0x5a0c7e,null));};exports['describe']=function(_0x35138a,_0x5516ad){return db[_0xe8d0('0x4a')]['describe']()[_0xe8d0('0x27')](respondWithResult(_0x5516ad,null))[_0xe8d0('0x46')](handleError(_0x5516ad,null));};exports[_0xe8d0('0x51')]=function(_0xcf4642,_0x555a56,_0x3088b1){var _0xbd55db=require(_0xe8d0('0x52'));var _0x2e3f1d=![];var _0x18cc14={};if(_0xcf4642['query'][_0xe8d0('0x30')]&&_0xcf4642[_0xe8d0('0x33')][_0xe8d0('0x30')]==='uniqueid'){_0x18cc14[_0xe8d0('0x53')]=_0xcf4642['params']['id'];}else{_0x18cc14['id']=_0xcf4642['params']['id'];}return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':_0x18cc14,'attributes':['id','value'],'raw':!![]})[_0xe8d0('0x27')](handleEntityNotFound(_0x555a56,null))[_0xe8d0('0x27')](function(_0x47893d){if(_0x47893d){var _0x2a54c1=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0x47893d['value']);var _0x20f6c2=util[_0xe8d0('0x32')](_0xe8d0('0x57'),_0x2a54c1);if(fs[_0xe8d0('0x58')](_0x20f6c2)){_0x2e3f1d=!![];return _0xbd55db['decryptFile'](_0x20f6c2,_0x2a54c1,config[_0xe8d0('0x59')][_0xe8d0('0x5a')])[_0xe8d0('0x27')](function(){return _0x47893d;});}return _0x47893d;}})[_0xe8d0('0x27')](function(_0x1a74d0){if(_0x1a74d0){var _0x29667c=path['join'](config['root'],_0xe8d0('0x56'),_0x1a74d0['value']);if(!fs[_0xe8d0('0x58')](_0x29667c)){throw new db[(_0xe8d0('0x5b'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x1a74d0[_0xe8d0('0x5c')]){return _0x555a56['download'](_0x29667c,_0x1a74d0[_0xe8d0('0x5c')]+path['extname'](_0x29667c),function(){if(_0x2e3f1d){fs[_0xe8d0('0x5d')](_0x29667c);}});}else{return _0x555a56[_0xe8d0('0x51')](_0x29667c,function(_0x13b9f0){if(_0x2e3f1d){fs['unlink'](_0x29667c);}});}}})[_0xe8d0('0x46')](function(_0x3cbc9f){if(_0x3cbc9f['message']===_0xe8d0('0x5e')){_0x555a56['status'](0x194)[_0xe8d0('0x2d')]('Not\x20found');}else{return handleError(_0x555a56,null);}});};exports[_0xe8d0('0x26')]=function(_0x17afc2,_0x29467d){return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x17afc2['params']['id']}})['then'](function(_0xd7d433){if(_['isNil'](_0xd7d433)){throw new ReferenceError(_0xe8d0('0x5f'));}return _0xd7d433;})[_0xe8d0('0x27')](function(_0xbbe457){var _0x95565d=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0xbbe457[_0xe8d0('0x4f')]);logger[_0xe8d0('0x60')](_0xe8d0('0x61'),_0x95565d);if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger[_0xe8d0('0x60')](_0xe8d0('0x63')+_0x95565d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe8d0('0x64')](_0x95565d);}_0x95565d=_0x95565d+_0xe8d0('0x65');if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger['info'](_0xe8d0('0x63')+_0x95565d+_0xe8d0('0x66'));fs[_0xe8d0('0x64')](_0x95565d);}return _0xbbe457;})[_0xe8d0('0x27')](function(_0x360633){if(!_0x360633)throw new InternalError();return _0x360633[_0xe8d0('0x26')]();})[_0xe8d0('0x27')](function(){_0x29467d[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();})[_0xe8d0('0x46')](handleError(_0x29467d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7803a56..5920f8f 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 _0x259b=['util','../../config/logger','api','moment','bluebird','path','exports','define','ScreenRecording','interactionid','lodash'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x259b,0x1b7));var _0xb259=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x259b[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xb259('0x0'));var util=require(_0xb259('0x1'));var logger=require(_0xb259('0x2'))(_0xb259('0x3'));var moment=require(_0xb259('0x4'));var BPromise=require(_0xb259('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb259('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xb259('0x7')]=function(_0x56285c,_0x545832){return _0x56285c[_0xb259('0x8')](_0xb259('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xb259('0xa'),'fields':[_0xb259('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f41=['moment','bluebird','path','rimraf','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api'];(function(_0x1f98c2,_0x2a5e5f){var _0x6d53d0=function(_0x2e1593){while(--_0x2e1593){_0x1f98c2['push'](_0x1f98c2['shift']());}};_0x6d53d0(++_0x2a5e5f);}(_0x9f41,0x15d));var _0x19f4=function(_0x50f2b0,_0x32c5f3){_0x50f2b0=_0x50f2b0-0x0;var _0x477ebc=_0x9f41[_0x50f2b0];return _0x477ebc;};'use strict';var _=require('lodash');var util=require(_0x19f4('0x0'));var logger=require(_0x19f4('0x1'))(_0x19f4('0x2'));var moment=require(_0x19f4('0x3'));var BPromise=require(_0x19f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19f4('0x5'));var rimraf=require(_0x19f4('0x6'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x20f824,_0x2a1bbb){return _0x20f824[_0x19f4('0x7')](_0x19f4('0x8'),attributes,{'tableName':_0x19f4('0x9'),'paranoid':![],'indexes':[{'name':_0x19f4('0xa'),'fields':[_0x19f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2898102..77894ef 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 _0xbe02=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment'];(function(_0x29b25d,_0x7f7e39){var _0x164741=function(_0x3b9921){while(--_0x3b9921){_0x29b25d['push'](_0x29b25d['shift']());}};_0x164741(++_0x7f7e39);}(_0xbe02,0x11e));var _0x2be0=function(_0x360fe8,_0x9e2515){_0x360fe8=_0x360fe8-0x0;var _0x4ada57=_0xbe02[_0x360fe8];return _0x4ada57;};'use strict';var _=require('lodash');var util=require(_0x2be0('0x0'));var moment=require(_0x2be0('0x1'));var BPromise=require(_0x2be0('0x2'));var rs=require(_0x2be0('0x3'));var fs=require('fs');var Redis=require(_0x2be0('0x4'));var db=require(_0x2be0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2be0('0x6'))(_0x2be0('0x7'));var config=require('../../config/environment');var jayson=require(_0x2be0('0x8'));var client=jayson[_0x2be0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53247e,_0x3fc43c,_0x2e01fe){return new BPromise(function(_0x2a3015,_0x15965a){return client[_0x2be0('0xa')](_0x53247e,_0x2e01fe)['then'](function(_0x2182a4){logger['info'](_0x2be0('0xb'),_0x3fc43c,_0x2be0('0xc'));logger[_0x2be0('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3fc43c,_0x2be0('0xc'),JSON[_0x2be0('0xe')](_0x2182a4));if(_0x2182a4[_0x2be0('0xf')]){if(_0x2182a4[_0x2be0('0xf')]['code']===0x1f4){logger['error'](_0x2be0('0xb'),_0x3fc43c,_0x2182a4[_0x2be0('0xf')][_0x2be0('0x10')]);return _0x15965a(_0x2182a4[_0x2be0('0xf')][_0x2be0('0x10')]);}logger[_0x2be0('0xf')](_0x2be0('0xb'),_0x3fc43c,_0x2182a4['error'][_0x2be0('0x10')]);return _0x2a3015(_0x2182a4[_0x2be0('0xf')]['message']);}else{logger['info'](_0x2be0('0xb'),_0x3fc43c,_0x2be0('0xc'));_0x2a3015(_0x2182a4['result']['message']);}})[_0x2be0('0x11')](function(_0x3e839){logger[_0x2be0('0xf')](_0x2be0('0xb'),_0x3fc43c,_0x3e839);_0x15965a(_0x3e839);});});} \ No newline at end of file +var _0x3953=['then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc731bb,_0x5891d4){var _0xfe197d=function(_0x2cd6a7){while(--_0x2cd6a7){_0xc731bb['push'](_0xc731bb['shift']());}};_0xfe197d(++_0x5891d4);}(_0x3953,0x192));var _0x3395=function(_0x3118a0,_0x92e712){_0x3118a0=_0x3118a0-0x0;var _0x49d571=_0x3953[_0x3118a0];return _0x49d571;};'use strict';var _=require(_0x3395('0x0'));var util=require(_0x3395('0x1'));var moment=require(_0x3395('0x2'));var BPromise=require(_0x3395('0x3'));var rs=require(_0x3395('0x4'));var fs=require('fs');var Redis=require(_0x3395('0x5'));var db=require(_0x3395('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3395('0x7'))(_0x3395('0x8'));var config=require(_0x3395('0x9'));var jayson=require(_0x3395('0xa'));var client=jayson[_0x3395('0xb')][_0x3395('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36b4f4,_0x2a33a6,_0x37b237){return new BPromise(function(_0x235721,_0x2ad59e){return client[_0x3395('0xd')](_0x36b4f4,_0x37b237)[_0x3395('0xe')](function(_0xa8d3d1){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2a33a6,_0x3395('0xf'));logger[_0x3395('0x10')](_0x3395('0x11'),_0x2a33a6,_0x3395('0xf'),JSON[_0x3395('0x12')](_0xa8d3d1));if(_0xa8d3d1[_0x3395('0x13')]){if(_0xa8d3d1[_0x3395('0x13')][_0x3395('0x14')]===0x1f4){logger[_0x3395('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x2a33a6,_0xa8d3d1['error']['message']);return _0x2ad59e(_0xa8d3d1[_0x3395('0x13')][_0x3395('0x15')]);}logger[_0x3395('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x2a33a6,_0xa8d3d1[_0x3395('0x13')][_0x3395('0x15')]);return _0x235721(_0xa8d3d1[_0x3395('0x13')][_0x3395('0x15')]);}else{logger[_0x3395('0x16')](_0x3395('0x17'),_0x2a33a6,_0x3395('0xf'));_0x235721(_0xa8d3d1[_0x3395('0x18')][_0x3395('0x15')]);}})[_0x3395('0x19')](function(_0x5e60da){logger[_0x3395('0x13')](_0x3395('0x17'),_0x2a33a6,_0x5e60da);_0x2ad59e(_0x5e60da);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 080a593..636b4d6 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 _0x5c83=['/:id/preferred','getPreferred','getFavicon','diskStorage','root','format','%s%s','post','/:id/logo','single','addLogo','server/files/images/logos/','logologin','extname','originalname','file','join','preferred','addPreferred','favicon','/:id/favicon','update','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x5c83,0xbf));var _0x35c8=function(_0xa72cf,_0x24a05c){_0xa72cf=_0xa72cf-0x0;var _0x263735=_0x5c83[_0xa72cf];return _0x263735;};'use strict';var multer=require('multer');var util=require(_0x35c8('0x0'));var path=require('path');var timeout=require(_0x35c8('0x1'));var express=require('express');var router=express[_0x35c8('0x2')]();var fs_extra=require(_0x35c8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x35c8('0x4'));var config=require(_0x35c8('0x5'));var controller=require(_0x35c8('0x6'));router[_0x35c8('0x7')]('/',auth[_0x35c8('0x8')](),controller[_0x35c8('0x9')]);router[_0x35c8('0x7')](_0x35c8('0xa'),controller[_0x35c8('0xb')]);router[_0x35c8('0x7')](_0x35c8('0xc'),controller[_0x35c8('0xd')]);router[_0x35c8('0x7')]('/:id/logo',controller[_0x35c8('0xe')]);router[_0x35c8('0x7')](_0x35c8('0xf'),controller[_0x35c8('0x10')]);router[_0x35c8('0x7')](_0x35c8('0x11'),controller[_0x35c8('0x12')]);router['get'](_0x35c8('0x13'),controller[_0x35c8('0x14')]);router[_0x35c8('0x7')]('/:id/favicon',controller[_0x35c8('0x15')]);var upload=multer({'storage':multer[_0x35c8('0x16')]({'destination':function(_0x1cee7d,_0x53a993,_0xe2bbde){_0xe2bbde(null,path['join'](config[_0x35c8('0x17')],'server/files/images/logos/'));},'filename':function(_0x4de438,_0x4eb14c,_0x3ccdb9){_0x3ccdb9(null,util[_0x35c8('0x18')](_0x35c8('0x19'),'logo',path['extname'](_0x4eb14c['originalname'])));}})});router[_0x35c8('0x1a')](_0x35c8('0x1b'),upload[_0x35c8('0x1c')]('file'),controller[_0x35c8('0x1d')]);var upload=multer({'storage':multer[_0x35c8('0x16')]({'destination':function(_0x15eeb1,_0x4650cc,_0x3e8326){_0x3e8326(null,path['join'](config[_0x35c8('0x17')],_0x35c8('0x1e')));},'filename':function(_0xa2ba73,_0xfb93b4,_0x409013){_0x409013(null,util['format'](_0x35c8('0x19'),_0x35c8('0x1f'),path[_0x35c8('0x20')](_0xfb93b4[_0x35c8('0x21')])));}})});router[_0x35c8('0x1a')](_0x35c8('0xf'),upload['single'](_0x35c8('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x35c8('0x16')]({'destination':function(_0x50859b,_0x1d0aa0,_0x1a9c55){_0x1a9c55(null,path[_0x35c8('0x23')](config[_0x35c8('0x17')],_0x35c8('0x1e')));},'filename':function(_0x167886,_0xacfed3,_0x52a6a1){_0x52a6a1(null,util[_0x35c8('0x18')](_0x35c8('0x19'),_0x35c8('0x24'),path['extname'](_0xacfed3[_0x35c8('0x21')])));}})});router[_0x35c8('0x1a')]('/:id/preferred',upload[_0x35c8('0x1c')](_0x35c8('0x22')),controller[_0x35c8('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x844a16,_0x31ae13,_0x3cbbeb){_0x3cbbeb(null,path[_0x35c8('0x23')](config[_0x35c8('0x17')],_0x35c8('0x1e')));},'filename':function(_0x183cff,_0x4ffcca,_0x3153ae){_0x3153ae(null,util[_0x35c8('0x18')]('%s%s',_0x35c8('0x26'),path['extname'](_0x4ffcca[_0x35c8('0x21')])));}})});router[_0x35c8('0x1a')](_0x35c8('0x27'),upload['single']('file'),controller['addFavicon']);router['put'](_0x35c8('0xc'),auth[_0x35c8('0x8')](),controller[_0x35c8('0x28')]);module[_0x35c8('0x29')]=router; \ No newline at end of file +var _0x875c=['../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','originalname','post','single','root','%s%s','logologin','extname','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3b7ef8,_0x542ada){var _0x2e10df=function(_0x58a408){while(--_0x58a408){_0x3b7ef8['push'](_0x3b7ef8['shift']());}};_0x2e10df(++_0x542ada);}(_0x875c,0xda));var _0xc875=function(_0x55dedb,_0x5a5c44){_0x55dedb=_0x55dedb-0x0;var _0x3c908f=_0x875c[_0x55dedb];return _0x3c908f;};'use strict';var multer=require(_0xc875('0x0'));var util=require(_0xc875('0x1'));var path=require(_0xc875('0x2'));var timeout=require(_0xc875('0x3'));var express=require(_0xc875('0x4'));var router=express[_0xc875('0x5')]();var fs_extra=require(_0xc875('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc875('0x7'));var config=require(_0xc875('0x8'));var controller=require(_0xc875('0x9'));router['get']('/',auth[_0xc875('0xa')](),controller[_0xc875('0xb')]);router[_0xc875('0xc')](_0xc875('0xd'),controller[_0xc875('0xe')]);router['get']('/:id',controller[_0xc875('0xf')]);router['get'](_0xc875('0x10'),controller[_0xc875('0x11')]);router[_0xc875('0xc')]('/:id/logo_login',controller[_0xc875('0x12')]);router[_0xc875('0xc')](_0xc875('0x13'),controller[_0xc875('0x14')]);router[_0xc875('0xc')](_0xc875('0x15'),controller['getPreferred']);router[_0xc875('0xc')](_0xc875('0x16'),controller[_0xc875('0x17')]);var upload=multer({'storage':multer[_0xc875('0x18')]({'destination':function(_0x5cd678,_0x182913,_0xbac09d){_0xbac09d(null,path[_0xc875('0x19')](config['root'],_0xc875('0x1a')));},'filename':function(_0x21ad45,_0x57079b,_0x1cfc73){_0x1cfc73(null,util[_0xc875('0x1b')]('%s%s','logo',path['extname'](_0x57079b[_0xc875('0x1c')])));}})});router[_0xc875('0x1d')](_0xc875('0x10'),upload[_0xc875('0x1e')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xc875('0x18')]({'destination':function(_0x34a504,_0x4e0622,_0x15c416){_0x15c416(null,path[_0xc875('0x19')](config[_0xc875('0x1f')],_0xc875('0x1a')));},'filename':function(_0x25d2a1,_0x1173ac,_0xbfc673){_0xbfc673(null,util[_0xc875('0x1b')](_0xc875('0x20'),_0xc875('0x21'),path[_0xc875('0x22')](_0x1173ac[_0xc875('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0xc875('0x1e')](_0xc875('0x23')),controller[_0xc875('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x488518,_0x599a48,_0x3efbd9){_0x3efbd9(null,path[_0xc875('0x19')](config[_0xc875('0x1f')],_0xc875('0x1a')));},'filename':function(_0x39b63b,_0x579535,_0x5dc40c){_0x5dc40c(null,util['format'](_0xc875('0x20'),_0xc875('0x25'),path[_0xc875('0x22')](_0x579535[_0xc875('0x1c')])));}})});router[_0xc875('0x1d')]('/:id/preferred',upload['single']('file'),controller[_0xc875('0x26')]);var upload=multer({'storage':multer[_0xc875('0x18')]({'destination':function(_0x3b0a42,_0x4c6d3f,_0x5299de){_0x5299de(null,path[_0xc875('0x19')](config[_0xc875('0x1f')],_0xc875('0x1a')));},'filename':function(_0x27f309,_0x1a2cba,_0x2a40e1){_0x2a40e1(null,util['format']('%s%s',_0xc875('0x27'),path[_0xc875('0x22')](_0x1a2cba[_0xc875('0x1c')])));}})});router[_0xc875('0x1d')]('/:id/favicon',upload[_0xc875('0x1e')](_0xc875('0x23')),controller[_0xc875('0x28')]);router[_0xc875('0x29')](_0xc875('0x2a'),auth['isAuthenticated'](),controller[_0xc875('0x2b')]);module[_0xc875('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8cbfc2e..15a2dbe 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 _0xe14b=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','BOOLEAN'];(function(_0x1f8069,_0x10b62c){var _0x1c2603=function(_0x82ca43){while(--_0x82ca43){_0x1f8069['push'](_0x1f8069['shift']());}};_0x1c2603(++_0x10b62c);}(_0xe14b,0x93));var _0xbe14=function(_0x390997,_0x481f56){_0x390997=_0x390997-0x0;var _0x262f86=_0xe14b[_0x390997];return _0x262f86;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbe14('0x2')](0xb),'unique':_0xbe14('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xbe14('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbe14('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xbe14('0x4')]},'pageTitle':{'type':Sequelize[_0xbe14('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':_0xbe14('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':_0xbe14('0x7')},'chatTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbe14('0x4')]},'defaultPreferred':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xbe14('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xbe14('0x4')]},'sentiment':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbe14('0x2')]},'sentimentRegion':{'type':Sequelize[_0xbe14('0x4')]},'language':{'type':Sequelize[_0xbe14('0x4')]},'bucket':{'type':Sequelize[_0xbe14('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'disconnectionTimeout':{'type':Sequelize[_0xbe14('0x2')]()['UNSIGNED'],'defaultValue':0x5,'validate':{'min':0x1}}}; \ No newline at end of file +var _0xe14b=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','BOOLEAN'];(function(_0x33f5c8,_0x5202bb){var _0x4ea43f=function(_0x16be2b){while(--_0x16be2b){_0x33f5c8['push'](_0x33f5c8['shift']());}};_0x4ea43f(++_0x5202bb);}(_0xe14b,0x93));var _0xbe14=function(_0x2bd8e2,_0x3a919c){_0x2bd8e2=_0x2bd8e2-0x0;var _0x3dc91b=_0xe14b[_0x2bd8e2];return _0x3dc91b;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbe14('0x2')](0xb),'unique':_0xbe14('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xbe14('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbe14('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xbe14('0x4')]},'pageTitle':{'type':Sequelize[_0xbe14('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':_0xbe14('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':_0xbe14('0x7')},'chatTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbe14('0x4')]},'defaultPreferred':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xbe14('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xbe14('0x4')]},'sentiment':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbe14('0x2')]},'sentimentRegion':{'type':Sequelize[_0xbe14('0x4')]},'language':{'type':Sequelize[_0xbe14('0x4')]},'bucket':{'type':Sequelize[_0xbe14('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xbe14('0x2')](0x2)[_0xbe14('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xbe14('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'disconnectionTimeout':{'type':Sequelize[_0xbe14('0x2')]()['UNSIGNED'],'defaultValue':0x5,'validate':{'min':0x1}}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 2152b05..e286583 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 _0x36f1=['pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','body','params','addLogo','file','logo','filename','loginLogo','getLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','favicon','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','apply','save','update','stack','name','send','index','Setting','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x36f1,0xb0));var _0x136f=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x36f1[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x136f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x136f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x136f('0x2'));var moment=require(_0x136f('0x3'));var BPromise=require(_0x136f('0x4'));var Mustache=require(_0x136f('0x5'));var util=require(_0x136f('0x6'));var path=require(_0x136f('0x7'));var sox=require(_0x136f('0x8'));var csv=require(_0x136f('0x9'));var ejs=require(_0x136f('0xa'));var fs=require('fs');var fs_extra=require(_0x136f('0xb'));var _=require('lodash');var squel=require(_0x136f('0xc'));var crypto=require(_0x136f('0xd'));var jsforce=require(_0x136f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x136f('0x9'));var querystring=require(_0x136f('0xf'));var Papa=require(_0x136f('0x10'));var Redis=require(_0x136f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x136f('0x12'));var hardwareService=require(_0x136f('0x13'));var logger=require(_0x136f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x136f('0x15'));var licenseUtil=require(_0x136f('0x16'));var db=require(_0x136f('0x17'))['db'];var jayson=require(_0x136f('0x18'));var client=jayson[_0x136f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a89b4,_0x34f142,_0x3cb580,_0x21ede1){return new BPromise(function(_0x541865,_0x43fca8){var _0x3de185=_0x21ede1||client;return _0x3de185[_0x136f('0x1a')](_0x4a89b4,_0x3cb580)[_0x136f('0x1b')](function(_0x1c89fa){logger[_0x136f('0x1c')](_0x136f('0x1d'),_0x34f142,_0x136f('0x1e'));logger['debug'](_0x136f('0x1f'),_0x34f142,_0x136f('0x1e'),JSON[_0x136f('0x20')](_0x1c89fa));if(_0x1c89fa[_0x136f('0x21')]){if(_0x1c89fa[_0x136f('0x21')][_0x136f('0x22')]===0x1f4){logger['error'](_0x136f('0x1d'),_0x34f142,_0x1c89fa[_0x136f('0x21')]['message']);return _0x43fca8(_0x1c89fa[_0x136f('0x21')][_0x136f('0x23')]);}logger[_0x136f('0x21')](_0x136f('0x1d'),_0x34f142,_0x1c89fa[_0x136f('0x21')][_0x136f('0x23')]);return _0x541865(_0x1c89fa['error'][_0x136f('0x23')]);}else{logger[_0x136f('0x1c')](_0x136f('0x1d'),_0x34f142,'request\x20sent');_0x541865(_0x1c89fa['result'][_0x136f('0x23')]);}})['catch'](function(_0x4da99b){logger[_0x136f('0x21')](_0x136f('0x1d'),_0x34f142,_0x4da99b);_0x43fca8(_0x4da99b);});});}function respondWithStatusCode(_0x581b7c,_0xf3ad9b){_0xf3ad9b=_0xf3ad9b||0xcc;return function(_0x34f467){if(_0x34f467){return _0x581b7c[_0x136f('0x24')](_0xf3ad9b);}return _0x581b7c['status'](_0xf3ad9b)[_0x136f('0x25')]();};}function respondWithResult(_0x8c290c,_0x538101){_0x538101=_0x538101||0xc8;return function(_0x34cb4f){if(_0x34cb4f){return _0x8c290c[_0x136f('0x26')](_0x538101)['json'](_0x34cb4f);}};}function respondWithFilteredResult(_0x12ac03,_0x70c7b3){return function(_0x278e59){if(_0x278e59){var _0x442f7f=typeof _0x70c7b3['offset']===_0x136f('0x27')&&typeof _0x70c7b3[_0x136f('0x28')]===_0x136f('0x27');var _0x23ab25=_0x278e59['count'];var _0x3a630c=_0x442f7f?0x0:_0x70c7b3[_0x136f('0x29')];var _0x1b8e90=_0x442f7f?_0x278e59[_0x136f('0x2a')]:_0x70c7b3[_0x136f('0x29')]+_0x70c7b3[_0x136f('0x28')];var _0x527527;if(_0x1b8e90>=_0x23ab25){_0x1b8e90=_0x23ab25;_0x527527=0xc8;}else{_0x527527=0xce;}_0x12ac03[_0x136f('0x26')](_0x527527);return _0x12ac03[_0x136f('0x2b')](_0x136f('0x2c'),_0x3a630c+'-'+_0x1b8e90+'/'+_0x23ab25)['json'](_0x278e59);}return null;};}function patchUpdates(_0x3341ea){return function(_0x5bfdbd){try{jsonpatch[_0x136f('0x2d')](_0x5bfdbd,_0x3341ea,!![]);}catch(_0x7ce9af){return BPromise['reject'](_0x7ce9af);}return _0x5bfdbd[_0x136f('0x2e')]();};}function saveUpdates(_0x65ef2,_0x21ad42){return function(_0x3f2c10){if(_0x3f2c10){return _0x3f2c10[_0x136f('0x2f')](_0x65ef2)[_0x136f('0x1b')](function(_0x1305cd){return _0x1305cd;});}return null;};}function removeEntity(_0x2195b6,_0x4d7851){return function(_0x1b7197){if(_0x1b7197){return _0x1b7197['destroy']()['then'](function(){_0x2195b6[_0x136f('0x26')](0xcc)[_0x136f('0x25')]();});}};}function handleEntityNotFound(_0x58f06e,_0x57b8fe){return function(_0x3fe294){if(!_0x3fe294){_0x58f06e[_0x136f('0x24')](0x194);}return _0x3fe294;};}function handleError(_0x149f1a,_0x5565fe){_0x5565fe=_0x5565fe||0x1f4;return function(_0x2e565a){logger[_0x136f('0x21')](_0x2e565a[_0x136f('0x30')]);if(_0x2e565a[_0x136f('0x31')]){delete _0x2e565a[_0x136f('0x31')];}_0x149f1a['status'](_0x5565fe)[_0x136f('0x32')](_0x2e565a);};}exports[_0x136f('0x33')]=function(_0x2b310b,_0x1cf0d2){var _0x101e71={},_0x27212a={},_0x300a6e={'count':0x0,'rows':[]};var _0x5ff6a3=_['map'](db[_0x136f('0x34')][_0x136f('0x35')],function(_0x5d9244){return{'name':_0x5d9244['fieldName'],'type':_0x5d9244[_0x136f('0x36')][_0x136f('0x37')]};});_0x27212a[_0x136f('0x38')]=_[_0x136f('0x39')](_0x5ff6a3,_0x136f('0x31'));_0x27212a[_0x136f('0x3a')]=_[_0x136f('0x3b')](_0x2b310b[_0x136f('0x3a')]);_0x27212a[_0x136f('0x3c')]=_[_0x136f('0x3d')](_0x27212a['model'],_0x27212a[_0x136f('0x3a')]);_0x101e71[_0x136f('0x3e')]=_[_0x136f('0x3d')](_0x27212a['model'],qs['fields'](_0x2b310b[_0x136f('0x3a')][_0x136f('0x3f')]));_0x101e71[_0x136f('0x3e')]=_0x101e71[_0x136f('0x3e')][_0x136f('0x40')]?_0x101e71[_0x136f('0x3e')]:_0x27212a[_0x136f('0x38')];if(!_0x2b310b[_0x136f('0x3a')][_0x136f('0x41')](_0x136f('0x42'))){_0x101e71[_0x136f('0x28')]=qs[_0x136f('0x28')](_0x2b310b[_0x136f('0x3a')][_0x136f('0x28')]);_0x101e71[_0x136f('0x29')]=qs[_0x136f('0x29')](_0x2b310b[_0x136f('0x3a')][_0x136f('0x29')]);}_0x101e71[_0x136f('0x43')]=qs[_0x136f('0x44')](_0x2b310b[_0x136f('0x3a')][_0x136f('0x44')]);_0x101e71[_0x136f('0x45')]=qs[_0x136f('0x3c')](_[_0x136f('0x46')](_0x2b310b[_0x136f('0x3a')],_0x27212a[_0x136f('0x3c')]),_0x5ff6a3);if(_0x2b310b[_0x136f('0x3a')][_0x136f('0x47')]){_0x101e71[_0x136f('0x45')]=_[_0x136f('0x48')](_0x101e71[_0x136f('0x45')],{'$or':_['map'](_0x5ff6a3,function(_0x456098){if(_0x456098[_0x136f('0x36')]!=='VIRTUAL'){var _0x217fdf={};_0x217fdf[_0x456098[_0x136f('0x31')]]={'$like':'%'+_0x2b310b[_0x136f('0x3a')][_0x136f('0x47')]+'%'};return _0x217fdf;}})});}_0x101e71=_[_0x136f('0x48')]({},_0x101e71,_0x2b310b[_0x136f('0x49')]);var _0x20621c={'where':_0x101e71[_0x136f('0x45')]};return db[_0x136f('0x34')][_0x136f('0x2a')](_0x20621c)[_0x136f('0x1b')](function(_0x3aca31){_0x300a6e[_0x136f('0x2a')]=_0x3aca31;if(_0x2b310b[_0x136f('0x3a')]['includeAll']){_0x101e71[_0x136f('0x4a')]=[{'all':!![]}];}return db[_0x136f('0x34')][_0x136f('0x4b')](_0x101e71);})[_0x136f('0x1b')](function(_0x39fe33){_0x300a6e[_0x136f('0x4c')]=_0x39fe33;return _0x300a6e;})[_0x136f('0x1b')](respondWithFilteredResult(_0x1cf0d2,_0x101e71))[_0x136f('0x4d')](handleError(_0x1cf0d2,null));};exports[_0x136f('0x4e')]=function(_0x51ae72,_0x38990b){var _0x4376f6={'raw':![],'where':{'id':_0x51ae72['params']['id']}},_0x2a8749={};_0x2a8749[_0x136f('0x38')]=_[_0x136f('0x3b')](db[_0x136f('0x34')][_0x136f('0x35')]);_0x2a8749['query']=_[_0x136f('0x3b')](_0x51ae72[_0x136f('0x3a')]);_0x2a8749[_0x136f('0x3c')]=_['intersection'](_0x2a8749['model'],_0x2a8749[_0x136f('0x3a')]);_0x4376f6[_0x136f('0x3e')]=_['intersection'](_0x2a8749[_0x136f('0x38')],qs[_0x136f('0x3f')](_0x51ae72[_0x136f('0x3a')][_0x136f('0x3f')]));_0x4376f6['attributes']=_0x4376f6[_0x136f('0x3e')][_0x136f('0x40')]?_0x4376f6[_0x136f('0x3e')]:_0x2a8749[_0x136f('0x38')];if(_0x51ae72['query'][_0x136f('0x4f')]){_0x4376f6['include']=[{'all':!![]}];}_0x4376f6=_['merge']({},_0x4376f6,_0x51ae72[_0x136f('0x49')]);return db[_0x136f('0x34')][_0x136f('0x50')](_0x4376f6)[_0x136f('0x1b')](handleEntityNotFound(_0x38990b,null))[_0x136f('0x1b')](respondWithResult(_0x38990b,null))['catch'](handleError(_0x38990b,null));};exports[_0x136f('0x2f')]=function(_0x7edaa2,_0x21b1cf){if(_0x7edaa2[_0x136f('0x51')]['id']){delete _0x7edaa2[_0x136f('0x51')]['id'];}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x7edaa2[_0x136f('0x52')]['id']}})['then'](handleEntityNotFound(_0x21b1cf,null))[_0x136f('0x1b')](saveUpdates(_0x7edaa2[_0x136f('0x51')],null))[_0x136f('0x1b')](respondWithResult(_0x21b1cf,null))[_0x136f('0x4d')](handleError(_0x21b1cf,null));};exports[_0x136f('0x53')]=function(_0x499b2f,_0x40f555,_0x21b036){if(_0x499b2f[_0x136f('0x54')]&&_0x499b2f[_0x136f('0x54')]['filename']){_0x499b2f[_0x136f('0x51')][_0x136f('0x55')]=_0x499b2f[_0x136f('0x54')][_0x136f('0x56')];}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x499b2f[_0x136f('0x52')]['id']}})[_0x136f('0x1b')](handleEntityNotFound(_0x40f555,null))[_0x136f('0x1b')](saveUpdates(_0x499b2f[_0x136f('0x51')],null))[_0x136f('0x1b')](respondWithResult(_0x40f555,null))[_0x136f('0x4d')](handleError(_0x40f555,null));};exports['addLogoLogin']=function(_0x313d4a,_0x119c79,_0x2d5104){if(_0x313d4a[_0x136f('0x54')]&&_0x313d4a[_0x136f('0x54')][_0x136f('0x56')]){_0x313d4a[_0x136f('0x51')][_0x136f('0x57')]=_0x313d4a[_0x136f('0x54')][_0x136f('0x56')];}return db[_0x136f('0x34')]['find']({'where':{'id':_0x313d4a[_0x136f('0x52')]['id']}})[_0x136f('0x1b')](handleEntityNotFound(_0x119c79,null))[_0x136f('0x1b')](saveUpdates(_0x313d4a[_0x136f('0x51')],null))[_0x136f('0x1b')](respondWithResult(_0x119c79,null))[_0x136f('0x4d')](handleError(_0x119c79,null));};var utilLicense=require(_0x136f('0x16'));exports[_0x136f('0x58')]=function(_0x4e4ab4,_0x3796a8,_0x11cec1){var _0x17e273='server/files/images/logos';var _0x2a3395={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4090e3){if(_0x4090e3){_0x2a3395=_0x4090e3;}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x4e4ab4[_0x136f('0x52')]['id']},'attributes':[_0x136f('0x55'),_0x136f('0x57'),_0x136f('0x59'),'favicon',_0x136f('0x5a'),_0x136f('0x5b'),_0x136f('0x5c'),_0x136f('0x5d')],'raw':!![]});})[_0x136f('0x1b')](handleEntityNotFound(_0x3796a8,null))[_0x136f('0x1b')](function(_0x3d7a48){if(_0x3d7a48){var _0x2d087a=_0x3d7a48[_0x136f('0x55')]&&fs[_0x136f('0x5e')](path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x17e273,_[_0x136f('0x61')](_0x3d7a48[_0x136f('0x55')])))?path[_0x136f('0x5f')](config['root'],_0x17e273,_['toLower'](_0x3d7a48[_0x136f('0x55')])):path['join'](config[_0x136f('0x60')],_0x17e273,_['toLower'](_0x136f('0x62')));var _0x17b4bc=_0x136f('0x63')+_[_0x136f('0x64')]('logo');if(_0x3d7a48[_0x17b4bc]||!_0x2a3395[_0x136f('0x65')]){_0x2d087a=path['join'](config[_0x136f('0x60')],_0x17e273,_[_0x136f('0x61')](_0x136f('0x62')));}if(!fs[_0x136f('0x5e')](_0x2d087a)){throw new db[(_0x136f('0x66'))]['ValidationError'](_[_0x136f('0x64')](_0x136f('0x55'))+_0x136f('0x67'));}return _0x3796a8[_0x136f('0x68')](_0x2d087a);}})[_0x136f('0x4d')](handleError(_0x3796a8,null));};var utilLicense=require(_0x136f('0x16'));exports[_0x136f('0x69')]=function(_0x1246d8,_0x33379d,_0x58cae2){var _0x38954e=_0x136f('0x6a');var _0xe4d157={'custom':![]};return utilLicense[_0x136f('0x6b')]()['then'](function(_0x2bf2be){if(_0x2bf2be){_0xe4d157=_0x2bf2be;}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x1246d8['params']['id']},'attributes':[_0x136f('0x55'),_0x136f('0x57'),_0x136f('0x59'),_0x136f('0x6c'),_0x136f('0x5a'),'defaultLoginLogo','defaultPreferred',_0x136f('0x5d')],'raw':!![]});})[_0x136f('0x1b')](handleEntityNotFound(_0x33379d,null))[_0x136f('0x1b')](function(_0xf4e6fd){if(_0xf4e6fd){var _0x2508a3=_0xf4e6fd[_0x136f('0x57')]&&fs[_0x136f('0x5e')](path[_0x136f('0x5f')](config['root'],_0x38954e,_[_0x136f('0x61')](_0xf4e6fd['loginLogo'])))?path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x38954e,_['toLower'](_0xf4e6fd['loginLogo'])):path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x38954e,_['toLower']('default_loginLogo.svg'));var _0x45ca79=_0x136f('0x63')+_[_0x136f('0x64')](_0x136f('0x57'));if(_0xf4e6fd[_0x45ca79]||!_0xe4d157[_0x136f('0x65')]){_0x2508a3=path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x38954e,_[_0x136f('0x61')](_0x136f('0x6d')));}if(!fs[_0x136f('0x5e')](_0x2508a3)){throw new db['Sequelize'][(_0x136f('0x6e'))](_[_0x136f('0x64')](_0x136f('0x57'))+'\x20not\x20found');}return _0x33379d[_0x136f('0x68')](_0x2508a3);}})['catch'](handleError(_0x33379d,null));};exports[_0x136f('0x6f')]=function(_0x38db6c,_0x56fd83){return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x38db6c[_0x136f('0x52')]['id']},'attributes':[_0x136f('0x70')]})[_0x136f('0x1b')](respondWithResult(_0x56fd83,null))['catch'](handleError(_0x56fd83,null));};exports[_0x136f('0x71')]=function(_0x5d9cea,_0x516732,_0x4ebd47){if(_0x5d9cea[_0x136f('0x54')]&&_0x5d9cea[_0x136f('0x54')]['filename']){_0x5d9cea[_0x136f('0x51')][_0x136f('0x59')]=_0x5d9cea[_0x136f('0x54')]['filename'];}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x5d9cea[_0x136f('0x52')]['id']}})[_0x136f('0x1b')](handleEntityNotFound(_0x516732,null))[_0x136f('0x1b')](saveUpdates(_0x5d9cea[_0x136f('0x51')],null))['then'](respondWithResult(_0x516732,null))[_0x136f('0x4d')](handleError(_0x516732,null));};var utilLicense=require(_0x136f('0x16'));exports[_0x136f('0x72')]=function(_0x281acc,_0x5804fe,_0x324e2f){var _0x5d3e61='server/files/images/logos';var _0x42aaff={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2d8f50){if(_0x2d8f50){_0x42aaff=_0x2d8f50;}return db['Setting'][_0x136f('0x50')]({'where':{'id':_0x281acc[_0x136f('0x52')]['id']},'attributes':[_0x136f('0x55'),_0x136f('0x57'),_0x136f('0x59'),_0x136f('0x6c'),_0x136f('0x5a'),_0x136f('0x5b'),_0x136f('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x136f('0x1b')](handleEntityNotFound(_0x5804fe,null))[_0x136f('0x1b')](function(_0x11a3f3){if(_0x11a3f3){var _0x5f51a6=_0x11a3f3[_0x136f('0x59')]&&fs['existsSync'](path['join'](config['root'],_0x5d3e61,_['toLower'](_0x11a3f3[_0x136f('0x59')])))?path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x5d3e61,_['toLower'](_0x11a3f3[_0x136f('0x59')])):path['join'](config[_0x136f('0x60')],_0x5d3e61,_['toLower']('default_preferred.png'));var _0x1ba77f=_0x136f('0x63')+_['upperFirst'](_0x136f('0x59'));if(_0x11a3f3[_0x1ba77f]||!_0x42aaff['custom']||!_0x42aaff[_0x136f('0x59')]){_0x5f51a6=path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x5d3e61,_['toLower'](_0x136f('0x73')));}if(!fs[_0x136f('0x5e')](_0x5f51a6)){throw new db[(_0x136f('0x66'))]['ValidationError'](_[_0x136f('0x64')](_0x136f('0x59'))+_0x136f('0x67'));}return _0x5804fe[_0x136f('0x68')](_0x5f51a6);}})[_0x136f('0x4d')](handleError(_0x5804fe,null));};exports[_0x136f('0x74')]=function(_0x552246,_0x5847cc,_0x245b7e){if(_0x552246[_0x136f('0x54')]&&_0x552246['file'][_0x136f('0x56')]){_0x552246[_0x136f('0x51')]['favicon']=_0x552246['file'][_0x136f('0x56')];}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0x552246['params']['id']}})[_0x136f('0x1b')](handleEntityNotFound(_0x5847cc,null))['then'](saveUpdates(_0x552246[_0x136f('0x51')],null))[_0x136f('0x1b')](respondWithResult(_0x5847cc,null))['catch'](handleError(_0x5847cc,null));};var utilLicense=require(_0x136f('0x16'));exports[_0x136f('0x75')]=function(_0xb93ea7,_0x8f7a4e,_0x4c17fb){var _0x5d2bf1=_0x136f('0x6a');var _0x3fbd18={'custom':![]};return utilLicense['getLicense']()[_0x136f('0x1b')](function(_0x383098){if(_0x383098){_0x3fbd18=_0x383098;}return db[_0x136f('0x34')][_0x136f('0x50')]({'where':{'id':_0xb93ea7[_0x136f('0x52')]['id']},'attributes':[_0x136f('0x55'),_0x136f('0x57'),'preferred','favicon',_0x136f('0x5a'),_0x136f('0x5b'),_0x136f('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x136f('0x1b')](handleEntityNotFound(_0x8f7a4e,null))['then'](function(_0x5e3cf8){if(_0x5e3cf8){var _0x505d48=_0x5e3cf8[_0x136f('0x6c')]&&fs[_0x136f('0x5e')](path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x5d2bf1,_[_0x136f('0x61')](_0x5e3cf8[_0x136f('0x6c')])))?path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x5d2bf1,_['toLower'](_0x5e3cf8['favicon'])):path[_0x136f('0x5f')](config[_0x136f('0x60')],_0x5d2bf1,_[_0x136f('0x61')](_0x136f('0x76')));var _0x2569ea=_0x136f('0x63')+_['upperFirst'](_0x136f('0x6c'));if(_0x5e3cf8[_0x2569ea]||!_0x3fbd18['custom']){_0x505d48=path['join'](config[_0x136f('0x60')],_0x5d2bf1,_['toLower'](_0x136f('0x76')));}if(!fs[_0x136f('0x5e')](_0x505d48)){throw new db[(_0x136f('0x66'))][(_0x136f('0x6e'))](_[_0x136f('0x64')](_0x136f('0x6c'))+_0x136f('0x67'));}return _0x8f7a4e[_0x136f('0x68')](_0x505d48);}})[_0x136f('0x4d')](handleError(_0x8f7a4e,null));};exports[_0x136f('0x77')]=function(_0x406f39,_0x285aed){var _0x357393={'offset':moment()[_0x136f('0x78')]()};_0x357393[_0x136f('0x79')]=moment()['utcOffset'](_0x357393[_0x136f('0x29')])['format'](_0x136f('0x7a'));return _0x285aed[_0x136f('0x26')](0xc8)[_0x136f('0x32')](_0x357393);}; \ No newline at end of file +var _0xe134=['addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','stack','name','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','findAll','rows','catch','params','keys','length','includeAll','body','find','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','securePassword'];(function(_0xc2eeec,_0x1557af){var _0xfa4593=function(_0x5f5986){while(--_0x5f5986){_0xc2eeec['push'](_0xc2eeec['shift']());}};_0xfa4593(++_0x1557af);}(_0xe134,0x102));var _0x4e13=function(_0x4fa288,_0x313817){_0x4fa288=_0x4fa288-0x0;var _0x160e71=_0xe134[_0x4fa288];return _0x160e71;};'use strict';var emlformat=require(_0x4e13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e13('0x2'));var moment=require('moment');var BPromise=require(_0x4e13('0x3'));var Mustache=require(_0x4e13('0x4'));var util=require('util');var path=require(_0x4e13('0x5'));var sox=require(_0x4e13('0x6'));var csv=require('to-csv');var ejs=require(_0x4e13('0x7'));var fs=require('fs');var fs_extra=require(_0x4e13('0x8'));var _=require(_0x4e13('0x9'));var squel=require(_0x4e13('0xa'));var crypto=require(_0x4e13('0xb'));var jsforce=require(_0x4e13('0xc'));var deskjs=require(_0x4e13('0xd'));var toCsv=require(_0x4e13('0xe'));var querystring=require(_0x4e13('0xf'));var Papa=require(_0x4e13('0x10'));var Redis=require(_0x4e13('0x11'));var authService=require(_0x4e13('0x12'));var qs=require(_0x4e13('0x13'));var as=require(_0x4e13('0x14'));var hardwareService=require(_0x4e13('0x15'));var logger=require(_0x4e13('0x16'))(_0x4e13('0x17'));var utils=require(_0x4e13('0x18'));var config=require(_0x4e13('0x19'));var licenseUtil=require(_0x4e13('0x1a'));var db=require(_0x4e13('0x1b'))['db'];var jayson=require(_0x4e13('0x1c'));var client=jayson[_0x4e13('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x542afb,_0x33a455,_0xdd983c,_0x17df99){return new BPromise(function(_0x53c098,_0x10ff25){var _0x13cd48=_0x17df99||client;return _0x13cd48[_0x4e13('0x1e')](_0x542afb,_0xdd983c)[_0x4e13('0x1f')](function(_0x3a6984){logger['info'](_0x4e13('0x20'),_0x33a455,_0x4e13('0x21'));logger[_0x4e13('0x22')](_0x4e13('0x23'),_0x33a455,_0x4e13('0x21'),JSON[_0x4e13('0x24')](_0x3a6984));if(_0x3a6984[_0x4e13('0x25')]){if(_0x3a6984['error'][_0x4e13('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x33a455,_0x3a6984[_0x4e13('0x25')]['message']);return _0x10ff25(_0x3a6984[_0x4e13('0x25')][_0x4e13('0x27')]);}logger[_0x4e13('0x25')]('Setting,\x20%s,\x20%s',_0x33a455,_0x3a6984[_0x4e13('0x25')][_0x4e13('0x27')]);return _0x53c098(_0x3a6984[_0x4e13('0x25')][_0x4e13('0x27')]);}else{logger['info'](_0x4e13('0x20'),_0x33a455,_0x4e13('0x21'));_0x53c098(_0x3a6984[_0x4e13('0x28')]['message']);}})['catch'](function(_0x1dae21){logger[_0x4e13('0x25')](_0x4e13('0x20'),_0x33a455,_0x1dae21);_0x10ff25(_0x1dae21);});});}function respondWithStatusCode(_0x58d2eb,_0x2569c5){_0x2569c5=_0x2569c5||0xcc;return function(_0x109eaf){if(_0x109eaf){return _0x58d2eb[_0x4e13('0x29')](_0x2569c5);}return _0x58d2eb[_0x4e13('0x2a')](_0x2569c5)[_0x4e13('0x2b')]();};}function respondWithResult(_0xca7ee1,_0x414c96){_0x414c96=_0x414c96||0xc8;return function(_0x4c63fc){if(_0x4c63fc){return _0xca7ee1[_0x4e13('0x2a')](_0x414c96)[_0x4e13('0x2c')](_0x4c63fc);}};}function respondWithFilteredResult(_0x3e62d0,_0xf1ea35){return function(_0xf312a6){if(_0xf312a6){var _0x12832b=typeof _0xf1ea35[_0x4e13('0x2d')]===_0x4e13('0x2e')&&typeof _0xf1ea35[_0x4e13('0x2f')]===_0x4e13('0x2e');var _0x4c88e2=_0xf312a6[_0x4e13('0x30')];var _0x486f8e=_0x12832b?0x0:_0xf1ea35[_0x4e13('0x2d')];var _0xf6158c=_0x12832b?_0xf312a6['count']:_0xf1ea35['offset']+_0xf1ea35['limit'];var _0xad643b;if(_0xf6158c>=_0x4c88e2){_0xf6158c=_0x4c88e2;_0xad643b=0xc8;}else{_0xad643b=0xce;}_0x3e62d0['status'](_0xad643b);return _0x3e62d0[_0x4e13('0x31')]('Content-Range',_0x486f8e+'-'+_0xf6158c+'/'+_0x4c88e2)[_0x4e13('0x2c')](_0xf312a6);}return null;};}function patchUpdates(_0x48e74){return function(_0x1ce508){try{jsonpatch['apply'](_0x1ce508,_0x48e74,!![]);}catch(_0x21382f){return BPromise['reject'](_0x21382f);}return _0x1ce508[_0x4e13('0x32')]();};}function saveUpdates(_0x212ac2,_0x5b4ea9){return function(_0xf7fb49){if(_0xf7fb49){return _0xf7fb49[_0x4e13('0x33')](_0x212ac2)['then'](function(_0xe0a7eb){return _0xe0a7eb;});}return null;};}function removeEntity(_0x4dcec4,_0x28d028){return function(_0x5367fd){if(_0x5367fd){return _0x5367fd[_0x4e13('0x34')]()[_0x4e13('0x1f')](function(){_0x4dcec4[_0x4e13('0x2a')](0xcc)[_0x4e13('0x2b')]();});}};}function handleEntityNotFound(_0x18c151,_0x3e1270){return function(_0xdc3c7b){if(!_0xdc3c7b){_0x18c151[_0x4e13('0x29')](0x194);}return _0xdc3c7b;};}function handleError(_0x530efe,_0x3413b9){_0x3413b9=_0x3413b9||0x1f4;return function(_0x54d14c){logger[_0x4e13('0x25')](_0x54d14c[_0x4e13('0x35')]);if(_0x54d14c[_0x4e13('0x36')]){delete _0x54d14c[_0x4e13('0x36')];}_0x530efe[_0x4e13('0x2a')](_0x3413b9)['send'](_0x54d14c);};}exports['index']=function(_0x3b9648,_0x2b0c20){var _0x1ec70f={},_0x232670={},_0x199f08={'count':0x0,'rows':[]};var _0x26d855=_[_0x4e13('0x37')](db['Setting'][_0x4e13('0x38')],function(_0x3f8bcd){return{'name':_0x3f8bcd['fieldName'],'type':_0x3f8bcd[_0x4e13('0x39')][_0x4e13('0x3a')]};});_0x232670['model']=_[_0x4e13('0x37')](_0x26d855,'name');_0x232670[_0x4e13('0x3b')]=_['keys'](_0x3b9648['query']);_0x232670[_0x4e13('0x3c')]=_[_0x4e13('0x3d')](_0x232670[_0x4e13('0x3e')],_0x232670['query']);_0x1ec70f['attributes']=_['intersection'](_0x232670[_0x4e13('0x3e')],qs[_0x4e13('0x3f')](_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x3f')]));_0x1ec70f['attributes']=_0x1ec70f['attributes']['length']?_0x1ec70f[_0x4e13('0x40')]:_0x232670[_0x4e13('0x3e')];if(!_0x3b9648['query']['hasOwnProperty'](_0x4e13('0x41'))){_0x1ec70f[_0x4e13('0x2f')]=qs[_0x4e13('0x2f')](_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x2f')]);_0x1ec70f[_0x4e13('0x2d')]=qs['offset'](_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x2d')]);}_0x1ec70f[_0x4e13('0x42')]=qs[_0x4e13('0x43')](_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x43')]);_0x1ec70f[_0x4e13('0x44')]=qs[_0x4e13('0x3c')](_[_0x4e13('0x45')](_0x3b9648[_0x4e13('0x3b')],_0x232670[_0x4e13('0x3c')]),_0x26d855);if(_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x46')]){_0x1ec70f[_0x4e13('0x44')]=_[_0x4e13('0x47')](_0x1ec70f['where'],{'$or':_[_0x4e13('0x37')](_0x26d855,function(_0x162d08){if(_0x162d08[_0x4e13('0x39')]!==_0x4e13('0x48')){var _0x33b1c6={};_0x33b1c6[_0x162d08[_0x4e13('0x36')]]={'$like':'%'+_0x3b9648[_0x4e13('0x3b')][_0x4e13('0x46')]+'%'};return _0x33b1c6;}})});}_0x1ec70f=_[_0x4e13('0x47')]({},_0x1ec70f,_0x3b9648[_0x4e13('0x49')]);var _0x3b25f3={'where':_0x1ec70f['where']};return db[_0x4e13('0x4a')][_0x4e13('0x30')](_0x3b25f3)[_0x4e13('0x1f')](function(_0x5a3864){_0x199f08[_0x4e13('0x30')]=_0x5a3864;if(_0x3b9648[_0x4e13('0x3b')]['includeAll']){_0x1ec70f['include']=[{'all':!![]}];}return db[_0x4e13('0x4a')][_0x4e13('0x4b')](_0x1ec70f);})[_0x4e13('0x1f')](function(_0x50acfc){_0x199f08[_0x4e13('0x4c')]=_0x50acfc;return _0x199f08;})['then'](respondWithFilteredResult(_0x2b0c20,_0x1ec70f))[_0x4e13('0x4d')](handleError(_0x2b0c20,null));};exports['show']=function(_0x2ab74b,_0x247df3){var _0x3c96ba={'raw':![],'where':{'id':_0x2ab74b[_0x4e13('0x4e')]['id']}},_0x5ad483={};_0x5ad483[_0x4e13('0x3e')]=_[_0x4e13('0x4f')](db['Setting']['rawAttributes']);_0x5ad483['query']=_[_0x4e13('0x4f')](_0x2ab74b[_0x4e13('0x3b')]);_0x5ad483['filters']=_[_0x4e13('0x3d')](_0x5ad483[_0x4e13('0x3e')],_0x5ad483[_0x4e13('0x3b')]);_0x3c96ba[_0x4e13('0x40')]=_[_0x4e13('0x3d')](_0x5ad483[_0x4e13('0x3e')],qs[_0x4e13('0x3f')](_0x2ab74b[_0x4e13('0x3b')][_0x4e13('0x3f')]));_0x3c96ba[_0x4e13('0x40')]=_0x3c96ba[_0x4e13('0x40')][_0x4e13('0x50')]?_0x3c96ba['attributes']:_0x5ad483[_0x4e13('0x3e')];if(_0x2ab74b[_0x4e13('0x3b')][_0x4e13('0x51')]){_0x3c96ba['include']=[{'all':!![]}];}_0x3c96ba=_['merge']({},_0x3c96ba,_0x2ab74b[_0x4e13('0x49')]);return db[_0x4e13('0x4a')]['find'](_0x3c96ba)[_0x4e13('0x1f')](handleEntityNotFound(_0x247df3,null))[_0x4e13('0x1f')](respondWithResult(_0x247df3,null))[_0x4e13('0x4d')](handleError(_0x247df3,null));};exports['update']=function(_0x13a5b6,_0x1a5e59){if(_0x13a5b6[_0x4e13('0x52')]['id']){delete _0x13a5b6[_0x4e13('0x52')]['id'];}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x13a5b6[_0x4e13('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a5e59,null))[_0x4e13('0x1f')](saveUpdates(_0x13a5b6[_0x4e13('0x52')],null))[_0x4e13('0x1f')](respondWithResult(_0x1a5e59,null))['catch'](handleError(_0x1a5e59,null));};exports[_0x4e13('0x54')]=function(_0x3a3909,_0x56d6e9,_0x2d0932){if(_0x3a3909[_0x4e13('0x55')]&&_0x3a3909[_0x4e13('0x55')][_0x4e13('0x56')]){_0x3a3909[_0x4e13('0x52')][_0x4e13('0x57')]=_0x3a3909[_0x4e13('0x55')]['filename'];}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x3a3909[_0x4e13('0x4e')]['id']}})[_0x4e13('0x1f')](handleEntityNotFound(_0x56d6e9,null))[_0x4e13('0x1f')](saveUpdates(_0x3a3909[_0x4e13('0x52')],null))[_0x4e13('0x1f')](respondWithResult(_0x56d6e9,null))['catch'](handleError(_0x56d6e9,null));};exports[_0x4e13('0x58')]=function(_0x25444f,_0xfa48af,_0x4df755){if(_0x25444f[_0x4e13('0x55')]&&_0x25444f[_0x4e13('0x55')]['filename']){_0x25444f[_0x4e13('0x52')]['loginLogo']=_0x25444f[_0x4e13('0x55')][_0x4e13('0x56')];}return db[_0x4e13('0x4a')]['find']({'where':{'id':_0x25444f[_0x4e13('0x4e')]['id']}})[_0x4e13('0x1f')](handleEntityNotFound(_0xfa48af,null))['then'](saveUpdates(_0x25444f[_0x4e13('0x52')],null))['then'](respondWithResult(_0xfa48af,null))[_0x4e13('0x4d')](handleError(_0xfa48af,null));};var utilLicense=require(_0x4e13('0x1a'));exports[_0x4e13('0x59')]=function(_0x3a0805,_0x28aa93,_0x144d62){var _0x5ce042=_0x4e13('0x5a');var _0x253fb6={'custom':![]};return utilLicense[_0x4e13('0x5b')]()[_0x4e13('0x1f')](function(_0x209da8){if(_0x209da8){_0x253fb6=_0x209da8;}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x3a0805[_0x4e13('0x4e')]['id']},'attributes':[_0x4e13('0x57'),_0x4e13('0x5c'),_0x4e13('0x5d'),_0x4e13('0x5e'),'defaultLogo',_0x4e13('0x5f'),_0x4e13('0x60'),_0x4e13('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x28aa93,null))['then'](function(_0x431d85){if(_0x431d85){var _0x5082fa=_0x431d85[_0x4e13('0x57')]&&fs[_0x4e13('0x62')](path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5ce042,_[_0x4e13('0x65')](_0x431d85[_0x4e13('0x57')])))?path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5ce042,_[_0x4e13('0x65')](_0x431d85['logo'])):path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5ce042,_['toLower'](_0x4e13('0x66')));var _0x23be95=_0x4e13('0x67')+_[_0x4e13('0x68')](_0x4e13('0x57'));if(_0x431d85[_0x23be95]||!_0x253fb6[_0x4e13('0x69')]){_0x5082fa=path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5ce042,_['toLower'](_0x4e13('0x66')));}if(!fs[_0x4e13('0x62')](_0x5082fa)){throw new db[(_0x4e13('0x6a'))][(_0x4e13('0x6b'))](_[_0x4e13('0x68')]('logo')+_0x4e13('0x6c'));}return _0x28aa93[_0x4e13('0x6d')](_0x5082fa);}})['catch'](handleError(_0x28aa93,null));};var utilLicense=require(_0x4e13('0x1a'));exports[_0x4e13('0x6e')]=function(_0x172fb7,_0x4aeead,_0x4f2fd2){var _0x5a0821=_0x4e13('0x5a');var _0x5ab98a={'custom':![]};return utilLicense['getLicense']()[_0x4e13('0x1f')](function(_0x7a2c15){if(_0x7a2c15){_0x5ab98a=_0x7a2c15;}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x172fb7[_0x4e13('0x4e')]['id']},'attributes':['logo',_0x4e13('0x5c'),_0x4e13('0x5d'),_0x4e13('0x5e'),_0x4e13('0x6f'),_0x4e13('0x5f'),_0x4e13('0x60'),_0x4e13('0x61')],'raw':!![]});})[_0x4e13('0x1f')](handleEntityNotFound(_0x4aeead,null))[_0x4e13('0x1f')](function(_0x5156e2){if(_0x5156e2){var _0x2e0025=_0x5156e2['loginLogo']&&fs[_0x4e13('0x62')](path['join'](config['root'],_0x5a0821,_[_0x4e13('0x65')](_0x5156e2[_0x4e13('0x5c')])))?path[_0x4e13('0x63')](config['root'],_0x5a0821,_[_0x4e13('0x65')](_0x5156e2[_0x4e13('0x5c')])):path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5a0821,_[_0x4e13('0x65')]('default_loginLogo.svg'));var _0x36940d=_0x4e13('0x67')+_[_0x4e13('0x68')](_0x4e13('0x5c'));if(_0x5156e2[_0x36940d]||!_0x5ab98a[_0x4e13('0x69')]){_0x2e0025=path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x5a0821,_[_0x4e13('0x65')](_0x4e13('0x70')));}if(!fs['existsSync'](_0x2e0025)){throw new db['Sequelize'][(_0x4e13('0x6b'))](_[_0x4e13('0x68')](_0x4e13('0x5c'))+_0x4e13('0x6c'));}return _0x4aeead[_0x4e13('0x6d')](_0x2e0025);}})[_0x4e13('0x4d')](handleError(_0x4aeead,null));};exports['gdpr']=function(_0x3228d0,_0x4c22b8){return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x3228d0[_0x4e13('0x4e')]['id']},'attributes':[_0x4e13('0x71')]})[_0x4e13('0x1f')](respondWithResult(_0x4c22b8,null))['catch'](handleError(_0x4c22b8,null));};exports[_0x4e13('0x72')]=function(_0x57adb2,_0x3be61e,_0x415d11){if(_0x57adb2[_0x4e13('0x55')]&&_0x57adb2['file'][_0x4e13('0x56')]){_0x57adb2[_0x4e13('0x52')][_0x4e13('0x5d')]=_0x57adb2[_0x4e13('0x55')]['filename'];}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x57adb2['params']['id']}})['then'](handleEntityNotFound(_0x3be61e,null))[_0x4e13('0x1f')](saveUpdates(_0x57adb2['body'],null))[_0x4e13('0x1f')](respondWithResult(_0x3be61e,null))['catch'](handleError(_0x3be61e,null));};var utilLicense=require(_0x4e13('0x1a'));exports[_0x4e13('0x73')]=function(_0x3639c5,_0x3dfff2,_0x63e2fc){var _0x1f2338='server/files/images/logos';var _0x5788dd={'custom':![]};return utilLicense[_0x4e13('0x5b')]()[_0x4e13('0x1f')](function(_0x43e758){if(_0x43e758){_0x5788dd=_0x43e758;}return db[_0x4e13('0x4a')][_0x4e13('0x53')]({'where':{'id':_0x3639c5[_0x4e13('0x4e')]['id']},'attributes':[_0x4e13('0x57'),_0x4e13('0x5c'),'preferred','favicon',_0x4e13('0x6f'),'defaultLoginLogo',_0x4e13('0x60'),'defaultFavicon'],'raw':!![]});})[_0x4e13('0x1f')](handleEntityNotFound(_0x3dfff2,null))['then'](function(_0x526850){if(_0x526850){var _0x42def5=_0x526850['preferred']&&fs[_0x4e13('0x62')](path['join'](config['root'],_0x1f2338,_[_0x4e13('0x65')](_0x526850[_0x4e13('0x5d')])))?path[_0x4e13('0x63')](config['root'],_0x1f2338,_['toLower'](_0x526850[_0x4e13('0x5d')])):path[_0x4e13('0x63')](config['root'],_0x1f2338,_[_0x4e13('0x65')](_0x4e13('0x74')));var _0x5f3e4f='default'+_[_0x4e13('0x68')]('preferred');if(_0x526850[_0x5f3e4f]||!_0x5788dd[_0x4e13('0x69')]||!_0x5788dd[_0x4e13('0x5d')]){_0x42def5=path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x1f2338,_[_0x4e13('0x65')](_0x4e13('0x74')));}if(!fs['existsSync'](_0x42def5)){throw new db[(_0x4e13('0x6a'))][(_0x4e13('0x6b'))](_[_0x4e13('0x68')](_0x4e13('0x5d'))+_0x4e13('0x6c'));}return _0x3dfff2[_0x4e13('0x6d')](_0x42def5);}})[_0x4e13('0x4d')](handleError(_0x3dfff2,null));};exports[_0x4e13('0x75')]=function(_0x28b701,_0x3537ff,_0x418815){if(_0x28b701[_0x4e13('0x55')]&&_0x28b701['file']['filename']){_0x28b701['body'][_0x4e13('0x5e')]=_0x28b701['file']['filename'];}return db['Setting'][_0x4e13('0x53')]({'where':{'id':_0x28b701[_0x4e13('0x4e')]['id']}})[_0x4e13('0x1f')](handleEntityNotFound(_0x3537ff,null))[_0x4e13('0x1f')](saveUpdates(_0x28b701['body'],null))[_0x4e13('0x1f')](respondWithResult(_0x3537ff,null))[_0x4e13('0x4d')](handleError(_0x3537ff,null));};var utilLicense=require(_0x4e13('0x1a'));exports['getFavicon']=function(_0x5c56d5,_0x1deb41,_0x57ba48){var _0x330955=_0x4e13('0x5a');var _0x32eff7={'custom':![]};return utilLicense[_0x4e13('0x5b')]()[_0x4e13('0x1f')](function(_0x1885d1){if(_0x1885d1){_0x32eff7=_0x1885d1;}return db['Setting'][_0x4e13('0x53')]({'where':{'id':_0x5c56d5['params']['id']},'attributes':['logo',_0x4e13('0x5c'),'preferred','favicon','defaultLogo',_0x4e13('0x5f'),_0x4e13('0x60'),_0x4e13('0x61')],'raw':!![]});})[_0x4e13('0x1f')](handleEntityNotFound(_0x1deb41,null))[_0x4e13('0x1f')](function(_0x49d70c){if(_0x49d70c){var _0x497994=_0x49d70c['favicon']&&fs[_0x4e13('0x62')](path['join'](config[_0x4e13('0x64')],_0x330955,_[_0x4e13('0x65')](_0x49d70c['favicon'])))?path['join'](config['root'],_0x330955,_[_0x4e13('0x65')](_0x49d70c[_0x4e13('0x5e')])):path[_0x4e13('0x63')](config[_0x4e13('0x64')],_0x330955,_[_0x4e13('0x65')](_0x4e13('0x76')));var _0x191616=_0x4e13('0x67')+_[_0x4e13('0x68')](_0x4e13('0x5e'));if(_0x49d70c[_0x191616]||!_0x32eff7[_0x4e13('0x69')]){_0x497994=path['join'](config[_0x4e13('0x64')],_0x330955,_[_0x4e13('0x65')](_0x4e13('0x76')));}if(!fs['existsSync'](_0x497994)){throw new db[(_0x4e13('0x6a'))][(_0x4e13('0x6b'))](_[_0x4e13('0x68')](_0x4e13('0x5e'))+_0x4e13('0x6c'));}return _0x1deb41[_0x4e13('0x6d')](_0x497994);}})[_0x4e13('0x4d')](handleError(_0x1deb41,null));};exports[_0x4e13('0x77')]=function(_0x314ab3,_0x8f00d){var _0x3bebbc={'offset':moment()['utcOffset']()};_0x3bebbc[_0x4e13('0x78')]=moment()['utcOffset'](_0x3bebbc[_0x4e13('0x2d')])[_0x4e13('0x79')](_0x4e13('0x7a'));return _0x8f00d[_0x4e13('0x2a')](0xc8)[_0x4e13('0x7b')](_0x3bebbc);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 04a0b60..91e7bb2 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x2af209,_0x4ade86){var _0x58ee63=function(_0x7e83b8){while(--_0x7e83b8){_0x2af209['push'](_0x2af209['shift']());}};_0x58ee63(++_0x4ade86);}(_0xe14b,0x93));var _0xbe14=function(_0x22165a,_0x228d4e){_0x22165a=_0x22165a-0x0;var _0x23d058=_0xe14b[_0x22165a];return _0x23d058;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 149ac4f..0cc49b5 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 _0x5b2f=['map','include','model','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','options','raw','attributes'];(function(_0x2b1d87,_0x27c1f5){var _0x496c38=function(_0x3ba8c2){while(--_0x3ba8c2){_0x2b1d87['push'](_0x2b1d87['shift']());}};_0x496c38(++_0x27c1f5);}(_0x5b2f,0xe4));var _0xf5b2=function(_0x517d9e,_0x214a0a){_0x517d9e=_0x517d9e-0x0;var _0x2da8ac=_0x5b2f[_0x517d9e];return _0x2da8ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf5b2('0x0'));var BPromise=require(_0xf5b2('0x1'));var rs=require(_0xf5b2('0x2'));var fs=require('fs');var Redis=require(_0xf5b2('0x3'));var db=require(_0xf5b2('0x4'))['db'];var utils=require(_0xf5b2('0x5'));var logger=require(_0xf5b2('0x6'))(_0xf5b2('0x7'));var config=require(_0xf5b2('0x8'));var jayson=require(_0xf5b2('0x9'));var client=jayson[_0xf5b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f5f7b,_0x2e508f,_0x3e8c13){return new BPromise(function(_0x2e82c5,_0x560298){return client[_0xf5b2('0xb')](_0x1f5f7b,_0x3e8c13)[_0xf5b2('0xc')](function(_0xae13ce){logger[_0xf5b2('0xd')](_0xf5b2('0xe'),_0x2e508f,_0xf5b2('0xf'));logger[_0xf5b2('0x10')](_0xf5b2('0x11'),_0x2e508f,'request\x20sent',JSON['stringify'](_0xae13ce));if(_0xae13ce[_0xf5b2('0x12')]){if(_0xae13ce[_0xf5b2('0x12')][_0xf5b2('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x2e508f,_0xae13ce[_0xf5b2('0x12')]['message']);return _0x560298(_0xae13ce['error']['message']);}logger[_0xf5b2('0x12')](_0xf5b2('0xe'),_0x2e508f,_0xae13ce[_0xf5b2('0x12')]['message']);return _0x2e82c5(_0xae13ce['error'][_0xf5b2('0x14')]);}else{logger[_0xf5b2('0xd')](_0xf5b2('0xe'),_0x2e508f,_0xf5b2('0xf'));_0x2e82c5(_0xae13ce[_0xf5b2('0x15')][_0xf5b2('0x14')]);}})[_0xf5b2('0x16')](function(_0x584617){logger[_0xf5b2('0x12')](_0xf5b2('0xe'),_0x2e508f,_0x584617);_0x560298(_0x584617);});});}exports[_0xf5b2('0x17')]=function(_0x149fbb){var _0x83b9b1=this;return new Promise(function(_0x444594,_0x510710){return db[_0xf5b2('0x18')]['find']({'raw':_0x149fbb['options']?_0x149fbb[_0xf5b2('0x19')][_0xf5b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x149fbb[_0xf5b2('0x19')]?_0x149fbb[_0xf5b2('0x19')]['where']||null:null,'attributes':_0x149fbb[_0xf5b2('0x19')]?_0x149fbb['options'][_0xf5b2('0x1b')]||null:null,'include':_0x149fbb[_0xf5b2('0x19')]?_0x149fbb[_0xf5b2('0x19')]['include']?_[_0xf5b2('0x1c')](_0x149fbb[_0xf5b2('0x19')][_0xf5b2('0x1d')],function(_0x317aa4){return{'model':db[_0x317aa4[_0xf5b2('0x1e')]],'as':_0x317aa4['as'],'attributes':_0x317aa4[_0xf5b2('0x1b')],'include':_0x317aa4['include']?_['map'](_0x317aa4[_0xf5b2('0x1d')],function(_0x351fe5){return{'model':db[_0x351fe5[_0xf5b2('0x1e')]],'as':_0x351fe5['as'],'attributes':_0x351fe5[_0xf5b2('0x1b')],'include':_0x351fe5[_0xf5b2('0x1d')]?_['map'](_0x351fe5['include'],function(_0x135c2d){return{'model':db[_0x135c2d[_0xf5b2('0x1e')]],'as':_0x135c2d['as'],'attributes':_0x135c2d[_0xf5b2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf5b2('0xc')](function(_0x457c3a){logger['info'](_0xf5b2('0x17'),_0x149fbb);logger[_0xf5b2('0x10')](_0xf5b2('0x17'),_0x149fbb,JSON[_0xf5b2('0x1f')](_0x457c3a));_0x444594(_0x457c3a);})[_0xf5b2('0x16')](function(_0x1a1681){logger[_0xf5b2('0x12')]('ShowSetting',_0x1a1681[_0xf5b2('0x14')],_0x149fbb);_0x510710(_0x83b9b1['error'](0x1f4,_0x1a1681[_0xf5b2('0x14')]));});});}; \ No newline at end of file +var _0x4533=['message','ShowSetting','Setting','find','options','where','attributes','include','map','model','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error'];(function(_0x806bc,_0x49db1c){var _0x476d9c=function(_0x46c2bf){while(--_0x46c2bf){_0x806bc['push'](_0x806bc['shift']());}};_0x476d9c(++_0x49db1c);}(_0x4533,0x1dc));var _0x3453=function(_0x3c49d4,_0x2af6f6){_0x3c49d4=_0x3c49d4-0x0;var _0x33932c=_0x4533[_0x3c49d4];return _0x33932c;};'use strict';var _=require('lodash');var util=require(_0x3453('0x0'));var moment=require(_0x3453('0x1'));var BPromise=require(_0x3453('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3453('0x3'));var db=require(_0x3453('0x4'))['db'];var utils=require(_0x3453('0x5'));var logger=require(_0x3453('0x6'))(_0x3453('0x7'));var config=require(_0x3453('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3453('0x9')][_0x3453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127e74,_0x7fee09,_0x3a4b2c){return new BPromise(function(_0x358d97,_0x4bbfd1){return client[_0x3453('0xb')](_0x127e74,_0x3a4b2c)[_0x3453('0xc')](function(_0x5170b7){logger[_0x3453('0xd')](_0x3453('0xe'),_0x7fee09,'request\x20sent');logger[_0x3453('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x7fee09,_0x3453('0x10'),JSON[_0x3453('0x11')](_0x5170b7));if(_0x5170b7['error']){if(_0x5170b7['error'][_0x3453('0x12')]===0x1f4){logger[_0x3453('0x13')](_0x3453('0xe'),_0x7fee09,_0x5170b7[_0x3453('0x13')]['message']);return _0x4bbfd1(_0x5170b7[_0x3453('0x13')][_0x3453('0x14')]);}logger[_0x3453('0x13')](_0x3453('0xe'),_0x7fee09,_0x5170b7['error'][_0x3453('0x14')]);return _0x358d97(_0x5170b7[_0x3453('0x13')]['message']);}else{logger['info'](_0x3453('0xe'),_0x7fee09,'request\x20sent');_0x358d97(_0x5170b7['result'][_0x3453('0x14')]);}})['catch'](function(_0x3fac36){logger[_0x3453('0x13')](_0x3453('0xe'),_0x7fee09,_0x3fac36);_0x4bbfd1(_0x3fac36);});});}exports[_0x3453('0x15')]=function(_0x9cb3ab){var _0x4f42ef=this;return new Promise(function(_0x156681,_0x4e48b5){return db[_0x3453('0x16')][_0x3453('0x17')]({'raw':_0x9cb3ab[_0x3453('0x18')]?_0x9cb3ab[_0x3453('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x9cb3ab['options']?_0x9cb3ab[_0x3453('0x18')][_0x3453('0x19')]||null:null,'attributes':_0x9cb3ab[_0x3453('0x18')]?_0x9cb3ab[_0x3453('0x18')][_0x3453('0x1a')]||null:null,'include':_0x9cb3ab[_0x3453('0x18')]?_0x9cb3ab[_0x3453('0x18')][_0x3453('0x1b')]?_[_0x3453('0x1c')](_0x9cb3ab[_0x3453('0x18')][_0x3453('0x1b')],function(_0x1d31a2){return{'model':db[_0x1d31a2[_0x3453('0x1d')]],'as':_0x1d31a2['as'],'attributes':_0x1d31a2[_0x3453('0x1a')],'include':_0x1d31a2[_0x3453('0x1b')]?_['map'](_0x1d31a2[_0x3453('0x1b')],function(_0x9038c4){return{'model':db[_0x9038c4[_0x3453('0x1d')]],'as':_0x9038c4['as'],'attributes':_0x9038c4[_0x3453('0x1a')],'include':_0x9038c4[_0x3453('0x1b')]?_[_0x3453('0x1c')](_0x9038c4[_0x3453('0x1b')],function(_0x67c624){return{'model':db[_0x67c624[_0x3453('0x1d')]],'as':_0x67c624['as'],'attributes':_0x67c624[_0x3453('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3453('0xc')](function(_0x8114f9){logger['info'](_0x3453('0x15'),_0x9cb3ab);logger[_0x3453('0xf')](_0x3453('0x15'),_0x9cb3ab,JSON[_0x3453('0x11')](_0x8114f9));_0x156681(_0x8114f9);})[_0x3453('0x1e')](function(_0x68ec10){logger[_0x3453('0x13')]('ShowSetting',_0x68ec10[_0x3453('0x14')],_0x9cb3ab);_0x4e48b5(_0x4f42ef[_0x3453('0x13')](0x1f4,_0x68ec10[_0x3453('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e41542f..644d5b5 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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x24b49c,_0x1aed57){var _0x3f21fc=function(_0x4dc9ef){while(--_0x4dc9ef){_0x24b49c['push'](_0x24b49c['shift']());}};_0x3f21fc(++_0x1aed57);}(_0x5fc3,0xa8));var _0x35fc=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0x5fc3[_0x401ccd];return _0x5a57ad;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0xceb427,_0x58b351){var _0x2ee920=function(_0x3d9c7d){while(--_0x3d9c7d){_0xceb427['push'](_0xceb427['shift']());}};_0x2ee920(++_0x58b351);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 9b66713..08731a7 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 _0x77a8=['mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','connectel','plivo','clickatell','bandwidth','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x213350,_0x1ac15f){var _0x2b6615=function(_0x487946){while(--_0x487946){_0x213350['push'](_0x213350['shift']());}};_0x2b6615(++_0x1ac15f);}(_0x77a8,0xc9));var _0x877a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77a8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x877a('0x0'));module[_0x877a('0x1')]={'name':{'type':Sequelize[_0x877a('0x2')],'unique':_0x877a('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x877a('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x877a('0x2')]},'type':{'type':Sequelize[_0x877a('0x4')](_0x877a('0x5'),'skebby',_0x877a('0x6'),'clicksend',_0x877a('0x7'),_0x877a('0x8'),_0x877a('0x9'),_0x877a('0xa'),'infobip',_0x877a('0xb'))},'accountSid':{'type':Sequelize[_0x877a('0x2')]},'authId':{'type':Sequelize[_0x877a('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x877a('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x877a('0x2')]},'password':{'type':Sequelize[_0x877a('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x877a('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x877a('0xc')],'defaultValue':function(){return _0x877a('0xd');}},'notificationSound':{'type':Sequelize[_0x877a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x877a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x877a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x877a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x877a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x877a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x877a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x877a('0xf')],'comment':_0x877a('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x877a('0xe')],'defaultValue':![],'comment':_0x877a('0x11'),'set':function(_0x188ec6){if(!_0x188ec6)this['setDataValue'](_0x877a('0x12'),null);this['setDataValue'](_0x877a('0x13'),_0x188ec6);}}}; \ No newline at end of file +var _0x5acd=['csc','intelepeer','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','STRING','name','ENUM','twilio','skebby','connectel','clicksend','bandwidth'];(function(_0x3ff0f0,_0x5523bf){var _0x5dc82a=function(_0x14d26d){while(--_0x14d26d){_0x3ff0f0['push'](_0x3ff0f0['shift']());}};_0x5dc82a(++_0x5523bf);}(_0x5acd,0x190));var _0xd5ac=function(_0x499494,_0x36f3bd){_0x499494=_0x499494-0x0;var _0x587430=_0x5acd[_0x499494];return _0x587430;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xd5ac('0x0')],'unique':_0xd5ac('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xd5ac('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0xd5ac('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0xd5ac('0x0')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd5ac('0x0')]},'type':{'type':Sequelize[_0xd5ac('0x2')](_0xd5ac('0x3'),_0xd5ac('0x4'),_0xd5ac('0x5'),_0xd5ac('0x6'),'plivo','clickatell',_0xd5ac('0x7'),_0xd5ac('0x8'),'infobip',_0xd5ac('0x9'))},'accountSid':{'type':Sequelize[_0xd5ac('0x0')]},'authId':{'type':Sequelize[_0xd5ac('0x0')]},'authToken':{'type':Sequelize[_0xd5ac('0x0')]},'smsMethod':{'type':Sequelize[_0xd5ac('0x2')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd5ac('0x0')]},'password':{'type':Sequelize[_0xd5ac('0x0')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd5ac('0x0')]},'accountId':{'type':Sequelize[_0xd5ac('0x0')]},'senderString':{'type':Sequelize[_0xd5ac('0x0')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd5ac('0x0')]},'notificationTemplate':{'type':Sequelize[_0xd5ac('0xa')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd5ac('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd5ac('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd5ac('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5ac('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd5ac('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd5ac('0x0')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd5ac('0xc')],'comment':_0xd5ac('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xd5ac('0xb')],'defaultValue':![],'comment':_0xd5ac('0xe'),'set':function(_0x3aad5c){if(!_0x3aad5c)this[_0xd5ac('0xf')]('mandatoryDispositionPauseId',null);this[_0xd5ac('0xf')](_0xd5ac('0x10'),_0x3aad5c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 39f3aca..d823171 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 _0x56a0=['debug','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','pick','filter','rows','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','sms','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','From','Text','MessageUUID','infobip','results','text','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','omit','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','groupName','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','request\x20sent'];(function(_0x362ff4,_0x3cb397){var _0x30e526=function(_0xc136f3){while(--_0xc136f3){_0x362ff4['push'](_0x362ff4['shift']());}};_0x30e526(++_0x3cb397);}(_0x56a0,0xca));var _0x056a=function(_0x100827,_0x49215d){_0x100827=_0x100827-0x0;var _0x1e6245=_0x56a0[_0x100827];return _0x1e6245;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x056a('0x0'));var jsonpatch=require(_0x056a('0x1'));var rp=require(_0x056a('0x2'));var moment=require('moment');var BPromise=require(_0x056a('0x3'));var Mustache=require(_0x056a('0x4'));var util=require(_0x056a('0x5'));var path=require(_0x056a('0x6'));var sox=require('sox');var csv=require(_0x056a('0x7'));var ejs=require(_0x056a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x056a('0x9'));var squel=require('squel');var crypto=require(_0x056a('0xa'));var jsforce=require(_0x056a('0xb'));var deskjs=require(_0x056a('0xc'));var toCsv=require(_0x056a('0x7'));var querystring=require(_0x056a('0xd'));var Papa=require(_0x056a('0xe'));var Redis=require('ioredis');var authService=require(_0x056a('0xf'));var qs=require(_0x056a('0x10'));var as=require(_0x056a('0x11'));var hardwareService=require(_0x056a('0x12'));var logger=require(_0x056a('0x13'))('api');var utils=require(_0x056a('0x14'));var config=require(_0x056a('0x15'));var licenseUtil=require(_0x056a('0x16'));var db=require(_0x056a('0x17'))['db'];config[_0x056a('0x18')]=_[_0x056a('0x19')](config[_0x056a('0x18')],{'host':_0x056a('0x1a'),'port':0x18eb});var socket=require(_0x056a('0x1b'))(new Redis(config['redis']));require(_0x056a('0x1c'))[_0x056a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x056a('0x1e')][_0x056a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x59dd51,_0x5f18ab,_0x1cd306,_0x285a57){return new BPromise(function(_0x59fb74,_0x3f3ff6){var _0x2644ce=_0x285a57||client;return _0x2644ce[_0x056a('0x20')](_0x59dd51,_0x1cd306)['then'](function(_0x100eb7){logger[_0x056a('0x21')]('SmsAccount,\x20%s,\x20%s',_0x5f18ab,_0x056a('0x22'));logger[_0x056a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5f18ab,_0x056a('0x22'),JSON[_0x056a('0x24')](_0x100eb7));if(_0x100eb7[_0x056a('0x25')]){if(_0x100eb7[_0x056a('0x25')][_0x056a('0x26')]===0x1f4){logger[_0x056a('0x25')]('SmsAccount,\x20%s,\x20%s',_0x5f18ab,_0x100eb7[_0x056a('0x25')][_0x056a('0x27')]);return _0x3f3ff6(_0x100eb7[_0x056a('0x25')][_0x056a('0x27')]);}logger[_0x056a('0x25')](_0x056a('0x28'),_0x5f18ab,_0x100eb7['error'][_0x056a('0x27')]);return _0x59fb74(_0x100eb7[_0x056a('0x25')][_0x056a('0x27')]);}else{logger[_0x056a('0x21')](_0x056a('0x28'),_0x5f18ab,_0x056a('0x22'));_0x59fb74(_0x100eb7[_0x056a('0x29')][_0x056a('0x27')]);}})[_0x056a('0x2a')](function(_0x29acd6){logger['error'](_0x056a('0x28'),_0x5f18ab,_0x29acd6);_0x3f3ff6(_0x29acd6);});});}function respondWithStatusCode(_0x1f6228,_0x2c8cfd){_0x2c8cfd=_0x2c8cfd||0xcc;return function(_0x130c91){if(_0x130c91){return _0x1f6228['sendStatus'](_0x2c8cfd);}return _0x1f6228['status'](_0x2c8cfd)[_0x056a('0x2b')]();};}function respondWithResult(_0x5082d3,_0x22bc0d){_0x22bc0d=_0x22bc0d||0xc8;return function(_0x55d4d9){if(_0x55d4d9){return _0x5082d3[_0x056a('0x2c')](_0x22bc0d)[_0x056a('0x2d')](_0x55d4d9);}};}function respondWithFilteredResult(_0x59d46e,_0xf57511){return function(_0x261da0){if(_0x261da0){var _0x38ae68=typeof _0xf57511[_0x056a('0x2e')]===_0x056a('0x2f')&&typeof _0xf57511[_0x056a('0x30')]===_0x056a('0x2f');var _0x2d2f70=_0x261da0[_0x056a('0x31')];var _0x4d901e=_0x38ae68?0x0:_0xf57511[_0x056a('0x2e')];var _0x1585f4=_0x38ae68?_0x261da0[_0x056a('0x31')]:_0xf57511['offset']+_0xf57511[_0x056a('0x30')];var _0x366437;if(_0x1585f4>=_0x2d2f70){_0x1585f4=_0x2d2f70;_0x366437=0xc8;}else{_0x366437=0xce;}_0x59d46e[_0x056a('0x2c')](_0x366437);return _0x59d46e[_0x056a('0x32')](_0x056a('0x33'),_0x4d901e+'-'+_0x1585f4+'/'+_0x2d2f70)[_0x056a('0x2d')](_0x261da0);}return null;};}function patchUpdates(_0x18f04a){return function(_0x363ae7){try{jsonpatch[_0x056a('0x34')](_0x363ae7,_0x18f04a,!![]);}catch(_0x530e8f){return BPromise['reject'](_0x530e8f);}return _0x363ae7[_0x056a('0x35')]();};}function saveUpdates(_0x567a08,_0x18252a){return function(_0xfde618){if(_0xfde618){return _0xfde618[_0x056a('0x36')](_0x567a08)[_0x056a('0x37')](function(_0x36ef5b){return _0x36ef5b;});}return null;};}function removeEntity(_0xd9f673,_0x3ddad4){return function(_0x54dc5d){if(_0x54dc5d){return _0x54dc5d[_0x056a('0x38')]()[_0x056a('0x37')](function(){var _0x268989=_0x54dc5d['get']({'plain':!![]});var _0x3d9caa=_0x056a('0x39');return db[_0x056a('0x3a')][_0x056a('0x38')]({'where':{'type':_0x3d9caa,'resourceId':_0x268989['id']}})['then'](function(){return _0x54dc5d;});})[_0x056a('0x37')](function(){_0xd9f673[_0x056a('0x2c')](0xcc)[_0x056a('0x2b')]();});}};}function handleEntityNotFound(_0x2bc276,_0x339381){return function(_0x531ea1){if(!_0x531ea1){_0x2bc276[_0x056a('0x3b')](0x194);}return _0x531ea1;};}function handleError(_0x53c555,_0x48e724){_0x48e724=_0x48e724||0x1f4;return function(_0x10031b){logger[_0x056a('0x25')](_0x10031b[_0x056a('0x3c')]);if(_0x10031b[_0x056a('0x3d')]){delete _0x10031b[_0x056a('0x3d')];}_0x53c555['status'](_0x48e724)[_0x056a('0x3e')](_0x10031b);};}exports[_0x056a('0x3f')]=function(_0x1b5876,_0x3ee77d){var _0x58e06a={'include':[{'model':db[_0x056a('0x40')],'as':_0x056a('0x41')}]},_0x588425={},_0x4a473c={'count':0x0,'rows':[]};var _0x6ca59e=_[_0x056a('0x42')](db[_0x056a('0x43')][_0x056a('0x44')],function(_0x1633ea){return{'name':_0x1633ea[_0x056a('0x45')],'type':_0x1633ea['type'][_0x056a('0x46')]};});_0x588425[_0x056a('0x47')]=_['map'](_0x6ca59e,'name');_0x588425[_0x056a('0x48')]=_[_0x056a('0x49')](_0x1b5876[_0x056a('0x48')]);_0x588425[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x588425[_0x056a('0x47')],_0x588425[_0x056a('0x48')]);_0x58e06a[_0x056a('0x4c')]=_['intersection'](_0x588425['model'],qs[_0x056a('0x4d')](_0x1b5876['query'][_0x056a('0x4d')]));_0x58e06a[_0x056a('0x4c')]=_0x58e06a[_0x056a('0x4c')][_0x056a('0x4e')]?_0x58e06a[_0x056a('0x4c')]:_0x588425[_0x056a('0x47')];if(!_0x1b5876[_0x056a('0x48')][_0x056a('0x4f')](_0x056a('0x50'))){_0x58e06a['limit']=qs[_0x056a('0x30')](_0x1b5876['query'][_0x056a('0x30')]);_0x58e06a[_0x056a('0x2e')]=qs[_0x056a('0x2e')](_0x1b5876['query'][_0x056a('0x2e')]);}_0x58e06a[_0x056a('0x51')]=qs['sort'](_0x1b5876['query'][_0x056a('0x52')]);_0x58e06a[_0x056a('0x53')]=qs[_0x056a('0x4a')](_['pick'](_0x1b5876[_0x056a('0x48')],_0x588425['filters']),_0x6ca59e);if(_0x1b5876[_0x056a('0x48')]['filter']){_0x58e06a[_0x056a('0x53')]=_[_0x056a('0x54')](_0x58e06a[_0x056a('0x53')],{'$or':_[_0x056a('0x42')](_0x6ca59e,function(_0x4246a5){if(_0x4246a5[_0x056a('0x55')]!==_0x056a('0x56')){var _0x1eb362={};_0x1eb362[_0x4246a5[_0x056a('0x3d')]]={'$like':'%'+_0x1b5876['query']['filter']+'%'};return _0x1eb362;}})});}_0x58e06a=_[_0x056a('0x54')]({},_0x58e06a,_0x1b5876[_0x056a('0x57')]);var _0x49b0af={'where':_0x58e06a['where']};return db[_0x056a('0x43')][_0x056a('0x31')](_0x49b0af)[_0x056a('0x37')](function(_0x42fe30){_0x4a473c[_0x056a('0x31')]=_0x42fe30;if(_0x1b5876['query'][_0x056a('0x58')]){_0x58e06a['include']=[{'all':!![]}];}return db[_0x056a('0x43')][_0x056a('0x59')](_0x58e06a);})[_0x056a('0x37')](function(_0x3d04f0){_0x4a473c['rows']=_0x3d04f0;return _0x4a473c;})['then'](respondWithFilteredResult(_0x3ee77d,_0x58e06a))[_0x056a('0x2a')](handleError(_0x3ee77d,null));};exports[_0x056a('0x5a')]=function(_0x1b92d6,_0x51de19){var _0x2da8ab={'raw':![],'where':{'id':_0x1b92d6[_0x056a('0x5b')]['id']},'include':[{'model':db[_0x056a('0x40')],'as':_0x056a('0x41')}]},_0x301686={};_0x301686[_0x056a('0x47')]=_[_0x056a('0x49')](db['SmsAccount'][_0x056a('0x44')]);_0x301686['query']=_[_0x056a('0x49')](_0x1b92d6[_0x056a('0x48')]);_0x301686[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x301686[_0x056a('0x47')],_0x301686[_0x056a('0x48')]);_0x2da8ab[_0x056a('0x4c')]=_[_0x056a('0x4b')](_0x301686['model'],qs['fields'](_0x1b92d6[_0x056a('0x48')]['fields']));_0x2da8ab['attributes']=_0x2da8ab[_0x056a('0x4c')][_0x056a('0x4e')]?_0x2da8ab[_0x056a('0x4c')]:_0x301686[_0x056a('0x47')];if(_0x1b92d6[_0x056a('0x48')][_0x056a('0x58')]){_0x2da8ab[_0x056a('0x5c')]=[{'all':!![]}];}_0x2da8ab=_[_0x056a('0x54')]({},_0x2da8ab,_0x1b92d6['options']);return db[_0x056a('0x43')][_0x056a('0x5d')](_0x2da8ab)[_0x056a('0x37')](handleEntityNotFound(_0x51de19,null))[_0x056a('0x37')](respondWithResult(_0x51de19,null))['catch'](handleError(_0x51de19,null));};exports[_0x056a('0x5e')]=function(_0x5d9893,_0x3d241e){return db['SmsAccount'][_0x056a('0x5e')](_0x5d9893['body'],{})[_0x056a('0x37')](function(_0x31db6f){var _0x4758ca=_0x5d9893[_0x056a('0x5f')][_0x056a('0x60')]({'plain':!![]});if(!_0x4758ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4758ca[_0x056a('0x61')]==='user'){var _0x1ac900=_0x31db6f[_0x056a('0x60')]({'plain':!![]});var _0x3d3f80=_0x056a('0x39');return db[_0x056a('0x62')][_0x056a('0x5d')]({'where':{'name':_0x3d3f80,'userProfileId':_0x4758ca[_0x056a('0x63')]},'raw':!![]})['then'](function(_0x3b6d7d){if(_0x3b6d7d&&_0x3b6d7d[_0x056a('0x64')]===0x0){return db[_0x056a('0x3a')][_0x056a('0x5e')]({'name':_0x1ac900[_0x056a('0x3d')],'resourceId':_0x1ac900['id'],'type':_0x3b6d7d[_0x056a('0x3d')],'sectionId':_0x3b6d7d['id']},{})[_0x056a('0x37')](function(){return _0x31db6f;});}else{return _0x31db6f;}})[_0x056a('0x2a')](function(_0x514fa7){logger['error'](_0x056a('0x65'),_0x514fa7);throw _0x514fa7;});}return _0x31db6f;})['then'](respondWithResult(_0x3d241e,0xc9))['catch'](handleError(_0x3d241e,null));};exports[_0x056a('0x36')]=function(_0x190ab4,_0x4bec03){if(_0x190ab4[_0x056a('0x66')]['id']){delete _0x190ab4[_0x056a('0x66')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x190ab4[_0x056a('0x5b')]['id']},'include':[{'model':db[_0x056a('0x40')],'as':_0x056a('0x41')}]})[_0x056a('0x37')](handleEntityNotFound(_0x4bec03,null))[_0x056a('0x37')](saveUpdates(_0x190ab4[_0x056a('0x66')],null))[_0x056a('0x37')](respondWithResult(_0x4bec03,null))[_0x056a('0x2a')](handleError(_0x4bec03,null));};exports['destroy']=function(_0x5c13c0,_0x2afbc0){return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x5c13c0['params']['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x2afbc0,null))[_0x056a('0x37')](removeEntity(_0x2afbc0,null))[_0x056a('0x2a')](handleError(_0x2afbc0,null));};exports[_0x056a('0x67')]=function(_0x516549,_0x54aa75){return db[_0x056a('0x43')][_0x056a('0x67')]()[_0x056a('0x37')](respondWithResult(_0x54aa75,null))[_0x056a('0x2a')](handleError(_0x54aa75,null));};exports[_0x056a('0x68')]=function(_0x4020bb,_0xb99374,_0x29b584){if(_0x4020bb[_0x056a('0x66')]['id']){delete _0x4020bb[_0x056a('0x66')]['id'];}return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x4020bb[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0xb99374,null))['then'](function(_0x1c1bd9){if(_0x1c1bd9){_0x4020bb[_0x056a('0x66')][_0x056a('0x69')]=_0x1c1bd9['id'];return db[_0x056a('0x6a')][_0x056a('0x5e')](_0x4020bb[_0x056a('0x66')]);}})[_0x056a('0x37')](respondWithResult(_0xb99374,null))[_0x056a('0x2a')](handleError(_0xb99374,null));};exports[_0x056a('0x6b')]=function(_0x5d4d2e,_0x12e0fb,_0x17ca3d){var _0x34ccef={'raw':![],'where':{}};var _0x3bc092={};var _0x451133={'count':0x0,'rows':[]};return db[_0x056a('0x43')]['findOne']({'where':{'id':_0x5d4d2e[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x12e0fb,null))['then'](function(_0x18e90c){if(_0x18e90c){_0x3bc092['model']=_[_0x056a('0x49')](db['Disposition'][_0x056a('0x44')]);_0x3bc092['query']=_[_0x056a('0x49')](_0x5d4d2e[_0x056a('0x48')]);_0x3bc092[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x3bc092[_0x056a('0x47')],_0x3bc092['query']);_0x34ccef['attributes']=_['intersection'](_0x3bc092[_0x056a('0x47')],qs['fields'](_0x5d4d2e[_0x056a('0x48')][_0x056a('0x4d')]));_0x34ccef['attributes']=_0x34ccef['attributes']['length']?_0x34ccef['attributes']:_0x3bc092[_0x056a('0x47')];if(!_0x5d4d2e[_0x056a('0x48')][_0x056a('0x4f')](_0x056a('0x50'))){_0x34ccef[_0x056a('0x30')]=qs['limit'](_0x5d4d2e[_0x056a('0x48')]['limit']);_0x34ccef[_0x056a('0x2e')]=qs['offset'](_0x5d4d2e[_0x056a('0x48')][_0x056a('0x2e')]);}_0x34ccef[_0x056a('0x51')]=qs[_0x056a('0x52')](_0x5d4d2e[_0x056a('0x48')][_0x056a('0x52')]);_0x34ccef['where']=qs[_0x056a('0x4a')](_[_0x056a('0x6c')](_0x5d4d2e[_0x056a('0x48')],_0x3bc092['filters']));_0x34ccef[_0x056a('0x53')]['SmsAccountId']=_0x18e90c['id'];if(_0x5d4d2e[_0x056a('0x48')][_0x056a('0x6d')]){_0x34ccef[_0x056a('0x53')]=_[_0x056a('0x54')](_0x34ccef[_0x056a('0x53')],{'$or':_[_0x056a('0x42')](_0x34ccef[_0x056a('0x4c')],function(_0xd65b81){var _0x4499a3={};_0x4499a3[_0xd65b81]={'$like':'%'+_0x5d4d2e['query'][_0x056a('0x6d')]+'%'};return _0x4499a3;})});}_0x34ccef=_[_0x056a('0x54')]({},_0x34ccef,_0x5d4d2e[_0x056a('0x57')]);return db['Disposition']['count']({'where':_0x34ccef[_0x056a('0x53')]})['then'](function(_0x5bb767){_0x451133[_0x056a('0x31')]=_0x5bb767;if(_0x5d4d2e[_0x056a('0x48')][_0x056a('0x58')]){_0x34ccef[_0x056a('0x5c')]=[{'all':!![]}];}return db[_0x056a('0x6a')]['findAll'](_0x34ccef);})[_0x056a('0x37')](function(_0x5b8fe2){_0x451133[_0x056a('0x6e')]=_0x5b8fe2;return _0x451133;});}})[_0x056a('0x37')](respondWithFilteredResult(_0x12e0fb,_0x34ccef))[_0x056a('0x2a')](handleError(_0x12e0fb,null));};exports[_0x056a('0x6f')]=function(_0x398884,_0x53e9b1,_0xed5e03){return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x398884['params']['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x53e9b1,null))['then'](function(_0x544174){if(_0x544174){return _0x544174['removeDispositions'](_0x398884[_0x056a('0x48')]['ids']);}})[_0x056a('0x37')](respondWithStatusCode(_0x53e9b1,null))[_0x056a('0x2a')](handleError(_0x53e9b1,null));};exports['addAnswer']=function(_0x168019,_0x2f7053,_0x4e8d8a){if(_0x168019[_0x056a('0x66')]['id']){delete _0x168019[_0x056a('0x66')]['id'];}return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x168019[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x2f7053,null))[_0x056a('0x37')](function(_0x1b6070){if(_0x1b6070){_0x168019[_0x056a('0x66')][_0x056a('0x69')]=_0x1b6070['id'];return db[_0x056a('0x70')][_0x056a('0x5e')](_0x168019[_0x056a('0x66')]);}})[_0x056a('0x37')](respondWithResult(_0x2f7053,null))[_0x056a('0x2a')](handleError(_0x2f7053,null));};exports[_0x056a('0x71')]=function(_0x2b1ec2,_0x3fe0e5,_0xefa327){var _0x4b80b1={'raw':![],'where':{}};var _0x3a3bea={};var _0x209ffe={'count':0x0,'rows':[]};return db[_0x056a('0x43')][_0x056a('0x72')]({'where':{'id':_0x2b1ec2[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x3fe0e5,null))[_0x056a('0x37')](function(_0x168084){if(_0x168084){_0x3a3bea[_0x056a('0x47')]=_['keys'](db['CannedAnswer'][_0x056a('0x44')]);_0x3a3bea[_0x056a('0x48')]=_[_0x056a('0x49')](_0x2b1ec2[_0x056a('0x48')]);_0x3a3bea[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x3a3bea[_0x056a('0x47')],_0x3a3bea['query']);_0x4b80b1[_0x056a('0x4c')]=_[_0x056a('0x4b')](_0x3a3bea[_0x056a('0x47')],qs[_0x056a('0x4d')](_0x2b1ec2[_0x056a('0x48')]['fields']));_0x4b80b1[_0x056a('0x4c')]=_0x4b80b1[_0x056a('0x4c')]['length']?_0x4b80b1['attributes']:_0x3a3bea['model'];if(!_0x2b1ec2[_0x056a('0x48')][_0x056a('0x4f')](_0x056a('0x50'))){_0x4b80b1[_0x056a('0x30')]=qs[_0x056a('0x30')](_0x2b1ec2['query'][_0x056a('0x30')]);_0x4b80b1['offset']=qs[_0x056a('0x2e')](_0x2b1ec2[_0x056a('0x48')][_0x056a('0x2e')]);}_0x4b80b1['order']=qs[_0x056a('0x52')](_0x2b1ec2['query']['sort']);_0x4b80b1[_0x056a('0x53')]=qs[_0x056a('0x4a')](_[_0x056a('0x6c')](_0x2b1ec2[_0x056a('0x48')],_0x3a3bea[_0x056a('0x4a')]));_0x4b80b1[_0x056a('0x53')][_0x056a('0x69')]=_0x168084['id'];if(_0x2b1ec2[_0x056a('0x48')][_0x056a('0x6d')]){_0x4b80b1['where']=_[_0x056a('0x54')](_0x4b80b1['where'],{'$or':_[_0x056a('0x42')](_0x4b80b1[_0x056a('0x4c')],function(_0x4ec61d){var _0x709e2b={};_0x709e2b[_0x4ec61d]={'$like':'%'+_0x2b1ec2['query']['filter']+'%'};return _0x709e2b;})});}_0x4b80b1=_[_0x056a('0x54')]({},_0x4b80b1,_0x2b1ec2[_0x056a('0x57')]);return db[_0x056a('0x70')][_0x056a('0x31')]({'where':_0x4b80b1[_0x056a('0x53')]})['then'](function(_0x5c053f){_0x209ffe['count']=_0x5c053f;if(_0x2b1ec2[_0x056a('0x48')][_0x056a('0x58')]){_0x4b80b1['include']=[{'all':!![]}];}return db[_0x056a('0x70')][_0x056a('0x59')](_0x4b80b1);})[_0x056a('0x37')](function(_0x40432a){_0x209ffe[_0x056a('0x6e')]=_0x40432a;return _0x209ffe;});}})[_0x056a('0x37')](respondWithFilteredResult(_0x3fe0e5,_0x4b80b1))[_0x056a('0x2a')](handleError(_0x3fe0e5,null));};exports[_0x056a('0x73')]=function(_0x4642f4,_0x208587,_0x3524fb){return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x4642f4[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x208587,null))[_0x056a('0x37')](function(_0x5bcc03){if(_0x5bcc03){return _0x5bcc03[_0x056a('0x73')](_0x4642f4[_0x056a('0x48')][_0x056a('0x74')]);}})['then'](respondWithStatusCode(_0x208587,null))[_0x056a('0x2a')](handleError(_0x208587,null));};exports[_0x056a('0x75')]=function(_0x1ca6c7,_0x55f102,_0x5f3bf0){var _0x34dd39={'channel':_0x056a('0x76')};var _0x120354=[];var _0x5f4925=[];var _0x44e579={};return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x1ca6c7[_0x056a('0x5b')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x056a('0x77')}]})[_0x056a('0x37')](handleEntityNotFound(_0x55f102,null))[_0x056a('0x37')](function(_0x3a7e98){_0x34dd39[_0x056a('0x78')]=_0x3a7e98;_0x34dd39[_0x056a('0x79')]=_[_0x056a('0x7a')](_0x3a7e98['Applications'],['priority'],[_0x056a('0x7b')]);if(_0x34dd39[_0x056a('0x78')][_0x056a('0x77')]){delete _0x34dd39[_0x056a('0x78')]['Applications'];}return db[_0x056a('0x7c')][_0x056a('0x67')]();})[_0x056a('0x37')](function(_0x70d226){if(!_0x70d226){throw new db['Sequelize'][(_0x056a('0x7d'))](_0x056a('0x7e'));}_0x120354=_[_0x056a('0x7f')](_[_0x056a('0x49')](_0x70d226),[_0x056a('0x80'),_0x056a('0x81')]);_0x5f4925=_['difference'](_[_0x056a('0x49')](_0x70d226),[_0x056a('0x80'),_0x056a('0x81'),_0x056a('0x82'),_0x056a('0x83')]);_0x34dd39[_0x056a('0x66')]={'mapKey':_0x056a('0x84')};if(_0x34dd39[_0x056a('0x78')][_0x056a('0x55')]){switch(_0x34dd39[_0x056a('0x78')]['type']){case _0x056a('0x85'):_0x34dd39[_0x056a('0x66')][_0x056a('0x86')]=_0x1ca6c7['body']['From'];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x87')];_0x34dd39[_0x056a('0x66')][_0x056a('0x88')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x89')];break;case _0x056a('0x8a'):_0x34dd39[_0x056a('0x66')]['from']='+'+_0x1ca6c7[_0x056a('0x66')][_0x056a('0x8b')];_0x34dd39[_0x056a('0x66')][_0x056a('0x66')]=_0x1ca6c7['body']['text'];break;case _0x056a('0x8c'):_0x34dd39['body'][_0x056a('0x86')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x86')];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x27')];break;case _0x056a('0x8d'):_0x34dd39[_0x056a('0x66')][_0x056a('0x86')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x86')];_0x34dd39[_0x056a('0x66')][_0x056a('0x66')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x66')];_0x34dd39[_0x056a('0x66')]['messageId']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x8e')];break;case'plivo':_0x34dd39['body'][_0x056a('0x86')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x8f')];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x90')];_0x34dd39[_0x056a('0x66')][_0x056a('0x88')]=_0x1ca6c7['body'][_0x056a('0x91')];break;case _0x056a('0x92'):_0x34dd39[_0x056a('0x66')][_0x056a('0x86')]='+'+_0x1ca6c7[_0x056a('0x66')][_0x056a('0x93')][0x0][_0x056a('0x86')];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x93')][0x0][_0x056a('0x94')];_0x34dd39[_0x056a('0x66')][_0x056a('0x88')]=_0x1ca6c7['body'][_0x056a('0x93')][0x0][_0x056a('0x88')];break;case _0x056a('0x95'):_0x34dd39[_0x056a('0x66')][_0x056a('0x86')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x96')];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7['body']['segmentedMessage']['message'];break;case _0x056a('0x97'):_0x34dd39[_0x056a('0x66')]['from']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x98')];_0x34dd39[_0x056a('0x66')][_0x056a('0x66')]=_0x1ca6c7[_0x056a('0x66')]['text'];_0x34dd39['body'][_0x056a('0x88')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x99')];break;case _0x056a('0x9a'):_0x34dd39[_0x056a('0x66')][_0x056a('0x88')]=_0x1ca6c7[_0x056a('0x66')][0x0][_0x056a('0x27')]['id'];_0x34dd39[_0x056a('0x66')]['from']=_0x1ca6c7[_0x056a('0x66')][0x0][_0x056a('0x27')][_0x056a('0x86')];_0x34dd39['body'][_0x056a('0x66')]=_0x1ca6c7[_0x056a('0x66')][0x0][_0x056a('0x27')]['text'];break;case _0x056a('0x9b'):_0x34dd39[_0x056a('0x66')][_0x056a('0x86')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x86')];_0x34dd39[_0x056a('0x66')]['body']=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x27')];_0x34dd39[_0x056a('0x66')][_0x056a('0x88')]=_0x1ca6c7[_0x056a('0x66')][_0x056a('0x9c')];break;}}if(_0x34dd39[_0x056a('0x66')]['id']){delete _0x34dd39[_0x056a('0x66')]['id'];}if(_[_0x056a('0x9d')](_0x34dd39[_0x056a('0x66')][_0x056a('0x86')])){throw new db['Sequelize'][(_0x056a('0x7d'))](_0x056a('0x9e'));}if(_[_0x056a('0x9d')](_0x34dd39[_0x056a('0x66')][_0x056a('0x66')])||_0x34dd39[_0x056a('0x66')][_0x056a('0x66')]===''){throw new db['Sequelize'][(_0x056a('0x7d'))](_0x056a('0x9f'));}if(_[_0x056a('0x9d')](_0x34dd39['body']['mapKey'])){throw new db['Sequelize'][(_0x056a('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5f4925);}if(!_['includes'](_0x5f4925,_0x34dd39[_0x056a('0x66')][_0x056a('0xa0')])){throw new db[(_0x056a('0xa1'))]['ValidationError'](_0x056a('0xa2')+_0x5f4925);}_0x44e579[_0x34dd39[_0x056a('0x66')][_0x056a('0xa0')]]=_0x34dd39[_0x056a('0x66')]['from'];return db['CmList'][_0x056a('0x5d')]({'where':{'id':_0x34dd39[_0x056a('0x78')][_0x056a('0x83')]},'include':[{'model':db[_0x056a('0x7c')],'as':_0x056a('0xa3'),'where':_0x44e579,'limit':0x1,'order':[[_0x056a('0x81'),'DESC']]}]});})['then'](handleEntityNotFound(_0x55f102,null))['then'](function(_0x56c578){if(_0x56c578){_0x34dd39['list']=_[_0x056a('0xa4')](_0x56c578,[_0x056a('0xa3')]);if(_0x56c578[_0x056a('0xa3')][_0x056a('0x4e')]){return _0x56c578[_0x056a('0xa3')][0x0];}var _0x3f1e71=_[_0x056a('0x19')](_0x34dd39[_0x056a('0x66')],{'firstName':_0x34dd39[_0x056a('0x66')][_0x056a('0x86')],'ListId':_0x56c578['id']});_0x3f1e71[_0x34dd39[_0x056a('0x66')][_0x056a('0xa0')]]=_0x34dd39[_0x056a('0x66')][_0x056a('0x86')];return db[_0x056a('0x7c')][_0x056a('0x5e')](_0x3f1e71,{'fields':_0x120354,'raw':!![]});}})[_0x056a('0x37')](handleEntityNotFound(_0x55f102,null))[_0x056a('0x37')](function(_0x353b19){if(_0x353b19){_0x34dd39[_0x056a('0xa5')]=_0x353b19;var _0x2b76bc={'ContactId':_0x353b19['id'],'phone':_0x34dd39[_0x056a('0x66')][_0x056a('0x86')],'SmsAccountId':_0x1ca6c7[_0x056a('0x5b')]['id']};var _0x3da53e={'ContactId':_0x353b19['id'],'SmsAccountId':_0x1ca6c7['params']['id'],'closed':![]};return db[_0x056a('0xa6')]['find']({'where':_0x3da53e})['then'](function(_0xcf9e3f){if(_0xcf9e3f){return[_0xcf9e3f,![]];}return db['SmsInteraction'][_0x056a('0x5e')](_0x2b76bc)[_0x056a('0x37')](function(_0x21e52b){return[_0x21e52b,!![]];});});}})[_0x056a('0xa7')](function(_0x32d36f,_0x3a0403){_0x34dd39[_0x056a('0xa8')]=_0x32d36f[_0x056a('0x60')]({'plain':!![]});_0x34dd39[_0x056a('0xa8')][_0x056a('0xa9')]=![];if(_0x3a0403){if(_0x34dd39[_0x056a('0x78')]['autoclose']){_0x34dd39[_0x056a('0x79')][_0x056a('0xaa')]({'id':0x0,'priority':_0x34dd39[_0x056a('0x79')]['length']+0x1,'app':_0x056a('0xab'),'appdata':_0x056a('0xac'),'interval':'*,*,*,*'});}_0x34dd39[_0x056a('0xa8')]['created']=!![];}return db[_0x056a('0xad')]['create']({'phone':_0x34dd39[_0x056a('0x66')]['from'],'messageId':_0x34dd39[_0x056a('0x66')]['messageId'],'body':_0x34dd39[_0x056a('0x66')][_0x056a('0x66')],'SmsAccountId':_0x1ca6c7[_0x056a('0x5b')]['id'],'SmsInteractionId':_0x32d36f['id'],'direction':'in','ContactId':_0x32d36f[_0x056a('0xae')],'AttachmentId':_0x34dd39[_0x056a('0x66')][_0x056a('0xaf')]});})[_0x056a('0x37')](function(_0x1dc7e8){_0x34dd39[_0x056a('0x27')]=_0x1dc7e8;if(_0x34dd39[_0x056a('0xa8')][_0x056a('0xb0')]){return db[_0x056a('0xb1')]['find']({'attributes':['id','name'],'where':{'id':_0x34dd39[_0x056a('0xa8')][_0x056a('0xb0')]}})[_0x056a('0x37')](function(_0x5869a7){if(_0x5869a7){_0x34dd39[_0x056a('0x79')][_0x056a('0xb2')]({'id':0x0,'priority':0x0,'app':_0x056a('0xb3'),'appdata':_0x5869a7[_0x056a('0x3d')]+','+(_0x34dd39[_0x056a('0x78')][_0x056a('0xb4')]||0xa),'interval':_0x056a('0xb5')});}return respondWithRpcPromise(_0x056a('0xb6'),'startRouting',_0x34dd39);});}return respondWithRpcPromise(_0x056a('0xb6'),_0x056a('0xb7'),_0x34dd39);})[_0x056a('0x37')](function(_0x3a4235){if(_0x3a4235){var _0x428b49=0xc8;var _0x57e4ba=_0x056a('0xb8');logger[_0x056a('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57e4ba,_0x428b49,_0x056a('0xb9'));logger[_0x056a('0x23')](_0x056a('0xba'),_0x57e4ba,_0x428b49,_0x056a('0xb9'),JSON[_0x056a('0x24')](_0x3a4235));if(_0x34dd39[_0x056a('0x78')][_0x056a('0x55')]===_0x056a('0x85')){return _0x55f102[_0x056a('0x2c')](_0x428b49)[_0x056a('0x32')](_0x056a('0xbb'),_0x056a('0xbc'))['send'](_0x056a('0xbd'));}else{return _0x55f102[_0x056a('0x2c')](_0x428b49)[_0x056a('0x2d')](_0x3a4235);}}})[_0x056a('0x2a')](handleError(_0x55f102,null));};exports[_0x056a('0xbe')]=function(_0x15b1d2,_0x564335){var _0x40381f=_0x15b1d2[_0x056a('0x5b')]['id'];var _0x19b17b=_0x15b1d2[_0x056a('0x66')];var _0x44c27b=0xc8;var _0x185a41=null;return db[_0x056a('0xbf')]['transaction']({'isolationLevel':db[_0x056a('0xbf')][_0x056a('0xc0')][_0x056a('0xc1')][_0x056a('0xc2')]},function(_0x44304a){return db[_0x056a('0x43')][_0x056a('0x72')]({'where':{'id':_0x40381f},'transaction':_0x44304a})['then'](function(_0x3fa0df){if(_0x3fa0df){return db[_0x056a('0xc3')][_0x056a('0x38')]({'where':{'SmsAccountId':_0x40381f},'transaction':_0x44304a})[_0x056a('0x37')](function(){var _0x247ef1=_[_0x056a('0x42')](_0x19b17b,function(_0xe298f9){_0xe298f9['SmsAccountId']=_0x40381f;return _0xe298f9;});return db[_0x056a('0xc3')][_0x056a('0xc4')](_0x247ef1,{'transaction':_0x44304a});});}else{_0x44c27b=0x194;_0x185a41=[];}});})[_0x056a('0x37')](function(){if(_0x44c27b!==0x194){return db[_0x056a('0xc3')][_0x056a('0xc5')]({'where':{'SmsAccountId':_0x40381f},'order':'priority'})[_0x056a('0x37')](function(_0x188011){_0x185a41=_0x188011;});}})[_0x056a('0x2a')](function(_0x20c7d6){_0x44c27b=0x1f4;logger[_0x056a('0x25')](_0x20c7d6[_0x056a('0x3c')]);if(_0x20c7d6[_0x056a('0x3d')]){delete _0x20c7d6[_0x056a('0x3d')];}_0x185a41=_0x20c7d6;})[_0x056a('0xc6')](function(){if(_0x185a41===null){_0x564335[_0x056a('0x3b')](_0x44c27b);}else{if(_0x44c27b===0x1f4){_0x564335[_0x056a('0x2c')](_0x44c27b)[_0x056a('0x3e')](_0x185a41);}else{_0x564335[_0x056a('0x2c')](_0x44c27b)[_0x056a('0x2d')](_0x185a41);}}});};exports[_0x056a('0xc7')]=function(_0x5f2d57,_0x4e488b,_0x45c8ea){var _0x198d8d={};var _0x3315a9={};var _0x291dad;var _0x1c7463;return db['SmsAccount'][_0x056a('0x72')]({'where':{'id':_0x5f2d57[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x4e488b,null))[_0x056a('0x37')](function(_0x56a4ef){if(_0x56a4ef){_0x291dad=_0x56a4ef;_0x3315a9['model']=_[_0x056a('0x49')](db[_0x056a('0xc3')][_0x056a('0x44')]);_0x3315a9[_0x056a('0x48')]=_[_0x056a('0x49')](_0x5f2d57[_0x056a('0x48')]);_0x3315a9[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x3315a9['model'],_0x3315a9[_0x056a('0x48')]);_0x198d8d[_0x056a('0x4c')]=_[_0x056a('0x4b')](_0x3315a9['model'],qs['fields'](_0x5f2d57['query'][_0x056a('0x4d')]));_0x198d8d['attributes']=_0x198d8d['attributes'][_0x056a('0x4e')]?_0x198d8d[_0x056a('0x4c')]:_0x3315a9[_0x056a('0x47')];_0x198d8d[_0x056a('0x51')]=qs[_0x056a('0x52')](_0x5f2d57['query'][_0x056a('0x52')]);_0x198d8d['where']=qs[_0x056a('0x4a')](_[_0x056a('0x6c')](_0x5f2d57[_0x056a('0x48')],_0x3315a9[_0x056a('0x4a')]));if(_0x5f2d57[_0x056a('0x48')][_0x056a('0x6d')]){_0x198d8d[_0x056a('0x53')]=_['merge'](_0x198d8d['where'],{'$or':_['map'](_0x198d8d['attributes'],function(_0x3c5652){var _0x383fa8={};_0x383fa8[_0x3c5652]={'$like':'%'+_0x5f2d57[_0x056a('0x48')]['filter']+'%'};return _0x383fa8;})});}_0x198d8d=_['merge']({},_0x198d8d,_0x5f2d57[_0x056a('0x57')]);return _0x291dad[_0x056a('0xc7')](_0x198d8d);}})[_0x056a('0x37')](function(_0x5396c3){if(_0x5396c3){_0x1c7463=_0x5396c3[_0x056a('0x4e')];if(!_0x5f2d57['query'][_0x056a('0x4f')](_0x056a('0x50'))){_0x198d8d[_0x056a('0x30')]=qs['limit'](_0x5f2d57[_0x056a('0x48')]['limit']);_0x198d8d[_0x056a('0x2e')]=qs[_0x056a('0x2e')](_0x5f2d57[_0x056a('0x48')]['offset']);}return _0x291dad[_0x056a('0xc7')](_0x198d8d);}})[_0x056a('0x37')](function(_0x287cda){if(_0x287cda){return _0x287cda?{'count':_0x1c7463,'rows':_0x287cda}:null;}})[_0x056a('0x37')](respondWithResult(_0x4e488b,null))['catch'](handleError(_0x4e488b,null));};exports[_0x056a('0xc8')]=function(_0x1cd902,_0xebb9b0,_0x3ead8c){var _0x5e39a9={'raw':![],'where':{}};var _0x339f81={};var _0x551086={'count':0x0,'rows':[]};return db[_0x056a('0x43')][_0x056a('0x72')]({'where':{'id':_0x1cd902[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0xebb9b0,null))[_0x056a('0x37')](function(_0x5c0505){if(_0x5c0505){_0x339f81['model']=_[_0x056a('0x49')](db[_0x056a('0xa6')][_0x056a('0x44')]);_0x339f81[_0x056a('0x48')]=_['keys'](_0x1cd902[_0x056a('0x48')]);_0x339f81[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x339f81[_0x056a('0x47')],_0x339f81[_0x056a('0x48')]);_0x5e39a9['attributes']=_[_0x056a('0x4b')](_0x339f81[_0x056a('0x47')],qs[_0x056a('0x4d')](_0x1cd902[_0x056a('0x48')]['fields']));_0x5e39a9[_0x056a('0x4c')]=_0x5e39a9['attributes'][_0x056a('0x4e')]?_0x5e39a9['attributes']:_0x339f81[_0x056a('0x47')];if(!_0x1cd902[_0x056a('0x48')][_0x056a('0x4f')](_0x056a('0x50'))){_0x5e39a9[_0x056a('0x30')]=qs[_0x056a('0x30')](_0x1cd902[_0x056a('0x48')][_0x056a('0x30')]);_0x5e39a9[_0x056a('0x2e')]=qs[_0x056a('0x2e')](_0x1cd902[_0x056a('0x48')]['offset']);}_0x5e39a9[_0x056a('0x51')]=qs[_0x056a('0x52')](_0x1cd902[_0x056a('0x48')][_0x056a('0x52')]);_0x5e39a9[_0x056a('0x53')]=qs['filters'](_[_0x056a('0x6c')](_0x1cd902[_0x056a('0x48')],_0x339f81[_0x056a('0x4a')]));_0x5e39a9[_0x056a('0x53')][_0x056a('0x69')]=_0x5c0505['id'];if(_0x1cd902[_0x056a('0x48')][_0x056a('0x6d')]){_0x5e39a9[_0x056a('0x53')]=_[_0x056a('0x54')](_0x5e39a9['where'],{'$or':_[_0x056a('0x42')](_0x5e39a9[_0x056a('0x4c')],function(_0xb56966){var _0x5be0e9={};_0x5be0e9[_0xb56966]={'$like':'%'+_0x1cd902['query'][_0x056a('0x6d')]+'%'};return _0x5be0e9;})});}_0x5e39a9=_[_0x056a('0x54')]({},_0x5e39a9,_0x1cd902[_0x056a('0x57')]);return db[_0x056a('0xa6')][_0x056a('0x31')]({'where':_0x5e39a9['where']})[_0x056a('0x37')](function(_0x3f779a){_0x551086[_0x056a('0x31')]=_0x3f779a;if(_0x1cd902[_0x056a('0x48')]['includeAll']){_0x5e39a9[_0x056a('0x5c')]=[{'model':db[_0x056a('0x7c')],'as':'Contact','required':![]},{'model':db[_0x056a('0xb1')],'as':_0x056a('0xc9'),'attributes':[_0x056a('0x3d'),_0x056a('0xca'),_0x056a('0xcb')],'required':![]},{'model':db['Tag'],'as':_0x056a('0xcc'),'attributes':['id','name','color'],'where':_0x1cd902[_0x056a('0x48')][_0x056a('0xcd')]?{'id':_0x1cd902['query'][_0x056a('0xcd')]}:undefined,'required':_0x1cd902[_0x056a('0x48')][_0x056a('0xcd')]?!![]:![]}];}return db[_0x056a('0xa6')][_0x056a('0x59')](_0x5e39a9);})[_0x056a('0x37')](function(_0x457ed4){_0x551086['rows']=_0x457ed4;return _0x551086;});}})[_0x056a('0x37')](respondWithFilteredResult(_0xebb9b0,_0x5e39a9))[_0x056a('0x2a')](handleError(_0xebb9b0,null));};exports[_0x056a('0x3e')]=function(_0x3c38d1,_0x27c91c,_0x4ad890){var _0x1dc435,_0x22f4f3,_0x1bc5d6;if(_[_0x056a('0x9d')](_0x3c38d1[_0x056a('0x66')]['body'])||_0x3c38d1['body']['body']===''){throw new db[(_0x056a('0xa1'))][(_0x056a('0x7d'))](_0x056a('0x9f'));}if(_[_0x056a('0x9d')](_0x3c38d1[_0x056a('0x66')]['to'])){throw new db[(_0x056a('0xa1'))]['ValidationError'](_0x056a('0xce'));}_0x1dc435=_0x3c38d1[_0x056a('0x66')]['to'];return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x3c38d1[_0x056a('0x5b')]['id']},'include':[{'model':db[_0x056a('0xcf')],'as':_0x056a('0xd0'),'include':[{'model':db['CmContact'],'as':_0x056a('0xa3'),'where':{'mobile':_0x1dc435},'limit':0x1,'order':[[_0x056a('0x81'),_0x056a('0xd1')]]}]}]})[_0x056a('0x37')](handleEntityNotFound(_0x27c91c,null))[_0x056a('0x37')](function(_0x30a873){if(_0x30a873&&_0x30a873[_0x056a('0xd0')]){_0x22f4f3=_0x30a873['get']({'plain':!![]});if(_0x22f4f3['List']&&_0x22f4f3[_0x056a('0xd0')][_0x056a('0xa3')][_0x056a('0x4e')]){return _0x22f4f3['List'][_0x056a('0xa3')][0x0];}return db['CmContact']['create'](_['defaults'](_0x3c38d1[_0x056a('0x66')],{'firstName':_0x1dc435,'mobile':_0x1dc435,'phone':_0x1dc435,'ListId':_0x22f4f3[_0x056a('0x83')]}));}})[_0x056a('0x37')](handleEntityNotFound(_0x27c91c,null))['then'](function(_0x333f91){if(_0x333f91){_0x1bc5d6=_0x333f91;return db[_0x056a('0xa6')][_0x056a('0x5d')]({'where':{'ContactId':_0x1bc5d6['id'],'closed':![],'SmsAccountId':_0x22f4f3['id']}})['then'](function(_0x14df6d){if(_0x14df6d){return[_0x14df6d,![]];}return db[_0x056a('0xa6')]['create']({'UserId':_0x3c38d1[_0x056a('0x5f')]['id'],'ContactId':_0x1bc5d6['id'],'SmsAccountId':_0x22f4f3['id'],'phone':_0x1dc435,'firstMsgDirection':_0x056a('0xd2'),'Messages':[_[_0x056a('0x54')](_0x3c38d1[_0x056a('0x66')],{'read':![],'body':_0x3c38d1['body'][_0x056a('0x66')],'phone':_0x1dc435,'SmsAccountId':_0x22f4f3['id'],'UserId':_0x3c38d1[_0x056a('0x5f')]['id'],'ContactId':_0x1bc5d6['id']})]},{'include':[{'model':db[_0x056a('0xad')],'as':_0x056a('0xd3')}]})[_0x056a('0x37')](function(_0x4ce098){return[_0x4ce098,!![]];});});}})[_0x056a('0xa7')](function(_0x5e0ebb,_0x24dfce){if(_0x24dfce){return _0x5e0ebb;}return db[_0x056a('0xad')][_0x056a('0x5e')](_['merge'](_0x3c38d1[_0x056a('0x66')],{'read':![],'body':_0x3c38d1[_0x056a('0x66')][_0x056a('0x66')],'phone':_0x1dc435,'SmsAccountId':_0x22f4f3['id'],'SmsInteractionId':_0x5e0ebb['id'],'UserId':_0x3c38d1[_0x056a('0x5f')]['id'],'ContactId':_0x1bc5d6['id']}))[_0x056a('0x37')](function(_0x24ac39){_0x5e0ebb['dataValues'][_0x056a('0xd3')]=[];_0x5e0ebb[_0x056a('0xd4')]['Messages'][_0x056a('0xaa')](_0x24ac39[_0x056a('0xd4')]);return _0x5e0ebb;});})[_0x056a('0x37')](respondWithResult(_0x27c91c,null))['catch'](handleError(_0x27c91c,null));};exports[_0x056a('0x2c')]=function(_0x50f1e5,_0x32d680,_0x3bfde8){if(_0x50f1e5[_0x056a('0x66')]['id']){delete _0x50f1e5[_0x056a('0x66')]['id'];}var _0x2023ef,_0x4e7204,_0x306b08;return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x50f1e5[_0x056a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32d680,null))[_0x056a('0x37')](function(_0x1f68d4){if(_0x1f68d4){_0x306b08=_0x1f68d4;logger[_0x056a('0x23')](_0x056a('0xd5'),_0x056a('0x2c'),_0x056a('0xd6'),_0x1f68d4['type'],util['inspect'](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));switch(_0x1f68d4[_0x056a('0x55')]){case _0x056a('0x8a'):if(_0x50f1e5[_0x056a('0x66')][_0x056a('0xd7')]&&_0x50f1e5['body'][_0x056a('0x2c')]){_0x4e7204=_0x50f1e5[_0x056a('0x66')]['status'];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][_0x056a('0xd7')]}});}break;case'connectel':if(_0x50f1e5[_0x056a('0x66')]['requestid']&&_0x50f1e5[_0x056a('0x66')][_0x056a('0xd8')]){_0x4e7204=_0x50f1e5['body'][_0x056a('0xd8')];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][_0x056a('0xd9')]}});}break;case'clicksend':if(_0x50f1e5[_0x056a('0x66')][_0x056a('0x8e')]&&_0x50f1e5['body'][_0x056a('0xda')]){_0x4e7204=_0x50f1e5['body'][_0x056a('0xda')];return db['SmsMessage']['find']({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][_0x056a('0x8e')]}});}break;case _0x056a('0x92'):var _0x31f66e=_0x50f1e5[_0x056a('0x66')]['results'][0x0];if(_0x31f66e['messageId']&&_0x31f66e[_0x056a('0x2c')]['groupName']===_0x056a('0xdb')){_0x4e7204=_0x31f66e['status'][_0x056a('0xdc')];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x31f66e[_0x056a('0x88')]}});}break;case _0x056a('0x97'):if(_0x50f1e5['body'][_0x056a('0x88')]&&_0x50f1e5[_0x056a('0x66')][_0x056a('0x2c')]){_0x4e7204=_0x50f1e5[_0x056a('0x66')][_0x056a('0x2c')];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][_0x056a('0x88')]}});}break;case _0x056a('0x9a'):if(_0x50f1e5[_0x056a('0x66')][0x0]['message']['id']){_0x4e7204=_0x50f1e5['body'][0x0][_0x056a('0x55')];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][0x0][_0x056a('0x27')]['id']}});}break;case _0x056a('0x9b'):if(_0x50f1e5[_0x056a('0x66')][_0x056a('0xdd')]&&_0x50f1e5[_0x056a('0x66')][_0x056a('0x2c')]){_0x4e7204=_0x50f1e5[_0x056a('0x66')][_0x056a('0x2c')];return db[_0x056a('0xad')]['find']({'where':{'messageId':_0x50f1e5[_0x056a('0x66')][_0x056a('0xdd')]}});}break;}}})[_0x056a('0x37')](handleEntityNotFound(_0x32d680,null))[_0x056a('0x37')](function(_0x631000){if(_0x631000){_0x2023ef=_0x631000;switch(_0x306b08[_0x056a('0x55')]){case _0x056a('0x8a'):if(_0x4e7204==='DELIVERED'){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),_0x056a('0x8a'),util[_0x056a('0xde')](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));}break;case _0x056a('0x8c'):if(_0x4e7204==='1'){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger[_0x056a('0x25')](_0x056a('0xd5'),_0x056a('0x2c'),'skebby',util['inspect'](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));}break;case _0x056a('0x8d'):if(!_0x50f1e5[_0x056a('0x66')][_0x056a('0xdf')]&&_0x4e7204>=0xc8&&_0x4e7204<=0xce){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger[_0x056a('0x25')](_0x056a('0xd5'),'status',_0x056a('0x8d'),util[_0x056a('0xde')](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5361a6=_0x50f1e5[_0x056a('0x66')]['results'][0x0];if(_0x5361a6['status'][_0x056a('0xdc')]==='DELIVERED'){return _0x2023ef['update']({'read':!![]});}else{logger[_0x056a('0x25')](_0x056a('0xd5'),'status',_0x056a('0x92'),util[_0x056a('0xde')](_0x50f1e5['body'],{'showHidden':![],'depth':null}));}break;case _0x056a('0x97'):if(_0x4e7204=='DELIVERED_TO_GATEWAY'||_0x4e7204==_0x056a('0xe0')){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger[_0x056a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),_0x056a('0x97'),util[_0x056a('0xde')](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x4e7204==_0x056a('0xe1')){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger[_0x056a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),_0x056a('0x9a'),util[_0x056a('0xde')](_0x50f1e5['body'],{'showHidden':![],'depth':null}));}break;case _0x056a('0x9b'):if(_0x4e7204===_0x056a('0xe2')||_0x4e7204===_0x056a('0xe3')){return _0x2023ef[_0x056a('0x36')]({'read':!![]});}else{logger[_0x056a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),_0x056a('0x9b'),util[_0x056a('0xde')](_0x50f1e5[_0x056a('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x2023ef;}})['then'](respondWithResult(_0x32d680,null))['catch'](handleError(_0x32d680,null));};exports['statusGet']=function(_0x6a14d1,_0x5dbf21,_0x202b91){var _0x3e7b9a,_0x4217a9,_0x477495;return db[_0x056a('0x43')]['find']({'where':{'id':_0x6a14d1[_0x056a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5dbf21,null))[_0x056a('0x37')](function(_0x577e48){if(_0x577e48){_0x477495=_0x577e48;logger[_0x056a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),_0x056a('0xd6'),_0x577e48[_0x056a('0x55')],util[_0x056a('0xde')](_0x6a14d1[_0x056a('0x48')],{'showHidden':![],'depth':null}));switch(_0x577e48[_0x056a('0x55')]){case _0x056a('0x95'):if(_0x6a14d1[_0x056a('0x48')][_0x056a('0xe4')]&&_0x6a14d1[_0x056a('0x48')][_0x056a('0xe5')]){_0x4217a9=_0x6a14d1[_0x056a('0x48')][_0x056a('0xe5')];return db[_0x056a('0xad')][_0x056a('0x5d')]({'where':{'messageId':_0x6a14d1[_0x056a('0x48')][_0x056a('0xe4')]}});}break;}}})[_0x056a('0x37')](handleEntityNotFound(_0x5dbf21,null))[_0x056a('0x37')](function(_0x266b19){if(_0x266b19){_0x3e7b9a=_0x266b19;switch(_0x477495[_0x056a('0x55')]){case _0x056a('0x95'):if(_0x4217a9==='2'||_0x4217a9==='6'){return _0x3e7b9a['update']({'read':!![]});}else{logger[_0x056a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x056a('0x2c'),'csc',util[_0x056a('0xde')](_0x6a14d1[_0x056a('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x3e7b9a;}})[_0x056a('0x37')](respondWithResult(_0x5dbf21,null))[_0x056a('0x2a')](handleError(_0x5dbf21,null));};exports[_0x056a('0xe6')]=function(_0x6c9db6,_0x103e17,_0x38044c){return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x6c9db6['params']['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x103e17,null))[_0x056a('0x37')](function(_0x309baf){if(_0x309baf){return _0x309baf[_0x056a('0xe6')](_0x6c9db6['body'][_0x056a('0x74')],_[_0x056a('0xa4')](_0x6c9db6[_0x056a('0x66')],[_0x056a('0x74'),'id'])||{})[_0x056a('0xa7')](function(_0x3a8c1c){for(var _0x30a79a=0x0;_0x30a79a<_0x6c9db6[_0x056a('0x66')]['ids'][_0x056a('0x4e')];_0x30a79a+=0x1){socket['emit'](_0x056a('0xe7'),{'UserId':Number(_0x6c9db6[_0x056a('0x66')][_0x056a('0x74')][_0x30a79a]),'SmsAccountId':Number(_0x6c9db6[_0x056a('0x5b')]['id'])});}return _0x3a8c1c;});}})[_0x056a('0x37')](respondWithResult(_0x103e17,null))['catch'](handleError(_0x103e17,null));};exports[_0x056a('0xe8')]=function(_0x2f67bc,_0x46c2cb,_0xe67f70){return db[_0x056a('0x43')][_0x056a('0x5d')]({'where':{'id':_0x2f67bc[_0x056a('0x5b')]['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x46c2cb,null))[_0x056a('0x37')](function(_0x4fa502){if(_0x4fa502){return _0x4fa502[_0x056a('0xe8')](_0x2f67bc[_0x056a('0x48')]['ids'])[_0x056a('0x37')](function(){if(_[_0x056a('0xe9')](_0x2f67bc[_0x056a('0x48')][_0x056a('0x74')])){for(var _0x263171=0x0;_0x263171<_0x2f67bc[_0x056a('0x48')][_0x056a('0x74')][_0x056a('0x4e')];_0x263171+=0x1){socket['emit'](_0x056a('0xea'),{'UserId':Number(_0x2f67bc[_0x056a('0x48')][_0x056a('0x74')][_0x263171]),'SmsAccountId':Number(_0x2f67bc[_0x056a('0x5b')]['id'])});}}else{socket[_0x056a('0xeb')](_0x056a('0xea'),{'UserId':Number(_0x2f67bc[_0x056a('0x48')][_0x056a('0x74')]),'SmsAccountId':Number(_0x2f67bc[_0x056a('0x5b')]['id'])});}});}})[_0x056a('0x37')](respondWithStatusCode(_0x46c2cb,null))[_0x056a('0x2a')](handleError(_0x46c2cb,null));};exports[_0x056a('0xec')]=function(_0x53c876,_0x40c3e0,_0x2be72f){var _0x4c1244={};var _0x35db74={};var _0x2c3aed;var _0x237daf;return db['SmsAccount']['findOne']({'where':{'id':_0x53c876['params']['id']}})[_0x056a('0x37')](handleEntityNotFound(_0x40c3e0,null))[_0x056a('0x37')](function(_0x508ee5){if(_0x508ee5){_0x2c3aed=_0x508ee5;_0x35db74['model']=_[_0x056a('0x49')](db[_0x056a('0xb1')][_0x056a('0x44')]);_0x35db74[_0x056a('0x48')]=_[_0x056a('0x49')](_0x53c876[_0x056a('0x48')]);_0x35db74[_0x056a('0x4a')]=_[_0x056a('0x4b')](_0x35db74['model'],_0x35db74['query']);_0x4c1244[_0x056a('0x4c')]=_['intersection'](_0x35db74[_0x056a('0x47')],qs[_0x056a('0x4d')](_0x53c876['query'][_0x056a('0x4d')]));_0x4c1244[_0x056a('0x4c')]=_0x4c1244['attributes'][_0x056a('0x4e')]?_0x4c1244['attributes']:_0x35db74[_0x056a('0x47')];_0x4c1244[_0x056a('0x51')]=qs[_0x056a('0x52')](_0x53c876['query'][_0x056a('0x52')]);_0x4c1244['where']=qs['filters'](_[_0x056a('0x6c')](_0x53c876['query'],_0x35db74['filters']));if(_0x53c876[_0x056a('0x48')]['filter']){_0x4c1244['where']=_[_0x056a('0x54')](_0x4c1244[_0x056a('0x53')],{'$or':_[_0x056a('0x42')](_0x4c1244[_0x056a('0x4c')],function(_0x4fd7d3){var _0x3a5c53={};_0x3a5c53[_0x4fd7d3]={'$like':'%'+_0x53c876[_0x056a('0x48')][_0x056a('0x6d')]+'%'};return _0x3a5c53;})});}_0x4c1244=_[_0x056a('0x54')]({},_0x4c1244,_0x53c876['options']);return _0x2c3aed['getAgents'](_0x4c1244);}})[_0x056a('0x37')](function(_0x25a891){if(_0x25a891){_0x237daf=_0x25a891['length'];if(!_0x53c876[_0x056a('0x48')][_0x056a('0x4f')]('nolimit')){_0x4c1244[_0x056a('0x30')]=qs[_0x056a('0x30')](_0x53c876[_0x056a('0x48')][_0x056a('0x30')]);_0x4c1244[_0x056a('0x2e')]=qs[_0x056a('0x2e')](_0x53c876[_0x056a('0x48')][_0x056a('0x2e')]);}return _0x2c3aed[_0x056a('0xec')](_0x4c1244);}})[_0x056a('0x37')](function(_0xdb9302){if(_0xdb9302){return _0xdb9302?{'count':_0x237daf,'rows':_0xdb9302}:null;}})['then'](respondWithResult(_0x40c3e0,null))[_0x056a('0x2a')](handleError(_0x40c3e0,null));}; \ No newline at end of file +var _0xb0f9=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','SmsAccounts','destroy','sendStatus','stack','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','name','findAll','show','params','keys','intersection','include','options','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','ACCEPTD','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','catch','status','end','json','offset'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xb0f9,0xb4));var _0x9b0f=function(_0x3d078a,_0x28ee11){_0x3d078a=_0x3d078a-0x0;var _0x390a12=_0xb0f9[_0x3d078a];return _0x390a12;};'use strict';var emlformat=require(_0x9b0f('0x0'));var rimraf=require(_0x9b0f('0x1'));var zipdir=require(_0x9b0f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b0f('0x3'));var moment=require(_0x9b0f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b0f('0x5'));var util=require(_0x9b0f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9b0f('0x7'));var ejs=require(_0x9b0f('0x8'));var fs=require('fs');var fs_extra=require(_0x9b0f('0x9'));var _=require(_0x9b0f('0xa'));var squel=require(_0x9b0f('0xb'));var crypto=require('crypto');var jsforce=require(_0x9b0f('0xc'));var deskjs=require(_0x9b0f('0xd'));var toCsv=require(_0x9b0f('0x7'));var querystring=require('querystring');var Papa=require(_0x9b0f('0xe'));var Redis=require(_0x9b0f('0xf'));var authService=require(_0x9b0f('0x10'));var qs=require(_0x9b0f('0x11'));var as=require(_0x9b0f('0x12'));var hardwareService=require(_0x9b0f('0x13'));var logger=require(_0x9b0f('0x14'))('api');var utils=require(_0x9b0f('0x15'));var config=require(_0x9b0f('0x16'));var licenseUtil=require(_0x9b0f('0x17'));var db=require(_0x9b0f('0x18'))['db'];config[_0x9b0f('0x19')]=_['defaults'](config['redis'],{'host':_0x9b0f('0x1a'),'port':0x18eb});var socket=require(_0x9b0f('0x1b'))(new Redis(config['redis']));require(_0x9b0f('0x1c'))['register'](socket);var jayson=require(_0x9b0f('0x1d'));var client=jayson[_0x9b0f('0x1e')][_0x9b0f('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5cdbe2,_0x4406c6,_0x4463e1,_0xc382a3){return new BPromise(function(_0x2b4ad4,_0x4830d5){var _0x1702ab=_0xc382a3||client;return _0x1702ab[_0x9b0f('0x20')](_0x5cdbe2,_0x4463e1)['then'](function(_0x19ef84){logger[_0x9b0f('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4406c6,_0x9b0f('0x22'));logger[_0x9b0f('0x23')](_0x9b0f('0x24'),_0x4406c6,_0x9b0f('0x22'),JSON['stringify'](_0x19ef84));if(_0x19ef84[_0x9b0f('0x25')]){if(_0x19ef84[_0x9b0f('0x25')][_0x9b0f('0x26')]===0x1f4){logger[_0x9b0f('0x25')]('SmsAccount,\x20%s,\x20%s',_0x4406c6,_0x19ef84[_0x9b0f('0x25')][_0x9b0f('0x27')]);return _0x4830d5(_0x19ef84[_0x9b0f('0x25')][_0x9b0f('0x27')]);}logger[_0x9b0f('0x25')](_0x9b0f('0x28'),_0x4406c6,_0x19ef84['error'][_0x9b0f('0x27')]);return _0x2b4ad4(_0x19ef84[_0x9b0f('0x25')][_0x9b0f('0x27')]);}else{logger[_0x9b0f('0x21')](_0x9b0f('0x28'),_0x4406c6,'request\x20sent');_0x2b4ad4(_0x19ef84['result']['message']);}})[_0x9b0f('0x29')](function(_0x2a48cc){logger[_0x9b0f('0x25')](_0x9b0f('0x28'),_0x4406c6,_0x2a48cc);_0x4830d5(_0x2a48cc);});});}function respondWithStatusCode(_0x881464,_0x2520dd){_0x2520dd=_0x2520dd||0xcc;return function(_0x2c3c18){if(_0x2c3c18){return _0x881464['sendStatus'](_0x2520dd);}return _0x881464[_0x9b0f('0x2a')](_0x2520dd)[_0x9b0f('0x2b')]();};}function respondWithResult(_0x4738b6,_0x1fd243){_0x1fd243=_0x1fd243||0xc8;return function(_0x3a6cac){if(_0x3a6cac){return _0x4738b6[_0x9b0f('0x2a')](_0x1fd243)[_0x9b0f('0x2c')](_0x3a6cac);}};}function respondWithFilteredResult(_0x7c1439,_0x160a2b){return function(_0xc8b5bf){if(_0xc8b5bf){var _0x3e8814=typeof _0x160a2b[_0x9b0f('0x2d')]==='undefined'&&typeof _0x160a2b['limit']===_0x9b0f('0x2e');var _0x409e72=_0xc8b5bf[_0x9b0f('0x2f')];var _0x1e9f2d=_0x3e8814?0x0:_0x160a2b[_0x9b0f('0x2d')];var _0x1ae3f8=_0x3e8814?_0xc8b5bf[_0x9b0f('0x2f')]:_0x160a2b['offset']+_0x160a2b[_0x9b0f('0x30')];var _0x3b4041;if(_0x1ae3f8>=_0x409e72){_0x1ae3f8=_0x409e72;_0x3b4041=0xc8;}else{_0x3b4041=0xce;}_0x7c1439[_0x9b0f('0x2a')](_0x3b4041);return _0x7c1439[_0x9b0f('0x31')](_0x9b0f('0x32'),_0x1e9f2d+'-'+_0x1ae3f8+'/'+_0x409e72)[_0x9b0f('0x2c')](_0xc8b5bf);}return null;};}function patchUpdates(_0x255465){return function(_0x1213c2){try{jsonpatch[_0x9b0f('0x33')](_0x1213c2,_0x255465,!![]);}catch(_0x86f6fa){return BPromise[_0x9b0f('0x34')](_0x86f6fa);}return _0x1213c2[_0x9b0f('0x35')]();};}function saveUpdates(_0x26edcf,_0x484160){return function(_0x1f0ff2){if(_0x1f0ff2){return _0x1f0ff2[_0x9b0f('0x36')](_0x26edcf)[_0x9b0f('0x37')](function(_0x251dd3){return _0x251dd3;});}return null;};}function removeEntity(_0x3a9505,_0x1b35ca){return function(_0x33e08f){if(_0x33e08f){return _0x33e08f['destroy']()[_0x9b0f('0x37')](function(){var _0x422b9b=_0x33e08f[_0x9b0f('0x38')]({'plain':!![]});var _0x4b3417=_0x9b0f('0x39');return db['UserProfileResource'][_0x9b0f('0x3a')]({'where':{'type':_0x4b3417,'resourceId':_0x422b9b['id']}})[_0x9b0f('0x37')](function(){return _0x33e08f;});})[_0x9b0f('0x37')](function(){_0x3a9505['status'](0xcc)[_0x9b0f('0x2b')]();});}};}function handleEntityNotFound(_0x87b51c,_0x214525){return function(_0x541136){if(!_0x541136){_0x87b51c[_0x9b0f('0x3b')](0x194);}return _0x541136;};}function handleError(_0x5615e3,_0x5a3cc8){_0x5a3cc8=_0x5a3cc8||0x1f4;return function(_0x247bf7){logger['error'](_0x247bf7[_0x9b0f('0x3c')]);if(_0x247bf7['name']){delete _0x247bf7['name'];}_0x5615e3[_0x9b0f('0x2a')](_0x5a3cc8)['send'](_0x247bf7);};}exports['index']=function(_0x376eb3,_0x3eb8c6){var _0x36a3b4={'include':[{'model':db[_0x9b0f('0x3d')],'as':_0x9b0f('0x3e')}]},_0x53c7bc={},_0x5dbc33={'count':0x0,'rows':[]};var _0x2ba8cc=_[_0x9b0f('0x3f')](db[_0x9b0f('0x40')][_0x9b0f('0x41')],function(_0x5203db){return{'name':_0x5203db['fieldName'],'type':_0x5203db[_0x9b0f('0x42')][_0x9b0f('0x43')]};});_0x53c7bc[_0x9b0f('0x44')]=_['map'](_0x2ba8cc,'name');_0x53c7bc[_0x9b0f('0x45')]=_['keys'](_0x376eb3[_0x9b0f('0x45')]);_0x53c7bc[_0x9b0f('0x46')]=_['intersection'](_0x53c7bc[_0x9b0f('0x44')],_0x53c7bc[_0x9b0f('0x45')]);_0x36a3b4[_0x9b0f('0x47')]=_['intersection'](_0x53c7bc[_0x9b0f('0x44')],qs[_0x9b0f('0x48')](_0x376eb3[_0x9b0f('0x45')]['fields']));_0x36a3b4[_0x9b0f('0x47')]=_0x36a3b4[_0x9b0f('0x47')][_0x9b0f('0x49')]?_0x36a3b4[_0x9b0f('0x47')]:_0x53c7bc[_0x9b0f('0x44')];if(!_0x376eb3[_0x9b0f('0x45')][_0x9b0f('0x4a')](_0x9b0f('0x4b'))){_0x36a3b4[_0x9b0f('0x30')]=qs[_0x9b0f('0x30')](_0x376eb3[_0x9b0f('0x45')][_0x9b0f('0x30')]);_0x36a3b4[_0x9b0f('0x2d')]=qs['offset'](_0x376eb3[_0x9b0f('0x45')][_0x9b0f('0x2d')]);}_0x36a3b4[_0x9b0f('0x4c')]=qs['sort'](_0x376eb3[_0x9b0f('0x45')]['sort']);_0x36a3b4[_0x9b0f('0x4d')]=qs[_0x9b0f('0x46')](_[_0x9b0f('0x4e')](_0x376eb3[_0x9b0f('0x45')],_0x53c7bc['filters']),_0x2ba8cc);if(_0x376eb3[_0x9b0f('0x45')][_0x9b0f('0x4f')]){_0x36a3b4[_0x9b0f('0x4d')]=_[_0x9b0f('0x50')](_0x36a3b4[_0x9b0f('0x4d')],{'$or':_[_0x9b0f('0x3f')](_0x2ba8cc,function(_0x1176b0){if(_0x1176b0[_0x9b0f('0x42')]!=='VIRTUAL'){var _0x3d0564={};_0x3d0564[_0x1176b0[_0x9b0f('0x51')]]={'$like':'%'+_0x376eb3['query'][_0x9b0f('0x4f')]+'%'};return _0x3d0564;}})});}_0x36a3b4=_[_0x9b0f('0x50')]({},_0x36a3b4,_0x376eb3['options']);var _0x2c9a7e={'where':_0x36a3b4['where']};return db[_0x9b0f('0x40')][_0x9b0f('0x2f')](_0x2c9a7e)[_0x9b0f('0x37')](function(_0x36e781){_0x5dbc33[_0x9b0f('0x2f')]=_0x36e781;if(_0x376eb3[_0x9b0f('0x45')]['includeAll']){_0x36a3b4['include']=[{'all':!![]}];}return db[_0x9b0f('0x40')][_0x9b0f('0x52')](_0x36a3b4);})[_0x9b0f('0x37')](function(_0x58dfd1){_0x5dbc33['rows']=_0x58dfd1;return _0x5dbc33;})[_0x9b0f('0x37')](respondWithFilteredResult(_0x3eb8c6,_0x36a3b4))[_0x9b0f('0x29')](handleError(_0x3eb8c6,null));};exports[_0x9b0f('0x53')]=function(_0x575a84,_0x434e3e){var _0x1232a0={'raw':![],'where':{'id':_0x575a84[_0x9b0f('0x54')]['id']},'include':[{'model':db[_0x9b0f('0x3d')],'as':_0x9b0f('0x3e')}]},_0x4e079f={};_0x4e079f[_0x9b0f('0x44')]=_[_0x9b0f('0x55')](db[_0x9b0f('0x40')][_0x9b0f('0x41')]);_0x4e079f['query']=_[_0x9b0f('0x55')](_0x575a84['query']);_0x4e079f['filters']=_[_0x9b0f('0x56')](_0x4e079f[_0x9b0f('0x44')],_0x4e079f['query']);_0x1232a0[_0x9b0f('0x47')]=_[_0x9b0f('0x56')](_0x4e079f[_0x9b0f('0x44')],qs[_0x9b0f('0x48')](_0x575a84['query'][_0x9b0f('0x48')]));_0x1232a0[_0x9b0f('0x47')]=_0x1232a0[_0x9b0f('0x47')]['length']?_0x1232a0['attributes']:_0x4e079f[_0x9b0f('0x44')];if(_0x575a84['query']['includeAll']){_0x1232a0[_0x9b0f('0x57')]=[{'all':!![]}];}_0x1232a0=_['merge']({},_0x1232a0,_0x575a84[_0x9b0f('0x58')]);return db[_0x9b0f('0x40')][_0x9b0f('0x59')](_0x1232a0)['then'](handleEntityNotFound(_0x434e3e,null))[_0x9b0f('0x37')](respondWithResult(_0x434e3e,null))[_0x9b0f('0x29')](handleError(_0x434e3e,null));};exports[_0x9b0f('0x5a')]=function(_0x14810a,_0x4956b){return db[_0x9b0f('0x40')][_0x9b0f('0x5a')](_0x14810a[_0x9b0f('0x5b')],{})[_0x9b0f('0x37')](function(_0x40974b){var _0x374505=_0x14810a[_0x9b0f('0x5c')]['get']({'plain':!![]});if(!_0x374505)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x374505[_0x9b0f('0x5d')]===_0x9b0f('0x5c')){var _0x429b4f=_0x40974b[_0x9b0f('0x38')]({'plain':!![]});var _0x3f497a=_0x9b0f('0x39');return db['UserProfileSection'][_0x9b0f('0x59')]({'where':{'name':_0x3f497a,'userProfileId':_0x374505[_0x9b0f('0x5e')]},'raw':!![]})[_0x9b0f('0x37')](function(_0x32498a){if(_0x32498a&&_0x32498a[_0x9b0f('0x5f')]===0x0){return db[_0x9b0f('0x60')]['create']({'name':_0x429b4f[_0x9b0f('0x51')],'resourceId':_0x429b4f['id'],'type':_0x32498a[_0x9b0f('0x51')],'sectionId':_0x32498a['id']},{})[_0x9b0f('0x37')](function(){return _0x40974b;});}else{return _0x40974b;}})[_0x9b0f('0x29')](function(_0x4dbc4d){logger[_0x9b0f('0x25')](_0x9b0f('0x61'),_0x4dbc4d);throw _0x4dbc4d;});}return _0x40974b;})[_0x9b0f('0x37')](respondWithResult(_0x4956b,0xc9))[_0x9b0f('0x29')](handleError(_0x4956b,null));};exports[_0x9b0f('0x36')]=function(_0x26c3fa,_0x99e9f0){if(_0x26c3fa[_0x9b0f('0x5b')]['id']){delete _0x26c3fa[_0x9b0f('0x5b')]['id'];}return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x26c3fa['params']['id']},'include':[{'model':db[_0x9b0f('0x3d')],'as':_0x9b0f('0x3e')}]})[_0x9b0f('0x37')](handleEntityNotFound(_0x99e9f0,null))[_0x9b0f('0x37')](saveUpdates(_0x26c3fa['body'],null))[_0x9b0f('0x37')](respondWithResult(_0x99e9f0,null))['catch'](handleError(_0x99e9f0,null));};exports[_0x9b0f('0x3a')]=function(_0x492fba,_0x8078fd){return db['SmsAccount']['find']({'where':{'id':_0x492fba['params']['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x8078fd,null))[_0x9b0f('0x37')](removeEntity(_0x8078fd,null))[_0x9b0f('0x29')](handleError(_0x8078fd,null));};exports['describe']=function(_0x4dad5c,_0x351360){return db[_0x9b0f('0x40')][_0x9b0f('0x62')]()['then'](respondWithResult(_0x351360,null))[_0x9b0f('0x29')](handleError(_0x351360,null));};exports[_0x9b0f('0x63')]=function(_0x50835a,_0x53e7ce,_0x541b60){if(_0x50835a[_0x9b0f('0x5b')]['id']){delete _0x50835a[_0x9b0f('0x5b')]['id'];}return db['SmsAccount'][_0x9b0f('0x59')]({'where':{'id':_0x50835a[_0x9b0f('0x54')]['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x53e7ce,null))[_0x9b0f('0x37')](function(_0x37b35b){if(_0x37b35b){_0x50835a[_0x9b0f('0x5b')][_0x9b0f('0x64')]=_0x37b35b['id'];return db[_0x9b0f('0x65')][_0x9b0f('0x5a')](_0x50835a['body']);}})[_0x9b0f('0x37')](respondWithResult(_0x53e7ce,null))[_0x9b0f('0x29')](handleError(_0x53e7ce,null));};exports[_0x9b0f('0x66')]=function(_0x1aeb0d,_0x38373f,_0x2ed1a5){var _0xcd95d6={'raw':![],'where':{}};var _0x111b05={};var _0x474c27={'count':0x0,'rows':[]};return db[_0x9b0f('0x40')][_0x9b0f('0x67')]({'where':{'id':_0x1aeb0d[_0x9b0f('0x54')]['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x38373f,null))[_0x9b0f('0x37')](function(_0x2dfd5a){if(_0x2dfd5a){_0x111b05[_0x9b0f('0x44')]=_[_0x9b0f('0x55')](db[_0x9b0f('0x65')][_0x9b0f('0x41')]);_0x111b05[_0x9b0f('0x45')]=_['keys'](_0x1aeb0d['query']);_0x111b05[_0x9b0f('0x46')]=_[_0x9b0f('0x56')](_0x111b05[_0x9b0f('0x44')],_0x111b05['query']);_0xcd95d6[_0x9b0f('0x47')]=_['intersection'](_0x111b05[_0x9b0f('0x44')],qs[_0x9b0f('0x48')](_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x48')]));_0xcd95d6['attributes']=_0xcd95d6[_0x9b0f('0x47')][_0x9b0f('0x49')]?_0xcd95d6['attributes']:_0x111b05[_0x9b0f('0x44')];if(!_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x4a')](_0x9b0f('0x4b'))){_0xcd95d6[_0x9b0f('0x30')]=qs[_0x9b0f('0x30')](_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x30')]);_0xcd95d6[_0x9b0f('0x2d')]=qs[_0x9b0f('0x2d')](_0x1aeb0d['query'][_0x9b0f('0x2d')]);}_0xcd95d6[_0x9b0f('0x4c')]=qs['sort'](_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x68')]);_0xcd95d6['where']=qs['filters'](_[_0x9b0f('0x4e')](_0x1aeb0d['query'],_0x111b05[_0x9b0f('0x46')]));_0xcd95d6[_0x9b0f('0x4d')][_0x9b0f('0x64')]=_0x2dfd5a['id'];if(_0x1aeb0d['query']['filter']){_0xcd95d6[_0x9b0f('0x4d')]=_[_0x9b0f('0x50')](_0xcd95d6[_0x9b0f('0x4d')],{'$or':_['map'](_0xcd95d6[_0x9b0f('0x47')],function(_0x41d47f){var _0x1a6a0e={};_0x1a6a0e[_0x41d47f]={'$like':'%'+_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x4f')]+'%'};return _0x1a6a0e;})});}_0xcd95d6=_['merge']({},_0xcd95d6,_0x1aeb0d[_0x9b0f('0x58')]);return db[_0x9b0f('0x65')][_0x9b0f('0x2f')]({'where':_0xcd95d6['where']})[_0x9b0f('0x37')](function(_0x5b5b25){_0x474c27[_0x9b0f('0x2f')]=_0x5b5b25;if(_0x1aeb0d[_0x9b0f('0x45')][_0x9b0f('0x69')]){_0xcd95d6[_0x9b0f('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x9b0f('0x52')](_0xcd95d6);})[_0x9b0f('0x37')](function(_0x114bdc){_0x474c27[_0x9b0f('0x6a')]=_0x114bdc;return _0x474c27;});}})[_0x9b0f('0x37')](respondWithFilteredResult(_0x38373f,_0xcd95d6))[_0x9b0f('0x29')](handleError(_0x38373f,null));};exports[_0x9b0f('0x6b')]=function(_0x6496e4,_0x1106d2,_0x106f39){return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x6496e4[_0x9b0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x1106d2,null))[_0x9b0f('0x37')](function(_0x3b206e){if(_0x3b206e){return _0x3b206e[_0x9b0f('0x6b')](_0x6496e4[_0x9b0f('0x45')][_0x9b0f('0x6c')]);}})['then'](respondWithStatusCode(_0x1106d2,null))['catch'](handleError(_0x1106d2,null));};exports['addAnswer']=function(_0x2a60d4,_0x13dd4d,_0x327545){if(_0x2a60d4[_0x9b0f('0x5b')]['id']){delete _0x2a60d4[_0x9b0f('0x5b')]['id'];}return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x2a60d4['params']['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x13dd4d,null))[_0x9b0f('0x37')](function(_0x18141a){if(_0x18141a){_0x2a60d4['body'][_0x9b0f('0x64')]=_0x18141a['id'];return db[_0x9b0f('0x6d')]['create'](_0x2a60d4[_0x9b0f('0x5b')]);}})[_0x9b0f('0x37')](respondWithResult(_0x13dd4d,null))[_0x9b0f('0x29')](handleError(_0x13dd4d,null));};exports[_0x9b0f('0x6e')]=function(_0x129b01,_0x4e4e3f,_0x171ad2){var _0x5656ac={'raw':![],'where':{}};var _0x42a0c0={};var _0x3becc3={'count':0x0,'rows':[]};return db[_0x9b0f('0x40')][_0x9b0f('0x67')]({'where':{'id':_0x129b01[_0x9b0f('0x54')]['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x4e4e3f,null))[_0x9b0f('0x37')](function(_0x52e971){if(_0x52e971){_0x42a0c0['model']=_['keys'](db[_0x9b0f('0x6d')][_0x9b0f('0x41')]);_0x42a0c0[_0x9b0f('0x45')]=_[_0x9b0f('0x55')](_0x129b01['query']);_0x42a0c0[_0x9b0f('0x46')]=_[_0x9b0f('0x56')](_0x42a0c0['model'],_0x42a0c0[_0x9b0f('0x45')]);_0x5656ac['attributes']=_[_0x9b0f('0x56')](_0x42a0c0[_0x9b0f('0x44')],qs['fields'](_0x129b01[_0x9b0f('0x45')][_0x9b0f('0x48')]));_0x5656ac['attributes']=_0x5656ac[_0x9b0f('0x47')][_0x9b0f('0x49')]?_0x5656ac[_0x9b0f('0x47')]:_0x42a0c0[_0x9b0f('0x44')];if(!_0x129b01[_0x9b0f('0x45')][_0x9b0f('0x4a')](_0x9b0f('0x4b'))){_0x5656ac[_0x9b0f('0x30')]=qs[_0x9b0f('0x30')](_0x129b01['query'][_0x9b0f('0x30')]);_0x5656ac[_0x9b0f('0x2d')]=qs[_0x9b0f('0x2d')](_0x129b01['query'][_0x9b0f('0x2d')]);}_0x5656ac[_0x9b0f('0x4c')]=qs[_0x9b0f('0x68')](_0x129b01[_0x9b0f('0x45')][_0x9b0f('0x68')]);_0x5656ac['where']=qs[_0x9b0f('0x46')](_[_0x9b0f('0x4e')](_0x129b01[_0x9b0f('0x45')],_0x42a0c0[_0x9b0f('0x46')]));_0x5656ac[_0x9b0f('0x4d')][_0x9b0f('0x64')]=_0x52e971['id'];if(_0x129b01[_0x9b0f('0x45')][_0x9b0f('0x4f')]){_0x5656ac[_0x9b0f('0x4d')]=_[_0x9b0f('0x50')](_0x5656ac['where'],{'$or':_[_0x9b0f('0x3f')](_0x5656ac['attributes'],function(_0x42727a){var _0x26e376={};_0x26e376[_0x42727a]={'$like':'%'+_0x129b01[_0x9b0f('0x45')][_0x9b0f('0x4f')]+'%'};return _0x26e376;})});}_0x5656ac=_['merge']({},_0x5656ac,_0x129b01[_0x9b0f('0x58')]);return db[_0x9b0f('0x6d')]['count']({'where':_0x5656ac[_0x9b0f('0x4d')]})[_0x9b0f('0x37')](function(_0xc3d47f){_0x3becc3[_0x9b0f('0x2f')]=_0xc3d47f;if(_0x129b01['query']['includeAll']){_0x5656ac[_0x9b0f('0x57')]=[{'all':!![]}];}return db[_0x9b0f('0x6d')][_0x9b0f('0x52')](_0x5656ac);})[_0x9b0f('0x37')](function(_0x38d563){_0x3becc3[_0x9b0f('0x6a')]=_0x38d563;return _0x3becc3;});}})[_0x9b0f('0x37')](respondWithFilteredResult(_0x4e4e3f,_0x5656ac))['catch'](handleError(_0x4e4e3f,null));};exports[_0x9b0f('0x6f')]=function(_0x400779,_0x35653c,_0x2ded7d){return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x400779['params']['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x35653c,null))[_0x9b0f('0x37')](function(_0x39ab25){if(_0x39ab25){return _0x39ab25[_0x9b0f('0x6f')](_0x400779['query'][_0x9b0f('0x6c')]);}})[_0x9b0f('0x37')](respondWithStatusCode(_0x35653c,null))[_0x9b0f('0x29')](handleError(_0x35653c,null));};exports[_0x9b0f('0x70')]=function(_0x49a62f,_0x5ae49e,_0x54713d){var _0x4afe27={'channel':_0x9b0f('0x71')};var _0x263cbf=[];var _0xb5a212=[];var _0x43ce3a={};return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x49a62f[_0x9b0f('0x54')]['id']},'include':[{'model':db[_0x9b0f('0x72')],'as':_0x9b0f('0x73')}]})[_0x9b0f('0x37')](handleEntityNotFound(_0x5ae49e,null))[_0x9b0f('0x37')](function(_0x569a90){_0x4afe27[_0x9b0f('0x74')]=_0x569a90;_0x4afe27[_0x9b0f('0x75')]=_[_0x9b0f('0x76')](_0x569a90[_0x9b0f('0x73')],[_0x9b0f('0x77')],['asc']);if(_0x4afe27['account'][_0x9b0f('0x73')]){delete _0x4afe27['account'][_0x9b0f('0x73')];}return db['CmContact']['describe']();})[_0x9b0f('0x37')](function(_0x359950){if(!_0x359950){throw new db[(_0x9b0f('0x78'))][(_0x9b0f('0x79'))]('no\x20available\x20attributes');}_0x263cbf=_[_0x9b0f('0x7a')](_[_0x9b0f('0x55')](_0x359950),[_0x9b0f('0x7b'),'updatedAt']);_0xb5a212=_[_0x9b0f('0x7a')](_[_0x9b0f('0x55')](_0x359950),[_0x9b0f('0x7b'),_0x9b0f('0x7c'),_0x9b0f('0x7d'),_0x9b0f('0x7e')]);_0x4afe27['body']={'mapKey':_0x9b0f('0x7f')};if(_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0x42')]){switch(_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0x42')]){case'twilio':_0x4afe27[_0x9b0f('0x5b')]['from']=_0x49a62f['body'][_0x9b0f('0x80')];_0x4afe27['body'][_0x9b0f('0x5b')]=_0x49a62f['body']['Body'];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x82')];break;case _0x9b0f('0x83'):_0x4afe27['body'][_0x9b0f('0x84')]='+'+_0x49a62f['body'][_0x9b0f('0x85')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x86')];break;case _0x9b0f('0x87'):_0x4afe27[_0x9b0f('0x5b')]['from']=_0x49a62f['body'][_0x9b0f('0x84')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')]['message'];break;case _0x9b0f('0x88'):_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')]=_0x49a62f[_0x9b0f('0x5b')]['from'];_0x4afe27['body'][_0x9b0f('0x5b')]=_0x49a62f['body'][_0x9b0f('0x5b')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x89')];break;case'plivo':_0x4afe27['body'][_0x9b0f('0x84')]=_0x49a62f['body'][_0x9b0f('0x80')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')]['Text'];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x8a')];break;case _0x9b0f('0x8b'):_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')]='+'+_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x8c')][0x0][_0x9b0f('0x84')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f['body'][_0x9b0f('0x8c')][0x0][_0x9b0f('0x86')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f['body'][_0x9b0f('0x8c')][0x0][_0x9b0f('0x81')];break;case _0x9b0f('0x8d'):_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x8e')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x8f')]['message'];break;case _0x9b0f('0x90'):_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')]=_0x49a62f[_0x9b0f('0x5b')]['fromNumber'];_0x4afe27['body'][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x86')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x91')];break;case _0x9b0f('0x92'):_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')]=_0x49a62f['body'][0x0][_0x9b0f('0x27')]['id'];_0x4afe27['body'][_0x9b0f('0x84')]=_0x49a62f[_0x9b0f('0x5b')][0x0][_0x9b0f('0x27')][_0x9b0f('0x84')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f[_0x9b0f('0x5b')][0x0][_0x9b0f('0x27')][_0x9b0f('0x86')];break;case'intelepeer':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')]=_0x49a62f[_0x9b0f('0x5b')][_0x9b0f('0x84')];_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')]=_0x49a62f['body'][_0x9b0f('0x27')];_0x4afe27['body'][_0x9b0f('0x81')]=_0x49a62f[_0x9b0f('0x5b')]['refid'];break;}}if(_0x4afe27[_0x9b0f('0x5b')]['id']){delete _0x4afe27[_0x9b0f('0x5b')]['id'];}if(_['isNil'](_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')])){throw new db[(_0x9b0f('0x78'))][(_0x9b0f('0x79'))](_0x9b0f('0x93'));}if(_[_0x9b0f('0x94')](_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')])||_0x4afe27['body'][_0x9b0f('0x5b')]===''){throw new db[(_0x9b0f('0x78'))][(_0x9b0f('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9b0f('0x94')](_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x95')])){throw new db[(_0x9b0f('0x78'))][(_0x9b0f('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb5a212);}if(!_[_0x9b0f('0x96')](_0xb5a212,_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x95')])){throw new db[(_0x9b0f('0x78'))][(_0x9b0f('0x79'))](_0x9b0f('0x97')+_0xb5a212);}_0x43ce3a[_0x4afe27[_0x9b0f('0x5b')]['mapKey']]=_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')];return db[_0x9b0f('0x98')][_0x9b0f('0x59')]({'where':{'id':_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0x7e')]},'include':[{'model':db[_0x9b0f('0x99')],'as':'Contacts','where':_0x43ce3a,'limit':0x1,'order':[[_0x9b0f('0x7c'),_0x9b0f('0x9a')]]}]});})['then'](handleEntityNotFound(_0x5ae49e,null))[_0x9b0f('0x37')](function(_0x2d34d7){if(_0x2d34d7){_0x4afe27[_0x9b0f('0x9b')]=_[_0x9b0f('0x9c')](_0x2d34d7,[_0x9b0f('0x9d')]);if(_0x2d34d7[_0x9b0f('0x9d')][_0x9b0f('0x49')]){return _0x2d34d7[_0x9b0f('0x9d')][0x0];}var _0x1e5fc4=_[_0x9b0f('0x9e')](_0x4afe27['body'],{'firstName':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')],'ListId':_0x2d34d7['id']});_0x1e5fc4[_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x95')]]=_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')];return db[_0x9b0f('0x99')]['create'](_0x1e5fc4,{'fields':_0x263cbf,'raw':!![]});}})[_0x9b0f('0x37')](handleEntityNotFound(_0x5ae49e,null))[_0x9b0f('0x37')](function(_0x13c317){if(_0x13c317){_0x4afe27[_0x9b0f('0x9f')]=_0x13c317;var _0x4aca3d={'ContactId':_0x13c317['id'],'phone':_0x4afe27[_0x9b0f('0x5b')]['from'],'SmsAccountId':_0x49a62f[_0x9b0f('0x54')]['id']};var _0x3ccf9f={'ContactId':_0x13c317['id'],'SmsAccountId':_0x49a62f[_0x9b0f('0x54')]['id'],'closed':![]};return db[_0x9b0f('0xa0')]['find']({'where':_0x3ccf9f})[_0x9b0f('0x37')](function(_0x555eb9){if(_0x555eb9){return[_0x555eb9,![]];}return db[_0x9b0f('0xa0')][_0x9b0f('0x5a')](_0x4aca3d)[_0x9b0f('0x37')](function(_0x56cc60){return[_0x56cc60,!![]];});});}})[_0x9b0f('0xa1')](function(_0x122a8d,_0x4cbb25){_0x4afe27[_0x9b0f('0xa2')]=_0x122a8d['get']({'plain':!![]});_0x4afe27[_0x9b0f('0xa2')][_0x9b0f('0xa3')]=![];if(_0x4cbb25){if(_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0xa4')]){_0x4afe27[_0x9b0f('0x75')][_0x9b0f('0xa5')]({'id':0x0,'priority':_0x4afe27[_0x9b0f('0x75')][_0x9b0f('0x49')]+0x1,'app':'close','appdata':_0x9b0f('0xa6'),'interval':'*,*,*,*'});}_0x4afe27[_0x9b0f('0xa2')][_0x9b0f('0xa3')]=!![];}return db[_0x9b0f('0xa7')][_0x9b0f('0x5a')]({'phone':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x84')],'messageId':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x81')],'body':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0x5b')],'SmsAccountId':_0x49a62f['params']['id'],'SmsInteractionId':_0x122a8d['id'],'direction':'in','ContactId':_0x122a8d[_0x9b0f('0xa8')],'AttachmentId':_0x4afe27[_0x9b0f('0x5b')][_0x9b0f('0xa9')]});})['then'](function(_0x13aa6b){_0x4afe27[_0x9b0f('0x27')]=_0x13aa6b;if(_0x4afe27[_0x9b0f('0xa2')][_0x9b0f('0xaa')]){return db[_0x9b0f('0xab')][_0x9b0f('0x59')]({'attributes':['id',_0x9b0f('0x51')],'where':{'id':_0x4afe27[_0x9b0f('0xa2')][_0x9b0f('0xaa')]}})[_0x9b0f('0x37')](function(_0x369d7f){if(_0x369d7f){_0x4afe27[_0x9b0f('0x75')][_0x9b0f('0xac')]({'id':0x0,'priority':0x0,'app':_0x9b0f('0xad'),'appdata':_0x369d7f['name']+','+(_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0xae')]||0xa),'interval':_0x9b0f('0xaf')});}return respondWithRpcPromise(_0x9b0f('0xb0'),_0x9b0f('0xb1'),_0x4afe27);});}return respondWithRpcPromise(_0x9b0f('0xb0'),_0x9b0f('0xb1'),_0x4afe27);})[_0x9b0f('0x37')](function(_0x4ddb81){if(_0x4ddb81){var _0x2406a9=0xc8;var _0x58a163=_0x9b0f('0xb2');logger[_0x9b0f('0x21')](_0x9b0f('0x24'),_0x58a163,_0x2406a9,'entity\x20found');logger['debug'](_0x9b0f('0xb3'),_0x58a163,_0x2406a9,_0x9b0f('0xb4'),JSON[_0x9b0f('0xb5')](_0x4ddb81));if(_0x4afe27[_0x9b0f('0x74')][_0x9b0f('0x42')]==='twilio'){return _0x5ae49e[_0x9b0f('0x2a')](_0x2406a9)[_0x9b0f('0x31')](_0x9b0f('0xb6'),_0x9b0f('0xb7'))['send'](_0x9b0f('0xb8'));}else{return _0x5ae49e[_0x9b0f('0x2a')](_0x2406a9)[_0x9b0f('0x2c')](_0x4ddb81);}}})[_0x9b0f('0x29')](handleError(_0x5ae49e,null));};exports[_0x9b0f('0xb9')]=function(_0x332d60,_0x424ba4){var _0x20414e=_0x332d60[_0x9b0f('0x54')]['id'];var _0x2643c0=_0x332d60[_0x9b0f('0x5b')];var _0x13c426=0xc8;var _0xc98f97=null;return db[_0x9b0f('0xba')]['transaction']({'isolationLevel':db[_0x9b0f('0xba')][_0x9b0f('0xbb')]['ISOLATION_LEVELS'][_0x9b0f('0xbc')]},function(_0x3c7ea5){return db[_0x9b0f('0x40')][_0x9b0f('0x67')]({'where':{'id':_0x20414e},'transaction':_0x3c7ea5})[_0x9b0f('0x37')](function(_0x1b6259){if(_0x1b6259){return db[_0x9b0f('0x72')][_0x9b0f('0x3a')]({'where':{'SmsAccountId':_0x20414e},'transaction':_0x3c7ea5})[_0x9b0f('0x37')](function(){var _0x303f8e=_[_0x9b0f('0x3f')](_0x2643c0,function(_0x3e38bb){_0x3e38bb[_0x9b0f('0x64')]=_0x20414e;return _0x3e38bb;});return db[_0x9b0f('0x72')][_0x9b0f('0xbd')](_0x303f8e,{'transaction':_0x3c7ea5});});}else{_0x13c426=0x194;_0xc98f97=[];}});})[_0x9b0f('0x37')](function(){if(_0x13c426!==0x194){return db[_0x9b0f('0x72')][_0x9b0f('0xbe')]({'where':{'SmsAccountId':_0x20414e},'order':'priority'})[_0x9b0f('0x37')](function(_0x2ef92a){_0xc98f97=_0x2ef92a;});}})[_0x9b0f('0x29')](function(_0x1af1cc){_0x13c426=0x1f4;logger[_0x9b0f('0x25')](_0x1af1cc[_0x9b0f('0x3c')]);if(_0x1af1cc[_0x9b0f('0x51')]){delete _0x1af1cc[_0x9b0f('0x51')];}_0xc98f97=_0x1af1cc;})[_0x9b0f('0xbf')](function(){if(_0xc98f97===null){_0x424ba4[_0x9b0f('0x3b')](_0x13c426);}else{if(_0x13c426===0x1f4){_0x424ba4[_0x9b0f('0x2a')](_0x13c426)['send'](_0xc98f97);}else{_0x424ba4[_0x9b0f('0x2a')](_0x13c426)[_0x9b0f('0x2c')](_0xc98f97);}}});};exports[_0x9b0f('0xc0')]=function(_0x31100d,_0xc7910b,_0x5ab868){var _0x28291a={};var _0x2381ff={};var _0x53a44a;var _0x2a3a3a;return db[_0x9b0f('0x40')]['findOne']({'where':{'id':_0x31100d[_0x9b0f('0x54')]['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0xc7910b,null))[_0x9b0f('0x37')](function(_0x120e6b){if(_0x120e6b){_0x53a44a=_0x120e6b;_0x2381ff[_0x9b0f('0x44')]=_[_0x9b0f('0x55')](db['SmsApplication'][_0x9b0f('0x41')]);_0x2381ff[_0x9b0f('0x45')]=_[_0x9b0f('0x55')](_0x31100d[_0x9b0f('0x45')]);_0x2381ff['filters']=_[_0x9b0f('0x56')](_0x2381ff['model'],_0x2381ff[_0x9b0f('0x45')]);_0x28291a[_0x9b0f('0x47')]=_[_0x9b0f('0x56')](_0x2381ff[_0x9b0f('0x44')],qs[_0x9b0f('0x48')](_0x31100d['query'][_0x9b0f('0x48')]));_0x28291a[_0x9b0f('0x47')]=_0x28291a[_0x9b0f('0x47')]['length']?_0x28291a[_0x9b0f('0x47')]:_0x2381ff['model'];_0x28291a[_0x9b0f('0x4c')]=qs[_0x9b0f('0x68')](_0x31100d[_0x9b0f('0x45')][_0x9b0f('0x68')]);_0x28291a['where']=qs['filters'](_[_0x9b0f('0x4e')](_0x31100d[_0x9b0f('0x45')],_0x2381ff[_0x9b0f('0x46')]));if(_0x31100d[_0x9b0f('0x45')]['filter']){_0x28291a[_0x9b0f('0x4d')]=_[_0x9b0f('0x50')](_0x28291a[_0x9b0f('0x4d')],{'$or':_['map'](_0x28291a[_0x9b0f('0x47')],function(_0xa89ff5){var _0x12bf36={};_0x12bf36[_0xa89ff5]={'$like':'%'+_0x31100d[_0x9b0f('0x45')]['filter']+'%'};return _0x12bf36;})});}_0x28291a=_[_0x9b0f('0x50')]({},_0x28291a,_0x31100d['options']);return _0x53a44a[_0x9b0f('0xc0')](_0x28291a);}})[_0x9b0f('0x37')](function(_0xeade77){if(_0xeade77){_0x2a3a3a=_0xeade77[_0x9b0f('0x49')];if(!_0x31100d[_0x9b0f('0x45')][_0x9b0f('0x4a')](_0x9b0f('0x4b'))){_0x28291a['limit']=qs[_0x9b0f('0x30')](_0x31100d[_0x9b0f('0x45')][_0x9b0f('0x30')]);_0x28291a[_0x9b0f('0x2d')]=qs[_0x9b0f('0x2d')](_0x31100d[_0x9b0f('0x45')]['offset']);}return _0x53a44a[_0x9b0f('0xc0')](_0x28291a);}})[_0x9b0f('0x37')](function(_0x2efdd1){if(_0x2efdd1){return _0x2efdd1?{'count':_0x2a3a3a,'rows':_0x2efdd1}:null;}})[_0x9b0f('0x37')](respondWithResult(_0xc7910b,null))[_0x9b0f('0x29')](handleError(_0xc7910b,null));};exports[_0x9b0f('0xc1')]=function(_0x2b5241,_0x1d24f5,_0x44af84){var _0x257744={'raw':![],'where':{}};var _0x5d5e47={};var _0x3c72ca={'count':0x0,'rows':[]};return db[_0x9b0f('0x40')][_0x9b0f('0x67')]({'where':{'id':_0x2b5241[_0x9b0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d24f5,null))[_0x9b0f('0x37')](function(_0x4375ff){if(_0x4375ff){_0x5d5e47[_0x9b0f('0x44')]=_[_0x9b0f('0x55')](db[_0x9b0f('0xa0')]['rawAttributes']);_0x5d5e47[_0x9b0f('0x45')]=_[_0x9b0f('0x55')](_0x2b5241['query']);_0x5d5e47[_0x9b0f('0x46')]=_['intersection'](_0x5d5e47[_0x9b0f('0x44')],_0x5d5e47[_0x9b0f('0x45')]);_0x257744[_0x9b0f('0x47')]=_[_0x9b0f('0x56')](_0x5d5e47[_0x9b0f('0x44')],qs['fields'](_0x2b5241['query'][_0x9b0f('0x48')]));_0x257744[_0x9b0f('0x47')]=_0x257744[_0x9b0f('0x47')][_0x9b0f('0x49')]?_0x257744['attributes']:_0x5d5e47[_0x9b0f('0x44')];if(!_0x2b5241[_0x9b0f('0x45')]['hasOwnProperty'](_0x9b0f('0x4b'))){_0x257744['limit']=qs[_0x9b0f('0x30')](_0x2b5241['query'][_0x9b0f('0x30')]);_0x257744[_0x9b0f('0x2d')]=qs[_0x9b0f('0x2d')](_0x2b5241[_0x9b0f('0x45')][_0x9b0f('0x2d')]);}_0x257744[_0x9b0f('0x4c')]=qs['sort'](_0x2b5241[_0x9b0f('0x45')]['sort']);_0x257744[_0x9b0f('0x4d')]=qs[_0x9b0f('0x46')](_[_0x9b0f('0x4e')](_0x2b5241[_0x9b0f('0x45')],_0x5d5e47[_0x9b0f('0x46')]));_0x257744[_0x9b0f('0x4d')][_0x9b0f('0x64')]=_0x4375ff['id'];if(_0x2b5241[_0x9b0f('0x45')][_0x9b0f('0x4f')]){_0x257744[_0x9b0f('0x4d')]=_['merge'](_0x257744['where'],{'$or':_[_0x9b0f('0x3f')](_0x257744[_0x9b0f('0x47')],function(_0x2144b9){var _0xd8e1a7={};_0xd8e1a7[_0x2144b9]={'$like':'%'+_0x2b5241[_0x9b0f('0x45')][_0x9b0f('0x4f')]+'%'};return _0xd8e1a7;})});}_0x257744=_[_0x9b0f('0x50')]({},_0x257744,_0x2b5241['options']);return db[_0x9b0f('0xa0')][_0x9b0f('0x2f')]({'where':_0x257744[_0x9b0f('0x4d')]})[_0x9b0f('0x37')](function(_0xef63d3){_0x3c72ca[_0x9b0f('0x2f')]=_0xef63d3;if(_0x2b5241[_0x9b0f('0x45')][_0x9b0f('0x69')]){_0x257744[_0x9b0f('0x57')]=[{'model':db[_0x9b0f('0x99')],'as':'Contact','required':![]},{'model':db[_0x9b0f('0xab')],'as':_0x9b0f('0xc2'),'attributes':[_0x9b0f('0x51'),_0x9b0f('0xc3'),'internal'],'required':![]},{'model':db[_0x9b0f('0xc4')],'as':_0x9b0f('0xc5'),'attributes':['id','name',_0x9b0f('0xc6')],'where':_0x2b5241[_0x9b0f('0x45')][_0x9b0f('0xc7')]?{'id':_0x2b5241['query'][_0x9b0f('0xc7')]}:undefined,'required':_0x2b5241['query'][_0x9b0f('0xc7')]?!![]:![]}];}return db[_0x9b0f('0xa0')][_0x9b0f('0x52')](_0x257744);})[_0x9b0f('0x37')](function(_0x2744cf){_0x3c72ca[_0x9b0f('0x6a')]=_0x2744cf;return _0x3c72ca;});}})[_0x9b0f('0x37')](respondWithFilteredResult(_0x1d24f5,_0x257744))['catch'](handleError(_0x1d24f5,null));};exports[_0x9b0f('0xc8')]=function(_0xb6014f,_0x41a6ac,_0x5a4067){var _0x3f6263,_0xe4a351,_0x25493e;if(_[_0x9b0f('0x94')](_0xb6014f[_0x9b0f('0x5b')][_0x9b0f('0x5b')])||_0xb6014f[_0x9b0f('0x5b')][_0x9b0f('0x5b')]===''){throw new db[(_0x9b0f('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9b0f('0x94')](_0xb6014f[_0x9b0f('0x5b')]['to'])){throw new db['Sequelize'][(_0x9b0f('0x79'))](_0x9b0f('0xc9'));}_0x3f6263=_0xb6014f[_0x9b0f('0x5b')]['to'];return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0xb6014f[_0x9b0f('0x54')]['id']},'include':[{'model':db[_0x9b0f('0x98')],'as':_0x9b0f('0xca'),'include':[{'model':db[_0x9b0f('0x99')],'as':'Contacts','where':{'mobile':_0x3f6263},'limit':0x1,'order':[[_0x9b0f('0x7c'),_0x9b0f('0x9a')]]}]}]})[_0x9b0f('0x37')](handleEntityNotFound(_0x41a6ac,null))['then'](function(_0x2bc52d){if(_0x2bc52d&&_0x2bc52d['List']){_0xe4a351=_0x2bc52d[_0x9b0f('0x38')]({'plain':!![]});if(_0xe4a351['List']&&_0xe4a351[_0x9b0f('0xca')][_0x9b0f('0x9d')]['length']){return _0xe4a351[_0x9b0f('0xca')][_0x9b0f('0x9d')][0x0];}return db[_0x9b0f('0x99')][_0x9b0f('0x5a')](_[_0x9b0f('0x9e')](_0xb6014f[_0x9b0f('0x5b')],{'firstName':_0x3f6263,'mobile':_0x3f6263,'phone':_0x3f6263,'ListId':_0xe4a351[_0x9b0f('0x7e')]}));}})[_0x9b0f('0x37')](handleEntityNotFound(_0x41a6ac,null))[_0x9b0f('0x37')](function(_0x48489d){if(_0x48489d){_0x25493e=_0x48489d;return db[_0x9b0f('0xa0')][_0x9b0f('0x59')]({'where':{'ContactId':_0x25493e['id'],'closed':![],'SmsAccountId':_0xe4a351['id']}})[_0x9b0f('0x37')](function(_0x43ea93){if(_0x43ea93){return[_0x43ea93,![]];}return db[_0x9b0f('0xa0')][_0x9b0f('0x5a')]({'UserId':_0xb6014f['user']['id'],'ContactId':_0x25493e['id'],'SmsAccountId':_0xe4a351['id'],'phone':_0x3f6263,'firstMsgDirection':'out','Messages':[_['merge'](_0xb6014f[_0x9b0f('0x5b')],{'read':![],'body':_0xb6014f['body']['body'],'phone':_0x3f6263,'SmsAccountId':_0xe4a351['id'],'UserId':_0xb6014f[_0x9b0f('0x5c')]['id'],'ContactId':_0x25493e['id']})]},{'include':[{'model':db[_0x9b0f('0xa7')],'as':'Messages'}]})['then'](function(_0x383c93){return[_0x383c93,!![]];});});}})[_0x9b0f('0xa1')](function(_0x1a60b9,_0x49b1e7){if(_0x49b1e7){return _0x1a60b9;}return db['SmsMessage'][_0x9b0f('0x5a')](_[_0x9b0f('0x50')](_0xb6014f['body'],{'read':![],'body':_0xb6014f[_0x9b0f('0x5b')][_0x9b0f('0x5b')],'phone':_0x3f6263,'SmsAccountId':_0xe4a351['id'],'SmsInteractionId':_0x1a60b9['id'],'UserId':_0xb6014f[_0x9b0f('0x5c')]['id'],'ContactId':_0x25493e['id']}))[_0x9b0f('0x37')](function(_0x33e4e3){_0x1a60b9['dataValues'][_0x9b0f('0xcb')]=[];_0x1a60b9[_0x9b0f('0xcc')][_0x9b0f('0xcb')][_0x9b0f('0xa5')](_0x33e4e3['dataValues']);return _0x1a60b9;});})['then'](respondWithResult(_0x41a6ac,null))[_0x9b0f('0x29')](handleError(_0x41a6ac,null));};exports[_0x9b0f('0x2a')]=function(_0x1d98b6,_0x43b8be,_0x17c31f){if(_0x1d98b6[_0x9b0f('0x5b')]['id']){delete _0x1d98b6['body']['id'];}var _0x50089a,_0x18d96e,_0x32b513;return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x1d98b6[_0x9b0f('0x54')]['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x43b8be,null))[_0x9b0f('0x37')](function(_0x29014c){if(_0x29014c){_0x32b513=_0x29014c;logger['debug'](_0x9b0f('0x24'),_0x9b0f('0x2a'),_0x9b0f('0xcd'),_0x29014c['type'],util[_0x9b0f('0xce')](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));switch(_0x29014c[_0x9b0f('0x42')]){case _0x9b0f('0x83'):if(_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0xcf')]&&_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')]){_0x18d96e=_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6['body'][_0x9b0f('0xcf')]}});}break;case _0x9b0f('0x87'):if(_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0xd0')]&&_0x1d98b6[_0x9b0f('0x5b')]['statusInt']){_0x18d96e=_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0xd1')];return db['SmsMessage'][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6['body'][_0x9b0f('0xd0')]}});}break;case _0x9b0f('0x88'):if(_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x89')]&&_0x1d98b6[_0x9b0f('0x5b')]['status_code']){_0x18d96e=_0x1d98b6['body']['status_code'];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6[_0x9b0f('0x5b')]['message_id']}});}break;case'infobip':var _0xe190ea=_0x1d98b6['body'][_0x9b0f('0x8c')][0x0];if(_0xe190ea[_0x9b0f('0x81')]&&_0xe190ea['status'][_0x9b0f('0xd2')]===_0x9b0f('0xd3')){_0x18d96e=_0xe190ea[_0x9b0f('0x2a')][_0x9b0f('0xd2')];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0xe190ea[_0x9b0f('0x81')]}});}break;case _0x9b0f('0x90'):if(_0x1d98b6['body']['messageId']&&_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')]){_0x18d96e=_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x81')]}});}break;case'bandwidth':if(_0x1d98b6[_0x9b0f('0x5b')][0x0][_0x9b0f('0x27')]['id']){_0x18d96e=_0x1d98b6[_0x9b0f('0x5b')][0x0][_0x9b0f('0x42')];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6[_0x9b0f('0x5b')][0x0][_0x9b0f('0x27')]['id']}});}break;case'intelepeer':if(_0x1d98b6['body'][_0x9b0f('0xd4')]&&_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')]){_0x18d96e=_0x1d98b6[_0x9b0f('0x5b')][_0x9b0f('0x2a')];return db[_0x9b0f('0xa7')][_0x9b0f('0x59')]({'where':{'messageId':_0x1d98b6[_0x9b0f('0x5b')]['redif']}});}break;}}})[_0x9b0f('0x37')](handleEntityNotFound(_0x43b8be,null))[_0x9b0f('0x37')](function(_0x8b1440){if(_0x8b1440){_0x50089a=_0x8b1440;switch(_0x32b513['type']){case'skebby':if(_0x18d96e===_0x9b0f('0xd3')){return _0x50089a[_0x9b0f('0x36')]({'read':!![]});}else{logger['error'](_0x9b0f('0x24'),_0x9b0f('0x2a'),'skebby',util[_0x9b0f('0xce')](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9b0f('0x87'):if(_0x18d96e==='1'){return _0x50089a[_0x9b0f('0x36')]({'read':!![]});}else{logger[_0x9b0f('0x25')](_0x9b0f('0x24'),_0x9b0f('0x2a'),'skebby',util[_0x9b0f('0xce')](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1d98b6['body']['error_code']&&_0x18d96e>=0xc8&&_0x18d96e<=0xce){return _0x50089a[_0x9b0f('0x36')]({'read':!![]});}else{logger[_0x9b0f('0x25')](_0x9b0f('0x24'),_0x9b0f('0x2a'),_0x9b0f('0x88'),util['inspect'](_0x1d98b6['body'],{'showHidden':![],'depth':null}));}break;case _0x9b0f('0x8b'):var _0x38c536=_0x1d98b6[_0x9b0f('0x5b')]['results'][0x0];if(_0x38c536[_0x9b0f('0x2a')][_0x9b0f('0xd2')]==='DELIVERED'){return _0x50089a[_0x9b0f('0x36')]({'read':!![]});}else{logger[_0x9b0f('0x25')](_0x9b0f('0x24'),'status',_0x9b0f('0x8b'),util[_0x9b0f('0xce')](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9b0f('0x90'):if(_0x18d96e=='DELIVERED_TO_GATEWAY'||_0x18d96e==_0x9b0f('0xd5')){return _0x50089a['update']({'read':!![]});}else{logger['error'](_0x9b0f('0x24'),_0x9b0f('0x2a'),_0x9b0f('0x90'),util['inspect'](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9b0f('0x92'):if(_0x18d96e=='message-delivered'){return _0x50089a['update']({'read':!![]});}else{logger['error'](_0x9b0f('0x24'),_0x9b0f('0x2a'),_0x9b0f('0x92'),util['inspect'](_0x1d98b6[_0x9b0f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9b0f('0xd6'):if(_0x18d96e===_0x9b0f('0xd7')||_0x18d96e===_0x9b0f('0xd8')){return _0x50089a['update']({'read':!![]});}else{logger[_0x9b0f('0x25')](_0x9b0f('0x24'),_0x9b0f('0x2a'),_0x9b0f('0xd6'),util[_0x9b0f('0xce')](_0x1d98b6['body'],{'showHidden':![],'depth':null}));}break;}return _0x50089a;}})[_0x9b0f('0x37')](respondWithResult(_0x43b8be,null))[_0x9b0f('0x29')](handleError(_0x43b8be,null));};exports['statusGet']=function(_0x2f06e1,_0x274918,_0x14e2bf){var _0x25afbc,_0xec71d3,_0x4da7c2;return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x2f06e1[_0x9b0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x274918,null))['then'](function(_0x1ae770){if(_0x1ae770){_0x4da7c2=_0x1ae770;logger[_0x9b0f('0x23')](_0x9b0f('0x24'),'status','received\x20delivery\x20report\x20from',_0x1ae770['type'],util[_0x9b0f('0xce')](_0x2f06e1[_0x9b0f('0x45')],{'showHidden':![],'depth':null}));switch(_0x1ae770[_0x9b0f('0x42')]){case _0x9b0f('0x8d'):if(_0x2f06e1[_0x9b0f('0x45')][_0x9b0f('0xd9')]&&_0x2f06e1[_0x9b0f('0x45')][_0x9b0f('0xda')]){_0xec71d3=_0x2f06e1[_0x9b0f('0x45')]['state'];return db['SmsMessage'][_0x9b0f('0x59')]({'where':{'messageId':_0x2f06e1[_0x9b0f('0x45')][_0x9b0f('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x274918,null))[_0x9b0f('0x37')](function(_0x1c6a96){if(_0x1c6a96){_0x25afbc=_0x1c6a96;switch(_0x4da7c2['type']){case'csc':if(_0xec71d3==='2'||_0xec71d3==='6'){return _0x25afbc[_0x9b0f('0x36')]({'read':!![]});}else{logger['error'](_0x9b0f('0x24'),_0x9b0f('0x2a'),'csc',util[_0x9b0f('0xce')](_0x2f06e1['query'],{'showHidden':![],'depth':null}));};break;}return _0x25afbc;}})[_0x9b0f('0x37')](respondWithResult(_0x274918,null))['catch'](handleError(_0x274918,null));};exports[_0x9b0f('0xdb')]=function(_0x28ccce,_0x4cd520,_0x30813b){return db['SmsAccount'][_0x9b0f('0x59')]({'where':{'id':_0x28ccce[_0x9b0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cd520,null))[_0x9b0f('0x37')](function(_0x152556){if(_0x152556){return _0x152556[_0x9b0f('0xdb')](_0x28ccce[_0x9b0f('0x5b')][_0x9b0f('0x6c')],_[_0x9b0f('0x9c')](_0x28ccce[_0x9b0f('0x5b')],[_0x9b0f('0x6c'),'id'])||{})[_0x9b0f('0xa1')](function(_0x29a6be){for(var _0x39a99b=0x0;_0x39a99b<_0x28ccce[_0x9b0f('0x5b')][_0x9b0f('0x6c')][_0x9b0f('0x49')];_0x39a99b+=0x1){socket['emit'](_0x9b0f('0xdc'),{'UserId':Number(_0x28ccce[_0x9b0f('0x5b')][_0x9b0f('0x6c')][_0x39a99b]),'SmsAccountId':Number(_0x28ccce[_0x9b0f('0x54')]['id'])});}return _0x29a6be;});}})[_0x9b0f('0x37')](respondWithResult(_0x4cd520,null))[_0x9b0f('0x29')](handleError(_0x4cd520,null));};exports[_0x9b0f('0xdd')]=function(_0x279e73,_0x2af49d,_0x5eba2b){return db[_0x9b0f('0x40')][_0x9b0f('0x59')]({'where':{'id':_0x279e73[_0x9b0f('0x54')]['id']}})['then'](handleEntityNotFound(_0x2af49d,null))[_0x9b0f('0x37')](function(_0x14ed1e){if(_0x14ed1e){return _0x14ed1e[_0x9b0f('0xdd')](_0x279e73[_0x9b0f('0x45')]['ids'])[_0x9b0f('0x37')](function(){if(_[_0x9b0f('0xde')](_0x279e73[_0x9b0f('0x45')][_0x9b0f('0x6c')])){for(var _0x50155d=0x0;_0x50155d<_0x279e73[_0x9b0f('0x45')][_0x9b0f('0x6c')][_0x9b0f('0x49')];_0x50155d+=0x1){socket[_0x9b0f('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x279e73[_0x9b0f('0x45')][_0x9b0f('0x6c')][_0x50155d]),'SmsAccountId':Number(_0x279e73[_0x9b0f('0x54')]['id'])});}}else{socket[_0x9b0f('0xdf')](_0x9b0f('0xe0'),{'UserId':Number(_0x279e73[_0x9b0f('0x45')][_0x9b0f('0x6c')]),'SmsAccountId':Number(_0x279e73[_0x9b0f('0x54')]['id'])});}});}})[_0x9b0f('0x37')](respondWithStatusCode(_0x2af49d,null))[_0x9b0f('0x29')](handleError(_0x2af49d,null));};exports[_0x9b0f('0xe1')]=function(_0xb1005,_0x2724e4,_0x486d4d){var _0x85df83={};var _0x2297a4={};var _0x337b62;var _0xd348de;return db[_0x9b0f('0x40')][_0x9b0f('0x67')]({'where':{'id':_0xb1005['params']['id']}})[_0x9b0f('0x37')](handleEntityNotFound(_0x2724e4,null))[_0x9b0f('0x37')](function(_0x3f6c72){if(_0x3f6c72){_0x337b62=_0x3f6c72;_0x2297a4[_0x9b0f('0x44')]=_[_0x9b0f('0x55')](db['User'][_0x9b0f('0x41')]);_0x2297a4[_0x9b0f('0x45')]=_[_0x9b0f('0x55')](_0xb1005['query']);_0x2297a4[_0x9b0f('0x46')]=_[_0x9b0f('0x56')](_0x2297a4[_0x9b0f('0x44')],_0x2297a4[_0x9b0f('0x45')]);_0x85df83['attributes']=_[_0x9b0f('0x56')](_0x2297a4[_0x9b0f('0x44')],qs[_0x9b0f('0x48')](_0xb1005['query'][_0x9b0f('0x48')]));_0x85df83['attributes']=_0x85df83[_0x9b0f('0x47')]['length']?_0x85df83['attributes']:_0x2297a4[_0x9b0f('0x44')];_0x85df83[_0x9b0f('0x4c')]=qs[_0x9b0f('0x68')](_0xb1005[_0x9b0f('0x45')]['sort']);_0x85df83[_0x9b0f('0x4d')]=qs[_0x9b0f('0x46')](_[_0x9b0f('0x4e')](_0xb1005['query'],_0x2297a4[_0x9b0f('0x46')]));if(_0xb1005[_0x9b0f('0x45')][_0x9b0f('0x4f')]){_0x85df83[_0x9b0f('0x4d')]=_[_0x9b0f('0x50')](_0x85df83[_0x9b0f('0x4d')],{'$or':_[_0x9b0f('0x3f')](_0x85df83['attributes'],function(_0x386c15){var _0x2b5c0a={};_0x2b5c0a[_0x386c15]={'$like':'%'+_0xb1005[_0x9b0f('0x45')][_0x9b0f('0x4f')]+'%'};return _0x2b5c0a;})});}_0x85df83=_[_0x9b0f('0x50')]({},_0x85df83,_0xb1005[_0x9b0f('0x58')]);return _0x337b62[_0x9b0f('0xe1')](_0x85df83);}})[_0x9b0f('0x37')](function(_0x101120){if(_0x101120){_0xd348de=_0x101120[_0x9b0f('0x49')];if(!_0xb1005['query'][_0x9b0f('0x4a')]('nolimit')){_0x85df83['limit']=qs['limit'](_0xb1005[_0x9b0f('0x45')][_0x9b0f('0x30')]);_0x85df83[_0x9b0f('0x2d')]=qs['offset'](_0xb1005['query'][_0x9b0f('0x2d')]);}return _0x337b62[_0x9b0f('0xe1')](_0x85df83);}})['then'](function(_0x577415){if(_0x577415){return _0x577415?{'count':_0xd348de,'rows':_0x577415}:null;}})[_0x9b0f('0x37')](respondWithResult(_0x2724e4,null))['catch'](handleError(_0x2724e4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e06d876..05a982e 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 _0xf51e=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5ad133,_0x38c8f0){var _0x50434c=function(_0x29f974){while(--_0x29f974){_0x5ad133['push'](_0x5ad133['shift']());}};_0x50434c(++_0x38c8f0);}(_0xf51e,0x1a1));var _0xef51=function(_0x25e890,_0xd87094){_0x25e890=_0x25e890-0x0;var _0x12aa6a=_0xf51e[_0x25e890];return _0x12aa6a;};'use strict';var EventEmitter=require(_0xef51('0x0'));var SmsAccount=require(_0xef51('0x1'))['db'][_0xef51('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xef51('0x3')](0x0);var events={'afterCreate':_0xef51('0x4'),'afterUpdate':_0xef51('0x5'),'afterDestroy':_0xef51('0x6')};function emitEvent(_0x3f1bf9){return function(_0x12efa7,_0x32c591,_0x1d6391){SmsAccountEvents[_0xef51('0x7')](_0x3f1bf9+':'+_0x12efa7['id'],_0x12efa7);SmsAccountEvents[_0xef51('0x7')](_0x3f1bf9,_0x12efa7);_0x1d6391(null);};}for(var e in events){if(events[_0xef51('0x8')](e)){var event=events[e];SmsAccount[_0xef51('0x9')](e,emitEvent(event));}}module[_0xef51('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x105a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','save','update'];(function(_0x33775b,_0x14be5b){var _0x5e6bbe=function(_0x22d533){while(--_0x22d533){_0x33775b['push'](_0x33775b['shift']());}};_0x5e6bbe(++_0x14be5b);}(_0x105a,0xcb));var _0xa105=function(_0x2d9e3a,_0xe9327a){_0x2d9e3a=_0x2d9e3a-0x0;var _0xe48e4c=_0x105a[_0x2d9e3a];return _0xe48e4c;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xa105('0x0'))['db'][_0xa105('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa105('0x2'),'afterUpdate':_0xa105('0x3'),'afterDestroy':_0xa105('0x4')};function emitEvent(_0x214148){return function(_0x46d832,_0x33223c,_0x376ef2){SmsAccountEvents['emit'](_0x214148+':'+_0x46d832['id'],_0x46d832);SmsAccountEvents[_0xa105('0x5')](_0x214148,_0x46d832);_0x376ef2(null);};}for(var e in events){if(events[_0xa105('0x6')](e)){var event=events[e];SmsAccount[_0xa105('0x7')](e,emitEvent(event));}}module[_0xa105('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 30fb3dc..66d4515 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 _0xfea7=['SmsAccount','sms_accounts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x29b8bd,_0x519f53){var _0x3be4f2=function(_0x728711){while(--_0x728711){_0x29b8bd['push'](_0x29b8bd['shift']());}};_0x3be4f2(++_0x519f53);}(_0xfea7,0x1ce));var _0x7fea=function(_0x368053,_0x2d9f9f){_0x368053=_0x368053-0x0;var _0x5655f6=_0xfea7[_0x368053];return _0x5655f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7fea('0x0'))(_0x7fea('0x1'));var moment=require(_0x7fea('0x2'));var BPromise=require(_0x7fea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fea('0x4'));var rimraf=require(_0x7fea('0x5'));var config=require(_0x7fea('0x6'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x559035,_0x1d617d){return _0x559035[_0x7fea('0x7')](_0x7fea('0x8'),attributes,{'tableName':_0x7fea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ad3=['request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6ad3,0xe5));var _0x36ad=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x6ad3[_0x5bd1a9];return _0x2ba345;};'use strict';var _=require(_0x36ad('0x0'));var util=require('util');var logger=require(_0x36ad('0x1'))(_0x36ad('0x2'));var moment=require(_0x36ad('0x3'));var BPromise=require(_0x36ad('0x4'));var rp=require(_0x36ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36ad('0x6'));var config=require(_0x36ad('0x7'));var attributes=require(_0x36ad('0x8'));module[_0x36ad('0x9')]=function(_0x19e1c4,_0x2ae432){return _0x19e1c4[_0x36ad('0xa')](_0x36ad('0xb'),attributes,{'tableName':_0x36ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 04b326a..765ba1f 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 _0xf481=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','stringify','error','SmsAccount,\x20%s,\x20%s','message','request\x20sent','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x164fdd,_0x571315){var _0x3735ea=function(_0x537bbb){while(--_0x537bbb){_0x164fdd['push'](_0x164fdd['shift']());}};_0x3735ea(++_0x571315);}(_0xf481,0x16c));var _0x1f48=function(_0x41bd0d,_0x283017){_0x41bd0d=_0x41bd0d-0x0;var _0x5a4f5d=_0xf481[_0x41bd0d];return _0x5a4f5d;};'use strict';var _=require(_0x1f48('0x0'));var util=require(_0x1f48('0x1'));var moment=require(_0x1f48('0x2'));var BPromise=require(_0x1f48('0x3'));var rs=require(_0x1f48('0x4'));var fs=require('fs');var Redis=require(_0x1f48('0x5'));var db=require(_0x1f48('0x6'))['db'];var utils=require(_0x1f48('0x7'));var logger=require(_0x1f48('0x8'))(_0x1f48('0x9'));var config=require(_0x1f48('0xa'));var jayson=require(_0x1f48('0xb'));var client=jayson[_0x1f48('0xc')][_0x1f48('0xd')]({'port':0x232a});config[_0x1f48('0xe')]=_[_0x1f48('0xf')](config[_0x1f48('0xe')],{'host':_0x1f48('0x10'),'port':0x18eb});var socket=require(_0x1f48('0x11'))(new Redis(config[_0x1f48('0xe')]));require('./smsAccount.socket')[_0x1f48('0x12')](socket);function respondWithRpcPromise(_0x44b6be,_0x5b9367,_0x3360e4){return new BPromise(function(_0x29f3d7,_0x5a57b1){return client[_0x1f48('0x13')](_0x44b6be,_0x3360e4)['then'](function(_0x164209){logger[_0x1f48('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5b9367,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b9367,'request\x20sent',JSON[_0x1f48('0x15')](_0x164209));if(_0x164209['error']){if(_0x164209[_0x1f48('0x16')]['code']===0x1f4){logger['error'](_0x1f48('0x17'),_0x5b9367,_0x164209['error'][_0x1f48('0x18')]);return _0x5a57b1(_0x164209['error'][_0x1f48('0x18')]);}logger[_0x1f48('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5b9367,_0x164209[_0x1f48('0x16')][_0x1f48('0x18')]);return _0x29f3d7(_0x164209[_0x1f48('0x16')][_0x1f48('0x18')]);}else{logger[_0x1f48('0x14')](_0x1f48('0x17'),_0x5b9367,_0x1f48('0x19'));_0x29f3d7(_0x164209['result'][_0x1f48('0x18')]);}})[_0x1f48('0x1a')](function(_0x37474f){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b9367,_0x37474f);_0x5a57b1(_0x37474f);});});}exports[_0x1f48('0x1b')]=function(_0x401477){var _0x5c8e4b=this;return new Promise(function(_0x34b454,_0x1d4f6a){return db[_0x1f48('0x1c')]['find']({'raw':_0x401477[_0x1f48('0x1d')]?_0x401477[_0x1f48('0x1d')][_0x1f48('0x1e')]===undefined?!![]:![]:!![],'where':_0x401477['options']?_0x401477[_0x1f48('0x1d')]['where']||null:null,'attributes':_0x401477[_0x1f48('0x1d')]?_0x401477[_0x1f48('0x1d')][_0x1f48('0x1f')]||null:null,'include':_0x401477[_0x1f48('0x1d')]?_0x401477['options'][_0x1f48('0x20')]?_[_0x1f48('0x21')](_0x401477[_0x1f48('0x1d')][_0x1f48('0x20')],function(_0x1a8527){return{'model':db[_0x1a8527[_0x1f48('0x22')]],'as':_0x1a8527['as'],'attributes':_0x1a8527['attributes'],'include':_0x1a8527[_0x1f48('0x20')]?_[_0x1f48('0x21')](_0x1a8527[_0x1f48('0x20')],function(_0x365fe3){return{'model':db[_0x365fe3[_0x1f48('0x22')]],'as':_0x365fe3['as'],'attributes':_0x365fe3[_0x1f48('0x1f')],'include':_0x365fe3[_0x1f48('0x20')]?_[_0x1f48('0x21')](_0x365fe3[_0x1f48('0x20')],function(_0x7b972e){return{'model':db[_0x7b972e[_0x1f48('0x22')]],'as':_0x7b972e['as'],'attributes':_0x7b972e[_0x1f48('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1f48('0x23')](function(_0x2f030d){logger[_0x1f48('0x14')]('ShowSmsAccount',_0x401477);logger[_0x1f48('0x24')]('ShowSmsAccount',_0x401477,JSON[_0x1f48('0x15')](_0x2f030d));_0x34b454(_0x2f030d);})[_0x1f48('0x1a')](function(_0x318ec2){logger[_0x1f48('0x16')](_0x1f48('0x1b'),_0x318ec2[_0x1f48('0x18')],_0x401477);_0x1d4f6a(_0x5c8e4b['error'](0x1f4,_0x318ec2[_0x1f48('0x18')]));});});}; \ No newline at end of file +var _0xa801=['http','defaults','redis','localhost','socket.io-emitter','then','info','request\x20sent','debug','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','find','options','raw','where','include','map','model','attributes','ShowSmsAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa801,0xa1));var _0x1a80=function(_0x1f9b5b,_0x25e7a0){_0x1f9b5b=_0x1f9b5b-0x0;var _0x585571=_0xa801[_0x1f9b5b];return _0x585571;};'use strict';var _=require(_0x1a80('0x0'));var util=require(_0x1a80('0x1'));var moment=require(_0x1a80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a80('0x3'));var db=require(_0x1a80('0x4'))['db'];var utils=require(_0x1a80('0x5'));var logger=require(_0x1a80('0x6'))(_0x1a80('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a80('0x8'));var client=jayson['client'][_0x1a80('0x9')]({'port':0x232a});config['redis']=_[_0x1a80('0xa')](config[_0x1a80('0xb')],{'host':_0x1a80('0xc'),'port':0x18eb});var socket=require(_0x1a80('0xd'))(new Redis(config[_0x1a80('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x44c342,_0x5ecde0,_0x2d2c24){return new BPromise(function(_0x556f36,_0x43ec07){return client['request'](_0x44c342,_0x2d2c24)[_0x1a80('0xe')](function(_0x1a59b9){logger[_0x1a80('0xf')]('SmsAccount,\x20%s,\x20%s',_0x5ecde0,_0x1a80('0x10'));logger[_0x1a80('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5ecde0,_0x1a80('0x10'),JSON[_0x1a80('0x12')](_0x1a59b9));if(_0x1a59b9[_0x1a80('0x13')]){if(_0x1a59b9[_0x1a80('0x13')][_0x1a80('0x14')]===0x1f4){logger[_0x1a80('0x13')]('SmsAccount,\x20%s,\x20%s',_0x5ecde0,_0x1a59b9[_0x1a80('0x13')][_0x1a80('0x15')]);return _0x43ec07(_0x1a59b9[_0x1a80('0x13')][_0x1a80('0x15')]);}logger['error'](_0x1a80('0x16'),_0x5ecde0,_0x1a59b9[_0x1a80('0x13')]['message']);return _0x556f36(_0x1a59b9[_0x1a80('0x13')]['message']);}else{logger[_0x1a80('0xf')](_0x1a80('0x16'),_0x5ecde0,_0x1a80('0x10'));_0x556f36(_0x1a59b9[_0x1a80('0x17')][_0x1a80('0x15')]);}})[_0x1a80('0x18')](function(_0x4968fc){logger[_0x1a80('0x13')](_0x1a80('0x16'),_0x5ecde0,_0x4968fc);_0x43ec07(_0x4968fc);});});}exports['ShowSmsAccount']=function(_0xae6931){var _0x4d5adb=this;return new Promise(function(_0x3c8cb8,_0x3c006b){return db['SmsAccount'][_0x1a80('0x19')]({'raw':_0xae6931[_0x1a80('0x1a')]?_0xae6931[_0x1a80('0x1a')][_0x1a80('0x1b')]===undefined?!![]:![]:!![],'where':_0xae6931[_0x1a80('0x1a')]?_0xae6931[_0x1a80('0x1a')][_0x1a80('0x1c')]||null:null,'attributes':_0xae6931[_0x1a80('0x1a')]?_0xae6931[_0x1a80('0x1a')]['attributes']||null:null,'include':_0xae6931[_0x1a80('0x1a')]?_0xae6931[_0x1a80('0x1a')][_0x1a80('0x1d')]?_[_0x1a80('0x1e')](_0xae6931[_0x1a80('0x1a')][_0x1a80('0x1d')],function(_0x34c9b2){return{'model':db[_0x34c9b2[_0x1a80('0x1f')]],'as':_0x34c9b2['as'],'attributes':_0x34c9b2[_0x1a80('0x20')],'include':_0x34c9b2['include']?_[_0x1a80('0x1e')](_0x34c9b2[_0x1a80('0x1d')],function(_0x51b647){return{'model':db[_0x51b647[_0x1a80('0x1f')]],'as':_0x51b647['as'],'attributes':_0x51b647[_0x1a80('0x20')],'include':_0x51b647['include']?_[_0x1a80('0x1e')](_0x51b647['include'],function(_0x24d2eb){return{'model':db[_0x24d2eb['model']],'as':_0x24d2eb['as'],'attributes':_0x24d2eb[_0x1a80('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1a80('0xe')](function(_0x5e1855){logger[_0x1a80('0xf')](_0x1a80('0x21'),_0xae6931);logger[_0x1a80('0x11')](_0x1a80('0x21'),_0xae6931,JSON[_0x1a80('0x12')](_0x5e1855));_0x3c8cb8(_0x5e1855);})[_0x1a80('0x18')](function(_0x58f330){logger['error'](_0x1a80('0x21'),_0x58f330['message'],_0xae6931);_0x3c006b(_0x4d5adb['error'](0x1f4,_0x58f330[_0x1a80('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 009cb91..3a614fa 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 275282b..41e407b 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(_0xe595d5,_0xa8f630){var _0xc7281f=function(_0x39122b){while(--_0x39122b){_0xe595d5['push'](_0xe595d5['shift']());}};_0xc7281f(++_0xa8f630);}(_0xedd9,0xfc));var _0x9edd=function(_0x55f2c0,_0x3aadc1){_0x55f2c0=_0x55f2c0-0x0;var _0x268145=_0xedd9[_0x55f2c0];return _0x268145;};'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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x26797a,_0x104240){var _0xeb5295=function(_0x238784){while(--_0x238784){_0x26797a['push'](_0x26797a['shift']());}};_0xeb5295(++_0x104240);}(_0x3e74,0x175));var _0x43e7=function(_0x11a93d,_0x47f2ad){_0x11a93d=_0x11a93d-0x0;var _0x4ec59b=_0x3e74[_0x11a93d];return _0x4ec59b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('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 4fd9266..e3df6e6 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 _0x6f7b=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x16f2d1,_0x1a044b){var _0x586123=function(_0x1e9d56){while(--_0x1e9d56){_0x16f2d1['push'](_0x16f2d1['shift']());}};_0x586123(++_0x1a044b);}(_0x6f7b,0xbf));var _0xb6f7=function(_0x4d3e23,_0x4d0489){_0x4d3e23=_0x4d3e23-0x0;var _0x320c46=_0x6f7b[_0x4d3e23];return _0x320c46;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb6f7('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb6f7('0x1')],'allowNull':![],'defaultValue':_0xb6f7('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb6f7('0x3')}}; \ No newline at end of file +var _0xf04d=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5e02fd,_0x9f186e){var _0x543f4f=function(_0x17f9c4){while(--_0x17f9c4){_0x5e02fd['push'](_0x5e02fd['shift']());}};_0x543f4f(++_0x9f186e);}(_0xf04d,0x1e6));var _0xdf04=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xf04d[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require(_0xdf04('0x0'));module[_0xdf04('0x1')]={'priority':{'type':Sequelize[_0xdf04('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdf04('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdf04('0x3')]},'interval':{'type':Sequelize[_0xdf04('0x3')],'defaultValue':_0xdf04('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f2c6b6c..6324f7b 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 _0xe2a2=['desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xe2a2,0x82));var _0x2e2a=function(_0x3d7b4b,_0x2790b7){_0x3d7b4b=_0x3d7b4b-0x0;var _0x1a4989=_0xe2a2[_0x3d7b4b];return _0x1a4989;};'use strict';var emlformat=require(_0x2e2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e2a('0x1'));var jsonpatch=require(_0x2e2a('0x2'));var rp=require(_0x2e2a('0x3'));var moment=require(_0x2e2a('0x4'));var BPromise=require(_0x2e2a('0x5'));var Mustache=require(_0x2e2a('0x6'));var util=require(_0x2e2a('0x7'));var path=require(_0x2e2a('0x8'));var sox=require('sox');var csv=require(_0x2e2a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e2a('0xa'));var _=require(_0x2e2a('0xb'));var squel=require('squel');var crypto=require(_0x2e2a('0xc'));var jsforce=require(_0x2e2a('0xd'));var deskjs=require(_0x2e2a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e2a('0xf'));var Redis=require(_0x2e2a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e2a('0x11'));var hardwareService=require(_0x2e2a('0x12'));var logger=require('../../config/logger')(_0x2e2a('0x13'));var utils=require('../../config/utils');var config=require(_0x2e2a('0x14'));var licenseUtil=require(_0x2e2a('0x15'));var db=require(_0x2e2a('0x16'))['db'];function respondWithStatusCode(_0x3f4a2c,_0x59b107){_0x59b107=_0x59b107||0xcc;return function(_0x27b912){if(_0x27b912){return _0x3f4a2c[_0x2e2a('0x17')](_0x59b107);}return _0x3f4a2c[_0x2e2a('0x18')](_0x59b107)[_0x2e2a('0x19')]();};}function respondWithResult(_0x53aa8c,_0x282800){_0x282800=_0x282800||0xc8;return function(_0x5eb382){if(_0x5eb382){return _0x53aa8c['status'](_0x282800)[_0x2e2a('0x1a')](_0x5eb382);}};}function respondWithFilteredResult(_0xeebb1b,_0x142623){return function(_0x314758){if(_0x314758){var _0x5f15af=typeof _0x142623[_0x2e2a('0x1b')]===_0x2e2a('0x1c')&&typeof _0x142623[_0x2e2a('0x1d')]==='undefined';var _0x540747=_0x314758['count'];var _0x46dcac=_0x5f15af?0x0:_0x142623[_0x2e2a('0x1b')];var _0x4c8ad4=_0x5f15af?_0x314758['count']:_0x142623['offset']+_0x142623[_0x2e2a('0x1d')];var _0x26e186;if(_0x4c8ad4>=_0x540747){_0x4c8ad4=_0x540747;_0x26e186=0xc8;}else{_0x26e186=0xce;}_0xeebb1b['status'](_0x26e186);return _0xeebb1b[_0x2e2a('0x1e')](_0x2e2a('0x1f'),_0x46dcac+'-'+_0x4c8ad4+'/'+_0x540747)[_0x2e2a('0x1a')](_0x314758);}return null;};}function patchUpdates(_0x12328b){return function(_0x35bbbc){try{jsonpatch[_0x2e2a('0x20')](_0x35bbbc,_0x12328b,!![]);}catch(_0x5a0d50){return BPromise[_0x2e2a('0x21')](_0x5a0d50);}return _0x35bbbc[_0x2e2a('0x22')]();};}function saveUpdates(_0x393f9d,_0x3e0291){return function(_0x116133){if(_0x116133){return _0x116133['update'](_0x393f9d)[_0x2e2a('0x23')](function(_0x5a0896){return _0x5a0896;});}return null;};}function removeEntity(_0x1b8963,_0x558636){return function(_0x14bb1f){if(_0x14bb1f){return _0x14bb1f['destroy']()[_0x2e2a('0x23')](function(){_0x1b8963[_0x2e2a('0x18')](0xcc)[_0x2e2a('0x19')]();});}};}function handleEntityNotFound(_0x1557ea,_0x531bc6){return function(_0x5492bc){if(!_0x5492bc){_0x1557ea['sendStatus'](0x194);}return _0x5492bc;};}function handleError(_0x540ddc,_0x540e0d){_0x540e0d=_0x540e0d||0x1f4;return function(_0x5e969a){logger['error'](_0x5e969a[_0x2e2a('0x24')]);if(_0x5e969a[_0x2e2a('0x25')]){delete _0x5e969a[_0x2e2a('0x25')];}_0x540ddc[_0x2e2a('0x18')](_0x540e0d)[_0x2e2a('0x26')](_0x5e969a);};}exports[_0x2e2a('0x27')]=function(_0x31cf5c,_0x4cc4d8){var _0x4b9e55={},_0x59ca7d={},_0x5e2669={'count':0x0,'rows':[]};var _0x5d68b1=_['map'](db[_0x2e2a('0x28')][_0x2e2a('0x29')],function(_0x15e12b){return{'name':_0x15e12b[_0x2e2a('0x2a')],'type':_0x15e12b[_0x2e2a('0x2b')][_0x2e2a('0x2c')]};});_0x59ca7d[_0x2e2a('0x2d')]=_[_0x2e2a('0x2e')](_0x5d68b1,_0x2e2a('0x25'));_0x59ca7d[_0x2e2a('0x2f')]=_[_0x2e2a('0x30')](_0x31cf5c[_0x2e2a('0x2f')]);_0x59ca7d[_0x2e2a('0x31')]=_[_0x2e2a('0x32')](_0x59ca7d[_0x2e2a('0x2d')],_0x59ca7d[_0x2e2a('0x2f')]);_0x4b9e55[_0x2e2a('0x33')]=_['intersection'](_0x59ca7d[_0x2e2a('0x2d')],qs[_0x2e2a('0x34')](_0x31cf5c['query']['fields']));_0x4b9e55[_0x2e2a('0x33')]=_0x4b9e55[_0x2e2a('0x33')]['length']?_0x4b9e55[_0x2e2a('0x33')]:_0x59ca7d['model'];if(!_0x31cf5c[_0x2e2a('0x2f')][_0x2e2a('0x35')](_0x2e2a('0x36'))){_0x4b9e55['limit']=qs[_0x2e2a('0x1d')](_0x31cf5c[_0x2e2a('0x2f')][_0x2e2a('0x1d')]);_0x4b9e55[_0x2e2a('0x1b')]=qs[_0x2e2a('0x1b')](_0x31cf5c['query'][_0x2e2a('0x1b')]);}_0x4b9e55['order']=qs['sort'](_0x31cf5c[_0x2e2a('0x2f')][_0x2e2a('0x37')]);_0x4b9e55[_0x2e2a('0x38')]=qs['filters'](_[_0x2e2a('0x39')](_0x31cf5c['query'],_0x59ca7d['filters']),_0x5d68b1);if(_0x31cf5c[_0x2e2a('0x2f')]['filter']){_0x4b9e55[_0x2e2a('0x38')]=_[_0x2e2a('0x3a')](_0x4b9e55[_0x2e2a('0x38')],{'$or':_[_0x2e2a('0x2e')](_0x5d68b1,function(_0x3649bd){if(_0x3649bd[_0x2e2a('0x2b')]!==_0x2e2a('0x3b')){var _0x396926={};_0x396926[_0x3649bd[_0x2e2a('0x25')]]={'$like':'%'+_0x31cf5c[_0x2e2a('0x2f')]['filter']+'%'};return _0x396926;}})});}_0x4b9e55=_[_0x2e2a('0x3a')]({},_0x4b9e55,_0x31cf5c[_0x2e2a('0x3c')]);var _0x443a97={'where':_0x4b9e55[_0x2e2a('0x38')]};return db[_0x2e2a('0x28')][_0x2e2a('0x3d')](_0x443a97)[_0x2e2a('0x23')](function(_0x2db42b){_0x5e2669['count']=_0x2db42b;if(_0x31cf5c['query'][_0x2e2a('0x3e')]){_0x4b9e55[_0x2e2a('0x3f')]=[{'all':!![]}];}return db[_0x2e2a('0x28')]['findAll'](_0x4b9e55);})[_0x2e2a('0x23')](function(_0x1314cd){_0x5e2669['rows']=_0x1314cd;return _0x5e2669;})['then'](respondWithFilteredResult(_0x4cc4d8,_0x4b9e55))[_0x2e2a('0x40')](handleError(_0x4cc4d8,null));};exports[_0x2e2a('0x41')]=function(_0x1633a2,_0x778aa){var _0x25351b={'raw':!![],'where':{'id':_0x1633a2[_0x2e2a('0x42')]['id']}},_0x3dbd0a={};_0x3dbd0a['model']=_['keys'](db[_0x2e2a('0x28')]['rawAttributes']);_0x3dbd0a[_0x2e2a('0x2f')]=_[_0x2e2a('0x30')](_0x1633a2[_0x2e2a('0x2f')]);_0x3dbd0a[_0x2e2a('0x31')]=_[_0x2e2a('0x32')](_0x3dbd0a[_0x2e2a('0x2d')],_0x3dbd0a[_0x2e2a('0x2f')]);_0x25351b['attributes']=_['intersection'](_0x3dbd0a[_0x2e2a('0x2d')],qs[_0x2e2a('0x34')](_0x1633a2['query']['fields']));_0x25351b[_0x2e2a('0x33')]=_0x25351b[_0x2e2a('0x33')][_0x2e2a('0x43')]?_0x25351b['attributes']:_0x3dbd0a[_0x2e2a('0x2d')];if(_0x1633a2[_0x2e2a('0x2f')][_0x2e2a('0x3e')]){_0x25351b[_0x2e2a('0x3f')]=[{'all':!![]}];}_0x25351b=_['merge']({},_0x25351b,_0x1633a2[_0x2e2a('0x3c')]);return db[_0x2e2a('0x28')][_0x2e2a('0x44')](_0x25351b)[_0x2e2a('0x23')](handleEntityNotFound(_0x778aa,null))[_0x2e2a('0x23')](respondWithResult(_0x778aa,null))[_0x2e2a('0x40')](handleError(_0x778aa,null));};exports[_0x2e2a('0x45')]=function(_0xf341b1,_0x594407){return db[_0x2e2a('0x28')]['create'](_0xf341b1[_0x2e2a('0x46')],{})[_0x2e2a('0x23')](respondWithResult(_0x594407,0xc9))[_0x2e2a('0x40')](handleError(_0x594407,null));};exports[_0x2e2a('0x47')]=function(_0x338b3c,_0x52980b){if(_0x338b3c[_0x2e2a('0x46')]['id']){delete _0x338b3c[_0x2e2a('0x46')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x338b3c['params']['id']}})[_0x2e2a('0x23')](handleEntityNotFound(_0x52980b,null))[_0x2e2a('0x23')](saveUpdates(_0x338b3c[_0x2e2a('0x46')],null))[_0x2e2a('0x23')](respondWithResult(_0x52980b,null))[_0x2e2a('0x40')](handleError(_0x52980b,null));};exports['destroy']=function(_0x468747,_0x25788e){return db[_0x2e2a('0x28')][_0x2e2a('0x44')]({'where':{'id':_0x468747['params']['id']}})[_0x2e2a('0x23')](handleEntityNotFound(_0x25788e,null))[_0x2e2a('0x23')](removeEntity(_0x25788e,null))[_0x2e2a('0x40')](handleError(_0x25788e,null));}; \ No newline at end of file +var _0x9ed4=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','show','params','rawAttributes','options','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x2579a,_0x513950){var _0x37d37e=function(_0x573b0b){while(--_0x573b0b){_0x2579a['push'](_0x2579a['shift']());}};_0x37d37e(++_0x513950);}(_0x9ed4,0x155));var _0x49ed=function(_0x3c945d,_0x372fbf){_0x3c945d=_0x3c945d-0x0;var _0x53280a=_0x9ed4[_0x3c945d];return _0x53280a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49ed('0x0'));var zipdir=require(_0x49ed('0x1'));var jsonpatch=require(_0x49ed('0x2'));var rp=require(_0x49ed('0x3'));var moment=require(_0x49ed('0x4'));var BPromise=require(_0x49ed('0x5'));var Mustache=require(_0x49ed('0x6'));var util=require(_0x49ed('0x7'));var path=require(_0x49ed('0x8'));var sox=require(_0x49ed('0x9'));var csv=require(_0x49ed('0xa'));var ejs=require(_0x49ed('0xb'));var fs=require('fs');var fs_extra=require(_0x49ed('0xc'));var _=require(_0x49ed('0xd'));var squel=require(_0x49ed('0xe'));var crypto=require(_0x49ed('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x49ed('0x10'));var toCsv=require(_0x49ed('0xa'));var querystring=require(_0x49ed('0x11'));var Papa=require(_0x49ed('0x12'));var Redis=require(_0x49ed('0x13'));var authService=require(_0x49ed('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x49ed('0x15'));var hardwareService=require(_0x49ed('0x16'));var logger=require('../../config/logger')(_0x49ed('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49ed('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe9ec5e,_0x10c532){_0x10c532=_0x10c532||0xcc;return function(_0x20b068){if(_0x20b068){return _0xe9ec5e[_0x49ed('0x19')](_0x10c532);}return _0xe9ec5e[_0x49ed('0x1a')](_0x10c532)[_0x49ed('0x1b')]();};}function respondWithResult(_0x132b4d,_0x5255b3){_0x5255b3=_0x5255b3||0xc8;return function(_0x315cbb){if(_0x315cbb){return _0x132b4d[_0x49ed('0x1a')](_0x5255b3)[_0x49ed('0x1c')](_0x315cbb);}};}function respondWithFilteredResult(_0x3be407,_0x47587a){return function(_0x25cc65){if(_0x25cc65){var _0x323ef4=typeof _0x47587a[_0x49ed('0x1d')]==='undefined'&&typeof _0x47587a[_0x49ed('0x1e')]==='undefined';var _0x116cb7=_0x25cc65[_0x49ed('0x1f')];var _0x12a06e=_0x323ef4?0x0:_0x47587a['offset'];var _0x25f0bb=_0x323ef4?_0x25cc65[_0x49ed('0x1f')]:_0x47587a[_0x49ed('0x1d')]+_0x47587a[_0x49ed('0x1e')];var _0x36613e;if(_0x25f0bb>=_0x116cb7){_0x25f0bb=_0x116cb7;_0x36613e=0xc8;}else{_0x36613e=0xce;}_0x3be407[_0x49ed('0x1a')](_0x36613e);return _0x3be407['set'](_0x49ed('0x20'),_0x12a06e+'-'+_0x25f0bb+'/'+_0x116cb7)[_0x49ed('0x1c')](_0x25cc65);}return null;};}function patchUpdates(_0x44573b){return function(_0x4e0299){try{jsonpatch[_0x49ed('0x21')](_0x4e0299,_0x44573b,!![]);}catch(_0x143bd6){return BPromise['reject'](_0x143bd6);}return _0x4e0299[_0x49ed('0x22')]();};}function saveUpdates(_0x41fa35,_0x2b399f){return function(_0x9d1ec1){if(_0x9d1ec1){return _0x9d1ec1[_0x49ed('0x23')](_0x41fa35)[_0x49ed('0x24')](function(_0x9b104e){return _0x9b104e;});}return null;};}function removeEntity(_0x50a388,_0x21debd){return function(_0x319206){if(_0x319206){return _0x319206[_0x49ed('0x25')]()[_0x49ed('0x24')](function(){_0x50a388[_0x49ed('0x1a')](0xcc)[_0x49ed('0x1b')]();});}};}function handleEntityNotFound(_0x1508ea,_0x9cc390){return function(_0x242166){if(!_0x242166){_0x1508ea[_0x49ed('0x19')](0x194);}return _0x242166;};}function handleError(_0x5b7387,_0x396e34){_0x396e34=_0x396e34||0x1f4;return function(_0x52daa6){logger[_0x49ed('0x26')](_0x52daa6[_0x49ed('0x27')]);if(_0x52daa6[_0x49ed('0x28')]){delete _0x52daa6[_0x49ed('0x28')];}_0x5b7387[_0x49ed('0x1a')](_0x396e34)[_0x49ed('0x29')](_0x52daa6);};}exports[_0x49ed('0x2a')]=function(_0x2c5250,_0x5eb19d){var _0x41d8d3={},_0x27c355={},_0x2850d8={'count':0x0,'rows':[]};var _0x334ed7=_[_0x49ed('0x2b')](db[_0x49ed('0x2c')]['rawAttributes'],function(_0x6829af){return{'name':_0x6829af[_0x49ed('0x2d')],'type':_0x6829af['type'][_0x49ed('0x2e')]};});_0x27c355[_0x49ed('0x2f')]=_[_0x49ed('0x2b')](_0x334ed7,_0x49ed('0x28'));_0x27c355[_0x49ed('0x30')]=_[_0x49ed('0x31')](_0x2c5250['query']);_0x27c355[_0x49ed('0x32')]=_[_0x49ed('0x33')](_0x27c355[_0x49ed('0x2f')],_0x27c355[_0x49ed('0x30')]);_0x41d8d3[_0x49ed('0x34')]=_[_0x49ed('0x33')](_0x27c355[_0x49ed('0x2f')],qs[_0x49ed('0x35')](_0x2c5250['query']['fields']));_0x41d8d3['attributes']=_0x41d8d3[_0x49ed('0x34')][_0x49ed('0x36')]?_0x41d8d3['attributes']:_0x27c355[_0x49ed('0x2f')];if(!_0x2c5250[_0x49ed('0x30')]['hasOwnProperty']('nolimit')){_0x41d8d3[_0x49ed('0x1e')]=qs[_0x49ed('0x1e')](_0x2c5250[_0x49ed('0x30')][_0x49ed('0x1e')]);_0x41d8d3[_0x49ed('0x1d')]=qs['offset'](_0x2c5250[_0x49ed('0x30')][_0x49ed('0x1d')]);}_0x41d8d3['order']=qs[_0x49ed('0x37')](_0x2c5250[_0x49ed('0x30')]['sort']);_0x41d8d3[_0x49ed('0x38')]=qs[_0x49ed('0x32')](_[_0x49ed('0x39')](_0x2c5250[_0x49ed('0x30')],_0x27c355[_0x49ed('0x32')]),_0x334ed7);if(_0x2c5250[_0x49ed('0x30')]['filter']){_0x41d8d3['where']=_[_0x49ed('0x3a')](_0x41d8d3['where'],{'$or':_[_0x49ed('0x2b')](_0x334ed7,function(_0x23a779){if(_0x23a779[_0x49ed('0x3b')]!==_0x49ed('0x3c')){var _0x16ca9a={};_0x16ca9a[_0x23a779[_0x49ed('0x28')]]={'$like':'%'+_0x2c5250[_0x49ed('0x30')][_0x49ed('0x3d')]+'%'};return _0x16ca9a;}})});}_0x41d8d3=_[_0x49ed('0x3a')]({},_0x41d8d3,_0x2c5250['options']);var _0x3e206a={'where':_0x41d8d3[_0x49ed('0x38')]};return db[_0x49ed('0x2c')][_0x49ed('0x1f')](_0x3e206a)['then'](function(_0x4061f8){_0x2850d8[_0x49ed('0x1f')]=_0x4061f8;if(_0x2c5250[_0x49ed('0x30')][_0x49ed('0x3e')]){_0x41d8d3[_0x49ed('0x3f')]=[{'all':!![]}];}return db[_0x49ed('0x2c')][_0x49ed('0x40')](_0x41d8d3);})[_0x49ed('0x24')](function(_0x26998f){_0x2850d8['rows']=_0x26998f;return _0x2850d8;})[_0x49ed('0x24')](respondWithFilteredResult(_0x5eb19d,_0x41d8d3))['catch'](handleError(_0x5eb19d,null));};exports[_0x49ed('0x41')]=function(_0x12e756,_0x5655d9){var _0x2854ea={'raw':!![],'where':{'id':_0x12e756[_0x49ed('0x42')]['id']}},_0x2d26e8={};_0x2d26e8[_0x49ed('0x2f')]=_[_0x49ed('0x31')](db[_0x49ed('0x2c')][_0x49ed('0x43')]);_0x2d26e8[_0x49ed('0x30')]=_[_0x49ed('0x31')](_0x12e756['query']);_0x2d26e8[_0x49ed('0x32')]=_['intersection'](_0x2d26e8[_0x49ed('0x2f')],_0x2d26e8['query']);_0x2854ea['attributes']=_[_0x49ed('0x33')](_0x2d26e8[_0x49ed('0x2f')],qs[_0x49ed('0x35')](_0x12e756['query'][_0x49ed('0x35')]));_0x2854ea[_0x49ed('0x34')]=_0x2854ea['attributes'][_0x49ed('0x36')]?_0x2854ea['attributes']:_0x2d26e8['model'];if(_0x12e756['query'][_0x49ed('0x3e')]){_0x2854ea['include']=[{'all':!![]}];}_0x2854ea=_[_0x49ed('0x3a')]({},_0x2854ea,_0x12e756[_0x49ed('0x44')]);return db['SmsApplication'][_0x49ed('0x45')](_0x2854ea)['then'](handleEntityNotFound(_0x5655d9,null))[_0x49ed('0x24')](respondWithResult(_0x5655d9,null))[_0x49ed('0x46')](handleError(_0x5655d9,null));};exports['create']=function(_0x34ecfa,_0x3e10e6){return db[_0x49ed('0x2c')]['create'](_0x34ecfa['body'],{})[_0x49ed('0x24')](respondWithResult(_0x3e10e6,0xc9))[_0x49ed('0x46')](handleError(_0x3e10e6,null));};exports['update']=function(_0x596723,_0x13d00c){if(_0x596723[_0x49ed('0x47')]['id']){delete _0x596723['body']['id'];}return db[_0x49ed('0x2c')][_0x49ed('0x45')]({'where':{'id':_0x596723[_0x49ed('0x42')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x13d00c,null))[_0x49ed('0x24')](saveUpdates(_0x596723[_0x49ed('0x47')],null))[_0x49ed('0x24')](respondWithResult(_0x13d00c,null))[_0x49ed('0x46')](handleError(_0x13d00c,null));};exports[_0x49ed('0x25')]=function(_0x1cae3d,_0x5b8037){return db[_0x49ed('0x2c')]['find']({'where':{'id':_0x1cae3d[_0x49ed('0x42')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x5b8037,null))[_0x49ed('0x24')](removeEntity(_0x5b8037,null))[_0x49ed('0x46')](handleError(_0x5b8037,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 84ef549..4a2a60f 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 _0xf0f8=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0xf0f8,0xbb));var _0x8f0f=function(_0x59e285,_0x56f21b){_0x59e285=_0x59e285-0x0;var _0x57917e=_0xf0f8[_0x59e285];return _0x57917e;};'use strict';var _=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var logger=require(_0x8f0f('0x2'))(_0x8f0f('0x3'));var moment=require(_0x8f0f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f0f('0x5'));var rimraf=require(_0x8f0f('0x6'));var config=require(_0x8f0f('0x7'));var attributes=require(_0x8f0f('0x8'));module[_0x8f0f('0x9')]=function(_0x179a85,_0x36c7c6){return _0x179a85['define'](_0x8f0f('0xa'),attributes,{'tableName':_0x8f0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f0f('0xc'),'collate':_0x8f0f('0xd')});}; \ No newline at end of file +var _0x3e1f=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x12cd6c,_0x39855b){var _0x508e5f=function(_0x32e31b){while(--_0x32e31b){_0x12cd6c['push'](_0x12cd6c['shift']());}};_0x508e5f(++_0x39855b);}(_0x3e1f,0x18a));var _0xf3e1=function(_0x381bff,_0x19d01f){_0x381bff=_0x381bff-0x0;var _0x201ab1=_0x3e1f[_0x381bff];return _0x201ab1;};'use strict';var _=require('lodash');var util=require(_0xf3e1('0x0'));var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require('moment');var BPromise=require(_0xf3e1('0x3'));var rp=require(_0xf3e1('0x4'));var fs=require('fs');var path=require(_0xf3e1('0x5'));var rimraf=require(_0xf3e1('0x6'));var config=require(_0xf3e1('0x7'));var attributes=require('./smsApplication.attributes');module[_0xf3e1('0x8')]=function(_0x35ddd3,_0x3e1058){return _0x35ddd3[_0xf3e1('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf3e1('0xa'),'collate':_0xf3e1('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2a27a69..5f8fd84 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 _0xd943=['info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x2c0ef8,_0xed3b6b){var _0x3e2d27=function(_0x35ef6e){while(--_0x35ef6e){_0x2c0ef8['push'](_0x2c0ef8['shift']());}};_0x3e2d27(++_0xed3b6b);}(_0xd943,0x15d));var _0x3d94=function(_0x7e690d,_0x168b50){_0x7e690d=_0x7e690d-0x0;var _0x2b9c7f=_0xd943[_0x7e690d];return _0x2b9c7f;};'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});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file +var _0x229c=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','util','randomstring'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x229c,0xcf));var _0xc229=function(_0x21b031,_0x4c63bb){_0x21b031=_0x21b031-0x0;var _0x1e47fb=_0x229c[_0x21b031];return _0x1e47fb;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc229('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc229('0x2'));var logger=require('../../config/logger')(_0xc229('0x3'));var config=require(_0xc229('0x4'));var jayson=require(_0xc229('0x5'));var client=jayson['client'][_0xc229('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52978a,_0x41ede5,_0x14cd26){return new BPromise(function(_0x504d48,_0x3fb59d){return client[_0xc229('0x7')](_0x52978a,_0x14cd26)['then'](function(_0x529822){logger[_0xc229('0x8')]('SmsApplication,\x20%s,\x20%s',_0x41ede5,'request\x20sent');logger[_0xc229('0x9')](_0xc229('0xa'),_0x41ede5,_0xc229('0xb'),JSON[_0xc229('0xc')](_0x529822));if(_0x529822[_0xc229('0xd')]){if(_0x529822[_0xc229('0xd')][_0xc229('0xe')]===0x1f4){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x529822[_0xc229('0xd')][_0xc229('0x10')]);return _0x3fb59d(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}logger['error'](_0xc229('0xf'),_0x41ede5,_0x529822['error'][_0xc229('0x10')]);return _0x504d48(_0x529822[_0xc229('0xd')][_0xc229('0x10')]);}else{logger[_0xc229('0x8')](_0xc229('0xf'),_0x41ede5,_0xc229('0xb'));_0x504d48(_0x529822[_0xc229('0x11')][_0xc229('0x10')]);}})[_0xc229('0x12')](function(_0x3c3b1c){logger[_0xc229('0xd')](_0xc229('0xf'),_0x41ede5,_0x3c3b1c);_0x3fb59d(_0x3c3b1c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index cd1f8a6..3be4eb7 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 _0xb688=['destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb688,0xcf));var _0x8b68=function(_0x2dedfa,_0x42ac98){_0x2dedfa=_0x2dedfa-0x0;var _0x16d8e4=_0xb688[_0x2dedfa];return _0x16d8e4;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x14')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x16')]);router[_0x8b68('0x14')]('/:id/tags',auth[_0x8b68('0xc')](),interaction['tracked']('sms',_0x8b68('0x17')),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x8b68('0x1a')]('sms',_0x8b68('0x1b')),controller[_0x8b68('0x1c')]);router[_0x8b68('0x1d')](_0x8b68('0xe'),auth['isAuthenticated'](),interaction[_0x8b68('0x1a')](_0x8b68('0x1e'),'smsinteraction:destroy'),controller[_0x8b68('0x1f')]);router[_0x8b68('0x1d')](_0x8b68('0x20'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0xae9024,_0x17f58e){var _0x23e7d3=function(_0x5911fb){while(--_0x5911fb){_0xae9024['push'](_0xae9024['shift']());}};_0x23e7d3(++_0x17f58e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x12d75d,_0x209e4b){_0x12d75d=_0x12d75d-0x0;var _0x1f9228=_0xb03e[_0x12d75d];return _0x1f9228;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index b2537fb..fa5ae32 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 _0x8110=['STRING','DATE','ENUM','out','BOOLEAN','moment'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0x8110,0x185));var _0x0811=function(_0x20817f,_0x276d73){_0x20817f=_0x20817f-0x0;var _0x53f1b3=_0x8110[_0x20817f];return _0x53f1b3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0811('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0811('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0811('0x1')]},'note':{'type':Sequelize[_0x0811('0x1')]},'phone':{'type':Sequelize[_0x0811('0x1')]},'read1stAt':{'type':Sequelize[_0x0811('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0811('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0811('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0811('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0811('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x3937=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x3937,0xbf));var _0x7393=function(_0x3e761d,_0x32c4d0){_0x3e761d=_0x3e761d-0x0;var _0x5ecc0b=_0x3937[_0x3e761d];return _0x5ecc0b;};'use strict';var Sequelize=require(_0x7393('0x0'));var moment=require('moment');module[_0x7393('0x1')]={'closed':{'type':Sequelize[_0x7393('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7393('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7393('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7393('0x3')]},'read1stAt':{'type':Sequelize[_0x7393('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7393('0x5')]('in',_0x7393('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7393('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7393('0x5')]('in',_0x7393('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7393('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2534b72..cded1ed 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 _0x9034=['CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','body','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','user','agent','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','catch','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','omit','getMessages','findOne','filters','hasOwnProperty','sort','pick','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','findAll','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','CmContact','firstName','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','fullname','N.A.','disposition','System','lastName','renderFile','views','transcript-','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','forEach','waiting','talking','answered','unmanaged','total','closed','UserId','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag'];(function(_0x1bd5ae,_0x22fa5e){var _0x317cf8=function(_0x27e506){while(--_0x27e506){_0x1bd5ae['push'](_0x1bd5ae['shift']());}};_0x317cf8(++_0x22fa5e);}(_0x9034,0x178));var _0x4903=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9034[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x4903('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4903('0x1'));var jsonpatch=require(_0x4903('0x2'));var rp=require(_0x4903('0x3'));var moment=require(_0x4903('0x4'));var BPromise=require(_0x4903('0x5'));var Mustache=require(_0x4903('0x6'));var util=require(_0x4903('0x7'));var path=require('path');var sox=require(_0x4903('0x8'));var csv=require(_0x4903('0x9'));var ejs=require(_0x4903('0xa'));var fs=require('fs');var fs_extra=require(_0x4903('0xb'));var _=require(_0x4903('0xc'));var squel=require(_0x4903('0xd'));var crypto=require('crypto');var jsforce=require(_0x4903('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4903('0xf'));var Papa=require('papaparse');var Redis=require(_0x4903('0x10'));var authService=require(_0x4903('0x11'));var qs=require(_0x4903('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4903('0x13'));var hardwareService=require(_0x4903('0x14'));var logger=require(_0x4903('0x15'))(_0x4903('0x16'));var utils=require(_0x4903('0x17'));var config=require(_0x4903('0x18'));var licenseUtil=require(_0x4903('0x19'));var db=require(_0x4903('0x1a'))['db'];config['redis']=_['defaults'](config[_0x4903('0x1b')],{'host':_0x4903('0x1c'),'port':0x18eb});var socket=require(_0x4903('0x1d'))(new Redis(config[_0x4903('0x1b')]));require(_0x4903('0x1e'))[_0x4903('0x1f')](socket);function respondWithStatusCode(_0x5df739,_0x54a9dc){_0x54a9dc=_0x54a9dc||0xcc;return function(_0x530f84){if(_0x530f84){return _0x5df739[_0x4903('0x20')](_0x54a9dc);}return _0x5df739[_0x4903('0x21')](_0x54a9dc)[_0x4903('0x22')]();};}function respondWithResult(_0x8bb29c,_0x57ae2c){_0x57ae2c=_0x57ae2c||0xc8;return function(_0x14c053){if(_0x14c053){return _0x8bb29c[_0x4903('0x21')](_0x57ae2c)['json'](_0x14c053);}};}function respondWithFilteredResult(_0x20f2c9,_0x4c4f75){return function(_0x26d48a){if(_0x26d48a){var _0x6a5c07=typeof _0x4c4f75[_0x4903('0x23')]===_0x4903('0x24')&&typeof _0x4c4f75[_0x4903('0x25')]===_0x4903('0x24');var _0x5332ee=_0x26d48a[_0x4903('0x26')];var _0x54b3ff=_0x6a5c07?0x0:_0x4c4f75['offset'];var _0x43e1ea=_0x6a5c07?_0x26d48a[_0x4903('0x26')]:_0x4c4f75[_0x4903('0x23')]+_0x4c4f75['limit'];var _0x5e2ae3;if(_0x43e1ea>=_0x5332ee){_0x43e1ea=_0x5332ee;_0x5e2ae3=0xc8;}else{_0x5e2ae3=0xce;}_0x20f2c9['status'](_0x5e2ae3);return _0x20f2c9['set']('Content-Range',_0x54b3ff+'-'+_0x43e1ea+'/'+_0x5332ee)[_0x4903('0x27')](_0x26d48a);}return null;};}function patchUpdates(_0x67d7ff){return function(_0x5ca8a3){try{jsonpatch[_0x4903('0x28')](_0x5ca8a3,_0x67d7ff,!![]);}catch(_0x5735fc){return BPromise[_0x4903('0x29')](_0x5735fc);}return _0x5ca8a3[_0x4903('0x2a')]();};}function saveUpdates(_0x231e2e,_0x4f5971){return function(_0x553bad){if(_0x553bad){return _0x553bad[_0x4903('0x2b')](_0x231e2e)[_0x4903('0x2c')](function(_0x1ff1fe){return _0x1ff1fe;});}return null;};}function removeEntity(_0x4f9e42,_0x2a7717){return function(_0x182a7f){if(_0x182a7f){return _0x182a7f[_0x4903('0x2d')]()[_0x4903('0x2c')](function(){_0x4f9e42[_0x4903('0x21')](0xcc)[_0x4903('0x22')]();});}};}function handleEntityNotFound(_0x3d3023,_0x16d449){return function(_0x4649b0){if(!_0x4649b0){_0x3d3023['sendStatus'](0x194);}return _0x4649b0;};}function handleError(_0x3cd7dd,_0x195b79){_0x195b79=_0x195b79||0x1f4;return function(_0x25ef2d){logger[_0x4903('0x2e')](_0x25ef2d[_0x4903('0x2f')]);if(_0x25ef2d[_0x4903('0x30')]){delete _0x25ef2d[_0x4903('0x30')];}_0x3cd7dd['status'](_0x195b79)[_0x4903('0x31')](_0x25ef2d);};}function getInteractionUsers(_0xcb05db,_0x4571c6){return new BPromise(function(_0x2afa58,_0xde5ae5){try{if(_0x4571c6[_0xcb05db['id']]){_0xcb05db[_0x4903('0x32')]=_[_0x4903('0x33')](_0x4571c6[_0xcb05db['id']],function(_0x5c90e7){return{'id':_0x5c90e7['id'],'fullname':_0x5c90e7['fullname']};});}}catch(_0x54ebde){_0xde5ae5(_0x54ebde);}_0x2afa58(_0xcb05db);});}function getInteractionTags(_0x7b9034,_0xcf6db3){return new BPromise(function(_0x3aa5f0,_0x3cb30b){try{if(_0x7b9034[_0x4903('0x34')]){_0x7b9034[_0x4903('0x35')]=[];_0x7b9034[_0x4903('0x34')]['split'](',')[_0x4903('0x36')](function(_0x22a269){_0x7b9034[_0x4903('0x35')]['push'](_0xcf6db3[_0x22a269]);});}delete _0x7b9034[_0x4903('0x34')];}catch(_0x5cef3f){_0x3cb30b(_0x5cef3f);}_0x3aa5f0(_0x7b9034);});}function updateSmsInteraction(_0x591a28,_0x4a6bd9,_0x196117){return new BPromise(function(_0x50ccda,_0x443a52){return getInteractionUsers(_0x591a28,_0x196117)['then'](function(_0x4f8f88){return getInteractionTags(_0x4f8f88,_0x4a6bd9);})['then'](function(_0x56deb3){return getStateInteraction(_0x56deb3);})[_0x4903('0x2c')](function(_0x41ee50){_0x50ccda(_0x41ee50);})['catch'](function(_0x157ee2){_0x443a52(_0x157ee2);});});}function getStateInteraction(_0x1e87d8){return new BPromise(function(_0x1c050b){_0x1e87d8[_0x4903('0x37')]=0x0;_0x1e87d8[_0x4903('0x38')]=0x0;_0x1e87d8[_0x4903('0x39')]=0x0;_0x1e87d8[_0x4903('0x3a')]=0x0;_0x1e87d8[_0x4903('0x3b')]=0x0;if(!_0x1e87d8[_0x4903('0x3c')]&&!_0x1e87d8[_0x4903('0x3d')]){_0x1e87d8[_0x4903('0x37')]+=0x1;}if(!_0x1e87d8[_0x4903('0x3c')]&&_0x1e87d8['UserId']){_0x1e87d8['talking']+=0x1;if(_0x1e87d8[_0x4903('0x37')]){_0x1e87d8[_0x4903('0x37')]-=0x1;}}if(_0x1e87d8[_0x4903('0x3c')]&&_0x1e87d8['UserId']){_0x1e87d8['answered']+=0x1;if(_0x1e87d8[_0x4903('0x38')]){_0x1e87d8['talking']-=0x1;}}if(_0x1e87d8[_0x4903('0x3c')]&&!_0x1e87d8[_0x4903('0x3d')]){_0x1e87d8[_0x4903('0x3a')]+=0x1;if(_0x1e87d8[_0x4903('0x37')]){_0x1e87d8[_0x4903('0x37')]-=0x1;}}_0x1e87d8[_0x4903('0x3b')]+=0x1;_0x1c050b(_0x1e87d8);});}exports['index']=function(_0x321eaf,_0x50509e){var _0x4e7ebc={},_0x5c54bd={},_0x33dba2={'count':0x0,'rows':[]};var _0x36cab6=_[_0x4903('0x33')](db[_0x4903('0x3e')][_0x4903('0x3f')],function(_0x33e84d){return{'name':_0x33e84d[_0x4903('0x40')],'type':_0x33e84d[_0x4903('0x41')][_0x4903('0x42')]};});_0x5c54bd[_0x4903('0x43')]=_[_0x4903('0x33')](_0x36cab6,_0x4903('0x30'));_0x5c54bd[_0x4903('0x44')]=_[_0x4903('0x45')](_0x321eaf['query']);_0x5c54bd['filters']=_[_0x4903('0x46')](_0x5c54bd[_0x4903('0x43')],_0x5c54bd[_0x4903('0x44')]);_0x4e7ebc[_0x4903('0x47')]=_[_0x4903('0x46')](_0x5c54bd[_0x4903('0x43')],qs[_0x4903('0x48')](_0x321eaf['query']['fields']));_0x4e7ebc[_0x4903('0x47')]=_0x4e7ebc[_0x4903('0x47')][_0x4903('0x49')]?_0x4e7ebc[_0x4903('0x47')]:_0x5c54bd[_0x4903('0x43')];if(!_0x321eaf[_0x4903('0x44')]['hasOwnProperty'](_0x4903('0x4a'))){_0x4e7ebc[_0x4903('0x25')]=qs[_0x4903('0x25')](_0x321eaf[_0x4903('0x44')][_0x4903('0x25')]);_0x4e7ebc[_0x4903('0x23')]=qs[_0x4903('0x23')](_0x321eaf['query'][_0x4903('0x23')]);}_0x4e7ebc[_0x4903('0x4b')]=qs['sort'](_0x321eaf['query']['sort']);_0x4e7ebc['where']=qs['filters'](_['pick'](_0x321eaf['query'],_0x5c54bd['filters']),_0x36cab6);var _0x216433=[];var _0x48921e=squel['select']()[_0x4903('0x4c')]('id')['field']('name')[_0x4903('0x4c')](_0x4903('0x4d'))[_0x4903('0x4e')](_0x4903('0x4f'));var _0x3fdaa0=squel[_0x4903('0x50')]()[_0x4903('0x4c')](_0x4903('0x51'))[_0x4903('0x4c')](_0x4903('0x52'))[_0x4903('0x4c')](_0x4903('0x53'))[_0x4903('0x4e')](_0x4903('0x54'),'ui')[_0x4903('0x55')]('users','u',_0x4903('0x56'));var _0x4f307a=squel[_0x4903('0x50')]()[_0x4903('0x4e')](_0x4903('0x57'),'i')[_0x4903('0x55')](_0x4903('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4903('0x55')](_0x4903('0x59'),'o',_0x4903('0x5a'))[_0x4903('0x55')](_0x4903('0x5b'),'a','a.id\x20=\x20i.SmsAccountId')[_0x4903('0x55')](_0x4903('0x5c'),'me',_0x4903('0x5d'))[_0x4903('0x55')]('sms_interaction_has_tags','it',_0x4903('0x5e'))['left_join']('tools_tags','t',_0x4903('0x5f'));var _0x40fb2a=squel[_0x4903('0x60')]();var _0x4fd814=[];var _0x58c8a0=squel[_0x4903('0x60')]();var _0x2883f2;if(_0x321eaf[_0x4903('0x44')][_0x4903('0x61')]){_0x2883f2=as['parseSearch'](_0x321eaf[_0x4903('0x44')][_0x4903('0x61')]);var _0x75b37e=_0x2883f2[_0x4903('0x62')];for(var _0xc7f8b4=0x0;_0xc7f8b4<_0x2883f2[_0x4903('0x63')][_0x4903('0x49')];_0xc7f8b4++){var _0x4a8748=_0x2883f2[_0x4903('0x63')][_0xc7f8b4];var _0x4e13cb='i';var _0x8d3261=_[_0x4903('0x64')](_0x36cab6,[_0x4903('0x30'),_0x4a8748[_0x4903('0x4c')]]);if(!_0x8d3261){switch(_0x4a8748[_0x4903('0x4c')]){case'unreadMessages':if(_0x4a8748[_0x4903('0x65')]==0x1){_0x4f307a[_0x4903('0x66')]('`'+_0x4a8748[_0x4903('0x4c')]+_0x4903('0x67'));}else{_0x4f307a[_0x4903('0x66')]('`'+_0x4a8748[_0x4903('0x4c')]+_0x4903('0x68'));}break;case _0x4903('0x69'):if(_0x4a8748[_0x4903('0x6a')]==='$substring'){if(_0x4a8748[_0x4903('0x65')][_0x4903('0x6b')]('\x20')[_0x4903('0x49')]>0x1){_0x40fb2a[_0x75b37e](_0x4903('0x6c'),qs[_0x4903('0x6d')](_0x4a8748[_0x4903('0x65')]),null);}else{var _0x29117f='%'+_0x4a8748[_0x4903('0x65')]+'%';_0x40fb2a[_0x75b37e](_0x4903('0x6e'),_0x29117f,_0x29117f,_0x29117f);}}else{_0x8d3261=_[_0x4903('0x64')](_0x36cab6,[_0x4903('0x30'),_0x4903('0x6f')]);_0x4a8748['field']=_0x4903('0x6f');_0x20ad77=as[_0x4903('0x70')](_0x4e13cb,_0x8d3261[_0x4903('0x41')],_0x4a8748);_0x40fb2a[_0x75b37e](_0x20ad77[_0x4903('0x71')],_0x20ad77[_0x4903('0x65')][_0x4903('0x72')],_0x20ad77[_0x4903('0x65')][_0x4903('0x22')]);}break;case _0x4903('0x73'):var _0xacce3c=_0x4a8748[_0x4903('0x65')][_0x4903('0x6b')](',')[_0x4903('0x33')](function(_0x56258c){return Number(_0x56258c);});_0xacce3c[_0x4903('0x36')](function(_0x5b8a74){_0x58c8a0['or'](_0x4903('0x74'),'%,'+_0x5b8a74+',%');});_0x4fd814=_[_0x4903('0x75')](_0x4fd814,_0xacce3c);break;case _0x4903('0x76'):if(_0x4a8748[_0x4903('0x6a')]===_0x4903('0x77')){_0x40fb2a[_0x75b37e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a8748[_0x4903('0x65')]+'%',null);}else{_0x8d3261=_[_0x4903('0x64')](_0x36cab6,['name','UserId']);_0x4a8748[_0x4903('0x4c')]=_0x4903('0x3d');_0x20ad77=as['buildExpression'](_0x4e13cb,_0x8d3261[_0x4903('0x41')],_0x4a8748);_0x40fb2a[_0x75b37e](_0x20ad77[_0x4903('0x71')],_0x20ad77[_0x4903('0x65')][_0x4903('0x72')],_0x20ad77[_0x4903('0x65')][_0x4903('0x22')]);}break;case _0x4903('0x78'):_0x20ad77=as[_0x4903('0x70')]('me',null,_0x4a8748);_0x40fb2a[_0x75b37e](_0x20ad77[_0x4903('0x71')],_0x20ad77['value'][_0x4903('0x72')],_0x20ad77[_0x4903('0x65')][_0x4903('0x22')]);break;}}else{var _0x20ad77=as[_0x4903('0x70')](_0x4e13cb,_0x8d3261[_0x4903('0x41')],_0x4a8748);_0x40fb2a[_0x75b37e](_0x20ad77[_0x4903('0x71')],_0x20ad77['value'][_0x4903('0x72')],_0x20ad77[_0x4903('0x65')]['end']);}}}else{var _0x3e330e=_(_0x321eaf[_0x4903('0x44')])[_0x4903('0x45')]()[_0x4903('0x33')](function(_0x5c3e5b){return _[_0x4903('0x79')](_0x36cab6,[_0x4903('0x30'),_0x5c3e5b])?_0x5c3e5b:undefined;})[_0x4903('0x7a')]()[_0x4903('0x65')]();if(!_[_0x4903('0x7b')](_0x3e330e)){_0x3e330e[_0x4903('0x36')](function(_0x2a23b0){if(_0x2a23b0===_0x4903('0x7c')){_0x4f307a['where']('i.SmsAccountId\x20IN\x20?',[][_0x4903('0x7d')](_0x321eaf[_0x4903('0x44')][_0x2a23b0]));}else if(_0x2a23b0===_0x4903('0x7e')){var _0x54a464=JSON[_0x4903('0x7f')](_0x321eaf['query'][_0x2a23b0])[_0x4903('0x80')];var _0x37a36a=JSON[_0x4903('0x7f')](_0x321eaf[_0x4903('0x44')][_0x2a23b0])[_0x4903('0x81')];_0x4f307a[_0x4903('0x82')](_0x4903('0x83'),_0x54a464,_0x37a36a);}else{if(_0x321eaf[_0x4903('0x44')][_0x2a23b0]===_0x4903('0x84')){_0x4f307a['where']('i.'+_0x2a23b0+_0x4903('0x85'));}else{_0x4f307a[_0x4903('0x82')]('i.'+_0x2a23b0+_0x4903('0x86'),_0x321eaf[_0x4903('0x44')][_0x2a23b0]);}}});}if(_0x321eaf[_0x4903('0x44')][_0x4903('0x87')]){if(_0x321eaf[_0x4903('0x44')]['read']==0x1){_0x4f307a[_0x4903('0x66')](_0x4903('0x88'));}else{_0x4f307a[_0x4903('0x66')](_0x4903('0x89'));}}if(_0x321eaf[_0x4903('0x44')][_0x4903('0x8a')]){_0x4fd814=_[_0x4903('0x8b')](_0x321eaf['query'][_0x4903('0x8a')])?_0x321eaf[_0x4903('0x44')]['tag']:new Array(_0x321eaf['query'][_0x4903('0x8a')]);_0x4fd814[_0x4903('0x36')](function(_0x1648a3){_0x58c8a0['or'](_0x4903('0x74'),'%,'+_0x1648a3+',%');});}if(_0x321eaf[_0x4903('0x44')]['filter']){var _0x150fc0=_0x321eaf[_0x4903('0x44')][_0x4903('0x8c')][_0x4903('0x8d')]('\x5c','\x5c\x5c')[_0x4903('0x8d')](/'/g,'\x27\x27');if(qs[_0x4903('0x8e')](_0x150fc0)){_0x40fb2a['or'](_0x4903('0x8f'),_0x150fc0+'%')['or'](_0x4903('0x90'),_0x150fc0+'%');}else{_0x40fb2a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x150fc0))['or'](_0x4903('0x91'),_0x150fc0+'%');}}}_0x4f307a[_0x4903('0x82')](_0x40fb2a);_0x4f307a['group'](_0x4903('0x92'));var _0x35e7a2={'type':db[_0x4903('0x93')][_0x4903('0x94')][_0x4903('0x95')],'raw':!![]};var _0x31f12c=_0x4f307a[_0x4903('0x96')]();_0x31f12c[_0x4903('0x4c')](_0x4903('0x92'));_0x31f12c['field'](_0x4903('0x97'),_0x4903('0x98'));if(_0x4e7ebc['order']){_0x4e7ebc[_0x4903('0x4b')][_0x4903('0x36')](function(_0x2c2deb){var _0x4d0733=_0x2c2deb[0x0]===_0x4903('0x99')?_0x2c2deb[0x0]:'i.'+_0x2c2deb[0x0];_0x4f307a[_0x4903('0x4b')](_0x4d0733,_0x2c2deb[0x1]===_0x4903('0x9a')?![]:!![]);});}if(!_[_0x4903('0x7b')](_0x4fd814)){_0x4f307a['having'](_0x58c8a0);_0x31f12c[_0x4903('0x82')](_0x4903('0x9b'),_0x4fd814);}BPromise['resolve']()[_0x4903('0x2c')](function(){if(!_0x2883f2){if(_0x321eaf['query'][_0x4903('0x7c')])return;_0x31f12c[_0x4903('0x82')](_0x4903('0x9c'));_0x4f307a[_0x4903('0x82')](_0x4903('0x9c'));return;}if(_0x321eaf['user'][_0x4903('0x9d')]!=='agent')return;return _0x321eaf['user'][_0x4903('0x9e')]({'attributes':['id'],'raw':!![]})[_0x4903('0x2c')](function(_0x24193c){if(_[_0x4903('0x7b')](_0x24193c)){_0x31f12c[_0x4903('0x82')]('i.SmsAccountId\x20IS\x20NULL');_0x4f307a[_0x4903('0x82')](_0x4903('0x9f'));}else{_0x31f12c['where'](_0x4903('0xa0'),_[_0x4903('0x33')](_0x24193c,'id'));_0x4f307a['where']('i.SmsAccountId\x20IN\x20?',_[_0x4903('0x33')](_0x24193c,'id'));}});})[_0x4903('0x2c')](function(){if(_0x321eaf[_0x4903('0xa1')][_0x4903('0x9d')]===_0x4903('0xa2')&&!_0x2883f2&&!_0x321eaf[_0x4903('0x44')][_0x4903('0x7c')])return[];return db['sequelize']['query'](_0x31f12c['toString'](),_0x35e7a2);})['then'](function(_0x12a80a){_0x33dba2[_0x4903('0x26')]=_0x12a80a[_0x4903('0x49')];if(_0x33dba2['count']===0x0)return[];return db['sequelize']['query'](_0x48921e['toString'](),_0x35e7a2)[_0x4903('0x2c')](function(_0xfd3742){_0x216433=_[_0x4903('0xa3')](_0xfd3742,'id');_0x35e7a2=_[_0x4903('0xa4')](_0x35e7a2,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x321eaf[_0x4903('0x44')]['fields']){_0x4e7ebc[_0x4903('0x47')][_0x4903('0x36')](function(_0x303cda){_0x4f307a[_0x4903('0x4c')]('i.'+_0x303cda);});}else{_0x4f307a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4903('0x98'));_0x4f307a[_0x4903('0x4c')]('a.key',_0x4903('0xa5'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xa6'),_0x4903('0xa7'));_0x4f307a['field'](_0x4903('0xa8'),_0x4903('0x99'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xa9'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xaa'),_0x4903('0xab'));_0x4f307a['field'](_0x4903('0xac'),_0x4903('0xad'));_0x4f307a['field'](_0x4903('0xae'),_0x4903('0xaf'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xb0'),'Contact.phone');_0x4f307a[_0x4903('0x4c')](_0x4903('0xb1'),'Contact.mobile');_0x4f307a[_0x4903('0x4c')](_0x4903('0xb2'),_0x4903('0xb3'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xb4'),_0x4903('0xb5'));_0x4f307a[_0x4903('0x4c')](_0x4903('0xb6'),'Owner.internal');_0x4f307a[_0x4903('0x4c')](_0x4903('0xb7'),_0x4903('0x34'));}if(_0x4e7ebc[_0x4903('0x25')])_0x4f307a[_0x4903('0x25')](_0x4e7ebc['limit']);if(_0x4e7ebc[_0x4903('0x23')])_0x4f307a['offset'](_0x4e7ebc[_0x4903('0x23')]);return db[_0x4903('0xb8')][_0x4903('0x44')](_0x4f307a[_0x4903('0xb9')](),_0x35e7a2);})[_0x4903('0x2c')](function(_0x2f0cc6){if(_0x2f0cc6[_0x4903('0x49')]>0x0)_0x3fdaa0[_0x4903('0x82')](_0x4903('0xba'),_[_0x4903('0x33')](_0x2f0cc6,'id'));return db['sequelize'][_0x4903('0x44')](_0x3fdaa0[_0x4903('0xb9')](),_0x35e7a2)['then'](function(_0x4ba997){var _0x2fc77b=_[_0x4903('0xbb')](_0x4ba997,_0x4903('0xbc'));var _0x553305=[];_0x2f0cc6[_0x4903('0x36')](function(_0x2f4e4d){_0x553305[_0x4903('0xbd')](updateSmsInteraction(_0x2f4e4d,_0x216433,_0x2fc77b));});return BPromise[_0x4903('0xbe')](_0x553305);});});})[_0x4903('0x2c')](function(_0x4d31d2){_0x33dba2['rows']=_0x4d31d2;return _0x33dba2;})['then'](respondWithFilteredResult(_0x50509e,_0x4e7ebc))[_0x4903('0xbf')](handleError(_0x50509e,null));};exports[_0x4903('0xc0')]=function(_0x2f4da7,_0x5127c5){var _0x4b281d={'raw':![],'where':{'id':_0x2f4da7[_0x4903('0xc1')]['id']}},_0x5050b7={};_0x5050b7[_0x4903('0x43')]=_[_0x4903('0x45')](db['SmsInteraction'][_0x4903('0x3f')]);_0x5050b7[_0x4903('0x44')]=_['keys'](_0x2f4da7[_0x4903('0x44')]);_0x5050b7['filters']=_[_0x4903('0x46')](_0x5050b7['model'],_0x5050b7[_0x4903('0x44')]);_0x4b281d[_0x4903('0x47')]=_[_0x4903('0x46')](_0x5050b7[_0x4903('0x43')],qs[_0x4903('0x48')](_0x2f4da7[_0x4903('0x44')][_0x4903('0x48')]));_0x4b281d[_0x4903('0x47')]=_0x4b281d['attributes']['length']?_0x4b281d[_0x4903('0x47')]:_0x5050b7['model'];if(_0x2f4da7['query'][_0x4903('0xc2')]){_0x4b281d[_0x4903('0xc3')]=[{'all':!![]}];}_0x4b281d=_[_0x4903('0xa4')]({},_0x4b281d,_0x2f4da7[_0x4903('0xc4')]);return db[_0x4903('0x3e')][_0x4903('0x64')](_0x4b281d)[_0x4903('0x2c')](handleEntityNotFound(_0x5127c5,null))[_0x4903('0x2c')](respondWithResult(_0x5127c5,null))['catch'](handleError(_0x5127c5,null));};exports[_0x4903('0xc5')]=function(_0x30434d,_0x473264){return db['SmsInteraction'][_0x4903('0xc5')](_0x30434d['body'],{})[_0x4903('0x2c')](respondWithResult(_0x473264,0xc9))['catch'](handleError(_0x473264,null));};exports[_0x4903('0x2b')]=function(_0x4676ca,_0x28fb0c){if(_0x4676ca['body']['id']){delete _0x4676ca[_0x4903('0x78')]['id'];}return db[_0x4903('0x3e')][_0x4903('0x64')]({'where':{'id':_0x4676ca[_0x4903('0xc1')]['id']}})[_0x4903('0x2c')](handleEntityNotFound(_0x28fb0c,null))[_0x4903('0x2c')](saveUpdates(_0x4676ca[_0x4903('0x78')],null))[_0x4903('0x2c')](respondWithResult(_0x28fb0c,null))['catch'](handleError(_0x28fb0c,null));};exports[_0x4903('0x2d')]=function(_0x44c1df,_0x3d8a81){return db['SmsInteraction']['find']({'where':{'id':_0x44c1df['params']['id']}})[_0x4903('0x2c')](handleEntityNotFound(_0x3d8a81,null))[_0x4903('0x2c')](removeEntity(_0x3d8a81,null))[_0x4903('0xbf')](handleError(_0x3d8a81,null));};exports[_0x4903('0xc6')]=function(_0x303d2d,_0xebb101){return db[_0x4903('0x3e')]['describe']()[_0x4903('0x2c')](respondWithResult(_0xebb101,null))['catch'](handleError(_0xebb101,null));};exports[_0x4903('0xc7')]=function(_0x2815ef,_0x4ecae6,_0x23acf9){return db[_0x4903('0xc8')][_0x4903('0x64')]({'where':{'id':_0x2815ef[_0x4903('0xc1')]['id']}})['then'](handleEntityNotFound(_0x4ecae6,null))[_0x4903('0x2c')](function(_0x225e9b){if(_0x225e9b){return _0x225e9b[_0x4903('0xc7')](_0x2815ef['body']['ids'],_[_0x4903('0xc9')](_0x2815ef['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4ecae6,null))['catch'](handleError(_0x4ecae6,null));};exports[_0x4903('0xca')]=function(_0x5f4fe4,_0x3d0ebd,_0x20ea53){var _0x4044fe={'raw':![],'where':{}};var _0x30e31b={};var _0x308a3a={'count':0x0,'rows':[]};return db[_0x4903('0x3e')][_0x4903('0xcb')]({'where':{'id':_0x5f4fe4['params']['id']}})[_0x4903('0x2c')](handleEntityNotFound(_0x3d0ebd,null))[_0x4903('0x2c')](function(_0x588edb){if(_0x588edb){_0x30e31b['model']=_[_0x4903('0x45')](db[_0x4903('0xc8')][_0x4903('0x3f')]);_0x30e31b[_0x4903('0x44')]=_[_0x4903('0x45')](_0x5f4fe4[_0x4903('0x44')]);_0x30e31b[_0x4903('0xcc')]=_[_0x4903('0x46')](_0x30e31b[_0x4903('0x43')],_0x30e31b[_0x4903('0x44')]);_0x4044fe[_0x4903('0x47')]=_[_0x4903('0x46')](_0x30e31b[_0x4903('0x43')],qs[_0x4903('0x48')](_0x5f4fe4[_0x4903('0x44')][_0x4903('0x48')]));_0x4044fe[_0x4903('0x47')]=_0x4044fe[_0x4903('0x47')][_0x4903('0x49')]?_0x4044fe[_0x4903('0x47')]:_0x30e31b[_0x4903('0x43')];if(!_0x5f4fe4[_0x4903('0x44')][_0x4903('0xcd')](_0x4903('0x4a'))){_0x4044fe[_0x4903('0x25')]=qs[_0x4903('0x25')](_0x5f4fe4[_0x4903('0x44')][_0x4903('0x25')]);_0x4044fe['offset']=qs[_0x4903('0x23')](_0x5f4fe4['query'][_0x4903('0x23')]);}_0x4044fe['order']=qs[_0x4903('0xce')](_0x5f4fe4['query']['sort']);_0x4044fe['where']=qs[_0x4903('0xcc')](_[_0x4903('0xcf')](_0x5f4fe4['query'],_0x30e31b['filters']));_0x4044fe['where'][_0x4903('0xbc')]=_0x588edb['id'];if(_0x5f4fe4[_0x4903('0x44')][_0x4903('0x8c')]){_0x4044fe[_0x4903('0x82')]=_[_0x4903('0xa4')](_0x4044fe[_0x4903('0x82')],{'$or':_[_0x4903('0x33')](_0x4044fe[_0x4903('0x47')],function(_0x1741fd){var _0x47e070={};_0x47e070[_0x1741fd]={'$like':'%'+_0x5f4fe4['query']['filter']+'%'};return _0x47e070;})});}if(_0x5f4fe4[_0x4903('0x44')][_0x4903('0x80')]){var _0x57128e=_0x5f4fe4[_0x4903('0x44')]['$gte']['split'](',');var _0x4e78cb={};_0x4e78cb[_0x57128e[0x0]]={'$gte':moment(_0x57128e[0x1])[_0x4903('0xd0')](_0x4903('0xd1'))};_0x4044fe[_0x4903('0x82')]=_[_0x4903('0xa4')](_0x4044fe['where'],_0x4e78cb);}_0x4044fe=_[_0x4903('0xa4')]({},_0x4044fe,_0x5f4fe4['options']);return db[_0x4903('0xc8')][_0x4903('0x26')]({'where':_0x4044fe[_0x4903('0x82')]})[_0x4903('0x2c')](function(_0x495f12){_0x308a3a[_0x4903('0x26')]=_0x495f12;if(_0x5f4fe4['query'][_0x4903('0xc2')]){_0x4044fe[_0x4903('0xc3')]=[{'all':!![]}];}return db[_0x4903('0xc8')]['findAll'](_0x4044fe);})[_0x4903('0x2c')](function(_0x34184c){_0x308a3a[_0x4903('0xd2')]=_0x34184c;return _0x308a3a;});}})[_0x4903('0x2c')](respondWithFilteredResult(_0x3d0ebd,_0x4044fe))[_0x4903('0xbf')](handleError(_0x3d0ebd,null));};exports['addTags']=function(_0x4634ce,_0x4a0b2d,_0x172fbb){return db[_0x4903('0x3e')][_0x4903('0x64')]({'where':{'id':_0x4634ce[_0x4903('0xc1')]['id']}})['then'](handleEntityNotFound(_0x4a0b2d,null))['then'](function(_0x21019c){if(_0x21019c){return _0x21019c[_0x4903('0xd3')](_0x4634ce['body'][_0x4903('0xd4')],_['omit'](_0x4634ce[_0x4903('0x78')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x4903('0xd5')]({'attributes':['id',_0x4903('0x30'),_0x4903('0x4d')],'where':{'id':_0x4634ce['body']['ids']}});})[_0x4903('0x2c')](function(_0x18684b){socket[_0x4903('0xd6')](_0x4903('0xd7'),{'id':Number(_0x4634ce[_0x4903('0xc1')]['id']),'tags':_0x18684b||[]});return{'id':Number(_0x4634ce['params']['id']),'tags':_0x18684b||[]};});}})[_0x4903('0x2c')](respondWithResult(_0x4a0b2d,null))[_0x4903('0xbf')](handleError(_0x4a0b2d,null));};exports[_0x4903('0xd8')]=function(_0x505631,_0x306acd,_0x5cbdd0){return db['SmsInteraction'][_0x4903('0x64')]({'where':{'id':_0x505631[_0x4903('0xc1')]['id']}})[_0x4903('0x2c')](handleEntityNotFound(_0x306acd,null))[_0x4903('0x2c')](function(_0x3381d6){if(_0x3381d6){return _0x3381d6['removeTags'](_0x505631[_0x4903('0x44')][_0x4903('0xd4')]);}})[_0x4903('0x2c')](respondWithStatusCode(_0x306acd,null))[_0x4903('0xbf')](handleError(_0x306acd,null));};exports[_0x4903('0xd9')]=function(_0x24c3ca,_0x315bbb){var _0x2bf319=moment()[_0x4903('0xda')]()[_0x4903('0xb9')]();var _0x590f69=path[_0x4903('0xdb')](config['root'],_0x4903('0xdc'),_0x4903('0xdd'),_0x4903('0xde'));var _0xcb94f8=path[_0x4903('0xdb')](config[_0x4903('0xdf')],_0x4903('0xdc'),_0x4903('0xdd'),'attachments');var _0x3168df=path[_0x4903('0xdb')](_0x590f69,_0x2bf319);var _0x3329ab=util[_0x4903('0xd0')](_0x4903('0xe0'),_0x24c3ca[_0x4903('0xc1')]['id'],_0x2bf319);var _0x22adaf=path[_0x4903('0xdb')](_0x590f69,_0x3329ab);var _0x45f1e1=[];_0x45f1e1[_0x4903('0xbd')]({'model':db[_0x4903('0x76')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x45f1e1['push']({'model':db[_0x4903('0xe1')],'as':_0x4903('0x69'),'attributes':['id',_0x4903('0xe2'),'lastName'],'raw':!![]});var _0x24966f=[{'model':db[_0x4903('0xc8')],'as':'Messages','attributes':['id',_0x4903('0x78'),_0x4903('0x7e'),_0x4903('0xe3'),_0x4903('0xe4'),_0x4903('0x87')],'include':_0x45f1e1}];_0x24966f[_0x4903('0xbd')]({'model':db[_0x4903('0xe5')],'as':_0x4903('0xe6'),'attributes':['id',_0x4903('0x30')]});_0x24966f['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x4903('0x3e')]['find']({'where':{'id':_0x24c3ca[_0x4903('0xc1')]['id']},'include':_0x24966f})['then'](handleEntityNotFound(_0x315bbb,null))[_0x4903('0x2c')](function(_0x2cea89){if(_0x2cea89){var _0xcbcb2a=_0x2cea89[_0x4903('0xe7')]({'plain':!![]});fs[_0x4903('0xe8')](_0x3168df);var _0x2c41a2={'channel':_0x4903('0xe9'),'account':_0xcbcb2a['Account'][_0x4903('0x30')],'agent':_0xcbcb2a['Owner']?_0xcbcb2a[_0x4903('0xea')][_0x4903('0xeb')]:_0x4903('0xec'),'createdAt':moment(_0xcbcb2a['createdAt'])[_0x4903('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4903('0xb9')](),'closedAt':_0xcbcb2a[_0x4903('0x3c')]?moment(_0xcbcb2a['closedAt'])[_0x4903('0xd0')](_0x4903('0xd1'))[_0x4903('0xb9')]():'','disposition':_0xcbcb2a[_0x4903('0xed')],'messages':_(_0xcbcb2a['Messages'])['filter']({'secret':![]})[_0x4903('0x33')](function(_0x4207){return{'date':moment(_0x4207['createdAt'])['format'](_0x4903('0xd1'))[_0x4903('0xb9')](),'sender':_0x4207[_0x4903('0xe3')]==='out'?_0x4207[_0x4903('0x76')]?_0x4207[_0x4903('0x76')][_0x4903('0xeb')]:_0x4903('0xee'):_0x4207[_0x4903('0x69')]['firstName']+(_0x4207[_0x4903('0x69')][_0x4903('0xef')]?'\x20'+_0x4207[_0x4903('0x69')][_0x4903('0xef')]:''),'body':_0x4207[_0x4903('0x78')],'direction':_0x4207[_0x4903('0xe3')]==='out'?'A':'C','secret':_0x4207['secret'],'read':_0x4207[_0x4903('0x87')]};})[_0x4903('0x65')]()};return ejs[_0x4903('0xf0')](path['join'](config[_0x4903('0xdf')],_0x4903('0xdc'),_0x4903('0xf1'),'downloadInteraction.ejs'),{'interaction':_0x2c41a2})[_0x4903('0x2c')](function(_0x168749){var _0x247155=path[_0x4903('0xdb')](_0x3168df,_0x4903('0xf2')+_0xcbcb2a['id']+'-'+_0x2bf319+'.pdf');var _0x4fad2f={'path':_0x247155,'channel':_0x4903('0xe9'),'interactionId':_0xcbcb2a['id']};return pdf['createPdfFromHTML'](_0x168749,_0x4fad2f);})['then'](function(){return new BPromise(function(_0x3d714a,_0x515e0c){zipdir(_0x3168df,{'saveTo':_0x22adaf},function(_0x544070,_0x3b0275){if(_0x544070)return _0x515e0c(_0x544070);return _0x3d714a(_0x3b0275);});})[_0x4903('0x2c')](function(){return new BPromise(function(_0x1fbdf8,_0x201a8c){rimraf(_0x3168df,function(_0x382344){if(_0x382344)_0x201a8c(_0x382344);return _0x1fbdf8();});});})[_0x4903('0x2c')](function(){return _0x315bbb[_0x4903('0xd9')](_0x22adaf,_0x3329ab,function(_0x32aa36){if(_0x32aa36){console[_0x4903('0xf3')](_0x4903('0xf4'),_0x32aa36);}else{fs[_0x4903('0xf5')](_0x22adaf);}});});});}else{return _0x315bbb['sendStatus'](0xc8);}})[_0x4903('0xbf')](handleError(_0x315bbb,null));}; \ No newline at end of file +var _0x349a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','limit','count','Content-Range','apply','reject','destroy','then','error','stack','name','Users','map','TagIds','Tags','forEach','push','catch','talking','answered','total','UserId','waiting','closed','unmanaged','index','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','end','Tag','union','User','operator','text','start','body','isEmpty','SmsAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','rows','params','intersection','includeAll','merge','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','pick','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','CmContact','firstName','Messages','direction','secret','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','out','System','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2dc790,_0x5e4faa){var _0x3ae53c=function(_0x2aeee0){while(--_0x2aeee0){_0x2dc790['push'](_0x2dc790['shift']());}};_0x3ae53c(++_0x5e4faa);}(_0x349a,0xd8));var _0xa349=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x349a[_0x466bc5];return _0x138952;};'use strict';var emlformat=require(_0xa349('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa349('0x1'));var jsonpatch=require(_0xa349('0x2'));var rp=require('request-promise');var moment=require(_0xa349('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa349('0x4'));var util=require(_0xa349('0x5'));var path=require(_0xa349('0x6'));var sox=require(_0xa349('0x7'));var csv=require(_0xa349('0x8'));var ejs=require(_0xa349('0x9'));var fs=require('fs');var fs_extra=require(_0xa349('0xa'));var _=require(_0xa349('0xb'));var squel=require(_0xa349('0xc'));var crypto=require(_0xa349('0xd'));var jsforce=require(_0xa349('0xe'));var deskjs=require(_0xa349('0xf'));var toCsv=require(_0xa349('0x8'));var querystring=require(_0xa349('0x10'));var Papa=require(_0xa349('0x11'));var Redis=require(_0xa349('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa349('0x13'));var as=require(_0xa349('0x14'));var pdf=require(_0xa349('0x15'));var hardwareService=require(_0xa349('0x16'));var logger=require('../../config/logger')(_0xa349('0x17'));var utils=require(_0xa349('0x18'));var config=require(_0xa349('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa349('0x1a')]=_[_0xa349('0x1b')](config[_0xa349('0x1a')],{'host':_0xa349('0x1c'),'port':0x18eb});var socket=require(_0xa349('0x1d'))(new Redis(config[_0xa349('0x1a')]));require(_0xa349('0x1e'))[_0xa349('0x1f')](socket);function respondWithStatusCode(_0x36d964,_0xa287dd){_0xa287dd=_0xa287dd||0xcc;return function(_0x5313f2){if(_0x5313f2){return _0x36d964[_0xa349('0x20')](_0xa287dd);}return _0x36d964[_0xa349('0x21')](_0xa287dd)['end']();};}function respondWithResult(_0x5dbabe,_0x55d5af){_0x55d5af=_0x55d5af||0xc8;return function(_0x521164){if(_0x521164){return _0x5dbabe[_0xa349('0x21')](_0x55d5af)['json'](_0x521164);}};}function respondWithFilteredResult(_0xae3da,_0x1e291c){return function(_0xebd059){if(_0xebd059){var _0x42a7b0=typeof _0x1e291c[_0xa349('0x22')]==='undefined'&&typeof _0x1e291c[_0xa349('0x23')]==='undefined';var _0x56e3a1=_0xebd059[_0xa349('0x24')];var _0x32229d=_0x42a7b0?0x0:_0x1e291c['offset'];var _0x4f5716=_0x42a7b0?_0xebd059[_0xa349('0x24')]:_0x1e291c[_0xa349('0x22')]+_0x1e291c[_0xa349('0x23')];var _0x2fa56e;if(_0x4f5716>=_0x56e3a1){_0x4f5716=_0x56e3a1;_0x2fa56e=0xc8;}else{_0x2fa56e=0xce;}_0xae3da[_0xa349('0x21')](_0x2fa56e);return _0xae3da['set'](_0xa349('0x25'),_0x32229d+'-'+_0x4f5716+'/'+_0x56e3a1)['json'](_0xebd059);}return null;};}function patchUpdates(_0x28f120){return function(_0x5a2daa){try{jsonpatch[_0xa349('0x26')](_0x5a2daa,_0x28f120,!![]);}catch(_0x2818e2){return BPromise[_0xa349('0x27')](_0x2818e2);}return _0x5a2daa['save']();};}function saveUpdates(_0x43833f,_0x1e7281){return function(_0x390bfb){if(_0x390bfb){return _0x390bfb['update'](_0x43833f)['then'](function(_0x3b26a7){return _0x3b26a7;});}return null;};}function removeEntity(_0x2f368d,_0x76d4b2){return function(_0x6413d0){if(_0x6413d0){return _0x6413d0[_0xa349('0x28')]()[_0xa349('0x29')](function(){_0x2f368d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fd055,_0x225cb9){return function(_0x1d3292){if(!_0x1d3292){_0x1fd055['sendStatus'](0x194);}return _0x1d3292;};}function handleError(_0x49c049,_0x23e6d2){_0x23e6d2=_0x23e6d2||0x1f4;return function(_0x5c2bdd){logger[_0xa349('0x2a')](_0x5c2bdd[_0xa349('0x2b')]);if(_0x5c2bdd[_0xa349('0x2c')]){delete _0x5c2bdd[_0xa349('0x2c')];}_0x49c049[_0xa349('0x21')](_0x23e6d2)['send'](_0x5c2bdd);};}function getInteractionUsers(_0x1ff15a,_0x40db48){return new BPromise(function(_0x5bc5e4,_0x34936a){try{if(_0x40db48[_0x1ff15a['id']]){_0x1ff15a[_0xa349('0x2d')]=_[_0xa349('0x2e')](_0x40db48[_0x1ff15a['id']],function(_0x2d0d6a){return{'id':_0x2d0d6a['id'],'fullname':_0x2d0d6a['fullname']};});}}catch(_0x4706ca){_0x34936a(_0x4706ca);}_0x5bc5e4(_0x1ff15a);});}function getInteractionTags(_0x3215d1,_0x1b5dc4){return new BPromise(function(_0x4144b6,_0x3d5890){try{if(_0x3215d1[_0xa349('0x2f')]){_0x3215d1[_0xa349('0x30')]=[];_0x3215d1[_0xa349('0x2f')]['split'](',')[_0xa349('0x31')](function(_0x4947ba){_0x3215d1[_0xa349('0x30')][_0xa349('0x32')](_0x1b5dc4[_0x4947ba]);});}delete _0x3215d1['TagIds'];}catch(_0x7eabe9){_0x3d5890(_0x7eabe9);}_0x4144b6(_0x3215d1);});}function updateSmsInteraction(_0x65ef67,_0x164bc3,_0x231669){return new BPromise(function(_0x4e11be,_0x47250a){return getInteractionUsers(_0x65ef67,_0x231669)[_0xa349('0x29')](function(_0x518897){return getInteractionTags(_0x518897,_0x164bc3);})['then'](function(_0x4abc4a){return getStateInteraction(_0x4abc4a);})['then'](function(_0x57f9a0){_0x4e11be(_0x57f9a0);})[_0xa349('0x33')](function(_0x3ac341){_0x47250a(_0x3ac341);});});}function getStateInteraction(_0x40f509){return new BPromise(function(_0x16aaca){_0x40f509['waiting']=0x0;_0x40f509[_0xa349('0x34')]=0x0;_0x40f509[_0xa349('0x35')]=0x0;_0x40f509['unmanaged']=0x0;_0x40f509[_0xa349('0x36')]=0x0;if(!_0x40f509['closed']&&!_0x40f509[_0xa349('0x37')]){_0x40f509[_0xa349('0x38')]+=0x1;}if(!_0x40f509['closed']&&_0x40f509[_0xa349('0x37')]){_0x40f509['talking']+=0x1;if(_0x40f509[_0xa349('0x38')]){_0x40f509[_0xa349('0x38')]-=0x1;}}if(_0x40f509[_0xa349('0x39')]&&_0x40f509['UserId']){_0x40f509['answered']+=0x1;if(_0x40f509[_0xa349('0x34')]){_0x40f509[_0xa349('0x34')]-=0x1;}}if(_0x40f509[_0xa349('0x39')]&&!_0x40f509['UserId']){_0x40f509[_0xa349('0x3a')]+=0x1;if(_0x40f509['waiting']){_0x40f509['waiting']-=0x1;}}_0x40f509['total']+=0x1;_0x16aaca(_0x40f509);});}exports[_0xa349('0x3b')]=function(_0xae901,_0xace705){var _0x2644ae={},_0x306e3b={},_0x35083a={'count':0x0,'rows':[]};var _0x123159=_['map'](db['SmsInteraction'][_0xa349('0x3c')],function(_0xf25c08){return{'name':_0xf25c08[_0xa349('0x3d')],'type':_0xf25c08[_0xa349('0x3e')][_0xa349('0x3f')]};});_0x306e3b[_0xa349('0x40')]=_[_0xa349('0x2e')](_0x123159,_0xa349('0x2c'));_0x306e3b['query']=_[_0xa349('0x41')](_0xae901[_0xa349('0x42')]);_0x306e3b[_0xa349('0x43')]=_['intersection'](_0x306e3b[_0xa349('0x40')],_0x306e3b[_0xa349('0x42')]);_0x2644ae[_0xa349('0x44')]=_['intersection'](_0x306e3b[_0xa349('0x40')],qs[_0xa349('0x45')](_0xae901[_0xa349('0x42')][_0xa349('0x45')]));_0x2644ae[_0xa349('0x44')]=_0x2644ae['attributes'][_0xa349('0x46')]?_0x2644ae[_0xa349('0x44')]:_0x306e3b[_0xa349('0x40')];if(!_0xae901[_0xa349('0x42')][_0xa349('0x47')](_0xa349('0x48'))){_0x2644ae[_0xa349('0x23')]=qs[_0xa349('0x23')](_0xae901['query']['limit']);_0x2644ae[_0xa349('0x22')]=qs[_0xa349('0x22')](_0xae901[_0xa349('0x42')]['offset']);}_0x2644ae[_0xa349('0x49')]=qs[_0xa349('0x4a')](_0xae901['query']['sort']);_0x2644ae[_0xa349('0x4b')]=qs[_0xa349('0x43')](_['pick'](_0xae901[_0xa349('0x42')],_0x306e3b[_0xa349('0x43')]),_0x123159);var _0x3478db=[];var _0x333e41=squel[_0xa349('0x4c')]()[_0xa349('0x4d')]('id')[_0xa349('0x4d')](_0xa349('0x2c'))[_0xa349('0x4d')](_0xa349('0x4e'))[_0xa349('0x4f')]('tools_tags');var _0x39ad69=squel['select']()['field'](_0xa349('0x50'))[_0xa349('0x4d')](_0xa349('0x51'))[_0xa349('0x4d')](_0xa349('0x52'))['from'](_0xa349('0x53'),'ui')['left_join'](_0xa349('0x54'),'u',_0xa349('0x55'));var _0x4391b4=squel[_0xa349('0x4c')]()['from'](_0xa349('0x56'),'i')[_0xa349('0x57')](_0xa349('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xa349('0x54'),'o','o.id\x20=\x20i.UserId')[_0xa349('0x57')](_0xa349('0x59'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0xa349('0x5a'),'me',_0xa349('0x5b'))[_0xa349('0x57')](_0xa349('0x5c'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xa349('0x57')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5df58e=squel[_0xa349('0x5d')]();var _0x373a58=[];var _0x3cf92e=squel[_0xa349('0x5d')]();var _0x16876e;if(_0xae901['query'][_0xa349('0x5e')]){_0x16876e=as[_0xa349('0x5f')](_0xae901[_0xa349('0x42')]['search']);var _0x8f2f74=_0x16876e[_0xa349('0x60')];for(var _0x14e0ac=0x0;_0x14e0ac<_0x16876e[_0xa349('0x61')][_0xa349('0x46')];_0x14e0ac++){var _0x5ba2c6=_0x16876e['conditions'][_0x14e0ac];var _0x481b02='i';var _0x2a3091=_['find'](_0x123159,[_0xa349('0x2c'),_0x5ba2c6['field']]);if(!_0x2a3091){switch(_0x5ba2c6['field']){case _0xa349('0x62'):if(_0x5ba2c6[_0xa349('0x63')]==0x1){_0x4391b4[_0xa349('0x64')]('`'+_0x5ba2c6['field']+'`\x20=\x200');}else{_0x4391b4[_0xa349('0x64')]('`'+_0x5ba2c6[_0xa349('0x4d')]+_0xa349('0x65'));}break;case _0xa349('0x66'):if(_0x5ba2c6['operator']===_0xa349('0x67')){if(_0x5ba2c6[_0xa349('0x63')][_0xa349('0x68')]('\x20')[_0xa349('0x46')]>0x1){_0x5df58e[_0x8f2f74](_0xa349('0x69'),qs[_0xa349('0x6a')](_0x5ba2c6[_0xa349('0x63')]),null);}else{var _0xbe1788='%'+_0x5ba2c6['value']+'%';_0x5df58e[_0x8f2f74](_0xa349('0x6b'),_0xbe1788,_0xbe1788,_0xbe1788);}}else{_0x2a3091=_[_0xa349('0x6c')](_0x123159,['name',_0xa349('0x6d')]);_0x5ba2c6['field']=_0xa349('0x6d');_0x40f875=as[_0xa349('0x6e')](_0x481b02,_0x2a3091['type'],_0x5ba2c6);_0x5df58e[_0x8f2f74](_0x40f875['text'],_0x40f875[_0xa349('0x63')]['start'],_0x40f875[_0xa349('0x63')][_0xa349('0x6f')]);}break;case _0xa349('0x70'):var _0xf5bcee=_0x5ba2c6[_0xa349('0x63')][_0xa349('0x68')](',')[_0xa349('0x2e')](function(_0x595a81){return Number(_0x595a81);});_0xf5bcee['forEach'](function(_0x3a8daa){_0x3cf92e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a8daa+',%');});_0x373a58=_[_0xa349('0x71')](_0x373a58,_0xf5bcee);break;case _0xa349('0x72'):if(_0x5ba2c6[_0xa349('0x73')]===_0xa349('0x67')){_0x5df58e[_0x8f2f74]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ba2c6[_0xa349('0x63')]+'%',null);}else{_0x2a3091=_[_0xa349('0x6c')](_0x123159,['name',_0xa349('0x37')]);_0x5ba2c6[_0xa349('0x4d')]=_0xa349('0x37');_0x40f875=as[_0xa349('0x6e')](_0x481b02,_0x2a3091['type'],_0x5ba2c6);_0x5df58e[_0x8f2f74](_0x40f875[_0xa349('0x74')],_0x40f875[_0xa349('0x63')][_0xa349('0x75')],_0x40f875[_0xa349('0x63')]['end']);}break;case _0xa349('0x76'):_0x40f875=as[_0xa349('0x6e')]('me',null,_0x5ba2c6);_0x5df58e[_0x8f2f74](_0x40f875[_0xa349('0x74')],_0x40f875[_0xa349('0x63')][_0xa349('0x75')],_0x40f875[_0xa349('0x63')][_0xa349('0x6f')]);break;}}else{var _0x40f875=as['buildExpression'](_0x481b02,_0x2a3091[_0xa349('0x3e')],_0x5ba2c6);_0x5df58e[_0x8f2f74](_0x40f875['text'],_0x40f875[_0xa349('0x63')]['start'],_0x40f875[_0xa349('0x63')][_0xa349('0x6f')]);}}}else{var _0x141218=_(_0xae901[_0xa349('0x42')])[_0xa349('0x41')]()[_0xa349('0x2e')](function(_0xdab0fe){return _['some'](_0x123159,['name',_0xdab0fe])?_0xdab0fe:undefined;})['compact']()[_0xa349('0x63')]();if(!_[_0xa349('0x77')](_0x141218)){_0x141218[_0xa349('0x31')](function(_0x4e5c39){if(_0x4e5c39===_0xa349('0x78')){_0x4391b4['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0xae901[_0xa349('0x42')][_0x4e5c39]));}else if(_0x4e5c39===_0xa349('0x79')){var _0x24080e=JSON[_0xa349('0x7a')](_0xae901['query'][_0x4e5c39])[_0xa349('0x7b')];var _0x9c38f0=JSON[_0xa349('0x7a')](_0xae901[_0xa349('0x42')][_0x4e5c39])[_0xa349('0x7c')];_0x4391b4[_0xa349('0x4b')](_0xa349('0x7d'),_0x24080e,_0x9c38f0);}else{if(_0xae901[_0xa349('0x42')][_0x4e5c39]===_0xa349('0x7e')){_0x4391b4[_0xa349('0x4b')]('i.'+_0x4e5c39+_0xa349('0x7f'));}else{_0x4391b4[_0xa349('0x4b')]('i.'+_0x4e5c39+_0xa349('0x80'),_0xae901['query'][_0x4e5c39]);}}});}if(_0xae901[_0xa349('0x42')][_0xa349('0x81')]){if(_0xae901[_0xa349('0x42')][_0xa349('0x81')]==0x1){_0x4391b4[_0xa349('0x64')]('`unreadMessages`\x20=\x200');}else{_0x4391b4[_0xa349('0x64')]('`unreadMessages`\x20>\x200');}}if(_0xae901[_0xa349('0x42')]['tag']){_0x373a58=_[_0xa349('0x82')](_0xae901[_0xa349('0x42')][_0xa349('0x83')])?_0xae901[_0xa349('0x42')][_0xa349('0x83')]:new Array(_0xae901[_0xa349('0x42')]['tag']);_0x373a58['forEach'](function(_0x10b8a9){_0x3cf92e['or'](_0xa349('0x84'),'%,'+_0x10b8a9+',%');});}if(_0xae901[_0xa349('0x42')]['filter']){var _0x4eeadb=_0xae901[_0xa349('0x42')][_0xa349('0x85')][_0xa349('0x86')]('\x5c','\x5c\x5c')[_0xa349('0x86')](/'/g,'\x27\x27');if(qs[_0xa349('0x87')](_0x4eeadb)){_0x5df58e['or'](_0xa349('0x88'),_0x4eeadb+'%')['or'](_0xa349('0x89'),_0x4eeadb+'%');}else{_0x5df58e['or'](_0xa349('0x8a'),qs[_0xa349('0x6a')](_0x4eeadb))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4eeadb+'%');}}}_0x4391b4[_0xa349('0x4b')](_0x5df58e);_0x4391b4['group'](_0xa349('0x8b'));var _0x4bf7a9={'type':db['Sequelize'][_0xa349('0x8c')]['SELECT'],'raw':!![]};var _0x36ead6=_0x4391b4['clone']();_0x36ead6[_0xa349('0x4d')](_0xa349('0x8b'));_0x36ead6[_0xa349('0x4d')](_0xa349('0x8d'),'unreadMessages');if(_0x2644ae[_0xa349('0x49')]){_0x2644ae[_0xa349('0x49')][_0xa349('0x31')](function(_0x3f1e16){var _0x48867f=_0x3f1e16[0x0]===_0xa349('0x8e')?_0x3f1e16[0x0]:'i.'+_0x3f1e16[0x0];_0x4391b4[_0xa349('0x49')](_0x48867f,_0x3f1e16[0x1]===_0xa349('0x8f')?![]:!![]);});}if(!_[_0xa349('0x77')](_0x373a58)){_0x4391b4[_0xa349('0x64')](_0x3cf92e);_0x36ead6[_0xa349('0x4b')](_0xa349('0x90'),_0x373a58);}BPromise[_0xa349('0x91')]()[_0xa349('0x29')](function(){if(!_0x16876e){if(_0xae901[_0xa349('0x42')][_0xa349('0x78')])return;_0x36ead6['where'](_0xa349('0x92'));_0x4391b4['where'](_0xa349('0x92'));return;}if(_0xae901['user'][_0xa349('0x93')]!==_0xa349('0x94'))return;return _0xae901[_0xa349('0x95')][_0xa349('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x318d1a){if(_[_0xa349('0x77')](_0x318d1a)){_0x36ead6['where']('i.SmsAccountId\x20IS\x20NULL');_0x4391b4['where'](_0xa349('0x97'));}else{_0x36ead6[_0xa349('0x4b')](_0xa349('0x98'),_['map'](_0x318d1a,'id'));_0x4391b4[_0xa349('0x4b')](_0xa349('0x98'),_['map'](_0x318d1a,'id'));}});})[_0xa349('0x29')](function(){if(_0xae901[_0xa349('0x95')][_0xa349('0x93')]===_0xa349('0x94')&&!_0x16876e&&!_0xae901['query']['SmsAccountId'])return[];return db[_0xa349('0x99')]['query'](_0x36ead6[_0xa349('0x9a')](),_0x4bf7a9);})[_0xa349('0x29')](function(_0x55c62c){_0x35083a[_0xa349('0x24')]=_0x55c62c[_0xa349('0x46')];if(_0x35083a[_0xa349('0x24')]===0x0)return[];return db[_0xa349('0x99')][_0xa349('0x42')](_0x333e41[_0xa349('0x9a')](),_0x4bf7a9)[_0xa349('0x29')](function(_0x1ab565){_0x3478db=_[_0xa349('0x9b')](_0x1ab565,'id');_0x4bf7a9=_['merge'](_0x4bf7a9,{'model':db[_0xa349('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xae901[_0xa349('0x42')][_0xa349('0x45')]){_0x2644ae[_0xa349('0x44')][_0xa349('0x31')](function(_0x190ab5){_0x4391b4[_0xa349('0x4d')]('i.'+_0x190ab5);});}else{_0x4391b4[_0xa349('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa349('0x62'));_0x4391b4[_0xa349('0x4d')](_0xa349('0x9d'),_0xa349('0x9e'));_0x4391b4['field'](_0xa349('0x9f'),'Account.mandatoryDisposition');_0x4391b4[_0xa349('0x4d')](_0xa349('0xa0'),_0xa349('0x8e'));_0x4391b4[_0xa349('0x4d')]('i.*');_0x4391b4[_0xa349('0x4d')](_0xa349('0xa1'),_0xa349('0xa2'));_0x4391b4[_0xa349('0x4d')](_0xa349('0xa3'),'Contact.lastName');_0x4391b4[_0xa349('0x4d')](_0xa349('0xa4'),_0xa349('0xa5'));_0x4391b4['field'](_0xa349('0xa6'),'Contact.phone');_0x4391b4[_0xa349('0x4d')](_0xa349('0xa7'),_0xa349('0xa8'));_0x4391b4['field'](_0xa349('0xa9'),'Contact.fax');_0x4391b4['field']('o.fullname','Owner.fullname');_0x4391b4[_0xa349('0x4d')](_0xa349('0xaa'),_0xa349('0xab'));_0x4391b4[_0xa349('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa349('0x2f'));}if(_0x2644ae[_0xa349('0x23')])_0x4391b4[_0xa349('0x23')](_0x2644ae[_0xa349('0x23')]);if(_0x2644ae['offset'])_0x4391b4['offset'](_0x2644ae[_0xa349('0x22')]);return db[_0xa349('0x99')][_0xa349('0x42')](_0x4391b4[_0xa349('0x9a')](),_0x4bf7a9);})[_0xa349('0x29')](function(_0x464737){if(_0x464737[_0xa349('0x46')]>0x0)_0x39ad69['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xa349('0x2e')](_0x464737,'id'));return db[_0xa349('0x99')][_0xa349('0x42')](_0x39ad69[_0xa349('0x9a')](),_0x4bf7a9)['then'](function(_0x4f6eca){var _0x40cdf5=_['groupBy'](_0x4f6eca,'SmsInteractionId');var _0x126b9b=[];_0x464737['forEach'](function(_0x3a7002){_0x126b9b[_0xa349('0x32')](updateSmsInteraction(_0x3a7002,_0x3478db,_0x40cdf5));});return BPromise['all'](_0x126b9b);});});})[_0xa349('0x29')](function(_0x56c0e2){_0x35083a[_0xa349('0xac')]=_0x56c0e2;return _0x35083a;})[_0xa349('0x29')](respondWithFilteredResult(_0xace705,_0x2644ae))[_0xa349('0x33')](handleError(_0xace705,null));};exports['show']=function(_0x54f56f,_0x790d1c){var _0x21b879={'raw':![],'where':{'id':_0x54f56f[_0xa349('0xad')]['id']}},_0x534b6e={};_0x534b6e[_0xa349('0x40')]=_[_0xa349('0x41')](db[_0xa349('0x9c')][_0xa349('0x3c')]);_0x534b6e['query']=_[_0xa349('0x41')](_0x54f56f['query']);_0x534b6e[_0xa349('0x43')]=_[_0xa349('0xae')](_0x534b6e[_0xa349('0x40')],_0x534b6e[_0xa349('0x42')]);_0x21b879[_0xa349('0x44')]=_[_0xa349('0xae')](_0x534b6e[_0xa349('0x40')],qs['fields'](_0x54f56f[_0xa349('0x42')][_0xa349('0x45')]));_0x21b879[_0xa349('0x44')]=_0x21b879['attributes'][_0xa349('0x46')]?_0x21b879['attributes']:_0x534b6e[_0xa349('0x40')];if(_0x54f56f[_0xa349('0x42')][_0xa349('0xaf')]){_0x21b879['include']=[{'all':!![]}];}_0x21b879=_[_0xa349('0xb0')]({},_0x21b879,_0x54f56f[_0xa349('0xb1')]);return db[_0xa349('0x9c')]['find'](_0x21b879)[_0xa349('0x29')](handleEntityNotFound(_0x790d1c,null))[_0xa349('0x29')](respondWithResult(_0x790d1c,null))['catch'](handleError(_0x790d1c,null));};exports[_0xa349('0xb2')]=function(_0xed1640,_0x427d08){return db[_0xa349('0x9c')]['create'](_0xed1640[_0xa349('0x76')],{})[_0xa349('0x29')](respondWithResult(_0x427d08,0xc9))[_0xa349('0x33')](handleError(_0x427d08,null));};exports[_0xa349('0xb3')]=function(_0x31244f,_0x413144){if(_0x31244f[_0xa349('0x76')]['id']){delete _0x31244f[_0xa349('0x76')]['id'];}return db['SmsInteraction'][_0xa349('0x6c')]({'where':{'id':_0x31244f[_0xa349('0xad')]['id']}})['then'](handleEntityNotFound(_0x413144,null))[_0xa349('0x29')](saveUpdates(_0x31244f[_0xa349('0x76')],null))['then'](respondWithResult(_0x413144,null))[_0xa349('0x33')](handleError(_0x413144,null));};exports['destroy']=function(_0x11ef9c,_0x340895){return db['SmsInteraction'][_0xa349('0x6c')]({'where':{'id':_0x11ef9c[_0xa349('0xad')]['id']}})[_0xa349('0x29')](handleEntityNotFound(_0x340895,null))[_0xa349('0x29')](removeEntity(_0x340895,null))['catch'](handleError(_0x340895,null));};exports['describe']=function(_0x32bd15,_0x12eb70){return db['SmsInteraction'][_0xa349('0xb4')]()[_0xa349('0x29')](respondWithResult(_0x12eb70,null))[_0xa349('0x33')](handleError(_0x12eb70,null));};exports[_0xa349('0xb5')]=function(_0x43f552,_0x5c473b,_0x5c2248){return db[_0xa349('0xb6')][_0xa349('0x6c')]({'where':{'id':_0x43f552[_0xa349('0xad')]['id']}})[_0xa349('0x29')](handleEntityNotFound(_0x5c473b,null))[_0xa349('0x29')](function(_0x5a2ef7){if(_0x5a2ef7){return _0x5a2ef7[_0xa349('0xb5')](_0x43f552[_0xa349('0x76')][_0xa349('0xb7')],_[_0xa349('0xb8')](_0x43f552[_0xa349('0x76')],[_0xa349('0xb7'),'id'])||{});}})[_0xa349('0x29')](respondWithResult(_0x5c473b,null))[_0xa349('0x33')](handleError(_0x5c473b,null));};exports[_0xa349('0xb9')]=function(_0x30a907,_0x533cfc,_0x52e2f9){var _0x37eb7c={'raw':![],'where':{}};var _0x340715={};var _0x507e3f={'count':0x0,'rows':[]};return db[_0xa349('0x9c')][_0xa349('0xba')]({'where':{'id':_0x30a907[_0xa349('0xad')]['id']}})[_0xa349('0x29')](handleEntityNotFound(_0x533cfc,null))[_0xa349('0x29')](function(_0x4dc0aa){if(_0x4dc0aa){_0x340715['model']=_[_0xa349('0x41')](db[_0xa349('0xb6')][_0xa349('0x3c')]);_0x340715['query']=_[_0xa349('0x41')](_0x30a907['query']);_0x340715['filters']=_[_0xa349('0xae')](_0x340715['model'],_0x340715['query']);_0x37eb7c['attributes']=_[_0xa349('0xae')](_0x340715[_0xa349('0x40')],qs['fields'](_0x30a907[_0xa349('0x42')][_0xa349('0x45')]));_0x37eb7c[_0xa349('0x44')]=_0x37eb7c['attributes'][_0xa349('0x46')]?_0x37eb7c[_0xa349('0x44')]:_0x340715[_0xa349('0x40')];if(!_0x30a907[_0xa349('0x42')][_0xa349('0x47')]('nolimit')){_0x37eb7c['limit']=qs[_0xa349('0x23')](_0x30a907[_0xa349('0x42')][_0xa349('0x23')]);_0x37eb7c[_0xa349('0x22')]=qs['offset'](_0x30a907[_0xa349('0x42')][_0xa349('0x22')]);}_0x37eb7c[_0xa349('0x49')]=qs[_0xa349('0x4a')](_0x30a907[_0xa349('0x42')][_0xa349('0x4a')]);_0x37eb7c[_0xa349('0x4b')]=qs[_0xa349('0x43')](_[_0xa349('0xbb')](_0x30a907['query'],_0x340715[_0xa349('0x43')]));_0x37eb7c['where'][_0xa349('0xbc')]=_0x4dc0aa['id'];if(_0x30a907[_0xa349('0x42')][_0xa349('0x85')]){_0x37eb7c['where']=_[_0xa349('0xb0')](_0x37eb7c['where'],{'$or':_['map'](_0x37eb7c[_0xa349('0x44')],function(_0x1c0c70){var _0x5b5163={};_0x5b5163[_0x1c0c70]={'$like':'%'+_0x30a907['query']['filter']+'%'};return _0x5b5163;})});}if(_0x30a907[_0xa349('0x42')][_0xa349('0x7b')]){var _0x25aa3f=_0x30a907['query'][_0xa349('0x7b')]['split'](',');var _0x3b6992={};_0x3b6992[_0x25aa3f[0x0]]={'$gte':moment(_0x25aa3f[0x1])[_0xa349('0xbd')](_0xa349('0xbe'))};_0x37eb7c[_0xa349('0x4b')]=_['merge'](_0x37eb7c['where'],_0x3b6992);}_0x37eb7c=_[_0xa349('0xb0')]({},_0x37eb7c,_0x30a907[_0xa349('0xb1')]);return db[_0xa349('0xb6')][_0xa349('0x24')]({'where':_0x37eb7c[_0xa349('0x4b')]})[_0xa349('0x29')](function(_0x59461c){_0x507e3f['count']=_0x59461c;if(_0x30a907['query'][_0xa349('0xaf')]){_0x37eb7c[_0xa349('0xbf')]=[{'all':!![]}];}return db['SmsMessage'][_0xa349('0xc0')](_0x37eb7c);})[_0xa349('0x29')](function(_0x21138e){_0x507e3f['rows']=_0x21138e;return _0x507e3f;});}})[_0xa349('0x29')](respondWithFilteredResult(_0x533cfc,_0x37eb7c))[_0xa349('0x33')](handleError(_0x533cfc,null));};exports[_0xa349('0xc1')]=function(_0x1a1712,_0x5f2808,_0xf40c57){return db['SmsInteraction'][_0xa349('0x6c')]({'where':{'id':_0x1a1712[_0xa349('0xad')]['id']}})[_0xa349('0x29')](handleEntityNotFound(_0x5f2808,null))[_0xa349('0x29')](function(_0x45cd9b){if(_0x45cd9b){return _0x45cd9b[_0xa349('0xc2')](_0x1a1712[_0xa349('0x76')][_0xa349('0xb7')],_[_0xa349('0xb8')](_0x1a1712[_0xa349('0x76')],[_0xa349('0xb7'),'id'])||{})[_0xa349('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0xa349('0x2c'),_0xa349('0x4e')],'where':{'id':_0x1a1712[_0xa349('0x76')][_0xa349('0xb7')]}});})[_0xa349('0x29')](function(_0x2fd60a){socket[_0xa349('0xc4')](_0xa349('0xc5'),{'id':Number(_0x1a1712['params']['id']),'tags':_0x2fd60a||[]});return{'id':Number(_0x1a1712[_0xa349('0xad')]['id']),'tags':_0x2fd60a||[]};});}})[_0xa349('0x29')](respondWithResult(_0x5f2808,null))['catch'](handleError(_0x5f2808,null));};exports[_0xa349('0xc6')]=function(_0x13c39c,_0x520265,_0x2dc840){return db[_0xa349('0x9c')][_0xa349('0x6c')]({'where':{'id':_0x13c39c[_0xa349('0xad')]['id']}})[_0xa349('0x29')](handleEntityNotFound(_0x520265,null))[_0xa349('0x29')](function(_0x16c9be){if(_0x16c9be){return _0x16c9be['removeTags'](_0x13c39c[_0xa349('0x42')][_0xa349('0xb7')]);}})[_0xa349('0x29')](respondWithStatusCode(_0x520265,null))[_0xa349('0x33')](handleError(_0x520265,null));};exports[_0xa349('0xc7')]=function(_0x2cdab2,_0x1f12b6){var _0xfbbc9a=moment()[_0xa349('0xc8')]()[_0xa349('0x9a')]();var _0x1821a3=path[_0xa349('0xc9')](config[_0xa349('0xca')],_0xa349('0xcb'),'files','tmp');var _0x5920c7=path['join'](config[_0xa349('0xca')],_0xa349('0xcb'),'files','attachments');var _0xadb22d=path[_0xa349('0xc9')](_0x1821a3,_0xfbbc9a);var _0x3645be=util[_0xa349('0xbd')]('transcript-%d-%s.zip',_0x2cdab2[_0xa349('0xad')]['id'],_0xfbbc9a);var _0x6717b1=path[_0xa349('0xc9')](_0x1821a3,_0x3645be);var _0x5971a6=[];_0x5971a6[_0xa349('0x32')]({'model':db['User'],'as':_0xa349('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x5971a6['push']({'model':db[_0xa349('0xcc')],'as':'Contact','attributes':['id',_0xa349('0xcd'),'lastName'],'raw':!![]});var _0x532f77=[{'model':db[_0xa349('0xb6')],'as':_0xa349('0xce'),'attributes':['id',_0xa349('0x76'),_0xa349('0x79'),_0xa349('0xcf'),_0xa349('0xd0'),_0xa349('0x81')],'include':_0x5971a6}];_0x532f77[_0xa349('0x32')]({'model':db[_0xa349('0xd1')],'as':_0xa349('0xd2'),'attributes':['id','name']});_0x532f77[_0xa349('0x32')]({'model':db['User'],'as':'Owner','attributes':['id',_0xa349('0xd3')]});return db[_0xa349('0x9c')][_0xa349('0x6c')]({'where':{'id':_0x2cdab2['params']['id']},'include':_0x532f77})[_0xa349('0x29')](handleEntityNotFound(_0x1f12b6,null))[_0xa349('0x29')](function(_0x224be0){if(_0x224be0){var _0x30f979=_0x224be0[_0xa349('0xd4')]({'plain':!![]});fs[_0xa349('0xd5')](_0xadb22d);var _0x2883b0={'channel':_0xa349('0xd6'),'account':_0x30f979[_0xa349('0xd2')]['name'],'agent':_0x30f979[_0xa349('0xd7')]?_0x30f979['Owner']['fullname']:_0xa349('0xd8'),'createdAt':moment(_0x30f979[_0xa349('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa349('0x9a')](),'closedAt':_0x30f979[_0xa349('0x39')]?moment(_0x30f979[_0xa349('0xd9')])['format'](_0xa349('0xbe'))[_0xa349('0x9a')]():'','disposition':_0x30f979[_0xa349('0xda')],'messages':_(_0x30f979[_0xa349('0xce')])['filter']({'secret':![]})['map'](function(_0x15284b){return{'date':moment(_0x15284b[_0xa349('0x79')])[_0xa349('0xbd')](_0xa349('0xbe'))['toString'](),'sender':_0x15284b[_0xa349('0xcf')]===_0xa349('0xdb')?_0x15284b[_0xa349('0x72')]?_0x15284b[_0xa349('0x72')][_0xa349('0xd3')]:_0xa349('0xdc'):_0x15284b[_0xa349('0x66')][_0xa349('0xcd')]+(_0x15284b[_0xa349('0x66')]['lastName']?'\x20'+_0x15284b[_0xa349('0x66')][_0xa349('0xdd')]:''),'body':_0x15284b[_0xa349('0x76')],'direction':_0x15284b[_0xa349('0xcf')]===_0xa349('0xdb')?'A':'C','secret':_0x15284b[_0xa349('0xd0')],'read':_0x15284b[_0xa349('0x81')]};})[_0xa349('0x63')]()};return ejs[_0xa349('0xde')](path[_0xa349('0xc9')](config[_0xa349('0xca')],_0xa349('0xcb'),_0xa349('0xdf'),'downloadInteraction.ejs'),{'interaction':_0x2883b0})['then'](function(_0x2b26e6){var _0x172664=path[_0xa349('0xc9')](_0xadb22d,_0xa349('0xe0')+_0x30f979['id']+'-'+_0xfbbc9a+_0xa349('0xe1'));var _0x4b43d0={'path':_0x172664,'channel':'Sms','interactionId':_0x30f979['id']};return pdf[_0xa349('0xe2')](_0x2b26e6,_0x4b43d0);})[_0xa349('0x29')](function(){return new BPromise(function(_0x54a6c8,_0x4a230f){zipdir(_0xadb22d,{'saveTo':_0x6717b1},function(_0x251381,_0x5dd3b3){if(_0x251381)return _0x4a230f(_0x251381);return _0x54a6c8(_0x5dd3b3);});})[_0xa349('0x29')](function(){return new BPromise(function(_0x12022f,_0x12664a){rimraf(_0xadb22d,function(_0xa16e92){if(_0xa16e92)_0x12664a(_0xa16e92);return _0x12022f();});});})[_0xa349('0x29')](function(){return _0x1f12b6[_0xa349('0xc7')](_0x6717b1,_0x3645be,function(_0x1c371b){if(_0x1c371b){console[_0xa349('0xe3')](_0xa349('0xe4'),_0x1c371b);}else{fs[_0xa349('0xe5')](_0x6717b1);}});});});}else{return _0x1f12b6['sendStatus'](0xc8);}})['catch'](handleError(_0x1f12b6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 311dc66..5329e7a 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 _0x757a=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','../../mysqldb','SmsInteraction','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x757a,0xde));var _0xa757=function(_0x557881,_0xefcd5c){_0x557881=_0x557881-0x0;var _0xb08852=_0x757a[_0x557881];return _0xb08852;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa757('0x2'),'afterUpdate':_0xa757('0x3'),'afterDestroy':_0xa757('0x4')};function emitEvent(_0x453d07){return function(_0x32630d,_0x3caeb0,_0x5edca8){_0x32630d[_0xa757('0x5')]({'attributes':['id'],'raw':!![]})[_0xa757('0x6')](function(_0x53be0e){_0x32630d[_0xa757('0x7')](_0xa757('0x8'),_0x53be0e[_0xa757('0x9')](function(_0x1a95ee){return{'id':_0x1a95ee['id']};}));return SmsMessage[_0xa757('0xa')]({'where':{'SmsInteractionId':_0x32630d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x89c630){_0x32630d[_0xa757('0x7')](_0xa757('0xb'),_0x89c630[_0xa757('0xc')]);SmsInteractionEvents[_0xa757('0xd')](_0x453d07+':'+_0x32630d['id'],_0x32630d);SmsInteractionEvents[_0xa757('0xd')](_0x453d07,_0x32630d);_0x5edca8(null);})[_0xa757('0xe')](_0x5edca8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xf4f4=['findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0xb35682,_0x480e14){_0xb35682=_0xb35682-0x0;var _0x3d8b4e=_0xf4f4[_0xb35682];return _0x3d8b4e;};'use strict';var EventEmitter=require(_0x4f4f('0x0'));var SmsInteraction=require(_0x4f4f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4f4f('0x1'))['db'][_0x4f4f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4f4f('0x3')](0x0);var events={'afterCreate':_0x4f4f('0x4'),'afterUpdate':_0x4f4f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5a752b){return function(_0x593952,_0x3f274d,_0x132d5c){_0x593952[_0x4f4f('0x6')]({'attributes':['id'],'raw':!![]})[_0x4f4f('0x7')](function(_0x3c4877){_0x593952[_0x4f4f('0x8')](_0x4f4f('0x9'),_0x3c4877[_0x4f4f('0xa')](function(_0x48f6b9){return{'id':_0x48f6b9['id']};}));return SmsMessage[_0x4f4f('0xb')]({'where':{'SmsInteractionId':_0x593952['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f4f('0x7')](function(_0x39e36b){_0x593952[_0x4f4f('0x8')](_0x4f4f('0xc'),_0x39e36b[_0x4f4f('0xd')]);SmsInteractionEvents[_0x4f4f('0xe')](_0x5a752b+':'+_0x593952['id'],_0x593952);SmsInteractionEvents[_0x4f4f('0xe')](_0x5a752b,_0x593952);_0x132d5c(null);})['catch'](_0x132d5c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4f4f('0xf')](e,emitEvent(event));}}module[_0x4f4f('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 04ba0fa..e9d8b9f 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 _0x75e2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3d1911,_0x2e34fd){var _0x253f88=function(_0x248d9){while(--_0x248d9){_0x3d1911['push'](_0x3d1911['shift']());}};_0x253f88(++_0x2e34fd);}(_0x75e2,0xed));var _0x275e=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x75e2[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0x275e('0x0'));var util=require(_0x275e('0x1'));var logger=require(_0x275e('0x2'))('api');var moment=require(_0x275e('0x3'));var BPromise=require(_0x275e('0x4'));var rp=require(_0x275e('0x5'));var fs=require('fs');var path=require(_0x275e('0x6'));var rimraf=require(_0x275e('0x7'));var config=require(_0x275e('0x8'));var attributes=require(_0x275e('0x9'));module[_0x275e('0xa')]=function(_0x291e7e,_0x32309a){return _0x291e7e['define']('SmsInteraction',attributes,{'tableName':_0x275e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x401c89,_0x54b389,_0x4d5637){if(_0x401c89[_0x275e('0xc')](_0x275e('0xd'))){_0x401c89[_0x275e('0xe')]=moment()['format'](_0x275e('0xf'));}_0x4d5637(null,_0x401c89);}}});}; \ No newline at end of file +var _0xa940=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x354e35,_0x44c128){var _0x3c597c=function(_0x5b1887){while(--_0x5b1887){_0x354e35['push'](_0x354e35['shift']());}};_0x3c597c(++_0x44c128);}(_0xa940,0x111));var _0x0a94=function(_0xdc11f7,_0x2e8d05){_0xdc11f7=_0xdc11f7-0x0;var _0x56948d=_0xa940[_0xdc11f7];return _0x56948d;};'use strict';var _=require(_0x0a94('0x0'));var util=require(_0x0a94('0x1'));var logger=require(_0x0a94('0x2'))(_0x0a94('0x3'));var moment=require(_0x0a94('0x4'));var BPromise=require(_0x0a94('0x5'));var rp=require(_0x0a94('0x6'));var fs=require('fs');var path=require(_0x0a94('0x7'));var rimraf=require(_0x0a94('0x8'));var config=require(_0x0a94('0x9'));var attributes=require(_0x0a94('0xa'));module[_0x0a94('0xb')]=function(_0xf07c3b,_0x2d3067){return _0xf07c3b[_0x0a94('0xc')](_0x0a94('0xd'),attributes,{'tableName':_0x0a94('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a8ed4,_0x3c754b,_0x4da8b9){if(_0x3a8ed4[_0x0a94('0xf')](_0x0a94('0x10'))){_0x3a8ed4[_0x0a94('0x11')]=moment()[_0x0a94('0x12')](_0x0a94('0x13'));}_0x4da8b9(null,_0x3a8ed4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 45a3fcc..9fc62dd 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 _0xcde6=['body','options','raw','where','then','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xcde6,0x142));var _0x6cde=function(_0x523bd9,_0x243869){_0x523bd9=_0x523bd9-0x0;var _0x49b2a2=_0xcde6[_0x523bd9];return _0x49b2a2;};'use strict';var _=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var moment=require('moment');var BPromise=require(_0x6cde('0x2'));var rs=require(_0x6cde('0x3'));var fs=require('fs');var Redis=require(_0x6cde('0x4'));var db=require(_0x6cde('0x5'))['db'];var utils=require(_0x6cde('0x6'));var logger=require(_0x6cde('0x7'))(_0x6cde('0x8'));var config=require(_0x6cde('0x9'));var jayson=require(_0x6cde('0xa'));var client=jayson[_0x6cde('0xb')][_0x6cde('0xc')]({'port':0x232a});config[_0x6cde('0xd')]=_[_0x6cde('0xe')](config[_0x6cde('0xd')],{'host':_0x6cde('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cde('0xd')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3e4557,_0x3cb8f9,_0x1fe9de){return new BPromise(function(_0x4b6b9c,_0x113cdc){return client[_0x6cde('0x10')](_0x3e4557,_0x1fe9de)['then'](function(_0x5f4d15){logger[_0x6cde('0x11')](_0x6cde('0x12'),_0x3cb8f9,_0x6cde('0x13'));logger[_0x6cde('0x14')](_0x6cde('0x15'),_0x3cb8f9,_0x6cde('0x13'),JSON[_0x6cde('0x16')](_0x5f4d15));if(_0x5f4d15[_0x6cde('0x17')]){if(_0x5f4d15[_0x6cde('0x17')][_0x6cde('0x18')]===0x1f4){logger[_0x6cde('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3cb8f9,_0x5f4d15[_0x6cde('0x17')][_0x6cde('0x19')]);return _0x113cdc(_0x5f4d15[_0x6cde('0x17')][_0x6cde('0x19')]);}logger[_0x6cde('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3cb8f9,_0x5f4d15['error'][_0x6cde('0x19')]);return _0x4b6b9c(_0x5f4d15[_0x6cde('0x17')][_0x6cde('0x19')]);}else{logger[_0x6cde('0x11')](_0x6cde('0x12'),_0x3cb8f9,_0x6cde('0x13'));_0x4b6b9c(_0x5f4d15['result'][_0x6cde('0x19')]);}})[_0x6cde('0x1a')](function(_0x33aa73){logger[_0x6cde('0x17')](_0x6cde('0x12'),_0x3cb8f9,_0x33aa73);_0x113cdc(_0x33aa73);});});}exports[_0x6cde('0x1b')]=function(_0xb3503){var _0x5d80fb=this;return new Promise(function(_0x5c3ce6,_0x3eed22){return db[_0x6cde('0x1c')]['update'](_0xb3503[_0x6cde('0x1d')],{'raw':_0xb3503[_0x6cde('0x1e')]?_0xb3503[_0x6cde('0x1e')][_0x6cde('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb3503['options']?_0xb3503[_0x6cde('0x1e')][_0x6cde('0x20')]||null:null,'attributes':_0xb3503[_0x6cde('0x1e')]?_0xb3503[_0x6cde('0x1e')]['attributes']||null:null,'limit':_0xb3503[_0x6cde('0x1e')]?_0xb3503[_0x6cde('0x1e')]['limit']||null:null})[_0x6cde('0x21')](function(_0x4de3f6){logger['info'](_0x6cde('0x1b'),_0xb3503);logger[_0x6cde('0x14')](_0x6cde('0x1b'),_0xb3503,JSON[_0x6cde('0x16')](_0x4de3f6));_0x5c3ce6(_0x4de3f6);})[_0x6cde('0x1a')](function(_0x5d53a0){logger[_0x6cde('0x17')](_0x6cde('0x1b'),_0x5d53a0[_0x6cde('0x19')],_0xb3503);_0x3eed22(_0x5d80fb[_0x6cde('0x17')](0x1f4,_0x5d53a0[_0x6cde('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x597f95){return new Promise(function(_0xb468f6,_0x1b1946){return db[_0x6cde('0x1c')][_0x6cde('0x22')]({'where':_0x597f95[_0x6cde('0x1e')]?_0x597f95[_0x6cde('0x1e')][_0x6cde('0x20')]||null:null})['then'](function(_0x121671){if(_0x121671){return _0x121671[_0x6cde('0x23')](_0x597f95['body']['ids'],_['omit'](_0x597f95[_0x6cde('0x1d')],[_0x6cde('0x24'),'id'])||{});}})[_0x6cde('0x25')](function(_0x443ba6){logger[_0x6cde('0x11')](_0x6cde('0x26'),_0x597f95);logger[_0x6cde('0x14')]('AddTags',_0x597f95,JSON[_0x6cde('0x16')](_0x443ba6));_0xb468f6(_0x443ba6);})[_0x6cde('0x1a')](function(_0x48910b){logger['error'](_0x6cde('0x26'),_0x48910b[_0x6cde('0x19')],_0x597f95);_0x1b1946(_this['error'](0x1f4,_0x48910b[_0x6cde('0x19')]));});});}; \ No newline at end of file +var _0x4ea5=['UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','AddTagsToSmsInteraction','then','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','socket.io-emitter','./smsInteraction.socket','register','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','info','result','catch'];(function(_0x1661fc,_0x36c5e5){var _0x15366c=function(_0x1d0089){while(--_0x1d0089){_0x1661fc['push'](_0x1661fc['shift']());}};_0x15366c(++_0x36c5e5);}(_0x4ea5,0x1bd));var _0x54ea=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4ea5[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x54ea('0x0'));var util=require(_0x54ea('0x1'));var moment=require('moment');var BPromise=require(_0x54ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54ea('0x3'));var db=require(_0x54ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x54ea('0x5'))(_0x54ea('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x54ea('0x7')]['http']({'port':0x232a});config[_0x54ea('0x8')]=_['defaults'](config[_0x54ea('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x54ea('0x9'))(new Redis(config[_0x54ea('0x8')]));require(_0x54ea('0xa'))[_0x54ea('0xb')](socket);function respondWithRpcPromise(_0x41d139,_0x4c3b34,_0x463f00){return new BPromise(function(_0x23abfd,_0x57aefb){return client['request'](_0x41d139,_0x463f00)['then'](function(_0x26099){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4c3b34,_0x54ea('0xc'));logger[_0x54ea('0xd')](_0x54ea('0xe'),_0x4c3b34,_0x54ea('0xc'),JSON[_0x54ea('0xf')](_0x26099));if(_0x26099[_0x54ea('0x10')]){if(_0x26099[_0x54ea('0x10')][_0x54ea('0x11')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4c3b34,_0x26099[_0x54ea('0x10')][_0x54ea('0x12')]);return _0x57aefb(_0x26099['error'][_0x54ea('0x12')]);}logger[_0x54ea('0x10')](_0x54ea('0x13'),_0x4c3b34,_0x26099[_0x54ea('0x10')][_0x54ea('0x12')]);return _0x23abfd(_0x26099['error']['message']);}else{logger[_0x54ea('0x14')](_0x54ea('0x13'),_0x4c3b34,'request\x20sent');_0x23abfd(_0x26099[_0x54ea('0x15')][_0x54ea('0x12')]);}})[_0x54ea('0x16')](function(_0x50bef2){logger[_0x54ea('0x10')](_0x54ea('0x13'),_0x4c3b34,_0x50bef2);_0x57aefb(_0x50bef2);});});}exports[_0x54ea('0x17')]=function(_0xf12cb6){var _0x51a817=this;return new Promise(function(_0x186303,_0x4b0cbe){return db[_0x54ea('0x18')]['update'](_0xf12cb6[_0x54ea('0x19')],{'raw':_0xf12cb6[_0x54ea('0x1a')]?_0xf12cb6[_0x54ea('0x1a')][_0x54ea('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf12cb6[_0x54ea('0x1a')]?_0xf12cb6[_0x54ea('0x1a')][_0x54ea('0x1c')]||null:null,'attributes':_0xf12cb6[_0x54ea('0x1a')]?_0xf12cb6[_0x54ea('0x1a')]['attributes']||null:null,'limit':_0xf12cb6[_0x54ea('0x1a')]?_0xf12cb6['options'][_0x54ea('0x1d')]||null:null})['then'](function(_0x43a48d){logger[_0x54ea('0x14')](_0x54ea('0x17'),_0xf12cb6);logger[_0x54ea('0xd')](_0x54ea('0x17'),_0xf12cb6,JSON['stringify'](_0x43a48d));_0x186303(_0x43a48d);})[_0x54ea('0x16')](function(_0x3b8fd9){logger[_0x54ea('0x10')](_0x54ea('0x17'),_0x3b8fd9[_0x54ea('0x12')],_0xf12cb6);_0x4b0cbe(_0x51a817['error'](0x1f4,_0x3b8fd9[_0x54ea('0x12')]));});});};exports[_0x54ea('0x1e')]=function(_0x4349b1){return new Promise(function(_0x14c335,_0x3db230){return db[_0x54ea('0x18')]['find']({'where':_0x4349b1[_0x54ea('0x1a')]?_0x4349b1[_0x54ea('0x1a')][_0x54ea('0x1c')]||null:null})[_0x54ea('0x1f')](function(_0x4db934){if(_0x4db934){return _0x4db934['addTags'](_0x4349b1[_0x54ea('0x19')]['ids'],_[_0x54ea('0x20')](_0x4349b1[_0x54ea('0x19')],[_0x54ea('0x21'),'id'])||{});}})[_0x54ea('0x22')](function(_0x525844){logger[_0x54ea('0x14')](_0x54ea('0x23'),_0x4349b1);logger[_0x54ea('0xd')](_0x54ea('0x23'),_0x4349b1,JSON[_0x54ea('0xf')](_0x525844));_0x14c335(_0x525844);})[_0x54ea('0x16')](function(_0x41321a){logger[_0x54ea('0x10')](_0x54ea('0x23'),_0x41321a[_0x54ea('0x12')],_0x4349b1);_0x3db230(_this[_0x54ea('0x10')](0x1f4,_0x41321a[_0x54ea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1cccf63..ec0ef57 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 _0x481e=['smsInteraction:','remove','update','emit','removeListener','register','length'];(function(_0x4f3600,_0x456aae){var _0x4a0d68=function(_0x3ae024){while(--_0x3ae024){_0x4f3600['push'](_0x4f3600['shift']());}};_0x4a0d68(++_0x456aae);}(_0x481e,0x1dd));var _0xe481=function(_0x1553d6,_0x4e25b7){_0x1553d6=_0x1553d6-0x0;var _0x228be6=_0x481e[_0x1553d6];return _0x228be6;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xe481('0x0'),_0xe481('0x1')];function createListener(_0x2aaa75,_0x1b1a75){return function(_0x22e62e){_0x1b1a75[_0xe481('0x2')](_0x2aaa75,_0x22e62e);};}function removeListener(_0x22d5d1,_0x178f00){return function(){SmsInteractionEvents[_0xe481('0x3')](_0x22d5d1,_0x178f00);};}exports[_0xe481('0x4')]=function(_0x540ec0){for(var _0x336ac5=0x0,_0x310755=events[_0xe481('0x5')];_0x336ac5<_0x310755;_0x336ac5++){var _0x5a1e87=events[_0x336ac5];var _0x1b1b33=createListener(_0xe481('0x6')+_0x5a1e87,_0x540ec0);SmsInteractionEvents['on'](_0x5a1e87,_0x1b1b33);}}; \ No newline at end of file +var _0xe2fc=['emit','register','length','./smsInteraction.events','remove'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xe2fc,0xbc));var _0xce2f=function(_0x5a9ef0,_0x309444){_0x5a9ef0=_0x5a9ef0-0x0;var _0x334380=_0xe2fc[_0x5a9ef0];return _0x334380;};'use strict';var SmsInteractionEvents=require(_0xce2f('0x0'));var events=['save',_0xce2f('0x1'),'update'];function createListener(_0x3c2535,_0x29bddf){return function(_0x5311f7){_0x29bddf[_0xce2f('0x2')](_0x3c2535,_0x5311f7);};}function removeListener(_0x58fc12,_0x536987){return function(){SmsInteractionEvents['removeListener'](_0x58fc12,_0x536987);};}exports[_0xce2f('0x3')]=function(_0x3bd1fa){for(var _0x3f5850=0x0,_0x28b0df=events[_0xce2f('0x4')];_0x3f5850<_0x28b0df;_0x3f5850++){var _0x4126c6=events[_0x3f5850];var _0x53fdfb=createListener('smsInteraction:'+_0x4126c6,_0x3bd1fa);SmsInteractionEvents['on'](_0x4126c6,_0x53fdfb);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c866817..d268b12 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 _0x9ae8=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ae8,0x1d2));var _0x89ae=function(_0xce94e3,_0x112f55){_0xce94e3=_0xce94e3-0x0;var _0x347f05=_0x9ae8[_0xce94e3];return _0x347f05;};'use strict';var multer=require(_0x89ae('0x0'));var util=require(_0x89ae('0x1'));var path=require(_0x89ae('0x2'));var timeout=require('connect-timeout');var express=require(_0x89ae('0x3'));var router=express[_0x89ae('0x4')]();var fs_extra=require(_0x89ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89ae('0x6'));var config=require(_0x89ae('0x7'));var controller=require(_0x89ae('0x8'));router[_0x89ae('0x9')]('/',auth[_0x89ae('0xa')](),controller[_0x89ae('0xb')]);router[_0x89ae('0x9')]('/describe',auth[_0x89ae('0xa')](),controller['describe']);router[_0x89ae('0x9')](_0x89ae('0xc'),auth[_0x89ae('0xa')](),controller[_0x89ae('0xd')]);router[_0x89ae('0xe')]('/',auth[_0x89ae('0xa')](),interaction[_0x89ae('0xf')](_0x89ae('0x10'),_0x89ae('0x11')),controller[_0x89ae('0x12')]);router[_0x89ae('0xe')](_0x89ae('0x13'),controller[_0x89ae('0x14')]);router['put'](_0x89ae('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x89ae('0x15')](_0x89ae('0x16'),auth['isAuthenticated'](),controller[_0x89ae('0x17')]);router[_0x89ae('0x15')](_0x89ae('0x18'),auth[_0x89ae('0xa')](),controller[_0x89ae('0x19')]);router[_0x89ae('0x1a')](_0x89ae('0xc'),auth[_0x89ae('0xa')](),controller[_0x89ae('0x1b')]);module[_0x89ae('0x1c')]=router; \ No newline at end of file +var _0xe35d=['/describe','describe','/:id','show','post','sms','smsmessage:create','status','accept','put','reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x1b14dc,_0x27c459){var _0xb88448=function(_0xabfebc){while(--_0xabfebc){_0x1b14dc['push'](_0x1b14dc['shift']());}};_0xb88448(++_0x27c459);}(_0xe35d,0xd5));var _0xde35=function(_0x2af866,_0x368167){_0x2af866=_0x2af866-0x0;var _0x227a64=_0xe35d[_0x2af866];return _0x227a64;};'use strict';var multer=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde35('0x2'));var router=express[_0xde35('0x3')]();var fs_extra=require(_0xde35('0x4'));var auth=require(_0xde35('0x5'));var interaction=require(_0xde35('0x6'));var config=require(_0xde35('0x7'));var controller=require(_0xde35('0x8'));router[_0xde35('0x9')]('/',auth[_0xde35('0xa')](),controller[_0xde35('0xb')]);router['get'](_0xde35('0xc'),auth[_0xde35('0xa')](),controller[_0xde35('0xd')]);router[_0xde35('0x9')](_0xde35('0xe'),auth['isAuthenticated'](),controller[_0xde35('0xf')]);router[_0xde35('0x10')]('/',auth[_0xde35('0xa')](),interaction['tracked'](_0xde35('0x11'),_0xde35('0x12')),controller['create']);router[_0xde35('0x10')]('/:id/status',controller[_0xde35('0x13')]);router['put'](_0xde35('0xe'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xde35('0x14')]);router[_0xde35('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0xde35('0x16')]);router[_0xde35('0x17')](_0xde35('0xe'),auth[_0xde35('0xa')](),controller[_0xde35('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5be6355..fd2919c 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 _0xb6a9=['out','STRING','BOOLEAN','TEXT','sequelize','exports','medium','ENUM'];(function(_0x2fdef5,_0x34a29b){var _0x30ce36=function(_0xb2478f){while(--_0xb2478f){_0x2fdef5['push'](_0x2fdef5['shift']());}};_0x30ce36(++_0x34a29b);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb6a9[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x9b6a('0x0'));module[_0x9b6a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9b6a('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9b6a('0x3')]('in',_0x9b6a('0x4')),'defaultValue':_0x9b6a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9b6a('0x5')](0xbe)},'phone':{'type':Sequelize[_0x9b6a('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9b6a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9b6a('0x5')]},'providerResponse':{'type':Sequelize[_0x9b6a('0x7')]}}; \ No newline at end of file +var _0x8fa6=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x4fb428,_0x1605b7){var _0x252470=function(_0x38cc52){while(--_0x38cc52){_0x4fb428['push'](_0x4fb428['shift']());}};_0x252470(++_0x1605b7);}(_0x8fa6,0x1c0));var _0x68fa=function(_0x768a0a,_0x18eb52){_0x768a0a=_0x768a0a-0x0;var _0x2255a5=_0x8fa6[_0x768a0a];return _0x2255a5;};'use strict';var Sequelize=require(_0x68fa('0x0'));module[_0x68fa('0x1')]={'body':{'type':Sequelize[_0x68fa('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x68fa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x68fa('0x4')]('in',_0x68fa('0x5')),'defaultValue':_0x68fa('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x68fa('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x68fa('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e533304..73c8b75 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 _0x27d7=['MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','json','save','update','then','stack','name','send','index','map','SmsMessage','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','include','find','create','body','params','destroy','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','get','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio'];(function(_0x2dfefb,_0x583c75){var _0x233279=function(_0x38b6ce){while(--_0x38b6ce){_0x2dfefb['push'](_0x2dfefb['shift']());}};_0x233279(++_0x583c75);}(_0x27d7,0xa4));var _0x727d=function(_0x32ee50,_0x564493){_0x32ee50=_0x32ee50-0x0;var _0x12a1b3=_0x27d7[_0x32ee50];return _0x12a1b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x727d('0x0'));var jsonpatch=require(_0x727d('0x1'));var rp=require('request-promise');var moment=require(_0x727d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x727d('0x3'));var util=require(_0x727d('0x4'));var path=require(_0x727d('0x5'));var sox=require(_0x727d('0x6'));var csv=require('to-csv');var ejs=require(_0x727d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x727d('0x8'));var squel=require(_0x727d('0x9'));var crypto=require(_0x727d('0xa'));var jsforce=require(_0x727d('0xb'));var deskjs=require(_0x727d('0xc'));var toCsv=require(_0x727d('0xd'));var querystring=require(_0x727d('0xe'));var Papa=require(_0x727d('0xf'));var Redis=require(_0x727d('0x10'));var authService=require(_0x727d('0x11'));var qs=require(_0x727d('0x12'));var as=require(_0x727d('0x13'));var hardwareService=require(_0x727d('0x14'));var logger=require(_0x727d('0x15'))(_0x727d('0x16'));var utils=require(_0x727d('0x17'));var config=require(_0x727d('0x18'));var licenseUtil=require(_0x727d('0x19'));var db=require(_0x727d('0x1a'))['db'];config[_0x727d('0x1b')]=_[_0x727d('0x1c')](config[_0x727d('0x1b')],{'host':_0x727d('0x1d'),'port':0x18eb});var socket=require(_0x727d('0x1e'))(new Redis(config['redis']));require(_0x727d('0x1f'))[_0x727d('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x727d('0x21')][_0x727d('0x22')]({'port':0x232c});var client9002=jayson[_0x727d('0x21')][_0x727d('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3aea72,_0xa0ea9,_0x38b18e,_0x28aeac){return new BPromise(function(_0x25d831,_0x2e2ab2){var _0x5bda06=_0x28aeac||client;return _0x5bda06[_0x727d('0x23')](_0x3aea72,_0x38b18e)['then'](function(_0x1e8235){logger['info']('SmsMessage,\x20%s,\x20%s',_0xa0ea9,'request\x20sent');logger[_0x727d('0x24')](_0x727d('0x25'),_0xa0ea9,_0x727d('0x26'),JSON[_0x727d('0x27')](_0x1e8235));if(_0x1e8235['error']){if(_0x1e8235[_0x727d('0x28')][_0x727d('0x29')]===0x1f4){logger[_0x727d('0x28')]('SmsMessage,\x20%s,\x20%s',_0xa0ea9,_0x1e8235[_0x727d('0x28')][_0x727d('0x2a')]);return _0x2e2ab2(_0x1e8235[_0x727d('0x28')][_0x727d('0x2a')]);}logger[_0x727d('0x28')](_0x727d('0x2b'),_0xa0ea9,_0x1e8235['error'][_0x727d('0x2a')]);return _0x25d831(_0x1e8235[_0x727d('0x28')][_0x727d('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0xa0ea9,_0x727d('0x26'));_0x25d831(_0x1e8235[_0x727d('0x2c')][_0x727d('0x2a')]);}})[_0x727d('0x2d')](function(_0x251cc2){logger[_0x727d('0x28')](_0x727d('0x2b'),_0xa0ea9,_0x251cc2);_0x2e2ab2(_0x251cc2);});});}function respondWithStatusCode(_0x4a5404,_0x436f38){_0x436f38=_0x436f38||0xcc;return function(_0x4c1807){if(_0x4c1807){return _0x4a5404[_0x727d('0x2e')](_0x436f38);}return _0x4a5404['status'](_0x436f38)[_0x727d('0x2f')]();};}function respondWithResult(_0x5f1967,_0x13b64c){_0x13b64c=_0x13b64c||0xc8;return function(_0x47a2a4){if(_0x47a2a4){return _0x5f1967[_0x727d('0x30')](_0x13b64c)['json'](_0x47a2a4);}};}function respondWithFilteredResult(_0x43e66a,_0x1d3d3f){return function(_0x2e34ec){if(_0x2e34ec){var _0x40d3fd=typeof _0x1d3d3f[_0x727d('0x31')]==='undefined'&&typeof _0x1d3d3f[_0x727d('0x32')]===_0x727d('0x33');var _0x51df23=_0x2e34ec[_0x727d('0x34')];var _0x1dc99b=_0x40d3fd?0x0:_0x1d3d3f[_0x727d('0x31')];var _0xf5c855=_0x40d3fd?_0x2e34ec[_0x727d('0x34')]:_0x1d3d3f[_0x727d('0x31')]+_0x1d3d3f['limit'];var _0x418abc;if(_0xf5c855>=_0x51df23){_0xf5c855=_0x51df23;_0x418abc=0xc8;}else{_0x418abc=0xce;}_0x43e66a[_0x727d('0x30')](_0x418abc);return _0x43e66a[_0x727d('0x35')]('Content-Range',_0x1dc99b+'-'+_0xf5c855+'/'+_0x51df23)[_0x727d('0x36')](_0x2e34ec);}return null;};}function patchUpdates(_0x16a78d){return function(_0x1b878f){try{jsonpatch['apply'](_0x1b878f,_0x16a78d,!![]);}catch(_0x1bab0a){return BPromise['reject'](_0x1bab0a);}return _0x1b878f[_0x727d('0x37')]();};}function saveUpdates(_0x539dca,_0x42aa56){return function(_0xfdb50c){if(_0xfdb50c){return _0xfdb50c[_0x727d('0x38')](_0x539dca)[_0x727d('0x39')](function(_0x2b115c){return _0x2b115c;});}return null;};}function removeEntity(_0x29a8e8,_0x284abb){return function(_0x2954d1){if(_0x2954d1){return _0x2954d1['destroy']()[_0x727d('0x39')](function(){_0x29a8e8[_0x727d('0x30')](0xcc)[_0x727d('0x2f')]();});}};}function handleEntityNotFound(_0x26801a,_0xa47b6f){return function(_0x156bcc){if(!_0x156bcc){_0x26801a[_0x727d('0x2e')](0x194);}return _0x156bcc;};}function handleError(_0x173486,_0xaa6b1e){_0xaa6b1e=_0xaa6b1e||0x1f4;return function(_0x555d29){logger['error'](_0x555d29[_0x727d('0x3a')]);if(_0x555d29[_0x727d('0x3b')]){delete _0x555d29['name'];}_0x173486['status'](_0xaa6b1e)[_0x727d('0x3c')](_0x555d29);};}exports[_0x727d('0x3d')]=function(_0x244116,_0x2611ab){var _0x57cb77={},_0x45833a={},_0xf43896={'count':0x0,'rows':[]};var _0x1ac708=_[_0x727d('0x3e')](db[_0x727d('0x3f')]['rawAttributes'],function(_0x4b99b7){return{'name':_0x4b99b7[_0x727d('0x40')],'type':_0x4b99b7[_0x727d('0x41')]['key']};});_0x45833a[_0x727d('0x42')]=_[_0x727d('0x3e')](_0x1ac708,_0x727d('0x3b'));_0x45833a['query']=_[_0x727d('0x43')](_0x244116[_0x727d('0x44')]);_0x45833a[_0x727d('0x45')]=_[_0x727d('0x46')](_0x45833a[_0x727d('0x42')],_0x45833a[_0x727d('0x44')]);_0x57cb77[_0x727d('0x47')]=_[_0x727d('0x46')](_0x45833a[_0x727d('0x42')],qs[_0x727d('0x48')](_0x244116[_0x727d('0x44')][_0x727d('0x48')]));_0x57cb77[_0x727d('0x47')]=_0x57cb77[_0x727d('0x47')][_0x727d('0x49')]?_0x57cb77['attributes']:_0x45833a['model'];if(!_0x244116['query'][_0x727d('0x4a')](_0x727d('0x4b'))){_0x57cb77[_0x727d('0x32')]=qs['limit'](_0x244116['query'][_0x727d('0x32')]);_0x57cb77['offset']=qs[_0x727d('0x31')](_0x244116[_0x727d('0x44')][_0x727d('0x31')]);}_0x57cb77['order']=qs[_0x727d('0x4c')](_0x244116[_0x727d('0x44')]['sort']);_0x57cb77[_0x727d('0x4d')]=qs['filters'](_[_0x727d('0x4e')](_0x244116[_0x727d('0x44')],_0x45833a[_0x727d('0x45')]),_0x1ac708);if(_0x244116[_0x727d('0x44')][_0x727d('0x4f')]){_0x57cb77[_0x727d('0x4d')]=_[_0x727d('0x50')](_0x57cb77['where'],{'$or':_['map'](_0x1ac708,function(_0x44be3b){if(_0x44be3b[_0x727d('0x41')]!==_0x727d('0x51')){var _0x34544e={};_0x34544e[_0x44be3b['name']]={'$like':'%'+_0x244116[_0x727d('0x44')][_0x727d('0x4f')]+'%'};return _0x34544e;}})});}_0x57cb77=_['merge']({},_0x57cb77,_0x244116[_0x727d('0x52')]);var _0x1ee6fb={'where':_0x57cb77[_0x727d('0x4d')]};return db['SmsMessage'][_0x727d('0x34')](_0x1ee6fb)['then'](function(_0xd64553){_0xf43896[_0x727d('0x34')]=_0xd64553;if(_0x244116['query'][_0x727d('0x53')]){_0x57cb77['include']=[{'all':!![]}];}return db[_0x727d('0x3f')][_0x727d('0x54')](_0x57cb77);})[_0x727d('0x39')](function(_0x1e039d){_0xf43896[_0x727d('0x55')]=_0x1e039d;return _0xf43896;})[_0x727d('0x39')](respondWithFilteredResult(_0x2611ab,_0x57cb77))[_0x727d('0x2d')](handleError(_0x2611ab,null));};exports[_0x727d('0x56')]=function(_0x42e682,_0x3fbbdd){var _0x218e1d={'raw':!![],'where':{'id':_0x42e682['params']['id']}},_0x4817c7={};_0x4817c7['model']=_[_0x727d('0x43')](db['SmsMessage'][_0x727d('0x57')]);_0x4817c7[_0x727d('0x44')]=_['keys'](_0x42e682['query']);_0x4817c7[_0x727d('0x45')]=_['intersection'](_0x4817c7[_0x727d('0x42')],_0x4817c7[_0x727d('0x44')]);_0x218e1d['attributes']=_[_0x727d('0x46')](_0x4817c7[_0x727d('0x42')],qs[_0x727d('0x48')](_0x42e682['query'][_0x727d('0x48')]));_0x218e1d[_0x727d('0x47')]=_0x218e1d[_0x727d('0x47')][_0x727d('0x49')]?_0x218e1d[_0x727d('0x47')]:_0x4817c7[_0x727d('0x42')];if(_0x42e682[_0x727d('0x44')][_0x727d('0x53')]){_0x218e1d[_0x727d('0x58')]=[{'all':!![]}];}_0x218e1d=_[_0x727d('0x50')]({},_0x218e1d,_0x42e682[_0x727d('0x52')]);return db[_0x727d('0x3f')][_0x727d('0x59')](_0x218e1d)['then'](handleEntityNotFound(_0x3fbbdd,null))[_0x727d('0x39')](respondWithResult(_0x3fbbdd,null))['catch'](handleError(_0x3fbbdd,null));};exports[_0x727d('0x5a')]=function(_0x1ac24c,_0x29034f){return db['SmsMessage'][_0x727d('0x5a')](_0x1ac24c[_0x727d('0x5b')],{})[_0x727d('0x39')](respondWithResult(_0x29034f,0xc9))[_0x727d('0x2d')](handleError(_0x29034f,null));};exports[_0x727d('0x38')]=function(_0x12daf3,_0x398308){if(_0x12daf3[_0x727d('0x5b')]['id']){delete _0x12daf3['body']['id'];}return db[_0x727d('0x3f')][_0x727d('0x59')]({'where':{'id':_0x12daf3[_0x727d('0x5c')]['id']}})[_0x727d('0x39')](handleEntityNotFound(_0x398308,null))[_0x727d('0x39')](saveUpdates(_0x12daf3[_0x727d('0x5b')],null))['then'](respondWithResult(_0x398308,null))[_0x727d('0x2d')](handleError(_0x398308,null));};exports[_0x727d('0x5d')]=function(_0xeca0fb,_0x4c4456){return db[_0x727d('0x3f')][_0x727d('0x59')]({'where':{'id':_0xeca0fb[_0x727d('0x5c')]['id']}})[_0x727d('0x39')](handleEntityNotFound(_0x4c4456,null))['then'](removeEntity(_0x4c4456,null))[_0x727d('0x2d')](handleError(_0x4c4456,null));};exports[_0x727d('0x5e')]=function(_0x499615,_0x20cc03){return db['SmsMessage'][_0x727d('0x5e')]()[_0x727d('0x39')](respondWithResult(_0x20cc03,null))['catch'](handleError(_0x20cc03,null));};var interaction_log=require(_0x727d('0x15'))(_0x727d('0x5f'));exports['accept']=function(_0x49566f,_0x1b05d1,_0x2f77dc){var _0x141c28={'agent':{},'channel':_0x727d('0x60')};if(_0x49566f[_0x727d('0x5b')]['id']){delete _0x49566f['body']['id'];}_0x49566f[_0x727d('0x5b')][_0x727d('0x61')]=!![];_0x49566f[_0x727d('0x5b')]['readAt']=moment()['format'](_0x727d('0x62'));_0x49566f[_0x727d('0x5b')]['UserId']=_0x49566f['body'][_0x727d('0x63')]||_0x49566f[_0x727d('0x64')]['id'];_0x141c28[_0x727d('0x65')]['id']=_0x49566f[_0x727d('0x5b')][_0x727d('0x63')];return db[_0x727d('0x3f')][_0x727d('0x59')]({'where':{'id':_0x49566f[_0x727d('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1b05d1,null))['then'](saveUpdates(_0x49566f[_0x727d('0x5b')],null))['then'](function(_0x31a55c){if(_0x31a55c){_0x141c28[_0x727d('0x2a')]=_0x31a55c['get']({'plain':!![]});return db[_0x727d('0x66')][_0x727d('0x59')]({'where':{'id':_0x31a55c['SmsInteractionId']}});}return null;})[_0x727d('0x39')](handleEntityNotFound(_0x1b05d1,null))['then'](function(_0x52e7d3){if(_0x52e7d3){return _0x52e7d3['update']({'UserId':_0x49566f[_0x727d('0x5b')]['UserId'],'read1stAt':_[_0x727d('0x67')](_0x52e7d3[_0x727d('0x68')])?moment()[_0x727d('0x69')](_0x727d('0x62')):undefined});}return null;})[_0x727d('0x39')](function(_0x4469f0){if(_0x4469f0){_0x141c28['interaction']=_0x4469f0['get']({'plain':!![]});interaction_log['info'](_0x727d('0x6a'),_0x49566f[_0x727d('0x64')]['id'],_0x49566f[_0x727d('0x64')][_0x727d('0x3b')],_0x49566f[_0x727d('0x64')][_0x727d('0x6b')],_0x141c28[_0x727d('0x6c')]['id'],_0x49566f[_0x727d('0x5b')]?JSON[_0x727d('0x27')](_0x49566f[_0x727d('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x141c28);}return null;})[_0x727d('0x39')](function(_0x3cdccd){var _0x52bb80=_0x727d('0x6d')+_0x3cdccd['message'][_0x727d('0x6e')];return db[_0x727d('0x6f')][_0x727d('0x44')](_0x52bb80,{'type':db[_0x727d('0x70')][_0x727d('0x71')][_0x727d('0x72')],'raw':!![]})['then'](function(_0x5a6632){return _0x5a6632;});})[_0x727d('0x39')](function(_0x12a768){if(_0x12a768){_0x141c28[_0x727d('0x2a')][_0x727d('0x73')]=_0x12a768[0x0];if(!_0x49566f[_0x727d('0x5b')]['UserId'])return;return db[_0x727d('0x74')][_0x727d('0x59')]({'where':{'id':_0x49566f[_0x727d('0x5b')][_0x727d('0x63')],'role':'agent'},'attributes':['id','name','fullname','email',_0x727d('0x75')],'raw':!![]});}return null;})[_0x727d('0x39')](function(_0x48f9a5){if(!_0x48f9a5)return null;_0x141c28['message'][_0x727d('0x65')]=_0x48f9a5;return _0x141c28;})['then'](function(_0x362a12){if(_0x362a12){if(_0x49566f['body']['manual']){_0x141c28[_0x727d('0x2a')][_0x727d('0x76')]=util[_0x727d('0x69')](_0x727d('0x77'),_0x49566f['user'][_0x727d('0x3b')]);_0x141c28['message'][_0x727d('0x78')]=_0x141c28['channel'];_0x141c28['message'][_0x727d('0x79')]=_0x141c28[_0x727d('0x78')];_0x141c28[_0x727d('0x2a')][_0x727d('0x7a')]='accept';return respondWithRpcPromise('EventManager',_0x727d('0x7b'),{'event':_0x727d('0x7c'),'message':_0x141c28[_0x727d('0x2a')]},client9002)[_0x727d('0x39')](function(){return _0x141c28;});}return _0x141c28;}return null;})[_0x727d('0x39')](respondWithResult(_0x1b05d1,null))[_0x727d('0x2d')](handleError(_0x1b05d1,null));};var interaction_log=require(_0x727d('0x15'))(_0x727d('0x5f'));exports[_0x727d('0x7d')]=function(_0x39fbdb,_0x41d80e,_0x4a0d1b){var _0x2f8d85={'agent':{},'channel':'sms'};if(_0x39fbdb[_0x727d('0x5b')]['id']){delete _0x39fbdb[_0x727d('0x5b')]['id'];}_0x39fbdb['body'][_0x727d('0x63')]=_0x39fbdb['body'][_0x727d('0x63')]||_0x39fbdb[_0x727d('0x64')]['id'];_0x2f8d85[_0x727d('0x65')]['id']=_0x39fbdb[_0x727d('0x5b')][_0x727d('0x63')];return db[_0x727d('0x3f')][_0x727d('0x59')]({'where':{'id':_0x39fbdb[_0x727d('0x5c')]['id'],'UserId':null}})[_0x727d('0x39')](handleEntityNotFound(_0x41d80e,null))[_0x727d('0x39')](function(_0xfcdff4){if(_0xfcdff4){_0x2f8d85['message']=_0xfcdff4[_0x727d('0x7e')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0xfcdff4[_0x727d('0x7f')]}});}return null;})[_0x727d('0x39')](handleEntityNotFound(_0x41d80e,null))[_0x727d('0x39')](function(_0x5e0789){if(_0x5e0789){_0x2f8d85['interaction']=_0x5e0789['get']({'plain':!![]});interaction_log['info'](_0x727d('0x80'),_0x39fbdb['user']['id'],_0x39fbdb[_0x727d('0x64')][_0x727d('0x3b')],_0x39fbdb['user']['role'],_0x2f8d85[_0x727d('0x6c')]['id'],_0x39fbdb[_0x727d('0x5b')]?JSON['stringify'](_0x39fbdb[_0x727d('0x5b')]):'null');return respondWithRpcPromise(_0x727d('0x81'),_0x727d('0x82'),_0x2f8d85);}return null;})[_0x727d('0x39')](function(_0x5726e4){var _0x58dad6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5726e4['message'][_0x727d('0x6e')];return db['sequelize'][_0x727d('0x44')](_0x58dad6,{'type':db[_0x727d('0x70')]['QueryTypes'][_0x727d('0x72')],'raw':!![]})[_0x727d('0x39')](function(_0x5742a1){return _0x5742a1;});})[_0x727d('0x39')](function(_0x1a4b53){if(_0x1a4b53){_0x2f8d85[_0x727d('0x2a')][_0x727d('0x73')]=_0x1a4b53[0x0];if(!_0x39fbdb[_0x727d('0x5b')]['UserId'])return;return db[_0x727d('0x74')][_0x727d('0x59')]({'where':{'id':_0x39fbdb['body'][_0x727d('0x63')],'role':_0x727d('0x65')},'attributes':['id',_0x727d('0x3b'),_0x727d('0x83'),_0x727d('0x84'),_0x727d('0x75')],'raw':!![]});}return null;})[_0x727d('0x39')](function(_0x1540a2){if(!_0x1540a2)return null;_0x2f8d85['message'][_0x727d('0x65')]=_0x1540a2;return _0x2f8d85;})[_0x727d('0x39')](function(_0x8866ab){if(_0x8866ab){_0x8866ab['message'][_0x727d('0x76')]=util[_0x727d('0x69')](_0x727d('0x77'),_0x39fbdb[_0x727d('0x64')][_0x727d('0x3b')]);_0x8866ab[_0x727d('0x2a')][_0x727d('0x78')]=_0x2f8d85['channel'];_0x8866ab['message']['motionChannel']=_0x2f8d85['channel'];_0x8866ab[_0x727d('0x2a')][_0x727d('0x7a')]=_0x727d('0x7d');respondWithRpcPromise(_0x727d('0x7b'),_0x727d('0x7b'),{'event':_0x727d('0x85'),'message':_0x8866ab[_0x727d('0x2a')]},client9002);return _0x2f8d85;}return null;})[_0x727d('0x39')](respondWithResult(_0x41d80e,null))[_0x727d('0x2d')](handleError(_0x41d80e,null));};exports[_0x727d('0x30')]=function(_0x4e3f78,_0xadd668,_0x20412d){if(_0x4e3f78['body']['id']){delete _0x4e3f78[_0x727d('0x5b')]['id'];}var _0x2c93e0;return db[_0x727d('0x3f')][_0x727d('0x59')]({'where':{'id':_0x4e3f78[_0x727d('0x5c')]['id']}})['then'](handleEntityNotFound(_0xadd668,null))[_0x727d('0x39')](function(_0x4d7b3b){if(_0x4d7b3b){_0x2c93e0=_0x4d7b3b;return db[_0x727d('0x86')][_0x727d('0x59')]({'where':{'id':_0x4d7b3b[_0x727d('0x87')]}});}})[_0x727d('0x39')](handleEntityNotFound(_0xadd668,null))[_0x727d('0x39')](function(_0x2fa1af){if(_0x2fa1af){logger['debug'](_0x727d('0x25'),_0x727d('0x30'),_0x727d('0x88'),_0x2fa1af['type'],util['inspect'](_0x4e3f78['body'],{'showHidden':![],'depth':null}));switch(_0x2fa1af['type']){case _0x727d('0x89'):if(_0x4e3f78[_0x727d('0x5b')][_0x727d('0x8a')]&&_0x4e3f78[_0x727d('0x5b')]['MessageSid']===_0x2c93e0['messageId']){return _0x2c93e0['update']({'read':!![]});}else{logger[_0x727d('0x28')](_0x727d('0x8b'),_0x727d('0x30'),_0x727d('0x89'),util[_0x727d('0x8c')](_0x4e3f78[_0x727d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x727d('0x8d'):if(_0x4e3f78[_0x727d('0x5b')][_0x727d('0x8e')]&&_0x4e3f78[_0x727d('0x5b')][_0x727d('0x8e')]===_0x2c93e0['messageId']&&_[_0x727d('0x8f')]([_0x727d('0x90'),'delivered'],_0x4e3f78[_0x727d('0x5b')][_0x727d('0x91')])>=0x0){return _0x2c93e0['update']({'read':!![]});}else{logger['error'](_0x727d('0x8b'),'status',_0x727d('0x92'),util[_0x727d('0x8c')](_0x4e3f78['body'],{'showHidden':![],'depth':null}));}break;case _0x727d('0x93'):var _0x11dd95=_0x4e3f78[_0x727d('0x5b')][_0x727d('0x94')][0x0];if(_0x11dd95[_0x727d('0x30')][_0x727d('0x95')]===_0x727d('0x96')){return _0x2c93e0['update']({'read':!![]});}else{logger[_0x727d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x727d('0x30'),_0x727d('0x93'),util[_0x727d('0x8c')](_0x4e3f78[_0x727d('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2c93e0;}})['then'](respondWithResult(_0xadd668,null))[_0x727d('0x2d')](handleError(_0xadd668,null));}; \ No newline at end of file +var _0x4ccb=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','SmsMessage','findAll','rows','show','params','find','create','body','update','destroy','describe','../../config/logger','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','interface','event','rejectmessage','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','infobip','results','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x19a1bf,_0xd46be){var _0x4e8a3e=function(_0x46ef61){while(--_0x46ef61){_0x19a1bf['push'](_0x19a1bf['shift']());}};_0x4e8a3e(++_0xd46be);}(_0x4ccb,0x196));var _0xb4cc=function(_0x474581,_0x3b5bd3){_0x474581=_0x474581-0x0;var _0x1ef5b6=_0x4ccb[_0x474581];return _0x1ef5b6;};'use strict';var emlformat=require(_0xb4cc('0x0'));var rimraf=require(_0xb4cc('0x1'));var zipdir=require(_0xb4cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4cc('0x3'));var moment=require(_0xb4cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb4cc('0x5'));var util=require(_0xb4cc('0x6'));var path=require(_0xb4cc('0x7'));var sox=require('sox');var csv=require(_0xb4cc('0x8'));var ejs=require(_0xb4cc('0x9'));var fs=require('fs');var fs_extra=require(_0xb4cc('0xa'));var _=require('lodash');var squel=require(_0xb4cc('0xb'));var crypto=require(_0xb4cc('0xc'));var jsforce=require(_0xb4cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4cc('0x8'));var querystring=require(_0xb4cc('0xe'));var Papa=require(_0xb4cc('0xf'));var Redis=require(_0xb4cc('0x10'));var authService=require(_0xb4cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb4cc('0x12'));var hardwareService=require(_0xb4cc('0x13'));var logger=require('../../config/logger')(_0xb4cc('0x14'));var utils=require('../../config/utils');var config=require(_0xb4cc('0x15'));var licenseUtil=require(_0xb4cc('0x16'));var db=require(_0xb4cc('0x17'))['db'];config['redis']=_['defaults'](config[_0xb4cc('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4cc('0x18')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xb4cc('0x19'));var client=jayson[_0xb4cc('0x1a')][_0xb4cc('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xb4cc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1a5edc,_0x3aca2b,_0x926f2c,_0x3cf8a4){return new BPromise(function(_0x506ef9,_0x4d4546){var _0x2ba050=_0x3cf8a4||client;return _0x2ba050[_0xb4cc('0x1c')](_0x1a5edc,_0x926f2c)['then'](function(_0x490b1a){logger[_0xb4cc('0x1d')](_0xb4cc('0x1e'),_0x3aca2b,_0xb4cc('0x1f'));logger[_0xb4cc('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3aca2b,_0xb4cc('0x1f'),JSON[_0xb4cc('0x21')](_0x490b1a));if(_0x490b1a[_0xb4cc('0x22')]){if(_0x490b1a[_0xb4cc('0x22')][_0xb4cc('0x23')]===0x1f4){logger['error'](_0xb4cc('0x1e'),_0x3aca2b,_0x490b1a[_0xb4cc('0x22')][_0xb4cc('0x24')]);return _0x4d4546(_0x490b1a[_0xb4cc('0x22')][_0xb4cc('0x24')]);}logger['error'](_0xb4cc('0x1e'),_0x3aca2b,_0x490b1a[_0xb4cc('0x22')][_0xb4cc('0x24')]);return _0x506ef9(_0x490b1a[_0xb4cc('0x22')]['message']);}else{logger['info'](_0xb4cc('0x1e'),_0x3aca2b,_0xb4cc('0x1f'));_0x506ef9(_0x490b1a['result']['message']);}})[_0xb4cc('0x25')](function(_0xeb25e1){logger[_0xb4cc('0x22')](_0xb4cc('0x1e'),_0x3aca2b,_0xeb25e1);_0x4d4546(_0xeb25e1);});});}function respondWithStatusCode(_0x5af854,_0x4efac8){_0x4efac8=_0x4efac8||0xcc;return function(_0x3a1236){if(_0x3a1236){return _0x5af854['sendStatus'](_0x4efac8);}return _0x5af854[_0xb4cc('0x26')](_0x4efac8)[_0xb4cc('0x27')]();};}function respondWithResult(_0x1e7327,_0x2ed6d4){_0x2ed6d4=_0x2ed6d4||0xc8;return function(_0x6fb0fb){if(_0x6fb0fb){return _0x1e7327[_0xb4cc('0x26')](_0x2ed6d4)[_0xb4cc('0x28')](_0x6fb0fb);}};}function respondWithFilteredResult(_0x1de4b6,_0x27b804){return function(_0x5baab6){if(_0x5baab6){var _0x755b4a=typeof _0x27b804[_0xb4cc('0x29')]===_0xb4cc('0x2a')&&typeof _0x27b804[_0xb4cc('0x2b')]===_0xb4cc('0x2a');var _0x541a4a=_0x5baab6[_0xb4cc('0x2c')];var _0x2957ee=_0x755b4a?0x0:_0x27b804[_0xb4cc('0x29')];var _0x373b4e=_0x755b4a?_0x5baab6['count']:_0x27b804[_0xb4cc('0x29')]+_0x27b804[_0xb4cc('0x2b')];var _0x4e8e5f;if(_0x373b4e>=_0x541a4a){_0x373b4e=_0x541a4a;_0x4e8e5f=0xc8;}else{_0x4e8e5f=0xce;}_0x1de4b6[_0xb4cc('0x26')](_0x4e8e5f);return _0x1de4b6[_0xb4cc('0x2d')]('Content-Range',_0x2957ee+'-'+_0x373b4e+'/'+_0x541a4a)[_0xb4cc('0x28')](_0x5baab6);}return null;};}function patchUpdates(_0x151427){return function(_0x26b9c1){try{jsonpatch[_0xb4cc('0x2e')](_0x26b9c1,_0x151427,!![]);}catch(_0x2962fe){return BPromise[_0xb4cc('0x2f')](_0x2962fe);}return _0x26b9c1[_0xb4cc('0x30')]();};}function saveUpdates(_0x3a48ca,_0x332e34){return function(_0x4f5172){if(_0x4f5172){return _0x4f5172['update'](_0x3a48ca)[_0xb4cc('0x31')](function(_0x8dafaf){return _0x8dafaf;});}return null;};}function removeEntity(_0x3fe057,_0x11b874){return function(_0x373f36){if(_0x373f36){return _0x373f36['destroy']()[_0xb4cc('0x31')](function(){_0x3fe057[_0xb4cc('0x26')](0xcc)[_0xb4cc('0x27')]();});}};}function handleEntityNotFound(_0x5154f9,_0x418182){return function(_0x121dfb){if(!_0x121dfb){_0x5154f9[_0xb4cc('0x32')](0x194);}return _0x121dfb;};}function handleError(_0x519b22,_0x27e4fb){_0x27e4fb=_0x27e4fb||0x1f4;return function(_0x51155e){logger[_0xb4cc('0x22')](_0x51155e[_0xb4cc('0x33')]);if(_0x51155e[_0xb4cc('0x34')]){delete _0x51155e[_0xb4cc('0x34')];}_0x519b22['status'](_0x27e4fb)[_0xb4cc('0x35')](_0x51155e);};}exports['index']=function(_0x8d6f09,_0x44b56d){var _0x4490ea={},_0x4245cd={},_0x1ce892={'count':0x0,'rows':[]};var _0x3f9b37=_[_0xb4cc('0x36')](db['SmsMessage'][_0xb4cc('0x37')],function(_0x379ab3){return{'name':_0x379ab3[_0xb4cc('0x38')],'type':_0x379ab3['type']['key']};});_0x4245cd[_0xb4cc('0x39')]=_[_0xb4cc('0x36')](_0x3f9b37,_0xb4cc('0x34'));_0x4245cd[_0xb4cc('0x3a')]=_[_0xb4cc('0x3b')](_0x8d6f09['query']);_0x4245cd[_0xb4cc('0x3c')]=_['intersection'](_0x4245cd['model'],_0x4245cd[_0xb4cc('0x3a')]);_0x4490ea[_0xb4cc('0x3d')]=_[_0xb4cc('0x3e')](_0x4245cd[_0xb4cc('0x39')],qs[_0xb4cc('0x3f')](_0x8d6f09['query'][_0xb4cc('0x3f')]));_0x4490ea['attributes']=_0x4490ea[_0xb4cc('0x3d')][_0xb4cc('0x40')]?_0x4490ea[_0xb4cc('0x3d')]:_0x4245cd[_0xb4cc('0x39')];if(!_0x8d6f09[_0xb4cc('0x3a')][_0xb4cc('0x41')](_0xb4cc('0x42'))){_0x4490ea[_0xb4cc('0x2b')]=qs[_0xb4cc('0x2b')](_0x8d6f09[_0xb4cc('0x3a')][_0xb4cc('0x2b')]);_0x4490ea['offset']=qs[_0xb4cc('0x29')](_0x8d6f09[_0xb4cc('0x3a')][_0xb4cc('0x29')]);}_0x4490ea[_0xb4cc('0x43')]=qs['sort'](_0x8d6f09['query'][_0xb4cc('0x44')]);_0x4490ea[_0xb4cc('0x45')]=qs['filters'](_[_0xb4cc('0x46')](_0x8d6f09[_0xb4cc('0x3a')],_0x4245cd[_0xb4cc('0x3c')]),_0x3f9b37);if(_0x8d6f09[_0xb4cc('0x3a')]['filter']){_0x4490ea[_0xb4cc('0x45')]=_[_0xb4cc('0x47')](_0x4490ea[_0xb4cc('0x45')],{'$or':_['map'](_0x3f9b37,function(_0x41a604){if(_0x41a604[_0xb4cc('0x48')]!==_0xb4cc('0x49')){var _0x1490b6={};_0x1490b6[_0x41a604[_0xb4cc('0x34')]]={'$like':'%'+_0x8d6f09[_0xb4cc('0x3a')][_0xb4cc('0x4a')]+'%'};return _0x1490b6;}})});}_0x4490ea=_[_0xb4cc('0x47')]({},_0x4490ea,_0x8d6f09[_0xb4cc('0x4b')]);var _0x497dee={'where':_0x4490ea[_0xb4cc('0x45')]};return db['SmsMessage'][_0xb4cc('0x2c')](_0x497dee)[_0xb4cc('0x31')](function(_0x10f142){_0x1ce892['count']=_0x10f142;if(_0x8d6f09[_0xb4cc('0x3a')][_0xb4cc('0x4c')]){_0x4490ea[_0xb4cc('0x4d')]=[{'all':!![]}];}return db[_0xb4cc('0x4e')][_0xb4cc('0x4f')](_0x4490ea);})[_0xb4cc('0x31')](function(_0x22fc9a){_0x1ce892[_0xb4cc('0x50')]=_0x22fc9a;return _0x1ce892;})['then'](respondWithFilteredResult(_0x44b56d,_0x4490ea))[_0xb4cc('0x25')](handleError(_0x44b56d,null));};exports[_0xb4cc('0x51')]=function(_0x162f14,_0x1b4e81){var _0x1896dc={'raw':!![],'where':{'id':_0x162f14[_0xb4cc('0x52')]['id']}},_0xbd8de8={};_0xbd8de8['model']=_[_0xb4cc('0x3b')](db[_0xb4cc('0x4e')]['rawAttributes']);_0xbd8de8[_0xb4cc('0x3a')]=_[_0xb4cc('0x3b')](_0x162f14[_0xb4cc('0x3a')]);_0xbd8de8[_0xb4cc('0x3c')]=_['intersection'](_0xbd8de8[_0xb4cc('0x39')],_0xbd8de8['query']);_0x1896dc[_0xb4cc('0x3d')]=_['intersection'](_0xbd8de8['model'],qs[_0xb4cc('0x3f')](_0x162f14[_0xb4cc('0x3a')][_0xb4cc('0x3f')]));_0x1896dc['attributes']=_0x1896dc[_0xb4cc('0x3d')][_0xb4cc('0x40')]?_0x1896dc[_0xb4cc('0x3d')]:_0xbd8de8[_0xb4cc('0x39')];if(_0x162f14[_0xb4cc('0x3a')]['includeAll']){_0x1896dc[_0xb4cc('0x4d')]=[{'all':!![]}];}_0x1896dc=_[_0xb4cc('0x47')]({},_0x1896dc,_0x162f14['options']);return db[_0xb4cc('0x4e')][_0xb4cc('0x53')](_0x1896dc)[_0xb4cc('0x31')](handleEntityNotFound(_0x1b4e81,null))['then'](respondWithResult(_0x1b4e81,null))[_0xb4cc('0x25')](handleError(_0x1b4e81,null));};exports[_0xb4cc('0x54')]=function(_0x4ccbd7,_0x5c5a3e){return db[_0xb4cc('0x4e')]['create'](_0x4ccbd7[_0xb4cc('0x55')],{})[_0xb4cc('0x31')](respondWithResult(_0x5c5a3e,0xc9))['catch'](handleError(_0x5c5a3e,null));};exports[_0xb4cc('0x56')]=function(_0x2a0c11,_0x350842){if(_0x2a0c11[_0xb4cc('0x55')]['id']){delete _0x2a0c11[_0xb4cc('0x55')]['id'];}return db['SmsMessage'][_0xb4cc('0x53')]({'where':{'id':_0x2a0c11['params']['id']}})[_0xb4cc('0x31')](handleEntityNotFound(_0x350842,null))[_0xb4cc('0x31')](saveUpdates(_0x2a0c11[_0xb4cc('0x55')],null))['then'](respondWithResult(_0x350842,null))[_0xb4cc('0x25')](handleError(_0x350842,null));};exports[_0xb4cc('0x57')]=function(_0x3b4f28,_0x5d26f2){return db[_0xb4cc('0x4e')][_0xb4cc('0x53')]({'where':{'id':_0x3b4f28[_0xb4cc('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d26f2,null))[_0xb4cc('0x31')](removeEntity(_0x5d26f2,null))[_0xb4cc('0x25')](handleError(_0x5d26f2,null));};exports[_0xb4cc('0x58')]=function(_0xd65693,_0x39d2ac){return db['SmsMessage'][_0xb4cc('0x58')]()[_0xb4cc('0x31')](respondWithResult(_0x39d2ac,null))[_0xb4cc('0x25')](handleError(_0x39d2ac,null));};var interaction_log=require(_0xb4cc('0x59'))(_0xb4cc('0x5a'));exports[_0xb4cc('0x5b')]=function(_0xc2a99c,_0x31d28c,_0x36537a){var _0x491aaa={'agent':{},'channel':_0xb4cc('0x5c')};if(_0xc2a99c['body']['id']){delete _0xc2a99c[_0xb4cc('0x55')]['id'];}_0xc2a99c[_0xb4cc('0x55')]['read']=!![];_0xc2a99c[_0xb4cc('0x55')]['readAt']=moment()[_0xb4cc('0x5d')](_0xb4cc('0x5e'));_0xc2a99c['body'][_0xb4cc('0x5f')]=_0xc2a99c[_0xb4cc('0x55')][_0xb4cc('0x5f')]||_0xc2a99c[_0xb4cc('0x60')]['id'];_0x491aaa[_0xb4cc('0x61')]['id']=_0xc2a99c['body'][_0xb4cc('0x5f')];return db['SmsMessage'][_0xb4cc('0x53')]({'where':{'id':_0xc2a99c[_0xb4cc('0x52')]['id'],'UserId':null}})[_0xb4cc('0x31')](handleEntityNotFound(_0x31d28c,null))[_0xb4cc('0x31')](saveUpdates(_0xc2a99c[_0xb4cc('0x55')],null))[_0xb4cc('0x31')](function(_0x20215d){if(_0x20215d){_0x491aaa[_0xb4cc('0x24')]=_0x20215d[_0xb4cc('0x62')]({'plain':!![]});return db[_0xb4cc('0x63')]['find']({'where':{'id':_0x20215d['SmsInteractionId']}});}return null;})[_0xb4cc('0x31')](handleEntityNotFound(_0x31d28c,null))[_0xb4cc('0x31')](function(_0x3e36c1){if(_0x3e36c1){return _0x3e36c1['update']({'UserId':_0xc2a99c[_0xb4cc('0x55')][_0xb4cc('0x5f')],'read1stAt':_[_0xb4cc('0x64')](_0x3e36c1[_0xb4cc('0x65')])?moment()[_0xb4cc('0x5d')](_0xb4cc('0x5e')):undefined});}return null;})[_0xb4cc('0x31')](function(_0x33ea50){if(_0x33ea50){_0x491aaa[_0xb4cc('0x66')]=_0x33ea50['get']({'plain':!![]});interaction_log[_0xb4cc('0x1d')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc2a99c[_0xb4cc('0x60')]['id'],_0xc2a99c[_0xb4cc('0x60')]['name'],_0xc2a99c[_0xb4cc('0x60')][_0xb4cc('0x67')],_0x491aaa['interaction']['id'],_0xc2a99c[_0xb4cc('0x55')]?JSON[_0xb4cc('0x21')](_0xc2a99c['body']):_0xb4cc('0x68'));return respondWithRpcPromise(_0xb4cc('0x69'),_0xb4cc('0x6a'),_0x491aaa);}return null;})[_0xb4cc('0x31')](function(_0xc7874){var _0x36339f=_0xb4cc('0x6b')+_0xc7874[_0xb4cc('0x24')][_0xb4cc('0x6c')];return db[_0xb4cc('0x6d')][_0xb4cc('0x3a')](_0x36339f,{'type':db[_0xb4cc('0x6e')][_0xb4cc('0x6f')][_0xb4cc('0x70')],'raw':!![]})[_0xb4cc('0x31')](function(_0x5300cd){return _0x5300cd;});})[_0xb4cc('0x31')](function(_0x15fb52){if(_0x15fb52){_0x491aaa[_0xb4cc('0x24')][_0xb4cc('0x71')]=_0x15fb52[0x0];if(!_0xc2a99c[_0xb4cc('0x55')][_0xb4cc('0x5f')])return;return db['User'][_0xb4cc('0x53')]({'where':{'id':_0xc2a99c[_0xb4cc('0x55')]['UserId'],'role':_0xb4cc('0x61')},'attributes':['id',_0xb4cc('0x34'),_0xb4cc('0x72'),_0xb4cc('0x73'),_0xb4cc('0x74')],'raw':!![]});}return null;})[_0xb4cc('0x31')](function(_0x405dd2){if(!_0x405dd2)return null;_0x491aaa[_0xb4cc('0x24')]['agent']=_0x405dd2;return _0x491aaa;})[_0xb4cc('0x31')](function(_0x228440){if(_0x228440){if(_0xc2a99c[_0xb4cc('0x55')][_0xb4cc('0x75')]){_0x491aaa[_0xb4cc('0x24')]['interface']=util[_0xb4cc('0x5d')](_0xb4cc('0x76'),_0xc2a99c[_0xb4cc('0x60')][_0xb4cc('0x34')]);_0x491aaa[_0xb4cc('0x24')][_0xb4cc('0x77')]=_0x491aaa[_0xb4cc('0x77')];_0x491aaa[_0xb4cc('0x24')]['motionChannel']=_0x491aaa['channel'];_0x491aaa[_0xb4cc('0x24')]['event']=_0xb4cc('0x5b');return respondWithRpcPromise(_0xb4cc('0x78'),'EventManager',{'event':_0xb4cc('0x79'),'message':_0x491aaa['message']},client9002)[_0xb4cc('0x31')](function(){return _0x491aaa;});}return _0x491aaa;}return null;})['then'](respondWithResult(_0x31d28c,null))[_0xb4cc('0x25')](handleError(_0x31d28c,null));};var interaction_log=require('../../config/logger')(_0xb4cc('0x5a'));exports[_0xb4cc('0x2f')]=function(_0x1ce985,_0x87ff1e,_0x5ce13e){var _0xc3b8b1={'agent':{},'channel':_0xb4cc('0x5c')};if(_0x1ce985['body']['id']){delete _0x1ce985[_0xb4cc('0x55')]['id'];}_0x1ce985[_0xb4cc('0x55')]['UserId']=_0x1ce985['body']['UserId']||_0x1ce985['user']['id'];_0xc3b8b1[_0xb4cc('0x61')]['id']=_0x1ce985[_0xb4cc('0x55')]['UserId'];return db[_0xb4cc('0x4e')][_0xb4cc('0x53')]({'where':{'id':_0x1ce985[_0xb4cc('0x52')]['id'],'UserId':null}})[_0xb4cc('0x31')](handleEntityNotFound(_0x87ff1e,null))['then'](function(_0x377e57){if(_0x377e57){_0xc3b8b1[_0xb4cc('0x24')]=_0x377e57['get']({'plain':!![]});return db[_0xb4cc('0x63')][_0xb4cc('0x53')]({'where':{'id':_0x377e57[_0xb4cc('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x87ff1e,null))[_0xb4cc('0x31')](function(_0x138709){if(_0x138709){_0xc3b8b1[_0xb4cc('0x66')]=_0x138709[_0xb4cc('0x62')]({'plain':!![]});interaction_log['info'](_0xb4cc('0x7b'),_0x1ce985['user']['id'],_0x1ce985[_0xb4cc('0x60')][_0xb4cc('0x34')],_0x1ce985[_0xb4cc('0x60')][_0xb4cc('0x67')],_0xc3b8b1[_0xb4cc('0x66')]['id'],_0x1ce985[_0xb4cc('0x55')]?JSON[_0xb4cc('0x21')](_0x1ce985['body']):_0xb4cc('0x68'));return respondWithRpcPromise('RejectMessage',_0xb4cc('0x7c'),_0xc3b8b1);}return null;})[_0xb4cc('0x31')](function(_0x402743){var _0x41d110=_0xb4cc('0x6b')+_0x402743[_0xb4cc('0x24')][_0xb4cc('0x6c')];return db[_0xb4cc('0x6d')][_0xb4cc('0x3a')](_0x41d110,{'type':db[_0xb4cc('0x6e')]['QueryTypes'][_0xb4cc('0x70')],'raw':!![]})[_0xb4cc('0x31')](function(_0x4f8074){return _0x4f8074;});})['then'](function(_0x26765f){if(_0x26765f){_0xc3b8b1[_0xb4cc('0x24')][_0xb4cc('0x71')]=_0x26765f[0x0];if(!_0x1ce985[_0xb4cc('0x55')][_0xb4cc('0x5f')])return;return db[_0xb4cc('0x7d')][_0xb4cc('0x53')]({'where':{'id':_0x1ce985[_0xb4cc('0x55')][_0xb4cc('0x5f')],'role':_0xb4cc('0x61')},'attributes':['id',_0xb4cc('0x34'),_0xb4cc('0x72'),'email','internal'],'raw':!![]});}return null;})[_0xb4cc('0x31')](function(_0x31eda6){if(!_0x31eda6)return null;_0xc3b8b1['message'][_0xb4cc('0x61')]=_0x31eda6;return _0xc3b8b1;})['then'](function(_0xd6f8df){if(_0xd6f8df){_0xd6f8df[_0xb4cc('0x24')][_0xb4cc('0x7e')]=util[_0xb4cc('0x5d')](_0xb4cc('0x76'),_0x1ce985[_0xb4cc('0x60')][_0xb4cc('0x34')]);_0xd6f8df[_0xb4cc('0x24')][_0xb4cc('0x77')]=_0xc3b8b1[_0xb4cc('0x77')];_0xd6f8df[_0xb4cc('0x24')]['motionChannel']=_0xc3b8b1[_0xb4cc('0x77')];_0xd6f8df[_0xb4cc('0x24')][_0xb4cc('0x7f')]=_0xb4cc('0x2f');respondWithRpcPromise(_0xb4cc('0x78'),_0xb4cc('0x78'),{'event':_0xb4cc('0x80'),'message':_0xd6f8df[_0xb4cc('0x24')]},client9002);return _0xc3b8b1;}return null;})[_0xb4cc('0x31')](respondWithResult(_0x87ff1e,null))[_0xb4cc('0x25')](handleError(_0x87ff1e,null));};exports[_0xb4cc('0x26')]=function(_0x5a0a19,_0x18377f,_0x3dc004){if(_0x5a0a19[_0xb4cc('0x55')]['id']){delete _0x5a0a19[_0xb4cc('0x55')]['id'];}var _0x2bf848;return db[_0xb4cc('0x4e')]['find']({'where':{'id':_0x5a0a19[_0xb4cc('0x52')]['id']}})['then'](handleEntityNotFound(_0x18377f,null))['then'](function(_0x28549b){if(_0x28549b){_0x2bf848=_0x28549b;return db['SmsAccount']['find']({'where':{'id':_0x28549b['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x18377f,null))[_0xb4cc('0x31')](function(_0x3ab3d1){if(_0x3ab3d1){logger[_0xb4cc('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4cc('0x26'),'received\x20delivery\x20report\x20from',_0x3ab3d1['type'],util[_0xb4cc('0x81')](_0x5a0a19['body'],{'showHidden':![],'depth':null}));switch(_0x3ab3d1[_0xb4cc('0x48')]){case _0xb4cc('0x82'):if(_0x5a0a19['body'][_0xb4cc('0x83')]&&_0x5a0a19[_0xb4cc('0x55')][_0xb4cc('0x83')]===_0x2bf848[_0xb4cc('0x84')]){return _0x2bf848[_0xb4cc('0x56')]({'read':!![]});}else{logger[_0xb4cc('0x22')](_0xb4cc('0x85'),_0xb4cc('0x26'),_0xb4cc('0x82'),util['inspect'](_0x5a0a19[_0xb4cc('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb4cc('0x86'):if(_0x5a0a19[_0xb4cc('0x55')][_0xb4cc('0x87')]&&_0x5a0a19['body']['MessageUUID']===_0x2bf848[_0xb4cc('0x84')]&&_[_0xb4cc('0x88')](['sent','delivered'],_0x5a0a19[_0xb4cc('0x55')][_0xb4cc('0x89')])>=0x0){return _0x2bf848[_0xb4cc('0x56')]({'read':!![]});}else{logger[_0xb4cc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb4cc('0x26'),'plivio',util[_0xb4cc('0x81')](_0x5a0a19[_0xb4cc('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb4cc('0x8a'):var _0x21140f=_0x5a0a19['body'][_0xb4cc('0x8b')][0x0];if(_0x21140f[_0xb4cc('0x26')]['groupName']==='DELIVERED'){return _0x2bf848[_0xb4cc('0x56')]({'read':!![]});}else{logger[_0xb4cc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb4cc('0x26'),_0xb4cc('0x8a'),util[_0xb4cc('0x81')](_0x5a0a19[_0xb4cc('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2bf848;}})[_0xb4cc('0x31')](respondWithResult(_0x18377f,null))[_0xb4cc('0x25')](handleError(_0x18377f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7676e88..a63722a 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 _0x2756=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2af7f0,_0x4af5e8){var _0x1d7302=function(_0x1c3cb0){while(--_0x1c3cb0){_0x2af7f0['push'](_0x2af7f0['shift']());}};_0x1d7302(++_0x4af5e8);}(_0x2756,0xb0));var _0x6275=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x2756[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x6275('0x0'));var SmsMessage=require(_0x6275('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6275('0x2')](0x0);var events={'afterCreate':_0x6275('0x3'),'afterUpdate':_0x6275('0x4'),'afterDestroy':_0x6275('0x5')};function emitEvent(_0x521dd1){return function(_0xd3d752,_0x103e22,_0x39b956){SmsMessageEvents['emit'](_0x521dd1+':'+_0xd3d752['id'],_0xd3d752);SmsMessageEvents[_0x6275('0x6')](_0x521dd1,_0xd3d752);_0x39b956(null);};}for(var e in events){if(events[_0x6275('0x7')](e)){var event=events[e];SmsMessage[_0x6275('0x8')](e,emitEvent(event));}}module[_0x6275('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xedd4=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1cdb51,_0x825644){var _0x4b05ed=function(_0x5a57f5){while(--_0x5a57f5){_0x1cdb51['push'](_0x1cdb51['shift']());}};_0x4b05ed(++_0x825644);}(_0xedd4,0x1c3));var _0x4edd=function(_0xd34f99,_0x5830a4){_0xd34f99=_0xd34f99-0x0;var _0x10c4aa=_0xedd4[_0xd34f99];return _0x10c4aa;};'use strict';var EventEmitter=require(_0x4edd('0x0'));var SmsMessage=require(_0x4edd('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4edd('0x2')](0x0);var events={'afterCreate':_0x4edd('0x3'),'afterUpdate':_0x4edd('0x4'),'afterDestroy':_0x4edd('0x5')};function emitEvent(_0x171e75){return function(_0x8cadd3,_0x1d2dad,_0x510e50){SmsMessageEvents[_0x4edd('0x6')](_0x171e75+':'+_0x8cadd3['id'],_0x8cadd3);SmsMessageEvents[_0x4edd('0x6')](_0x171e75,_0x8cadd3);_0x510e50(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x4edd('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 3ab6aaa..d3caad9 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 _0xe419=['https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','error','out','SmsAccount','find','type','accountSid','authToken','phone','messages','create','body','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','https://smsapi.connectel.se/api/v2/send/','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','senderString','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','keys','sort','length','createHash','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe419,0x1f1));var _0x9e41=function(_0xf019d2,_0x289841){_0xf019d2=_0xf019d2-0x0;var _0x19aee3=_0xe419[_0xf019d2];return _0x19aee3;};'use strict';var _=require(_0x9e41('0x0'));var util=require(_0x9e41('0x1'));var logger=require(_0x9e41('0x2'))(_0x9e41('0x3'));var moment=require(_0x9e41('0x4'));var BPromise=require(_0x9e41('0x5'));var rp=require(_0x9e41('0x6'));var fs=require('fs');var path=require(_0x9e41('0x7'));var rimraf=require(_0x9e41('0x8'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x9e41('0x9')]=function(_0x51613f,_0xf319ab){return _0x51613f[_0x9e41('0xa')](_0x9e41('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x9e41('0xc'),'fields':[_0x9e41('0xc')]},{'name':_0x9e41('0xd'),'fields':['body'],'type':_0x9e41('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x95219a,_0x21947f,_0x538be7){var _0x2c798a=_0x51613f[_0x9e41('0xf')];var _0x19000f=_0x95219a['get']({'plain':!![]});if(_0x19000f[_0x9e41('0x10')]['toLowerCase']()==='in'||_0x19000f[_0x9e41('0x10')][_0x9e41('0x11')]()==='out'&&!_0x19000f[_0x9e41('0x12')]&&!_['isNil'](_0x19000f[_0x9e41('0x13')])&&!_[_0x9e41('0x14')](_0x19000f['SmsInteractionId'])){_0x2c798a[_0x9e41('0x15')][_0x9e41('0x16')]({'where':{'id':_0x19000f[_0x9e41('0x17')]}})[_0x9e41('0x18')](function(_0x3864ef){if(_0x3864ef){_0x3864ef[_0x9e41('0x19')]({'lastMsgAt':_0x19000f['createdAt'],'lastMsgDirection':_0x19000f[_0x9e41('0x10')]['toLowerCase']()});}})['catch'](function(_0xd24560){console[_0x9e41('0x1a')](_0xd24560);});}if(_0x19000f[_0x9e41('0x10')]===_0x9e41('0x1b')&&!_0x19000f[_0x9e41('0x12')]){var _0x357a2c;_0x2c798a[_0x9e41('0x1c')][_0x9e41('0x1d')]({'where':{'id':_0x19000f['SmsAccountId']},'raw':!![]})[_0x9e41('0x18')](function(_0x40891f){_0x357a2c=_0x40891f;if(_0x357a2c&&_0x357a2c[_0x9e41('0x1e')]){switch(_0x357a2c[_0x9e41('0x1e')]){case'twilio':var _0x172e43=require('twilio');if(_0x357a2c[_0x9e41('0x1f')]&&_0x357a2c[_0x9e41('0x20')]&&_0x357a2c[_0x9e41('0x21')]){var _0x37a704=new _0x172e43(_0x357a2c['accountSid'],_0x357a2c['authToken']);_0x37a704[_0x9e41('0x22')][_0x9e41('0x23')]({'body':_0x19000f[_0x9e41('0x24')],'to':_0x19000f[_0x9e41('0x21')],'from':_0x357a2c[_0x9e41('0x21')],'statusCallback':_0x357a2c['remote']+'/api/sms/messages/'+_0x19000f['id']+_0x9e41('0x25')+_0x357a2c[_0x9e41('0x26')]})[_0x9e41('0x18')](function(_0x26bd82){if(_0x26bd82[_0x9e41('0x27')]){return _0x95219a[_0x9e41('0x19')]({'messageId':_0x26bd82[_0x9e41('0x27')]});}})[_0x9e41('0x28')](function(_0x13f244){logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x2b'),util[_0x9e41('0x2c')](_0x13f244,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),'twilio',_0x9e41('0x2d'));}break;case _0x9e41('0x2e'):var _0xc4a01f=_0x9e41('0x2f');if(_0x357a2c[_0x9e41('0x30')]&&_0x357a2c[_0x9e41('0x31')]){var _0x36a38b={'recipient':[_0x19000f[_0x9e41('0x21')]],'message':_0x19000f[_0x9e41('0x24')],'message_type':_0x357a2c[_0x9e41('0x32')]};if(_0x357a2c[_0x9e41('0x32')]&&_0x357a2c['smsMethod']!=='SI'){_0x36a38b[_0x9e41('0x33')]=_0x357a2c[_0x9e41('0x21')];}var _0x5f46a3={'url':_0xc4a01f+_0x9e41('0x34')+_0x357a2c['username']+'&password='+_0x357a2c[_0x9e41('0x31')],'method':_0x9e41('0x35')};rp(_0x5f46a3)[_0x9e41('0x18')](function(_0x3919d3){var _0x46a830=_0x3919d3[_0x9e41('0x36')](';');var _0x1f88e6={'user_key':_0x46a830[0x0],'session_key':_0x46a830[0x1]};_0x5f46a3={'url':_0xc4a01f+_0x9e41('0x37'),'method':_0x9e41('0x38'),'headers':{'user_key':_0x1f88e6[_0x9e41('0x39')],'Session_key':_0x1f88e6[_0x9e41('0x3a')]},'json':!![],'body':_0x36a38b};return rp(_0x5f46a3);})['then'](function(_0x38e167){if(_0x38e167[_0x9e41('0x3b')]>=0x1){var _0x6fc72c={'messageId':_0x38e167['internal_order_id']};if(_0x357a2c[_0x9e41('0x32')]!=='GP'||!_0x357a2c[_0x9e41('0x3c')]){_0x6fc72c[_0x9e41('0x3d')]=!![];}return _0x95219a[_0x9e41('0x19')](_0x6fc72c);}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),'skebby',util[_0x9e41('0x2c')](_0x38e167,{'showHidden':![],'depth':null}));}})[_0x9e41('0x28')](function(_0x33bc62){return logger['error'](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x2e'),util[_0x9e41('0x2c')](_0x33bc62,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),_0x9e41('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9e41('0x3e'):if(_0x357a2c[_0x9e41('0x20')]){var _0x320870={'recipient':_0x19000f[_0x9e41('0x21')],'message':_0x19000f[_0x9e41('0x24')],'sender':_0x357a2c['senderString']||_0x357a2c['phone'],'authorization':_0x357a2c['authToken']};var _0x21947f={'method':_0x9e41('0x38'),'uri':_0x9e41('0x3f'),'body':_0x320870,'json':!![]};rp(_0x21947f)[_0x9e41('0x18')](function(_0x37748d){var _0x4fd650={'messageId':_0x37748d['requestid']};if(!_0x357a2c['deliveryReport']){_0x4fd650[_0x9e41('0x3d')]=!![];}return _0x95219a['update'](_0x4fd650);})['catch'](function(_0x312506){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),_0x9e41('0x3e'),util['inspect'](_0x312506,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),'afterCreate',_0x9e41('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0x9e41('0x40'):if(_0x357a2c[_0x9e41('0x30')]&&_0x357a2c[_0x9e41('0x31')]){var _0x320870={'messages':[{'source':_0x9e41('0x41'),'to':_0x19000f[_0x9e41('0x21')],'body':_0x19000f[_0x9e41('0x24')],'from':_0x357a2c['senderString']||_0x357a2c[_0x9e41('0x21')]}]};var _0x41cbb1=util['format'](_0x9e41('0x42'),_0x357a2c[_0x9e41('0x30')],_0x357a2c[_0x9e41('0x31')]);var _0x21947f={'method':_0x9e41('0x38'),'uri':_0x9e41('0x43'),'body':_0x320870,'headers':{'Authorization':util[_0x9e41('0x44')]('Basic\x20%s',new Buffer(_0x41cbb1)[_0x9e41('0x45')](_0x9e41('0x46')))},'json':!![]};rp(_0x21947f)[_0x9e41('0x18')](function(_0x578521){if(_0x578521[_0x9e41('0x47')]>=0xc8&&_0x578521[_0x9e41('0x47')]<=0xce){if(_0x578521[_0x9e41('0x48')]&&_0x578521[_0x9e41('0x48')]['queued_count']>0x0){var _0x2a3dbe=_[_0x9e41('0x49')](_0x578521[_0x9e41('0x48')][_0x9e41('0x22')]);var _0x19a6c5={'messageId':_0x2a3dbe[_0x9e41('0x4a')]};if(!_0x357a2c['deliveryReport']){_0x19a6c5[_0x9e41('0x3d')]=!![];}return _0x95219a['update'](_0x19a6c5);}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x4b'),util['inspect'](_0x578521,{'showHidden':![],'depth':null}));}}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),'afterCreate',_0x9e41('0x4b'),util[_0x9e41('0x2c')](_0x578521,{'showHidden':![],'depth':null}));}})[_0x9e41('0x28')](function(_0x46045c){logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x4b'),util['inspect'](_0x46045c,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),'clickSend',_0x9e41('0x4c'));}break;case'plivo':if(_0x357a2c[_0x9e41('0x4d')]&&_0x357a2c[_0x9e41('0x20')]){var _0x320870={'dst':_0x19000f['phone'],'text':_0x19000f[_0x9e41('0x24')],'src':_0x357a2c[_0x9e41('0x4e')]||_0x357a2c[_0x9e41('0x21')],'url':_0x357a2c[_0x9e41('0x4f')]+_0x9e41('0x50')+_0x19000f['id']+_0x9e41('0x25')+_0x357a2c['token']};var _0x41cbb1=util['format'](_0x9e41('0x42'),_0x357a2c['authId'],_0x357a2c[_0x9e41('0x20')]);var _0x21947f={'method':_0x9e41('0x38'),'uri':util[_0x9e41('0x44')](_0x9e41('0x51'),_0x357a2c[_0x9e41('0x4d')]),'body':_0x320870,'headers':{'Authorization':util[_0x9e41('0x44')](_0x9e41('0x52'),new Buffer(_0x41cbb1)[_0x9e41('0x45')](_0x9e41('0x46')))},'json':!![]};rp(_0x21947f)[_0x9e41('0x18')](function(_0x4e72c3){var _0x272919={'messageId':_0x4e72c3['message_uuid'][0x0]};return _0x95219a['update'](_0x272919);})[_0x9e41('0x28')](function(_0x28a6d9){logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),_0x9e41('0x53'),util[_0x9e41('0x2c')](_0x28a6d9,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),_0x9e41('0x53'),_0x9e41('0x54'));}break;case _0x9e41('0x55'):if(_0x357a2c[_0x9e41('0x30')]&&_0x357a2c['password']){if(_0x357a2c[_0x9e41('0x56')]){var _0x28ea04={'method':_0x9e41('0x38'),'uri':_0x357a2c[_0x9e41('0x56')]+'/auth/1/session','body':{'username':_0x357a2c[_0x9e41('0x30')],'password':_0x357a2c[_0x9e41('0x31')]},'json':!![]};return rp(_0x28ea04)[_0x9e41('0x18')](function(_0x4a9183){var _0x48b0e4={'method':_0x9e41('0x38'),'uri':_0x357a2c['baseUrl']+_0x9e41('0x57'),'body':{'messages':[{'from':_0x357a2c[_0x9e41('0x21')],'destinations':[{'to':_0x19000f[_0x9e41('0x21')]}],'text':_0x19000f[_0x9e41('0x24')],'notifyUrl':_0x357a2c[_0x9e41('0x4f')]+_0x9e41('0x50')+_0x19000f['id']+_0x9e41('0x25')+_0x357a2c['token'],'notifyContentType':_0x9e41('0x58'),'callbackData':_0x357a2c['phone']+';'+_0x19000f[_0x9e41('0x24')]}]},'headers':{'Authorization':_0x9e41('0x59')+_0x4a9183[_0x9e41('0x26')]},'json':!![]};return rp(_0x48b0e4)[_0x9e41('0x18')](function(_0xbbfdad){if(_0xbbfdad[_0x9e41('0x22')]){var _0x4a64d6={'messageId':_0xbbfdad['messages'][0x0][_0x9e41('0xc')]};if(!_0x357a2c[_0x9e41('0x3c')]){_0x4a64d6[_0x9e41('0x3d')]=!![];}return _0x95219a[_0x9e41('0x19')](_0x4a64d6);}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x55'),util[_0x9e41('0x2c')](_0xbbfdad,{'showHidden':![],'depth':null}));}});})[_0x9e41('0x28')](function(_0x3ac6db){return logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e41('0x55'),util[_0x9e41('0x2c')](_0x3ac6db,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x55'),_0x9e41('0x5a'));}}else{logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e41('0x55'),_0x9e41('0x4c'));}break;case _0x9e41('0x5b'):var _0x2dfeae=require(_0x9e41('0x5c'));if(_0x357a2c[_0x9e41('0x5d')]){var _0x49ae5f={};_0x49ae5f[_0x9e41('0x5e')]=_0x357a2c[_0x9e41('0x30')];_0x49ae5f[_0x9e41('0x21')]=_0x19000f[_0x9e41('0x21')];_0x49ae5f[_0x9e41('0x33')]=_0x357a2c[_0x9e41('0x21')];_0x49ae5f['text']=_0x19000f[_0x9e41('0x24')];_0x49ae5f['timestamp']=+new Date();var _0x46e84c='';var _0x1f3ba1='';var _0x5ab095=Object[_0x9e41('0x5f')](_0x49ae5f);_0x5ab095[_0x9e41('0x60')]();for(var _0x4509b6=0x0;_0x4509b6<_0x5ab095[_0x9e41('0x61')];_0x4509b6++){if(_0x46e84c!=''){_0x46e84c+='&';}_0x46e84c+=_0x5ab095[_0x4509b6]+'='+encodeURIComponent(_0x49ae5f[_0x5ab095[_0x4509b6]]);_0x1f3ba1+=_0x49ae5f[_0x5ab095[_0x4509b6]];}_0x1f3ba1+=_0x357a2c[_0x9e41('0x5d')];_0x1f3ba1=_0x2dfeae[_0x9e41('0x62')]('md5')[_0x9e41('0x19')](_0x1f3ba1)['digest']('hex');if(_0x46e84c!==''){_0x46e84c+='&';}_0x46e84c+=_0x9e41('0x63')+_0x1f3ba1;var _0x5f46a3={'method':_0x9e41('0x35'),'uri':_0x357a2c[_0x9e41('0x56')]+_0x9e41('0x64')+_0x46e84c,'json':!![]};return rp(_0x5f46a3)[_0x9e41('0x18')](function(_0x1ab177){var _0x207931=Object['keys'](_0x1ab177);if(_0x1ab177[_0x207931[0x0]][_0x9e41('0x1a')]&&parseInt(_0x1ab177[_0x207931[0x0]][_0x9e41('0x1a')])===0x0){var _0x28a3ba={'messageId':_0x1ab177[_0x207931[0x0]]['id_sms']};if(!_0x357a2c['deliveryReport']){_0x28a3ba[_0x9e41('0x3d')]=!![];}return _0x95219a[_0x9e41('0x19')](_0x28a3ba);}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),'afterCreate',_0x9e41('0x5b'),util[_0x9e41('0x2c')](_0x1ab177[_0x9e41('0x1a')],{'showHidden':![],'depth':null}));}})[_0x9e41('0x28')](function(_0x1b1af1){return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x5b'),util[_0x9e41('0x2c')](_0x1b1af1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),'csc',_0x9e41('0x65'));}break;case _0x9e41('0x66'):if(_0x357a2c[_0x9e41('0x5d')]){var _0x29882d={'method':'POST','uri':_0x9e41('0x67'),'headers':{'Authorization':_0x357a2c[_0x9e41('0x5d')]},'body':{'content':_0x19000f[_0x9e41('0x24')],'to':[_0x19000f[_0x9e41('0x21')]],'from':_0x357a2c[_0x9e41('0x21')],'binary':![],'clientMessageId':_0x9e41('0x68'),'charset':_0x9e41('0x69')},'json':!![]};rp(_0x29882d)[_0x9e41('0x18')](function(_0xfa7bf6){if(!_0xfa7bf6[_0x9e41('0x1a')]){var _0x167389={'messageId':_0xfa7bf6['messages'][0x0]['apiMessageId']};if(!_0x357a2c['deliveryReport']){_0x167389[_0x9e41('0x3d')]=!![];}return _0x95219a[_0x9e41('0x19')](_0x167389);}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),'afterCreate','clickatell',util['inspect'](_0xfa7bf6[_0x9e41('0x1a')],{'showHidden':![],'depth':null}));}})[_0x9e41('0x28')](function(_0x5e4f6b){return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),'clickatell',util[_0x9e41('0x2c')](_0x5e4f6b,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x66'),_0x9e41('0x65'));}break;case _0x9e41('0x6a'):if(_0x357a2c[_0x9e41('0x30')]&&_0x357a2c[_0x9e41('0x31')]){var _0x41cbb1=util['format'](_0x9e41('0x42'),_0x357a2c[_0x9e41('0x30')],_0x357a2c[_0x9e41('0x31')]);var _0x21947f={'method':_0x9e41('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x357a2c[_0x9e41('0x6b')]+'/messages','body':{'to':[_0x19000f[_0x9e41('0x21')]],'text':_0x19000f[_0x9e41('0x24')],'from':_0x357a2c[_0x9e41('0x21')],'applicationId':_0x357a2c['applicationId']},'headers':{'Authorization':util[_0x9e41('0x44')](_0x9e41('0x52'),new Buffer(_0x41cbb1)['toString']('base64'))},'json':!![]};rp(_0x21947f)['then'](function(_0x44665e){if(_0x44665e['id']){var _0x258813={'messageId':_0x44665e['id']};return _0x95219a[_0x9e41('0x19')](_0x258813);}else{logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x6a'),util[_0x9e41('0x2c')](_0x44665e,{'showHidden':![],'depth':null}));}})[_0x9e41('0x28')](function(_0x1fb35f){logger[_0x9e41('0x1a')](_0x9e41('0x29'),'afterCreate','bandwidth',util[_0x9e41('0x2c')](_0x1fb35f,{'showHidden':![],'depth':null}));});}else{logger[_0x9e41('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e41('0x2a'),_0x9e41('0x6a'),_0x9e41('0x4c'));}break;case _0x9e41('0x6c'):if(_0x357a2c[_0x9e41('0x5d')]){var _0x810ed0={};var _0x5f46a3={'method':_0x9e41('0x38'),'uri':_0x9e41('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x357a2c[_0x9e41('0x5d')],'Content-Type':_0x9e41('0x58')},'body':{'from':_0x357a2c[_0x9e41('0x21')],'to':_0x19000f[_0x9e41('0x21')],'text':_0x19000f['body']},'json':!![]};return rp(_0x5f46a3)['then'](function(_0xdd1f1b){if(_0xdd1f1b[_0x9e41('0x6e')]==0xca){_0x810ed0[_0x9e41('0x6f')]=_0xdd1f1b;var _0x5c9294={'method':_0x9e41('0x38'),'uri':_0x9e41('0x70'),'headers':{'Authorization':_0x9e41('0x71')+_0x357a2c[_0x9e41('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x810ed0[_0x9e41('0x6f')]['refid']},'json':!![]};return rp(_0x5c9294)['then'](function(_0x17ed42){_0x810ed0[_0x9e41('0x72')]=_0x17ed42;var _0x2728c7={'messageId':_0x810ed0[_0x9e41('0x6f')][_0x9e41('0x73')],'read':!![]};return _0x95219a['update'](_0x2728c7);});}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x6c'),util[_0x9e41('0x2c')](_0xdd1f1b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4d9f71){return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),'intelepeer',util[_0x9e41('0x2c')](_0x4d9f71,{'showHidden':![],'depth':null}));});}else{return logger[_0x9e41('0x1a')](_0x9e41('0x29'),_0x9e41('0x2a'),_0x9e41('0x6c'),_0x9e41('0x74'));}break;}}})[_0x9e41('0x75')](function(){_0x538be7();});}else{_0x538be7();}}},'charset':_0x9e41('0x76'),'collate':_0x9e41('0x77')});}; \ No newline at end of file +var _0xbde4=['moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','lodash','util','../../config/logger','api'];(function(_0x2dbed7,_0x2962d5){var _0x326efc=function(_0x1713b3){while(--_0x1713b3){_0x2dbed7['push'](_0x2dbed7['shift']());}};_0x326efc(++_0x2962d5);}(_0xbde4,0xf2));var _0x4bde=function(_0x3bcd23,_0x4d5dd6){_0x3bcd23=_0x3bcd23-0x0;var _0x580708=_0xbde4[_0x3bcd23];return _0x580708;};'use strict';var _=require(_0x4bde('0x0'));var util=require(_0x4bde('0x1'));var logger=require(_0x4bde('0x2'))(_0x4bde('0x3'));var moment=require(_0x4bde('0x4'));var BPromise=require(_0x4bde('0x5'));var rp=require(_0x4bde('0x6'));var fs=require('fs');var path=require(_0x4bde('0x7'));var rimraf=require(_0x4bde('0x8'));var config=require('../../config/environment');var attributes=require(_0x4bde('0x9'));module[_0x4bde('0xa')]=function(_0x5ce754,_0x361d46){return _0x5ce754[_0x4bde('0xb')](_0x4bde('0xc'),attributes,{'tableName':_0x4bde('0xd'),'paranoid':![],'indexes':[{'name':_0x4bde('0xe'),'fields':['messageId']},{'name':_0x4bde('0xf'),'fields':['body'],'type':_0x4bde('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2382bb,_0x3f5ed8,_0x895d9f){var _0x209347=_0x5ce754['models'];var _0x21a482=_0x2382bb[_0x4bde('0x11')]({'plain':!![]});if(_0x21a482['direction'][_0x4bde('0x12')]()==='in'||_0x21a482[_0x4bde('0x13')][_0x4bde('0x12')]()===_0x4bde('0x14')&&!_0x21a482[_0x4bde('0x15')]&&!_[_0x4bde('0x16')](_0x21a482[_0x4bde('0x17')])&&!_['isNil'](_0x21a482[_0x4bde('0x18')])){_0x209347[_0x4bde('0x19')]['findOne']({'where':{'id':_0x21a482['SmsInteractionId']}})[_0x4bde('0x1a')](function(_0x49b7ca){if(_0x49b7ca){_0x49b7ca[_0x4bde('0x1b')]({'lastMsgAt':_0x21a482[_0x4bde('0x1c')],'lastMsgDirection':_0x21a482[_0x4bde('0x13')]['toLowerCase']()});}})[_0x4bde('0x1d')](function(_0xa85070){console['error'](_0xa85070);});}if(_0x21a482[_0x4bde('0x13')]==='out'&&!_0x21a482[_0x4bde('0x15')]){var _0x11f5b0;_0x209347[_0x4bde('0x1e')][_0x4bde('0x1f')]({'where':{'id':_0x21a482[_0x4bde('0x20')]},'raw':!![]})[_0x4bde('0x1a')](function(_0x35eeb2){_0x11f5b0=_0x35eeb2;if(_0x11f5b0&&_0x11f5b0[_0x4bde('0x21')]){switch(_0x11f5b0['type']){case _0x4bde('0x22'):var _0x29c1a6=require(_0x4bde('0x22'));if(_0x11f5b0['accountSid']&&_0x11f5b0[_0x4bde('0x23')]&&_0x11f5b0[_0x4bde('0x24')]){var _0x342671=new _0x29c1a6(_0x11f5b0['accountSid'],_0x11f5b0['authToken']);_0x342671[_0x4bde('0x25')][_0x4bde('0x26')]({'body':_0x21a482[_0x4bde('0x27')],'to':_0x21a482[_0x4bde('0x24')],'from':_0x11f5b0['phone'],'statusCallback':_0x11f5b0['remote']+_0x4bde('0x28')+_0x21a482['id']+_0x4bde('0x29')+_0x11f5b0[_0x4bde('0x2a')]})[_0x4bde('0x1a')](function(_0x51fa83){if(_0x51fa83[_0x4bde('0x2b')]){return _0x2382bb['update']({'messageId':_0x51fa83[_0x4bde('0x2b')]});}})['catch'](function(_0x5453fd){logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x22'),util[_0x4bde('0x2e')](_0x5453fd,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),_0x4bde('0x22'),_0x4bde('0x30'));}break;case _0x4bde('0x31'):var _0x425609=_0x4bde('0x32');if(_0x11f5b0['username']&&_0x11f5b0[_0x4bde('0x33')]){var _0x5817ab={'recipient':[_0x21a482[_0x4bde('0x24')]],'message':_0x21a482[_0x4bde('0x27')],'message_type':_0x11f5b0[_0x4bde('0x34')]};if(_0x11f5b0['smsMethod']&&_0x11f5b0['smsMethod']!=='SI'){_0x5817ab[_0x4bde('0x35')]=_0x11f5b0[_0x4bde('0x24')];}var _0x302545={'url':_0x425609+_0x4bde('0x36')+_0x11f5b0[_0x4bde('0x37')]+_0x4bde('0x38')+_0x11f5b0[_0x4bde('0x33')],'method':_0x4bde('0x39')};rp(_0x302545)[_0x4bde('0x1a')](function(_0x1c3f21){var _0xe64e6a=_0x1c3f21[_0x4bde('0x3a')](';');var _0x2aab9f={'user_key':_0xe64e6a[0x0],'session_key':_0xe64e6a[0x1]};_0x302545={'url':_0x425609+_0x4bde('0x3b'),'method':_0x4bde('0x3c'),'headers':{'user_key':_0x2aab9f[_0x4bde('0x3d')],'Session_key':_0x2aab9f[_0x4bde('0x3e')]},'json':!![],'body':_0x5817ab};return rp(_0x302545);})[_0x4bde('0x1a')](function(_0x179803){if(_0x179803[_0x4bde('0x3f')]>=0x1){var _0x364b00={'messageId':_0x179803['internal_order_id']};if(_0x11f5b0[_0x4bde('0x34')]!=='GP'||!_0x11f5b0[_0x4bde('0x40')]){_0x364b00[_0x4bde('0x41')]=!![];}return _0x2382bb[_0x4bde('0x1b')](_0x364b00);}else{return logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x31'),util[_0x4bde('0x2e')](_0x179803,{'showHidden':![],'depth':null}));}})[_0x4bde('0x1d')](function(_0x348bbd){return logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),'skebby',util[_0x4bde('0x2e')](_0x348bbd,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),_0x4bde('0x31'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4bde('0x42'):if(_0x11f5b0['authToken']){var _0x15993c={'recipient':_0x21a482['phone'],'message':_0x21a482[_0x4bde('0x27')],'sender':_0x11f5b0[_0x4bde('0x43')]||_0x11f5b0[_0x4bde('0x24')],'authorization':_0x11f5b0[_0x4bde('0x23')]};var _0x3f5ed8={'method':_0x4bde('0x3c'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x15993c,'json':!![]};rp(_0x3f5ed8)[_0x4bde('0x1a')](function(_0x210e02){var _0x19845c={'messageId':_0x210e02['requestid']};if(!_0x11f5b0[_0x4bde('0x40')]){_0x19845c[_0x4bde('0x41')]=!![];}return _0x2382bb[_0x4bde('0x1b')](_0x19845c);})['catch'](function(_0x196ae3){logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),_0x4bde('0x42'),util[_0x4bde('0x2e')](_0x196ae3,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),_0x4bde('0x42'),_0x4bde('0x44'));}break;case _0x4bde('0x45'):if(_0x11f5b0['username']&&_0x11f5b0['password']){var _0x15993c={'messages':[{'source':_0x4bde('0x46'),'to':_0x21a482[_0x4bde('0x24')],'body':_0x21a482[_0x4bde('0x27')],'from':_0x11f5b0[_0x4bde('0x43')]||_0x11f5b0[_0x4bde('0x24')]}]};var _0x4c91c3=util[_0x4bde('0x47')]('%s:%s',_0x11f5b0[_0x4bde('0x37')],_0x11f5b0[_0x4bde('0x33')]);var _0x3f5ed8={'method':_0x4bde('0x3c'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x15993c,'headers':{'Authorization':util[_0x4bde('0x47')](_0x4bde('0x48'),new Buffer(_0x4c91c3)[_0x4bde('0x49')]('base64'))},'json':!![]};rp(_0x3f5ed8)['then'](function(_0x24c37c){if(_0x24c37c[_0x4bde('0x4a')]>=0xc8&&_0x24c37c['http_code']<=0xce){if(_0x24c37c[_0x4bde('0x4b')]&&_0x24c37c['data'][_0x4bde('0x4c')]>0x0){var _0x14e71f=_['head'](_0x24c37c[_0x4bde('0x4b')][_0x4bde('0x25')]);var _0x9d8ea8={'messageId':_0x14e71f[_0x4bde('0x4d')]};if(!_0x11f5b0[_0x4bde('0x40')]){_0x9d8ea8['read']=!![];}return _0x2382bb['update'](_0x9d8ea8);}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate','clickSend',util[_0x4bde('0x2e')](_0x24c37c,{'showHidden':![],'depth':null}));}}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),'clickSend',util[_0x4bde('0x2e')](_0x24c37c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1153cf){logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),'clickSend',util[_0x4bde('0x2e')](_0x1153cf,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x4e'),_0x4bde('0x4f'));}break;case _0x4bde('0x50'):if(_0x11f5b0[_0x4bde('0x51')]&&_0x11f5b0[_0x4bde('0x23')]){var _0x15993c={'dst':_0x21a482[_0x4bde('0x24')],'text':_0x21a482['body'],'src':_0x11f5b0[_0x4bde('0x43')]||_0x11f5b0[_0x4bde('0x24')],'url':_0x11f5b0[_0x4bde('0x52')]+_0x4bde('0x28')+_0x21a482['id']+_0x4bde('0x29')+_0x11f5b0[_0x4bde('0x2a')]};var _0x4c91c3=util[_0x4bde('0x47')]('%s:%s',_0x11f5b0[_0x4bde('0x51')],_0x11f5b0[_0x4bde('0x23')]);var _0x3f5ed8={'method':_0x4bde('0x3c'),'uri':util[_0x4bde('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x11f5b0[_0x4bde('0x51')]),'body':_0x15993c,'headers':{'Authorization':util[_0x4bde('0x47')](_0x4bde('0x48'),new Buffer(_0x4c91c3)[_0x4bde('0x49')](_0x4bde('0x53')))},'json':!![]};rp(_0x3f5ed8)['then'](function(_0x5c63fe){var _0x426e19={'messageId':_0x5c63fe[_0x4bde('0x54')][0x0]};return _0x2382bb['update'](_0x426e19);})[_0x4bde('0x1d')](function(_0x48d3ed){logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),'plivo',util[_0x4bde('0x2e')](_0x48d3ed,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),'plivo',_0x4bde('0x55'));}break;case _0x4bde('0x56'):if(_0x11f5b0['username']&&_0x11f5b0[_0x4bde('0x33')]){if(_0x11f5b0['baseUrl']){var _0x4baa61={'method':'POST','uri':_0x11f5b0[_0x4bde('0x57')]+_0x4bde('0x58'),'body':{'username':_0x11f5b0[_0x4bde('0x37')],'password':_0x11f5b0[_0x4bde('0x33')]},'json':!![]};return rp(_0x4baa61)[_0x4bde('0x1a')](function(_0x2a1a78){var _0x3922d2={'method':_0x4bde('0x3c'),'uri':_0x11f5b0[_0x4bde('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x11f5b0[_0x4bde('0x24')],'destinations':[{'to':_0x21a482[_0x4bde('0x24')]}],'text':_0x21a482['body'],'notifyUrl':_0x11f5b0[_0x4bde('0x52')]+_0x4bde('0x28')+_0x21a482['id']+'/status?token='+_0x11f5b0[_0x4bde('0x2a')],'notifyContentType':'application/json','callbackData':_0x11f5b0['phone']+';'+_0x21a482[_0x4bde('0x27')]}]},'headers':{'Authorization':_0x4bde('0x59')+_0x2a1a78[_0x4bde('0x2a')]},'json':!![]};return rp(_0x3922d2)[_0x4bde('0x1a')](function(_0x465058){if(_0x465058[_0x4bde('0x25')]){var _0x492f13={'messageId':_0x465058[_0x4bde('0x25')][0x0]['messageId']};if(!_0x11f5b0[_0x4bde('0x40')]){_0x492f13[_0x4bde('0x41')]=!![];}return _0x2382bb[_0x4bde('0x1b')](_0x492f13);}else{return logger['error'](_0x4bde('0x2d'),_0x4bde('0x2f'),'infobip',util['inspect'](_0x465058,{'showHidden':![],'depth':null}));}});})[_0x4bde('0x1d')](function(_0x17bf96){return logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),'infobip',util['inspect'](_0x17bf96,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x56'),_0x4bde('0x5a'));}}else{logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),_0x4bde('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4bde('0x5b'):var _0x1aa67d=require(_0x4bde('0x5c'));if(_0x11f5b0[_0x4bde('0x5d')]){var _0x4dc25b={};_0x4dc25b[_0x4bde('0x5e')]=_0x11f5b0[_0x4bde('0x37')];_0x4dc25b[_0x4bde('0x24')]=_0x21a482[_0x4bde('0x24')];_0x4dc25b['sender']=_0x11f5b0[_0x4bde('0x24')];_0x4dc25b['text']=_0x21a482[_0x4bde('0x27')];_0x4dc25b['timestamp']=+new Date();var _0x2a6630='';var _0xf52e3b='';var _0x1d138e=Object[_0x4bde('0x5f')](_0x4dc25b);_0x1d138e[_0x4bde('0x60')]();for(var _0x180c7a=0x0;_0x180c7a<_0x1d138e[_0x4bde('0x61')];_0x180c7a++){if(_0x2a6630!=''){_0x2a6630+='&';}_0x2a6630+=_0x1d138e[_0x180c7a]+'='+encodeURIComponent(_0x4dc25b[_0x1d138e[_0x180c7a]]);_0xf52e3b+=_0x4dc25b[_0x1d138e[_0x180c7a]];}_0xf52e3b+=_0x11f5b0[_0x4bde('0x5d')];_0xf52e3b=_0x1aa67d[_0x4bde('0x62')](_0x4bde('0x63'))[_0x4bde('0x1b')](_0xf52e3b)[_0x4bde('0x64')](_0x4bde('0x65'));if(_0x2a6630!==''){_0x2a6630+='&';}_0x2a6630+=_0x4bde('0x66')+_0xf52e3b;var _0x302545={'method':_0x4bde('0x39'),'uri':_0x11f5b0[_0x4bde('0x57')]+_0x4bde('0x67')+_0x2a6630,'json':!![]};return rp(_0x302545)[_0x4bde('0x1a')](function(_0x660221){var _0x22306b=Object['keys'](_0x660221);if(_0x660221[_0x22306b[0x0]][_0x4bde('0x2c')]&&parseInt(_0x660221[_0x22306b[0x0]][_0x4bde('0x2c')])===0x0){var _0x5941eb={'messageId':_0x660221[_0x22306b[0x0]][_0x4bde('0x68')]};if(!_0x11f5b0['deliveryReport']){_0x5941eb['read']=!![];}return _0x2382bb[_0x4bde('0x1b')](_0x5941eb);}else{return logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),_0x4bde('0x5b'),util[_0x4bde('0x2e')](_0x660221[_0x4bde('0x2c')],{'showHidden':![],'depth':null}));}})[_0x4bde('0x1d')](function(_0x468878){return logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),_0x4bde('0x5b'),util[_0x4bde('0x2e')](_0x468878,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x5b'),_0x4bde('0x69'));}break;case'clickatell':if(_0x11f5b0[_0x4bde('0x5d')]){var _0x2d3de2={'method':'POST','uri':_0x4bde('0x6a'),'headers':{'Authorization':_0x11f5b0[_0x4bde('0x5d')]},'body':{'content':_0x21a482['body'],'to':[_0x21a482['phone']],'from':_0x11f5b0['phone'],'binary':![],'clientMessageId':_0x4bde('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x2d3de2)['then'](function(_0x2d09ae){if(!_0x2d09ae['error']){var _0x23cea9={'messageId':_0x2d09ae['messages'][0x0][_0x4bde('0x6c')]};if(!_0x11f5b0[_0x4bde('0x40')]){_0x23cea9['read']=!![];}return _0x2382bb[_0x4bde('0x1b')](_0x23cea9);}else{return logger['error'](_0x4bde('0x2d'),_0x4bde('0x2f'),'clickatell',util[_0x4bde('0x2e')](_0x2d09ae[_0x4bde('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x623df3){return logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),_0x4bde('0x6d'),util[_0x4bde('0x2e')](_0x623df3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4bde('0x2d'),_0x4bde('0x2f'),'clickatell',_0x4bde('0x69'));}break;case _0x4bde('0x6e'):if(_0x11f5b0[_0x4bde('0x37')]&&_0x11f5b0[_0x4bde('0x33')]){var _0x4c91c3=util['format'](_0x4bde('0x6f'),_0x11f5b0[_0x4bde('0x37')],_0x11f5b0[_0x4bde('0x33')]);var _0x3f5ed8={'method':_0x4bde('0x3c'),'uri':_0x4bde('0x70')+_0x11f5b0[_0x4bde('0x71')]+_0x4bde('0x72'),'body':{'to':[_0x21a482['phone']],'text':_0x21a482[_0x4bde('0x27')],'from':_0x11f5b0[_0x4bde('0x24')],'applicationId':_0x11f5b0[_0x4bde('0x73')]},'headers':{'Authorization':util[_0x4bde('0x47')](_0x4bde('0x48'),new Buffer(_0x4c91c3)[_0x4bde('0x49')](_0x4bde('0x53')))},'json':!![]};rp(_0x3f5ed8)[_0x4bde('0x1a')](function(_0x399caa){if(_0x399caa['id']){var _0x760197={'messageId':_0x399caa['id']};return _0x2382bb[_0x4bde('0x1b')](_0x760197);}else{logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate','bandwidth',util[_0x4bde('0x2e')](_0x399caa,{'showHidden':![],'depth':null}));}})[_0x4bde('0x1d')](function(_0x48a03a){logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x6e'),util[_0x4bde('0x2e')](_0x48a03a,{'showHidden':![],'depth':null}));});}else{logger[_0x4bde('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bde('0x2f'),'bandwidth',_0x4bde('0x4f'));}break;case _0x4bde('0x74'):if(_0x11f5b0[_0x4bde('0x5d')]){var _0x519e08={};var _0x302545={'method':_0x4bde('0x3c'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x11f5b0[_0x4bde('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x11f5b0[_0x4bde('0x24')],'to':_0x21a482[_0x4bde('0x24')],'text':_0x21a482['body']},'json':!![]};return rp(_0x302545)['then'](function(_0x1fbc1d){if(_0x1fbc1d[_0x4bde('0x75')]==0xca){_0x519e08[_0x4bde('0x76')]=_0x1fbc1d;var _0x1aa164={'method':_0x4bde('0x3c'),'uri':_0x4bde('0x77'),'headers':{'Authorization':_0x4bde('0x78')+_0x11f5b0[_0x4bde('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x519e08['message'][_0x4bde('0x79')]},'json':!![]};return rp(_0x1aa164)['then'](function(_0x4dee86){_0x519e08['status']=_0x4dee86;var _0x57196f={'messageId':_0x519e08['message']['refid'],'read':!![]};return _0x2382bb[_0x4bde('0x1b')](_0x57196f);});}else{return logger[_0x4bde('0x2c')](_0x4bde('0x2d'),_0x4bde('0x2f'),_0x4bde('0x74'),util[_0x4bde('0x2e')](_0x1fbc1d,{'showHidden':![],'depth':null}));}})[_0x4bde('0x1d')](function(_0x1b9bda){return logger['error'](_0x4bde('0x2d'),'afterCreate',_0x4bde('0x74'),util[_0x4bde('0x2e')](_0x1b9bda,{'showHidden':![],'depth':null}));});}else{return logger[_0x4bde('0x2c')](_0x4bde('0x2d'),'afterCreate','intelepeer',_0x4bde('0x7a'));}break;}}})['finally'](function(){_0x895d9f();});}else{_0x895d9f();}}},'charset':'utf8mb4','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 fae3cea..842dc36 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 _0x8650=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b516,_0xbe9133){var _0x1b5b8e=function(_0x3240be){while(--_0x3240be){_0x2b516['push'](_0x2b516['shift']());}};_0x1b5b8e(++_0xbe9133);}(_0x8650,0x192));var _0x0865=function(_0x2581ab,_0x3266ae){_0x2581ab=_0x2581ab-0x0;var _0x19c0f2=_0x8650[_0x2581ab];return _0x19c0f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0865('0x0'));var BPromise=require(_0x0865('0x1'));var rs=require(_0x0865('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0865('0x3'))['db'];var utils=require(_0x0865('0x4'));var logger=require(_0x0865('0x5'))(_0x0865('0x6'));var config=require(_0x0865('0x7'));var jayson=require(_0x0865('0x8'));var client=jayson[_0x0865('0x9')][_0x0865('0xa')]({'port':0x232a});config[_0x0865('0xb')]=_[_0x0865('0xc')](config[_0x0865('0xb')],{'host':_0x0865('0xd'),'port':0x18eb});var socket=require(_0x0865('0xe'))(new Redis(config[_0x0865('0xb')]));require(_0x0865('0xf'))['register'](socket);function respondWithRpcPromise(_0x332374,_0x416a50,_0x366c5b){return new BPromise(function(_0x4129f1,_0x1731bb){return client[_0x0865('0x10')](_0x332374,_0x366c5b)['then'](function(_0xc9cc86){logger['info']('SmsMessage,\x20%s,\x20%s',_0x416a50,_0x0865('0x11'));logger[_0x0865('0x12')](_0x0865('0x13'),_0x416a50,_0x0865('0x11'),JSON['stringify'](_0xc9cc86));if(_0xc9cc86['error']){if(_0xc9cc86[_0x0865('0x14')][_0x0865('0x15')]===0x1f4){logger[_0x0865('0x14')](_0x0865('0x16'),_0x416a50,_0xc9cc86[_0x0865('0x14')]['message']);return _0x1731bb(_0xc9cc86[_0x0865('0x14')][_0x0865('0x17')]);}logger[_0x0865('0x14')](_0x0865('0x16'),_0x416a50,_0xc9cc86[_0x0865('0x14')][_0x0865('0x17')]);return _0x4129f1(_0xc9cc86['error'][_0x0865('0x17')]);}else{logger[_0x0865('0x18')](_0x0865('0x16'),_0x416a50,_0x0865('0x11'));_0x4129f1(_0xc9cc86[_0x0865('0x19')][_0x0865('0x17')]);}})[_0x0865('0x1a')](function(_0x20aea0){logger[_0x0865('0x14')](_0x0865('0x16'),_0x416a50,_0x20aea0);_0x1731bb(_0x20aea0);});});}exports[_0x0865('0x1b')]=function(_0x3c6614){var _0x8a990a=this;return new Promise(function(_0x2a7700,_0x3caaeb){return db[_0x0865('0x1c')][_0x0865('0x1d')](_0x3c6614['body'],{'raw':_0x3c6614[_0x0865('0x1e')]?_0x3c6614[_0x0865('0x1e')][_0x0865('0x1f')]===undefined?!![]:![]:!![]})[_0x0865('0x20')](function(_0x4a8ebb){logger[_0x0865('0x18')](_0x0865('0x1b'),_0x3c6614);logger[_0x0865('0x12')](_0x0865('0x1b'),_0x3c6614,JSON[_0x0865('0x21')](_0x4a8ebb));_0x2a7700(_0x4a8ebb);})[_0x0865('0x1a')](function(_0x3d593b){logger[_0x0865('0x14')](_0x0865('0x1b'),_0x3d593b[_0x0865('0x17')],_0x3c6614);_0x3caaeb(_0x8a990a[_0x0865('0x14')](0x1f4,_0x3d593b[_0x0865('0x17')]));});});}; \ No newline at end of file +var _0x060b=['create','body','options','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSmsMessage','SmsMessage'];(function(_0x87d340,_0x2a3e68){var _0x2588cc=function(_0xf1c1fc){while(--_0xf1c1fc){_0x87d340['push'](_0x87d340['shift']());}};_0x2588cc(++_0x2a3e68);}(_0x060b,0x83));var _0xb060=function(_0x5a8dcc,_0x3c29ff){_0x5a8dcc=_0x5a8dcc-0x0;var _0x1c5c1c=_0x060b[_0x5a8dcc];return _0x1c5c1c;};'use strict';var _=require(_0xb060('0x0'));var util=require('util');var moment=require(_0xb060('0x1'));var BPromise=require('bluebird');var rs=require(_0xb060('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb060('0x3'));var logger=require(_0xb060('0x4'))(_0xb060('0x5'));var config=require('../../config/environment');var jayson=require(_0xb060('0x6'));var client=jayson[_0xb060('0x7')][_0xb060('0x8')]({'port':0x232a});config[_0xb060('0x9')]=_[_0xb060('0xa')](config[_0xb060('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb060('0xb'))(new Redis(config[_0xb060('0x9')]));require(_0xb060('0xc'))[_0xb060('0xd')](socket);function respondWithRpcPromise(_0x3c3673,_0x70785,_0x6e2cb4){return new BPromise(function(_0x195d54,_0x555e55){return client[_0xb060('0xe')](_0x3c3673,_0x6e2cb4)[_0xb060('0xf')](function(_0x624b30){logger[_0xb060('0x10')](_0xb060('0x11'),_0x70785,'request\x20sent');logger[_0xb060('0x12')](_0xb060('0x13'),_0x70785,'request\x20sent',JSON[_0xb060('0x14')](_0x624b30));if(_0x624b30[_0xb060('0x15')]){if(_0x624b30['error'][_0xb060('0x16')]===0x1f4){logger[_0xb060('0x15')](_0xb060('0x11'),_0x70785,_0x624b30['error']['message']);return _0x555e55(_0x624b30[_0xb060('0x15')][_0xb060('0x17')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x70785,_0x624b30[_0xb060('0x15')][_0xb060('0x17')]);return _0x195d54(_0x624b30['error'][_0xb060('0x17')]);}else{logger[_0xb060('0x10')]('SmsMessage,\x20%s,\x20%s',_0x70785,_0xb060('0x18'));_0x195d54(_0x624b30[_0xb060('0x19')]['message']);}})[_0xb060('0x1a')](function(_0x529681){logger[_0xb060('0x15')](_0xb060('0x11'),_0x70785,_0x529681);_0x555e55(_0x529681);});});}exports[_0xb060('0x1b')]=function(_0x145fc1){var _0x4ce57e=this;return new Promise(function(_0xbb103c,_0x9840ee){return db[_0xb060('0x1c')][_0xb060('0x1d')](_0x145fc1[_0xb060('0x1e')],{'raw':_0x145fc1[_0xb060('0x1f')]?_0x145fc1[_0xb060('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb060('0xf')](function(_0x3d2a86){logger[_0xb060('0x10')]('CreateSmsMessage',_0x145fc1);logger['debug'](_0xb060('0x1b'),_0x145fc1,JSON[_0xb060('0x14')](_0x3d2a86));_0xbb103c(_0x3d2a86);})[_0xb060('0x1a')](function(_0x1b4563){logger[_0xb060('0x15')](_0xb060('0x1b'),_0x1b4563[_0xb060('0x17')],_0x145fc1);_0x9840ee(_0x4ce57e['error'](0x1f4,_0x1b4563[_0xb060('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 75db974..a8c5e95 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 _0x92a9=['removeListener','register','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0xa79bed,_0x31306b){var _0x246151=function(_0x1b686f){while(--_0x1b686f){_0xa79bed['push'](_0xa79bed['shift']());}};_0x246151(++_0x31306b);}(_0x92a9,0x73));var _0x992a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x92a9[_0x3070dc];return _0x431489;};'use strict';var SmsMessageEvents=require(_0x992a('0x0'));var events=[_0x992a('0x1'),_0x992a('0x2'),_0x992a('0x3')];function createListener(_0x57d36f,_0x412bc1){return function(_0x11e83c){_0x412bc1[_0x992a('0x4')](_0x57d36f,_0x11e83c);};}function removeListener(_0xe0c376,_0x4a6eb3){return function(){SmsMessageEvents[_0x992a('0x5')](_0xe0c376,_0x4a6eb3);};}exports[_0x992a('0x6')]=function(_0x3cfba8){for(var _0xbd0761=0x0,_0xdd8f7b=events['length'];_0xbd0761<_0xdd8f7b;_0xbd0761++){var _0x2e48bc=events[_0xbd0761];var _0x295431=createListener(_0x992a('0x7')+_0x2e48bc,_0x3cfba8);SmsMessageEvents['on'](_0x2e48bc,_0x295431);}}; \ No newline at end of file +var _0x177f=['length','smsMessage:','remove','update','emit','register'];(function(_0x689e16,_0x176daf){var _0xf6f855=function(_0x3c4b0d){while(--_0x3c4b0d){_0x689e16['push'](_0x689e16['shift']());}};_0xf6f855(++_0x176daf);}(_0x177f,0xce));var _0xf177=function(_0xee54c3,_0x219399){_0xee54c3=_0xee54c3-0x0;var _0x35b8ef=_0x177f[_0xee54c3];return _0x35b8ef;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xf177('0x0'),_0xf177('0x1')];function createListener(_0x16846c,_0x2a652a){return function(_0x5cbe11){_0x2a652a[_0xf177('0x2')](_0x16846c,_0x5cbe11);};}function removeListener(_0x5094e4,_0x227027){return function(){SmsMessageEvents['removeListener'](_0x5094e4,_0x227027);};}exports[_0xf177('0x3')]=function(_0x432ec1){for(var _0x52ff89=0x0,_0x40f9b0=events[_0xf177('0x4')];_0x52ff89<_0x40f9b0;_0x52ff89++){var _0x31f578=events[_0x52ff89];var _0x1ec863=createListener(_0xf177('0x5')+_0x31f578,_0x432ec1);SmsMessageEvents['on'](_0x31f578,_0x1ec863);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 21e4e5d..770ec5e 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 _0xe980=['multer','util','path','express','fs-extra','../../components/auth/service','./smsQueue.controller','index','get','/describe','isAuthenticated','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe980,0x152));var _0x0e98=function(_0x5c4ee7,_0x2fd24a){_0x5c4ee7=_0x5c4ee7-0x0;var _0x4b7b88=_0xe980[_0x5c4ee7];return _0x4b7b88;};'use strict';var multer=require(_0x0e98('0x0'));var util=require(_0x0e98('0x1'));var path=require(_0x0e98('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e98('0x3'));var router=express['Router']();var fs_extra=require(_0x0e98('0x4'));var auth=require(_0x0e98('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e98('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0e98('0x7')]);router[_0x0e98('0x8')](_0x0e98('0x9'),auth[_0x0e98('0xa')](),controller['describe']);router[_0x0e98('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x0e98('0xb'),auth[_0x0e98('0xa')](),controller[_0x0e98('0xc')]);router[_0x0e98('0x8')](_0x0e98('0xd'),auth[_0x0e98('0xa')](),controller['getTeams']);router['get'](_0x0e98('0xe'),auth[_0x0e98('0xa')](),controller[_0x0e98('0xf')]);router[_0x0e98('0x10')]('/',auth[_0x0e98('0xa')](),controller[_0x0e98('0x11')]);router[_0x0e98('0x10')](_0x0e98('0xd'),auth[_0x0e98('0xa')](),controller[_0x0e98('0x12')]);router[_0x0e98('0x10')](_0x0e98('0xe'),auth[_0x0e98('0xa')](),controller[_0x0e98('0x13')]);router['put'](_0x0e98('0x14'),auth[_0x0e98('0xa')](),controller[_0x0e98('0x15')]);router['delete'](_0x0e98('0x14'),auth[_0x0e98('0xa')](),controller['destroy']);router[_0x0e98('0x16')](_0x0e98('0xd'),auth['isAuthenticated'](),controller[_0x0e98('0x17')]);router[_0x0e98('0x16')](_0x0e98('0xe'),auth[_0x0e98('0xa')](),controller[_0x0e98('0x18')]);module[_0x0e98('0x19')]=router; \ No newline at end of file +var _0xb576=['update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','/describe','describe','get','/:id','/:id/members','isAuthenticated','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xb576,0x1b8));var _0x6b57=function(_0x360244,_0x3c35ad){_0x360244=_0x360244-0x0;var _0x13b668=_0xb576[_0x360244];return _0x13b668;};'use strict';var multer=require('multer');var util=require(_0x6b57('0x0'));var path=require(_0x6b57('0x1'));var timeout=require(_0x6b57('0x2'));var express=require(_0x6b57('0x3'));var router=express[_0x6b57('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b57('0x5'));var interaction=require(_0x6b57('0x6'));var config=require(_0x6b57('0x7'));var controller=require(_0x6b57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b57('0x9')]);router['get'](_0x6b57('0xa'),auth['isAuthenticated'](),controller[_0x6b57('0xb')]);router[_0x6b57('0xc')](_0x6b57('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6b57('0xe'),auth[_0x6b57('0xf')](),controller['getMembers']);router[_0x6b57('0xc')](_0x6b57('0x10'),auth[_0x6b57('0xf')](),controller[_0x6b57('0x11')]);router['get'](_0x6b57('0x12'),auth[_0x6b57('0xf')](),controller[_0x6b57('0x13')]);router['post']('/',auth[_0x6b57('0xf')](),controller[_0x6b57('0x14')]);router['post'](_0x6b57('0x10'),auth[_0x6b57('0xf')](),controller[_0x6b57('0x15')]);router[_0x6b57('0x16')](_0x6b57('0x12'),auth[_0x6b57('0xf')](),controller[_0x6b57('0x17')]);router[_0x6b57('0x18')]('/:id',auth[_0x6b57('0xf')](),controller[_0x6b57('0x19')]);router[_0x6b57('0x1a')](_0x6b57('0xd'),auth['isAuthenticated'](),controller[_0x6b57('0x1b')]);router[_0x6b57('0x1a')](_0x6b57('0x10'),auth[_0x6b57('0xf')](),controller[_0x6b57('0x1c')]);router[_0x6b57('0x1a')]('/:id/users',auth[_0x6b57('0xf')](),controller[_0x6b57('0x1d')]);module[_0x6b57('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 92a1ca6..731485f 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 _0x7dd2=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xfd9f63,_0x4abf21){var _0x228a36=function(_0x474e6c){while(--_0x474e6c){_0xfd9f63['push'](_0xfd9f63['shift']());}};_0x228a36(++_0x4abf21);}(_0x7dd2,0xf2));var _0x27dd=function(_0x5b5a7c,_0x562c97){_0x5b5a7c=_0x5b5a7c-0x0;var _0x312118=_0x7dd2[_0x5b5a7c];return _0x312118;};'use strict';var Sequelize=require(_0x27dd('0x0'));module[_0x27dd('0x1')]={'name':{'type':Sequelize[_0x27dd('0x2')],'unique':_0x27dd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x27dd('0x2')]},'timeout':{'type':Sequelize[_0x27dd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x27dd('0x5'),_0x27dd('0x6'))}}; \ No newline at end of file +var _0x3c21=['sequelize','STRING','INTEGER','ENUM','roundrobin'];(function(_0x30cd66,_0x12130f){var _0x532bdd=function(_0xa5e290){while(--_0xa5e290){_0x30cd66['push'](_0x30cd66['shift']());}};_0x532bdd(++_0x12130f);}(_0x3c21,0x14f));var _0x13c2=function(_0x2e55e3,_0x29f41f){_0x2e55e3=_0x2e55e3-0x0;var _0x230da2=_0x3c21[_0x2e55e3];return _0x230da2;};'use strict';var Sequelize=require(_0x13c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x13c2('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x13c2('0x1')]},'timeout':{'type':Sequelize[_0x13c2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x13c2('0x3')]('rrmemory','beepall',_0x13c2('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index bb128b2..d2c9d4b 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 _0xc74c=['includeAll','findAll','rows','show','rawAttributes','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','error','body','params','describe','getMembers','UserSmsQueue','order','pick','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','getTeams','addTeams','ids','Team','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SmsQueue','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options'];(function(_0x36cdc6,_0x2b662b){var _0x19617c=function(_0x28622c){while(--_0x28622c){_0x36cdc6['push'](_0x36cdc6['shift']());}};_0x19617c(++_0x2b662b);}(_0xc74c,0x163));var _0xcc74=function(_0x2847b1,_0x12ac39){_0x2847b1=_0x2847b1-0x0;var _0x1bacd0=_0xc74c[_0x2847b1];return _0x1bacd0;};'use strict';var emlformat=require(_0xcc74('0x0'));var rimraf=require(_0xcc74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc74('0x2'));var moment=require(_0xcc74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc74('0x4'));var util=require(_0xcc74('0x5'));var path=require(_0xcc74('0x6'));var sox=require(_0xcc74('0x7'));var csv=require(_0xcc74('0x8'));var ejs=require(_0xcc74('0x9'));var fs=require('fs');var fs_extra=require(_0xcc74('0xa'));var _=require('lodash');var squel=require(_0xcc74('0xb'));var crypto=require(_0xcc74('0xc'));var jsforce=require(_0xcc74('0xd'));var deskjs=require(_0xcc74('0xe'));var toCsv=require(_0xcc74('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc74('0xf'));var authService=require(_0xcc74('0x10'));var qs=require(_0xcc74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc74('0x12'));var logger=require(_0xcc74('0x13'))(_0xcc74('0x14'));var utils=require('../../config/utils');var config=require(_0xcc74('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc74('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xcc74('0x17'),'port':0x18eb});var socket=require(_0xcc74('0x18'))(new Redis(config[_0xcc74('0x19')]));require(_0xcc74('0x1a'))[_0xcc74('0x1b')](socket);function respondWithStatusCode(_0x59eff4,_0xe4aaaa){_0xe4aaaa=_0xe4aaaa||0xcc;return function(_0x3b3ed8){if(_0x3b3ed8){return _0x59eff4[_0xcc74('0x1c')](_0xe4aaaa);}return _0x59eff4[_0xcc74('0x1d')](_0xe4aaaa)[_0xcc74('0x1e')]();};}function respondWithResult(_0x57f804,_0x3ffb75){_0x3ffb75=_0x3ffb75||0xc8;return function(_0xbcdba8){if(_0xbcdba8){return _0x57f804[_0xcc74('0x1d')](_0x3ffb75)[_0xcc74('0x1f')](_0xbcdba8);}};}function respondWithFilteredResult(_0x2f33ad,_0x2715bb){return function(_0x170583){if(_0x170583){var _0x45d9bd=typeof _0x2715bb[_0xcc74('0x20')]==='undefined'&&typeof _0x2715bb[_0xcc74('0x21')]===_0xcc74('0x22');var _0x1cd9ae=_0x170583[_0xcc74('0x23')];var _0x2f084f=_0x45d9bd?0x0:_0x2715bb[_0xcc74('0x20')];var _0x5b48a2=_0x45d9bd?_0x170583[_0xcc74('0x23')]:_0x2715bb[_0xcc74('0x20')]+_0x2715bb['limit'];var _0x17a3aa;if(_0x5b48a2>=_0x1cd9ae){_0x5b48a2=_0x1cd9ae;_0x17a3aa=0xc8;}else{_0x17a3aa=0xce;}_0x2f33ad[_0xcc74('0x1d')](_0x17a3aa);return _0x2f33ad[_0xcc74('0x24')]('Content-Range',_0x2f084f+'-'+_0x5b48a2+'/'+_0x1cd9ae)[_0xcc74('0x1f')](_0x170583);}return null;};}function patchUpdates(_0x22b39f){return function(_0x403b76){try{jsonpatch[_0xcc74('0x25')](_0x403b76,_0x22b39f,!![]);}catch(_0x554111){return BPromise[_0xcc74('0x26')](_0x554111);}return _0x403b76[_0xcc74('0x27')]();};}function saveUpdates(_0x462348,_0x4f9b6e){return function(_0xdd96b1){if(_0xdd96b1){return _0xdd96b1[_0xcc74('0x28')](_0x462348)[_0xcc74('0x29')](function(_0x5a9fa6){return _0x5a9fa6;});}return null;};}function removeEntity(_0x59ee69,_0x563b64){return function(_0x134ad4){if(_0x134ad4){return _0x134ad4[_0xcc74('0x2a')]()[_0xcc74('0x29')](function(){var _0x311cc2=_0x134ad4[_0xcc74('0x2b')]({'plain':!![]});var _0x39de38='SmsQueues';return db[_0xcc74('0x2c')][_0xcc74('0x2a')]({'where':{'type':_0x39de38,'resourceId':_0x311cc2['id']}})[_0xcc74('0x29')](function(){return _0x134ad4;});})[_0xcc74('0x29')](function(){_0x59ee69['status'](0xcc)[_0xcc74('0x1e')]();});}};}function handleEntityNotFound(_0x4dd6ea,_0x46e47f){return function(_0x362a31){if(!_0x362a31){_0x4dd6ea[_0xcc74('0x1c')](0x194);}return _0x362a31;};}function handleError(_0x20fe73,_0x4c75d1){_0x4c75d1=_0x4c75d1||0x1f4;return function(_0x390bc0){logger['error'](_0x390bc0[_0xcc74('0x2d')]);if(_0x390bc0[_0xcc74('0x2e')]){delete _0x390bc0[_0xcc74('0x2e')];}_0x20fe73[_0xcc74('0x1d')](_0x4c75d1)[_0xcc74('0x2f')](_0x390bc0);};}exports[_0xcc74('0x30')]=function(_0x54d120,_0x5bdf22){var _0x4445c4={},_0x2d07ae={},_0x3d0f8b={'count':0x0,'rows':[]};var _0x5bbc39=_[_0xcc74('0x31')](db[_0xcc74('0x32')]['rawAttributes'],function(_0x53e0e6){return{'name':_0x53e0e6[_0xcc74('0x33')],'type':_0x53e0e6[_0xcc74('0x34')]['key']};});_0x2d07ae[_0xcc74('0x35')]=_[_0xcc74('0x31')](_0x5bbc39,_0xcc74('0x2e'));_0x2d07ae[_0xcc74('0x36')]=_[_0xcc74('0x37')](_0x54d120[_0xcc74('0x36')]);_0x2d07ae['filters']=_[_0xcc74('0x38')](_0x2d07ae[_0xcc74('0x35')],_0x2d07ae[_0xcc74('0x36')]);_0x4445c4[_0xcc74('0x39')]=_[_0xcc74('0x38')](_0x2d07ae[_0xcc74('0x35')],qs[_0xcc74('0x3a')](_0x54d120['query'][_0xcc74('0x3a')]));_0x4445c4['attributes']=_0x4445c4[_0xcc74('0x39')][_0xcc74('0x3b')]?_0x4445c4[_0xcc74('0x39')]:_0x2d07ae[_0xcc74('0x35')];if(!_0x54d120[_0xcc74('0x36')][_0xcc74('0x3c')](_0xcc74('0x3d'))){_0x4445c4[_0xcc74('0x21')]=qs[_0xcc74('0x21')](_0x54d120[_0xcc74('0x36')][_0xcc74('0x21')]);_0x4445c4[_0xcc74('0x20')]=qs['offset'](_0x54d120[_0xcc74('0x36')][_0xcc74('0x20')]);}_0x4445c4['order']=qs[_0xcc74('0x3e')](_0x54d120[_0xcc74('0x36')][_0xcc74('0x3e')]);_0x4445c4[_0xcc74('0x3f')]=qs[_0xcc74('0x40')](_['pick'](_0x54d120[_0xcc74('0x36')],_0x2d07ae['filters']),_0x5bbc39);if(_0x54d120[_0xcc74('0x36')][_0xcc74('0x41')]){_0x4445c4[_0xcc74('0x3f')]=_['merge'](_0x4445c4[_0xcc74('0x3f')],{'$or':_[_0xcc74('0x31')](_0x5bbc39,function(_0x4333eb){if(_0x4333eb[_0xcc74('0x34')]!==_0xcc74('0x42')){var _0x13d436={};_0x13d436[_0x4333eb[_0xcc74('0x2e')]]={'$like':'%'+_0x54d120[_0xcc74('0x36')][_0xcc74('0x41')]+'%'};return _0x13d436;}})});}_0x4445c4=_['merge']({},_0x4445c4,_0x54d120[_0xcc74('0x43')]);var _0x3e3d99={'where':_0x4445c4[_0xcc74('0x3f')]};return db[_0xcc74('0x32')][_0xcc74('0x23')](_0x3e3d99)[_0xcc74('0x29')](function(_0x37deeb){_0x3d0f8b[_0xcc74('0x23')]=_0x37deeb;if(_0x54d120[_0xcc74('0x36')][_0xcc74('0x44')]){_0x4445c4['include']=[{'all':!![]}];}return db[_0xcc74('0x32')][_0xcc74('0x45')](_0x4445c4);})[_0xcc74('0x29')](function(_0x1534fb){_0x3d0f8b[_0xcc74('0x46')]=_0x1534fb;return _0x3d0f8b;})[_0xcc74('0x29')](respondWithFilteredResult(_0x5bdf22,_0x4445c4))['catch'](handleError(_0x5bdf22,null));};exports[_0xcc74('0x47')]=function(_0x3bd226,_0x1b5270){var _0xd21897={'raw':!![],'where':{'id':_0x3bd226['params']['id']}},_0x51ebfa={};_0x51ebfa[_0xcc74('0x35')]=_[_0xcc74('0x37')](db[_0xcc74('0x32')][_0xcc74('0x48')]);_0x51ebfa[_0xcc74('0x36')]=_[_0xcc74('0x37')](_0x3bd226['query']);_0x51ebfa[_0xcc74('0x40')]=_[_0xcc74('0x38')](_0x51ebfa[_0xcc74('0x35')],_0x51ebfa[_0xcc74('0x36')]);_0xd21897[_0xcc74('0x39')]=_['intersection'](_0x51ebfa['model'],qs[_0xcc74('0x3a')](_0x3bd226[_0xcc74('0x36')][_0xcc74('0x3a')]));_0xd21897[_0xcc74('0x39')]=_0xd21897[_0xcc74('0x39')][_0xcc74('0x3b')]?_0xd21897['attributes']:_0x51ebfa['model'];if(_0x3bd226['query'][_0xcc74('0x44')]){_0xd21897['include']=[{'all':!![]}];}_0xd21897=_[_0xcc74('0x49')]({},_0xd21897,_0x3bd226[_0xcc74('0x43')]);return db[_0xcc74('0x32')]['find'](_0xd21897)[_0xcc74('0x29')](handleEntityNotFound(_0x1b5270,null))[_0xcc74('0x29')](respondWithResult(_0x1b5270,null))[_0xcc74('0x4a')](handleError(_0x1b5270,null));};exports[_0xcc74('0x4b')]=function(_0x4060cc,_0x24e6cd){return db['SmsQueue']['create'](_0x4060cc['body'],{})[_0xcc74('0x29')](function(_0x5c5409){var _0x282a4b=_0x4060cc[_0xcc74('0x4c')][_0xcc74('0x2b')]({'plain':!![]});if(!_0x282a4b)throw new Error(_0xcc74('0x4d'));if(_0x282a4b[_0xcc74('0x4e')]===_0xcc74('0x4c')){var _0x112244=_0x5c5409[_0xcc74('0x2b')]({'plain':!![]});var _0x37fab3=_0xcc74('0x4f');return db[_0xcc74('0x50')][_0xcc74('0x51')]({'where':{'name':_0x37fab3,'userProfileId':_0x282a4b[_0xcc74('0x52')]},'raw':!![]})[_0xcc74('0x29')](function(_0x26df57){if(_0x26df57&&_0x26df57[_0xcc74('0x53')]===0x0){return db[_0xcc74('0x2c')][_0xcc74('0x4b')]({'name':_0x112244[_0xcc74('0x2e')],'resourceId':_0x112244['id'],'type':_0x26df57[_0xcc74('0x2e')],'sectionId':_0x26df57['id']},{})[_0xcc74('0x29')](function(){return _0x5c5409;});}else{return _0x5c5409;}})[_0xcc74('0x4a')](function(_0x512349){logger[_0xcc74('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x512349);throw _0x512349;});}return _0x5c5409;})['then'](respondWithResult(_0x24e6cd,0xc9))['catch'](handleError(_0x24e6cd,null));};exports[_0xcc74('0x28')]=function(_0x2e9ca2,_0x3655c6){if(_0x2e9ca2[_0xcc74('0x55')]['id']){delete _0x2e9ca2[_0xcc74('0x55')]['id'];}return db[_0xcc74('0x32')]['find']({'where':{'id':_0x2e9ca2['params']['id']}})['then'](handleEntityNotFound(_0x3655c6,null))['then'](saveUpdates(_0x2e9ca2[_0xcc74('0x55')],null))[_0xcc74('0x29')](respondWithResult(_0x3655c6,null))[_0xcc74('0x4a')](handleError(_0x3655c6,null));};exports[_0xcc74('0x2a')]=function(_0x496570,_0x24dce4){return db[_0xcc74('0x32')][_0xcc74('0x51')]({'where':{'id':_0x496570[_0xcc74('0x56')]['id']}})['then'](handleEntityNotFound(_0x24dce4,null))['then'](removeEntity(_0x24dce4,null))[_0xcc74('0x4a')](handleError(_0x24dce4,null));};exports[_0xcc74('0x57')]=function(_0xd75fe7,_0xb6c84b){return db[_0xcc74('0x32')][_0xcc74('0x57')]()[_0xcc74('0x29')](respondWithResult(_0xb6c84b,null))[_0xcc74('0x4a')](handleError(_0xb6c84b,null));};exports[_0xcc74('0x58')]=function(_0x431852,_0x969729,_0x2698b0){var _0x17db4d={'raw':!![],'where':{}},_0xf191c8={},_0x549543;return db[_0xcc74('0x32')]['findOne']({'where':{'id':_0x431852[_0xcc74('0x56')]['id']}})['then'](handleEntityNotFound(_0x969729,null))['then'](function(_0x43fba0){if(_0x43fba0){_0x549543=_0x43fba0[_0xcc74('0x2b')]({'plain':!![]});_0xf191c8[_0xcc74('0x35')]=_['keys'](db[_0xcc74('0x59')][_0xcc74('0x48')]);_0xf191c8[_0xcc74('0x36')]=_[_0xcc74('0x37')](_0x431852[_0xcc74('0x36')]);_0xf191c8[_0xcc74('0x40')]=_[_0xcc74('0x38')](_0xf191c8[_0xcc74('0x35')],_0xf191c8['query']);_0x17db4d[_0xcc74('0x39')]=_[_0xcc74('0x38')](_0xf191c8[_0xcc74('0x35')],qs[_0xcc74('0x3a')](_0x431852[_0xcc74('0x36')][_0xcc74('0x3a')]));_0x17db4d[_0xcc74('0x39')]=_0x17db4d['attributes'][_0xcc74('0x3b')]?_0x17db4d[_0xcc74('0x39')]:_0xf191c8[_0xcc74('0x35')];if(!_0x431852[_0xcc74('0x36')]['hasOwnProperty'](_0xcc74('0x3d'))){_0x17db4d[_0xcc74('0x21')]=qs['limit'](_0x431852[_0xcc74('0x36')][_0xcc74('0x21')]);_0x17db4d['offset']=qs[_0xcc74('0x20')](_0x431852['query'][_0xcc74('0x20')]);}_0x17db4d[_0xcc74('0x5a')]=qs[_0xcc74('0x3e')](_0x431852['query'][_0xcc74('0x3e')]);_0x17db4d[_0xcc74('0x3f')]=qs[_0xcc74('0x40')](_[_0xcc74('0x5b')](_0x431852[_0xcc74('0x36')],_0xf191c8[_0xcc74('0x40')]));_0x17db4d[_0xcc74('0x3f')][_0xcc74('0x5c')]=_0x43fba0['id'];if(_0x431852[_0xcc74('0x36')][_0xcc74('0x41')]){_0x17db4d[_0xcc74('0x3f')]=_['merge'](_0x17db4d[_0xcc74('0x3f')],{'$or':_[_0xcc74('0x31')](_0x17db4d[_0xcc74('0x39')],function(_0x3dbc24){var _0x2f252f={};_0x2f252f[_0x3dbc24]={'$like':'%'+_0x431852[_0xcc74('0x36')][_0xcc74('0x41')]+'%'};return _0x2f252f;})});}_0x17db4d=_[_0xcc74('0x49')]({},_0x17db4d,_0x431852['options']);return db[_0xcc74('0x59')][_0xcc74('0x45')](_0x17db4d);}})[_0xcc74('0x29')](function(_0xc0139b){if(_0xc0139b){return db[_0xcc74('0x5d')][_0xcc74('0x5e')]({'where':{'id':_[_0xcc74('0x31')](_0xc0139b,'UserId'),'role':_0xcc74('0x5f')},'attributes':['id',_0xcc74('0x2e'),_0xcc74('0x60'),_0xcc74('0x61'),_0xcc74('0x62')]});}})[_0xcc74('0x29')](function(_0x59e2e0){if(_0x59e2e0){return{'count':_0x59e2e0[_0xcc74('0x23')],'rows':_[_0xcc74('0x31')](_0x59e2e0[_0xcc74('0x46')],function(_0x333288){return{'membername':_0x333288[_0xcc74('0x2e')],'UserId':_0x333288['id'],'queue_name':_0x549543[_0xcc74('0x2e')],'SmsQueueId':_0x549543['id'],'interface':util[_0xcc74('0x63')](_0xcc74('0x64'),_0xcc74('0x65'),_0x333288[_0xcc74('0x2e')]),'penalty':0x0,'paused':_0x333288[_0xcc74('0x60')],'createdAt':_0x333288['createdAt'],'updatedAt':_0x333288[_0xcc74('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc74('0x29')](respondWithFilteredResult(_0x969729,_0x17db4d))[_0xcc74('0x4a')](handleError(_0x969729,null));};exports['getTeams']=function(_0x52cc95,_0x59a953,_0x3b57b9){var _0x53a391={};var _0x22f16b={};var _0x45470a;var _0x4db47a;return db[_0xcc74('0x32')][_0xcc74('0x66')]({'where':{'id':_0x52cc95['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x59a953,null))[_0xcc74('0x29')](function(_0x5ea265){if(_0x5ea265){_0x45470a=_0x5ea265;_0x22f16b[_0xcc74('0x35')]=_[_0xcc74('0x37')](db['Team'][_0xcc74('0x48')]);_0x22f16b[_0xcc74('0x36')]=_['keys'](_0x52cc95[_0xcc74('0x36')]);_0x22f16b['filters']=_[_0xcc74('0x38')](_0x22f16b[_0xcc74('0x35')],_0x22f16b['query']);_0x53a391[_0xcc74('0x39')]=_[_0xcc74('0x38')](_0x22f16b['model'],qs['fields'](_0x52cc95['query'][_0xcc74('0x3a')]));_0x53a391[_0xcc74('0x39')]=_0x53a391[_0xcc74('0x39')]['length']?_0x53a391['attributes']:_0x22f16b[_0xcc74('0x35')];_0x53a391['order']=qs['sort'](_0x52cc95[_0xcc74('0x36')][_0xcc74('0x3e')]);_0x53a391[_0xcc74('0x3f')]=qs[_0xcc74('0x40')](_[_0xcc74('0x5b')](_0x52cc95[_0xcc74('0x36')],_0x22f16b[_0xcc74('0x40')]));if(_0x52cc95[_0xcc74('0x36')][_0xcc74('0x41')]){_0x53a391[_0xcc74('0x3f')]=_[_0xcc74('0x49')](_0x53a391[_0xcc74('0x3f')],{'$or':_[_0xcc74('0x31')](_0x53a391['attributes'],function(_0x29ef96){var _0x397c32={};_0x397c32[_0x29ef96]={'$like':'%'+_0x52cc95['query'][_0xcc74('0x41')]+'%'};return _0x397c32;})});}_0x53a391=_['merge']({},_0x53a391,_0x52cc95[_0xcc74('0x43')]);return _0x45470a[_0xcc74('0x67')](_0x53a391);}})[_0xcc74('0x29')](function(_0x25a032){if(_0x25a032){_0x4db47a=_0x25a032['length'];if(!_0x52cc95[_0xcc74('0x36')]['hasOwnProperty'](_0xcc74('0x3d'))){_0x53a391[_0xcc74('0x21')]=qs[_0xcc74('0x21')](_0x52cc95['query'][_0xcc74('0x21')]);_0x53a391[_0xcc74('0x20')]=qs['offset'](_0x52cc95[_0xcc74('0x36')]['offset']);}return _0x45470a['getTeams'](_0x53a391);}})[_0xcc74('0x29')](function(_0x409f85){if(_0x409f85){return _0x409f85?{'count':_0x4db47a,'rows':_0x409f85}:null;}})[_0xcc74('0x29')](respondWithResult(_0x59a953,null))[_0xcc74('0x4a')](handleError(_0x59a953,null));};exports[_0xcc74('0x68')]=function(_0x2eb9fe,_0x1a5cd1,_0x826114){var _0x3a1a2a=_0x2eb9fe[_0xcc74('0x55')][_0xcc74('0x69')];return db[_0xcc74('0x6a')][_0xcc74('0x45')]({'where':{'id':_0x3a1a2a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xcc74('0x6b'),'voicePause',_0xcc74('0x6c')],'raw':!![]}]})[_0xcc74('0x29')](function(_0x5c5e8e){if(_0x5c5e8e){var _0x253ccc=_[_0xcc74('0x6d')](_0x5c5e8e,function(_0x3fb82d){var _0x7a3d88=_0x3fb82d['get']({'plain':!![]});return _0x7a3d88[_0xcc74('0x6e')];});return db['SmsQueue'][_0xcc74('0x51')]({'where':{'id':_0x2eb9fe[_0xcc74('0x56')]['id']}})['then'](function(_0x5f51a8){return db[_0xcc74('0x6f')][_0xcc74('0x70')](function(_0x71c3b9){return _0x5f51a8[_0xcc74('0x68')](_0x3a1a2a,{'transaction':_0x71c3b9})['then'](function(){return BPromise[_0xcc74('0x71')](_0x253ccc,function(_0x2c57f2){return db[_0xcc74('0x59')]['findOrCreate']({'where':{'UserId':_0x2c57f2['id'],'SmsQueueId':_0x2eb9fe[_0xcc74('0x56')]['id']},'transaction':_0x71c3b9});});})['then'](function(){_0x253ccc[_0xcc74('0x72')](function(_0x43d82c){socket[_0xcc74('0x73')](_0xcc74('0x74'),{'UserId':_0x43d82c['id'],'SmsQueueId':_0x5f51a8['id']});});});});});}})['then'](respondWithStatusCode(_0x1a5cd1,null))['catch'](handleError(_0x1a5cd1,null));};exports[_0xcc74('0x75')]=function(_0x37f30c,_0x3e1a23,_0x5ea768){return db['Team']['findAll']({'where':{'id':_0x37f30c[_0xcc74('0x36')][_0xcc74('0x69')]},'attributes':['id'],'include':[{'model':db[_0xcc74('0x5d')],'as':_0xcc74('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e1a23,null))['then'](function(_0x3a43b0){var _0x3a7128=_[_0xcc74('0x31')](_0x3a43b0,'id');var _0x4c56cb=[];var _0x37edc7=[];var _0x2e8266=squel['select']();_0x2e8266['field']('tq.TeamId')['from'](_0xcc74('0x76'),'tq')[_0xcc74('0x77')](_0xcc74('0x78'),'ut',_0xcc74('0x79'))[_0xcc74('0x3f')](_0xcc74('0x7a'),_0x37f30c[_0xcc74('0x56')]['id']);for(var _0x401362=0x0;_0x401362<_0x3a43b0[_0xcc74('0x3b')];_0x401362+=0x1){let _0x730224=_0x3a43b0[_0x401362];for(var _0x2c5172=0x0;_0x2c5172<_0x730224[_0xcc74('0x6e')]['length'];_0x2c5172+=0x1){let _0x48195f=_0x730224['Agents'][_0x2c5172];var _0x2d0d21=_0x2e8266[_0xcc74('0x7b')]();_0x2d0d21['where'](_0xcc74('0x7c'),_0x48195f['id']);_0x37edc7[_0xcc74('0x7d')](db['sequelize']['query'](_0x2d0d21['toString'](),{'type':db[_0xcc74('0x6f')][_0xcc74('0x7e')][_0xcc74('0x7f')]})[_0xcc74('0x29')](function(_0x196834){if(_0x196834['length']===0x1){return _0x48195f['id'];}else{var _0x121716=_[_0xcc74('0x80')](_[_0xcc74('0x31')](_0x196834,_0xcc74('0x81')),function(_0x35c393){return _[_0xcc74('0x82')](_0x3a7128,_0x35c393);});if(_0x121716){return _0x48195f['id'];}}}));}}return BPromise['all'](_0x37edc7)[_0xcc74('0x29')](function(_0x3e5dc6){_0x4c56cb=_(_0x4c56cb)[_0xcc74('0x83')](_0x3e5dc6)['compact']()[_0xcc74('0x84')]();return db[_0xcc74('0x32')][_0xcc74('0x51')]({'where':{'id':_0x37f30c['params']['id']}})['then'](function(_0x5675e7){return db[_0xcc74('0x6f')][_0xcc74('0x70')](function(_0x1aa037){return _0x5675e7['removeTeams'](_0x37f30c[_0xcc74('0x36')][_0xcc74('0x69')],{'transaction':_0x1aa037})['then'](function(){if(!_[_0xcc74('0x85')](_0x4c56cb)){return _0x5675e7['removeAgents'](_0x4c56cb,{'transaction':_0x1aa037});}})[_0xcc74('0x29')](function(){_0x4c56cb[_0xcc74('0x72')](function(_0x260eff){socket[_0xcc74('0x73')](_0xcc74('0x86'),{'UserId':_0x260eff,'SmsQueueId':_0x5675e7['id']});});});});});});})[_0xcc74('0x29')](respondWithStatusCode(_0x3e1a23,null))[_0xcc74('0x4a')](handleError(_0x3e1a23,null));};exports[_0xcc74('0x87')]=function(_0x423bfd,_0x1a9e91,_0x58339e){return db[_0xcc74('0x32')][_0xcc74('0x51')]({'where':{'id':_0x423bfd[_0xcc74('0x56')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x1a9e91,null))[_0xcc74('0x29')](function(_0x5f4329){if(_0x5f4329){return _0x5f4329[_0xcc74('0x87')](_0x423bfd[_0xcc74('0x55')][_0xcc74('0x69')],_[_0xcc74('0x88')](_0x423bfd[_0xcc74('0x55')],['ids','id'])||{})[_0xcc74('0x89')](function(_0x2e0dbc){for(var _0x1cb07b=0x0;_0x1cb07b<_0x423bfd[_0xcc74('0x55')][_0xcc74('0x69')]['length'];_0x1cb07b+=0x1){socket[_0xcc74('0x73')]('userSmsQueue:save',{'UserId':Number(_0x423bfd['body'][_0xcc74('0x69')][_0x1cb07b]),'SmsQueueId':Number(_0x423bfd[_0xcc74('0x56')]['id'])});}return _0x2e0dbc;});}})['then'](respondWithResult(_0x1a9e91,null))[_0xcc74('0x4a')](handleError(_0x1a9e91,null));};exports['removeAgents']=function(_0x4a0d7b,_0x6a7153,_0x24c969){return db[_0xcc74('0x32')]['find']({'where':{'id':_0x4a0d7b[_0xcc74('0x56')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x6a7153,null))['then'](function(_0x231537){if(_0x231537){return _0x231537[_0xcc74('0x8a')](_0x4a0d7b[_0xcc74('0x36')]['ids'])[_0xcc74('0x29')](function(){if(_[_0xcc74('0x8b')](_0x4a0d7b[_0xcc74('0x36')][_0xcc74('0x69')])){for(var _0x24dc13=0x0;_0x24dc13<_0x4a0d7b[_0xcc74('0x36')][_0xcc74('0x69')][_0xcc74('0x3b')];_0x24dc13+=0x1){socket[_0xcc74('0x73')](_0xcc74('0x86'),{'UserId':Number(_0x4a0d7b[_0xcc74('0x36')]['ids'][_0x24dc13]),'SmsQueueId':Number(_0x4a0d7b[_0xcc74('0x56')]['id'])});}}else{socket[_0xcc74('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x4a0d7b[_0xcc74('0x36')][_0xcc74('0x69')]),'SmsQueueId':Number(_0x4a0d7b['params']['id'])});}});}})[_0xcc74('0x29')](respondWithStatusCode(_0x6a7153,null))[_0xcc74('0x4a')](handleError(_0x6a7153,null));};exports[_0xcc74('0x8c')]=function(_0x562b20,_0x540d59,_0x1c2042){var _0x249658={};var _0x46f18c={};var _0x3c6d61;var _0x17114f;return db['SmsQueue'][_0xcc74('0x66')]({'where':{'id':_0x562b20['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x540d59,null))[_0xcc74('0x29')](function(_0x1e759f){if(_0x1e759f){_0x3c6d61=_0x1e759f;_0x46f18c['model']=_[_0xcc74('0x37')](db[_0xcc74('0x5d')]['rawAttributes']);_0x46f18c[_0xcc74('0x36')]=_['keys'](_0x562b20[_0xcc74('0x36')]);_0x46f18c[_0xcc74('0x40')]=_[_0xcc74('0x38')](_0x46f18c[_0xcc74('0x35')],_0x46f18c[_0xcc74('0x36')]);_0x249658[_0xcc74('0x39')]=_[_0xcc74('0x38')](_0x46f18c[_0xcc74('0x35')],qs[_0xcc74('0x3a')](_0x562b20[_0xcc74('0x36')][_0xcc74('0x3a')]));_0x249658[_0xcc74('0x39')]=_0x249658[_0xcc74('0x39')][_0xcc74('0x3b')]?_0x249658[_0xcc74('0x39')]:_0x46f18c[_0xcc74('0x35')];_0x249658[_0xcc74('0x5a')]=qs[_0xcc74('0x3e')](_0x562b20[_0xcc74('0x36')][_0xcc74('0x3e')]);_0x249658[_0xcc74('0x3f')]=qs[_0xcc74('0x40')](_['pick'](_0x562b20[_0xcc74('0x36')],_0x46f18c['filters']));if(_0x562b20[_0xcc74('0x36')][_0xcc74('0x41')]){_0x249658['where']=_[_0xcc74('0x49')](_0x249658[_0xcc74('0x3f')],{'$or':_['map'](_0x249658[_0xcc74('0x39')],function(_0x5d4913){var _0x4185eb={};_0x4185eb[_0x5d4913]={'$like':'%'+_0x562b20[_0xcc74('0x36')][_0xcc74('0x41')]+'%'};return _0x4185eb;})});}_0x249658=_[_0xcc74('0x49')]({},_0x249658,_0x562b20[_0xcc74('0x43')]);return _0x3c6d61[_0xcc74('0x8c')](_0x249658);}})[_0xcc74('0x29')](function(_0x11daad){if(_0x11daad){_0x17114f=_0x11daad[_0xcc74('0x3b')];if(!_0x562b20[_0xcc74('0x36')][_0xcc74('0x3c')](_0xcc74('0x3d'))){_0x249658['limit']=qs[_0xcc74('0x21')](_0x562b20['query'][_0xcc74('0x21')]);_0x249658[_0xcc74('0x20')]=qs['offset'](_0x562b20[_0xcc74('0x36')][_0xcc74('0x20')]);}return _0x3c6d61['getAgents'](_0x249658);}})[_0xcc74('0x29')](function(_0x4823a0){if(_0x4823a0){return _0x4823a0?{'count':_0x17114f,'rows':_0x4823a0}:null;}})[_0xcc74('0x29')](respondWithResult(_0x540d59,null))[_0xcc74('0x4a')](handleError(_0x540d59,null));}; \ No newline at end of file +var _0xff69=['emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','redis','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','findAll','rows','show','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','findOne','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','from','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','TeamId','includes','all','union','compact','value','isEmpty','removeAgents'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0xff69,0x119));var _0x9ff6=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0xff69[_0x22a8c4];return _0x104c6d;};'use strict';var emlformat=require(_0x9ff6('0x0'));var rimraf=require(_0x9ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ff6('0x2'));var rp=require(_0x9ff6('0x3'));var moment=require(_0x9ff6('0x4'));var BPromise=require(_0x9ff6('0x5'));var Mustache=require(_0x9ff6('0x6'));var util=require('util');var path=require(_0x9ff6('0x7'));var sox=require(_0x9ff6('0x8'));var csv=require(_0x9ff6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ff6('0xa'));var _=require(_0x9ff6('0xb'));var squel=require('squel');var crypto=require(_0x9ff6('0xc'));var jsforce=require(_0x9ff6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ff6('0x9'));var querystring=require(_0x9ff6('0xe'));var Papa=require(_0x9ff6('0xf'));var Redis=require(_0x9ff6('0x10'));var authService=require(_0x9ff6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ff6('0x12'));var hardwareService=require(_0x9ff6('0x13'));var logger=require(_0x9ff6('0x14'))('api');var utils=require(_0x9ff6('0x15'));var config=require(_0x9ff6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff6('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9ff6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ff6('0x19')]));require(_0x9ff6('0x1a'))[_0x9ff6('0x1b')](socket);function respondWithStatusCode(_0x238358,_0x5b020b){_0x5b020b=_0x5b020b||0xcc;return function(_0x32f0d6){if(_0x32f0d6){return _0x238358[_0x9ff6('0x1c')](_0x5b020b);}return _0x238358[_0x9ff6('0x1d')](_0x5b020b)[_0x9ff6('0x1e')]();};}function respondWithResult(_0x2399b5,_0x2d7979){_0x2d7979=_0x2d7979||0xc8;return function(_0x19fb3c){if(_0x19fb3c){return _0x2399b5[_0x9ff6('0x1d')](_0x2d7979)['json'](_0x19fb3c);}};}function respondWithFilteredResult(_0x36e1d5,_0x283366){return function(_0x4e590f){if(_0x4e590f){var _0x74683b=typeof _0x283366[_0x9ff6('0x1f')]===_0x9ff6('0x20')&&typeof _0x283366[_0x9ff6('0x21')]===_0x9ff6('0x20');var _0xbfca9e=_0x4e590f[_0x9ff6('0x22')];var _0xdfccbc=_0x74683b?0x0:_0x283366['offset'];var _0x5337cf=_0x74683b?_0x4e590f[_0x9ff6('0x22')]:_0x283366[_0x9ff6('0x1f')]+_0x283366['limit'];var _0x477c1b;if(_0x5337cf>=_0xbfca9e){_0x5337cf=_0xbfca9e;_0x477c1b=0xc8;}else{_0x477c1b=0xce;}_0x36e1d5[_0x9ff6('0x1d')](_0x477c1b);return _0x36e1d5[_0x9ff6('0x23')](_0x9ff6('0x24'),_0xdfccbc+'-'+_0x5337cf+'/'+_0xbfca9e)[_0x9ff6('0x25')](_0x4e590f);}return null;};}function patchUpdates(_0x2c7830){return function(_0x4ed36a){try{jsonpatch[_0x9ff6('0x26')](_0x4ed36a,_0x2c7830,!![]);}catch(_0x5bd5da){return BPromise['reject'](_0x5bd5da);}return _0x4ed36a[_0x9ff6('0x27')]();};}function saveUpdates(_0x38d281,_0x55b9d7){return function(_0x56388d){if(_0x56388d){return _0x56388d[_0x9ff6('0x28')](_0x38d281)[_0x9ff6('0x29')](function(_0xc6f160){return _0xc6f160;});}return null;};}function removeEntity(_0x236038,_0x21c211){return function(_0x542254){if(_0x542254){return _0x542254[_0x9ff6('0x2a')]()[_0x9ff6('0x29')](function(){var _0x122ca4=_0x542254[_0x9ff6('0x2b')]({'plain':!![]});var _0x5a1ce3=_0x9ff6('0x2c');return db[_0x9ff6('0x2d')][_0x9ff6('0x2a')]({'where':{'type':_0x5a1ce3,'resourceId':_0x122ca4['id']}})[_0x9ff6('0x29')](function(){return _0x542254;});})[_0x9ff6('0x29')](function(){_0x236038[_0x9ff6('0x1d')](0xcc)[_0x9ff6('0x1e')]();});}};}function handleEntityNotFound(_0x260749,_0x3088ee){return function(_0x3a9df1){if(!_0x3a9df1){_0x260749['sendStatus'](0x194);}return _0x3a9df1;};}function handleError(_0x36a90e,_0x2fb7d8){_0x2fb7d8=_0x2fb7d8||0x1f4;return function(_0x1a8ed1){logger[_0x9ff6('0x2e')](_0x1a8ed1['stack']);if(_0x1a8ed1[_0x9ff6('0x2f')]){delete _0x1a8ed1[_0x9ff6('0x2f')];}_0x36a90e[_0x9ff6('0x1d')](_0x2fb7d8)['send'](_0x1a8ed1);};}exports[_0x9ff6('0x30')]=function(_0x195ae3,_0x4c6490){var _0x435ef0={},_0xaf444a={},_0x2540a5={'count':0x0,'rows':[]};var _0xbd3264=_[_0x9ff6('0x31')](db['SmsQueue'][_0x9ff6('0x32')],function(_0x1a21ee){return{'name':_0x1a21ee['fieldName'],'type':_0x1a21ee[_0x9ff6('0x33')][_0x9ff6('0x34')]};});_0xaf444a[_0x9ff6('0x35')]=_[_0x9ff6('0x31')](_0xbd3264,_0x9ff6('0x2f'));_0xaf444a[_0x9ff6('0x36')]=_[_0x9ff6('0x37')](_0x195ae3[_0x9ff6('0x36')]);_0xaf444a[_0x9ff6('0x38')]=_['intersection'](_0xaf444a[_0x9ff6('0x35')],_0xaf444a[_0x9ff6('0x36')]);_0x435ef0[_0x9ff6('0x39')]=_[_0x9ff6('0x3a')](_0xaf444a[_0x9ff6('0x35')],qs[_0x9ff6('0x3b')](_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x3b')]));_0x435ef0['attributes']=_0x435ef0['attributes']['length']?_0x435ef0['attributes']:_0xaf444a[_0x9ff6('0x35')];if(!_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x3c')](_0x9ff6('0x3d'))){_0x435ef0[_0x9ff6('0x21')]=qs[_0x9ff6('0x21')](_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x21')]);_0x435ef0[_0x9ff6('0x1f')]=qs[_0x9ff6('0x1f')](_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x1f')]);}_0x435ef0['order']=qs[_0x9ff6('0x3e')](_0x195ae3['query'][_0x9ff6('0x3e')]);_0x435ef0[_0x9ff6('0x3f')]=qs[_0x9ff6('0x38')](_[_0x9ff6('0x40')](_0x195ae3[_0x9ff6('0x36')],_0xaf444a[_0x9ff6('0x38')]),_0xbd3264);if(_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x41')]){_0x435ef0[_0x9ff6('0x3f')]=_[_0x9ff6('0x42')](_0x435ef0['where'],{'$or':_[_0x9ff6('0x31')](_0xbd3264,function(_0x1d8857){if(_0x1d8857[_0x9ff6('0x33')]!==_0x9ff6('0x43')){var _0x81fcc5={};_0x81fcc5[_0x1d8857['name']]={'$like':'%'+_0x195ae3[_0x9ff6('0x36')][_0x9ff6('0x41')]+'%'};return _0x81fcc5;}})});}_0x435ef0=_['merge']({},_0x435ef0,_0x195ae3[_0x9ff6('0x44')]);var _0x25576d={'where':_0x435ef0[_0x9ff6('0x3f')]};return db[_0x9ff6('0x45')][_0x9ff6('0x22')](_0x25576d)['then'](function(_0x446fd8){_0x2540a5[_0x9ff6('0x22')]=_0x446fd8;if(_0x195ae3['query'][_0x9ff6('0x46')]){_0x435ef0['include']=[{'all':!![]}];}return db['SmsQueue'][_0x9ff6('0x47')](_0x435ef0);})[_0x9ff6('0x29')](function(_0xf7ae7a){_0x2540a5[_0x9ff6('0x48')]=_0xf7ae7a;return _0x2540a5;})[_0x9ff6('0x29')](respondWithFilteredResult(_0x4c6490,_0x435ef0))['catch'](handleError(_0x4c6490,null));};exports[_0x9ff6('0x49')]=function(_0x154085,_0x149732){var _0x2c9bab={'raw':!![],'where':{'id':_0x154085['params']['id']}},_0x43af6d={};_0x43af6d['model']=_['keys'](db[_0x9ff6('0x45')][_0x9ff6('0x32')]);_0x43af6d[_0x9ff6('0x36')]=_[_0x9ff6('0x37')](_0x154085['query']);_0x43af6d['filters']=_[_0x9ff6('0x3a')](_0x43af6d['model'],_0x43af6d['query']);_0x2c9bab[_0x9ff6('0x39')]=_[_0x9ff6('0x3a')](_0x43af6d[_0x9ff6('0x35')],qs[_0x9ff6('0x3b')](_0x154085['query']['fields']));_0x2c9bab[_0x9ff6('0x39')]=_0x2c9bab[_0x9ff6('0x39')][_0x9ff6('0x4a')]?_0x2c9bab['attributes']:_0x43af6d[_0x9ff6('0x35')];if(_0x154085[_0x9ff6('0x36')][_0x9ff6('0x46')]){_0x2c9bab['include']=[{'all':!![]}];}_0x2c9bab=_['merge']({},_0x2c9bab,_0x154085['options']);return db['SmsQueue'][_0x9ff6('0x4b')](_0x2c9bab)[_0x9ff6('0x29')](handleEntityNotFound(_0x149732,null))[_0x9ff6('0x29')](respondWithResult(_0x149732,null))[_0x9ff6('0x4c')](handleError(_0x149732,null));};exports[_0x9ff6('0x4d')]=function(_0x13167f,_0x5dffdb){return db[_0x9ff6('0x45')][_0x9ff6('0x4d')](_0x13167f[_0x9ff6('0x4e')],{})[_0x9ff6('0x29')](function(_0x24501e){var _0x3cb931=_0x13167f['user'][_0x9ff6('0x2b')]({'plain':!![]});if(!_0x3cb931)throw new Error(_0x9ff6('0x4f'));if(_0x3cb931['role']===_0x9ff6('0x50')){var _0xedb322=_0x24501e[_0x9ff6('0x2b')]({'plain':!![]});var _0x4cf97a=_0x9ff6('0x2c');return db[_0x9ff6('0x51')][_0x9ff6('0x4b')]({'where':{'name':_0x4cf97a,'userProfileId':_0x3cb931[_0x9ff6('0x52')]},'raw':!![]})[_0x9ff6('0x29')](function(_0x3f4ac8){if(_0x3f4ac8&&_0x3f4ac8['autoAssociation']===0x0){return db['UserProfileResource'][_0x9ff6('0x4d')]({'name':_0xedb322[_0x9ff6('0x2f')],'resourceId':_0xedb322['id'],'type':_0x3f4ac8[_0x9ff6('0x2f')],'sectionId':_0x3f4ac8['id']},{})[_0x9ff6('0x29')](function(){return _0x24501e;});}else{return _0x24501e;}})[_0x9ff6('0x4c')](function(_0x5bf27f){logger['error'](_0x9ff6('0x53'),_0x5bf27f);throw _0x5bf27f;});}return _0x24501e;})[_0x9ff6('0x29')](respondWithResult(_0x5dffdb,0xc9))['catch'](handleError(_0x5dffdb,null));};exports[_0x9ff6('0x28')]=function(_0x3521bc,_0x553ef2){if(_0x3521bc[_0x9ff6('0x4e')]['id']){delete _0x3521bc[_0x9ff6('0x4e')]['id'];}return db['SmsQueue'][_0x9ff6('0x4b')]({'where':{'id':_0x3521bc[_0x9ff6('0x54')]['id']}})['then'](handleEntityNotFound(_0x553ef2,null))['then'](saveUpdates(_0x3521bc[_0x9ff6('0x4e')],null))['then'](respondWithResult(_0x553ef2,null))[_0x9ff6('0x4c')](handleError(_0x553ef2,null));};exports['destroy']=function(_0x868c77,_0x27f00c){return db[_0x9ff6('0x45')]['find']({'where':{'id':_0x868c77[_0x9ff6('0x54')]['id']}})[_0x9ff6('0x29')](handleEntityNotFound(_0x27f00c,null))[_0x9ff6('0x29')](removeEntity(_0x27f00c,null))[_0x9ff6('0x4c')](handleError(_0x27f00c,null));};exports[_0x9ff6('0x55')]=function(_0x595f8b,_0x155cf2){return db[_0x9ff6('0x45')][_0x9ff6('0x55')]()[_0x9ff6('0x29')](respondWithResult(_0x155cf2,null))[_0x9ff6('0x4c')](handleError(_0x155cf2,null));};exports['getMembers']=function(_0x404840,_0x1517a3,_0x4c6a85){var _0xe3ec68={'raw':!![],'where':{}},_0x3a63ab={},_0x53bc83;return db['SmsQueue']['findOne']({'where':{'id':_0x404840[_0x9ff6('0x54')]['id']}})[_0x9ff6('0x29')](handleEntityNotFound(_0x1517a3,null))['then'](function(_0x50517f){if(_0x50517f){_0x53bc83=_0x50517f[_0x9ff6('0x2b')]({'plain':!![]});_0x3a63ab[_0x9ff6('0x35')]=_[_0x9ff6('0x37')](db[_0x9ff6('0x56')][_0x9ff6('0x32')]);_0x3a63ab[_0x9ff6('0x36')]=_['keys'](_0x404840[_0x9ff6('0x36')]);_0x3a63ab[_0x9ff6('0x38')]=_[_0x9ff6('0x3a')](_0x3a63ab[_0x9ff6('0x35')],_0x3a63ab[_0x9ff6('0x36')]);_0xe3ec68[_0x9ff6('0x39')]=_[_0x9ff6('0x3a')](_0x3a63ab[_0x9ff6('0x35')],qs[_0x9ff6('0x3b')](_0x404840['query']['fields']));_0xe3ec68[_0x9ff6('0x39')]=_0xe3ec68[_0x9ff6('0x39')]['length']?_0xe3ec68[_0x9ff6('0x39')]:_0x3a63ab[_0x9ff6('0x35')];if(!_0x404840['query'][_0x9ff6('0x3c')]('nolimit')){_0xe3ec68[_0x9ff6('0x21')]=qs['limit'](_0x404840[_0x9ff6('0x36')][_0x9ff6('0x21')]);_0xe3ec68['offset']=qs[_0x9ff6('0x1f')](_0x404840[_0x9ff6('0x36')][_0x9ff6('0x1f')]);}_0xe3ec68[_0x9ff6('0x57')]=qs[_0x9ff6('0x3e')](_0x404840['query'][_0x9ff6('0x3e')]);_0xe3ec68[_0x9ff6('0x3f')]=qs['filters'](_['pick'](_0x404840[_0x9ff6('0x36')],_0x3a63ab['filters']));_0xe3ec68[_0x9ff6('0x3f')][_0x9ff6('0x58')]=_0x50517f['id'];if(_0x404840['query'][_0x9ff6('0x41')]){_0xe3ec68[_0x9ff6('0x3f')]=_[_0x9ff6('0x42')](_0xe3ec68[_0x9ff6('0x3f')],{'$or':_[_0x9ff6('0x31')](_0xe3ec68['attributes'],function(_0x52aecc){var _0x109353={};_0x109353[_0x52aecc]={'$like':'%'+_0x404840[_0x9ff6('0x36')][_0x9ff6('0x41')]+'%'};return _0x109353;})});}_0xe3ec68=_[_0x9ff6('0x42')]({},_0xe3ec68,_0x404840[_0x9ff6('0x44')]);return db['UserSmsQueue'][_0x9ff6('0x47')](_0xe3ec68);}})[_0x9ff6('0x29')](function(_0x127fda){if(_0x127fda){return db[_0x9ff6('0x59')][_0x9ff6('0x5a')]({'where':{'id':_[_0x9ff6('0x31')](_0x127fda,_0x9ff6('0x5b')),'role':_0x9ff6('0x5c')},'attributes':['id','name','smsPause',_0x9ff6('0x5d'),_0x9ff6('0x5e')]});}})[_0x9ff6('0x29')](function(_0x51324e){if(_0x51324e){return{'count':_0x51324e[_0x9ff6('0x22')],'rows':_[_0x9ff6('0x31')](_0x51324e['rows'],function(_0x22aa16){return{'membername':_0x22aa16[_0x9ff6('0x2f')],'UserId':_0x22aa16['id'],'queue_name':_0x53bc83[_0x9ff6('0x2f')],'SmsQueueId':_0x53bc83['id'],'interface':util['format'](_0x9ff6('0x5f'),_0x9ff6('0x60'),_0x22aa16['name']),'penalty':0x0,'paused':_0x22aa16[_0x9ff6('0x61')],'createdAt':_0x22aa16[_0x9ff6('0x5e')],'updatedAt':_0x22aa16['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1517a3,_0xe3ec68))[_0x9ff6('0x4c')](handleError(_0x1517a3,null));};exports[_0x9ff6('0x62')]=function(_0x5d6e76,_0xf0db1f,_0x59c3d5){var _0xdf5eb1={};var _0x5981a2={};var _0x4d15df;var _0x2f35a8;return db['SmsQueue'][_0x9ff6('0x63')]({'where':{'id':_0x5d6e76[_0x9ff6('0x54')]['id']}})['then'](handleEntityNotFound(_0xf0db1f,null))[_0x9ff6('0x29')](function(_0x1b20b5){if(_0x1b20b5){_0x4d15df=_0x1b20b5;_0x5981a2['model']=_[_0x9ff6('0x37')](db[_0x9ff6('0x64')][_0x9ff6('0x32')]);_0x5981a2[_0x9ff6('0x36')]=_[_0x9ff6('0x37')](_0x5d6e76[_0x9ff6('0x36')]);_0x5981a2[_0x9ff6('0x38')]=_[_0x9ff6('0x3a')](_0x5981a2[_0x9ff6('0x35')],_0x5981a2[_0x9ff6('0x36')]);_0xdf5eb1[_0x9ff6('0x39')]=_[_0x9ff6('0x3a')](_0x5981a2[_0x9ff6('0x35')],qs['fields'](_0x5d6e76['query'][_0x9ff6('0x3b')]));_0xdf5eb1[_0x9ff6('0x39')]=_0xdf5eb1[_0x9ff6('0x39')][_0x9ff6('0x4a')]?_0xdf5eb1[_0x9ff6('0x39')]:_0x5981a2[_0x9ff6('0x35')];_0xdf5eb1[_0x9ff6('0x57')]=qs[_0x9ff6('0x3e')](_0x5d6e76[_0x9ff6('0x36')][_0x9ff6('0x3e')]);_0xdf5eb1[_0x9ff6('0x3f')]=qs[_0x9ff6('0x38')](_['pick'](_0x5d6e76['query'],_0x5981a2[_0x9ff6('0x38')]));if(_0x5d6e76[_0x9ff6('0x36')]['filter']){_0xdf5eb1[_0x9ff6('0x3f')]=_[_0x9ff6('0x42')](_0xdf5eb1[_0x9ff6('0x3f')],{'$or':_[_0x9ff6('0x31')](_0xdf5eb1[_0x9ff6('0x39')],function(_0x2de632){var _0x4f637a={};_0x4f637a[_0x2de632]={'$like':'%'+_0x5d6e76[_0x9ff6('0x36')][_0x9ff6('0x41')]+'%'};return _0x4f637a;})});}_0xdf5eb1=_[_0x9ff6('0x42')]({},_0xdf5eb1,_0x5d6e76[_0x9ff6('0x44')]);return _0x4d15df[_0x9ff6('0x62')](_0xdf5eb1);}})[_0x9ff6('0x29')](function(_0x31255b){if(_0x31255b){_0x2f35a8=_0x31255b[_0x9ff6('0x4a')];if(!_0x5d6e76[_0x9ff6('0x36')][_0x9ff6('0x3c')](_0x9ff6('0x3d'))){_0xdf5eb1[_0x9ff6('0x21')]=qs['limit'](_0x5d6e76[_0x9ff6('0x36')][_0x9ff6('0x21')]);_0xdf5eb1[_0x9ff6('0x1f')]=qs['offset'](_0x5d6e76[_0x9ff6('0x36')][_0x9ff6('0x1f')]);}return _0x4d15df[_0x9ff6('0x62')](_0xdf5eb1);}})['then'](function(_0x1ab7a5){if(_0x1ab7a5){return _0x1ab7a5?{'count':_0x2f35a8,'rows':_0x1ab7a5}:null;}})[_0x9ff6('0x29')](respondWithResult(_0xf0db1f,null))[_0x9ff6('0x4c')](handleError(_0xf0db1f,null));};exports[_0x9ff6('0x65')]=function(_0x3c44a1,_0x5c4669,_0x562c33){var _0x3fe7f1=_0x3c44a1[_0x9ff6('0x4e')]['ids'];return db['Team'][_0x9ff6('0x47')]({'where':{'id':_0x3fe7f1},'attributes':['id'],'include':[{'model':db[_0x9ff6('0x59')],'as':_0x9ff6('0x66'),'attributes':['id','name',_0x9ff6('0x67'),_0x9ff6('0x68'),_0x9ff6('0x69')],'raw':!![]}]})[_0x9ff6('0x29')](function(_0x20d809){if(_0x20d809){var _0x2d2396=_[_0x9ff6('0x6a')](_0x20d809,function(_0x229d5f){var _0x3a8137=_0x229d5f[_0x9ff6('0x2b')]({'plain':!![]});return _0x3a8137['Agents'];});return db[_0x9ff6('0x45')][_0x9ff6('0x4b')]({'where':{'id':_0x3c44a1['params']['id']}})[_0x9ff6('0x29')](function(_0x26a821){return db[_0x9ff6('0x6b')][_0x9ff6('0x6c')](function(_0x4a7e22){return _0x26a821[_0x9ff6('0x65')](_0x3fe7f1,{'transaction':_0x4a7e22})[_0x9ff6('0x29')](function(){return BPromise[_0x9ff6('0x6d')](_0x2d2396,function(_0x462147){return db[_0x9ff6('0x56')][_0x9ff6('0x6e')]({'where':{'UserId':_0x462147['id'],'SmsQueueId':_0x3c44a1[_0x9ff6('0x54')]['id']},'transaction':_0x4a7e22});});})[_0x9ff6('0x29')](function(){_0x2d2396[_0x9ff6('0x6f')](function(_0xfca854){socket['emit'](_0x9ff6('0x70'),{'UserId':_0xfca854['id'],'SmsQueueId':_0x26a821['id']});});});});});}})['then'](respondWithStatusCode(_0x5c4669,null))['catch'](handleError(_0x5c4669,null));};exports[_0x9ff6('0x71')]=function(_0x56b360,_0x143605,_0x48bff4){return db[_0x9ff6('0x64')][_0x9ff6('0x47')]({'where':{'id':_0x56b360['query'][_0x9ff6('0x72')]},'attributes':['id'],'include':[{'model':db[_0x9ff6('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9ff6('0x29')](handleEntityNotFound(_0x143605,null))['then'](function(_0x103cb0){var _0x4a6544=_[_0x9ff6('0x31')](_0x103cb0,'id');var _0x3b5cfa=[];var _0x33543a=[];var _0x332ba4=squel[_0x9ff6('0x73')]();_0x332ba4['field']('tq.TeamId')[_0x9ff6('0x74')]('team_has_sms_queues','tq')['join'](_0x9ff6('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9ff6('0x3f')](_0x9ff6('0x76'),_0x56b360['params']['id']);for(var _0xc98073=0x0;_0xc98073<_0x103cb0[_0x9ff6('0x4a')];_0xc98073+=0x1){let _0x2adfb9=_0x103cb0[_0xc98073];for(var _0x4074b1=0x0;_0x4074b1<_0x2adfb9[_0x9ff6('0x66')][_0x9ff6('0x4a')];_0x4074b1+=0x1){let _0x8b0a77=_0x2adfb9[_0x9ff6('0x66')][_0x4074b1];var _0x429ff4=_0x332ba4[_0x9ff6('0x77')]();_0x429ff4[_0x9ff6('0x3f')](_0x9ff6('0x78'),_0x8b0a77['id']);_0x33543a[_0x9ff6('0x79')](db[_0x9ff6('0x6b')][_0x9ff6('0x36')](_0x429ff4['toString'](),{'type':db[_0x9ff6('0x6b')]['QueryTypes']['SELECT']})[_0x9ff6('0x29')](function(_0x41f3c3){if(_0x41f3c3[_0x9ff6('0x4a')]===0x1){return _0x8b0a77['id'];}else{var _0x165468=_['every'](_[_0x9ff6('0x31')](_0x41f3c3,_0x9ff6('0x7a')),function(_0x3e317e){return _[_0x9ff6('0x7b')](_0x4a6544,_0x3e317e);});if(_0x165468){return _0x8b0a77['id'];}}}));}}return BPromise[_0x9ff6('0x7c')](_0x33543a)[_0x9ff6('0x29')](function(_0x24000d){_0x3b5cfa=_(_0x3b5cfa)[_0x9ff6('0x7d')](_0x24000d)[_0x9ff6('0x7e')]()[_0x9ff6('0x7f')]();return db['SmsQueue'][_0x9ff6('0x4b')]({'where':{'id':_0x56b360[_0x9ff6('0x54')]['id']}})[_0x9ff6('0x29')](function(_0x55d3e0){return db[_0x9ff6('0x6b')][_0x9ff6('0x6c')](function(_0x2b8d02){return _0x55d3e0[_0x9ff6('0x71')](_0x56b360[_0x9ff6('0x36')]['ids'],{'transaction':_0x2b8d02})['then'](function(){if(!_[_0x9ff6('0x80')](_0x3b5cfa)){return _0x55d3e0[_0x9ff6('0x81')](_0x3b5cfa,{'transaction':_0x2b8d02});}})['then'](function(){_0x3b5cfa[_0x9ff6('0x6f')](function(_0x19f8c1){socket[_0x9ff6('0x82')](_0x9ff6('0x83'),{'UserId':_0x19f8c1,'SmsQueueId':_0x55d3e0['id']});});});});});});})[_0x9ff6('0x29')](respondWithStatusCode(_0x143605,null))[_0x9ff6('0x4c')](handleError(_0x143605,null));};exports[_0x9ff6('0x84')]=function(_0x3257fa,_0x3e0be7,_0x3fc207){return db[_0x9ff6('0x45')][_0x9ff6('0x4b')]({'where':{'id':_0x3257fa['params']['id']}})['then'](handleEntityNotFound(_0x3e0be7,null))[_0x9ff6('0x29')](function(_0x53e23c){if(_0x53e23c){return _0x53e23c[_0x9ff6('0x84')](_0x3257fa[_0x9ff6('0x4e')][_0x9ff6('0x72')],_[_0x9ff6('0x85')](_0x3257fa[_0x9ff6('0x4e')],[_0x9ff6('0x72'),'id'])||{})[_0x9ff6('0x86')](function(_0x499d86){for(var _0x12bc36=0x0;_0x12bc36<_0x3257fa[_0x9ff6('0x4e')][_0x9ff6('0x72')][_0x9ff6('0x4a')];_0x12bc36+=0x1){socket[_0x9ff6('0x82')](_0x9ff6('0x70'),{'UserId':Number(_0x3257fa[_0x9ff6('0x4e')][_0x9ff6('0x72')][_0x12bc36]),'SmsQueueId':Number(_0x3257fa[_0x9ff6('0x54')]['id'])});}return _0x499d86;});}})['then'](respondWithResult(_0x3e0be7,null))[_0x9ff6('0x4c')](handleError(_0x3e0be7,null));};exports[_0x9ff6('0x81')]=function(_0x3973f5,_0x5c469b,_0x38d4ad){return db[_0x9ff6('0x45')][_0x9ff6('0x4b')]({'where':{'id':_0x3973f5[_0x9ff6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c469b,null))['then'](function(_0x417db7){if(_0x417db7){return _0x417db7[_0x9ff6('0x81')](_0x3973f5[_0x9ff6('0x36')][_0x9ff6('0x72')])[_0x9ff6('0x29')](function(){if(_[_0x9ff6('0x87')](_0x3973f5['query'][_0x9ff6('0x72')])){for(var _0x2b40d0=0x0;_0x2b40d0<_0x3973f5['query'][_0x9ff6('0x72')][_0x9ff6('0x4a')];_0x2b40d0+=0x1){socket['emit'](_0x9ff6('0x83'),{'UserId':Number(_0x3973f5[_0x9ff6('0x36')][_0x9ff6('0x72')][_0x2b40d0]),'SmsQueueId':Number(_0x3973f5['params']['id'])});}}else{socket[_0x9ff6('0x82')](_0x9ff6('0x83'),{'UserId':Number(_0x3973f5[_0x9ff6('0x36')][_0x9ff6('0x72')]),'SmsQueueId':Number(_0x3973f5[_0x9ff6('0x54')]['id'])});}});}})[_0x9ff6('0x29')](respondWithStatusCode(_0x5c469b,null))[_0x9ff6('0x4c')](handleError(_0x5c469b,null));};exports[_0x9ff6('0x88')]=function(_0x48b4bb,_0x30add9,_0x49d7ad){var _0x15d406={};var _0x4dae32={};var _0x9338fe;var _0x533dc7;return db[_0x9ff6('0x45')][_0x9ff6('0x63')]({'where':{'id':_0x48b4bb[_0x9ff6('0x54')]['id']}})['then'](handleEntityNotFound(_0x30add9,null))[_0x9ff6('0x29')](function(_0x1aee48){if(_0x1aee48){_0x9338fe=_0x1aee48;_0x4dae32[_0x9ff6('0x35')]=_['keys'](db[_0x9ff6('0x59')][_0x9ff6('0x32')]);_0x4dae32[_0x9ff6('0x36')]=_['keys'](_0x48b4bb['query']);_0x4dae32[_0x9ff6('0x38')]=_[_0x9ff6('0x3a')](_0x4dae32[_0x9ff6('0x35')],_0x4dae32[_0x9ff6('0x36')]);_0x15d406[_0x9ff6('0x39')]=_[_0x9ff6('0x3a')](_0x4dae32[_0x9ff6('0x35')],qs['fields'](_0x48b4bb['query']['fields']));_0x15d406[_0x9ff6('0x39')]=_0x15d406[_0x9ff6('0x39')][_0x9ff6('0x4a')]?_0x15d406['attributes']:_0x4dae32[_0x9ff6('0x35')];_0x15d406['order']=qs[_0x9ff6('0x3e')](_0x48b4bb['query']['sort']);_0x15d406['where']=qs[_0x9ff6('0x38')](_[_0x9ff6('0x40')](_0x48b4bb[_0x9ff6('0x36')],_0x4dae32[_0x9ff6('0x38')]));if(_0x48b4bb['query'][_0x9ff6('0x41')]){_0x15d406[_0x9ff6('0x3f')]=_[_0x9ff6('0x42')](_0x15d406[_0x9ff6('0x3f')],{'$or':_['map'](_0x15d406[_0x9ff6('0x39')],function(_0x5da1d0){var _0x264d62={};_0x264d62[_0x5da1d0]={'$like':'%'+_0x48b4bb[_0x9ff6('0x36')]['filter']+'%'};return _0x264d62;})});}_0x15d406=_[_0x9ff6('0x42')]({},_0x15d406,_0x48b4bb['options']);return _0x9338fe['getAgents'](_0x15d406);}})[_0x9ff6('0x29')](function(_0x529b6a){if(_0x529b6a){_0x533dc7=_0x529b6a[_0x9ff6('0x4a')];if(!_0x48b4bb['query'][_0x9ff6('0x3c')](_0x9ff6('0x3d'))){_0x15d406['limit']=qs['limit'](_0x48b4bb[_0x9ff6('0x36')][_0x9ff6('0x21')]);_0x15d406['offset']=qs[_0x9ff6('0x1f')](_0x48b4bb[_0x9ff6('0x36')]['offset']);}return _0x9338fe[_0x9ff6('0x88')](_0x15d406);}})[_0x9ff6('0x29')](function(_0x49f4f2){if(_0x49f4f2){return _0x49f4f2?{'count':_0x533dc7,'rows':_0x49f4f2}:null;}})[_0x9ff6('0x29')](respondWithResult(_0x30add9,null))[_0x9ff6('0x4c')](handleError(_0x30add9,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6c117df..1f98bc0 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 _0x5acb=['hook','exports','events','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x74115b,_0x31f752){var _0x57ebbd=function(_0x234873){while(--_0x234873){_0x74115b['push'](_0x74115b['shift']());}};_0x57ebbd(++_0x31f752);}(_0x5acb,0x16e));var _0xb5ac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5acb[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xb5ac('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb5ac('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb5ac('0x2')};function emitEvent(_0x419751){return function(_0x983c4e,_0x3ae739,_0x3b58f4){SmsQueueEvents[_0xb5ac('0x3')](_0x419751+':'+_0x983c4e['id'],_0x983c4e);SmsQueueEvents['emit'](_0x419751,_0x983c4e);_0x3b58f4(null);};}for(var e in events){if(events[_0xb5ac('0x4')](e)){var event=events[e];SmsQueue[_0xb5ac('0x5')](e,emitEvent(event));}}module[_0xb5ac('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x0196=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x545a65,_0x525fcf){var _0x334ed6=function(_0x4953db){while(--_0x4953db){_0x545a65['push'](_0x545a65['shift']());}};_0x334ed6(++_0x525fcf);}(_0x0196,0x6c));var _0x6019=function(_0x2a56de,_0x4b9406){_0x2a56de=_0x2a56de-0x0;var _0x36ddeb=_0x0196[_0x2a56de];return _0x36ddeb;};'use strict';var EventEmitter=require(_0x6019('0x0'));var SmsQueue=require(_0x6019('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6019('0x2')](0x0);var events={'afterCreate':_0x6019('0x3'),'afterUpdate':_0x6019('0x4'),'afterDestroy':_0x6019('0x5')};function emitEvent(_0x28e086){return function(_0x303bc7,_0x51f146,_0x43fd66){SmsQueueEvents[_0x6019('0x6')](_0x28e086+':'+_0x303bc7['id'],_0x303bc7);SmsQueueEvents[_0x6019('0x6')](_0x28e086,_0x303bc7);_0x43fd66(null);};}for(var e in events){if(events[_0x6019('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x6019('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a1fe7d9..79e0d10 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 _0xfc11=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0xfc11,0x10e));var _0x1fc1=function(_0x5df457,_0x3f5704){_0x5df457=_0x5df457-0x0;var _0x9a8643=_0xfc11[_0x5df457];return _0x9a8643;};'use strict';var _=require(_0x1fc1('0x0'));var util=require(_0x1fc1('0x1'));var logger=require(_0x1fc1('0x2'))(_0x1fc1('0x3'));var moment=require(_0x1fc1('0x4'));var BPromise=require(_0x1fc1('0x5'));var rp=require(_0x1fc1('0x6'));var fs=require('fs');var path=require(_0x1fc1('0x7'));var rimraf=require(_0x1fc1('0x8'));var config=require(_0x1fc1('0x9'));var attributes=require('./smsQueue.attributes');module[_0x1fc1('0xa')]=function(_0x34beb6,_0xf59ca3){return _0x34beb6[_0x1fc1('0xb')](_0x1fc1('0xc'),attributes,{'tableName':_0x1fc1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe83a=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe83a,0x14f));var _0xae83=function(_0x1f9623,_0x538754){_0x1f9623=_0x1f9623-0x0;var _0x416fe5=_0xe83a[_0x1f9623];return _0x416fe5;};'use strict';var _=require(_0xae83('0x0'));var util=require(_0xae83('0x1'));var logger=require(_0xae83('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae83('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae83('0x4'));var rimraf=require(_0xae83('0x5'));var config=require(_0xae83('0x6'));var attributes=require(_0xae83('0x7'));module[_0xae83('0x8')]=function(_0x4d5970,_0x314394){return _0x4d5970[_0xae83('0x9')](_0xae83('0xa'),attributes,{'tableName':_0xae83('0xb'),'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 e9fe18c..f50a27c 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 _0x1364=['SmsQueue','find','ShowSmsQueue','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','include','model','map','GetSmsQueue'];(function(_0x46df5b,_0x5e3b71){var _0xc7d1de=function(_0x36868f){while(--_0x36868f){_0x46df5b['push'](_0x46df5b['shift']());}};_0xc7d1de(++_0x5e3b71);}(_0x1364,0x162));var _0x4136=function(_0x1467da,_0x2deb42){_0x1467da=_0x1467da-0x0;var _0x3ce579=_0x1364[_0x1467da];return _0x3ce579;};'use strict';var _=require(_0x4136('0x0'));var util=require(_0x4136('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4136('0x2'));var db=require(_0x4136('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4136('0x4'))('rpc');var config=require(_0x4136('0x5'));var jayson=require(_0x4136('0x6'));var client=jayson[_0x4136('0x7')][_0x4136('0x8')]({'port':0x232a});config[_0x4136('0x9')]=_[_0x4136('0xa')](config['redis'],{'host':_0x4136('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4136('0x9')]));require(_0x4136('0xc'))[_0x4136('0xd')](socket);function respondWithRpcPromise(_0x2b2fcc,_0x20f886,_0xb6701d){return new BPromise(function(_0x3e07f7,_0x4a3478){return client[_0x4136('0xe')](_0x2b2fcc,_0xb6701d)[_0x4136('0xf')](function(_0x555ab3){logger[_0x4136('0x10')]('SmsQueue,\x20%s,\x20%s',_0x20f886,_0x4136('0x11'));logger[_0x4136('0x12')](_0x4136('0x13'),_0x20f886,_0x4136('0x11'),JSON[_0x4136('0x14')](_0x555ab3));if(_0x555ab3[_0x4136('0x15')]){if(_0x555ab3[_0x4136('0x15')][_0x4136('0x16')]===0x1f4){logger[_0x4136('0x15')](_0x4136('0x17'),_0x20f886,_0x555ab3['error'][_0x4136('0x18')]);return _0x4a3478(_0x555ab3[_0x4136('0x15')]['message']);}logger['error'](_0x4136('0x17'),_0x20f886,_0x555ab3['error'][_0x4136('0x18')]);return _0x3e07f7(_0x555ab3[_0x4136('0x15')][_0x4136('0x18')]);}else{logger[_0x4136('0x10')](_0x4136('0x17'),_0x20f886,'request\x20sent');_0x3e07f7(_0x555ab3[_0x4136('0x19')][_0x4136('0x18')]);}})[_0x4136('0x1a')](function(_0x2a459e){logger[_0x4136('0x15')]('SmsQueue,\x20%s,\x20%s',_0x20f886,_0x2a459e);_0x4a3478(_0x2a459e);});});}exports['GetSmsQueue']=function(_0x2bfa9a){var _0x58450b=this;return new Promise(function(_0x282424,_0x216880){return db['SmsQueue'][_0x4136('0x1b')]({'raw':_0x2bfa9a[_0x4136('0x1c')]?_0x2bfa9a[_0x4136('0x1c')][_0x4136('0x1d')]===undefined?!![]:![]:!![],'where':_0x2bfa9a[_0x4136('0x1c')]?_0x2bfa9a[_0x4136('0x1c')][_0x4136('0x1e')]||null:null,'attributes':_0x2bfa9a[_0x4136('0x1c')]?_0x2bfa9a[_0x4136('0x1c')][_0x4136('0x1f')]||null:null,'limit':_0x2bfa9a['options']?_0x2bfa9a['options']['limit']||null:null,'include':_0x2bfa9a['options']?_0x2bfa9a[_0x4136('0x1c')][_0x4136('0x20')]?_['map'](_0x2bfa9a[_0x4136('0x1c')][_0x4136('0x20')],function(_0x3ef980){return{'model':db[_0x3ef980[_0x4136('0x21')]],'as':_0x3ef980['as'],'attributes':_0x3ef980['attributes'],'include':_0x3ef980['include']?_[_0x4136('0x22')](_0x3ef980[_0x4136('0x20')],function(_0x5db7ee){return{'model':db[_0x5db7ee[_0x4136('0x21')]],'as':_0x5db7ee['as'],'attributes':_0x5db7ee[_0x4136('0x1f')],'include':_0x5db7ee[_0x4136('0x20')]?_[_0x4136('0x22')](_0x5db7ee['include'],function(_0x16edcc){return{'model':db[_0x16edcc['model']],'as':_0x16edcc['as'],'attributes':_0x16edcc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4136('0xf')](function(_0x217712){logger[_0x4136('0x10')](_0x4136('0x23'),_0x2bfa9a);logger[_0x4136('0x12')](_0x4136('0x23'),_0x2bfa9a,JSON[_0x4136('0x14')](_0x217712));_0x282424(_0x217712);})[_0x4136('0x1a')](function(_0x313f64){logger['error'](_0x4136('0x23'),_0x313f64['message'],_0x2bfa9a);_0x216880(_0x58450b[_0x4136('0x15')](0x1f4,_0x313f64[_0x4136('0x18')]));});});};exports['ShowSmsQueue']=function(_0x119ebd){var _0x5087ed=this;return new Promise(function(_0xbe8c1e,_0x42ff1c){return db[_0x4136('0x24')][_0x4136('0x25')]({'raw':_0x119ebd[_0x4136('0x1c')]?_0x119ebd['options']['raw']===undefined?!![]:![]:!![],'where':_0x119ebd[_0x4136('0x1c')]?_0x119ebd['options']['where']||null:null,'attributes':_0x119ebd[_0x4136('0x1c')]?_0x119ebd[_0x4136('0x1c')][_0x4136('0x1f')]||null:null,'include':_0x119ebd[_0x4136('0x1c')]?_0x119ebd[_0x4136('0x1c')][_0x4136('0x20')]?_[_0x4136('0x22')](_0x119ebd[_0x4136('0x1c')]['include'],function(_0x4de8db){return{'model':db[_0x4de8db[_0x4136('0x21')]],'as':_0x4de8db['as'],'attributes':_0x4de8db[_0x4136('0x1f')],'include':_0x4de8db[_0x4136('0x20')]?_[_0x4136('0x22')](_0x4de8db['include'],function(_0x32d668){return{'model':db[_0x32d668[_0x4136('0x21')]],'as':_0x32d668['as'],'attributes':_0x32d668[_0x4136('0x1f')],'include':_0x32d668[_0x4136('0x20')]?_[_0x4136('0x22')](_0x32d668[_0x4136('0x20')],function(_0x13ddcc){return{'model':db[_0x13ddcc[_0x4136('0x21')]],'as':_0x13ddcc['as'],'attributes':_0x13ddcc[_0x4136('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4136('0xf')](function(_0x36f76a){logger[_0x4136('0x10')](_0x4136('0x26'),_0x119ebd);logger[_0x4136('0x12')](_0x4136('0x26'),_0x119ebd,JSON[_0x4136('0x14')](_0x36f76a));_0xbe8c1e(_0x36f76a);})[_0x4136('0x1a')](function(_0x3de4f2){logger['error'](_0x4136('0x26'),_0x3de4f2['message'],_0x119ebd);_0x42ff1c(_0x5087ed['error'](0x1f4,_0x3de4f2[_0x4136('0x18')]));});});}; \ No newline at end of file +var _0xb203=['SmsQueue','options','raw','where','limit','include','map','model','attributes','debug','GetSmsQueue','ShowSmsQueue','find','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5bf025,_0x38aab7){var _0x918a27=function(_0x4c585c){while(--_0x4c585c){_0x5bf025['push'](_0x5bf025['shift']());}};_0x918a27(++_0x38aab7);}(_0xb203,0x16d));var _0x3b20=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb203[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x3b20('0x0'));var moment=require(_0x3b20('0x1'));var BPromise=require(_0x3b20('0x2'));var rs=require(_0x3b20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b20('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b20('0x5'))('rpc');var config=require(_0x3b20('0x6'));var jayson=require(_0x3b20('0x7'));var client=jayson['client'][_0x3b20('0x8')]({'port':0x232a});config['redis']=_[_0x3b20('0x9')](config['redis'],{'host':_0x3b20('0xa'),'port':0x18eb});var socket=require(_0x3b20('0xb'))(new Redis(config[_0x3b20('0xc')]));require(_0x3b20('0xd'))[_0x3b20('0xe')](socket);function respondWithRpcPromise(_0x3b8f72,_0x18e211,_0x500d32){return new BPromise(function(_0x10c357,_0x7a3cf6){return client[_0x3b20('0xf')](_0x3b8f72,_0x500d32)['then'](function(_0x1477f9){logger[_0x3b20('0x10')](_0x3b20('0x11'),_0x18e211,_0x3b20('0x12'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x18e211,'request\x20sent',JSON[_0x3b20('0x13')](_0x1477f9));if(_0x1477f9[_0x3b20('0x14')]){if(_0x1477f9[_0x3b20('0x14')][_0x3b20('0x15')]===0x1f4){logger['error'](_0x3b20('0x11'),_0x18e211,_0x1477f9[_0x3b20('0x14')][_0x3b20('0x16')]);return _0x7a3cf6(_0x1477f9['error'][_0x3b20('0x16')]);}logger[_0x3b20('0x14')](_0x3b20('0x11'),_0x18e211,_0x1477f9[_0x3b20('0x14')]['message']);return _0x10c357(_0x1477f9['error']['message']);}else{logger[_0x3b20('0x10')]('SmsQueue,\x20%s,\x20%s',_0x18e211,_0x3b20('0x12'));_0x10c357(_0x1477f9[_0x3b20('0x17')]['message']);}})[_0x3b20('0x18')](function(_0x48a288){logger[_0x3b20('0x14')](_0x3b20('0x11'),_0x18e211,_0x48a288);_0x7a3cf6(_0x48a288);});});}exports['GetSmsQueue']=function(_0x159edf){var _0x4bdb56=this;return new Promise(function(_0x1644f0,_0x3d9ea4){return db[_0x3b20('0x19')]['findAll']({'raw':_0x159edf['options']?_0x159edf[_0x3b20('0x1a')][_0x3b20('0x1b')]===undefined?!![]:![]:!![],'where':_0x159edf[_0x3b20('0x1a')]?_0x159edf[_0x3b20('0x1a')][_0x3b20('0x1c')]||null:null,'attributes':_0x159edf[_0x3b20('0x1a')]?_0x159edf[_0x3b20('0x1a')]['attributes']||null:null,'limit':_0x159edf[_0x3b20('0x1a')]?_0x159edf[_0x3b20('0x1a')][_0x3b20('0x1d')]||null:null,'include':_0x159edf['options']?_0x159edf[_0x3b20('0x1a')][_0x3b20('0x1e')]?_[_0x3b20('0x1f')](_0x159edf[_0x3b20('0x1a')][_0x3b20('0x1e')],function(_0x41b294){return{'model':db[_0x41b294[_0x3b20('0x20')]],'as':_0x41b294['as'],'attributes':_0x41b294[_0x3b20('0x21')],'include':_0x41b294[_0x3b20('0x1e')]?_['map'](_0x41b294[_0x3b20('0x1e')],function(_0x57b6b3){return{'model':db[_0x57b6b3[_0x3b20('0x20')]],'as':_0x57b6b3['as'],'attributes':_0x57b6b3['attributes'],'include':_0x57b6b3[_0x3b20('0x1e')]?_['map'](_0x57b6b3[_0x3b20('0x1e')],function(_0x390ba1){return{'model':db[_0x390ba1['model']],'as':_0x390ba1['as'],'attributes':_0x390ba1[_0x3b20('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26a0ca){logger[_0x3b20('0x10')]('GetSmsQueue',_0x159edf);logger[_0x3b20('0x22')](_0x3b20('0x23'),_0x159edf,JSON['stringify'](_0x26a0ca));_0x1644f0(_0x26a0ca);})[_0x3b20('0x18')](function(_0x7380f0){logger['error'](_0x3b20('0x23'),_0x7380f0[_0x3b20('0x16')],_0x159edf);_0x3d9ea4(_0x4bdb56[_0x3b20('0x14')](0x1f4,_0x7380f0[_0x3b20('0x16')]));});});};exports[_0x3b20('0x24')]=function(_0x38fcec){var _0x234b59=this;return new Promise(function(_0x1a41e3,_0x51b3bf){return db[_0x3b20('0x19')][_0x3b20('0x25')]({'raw':_0x38fcec['options']?_0x38fcec[_0x3b20('0x1a')][_0x3b20('0x1b')]===undefined?!![]:![]:!![],'where':_0x38fcec['options']?_0x38fcec[_0x3b20('0x1a')][_0x3b20('0x1c')]||null:null,'attributes':_0x38fcec[_0x3b20('0x1a')]?_0x38fcec[_0x3b20('0x1a')]['attributes']||null:null,'include':_0x38fcec[_0x3b20('0x1a')]?_0x38fcec['options'][_0x3b20('0x1e')]?_[_0x3b20('0x1f')](_0x38fcec[_0x3b20('0x1a')]['include'],function(_0x48abca){return{'model':db[_0x48abca[_0x3b20('0x20')]],'as':_0x48abca['as'],'attributes':_0x48abca['attributes'],'include':_0x48abca[_0x3b20('0x1e')]?_['map'](_0x48abca[_0x3b20('0x1e')],function(_0x38e63b){return{'model':db[_0x38e63b[_0x3b20('0x20')]],'as':_0x38e63b['as'],'attributes':_0x38e63b[_0x3b20('0x21')],'include':_0x38e63b['include']?_[_0x3b20('0x1f')](_0x38e63b[_0x3b20('0x1e')],function(_0x312a1b){return{'model':db[_0x312a1b['model']],'as':_0x312a1b['as'],'attributes':_0x312a1b[_0x3b20('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3b20('0x26')](function(_0x338778){logger[_0x3b20('0x10')](_0x3b20('0x24'),_0x38fcec);logger['debug'](_0x3b20('0x24'),_0x38fcec,JSON['stringify'](_0x338778));_0x1a41e3(_0x338778);})[_0x3b20('0x18')](function(_0x555776){logger[_0x3b20('0x14')]('ShowSmsQueue',_0x555776[_0x3b20('0x16')],_0x38fcec);_0x51b3bf(_0x234b59['error'](0x1f4,_0x555776[_0x3b20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5338b85..6bbdb78 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 _0x894f=['register','length','smsQueue:','./smsQueue.events','update','emit'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x894f,0x1e3));var _0xf894=function(_0x48f656,_0x2ed75a){_0x48f656=_0x48f656-0x0;var _0x5b3fcb=_0x894f[_0x48f656];return _0x5b3fcb;};'use strict';var SmsQueueEvents=require(_0xf894('0x0'));var events=['save','remove',_0xf894('0x1')];function createListener(_0x152872,_0x198fd2){return function(_0x45ead6){_0x198fd2[_0xf894('0x2')](_0x152872,_0x45ead6);};}function removeListener(_0x4e0749,_0x43a593){return function(){SmsQueueEvents['removeListener'](_0x4e0749,_0x43a593);};}exports[_0xf894('0x3')]=function(_0xb4b739){for(var _0x25cd0d=0x0,_0x2760c7=events[_0xf894('0x4')];_0x25cd0d<_0x2760c7;_0x25cd0d++){var _0x27c2df=events[_0x25cd0d];var _0x7c75a2=createListener(_0xf894('0x5')+_0x27c2df,_0xb4b739);SmsQueueEvents['on'](_0x27c2df,_0x7c75a2);}}; \ No newline at end of file +var _0x6bd0=['smsQueue:','./smsQueue.events','save','update','emit','removeListener','register','length'];(function(_0x5bdc45,_0x100a4b){var _0x22db31=function(_0x1097d0){while(--_0x1097d0){_0x5bdc45['push'](_0x5bdc45['shift']());}};_0x22db31(++_0x100a4b);}(_0x6bd0,0x1a1));var _0x06bd=function(_0x1d8f34,_0x16d1b7){_0x1d8f34=_0x1d8f34-0x0;var _0xd41ed6=_0x6bd0[_0x1d8f34];return _0xd41ed6;};'use strict';var SmsQueueEvents=require(_0x06bd('0x0'));var events=[_0x06bd('0x1'),'remove',_0x06bd('0x2')];function createListener(_0x50958d,_0x5bd849){return function(_0x4ec9a6){_0x5bd849[_0x06bd('0x3')](_0x50958d,_0x4ec9a6);};}function removeListener(_0x356800,_0x2c2a4c){return function(){SmsQueueEvents[_0x06bd('0x4')](_0x356800,_0x2c2a4c);};}exports[_0x06bd('0x5')]=function(_0xcdd361){for(var _0x1eb1f6=0x0,_0x108469=events[_0x06bd('0x6')];_0x1eb1f6<_0x108469;_0x1eb1f6++){var _0x1161b6=events[_0x1eb1f6];var _0x4269e7=createListener(_0x06bd('0x7')+_0x1161b6,_0xcdd361);SmsQueueEvents['on'](_0x1161b6,_0x4269e7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e72b024..98992a9 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 _0x99fb=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x149055,_0x42bd96){var _0x2862bf=function(_0x39a5dc){while(--_0x39a5dc){_0x149055['push'](_0x149055['shift']());}};_0x2862bf(++_0x42bd96);}(_0x99fb,0x92));var _0xb99f=function(_0x22f08b,_0x208b7e){_0x22f08b=_0x22f08b-0x0;var _0x704024=_0x99fb[_0x22f08b];return _0x704024;};'use strict';var multer=require(_0xb99f('0x0'));var util=require('util');var path=require(_0xb99f('0x1'));var timeout=require(_0xb99f('0x2'));var express=require(_0xb99f('0x3'));var router=express[_0xb99f('0x4')]();var fs_extra=require(_0xb99f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb99f('0x6'));var config=require(_0xb99f('0x7'));var controller=require('./smsQueueReport.controller');router[_0xb99f('0x8')]('/',auth[_0xb99f('0x9')](),controller[_0xb99f('0xa')]);router['get'](_0xb99f('0xb'),auth['isAuthenticated'](),controller[_0xb99f('0xc')]);router['get'](_0xb99f('0xd'),auth[_0xb99f('0x9')](),controller['show']);router[_0xb99f('0xe')]('/',auth[_0xb99f('0x9')](),controller[_0xb99f('0xf')]);router[_0xb99f('0x10')](_0xb99f('0xd'),auth[_0xb99f('0x9')](),controller[_0xb99f('0x11')]);router['delete'](_0xb99f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xb99f('0x12')]=router; \ No newline at end of file +var _0x34aa=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x2f35a2,_0x9c1ac){var _0x503004=function(_0x41186f){while(--_0x41186f){_0x2f35a2['push'](_0x2f35a2['shift']());}};_0x503004(++_0x9c1ac);}(_0x34aa,0x171));var _0xa34a=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x34aa[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xa34a('0x0'));var util=require('util');var path=require(_0xa34a('0x1'));var timeout=require(_0xa34a('0x2'));var express=require(_0xa34a('0x3'));var router=express[_0xa34a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa34a('0x5'));var interaction=require(_0xa34a('0x6'));var config=require(_0xa34a('0x7'));var controller=require(_0xa34a('0x8'));router[_0xa34a('0x9')]('/',auth[_0xa34a('0xa')](),controller[_0xa34a('0xb')]);router[_0xa34a('0x9')](_0xa34a('0xc'),auth[_0xa34a('0xa')](),controller[_0xa34a('0xd')]);router['get'](_0xa34a('0xe'),auth[_0xa34a('0xa')](),controller[_0xa34a('0xf')]);router[_0xa34a('0x10')]('/',auth[_0xa34a('0xa')](),controller['create']);router[_0xa34a('0x11')](_0xa34a('0xe'),auth[_0xa34a('0xa')](),controller[_0xa34a('0x12')]);router[_0xa34a('0x13')](_0xa34a('0xe'),auth[_0xa34a('0xa')](),controller['destroy']);module[_0xa34a('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1a19e08..ad6cbd5 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 _0x6d41=['DATE','sequelize','exports','STRING'];(function(_0x5759e0,_0x31984b){var _0x1a64cd=function(_0x586c59){while(--_0x586c59){_0x5759e0['push'](_0x5759e0['shift']());}};_0x1a64cd(++_0x31984b);}(_0x6d41,0xad));var _0x16d4=function(_0x13ad14,_0x3d92c4){_0x13ad14=_0x13ad14-0x0;var _0x512f93=_0x6d41[_0x13ad14];return _0x512f93;};'use strict';var moment=require('moment');var Sequelize=require(_0x16d4('0x0'));module[_0x16d4('0x1')]={'uniqueid':{'type':Sequelize[_0x16d4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x16d4('0x2')]},'joinAt':{'type':Sequelize[_0x16d4('0x3')]},'leaveAt':{'type':Sequelize[_0x16d4('0x3')]},'acceptAt':{'type':Sequelize[_0x16d4('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x16d4('0x2')]}}; \ No newline at end of file +var _0x53f8=['STRING','DATE','sequelize','exports'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x53f8,0x7a));var _0x853f=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x53f8[_0x565c49];return _0x20ca34;};'use strict';var moment=require('moment');var Sequelize=require(_0x853f('0x0'));module[_0x853f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x853f('0x2')]},'joinAt':{'type':Sequelize[_0x853f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x853f('0x3')]},'exitAt':{'type':Sequelize[_0x853f('0x3')]},'reason':{'type':Sequelize[_0x853f('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4c9b8b6..24949ca 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 _0x69ce=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SmsQueueReport','include','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x15299d,_0x16548f){var _0x969422=function(_0x287c0a){while(--_0x287c0a){_0x15299d['push'](_0x15299d['shift']());}};_0x969422(++_0x16548f);}(_0x69ce,0xd6));var _0xe69c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x69ce[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xe69c('0x0'));var rimraf=require(_0xe69c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe69c('0x2'));var rp=require(_0xe69c('0x3'));var moment=require('moment');var BPromise=require(_0xe69c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe69c('0x5'));var sox=require(_0xe69c('0x6'));var csv=require('to-csv');var ejs=require(_0xe69c('0x7'));var fs=require('fs');var fs_extra=require(_0xe69c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe69c('0x9'));var jsforce=require(_0xe69c('0xa'));var deskjs=require(_0xe69c('0xb'));var toCsv=require(_0xe69c('0xc'));var querystring=require(_0xe69c('0xd'));var Papa=require('papaparse');var Redis=require(_0xe69c('0xe'));var authService=require(_0xe69c('0xf'));var qs=require(_0xe69c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe69c('0x11'));var logger=require(_0xe69c('0x12'))(_0xe69c('0x13'));var utils=require(_0xe69c('0x14'));var config=require(_0xe69c('0x15'));var licenseUtil=require(_0xe69c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369c6c,_0x205325){_0x205325=_0x205325||0xcc;return function(_0x5237db){if(_0x5237db){return _0x369c6c[_0xe69c('0x17')](_0x205325);}return _0x369c6c[_0xe69c('0x18')](_0x205325)['end']();};}function respondWithResult(_0x52a451,_0x475411){_0x475411=_0x475411||0xc8;return function(_0x5611d6){if(_0x5611d6){return _0x52a451['status'](_0x475411)[_0xe69c('0x19')](_0x5611d6);}};}function respondWithFilteredResult(_0x4cbf22,_0xe48434){return function(_0x3e0022){if(_0x3e0022){var _0x30ef17=typeof _0xe48434[_0xe69c('0x1a')]===_0xe69c('0x1b')&&typeof _0xe48434['limit']==='undefined';var _0x535907=_0x3e0022[_0xe69c('0x1c')];var _0x229e04=_0x30ef17?0x0:_0xe48434[_0xe69c('0x1a')];var _0x1e3a71=_0x30ef17?_0x3e0022[_0xe69c('0x1c')]:_0xe48434[_0xe69c('0x1a')]+_0xe48434[_0xe69c('0x1d')];var _0x328080;if(_0x1e3a71>=_0x535907){_0x1e3a71=_0x535907;_0x328080=0xc8;}else{_0x328080=0xce;}_0x4cbf22[_0xe69c('0x18')](_0x328080);return _0x4cbf22[_0xe69c('0x1e')](_0xe69c('0x1f'),_0x229e04+'-'+_0x1e3a71+'/'+_0x535907)['json'](_0x3e0022);}return null;};}function patchUpdates(_0x2f18e9){return function(_0x300b78){try{jsonpatch[_0xe69c('0x20')](_0x300b78,_0x2f18e9,!![]);}catch(_0x46c60e){return BPromise[_0xe69c('0x21')](_0x46c60e);}return _0x300b78[_0xe69c('0x22')]();};}function saveUpdates(_0x4c0a18,_0x209618){return function(_0x19ea60){if(_0x19ea60){return _0x19ea60['update'](_0x4c0a18)[_0xe69c('0x23')](function(_0xd1b049){return _0xd1b049;});}return null;};}function removeEntity(_0x35014e,_0x438b56){return function(_0x428b79){if(_0x428b79){return _0x428b79[_0xe69c('0x24')]()[_0xe69c('0x23')](function(){_0x35014e[_0xe69c('0x18')](0xcc)[_0xe69c('0x25')]();});}};}function handleEntityNotFound(_0x5c3f2f,_0xfc1c09){return function(_0x51ca39){if(!_0x51ca39){_0x5c3f2f[_0xe69c('0x17')](0x194);}return _0x51ca39;};}function handleError(_0x56a78a,_0x13ffcf){_0x13ffcf=_0x13ffcf||0x1f4;return function(_0x35871){logger[_0xe69c('0x26')](_0x35871[_0xe69c('0x27')]);if(_0x35871[_0xe69c('0x28')]){delete _0x35871[_0xe69c('0x28')];}_0x56a78a[_0xe69c('0x18')](_0x13ffcf)[_0xe69c('0x29')](_0x35871);};}exports[_0xe69c('0x2a')]=function(_0x372031,_0x21fbe7){var _0x15c6d2={},_0x44412d={},_0x669cba={'count':0x0,'rows':[]};var _0x58f08f=_[_0xe69c('0x2b')](db['SmsQueueReport'][_0xe69c('0x2c')],function(_0x1efb77){return{'name':_0x1efb77[_0xe69c('0x2d')],'type':_0x1efb77[_0xe69c('0x2e')][_0xe69c('0x2f')]};});_0x44412d[_0xe69c('0x30')]=_[_0xe69c('0x2b')](_0x58f08f,_0xe69c('0x28'));_0x44412d[_0xe69c('0x31')]=_['keys'](_0x372031[_0xe69c('0x31')]);_0x44412d[_0xe69c('0x32')]=_[_0xe69c('0x33')](_0x44412d[_0xe69c('0x30')],_0x44412d[_0xe69c('0x31')]);_0x15c6d2['attributes']=_[_0xe69c('0x33')](_0x44412d[_0xe69c('0x30')],qs['fields'](_0x372031[_0xe69c('0x31')][_0xe69c('0x34')]));_0x15c6d2[_0xe69c('0x35')]=_0x15c6d2[_0xe69c('0x35')][_0xe69c('0x36')]?_0x15c6d2[_0xe69c('0x35')]:_0x44412d['model'];if(!_0x372031[_0xe69c('0x31')][_0xe69c('0x37')](_0xe69c('0x38'))){_0x15c6d2[_0xe69c('0x1d')]=qs['limit'](_0x372031['query']['limit']);_0x15c6d2['offset']=qs[_0xe69c('0x1a')](_0x372031[_0xe69c('0x31')][_0xe69c('0x1a')]);}_0x15c6d2[_0xe69c('0x39')]=qs[_0xe69c('0x3a')](_0x372031[_0xe69c('0x31')][_0xe69c('0x3a')]);_0x15c6d2[_0xe69c('0x3b')]=qs[_0xe69c('0x32')](_[_0xe69c('0x3c')](_0x372031[_0xe69c('0x31')],_0x44412d[_0xe69c('0x32')]),_0x58f08f);if(_0x372031[_0xe69c('0x31')][_0xe69c('0x3d')]){_0x15c6d2[_0xe69c('0x3b')]=_[_0xe69c('0x3e')](_0x15c6d2[_0xe69c('0x3b')],{'$or':_[_0xe69c('0x2b')](_0x58f08f,function(_0x4a0d6b){if(_0x4a0d6b[_0xe69c('0x2e')]!=='VIRTUAL'){var _0xe884a1={};_0xe884a1[_0x4a0d6b[_0xe69c('0x28')]]={'$like':'%'+_0x372031[_0xe69c('0x31')]['filter']+'%'};return _0xe884a1;}})});}_0x15c6d2=_[_0xe69c('0x3e')]({},_0x15c6d2,_0x372031[_0xe69c('0x3f')]);var _0xd5da0={'where':_0x15c6d2[_0xe69c('0x3b')]};return db[_0xe69c('0x40')][_0xe69c('0x1c')](_0xd5da0)[_0xe69c('0x23')](function(_0x3ef3e5){_0x669cba[_0xe69c('0x1c')]=_0x3ef3e5;if(_0x372031['query']['includeAll']){_0x15c6d2[_0xe69c('0x41')]=[{'all':!![]}];}return db[_0xe69c('0x40')]['findAll'](_0x15c6d2);})['then'](function(_0x27f7ff){_0x669cba[_0xe69c('0x42')]=_0x27f7ff;return _0x669cba;})[_0xe69c('0x23')](respondWithFilteredResult(_0x21fbe7,_0x15c6d2))[_0xe69c('0x43')](handleError(_0x21fbe7,null));};exports[_0xe69c('0x44')]=function(_0x4e29b9,_0x1e0f91){var _0x5b4e9a={'raw':!![],'where':{'id':_0x4e29b9[_0xe69c('0x45')]['id']}},_0x448d12={};_0x448d12['model']=_[_0xe69c('0x46')](db[_0xe69c('0x40')][_0xe69c('0x2c')]);_0x448d12[_0xe69c('0x31')]=_[_0xe69c('0x46')](_0x4e29b9[_0xe69c('0x31')]);_0x448d12[_0xe69c('0x32')]=_[_0xe69c('0x33')](_0x448d12[_0xe69c('0x30')],_0x448d12[_0xe69c('0x31')]);_0x5b4e9a[_0xe69c('0x35')]=_[_0xe69c('0x33')](_0x448d12[_0xe69c('0x30')],qs[_0xe69c('0x34')](_0x4e29b9[_0xe69c('0x31')][_0xe69c('0x34')]));_0x5b4e9a[_0xe69c('0x35')]=_0x5b4e9a[_0xe69c('0x35')][_0xe69c('0x36')]?_0x5b4e9a['attributes']:_0x448d12[_0xe69c('0x30')];if(_0x4e29b9['query'][_0xe69c('0x47')]){_0x5b4e9a[_0xe69c('0x41')]=[{'all':!![]}];}_0x5b4e9a=_['merge']({},_0x5b4e9a,_0x4e29b9[_0xe69c('0x3f')]);return db[_0xe69c('0x40')]['find'](_0x5b4e9a)[_0xe69c('0x23')](handleEntityNotFound(_0x1e0f91,null))['then'](respondWithResult(_0x1e0f91,null))[_0xe69c('0x43')](handleError(_0x1e0f91,null));};exports[_0xe69c('0x48')]=function(_0x2493cc,_0x19a62d){return db[_0xe69c('0x40')][_0xe69c('0x48')](_0x2493cc[_0xe69c('0x49')],{})['then'](respondWithResult(_0x19a62d,0xc9))[_0xe69c('0x43')](handleError(_0x19a62d,null));};exports['update']=function(_0x46a574,_0x15f56f){if(_0x46a574[_0xe69c('0x49')]['id']){delete _0x46a574[_0xe69c('0x49')]['id'];}return db[_0xe69c('0x40')][_0xe69c('0x4a')]({'where':{'id':_0x46a574[_0xe69c('0x45')]['id']}})['then'](handleEntityNotFound(_0x15f56f,null))[_0xe69c('0x23')](saveUpdates(_0x46a574[_0xe69c('0x49')],null))['then'](respondWithResult(_0x15f56f,null))[_0xe69c('0x43')](handleError(_0x15f56f,null));};exports['destroy']=function(_0x366f5c,_0x1fd476){return db[_0xe69c('0x40')][_0xe69c('0x4a')]({'where':{'id':_0x366f5c[_0xe69c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fd476,null))[_0xe69c('0x23')](removeEntity(_0x1fd476,null))[_0xe69c('0x43')](handleError(_0x1fd476,null));};exports[_0xe69c('0x4b')]=function(_0x393ce0,_0x5f3f2f){return db[_0xe69c('0x40')][_0xe69c('0x4b')]()['then'](respondWithResult(_0x5f3f2f,null))['catch'](handleError(_0x5f3f2f,null));}; \ No newline at end of file +var _0x236a=['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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','options','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5dc45d,_0x55f90f){var _0x4ce697=function(_0x4e6e21){while(--_0x4e6e21){_0x5dc45d['push'](_0x5dc45d['shift']());}};_0x4ce697(++_0x55f90f);}(_0x236a,0x17d));var _0xa236=function(_0x306409,_0x9c38b4){_0x306409=_0x306409-0x0;var _0x5a179b=_0x236a[_0x306409];return _0x5a179b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa236('0x0'));var zipdir=require(_0xa236('0x1'));var jsonpatch=require(_0xa236('0x2'));var rp=require(_0xa236('0x3'));var moment=require(_0xa236('0x4'));var BPromise=require(_0xa236('0x5'));var Mustache=require(_0xa236('0x6'));var util=require(_0xa236('0x7'));var path=require(_0xa236('0x8'));var sox=require('sox');var csv=require(_0xa236('0x9'));var ejs=require(_0xa236('0xa'));var fs=require('fs');var fs_extra=require(_0xa236('0xb'));var _=require(_0xa236('0xc'));var squel=require(_0xa236('0xd'));var crypto=require(_0xa236('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa236('0xf'));var toCsv=require(_0xa236('0x9'));var querystring=require('querystring');var Papa=require(_0xa236('0x10'));var Redis=require(_0xa236('0x11'));var authService=require(_0xa236('0x12'));var qs=require(_0xa236('0x13'));var as=require(_0xa236('0x14'));var hardwareService=require(_0xa236('0x15'));var logger=require(_0xa236('0x16'))(_0xa236('0x17'));var utils=require(_0xa236('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa236('0x19'));var db=require(_0xa236('0x1a'))['db'];function respondWithStatusCode(_0xe9fc26,_0x439fc7){_0x439fc7=_0x439fc7||0xcc;return function(_0x39e8d4){if(_0x39e8d4){return _0xe9fc26[_0xa236('0x1b')](_0x439fc7);}return _0xe9fc26[_0xa236('0x1c')](_0x439fc7)['end']();};}function respondWithResult(_0x5c036b,_0x44905f){_0x44905f=_0x44905f||0xc8;return function(_0x232198){if(_0x232198){return _0x5c036b[_0xa236('0x1c')](_0x44905f)[_0xa236('0x1d')](_0x232198);}};}function respondWithFilteredResult(_0x2b2944,_0x4faee9){return function(_0x5b5dc5){if(_0x5b5dc5){var _0x29a246=typeof _0x4faee9[_0xa236('0x1e')]===_0xa236('0x1f')&&typeof _0x4faee9[_0xa236('0x20')]===_0xa236('0x1f');var _0x4c7173=_0x5b5dc5[_0xa236('0x21')];var _0x2613e6=_0x29a246?0x0:_0x4faee9['offset'];var _0x5e14a1=_0x29a246?_0x5b5dc5[_0xa236('0x21')]:_0x4faee9[_0xa236('0x1e')]+_0x4faee9[_0xa236('0x20')];var _0x5472c9;if(_0x5e14a1>=_0x4c7173){_0x5e14a1=_0x4c7173;_0x5472c9=0xc8;}else{_0x5472c9=0xce;}_0x2b2944[_0xa236('0x1c')](_0x5472c9);return _0x2b2944['set']('Content-Range',_0x2613e6+'-'+_0x5e14a1+'/'+_0x4c7173)[_0xa236('0x1d')](_0x5b5dc5);}return null;};}function patchUpdates(_0x553413){return function(_0x58d2ca){try{jsonpatch[_0xa236('0x22')](_0x58d2ca,_0x553413,!![]);}catch(_0x4ca8de){return BPromise[_0xa236('0x23')](_0x4ca8de);}return _0x58d2ca[_0xa236('0x24')]();};}function saveUpdates(_0x58c658,_0x1da4a7){return function(_0x1cd13a){if(_0x1cd13a){return _0x1cd13a['update'](_0x58c658)[_0xa236('0x25')](function(_0x5749aa){return _0x5749aa;});}return null;};}function removeEntity(_0x51bab0,_0x93f852){return function(_0x35a6f5){if(_0x35a6f5){return _0x35a6f5[_0xa236('0x26')]()[_0xa236('0x25')](function(){_0x51bab0[_0xa236('0x1c')](0xcc)[_0xa236('0x27')]();});}};}function handleEntityNotFound(_0x51aa39,_0x19a6fa){return function(_0x4f9517){if(!_0x4f9517){_0x51aa39[_0xa236('0x1b')](0x194);}return _0x4f9517;};}function handleError(_0x42640b,_0x34c289){_0x34c289=_0x34c289||0x1f4;return function(_0x16f62b){logger[_0xa236('0x28')](_0x16f62b[_0xa236('0x29')]);if(_0x16f62b[_0xa236('0x2a')]){delete _0x16f62b['name'];}_0x42640b[_0xa236('0x1c')](_0x34c289)[_0xa236('0x2b')](_0x16f62b);};}exports[_0xa236('0x2c')]=function(_0x195df4,_0x1f9857){var _0x4912d1={},_0x214cb1={},_0x32e7a3={'count':0x0,'rows':[]};var _0x5b539f=_['map'](db[_0xa236('0x2d')][_0xa236('0x2e')],function(_0x1c2100){return{'name':_0x1c2100[_0xa236('0x2f')],'type':_0x1c2100[_0xa236('0x30')][_0xa236('0x31')]};});_0x214cb1['model']=_['map'](_0x5b539f,'name');_0x214cb1[_0xa236('0x32')]=_[_0xa236('0x33')](_0x195df4['query']);_0x214cb1[_0xa236('0x34')]=_[_0xa236('0x35')](_0x214cb1[_0xa236('0x36')],_0x214cb1['query']);_0x4912d1[_0xa236('0x37')]=_[_0xa236('0x35')](_0x214cb1[_0xa236('0x36')],qs[_0xa236('0x38')](_0x195df4[_0xa236('0x32')][_0xa236('0x38')]));_0x4912d1[_0xa236('0x37')]=_0x4912d1[_0xa236('0x37')][_0xa236('0x39')]?_0x4912d1['attributes']:_0x214cb1[_0xa236('0x36')];if(!_0x195df4[_0xa236('0x32')][_0xa236('0x3a')]('nolimit')){_0x4912d1[_0xa236('0x20')]=qs[_0xa236('0x20')](_0x195df4['query'][_0xa236('0x20')]);_0x4912d1[_0xa236('0x1e')]=qs[_0xa236('0x1e')](_0x195df4[_0xa236('0x32')][_0xa236('0x1e')]);}_0x4912d1[_0xa236('0x3b')]=qs['sort'](_0x195df4[_0xa236('0x32')][_0xa236('0x3c')]);_0x4912d1[_0xa236('0x3d')]=qs[_0xa236('0x34')](_[_0xa236('0x3e')](_0x195df4['query'],_0x214cb1[_0xa236('0x34')]),_0x5b539f);if(_0x195df4[_0xa236('0x32')]['filter']){_0x4912d1[_0xa236('0x3d')]=_[_0xa236('0x3f')](_0x4912d1['where'],{'$or':_[_0xa236('0x40')](_0x5b539f,function(_0x32fcb5){if(_0x32fcb5[_0xa236('0x30')]!==_0xa236('0x41')){var _0x56490e={};_0x56490e[_0x32fcb5[_0xa236('0x2a')]]={'$like':'%'+_0x195df4[_0xa236('0x32')]['filter']+'%'};return _0x56490e;}})});}_0x4912d1=_['merge']({},_0x4912d1,_0x195df4['options']);var _0x52e260={'where':_0x4912d1[_0xa236('0x3d')]};return db[_0xa236('0x2d')][_0xa236('0x21')](_0x52e260)[_0xa236('0x25')](function(_0x31de8e){_0x32e7a3[_0xa236('0x21')]=_0x31de8e;if(_0x195df4[_0xa236('0x32')]['includeAll']){_0x4912d1[_0xa236('0x42')]=[{'all':!![]}];}return db[_0xa236('0x2d')][_0xa236('0x43')](_0x4912d1);})[_0xa236('0x25')](function(_0x5d65dd){_0x32e7a3[_0xa236('0x44')]=_0x5d65dd;return _0x32e7a3;})[_0xa236('0x25')](respondWithFilteredResult(_0x1f9857,_0x4912d1))[_0xa236('0x45')](handleError(_0x1f9857,null));};exports[_0xa236('0x46')]=function(_0x234320,_0x16a85f){var _0x41d82f={'raw':!![],'where':{'id':_0x234320[_0xa236('0x47')]['id']}},_0x2009ca={};_0x2009ca[_0xa236('0x36')]=_[_0xa236('0x33')](db['SmsQueueReport']['rawAttributes']);_0x2009ca[_0xa236('0x32')]=_['keys'](_0x234320[_0xa236('0x32')]);_0x2009ca[_0xa236('0x34')]=_[_0xa236('0x35')](_0x2009ca['model'],_0x2009ca[_0xa236('0x32')]);_0x41d82f[_0xa236('0x37')]=_['intersection'](_0x2009ca['model'],qs[_0xa236('0x38')](_0x234320[_0xa236('0x32')][_0xa236('0x38')]));_0x41d82f[_0xa236('0x37')]=_0x41d82f[_0xa236('0x37')][_0xa236('0x39')]?_0x41d82f['attributes']:_0x2009ca[_0xa236('0x36')];if(_0x234320['query']['includeAll']){_0x41d82f[_0xa236('0x42')]=[{'all':!![]}];}_0x41d82f=_[_0xa236('0x3f')]({},_0x41d82f,_0x234320[_0xa236('0x48')]);return db['SmsQueueReport'][_0xa236('0x49')](_0x41d82f)['then'](handleEntityNotFound(_0x16a85f,null))[_0xa236('0x25')](respondWithResult(_0x16a85f,null))[_0xa236('0x45')](handleError(_0x16a85f,null));};exports[_0xa236('0x4a')]=function(_0x5a5659,_0x1603b8){return db['SmsQueueReport'][_0xa236('0x4a')](_0x5a5659['body'],{})[_0xa236('0x25')](respondWithResult(_0x1603b8,0xc9))[_0xa236('0x45')](handleError(_0x1603b8,null));};exports[_0xa236('0x4b')]=function(_0x28f02f,_0x48a793){if(_0x28f02f[_0xa236('0x4c')]['id']){delete _0x28f02f[_0xa236('0x4c')]['id'];}return db['SmsQueueReport'][_0xa236('0x49')]({'where':{'id':_0x28f02f[_0xa236('0x47')]['id']}})[_0xa236('0x25')](handleEntityNotFound(_0x48a793,null))['then'](saveUpdates(_0x28f02f['body'],null))[_0xa236('0x25')](respondWithResult(_0x48a793,null))[_0xa236('0x45')](handleError(_0x48a793,null));};exports[_0xa236('0x26')]=function(_0x1392ee,_0x117259){return db[_0xa236('0x2d')][_0xa236('0x49')]({'where':{'id':_0x1392ee[_0xa236('0x47')]['id']}})[_0xa236('0x25')](handleEntityNotFound(_0x117259,null))['then'](removeEntity(_0x117259,null))[_0xa236('0x45')](handleError(_0x117259,null));};exports[_0xa236('0x4d')]=function(_0x35375d,_0x114ce6){return db[_0xa236('0x2d')][_0xa236('0x4d')]()['then'](respondWithResult(_0x114ce6,null))[_0xa236('0x45')](handleError(_0x114ce6,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 56b6a39..2140936 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x529fe4,_0x24c212){var _0x18511a=function(_0x3361bd){while(--_0x3361bd){_0x529fe4['push'](_0x529fe4['shift']());}};_0x18511a(++_0x24c212);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xcb91[_0x80d733];return _0x435868;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x3d7a9f,_0x24e0f1){var _0x13f5f1=function(_0x1fbbda){while(--_0x1fbbda){_0x3d7a9f['push'](_0x3d7a9f['shift']());}};_0x13f5f1(++_0x24e0f1);}(_0xe706,0xa3));var _0x6e70=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0xe706[_0x4ea728];return _0x290764;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 61cefac..1039b5b 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 _0xc9dc=['error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','UpdateSmsQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a8517,_0x2b5a1d){var _0x43ff0e=function(_0x3e0b3d){while(--_0x3e0b3d){_0x3a8517['push'](_0x3a8517['shift']());}};_0x43ff0e(++_0x2b5a1d);}(_0xc9dc,0xc8));var _0xcc9d=function(_0x19280a,_0x192558){_0x19280a=_0x19280a-0x0;var _0x1c5d4a=_0xc9dc[_0x19280a];return _0x1c5d4a;};'use strict';var _=require('lodash');var util=require(_0xcc9d('0x0'));var moment=require(_0xcc9d('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc9d('0x2'));var fs=require('fs');var Redis=require(_0xcc9d('0x3'));var db=require(_0xcc9d('0x4'))['db'];var utils=require(_0xcc9d('0x5'));var logger=require(_0xcc9d('0x6'))('rpc');var config=require(_0xcc9d('0x7'));var jayson=require(_0xcc9d('0x8'));var client=jayson[_0xcc9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b4fb5,_0xc30ae0,_0x333861){return new BPromise(function(_0x393226,_0x3ba967){return client[_0xcc9d('0xa')](_0x5b4fb5,_0x333861)['then'](function(_0x22bee8){logger[_0xcc9d('0xb')](_0xcc9d('0xc'),_0xc30ae0,'request\x20sent');logger[_0xcc9d('0xd')](_0xcc9d('0xe'),_0xc30ae0,_0xcc9d('0xf'),JSON[_0xcc9d('0x10')](_0x22bee8));if(_0x22bee8[_0xcc9d('0x11')]){if(_0x22bee8[_0xcc9d('0x11')][_0xcc9d('0x12')]===0x1f4){logger[_0xcc9d('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xc30ae0,_0x22bee8['error'][_0xcc9d('0x13')]);return _0x3ba967(_0x22bee8['error'][_0xcc9d('0x13')]);}logger[_0xcc9d('0x11')](_0xcc9d('0xc'),_0xc30ae0,_0x22bee8[_0xcc9d('0x11')]['message']);return _0x393226(_0x22bee8[_0xcc9d('0x11')][_0xcc9d('0x13')]);}else{logger[_0xcc9d('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0xc30ae0,_0xcc9d('0xf'));_0x393226(_0x22bee8[_0xcc9d('0x14')][_0xcc9d('0x13')]);}})['catch'](function(_0x17bf68){logger[_0xcc9d('0x11')](_0xcc9d('0xc'),_0xc30ae0,_0x17bf68);_0x3ba967(_0x17bf68);});});}exports[_0xcc9d('0x15')]=function(_0xbf02de){var _0x53d28b=this;return new Promise(function(_0x416186,_0x56b4ed){return db[_0xcc9d('0x16')][_0xcc9d('0x17')](_0xbf02de[_0xcc9d('0x18')],{'raw':_0xbf02de[_0xcc9d('0x19')]?_0xbf02de[_0xcc9d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xcc9d('0x1a')](function(_0x2dfc5d){logger[_0xcc9d('0xb')]('CreateSmsQueueReport',_0xbf02de);logger[_0xcc9d('0xd')](_0xcc9d('0x15'),_0xbf02de,JSON[_0xcc9d('0x10')](_0x2dfc5d));_0x416186(_0x2dfc5d);})['catch'](function(_0x1393cb){logger[_0xcc9d('0x11')](_0xcc9d('0x15'),_0x1393cb['message'],_0xbf02de);_0x56b4ed(_0x53d28b[_0xcc9d('0x11')](0x1f4,_0x1393cb[_0xcc9d('0x13')]));});});};exports[_0xcc9d('0x1b')]=function(_0x981714){var _0x2384fd=this;return new Promise(function(_0x30b2f4,_0x2ac2ef){return db['SmsQueueReport']['update'](_0x981714['body'],{'raw':_0x981714[_0xcc9d('0x19')]?_0x981714[_0xcc9d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x981714[_0xcc9d('0x19')]?_0x981714[_0xcc9d('0x19')][_0xcc9d('0x1c')]||null:null,'attributes':_0x981714['options']?_0x981714[_0xcc9d('0x19')][_0xcc9d('0x1d')]||null:null,'limit':_0x981714[_0xcc9d('0x19')]?_0x981714[_0xcc9d('0x19')][_0xcc9d('0x1e')]||null:null})['then'](function(_0x1b75c1){logger[_0xcc9d('0xb')](_0xcc9d('0x1b'),_0x981714);logger[_0xcc9d('0xd')]('UpdateSmsQueueReport',_0x981714,JSON[_0xcc9d('0x10')](_0x1b75c1));_0x30b2f4(_0x1b75c1);})['catch'](function(_0x374553){logger[_0xcc9d('0x11')]('UpdateSmsQueueReport',_0x374553[_0xcc9d('0x13')],_0x981714);_0x2ac2ef(_0x2384fd[_0xcc9d('0x11')](0x1f4,_0x374553[_0xcc9d('0x13')]));});});}; \ No newline at end of file +var _0x4b8b=['CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','create','body','options','raw'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4b8b,0x1ce));var _0xb4b8=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x4b8b[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require(_0xb4b8('0x2'));var BPromise=require(_0xb4b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4b8('0x4'));var db=require(_0xb4b8('0x5'))['db'];var utils=require(_0xb4b8('0x6'));var logger=require(_0xb4b8('0x7'))('rpc');var config=require(_0xb4b8('0x8'));var jayson=require(_0xb4b8('0x9'));var client=jayson['client'][_0xb4b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199264,_0x2d22dd,_0x169f22){return new BPromise(function(_0x8bacc9,_0x27d7c3){return client[_0xb4b8('0xb')](_0x199264,_0x169f22)[_0xb4b8('0xc')](function(_0x2167d8){logger[_0xb4b8('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2d22dd,_0xb4b8('0xe'));logger['debug'](_0xb4b8('0xf'),_0x2d22dd,_0xb4b8('0xe'),JSON[_0xb4b8('0x10')](_0x2167d8));if(_0x2167d8['error']){if(_0x2167d8[_0xb4b8('0x11')][_0xb4b8('0x12')]===0x1f4){logger[_0xb4b8('0x11')](_0xb4b8('0x13'),_0x2d22dd,_0x2167d8['error'][_0xb4b8('0x14')]);return _0x27d7c3(_0x2167d8[_0xb4b8('0x11')][_0xb4b8('0x14')]);}logger[_0xb4b8('0x11')](_0xb4b8('0x13'),_0x2d22dd,_0x2167d8[_0xb4b8('0x11')][_0xb4b8('0x14')]);return _0x8bacc9(_0x2167d8[_0xb4b8('0x11')][_0xb4b8('0x14')]);}else{logger['info'](_0xb4b8('0x13'),_0x2d22dd,'request\x20sent');_0x8bacc9(_0x2167d8[_0xb4b8('0x15')]['message']);}})[_0xb4b8('0x16')](function(_0x14c9e9){logger[_0xb4b8('0x11')](_0xb4b8('0x13'),_0x2d22dd,_0x14c9e9);_0x27d7c3(_0x14c9e9);});});}exports['CreateSmsQueueReport']=function(_0x4e5a74){var _0x475940=this;return new Promise(function(_0x44cec2,_0x1a74db){return db[_0xb4b8('0x17')][_0xb4b8('0x18')](_0x4e5a74[_0xb4b8('0x19')],{'raw':_0x4e5a74[_0xb4b8('0x1a')]?_0x4e5a74[_0xb4b8('0x1a')][_0xb4b8('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5d662a){logger['info']('CreateSmsQueueReport',_0x4e5a74);logger['debug'](_0xb4b8('0x1c'),_0x4e5a74,JSON['stringify'](_0x5d662a));_0x44cec2(_0x5d662a);})[_0xb4b8('0x16')](function(_0x4fee49){logger[_0xb4b8('0x11')](_0xb4b8('0x1c'),_0x4fee49[_0xb4b8('0x14')],_0x4e5a74);_0x1a74db(_0x475940[_0xb4b8('0x11')](0x1f4,_0x4fee49['message']));});});};exports[_0xb4b8('0x1d')]=function(_0x206f08){var _0x206814=this;return new Promise(function(_0x1b24c4,_0x436493){return db[_0xb4b8('0x17')][_0xb4b8('0x1e')](_0x206f08[_0xb4b8('0x19')],{'raw':_0x206f08[_0xb4b8('0x1a')]?_0x206f08['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x206f08[_0xb4b8('0x1a')]?_0x206f08['options'][_0xb4b8('0x1f')]||null:null,'attributes':_0x206f08['options']?_0x206f08['options'][_0xb4b8('0x20')]||null:null,'limit':_0x206f08[_0xb4b8('0x1a')]?_0x206f08[_0xb4b8('0x1a')][_0xb4b8('0x21')]||null:null})['then'](function(_0x687101){logger[_0xb4b8('0xd')]('UpdateSmsQueueReport',_0x206f08);logger[_0xb4b8('0x22')](_0xb4b8('0x1d'),_0x206f08,JSON[_0xb4b8('0x10')](_0x687101));_0x1b24c4(_0x687101);})[_0xb4b8('0x16')](function(_0x57973f){logger[_0xb4b8('0x11')](_0xb4b8('0x1d'),_0x57973f[_0xb4b8('0x14')],_0x206f08);_0x436493(_0x206814[_0xb4b8('0x11')](0x1f4,_0x57973f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a2100c1..6ed52ff 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 _0x7217=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7217,0x19e));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2fed=['path','connect-timeout','express','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x15add8,_0x14cf3d){var _0x3358ce=function(_0x4eadc3){while(--_0x4eadc3){_0x15add8['push'](_0x15add8['shift']());}};_0x3358ce(++_0x14cf3d);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4ba537,_0x23673b){_0x4ba537=_0x4ba537-0x0;var _0xd4ef2a=_0x2fed[_0x4ba537];return _0xd4ef2a;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require(_0xd2fe('0x3'));var express=require(_0xd2fe('0x4'));var router=express['Router']();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2fe('0x7'));router[_0xd2fe('0x8')]('/',auth[_0xd2fe('0x9')](),controller['index']);router[_0xd2fe('0x8')](_0xd2fe('0xa'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xb')]);router['get'](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xd')]);router[_0xd2fe('0xe')]('/',auth[_0xd2fe('0x9')](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0x10')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x11')]);router[_0xd2fe('0x12')](_0xd2fe('0xc'),auth[_0xd2fe('0x9')](),controller[_0xd2fe('0x13')]);module[_0xd2fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1f01a0f..168b289 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2e4125,_0x2e2929){var _0x568e0c=function(_0x117a25){while(--_0x117a25){_0x2e4125['push'](_0x2e4125['shift']());}};_0x568e0c(++_0x2e2929);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3409aa,_0x535577){_0x3409aa=_0x3409aa-0x0;var _0x2987fc=_0xf4eb[_0x3409aa];return _0x2987fc;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1adac7,_0x52e48a){var _0x528a7a=function(_0x20a3c7){while(--_0x20a3c7){_0x1adac7['push'](_0x1adac7['shift']());}};_0x528a7a(++_0x52e48a);}(_0xaa88,0x137));var _0x8aa8=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xaa88[_0xa388a2];return _0x7ce7f6;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 100819e..9fc688a 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 _0xbf3b=['offset','set','Content-Range','reject','then','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','SmsTransferReport','findAll','catch','show','params','keys','includeAll','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count'];(function(_0x408b65,_0x11dc18){var _0x360b6a=function(_0x520e5){while(--_0x520e5){_0x408b65['push'](_0x408b65['shift']());}};_0x360b6a(++_0x11dc18);}(_0xbf3b,0x19a));var _0xbbf3=function(_0x1223e8,_0x341712){_0x1223e8=_0x1223e8-0x0;var _0x6682e5=_0xbf3b[_0x1223e8];return _0x6682e5;};'use strict';var emlformat=require(_0xbbf3('0x0'));var rimraf=require(_0xbbf3('0x1'));var zipdir=require(_0xbbf3('0x2'));var jsonpatch=require(_0xbbf3('0x3'));var rp=require(_0xbbf3('0x4'));var moment=require('moment');var BPromise=require(_0xbbf3('0x5'));var Mustache=require(_0xbbf3('0x6'));var util=require('util');var path=require(_0xbbf3('0x7'));var sox=require(_0xbbf3('0x8'));var csv=require(_0xbbf3('0x9'));var ejs=require(_0xbbf3('0xa'));var fs=require('fs');var fs_extra=require(_0xbbf3('0xb'));var _=require(_0xbbf3('0xc'));var squel=require(_0xbbf3('0xd'));var crypto=require(_0xbbf3('0xe'));var jsforce=require(_0xbbf3('0xf'));var deskjs=require(_0xbbf3('0x10'));var toCsv=require(_0xbbf3('0x9'));var querystring=require(_0xbbf3('0x11'));var Papa=require(_0xbbf3('0x12'));var Redis=require(_0xbbf3('0x13'));var authService=require(_0xbbf3('0x14'));var qs=require(_0xbbf3('0x15'));var as=require(_0xbbf3('0x16'));var hardwareService=require(_0xbbf3('0x17'));var logger=require(_0xbbf3('0x18'))(_0xbbf3('0x19'));var utils=require('../../config/utils');var config=require(_0xbbf3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbf3('0x1b'))['db'];function respondWithStatusCode(_0xb75563,_0x57e501){_0x57e501=_0x57e501||0xcc;return function(_0x194c94){if(_0x194c94){return _0xb75563['sendStatus'](_0x57e501);}return _0xb75563[_0xbbf3('0x1c')](_0x57e501)[_0xbbf3('0x1d')]();};}function respondWithResult(_0x14f087,_0x575499){_0x575499=_0x575499||0xc8;return function(_0x495940){if(_0x495940){return _0x14f087[_0xbbf3('0x1c')](_0x575499)[_0xbbf3('0x1e')](_0x495940);}};}function respondWithFilteredResult(_0x1882bd,_0x579b45){return function(_0x2d0961){if(_0x2d0961){var _0x15925e=typeof _0x579b45['offset']===_0xbbf3('0x1f')&&typeof _0x579b45[_0xbbf3('0x20')]===_0xbbf3('0x1f');var _0x1c381e=_0x2d0961[_0xbbf3('0x21')];var _0x4b20f2=_0x15925e?0x0:_0x579b45[_0xbbf3('0x22')];var _0x3d1439=_0x15925e?_0x2d0961[_0xbbf3('0x21')]:_0x579b45['offset']+_0x579b45[_0xbbf3('0x20')];var _0x18a2d3;if(_0x3d1439>=_0x1c381e){_0x3d1439=_0x1c381e;_0x18a2d3=0xc8;}else{_0x18a2d3=0xce;}_0x1882bd[_0xbbf3('0x1c')](_0x18a2d3);return _0x1882bd[_0xbbf3('0x23')](_0xbbf3('0x24'),_0x4b20f2+'-'+_0x3d1439+'/'+_0x1c381e)[_0xbbf3('0x1e')](_0x2d0961);}return null;};}function patchUpdates(_0x5f4d09){return function(_0x5492f2){try{jsonpatch['apply'](_0x5492f2,_0x5f4d09,!![]);}catch(_0x245e59){return BPromise[_0xbbf3('0x25')](_0x245e59);}return _0x5492f2['save']();};}function saveUpdates(_0x28dc21,_0x1c4e1e){return function(_0xfdfe95){if(_0xfdfe95){return _0xfdfe95['update'](_0x28dc21)[_0xbbf3('0x26')](function(_0x183054){return _0x183054;});}return null;};}function removeEntity(_0xc951df,_0x384f60){return function(_0x4d73ef){if(_0x4d73ef){return _0x4d73ef['destroy']()[_0xbbf3('0x26')](function(){_0xc951df[_0xbbf3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b43d,_0x56e090){return function(_0x59d20d){if(!_0x59d20d){_0x16b43d[_0xbbf3('0x27')](0x194);}return _0x59d20d;};}function handleError(_0x3185e7,_0xca65dd){_0xca65dd=_0xca65dd||0x1f4;return function(_0x250e67){logger['error'](_0x250e67['stack']);if(_0x250e67['name']){delete _0x250e67[_0xbbf3('0x28')];}_0x3185e7[_0xbbf3('0x1c')](_0xca65dd)[_0xbbf3('0x29')](_0x250e67);};}exports['index']=function(_0x35897c,_0x1fac9e){var _0x76a5e2={},_0x377323={},_0x59f7ff={'count':0x0,'rows':[]};var _0x4cfefd=_[_0xbbf3('0x2a')](db['SmsTransferReport'][_0xbbf3('0x2b')],function(_0x13afa2){return{'name':_0x13afa2[_0xbbf3('0x2c')],'type':_0x13afa2[_0xbbf3('0x2d')][_0xbbf3('0x2e')]};});_0x377323[_0xbbf3('0x2f')]=_[_0xbbf3('0x2a')](_0x4cfefd,'name');_0x377323[_0xbbf3('0x30')]=_['keys'](_0x35897c[_0xbbf3('0x30')]);_0x377323['filters']=_[_0xbbf3('0x31')](_0x377323[_0xbbf3('0x2f')],_0x377323['query']);_0x76a5e2[_0xbbf3('0x32')]=_[_0xbbf3('0x31')](_0x377323[_0xbbf3('0x2f')],qs['fields'](_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x33')]));_0x76a5e2[_0xbbf3('0x32')]=_0x76a5e2[_0xbbf3('0x32')][_0xbbf3('0x34')]?_0x76a5e2[_0xbbf3('0x32')]:_0x377323[_0xbbf3('0x2f')];if(!_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x35')]('nolimit')){_0x76a5e2[_0xbbf3('0x20')]=qs[_0xbbf3('0x20')](_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x20')]);_0x76a5e2['offset']=qs[_0xbbf3('0x22')](_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x22')]);}_0x76a5e2[_0xbbf3('0x36')]=qs[_0xbbf3('0x37')](_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x37')]);_0x76a5e2[_0xbbf3('0x38')]=qs[_0xbbf3('0x39')](_[_0xbbf3('0x3a')](_0x35897c[_0xbbf3('0x30')],_0x377323[_0xbbf3('0x39')]),_0x4cfefd);if(_0x35897c[_0xbbf3('0x30')]['filter']){_0x76a5e2[_0xbbf3('0x38')]=_['merge'](_0x76a5e2['where'],{'$or':_[_0xbbf3('0x2a')](_0x4cfefd,function(_0x2b7606){if(_0x2b7606[_0xbbf3('0x2d')]!==_0xbbf3('0x3b')){var _0x3e2a02={};_0x3e2a02[_0x2b7606['name']]={'$like':'%'+_0x35897c[_0xbbf3('0x30')][_0xbbf3('0x3c')]+'%'};return _0x3e2a02;}})});}_0x76a5e2=_[_0xbbf3('0x3d')]({},_0x76a5e2,_0x35897c['options']);var _0x3b85e6={'where':_0x76a5e2[_0xbbf3('0x38')]};return db['SmsTransferReport']['count'](_0x3b85e6)[_0xbbf3('0x26')](function(_0x31cc37){_0x59f7ff['count']=_0x31cc37;if(_0x35897c[_0xbbf3('0x30')]['includeAll']){_0x76a5e2['include']=[{'all':!![]}];}return db[_0xbbf3('0x3e')][_0xbbf3('0x3f')](_0x76a5e2);})['then'](function(_0xc56c36){_0x59f7ff['rows']=_0xc56c36;return _0x59f7ff;})['then'](respondWithFilteredResult(_0x1fac9e,_0x76a5e2))[_0xbbf3('0x40')](handleError(_0x1fac9e,null));};exports[_0xbbf3('0x41')]=function(_0x31b5e0,_0x4bc32e){var _0x4ef1b6={'raw':!![],'where':{'id':_0x31b5e0[_0xbbf3('0x42')]['id']}},_0x3cf515={};_0x3cf515[_0xbbf3('0x2f')]=_['keys'](db[_0xbbf3('0x3e')][_0xbbf3('0x2b')]);_0x3cf515[_0xbbf3('0x30')]=_[_0xbbf3('0x43')](_0x31b5e0[_0xbbf3('0x30')]);_0x3cf515[_0xbbf3('0x39')]=_[_0xbbf3('0x31')](_0x3cf515['model'],_0x3cf515[_0xbbf3('0x30')]);_0x4ef1b6['attributes']=_['intersection'](_0x3cf515[_0xbbf3('0x2f')],qs[_0xbbf3('0x33')](_0x31b5e0[_0xbbf3('0x30')][_0xbbf3('0x33')]));_0x4ef1b6[_0xbbf3('0x32')]=_0x4ef1b6[_0xbbf3('0x32')][_0xbbf3('0x34')]?_0x4ef1b6[_0xbbf3('0x32')]:_0x3cf515[_0xbbf3('0x2f')];if(_0x31b5e0[_0xbbf3('0x30')][_0xbbf3('0x44')]){_0x4ef1b6['include']=[{'all':!![]}];}_0x4ef1b6=_['merge']({},_0x4ef1b6,_0x31b5e0['options']);return db[_0xbbf3('0x3e')]['find'](_0x4ef1b6)[_0xbbf3('0x26')](handleEntityNotFound(_0x4bc32e,null))[_0xbbf3('0x26')](respondWithResult(_0x4bc32e,null))['catch'](handleError(_0x4bc32e,null));};exports[_0xbbf3('0x45')]=function(_0x482812,_0x32c712){return db[_0xbbf3('0x3e')]['create'](_0x482812[_0xbbf3('0x46')],{})[_0xbbf3('0x26')](respondWithResult(_0x32c712,0xc9))[_0xbbf3('0x40')](handleError(_0x32c712,null));};exports[_0xbbf3('0x47')]=function(_0x306cce,_0x32e8c9){if(_0x306cce[_0xbbf3('0x46')]['id']){delete _0x306cce[_0xbbf3('0x46')]['id'];}return db[_0xbbf3('0x3e')][_0xbbf3('0x48')]({'where':{'id':_0x306cce[_0xbbf3('0x42')]['id']}})[_0xbbf3('0x26')](handleEntityNotFound(_0x32e8c9,null))['then'](saveUpdates(_0x306cce[_0xbbf3('0x46')],null))['then'](respondWithResult(_0x32e8c9,null))[_0xbbf3('0x40')](handleError(_0x32e8c9,null));};exports['destroy']=function(_0x16ac90,_0x40c97f){return db[_0xbbf3('0x3e')][_0xbbf3('0x48')]({'where':{'id':_0x16ac90[_0xbbf3('0x42')]['id']}})[_0xbbf3('0x26')](handleEntityNotFound(_0x40c97f,null))[_0xbbf3('0x26')](removeEntity(_0x40c97f,null))[_0xbbf3('0x40')](handleError(_0x40c97f,null));};exports['describe']=function(_0x13c665,_0x23bab5){return db[_0xbbf3('0x3e')][_0xbbf3('0x49')]()[_0xbbf3('0x26')](respondWithResult(_0x23bab5,null))[_0xbbf3('0x40')](handleError(_0x23bab5,null));}; \ No newline at end of file +var _0xba85=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','map','SmsTransferReport','rawAttributes','fieldName','type','key','keys','filters','query','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','show','params','includeAll','options','catch','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xba85,0x1ad));var _0x5ba8=function(_0x27a98d,_0x3a6752){_0x27a98d=_0x27a98d-0x0;var _0x5d9e1b=_0xba85[_0x27a98d];return _0x5d9e1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ba8('0x0'));var zipdir=require(_0x5ba8('0x1'));var jsonpatch=require(_0x5ba8('0x2'));var rp=require('request-promise');var moment=require(_0x5ba8('0x3'));var BPromise=require(_0x5ba8('0x4'));var Mustache=require(_0x5ba8('0x5'));var util=require(_0x5ba8('0x6'));var path=require(_0x5ba8('0x7'));var sox=require(_0x5ba8('0x8'));var csv=require(_0x5ba8('0x9'));var ejs=require(_0x5ba8('0xa'));var fs=require('fs');var fs_extra=require(_0x5ba8('0xb'));var _=require('lodash');var squel=require(_0x5ba8('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ba8('0xd'));var deskjs=require(_0x5ba8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5ba8('0xf'));var Papa=require(_0x5ba8('0x10'));var Redis=require(_0x5ba8('0x11'));var authService=require(_0x5ba8('0x12'));var qs=require(_0x5ba8('0x13'));var as=require(_0x5ba8('0x14'));var hardwareService=require(_0x5ba8('0x15'));var logger=require(_0x5ba8('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ba8('0x17'));var db=require(_0x5ba8('0x18'))['db'];function respondWithStatusCode(_0x357b9a,_0x203f6f){_0x203f6f=_0x203f6f||0xcc;return function(_0x2d32ec){if(_0x2d32ec){return _0x357b9a[_0x5ba8('0x19')](_0x203f6f);}return _0x357b9a[_0x5ba8('0x1a')](_0x203f6f)[_0x5ba8('0x1b')]();};}function respondWithResult(_0x555dc4,_0x47bbee){_0x47bbee=_0x47bbee||0xc8;return function(_0x7c2189){if(_0x7c2189){return _0x555dc4[_0x5ba8('0x1a')](_0x47bbee)[_0x5ba8('0x1c')](_0x7c2189);}};}function respondWithFilteredResult(_0x2be7b7,_0x29d088){return function(_0x49a78b){if(_0x49a78b){var _0x56ae4b=typeof _0x29d088[_0x5ba8('0x1d')]===_0x5ba8('0x1e')&&typeof _0x29d088[_0x5ba8('0x1f')]==='undefined';var _0x1c488e=_0x49a78b[_0x5ba8('0x20')];var _0x569db5=_0x56ae4b?0x0:_0x29d088[_0x5ba8('0x1d')];var _0x37fa07=_0x56ae4b?_0x49a78b[_0x5ba8('0x20')]:_0x29d088['offset']+_0x29d088[_0x5ba8('0x1f')];var _0x24e49d;if(_0x37fa07>=_0x1c488e){_0x37fa07=_0x1c488e;_0x24e49d=0xc8;}else{_0x24e49d=0xce;}_0x2be7b7[_0x5ba8('0x1a')](_0x24e49d);return _0x2be7b7['set']('Content-Range',_0x569db5+'-'+_0x37fa07+'/'+_0x1c488e)[_0x5ba8('0x1c')](_0x49a78b);}return null;};}function patchUpdates(_0x429c0a){return function(_0x15ac6b){try{jsonpatch[_0x5ba8('0x21')](_0x15ac6b,_0x429c0a,!![]);}catch(_0x2a2cf0){return BPromise[_0x5ba8('0x22')](_0x2a2cf0);}return _0x15ac6b[_0x5ba8('0x23')]();};}function saveUpdates(_0x46bb59,_0x5a1612){return function(_0x4d2112){if(_0x4d2112){return _0x4d2112['update'](_0x46bb59)[_0x5ba8('0x24')](function(_0x39bb61){return _0x39bb61;});}return null;};}function removeEntity(_0x230f1c,_0x27f48e){return function(_0x1587d3){if(_0x1587d3){return _0x1587d3[_0x5ba8('0x25')]()[_0x5ba8('0x24')](function(){_0x230f1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1172d8,_0x2477a2){return function(_0x57da77){if(!_0x57da77){_0x1172d8[_0x5ba8('0x19')](0x194);}return _0x57da77;};}function handleError(_0x23acb7,_0x13adef){_0x13adef=_0x13adef||0x1f4;return function(_0x5656c4){logger[_0x5ba8('0x26')](_0x5656c4[_0x5ba8('0x27')]);if(_0x5656c4['name']){delete _0x5656c4[_0x5ba8('0x28')];}_0x23acb7['status'](_0x13adef)['send'](_0x5656c4);};}exports['index']=function(_0x14686b,_0x274cf4){var _0xb1216b={},_0x581812={},_0x3d33c6={'count':0x0,'rows':[]};var _0x313259=_[_0x5ba8('0x29')](db[_0x5ba8('0x2a')][_0x5ba8('0x2b')],function(_0x487785){return{'name':_0x487785[_0x5ba8('0x2c')],'type':_0x487785[_0x5ba8('0x2d')][_0x5ba8('0x2e')]};});_0x581812['model']=_['map'](_0x313259,_0x5ba8('0x28'));_0x581812['query']=_[_0x5ba8('0x2f')](_0x14686b['query']);_0x581812[_0x5ba8('0x30')]=_['intersection'](_0x581812['model'],_0x581812[_0x5ba8('0x31')]);_0xb1216b[_0x5ba8('0x32')]=_[_0x5ba8('0x33')](_0x581812[_0x5ba8('0x34')],qs[_0x5ba8('0x35')](_0x14686b[_0x5ba8('0x31')][_0x5ba8('0x35')]));_0xb1216b[_0x5ba8('0x32')]=_0xb1216b[_0x5ba8('0x32')][_0x5ba8('0x36')]?_0xb1216b['attributes']:_0x581812[_0x5ba8('0x34')];if(!_0x14686b['query']['hasOwnProperty'](_0x5ba8('0x37'))){_0xb1216b[_0x5ba8('0x1f')]=qs[_0x5ba8('0x1f')](_0x14686b[_0x5ba8('0x31')]['limit']);_0xb1216b[_0x5ba8('0x1d')]=qs[_0x5ba8('0x1d')](_0x14686b[_0x5ba8('0x31')]['offset']);}_0xb1216b[_0x5ba8('0x38')]=qs[_0x5ba8('0x39')](_0x14686b['query']['sort']);_0xb1216b[_0x5ba8('0x3a')]=qs[_0x5ba8('0x30')](_[_0x5ba8('0x3b')](_0x14686b[_0x5ba8('0x31')],_0x581812[_0x5ba8('0x30')]),_0x313259);if(_0x14686b[_0x5ba8('0x31')][_0x5ba8('0x3c')]){_0xb1216b[_0x5ba8('0x3a')]=_['merge'](_0xb1216b[_0x5ba8('0x3a')],{'$or':_[_0x5ba8('0x29')](_0x313259,function(_0x5777c3){if(_0x5777c3[_0x5ba8('0x2d')]!==_0x5ba8('0x3d')){var _0x32228f={};_0x32228f[_0x5777c3['name']]={'$like':'%'+_0x14686b[_0x5ba8('0x31')][_0x5ba8('0x3c')]+'%'};return _0x32228f;}})});}_0xb1216b=_[_0x5ba8('0x3e')]({},_0xb1216b,_0x14686b['options']);var _0x200f34={'where':_0xb1216b['where']};return db[_0x5ba8('0x2a')][_0x5ba8('0x20')](_0x200f34)[_0x5ba8('0x24')](function(_0x13e730){_0x3d33c6[_0x5ba8('0x20')]=_0x13e730;if(_0x14686b[_0x5ba8('0x31')]['includeAll']){_0xb1216b[_0x5ba8('0x3f')]=[{'all':!![]}];}return db[_0x5ba8('0x2a')][_0x5ba8('0x40')](_0xb1216b);})[_0x5ba8('0x24')](function(_0x37a6e4){_0x3d33c6['rows']=_0x37a6e4;return _0x3d33c6;})['then'](respondWithFilteredResult(_0x274cf4,_0xb1216b))['catch'](handleError(_0x274cf4,null));};exports[_0x5ba8('0x41')]=function(_0x36ea83,_0xbbe128){var _0xa35bfe={'raw':!![],'where':{'id':_0x36ea83[_0x5ba8('0x42')]['id']}},_0x4f5bc6={};_0x4f5bc6[_0x5ba8('0x34')]=_['keys'](db[_0x5ba8('0x2a')][_0x5ba8('0x2b')]);_0x4f5bc6[_0x5ba8('0x31')]=_[_0x5ba8('0x2f')](_0x36ea83[_0x5ba8('0x31')]);_0x4f5bc6[_0x5ba8('0x30')]=_[_0x5ba8('0x33')](_0x4f5bc6[_0x5ba8('0x34')],_0x4f5bc6[_0x5ba8('0x31')]);_0xa35bfe['attributes']=_[_0x5ba8('0x33')](_0x4f5bc6['model'],qs[_0x5ba8('0x35')](_0x36ea83[_0x5ba8('0x31')][_0x5ba8('0x35')]));_0xa35bfe[_0x5ba8('0x32')]=_0xa35bfe[_0x5ba8('0x32')][_0x5ba8('0x36')]?_0xa35bfe[_0x5ba8('0x32')]:_0x4f5bc6[_0x5ba8('0x34')];if(_0x36ea83[_0x5ba8('0x31')][_0x5ba8('0x43')]){_0xa35bfe['include']=[{'all':!![]}];}_0xa35bfe=_[_0x5ba8('0x3e')]({},_0xa35bfe,_0x36ea83[_0x5ba8('0x44')]);return db[_0x5ba8('0x2a')]['find'](_0xa35bfe)[_0x5ba8('0x24')](handleEntityNotFound(_0xbbe128,null))[_0x5ba8('0x24')](respondWithResult(_0xbbe128,null))[_0x5ba8('0x45')](handleError(_0xbbe128,null));};exports[_0x5ba8('0x46')]=function(_0x599cb0,_0x3fcaff){return db[_0x5ba8('0x2a')][_0x5ba8('0x46')](_0x599cb0[_0x5ba8('0x47')],{})[_0x5ba8('0x24')](respondWithResult(_0x3fcaff,0xc9))['catch'](handleError(_0x3fcaff,null));};exports[_0x5ba8('0x48')]=function(_0x39d5c7,_0x153846){if(_0x39d5c7[_0x5ba8('0x47')]['id']){delete _0x39d5c7[_0x5ba8('0x47')]['id'];}return db[_0x5ba8('0x2a')][_0x5ba8('0x49')]({'where':{'id':_0x39d5c7[_0x5ba8('0x42')]['id']}})['then'](handleEntityNotFound(_0x153846,null))[_0x5ba8('0x24')](saveUpdates(_0x39d5c7[_0x5ba8('0x47')],null))[_0x5ba8('0x24')](respondWithResult(_0x153846,null))[_0x5ba8('0x45')](handleError(_0x153846,null));};exports[_0x5ba8('0x25')]=function(_0x33151d,_0x2e02eb){return db[_0x5ba8('0x2a')][_0x5ba8('0x49')]({'where':{'id':_0x33151d[_0x5ba8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e02eb,null))['then'](removeEntity(_0x2e02eb,null))[_0x5ba8('0x45')](handleError(_0x2e02eb,null));};exports['describe']=function(_0x3814ae,_0xc26f74){return db['SmsTransferReport'][_0x5ba8('0x4a')]()['then'](respondWithResult(_0xc26f74,null))[_0x5ba8('0x45')](handleError(_0xc26f74,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 491ad71..abe9c96 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 _0x80ea=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x5f3863,_0x341deb){var _0x294f67=function(_0x587448){while(--_0x587448){_0x5f3863['push'](_0x5f3863['shift']());}};_0x294f67(++_0x341deb);}(_0x80ea,0x15c));var _0xa80e=function(_0x15751f,_0x3cb778){_0x15751f=_0x15751f-0x0;var _0xdb1cbd=_0x80ea[_0x15751f];return _0xdb1cbd;};'use strict';var _=require(_0xa80e('0x0'));var util=require(_0xa80e('0x1'));var logger=require(_0xa80e('0x2'))(_0xa80e('0x3'));var moment=require(_0xa80e('0x4'));var BPromise=require(_0xa80e('0x5'));var rp=require(_0xa80e('0x6'));var fs=require('fs');var path=require(_0xa80e('0x7'));var rimraf=require(_0xa80e('0x8'));var config=require(_0xa80e('0x9'));var attributes=require(_0xa80e('0xa'));module[_0xa80e('0xb')]=function(_0x2b3c6f,_0x39a910){return _0x2b3c6f['define'](_0xa80e('0xc'),attributes,{'tableName':_0xa80e('0xd'),'paranoid':![],'indexes':[{'name':_0xa80e('0xe'),'fields':[_0xa80e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5127=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3be6b3,_0x10beb4){var _0x2ca5a7=function(_0x202b09){while(--_0x202b09){_0x3be6b3['push'](_0x3be6b3['shift']());}};_0x2ca5a7(++_0x10beb4);}(_0x5127,0x64));var _0x7512=function(_0x4b13f0,_0x1273df){_0x4b13f0=_0x4b13f0-0x0;var _0x2a1955=_0x5127[_0x4b13f0];return _0x2a1955;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require(_0x7512('0x4'));var rp=require(_0x7512('0x5'));var fs=require('fs');var path=require(_0x7512('0x6'));var rimraf=require('rimraf');var config=require(_0x7512('0x7'));var attributes=require(_0x7512('0x8'));module[_0x7512('0x9')]=function(_0x157c99,_0x3140b3){return _0x157c99['define'](_0x7512('0xa'),attributes,{'tableName':_0x7512('0xb'),'paranoid':![],'indexes':[{'name':_0x7512('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3af5935..35e8304 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 _0x740a=['../../config/utils','rpc','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e99c1,_0x577c8e){var _0x5da8ea=function(_0x338f0e){while(--_0x338f0e){_0x4e99c1['push'](_0x4e99c1['shift']());}};_0x5da8ea(++_0x577c8e);}(_0x740a,0x175));var _0xa740=function(_0x413495,_0x201bf9){_0x413495=_0x413495-0x0;var _0x5466ba=_0x740a[_0x413495];return _0x5466ba;};'use strict';var _=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var moment=require(_0xa740('0x2'));var BPromise=require(_0xa740('0x3'));var rs=require(_0xa740('0x4'));var fs=require('fs');var Redis=require(_0xa740('0x5'));var db=require(_0xa740('0x6'))['db'];var utils=require(_0xa740('0x7'));var logger=require('../../config/logger')(_0xa740('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa740('0x9')][_0xa740('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1858d7,_0x29c7bc,_0x356379){return new BPromise(function(_0x74b3cd,_0x2d12ee){return client['request'](_0x1858d7,_0x356379)[_0xa740('0xb')](function(_0x28206e){logger[_0xa740('0xc')](_0xa740('0xd'),_0x29c7bc,_0xa740('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x29c7bc,'request\x20sent',JSON['stringify'](_0x28206e));if(_0x28206e[_0xa740('0xf')]){if(_0x28206e[_0xa740('0xf')][_0xa740('0x10')]===0x1f4){logger[_0xa740('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x29c7bc,_0x28206e['error']['message']);return _0x2d12ee(_0x28206e[_0xa740('0xf')][_0xa740('0x11')]);}logger[_0xa740('0xf')](_0xa740('0xd'),_0x29c7bc,_0x28206e[_0xa740('0xf')][_0xa740('0x11')]);return _0x74b3cd(_0x28206e[_0xa740('0xf')][_0xa740('0x11')]);}else{logger[_0xa740('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x29c7bc,'request\x20sent');_0x74b3cd(_0x28206e[_0xa740('0x12')]['message']);}})[_0xa740('0x13')](function(_0x455d33){logger[_0xa740('0xf')](_0xa740('0xd'),_0x29c7bc,_0x455d33);_0x2d12ee(_0x455d33);});});} \ No newline at end of file +var _0xf569=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x4bd5ed,_0x1e332c){var _0x40f7a5=function(_0x5bbb01){while(--_0x5bbb01){_0x4bd5ed['push'](_0x4bd5ed['shift']());}};_0x40f7a5(++_0x1e332c);}(_0xf569,0xd0));var _0x9f56=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf569[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require(_0x9f56('0x7'))('rpc');var config=require(_0x9f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e5f,_0x1bcede,_0x73c3b4){return new BPromise(function(_0x5980f2,_0x46fd92){return client[_0x9f56('0xb')](_0x5c5e5f,_0x73c3b4)[_0x9f56('0xc')](function(_0x4f398b){logger['info'](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));logger['debug'](_0x9f56('0xf'),_0x1bcede,_0x9f56('0xe'),JSON[_0x9f56('0x10')](_0x4f398b));if(_0x4f398b['error']){if(_0x4f398b['error'][_0x9f56('0x11')]===0x1f4){logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b['error']['message']);return _0x46fd92(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);return _0x5980f2(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}else{logger[_0x9f56('0x14')](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));_0x5980f2(_0x4f398b[_0x9f56('0x15')][_0x9f56('0x13')]);}})[_0x9f56('0x16')](function(_0x13ebfa){logger[_0x9f56('0x12')](_0x9f56('0xd'),_0x1bcede,_0x13ebfa);_0x46fd92(_0x13ebfa);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3045073..0b30ad9 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 _0xee1d=['delete','util','express','fs-extra','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','single','put','update'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xee1d,0x114));var _0xdee1=function(_0x49674d,_0x1ae7e9){_0x49674d=_0x49674d-0x0;var _0x181cf9=_0xee1d[_0x49674d];return _0x181cf9;};'use strict';var multer=require('multer');var util=require(_0xdee1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdee1('0x1'));var router=express['Router']();var fs_extra=require(_0xdee1('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdee1('0x3'));var controller=require(_0xdee1('0x4'));router[_0xdee1('0x5')]('/',auth[_0xdee1('0x6')](),controller[_0xdee1('0x7')]);router[_0xdee1('0x5')](_0xdee1('0x8'),auth[_0xdee1('0x6')](),controller[_0xdee1('0x9')]);router[_0xdee1('0x5')](_0xdee1('0xa'),auth[_0xdee1('0x6')](),controller['download']);var upload=multer({'storage':multer[_0xdee1('0xb')]({'destination':function(_0x4f412c,_0x5a4294,_0x2376bc){_0x2376bc(null,path[_0xdee1('0xc')](config[_0xdee1('0xd')],_0xdee1('0xe')));},'filename':function(_0x516792,_0x568836,_0x1af4b0){_0x568836[_0xdee1('0xf')]=_0x568836['originalname'][_0xdee1('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1af4b0(null,util['format'](_0xdee1('0x11'),path[_0xdee1('0x12')](_0x568836[_0xdee1('0xf')],path[_0xdee1('0x13')](_0x568836['originalname'])),Date[_0xdee1('0x14')](),path[_0xdee1('0x13')](_0x568836['originalname'])));}})});router['post']('/',upload[_0xdee1('0x15')]('file'),controller['create']);router[_0xdee1('0x16')](_0xdee1('0x8'),auth[_0xdee1('0x6')](),controller[_0xdee1('0x17')]);router[_0xdee1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xdee1('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc730=['../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','now','extname','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x327a0f,_0x2a071e){var _0x5874f4=function(_0x3a9701){while(--_0x3a9701){_0x327a0f['push'](_0x327a0f['shift']());}};_0x5874f4(++_0x2a071e);}(_0xc730,0xba));var _0x0c73=function(_0x2f9c8a,_0x276157){_0x2f9c8a=_0x2f9c8a-0x0;var _0x3ccf0e=_0xc730[_0x2f9c8a];return _0x3ccf0e;};'use strict';var multer=require(_0x0c73('0x0'));var util=require(_0x0c73('0x1'));var path=require(_0x0c73('0x2'));var timeout=require(_0x0c73('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c73('0x4'));var auth=require(_0x0c73('0x5'));var interaction=require(_0x0c73('0x6'));var config=require('../../config/environment');var controller=require(_0x0c73('0x7'));router[_0x0c73('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c73('0x9')]);router[_0x0c73('0x8')](_0x0c73('0xa'),auth[_0x0c73('0xb')](),controller[_0x0c73('0xc')]);router[_0x0c73('0x8')](_0x0c73('0xd'),auth[_0x0c73('0xb')](),controller[_0x0c73('0xe')]);var upload=multer({'storage':multer[_0x0c73('0xf')]({'destination':function(_0x518552,_0x104c30,_0x3b908c){_0x3b908c(null,path[_0x0c73('0x10')](config[_0x0c73('0x11')],_0x0c73('0x12')));},'filename':function(_0x685195,_0x1b4711,_0x3f899e){_0x1b4711[_0x0c73('0x13')]=_0x1b4711['originalname'][_0x0c73('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f899e(null,util[_0x0c73('0x15')]('%s-%s%s',path[_0x0c73('0x16')](_0x1b4711[_0x0c73('0x13')],path['extname'](_0x1b4711['originalname'])),Date[_0x0c73('0x17')](),path[_0x0c73('0x18')](_0x1b4711[_0x0c73('0x13')])));}})});router['post']('/',upload[_0x0c73('0x19')](_0x0c73('0x1a')),controller[_0x0c73('0x1b')]);router[_0x0c73('0x1c')](_0x0c73('0xa'),auth[_0x0c73('0xb')](),controller[_0x0c73('0x1d')]);router[_0x0c73('0x1e')](_0x0c73('0xa'),auth[_0x0c73('0xb')](),controller[_0x0c73('0x1e')]);module[_0x0c73('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 564e77f..59313ee 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 _0xace9=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0xd1a7ca,_0x223558){var _0x4ed042=function(_0x463b6b){while(--_0x463b6b){_0xd1a7ca['push'](_0xd1a7ca['shift']());}};_0x4ed042(++_0x223558);}(_0xace9,0x164));var _0x9ace=function(_0x488681,_0x2b0715){_0x488681=_0x488681-0x0;var _0x4b0804=_0xace9[_0x488681];return _0x4b0804;};'use strict';var Sequelize=require('sequelize');module[_0x9ace('0x0')]={'name':{'type':Sequelize[_0x9ace('0x1')],'unique':_0x9ace('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9ace('0x1')]},'display_name':{'type':Sequelize[_0x9ace('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9ace('0x1')]},'original_duration':{'type':Sequelize[_0x9ace('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9ace('0x4')]},'original_channelCount':{'type':Sequelize[_0x9ace('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x9ace('0x1')]},'converted_duration':{'type':Sequelize[_0x9ace('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x9ace('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9ace('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6124=['exports','STRING','name','BIGINT','INTEGER','sequelize'];(function(_0x5067af,_0x1b91bc){var _0x46dccf=function(_0x4c3e64){while(--_0x4c3e64){_0x5067af['push'](_0x5067af['shift']());}};_0x46dccf(++_0x1b91bc);}(_0x6124,0x119));var _0x4612=function(_0x42f989,_0x1254e4){_0x42f989=_0x42f989-0x0;var _0x2876b2=_0x6124[_0x42f989];return _0x2876b2;};'use strict';var Sequelize=require(_0x4612('0x0'));module[_0x4612('0x1')]={'name':{'type':Sequelize[_0x4612('0x2')],'unique':_0x4612('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4612('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4612('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4612('0x4')]},'original_sampleRate':{'type':Sequelize[_0x4612('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4612('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4612('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4612('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 754cf08..22d3030 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 _0x4705=['send','Sound','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params','include','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','basename','file','extname','originalname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','end','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','autoAssociation','description','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x4705,0xc7));var _0x5470=function(_0x48d892,_0x1ac4e0){_0x48d892=_0x48d892-0x0;var _0x2b07c3=_0x4705[_0x48d892];return _0x2b07c3;};'use strict';var emlformat=require(_0x5470('0x0'));var rimraf=require(_0x5470('0x1'));var zipdir=require(_0x5470('0x2'));var jsonpatch=require(_0x5470('0x3'));var rp=require(_0x5470('0x4'));var moment=require('moment');var BPromise=require(_0x5470('0x5'));var Mustache=require('mustache');var util=require(_0x5470('0x6'));var path=require(_0x5470('0x7'));var sox=require(_0x5470('0x8'));var csv=require(_0x5470('0x9'));var ejs=require(_0x5470('0xa'));var fs=require('fs');var fs_extra=require(_0x5470('0xb'));var _=require(_0x5470('0xc'));var squel=require('squel');var crypto=require(_0x5470('0xd'));var jsforce=require(_0x5470('0xe'));var deskjs=require(_0x5470('0xf'));var toCsv=require(_0x5470('0x9'));var querystring=require(_0x5470('0x10'));var Papa=require('papaparse');var Redis=require(_0x5470('0x11'));var authService=require(_0x5470('0x12'));var qs=require(_0x5470('0x13'));var as=require(_0x5470('0x14'));var hardwareService=require(_0x5470('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5470('0x16'));var db=require(_0x5470('0x17'))['db'];function respondWithStatusCode(_0x51223d,_0x4a80b5){_0x4a80b5=_0x4a80b5||0xcc;return function(_0xb0cd5f){if(_0xb0cd5f){return _0x51223d['sendStatus'](_0x4a80b5);}return _0x51223d[_0x5470('0x18')](_0x4a80b5)['end']();};}function respondWithResult(_0x228d12,_0x3549c2){_0x3549c2=_0x3549c2||0xc8;return function(_0x411342){if(_0x411342){return _0x228d12[_0x5470('0x18')](_0x3549c2)[_0x5470('0x19')](_0x411342);}};}function respondWithFilteredResult(_0x5f38ce,_0x146763){return function(_0x105166){if(_0x105166){var _0x1f3c12=typeof _0x146763['offset']===_0x5470('0x1a')&&typeof _0x146763[_0x5470('0x1b')]===_0x5470('0x1a');var _0x247fe1=_0x105166['count'];var _0xc665d7=_0x1f3c12?0x0:_0x146763[_0x5470('0x1c')];var _0x95718d=_0x1f3c12?_0x105166[_0x5470('0x1d')]:_0x146763['offset']+_0x146763[_0x5470('0x1b')];var _0x3662e1;if(_0x95718d>=_0x247fe1){_0x95718d=_0x247fe1;_0x3662e1=0xc8;}else{_0x3662e1=0xce;}_0x5f38ce['status'](_0x3662e1);return _0x5f38ce[_0x5470('0x1e')](_0x5470('0x1f'),_0xc665d7+'-'+_0x95718d+'/'+_0x247fe1)[_0x5470('0x19')](_0x105166);}return null;};}function patchUpdates(_0x3cac45){return function(_0xe4cfb0){try{jsonpatch['apply'](_0xe4cfb0,_0x3cac45,!![]);}catch(_0xdae04c){return BPromise['reject'](_0xdae04c);}return _0xe4cfb0['save']();};}function saveUpdates(_0x91a4e2,_0x16f433){return function(_0x7c48f3){if(_0x7c48f3){return _0x7c48f3[_0x5470('0x20')](_0x91a4e2)[_0x5470('0x21')](function(_0xecbb00){return _0xecbb00;});}return null;};}function removeEntity(_0x56ebdb,_0x495c83){return function(_0xa8deeb){if(_0xa8deeb){return _0xa8deeb[_0x5470('0x22')]()[_0x5470('0x21')](function(){var _0x8ff380=_0xa8deeb[_0x5470('0x23')]({'plain':!![]});var _0x5a711a='Sounds';return db[_0x5470('0x24')][_0x5470('0x22')]({'where':{'type':_0x5a711a,'resourceId':_0x8ff380['id']}})[_0x5470('0x21')](function(){return _0xa8deeb;});})['then'](function(){_0x56ebdb[_0x5470('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b69d,_0x5738fc){return function(_0x2e45b4){if(!_0x2e45b4){_0x37b69d[_0x5470('0x25')](0x194);}return _0x2e45b4;};}function handleError(_0x3a6eb3,_0x133567){_0x133567=_0x133567||0x1f4;return function(_0x1c8b0b){logger[_0x5470('0x26')](_0x1c8b0b[_0x5470('0x27')]);if(_0x1c8b0b[_0x5470('0x28')]){delete _0x1c8b0b[_0x5470('0x28')];}_0x3a6eb3[_0x5470('0x18')](_0x133567)[_0x5470('0x29')](_0x1c8b0b);};}exports['index']=function(_0x5216b3,_0x1f57ca){var _0x4de57f={},_0x311ab0={},_0x1fecdb={'count':0x0,'rows':[]};var _0x5f1fab=_['map'](db[_0x5470('0x2a')][_0x5470('0x2b')],function(_0x2b365e){return{'name':_0x2b365e[_0x5470('0x2c')],'type':_0x2b365e[_0x5470('0x2d')][_0x5470('0x2e')]};});_0x311ab0['model']=_[_0x5470('0x2f')](_0x5f1fab,_0x5470('0x28'));_0x311ab0[_0x5470('0x30')]=_[_0x5470('0x31')](_0x5216b3['query']);_0x311ab0[_0x5470('0x32')]=_[_0x5470('0x33')](_0x311ab0[_0x5470('0x34')],_0x311ab0['query']);_0x4de57f[_0x5470('0x35')]=_[_0x5470('0x33')](_0x311ab0[_0x5470('0x34')],qs[_0x5470('0x36')](_0x5216b3[_0x5470('0x30')][_0x5470('0x36')]));_0x4de57f[_0x5470('0x35')]=_0x4de57f['attributes'][_0x5470('0x37')]?_0x4de57f[_0x5470('0x35')]:_0x311ab0[_0x5470('0x34')];if(!_0x5216b3['query'][_0x5470('0x38')](_0x5470('0x39'))){_0x4de57f[_0x5470('0x1b')]=qs[_0x5470('0x1b')](_0x5216b3[_0x5470('0x30')][_0x5470('0x1b')]);_0x4de57f[_0x5470('0x1c')]=qs[_0x5470('0x1c')](_0x5216b3[_0x5470('0x30')]['offset']);}_0x4de57f[_0x5470('0x3a')]=qs[_0x5470('0x3b')](_0x5216b3['query'][_0x5470('0x3b')]);_0x4de57f['where']=qs[_0x5470('0x32')](_[_0x5470('0x3c')](_0x5216b3[_0x5470('0x30')],_0x311ab0['filters']),_0x5f1fab);if(_0x5216b3['query'][_0x5470('0x3d')]){_0x4de57f[_0x5470('0x3e')]=_['merge'](_0x4de57f[_0x5470('0x3e')],{'$or':_['map'](_0x5f1fab,function(_0x37371c){if(_0x37371c[_0x5470('0x2d')]!=='VIRTUAL'){var _0x52a66c={};_0x52a66c[_0x37371c[_0x5470('0x28')]]={'$like':'%'+_0x5216b3[_0x5470('0x30')]['filter']+'%'};return _0x52a66c;}})});}_0x4de57f=_[_0x5470('0x3f')]({},_0x4de57f,_0x5216b3[_0x5470('0x40')]);var _0x3e0650={'where':_0x4de57f['where']};return db[_0x5470('0x2a')][_0x5470('0x1d')](_0x3e0650)[_0x5470('0x21')](function(_0x836ace){_0x1fecdb[_0x5470('0x1d')]=_0x836ace;if(_0x5216b3[_0x5470('0x30')][_0x5470('0x41')]){_0x4de57f['include']=[{'all':!![]}];}return db[_0x5470('0x2a')][_0x5470('0x42')](_0x4de57f);})[_0x5470('0x21')](function(_0x35f248){_0x1fecdb[_0x5470('0x43')]=_0x35f248;return _0x1fecdb;})[_0x5470('0x21')](respondWithFilteredResult(_0x1f57ca,_0x4de57f))[_0x5470('0x44')](handleError(_0x1f57ca,null));};exports['show']=function(_0x4345c6,_0x39528a){var _0x712597={'raw':!![],'where':{'id':_0x4345c6[_0x5470('0x45')]['id']}},_0xcd70e4={};_0xcd70e4[_0x5470('0x34')]=_[_0x5470('0x31')](db[_0x5470('0x2a')]['rawAttributes']);_0xcd70e4['query']=_[_0x5470('0x31')](_0x4345c6[_0x5470('0x30')]);_0xcd70e4[_0x5470('0x32')]=_[_0x5470('0x33')](_0xcd70e4[_0x5470('0x34')],_0xcd70e4[_0x5470('0x30')]);_0x712597[_0x5470('0x35')]=_['intersection'](_0xcd70e4[_0x5470('0x34')],qs[_0x5470('0x36')](_0x4345c6[_0x5470('0x30')][_0x5470('0x36')]));_0x712597[_0x5470('0x35')]=_0x712597[_0x5470('0x35')]['length']?_0x712597[_0x5470('0x35')]:_0xcd70e4['model'];if(_0x4345c6['query']['includeAll']){_0x712597[_0x5470('0x46')]=[{'all':!![]}];}_0x712597=_[_0x5470('0x3f')]({},_0x712597,_0x4345c6[_0x5470('0x40')]);return db[_0x5470('0x2a')][_0x5470('0x47')](_0x712597)[_0x5470('0x21')](handleEntityNotFound(_0x39528a,null))[_0x5470('0x21')](respondWithResult(_0x39528a,null))[_0x5470('0x44')](handleError(_0x39528a,null));};exports[_0x5470('0x48')]=function(_0x2d6eaf,_0x556870,_0x3617b1){return db['Sound'][_0x5470('0x47')]({'where':{'id':_0x2d6eaf[_0x5470('0x45')]['id']},'attributes':[_0x5470('0x28'),_0x5470('0x49'),_0x5470('0x4a')],'raw':!![]})[_0x5470('0x21')](handleEntityNotFound(_0x556870,null))[_0x5470('0x21')](function(_0x2bdcd2){if(_0x2bdcd2){if(!fs['existsSync'](path[_0x5470('0x4b')](config[_0x5470('0x4c')],_0x5470('0x4d'),_0x2bdcd2[_0x5470('0x49')]+'.'+_0x2bdcd2['converted_format']))){throw new db[(_0x5470('0x4e'))][(_0x5470('0x4f'))]('Sound\x20not\x20found');}return _0x556870['download'](path[_0x5470('0x4b')](config['root'],_0x5470('0x4d'),util[_0x5470('0x50')](_0x5470('0x51'),_0x2bdcd2[_0x5470('0x49')],_0x2bdcd2[_0x5470('0x4a')])),util['format']('%s.%s',_0x2bdcd2[_0x5470('0x28')],_0x2bdcd2['converted_format']));}return null;})[_0x5470('0x44')](handleError(_0x556870,null));};exports[_0x5470('0x52')]=function(_0x408f85,_0x42f2a1,_0x133b5a){var _0x24552b={'name':path[_0x5470('0x53')](_0x408f85[_0x5470('0x54')]['originalname'],path[_0x5470('0x55')](_0x408f85[_0x5470('0x54')][_0x5470('0x56')])),'save_name':path[_0x5470('0x53')](_0x408f85[_0x5470('0x54')][_0x5470('0x57')],path['extname'](_0x408f85['file']['filename'])),'original_format':path[_0x5470('0x55')](_0x408f85['file'][_0x5470('0x56')])[_0x5470('0x58')](0x1),'converted_format':'wav'};var _0x1cb4af=path[_0x5470('0x4b')](config[_0x5470('0x4c')],_0x5470('0x59'),_0x408f85[_0x5470('0x54')][_0x5470('0x57')]);var _0x19a1a2=path[_0x5470('0x4b')](config[_0x5470('0x4c')],'server/files/sounds/converted',util[_0x5470('0x50')](_0x5470('0x51'),path[_0x5470('0x53')](_0x408f85[_0x5470('0x54')][_0x5470('0x57')],path[_0x5470('0x55')](_0x408f85['file']['filename'])),_0x24552b['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x1cb4af);logger[_0x5470('0x5a')](_0x5470('0x5b'),_0x19a1a2);try{fs['chmodSync'](_0x1cb4af,parseInt(_0x5470('0x5c'),0x8));var _0x291aec=sox[_0x5470('0x5d')](_0x1cb4af,_0x19a1a2,{'sampleRate':0x1f40,'format':_0x5470('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x291aec['on']('error',function(_0x449022){fs['unlinkSync'](_0x1cb4af);_0x42f2a1[_0x5470('0x18')](0x1f4)[_0x5470('0x29')](_0x449022);});_0x291aec['on'](_0x5470('0x5f'),function(_0x31e717){_0x24552b[_0x5470('0x60')]=isNaN(_0x31e717[_0x5470('0x61')])?null:_0x31e717[_0x5470('0x61')]*0x3e8;_0x24552b['original_sampleCount']=isNaN(_0x31e717['sampleCount'])?null:_0x31e717[_0x5470('0x62')];_0x24552b[_0x5470('0x63')]=isNaN(_0x31e717[_0x5470('0x64')])?null:_0x31e717[_0x5470('0x64')];_0x24552b[_0x5470('0x65')]=isNaN(_0x31e717[_0x5470('0x66')])?null:_0x31e717[_0x5470('0x66')];_0x24552b['original_sampleRate']=isNaN(_0x31e717['sampleRate'])?null:_0x31e717[_0x5470('0x67')];});_0x291aec['on'](_0x5470('0x68'),function(_0x4125ac){_0x24552b['converted_duration']=isNaN(_0x4125ac['duration'])?null:_0x4125ac[_0x5470('0x61')]*0x3e8;_0x24552b['converted_sampleCount']=isNaN(_0x4125ac['sampleCount'])?null:_0x4125ac[_0x5470('0x62')];_0x24552b[_0x5470('0x69')]=isNaN(_0x4125ac[_0x5470('0x64')])?null:_0x4125ac[_0x5470('0x64')];_0x24552b[_0x5470('0x6a')]=isNaN(_0x4125ac[_0x5470('0x66')])?null:_0x4125ac[_0x5470('0x66')];_0x24552b[_0x5470('0x6b')]=isNaN(_0x4125ac[_0x5470('0x67')])?null:_0x4125ac[_0x5470('0x67')];});_0x291aec['on'](_0x5470('0x6c'),function(){fs[_0x5470('0x6d')](_0x19a1a2,parseInt('0777',0x8));return db[_0x5470('0x2a')]['create'](_0x24552b)['then'](function(_0x5b94f6){var _0x2fea39={'role':_0x408f85[_0x5470('0x6e')][_0x5470('0x6f')],'userProfileId':_0x408f85[_0x5470('0x6e')][_0x5470('0x70')]};if(!_0x2fea39)throw new Error(_0x5470('0x71'));if(_0x2fea39['role']==='user'){var _0x332f81=_0x5b94f6[_0x5470('0x23')]({'plain':!![]});return db[_0x5470('0x72')][_0x5470('0x47')]({'where':{'name':_0x5470('0x73'),'userProfileId':_0x2fea39[_0x5470('0x70')]},'raw':!![]})[_0x5470('0x21')](function(_0x383d04){if(_0x383d04&&_0x383d04[_0x5470('0x74')]===0x0){return db[_0x5470('0x24')][_0x5470('0x52')]({'name':_0x332f81['name'],'resourceId':_0x332f81['id'],'type':_0x383d04[_0x5470('0x28')],'sectionId':_0x383d04['id']},{})['then'](function(){return _0x5b94f6;});}else{return _0x5b94f6;}})[_0x5470('0x44')](function(_0x4eef8d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4eef8d);throw _0x4eef8d;});}return _0x5b94f6;})[_0x5470('0x21')](respondWithResult(_0x42f2a1,null))[_0x5470('0x44')](handleError(_0x42f2a1,null));});_0x291aec['start']();}catch(_0x4e0a50){_0x42f2a1[_0x5470('0x18')](0x1f4)[_0x5470('0x29')](_0x4e0a50);}};exports['update']=function(_0x20da71,_0x30b8c7,_0x3b7443){return db[_0x5470('0x2a')][_0x5470('0x47')]({'where':{'id':_0x20da71[_0x5470('0x45')]['id']}})[_0x5470('0x21')](handleEntityNotFound(_0x30b8c7,null))[_0x5470('0x21')](saveUpdates(_[_0x5470('0x3c')](_0x20da71[_0x5470('0x6e')],[_0x5470('0x28'),_0x5470('0x75')]),null))['then'](respondWithResult(_0x30b8c7,null))['catch'](handleError(_0x30b8c7,null));};exports['delete']=function(_0x2c24b7,_0x27af71,_0x5be222){return db[_0x5470('0x2a')]['find']({'where':{'id':_0x2c24b7[_0x5470('0x45')]['id']}})[_0x5470('0x21')](function(_0x89522f){if(_0x89522f){return _0x89522f[_0x5470('0x22')]();}})[_0x5470('0x21')](function(_0x3fa513){var _0x3296f7=path['join'](config[_0x5470('0x4c')],_0x5470('0x59'),util[_0x5470('0x50')](_0x5470('0x51'),_0x3fa513[_0x5470('0x49')],_0x3fa513[_0x5470('0x76')]));var _0x260d06=path[_0x5470('0x4b')](config['root'],_0x5470('0x4d'),util[_0x5470('0x50')](_0x5470('0x51'),_0x3fa513[_0x5470('0x49')],_0x3fa513[_0x5470('0x4a')]));fs[_0x5470('0x77')](_0x3296f7);fs[_0x5470('0x77')](_0x260d06);return _0x3fa513;})[_0x5470('0x21')](function(_0x4c2958){if(_0x4c2958){return _0x27af71[_0x5470('0x18')](0xcc)[_0x5470('0x6c')]();}})[_0x5470('0x21')](handleEntityNotFound(_0x27af71,null))[_0x5470('0x44')](handleError(_0x27af71,null));}; \ No newline at end of file +var _0xcaa4=['where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','rawAttributes','find','params','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','chmodSync','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','sendStatus','error','stack','name','send','index','map','Sound','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5ca72f,_0xccbe4e){var _0x406089=function(_0x3589d8){while(--_0x3589d8){_0x5ca72f['push'](_0x5ca72f['shift']());}};_0x406089(++_0xccbe4e);}(_0xcaa4,0x141));var _0x4caa=function(_0x37c2f8,_0x296e97){_0x37c2f8=_0x37c2f8-0x0;var _0x536f95=_0xcaa4[_0x37c2f8];return _0x536f95;};'use strict';var emlformat=require(_0x4caa('0x0'));var rimraf=require(_0x4caa('0x1'));var zipdir=require(_0x4caa('0x2'));var jsonpatch=require(_0x4caa('0x3'));var rp=require(_0x4caa('0x4'));var moment=require('moment');var BPromise=require(_0x4caa('0x5'));var Mustache=require(_0x4caa('0x6'));var util=require(_0x4caa('0x7'));var path=require(_0x4caa('0x8'));var sox=require(_0x4caa('0x9'));var csv=require(_0x4caa('0xa'));var ejs=require(_0x4caa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4caa('0xc'));var squel=require('squel');var crypto=require(_0x4caa('0xd'));var jsforce=require(_0x4caa('0xe'));var deskjs=require(_0x4caa('0xf'));var toCsv=require(_0x4caa('0xa'));var querystring=require(_0x4caa('0x10'));var Papa=require(_0x4caa('0x11'));var Redis=require('ioredis');var authService=require(_0x4caa('0x12'));var qs=require(_0x4caa('0x13'));var as=require(_0x4caa('0x14'));var hardwareService=require(_0x4caa('0x15'));var logger=require(_0x4caa('0x16'))(_0x4caa('0x17'));var utils=require('../../config/utils');var config=require(_0x4caa('0x18'));var licenseUtil=require(_0x4caa('0x19'));var db=require(_0x4caa('0x1a'))['db'];function respondWithStatusCode(_0x493b1e,_0x32230e){_0x32230e=_0x32230e||0xcc;return function(_0x5a06d0){if(_0x5a06d0){return _0x493b1e['sendStatus'](_0x32230e);}return _0x493b1e[_0x4caa('0x1b')](_0x32230e)[_0x4caa('0x1c')]();};}function respondWithResult(_0x5d883a,_0x1acc07){_0x1acc07=_0x1acc07||0xc8;return function(_0x4ea608){if(_0x4ea608){return _0x5d883a[_0x4caa('0x1b')](_0x1acc07)[_0x4caa('0x1d')](_0x4ea608);}};}function respondWithFilteredResult(_0x2b0778,_0x15fd18){return function(_0x4968fe){if(_0x4968fe){var _0x480ebd=typeof _0x15fd18[_0x4caa('0x1e')]===_0x4caa('0x1f')&&typeof _0x15fd18[_0x4caa('0x20')]===_0x4caa('0x1f');var _0xb6a619=_0x4968fe[_0x4caa('0x21')];var _0xa72d21=_0x480ebd?0x0:_0x15fd18[_0x4caa('0x1e')];var _0x303228=_0x480ebd?_0x4968fe[_0x4caa('0x21')]:_0x15fd18[_0x4caa('0x1e')]+_0x15fd18['limit'];var _0x115219;if(_0x303228>=_0xb6a619){_0x303228=_0xb6a619;_0x115219=0xc8;}else{_0x115219=0xce;}_0x2b0778['status'](_0x115219);return _0x2b0778[_0x4caa('0x22')](_0x4caa('0x23'),_0xa72d21+'-'+_0x303228+'/'+_0xb6a619)[_0x4caa('0x1d')](_0x4968fe);}return null;};}function patchUpdates(_0x295fa3){return function(_0x30f8de){try{jsonpatch[_0x4caa('0x24')](_0x30f8de,_0x295fa3,!![]);}catch(_0xd0b683){return BPromise[_0x4caa('0x25')](_0xd0b683);}return _0x30f8de[_0x4caa('0x26')]();};}function saveUpdates(_0x5d1f11,_0x492735){return function(_0x59c613){if(_0x59c613){return _0x59c613[_0x4caa('0x27')](_0x5d1f11)[_0x4caa('0x28')](function(_0x66b89d){return _0x66b89d;});}return null;};}function removeEntity(_0x1f8aaa,_0x34d958){return function(_0x113f6f){if(_0x113f6f){return _0x113f6f[_0x4caa('0x29')]()[_0x4caa('0x28')](function(){var _0xd57468=_0x113f6f[_0x4caa('0x2a')]({'plain':!![]});var _0x52ebf4=_0x4caa('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x52ebf4,'resourceId':_0xd57468['id']}})['then'](function(){return _0x113f6f;});})[_0x4caa('0x28')](function(){_0x1f8aaa['status'](0xcc)[_0x4caa('0x1c')]();});}};}function handleEntityNotFound(_0x1d1d9e,_0x38e99b){return function(_0x1da228){if(!_0x1da228){_0x1d1d9e[_0x4caa('0x2c')](0x194);}return _0x1da228;};}function handleError(_0x23bb14,_0x3b39ac){_0x3b39ac=_0x3b39ac||0x1f4;return function(_0x3c2870){logger[_0x4caa('0x2d')](_0x3c2870[_0x4caa('0x2e')]);if(_0x3c2870[_0x4caa('0x2f')]){delete _0x3c2870[_0x4caa('0x2f')];}_0x23bb14['status'](_0x3b39ac)[_0x4caa('0x30')](_0x3c2870);};}exports[_0x4caa('0x31')]=function(_0x26e6f4,_0x374a58){var _0x5d4f6c={},_0x51e9c8={},_0x317a8b={'count':0x0,'rows':[]};var _0x18d952=_[_0x4caa('0x32')](db[_0x4caa('0x33')]['rawAttributes'],function(_0x210a0d){return{'name':_0x210a0d[_0x4caa('0x34')],'type':_0x210a0d[_0x4caa('0x35')]['key']};});_0x51e9c8[_0x4caa('0x36')]=_['map'](_0x18d952,'name');_0x51e9c8[_0x4caa('0x37')]=_[_0x4caa('0x38')](_0x26e6f4[_0x4caa('0x37')]);_0x51e9c8[_0x4caa('0x39')]=_[_0x4caa('0x3a')](_0x51e9c8['model'],_0x51e9c8[_0x4caa('0x37')]);_0x5d4f6c[_0x4caa('0x3b')]=_[_0x4caa('0x3a')](_0x51e9c8[_0x4caa('0x36')],qs[_0x4caa('0x3c')](_0x26e6f4['query'][_0x4caa('0x3c')]));_0x5d4f6c[_0x4caa('0x3b')]=_0x5d4f6c[_0x4caa('0x3b')][_0x4caa('0x3d')]?_0x5d4f6c[_0x4caa('0x3b')]:_0x51e9c8[_0x4caa('0x36')];if(!_0x26e6f4[_0x4caa('0x37')][_0x4caa('0x3e')](_0x4caa('0x3f'))){_0x5d4f6c[_0x4caa('0x20')]=qs['limit'](_0x26e6f4[_0x4caa('0x37')]['limit']);_0x5d4f6c[_0x4caa('0x1e')]=qs[_0x4caa('0x1e')](_0x26e6f4[_0x4caa('0x37')][_0x4caa('0x1e')]);}_0x5d4f6c[_0x4caa('0x40')]=qs[_0x4caa('0x41')](_0x26e6f4[_0x4caa('0x37')]['sort']);_0x5d4f6c[_0x4caa('0x42')]=qs[_0x4caa('0x39')](_['pick'](_0x26e6f4[_0x4caa('0x37')],_0x51e9c8[_0x4caa('0x39')]),_0x18d952);if(_0x26e6f4[_0x4caa('0x37')][_0x4caa('0x43')]){_0x5d4f6c[_0x4caa('0x42')]=_['merge'](_0x5d4f6c[_0x4caa('0x42')],{'$or':_['map'](_0x18d952,function(_0x55ead0){if(_0x55ead0[_0x4caa('0x35')]!==_0x4caa('0x44')){var _0x4ffe0f={};_0x4ffe0f[_0x55ead0[_0x4caa('0x2f')]]={'$like':'%'+_0x26e6f4[_0x4caa('0x37')]['filter']+'%'};return _0x4ffe0f;}})});}_0x5d4f6c=_[_0x4caa('0x45')]({},_0x5d4f6c,_0x26e6f4[_0x4caa('0x46')]);var _0x168c53={'where':_0x5d4f6c[_0x4caa('0x42')]};return db['Sound'][_0x4caa('0x21')](_0x168c53)['then'](function(_0x38bd3f){_0x317a8b[_0x4caa('0x21')]=_0x38bd3f;if(_0x26e6f4['query'][_0x4caa('0x47')]){_0x5d4f6c['include']=[{'all':!![]}];}return db[_0x4caa('0x33')][_0x4caa('0x48')](_0x5d4f6c);})[_0x4caa('0x28')](function(_0xd1657a){_0x317a8b[_0x4caa('0x49')]=_0xd1657a;return _0x317a8b;})['then'](respondWithFilteredResult(_0x374a58,_0x5d4f6c))[_0x4caa('0x4a')](handleError(_0x374a58,null));};exports['show']=function(_0x23fae6,_0xd8c27c){var _0x201dc3={'raw':!![],'where':{'id':_0x23fae6['params']['id']}},_0x1eb3b7={};_0x1eb3b7[_0x4caa('0x36')]=_['keys'](db['Sound'][_0x4caa('0x4b')]);_0x1eb3b7[_0x4caa('0x37')]=_[_0x4caa('0x38')](_0x23fae6[_0x4caa('0x37')]);_0x1eb3b7[_0x4caa('0x39')]=_[_0x4caa('0x3a')](_0x1eb3b7[_0x4caa('0x36')],_0x1eb3b7[_0x4caa('0x37')]);_0x201dc3[_0x4caa('0x3b')]=_[_0x4caa('0x3a')](_0x1eb3b7[_0x4caa('0x36')],qs[_0x4caa('0x3c')](_0x23fae6[_0x4caa('0x37')][_0x4caa('0x3c')]));_0x201dc3['attributes']=_0x201dc3[_0x4caa('0x3b')][_0x4caa('0x3d')]?_0x201dc3[_0x4caa('0x3b')]:_0x1eb3b7[_0x4caa('0x36')];if(_0x23fae6['query']['includeAll']){_0x201dc3['include']=[{'all':!![]}];}_0x201dc3=_[_0x4caa('0x45')]({},_0x201dc3,_0x23fae6['options']);return db[_0x4caa('0x33')][_0x4caa('0x4c')](_0x201dc3)[_0x4caa('0x28')](handleEntityNotFound(_0xd8c27c,null))['then'](respondWithResult(_0xd8c27c,null))['catch'](handleError(_0xd8c27c,null));};exports['download']=function(_0x3cdec3,_0x3835f0,_0x43a9ef){return db[_0x4caa('0x33')][_0x4caa('0x4c')]({'where':{'id':_0x3cdec3[_0x4caa('0x4d')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x3835f0,null))[_0x4caa('0x28')](function(_0x3e88d0){if(_0x3e88d0){if(!fs[_0x4caa('0x4e')](path[_0x4caa('0x4f')](config[_0x4caa('0x50')],_0x4caa('0x51'),_0x3e88d0[_0x4caa('0x52')]+'.'+_0x3e88d0[_0x4caa('0x53')]))){throw new db[(_0x4caa('0x54'))]['ValidationError']('Sound\x20not\x20found');}return _0x3835f0['download'](path[_0x4caa('0x4f')](config[_0x4caa('0x50')],_0x4caa('0x51'),util[_0x4caa('0x55')](_0x4caa('0x56'),_0x3e88d0[_0x4caa('0x52')],_0x3e88d0[_0x4caa('0x53')])),util['format'](_0x4caa('0x56'),_0x3e88d0[_0x4caa('0x2f')],_0x3e88d0['converted_format']));}return null;})[_0x4caa('0x4a')](handleError(_0x3835f0,null));};exports[_0x4caa('0x57')]=function(_0x4d25f7,_0x1839ab,_0x4b78a0){var _0x348995={'name':path[_0x4caa('0x58')](_0x4d25f7[_0x4caa('0x59')][_0x4caa('0x5a')],path[_0x4caa('0x5b')](_0x4d25f7[_0x4caa('0x59')][_0x4caa('0x5a')])),'save_name':path[_0x4caa('0x58')](_0x4d25f7['file']['filename'],path[_0x4caa('0x5b')](_0x4d25f7['file'][_0x4caa('0x5c')])),'original_format':path[_0x4caa('0x5b')](_0x4d25f7[_0x4caa('0x59')][_0x4caa('0x5a')])[_0x4caa('0x5d')](0x1),'converted_format':_0x4caa('0x5e')};var _0x5e5f87=path['join'](config[_0x4caa('0x50')],_0x4caa('0x5f'),_0x4d25f7[_0x4caa('0x59')]['filename']);var _0x1b8320=path[_0x4caa('0x4f')](config[_0x4caa('0x50')],_0x4caa('0x51'),util['format']('%s.%s',path[_0x4caa('0x58')](_0x4d25f7[_0x4caa('0x59')]['filename'],path[_0x4caa('0x5b')](_0x4d25f7[_0x4caa('0x59')][_0x4caa('0x5c')])),_0x348995[_0x4caa('0x53')]));logger[_0x4caa('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x5e5f87);logger[_0x4caa('0x60')](_0x4caa('0x61'),_0x1b8320);try{fs['chmodSync'](_0x5e5f87,parseInt('0777',0x8));var _0x16f459=sox[_0x4caa('0x62')](_0x5e5f87,_0x1b8320,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x16f459['on'](_0x4caa('0x2d'),function(_0x213511){fs[_0x4caa('0x63')](_0x5e5f87);_0x1839ab[_0x4caa('0x1b')](0x1f4)[_0x4caa('0x30')](_0x213511);});_0x16f459['on'](_0x4caa('0x64'),function(_0x52542a){_0x348995[_0x4caa('0x65')]=isNaN(_0x52542a[_0x4caa('0x66')])?null:_0x52542a[_0x4caa('0x66')]*0x3e8;_0x348995[_0x4caa('0x67')]=isNaN(_0x52542a[_0x4caa('0x68')])?null:_0x52542a[_0x4caa('0x68')];_0x348995['original_channelCount']=isNaN(_0x52542a[_0x4caa('0x69')])?null:_0x52542a[_0x4caa('0x69')];_0x348995[_0x4caa('0x6a')]=isNaN(_0x52542a[_0x4caa('0x6b')])?null:_0x52542a[_0x4caa('0x6b')];_0x348995[_0x4caa('0x6c')]=isNaN(_0x52542a[_0x4caa('0x6d')])?null:_0x52542a[_0x4caa('0x6d')];});_0x16f459['on'](_0x4caa('0x6e'),function(_0x3d2029){_0x348995[_0x4caa('0x6f')]=isNaN(_0x3d2029[_0x4caa('0x66')])?null:_0x3d2029[_0x4caa('0x66')]*0x3e8;_0x348995['converted_sampleCount']=isNaN(_0x3d2029['sampleCount'])?null:_0x3d2029[_0x4caa('0x68')];_0x348995['converted_channelCount']=isNaN(_0x3d2029[_0x4caa('0x69')])?null:_0x3d2029[_0x4caa('0x69')];_0x348995[_0x4caa('0x70')]=isNaN(_0x3d2029[_0x4caa('0x6b')])?null:_0x3d2029['bitRate'];_0x348995['converted_sampleRate']=isNaN(_0x3d2029['sampleRate'])?null:_0x3d2029[_0x4caa('0x6d')];});_0x16f459['on'](_0x4caa('0x1c'),function(){fs[_0x4caa('0x71')](_0x1b8320,parseInt(_0x4caa('0x72'),0x8));return db['Sound'][_0x4caa('0x57')](_0x348995)[_0x4caa('0x28')](function(_0x198d50){var _0x87a461={'role':_0x4d25f7[_0x4caa('0x73')]['role'],'userProfileId':_0x4d25f7['body'][_0x4caa('0x74')]};if(!_0x87a461)throw new Error(_0x4caa('0x75'));if(_0x87a461[_0x4caa('0x76')]===_0x4caa('0x77')){var _0x2e8371=_0x198d50[_0x4caa('0x2a')]({'plain':!![]});return db[_0x4caa('0x78')][_0x4caa('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x87a461[_0x4caa('0x74')]},'raw':!![]})[_0x4caa('0x28')](function(_0x2739de){if(_0x2739de&&_0x2739de[_0x4caa('0x79')]===0x0){return db[_0x4caa('0x7a')]['create']({'name':_0x2e8371[_0x4caa('0x2f')],'resourceId':_0x2e8371['id'],'type':_0x2739de[_0x4caa('0x2f')],'sectionId':_0x2739de['id']},{})[_0x4caa('0x28')](function(){return _0x198d50;});}else{return _0x198d50;}})[_0x4caa('0x4a')](function(_0x2f55b5){logger['error'](_0x4caa('0x7b'),_0x2f55b5);throw _0x2f55b5;});}return _0x198d50;})[_0x4caa('0x28')](respondWithResult(_0x1839ab,null))['catch'](handleError(_0x1839ab,null));});_0x16f459[_0x4caa('0x7c')]();}catch(_0x27d2e1){_0x1839ab[_0x4caa('0x1b')](0x1f4)[_0x4caa('0x30')](_0x27d2e1);}};exports[_0x4caa('0x27')]=function(_0x3470ba,_0x3fc2db,_0x5cd7c8){return db[_0x4caa('0x33')][_0x4caa('0x4c')]({'where':{'id':_0x3470ba['params']['id']}})[_0x4caa('0x28')](handleEntityNotFound(_0x3fc2db,null))[_0x4caa('0x28')](saveUpdates(_[_0x4caa('0x7d')](_0x3470ba['body'],[_0x4caa('0x2f'),_0x4caa('0x7e')]),null))[_0x4caa('0x28')](respondWithResult(_0x3fc2db,null))[_0x4caa('0x4a')](handleError(_0x3fc2db,null));};exports[_0x4caa('0x7f')]=function(_0x1a4113,_0x86258c,_0x57084c){return db['Sound'][_0x4caa('0x4c')]({'where':{'id':_0x1a4113[_0x4caa('0x4d')]['id']}})[_0x4caa('0x28')](function(_0x362868){if(_0x362868){return _0x362868[_0x4caa('0x29')]();}})['then'](function(_0x1260ff){var _0x11c19e=path['join'](config['root'],_0x4caa('0x5f'),util[_0x4caa('0x55')](_0x4caa('0x56'),_0x1260ff[_0x4caa('0x52')],_0x1260ff[_0x4caa('0x80')]));var _0x596f00=path[_0x4caa('0x4f')](config[_0x4caa('0x50')],_0x4caa('0x51'),util[_0x4caa('0x55')]('%s.%s',_0x1260ff[_0x4caa('0x52')],_0x1260ff[_0x4caa('0x53')]));fs[_0x4caa('0x63')](_0x11c19e);fs['unlinkSync'](_0x596f00);return _0x1260ff;})[_0x4caa('0x28')](function(_0x15659f){if(_0x15659f){return _0x86258c[_0x4caa('0x1b')](0xcc)[_0x4caa('0x1c')]();}})[_0x4caa('0x28')](handleEntityNotFound(_0x86258c,null))[_0x4caa('0x4a')](handleError(_0x86258c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7346825..fd65628 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 _0xb77a=['path','define','Sound','lodash','util','api','moment','request-promise'];(function(_0x257b97,_0x1339de){var _0x26e3ff=function(_0x237d07){while(--_0x237d07){_0x257b97['push'](_0x257b97['shift']());}};_0x26e3ff(++_0x1339de);}(_0xb77a,0x17b));var _0xab77=function(_0x82e3a0,_0x3b9965){_0x82e3a0=_0x82e3a0-0x0;var _0xd225a0=_0xb77a[_0x82e3a0];return _0xd225a0;};'use strict';var _=require(_0xab77('0x0'));var util=require(_0xab77('0x1'));var logger=require('../../config/logger')(_0xab77('0x2'));var moment=require(_0xab77('0x3'));var BPromise=require('bluebird');var rp=require(_0xab77('0x4'));var fs=require('fs');var path=require(_0xab77('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x2e1e74,_0x53b1fc){return _0x2e1e74[_0xab77('0x6')](_0xab77('0x7'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a66=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7a66,0xbb));var _0x67a6=function(_0x443f85,_0x53c6a2){_0x443f85=_0x443f85-0x0;var _0x4e8d34=_0x7a66[_0x443f85];return _0x4e8d34;};'use strict';var _=require(_0x67a6('0x0'));var util=require(_0x67a6('0x1'));var logger=require(_0x67a6('0x2'))(_0x67a6('0x3'));var moment=require('moment');var BPromise=require(_0x67a6('0x4'));var rp=require(_0x67a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67a6('0x6'));var config=require(_0x67a6('0x7'));var attributes=require(_0x67a6('0x8'));module['exports']=function(_0x11f543,_0x14d3c9){return _0x11f543['define'](_0x67a6('0x9'),attributes,{'tableName':_0x67a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index d40d24b..f742216 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 _0xa9c7=['rpc','jayson/promise','client','http','request','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','info','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x53abac,_0x555d2c){var _0x5beb6f=function(_0x39bbe6){while(--_0x39bbe6){_0x53abac['push'](_0x53abac['shift']());}};_0x5beb6f(++_0x555d2c);}(_0xa9c7,0x96));var _0x7a9c=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0xa9c7[_0x1e393b];return _0x3d0bfe;};'use strict';var _=require('lodash');var util=require(_0x7a9c('0x0'));var moment=require('moment');var BPromise=require(_0x7a9c('0x1'));var rs=require(_0x7a9c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a9c('0x3'))['db'];var utils=require(_0x7a9c('0x4'));var logger=require('../../config/logger')(_0x7a9c('0x5'));var config=require('../../config/environment');var jayson=require(_0x7a9c('0x6'));var client=jayson[_0x7a9c('0x7')][_0x7a9c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xde5c15,_0x3de403,_0x2929f9){return new BPromise(function(_0x31db01,_0x382214){return client[_0x7a9c('0x9')](_0xde5c15,_0x2929f9)['then'](function(_0x595295){logger['info']('Sound,\x20%s,\x20%s',_0x3de403,_0x7a9c('0xa'));logger['debug'](_0x7a9c('0xb'),_0x3de403,_0x7a9c('0xa'),JSON[_0x7a9c('0xc')](_0x595295));if(_0x595295[_0x7a9c('0xd')]){if(_0x595295[_0x7a9c('0xd')][_0x7a9c('0xe')]===0x1f4){logger[_0x7a9c('0xd')](_0x7a9c('0xf'),_0x3de403,_0x595295['error'][_0x7a9c('0x10')]);return _0x382214(_0x595295[_0x7a9c('0xd')][_0x7a9c('0x10')]);}logger[_0x7a9c('0xd')](_0x7a9c('0xf'),_0x3de403,_0x595295['error']['message']);return _0x31db01(_0x595295[_0x7a9c('0xd')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x3de403,_0x7a9c('0xa'));_0x31db01(_0x595295[_0x7a9c('0x11')][_0x7a9c('0x10')]);}})[_0x7a9c('0x12')](function(_0x479e77){logger[_0x7a9c('0xd')](_0x7a9c('0xf'),_0x3de403,_0x479e77);_0x382214(_0x479e77);});});}exports[_0x7a9c('0x13')]=function(_0x35a477){var _0x36f3c5=this;return new Promise(function(_0x2e3132,_0x1574e5){return db[_0x7a9c('0x14')][_0x7a9c('0x15')]({'raw':_0x35a477[_0x7a9c('0x16')]?_0x35a477[_0x7a9c('0x16')][_0x7a9c('0x17')]===undefined?!![]:![]:!![],'where':_0x35a477[_0x7a9c('0x16')]?_0x35a477[_0x7a9c('0x16')][_0x7a9c('0x18')]||null:null,'attributes':_0x35a477[_0x7a9c('0x16')]?_0x35a477['options'][_0x7a9c('0x19')]||null:null,'include':_0x35a477['options']?_0x35a477[_0x7a9c('0x16')][_0x7a9c('0x1a')]?_[_0x7a9c('0x1b')](_0x35a477['options'][_0x7a9c('0x1a')],function(_0x464e3e){return{'model':db[_0x464e3e[_0x7a9c('0x1c')]],'as':_0x464e3e['as'],'attributes':_0x464e3e[_0x7a9c('0x19')],'include':_0x464e3e[_0x7a9c('0x1a')]?_[_0x7a9c('0x1b')](_0x464e3e['include'],function(_0x51fe28){return{'model':db[_0x51fe28['model']],'as':_0x51fe28['as'],'attributes':_0x51fe28[_0x7a9c('0x19')],'include':_0x51fe28[_0x7a9c('0x1a')]?_[_0x7a9c('0x1b')](_0x51fe28[_0x7a9c('0x1a')],function(_0xdfa3be){return{'model':db[_0xdfa3be[_0x7a9c('0x1c')]],'as':_0xdfa3be['as'],'attributes':_0xdfa3be[_0x7a9c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7a9c('0x1d')](function(_0xe89541){logger[_0x7a9c('0x1e')](_0x7a9c('0x13'),_0x35a477);logger['debug'](_0x7a9c('0x13'),_0x35a477,JSON[_0x7a9c('0xc')](_0xe89541));_0x2e3132(_0xe89541);})['catch'](function(_0x1060f7){logger[_0x7a9c('0xd')]('ShowSound',_0x1060f7[_0x7a9c('0x10')],_0x35a477);_0x1574e5(_0x36f3c5[_0x7a9c('0xd')](0x1f4,_0x1060f7[_0x7a9c('0x10')]));});});}; \ No newline at end of file +var _0x7f6f=['result','catch','Sound','options','raw','where','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x57178e,_0x265ff8){var _0x1111da=function(_0x5a6a61){while(--_0x5a6a61){_0x57178e['push'](_0x57178e['shift']());}};_0x1111da(++_0x265ff8);}(_0x7f6f,0x142));var _0xf7f6=function(_0x226b19,_0x4bdfb8){_0x226b19=_0x226b19-0x0;var _0x6bfc30=_0x7f6f[_0x226b19];return _0x6bfc30;};'use strict';var _=require(_0xf7f6('0x0'));var util=require(_0xf7f6('0x1'));var moment=require(_0xf7f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf7f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7f6('0x4'))['db'];var utils=require(_0xf7f6('0x5'));var logger=require(_0xf7f6('0x6'))(_0xf7f6('0x7'));var config=require(_0xf7f6('0x8'));var jayson=require(_0xf7f6('0x9'));var client=jayson['client'][_0xf7f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bc4d5,_0x4d4ad9,_0x67328c){return new BPromise(function(_0x356d74,_0xd45004){return client[_0xf7f6('0xb')](_0x4bc4d5,_0x67328c)[_0xf7f6('0xc')](function(_0x5b29f5){logger[_0xf7f6('0xd')](_0xf7f6('0xe'),_0x4d4ad9,_0xf7f6('0xf'));logger[_0xf7f6('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x4d4ad9,'request\x20sent',JSON['stringify'](_0x5b29f5));if(_0x5b29f5[_0xf7f6('0x11')]){if(_0x5b29f5[_0xf7f6('0x11')]['code']===0x1f4){logger[_0xf7f6('0x11')](_0xf7f6('0xe'),_0x4d4ad9,_0x5b29f5[_0xf7f6('0x11')]['message']);return _0xd45004(_0x5b29f5[_0xf7f6('0x11')][_0xf7f6('0x12')]);}logger['error'](_0xf7f6('0xe'),_0x4d4ad9,_0x5b29f5['error']['message']);return _0x356d74(_0x5b29f5[_0xf7f6('0x11')][_0xf7f6('0x12')]);}else{logger['info'](_0xf7f6('0xe'),_0x4d4ad9,'request\x20sent');_0x356d74(_0x5b29f5[_0xf7f6('0x13')][_0xf7f6('0x12')]);}})[_0xf7f6('0x14')](function(_0x82b6d0){logger['error'](_0xf7f6('0xe'),_0x4d4ad9,_0x82b6d0);_0xd45004(_0x82b6d0);});});}exports['ShowSound']=function(_0x182e69){var _0x58d0b5=this;return new Promise(function(_0x481ef7,_0x5d6a58){return db[_0xf7f6('0x15')]['find']({'raw':_0x182e69[_0xf7f6('0x16')]?_0x182e69[_0xf7f6('0x16')][_0xf7f6('0x17')]===undefined?!![]:![]:!![],'where':_0x182e69[_0xf7f6('0x16')]?_0x182e69[_0xf7f6('0x16')][_0xf7f6('0x18')]||null:null,'attributes':_0x182e69[_0xf7f6('0x16')]?_0x182e69['options'][_0xf7f6('0x19')]||null:null,'include':_0x182e69[_0xf7f6('0x16')]?_0x182e69[_0xf7f6('0x16')][_0xf7f6('0x1a')]?_[_0xf7f6('0x1b')](_0x182e69['options'][_0xf7f6('0x1a')],function(_0x168280){return{'model':db[_0x168280['model']],'as':_0x168280['as'],'attributes':_0x168280[_0xf7f6('0x19')],'include':_0x168280[_0xf7f6('0x1a')]?_[_0xf7f6('0x1b')](_0x168280[_0xf7f6('0x1a')],function(_0x66d598){return{'model':db[_0x66d598[_0xf7f6('0x1c')]],'as':_0x66d598['as'],'attributes':_0x66d598[_0xf7f6('0x19')],'include':_0x66d598[_0xf7f6('0x1a')]?_[_0xf7f6('0x1b')](_0x66d598[_0xf7f6('0x1a')],function(_0x4d6a5d){return{'model':db[_0x4d6a5d['model']],'as':_0x4d6a5d['as'],'attributes':_0x4d6a5d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a7276){logger[_0xf7f6('0xd')](_0xf7f6('0x1d'),_0x182e69);logger[_0xf7f6('0x10')](_0xf7f6('0x1d'),_0x182e69,JSON[_0xf7f6('0x1e')](_0x3a7276));_0x481ef7(_0x3a7276);})[_0xf7f6('0x14')](function(_0xf4ac6b){logger[_0xf7f6('0x11')](_0xf7f6('0x1d'),_0xf4ac6b['message'],_0x182e69);_0x5d6a58(_0x58d0b5[_0xf7f6('0x11')](0x1f4,_0xf4ac6b[_0xf7f6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e692c05..d7d2db3 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31729d,_0x9128a){var _0x29a0a4=function(_0x3f5d3e){while(--_0x3f5d3e){_0x31729d['push'](_0x31729d['shift']());}};_0x29a0a4(++_0x9128a);}(_0xb10b,0x12a));var _0xbb10=function(_0x523196,_0x1d6d0a){_0x523196=_0x523196-0x0;var _0x3c75a1=_0xb10b[_0x523196];return _0x3c75a1;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4aa4af,_0x210cde){var _0x3bf44a=function(_0x4a8126){while(--_0x4a8126){_0x4aa4af['push'](_0x4aa4af['shift']());}};_0x3bf44a(++_0x210cde);}(_0x8603,0x190));var _0x3860=function(_0x39767f,_0xdf30e6){_0x39767f=_0x39767f-0x0;var _0x54ff20=_0x8603[_0x39767f];return _0x54ff20;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1fd6358..8cb2dc1 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 _0xb87b=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x30bed8,_0x3d7980){var _0x53d3c4=function(_0x4fb52f){while(--_0x4fb52f){_0x30bed8['push'](_0x30bed8['shift']());}};_0x53d3c4(++_0x3d7980);}(_0xb87b,0xe1));var _0xbb87=function(_0x5b45bf,_0x22cd02){_0x5b45bf=_0x5b45bf-0x0;var _0x423fd7=_0xb87b[_0x5b45bf];return _0x423fd7;};'use strict';var Sequelize=require(_0xbb87('0x0'));module[_0xbb87('0x1')]={'uniqueid':{'type':Sequelize[_0xbb87('0x2')]},'body':{'type':Sequelize[_0xbb87('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xbb87('0x4')]('in','out'),'defaultValue':_0xbb87('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbb87('0x3')]}}; \ No newline at end of file +var _0xd653=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x3404e6,_0xf22a6c){var _0x2affa8=function(_0x114816){while(--_0x114816){_0x3404e6['push'](_0x3404e6['shift']());}};_0x2affa8(++_0xf22a6c);}(_0xd653,0x1cb));var _0x3d65=function(_0xc40dc4,_0x1cfcdc){_0xc40dc4=_0xc40dc4-0x0;var _0x31ecb7=_0xd653[_0xc40dc4];return _0x31ecb7;};'use strict';var Sequelize=require('sequelize');module[_0x3d65('0x0')]={'uniqueid':{'type':Sequelize[_0x3d65('0x1')]},'body':{'type':Sequelize[_0x3d65('0x2')](_0x3d65('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x3d65('0x4')]('in',_0x3d65('0x5')),'defaultValue':_0x3d65('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3d65('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 680d567..6b09659 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 _0x4e63=['create','body','find','rimraf','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','order','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','SquareMessage','findAll','catch','params','keys'];(function(_0x4a0d06,_0x22d096){var _0x123baf=function(_0x5c214f){while(--_0x5c214f){_0x4a0d06['push'](_0x4a0d06['shift']());}};_0x123baf(++_0x22d096);}(_0x4e63,0x1ad));var _0x34e6=function(_0x1b532f,_0xf85d63){_0x1b532f=_0x1b532f-0x0;var _0x45b0e2=_0x4e63[_0x1b532f];return _0x45b0e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x34e6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34e6('0x2'));var util=require(_0x34e6('0x3'));var path=require('path');var sox=require(_0x34e6('0x4'));var csv=require(_0x34e6('0x5'));var ejs=require(_0x34e6('0x6'));var fs=require('fs');var fs_extra=require(_0x34e6('0x7'));var _=require(_0x34e6('0x8'));var squel=require('squel');var crypto=require(_0x34e6('0x9'));var jsforce=require(_0x34e6('0xa'));var deskjs=require(_0x34e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x34e6('0xc'));var Papa=require(_0x34e6('0xd'));var Redis=require('ioredis');var authService=require(_0x34e6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x34e6('0xf'));var hardwareService=require(_0x34e6('0x10'));var logger=require(_0x34e6('0x11'))(_0x34e6('0x12'));var utils=require(_0x34e6('0x13'));var config=require(_0x34e6('0x14'));var licenseUtil=require(_0x34e6('0x15'));var db=require(_0x34e6('0x16'))['db'];function respondWithStatusCode(_0x1f862b,_0x24650b){_0x24650b=_0x24650b||0xcc;return function(_0x26a73e){if(_0x26a73e){return _0x1f862b['sendStatus'](_0x24650b);}return _0x1f862b[_0x34e6('0x17')](_0x24650b)[_0x34e6('0x18')]();};}function respondWithResult(_0x32212f,_0x390135){_0x390135=_0x390135||0xc8;return function(_0x262757){if(_0x262757){return _0x32212f[_0x34e6('0x17')](_0x390135)[_0x34e6('0x19')](_0x262757);}};}function respondWithFilteredResult(_0x23d99f,_0x4fe881){return function(_0x51413a){if(_0x51413a){var _0x1a5204=typeof _0x4fe881[_0x34e6('0x1a')]==='undefined'&&typeof _0x4fe881[_0x34e6('0x1b')]===_0x34e6('0x1c');var _0xf8528e=_0x51413a['count'];var _0x19e888=_0x1a5204?0x0:_0x4fe881[_0x34e6('0x1a')];var _0x1f2dfe=_0x1a5204?_0x51413a['count']:_0x4fe881['offset']+_0x4fe881['limit'];var _0x17a136;if(_0x1f2dfe>=_0xf8528e){_0x1f2dfe=_0xf8528e;_0x17a136=0xc8;}else{_0x17a136=0xce;}_0x23d99f['status'](_0x17a136);return _0x23d99f[_0x34e6('0x1d')]('Content-Range',_0x19e888+'-'+_0x1f2dfe+'/'+_0xf8528e)[_0x34e6('0x19')](_0x51413a);}return null;};}function patchUpdates(_0x451468){return function(_0xc5734a){try{jsonpatch[_0x34e6('0x1e')](_0xc5734a,_0x451468,!![]);}catch(_0x209b0e){return BPromise[_0x34e6('0x1f')](_0x209b0e);}return _0xc5734a[_0x34e6('0x20')]();};}function saveUpdates(_0x397a3c,_0x3131b7){return function(_0x6d82ed){if(_0x6d82ed){return _0x6d82ed[_0x34e6('0x21')](_0x397a3c)[_0x34e6('0x22')](function(_0x1738dc){return _0x1738dc;});}return null;};}function removeEntity(_0x433e9d,_0x353e15){return function(_0x2bbd27){if(_0x2bbd27){return _0x2bbd27[_0x34e6('0x23')]()['then'](function(){_0x433e9d[_0x34e6('0x17')](0xcc)[_0x34e6('0x18')]();});}};}function handleEntityNotFound(_0xf992b5,_0x58c836){return function(_0x1ff986){if(!_0x1ff986){_0xf992b5[_0x34e6('0x24')](0x194);}return _0x1ff986;};}function handleError(_0x391fee,_0x45691a){_0x45691a=_0x45691a||0x1f4;return function(_0x4b5b21){logger[_0x34e6('0x25')](_0x4b5b21[_0x34e6('0x26')]);if(_0x4b5b21['name']){delete _0x4b5b21[_0x34e6('0x27')];}_0x391fee[_0x34e6('0x17')](_0x45691a)[_0x34e6('0x28')](_0x4b5b21);};}exports[_0x34e6('0x29')]=function(_0x465814,_0x2c5642){var _0x3bfe18={},_0x2e071f={},_0x468327={'count':0x0,'rows':[]};var _0x1f0e9e=_[_0x34e6('0x2a')](db['SquareMessage'][_0x34e6('0x2b')],function(_0x38da71){return{'name':_0x38da71[_0x34e6('0x2c')],'type':_0x38da71[_0x34e6('0x2d')]['key']};});_0x2e071f[_0x34e6('0x2e')]=_[_0x34e6('0x2a')](_0x1f0e9e,_0x34e6('0x27'));_0x2e071f['query']=_['keys'](_0x465814[_0x34e6('0x2f')]);_0x2e071f[_0x34e6('0x30')]=_[_0x34e6('0x31')](_0x2e071f[_0x34e6('0x2e')],_0x2e071f[_0x34e6('0x2f')]);_0x3bfe18['attributes']=_[_0x34e6('0x31')](_0x2e071f[_0x34e6('0x2e')],qs['fields'](_0x465814['query'][_0x34e6('0x32')]));_0x3bfe18['attributes']=_0x3bfe18[_0x34e6('0x33')][_0x34e6('0x34')]?_0x3bfe18[_0x34e6('0x33')]:_0x2e071f[_0x34e6('0x2e')];if(!_0x465814[_0x34e6('0x2f')]['hasOwnProperty']('nolimit')){_0x3bfe18[_0x34e6('0x1b')]=qs['limit'](_0x465814['query'][_0x34e6('0x1b')]);_0x3bfe18[_0x34e6('0x1a')]=qs[_0x34e6('0x1a')](_0x465814[_0x34e6('0x2f')][_0x34e6('0x1a')]);}_0x3bfe18[_0x34e6('0x35')]=qs['sort'](_0x465814[_0x34e6('0x2f')]['sort']);_0x3bfe18['where']=qs[_0x34e6('0x30')](_[_0x34e6('0x36')](_0x465814[_0x34e6('0x2f')],_0x2e071f[_0x34e6('0x30')]),_0x1f0e9e);if(_0x465814[_0x34e6('0x2f')][_0x34e6('0x37')]){_0x3bfe18[_0x34e6('0x38')]=_[_0x34e6('0x39')](_0x3bfe18['where'],{'$or':_[_0x34e6('0x2a')](_0x1f0e9e,function(_0x1c5a6f){if(_0x1c5a6f['type']!==_0x34e6('0x3a')){var _0x304adb={};_0x304adb[_0x1c5a6f[_0x34e6('0x27')]]={'$like':'%'+_0x465814[_0x34e6('0x2f')][_0x34e6('0x37')]+'%'};return _0x304adb;}})});}_0x3bfe18=_[_0x34e6('0x39')]({},_0x3bfe18,_0x465814[_0x34e6('0x3b')]);var _0x1dae90={'where':_0x3bfe18['where']};return db['SquareMessage'][_0x34e6('0x3c')](_0x1dae90)[_0x34e6('0x22')](function(_0x58e455){_0x468327[_0x34e6('0x3c')]=_0x58e455;if(_0x465814[_0x34e6('0x2f')][_0x34e6('0x3d')]){_0x3bfe18[_0x34e6('0x3e')]=[{'all':!![]}];}return db[_0x34e6('0x3f')][_0x34e6('0x40')](_0x3bfe18);})[_0x34e6('0x22')](function(_0xbe096d){_0x468327['rows']=_0xbe096d;return _0x468327;})[_0x34e6('0x22')](respondWithFilteredResult(_0x2c5642,_0x3bfe18))[_0x34e6('0x41')](handleError(_0x2c5642,null));};exports['show']=function(_0xa9cd66,_0x37d070){var _0x9c23e5={'raw':!![],'where':{'id':_0xa9cd66[_0x34e6('0x42')]['id']}},_0x12359e={};_0x12359e[_0x34e6('0x2e')]=_[_0x34e6('0x43')](db['SquareMessage'][_0x34e6('0x2b')]);_0x12359e[_0x34e6('0x2f')]=_['keys'](_0xa9cd66[_0x34e6('0x2f')]);_0x12359e[_0x34e6('0x30')]=_[_0x34e6('0x31')](_0x12359e['model'],_0x12359e[_0x34e6('0x2f')]);_0x9c23e5['attributes']=_[_0x34e6('0x31')](_0x12359e['model'],qs['fields'](_0xa9cd66[_0x34e6('0x2f')][_0x34e6('0x32')]));_0x9c23e5[_0x34e6('0x33')]=_0x9c23e5[_0x34e6('0x33')][_0x34e6('0x34')]?_0x9c23e5[_0x34e6('0x33')]:_0x12359e[_0x34e6('0x2e')];if(_0xa9cd66[_0x34e6('0x2f')]['includeAll']){_0x9c23e5['include']=[{'all':!![]}];}_0x9c23e5=_['merge']({},_0x9c23e5,_0xa9cd66[_0x34e6('0x3b')]);return db[_0x34e6('0x3f')]['find'](_0x9c23e5)[_0x34e6('0x22')](handleEntityNotFound(_0x37d070,null))[_0x34e6('0x22')](respondWithResult(_0x37d070,null))[_0x34e6('0x41')](handleError(_0x37d070,null));};exports[_0x34e6('0x44')]=function(_0x48be34,_0x1f2b4e){return db[_0x34e6('0x3f')][_0x34e6('0x44')](_0x48be34[_0x34e6('0x45')],{})[_0x34e6('0x22')](respondWithResult(_0x1f2b4e,0xc9))[_0x34e6('0x41')](handleError(_0x1f2b4e,null));};exports[_0x34e6('0x21')]=function(_0x2d212e,_0x4f9079){if(_0x2d212e[_0x34e6('0x45')]['id']){delete _0x2d212e[_0x34e6('0x45')]['id'];}return db[_0x34e6('0x3f')][_0x34e6('0x46')]({'where':{'id':_0x2d212e[_0x34e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f9079,null))['then'](saveUpdates(_0x2d212e['body'],null))[_0x34e6('0x22')](respondWithResult(_0x4f9079,null))[_0x34e6('0x41')](handleError(_0x4f9079,null));};exports[_0x34e6('0x23')]=function(_0x1443aa,_0x5e43cd){return db[_0x34e6('0x3f')][_0x34e6('0x46')]({'where':{'id':_0x1443aa[_0x34e6('0x42')]['id']}})[_0x34e6('0x22')](handleEntityNotFound(_0x5e43cd,null))[_0x34e6('0x22')](removeEntity(_0x5e43cd,null))[_0x34e6('0x41')](handleError(_0x5e43cd,null));}; \ No newline at end of file +var _0xd732=['then','error','stack','name','send','map','SquareMessage','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','eml-format','zip-dir','moment','bluebird','path','to-csv','ejs','squel','jsforce','desk.js','querystring','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','count','limit','set','Content-Range','json','apply','reject','update','destroy'];(function(_0x181f30,_0x59e7e0){var _0x175754=function(_0x5f0751){while(--_0x5f0751){_0x181f30['push'](_0x181f30['shift']());}};_0x175754(++_0x59e7e0);}(_0xd732,0x18e));var _0x2d73=function(_0x4b2ae9,_0x3a490b){_0x4b2ae9=_0x4b2ae9-0x0;var _0x14549c=_0xd732[_0x4b2ae9];return _0x14549c;};'use strict';var emlformat=require(_0x2d73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d73('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d73('0x2'));var BPromise=require(_0x2d73('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2d73('0x4'));var sox=require('sox');var csv=require(_0x2d73('0x5'));var ejs=require(_0x2d73('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d73('0x7'));var crypto=require('crypto');var jsforce=require(_0x2d73('0x8'));var deskjs=require(_0x2d73('0x9'));var toCsv=require(_0x2d73('0x5'));var querystring=require(_0x2d73('0xa'));var Papa=require('papaparse');var Redis=require(_0x2d73('0xb'));var authService=require(_0x2d73('0xc'));var qs=require(_0x2d73('0xd'));var as=require(_0x2d73('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d73('0xf'))(_0x2d73('0x10'));var utils=require(_0x2d73('0x11'));var config=require(_0x2d73('0x12'));var licenseUtil=require(_0x2d73('0x13'));var db=require(_0x2d73('0x14'))['db'];function respondWithStatusCode(_0x176782,_0x3e8105){_0x3e8105=_0x3e8105||0xcc;return function(_0x295c21){if(_0x295c21){return _0x176782[_0x2d73('0x15')](_0x3e8105);}return _0x176782[_0x2d73('0x16')](_0x3e8105)[_0x2d73('0x17')]();};}function respondWithResult(_0x4b3525,_0x370fa5){_0x370fa5=_0x370fa5||0xc8;return function(_0x559bb4){if(_0x559bb4){return _0x4b3525[_0x2d73('0x16')](_0x370fa5)['json'](_0x559bb4);}};}function respondWithFilteredResult(_0x1e9bc3,_0xe0be82){return function(_0x54e386){if(_0x54e386){var _0x238897=typeof _0xe0be82[_0x2d73('0x18')]==='undefined'&&typeof _0xe0be82['limit']==='undefined';var _0x3cde1d=_0x54e386[_0x2d73('0x19')];var _0x43a2a5=_0x238897?0x0:_0xe0be82['offset'];var _0x303dfe=_0x238897?_0x54e386[_0x2d73('0x19')]:_0xe0be82[_0x2d73('0x18')]+_0xe0be82[_0x2d73('0x1a')];var _0x5934e2;if(_0x303dfe>=_0x3cde1d){_0x303dfe=_0x3cde1d;_0x5934e2=0xc8;}else{_0x5934e2=0xce;}_0x1e9bc3['status'](_0x5934e2);return _0x1e9bc3[_0x2d73('0x1b')](_0x2d73('0x1c'),_0x43a2a5+'-'+_0x303dfe+'/'+_0x3cde1d)[_0x2d73('0x1d')](_0x54e386);}return null;};}function patchUpdates(_0x350d7d){return function(_0x27bb5e){try{jsonpatch[_0x2d73('0x1e')](_0x27bb5e,_0x350d7d,!![]);}catch(_0x1e7144){return BPromise[_0x2d73('0x1f')](_0x1e7144);}return _0x27bb5e['save']();};}function saveUpdates(_0x408067,_0x233f57){return function(_0x221f5b){if(_0x221f5b){return _0x221f5b[_0x2d73('0x20')](_0x408067)['then'](function(_0x186b9a){return _0x186b9a;});}return null;};}function removeEntity(_0x1e8acd,_0x34da74){return function(_0x1bcb10){if(_0x1bcb10){return _0x1bcb10[_0x2d73('0x21')]()[_0x2d73('0x22')](function(){_0x1e8acd[_0x2d73('0x16')](0xcc)[_0x2d73('0x17')]();});}};}function handleEntityNotFound(_0x350848,_0x2f682b){return function(_0x361e5e){if(!_0x361e5e){_0x350848[_0x2d73('0x15')](0x194);}return _0x361e5e;};}function handleError(_0x2c97f2,_0x11d2f3){_0x11d2f3=_0x11d2f3||0x1f4;return function(_0x24aecc){logger[_0x2d73('0x23')](_0x24aecc[_0x2d73('0x24')]);if(_0x24aecc['name']){delete _0x24aecc[_0x2d73('0x25')];}_0x2c97f2[_0x2d73('0x16')](_0x11d2f3)[_0x2d73('0x26')](_0x24aecc);};}exports['index']=function(_0x59075b,_0x1458b7){var _0x133c2a={},_0x494a49={},_0x5aa9ea={'count':0x0,'rows':[]};var _0x1beaef=_[_0x2d73('0x27')](db[_0x2d73('0x28')]['rawAttributes'],function(_0x4a47d3){return{'name':_0x4a47d3[_0x2d73('0x29')],'type':_0x4a47d3[_0x2d73('0x2a')][_0x2d73('0x2b')]};});_0x494a49['model']=_['map'](_0x1beaef,_0x2d73('0x25'));_0x494a49['query']=_[_0x2d73('0x2c')](_0x59075b[_0x2d73('0x2d')]);_0x494a49[_0x2d73('0x2e')]=_[_0x2d73('0x2f')](_0x494a49[_0x2d73('0x30')],_0x494a49[_0x2d73('0x2d')]);_0x133c2a[_0x2d73('0x31')]=_[_0x2d73('0x2f')](_0x494a49[_0x2d73('0x30')],qs[_0x2d73('0x32')](_0x59075b['query'][_0x2d73('0x32')]));_0x133c2a['attributes']=_0x133c2a[_0x2d73('0x31')]['length']?_0x133c2a[_0x2d73('0x31')]:_0x494a49[_0x2d73('0x30')];if(!_0x59075b[_0x2d73('0x2d')][_0x2d73('0x33')](_0x2d73('0x34'))){_0x133c2a[_0x2d73('0x1a')]=qs[_0x2d73('0x1a')](_0x59075b[_0x2d73('0x2d')]['limit']);_0x133c2a[_0x2d73('0x18')]=qs['offset'](_0x59075b[_0x2d73('0x2d')][_0x2d73('0x18')]);}_0x133c2a[_0x2d73('0x35')]=qs[_0x2d73('0x36')](_0x59075b[_0x2d73('0x2d')][_0x2d73('0x36')]);_0x133c2a['where']=qs['filters'](_[_0x2d73('0x37')](_0x59075b[_0x2d73('0x2d')],_0x494a49['filters']),_0x1beaef);if(_0x59075b[_0x2d73('0x2d')][_0x2d73('0x38')]){_0x133c2a[_0x2d73('0x39')]=_['merge'](_0x133c2a[_0x2d73('0x39')],{'$or':_[_0x2d73('0x27')](_0x1beaef,function(_0x5c3462){if(_0x5c3462[_0x2d73('0x2a')]!==_0x2d73('0x3a')){var _0x53bd55={};_0x53bd55[_0x5c3462[_0x2d73('0x25')]]={'$like':'%'+_0x59075b['query'][_0x2d73('0x38')]+'%'};return _0x53bd55;}})});}_0x133c2a=_[_0x2d73('0x3b')]({},_0x133c2a,_0x59075b[_0x2d73('0x3c')]);var _0x40edb7={'where':_0x133c2a[_0x2d73('0x39')]};return db[_0x2d73('0x28')][_0x2d73('0x19')](_0x40edb7)[_0x2d73('0x22')](function(_0x6b8cdd){_0x5aa9ea[_0x2d73('0x19')]=_0x6b8cdd;if(_0x59075b['query']['includeAll']){_0x133c2a['include']=[{'all':!![]}];}return db[_0x2d73('0x28')][_0x2d73('0x3d')](_0x133c2a);})[_0x2d73('0x22')](function(_0x547b4d){_0x5aa9ea[_0x2d73('0x3e')]=_0x547b4d;return _0x5aa9ea;})[_0x2d73('0x22')](respondWithFilteredResult(_0x1458b7,_0x133c2a))[_0x2d73('0x3f')](handleError(_0x1458b7,null));};exports[_0x2d73('0x40')]=function(_0xa910d5,_0x5c4877){var _0x446aeb={'raw':!![],'where':{'id':_0xa910d5[_0x2d73('0x41')]['id']}},_0x31c6b3={};_0x31c6b3[_0x2d73('0x30')]=_['keys'](db['SquareMessage'][_0x2d73('0x42')]);_0x31c6b3[_0x2d73('0x2d')]=_[_0x2d73('0x2c')](_0xa910d5[_0x2d73('0x2d')]);_0x31c6b3['filters']=_[_0x2d73('0x2f')](_0x31c6b3[_0x2d73('0x30')],_0x31c6b3[_0x2d73('0x2d')]);_0x446aeb[_0x2d73('0x31')]=_['intersection'](_0x31c6b3[_0x2d73('0x30')],qs[_0x2d73('0x32')](_0xa910d5[_0x2d73('0x2d')][_0x2d73('0x32')]));_0x446aeb['attributes']=_0x446aeb['attributes'][_0x2d73('0x43')]?_0x446aeb[_0x2d73('0x31')]:_0x31c6b3[_0x2d73('0x30')];if(_0xa910d5[_0x2d73('0x2d')]['includeAll']){_0x446aeb[_0x2d73('0x44')]=[{'all':!![]}];}_0x446aeb=_[_0x2d73('0x3b')]({},_0x446aeb,_0xa910d5[_0x2d73('0x3c')]);return db['SquareMessage'][_0x2d73('0x45')](_0x446aeb)[_0x2d73('0x22')](handleEntityNotFound(_0x5c4877,null))['then'](respondWithResult(_0x5c4877,null))[_0x2d73('0x3f')](handleError(_0x5c4877,null));};exports[_0x2d73('0x46')]=function(_0x364aa8,_0x35d9eb){return db['SquareMessage'][_0x2d73('0x46')](_0x364aa8[_0x2d73('0x47')],{})[_0x2d73('0x22')](respondWithResult(_0x35d9eb,0xc9))[_0x2d73('0x3f')](handleError(_0x35d9eb,null));};exports[_0x2d73('0x20')]=function(_0x5308f0,_0x2ba33e){if(_0x5308f0['body']['id']){delete _0x5308f0['body']['id'];}return db[_0x2d73('0x28')][_0x2d73('0x45')]({'where':{'id':_0x5308f0[_0x2d73('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ba33e,null))[_0x2d73('0x22')](saveUpdates(_0x5308f0['body'],null))['then'](respondWithResult(_0x2ba33e,null))[_0x2d73('0x3f')](handleError(_0x2ba33e,null));};exports[_0x2d73('0x21')]=function(_0x13f364,_0x30eeda){return db['SquareMessage'][_0x2d73('0x45')]({'where':{'id':_0x13f364[_0x2d73('0x41')]['id']}})['then'](handleEntityNotFound(_0x30eeda,null))[_0x2d73('0x22')](removeEntity(_0x30eeda,null))['catch'](handleError(_0x30eeda,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1e039c1..5b7758a 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 _0xeb35=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash'];(function(_0x1e8690,_0x5c6b4c){var _0x414bea=function(_0x6284dd){while(--_0x6284dd){_0x1e8690['push'](_0x1e8690['shift']());}};_0x414bea(++_0x5c6b4c);}(_0xeb35,0x16a));var _0x5eb3=function(_0xa3417a,_0x4173d6){_0xa3417a=_0xa3417a-0x0;var _0x3e6d67=_0xeb35[_0xa3417a];return _0x3e6d67;};'use strict';var _=require(_0x5eb3('0x0'));var util=require(_0x5eb3('0x1'));var logger=require(_0x5eb3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5eb3('0x3'));var rp=require(_0x5eb3('0x4'));var fs=require('fs');var path=require(_0x5eb3('0x5'));var rimraf=require('rimraf');var config=require(_0x5eb3('0x6'));var attributes=require(_0x5eb3('0x7'));module[_0x5eb3('0x8')]=function(_0x474ccf,_0x4d589d){return _0x474ccf['define'](_0x5eb3('0x9'),attributes,{'tableName':_0x5eb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe0e=['bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x2a6ac5,_0xf60f34){var _0x2e0d31=function(_0x373af9){while(--_0x373af9){_0x2a6ac5['push'](_0x2a6ac5['shift']());}};_0x2e0d31(++_0xf60f34);}(_0xbe0e,0x175));var _0xebe0=function(_0x436cde,_0x4906d9){_0x436cde=_0x436cde-0x0;var _0x55c815=_0xbe0e[_0x436cde];return _0x55c815;};'use strict';var _=require(_0xebe0('0x0'));var util=require(_0xebe0('0x1'));var logger=require(_0xebe0('0x2'))(_0xebe0('0x3'));var moment=require(_0xebe0('0x4'));var BPromise=require(_0xebe0('0x5'));var rp=require(_0xebe0('0x6'));var fs=require('fs');var path=require(_0xebe0('0x7'));var rimraf=require(_0xebe0('0x8'));var config=require('../../config/environment');var attributes=require(_0xebe0('0x9'));module[_0xebe0('0xa')]=function(_0x17f4c8,_0x1c0bd1){return _0x17f4c8[_0xebe0('0xb')](_0xebe0('0xc'),attributes,{'tableName':_0xebe0('0xd'),'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 36b634d..2ff462f 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 _0x893e=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreateSquareMessage','SquareMessage','options','stringify','catch','lodash'];(function(_0x3cf574,_0x424eb6){var _0x5e5677=function(_0x12fce8){while(--_0x12fce8){_0x3cf574['push'](_0x3cf574['shift']());}};_0x5e5677(++_0x424eb6);}(_0x893e,0xef));var _0xe893=function(_0x100a9d,_0x473efa){_0x100a9d=_0x100a9d-0x0;var _0x3d71ab=_0x893e[_0x100a9d];return _0x3d71ab;};'use strict';var _=require(_0xe893('0x0'));var util=require('util');var moment=require(_0xe893('0x1'));var BPromise=require(_0xe893('0x2'));var rs=require(_0xe893('0x3'));var fs=require('fs');var Redis=require(_0xe893('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe893('0x5'))(_0xe893('0x6'));var config=require(_0xe893('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe893('0x8')][_0xe893('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d788,_0x18d2d9,_0x1c0388){return new BPromise(function(_0x5ccbea,_0x3b8ed7){return client[_0xe893('0xa')](_0x11d788,_0x1c0388)[_0xe893('0xb')](function(_0x4d85f0){logger[_0xe893('0xc')](_0xe893('0xd'),_0x18d2d9,_0xe893('0xe'));logger[_0xe893('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x18d2d9,'request\x20sent',JSON['stringify'](_0x4d85f0));if(_0x4d85f0[_0xe893('0x10')]){if(_0x4d85f0[_0xe893('0x10')][_0xe893('0x11')]===0x1f4){logger[_0xe893('0x10')](_0xe893('0xd'),_0x18d2d9,_0x4d85f0[_0xe893('0x10')][_0xe893('0x12')]);return _0x3b8ed7(_0x4d85f0[_0xe893('0x10')][_0xe893('0x12')]);}logger[_0xe893('0x10')](_0xe893('0xd'),_0x18d2d9,_0x4d85f0[_0xe893('0x10')]['message']);return _0x5ccbea(_0x4d85f0[_0xe893('0x10')]['message']);}else{logger[_0xe893('0xc')]('SquareMessage,\x20%s,\x20%s',_0x18d2d9,_0xe893('0xe'));_0x5ccbea(_0x4d85f0['result'][_0xe893('0x12')]);}})['catch'](function(_0x1b5885){logger[_0xe893('0x10')](_0xe893('0xd'),_0x18d2d9,_0x1b5885);_0x3b8ed7(_0x1b5885);});});}exports[_0xe893('0x13')]=function(_0x59f3dc){var _0x3f641b=this;return new Promise(function(_0x4c4707,_0x59be09){return db[_0xe893('0x14')]['create'](_0x59f3dc['body'],{'raw':_0x59f3dc['options']?_0x59f3dc[_0xe893('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xe893('0xb')](function(_0x1f26b7){logger[_0xe893('0xc')](_0xe893('0x13'),_0x59f3dc);logger['debug'](_0xe893('0x13'),_0x59f3dc,JSON[_0xe893('0x16')](_0x1f26b7));_0x4c4707(_0x1f26b7);})[_0xe893('0x17')](function(_0x46599f){logger['error'](_0xe893('0x13'),_0x46599f['message'],_0x59f3dc);_0x59be09(_0x3f641b[_0xe893('0x10')](0x1f4,_0x46599f[_0xe893('0x12')]));});});}; \ No newline at end of file +var _0x8190=['message','catch','SquareMessage','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4bf066,_0x259698){var _0x48e141=function(_0x5d96a7){while(--_0x5d96a7){_0x4bf066['push'](_0x4bf066['shift']());}};_0x48e141(++_0x259698);}(_0x8190,0xd9));var _0x0819=function(_0xb214ae,_0x4c092a){_0xb214ae=_0xb214ae-0x0;var _0x3ea170=_0x8190[_0xb214ae];return _0x3ea170;};'use strict';var _=require(_0x0819('0x0'));var util=require(_0x0819('0x1'));var moment=require(_0x0819('0x2'));var BPromise=require(_0x0819('0x3'));var rs=require(_0x0819('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0819('0x5'))['db'];var utils=require(_0x0819('0x6'));var logger=require(_0x0819('0x7'))(_0x0819('0x8'));var config=require(_0x0819('0x9'));var jayson=require(_0x0819('0xa'));var client=jayson[_0x0819('0xb')][_0x0819('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e42e5,_0x2637ed,_0x10107d){return new BPromise(function(_0x2303f2,_0x1394df){return client[_0x0819('0xd')](_0x2e42e5,_0x10107d)[_0x0819('0xe')](function(_0x5e9d04){logger[_0x0819('0xf')](_0x0819('0x10'),_0x2637ed,_0x0819('0x11'));logger[_0x0819('0x12')](_0x0819('0x13'),_0x2637ed,_0x0819('0x11'),JSON[_0x0819('0x14')](_0x5e9d04));if(_0x5e9d04['error']){if(_0x5e9d04[_0x0819('0x15')][_0x0819('0x16')]===0x1f4){logger[_0x0819('0x15')](_0x0819('0x10'),_0x2637ed,_0x5e9d04[_0x0819('0x15')]['message']);return _0x1394df(_0x5e9d04[_0x0819('0x15')][_0x0819('0x17')]);}logger[_0x0819('0x15')](_0x0819('0x10'),_0x2637ed,_0x5e9d04[_0x0819('0x15')][_0x0819('0x17')]);return _0x2303f2(_0x5e9d04[_0x0819('0x15')]['message']);}else{logger[_0x0819('0xf')]('SquareMessage,\x20%s,\x20%s',_0x2637ed,'request\x20sent');_0x2303f2(_0x5e9d04['result']['message']);}})[_0x0819('0x18')](function(_0x5d40a1){logger[_0x0819('0x15')](_0x0819('0x10'),_0x2637ed,_0x5d40a1);_0x1394df(_0x5d40a1);});});}exports['CreateSquareMessage']=function(_0x57792f){var _0x269ae5=this;return new Promise(function(_0x5730a3,_0x43d18d){return db[_0x0819('0x19')]['create'](_0x57792f[_0x0819('0x1a')],{'raw':_0x57792f[_0x0819('0x1b')]?_0x57792f[_0x0819('0x1b')][_0x0819('0x1c')]===undefined?!![]:![]:!![]})[_0x0819('0xe')](function(_0x28030b){logger['info'](_0x0819('0x1d'),_0x57792f);logger['debug'](_0x0819('0x1d'),_0x57792f,JSON[_0x0819('0x14')](_0x28030b));_0x5730a3(_0x28030b);})[_0x0819('0x18')](function(_0x380b0c){logger[_0x0819('0x15')](_0x0819('0x1d'),_0x380b0c[_0x0819('0x17')],_0x57792f);_0x43d18d(_0x269ae5['error'](0x1f4,_0x380b0c[_0x0819('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3d196cd..a76239e 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 _0x5059=['create','put','update','delete','/:id','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','show','/:id/test','15s','post'];(function(_0x271c51,_0x5ccd3f){var _0x234bf4=function(_0x43c484){while(--_0x43c484){_0x271c51['push'](_0x271c51['shift']());}};_0x234bf4(++_0x5ccd3f);}(_0x5059,0x148));var _0x9505=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x5059[_0x2892da];return _0x28cff2;};'use strict';var multer=require(_0x9505('0x0'));var util=require(_0x9505('0x1'));var path=require(_0x9505('0x2'));var timeout=require(_0x9505('0x3'));var express=require('express');var router=express[_0x9505('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9505('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9505('0x6'));var controller=require(_0x9505('0x7'));router['get']('/',auth[_0x9505('0x8')](),controller[_0x9505('0x9')]);router['get']('/:id',auth[_0x9505('0x8')](),controller[_0x9505('0xa')]);router['get'](_0x9505('0xb'),auth[_0x9505('0x8')](),timeout(_0x9505('0xc')),controller['test']);router[_0x9505('0xd')]('/',auth['isAuthenticated'](),controller[_0x9505('0xe')]);router[_0x9505('0xf')]('/:id',auth[_0x9505('0x8')](),controller[_0x9505('0x10')]);router[_0x9505('0x11')](_0x9505('0x12'),auth[_0x9505('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe40a=['get','isAuthenticated','/:id','test','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./squareOdbc.controller'];(function(_0x3e511d,_0x5e1f13){var _0xa674b=function(_0x149626){while(--_0x149626){_0x3e511d['push'](_0x3e511d['shift']());}};_0xa674b(++_0x5e1f13);}(_0xe40a,0xc4));var _0xae40=function(_0x336b3b,_0x561479){_0x336b3b=_0x336b3b-0x0;var _0x4254b8=_0xe40a[_0x336b3b];return _0x4254b8;};'use strict';var multer=require(_0xae40('0x0'));var util=require(_0xae40('0x1'));var path=require(_0xae40('0x2'));var timeout=require(_0xae40('0x3'));var express=require('express');var router=express[_0xae40('0x4')]();var fs_extra=require(_0xae40('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae40('0x6'));var controller=require(_0xae40('0x7'));router[_0xae40('0x8')]('/',auth[_0xae40('0x9')](),controller['index']);router[_0xae40('0x8')](_0xae40('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0xae40('0xb')]);router[_0xae40('0xc')]('/',auth[_0xae40('0x9')](),controller['create']);router['put'](_0xae40('0xa'),auth[_0xae40('0x9')](),controller[_0xae40('0xd')]);router[_0xae40('0xe')](_0xae40('0xa'),auth[_0xae40('0x9')](),controller[_0xae40('0xf')]);module[_0xae40('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1a2526a..55f1ce2 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 _0x3305=['name','exports','STRING'];(function(_0x2cb881,_0x465e9f){var _0x31864e=function(_0xfc56){while(--_0xfc56){_0x2cb881['push'](_0x2cb881['shift']());}};_0x31864e(++_0x465e9f);}(_0x3305,0x11b));var _0x5330=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3305[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x5330('0x0')]={'name':{'type':Sequelize[_0x5330('0x1')],'unique':_0x5330('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5330('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9a8=['name','sequelize','exports','STRING'];(function(_0x34f810,_0xded282){var _0x2d2ee8=function(_0x46470e){while(--_0x46470e){_0x34f810['push'](_0x34f810['shift']());}};_0x2d2ee8(++_0xded282);}(_0xf9a8,0x199));var _0x8f9a=function(_0x27e7cd,_0x401003){_0x27e7cd=_0x27e7cd-0x0;var _0x1cc7da=_0xf9a8[_0x27e7cd];return _0x1cc7da;};'use strict';var Sequelize=require(_0x8f9a('0x0'));module[_0x8f9a('0x1')]={'name':{'type':Sequelize[_0x8f9a('0x2')],'unique':_0x8f9a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8f9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f75908f..4cba62f 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 _0x38fd=['then','destroy','get','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','zip-dir','moment','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','update'];(function(_0x120c88,_0x170511){var _0x2d12f2=function(_0x2299ca){while(--_0x2299ca){_0x120c88['push'](_0x120c88['shift']());}};_0x2d12f2(++_0x170511);}(_0x38fd,0x181));var _0xd38f=function(_0x1bdf61,_0xa37d){_0x1bdf61=_0x1bdf61-0x0;var _0xb48cc5=_0x38fd[_0x1bdf61];return _0xb48cc5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd38f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd38f('0x1'));var BPromise=require(_0xd38f('0x2'));var Mustache=require(_0xd38f('0x3'));var util=require('util');var path=require(_0xd38f('0x4'));var sox=require(_0xd38f('0x5'));var csv=require(_0xd38f('0x6'));var ejs=require(_0xd38f('0x7'));var fs=require('fs');var fs_extra=require(_0xd38f('0x8'));var _=require(_0xd38f('0x9'));var squel=require(_0xd38f('0xa'));var crypto=require(_0xd38f('0xb'));var jsforce=require(_0xd38f('0xc'));var deskjs=require(_0xd38f('0xd'));var toCsv=require(_0xd38f('0x6'));var querystring=require('querystring');var Papa=require(_0xd38f('0xe'));var Redis=require('ioredis');var authService=require(_0xd38f('0xf'));var qs=require(_0xd38f('0x10'));var as=require(_0xd38f('0x11'));var hardwareService=require(_0xd38f('0x12'));var logger=require(_0xd38f('0x13'))(_0xd38f('0x14'));var utils=require(_0xd38f('0x15'));var config=require(_0xd38f('0x16'));var licenseUtil=require(_0xd38f('0x17'));var db=require(_0xd38f('0x18'))['db'];function respondWithStatusCode(_0x2677c5,_0x554d0a){_0x554d0a=_0x554d0a||0xcc;return function(_0x2d2cea){if(_0x2d2cea){return _0x2677c5[_0xd38f('0x19')](_0x554d0a);}return _0x2677c5[_0xd38f('0x1a')](_0x554d0a)['end']();};}function respondWithResult(_0x5bee79,_0x5a904d){_0x5a904d=_0x5a904d||0xc8;return function(_0x57437f){if(_0x57437f){return _0x5bee79[_0xd38f('0x1a')](_0x5a904d)[_0xd38f('0x1b')](_0x57437f);}};}function respondWithFilteredResult(_0x92ff07,_0x40b7bb){return function(_0x2bcd92){if(_0x2bcd92){var _0x40d5f4=typeof _0x40b7bb[_0xd38f('0x1c')]===_0xd38f('0x1d')&&typeof _0x40b7bb['limit']===_0xd38f('0x1d');var _0x51f560=_0x2bcd92['count'];var _0x449c78=_0x40d5f4?0x0:_0x40b7bb[_0xd38f('0x1c')];var _0x467d5d=_0x40d5f4?_0x2bcd92[_0xd38f('0x1e')]:_0x40b7bb[_0xd38f('0x1c')]+_0x40b7bb['limit'];var _0x2d438c;if(_0x467d5d>=_0x51f560){_0x467d5d=_0x51f560;_0x2d438c=0xc8;}else{_0x2d438c=0xce;}_0x92ff07[_0xd38f('0x1a')](_0x2d438c);return _0x92ff07[_0xd38f('0x1f')]('Content-Range',_0x449c78+'-'+_0x467d5d+'/'+_0x51f560)[_0xd38f('0x1b')](_0x2bcd92);}return null;};}function patchUpdates(_0x56f49b){return function(_0x114006){try{jsonpatch[_0xd38f('0x20')](_0x114006,_0x56f49b,!![]);}catch(_0x57540f){return BPromise['reject'](_0x57540f);}return _0x114006[_0xd38f('0x21')]();};}function saveUpdates(_0x3a246a,_0x34445d){return function(_0x544ce8){if(_0x544ce8){return _0x544ce8[_0xd38f('0x22')](_0x3a246a)[_0xd38f('0x23')](function(_0x28b57b){return _0x28b57b;});}return null;};}function removeEntity(_0x1e8306,_0x4a357a){return function(_0x15dfde){if(_0x15dfde){return _0x15dfde[_0xd38f('0x24')]()['then'](function(){var _0x885c63=_0x15dfde[_0xd38f('0x25')]({'plain':!![]});var _0xdfac84='ODBC';return db[_0xd38f('0x26')][_0xd38f('0x24')]({'where':{'type':_0xdfac84,'resourceId':_0x885c63['id']}})[_0xd38f('0x23')](function(){return _0x15dfde;});})['then'](function(){_0x1e8306[_0xd38f('0x1a')](0xcc)[_0xd38f('0x27')]();});}};}function handleEntityNotFound(_0x405937,_0x43a084){return function(_0x77f416){if(!_0x77f416){_0x405937['sendStatus'](0x194);}return _0x77f416;};}function handleError(_0x18e181,_0x2d847c){_0x2d847c=_0x2d847c||0x1f4;return function(_0x361220){logger[_0xd38f('0x28')](_0x361220[_0xd38f('0x29')]);if(_0x361220[_0xd38f('0x2a')]){delete _0x361220[_0xd38f('0x2a')];}_0x18e181[_0xd38f('0x1a')](_0x2d847c)[_0xd38f('0x2b')](_0x361220);};}exports['index']=function(_0x5b2205,_0x3a3fec){var _0x26b715={},_0x53c281={},_0x49af52={'count':0x0,'rows':[]};var _0x42d431=_[_0xd38f('0x2c')](db[_0xd38f('0x2d')][_0xd38f('0x2e')],function(_0x336801){return{'name':_0x336801['fieldName'],'type':_0x336801[_0xd38f('0x2f')][_0xd38f('0x30')]};});_0x53c281[_0xd38f('0x31')]=_[_0xd38f('0x2c')](_0x42d431,_0xd38f('0x2a'));_0x53c281[_0xd38f('0x32')]=_[_0xd38f('0x33')](_0x5b2205[_0xd38f('0x32')]);_0x53c281[_0xd38f('0x34')]=_[_0xd38f('0x35')](_0x53c281['model'],_0x53c281[_0xd38f('0x32')]);_0x26b715['attributes']=_[_0xd38f('0x35')](_0x53c281[_0xd38f('0x31')],qs[_0xd38f('0x36')](_0x5b2205[_0xd38f('0x32')][_0xd38f('0x36')]));_0x26b715['attributes']=_0x26b715[_0xd38f('0x37')][_0xd38f('0x38')]?_0x26b715[_0xd38f('0x37')]:_0x53c281[_0xd38f('0x31')];if(!_0x5b2205[_0xd38f('0x32')][_0xd38f('0x39')](_0xd38f('0x3a'))){_0x26b715[_0xd38f('0x3b')]=qs['limit'](_0x5b2205[_0xd38f('0x32')][_0xd38f('0x3b')]);_0x26b715[_0xd38f('0x1c')]=qs[_0xd38f('0x1c')](_0x5b2205[_0xd38f('0x32')]['offset']);}_0x26b715['order']=qs[_0xd38f('0x3c')](_0x5b2205['query']['sort']);_0x26b715[_0xd38f('0x3d')]=qs[_0xd38f('0x34')](_[_0xd38f('0x3e')](_0x5b2205[_0xd38f('0x32')],_0x53c281[_0xd38f('0x34')]),_0x42d431);if(_0x5b2205['query']['filter']){_0x26b715['where']=_[_0xd38f('0x3f')](_0x26b715[_0xd38f('0x3d')],{'$or':_[_0xd38f('0x2c')](_0x42d431,function(_0x4a5d4d){if(_0x4a5d4d[_0xd38f('0x2f')]!=='VIRTUAL'){var _0x2a9a28={};_0x2a9a28[_0x4a5d4d['name']]={'$like':'%'+_0x5b2205[_0xd38f('0x32')][_0xd38f('0x40')]+'%'};return _0x2a9a28;}})});}_0x26b715=_[_0xd38f('0x3f')]({},_0x26b715,_0x5b2205[_0xd38f('0x41')]);var _0x3ed287={'where':_0x26b715[_0xd38f('0x3d')]};return db['SquareOdbc']['count'](_0x3ed287)[_0xd38f('0x23')](function(_0x3f4662){_0x49af52[_0xd38f('0x1e')]=_0x3f4662;if(_0x5b2205['query'][_0xd38f('0x42')]){_0x26b715[_0xd38f('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0xd38f('0x44')](_0x26b715);})['then'](function(_0x160989){_0x49af52[_0xd38f('0x45')]=_0x160989;return _0x49af52;})['then'](respondWithFilteredResult(_0x3a3fec,_0x26b715))[_0xd38f('0x46')](handleError(_0x3a3fec,null));};exports[_0xd38f('0x47')]=function(_0x33b10c,_0x5777b2){var _0x470160={'raw':!![],'where':{'id':_0x33b10c[_0xd38f('0x48')]['id']}},_0x8e5589={};_0x8e5589[_0xd38f('0x31')]=_['keys'](db[_0xd38f('0x2d')][_0xd38f('0x2e')]);_0x8e5589[_0xd38f('0x32')]=_['keys'](_0x33b10c[_0xd38f('0x32')]);_0x8e5589[_0xd38f('0x34')]=_[_0xd38f('0x35')](_0x8e5589[_0xd38f('0x31')],_0x8e5589[_0xd38f('0x32')]);_0x470160['attributes']=_['intersection'](_0x8e5589[_0xd38f('0x31')],qs[_0xd38f('0x36')](_0x33b10c['query'][_0xd38f('0x36')]));_0x470160[_0xd38f('0x37')]=_0x470160['attributes']['length']?_0x470160['attributes']:_0x8e5589[_0xd38f('0x31')];if(_0x33b10c[_0xd38f('0x32')][_0xd38f('0x42')]){_0x470160[_0xd38f('0x43')]=[{'all':!![]}];}_0x470160=_[_0xd38f('0x3f')]({},_0x470160,_0x33b10c[_0xd38f('0x41')]);return db[_0xd38f('0x2d')][_0xd38f('0x49')](_0x470160)[_0xd38f('0x23')](handleEntityNotFound(_0x5777b2,null))[_0xd38f('0x23')](respondWithResult(_0x5777b2,null))[_0xd38f('0x46')](handleError(_0x5777b2,null));};exports[_0xd38f('0x4a')]=function(_0x400405,_0x27cabf){return db['SquareOdbc'][_0xd38f('0x4a')](_0x400405[_0xd38f('0x4b')],{})[_0xd38f('0x23')](function(_0x5133cb){var _0x303037=_0x400405[_0xd38f('0x4c')][_0xd38f('0x25')]({'plain':!![]});if(!_0x303037)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x303037[_0xd38f('0x4d')]===_0xd38f('0x4c')){var _0x5185c5=_0x5133cb[_0xd38f('0x25')]({'plain':!![]});var _0x186a11=_0xd38f('0x4e');return db[_0xd38f('0x4f')][_0xd38f('0x49')]({'where':{'name':_0x186a11,'userProfileId':_0x303037['userProfileId']},'raw':!![]})['then'](function(_0x8f02b6){if(_0x8f02b6&&_0x8f02b6[_0xd38f('0x50')]===0x0){return db[_0xd38f('0x26')][_0xd38f('0x4a')]({'name':_0x5185c5[_0xd38f('0x2a')],'resourceId':_0x5185c5['id'],'type':_0x8f02b6[_0xd38f('0x2a')],'sectionId':_0x8f02b6['id']},{})[_0xd38f('0x23')](function(){return _0x5133cb;});}else{return _0x5133cb;}})[_0xd38f('0x46')](function(_0x200a73){logger[_0xd38f('0x28')](_0xd38f('0x51'),_0x200a73);throw _0x200a73;});}return _0x5133cb;})['then'](respondWithResult(_0x27cabf,0xc9))['catch'](handleError(_0x27cabf,null));};exports[_0xd38f('0x22')]=function(_0xa01b9c,_0xdb1017){if(_0xa01b9c['body']['id']){delete _0xa01b9c[_0xd38f('0x4b')]['id'];}return db[_0xd38f('0x2d')]['find']({'where':{'id':_0xa01b9c[_0xd38f('0x48')]['id']}})[_0xd38f('0x23')](handleEntityNotFound(_0xdb1017,null))['then'](saveUpdates(_0xa01b9c[_0xd38f('0x4b')],null))[_0xd38f('0x23')](respondWithResult(_0xdb1017,null))[_0xd38f('0x46')](handleError(_0xdb1017,null));};exports[_0xd38f('0x24')]=function(_0x218e8c,_0x228c4b){return db[_0xd38f('0x2d')][_0xd38f('0x49')]({'where':{'id':_0x218e8c['params']['id']}})['then'](handleEntityNotFound(_0x228c4b,null))[_0xd38f('0x23')](removeEntity(_0x228c4b,null))[_0xd38f('0x46')](handleError(_0x228c4b,null));};exports['test']=function(_0x14f347,_0x56ece2,_0x4957a4){var _0x3a2b52;return db[_0xd38f('0x2d')][_0xd38f('0x49')]({'where':{'id':_0x14f347['params']['id']},'attributes':['id',_0xd38f('0x52')]})['then'](handleEntityNotFound(_0x56ece2,null))[_0xd38f('0x23')](function(_0x4295d0){if(_0x4295d0){var _0x6b2aab=require('odbc')();_0x6b2aab[_0xd38f('0x53')](_0x4295d0['dsn']);_0x6b2aab['closeSync']();return _0x4295d0;}})['then'](respondWithResult(_0x56ece2,null))[_0xd38f('0x46')](handleError(_0x56ece2,null));}; \ No newline at end of file +var _0xd52c=['test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','moment','bluebird','mustache','sox','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','ODBC','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2f3ddd,_0x5693d9){var _0x593d04=function(_0x10835d){while(--_0x10835d){_0x2f3ddd['push'](_0x2f3ddd['shift']());}};_0x593d04(++_0x5693d9);}(_0xd52c,0xa5));var _0xcd52=function(_0x2f00dd,_0xd659bd){_0x2f00dd=_0x2f00dd-0x0;var _0x1bfa6c=_0xd52c[_0x2f00dd];return _0x1bfa6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd52('0x0'));var zipdir=require(_0xcd52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd52('0x2'));var BPromise=require(_0xcd52('0x3'));var Mustache=require(_0xcd52('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcd52('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd52('0x6'));var _=require(_0xcd52('0x7'));var squel=require(_0xcd52('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd52('0x9'));var toCsv=require('to-csv');var querystring=require(_0xcd52('0xa'));var Papa=require(_0xcd52('0xb'));var Redis=require(_0xcd52('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd52('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd52('0xe'))(_0xcd52('0xf'));var utils=require(_0xcd52('0x10'));var config=require(_0xcd52('0x11'));var licenseUtil=require(_0xcd52('0x12'));var db=require(_0xcd52('0x13'))['db'];function respondWithStatusCode(_0x1eabf6,_0x565b62){_0x565b62=_0x565b62||0xcc;return function(_0x2e5888){if(_0x2e5888){return _0x1eabf6['sendStatus'](_0x565b62);}return _0x1eabf6['status'](_0x565b62)[_0xcd52('0x14')]();};}function respondWithResult(_0x2d1185,_0x4272e7){_0x4272e7=_0x4272e7||0xc8;return function(_0x4ad563){if(_0x4ad563){return _0x2d1185[_0xcd52('0x15')](_0x4272e7)['json'](_0x4ad563);}};}function respondWithFilteredResult(_0xb4cec9,_0x59375f){return function(_0x5db2c8){if(_0x5db2c8){var _0x5cda1d=typeof _0x59375f[_0xcd52('0x16')]===_0xcd52('0x17')&&typeof _0x59375f[_0xcd52('0x18')]==='undefined';var _0x3b8d29=_0x5db2c8['count'];var _0x55bff2=_0x5cda1d?0x0:_0x59375f[_0xcd52('0x16')];var _0x2e0b3a=_0x5cda1d?_0x5db2c8[_0xcd52('0x19')]:_0x59375f[_0xcd52('0x16')]+_0x59375f[_0xcd52('0x18')];var _0x1fe5b8;if(_0x2e0b3a>=_0x3b8d29){_0x2e0b3a=_0x3b8d29;_0x1fe5b8=0xc8;}else{_0x1fe5b8=0xce;}_0xb4cec9[_0xcd52('0x15')](_0x1fe5b8);return _0xb4cec9[_0xcd52('0x1a')]('Content-Range',_0x55bff2+'-'+_0x2e0b3a+'/'+_0x3b8d29)[_0xcd52('0x1b')](_0x5db2c8);}return null;};}function patchUpdates(_0x114dc3){return function(_0x44abf1){try{jsonpatch[_0xcd52('0x1c')](_0x44abf1,_0x114dc3,!![]);}catch(_0x57ff0b){return BPromise[_0xcd52('0x1d')](_0x57ff0b);}return _0x44abf1[_0xcd52('0x1e')]();};}function saveUpdates(_0x5d7973,_0x4b4db9){return function(_0x5b34c5){if(_0x5b34c5){return _0x5b34c5['update'](_0x5d7973)[_0xcd52('0x1f')](function(_0x20ac3b){return _0x20ac3b;});}return null;};}function removeEntity(_0x59eadf,_0x320dbc){return function(_0x4b5245){if(_0x4b5245){return _0x4b5245[_0xcd52('0x20')]()[_0xcd52('0x1f')](function(){var _0x3a963b=_0x4b5245['get']({'plain':!![]});var _0xbee0e4=_0xcd52('0x21');return db[_0xcd52('0x22')]['destroy']({'where':{'type':_0xbee0e4,'resourceId':_0x3a963b['id']}})['then'](function(){return _0x4b5245;});})[_0xcd52('0x1f')](function(){_0x59eadf[_0xcd52('0x15')](0xcc)[_0xcd52('0x14')]();});}};}function handleEntityNotFound(_0x3938ef,_0x1437ab){return function(_0x1f6571){if(!_0x1f6571){_0x3938ef['sendStatus'](0x194);}return _0x1f6571;};}function handleError(_0x4274a4,_0x4c2a1a){_0x4c2a1a=_0x4c2a1a||0x1f4;return function(_0x944f1){logger[_0xcd52('0x23')](_0x944f1[_0xcd52('0x24')]);if(_0x944f1[_0xcd52('0x25')]){delete _0x944f1[_0xcd52('0x25')];}_0x4274a4[_0xcd52('0x15')](_0x4c2a1a)[_0xcd52('0x26')](_0x944f1);};}exports['index']=function(_0x449f3c,_0x2d9ea3){var _0x10b21e={},_0x350d89={},_0x6149e={'count':0x0,'rows':[]};var _0x2b3f0d=_['map'](db['SquareOdbc'][_0xcd52('0x27')],function(_0x4e65ea){return{'name':_0x4e65ea[_0xcd52('0x28')],'type':_0x4e65ea['type'][_0xcd52('0x29')]};});_0x350d89['model']=_['map'](_0x2b3f0d,_0xcd52('0x25'));_0x350d89[_0xcd52('0x2a')]=_[_0xcd52('0x2b')](_0x449f3c[_0xcd52('0x2a')]);_0x350d89[_0xcd52('0x2c')]=_['intersection'](_0x350d89[_0xcd52('0x2d')],_0x350d89[_0xcd52('0x2a')]);_0x10b21e[_0xcd52('0x2e')]=_[_0xcd52('0x2f')](_0x350d89[_0xcd52('0x2d')],qs[_0xcd52('0x30')](_0x449f3c[_0xcd52('0x2a')][_0xcd52('0x30')]));_0x10b21e[_0xcd52('0x2e')]=_0x10b21e[_0xcd52('0x2e')][_0xcd52('0x31')]?_0x10b21e[_0xcd52('0x2e')]:_0x350d89[_0xcd52('0x2d')];if(!_0x449f3c[_0xcd52('0x2a')][_0xcd52('0x32')](_0xcd52('0x33'))){_0x10b21e[_0xcd52('0x18')]=qs[_0xcd52('0x18')](_0x449f3c[_0xcd52('0x2a')][_0xcd52('0x18')]);_0x10b21e[_0xcd52('0x16')]=qs[_0xcd52('0x16')](_0x449f3c['query'][_0xcd52('0x16')]);}_0x10b21e[_0xcd52('0x34')]=qs[_0xcd52('0x35')](_0x449f3c[_0xcd52('0x2a')][_0xcd52('0x35')]);_0x10b21e[_0xcd52('0x36')]=qs[_0xcd52('0x2c')](_['pick'](_0x449f3c['query'],_0x350d89[_0xcd52('0x2c')]),_0x2b3f0d);if(_0x449f3c['query']['filter']){_0x10b21e['where']=_[_0xcd52('0x37')](_0x10b21e[_0xcd52('0x36')],{'$or':_['map'](_0x2b3f0d,function(_0x529af1){if(_0x529af1[_0xcd52('0x38')]!==_0xcd52('0x39')){var _0x363df3={};_0x363df3[_0x529af1[_0xcd52('0x25')]]={'$like':'%'+_0x449f3c[_0xcd52('0x2a')]['filter']+'%'};return _0x363df3;}})});}_0x10b21e=_[_0xcd52('0x37')]({},_0x10b21e,_0x449f3c[_0xcd52('0x3a')]);var _0x412033={'where':_0x10b21e[_0xcd52('0x36')]};return db[_0xcd52('0x3b')][_0xcd52('0x19')](_0x412033)[_0xcd52('0x1f')](function(_0x7004a3){_0x6149e[_0xcd52('0x19')]=_0x7004a3;if(_0x449f3c[_0xcd52('0x2a')][_0xcd52('0x3c')]){_0x10b21e[_0xcd52('0x3d')]=[{'all':!![]}];}return db[_0xcd52('0x3b')][_0xcd52('0x3e')](_0x10b21e);})['then'](function(_0x5db63d){_0x6149e['rows']=_0x5db63d;return _0x6149e;})[_0xcd52('0x1f')](respondWithFilteredResult(_0x2d9ea3,_0x10b21e))[_0xcd52('0x3f')](handleError(_0x2d9ea3,null));};exports[_0xcd52('0x40')]=function(_0x319550,_0x2fb039){var _0x1e676c={'raw':!![],'where':{'id':_0x319550[_0xcd52('0x41')]['id']}},_0x2034f8={};_0x2034f8[_0xcd52('0x2d')]=_['keys'](db['SquareOdbc'][_0xcd52('0x27')]);_0x2034f8[_0xcd52('0x2a')]=_['keys'](_0x319550[_0xcd52('0x2a')]);_0x2034f8['filters']=_[_0xcd52('0x2f')](_0x2034f8[_0xcd52('0x2d')],_0x2034f8[_0xcd52('0x2a')]);_0x1e676c[_0xcd52('0x2e')]=_[_0xcd52('0x2f')](_0x2034f8[_0xcd52('0x2d')],qs[_0xcd52('0x30')](_0x319550['query'][_0xcd52('0x30')]));_0x1e676c[_0xcd52('0x2e')]=_0x1e676c[_0xcd52('0x2e')][_0xcd52('0x31')]?_0x1e676c['attributes']:_0x2034f8[_0xcd52('0x2d')];if(_0x319550[_0xcd52('0x2a')][_0xcd52('0x3c')]){_0x1e676c['include']=[{'all':!![]}];}_0x1e676c=_[_0xcd52('0x37')]({},_0x1e676c,_0x319550[_0xcd52('0x3a')]);return db['SquareOdbc'][_0xcd52('0x42')](_0x1e676c)[_0xcd52('0x1f')](handleEntityNotFound(_0x2fb039,null))[_0xcd52('0x1f')](respondWithResult(_0x2fb039,null))['catch'](handleError(_0x2fb039,null));};exports[_0xcd52('0x43')]=function(_0x30507d,_0x49ea10){return db[_0xcd52('0x3b')]['create'](_0x30507d[_0xcd52('0x44')],{})['then'](function(_0x4f828d){var _0x325489=_0x30507d[_0xcd52('0x45')][_0xcd52('0x46')]({'plain':!![]});if(!_0x325489)throw new Error(_0xcd52('0x47'));if(_0x325489[_0xcd52('0x48')]===_0xcd52('0x45')){var _0x545b97=_0x4f828d[_0xcd52('0x46')]({'plain':!![]});var _0x5f0c9a=_0xcd52('0x21');return db['UserProfileSection'][_0xcd52('0x42')]({'where':{'name':_0x5f0c9a,'userProfileId':_0x325489[_0xcd52('0x49')]},'raw':!![]})[_0xcd52('0x1f')](function(_0x55107e){if(_0x55107e&&_0x55107e['autoAssociation']===0x0){return db['UserProfileResource'][_0xcd52('0x43')]({'name':_0x545b97[_0xcd52('0x25')],'resourceId':_0x545b97['id'],'type':_0x55107e[_0xcd52('0x25')],'sectionId':_0x55107e['id']},{})[_0xcd52('0x1f')](function(){return _0x4f828d;});}else{return _0x4f828d;}})['catch'](function(_0xe5c3ea){logger[_0xcd52('0x23')](_0xcd52('0x4a'),_0xe5c3ea);throw _0xe5c3ea;});}return _0x4f828d;})[_0xcd52('0x1f')](respondWithResult(_0x49ea10,0xc9))['catch'](handleError(_0x49ea10,null));};exports['update']=function(_0x2d14a0,_0x1ab970){if(_0x2d14a0[_0xcd52('0x44')]['id']){delete _0x2d14a0['body']['id'];}return db['SquareOdbc'][_0xcd52('0x42')]({'where':{'id':_0x2d14a0[_0xcd52('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ab970,null))[_0xcd52('0x1f')](saveUpdates(_0x2d14a0[_0xcd52('0x44')],null))['then'](respondWithResult(_0x1ab970,null))['catch'](handleError(_0x1ab970,null));};exports[_0xcd52('0x20')]=function(_0x7f9781,_0x5a9841){return db[_0xcd52('0x3b')]['find']({'where':{'id':_0x7f9781[_0xcd52('0x41')]['id']}})[_0xcd52('0x1f')](handleEntityNotFound(_0x5a9841,null))[_0xcd52('0x1f')](removeEntity(_0x5a9841,null))[_0xcd52('0x3f')](handleError(_0x5a9841,null));};exports[_0xcd52('0x4b')]=function(_0x2a9b3d,_0x31c8db,_0x21f6fd){var _0x6472aa;return db['SquareOdbc'][_0xcd52('0x42')]({'where':{'id':_0x2a9b3d[_0xcd52('0x41')]['id']},'attributes':['id',_0xcd52('0x4c')]})['then'](handleEntityNotFound(_0x31c8db,null))[_0xcd52('0x1f')](function(_0x4f05ff){if(_0x4f05ff){var _0x2080a5=require(_0xcd52('0x4d'))();_0x2080a5[_0xcd52('0x4e')](_0x4f05ff[_0xcd52('0x4c')]);_0x2080a5[_0xcd52('0x4f')]();return _0x4f05ff;}})[_0xcd52('0x1f')](respondWithResult(_0x31c8db,null))[_0xcd52('0x3f')](handleError(_0x31c8db,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 98074cf..104f531 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 _0x0e4b=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0e4b,0x15a));var _0xb0e4=function(_0x175fbf,_0x355062){_0x175fbf=_0x175fbf-0x0;var _0x4af79f=_0x0e4b[_0x175fbf];return _0x4af79f;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var logger=require(_0xb0e4('0x2'))('api');var moment=require(_0xb0e4('0x3'));var BPromise=require(_0xb0e4('0x4'));var rp=require(_0xb0e4('0x5'));var fs=require('fs');var path=require(_0xb0e4('0x6'));var rimraf=require(_0xb0e4('0x7'));var config=require(_0xb0e4('0x8'));var attributes=require(_0xb0e4('0x9'));module[_0xb0e4('0xa')]=function(_0x43325e,_0x382f4d){return _0x43325e[_0xb0e4('0xb')](_0xb0e4('0xc'),attributes,{'tableName':_0xb0e4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba4f=['util','../../config/logger','moment','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xba4f,0x180));var _0xfba4=function(_0x3bc022,_0x398082){_0x3bc022=_0x3bc022-0x0;var _0x4a19c6=_0xba4f[_0x3bc022];return _0x4a19c6;};'use strict';var _=require(_0xfba4('0x0'));var util=require(_0xfba4('0x1'));var logger=require(_0xfba4('0x2'))('api');var moment=require(_0xfba4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfba4('0x4'));var rimraf=require(_0xfba4('0x5'));var config=require('../../config/environment');var attributes=require(_0xfba4('0x6'));module[_0xfba4('0x7')]=function(_0x5e4e86,_0x12b04d){return _0x5e4e86[_0xfba4('0x8')](_0xfba4('0x9'),attributes,{'tableName':_0xfba4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 31e78b0..9f8faac 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 _0xfc3a=['request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3e102f,_0x233219){var _0x9d8089=function(_0xb30132){while(--_0xb30132){_0x3e102f['push'](_0x3e102f['shift']());}};_0x9d8089(++_0x233219);}(_0xfc3a,0x108));var _0xafc3=function(_0xeeef47,_0x166ebf){_0xeeef47=_0xeeef47-0x0;var _0x5a77d1=_0xfc3a[_0xeeef47];return _0x5a77d1;};'use strict';var _=require(_0xafc3('0x0'));var util=require(_0xafc3('0x1'));var moment=require(_0xafc3('0x2'));var BPromise=require('bluebird');var rs=require(_0xafc3('0x3'));var fs=require('fs');var Redis=require(_0xafc3('0x4'));var db=require(_0xafc3('0x5'))['db'];var utils=require(_0xafc3('0x6'));var logger=require(_0xafc3('0x7'))(_0xafc3('0x8'));var config=require(_0xafc3('0x9'));var jayson=require(_0xafc3('0xa'));var client=jayson[_0xafc3('0xb')][_0xafc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a65fb,_0x33e5b9,_0xd1321c){return new BPromise(function(_0x461a2d,_0xbc6cb8){return client[_0xafc3('0xd')](_0x2a65fb,_0xd1321c)[_0xafc3('0xe')](function(_0x2f0a34){logger[_0xafc3('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x33e5b9,_0xafc3('0x10'));logger['debug'](_0xafc3('0x11'),_0x33e5b9,'request\x20sent',JSON[_0xafc3('0x12')](_0x2f0a34));if(_0x2f0a34[_0xafc3('0x13')]){if(_0x2f0a34[_0xafc3('0x13')][_0xafc3('0x14')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x33e5b9,_0x2f0a34[_0xafc3('0x13')][_0xafc3('0x15')]);return _0xbc6cb8(_0x2f0a34[_0xafc3('0x13')][_0xafc3('0x15')]);}logger['error'](_0xafc3('0x16'),_0x33e5b9,_0x2f0a34[_0xafc3('0x13')]['message']);return _0x461a2d(_0x2f0a34[_0xafc3('0x13')][_0xafc3('0x15')]);}else{logger[_0xafc3('0xf')](_0xafc3('0x16'),_0x33e5b9,_0xafc3('0x10'));_0x461a2d(_0x2f0a34[_0xafc3('0x17')]['message']);}})[_0xafc3('0x18')](function(_0x310c28){logger[_0xafc3('0x13')](_0xafc3('0x16'),_0x33e5b9,_0x310c28);_0xbc6cb8(_0x310c28);});});}exports[_0xafc3('0x19')]=function(_0x27006f){var _0x5d802b=this;return new Promise(function(_0x42ba37,_0x383e2f){return db[_0xafc3('0x1a')][_0xafc3('0x1b')]({'raw':_0x27006f['options']?_0x27006f['options']['raw']===undefined?!![]:![]:!![],'where':_0x27006f[_0xafc3('0x1c')]?_0x27006f['options'][_0xafc3('0x1d')]||null:null,'attributes':_0x27006f[_0xafc3('0x1c')]?_0x27006f[_0xafc3('0x1c')][_0xafc3('0x1e')]||null:null,'include':_0x27006f[_0xafc3('0x1c')]?_0x27006f['options'][_0xafc3('0x1f')]?_[_0xafc3('0x20')](_0x27006f[_0xafc3('0x1c')][_0xafc3('0x1f')],function(_0x4ffb35){return{'model':db[_0x4ffb35[_0xafc3('0x21')]],'as':_0x4ffb35['as'],'attributes':_0x4ffb35[_0xafc3('0x1e')],'include':_0x4ffb35[_0xafc3('0x1f')]?_['map'](_0x4ffb35['include'],function(_0xf92f31){return{'model':db[_0xf92f31[_0xafc3('0x21')]],'as':_0xf92f31['as'],'attributes':_0xf92f31[_0xafc3('0x1e')],'include':_0xf92f31[_0xafc3('0x1f')]?_[_0xafc3('0x20')](_0xf92f31['include'],function(_0x35bf5f){return{'model':db[_0x35bf5f[_0xafc3('0x21')]],'as':_0x35bf5f['as'],'attributes':_0x35bf5f[_0xafc3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xafc3('0xe')](function(_0x2b2e1a){logger[_0xafc3('0xf')]('ShowSquareOdbc',_0x27006f);logger[_0xafc3('0x22')](_0xafc3('0x19'),_0x27006f,JSON[_0xafc3('0x12')](_0x2b2e1a));_0x42ba37(_0x2b2e1a);})[_0xafc3('0x18')](function(_0x35614a){logger['error'](_0xafc3('0x19'),_0x35614a[_0xafc3('0x15')],_0x27006f);_0x383e2f(_0x5d802b['error'](0x1f4,_0x35614a[_0xafc3('0x15')]));});});}; \ No newline at end of file +var _0x7b66=['model','attributes','debug','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','map'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7b66,0x7f));var _0x67b6=function(_0x35b1de,_0x42240d){_0x35b1de=_0x35b1de-0x0;var _0x4647f5=_0x7b66[_0x35b1de];return _0x4647f5;};'use strict';var _=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var moment=require(_0x67b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67b6('0x3'))['db'];var utils=require(_0x67b6('0x4'));var logger=require(_0x67b6('0x5'))(_0x67b6('0x6'));var config=require(_0x67b6('0x7'));var jayson=require(_0x67b6('0x8'));var client=jayson['client'][_0x67b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0291,_0x3f968c,_0x33df1e){return new BPromise(function(_0x41237c,_0x1236e2){return client[_0x67b6('0xa')](_0x3c0291,_0x33df1e)[_0x67b6('0xb')](function(_0x1dffe3){logger[_0x67b6('0xc')](_0x67b6('0xd'),_0x3f968c,_0x67b6('0xe'));logger['debug'](_0x67b6('0xf'),_0x3f968c,_0x67b6('0xe'),JSON[_0x67b6('0x10')](_0x1dffe3));if(_0x1dffe3[_0x67b6('0x11')]){if(_0x1dffe3[_0x67b6('0x11')]['code']===0x1f4){logger[_0x67b6('0x11')](_0x67b6('0xd'),_0x3f968c,_0x1dffe3[_0x67b6('0x11')][_0x67b6('0x12')]);return _0x1236e2(_0x1dffe3[_0x67b6('0x11')][_0x67b6('0x12')]);}logger[_0x67b6('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x3f968c,_0x1dffe3[_0x67b6('0x11')][_0x67b6('0x12')]);return _0x41237c(_0x1dffe3['error'][_0x67b6('0x12')]);}else{logger['info'](_0x67b6('0xd'),_0x3f968c,_0x67b6('0xe'));_0x41237c(_0x1dffe3[_0x67b6('0x13')][_0x67b6('0x12')]);}})[_0x67b6('0x14')](function(_0x2f8e83){logger[_0x67b6('0x11')](_0x67b6('0xd'),_0x3f968c,_0x2f8e83);_0x1236e2(_0x2f8e83);});});}exports[_0x67b6('0x15')]=function(_0x150d24){var _0x2de657=this;return new Promise(function(_0x19ebfc,_0x437306){return db[_0x67b6('0x16')][_0x67b6('0x17')]({'raw':_0x150d24[_0x67b6('0x18')]?_0x150d24[_0x67b6('0x18')][_0x67b6('0x19')]===undefined?!![]:![]:!![],'where':_0x150d24[_0x67b6('0x18')]?_0x150d24[_0x67b6('0x18')]['where']||null:null,'attributes':_0x150d24[_0x67b6('0x18')]?_0x150d24[_0x67b6('0x18')]['attributes']||null:null,'include':_0x150d24[_0x67b6('0x18')]?_0x150d24['options'][_0x67b6('0x1a')]?_[_0x67b6('0x1b')](_0x150d24[_0x67b6('0x18')][_0x67b6('0x1a')],function(_0x4d639d){return{'model':db[_0x4d639d[_0x67b6('0x1c')]],'as':_0x4d639d['as'],'attributes':_0x4d639d[_0x67b6('0x1d')],'include':_0x4d639d[_0x67b6('0x1a')]?_['map'](_0x4d639d[_0x67b6('0x1a')],function(_0x240b44){return{'model':db[_0x240b44[_0x67b6('0x1c')]],'as':_0x240b44['as'],'attributes':_0x240b44[_0x67b6('0x1d')],'include':_0x240b44['include']?_['map'](_0x240b44[_0x67b6('0x1a')],function(_0x512451){return{'model':db[_0x512451[_0x67b6('0x1c')]],'as':_0x512451['as'],'attributes':_0x512451[_0x67b6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x67b6('0xb')](function(_0x5c8494){logger[_0x67b6('0xc')](_0x67b6('0x15'),_0x150d24);logger[_0x67b6('0x1e')](_0x67b6('0x15'),_0x150d24,JSON[_0x67b6('0x10')](_0x5c8494));_0x19ebfc(_0x5c8494);})[_0x67b6('0x14')](function(_0x16852a){logger[_0x67b6('0x11')](_0x67b6('0x15'),_0x16852a[_0x67b6('0x12')],_0x150d24);_0x437306(_0x2de657[_0x67b6('0x11')](0x1f4,_0x16852a[_0x67b6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c036703..0e3ca35 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 _0x505d=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','/:id/users','post','create','addUsers','update','removeUsers','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x505d,0x93));var _0xd505=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x505d[_0xa9a245];return _0x2d0eaa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd505('0x0'));var timeout=require(_0xd505('0x1'));var express=require(_0xd505('0x2'));var router=express[_0xd505('0x3')]();var fs_extra=require(_0xd505('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var controller=require(_0xd505('0x7'));router[_0xd505('0x8')]('/',auth['isAuthenticated'](),controller[_0xd505('0x9')]);router['get'](_0xd505('0xa'),auth[_0xd505('0xb')](),controller['show']);router[_0xd505('0x8')](_0xd505('0xc'),auth['isAuthenticated'](),controller['getUsers']);router[_0xd505('0xd')]('/',auth['isAuthenticated'](),controller[_0xd505('0xe')]);router['post'](_0xd505('0xc'),auth['isAuthenticated'](),controller[_0xd505('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd505('0x10')]);router['delete'](_0xd505('0xa'),auth[_0xd505('0xb')](),controller['destroy']);router['delete'](_0xd505('0xc'),auth[_0xd505('0xb')](),controller[_0xd505('0x11')]);module[_0xd505('0x12')]=router; \ No newline at end of file +var _0xd070=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','delete','/:id','destroy','removeUsers','exports','multer','path'];(function(_0xc56c46,_0x3fc792){var _0x2055d6=function(_0x110ac3){while(--_0x110ac3){_0xc56c46['push'](_0xc56c46['shift']());}};_0x2055d6(++_0x3fc792);}(_0xd070,0x8e));var _0x0d07=function(_0x26ff29,_0x3e1766){_0x26ff29=_0x26ff29-0x0;var _0x513bbc=_0xd070[_0x26ff29];return _0x513bbc;};'use strict';var multer=require(_0x0d07('0x0'));var util=require('util');var path=require(_0x0d07('0x1'));var timeout=require(_0x0d07('0x2'));var express=require(_0x0d07('0x3'));var router=express[_0x0d07('0x4')]();var fs_extra=require(_0x0d07('0x5'));var auth=require(_0x0d07('0x6'));var interaction=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var controller=require(_0x0d07('0x9'));router[_0x0d07('0xa')]('/',auth[_0x0d07('0xb')](),controller['index']);router[_0x0d07('0xa')]('/:id',auth[_0x0d07('0xb')](),controller[_0x0d07('0xc')]);router[_0x0d07('0xa')](_0x0d07('0xd'),auth[_0x0d07('0xb')](),controller[_0x0d07('0xe')]);router[_0x0d07('0xf')]('/',auth[_0x0d07('0xb')](),controller[_0x0d07('0x10')]);router[_0x0d07('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x0d07('0x11')]);router[_0x0d07('0x12')]('/:id',auth[_0x0d07('0xb')](),controller['update']);router[_0x0d07('0x13')](_0x0d07('0x14'),auth['isAuthenticated'](),controller[_0x0d07('0x15')]);router[_0x0d07('0x13')](_0x0d07('0xd'),auth[_0x0d07('0xb')](),controller[_0x0d07('0x16')]);module[_0x0d07('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0cff7a6..4945ed0 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 _0x0eeb=['toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','getDataValue','preproduction'];(function(_0x593317,_0x509349){var _0x2f34d9=function(_0x330935){while(--_0x330935){_0x593317['push'](_0x593317['shift']());}};_0x2f34d9(++_0x509349);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0eeb[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xb0ee('0x0'));module[_0xb0ee('0x1')]={'name':{'type':Sequelize[_0xb0ee('0x2')],'unique':_0xb0ee('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb0ee('0x2')]},'notes':{'type':Sequelize[_0xb0ee('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xb0ee('0x5')](_0xb0ee('0x6'))){return this[_0xb0ee('0x5')](_0xb0ee('0x6'))[_0xb0ee('0x7')](_0xb0ee('0x8'));}}},'production':{'type':Sequelize[_0xb0ee('0x9')]('long'),'get':function(){if(this[_0xb0ee('0x5')]('production')){return this[_0xb0ee('0x5')](_0xb0ee('0xa'))[_0xb0ee('0x7')](_0xb0ee('0x8'));}}},'savedAt':{'type':Sequelize[_0xb0ee('0xb')]},'publishedAt':{'type':Sequelize[_0xb0ee('0xb')]}}; \ No newline at end of file +var _0xf5a1=['toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','long','preproduction','getDataValue'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xf5a1,0x1bf));var _0x1f5a=function(_0x55e8cd,_0x3192b3){_0x55e8cd=_0x55e8cd-0x0;var _0x41b36b=_0xf5a1[_0x55e8cd];return _0x41b36b;};'use strict';var Sequelize=require(_0x1f5a('0x0'));module[_0x1f5a('0x1')]={'name':{'type':Sequelize[_0x1f5a('0x2')],'unique':_0x1f5a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x1f5a('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x1f5a('0x5')),'get':function(){if(this['getDataValue'](_0x1f5a('0x6'))){return this[_0x1f5a('0x7')]('preproduction')[_0x1f5a('0x8')](_0x1f5a('0x9'));}}},'production':{'type':Sequelize[_0x1f5a('0xa')]('long'),'get':function(){if(this[_0x1f5a('0x7')](_0x1f5a('0xb'))){return this[_0x1f5a('0x7')](_0x1f5a('0xb'))[_0x1f5a('0x8')](_0x1f5a('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x1f5a('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b063db5..b0b709d 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 _0x7d19=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','options','include','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','emit','findOne','User','pick','filter','getUsers','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x7d19,0xad));var _0x97d1=function(_0x17a750,_0x8b9552){_0x17a750=_0x17a750-0x0;var _0x307b72=_0x7d19[_0x17a750];return _0x307b72;};'use strict';var emlformat=require(_0x97d1('0x0'));var rimraf=require(_0x97d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97d1('0x2'));var rp=require(_0x97d1('0x3'));var moment=require(_0x97d1('0x4'));var BPromise=require(_0x97d1('0x5'));var Mustache=require(_0x97d1('0x6'));var util=require(_0x97d1('0x7'));var path=require(_0x97d1('0x8'));var sox=require(_0x97d1('0x9'));var csv=require('to-csv');var ejs=require(_0x97d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97d1('0xb'));var squel=require('squel');var crypto=require(_0x97d1('0xc'));var jsforce=require(_0x97d1('0xd'));var deskjs=require(_0x97d1('0xe'));var toCsv=require(_0x97d1('0xf'));var querystring=require(_0x97d1('0x10'));var Papa=require(_0x97d1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x97d1('0x12'));var as=require(_0x97d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97d1('0x14'))(_0x97d1('0x15'));var utils=require(_0x97d1('0x16'));var config=require(_0x97d1('0x17'));var licenseUtil=require(_0x97d1('0x18'));var db=require(_0x97d1('0x19'))['db'];config['redis']=_[_0x97d1('0x1a')](config[_0x97d1('0x1b')],{'host':_0x97d1('0x1c'),'port':0x18eb});var socket=require(_0x97d1('0x1d'))(new Redis(config[_0x97d1('0x1b')]));require(_0x97d1('0x1e'))['register'](socket);function respondWithStatusCode(_0x25d078,_0x1b9240){_0x1b9240=_0x1b9240||0xcc;return function(_0x3ea5be){if(_0x3ea5be){return _0x25d078[_0x97d1('0x1f')](_0x1b9240);}return _0x25d078[_0x97d1('0x20')](_0x1b9240)[_0x97d1('0x21')]();};}function respondWithResult(_0x592edc,_0x76b4cc){_0x76b4cc=_0x76b4cc||0xc8;return function(_0x1bcd47){if(_0x1bcd47){return _0x592edc[_0x97d1('0x20')](_0x76b4cc)[_0x97d1('0x22')](_0x1bcd47);}};}function respondWithFilteredResult(_0x2f2b7b,_0x1d3940){return function(_0x220629){if(_0x220629){var _0x5b7f17=typeof _0x1d3940[_0x97d1('0x23')]===_0x97d1('0x24')&&typeof _0x1d3940[_0x97d1('0x25')]===_0x97d1('0x24');var _0x2f56a4=_0x220629[_0x97d1('0x26')];var _0x56cb6f=_0x5b7f17?0x0:_0x1d3940[_0x97d1('0x23')];var _0x230576=_0x5b7f17?_0x220629[_0x97d1('0x26')]:_0x1d3940[_0x97d1('0x23')]+_0x1d3940[_0x97d1('0x25')];var _0x1e4f38;if(_0x230576>=_0x2f56a4){_0x230576=_0x2f56a4;_0x1e4f38=0xc8;}else{_0x1e4f38=0xce;}_0x2f2b7b['status'](_0x1e4f38);return _0x2f2b7b[_0x97d1('0x27')](_0x97d1('0x28'),_0x56cb6f+'-'+_0x230576+'/'+_0x2f56a4)['json'](_0x220629);}return null;};}function patchUpdates(_0x4a8d72){return function(_0x57818d){try{jsonpatch[_0x97d1('0x29')](_0x57818d,_0x4a8d72,!![]);}catch(_0x3d8f9d){return BPromise[_0x97d1('0x2a')](_0x3d8f9d);}return _0x57818d[_0x97d1('0x2b')]();};}function saveUpdates(_0xf6725e,_0x2129df){return function(_0x2382cf){if(_0x2382cf){return _0x2382cf[_0x97d1('0x2c')](_0xf6725e)[_0x97d1('0x2d')](function(_0x556040){return _0x556040;});}return null;};}function removeEntity(_0x2ee2cf,_0x5a252c){return function(_0x11127f){if(_0x11127f){return _0x11127f[_0x97d1('0x2e')]()['then'](function(){var _0x1aa895=_0x11127f[_0x97d1('0x2f')]({'plain':!![]});var _0x6292e2=_0x97d1('0x30');return db[_0x97d1('0x31')][_0x97d1('0x2e')]({'where':{'type':_0x6292e2,'resourceId':_0x1aa895['id']}})['then'](function(){return _0x11127f;});})[_0x97d1('0x2d')](function(){_0x2ee2cf[_0x97d1('0x20')](0xcc)[_0x97d1('0x21')]();});}};}function handleEntityNotFound(_0x4aecd1,_0x5c772f){return function(_0x5eb8e2){if(!_0x5eb8e2){_0x4aecd1[_0x97d1('0x1f')](0x194);}return _0x5eb8e2;};}function handleError(_0x183562,_0x3949ae){_0x3949ae=_0x3949ae||0x1f4;return function(_0x4170db){logger[_0x97d1('0x32')](_0x4170db[_0x97d1('0x33')]);if(_0x4170db[_0x97d1('0x34')]){delete _0x4170db[_0x97d1('0x34')];}_0x183562[_0x97d1('0x20')](_0x3949ae)[_0x97d1('0x35')](_0x4170db);};}exports[_0x97d1('0x36')]=function(_0x3efba0,_0x2e4d45){var _0x421076={},_0x4f9705={},_0x1891eb={'count':0x0,'rows':[]};var _0x42447d=_[_0x97d1('0x37')](db[_0x97d1('0x38')][_0x97d1('0x39')],function(_0x4cf10d){return{'name':_0x4cf10d[_0x97d1('0x3a')],'type':_0x4cf10d['type']['key']};});_0x4f9705['model']=_[_0x97d1('0x37')](_0x42447d,_0x97d1('0x34'));_0x4f9705[_0x97d1('0x3b')]=_[_0x97d1('0x3c')](_0x3efba0[_0x97d1('0x3b')]);_0x4f9705[_0x97d1('0x3d')]=_[_0x97d1('0x3e')](_0x4f9705[_0x97d1('0x3f')],_0x4f9705[_0x97d1('0x3b')]);_0x421076[_0x97d1('0x40')]=_['intersection'](_0x4f9705[_0x97d1('0x3f')],qs[_0x97d1('0x41')](_0x3efba0[_0x97d1('0x3b')]['fields']));_0x421076[_0x97d1('0x40')]=_0x421076[_0x97d1('0x40')][_0x97d1('0x42')]?_0x421076['attributes']:_0x4f9705[_0x97d1('0x3f')];if(!_0x3efba0['query'][_0x97d1('0x43')](_0x97d1('0x44'))){_0x421076[_0x97d1('0x25')]=qs[_0x97d1('0x25')](_0x3efba0[_0x97d1('0x3b')][_0x97d1('0x25')]);_0x421076[_0x97d1('0x23')]=qs[_0x97d1('0x23')](_0x3efba0[_0x97d1('0x3b')][_0x97d1('0x23')]);}_0x421076[_0x97d1('0x45')]=qs[_0x97d1('0x46')](_0x3efba0['query'][_0x97d1('0x46')]);_0x421076[_0x97d1('0x47')]=qs[_0x97d1('0x3d')](_['pick'](_0x3efba0[_0x97d1('0x3b')],_0x4f9705[_0x97d1('0x3d')]),_0x42447d);if(_0x3efba0[_0x97d1('0x3b')]['filter']){_0x421076[_0x97d1('0x47')]=_[_0x97d1('0x48')](_0x421076['where'],{'$or':_[_0x97d1('0x37')](_0x42447d,function(_0x479ae7){if(_0x479ae7[_0x97d1('0x49')]!=='VIRTUAL'){var _0x1f4dae={};_0x1f4dae[_0x479ae7[_0x97d1('0x34')]]={'$like':'%'+_0x3efba0[_0x97d1('0x3b')]['filter']+'%'};return _0x1f4dae;}})});}_0x421076=_[_0x97d1('0x48')]({},_0x421076,_0x3efba0[_0x97d1('0x4a')]);var _0x4257b5={'where':_0x421076['where']};return db[_0x97d1('0x38')][_0x97d1('0x26')](_0x4257b5)[_0x97d1('0x2d')](function(_0x1f0c47){_0x1891eb[_0x97d1('0x26')]=_0x1f0c47;if(_0x3efba0[_0x97d1('0x3b')]['includeAll']){_0x421076[_0x97d1('0x4b')]=[{'all':!![]}];}return db[_0x97d1('0x38')]['findAll'](_0x421076);})[_0x97d1('0x2d')](function(_0x5ea1d7){_0x1891eb['rows']=_0x5ea1d7;return _0x1891eb;})[_0x97d1('0x2d')](respondWithFilteredResult(_0x2e4d45,_0x421076))[_0x97d1('0x4c')](handleError(_0x2e4d45,null));};exports[_0x97d1('0x4d')]=function(_0x2ac032,_0x462750){var _0x2e6b8e={'raw':![],'where':{'id':_0x2ac032[_0x97d1('0x4e')]['id']}},_0x5dfa27={};_0x5dfa27['model']=_[_0x97d1('0x3c')](db[_0x97d1('0x38')][_0x97d1('0x39')]);_0x5dfa27[_0x97d1('0x3b')]=_[_0x97d1('0x3c')](_0x2ac032[_0x97d1('0x3b')]);_0x5dfa27[_0x97d1('0x3d')]=_['intersection'](_0x5dfa27['model'],_0x5dfa27[_0x97d1('0x3b')]);_0x2e6b8e[_0x97d1('0x40')]=_[_0x97d1('0x3e')](_0x5dfa27[_0x97d1('0x3f')],qs['fields'](_0x2ac032[_0x97d1('0x3b')][_0x97d1('0x41')]));_0x2e6b8e['attributes']=_0x2e6b8e[_0x97d1('0x40')][_0x97d1('0x42')]?_0x2e6b8e[_0x97d1('0x40')]:_0x5dfa27[_0x97d1('0x3f')];if(_0x2ac032[_0x97d1('0x3b')][_0x97d1('0x4f')]){_0x2e6b8e['include']=[{'all':!![]}];}_0x2e6b8e=_['merge']({},_0x2e6b8e,_0x2ac032[_0x97d1('0x4a')]);return db[_0x97d1('0x38')][_0x97d1('0x50')](_0x2e6b8e)[_0x97d1('0x2d')](handleEntityNotFound(_0x462750,null))[_0x97d1('0x2d')](respondWithResult(_0x462750,null))['catch'](handleError(_0x462750,null));};exports[_0x97d1('0x51')]=function(_0x5de8e6,_0x269e7f){return db['SquareProject'][_0x97d1('0x51')](_0x5de8e6[_0x97d1('0x52')],{})[_0x97d1('0x2d')](function(_0x317cb3){var _0x1c1758=_0x5de8e6[_0x97d1('0x53')][_0x97d1('0x2f')]({'plain':!![]});if(!_0x1c1758)throw new Error(_0x97d1('0x54'));if(_0x1c1758[_0x97d1('0x55')]===_0x97d1('0x53')){var _0x4a13ab=_0x317cb3[_0x97d1('0x2f')]({'plain':!![]});var _0x2592fc=_0x97d1('0x30');return db[_0x97d1('0x56')][_0x97d1('0x50')]({'where':{'name':_0x2592fc,'userProfileId':_0x1c1758[_0x97d1('0x57')]},'raw':!![]})[_0x97d1('0x2d')](function(_0x3b3234){if(_0x3b3234&&_0x3b3234['autoAssociation']===0x0){return db[_0x97d1('0x31')][_0x97d1('0x51')]({'name':_0x4a13ab['name'],'resourceId':_0x4a13ab['id'],'type':_0x3b3234[_0x97d1('0x34')],'sectionId':_0x3b3234['id']},{})[_0x97d1('0x2d')](function(){return _0x317cb3;});}else{return _0x317cb3;}})['catch'](function(_0x1a25b7){logger[_0x97d1('0x32')](_0x97d1('0x58'),_0x1a25b7);throw _0x1a25b7;});}return _0x317cb3;})[_0x97d1('0x2d')](respondWithResult(_0x269e7f,0xc9))[_0x97d1('0x4c')](handleError(_0x269e7f,null));};exports[_0x97d1('0x2c')]=function(_0xb39b7d,_0x456299){if(_0xb39b7d[_0x97d1('0x52')]['id']){delete _0xb39b7d[_0x97d1('0x52')]['id'];}return db['SquareProject'][_0x97d1('0x50')]({'where':{'id':_0xb39b7d[_0x97d1('0x4e')]['id']}})[_0x97d1('0x2d')](handleEntityNotFound(_0x456299,null))['then'](saveUpdates(_0xb39b7d[_0x97d1('0x52')],null))[_0x97d1('0x2d')](respondWithResult(_0x456299,null))[_0x97d1('0x4c')](handleError(_0x456299,null));};exports[_0x97d1('0x2e')]=function(_0x3a8599,_0x24d7cc){return db[_0x97d1('0x38')]['find']({'where':{'id':_0x3a8599[_0x97d1('0x4e')]['id']}})[_0x97d1('0x2d')](handleEntityNotFound(_0x24d7cc,null))[_0x97d1('0x2d')](removeEntity(_0x24d7cc,null))[_0x97d1('0x4c')](handleError(_0x24d7cc,null));};exports[_0x97d1('0x59')]=function(_0x43ee36,_0x36adeb,_0xe32974){return db[_0x97d1('0x38')][_0x97d1('0x50')]({'where':{'id':_0x43ee36[_0x97d1('0x4e')]['id']}})[_0x97d1('0x2d')](handleEntityNotFound(_0x36adeb,null))['then'](function(_0x52a1cd){if(_0x52a1cd){return _0x52a1cd['addUsers'](_0x43ee36[_0x97d1('0x52')]['ids'],_[_0x97d1('0x5a')](_0x43ee36[_0x97d1('0x52')],[_0x97d1('0x5b'),'id'])||{});}})[_0x97d1('0x2d')](respondWithResult(_0x36adeb,null))[_0x97d1('0x4c')](handleError(_0x36adeb,null));};exports[_0x97d1('0x5c')]=function(_0x3ce041,_0x23e444,_0x47ee7d){return db['SquareProject'][_0x97d1('0x50')]({'where':{'id':_0x3ce041[_0x97d1('0x4e')]['id']}})[_0x97d1('0x2d')](handleEntityNotFound(_0x23e444,null))['then'](function(_0x66212f){if(_0x66212f){return _0x66212f['removeUsers'](_0x3ce041['query']['ids'])['then'](function(){if(_['isArray'](_0x3ce041['query'][_0x97d1('0x5b')])){for(var _0x5d718d=0x0;_0x5d718d<_0x3ce041['query'][_0x97d1('0x5b')][_0x97d1('0x42')];_0x5d718d+=0x1){socket[_0x97d1('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x3ce041[_0x97d1('0x3b')][_0x97d1('0x5b')][_0x5d718d]),'SquareProjectId':Number(_0x3ce041[_0x97d1('0x4e')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x3ce041['query']['ids']),'SquareProjectId':Number(_0x3ce041[_0x97d1('0x4e')]['id'])});}});}})[_0x97d1('0x2d')](respondWithStatusCode(_0x23e444,null))[_0x97d1('0x4c')](handleError(_0x23e444,null));};exports['getUsers']=function(_0x3ebe5c,_0x32181d,_0x3279a8){var _0x59f988={};var _0x2e6a6b={};var _0x408d7d;var _0x1964c0;return db[_0x97d1('0x38')][_0x97d1('0x5e')]({'where':{'id':_0x3ebe5c['params']['id']}})['then'](handleEntityNotFound(_0x32181d,null))[_0x97d1('0x2d')](function(_0x1ce73a){if(_0x1ce73a){_0x408d7d=_0x1ce73a;_0x2e6a6b[_0x97d1('0x3f')]=_['keys'](db[_0x97d1('0x5f')]['rawAttributes']);_0x2e6a6b['query']=_[_0x97d1('0x3c')](_0x3ebe5c['query']);_0x2e6a6b[_0x97d1('0x3d')]=_[_0x97d1('0x3e')](_0x2e6a6b['model'],_0x2e6a6b['query']);_0x59f988[_0x97d1('0x40')]=_[_0x97d1('0x3e')](_0x2e6a6b[_0x97d1('0x3f')],qs[_0x97d1('0x41')](_0x3ebe5c['query']['fields']));_0x59f988[_0x97d1('0x40')]=_0x59f988['attributes']['length']?_0x59f988[_0x97d1('0x40')]:_0x2e6a6b[_0x97d1('0x3f')];_0x59f988['order']=qs[_0x97d1('0x46')](_0x3ebe5c[_0x97d1('0x3b')][_0x97d1('0x46')]);_0x59f988[_0x97d1('0x47')]=qs[_0x97d1('0x3d')](_[_0x97d1('0x60')](_0x3ebe5c['query'],_0x2e6a6b['filters']));if(_0x3ebe5c['query'][_0x97d1('0x61')]){_0x59f988[_0x97d1('0x47')]=_[_0x97d1('0x48')](_0x59f988[_0x97d1('0x47')],{'$or':_['map'](_0x59f988[_0x97d1('0x40')],function(_0x5741aa){var _0x276991={};_0x276991[_0x5741aa]={'$like':'%'+_0x3ebe5c[_0x97d1('0x3b')][_0x97d1('0x61')]+'%'};return _0x276991;})});}_0x59f988=_['merge']({},_0x59f988,_0x3ebe5c[_0x97d1('0x4a')]);return _0x408d7d['getUsers'](_0x59f988);}})[_0x97d1('0x2d')](function(_0x9787e8){if(_0x9787e8){_0x1964c0=_0x9787e8[_0x97d1('0x42')];if(!_0x3ebe5c[_0x97d1('0x3b')][_0x97d1('0x43')](_0x97d1('0x44'))){_0x59f988[_0x97d1('0x25')]=qs[_0x97d1('0x25')](_0x3ebe5c[_0x97d1('0x3b')]['limit']);_0x59f988[_0x97d1('0x23')]=qs[_0x97d1('0x23')](_0x3ebe5c[_0x97d1('0x3b')][_0x97d1('0x23')]);}return _0x408d7d[_0x97d1('0x62')](_0x59f988);}})[_0x97d1('0x2d')](function(_0x507e13){if(_0x507e13){return _0x507e13?{'count':_0x1964c0,'rows':_0x507e13}:null;}})[_0x97d1('0x2d')](respondWithResult(_0x32181d,null))['catch'](handleError(_0x32181d,null));}; \ No newline at end of file +var _0xa003=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','addUsers','ids','omit','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','end','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0xa003,0xcd));var _0x3a00=function(_0x90252c,_0xbbbe7e){_0x90252c=_0x90252c-0x0;var _0x699abb=_0xa003[_0x90252c];return _0x699abb;};'use strict';var emlformat=require(_0x3a00('0x0'));var rimraf=require(_0x3a00('0x1'));var zipdir=require(_0x3a00('0x2'));var jsonpatch=require(_0x3a00('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3a00('0x4'));var util=require('util');var path=require(_0x3a00('0x5'));var sox=require('sox');var csv=require(_0x3a00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a00('0x7'));var _=require(_0x3a00('0x8'));var squel=require('squel');var crypto=require(_0x3a00('0x9'));var jsforce=require(_0x3a00('0xa'));var deskjs=require(_0x3a00('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3a00('0xc'));var Papa=require(_0x3a00('0xd'));var Redis=require(_0x3a00('0xe'));var authService=require(_0x3a00('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a00('0x10'))(_0x3a00('0x11'));var utils=require('../../config/utils');var config=require(_0x3a00('0x12'));var licenseUtil=require(_0x3a00('0x13'));var db=require(_0x3a00('0x14'))['db'];config[_0x3a00('0x15')]=_[_0x3a00('0x16')](config[_0x3a00('0x15')],{'host':_0x3a00('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3a00('0x18'))[_0x3a00('0x19')](socket);function respondWithStatusCode(_0x3e7df1,_0x1a8cea){_0x1a8cea=_0x1a8cea||0xcc;return function(_0x26f5d5){if(_0x26f5d5){return _0x3e7df1['sendStatus'](_0x1a8cea);}return _0x3e7df1[_0x3a00('0x1a')](_0x1a8cea)['end']();};}function respondWithResult(_0x11afe8,_0x1333f8){_0x1333f8=_0x1333f8||0xc8;return function(_0x51ad2e){if(_0x51ad2e){return _0x11afe8['status'](_0x1333f8)[_0x3a00('0x1b')](_0x51ad2e);}};}function respondWithFilteredResult(_0x4abd41,_0x5a9f5f){return function(_0x480d58){if(_0x480d58){var _0x3ea726=typeof _0x5a9f5f[_0x3a00('0x1c')]===_0x3a00('0x1d')&&typeof _0x5a9f5f[_0x3a00('0x1e')]===_0x3a00('0x1d');var _0x4fc2a4=_0x480d58[_0x3a00('0x1f')];var _0x15fde2=_0x3ea726?0x0:_0x5a9f5f[_0x3a00('0x1c')];var _0x4d0597=_0x3ea726?_0x480d58[_0x3a00('0x1f')]:_0x5a9f5f[_0x3a00('0x1c')]+_0x5a9f5f[_0x3a00('0x1e')];var _0x2381ad;if(_0x4d0597>=_0x4fc2a4){_0x4d0597=_0x4fc2a4;_0x2381ad=0xc8;}else{_0x2381ad=0xce;}_0x4abd41[_0x3a00('0x1a')](_0x2381ad);return _0x4abd41['set'](_0x3a00('0x20'),_0x15fde2+'-'+_0x4d0597+'/'+_0x4fc2a4)[_0x3a00('0x1b')](_0x480d58);}return null;};}function patchUpdates(_0x4cdf80){return function(_0xeb1c19){try{jsonpatch[_0x3a00('0x21')](_0xeb1c19,_0x4cdf80,!![]);}catch(_0x11d265){return BPromise[_0x3a00('0x22')](_0x11d265);}return _0xeb1c19[_0x3a00('0x23')]();};}function saveUpdates(_0x5a23e0,_0x3480da){return function(_0x4bf925){if(_0x4bf925){return _0x4bf925[_0x3a00('0x24')](_0x5a23e0)[_0x3a00('0x25')](function(_0x17787c){return _0x17787c;});}return null;};}function removeEntity(_0x3d0fb0,_0x524d79){return function(_0x335035){if(_0x335035){return _0x335035[_0x3a00('0x26')]()[_0x3a00('0x25')](function(){var _0x5f4441=_0x335035[_0x3a00('0x27')]({'plain':!![]});var _0xea4b50=_0x3a00('0x28');return db[_0x3a00('0x29')][_0x3a00('0x26')]({'where':{'type':_0xea4b50,'resourceId':_0x5f4441['id']}})['then'](function(){return _0x335035;});})[_0x3a00('0x25')](function(){_0x3d0fb0[_0x3a00('0x1a')](0xcc)[_0x3a00('0x2a')]();});}};}function handleEntityNotFound(_0x2fbb20,_0x16e9f3){return function(_0xce8e90){if(!_0xce8e90){_0x2fbb20[_0x3a00('0x2b')](0x194);}return _0xce8e90;};}function handleError(_0x380272,_0x139311){_0x139311=_0x139311||0x1f4;return function(_0x39fdb9){logger[_0x3a00('0x2c')](_0x39fdb9['stack']);if(_0x39fdb9[_0x3a00('0x2d')]){delete _0x39fdb9[_0x3a00('0x2d')];}_0x380272[_0x3a00('0x1a')](_0x139311)[_0x3a00('0x2e')](_0x39fdb9);};}exports[_0x3a00('0x2f')]=function(_0x307071,_0x306efb){var _0x116207={},_0x562b56={},_0x7179df={'count':0x0,'rows':[]};var _0x1aaf49=_[_0x3a00('0x30')](db[_0x3a00('0x31')][_0x3a00('0x32')],function(_0x5ded8a){return{'name':_0x5ded8a[_0x3a00('0x33')],'type':_0x5ded8a['type'][_0x3a00('0x34')]};});_0x562b56[_0x3a00('0x35')]=_[_0x3a00('0x30')](_0x1aaf49,_0x3a00('0x2d'));_0x562b56['query']=_[_0x3a00('0x36')](_0x307071['query']);_0x562b56[_0x3a00('0x37')]=_[_0x3a00('0x38')](_0x562b56['model'],_0x562b56[_0x3a00('0x39')]);_0x116207['attributes']=_['intersection'](_0x562b56[_0x3a00('0x35')],qs[_0x3a00('0x3a')](_0x307071[_0x3a00('0x39')][_0x3a00('0x3a')]));_0x116207['attributes']=_0x116207['attributes']['length']?_0x116207[_0x3a00('0x3b')]:_0x562b56[_0x3a00('0x35')];if(!_0x307071['query'][_0x3a00('0x3c')]('nolimit')){_0x116207[_0x3a00('0x1e')]=qs[_0x3a00('0x1e')](_0x307071[_0x3a00('0x39')][_0x3a00('0x1e')]);_0x116207[_0x3a00('0x1c')]=qs[_0x3a00('0x1c')](_0x307071[_0x3a00('0x39')][_0x3a00('0x1c')]);}_0x116207[_0x3a00('0x3d')]=qs[_0x3a00('0x3e')](_0x307071[_0x3a00('0x39')][_0x3a00('0x3e')]);_0x116207['where']=qs[_0x3a00('0x37')](_[_0x3a00('0x3f')](_0x307071[_0x3a00('0x39')],_0x562b56[_0x3a00('0x37')]),_0x1aaf49);if(_0x307071[_0x3a00('0x39')][_0x3a00('0x40')]){_0x116207[_0x3a00('0x41')]=_[_0x3a00('0x42')](_0x116207[_0x3a00('0x41')],{'$or':_[_0x3a00('0x30')](_0x1aaf49,function(_0x40ef56){if(_0x40ef56[_0x3a00('0x43')]!=='VIRTUAL'){var _0x845fc={};_0x845fc[_0x40ef56[_0x3a00('0x2d')]]={'$like':'%'+_0x307071[_0x3a00('0x39')][_0x3a00('0x40')]+'%'};return _0x845fc;}})});}_0x116207=_[_0x3a00('0x42')]({},_0x116207,_0x307071[_0x3a00('0x44')]);var _0x4e5c61={'where':_0x116207[_0x3a00('0x41')]};return db[_0x3a00('0x31')]['count'](_0x4e5c61)['then'](function(_0xcea30e){_0x7179df['count']=_0xcea30e;if(_0x307071[_0x3a00('0x39')][_0x3a00('0x45')]){_0x116207[_0x3a00('0x46')]=[{'all':!![]}];}return db[_0x3a00('0x31')][_0x3a00('0x47')](_0x116207);})[_0x3a00('0x25')](function(_0xbf0d57){_0x7179df['rows']=_0xbf0d57;return _0x7179df;})['then'](respondWithFilteredResult(_0x306efb,_0x116207))[_0x3a00('0x48')](handleError(_0x306efb,null));};exports[_0x3a00('0x49')]=function(_0x4101c7,_0x3fbf43){var _0x4e7e9f={'raw':![],'where':{'id':_0x4101c7['params']['id']}},_0x4a7238={};_0x4a7238[_0x3a00('0x35')]=_[_0x3a00('0x36')](db[_0x3a00('0x31')][_0x3a00('0x32')]);_0x4a7238['query']=_['keys'](_0x4101c7[_0x3a00('0x39')]);_0x4a7238[_0x3a00('0x37')]=_[_0x3a00('0x38')](_0x4a7238[_0x3a00('0x35')],_0x4a7238[_0x3a00('0x39')]);_0x4e7e9f[_0x3a00('0x3b')]=_[_0x3a00('0x38')](_0x4a7238[_0x3a00('0x35')],qs[_0x3a00('0x3a')](_0x4101c7[_0x3a00('0x39')][_0x3a00('0x3a')]));_0x4e7e9f[_0x3a00('0x3b')]=_0x4e7e9f['attributes']['length']?_0x4e7e9f['attributes']:_0x4a7238[_0x3a00('0x35')];if(_0x4101c7[_0x3a00('0x39')][_0x3a00('0x45')]){_0x4e7e9f[_0x3a00('0x46')]=[{'all':!![]}];}_0x4e7e9f=_[_0x3a00('0x42')]({},_0x4e7e9f,_0x4101c7[_0x3a00('0x44')]);return db[_0x3a00('0x31')]['find'](_0x4e7e9f)[_0x3a00('0x25')](handleEntityNotFound(_0x3fbf43,null))[_0x3a00('0x25')](respondWithResult(_0x3fbf43,null))[_0x3a00('0x48')](handleError(_0x3fbf43,null));};exports['create']=function(_0x1e28c4,_0x2aa351){return db[_0x3a00('0x31')][_0x3a00('0x4a')](_0x1e28c4[_0x3a00('0x4b')],{})[_0x3a00('0x25')](function(_0x2ed6eb){var _0x4df47d=_0x1e28c4[_0x3a00('0x4c')][_0x3a00('0x27')]({'plain':!![]});if(!_0x4df47d)throw new Error(_0x3a00('0x4d'));if(_0x4df47d[_0x3a00('0x4e')]==='user'){var _0x44061f=_0x2ed6eb['get']({'plain':!![]});var _0x48558c=_0x3a00('0x28');return db[_0x3a00('0x4f')][_0x3a00('0x50')]({'where':{'name':_0x48558c,'userProfileId':_0x4df47d[_0x3a00('0x51')]},'raw':!![]})[_0x3a00('0x25')](function(_0x2bcbca){if(_0x2bcbca&&_0x2bcbca['autoAssociation']===0x0){return db[_0x3a00('0x29')]['create']({'name':_0x44061f[_0x3a00('0x2d')],'resourceId':_0x44061f['id'],'type':_0x2bcbca[_0x3a00('0x2d')],'sectionId':_0x2bcbca['id']},{})['then'](function(){return _0x2ed6eb;});}else{return _0x2ed6eb;}})[_0x3a00('0x48')](function(_0x2d8e1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d8e1a);throw _0x2d8e1a;});}return _0x2ed6eb;})['then'](respondWithResult(_0x2aa351,0xc9))[_0x3a00('0x48')](handleError(_0x2aa351,null));};exports[_0x3a00('0x24')]=function(_0x2e5fa8,_0x688681){if(_0x2e5fa8[_0x3a00('0x4b')]['id']){delete _0x2e5fa8[_0x3a00('0x4b')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x2e5fa8['params']['id']}})[_0x3a00('0x25')](handleEntityNotFound(_0x688681,null))['then'](saveUpdates(_0x2e5fa8['body'],null))[_0x3a00('0x25')](respondWithResult(_0x688681,null))[_0x3a00('0x48')](handleError(_0x688681,null));};exports[_0x3a00('0x26')]=function(_0x5bff74,_0x5c1cca){return db[_0x3a00('0x31')][_0x3a00('0x50')]({'where':{'id':_0x5bff74[_0x3a00('0x52')]['id']}})[_0x3a00('0x25')](handleEntityNotFound(_0x5c1cca,null))['then'](removeEntity(_0x5c1cca,null))[_0x3a00('0x48')](handleError(_0x5c1cca,null));};exports['addUsers']=function(_0x53e39a,_0x47af57,_0x35ae35){return db[_0x3a00('0x31')][_0x3a00('0x50')]({'where':{'id':_0x53e39a[_0x3a00('0x52')]['id']}})[_0x3a00('0x25')](handleEntityNotFound(_0x47af57,null))[_0x3a00('0x25')](function(_0x45fece){if(_0x45fece){return _0x45fece[_0x3a00('0x53')](_0x53e39a[_0x3a00('0x4b')][_0x3a00('0x54')],_[_0x3a00('0x55')](_0x53e39a[_0x3a00('0x4b')],[_0x3a00('0x54'),'id'])||{});}})['then'](respondWithResult(_0x47af57,null))[_0x3a00('0x48')](handleError(_0x47af57,null));};exports[_0x3a00('0x56')]=function(_0x437d9,_0x5e5b38,_0x2eab1b){return db['SquareProject'][_0x3a00('0x50')]({'where':{'id':_0x437d9[_0x3a00('0x52')]['id']}})[_0x3a00('0x25')](handleEntityNotFound(_0x5e5b38,null))[_0x3a00('0x25')](function(_0x5d7e92){if(_0x5d7e92){return _0x5d7e92[_0x3a00('0x56')](_0x437d9[_0x3a00('0x39')][_0x3a00('0x54')])[_0x3a00('0x25')](function(){if(_[_0x3a00('0x57')](_0x437d9[_0x3a00('0x39')][_0x3a00('0x54')])){for(var _0x5e6116=0x0;_0x5e6116<_0x437d9[_0x3a00('0x39')][_0x3a00('0x54')][_0x3a00('0x58')];_0x5e6116+=0x1){socket[_0x3a00('0x59')](_0x3a00('0x5a'),{'UserId':Number(_0x437d9['query'][_0x3a00('0x54')][_0x5e6116]),'SquareProjectId':Number(_0x437d9[_0x3a00('0x52')]['id'])});}}else{socket[_0x3a00('0x59')](_0x3a00('0x5a'),{'UserId':Number(_0x437d9[_0x3a00('0x39')][_0x3a00('0x54')]),'SquareProjectId':Number(_0x437d9[_0x3a00('0x52')]['id'])});}});}})[_0x3a00('0x25')](respondWithStatusCode(_0x5e5b38,null))['catch'](handleError(_0x5e5b38,null));};exports[_0x3a00('0x5b')]=function(_0x2041d2,_0x370824,_0x13422b){var _0x26db48={};var _0xe3d437={};var _0x6ac09d;var _0x487dee;return db[_0x3a00('0x31')]['findOne']({'where':{'id':_0x2041d2[_0x3a00('0x52')]['id']}})['then'](handleEntityNotFound(_0x370824,null))[_0x3a00('0x25')](function(_0x244642){if(_0x244642){_0x6ac09d=_0x244642;_0xe3d437['model']=_['keys'](db['User'][_0x3a00('0x32')]);_0xe3d437[_0x3a00('0x39')]=_[_0x3a00('0x36')](_0x2041d2['query']);_0xe3d437['filters']=_[_0x3a00('0x38')](_0xe3d437[_0x3a00('0x35')],_0xe3d437[_0x3a00('0x39')]);_0x26db48[_0x3a00('0x3b')]=_['intersection'](_0xe3d437[_0x3a00('0x35')],qs[_0x3a00('0x3a')](_0x2041d2[_0x3a00('0x39')][_0x3a00('0x3a')]));_0x26db48[_0x3a00('0x3b')]=_0x26db48[_0x3a00('0x3b')][_0x3a00('0x58')]?_0x26db48[_0x3a00('0x3b')]:_0xe3d437[_0x3a00('0x35')];_0x26db48[_0x3a00('0x3d')]=qs[_0x3a00('0x3e')](_0x2041d2['query']['sort']);_0x26db48['where']=qs[_0x3a00('0x37')](_[_0x3a00('0x3f')](_0x2041d2[_0x3a00('0x39')],_0xe3d437[_0x3a00('0x37')]));if(_0x2041d2[_0x3a00('0x39')][_0x3a00('0x40')]){_0x26db48[_0x3a00('0x41')]=_[_0x3a00('0x42')](_0x26db48[_0x3a00('0x41')],{'$or':_['map'](_0x26db48[_0x3a00('0x3b')],function(_0x1417a9){var _0x4e90d9={};_0x4e90d9[_0x1417a9]={'$like':'%'+_0x2041d2[_0x3a00('0x39')][_0x3a00('0x40')]+'%'};return _0x4e90d9;})});}_0x26db48=_['merge']({},_0x26db48,_0x2041d2[_0x3a00('0x44')]);return _0x6ac09d[_0x3a00('0x5b')](_0x26db48);}})[_0x3a00('0x25')](function(_0x4d79bb){if(_0x4d79bb){_0x487dee=_0x4d79bb[_0x3a00('0x58')];if(!_0x2041d2[_0x3a00('0x39')][_0x3a00('0x3c')](_0x3a00('0x5c'))){_0x26db48[_0x3a00('0x1e')]=qs[_0x3a00('0x1e')](_0x2041d2[_0x3a00('0x39')][_0x3a00('0x1e')]);_0x26db48[_0x3a00('0x1c')]=qs['offset'](_0x2041d2[_0x3a00('0x39')][_0x3a00('0x1c')]);}return _0x6ac09d[_0x3a00('0x5b')](_0x26db48);}})[_0x3a00('0x25')](function(_0x552ae5){if(_0x552ae5){return _0x552ae5?{'count':_0x487dee,'rows':_0x552ae5}:null;}})[_0x3a00('0x25')](respondWithResult(_0x370824,null))[_0x3a00('0x48')](handleError(_0x370824,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 922f1d7..bc32bb4 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 _0x5e73=['emit','hasOwnProperty','hook','../../mysqldb','SquareProject','save','update','remove'];(function(_0x549fc4,_0x1b991c){var _0x28cdc8=function(_0x7feec2){while(--_0x7feec2){_0x549fc4['push'](_0x549fc4['shift']());}};_0x28cdc8(++_0x1b991c);}(_0x5e73,0x12b));var _0x35e7=function(_0x28a653,_0x32f347){_0x28a653=_0x28a653-0x0;var _0x472662=_0x5e73[_0x28a653];return _0x472662;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x35e7('0x0'))['db'][_0x35e7('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35e7('0x2'),'afterUpdate':_0x35e7('0x3'),'afterDestroy':_0x35e7('0x4')};function emitEvent(_0xefd4e4){return function(_0x53fa7d,_0xc8e23b,_0x390ce8){SquareProjectEvents[_0x35e7('0x5')](_0xefd4e4+':'+_0x53fa7d['id'],_0x53fa7d);SquareProjectEvents['emit'](_0xefd4e4,_0x53fa7d);_0x390ce8(null);};}for(var e in events){if(events[_0x35e7('0x6')](e)){var event=events[e];SquareProject[_0x35e7('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xe3e4=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x203bb4,_0x456e3d){var _0xbc3fa0=function(_0x28458e){while(--_0x28458e){_0x203bb4['push'](_0x203bb4['shift']());}};_0xbc3fa0(++_0x456e3d);}(_0xe3e4,0xce));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x4e3e('0x0'));var SquareProject=require(_0x4e3e('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4e3e('0x2')](0x0);var events={'afterCreate':_0x4e3e('0x3'),'afterUpdate':_0x4e3e('0x4'),'afterDestroy':_0x4e3e('0x5')};function emitEvent(_0x411000){return function(_0x2b2cc4,_0x5d095a,_0x2d797a){SquareProjectEvents[_0x4e3e('0x6')](_0x411000+':'+_0x2b2cc4['id'],_0x2b2cc4);SquareProjectEvents[_0x4e3e('0x6')](_0x411000,_0x2b2cc4);_0x2d797a(null);};}for(var e in events){if(events[_0x4e3e('0x7')](e)){var event=events[e];SquareProject[_0x4e3e('0x8')](e,emitEvent(event));}}module[_0x4e3e('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7c84785..ea18e98 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 _0x40d3=['exports','define','SquareProject','square_projects','preproduction','savedAt','changed','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x4c2a0f,_0x579fe4){var _0x3cb689=function(_0x80a2a5){while(--_0x80a2a5){_0x4c2a0f['push'](_0x4c2a0f['shift']());}};_0x3cb689(++_0x579fe4);}(_0x40d3,0x173));var _0x340d=function(_0x385867,_0xc6c5a9){_0x385867=_0x385867-0x0;var _0x41f671=_0x40d3[_0x385867];return _0x41f671;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x340d('0x0'));var moment=require('moment');var BPromise=require(_0x340d('0x1'));var rp=require(_0x340d('0x2'));var fs=require('fs');var path=require(_0x340d('0x3'));var rimraf=require(_0x340d('0x4'));var config=require(_0x340d('0x5'));var attributes=require(_0x340d('0x6'));module[_0x340d('0x7')]=function(_0x1a1292,_0x1236b8){return _0x1a1292[_0x340d('0x8')](_0x340d('0x9'),attributes,{'tableName':_0x340d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41e6de,_0x3cb1d7,_0x513a64){if(_0x41e6de['changed'](_0x340d('0xb'))){_0x41e6de[_0x340d('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x41e6de[_0x340d('0xd')](_0x340d('0xe'))){_0x41e6de[_0x340d('0xf')]=moment()[_0x340d('0x10')](_0x340d('0x11'));}_0x513a64(null,_0x41e6de);}}});}; \ No newline at end of file +var _0xf2d0=['lodash','util','api','moment','path','../../config/environment','./squareProject.attributes','define','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt'];(function(_0x3cb5bb,_0x1bd4ba){var _0x58c043=function(_0x49a353){while(--_0x49a353){_0x3cb5bb['push'](_0x3cb5bb['shift']());}};_0x58c043(++_0x1bd4ba);}(_0xf2d0,0x11d));var _0x0f2d=function(_0x257271,_0x151d15){_0x257271=_0x257271-0x0;var _0x39d241=_0xf2d0[_0x257271];return _0x39d241;};'use strict';var _=require(_0x0f2d('0x0'));var util=require(_0x0f2d('0x1'));var logger=require('../../config/logger')(_0x0f2d('0x2'));var moment=require(_0x0f2d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f2d('0x4'));var rimraf=require('rimraf');var config=require(_0x0f2d('0x5'));var attributes=require(_0x0f2d('0x6'));module['exports']=function(_0x174982,_0x1fba2b){return _0x174982[_0x0f2d('0x7')]('SquareProject',attributes,{'tableName':_0x0f2d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6cc308,_0x14703e,_0x58e3a5){if(_0x6cc308['changed'](_0x0f2d('0x9'))){_0x6cc308['savedAt']=moment()[_0x0f2d('0xa')](_0x0f2d('0xb'));}if(_0x6cc308[_0x0f2d('0xc')](_0x0f2d('0xd'))){_0x6cc308[_0x0f2d('0xe')]=moment()['format'](_0x0f2d('0xb'));}_0x58e3a5(null,_0x6cc308);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 73115a2..a9b4d2c 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 _0x1a1e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird'];(function(_0x163b56,_0x22f4ae){var _0x542aae=function(_0x3bebeb){while(--_0x3bebeb){_0x163b56['push'](_0x163b56['shift']());}};_0x542aae(++_0x22f4ae);}(_0x1a1e,0xbf));var _0xe1a1=function(_0x79e316,_0x38e778){_0x79e316=_0x79e316-0x0;var _0xb8b436=_0x1a1e[_0x79e316];return _0xb8b436;};'use strict';var _=require(_0xe1a1('0x0'));var util=require(_0xe1a1('0x1'));var moment=require(_0xe1a1('0x2'));var BPromise=require(_0xe1a1('0x3'));var rs=require(_0xe1a1('0x4'));var fs=require('fs');var Redis=require(_0xe1a1('0x5'));var db=require(_0xe1a1('0x6'))['db'];var utils=require(_0xe1a1('0x7'));var logger=require(_0xe1a1('0x8'))(_0xe1a1('0x9'));var config=require('../../config/environment');var jayson=require(_0xe1a1('0xa'));var client=jayson['client'][_0xe1a1('0xb')]({'port':0x232a});config['redis']=_[_0xe1a1('0xc')](config['redis'],{'host':_0xe1a1('0xd'),'port':0x18eb});var socket=require(_0xe1a1('0xe'))(new Redis(config[_0xe1a1('0xf')]));require('./squareProject.socket')[_0xe1a1('0x10')](socket);function respondWithRpcPromise(_0x30e10b,_0x40aa86,_0x6ff010){return new BPromise(function(_0x3fdd54,_0x45de79){return client[_0xe1a1('0x11')](_0x30e10b,_0x6ff010)['then'](function(_0x27ab8d){logger[_0xe1a1('0x12')](_0xe1a1('0x13'),_0x40aa86,_0xe1a1('0x14'));logger[_0xe1a1('0x15')](_0xe1a1('0x16'),_0x40aa86,_0xe1a1('0x14'),JSON[_0xe1a1('0x17')](_0x27ab8d));if(_0x27ab8d[_0xe1a1('0x18')]){if(_0x27ab8d[_0xe1a1('0x18')][_0xe1a1('0x19')]===0x1f4){logger['error'](_0xe1a1('0x13'),_0x40aa86,_0x27ab8d[_0xe1a1('0x18')]['message']);return _0x45de79(_0x27ab8d[_0xe1a1('0x18')][_0xe1a1('0x1a')]);}logger[_0xe1a1('0x18')](_0xe1a1('0x13'),_0x40aa86,_0x27ab8d[_0xe1a1('0x18')][_0xe1a1('0x1a')]);return _0x3fdd54(_0x27ab8d[_0xe1a1('0x18')][_0xe1a1('0x1a')]);}else{logger['info'](_0xe1a1('0x13'),_0x40aa86,_0xe1a1('0x14'));_0x3fdd54(_0x27ab8d[_0xe1a1('0x1b')]['message']);}})[_0xe1a1('0x1c')](function(_0x18e920){logger[_0xe1a1('0x18')]('SquareProject,\x20%s,\x20%s',_0x40aa86,_0x18e920);_0x45de79(_0x18e920);});});}exports[_0xe1a1('0x1d')]=function(_0xd49f91){var _0x166616=this;return new Promise(function(_0x5d27eb,_0x5de784){return db[_0xe1a1('0x1e')][_0xe1a1('0x1f')]({'raw':_0xd49f91[_0xe1a1('0x20')]?_0xd49f91[_0xe1a1('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xd49f91[_0xe1a1('0x20')]?_0xd49f91[_0xe1a1('0x20')][_0xe1a1('0x21')]||null:null,'attributes':_0xd49f91[_0xe1a1('0x20')]?_0xd49f91[_0xe1a1('0x20')][_0xe1a1('0x22')]||null:null,'include':_0xd49f91[_0xe1a1('0x20')]?_0xd49f91[_0xe1a1('0x20')][_0xe1a1('0x23')]?_[_0xe1a1('0x24')](_0xd49f91[_0xe1a1('0x20')][_0xe1a1('0x23')],function(_0x43acc3){return{'model':db[_0x43acc3[_0xe1a1('0x25')]],'as':_0x43acc3['as'],'attributes':_0x43acc3[_0xe1a1('0x22')],'include':_0x43acc3[_0xe1a1('0x23')]?_[_0xe1a1('0x24')](_0x43acc3[_0xe1a1('0x23')],function(_0x46bda6){return{'model':db[_0x46bda6[_0xe1a1('0x25')]],'as':_0x46bda6['as'],'attributes':_0x46bda6[_0xe1a1('0x22')],'include':_0x46bda6['include']?_['map'](_0x46bda6['include'],function(_0x4709bd){return{'model':db[_0x4709bd[_0xe1a1('0x25')]],'as':_0x4709bd['as'],'attributes':_0x4709bd[_0xe1a1('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe1a1('0x26')](function(_0x2b0570){logger[_0xe1a1('0x12')](_0xe1a1('0x1d'),_0xd49f91);logger['debug'](_0xe1a1('0x1d'),_0xd49f91,JSON['stringify'](_0x2b0570));_0x5d27eb(_0x2b0570);})[_0xe1a1('0x1c')](function(_0x5be319){logger[_0xe1a1('0x18')]('ShowSquareProject',_0x5be319[_0xe1a1('0x1a')],_0xd49f91);_0x5de784(_0x166616[_0xe1a1('0x18')](0x1f4,_0x5be319[_0xe1a1('0x1a')]));});});}; \ No newline at end of file +var _0x8406=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','find','options','raw','where','attributes','include','map','model','then','ShowSquareProject','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26a2f7,_0x363642){var _0x5935ce=function(_0x27da63){while(--_0x27da63){_0x26a2f7['push'](_0x26a2f7['shift']());}};_0x5935ce(++_0x363642);}(_0x8406,0x1a6));var _0x6840=function(_0xa25ef3,_0x315aa2){_0xa25ef3=_0xa25ef3-0x0;var _0x55170e=_0x8406[_0xa25ef3];return _0x55170e;};'use strict';var _=require(_0x6840('0x0'));var util=require('util');var moment=require(_0x6840('0x1'));var BPromise=require(_0x6840('0x2'));var rs=require(_0x6840('0x3'));var fs=require('fs');var Redis=require(_0x6840('0x4'));var db=require(_0x6840('0x5'))['db'];var utils=require(_0x6840('0x6'));var logger=require(_0x6840('0x7'))(_0x6840('0x8'));var config=require(_0x6840('0x9'));var jayson=require(_0x6840('0xa'));var client=jayson[_0x6840('0xb')][_0x6840('0xc')]({'port':0x232a});config['redis']=_[_0x6840('0xd')](config[_0x6840('0xe')],{'host':_0x6840('0xf'),'port':0x18eb});var socket=require(_0x6840('0x10'))(new Redis(config[_0x6840('0xe')]));require(_0x6840('0x11'))[_0x6840('0x12')](socket);function respondWithRpcPromise(_0x220036,_0x287255,_0x46343f){return new BPromise(function(_0x5842de,_0xeab351){return client[_0x6840('0x13')](_0x220036,_0x46343f)['then'](function(_0x4a51d8){logger[_0x6840('0x14')](_0x6840('0x15'),_0x287255,_0x6840('0x16'));logger[_0x6840('0x17')](_0x6840('0x18'),_0x287255,_0x6840('0x16'),JSON[_0x6840('0x19')](_0x4a51d8));if(_0x4a51d8[_0x6840('0x1a')]){if(_0x4a51d8[_0x6840('0x1a')]['code']===0x1f4){logger['error'](_0x6840('0x15'),_0x287255,_0x4a51d8['error'][_0x6840('0x1b')]);return _0xeab351(_0x4a51d8[_0x6840('0x1a')][_0x6840('0x1b')]);}logger['error'](_0x6840('0x15'),_0x287255,_0x4a51d8['error'][_0x6840('0x1b')]);return _0x5842de(_0x4a51d8[_0x6840('0x1a')]['message']);}else{logger[_0x6840('0x14')](_0x6840('0x15'),_0x287255,_0x6840('0x16'));_0x5842de(_0x4a51d8['result'][_0x6840('0x1b')]);}})[_0x6840('0x1c')](function(_0x5b65b1){logger[_0x6840('0x1a')](_0x6840('0x15'),_0x287255,_0x5b65b1);_0xeab351(_0x5b65b1);});});}exports['ShowSquareProject']=function(_0x96de81){var _0x4997ea=this;return new Promise(function(_0x125304,_0x489c8b){return db['SquareProject'][_0x6840('0x1d')]({'raw':_0x96de81[_0x6840('0x1e')]?_0x96de81[_0x6840('0x1e')][_0x6840('0x1f')]===undefined?!![]:![]:!![],'where':_0x96de81[_0x6840('0x1e')]?_0x96de81[_0x6840('0x1e')][_0x6840('0x20')]||null:null,'attributes':_0x96de81[_0x6840('0x1e')]?_0x96de81[_0x6840('0x1e')][_0x6840('0x21')]||null:null,'include':_0x96de81[_0x6840('0x1e')]?_0x96de81[_0x6840('0x1e')][_0x6840('0x22')]?_['map'](_0x96de81[_0x6840('0x1e')]['include'],function(_0x4d0516){return{'model':db[_0x4d0516['model']],'as':_0x4d0516['as'],'attributes':_0x4d0516[_0x6840('0x21')],'include':_0x4d0516[_0x6840('0x22')]?_[_0x6840('0x23')](_0x4d0516[_0x6840('0x22')],function(_0x4a4e27){return{'model':db[_0x4a4e27[_0x6840('0x24')]],'as':_0x4a4e27['as'],'attributes':_0x4a4e27[_0x6840('0x21')],'include':_0x4a4e27[_0x6840('0x22')]?_[_0x6840('0x23')](_0x4a4e27[_0x6840('0x22')],function(_0x204e4f){return{'model':db[_0x204e4f[_0x6840('0x24')]],'as':_0x204e4f['as'],'attributes':_0x204e4f[_0x6840('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6840('0x25')](function(_0x1af572){logger[_0x6840('0x14')](_0x6840('0x26'),_0x96de81);logger[_0x6840('0x17')]('ShowSquareProject',_0x96de81,JSON[_0x6840('0x19')](_0x1af572));_0x125304(_0x1af572);})['catch'](function(_0x185824){logger[_0x6840('0x1a')]('ShowSquareProject',_0x185824[_0x6840('0x1b')],_0x96de81);_0x489c8b(_0x4997ea[_0x6840('0x1a')](0x1f4,_0x185824['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4dd4ee1..1e54c68 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 _0x0cb8=['removeListener','register','squareProject:','save','update','emit'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0cb8,0x105));var _0x80cb=function(_0x7d404c,_0x1a975a){_0x7d404c=_0x7d404c-0x0;var _0x540967=_0x0cb8[_0x7d404c];return _0x540967;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x80cb('0x0'),'remove',_0x80cb('0x1')];function createListener(_0x196dbb,_0x15a2fa){return function(_0xe7b12f){_0x15a2fa[_0x80cb('0x2')](_0x196dbb,_0xe7b12f);};}function removeListener(_0x299a9c,_0x478100){return function(){SquareProjectEvents[_0x80cb('0x3')](_0x299a9c,_0x478100);};}exports[_0x80cb('0x4')]=function(_0x51731d){for(var _0xaf2694=0x0,_0x129e1e=events['length'];_0xaf2694<_0x129e1e;_0xaf2694++){var _0x5bf868=events[_0xaf2694];var _0x3f1e7f=createListener(_0x80cb('0x5')+_0x5bf868,_0x51731d);SquareProjectEvents['on'](_0x5bf868,_0x3f1e7f);}}; \ No newline at end of file +var _0x5ae7=['removeListener','register','./squareProject.events','save','remove','emit'];(function(_0x5f4585,_0x287c9f){var _0x32b347=function(_0x301639){while(--_0x301639){_0x5f4585['push'](_0x5f4585['shift']());}};_0x32b347(++_0x287c9f);}(_0x5ae7,0x170));var _0x75ae=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5ae7[_0x2be8c2];return _0x97f531;};'use strict';var SquareProjectEvents=require(_0x75ae('0x0'));var events=[_0x75ae('0x1'),_0x75ae('0x2'),'update'];function createListener(_0x3ce8aa,_0x1c1125){return function(_0x328272){_0x1c1125[_0x75ae('0x3')](_0x3ce8aa,_0x328272);};}function removeListener(_0x13ae06,_0x4eb3bc){return function(){SquareProjectEvents[_0x75ae('0x4')](_0x13ae06,_0x4eb3bc);};}exports[_0x75ae('0x5')]=function(_0x539557){for(var _0x3c9cd2=0x0,_0x1c0708=events['length'];_0x3c9cd2<_0x1c0708;_0x3c9cd2++){var _0xa09d21=events[_0x3c9cd2];var _0x2ffced=createListener('squareProject:'+_0xa09d21,_0x539557);SquareProjectEvents['on'](_0xa09d21,_0x2ffced);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 02f4ea3..80a6470 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x292acd,_0x183894){var _0x23f975=function(_0x2b3f01){while(--_0x2b3f01){_0x292acd['push'](_0x292acd['shift']());}};_0x23f975(++_0x183894);}(_0x814b,0x1a2));var _0xb814=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0x814b[_0x18f396];return _0x3ba532;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x1b0bd9,_0x3edec1){var _0x7cff7b=function(_0x5eb523){while(--_0x5eb523){_0x1b0bd9['push'](_0x1b0bd9['shift']());}};_0x7cff7b(++_0x3edec1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x31a520,_0x231135){_0x31a520=_0x31a520-0x0;var _0x57d51a=_0x1cb9[_0x31a520];return _0x57d51a;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 036570d..40a8cbc 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 _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x3c9665,_0x17f8b0){var _0x17e43a=function(_0x52d22b){while(--_0x52d22b){_0x3c9665['push'](_0x3c9665['shift']());}};_0x17e43a(++_0x17f8b0);}(_0xb458,0x103));var _0x8b45=function(_0x4f1651,_0xc4ac4f){_0x4f1651=_0x4f1651-0x0;var _0x44868e=_0xb458[_0x4f1651];return _0x44868e;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file +var _0x33c5=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','exports'];(function(_0x23821a,_0x4ca1e6){var _0x310a88=function(_0xddbf99){while(--_0xddbf99){_0x23821a['push'](_0x23821a['shift']());}};_0x310a88(++_0x4ca1e6);}(_0x33c5,0xe6));var _0x533c=function(_0x575934,_0x4a6760){_0x575934=_0x575934-0x0;var _0x109a3d=_0x33c5[_0x575934];return _0x109a3d;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'uniqueid':{'type':Sequelize[_0x533c('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'extension':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x533c('0x1')]},'saveName':{'type':Sequelize[_0x533c('0x1')]},'filename':{'type':Sequelize[_0x533c('0x1')]},'savePath':{'type':Sequelize[_0x533c('0x1')]},'format':{'type':Sequelize[_0x533c('0x2')],'get':function(){var _0x1699d5='';var _0x3a009b=this[_0x533c('0x3')](_0x533c('0x4'));if(_0x3a009b){_0x1699d5=_0x3a009b[_0x533c('0x5')](_0x3a009b[_0x533c('0x6')]('.'));}return _0x1699d5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1c94332..7ec8465 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 _0xf58c=['cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','SquareRecording','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf58c,0x189));var _0xcf58=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xf58c[_0x1cc961];return _0x471d86;};'use strict';var emlformat=require(_0xcf58('0x0'));var rimraf=require(_0xcf58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf58('0x2'));var rp=require(_0xcf58('0x3'));var moment=require(_0xcf58('0x4'));var BPromise=require(_0xcf58('0x5'));var Mustache=require(_0xcf58('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcf58('0x7'));var csv=require(_0xcf58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf58('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcf58('0xa'));var deskjs=require(_0xcf58('0xb'));var toCsv=require(_0xcf58('0x8'));var querystring=require(_0xcf58('0xc'));var Papa=require(_0xcf58('0xd'));var Redis=require(_0xcf58('0xe'));var authService=require(_0xcf58('0xf'));var qs=require(_0xcf58('0x10'));var as=require(_0xcf58('0x11'));var hardwareService=require(_0xcf58('0x12'));var logger=require(_0xcf58('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcf58('0x14'));var licenseUtil=require(_0xcf58('0x15'));var db=require(_0xcf58('0x16'))['db'];function respondWithStatusCode(_0x35b9d0,_0x299e75){_0x299e75=_0x299e75||0xcc;return function(_0x1f29df){if(_0x1f29df){return _0x35b9d0['sendStatus'](_0x299e75);}return _0x35b9d0[_0xcf58('0x17')](_0x299e75)[_0xcf58('0x18')]();};}function respondWithResult(_0x118704,_0x500a90){_0x500a90=_0x500a90||0xc8;return function(_0x4c4ccb){if(_0x4c4ccb){return _0x118704[_0xcf58('0x17')](_0x500a90)[_0xcf58('0x19')](_0x4c4ccb);}};}function respondWithFilteredResult(_0x1ef510,_0x14ce62){return function(_0x342bb7){if(_0x342bb7){var _0x386596=typeof _0x14ce62['offset']==='undefined'&&typeof _0x14ce62[_0xcf58('0x1a')]===_0xcf58('0x1b');var _0x597350=_0x342bb7[_0xcf58('0x1c')];var _0xf41da6=_0x386596?0x0:_0x14ce62['offset'];var _0x560d42=_0x386596?_0x342bb7[_0xcf58('0x1c')]:_0x14ce62[_0xcf58('0x1d')]+_0x14ce62[_0xcf58('0x1a')];var _0x497f5e;if(_0x560d42>=_0x597350){_0x560d42=_0x597350;_0x497f5e=0xc8;}else{_0x497f5e=0xce;}_0x1ef510[_0xcf58('0x17')](_0x497f5e);return _0x1ef510[_0xcf58('0x1e')](_0xcf58('0x1f'),_0xf41da6+'-'+_0x560d42+'/'+_0x597350)[_0xcf58('0x19')](_0x342bb7);}return null;};}function patchUpdates(_0xdda0b6){return function(_0xa9cb2a){try{jsonpatch[_0xcf58('0x20')](_0xa9cb2a,_0xdda0b6,!![]);}catch(_0x232728){return BPromise[_0xcf58('0x21')](_0x232728);}return _0xa9cb2a['save']();};}function saveUpdates(_0x506c89,_0x258f23){return function(_0x40464b){if(_0x40464b){return _0x40464b['update'](_0x506c89)[_0xcf58('0x22')](function(_0x29e3e0){return _0x29e3e0;});}return null;};}function removeEntity(_0x2b2351,_0x3245d7){return function(_0x541140){if(_0x541140){return _0x541140[_0xcf58('0x23')]()[_0xcf58('0x22')](function(){_0x2b2351['status'](0xcc)[_0xcf58('0x18')]();});}};}function handleEntityNotFound(_0x5d6e92,_0x16fe52){return function(_0x42db34){if(!_0x42db34){_0x5d6e92['sendStatus'](0x194);}return _0x42db34;};}function handleError(_0x4a391b,_0x3db4b9){_0x3db4b9=_0x3db4b9||0x1f4;return function(_0x16f826){logger[_0xcf58('0x24')](_0x16f826[_0xcf58('0x25')]);if(_0x16f826[_0xcf58('0x26')]){delete _0x16f826[_0xcf58('0x26')];}_0x4a391b[_0xcf58('0x17')](_0x3db4b9)[_0xcf58('0x27')](_0x16f826);};}exports['index']=function(_0x582e08,_0x43cf85){var _0x2e1cb6={},_0x18803e={},_0x5d4792={'count':0x0,'rows':[]};var _0x5c4204=_[_0xcf58('0x28')](db[_0xcf58('0x29')]['rawAttributes'],function(_0x16a8d5){return{'name':_0x16a8d5[_0xcf58('0x2a')],'type':_0x16a8d5[_0xcf58('0x2b')][_0xcf58('0x2c')]};});_0x18803e[_0xcf58('0x2d')]=_[_0xcf58('0x28')](_0x5c4204,_0xcf58('0x26'));_0x18803e[_0xcf58('0x2e')]=_[_0xcf58('0x2f')](_0x582e08[_0xcf58('0x2e')]);_0x18803e['filters']=_[_0xcf58('0x30')](_0x18803e['model'],_0x18803e['query']);_0x2e1cb6['attributes']=_[_0xcf58('0x30')](_0x18803e[_0xcf58('0x2d')],qs['fields'](_0x582e08[_0xcf58('0x2e')][_0xcf58('0x31')]));_0x2e1cb6[_0xcf58('0x32')]=_0x2e1cb6[_0xcf58('0x32')][_0xcf58('0x33')]?_0x2e1cb6[_0xcf58('0x32')]:_0x18803e[_0xcf58('0x2d')];if(!_0x582e08['query'][_0xcf58('0x34')](_0xcf58('0x35'))){_0x2e1cb6[_0xcf58('0x1a')]=qs[_0xcf58('0x1a')](_0x582e08['query'][_0xcf58('0x1a')]);_0x2e1cb6['offset']=qs['offset'](_0x582e08['query'][_0xcf58('0x1d')]);}_0x2e1cb6[_0xcf58('0x36')]=qs[_0xcf58('0x37')](_0x582e08[_0xcf58('0x2e')][_0xcf58('0x37')]);_0x2e1cb6['where']=qs[_0xcf58('0x38')](_[_0xcf58('0x39')](_0x582e08[_0xcf58('0x2e')],_0x18803e['filters']),_0x5c4204);if(_0x582e08['query'][_0xcf58('0x3a')]){_0x2e1cb6[_0xcf58('0x3b')]=_[_0xcf58('0x3c')](_0x2e1cb6[_0xcf58('0x3b')],{'$or':_[_0xcf58('0x28')](_0x5c4204,function(_0x2a8ce9){if(_0x2a8ce9[_0xcf58('0x2b')]!==_0xcf58('0x3d')){var _0x594acf={};_0x594acf[_0x2a8ce9['name']]={'$like':'%'+_0x582e08[_0xcf58('0x2e')]['filter']+'%'};return _0x594acf;}})});}_0x2e1cb6=_[_0xcf58('0x3c')]({},_0x2e1cb6,_0x582e08[_0xcf58('0x3e')]);var _0x695d11={'where':_0x2e1cb6[_0xcf58('0x3b')]};return db[_0xcf58('0x29')][_0xcf58('0x1c')](_0x695d11)['then'](function(_0x2e81cb){_0x5d4792['count']=_0x2e81cb;if(_0x582e08[_0xcf58('0x2e')][_0xcf58('0x3f')]){_0x2e1cb6[_0xcf58('0x40')]=[{'all':!![]}];}return db[_0xcf58('0x29')][_0xcf58('0x41')](_0x2e1cb6);})[_0xcf58('0x22')](function(_0x37d52c){_0x5d4792[_0xcf58('0x42')]=_0x37d52c;return _0x5d4792;})[_0xcf58('0x22')](respondWithFilteredResult(_0x43cf85,_0x2e1cb6))[_0xcf58('0x43')](handleError(_0x43cf85,null));};exports[_0xcf58('0x44')]=function(_0x1eca30,_0x1b63f6){var _0x22a9ff={'raw':!![],'where':{'id':_0x1eca30[_0xcf58('0x45')]['id']}},_0x3cdb50={};_0x3cdb50[_0xcf58('0x2d')]=_[_0xcf58('0x2f')](db[_0xcf58('0x29')]['rawAttributes']);_0x3cdb50['query']=_[_0xcf58('0x2f')](_0x1eca30['query']);_0x3cdb50[_0xcf58('0x38')]=_[_0xcf58('0x30')](_0x3cdb50[_0xcf58('0x2d')],_0x3cdb50[_0xcf58('0x2e')]);_0x22a9ff[_0xcf58('0x32')]=_[_0xcf58('0x30')](_0x3cdb50[_0xcf58('0x2d')],qs['fields'](_0x1eca30[_0xcf58('0x2e')]['fields']));_0x22a9ff[_0xcf58('0x32')]=_0x22a9ff['attributes']['length']?_0x22a9ff[_0xcf58('0x32')]:_0x3cdb50['model'];if(_0x1eca30['query'][_0xcf58('0x3f')]){_0x22a9ff[_0xcf58('0x40')]=[{'all':!![]}];}_0x22a9ff=_[_0xcf58('0x3c')]({},_0x22a9ff,_0x1eca30[_0xcf58('0x3e')]);return db[_0xcf58('0x29')][_0xcf58('0x46')](_0x22a9ff)[_0xcf58('0x22')](handleEntityNotFound(_0x1b63f6,null))['then'](respondWithResult(_0x1b63f6,null))[_0xcf58('0x43')](handleError(_0x1b63f6,null));};exports[_0xcf58('0x47')]=function(_0x7582fa,_0x562a7d){return db[_0xcf58('0x29')][_0xcf58('0x47')](_0x7582fa[_0xcf58('0x48')],{})[_0xcf58('0x22')](respondWithResult(_0x562a7d,0xc9))['catch'](handleError(_0x562a7d,null));};exports[_0xcf58('0x49')]=function(_0xfe9a82,_0x49a990){if(_0xfe9a82[_0xcf58('0x48')]['id']){delete _0xfe9a82['body']['id'];}return db[_0xcf58('0x29')][_0xcf58('0x46')]({'where':{'id':_0xfe9a82[_0xcf58('0x45')]['id']}})[_0xcf58('0x22')](handleEntityNotFound(_0x49a990,null))['then'](saveUpdates(_0xfe9a82[_0xcf58('0x48')],null))[_0xcf58('0x22')](respondWithResult(_0x49a990,null))[_0xcf58('0x43')](handleError(_0x49a990,null));};exports[_0xcf58('0x4a')]=function(_0x3fa58e,_0x5a586f,_0x5a8e08){var _0x44a147=require(_0xcf58('0x4b'));var _0xda1103=![];var _0x421aca={};if(_0x3fa58e['query'][_0xcf58('0x2b')]&&_0x3fa58e[_0xcf58('0x2e')][_0xcf58('0x2b')]==='uniqueid'){_0x421aca[_0xcf58('0x4c')]=_0x3fa58e['params']['id'];}else{_0x421aca['id']=_0x3fa58e['params']['id'];}return db['SquareRecording'][_0xcf58('0x46')]({'where':_0x421aca,'attributes':['id',_0xcf58('0x4d'),'filename'],'raw':!![]})[_0xcf58('0x22')](handleEntityNotFound(_0x5a586f,null))['then'](function(_0x3e5b3c){if(_0x3e5b3c){var _0x2c3c5d=_0x3e5b3c[_0xcf58('0x4d')];var _0x383f8c=util[_0xcf58('0x4e')](_0xcf58('0x4f'),_0x2c3c5d);if(fs[_0xcf58('0x50')](_0x383f8c)){_0xda1103=!![];return _0x44a147['decryptFile'](_0x383f8c,_0x2c3c5d,config[_0xcf58('0x51')][_0xcf58('0x52')])[_0xcf58('0x22')](function(){return _0x3e5b3c;});}return _0x3e5b3c;}})[_0xcf58('0x22')](function(_0x3ea2bd){if(_0x3ea2bd){var _0x1b18a8=_0x3ea2bd[_0xcf58('0x4d')];if(!fs[_0xcf58('0x50')](_0x1b18a8)){throw new db[(_0xcf58('0x53'))]['ValidationError'](_0xcf58('0x54'));}if(_0x3ea2bd[_0xcf58('0x55')]){return _0x5a586f[_0xcf58('0x4a')](_0x1b18a8,_0x3ea2bd[_0xcf58('0x55')]+path[_0xcf58('0x56')](_0x1b18a8),function(){if(_0xda1103){fs[_0xcf58('0x57')](_0x1b18a8);}});}else{return _0x5a586f[_0xcf58('0x4a')](_0x1b18a8,function(_0x282ff3){if(_0xda1103){fs[_0xcf58('0x57')](_0x1b18a8);}});}}})['catch'](function(_0x1a6655){if(_0x1a6655[_0xcf58('0x58')]===_0xcf58('0x54')){_0x5a586f[_0xcf58('0x17')](0x194)['send'](_0xcf58('0x59'));}else{return handleError(_0x5a586f,null);}});};exports[_0xcf58('0x23')]=function(_0x54ff39,_0x1768bb){return db[_0xcf58('0x29')]['find']({'where':{'id':_0x54ff39['params']['id']}})['then'](function(_0x3acb98){if(_[_0xcf58('0x5a')](_0x3acb98)){throw new ReferenceError(_0xcf58('0x5b'));}return _0x3acb98;})['then'](function(_0x4c1de4){var _0x47339d=_0x4c1de4[_0xcf58('0x4d')];logger['info'](_0xcf58('0x5c'),_0x47339d);if(!_['isNil'](_0x4c1de4[_0xcf58('0x4d')])&&fs[_0xcf58('0x50')](_0x47339d)){logger['info']('File:\x20\x22'+_0x47339d+_0xcf58('0x5d'));fs[_0xcf58('0x5e')](_0x47339d);}_0x47339d=_0x47339d+_0xcf58('0x5f');if(!_[_0xcf58('0x5a')](_0x4c1de4[_0xcf58('0x4d')])&&fs[_0xcf58('0x50')](_0x47339d)){logger[_0xcf58('0x60')]('File:\x20\x22'+_0x47339d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcf58('0x5e')](_0x47339d);}return _0x4c1de4;})['then'](function(_0x2d8b13){if(!_0x2d8b13)throw new InternalError();return _0x2d8b13[_0xcf58('0x23')]();})['then'](function(){_0x1768bb[_0xcf58('0x17')](0xcc)[_0xcf58('0x18')]();})[_0xcf58('0x43')](handleError(_0x1768bb,null));}; \ No newline at end of file +var _0xa0cf=['pick','filter','merge','includeAll','findAll','rows','catch','params','include','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x327f3c,_0x46981a){var _0x2d85f3=function(_0x487da0){while(--_0x487da0){_0x327f3c['push'](_0x327f3c['shift']());}};_0x2d85f3(++_0x46981a);}(_0xa0cf,0x1a0));var _0xfa0c=function(_0x42aabd,_0x217ade){_0x42aabd=_0x42aabd-0x0;var _0x2e83fb=_0xa0cf[_0x42aabd];return _0x2e83fb;};'use strict';var emlformat=require(_0xfa0c('0x0'));var rimraf=require(_0xfa0c('0x1'));var zipdir=require(_0xfa0c('0x2'));var jsonpatch=require(_0xfa0c('0x3'));var rp=require(_0xfa0c('0x4'));var moment=require(_0xfa0c('0x5'));var BPromise=require(_0xfa0c('0x6'));var Mustache=require(_0xfa0c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfa0c('0x8'));var ejs=require(_0xfa0c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa0c('0xa'));var squel=require(_0xfa0c('0xb'));var crypto=require(_0xfa0c('0xc'));var jsforce=require(_0xfa0c('0xd'));var deskjs=require(_0xfa0c('0xe'));var toCsv=require(_0xfa0c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfa0c('0xf'));var authService=require(_0xfa0c('0x10'));var qs=require(_0xfa0c('0x11'));var as=require(_0xfa0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa0c('0x13'));var utils=require(_0xfa0c('0x14'));var config=require(_0xfa0c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa0c('0x16'))['db'];function respondWithStatusCode(_0x5e6806,_0x2f0e84){_0x2f0e84=_0x2f0e84||0xcc;return function(_0x30c436){if(_0x30c436){return _0x5e6806[_0xfa0c('0x17')](_0x2f0e84);}return _0x5e6806[_0xfa0c('0x18')](_0x2f0e84)[_0xfa0c('0x19')]();};}function respondWithResult(_0x3e5784,_0x150370){_0x150370=_0x150370||0xc8;return function(_0x3eb793){if(_0x3eb793){return _0x3e5784[_0xfa0c('0x18')](_0x150370)['json'](_0x3eb793);}};}function respondWithFilteredResult(_0x239813,_0x2c2c2c){return function(_0x280483){if(_0x280483){var _0x433eb0=typeof _0x2c2c2c[_0xfa0c('0x1a')]===_0xfa0c('0x1b')&&typeof _0x2c2c2c['limit']===_0xfa0c('0x1b');var _0x7173c9=_0x280483[_0xfa0c('0x1c')];var _0x465310=_0x433eb0?0x0:_0x2c2c2c[_0xfa0c('0x1a')];var _0x2721e8=_0x433eb0?_0x280483[_0xfa0c('0x1c')]:_0x2c2c2c[_0xfa0c('0x1a')]+_0x2c2c2c['limit'];var _0x5bd666;if(_0x2721e8>=_0x7173c9){_0x2721e8=_0x7173c9;_0x5bd666=0xc8;}else{_0x5bd666=0xce;}_0x239813[_0xfa0c('0x18')](_0x5bd666);return _0x239813[_0xfa0c('0x1d')](_0xfa0c('0x1e'),_0x465310+'-'+_0x2721e8+'/'+_0x7173c9)[_0xfa0c('0x1f')](_0x280483);}return null;};}function patchUpdates(_0x2317f2){return function(_0x4d16ca){try{jsonpatch['apply'](_0x4d16ca,_0x2317f2,!![]);}catch(_0x44b02c){return BPromise[_0xfa0c('0x20')](_0x44b02c);}return _0x4d16ca[_0xfa0c('0x21')]();};}function saveUpdates(_0xe78dec,_0xcbf125){return function(_0x25f44d){if(_0x25f44d){return _0x25f44d[_0xfa0c('0x22')](_0xe78dec)[_0xfa0c('0x23')](function(_0x181873){return _0x181873;});}return null;};}function removeEntity(_0x2a215a,_0x530ff2){return function(_0x551735){if(_0x551735){return _0x551735[_0xfa0c('0x24')]()[_0xfa0c('0x23')](function(){_0x2a215a[_0xfa0c('0x18')](0xcc)[_0xfa0c('0x19')]();});}};}function handleEntityNotFound(_0x381bc3,_0x302ad4){return function(_0x2dc16d){if(!_0x2dc16d){_0x381bc3[_0xfa0c('0x17')](0x194);}return _0x2dc16d;};}function handleError(_0x10aa54,_0x3422af){_0x3422af=_0x3422af||0x1f4;return function(_0x3f0383){logger[_0xfa0c('0x25')](_0x3f0383['stack']);if(_0x3f0383[_0xfa0c('0x26')]){delete _0x3f0383[_0xfa0c('0x26')];}_0x10aa54[_0xfa0c('0x18')](_0x3422af)['send'](_0x3f0383);};}exports['index']=function(_0x416dc2,_0x8ed571){var _0x516287={},_0x450590={},_0x323e44={'count':0x0,'rows':[]};var _0x3b5210=_[_0xfa0c('0x27')](db[_0xfa0c('0x28')][_0xfa0c('0x29')],function(_0x221feb){return{'name':_0x221feb[_0xfa0c('0x2a')],'type':_0x221feb[_0xfa0c('0x2b')][_0xfa0c('0x2c')]};});_0x450590[_0xfa0c('0x2d')]=_[_0xfa0c('0x27')](_0x3b5210,_0xfa0c('0x26'));_0x450590['query']=_[_0xfa0c('0x2e')](_0x416dc2['query']);_0x450590[_0xfa0c('0x2f')]=_[_0xfa0c('0x30')](_0x450590['model'],_0x450590[_0xfa0c('0x31')]);_0x516287[_0xfa0c('0x32')]=_[_0xfa0c('0x30')](_0x450590[_0xfa0c('0x2d')],qs[_0xfa0c('0x33')](_0x416dc2[_0xfa0c('0x31')][_0xfa0c('0x33')]));_0x516287[_0xfa0c('0x32')]=_0x516287['attributes'][_0xfa0c('0x34')]?_0x516287[_0xfa0c('0x32')]:_0x450590[_0xfa0c('0x2d')];if(!_0x416dc2['query'][_0xfa0c('0x35')](_0xfa0c('0x36'))){_0x516287[_0xfa0c('0x37')]=qs[_0xfa0c('0x37')](_0x416dc2[_0xfa0c('0x31')][_0xfa0c('0x37')]);_0x516287['offset']=qs[_0xfa0c('0x1a')](_0x416dc2[_0xfa0c('0x31')]['offset']);}_0x516287[_0xfa0c('0x38')]=qs['sort'](_0x416dc2['query'][_0xfa0c('0x39')]);_0x516287[_0xfa0c('0x3a')]=qs[_0xfa0c('0x2f')](_[_0xfa0c('0x3b')](_0x416dc2[_0xfa0c('0x31')],_0x450590[_0xfa0c('0x2f')]),_0x3b5210);if(_0x416dc2['query'][_0xfa0c('0x3c')]){_0x516287[_0xfa0c('0x3a')]=_[_0xfa0c('0x3d')](_0x516287[_0xfa0c('0x3a')],{'$or':_['map'](_0x3b5210,function(_0x437191){if(_0x437191[_0xfa0c('0x2b')]!=='VIRTUAL'){var _0x398d64={};_0x398d64[_0x437191['name']]={'$like':'%'+_0x416dc2[_0xfa0c('0x31')][_0xfa0c('0x3c')]+'%'};return _0x398d64;}})});}_0x516287=_[_0xfa0c('0x3d')]({},_0x516287,_0x416dc2['options']);var _0x5590a1={'where':_0x516287['where']};return db[_0xfa0c('0x28')]['count'](_0x5590a1)[_0xfa0c('0x23')](function(_0x32f7b0){_0x323e44[_0xfa0c('0x1c')]=_0x32f7b0;if(_0x416dc2[_0xfa0c('0x31')][_0xfa0c('0x3e')]){_0x516287['include']=[{'all':!![]}];}return db[_0xfa0c('0x28')][_0xfa0c('0x3f')](_0x516287);})['then'](function(_0x55cba8){_0x323e44[_0xfa0c('0x40')]=_0x55cba8;return _0x323e44;})[_0xfa0c('0x23')](respondWithFilteredResult(_0x8ed571,_0x516287))[_0xfa0c('0x41')](handleError(_0x8ed571,null));};exports['show']=function(_0x2d96eb,_0x655de9){var _0x27ffed={'raw':!![],'where':{'id':_0x2d96eb[_0xfa0c('0x42')]['id']}},_0x8ff7a5={};_0x8ff7a5['model']=_[_0xfa0c('0x2e')](db[_0xfa0c('0x28')]['rawAttributes']);_0x8ff7a5[_0xfa0c('0x31')]=_[_0xfa0c('0x2e')](_0x2d96eb[_0xfa0c('0x31')]);_0x8ff7a5[_0xfa0c('0x2f')]=_['intersection'](_0x8ff7a5['model'],_0x8ff7a5[_0xfa0c('0x31')]);_0x27ffed[_0xfa0c('0x32')]=_[_0xfa0c('0x30')](_0x8ff7a5[_0xfa0c('0x2d')],qs[_0xfa0c('0x33')](_0x2d96eb[_0xfa0c('0x31')][_0xfa0c('0x33')]));_0x27ffed[_0xfa0c('0x32')]=_0x27ffed['attributes'][_0xfa0c('0x34')]?_0x27ffed[_0xfa0c('0x32')]:_0x8ff7a5[_0xfa0c('0x2d')];if(_0x2d96eb[_0xfa0c('0x31')]['includeAll']){_0x27ffed[_0xfa0c('0x43')]=[{'all':!![]}];}_0x27ffed=_[_0xfa0c('0x3d')]({},_0x27ffed,_0x2d96eb[_0xfa0c('0x44')]);return db[_0xfa0c('0x28')][_0xfa0c('0x45')](_0x27ffed)[_0xfa0c('0x23')](handleEntityNotFound(_0x655de9,null))[_0xfa0c('0x23')](respondWithResult(_0x655de9,null))[_0xfa0c('0x41')](handleError(_0x655de9,null));};exports[_0xfa0c('0x46')]=function(_0x3101cb,_0x454278){return db[_0xfa0c('0x28')][_0xfa0c('0x46')](_0x3101cb['body'],{})[_0xfa0c('0x23')](respondWithResult(_0x454278,0xc9))[_0xfa0c('0x41')](handleError(_0x454278,null));};exports[_0xfa0c('0x22')]=function(_0x2d02f8,_0x484d14){if(_0x2d02f8[_0xfa0c('0x47')]['id']){delete _0x2d02f8[_0xfa0c('0x47')]['id'];}return db['SquareRecording'][_0xfa0c('0x45')]({'where':{'id':_0x2d02f8[_0xfa0c('0x42')]['id']}})[_0xfa0c('0x23')](handleEntityNotFound(_0x484d14,null))[_0xfa0c('0x23')](saveUpdates(_0x2d02f8[_0xfa0c('0x47')],null))['then'](respondWithResult(_0x484d14,null))[_0xfa0c('0x41')](handleError(_0x484d14,null));};exports[_0xfa0c('0x48')]=function(_0x56319d,_0x439694,_0x4c44f8){var _0x103f7f=require(_0xfa0c('0x49'));var _0x2bdf3b=![];var _0x22c236={};if(_0x56319d['query']['type']&&_0x56319d['query']['type']==='uniqueid'){_0x22c236[_0xfa0c('0x4a')]=_0x56319d[_0xfa0c('0x42')]['id'];}else{_0x22c236['id']=_0x56319d[_0xfa0c('0x42')]['id'];}return db[_0xfa0c('0x28')][_0xfa0c('0x45')]({'where':_0x22c236,'attributes':['id',_0xfa0c('0x4b'),_0xfa0c('0x4c')],'raw':!![]})[_0xfa0c('0x23')](handleEntityNotFound(_0x439694,null))[_0xfa0c('0x23')](function(_0x34a1d7){if(_0x34a1d7){var _0x3bc70a=_0x34a1d7['savePath'];var _0x5984b0=util[_0xfa0c('0x4d')]('%s.cypher',_0x3bc70a);if(fs[_0xfa0c('0x4e')](_0x5984b0)){_0x2bdf3b=!![];return _0x103f7f[_0xfa0c('0x4f')](_0x5984b0,_0x3bc70a,config[_0xfa0c('0x50')][_0xfa0c('0x51')])[_0xfa0c('0x23')](function(){return _0x34a1d7;});}return _0x34a1d7;}})['then'](function(_0xb02fd9){if(_0xb02fd9){var _0x26269c=_0xb02fd9[_0xfa0c('0x4b')];if(!fs[_0xfa0c('0x4e')](_0x26269c)){throw new db[(_0xfa0c('0x52'))][(_0xfa0c('0x53'))](_0xfa0c('0x54'));}if(_0xb02fd9[_0xfa0c('0x4c')]){return _0x439694[_0xfa0c('0x48')](_0x26269c,_0xb02fd9[_0xfa0c('0x4c')]+path['extname'](_0x26269c),function(){if(_0x2bdf3b){fs['unlink'](_0x26269c);}});}else{return _0x439694[_0xfa0c('0x48')](_0x26269c,function(_0x2bd9c6){if(_0x2bdf3b){fs[_0xfa0c('0x55')](_0x26269c);}});}}})[_0xfa0c('0x41')](function(_0x1703e0){if(_0x1703e0[_0xfa0c('0x56')]===_0xfa0c('0x54')){_0x439694[_0xfa0c('0x18')](0x194)[_0xfa0c('0x57')]('Not\x20found');}else{return handleError(_0x439694,null);}});};exports[_0xfa0c('0x24')]=function(_0x867c89,_0x38c6d){return db[_0xfa0c('0x28')][_0xfa0c('0x45')]({'where':{'id':_0x867c89[_0xfa0c('0x42')]['id']}})[_0xfa0c('0x23')](function(_0x5ee12f){if(_[_0xfa0c('0x58')](_0x5ee12f)){throw new ReferenceError(_0xfa0c('0x59'));}return _0x5ee12f;})['then'](function(_0x1cd909){var _0x256367=_0x1cd909['savePath'];logger[_0xfa0c('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x256367);if(!_[_0xfa0c('0x58')](_0x1cd909[_0xfa0c('0x4b')])&&fs[_0xfa0c('0x4e')](_0x256367)){logger[_0xfa0c('0x5a')](_0xfa0c('0x5b')+_0x256367+_0xfa0c('0x5c'));fs[_0xfa0c('0x5d')](_0x256367);}_0x256367=_0x256367+_0xfa0c('0x5e');if(!_[_0xfa0c('0x58')](_0x1cd909[_0xfa0c('0x4b')])&&fs['existsSync'](_0x256367)){logger['info']('File:\x20\x22'+_0x256367+_0xfa0c('0x5c'));fs[_0xfa0c('0x5d')](_0x256367);}return _0x1cd909;})[_0xfa0c('0x23')](function(_0x569019){if(!_0x569019)throw new InternalError();return _0x569019['destroy']();})['then'](function(){_0x38c6d['status'](0xcc)[_0xfa0c('0x19')]();})[_0xfa0c('0x41')](handleError(_0x38c6d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 543a254..b8db161 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 _0xafc4=['path','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xafc4,0x69));var _0x4afc=function(_0x3416e5,_0x18dbd9){_0x3416e5=_0x3416e5-0x0;var _0x3a5b8a=_0xafc4[_0x3416e5];return _0x3a5b8a;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7374=['SquareRecording','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x2408ca,_0x397a53){var _0x271588=function(_0x1b604e){while(--_0x1b604e){_0x2408ca['push'](_0x2408ca['shift']());}};_0x271588(++_0x397a53);}(_0x7374,0x1b9));var _0x4737=function(_0xdaf565,_0x3a7257){_0xdaf565=_0xdaf565-0x0;var _0x2520e6=_0x7374[_0xdaf565];return _0x2520e6;};'use strict';var _=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var logger=require(_0x4737('0x2'))(_0x4737('0x3'));var moment=require(_0x4737('0x4'));var BPromise=require('bluebird');var rp=require(_0x4737('0x5'));var fs=require('fs');var path=require(_0x4737('0x6'));var rimraf=require(_0x4737('0x7'));var config=require(_0x4737('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x162bf0,_0xc35930){return _0x162bf0[_0x4737('0x9')](_0x4737('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 355cf4a..cb3d14e 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 _0x82dc=['body','options','CreateSquareRecording','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareRecording','create'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x82dc,0x1cb));var _0xc82d=function(_0x577c5a,_0x2adb69){_0x577c5a=_0x577c5a-0x0;var _0x1e69e3=_0x82dc[_0x577c5a];return _0x1e69e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc82d('0x0'));var rs=require(_0xc82d('0x1'));var fs=require('fs');var Redis=require(_0xc82d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc82d('0x3'));var logger=require('../../config/logger')(_0xc82d('0x4'));var config=require(_0xc82d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc82d('0x6')][_0xc82d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e1e67,_0x2b6cce,_0x4f42f1){return new BPromise(function(_0x19994e,_0x1e50f0){return client['request'](_0x5e1e67,_0x4f42f1)[_0xc82d('0x8')](function(_0x45a35d){logger[_0xc82d('0x9')](_0xc82d('0xa'),_0x2b6cce,_0xc82d('0xb'));logger[_0xc82d('0xc')](_0xc82d('0xd'),_0x2b6cce,_0xc82d('0xb'),JSON[_0xc82d('0xe')](_0x45a35d));if(_0x45a35d[_0xc82d('0xf')]){if(_0x45a35d['error']['code']===0x1f4){logger['error'](_0xc82d('0xa'),_0x2b6cce,_0x45a35d['error'][_0xc82d('0x10')]);return _0x1e50f0(_0x45a35d[_0xc82d('0xf')][_0xc82d('0x10')]);}logger[_0xc82d('0xf')]('SquareRecording,\x20%s,\x20%s',_0x2b6cce,_0x45a35d[_0xc82d('0xf')][_0xc82d('0x10')]);return _0x19994e(_0x45a35d['error'][_0xc82d('0x10')]);}else{logger[_0xc82d('0x9')](_0xc82d('0xa'),_0x2b6cce,_0xc82d('0xb'));_0x19994e(_0x45a35d[_0xc82d('0x11')][_0xc82d('0x10')]);}})[_0xc82d('0x12')](function(_0x5dc21e){logger[_0xc82d('0xf')](_0xc82d('0xa'),_0x2b6cce,_0x5dc21e);_0x1e50f0(_0x5dc21e);});});}exports['CreateSquareRecording']=function(_0x4cb7b0){var _0x5c8f46=this;return new Promise(function(_0x276cb9,_0x510f35){return db[_0xc82d('0x13')][_0xc82d('0x14')](_0x4cb7b0[_0xc82d('0x15')],{'raw':_0x4cb7b0[_0xc82d('0x16')]?_0x4cb7b0[_0xc82d('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc82d('0x8')](function(_0x5144f8){logger[_0xc82d('0x9')](_0xc82d('0x17'),_0x4cb7b0);logger[_0xc82d('0xc')](_0xc82d('0x17'),_0x4cb7b0,JSON[_0xc82d('0xe')](_0x5144f8));_0x276cb9(_0x5144f8);})[_0xc82d('0x12')](function(_0x294104){logger[_0xc82d('0xf')](_0xc82d('0x17'),_0x294104[_0xc82d('0x10')],_0x4cb7b0);_0x510f35(_0x5c8f46[_0xc82d('0xf')](0x1f4,_0x294104[_0xc82d('0x10')]));});});}; \ No newline at end of file +var _0x5879=['SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7c3bf0,_0x1f0a94){var _0x37ddaa=function(_0x1136e4){while(--_0x1136e4){_0x7c3bf0['push'](_0x7c3bf0['shift']());}};_0x37ddaa(++_0x1f0a94);}(_0x5879,0xdb));var _0x9587=function(_0x5d2aba,_0x5ea233){_0x5d2aba=_0x5d2aba-0x0;var _0x2f53f0=_0x5879[_0x5d2aba];return _0x2f53f0;};'use strict';var _=require(_0x9587('0x0'));var util=require(_0x9587('0x1'));var moment=require(_0x9587('0x2'));var BPromise=require(_0x9587('0x3'));var rs=require(_0x9587('0x4'));var fs=require('fs');var Redis=require(_0x9587('0x5'));var db=require(_0x9587('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9587('0x7'))('rpc');var config=require(_0x9587('0x8'));var jayson=require(_0x9587('0x9'));var client=jayson[_0x9587('0xa')][_0x9587('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4430c5,_0x57d1f6,_0xc5892d){return new BPromise(function(_0xa2bcbe,_0x37f23e){return client[_0x9587('0xc')](_0x4430c5,_0xc5892d)[_0x9587('0xd')](function(_0x43470f){logger[_0x9587('0xe')]('SquareRecording,\x20%s,\x20%s',_0x57d1f6,_0x9587('0xf'));logger[_0x9587('0x10')](_0x9587('0x11'),_0x57d1f6,'request\x20sent',JSON[_0x9587('0x12')](_0x43470f));if(_0x43470f[_0x9587('0x13')]){if(_0x43470f[_0x9587('0x13')][_0x9587('0x14')]===0x1f4){logger['error'](_0x9587('0x15'),_0x57d1f6,_0x43470f['error'][_0x9587('0x16')]);return _0x37f23e(_0x43470f[_0x9587('0x13')]['message']);}logger[_0x9587('0x13')](_0x9587('0x15'),_0x57d1f6,_0x43470f['error'][_0x9587('0x16')]);return _0xa2bcbe(_0x43470f[_0x9587('0x13')][_0x9587('0x16')]);}else{logger[_0x9587('0xe')](_0x9587('0x15'),_0x57d1f6,_0x9587('0xf'));_0xa2bcbe(_0x43470f[_0x9587('0x17')][_0x9587('0x16')]);}})[_0x9587('0x18')](function(_0x39c7e3){logger[_0x9587('0x13')](_0x9587('0x15'),_0x57d1f6,_0x39c7e3);_0x37f23e(_0x39c7e3);});});}exports[_0x9587('0x19')]=function(_0x589ac0){var _0x5a2b7a=this;return new Promise(function(_0x1e9f39,_0x4ebcac){return db['SquareRecording'][_0x9587('0x1a')](_0x589ac0[_0x9587('0x1b')],{'raw':_0x589ac0['options']?_0x589ac0[_0x9587('0x1c')][_0x9587('0x1d')]===undefined?!![]:![]:!![]})[_0x9587('0xd')](function(_0x92170f){logger[_0x9587('0xe')](_0x9587('0x19'),_0x589ac0);logger[_0x9587('0x10')](_0x9587('0x19'),_0x589ac0,JSON[_0x9587('0x12')](_0x92170f));_0x1e9f39(_0x92170f);})[_0x9587('0x18')](function(_0x50651c){logger[_0x9587('0x13')](_0x9587('0x19'),_0x50651c[_0x9587('0x16')],_0x589ac0);_0x4ebcac(_0x5a2b7a[_0x9587('0x13')](0x1f4,_0x50651c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 144a777..284d1fe 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2cb952,_0x11ce19){var _0xf9f9ba=function(_0x3b369a){while(--_0x3b369a){_0x2cb952['push'](_0x2cb952['shift']());}};_0xf9f9ba(++_0x11ce19);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a19d8bd..a49bf7b 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 _0xed4a=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x23c845,_0x35ec41){var _0x8704e5=function(_0x411b15){while(--_0x411b15){_0x23c845['push'](_0x23c845['shift']());}};_0x8704e5(++_0x35ec41);}(_0xed4a,0xd2));var _0xaed4=function(_0x32eb8c,_0x2f8904){_0x32eb8c=_0x32eb8c-0x0;var _0x5e09b5=_0xed4a[_0x32eb8c];return _0x5e09b5;};'use strict';var Sequelize=require(_0xaed4('0x0'));module[_0xaed4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xaed4('0x2')]},'channel':{'type':Sequelize[_0xaed4('0x2')]},'language':{'type':Sequelize[_0xaed4('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaed4('0x2')]},'version':{'type':Sequelize[_0xaed4('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaed4('0x2')]},'callingpres':{'type':Sequelize[_0xaed4('0x2')]},'callingani2':{'type':Sequelize[_0xaed4('0x2')]},'callington':{'type':Sequelize[_0xaed4('0x2')]},'callingtns':{'type':Sequelize[_0xaed4('0x2')]},'dnid':{'type':Sequelize[_0xaed4('0x2')]},'rdnis':{'type':Sequelize[_0xaed4('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xaed4('0x2')]},'priority':{'type':Sequelize[_0xaed4('0x2')]},'enhanced':{'type':Sequelize[_0xaed4('0x2')]},'accountcode':{'type':Sequelize[_0xaed4('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xaed4('0x2')]},'joinAt':{'type':Sequelize[_0xaed4('0x3')]},'leaveAt':{'type':Sequelize[_0xaed4('0x3')]},'bot':{'type':Sequelize[_0xaed4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8693=['DATE','BOOLEAN','STRING'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x8693,0xf8));var _0x3869=function(_0x1fcaae,_0x256649){_0x1fcaae=_0x1fcaae-0x0;var _0x10841f=_0x8693[_0x1fcaae];return _0x10841f;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x3869('0x0')]},'network_script':{'type':Sequelize[_0x3869('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3869('0x0')]},'uniqueid':{'type':Sequelize[_0x3869('0x0')]},'version':{'type':Sequelize[_0x3869('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3869('0x0')]},'callingpres':{'type':Sequelize[_0x3869('0x0')]},'callingani2':{'type':Sequelize[_0x3869('0x0')]},'callington':{'type':Sequelize[_0x3869('0x0')]},'callingtns':{'type':Sequelize[_0x3869('0x0')]},'dnid':{'type':Sequelize[_0x3869('0x0')]},'rdnis':{'type':Sequelize[_0x3869('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3869('0x0')]},'priority':{'type':Sequelize[_0x3869('0x0')]},'enhanced':{'type':Sequelize[_0x3869('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x3869('0x0')]},'project_name':{'type':Sequelize[_0x3869('0x0')]},'joinAt':{'type':Sequelize[_0x3869('0x1')]},'leaveAt':{'type':Sequelize[_0x3869('0x1')]},'bot':{'type':Sequelize[_0x3869('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 63c3290..009f7a9 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 _0xcc11=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','apply','reject','save','update','stack','name','send','index','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','catch','create','body','destroy','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x153067,_0xcf617b){var _0x7fa3d4=function(_0x364b01){while(--_0x364b01){_0x153067['push'](_0x153067['shift']());}};_0x7fa3d4(++_0xcf617b);}(_0xcc11,0xd4));var _0x1cc1=function(_0x5519c4,_0x270f91){_0x5519c4=_0x5519c4-0x0;var _0x2c1c3=_0xcc11[_0x5519c4];return _0x2c1c3;};'use strict';var emlformat=require(_0x1cc1('0x0'));var rimraf=require(_0x1cc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cc1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cc1('0x3'));var Mustache=require(_0x1cc1('0x4'));var util=require(_0x1cc1('0x5'));var path=require(_0x1cc1('0x6'));var sox=require(_0x1cc1('0x7'));var csv=require(_0x1cc1('0x8'));var ejs=require(_0x1cc1('0x9'));var fs=require('fs');var fs_extra=require(_0x1cc1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1cc1('0xb'));var jsforce=require(_0x1cc1('0xc'));var deskjs=require(_0x1cc1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cc1('0xe'));var authService=require(_0x1cc1('0xf'));var qs=require(_0x1cc1('0x10'));var as=require(_0x1cc1('0x11'));var hardwareService=require(_0x1cc1('0x12'));var logger=require(_0x1cc1('0x13'))(_0x1cc1('0x14'));var utils=require(_0x1cc1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1cc1('0x16'));var db=require(_0x1cc1('0x17'))['db'];function respondWithStatusCode(_0x253179,_0x28938b){_0x28938b=_0x28938b||0xcc;return function(_0x43cdee){if(_0x43cdee){return _0x253179[_0x1cc1('0x18')](_0x28938b);}return _0x253179['status'](_0x28938b)[_0x1cc1('0x19')]();};}function respondWithResult(_0x1c79b7,_0xe934fb){_0xe934fb=_0xe934fb||0xc8;return function(_0x15cfd8){if(_0x15cfd8){return _0x1c79b7[_0x1cc1('0x1a')](_0xe934fb)[_0x1cc1('0x1b')](_0x15cfd8);}};}function respondWithFilteredResult(_0xf06ffc,_0x4a579f){return function(_0xf12da8){if(_0xf12da8){var _0x183fa5=typeof _0x4a579f['offset']==='undefined'&&typeof _0x4a579f[_0x1cc1('0x1c')]==='undefined';var _0x24e3e2=_0xf12da8[_0x1cc1('0x1d')];var _0x5a1265=_0x183fa5?0x0:_0x4a579f[_0x1cc1('0x1e')];var _0x29fac6=_0x183fa5?_0xf12da8[_0x1cc1('0x1d')]:_0x4a579f[_0x1cc1('0x1e')]+_0x4a579f[_0x1cc1('0x1c')];var _0x5cbc9b;if(_0x29fac6>=_0x24e3e2){_0x29fac6=_0x24e3e2;_0x5cbc9b=0xc8;}else{_0x5cbc9b=0xce;}_0xf06ffc['status'](_0x5cbc9b);return _0xf06ffc[_0x1cc1('0x1f')]('Content-Range',_0x5a1265+'-'+_0x29fac6+'/'+_0x24e3e2)['json'](_0xf12da8);}return null;};}function patchUpdates(_0xf7a0e){return function(_0x38eb60){try{jsonpatch[_0x1cc1('0x20')](_0x38eb60,_0xf7a0e,!![]);}catch(_0x4a59f6){return BPromise[_0x1cc1('0x21')](_0x4a59f6);}return _0x38eb60[_0x1cc1('0x22')]();};}function saveUpdates(_0x1593df,_0xad51d7){return function(_0x44c704){if(_0x44c704){return _0x44c704[_0x1cc1('0x23')](_0x1593df)['then'](function(_0x53a3aa){return _0x53a3aa;});}return null;};}function removeEntity(_0x385230,_0x51a232){return function(_0x41fa63){if(_0x41fa63){return _0x41fa63['destroy']()['then'](function(){_0x385230[_0x1cc1('0x1a')](0xcc)[_0x1cc1('0x19')]();});}};}function handleEntityNotFound(_0x416c6a,_0x55a9a4){return function(_0x277e2e){if(!_0x277e2e){_0x416c6a[_0x1cc1('0x18')](0x194);}return _0x277e2e;};}function handleError(_0x225195,_0xfc1a83){_0xfc1a83=_0xfc1a83||0x1f4;return function(_0x583cf6){logger['error'](_0x583cf6[_0x1cc1('0x24')]);if(_0x583cf6[_0x1cc1('0x25')]){delete _0x583cf6[_0x1cc1('0x25')];}_0x225195['status'](_0xfc1a83)[_0x1cc1('0x26')](_0x583cf6);};}exports[_0x1cc1('0x27')]=function(_0x575e91,_0xdfd558){var _0x4290f6={},_0x5755f6={},_0x2c070d={'count':0x0,'rows':[]};var _0x1b49a2=_['map'](db[_0x1cc1('0x28')][_0x1cc1('0x29')],function(_0x221437){return{'name':_0x221437['fieldName'],'type':_0x221437[_0x1cc1('0x2a')][_0x1cc1('0x2b')]};});_0x5755f6[_0x1cc1('0x2c')]=_[_0x1cc1('0x2d')](_0x1b49a2,_0x1cc1('0x25'));_0x5755f6[_0x1cc1('0x2e')]=_[_0x1cc1('0x2f')](_0x575e91[_0x1cc1('0x2e')]);_0x5755f6[_0x1cc1('0x30')]=_[_0x1cc1('0x31')](_0x5755f6[_0x1cc1('0x2c')],_0x5755f6[_0x1cc1('0x2e')]);_0x4290f6['attributes']=_[_0x1cc1('0x31')](_0x5755f6['model'],qs['fields'](_0x575e91['query'][_0x1cc1('0x32')]));_0x4290f6['attributes']=_0x4290f6[_0x1cc1('0x33')][_0x1cc1('0x34')]?_0x4290f6[_0x1cc1('0x33')]:_0x5755f6['model'];if(!_0x575e91[_0x1cc1('0x2e')][_0x1cc1('0x35')]('nolimit')){_0x4290f6[_0x1cc1('0x1c')]=qs['limit'](_0x575e91[_0x1cc1('0x2e')][_0x1cc1('0x1c')]);_0x4290f6[_0x1cc1('0x1e')]=qs[_0x1cc1('0x1e')](_0x575e91[_0x1cc1('0x2e')][_0x1cc1('0x1e')]);}_0x4290f6[_0x1cc1('0x36')]=qs[_0x1cc1('0x37')](_0x575e91['query'][_0x1cc1('0x37')]);_0x4290f6[_0x1cc1('0x38')]=qs[_0x1cc1('0x30')](_[_0x1cc1('0x39')](_0x575e91['query'],_0x5755f6['filters']),_0x1b49a2);if(_0x575e91[_0x1cc1('0x2e')][_0x1cc1('0x3a')]){_0x4290f6[_0x1cc1('0x38')]=_[_0x1cc1('0x3b')](_0x4290f6[_0x1cc1('0x38')],{'$or':_[_0x1cc1('0x2d')](_0x1b49a2,function(_0x387a3b){if(_0x387a3b['type']!==_0x1cc1('0x3c')){var _0x3f9d97={};_0x3f9d97[_0x387a3b['name']]={'$like':'%'+_0x575e91[_0x1cc1('0x2e')][_0x1cc1('0x3a')]+'%'};return _0x3f9d97;}})});}_0x4290f6=_['merge']({},_0x4290f6,_0x575e91[_0x1cc1('0x3d')]);var _0x24c21c={'where':_0x4290f6[_0x1cc1('0x38')]};return db['SquareReport'][_0x1cc1('0x1d')](_0x24c21c)[_0x1cc1('0x3e')](function(_0x5da728){_0x2c070d[_0x1cc1('0x1d')]=_0x5da728;if(_0x575e91['query'][_0x1cc1('0x3f')]){_0x4290f6[_0x1cc1('0x40')]=[{'all':!![]}];}return db[_0x1cc1('0x28')][_0x1cc1('0x41')](_0x4290f6);})['then'](function(_0xe4b496){_0x2c070d[_0x1cc1('0x42')]=_0xe4b496;return _0x2c070d;})[_0x1cc1('0x3e')](respondWithFilteredResult(_0xdfd558,_0x4290f6))['catch'](handleError(_0xdfd558,null));};exports[_0x1cc1('0x43')]=function(_0x19eb8b,_0x4c9724){var _0x1cc501={'raw':!![],'where':{'id':_0x19eb8b[_0x1cc1('0x44')]['id']}},_0x5a1ed6={};_0x5a1ed6[_0x1cc1('0x2c')]=_['keys'](db[_0x1cc1('0x28')][_0x1cc1('0x29')]);_0x5a1ed6[_0x1cc1('0x2e')]=_['keys'](_0x19eb8b[_0x1cc1('0x2e')]);_0x5a1ed6[_0x1cc1('0x30')]=_['intersection'](_0x5a1ed6[_0x1cc1('0x2c')],_0x5a1ed6['query']);_0x1cc501['attributes']=_[_0x1cc1('0x31')](_0x5a1ed6[_0x1cc1('0x2c')],qs[_0x1cc1('0x32')](_0x19eb8b['query'][_0x1cc1('0x32')]));_0x1cc501[_0x1cc1('0x33')]=_0x1cc501[_0x1cc1('0x33')][_0x1cc1('0x34')]?_0x1cc501['attributes']:_0x5a1ed6[_0x1cc1('0x2c')];if(_0x19eb8b[_0x1cc1('0x2e')][_0x1cc1('0x3f')]){_0x1cc501[_0x1cc1('0x40')]=[{'all':!![]}];}_0x1cc501=_[_0x1cc1('0x3b')]({},_0x1cc501,_0x19eb8b['options']);return db['SquareReport']['find'](_0x1cc501)[_0x1cc1('0x3e')](handleEntityNotFound(_0x4c9724,null))[_0x1cc1('0x3e')](respondWithResult(_0x4c9724,null))[_0x1cc1('0x45')](handleError(_0x4c9724,null));};exports[_0x1cc1('0x46')]=function(_0x55eed2,_0x278062){return db[_0x1cc1('0x28')][_0x1cc1('0x46')](_0x55eed2[_0x1cc1('0x47')],{})['then'](respondWithResult(_0x278062,0xc9))['catch'](handleError(_0x278062,null));};exports[_0x1cc1('0x23')]=function(_0x58abba,_0x20237e){if(_0x58abba[_0x1cc1('0x47')]['id']){delete _0x58abba[_0x1cc1('0x47')]['id'];}return db[_0x1cc1('0x28')]['find']({'where':{'id':_0x58abba['params']['id']}})[_0x1cc1('0x3e')](handleEntityNotFound(_0x20237e,null))['then'](saveUpdates(_0x58abba[_0x1cc1('0x47')],null))[_0x1cc1('0x3e')](respondWithResult(_0x20237e,null))[_0x1cc1('0x45')](handleError(_0x20237e,null));};exports[_0x1cc1('0x48')]=function(_0x2bcbbc,_0x5e28a1){return db[_0x1cc1('0x28')][_0x1cc1('0x49')]({'where':{'id':_0x2bcbbc['params']['id']}})[_0x1cc1('0x3e')](handleEntityNotFound(_0x5e28a1,null))['then'](removeEntity(_0x5e28a1,null))['catch'](handleError(_0x5e28a1,null));};exports[_0x1cc1('0x4a')]=function(_0xfb8d95,_0x8e3f52){return db[_0x1cc1('0x28')][_0x1cc1('0x4a')]()[_0x1cc1('0x3e')](respondWithResult(_0x8e3f52,null))['catch'](handleError(_0x8e3f52,null));}; \ No newline at end of file +var _0xad85=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x46830e,_0x2573bd){var _0x22f88a=function(_0x216f38){while(--_0x216f38){_0x46830e['push'](_0x46830e['shift']());}};_0x22f88a(++_0x2573bd);}(_0xad85,0x87));var _0x5ad8=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0xad85[_0x2e9b5b];return _0x734c46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ad8('0x0'));var zipdir=require(_0x5ad8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ad8('0x2'));var moment=require('moment');var BPromise=require(_0x5ad8('0x3'));var Mustache=require(_0x5ad8('0x4'));var util=require(_0x5ad8('0x5'));var path=require(_0x5ad8('0x6'));var sox=require(_0x5ad8('0x7'));var csv=require(_0x5ad8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ad8('0x9'));var _=require(_0x5ad8('0xa'));var squel=require(_0x5ad8('0xb'));var crypto=require(_0x5ad8('0xc'));var jsforce=require(_0x5ad8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5ad8('0x8'));var querystring=require('querystring');var Papa=require(_0x5ad8('0xe'));var Redis=require(_0x5ad8('0xf'));var authService=require(_0x5ad8('0x10'));var qs=require(_0x5ad8('0x11'));var as=require(_0x5ad8('0x12'));var hardwareService=require(_0x5ad8('0x13'));var logger=require(_0x5ad8('0x14'))(_0x5ad8('0x15'));var utils=require(_0x5ad8('0x16'));var config=require(_0x5ad8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ad8('0x18'))['db'];function respondWithStatusCode(_0x5e3bd9,_0x2fdd9d){_0x2fdd9d=_0x2fdd9d||0xcc;return function(_0x1ac913){if(_0x1ac913){return _0x5e3bd9[_0x5ad8('0x19')](_0x2fdd9d);}return _0x5e3bd9[_0x5ad8('0x1a')](_0x2fdd9d)['end']();};}function respondWithResult(_0x20e1fe,_0x1a1294){_0x1a1294=_0x1a1294||0xc8;return function(_0x33355e){if(_0x33355e){return _0x20e1fe[_0x5ad8('0x1a')](_0x1a1294)[_0x5ad8('0x1b')](_0x33355e);}};}function respondWithFilteredResult(_0x3f8173,_0x2b785d){return function(_0x3941bc){if(_0x3941bc){var _0x2f21b7=typeof _0x2b785d[_0x5ad8('0x1c')]==='undefined'&&typeof _0x2b785d[_0x5ad8('0x1d')]===_0x5ad8('0x1e');var _0x38db8a=_0x3941bc[_0x5ad8('0x1f')];var _0x2361c3=_0x2f21b7?0x0:_0x2b785d[_0x5ad8('0x1c')];var _0x3c1587=_0x2f21b7?_0x3941bc[_0x5ad8('0x1f')]:_0x2b785d[_0x5ad8('0x1c')]+_0x2b785d[_0x5ad8('0x1d')];var _0x348d54;if(_0x3c1587>=_0x38db8a){_0x3c1587=_0x38db8a;_0x348d54=0xc8;}else{_0x348d54=0xce;}_0x3f8173[_0x5ad8('0x1a')](_0x348d54);return _0x3f8173[_0x5ad8('0x20')](_0x5ad8('0x21'),_0x2361c3+'-'+_0x3c1587+'/'+_0x38db8a)[_0x5ad8('0x1b')](_0x3941bc);}return null;};}function patchUpdates(_0x4376fb){return function(_0x4ef908){try{jsonpatch['apply'](_0x4ef908,_0x4376fb,!![]);}catch(_0x2dd432){return BPromise[_0x5ad8('0x22')](_0x2dd432);}return _0x4ef908[_0x5ad8('0x23')]();};}function saveUpdates(_0x2f410f,_0x1905fb){return function(_0x5d3892){if(_0x5d3892){return _0x5d3892[_0x5ad8('0x24')](_0x2f410f)[_0x5ad8('0x25')](function(_0x444d0d){return _0x444d0d;});}return null;};}function removeEntity(_0x209511,_0x3d2741){return function(_0x57448b){if(_0x57448b){return _0x57448b['destroy']()[_0x5ad8('0x25')](function(){_0x209511['status'](0xcc)[_0x5ad8('0x26')]();});}};}function handleEntityNotFound(_0x364dca,_0x47e7ef){return function(_0x516042){if(!_0x516042){_0x364dca[_0x5ad8('0x19')](0x194);}return _0x516042;};}function handleError(_0x134e36,_0xd941c){_0xd941c=_0xd941c||0x1f4;return function(_0x370f2b){logger[_0x5ad8('0x27')](_0x370f2b[_0x5ad8('0x28')]);if(_0x370f2b[_0x5ad8('0x29')]){delete _0x370f2b['name'];}_0x134e36[_0x5ad8('0x1a')](_0xd941c)[_0x5ad8('0x2a')](_0x370f2b);};}exports[_0x5ad8('0x2b')]=function(_0x4a4cdd,_0x4c09e4){var _0x5917ea={},_0x512918={},_0x2c03ae={'count':0x0,'rows':[]};var _0x1aed50=_[_0x5ad8('0x2c')](db[_0x5ad8('0x2d')][_0x5ad8('0x2e')],function(_0x1e0eb0){return{'name':_0x1e0eb0[_0x5ad8('0x2f')],'type':_0x1e0eb0[_0x5ad8('0x30')]['key']};});_0x512918[_0x5ad8('0x31')]=_[_0x5ad8('0x2c')](_0x1aed50,_0x5ad8('0x29'));_0x512918[_0x5ad8('0x32')]=_[_0x5ad8('0x33')](_0x4a4cdd[_0x5ad8('0x32')]);_0x512918[_0x5ad8('0x34')]=_[_0x5ad8('0x35')](_0x512918[_0x5ad8('0x31')],_0x512918[_0x5ad8('0x32')]);_0x5917ea[_0x5ad8('0x36')]=_['intersection'](_0x512918[_0x5ad8('0x31')],qs[_0x5ad8('0x37')](_0x4a4cdd[_0x5ad8('0x32')][_0x5ad8('0x37')]));_0x5917ea[_0x5ad8('0x36')]=_0x5917ea[_0x5ad8('0x36')]['length']?_0x5917ea[_0x5ad8('0x36')]:_0x512918['model'];if(!_0x4a4cdd[_0x5ad8('0x32')]['hasOwnProperty'](_0x5ad8('0x38'))){_0x5917ea['limit']=qs[_0x5ad8('0x1d')](_0x4a4cdd[_0x5ad8('0x32')]['limit']);_0x5917ea[_0x5ad8('0x1c')]=qs['offset'](_0x4a4cdd[_0x5ad8('0x32')]['offset']);}_0x5917ea[_0x5ad8('0x39')]=qs['sort'](_0x4a4cdd[_0x5ad8('0x32')][_0x5ad8('0x3a')]);_0x5917ea['where']=qs[_0x5ad8('0x34')](_[_0x5ad8('0x3b')](_0x4a4cdd[_0x5ad8('0x32')],_0x512918[_0x5ad8('0x34')]),_0x1aed50);if(_0x4a4cdd[_0x5ad8('0x32')][_0x5ad8('0x3c')]){_0x5917ea[_0x5ad8('0x3d')]=_[_0x5ad8('0x3e')](_0x5917ea[_0x5ad8('0x3d')],{'$or':_['map'](_0x1aed50,function(_0x5115f4){if(_0x5115f4[_0x5ad8('0x30')]!==_0x5ad8('0x3f')){var _0x2eae61={};_0x2eae61[_0x5115f4[_0x5ad8('0x29')]]={'$like':'%'+_0x4a4cdd[_0x5ad8('0x32')][_0x5ad8('0x3c')]+'%'};return _0x2eae61;}})});}_0x5917ea=_[_0x5ad8('0x3e')]({},_0x5917ea,_0x4a4cdd[_0x5ad8('0x40')]);var _0x13564b={'where':_0x5917ea['where']};return db[_0x5ad8('0x2d')][_0x5ad8('0x1f')](_0x13564b)['then'](function(_0x44bd2a){_0x2c03ae['count']=_0x44bd2a;if(_0x4a4cdd[_0x5ad8('0x32')][_0x5ad8('0x41')]){_0x5917ea[_0x5ad8('0x42')]=[{'all':!![]}];}return db[_0x5ad8('0x2d')][_0x5ad8('0x43')](_0x5917ea);})[_0x5ad8('0x25')](function(_0x4250c8){_0x2c03ae['rows']=_0x4250c8;return _0x2c03ae;})['then'](respondWithFilteredResult(_0x4c09e4,_0x5917ea))[_0x5ad8('0x44')](handleError(_0x4c09e4,null));};exports[_0x5ad8('0x45')]=function(_0x1abe3e,_0x56a2bd){var _0x370d22={'raw':!![],'where':{'id':_0x1abe3e[_0x5ad8('0x46')]['id']}},_0x3d1d4d={};_0x3d1d4d[_0x5ad8('0x31')]=_[_0x5ad8('0x33')](db['SquareReport'][_0x5ad8('0x2e')]);_0x3d1d4d['query']=_[_0x5ad8('0x33')](_0x1abe3e[_0x5ad8('0x32')]);_0x3d1d4d[_0x5ad8('0x34')]=_[_0x5ad8('0x35')](_0x3d1d4d[_0x5ad8('0x31')],_0x3d1d4d['query']);_0x370d22[_0x5ad8('0x36')]=_[_0x5ad8('0x35')](_0x3d1d4d[_0x5ad8('0x31')],qs[_0x5ad8('0x37')](_0x1abe3e[_0x5ad8('0x32')][_0x5ad8('0x37')]));_0x370d22[_0x5ad8('0x36')]=_0x370d22[_0x5ad8('0x36')]['length']?_0x370d22[_0x5ad8('0x36')]:_0x3d1d4d[_0x5ad8('0x31')];if(_0x1abe3e['query'][_0x5ad8('0x41')]){_0x370d22[_0x5ad8('0x42')]=[{'all':!![]}];}_0x370d22=_[_0x5ad8('0x3e')]({},_0x370d22,_0x1abe3e[_0x5ad8('0x40')]);return db['SquareReport']['find'](_0x370d22)[_0x5ad8('0x25')](handleEntityNotFound(_0x56a2bd,null))[_0x5ad8('0x25')](respondWithResult(_0x56a2bd,null))[_0x5ad8('0x44')](handleError(_0x56a2bd,null));};exports[_0x5ad8('0x47')]=function(_0x5b503d,_0x405671){return db[_0x5ad8('0x2d')][_0x5ad8('0x47')](_0x5b503d[_0x5ad8('0x48')],{})['then'](respondWithResult(_0x405671,0xc9))['catch'](handleError(_0x405671,null));};exports[_0x5ad8('0x24')]=function(_0x2800fb,_0x1769cb){if(_0x2800fb['body']['id']){delete _0x2800fb[_0x5ad8('0x48')]['id'];}return db[_0x5ad8('0x2d')][_0x5ad8('0x49')]({'where':{'id':_0x2800fb[_0x5ad8('0x46')]['id']}})[_0x5ad8('0x25')](handleEntityNotFound(_0x1769cb,null))[_0x5ad8('0x25')](saveUpdates(_0x2800fb[_0x5ad8('0x48')],null))['then'](respondWithResult(_0x1769cb,null))[_0x5ad8('0x44')](handleError(_0x1769cb,null));};exports[_0x5ad8('0x4a')]=function(_0x923539,_0x518dcd){return db[_0x5ad8('0x2d')][_0x5ad8('0x49')]({'where':{'id':_0x923539[_0x5ad8('0x46')]['id']}})['then'](handleEntityNotFound(_0x518dcd,null))[_0x5ad8('0x25')](removeEntity(_0x518dcd,null))[_0x5ad8('0x44')](handleError(_0x518dcd,null));};exports[_0x5ad8('0x4b')]=function(_0x3e96a9,_0xf9fa2){return db[_0x5ad8('0x2d')][_0x5ad8('0x4b')]()[_0x5ad8('0x25')](respondWithResult(_0xf9fa2,null))[_0x5ad8('0x44')](handleError(_0xf9fa2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 552997b..1363596 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 _0x19bc=['define','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./squareReport.attributes','exports'];(function(_0x3baf6d,_0x3babf2){var _0xc674cf=function(_0xa8b22f){while(--_0xa8b22f){_0x3baf6d['push'](_0x3baf6d['shift']());}};_0xc674cf(++_0x3babf2);}(_0x19bc,0x7a));var _0xc19b=function(_0x25ded3,_0x41033c){_0x25ded3=_0x25ded3-0x0;var _0xa0eca5=_0x19bc[_0x25ded3];return _0xa0eca5;};'use strict';var _=require(_0xc19b('0x0'));var util=require(_0xc19b('0x1'));var logger=require(_0xc19b('0x2'))('api');var moment=require(_0xc19b('0x3'));var BPromise=require(_0xc19b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc19b('0x5'));var attributes=require(_0xc19b('0x6'));module[_0xc19b('0x7')]=function(_0x5c2885,_0x25d672){return _0x5c2885[_0xc19b('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xc19b('0x9'),'fields':[_0xc19b('0xa'),_0xc19b('0xb')]},{'name':_0xc19b('0xc'),'fields':[_0xc19b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c99=['path','report_square','uid_pname','uniqueid','util','api','moment','bluebird','request-promise'];(function(_0x2cb633,_0x5caee0){var _0x4b1a20=function(_0x4ea50f){while(--_0x4ea50f){_0x2cb633['push'](_0x2cb633['shift']());}};_0x4b1a20(++_0x5caee0);}(_0x9c99,0x199));var _0x99c9=function(_0x2d061c,_0x48e86c){_0x2d061c=_0x2d061c-0x0;var _0x2f1dfd=_0x9c99[_0x2d061c];return _0x2f1dfd;};'use strict';var _=require('lodash');var util=require(_0x99c9('0x0'));var logger=require('../../config/logger')(_0x99c9('0x1'));var moment=require(_0x99c9('0x2'));var BPromise=require(_0x99c9('0x3'));var rp=require(_0x99c9('0x4'));var fs=require('fs');var path=require(_0x99c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x11892d,_0x1969b8){return _0x11892d['define']('SquareReport',attributes,{'tableName':_0x99c9('0x6'),'paranoid':![],'indexes':[{'name':_0x99c9('0x7'),'fields':[_0x99c9('0x8'),'project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c94d179..f5e9ced 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 _0xa4fd=['limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','debug','UpdateSquareReport','update','raw'];(function(_0x5f5da1,_0x273423){var _0x105bbc=function(_0x3f9e55){while(--_0x3f9e55){_0x5f5da1['push'](_0x5f5da1['shift']());}};_0x105bbc(++_0x273423);}(_0xa4fd,0x92));var _0xda4f=function(_0x225f0a,_0x49b492){_0x225f0a=_0x225f0a-0x0;var _0x3524d3=_0xa4fd[_0x225f0a];return _0x3524d3;};'use strict';var _=require(_0xda4f('0x0'));var util=require(_0xda4f('0x1'));var moment=require(_0xda4f('0x2'));var BPromise=require(_0xda4f('0x3'));var rs=require(_0xda4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda4f('0x5'))['db'];var utils=require(_0xda4f('0x6'));var logger=require('../../config/logger')(_0xda4f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda4f('0x8')][_0xda4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f68a0,_0x592374,_0x147c54){return new BPromise(function(_0x402e18,_0x5eb95a){return client['request'](_0x1f68a0,_0x147c54)[_0xda4f('0xa')](function(_0x503ab7){logger[_0xda4f('0xb')](_0xda4f('0xc'),_0x592374,_0xda4f('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x592374,_0xda4f('0xd'),JSON[_0xda4f('0xe')](_0x503ab7));if(_0x503ab7[_0xda4f('0xf')]){if(_0x503ab7[_0xda4f('0xf')][_0xda4f('0x10')]===0x1f4){logger[_0xda4f('0xf')](_0xda4f('0xc'),_0x592374,_0x503ab7[_0xda4f('0xf')][_0xda4f('0x11')]);return _0x5eb95a(_0x503ab7[_0xda4f('0xf')][_0xda4f('0x11')]);}logger[_0xda4f('0xf')](_0xda4f('0xc'),_0x592374,_0x503ab7[_0xda4f('0xf')]['message']);return _0x402e18(_0x503ab7[_0xda4f('0xf')][_0xda4f('0x11')]);}else{logger[_0xda4f('0xb')](_0xda4f('0xc'),_0x592374,_0xda4f('0xd'));_0x402e18(_0x503ab7[_0xda4f('0x12')]['message']);}})[_0xda4f('0x13')](function(_0x2e6985){logger[_0xda4f('0xf')](_0xda4f('0xc'),_0x592374,_0x2e6985);_0x5eb95a(_0x2e6985);});});}exports[_0xda4f('0x14')]=function(_0x59c319){var _0x2c44a4=this;return new Promise(function(_0x289f37,_0x5211cf){return db[_0xda4f('0x15')]['create'](_0x59c319[_0xda4f('0x16')],{'raw':_0x59c319[_0xda4f('0x17')]?_0x59c319[_0xda4f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xda4f('0xa')](function(_0x4fe34a){logger[_0xda4f('0xb')](_0xda4f('0x14'),_0x59c319);logger[_0xda4f('0x18')](_0xda4f('0x14'),_0x59c319,JSON[_0xda4f('0xe')](_0x4fe34a));_0x289f37(_0x4fe34a);})[_0xda4f('0x13')](function(_0x5d9de1){logger['error']('CreateSquareReport',_0x5d9de1[_0xda4f('0x11')],_0x59c319);_0x5211cf(_0x2c44a4['error'](0x1f4,_0x5d9de1[_0xda4f('0x11')]));});});};exports[_0xda4f('0x19')]=function(_0x272d93){var _0x3599e9=this;return new Promise(function(_0x4341fa,_0x148b8c){return db[_0xda4f('0x15')][_0xda4f('0x1a')](_0x272d93['body'],{'raw':_0x272d93[_0xda4f('0x17')]?_0x272d93[_0xda4f('0x17')][_0xda4f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272d93[_0xda4f('0x17')]?_0x272d93['options']['where']||null:null,'attributes':_0x272d93[_0xda4f('0x17')]?_0x272d93[_0xda4f('0x17')]['attributes']||null:null,'limit':_0x272d93['options']?_0x272d93[_0xda4f('0x17')][_0xda4f('0x1c')]||null:null})[_0xda4f('0xa')](function(_0x44e55a){logger[_0xda4f('0xb')]('UpdateSquareReport',_0x272d93);logger[_0xda4f('0x18')](_0xda4f('0x19'),_0x272d93,JSON[_0xda4f('0xe')](_0x44e55a));_0x4341fa(_0x44e55a);})[_0xda4f('0x13')](function(_0x4a3563){logger['error'](_0xda4f('0x19'),_0x4a3563[_0xda4f('0x11')],_0x272d93);_0x148b8c(_0x3599e9[_0xda4f('0xf')](0x1f4,_0x4a3563[_0xda4f('0x11')]));});});}; \ No newline at end of file +var _0x0787=['update','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSquareReport','SquareReport','create','options','stringify','UpdateSquareReport'];(function(_0xb5ac36,_0x345b02){var _0x3f32e9=function(_0x48edfd){while(--_0x48edfd){_0xb5ac36['push'](_0xb5ac36['shift']());}};_0x3f32e9(++_0x345b02);}(_0x0787,0x198));var _0x7078=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x0787[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x7078('0x0'));var util=require('util');var moment=require(_0x7078('0x1'));var BPromise=require('bluebird');var rs=require(_0x7078('0x2'));var fs=require('fs');var Redis=require(_0x7078('0x3'));var db=require(_0x7078('0x4'))['db'];var utils=require(_0x7078('0x5'));var logger=require(_0x7078('0x6'))('rpc');var config=require(_0x7078('0x7'));var jayson=require(_0x7078('0x8'));var client=jayson['client'][_0x7078('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x254e4b,_0x3f6786,_0x16025f){return new BPromise(function(_0x4554a7,_0x25e344){return client[_0x7078('0xa')](_0x254e4b,_0x16025f)[_0x7078('0xb')](function(_0x59495b){logger[_0x7078('0xc')](_0x7078('0xd'),_0x3f6786,_0x7078('0xe'));logger[_0x7078('0xf')](_0x7078('0x10'),_0x3f6786,_0x7078('0xe'),JSON['stringify'](_0x59495b));if(_0x59495b[_0x7078('0x11')]){if(_0x59495b[_0x7078('0x11')]['code']===0x1f4){logger[_0x7078('0x11')](_0x7078('0xd'),_0x3f6786,_0x59495b[_0x7078('0x11')][_0x7078('0x12')]);return _0x25e344(_0x59495b[_0x7078('0x11')][_0x7078('0x12')]);}logger[_0x7078('0x11')](_0x7078('0xd'),_0x3f6786,_0x59495b['error'][_0x7078('0x12')]);return _0x4554a7(_0x59495b['error'][_0x7078('0x12')]);}else{logger['info'](_0x7078('0xd'),_0x3f6786,_0x7078('0xe'));_0x4554a7(_0x59495b['result']['message']);}})[_0x7078('0x13')](function(_0x250e93){logger[_0x7078('0x11')](_0x7078('0xd'),_0x3f6786,_0x250e93);_0x25e344(_0x250e93);});});}exports[_0x7078('0x14')]=function(_0x2f0a42){var _0x42e066=this;return new Promise(function(_0x58d7a1,_0xa477ab){return db[_0x7078('0x15')][_0x7078('0x16')](_0x2f0a42['body'],{'raw':_0x2f0a42[_0x7078('0x17')]?_0x2f0a42[_0x7078('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7078('0xb')](function(_0x5edaea){logger[_0x7078('0xc')]('CreateSquareReport',_0x2f0a42);logger[_0x7078('0xf')]('CreateSquareReport',_0x2f0a42,JSON[_0x7078('0x18')](_0x5edaea));_0x58d7a1(_0x5edaea);})['catch'](function(_0x4f7730){logger['error'](_0x7078('0x14'),_0x4f7730['message'],_0x2f0a42);_0xa477ab(_0x42e066[_0x7078('0x11')](0x1f4,_0x4f7730[_0x7078('0x12')]));});});};exports[_0x7078('0x19')]=function(_0x4bb71e){var _0x587874=this;return new Promise(function(_0x330857,_0x425ba6){return db['SquareReport'][_0x7078('0x1a')](_0x4bb71e['body'],{'raw':_0x4bb71e[_0x7078('0x17')]?_0x4bb71e['options'][_0x7078('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb71e[_0x7078('0x17')]?_0x4bb71e[_0x7078('0x17')][_0x7078('0x1c')]||null:null,'attributes':_0x4bb71e[_0x7078('0x17')]?_0x4bb71e[_0x7078('0x17')][_0x7078('0x1d')]||null:null,'limit':_0x4bb71e[_0x7078('0x17')]?_0x4bb71e['options'][_0x7078('0x1e')]||null:null})[_0x7078('0xb')](function(_0x3a6c22){logger[_0x7078('0xc')](_0x7078('0x19'),_0x4bb71e);logger[_0x7078('0xf')](_0x7078('0x19'),_0x4bb71e,JSON[_0x7078('0x18')](_0x3a6c22));_0x330857(_0x3a6c22);})[_0x7078('0x13')](function(_0x4d7c7e){logger[_0x7078('0x11')](_0x7078('0x19'),_0x4d7c7e[_0x7078('0x12')],_0x4bb71e);_0x425ba6(_0x587874[_0x7078('0x11')](0x1f4,_0x4d7c7e[_0x7078('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5b76806..bae98db 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 _0x9603=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x550985,_0x15619e){var _0x1a9ad9=function(_0x2234cd){while(--_0x2234cd){_0x550985['push'](_0x550985['shift']());}};_0x1a9ad9(++_0x15619e);}(_0x9603,0x175));var _0x3960=function(_0x57bfce,_0x3fa169){_0x57bfce=_0x57bfce-0x0;var _0x3da9a7=_0x9603[_0x57bfce];return _0x3da9a7;};'use strict';var multer=require(_0x3960('0x0'));var util=require(_0x3960('0x1'));var path=require(_0x3960('0x2'));var timeout=require(_0x3960('0x3'));var express=require(_0x3960('0x4'));var router=express[_0x3960('0x5')]();var fs_extra=require(_0x3960('0x6'));var auth=require(_0x3960('0x7'));var interaction=require(_0x3960('0x8'));var config=require('../../config/environment');var controller=require(_0x3960('0x9'));router[_0x3960('0xa')]('/',auth[_0x3960('0xb')](),controller[_0x3960('0xc')]);router[_0x3960('0xa')](_0x3960('0xd'),auth[_0x3960('0xb')](),controller[_0x3960('0xe')]);router[_0x3960('0xa')](_0x3960('0xf'),auth[_0x3960('0xb')](),controller[_0x3960('0x10')]);router[_0x3960('0x11')]('/',auth[_0x3960('0xb')](),controller[_0x3960('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3960('0x13')]);router[_0x3960('0x14')](_0x3960('0xf'),auth[_0x3960('0xb')](),controller[_0x3960('0x15')]);module[_0x3960('0x16')]=router; \ No newline at end of file +var _0xcab7=['index','/describe','describe','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xcab7,0x119));var _0x7cab=function(_0x5d4876,_0x11e6b0){_0x5d4876=_0x5d4876-0x0;var _0x6927ac=_0xcab7[_0x5d4876];return _0x6927ac;};'use strict';var multer=require(_0x7cab('0x0'));var util=require(_0x7cab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7cab('0x2'));var router=express[_0x7cab('0x3')]();var fs_extra=require(_0x7cab('0x4'));var auth=require(_0x7cab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7cab('0x6'));var controller=require('./squareReportDetail.controller');router[_0x7cab('0x7')]('/',auth['isAuthenticated'](),controller[_0x7cab('0x8')]);router[_0x7cab('0x7')](_0x7cab('0x9'),auth['isAuthenticated'](),controller[_0x7cab('0xa')]);router[_0x7cab('0x7')](_0x7cab('0xb'),auth[_0x7cab('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7cab('0xb'),auth[_0x7cab('0xc')](),controller[_0x7cab('0xd')]);router[_0x7cab('0xe')](_0x7cab('0xb'),auth[_0x7cab('0xc')](),controller[_0x7cab('0xf')]);module[_0x7cab('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 0bc68cf..84ef46a 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 _0xe609=['exports','STRING','TEXT'];(function(_0x5a0630,_0x16044d){var _0x553546=function(_0x361ad4){while(--_0x361ad4){_0x5a0630['push'](_0x5a0630['shift']());}};_0x553546(++_0x16044d);}(_0xe609,0xe1));var _0x9e60=function(_0xd2c423,_0x572acf){_0xd2c423=_0xd2c423-0x0;var _0xed48ff=_0xe609[_0xd2c423];return _0xed48ff;};'use strict';var Sequelize=require('sequelize');module[_0x9e60('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9e60('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x9e60('0x2')]},'project_name':{'type':Sequelize[_0x9e60('0x1')]},'callerid':{'type':Sequelize[_0x9e60('0x1')]}}; \ No newline at end of file +var _0xe0e5=['STRING','TEXT','sequelize'];(function(_0x1bce08,_0x21b6de){var _0x4fa7d4=function(_0x2a7245){while(--_0x2a7245){_0x1bce08['push'](_0x1bce08['shift']());}};_0x4fa7d4(++_0x21b6de);}(_0xe0e5,0x8f));var _0x5e0e=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0xe0e5[_0x34b5ca];return _0x2d72c0;};'use strict';var Sequelize=require(_0x5e0e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x5e0e('0x1')]},'data':{'type':Sequelize[_0x5e0e('0x2')]},'project_name':{'type':Sequelize[_0x5e0e('0x1')]},'callerid':{'type':Sequelize[_0x5e0e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e7380bd..3bbed66 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 _0xe760=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0xe760,0x17e));var _0x0e76=function(_0x16a3b9,_0xc9fbaa){_0x16a3b9=_0x16a3b9-0x0;var _0x3ec686=_0xe760[_0x16a3b9];return _0x3ec686;};'use strict';var emlformat=require(_0x0e76('0x0'));var rimraf=require(_0x0e76('0x1'));var zipdir=require(_0x0e76('0x2'));var jsonpatch=require(_0x0e76('0x3'));var rp=require(_0x0e76('0x4'));var moment=require(_0x0e76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0e76('0x6'));var util=require(_0x0e76('0x7'));var path=require('path');var sox=require(_0x0e76('0x8'));var csv=require(_0x0e76('0x9'));var ejs=require(_0x0e76('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e76('0xb'));var squel=require(_0x0e76('0xc'));var crypto=require(_0x0e76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0e76('0xe'));var toCsv=require(_0x0e76('0x9'));var querystring=require('querystring');var Papa=require(_0x0e76('0xf'));var Redis=require(_0x0e76('0x10'));var authService=require(_0x0e76('0x11'));var qs=require(_0x0e76('0x12'));var as=require(_0x0e76('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e76('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e76('0x15'));var db=require(_0x0e76('0x16'))['db'];function respondWithStatusCode(_0x3106ff,_0x12ccff){_0x12ccff=_0x12ccff||0xcc;return function(_0x5bc342){if(_0x5bc342){return _0x3106ff['sendStatus'](_0x12ccff);}return _0x3106ff[_0x0e76('0x17')](_0x12ccff)[_0x0e76('0x18')]();};}function respondWithResult(_0x3c7256,_0x47f7cc){_0x47f7cc=_0x47f7cc||0xc8;return function(_0x24bc13){if(_0x24bc13){return _0x3c7256[_0x0e76('0x17')](_0x47f7cc)[_0x0e76('0x19')](_0x24bc13);}};}function respondWithFilteredResult(_0x11ce46,_0x857c25){return function(_0x307280){if(_0x307280){var _0x319f76=typeof _0x857c25[_0x0e76('0x1a')]===_0x0e76('0x1b')&&typeof _0x857c25[_0x0e76('0x1c')]===_0x0e76('0x1b');var _0x1c3400=_0x307280['count'];var _0x270fc4=_0x319f76?0x0:_0x857c25[_0x0e76('0x1a')];var _0x5d01bf=_0x319f76?_0x307280[_0x0e76('0x1d')]:_0x857c25[_0x0e76('0x1a')]+_0x857c25['limit'];var _0x59e4a1;if(_0x5d01bf>=_0x1c3400){_0x5d01bf=_0x1c3400;_0x59e4a1=0xc8;}else{_0x59e4a1=0xce;}_0x11ce46[_0x0e76('0x17')](_0x59e4a1);return _0x11ce46[_0x0e76('0x1e')](_0x0e76('0x1f'),_0x270fc4+'-'+_0x5d01bf+'/'+_0x1c3400)['json'](_0x307280);}return null;};}function patchUpdates(_0x13b127){return function(_0xdc79b2){try{jsonpatch['apply'](_0xdc79b2,_0x13b127,!![]);}catch(_0x457788){return BPromise['reject'](_0x457788);}return _0xdc79b2['save']();};}function saveUpdates(_0x9205f4,_0x8f1501){return function(_0xde3f){if(_0xde3f){return _0xde3f[_0x0e76('0x20')](_0x9205f4)['then'](function(_0x38849b){return _0x38849b;});}return null;};}function removeEntity(_0x52551b,_0x2907da){return function(_0x1f6a79){if(_0x1f6a79){return _0x1f6a79[_0x0e76('0x21')]()[_0x0e76('0x22')](function(){_0x52551b[_0x0e76('0x17')](0xcc)[_0x0e76('0x18')]();});}};}function handleEntityNotFound(_0x5e66b8,_0x2582dc){return function(_0x44ba8c){if(!_0x44ba8c){_0x5e66b8[_0x0e76('0x23')](0x194);}return _0x44ba8c;};}function handleError(_0x49acf0,_0x5a22d4){_0x5a22d4=_0x5a22d4||0x1f4;return function(_0x15deab){logger[_0x0e76('0x24')](_0x15deab[_0x0e76('0x25')]);if(_0x15deab[_0x0e76('0x26')]){delete _0x15deab[_0x0e76('0x26')];}_0x49acf0[_0x0e76('0x17')](_0x5a22d4)[_0x0e76('0x27')](_0x15deab);};}exports[_0x0e76('0x28')]=function(_0x3c3fa7,_0xdc3f80){var _0x521fce={},_0xa751e8={},_0x2f5ac2={'count':0x0,'rows':[]};var _0x73ee24=_[_0x0e76('0x29')](db[_0x0e76('0x2a')][_0x0e76('0x2b')],function(_0x178235){return{'name':_0x178235[_0x0e76('0x2c')],'type':_0x178235[_0x0e76('0x2d')][_0x0e76('0x2e')]};});_0xa751e8[_0x0e76('0x2f')]=_[_0x0e76('0x29')](_0x73ee24,_0x0e76('0x26'));_0xa751e8[_0x0e76('0x30')]=_['keys'](_0x3c3fa7[_0x0e76('0x30')]);_0xa751e8[_0x0e76('0x31')]=_[_0x0e76('0x32')](_0xa751e8['model'],_0xa751e8[_0x0e76('0x30')]);_0x521fce[_0x0e76('0x33')]=_['intersection'](_0xa751e8[_0x0e76('0x2f')],qs['fields'](_0x3c3fa7['query'][_0x0e76('0x34')]));_0x521fce[_0x0e76('0x33')]=_0x521fce[_0x0e76('0x33')][_0x0e76('0x35')]?_0x521fce[_0x0e76('0x33')]:_0xa751e8[_0x0e76('0x2f')];if(!_0x3c3fa7[_0x0e76('0x30')][_0x0e76('0x36')](_0x0e76('0x37'))){_0x521fce[_0x0e76('0x1c')]=qs[_0x0e76('0x1c')](_0x3c3fa7[_0x0e76('0x30')][_0x0e76('0x1c')]);_0x521fce[_0x0e76('0x1a')]=qs[_0x0e76('0x1a')](_0x3c3fa7['query'][_0x0e76('0x1a')]);}_0x521fce['order']=qs[_0x0e76('0x38')](_0x3c3fa7[_0x0e76('0x30')]['sort']);_0x521fce[_0x0e76('0x39')]=qs[_0x0e76('0x31')](_[_0x0e76('0x3a')](_0x3c3fa7[_0x0e76('0x30')],_0xa751e8['filters']),_0x73ee24);if(_0x3c3fa7[_0x0e76('0x30')]['filter']){_0x521fce[_0x0e76('0x39')]=_[_0x0e76('0x3b')](_0x521fce[_0x0e76('0x39')],{'$or':_[_0x0e76('0x29')](_0x73ee24,function(_0x57f628){if(_0x57f628[_0x0e76('0x2d')]!=='VIRTUAL'){var _0x1740c5={};_0x1740c5[_0x57f628[_0x0e76('0x26')]]={'$like':'%'+_0x3c3fa7[_0x0e76('0x30')][_0x0e76('0x3c')]+'%'};return _0x1740c5;}})});}_0x521fce=_[_0x0e76('0x3b')]({},_0x521fce,_0x3c3fa7[_0x0e76('0x3d')]);var _0x44760a={'where':_0x521fce[_0x0e76('0x39')]};return db[_0x0e76('0x2a')][_0x0e76('0x1d')](_0x44760a)[_0x0e76('0x22')](function(_0x222a56){_0x2f5ac2[_0x0e76('0x1d')]=_0x222a56;if(_0x3c3fa7[_0x0e76('0x30')]['includeAll']){_0x521fce[_0x0e76('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x521fce);})['then'](function(_0x566710){_0x2f5ac2[_0x0e76('0x3f')]=_0x566710;return _0x2f5ac2;})['then'](respondWithFilteredResult(_0xdc3f80,_0x521fce))['catch'](handleError(_0xdc3f80,null));};exports['show']=function(_0x29f0af,_0x45ce01){var _0x562868={'raw':!![],'where':{'id':_0x29f0af[_0x0e76('0x40')]['id']}},_0x59b59e={};_0x59b59e[_0x0e76('0x2f')]=_[_0x0e76('0x41')](db[_0x0e76('0x2a')][_0x0e76('0x2b')]);_0x59b59e[_0x0e76('0x30')]=_[_0x0e76('0x41')](_0x29f0af['query']);_0x59b59e['filters']=_[_0x0e76('0x32')](_0x59b59e[_0x0e76('0x2f')],_0x59b59e[_0x0e76('0x30')]);_0x562868[_0x0e76('0x33')]=_['intersection'](_0x59b59e[_0x0e76('0x2f')],qs[_0x0e76('0x34')](_0x29f0af[_0x0e76('0x30')][_0x0e76('0x34')]));_0x562868[_0x0e76('0x33')]=_0x562868[_0x0e76('0x33')]['length']?_0x562868[_0x0e76('0x33')]:_0x59b59e[_0x0e76('0x2f')];if(_0x29f0af[_0x0e76('0x30')]['includeAll']){_0x562868[_0x0e76('0x3e')]=[{'all':!![]}];}_0x562868=_[_0x0e76('0x3b')]({},_0x562868,_0x29f0af[_0x0e76('0x3d')]);return db[_0x0e76('0x2a')][_0x0e76('0x42')](_0x562868)[_0x0e76('0x22')](handleEntityNotFound(_0x45ce01,null))[_0x0e76('0x22')](respondWithResult(_0x45ce01,null))[_0x0e76('0x43')](handleError(_0x45ce01,null));};exports['create']=function(_0x94f589,_0x152752){return db['SquareDetailsReport'][_0x0e76('0x44')](_0x94f589[_0x0e76('0x45')],{})[_0x0e76('0x22')](respondWithResult(_0x152752,0xc9))[_0x0e76('0x43')](handleError(_0x152752,null));};exports[_0x0e76('0x20')]=function(_0x271833,_0x3ef46d){if(_0x271833[_0x0e76('0x45')]['id']){delete _0x271833[_0x0e76('0x45')]['id'];}return db['SquareDetailsReport'][_0x0e76('0x42')]({'where':{'id':_0x271833['params']['id']}})[_0x0e76('0x22')](handleEntityNotFound(_0x3ef46d,null))['then'](saveUpdates(_0x271833[_0x0e76('0x45')],null))['then'](respondWithResult(_0x3ef46d,null))[_0x0e76('0x43')](handleError(_0x3ef46d,null));};exports[_0x0e76('0x21')]=function(_0xd007ce,_0x2558d9){return db['SquareDetailsReport']['find']({'where':{'id':_0xd007ce[_0x0e76('0x40')]['id']}})[_0x0e76('0x22')](handleEntityNotFound(_0x2558d9,null))[_0x0e76('0x22')](removeEntity(_0x2558d9,null))[_0x0e76('0x43')](handleError(_0x2558d9,null));};exports[_0x0e76('0x46')]=function(_0x30b730,_0x39142c){return db[_0x0e76('0x2a')][_0x0e76('0x46')]()[_0x0e76('0x22')](respondWithResult(_0x39142c,null))[_0x0e76('0x43')](handleError(_0x39142c,null));}; \ No newline at end of file +var _0x903d=['options','includeAll','rows','show','params','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x903d,0x137));var _0xd903=function(_0x52ec7b,_0x15045f){_0x52ec7b=_0x52ec7b-0x0;var _0x46cb44=_0x903d[_0x52ec7b];return _0x46cb44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd903('0x0'));var zipdir=require(_0xd903('0x1'));var jsonpatch=require(_0xd903('0x2'));var rp=require(_0xd903('0x3'));var moment=require('moment');var BPromise=require(_0xd903('0x4'));var Mustache=require('mustache');var util=require(_0xd903('0x5'));var path=require(_0xd903('0x6'));var sox=require('sox');var csv=require(_0xd903('0x7'));var ejs=require(_0xd903('0x8'));var fs=require('fs');var fs_extra=require(_0xd903('0x9'));var _=require(_0xd903('0xa'));var squel=require(_0xd903('0xb'));var crypto=require(_0xd903('0xc'));var jsforce=require(_0xd903('0xd'));var deskjs=require(_0xd903('0xe'));var toCsv=require(_0xd903('0x7'));var querystring=require(_0xd903('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd903('0x10'));var logger=require(_0xd903('0x11'))(_0xd903('0x12'));var utils=require(_0xd903('0x13'));var config=require(_0xd903('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd903('0x15'))['db'];function respondWithStatusCode(_0x4916a8,_0x2ad01c){_0x2ad01c=_0x2ad01c||0xcc;return function(_0x10d422){if(_0x10d422){return _0x4916a8[_0xd903('0x16')](_0x2ad01c);}return _0x4916a8[_0xd903('0x17')](_0x2ad01c)['end']();};}function respondWithResult(_0x15030f,_0xcb5e48){_0xcb5e48=_0xcb5e48||0xc8;return function(_0x2a11f3){if(_0x2a11f3){return _0x15030f[_0xd903('0x17')](_0xcb5e48)[_0xd903('0x18')](_0x2a11f3);}};}function respondWithFilteredResult(_0x37a4c0,_0x1bd0e2){return function(_0x3fce7b){if(_0x3fce7b){var _0x5a13a8=typeof _0x1bd0e2[_0xd903('0x19')]==='undefined'&&typeof _0x1bd0e2[_0xd903('0x1a')]===_0xd903('0x1b');var _0x169743=_0x3fce7b[_0xd903('0x1c')];var _0x2013aa=_0x5a13a8?0x0:_0x1bd0e2[_0xd903('0x19')];var _0x52cbac=_0x5a13a8?_0x3fce7b['count']:_0x1bd0e2['offset']+_0x1bd0e2[_0xd903('0x1a')];var _0x437507;if(_0x52cbac>=_0x169743){_0x52cbac=_0x169743;_0x437507=0xc8;}else{_0x437507=0xce;}_0x37a4c0[_0xd903('0x17')](_0x437507);return _0x37a4c0[_0xd903('0x1d')](_0xd903('0x1e'),_0x2013aa+'-'+_0x52cbac+'/'+_0x169743)['json'](_0x3fce7b);}return null;};}function patchUpdates(_0xf88533){return function(_0x21fa84){try{jsonpatch[_0xd903('0x1f')](_0x21fa84,_0xf88533,!![]);}catch(_0xca08c9){return BPromise[_0xd903('0x20')](_0xca08c9);}return _0x21fa84[_0xd903('0x21')]();};}function saveUpdates(_0x4d1f4c,_0x9c97ca){return function(_0x28b1e9){if(_0x28b1e9){return _0x28b1e9[_0xd903('0x22')](_0x4d1f4c)[_0xd903('0x23')](function(_0x368222){return _0x368222;});}return null;};}function removeEntity(_0x379561,_0x57bbe4){return function(_0x2c7478){if(_0x2c7478){return _0x2c7478[_0xd903('0x24')]()[_0xd903('0x23')](function(){_0x379561[_0xd903('0x17')](0xcc)[_0xd903('0x25')]();});}};}function handleEntityNotFound(_0x4e3ee3,_0x1319f2){return function(_0x3e5107){if(!_0x3e5107){_0x4e3ee3[_0xd903('0x16')](0x194);}return _0x3e5107;};}function handleError(_0x4b18c0,_0x51b387){_0x51b387=_0x51b387||0x1f4;return function(_0x2d825f){logger[_0xd903('0x26')](_0x2d825f[_0xd903('0x27')]);if(_0x2d825f[_0xd903('0x28')]){delete _0x2d825f['name'];}_0x4b18c0['status'](_0x51b387)[_0xd903('0x29')](_0x2d825f);};}exports[_0xd903('0x2a')]=function(_0xce2806,_0x5411a8){var _0x598c2b={},_0x3e0651={},_0x195d41={'count':0x0,'rows':[]};var _0x322ae7=_[_0xd903('0x2b')](db[_0xd903('0x2c')][_0xd903('0x2d')],function(_0x171a23){return{'name':_0x171a23['fieldName'],'type':_0x171a23[_0xd903('0x2e')][_0xd903('0x2f')]};});_0x3e0651[_0xd903('0x30')]=_[_0xd903('0x2b')](_0x322ae7,'name');_0x3e0651[_0xd903('0x31')]=_[_0xd903('0x32')](_0xce2806[_0xd903('0x31')]);_0x3e0651[_0xd903('0x33')]=_[_0xd903('0x34')](_0x3e0651[_0xd903('0x30')],_0x3e0651[_0xd903('0x31')]);_0x598c2b[_0xd903('0x35')]=_[_0xd903('0x34')](_0x3e0651[_0xd903('0x30')],qs[_0xd903('0x36')](_0xce2806[_0xd903('0x31')][_0xd903('0x36')]));_0x598c2b[_0xd903('0x35')]=_0x598c2b[_0xd903('0x35')][_0xd903('0x37')]?_0x598c2b['attributes']:_0x3e0651[_0xd903('0x30')];if(!_0xce2806[_0xd903('0x31')][_0xd903('0x38')](_0xd903('0x39'))){_0x598c2b[_0xd903('0x1a')]=qs[_0xd903('0x1a')](_0xce2806[_0xd903('0x31')]['limit']);_0x598c2b[_0xd903('0x19')]=qs[_0xd903('0x19')](_0xce2806[_0xd903('0x31')]['offset']);}_0x598c2b['order']=qs['sort'](_0xce2806[_0xd903('0x31')][_0xd903('0x3a')]);_0x598c2b['where']=qs[_0xd903('0x33')](_[_0xd903('0x3b')](_0xce2806['query'],_0x3e0651[_0xd903('0x33')]),_0x322ae7);if(_0xce2806[_0xd903('0x31')]['filter']){_0x598c2b['where']=_[_0xd903('0x3c')](_0x598c2b[_0xd903('0x3d')],{'$or':_[_0xd903('0x2b')](_0x322ae7,function(_0x47c482){if(_0x47c482['type']!==_0xd903('0x3e')){var _0x40550e={};_0x40550e[_0x47c482[_0xd903('0x28')]]={'$like':'%'+_0xce2806[_0xd903('0x31')][_0xd903('0x3f')]+'%'};return _0x40550e;}})});}_0x598c2b=_['merge']({},_0x598c2b,_0xce2806[_0xd903('0x40')]);var _0x290bf8={'where':_0x598c2b[_0xd903('0x3d')]};return db[_0xd903('0x2c')][_0xd903('0x1c')](_0x290bf8)['then'](function(_0x15486d){_0x195d41[_0xd903('0x1c')]=_0x15486d;if(_0xce2806['query'][_0xd903('0x41')]){_0x598c2b['include']=[{'all':!![]}];}return db[_0xd903('0x2c')]['findAll'](_0x598c2b);})[_0xd903('0x23')](function(_0x467632){_0x195d41[_0xd903('0x42')]=_0x467632;return _0x195d41;})['then'](respondWithFilteredResult(_0x5411a8,_0x598c2b))['catch'](handleError(_0x5411a8,null));};exports[_0xd903('0x43')]=function(_0x2d4cb9,_0x23e8a4){var _0x4da044={'raw':!![],'where':{'id':_0x2d4cb9[_0xd903('0x44')]['id']}},_0x2097b4={};_0x2097b4['model']=_[_0xd903('0x32')](db[_0xd903('0x2c')][_0xd903('0x2d')]);_0x2097b4[_0xd903('0x31')]=_[_0xd903('0x32')](_0x2d4cb9[_0xd903('0x31')]);_0x2097b4[_0xd903('0x33')]=_[_0xd903('0x34')](_0x2097b4['model'],_0x2097b4[_0xd903('0x31')]);_0x4da044[_0xd903('0x35')]=_[_0xd903('0x34')](_0x2097b4[_0xd903('0x30')],qs[_0xd903('0x36')](_0x2d4cb9[_0xd903('0x31')][_0xd903('0x36')]));_0x4da044[_0xd903('0x35')]=_0x4da044[_0xd903('0x35')][_0xd903('0x37')]?_0x4da044[_0xd903('0x35')]:_0x2097b4[_0xd903('0x30')];if(_0x2d4cb9['query']['includeAll']){_0x4da044[_0xd903('0x45')]=[{'all':!![]}];}_0x4da044=_['merge']({},_0x4da044,_0x2d4cb9[_0xd903('0x40')]);return db[_0xd903('0x2c')][_0xd903('0x46')](_0x4da044)['then'](handleEntityNotFound(_0x23e8a4,null))['then'](respondWithResult(_0x23e8a4,null))[_0xd903('0x47')](handleError(_0x23e8a4,null));};exports[_0xd903('0x48')]=function(_0x1f7f91,_0x335570){return db[_0xd903('0x2c')][_0xd903('0x48')](_0x1f7f91[_0xd903('0x49')],{})[_0xd903('0x23')](respondWithResult(_0x335570,0xc9))[_0xd903('0x47')](handleError(_0x335570,null));};exports[_0xd903('0x22')]=function(_0x33853e,_0x4680e6){if(_0x33853e['body']['id']){delete _0x33853e['body']['id'];}return db['SquareDetailsReport'][_0xd903('0x46')]({'where':{'id':_0x33853e['params']['id']}})[_0xd903('0x23')](handleEntityNotFound(_0x4680e6,null))[_0xd903('0x23')](saveUpdates(_0x33853e[_0xd903('0x49')],null))[_0xd903('0x23')](respondWithResult(_0x4680e6,null))[_0xd903('0x47')](handleError(_0x4680e6,null));};exports[_0xd903('0x24')]=function(_0x274479,_0x5365d3){return db[_0xd903('0x2c')]['find']({'where':{'id':_0x274479['params']['id']}})[_0xd903('0x23')](handleEntityNotFound(_0x5365d3,null))['then'](removeEntity(_0x5365d3,null))[_0xd903('0x47')](handleError(_0x5365d3,null));};exports[_0xd903('0x4a')]=function(_0x69c267,_0xa1555c){return db[_0xd903('0x2c')][_0xd903('0x4a')]()[_0xd903('0x23')](respondWithResult(_0xa1555c,null))[_0xd903('0x47')](handleError(_0xa1555c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7e05f72..5495d2e 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 _0x4c2c=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x1e20a1,_0x537772){var _0x29de0a=function(_0x265146){while(--_0x265146){_0x1e20a1['push'](_0x1e20a1['shift']());}};_0x29de0a(++_0x537772);}(_0x4c2c,0xa7));var _0xc4c2=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x4c2c[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require(_0xc4c2('0x0'));var util=require(_0xc4c2('0x1'));var logger=require(_0xc4c2('0x2'))(_0xc4c2('0x3'));var moment=require(_0xc4c2('0x4'));var BPromise=require(_0xc4c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c2('0x6'));var rimraf=require('rimraf');var config=require(_0xc4c2('0x7'));var attributes=require(_0xc4c2('0x8'));module[_0xc4c2('0x9')]=function(_0xe27911,_0x329629){return _0xe27911['define'](_0xc4c2('0xa'),attributes,{'tableName':_0xc4c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe363=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x1e5017,_0x652070){var _0x56e3bd=function(_0xb0637c){while(--_0xb0637c){_0x1e5017['push'](_0x1e5017['shift']());}};_0x56e3bd(++_0x652070);}(_0xe363,0x176));var _0x3e36=function(_0x20b757,_0x26b51d){_0x20b757=_0x20b757-0x0;var _0x283293=_0xe363[_0x20b757];return _0x283293;};'use strict';var _=require(_0x3e36('0x0'));var util=require(_0x3e36('0x1'));var logger=require(_0x3e36('0x2'))('api');var moment=require(_0x3e36('0x3'));var BPromise=require(_0x3e36('0x4'));var rp=require(_0x3e36('0x5'));var fs=require('fs');var path=require(_0x3e36('0x6'));var rimraf=require(_0x3e36('0x7'));var config=require(_0x3e36('0x8'));var attributes=require(_0x3e36('0x9'));module[_0x3e36('0xa')]=function(_0x20fcff,_0x36c344){return _0x20fcff['define'](_0x3e36('0xb'),attributes,{'tableName':_0x3e36('0xc'),'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 e66e568..a96fa9b 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 _0xfef3=['../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1a6ca7,_0x36ee4b){var _0x2e4b1d=function(_0xbf80e4){while(--_0xbf80e4){_0x1a6ca7['push'](_0x1a6ca7['shift']());}};_0x2e4b1d(++_0x36ee4b);}(_0xfef3,0x118));var _0x3fef=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0xfef3[_0x20e5c3];return _0x401520;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['create'](_0x1613ad[_0x3fef('0x16')],{'raw':_0x1613ad[_0x3fef('0x17')]?_0x1613ad[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![]})[_0x3fef('0xa')](function(_0x2b5226){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger[_0x3fef('0xe')](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x2b5226));_0x53d993(_0x2b5226);})[_0x3fef('0x19')](function(_0x2eb578){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2eb578['message'],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2eb578['message']));});});}; \ No newline at end of file +var _0x373d=['result','catch','body','options','raw','then','CreateSquareDetailsReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x373d,0x1e2));var _0xd373=function(_0x82305a,_0x46a9fb){_0x82305a=_0x82305a-0x0;var _0x5b57e6=_0x373d[_0x82305a];return _0x5b57e6;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['CreateSquareDetailsReport']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['SquareDetailsReport']['create'](_0x460259[_0xd373('0x14')],{'raw':_0x460259[_0xd373('0x15')]?_0x460259[_0xd373('0x15')][_0xd373('0x16')]===undefined?!![]:![]:!![]})[_0xd373('0x17')](function(_0x181eb2){logger['info'](_0xd373('0x18'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x18'),_0x460259,JSON[_0xd373('0xd')](_0x181eb2));_0x55c5c7(_0x181eb2);})[_0xd373('0x13')](function(_0x3aa1c5){logger['error'](_0xd373('0x18'),_0x3aa1c5[_0xd373('0x10')],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0x3aa1c5[_0xd373('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1a01b62..2875169 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 _0x9e5c=['exports','express','../../components/auth/service','./system.controller','isAuthenticated','killProcess'];(function(_0x39550d,_0x101908){var _0x51c4c9=function(_0x7e759c){while(--_0x7e759c){_0x39550d['push'](_0x39550d['shift']());}};_0x51c4c9(++_0x101908);}(_0x9e5c,0x139));var _0xc9e5=function(_0x47f4c0,_0x5ab2c6){_0x47f4c0=_0x47f4c0-0x0;var _0x35e376=_0x9e5c[_0x47f4c0];return _0x35e376;};'use strict';var express=require(_0xc9e5('0x0'));var router=express['Router']();var auth=require(_0xc9e5('0x1'));var controller=require(_0xc9e5('0x2'));router['get']('/',auth[_0xc9e5('0x3')](),controller['index']);router['get']('/process/:pid/kill',auth[_0xc9e5('0x3')](),controller[_0xc9e5('0x4')]);module[_0xc9e5('0x5')]=router; \ No newline at end of file +var _0x0a7c=['isAuthenticated','get','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a7c,0xc2));var _0xc0a7=function(_0x4cc21a,_0x3677fe){_0x4cc21a=_0x4cc21a-0x0;var _0x426d76=_0x0a7c[_0x4cc21a];return _0x426d76;};'use strict';var express=require(_0xc0a7('0x0'));var router=express[_0xc0a7('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0xc0a7('0x2')](),controller['index']);router[_0xc0a7('0x3')](_0xc0a7('0x4'),auth[_0xc0a7('0x2')](),controller[_0xc0a7('0x5')]);module[_0xc0a7('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c5da44b..21ab6e6 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 _0xcf18=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','catch','exec','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','killProcess','components/import/cm'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xcf18,0x1a1));var _0x8cf1=function(_0x38aa1d,_0x4faf18){_0x38aa1d=_0x38aa1d-0x0;var _0x2fb75d=_0xcf18[_0x38aa1d];return _0x2fb75d;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x8cf1('0x0')];var logger=require(_0x8cf1('0x1'))('api');var util=require('util');var BPromise=require(_0x8cf1('0x2'));var _=require(_0x8cf1('0x3'));function handleError(_0x38da36,_0x1fd1e9,_0x1e7044){_0x1fd1e9=_0x1fd1e9||0x1f4;return function(_0x51c977){logger[_0x8cf1('0x4')](_0x8cf1('0x5'),_0x1e7044,_0x1fd1e9,util[_0x8cf1('0x6')](_0x51c977,{'showHidden':![],'depth':null}));delete _0x51c977[_0x8cf1('0x7')];_0x38da36[_0x8cf1('0x8')](_0x1fd1e9)[_0x8cf1('0x9')](_0x51c977);};}exports['index']=function(_0x1b2a55,_0x53b386){return info[_0x8cf1('0xa')]()[_0x8cf1('0xb')](function(_0x2cfee9){return _0x53b386['status'](0xc8)[_0x8cf1('0xc')](_0x2cfee9);})['catch'](function(_0x3f786f){return _0x53b386[_0x8cf1('0x8')](0x1f4)['json'](_0x3f786f);});};exports[_0x8cf1('0xd')]=function(_0x532870,_0x417b37){var _0xabfd50=[_0x8cf1('0xe')];return new BPromise(function(_0x35e6de,_0x1fb52f){return exec(util['format'](_0x8cf1('0xf'),_0x532870['params'][_0x8cf1('0x10')]),function(_0x271b63,_0x3167b1,_0x1826bd){if(_0x271b63){return _0x1fb52f(_0x271b63);}return _0x35e6de(_0x3167b1);});})[_0x8cf1('0xb')](function(_0xcfbe2){var _0x2a702f=![];var _0x3c8ec6=_0xcfbe2[_0x8cf1('0x11')](/\n/);for(var _0x1b49d1=0x0,_0x3b733a=_0xabfd50[_0x8cf1('0x12')];_0x1b49d1<_0x3b733a,_0x2a702f===![];_0x1b49d1+=0x1){if(_0xcfbe2[_0x8cf1('0x13')](_0xabfd50[_0x1b49d1])>=0x0){_0x2a702f=!![];}}if(!_0x2a702f){throw new Error(util[_0x8cf1('0x14')](_0x8cf1('0x15'),_0x532870['params'][_0x8cf1('0x10')]));}process['kill'](_0x532870[_0x8cf1('0x16')][_0x8cf1('0x10')],'SIGINT');return _0x417b37[_0x8cf1('0x8')](0xc8)[_0x8cf1('0xc')]({'message':util[_0x8cf1('0x14')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x532870[_0x8cf1('0x16')][_0x8cf1('0x10')])});})[_0x8cf1('0x17')](handleError(_0x417b37,null,_0x8cf1('0xd')));}; \ No newline at end of file +var _0xf4db=['exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','catch','json','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation'];(function(_0x380a27,_0x47afe6){var _0x6ceac1=function(_0x1f9a1a){while(--_0x1f9a1a){_0x380a27['push'](_0x380a27['shift']());}};_0x6ceac1(++_0x47afe6);}(_0xf4db,0xb5));var _0xbf4d=function(_0x466186,_0x2276fb){_0x466186=_0x466186-0x0;var _0x1ee9af=_0xf4db[_0x466186];return _0x1ee9af;};'use strict';var info=require(_0xbf4d('0x0'));var exec=require('child_process')[_0xbf4d('0x1')];var logger=require(_0xbf4d('0x2'))(_0xbf4d('0x3'));var util=require(_0xbf4d('0x4'));var BPromise=require(_0xbf4d('0x5'));var _=require('lodash');function handleError(_0x6a8294,_0x2e6458,_0x2a2d86){_0x2e6458=_0x2e6458||0x1f4;return function(_0x2a892e){logger['error'](_0xbf4d('0x6'),_0x2a2d86,_0x2e6458,util['inspect'](_0x2a892e,{'showHidden':![],'depth':null}));delete _0x2a892e['name'];_0x6a8294[_0xbf4d('0x7')](_0x2e6458)[_0xbf4d('0x8')](_0x2a892e);};}exports[_0xbf4d('0x9')]=function(_0x5c695a,_0xa56fb1){return info[_0xbf4d('0xa')]()[_0xbf4d('0xb')](function(_0xe430a1){return _0xa56fb1['status'](0xc8)['json'](_0xe430a1);})[_0xbf4d('0xc')](function(_0x30cff7){return _0xa56fb1[_0xbf4d('0x7')](0x1f4)[_0xbf4d('0xd')](_0x30cff7);});};exports['killProcess']=function(_0x40f24d,_0x214840){var _0x4baeb0=[_0xbf4d('0xe')];return new BPromise(function(_0x324ae7,_0xe71439){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x40f24d[_0xbf4d('0xf')][_0xbf4d('0x10')]),function(_0x99a384,_0x35d313,_0x470afe){if(_0x99a384){return _0xe71439(_0x99a384);}return _0x324ae7(_0x35d313);});})[_0xbf4d('0xb')](function(_0x28c279){var _0x43737d=![];var _0x28c7bb=_0x28c279[_0xbf4d('0x11')](/\n/);for(var _0x49344c=0x0,_0x4b8a37=_0x4baeb0[_0xbf4d('0x12')];_0x49344c<_0x4b8a37,_0x43737d===![];_0x49344c+=0x1){if(_0x28c279[_0xbf4d('0x13')](_0x4baeb0[_0x49344c])>=0x0){_0x43737d=!![];}}if(!_0x43737d){throw new Error(util[_0xbf4d('0x14')](_0xbf4d('0x15'),_0x40f24d['params']['pid']));}process[_0xbf4d('0x16')](_0x40f24d[_0xbf4d('0xf')][_0xbf4d('0x10')],_0xbf4d('0x17'));return _0x214840[_0xbf4d('0x7')](0xc8)[_0xbf4d('0xd')]({'message':util['format'](_0xbf4d('0x18'),_0x40f24d[_0xbf4d('0xf')][_0xbf4d('0x10')])});})[_0xbf4d('0xc')](handleError(_0x214840,null,_0xbf4d('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 025f069..688c8a5 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 _0x9195=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9195,0x129));var _0x5919=function(_0x1e829d,_0xe3e6e8){_0x1e829d=_0x1e829d-0x0;var _0x3f5769=_0x9195[_0x1e829d];return _0x3f5769;};'use strict';var multer=require(_0x5919('0x0'));var util=require(_0x5919('0x1'));var path=require(_0x5919('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5919('0x3')]();var fs_extra=require(_0x5919('0x4'));var auth=require(_0x5919('0x5'));var interaction=require(_0x5919('0x6'));var config=require(_0x5919('0x7'));var controller=require('./tag.controller');router['get']('/',auth[_0x5919('0x8')](),controller[_0x5919('0x9')]);router[_0x5919('0xa')](_0x5919('0xb'),auth[_0x5919('0x8')](),controller[_0x5919('0xc')]);router[_0x5919('0xd')]('/',auth[_0x5919('0x8')](),controller[_0x5919('0xe')]);router[_0x5919('0xf')](_0x5919('0xb'),auth[_0x5919('0x8')](),controller[_0x5919('0x10')]);router[_0x5919('0x11')](_0x5919('0xb'),auth[_0x5919('0x8')](),controller[_0x5919('0x12')]);module[_0x5919('0x13')]=router; \ No newline at end of file +var _0xd3f9=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','multer'];(function(_0x19242d,_0x2818cd){var _0x290c0f=function(_0x2821e1){while(--_0x2821e1){_0x19242d['push'](_0x19242d['shift']());}};_0x290c0f(++_0x2818cd);}(_0xd3f9,0x7d));var _0x9d3f=function(_0x4ec8ef,_0x3fb840){_0x4ec8ef=_0x4ec8ef-0x0;var _0x5c66d1=_0xd3f9[_0x4ec8ef];return _0x5c66d1;};'use strict';var multer=require(_0x9d3f('0x0'));var util=require('util');var path=require(_0x9d3f('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d3f('0x2'));var router=express[_0x9d3f('0x3')]();var fs_extra=require(_0x9d3f('0x4'));var auth=require(_0x9d3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d3f('0x6'));var controller=require(_0x9d3f('0x7'));router['get']('/',auth[_0x9d3f('0x8')](),controller[_0x9d3f('0x9')]);router[_0x9d3f('0xa')](_0x9d3f('0xb'),auth[_0x9d3f('0x8')](),controller[_0x9d3f('0xc')]);router[_0x9d3f('0xd')]('/',auth[_0x9d3f('0x8')](),controller[_0x9d3f('0xe')]);router[_0x9d3f('0xf')]('/:id',auth[_0x9d3f('0x8')](),controller[_0x9d3f('0x10')]);router[_0x9d3f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 59a876f..71785ac 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 _0xe61a=['name','#0091EA','STRING','sequelize','exports'];(function(_0x28c752,_0x238454){var _0x30cd6c=function(_0x4c71be){while(--_0x4c71be){_0x28c752['push'](_0x28c752['shift']());}};_0x30cd6c(++_0x238454);}(_0xe61a,0x120));var _0xae61=function(_0xdee349,_0x38d21f){_0xdee349=_0xdee349-0x0;var _0x1ab237=_0xe61a[_0xdee349];return _0x1ab237;};'use strict';var Sequelize=require(_0xae61('0x0'));module[_0xae61('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xae61('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xae61('0x3')},'description':{'type':Sequelize[_0xae61('0x4')]}}; \ No newline at end of file +var _0xe1e8=['sequelize','STRING','#0091EA'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x508bb2,_0x4b4532){_0x508bb2=_0x508bb2-0x0;var _0x273268=_0xe1e8[_0x508bb2];return _0x273268;};'use strict';var Sequelize=require(_0x8e1e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e1e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x8e1e('0x2')},'description':{'type':Sequelize[_0x8e1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ee6dc21..101ff04 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 _0xde64=['limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Tags','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','Tag','catch','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xde64,0x17c));var _0x4de6=function(_0x568f36,_0x8266d4){_0x568f36=_0x568f36-0x0;var _0x4a74c4=_0xde64[_0x568f36];return _0x4a74c4;};'use strict';var emlformat=require(_0x4de6('0x0'));var rimraf=require(_0x4de6('0x1'));var zipdir=require(_0x4de6('0x2'));var jsonpatch=require(_0x4de6('0x3'));var rp=require(_0x4de6('0x4'));var moment=require(_0x4de6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4de6('0x6'));var util=require(_0x4de6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4de6('0x8'));var ejs=require(_0x4de6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4de6('0xa'));var crypto=require(_0x4de6('0xb'));var jsforce=require(_0x4de6('0xc'));var deskjs=require(_0x4de6('0xd'));var toCsv=require(_0x4de6('0x8'));var querystring=require(_0x4de6('0xe'));var Papa=require('papaparse');var Redis=require(_0x4de6('0xf'));var authService=require(_0x4de6('0x10'));var qs=require(_0x4de6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de6('0x12'));var logger=require(_0x4de6('0x13'))(_0x4de6('0x14'));var utils=require(_0x4de6('0x15'));var config=require(_0x4de6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4de6('0x17'))['db'];function respondWithStatusCode(_0x3baa31,_0xb8e256){_0xb8e256=_0xb8e256||0xcc;return function(_0x509002){if(_0x509002){return _0x3baa31[_0x4de6('0x18')](_0xb8e256);}return _0x3baa31[_0x4de6('0x19')](_0xb8e256)[_0x4de6('0x1a')]();};}function respondWithResult(_0x2bd121,_0x58b0c1){_0x58b0c1=_0x58b0c1||0xc8;return function(_0x1ccfee){if(_0x1ccfee){return _0x2bd121[_0x4de6('0x19')](_0x58b0c1)[_0x4de6('0x1b')](_0x1ccfee);}};}function respondWithFilteredResult(_0x4dd3b5,_0x33fd67){return function(_0x54e2f2){if(_0x54e2f2){var _0x4cbb5c=typeof _0x33fd67[_0x4de6('0x1c')]===_0x4de6('0x1d')&&typeof _0x33fd67[_0x4de6('0x1e')]===_0x4de6('0x1d');var _0x37975a=_0x54e2f2[_0x4de6('0x1f')];var _0x324202=_0x4cbb5c?0x0:_0x33fd67['offset'];var _0x420f7c=_0x4cbb5c?_0x54e2f2[_0x4de6('0x1f')]:_0x33fd67[_0x4de6('0x1c')]+_0x33fd67[_0x4de6('0x1e')];var _0x167c7c;if(_0x420f7c>=_0x37975a){_0x420f7c=_0x37975a;_0x167c7c=0xc8;}else{_0x167c7c=0xce;}_0x4dd3b5[_0x4de6('0x19')](_0x167c7c);return _0x4dd3b5[_0x4de6('0x20')](_0x4de6('0x21'),_0x324202+'-'+_0x420f7c+'/'+_0x37975a)[_0x4de6('0x1b')](_0x54e2f2);}return null;};}function patchUpdates(_0x15c923){return function(_0x4c4d13){try{jsonpatch[_0x4de6('0x22')](_0x4c4d13,_0x15c923,!![]);}catch(_0x51ad13){return BPromise[_0x4de6('0x23')](_0x51ad13);}return _0x4c4d13[_0x4de6('0x24')]();};}function saveUpdates(_0x43771b,_0x5de99f){return function(_0xe1b69d){if(_0xe1b69d){return _0xe1b69d['update'](_0x43771b)[_0x4de6('0x25')](function(_0x385cae){return _0x385cae;});}return null;};}function removeEntity(_0x1a64e9,_0x5ddbab){return function(_0x478d83){if(_0x478d83){return _0x478d83[_0x4de6('0x26')]()[_0x4de6('0x25')](function(){var _0x3be904=_0x478d83[_0x4de6('0x27')]({'plain':!![]});var _0x25a76b=_0x4de6('0x28');return db['UserProfileResource'][_0x4de6('0x26')]({'where':{'type':_0x25a76b,'resourceId':_0x3be904['id']}})[_0x4de6('0x25')](function(){return _0x478d83;});})[_0x4de6('0x25')](function(){_0x1a64e9[_0x4de6('0x19')](0xcc)[_0x4de6('0x1a')]();});}};}function handleEntityNotFound(_0x281060,_0xa2b88c){return function(_0x7bc61e){if(!_0x7bc61e){_0x281060[_0x4de6('0x18')](0x194);}return _0x7bc61e;};}function handleError(_0x4f168b,_0x2065b4){_0x2065b4=_0x2065b4||0x1f4;return function(_0x2a5592){logger[_0x4de6('0x29')](_0x2a5592[_0x4de6('0x2a')]);if(_0x2a5592[_0x4de6('0x2b')]){delete _0x2a5592['name'];}_0x4f168b[_0x4de6('0x19')](_0x2065b4)['send'](_0x2a5592);};}exports[_0x4de6('0x2c')]=function(_0x2bfc77,_0x1df7c0){var _0x1b5607={},_0x592799={},_0x5593e8={'count':0x0,'rows':[]};var _0x530e04=_['map'](db['Tag'][_0x4de6('0x2d')],function(_0x1da3b1){return{'name':_0x1da3b1[_0x4de6('0x2e')],'type':_0x1da3b1[_0x4de6('0x2f')][_0x4de6('0x30')]};});_0x592799[_0x4de6('0x31')]=_[_0x4de6('0x32')](_0x530e04,_0x4de6('0x2b'));_0x592799[_0x4de6('0x33')]=_[_0x4de6('0x34')](_0x2bfc77[_0x4de6('0x33')]);_0x592799[_0x4de6('0x35')]=_[_0x4de6('0x36')](_0x592799[_0x4de6('0x31')],_0x592799[_0x4de6('0x33')]);_0x1b5607[_0x4de6('0x37')]=_[_0x4de6('0x36')](_0x592799[_0x4de6('0x31')],qs[_0x4de6('0x38')](_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x38')]));_0x1b5607[_0x4de6('0x37')]=_0x1b5607[_0x4de6('0x37')][_0x4de6('0x39')]?_0x1b5607[_0x4de6('0x37')]:_0x592799[_0x4de6('0x31')];if(!_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x3a')](_0x4de6('0x3b'))){_0x1b5607['limit']=qs[_0x4de6('0x1e')](_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x1e')]);_0x1b5607[_0x4de6('0x1c')]=qs['offset'](_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x1c')]);}_0x1b5607[_0x4de6('0x3c')]=qs[_0x4de6('0x3d')](_0x2bfc77['query'][_0x4de6('0x3d')]);_0x1b5607['where']=qs[_0x4de6('0x35')](_[_0x4de6('0x3e')](_0x2bfc77[_0x4de6('0x33')],_0x592799[_0x4de6('0x35')]),_0x530e04);if(_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x3f')]){_0x1b5607[_0x4de6('0x40')]=_[_0x4de6('0x41')](_0x1b5607[_0x4de6('0x40')],{'$or':_[_0x4de6('0x32')](_0x530e04,function(_0x85581b){if(_0x85581b[_0x4de6('0x2f')]!=='VIRTUAL'){var _0x57a6ca={};_0x57a6ca[_0x85581b[_0x4de6('0x2b')]]={'$like':'%'+_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x3f')]+'%'};return _0x57a6ca;}})});}_0x1b5607=_[_0x4de6('0x41')]({},_0x1b5607,_0x2bfc77['options']);var _0x5d07aa={'where':_0x1b5607[_0x4de6('0x40')]};return db['Tag'][_0x4de6('0x1f')](_0x5d07aa)['then'](function(_0x3696c8){_0x5593e8['count']=_0x3696c8;if(_0x2bfc77[_0x4de6('0x33')][_0x4de6('0x42')]){_0x1b5607[_0x4de6('0x43')]=[{'all':!![]}];}return db[_0x4de6('0x44')]['findAll'](_0x1b5607);})[_0x4de6('0x25')](function(_0x4049ed){_0x5593e8['rows']=_0x4049ed;return _0x5593e8;})['then'](respondWithFilteredResult(_0x1df7c0,_0x1b5607))[_0x4de6('0x45')](handleError(_0x1df7c0,null));};exports['show']=function(_0x118eb3,_0x3260bc){var _0x3f0f08={'raw':!![],'where':{'id':_0x118eb3[_0x4de6('0x46')]['id']}},_0x349688={};_0x349688[_0x4de6('0x31')]=_[_0x4de6('0x34')](db[_0x4de6('0x44')][_0x4de6('0x2d')]);_0x349688[_0x4de6('0x33')]=_[_0x4de6('0x34')](_0x118eb3[_0x4de6('0x33')]);_0x349688['filters']=_['intersection'](_0x349688['model'],_0x349688[_0x4de6('0x33')]);_0x3f0f08[_0x4de6('0x37')]=_['intersection'](_0x349688['model'],qs[_0x4de6('0x38')](_0x118eb3['query'][_0x4de6('0x38')]));_0x3f0f08[_0x4de6('0x37')]=_0x3f0f08['attributes'][_0x4de6('0x39')]?_0x3f0f08[_0x4de6('0x37')]:_0x349688[_0x4de6('0x31')];if(_0x118eb3[_0x4de6('0x33')][_0x4de6('0x42')]){_0x3f0f08['include']=[{'all':!![]}];}_0x3f0f08=_[_0x4de6('0x41')]({},_0x3f0f08,_0x118eb3[_0x4de6('0x47')]);return db[_0x4de6('0x44')][_0x4de6('0x48')](_0x3f0f08)[_0x4de6('0x25')](handleEntityNotFound(_0x3260bc,null))[_0x4de6('0x25')](respondWithResult(_0x3260bc,null))[_0x4de6('0x45')](handleError(_0x3260bc,null));};exports[_0x4de6('0x49')]=function(_0x698dcb,_0x3126f1){return db[_0x4de6('0x44')][_0x4de6('0x49')](_0x698dcb[_0x4de6('0x4a')],{})[_0x4de6('0x25')](function(_0x354558){var _0x12ce25=_0x698dcb[_0x4de6('0x4b')]['get']({'plain':!![]});if(!_0x12ce25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ce25[_0x4de6('0x4c')]===_0x4de6('0x4b')){var _0x524807=_0x354558[_0x4de6('0x27')]({'plain':!![]});var _0x191f93=_0x4de6('0x28');return db[_0x4de6('0x4d')][_0x4de6('0x48')]({'where':{'name':_0x191f93,'userProfileId':_0x12ce25[_0x4de6('0x4e')]},'raw':!![]})[_0x4de6('0x25')](function(_0x502e4d){if(_0x502e4d&&_0x502e4d[_0x4de6('0x4f')]===0x0){return db['UserProfileResource'][_0x4de6('0x49')]({'name':_0x524807[_0x4de6('0x2b')],'resourceId':_0x524807['id'],'type':_0x502e4d[_0x4de6('0x2b')],'sectionId':_0x502e4d['id']},{})[_0x4de6('0x25')](function(){return _0x354558;});}else{return _0x354558;}})[_0x4de6('0x45')](function(_0xac3eb5){logger[_0x4de6('0x29')](_0x4de6('0x50'),_0xac3eb5);throw _0xac3eb5;});}return _0x354558;})['then'](respondWithResult(_0x3126f1,0xc9))['catch'](handleError(_0x3126f1,null));};exports[_0x4de6('0x51')]=function(_0x198054,_0x61bc5d){if(_0x198054[_0x4de6('0x4a')]['id']){delete _0x198054['body']['id'];}return db[_0x4de6('0x44')][_0x4de6('0x48')]({'where':{'id':_0x198054[_0x4de6('0x46')]['id']}})['then'](handleEntityNotFound(_0x61bc5d,null))[_0x4de6('0x25')](saveUpdates(_0x198054['body'],null))[_0x4de6('0x25')](respondWithResult(_0x61bc5d,null))[_0x4de6('0x45')](handleError(_0x61bc5d,null));};exports['destroy']=function(_0x19f34a,_0x1b71cf){return db['Tag'][_0x4de6('0x48')]({'where':{'id':_0x19f34a[_0x4de6('0x46')]['id']}})[_0x4de6('0x25')](handleEntityNotFound(_0x1b71cf,null))[_0x4de6('0x25')](removeEntity(_0x1b71cf,null))[_0x4de6('0x45')](handleError(_0x1b71cf,null));}; \ No newline at end of file +var _0x80df=['fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','end','sendStatus','error','stack','name','index','Tag','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0x26f5d9,_0x2da44b){var _0x387615=function(_0x7b3803){while(--_0x7b3803){_0x26f5d9['push'](_0x26f5d9['shift']());}};_0x387615(++_0x2da44b);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){var _0x3353a3=_0x32ad42[_0xf80d('0x29')]({'plain':!![]});var _0x323540=_0xf80d('0x2a');return db['UserProfileResource'][_0xf80d('0x28')]({'where':{'type':_0x323540,'resourceId':_0x3353a3['id']}})[_0xf80d('0x27')](function(){return _0x32ad42;});})[_0xf80d('0x27')](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x2b')]();});}};}function handleEntityNotFound(_0xde054a,_0x2fc429){return function(_0x68f2c6){if(!_0x68f2c6){_0xde054a[_0xf80d('0x2c')](0x194);}return _0x68f2c6;};}function handleError(_0x4d2579,_0xe940d6){_0xe940d6=_0xe940d6||0x1f4;return function(_0x1603a4){logger[_0xf80d('0x2d')](_0x1603a4[_0xf80d('0x2e')]);if(_0x1603a4[_0xf80d('0x2f')]){delete _0x1603a4[_0xf80d('0x2f')];}_0x4d2579[_0xf80d('0x1c')](_0xe940d6)['send'](_0x1603a4);};}exports[_0xf80d('0x30')]=function(_0x27887e,_0x214bff){var _0x435e23={},_0x5c3a1d={},_0x487d2c={'count':0x0,'rows':[]};var _0x2359f1=_['map'](db[_0xf80d('0x31')][_0xf80d('0x32')],function(_0x45f76a){return{'name':_0x45f76a['fieldName'],'type':_0x45f76a[_0xf80d('0x33')][_0xf80d('0x34')]};});_0x5c3a1d['model']=_[_0xf80d('0x35')](_0x2359f1,_0xf80d('0x2f'));_0x5c3a1d[_0xf80d('0x36')]=_['keys'](_0x27887e[_0xf80d('0x36')]);_0x5c3a1d[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x5c3a1d[_0xf80d('0x39')],_0x5c3a1d[_0xf80d('0x36')]);_0x435e23['attributes']=_[_0xf80d('0x38')](_0x5c3a1d['model'],qs[_0xf80d('0x3a')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x435e23[_0xf80d('0x3b')]=_0x435e23['attributes'][_0xf80d('0x3c')]?_0x435e23[_0xf80d('0x3b')]:_0x5c3a1d[_0xf80d('0x39')];if(!_0x27887e[_0xf80d('0x36')]['hasOwnProperty'](_0xf80d('0x3d'))){_0x435e23[_0xf80d('0x20')]=qs[_0xf80d('0x20')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x20')]);_0x435e23[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x27887e[_0xf80d('0x36')]['offset']);}_0x435e23[_0xf80d('0x3e')]=qs[_0xf80d('0x3f')](_0x27887e[_0xf80d('0x36')]['sort']);_0x435e23[_0xf80d('0x40')]=qs['filters'](_[_0xf80d('0x41')](_0x27887e[_0xf80d('0x36')],_0x5c3a1d[_0xf80d('0x37')]),_0x2359f1);if(_0x27887e[_0xf80d('0x36')]['filter']){_0x435e23['where']=_['merge'](_0x435e23[_0xf80d('0x40')],{'$or':_[_0xf80d('0x35')](_0x2359f1,function(_0x2d0ee5){if(_0x2d0ee5[_0xf80d('0x33')]!==_0xf80d('0x42')){var _0x100dc7={};_0x100dc7[_0x2d0ee5['name']]={'$like':'%'+_0x27887e[_0xf80d('0x36')][_0xf80d('0x43')]+'%'};return _0x100dc7;}})});}_0x435e23=_[_0xf80d('0x44')]({},_0x435e23,_0x27887e['options']);var _0x14314a={'where':_0x435e23['where']};return db[_0xf80d('0x31')][_0xf80d('0x21')](_0x14314a)[_0xf80d('0x27')](function(_0x2cd371){_0x487d2c[_0xf80d('0x21')]=_0x2cd371;if(_0x27887e[_0xf80d('0x36')][_0xf80d('0x45')]){_0x435e23[_0xf80d('0x46')]=[{'all':!![]}];}return db[_0xf80d('0x31')][_0xf80d('0x47')](_0x435e23);})[_0xf80d('0x27')](function(_0x437e44){_0x487d2c[_0xf80d('0x48')]=_0x437e44;return _0x487d2c;})[_0xf80d('0x27')](respondWithFilteredResult(_0x214bff,_0x435e23))[_0xf80d('0x49')](handleError(_0x214bff,null));};exports[_0xf80d('0x4a')]=function(_0x43474d,_0x9da271){var _0x19b7eb={'raw':!![],'where':{'id':_0x43474d[_0xf80d('0x4b')]['id']}},_0x24c1e4={};_0x24c1e4[_0xf80d('0x39')]=_[_0xf80d('0x4c')](db[_0xf80d('0x31')][_0xf80d('0x32')]);_0x24c1e4['query']=_[_0xf80d('0x4c')](_0x43474d[_0xf80d('0x36')]);_0x24c1e4[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],_0x24c1e4['query']);_0x19b7eb[_0xf80d('0x3b')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],qs[_0xf80d('0x3a')](_0x43474d[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x19b7eb[_0xf80d('0x3b')]=_0x19b7eb[_0xf80d('0x3b')][_0xf80d('0x3c')]?_0x19b7eb[_0xf80d('0x3b')]:_0x24c1e4[_0xf80d('0x39')];if(_0x43474d[_0xf80d('0x36')][_0xf80d('0x45')]){_0x19b7eb[_0xf80d('0x46')]=[{'all':!![]}];}_0x19b7eb=_[_0xf80d('0x44')]({},_0x19b7eb,_0x43474d[_0xf80d('0x4d')]);return db[_0xf80d('0x31')]['find'](_0x19b7eb)[_0xf80d('0x27')](handleEntityNotFound(_0x9da271,null))[_0xf80d('0x27')](respondWithResult(_0x9da271,null))[_0xf80d('0x49')](handleError(_0x9da271,null));};exports['create']=function(_0x3e5cf6,_0x1088ca){return db['Tag']['create'](_0x3e5cf6[_0xf80d('0x4e')],{})['then'](function(_0xcb5fe7){var _0x24c70e=_0x3e5cf6[_0xf80d('0x4f')][_0xf80d('0x29')]({'plain':!![]});if(!_0x24c70e)throw new Error(_0xf80d('0x50'));if(_0x24c70e[_0xf80d('0x51')]===_0xf80d('0x4f')){var _0x114132=_0xcb5fe7[_0xf80d('0x29')]({'plain':!![]});var _0x1f20a2=_0xf80d('0x2a');return db[_0xf80d('0x52')]['find']({'where':{'name':_0x1f20a2,'userProfileId':_0x24c70e[_0xf80d('0x53')]},'raw':!![]})[_0xf80d('0x27')](function(_0x3c25d7){if(_0x3c25d7&&_0x3c25d7['autoAssociation']===0x0){return db[_0xf80d('0x54')][_0xf80d('0x55')]({'name':_0x114132['name'],'resourceId':_0x114132['id'],'type':_0x3c25d7[_0xf80d('0x2f')],'sectionId':_0x3c25d7['id']},{})[_0xf80d('0x27')](function(){return _0xcb5fe7;});}else{return _0xcb5fe7;}})['catch'](function(_0xee12ae){logger[_0xf80d('0x2d')](_0xf80d('0x56'),_0xee12ae);throw _0xee12ae;});}return _0xcb5fe7;})[_0xf80d('0x27')](respondWithResult(_0x1088ca,0xc9))['catch'](handleError(_0x1088ca,null));};exports[_0xf80d('0x26')]=function(_0x374985,_0x1a4c08){if(_0x374985['body']['id']){delete _0x374985[_0xf80d('0x4e')]['id'];}return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x374985[_0xf80d('0x4b')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1a4c08,null))[_0xf80d('0x27')](saveUpdates(_0x374985[_0xf80d('0x4e')],null))[_0xf80d('0x27')](respondWithResult(_0x1a4c08,null))[_0xf80d('0x49')](handleError(_0x1a4c08,null));};exports[_0xf80d('0x28')]=function(_0x543dba,_0x112342){return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x543dba[_0xf80d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x112342,null))['then'](removeEntity(_0x112342,null))[_0xf80d('0x49')](handleError(_0x112342,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e27422a..6554bcd 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 _0x04a8=['exports','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x3345af,_0x4a8600){var _0x18867b=function(_0x7752f7){while(--_0x7752f7){_0x3345af['push'](_0x3345af['shift']());}};_0x18867b(++_0x4a8600);}(_0x04a8,0x153));var _0x804a=function(_0x128c40,_0x57371f){_0x128c40=_0x128c40-0x0;var _0x24e472=_0x04a8[_0x128c40];return _0x24e472;};'use strict';var _=require(_0x804a('0x0'));var util=require('util');var logger=require(_0x804a('0x1'))(_0x804a('0x2'));var moment=require(_0x804a('0x3'));var BPromise=require(_0x804a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x804a('0x5'));var rimraf=require(_0x804a('0x6'));var config=require(_0x804a('0x7'));var attributes=require(_0x804a('0x8'));module[_0x804a('0x9')]=function(_0x1b90dc,_0x34189b){return _0x1b90dc['define'](_0x804a('0xa'),attributes,{'tableName':_0x804a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90cd=['define','Tag','tools_tags','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x1620d2,_0x798f79){var _0xb63a8d=function(_0x414068){while(--_0x414068){_0x1620d2['push'](_0x1620d2['shift']());}};_0xb63a8d(++_0x798f79);}(_0x90cd,0x1bf));var _0xd90c=function(_0x4a7020,_0x2c7d96){_0x4a7020=_0x4a7020-0x0;var _0x2cca9f=_0x90cd[_0x4a7020];return _0x2cca9f;};'use strict';var _=require(_0xd90c('0x0'));var util=require('util');var logger=require(_0xd90c('0x1'))(_0xd90c('0x2'));var moment=require('moment');var BPromise=require(_0xd90c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd90c('0x4'));var rimraf=require(_0xd90c('0x5'));var config=require(_0xd90c('0x6'));var attributes=require(_0xd90c('0x7'));module[_0xd90c('0x8')]=function(_0x7b823,_0x357b3d){return _0x7b823[_0xd90c('0x9')](_0xd90c('0xa'),attributes,{'tableName':_0xd90c('0xb'),'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 18abbcc..c51728d 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 _0xb205=['../../config/environment','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb205,0xf0));var _0x5b20=function(_0x5c32e4,_0x2ac178){_0x5c32e4=_0x5c32e4-0x0;var _0x4e28cf=_0xb205[_0x5c32e4];return _0x4e28cf;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var BPromise=require(_0x5b20('0x3'));var rs=require(_0x5b20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b20('0x5'));var logger=require('../../config/logger')(_0x5b20('0x6'));var config=require(_0x5b20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b20('0x8')][_0x5b20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x364e48,_0x5c1ff9,_0x32b467){return new BPromise(function(_0x13fb27,_0x528c54){return client['request'](_0x364e48,_0x32b467)[_0x5b20('0xa')](function(_0xb77426){logger[_0x5b20('0xb')](_0x5b20('0xc'),_0x5c1ff9,_0x5b20('0xd'));logger[_0x5b20('0xe')](_0x5b20('0xf'),_0x5c1ff9,'request\x20sent',JSON[_0x5b20('0x10')](_0xb77426));if(_0xb77426[_0x5b20('0x11')]){if(_0xb77426[_0x5b20('0x11')]['code']===0x1f4){logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x528c54(_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);}logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x13fb27(_0xb77426[_0x5b20('0x11')]['message']);}else{logger['info'](_0x5b20('0xc'),_0x5c1ff9,'request\x20sent');_0x13fb27(_0xb77426['result'][_0x5b20('0x12')]);}})['catch'](function(_0x43b7b0){logger[_0x5b20('0x11')](_0x5b20('0xc'),_0x5c1ff9,_0x43b7b0);_0x528c54(_0x43b7b0);});});} \ No newline at end of file +var _0xec56=['http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xec56,0x1bd));var _0x6ec5=function(_0x56cfc6,_0x46356f){_0x56cfc6=_0x56cfc6-0x0;var _0x263b43=_0xec56[_0x56cfc6];return _0x263b43;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('Tag,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6a71a3b..3ffa37c 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 de65c9c..4bc4ded 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 _0xe706=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe706,0xa3));var _0x6e70=function(_0x28a8c2,_0x494d5){_0x28a8c2=_0x28a8c2-0x0;var _0x37ac3c=_0xe706[_0x28a8c2];return _0x37ac3c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4ed0044..09a96cd 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 _0xf1bb=['capitalize','Queue','toLowerCase','Queues','addQueues','isValidChannel','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Mail','Sms','Fax','penalty','QueueId','defaults','TeamVoiceQueue','User','emit','online','voicePause','interface','upsert','format','SIP/%s','all','spread','removeAgents','Openchannel','Whatsapp','Queue:remove','TeamVoicePrefix','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','Team','fieldName','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError'];(function(_0x4e740c,_0x2f3120){var _0x327a06=function(_0x908629){while(--_0x908629){_0x4e740c['push'](_0x4e740c['shift']());}};_0x327a06(++_0x2f3120);}(_0xf1bb,0x1ed));var _0xbf1b=function(_0x38db71,_0x4b265b){_0x38db71=_0x38db71-0x0;var _0x9723ae=_0xf1bb[_0x38db71];return _0x9723ae;};'use strict';var emlformat=require(_0xbf1b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf1b('0x1'));var rp=require('request-promise');var moment=require(_0xbf1b('0x2'));var BPromise=require(_0xbf1b('0x3'));var Mustache=require(_0xbf1b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbf1b('0x5'));var csv=require(_0xbf1b('0x6'));var ejs=require(_0xbf1b('0x7'));var fs=require('fs');var fs_extra=require(_0xbf1b('0x8'));var _=require(_0xbf1b('0x9'));var squel=require('squel');var crypto=require(_0xbf1b('0xa'));var jsforce=require(_0xbf1b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbf1b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf1b('0xc'));var authService=require(_0xbf1b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf1b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf1b('0xf'));var utils=require(_0xbf1b('0x10'));var config=require(_0xbf1b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf1b('0x12'))['db'];config[_0xbf1b('0x13')]=_['defaults'](config[_0xbf1b('0x13')],{'host':_0xbf1b('0x14'),'port':0x18eb});var socket=require(_0xbf1b('0x15'))(new Redis(config[_0xbf1b('0x13')]));require(_0xbf1b('0x16'))['register'](socket);function respondWithStatusCode(_0x29f00b,_0x5baf5b){_0x5baf5b=_0x5baf5b||0xcc;return function(_0x290bab){if(_0x290bab){return _0x29f00b[_0xbf1b('0x17')](_0x5baf5b);}return _0x29f00b[_0xbf1b('0x18')](_0x5baf5b)[_0xbf1b('0x19')]();};}function respondWithResult(_0x51032f,_0x53121b){_0x53121b=_0x53121b||0xc8;return function(_0x4d9f6f){if(_0x4d9f6f){return _0x51032f['status'](_0x53121b)[_0xbf1b('0x1a')](_0x4d9f6f);}};}function respondWithFilteredResult(_0x347d99,_0x409330){return function(_0x3c789b){if(_0x3c789b){var _0x3ba32e=typeof _0x409330[_0xbf1b('0x1b')]===_0xbf1b('0x1c')&&typeof _0x409330['limit']==='undefined';var _0x3e834c=_0x3c789b[_0xbf1b('0x1d')];var _0x455a46=_0x3ba32e?0x0:_0x409330[_0xbf1b('0x1b')];var _0x23d820=_0x3ba32e?_0x3c789b['count']:_0x409330['offset']+_0x409330['limit'];var _0xbfc2d9;if(_0x23d820>=_0x3e834c){_0x23d820=_0x3e834c;_0xbfc2d9=0xc8;}else{_0xbfc2d9=0xce;}_0x347d99[_0xbf1b('0x18')](_0xbfc2d9);return _0x347d99[_0xbf1b('0x1e')](_0xbf1b('0x1f'),_0x455a46+'-'+_0x23d820+'/'+_0x3e834c)[_0xbf1b('0x1a')](_0x3c789b);}return null;};}function patchUpdates(_0x467e06){return function(_0x1180bf){try{jsonpatch['apply'](_0x1180bf,_0x467e06,!![]);}catch(_0x4b9cbe){return BPromise[_0xbf1b('0x20')](_0x4b9cbe);}return _0x1180bf[_0xbf1b('0x21')]();};}function saveUpdates(_0x205668,_0x1899a6){return function(_0x131f2f){if(_0x131f2f){return _0x131f2f[_0xbf1b('0x22')](_0x205668)[_0xbf1b('0x23')](function(_0x58e8bd){return _0x58e8bd;});}return null;};}function handleEntityNotFound(_0x5809a9,_0x26d6ca){return function(_0x439c2a){if(!_0x439c2a){_0x5809a9['sendStatus'](0x194);}return _0x439c2a;};}function handleError(_0x2c90b1,_0x3576f7){_0x3576f7=_0x3576f7||0x1f4;return function(_0x3a2bda){logger[_0xbf1b('0x24')](_0x3a2bda[_0xbf1b('0x25')]);if(_0x3a2bda[_0xbf1b('0x26')]){delete _0x3a2bda[_0xbf1b('0x26')];}_0x2c90b1[_0xbf1b('0x18')](_0x3576f7)[_0xbf1b('0x27')](_0x3a2bda);};}exports[_0xbf1b('0x28')]=function(_0x31f2a9,_0x70e3f9){var _0x1d1cca={},_0x274a70={},_0x1f02d7={'count':0x0,'rows':[]};var _0x167b42=_['map'](db[_0xbf1b('0x29')]['rawAttributes'],function(_0x1e5fc3){return{'name':_0x1e5fc3[_0xbf1b('0x2a')],'type':_0x1e5fc3['type'][_0xbf1b('0x2b')]};});_0x274a70['model']=_[_0xbf1b('0x2c')](_0x167b42,_0xbf1b('0x26'));_0x274a70[_0xbf1b('0x2d')]=_[_0xbf1b('0x2e')](_0x31f2a9['query']);_0x274a70[_0xbf1b('0x2f')]=_['intersection'](_0x274a70[_0xbf1b('0x30')],_0x274a70[_0xbf1b('0x2d')]);_0x1d1cca['attributes']=_[_0xbf1b('0x31')](_0x274a70[_0xbf1b('0x30')],qs[_0xbf1b('0x32')](_0x31f2a9[_0xbf1b('0x2d')][_0xbf1b('0x32')]));_0x1d1cca['attributes']=_0x1d1cca[_0xbf1b('0x33')][_0xbf1b('0x34')]?_0x1d1cca[_0xbf1b('0x33')]:_0x274a70[_0xbf1b('0x30')];if(!_0x31f2a9['query'][_0xbf1b('0x35')](_0xbf1b('0x36'))){_0x1d1cca['limit']=qs[_0xbf1b('0x37')](_0x31f2a9[_0xbf1b('0x2d')][_0xbf1b('0x37')]);_0x1d1cca['offset']=qs['offset'](_0x31f2a9[_0xbf1b('0x2d')]['offset']);}_0x1d1cca[_0xbf1b('0x38')]=qs[_0xbf1b('0x39')](_0x31f2a9['query']['sort']);_0x1d1cca[_0xbf1b('0x3a')]=qs[_0xbf1b('0x2f')](_[_0xbf1b('0x3b')](_0x31f2a9['query'],_0x274a70[_0xbf1b('0x2f')]),_0x167b42);if(_0x31f2a9[_0xbf1b('0x2d')][_0xbf1b('0x3c')]){_0x1d1cca[_0xbf1b('0x3a')]=_[_0xbf1b('0x3d')](_0x1d1cca['where'],{'$or':_['map'](_0x167b42,function(_0x37ac52){if(_0x37ac52['type']!=='VIRTUAL'){var _0x265a41={};_0x265a41[_0x37ac52[_0xbf1b('0x26')]]={'$like':'%'+_0x31f2a9['query'][_0xbf1b('0x3c')]+'%'};return _0x265a41;}})});}_0x1d1cca=_[_0xbf1b('0x3d')]({},_0x1d1cca,_0x31f2a9[_0xbf1b('0x3e')]);var _0x2e9c96={'where':_0x1d1cca[_0xbf1b('0x3a')]};return db[_0xbf1b('0x29')][_0xbf1b('0x1d')](_0x2e9c96)[_0xbf1b('0x23')](function(_0x4118f8){_0x1f02d7[_0xbf1b('0x1d')]=_0x4118f8;if(_0x31f2a9[_0xbf1b('0x2d')][_0xbf1b('0x3f')]){_0x1d1cca[_0xbf1b('0x40')]=[{'all':!![]}];}return db[_0xbf1b('0x29')][_0xbf1b('0x41')](_0x1d1cca);})[_0xbf1b('0x23')](function(_0x24abc8){_0x1f02d7['rows']=_0x24abc8;return _0x1f02d7;})[_0xbf1b('0x23')](respondWithFilteredResult(_0x70e3f9,_0x1d1cca))['catch'](handleError(_0x70e3f9,null));};exports[_0xbf1b('0x42')]=function(_0x2479b5,_0x56c0d4){var _0x5f1821={'raw':![],'where':{'id':_0x2479b5[_0xbf1b('0x43')]['id']}},_0x483f41={};_0x483f41[_0xbf1b('0x30')]=_['keys'](db['Team'][_0xbf1b('0x44')]);_0x483f41[_0xbf1b('0x2d')]=_[_0xbf1b('0x2e')](_0x2479b5[_0xbf1b('0x2d')]);_0x483f41[_0xbf1b('0x2f')]=_['intersection'](_0x483f41[_0xbf1b('0x30')],_0x483f41[_0xbf1b('0x2d')]);_0x5f1821[_0xbf1b('0x33')]=_[_0xbf1b('0x31')](_0x483f41[_0xbf1b('0x30')],qs[_0xbf1b('0x32')](_0x2479b5[_0xbf1b('0x2d')]['fields']));_0x5f1821[_0xbf1b('0x33')]=_0x5f1821[_0xbf1b('0x33')][_0xbf1b('0x34')]?_0x5f1821[_0xbf1b('0x33')]:_0x483f41['model'];if(_0x2479b5[_0xbf1b('0x2d')][_0xbf1b('0x3f')]){_0x5f1821[_0xbf1b('0x40')]=[{'all':!![]}];}_0x5f1821=_[_0xbf1b('0x3d')]({},_0x5f1821,_0x2479b5[_0xbf1b('0x3e')]);return db[_0xbf1b('0x29')][_0xbf1b('0x45')](_0x5f1821)[_0xbf1b('0x23')](handleEntityNotFound(_0x56c0d4,null))[_0xbf1b('0x23')](respondWithResult(_0x56c0d4,null))[_0xbf1b('0x46')](handleError(_0x56c0d4,null));};exports['create']=function(_0x447e57,_0x3c0fc1){return db['Team']['create'](_0x447e57[_0xbf1b('0x47')],{})['then'](function(_0x3fbd24){var _0x286cd5=_0x447e57[_0xbf1b('0x48')]['get']({'plain':!![]});if(!_0x286cd5)throw new Error(_0xbf1b('0x49'));if(_0x286cd5['role']===_0xbf1b('0x48')){var _0x42cd56=_0x3fbd24[_0xbf1b('0x4a')]({'plain':!![]});var _0x474ac1=_0xbf1b('0x4b');return db[_0xbf1b('0x4c')][_0xbf1b('0x45')]({'where':{'name':_0x474ac1,'userProfileId':_0x286cd5[_0xbf1b('0x4d')]},'raw':!![]})[_0xbf1b('0x23')](function(_0x4b4302){if(_0x4b4302&&_0x4b4302[_0xbf1b('0x4e')]===0x0){return db['UserProfileResource'][_0xbf1b('0x4f')]({'name':_0x42cd56['name'],'resourceId':_0x42cd56['id'],'type':_0x4b4302[_0xbf1b('0x26')],'sectionId':_0x4b4302['id']},{})[_0xbf1b('0x23')](function(){return _0x3fbd24;});}else{return _0x3fbd24;}})[_0xbf1b('0x46')](function(_0x399ce9){logger[_0xbf1b('0x24')](_0xbf1b('0x50'),_0x399ce9);throw _0x399ce9;});}return _0x3fbd24;})['then'](respondWithResult(_0x3c0fc1,0xc9))['catch'](handleError(_0x3c0fc1,null));};exports[_0xbf1b('0x22')]=function(_0x579bbf,_0x2a4478){if(_0x579bbf[_0xbf1b('0x47')]['id']){delete _0x579bbf['body']['id'];}return db[_0xbf1b('0x29')][_0xbf1b('0x45')]({'where':{'id':_0x579bbf[_0xbf1b('0x43')]['id']}})[_0xbf1b('0x23')](handleEntityNotFound(_0x2a4478,null))[_0xbf1b('0x23')](saveUpdates(_0x579bbf[_0xbf1b('0x47')],null))[_0xbf1b('0x23')](respondWithResult(_0x2a4478,null))[_0xbf1b('0x46')](handleError(_0x2a4478,null));};exports[_0xbf1b('0x51')]=function(_0x635d25,_0x36be29){var _0x25c2c1=_0x635d25['params']['id'];var _0x16ce41=[];return db[_0xbf1b('0x52')][_0xbf1b('0x53')](function(_0x290d49){var _0x4b1f78=_0xbf1b('0x54')+_0x25c2c1;return db[_0xbf1b('0x52')]['query'](_0x4b1f78,{'type':db['Sequelize'][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49})[_0xbf1b('0x23')](function(_0x55f684){_0x16ce41=_[_0xbf1b('0x2c')](_0x55f684,function(_0x39cdc3){return Number(_0x39cdc3[_0xbf1b('0x57')]);});})[_0xbf1b('0x23')](function(){var _0x2f8fb9=_0xbf1b('0x58')+_0x25c2c1;return db[_0xbf1b('0x52')][_0xbf1b('0x2d')](_0x2f8fb9,{'type':db['Sequelize'][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})[_0xbf1b('0x23')](function(_0x2c49f5){var _0xe8676f=_[_0xbf1b('0x2c')](_0x2c49f5,function(_0x382513){return Number(_0x382513[_0xbf1b('0x59')]);});return db[_0xbf1b('0x5a')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'VoiceQueueId':{'$in':_0xe8676f}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x21cf36=_0xbf1b('0x5b')+_0x25c2c1;return db[_0xbf1b('0x52')]['query'](_0x21cf36,{'type':db[_0xbf1b('0x5c')]['QueryTypes'][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})['then'](function(_0x5bd032){var _0x2ca43b=_[_0xbf1b('0x2c')](_0x5bd032,function(_0x47105f){return Number(_0x47105f[_0xbf1b('0x5d')]);});return db[_0xbf1b('0x5e')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'MailQueueId':{'$in':_0x2ca43b}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x3452c9=_0xbf1b('0x5f')+_0x25c2c1;return db[_0xbf1b('0x52')]['query'](_0x3452c9,{'type':db['Sequelize'][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})[_0xbf1b('0x23')](function(_0x2c307b){var _0x22fc3e=_[_0xbf1b('0x2c')](_0x2c307b,function(_0x8573b){return Number(_0x8573b[_0xbf1b('0x60')]);});return db[_0xbf1b('0x61')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'SmsQueueId':{'$in':_0x22fc3e}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x581037=_0xbf1b('0x62')+_0x25c2c1;return db[_0xbf1b('0x52')][_0xbf1b('0x2d')](_0x581037,{'type':db[_0xbf1b('0x5c')][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})['then'](function(_0x32415a){var _0x134565=_[_0xbf1b('0x2c')](_0x32415a,function(_0x11ed18){return Number(_0x11ed18['ChatQueueId']);});return db[_0xbf1b('0x63')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'ChatQueueId':{'$in':_0x134565}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x26cba5=_0xbf1b('0x64')+_0x25c2c1;return db[_0xbf1b('0x52')][_0xbf1b('0x2d')](_0x26cba5,{'type':db[_0xbf1b('0x5c')][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})['then'](function(_0x5bfc3b){var _0x97f9ce=_[_0xbf1b('0x2c')](_0x5bfc3b,function(_0x4ebbf5){return Number(_0x4ebbf5[_0xbf1b('0x65')]);});return db[_0xbf1b('0x66')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'FaxQueueId':{'$in':_0x97f9ce}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x3715f0=_0xbf1b('0x67')+_0x25c2c1;return db[_0xbf1b('0x52')]['query'](_0x3715f0,{'type':db[_0xbf1b('0x5c')][_0xbf1b('0x55')][_0xbf1b('0x56')],'raw':!![],'transaction':_0x290d49});})[_0xbf1b('0x23')](function(_0x5c5126){var _0x276a09=_[_0xbf1b('0x2c')](_0x5c5126,function(_0x4f961c){return Number(_0x4f961c[_0xbf1b('0x68')]);});return db[_0xbf1b('0x69')][_0xbf1b('0x51')]({'where':{'UserId':{'$in':_0x16ce41},'OpenchannelQueueId':{'$in':_0x276a09}},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){var _0x12049c=_0xbf1b('0x6a')+_0x25c2c1;return db[_0xbf1b('0x52')][_0xbf1b('0x2d')](_0x12049c,{'type':db[_0xbf1b('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x290d49});})[_0xbf1b('0x23')](function(_0x4f479c){var _0x346c20=_[_0xbf1b('0x2c')](_0x4f479c,function(_0x590cd7){return Number(_0x590cd7['WhatsappQueueId']);});return db[_0xbf1b('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x16ce41},'WhatsappQueueId':{'$in':_0x346c20}},'transaction':_0x290d49});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x25c2c1}});})[_0xbf1b('0x23')](function(_0x2952a0){if(_0x2952a0===null){return;}return db[_0xbf1b('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x16ce41},'VoicePrefixId':_0x2952a0[_0xbf1b('0x6d')]},'transaction':_0x290d49});})[_0xbf1b('0x23')](function(){return db[_0xbf1b('0x29')][_0xbf1b('0x51')]({'where':{'id':_0x25c2c1},'cascade':!![],'transaction':_0x290d49});})[_0xbf1b('0x23')](function(_0x3cf5da){if(_0x3cf5da===0x0){_0x36be29[_0xbf1b('0x17')](0x194);}else{return db[_0xbf1b('0x6e')]['destroy']({'where':{'type':_0xbf1b('0x4b'),'resourceId':_0x25c2c1},'cascade':!![],'transaction':_0x290d49})[_0xbf1b('0x23')](function(){_0x36be29['status'](0xcc)[_0xbf1b('0x19')]();});}})[_0xbf1b('0x46')](function(_0x21b919){_0x36be29['status'](0x1f4)['send'](_0x21b919);});});};exports[_0xbf1b('0x6f')]=function(_0x407d5a,_0x41ba58,_0x2c248c){return db[_0xbf1b('0x29')][_0xbf1b('0x70')]({'where':{'id':_0x407d5a['params']['id']}})[_0xbf1b('0x23')](handleEntityNotFound(_0x41ba58,null))[_0xbf1b('0x23')](function(_0x3f36b6){if(!_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x71')]||!utils['isValidChannel'](_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x71')])){throw new db[(_0xbf1b('0x5c'))][(_0xbf1b('0x72'))]('Unknown\x20channel');}var _0x643f57={};var _0x14bd7d={};_0x14bd7d['model']=_['keys'](db[_[_0xbf1b('0x73')](_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x71')]['toLowerCase']())+_0xbf1b('0x74')][_0xbf1b('0x44')]);_0x14bd7d[_0xbf1b('0x2d')]=_[_0xbf1b('0x2e')](_0x407d5a[_0xbf1b('0x2d')]);_0x14bd7d['filters']=_[_0xbf1b('0x31')](_0x14bd7d['model'],_0x14bd7d[_0xbf1b('0x2d')]);_0x643f57[_0xbf1b('0x33')]=_[_0xbf1b('0x31')](_0x14bd7d[_0xbf1b('0x30')],qs[_0xbf1b('0x32')](_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x32')]));_0x643f57[_0xbf1b('0x33')]=_0x643f57['attributes'][_0xbf1b('0x34')]?_0x643f57[_0xbf1b('0x33')]:_0x14bd7d[_0xbf1b('0x30')];_0x643f57['limit']=qs['limit'](_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x37')]);_0x643f57[_0xbf1b('0x1b')]=qs[_0xbf1b('0x1b')](_0x407d5a[_0xbf1b('0x2d')][_0xbf1b('0x1b')]);_0x643f57[_0xbf1b('0x38')]=qs[_0xbf1b('0x39')](_0x407d5a['query'][_0xbf1b('0x39')]);_0x643f57[_0xbf1b('0x3a')]=qs[_0xbf1b('0x2f')](_[_0xbf1b('0x3b')](_0x407d5a['query'],_0x14bd7d['filters']));_0x643f57=_[_0xbf1b('0x3d')]({},_0x643f57,_0x407d5a[_0xbf1b('0x3e')]);return _0x3f36b6[_0xbf1b('0x4a')+_[_0xbf1b('0x73')](_0x407d5a['query'][_0xbf1b('0x71')][_0xbf1b('0x75')]())+_0xbf1b('0x76')](_0x643f57);})[_0xbf1b('0x23')](respondWithResult(_0x41ba58,null))[_0xbf1b('0x46')](handleError(_0x41ba58,null));};exports[_0xbf1b('0x77')]=function(_0x5cd6c3,_0x8f09c4,_0x4f775a){return db['Team'][_0xbf1b('0x70')]({'where':{'id':_0x5cd6c3['params']['id']}})[_0xbf1b('0x23')](function(_0xa86410){if(_0xa86410){if(!_0x5cd6c3['body'][_0xbf1b('0x71')]||!utils[_0xbf1b('0x78')](_0x5cd6c3[_0xbf1b('0x47')][_0xbf1b('0x71')])){throw new db[(_0xbf1b('0x5c'))][(_0xbf1b('0x72'))](_0xbf1b('0x79'));}return _0xa86410[_0xbf1b('0x7a')+_[_0xbf1b('0x73')](_0x5cd6c3[_0xbf1b('0x47')][_0xbf1b('0x71')][_0xbf1b('0x75')]())+_0xbf1b('0x76')](_0x5cd6c3[_0xbf1b('0x47')][_0xbf1b('0x7b')]);}return null;})[_0xbf1b('0x23')](handleEntityNotFound(_0x8f09c4,null))['then'](respondWithStatusCode(_0x8f09c4,null))[_0xbf1b('0x46')](handleError(_0x8f09c4,null));};exports[_0xbf1b('0x7c')]=function(_0x5619eb,_0x965288,_0x34a8df){return db[_0xbf1b('0x29')][_0xbf1b('0x70')]({'where':{'id':_0x5619eb[_0xbf1b('0x43')]['id']}})['then'](function(_0xe974cd){if(_0xe974cd){if(!_0x5619eb['query'][_0xbf1b('0x71')]||!utils[_0xbf1b('0x78')](_0x5619eb[_0xbf1b('0x2d')]['channel'])){throw new db[(_0xbf1b('0x5c'))][(_0xbf1b('0x72'))](_0xbf1b('0x79'));}return _0xe974cd[_0xbf1b('0x7d')+_[_0xbf1b('0x73')](_0x5619eb[_0xbf1b('0x2d')][_0xbf1b('0x71')][_0xbf1b('0x75')]())+_0xbf1b('0x76')](_0x5619eb[_0xbf1b('0x2d')][_0xbf1b('0x7b')]);}return null;})[_0xbf1b('0x23')](handleEntityNotFound(_0x965288,null))[_0xbf1b('0x23')](respondWithStatusCode(_0x965288,null))[_0xbf1b('0x46')](handleError(_0x965288,null));};exports[_0xbf1b('0x7e')]=function(_0x2d1c83,_0x594ba0){var _0x684f6f=_[_0xbf1b('0x7f')](_0x2d1c83[_0xbf1b('0x47')][_0xbf1b('0x7b')])?_0x2d1c83['body']['ids']:[_0x2d1c83[_0xbf1b('0x47')][_0xbf1b('0x7b')]];var _0x4a596d=_0x2d1c83['params']['id'];return db[_0xbf1b('0x29')][_0xbf1b('0x45')]({'where':{'id':_0x4a596d}})[_0xbf1b('0x23')](handleEntityNotFound(_0x594ba0,null))['then'](function(_0x5997eb){if(_0x5997eb){var _0x1bd572=[_0xbf1b('0x80'),'Chat',_0xbf1b('0x81'),_0xbf1b('0x82'),_0xbf1b('0x83'),'Openchannel','Whatsapp'];return db[_0xbf1b('0x52')][_0xbf1b('0x53')](function(_0x4343ff){var _0x4db250=_[_0xbf1b('0x2c')](_0x1bd572,function(_0x1f6769){var _0x4091de={'attributes':['id',_0xbf1b('0x26')]};if(_0x1f6769===_0xbf1b('0x80')){_0x4091de['through']={'attributes':[_0xbf1b('0x84')]};}return _0x5997eb['get'+_0x1f6769+_0xbf1b('0x76')](_0x4091de)[_0xbf1b('0x23')](function(_0x497335){var _0x4257b0=_[_0xbf1b('0x2c')](_0x497335,function(_0x21cd6f){var _0x2ccf05=_['map'](_0x684f6f,function(_0x3b445f){var _0x43bf6b={'where':{'UserId':_0x3b445f,[_0x1f6769+_0xbf1b('0x85')]:_0x21cd6f['id']},'transaction':_0x4343ff};if(_0x1f6769===_0xbf1b('0x80')){_0x43bf6b[_0xbf1b('0x86')]={'penalty':_0x21cd6f[_0xbf1b('0x87')][_0xbf1b('0x84')]};}return db[_0xbf1b('0x88')+_0x1f6769+'Queue']['findOrCreate'](_0x43bf6b)[_0xbf1b('0x23')](function(){socket[_0xbf1b('0x89')](_0xbf1b('0x48')+_0x1f6769+'Queue:save',{'UserId':_0x3b445f,[_0x1f6769+_0xbf1b('0x85')]:_0x21cd6f['id']});if(_0x1f6769!=='Voice'){return;}return db[_0xbf1b('0x88')][_0xbf1b('0x41')]({'where':{'id':_0x684f6f,'online':0x1},'attributes':['id','name',_0xbf1b('0x8a'),_0xbf1b('0x8b'),_0xbf1b('0x8c')],'raw':!![]})['then'](function(_0xcb2c06){var _0x53b5d1=_[_0xbf1b('0x2c')](_0xcb2c06,function(_0x2a0ec7){return db['UserVoiceQueueRt'][_0xbf1b('0x8d')]({'membername':_0x2a0ec7[_0xbf1b('0x26')],'UserId':_0x2a0ec7['id'],'queue_name':_0x21cd6f['name'],'VoiceQueueId':_0x21cd6f['id'],'interface':_['isNil'](_0x2a0ec7[_0xbf1b('0x8c')])?util[_0xbf1b('0x8e')](_0xbf1b('0x8f'),_0x2a0ec7[_0xbf1b('0x26')]):_0x2a0ec7[_0xbf1b('0x8c')],'paused':_0x2a0ec7[_0xbf1b('0x8b')]||![],'penalty':_0x21cd6f['TeamVoiceQueue'][_0xbf1b('0x84')]},{'transaction':_0x4343ff});});return Promise[_0xbf1b('0x90')](_0x53b5d1);});});});return Promise[_0xbf1b('0x90')](_0x2ccf05);});return Promise[_0xbf1b('0x90')](_0x4257b0);})[_0xbf1b('0x23')](function(){return db['TeamVoicePrefix'][_0xbf1b('0x70')]({'where':{'teamId':_0x4a596d}})['then'](function(_0x9b907b){if(_0x9b907b){var _0x3ea38b=_['map'](_0x684f6f,function(_0x457975){db[_0xbf1b('0x6c')][_0xbf1b('0x8d')]({'UserId':_0x457975,'VoicePrefixId':_0x9b907b['VoicePrefixId']});});return Promise[_0xbf1b('0x90')](_0x3ea38b);}});});});return Promise[_0xbf1b('0x90')](_0x4db250)['then'](function(){return _0x5997eb['addAgents'](_0x684f6f,{'transaction':_0x4343ff})[_0xbf1b('0x91')](function(_0x3b2f3b){return _0x3b2f3b;});});});}})[_0xbf1b('0x23')](respondWithResult(_0x594ba0,null))[_0xbf1b('0x46')](handleError(_0x594ba0,null));};exports[_0xbf1b('0x92')]=function(_0xa69120,_0x4d2dc6){var _0x3b0de5=_[_0xbf1b('0x7f')](_0xa69120['query'][_0xbf1b('0x7b')])?_0xa69120['query'][_0xbf1b('0x7b')]:[_0xa69120[_0xbf1b('0x2d')]['ids']];var _0x17e723=_0xa69120[_0xbf1b('0x43')]['id'];return db[_0xbf1b('0x29')]['find']({'where':{'id':_0x17e723}})[_0xbf1b('0x23')](handleEntityNotFound(_0x4d2dc6,null))[_0xbf1b('0x23')](function(_0x17a872){if(_0x17a872){var _0x99fa8c=[_0xbf1b('0x80'),'Chat',_0xbf1b('0x81'),_0xbf1b('0x82'),_0xbf1b('0x83'),_0xbf1b('0x93'),_0xbf1b('0x94')];return db[_0xbf1b('0x52')][_0xbf1b('0x53')](function(_0x5710bf){var _0x137e89=_[_0xbf1b('0x2c')](_0x99fa8c,function(_0x98bdd4){var _0xda6e6e={'attributes':['id',_0xbf1b('0x26')]};return _0x17a872[_0xbf1b('0x4a')+_0x98bdd4+_0xbf1b('0x76')](_0xda6e6e)[_0xbf1b('0x23')](function(_0x53d39a){var _0x152ae0=_[_0xbf1b('0x2c')](_0x53d39a,function(_0xc6a25e){return _0xc6a25e['removeAgents'](_0x3b0de5,{'transaction':_0x5710bf})['then'](function(){var _0x5824ea=_[_0xbf1b('0x2c')](_0x3b0de5,function(_0x2bc0f9){socket[_0xbf1b('0x89')](_0xbf1b('0x48')+_0x98bdd4+_0xbf1b('0x95'),{'UserId':Number(_0x2bc0f9),[_0x98bdd4+_0xbf1b('0x85')]:_0xc6a25e['id']});if(_0x98bdd4!==_0xbf1b('0x80')){return;}return db['UserVoiceQueueRt'][_0xbf1b('0x51')]({'where':{'VoiceQueueId':_0xc6a25e['id'],'UserId':_0x2bc0f9},'transaction':_0x5710bf});});return Promise[_0xbf1b('0x90')](_0x5824ea);});});return Promise[_0xbf1b('0x90')](_0x152ae0);});});return Promise[_0xbf1b('0x90')](_0x137e89)[_0xbf1b('0x23')](function(){return _0x17a872[_0xbf1b('0x92')](_0x3b0de5,{'transaction':_0x5710bf});})['then'](function(){return db[_0xbf1b('0x96')][_0xbf1b('0x70')]({'where':{'teamId':_0x17e723}})[_0xbf1b('0x23')](function(_0x345863){if(_0x345863){var _0x31b05d=_[_0xbf1b('0x2c')](_0x3b0de5,function(_0x4197e0){db[_0xbf1b('0x6c')]['destroy']({'where':{'UserId':_0x4197e0,'VoicePrefixId':_0x345863[_0xbf1b('0x6d')]}});});return Promise[_0xbf1b('0x90')](_0x31b05d);}});});});}})[_0xbf1b('0x23')](respondWithStatusCode(_0x4d2dc6,null))[_0xbf1b('0x46')](handleError(_0x4d2dc6,null));};exports[_0xbf1b('0x97')]=function(_0x278857,_0x213f6b,_0x168d38){var _0x54392f={};var _0x58a062={};var _0x5d5b09;var _0x47f398;return db[_0xbf1b('0x29')][_0xbf1b('0x70')]({'where':{'id':_0x278857['params']['id']}})[_0xbf1b('0x23')](handleEntityNotFound(_0x213f6b,null))[_0xbf1b('0x23')](function(_0xf5faa8){if(_0xf5faa8){_0x5d5b09=_0xf5faa8;_0x58a062[_0xbf1b('0x30')]=_[_0xbf1b('0x2e')](db[_0xbf1b('0x88')][_0xbf1b('0x44')]);_0x58a062[_0xbf1b('0x2d')]=_['keys'](_0x278857[_0xbf1b('0x2d')]);_0x58a062[_0xbf1b('0x2f')]=_[_0xbf1b('0x31')](_0x58a062[_0xbf1b('0x30')],_0x58a062[_0xbf1b('0x2d')]);_0x54392f[_0xbf1b('0x33')]=_[_0xbf1b('0x31')](_0x58a062['model'],qs['fields'](_0x278857[_0xbf1b('0x2d')][_0xbf1b('0x32')]));_0x54392f[_0xbf1b('0x33')]=_0x54392f[_0xbf1b('0x33')][_0xbf1b('0x34')]?_0x54392f[_0xbf1b('0x33')]:_0x58a062[_0xbf1b('0x30')];_0x54392f[_0xbf1b('0x38')]=qs[_0xbf1b('0x39')](_0x278857[_0xbf1b('0x2d')]['sort']);_0x54392f[_0xbf1b('0x3a')]=qs[_0xbf1b('0x2f')](_[_0xbf1b('0x3b')](_0x278857['query'],_0x58a062[_0xbf1b('0x2f')]));if(_0x278857['query'][_0xbf1b('0x3c')]){_0x54392f['where']=_[_0xbf1b('0x3d')](_0x54392f[_0xbf1b('0x3a')],{'$or':_[_0xbf1b('0x2c')](_0x54392f[_0xbf1b('0x33')],function(_0x1093a3){var _0x185a8b={};_0x185a8b[_0x1093a3]={'$like':'%'+_0x278857[_0xbf1b('0x2d')][_0xbf1b('0x3c')]+'%'};return _0x185a8b;})});}_0x54392f=_[_0xbf1b('0x3d')]({},_0x54392f,_0x278857['options']);return _0x5d5b09['getAgents'](_0x54392f);}})[_0xbf1b('0x23')](function(_0x975bad){if(_0x975bad){_0x47f398=_0x975bad[_0xbf1b('0x34')];if(!_0x278857[_0xbf1b('0x2d')][_0xbf1b('0x35')](_0xbf1b('0x36'))){_0x54392f[_0xbf1b('0x37')]=qs[_0xbf1b('0x37')](_0x278857[_0xbf1b('0x2d')]['limit']);_0x54392f['offset']=qs['offset'](_0x278857[_0xbf1b('0x2d')]['offset']);}return _0x5d5b09['getAgents'](_0x54392f);}})[_0xbf1b('0x23')](function(_0x118edf){if(_0x118edf){return _0x118edf?{'count':_0x47f398,'rows':_0x118edf}:null;}})['then'](respondWithResult(_0x213f6b,null))[_0xbf1b('0x46')](handleError(_0x213f6b,null));}; \ No newline at end of file +var _0xf3d8=['Queue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','error','name','index','map','Team','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','through','TeamVoiceQueue','findOrCreate','emit','Queue:save','QueueId','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','penalty','all','spread','removeAgents'];(function(_0x49364e,_0x11d105){var _0xb49084=function(_0x4d3c74){while(--_0x4d3c74){_0x49364e['push'](_0x49364e['shift']());}};_0xb49084(++_0x11d105);}(_0xf3d8,0x9e));var _0x8f3d=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xf3d8[_0x1e03a6];return _0x295b64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f3d('0x0'));var zipdir=require(_0x8f3d('0x1'));var jsonpatch=require(_0x8f3d('0x2'));var rp=require(_0x8f3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8f3d('0x4'));var ejs=require(_0x8f3d('0x5'));var fs=require('fs');var fs_extra=require(_0x8f3d('0x6'));var _=require(_0x8f3d('0x7'));var squel=require(_0x8f3d('0x8'));var crypto=require(_0x8f3d('0x9'));var jsforce=require(_0x8f3d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8f3d('0x4'));var querystring=require('querystring');var Papa=require(_0x8f3d('0xb'));var Redis=require(_0x8f3d('0xc'));var authService=require(_0x8f3d('0xd'));var qs=require(_0x8f3d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f3d('0xf'))(_0x8f3d('0x10'));var utils=require(_0x8f3d('0x11'));var config=require(_0x8f3d('0x12'));var licenseUtil=require(_0x8f3d('0x13'));var db=require(_0x8f3d('0x14'))['db'];config[_0x8f3d('0x15')]=_[_0x8f3d('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8f3d('0x17'))(new Redis(config['redis']));require(_0x8f3d('0x18'))[_0x8f3d('0x19')](socket);function respondWithStatusCode(_0x32ac5f,_0x3fb07a){_0x3fb07a=_0x3fb07a||0xcc;return function(_0x5e22c8){if(_0x5e22c8){return _0x32ac5f[_0x8f3d('0x1a')](_0x3fb07a);}return _0x32ac5f[_0x8f3d('0x1b')](_0x3fb07a)[_0x8f3d('0x1c')]();};}function respondWithResult(_0x2cf582,_0xa2dd05){_0xa2dd05=_0xa2dd05||0xc8;return function(_0x31004d){if(_0x31004d){return _0x2cf582[_0x8f3d('0x1b')](_0xa2dd05)[_0x8f3d('0x1d')](_0x31004d);}};}function respondWithFilteredResult(_0x90dce2,_0x3a010a){return function(_0x4b12db){if(_0x4b12db){var _0x54e63f=typeof _0x3a010a[_0x8f3d('0x1e')]==='undefined'&&typeof _0x3a010a[_0x8f3d('0x1f')]===_0x8f3d('0x20');var _0x30d05c=_0x4b12db['count'];var _0x1ec802=_0x54e63f?0x0:_0x3a010a[_0x8f3d('0x1e')];var _0x1b27b6=_0x54e63f?_0x4b12db[_0x8f3d('0x21')]:_0x3a010a['offset']+_0x3a010a[_0x8f3d('0x1f')];var _0x13002e;if(_0x1b27b6>=_0x30d05c){_0x1b27b6=_0x30d05c;_0x13002e=0xc8;}else{_0x13002e=0xce;}_0x90dce2[_0x8f3d('0x1b')](_0x13002e);return _0x90dce2[_0x8f3d('0x22')]('Content-Range',_0x1ec802+'-'+_0x1b27b6+'/'+_0x30d05c)[_0x8f3d('0x1d')](_0x4b12db);}return null;};}function patchUpdates(_0x8af69b){return function(_0x308a23){try{jsonpatch[_0x8f3d('0x23')](_0x308a23,_0x8af69b,!![]);}catch(_0x1e70c1){return BPromise['reject'](_0x1e70c1);}return _0x308a23[_0x8f3d('0x24')]();};}function saveUpdates(_0x226ce1,_0x23cb30){return function(_0x335e39){if(_0x335e39){return _0x335e39[_0x8f3d('0x25')](_0x226ce1)[_0x8f3d('0x26')](function(_0x27a39d){return _0x27a39d;});}return null;};}function handleEntityNotFound(_0x40e163,_0x2b15f8){return function(_0x184eed){if(!_0x184eed){_0x40e163['sendStatus'](0x194);}return _0x184eed;};}function handleError(_0x2bb440,_0x2ffa71){_0x2ffa71=_0x2ffa71||0x1f4;return function(_0xf6ac34){logger[_0x8f3d('0x27')](_0xf6ac34['stack']);if(_0xf6ac34[_0x8f3d('0x28')]){delete _0xf6ac34[_0x8f3d('0x28')];}_0x2bb440['status'](_0x2ffa71)['send'](_0xf6ac34);};}exports[_0x8f3d('0x29')]=function(_0x29f469,_0x1c36ba){var _0x5a17de={},_0xeed604={},_0x4c4bce={'count':0x0,'rows':[]};var _0x4704e7=_[_0x8f3d('0x2a')](db[_0x8f3d('0x2b')][_0x8f3d('0x2c')],function(_0x5a5092){return{'name':_0x5a5092['fieldName'],'type':_0x5a5092['type'][_0x8f3d('0x2d')]};});_0xeed604[_0x8f3d('0x2e')]=_[_0x8f3d('0x2a')](_0x4704e7,_0x8f3d('0x28'));_0xeed604[_0x8f3d('0x2f')]=_[_0x8f3d('0x30')](_0x29f469[_0x8f3d('0x2f')]);_0xeed604[_0x8f3d('0x31')]=_[_0x8f3d('0x32')](_0xeed604[_0x8f3d('0x2e')],_0xeed604[_0x8f3d('0x2f')]);_0x5a17de[_0x8f3d('0x33')]=_[_0x8f3d('0x32')](_0xeed604[_0x8f3d('0x2e')],qs['fields'](_0x29f469['query'][_0x8f3d('0x34')]));_0x5a17de['attributes']=_0x5a17de['attributes'][_0x8f3d('0x35')]?_0x5a17de[_0x8f3d('0x33')]:_0xeed604[_0x8f3d('0x2e')];if(!_0x29f469[_0x8f3d('0x2f')]['hasOwnProperty'](_0x8f3d('0x36'))){_0x5a17de[_0x8f3d('0x1f')]=qs[_0x8f3d('0x1f')](_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x1f')]);_0x5a17de[_0x8f3d('0x1e')]=qs[_0x8f3d('0x1e')](_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x1e')]);}_0x5a17de[_0x8f3d('0x37')]=qs['sort'](_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x38')]);_0x5a17de[_0x8f3d('0x39')]=qs['filters'](_[_0x8f3d('0x3a')](_0x29f469[_0x8f3d('0x2f')],_0xeed604['filters']),_0x4704e7);if(_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x3b')]){_0x5a17de[_0x8f3d('0x39')]=_[_0x8f3d('0x3c')](_0x5a17de[_0x8f3d('0x39')],{'$or':_['map'](_0x4704e7,function(_0x8d7218){if(_0x8d7218[_0x8f3d('0x3d')]!=='VIRTUAL'){var _0x4c2f4c={};_0x4c2f4c[_0x8d7218['name']]={'$like':'%'+_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x3b')]+'%'};return _0x4c2f4c;}})});}_0x5a17de=_[_0x8f3d('0x3c')]({},_0x5a17de,_0x29f469[_0x8f3d('0x3e')]);var _0x279ed4={'where':_0x5a17de[_0x8f3d('0x39')]};return db[_0x8f3d('0x2b')][_0x8f3d('0x21')](_0x279ed4)[_0x8f3d('0x26')](function(_0x2b990f){_0x4c4bce[_0x8f3d('0x21')]=_0x2b990f;if(_0x29f469[_0x8f3d('0x2f')][_0x8f3d('0x3f')]){_0x5a17de[_0x8f3d('0x40')]=[{'all':!![]}];}return db['Team'][_0x8f3d('0x41')](_0x5a17de);})[_0x8f3d('0x26')](function(_0x1c1797){_0x4c4bce[_0x8f3d('0x42')]=_0x1c1797;return _0x4c4bce;})[_0x8f3d('0x26')](respondWithFilteredResult(_0x1c36ba,_0x5a17de))['catch'](handleError(_0x1c36ba,null));};exports[_0x8f3d('0x43')]=function(_0x1d2dc6,_0x428aeb){var _0xe5ff62={'raw':![],'where':{'id':_0x1d2dc6[_0x8f3d('0x44')]['id']}},_0xca00f1={};_0xca00f1[_0x8f3d('0x2e')]=_[_0x8f3d('0x30')](db[_0x8f3d('0x2b')][_0x8f3d('0x2c')]);_0xca00f1['query']=_['keys'](_0x1d2dc6[_0x8f3d('0x2f')]);_0xca00f1[_0x8f3d('0x31')]=_[_0x8f3d('0x32')](_0xca00f1[_0x8f3d('0x2e')],_0xca00f1['query']);_0xe5ff62[_0x8f3d('0x33')]=_[_0x8f3d('0x32')](_0xca00f1[_0x8f3d('0x2e')],qs['fields'](_0x1d2dc6[_0x8f3d('0x2f')][_0x8f3d('0x34')]));_0xe5ff62[_0x8f3d('0x33')]=_0xe5ff62[_0x8f3d('0x33')][_0x8f3d('0x35')]?_0xe5ff62['attributes']:_0xca00f1['model'];if(_0x1d2dc6[_0x8f3d('0x2f')][_0x8f3d('0x3f')]){_0xe5ff62[_0x8f3d('0x40')]=[{'all':!![]}];}_0xe5ff62=_[_0x8f3d('0x3c')]({},_0xe5ff62,_0x1d2dc6[_0x8f3d('0x3e')]);return db['Team'][_0x8f3d('0x45')](_0xe5ff62)[_0x8f3d('0x26')](handleEntityNotFound(_0x428aeb,null))[_0x8f3d('0x26')](respondWithResult(_0x428aeb,null))[_0x8f3d('0x46')](handleError(_0x428aeb,null));};exports[_0x8f3d('0x47')]=function(_0x2700a6,_0x1c1f64){return db[_0x8f3d('0x2b')][_0x8f3d('0x47')](_0x2700a6['body'],{})[_0x8f3d('0x26')](function(_0x5a7b9b){var _0x2d3bd9=_0x2700a6[_0x8f3d('0x48')][_0x8f3d('0x49')]({'plain':!![]});if(!_0x2d3bd9)throw new Error(_0x8f3d('0x4a'));if(_0x2d3bd9[_0x8f3d('0x4b')]===_0x8f3d('0x48')){var _0x25d6fd=_0x5a7b9b['get']({'plain':!![]});var _0x20cc0d=_0x8f3d('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x20cc0d,'userProfileId':_0x2d3bd9[_0x8f3d('0x4d')]},'raw':!![]})[_0x8f3d('0x26')](function(_0x5a0d87){if(_0x5a0d87&&_0x5a0d87[_0x8f3d('0x4e')]===0x0){return db['UserProfileResource'][_0x8f3d('0x47')]({'name':_0x25d6fd[_0x8f3d('0x28')],'resourceId':_0x25d6fd['id'],'type':_0x5a0d87['name'],'sectionId':_0x5a0d87['id']},{})['then'](function(){return _0x5a7b9b;});}else{return _0x5a7b9b;}})[_0x8f3d('0x46')](function(_0x54f47a){logger[_0x8f3d('0x27')](_0x8f3d('0x4f'),_0x54f47a);throw _0x54f47a;});}return _0x5a7b9b;})[_0x8f3d('0x26')](respondWithResult(_0x1c1f64,0xc9))['catch'](handleError(_0x1c1f64,null));};exports[_0x8f3d('0x25')]=function(_0x2f3132,_0x4912ee){if(_0x2f3132[_0x8f3d('0x50')]['id']){delete _0x2f3132['body']['id'];}return db[_0x8f3d('0x2b')][_0x8f3d('0x45')]({'where':{'id':_0x2f3132[_0x8f3d('0x44')]['id']}})[_0x8f3d('0x26')](handleEntityNotFound(_0x4912ee,null))[_0x8f3d('0x26')](saveUpdates(_0x2f3132[_0x8f3d('0x50')],null))[_0x8f3d('0x26')](respondWithResult(_0x4912ee,null))['catch'](handleError(_0x4912ee,null));};exports[_0x8f3d('0x51')]=function(_0x15936a,_0xfb132a){var _0x593714=_0x15936a['params']['id'];var _0x2056dc=[];return db[_0x8f3d('0x52')]['transaction'](function(_0x43f4b3){var _0x529ef7=_0x8f3d('0x53')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x529ef7,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3})[_0x8f3d('0x26')](function(_0x11ba20){_0x2056dc=_[_0x8f3d('0x2a')](_0x11ba20,function(_0x1765c7){return Number(_0x1765c7[_0x8f3d('0x57')]);});})[_0x8f3d('0x26')](function(){var _0x1d6971=_0x8f3d('0x58')+_0x593714;return db[_0x8f3d('0x52')]['query'](_0x1d6971,{'type':db['Sequelize'][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})['then'](function(_0x45d164){var _0x3ff628=_['map'](_0x45d164,function(_0x2096ef){return Number(_0x2096ef[_0x8f3d('0x59')]);});return db['UserVoiceQueue'][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'VoiceQueueId':{'$in':_0x3ff628}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x22c7bb=_0x8f3d('0x5a')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x22c7bb,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(_0x12bf1e){var _0x26d17e=_['map'](_0x12bf1e,function(_0x35dbea){return Number(_0x35dbea[_0x8f3d('0x5b')]);});return db[_0x8f3d('0x5c')][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'MailQueueId':{'$in':_0x26d17e}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x229c9e=_0x8f3d('0x5d')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x229c9e,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})['then'](function(_0x84de3d){var _0x2f1bad=_[_0x8f3d('0x2a')](_0x84de3d,function(_0x5c18ed){return Number(_0x5c18ed['SmsQueueId']);});return db[_0x8f3d('0x5e')][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'SmsQueueId':{'$in':_0x2f1bad}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x21c344=_0x8f3d('0x5f')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x21c344,{'type':db['Sequelize']['QueryTypes'][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})['then'](function(_0x1dd2f3){var _0x1b7d2c=_[_0x8f3d('0x2a')](_0x1dd2f3,function(_0x58b6f5){return Number(_0x58b6f5[_0x8f3d('0x60')]);});return db[_0x8f3d('0x61')]['destroy']({'where':{'UserId':{'$in':_0x2056dc},'ChatQueueId':{'$in':_0x1b7d2c}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x23ed91=_0x8f3d('0x62')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x23ed91,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})['then'](function(_0x47598a){var _0x4709f2=_['map'](_0x47598a,function(_0x261893){return Number(_0x261893[_0x8f3d('0x63')]);});return db[_0x8f3d('0x64')][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'FaxQueueId':{'$in':_0x4709f2}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x4eb023=_0x8f3d('0x65')+_0x593714;return db[_0x8f3d('0x52')][_0x8f3d('0x2f')](_0x4eb023,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(_0xb7b71c){var _0x177e83=_['map'](_0xb7b71c,function(_0x24b350){return Number(_0x24b350[_0x8f3d('0x66')]);});return db[_0x8f3d('0x67')][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'OpenchannelQueueId':{'$in':_0x177e83}},'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(){var _0x4283f7=_0x8f3d('0x68')+_0x593714;return db[_0x8f3d('0x52')]['query'](_0x4283f7,{'type':db[_0x8f3d('0x54')][_0x8f3d('0x55')][_0x8f3d('0x56')],'raw':!![],'transaction':_0x43f4b3});})[_0x8f3d('0x26')](function(_0x1f06d2){var _0x274333=_[_0x8f3d('0x2a')](_0x1f06d2,function(_0x5ef671){return Number(_0x5ef671['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'WhatsappQueueId':{'$in':_0x274333}},'transaction':_0x43f4b3});})['then'](function(){return db[_0x8f3d('0x69')][_0x8f3d('0x45')]({'where':{'TeamId':_0x593714}});})[_0x8f3d('0x26')](function(_0xb610e){if(_0xb610e===null){return;}return db[_0x8f3d('0x6a')][_0x8f3d('0x51')]({'where':{'UserId':{'$in':_0x2056dc},'VoicePrefixId':_0xb610e[_0x8f3d('0x6b')]},'transaction':_0x43f4b3});})['then'](function(){return db['Team']['destroy']({'where':{'id':_0x593714},'cascade':!![],'transaction':_0x43f4b3});})['then'](function(_0x587914){if(_0x587914===0x0){_0xfb132a[_0x8f3d('0x1a')](0x194);}else{return db[_0x8f3d('0x6c')][_0x8f3d('0x51')]({'where':{'type':_0x8f3d('0x4c'),'resourceId':_0x593714},'cascade':!![],'transaction':_0x43f4b3})[_0x8f3d('0x26')](function(){_0xfb132a[_0x8f3d('0x1b')](0xcc)[_0x8f3d('0x1c')]();});}})[_0x8f3d('0x46')](function(_0x59af73){_0xfb132a['status'](0x1f4)[_0x8f3d('0x6d')](_0x59af73);});});};exports[_0x8f3d('0x6e')]=function(_0x4d7587,_0x2cc43c,_0x5c50d8){return db[_0x8f3d('0x2b')][_0x8f3d('0x6f')]({'where':{'id':_0x4d7587['params']['id']}})['then'](handleEntityNotFound(_0x2cc43c,null))[_0x8f3d('0x26')](function(_0x38b8e2){if(!_0x4d7587['query'][_0x8f3d('0x70')]||!utils['isValidChannel'](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x70')])){throw new db[(_0x8f3d('0x54'))][(_0x8f3d('0x71'))](_0x8f3d('0x72'));}var _0x1bc623={};var _0x56fd9c={};_0x56fd9c[_0x8f3d('0x2e')]=_[_0x8f3d('0x30')](db[_[_0x8f3d('0x73')](_0x4d7587['query'][_0x8f3d('0x70')][_0x8f3d('0x74')]())+_0x8f3d('0x75')][_0x8f3d('0x2c')]);_0x56fd9c[_0x8f3d('0x2f')]=_['keys'](_0x4d7587['query']);_0x56fd9c['filters']=_['intersection'](_0x56fd9c[_0x8f3d('0x2e')],_0x56fd9c[_0x8f3d('0x2f')]);_0x1bc623[_0x8f3d('0x33')]=_[_0x8f3d('0x32')](_0x56fd9c[_0x8f3d('0x2e')],qs[_0x8f3d('0x34')](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x34')]));_0x1bc623['attributes']=_0x1bc623[_0x8f3d('0x33')][_0x8f3d('0x35')]?_0x1bc623[_0x8f3d('0x33')]:_0x56fd9c[_0x8f3d('0x2e')];_0x1bc623['limit']=qs[_0x8f3d('0x1f')](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x1f')]);_0x1bc623[_0x8f3d('0x1e')]=qs[_0x8f3d('0x1e')](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x1e')]);_0x1bc623['order']=qs['sort'](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x38')]);_0x1bc623[_0x8f3d('0x39')]=qs['filters'](_[_0x8f3d('0x3a')](_0x4d7587[_0x8f3d('0x2f')],_0x56fd9c[_0x8f3d('0x31')]));_0x1bc623=_['merge']({},_0x1bc623,_0x4d7587[_0x8f3d('0x3e')]);return _0x38b8e2[_0x8f3d('0x49')+_[_0x8f3d('0x73')](_0x4d7587[_0x8f3d('0x2f')][_0x8f3d('0x70')][_0x8f3d('0x74')]())+_0x8f3d('0x76')](_0x1bc623);})['then'](respondWithResult(_0x2cc43c,null))[_0x8f3d('0x46')](handleError(_0x2cc43c,null));};exports['addQueues']=function(_0x49ded3,_0x361141,_0x2840ad){return db['Team']['findOne']({'where':{'id':_0x49ded3[_0x8f3d('0x44')]['id']}})[_0x8f3d('0x26')](function(_0x501271){if(_0x501271){if(!_0x49ded3[_0x8f3d('0x50')][_0x8f3d('0x70')]||!utils[_0x8f3d('0x77')](_0x49ded3[_0x8f3d('0x50')][_0x8f3d('0x70')])){throw new db[(_0x8f3d('0x54'))][(_0x8f3d('0x71'))]('Unknown\x20channel');}return _0x501271[_0x8f3d('0x78')+_[_0x8f3d('0x73')](_0x49ded3['body']['channel'][_0x8f3d('0x74')]())+_0x8f3d('0x76')](_0x49ded3[_0x8f3d('0x50')][_0x8f3d('0x79')]);}return null;})[_0x8f3d('0x26')](handleEntityNotFound(_0x361141,null))[_0x8f3d('0x26')](respondWithStatusCode(_0x361141,null))[_0x8f3d('0x46')](handleError(_0x361141,null));};exports[_0x8f3d('0x7a')]=function(_0x516079,_0x473852,_0x44d4fe){return db[_0x8f3d('0x2b')][_0x8f3d('0x6f')]({'where':{'id':_0x516079[_0x8f3d('0x44')]['id']}})[_0x8f3d('0x26')](function(_0x3ebaee){if(_0x3ebaee){if(!_0x516079['query'][_0x8f3d('0x70')]||!utils[_0x8f3d('0x77')](_0x516079['query'][_0x8f3d('0x70')])){throw new db[(_0x8f3d('0x54'))][(_0x8f3d('0x71'))]('Unknown\x20channel');}return _0x3ebaee[_0x8f3d('0x7b')+_[_0x8f3d('0x73')](_0x516079['query']['channel'][_0x8f3d('0x74')]())+'Queues'](_0x516079[_0x8f3d('0x2f')][_0x8f3d('0x79')]);}return null;})[_0x8f3d('0x26')](handleEntityNotFound(_0x473852,null))[_0x8f3d('0x26')](respondWithStatusCode(_0x473852,null))[_0x8f3d('0x46')](handleError(_0x473852,null));};exports[_0x8f3d('0x7c')]=function(_0x425216,_0x2b3d07){var _0x104feb=_[_0x8f3d('0x7d')](_0x425216[_0x8f3d('0x50')][_0x8f3d('0x79')])?_0x425216[_0x8f3d('0x50')][_0x8f3d('0x79')]:[_0x425216[_0x8f3d('0x50')][_0x8f3d('0x79')]];var _0x2a100e=_0x425216[_0x8f3d('0x44')]['id'];return db[_0x8f3d('0x2b')][_0x8f3d('0x45')]({'where':{'id':_0x2a100e}})[_0x8f3d('0x26')](handleEntityNotFound(_0x2b3d07,null))[_0x8f3d('0x26')](function(_0x242f4a){if(_0x242f4a){var _0x236224=[_0x8f3d('0x7e'),_0x8f3d('0x7f'),_0x8f3d('0x80'),_0x8f3d('0x81'),_0x8f3d('0x82'),'Openchannel',_0x8f3d('0x83')];return db[_0x8f3d('0x52')][_0x8f3d('0x84')](function(_0x4ec10d){var _0x26c9bc=_[_0x8f3d('0x2a')](_0x236224,function(_0x4bb027){var _0x4c957b={'attributes':['id',_0x8f3d('0x28')]};if(_0x4bb027===_0x8f3d('0x7e')){_0x4c957b[_0x8f3d('0x85')]={'attributes':['penalty']};}return _0x242f4a[_0x8f3d('0x49')+_0x4bb027+'Queues'](_0x4c957b)[_0x8f3d('0x26')](function(_0x444dd0){var _0x40485a=_['map'](_0x444dd0,function(_0x33165f){var _0xbd0299=_[_0x8f3d('0x2a')](_0x104feb,function(_0x5dff0b){var _0x51b763={'where':{'UserId':_0x5dff0b,[_0x4bb027+'QueueId']:_0x33165f['id']},'transaction':_0x4ec10d};if(_0x4bb027===_0x8f3d('0x7e')){_0x51b763[_0x8f3d('0x16')]={'penalty':_0x33165f[_0x8f3d('0x86')]['penalty']};}return db['User'+_0x4bb027+_0x8f3d('0x75')][_0x8f3d('0x87')](_0x51b763)[_0x8f3d('0x26')](function(){socket[_0x8f3d('0x88')](_0x8f3d('0x48')+_0x4bb027+_0x8f3d('0x89'),{'UserId':_0x5dff0b,[_0x4bb027+_0x8f3d('0x8a')]:_0x33165f['id']});if(_0x4bb027!==_0x8f3d('0x7e')){return;}return db[_0x8f3d('0x8b')][_0x8f3d('0x41')]({'where':{'id':_0x104feb,'online':0x1},'attributes':['id','name',_0x8f3d('0x8c'),_0x8f3d('0x8d'),_0x8f3d('0x8e')],'raw':!![]})[_0x8f3d('0x26')](function(_0x62de3b){var _0x8fe9ad=_[_0x8f3d('0x2a')](_0x62de3b,function(_0x3e6f0c){return db[_0x8f3d('0x8f')][_0x8f3d('0x90')]({'membername':_0x3e6f0c['name'],'UserId':_0x3e6f0c['id'],'queue_name':_0x33165f[_0x8f3d('0x28')],'VoiceQueueId':_0x33165f['id'],'interface':_[_0x8f3d('0x91')](_0x3e6f0c[_0x8f3d('0x8e')])?util[_0x8f3d('0x92')](_0x8f3d('0x93'),_0x3e6f0c[_0x8f3d('0x28')]):_0x3e6f0c[_0x8f3d('0x8e')],'paused':_0x3e6f0c[_0x8f3d('0x8d')]||![],'penalty':_0x33165f[_0x8f3d('0x86')][_0x8f3d('0x94')]},{'transaction':_0x4ec10d});});return Promise[_0x8f3d('0x95')](_0x8fe9ad);});});});return Promise[_0x8f3d('0x95')](_0xbd0299);});return Promise[_0x8f3d('0x95')](_0x40485a);})[_0x8f3d('0x26')](function(){return db['TeamVoicePrefix'][_0x8f3d('0x6f')]({'where':{'teamId':_0x2a100e}})[_0x8f3d('0x26')](function(_0x505885){if(_0x505885){var _0x50122d=_[_0x8f3d('0x2a')](_0x104feb,function(_0x4b0c69){db[_0x8f3d('0x6a')][_0x8f3d('0x90')]({'UserId':_0x4b0c69,'VoicePrefixId':_0x505885[_0x8f3d('0x6b')]});});return Promise[_0x8f3d('0x95')](_0x50122d);}});});});return Promise[_0x8f3d('0x95')](_0x26c9bc)[_0x8f3d('0x26')](function(){return _0x242f4a[_0x8f3d('0x7c')](_0x104feb,{'transaction':_0x4ec10d})[_0x8f3d('0x96')](function(_0x40cf0b){return _0x40cf0b;});});});}})[_0x8f3d('0x26')](respondWithResult(_0x2b3d07,null))[_0x8f3d('0x46')](handleError(_0x2b3d07,null));};exports['removeAgents']=function(_0x23a308,_0x4cd44e){var _0x5ee157=_[_0x8f3d('0x7d')](_0x23a308['query'][_0x8f3d('0x79')])?_0x23a308[_0x8f3d('0x2f')][_0x8f3d('0x79')]:[_0x23a308[_0x8f3d('0x2f')][_0x8f3d('0x79')]];var _0x2106d5=_0x23a308[_0x8f3d('0x44')]['id'];return db[_0x8f3d('0x2b')]['find']({'where':{'id':_0x2106d5}})[_0x8f3d('0x26')](handleEntityNotFound(_0x4cd44e,null))['then'](function(_0x222d45){if(_0x222d45){var _0x5776da=[_0x8f3d('0x7e'),_0x8f3d('0x7f'),_0x8f3d('0x80'),'Sms',_0x8f3d('0x82'),'Openchannel',_0x8f3d('0x83')];return db[_0x8f3d('0x52')][_0x8f3d('0x84')](function(_0x2a7ef8){var _0x150119=_[_0x8f3d('0x2a')](_0x5776da,function(_0x2d16b4){var _0xb26ae={'attributes':['id',_0x8f3d('0x28')]};return _0x222d45['get'+_0x2d16b4+_0x8f3d('0x76')](_0xb26ae)[_0x8f3d('0x26')](function(_0x271832){var _0x50052c=_[_0x8f3d('0x2a')](_0x271832,function(_0x521df9){return _0x521df9[_0x8f3d('0x97')](_0x5ee157,{'transaction':_0x2a7ef8})[_0x8f3d('0x26')](function(){var _0x4887fe=_[_0x8f3d('0x2a')](_0x5ee157,function(_0x1712c8){socket['emit']('user'+_0x2d16b4+_0x8f3d('0x98'),{'UserId':Number(_0x1712c8),[_0x2d16b4+_0x8f3d('0x8a')]:_0x521df9['id']});if(_0x2d16b4!==_0x8f3d('0x7e')){return;}return db[_0x8f3d('0x8f')][_0x8f3d('0x51')]({'where':{'VoiceQueueId':_0x521df9['id'],'UserId':_0x1712c8},'transaction':_0x2a7ef8});});return Promise[_0x8f3d('0x95')](_0x4887fe);});});return Promise['all'](_0x50052c);});});return Promise['all'](_0x150119)['then'](function(){return _0x222d45[_0x8f3d('0x97')](_0x5ee157,{'transaction':_0x2a7ef8});})[_0x8f3d('0x26')](function(){return db[_0x8f3d('0x69')][_0x8f3d('0x6f')]({'where':{'teamId':_0x2106d5}})[_0x8f3d('0x26')](function(_0x194829){if(_0x194829){var _0x5015c7=_['map'](_0x5ee157,function(_0x127c24){db[_0x8f3d('0x6a')][_0x8f3d('0x51')]({'where':{'UserId':_0x127c24,'VoicePrefixId':_0x194829[_0x8f3d('0x6b')]}});});return Promise[_0x8f3d('0x95')](_0x5015c7);}});});});}})['then'](respondWithStatusCode(_0x4cd44e,null))[_0x8f3d('0x46')](handleError(_0x4cd44e,null));};exports[_0x8f3d('0x99')]=function(_0x5b6873,_0xc659d6,_0x37debe){var _0x423911={};var _0x50328f={};var _0x5aee1b;var _0xef82ee;return db[_0x8f3d('0x2b')][_0x8f3d('0x6f')]({'where':{'id':_0x5b6873[_0x8f3d('0x44')]['id']}})['then'](handleEntityNotFound(_0xc659d6,null))[_0x8f3d('0x26')](function(_0x4d4e21){if(_0x4d4e21){_0x5aee1b=_0x4d4e21;_0x50328f['model']=_[_0x8f3d('0x30')](db['User']['rawAttributes']);_0x50328f['query']=_['keys'](_0x5b6873[_0x8f3d('0x2f')]);_0x50328f[_0x8f3d('0x31')]=_[_0x8f3d('0x32')](_0x50328f[_0x8f3d('0x2e')],_0x50328f[_0x8f3d('0x2f')]);_0x423911[_0x8f3d('0x33')]=_[_0x8f3d('0x32')](_0x50328f[_0x8f3d('0x2e')],qs['fields'](_0x5b6873[_0x8f3d('0x2f')][_0x8f3d('0x34')]));_0x423911[_0x8f3d('0x33')]=_0x423911['attributes'][_0x8f3d('0x35')]?_0x423911[_0x8f3d('0x33')]:_0x50328f[_0x8f3d('0x2e')];_0x423911[_0x8f3d('0x37')]=qs['sort'](_0x5b6873['query'][_0x8f3d('0x38')]);_0x423911[_0x8f3d('0x39')]=qs[_0x8f3d('0x31')](_[_0x8f3d('0x3a')](_0x5b6873[_0x8f3d('0x2f')],_0x50328f['filters']));if(_0x5b6873[_0x8f3d('0x2f')]['filter']){_0x423911[_0x8f3d('0x39')]=_[_0x8f3d('0x3c')](_0x423911[_0x8f3d('0x39')],{'$or':_[_0x8f3d('0x2a')](_0x423911[_0x8f3d('0x33')],function(_0xa625b1){var _0x47eacc={};_0x47eacc[_0xa625b1]={'$like':'%'+_0x5b6873[_0x8f3d('0x2f')][_0x8f3d('0x3b')]+'%'};return _0x47eacc;})});}_0x423911=_['merge']({},_0x423911,_0x5b6873[_0x8f3d('0x3e')]);return _0x5aee1b['getAgents'](_0x423911);}})[_0x8f3d('0x26')](function(_0x505628){if(_0x505628){_0xef82ee=_0x505628[_0x8f3d('0x35')];if(!_0x5b6873[_0x8f3d('0x2f')][_0x8f3d('0x9a')](_0x8f3d('0x36'))){_0x423911[_0x8f3d('0x1f')]=qs[_0x8f3d('0x1f')](_0x5b6873[_0x8f3d('0x2f')][_0x8f3d('0x1f')]);_0x423911[_0x8f3d('0x1e')]=qs['offset'](_0x5b6873[_0x8f3d('0x2f')][_0x8f3d('0x1e')]);}return _0x5aee1b[_0x8f3d('0x99')](_0x423911);}})['then'](function(_0x5ee83f){if(_0x5ee83f){return _0x5ee83f?{'count':_0xef82ee,'rows':_0x5ee83f}:null;}})[_0x8f3d('0x26')](respondWithResult(_0xc659d6,null))['catch'](handleError(_0xc659d6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a5213f5..f785652 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 _0xa414=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1bac9a,_0x2b1b38){var _0x27bb28=function(_0x1528ab){while(--_0x1528ab){_0x1bac9a['push'](_0x1bac9a['shift']());}};_0x27bb28(++_0x2b1b38);}(_0xa414,0xed));var _0x4a41=function(_0x56c71c,_0x4a20b3){_0x56c71c=_0x56c71c-0x0;var _0x641447=_0xa414[_0x56c71c];return _0x641447;};'use strict';var EventEmitter=require(_0x4a41('0x0'));var Team=require(_0x4a41('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x4a41('0x2')](0x0);var events={'afterCreate':_0x4a41('0x3'),'afterUpdate':_0x4a41('0x4'),'afterDestroy':_0x4a41('0x5')};function emitEvent(_0x545a1e){return function(_0x1acb05,_0x31843d,_0x2c4b66){TeamEvents['emit'](_0x545a1e+':'+_0x1acb05['id'],_0x1acb05);TeamEvents[_0x4a41('0x6')](_0x545a1e,_0x1acb05);_0x2c4b66(null);};}for(var e in events){if(events[_0x4a41('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x4a41('0x8')]=TeamEvents; \ No newline at end of file +var _0x1d18=['hasOwnProperty','hook','events','Team','setMaxListeners','remove','emit'];(function(_0x2e02ae,_0x4a4623){var _0x375a6b=function(_0x45c5b2){while(--_0x45c5b2){_0x2e02ae['push'](_0x2e02ae['shift']());}};_0x375a6b(++_0x4a4623);}(_0x1d18,0x105));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x81d1('0x0'));var Team=require('../../mysqldb')['db'][_0x81d1('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x81d1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81d1('0x3')};function emitEvent(_0x4e09d6){return function(_0x5c6357,_0x16c103,_0x4f170e){TeamEvents[_0x81d1('0x4')](_0x4e09d6+':'+_0x5c6357['id'],_0x5c6357);TeamEvents['emit'](_0x4e09d6,_0x5c6357);_0x4f170e(null);};}for(var e in events){if(events[_0x81d1('0x5')](e)){var event=events[e];Team[_0x81d1('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6e98cf3..d2741a6 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 _0xb2af=['./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x163521,_0x1df3f9){var _0x4ad928=function(_0x252e9c){while(--_0x252e9c){_0x163521['push'](_0x163521['shift']());}};_0x4ad928(++_0x1df3f9);}(_0xb2af,0x1f1));var _0xfb2a=function(_0x519918,_0x11cae5){_0x519918=_0x519918-0x0;var _0x21a327=_0xb2af[_0x519918];return _0x21a327;};'use strict';var _=require(_0xfb2a('0x0'));var util=require('util');var logger=require(_0xfb2a('0x1'))(_0xfb2a('0x2'));var moment=require('moment');var BPromise=require(_0xfb2a('0x3'));var rp=require(_0xfb2a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2a('0x5'));var config=require(_0xfb2a('0x6'));var attributes=require(_0xfb2a('0x7'));module[_0xfb2a('0x8')]=function(_0x12ca3e,_0x33be87){return _0x12ca3e[_0xfb2a('0x9')](_0xfb2a('0xa'),attributes,{'tableName':_0xfb2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a6=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe4a6,0x158));var _0x6e4a=function(_0x27f157,_0x5055df){_0x27f157=_0x27f157-0x0;var _0x3d765=_0xe4a6[_0x27f157];return _0x3d765;};'use strict';var _=require(_0x6e4a('0x0'));var util=require(_0x6e4a('0x1'));var logger=require(_0x6e4a('0x2'))(_0x6e4a('0x3'));var moment=require(_0x6e4a('0x4'));var BPromise=require(_0x6e4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e4a('0x6'));var rimraf=require('rimraf');var config=require(_0x6e4a('0x7'));var attributes=require(_0x6e4a('0x8'));module[_0x6e4a('0x9')]=function(_0x2cf793,_0x1999b9){return _0x2cf793[_0x6e4a('0xa')](_0x6e4a('0xb'),attributes,{'tableName':_0x6e4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5831bcd..3e3213e 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 _0x5a73=['rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./team.socket','register','then','info','request\x20sent','debug','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3795b9,_0xafee45){var _0x5c29fb=function(_0x739e60){while(--_0x739e60){_0x3795b9['push'](_0x3795b9['shift']());}};_0x5c29fb(++_0xafee45);}(_0x5a73,0x122));var _0x35a7=function(_0x34e330,_0x19c0a8){_0x34e330=_0x34e330-0x0;var _0x30a2fc=_0x5a73[_0x34e330];return _0x30a2fc;};'use strict';var _=require(_0x35a7('0x0'));var util=require(_0x35a7('0x1'));var moment=require(_0x35a7('0x2'));var BPromise=require(_0x35a7('0x3'));var rs=require(_0x35a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a7('0x5'));var logger=require(_0x35a7('0x6'))(_0x35a7('0x7'));var config=require(_0x35a7('0x8'));var jayson=require(_0x35a7('0x9'));var client=jayson['client'][_0x35a7('0xa')]({'port':0x232a});config['redis']=_[_0x35a7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35a7('0xc'))(new Redis(config[_0x35a7('0xd')]));require(_0x35a7('0xe'))[_0x35a7('0xf')](socket);function respondWithRpcPromise(_0x5b5a2c,_0x2acf0c,_0xf0c76c){return new BPromise(function(_0x533917,_0x32b7a7){return client['request'](_0x5b5a2c,_0xf0c76c)[_0x35a7('0x10')](function(_0x1259f5){logger[_0x35a7('0x11')]('Team,\x20%s,\x20%s',_0x2acf0c,_0x35a7('0x12'));logger[_0x35a7('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x2acf0c,'request\x20sent',JSON[_0x35a7('0x14')](_0x1259f5));if(_0x1259f5[_0x35a7('0x15')]){if(_0x1259f5[_0x35a7('0x15')][_0x35a7('0x16')]===0x1f4){logger[_0x35a7('0x15')]('Team,\x20%s,\x20%s',_0x2acf0c,_0x1259f5[_0x35a7('0x15')][_0x35a7('0x17')]);return _0x32b7a7(_0x1259f5['error']['message']);}logger[_0x35a7('0x15')]('Team,\x20%s,\x20%s',_0x2acf0c,_0x1259f5[_0x35a7('0x15')]['message']);return _0x533917(_0x1259f5['error'][_0x35a7('0x17')]);}else{logger[_0x35a7('0x11')](_0x35a7('0x18'),_0x2acf0c,_0x35a7('0x12'));_0x533917(_0x1259f5[_0x35a7('0x19')][_0x35a7('0x17')]);}})[_0x35a7('0x1a')](function(_0x1e6689){logger[_0x35a7('0x15')](_0x35a7('0x18'),_0x2acf0c,_0x1e6689);_0x32b7a7(_0x1e6689);});});} \ No newline at end of file +var _0x80b5=['register','request','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','socket.io-emitter','./team.socket'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x80b5,0x70));var _0x580b=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x80b5[_0x36d8d9];return _0x1ac3a2;};'use strict';var _=require('lodash');var util=require(_0x580b('0x0'));var moment=require(_0x580b('0x1'));var BPromise=require(_0x580b('0x2'));var rs=require(_0x580b('0x3'));var fs=require('fs');var Redis=require(_0x580b('0x4'));var db=require(_0x580b('0x5'))['db'];var utils=require(_0x580b('0x6'));var logger=require('../../config/logger')(_0x580b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x580b('0x8')]({'port':0x232a});config[_0x580b('0x9')]=_[_0x580b('0xa')](config[_0x580b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x580b('0xb'))(new Redis(config[_0x580b('0x9')]));require(_0x580b('0xc'))[_0x580b('0xd')](socket);function respondWithRpcPromise(_0x11ef05,_0x210b16,_0x1698bb){return new BPromise(function(_0x8804fc,_0x53bf0a){return client[_0x580b('0xe')](_0x11ef05,_0x1698bb)['then'](function(_0x41286a){logger[_0x580b('0xf')]('Team,\x20%s,\x20%s',_0x210b16,_0x580b('0x10'));logger[_0x580b('0x11')](_0x580b('0x12'),_0x210b16,_0x580b('0x10'),JSON[_0x580b('0x13')](_0x41286a));if(_0x41286a[_0x580b('0x14')]){if(_0x41286a['error'][_0x580b('0x15')]===0x1f4){logger[_0x580b('0x14')](_0x580b('0x16'),_0x210b16,_0x41286a[_0x580b('0x14')][_0x580b('0x17')]);return _0x53bf0a(_0x41286a[_0x580b('0x14')]['message']);}logger[_0x580b('0x14')](_0x580b('0x16'),_0x210b16,_0x41286a[_0x580b('0x14')]['message']);return _0x8804fc(_0x41286a[_0x580b('0x14')][_0x580b('0x17')]);}else{logger[_0x580b('0xf')]('Team,\x20%s,\x20%s',_0x210b16,'request\x20sent');_0x8804fc(_0x41286a['result'][_0x580b('0x17')]);}})[_0x580b('0x18')](function(_0x4c4a09){logger[_0x580b('0x14')](_0x580b('0x16'),_0x210b16,_0x4c4a09);_0x53bf0a(_0x4c4a09);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2a38002..342150e 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 _0xf5fe=['remove','update','emit','register','team:','./team.events','save'];(function(_0x39734d,_0x23ef32){var _0x64a781=function(_0x216b9e){while(--_0x216b9e){_0x39734d['push'](_0x39734d['shift']());}};_0x64a781(++_0x23ef32);}(_0xf5fe,0x1da));var _0xef5f=function(_0x23caf5,_0x25f497){_0x23caf5=_0x23caf5-0x0;var _0x34843a=_0xf5fe[_0x23caf5];return _0x34843a;};'use strict';var TeamEvents=require(_0xef5f('0x0'));var events=[_0xef5f('0x1'),_0xef5f('0x2'),_0xef5f('0x3')];function createListener(_0x1f97dd,_0x53d6e5){return function(_0x2183ba){_0x53d6e5[_0xef5f('0x4')](_0x1f97dd,_0x2183ba);};}function removeListener(_0xb47ede,_0x388497){return function(){TeamEvents['removeListener'](_0xb47ede,_0x388497);};}exports[_0xef5f('0x5')]=function(_0x254970){for(var _0x4bf0e6=0x0,_0x3e09e5=events['length'];_0x4bf0e6<_0x3e09e5;_0x4bf0e6++){var _0x4834d8=events[_0x4bf0e6];var _0xd47d67=createListener(_0xef5f('0x6')+_0x4834d8,_0x254970);TeamEvents['on'](_0x4834d8,_0xd47d67);}}; \ No newline at end of file +var _0x0f42=['./team.events','save','remove','update','emit','removeListener','register'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x0f42,0x126));var _0x20f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0f42[_0x126558];return _0x1f6d14;};'use strict';var TeamEvents=require(_0x20f4('0x0'));var events=[_0x20f4('0x1'),_0x20f4('0x2'),_0x20f4('0x3')];function createListener(_0x4e1c16,_0xb26f96){return function(_0x47a808){_0xb26f96[_0x20f4('0x4')](_0x4e1c16,_0x47a808);};}function removeListener(_0x4a2add,_0x1b1f1a){return function(){TeamEvents[_0x20f4('0x5')](_0x4a2add,_0x1b1f1a);};}exports[_0x20f4('0x6')]=function(_0x4c3214){for(var _0x435359=0x0,_0x1519fe=events['length'];_0x435359<_0x1519fe;_0x435359++){var _0x45adf6=events[_0x435359];var _0x553d5d=createListener('team:'+_0x45adf6,_0x4c3214);TeamEvents['on'](_0x45adf6,_0x553d5d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1eafb56..7633fc0 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 _0xfac4=['INTEGER'];(function(_0x38da9f,_0xe3d9bb){var _0x384494=function(_0x265884){while(--_0x265884){_0x38da9f['push'](_0x38da9f['shift']());}};_0x384494(++_0xe3d9bb);}(_0xfac4,0xb1));var _0x4fac=function(_0x3faa94,_0x16081b){_0x3faa94=_0x3faa94-0x0;var _0x4f3632=_0xfac4[_0x3faa94];return _0x4f3632;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x4fac('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x4fac('0x0')]}}; \ No newline at end of file +var _0x3098=['exports','INTEGER','sequelize'];(function(_0x5e10b2,_0x4f102a){var _0x317c37=function(_0x357d53){while(--_0x357d53){_0x5e10b2['push'](_0x5e10b2['shift']());}};_0x317c37(++_0x4f102a);}(_0x3098,0x86));var _0x8309=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x3098[_0x2ac5f8];return _0x3b8229;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'TeamId':{'type':Sequelize[_0x8309('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8309('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ba48d42..ad5b3c6 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 _0xa3db=['./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x50b76f,_0x3f0a4f){var _0x45b4fa=function(_0x4bb814){while(--_0x4bb814){_0x50b76f['push'](_0x50b76f['shift']());}};_0x45b4fa(++_0x3f0a4f);}(_0xa3db,0x10c));var _0xba3d=function(_0x18b0cf,_0x54ad9b){_0x18b0cf=_0x18b0cf-0x0;var _0x39e4ae=_0xa3db[_0x18b0cf];return _0x39e4ae;};'use strict';var _=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var logger=require(_0xba3d('0x2'))(_0xba3d('0x3'));var moment=require(_0xba3d('0x4'));var BPromise=require(_0xba3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba3d('0x6'));var config=require('../../config/environment');var attributes=require(_0xba3d('0x7'));module['exports']=function(_0x3f8f46,_0x12481b){return _0x3f8f46[_0xba3d('0x8')](_0xba3d('0x9'),attributes,{'tableName':_0xba3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe211=['bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','../../config/logger','moment'];(function(_0x2f0ab5,_0x428533){var _0xf0299b=function(_0x24ae1a){while(--_0x24ae1a){_0x2f0ab5['push'](_0x2f0ab5['shift']());}};_0xf0299b(++_0x428533);}(_0xe211,0x166));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e21('0x0'))('api');var moment=require(_0x1e21('0x1'));var BPromise=require(_0x1e21('0x2'));var rp=require(_0x1e21('0x3'));var fs=require('fs');var path=require(_0x1e21('0x4'));var rimraf=require(_0x1e21('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e21('0x6'));module[_0x1e21('0x7')]=function(_0xbf1ae6,_0x39cb89){return _0xbf1ae6[_0x1e21('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x1e21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index eea4963..3260725 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x392d39,_0x1ba1b2){var _0x2e92c8=function(_0x599565){while(--_0x599565){_0x392d39['push'](_0x392d39['shift']());}};_0x2e92c8(++_0x1ba1b2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcb91[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1843ab5..fb310da 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 _0xea21=['INTEGER','sequelize','exports'];(function(_0x2b7f3a,_0x5c5099){var _0x46ecaf=function(_0x461c79){while(--_0x461c79){_0x2b7f3a['push'](_0x2b7f3a['shift']());}};_0x46ecaf(++_0x5c5099);}(_0xea21,0xc1));var _0x1ea2=function(_0x58c892,_0x218788){_0x58c892=_0x58c892-0x0;var _0xe74a71=_0xea21[_0x58c892];return _0xe74a71;};'use strict';var Sequelize=require(_0x1ea2('0x0'));module[_0x1ea2('0x1')]={'penalty':{'type':Sequelize[_0x1ea2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff92=['exports','sequelize'];(function(_0x5e4a6a,_0x287632){var _0xc8879f=function(_0x4a5f5a){while(--_0x4a5f5a){_0x5e4a6a['push'](_0x5e4a6a['shift']());}};_0xc8879f(++_0x287632);}(_0xff92,0x67));var _0x2ff9=function(_0x57bab4,_0x365277){_0x57bab4=_0x57bab4-0x0;var _0x124816=_0xff92[_0x57bab4];return _0x124816;};'use strict';var Sequelize=require(_0x2ff9('0x0'));module[_0x2ff9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 140c0fa..b94f20f 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aaf=['./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0xff6ec1,_0x5886bf){var _0x1f5089=function(_0x460e2f){while(--_0x460e2f){_0xff6ec1['push'](_0xff6ec1['shift']());}};_0x1f5089(++_0x5886bf);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x58a9f8,_0x5d188b){_0x58a9f8=_0x58a9f8-0x0;var _0x9edba5=_0x7aaf[_0x58a9f8];return _0x9edba5;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7aa('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7aa('0x5'));module[_0xf7aa('0x6')]=function(_0x1babcd,_0xf02ed5){return _0x1babcd['define'](_0xf7aa('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c5=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','../../config/logger','api','moment'];(function(_0x5464cf,_0x436097){var _0x690886=function(_0x66c56c){while(--_0x66c56c){_0x5464cf['push'](_0x5464cf['shift']());}};_0x690886(++_0x436097);}(_0x27c5,0x173));var _0x527c=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x27c5[_0x4a9a17];return _0x30e831;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x527c('0x0'))(_0x527c('0x1'));var moment=require(_0x527c('0x2'));var BPromise=require('bluebird');var rp=require(_0x527c('0x3'));var fs=require('fs');var path=require(_0x527c('0x4'));var rimraf=require(_0x527c('0x5'));var config=require(_0x527c('0x6'));var attributes=require(_0x527c('0x7'));module[_0x527c('0x8')]=function(_0x37bd95,_0x552d9b){return _0x37bd95[_0x527c('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0x527c('0xa'),'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 cce0d5b..0de15f7 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 _0xe80d=['TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xe80d,0x183));var _0xde80=function(_0xc61ea8,_0x56e451){_0xc61ea8=_0xc61ea8-0x0;var _0x22c845=_0xe80d[_0xc61ea8];return _0x22c845;};'use strict';var _=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var moment=require(_0xde80('0x2'));var BPromise=require('bluebird');var rs=require(_0xde80('0x3'));var fs=require('fs');var Redis=require(_0xde80('0x4'));var db=require(_0xde80('0x5'))['db'];var utils=require(_0xde80('0x6'));var logger=require('../../config/logger')(_0xde80('0x7'));var config=require(_0xde80('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde80('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5c46,_0x2a8dae,_0x464766){return new BPromise(function(_0x5f4f15,_0x311166){return client['request'](_0x5c5c46,_0x464766)[_0xde80('0xa')](function(_0x342c33){logger[_0xde80('0xb')](_0xde80('0xc'),_0x2a8dae,'request\x20sent');logger[_0xde80('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2a8dae,_0xde80('0xe'),JSON[_0xde80('0xf')](_0x342c33));if(_0x342c33['error']){if(_0x342c33['error'][_0xde80('0x10')]===0x1f4){logger[_0xde80('0x11')](_0xde80('0xc'),_0x2a8dae,_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);return _0x311166(_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);}logger[_0xde80('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2a8dae,_0x342c33[_0xde80('0x11')][_0xde80('0x12')]);return _0x5f4f15(_0x342c33['error'][_0xde80('0x12')]);}else{logger[_0xde80('0xb')](_0xde80('0xc'),_0x2a8dae,_0xde80('0xe'));_0x5f4f15(_0x342c33[_0xde80('0x13')]['message']);}})[_0xde80('0x14')](function(_0x45ea0b){logger['error'](_0xde80('0xc'),_0x2a8dae,_0x45ea0b);_0x311166(_0x45ea0b);});});} \ No newline at end of file +var _0x5fc7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message'];(function(_0x557ae3,_0x13444f){var _0x2a4050=function(_0x539cf3){while(--_0x539cf3){_0x557ae3['push'](_0x557ae3['shift']());}};_0x2a4050(++_0x13444f);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x5fc7[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var moment=require(_0x75fc('0x2'));var BPromise=require(_0x75fc('0x3'));var rs=require(_0x75fc('0x4'));var fs=require('fs');var Redis=require(_0x75fc('0x5'));var db=require(_0x75fc('0x6'))['db'];var utils=require(_0x75fc('0x7'));var logger=require(_0x75fc('0x8'))(_0x75fc('0x9'));var config=require(_0x75fc('0xa'));var jayson=require(_0x75fc('0xb'));var client=jayson['client'][_0x75fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc85b45,_0x1430f3,_0x347ce8){return new BPromise(function(_0x17a1d5,_0x15f3bc){return client[_0x75fc('0xd')](_0xc85b45,_0x347ce8)[_0x75fc('0xe')](function(_0x957f42){logger[_0x75fc('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1430f3,_0x75fc('0x10'));logger[_0x75fc('0x11')](_0x75fc('0x12'),_0x1430f3,_0x75fc('0x10'),JSON['stringify'](_0x957f42));if(_0x957f42[_0x75fc('0x13')]){if(_0x957f42[_0x75fc('0x13')][_0x75fc('0x14')]===0x1f4){logger[_0x75fc('0x13')](_0x75fc('0x15'),_0x1430f3,_0x957f42[_0x75fc('0x13')][_0x75fc('0x16')]);return _0x15f3bc(_0x957f42['error']['message']);}logger['error'](_0x75fc('0x15'),_0x1430f3,_0x957f42[_0x75fc('0x13')][_0x75fc('0x16')]);return _0x17a1d5(_0x957f42[_0x75fc('0x13')][_0x75fc('0x16')]);}else{logger[_0x75fc('0xf')](_0x75fc('0x15'),_0x1430f3,_0x75fc('0x10'));_0x17a1d5(_0x957f42['result'][_0x75fc('0x16')]);}})[_0x75fc('0x17')](function(_0x51011d){logger[_0x75fc('0x13')](_0x75fc('0x15'),_0x1430f3,_0x51011d);_0x15f3bc(_0x51011d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 64f16f8..2d32e26 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 _0x3014=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x3014,0x1d7));var _0x4301=function(_0x7a8506,_0x2798c7){_0x7a8506=_0x7a8506-0x0;var _0x1bb32d=_0x3014[_0x7a8506];return _0x1bb32d;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4301('0xd')]);router[_0x4301('0xe')]('/:id',auth[_0x4301('0x9')](),controller[_0x4301('0xf')]);router[_0x4301('0x10')](_0x4301('0xb'),auth['isAuthenticated'](),controller[_0x4301('0x11')]);module['exports']=router; \ No newline at end of file +var _0x761c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x761c,0x18a));var _0xc761=function(_0x199a3d,_0x49fe64){_0x199a3d=_0x199a3d-0x0;var _0x4b9839=_0x761c[_0x199a3d];return _0x4b9839;};'use strict';var multer=require(_0xc761('0x0'));var util=require('util');var path=require(_0xc761('0x1'));var timeout=require(_0xc761('0x2'));var express=require('express');var router=express[_0xc761('0x3')]();var fs_extra=require(_0xc761('0x4'));var auth=require(_0xc761('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc761('0x6'));var controller=require('./template.controller');router[_0xc761('0x7')]('/',auth[_0xc761('0x8')](),controller[_0xc761('0x9')]);router[_0xc761('0x7')](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0xb')]);router['post']('/',auth[_0xc761('0x8')](),controller[_0xc761('0xc')]);router[_0xc761('0xd')](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0xe')]);router[_0xc761('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc761('0x10')]);module[_0xc761('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4a40719..9fa7187 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 _0xe696=['sequelize','exports','STRING','TEXT'];(function(_0xfccd38,_0x541220){var _0x533b87=function(_0x351dc4){while(--_0x351dc4){_0xfccd38['push'](_0xfccd38['shift']());}};_0x533b87(++_0x541220);}(_0xe696,0xd4));var _0x6e69=function(_0x59c46a,_0x241a33){_0x59c46a=_0x59c46a-0x0;var _0x2e416c=_0xe696[_0x59c46a];return _0x2e416c;};'use strict';var Sequelize=require(_0x6e69('0x0'));module[_0x6e69('0x1')]={'name':{'type':Sequelize[_0x6e69('0x2')]},'description':{'type':Sequelize[_0x6e69('0x2')]},'html':{'type':Sequelize[_0x6e69('0x3')]}}; \ No newline at end of file +var _0xe060=['TEXT','sequelize','STRING'];(function(_0x5cb84f,_0x24a3cd){var _0xd666b1=function(_0x4e2ee6){while(--_0x4e2ee6){_0x5cb84f['push'](_0x5cb84f['shift']());}};_0xd666b1(++_0x24a3cd);}(_0xe060,0xe5));var _0x0e06=function(_0x2468c3,_0x24b861){_0x2468c3=_0x2468c3-0x0;var _0x320a04=_0xe060[_0x2468c3];return _0x320a04;};'use strict';var Sequelize=require(_0x0e06('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e06('0x1')]},'html':{'type':Sequelize[_0x0e06('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e129d34..82ed7cc 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 _0xc5c3=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','Templates','UserProfileResource','error','stack','name','send','map','Template','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x41304c,_0x1b1b25){var _0x2ab518=function(_0x59c1e0){while(--_0x59c1e0){_0x41304c['push'](_0x41304c['shift']());}};_0x2ab518(++_0x1b1b25);}(_0xc5c3,0x11e));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3c5c('0x0'));var rimraf=require(_0x3c5c('0x1'));var zipdir=require(_0x3c5c('0x2'));var jsonpatch=require(_0x3c5c('0x3'));var rp=require(_0x3c5c('0x4'));var moment=require('moment');var BPromise=require(_0x3c5c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c5c('0x6'));var sox=require('sox');var csv=require(_0x3c5c('0x7'));var ejs=require(_0x3c5c('0x8'));var fs=require('fs');var fs_extra=require(_0x3c5c('0x9'));var _=require(_0x3c5c('0xa'));var squel=require(_0x3c5c('0xb'));var crypto=require(_0x3c5c('0xc'));var jsforce=require(_0x3c5c('0xd'));var deskjs=require(_0x3c5c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c5c('0xf'));var Papa=require(_0x3c5c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c5c('0x11'));var as=require(_0x3c5c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c5c('0x13'));var utils=require('../../config/utils');var config=require(_0x3c5c('0x14'));var licenseUtil=require(_0x3c5c('0x15'));var db=require(_0x3c5c('0x16'))['db'];function respondWithStatusCode(_0x12605f,_0x4d67a4){_0x4d67a4=_0x4d67a4||0xcc;return function(_0x365700){if(_0x365700){return _0x12605f[_0x3c5c('0x17')](_0x4d67a4);}return _0x12605f[_0x3c5c('0x18')](_0x4d67a4)[_0x3c5c('0x19')]();};}function respondWithResult(_0x4bbf0d,_0x324242){_0x324242=_0x324242||0xc8;return function(_0x41448e){if(_0x41448e){return _0x4bbf0d[_0x3c5c('0x18')](_0x324242)[_0x3c5c('0x1a')](_0x41448e);}};}function respondWithFilteredResult(_0x42b0df,_0x1e4e62){return function(_0x5b4d5b){if(_0x5b4d5b){var _0x2ebb06=typeof _0x1e4e62[_0x3c5c('0x1b')]===_0x3c5c('0x1c')&&typeof _0x1e4e62[_0x3c5c('0x1d')]===_0x3c5c('0x1c');var _0x134336=_0x5b4d5b[_0x3c5c('0x1e')];var _0x3dd8cf=_0x2ebb06?0x0:_0x1e4e62['offset'];var _0x24e4e1=_0x2ebb06?_0x5b4d5b[_0x3c5c('0x1e')]:_0x1e4e62[_0x3c5c('0x1b')]+_0x1e4e62[_0x3c5c('0x1d')];var _0xdfebf5;if(_0x24e4e1>=_0x134336){_0x24e4e1=_0x134336;_0xdfebf5=0xc8;}else{_0xdfebf5=0xce;}_0x42b0df[_0x3c5c('0x18')](_0xdfebf5);return _0x42b0df[_0x3c5c('0x1f')](_0x3c5c('0x20'),_0x3dd8cf+'-'+_0x24e4e1+'/'+_0x134336)[_0x3c5c('0x1a')](_0x5b4d5b);}return null;};}function patchUpdates(_0x2f1ed7){return function(_0xe3ded0){try{jsonpatch['apply'](_0xe3ded0,_0x2f1ed7,!![]);}catch(_0xd60940){return BPromise['reject'](_0xd60940);}return _0xe3ded0['save']();};}function saveUpdates(_0x2ac249,_0x1d9375){return function(_0x329575){if(_0x329575){return _0x329575[_0x3c5c('0x21')](_0x2ac249)['then'](function(_0xd11407){return _0xd11407;});}return null;};}function removeEntity(_0x302348,_0x2fe428){return function(_0x2e490e){if(_0x2e490e){return _0x2e490e[_0x3c5c('0x22')]()[_0x3c5c('0x23')](function(){var _0x585fae=_0x2e490e['get']({'plain':!![]});var _0x47d259=_0x3c5c('0x24');return db[_0x3c5c('0x25')]['destroy']({'where':{'type':_0x47d259,'resourceId':_0x585fae['id']}})[_0x3c5c('0x23')](function(){return _0x2e490e;});})[_0x3c5c('0x23')](function(){_0x302348[_0x3c5c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2daad2,_0x81ba12){return function(_0x7a9eee){if(!_0x7a9eee){_0x2daad2[_0x3c5c('0x17')](0x194);}return _0x7a9eee;};}function handleError(_0x45d174,_0x3e83dc){_0x3e83dc=_0x3e83dc||0x1f4;return function(_0x19774d){logger[_0x3c5c('0x26')](_0x19774d[_0x3c5c('0x27')]);if(_0x19774d[_0x3c5c('0x28')]){delete _0x19774d['name'];}_0x45d174[_0x3c5c('0x18')](_0x3e83dc)[_0x3c5c('0x29')](_0x19774d);};}exports['index']=function(_0x564643,_0x444ffd){var _0x429254={},_0x581eb9={},_0x404dd3={'count':0x0,'rows':[]};var _0x2605d9=_[_0x3c5c('0x2a')](db[_0x3c5c('0x2b')][_0x3c5c('0x2c')],function(_0x4305ed){return{'name':_0x4305ed['fieldName'],'type':_0x4305ed['type'][_0x3c5c('0x2d')]};});_0x581eb9[_0x3c5c('0x2e')]=_['map'](_0x2605d9,'name');_0x581eb9[_0x3c5c('0x2f')]=_['keys'](_0x564643['query']);_0x581eb9[_0x3c5c('0x30')]=_[_0x3c5c('0x31')](_0x581eb9['model'],_0x581eb9[_0x3c5c('0x2f')]);_0x429254[_0x3c5c('0x32')]=_[_0x3c5c('0x31')](_0x581eb9[_0x3c5c('0x2e')],qs[_0x3c5c('0x33')](_0x564643[_0x3c5c('0x2f')][_0x3c5c('0x33')]));_0x429254['attributes']=_0x429254[_0x3c5c('0x32')]['length']?_0x429254['attributes']:_0x581eb9[_0x3c5c('0x2e')];if(!_0x564643[_0x3c5c('0x2f')][_0x3c5c('0x34')](_0x3c5c('0x35'))){_0x429254['limit']=qs[_0x3c5c('0x1d')](_0x564643[_0x3c5c('0x2f')][_0x3c5c('0x1d')]);_0x429254['offset']=qs[_0x3c5c('0x1b')](_0x564643[_0x3c5c('0x2f')][_0x3c5c('0x1b')]);}_0x429254[_0x3c5c('0x36')]=qs['sort'](_0x564643[_0x3c5c('0x2f')]['sort']);_0x429254[_0x3c5c('0x37')]=qs[_0x3c5c('0x30')](_['pick'](_0x564643[_0x3c5c('0x2f')],_0x581eb9[_0x3c5c('0x30')]),_0x2605d9);if(_0x564643['query'][_0x3c5c('0x38')]){_0x429254[_0x3c5c('0x37')]=_[_0x3c5c('0x39')](_0x429254['where'],{'$or':_[_0x3c5c('0x2a')](_0x2605d9,function(_0x2a7f91){if(_0x2a7f91[_0x3c5c('0x3a')]!=='VIRTUAL'){var _0x299dbd={};_0x299dbd[_0x2a7f91['name']]={'$like':'%'+_0x564643['query']['filter']+'%'};return _0x299dbd;}})});}_0x429254=_[_0x3c5c('0x39')]({},_0x429254,_0x564643[_0x3c5c('0x3b')]);var _0x533fd3={'where':_0x429254['where']};return db[_0x3c5c('0x2b')][_0x3c5c('0x1e')](_0x533fd3)[_0x3c5c('0x23')](function(_0x87eff4){_0x404dd3[_0x3c5c('0x1e')]=_0x87eff4;if(_0x564643[_0x3c5c('0x2f')]['includeAll']){_0x429254['include']=[{'all':!![]}];}return db['Template'][_0x3c5c('0x3c')](_0x429254);})[_0x3c5c('0x23')](function(_0x165f70){_0x404dd3[_0x3c5c('0x3d')]=_0x165f70;return _0x404dd3;})[_0x3c5c('0x23')](respondWithFilteredResult(_0x444ffd,_0x429254))[_0x3c5c('0x3e')](handleError(_0x444ffd,null));};exports[_0x3c5c('0x3f')]=function(_0x53c7a1,_0x2b1b89){var _0x38535d={'raw':!![],'where':{'id':_0x53c7a1[_0x3c5c('0x40')]['id']}},_0xd7cc6e={};_0xd7cc6e[_0x3c5c('0x2e')]=_['keys'](db['Template'][_0x3c5c('0x2c')]);_0xd7cc6e['query']=_['keys'](_0x53c7a1[_0x3c5c('0x2f')]);_0xd7cc6e['filters']=_[_0x3c5c('0x31')](_0xd7cc6e[_0x3c5c('0x2e')],_0xd7cc6e[_0x3c5c('0x2f')]);_0x38535d[_0x3c5c('0x32')]=_[_0x3c5c('0x31')](_0xd7cc6e[_0x3c5c('0x2e')],qs['fields'](_0x53c7a1[_0x3c5c('0x2f')][_0x3c5c('0x33')]));_0x38535d[_0x3c5c('0x32')]=_0x38535d[_0x3c5c('0x32')][_0x3c5c('0x41')]?_0x38535d['attributes']:_0xd7cc6e[_0x3c5c('0x2e')];if(_0x53c7a1[_0x3c5c('0x2f')][_0x3c5c('0x42')]){_0x38535d[_0x3c5c('0x43')]=[{'all':!![]}];}_0x38535d=_[_0x3c5c('0x39')]({},_0x38535d,_0x53c7a1[_0x3c5c('0x3b')]);return db['Template'][_0x3c5c('0x44')](_0x38535d)[_0x3c5c('0x23')](handleEntityNotFound(_0x2b1b89,null))[_0x3c5c('0x23')](respondWithResult(_0x2b1b89,null))[_0x3c5c('0x3e')](handleError(_0x2b1b89,null));};exports[_0x3c5c('0x45')]=function(_0x194bc1,_0x296e99){return db[_0x3c5c('0x2b')][_0x3c5c('0x45')](_0x194bc1[_0x3c5c('0x46')],{})[_0x3c5c('0x23')](function(_0x499643){var _0x1e4cbc=_0x194bc1[_0x3c5c('0x47')][_0x3c5c('0x48')]({'plain':!![]});if(!_0x1e4cbc)throw new Error(_0x3c5c('0x49'));if(_0x1e4cbc[_0x3c5c('0x4a')]==='user'){var _0x9fa1fa=_0x499643['get']({'plain':!![]});var _0x40a8d8=_0x3c5c('0x24');return db['UserProfileSection'][_0x3c5c('0x44')]({'where':{'name':_0x40a8d8,'userProfileId':_0x1e4cbc[_0x3c5c('0x4b')]},'raw':!![]})[_0x3c5c('0x23')](function(_0x174b02){if(_0x174b02&&_0x174b02[_0x3c5c('0x4c')]===0x0){return db[_0x3c5c('0x25')]['create']({'name':_0x9fa1fa[_0x3c5c('0x28')],'resourceId':_0x9fa1fa['id'],'type':_0x174b02['name'],'sectionId':_0x174b02['id']},{})['then'](function(){return _0x499643;});}else{return _0x499643;}})[_0x3c5c('0x3e')](function(_0x143bbd){logger[_0x3c5c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x143bbd);throw _0x143bbd;});}return _0x499643;})['then'](respondWithResult(_0x296e99,0xc9))[_0x3c5c('0x3e')](handleError(_0x296e99,null));};exports[_0x3c5c('0x21')]=function(_0x4c83c6,_0x3d9061){if(_0x4c83c6[_0x3c5c('0x46')]['id']){delete _0x4c83c6['body']['id'];}return db['Template'][_0x3c5c('0x44')]({'where':{'id':_0x4c83c6[_0x3c5c('0x40')]['id']}})[_0x3c5c('0x23')](handleEntityNotFound(_0x3d9061,null))['then'](saveUpdates(_0x4c83c6[_0x3c5c('0x46')],null))[_0x3c5c('0x23')](respondWithResult(_0x3d9061,null))[_0x3c5c('0x3e')](handleError(_0x3d9061,null));};exports[_0x3c5c('0x22')]=function(_0x612c64,_0x4d4b12){return db[_0x3c5c('0x2b')][_0x3c5c('0x44')]({'where':{'id':_0x612c64[_0x3c5c('0x40')]['id']}})[_0x3c5c('0x23')](handleEntityNotFound(_0x4d4b12,null))[_0x3c5c('0x23')](removeEntity(_0x4d4b12,null))['catch'](handleError(_0x4d4b12,null));}; \ No newline at end of file +var _0xf62a=['reject','save','update','then','destroy','get','Templates','error','name','send','index','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Template','includeAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3f7500,_0x195884){var _0x47d371=function(_0x783d0a){while(--_0x783d0a){_0x3f7500['push'](_0x3f7500['shift']());}};_0x47d371(++_0x195884);}(_0xf62a,0xc4));var _0xaf62=function(_0x5d73fa,_0xc75195){_0x5d73fa=_0x5d73fa-0x0;var _0x131488=_0xf62a[_0x5d73fa];return _0x131488;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf62('0x0'));var zipdir=require(_0xaf62('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf62('0x2'));var moment=require(_0xaf62('0x3'));var BPromise=require(_0xaf62('0x4'));var Mustache=require(_0xaf62('0x5'));var util=require(_0xaf62('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xaf62('0x7'));var ejs=require(_0xaf62('0x8'));var fs=require('fs');var fs_extra=require(_0xaf62('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf62('0xa'));var jsforce=require(_0xaf62('0xb'));var deskjs=require(_0xaf62('0xc'));var toCsv=require(_0xaf62('0x7'));var querystring=require('querystring');var Papa=require(_0xaf62('0xd'));var Redis=require(_0xaf62('0xe'));var authService=require(_0xaf62('0xf'));var qs=require(_0xaf62('0x10'));var as=require(_0xaf62('0x11'));var hardwareService=require(_0xaf62('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xaf62('0x13'));var config=require(_0xaf62('0x14'));var licenseUtil=require(_0xaf62('0x15'));var db=require(_0xaf62('0x16'))['db'];function respondWithStatusCode(_0x2ca866,_0x41db3e){_0x41db3e=_0x41db3e||0xcc;return function(_0x25b7ce){if(_0x25b7ce){return _0x2ca866['sendStatus'](_0x41db3e);}return _0x2ca866['status'](_0x41db3e)[_0xaf62('0x17')]();};}function respondWithResult(_0x200f10,_0x4772ea){_0x4772ea=_0x4772ea||0xc8;return function(_0x3ce796){if(_0x3ce796){return _0x200f10[_0xaf62('0x18')](_0x4772ea)[_0xaf62('0x19')](_0x3ce796);}};}function respondWithFilteredResult(_0x2cae67,_0x2935c1){return function(_0xf50f8b){if(_0xf50f8b){var _0x18f472=typeof _0x2935c1[_0xaf62('0x1a')]===_0xaf62('0x1b')&&typeof _0x2935c1[_0xaf62('0x1c')]===_0xaf62('0x1b');var _0x7ec3a8=_0xf50f8b[_0xaf62('0x1d')];var _0x536f4b=_0x18f472?0x0:_0x2935c1[_0xaf62('0x1a')];var _0x380f2d=_0x18f472?_0xf50f8b[_0xaf62('0x1d')]:_0x2935c1['offset']+_0x2935c1[_0xaf62('0x1c')];var _0x5b0273;if(_0x380f2d>=_0x7ec3a8){_0x380f2d=_0x7ec3a8;_0x5b0273=0xc8;}else{_0x5b0273=0xce;}_0x2cae67[_0xaf62('0x18')](_0x5b0273);return _0x2cae67[_0xaf62('0x1e')](_0xaf62('0x1f'),_0x536f4b+'-'+_0x380f2d+'/'+_0x7ec3a8)[_0xaf62('0x19')](_0xf50f8b);}return null;};}function patchUpdates(_0x14ec50){return function(_0xbbcec8){try{jsonpatch['apply'](_0xbbcec8,_0x14ec50,!![]);}catch(_0x56c947){return BPromise[_0xaf62('0x20')](_0x56c947);}return _0xbbcec8[_0xaf62('0x21')]();};}function saveUpdates(_0x1cca33,_0x3e65d8){return function(_0x5dac07){if(_0x5dac07){return _0x5dac07[_0xaf62('0x22')](_0x1cca33)[_0xaf62('0x23')](function(_0x4eda76){return _0x4eda76;});}return null;};}function removeEntity(_0x2b5efc,_0xa4be3e){return function(_0x3a4267){if(_0x3a4267){return _0x3a4267[_0xaf62('0x24')]()[_0xaf62('0x23')](function(){var _0x29a04c=_0x3a4267[_0xaf62('0x25')]({'plain':!![]});var _0x3a5920=_0xaf62('0x26');return db['UserProfileResource'][_0xaf62('0x24')]({'where':{'type':_0x3a5920,'resourceId':_0x29a04c['id']}})[_0xaf62('0x23')](function(){return _0x3a4267;});})[_0xaf62('0x23')](function(){_0x2b5efc[_0xaf62('0x18')](0xcc)[_0xaf62('0x17')]();});}};}function handleEntityNotFound(_0x47454b,_0x43c387){return function(_0x47d901){if(!_0x47d901){_0x47454b['sendStatus'](0x194);}return _0x47d901;};}function handleError(_0xeb812b,_0x339a90){_0x339a90=_0x339a90||0x1f4;return function(_0x4f088e){logger[_0xaf62('0x27')](_0x4f088e['stack']);if(_0x4f088e[_0xaf62('0x28')]){delete _0x4f088e[_0xaf62('0x28')];}_0xeb812b['status'](_0x339a90)[_0xaf62('0x29')](_0x4f088e);};}exports[_0xaf62('0x2a')]=function(_0x4f4158,_0x45044f){var _0x48ce3e={},_0x5a040c={},_0x47777c={'count':0x0,'rows':[]};var _0x397f61=_[_0xaf62('0x2b')](db['Template'][_0xaf62('0x2c')],function(_0x5838d3){return{'name':_0x5838d3['fieldName'],'type':_0x5838d3[_0xaf62('0x2d')][_0xaf62('0x2e')]};});_0x5a040c[_0xaf62('0x2f')]=_['map'](_0x397f61,_0xaf62('0x28'));_0x5a040c[_0xaf62('0x30')]=_['keys'](_0x4f4158[_0xaf62('0x30')]);_0x5a040c['filters']=_['intersection'](_0x5a040c[_0xaf62('0x2f')],_0x5a040c[_0xaf62('0x30')]);_0x48ce3e[_0xaf62('0x31')]=_[_0xaf62('0x32')](_0x5a040c[_0xaf62('0x2f')],qs[_0xaf62('0x33')](_0x4f4158['query'][_0xaf62('0x33')]));_0x48ce3e['attributes']=_0x48ce3e['attributes'][_0xaf62('0x34')]?_0x48ce3e[_0xaf62('0x31')]:_0x5a040c['model'];if(!_0x4f4158['query']['hasOwnProperty'](_0xaf62('0x35'))){_0x48ce3e[_0xaf62('0x1c')]=qs['limit'](_0x4f4158[_0xaf62('0x30')][_0xaf62('0x1c')]);_0x48ce3e[_0xaf62('0x1a')]=qs[_0xaf62('0x1a')](_0x4f4158[_0xaf62('0x30')][_0xaf62('0x1a')]);}_0x48ce3e[_0xaf62('0x36')]=qs[_0xaf62('0x37')](_0x4f4158[_0xaf62('0x30')][_0xaf62('0x37')]);_0x48ce3e[_0xaf62('0x38')]=qs[_0xaf62('0x39')](_[_0xaf62('0x3a')](_0x4f4158[_0xaf62('0x30')],_0x5a040c[_0xaf62('0x39')]),_0x397f61);if(_0x4f4158[_0xaf62('0x30')][_0xaf62('0x3b')]){_0x48ce3e[_0xaf62('0x38')]=_[_0xaf62('0x3c')](_0x48ce3e[_0xaf62('0x38')],{'$or':_[_0xaf62('0x2b')](_0x397f61,function(_0x451bc7){if(_0x451bc7[_0xaf62('0x2d')]!==_0xaf62('0x3d')){var _0x3d5b1d={};_0x3d5b1d[_0x451bc7[_0xaf62('0x28')]]={'$like':'%'+_0x4f4158[_0xaf62('0x30')][_0xaf62('0x3b')]+'%'};return _0x3d5b1d;}})});}_0x48ce3e=_['merge']({},_0x48ce3e,_0x4f4158[_0xaf62('0x3e')]);var _0x5617c4={'where':_0x48ce3e[_0xaf62('0x38')]};return db[_0xaf62('0x3f')][_0xaf62('0x1d')](_0x5617c4)['then'](function(_0x557b49){_0x47777c[_0xaf62('0x1d')]=_0x557b49;if(_0x4f4158[_0xaf62('0x30')][_0xaf62('0x40')]){_0x48ce3e['include']=[{'all':!![]}];}return db[_0xaf62('0x3f')]['findAll'](_0x48ce3e);})['then'](function(_0x4d386e){_0x47777c['rows']=_0x4d386e;return _0x47777c;})['then'](respondWithFilteredResult(_0x45044f,_0x48ce3e))[_0xaf62('0x41')](handleError(_0x45044f,null));};exports[_0xaf62('0x42')]=function(_0x47b871,_0x5869bf){var _0x527881={'raw':!![],'where':{'id':_0x47b871[_0xaf62('0x43')]['id']}},_0x305976={};_0x305976[_0xaf62('0x2f')]=_['keys'](db[_0xaf62('0x3f')]['rawAttributes']);_0x305976[_0xaf62('0x30')]=_['keys'](_0x47b871[_0xaf62('0x30')]);_0x305976['filters']=_[_0xaf62('0x32')](_0x305976[_0xaf62('0x2f')],_0x305976[_0xaf62('0x30')]);_0x527881[_0xaf62('0x31')]=_['intersection'](_0x305976[_0xaf62('0x2f')],qs[_0xaf62('0x33')](_0x47b871['query']['fields']));_0x527881[_0xaf62('0x31')]=_0x527881[_0xaf62('0x31')][_0xaf62('0x34')]?_0x527881[_0xaf62('0x31')]:_0x305976[_0xaf62('0x2f')];if(_0x47b871[_0xaf62('0x30')]['includeAll']){_0x527881['include']=[{'all':!![]}];}_0x527881=_[_0xaf62('0x3c')]({},_0x527881,_0x47b871[_0xaf62('0x3e')]);return db[_0xaf62('0x3f')][_0xaf62('0x44')](_0x527881)[_0xaf62('0x23')](handleEntityNotFound(_0x5869bf,null))['then'](respondWithResult(_0x5869bf,null))[_0xaf62('0x41')](handleError(_0x5869bf,null));};exports[_0xaf62('0x45')]=function(_0x4e96a6,_0x305920){return db[_0xaf62('0x3f')][_0xaf62('0x45')](_0x4e96a6[_0xaf62('0x46')],{})[_0xaf62('0x23')](function(_0x3503e6){var _0x457c10=_0x4e96a6['user']['get']({'plain':!![]});if(!_0x457c10)throw new Error(_0xaf62('0x47'));if(_0x457c10['role']===_0xaf62('0x48')){var _0x3e3bad=_0x3503e6[_0xaf62('0x25')]({'plain':!![]});var _0x43a437=_0xaf62('0x26');return db[_0xaf62('0x49')][_0xaf62('0x44')]({'where':{'name':_0x43a437,'userProfileId':_0x457c10[_0xaf62('0x4a')]},'raw':!![]})[_0xaf62('0x23')](function(_0x20952b){if(_0x20952b&&_0x20952b[_0xaf62('0x4b')]===0x0){return db['UserProfileResource'][_0xaf62('0x45')]({'name':_0x3e3bad[_0xaf62('0x28')],'resourceId':_0x3e3bad['id'],'type':_0x20952b['name'],'sectionId':_0x20952b['id']},{})[_0xaf62('0x23')](function(){return _0x3503e6;});}else{return _0x3503e6;}})['catch'](function(_0x3cd05d){logger[_0xaf62('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cd05d);throw _0x3cd05d;});}return _0x3503e6;})['then'](respondWithResult(_0x305920,0xc9))[_0xaf62('0x41')](handleError(_0x305920,null));};exports[_0xaf62('0x22')]=function(_0x12f95a,_0x40253e){if(_0x12f95a[_0xaf62('0x46')]['id']){delete _0x12f95a[_0xaf62('0x46')]['id'];}return db['Template'][_0xaf62('0x44')]({'where':{'id':_0x12f95a[_0xaf62('0x43')]['id']}})[_0xaf62('0x23')](handleEntityNotFound(_0x40253e,null))[_0xaf62('0x23')](saveUpdates(_0x12f95a[_0xaf62('0x46')],null))['then'](respondWithResult(_0x40253e,null))['catch'](handleError(_0x40253e,null));};exports['destroy']=function(_0x250f8c,_0x4dc35f){return db[_0xaf62('0x3f')][_0xaf62('0x44')]({'where':{'id':_0x250f8c['params']['id']}})[_0xaf62('0x23')](handleEntityNotFound(_0x4dc35f,null))[_0xaf62('0x23')](removeEntity(_0x4dc35f,null))['catch'](handleError(_0x4dc35f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5df198f..3f1d034 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 _0xb932=['rimraf','../../config/environment','./template.attributes','lodash','util','../../config/logger','api','moment','path'];(function(_0x296aba,_0x2e69eb){var _0x54b03b=function(_0x409928){while(--_0x409928){_0x296aba['push'](_0x296aba['shift']());}};_0x54b03b(++_0x2e69eb);}(_0xb932,0xc0));var _0x2b93=function(_0x2ac0b0,_0x115490){_0x2ac0b0=_0x2ac0b0-0x0;var _0x352688=_0xb932[_0x2ac0b0];return _0x352688;};'use strict';var _=require(_0x2b93('0x0'));var util=require(_0x2b93('0x1'));var logger=require(_0x2b93('0x2'))(_0x2b93('0x3'));var moment=require(_0x2b93('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b93('0x5'));var rimraf=require(_0x2b93('0x6'));var config=require(_0x2b93('0x7'));var attributes=require(_0x2b93('0x8'));module['exports']=function(_0x237646,_0x2e8109){return _0x237646['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f79=['./template.attributes','exports','define','tools_templates','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x3f79,0x143));var _0x93f7=function(_0x5ed9fb,_0x28da98){_0x5ed9fb=_0x5ed9fb-0x0;var _0x4be7d9=_0x3f79[_0x5ed9fb];return _0x4be7d9;};'use strict';var _=require(_0x93f7('0x0'));var util=require('util');var logger=require(_0x93f7('0x1'))(_0x93f7('0x2'));var moment=require(_0x93f7('0x3'));var BPromise=require('bluebird');var rp=require(_0x93f7('0x4'));var fs=require('fs');var path=require(_0x93f7('0x5'));var rimraf=require(_0x93f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x93f7('0x7'));module[_0x93f7('0x8')]=function(_0x4f8014,_0x275bbf){return _0x4f8014[_0x93f7('0x9')]('Template',attributes,{'tableName':_0x93f7('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 5703970..0140dbf 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 _0x322f=['client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Template','findAll','options','raw','attributes','include','map','model','GetTemplate','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x16171e,_0x2524ee){var _0xd6412c=function(_0x198c9c){while(--_0x198c9c){_0x16171e['push'](_0x16171e['shift']());}};_0xd6412c(++_0x2524ee);}(_0x322f,0x1b9));var _0xf322=function(_0x35da81,_0x446adc){_0x35da81=_0x35da81-0x0;var _0x5963fb=_0x322f[_0x35da81];return _0x5963fb;};'use strict';var _=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var moment=require(_0xf322('0x2'));var BPromise=require('bluebird');var rs=require(_0xf322('0x3'));var fs=require('fs');var Redis=require(_0xf322('0x4'));var db=require(_0xf322('0x5'))['db'];var utils=require(_0xf322('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf322('0x7'));var jayson=require(_0xf322('0x8'));var client=jayson[_0xf322('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db562,_0x19e004,_0x274013){return new BPromise(function(_0xaa819b,_0x18c5c5){return client[_0xf322('0xa')](_0x2db562,_0x274013)[_0xf322('0xb')](function(_0xffc588){logger[_0xf322('0xc')](_0xf322('0xd'),_0x19e004,_0xf322('0xe'));logger[_0xf322('0xf')](_0xf322('0x10'),_0x19e004,'request\x20sent',JSON[_0xf322('0x11')](_0xffc588));if(_0xffc588['error']){if(_0xffc588['error']['code']===0x1f4){logger[_0xf322('0x12')](_0xf322('0xd'),_0x19e004,_0xffc588[_0xf322('0x12')]['message']);return _0x18c5c5(_0xffc588[_0xf322('0x12')]['message']);}logger[_0xf322('0x12')](_0xf322('0xd'),_0x19e004,_0xffc588[_0xf322('0x12')][_0xf322('0x13')]);return _0xaa819b(_0xffc588[_0xf322('0x12')][_0xf322('0x13')]);}else{logger[_0xf322('0xc')]('Template,\x20%s,\x20%s',_0x19e004,_0xf322('0xe'));_0xaa819b(_0xffc588['result'][_0xf322('0x13')]);}})[_0xf322('0x14')](function(_0x5b97ce){logger['error'](_0xf322('0xd'),_0x19e004,_0x5b97ce);_0x18c5c5(_0x5b97ce);});});}exports['GetTemplate']=function(_0x580c6a){var _0x15e00b=this;return new Promise(function(_0x5227c3,_0x1a5c4b){return db[_0xf322('0x15')][_0xf322('0x16')]({'raw':_0x580c6a[_0xf322('0x17')]?_0x580c6a['options'][_0xf322('0x18')]===undefined?!![]:![]:!![],'where':_0x580c6a[_0xf322('0x17')]?_0x580c6a['options']['where']||null:null,'attributes':_0x580c6a[_0xf322('0x17')]?_0x580c6a['options'][_0xf322('0x19')]||null:null,'limit':_0x580c6a['options']?_0x580c6a[_0xf322('0x17')]['limit']||null:null,'include':_0x580c6a[_0xf322('0x17')]?_0x580c6a[_0xf322('0x17')][_0xf322('0x1a')]?_[_0xf322('0x1b')](_0x580c6a['options'][_0xf322('0x1a')],function(_0x373a05){return{'model':db[_0x373a05[_0xf322('0x1c')]],'as':_0x373a05['as'],'attributes':_0x373a05[_0xf322('0x19')],'include':_0x373a05[_0xf322('0x1a')]?_[_0xf322('0x1b')](_0x373a05['include'],function(_0x5a5e21){return{'model':db[_0x5a5e21[_0xf322('0x1c')]],'as':_0x5a5e21['as'],'attributes':_0x5a5e21[_0xf322('0x19')],'include':_0x5a5e21[_0xf322('0x1a')]?_[_0xf322('0x1b')](_0x5a5e21['include'],function(_0x51c132){return{'model':db[_0x51c132[_0xf322('0x1c')]],'as':_0x51c132['as'],'attributes':_0x51c132[_0xf322('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf322('0xb')](function(_0x5cef63){logger['info'](_0xf322('0x1d'),_0x580c6a);logger[_0xf322('0xf')]('GetTemplate',_0x580c6a,JSON[_0xf322('0x11')](_0x5cef63));_0x5227c3(_0x5cef63);})[_0xf322('0x14')](function(_0x3388ec){logger[_0xf322('0x12')](_0xf322('0x1d'),_0x3388ec[_0xf322('0x13')],_0x580c6a);_0x1a5c4b(_0x15e00b['error'](0x1f4,_0x3388ec['message']));});});}; \ No newline at end of file +var _0x521e=['findAll','options','raw','limit','include','model','attributes','map','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','debug','stringify','error','code','message','catch','GetTemplate'];(function(_0x1fbac7,_0x4282b6){var _0x562537=function(_0x2490db){while(--_0x2490db){_0x1fbac7['push'](_0x1fbac7['shift']());}};_0x562537(++_0x4282b6);}(_0x521e,0xd3));var _0xe521=function(_0x4cbdda,_0x310d04){_0x4cbdda=_0x4cbdda-0x0;var _0x176175=_0x521e[_0x4cbdda];return _0x176175;};'use strict';var _=require(_0xe521('0x0'));var util=require(_0xe521('0x1'));var moment=require(_0xe521('0x2'));var BPromise=require('bluebird');var rs=require(_0xe521('0x3'));var fs=require('fs');var Redis=require(_0xe521('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe521('0x5'))(_0xe521('0x6'));var config=require(_0xe521('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe521('0x8')][_0xe521('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x443235,_0x32410b,_0x472306){return new BPromise(function(_0x3cbfd8,_0x4be6d7){return client[_0xe521('0xa')](_0x443235,_0x472306)[_0xe521('0xb')](function(_0x4f645f){logger[_0xe521('0xc')](_0xe521('0xd'),_0x32410b,'request\x20sent');logger[_0xe521('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x32410b,'request\x20sent',JSON[_0xe521('0xf')](_0x4f645f));if(_0x4f645f['error']){if(_0x4f645f[_0xe521('0x10')][_0xe521('0x11')]===0x1f4){logger[_0xe521('0x10')](_0xe521('0xd'),_0x32410b,_0x4f645f[_0xe521('0x10')]['message']);return _0x4be6d7(_0x4f645f['error'][_0xe521('0x12')]);}logger[_0xe521('0x10')](_0xe521('0xd'),_0x32410b,_0x4f645f[_0xe521('0x10')][_0xe521('0x12')]);return _0x3cbfd8(_0x4f645f[_0xe521('0x10')][_0xe521('0x12')]);}else{logger[_0xe521('0xc')](_0xe521('0xd'),_0x32410b,'request\x20sent');_0x3cbfd8(_0x4f645f['result'][_0xe521('0x12')]);}})[_0xe521('0x13')](function(_0x558c94){logger[_0xe521('0x10')](_0xe521('0xd'),_0x32410b,_0x558c94);_0x4be6d7(_0x558c94);});});}exports[_0xe521('0x14')]=function(_0x592283){var _0x1d5b58=this;return new Promise(function(_0x21abc9,_0xf0a363){return db['Template'][_0xe521('0x15')]({'raw':_0x592283['options']?_0x592283[_0xe521('0x16')][_0xe521('0x17')]===undefined?!![]:![]:!![],'where':_0x592283['options']?_0x592283[_0xe521('0x16')]['where']||null:null,'attributes':_0x592283[_0xe521('0x16')]?_0x592283['options']['attributes']||null:null,'limit':_0x592283['options']?_0x592283['options'][_0xe521('0x18')]||null:null,'include':_0x592283[_0xe521('0x16')]?_0x592283[_0xe521('0x16')][_0xe521('0x19')]?_['map'](_0x592283[_0xe521('0x16')][_0xe521('0x19')],function(_0x3425fa){return{'model':db[_0x3425fa[_0xe521('0x1a')]],'as':_0x3425fa['as'],'attributes':_0x3425fa[_0xe521('0x1b')],'include':_0x3425fa[_0xe521('0x19')]?_[_0xe521('0x1c')](_0x3425fa['include'],function(_0x29cc9f){return{'model':db[_0x29cc9f['model']],'as':_0x29cc9f['as'],'attributes':_0x29cc9f['attributes'],'include':_0x29cc9f[_0xe521('0x19')]?_['map'](_0x29cc9f[_0xe521('0x19')],function(_0x2b326e){return{'model':db[_0x2b326e[_0xe521('0x1a')]],'as':_0x2b326e['as'],'attributes':_0x2b326e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe521('0xb')](function(_0x4538c2){logger['info'](_0xe521('0x14'),_0x592283);logger[_0xe521('0xe')](_0xe521('0x14'),_0x592283,JSON[_0xe521('0xf')](_0x4538c2));_0x21abc9(_0x4538c2);})[_0xe521('0x13')](function(_0x367a56){logger['error'](_0xe521('0x14'),_0x367a56['message'],_0x592283);_0xf0a363(_0x1d5b58[_0xe521('0x10')](0x1f4,_0x367a56[_0xe521('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 63ec651..9a98484 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 _0xc224=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update'];(function(_0x3e5d23,_0x98312f){var _0x3999d4=function(_0x193467){while(--_0x193467){_0x3e5d23['push'](_0x3e5d23['shift']());}};_0x3999d4(++_0x98312f);}(_0xc224,0xe4));var _0x4c22=function(_0x15955e,_0x34ae19){_0x15955e=_0x15955e-0x0;var _0x14ddf6=_0xc224[_0x15955e];return _0x14ddf6;};'use strict';var multer=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var path=require(_0x4c22('0x2'));var timeout=require(_0x4c22('0x3'));var express=require('express');var router=express[_0x4c22('0x4')]();var fs_extra=require(_0x4c22('0x5'));var auth=require(_0x4c22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c22('0x7'));var controller=require('./trigger.controller');router[_0x4c22('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4c22('0x8')](_0x4c22('0x9'),auth[_0x4c22('0xa')](),controller['show']);router[_0x4c22('0x8')](_0x4c22('0xb'),auth[_0x4c22('0xa')](),controller[_0x4c22('0xc')]);router[_0x4c22('0x8')](_0x4c22('0xd'),auth[_0x4c22('0xa')](),controller['getAnyConditions']);router['get'](_0x4c22('0xe'),auth['isAuthenticated'](),controller[_0x4c22('0xf')]);router[_0x4c22('0x10')]('/',auth[_0x4c22('0xa')](),controller[_0x4c22('0x11')]);router[_0x4c22('0x10')](_0x4c22('0xb'),auth[_0x4c22('0xa')](),controller[_0x4c22('0x12')]);router['post'](_0x4c22('0xd'),auth[_0x4c22('0xa')](),controller['addAnyCondition']);router[_0x4c22('0x10')]('/:id/actions',auth[_0x4c22('0xa')](),controller[_0x4c22('0x13')]);router[_0x4c22('0x14')]('/:id',auth[_0x4c22('0xa')](),controller[_0x4c22('0x15')]);router[_0x4c22('0x16')](_0x4c22('0x9'),auth[_0x4c22('0xa')](),controller[_0x4c22('0x17')]);module[_0x4c22('0x18')]=router; \ No newline at end of file +var _0x189f=['../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAction','put','update','multer','util','path','connect-timeout','express'];(function(_0x29a4ef,_0x3d3725){var _0x2dc65c=function(_0x41067f){while(--_0x41067f){_0x29a4ef['push'](_0x29a4ef['shift']());}};_0x2dc65c(++_0x3d3725);}(_0x189f,0x145));var _0xf189=function(_0x33e114,_0x77cc5a){_0x33e114=_0x33e114-0x0;var _0x17e9b6=_0x189f[_0x33e114];return _0x17e9b6;};'use strict';var multer=require(_0xf189('0x0'));var util=require(_0xf189('0x1'));var path=require(_0xf189('0x2'));var timeout=require(_0xf189('0x3'));var express=require(_0xf189('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf189('0x5'));var config=require(_0xf189('0x6'));var controller=require(_0xf189('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf189('0x8')]);router[_0xf189('0x9')](_0xf189('0xa'),auth[_0xf189('0xb')](),controller[_0xf189('0xc')]);router['get']('/:id/all_conditions',auth[_0xf189('0xb')](),controller[_0xf189('0xd')]);router['get'](_0xf189('0xe'),auth['isAuthenticated'](),controller[_0xf189('0xf')]);router[_0xf189('0x9')](_0xf189('0x10'),auth[_0xf189('0xb')](),controller['getActions']);router[_0xf189('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf189('0x11')]('/:id/all_conditions',auth[_0xf189('0xb')](),controller[_0xf189('0x12')]);router[_0xf189('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0xf189('0x11')](_0xf189('0x10'),auth[_0xf189('0xb')](),controller[_0xf189('0x13')]);router[_0xf189('0x14')](_0xf189('0xa'),auth['isAuthenticated'](),controller[_0xf189('0x15')]);router['delete'](_0xf189('0xa'),auth[_0xf189('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7f1c433..6f1b945 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 _0x82e7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x319261,_0x2b165a){var _0x4a5cc9=function(_0x54149b){while(--_0x54149b){_0x319261['push'](_0x319261['shift']());}};_0x4a5cc9(++_0x2b165a);}(_0x82e7,0xb6));var _0x782e=function(_0x190c34,_0x45d713){_0x190c34=_0x190c34-0x0;var _0x2a6c2=_0x82e7[_0x190c34];return _0x2a6c2;};'use strict';var Sequelize=require(_0x782e('0x0'));module[_0x782e('0x1')]={'name':{'type':Sequelize[_0x782e('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x782e('0x2')]},'status':{'type':Sequelize[_0x782e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf4f5=['STRING','BOOLEAN'];(function(_0x5b9fe1,_0x162a48){var _0xe6ae43=function(_0x506916){while(--_0x506916){_0x5b9fe1['push'](_0x5b9fe1['shift']());}};_0xe6ae43(++_0x162a48);}(_0xf4f5,0x1dc));var _0x5f4f=function(_0x3c04ce,_0xa085fb){_0x3c04ce=_0x3c04ce-0x0;var _0x110c0b=_0xf4f5[_0x3c04ce];return _0x110c0b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5f4f('0x0')]},'description':{'type':Sequelize[_0x5f4f('0x0')]},'status':{'type':Sequelize[_0x5f4f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 2a0dfe0..b89e87c 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 _0x1019=['reject','update','then','UserProfileResource','end','error','stack','name','index','Trigger','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','catch','show','params','keys','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','json','apply'];(function(_0x3965b2,_0x4c950b){var _0x1bea9e=function(_0x4ec9d8){while(--_0x4ec9d8){_0x3965b2['push'](_0x3965b2['shift']());}};_0x1bea9e(++_0x4c950b);}(_0x1019,0xe1));var _0x9101=function(_0xe74b4b,_0x2aa789){_0xe74b4b=_0xe74b4b-0x0;var _0xc54661=_0x1019[_0xe74b4b];return _0xc54661;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9101('0x0'));var zipdir=require(_0x9101('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9101('0x2'));var Mustache=require(_0x9101('0x3'));var util=require('util');var path=require(_0x9101('0x4'));var sox=require(_0x9101('0x5'));var csv=require(_0x9101('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9101('0x7'));var _=require('lodash');var squel=require(_0x9101('0x8'));var crypto=require('crypto');var jsforce=require(_0x9101('0x9'));var deskjs=require(_0x9101('0xa'));var toCsv=require(_0x9101('0x6'));var querystring=require(_0x9101('0xb'));var Papa=require('papaparse');var Redis=require(_0x9101('0xc'));var authService=require(_0x9101('0xd'));var qs=require(_0x9101('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9101('0xf'));var utils=require(_0x9101('0x10'));var config=require(_0x9101('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9101('0x12'))['db'];function respondWithStatusCode(_0x46ce93,_0x29eb84){_0x29eb84=_0x29eb84||0xcc;return function(_0x727c12){if(_0x727c12){return _0x46ce93['sendStatus'](_0x29eb84);}return _0x46ce93[_0x9101('0x13')](_0x29eb84)['end']();};}function respondWithResult(_0x455f75,_0x1205f9){_0x1205f9=_0x1205f9||0xc8;return function(_0x2a0a6d){if(_0x2a0a6d){return _0x455f75[_0x9101('0x13')](_0x1205f9)['json'](_0x2a0a6d);}};}function respondWithFilteredResult(_0xa52065,_0x28217f){return function(_0xf61090){if(_0xf61090){var _0x1f4619=typeof _0x28217f[_0x9101('0x14')]===_0x9101('0x15')&&typeof _0x28217f[_0x9101('0x16')]==='undefined';var _0x3d8ddd=_0xf61090[_0x9101('0x17')];var _0x4268c9=_0x1f4619?0x0:_0x28217f[_0x9101('0x14')];var _0x56e807=_0x1f4619?_0xf61090[_0x9101('0x17')]:_0x28217f['offset']+_0x28217f['limit'];var _0x45d4ed;if(_0x56e807>=_0x3d8ddd){_0x56e807=_0x3d8ddd;_0x45d4ed=0xc8;}else{_0x45d4ed=0xce;}_0xa52065[_0x9101('0x13')](_0x45d4ed);return _0xa52065[_0x9101('0x18')]('Content-Range',_0x4268c9+'-'+_0x56e807+'/'+_0x3d8ddd)[_0x9101('0x19')](_0xf61090);}return null;};}function patchUpdates(_0x202035){return function(_0x5441a0){try{jsonpatch[_0x9101('0x1a')](_0x5441a0,_0x202035,!![]);}catch(_0x2f140b){return BPromise[_0x9101('0x1b')](_0x2f140b);}return _0x5441a0['save']();};}function saveUpdates(_0x30695e,_0x1cf984){return function(_0x1c6818){if(_0x1c6818){return _0x1c6818[_0x9101('0x1c')](_0x30695e)[_0x9101('0x1d')](function(_0x5a5e99){return _0x5a5e99;});}return null;};}function removeEntity(_0x513f25,_0x9496f7){return function(_0x29ee9d){if(_0x29ee9d){return _0x29ee9d['destroy']()[_0x9101('0x1d')](function(){var _0x449286=_0x29ee9d['get']({'plain':!![]});var _0x21b693='Triggers';return db[_0x9101('0x1e')]['destroy']({'where':{'type':_0x21b693,'resourceId':_0x449286['id']}})[_0x9101('0x1d')](function(){return _0x29ee9d;});})[_0x9101('0x1d')](function(){_0x513f25['status'](0xcc)[_0x9101('0x1f')]();});}};}function handleEntityNotFound(_0x108709,_0x48648c){return function(_0x771d13){if(!_0x771d13){_0x108709['sendStatus'](0x194);}return _0x771d13;};}function handleError(_0x46e406,_0x4e9a7c){_0x4e9a7c=_0x4e9a7c||0x1f4;return function(_0x11e5ba){logger[_0x9101('0x20')](_0x11e5ba[_0x9101('0x21')]);if(_0x11e5ba[_0x9101('0x22')]){delete _0x11e5ba['name'];}_0x46e406['status'](_0x4e9a7c)['send'](_0x11e5ba);};}exports[_0x9101('0x23')]=function(_0x9278d3,_0x553def){var _0x502cd8={},_0x2ed5e2={},_0x20bc76={'count':0x0,'rows':[]};var _0x3dc1ef=_['map'](db[_0x9101('0x24')][_0x9101('0x25')],function(_0x6f572){return{'name':_0x6f572[_0x9101('0x26')],'type':_0x6f572[_0x9101('0x27')][_0x9101('0x28')]};});_0x2ed5e2[_0x9101('0x29')]=_[_0x9101('0x2a')](_0x3dc1ef,_0x9101('0x22'));_0x2ed5e2[_0x9101('0x2b')]=_['keys'](_0x9278d3[_0x9101('0x2b')]);_0x2ed5e2[_0x9101('0x2c')]=_[_0x9101('0x2d')](_0x2ed5e2[_0x9101('0x29')],_0x2ed5e2[_0x9101('0x2b')]);_0x502cd8[_0x9101('0x2e')]=_[_0x9101('0x2d')](_0x2ed5e2[_0x9101('0x29')],qs[_0x9101('0x2f')](_0x9278d3['query'][_0x9101('0x2f')]));_0x502cd8[_0x9101('0x2e')]=_0x502cd8[_0x9101('0x2e')][_0x9101('0x30')]?_0x502cd8[_0x9101('0x2e')]:_0x2ed5e2['model'];if(!_0x9278d3[_0x9101('0x2b')]['hasOwnProperty'](_0x9101('0x31'))){_0x502cd8[_0x9101('0x16')]=qs[_0x9101('0x16')](_0x9278d3[_0x9101('0x2b')][_0x9101('0x16')]);_0x502cd8[_0x9101('0x14')]=qs['offset'](_0x9278d3[_0x9101('0x2b')][_0x9101('0x14')]);}_0x502cd8[_0x9101('0x32')]=qs['sort'](_0x9278d3['query'][_0x9101('0x33')]);_0x502cd8[_0x9101('0x34')]=qs[_0x9101('0x2c')](_[_0x9101('0x35')](_0x9278d3[_0x9101('0x2b')],_0x2ed5e2[_0x9101('0x2c')]),_0x3dc1ef);if(_0x9278d3[_0x9101('0x2b')][_0x9101('0x36')]){_0x502cd8[_0x9101('0x34')]=_[_0x9101('0x37')](_0x502cd8['where'],{'$or':_['map'](_0x3dc1ef,function(_0x49b532){if(_0x49b532[_0x9101('0x27')]!=='VIRTUAL'){var _0x59b8fc={};_0x59b8fc[_0x49b532[_0x9101('0x22')]]={'$like':'%'+_0x9278d3['query'][_0x9101('0x36')]+'%'};return _0x59b8fc;}})});}_0x502cd8=_['merge']({},_0x502cd8,_0x9278d3['options']);var _0xbb80bf={'where':_0x502cd8[_0x9101('0x34')]};return db[_0x9101('0x24')]['count'](_0xbb80bf)[_0x9101('0x1d')](function(_0x4c7cac){_0x20bc76[_0x9101('0x17')]=_0x4c7cac;if(_0x9278d3[_0x9101('0x2b')][_0x9101('0x38')]){_0x502cd8[_0x9101('0x39')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x502cd8);})[_0x9101('0x1d')](function(_0x36f097){_0x20bc76['rows']=_0x36f097;return _0x20bc76;})[_0x9101('0x1d')](respondWithFilteredResult(_0x553def,_0x502cd8))[_0x9101('0x3a')](handleError(_0x553def,null));};exports[_0x9101('0x3b')]=function(_0x5b40bf,_0x2ebcd2){var _0xc96ad2={'raw':![],'where':{'id':_0x5b40bf[_0x9101('0x3c')]['id']}},_0x33f0c1={};_0x33f0c1[_0x9101('0x29')]=_[_0x9101('0x3d')](db['Trigger'][_0x9101('0x25')]);_0x33f0c1[_0x9101('0x2b')]=_[_0x9101('0x3d')](_0x5b40bf[_0x9101('0x2b')]);_0x33f0c1[_0x9101('0x2c')]=_[_0x9101('0x2d')](_0x33f0c1[_0x9101('0x29')],_0x33f0c1['query']);_0xc96ad2['attributes']=_['intersection'](_0x33f0c1[_0x9101('0x29')],qs['fields'](_0x5b40bf[_0x9101('0x2b')][_0x9101('0x2f')]));_0xc96ad2[_0x9101('0x2e')]=_0xc96ad2[_0x9101('0x2e')][_0x9101('0x30')]?_0xc96ad2[_0x9101('0x2e')]:_0x33f0c1[_0x9101('0x29')];if(_0x5b40bf[_0x9101('0x2b')][_0x9101('0x38')]){_0xc96ad2['include']=[{'all':!![]}];}_0xc96ad2=_[_0x9101('0x37')]({},_0xc96ad2,_0x5b40bf[_0x9101('0x3e')]);return db[_0x9101('0x24')][_0x9101('0x3f')](_0xc96ad2)['then'](handleEntityNotFound(_0x2ebcd2,null))[_0x9101('0x1d')](respondWithResult(_0x2ebcd2,null))[_0x9101('0x3a')](handleError(_0x2ebcd2,null));};exports[_0x9101('0x40')]=function(_0x589ed7,_0x5b24f1){return db[_0x9101('0x24')][_0x9101('0x40')](_0x589ed7['body'],{})['then'](function(_0x4191e0){var _0xb551e3=_0x589ed7[_0x9101('0x41')][_0x9101('0x42')]({'plain':!![]});if(!_0xb551e3)throw new Error(_0x9101('0x43'));if(_0xb551e3[_0x9101('0x44')]===_0x9101('0x41')){var _0x663088=_0x4191e0[_0x9101('0x42')]({'plain':!![]});var _0x459b2c=_0x9101('0x45');return db['UserProfileSection'][_0x9101('0x3f')]({'where':{'name':_0x459b2c,'userProfileId':_0xb551e3['userProfileId']},'raw':!![]})[_0x9101('0x1d')](function(_0x3fde05){if(_0x3fde05&&_0x3fde05['autoAssociation']===0x0){return db[_0x9101('0x1e')]['create']({'name':_0x663088[_0x9101('0x22')],'resourceId':_0x663088['id'],'type':_0x3fde05[_0x9101('0x22')],'sectionId':_0x3fde05['id']},{})['then'](function(){return _0x4191e0;});}else{return _0x4191e0;}})[_0x9101('0x3a')](function(_0x14a8f0){logger['error'](_0x9101('0x46'),_0x14a8f0);throw _0x14a8f0;});}return _0x4191e0;})[_0x9101('0x1d')](respondWithResult(_0x5b24f1,0xc9))['catch'](handleError(_0x5b24f1,null));};exports['update']=function(_0x252843,_0x33dfb8){if(_0x252843[_0x9101('0x47')]['id']){delete _0x252843[_0x9101('0x47')]['id'];}return db[_0x9101('0x24')][_0x9101('0x3f')]({'where':{'id':_0x252843[_0x9101('0x3c')]['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x33dfb8,null))['then'](saveUpdates(_0x252843[_0x9101('0x47')],null))['then'](respondWithResult(_0x33dfb8,null))[_0x9101('0x3a')](handleError(_0x33dfb8,null));};exports[_0x9101('0x48')]=function(_0x2b769d,_0x5b2b46){return db[_0x9101('0x24')][_0x9101('0x3f')]({'where':{'id':_0x2b769d[_0x9101('0x3c')]['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x5b2b46,null))[_0x9101('0x1d')](removeEntity(_0x5b2b46,null))[_0x9101('0x3a')](handleError(_0x5b2b46,null));};exports['addAllCondition']=function(_0x248de5,_0x1d5b08,_0x52cd28){if(_0x248de5[_0x9101('0x47')]['id']){delete _0x248de5[_0x9101('0x47')]['id'];}return db[_0x9101('0x24')][_0x9101('0x3f')]({'where':{'id':_0x248de5['params']['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x1d5b08,null))[_0x9101('0x1d')](function(_0x252092){if(_0x252092){_0x248de5[_0x9101('0x47')][_0x9101('0x49')]=_0x252092['id'];return db['Condition'][_0x9101('0x40')](_0x248de5['body']);}})[_0x9101('0x1d')](respondWithResult(_0x1d5b08,null))[_0x9101('0x3a')](handleError(_0x1d5b08,null));};exports[_0x9101('0x4a')]=function(_0x12836c,_0x628041,_0x14440d){if(_0x12836c['body']['id']){delete _0x12836c[_0x9101('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x12836c[_0x9101('0x3c')]['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x628041,null))['then'](function(_0x1fdcc3){if(_0x1fdcc3){_0x12836c[_0x9101('0x47')]['TriggerAnyId']=_0x1fdcc3['id'];return db[_0x9101('0x4b')][_0x9101('0x40')](_0x12836c[_0x9101('0x47')]);}})[_0x9101('0x1d')](respondWithResult(_0x628041,null))[_0x9101('0x3a')](handleError(_0x628041,null));};exports[_0x9101('0x4c')]=function(_0x41a83a,_0x335834,_0x525d94){var _0x5015cf={};var _0x1f9af0={};var _0x39047e;var _0x3b7545;return db[_0x9101('0x24')][_0x9101('0x4d')]({'where':{'id':_0x41a83a[_0x9101('0x3c')]['id']}})['then'](handleEntityNotFound(_0x335834,null))[_0x9101('0x1d')](function(_0x561010){if(_0x561010){_0x39047e=_0x561010;_0x1f9af0[_0x9101('0x29')]=_['keys'](db[_0x9101('0x4b')][_0x9101('0x25')]);_0x1f9af0[_0x9101('0x2b')]=_[_0x9101('0x3d')](_0x41a83a['query']);_0x1f9af0[_0x9101('0x2c')]=_[_0x9101('0x2d')](_0x1f9af0[_0x9101('0x29')],_0x1f9af0['query']);_0x5015cf[_0x9101('0x2e')]=_[_0x9101('0x2d')](_0x1f9af0['model'],qs[_0x9101('0x2f')](_0x41a83a[_0x9101('0x2b')]['fields']));_0x5015cf['attributes']=_0x5015cf[_0x9101('0x2e')][_0x9101('0x30')]?_0x5015cf['attributes']:_0x1f9af0['model'];_0x5015cf[_0x9101('0x32')]=qs[_0x9101('0x33')](_0x41a83a['query'][_0x9101('0x33')]);_0x5015cf['where']=qs[_0x9101('0x2c')](_[_0x9101('0x35')](_0x41a83a[_0x9101('0x2b')],_0x1f9af0[_0x9101('0x2c')]));if(_0x41a83a[_0x9101('0x2b')][_0x9101('0x36')]){_0x5015cf['where']=_['merge'](_0x5015cf[_0x9101('0x34')],{'$or':_[_0x9101('0x2a')](_0x5015cf[_0x9101('0x2e')],function(_0x506d9f){var _0x56ca2e={};_0x56ca2e[_0x506d9f]={'$like':'%'+_0x41a83a[_0x9101('0x2b')]['filter']+'%'};return _0x56ca2e;})});}_0x5015cf=_['merge']({},_0x5015cf,_0x41a83a[_0x9101('0x3e')]);return _0x39047e[_0x9101('0x4c')](_0x5015cf);}})[_0x9101('0x1d')](function(_0x2872e8){if(_0x2872e8){_0x3b7545=_0x2872e8[_0x9101('0x30')];if(!_0x41a83a[_0x9101('0x2b')][_0x9101('0x4e')](_0x9101('0x31'))){_0x5015cf[_0x9101('0x16')]=qs[_0x9101('0x16')](_0x41a83a[_0x9101('0x2b')][_0x9101('0x16')]);_0x5015cf[_0x9101('0x14')]=qs['offset'](_0x41a83a[_0x9101('0x2b')][_0x9101('0x14')]);}return _0x39047e[_0x9101('0x4c')](_0x5015cf);}})['then'](function(_0x113fcc){if(_0x113fcc){return _0x113fcc?{'count':_0x3b7545,'rows':_0x113fcc}:null;}})[_0x9101('0x1d')](respondWithResult(_0x335834,null))[_0x9101('0x3a')](handleError(_0x335834,null));};exports[_0x9101('0x4f')]=function(_0x3b403e,_0x44cbe9,_0xf6f044){var _0x1e62ae={};var _0x14f8aa={};var _0x1c4710;var _0x98a0d7;return db['Trigger'][_0x9101('0x4d')]({'where':{'id':_0x3b403e['params']['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x44cbe9,null))[_0x9101('0x1d')](function(_0x56dcf5){if(_0x56dcf5){_0x1c4710=_0x56dcf5;_0x14f8aa[_0x9101('0x29')]=_[_0x9101('0x3d')](db['Condition'][_0x9101('0x25')]);_0x14f8aa[_0x9101('0x2b')]=_[_0x9101('0x3d')](_0x3b403e[_0x9101('0x2b')]);_0x14f8aa[_0x9101('0x2c')]=_['intersection'](_0x14f8aa['model'],_0x14f8aa[_0x9101('0x2b')]);_0x1e62ae[_0x9101('0x2e')]=_[_0x9101('0x2d')](_0x14f8aa[_0x9101('0x29')],qs[_0x9101('0x2f')](_0x3b403e[_0x9101('0x2b')][_0x9101('0x2f')]));_0x1e62ae['attributes']=_0x1e62ae['attributes'][_0x9101('0x30')]?_0x1e62ae[_0x9101('0x2e')]:_0x14f8aa[_0x9101('0x29')];_0x1e62ae['order']=qs['sort'](_0x3b403e['query'][_0x9101('0x33')]);_0x1e62ae[_0x9101('0x34')]=qs[_0x9101('0x2c')](_[_0x9101('0x35')](_0x3b403e[_0x9101('0x2b')],_0x14f8aa[_0x9101('0x2c')]));if(_0x3b403e['query'][_0x9101('0x36')]){_0x1e62ae['where']=_[_0x9101('0x37')](_0x1e62ae['where'],{'$or':_['map'](_0x1e62ae[_0x9101('0x2e')],function(_0x132f8f){var _0x24dbe1={};_0x24dbe1[_0x132f8f]={'$like':'%'+_0x3b403e[_0x9101('0x2b')][_0x9101('0x36')]+'%'};return _0x24dbe1;})});}_0x1e62ae=_[_0x9101('0x37')]({},_0x1e62ae,_0x3b403e[_0x9101('0x3e')]);return _0x1c4710['getAnyConditions'](_0x1e62ae);}})[_0x9101('0x1d')](function(_0x42a8d1){if(_0x42a8d1){_0x98a0d7=_0x42a8d1[_0x9101('0x30')];if(!_0x3b403e[_0x9101('0x2b')][_0x9101('0x4e')](_0x9101('0x31'))){_0x1e62ae[_0x9101('0x16')]=qs['limit'](_0x3b403e[_0x9101('0x2b')][_0x9101('0x16')]);_0x1e62ae['offset']=qs[_0x9101('0x14')](_0x3b403e['query'][_0x9101('0x14')]);}return _0x1c4710[_0x9101('0x4f')](_0x1e62ae);}})['then'](function(_0x923818){if(_0x923818){return _0x923818?{'count':_0x98a0d7,'rows':_0x923818}:null;}})['then'](respondWithResult(_0x44cbe9,null))[_0x9101('0x3a')](handleError(_0x44cbe9,null));};exports[_0x9101('0x50')]=function(_0x10505b,_0x13a108,_0xdfd422){if(_0x10505b[_0x9101('0x47')]['id']){delete _0x10505b[_0x9101('0x47')]['id'];}return db[_0x9101('0x24')][_0x9101('0x3f')]({'where':{'id':_0x10505b[_0x9101('0x3c')]['id']}})['then'](handleEntityNotFound(_0x13a108,null))[_0x9101('0x1d')](function(_0x731213){if(_0x731213){_0x10505b[_0x9101('0x47')][_0x9101('0x51')]=_0x731213['id'];return db[_0x9101('0x52')]['create'](_0x10505b[_0x9101('0x47')]);}})[_0x9101('0x1d')](respondWithResult(_0x13a108,null))[_0x9101('0x3a')](handleError(_0x13a108,null));};exports['getActions']=function(_0x39e324,_0x10a2e4,_0x38a1a6){var _0xc40177={};var _0x2c1ee0={};var _0x100878;var _0x2fed7e;return db[_0x9101('0x24')][_0x9101('0x4d')]({'where':{'id':_0x39e324[_0x9101('0x3c')]['id']}})[_0x9101('0x1d')](handleEntityNotFound(_0x10a2e4,null))[_0x9101('0x1d')](function(_0x3db6bb){if(_0x3db6bb){_0x100878=_0x3db6bb;_0x2c1ee0[_0x9101('0x29')]=_['keys'](db[_0x9101('0x52')][_0x9101('0x25')]);_0x2c1ee0[_0x9101('0x2b')]=_[_0x9101('0x3d')](_0x39e324[_0x9101('0x2b')]);_0x2c1ee0[_0x9101('0x2c')]=_[_0x9101('0x2d')](_0x2c1ee0['model'],_0x2c1ee0[_0x9101('0x2b')]);_0xc40177['attributes']=_[_0x9101('0x2d')](_0x2c1ee0['model'],qs[_0x9101('0x2f')](_0x39e324['query']['fields']));_0xc40177[_0x9101('0x2e')]=_0xc40177[_0x9101('0x2e')][_0x9101('0x30')]?_0xc40177['attributes']:_0x2c1ee0[_0x9101('0x29')];_0xc40177[_0x9101('0x32')]=qs['sort'](_0x39e324[_0x9101('0x2b')][_0x9101('0x33')]);_0xc40177[_0x9101('0x34')]=qs['filters'](_[_0x9101('0x35')](_0x39e324[_0x9101('0x2b')],_0x2c1ee0['filters']));if(_0x39e324[_0x9101('0x2b')][_0x9101('0x36')]){_0xc40177['where']=_['merge'](_0xc40177[_0x9101('0x34')],{'$or':_[_0x9101('0x2a')](_0xc40177[_0x9101('0x2e')],function(_0x3cf05f){var _0x3fec33={};_0x3fec33[_0x3cf05f]={'$like':'%'+_0x39e324[_0x9101('0x2b')][_0x9101('0x36')]+'%'};return _0x3fec33;})});}_0xc40177=_['merge']({},_0xc40177,_0x39e324[_0x9101('0x3e')]);return _0x100878[_0x9101('0x53')](_0xc40177);}})[_0x9101('0x1d')](function(_0x4922df){if(_0x4922df){_0x2fed7e=_0x4922df['length'];if(!_0x39e324[_0x9101('0x2b')]['hasOwnProperty']('nolimit')){_0xc40177[_0x9101('0x16')]=qs['limit'](_0x39e324['query']['limit']);_0xc40177[_0x9101('0x14')]=qs[_0x9101('0x14')](_0x39e324[_0x9101('0x2b')]['offset']);}return _0x100878[_0x9101('0x53')](_0xc40177);}})[_0x9101('0x1d')](function(_0xb5582a){if(_0xb5582a){return _0xb5582a?{'count':_0x2fed7e,'rows':_0xb5582a}:null;}})[_0x9101('0x1d')](respondWithResult(_0x10a2e4,null))[_0x9101('0x3a')](handleError(_0x10a2e4,null));}; \ No newline at end of file +var _0xd709=['index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','hasOwnProperty','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','Triggers','UserProfileResource','error','name','send'];(function(_0x4148b1,_0x27cf0b){var _0x5d2fe1=function(_0xbe01b){while(--_0xbe01b){_0x4148b1['push'](_0x4148b1['shift']());}};_0x5d2fe1(++_0x27cf0b);}(_0xd709,0x96));var _0x9d70=function(_0x5cd85a,_0xa6a4ef){_0x5cd85a=_0x5cd85a-0x0;var _0x46bc87=_0xd709[_0x5cd85a];return _0x46bc87;};'use strict';var emlformat=require(_0x9d70('0x0'));var rimraf=require(_0x9d70('0x1'));var zipdir=require(_0x9d70('0x2'));var jsonpatch=require(_0x9d70('0x3'));var rp=require(_0x9d70('0x4'));var moment=require(_0x9d70('0x5'));var BPromise=require(_0x9d70('0x6'));var Mustache=require(_0x9d70('0x7'));var util=require(_0x9d70('0x8'));var path=require(_0x9d70('0x9'));var sox=require('sox');var csv=require(_0x9d70('0xa'));var ejs=require(_0x9d70('0xb'));var fs=require('fs');var fs_extra=require(_0x9d70('0xc'));var _=require(_0x9d70('0xd'));var squel=require(_0x9d70('0xe'));var crypto=require('crypto');var jsforce=require(_0x9d70('0xf'));var deskjs=require(_0x9d70('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9d70('0x11'));var Papa=require(_0x9d70('0x12'));var Redis=require('ioredis');var authService=require(_0x9d70('0x13'));var qs=require(_0x9d70('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d70('0x15'))(_0x9d70('0x16'));var utils=require('../../config/utils');var config=require(_0x9d70('0x17'));var licenseUtil=require(_0x9d70('0x18'));var db=require(_0x9d70('0x19'))['db'];function respondWithStatusCode(_0x13cda1,_0x3fcf84){_0x3fcf84=_0x3fcf84||0xcc;return function(_0x23afd4){if(_0x23afd4){return _0x13cda1[_0x9d70('0x1a')](_0x3fcf84);}return _0x13cda1[_0x9d70('0x1b')](_0x3fcf84)[_0x9d70('0x1c')]();};}function respondWithResult(_0x30328b,_0x346b0e){_0x346b0e=_0x346b0e||0xc8;return function(_0x5dcb2b){if(_0x5dcb2b){return _0x30328b[_0x9d70('0x1b')](_0x346b0e)[_0x9d70('0x1d')](_0x5dcb2b);}};}function respondWithFilteredResult(_0x5a001d,_0x49963e){return function(_0x3e477a){if(_0x3e477a){var _0xd259db=typeof _0x49963e[_0x9d70('0x1e')]===_0x9d70('0x1f')&&typeof _0x49963e['limit']===_0x9d70('0x1f');var _0x53773a=_0x3e477a[_0x9d70('0x20')];var _0x3cbf9f=_0xd259db?0x0:_0x49963e['offset'];var _0x3456e9=_0xd259db?_0x3e477a[_0x9d70('0x20')]:_0x49963e['offset']+_0x49963e[_0x9d70('0x21')];var _0x2c2d38;if(_0x3456e9>=_0x53773a){_0x3456e9=_0x53773a;_0x2c2d38=0xc8;}else{_0x2c2d38=0xce;}_0x5a001d[_0x9d70('0x1b')](_0x2c2d38);return _0x5a001d[_0x9d70('0x22')](_0x9d70('0x23'),_0x3cbf9f+'-'+_0x3456e9+'/'+_0x53773a)[_0x9d70('0x1d')](_0x3e477a);}return null;};}function patchUpdates(_0x476838){return function(_0xd4d13b){try{jsonpatch['apply'](_0xd4d13b,_0x476838,!![]);}catch(_0x3b3211){return BPromise[_0x9d70('0x24')](_0x3b3211);}return _0xd4d13b[_0x9d70('0x25')]();};}function saveUpdates(_0x51a385,_0x3ce447){return function(_0x2b1666){if(_0x2b1666){return _0x2b1666[_0x9d70('0x26')](_0x51a385)[_0x9d70('0x27')](function(_0x184627){return _0x184627;});}return null;};}function removeEntity(_0x4a0b06,_0x131f61){return function(_0x3b9085){if(_0x3b9085){return _0x3b9085[_0x9d70('0x28')]()['then'](function(){var _0x4875b1=_0x3b9085['get']({'plain':!![]});var _0x511175=_0x9d70('0x29');return db[_0x9d70('0x2a')][_0x9d70('0x28')]({'where':{'type':_0x511175,'resourceId':_0x4875b1['id']}})[_0x9d70('0x27')](function(){return _0x3b9085;});})[_0x9d70('0x27')](function(){_0x4a0b06['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27da2b,_0x2d7a12){return function(_0x3b4e57){if(!_0x3b4e57){_0x27da2b[_0x9d70('0x1a')](0x194);}return _0x3b4e57;};}function handleError(_0x51fbb2,_0x4acadd){_0x4acadd=_0x4acadd||0x1f4;return function(_0x1e98db){logger[_0x9d70('0x2b')](_0x1e98db['stack']);if(_0x1e98db[_0x9d70('0x2c')]){delete _0x1e98db[_0x9d70('0x2c')];}_0x51fbb2[_0x9d70('0x1b')](_0x4acadd)[_0x9d70('0x2d')](_0x1e98db);};}exports[_0x9d70('0x2e')]=function(_0x27f107,_0x5accc3){var _0x54d4cf={},_0x368825={},_0x3967f5={'count':0x0,'rows':[]};var _0x1d4680=_[_0x9d70('0x2f')](db[_0x9d70('0x30')][_0x9d70('0x31')],function(_0x1695e8){return{'name':_0x1695e8[_0x9d70('0x32')],'type':_0x1695e8[_0x9d70('0x33')]['key']};});_0x368825[_0x9d70('0x34')]=_[_0x9d70('0x2f')](_0x1d4680,_0x9d70('0x2c'));_0x368825[_0x9d70('0x35')]=_[_0x9d70('0x36')](_0x27f107[_0x9d70('0x35')]);_0x368825[_0x9d70('0x37')]=_[_0x9d70('0x38')](_0x368825[_0x9d70('0x34')],_0x368825['query']);_0x54d4cf['attributes']=_['intersection'](_0x368825[_0x9d70('0x34')],qs['fields'](_0x27f107[_0x9d70('0x35')][_0x9d70('0x39')]));_0x54d4cf[_0x9d70('0x3a')]=_0x54d4cf['attributes'][_0x9d70('0x3b')]?_0x54d4cf[_0x9d70('0x3a')]:_0x368825[_0x9d70('0x34')];if(!_0x27f107[_0x9d70('0x35')]['hasOwnProperty'](_0x9d70('0x3c'))){_0x54d4cf[_0x9d70('0x21')]=qs[_0x9d70('0x21')](_0x27f107['query']['limit']);_0x54d4cf[_0x9d70('0x1e')]=qs['offset'](_0x27f107['query'][_0x9d70('0x1e')]);}_0x54d4cf[_0x9d70('0x3d')]=qs[_0x9d70('0x3e')](_0x27f107[_0x9d70('0x35')][_0x9d70('0x3e')]);_0x54d4cf[_0x9d70('0x3f')]=qs['filters'](_[_0x9d70('0x40')](_0x27f107[_0x9d70('0x35')],_0x368825['filters']),_0x1d4680);if(_0x27f107[_0x9d70('0x35')][_0x9d70('0x41')]){_0x54d4cf[_0x9d70('0x3f')]=_['merge'](_0x54d4cf[_0x9d70('0x3f')],{'$or':_[_0x9d70('0x2f')](_0x1d4680,function(_0x206d77){if(_0x206d77[_0x9d70('0x33')]!==_0x9d70('0x42')){var _0xe08817={};_0xe08817[_0x206d77[_0x9d70('0x2c')]]={'$like':'%'+_0x27f107['query']['filter']+'%'};return _0xe08817;}})});}_0x54d4cf=_[_0x9d70('0x43')]({},_0x54d4cf,_0x27f107[_0x9d70('0x44')]);var _0x35cd4a={'where':_0x54d4cf['where']};return db[_0x9d70('0x30')]['count'](_0x35cd4a)[_0x9d70('0x27')](function(_0x56df34){_0x3967f5[_0x9d70('0x20')]=_0x56df34;if(_0x27f107['query'][_0x9d70('0x45')]){_0x54d4cf[_0x9d70('0x46')]=[{'all':!![]}];}return db[_0x9d70('0x30')][_0x9d70('0x47')](_0x54d4cf);})[_0x9d70('0x27')](function(_0x1f343d){_0x3967f5[_0x9d70('0x48')]=_0x1f343d;return _0x3967f5;})[_0x9d70('0x27')](respondWithFilteredResult(_0x5accc3,_0x54d4cf))['catch'](handleError(_0x5accc3,null));};exports[_0x9d70('0x49')]=function(_0x3ed87f,_0x2307e7){var _0x2aaf7c={'raw':![],'where':{'id':_0x3ed87f[_0x9d70('0x4a')]['id']}},_0x150cb4={};_0x150cb4[_0x9d70('0x34')]=_[_0x9d70('0x36')](db[_0x9d70('0x30')]['rawAttributes']);_0x150cb4[_0x9d70('0x35')]=_[_0x9d70('0x36')](_0x3ed87f[_0x9d70('0x35')]);_0x150cb4[_0x9d70('0x37')]=_['intersection'](_0x150cb4['model'],_0x150cb4[_0x9d70('0x35')]);_0x2aaf7c['attributes']=_[_0x9d70('0x38')](_0x150cb4['model'],qs['fields'](_0x3ed87f[_0x9d70('0x35')]['fields']));_0x2aaf7c[_0x9d70('0x3a')]=_0x2aaf7c[_0x9d70('0x3a')][_0x9d70('0x3b')]?_0x2aaf7c[_0x9d70('0x3a')]:_0x150cb4['model'];if(_0x3ed87f['query'][_0x9d70('0x45')]){_0x2aaf7c[_0x9d70('0x46')]=[{'all':!![]}];}_0x2aaf7c=_[_0x9d70('0x43')]({},_0x2aaf7c,_0x3ed87f['options']);return db[_0x9d70('0x30')][_0x9d70('0x4b')](_0x2aaf7c)[_0x9d70('0x27')](handleEntityNotFound(_0x2307e7,null))[_0x9d70('0x27')](respondWithResult(_0x2307e7,null))[_0x9d70('0x4c')](handleError(_0x2307e7,null));};exports[_0x9d70('0x4d')]=function(_0x167544,_0x5e52b0){return db['Trigger'][_0x9d70('0x4d')](_0x167544[_0x9d70('0x4e')],{})[_0x9d70('0x27')](function(_0x491e20){var _0x467f7b=_0x167544['user'][_0x9d70('0x4f')]({'plain':!![]});if(!_0x467f7b)throw new Error(_0x9d70('0x50'));if(_0x467f7b['role']===_0x9d70('0x51')){var _0x991d02=_0x491e20['get']({'plain':!![]});var _0x54b865=_0x9d70('0x29');return db[_0x9d70('0x52')][_0x9d70('0x4b')]({'where':{'name':_0x54b865,'userProfileId':_0x467f7b[_0x9d70('0x53')]},'raw':!![]})[_0x9d70('0x27')](function(_0x286235){if(_0x286235&&_0x286235[_0x9d70('0x54')]===0x0){return db[_0x9d70('0x2a')][_0x9d70('0x4d')]({'name':_0x991d02[_0x9d70('0x2c')],'resourceId':_0x991d02['id'],'type':_0x286235[_0x9d70('0x2c')],'sectionId':_0x286235['id']},{})['then'](function(){return _0x491e20;});}else{return _0x491e20;}})['catch'](function(_0xb27992){logger[_0x9d70('0x2b')](_0x9d70('0x55'),_0xb27992);throw _0xb27992;});}return _0x491e20;})['then'](respondWithResult(_0x5e52b0,0xc9))[_0x9d70('0x4c')](handleError(_0x5e52b0,null));};exports['update']=function(_0x263f5d,_0x2d30d3){if(_0x263f5d[_0x9d70('0x4e')]['id']){delete _0x263f5d[_0x9d70('0x4e')]['id'];}return db['Trigger'][_0x9d70('0x4b')]({'where':{'id':_0x263f5d[_0x9d70('0x4a')]['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x2d30d3,null))['then'](saveUpdates(_0x263f5d[_0x9d70('0x4e')],null))[_0x9d70('0x27')](respondWithResult(_0x2d30d3,null))['catch'](handleError(_0x2d30d3,null));};exports[_0x9d70('0x28')]=function(_0x2beaa8,_0x102893){return db[_0x9d70('0x30')][_0x9d70('0x4b')]({'where':{'id':_0x2beaa8[_0x9d70('0x4a')]['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x102893,null))['then'](removeEntity(_0x102893,null))['catch'](handleError(_0x102893,null));};exports[_0x9d70('0x56')]=function(_0x54d8e8,_0x3d2505,_0x2e4c4c){if(_0x54d8e8['body']['id']){delete _0x54d8e8[_0x9d70('0x4e')]['id'];}return db[_0x9d70('0x30')][_0x9d70('0x4b')]({'where':{'id':_0x54d8e8['params']['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x3d2505,null))[_0x9d70('0x27')](function(_0x49e143){if(_0x49e143){_0x54d8e8[_0x9d70('0x4e')][_0x9d70('0x57')]=_0x49e143['id'];return db[_0x9d70('0x58')]['create'](_0x54d8e8[_0x9d70('0x4e')]);}})[_0x9d70('0x27')](respondWithResult(_0x3d2505,null))[_0x9d70('0x4c')](handleError(_0x3d2505,null));};exports[_0x9d70('0x59')]=function(_0x345c82,_0xdd9ed,_0x4b7261){if(_0x345c82[_0x9d70('0x4e')]['id']){delete _0x345c82['body']['id'];}return db['Trigger'][_0x9d70('0x4b')]({'where':{'id':_0x345c82[_0x9d70('0x4a')]['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0xdd9ed,null))[_0x9d70('0x27')](function(_0x17df47){if(_0x17df47){_0x345c82[_0x9d70('0x4e')]['TriggerAnyId']=_0x17df47['id'];return db[_0x9d70('0x58')][_0x9d70('0x4d')](_0x345c82['body']);}})['then'](respondWithResult(_0xdd9ed,null))[_0x9d70('0x4c')](handleError(_0xdd9ed,null));};exports[_0x9d70('0x5a')]=function(_0x1fbd8f,_0x3d5c79,_0x205418){var _0x580133={};var _0x5a8dd1={};var _0x18264c;var _0x51a904;return db['Trigger']['findOne']({'where':{'id':_0x1fbd8f['params']['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x3d5c79,null))['then'](function(_0x528d6d){if(_0x528d6d){_0x18264c=_0x528d6d;_0x5a8dd1[_0x9d70('0x34')]=_[_0x9d70('0x36')](db[_0x9d70('0x58')][_0x9d70('0x31')]);_0x5a8dd1[_0x9d70('0x35')]=_['keys'](_0x1fbd8f['query']);_0x5a8dd1[_0x9d70('0x37')]=_[_0x9d70('0x38')](_0x5a8dd1['model'],_0x5a8dd1[_0x9d70('0x35')]);_0x580133['attributes']=_[_0x9d70('0x38')](_0x5a8dd1[_0x9d70('0x34')],qs['fields'](_0x1fbd8f[_0x9d70('0x35')][_0x9d70('0x39')]));_0x580133[_0x9d70('0x3a')]=_0x580133[_0x9d70('0x3a')]['length']?_0x580133[_0x9d70('0x3a')]:_0x5a8dd1[_0x9d70('0x34')];_0x580133[_0x9d70('0x3d')]=qs[_0x9d70('0x3e')](_0x1fbd8f[_0x9d70('0x35')][_0x9d70('0x3e')]);_0x580133['where']=qs[_0x9d70('0x37')](_[_0x9d70('0x40')](_0x1fbd8f[_0x9d70('0x35')],_0x5a8dd1[_0x9d70('0x37')]));if(_0x1fbd8f[_0x9d70('0x35')][_0x9d70('0x41')]){_0x580133[_0x9d70('0x3f')]=_['merge'](_0x580133[_0x9d70('0x3f')],{'$or':_[_0x9d70('0x2f')](_0x580133[_0x9d70('0x3a')],function(_0x383af3){var _0x7152ad={};_0x7152ad[_0x383af3]={'$like':'%'+_0x1fbd8f[_0x9d70('0x35')]['filter']+'%'};return _0x7152ad;})});}_0x580133=_[_0x9d70('0x43')]({},_0x580133,_0x1fbd8f['options']);return _0x18264c[_0x9d70('0x5a')](_0x580133);}})[_0x9d70('0x27')](function(_0x3b5075){if(_0x3b5075){_0x51a904=_0x3b5075[_0x9d70('0x3b')];if(!_0x1fbd8f[_0x9d70('0x35')][_0x9d70('0x5b')]('nolimit')){_0x580133['limit']=qs[_0x9d70('0x21')](_0x1fbd8f[_0x9d70('0x35')][_0x9d70('0x21')]);_0x580133[_0x9d70('0x1e')]=qs['offset'](_0x1fbd8f[_0x9d70('0x35')]['offset']);}return _0x18264c['getAllConditions'](_0x580133);}})[_0x9d70('0x27')](function(_0x48b7ae){if(_0x48b7ae){return _0x48b7ae?{'count':_0x51a904,'rows':_0x48b7ae}:null;}})['then'](respondWithResult(_0x3d5c79,null))[_0x9d70('0x4c')](handleError(_0x3d5c79,null));};exports[_0x9d70('0x5c')]=function(_0x4e4680,_0x2e886f,_0x2a1dfe){var _0x3700f4={};var _0x4df737={};var _0x35868f;var _0xf28f2d;return db[_0x9d70('0x30')][_0x9d70('0x5d')]({'where':{'id':_0x4e4680['params']['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x2e886f,null))[_0x9d70('0x27')](function(_0x3dfb50){if(_0x3dfb50){_0x35868f=_0x3dfb50;_0x4df737['model']=_['keys'](db['Condition'][_0x9d70('0x31')]);_0x4df737[_0x9d70('0x35')]=_[_0x9d70('0x36')](_0x4e4680['query']);_0x4df737[_0x9d70('0x37')]=_[_0x9d70('0x38')](_0x4df737[_0x9d70('0x34')],_0x4df737['query']);_0x3700f4[_0x9d70('0x3a')]=_[_0x9d70('0x38')](_0x4df737['model'],qs[_0x9d70('0x39')](_0x4e4680['query'][_0x9d70('0x39')]));_0x3700f4[_0x9d70('0x3a')]=_0x3700f4['attributes'][_0x9d70('0x3b')]?_0x3700f4[_0x9d70('0x3a')]:_0x4df737['model'];_0x3700f4[_0x9d70('0x3d')]=qs[_0x9d70('0x3e')](_0x4e4680['query'][_0x9d70('0x3e')]);_0x3700f4[_0x9d70('0x3f')]=qs[_0x9d70('0x37')](_[_0x9d70('0x40')](_0x4e4680['query'],_0x4df737[_0x9d70('0x37')]));if(_0x4e4680[_0x9d70('0x35')]['filter']){_0x3700f4[_0x9d70('0x3f')]=_[_0x9d70('0x43')](_0x3700f4[_0x9d70('0x3f')],{'$or':_[_0x9d70('0x2f')](_0x3700f4[_0x9d70('0x3a')],function(_0x377255){var _0x4b6862={};_0x4b6862[_0x377255]={'$like':'%'+_0x4e4680[_0x9d70('0x35')][_0x9d70('0x41')]+'%'};return _0x4b6862;})});}_0x3700f4=_[_0x9d70('0x43')]({},_0x3700f4,_0x4e4680[_0x9d70('0x44')]);return _0x35868f[_0x9d70('0x5c')](_0x3700f4);}})[_0x9d70('0x27')](function(_0x32ae12){if(_0x32ae12){_0xf28f2d=_0x32ae12['length'];if(!_0x4e4680['query']['hasOwnProperty']('nolimit')){_0x3700f4[_0x9d70('0x21')]=qs[_0x9d70('0x21')](_0x4e4680[_0x9d70('0x35')]['limit']);_0x3700f4['offset']=qs[_0x9d70('0x1e')](_0x4e4680[_0x9d70('0x35')]['offset']);}return _0x35868f['getAnyConditions'](_0x3700f4);}})[_0x9d70('0x27')](function(_0x50c5e7){if(_0x50c5e7){return _0x50c5e7?{'count':_0xf28f2d,'rows':_0x50c5e7}:null;}})['then'](respondWithResult(_0x2e886f,null))[_0x9d70('0x4c')](handleError(_0x2e886f,null));};exports[_0x9d70('0x5e')]=function(_0x242d2d,_0x5ad31d,_0x45dbac){if(_0x242d2d[_0x9d70('0x4e')]['id']){delete _0x242d2d[_0x9d70('0x4e')]['id'];}return db[_0x9d70('0x30')][_0x9d70('0x4b')]({'where':{'id':_0x242d2d[_0x9d70('0x4a')]['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x5ad31d,null))[_0x9d70('0x27')](function(_0x4c1d5d){if(_0x4c1d5d){_0x242d2d['body'][_0x9d70('0x5f')]=_0x4c1d5d['id'];return db[_0x9d70('0x60')][_0x9d70('0x4d')](_0x242d2d[_0x9d70('0x4e')]);}})[_0x9d70('0x27')](respondWithResult(_0x5ad31d,null))['catch'](handleError(_0x5ad31d,null));};exports[_0x9d70('0x61')]=function(_0x58d300,_0x3220ef,_0x1c496d){var _0x4261e0={};var _0x5ced00={};var _0x2dfeb9;var _0x15bd1a;return db[_0x9d70('0x30')][_0x9d70('0x5d')]({'where':{'id':_0x58d300[_0x9d70('0x4a')]['id']}})[_0x9d70('0x27')](handleEntityNotFound(_0x3220ef,null))[_0x9d70('0x27')](function(_0x1e0362){if(_0x1e0362){_0x2dfeb9=_0x1e0362;_0x5ced00[_0x9d70('0x34')]=_['keys'](db[_0x9d70('0x60')][_0x9d70('0x31')]);_0x5ced00[_0x9d70('0x35')]=_[_0x9d70('0x36')](_0x58d300[_0x9d70('0x35')]);_0x5ced00[_0x9d70('0x37')]=_[_0x9d70('0x38')](_0x5ced00[_0x9d70('0x34')],_0x5ced00[_0x9d70('0x35')]);_0x4261e0['attributes']=_[_0x9d70('0x38')](_0x5ced00[_0x9d70('0x34')],qs['fields'](_0x58d300[_0x9d70('0x35')][_0x9d70('0x39')]));_0x4261e0[_0x9d70('0x3a')]=_0x4261e0[_0x9d70('0x3a')][_0x9d70('0x3b')]?_0x4261e0[_0x9d70('0x3a')]:_0x5ced00[_0x9d70('0x34')];_0x4261e0[_0x9d70('0x3d')]=qs[_0x9d70('0x3e')](_0x58d300[_0x9d70('0x35')]['sort']);_0x4261e0[_0x9d70('0x3f')]=qs[_0x9d70('0x37')](_['pick'](_0x58d300[_0x9d70('0x35')],_0x5ced00[_0x9d70('0x37')]));if(_0x58d300['query'][_0x9d70('0x41')]){_0x4261e0[_0x9d70('0x3f')]=_[_0x9d70('0x43')](_0x4261e0['where'],{'$or':_[_0x9d70('0x2f')](_0x4261e0[_0x9d70('0x3a')],function(_0x2c6eb0){var _0x3d7139={};_0x3d7139[_0x2c6eb0]={'$like':'%'+_0x58d300[_0x9d70('0x35')][_0x9d70('0x41')]+'%'};return _0x3d7139;})});}_0x4261e0=_[_0x9d70('0x43')]({},_0x4261e0,_0x58d300[_0x9d70('0x44')]);return _0x2dfeb9[_0x9d70('0x61')](_0x4261e0);}})[_0x9d70('0x27')](function(_0xed80af){if(_0xed80af){_0x15bd1a=_0xed80af[_0x9d70('0x3b')];if(!_0x58d300[_0x9d70('0x35')]['hasOwnProperty']('nolimit')){_0x4261e0[_0x9d70('0x21')]=qs[_0x9d70('0x21')](_0x58d300['query'][_0x9d70('0x21')]);_0x4261e0[_0x9d70('0x1e')]=qs['offset'](_0x58d300[_0x9d70('0x35')][_0x9d70('0x1e')]);}return _0x2dfeb9[_0x9d70('0x61')](_0x4261e0);}})['then'](function(_0x2c5cac){if(_0x2c5cac){return _0x2c5cac?{'count':_0x15bd1a,'rows':_0x2c5cac}:null;}})['then'](respondWithResult(_0x3220ef,null))[_0x9d70('0x4c')](handleError(_0x3220ef,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2995967..9fe1f75 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 _0xf7f3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x31483d,_0x1d0201){var _0x1ed9d5=function(_0x59c889){while(--_0x59c889){_0x31483d['push'](_0x31483d['shift']());}};_0x1ed9d5(++_0x1d0201);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x48449b,_0xb5ab3f){_0x48449b=_0x48449b-0x0;var _0x5288ec=_0xf7f3[_0x48449b];return _0x5288ec;};'use strict';var _=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var moment=require(_0x3f7f('0x4'));var BPromise=require(_0x3f7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var attributes=require('./trigger.attributes');module[_0x3f7f('0x8')]=function(_0x4876e8,_0x2198f7){return _0x4876e8[_0x3f7f('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3c5=['define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x263f76,_0x2ee49f){_0x263f76=_0x263f76-0x0;var _0x4112de=_0xe3c5[_0x263f76];return _0x4112de;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'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 126ff5e..0062cdd 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 _0x4cbf=['find','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','request\x20sent','debug','error','code','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','ShowTrigger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4cbf,0xb6));var _0xf4cb=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x4cbf[_0xac151d];return _0x111dba;};'use strict';var _=require(_0xf4cb('0x0'));var util=require(_0xf4cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf4cb('0x2'));var fs=require('fs');var Redis=require(_0xf4cb('0x3'));var db=require(_0xf4cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cb('0x5'))(_0xf4cb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf4cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127ecb,_0x355067,_0x2e631b){return new BPromise(function(_0x4ecdbc,_0x36ae50){return client['request'](_0x127ecb,_0x2e631b)[_0xf4cb('0x8')](function(_0x5bcb2d){logger[_0xf4cb('0x9')]('Trigger,\x20%s,\x20%s',_0x355067,_0xf4cb('0xa'));logger[_0xf4cb('0xb')]('Trigger,\x20%s,\x20%s,\x20%s',_0x355067,_0xf4cb('0xa'),JSON['stringify'](_0x5bcb2d));if(_0x5bcb2d[_0xf4cb('0xc')]){if(_0x5bcb2d[_0xf4cb('0xc')][_0xf4cb('0xd')]===0x1f4){logger[_0xf4cb('0xc')]('Trigger,\x20%s,\x20%s',_0x355067,_0x5bcb2d[_0xf4cb('0xc')][_0xf4cb('0xe')]);return _0x36ae50(_0x5bcb2d[_0xf4cb('0xc')][_0xf4cb('0xe')]);}logger[_0xf4cb('0xc')](_0xf4cb('0xf'),_0x355067,_0x5bcb2d[_0xf4cb('0xc')]['message']);return _0x4ecdbc(_0x5bcb2d[_0xf4cb('0xc')][_0xf4cb('0xe')]);}else{logger['info'](_0xf4cb('0xf'),_0x355067,_0xf4cb('0xa'));_0x4ecdbc(_0x5bcb2d[_0xf4cb('0x10')][_0xf4cb('0xe')]);}})[_0xf4cb('0x11')](function(_0x5805c2){logger[_0xf4cb('0xc')](_0xf4cb('0xf'),_0x355067,_0x5805c2);_0x36ae50(_0x5805c2);});});}exports[_0xf4cb('0x12')]=function(_0x46be37){var _0x4e1303=this;return new Promise(function(_0x381de2,_0x3fbca1){return db[_0xf4cb('0x13')]['findAll']({'raw':_0x46be37['options']?_0x46be37[_0xf4cb('0x14')][_0xf4cb('0x15')]===undefined?!![]:![]:!![],'where':_0x46be37[_0xf4cb('0x14')]?_0x46be37[_0xf4cb('0x14')][_0xf4cb('0x16')]||null:null,'attributes':_0x46be37['options']?_0x46be37[_0xf4cb('0x14')][_0xf4cb('0x17')]||null:null,'limit':_0x46be37[_0xf4cb('0x14')]?_0x46be37[_0xf4cb('0x14')]['limit']||null:null,'include':_0x46be37['options']?_0x46be37[_0xf4cb('0x14')][_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0x46be37[_0xf4cb('0x14')][_0xf4cb('0x18')],function(_0x1c72d6){return{'model':db[_0x1c72d6[_0xf4cb('0x1a')]],'as':_0x1c72d6['as'],'attributes':_0x1c72d6[_0xf4cb('0x17')],'include':_0x1c72d6[_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0x1c72d6[_0xf4cb('0x18')],function(_0x45efa4){return{'model':db[_0x45efa4[_0xf4cb('0x1a')]],'as':_0x45efa4['as'],'attributes':_0x45efa4[_0xf4cb('0x17')],'include':_0x45efa4[_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0x45efa4[_0xf4cb('0x18')],function(_0x31ad56){return{'model':db[_0x31ad56[_0xf4cb('0x1a')]],'as':_0x31ad56['as'],'attributes':_0x31ad56[_0xf4cb('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf4cb('0x8')](function(_0x2f2567){logger[_0xf4cb('0x9')]('GetTrigger',_0x46be37);logger[_0xf4cb('0xb')](_0xf4cb('0x12'),_0x46be37,JSON['stringify'](_0x2f2567));_0x381de2(_0x2f2567);})[_0xf4cb('0x11')](function(_0x519b72){logger[_0xf4cb('0xc')]('GetTrigger',_0x519b72[_0xf4cb('0xe')],_0x46be37);_0x3fbca1(_0x4e1303['error'](0x1f4,_0x519b72['message']));});});};exports[_0xf4cb('0x1b')]=function(_0x3a1527){var _0x59d597=this;return new Promise(function(_0x39ba2d,_0x539b16){return db[_0xf4cb('0x13')][_0xf4cb('0x1c')]({'raw':_0x3a1527[_0xf4cb('0x14')]?_0x3a1527[_0xf4cb('0x14')][_0xf4cb('0x15')]===undefined?!![]:![]:!![],'where':_0x3a1527[_0xf4cb('0x14')]?_0x3a1527[_0xf4cb('0x14')][_0xf4cb('0x16')]||null:null,'attributes':_0x3a1527[_0xf4cb('0x14')]?_0x3a1527['options'][_0xf4cb('0x17')]||null:null,'include':_0x3a1527['options']?_0x3a1527[_0xf4cb('0x14')][_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0x3a1527[_0xf4cb('0x14')][_0xf4cb('0x18')],function(_0xf5735d){return{'model':db[_0xf5735d[_0xf4cb('0x1a')]],'as':_0xf5735d['as'],'attributes':_0xf5735d[_0xf4cb('0x17')],'include':_0xf5735d[_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0xf5735d[_0xf4cb('0x18')],function(_0x5a35c6){return{'model':db[_0x5a35c6[_0xf4cb('0x1a')]],'as':_0x5a35c6['as'],'attributes':_0x5a35c6[_0xf4cb('0x17')],'include':_0x5a35c6[_0xf4cb('0x18')]?_[_0xf4cb('0x19')](_0x5a35c6[_0xf4cb('0x18')],function(_0x504f0e){return{'model':db[_0x504f0e[_0xf4cb('0x1a')]],'as':_0x504f0e['as'],'attributes':_0x504f0e[_0xf4cb('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b4ac){logger[_0xf4cb('0x9')]('ShowTrigger',_0x3a1527);logger[_0xf4cb('0xb')](_0xf4cb('0x1b'),_0x3a1527,JSON[_0xf4cb('0x1d')](_0x20b4ac));_0x39ba2d(_0x20b4ac);})[_0xf4cb('0x11')](function(_0x2e571c){logger['error'](_0xf4cb('0x1b'),_0x2e571c[_0xf4cb('0xe')],_0x3a1527);_0x539b16(_0x59d597['error'](0x1f4,_0x2e571c[_0xf4cb('0xe')]));});});}; \ No newline at end of file +var _0x9134=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','include','model','map','stringify','ShowTrigger','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9134,0x129));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4913('0x0'));var util=require(_0x4913('0x1'));var moment=require(_0x4913('0x2'));var BPromise=require(_0x4913('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4913('0x4'));var db=require(_0x4913('0x5'))['db'];var utils=require(_0x4913('0x6'));var logger=require(_0x4913('0x7'))(_0x4913('0x8'));var config=require(_0x4913('0x9'));var jayson=require(_0x4913('0xa'));var client=jayson[_0x4913('0xb')][_0x4913('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b41a5,_0x39ae59,_0x138a96){return new BPromise(function(_0x1a3c6d,_0x39c42a){return client[_0x4913('0xd')](_0x1b41a5,_0x138a96)[_0x4913('0xe')](function(_0x55fd96){logger[_0x4913('0xf')](_0x4913('0x10'),_0x39ae59,'request\x20sent');logger[_0x4913('0x11')](_0x4913('0x12'),_0x39ae59,_0x4913('0x13'),JSON['stringify'](_0x55fd96));if(_0x55fd96[_0x4913('0x14')]){if(_0x55fd96[_0x4913('0x14')][_0x4913('0x15')]===0x1f4){logger[_0x4913('0x14')](_0x4913('0x10'),_0x39ae59,_0x55fd96[_0x4913('0x14')][_0x4913('0x16')]);return _0x39c42a(_0x55fd96[_0x4913('0x14')][_0x4913('0x16')]);}logger['error'](_0x4913('0x10'),_0x39ae59,_0x55fd96[_0x4913('0x14')]['message']);return _0x1a3c6d(_0x55fd96[_0x4913('0x14')][_0x4913('0x16')]);}else{logger[_0x4913('0xf')](_0x4913('0x10'),_0x39ae59,_0x4913('0x13'));_0x1a3c6d(_0x55fd96[_0x4913('0x17')][_0x4913('0x16')]);}})[_0x4913('0x18')](function(_0x28a69b){logger[_0x4913('0x14')]('Trigger,\x20%s,\x20%s',_0x39ae59,_0x28a69b);_0x39c42a(_0x28a69b);});});}exports[_0x4913('0x19')]=function(_0xa5facb){var _0x79c92f=this;return new Promise(function(_0x29f86a,_0x240f90){return db[_0x4913('0x1a')][_0x4913('0x1b')]({'raw':_0xa5facb[_0x4913('0x1c')]?_0xa5facb[_0x4913('0x1c')][_0x4913('0x1d')]===undefined?!![]:![]:!![],'where':_0xa5facb[_0x4913('0x1c')]?_0xa5facb[_0x4913('0x1c')]['where']||null:null,'attributes':_0xa5facb[_0x4913('0x1c')]?_0xa5facb[_0x4913('0x1c')][_0x4913('0x1e')]||null:null,'limit':_0xa5facb[_0x4913('0x1c')]?_0xa5facb[_0x4913('0x1c')]['limit']||null:null,'include':_0xa5facb[_0x4913('0x1c')]?_0xa5facb[_0x4913('0x1c')][_0x4913('0x1f')]?_['map'](_0xa5facb[_0x4913('0x1c')]['include'],function(_0x6aa1a6){return{'model':db[_0x6aa1a6[_0x4913('0x20')]],'as':_0x6aa1a6['as'],'attributes':_0x6aa1a6[_0x4913('0x1e')],'include':_0x6aa1a6['include']?_[_0x4913('0x21')](_0x6aa1a6[_0x4913('0x1f')],function(_0x38ae99){return{'model':db[_0x38ae99[_0x4913('0x20')]],'as':_0x38ae99['as'],'attributes':_0x38ae99[_0x4913('0x1e')],'include':_0x38ae99[_0x4913('0x1f')]?_[_0x4913('0x21')](_0x38ae99[_0x4913('0x1f')],function(_0x46f759){return{'model':db[_0x46f759[_0x4913('0x20')]],'as':_0x46f759['as'],'attributes':_0x46f759['attributes']};}):[]};}):[]};}):[]:[]})[_0x4913('0xe')](function(_0x527e19){logger[_0x4913('0xf')]('GetTrigger',_0xa5facb);logger[_0x4913('0x11')](_0x4913('0x19'),_0xa5facb,JSON[_0x4913('0x22')](_0x527e19));_0x29f86a(_0x527e19);})[_0x4913('0x18')](function(_0x1bcafb){logger[_0x4913('0x14')](_0x4913('0x19'),_0x1bcafb[_0x4913('0x16')],_0xa5facb);_0x240f90(_0x79c92f['error'](0x1f4,_0x1bcafb[_0x4913('0x16')]));});});};exports[_0x4913('0x23')]=function(_0x502ae9){var _0x40164c=this;return new Promise(function(_0x432907,_0x185143){return db['Trigger'][_0x4913('0x24')]({'raw':_0x502ae9['options']?_0x502ae9[_0x4913('0x1c')][_0x4913('0x1d')]===undefined?!![]:![]:!![],'where':_0x502ae9['options']?_0x502ae9[_0x4913('0x1c')][_0x4913('0x25')]||null:null,'attributes':_0x502ae9[_0x4913('0x1c')]?_0x502ae9[_0x4913('0x1c')][_0x4913('0x1e')]||null:null,'include':_0x502ae9['options']?_0x502ae9[_0x4913('0x1c')][_0x4913('0x1f')]?_[_0x4913('0x21')](_0x502ae9['options'][_0x4913('0x1f')],function(_0x11c429){return{'model':db[_0x11c429['model']],'as':_0x11c429['as'],'attributes':_0x11c429[_0x4913('0x1e')],'include':_0x11c429['include']?_[_0x4913('0x21')](_0x11c429[_0x4913('0x1f')],function(_0x3e3346){return{'model':db[_0x3e3346[_0x4913('0x20')]],'as':_0x3e3346['as'],'attributes':_0x3e3346['attributes'],'include':_0x3e3346['include']?_['map'](_0x3e3346[_0x4913('0x1f')],function(_0x484272){return{'model':db[_0x484272[_0x4913('0x20')]],'as':_0x484272['as'],'attributes':_0x484272[_0x4913('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b2d8){logger[_0x4913('0xf')](_0x4913('0x23'),_0x502ae9);logger[_0x4913('0x11')]('ShowTrigger',_0x502ae9,JSON[_0x4913('0x22')](_0x17b2d8));_0x432907(_0x17b2d8);})[_0x4913('0x18')](function(_0x1d5a91){logger['error']('ShowTrigger',_0x1d5a91[_0x4913('0x16')],_0x502ae9);_0x185143(_0x40164c[_0x4913('0x14')](0x1f4,_0x1d5a91[_0x4913('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3c4f4f8..73d41e2 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 _0xb4e6=['Router','../../config/environment','./trunk.controller','get','isAuthenticated','show','/:id/clone','clone','post','put','/:id','update','destroy','util','path','connect-timeout','express'];(function(_0x1ecc5f,_0x4685cf){var _0x5effb6=function(_0x39de9c){while(--_0x39de9c){_0x1ecc5f['push'](_0x1ecc5f['shift']());}};_0x5effb6(++_0x4685cf);}(_0xb4e6,0x1c7));var _0x6b4e=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xb4e6[_0x1acc2d];return _0xabfa6d;};'use strict';var multer=require('multer');var util=require(_0x6b4e('0x0'));var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6b4e('0x5'));var controller=require(_0x6b4e('0x6'));router[_0x6b4e('0x7')]('/',auth[_0x6b4e('0x8')](),controller['index']);router[_0x6b4e('0x7')]('/:id',auth[_0x6b4e('0x8')](),controller[_0x6b4e('0x9')]);router['post'](_0x6b4e('0xa'),auth[_0x6b4e('0x8')](),controller[_0x6b4e('0xb')]);router[_0x6b4e('0xc')]('/',auth[_0x6b4e('0x8')](),controller['create']);router[_0x6b4e('0xd')](_0x6b4e('0xe'),auth[_0x6b4e('0x8')](),controller[_0x6b4e('0xf')]);router['delete'](_0x6b4e('0xe'),auth[_0x6b4e('0x8')](),controller[_0x6b4e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7cb1=['post','/:id/clone','clone','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','show'];(function(_0x3987bd,_0x4f4c39){var _0xae3e64=function(_0x409765){while(--_0x409765){_0x3987bd['push'](_0x3987bd['shift']());}};_0xae3e64(++_0x4f4c39);}(_0x7cb1,0x14b));var _0x17cb=function(_0x4ee532,_0xc8c938){_0x4ee532=_0x4ee532-0x0;var _0x277ac2=_0x7cb1[_0x4ee532];return _0x277ac2;};'use strict';var multer=require('multer');var util=require(_0x17cb('0x0'));var path=require(_0x17cb('0x1'));var timeout=require(_0x17cb('0x2'));var express=require(_0x17cb('0x3'));var router=express[_0x17cb('0x4')]();var fs_extra=require(_0x17cb('0x5'));var auth=require(_0x17cb('0x6'));var interaction=require(_0x17cb('0x7'));var config=require(_0x17cb('0x8'));var controller=require(_0x17cb('0x9'));router['get']('/',auth[_0x17cb('0xa')](),controller[_0x17cb('0xb')]);router[_0x17cb('0xc')]('/:id',auth[_0x17cb('0xa')](),controller[_0x17cb('0xd')]);router[_0x17cb('0xe')](_0x17cb('0xf'),auth['isAuthenticated'](),controller[_0x17cb('0x10')]);router[_0x17cb('0xe')]('/',auth[_0x17cb('0xa')](),controller[_0x17cb('0x11')]);router[_0x17cb('0x12')]('/:id',auth[_0x17cb('0xa')](),controller[_0x17cb('0x13')]);router['delete'](_0x17cb('0x14'),auth['isAuthenticated'](),controller[_0x17cb('0x15')]);module[_0x17cb('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b8e1cf4..df7dc5d 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 _0xd2dc=['actpass','dynamic','update,nonat','BOOLEAN','name','friend','user','STRING','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','getDataValue','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','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','certificate','passive'];(function(_0x4af87a,_0x387397){var _0x9bcf38=function(_0x555fa5){while(--_0x555fa5){_0x4af87a['push'](_0x4af87a['shift']());}};_0x9bcf38(++_0x387397);}(_0xd2dc,0x136));var _0xcd2d=function(_0x2848aa,_0x29d0de){_0x2848aa=_0x2848aa-0x0;var _0x4944e7=_0xd2dc[_0x2848aa];return _0x4944e7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcd2d('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcd2d('0x1'),_0xcd2d('0x2'),'peer'),'allowNull':![],'defaultValue':_0xcd2d('0x1')},'context':{'type':Sequelize[_0xcd2d('0x3')],'allowNull':![],'defaultValue':_0xcd2d('0x4')},'callingpres':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x6'),_0xcd2d('0x7'),_0xcd2d('0x8'),_0xcd2d('0x9'),_0xcd2d('0xa'),_0xcd2d('0xb'),_0xcd2d('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcd2d('0x3')]},'remotesecret':{'type':Sequelize[_0xcd2d('0x3')]},'transport':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0xd'),'set':function(_0x4d6829){this[_0xcd2d('0xe')](_0xcd2d('0xf'),_0x4d6829?_0x4d6829[_0xcd2d('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xcd2d('0xf'))?this['getDataValue'](_0xcd2d('0xf'))[_0xcd2d('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x12'),_0xcd2d('0x13'),'shortinfo',_0xcd2d('0x14'),_0xcd2d('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no',_0xcd2d('0x17'),_0xcd2d('0x18'),_0xcd2d('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcd2d('0x3')]},'directmediadeny':{'type':Sequelize[_0xcd2d('0x3')]},'nat':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0x1a'),'set':function(_0x12abea){this[_0xcd2d('0xe')](_0xcd2d('0x1b'),_0x12abea?_0x12abea['join'](','):null);},'get':function(){return this[_0xcd2d('0x1c')](_0xcd2d('0x1b'))?this['getDataValue'](_0xcd2d('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcd2d('0x3')]},'namedcallgroup':{'type':Sequelize[_0xcd2d('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0x1d')},'allow':{'type':Sequelize[_0xcd2d('0x3')],'allowNull':![],'defaultValue':_0xcd2d('0x1e'),'set':function(_0x36eb26){this[_0xcd2d('0xe')](_0xcd2d('0x1f'),_0x36eb26?_0x36eb26[_0xcd2d('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcd2d('0x1c')](_0xcd2d('0x1f'))?this[_0xcd2d('0x1c')](_0xcd2d('0x1f'))['split'](';'):null;},'comment':_0xcd2d('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no')},'insecure':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0x21'),'set':function(_0x3bfe03){this['setDataValue'](_0xcd2d('0x22'),_0x3bfe03?_0x3bfe03[_0xcd2d('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xcd2d('0x22'))?this[_0xcd2d('0x1c')](_0xcd2d('0x22'))[_0xcd2d('0x11')](','):null;},'comment':_0xcd2d('0x23')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no',_0xcd2d('0x24'))},'promiscredir':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xcd2d('0x5')]('yes','no')},'accountcode':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'setvar':{'type':Sequelize[_0xcd2d('0x3')]},'callerid':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0x26')},'amaflags':{'type':Sequelize[_0xcd2d('0x3')]},'callcounter':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no'),'defaultValue':_0xcd2d('0x16')},'busylevel':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xcd2d('0x5')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xcd2d('0x5')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcd2d('0x5')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xcd2d('0x3')]},'videosupport':{'type':Sequelize[_0xcd2d('0x5')]('yes','no',_0xcd2d('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'mailbox':{'type':Sequelize[_0xcd2d('0x3')]},'session_timers':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x28'),'refuse',_0xcd2d('0x29'))},'session_expires':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x2a'),_0xcd2d('0x2b')),'defaultValue':_0xcd2d('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xcd2d('0x3')]},'regexten':{'type':Sequelize[_0xcd2d('0x3')]},'fromdomain':{'type':Sequelize[_0xcd2d('0x3')]},'fromuser':{'type':Sequelize[_0xcd2d('0x3')]},'port':{'type':Sequelize[_0xcd2d('0x25')](0x5)},'qualify':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xcd2d('0x3')]},'defaultuser':{'type':Sequelize[_0xcd2d('0x3')]},'rtptimeout':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no',_0xcd2d('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcd2d('0x3')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'timerb':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xcd2d('0x3')]},'contactdeny':{'type':Sequelize[_0xcd2d('0x3')]},'contactacl':{'type':Sequelize[_0xcd2d('0x3')]},'unsolicited_mailbox':{'type':Sequelize[_0xcd2d('0x3')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'encryption':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'force_avp':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'icesupport':{'type':Sequelize[_0xcd2d('0x5')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no','fingerprint',_0xcd2d('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xcd2d('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcd2d('0x3')]},'dtlsprivatekey':{'type':Sequelize[_0xcd2d('0x3')]},'dtlscipher':{'type':Sequelize[_0xcd2d('0x3')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xcd2d('0x2e'),_0xcd2d('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xcd2d('0x5')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcd2d('0x3')]},'recordofffeature':{'type':Sequelize[_0xcd2d('0x3')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcd2d('0x5')](_0xcd2d('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no')},'vmexten':{'type':Sequelize[_0xcd2d('0x3')]},'mohinterpret':{'type':Sequelize[_0xcd2d('0x3')]},'mohsuggest':{'type':Sequelize[_0xcd2d('0x3')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd2d('0x3')]},'host':{'type':Sequelize[_0xcd2d('0x3')],'defaultValue':_0xcd2d('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xcd2d('0x16'),'no',_0xcd2d('0x17'),'update',_0xcd2d('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xcd2d('0x3')]},'active':{'type':Sequelize[_0xcd2d('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4071=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','refuse','originate','uac','uas','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','getDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x4835ca,_0x391238){var _0x131b60=function(_0x579360){while(--_0x579360){_0x4835ca['push'](_0x4835ca['shift']());}};_0x131b60(++_0x391238);}(_0x4071,0xd7));var _0x1407=function(_0x4dcc3,_0x18aacb){_0x4dcc3=_0x4dcc3-0x0;var _0x58874f=_0x4071[_0x4dcc3];return _0x58874f;};'use strict';var Sequelize=require(_0x1407('0x0'));module['exports']={'name':{'type':Sequelize[_0x1407('0x1')],'allowNull':![],'unique':_0x1407('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1407('0x3')]('friend',_0x1407('0x4'),_0x1407('0x5')),'allowNull':![],'defaultValue':_0x1407('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x7'),_0x1407('0x8'),'ALLOWED_FAILED_SCREEN',_0x1407('0x9'),_0x1407('0xa'),'PROHIB_PASSED_SCREEN',_0x1407('0xb'),_0x1407('0xc'))},'deny':{'type':Sequelize[_0x1407('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x1407('0x1')]},'md5secret':{'type':Sequelize[_0x1407('0x1')]},'remotesecret':{'type':Sequelize[_0x1407('0x1')]},'transport':{'type':Sequelize[_0x1407('0x1')],'defaultValue':_0x1407('0xd'),'set':function(_0x2d9be2){this[_0x1407('0xe')](_0x1407('0xf'),_0x2d9be2?_0x2d9be2[_0x1407('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x1407('0xf'))?this['getDataValue'](_0x1407('0xf'))[_0x1407('0x11')](','):null;},'comment':_0x1407('0x12')},'dtmfmode':{'type':Sequelize[_0x1407('0x3')]('rfc2833','info','shortinfo',_0x1407('0x13'),_0x1407('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no',_0x1407('0x16'),_0x1407('0x17'),_0x1407('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1407('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1407('0x19'),'set':function(_0x5b259d){this[_0x1407('0xe')]('nat',_0x5b259d?_0x5b259d[_0x1407('0x10')](','):null);},'get':function(){return this[_0x1407('0x1a')](_0x1407('0x1b'))?this['getDataValue']('nat')[_0x1407('0x11')](','):null;},'comment':_0x1407('0x1c')},'callgroup':{'type':Sequelize[_0x1407('0x1')]},'namedcallgroup':{'type':Sequelize[_0x1407('0x1')]},'pickupgroup':{'type':Sequelize[_0x1407('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1407('0x1')]},'language':{'type':Sequelize[_0x1407('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1407('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1407('0x1')],'defaultValue':_0x1407('0x1d')},'allow':{'type':Sequelize[_0x1407('0x1')],'allowNull':![],'defaultValue':_0x1407('0x1e'),'set':function(_0x152511){this[_0x1407('0xe')](_0x1407('0x1f'),_0x152511?_0x152511[_0x1407('0x10')](';'):_0x1407('0x1e'));},'get':function(){return this['getDataValue'](_0x1407('0x1f'))?this[_0x1407('0x1a')]('allow')['split'](';'):null;},'comment':_0x1407('0x20')},'autoframing':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'insecure':{'type':Sequelize[_0x1407('0x1')],'defaultValue':'port,invite','set':function(_0x5867e6){this[_0x1407('0xe')]('insecure',_0x5867e6?_0x5867e6[_0x1407('0x10')](','):null);},'get':function(){return this[_0x1407('0x1a')](_0x1407('0x21'))?this['getDataValue'](_0x1407('0x21'))[_0x1407('0x11')](','):null;},'comment':_0x1407('0x22')},'trustrpid':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no',_0x1407('0x23'))},'promiscredir':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x1407('0x3')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1407('0x1')],'defaultValue':_0x1407('0x24')},'amaflags':{'type':Sequelize[_0x1407('0x1')]},'callcounter':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':_0x1407('0x15')},'busylevel':{'type':Sequelize[_0x1407('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x1407('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x1407('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x1407('0x1')]},'template':{'type':Sequelize[_0x1407('0x1')]},'videosupport':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no',_0x1407('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x1407('0x3')]('accept',_0x1407('0x27'),_0x1407('0x28'))},'session_expires':{'type':Sequelize[_0x1407('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x1407('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x29'),_0x1407('0x2a')),'defaultValue':_0x1407('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x1407('0x1')]},'regexten':{'type':Sequelize[_0x1407('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x1407('0x1')]},'port':{'type':Sequelize[_0x1407('0x25')](0x5)},'qualify':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1407('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x1407('0x1')]},'defaultuser':{'type':Sequelize[_0x1407('0x1')]},'rtptimeout':{'type':Sequelize[_0x1407('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1407('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1407('0x1')]},'callbackextension':{'type':Sequelize[_0x1407('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1407('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1407('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x1407('0x1')]},'contactdeny':{'type':Sequelize[_0x1407('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x1407('0x25')](0xb)},'encryption':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x1407('0x15'),'no')},'icesupport':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no','fingerprint',_0x1407('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x1407('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1407('0x1')]},'dtlscapath':{'type':Sequelize[_0x1407('0x1')]},'dtlssetup':{'type':Sequelize[_0x1407('0x3')]('active',_0x1407('0x2c'),_0x1407('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1407('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x1407('0x3')](_0x1407('0x15'),'no')},'vmexten':{'type':Sequelize[_0x1407('0x1')]},'mohinterpret':{'type':Sequelize[_0x1407('0x1')]},'mohsuggest':{'type':Sequelize[_0x1407('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1407('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x1407('0x2e')},'canreinvite':{'type':Sequelize[_0x1407('0x3')]('yes','no','nonat','update',_0x1407('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x1407('0x1')]},'active':{'type':Sequelize[_0x1407('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 57a98bc..4f614d9 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 _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x3c882f,_0x385956){var _0x1a179b=function(_0x8bd072){while(--_0x8bd072){_0x3c882f['push'](_0x3c882f['shift']());}};_0x1a179b(++_0x385956);}(_0x3e74,0x175));var _0x43e7=function(_0xf5445f,_0x1ed1dd){_0xf5445f=_0xf5445f-0x0;var _0x2983b7=_0x3e74[_0xf5445f];return _0x2983b7;};'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'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x2dbe3d,_0x4b6223){var _0x2a4da5=function(_0x3b8795){while(--_0x3b8795){_0x2dbe3d['push'](_0x2dbe3d['shift']());}};_0x2a4da5(++_0x4b6223);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x23502b,_0x4a3260){_0x23502b=_0x23502b-0x0;var _0x3e04a7=_0x8d0e[_0x23502b];return _0x3e04a7;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c52e319..ea5d640 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 _0xf736=['tools_trunks','lodash','api','moment','bluebird','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x57cee3,_0x2c5a3a){var _0x7b6904=function(_0x14ca19){while(--_0x14ca19){_0x57cee3['push'](_0x57cee3['shift']());}};_0x7b6904(++_0x2c5a3a);}(_0xf736,0x123));var _0x6f73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf736[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6f73('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6f73('0x1'));var moment=require(_0x6f73('0x2'));var BPromise=require(_0x6f73('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f73('0x4'));var attributes=require(_0x6f73('0x5'));module[_0x6f73('0x6')]=function(_0x6c42e5,_0x53aed5){return _0x6c42e5[_0x6f73('0x7')](_0x6f73('0x8'),attributes,{'tableName':_0x6f73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f33=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./trunk.attributes','exports','define'];(function(_0x4a1bad,_0x41e569){var _0x50b536=function(_0x376950){while(--_0x376950){_0x4a1bad['push'](_0x4a1bad['shift']());}};_0x50b536(++_0x41e569);}(_0x7f33,0x86));var _0x37f3=function(_0x2fcbb5,_0x24f1fe){_0x2fcbb5=_0x2fcbb5-0x0;var _0x5e4fac=_0x7f33[_0x2fcbb5];return _0x5e4fac;};'use strict';var _=require(_0x37f3('0x0'));var util=require(_0x37f3('0x1'));var logger=require(_0x37f3('0x2'))(_0x37f3('0x3'));var moment=require(_0x37f3('0x4'));var BPromise=require(_0x37f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x37f3('0x6'));var config=require('../../config/environment');var attributes=require(_0x37f3('0x7'));module[_0x37f3('0x8')]=function(_0x220522,_0x2cf333){return _0x220522[_0x37f3('0x9')](_0x37f3('0xa'),attributes,{'tableName':_0x37f3('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 0d8e05b..9d656b8 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 _0xca26=['jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trunk','options','raw','where','attributes','limit','include','map','model','GetTrunk','stringify','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x216e58,_0x773152){var _0x14a1b5=function(_0x2067f9){while(--_0x2067f9){_0x216e58['push'](_0x216e58['shift']());}};_0x14a1b5(++_0x773152);}(_0xca26,0x1b3));var _0x6ca2=function(_0x5f2a4e,_0xd2fe86){_0x5f2a4e=_0x5f2a4e-0x0;var _0x3f21e6=_0xca26[_0x5f2a4e];return _0x3f21e6;};'use strict';var _=require(_0x6ca2('0x0'));var util=require(_0x6ca2('0x1'));var moment=require(_0x6ca2('0x2'));var BPromise=require(_0x6ca2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ca2('0x4'));var db=require(_0x6ca2('0x5'))['db'];var utils=require(_0x6ca2('0x6'));var logger=require(_0x6ca2('0x7'))('rpc');var config=require(_0x6ca2('0x8'));var jayson=require(_0x6ca2('0x9'));var client=jayson[_0x6ca2('0xa')][_0x6ca2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb38,_0x5bcae0,_0x2879a2){return new BPromise(function(_0x16abb0,_0xebbae2){return client[_0x6ca2('0xc')](_0x2bdb38,_0x2879a2)[_0x6ca2('0xd')](function(_0x1e05ef){logger[_0x6ca2('0xe')](_0x6ca2('0xf'),_0x5bcae0,_0x6ca2('0x10'));logger[_0x6ca2('0x11')](_0x6ca2('0x12'),_0x5bcae0,_0x6ca2('0x10'),JSON['stringify'](_0x1e05ef));if(_0x1e05ef[_0x6ca2('0x13')]){if(_0x1e05ef[_0x6ca2('0x13')][_0x6ca2('0x14')]===0x1f4){logger[_0x6ca2('0x13')](_0x6ca2('0xf'),_0x5bcae0,_0x1e05ef[_0x6ca2('0x13')][_0x6ca2('0x15')]);return _0xebbae2(_0x1e05ef[_0x6ca2('0x13')][_0x6ca2('0x15')]);}logger['error'](_0x6ca2('0xf'),_0x5bcae0,_0x1e05ef[_0x6ca2('0x13')][_0x6ca2('0x15')]);return _0x16abb0(_0x1e05ef['error'][_0x6ca2('0x15')]);}else{logger[_0x6ca2('0xe')]('Trunk,\x20%s,\x20%s',_0x5bcae0,_0x6ca2('0x10'));_0x16abb0(_0x1e05ef[_0x6ca2('0x16')][_0x6ca2('0x15')]);}})[_0x6ca2('0x17')](function(_0x199f87){logger['error'](_0x6ca2('0xf'),_0x5bcae0,_0x199f87);_0xebbae2(_0x199f87);});});}exports['GetTrunk']=function(_0x15fb05){var _0x263f23=this;return new Promise(function(_0x41d313,_0x399364){return db[_0x6ca2('0x18')]['findAll']({'raw':_0x15fb05['options']?_0x15fb05[_0x6ca2('0x19')][_0x6ca2('0x1a')]===undefined?!![]:![]:!![],'where':_0x15fb05[_0x6ca2('0x19')]?_0x15fb05[_0x6ca2('0x19')][_0x6ca2('0x1b')]||null:null,'attributes':_0x15fb05[_0x6ca2('0x19')]?_0x15fb05[_0x6ca2('0x19')][_0x6ca2('0x1c')]||null:null,'limit':_0x15fb05[_0x6ca2('0x19')]?_0x15fb05[_0x6ca2('0x19')][_0x6ca2('0x1d')]||null:null,'include':_0x15fb05[_0x6ca2('0x19')]?_0x15fb05['options'][_0x6ca2('0x1e')]?_[_0x6ca2('0x1f')](_0x15fb05[_0x6ca2('0x19')]['include'],function(_0x39fa10){return{'model':db[_0x39fa10[_0x6ca2('0x20')]],'as':_0x39fa10['as'],'attributes':_0x39fa10['attributes'],'include':_0x39fa10[_0x6ca2('0x1e')]?_[_0x6ca2('0x1f')](_0x39fa10[_0x6ca2('0x1e')],function(_0x466b39){return{'model':db[_0x466b39[_0x6ca2('0x20')]],'as':_0x466b39['as'],'attributes':_0x466b39[_0x6ca2('0x1c')],'include':_0x466b39[_0x6ca2('0x1e')]?_[_0x6ca2('0x1f')](_0x466b39['include'],function(_0x402d36){return{'model':db[_0x402d36['model']],'as':_0x402d36['as'],'attributes':_0x402d36[_0x6ca2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6ca2('0xd')](function(_0x396274){logger[_0x6ca2('0xe')](_0x6ca2('0x21'),_0x15fb05);logger[_0x6ca2('0x11')](_0x6ca2('0x21'),_0x15fb05,JSON[_0x6ca2('0x22')](_0x396274));_0x41d313(_0x396274);})[_0x6ca2('0x17')](function(_0x9ea7c2){logger[_0x6ca2('0x13')](_0x6ca2('0x21'),_0x9ea7c2[_0x6ca2('0x15')],_0x15fb05);_0x399364(_0x263f23[_0x6ca2('0x13')](0x1f4,_0x9ea7c2[_0x6ca2('0x15')]));});});};exports[_0x6ca2('0x23')]=function(_0x2a6c1b){var _0x365d2a=this;return new Promise(function(_0x55dae0,_0x418000){return db[_0x6ca2('0x18')][_0x6ca2('0x24')]({'raw':_0x2a6c1b[_0x6ca2('0x19')]?_0x2a6c1b[_0x6ca2('0x19')][_0x6ca2('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a6c1b[_0x6ca2('0x19')]?_0x2a6c1b[_0x6ca2('0x19')][_0x6ca2('0x1b')]||null:null,'attributes':_0x2a6c1b[_0x6ca2('0x19')]?_0x2a6c1b[_0x6ca2('0x19')][_0x6ca2('0x1c')]||null:null,'include':_0x2a6c1b[_0x6ca2('0x19')]?_0x2a6c1b[_0x6ca2('0x19')]['include']?_[_0x6ca2('0x1f')](_0x2a6c1b[_0x6ca2('0x19')]['include'],function(_0x2058e9){return{'model':db[_0x2058e9['model']],'as':_0x2058e9['as'],'attributes':_0x2058e9[_0x6ca2('0x1c')],'include':_0x2058e9[_0x6ca2('0x1e')]?_[_0x6ca2('0x1f')](_0x2058e9[_0x6ca2('0x1e')],function(_0x2da613){return{'model':db[_0x2da613[_0x6ca2('0x20')]],'as':_0x2da613['as'],'attributes':_0x2da613[_0x6ca2('0x1c')],'include':_0x2da613['include']?_[_0x6ca2('0x1f')](_0x2da613[_0x6ca2('0x1e')],function(_0x30df2d){return{'model':db[_0x30df2d[_0x6ca2('0x20')]],'as':_0x30df2d['as'],'attributes':_0x30df2d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ca2('0xd')](function(_0x59e019){logger[_0x6ca2('0xe')](_0x6ca2('0x23'),_0x2a6c1b);logger[_0x6ca2('0x11')](_0x6ca2('0x23'),_0x2a6c1b,JSON[_0x6ca2('0x22')](_0x59e019));_0x55dae0(_0x59e019);})[_0x6ca2('0x17')](function(_0xc5d951){logger[_0x6ca2('0x13')](_0x6ca2('0x23'),_0xc5d951[_0x6ca2('0x15')],_0x2a6c1b);_0x418000(_0x365d2a[_0x6ca2('0x13')](0x1f4,_0xc5d951[_0x6ca2('0x15')]));});});}; \ No newline at end of file +var _0x001f=['where','attributes','include','map','model','catch','find','debug','ShowTrunk','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw'];(function(_0x4d7c3b,_0x206cc7){var _0x4f182b=function(_0x1fc4ed){while(--_0x1fc4ed){_0x4d7c3b['push'](_0x4d7c3b['shift']());}};_0x4f182b(++_0x206cc7);}(_0x001f,0x1f3));var _0xf001=function(_0x997ede,_0x5a0814){_0x997ede=_0x997ede-0x0;var _0x1f3288=_0x001f[_0x997ede];return _0x1f3288;};'use strict';var _=require(_0xf001('0x0'));var util=require(_0xf001('0x1'));var moment=require(_0xf001('0x2'));var BPromise=require('bluebird');var rs=require(_0xf001('0x3'));var fs=require('fs');var Redis=require(_0xf001('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf001('0x5'));var logger=require(_0xf001('0x6'))(_0xf001('0x7'));var config=require(_0xf001('0x8'));var jayson=require(_0xf001('0x9'));var client=jayson[_0xf001('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549b5b,_0x347f1b,_0x4e0ce6){return new BPromise(function(_0x1eb8f9,_0xc66701){return client[_0xf001('0xb')](_0x549b5b,_0x4e0ce6)[_0xf001('0xc')](function(_0x3eaaf8){logger[_0xf001('0xd')](_0xf001('0xe'),_0x347f1b,'request\x20sent');logger['debug'](_0xf001('0xf'),_0x347f1b,_0xf001('0x10'),JSON[_0xf001('0x11')](_0x3eaaf8));if(_0x3eaaf8[_0xf001('0x12')]){if(_0x3eaaf8[_0xf001('0x12')]['code']===0x1f4){logger[_0xf001('0x12')](_0xf001('0xe'),_0x347f1b,_0x3eaaf8['error'][_0xf001('0x13')]);return _0xc66701(_0x3eaaf8[_0xf001('0x12')][_0xf001('0x13')]);}logger[_0xf001('0x12')](_0xf001('0xe'),_0x347f1b,_0x3eaaf8[_0xf001('0x12')]['message']);return _0x1eb8f9(_0x3eaaf8['error']['message']);}else{logger[_0xf001('0xd')]('Trunk,\x20%s,\x20%s',_0x347f1b,_0xf001('0x10'));_0x1eb8f9(_0x3eaaf8[_0xf001('0x14')]['message']);}})['catch'](function(_0x8c5629){logger[_0xf001('0x12')](_0xf001('0xe'),_0x347f1b,_0x8c5629);_0xc66701(_0x8c5629);});});}exports[_0xf001('0x15')]=function(_0x56e4d0){var _0x20ed4c=this;return new Promise(function(_0x5029e2,_0x2b201b){return db[_0xf001('0x16')][_0xf001('0x17')]({'raw':_0x56e4d0[_0xf001('0x18')]?_0x56e4d0['options'][_0xf001('0x19')]===undefined?!![]:![]:!![],'where':_0x56e4d0[_0xf001('0x18')]?_0x56e4d0['options'][_0xf001('0x1a')]||null:null,'attributes':_0x56e4d0[_0xf001('0x18')]?_0x56e4d0[_0xf001('0x18')][_0xf001('0x1b')]||null:null,'limit':_0x56e4d0[_0xf001('0x18')]?_0x56e4d0[_0xf001('0x18')]['limit']||null:null,'include':_0x56e4d0[_0xf001('0x18')]?_0x56e4d0['options'][_0xf001('0x1c')]?_['map'](_0x56e4d0[_0xf001('0x18')][_0xf001('0x1c')],function(_0x59d206){return{'model':db[_0x59d206['model']],'as':_0x59d206['as'],'attributes':_0x59d206[_0xf001('0x1b')],'include':_0x59d206[_0xf001('0x1c')]?_[_0xf001('0x1d')](_0x59d206['include'],function(_0x2da4c4){return{'model':db[_0x2da4c4['model']],'as':_0x2da4c4['as'],'attributes':_0x2da4c4[_0xf001('0x1b')],'include':_0x2da4c4[_0xf001('0x1c')]?_[_0xf001('0x1d')](_0x2da4c4[_0xf001('0x1c')],function(_0xdef18d){return{'model':db[_0xdef18d[_0xf001('0x1e')]],'as':_0xdef18d['as'],'attributes':_0xdef18d[_0xf001('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6984){logger[_0xf001('0xd')]('GetTrunk',_0x56e4d0);logger['debug'](_0xf001('0x15'),_0x56e4d0,JSON[_0xf001('0x11')](_0x3a6984));_0x5029e2(_0x3a6984);})[_0xf001('0x1f')](function(_0x279c74){logger[_0xf001('0x12')]('GetTrunk',_0x279c74[_0xf001('0x13')],_0x56e4d0);_0x2b201b(_0x20ed4c[_0xf001('0x12')](0x1f4,_0x279c74[_0xf001('0x13')]));});});};exports['ShowTrunk']=function(_0x539b31){var _0x29e827=this;return new Promise(function(_0x37d10e,_0x27e6b0){return db['Trunk'][_0xf001('0x20')]({'raw':_0x539b31[_0xf001('0x18')]?_0x539b31[_0xf001('0x18')][_0xf001('0x19')]===undefined?!![]:![]:!![],'where':_0x539b31[_0xf001('0x18')]?_0x539b31[_0xf001('0x18')][_0xf001('0x1a')]||null:null,'attributes':_0x539b31[_0xf001('0x18')]?_0x539b31[_0xf001('0x18')][_0xf001('0x1b')]||null:null,'include':_0x539b31[_0xf001('0x18')]?_0x539b31['options'][_0xf001('0x1c')]?_[_0xf001('0x1d')](_0x539b31[_0xf001('0x18')][_0xf001('0x1c')],function(_0x495766){return{'model':db[_0x495766[_0xf001('0x1e')]],'as':_0x495766['as'],'attributes':_0x495766[_0xf001('0x1b')],'include':_0x495766[_0xf001('0x1c')]?_[_0xf001('0x1d')](_0x495766['include'],function(_0x4cd7ca){return{'model':db[_0x4cd7ca[_0xf001('0x1e')]],'as':_0x4cd7ca['as'],'attributes':_0x4cd7ca['attributes'],'include':_0x4cd7ca[_0xf001('0x1c')]?_[_0xf001('0x1d')](_0x4cd7ca[_0xf001('0x1c')],function(_0x17aef4){return{'model':db[_0x17aef4[_0xf001('0x1e')]],'as':_0x17aef4['as'],'attributes':_0x17aef4[_0xf001('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf001('0xc')](function(_0x5d5362){logger['info']('ShowTrunk',_0x539b31);logger[_0xf001('0x21')](_0xf001('0x22'),_0x539b31,JSON[_0xf001('0x11')](_0x5d5362));_0x37d10e(_0x5d5362);})[_0xf001('0x1f')](function(_0x334607){logger['error']('ShowTrunk',_0x334607[_0xf001('0x13')],_0x539b31);_0x27e6b0(_0x29e827[_0xf001('0x12')](0x1f4,_0x334607['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 7860882..a7ddf6a 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 _0xb657=['/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb657,0xb3));var _0x7b65=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xb657[_0x68c979];return _0x4f0001;};'use strict';var express=require(_0x7b65('0x0'));var router=express[_0x7b65('0x1')]();var auth=require(_0x7b65('0x2'));var controller=require('./user-setting.controller');router['put'](_0x7b65('0x3'),auth[_0x7b65('0x4')](),controller[_0x7b65('0x5')]);module[_0x7b65('0x6')]=router; \ No newline at end of file +var _0xdfe7=['Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','exports','express'];(function(_0x3e7ab1,_0x5a334c){var _0x1f16eb=function(_0xe778dc){while(--_0xe778dc){_0x3e7ab1['push'](_0x3e7ab1['shift']());}};_0x1f16eb(++_0x5a334c);}(_0xdfe7,0xd1));var _0x7dfe=function(_0x2d47b1,_0x34f39b){_0x2d47b1=_0x2d47b1-0x0;var _0x5d0436=_0xdfe7[_0x2d47b1];return _0x5d0436;};'use strict';var express=require(_0x7dfe('0x0'));var router=express[_0x7dfe('0x1')]();var auth=require(_0x7dfe('0x2'));var controller=require(_0x7dfe('0x3'));router['put'](_0x7dfe('0x4'),auth[_0x7dfe('0x5')](),controller['update']);module[_0x7dfe('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 733484f..096f594 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 _0x9a8e=['ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error','warning','info','debug','exports'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0x9a8e,0x1be));var _0xe9a8=function(_0x4cc67e,_0x538fe0){_0x4cc67e=_0x4cc67e-0x0;var _0x5a8656=_0x9a8e[_0x4cc67e];return _0x5a8656;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xe9a8('0x0'),_0xe9a8('0x1'),_0xe9a8('0x2'),_0xe9a8('0x3')];module[_0xe9a8('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xe9a8('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xe9a8('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe9a8('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe9a8('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe9a8('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe9a8('0x9')],'unique':_0xe9a8('0xa')}}; \ No newline at end of file +var _0xac8b=['error','warning','info','debug','exports','ENUM','DATE','INTEGER','UserId','sequelize'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xac8b,0x95));var _0xbac8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xac8b[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xbac8('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xbac8('0x1'),_0xbac8('0x2'),_0xbac8('0x3'),_0xbac8('0x4')];module[_0xbac8('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xbac8('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xbac8('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbac8('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xbac8('0x8')],'unique':_0xbac8('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 55aecb4..f0fbe30 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 _0x3248=['UserSetting','find','body','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','update','then','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x3248,0x1bc));var _0x8324=function(_0x2544ce,_0x5d6782){_0x2544ce=_0x2544ce-0x0;var _0x2cd9c4=_0x3248[_0x2544ce];return _0x2cd9c4;};'use strict';var _=require('lodash');var Redis=require(_0x8324('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x8324('0x1'));var db=require(_0x8324('0x2'))['db'];var socket=require(_0x8324('0x3'))(new Redis(config[_0x8324('0x4')]));require(_0x8324('0x5'))[_0x8324('0x6')](socket);config['redis']=_[_0x8324('0x7')](config[_0x8324('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x25ee7a,_0x459a62){_0x459a62=_0x459a62||0xc8;return function(_0x4302c5){if(_0x4302c5){return _0x25ee7a[_0x8324('0x8')](_0x459a62)['json'](_0x4302c5);}};}function saveUpdates(_0x374820){return function(_0x114c03){if(_0x114c03){return _0x114c03[_0x8324('0x9')](_0x374820)[_0x8324('0xa')](function(_0x481aec){return _0x481aec;});}return null;};}function handleEntityNotFound(_0x33b170){return function(_0x3dd97d){if(!_0x3dd97d){_0x33b170['sendStatus'](0x194);}return _0x3dd97d;};}function handleError(_0x2e1cc7,_0x2c190e){_0x2c190e=_0x2c190e||0x1f4;return function(_0x58286f){logger['error'](_0x58286f['stack']);if(_0x58286f[_0x8324('0xb')]){delete _0x58286f[_0x8324('0xb')];}_0x2e1cc7[_0x8324('0x8')](_0x2c190e)[_0x8324('0xc')](_0x58286f);};}exports['update']=function(_0x296bda,_0x10cfea){if(_0x296bda[_0x8324('0xd')][_0x8324('0xe')]!==_0x8324('0xf'))throw new Error('Unauthorized');if(isNaN(Number(_0x296bda[_0x8324('0x10')]['id'])))throw new Error(_0x8324('0x11'));return db[_0x8324('0x12')][_0x8324('0x13')]({'where':{'id':_0x296bda[_0x8324('0x10')]['id']}})['then'](handleEntityNotFound(_0x10cfea,null))[_0x8324('0xa')](saveUpdates(_0x296bda[_0x8324('0x14')],null))[_0x8324('0xa')](respondWithResult(_0x10cfea,null))[_0x8324('0x15')](handleError(_0x10cfea,null));}; \ No newline at end of file +var _0x3e25=['../../config/environment','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger'];(function(_0x3f7bb3,_0x1c3d5f){var _0x539508=function(_0x22a315){while(--_0x22a315){_0x3f7bb3['push'](_0x3f7bb3['shift']());}};_0x539508(++_0x1c3d5f);}(_0x3e25,0x14f));var _0x53e2=function(_0x7397e,_0x43ca3e){_0x7397e=_0x7397e-0x0;var _0x2bf4d2=_0x3e25[_0x7397e];return _0x2bf4d2;};'use strict';var _=require(_0x53e2('0x0'));var Redis=require(_0x53e2('0x1'));var logger=require(_0x53e2('0x2'))('api');var config=require(_0x53e2('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x53e2('0x4'))(new Redis(config['redis']));require(_0x53e2('0x5'))[_0x53e2('0x6')](socket);config[_0x53e2('0x7')]=_[_0x53e2('0x8')](config[_0x53e2('0x7')],{'host':_0x53e2('0x9'),'port':0x18eb});function respondWithResult(_0x1905b4,_0x31c0fa){_0x31c0fa=_0x31c0fa||0xc8;return function(_0x431bee){if(_0x431bee){return _0x1905b4[_0x53e2('0xa')](_0x31c0fa)[_0x53e2('0xb')](_0x431bee);}};}function saveUpdates(_0x3ca18f){return function(_0x312036){if(_0x312036){return _0x312036[_0x53e2('0xc')](_0x3ca18f)[_0x53e2('0xd')](function(_0x1b3c38){return _0x1b3c38;});}return null;};}function handleEntityNotFound(_0x237ad4){return function(_0x156cf3){if(!_0x156cf3){_0x237ad4['sendStatus'](0x194);}return _0x156cf3;};}function handleError(_0x42bf3f,_0x5cf96c){_0x5cf96c=_0x5cf96c||0x1f4;return function(_0x5d1a8e){logger['error'](_0x5d1a8e[_0x53e2('0xe')]);if(_0x5d1a8e[_0x53e2('0xf')]){delete _0x5d1a8e[_0x53e2('0xf')];}_0x42bf3f[_0x53e2('0xa')](_0x5cf96c)[_0x53e2('0x10')](_0x5d1a8e);};}exports[_0x53e2('0xc')]=function(_0x2e50be,_0x26b624){if(_0x2e50be[_0x53e2('0x11')]['role']!==_0x53e2('0x12'))throw new Error(_0x53e2('0x13'));if(isNaN(Number(_0x2e50be[_0x53e2('0x14')]['id'])))throw new Error(_0x53e2('0x15'));return db[_0x53e2('0x16')][_0x53e2('0x17')]({'where':{'id':_0x2e50be['params']['id']}})[_0x53e2('0xd')](handleEntityNotFound(_0x26b624,null))['then'](saveUpdates(_0x2e50be[_0x53e2('0x18')],null))[_0x53e2('0xd')](respondWithResult(_0x26b624,null))[_0x53e2('0x19')](handleError(_0x26b624,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 ae7a5da..cd64808 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 _0x8076=['setMaxListeners','update','emit','exports','events'];(function(_0x46af2e,_0x24cb55){var _0x5c63a9=function(_0x440b83){while(--_0x440b83){_0x46af2e['push'](_0x46af2e['shift']());}};_0x5c63a9(++_0x24cb55);}(_0x8076,0x1bc));var _0x6807=function(_0x36d6b9,_0x3aa318){_0x36d6b9=_0x36d6b9-0x0;var _0x561bb=_0x8076[_0x36d6b9];return _0x561bb;};'use strict';var EventEmitter=require(_0x6807('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6807('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6807('0x2'),'afterDestroy':'remove'};function emitEvent(_0x586822){return function(_0x4404d2,_0xe9d641,_0x1bee5d){UserSettingEvents['emit'](_0x586822+':'+_0x4404d2['id'],_0x4404d2);UserSettingEvents[_0x6807('0x3')](_0x586822,_0x4404d2);_0x1bee5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6807('0x4')]=UserSettingEvents; \ No newline at end of file +var _0xc9e8=['events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x26d045,_0x3269f9){var _0x2a1377=function(_0xc95cf7){while(--_0xc95cf7){_0x26d045['push'](_0x26d045['shift']());}};_0x2a1377(++_0x3269f9);}(_0xc9e8,0x1c7));var _0x8c9e=function(_0x31c5e9,_0x30e373){_0x31c5e9=_0x31c5e9-0x0;var _0x517a8d=_0xc9e8[_0x31c5e9];return _0x517a8d;};'use strict';var EventEmitter=require(_0x8c9e('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c9e('0x1'),'afterUpdate':_0x8c9e('0x2'),'afterDestroy':_0x8c9e('0x3')};function emitEvent(_0x3efd7a){return function(_0x19bf1c,_0x45d763,_0x237a45){UserSettingEvents[_0x8c9e('0x4')](_0x3efd7a+':'+_0x19bf1c['id'],_0x19bf1c);UserSettingEvents[_0x8c9e('0x4')](_0x3efd7a,_0x19bf1c);_0x237a45(null);};}for(var e in events){if(events[_0x8c9e('0x5')](e)){var event=events[e];UserSetting[_0x8c9e('0x6')](e,emitEvent(event));}}module['exports']=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 50ccfc9..1a0634c 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 _0xe3db=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x2599ae,_0x141e73){var _0x2d94a0=function(_0x267dd8){while(--_0x267dd8){_0x2599ae['push'](_0x2599ae['shift']());}};_0x2d94a0(++_0x141e73);}(_0xe3db,0xc8));var _0xbe3d=function(_0x200f7d,_0x3b8428){_0x200f7d=_0x200f7d-0x0;var _0x7f345d=_0xe3db[_0x200f7d];return _0x7f345d;};'use strict';var attributes=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]=function(_0x50b3ff){return _0x50b3ff[_0xbe3d('0x2')](_0xbe3d('0x3'),attributes,{'tableName':_0xbe3d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x411429){if(!_0x411429[_0xbe3d('0x5')])_0x411429[_0xbe3d('0x6')]=null;else if(_0x411429[_0xbe3d('0x6')]===null)_0x411429[_0xbe3d('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x3c81=['define','UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3c81,0x102));var _0x13c8=function(_0x3da725,_0x5d3f3a){_0x3da725=_0x3da725-0x0;var _0x5e8601=_0x3c81[_0x3da725];return _0x5e8601;};'use strict';var attributes=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b){return _0x48c35b[_0x13c8('0x2')](_0x13c8('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5913e9){if(!_0x5913e9['clientSideLoggingEnabled'])_0x5913e9['clientSideLoggingEnabledSince']=null;else if(_0x5913e9[_0x13c8('0x4')]===null)_0x5913e9[_0x13c8('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 2ba7d0d..4c64bcd 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 _0xac0c=['UserId','register','length','user-setting:','save','update','emit','user-setting:update:user-'];(function(_0x4ad559,_0x5afeb9){var _0x491e86=function(_0xc5f2d0){while(--_0xc5f2d0){_0x4ad559['push'](_0x4ad559['shift']());}};_0x491e86(++_0x5afeb9);}(_0xac0c,0xdc));var _0xcac0=function(_0xf466fc,_0xe6b550){_0xf466fc=_0xf466fc-0x0;var _0x1e6330=_0xac0c[_0xf466fc];return _0x1e6330;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xcac0('0x0'),'remove',_0xcac0('0x1')];function createListener(_0x300281,_0x275abb){return function(_0x35147e){_0x275abb[_0xcac0('0x2')](_0x300281,_0x35147e);if(_0x300281==='user-setting:update'){_0x275abb[_0xcac0('0x2')](_0xcac0('0x3')+_0x35147e[_0xcac0('0x4')],_0x35147e);}};}exports[_0xcac0('0x5')]=function(_0x1ca729){for(var _0x4cce2c=0x0,_0x2850ba=events[_0xcac0('0x6')];_0x4cce2c<_0x2850ba;_0x4cce2c++){var _0xe00e9e=events[_0x4cce2c];var _0x50a290=createListener(_0xcac0('0x7')+_0xe00e9e,_0x1ca729);UserSettingEvents['on'](_0xe00e9e,_0x50a290);}}; \ No newline at end of file +var _0x2ec8=['emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','save'];(function(_0x327b4c,_0x1a3f25){var _0x2b9ea7=function(_0x1499e3){while(--_0x1499e3){_0x327b4c['push'](_0x327b4c['shift']());}};_0x2b9ea7(++_0x1a3f25);}(_0x2ec8,0x6e));var _0x82ec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ec8[_0x2dafbe];return _0x58a45a;};'use strict';var UserSettingEvents=require(_0x82ec('0x0'));var events=[_0x82ec('0x1'),'remove','update'];function createListener(_0x49a008,_0x477d5e){return function(_0x142fa6){_0x477d5e[_0x82ec('0x2')](_0x49a008,_0x142fa6);if(_0x49a008===_0x82ec('0x3')){_0x477d5e[_0x82ec('0x2')](_0x82ec('0x4')+_0x142fa6[_0x82ec('0x5')],_0x142fa6);}};}exports[_0x82ec('0x6')]=function(_0x1df9c9){for(var _0x6f8dba=0x0,_0x17c182=events['length'];_0x6f8dba<_0x17c182;_0x6f8dba++){var _0x2828ad=events[_0x6f8dba];var _0x5519b2=createListener(_0x82ec('0x7')+_0x2828ad,_0x1df9c9);UserSettingEvents['on'](_0x2828ad,_0x5519b2);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5ac4a13..076f702 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 _0xe956=['/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','addContacts','/create_many','bulkCreate','join','root','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','/:id/queues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe956,0xc4));var _0x6e95=function(_0x181d0e,_0x31c701){_0x181d0e=_0x181d0e-0x0;var _0x377327=_0xe956[_0x181d0e];return _0x377327;};'use strict';var multer=require(_0x6e95('0x0'));var util=require(_0x6e95('0x1'));var path=require(_0x6e95('0x2'));var timeout=require(_0x6e95('0x3'));var express=require(_0x6e95('0x4'));var router=express['Router']();var fs_extra=require(_0x6e95('0x5'));var auth=require(_0x6e95('0x6'));var interaction=require(_0x6e95('0x7'));var config=require(_0x6e95('0x8'));var controller=require('./user.controller');router['get']('/',auth[_0x6e95('0x9')](),controller[_0x6e95('0xa')]);router[_0x6e95('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x6e95('0xc')]);router[_0x6e95('0xb')](_0x6e95('0xd'),auth['isAuthenticated'](),controller[_0x6e95('0xe')]);router[_0x6e95('0xb')](_0x6e95('0xf'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x10')]);router[_0x6e95('0xb')](_0x6e95('0x11'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x12')]);router[_0x6e95('0xb')](_0x6e95('0x13'),controller['getAvatar']);router[_0x6e95('0xb')](_0x6e95('0x14'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x15')]);router['get'](_0x6e95('0x16'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x17')]);router[_0x6e95('0xb')]('/:id/queues',auth[_0x6e95('0x9')](),controller[_0x6e95('0x18')]);router['get'](_0x6e95('0x19'),auth[_0x6e95('0x9')](),controller['getVoiceQueuesRt']);router[_0x6e95('0xb')](_0x6e95('0x1a'),auth[_0x6e95('0x9')](),controller['getGroups']);router[_0x6e95('0xb')](_0x6e95('0x1b'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x1c')]);router[_0x6e95('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x6e95('0x1d')]);router['get'](_0x6e95('0x1e'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x1f')]);router[_0x6e95('0xb')](_0x6e95('0x20'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x21')]);router['get'](_0x6e95('0x22'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x23')]);router[_0x6e95('0xb')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x6e95('0x24')]);router['get'](_0x6e95('0x25'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x26')]);router[_0x6e95('0xb')](_0x6e95('0x27'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x28')]);router[_0x6e95('0xb')](_0x6e95('0x29'),auth['isAuthenticated'](),controller[_0x6e95('0x2a')]);router[_0x6e95('0xb')](_0x6e95('0x2b'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x2c')]);router['get'](_0x6e95('0x2d'),auth[_0x6e95('0x9')](),controller['getAgents']);router[_0x6e95('0xb')](_0x6e95('0x2e'),auth['isAuthenticated'](),controller[_0x6e95('0x2f')]);router[_0x6e95('0xb')](_0x6e95('0x30'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x31')]);router['get'](_0x6e95('0x32'),auth['isAuthenticated'](),controller[_0x6e95('0x33')]);router[_0x6e95('0xb')](_0x6e95('0x34'),auth[_0x6e95('0x9')](),controller['getOpenchannelAccounts']);router[_0x6e95('0xb')]('/:id/sms_accounts',auth[_0x6e95('0x9')](),controller[_0x6e95('0x35')]);router['get'](_0x6e95('0x36'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x37')]);router[_0x6e95('0xb')](_0x6e95('0x38'),auth[_0x6e95('0x9')](),controller['getWhatsappAccounts']);router[_0x6e95('0xb')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x6e95('0x39')]);router['get'](_0x6e95('0x3a'),auth[_0x6e95('0x9')](),controller['getScheduledCalls']);router[_0x6e95('0xb')](_0x6e95('0x3b'),auth[_0x6e95('0x9')](),controller['getApiKey']);router[_0x6e95('0x3c')](_0x6e95('0x16'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x3d')]);router['post']('/',auth[_0x6e95('0x9')](),controller['create']);router['post'](_0x6e95('0x3e'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x3f')]);router[_0x6e95('0x3c')]('/:id/queues',auth[_0x6e95('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b6a8a,_0x5db0d5,_0x2c6c4b){_0x2c6c4b(null,path[_0x6e95('0x40')](config[_0x6e95('0x41')],_0x6e95('0x42')));},'filename':function(_0x2941c7,_0x14c237,_0x28bf4b){_0x28bf4b(null,util[_0x6e95('0x43')]('%s-%s',Date['now'](),_0x14c237[_0x6e95('0x44')]));}})});router['post'](_0x6e95('0x13'),upload[_0x6e95('0x45')](_0x6e95('0x46')),controller[_0x6e95('0x47')]);router[_0x6e95('0x3c')](_0x6e95('0x48'),auth[_0x6e95('0x9')](),controller['login']);router['post'](_0x6e95('0x49'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x4a')]);router[_0x6e95('0x3c')](_0x6e95('0x4b'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x4c')]);router[_0x6e95('0x3c')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x6e95('0x4d')]);router['post']('/:id/teams',auth[_0x6e95('0x9')](),controller[_0x6e95('0x4e')]);router[_0x6e95('0x3c')](_0x6e95('0x4f'),auth['isAuthenticated'](),controller[_0x6e95('0x50')]);router[_0x6e95('0x3c')](_0x6e95('0x51'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x52')]);router[_0x6e95('0x3c')](_0x6e95('0x53'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x6e95('0x3c')](_0x6e95('0x54'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x55')]);router[_0x6e95('0x3c')]('/:id/openchannel_interactions',auth[_0x6e95('0x9')](),controller[_0x6e95('0x56')]);router[_0x6e95('0x3c')]('/:id/whatsapp_interactions',auth[_0x6e95('0x9')](),controller[_0x6e95('0x57')]);router[_0x6e95('0x3c')](_0x6e95('0x30'),auth['isAuthenticated'](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0x6e95('0x9')](),controller['addMailAccounts']);router[_0x6e95('0x3c')](_0x6e95('0x34'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x58')]);router['post'](_0x6e95('0x59'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x5a')]);router[_0x6e95('0x3c')](_0x6e95('0x36'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x5b')]);router['post'](_0x6e95('0x38'),auth[_0x6e95('0x9')](),controller['addWhatsappAccounts']);router[_0x6e95('0x3c')](_0x6e95('0x5c'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x5d')]);router[_0x6e95('0x3c')](_0x6e95('0x3b'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x5e')]);router[_0x6e95('0x5f')](_0x6e95('0x11'),auth[_0x6e95('0x9')](),controller['update']);router['put'](_0x6e95('0x60'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x61')]);router[_0x6e95('0x62')](_0x6e95('0x63'),auth[_0x6e95('0x9')](),controller['removeQueues']);router[_0x6e95('0x62')](_0x6e95('0x29'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x64')]);router['delete'](_0x6e95('0x11'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x65')]);router['delete'](_0x6e95('0x4f'),auth['isAuthenticated'](),controller[_0x6e95('0x66')]);router[_0x6e95('0x62')]('/:id/mail_interactions',auth[_0x6e95('0x9')](),controller[_0x6e95('0x67')]);router['delete'](_0x6e95('0x53'),auth[_0x6e95('0x9')](),controller['removeFaxInteractions']);router[_0x6e95('0x62')](_0x6e95('0x54'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x68')]);router['delete'](_0x6e95('0x69'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x6a')]);router['delete'](_0x6e95('0x6b'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x6e95('0x62')](_0x6e95('0x30'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x6c')]);router[_0x6e95('0x62')](_0x6e95('0x32'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x6d')]);router[_0x6e95('0x62')](_0x6e95('0x34'),auth[_0x6e95('0x9')](),controller['removeOpenchannelAccounts']);router['delete'](_0x6e95('0x59'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x6e')]);router[_0x6e95('0x62')](_0x6e95('0x36'),auth['isAuthenticated'](),controller[_0x6e95('0x6f')]);router[_0x6e95('0x62')](_0x6e95('0x38'),auth['isAuthenticated'](),controller[_0x6e95('0x70')]);router[_0x6e95('0x62')](_0x6e95('0x5c'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x6e95('0x62')](_0x6e95('0x3b'),auth[_0x6e95('0x9')](),controller[_0x6e95('0x71')]);module[_0x6e95('0x72')]=router; \ No newline at end of file +var _0x3f08=['put','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update'];(function(_0x1c7abc,_0x13cca2){var _0x354460=function(_0x1a09b6){while(--_0x1a09b6){_0x1c7abc['push'](_0x1c7abc['shift']());}};_0x354460(++_0x13cca2);}(_0x3f08,0x1dd));var _0x83f0=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3f08[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83f0('0x0'));var timeout=require('connect-timeout');var express=require(_0x83f0('0x1'));var router=express[_0x83f0('0x2')]();var fs_extra=require(_0x83f0('0x3'));var auth=require(_0x83f0('0x4'));var interaction=require(_0x83f0('0x5'));var config=require('../../config/environment');var controller=require(_0x83f0('0x6'));router[_0x83f0('0x7')]('/',auth[_0x83f0('0x8')](),controller[_0x83f0('0x9')]);router[_0x83f0('0x7')](_0x83f0('0xa'),auth[_0x83f0('0x8')](),controller[_0x83f0('0xb')]);router[_0x83f0('0x7')]('/whoami',auth[_0x83f0('0x8')](),controller[_0x83f0('0xc')]);router[_0x83f0('0x7')](_0x83f0('0xd'),auth[_0x83f0('0x8')](),controller[_0x83f0('0xe')]);router[_0x83f0('0x7')](_0x83f0('0xf'),auth['isAuthenticated'](),controller[_0x83f0('0x10')]);router[_0x83f0('0x7')](_0x83f0('0x11'),controller['getAvatar']);router[_0x83f0('0x7')](_0x83f0('0x12'),auth[_0x83f0('0x8')](),controller['getOpenTabs']);router[_0x83f0('0x7')]('/:id/contacts',auth[_0x83f0('0x8')](),controller[_0x83f0('0x13')]);router[_0x83f0('0x7')](_0x83f0('0x14'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x15')]);router[_0x83f0('0x7')]('/:id/queues_rt',auth[_0x83f0('0x8')](),controller[_0x83f0('0x16')]);router['get'](_0x83f0('0x17'),auth[_0x83f0('0x8')](),controller['getGroups']);router[_0x83f0('0x7')](_0x83f0('0x18'),auth[_0x83f0('0x8')](),controller['getRecordings']);router[_0x83f0('0x7')](_0x83f0('0x19'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x1a')]);router['get'](_0x83f0('0x1b'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x1c')]);router[_0x83f0('0x7')](_0x83f0('0x1d'),auth['isAuthenticated'](),controller[_0x83f0('0x1e')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x83f0('0x1f')]);router[_0x83f0('0x7')](_0x83f0('0x20'),auth[_0x83f0('0x8')](),controller['getSmsInteractions']);router[_0x83f0('0x7')](_0x83f0('0x21'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x22')]);router[_0x83f0('0x7')](_0x83f0('0x23'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x24')]);router[_0x83f0('0x7')](_0x83f0('0x25'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x26')]);router[_0x83f0('0x7')](_0x83f0('0x27'),auth[_0x83f0('0x8')](),controller['getLists']);router[_0x83f0('0x7')](_0x83f0('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0x83f0('0x7')](_0x83f0('0x29'),auth['isAuthenticated'](),controller[_0x83f0('0x2a')]);router[_0x83f0('0x7')](_0x83f0('0x2b'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x2c')]);router[_0x83f0('0x7')](_0x83f0('0x2d'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x83f0('0x7')](_0x83f0('0x2e'),auth[_0x83f0('0x8')](),controller['getOpenchannelAccounts']);router['get'](_0x83f0('0x2f'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x30')]);router[_0x83f0('0x7')](_0x83f0('0x31'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x32')]);router[_0x83f0('0x7')](_0x83f0('0x33'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x34')]);router[_0x83f0('0x7')](_0x83f0('0x35'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x36')]);router['get']('/:id/scheduled_calls',auth[_0x83f0('0x8')](),controller[_0x83f0('0x37')]);router[_0x83f0('0x7')](_0x83f0('0x38'),auth['isAuthenticated'](),controller[_0x83f0('0x39')]);router['post'](_0x83f0('0x3a'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x83f0('0x8')](),controller['create']);router[_0x83f0('0x3b')](_0x83f0('0x3c'),auth['isAuthenticated'](),controller[_0x83f0('0x3d')]);router[_0x83f0('0x3b')](_0x83f0('0x14'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x3e')]);var upload=multer({'storage':multer[_0x83f0('0x3f')]({'destination':function(_0x1d8d1c,_0x221556,_0x3077f8){_0x3077f8(null,path[_0x83f0('0x40')](config[_0x83f0('0x41')],_0x83f0('0x42')));},'filename':function(_0x4f355f,_0x516d8b,_0x1b0eb2){_0x1b0eb2(null,util[_0x83f0('0x43')](_0x83f0('0x44'),Date['now'](),_0x516d8b[_0x83f0('0x45')]));}})});router[_0x83f0('0x3b')](_0x83f0('0x11'),upload[_0x83f0('0x46')]('file'),controller[_0x83f0('0x47')]);router['post'](_0x83f0('0x48'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x49')]);router[_0x83f0('0x3b')](_0x83f0('0x4a'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x4b')]);router[_0x83f0('0x3b')]('/:id/pause',auth[_0x83f0('0x8')](),controller[_0x83f0('0x4c')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x83f0('0x4d')]);router[_0x83f0('0x3b')](_0x83f0('0x25'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x4e')]);router[_0x83f0('0x3b')](_0x83f0('0x4f'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x50')]);router[_0x83f0('0x3b')](_0x83f0('0x51'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x52')]);router[_0x83f0('0x3b')](_0x83f0('0x53'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x54')]);router[_0x83f0('0x3b')](_0x83f0('0x55'),auth[_0x83f0('0x8')](),controller['addSmsInteractions']);router[_0x83f0('0x3b')](_0x83f0('0x56'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x57')]);router[_0x83f0('0x3b')](_0x83f0('0x58'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x59')]);router[_0x83f0('0x3b')](_0x83f0('0x2b'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x5a')]);router[_0x83f0('0x3b')]('/:id/mail_accounts',auth[_0x83f0('0x8')](),controller['addMailAccounts']);router[_0x83f0('0x3b')](_0x83f0('0x2e'),auth['isAuthenticated'](),controller[_0x83f0('0x5b')]);router[_0x83f0('0x3b')]('/:id/sms_accounts',auth[_0x83f0('0x8')](),controller[_0x83f0('0x5c')]);router[_0x83f0('0x3b')](_0x83f0('0x31'),auth['isAuthenticated'](),controller[_0x83f0('0x5d')]);router[_0x83f0('0x3b')](_0x83f0('0x33'),auth['isAuthenticated'](),controller[_0x83f0('0x5e')]);router[_0x83f0('0x3b')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x83f0('0x5f')]);router[_0x83f0('0x3b')]('/:id/api_key',auth[_0x83f0('0x8')](),controller[_0x83f0('0x60')]);router['put'](_0x83f0('0xf'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x61')]);router[_0x83f0('0x62')]('/:id/password',auth[_0x83f0('0x8')](),controller[_0x83f0('0x63')]);router[_0x83f0('0x64')]('/:id/queues',auth[_0x83f0('0x8')](),controller[_0x83f0('0x65')]);router[_0x83f0('0x64')](_0x83f0('0x25'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x66')]);router[_0x83f0('0x64')](_0x83f0('0xf'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x67')]);router[_0x83f0('0x64')]('/:id/chat_interactions',auth[_0x83f0('0x8')](),controller['removeChatInteractions']);router[_0x83f0('0x64')](_0x83f0('0x51'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x68')]);router[_0x83f0('0x64')](_0x83f0('0x53'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x69')]);router[_0x83f0('0x64')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x83f0('0x6a')]);router[_0x83f0('0x64')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x83f0('0x6b')]);router[_0x83f0('0x64')](_0x83f0('0x58'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x6c')]);router[_0x83f0('0x64')](_0x83f0('0x2b'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x6d')]);router[_0x83f0('0x64')](_0x83f0('0x2d'),auth[_0x83f0('0x8')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x83f0('0x8')](),controller[_0x83f0('0x6e')]);router[_0x83f0('0x64')](_0x83f0('0x2f'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x6f')]);router[_0x83f0('0x64')](_0x83f0('0x31'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x70')]);router[_0x83f0('0x64')](_0x83f0('0x33'),auth[_0x83f0('0x8')](),controller[_0x83f0('0x71')]);router[_0x83f0('0x64')](_0x83f0('0x35'),auth[_0x83f0('0x8')](),controller['removeSquareProjects']);router[_0x83f0('0x64')](_0x83f0('0x38'),auth[_0x83f0('0x8')](),controller['removeApiKey']);module[_0x83f0('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 88fc73d..1de6472 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 _0xeeda=['callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','always','accept','refuse','originate','uac','uas','certificate','passive','update,nonat','showWebBar','get','isArray','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','avpf','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','fullname'];(function(_0x495529,_0x19bc75){var _0x3e2cb5=function(_0x4089de){while(--_0x4089de){_0x495529['push'](_0x495529['shift']());}};_0x3e2cb5(++_0x19bc75);}(_0xeeda,0x1be));var _0xaeed=function(_0x300776,_0x29a220){_0x300776=_0x300776-0x0;var _0x59b241=_0xeeda[_0x300776];return _0x59b241;};'use strict';var Sequelize=require(_0xaeed('0x0'));var moment=require(_0xaeed('0x1'));var util=require(_0xaeed('0x2'));var _=require(_0xaeed('0x3'));module[_0xaeed('0x4')]={'name':{'type':Sequelize[_0xaeed('0x5')],'allowNull':![],'unique':_0xaeed('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x18f5bc){this[_0xaeed('0x7')](_0xaeed('0x6'),_0x18f5bc);this[_0xaeed('0x7')]('defaultuser',_0x18f5bc);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xaeed('0x5')],'allowNull':![],'set':function(_0x3841d9){this[_0xaeed('0x7')](_0xaeed('0x8'),_0x3841d9);this[_0xaeed('0x7')](_0xaeed('0x9'),util[_0xaeed('0xa')](_0xaeed('0xb'),_0x3841d9,this[_0xaeed('0xc')](_0xaeed('0xd'))));}},'alias':{'type':Sequelize[_0xaeed('0x5')]},'email':{'type':Sequelize[_0xaeed('0x5')],'allowNull':![],'unique':_0xaeed('0xe'),'validate':{'isEmail':!![]},'set':function(_0xbcb9ce){if(_0xbcb9ce){this[_0xaeed('0x7')](_0xaeed('0xe'),_0xbcb9ce[_0xaeed('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xaeed('0x10'),_0xaeed('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xaeed('0x5')],'defaultValue':_0xaeed('0x12')},'internal':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4130e5){this[_0xaeed('0x7')]('internal',_0x4130e5);this[_0xaeed('0x7')](_0xaeed('0x14'),_0x4130e5);this[_0xaeed('0x7')]('callerid',util[_0xaeed('0xa')]('\x22%s\x22\x20<%s>',this[_0xaeed('0xc')](_0xaeed('0x8')),_0x4130e5));}},'salt':{'type':Sequelize[_0xaeed('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xaeed('0x5')]},'address':{'type':Sequelize[_0xaeed('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xaeed('0x5')]},'city':{'type':Sequelize[_0xaeed('0x5')]},'country':{'type':Sequelize[_0xaeed('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xaeed('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xaeed('0x17')},'lastPauseAt':{'type':Sequelize[_0xaeed('0x15')]},'chatCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xaeed('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xaeed('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xaeed('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xaeed('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x1a'),_0xaeed('0x11'),_0xaeed('0x1b')),'allowNull':!![],'defaultValue':_0xaeed('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xaeed('0x1c')},'callingpres':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x1d'),_0xaeed('0x1e'),_0xaeed('0x1f'),'ALLOWED',_0xaeed('0x20'),'PROHIB_PASSED_SCREEN',_0xaeed('0x21'),_0xaeed('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![],'defaultValue':_0xaeed('0x23'),'set':function(_0x3df561){this[_0xaeed('0x7')](_0xaeed('0x24'),_0x3df561?_0x3df561[_0xaeed('0x25')](','):null);},'get':function(){return this[_0xaeed('0xc')](_0xaeed('0x24'))?this['getDataValue'](_0xaeed('0x24'))[_0xaeed('0x26')](','):null;},'comment':_0xaeed('0x27')},'dtmfmode':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x28'),_0xaeed('0x29'),_0xaeed('0x2a'),'inband',_0xaeed('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no',_0xaeed('0x2d'),_0xaeed('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x173cc0){this[_0xaeed('0x7')](_0xaeed('0x2f'),_0x173cc0?_0x173cc0[_0xaeed('0x25')](','):null);},'get':function(){return this[_0xaeed('0xc')](_0xaeed('0x2f'))?this['getDataValue'](_0xaeed('0x2f'))['split'](','):null;},'comment':_0xaeed('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xaeed('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaeed('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaeed('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaeed('0x31')},'allow':{'type':Sequelize[_0xaeed('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e89a0){this[_0xaeed('0x7')](_0xaeed('0x32'),_0x4e89a0?_0x4e89a0[_0xaeed('0x25')](';'):_0xaeed('0x33'));},'get':function(){return this['getDataValue']('allow')?this[_0xaeed('0xc')](_0xaeed('0x32'))[_0xaeed('0x26')](';'):null;},'comment':_0xaeed('0x34')},'autoframing':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2b32b5){this[_0xaeed('0x7')](_0xaeed('0x35'),_0x2b32b5?_0x2b32b5[_0xaeed('0x25')](','):null);},'get':function(){return this[_0xaeed('0xc')]('insecure')?this[_0xaeed('0xc')]('insecure')[_0xaeed('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xaeed('0x19')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xaeed('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xaeed('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no',_0xaeed('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x37'),_0xaeed('0x38'),_0xaeed('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x3a'),_0xaeed('0x3b')),'allowNull':!![],'defaultValue':_0xaeed('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xaeed('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no','fingerprint',_0xaeed('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xaeed('0x19')]('active',_0xaeed('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xaeed('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xaeed('0x19')](_0xaeed('0x2c'),'no','nonat',_0xaeed('0x2e'),_0xaeed('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xaeed('0x15')]},'passwordResetAt':{'type':Sequelize[_0xaeed('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0,'set':function(_0xee77){this['setDataValue'](_0xaeed('0x3f'),_0xee77);var _0x116b48=this[_0xaeed('0x40')]({'plain':!![]});switch(_0xee77){case 0x0:case 0x1:var _0x2281da=_0x116b48[_0xaeed('0x24')]?_[_0xaeed('0x41')](_0x116b48[_0xaeed('0x24')])?_0x116b48[_0xaeed('0x24')][_0xaeed('0x25')]():_0x116b48['transport']:_0xaeed('0x23');if(_0x2281da==='wss'){_0x2281da=_0xaeed('0x23');}this[_0xaeed('0x7')]('transport',_0x2281da);this[_0xaeed('0x7')]('encryption','no');this[_0xaeed('0x7')]('avpf',null);this['setDataValue'](_0xaeed('0x42'),null);this[_0xaeed('0x7')](_0xaeed('0x43'),null);this[_0xaeed('0x7')](_0xaeed('0x44'),null);this[_0xaeed('0x7')](_0xaeed('0x45'),null);this[_0xaeed('0x7')](_0xaeed('0x46'),null);this[_0xaeed('0x7')](_0xaeed('0x47'),null);this[_0xaeed('0x7')](_0xaeed('0x48'),null);this[_0xaeed('0x7')](_0xaeed('0x49'),'no');break;case 0x2:this[_0xaeed('0x7')](_0xaeed('0x24'),_0xaeed('0x4a'));this['setDataValue']('encryption',_0xaeed('0x2c'));this[_0xaeed('0x7')](_0xaeed('0x4b'),_0xaeed('0x2c'));this[_0xaeed('0x7')]('force_avp',_0xaeed('0x2c'));this[_0xaeed('0x7')]('icesupport',_0xaeed('0x2c'));this[_0xaeed('0x7')]('dtlsenable','yes');this[_0xaeed('0x7')](_0xaeed('0x45'),'no');this[_0xaeed('0x7')](_0xaeed('0x46'),_0xaeed('0x4c'));this[_0xaeed('0x7')](_0xaeed('0x47'),_0x116b48[_0xaeed('0x47')]||_0xaeed('0x4d'));this[_0xaeed('0x7')]('dtlsprivatekey',_0x116b48[_0xaeed('0x48')]||_0xaeed('0x4e'));this[_0xaeed('0x7')](_0xaeed('0x49'),_0xaeed('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xaeed('0x4f')],'set':function(_0x3a5c25){this['setDataValue'](_0xaeed('0x50'),_0x3a5c25?_0x3a5c25[_0xaeed('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0xaeed('0x50'))?_[_0xaeed('0x51')](this['getDataValue'](_0xaeed('0x50'))[_0xaeed('0x26')](','),function(_0x469f4b){return parseInt(_0x469f4b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xaeed('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xaeed('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xaeed('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xaeed('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xaeed('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xaeed('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xaeed('0x52')],'get':function(){return this[_0xaeed('0xc')](_0xaeed('0x53'))?this[_0xaeed('0xc')](_0xaeed('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xaeed('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xaeed('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![],'set':function(_0x5ed398){if(typeof _0x5ed398===_0xaeed('0x54')){var _0x2ebf50=_0x5ed398==='1'?!![]:_0x5ed398==='0'?![]:_0x5ed398===_0xaeed('0x55')?!![]:_0x5ed398===_0xaeed('0x56')?![]:![];this['setDataValue'](_0xaeed('0x57'),_0x2ebf50);}else{this[_0xaeed('0x7')](_0xaeed('0x57'),_0x5ed398);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4909ef){this[_0xaeed('0x7')](_0xaeed('0x58'),_0x4909ef);if(_0x4909ef===!![]){this[_0xaeed('0x7')](_0xaeed('0x59'),moment());this[_0xaeed('0x7')]('loginAttempts',0x0);}else{this[_0xaeed('0x7')](_0xaeed('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xaeed('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xaeed('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x2448=['icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','setDataValue','name','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','showWebBar','get','isArray','force_avp'];(function(_0x18c04d,_0x498076){var _0x46e0c6=function(_0x13dfee){while(--_0x13dfee){_0x18c04d['push'](_0x18c04d['shift']());}};_0x46e0c6(++_0x498076);}(_0x2448,0x17b));var _0x8244=function(_0x2424d4,_0x37ac61){_0x2424d4=_0x2424d4-0x0;var _0x1ccc92=_0x2448[_0x2424d4];return _0x1ccc92;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var _=require(_0x8244('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xebb1ea){this[_0x8244('0x3')](_0x8244('0x4'),_0xebb1ea);this[_0x8244('0x3')]('defaultuser',_0xebb1ea);},'comment':_0x8244('0x5')},'fullname':{'type':Sequelize[_0x8244('0x6')],'allowNull':![],'set':function(_0x1aae15){this[_0x8244('0x3')](_0x8244('0x7'),_0x1aae15);this[_0x8244('0x3')](_0x8244('0x8'),util[_0x8244('0x9')](_0x8244('0xa'),_0x1aae15,this[_0x8244('0xb')](_0x8244('0xc'))));}},'alias':{'type':Sequelize[_0x8244('0x6')]},'email':{'type':Sequelize[_0x8244('0x6')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x37d866){if(_0x37d866){this['setDataValue'](_0x8244('0xd'),_0x37d866[_0x8244('0xe')]());}}},'role':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x10'),'user',_0x8244('0x11'),_0x8244('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x8244('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8244('0x6')],'defaultValue':_0x8244('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x8244('0xc'),'set':function(_0x2e63ad){this[_0x8244('0x3')](_0x8244('0xc'),_0x2e63ad);this[_0x8244('0x3')](_0x8244('0x14'),_0x2e63ad);this['setDataValue'](_0x8244('0x8'),util[_0x8244('0x9')]('\x22%s\x22\x20<%s>',this[_0x8244('0xb')]('fullname'),_0x2e63ad));}},'salt':{'type':Sequelize[_0x8244('0x6')]},'phone':{'type':Sequelize[_0x8244('0x6')]},'mobile':{'type':Sequelize[_0x8244('0x6')]},'address':{'type':Sequelize[_0x8244('0x6')]},'zipcode':{'type':Sequelize[_0x8244('0x6')]},'userpic':{'type':Sequelize[_0x8244('0x6')]},'city':{'type':Sequelize[_0x8244('0x6')]},'country':{'type':Sequelize[_0x8244('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8244('0x6')],'defaultValue':_0x8244('0x16')},'lastPauseAt':{'type':Sequelize[_0x8244('0x17')]},'chatCapacity':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8244('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![],'defaultValue':_0x8244('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x8244('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x1a'),'user',_0x8244('0x1b')),'allowNull':!![],'defaultValue':_0x8244('0x1a')},'context':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x8244('0x1c'),_0x8244('0x1d'),_0x8244('0x1e'),_0x8244('0x1f'),_0x8244('0x20'),'PROHIB_PASSED_SCREEN',_0x8244('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![],'defaultValue':_0x8244('0x22'),'set':function(_0x5d400b){this[_0x8244('0x3')](_0x8244('0x23'),_0x5d400b?_0x5d400b[_0x8244('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x8244('0x23'))?this[_0x8244('0xb')]('transport')[_0x8244('0x25')](','):null;},'comment':_0x8244('0x26')},'dtmfmode':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x27'),_0x8244('0x28'),'shortinfo',_0x8244('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x8244('0x27')},'directmedia':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no',_0x8244('0x2b'),_0x8244('0x2c'),_0x8244('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![],'defaultValue':_0x8244('0x2e'),'set':function(_0x3a4a01){this[_0x8244('0x3')](_0x8244('0x2f'),_0x3a4a01?_0x3a4a01[_0x8244('0x24')](','):null);},'get':function(){return this[_0x8244('0xb')](_0x8244('0x2f'))?this[_0x8244('0xb')](_0x8244('0x2f'))[_0x8244('0x25')](','):null;},'comment':_0x8244('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8244('0x6')]},'pickupgroup':{'type':Sequelize[_0x8244('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8244('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8244('0x6')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8244('0x31')},'allow':{'type':Sequelize[_0x8244('0x6')],'allowNull':![],'defaultValue':_0x8244('0x32'),'set':function(_0x11fac8){this['setDataValue'](_0x8244('0x33'),_0x11fac8?_0x11fac8['join'](';'):_0x8244('0x32'));},'get':function(){return this[_0x8244('0xb')](_0x8244('0x33'))?this['getDataValue'](_0x8244('0x33'))['split'](';'):null;},'comment':_0x8244('0x34')},'autoframing':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x13edd5){this[_0x8244('0x3')](_0x8244('0x35'),_0x13edd5?_0x13edd5[_0x8244('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x8244('0x35'))?this['getDataValue'](_0x8244('0x35'))[_0x8244('0x25')](','):null;},'comment':_0x8244('0x36')},'trustrpid':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no',_0x8244('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![],'defaultValue':_0x8244('0x38')},'amaflags':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x8244('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no',_0x8244('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x3a'),'refuse',_0x8244('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x3c'),_0x8244('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x8244('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x8244('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8244('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x8244('0x2a'),'no',_0x8244('0x3e'),_0x8244('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8244('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x40'),_0x8244('0x41'),_0x8244('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8244('0xf')](_0x8244('0x2a'),'no',_0x8244('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8244('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x8244('0x17')]},'passwordResetAt':{'type':Sequelize[_0x8244('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0,'set':function(_0x53a958){this[_0x8244('0x3')](_0x8244('0x43'),_0x53a958);var _0x4cdcce=this[_0x8244('0x44')]({'plain':!![]});switch(_0x53a958){case 0x0:case 0x1:var _0x331310=_0x4cdcce[_0x8244('0x23')]?_[_0x8244('0x45')](_0x4cdcce[_0x8244('0x23')])?_0x4cdcce[_0x8244('0x23')][_0x8244('0x24')]():_0x4cdcce['transport']:_0x8244('0x22');if(_0x331310==='wss'){_0x331310=_0x8244('0x22');}this[_0x8244('0x3')]('transport',_0x331310);this[_0x8244('0x3')]('encryption','no');this[_0x8244('0x3')]('avpf',null);this[_0x8244('0x3')](_0x8244('0x46'),null);this[_0x8244('0x3')](_0x8244('0x47'),null);this[_0x8244('0x3')](_0x8244('0x48'),null);this[_0x8244('0x3')]('dtlsverify',null);this[_0x8244('0x3')](_0x8244('0x49'),null);this[_0x8244('0x3')](_0x8244('0x4a'),null);this[_0x8244('0x3')](_0x8244('0x4b'),null);this[_0x8244('0x3')](_0x8244('0x4c'),'no');break;case 0x2:this[_0x8244('0x3')]('transport',_0x8244('0x4d'));this['setDataValue']('encryption',_0x8244('0x2a'));this[_0x8244('0x3')]('avpf',_0x8244('0x2a'));this[_0x8244('0x3')](_0x8244('0x46'),_0x8244('0x2a'));this['setDataValue'](_0x8244('0x47'),'yes');this[_0x8244('0x3')](_0x8244('0x48'),'yes');this[_0x8244('0x3')]('dtlsverify','no');this[_0x8244('0x3')]('dtlssetup',_0x8244('0x42'));this['setDataValue'](_0x8244('0x4a'),_0x4cdcce['dtlscertfile']||_0x8244('0x4e'));this[_0x8244('0x3')]('dtlsprivatekey',_0x4cdcce[_0x8244('0x4b')]||_0x8244('0x4f'));this[_0x8244('0x3')]('rtcp_mux',_0x8244('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x8244('0x50')],'set':function(_0x3c1c11){this[_0x8244('0x3')](_0x8244('0x51'),_0x3c1c11?_0x3c1c11['join'](','):[]);},'get':function(){return this[_0x8244('0xb')](_0x8244('0x51'))?_['map'](this['getDataValue'](_0x8244('0x51'))['split'](','),function(_0xe13b27){return parseInt(_0xe13b27,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8244('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8244('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8244('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8244('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8244('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x8244('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8244('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8244('0xb')](_0x8244('0x52'))?this[_0x8244('0xb')](_0x8244('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8244('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x10158a){if(typeof _0x10158a==='string'){var _0xeb1ab8=_0x10158a==='1'?!![]:_0x10158a==='0'?![]:_0x10158a===_0x8244('0x53')?!![]:_0x10158a===_0x8244('0x54')?![]:![];this[_0x8244('0x3')](_0x8244('0x55'),_0xeb1ab8);}else{this[_0x8244('0x3')](_0x8244('0x55'),_0x10158a);}}},'blocked':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![],'set':function(_0x2440a0){this[_0x8244('0x3')](_0x8244('0x56'),_0x2440a0);if(_0x2440a0===!![]){this['setDataValue'](_0x8244('0x57'),moment());this[_0x8244('0x3')](_0x8244('0x58'),0x0);}else{this[_0x8244('0x3')](_0x8244('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x8244('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8244('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8244('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8244('0x18')](0x5)[_0x8244('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8244('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8244('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x8244('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 373c13b..709b515 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 _0x4726=['message','result','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','update','destroy','get','role','admin','Telephones','telephone','ignore','map','value','find','UserProfileResource','stack','name','send','index','User','rawAttributes','fieldName','type','includes','password','salt','getOptions','query','includeAll','include','userSetting','true','UserSetting','attributes','findAll','rows','length','push','chat','dataValues','fax','mail','openchannel','whatsapp','all','params','model','keys','intersection','fields','merge','options','openTabs','body','addContacts','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','103','113','104','106','107','109','100','114','115','create','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','Agents','Unauthorized','checkUserLimits','each','some','isEmpty','autoAssociation','compact','changePassword','ValidationError','authenticate','Sequelize','Wrong\x20credentials','oldPassword','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','isValidChannel','add','capitalize','toLowerCase','Queues','ids','QueueId','emit','Queue:save','VoiceQueue','voice','format','SIP/%s','interface','penalty','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','join','getOpenTabs','sms','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','CmContact','filters','order','sort','where','pick','filter','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','voicePause','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','%s%s','Team','getTeams','addTeams','omit','setDataValue','getChatQueues','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Openchannel','flatten','getDataValue','Voice','removeTeams','getVoiceQueues','Fax','getOpenchannelQueues','transaction','removeAgent','TeamVoicePrefix','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gte','$lte','$ne','$eq','$not','$between','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','inbound','getAgents','lower','col','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','ringing','busy','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','moment','bluebird','util','path','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1261ac,_0x357a74){var _0x363168=function(_0x45c05c){while(--_0x45c05c){_0x1261ac['push'](_0x1261ac['shift']());}};_0x363168(++_0x357a74);}(_0x4726,0x174));var _0x6472=function(_0x285145,_0x46e7a1){_0x285145=_0x285145-0x0;var _0x53fe5a=_0x4726[_0x285145];return _0x53fe5a;};'use strict';var moment=require(_0x6472('0x0'));var BPromise=require(_0x6472('0x1'));var util=require(_0x6472('0x2'));var path=require(_0x6472('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6472('0x4'));var jayson=require(_0x6472('0x5'));var Redis=require('ioredis');var authService=require(_0x6472('0x6'));var qs=require(_0x6472('0x7'));var logger=require(_0x6472('0x8'))(_0x6472('0x9'));var utils=require(_0x6472('0xa'));var config=require(_0x6472('0xb'));var licenseUtil=require('../../config/license/util');var db=require(_0x6472('0xc'))['db'];var socket=require(_0x6472('0xd'))(new Redis(config[_0x6472('0xe')]));require(_0x6472('0xf'))[_0x6472('0x10')](socket);config[_0x6472('0xe')]=_[_0x6472('0x11')](config[_0x6472('0xe')],{'host':_0x6472('0x12'),'port':0x18eb});var client=jayson[_0x6472('0x13')][_0x6472('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x589589,_0x1f01a8,_0x2dc449,_0x2f275c){return new BPromise(function(_0xe8df77,_0x40bcb4){var _0x538103=_0x2f275c||client;return _0x538103[_0x6472('0x15')](_0x589589,_0x2dc449)[_0x6472('0x16')](function(_0x151a83){logger[_0x6472('0x17')](_0x6472('0x18'),_0x1f01a8,'request\x20sent');logger[_0x6472('0x19')](_0x6472('0x1a'),_0x1f01a8,_0x6472('0x1b'),JSON[_0x6472('0x1c')](_0x151a83));if(_0x151a83[_0x6472('0x1d')]){if(_0x151a83[_0x6472('0x1d')][_0x6472('0x1e')]===0x1f4){logger['error'](_0x6472('0x18'),_0x1f01a8,_0x151a83[_0x6472('0x1d')][_0x6472('0x1f')]);return _0x40bcb4(_0x151a83[_0x6472('0x1d')][_0x6472('0x1f')]);}logger[_0x6472('0x1d')](_0x6472('0x18'),_0x1f01a8,_0x151a83[_0x6472('0x1d')][_0x6472('0x1f')]);return _0xe8df77(_0x151a83[_0x6472('0x1d')][_0x6472('0x1f')]);}else{logger[_0x6472('0x17')](_0x6472('0x18'),_0x1f01a8,'request\x20sent');_0xe8df77(_0x151a83[_0x6472('0x20')][_0x6472('0x1f')]);}})[_0x6472('0x21')](function(_0x5a1f4b){logger[_0x6472('0x1d')](_0x6472('0x18'),_0x1f01a8,_0x5a1f4b);_0x40bcb4(_0x5a1f4b);});});}function respondWithStatusCode(_0x873d80,_0xad241d){_0xad241d=_0xad241d||0xcc;return function(_0xa06458){if(_0xa06458){return _0x873d80[_0x6472('0x22')](_0xad241d);}return _0x873d80[_0x6472('0x23')](_0xad241d)[_0x6472('0x24')]();};}function respondWithResult(_0x4a0116,_0x5561d0){_0x5561d0=_0x5561d0||0xc8;return function(_0x524f58){if(_0x524f58){return _0x4a0116[_0x6472('0x23')](_0x5561d0)['json'](_0x524f58);}};}function respondWithFilteredResult(_0x4da98c,_0x15f138){return function(_0x17b3fb){if(_0x17b3fb){var _0x42733f=typeof _0x15f138[_0x6472('0x25')]==='undefined'&&typeof _0x15f138[_0x6472('0x26')]==='undefined';var _0x3ffc84=_0x17b3fb[_0x6472('0x27')];var _0x148ddc=_0x42733f?0x0:_0x15f138['offset'];var _0x57e3e1=_0x42733f?_0x17b3fb[_0x6472('0x27')]:_0x15f138[_0x6472('0x25')]+_0x15f138['limit'];var _0x300d49;if(_0x57e3e1>=_0x3ffc84){_0x57e3e1=_0x3ffc84;_0x300d49=0xc8;}else{_0x300d49=0xce;}_0x4da98c[_0x6472('0x23')](_0x300d49);return _0x4da98c[_0x6472('0x28')](_0x6472('0x29'),_0x148ddc+'-'+_0x57e3e1+'/'+_0x3ffc84)[_0x6472('0x2a')](_0x17b3fb);}return null;};}function saveUpdates(_0x220f2f){return function(_0x6905c6){if(_0x6905c6){return _0x6905c6[_0x6472('0x2b')](_0x220f2f)[_0x6472('0x16')](function(_0x537bb1){return _0x537bb1;});}return null;};}function removeEntity(_0x2054a5){return function(_0x53e047){if(_0x53e047){return _0x53e047[_0x6472('0x2c')]()[_0x6472('0x16')](function(){var _0x40a1f9=_0x53e047[_0x6472('0x2d')]({'plain':!![]});if(_0x40a1f9[_0x6472('0x2e')]===_0x6472('0x2f'))return;var _0x662224=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x6472('0x30'),'value':_0x6472('0x31'),'ignore':![]}];var _0x554ffb=_(_0x662224)['filter'](_0x6472('0x32'))[_0x6472('0x33')](_0x6472('0x34'))[_0x6472('0x34')]();if(_['includes'](_0x554ffb,_0x40a1f9[_0x6472('0x2e')])){return;}var _0x230ead=_[_0x6472('0x35')](_0x662224,['value',_0x40a1f9[_0x6472('0x2e')]])['name'];return db[_0x6472('0x36')][_0x6472('0x2c')]({'where':{'type':_0x230ead,'resourceId':_0x40a1f9['id']}})[_0x6472('0x16')](function(){return _0x53e047;});})[_0x6472('0x16')](function(){_0x2054a5[_0x6472('0x23')](0xcc)[_0x6472('0x24')]();});}};}function handleEntityNotFound(_0x337bb4){return function(_0x11ef8b){if(!_0x11ef8b){_0x337bb4[_0x6472('0x22')](0x194);}return _0x11ef8b;};}function handleError(_0x4688e1,_0x46187b){_0x46187b=_0x46187b||0x1f4;return function(_0xe1bc3f){logger[_0x6472('0x1d')](_0xe1bc3f[_0x6472('0x37')]);if(_0xe1bc3f[_0x6472('0x38')]){delete _0xe1bc3f[_0x6472('0x38')];}_0x4688e1['status'](_0x46187b)[_0x6472('0x39')](_0xe1bc3f);};}exports[_0x6472('0x3a')]=function(_0x2901d1,_0x8dbba0){var _0x4cd363={},_0x51a066={'count':0x0,'rows':[]};var _0x328b66=_(db[_0x6472('0x3b')][_0x6472('0x3c')])[_0x6472('0x33')](function(_0x3e837e){return{'name':_0x3e837e[_0x6472('0x3d')],'type':_0x3e837e[_0x6472('0x3e')]['key']};})['filter'](function(_0xcb4fbd){return!_[_0x6472('0x3f')]([_0x6472('0x40'),_0x6472('0x41')],_0xcb4fbd[_0x6472('0x38')]);})[_0x6472('0x34')]();_0x4cd363=qs[_0x6472('0x42')](_0x328b66,_0x2901d1);var _0x2f8bce={'where':_0x4cd363['where']};return db[_0x6472('0x3b')][_0x6472('0x27')](_0x2f8bce)['then'](function(_0x3667a0){_0x51a066[_0x6472('0x27')]=_0x3667a0;if(_0x2901d1[_0x6472('0x43')][_0x6472('0x44')]){_0x4cd363[_0x6472('0x45')]=[{'all':!![]}];}if(_0x2901d1[_0x6472('0x43')][_0x6472('0x46')]===_0x6472('0x47')){_0x4cd363['include']=[{'model':db[_0x6472('0x48')],'as':_0x6472('0x46')}];}if(!_[_0x6472('0x3f')](_0x4cd363[_0x6472('0x49')],'id')){_0x4cd363[_0x6472('0x49')]['push']('id');}return db['User'][_0x6472('0x4a')](_0x4cd363);})[_0x6472('0x16')](function(_0x330c13){_0x51a066[_0x6472('0x4b')]=_0x330c13;if(_0x2901d1[_0x6472('0x43')]['openTabs']==='true'){var _0x5052af=[];for(var _0x419c37=0x0;_0x419c37<_0x51a066[_0x6472('0x4b')][_0x6472('0x4c')];_0x419c37++){_0x5052af[_0x6472('0x4d')](get_open_tabs(_0x6472('0x4e'),_0x51a066['rows'][_0x419c37][_0x6472('0x4f')]));_0x5052af[_0x6472('0x4d')](get_open_tabs('sms',_0x51a066['rows'][_0x419c37][_0x6472('0x4f')]));_0x5052af[_0x6472('0x4d')](get_open_tabs(_0x6472('0x50'),_0x51a066[_0x6472('0x4b')][_0x419c37][_0x6472('0x4f')]));_0x5052af[_0x6472('0x4d')](get_open_tabs(_0x6472('0x51'),_0x51a066[_0x6472('0x4b')][_0x419c37][_0x6472('0x4f')]));_0x5052af[_0x6472('0x4d')](get_open_tabs(_0x6472('0x52'),_0x51a066[_0x6472('0x4b')][_0x419c37][_0x6472('0x4f')]));_0x5052af[_0x6472('0x4d')](get_open_tabs(_0x6472('0x53'),_0x51a066[_0x6472('0x4b')][_0x419c37]['dataValues']));}return BPromise[_0x6472('0x54')](_0x5052af)[_0x6472('0x16')](function(){return _0x51a066;});}else{return _0x51a066;}})[_0x6472('0x16')](respondWithFilteredResult(_0x8dbba0,_0x4cd363))[_0x6472('0x21')](handleError(_0x8dbba0,null));};exports['show']=function(_0x4fd322,_0x2653a2){var _0x13feca={'raw':![],'where':{'id':_0x4fd322[_0x6472('0x55')]['id']}},_0x448488={};_0x448488[_0x6472('0x56')]=_['differenceBy'](_[_0x6472('0x57')](db[_0x6472('0x3b')][_0x6472('0x3c')]),['password',_0x6472('0x41')]);_0x448488[_0x6472('0x43')]=_[_0x6472('0x57')](_0x4fd322['query']);_0x448488['filters']=_[_0x6472('0x58')](_0x448488['model'],_0x448488[_0x6472('0x43')]);_0x13feca[_0x6472('0x49')]=_['intersection'](_0x448488[_0x6472('0x56')],qs[_0x6472('0x59')](_0x4fd322[_0x6472('0x43')][_0x6472('0x59')]));_0x13feca[_0x6472('0x49')]=_0x13feca['attributes'][_0x6472('0x4c')]?_0x13feca['attributes']:_0x448488[_0x6472('0x56')];if(_0x4fd322['query']['includeAll']){_0x13feca[_0x6472('0x45')]=[{'all':!![]}];}if(_0x4fd322[_0x6472('0x43')]['userSetting']===_0x6472('0x47')){_0x13feca[_0x6472('0x45')]=[{'model':db[_0x6472('0x48')],'as':'userSetting'}];}_0x13feca=_[_0x6472('0x5a')]({},_0x13feca,_0x4fd322[_0x6472('0x5b')]);if(!_[_0x6472('0x3f')](_0x13feca['attributes'],'id')){_0x13feca[_0x6472('0x49')][_0x6472('0x4d')]('id');}return db['User'][_0x6472('0x35')](_0x13feca)[_0x6472('0x16')](handleEntityNotFound(_0x2653a2,null))[_0x6472('0x16')](function(_0x2e5872){var _0x134644=[];values=_0x2e5872;if(_0x4fd322[_0x6472('0x43')][_0x6472('0x5c')]===_0x6472('0x47')){_0x134644[_0x6472('0x4d')](get_open_tabs('chat',_0x2e5872['dataValues']));_0x134644[_0x6472('0x4d')](get_open_tabs('sms',_0x2e5872[_0x6472('0x4f')]));_0x134644[_0x6472('0x4d')](get_open_tabs(_0x6472('0x52'),_0x2e5872[_0x6472('0x4f')]));_0x134644[_0x6472('0x4d')](get_open_tabs(_0x6472('0x53'),_0x2e5872[_0x6472('0x4f')]));_0x134644[_0x6472('0x4d')](get_open_tabs(_0x6472('0x50'),_0x2e5872[_0x6472('0x4f')]));_0x134644['push'](get_open_tabs(_0x6472('0x51'),_0x2e5872[_0x6472('0x4f')]));return BPromise[_0x6472('0x54')](_0x134644);}else{return values;}})['then'](function(){return values;})[_0x6472('0x16')](respondWithResult(_0x2653a2,null))[_0x6472('0x21')](handleError(_0x2653a2,null));};exports[_0x6472('0x2b')]=function(_0x50d0d1,_0xe0c8c3){if(_0x50d0d1[_0x6472('0x5d')]['id']){delete _0x50d0d1['body']['id'];}delete _0x50d0d1[_0x6472('0x5d')][_0x6472('0x2e')];return db['User']['find']({'where':{'id':_0x50d0d1[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0xe0c8c3,null))[_0x6472('0x16')](saveUpdates(_0x50d0d1[_0x6472('0x5d')],null))[_0x6472('0x16')](respondWithResult(_0xe0c8c3,null))[_0x6472('0x21')](handleError(_0xe0c8c3,null));};exports['describe']=function(_0x39abfe,_0x8f3c8e){return db[_0x6472('0x3b')]['describe']()[_0x6472('0x16')](respondWithResult(_0x8f3c8e,null))['catch'](handleError(_0x8f3c8e,null));};exports[_0x6472('0x5e')]=function(_0x580883,_0x5e7fa7){return db['User'][_0x6472('0x35')]({'where':{'id':_0x580883['params']['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x5e7fa7,null))[_0x6472('0x16')](function(_0x4ae305){if(_0x4ae305){return _0x4ae305[_0x6472('0x5e')](_0x580883[_0x6472('0x5d')]['ids'],_['omit'](_0x580883[_0x6472('0x5d')],['ids','id'])||{});}})[_0x6472('0x16')](respondWithResult(_0x5e7fa7,null))[_0x6472('0x21')](handleError(_0x5e7fa7,null));};function validateUser(_0x3dc04d){return new BPromise(function(_0x43bc18,_0x1705fd){if(_0x3dc04d[_0x6472('0x5f')])return _0x43bc18(_0x3dc04d);return db[_0x6472('0x60')][_0x6472('0x61')](0x1)[_0x6472('0x16')](function(_0x894581){if(_0x894581['securePassword'])authService[_0x6472('0x62')](_0x3dc04d['password']);db[_0x6472('0x3b')][_0x6472('0x63')](_0x6472('0x5f'))['then'](function(_0x4845eb){if(_[_0x6472('0x64')](_0x4845eb)){_0x3dc04d[_0x6472('0x5f')]=_0x894581[_0x6472('0x65')]||0x1;return;}if(_[_0x6472('0x64')](_0x894581[_0x6472('0x65')])||_0x894581['min_internal']===_0x4845eb){_0x3dc04d[_0x6472('0x5f')]=_0x4845eb+0x1;return;}if(_0x894581['min_internal']>_0x4845eb){_0x3dc04d[_0x6472('0x5f')]=_0x894581[_0x6472('0x65')];return;}return db[_0x6472('0x66')][_0x6472('0x43')](_0x6472('0x67'),{'type':db[_0x6472('0x66')]['QueryTypes']['SELECT']})[_0x6472('0x16')](function(_0x3eb83d){if(_0x3eb83d&&_0x3eb83d[_0x6472('0x4c')]){for(var _0x2acb44=0x0,_0x8b59d0=_0x3eb83d[_0x6472('0x4c')];_0x2acb44<_0x8b59d0&&_[_0x6472('0x64')](_0x3dc04d[_0x6472('0x5f')]);_0x2acb44++){if(_0x894581['min_internal']<=_0x3eb83d[_0x2acb44][_0x6472('0x68')]){_0x3dc04d[_0x6472('0x5f')]=_0x3eb83d[_0x2acb44][_0x6472('0x68')];}else if(_0x894581['min_internal']>_0x3eb83d[_0x2acb44][_0x6472('0x68')]&&_0x894581[_0x6472('0x65')]<=_0x3eb83d[_0x2acb44]['to']){_0x3dc04d[_0x6472('0x5f')]=_0x894581[_0x6472('0x65')];}}}if(_[_0x6472('0x64')](_0x3dc04d['internal'])){_0x3dc04d['internal']=_0x4845eb+0x1;}return _0x43bc18(_0x3dc04d);});});})[_0x6472('0x21')](function(_0x439fff){_0x1705fd(_0x439fff);});});}function updateUser(_0x4a8b9b){return new BPromise(function(_0x2f2326,_0x244548){try{if(_0x4a8b9b[_0x6472('0x69')]){_0x4a8b9b[_0x6472('0x6a')]=_0x4a8b9b[_0x6472('0x5f')];_0x4a8b9b[_0x6472('0x6b')]={'mailbox':_0x4a8b9b[_0x6472('0x5f')],'password':_0x4a8b9b['password'],'fullname':_0x4a8b9b[_0x6472('0x6c')],'email':_0x4a8b9b['email']};}if(_0x4a8b9b[_0x6472('0x2e')]===_0x6472('0x6d')){if(!_0x4a8b9b[_0x6472('0x6e')])_0x4a8b9b['permissions']=[_0x6472('0x6f'),'102',_0x6472('0x70'),_0x6472('0x71'),'110',_0x6472('0x72'),'105',_0x6472('0x73'),_0x6472('0x74'),'108',_0x6472('0x75'),_0x6472('0x76'),'111',_0x6472('0x77'),_0x6472('0x78')];}_0x2f2326(_0x4a8b9b);}catch(_0x4d4d2d){_0x244548(_0x4d4d2d);}});}exports[_0x6472('0x79')]=function(_0x3e4489,_0x13bd8c){if(_0x3e4489['user'][_0x6472('0x2e')]===_0x6472('0x6d'))throw new Error('Unauthorized');if(_0x3e4489[_0x6472('0x5d')][_0x6472('0x2e')]===_0x6472('0x7a')&&_0x3e4489[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x2f')){throw new Error(_0x6472('0x7b'));}if(_0x3e4489[_0x6472('0x5d')][_0x6472('0x2e')]===_0x6472('0x2f')&&_0x3e4489[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x3e4489['body']])[_0x6472('0x16')](function(){return validateUser(_0x3e4489[_0x6472('0x5d')]);})['then'](function(_0x4095ba){return updateUser(_0x4095ba)[_0x6472('0x16')](function(_0x2dc43a){if(_0x2dc43a[_0x6472('0x2e')]===_0x6472('0x2f')){_0x2dc43a[_0x6472('0x7c')]=_0x3e4489['user'][_0x6472('0x7c')];delete _0x2dc43a[_0x6472('0x7d')];}return _0x2dc43a;});})['then'](function(_0x3cce40){return db[_0x6472('0x3b')]['create'](_0x3cce40,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x5634b8){if(_0x3e4489[_0x6472('0x5d')][_0x6472('0x2e')]===_0x6472('0x7a'))return _0x5634b8;if(_0x3e4489[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x7a'))return _0x5634b8;return db['UserProfileSection']['find']({'where':{'name':_0x5634b8['role']==='agent'?_0x6472('0x7e'):'Telephones','userProfileId':_0x3e4489[_0x6472('0x7a')]['userProfileId']},'raw':!![]})['then'](function(_0x15384a){if(!_0x15384a||_0x15384a['autoAssociation']!=0x0)return _0x5634b8;return db[_0x6472('0x36')][_0x6472('0x79')]({'name':_0x5634b8[_0x6472('0x38')],'resourceId':_0x5634b8['id'],'type':_0x15384a[_0x6472('0x38')],'sectionId':_0x15384a['id']},{})[_0x6472('0x16')](function(){return _0x5634b8;});})[_0x6472('0x21')](function(_0x4488cb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4488cb);throw _0x4488cb;});})[_0x6472('0x16')](respondWithResult(_0x13bd8c,0xc9))[_0x6472('0x21')](handleError(_0x13bd8c,null));};exports['bulkCreate']=function(_0x1f7891,_0x206850){var _0x4029df=_0x1f7891['body'];var _0x1e1f74=[];if(_0x1f7891[_0x6472('0x7a')][_0x6472('0x2e')]==='agent')throw new Error(_0x6472('0x7f'));if(_['some'](_0x4029df,[_0x6472('0x2e'),_0x6472('0x7a')])&&_0x1f7891[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x4029df,['role',_0x6472('0x2f')])&&_0x1f7891[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x6472('0x80')](_0x4029df)[_0x6472('0x16')](function(){return validateUser(_0x4029df[0x0]);})[_0x6472('0x16')](function(){for(var _0x175c80=0x1;_0x175c80<_0x4029df['length'];_0x175c80++){var _0x4a659f=_0x4029df[_0x175c80-0x1]['internal'];if(!_0x4029df[_0x175c80][_0x6472('0x5f')])_0x4029df[_0x175c80][_0x6472('0x5f')]=_0x4a659f+0x1;_0x1e1f74[_0x6472('0x4d')](validateUser(_0x4029df[_0x175c80]));}return BPromise[_0x6472('0x54')](_0x1e1f74);})[_0x6472('0x16')](function(){_0x1e1f74=[];for(var _0x4192ed=0x0;_0x4192ed<_0x4029df[_0x6472('0x4c')];_0x4192ed++){_0x1e1f74[_0x6472('0x4d')](updateUser(_0x4029df[_0x4192ed]));}return BPromise[_0x6472('0x54')](_0x1e1f74);})[_0x6472('0x16')](function(){return BPromise[_0x6472('0x81')](_0x4029df,function(_0x55575f){return db[_0x6472('0x3b')][_0x6472('0x79')](_0x55575f,{'include':[{'model':db[_0x6472('0x6b')],'as':_0x6472('0x6b')}]})[_0x6472('0x16')](function(_0x2b4079){_0x55575f['id']=_0x2b4079['id'];return _0x55575f;});});})[_0x6472('0x16')](function(_0x107923){if(_0x1f7891[_0x6472('0x5d')][_0x6472('0x2e')]==='user')return _0x107923;if(_0x1f7891[_0x6472('0x7a')][_0x6472('0x2e')]!==_0x6472('0x7a'))return _0x107923;var _0x4d35d4=_[_0x6472('0x82')](_0x107923,function(_0x3d22a8){return _0x3d22a8[_0x6472('0x2e')]==='agent'||_0x3d22a8['role']===_0x6472('0x31');});if(!_0x4d35d4)return _0x107923;return db['UserProfileSection'][_0x6472('0x4a')]({'where':{'name':{'$or':[_0x6472('0x7e'),_0x6472('0x30')]},'userProfileId':_0x1f7891[_0x6472('0x7a')][_0x6472('0x7d')]},'raw':!![]})[_0x6472('0x16')](function(_0x2f79dc){if(_[_0x6472('0x83')](_0x2f79dc)||!_['some'](_0x2f79dc,[_0x6472('0x84'),0x0]))return _0x107923;_0x1e1f74=[];var _0x375cf2=_(_0x2f79dc)['map'](function(_0xd4bb9e){if(_0xd4bb9e[_0x6472('0x84')]===0x1)return;return _0xd4bb9e[_0x6472('0x38')]===_0x6472('0x7e')?_0x6472('0x6d'):_0x6472('0x31');})[_0x6472('0x85')]()[_0x6472('0x34')]();for(var _0x402c38=0x0;_0x402c38<_0x107923['length'];_0x402c38++){if(!_[_0x6472('0x3f')](_0x375cf2,_0x107923[_0x402c38][_0x6472('0x2e')]))return;var _0xd318df=_0x107923[_0x402c38][_0x6472('0x2e')]===_0x6472('0x6d')?_0x6472('0x7e'):_0x6472('0x30');_0x1e1f74['push'](db[_0x6472('0x36')][_0x6472('0x79')]({'name':_0x107923[_0x402c38]['name'],'resourceId':_0x107923[_0x402c38]['id'],'type':_0xd318df,'sectionId':_[_0x6472('0x35')](_0x2f79dc,[_0x6472('0x38'),_0xd318df])['id']},{}));}return BPromise[_0x6472('0x54')](_0x1e1f74);});})[_0x6472('0x16')](respondWithResult(_0x206850,0xc9))['catch'](handleError(_0x206850,null));};exports[_0x6472('0x86')]=function(_0x261d10,_0x5862a5){if(_0x261d10[_0x6472('0x5d')]['id']){delete _0x261d10[_0x6472('0x5d')]['id'];}return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x261d10[_0x6472('0x55')]['id']}})[_0x6472('0x16')](function(_0x452a02){if(!_0x452a02)return null;if(_0x452a02['id']===_0x261d10[_0x6472('0x7a')]['id']){if(!_0x261d10[_0x6472('0x5d')]['oldPassword']||!_0x261d10[_0x6472('0x5d')]['newPassword']){throw new db['Sequelize'][(_0x6472('0x87'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x452a02[_0x6472('0x88')](_0x261d10[_0x6472('0x5d')]['oldPassword'])){throw new db[(_0x6472('0x89'))]['ValidationError'](_0x6472('0x8a'));}if(_0x261d10[_0x6472('0x5d')][_0x6472('0x8b')]===_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')]){throw new db['Sequelize'][(_0x6472('0x87'))](_0x6472('0x8d'));}}else if(_0x261d10[_0x6472('0x7a')][_0x6472('0x2e')]===_0x6472('0x2f')){if(!_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')]){throw new db['Sequelize'][(_0x6472('0x87'))](_0x6472('0x8e'));}}else if(_0x261d10[_0x6472('0x7a')][_0x6472('0x2e')]===_0x6472('0x7a')){if(!_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x452a02[_0x6472('0x2e')]!==_0x6472('0x6d')){throw new db[(_0x6472('0x89'))][(_0x6472('0x87'))](_0x6472('0x7f'));}}else{throw new db[(_0x6472('0x89'))][(_0x6472('0x87'))](_0x6472('0x7f'));}return _0x452a02;})[_0x6472('0x16')](handleEntityNotFound(_0x5862a5,null))['then'](function(_0x32445d){return db[_0x6472('0x60')][_0x6472('0x8f')]({'attributes':['id',_0x6472('0x90'),_0x6472('0x91'),_0x6472('0x92')]})[_0x6472('0x16')](function(_0x24cc62){if(_0x24cc62[_0x6472('0x90')])authService['validatePasswordPattern'](_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')]);if(!_0x24cc62[_0x6472('0x91')]||!_0x32445d[_0x6472('0x93')])return _0x32445d;authService[_0x6472('0x94')](_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')],_0x32445d[_0x6472('0x93')],_0x24cc62[_0x6472('0x92')]);return _0x32445d;})[_0x6472('0x16')](saveUpdates({'password':_0x261d10[_0x6472('0x5d')]['newPassword'],'passwordResetAt':_0x261d10['user']['id']==_0x261d10['params']['id']?moment():null,'previousPasswords':authService[_0x6472('0x95')](_0x261d10[_0x6472('0x5d')][_0x6472('0x8c')],_0x32445d[_0x6472('0x93')])},null));})[_0x6472('0x16')](respondWithResult(_0x5862a5,null))[_0x6472('0x21')](handleError(_0x5862a5,null));};exports['addQueues']=function(_0xe1ccd4,_0xb21fa6){var _0x3f15cf=_0xe1ccd4[_0x6472('0x5d')][_0x6472('0x96')];return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0xe1ccd4['params']['id']},'attributes':['id','name',_0x6472('0x2e'),_0x6472('0x97'),_0x6472('0x98'),'voicePause','interface']})[_0x6472('0x16')](handleEntityNotFound(_0xb21fa6,null))['then'](function(_0x48f1db){if(_0x48f1db){if(!utils[_0x6472('0x99')](_0x3f15cf)){throw new db[(_0x6472('0x89'))][(_0x6472('0x87'))]('Unknown\x20channel');}return _0x48f1db[_0x6472('0x9a')+_[_0x6472('0x9b')](_0x3f15cf[_0x6472('0x9c')]())+_0x6472('0x9d')](_0xe1ccd4['body']['ids'],{'penalty':_0xe1ccd4[_0x6472('0x5d')]['penalty']||0x0})['spread'](function(_0x32b10a){for(var _0x4e0c1a=0x0;_0x4e0c1a<_0xe1ccd4[_0x6472('0x5d')][_0x6472('0x9e')]['length'];_0x4e0c1a+=0x1){var _0x14ffcb={'UserId':Number(_0xe1ccd4['params']['id'])};_0x14ffcb[_[_0x6472('0x9b')](_0x3f15cf[_0x6472('0x9c')]())+_0x6472('0x9f')]=Number(_0xe1ccd4[_0x6472('0x5d')][_0x6472('0x9e')][_0x4e0c1a]);socket[_0x6472('0xa0')]('user'+_[_0x6472('0x9b')](_0x3f15cf[_0x6472('0x9c')]())+_0x6472('0xa1'),_0x14ffcb);}return _0x32b10a;})[_0x6472('0x16')](function(){if(_0x3f15cf==='voice'){return db[_0x6472('0xa2')][_0x6472('0x4a')]({'where':{'id':_0xe1ccd4[_0x6472('0x5d')][_0x6472('0x9e')]||[]},'raw':!![],'attributes':['id',_0x6472('0x38')]});}})['then'](function(_0x241fca){var _0x24847a=_0x48f1db[_0x6472('0x2d')]({'plain':!![]});var _0x367ca7=[];if(_0x3f15cf===_0x6472('0xa3')&&_0x24847a['role']===_0x6472('0x6d')&&_0x24847a['online']){for(var _0x15f472=0x0;_0x15f472<_0x241fca[_0x6472('0x4c')];_0x15f472+=0x1){_0x367ca7['push']({'membername':_0x24847a['name'],'UserId':_0x24847a['id'],'queue_name':_0x241fca[_0x15f472][_0x6472('0x38')],'VoiceQueueId':_0x241fca[_0x15f472]['id'],'interface':_[_0x6472('0x64')](_0x24847a['interface'])?util[_0x6472('0xa4')](_0x6472('0xa5'),_0x24847a[_0x6472('0x38')]):_0x24847a[_0x6472('0xa6')],'paused':_0x24847a['voicePause']||![],'penalty':_0xe1ccd4[_0x6472('0x5d')][_0x6472('0xa7')]||0x0});}return BPromise[_0x6472('0x81')](_0x367ca7,function(_0x2619ff){return db[_0x6472('0xa8')][_0x6472('0xa9')](_0x2619ff);});}return _0x48f1db;});}})[_0x6472('0x16')](respondWithStatusCode(_0xb21fa6,null))[_0x6472('0x21')](handleError(_0xb21fa6,null));};exports[_0x6472('0xaa')]=function(_0x57af8c,_0x26c67f){var _0x324cc3,_0x272fe2;return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x57af8c[_0x6472('0x55')]['id']},'attributes':['id',_0x6472('0x38'),_0x6472('0x2e')]})[_0x6472('0x16')](handleEntityNotFound(_0x26c67f,null))['then'](function(_0x5c7146){if(_0x5c7146){_0x324cc3=_0x5c7146;if(!_0x57af8c['query'][_0x6472('0x96')]||!utils[_0x6472('0x99')](_0x57af8c[_0x6472('0x43')]['channel'])){throw new db['Sequelize'][(_0x6472('0x87'))](_0x6472('0xab'));}return _0x5c7146[_0x6472('0xac')+_[_0x6472('0x9b')](_0x57af8c[_0x6472('0x43')][_0x6472('0x96')]['toLowerCase']())+_0x6472('0x9d')](_0x57af8c['query'][_0x6472('0x9e')]);}})[_0x6472('0x16')](function(_0x128ca7){if(_[_0x6472('0xad')](_0x57af8c['query'][_0x6472('0x9e')])){for(var _0x4bb796=0x0;_0x4bb796<_0x57af8c[_0x6472('0x43')][_0x6472('0x9e')][_0x6472('0x4c')];_0x4bb796+=0x1){_0x272fe2={'UserId':Number(_0x57af8c[_0x6472('0x55')]['id'])};_0x272fe2[_[_0x6472('0x9b')](_0x57af8c['query'][_0x6472('0x96')][_0x6472('0x9c')]())+_0x6472('0x9f')]=Number(_0x57af8c[_0x6472('0x43')][_0x6472('0x9e')][_0x4bb796]);socket[_0x6472('0xa0')](_0x6472('0x7a')+_[_0x6472('0x9b')](_0x57af8c['query'][_0x6472('0x96')][_0x6472('0x9c')]())+'Queue:remove',_0x272fe2);}}else{_0x272fe2={'UserId':Number(_0x57af8c[_0x6472('0x55')]['id'])};_0x272fe2[_[_0x6472('0x9b')](_0x57af8c['query'][_0x6472('0x96')][_0x6472('0x9c')]())+'QueueId']=Number(_0x57af8c[_0x6472('0x43')][_0x6472('0x9e')]);socket[_0x6472('0xa0')](_0x6472('0x7a')+_[_0x6472('0x9b')](_0x57af8c['query'][_0x6472('0x96')]['toLowerCase']())+_0x6472('0xae'),_0x272fe2);}return _0x128ca7;})[_0x6472('0x16')](function(){if(_0x57af8c[_0x6472('0x43')]['channel']===_0x6472('0xa3')){return db[_0x6472('0xa8')][_0x6472('0x2c')]({'where':{'UserId':_0x57af8c[_0x6472('0x55')]['id'],'VoiceQueueId':_0x57af8c[_0x6472('0x43')][_0x6472('0x9e')]},'individualHooks':!![]})['then'](function(){return _0x324cc3;});}return _0x324cc3;})[_0x6472('0x16')](respondWithStatusCode(_0x26c67f,null))['catch'](handleError(_0x26c67f,null));};exports[_0x6472('0xaf')]=function(_0x2ad547,_0x1839d){_0x2ad547[_0x6472('0x5d')]['userpic']=_0x2ad547[_0x6472('0xb0')][_0x6472('0xb1')];return db[_0x6472('0x3b')]['find']({'where':{'id':_0x2ad547[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x1839d,null))[_0x6472('0x16')](saveUpdates(_0x2ad547[_0x6472('0x5d')],null))[_0x6472('0x16')](respondWithResult(_0x1839d,null))['catch'](handleError(_0x1839d,null));};exports[_0x6472('0xb2')]=function(_0x187ac3,_0x378ee5){var _0x5aa078=path['join'](config[_0x6472('0xb3')],_0x6472('0xb4'));return db[_0x6472('0x3b')]['find']({'where':{'id':_0x187ac3['params']['id']},'attributes':['id',_0x6472('0xb5')],'raw':!![]})[_0x6472('0x16')](handleEntityNotFound(_0x378ee5,null))[_0x6472('0x16')](function(_0x553628){if(_0x553628){if(_[_0x6472('0x64')](_0x553628[_0x6472('0xb5')])){return _0x378ee5[_0x6472('0xb6')](_0x5aa078);}else{if(!fs[_0x6472('0xb7')](path['join'](config['root'],_0x6472('0xb8'),_0x553628[_0x6472('0xb5')]))){return _0x378ee5[_0x6472('0xb6')](_0x5aa078);}return _0x378ee5[_0x6472('0xb6')](path[_0x6472('0xb9')](config[_0x6472('0xb3')],'server/files/images/',_0x553628[_0x6472('0xb5')]));}}})[_0x6472('0x21')](handleError(_0x378ee5,null));};exports[_0x6472('0xba')]=function(_0x115c4b,_0x238543){return db['User'][_0x6472('0x35')]({'where':{'id':_0x115c4b['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x238543,null))[_0x6472('0x16')](function(_0x431533){var _0x71ab23=[];values=_0x431533[_0x6472('0x4f')];_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0x4e'),_0x431533[_0x6472('0x4f')]));_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0xbb'),_0x431533[_0x6472('0x4f')]));_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0x52'),_0x431533[_0x6472('0x4f')]));_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0x53'),_0x431533[_0x6472('0x4f')]));_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0x50'),_0x431533['dataValues']));_0x71ab23[_0x6472('0x4d')](get_open_tabs(_0x6472('0x51'),_0x431533['dataValues']));return BPromise[_0x6472('0x54')](_0x71ab23);})[_0x6472('0x16')](function(_0x4bf526){if(_0x4bf526){var _0x4756a2=_[_0x6472('0x33')](values['ChatOpenTabs'],function(_0x5b696d){return{'channel':_0x6472('0xbc'),'id':_0x5b696d['id'],'createdAt':_0x5b696d[_0x6472('0xbd')]};});var _0x1d31d0=_[_0x6472('0x33')](values[_0x6472('0xbe')],function(_0x15223f){return{'channel':_0x6472('0xbf'),'id':_0x15223f['id'],'createdAt':_0x15223f[_0x6472('0xbd')]};});var _0x15a4be=_['map'](values[_0x6472('0xc0')],function(_0x5f43b3){return{'channel':'OPENCHANNEL','id':_0x5f43b3['id'],'createdAt':_0x5f43b3[_0x6472('0xbd')]};});var _0x120e5b=_[_0x6472('0x33')](values['MailOpenTabs'],function(_0x567a19){return{'channel':_0x6472('0xc1'),'id':_0x567a19['id'],'createdAt':_0x567a19[_0x6472('0xbd')]};});var _0x533fa4=_[_0x6472('0x33')](values[_0x6472('0xc2')],function(_0x574525){return{'channel':'SMS','id':_0x574525['id'],'createdAt':_0x574525['createdAt']};});var _0x5b04e7=_[_0x6472('0x33')](values[_0x6472('0xc3')],function(_0x55682b){return{'channel':_0x6472('0xc4'),'id':_0x55682b['id'],'createdAt':_0x55682b[_0x6472('0xbd')]};});var _0x31c5f7=_[_0x6472('0xc5')](_0x4756a2,_0x1d31d0,_0x15a4be,_0x120e5b,_0x533fa4,_0x5b04e7);var _0x1b129e={'count':_0x31c5f7[_0x6472('0x4c')],'rows':_0x31c5f7};return _0x1b129e;}else return null;})[_0x6472('0x16')](respondWithResult(_0x238543,null))[_0x6472('0x21')](handleError(_0x238543,null));};exports['getContacts']=function(_0x22bb53,_0x276708){var _0x2042f4={};var _0x8bd0ce={};var _0x5794c2;var _0x38cd05;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x22bb53['params']['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x276708,null))[_0x6472('0x16')](function(_0x143a3f){if(_0x143a3f){_0x5794c2=_0x143a3f;_0x8bd0ce['model']=_[_0x6472('0x57')](db[_0x6472('0xc6')][_0x6472('0x3c')]);_0x8bd0ce[_0x6472('0x43')]=_[_0x6472('0x57')](_0x22bb53[_0x6472('0x43')]);_0x8bd0ce[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x8bd0ce['model'],_0x8bd0ce[_0x6472('0x43')]);_0x2042f4['attributes']=_[_0x6472('0x58')](_0x8bd0ce[_0x6472('0x56')],qs[_0x6472('0x59')](_0x22bb53[_0x6472('0x43')][_0x6472('0x59')]));_0x2042f4[_0x6472('0x49')]=_0x2042f4[_0x6472('0x49')][_0x6472('0x4c')]?_0x2042f4[_0x6472('0x49')]:_0x8bd0ce[_0x6472('0x56')];_0x2042f4[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x22bb53[_0x6472('0x43')][_0x6472('0xc9')]);_0x2042f4[_0x6472('0xca')]=qs['filters'](_[_0x6472('0xcb')](_0x22bb53[_0x6472('0x43')],_0x8bd0ce[_0x6472('0xc7')]));if(_0x22bb53['query'][_0x6472('0xcc')]){_0x2042f4[_0x6472('0xca')]=_['merge'](_0x2042f4[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x2042f4[_0x6472('0x49')],function(_0x5d9f64){var _0x23bd54={};_0x23bd54[_0x5d9f64]={'$like':'%'+_0x22bb53[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x23bd54;})});}_0x2042f4=_['merge']({},_0x2042f4,_0x22bb53[_0x6472('0x5b')]);return _0x5794c2[_0x6472('0xcd')](_0x2042f4);}})['then'](function(_0x4c29b7){if(_0x4c29b7){_0x38cd05=_0x4c29b7[_0x6472('0x4c')];if(_0x22bb53['query'][_0x6472('0xce')]('includeAll')){_0x2042f4[_0x6472('0x45')]=[{'model':db[_0x6472('0xcf')],'as':_0x6472('0xd0'),'required':![]},{'model':db[_0x6472('0xd1')],'as':_0x6472('0xd2'),'attributes':['id','name',_0x6472('0xd3')],'where':_0x22bb53[_0x6472('0x43')][_0x6472('0xd4')]?{'id':_0x22bb53[_0x6472('0x43')][_0x6472('0xd4')]}:undefined,'required':_0x22bb53[_0x6472('0x43')][_0x6472('0xd4')]?!![]:![]}];}if(!_0x22bb53[_0x6472('0x43')][_0x6472('0xce')]('nolimit')){_0x2042f4[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x22bb53[_0x6472('0x43')][_0x6472('0x26')]);_0x2042f4[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x22bb53['query'][_0x6472('0x25')]);}return _0x5794c2[_0x6472('0xcd')](_0x2042f4);}})[_0x6472('0x16')](function(_0x13077b){if(_0x13077b){return _0x13077b?{'count':_0x38cd05,'rows':_0x13077b}:null;}})[_0x6472('0x16')](respondWithResult(_0x276708,null))[_0x6472('0x21')](handleError(_0x276708,null));};exports[_0x6472('0xd5')]=function(_0x415aa0,_0x1a5b41){var _0x2dbdcb;var _0x28b240={};var _0x4a3c86;return db[_0x6472('0x3b')]['findOne']({'where':{'id':_0x415aa0['params']['id']},'attributes':['id',_0x6472('0x38'),'role']})[_0x6472('0x16')](handleEntityNotFound(_0x1a5b41,null))[_0x6472('0x16')](function(_0x8f1aef){if(!utils['isValidChannel'](_0x415aa0[_0x6472('0x43')][_0x6472('0x96')])){throw new db[(_0x6472('0x89'))][(_0x6472('0x87'))](_0x6472('0xab'));}_0x2dbdcb=_0x8f1aef;var _0xdbf39f={};_0xdbf39f[_0x6472('0x56')]=_[_0x6472('0x57')](db[_[_0x6472('0x9b')](_0x415aa0[_0x6472('0x43')]['channel'])+'Queue']['rawAttributes']);_0xdbf39f[_0x6472('0x43')]=_[_0x6472('0x57')](_0x415aa0['query']);_0xdbf39f['filters']=_[_0x6472('0x58')](_0xdbf39f[_0x6472('0x56')],_0xdbf39f['query']);_0x28b240[_0x6472('0x49')]=_[_0x6472('0x58')](_0xdbf39f[_0x6472('0x56')],qs['fields'](_0x415aa0['query'][_0x6472('0x59')]));_0x28b240[_0x6472('0x49')]=_0x28b240[_0x6472('0x49')][_0x6472('0x4c')]?_0x28b240[_0x6472('0x49')]:_0xdbf39f[_0x6472('0x56')];_0x28b240[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x415aa0[_0x6472('0x43')][_0x6472('0xc9')]);_0x28b240[_0x6472('0xca')]=qs['filters'](_[_0x6472('0xcb')](_0x415aa0[_0x6472('0x43')],_0xdbf39f[_0x6472('0xc7')]));if(_0x415aa0[_0x6472('0x43')][_0x6472('0xcc')]){_0x28b240['where']=_[_0x6472('0x5a')](_0x28b240[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x28b240[_0x6472('0x49')],function(_0x34271e){var _0x19ab98={};_0x19ab98[_0x34271e]={'$like':'%'+_0x415aa0['query']['filter']+'%'};return _0x19ab98;})});}_0x28b240=_['merge']({},_0x28b240,_0x415aa0[_0x6472('0x5b')]);switch(_0x2dbdcb['role']){case _0x6472('0x2f'):return db[_[_0x6472('0x9b')](_0x415aa0[_0x6472('0x43')]['channel'])+_0x6472('0xd6')][_0x6472('0x4a')](_0x28b240);case _0x6472('0x7a'):case _0x6472('0x6d'):return _0x2dbdcb[_0x6472('0x2d')+_[_0x6472('0x9b')](_0x415aa0['query'][_0x6472('0x96')])+_0x6472('0x9d')](_0x28b240);default:throw new db['Sequelize'][(_0x6472('0x87'))](_0x6472('0xd7'));}})['then'](function(_0x59379d){_0x4a3c86=_0x59379d['length'];if(!_0x415aa0[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x28b240[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x415aa0['query']['limit']);_0x28b240['offset']=qs[_0x6472('0x25')](_0x415aa0[_0x6472('0x43')]['offset']);}switch(_0x2dbdcb[_0x6472('0x2e')]){case _0x6472('0x2f'):return db[_['capitalize'](_0x415aa0[_0x6472('0x43')][_0x6472('0x96')])+_0x6472('0xd6')][_0x6472('0x4a')](_0x28b240);case _0x6472('0x7a'):case _0x6472('0x6d'):return _0x2dbdcb[_0x6472('0x2d')+_[_0x6472('0x9b')](_0x415aa0[_0x6472('0x43')][_0x6472('0x96')])+_0x6472('0x9d')](_0x28b240);}})[_0x6472('0x16')](function(_0x327a02){return{'count':_0x4a3c86,'rows':_0x327a02};})[_0x6472('0x16')](respondWithResult(_0x1a5b41,null))[_0x6472('0x21')](handleError(_0x1a5b41,null));};exports[_0x6472('0xd9')]=function(_0x172102,_0x52a9ca){var _0x3ebac2={};var _0x38c11b={};var _0x5a1ebc;var _0x13cf99;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x172102[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x52a9ca,null))[_0x6472('0x16')](function(_0x2f05b1){if(_0x2f05b1){_0x5a1ebc=_0x2f05b1;_0x38c11b[_0x6472('0x56')]=_[_0x6472('0x57')](db[_0x6472('0xa8')][_0x6472('0x3c')]);_0x38c11b[_0x6472('0x43')]=_[_0x6472('0x57')](_0x172102[_0x6472('0x43')]);_0x38c11b[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x38c11b[_0x6472('0x56')],_0x38c11b['query']);_0x3ebac2[_0x6472('0x49')]=_[_0x6472('0x58')](_0x38c11b[_0x6472('0x56')],qs[_0x6472('0x59')](_0x172102[_0x6472('0x43')][_0x6472('0x59')]));_0x3ebac2[_0x6472('0x49')]=_0x3ebac2[_0x6472('0x49')]['length']?_0x3ebac2[_0x6472('0x49')]:_0x38c11b['model'];_0x3ebac2[_0x6472('0xc8')]=qs['sort'](_0x172102[_0x6472('0x43')][_0x6472('0xc9')]);_0x3ebac2['where']=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x172102[_0x6472('0x43')],_0x38c11b[_0x6472('0xc7')]));if(_0x172102[_0x6472('0x43')]['filter']){_0x3ebac2[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x3ebac2[_0x6472('0xca')],{'$or':_['map'](_0x3ebac2[_0x6472('0x49')],function(_0x5376d4){var _0x1cda84={};_0x1cda84[_0x5376d4]={'$like':'%'+_0x172102[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x1cda84;})});}_0x3ebac2=_[_0x6472('0x5a')]({},_0x3ebac2,_0x172102[_0x6472('0x5b')]);return _0x5a1ebc[_0x6472('0xd9')](_0x3ebac2);}})[_0x6472('0x16')](function(_0x126888){if(_0x126888){_0x13cf99=_0x126888[_0x6472('0x4c')];if(!_0x172102[_0x6472('0x43')]['hasOwnProperty'](_0x6472('0xd8'))){_0x3ebac2[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x172102['query'][_0x6472('0x26')]);_0x3ebac2[_0x6472('0x25')]=qs['offset'](_0x172102[_0x6472('0x43')]['offset']);}return _0x5a1ebc['getVoiceQueuesRt'](_0x3ebac2);}})[_0x6472('0x16')](function(_0x21e1b0){if(_0x21e1b0){return _0x21e1b0?{'count':_0x13cf99,'rows':_0x21e1b0}:null;}})[_0x6472('0x16')](respondWithResult(_0x52a9ca,null))[_0x6472('0x21')](handleError(_0x52a9ca,null));};exports[_0x6472('0xda')]=function(_0x446871,_0x43220a){var _0x151dbc={};var _0x324c46={};var _0x1523f9;var _0x14fa22;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x446871[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x43220a,null))[_0x6472('0x16')](function(_0x4a62a4){if(_0x4a62a4){_0x1523f9=_0x4a62a4;_0x324c46[_0x6472('0x56')]=_[_0x6472('0x57')](db[_0x6472('0xdb')][_0x6472('0x3c')]);_0x324c46['query']=_[_0x6472('0x57')](_0x446871[_0x6472('0x43')]);_0x324c46[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x324c46[_0x6472('0x56')],_0x324c46['query']);_0x151dbc[_0x6472('0x49')]=_['intersection'](_0x324c46[_0x6472('0x56')],qs['fields'](_0x446871[_0x6472('0x43')][_0x6472('0x59')]));_0x151dbc[_0x6472('0x49')]=_0x151dbc[_0x6472('0x49')][_0x6472('0x4c')]?_0x151dbc[_0x6472('0x49')]:_0x324c46[_0x6472('0x56')];_0x151dbc['order']=qs[_0x6472('0xc9')](_0x446871['query'][_0x6472('0xc9')]);_0x151dbc[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x446871[_0x6472('0x43')],_0x324c46['filters']));if(_0x446871[_0x6472('0x43')]['filter']){_0x151dbc[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x151dbc['where'],{'$or':_[_0x6472('0x33')](_0x151dbc[_0x6472('0x49')],function(_0x3788b8){var _0x3ef27b={};_0x3ef27b[_0x3788b8]={'$like':'%'+_0x446871['query'][_0x6472('0xcc')]+'%'};return _0x3ef27b;})});}_0x151dbc=_[_0x6472('0x5a')]({},_0x151dbc,_0x446871[_0x6472('0x5b')]);return _0x1523f9[_0x6472('0xda')](_0x151dbc);}})['then'](function(_0x4a5fb7){if(_0x4a5fb7){_0x14fa22=_0x4a5fb7['length'];if(!_0x446871[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x151dbc['limit']=qs['limit'](_0x446871[_0x6472('0x43')][_0x6472('0x26')]);_0x151dbc[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x446871[_0x6472('0x43')][_0x6472('0x25')]);}return _0x1523f9[_0x6472('0xda')](_0x151dbc);}})['then'](function(_0x102bed){if(_0x102bed){return _0x102bed?{'count':_0x14fa22,'rows':_0x102bed}:null;}})[_0x6472('0x16')](respondWithResult(_0x43220a,null))['catch'](handleError(_0x43220a,null));};exports['getRecordings']=function(_0x240e55,_0x4ba5bc){var _0x5dc497={'raw':!![],'where':{}};var _0x25ee7d={};var _0x430022={'count':0x0,'rows':[]};return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x240e55[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x4ba5bc,null))[_0x6472('0x16')](function(_0x18a456){if(_0x18a456){_0x25ee7d[_0x6472('0x56')]=_['keys'](db[_0x6472('0xdc')][_0x6472('0x3c')]);_0x25ee7d[_0x6472('0x43')]=_[_0x6472('0x57')](_0x240e55[_0x6472('0x43')]);_0x25ee7d[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x25ee7d[_0x6472('0x56')],_0x25ee7d['query']);_0x5dc497[_0x6472('0x49')]=_[_0x6472('0x58')](_0x25ee7d['model'],qs[_0x6472('0x59')](_0x240e55[_0x6472('0x43')]['fields']));_0x5dc497[_0x6472('0x49')]=_0x5dc497[_0x6472('0x49')][_0x6472('0x4c')]?_0x5dc497[_0x6472('0x49')]:_0x25ee7d[_0x6472('0x56')];if(!_0x240e55[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x5dc497['limit']=qs['limit'](_0x240e55[_0x6472('0x43')][_0x6472('0x26')]);_0x5dc497[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x240e55['query'][_0x6472('0x25')]);}_0x5dc497[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x240e55['query'][_0x6472('0xc9')]);_0x5dc497[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x240e55['query'],_0x25ee7d[_0x6472('0xc7')]));_0x5dc497[_0x6472('0xca')][_0x6472('0xdd')]=_0x18a456['id'];if(_0x240e55[_0x6472('0x43')][_0x6472('0xcc')]){_0x5dc497[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x5dc497[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x5dc497[_0x6472('0x49')],function(_0xfc0ba4){var _0x5dee6a={};_0x5dee6a[_0xfc0ba4]={'$like':'%'+_0x240e55[_0x6472('0x43')]['filter']+'%'};return _0x5dee6a;})});}_0x5dc497=_[_0x6472('0x5a')]({},_0x5dc497,_0x240e55[_0x6472('0x5b')]);return db[_0x6472('0xdc')][_0x6472('0x27')]({'where':_0x5dc497[_0x6472('0xca')]})[_0x6472('0x16')](function(_0x5e1e2c){_0x430022[_0x6472('0x27')]=_0x5e1e2c;if(_0x240e55[_0x6472('0x43')][_0x6472('0x44')]){_0x5dc497[_0x6472('0x45')]=[{'all':!![]}];}return db[_0x6472('0xdc')][_0x6472('0x4a')](_0x5dc497);})[_0x6472('0x16')](function(_0x343b6a){_0x430022[_0x6472('0x4b')]=_0x343b6a;return _0x430022;});}})[_0x6472('0x16')](respondWithFilteredResult(_0x4ba5bc,_0x5dc497))['catch'](handleError(_0x4ba5bc,null));};exports['getScreenRecordings']=function(_0x1e259f,_0x50af97){var _0x49c2d3={'raw':!![],'where':{}};var _0x17df52={};var _0x42889b={'count':0x0,'rows':[]};return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x1e259f[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x50af97,null))[_0x6472('0x16')](function(_0x4d049a){if(_0x4d049a){_0x17df52[_0x6472('0x56')]=_[_0x6472('0x57')](db[_0x6472('0xde')][_0x6472('0x3c')]);_0x17df52[_0x6472('0x43')]=_[_0x6472('0x57')](_0x1e259f[_0x6472('0x43')]);_0x17df52['filters']=_[_0x6472('0x58')](_0x17df52[_0x6472('0x56')],_0x17df52['query']);_0x49c2d3[_0x6472('0x49')]=_[_0x6472('0x58')](_0x17df52['model'],qs[_0x6472('0x59')](_0x1e259f[_0x6472('0x43')][_0x6472('0x59')]));_0x49c2d3[_0x6472('0x49')]=_0x49c2d3[_0x6472('0x49')][_0x6472('0x4c')]?_0x49c2d3[_0x6472('0x49')]:_0x17df52['model'];if(!_0x1e259f[_0x6472('0x43')][_0x6472('0xce')]('nolimit')){_0x49c2d3[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x1e259f[_0x6472('0x43')][_0x6472('0x26')]);_0x49c2d3[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x1e259f[_0x6472('0x43')][_0x6472('0x25')]);}_0x49c2d3[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x1e259f[_0x6472('0x43')][_0x6472('0xc9')]);_0x49c2d3[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x1e259f[_0x6472('0x43')],_0x17df52[_0x6472('0xc7')]));_0x49c2d3[_0x6472('0xca')][_0x6472('0xdd')]=_0x4d049a['id'];if(_0x1e259f['query'][_0x6472('0xcc')]){_0x49c2d3[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x49c2d3[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x49c2d3['attributes'],function(_0x27b995){var _0x192b6a={};_0x192b6a[_0x27b995]={'$like':'%'+_0x1e259f[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x192b6a;})});}_0x49c2d3=_[_0x6472('0x5a')]({},_0x49c2d3,_0x1e259f['options']);return db[_0x6472('0xde')][_0x6472('0x27')]({'where':_0x49c2d3[_0x6472('0xca')]})[_0x6472('0x16')](function(_0x28848a){_0x42889b[_0x6472('0x27')]=_0x28848a;if(_0x1e259f[_0x6472('0x43')][_0x6472('0x44')]){_0x49c2d3[_0x6472('0x45')]=[{'all':!![]}];}return db[_0x6472('0xde')]['findAll'](_0x49c2d3);})[_0x6472('0x16')](function(_0x2ade74){_0x42889b[_0x6472('0x4b')]=_0x2ade74;return _0x42889b;});}})[_0x6472('0x16')](respondWithFilteredResult(_0x50af97,_0x49c2d3))['catch'](handleError(_0x50af97,null));};exports[_0x6472('0xdf')]=function(_0xf6442b,_0x33598c){var _0x5a8482={};var _0x246c77={};var _0x2db628;var _0xbc9e63;return db['User']['findOne']({'where':{'id':_0xf6442b[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x33598c,null))[_0x6472('0x16')](function(_0x7172ea){if(_0x7172ea){_0x2db628=_0x7172ea;_0x246c77[_0x6472('0x56')]=_[_0x6472('0x57')](db[_0x6472('0xe0')][_0x6472('0x3c')]);_0x246c77[_0x6472('0x43')]=_['keys'](_0xf6442b[_0x6472('0x43')]);_0x246c77['filters']=_[_0x6472('0x58')](_0x246c77[_0x6472('0x56')],_0x246c77[_0x6472('0x43')]);_0x5a8482[_0x6472('0x49')]=_[_0x6472('0x58')](_0x246c77[_0x6472('0x56')],qs[_0x6472('0x59')](_0xf6442b['query'][_0x6472('0x59')]));_0x5a8482['attributes']=_0x5a8482[_0x6472('0x49')][_0x6472('0x4c')]?_0x5a8482['attributes']:_0x246c77['model'];_0x5a8482[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0xf6442b[_0x6472('0x43')][_0x6472('0xc9')]);_0x5a8482['where']=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0xf6442b['query'],_0x246c77[_0x6472('0xc7')]));if(_0xf6442b['query'][_0x6472('0xcc')]){_0x5a8482['where']=_[_0x6472('0x5a')](_0x5a8482[_0x6472('0xca')],{'$or':_['map'](_0x5a8482[_0x6472('0x49')],function(_0x3c1c74){var _0x32772a={};_0x32772a[_0x3c1c74]={'$like':'%'+_0xf6442b['query']['filter']+'%'};return _0x32772a;})});}_0x5a8482=_['merge']({},_0x5a8482,_0xf6442b[_0x6472('0x5b')]);return _0x2db628[_0x6472('0xdf')](_0x5a8482);}})[_0x6472('0x16')](function(_0x19941d){if(_0x19941d){_0xbc9e63=_0x19941d['length'];if(!_0xf6442b[_0x6472('0x43')]['hasOwnProperty'](_0x6472('0xd8'))){_0x5a8482[_0x6472('0x26')]=qs[_0x6472('0x26')](_0xf6442b[_0x6472('0x43')][_0x6472('0x26')]);_0x5a8482[_0x6472('0x25')]=qs['offset'](_0xf6442b[_0x6472('0x43')][_0x6472('0x25')]);}return _0x2db628[_0x6472('0xdf')](_0x5a8482);}})[_0x6472('0x16')](function(_0xe7ff4f){if(_0xe7ff4f){return _0xe7ff4f?{'count':_0xbc9e63,'rows':_0xe7ff4f}:null;}})['then'](respondWithResult(_0x33598c,null))[_0x6472('0x21')](handleError(_0x33598c,null));};exports['getOpenchannelInteractions']=function(_0x10b79c,_0x44f5db){var _0x4eeb30={};var _0x26afd4={};var _0x500a29;var _0x482158;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x10b79c[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x44f5db,null))['then'](function(_0x301fb1){if(_0x301fb1){_0x500a29=_0x301fb1;_0x26afd4[_0x6472('0x56')]=_[_0x6472('0x57')](db[_0x6472('0xe1')][_0x6472('0x3c')]);_0x26afd4[_0x6472('0x43')]=_[_0x6472('0x57')](_0x10b79c['query']);_0x26afd4[_0x6472('0xc7')]=_['intersection'](_0x26afd4[_0x6472('0x56')],_0x26afd4['query']);_0x4eeb30['attributes']=_[_0x6472('0x58')](_0x26afd4['model'],qs[_0x6472('0x59')](_0x10b79c[_0x6472('0x43')][_0x6472('0x59')]));_0x4eeb30['attributes']=_0x4eeb30['attributes'][_0x6472('0x4c')]?_0x4eeb30['attributes']:_0x26afd4[_0x6472('0x56')];_0x4eeb30[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x10b79c[_0x6472('0x43')][_0x6472('0xc9')]);_0x4eeb30[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x10b79c[_0x6472('0x43')],_0x26afd4[_0x6472('0xc7')]));if(_0x10b79c[_0x6472('0x43')][_0x6472('0xcc')]){_0x4eeb30['where']=_[_0x6472('0x5a')](_0x4eeb30[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x4eeb30[_0x6472('0x49')],function(_0x19f79d){var _0x46f8e2={};_0x46f8e2[_0x19f79d]={'$like':'%'+_0x10b79c[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x46f8e2;})});}_0x4eeb30=_[_0x6472('0x5a')]({},_0x4eeb30,_0x10b79c[_0x6472('0x5b')]);return _0x500a29['getOpenchannelInteractions'](_0x4eeb30);}})[_0x6472('0x16')](function(_0x2d82fb){if(_0x2d82fb){_0x482158=_0x2d82fb[_0x6472('0x4c')];if(!_0x10b79c[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x4eeb30[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x10b79c[_0x6472('0x43')][_0x6472('0x26')]);_0x4eeb30[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x10b79c[_0x6472('0x43')][_0x6472('0x25')]);}return _0x500a29['getOpenchannelInteractions'](_0x4eeb30);}})[_0x6472('0x16')](function(_0x2e272b){if(_0x2e272b){return _0x2e272b?{'count':_0x482158,'rows':_0x2e272b}:null;}})[_0x6472('0x16')](respondWithResult(_0x44f5db,null))['catch'](handleError(_0x44f5db,null));};exports[_0x6472('0xe2')]=function(_0x36404e,_0x2ef2d8){var _0x4e6ef2={'raw':!![],'where':{}};var _0x377cb8={};var _0x4c1f54={'count':0x0,'rows':[]};return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x36404e[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x2ef2d8,null))[_0x6472('0x16')](function(_0x596c7f){if(_0x596c7f){_0x377cb8['model']=_[_0x6472('0x57')](db['MailInteraction'][_0x6472('0x3c')]);_0x377cb8['query']=_[_0x6472('0x57')](_0x36404e[_0x6472('0x43')]);_0x377cb8['filters']=_[_0x6472('0x58')](_0x377cb8[_0x6472('0x56')],_0x377cb8[_0x6472('0x43')]);_0x4e6ef2[_0x6472('0x49')]=_['intersection'](_0x377cb8[_0x6472('0x56')],qs[_0x6472('0x59')](_0x36404e['query'][_0x6472('0x59')]));_0x4e6ef2['attributes']=_0x4e6ef2[_0x6472('0x49')]['length']?_0x4e6ef2[_0x6472('0x49')]:_0x377cb8[_0x6472('0x56')];if(!_0x36404e['query']['hasOwnProperty'](_0x6472('0xd8'))){_0x4e6ef2[_0x6472('0x26')]=qs['limit'](_0x36404e[_0x6472('0x43')][_0x6472('0x26')]);_0x4e6ef2[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x36404e[_0x6472('0x43')][_0x6472('0x25')]);}_0x4e6ef2[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x36404e[_0x6472('0x43')][_0x6472('0xc9')]);_0x4e6ef2[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x36404e[_0x6472('0x43')],_0x377cb8[_0x6472('0xc7')]));_0x4e6ef2[_0x6472('0xca')][_0x6472('0xdd')]=_0x596c7f['id'];if(_0x36404e[_0x6472('0x43')]['filter']){_0x4e6ef2[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x4e6ef2[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x4e6ef2[_0x6472('0x49')],function(_0x23ecc9){var _0x1fb891={};_0x1fb891[_0x23ecc9]={'$like':'%'+_0x36404e[_0x6472('0x43')]['filter']+'%'};return _0x1fb891;})});}_0x4e6ef2=_[_0x6472('0x5a')]({},_0x4e6ef2,_0x36404e[_0x6472('0x5b')]);return db[_0x6472('0xe3')][_0x6472('0x27')]({'where':_0x4e6ef2[_0x6472('0xca')]})[_0x6472('0x16')](function(_0x1fde0c){_0x4c1f54[_0x6472('0x27')]=_0x1fde0c;if(_0x36404e['query'][_0x6472('0x44')]){_0x4e6ef2[_0x6472('0x45')]=[{'all':!![]}];}return db[_0x6472('0xe3')]['findAll'](_0x4e6ef2);})[_0x6472('0x16')](function(_0x5be4b5){_0x4c1f54[_0x6472('0x4b')]=_0x5be4b5;return _0x4c1f54;});}})[_0x6472('0x16')](respondWithFilteredResult(_0x2ef2d8,_0x4e6ef2))[_0x6472('0x21')](handleError(_0x2ef2d8,null));};exports[_0x6472('0xe4')]=function(_0x2bd663,_0x3dad92){var _0x5aa20b={};var _0x3f8613={};var _0x31c2a4;var _0x573c20;return db[_0x6472('0x3b')]['findOne']({'where':{'id':_0x2bd663['params']['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x3dad92,null))[_0x6472('0x16')](function(_0x1b8f4d){if(_0x1b8f4d){_0x31c2a4=_0x1b8f4d;_0x3f8613[_0x6472('0x56')]=_['keys'](db[_0x6472('0xe5')][_0x6472('0x3c')]);_0x3f8613['query']=_['keys'](_0x2bd663['query']);_0x3f8613[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x3f8613[_0x6472('0x56')],_0x3f8613['query']);_0x5aa20b[_0x6472('0x49')]=_['intersection'](_0x3f8613[_0x6472('0x56')],qs['fields'](_0x2bd663[_0x6472('0x43')][_0x6472('0x59')]));_0x5aa20b[_0x6472('0x49')]=_0x5aa20b[_0x6472('0x49')][_0x6472('0x4c')]?_0x5aa20b['attributes']:_0x3f8613[_0x6472('0x56')];_0x5aa20b['order']=qs['sort'](_0x2bd663['query']['sort']);_0x5aa20b['where']=qs['filters'](_['pick'](_0x2bd663[_0x6472('0x43')],_0x3f8613[_0x6472('0xc7')]));if(_0x2bd663['query'][_0x6472('0xcc')]){_0x5aa20b[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x5aa20b[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x5aa20b[_0x6472('0x49')],function(_0x2dbd6e){var _0x459765={};_0x459765[_0x2dbd6e]={'$like':'%'+_0x2bd663[_0x6472('0x43')]['filter']+'%'};return _0x459765;})});}_0x5aa20b=_[_0x6472('0x5a')]({},_0x5aa20b,_0x2bd663[_0x6472('0x5b')]);return _0x31c2a4[_0x6472('0xe4')](_0x5aa20b);}})[_0x6472('0x16')](function(_0x3c3fd7){if(_0x3c3fd7){_0x573c20=_0x3c3fd7[_0x6472('0x4c')];if(!_0x2bd663['query'][_0x6472('0xce')](_0x6472('0xd8'))){_0x5aa20b[_0x6472('0x26')]=qs['limit'](_0x2bd663[_0x6472('0x43')][_0x6472('0x26')]);_0x5aa20b['offset']=qs[_0x6472('0x25')](_0x2bd663[_0x6472('0x43')]['offset']);}return _0x31c2a4[_0x6472('0xe4')](_0x5aa20b);}})[_0x6472('0x16')](function(_0x36e849){if(_0x36e849){return _0x36e849?{'count':_0x573c20,'rows':_0x36e849}:null;}})[_0x6472('0x16')](respondWithResult(_0x3dad92,null))[_0x6472('0x21')](handleError(_0x3dad92,null));};exports['getFaxInteractions']=function(_0x29d35a,_0xe48fb7){var _0x3cc4f2={};var _0x4cca9c={};var _0xaa8941;var _0x36fbc2;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x29d35a[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0xe48fb7,null))[_0x6472('0x16')](function(_0x20a4c7){if(_0x20a4c7){_0xaa8941=_0x20a4c7;_0x4cca9c[_0x6472('0x56')]=_['keys'](db['FaxInteraction'][_0x6472('0x3c')]);_0x4cca9c[_0x6472('0x43')]=_['keys'](_0x29d35a[_0x6472('0x43')]);_0x4cca9c['filters']=_[_0x6472('0x58')](_0x4cca9c[_0x6472('0x56')],_0x4cca9c[_0x6472('0x43')]);_0x3cc4f2[_0x6472('0x49')]=_['intersection'](_0x4cca9c[_0x6472('0x56')],qs[_0x6472('0x59')](_0x29d35a[_0x6472('0x43')][_0x6472('0x59')]));_0x3cc4f2['attributes']=_0x3cc4f2[_0x6472('0x49')][_0x6472('0x4c')]?_0x3cc4f2[_0x6472('0x49')]:_0x4cca9c[_0x6472('0x56')];_0x3cc4f2[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x29d35a[_0x6472('0x43')]['sort']);_0x3cc4f2[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x29d35a[_0x6472('0x43')],_0x4cca9c['filters']));if(_0x29d35a[_0x6472('0x43')][_0x6472('0xcc')]){_0x3cc4f2[_0x6472('0xca')]=_['merge'](_0x3cc4f2[_0x6472('0xca')],{'$or':_['map'](_0x3cc4f2[_0x6472('0x49')],function(_0x10dee2){var _0x537122={};_0x537122[_0x10dee2]={'$like':'%'+_0x29d35a[_0x6472('0x43')]['filter']+'%'};return _0x537122;})});}_0x3cc4f2=_[_0x6472('0x5a')]({},_0x3cc4f2,_0x29d35a[_0x6472('0x5b')]);return _0xaa8941[_0x6472('0xe6')](_0x3cc4f2);}})[_0x6472('0x16')](function(_0x24b4a6){if(_0x24b4a6){_0x36fbc2=_0x24b4a6[_0x6472('0x4c')];if(!_0x29d35a[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x3cc4f2[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x29d35a['query'][_0x6472('0x26')]);_0x3cc4f2[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x29d35a[_0x6472('0x43')]['offset']);}return _0xaa8941[_0x6472('0xe6')](_0x3cc4f2);}})[_0x6472('0x16')](function(_0x144aa0){if(_0x144aa0){return _0x144aa0?{'count':_0x36fbc2,'rows':_0x144aa0}:null;}})[_0x6472('0x16')](respondWithResult(_0xe48fb7,null))[_0x6472('0x21')](handleError(_0xe48fb7,null));};exports[_0x6472('0xe7')]=function(_0x52ad3f,_0x568500){var _0x1b183b={};var _0x156fa8={};var _0x27a702;var _0x2d7618;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x52ad3f[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x568500,null))['then'](function(_0x13d2f1){if(_0x13d2f1){_0x27a702=_0x13d2f1;_0x156fa8[_0x6472('0x56')]=_['keys'](db[_0x6472('0xe8')][_0x6472('0x3c')]);_0x156fa8[_0x6472('0x43')]=_['keys'](_0x52ad3f[_0x6472('0x43')]);_0x156fa8[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x156fa8[_0x6472('0x56')],_0x156fa8['query']);_0x1b183b[_0x6472('0x49')]=_[_0x6472('0x58')](_0x156fa8[_0x6472('0x56')],qs[_0x6472('0x59')](_0x52ad3f[_0x6472('0x43')][_0x6472('0x59')]));_0x1b183b['attributes']=_0x1b183b[_0x6472('0x49')]['length']?_0x1b183b[_0x6472('0x49')]:_0x156fa8[_0x6472('0x56')];_0x1b183b[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x52ad3f[_0x6472('0x43')][_0x6472('0xc9')]);_0x1b183b['where']=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0x52ad3f[_0x6472('0x43')],_0x156fa8['filters']));if(_0x52ad3f[_0x6472('0x43')][_0x6472('0xcc')]){_0x1b183b[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x1b183b[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x1b183b['attributes'],function(_0x3cf548){var _0x3b4f96={};_0x3b4f96[_0x3cf548]={'$like':'%'+_0x52ad3f['query'][_0x6472('0xcc')]+'%'};return _0x3b4f96;})});}_0x1b183b=_[_0x6472('0x5a')]({},_0x1b183b,_0x52ad3f[_0x6472('0x5b')]);return _0x27a702['getWhatsappInteractions'](_0x1b183b);}})['then'](function(_0x305e2b){if(_0x305e2b){_0x2d7618=_0x305e2b[_0x6472('0x4c')];if(!_0x52ad3f['query'][_0x6472('0xce')](_0x6472('0xd8'))){_0x1b183b[_0x6472('0x26')]=qs[_0x6472('0x26')](_0x52ad3f['query'][_0x6472('0x26')]);_0x1b183b[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x52ad3f[_0x6472('0x43')][_0x6472('0x25')]);}return _0x27a702['getWhatsappInteractions'](_0x1b183b);}})[_0x6472('0x16')](function(_0x1963ae){if(_0x1963ae){return _0x1963ae?{'count':_0x2d7618,'rows':_0x1963ae}:null;}})['then'](respondWithResult(_0x568500,null))[_0x6472('0x21')](handleError(_0x568500,null));};exports[_0x6472('0xe9')]=function(_0x404c04,_0xe245ae,_0x484908){var _0x4db5bd;var _0x1fba16;var _0x280df5;var _0x3a834b=!_[_0x6472('0x64')](_0x404c04[_0x6472('0x55')]['id'])?_0x404c04[_0x6472('0x55')]['id']:!_[_0x6472('0x64')](_0x404c04[_0x6472('0x7a')]['id'])?_0x404c04[_0x6472('0x7a')]['id']:null;return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x3a834b,'role':{'$or':[_0x6472('0x2f'),_0x6472('0x7a'),'agent']}},'attributes':['id','name',_0x6472('0xea'),_0x6472('0xeb'),_0x6472('0x2e'),_0x6472('0x5f'),_0x6472('0x98')]})[_0x6472('0x16')](function(_0x77451a){if(_0x77451a){if(_0x77451a[_0x6472('0x2e')]===_0x6472('0x6d')){_0x4db5bd=_0x77451a;if(_0x404c04[_0x6472('0x5d')][_0x6472('0xa6')]){_0x280df5=util['format'](_0x6472('0xec'),_0x4db5bd[_0x404c04[_0x6472('0x5d')][_0x6472('0xa6')]]);}else if(_0x404c04[_0x6472('0x5d')][_0x6472('0xed')]){_0x280df5=util[_0x6472('0xa4')](_0x6472('0xa5'),_0x404c04[_0x6472('0x5d')][_0x6472('0xed')]);}else{_0x280df5=util[_0x6472('0xa4')](_0x6472('0xa5'),_0x4db5bd[_0x6472('0x38')]);}socket['to'](util[_0x6472('0xa4')](_0x6472('0xee'),_0x4db5bd['name']))[_0x6472('0xa0')](_0x6472('0xef'),{'user':{'id':_0x4db5bd['id'],'name':_0x4db5bd['name']},'ip':_0x404c04[_0x6472('0xf0')]['x-forwarded-for']||_0x404c04[_0x6472('0xf1')][_0x6472('0xf2')]||_0x404c04[_0x6472('0xf3')][_0x6472('0xf2')]||_0x404c04[_0x6472('0xf1')][_0x6472('0xf3')][_0x6472('0xf2')]});return db[_0x6472('0xa8')][_0x6472('0x2c')]({'where':{'membername':_0x4db5bd[_0x6472('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0x6472('0x89'))][(_0x6472('0x87'))](_0x6472('0xf4'));}})[_0x6472('0x16')](function(){if(_0x4db5bd){return _0x4db5bd['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x3bd65f){if(_0x4db5bd){var _0x20cff2=[];if(_0x3bd65f){_0x1fba16=_0x3bd65f;if(_0x1fba16[_0x6472('0x4c')]){for(var _0x4f7cac=0x0;_0x4f7cac<_0x1fba16[_0x6472('0x4c')];_0x4f7cac++){_0x20cff2[_0x6472('0x4d')]({'membername':_0x4db5bd[_0x6472('0x38')],'UserId':_0x4db5bd['id'],'queue_name':_0x1fba16[_0x4f7cac][_0x6472('0x38')],'VoiceQueueId':_0x1fba16[_0x4f7cac]['id'],'interface':_0x280df5,'paused':_0x4db5bd[_0x6472('0x98')]||![],'penalty':_0x1fba16[_0x4f7cac][_0x6472('0xf5')]||0x0});}return BPromise[_0x6472('0x81')](_0x20cff2,function(_0xc37544){return db[_0x6472('0xa8')][_0x6472('0xa9')](_0xc37544);});}}}})[_0x6472('0x16')](function(){if(_0x4db5bd){return db[_0x6472('0xf6')][_0x6472('0x4a')]({'where':{'membername':_0x4db5bd['name'],'exitAt':null}});}})[_0x6472('0x16')](function(_0x98f8a4){if(_0x4db5bd){var _0x33c469=[];_0x98f8a4['forEach'](function(_0x3fe9b8){_0x33c469[_0x6472('0x4d')](_0x3fe9b8[_0x6472('0x2b')]({'exitAt':moment()[_0x6472('0xa4')](_0x6472('0xf7'))}));});return BPromise['all'](_0x33c469);}})['then'](function(){if(_0x4db5bd){var _0x221821=[];var _0x2668f6=[];var _0x63dd8=utils[_0x6472('0xf8')]();var _0x57b643={'membername':_0x4db5bd[_0x6472('0x38')],'interface':_0x280df5,'enterAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'role':_0x4db5bd['role'],'internal':_0x4db5bd[_0x6472('0x5f')]};_0x63dd8[_0x6472('0xf9')](function(_0x3cf49b){_0x221821[_0x6472('0x4d')](_[_0x6472('0x5a')]({'channel':_0x3cf49b,'type':_0x6472('0xfa'),'data1':_0x404c04[_0x6472('0x5d')][_0x6472('0xfb')],'data2':_0x280df5},_0x57b643));if(_0x4db5bd[_0x6472('0x98')]){_0x2668f6[_0x6472('0x4d')](_[_0x6472('0x5a')]({'channel':_0x3cf49b,'type':_0x6472('0xfc'),'data1':_0x6472('0xfd')},_0x57b643));}});return db[_0x6472('0xf6')][_0x6472('0xfe')](_0x221821[_0x6472('0xc5')](_0x2668f6),{'individualHooks':!![]});}})[_0x6472('0x16')](function(){if(_0x4db5bd){return _0x4db5bd['update']({'online':!![],'lastLoginAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'voicePause':_0x4db5bd[_0x6472('0x98')]||![],'mailPause':_0x4db5bd[_0x6472('0x98')]||![],'chatPause':_0x4db5bd['loginInPause']||![],'faxPause':_0x4db5bd[_0x6472('0x98')]||![],'smsPause':_0x4db5bd[_0x6472('0x98')]||![],'openchannelPause':_0x4db5bd[_0x6472('0x98')]||![],'whatsappPause':_0x4db5bd['loginInPause']||![],'pauseType':_0x4db5bd[_0x6472('0x98')]?_0x6472('0xfd'):null,'interface':_0x280df5,'lastPauseAt':moment()[_0x6472('0xa4')](_0x6472('0xf7'))});}})['then'](function(_0x1d1373){if(_0x404c04[_0x6472('0xff')]){return _0x484908();}else{return BPromise[_0x6472('0x100')](_0x1d1373)['then'](respondWithResult(_0xe245ae,null));}})[_0x6472('0x21')](handleError(_0xe245ae,null));};exports[_0x6472('0x101')]=function(_0x10d13a,_0x988ebf){var _0x291df;return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x10d13a[_0x6472('0x55')]['id'],'role':'agent'},'attributes':['id',_0x6472('0x38'),_0x6472('0x2e')]})[_0x6472('0x16')](handleEntityNotFound(_0x988ebf,null))['then'](function(_0x220bb7){if(_0x220bb7){_0x291df=_0x220bb7;return db[_0x6472('0xa8')][_0x6472('0x2c')]({'where':{'membername':_0x291df[_0x6472('0x38')]},'individualHooks':!![]});}})['then'](function(){return db[_0x6472('0xf6')][_0x6472('0x4a')]({'where':{'membername':_0x291df[_0x6472('0x38')],'exitAt':null}});})['then'](function(_0x4fad83){var _0x5d5c3c=[];_0x4fad83[_0x6472('0xf9')](function(_0x21acfd){_0x5d5c3c[_0x6472('0x4d')](_0x21acfd[_0x6472('0x2b')]({'exitAt':moment()[_0x6472('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6472('0x54')](_0x5d5c3c);})[_0x6472('0x16')](function(){return _0x291df['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6472('0x16')](respondWithResult(_0x988ebf,null))[_0x6472('0x21')](handleError(_0x988ebf,null));};exports[_0x6472('0x102')]=function(_0x4b00b5,_0x609745){var _0x4d1fa3;return db[_0x6472('0xa8')][_0x6472('0x2b')]({'paused':0x1},{'where':{'UserId':_0x4b00b5[_0x6472('0x55')]['id']},'individualHooks':!![]})[_0x6472('0x16')](function(){return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x4b00b5[_0x6472('0x55')]['id'],'role':_0x6472('0x6d')},'attributes':['id',_0x6472('0x38'),_0x6472('0x2e'),_0x6472('0x5f'),'interface']});})[_0x6472('0x16')](handleEntityNotFound(_0x609745,null))[_0x6472('0x16')](function(_0x17c55c){if(_0x17c55c){_0x4d1fa3=_0x17c55c;return respondWithRpcPromise(_0x6472('0x103'),_0x6472('0x102'),{'id':_0x4d1fa3['id'],'name':_0x4d1fa3[_0x6472('0x38')],'pause':!![]});}})[_0x6472('0x16')](function(){if(_0x4d1fa3){return db['MemberReport'][_0x6472('0x4a')]({'where':{'membername':_0x4d1fa3[_0x6472('0x38')],'type':_0x6472('0xfc'),'exitAt':null}});}})[_0x6472('0x16')](function(_0x450667){if(_0x450667[_0x6472('0x4c')]){var _0x23d91e=moment()[_0x6472('0xa4')](_0x6472('0xf7'));for(var _0x95ab4f=0x0,_0x58baea=_0x450667[_0x6472('0x4c')];_0x95ab4f<_0x58baea;_0x95ab4f++){_0x450667[_0x95ab4f][_0x6472('0x104')]({'exitAt':_0x23d91e});}}})[_0x6472('0x16')](function(){var _0x28fe2d=[];var _0x3e61f0=utils['getChannels']();_0x3e61f0[_0x6472('0xf9')](function(_0x2a6d44){_0x28fe2d[_0x6472('0x4d')]({'channel':_0x2a6d44,'membername':_0x4d1fa3[_0x6472('0x38')],'interface':_[_0x6472('0x64')](_0x4d1fa3['interface'])?util['format']('SIP/%s',_0x4d1fa3[_0x6472('0x38')]):_0x4d1fa3['interface'],'type':_0x6472('0xfc'),'enterAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'data1':_0x4b00b5[_0x6472('0x5d')][_0x6472('0x3e')]||_0x6472('0x105'),'role':_0x4d1fa3[_0x6472('0x2e')],'internal':_0x4d1fa3[_0x6472('0x5f')]});});return db['MemberReport']['bulkCreate'](_0x28fe2d,{'individualHooks':!![]});})[_0x6472('0x16')](function(){return _0x4d1fa3[_0x6472('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4b00b5[_0x6472('0x5d')]['type']||_0x6472('0x105'),'lastPauseAt':moment()[_0x6472('0xa4')](_0x6472('0xf7'))});})[_0x6472('0x16')](respondWithResult(_0x609745,null))[_0x6472('0x21')](handleError(_0x609745,null));};exports[_0x6472('0x106')]=function(_0x51c0b2,_0x8c4abd){var _0x226fa0;return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x51c0b2[_0x6472('0x55')]['id']},'attributes':['id',_0x6472('0x38'),'role',_0x6472('0x107'),_0x6472('0x108'),_0x6472('0x109'),'faxPause',_0x6472('0x10a'),_0x6472('0x10b'),'whatsapppause',_0x6472('0x10c'),_0x6472('0x10d')]})[_0x6472('0x16')](handleEntityNotFound(_0x8c4abd,null))['then'](function(_0x53eba5){if(_0x53eba5){_0x226fa0=_0x53eba5;if(_0x51c0b2[_0x6472('0x5d')]['channel']&&!utils[_0x6472('0x99')](_0x51c0b2[_0x6472('0x5d')][_0x6472('0x96')])){throw new db['Sequelize']['ValidationError'](_0x6472('0xab'));}switch(_0x51c0b2['body'][_0x6472('0x96')]){case'voice':return respondWithRpcPromise(_0x6472('0x103'),_0x6472('0x106'),{'id':_0x226fa0['id'],'name':_0x226fa0[_0x6472('0x38')],'pause':![]})[_0x6472('0x16')](function(){return db['UserVoiceQueueRt'][_0x6472('0x2b')]({'paused':0x0},{'where':{'UserId':_0x226fa0['id']},'individualHooks':!![]});})['then'](function(){return db[_0x6472('0xf6')][_0x6472('0x35')]({'where':{'channel':_0x51c0b2[_0x6472('0x5d')][_0x6472('0x96')],'membername':_0x226fa0[_0x6472('0x38')],'type':_0x6472('0xfc'),'exitAt':null}});})[_0x6472('0x16')](function(_0xc498c5){if(_0xc498c5){return _0xc498c5[_0x6472('0x2b')]({'exitAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x6472('0x16')](function(){return _0x226fa0[_0x6472('0x2b')]({'voicePause':![]});});case'mail':case _0x6472('0x4e'):case _0x6472('0x50'):case _0x6472('0xbb'):case'whatsapp':case'openchannel':return db[_0x6472('0xf6')][_0x6472('0x35')]({'where':{'channel':_0x51c0b2[_0x6472('0x5d')][_0x6472('0x96')],'membername':_0x226fa0[_0x6472('0x38')],'type':'PAUSE','exitAt':null}})[_0x6472('0x16')](function(_0x2c1008){if(_0x2c1008){return _0x2c1008[_0x6472('0x2b')]({'exitAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'data2':_0x6472('0x10e')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x31bd70={};_[_0x6472('0x28')](_0x31bd70,util[_0x6472('0xa4')](_0x6472('0x10f'),_0x51c0b2[_0x6472('0x5d')]['channel'],'Pause'),![]);return _0x226fa0['update'](_0x31bd70);});default:return respondWithRpcPromise('QueuePause',_0x6472('0x106'),{'id':_0x226fa0['id'],'name':_0x226fa0[_0x6472('0x38')],'pause':![]})['then'](function(){return db[_0x6472('0xa8')][_0x6472('0x2b')]({'paused':0x0},{'where':{'UserId':_0x226fa0['id']}});})[_0x6472('0x16')](function(){return db[_0x6472('0xf6')]['findAll']({'where':{'membername':_0x226fa0[_0x6472('0x38')],'type':_0x6472('0xfc'),'exitAt':null}});})[_0x6472('0x16')](function(_0x5adc2f){var _0x13a577=[];_0x5adc2f['forEach'](function(_0x2d7469){_0x13a577[_0x6472('0x4d')](_0x2d7469['update']({'exitAt':moment()[_0x6472('0xa4')](_0x6472('0xf7')),'data2':_0x6472('0x10e')}));});return BPromise[_0x6472('0x54')](_0x13a577);})['then'](function(){return _0x226fa0[_0x6472('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6472('0x16')](respondWithResult(_0x8c4abd,null))['catch'](handleError(_0x8c4abd,null));};exports['getTeams']=function(_0x3f0697,_0x53a11a){var _0x17009d={};var _0x10df32={};var _0x56cfa3;var _0x37f79a;return db[_0x6472('0x3b')][_0x6472('0x8f')]({'where':{'id':_0x3f0697[_0x6472('0x55')]['id']}})['then'](handleEntityNotFound(_0x53a11a,null))[_0x6472('0x16')](function(_0x5c225d){if(_0x5c225d){_0x56cfa3=_0x5c225d;_0x10df32['model']=_['keys'](db[_0x6472('0x110')][_0x6472('0x3c')]);_0x10df32[_0x6472('0x43')]=_[_0x6472('0x57')](_0x3f0697['query']);_0x10df32[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x10df32[_0x6472('0x56')],_0x10df32['query']);_0x17009d['attributes']=_[_0x6472('0x58')](_0x10df32[_0x6472('0x56')],qs[_0x6472('0x59')](_0x3f0697[_0x6472('0x43')][_0x6472('0x59')]));_0x17009d['attributes']=_0x17009d['attributes']['length']?_0x17009d['attributes']:_0x10df32[_0x6472('0x56')];_0x17009d[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0x3f0697['query'][_0x6472('0xc9')]);_0x17009d[_0x6472('0xca')]=qs[_0x6472('0xc7')](_['pick'](_0x3f0697[_0x6472('0x43')],_0x10df32[_0x6472('0xc7')]));if(_0x3f0697['query'][_0x6472('0xcc')]){_0x17009d[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x17009d[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x17009d['attributes'],function(_0x1f5e49){var _0x2aef82={};_0x2aef82[_0x1f5e49]={'$like':'%'+_0x3f0697[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x2aef82;})});}_0x17009d=_[_0x6472('0x5a')]({},_0x17009d,_0x3f0697['options']);return _0x56cfa3[_0x6472('0x111')](_0x17009d);}})[_0x6472('0x16')](function(_0xda2fb8){if(_0xda2fb8){_0x37f79a=_0xda2fb8[_0x6472('0x4c')];if(!_0x3f0697[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x17009d[_0x6472('0x26')]=qs['limit'](_0x3f0697[_0x6472('0x43')]['limit']);_0x17009d[_0x6472('0x25')]=qs[_0x6472('0x25')](_0x3f0697['query'][_0x6472('0x25')]);}return _0x56cfa3[_0x6472('0x111')](_0x17009d);}})['then'](function(_0x3ce05b){if(_0x3ce05b){return _0x3ce05b?{'count':_0x37f79a,'rows':_0x3ce05b}:null;}})[_0x6472('0x16')](respondWithResult(_0x53a11a,null))[_0x6472('0x21')](handleError(_0x53a11a,null));};exports[_0x6472('0x112')]=function(_0x247e03,_0x5eeff2){return db[_0x6472('0x3b')][_0x6472('0x35')]({'where':{'id':_0x247e03['params']['id']}})['then'](handleEntityNotFound(_0x5eeff2,null))[_0x6472('0x16')](function(_0xfc933b){if(_0xfc933b){var _0x78a554=_0xfc933b[_0x6472('0x2d')]({'plain':!![]});return _0xfc933b[_0x6472('0x112')](_0x247e03[_0x6472('0x5d')]['ids'],_[_0x6472('0x113')](_0x247e03[_0x6472('0x5d')],[_0x6472('0x9e'),'id'])||{})[_0x6472('0x16')](function(){for(var _0x316298=0x0;_0x316298<_0x247e03[_0x6472('0x5d')][_0x6472('0x9e')][_0x6472('0x4c')];_0x316298++){var _0x4d80f9=[];var _0x5b909d={};db['Team'][_0x6472('0x8f')]({'where':{'id':_0x247e03['body']['ids'][_0x316298]}})['then'](function(_0xfb1108){_0x5b909d=_0xfb1108[_0x6472('0x4f')];_0x4d80f9[_0x6472('0x4d')](_0xfb1108['getVoiceQueues']()[_0x6472('0x16')](function(_0x5b9b9c){for(var _0x41feed=0x0;_0x41feed<_0x5b9b9c[_0x6472('0x4c')];_0x41feed++){_0x5b9b9c[_0x41feed][_0x6472('0x114')](_0x6472('0x96'),'Voice');}return _0x5b9b9c;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108[_0x6472('0x115')]()['then'](function(_0x409cd0){for(var _0x56d4c1=0x0;_0x56d4c1<_0x409cd0[_0x6472('0x4c')];_0x56d4c1++){_0x409cd0[_0x56d4c1][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x116'));}return _0x409cd0;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108[_0x6472('0x117')]()[_0x6472('0x16')](function(_0x325265){for(var _0x5d156=0x0;_0x5d156<_0x325265[_0x6472('0x4c')];_0x5d156++){_0x325265[_0x5d156][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x118'));}return _0x325265;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108['getSmsQueues']()[_0x6472('0x16')](function(_0x213ee0){for(var _0x2e8482=0x0;_0x2e8482<_0x213ee0[_0x6472('0x4c')];_0x2e8482++){_0x213ee0[_0x2e8482][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x119'));}return _0x213ee0;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108[_0x6472('0x11a')]()[_0x6472('0x16')](function(_0x4af418){for(var _0x1e87a4=0x0;_0x1e87a4<_0x4af418['length'];_0x1e87a4++){_0x4af418[_0x1e87a4][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x11b'));}return _0x4af418;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108[_0x6472('0x11c')]()[_0x6472('0x16')](function(_0x254a84){for(var _0x5f1b90=0x0;_0x5f1b90<_0x254a84[_0x6472('0x4c')];_0x5f1b90++){_0x254a84[_0x5f1b90][_0x6472('0x114')]('channel','Fax');}return _0x254a84;}));_0x4d80f9[_0x6472('0x4d')](_0xfb1108['getOpenchannelQueues']()['then'](function(_0x9854cb){for(var _0x5da94e=0x0;_0x5da94e<_0x9854cb[_0x6472('0x4c')];_0x5da94e++){_0x9854cb[_0x5da94e][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x11d'));}return _0x9854cb;}));return BPromise[_0x6472('0x54')](_0x4d80f9);})[_0x6472('0x16')](function(_0x488639){var _0x36b61f=_[_0x6472('0x11e')](_0x488639);_0x4d80f9=[];return db[_0x6472('0x66')]['transaction'](function(_0x4131e0){for(var _0x1a6dc6=0x0;_0x1a6dc6<_0x36b61f['length'];_0x1a6dc6++){_0x4d80f9[_0x6472('0x4d')](_0x36b61f[_0x1a6dc6]['addAgent'](_0x78a554['id']),{'transaction':_0x4131e0});}return BPromise[_0x6472('0x54')](_0x4d80f9)[_0x6472('0x16')](function(){if(_0x78a554['online']){return BPromise['each'](_[_0x6472('0xcc')](_0x36b61f,function(_0x2f8cfe){return _0x2f8cfe[_0x6472('0x11f')]('channel')===_0x6472('0x120');}),function(_0x3e33a5){return db[_0x6472('0xa8')][_0x6472('0xa9')]({'membername':_0x78a554[_0x6472('0x38')],'UserId':_0x78a554['id'],'queue_name':_0x3e33a5[_0x6472('0x38')],'VoiceQueueId':_0x3e33a5['id'],'interface':_[_0x6472('0x64')](_0x78a554['interface'])?util[_0x6472('0xa4')](_0x6472('0xa5'),_0x78a554[_0x6472('0x38')]):_0x78a554['interface'],'paused':_0x78a554['voicePause']||![],'penalty':_0x78a554[_0x6472('0xa7')]},{'transaction':_0x4131e0});});}else{return;}})['then'](function(){for(var _0x2bf895=0x0;_0x2bf895<_0x36b61f[_0x6472('0x4c')];_0x2bf895++){var _0x1f59c4=_0x36b61f[_0x2bf895]['getDataValue'](_0x6472('0x96'));var _0x4ed16f=_0x1f59c4+'QueueId';socket['emit'](_0x6472('0x7a')+_0x1f59c4+'Queue:save',{'UserId':_0x78a554['id'],['queueField']:_0x36b61f[_0x2bf895]['id']});}});});})[_0x6472('0x16')](function(){db['TeamVoicePrefix'][_0x6472('0x8f')]({'where':{'teamId':_0x5b909d['id']}})[_0x6472('0x16')](function(_0x58f553){if(_0x58f553){db['UserVoicePrefix']['create']({'UserId':_0x247e03['params']['id'],'VoicePrefixId':_0x58f553['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x5eeff2,null))[_0x6472('0x21')](handleError(_0x5eeff2,null));};exports[_0x6472('0x121')]=function(_0x2e855f,_0x14de38){return db['User'][_0x6472('0x8f')]({'where':{'id':_0x2e855f[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x14de38,null))['then'](function(_0x42a1af){if(_0x42a1af){var _0x11619f=_0x42a1af[_0x6472('0x2d')]({'plain':!![]});var _0x43aedf=_0x2e855f[_0x6472('0x43')][_0x6472('0x9e')];return _0x42a1af[_0x6472('0x121')](_0x43aedf)['then'](function(){for(var _0x1c000d=0x0;_0x1c000d<_0x43aedf['length'];_0x1c000d++){var _0x41d2c7=[];var _0x137cf3={};db[_0x6472('0x110')][_0x6472('0x8f')]({'where':{'id':_0x43aedf[_0x1c000d]}})[_0x6472('0x16')](function(_0x5137f6){_0x137cf3=_0x5137f6['dataValues'];_0x41d2c7[_0x6472('0x4d')](_0x5137f6[_0x6472('0x122')]()[_0x6472('0x16')](function(_0x1e8d3a){for(var _0x47dd13=0x0;_0x47dd13<_0x1e8d3a[_0x6472('0x4c')];_0x47dd13++){_0x1e8d3a[_0x47dd13][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x120'));}return _0x1e8d3a;}));_0x41d2c7['push'](_0x5137f6['getChatQueues']()[_0x6472('0x16')](function(_0x1a5ab6){for(var _0x680230=0x0;_0x680230<_0x1a5ab6[_0x6472('0x4c')];_0x680230++){_0x1a5ab6[_0x680230][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x116'));}return _0x1a5ab6;}));_0x41d2c7[_0x6472('0x4d')](_0x5137f6[_0x6472('0x117')]()['then'](function(_0x27d700){for(var _0x1de2ae=0x0;_0x1de2ae<_0x27d700[_0x6472('0x4c')];_0x1de2ae++){_0x27d700[_0x1de2ae]['setDataValue'](_0x6472('0x96'),_0x6472('0x118'));}return _0x27d700;}));_0x41d2c7['push'](_0x5137f6['getSmsQueues']()['then'](function(_0x1c0eeb){for(var _0x48f623=0x0;_0x48f623<_0x1c0eeb[_0x6472('0x4c')];_0x48f623++){_0x1c0eeb[_0x48f623][_0x6472('0x114')]('channel',_0x6472('0x119'));}return _0x1c0eeb;}));_0x41d2c7[_0x6472('0x4d')](_0x5137f6[_0x6472('0x11a')]()[_0x6472('0x16')](function(_0x5a949a){for(var _0x406ab3=0x0;_0x406ab3<_0x5a949a[_0x6472('0x4c')];_0x406ab3++){_0x5a949a[_0x406ab3][_0x6472('0x114')]('channel',_0x6472('0x11b'));}return _0x5a949a;}));_0x41d2c7[_0x6472('0x4d')](_0x5137f6[_0x6472('0x11c')]()[_0x6472('0x16')](function(_0x301cb2){for(var _0x3d21db=0x0;_0x3d21db<_0x301cb2['length'];_0x3d21db++){_0x301cb2[_0x3d21db][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x123'));}return _0x301cb2;}));_0x41d2c7['push'](_0x5137f6[_0x6472('0x124')]()['then'](function(_0x3fdca3){for(var _0x3414ec=0x0;_0x3414ec<_0x3fdca3[_0x6472('0x4c')];_0x3414ec++){_0x3fdca3[_0x3414ec][_0x6472('0x114')](_0x6472('0x96'),_0x6472('0x11d'));}return _0x3fdca3;}));return BPromise[_0x6472('0x54')](_0x41d2c7);})[_0x6472('0x16')](function(_0x39f9ab){var _0x2042af=_['flatten'](_0x39f9ab);_0x41d2c7=[];return db['sequelize'][_0x6472('0x125')](function(_0x6f781){for(var _0x2a649b=0x0;_0x2a649b<_0x2042af['length'];_0x2a649b++){_0x41d2c7[_0x6472('0x4d')](_0x2042af[_0x2a649b][_0x6472('0x126')](_0x11619f['id']),{'transaction':_0x6f781});}return BPromise['all'](_0x41d2c7)['then'](function(){if(_0x11619f[_0x6472('0x97')]){return BPromise[_0x6472('0x81')](_[_0x6472('0xcc')](_0x2042af,function(_0x3f5d52){return _0x3f5d52[_0x6472('0x11f')]('channel')==='Voice';}),function(_0x13b980){return db[_0x6472('0xa8')][_0x6472('0x2c')]({'where':{'VoiceQueueId':_0x13b980['id'],'UserId':_0x11619f['id']},'transaction':_0x6f781});});}else{return;}})[_0x6472('0x16')](function(){db[_0x6472('0x127')][_0x6472('0x8f')]({'where':{'teamId':_0x137cf3['id']}})['then'](function(_0x55de85){if(_0x55de85){return db['UserVoicePrefix'][_0x6472('0x2c')]({'where':{'UserId':_0x11619f['id'],'VoicePrefixId':_0x55de85[_0x6472('0x4f')]['VoicePrefixId']}});}});})[_0x6472('0x16')](function(){for(var _0x258d84=0x0;_0x258d84<_0x2042af['length'];_0x258d84++){var _0x59215b=_0x2042af[_0x258d84][_0x6472('0x11f')]('channel');var _0xc28eec=_0x59215b+_0x6472('0x9f');socket[_0x6472('0xa0')]('user'+_0x59215b+'Queue:remove',{'UserId':_0x11619f['id'],['queueField']:_0x2042af[_0x258d84]['id']});}});});});}});}})[_0x6472('0x16')](respondWithStatusCode(_0x14de38,null))[_0x6472('0x21')](handleError(_0x14de38,null));};exports[_0x6472('0x128')]=function(_0xdddd2f,_0x3554da){var _0x3efea2={};var _0x3deb25={};var _0x2d2462;var _0x1eb3a5;return db['User']['findOne']({'where':{'id':_0xdddd2f[_0x6472('0x55')]['id']}})['then'](handleEntityNotFound(_0x3554da,null))[_0x6472('0x16')](function(_0x10a34f){if(_0x10a34f){_0x2d2462=_0x10a34f;_0x3deb25[_0x6472('0x56')]=_[_0x6472('0x57')](db['CmList']['rawAttributes']);_0x3deb25['query']=_[_0x6472('0x57')](_0xdddd2f[_0x6472('0x43')]);_0x3deb25[_0x6472('0xc7')]=_[_0x6472('0x58')](_0x3deb25[_0x6472('0x56')],_0x3deb25['query']);_0x3efea2[_0x6472('0x49')]=_[_0x6472('0x58')](_0x3deb25[_0x6472('0x56')],qs[_0x6472('0x59')](_0xdddd2f[_0x6472('0x43')][_0x6472('0x59')]));_0x3efea2[_0x6472('0x49')]=_0x3efea2[_0x6472('0x49')][_0x6472('0x4c')]?_0x3efea2[_0x6472('0x49')]:_0x3deb25[_0x6472('0x56')];_0x3efea2[_0x6472('0xc8')]=qs[_0x6472('0xc9')](_0xdddd2f['query']['sort']);_0x3efea2[_0x6472('0xca')]=qs[_0x6472('0xc7')](_[_0x6472('0xcb')](_0xdddd2f[_0x6472('0x43')],_0x3deb25[_0x6472('0xc7')]));if(_0xdddd2f[_0x6472('0x43')]['filter']){_0x3efea2[_0x6472('0xca')]=_['merge'](_0x3efea2['where'],{'$or':_[_0x6472('0x33')](_0x3efea2[_0x6472('0x49')],function(_0x292279){var _0x467308={};_0x467308[_0x292279]={'$like':'%'+_0xdddd2f[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x467308;})});}_0x3efea2=_[_0x6472('0x5a')]({},_0x3efea2,_0xdddd2f[_0x6472('0x5b')]);return _0x2d2462[_0x6472('0x128')](_0x3efea2);}})['then'](function(_0x3654b2){if(_0x3654b2){_0x1eb3a5=_0x3654b2[_0x6472('0x4c')];if(!_0xdddd2f[_0x6472('0x43')][_0x6472('0xce')](_0x6472('0xd8'))){_0x3efea2['limit']=qs[_0x6472('0x26')](_0xdddd2f[_0x6472('0x43')][_0x6472('0x26')]);_0x3efea2[_0x6472('0x25')]=qs[_0x6472('0x25')](_0xdddd2f[_0x6472('0x43')]['offset']);}return _0x2d2462[_0x6472('0x128')](_0x3efea2);}})[_0x6472('0x16')](function(_0x403454){if(_0x403454){return _0x403454?{'count':_0x1eb3a5,'rows':_0x403454}:null;}})[_0x6472('0x16')](respondWithResult(_0x3554da,null))[_0x6472('0x21')](handleError(_0x3554da,null));};exports['getAgents']=function(_0x2bac70,_0x177d3d){var _0x81adfb={};var _0x3636c0={};var _0x37e393;return db['User']['findOne']({'where':{'id':_0x2bac70[_0x6472('0x55')]['id']}})[_0x6472('0x16')](handleEntityNotFound(_0x177d3d,null))[_0x6472('0x16')](function(_0x34c289){if(_0x34c289){_0x37e393=_0x34c289;_0x3636c0['model']=_[_0x6472('0x57')](db['User']['rawAttributes']);_0x3636c0[_0x6472('0x43')]=_[_0x6472('0x57')](_0x2bac70[_0x6472('0x43')]);_0x3636c0['filters']=_[_0x6472('0x58')](_0x3636c0[_0x6472('0x56')],_0x3636c0['query']);_0x81adfb['attributes']=_[_0x6472('0x58')](_0x3636c0[_0x6472('0x56')],qs[_0x6472('0x59')](_0x2bac70[_0x6472('0x43')][_0x6472('0x59')]));_0x81adfb[_0x6472('0x49')]=_0x81adfb[_0x6472('0x49')][_0x6472('0x4c')]?_0x81adfb[_0x6472('0x49')]:_0x3636c0['model'];_0x81adfb[_0x6472('0xc8')]=qs['sort'](_0x2bac70[_0x6472('0x43')]['sort']);_0x81adfb[_0x6472('0xca')]=qs['filters'](_[_0x6472('0xcb')](_0x2bac70[_0x6472('0x43')],_0x3636c0[_0x6472('0xc7')]));if(_0x2bac70['query'][_0x6472('0xcc')]){_0x81adfb[_0x6472('0xca')]=_[_0x6472('0x5a')](_0x81adfb[_0x6472('0xca')],{'$or':_[_0x6472('0x33')](_0x81adfb[_0x6472('0x49')],function(_0x207f16){var _0x533d2a={};_0x533d2a[_0x207f16]={'$like':'%'+_0x2bac70[_0x6472('0x43')][_0x6472('0xcc')]+'%'};return _0x533d2a;})});}_0x81adfb[_0x6472('0x56')]=db[_0x6472('0x3b')];_0x81adfb['as']=_0x6472('0x7e');_0x81adfb=_[_0x6472('0x5a')]({},_0x81adfb,_0x2bac70[_0x6472('0x5b')]);return _0x37e393['getVoiceQueues']({'include':[_0x81adfb]});}})['then'](function(_0x76fa8d){if(_0x76fa8d){var _0x1f09ba={},_0x71322=[];for(var _0x2636a3=0x0;_0x2636a3<_0x76fa8d[_0x6472('0x4c')];_0x2636a3+=0x1){for(var _0xec04db=0x0,_0x88c316;_0xec04db<_0x76fa8d[_0x2636a3][_0x6472('0x7e')][_0x6472('0x4c')];_0xec04db+=0x1){_0x88c316=_0x76fa8d[_0x2636a3]['Agents'][_0xec04db][_0x6472('0x2d')]({'plain':!![]});_0x1f09ba[_0x88c316['id']]=_0x88c316;}}_0x1f09ba=_['values'](_0x1f09ba);for(var _0x32c00b=qs[_0x6472('0x25')](_0x2bac70['query'][_0x6472('0x25')]);_0x32c00b<_0x1f09ba['length']&&_0x71322['length']=_0xa79cb3){_0x2bec05=_0xa79cb3;_0x387104=0xc8;}else{_0x387104=0xce;}_0x2ac799[_0xd3c5('0x1a')](_0x387104);return _0x2ac799['set'](_0xd3c5('0x1f'),_0x2dd0b7+'-'+_0x2bec05+'/'+_0xa79cb3)[_0xd3c5('0x20')](_0x8edfa7);}return null;};}function saveUpdates(_0x444a80){return function(_0x36e17b){if(_0x36e17b){return _0x36e17b[_0xd3c5('0x21')](_0x444a80)[_0xd3c5('0x11')](function(_0x19abae){return _0x19abae;});}return null;};}function removeEntity(_0x41d222){return function(_0x541da5){if(_0x541da5){return _0x541da5[_0xd3c5('0x22')]()['then'](function(){var _0x4b1dfc=_0x541da5[_0xd3c5('0x23')]({'plain':!![]});if(_0x4b1dfc['role']===_0xd3c5('0x24'))return;var _0x199ae2=[{'name':_0xd3c5('0x25'),'value':_0xd3c5('0x26'),'ignore':!![]},{'name':_0xd3c5('0x27'),'value':_0xd3c5('0x28'),'ignore':![]},{'name':_0xd3c5('0x29'),'value':_0xd3c5('0x2a'),'ignore':![]}];var _0x125fef=_(_0x199ae2)[_0xd3c5('0x2b')](_0xd3c5('0x2c'))['map'](_0xd3c5('0x2d'))[_0xd3c5('0x2d')]();if(_['includes'](_0x125fef,_0x4b1dfc[_0xd3c5('0x2e')])){return;}var _0x4d8190=_[_0xd3c5('0x2f')](_0x199ae2,[_0xd3c5('0x2d'),_0x4b1dfc['role']])[_0xd3c5('0x30')];return db[_0xd3c5('0x31')][_0xd3c5('0x22')]({'where':{'type':_0x4d8190,'resourceId':_0x4b1dfc['id']}})[_0xd3c5('0x11')](function(){return _0x541da5;});})[_0xd3c5('0x11')](function(){_0x41d222[_0xd3c5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b2d9){return function(_0x18e6d3){if(!_0x18e6d3){_0x20b2d9['sendStatus'](0x194);}return _0x18e6d3;};}function handleError(_0x2ab56c,_0x506864){_0x506864=_0x506864||0x1f4;return function(_0x57fecc){logger[_0xd3c5('0x15')](_0x57fecc['stack']);if(_0x57fecc[_0xd3c5('0x30')]){delete _0x57fecc[_0xd3c5('0x30')];}_0x2ab56c['status'](_0x506864)[_0xd3c5('0x32')](_0x57fecc);};}exports['index']=function(_0x10885c,_0x4e4ab9){var _0x51b891={},_0xd01144={'count':0x0,'rows':[]};var _0x53dcbf=_(db[_0xd3c5('0x33')]['rawAttributes'])[_0xd3c5('0x34')](function(_0x273496){return{'name':_0x273496[_0xd3c5('0x35')],'type':_0x273496['type'][_0xd3c5('0x36')]};})['filter'](function(_0x3d3708){return!_['includes'](['password',_0xd3c5('0x37')],_0x3d3708[_0xd3c5('0x30')]);})['value']();_0x51b891=qs['getOptions'](_0x53dcbf,_0x10885c);var _0x1fc5df={'where':_0x51b891[_0xd3c5('0x38')]};return db[_0xd3c5('0x33')][_0xd3c5('0x1e')](_0x1fc5df)['then'](function(_0x1b1681){_0xd01144[_0xd3c5('0x1e')]=_0x1b1681;if(_0x10885c[_0xd3c5('0x39')][_0xd3c5('0x3a')]){_0x51b891['include']=[{'all':!![]}];}if(_0x10885c[_0xd3c5('0x39')][_0xd3c5('0x3b')]===_0xd3c5('0x3c')){_0x51b891[_0xd3c5('0x3d')]=[{'model':db[_0xd3c5('0x3e')],'as':'userSetting'}];}if(!_['includes'](_0x51b891['attributes'],'id')){_0x51b891[_0xd3c5('0x3f')][_0xd3c5('0x40')]('id');}return db[_0xd3c5('0x33')]['findAll'](_0x51b891);})[_0xd3c5('0x11')](function(_0x1f9799){_0xd01144[_0xd3c5('0x41')]=_0x1f9799;if(_0x10885c['query'][_0xd3c5('0x42')]===_0xd3c5('0x3c')){var _0x260fef=[];for(var _0x245204=0x0;_0x245204<_0xd01144[_0xd3c5('0x41')][_0xd3c5('0x43')];_0x245204++){_0x260fef[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x44'),_0xd01144[_0xd3c5('0x41')][_0x245204][_0xd3c5('0x45')]));_0x260fef[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x46'),_0xd01144[_0xd3c5('0x41')][_0x245204][_0xd3c5('0x45')]));_0x260fef[_0xd3c5('0x40')](get_open_tabs('fax',_0xd01144[_0xd3c5('0x41')][_0x245204][_0xd3c5('0x45')]));_0x260fef[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x47'),_0xd01144[_0xd3c5('0x41')][_0x245204][_0xd3c5('0x45')]));_0x260fef[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x48'),_0xd01144['rows'][_0x245204][_0xd3c5('0x45')]));_0x260fef[_0xd3c5('0x40')](get_open_tabs('whatsapp',_0xd01144[_0xd3c5('0x41')][_0x245204]['dataValues']));}return BPromise['all'](_0x260fef)['then'](function(){return _0xd01144;});}else{return _0xd01144;}})['then'](respondWithFilteredResult(_0x4e4ab9,_0x51b891))[_0xd3c5('0x49')](handleError(_0x4e4ab9,null));};exports[_0xd3c5('0x4a')]=function(_0x411661,_0xcb5d28){var _0xb34ae9={'raw':![],'where':{'id':_0x411661[_0xd3c5('0x4b')]['id']}},_0x4fd33b={};_0x4fd33b[_0xd3c5('0x4c')]=_[_0xd3c5('0x4d')](_[_0xd3c5('0x4e')](db[_0xd3c5('0x33')][_0xd3c5('0x4f')]),['password','salt']);_0x4fd33b[_0xd3c5('0x39')]=_['keys'](_0x411661['query']);_0x4fd33b[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x4fd33b['model'],_0x4fd33b['query']);_0xb34ae9[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x4fd33b[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x411661[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0xb34ae9[_0xd3c5('0x3f')]=_0xb34ae9[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0xb34ae9[_0xd3c5('0x3f')]:_0x4fd33b[_0xd3c5('0x4c')];if(_0x411661[_0xd3c5('0x39')]['includeAll']){_0xb34ae9[_0xd3c5('0x3d')]=[{'all':!![]}];}if(_0x411661[_0xd3c5('0x39')][_0xd3c5('0x3b')]===_0xd3c5('0x3c')){_0xb34ae9[_0xd3c5('0x3d')]=[{'model':db[_0xd3c5('0x3e')],'as':'userSetting'}];}_0xb34ae9=_[_0xd3c5('0x53')]({},_0xb34ae9,_0x411661['options']);if(!_[_0xd3c5('0x54')](_0xb34ae9['attributes'],'id')){_0xb34ae9[_0xd3c5('0x3f')][_0xd3c5('0x40')]('id');}return db[_0xd3c5('0x33')][_0xd3c5('0x2f')](_0xb34ae9)[_0xd3c5('0x11')](handleEntityNotFound(_0xcb5d28,null))[_0xd3c5('0x11')](function(_0x2da9b9){var _0x3fe88c=[];values=_0x2da9b9;if(_0x411661[_0xd3c5('0x39')]['openTabs']===_0xd3c5('0x3c')){_0x3fe88c[_0xd3c5('0x40')](get_open_tabs('chat',_0x2da9b9['dataValues']));_0x3fe88c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x46'),_0x2da9b9['dataValues']));_0x3fe88c[_0xd3c5('0x40')](get_open_tabs('openchannel',_0x2da9b9['dataValues']));_0x3fe88c[_0xd3c5('0x40')](get_open_tabs('whatsapp',_0x2da9b9[_0xd3c5('0x45')]));_0x3fe88c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x55'),_0x2da9b9[_0xd3c5('0x45')]));_0x3fe88c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x47'),_0x2da9b9[_0xd3c5('0x45')]));return BPromise[_0xd3c5('0x56')](_0x3fe88c);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0xcb5d28,null))[_0xd3c5('0x49')](handleError(_0xcb5d28,null));};exports[_0xd3c5('0x21')]=function(_0x461450,_0x3e92cd){if(_0x461450[_0xd3c5('0x57')]['id']){delete _0x461450[_0xd3c5('0x57')]['id'];}delete _0x461450['body'][_0xd3c5('0x2e')];return db['User'][_0xd3c5('0x2f')]({'where':{'id':_0x461450[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x3e92cd,null))[_0xd3c5('0x11')](saveUpdates(_0x461450[_0xd3c5('0x57')],null))['then'](respondWithResult(_0x3e92cd,null))[_0xd3c5('0x49')](handleError(_0x3e92cd,null));};exports[_0xd3c5('0x58')]=function(_0x5edb58,_0x45ae2a){return db[_0xd3c5('0x33')][_0xd3c5('0x58')]()[_0xd3c5('0x11')](respondWithResult(_0x45ae2a,null))[_0xd3c5('0x49')](handleError(_0x45ae2a,null));};exports['addContacts']=function(_0x330866,_0x38b819){return db[_0xd3c5('0x33')]['find']({'where':{'id':_0x330866[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x38b819,null))[_0xd3c5('0x11')](function(_0x637b6e){if(_0x637b6e){return _0x637b6e[_0xd3c5('0x59')](_0x330866[_0xd3c5('0x57')][_0xd3c5('0x5a')],_[_0xd3c5('0x5b')](_0x330866['body'],['ids','id'])||{});}})[_0xd3c5('0x11')](respondWithResult(_0x38b819,null))[_0xd3c5('0x49')](handleError(_0x38b819,null));};function validateUser(_0x4205f6){return new BPromise(function(_0x13af48,_0x449342){if(_0x4205f6['internal'])return _0x13af48(_0x4205f6);return db['Setting'][_0xd3c5('0x5c')](0x1)['then'](function(_0x1a3eb8){if(_0x1a3eb8[_0xd3c5('0x5d')])authService[_0xd3c5('0x5e')](_0x4205f6[_0xd3c5('0x5f')]);db[_0xd3c5('0x33')]['max'](_0xd3c5('0x60'))[_0xd3c5('0x11')](function(_0x4b3afa){if(_[_0xd3c5('0x61')](_0x4b3afa)){_0x4205f6['internal']=_0x1a3eb8[_0xd3c5('0x62')]||0x1;return;}if(_[_0xd3c5('0x61')](_0x1a3eb8[_0xd3c5('0x62')])||_0x1a3eb8[_0xd3c5('0x62')]===_0x4b3afa){_0x4205f6[_0xd3c5('0x60')]=_0x4b3afa+0x1;return;}if(_0x1a3eb8[_0xd3c5('0x62')]>_0x4b3afa){_0x4205f6[_0xd3c5('0x60')]=_0x1a3eb8[_0xd3c5('0x62')];return;}return db[_0xd3c5('0x63')][_0xd3c5('0x39')](_0xd3c5('0x64'),{'type':db[_0xd3c5('0x63')][_0xd3c5('0x65')][_0xd3c5('0x66')]})[_0xd3c5('0x11')](function(_0x376737){if(_0x376737&&_0x376737[_0xd3c5('0x43')]){for(var _0x4b1313=0x0,_0x17a1b7=_0x376737[_0xd3c5('0x43')];_0x4b1313<_0x17a1b7&&_[_0xd3c5('0x61')](_0x4205f6['internal']);_0x4b1313++){if(_0x1a3eb8[_0xd3c5('0x62')]<=_0x376737[_0x4b1313]['from']){_0x4205f6[_0xd3c5('0x60')]=_0x376737[_0x4b1313]['from'];}else if(_0x1a3eb8[_0xd3c5('0x62')]>_0x376737[_0x4b1313][_0xd3c5('0x67')]&&_0x1a3eb8[_0xd3c5('0x62')]<=_0x376737[_0x4b1313]['to']){_0x4205f6[_0xd3c5('0x60')]=_0x1a3eb8[_0xd3c5('0x62')];}}}if(_[_0xd3c5('0x61')](_0x4205f6['internal'])){_0x4205f6[_0xd3c5('0x60')]=_0x4b3afa+0x1;}return _0x13af48(_0x4205f6);});});})[_0xd3c5('0x49')](function(_0x14752a){_0x449342(_0x14752a);});});}function updateUser(_0x49ea5b){return new BPromise(function(_0x5eec3f,_0x84777c){try{if(_0x49ea5b['voicemail']){_0x49ea5b[_0xd3c5('0x68')]=_0x49ea5b[_0xd3c5('0x60')];_0x49ea5b[_0xd3c5('0x69')]={'mailbox':_0x49ea5b[_0xd3c5('0x60')],'password':_0x49ea5b[_0xd3c5('0x5f')],'fullname':_0x49ea5b[_0xd3c5('0x6a')],'email':_0x49ea5b['email']};}if(_0x49ea5b[_0xd3c5('0x2e')]==='agent'){if(!_0x49ea5b[_0xd3c5('0x6b')])_0x49ea5b[_0xd3c5('0x6b')]=['101',_0xd3c5('0x6c'),_0xd3c5('0x6d'),_0xd3c5('0x6e'),_0xd3c5('0x6f'),_0xd3c5('0x70'),'105',_0xd3c5('0x71'),_0xd3c5('0x72'),'108',_0xd3c5('0x73'),'100',_0xd3c5('0x74'),_0xd3c5('0x75'),'115'];}_0x5eec3f(_0x49ea5b);}catch(_0x19f47d){_0x84777c(_0x19f47d);}});}exports['create']=function(_0x2af635,_0x25796a){if(_0x2af635[_0xd3c5('0x26')]['role']==='agent')throw new Error('Unauthorized');if(_0x2af635[_0xd3c5('0x57')][_0xd3c5('0x2e')]==='user'&&_0x2af635[_0xd3c5('0x26')][_0xd3c5('0x2e')]!=='admin'){throw new Error(_0xd3c5('0x76'));}if(_0x2af635[_0xd3c5('0x57')][_0xd3c5('0x2e')]===_0xd3c5('0x24')&&_0x2af635[_0xd3c5('0x26')]['role']!==_0xd3c5('0x24')){throw new Error(_0xd3c5('0x77'));}return licenseUtil['checkUserLimits']([_0x2af635['body']])[_0xd3c5('0x11')](function(){return validateUser(_0x2af635[_0xd3c5('0x57')]);})[_0xd3c5('0x11')](function(_0x9a763a){return updateUser(_0x9a763a)['then'](function(_0xe05a37){if(_0xe05a37['role']===_0xd3c5('0x24')){_0xe05a37[_0xd3c5('0x78')]=_0x2af635[_0xd3c5('0x26')][_0xd3c5('0x78')];delete _0xe05a37[_0xd3c5('0x79')];}return _0xe05a37;});})['then'](function(_0x1784d6){return db[_0xd3c5('0x33')][_0xd3c5('0x7a')](_0x1784d6,{'include':[{'model':db[_0xd3c5('0x69')],'as':_0xd3c5('0x69')}]});})[_0xd3c5('0x11')](function(_0x5d449c){if(_0x2af635[_0xd3c5('0x57')]['role']===_0xd3c5('0x26'))return _0x5d449c;if(_0x2af635[_0xd3c5('0x26')][_0xd3c5('0x2e')]!==_0xd3c5('0x26'))return _0x5d449c;return db[_0xd3c5('0x7b')]['find']({'where':{'name':_0x5d449c[_0xd3c5('0x2e')]==='agent'?_0xd3c5('0x27'):_0xd3c5('0x29'),'userProfileId':_0x2af635[_0xd3c5('0x26')][_0xd3c5('0x79')]},'raw':!![]})[_0xd3c5('0x11')](function(_0x83b194){if(!_0x83b194||_0x83b194[_0xd3c5('0x7c')]!=0x0)return _0x5d449c;return db[_0xd3c5('0x31')]['create']({'name':_0x5d449c['name'],'resourceId':_0x5d449c['id'],'type':_0x83b194[_0xd3c5('0x30')],'sectionId':_0x83b194['id']},{})[_0xd3c5('0x11')](function(){return _0x5d449c;});})[_0xd3c5('0x49')](function(_0x420c87){logger['error'](_0xd3c5('0x7d'),_0x420c87);throw _0x420c87;});})['then'](respondWithResult(_0x25796a,0xc9))[_0xd3c5('0x49')](handleError(_0x25796a,null));};exports[_0xd3c5('0x7e')]=function(_0x4c71c3,_0x2bf01f){var _0x3a607e=_0x4c71c3[_0xd3c5('0x57')];var _0x57096e=[];if(_0x4c71c3[_0xd3c5('0x26')][_0xd3c5('0x2e')]===_0xd3c5('0x28'))throw new Error(_0xd3c5('0x7f'));if(_['some'](_0x3a607e,[_0xd3c5('0x2e'),_0xd3c5('0x26')])&&_0x4c71c3[_0xd3c5('0x26')][_0xd3c5('0x2e')]!==_0xd3c5('0x24')){throw new Error(_0xd3c5('0x76'));}if(_[_0xd3c5('0x80')](_0x3a607e,[_0xd3c5('0x2e'),_0xd3c5('0x24')])&&_0x4c71c3[_0xd3c5('0x26')][_0xd3c5('0x2e')]!==_0xd3c5('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xd3c5('0x81')](_0x3a607e)[_0xd3c5('0x11')](function(){return validateUser(_0x3a607e[0x0]);})['then'](function(){for(var _0x287439=0x1;_0x287439<_0x3a607e[_0xd3c5('0x43')];_0x287439++){var _0x11db96=_0x3a607e[_0x287439-0x1]['internal'];if(!_0x3a607e[_0x287439][_0xd3c5('0x60')])_0x3a607e[_0x287439][_0xd3c5('0x60')]=_0x11db96+0x1;_0x57096e[_0xd3c5('0x40')](validateUser(_0x3a607e[_0x287439]));}return BPromise['all'](_0x57096e);})[_0xd3c5('0x11')](function(){_0x57096e=[];for(var _0x2f2ddb=0x0;_0x2f2ddb<_0x3a607e[_0xd3c5('0x43')];_0x2f2ddb++){_0x57096e[_0xd3c5('0x40')](updateUser(_0x3a607e[_0x2f2ddb]));}return BPromise['all'](_0x57096e);})[_0xd3c5('0x11')](function(){return BPromise[_0xd3c5('0x82')](_0x3a607e,function(_0x433499){return db[_0xd3c5('0x33')]['create'](_0x433499,{'include':[{'model':db['VoiceMail'],'as':_0xd3c5('0x69')}]})[_0xd3c5('0x11')](function(_0xdc9d5c){_0x433499['id']=_0xdc9d5c['id'];return _0x433499;});});})['then'](function(_0x5e61ec){if(_0x4c71c3[_0xd3c5('0x57')][_0xd3c5('0x2e')]==='user')return _0x5e61ec;if(_0x4c71c3[_0xd3c5('0x26')][_0xd3c5('0x2e')]!=='user')return _0x5e61ec;var _0x25c861=_['some'](_0x5e61ec,function(_0x20bf42){return _0x20bf42[_0xd3c5('0x2e')]==='agent'||_0x20bf42[_0xd3c5('0x2e')]===_0xd3c5('0x2a');});if(!_0x25c861)return _0x5e61ec;return db[_0xd3c5('0x7b')][_0xd3c5('0x83')]({'where':{'name':{'$or':['Agents',_0xd3c5('0x29')]},'userProfileId':_0x4c71c3[_0xd3c5('0x26')][_0xd3c5('0x79')]},'raw':!![]})[_0xd3c5('0x11')](function(_0x1a13fc){if(_[_0xd3c5('0x84')](_0x1a13fc)||!_[_0xd3c5('0x80')](_0x1a13fc,['autoAssociation',0x0]))return _0x5e61ec;_0x57096e=[];var _0x4ea896=_(_0x1a13fc)[_0xd3c5('0x34')](function(_0x1f1ece){if(_0x1f1ece[_0xd3c5('0x7c')]===0x1)return;return _0x1f1ece['name']===_0xd3c5('0x27')?_0xd3c5('0x28'):'telephone';})[_0xd3c5('0x85')]()[_0xd3c5('0x2d')]();for(var _0x4d08df=0x0;_0x4d08df<_0x5e61ec[_0xd3c5('0x43')];_0x4d08df++){if(!_[_0xd3c5('0x54')](_0x4ea896,_0x5e61ec[_0x4d08df][_0xd3c5('0x2e')]))return;var _0x147ad2=_0x5e61ec[_0x4d08df][_0xd3c5('0x2e')]==='agent'?_0xd3c5('0x27'):_0xd3c5('0x29');_0x57096e[_0xd3c5('0x40')](db['UserProfileResource'][_0xd3c5('0x7a')]({'name':_0x5e61ec[_0x4d08df][_0xd3c5('0x30')],'resourceId':_0x5e61ec[_0x4d08df]['id'],'type':_0x147ad2,'sectionId':_[_0xd3c5('0x2f')](_0x1a13fc,[_0xd3c5('0x30'),_0x147ad2])['id']},{}));}return BPromise[_0xd3c5('0x56')](_0x57096e);});})['then'](respondWithResult(_0x2bf01f,0xc9))[_0xd3c5('0x49')](handleError(_0x2bf01f,null));};exports[_0xd3c5('0x86')]=function(_0x48b1ab,_0x15ae79){if(_0x48b1ab[_0xd3c5('0x57')]['id']){delete _0x48b1ab[_0xd3c5('0x57')]['id'];}return db[_0xd3c5('0x33')]['find']({'where':{'id':_0x48b1ab[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](function(_0x11a8de){if(!_0x11a8de)return null;if(_0x11a8de['id']===_0x48b1ab[_0xd3c5('0x26')]['id']){if(!_0x48b1ab[_0xd3c5('0x57')]['oldPassword']||!_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')]){throw new db['Sequelize']['ValidationError'](_0xd3c5('0x88'));}if(!_0x11a8de[_0xd3c5('0x89')](_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x8a')])){throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))](_0xd3c5('0x8d'));}if(_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x8a')]===_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')]){throw new db[(_0xd3c5('0x8b'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x48b1ab[_0xd3c5('0x26')][_0xd3c5('0x2e')]===_0xd3c5('0x24')){if(!_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')]){throw new db[(_0xd3c5('0x8b'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x48b1ab[_0xd3c5('0x26')][_0xd3c5('0x2e')]==='user'){if(!_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')]){throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x11a8de[_0xd3c5('0x2e')]!==_0xd3c5('0x28')){throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))](_0xd3c5('0x7f'));}}else{throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))](_0xd3c5('0x7f'));}return _0x11a8de;})['then'](handleEntityNotFound(_0x15ae79,null))['then'](function(_0x4a09e7){return db[_0xd3c5('0x8e')][_0xd3c5('0x8f')]({'attributes':['id',_0xd3c5('0x5d'),_0xd3c5('0x90'),_0xd3c5('0x91')]})[_0xd3c5('0x11')](function(_0x745ffb){if(_0x745ffb[_0xd3c5('0x5d')])authService['validatePasswordPattern'](_0x48b1ab['body']['newPassword']);if(!_0x745ffb[_0xd3c5('0x90')]||!_0x4a09e7[_0xd3c5('0x92')])return _0x4a09e7;authService[_0xd3c5('0x93')](_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')],_0x4a09e7[_0xd3c5('0x92')],_0x745ffb[_0xd3c5('0x91')]);return _0x4a09e7;})[_0xd3c5('0x11')](saveUpdates({'password':_0x48b1ab[_0xd3c5('0x57')]['newPassword'],'passwordResetAt':_0x48b1ab[_0xd3c5('0x26')]['id']==_0x48b1ab['params']['id']?moment():null,'previousPasswords':authService[_0xd3c5('0x94')](_0x48b1ab[_0xd3c5('0x57')][_0xd3c5('0x87')],_0x4a09e7[_0xd3c5('0x92')])},null));})[_0xd3c5('0x11')](respondWithResult(_0x15ae79,null))['catch'](handleError(_0x15ae79,null));};exports[_0xd3c5('0x95')]=function(_0x5943ce,_0x16c57c){var _0x43a4e0=_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x96')];return db['User'][_0xd3c5('0x2f')]({'where':{'id':_0x5943ce[_0xd3c5('0x4b')]['id']},'attributes':['id',_0xd3c5('0x30'),_0xd3c5('0x2e'),'online',_0xd3c5('0x97'),'voicePause',_0xd3c5('0x98')]})[_0xd3c5('0x11')](handleEntityNotFound(_0x16c57c,null))[_0xd3c5('0x11')](function(_0x269224){if(_0x269224){if(!utils[_0xd3c5('0x99')](_0x43a4e0)){throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))](_0xd3c5('0x9a'));}return _0x269224[_0xd3c5('0x9b')+_[_0xd3c5('0x9c')](_0x43a4e0[_0xd3c5('0x9d')]())+'Queues'](_0x5943ce['body'][_0xd3c5('0x5a')],{'penalty':_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x9e')]||0x0})[_0xd3c5('0x9f')](function(_0x560504){for(var _0x1f6d85=0x0;_0x1f6d85<_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x5a')][_0xd3c5('0x43')];_0x1f6d85+=0x1){var _0x3a1d72={'UserId':Number(_0x5943ce['params']['id'])};_0x3a1d72[_[_0xd3c5('0x9c')](_0x43a4e0[_0xd3c5('0x9d')]())+'QueueId']=Number(_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x5a')][_0x1f6d85]);socket[_0xd3c5('0xa0')](_0xd3c5('0x26')+_[_0xd3c5('0x9c')](_0x43a4e0[_0xd3c5('0x9d')]())+'Queue:save',_0x3a1d72);}return _0x560504;})[_0xd3c5('0x11')](function(){if(_0x43a4e0===_0xd3c5('0xa1')){return db[_0xd3c5('0xa2')][_0xd3c5('0x83')]({'where':{'id':_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x5a')]||[]},'raw':!![],'attributes':['id',_0xd3c5('0x30')]});}})['then'](function(_0x34b46e){var _0x1e7ff5=_0x269224['get']({'plain':!![]});var _0x1ea047=[];if(_0x43a4e0===_0xd3c5('0xa1')&&_0x1e7ff5[_0xd3c5('0x2e')]===_0xd3c5('0x28')&&_0x1e7ff5[_0xd3c5('0xa3')]){for(var _0x54d5f3=0x0;_0x54d5f3<_0x34b46e['length'];_0x54d5f3+=0x1){_0x1ea047['push']({'membername':_0x1e7ff5[_0xd3c5('0x30')],'UserId':_0x1e7ff5['id'],'queue_name':_0x34b46e[_0x54d5f3][_0xd3c5('0x30')],'VoiceQueueId':_0x34b46e[_0x54d5f3]['id'],'interface':_[_0xd3c5('0x61')](_0x1e7ff5[_0xd3c5('0x98')])?util[_0xd3c5('0xa4')]('SIP/%s',_0x1e7ff5[_0xd3c5('0x30')]):_0x1e7ff5['interface'],'paused':_0x1e7ff5[_0xd3c5('0xa5')]||![],'penalty':_0x5943ce[_0xd3c5('0x57')][_0xd3c5('0x9e')]||0x0});}return BPromise[_0xd3c5('0x82')](_0x1ea047,function(_0x35c81b){return db[_0xd3c5('0xa6')][_0xd3c5('0xa7')](_0x35c81b);});}return _0x269224;});}})[_0xd3c5('0x11')](respondWithStatusCode(_0x16c57c,null))[_0xd3c5('0x49')](handleError(_0x16c57c,null));};exports['removeQueues']=function(_0x2fd2d3,_0x5e12a4){var _0x28dc3f,_0x268b14;return db[_0xd3c5('0x33')]['find']({'where':{'id':_0x2fd2d3[_0xd3c5('0x4b')]['id']},'attributes':['id',_0xd3c5('0x30'),_0xd3c5('0x2e')]})[_0xd3c5('0x11')](handleEntityNotFound(_0x5e12a4,null))[_0xd3c5('0x11')](function(_0x50a9b4){if(_0x50a9b4){_0x28dc3f=_0x50a9b4;if(!_0x2fd2d3['query'][_0xd3c5('0x96')]||!utils[_0xd3c5('0x99')](_0x2fd2d3['query']['channel'])){throw new db['Sequelize'][(_0xd3c5('0x8c'))](_0xd3c5('0x9a'));}return _0x50a9b4[_0xd3c5('0xa8')+_[_0xd3c5('0x9c')](_0x2fd2d3[_0xd3c5('0x39')][_0xd3c5('0x96')][_0xd3c5('0x9d')]())+_0xd3c5('0xa9')](_0x2fd2d3['query'][_0xd3c5('0x5a')]);}})[_0xd3c5('0x11')](function(_0x30e32c){if(_[_0xd3c5('0xaa')](_0x2fd2d3['query'][_0xd3c5('0x5a')])){for(var _0x9860f=0x0;_0x9860f<_0x2fd2d3[_0xd3c5('0x39')][_0xd3c5('0x5a')][_0xd3c5('0x43')];_0x9860f+=0x1){_0x268b14={'UserId':Number(_0x2fd2d3[_0xd3c5('0x4b')]['id'])};_0x268b14[_[_0xd3c5('0x9c')](_0x2fd2d3['query'][_0xd3c5('0x96')]['toLowerCase']())+_0xd3c5('0xab')]=Number(_0x2fd2d3[_0xd3c5('0x39')]['ids'][_0x9860f]);socket[_0xd3c5('0xa0')](_0xd3c5('0x26')+_[_0xd3c5('0x9c')](_0x2fd2d3[_0xd3c5('0x39')]['channel']['toLowerCase']())+'Queue:remove',_0x268b14);}}else{_0x268b14={'UserId':Number(_0x2fd2d3[_0xd3c5('0x4b')]['id'])};_0x268b14[_['capitalize'](_0x2fd2d3['query'][_0xd3c5('0x96')]['toLowerCase']())+_0xd3c5('0xab')]=Number(_0x2fd2d3[_0xd3c5('0x39')]['ids']);socket[_0xd3c5('0xa0')](_0xd3c5('0x26')+_[_0xd3c5('0x9c')](_0x2fd2d3[_0xd3c5('0x39')][_0xd3c5('0x96')]['toLowerCase']())+_0xd3c5('0xac'),_0x268b14);}return _0x30e32c;})[_0xd3c5('0x11')](function(){if(_0x2fd2d3[_0xd3c5('0x39')][_0xd3c5('0x96')]===_0xd3c5('0xa1')){return db[_0xd3c5('0xa6')]['destroy']({'where':{'UserId':_0x2fd2d3['params']['id'],'VoiceQueueId':_0x2fd2d3[_0xd3c5('0x39')][_0xd3c5('0x5a')]},'individualHooks':!![]})['then'](function(){return _0x28dc3f;});}return _0x28dc3f;})[_0xd3c5('0x11')](respondWithStatusCode(_0x5e12a4,null))[_0xd3c5('0x49')](handleError(_0x5e12a4,null));};exports[_0xd3c5('0xad')]=function(_0x50c65b,_0x55f663){_0x50c65b[_0xd3c5('0x57')]['userpic']=_0x50c65b[_0xd3c5('0xae')][_0xd3c5('0xaf')];return db[_0xd3c5('0x33')]['find']({'where':{'id':_0x50c65b['params']['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x55f663,null))['then'](saveUpdates(_0x50c65b[_0xd3c5('0x57')],null))[_0xd3c5('0x11')](respondWithResult(_0x55f663,null))['catch'](handleError(_0x55f663,null));};exports[_0xd3c5('0xb0')]=function(_0xb00c4b,_0x6ed30b){var _0x1c2bfa=path[_0xd3c5('0xb1')](config[_0xd3c5('0xb2')],_0xd3c5('0xb3'));return db['User'][_0xd3c5('0x2f')]({'where':{'id':_0xb00c4b[_0xd3c5('0x4b')]['id']},'attributes':['id',_0xd3c5('0xb4')],'raw':!![]})[_0xd3c5('0x11')](handleEntityNotFound(_0x6ed30b,null))[_0xd3c5('0x11')](function(_0xe42c96){if(_0xe42c96){if(_[_0xd3c5('0x61')](_0xe42c96[_0xd3c5('0xb4')])){return _0x6ed30b['download'](_0x1c2bfa);}else{if(!fs[_0xd3c5('0xb5')](path[_0xd3c5('0xb1')](config[_0xd3c5('0xb2')],'server/files/images/',_0xe42c96['userpic']))){return _0x6ed30b[_0xd3c5('0xb6')](_0x1c2bfa);}return _0x6ed30b[_0xd3c5('0xb6')](path['join'](config[_0xd3c5('0xb2')],_0xd3c5('0xb7'),_0xe42c96['userpic']));}}})['catch'](handleError(_0x6ed30b,null));};exports['getOpenTabs']=function(_0x4445d7,_0x61b372){return db['User'][_0xd3c5('0x2f')]({'where':{'id':_0x4445d7['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x61b372,null))['then'](function(_0x181e18){var _0x10ed2c=[];values=_0x181e18[_0xd3c5('0x45')];_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x44'),_0x181e18[_0xd3c5('0x45')]));_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x46'),_0x181e18[_0xd3c5('0x45')]));_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x48'),_0x181e18[_0xd3c5('0x45')]));_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0xb8'),_0x181e18[_0xd3c5('0x45')]));_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x55'),_0x181e18['dataValues']));_0x10ed2c[_0xd3c5('0x40')](get_open_tabs(_0xd3c5('0x47'),_0x181e18[_0xd3c5('0x45')]));return BPromise[_0xd3c5('0x56')](_0x10ed2c);})[_0xd3c5('0x11')](function(_0x98550a){if(_0x98550a){var _0xe83295=_['map'](values['ChatOpenTabs'],function(_0x1399c5){return{'channel':_0xd3c5('0xb9'),'id':_0x1399c5['id'],'createdAt':_0x1399c5[_0xd3c5('0xba')]};});var _0x13633b=_[_0xd3c5('0x34')](values['FaxOpenTabs'],function(_0x5b24fe){return{'channel':_0xd3c5('0xbb'),'id':_0x5b24fe['id'],'createdAt':_0x5b24fe[_0xd3c5('0xba')]};});var _0x2a5225=_[_0xd3c5('0x34')](values['OpenchannelOpenTabs'],function(_0x361197){return{'channel':_0xd3c5('0xbc'),'id':_0x361197['id'],'createdAt':_0x361197[_0xd3c5('0xba')]};});var _0x47402a=_[_0xd3c5('0x34')](values[_0xd3c5('0xbd')],function(_0x43a908){return{'channel':_0xd3c5('0xbe'),'id':_0x43a908['id'],'createdAt':_0x43a908['createdAt']};});var _0x3eb9b1=_[_0xd3c5('0x34')](values['SmsOpenTabs'],function(_0xc96d97){return{'channel':_0xd3c5('0xbf'),'id':_0xc96d97['id'],'createdAt':_0xc96d97[_0xd3c5('0xba')]};});var _0x251eb0=_['map'](values[_0xd3c5('0xc0')],function(_0x114524){return{'channel':_0xd3c5('0xc1'),'id':_0x114524['id'],'createdAt':_0x114524[_0xd3c5('0xba')]};});var _0x28a836=_['concat'](_0xe83295,_0x13633b,_0x2a5225,_0x47402a,_0x3eb9b1,_0x251eb0);var _0x2db8a2={'count':_0x28a836[_0xd3c5('0x43')],'rows':_0x28a836};return _0x2db8a2;}else return null;})[_0xd3c5('0x11')](respondWithResult(_0x61b372,null))[_0xd3c5('0x49')](handleError(_0x61b372,null));};exports[_0xd3c5('0xc2')]=function(_0x4579af,_0x488670){var _0x12fd3c={};var _0x1a6ed1={};var _0xccef51;var _0x16777d;return db[_0xd3c5('0x33')]['findOne']({'where':{'id':_0x4579af[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x488670,null))[_0xd3c5('0x11')](function(_0x2bcab1){if(_0x2bcab1){_0xccef51=_0x2bcab1;_0x1a6ed1['model']=_[_0xd3c5('0x4e')](db[_0xd3c5('0xc3')][_0xd3c5('0x4f')]);_0x1a6ed1['query']=_['keys'](_0x4579af[_0xd3c5('0x39')]);_0x1a6ed1[_0xd3c5('0x50')]=_['intersection'](_0x1a6ed1[_0xd3c5('0x4c')],_0x1a6ed1[_0xd3c5('0x39')]);_0x12fd3c[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x1a6ed1['model'],qs[_0xd3c5('0x52')](_0x4579af[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x12fd3c[_0xd3c5('0x3f')]=_0x12fd3c[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x12fd3c[_0xd3c5('0x3f')]:_0x1a6ed1['model'];_0x12fd3c[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x4579af[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x12fd3c[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x4579af[_0xd3c5('0x39')],_0x1a6ed1[_0xd3c5('0x50')]));if(_0x4579af[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x12fd3c[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x12fd3c[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x12fd3c['attributes'],function(_0x5b72e7){var _0x403f41={};_0x403f41[_0x5b72e7]={'$like':'%'+_0x4579af[_0xd3c5('0x39')]['filter']+'%'};return _0x403f41;})});}_0x12fd3c=_[_0xd3c5('0x53')]({},_0x12fd3c,_0x4579af[_0xd3c5('0xc7')]);return _0xccef51[_0xd3c5('0xc2')](_0x12fd3c);}})['then'](function(_0x5c5d67){if(_0x5c5d67){_0x16777d=_0x5c5d67[_0xd3c5('0x43')];if(_0x4579af[_0xd3c5('0x39')]['hasOwnProperty'](_0xd3c5('0x3a'))){_0x12fd3c['include']=[{'model':db[_0xd3c5('0xc8')],'as':_0xd3c5('0xc9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd3c5('0x30'),_0xd3c5('0xca')],'where':_0x4579af[_0xd3c5('0x39')]['tag']?{'id':_0x4579af[_0xd3c5('0x39')]['tag']}:undefined,'required':_0x4579af[_0xd3c5('0x39')][_0xd3c5('0xcb')]?!![]:![]}];}if(!_0x4579af[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x12fd3c[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x4579af[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x12fd3c[_0xd3c5('0x1b')]=qs['offset'](_0x4579af[_0xd3c5('0x39')]['offset']);}return _0xccef51['getContacts'](_0x12fd3c);}})[_0xd3c5('0x11')](function(_0x3977b4){if(_0x3977b4){return _0x3977b4?{'count':_0x16777d,'rows':_0x3977b4}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x488670,null))[_0xd3c5('0x49')](handleError(_0x488670,null));};exports[_0xd3c5('0xce')]=function(_0x3eb772,_0x1b71d8){var _0x442776;var _0x340d69={};var _0x35a642;return db['User'][_0xd3c5('0x8f')]({'where':{'id':_0x3eb772[_0xd3c5('0x4b')]['id']},'attributes':['id',_0xd3c5('0x30'),_0xd3c5('0x2e')]})[_0xd3c5('0x11')](handleEntityNotFound(_0x1b71d8,null))[_0xd3c5('0x11')](function(_0x2d6e3b){if(!utils[_0xd3c5('0x99')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x96')])){throw new db[(_0xd3c5('0x8b'))][(_0xd3c5('0x8c'))]('Unknown\x20channel');}_0x442776=_0x2d6e3b;var _0x4b1d6d={};_0x4b1d6d[_0xd3c5('0x4c')]=_[_0xd3c5('0x4e')](db[_[_0xd3c5('0x9c')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x96')])+'Queue'][_0xd3c5('0x4f')]);_0x4b1d6d[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x3eb772[_0xd3c5('0x39')]);_0x4b1d6d[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x4b1d6d[_0xd3c5('0x4c')],_0x4b1d6d['query']);_0x340d69[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x4b1d6d[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x340d69['attributes']=_0x340d69['attributes']['length']?_0x340d69[_0xd3c5('0x3f')]:_0x4b1d6d[_0xd3c5('0x4c')];_0x340d69['order']=qs[_0xd3c5('0xc5')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x340d69[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x3eb772[_0xd3c5('0x39')],_0x4b1d6d[_0xd3c5('0x50')]));if(_0x3eb772[_0xd3c5('0x39')]['filter']){_0x340d69[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x340d69['where'],{'$or':_[_0xd3c5('0x34')](_0x340d69[_0xd3c5('0x3f')],function(_0x3ad70f){var _0x5e41b9={};_0x5e41b9[_0x3ad70f]={'$like':'%'+_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x5e41b9;})});}_0x340d69=_[_0xd3c5('0x53')]({},_0x340d69,_0x3eb772[_0xd3c5('0xc7')]);switch(_0x442776['role']){case _0xd3c5('0x24'):return db[_['capitalize'](_0x3eb772[_0xd3c5('0x39')]['channel'])+_0xd3c5('0xcf')][_0xd3c5('0x83')](_0x340d69);case _0xd3c5('0x26'):case'agent':return _0x442776['get'+_['capitalize'](_0x3eb772['query']['channel'])+_0xd3c5('0xa9')](_0x340d69);default:throw new db['Sequelize'][(_0xd3c5('0x8c'))](_0xd3c5('0xd0'));}})['then'](function(_0xf9c932){_0x35a642=_0xf9c932[_0xd3c5('0x43')];if(!_0x3eb772[_0xd3c5('0x39')]['hasOwnProperty'](_0xd3c5('0xcd'))){_0x340d69[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x3eb772['query']['limit']);_0x340d69['offset']=qs[_0xd3c5('0x1b')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}switch(_0x442776['role']){case'admin':return db[_[_0xd3c5('0x9c')](_0x3eb772[_0xd3c5('0x39')]['channel'])+'Queue'][_0xd3c5('0x83')](_0x340d69);case _0xd3c5('0x26'):case _0xd3c5('0x28'):return _0x442776[_0xd3c5('0x23')+_[_0xd3c5('0x9c')](_0x3eb772[_0xd3c5('0x39')][_0xd3c5('0x96')])+_0xd3c5('0xa9')](_0x340d69);}})['then'](function(_0x22d3bb){return{'count':_0x35a642,'rows':_0x22d3bb};})['then'](respondWithResult(_0x1b71d8,null))['catch'](handleError(_0x1b71d8,null));};exports[_0xd3c5('0xd1')]=function(_0x516181,_0x5424e3){var _0x3aabc0={};var _0x6e7e75={};var _0x282787;var _0x45127e;return db['User']['findOne']({'where':{'id':_0x516181[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x5424e3,null))[_0xd3c5('0x11')](function(_0x236a9b){if(_0x236a9b){_0x282787=_0x236a9b;_0x6e7e75['model']=_['keys'](db[_0xd3c5('0xa6')][_0xd3c5('0x4f')]);_0x6e7e75[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x516181['query']);_0x6e7e75['filters']=_['intersection'](_0x6e7e75[_0xd3c5('0x4c')],_0x6e7e75[_0xd3c5('0x39')]);_0x3aabc0['attributes']=_['intersection'](_0x6e7e75['model'],qs['fields'](_0x516181[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x3aabc0['attributes']=_0x3aabc0[_0xd3c5('0x3f')]['length']?_0x3aabc0[_0xd3c5('0x3f')]:_0x6e7e75[_0xd3c5('0x4c')];_0x3aabc0[_0xd3c5('0xc4')]=qs['sort'](_0x516181[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x3aabc0[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x516181[_0xd3c5('0x39')],_0x6e7e75[_0xd3c5('0x50')]));if(_0x516181[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x3aabc0[_0xd3c5('0x38')]=_['merge'](_0x3aabc0[_0xd3c5('0x38')],{'$or':_['map'](_0x3aabc0[_0xd3c5('0x3f')],function(_0x154664){var _0x15cc43={};_0x15cc43[_0x154664]={'$like':'%'+_0x516181[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x15cc43;})});}_0x3aabc0=_['merge']({},_0x3aabc0,_0x516181['options']);return _0x282787[_0xd3c5('0xd1')](_0x3aabc0);}})[_0xd3c5('0x11')](function(_0xf259ef){if(_0xf259ef){_0x45127e=_0xf259ef[_0xd3c5('0x43')];if(!_0x516181[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x3aabc0[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x516181[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x3aabc0[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x516181['query']['offset']);}return _0x282787['getVoiceQueuesRt'](_0x3aabc0);}})[_0xd3c5('0x11')](function(_0x39380f){if(_0x39380f){return _0x39380f?{'count':_0x45127e,'rows':_0x39380f}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x5424e3,null))[_0xd3c5('0x49')](handleError(_0x5424e3,null));};exports[_0xd3c5('0xd2')]=function(_0x48d985,_0x16135a){var _0x305e13={};var _0x3090e3={};var _0x45fb51;var _0x4ac7b1;return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x48d985[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x16135a,null))[_0xd3c5('0x11')](function(_0x4f84d4){if(_0x4f84d4){_0x45fb51=_0x4f84d4;_0x3090e3['model']=_[_0xd3c5('0x4e')](db[_0xd3c5('0xd3')][_0xd3c5('0x4f')]);_0x3090e3[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x48d985[_0xd3c5('0x39')]);_0x3090e3['filters']=_[_0xd3c5('0x51')](_0x3090e3[_0xd3c5('0x4c')],_0x3090e3[_0xd3c5('0x39')]);_0x305e13[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x3090e3[_0xd3c5('0x4c')],qs['fields'](_0x48d985['query'][_0xd3c5('0x52')]));_0x305e13['attributes']=_0x305e13[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x305e13[_0xd3c5('0x3f')]:_0x3090e3[_0xd3c5('0x4c')];_0x305e13[_0xd3c5('0xc4')]=qs['sort'](_0x48d985[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x305e13[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x48d985[_0xd3c5('0x39')],_0x3090e3[_0xd3c5('0x50')]));if(_0x48d985['query'][_0xd3c5('0x2b')]){_0x305e13[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x305e13[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x305e13[_0xd3c5('0x3f')],function(_0xf6d638){var _0x507cc6={};_0x507cc6[_0xf6d638]={'$like':'%'+_0x48d985[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x507cc6;})});}_0x305e13=_[_0xd3c5('0x53')]({},_0x305e13,_0x48d985['options']);return _0x45fb51[_0xd3c5('0xd2')](_0x305e13);}})[_0xd3c5('0x11')](function(_0x40a903){if(_0x40a903){_0x4ac7b1=_0x40a903[_0xd3c5('0x43')];if(!_0x48d985[_0xd3c5('0x39')][_0xd3c5('0xcc')]('nolimit')){_0x305e13['limit']=qs[_0xd3c5('0x1d')](_0x48d985[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x305e13[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x48d985[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x45fb51['getGroups'](_0x305e13);}})['then'](function(_0x2643f2){if(_0x2643f2){return _0x2643f2?{'count':_0x4ac7b1,'rows':_0x2643f2}:null;}})['then'](respondWithResult(_0x16135a,null))[_0xd3c5('0x49')](handleError(_0x16135a,null));};exports[_0xd3c5('0xd4')]=function(_0x74b0f9,_0xa026d9){var _0x532222={'raw':!![],'where':{}};var _0x1ea3d5={};var _0x477777={'count':0x0,'rows':[]};return db['User'][_0xd3c5('0x8f')]({'where':{'id':_0x74b0f9[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0xa026d9,null))[_0xd3c5('0x11')](function(_0x30ddd8){if(_0x30ddd8){_0x1ea3d5[_0xd3c5('0x4c')]=_['keys'](db[_0xd3c5('0xd5')][_0xd3c5('0x4f')]);_0x1ea3d5[_0xd3c5('0x39')]=_['keys'](_0x74b0f9[_0xd3c5('0x39')]);_0x1ea3d5['filters']=_[_0xd3c5('0x51')](_0x1ea3d5[_0xd3c5('0x4c')],_0x1ea3d5['query']);_0x532222[_0xd3c5('0x3f')]=_['intersection'](_0x1ea3d5['model'],qs['fields'](_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x532222[_0xd3c5('0x3f')]=_0x532222[_0xd3c5('0x3f')]['length']?_0x532222['attributes']:_0x1ea3d5[_0xd3c5('0x4c')];if(!_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x532222[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x532222[_0xd3c5('0x1b')]=qs['offset'](_0x74b0f9['query'][_0xd3c5('0x1b')]);}_0x532222[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x532222[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x74b0f9[_0xd3c5('0x39')],_0x1ea3d5[_0xd3c5('0x50')]));_0x532222[_0xd3c5('0x38')][_0xd3c5('0xd6')]=_0x30ddd8['id'];if(_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x532222[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x532222['where'],{'$or':_[_0xd3c5('0x34')](_0x532222['attributes'],function(_0x26ec29){var _0x55efcc={};_0x55efcc[_0x26ec29]={'$like':'%'+_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x55efcc;})});}_0x532222=_['merge']({},_0x532222,_0x74b0f9[_0xd3c5('0xc7')]);return db[_0xd3c5('0xd5')][_0xd3c5('0x1e')]({'where':_0x532222[_0xd3c5('0x38')]})[_0xd3c5('0x11')](function(_0x1eb28a){_0x477777[_0xd3c5('0x1e')]=_0x1eb28a;if(_0x74b0f9[_0xd3c5('0x39')][_0xd3c5('0x3a')]){_0x532222[_0xd3c5('0x3d')]=[{'all':!![]}];}return db[_0xd3c5('0xd5')][_0xd3c5('0x83')](_0x532222);})[_0xd3c5('0x11')](function(_0x4b09b8){_0x477777['rows']=_0x4b09b8;return _0x477777;});}})[_0xd3c5('0x11')](respondWithFilteredResult(_0xa026d9,_0x532222))[_0xd3c5('0x49')](handleError(_0xa026d9,null));};exports['getScreenRecordings']=function(_0x4eae95,_0x38d221){var _0x1d500d={'raw':!![],'where':{}};var _0x51844b={};var _0xbbc0e8={'count':0x0,'rows':[]};return db[_0xd3c5('0x33')]['findOne']({'where':{'id':_0x4eae95['params']['id']}})['then'](handleEntityNotFound(_0x38d221,null))[_0xd3c5('0x11')](function(_0x3d735a){if(_0x3d735a){_0x51844b[_0xd3c5('0x4c')]=_['keys'](db[_0xd3c5('0xd7')][_0xd3c5('0x4f')]);_0x51844b[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x4eae95[_0xd3c5('0x39')]);_0x51844b[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x51844b['model'],_0x51844b[_0xd3c5('0x39')]);_0x1d500d[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x51844b['model'],qs[_0xd3c5('0x52')](_0x4eae95[_0xd3c5('0x39')]['fields']));_0x1d500d[_0xd3c5('0x3f')]=_0x1d500d[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x1d500d[_0xd3c5('0x3f')]:_0x51844b[_0xd3c5('0x4c')];if(!_0x4eae95[_0xd3c5('0x39')][_0xd3c5('0xcc')]('nolimit')){_0x1d500d[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x4eae95[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x1d500d['offset']=qs[_0xd3c5('0x1b')](_0x4eae95[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}_0x1d500d[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x4eae95['query'][_0xd3c5('0xc5')]);_0x1d500d[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x4eae95[_0xd3c5('0x39')],_0x51844b[_0xd3c5('0x50')]));_0x1d500d[_0xd3c5('0x38')][_0xd3c5('0xd6')]=_0x3d735a['id'];if(_0x4eae95[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x1d500d[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x1d500d[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x1d500d[_0xd3c5('0x3f')],function(_0x33515e){var _0x38c635={};_0x38c635[_0x33515e]={'$like':'%'+_0x4eae95[_0xd3c5('0x39')]['filter']+'%'};return _0x38c635;})});}_0x1d500d=_[_0xd3c5('0x53')]({},_0x1d500d,_0x4eae95[_0xd3c5('0xc7')]);return db[_0xd3c5('0xd7')][_0xd3c5('0x1e')]({'where':_0x1d500d[_0xd3c5('0x38')]})[_0xd3c5('0x11')](function(_0x2e84bd){_0xbbc0e8[_0xd3c5('0x1e')]=_0x2e84bd;if(_0x4eae95[_0xd3c5('0x39')]['includeAll']){_0x1d500d['include']=[{'all':!![]}];}return db[_0xd3c5('0xd7')]['findAll'](_0x1d500d);})['then'](function(_0x24cfe7){_0xbbc0e8[_0xd3c5('0x41')]=_0x24cfe7;return _0xbbc0e8;});}})[_0xd3c5('0x11')](respondWithFilteredResult(_0x38d221,_0x1d500d))[_0xd3c5('0x49')](handleError(_0x38d221,null));};exports[_0xd3c5('0xd8')]=function(_0x48b465,_0x41b356){var _0x2119b9={};var _0xdb467f={};var _0x53858e;var _0x2372fb;return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x48b465[_0xd3c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41b356,null))[_0xd3c5('0x11')](function(_0x3652de){if(_0x3652de){_0x53858e=_0x3652de;_0xdb467f[_0xd3c5('0x4c')]=_[_0xd3c5('0x4e')](db[_0xd3c5('0xd9')][_0xd3c5('0x4f')]);_0xdb467f[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x48b465[_0xd3c5('0x39')]);_0xdb467f[_0xd3c5('0x50')]=_['intersection'](_0xdb467f[_0xd3c5('0x4c')],_0xdb467f[_0xd3c5('0x39')]);_0x2119b9[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0xdb467f[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x48b465['query'][_0xd3c5('0x52')]));_0x2119b9[_0xd3c5('0x3f')]=_0x2119b9['attributes'][_0xd3c5('0x43')]?_0x2119b9['attributes']:_0xdb467f['model'];_0x2119b9[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x48b465[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x2119b9[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_['pick'](_0x48b465[_0xd3c5('0x39')],_0xdb467f['filters']));if(_0x48b465[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x2119b9[_0xd3c5('0x38')]=_['merge'](_0x2119b9[_0xd3c5('0x38')],{'$or':_['map'](_0x2119b9[_0xd3c5('0x3f')],function(_0x52cf43){var _0x429aec={};_0x429aec[_0x52cf43]={'$like':'%'+_0x48b465[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x429aec;})});}_0x2119b9=_['merge']({},_0x2119b9,_0x48b465[_0xd3c5('0xc7')]);return _0x53858e['getChatInteractions'](_0x2119b9);}})[_0xd3c5('0x11')](function(_0x1aaba3){if(_0x1aaba3){_0x2372fb=_0x1aaba3[_0xd3c5('0x43')];if(!_0x48b465[_0xd3c5('0x39')]['hasOwnProperty']('nolimit')){_0x2119b9['limit']=qs[_0xd3c5('0x1d')](_0x48b465[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x2119b9[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x48b465[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x53858e[_0xd3c5('0xd8')](_0x2119b9);}})[_0xd3c5('0x11')](function(_0x4deb94){if(_0x4deb94){return _0x4deb94?{'count':_0x2372fb,'rows':_0x4deb94}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x41b356,null))[_0xd3c5('0x49')](handleError(_0x41b356,null));};exports[_0xd3c5('0xda')]=function(_0x23e216,_0x3bab85){var _0x4e79d6={};var _0x2b1eb9={};var _0x4075d9;var _0x1c3e78;return db['User'][_0xd3c5('0x8f')]({'where':{'id':_0x23e216[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x3bab85,null))['then'](function(_0x5ad3fc){if(_0x5ad3fc){_0x4075d9=_0x5ad3fc;_0x2b1eb9[_0xd3c5('0x4c')]=_[_0xd3c5('0x4e')](db[_0xd3c5('0xdb')][_0xd3c5('0x4f')]);_0x2b1eb9['query']=_[_0xd3c5('0x4e')](_0x23e216[_0xd3c5('0x39')]);_0x2b1eb9[_0xd3c5('0x50')]=_['intersection'](_0x2b1eb9[_0xd3c5('0x4c')],_0x2b1eb9['query']);_0x4e79d6[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x2b1eb9[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x23e216['query']['fields']));_0x4e79d6[_0xd3c5('0x3f')]=_0x4e79d6['attributes']['length']?_0x4e79d6[_0xd3c5('0x3f')]:_0x2b1eb9['model'];_0x4e79d6[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x23e216[_0xd3c5('0x39')]['sort']);_0x4e79d6[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x23e216[_0xd3c5('0x39')],_0x2b1eb9[_0xd3c5('0x50')]));if(_0x23e216[_0xd3c5('0x39')]['filter']){_0x4e79d6[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x4e79d6[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x4e79d6[_0xd3c5('0x3f')],function(_0x42397){var _0x276636={};_0x276636[_0x42397]={'$like':'%'+_0x23e216[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x276636;})});}_0x4e79d6=_['merge']({},_0x4e79d6,_0x23e216[_0xd3c5('0xc7')]);return _0x4075d9['getOpenchannelInteractions'](_0x4e79d6);}})[_0xd3c5('0x11')](function(_0x45334b){if(_0x45334b){_0x1c3e78=_0x45334b[_0xd3c5('0x43')];if(!_0x23e216['query']['hasOwnProperty'](_0xd3c5('0xcd'))){_0x4e79d6[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x23e216[_0xd3c5('0x39')]['limit']);_0x4e79d6['offset']=qs[_0xd3c5('0x1b')](_0x23e216[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x4075d9[_0xd3c5('0xda')](_0x4e79d6);}})[_0xd3c5('0x11')](function(_0x45f92f){if(_0x45f92f){return _0x45f92f?{'count':_0x1c3e78,'rows':_0x45f92f}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x3bab85,null))['catch'](handleError(_0x3bab85,null));};exports['getMailInteractions']=function(_0x7d783,_0x4586a2){var _0x3e3e2e={'raw':!![],'where':{}};var _0x33f73e={};var _0x31939b={'count':0x0,'rows':[]};return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x7d783['params']['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x4586a2,null))['then'](function(_0x5b61c2){if(_0x5b61c2){_0x33f73e['model']=_['keys'](db['MailInteraction'][_0xd3c5('0x4f')]);_0x33f73e[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x7d783[_0xd3c5('0x39')]);_0x33f73e[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x33f73e[_0xd3c5('0x4c')],_0x33f73e[_0xd3c5('0x39')]);_0x3e3e2e[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x33f73e['model'],qs[_0xd3c5('0x52')](_0x7d783[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x3e3e2e[_0xd3c5('0x3f')]=_0x3e3e2e[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x3e3e2e['attributes']:_0x33f73e[_0xd3c5('0x4c')];if(!_0x7d783[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x3e3e2e[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x7d783['query']['limit']);_0x3e3e2e['offset']=qs[_0xd3c5('0x1b')](_0x7d783['query'][_0xd3c5('0x1b')]);}_0x3e3e2e[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x7d783[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x3e3e2e[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_['pick'](_0x7d783[_0xd3c5('0x39')],_0x33f73e[_0xd3c5('0x50')]));_0x3e3e2e[_0xd3c5('0x38')][_0xd3c5('0xd6')]=_0x5b61c2['id'];if(_0x7d783[_0xd3c5('0x39')]['filter']){_0x3e3e2e[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x3e3e2e[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x3e3e2e[_0xd3c5('0x3f')],function(_0xd8eba7){var _0x561a2a={};_0x561a2a[_0xd8eba7]={'$like':'%'+_0x7d783[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x561a2a;})});}_0x3e3e2e=_[_0xd3c5('0x53')]({},_0x3e3e2e,_0x7d783[_0xd3c5('0xc7')]);return db[_0xd3c5('0xdc')][_0xd3c5('0x1e')]({'where':_0x3e3e2e[_0xd3c5('0x38')]})[_0xd3c5('0x11')](function(_0x8318b1){_0x31939b[_0xd3c5('0x1e')]=_0x8318b1;if(_0x7d783[_0xd3c5('0x39')][_0xd3c5('0x3a')]){_0x3e3e2e['include']=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x3e3e2e);})[_0xd3c5('0x11')](function(_0x1756db){_0x31939b['rows']=_0x1756db;return _0x31939b;});}})[_0xd3c5('0x11')](respondWithFilteredResult(_0x4586a2,_0x3e3e2e))['catch'](handleError(_0x4586a2,null));};exports[_0xd3c5('0xdd')]=function(_0x5bbb33,_0x59f597){var _0x1db42c={};var _0x202621={};var _0x5dbb7b;var _0x25d6f3;return db[_0xd3c5('0x33')]['findOne']({'where':{'id':_0x5bbb33[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x59f597,null))['then'](function(_0x4df10d){if(_0x4df10d){_0x5dbb7b=_0x4df10d;_0x202621['model']=_['keys'](db[_0xd3c5('0xde')][_0xd3c5('0x4f')]);_0x202621['query']=_[_0xd3c5('0x4e')](_0x5bbb33[_0xd3c5('0x39')]);_0x202621[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x202621[_0xd3c5('0x4c')],_0x202621['query']);_0x1db42c['attributes']=_[_0xd3c5('0x51')](_0x202621[_0xd3c5('0x4c')],qs['fields'](_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x1db42c[_0xd3c5('0x3f')]=_0x1db42c[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x1db42c[_0xd3c5('0x3f')]:_0x202621['model'];_0x1db42c[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x5bbb33[_0xd3c5('0x39')]['sort']);_0x1db42c[_0xd3c5('0x38')]=qs['filters'](_[_0xd3c5('0xc6')](_0x5bbb33['query'],_0x202621[_0xd3c5('0x50')]));if(_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x1db42c['where']=_[_0xd3c5('0x53')](_0x1db42c[_0xd3c5('0x38')],{'$or':_['map'](_0x1db42c[_0xd3c5('0x3f')],function(_0x2ecaff){var _0x502692={};_0x502692[_0x2ecaff]={'$like':'%'+_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x502692;})});}_0x1db42c=_[_0xd3c5('0x53')]({},_0x1db42c,_0x5bbb33[_0xd3c5('0xc7')]);return _0x5dbb7b['getSmsInteractions'](_0x1db42c);}})[_0xd3c5('0x11')](function(_0x496a56){if(_0x496a56){_0x25d6f3=_0x496a56[_0xd3c5('0x43')];if(!_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x1db42c[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x1db42c[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x5bbb33[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x5dbb7b[_0xd3c5('0xdd')](_0x1db42c);}})[_0xd3c5('0x11')](function(_0x4c1488){if(_0x4c1488){return _0x4c1488?{'count':_0x25d6f3,'rows':_0x4c1488}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x59f597,null))[_0xd3c5('0x49')](handleError(_0x59f597,null));};exports[_0xd3c5('0xdf')]=function(_0x40a7bb,_0x4bea15){var _0x23c7aa={};var _0x1b2d28={};var _0x3fa52f;var _0x460515;return db[_0xd3c5('0x33')]['findOne']({'where':{'id':_0x40a7bb['params']['id']}})['then'](handleEntityNotFound(_0x4bea15,null))['then'](function(_0x3a2a96){if(_0x3a2a96){_0x3fa52f=_0x3a2a96;_0x1b2d28[_0xd3c5('0x4c')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x1b2d28[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x40a7bb[_0xd3c5('0x39')]);_0x1b2d28['filters']=_[_0xd3c5('0x51')](_0x1b2d28[_0xd3c5('0x4c')],_0x1b2d28[_0xd3c5('0x39')]);_0x23c7aa['attributes']=_[_0xd3c5('0x51')](_0x1b2d28[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x40a7bb[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x23c7aa['attributes']=_0x23c7aa[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x23c7aa[_0xd3c5('0x3f')]:_0x1b2d28[_0xd3c5('0x4c')];_0x23c7aa[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x40a7bb[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x23c7aa[_0xd3c5('0x38')]=qs[_0xd3c5('0x50')](_['pick'](_0x40a7bb[_0xd3c5('0x39')],_0x1b2d28['filters']));if(_0x40a7bb[_0xd3c5('0x39')]['filter']){_0x23c7aa[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x23c7aa[_0xd3c5('0x38')],{'$or':_['map'](_0x23c7aa[_0xd3c5('0x3f')],function(_0x29f85a){var _0x174416={};_0x174416[_0x29f85a]={'$like':'%'+_0x40a7bb[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x174416;})});}_0x23c7aa=_[_0xd3c5('0x53')]({},_0x23c7aa,_0x40a7bb[_0xd3c5('0xc7')]);return _0x3fa52f[_0xd3c5('0xdf')](_0x23c7aa);}})[_0xd3c5('0x11')](function(_0x201509){if(_0x201509){_0x460515=_0x201509[_0xd3c5('0x43')];if(!_0x40a7bb[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x23c7aa[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x40a7bb[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x23c7aa['offset']=qs[_0xd3c5('0x1b')](_0x40a7bb[_0xd3c5('0x39')]['offset']);}return _0x3fa52f[_0xd3c5('0xdf')](_0x23c7aa);}})[_0xd3c5('0x11')](function(_0x38e9a1){if(_0x38e9a1){return _0x38e9a1?{'count':_0x460515,'rows':_0x38e9a1}:null;}})['then'](respondWithResult(_0x4bea15,null))[_0xd3c5('0x49')](handleError(_0x4bea15,null));};exports['getWhatsappInteractions']=function(_0x22f2d5,_0x5afc44){var _0x53d81a={};var _0xdca516={};var _0x72f157;var _0x1706ec;return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x22f2d5[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x5afc44,null))[_0xd3c5('0x11')](function(_0x11556a){if(_0x11556a){_0x72f157=_0x11556a;_0xdca516[_0xd3c5('0x4c')]=_['keys'](db[_0xd3c5('0xe0')][_0xd3c5('0x4f')]);_0xdca516['query']=_[_0xd3c5('0x4e')](_0x22f2d5['query']);_0xdca516[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0xdca516[_0xd3c5('0x4c')],_0xdca516[_0xd3c5('0x39')]);_0x53d81a['attributes']=_['intersection'](_0xdca516[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x22f2d5[_0xd3c5('0x39')]['fields']));_0x53d81a[_0xd3c5('0x3f')]=_0x53d81a[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x53d81a[_0xd3c5('0x3f')]:_0xdca516[_0xd3c5('0x4c')];_0x53d81a['order']=qs[_0xd3c5('0xc5')](_0x22f2d5['query'][_0xd3c5('0xc5')]);_0x53d81a['where']=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x22f2d5[_0xd3c5('0x39')],_0xdca516[_0xd3c5('0x50')]));if(_0x22f2d5[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x53d81a['where']=_[_0xd3c5('0x53')](_0x53d81a[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x53d81a[_0xd3c5('0x3f')],function(_0x1b98c9){var _0x1b9fb9={};_0x1b9fb9[_0x1b98c9]={'$like':'%'+_0x22f2d5[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x1b9fb9;})});}_0x53d81a=_['merge']({},_0x53d81a,_0x22f2d5[_0xd3c5('0xc7')]);return _0x72f157['getWhatsappInteractions'](_0x53d81a);}})[_0xd3c5('0x11')](function(_0x96acd1){if(_0x96acd1){_0x1706ec=_0x96acd1[_0xd3c5('0x43')];if(!_0x22f2d5['query'][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x53d81a[_0xd3c5('0x1d')]=qs['limit'](_0x22f2d5[_0xd3c5('0x39')]['limit']);_0x53d81a[_0xd3c5('0x1b')]=qs['offset'](_0x22f2d5[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x72f157[_0xd3c5('0xe1')](_0x53d81a);}})['then'](function(_0x570535){if(_0x570535){return _0x570535?{'count':_0x1706ec,'rows':_0x570535}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x5afc44,null))[_0xd3c5('0x49')](handleError(_0x5afc44,null));};exports[_0xd3c5('0xe2')]=function(_0x4dccce,_0x109331,_0x2ef6b8){var _0x2445e1;var _0x112049;var _0x458c8d;var _0x1a06a0=!_[_0xd3c5('0x61')](_0x4dccce[_0xd3c5('0x4b')]['id'])?_0x4dccce[_0xd3c5('0x4b')]['id']:!_[_0xd3c5('0x61')](_0x4dccce[_0xd3c5('0x26')]['id'])?_0x4dccce[_0xd3c5('0x26')]['id']:null;return db[_0xd3c5('0x33')][_0xd3c5('0x2f')]({'where':{'id':_0x1a06a0,'role':{'$or':[_0xd3c5('0x24'),_0xd3c5('0x26'),_0xd3c5('0x28')]}},'attributes':['id',_0xd3c5('0x30'),'phone',_0xd3c5('0xe3'),_0xd3c5('0x2e'),_0xd3c5('0x60'),_0xd3c5('0x97')]})[_0xd3c5('0x11')](function(_0x22a889){if(_0x22a889){if(_0x22a889[_0xd3c5('0x2e')]==='agent'){_0x2445e1=_0x22a889;if(_0x4dccce['body'][_0xd3c5('0x98')]){_0x458c8d=util[_0xd3c5('0xa4')](_0xd3c5('0xe4'),_0x2445e1[_0x4dccce['body'][_0xd3c5('0x98')]]);}else if(_0x4dccce[_0xd3c5('0x57')]['intrf']){_0x458c8d=util[_0xd3c5('0xa4')](_0xd3c5('0xe5'),_0x4dccce[_0xd3c5('0x57')][_0xd3c5('0xe6')]);}else{_0x458c8d=util[_0xd3c5('0xa4')](_0xd3c5('0xe5'),_0x2445e1[_0xd3c5('0x30')]);}socket['to'](util['format'](_0xd3c5('0xe7'),_0x2445e1[_0xd3c5('0x30')]))[_0xd3c5('0xa0')](_0xd3c5('0xe8'),{'user':{'id':_0x2445e1['id'],'name':_0x2445e1[_0xd3c5('0x30')]},'ip':_0x4dccce[_0xd3c5('0xe9')][_0xd3c5('0xea')]||_0x4dccce['connection'][_0xd3c5('0xeb')]||_0x4dccce[_0xd3c5('0xec')]['remoteAddress']||_0x4dccce[_0xd3c5('0xed')][_0xd3c5('0xec')][_0xd3c5('0xeb')]});return db['UserVoiceQueueRt'][_0xd3c5('0x22')]({'where':{'membername':_0x2445e1['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xd3c5('0x8c'))](_0xd3c5('0xee'));}})['then'](function(){if(_0x2445e1){return _0x2445e1[_0xd3c5('0xef')]({'raw':!![]});}})[_0xd3c5('0x11')](function(_0x336dc6){if(_0x2445e1){var _0x3d6d77=[];if(_0x336dc6){_0x112049=_0x336dc6;if(_0x112049[_0xd3c5('0x43')]){for(var _0xe1ac69=0x0;_0xe1ac69<_0x112049[_0xd3c5('0x43')];_0xe1ac69++){_0x3d6d77['push']({'membername':_0x2445e1[_0xd3c5('0x30')],'UserId':_0x2445e1['id'],'queue_name':_0x112049[_0xe1ac69]['name'],'VoiceQueueId':_0x112049[_0xe1ac69]['id'],'interface':_0x458c8d,'paused':_0x2445e1[_0xd3c5('0x97')]||![],'penalty':_0x112049[_0xe1ac69]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xd3c5('0x82')](_0x3d6d77,function(_0x22ff82){return db[_0xd3c5('0xa6')]['upsert'](_0x22ff82);});}}}})[_0xd3c5('0x11')](function(){if(_0x2445e1){return db['MemberReport'][_0xd3c5('0x83')]({'where':{'membername':_0x2445e1['name'],'exitAt':null}});}})[_0xd3c5('0x11')](function(_0x5f428a){if(_0x2445e1){var _0x2d8fcc=[];_0x5f428a[_0xd3c5('0xf0')](function(_0x5f3961){_0x2d8fcc['push'](_0x5f3961['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd3c5('0x56')](_0x2d8fcc);}})['then'](function(){if(_0x2445e1){var _0x400c72=[];var _0x2eb1f5=[];var _0x44d6b5=utils[_0xd3c5('0xf1')]();var _0x424349={'membername':_0x2445e1[_0xd3c5('0x30')],'interface':_0x458c8d,'enterAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2')),'role':_0x2445e1['role'],'internal':_0x2445e1[_0xd3c5('0x60')]};_0x44d6b5[_0xd3c5('0xf0')](function(_0x439dbc){_0x400c72[_0xd3c5('0x40')](_[_0xd3c5('0x53')]({'channel':_0x439dbc,'type':_0xd3c5('0xf3'),'data1':_0x4dccce[_0xd3c5('0x57')]['device'],'data2':_0x458c8d},_0x424349));if(_0x2445e1[_0xd3c5('0x97')]){_0x2eb1f5['push'](_[_0xd3c5('0x53')]({'channel':_0x439dbc,'type':_0xd3c5('0xf4'),'data1':_0xd3c5('0xf5')},_0x424349));}});return db[_0xd3c5('0xf6')][_0xd3c5('0x7e')](_0x400c72[_0xd3c5('0xf7')](_0x2eb1f5),{'individualHooks':!![]});}})[_0xd3c5('0x11')](function(){if(_0x2445e1){return _0x2445e1[_0xd3c5('0x21')]({'online':!![],'lastLoginAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2')),'voicePause':_0x2445e1['loginInPause']||![],'mailPause':_0x2445e1[_0xd3c5('0x97')]||![],'chatPause':_0x2445e1['loginInPause']||![],'faxPause':_0x2445e1[_0xd3c5('0x97')]||![],'smsPause':_0x2445e1['loginInPause']||![],'openchannelPause':_0x2445e1[_0xd3c5('0x97')]||![],'whatsappPause':_0x2445e1[_0xd3c5('0x97')]||![],'pauseType':_0x2445e1['loginInPause']?'LOGININPAUSE':null,'interface':_0x458c8d,'lastPauseAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2'))});}})[_0xd3c5('0x11')](function(_0x1fc7b3){if(_0x4dccce[_0xd3c5('0xf8')]){return _0x2ef6b8();}else{return BPromise['resolve'](_0x1fc7b3)[_0xd3c5('0x11')](respondWithResult(_0x109331,null));}})[_0xd3c5('0x49')](handleError(_0x109331,null));};exports[_0xd3c5('0xf9')]=function(_0x23bbc4,_0x5a76c4){var _0x3fd74c;return db[_0xd3c5('0x33')][_0xd3c5('0x2f')]({'where':{'id':_0x23bbc4[_0xd3c5('0x4b')]['id'],'role':_0xd3c5('0x28')},'attributes':['id',_0xd3c5('0x30'),_0xd3c5('0x2e')]})[_0xd3c5('0x11')](handleEntityNotFound(_0x5a76c4,null))[_0xd3c5('0x11')](function(_0x547dce){if(_0x547dce){_0x3fd74c=_0x547dce;return db[_0xd3c5('0xa6')][_0xd3c5('0x22')]({'where':{'membername':_0x3fd74c[_0xd3c5('0x30')]},'individualHooks':!![]});}})[_0xd3c5('0x11')](function(){return db['MemberReport'][_0xd3c5('0x83')]({'where':{'membername':_0x3fd74c[_0xd3c5('0x30')],'exitAt':null}});})[_0xd3c5('0x11')](function(_0x1a3374){var _0x3309a8=[];_0x1a3374[_0xd3c5('0xf0')](function(_0x932392){_0x3309a8[_0xd3c5('0x40')](_0x932392[_0xd3c5('0x21')]({'exitAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2'))}));});return BPromise['all'](_0x3309a8);})['then'](function(){return _0x3fd74c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd3c5('0x11')](respondWithResult(_0x5a76c4,null))[_0xd3c5('0x49')](handleError(_0x5a76c4,null));};exports[_0xd3c5('0xfa')]=function(_0x17830c,_0x32a69f){var _0x4e0706;return db[_0xd3c5('0xa6')][_0xd3c5('0x21')]({'paused':0x1},{'where':{'UserId':_0x17830c[_0xd3c5('0x4b')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xd3c5('0x33')][_0xd3c5('0x2f')]({'where':{'id':_0x17830c[_0xd3c5('0x4b')]['id'],'role':_0xd3c5('0x28')},'attributes':['id','name',_0xd3c5('0x2e'),_0xd3c5('0x60'),_0xd3c5('0x98')]});})[_0xd3c5('0x11')](handleEntityNotFound(_0x32a69f,null))[_0xd3c5('0x11')](function(_0x5a5a70){if(_0x5a5a70){_0x4e0706=_0x5a5a70;return respondWithRpcPromise(_0xd3c5('0xfb'),_0xd3c5('0xfa'),{'id':_0x4e0706['id'],'name':_0x4e0706['name'],'pause':!![]});}})[_0xd3c5('0x11')](function(){if(_0x4e0706){return db[_0xd3c5('0xf6')][_0xd3c5('0x83')]({'where':{'membername':_0x4e0706[_0xd3c5('0x30')],'type':_0xd3c5('0xf4'),'exitAt':null}});}})['then'](function(_0x4a8d4b){if(_0x4a8d4b[_0xd3c5('0x43')]){var _0xa9454=moment()[_0xd3c5('0xa4')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x191ea8=0x0,_0x11e492=_0x4a8d4b['length'];_0x191ea8<_0x11e492;_0x191ea8++){_0x4a8d4b[_0x191ea8]['updateAttributes']({'exitAt':_0xa9454});}}})[_0xd3c5('0x11')](function(){var _0x560e95=[];var _0x28aece=utils[_0xd3c5('0xf1')]();_0x28aece[_0xd3c5('0xf0')](function(_0x34cfb0){_0x560e95[_0xd3c5('0x40')]({'channel':_0x34cfb0,'membername':_0x4e0706[_0xd3c5('0x30')],'interface':_['isNil'](_0x4e0706[_0xd3c5('0x98')])?util['format'](_0xd3c5('0xe5'),_0x4e0706[_0xd3c5('0x30')]):_0x4e0706['interface'],'type':_0xd3c5('0xf4'),'enterAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2')),'data1':_0x17830c[_0xd3c5('0x57')][_0xd3c5('0xfc')]||'DEFAULT\x20PAUSE','role':_0x4e0706[_0xd3c5('0x2e')],'internal':_0x4e0706['internal']});});return db[_0xd3c5('0xf6')][_0xd3c5('0x7e')](_0x560e95,{'individualHooks':!![]});})[_0xd3c5('0x11')](function(){return _0x4e0706[_0xd3c5('0x21')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x17830c['body'][_0xd3c5('0xfc')]||_0xd3c5('0xfd'),'lastPauseAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2'))});})[_0xd3c5('0x11')](respondWithResult(_0x32a69f,null))[_0xd3c5('0x49')](handleError(_0x32a69f,null));};exports[_0xd3c5('0xfe')]=function(_0x13bb83,_0x2da83e){var _0x281cbb;return db[_0xd3c5('0x33')][_0xd3c5('0x2f')]({'where':{'id':_0x13bb83[_0xd3c5('0x4b')]['id']},'attributes':['id','name',_0xd3c5('0x2e'),_0xd3c5('0xa5'),'mailPause','chatPause',_0xd3c5('0xff'),_0xd3c5('0x100'),_0xd3c5('0x101'),'whatsapppause','pauseType',_0xd3c5('0x102')]})[_0xd3c5('0x11')](handleEntityNotFound(_0x2da83e,null))[_0xd3c5('0x11')](function(_0x3a77bc){if(_0x3a77bc){_0x281cbb=_0x3a77bc;if(_0x13bb83[_0xd3c5('0x57')][_0xd3c5('0x96')]&&!utils['isValidChannel'](_0x13bb83[_0xd3c5('0x57')][_0xd3c5('0x96')])){throw new db['Sequelize']['ValidationError'](_0xd3c5('0x9a'));}switch(_0x13bb83['body'][_0xd3c5('0x96')]){case _0xd3c5('0xa1'):return respondWithRpcPromise(_0xd3c5('0xfb'),_0xd3c5('0xfe'),{'id':_0x281cbb['id'],'name':_0x281cbb[_0xd3c5('0x30')],'pause':![]})[_0xd3c5('0x11')](function(){return db[_0xd3c5('0xa6')]['update']({'paused':0x0},{'where':{'UserId':_0x281cbb['id']},'individualHooks':!![]});})['then'](function(){return db[_0xd3c5('0xf6')][_0xd3c5('0x2f')]({'where':{'channel':_0x13bb83['body']['channel'],'membername':_0x281cbb[_0xd3c5('0x30')],'type':_0xd3c5('0xf4'),'exitAt':null}});})[_0xd3c5('0x11')](function(_0x2f655b){if(_0x2f655b){return _0x2f655b[_0xd3c5('0x21')]({'exitAt':moment()['format'](_0xd3c5('0xf2')),'data2':_0xd3c5('0x103')},{'individualHooks':!![]});}return null;})[_0xd3c5('0x11')](function(){return _0x281cbb[_0xd3c5('0x21')]({'voicePause':![]});});case _0xd3c5('0x47'):case'chat':case _0xd3c5('0x55'):case _0xd3c5('0x46'):case _0xd3c5('0xb8'):case _0xd3c5('0x48'):return db[_0xd3c5('0xf6')][_0xd3c5('0x2f')]({'where':{'channel':_0x13bb83[_0xd3c5('0x57')][_0xd3c5('0x96')],'membername':_0x281cbb[_0xd3c5('0x30')],'type':'PAUSE','exitAt':null}})[_0xd3c5('0x11')](function(_0xa8ae87){if(_0xa8ae87){return _0xa8ae87[_0xd3c5('0x21')]({'exitAt':moment()[_0xd3c5('0xa4')](_0xd3c5('0xf2')),'data2':_0xd3c5('0x103')},{'individualHooks':!![]});}return null;})[_0xd3c5('0x11')](function(){var _0x18e8f7={};_[_0xd3c5('0x104')](_0x18e8f7,util[_0xd3c5('0xa4')]('%s%s',_0x13bb83['body'][_0xd3c5('0x96')],_0xd3c5('0x105')),![]);return _0x281cbb['update'](_0x18e8f7);});default:return respondWithRpcPromise(_0xd3c5('0xfb'),_0xd3c5('0xfe'),{'id':_0x281cbb['id'],'name':_0x281cbb[_0xd3c5('0x30')],'pause':![]})[_0xd3c5('0x11')](function(){return db[_0xd3c5('0xa6')][_0xd3c5('0x21')]({'paused':0x0},{'where':{'UserId':_0x281cbb['id']}});})[_0xd3c5('0x11')](function(){return db[_0xd3c5('0xf6')][_0xd3c5('0x83')]({'where':{'membername':_0x281cbb[_0xd3c5('0x30')],'type':'PAUSE','exitAt':null}});})[_0xd3c5('0x11')](function(_0x31e51d){var _0x1e71cb=[];_0x31e51d['forEach'](function(_0xc94204){_0x1e71cb[_0xd3c5('0x40')](_0xc94204[_0xd3c5('0x21')]({'exitAt':moment()['format'](_0xd3c5('0xf2')),'data2':_0xd3c5('0x103')}));});return BPromise[_0xd3c5('0x56')](_0x1e71cb);})['then'](function(){return _0x281cbb[_0xd3c5('0x21')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xd3c5('0x11')](respondWithResult(_0x2da83e,null))['catch'](handleError(_0x2da83e,null));};exports[_0xd3c5('0x106')]=function(_0x5591e7,_0x1cfbf0){var _0x46f185={};var _0x3a7d74={};var _0x8f7910;var _0x4a20e6;return db['User'][_0xd3c5('0x8f')]({'where':{'id':_0x5591e7[_0xd3c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cfbf0,null))[_0xd3c5('0x11')](function(_0xa98ef7){if(_0xa98ef7){_0x8f7910=_0xa98ef7;_0x3a7d74[_0xd3c5('0x4c')]=_[_0xd3c5('0x4e')](db['Team'][_0xd3c5('0x4f')]);_0x3a7d74[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x5591e7[_0xd3c5('0x39')]);_0x3a7d74[_0xd3c5('0x50')]=_[_0xd3c5('0x51')](_0x3a7d74[_0xd3c5('0x4c')],_0x3a7d74[_0xd3c5('0x39')]);_0x46f185[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x3a7d74[_0xd3c5('0x4c')],qs['fields'](_0x5591e7[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x46f185[_0xd3c5('0x3f')]=_0x46f185[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x46f185[_0xd3c5('0x3f')]:_0x3a7d74[_0xd3c5('0x4c')];_0x46f185[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x5591e7['query'][_0xd3c5('0xc5')]);_0x46f185[_0xd3c5('0x38')]=qs['filters'](_['pick'](_0x5591e7[_0xd3c5('0x39')],_0x3a7d74[_0xd3c5('0x50')]));if(_0x5591e7[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x46f185['where']=_[_0xd3c5('0x53')](_0x46f185[_0xd3c5('0x38')],{'$or':_['map'](_0x46f185['attributes'],function(_0xac164){var _0x4a827a={};_0x4a827a[_0xac164]={'$like':'%'+_0x5591e7['query']['filter']+'%'};return _0x4a827a;})});}_0x46f185=_[_0xd3c5('0x53')]({},_0x46f185,_0x5591e7[_0xd3c5('0xc7')]);return _0x8f7910[_0xd3c5('0x106')](_0x46f185);}})['then'](function(_0x37d0a3){if(_0x37d0a3){_0x4a20e6=_0x37d0a3[_0xd3c5('0x43')];if(!_0x5591e7[_0xd3c5('0x39')][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x46f185[_0xd3c5('0x1d')]=qs['limit'](_0x5591e7[_0xd3c5('0x39')][_0xd3c5('0x1d')]);_0x46f185[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x5591e7[_0xd3c5('0x39')]['offset']);}return _0x8f7910[_0xd3c5('0x106')](_0x46f185);}})[_0xd3c5('0x11')](function(_0x2e93ae){if(_0x2e93ae){return _0x2e93ae?{'count':_0x4a20e6,'rows':_0x2e93ae}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x1cfbf0,null))['catch'](handleError(_0x1cfbf0,null));};exports[_0xd3c5('0x107')]=function(_0x4a5086,_0x42ff5f){return db[_0xd3c5('0x33')][_0xd3c5('0x2f')]({'where':{'id':_0x4a5086[_0xd3c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42ff5f,null))['then'](function(_0x22677d){if(_0x22677d){var _0x1ec53a=_0x22677d[_0xd3c5('0x23')]({'plain':!![]});return _0x22677d[_0xd3c5('0x107')](_0x4a5086[_0xd3c5('0x57')][_0xd3c5('0x5a')],_[_0xd3c5('0x5b')](_0x4a5086[_0xd3c5('0x57')],[_0xd3c5('0x5a'),'id'])||{})[_0xd3c5('0x11')](function(){for(var _0x7f8d4f=0x0;_0x7f8d4f<_0x4a5086['body'][_0xd3c5('0x5a')]['length'];_0x7f8d4f++){var _0x3535bd=[];var _0x1ac113={};db[_0xd3c5('0x108')][_0xd3c5('0x8f')]({'where':{'id':_0x4a5086['body'][_0xd3c5('0x5a')][_0x7f8d4f]}})[_0xd3c5('0x11')](function(_0xd2f28c){_0x1ac113=_0xd2f28c[_0xd3c5('0x45')];_0x3535bd['push'](_0xd2f28c[_0xd3c5('0xef')]()[_0xd3c5('0x11')](function(_0x39d916){for(var _0x55e47=0x0;_0x55e47<_0x39d916['length'];_0x55e47++){_0x39d916[_0x55e47][_0xd3c5('0x109')](_0xd3c5('0x96'),'Voice');}return _0x39d916;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x10a')]()[_0xd3c5('0x11')](function(_0x4a1e93){for(var _0x19d9d3=0x0;_0x19d9d3<_0x4a1e93[_0xd3c5('0x43')];_0x19d9d3++){_0x4a1e93[_0x19d9d3][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x10b'));}return _0x4a1e93;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x10c')]()['then'](function(_0x5c1c30){for(var _0x4da4e3=0x0;_0x4da4e3<_0x5c1c30[_0xd3c5('0x43')];_0x4da4e3++){_0x5c1c30[_0x4da4e3][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x10d'));}return _0x5c1c30;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x10e')]()[_0xd3c5('0x11')](function(_0x3d8a78){for(var _0x40d245=0x0;_0x40d245<_0x3d8a78['length'];_0x40d245++){_0x3d8a78[_0x40d245][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x10f'));}return _0x3d8a78;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x110')]()[_0xd3c5('0x11')](function(_0x5ea8dd){for(var _0x2a9dc2=0x0;_0x2a9dc2<_0x5ea8dd[_0xd3c5('0x43')];_0x2a9dc2++){_0x5ea8dd[_0x2a9dc2]['setDataValue'](_0xd3c5('0x96'),_0xd3c5('0x111'));}return _0x5ea8dd;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x112')]()[_0xd3c5('0x11')](function(_0x32783e){for(var _0x1c5af7=0x0;_0x1c5af7<_0x32783e[_0xd3c5('0x43')];_0x1c5af7++){_0x32783e[_0x1c5af7]['setDataValue'](_0xd3c5('0x96'),_0xd3c5('0x113'));}return _0x32783e;}));_0x3535bd[_0xd3c5('0x40')](_0xd2f28c[_0xd3c5('0x114')]()['then'](function(_0x3e7cc0){for(var _0x398019=0x0;_0x398019<_0x3e7cc0[_0xd3c5('0x43')];_0x398019++){_0x3e7cc0[_0x398019][_0xd3c5('0x109')](_0xd3c5('0x96'),'Openchannel');}return _0x3e7cc0;}));return BPromise['all'](_0x3535bd);})[_0xd3c5('0x11')](function(_0x2ce857){var _0x2d42f1=_['flatten'](_0x2ce857);_0x3535bd=[];return db[_0xd3c5('0x63')][_0xd3c5('0x115')](function(_0x24a26b){for(var _0x28ee19=0x0;_0x28ee19<_0x2d42f1[_0xd3c5('0x43')];_0x28ee19++){_0x3535bd[_0xd3c5('0x40')](_0x2d42f1[_0x28ee19][_0xd3c5('0x116')](_0x1ec53a['id']),{'transaction':_0x24a26b});}return BPromise[_0xd3c5('0x56')](_0x3535bd)[_0xd3c5('0x11')](function(){if(_0x1ec53a[_0xd3c5('0xa3')]){return BPromise['each'](_[_0xd3c5('0x2b')](_0x2d42f1,function(_0x64e389){return _0x64e389[_0xd3c5('0x117')]('channel')==='Voice';}),function(_0x54f7d6){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1ec53a['name'],'UserId':_0x1ec53a['id'],'queue_name':_0x54f7d6[_0xd3c5('0x30')],'VoiceQueueId':_0x54f7d6['id'],'interface':_[_0xd3c5('0x61')](_0x1ec53a[_0xd3c5('0x98')])?util['format']('SIP/%s',_0x1ec53a['name']):_0x1ec53a['interface'],'paused':_0x1ec53a[_0xd3c5('0xa5')]||![],'penalty':_0x1ec53a[_0xd3c5('0x9e')]},{'transaction':_0x24a26b});});}else{return;}})[_0xd3c5('0x11')](function(){for(var _0x3b4cfb=0x0;_0x3b4cfb<_0x2d42f1['length'];_0x3b4cfb++){var _0xd4f446=_0x2d42f1[_0x3b4cfb][_0xd3c5('0x117')](_0xd3c5('0x96'));var _0x48d472=_0xd4f446+'QueueId';socket[_0xd3c5('0xa0')]('user'+_0xd4f446+_0xd3c5('0x118'),{'UserId':_0x1ec53a['id'],['queueField']:_0x2d42f1[_0x3b4cfb]['id']});}});});})[_0xd3c5('0x11')](function(){db['TeamVoicePrefix'][_0xd3c5('0x8f')]({'where':{'teamId':_0x1ac113['id']}})['then'](function(_0x37d0ee){if(_0x37d0ee){db[_0xd3c5('0x119')][_0xd3c5('0x7a')]({'UserId':_0x4a5086['params']['id'],'VoicePrefixId':_0x37d0ee[_0xd3c5('0x11a')]});}});});}});}})[_0xd3c5('0x11')](respondWithStatusCode(_0x42ff5f,null))[_0xd3c5('0x49')](handleError(_0x42ff5f,null));};exports[_0xd3c5('0x11b')]=function(_0x20c0cc,_0x19873d){return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x20c0cc['params']['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x19873d,null))[_0xd3c5('0x11')](function(_0xd56c6f){if(_0xd56c6f){var _0x3337e2=_0xd56c6f[_0xd3c5('0x23')]({'plain':!![]});var _0x3a6ac5=_0x20c0cc[_0xd3c5('0x39')][_0xd3c5('0x5a')];return _0xd56c6f['removeTeams'](_0x3a6ac5)[_0xd3c5('0x11')](function(){for(var _0x50a2f8=0x0;_0x50a2f8<_0x3a6ac5[_0xd3c5('0x43')];_0x50a2f8++){var _0x31f69a=[];var _0x10dc31={};db[_0xd3c5('0x108')][_0xd3c5('0x8f')]({'where':{'id':_0x3a6ac5[_0x50a2f8]}})['then'](function(_0x4532a){_0x10dc31=_0x4532a[_0xd3c5('0x45')];_0x31f69a[_0xd3c5('0x40')](_0x4532a[_0xd3c5('0xef')]()['then'](function(_0x209910){for(var _0x14cac7=0x0;_0x14cac7<_0x209910[_0xd3c5('0x43')];_0x14cac7++){_0x209910[_0x14cac7][_0xd3c5('0x109')]('channel',_0xd3c5('0x11c'));}return _0x209910;}));_0x31f69a[_0xd3c5('0x40')](_0x4532a['getChatQueues']()[_0xd3c5('0x11')](function(_0x3e98f0){for(var _0x413fa7=0x0;_0x413fa7<_0x3e98f0[_0xd3c5('0x43')];_0x413fa7++){_0x3e98f0[_0x413fa7][_0xd3c5('0x109')]('channel',_0xd3c5('0x10b'));}return _0x3e98f0;}));_0x31f69a['push'](_0x4532a[_0xd3c5('0x10c')]()[_0xd3c5('0x11')](function(_0x13cb0f){for(var _0x993999=0x0;_0x993999<_0x13cb0f['length'];_0x993999++){_0x13cb0f[_0x993999][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x10d'));}return _0x13cb0f;}));_0x31f69a[_0xd3c5('0x40')](_0x4532a[_0xd3c5('0x10e')]()[_0xd3c5('0x11')](function(_0x4154c1){for(var _0x5af1a8=0x0;_0x5af1a8<_0x4154c1[_0xd3c5('0x43')];_0x5af1a8++){_0x4154c1[_0x5af1a8][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x10f'));}return _0x4154c1;}));_0x31f69a[_0xd3c5('0x40')](_0x4532a[_0xd3c5('0x110')]()['then'](function(_0x3d2ec4){for(var _0x28ffb0=0x0;_0x28ffb0<_0x3d2ec4[_0xd3c5('0x43')];_0x28ffb0++){_0x3d2ec4[_0x28ffb0][_0xd3c5('0x109')](_0xd3c5('0x96'),_0xd3c5('0x111'));}return _0x3d2ec4;}));_0x31f69a[_0xd3c5('0x40')](_0x4532a['getFaxQueues']()[_0xd3c5('0x11')](function(_0x5023d4){for(var _0x4f059e=0x0;_0x4f059e<_0x5023d4[_0xd3c5('0x43')];_0x4f059e++){_0x5023d4[_0x4f059e][_0xd3c5('0x109')]('channel',_0xd3c5('0x113'));}return _0x5023d4;}));_0x31f69a[_0xd3c5('0x40')](_0x4532a[_0xd3c5('0x114')]()[_0xd3c5('0x11')](function(_0x5b8049){for(var _0x1e1052=0x0;_0x1e1052<_0x5b8049[_0xd3c5('0x43')];_0x1e1052++){_0x5b8049[_0x1e1052]['setDataValue'](_0xd3c5('0x96'),_0xd3c5('0x11d'));}return _0x5b8049;}));return BPromise[_0xd3c5('0x56')](_0x31f69a);})['then'](function(_0x40b07c){var _0x14c8f3=_[_0xd3c5('0x11e')](_0x40b07c);_0x31f69a=[];return db['sequelize'][_0xd3c5('0x115')](function(_0x28297d){for(var _0x382769=0x0;_0x382769<_0x14c8f3[_0xd3c5('0x43')];_0x382769++){_0x31f69a['push'](_0x14c8f3[_0x382769][_0xd3c5('0x11f')](_0x3337e2['id']),{'transaction':_0x28297d});}return BPromise[_0xd3c5('0x56')](_0x31f69a)[_0xd3c5('0x11')](function(){if(_0x3337e2[_0xd3c5('0xa3')]){return BPromise[_0xd3c5('0x82')](_[_0xd3c5('0x2b')](_0x14c8f3,function(_0x4b7029){return _0x4b7029[_0xd3c5('0x117')](_0xd3c5('0x96'))===_0xd3c5('0x11c');}),function(_0x3d2324){return db[_0xd3c5('0xa6')][_0xd3c5('0x22')]({'where':{'VoiceQueueId':_0x3d2324['id'],'UserId':_0x3337e2['id']},'transaction':_0x28297d});});}else{return;}})[_0xd3c5('0x11')](function(){db['TeamVoicePrefix'][_0xd3c5('0x8f')]({'where':{'teamId':_0x10dc31['id']}})['then'](function(_0x43337c){if(_0x43337c){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x3337e2['id'],'VoicePrefixId':_0x43337c[_0xd3c5('0x45')][_0xd3c5('0x11a')]}});}});})[_0xd3c5('0x11')](function(){for(var _0xfebbba=0x0;_0xfebbba<_0x14c8f3[_0xd3c5('0x43')];_0xfebbba++){var _0x4c643d=_0x14c8f3[_0xfebbba][_0xd3c5('0x117')](_0xd3c5('0x96'));var _0x33707e=_0x4c643d+_0xd3c5('0xab');socket[_0xd3c5('0xa0')](_0xd3c5('0x26')+_0x4c643d+_0xd3c5('0xac'),{'UserId':_0x3337e2['id'],['queueField']:_0x14c8f3[_0xfebbba]['id']});}});});});}});}})[_0xd3c5('0x11')](respondWithStatusCode(_0x19873d,null))[_0xd3c5('0x49')](handleError(_0x19873d,null));};exports[_0xd3c5('0x120')]=function(_0x5cf7a8,_0x3d7665){var _0x3ab95b={};var _0x1c1573={};var _0x378de4;var _0x59d35a;return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x5cf7a8[_0xd3c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d7665,null))[_0xd3c5('0x11')](function(_0x1e54ce){if(_0x1e54ce){_0x378de4=_0x1e54ce;_0x1c1573[_0xd3c5('0x4c')]=_['keys'](db['CmList'][_0xd3c5('0x4f')]);_0x1c1573[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x5cf7a8[_0xd3c5('0x39')]);_0x1c1573[_0xd3c5('0x50')]=_['intersection'](_0x1c1573[_0xd3c5('0x4c')],_0x1c1573[_0xd3c5('0x39')]);_0x3ab95b[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x1c1573['model'],qs[_0xd3c5('0x52')](_0x5cf7a8[_0xd3c5('0x39')][_0xd3c5('0x52')]));_0x3ab95b['attributes']=_0x3ab95b[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x3ab95b['attributes']:_0x1c1573[_0xd3c5('0x4c')];_0x3ab95b[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x5cf7a8[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x3ab95b['where']=qs[_0xd3c5('0x50')](_[_0xd3c5('0xc6')](_0x5cf7a8[_0xd3c5('0x39')],_0x1c1573[_0xd3c5('0x50')]));if(_0x5cf7a8['query']['filter']){_0x3ab95b[_0xd3c5('0x38')]=_[_0xd3c5('0x53')](_0x3ab95b[_0xd3c5('0x38')],{'$or':_['map'](_0x3ab95b['attributes'],function(_0x2bcb34){var _0x47f4bf={};_0x47f4bf[_0x2bcb34]={'$like':'%'+_0x5cf7a8[_0xd3c5('0x39')][_0xd3c5('0x2b')]+'%'};return _0x47f4bf;})});}_0x3ab95b=_['merge']({},_0x3ab95b,_0x5cf7a8['options']);return _0x378de4[_0xd3c5('0x120')](_0x3ab95b);}})[_0xd3c5('0x11')](function(_0xa0a44c){if(_0xa0a44c){_0x59d35a=_0xa0a44c['length'];if(!_0x5cf7a8['query'][_0xd3c5('0xcc')](_0xd3c5('0xcd'))){_0x3ab95b[_0xd3c5('0x1d')]=qs[_0xd3c5('0x1d')](_0x5cf7a8['query'][_0xd3c5('0x1d')]);_0x3ab95b[_0xd3c5('0x1b')]=qs[_0xd3c5('0x1b')](_0x5cf7a8[_0xd3c5('0x39')][_0xd3c5('0x1b')]);}return _0x378de4[_0xd3c5('0x120')](_0x3ab95b);}})['then'](function(_0x3eb9e4){if(_0x3eb9e4){return _0x3eb9e4?{'count':_0x59d35a,'rows':_0x3eb9e4}:null;}})[_0xd3c5('0x11')](respondWithResult(_0x3d7665,null))[_0xd3c5('0x49')](handleError(_0x3d7665,null));};exports[_0xd3c5('0x121')]=function(_0x334369,_0x21ac6d){var _0x3d2d80={};var _0x55ee50={};var _0xbc5f3e;return db[_0xd3c5('0x33')][_0xd3c5('0x8f')]({'where':{'id':_0x334369[_0xd3c5('0x4b')]['id']}})[_0xd3c5('0x11')](handleEntityNotFound(_0x21ac6d,null))[_0xd3c5('0x11')](function(_0x34e9ee){if(_0x34e9ee){_0xbc5f3e=_0x34e9ee;_0x55ee50['model']=_[_0xd3c5('0x4e')](db['User']['rawAttributes']);_0x55ee50[_0xd3c5('0x39')]=_[_0xd3c5('0x4e')](_0x334369[_0xd3c5('0x39')]);_0x55ee50[_0xd3c5('0x50')]=_['intersection'](_0x55ee50['model'],_0x55ee50[_0xd3c5('0x39')]);_0x3d2d80[_0xd3c5('0x3f')]=_[_0xd3c5('0x51')](_0x55ee50[_0xd3c5('0x4c')],qs[_0xd3c5('0x52')](_0x334369[_0xd3c5('0x39')]['fields']));_0x3d2d80['attributes']=_0x3d2d80[_0xd3c5('0x3f')][_0xd3c5('0x43')]?_0x3d2d80[_0xd3c5('0x3f')]:_0x55ee50[_0xd3c5('0x4c')];_0x3d2d80[_0xd3c5('0xc4')]=qs[_0xd3c5('0xc5')](_0x334369[_0xd3c5('0x39')][_0xd3c5('0xc5')]);_0x3d2d80[_0xd3c5('0x38')]=qs['filters'](_[_0xd3c5('0xc6')](_0x334369[_0xd3c5('0x39')],_0x55ee50[_0xd3c5('0x50')]));if(_0x334369[_0xd3c5('0x39')][_0xd3c5('0x2b')]){_0x3d2d80[_0xd3c5('0x38')]=_['merge'](_0x3d2d80[_0xd3c5('0x38')],{'$or':_[_0xd3c5('0x34')](_0x3d2d80[_0xd3c5('0x3f')],function(_0x4d287f){var _0x31f7e1={};_0x31f7e1[_0x4d287f]={'$like':'%'+_0x334369[_0xd3c5('0x39')]['filter']+'%'};return _0x31f7e1;})});}_0x3d2d80['model']=db[_0xd3c5('0x33')];_0x3d2d80['as']='Agents';_0x3d2d80=_[_0xd3c5('0x53')]({},_0x3d2d80,_0x334369['options']);return _0xbc5f3e['getVoiceQueues']({'include':[_0x3d2d80]});}})[_0xd3c5('0x11')](function(_0x1a23cc){if(_0x1a23cc){var _0x34a614={},_0xc360cb=[];for(var _0xe20ec5=0x0;_0xe20ec5<_0x1a23cc['length'];_0xe20ec5+=0x1){for(var _0x4668b7=0x0,_0x35327c;_0x4668b7<_0x1a23cc[_0xe20ec5][_0xd3c5('0x27')][_0xd3c5('0x43')];_0x4668b7+=0x1){_0x35327c=_0x1a23cc[_0xe20ec5][_0xd3c5('0x27')][_0x4668b7][_0xd3c5('0x23')]({'plain':!![]});_0x34a614[_0x35327c['id']]=_0x35327c;}}_0x34a614=_[_0xd3c5('0x122')](_0x34a614);for(var _0x45f3f4=qs[_0xd3c5('0x1b')](_0x334369[_0xd3c5('0x39')][_0xd3c5('0x1b')]);_0x45f3f4<_0x34a614[_0xd3c5('0x43')]&&_0xc360cb['length']=_0xe6b391['agents']){throw new Error(_0xae68('0x4f'));}})[_0xae68('0xf')](function(){if(_0x53dd90){return db[_0xae68('0x2a')][_0xae68('0x50')]({'where':{'membername':_0x53dd90['name']},'individualHooks':!![]});}})[_0xae68('0xf')](function(){if(_0x53dd90){return _0x53dd90[_0xae68('0x51')]({'raw':!![]});}})[_0xae68('0xf')](function(_0x139ba2){if(_0x53dd90){if(_0x139ba2){var _0x478170=[];_0x362dd8=_0x139ba2;if(_0x362dd8[_0xae68('0x48')]){for(var _0x2a6a24=0x0;_0x2a6a24<_0x362dd8[_0xae68('0x48')];_0x2a6a24++){_0x478170[_0xae68('0x31')](db[_0xae68('0x2a')][_0xae68('0x52')]({'membername':_0x53dd90['name'],'UserId':_0x53dd90['id'],'queue_name':_0x362dd8[_0x2a6a24]['name'],'VoiceQueueId':_0x362dd8[_0x2a6a24]['id'],'interface':_0x154d31,'paused':_0x53dd90[_0xae68('0x53')]||![],'penalty':_0x362dd8[_0x2a6a24][_0xae68('0x54')]||0x0}));}return BPromise[_0xae68('0x46')](_0x478170);}}}})[_0xae68('0xf')](function(){if(_0x53dd90){return db[_0xae68('0x2c')][_0xae68('0x1a')]({'where':{'membername':_0x53dd90[_0xae68('0x2d')],'exitAt':null}});}})[_0xae68('0xf')](function(_0x3b956c){if(_0x53dd90){if(_0x3b956c&&_0x3b956c['length']){var _0x54ed40=[];_0x3b956c[_0xae68('0x30')](function(_0x4d4007){_0x54ed40[_0xae68('0x31')](_0x4d4007[_0xae68('0x2b')]({'exitAt':moment()[_0xae68('0x2e')](_0xae68('0x2f'))}));});return BPromise['all'](_0x54ed40);}}})[_0xae68('0xf')](function(_0x33d2fb){if(_0x53dd90){var _0x57f680=[];var _0x26cdc9=[];var _0x163f95=utils[_0xae68('0x55')]();var _0x5a6117={'membername':_0x53dd90[_0xae68('0x2d')],'interface':_0x154d31,'enterAt':moment()[_0xae68('0x2e')](_0xae68('0x2f')),'role':_0x53dd90[_0xae68('0x27')],'internal':_0x53dd90[_0xae68('0x28')]};_0x163f95[_0xae68('0x30')](function(_0x49e4e5){_0x57f680[_0xae68('0x31')](_[_0xae68('0x56')]({'channel':_0x49e4e5,'type':_0xae68('0x57'),'data1':_0xae68('0x58'),'data2':_0x154d31},_0x5a6117));if(_0x53dd90[_0xae68('0x53')]){_0x26cdc9['push'](_[_0xae68('0x56')]({'channel':_0x49e4e5,'type':_0xae68('0x3d'),'data1':'LOGININPAUSE'},_0x5a6117));}});return db[_0xae68('0x2c')][_0xae68('0x36')](_0x57f680[_0xae68('0x59')](_0x26cdc9),{'individualHooks':!![]});}})['then'](function(){if(_0x53dd90){return _0x53dd90[_0xae68('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xae68('0x2e')](_0xae68('0x2f')),'voicePause':_0x53dd90[_0xae68('0x53')]||![],'mailPause':_0x53dd90[_0xae68('0x53')]||![],'chatPause':_0x53dd90[_0xae68('0x53')]||![],'faxPause':_0x53dd90[_0xae68('0x53')]||![],'smsPause':_0x53dd90['loginInPause']||![],'openchannelPause':_0x53dd90[_0xae68('0x53')]||![],'pauseType':_0x53dd90[_0xae68('0x53')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xae68('0x2e')](_0xae68('0x2f')),'interface':_0x154d31});}})[_0xae68('0xf')](function(_0x203e9f){_0x405b88(_0x203e9f);})[_0xae68('0x17')](function(_0x49c7da){_0x2c3a82(_0x4070e5[_0xae68('0x14')](0x1f4,_0x49c7da['message']));});});}; \ No newline at end of file +var _0x951b=['Pause','forEach','LogoutUser','findOne','all','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','info','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','request\x20sent','result','catch','GetUser','User','findAll','options','raw','attributes','map','include','model','then','ShowUser','find','where','name','role','internal','interface','UserVoiceQueueRt','format','length','updateAttributes','getChannels','push','isNil','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','update','channel','isValidChannel','voice','YYYY-MM-DD\x20HH:mm:ss','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s'];(function(_0xcff057,_0x46c96c){var _0x19a98b=function(_0x26e556){while(--_0x26e556){_0xcff057['push'](_0xcff057['shift']());}};_0x19a98b(++_0x46c96c);}(_0x951b,0xd4));var _0xb951=function(_0x47c8eb,_0x3eb5ef){_0x47c8eb=_0x47c8eb-0x0;var _0x23a121=_0x951b[_0x47c8eb];return _0x23a121;};'use strict';var _=require(_0xb951('0x0'));var util=require('util');var moment=require(_0xb951('0x1'));var BPromise=require(_0xb951('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb951('0x3'));var db=require(_0xb951('0x4'))['db'];var utils=require(_0xb951('0x5'));var logger=require(_0xb951('0x6'))(_0xb951('0x7'));var config=require(_0xb951('0x8'));var jayson=require(_0xb951('0x9'));var client=jayson['client'][_0xb951('0xa')]({'port':0x232a});config[_0xb951('0xb')]=_[_0xb951('0xc')](config['redis'],{'host':_0xb951('0xd'),'port':0x18eb});var socket=require(_0xb951('0xe'))(new Redis(config[_0xb951('0xb')]));require(_0xb951('0xf'))[_0xb951('0x10')](socket);function respondWithRpcPromise(_0x300407,_0xae3f53,_0x20fdd5){return new BPromise(function(_0xca59d2,_0x11b740){return client[_0xb951('0x11')](_0x300407,_0x20fdd5)['then'](function(_0x4e81eb){logger[_0xb951('0x12')]('User,\x20%s,\x20%s',_0xae3f53,'request\x20sent');logger[_0xb951('0x13')](_0xb951('0x14'),_0xae3f53,'request\x20sent',JSON[_0xb951('0x15')](_0x4e81eb));if(_0x4e81eb[_0xb951('0x16')]){if(_0x4e81eb[_0xb951('0x16')]['code']===0x1f4){logger[_0xb951('0x16')](_0xb951('0x17'),_0xae3f53,_0x4e81eb['error']['message']);return _0x11b740(_0x4e81eb[_0xb951('0x16')][_0xb951('0x18')]);}logger[_0xb951('0x16')]('User,\x20%s,\x20%s',_0xae3f53,_0x4e81eb[_0xb951('0x16')][_0xb951('0x18')]);return _0xca59d2(_0x4e81eb[_0xb951('0x16')][_0xb951('0x18')]);}else{logger[_0xb951('0x12')](_0xb951('0x17'),_0xae3f53,_0xb951('0x19'));_0xca59d2(_0x4e81eb[_0xb951('0x1a')][_0xb951('0x18')]);}})[_0xb951('0x1b')](function(_0x39557f){logger[_0xb951('0x16')](_0xb951('0x17'),_0xae3f53,_0x39557f);_0x11b740(_0x39557f);});});}exports[_0xb951('0x1c')]=function(_0x5bdea3){var _0x15c865=this;return new Promise(function(_0x50696d,_0x57a0e0){return db[_0xb951('0x1d')][_0xb951('0x1e')]({'raw':_0x5bdea3[_0xb951('0x1f')]?_0x5bdea3[_0xb951('0x1f')][_0xb951('0x20')]===undefined?!![]:![]:!![],'where':_0x5bdea3[_0xb951('0x1f')]?_0x5bdea3[_0xb951('0x1f')]['where']||null:null,'attributes':_0x5bdea3[_0xb951('0x1f')]?_0x5bdea3['options'][_0xb951('0x21')]||null:null,'limit':_0x5bdea3[_0xb951('0x1f')]?_0x5bdea3[_0xb951('0x1f')]['limit']||null:null,'include':_0x5bdea3[_0xb951('0x1f')]?_0x5bdea3[_0xb951('0x1f')]['include']?_[_0xb951('0x22')](_0x5bdea3[_0xb951('0x1f')][_0xb951('0x23')],function(_0x3af9ef){return{'model':db[_0x3af9ef[_0xb951('0x24')]],'as':_0x3af9ef['as'],'attributes':_0x3af9ef[_0xb951('0x21')],'include':_0x3af9ef[_0xb951('0x23')]?_[_0xb951('0x22')](_0x3af9ef[_0xb951('0x23')],function(_0x1b8935){return{'model':db[_0x1b8935['model']],'as':_0x1b8935['as'],'attributes':_0x1b8935[_0xb951('0x21')],'include':_0x1b8935[_0xb951('0x23')]?_['map'](_0x1b8935[_0xb951('0x23')],function(_0x2a40a7){return{'model':db[_0x2a40a7[_0xb951('0x24')]],'as':_0x2a40a7['as'],'attributes':_0x2a40a7[_0xb951('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb951('0x25')](function(_0x457bf1){logger[_0xb951('0x12')](_0xb951('0x1c'),_0x5bdea3);logger[_0xb951('0x13')](_0xb951('0x1c'),_0x5bdea3,JSON[_0xb951('0x15')](_0x457bf1));_0x50696d(_0x457bf1);})[_0xb951('0x1b')](function(_0x293683){logger['error'](_0xb951('0x1c'),_0x293683[_0xb951('0x18')],_0x5bdea3);_0x57a0e0(_0x15c865[_0xb951('0x16')](0x1f4,_0x293683[_0xb951('0x18')]));});});};exports[_0xb951('0x26')]=function(_0x2c2131){var _0x487926=this;return new Promise(function(_0x4644f6,_0x52f280){return db['User'][_0xb951('0x27')]({'raw':_0x2c2131['options']?_0x2c2131[_0xb951('0x1f')][_0xb951('0x20')]===undefined?!![]:![]:!![],'where':_0x2c2131[_0xb951('0x1f')]?_0x2c2131[_0xb951('0x1f')][_0xb951('0x28')]||null:null,'attributes':_0x2c2131[_0xb951('0x1f')]?_0x2c2131[_0xb951('0x1f')][_0xb951('0x21')]||null:null,'include':_0x2c2131[_0xb951('0x1f')]?_0x2c2131['options']['include']?_[_0xb951('0x22')](_0x2c2131[_0xb951('0x1f')]['include'],function(_0x460497){return{'model':db[_0x460497[_0xb951('0x24')]],'as':_0x460497['as'],'attributes':_0x460497[_0xb951('0x21')],'include':_0x460497[_0xb951('0x23')]?_['map'](_0x460497[_0xb951('0x23')],function(_0x4966ef){return{'model':db[_0x4966ef[_0xb951('0x24')]],'as':_0x4966ef['as'],'attributes':_0x4966ef[_0xb951('0x21')],'include':_0x4966ef['include']?_[_0xb951('0x22')](_0x4966ef['include'],function(_0x55f03b){return{'model':db[_0x55f03b[_0xb951('0x24')]],'as':_0x55f03b['as'],'attributes':_0x55f03b['attributes']};}):[]};}):[]};}):[]:[]})[_0xb951('0x25')](function(_0x49cbd1){logger[_0xb951('0x12')](_0xb951('0x26'),_0x2c2131);logger[_0xb951('0x13')]('ShowUser',_0x2c2131,JSON['stringify'](_0x49cbd1));_0x4644f6(_0x49cbd1);})[_0xb951('0x1b')](function(_0x4b5758){logger[_0xb951('0x16')](_0xb951('0x26'),_0x4b5758['message'],_0x2c2131);_0x52f280(_0x487926[_0xb951('0x16')](0x1f4,_0x4b5758['message']));});});};exports['PauseUser']=function(_0x326ce3){var _0x4380e6=this;return new Promise(function(_0x33cfe9,_0x55e6d0){var _0x20a594;return db[_0xb951('0x1d')]['find']({'where':_0x326ce3['options'][_0xb951('0x28')]||{},'attributes':['id',_0xb951('0x29'),_0xb951('0x2a'),_0xb951('0x2b'),_0xb951('0x2c')]})[_0xb951('0x25')](function(_0x1a6c2c){if(_0x1a6c2c){_0x20a594=_0x1a6c2c;return db[_0xb951('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x20a594['id']},'individualHooks':!![]});}})[_0xb951('0x25')](function(){if(_0x20a594){return db['MemberReport'][_0xb951('0x1e')]({'where':{'membername':_0x20a594['name'],'type':'PAUSE','exitAt':null}});}})[_0xb951('0x25')](function(_0x19c3fd){if(_0x20a594){if(_0x19c3fd&&_0x19c3fd['length']){var _0x5c1f0b=moment()[_0xb951('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x17a042=0x0,_0x22f0c1=_0x19c3fd[_0xb951('0x2f')];_0x17a042<_0x22f0c1;_0x17a042++){_0x19c3fd[_0x17a042][_0xb951('0x30')]({'exitAt':_0x5c1f0b});}}}})[_0xb951('0x25')](function(){if(_0x20a594){var _0x4499cb=[];var _0x54a8a9=utils[_0xb951('0x31')]();_0x54a8a9['forEach'](function(_0x3bd5f5){_0x4499cb[_0xb951('0x32')]({'channel':_0x3bd5f5,'membername':_0x20a594[_0xb951('0x29')],'interface':_[_0xb951('0x33')](_0x20a594['interface'])?util[_0xb951('0x2e')](_0xb951('0x34'),_0x20a594[_0xb951('0x29')]):_0x20a594[_0xb951('0x2c')],'type':_0xb951('0x35'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x326ce3[_0xb951('0x36')][_0xb951('0x37')]||_0xb951('0x38'),'role':_0x20a594['role'],'internal':_0x20a594['internal'],'uniqueid':_0x326ce3[_0xb951('0x36')][_0xb951('0x39')]||null});});return db[_0xb951('0x3a')]['bulkCreate'](_0x4499cb,{'individualHooks':!![]});}})[_0xb951('0x25')](function(){if(_0x20a594){return _0x20a594[_0xb951('0x3b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x326ce3[_0xb951('0x36')][_0xb951('0x37')]||_0xb951('0x38'),'lastPauseAt':moment()[_0xb951('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb951('0x25')](function(_0x35cd5b){_0x33cfe9(_0x35cd5b);})[_0xb951('0x1b')](function(_0x10334){_0x55e6d0(_0x4380e6[_0xb951('0x16')](0x1f4,_0x10334['message']));});});};exports['UnpauseUser']=function(_0x1d412a){var _0x142bce=this;return new Promise(function(_0x162185,_0x1be8ff){var _0x31d447;return db[_0xb951('0x1d')]['findOne']({'where':_0x1d412a[_0xb951('0x1f')][_0xb951('0x28')]||{},'attributes':['id',_0xb951('0x29')]})['then'](function(_0x179155){if(_0x179155){_0x31d447=_0x179155;if(_0x1d412a[_0xb951('0x36')][_0xb951('0x3c')]&&!utils[_0xb951('0x3d')](_0x1d412a[_0xb951('0x36')][_0xb951('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x1d412a[_0xb951('0x36')][_0xb951('0x3c')]){case _0xb951('0x3e'):return db[_0xb951('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x31d447['id']}})[_0xb951('0x25')](function(){return db[_0xb951('0x3a')]['find']({'where':{'channel':_0x1d412a['body'][_0xb951('0x3c')],'membername':_0x31d447['name'],'type':_0xb951('0x35'),'exitAt':null}});})[_0xb951('0x25')](function(_0x54c797){if(_0x54c797){return _0x54c797['update']({'exitAt':moment()[_0xb951('0x2e')](_0xb951('0x3f')),'data2':_0xb951('0x40')},{'individualHooks':!![]});}return null;})[_0xb951('0x25')](function(){return _0x31d447[_0xb951('0x3b')]({'voicePause':![]});});case _0xb951('0x41'):case _0xb951('0x42'):case _0xb951('0x43'):case _0xb951('0x44'):case _0xb951('0x45'):case _0xb951('0x46'):return db[_0xb951('0x3a')][_0xb951('0x27')]({'where':{'channel':_0x1d412a[_0xb951('0x36')][_0xb951('0x3c')],'membername':_0x31d447[_0xb951('0x29')],'type':_0xb951('0x35'),'exitAt':null}})[_0xb951('0x25')](function(_0xa671a5){return _0xa671a5['update']({'exitAt':moment()['format'](_0xb951('0x3f')),'data2':_0xb951('0x40')},{'individualHooks':!![]});})[_0xb951('0x25')](function(){var _0x12c27c={};_[_0xb951('0x47')](_0x12c27c,util['format'](_0xb951('0x48'),_0x1d412a['body']['channel'],_0xb951('0x49')),![]);return _0x31d447[_0xb951('0x3b')](_0x12c27c);});default:return db['UserVoiceQueueRt'][_0xb951('0x3b')]({'paused':0x0},{'where':{'UserId':_0x31d447['id']}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x31d447[_0xb951('0x29')],'type':_0xb951('0x35'),'exitAt':null}});})[_0xb951('0x25')](function(_0x17dd7f){var _0x4bce83=[];_0x17dd7f[_0xb951('0x4a')](function(_0x12e2d5){_0x4bce83[_0xb951('0x32')](_0x12e2d5[_0xb951('0x3b')]({'exitAt':moment()[_0xb951('0x2e')](_0xb951('0x3f')),'data2':_0xb951('0x40')}));});return BPromise['all'](_0x4bce83);})[_0xb951('0x25')](function(){return _0x31d447[_0xb951('0x3b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xb951('0x25')](function(_0x2d9e75){_0x162185(_0x2d9e75);})[_0xb951('0x1b')](function(_0x38d9a8){_0x1be8ff(_0x142bce['error'](0x1f4,_0x38d9a8[_0xb951('0x18')]));});});};exports[_0xb951('0x4b')]=function(_0x15335a){var _0x4a73be=this;return new Promise(function(_0x1b3eda,_0x1c652a){var _0xc76cad;return db[_0xb951('0x1d')][_0xb951('0x4c')]({'where':_0x15335a[_0xb951('0x1f')][_0xb951('0x28')]||{},'attributes':['id','name']})[_0xb951('0x25')](function(_0x466b01){if(_0x466b01){_0xc76cad=_0x466b01;return db[_0xb951('0x2d')]['destroy']({'where':{'membername':_0xc76cad[_0xb951('0x29')]},'individualHooks':!![]});}})[_0xb951('0x25')](function(){if(_0xc76cad){return db['MemberReport'][_0xb951('0x1e')]({'where':{'membername':_0xc76cad[_0xb951('0x29')],'exitAt':null}});}})['then'](function(_0x24ea7b){if(_0xc76cad){if(_0x24ea7b&&_0x24ea7b[_0xb951('0x2f')]){var _0xc56816=[];_0x24ea7b['forEach'](function(_0x43d734){_0xc56816[_0xb951('0x32')](_0x43d734[_0xb951('0x3b')]({'exitAt':moment()[_0xb951('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb951('0x4d')](_0xc56816);}}})['then'](function(){if(_0xc76cad){return _0xc76cad[_0xb951('0x3b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x10ad6b){_0x1b3eda(_0x10ad6b);})['catch'](function(_0x10b45d){_0x1c652a(_0x4a73be['error'](0x1f4,_0x10b45d[_0xb951('0x18')]));});});};exports['LoginUser']=function(_0x507968){var _0xa2487e=this;return new Promise(function(_0x1b5d2e,_0x3ed5ec){var _0x34b1ec;var _0x360e8e;var _0x51f1c6;var _0x5e4a62;return db[_0xb951('0x1d')]['findOne']({'where':_0x507968[_0xb951('0x1f')][_0xb951('0x28')]||{},'attributes':['id',_0xb951('0x29'),'role',_0xb951('0x4e'),_0xb951('0x4f'),_0xb951('0x2b'),_0xb951('0x50'),_0xb951('0x2c')]})[_0xb951('0x25')](function(_0x4f9777){if(_0x4f9777){_0x34b1ec=_0x4f9777;_0x5e4a62=_0x507968['body'][_0xb951('0x2c')]?_0x507968[_0xb951('0x36')]['interface']:util[_0xb951('0x2e')](_0xb951('0x34'),_0x34b1ec['name']);return db[_0xb951('0x1d')][_0xb951('0x51')]({'where':{'role':_0xb951('0x52'),'online':!![],'id':{'$ne':_0x34b1ec['id']}}});}})[_0xb951('0x25')](function(_0x58e866){if(_0x58e866){_0x51f1c6=_0x58e866;return require(_0xb951('0x53'))[_0xb951('0x54')]();}})[_0xb951('0x25')](function(_0x1f8588){if(_0x1f8588&&_0x1f8588[_0xb951('0x55')]&&_0x51f1c6>=_0x1f8588[_0xb951('0x55')]){throw new Error(_0xb951('0x56'));}})['then'](function(){if(_0x34b1ec){return db[_0xb951('0x2d')][_0xb951('0x57')]({'where':{'membername':_0x34b1ec[_0xb951('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x34b1ec){return _0x34b1ec['getVoiceQueues']({'raw':!![]});}})[_0xb951('0x25')](function(_0x114814){if(_0x34b1ec){if(_0x114814){var _0x1c7c8a=[];_0x360e8e=_0x114814;if(_0x360e8e['length']){for(var _0xad41ed=0x0;_0xad41ed<_0x360e8e[_0xb951('0x2f')];_0xad41ed++){_0x1c7c8a[_0xb951('0x32')](db['UserVoiceQueueRt'][_0xb951('0x58')]({'membername':_0x34b1ec[_0xb951('0x29')],'UserId':_0x34b1ec['id'],'queue_name':_0x360e8e[_0xad41ed][_0xb951('0x29')],'VoiceQueueId':_0x360e8e[_0xad41ed]['id'],'interface':_0x5e4a62,'paused':_0x34b1ec[_0xb951('0x50')]||![],'penalty':_0x360e8e[_0xad41ed][_0xb951('0x59')]||0x0}));}return BPromise[_0xb951('0x4d')](_0x1c7c8a);}}}})[_0xb951('0x25')](function(){if(_0x34b1ec){return db[_0xb951('0x3a')]['findAll']({'where':{'membername':_0x34b1ec[_0xb951('0x29')],'exitAt':null}});}})[_0xb951('0x25')](function(_0x170dd9){if(_0x34b1ec){if(_0x170dd9&&_0x170dd9['length']){var _0x4b1969=[];_0x170dd9[_0xb951('0x4a')](function(_0x3cedae){_0x4b1969['push'](_0x3cedae['update']({'exitAt':moment()['format'](_0xb951('0x3f'))}));});return BPromise[_0xb951('0x4d')](_0x4b1969);}}})[_0xb951('0x25')](function(_0x39fa76){if(_0x34b1ec){var _0x2a1490=[];var _0x5d5cd7=[];var _0x30a89e=utils[_0xb951('0x31')]();var _0x399af5={'membername':_0x34b1ec[_0xb951('0x29')],'interface':_0x5e4a62,'enterAt':moment()[_0xb951('0x2e')](_0xb951('0x3f')),'role':_0x34b1ec[_0xb951('0x2a')],'internal':_0x34b1ec[_0xb951('0x2b')]};_0x30a89e[_0xb951('0x4a')](function(_0x1ceda7){_0x2a1490['push'](_[_0xb951('0x5a')]({'channel':_0x1ceda7,'type':_0xb951('0x5b'),'data1':_0xb951('0x5c'),'data2':_0x5e4a62},_0x399af5));if(_0x34b1ec[_0xb951('0x50')]){_0x5d5cd7[_0xb951('0x32')](_[_0xb951('0x5a')]({'channel':_0x1ceda7,'type':_0xb951('0x35'),'data1':_0xb951('0x5d')},_0x399af5));}});return db[_0xb951('0x3a')][_0xb951('0x5e')](_0x2a1490['concat'](_0x5d5cd7),{'individualHooks':!![]});}})['then'](function(){if(_0x34b1ec){return _0x34b1ec['update']({'online':!![],'lastLoginAt':moment()[_0xb951('0x2e')](_0xb951('0x3f')),'voicePause':_0x34b1ec[_0xb951('0x50')]||![],'mailPause':_0x34b1ec[_0xb951('0x50')]||![],'chatPause':_0x34b1ec[_0xb951('0x50')]||![],'faxPause':_0x34b1ec['loginInPause']||![],'smsPause':_0x34b1ec[_0xb951('0x50')]||![],'openchannelPause':_0x34b1ec[_0xb951('0x50')]||![],'pauseType':_0x34b1ec[_0xb951('0x50')]?_0xb951('0x5d'):null,'lastPauseAt':moment()[_0xb951('0x2e')](_0xb951('0x3f')),'interface':_0x5e4a62});}})['then'](function(_0xe13625){_0x1b5d2e(_0xe13625);})['catch'](function(_0x53f939){_0x3ed5ec(_0xa2487e[_0xb951('0x16')](0x1f4,_0x53f939[_0xb951('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 534301a..66168d5 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 _0x5295=['length','./user.events','save','remove','update','removeListener'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5295,0x11b));var _0x5529=function(_0x47107f,_0x3e0b1b){_0x47107f=_0x47107f-0x0;var _0x1cf19f=_0x5295[_0x47107f];return _0x1cf19f;};'use strict';var UserEvents=require(_0x5529('0x0'));var events=[_0x5529('0x1'),_0x5529('0x2'),_0x5529('0x3')];function createListener(_0x4ca919,_0x461989){return function(_0x309e27){_0x461989['emit'](_0x4ca919,_0x309e27);};}function removeListener(_0x15f655,_0x289ae3){return function(){UserEvents[_0x5529('0x4')](_0x15f655,_0x289ae3);};}exports['register']=function(_0x2c5815){for(var _0xcb0818=0x0,_0x2e1787=events[_0x5529('0x5')];_0xcb0818<_0x2e1787;_0xcb0818++){var _0x309ca3=events[_0xcb0818];var _0x1e805b=createListener('user:'+_0x309ca3,_0x2c5815);UserEvents['on'](_0x309ca3,_0x1e805b);}}; \ No newline at end of file +var _0xc706=['length','user:','./user.events','save','remove','update','emit','register'];(function(_0x533d04,_0x4b0d45){var _0x2d2e77=function(_0x393055){while(--_0x393055){_0x533d04['push'](_0x533d04['shift']());}};_0x2d2e77(++_0x4b0d45);}(_0xc706,0xf2));var _0x6c70=function(_0x24a312,_0x816625){_0x24a312=_0x24a312-0x0;var _0x4ac91f=_0xc706[_0x24a312];return _0x4ac91f;};'use strict';var UserEvents=require(_0x6c70('0x0'));var events=[_0x6c70('0x1'),_0x6c70('0x2'),_0x6c70('0x3')];function createListener(_0x32c50d,_0x3b099b){return function(_0x30ef4d){_0x3b099b[_0x6c70('0x4')](_0x32c50d,_0x30ef4d);};}function removeListener(_0x20ac58,_0x520773){return function(){UserEvents['removeListener'](_0x20ac58,_0x520773);};}exports[_0x6c70('0x5')]=function(_0x47bc7d){for(var _0x1b816f=0x0,_0x5b1021=events[_0x6c70('0x6')];_0x1b816f<_0x5b1021;_0x1b816f++){var _0xef22d1=events[_0x1b816f];var _0x3510b0=createListener(_0x6c70('0x7')+_0xef22d1,_0x47bc7d);UserEvents['on'](_0xef22d1,_0x3510b0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index eb20e1c..df68823 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x29cc96,_0x39d612){var _0xd403ae=function(_0x104054){while(--_0x104054){_0x29cc96['push'](_0x29cc96['shift']());}};_0xd403ae(++_0x39d612);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x82a071,_0x252266){var _0x15dda9=function(_0x3f73b0){while(--_0x3f73b0){_0x82a071['push'](_0x82a071['shift']());}};_0x15dda9(++_0x252266);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 438aac8..26d1cab 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 _0x019b=['INTEGER','exports'];(function(_0x41c13b,_0x4c8897){var _0x2f3851=function(_0x143262){while(--_0x143262){_0x41c13b['push'](_0x41c13b['shift']());}};_0x2f3851(++_0x4c8897);}(_0x019b,0x107));var _0xb019=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x019b[_0x35bd6c];return _0x2f421d;};'use strict';var Sequelize=require('sequelize');module[_0xb019('0x0')]={'penalty':{'type':Sequelize[_0xb019('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x00a1=['sequelize','exports','INTEGER'];(function(_0x1e2d9a,_0x350fb0){var _0x37f058=function(_0x4949ce){while(--_0x4949ce){_0x1e2d9a['push'](_0x1e2d9a['shift']());}};_0x37f058(++_0x350fb0);}(_0x00a1,0x7b));var _0x100a=function(_0x471337,_0x1bef41){_0x471337=_0x471337-0x0;var _0x3ec3be=_0x00a1[_0x471337];return _0x3ec3be;};'use strict';var Sequelize=require(_0x100a('0x0'));module[_0x100a('0x1')]={'penalty':{'type':Sequelize[_0x100a('0x2')],'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 6c39433..1417bcf 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 _0xbfa3=['request-promise','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0xbfa3,0x1c3));var _0x3bfa=function(_0x25ac47,_0x17c52e){_0x25ac47=_0x25ac47-0x0;var _0x11fda2=_0xbfa3[_0x25ac47];return _0x11fda2;};'use strict';var _=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var logger=require(_0x3bfa('0x2'))(_0x3bfa('0x3'));var moment=require('moment');var BPromise=require(_0x3bfa('0x4'));var rp=require(_0x3bfa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bfa('0x6'));var attributes=require(_0x3bfa('0x7'));module[_0x3bfa('0x8')]=function(_0x39be4c,_0x35d262){return _0x39be4c[_0x3bfa('0x9')](_0x3bfa('0xa'),attributes,{'tableName':_0x3bfa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf564=['request-promise','path','rimraf','../../config/environment','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xf564,0xa3));var _0x4f56=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0xf564[_0xce93c];return _0x230720;};'use strict';var _=require(_0x4f56('0x0'));var util=require('util');var logger=require(_0x4f56('0x1'))(_0x4f56('0x2'));var moment=require(_0x4f56('0x3'));var BPromise=require(_0x4f56('0x4'));var rp=require(_0x4f56('0x5'));var fs=require('fs');var path=require(_0x4f56('0x6'));var rimraf=require(_0x4f56('0x7'));var config=require(_0x4f56('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x4b43a8,_0x2f2474){return _0x4b43a8[_0x4f56('0x9')](_0x4f56('0xa'),attributes,{'tableName':_0x4f56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 7bb5e97..e70bea2 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 _0x3fd0=['request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0xb2f7b9,_0x283db3){var _0x2fa860=function(_0x2efefd){while(--_0x2efefd){_0xb2f7b9['push'](_0xb2f7b9['shift']());}};_0x2fa860(++_0x283db3);}(_0x3fd0,0xce));var _0x03fd=function(_0x19b8c1,_0x4b0823){_0x19b8c1=_0x19b8c1-0x0;var _0x24b112=_0x3fd0[_0x19b8c1];return _0x24b112;};'use strict';var _=require(_0x03fd('0x0'));var util=require(_0x03fd('0x1'));var moment=require(_0x03fd('0x2'));var BPromise=require(_0x03fd('0x3'));var rs=require(_0x03fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03fd('0x5'))['db'];var utils=require(_0x03fd('0x6'));var logger=require('../../config/logger')(_0x03fd('0x7'));var config=require(_0x03fd('0x8'));var jayson=require(_0x03fd('0x9'));var client=jayson['client'][_0x03fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26fe36,_0x6a135,_0x40bcf4){return new BPromise(function(_0x2e6ac9,_0x5cb28c){return client['request'](_0x26fe36,_0x40bcf4)[_0x03fd('0xb')](function(_0x19680d){logger[_0x03fd('0xc')](_0x03fd('0xd'),_0x6a135,_0x03fd('0xe'));logger['debug'](_0x03fd('0xf'),_0x6a135,_0x03fd('0xe'),JSON[_0x03fd('0x10')](_0x19680d));if(_0x19680d[_0x03fd('0x11')]){if(_0x19680d[_0x03fd('0x11')][_0x03fd('0x12')]===0x1f4){logger['error'](_0x03fd('0xd'),_0x6a135,_0x19680d[_0x03fd('0x11')][_0x03fd('0x13')]);return _0x5cb28c(_0x19680d[_0x03fd('0x11')][_0x03fd('0x13')]);}logger['error'](_0x03fd('0xd'),_0x6a135,_0x19680d[_0x03fd('0x11')][_0x03fd('0x13')]);return _0x2e6ac9(_0x19680d[_0x03fd('0x11')][_0x03fd('0x13')]);}else{logger[_0x03fd('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x6a135,_0x03fd('0xe'));_0x2e6ac9(_0x19680d[_0x03fd('0x14')]['message']);}})[_0x03fd('0x15')](function(_0x28fec6){logger[_0x03fd('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x6a135,_0x28fec6);_0x5cb28c(_0x28fec6);});});} \ No newline at end of file +var _0x02b0=['client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0x02b0,0x75));var _0x002b=function(_0x34f9e2,_0x5a8e00){_0x34f9e2=_0x34f9e2-0x0;var _0xd6447f=_0x02b0[_0x34f9e2];return _0xd6447f;};'use strict';var _=require(_0x002b('0x0'));var util=require('util');var moment=require(_0x002b('0x1'));var BPromise=require(_0x002b('0x2'));var rs=require(_0x002b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x002b('0x4'))['db'];var utils=require(_0x002b('0x5'));var logger=require('../../config/logger')(_0x002b('0x6'));var config=require(_0x002b('0x7'));var jayson=require(_0x002b('0x8'));var client=jayson[_0x002b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bfcba,_0x103a19,_0x1ebb0d){return new BPromise(function(_0x59f5ea,_0x47b207){return client['request'](_0x4bfcba,_0x1ebb0d)[_0x002b('0xa')](function(_0x383881){logger[_0x002b('0xb')](_0x002b('0xc'),_0x103a19,_0x002b('0xd'));logger['debug'](_0x002b('0xe'),_0x103a19,_0x002b('0xd'),JSON[_0x002b('0xf')](_0x383881));if(_0x383881[_0x002b('0x10')]){if(_0x383881[_0x002b('0x10')][_0x002b('0x11')]===0x1f4){logger[_0x002b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x103a19,_0x383881[_0x002b('0x10')][_0x002b('0x12')]);return _0x47b207(_0x383881[_0x002b('0x10')][_0x002b('0x12')]);}logger[_0x002b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x103a19,_0x383881[_0x002b('0x10')][_0x002b('0x12')]);return _0x59f5ea(_0x383881[_0x002b('0x10')][_0x002b('0x12')]);}else{logger['info'](_0x002b('0xc'),_0x103a19,_0x002b('0xd'));_0x59f5ea(_0x383881[_0x002b('0x13')][_0x002b('0x12')]);}})[_0x002b('0x14')](function(_0x110c55){logger['error'](_0x002b('0xc'),_0x103a19,_0x110c55);_0x47b207(_0x110c55);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 769124e..3b8036a 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x14361b,_0x42d5cc){var _0x5d96bb=function(_0xd4596f){while(--_0xd4596f){_0x14361b['push'](_0x14361b['shift']());}};_0x5d96bb(++_0x42d5cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37ee44,_0xb91a6d){var _0xb40465=function(_0x178f14){while(--_0x178f14){_0x37ee44['push'](_0x37ee44['shift']());}};_0xb40465(++_0xb91a6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9ea4353..df8e4c1 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 _0xe6b8=['INTEGER','STRING','sequelize','exports'];(function(_0x252fec,_0x21dfd6){var _0x1b3256=function(_0x3836bf){while(--_0x3836bf){_0x252fec['push'](_0x252fec['shift']());}};_0x1b3256(++_0x21dfd6);}(_0xe6b8,0x152));var _0x8e6b=function(_0x26f4de,_0x39b760){_0x26f4de=_0x26f4de-0x0;var _0x56c012=_0xe6b8[_0x26f4de];return _0x56c012;};'use strict';var Sequelize=require(_0x8e6b('0x0'));module[_0x8e6b('0x1')]={'penalty':{'type':Sequelize[_0x8e6b('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8e6b('0x3')]}}; \ No newline at end of file +var _0x1b97=['sequelize','INTEGER','STRING'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x1b97,0x156));var _0x71b9=function(_0x30633a,_0xba964a){_0x30633a=_0x30633a-0x0;var _0x13737c=_0x1b97[_0x30633a];return _0x13737c;};'use strict';var Sequelize=require(_0x71b9('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x71b9('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x71b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9610199..160901f 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 _0x8441=['define','UserFaxQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x8441,0x9c));var _0x1844=function(_0x377ef7,_0x256359){_0x377ef7=_0x377ef7-0x0;var _0x42bf67=_0x8441[_0x377ef7];return _0x42bf67;};'use strict';var _=require(_0x1844('0x0'));var util=require(_0x1844('0x1'));var logger=require('../../config/logger')(_0x1844('0x2'));var moment=require(_0x1844('0x3'));var BPromise=require(_0x1844('0x4'));var rp=require(_0x1844('0x5'));var fs=require('fs');var path=require(_0x1844('0x6'));var rimraf=require(_0x1844('0x7'));var config=require('../../config/environment');var attributes=require(_0x1844('0x8'));module['exports']=function(_0x4cb04b,_0x21149d){return _0x4cb04b[_0x1844('0x9')](_0x1844('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32bf=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x27f4bd,_0x2f2681){var _0x69f4b5=function(_0x22072b){while(--_0x22072b){_0x27f4bd['push'](_0x27f4bd['shift']());}};_0x69f4b5(++_0x2f2681);}(_0x32bf,0x137));var _0xf32b=function(_0x1b0d3b,_0xf74fc1){_0x1b0d3b=_0x1b0d3b-0x0;var _0x947886=_0x32bf[_0x1b0d3b];return _0x947886;};'use strict';var _=require(_0xf32b('0x0'));var util=require(_0xf32b('0x1'));var logger=require(_0xf32b('0x2'))(_0xf32b('0x3'));var moment=require(_0xf32b('0x4'));var BPromise=require(_0xf32b('0x5'));var rp=require(_0xf32b('0x6'));var fs=require('fs');var path=require(_0xf32b('0x7'));var rimraf=require('rimraf');var config=require(_0xf32b('0x8'));var attributes=require(_0xf32b('0x9'));module[_0xf32b('0xa')]=function(_0x25d4ff,_0x571b67){return _0x25d4ff[_0xf32b('0xb')](_0xf32b('0xc'),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 e72af00..2ae36ff 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 _0xf90e=['request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','debug'];(function(_0x5d7109,_0x231933){var _0x20a7bf=function(_0x4243c1){while(--_0x4243c1){_0x5d7109['push'](_0x5d7109['shift']());}};_0x20a7bf(++_0x231933);}(_0xf90e,0xad));var _0xef90=function(_0x4cf95a,_0x4df1da){_0x4cf95a=_0x4cf95a-0x0;var _0x4cb6b0=_0xf90e[_0x4cf95a];return _0x4cb6b0;};'use strict';var _=require(_0xef90('0x0'));var util=require(_0xef90('0x1'));var moment=require('moment');var BPromise=require(_0xef90('0x2'));var rs=require(_0xef90('0x3'));var fs=require('fs');var Redis=require(_0xef90('0x4'));var db=require(_0xef90('0x5'))['db'];var utils=require(_0xef90('0x6'));var logger=require(_0xef90('0x7'))(_0xef90('0x8'));var config=require(_0xef90('0x9'));var jayson=require(_0xef90('0xa'));var client=jayson[_0xef90('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d006,_0x1db1e9,_0x344c95){return new BPromise(function(_0x4acc0a,_0x43fa8c){return client[_0xef90('0xc')](_0x35d006,_0x344c95)['then'](function(_0x129389){logger[_0xef90('0xd')](_0xef90('0xe'),_0x1db1e9,'request\x20sent');logger[_0xef90('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1db1e9,_0xef90('0x10'),JSON['stringify'](_0x129389));if(_0x129389['error']){if(_0x129389[_0xef90('0x11')][_0xef90('0x12')]===0x1f4){logger['error'](_0xef90('0xe'),_0x1db1e9,_0x129389[_0xef90('0x11')][_0xef90('0x13')]);return _0x43fa8c(_0x129389['error'][_0xef90('0x13')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1db1e9,_0x129389[_0xef90('0x11')][_0xef90('0x13')]);return _0x4acc0a(_0x129389['error'][_0xef90('0x13')]);}else{logger[_0xef90('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1db1e9,_0xef90('0x10'));_0x4acc0a(_0x129389[_0xef90('0x14')][_0xef90('0x13')]);}})['catch'](function(_0x3e67ec){logger[_0xef90('0x11')](_0xef90('0xe'),_0x1db1e9,_0x3e67ec);_0x43fa8c(_0x3e67ec);});});} \ No newline at end of file +var _0xb080=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x11ad93,_0x49306a){var _0x50535e=function(_0x30b454){while(--_0x30b454){_0x11ad93['push'](_0x11ad93['shift']());}};_0x50535e(++_0x49306a);}(_0xb080,0x107));var _0x0b08=function(_0xf2af38,_0x1db868){_0xf2af38=_0xf2af38-0x0;var _0x531940=_0xb080[_0xf2af38];return _0x531940;};'use strict';var _=require('lodash');var util=require(_0x0b08('0x0'));var moment=require(_0x0b08('0x1'));var BPromise=require(_0x0b08('0x2'));var rs=require(_0x0b08('0x3'));var fs=require('fs');var Redis=require(_0x0b08('0x4'));var db=require(_0x0b08('0x5'))['db'];var utils=require(_0x0b08('0x6'));var logger=require(_0x0b08('0x7'))(_0x0b08('0x8'));var config=require(_0x0b08('0x9'));var jayson=require(_0x0b08('0xa'));var client=jayson[_0x0b08('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81712c,_0x59eb1f,_0x2ad205){return new BPromise(function(_0x3b2f70,_0x55c11e){return client[_0x0b08('0xc')](_0x81712c,_0x2ad205)['then'](function(_0x5b205c){logger[_0x0b08('0xd')](_0x0b08('0xe'),_0x59eb1f,'request\x20sent');logger[_0x0b08('0xf')](_0x0b08('0x10'),_0x59eb1f,_0x0b08('0x11'),JSON[_0x0b08('0x12')](_0x5b205c));if(_0x5b205c[_0x0b08('0x13')]){if(_0x5b205c[_0x0b08('0x13')][_0x0b08('0x14')]===0x1f4){logger[_0x0b08('0x13')](_0x0b08('0xe'),_0x59eb1f,_0x5b205c[_0x0b08('0x13')][_0x0b08('0x15')]);return _0x55c11e(_0x5b205c[_0x0b08('0x13')]['message']);}logger[_0x0b08('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x59eb1f,_0x5b205c[_0x0b08('0x13')]['message']);return _0x3b2f70(_0x5b205c[_0x0b08('0x13')][_0x0b08('0x15')]);}else{logger[_0x0b08('0xd')](_0x0b08('0xe'),_0x59eb1f,_0x0b08('0x11'));_0x3b2f70(_0x5b205c[_0x0b08('0x16')][_0x0b08('0x15')]);}})[_0x0b08('0x17')](function(_0x1bfc4e){logger['error'](_0x0b08('0xe'),_0x59eb1f,_0x1bfc4e);_0x55c11e(_0x1bfc4e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 4e6a454..b6f2e1d 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3640ba,_0x20f42a){var _0x1624b8=function(_0x5c939f){while(--_0x5c939f){_0x3640ba['push'](_0x3640ba['shift']());}};_0x1624b8(++_0x20f42a);}(_0xe706,0xa3));var _0x6e70=function(_0x557e8a,_0xd2d09b){_0x557e8a=_0x557e8a-0x0;var _0x5c7f96=_0xe706[_0x557e8a];return _0x5c7f96;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ac53b,_0x31c1f1){var _0x6dcc75=function(_0x3a2a35){while(--_0x3a2a35){_0x1ac53b['push'](_0x1ac53b['shift']());}};_0x6dcc75(++_0x31c1f1);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1fdb6b8..7f40235 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 _0x29d1=['sequelize','INTEGER'];(function(_0x444199,_0x1acd8f){var _0x56cfc8=function(_0x1012b8){while(--_0x1012b8){_0x444199['push'](_0x444199['shift']());}};_0x56cfc8(++_0x1acd8f);}(_0x29d1,0x1d6));var _0x129d=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0x29d1[_0x497948];return _0x39bb36;};'use strict';var Sequelize=require(_0x129d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x129d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa50d=['sequelize','exports','INTEGER'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xa50d,0x7b));var _0xda50=function(_0x107a42,_0x244c12){_0x107a42=_0x107a42-0x0;var _0x4e8987=_0xa50d[_0x107a42];return _0x4e8987;};'use strict';var Sequelize=require(_0xda50('0x0'));module[_0xda50('0x1')]={'penalty':{'type':Sequelize[_0xda50('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 1c084b4..ab0c5f9 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 _0xc36b=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc36b,0x88));var _0xbc36=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xc36b[_0xd307d9];return _0x209bf8;};'use strict';var _=require(_0xbc36('0x0'));var util=require(_0xbc36('0x1'));var logger=require(_0xbc36('0x2'))(_0xbc36('0x3'));var moment=require(_0xbc36('0x4'));var BPromise=require(_0xbc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc36('0x6'));var config=require(_0xbc36('0x7'));var attributes=require(_0xbc36('0x8'));module['exports']=function(_0x576f5a,_0x13d538){return _0x576f5a[_0xbc36('0x9')](_0xbc36('0xa'),attributes,{'tableName':_0xbc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4d2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x256528,_0xd4e51b){var _0x5bddd8=function(_0x377b91){while(--_0x377b91){_0x256528['push'](_0x256528['shift']());}};_0x5bddd8(++_0xd4e51b);}(_0xf4d2,0xed));var _0x2f4d=function(_0x42cdf9,_0xe979ab){_0x42cdf9=_0x42cdf9-0x0;var _0x2e03e4=_0xf4d2[_0x42cdf9];return _0x2e03e4;};'use strict';var _=require(_0x2f4d('0x0'));var util=require('util');var logger=require(_0x2f4d('0x1'))(_0x2f4d('0x2'));var moment=require(_0x2f4d('0x3'));var BPromise=require(_0x2f4d('0x4'));var rp=require(_0x2f4d('0x5'));var fs=require('fs');var path=require(_0x2f4d('0x6'));var rimraf=require(_0x2f4d('0x7'));var config=require(_0x2f4d('0x8'));var attributes=require(_0x2f4d('0x9'));module[_0x2f4d('0xa')]=function(_0xc32919,_0x3b5d7f){return _0xc32919[_0x2f4d('0xb')](_0x2f4d('0xc'),attributes,{'tableName':_0x2f4d('0xd'),'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 e0eb936..6425f5e 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'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')]('UserMailQueue,\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']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x432e45,_0x276c2c){var _0x2db69d=function(_0x263747){while(--_0x263747){_0x432e45['push'](_0x432e45['shift']());}};_0x2db69d(++_0x276c2c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x10c2f6,_0x3b7c97){_0x10c2f6=_0x10c2f6-0x0;var _0x1ab0ad=_0x8ef6[_0x10c2f6];return _0x1ab0ad;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4b4247e..ce9206b 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 _0x6830=['express','Router','fs-extra','../../components/auth/service','../../config/environment','post','isAuthenticated','exports','multer','path','connect-timeout'];(function(_0x158b5e,_0x15009d){var _0x1728bb=function(_0x571bc5){while(--_0x571bc5){_0x158b5e['push'](_0x158b5e['shift']());}};_0x1728bb(++_0x15009d);}(_0x6830,0x189));var _0x0683=function(_0xc25778,_0xf5d1f6){_0xc25778=_0xc25778-0x0;var _0x314223=_0x6830[_0xc25778];return _0x314223;};'use strict';var multer=require(_0x0683('0x0'));var util=require('util');var path=require(_0x0683('0x1'));var timeout=require(_0x0683('0x2'));var express=require(_0x0683('0x3'));var router=express[_0x0683('0x4')]();var fs_extra=require(_0x0683('0x5'));var auth=require(_0x0683('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0683('0x7'));var controller=require('./userNotification.controller');router[_0x0683('0x8')]('/',auth[_0x0683('0x9')](),controller['sendUserNotification']);module[_0x0683('0xa')]=router; \ No newline at end of file +var _0x67a6=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x67a6,0x126));var _0x667a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x67a6[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x667a('0x0'));var util=require(_0x667a('0x1'));var path=require('path');var timeout=require(_0x667a('0x2'));var express=require(_0x667a('0x3'));var router=express['Router']();var fs_extra=require(_0x667a('0x4'));var auth=require(_0x667a('0x5'));var interaction=require(_0x667a('0x6'));var config=require(_0x667a('0x7'));var controller=require(_0x667a('0x8'));router['post']('/',auth[_0x667a('0x9')](),controller[_0x667a('0xa')]);module[_0x667a('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f845778..e0ae859 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 _0x59d7=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x477b5b,_0x57826a){var _0xd233ef=function(_0x55129a){while(--_0x55129a){_0x477b5b['push'](_0x477b5b['shift']());}};_0xd233ef(++_0x57826a);}(_0x59d7,0x1c0));var _0x759d=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x59d7[_0x34c027];return _0x47bff0;};'use strict';var Sequelize=require(_0x759d('0x0'));module[_0x759d('0x1')]={'body':{'type':Sequelize[_0x759d('0x2')]},'senderName':{'type':Sequelize[_0x759d('0x3')]},'recipientsId':{'type':Sequelize[_0x759d('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x759d('0x4')]}}; \ No newline at end of file +var _0xdc9e=['TEXT','BOOLEAN','exports','STRING'];(function(_0x1568cd,_0x264188){var _0x1ef117=function(_0x2f704a){while(--_0x2f704a){_0x1568cd['push'](_0x1568cd['shift']());}};_0x1ef117(++_0x264188);}(_0xdc9e,0xb2));var _0xedc9=function(_0x42149b,_0x3c453d){_0x42149b=_0x42149b-0x0;var _0x5ce3fc=_0xdc9e[_0x42149b];return _0x5ce3fc;};'use strict';var Sequelize=require('sequelize');module[_0xedc9('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xedc9('0x1')]},'recipientsId':{'type':Sequelize[_0xedc9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xedc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5680f8c..4deb15b 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 _0xee0e=['senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','ids','queue','Queue','all','union','flatten','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','body','text','hasOwnProperty','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object'];(function(_0x126053,_0x483750){var _0x38b025=function(_0x26bbd3){while(--_0x26bbd3){_0x126053['push'](_0x126053['shift']());}};_0x38b025(++_0x483750);}(_0xee0e,0x19a));var _0xeee0=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0xee0e[_0x56c70f];return _0x3812ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeee0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeee0('0x1'));var rp=require(_0xeee0('0x2'));var moment=require(_0xeee0('0x3'));var BPromise=require(_0xeee0('0x4'));var Mustache=require(_0xeee0('0x5'));var util=require(_0xeee0('0x6'));var path=require(_0xeee0('0x7'));var sox=require(_0xeee0('0x8'));var csv=require(_0xeee0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeee0('0xa'));var _=require(_0xeee0('0xb'));var squel=require(_0xeee0('0xc'));var crypto=require('crypto');var jsforce=require(_0xeee0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeee0('0x9'));var querystring=require(_0xeee0('0xe'));var Papa=require(_0xeee0('0xf'));var Redis=require(_0xeee0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xeee0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeee0('0x12'));var logger=require('../../config/logger')(_0xeee0('0x13'));var utils=require(_0xeee0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xeee0('0x15'));var db=require(_0xeee0('0x16'))['db'];config['redis']=_[_0xeee0('0x17')](config['redis'],{'host':_0xeee0('0x18'),'port':0x18eb});var socket=require(_0xeee0('0x19'))(new Redis(config[_0xeee0('0x1a')]));require(_0xeee0('0x1b'))['register'](socket);function respondWithStatusCode(_0x57f9b1,_0x3d9bdc){_0x3d9bdc=_0x3d9bdc||0xcc;return function(_0x348291){if(_0x348291){return _0x57f9b1[_0xeee0('0x1c')](_0x3d9bdc);}return _0x57f9b1[_0xeee0('0x1d')](_0x3d9bdc)['end']();};}function respondWithResult(_0x47f287,_0x4170e9){_0x4170e9=_0x4170e9||0xc8;return function(_0x48458c){if(_0x48458c){return _0x47f287[_0xeee0('0x1d')](_0x4170e9)[_0xeee0('0x1e')](_0x48458c);}};}function respondWithFilteredResult(_0x353b69,_0x7e77a3){return function(_0x1ecdff){if(_0x1ecdff){var _0x535fd7=typeof _0x7e77a3[_0xeee0('0x1f')]==='undefined'&&typeof _0x7e77a3[_0xeee0('0x20')]===_0xeee0('0x21');var _0x44ac9d=_0x1ecdff[_0xeee0('0x22')];var _0x3f33b1=_0x535fd7?0x0:_0x7e77a3[_0xeee0('0x1f')];var _0x41995f=_0x535fd7?_0x1ecdff[_0xeee0('0x22')]:_0x7e77a3[_0xeee0('0x1f')]+_0x7e77a3[_0xeee0('0x20')];var _0xfb7531;if(_0x41995f>=_0x44ac9d){_0x41995f=_0x44ac9d;_0xfb7531=0xc8;}else{_0xfb7531=0xce;}_0x353b69[_0xeee0('0x1d')](_0xfb7531);return _0x353b69[_0xeee0('0x23')](_0xeee0('0x24'),_0x3f33b1+'-'+_0x41995f+'/'+_0x44ac9d)[_0xeee0('0x1e')](_0x1ecdff);}return null;};}function patchUpdates(_0x70019b){return function(_0x3ee33e){try{jsonpatch[_0xeee0('0x25')](_0x3ee33e,_0x70019b,!![]);}catch(_0x137e00){return BPromise[_0xeee0('0x26')](_0x137e00);}return _0x3ee33e[_0xeee0('0x27')]();};}function saveUpdates(_0xb47c7d,_0x143cfb){return function(_0x33576e){if(_0x33576e){return _0x33576e[_0xeee0('0x28')](_0xb47c7d)[_0xeee0('0x29')](function(_0x3b7112){return _0x3b7112;});}return null;};}function removeEntity(_0x40ec21,_0xe6ffc4){return function(_0x5ed0bd){if(_0x5ed0bd){return _0x5ed0bd['destroy']()['then'](function(){_0x40ec21[_0xeee0('0x1d')](0xcc)[_0xeee0('0x2a')]();});}};}function handleEntityNotFound(_0x1474e9,_0x177490){return function(_0x3762c2){if(!_0x3762c2){_0x1474e9[_0xeee0('0x1c')](0x194);}return _0x3762c2;};}function handleError(_0x163653,_0x90814a){_0x90814a=_0x90814a||0x1f4;return function(_0x283157){logger[_0xeee0('0x2b')](_0x283157[_0xeee0('0x2c')]);if(_0x283157[_0xeee0('0x2d')]){delete _0x283157['name'];}_0x163653[_0xeee0('0x1d')](_0x90814a)[_0xeee0('0x2e')](_0x283157);};}exports['sendUserNotification']=function(_0x206434,_0x2a25c6,_0x54166c){if(!_0x206434[_0xeee0('0x2f')]['hasOwnProperty'](_0xeee0('0x30'))&&!_0x206434['body'][_0xeee0('0x31')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0xeee0('0x32'));}else{if(_0x206434['body']['hasOwnProperty'](_0xeee0('0x33'))&&!_0x206434['body']['hasOwnProperty']('view')){throw new db[(_0xeee0('0x34'))]['ValidationError'](_0xeee0('0x35'));}if(!_0x206434['body']['hasOwnProperty'](_0xeee0('0x36'))){throw new db[(_0xeee0('0x34'))][(_0xeee0('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x44108a=JSON[_0xeee0('0x38')](_0x206434['body']['recipients']);}catch(_0x28d1ad){logger['error'](_0x28d1ad);throw new db[(_0xeee0('0x34'))][(_0xeee0('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x344b9d=[_0xeee0('0x39'),_0xeee0('0x3a'),_0xeee0('0x3b'),_0xeee0('0x3c'),_0xeee0('0x3d'),'voicequeue',_0xeee0('0x3e'),_0xeee0('0x3f'),_0xeee0('0x40')];if(_[_0xeee0('0x41')](_0x44108a,function(_0x5edae4){return!_[_0xeee0('0x42')](_0x344b9d,_0x5edae4[_0xeee0('0x43')][_0xeee0('0x44')]());})){throw new db[(_0xeee0('0x34'))]['ValidationError'](_0xeee0('0x45'));}}}var _0x313248={};_0x313248['senderName']=_0x206434[_0xeee0('0x2f')][_0xeee0('0x31')](_0xeee0('0x46'))?_0x206434[_0xeee0('0x2f')]['senderName']:_0x206434[_0xeee0('0x40')][_0xeee0('0x47')];_0x313248[_0xeee0('0x48')]=_[_0xeee0('0x49')](_0x206434['body'][_0xeee0('0x48')])?null:_0x206434[_0xeee0('0x2f')][_0xeee0('0x48')];_0x313248[_0xeee0('0x4a')]=_0x206434['body'][_0xeee0('0x4a')]||![];_0x313248[_0xeee0('0x4b')]=_0x206434[_0xeee0('0x40')]['id'];return getContent(_0x206434['body'])['then'](function(_0x32b7c5){_0x313248[_0xeee0('0x2f')]=_0x32b7c5;return getRecipients(_0x44108a);})[_0xeee0('0x29')](function(_0x28ff9b){_0x313248[_0xeee0('0x4c')]=_['sortBy'](_0x28ff9b)[_0xeee0('0x4d')](',');return db[_0xeee0('0x4e')][_0xeee0('0x4f')](function(_0x35a02b){return db[_0xeee0('0x50')][_0xeee0('0x51')](_0x313248,{'raw':!![],'transaction':_0x35a02b})['then'](function(_0x4a870f){var _0x211a7a={'sender':_0x313248['senderName'],'description':_0x313248[_0xeee0('0x48')],'content':_0x313248[_0xeee0('0x2f')],'beep':_0x313248[_0xeee0('0x4a')]};_0x28ff9b[_0xeee0('0x52')](function(_0x27a0d2){_0x211a7a[_0xeee0('0x53')]=_0x27a0d2;socket['emit']('userNotification:send',_0x211a7a);});return _0x4a870f;});});})[_0xeee0('0x29')](respondWithResult(_0x2a25c6,0xc9))[_0xeee0('0x54')](handleError(_0x2a25c6,null));};function getContent(_0x7ba60b){return new BPromise(function(_0x3a2932,_0x1bc6b7){if(_0x7ba60b[_0xeee0('0x30')]){_0x3a2932(_0x7ba60b[_0xeee0('0x30')]);return;}return db['Template'][_0xeee0('0x55')]({'attributes':[_0xeee0('0x56')],'where':{'id':_0x7ba60b[_0xeee0('0x33')]},'raw':!![]})['then'](function(_0x3dd3a1){if(!_0x3dd3a1)throw new db[(_0xeee0('0x34'))]['ValidationError'](_0xeee0('0x57'));var _0x50864d=Mustache[_0xeee0('0x58')](_0x3dd3a1[_0xeee0('0x56')],_0x7ba60b[_0xeee0('0x59')]);_0x3a2932(_0x50864d);})[_0xeee0('0x54')](function(_0x84bdca){_0x1bc6b7(_0x84bdca);});});}function getRecipients(_0x14556b){return new BPromise(function(_0x428d27,_0x26687f){var _0x55236d=[];var _0x56177f=[];_0x14556b['forEach'](function(_0x5b63a8){var _0x41338d=_['startCase'](_0x5b63a8[_0xeee0('0x43')]['toLowerCase']());if(_0x41338d==='User'){_0x55236d=_['union'](_0x55236d,_0x5b63a8[_0xeee0('0x5a')]);}else{if(_[_0xeee0('0x42')](_0x41338d,'queue'))_0x41338d=_0x41338d['replace'](_0xeee0('0x5b'),_0xeee0('0x5c'));_0x5b63a8[_0xeee0('0x5a')][_0xeee0('0x52')](function(_0x27ae34){_0x56177f['push'](getAgents(_0x41338d,_0x27ae34));});}});return BPromise[_0xeee0('0x5d')](_0x56177f)[_0xeee0('0x29')](function(_0x20ac69){_0x55236d=_[_0xeee0('0x5e')](_0x55236d,_[_0xeee0('0x5f')](_0x20ac69));_0x428d27(_0x55236d);})['catch'](function(_0x395bd1){_0x26687f(_0x395bd1);});});}function getAgents(_0x38cc98,_0xa6f797){return new BPromise(function(_0x47050f,_0x3e2bd5){return db[_0x38cc98]['findOne']({'where':{'id':_0xa6f797}})[_0xeee0('0x29')](function(_0x27fab2){return _0x27fab2['getAgents']({'attributes':['id'],'raw':!![]})[_0xeee0('0x29')](function(_0x1621d5){var _0x56a5c6=_['map'](_0x1621d5,'id');_0x47050f(_0x56a5c6);});})['catch'](function(_0x4e4687){_0x3e2bd5(_0x4e4687);});});} \ No newline at end of file +var _0x4f6f=['sendUserNotification','hasOwnProperty','text','body','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','model','User','ids','queue','replace','Queue','all','union','flatten','getAgents','map','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send'];(function(_0x9df984,_0x632428){var _0x56c824=function(_0x5e220e){while(--_0x5e220e){_0x9df984['push'](_0x9df984['shift']());}};_0x56c824(++_0x632428);}(_0x4f6f,0x9e));var _0xf4f6=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x4f6f[_0x2074db];return _0x27324c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4f6('0x1'));var rp=require(_0xf4f6('0x2'));var moment=require('moment');var BPromise=require(_0xf4f6('0x3'));var Mustache=require('mustache');var util=require(_0xf4f6('0x4'));var path=require(_0xf4f6('0x5'));var sox=require(_0xf4f6('0x6'));var csv=require(_0xf4f6('0x7'));var ejs=require(_0xf4f6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4f6('0x9'));var _=require(_0xf4f6('0xa'));var squel=require(_0xf4f6('0xb'));var crypto=require('crypto');var jsforce=require(_0xf4f6('0xc'));var deskjs=require(_0xf4f6('0xd'));var toCsv=require(_0xf4f6('0x7'));var querystring=require(_0xf4f6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4f6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf4f6('0x10'));var hardwareService=require(_0xf4f6('0x11'));var logger=require(_0xf4f6('0x12'))(_0xf4f6('0x13'));var utils=require('../../config/utils');var config=require(_0xf4f6('0x14'));var licenseUtil=require(_0xf4f6('0x15'));var db=require(_0xf4f6('0x16'))['db'];config[_0xf4f6('0x17')]=_[_0xf4f6('0x18')](config['redis'],{'host':_0xf4f6('0x19'),'port':0x18eb});var socket=require(_0xf4f6('0x1a'))(new Redis(config[_0xf4f6('0x17')]));require(_0xf4f6('0x1b'))[_0xf4f6('0x1c')](socket);function respondWithStatusCode(_0x39a394,_0x4a2f24){_0x4a2f24=_0x4a2f24||0xcc;return function(_0x2577f1){if(_0x2577f1){return _0x39a394[_0xf4f6('0x1d')](_0x4a2f24);}return _0x39a394['status'](_0x4a2f24)[_0xf4f6('0x1e')]();};}function respondWithResult(_0x53f5a1,_0x525e37){_0x525e37=_0x525e37||0xc8;return function(_0x401a88){if(_0x401a88){return _0x53f5a1['status'](_0x525e37)[_0xf4f6('0x1f')](_0x401a88);}};}function respondWithFilteredResult(_0x354488,_0x4c1003){return function(_0x28e471){if(_0x28e471){var _0x1224d7=typeof _0x4c1003[_0xf4f6('0x20')]===_0xf4f6('0x21')&&typeof _0x4c1003[_0xf4f6('0x22')]==='undefined';var _0x2dbc13=_0x28e471[_0xf4f6('0x23')];var _0x3364c5=_0x1224d7?0x0:_0x4c1003['offset'];var _0x1fbd2b=_0x1224d7?_0x28e471[_0xf4f6('0x23')]:_0x4c1003[_0xf4f6('0x20')]+_0x4c1003[_0xf4f6('0x22')];var _0x2a2d94;if(_0x1fbd2b>=_0x2dbc13){_0x1fbd2b=_0x2dbc13;_0x2a2d94=0xc8;}else{_0x2a2d94=0xce;}_0x354488[_0xf4f6('0x24')](_0x2a2d94);return _0x354488[_0xf4f6('0x25')](_0xf4f6('0x26'),_0x3364c5+'-'+_0x1fbd2b+'/'+_0x2dbc13)['json'](_0x28e471);}return null;};}function patchUpdates(_0x311be6){return function(_0x2e5858){try{jsonpatch[_0xf4f6('0x27')](_0x2e5858,_0x311be6,!![]);}catch(_0x455ba6){return BPromise[_0xf4f6('0x28')](_0x455ba6);}return _0x2e5858[_0xf4f6('0x29')]();};}function saveUpdates(_0x11f77f,_0x42461a){return function(_0x411cf9){if(_0x411cf9){return _0x411cf9[_0xf4f6('0x2a')](_0x11f77f)['then'](function(_0x5da3ce){return _0x5da3ce;});}return null;};}function removeEntity(_0x4131d0,_0x41e1d9){return function(_0x3843d3){if(_0x3843d3){return _0x3843d3[_0xf4f6('0x2b')]()[_0xf4f6('0x2c')](function(){_0x4131d0['status'](0xcc)[_0xf4f6('0x1e')]();});}};}function handleEntityNotFound(_0x4e91b5,_0x1cff05){return function(_0x170867){if(!_0x170867){_0x4e91b5[_0xf4f6('0x1d')](0x194);}return _0x170867;};}function handleError(_0x1fa9e1,_0x51f9a3){_0x51f9a3=_0x51f9a3||0x1f4;return function(_0x496846){logger[_0xf4f6('0x2d')](_0x496846['stack']);if(_0x496846[_0xf4f6('0x2e')]){delete _0x496846[_0xf4f6('0x2e')];}_0x1fa9e1[_0xf4f6('0x24')](_0x51f9a3)[_0xf4f6('0x2f')](_0x496846);};}exports[_0xf4f6('0x30')]=function(_0x39b7e9,_0x26a2e9,_0x584ac4){if(!_0x39b7e9['body'][_0xf4f6('0x31')](_0xf4f6('0x32'))&&!_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x31')]('TemplateId')){throw new db[(_0xf4f6('0x34'))][(_0xf4f6('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x39b7e9['body'][_0xf4f6('0x31')]('TemplateId')&&!_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x31')]('view')){throw new db[(_0xf4f6('0x34'))][(_0xf4f6('0x35'))](_0xf4f6('0x36'));}if(!_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x31')](_0xf4f6('0x37'))){throw new db[(_0xf4f6('0x34'))][(_0xf4f6('0x35'))](_0xf4f6('0x38'));}else{try{var _0x51213d=JSON['parse'](_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x37')]);}catch(_0x160468){logger['error'](_0x160468);throw new db['Sequelize'][(_0xf4f6('0x35'))](_0xf4f6('0x39'));}var _0x2fe2ce=[_0xf4f6('0x3a'),_0xf4f6('0x3b'),'mailqueue',_0xf4f6('0x3c'),_0xf4f6('0x3d'),_0xf4f6('0x3e'),'whatsappqueue',_0xf4f6('0x3f'),_0xf4f6('0x40')];if(_[_0xf4f6('0x41')](_0x51213d,function(_0x1cfba4){return!_[_0xf4f6('0x42')](_0x2fe2ce,_0x1cfba4['model'][_0xf4f6('0x43')]());})){throw new db[(_0xf4f6('0x34'))][(_0xf4f6('0x35'))](_0xf4f6('0x44'));}}}var _0x532d73={};_0x532d73[_0xf4f6('0x45')]=_0x39b7e9['body'][_0xf4f6('0x31')](_0xf4f6('0x45'))?_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x45')]:_0x39b7e9['user'][_0xf4f6('0x46')];_0x532d73[_0xf4f6('0x47')]=_[_0xf4f6('0x48')](_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x47')])?null:_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x47')];_0x532d73[_0xf4f6('0x49')]=_0x39b7e9[_0xf4f6('0x33')][_0xf4f6('0x49')]||![];_0x532d73['SenderId']=_0x39b7e9[_0xf4f6('0x40')]['id'];return getContent(_0x39b7e9[_0xf4f6('0x33')])['then'](function(_0xed89c7){_0x532d73[_0xf4f6('0x33')]=_0xed89c7;return getRecipients(_0x51213d);})[_0xf4f6('0x2c')](function(_0x3ae217){_0x532d73[_0xf4f6('0x4a')]=_[_0xf4f6('0x4b')](_0x3ae217)[_0xf4f6('0x4c')](',');return db['sequelize'][_0xf4f6('0x4d')](function(_0xff3add){return db[_0xf4f6('0x4e')][_0xf4f6('0x4f')](_0x532d73,{'raw':!![],'transaction':_0xff3add})[_0xf4f6('0x2c')](function(_0x399eaa){var _0x48e89c={'sender':_0x532d73['senderName'],'description':_0x532d73[_0xf4f6('0x47')],'content':_0x532d73['body'],'beep':_0x532d73[_0xf4f6('0x49')]};_0x3ae217[_0xf4f6('0x50')](function(_0x9b2ef6){_0x48e89c[_0xf4f6('0x51')]=_0x9b2ef6;socket[_0xf4f6('0x52')](_0xf4f6('0x53'),_0x48e89c);});return _0x399eaa;});});})[_0xf4f6('0x2c')](respondWithResult(_0x26a2e9,0xc9))[_0xf4f6('0x54')](handleError(_0x26a2e9,null));};function getContent(_0x11ed60){return new BPromise(function(_0x1a4ba3,_0x2b92d6){if(_0x11ed60['text']){_0x1a4ba3(_0x11ed60[_0xf4f6('0x32')]);return;}return db[_0xf4f6('0x55')][_0xf4f6('0x56')]({'attributes':[_0xf4f6('0x57')],'where':{'id':_0x11ed60['TemplateId']},'raw':!![]})[_0xf4f6('0x2c')](function(_0x458509){if(!_0x458509)throw new db[(_0xf4f6('0x34'))][(_0xf4f6('0x35'))](_0xf4f6('0x58'));var _0x2b3091=Mustache[_0xf4f6('0x59')](_0x458509['html'],_0x11ed60[_0xf4f6('0x5a')]);_0x1a4ba3(_0x2b3091);})[_0xf4f6('0x54')](function(_0x35831a){_0x2b92d6(_0x35831a);});});}function getRecipients(_0x466dcc){return new BPromise(function(_0x5db461,_0x1efc11){var _0x235561=[];var _0x33263e=[];_0x466dcc['forEach'](function(_0x2762e8){var _0x57c112=_[_0xf4f6('0x5b')](_0x2762e8[_0xf4f6('0x5c')][_0xf4f6('0x43')]());if(_0x57c112===_0xf4f6('0x5d')){_0x235561=_['union'](_0x235561,_0x2762e8[_0xf4f6('0x5e')]);}else{if(_[_0xf4f6('0x42')](_0x57c112,_0xf4f6('0x5f')))_0x57c112=_0x57c112[_0xf4f6('0x60')](_0xf4f6('0x5f'),_0xf4f6('0x61'));_0x2762e8[_0xf4f6('0x5e')][_0xf4f6('0x50')](function(_0x220605){_0x33263e['push'](getAgents(_0x57c112,_0x220605));});}});return BPromise[_0xf4f6('0x62')](_0x33263e)['then'](function(_0x43fba9){_0x235561=_[_0xf4f6('0x63')](_0x235561,_[_0xf4f6('0x64')](_0x43fba9));_0x5db461(_0x235561);})[_0xf4f6('0x54')](function(_0x209ec9){_0x1efc11(_0x209ec9);});});}function getAgents(_0x28cda8,_0x18413e){return new BPromise(function(_0x5d81c2,_0x3cd6ee){return db[_0x28cda8][_0xf4f6('0x56')]({'where':{'id':_0x18413e}})['then'](function(_0x30053c){return _0x30053c[_0xf4f6('0x65')]({'attributes':['id'],'raw':!![]})[_0xf4f6('0x2c')](function(_0xa5657c){var _0xf621ca=_[_0xf4f6('0x66')](_0xa5657c,'id');_0x5d81c2(_0xf621ca);});})[_0xf4f6('0x54')](function(_0x2dbdc4){_0x3cd6ee(_0x2dbdc4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9e61f2f..771cbb5 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 _0xc6f3=['hook','exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x26b633,_0x4da9f1){var _0x2643fa=function(_0x27b7bb){while(--_0x27b7bb){_0x26b633['push'](_0x26b633['shift']());}};_0x2643fa(++_0x4da9f1);}(_0xc6f3,0x14a));var _0x3c6f=function(_0x64efe5,_0x4ddd0d){_0x64efe5=_0x64efe5-0x0;var _0x58bd4a=_0xc6f3[_0x64efe5];return _0x58bd4a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3c6f('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3c6f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3c6f('0x2'),'afterDestroy':_0x3c6f('0x3')};function emitEvent(_0x256d01){return function(_0x2e2b3a,_0x1d5a39,_0x5683ff){UserNotificationEvents[_0x3c6f('0x4')](_0x256d01+':'+_0x2e2b3a['id'],_0x2e2b3a);UserNotificationEvents[_0x3c6f('0x4')](_0x256d01,_0x2e2b3a);_0x5683ff(null);};}for(var e in events){if(events[_0x3c6f('0x5')](e)){var event=events[e];UserNotification[_0x3c6f('0x6')](e,emitEvent(event));}}module[_0x3c6f('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x3341=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3341,0x14b));var _0x1334=function(_0x3e4713,_0x31b249){_0x3e4713=_0x3e4713-0x0;var _0x547bb0=_0x3341[_0x3e4713];return _0x547bb0;};'use strict';var EventEmitter=require(_0x1334('0x0'));var UserNotification=require(_0x1334('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1334('0x2')](0x0);var events={'afterCreate':_0x1334('0x3'),'afterUpdate':_0x1334('0x4'),'afterDestroy':_0x1334('0x5')};function emitEvent(_0xa6036c){return function(_0x392a08,_0x3b16bc,_0xb81bd0){UserNotificationEvents[_0x1334('0x6')](_0xa6036c+':'+_0x392a08['id'],_0x392a08);UserNotificationEvents[_0x1334('0x6')](_0xa6036c,_0x392a08);_0xb81bd0(null);};}for(var e in events){if(events[_0x1334('0x7')](e)){var event=events[e];UserNotification[_0x1334('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 3190a48..d783312 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 _0x752b=['path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x752b,0x80));var _0xb752=function(_0x288428,_0xb112cc){_0x288428=_0x288428-0x0;var _0x56c232=_0x752b[_0x288428];return _0x56c232;};'use strict';var _=require(_0xb752('0x0'));var util=require(_0xb752('0x1'));var logger=require(_0xb752('0x2'))(_0xb752('0x3'));var moment=require(_0xb752('0x4'));var BPromise=require(_0xb752('0x5'));var rp=require(_0xb752('0x6'));var fs=require('fs');var path=require(_0xb752('0x7'));var rimraf=require('rimraf');var config=require(_0xb752('0x8'));var attributes=require(_0xb752('0x9'));module[_0xb752('0xa')]=function(_0x1907a7,_0x381310){return _0x1907a7[_0xb752('0xb')](_0xb752('0xc'),attributes,{'tableName':_0xb752('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb752('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6c82=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x5d115e,_0x35ce96){var _0x420939=function(_0x597832){while(--_0x597832){_0x5d115e['push'](_0x5d115e['shift']());}};_0x420939(++_0x35ce96);}(_0x6c82,0x1af));var _0x26c8=function(_0x720a75,_0x3108d4){_0x720a75=_0x720a75-0x0;var _0x3ced98=_0x6c82[_0x720a75];return _0x3ced98;};'use strict';var _=require(_0x26c8('0x0'));var util=require(_0x26c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x26c8('0x2'));var BPromise=require(_0x26c8('0x3'));var rp=require(_0x26c8('0x4'));var fs=require('fs');var path=require(_0x26c8('0x5'));var rimraf=require(_0x26c8('0x6'));var config=require(_0x26c8('0x7'));var attributes=require(_0x26c8('0x8'));module[_0x26c8('0x9')]=function(_0x365dbf,_0x3d7772){return _0x365dbf[_0x26c8('0xa')](_0x26c8('0xb'),attributes,{'tableName':_0x26c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x26c8('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1208d77..5166d90 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 _0x38c4=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3cd5c2,_0x13110f){var _0x577f82=function(_0x174ab1){while(--_0x174ab1){_0x3cd5c2['push'](_0x3cd5c2['shift']());}};_0x577f82(++_0x13110f);}(_0x38c4,0x146));var _0x438c=function(_0x417346,_0x1e4dc3){_0x417346=_0x417346-0x0;var _0x3f3784=_0x38c4[_0x417346];return _0x3f3784;};'use strict';var _=require(_0x438c('0x0'));var util=require(_0x438c('0x1'));var moment=require(_0x438c('0x2'));var BPromise=require(_0x438c('0x3'));var rs=require(_0x438c('0x4'));var fs=require('fs');var Redis=require(_0x438c('0x5'));var db=require(_0x438c('0x6'))['db'];var utils=require(_0x438c('0x7'));var logger=require(_0x438c('0x8'))('rpc');var config=require(_0x438c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x438c('0xa')][_0x438c('0xb')]({'port':0x232a});config[_0x438c('0xc')]=_['defaults'](config['redis'],{'host':_0x438c('0xd'),'port':0x18eb});var socket=require(_0x438c('0xe'))(new Redis(config['redis']));require(_0x438c('0xf'))[_0x438c('0x10')](socket);function respondWithRpcPromise(_0x27a039,_0x258d8f,_0x35b559){return new BPromise(function(_0x3bc9a3,_0x2f77d8){return client[_0x438c('0x11')](_0x27a039,_0x35b559)[_0x438c('0x12')](function(_0x53d5ca){logger[_0x438c('0x13')](_0x438c('0x14'),_0x258d8f,_0x438c('0x15'));logger[_0x438c('0x16')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x258d8f,_0x438c('0x15'),JSON[_0x438c('0x17')](_0x53d5ca));if(_0x53d5ca[_0x438c('0x18')]){if(_0x53d5ca['error']['code']===0x1f4){logger[_0x438c('0x18')](_0x438c('0x14'),_0x258d8f,_0x53d5ca[_0x438c('0x18')][_0x438c('0x19')]);return _0x2f77d8(_0x53d5ca[_0x438c('0x18')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x258d8f,_0x53d5ca['error']['message']);return _0x3bc9a3(_0x53d5ca[_0x438c('0x18')]['message']);}else{logger[_0x438c('0x13')]('UserNotification,\x20%s,\x20%s',_0x258d8f,_0x438c('0x15'));_0x3bc9a3(_0x53d5ca[_0x438c('0x1a')][_0x438c('0x19')]);}})['catch'](function(_0x4c2ed4){logger['error'](_0x438c('0x14'),_0x258d8f,_0x4c2ed4);_0x2f77d8(_0x4c2ed4);});});} \ No newline at end of file +var _0xae74=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xae74,0x109));var _0x4ae7=function(_0x56b6dd,_0x35177d){_0x56b6dd=_0x56b6dd-0x0;var _0x1ad5a9=_0xae74[_0x56b6dd];return _0x1ad5a9;};'use strict';var _=require(_0x4ae7('0x0'));var util=require(_0x4ae7('0x1'));var moment=require('moment');var BPromise=require(_0x4ae7('0x2'));var rs=require(_0x4ae7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae7('0x4'))['db'];var utils=require(_0x4ae7('0x5'));var logger=require('../../config/logger')(_0x4ae7('0x6'));var config=require(_0x4ae7('0x7'));var jayson=require(_0x4ae7('0x8'));var client=jayson['client'][_0x4ae7('0x9')]({'port':0x232a});config[_0x4ae7('0xa')]=_[_0x4ae7('0xb')](config[_0x4ae7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae7('0xc'))(new Redis(config[_0x4ae7('0xa')]));require(_0x4ae7('0xd'))[_0x4ae7('0xe')](socket);function respondWithRpcPromise(_0x4c9c29,_0x378c08,_0x3e496b){return new BPromise(function(_0x753f0c,_0x4b504a){return client[_0x4ae7('0xf')](_0x4c9c29,_0x3e496b)[_0x4ae7('0x10')](function(_0x326cd3){logger[_0x4ae7('0x11')](_0x4ae7('0x12'),_0x378c08,_0x4ae7('0x13'));logger['debug'](_0x4ae7('0x14'),_0x378c08,_0x4ae7('0x13'),JSON['stringify'](_0x326cd3));if(_0x326cd3[_0x4ae7('0x15')]){if(_0x326cd3[_0x4ae7('0x15')][_0x4ae7('0x16')]===0x1f4){logger[_0x4ae7('0x15')](_0x4ae7('0x12'),_0x378c08,_0x326cd3['error'][_0x4ae7('0x17')]);return _0x4b504a(_0x326cd3[_0x4ae7('0x15')][_0x4ae7('0x17')]);}logger[_0x4ae7('0x15')]('UserNotification,\x20%s,\x20%s',_0x378c08,_0x326cd3['error'][_0x4ae7('0x17')]);return _0x753f0c(_0x326cd3['error'][_0x4ae7('0x17')]);}else{logger['info'](_0x4ae7('0x12'),_0x378c08,_0x4ae7('0x13'));_0x753f0c(_0x326cd3[_0x4ae7('0x18')][_0x4ae7('0x17')]);}})[_0x4ae7('0x19')](function(_0x1a411c){logger[_0x4ae7('0x15')](_0x4ae7('0x12'),_0x378c08,_0x1a411c);_0x4b504a(_0x1a411c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index db759df..4393efc 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 _0xfeb9=['./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x574788,_0x40c554){var _0x341897=function(_0x357342){while(--_0x357342){_0x574788['push'](_0x574788['shift']());}};_0x341897(++_0x40c554);}(_0xfeb9,0x1ce));var _0x9feb=function(_0x2c81c9,_0x511fea){_0x2c81c9=_0x2c81c9-0x0;var _0x594625=_0xfeb9[_0x2c81c9];return _0x594625;};'use strict';var UserNotificationEvents=require(_0x9feb('0x0'));var events=[_0x9feb('0x1'),_0x9feb('0x2'),_0x9feb('0x3')];function createListener(_0x38279,_0x4132a8){return function(_0x4cb8d8){_0x4132a8[_0x9feb('0x4')](_0x38279,_0x4cb8d8);};}function removeListener(_0x2b041d,_0x619544){return function(){UserNotificationEvents[_0x9feb('0x5')](_0x2b041d,_0x619544);};}exports[_0x9feb('0x6')]=function(_0x469b52){for(var _0x3151ac=0x0,_0x2cb42c=events['length'];_0x3151ac<_0x2cb42c;_0x3151ac++){var _0x26c478=events[_0x3151ac];var _0x482c46=createListener('userNotification:'+_0x26c478,_0x469b52);UserNotificationEvents['on'](_0x26c478,_0x482c46);}}; \ No newline at end of file +var _0x6194=['update','emit','register','userNotification:','./userNotification.events'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6194,0x17b));var _0x4619=function(_0x4e78a0,_0x5d72cc){_0x4e78a0=_0x4e78a0-0x0;var _0xea8bf1=_0x6194[_0x4e78a0];return _0xea8bf1;};'use strict';var UserNotificationEvents=require(_0x4619('0x0'));var events=['save','remove',_0x4619('0x1')];function createListener(_0x43c7a7,_0x4a5c5b){return function(_0x5cccb9){_0x4a5c5b[_0x4619('0x2')](_0x43c7a7,_0x5cccb9);};}function removeListener(_0x28bbb9,_0x3975dc){return function(){UserNotificationEvents['removeListener'](_0x28bbb9,_0x3975dc);};}exports[_0x4619('0x3')]=function(_0x4430f9){for(var _0x500a6c=0x0,_0x2dc00d=events['length'];_0x500a6c<_0x2dc00d;_0x500a6c++){var _0x1d43a6=events[_0x500a6c];var _0x18170d=createListener(_0x4619('0x4')+_0x1d43a6,_0x4430f9);UserNotificationEvents['on'](_0x1d43a6,_0x18170d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cc9c0dd..bf02fac 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2c8d3c,_0x592522){var _0x52a455=function(_0x53481d){while(--_0x53481d){_0x2c8d3c['push'](_0x2c8d3c['shift']());}};_0x52a455(++_0x592522);}(_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 e9934c4..6b80cdb 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 _0xcb1c=['sequelize','INTEGER'];(function(_0xe94c5d,_0xe557fe){var _0x3cb098=function(_0x23a0a4){while(--_0x23a0a4){_0xe94c5d['push'](_0xe94c5d['shift']());}};_0x3cb098(++_0xe557fe);}(_0xcb1c,0x1f0));var _0xccb1=function(_0x92f772,_0x4eee07){_0x92f772=_0x92f772-0x0;var _0x437a18=_0xcb1c[_0x92f772];return _0x437a18;};'use strict';var Sequelize=require(_0xccb1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xccb1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x579f=['exports','sequelize'];(function(_0x31badb,_0x100ecd){var _0x10643e=function(_0x3fd8b1){while(--_0x3fd8b1){_0x31badb['push'](_0x31badb['shift']());}};_0x10643e(++_0x100ecd);}(_0x579f,0x14d));var _0xf579=function(_0x20869c,_0x3eab71){_0x20869c=_0x20869c-0x0;var _0x27989a=_0x579f[_0x20869c];return _0x27989a;};'use strict';var Sequelize=require(_0xf579('0x0'));module[_0xf579('0x1')]={'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 cce4c89..402f8da 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 _0x2466=['UserOpenchannelQueue','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2466,0xf1));var _0x6246=function(_0x41624f,_0x4b78fb){_0x41624f=_0x41624f-0x0;var _0x3d3d5f=_0x2466[_0x41624f];return _0x3d3d5f;};'use strict';var _=require(_0x6246('0x0'));var util=require(_0x6246('0x1'));var logger=require('../../config/logger')(_0x6246('0x2'));var moment=require('moment');var BPromise=require(_0x6246('0x3'));var rp=require(_0x6246('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6246('0x5'));var config=require(_0x6246('0x6'));var attributes=require(_0x6246('0x7'));module['exports']=function(_0x517f17,_0x5112d3){return _0x517f17[_0x6246('0x8')](_0x6246('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb96=['request-promise','path','rimraf','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x7a48ce,_0x410cf6){var _0x2dd940=function(_0x3ceaf9){while(--_0x3ceaf9){_0x7a48ce['push'](_0x7a48ce['shift']());}};_0x2dd940(++_0x410cf6);}(_0xeb96,0x1c9));var _0x6eb9=function(_0x24b302,_0x2c1b76){_0x24b302=_0x24b302-0x0;var _0x46b81e=_0xeb96[_0x24b302];return _0x46b81e;};'use strict';var _=require(_0x6eb9('0x0'));var util=require(_0x6eb9('0x1'));var logger=require(_0x6eb9('0x2'))(_0x6eb9('0x3'));var moment=require(_0x6eb9('0x4'));var BPromise=require('bluebird');var rp=require(_0x6eb9('0x5'));var fs=require('fs');var path=require(_0x6eb9('0x6'));var rimraf=require(_0x6eb9('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x6eb9('0x8')]=function(_0x4f7e1c,_0x3769ce){return _0x4f7e1c['define'](_0x6eb9('0x9'),attributes,{'tableName':_0x6eb9('0xa'),'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 5e1317b..5f9f5c2 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 _0x2514=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0x2514,0xea));var _0x4251=function(_0x4f721b,_0x56408d){_0x4f721b=_0x4f721b-0x0;var _0x178be9=_0x2514[_0x4f721b];return _0x178be9;};'use strict';var _=require(_0x4251('0x0'));var util=require(_0x4251('0x1'));var moment=require(_0x4251('0x2'));var BPromise=require(_0x4251('0x3'));var rs=require(_0x4251('0x4'));var fs=require('fs');var Redis=require(_0x4251('0x5'));var db=require(_0x4251('0x6'))['db'];var utils=require(_0x4251('0x7'));var logger=require(_0x4251('0x8'))(_0x4251('0x9'));var config=require(_0x4251('0xa'));var jayson=require(_0x4251('0xb'));var client=jayson[_0x4251('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ced12,_0x106caf,_0x1207ca){return new BPromise(function(_0x6445ad,_0x1b1022){return client[_0x4251('0xd')](_0x4ced12,_0x1207ca)[_0x4251('0xe')](function(_0x41f493){logger[_0x4251('0xf')](_0x4251('0x10'),_0x106caf,_0x4251('0x11'));logger[_0x4251('0x12')](_0x4251('0x13'),_0x106caf,_0x4251('0x11'),JSON['stringify'](_0x41f493));if(_0x41f493[_0x4251('0x14')]){if(_0x41f493[_0x4251('0x14')]['code']===0x1f4){logger[_0x4251('0x14')](_0x4251('0x10'),_0x106caf,_0x41f493['error'][_0x4251('0x15')]);return _0x1b1022(_0x41f493[_0x4251('0x14')][_0x4251('0x15')]);}logger['error'](_0x4251('0x10'),_0x106caf,_0x41f493[_0x4251('0x14')][_0x4251('0x15')]);return _0x6445ad(_0x41f493['error']['message']);}else{logger[_0x4251('0xf')](_0x4251('0x10'),_0x106caf,_0x4251('0x11'));_0x6445ad(_0x41f493['result']['message']);}})[_0x4251('0x16')](function(_0x4d76e9){logger[_0x4251('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x106caf,_0x4d76e9);_0x1b1022(_0x4d76e9);});});} \ No newline at end of file +var _0x68fb=['stringify','error','code','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x584d37,_0x13fb20){var _0x1a1dbf=function(_0x23cd11){while(--_0x23cd11){_0x584d37['push'](_0x584d37['shift']());}};_0x1a1dbf(++_0x13fb20);}(_0x68fb,0x1d1));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb68f('0x0'));var moment=require('moment');var BPromise=require(_0xb68f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb68f('0x2'));var db=require(_0xb68f('0x3'))['db'];var utils=require(_0xb68f('0x4'));var logger=require(_0xb68f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb68f('0x6'));var client=jayson[_0xb68f('0x7')][_0xb68f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41504f,_0x29701d,_0x398de0){return new BPromise(function(_0x20d57f,_0x2a006d){return client[_0xb68f('0x9')](_0x41504f,_0x398de0)[_0xb68f('0xa')](function(_0x35e071){logger[_0xb68f('0xb')](_0xb68f('0xc'),_0x29701d,_0xb68f('0xd'));logger[_0xb68f('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x29701d,_0xb68f('0xd'),JSON[_0xb68f('0xf')](_0x35e071));if(_0x35e071[_0xb68f('0x10')]){if(_0x35e071[_0xb68f('0x10')][_0xb68f('0x11')]===0x1f4){logger[_0xb68f('0x10')](_0xb68f('0xc'),_0x29701d,_0x35e071[_0xb68f('0x10')][_0xb68f('0x12')]);return _0x2a006d(_0x35e071['error'][_0xb68f('0x12')]);}logger[_0xb68f('0x10')](_0xb68f('0xc'),_0x29701d,_0x35e071['error'][_0xb68f('0x12')]);return _0x20d57f(_0x35e071[_0xb68f('0x10')][_0xb68f('0x12')]);}else{logger['info'](_0xb68f('0xc'),_0x29701d,_0xb68f('0xd'));_0x20d57f(_0x35e071[_0xb68f('0x13')][_0xb68f('0x12')]);}})['catch'](function(_0x2fe713){logger[_0xb68f('0x10')](_0xb68f('0xc'),_0x29701d,_0x2fe713);_0x2a006d(_0x2fe713);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2e4a5a1..7ef3d5b 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 _0x35cf=['/:id','show','/:id/sections','/:id/resources','getResources','create','/:id/clone','clone','post','addSections','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe'];(function(_0xd622ea,_0x133e69){var _0x45d09f=function(_0x1a876a){while(--_0x1a876a){_0xd622ea['push'](_0xd622ea['shift']());}};_0x45d09f(++_0x133e69);}(_0x35cf,0xbf));var _0xf35c=function(_0x3b6668,_0x3b3c41){_0x3b6668=_0x3b6668-0x0;var _0x4e47e6=_0x35cf[_0x3b6668];return _0x4e47e6;};'use strict';var multer=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var path=require(_0xf35c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf35c('0x3')]();var fs_extra=require(_0xf35c('0x4'));var auth=require(_0xf35c('0x5'));var interaction=require(_0xf35c('0x6'));var config=require(_0xf35c('0x7'));var controller=require(_0xf35c('0x8'));router[_0xf35c('0x9')]('/',auth[_0xf35c('0xa')](),controller['index']);router[_0xf35c('0x9')](_0xf35c('0xb'),auth[_0xf35c('0xa')](),controller['describe']);router[_0xf35c('0x9')](_0xf35c('0xc'),auth[_0xf35c('0xa')](),controller[_0xf35c('0xd')]);router[_0xf35c('0x9')](_0xf35c('0xe'),auth[_0xf35c('0xa')](),controller['getSections']);router[_0xf35c('0x9')](_0xf35c('0xf'),auth[_0xf35c('0xa')](),controller[_0xf35c('0x10')]);router['post']('/',auth[_0xf35c('0xa')](),controller[_0xf35c('0x11')]);router['post'](_0xf35c('0x12'),auth[_0xf35c('0xa')](),controller[_0xf35c('0x13')]);router[_0xf35c('0x14')](_0xf35c('0xe'),auth[_0xf35c('0xa')](),controller[_0xf35c('0x15')]);router['post']('/:id/resources',auth[_0xf35c('0xa')](),controller[_0xf35c('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf35c('0x17')]);router[_0xf35c('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xf35c('0x19')]);router[_0xf35c('0x18')]('/:id/sections',auth[_0xf35c('0xa')](),controller[_0xf35c('0x1a')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0xf35c('0x1b')]);module[_0xf35c('0x1c')]=router; \ No newline at end of file +var _0x65a6=['../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','update','destroy','delete','removeSections','removeResources','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x65a6,0x19e));var _0x665a=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x65a6[_0x1ba43c];return _0x2f60eb;};'use strict';var multer=require(_0x665a('0x0'));var util=require(_0x665a('0x1'));var path=require('path');var timeout=require(_0x665a('0x2'));var express=require('express');var router=express[_0x665a('0x3')]();var fs_extra=require(_0x665a('0x4'));var auth=require(_0x665a('0x5'));var interaction=require(_0x665a('0x6'));var config=require(_0x665a('0x7'));var controller=require(_0x665a('0x8'));router[_0x665a('0x9')]('/',auth[_0x665a('0xa')](),controller[_0x665a('0xb')]);router[_0x665a('0x9')](_0x665a('0xc'),auth[_0x665a('0xa')](),controller[_0x665a('0xd')]);router[_0x665a('0x9')](_0x665a('0xe'),auth['isAuthenticated'](),controller[_0x665a('0xf')]);router[_0x665a('0x9')](_0x665a('0x10'),auth[_0x665a('0xa')](),controller['getSections']);router[_0x665a('0x9')](_0x665a('0x11'),auth[_0x665a('0xa')](),controller[_0x665a('0x12')]);router[_0x665a('0x13')]('/',auth[_0x665a('0xa')](),controller[_0x665a('0x14')]);router[_0x665a('0x13')](_0x665a('0x15'),auth[_0x665a('0xa')](),controller[_0x665a('0x16')]);router['post'](_0x665a('0x10'),auth['isAuthenticated'](),controller['addSections']);router[_0x665a('0x13')](_0x665a('0x11'),auth[_0x665a('0xa')](),controller[_0x665a('0x17')]);router[_0x665a('0x18')](_0x665a('0xe'),auth[_0x665a('0xa')](),controller[_0x665a('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x665a('0x1a')]);router[_0x665a('0x1b')]('/:id/sections',auth[_0x665a('0xa')](),controller[_0x665a('0x1c')]);router['delete'](_0x665a('0x11'),auth[_0x665a('0xa')](),controller[_0x665a('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fb5a761..776547f 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 _0x07a3=['split','BOOLEAN','sequelize','STRING','name','join','crudPermissions'];(function(_0x5c4c36,_0x506043){var _0xe3c7ab=function(_0x31f3fe){while(--_0x31f3fe){_0x5c4c36['push'](_0x5c4c36['shift']());}};_0xe3c7ab(++_0x506043);}(_0x07a3,0x17c));var _0x307a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x07a3[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x307a('0x0'));module['exports']={'name':{'type':Sequelize[_0x307a('0x1')],'allowNull':![],'unique':_0x307a('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4b407a){this['setDataValue']('crudPermissions',_0x4b407a?_0x4b407a[_0x307a('0x3')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x307a('0x4'))[_0x307a('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x307a('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x307a('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x307a('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x229c=['getDataValue','split','BOOLEAN','exports','STRING','join'];(function(_0x12db95,_0x58fc5e){var _0x1c612e=function(_0x3db7b5){while(--_0x3db7b5){_0x12db95['push'](_0x12db95['shift']());}};_0x1c612e(++_0x58fc5e);}(_0x229c,0x117));var _0xc229=function(_0xa79959,_0xb102f3){_0xa79959=_0xa79959-0x0;var _0xbc8f3c=_0x229c[_0xa79959];return _0xbc8f3c;};'use strict';var Sequelize=require('sequelize');module[_0xc229('0x0')]={'name':{'type':Sequelize[_0xc229('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xc229('0x1')],'set':function(_0x2a3069){this['setDataValue']('crudPermissions',_0x2a3069?_0x2a3069[_0xc229('0x2')](''):[]);},'get':function(){return this[_0xc229('0x3')]('crudPermissions')?this[_0xc229('0x3')]('crudPermissions')[_0xc229('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc229('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc229('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc229('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc229('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc229('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 26d5473..7822398 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 _0xd142=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','catch','clone','get','createdAt','updatedAt','body','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','update','find','destroy','describe','addSections','push','removeSections','getSections','enabled','includes','subsections','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x23d45d,_0x19fdd2){var _0x418bad=function(_0xe94a25){while(--_0xe94a25){_0x23d45d['push'](_0x23d45d['shift']());}};_0x418bad(++_0x19fdd2);}(_0xd142,0x11a));var _0x2d14=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0xd142[_0x5e2489];return _0xa87596;};'use strict';var emlformat=require(_0x2d14('0x0'));var rimraf=require(_0x2d14('0x1'));var zipdir=require(_0x2d14('0x2'));var jsonpatch=require(_0x2d14('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d14('0x4'));var Mustache=require(_0x2d14('0x5'));var util=require(_0x2d14('0x6'));var path=require(_0x2d14('0x7'));var sox=require(_0x2d14('0x8'));var csv=require(_0x2d14('0x9'));var ejs=require(_0x2d14('0xa'));var fs=require('fs');var fs_extra=require(_0x2d14('0xb'));var _=require(_0x2d14('0xc'));var squel=require(_0x2d14('0xd'));var crypto=require(_0x2d14('0xe'));var jsforce=require(_0x2d14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2d14('0x9'));var querystring=require(_0x2d14('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d14('0x11'));var authService=require(_0x2d14('0x12'));var qs=require(_0x2d14('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d14('0x14'));var logger=require(_0x2d14('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2d14('0x16'));var licenseUtil=require(_0x2d14('0x17'));var db=require(_0x2d14('0x18'))['db'];config['redis']=_[_0x2d14('0x19')](config[_0x2d14('0x1a')],{'host':_0x2d14('0x1b'),'port':0x18eb});var socket=require(_0x2d14('0x1c'))(new Redis(config['redis']));require(_0x2d14('0x1d'))[_0x2d14('0x1e')](socket);function respondWithStatusCode(_0x488250,_0x2512df){_0x2512df=_0x2512df||0xcc;return function(_0x2c2b4a){if(_0x2c2b4a){return _0x488250[_0x2d14('0x1f')](_0x2512df);}return _0x488250[_0x2d14('0x20')](_0x2512df)[_0x2d14('0x21')]();};}function respondWithResult(_0x5e6095,_0x3a0e8e){_0x3a0e8e=_0x3a0e8e||0xc8;return function(_0x19fc2f){if(_0x19fc2f){return _0x5e6095[_0x2d14('0x20')](_0x3a0e8e)[_0x2d14('0x22')](_0x19fc2f);}};}function respondWithFilteredResult(_0x27b6a3,_0x5ac4a5){return function(_0x427c26){if(_0x427c26){var _0x45f5c9=typeof _0x5ac4a5[_0x2d14('0x23')]===_0x2d14('0x24')&&typeof _0x5ac4a5['limit']==='undefined';var _0x21385a=_0x427c26['count'];var _0x48873a=_0x45f5c9?0x0:_0x5ac4a5[_0x2d14('0x23')];var _0x3c930f=_0x45f5c9?_0x427c26[_0x2d14('0x25')]:_0x5ac4a5['offset']+_0x5ac4a5[_0x2d14('0x26')];var _0x3be304;if(_0x3c930f>=_0x21385a){_0x3c930f=_0x21385a;_0x3be304=0xc8;}else{_0x3be304=0xce;}_0x27b6a3['status'](_0x3be304);return _0x27b6a3[_0x2d14('0x27')](_0x2d14('0x28'),_0x48873a+'-'+_0x3c930f+'/'+_0x21385a)['json'](_0x427c26);}return null;};}function patchUpdates(_0x18c2b4){return function(_0x1162d7){try{jsonpatch[_0x2d14('0x29')](_0x1162d7,_0x18c2b4,!![]);}catch(_0x1ca76f){return BPromise[_0x2d14('0x2a')](_0x1ca76f);}return _0x1162d7['save']();};}function saveUpdates(_0x334ff7,_0x5d6ab5){return function(_0x27548e){if(_0x27548e){return _0x27548e['update'](_0x334ff7)['then'](function(_0x2af2cf){return _0x2af2cf;});}return null;};}function removeEntity(_0x1b32e2,_0x2724f3){return function(_0x4571d5){if(_0x4571d5){return _0x4571d5['destroy']()[_0x2d14('0x2b')](function(){_0x1b32e2[_0x2d14('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16fa67,_0x35ace8){return function(_0x572720){if(!_0x572720){_0x16fa67[_0x2d14('0x1f')](0x194);}return _0x572720;};}function handleError(_0x429c97,_0x5988f1){_0x5988f1=_0x5988f1||0x1f4;return function(_0x2813b1){logger[_0x2d14('0x2c')](_0x2813b1[_0x2d14('0x2d')]);if(_0x2813b1[_0x2d14('0x2e')]){delete _0x2813b1[_0x2d14('0x2e')];}_0x429c97[_0x2d14('0x20')](_0x5988f1)[_0x2d14('0x2f')](_0x2813b1);};}exports[_0x2d14('0x30')]=function(_0x4eee8a,_0xd4edb0){var _0x1415dd={},_0x1a086a={},_0x1da82a={'count':0x0,'rows':[]};var _0x55ccb5=_[_0x2d14('0x31')](db[_0x2d14('0x32')][_0x2d14('0x33')],function(_0x4e8980){return{'name':_0x4e8980[_0x2d14('0x34')],'type':_0x4e8980[_0x2d14('0x35')][_0x2d14('0x36')]};});_0x1a086a[_0x2d14('0x37')]=_[_0x2d14('0x31')](_0x55ccb5,_0x2d14('0x2e'));_0x1a086a[_0x2d14('0x38')]=_[_0x2d14('0x39')](_0x4eee8a['query']);_0x1a086a[_0x2d14('0x3a')]=_[_0x2d14('0x3b')](_0x1a086a[_0x2d14('0x37')],_0x1a086a[_0x2d14('0x38')]);_0x1415dd[_0x2d14('0x3c')]=_['intersection'](_0x1a086a[_0x2d14('0x37')],qs[_0x2d14('0x3d')](_0x4eee8a[_0x2d14('0x38')][_0x2d14('0x3d')]));_0x1415dd[_0x2d14('0x3c')]=_0x1415dd['attributes'][_0x2d14('0x3e')]?_0x1415dd[_0x2d14('0x3c')]:_0x1a086a[_0x2d14('0x37')];if(!_0x4eee8a[_0x2d14('0x38')][_0x2d14('0x3f')](_0x2d14('0x40'))){_0x1415dd['limit']=qs[_0x2d14('0x26')](_0x4eee8a['query'][_0x2d14('0x26')]);_0x1415dd[_0x2d14('0x23')]=qs[_0x2d14('0x23')](_0x4eee8a[_0x2d14('0x38')][_0x2d14('0x23')]);}_0x1415dd[_0x2d14('0x41')]=qs[_0x2d14('0x42')](_0x4eee8a['query'][_0x2d14('0x42')]);_0x1415dd[_0x2d14('0x43')]=qs[_0x2d14('0x3a')](_[_0x2d14('0x44')](_0x4eee8a[_0x2d14('0x38')],_0x1a086a['filters']),_0x55ccb5);if(_0x4eee8a[_0x2d14('0x38')][_0x2d14('0x45')]){_0x1415dd[_0x2d14('0x43')]=_[_0x2d14('0x46')](_0x1415dd[_0x2d14('0x43')],{'$or':_[_0x2d14('0x31')](_0x55ccb5,function(_0x2324d9){if(_0x2324d9[_0x2d14('0x35')]!==_0x2d14('0x47')){var _0xc61860={};_0xc61860[_0x2324d9[_0x2d14('0x2e')]]={'$like':'%'+_0x4eee8a[_0x2d14('0x38')][_0x2d14('0x45')]+'%'};return _0xc61860;}})});}_0x1415dd=_[_0x2d14('0x46')]({},_0x1415dd,_0x4eee8a[_0x2d14('0x48')]);var _0x5f2ef6={'where':_0x1415dd[_0x2d14('0x43')]};return db[_0x2d14('0x32')][_0x2d14('0x25')](_0x5f2ef6)[_0x2d14('0x2b')](function(_0x5e106c){_0x1da82a[_0x2d14('0x25')]=_0x5e106c;if(_0x4eee8a[_0x2d14('0x38')]['includeAll']){_0x1415dd[_0x2d14('0x49')]=[{'all':!![]}];}return db[_0x2d14('0x32')][_0x2d14('0x4a')](_0x1415dd);})[_0x2d14('0x2b')](function(_0x27e50e){_0x1da82a[_0x2d14('0x4b')]=_0x27e50e;return _0x1da82a;})['then'](respondWithFilteredResult(_0xd4edb0,_0x1415dd))['catch'](handleError(_0xd4edb0,null));};exports[_0x2d14('0x4c')]=function(_0x925531,_0x9eec0e){var _0x9b4ab={'raw':![],'where':{'id':_0x925531[_0x2d14('0x4d')]['id']}},_0x533220={};_0x533220[_0x2d14('0x37')]=_[_0x2d14('0x39')](db[_0x2d14('0x32')][_0x2d14('0x33')]);_0x533220[_0x2d14('0x38')]=_[_0x2d14('0x39')](_0x925531[_0x2d14('0x38')]);_0x533220[_0x2d14('0x3a')]=_[_0x2d14('0x3b')](_0x533220['model'],_0x533220[_0x2d14('0x38')]);_0x9b4ab[_0x2d14('0x3c')]=_[_0x2d14('0x3b')](_0x533220[_0x2d14('0x37')],qs['fields'](_0x925531['query'][_0x2d14('0x3d')]));_0x9b4ab['attributes']=_0x9b4ab['attributes']['length']?_0x9b4ab[_0x2d14('0x3c')]:_0x533220['model'];if(_0x925531[_0x2d14('0x38')][_0x2d14('0x4e')]){_0x9b4ab[_0x2d14('0x49')]=[{'all':!![]}];}_0x9b4ab=_[_0x2d14('0x46')]({},_0x9b4ab,_0x925531['options']);return db[_0x2d14('0x32')]['find'](_0x9b4ab)[_0x2d14('0x2b')](handleEntityNotFound(_0x9eec0e,null))[_0x2d14('0x2b')](respondWithResult(_0x9eec0e,null))['catch'](handleError(_0x9eec0e,null));};exports['create']=function(_0x293723,_0x2c16b0){return db[_0x2d14('0x32')][_0x2d14('0x4f')](_0x293723['body'],{})['then'](respondWithResult(_0x2c16b0,0xc9))[_0x2d14('0x50')](handleError(_0x2c16b0,null));};exports[_0x2d14('0x51')]=function(_0x446421,_0x4ded7b){var _0x522983={'where':{'id':_0x446421[_0x2d14('0x4d')]['id']}},_0x56fa00={};_0x56fa00['model']=_[_0x2d14('0x39')](db[_0x2d14('0x32')][_0x2d14('0x33')]);_0x522983[_0x2d14('0x3c')]=_['intersection'](_0x56fa00[_0x2d14('0x37')],qs['fields'](_0x446421['query']['fields']));_0x522983[_0x2d14('0x3c')]=_0x522983[_0x2d14('0x3c')]['length']?_0x522983[_0x2d14('0x3c')]:_0x56fa00['model'];if(_0x446421[_0x2d14('0x38')][_0x2d14('0x4e')]){_0x522983[_0x2d14('0x49')]=[{'all':!![]}];}_0x522983=_[_0x2d14('0x46')]({},_0x522983,_0x446421[_0x2d14('0x48')]);return db['UserProfile']['find'](_0x522983)[_0x2d14('0x2b')](handleEntityNotFound(_0x4ded7b,null))['then'](function(_0x168bb6){if(_0x168bb6){var _0x551c83=_0x168bb6[_0x2d14('0x52')]({'plain':!![]});_0x551c83=qs['omit'](_0x551c83,['id',_0x2d14('0x53'),_0x2d14('0x54'),'crudPermissions']);_0x446421[_0x2d14('0x55')]=_['omit'](_0x446421[_0x2d14('0x55')],['id','createdAt',_0x2d14('0x54')]);return db['sequelize'][_0x2d14('0x56')](function(_0x223adf){return db['UserProfile']['create'](_[_0x2d14('0x46')](_0x551c83,_0x446421[_0x2d14('0x55')]),{'include':_0x446421[_0x2d14('0x38')][_0x2d14('0x4e')]?[{'all':!![]}]:undefined,'transaction':_0x223adf})[_0x2d14('0x2b')](function(_0x59c554){var _0x499f58=_0x59c554['get']({'plain':!![]});return db[_0x2d14('0x57')][_0x2d14('0x4a')]({'where':{'userProfileId':_0x446421[_0x2d14('0x4d')]['id']},'raw':!![]})['then'](function(_0x48f9e5){if(_0x48f9e5){return BPromise[_0x2d14('0x58')](_0x48f9e5,function(_0x116b0e){return new BPromise(function(_0x483347,_0x39385e){if(_0x116b0e[_0x2d14('0x59')]===null||_0x116b0e['autoAssociation']===0x1)_0x483347(null);return db[_0x2d14('0x5a')][_0x2d14('0x4a')]({'where':{'sectionId':_0x116b0e['id']},'raw':!![]})[_0x2d14('0x2b')](function(_0x38784c){var _0x26c4c0=_[_0x2d14('0x31')](_0x38784c,function(_0x5ea5ce){return qs[_0x2d14('0x5b')](_0x5ea5ce,['id',_0x2d14('0x53'),_0x2d14('0x54'),_0x2d14('0x5c')]);});_0x483347(_0x26c4c0);})[_0x2d14('0x50')](function(_0x12b866){_0x39385e(_0x12b866);});})[_0x2d14('0x2b')](function(_0x7375d6){var _0x570dd0=qs['omit'](_0x116b0e,['id',_0x2d14('0x53'),_0x2d14('0x54')]);_0x570dd0[_0x2d14('0x5d')]=_0x499f58['id'];if(_0x7375d6)_0x570dd0[_0x2d14('0x5e')]=_0x7375d6;return _0x570dd0;})[_0x2d14('0x2b')](function(_0x50ea4a){return db['UserProfileSection'][_0x2d14('0x4f')](_0x50ea4a,{'include':[{'model':db[_0x2d14('0x5a')],'as':_0x2d14('0x5e')}],'raw':!![],'transaction':_0x223adf});});})[_0x2d14('0x2b')](function(){return _0x499f58;});}});});});}})[_0x2d14('0x2b')](respondWithResult(_0x4ded7b,0xc9))['catch'](handleError(_0x4ded7b,null));};exports[_0x2d14('0x5f')]=function(_0x4973b0,_0x54bcb1){if(_0x4973b0[_0x2d14('0x55')]['id']){delete _0x4973b0[_0x2d14('0x55')]['id'];}return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x4973b0[_0x2d14('0x4d')]['id']}})[_0x2d14('0x2b')](handleEntityNotFound(_0x54bcb1,null))[_0x2d14('0x2b')](saveUpdates(_0x4973b0[_0x2d14('0x55')],null))[_0x2d14('0x2b')](respondWithResult(_0x54bcb1,null))[_0x2d14('0x50')](handleError(_0x54bcb1,null));};exports[_0x2d14('0x61')]=function(_0x13a5fb,_0x3537c1){return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x13a5fb[_0x2d14('0x4d')]['id']}})[_0x2d14('0x2b')](handleEntityNotFound(_0x3537c1,null))[_0x2d14('0x2b')](removeEntity(_0x3537c1,null))[_0x2d14('0x50')](handleError(_0x3537c1,null));};exports['describe']=function(_0x48cb98,_0x15b9ae){return db[_0x2d14('0x32')][_0x2d14('0x62')]()[_0x2d14('0x2b')](respondWithResult(_0x15b9ae,null))['catch'](handleError(_0x15b9ae,null));};exports[_0x2d14('0x63')]=function(_0x44d15d,_0x541442){var _0x5ca3b1=_0x44d15d[_0x2d14('0x55')];return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x44d15d[_0x2d14('0x4d')]['id']}})[_0x2d14('0x2b')](handleEntityNotFound(_0x541442,null))[_0x2d14('0x2b')](function(_0x3777a1){if(_0x3777a1){return db['sequelize'][_0x2d14('0x56')](function(_0x37b98f){return db[_0x2d14('0x57')]['destroy']({'where':{'userProfileId':_0x44d15d[_0x2d14('0x4d')]['id'],'sectionId':_[_0x2d14('0x31')](_0x5ca3b1,function(_0x567b8d){return _0x567b8d[_0x2d14('0x5c')];})},'transaction':_0x37b98f})[_0x2d14('0x2b')](function(){var _0x5ef440=_['map'](_0x5ca3b1,function(_0x4207c4){_0x4207c4[_0x2d14('0x5d')]=_0x44d15d[_0x2d14('0x4d')]['id'];return _0x4207c4;});var _0x302dd7=[];return BPromise[_0x2d14('0x58')](_0x5ef440,function(_0x470fa1){return db[_0x2d14('0x57')]['create'](_0x470fa1,{'include':[{'model':db[_0x2d14('0x5a')],'as':_0x2d14('0x5e')}],'raw':!![],'transaction':_0x37b98f})['then'](function(_0x586267){_0x302dd7[_0x2d14('0x64')](_0x586267['get']({'plain':!![]}));});})[_0x2d14('0x2b')](function(){return _0x302dd7;});});});}})['then'](function(_0x47d82b){return _0x47d82b;})[_0x2d14('0x2b')](respondWithResult(_0x541442,null))[_0x2d14('0x50')](handleError(_0x541442,null));};exports[_0x2d14('0x65')]=function(_0x5d2a74,_0x3bbb06){var _0x482bd3;return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x5d2a74[_0x2d14('0x4d')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x3bbb06,null))['then'](function(_0x4c9381){if(_0x4c9381){_0x482bd3=_0x4c9381;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5d2a74[_0x2d14('0x4d')]['id'],'sectionId':_0x5d2a74[_0x2d14('0x38')]['ids']}});}})[_0x2d14('0x2b')](function(){return _0x482bd3;})['then'](respondWithStatusCode(_0x3bbb06,null))[_0x2d14('0x50')](handleError(_0x3bbb06,null));};exports[_0x2d14('0x66')]=function(_0x23c591,_0x5cc583){var _0x4d3ada=[];var _0x6f56de=[];return db[_0x2d14('0x57')]['findAll']({'where':{'userProfileId':_0x23c591[_0x2d14('0x4d')]['id']},'raw':!![]})['then'](function(_0x2cf985){_0x4d3ada=_[_0x2d14('0x45')](_0x2cf985,function(_0x3fbe52){return _0x3fbe52[_0x2d14('0x67')]===0x1||_[_0x2d14('0x68')]([0x3eb,0x709],_0x3fbe52[_0x2d14('0x5c')]);});if(!_['isEmpty'](_0x4d3ada)){return _[_0x2d14('0x31')](_0x4d3ada,function(_0x2713c3){return _0x2713c3[_0x2d14('0x5c')];});}else{return;}})[_0x2d14('0x2b')](function(_0x5c1315){if(_0x5c1315)_0x6f56de=_0x5c1315;if(_[_0x2d14('0x68')](_0x6f56de,0x64)){var _0x205519=_[_0x2d14('0x60')](_0x4d3ada,{'sectionId':0x64});return hasDefaultDashboard(_0x205519)[_0x2d14('0x2b')](function(_0x59e29a){return _[_0x2d14('0x31')](_0x4d3ada,function(_0x1468c5){if(_0x1468c5['sectionId']===0x64){_0x1468c5[_0x2d14('0x69')]=_0x59e29a;}return _0x1468c5;});});}else{return;}})[_0x2d14('0x2b')](function(_0x19d24c){if(_0x19d24c)_0x4d3ada=_0x19d24c;if(_[_0x2d14('0x68')](_0x6f56de,0x3eb)){var _0x5e4252=_[_0x2d14('0x60')](_0x4d3ada,{'sectionId':0x3eb});return getCustomDashboards(_0x5e4252)['then'](function(_0x55a446){return _['map'](_0x4d3ada,function(_0x1adc3b){if(_0x5e4252[_0x2d14('0x67')]){if(_0x1adc3b[_0x2d14('0x5c')]===0x3eb){_0x1adc3b[_0x2d14('0x69')]=_0x55a446;}}else{if(_0x1adc3b['sectionId']===0x64){_0x1adc3b['subsections']=_0x55a446;}}return _0x1adc3b;});});}else{return;}})[_0x2d14('0x2b')](function(_0x1599c0){if(_0x1599c0)_0x4d3ada=_0x1599c0;if(_[_0x2d14('0x68')](_0x6f56de,0x709)){var _0x4bcde7=_[_0x2d14('0x60')](_0x4d3ada,{'sectionId':0x709});return getPlugins(_0x4bcde7)[_0x2d14('0x2b')](function(_0x172193){if(_0x4bcde7[_0x2d14('0x67')]){return _['map'](_0x4d3ada,function(_0x579d78){if(_0x579d78[_0x2d14('0x5c')]===0x709){_0x579d78[_0x2d14('0x69')]=_0x172193;}return _0x579d78;});}else{var _0x4ff249={'sectionId':0x76c,'enabled':0x1,'subsections':_0x172193};var _0x9c67b1=_[_0x2d14('0x31')](_0x4d3ada);_0x9c67b1[_0x2d14('0x64')](_0x4ff249);return _0x9c67b1;}});}else{return;}})[_0x2d14('0x2b')](function(_0x58da03){if(_0x58da03)_0x4d3ada=_0x58da03;return _[_0x2d14('0x45')](_0x4d3ada,['enabled',0x1]);})['then'](respondWithResult(_0x5cc583,null))[_0x2d14('0x50')](handleError(_0x5cc583,null));};function hasDefaultDashboard(_0x6e7f16){var _0x37c99b=[0x65];return new BPromise(function(_0x1ed8b5,_0x2282c2){try{if(_0x6e7f16[_0x2d14('0x59')]){_0x1ed8b5(_0x37c99b);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x6e7f16['id']},'raw':!![]})[_0x2d14('0x2b')](function(_0x3e569e){_0x3e569e?_0x1ed8b5(_0x37c99b):_0x1ed8b5();});}}catch(_0x289647){_0x2282c2(_0x289647);}});}function getCustomDashboards(_0xd169ea){var _0x238dad=[];return new BPromise(function(_0x5ef9a5,_0x41c31d){try{if(_0xd169ea[_0x2d14('0x59')]){return db['Dashboard'][_0x2d14('0x4a')]({'raw':!![]})[_0x2d14('0x2b')](function(_0x43442a){_0x43442a[_0x2d14('0x6a')](function(_0x7a630e){_0x238dad[_0x2d14('0x64')](_0x7a630e['id']+0x1869f);});_0x5ef9a5(_0x238dad);});}else{return db[_0x2d14('0x5a')][_0x2d14('0x4a')]({'where':{'sectionId':_0xd169ea['id']},'raw':!![]})[_0x2d14('0x2b')](function(_0x4a073e){_0x4a073e['forEach'](function(_0x2f5571){_0x238dad[_0x2d14('0x64')](_0x2f5571[_0x2d14('0x6b')]+0x1869f);});_0x5ef9a5(_0x238dad);});}}catch(_0x103ad5){_0x41c31d(_0x103ad5);}});}function getPlugins(_0x471e91){var _0x4b6cf8=[];return new BPromise(function(_0x1de1a7,_0x327c32){try{if(_0x471e91[_0x2d14('0x59')]){return db[_0x2d14('0x6c')][_0x2d14('0x4a')]({'raw':!![]})[_0x2d14('0x2b')](function(_0x456ab0){_0x456ab0[_0x2d14('0x6a')](function(_0x53678b){_0x4b6cf8[_0x2d14('0x64')](_0x53678b['id']+0x15b38);});_0x1de1a7(_0x4b6cf8);});}else{return db[_0x2d14('0x5a')][_0x2d14('0x4a')]({'where':{'sectionId':_0x471e91['id']},'raw':!![]})[_0x2d14('0x2b')](function(_0x3216f5){_0x3216f5[_0x2d14('0x6a')](function(_0x5f4e05){_0x4b6cf8[_0x2d14('0x64')](_0x5f4e05[_0x2d14('0x6b')]+0x15b38);});_0x1de1a7(_0x4b6cf8);});}}catch(_0x5cb19f){_0x327c32(_0x5cb19f);}});}exports[_0x2d14('0x6d')]=function(_0x2ee838,_0x408910){return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x2ee838[_0x2d14('0x4d')]['id']}})[_0x2d14('0x2b')](handleEntityNotFound(_0x408910,null))['then'](function(_0x2656b5){if(_0x2656b5){return db['sequelize'][_0x2d14('0x56')](function(_0x456141){return db[_0x2d14('0x57')][_0x2d14('0x4a')]({'where':{'userProfileId':_0x2ee838[_0x2d14('0x4d')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x6eb941){if(_0x6eb941){return db[_0x2d14('0x57')][_0x2d14('0x61')]({'where':{'userProfileId':_0x2ee838['params']['id'],'id':_['map'](_0x6eb941,function(_0x4806fd){return _0x4806fd['id'];})},'transaction':_0x456141});}})[_0x2d14('0x2b')](function(_0x1516e9){var _0x488991=_[_0x2d14('0x31')](_0x2ee838[_0x2d14('0x55')],function(_0x3ff747){_0x3ff747[_0x2d14('0x5d')]=_0x2ee838[_0x2d14('0x4d')]['id'];return _0x3ff747;});return db[_0x2d14('0x57')][_0x2d14('0x6e')](_0x488991,{'raw':!![],'transaction':_0x456141});})[_0x2d14('0x2b')](function(_0x190bec){var _0x386ab3=_[_0x2d14('0x45')](_[_0x2d14('0x31')](_0x190bec,function(_0x2d10b6){return _0x2d10b6[_0x2d14('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x386ab3){return db[_0x2d14('0x57')]['findAll']({'where':{'userProfileId':_0x2ee838[_0x2d14('0x4d')]['id'],'sectionId':_['map'](_0x386ab3,function(_0x36f6c6){return _0x36f6c6[_0x2d14('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2d14('0x2b')](function(_0x462f40){var _0x7cca76=_['map'](_0x2ee838['body'],function(_0xbf1156){_0xbf1156[_0x2d14('0x5d')]=_0x2ee838['params']['id'];return _0xbf1156;});return db['UserProfileResource'][_0x2d14('0x6e')](_0x7cca76,{'raw':!![],'transaction':_0x456141});});}})['catch'](handleError(_0x408910,null));});}})['then'](function(_0x5b7cb3){var _0x21ff18=_[_0x2d14('0x31')](_0x5b7cb3,function(_0x1f61a8){return _0x1f61a8['get']({'plain':!![]});});})[_0x2d14('0x2b')](respondWithResult(_0x408910,null))['catch'](handleError(_0x408910,null));};exports['removeResources']=function(_0x26c5fe,_0x8611aa,_0x1d9d66){return db[_0x2d14('0x32')]['find']({'where':{'id':_0x26c5fe[_0x2d14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8611aa,null))[_0x2d14('0x2b')](function(_0x1160d7){if(_0x1160d7){return _0x1160d7[_0x2d14('0x6f')](_0x26c5fe['query'][_0x2d14('0x70')]);}})[_0x2d14('0x2b')](respondWithStatusCode(_0x8611aa,null))[_0x2d14('0x50')](handleError(_0x8611aa,null));};exports[_0x2d14('0x71')]=function(_0x36f181,_0xb17f7b){var _0x3a6ace={};if(!_0x36f181[_0x2d14('0x38')][_0x2d14('0x72')])throw new Error(_0x2d14('0x73'));if(!_0x36f181[_0x2d14('0x38')]['hasOwnProperty'](_0x2d14('0x40'))){_0x3a6ace[_0x2d14('0x26')]=qs[_0x2d14('0x26')](_0x36f181['query']['limit']);_0x3a6ace[_0x2d14('0x23')]=qs['offset'](_0x36f181[_0x2d14('0x38')][_0x2d14('0x23')]);}return db[_0x2d14('0x32')][_0x2d14('0x60')]({'where':{'id':_0x36f181[_0x2d14('0x4d')]['id']}})[_0x2d14('0x2b')](function(_0x2d7e20){if(!_0x2d7e20)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x36f181['params']['id']);return db[_0x2d14('0x32')]['getResources'](_0x36f181);})[_0x2d14('0x2b')](respondWithFilteredResult(_0xb17f7b,_0x3a6ace))[_0x2d14('0x50')](handleError(_0xb17f7b,null));}; \ No newline at end of file +var _0xa32b=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','count','includeAll','findAll','rows','show','params','include','find','create','body','omit','createdAt','updatedAt','crudPermissions','sequelize','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','catch','userProfileId','Resources','update','describe','addSections','push','enabled','includes','subsections','findOne','forEach','resourceId','addResources','transaction','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','eml-format','zip-dir'];(function(_0x1de08f,_0x324b30){var _0x1f6cff=function(_0x1ba4c9){while(--_0x1ba4c9){_0x1de08f['push'](_0x1de08f['shift']());}};_0x1f6cff(++_0x324b30);}(_0xa32b,0x68));var _0xba32=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xa32b[_0x1afabf];return _0x497ff1;};'use strict';var emlformat=require(_0xba32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba32('0x2'));var BPromise=require(_0xba32('0x3'));var Mustache=require(_0xba32('0x4'));var util=require('util');var path=require(_0xba32('0x5'));var sox=require(_0xba32('0x6'));var csv=require(_0xba32('0x7'));var ejs=require(_0xba32('0x8'));var fs=require('fs');var fs_extra=require(_0xba32('0x9'));var _=require('lodash');var squel=require(_0xba32('0xa'));var crypto=require('crypto');var jsforce=require(_0xba32('0xb'));var deskjs=require(_0xba32('0xc'));var toCsv=require(_0xba32('0x7'));var querystring=require(_0xba32('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba32('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba32('0xf'))('api');var utils=require(_0xba32('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba32('0x11'))['db'];config[_0xba32('0x12')]=_[_0xba32('0x13')](config[_0xba32('0x12')],{'host':_0xba32('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba32('0x12')]));require(_0xba32('0x15'))[_0xba32('0x16')](socket);function respondWithStatusCode(_0xd82932,_0x36c197){_0x36c197=_0x36c197||0xcc;return function(_0x184f31){if(_0x184f31){return _0xd82932[_0xba32('0x17')](_0x36c197);}return _0xd82932['status'](_0x36c197)[_0xba32('0x18')]();};}function respondWithResult(_0x22c2be,_0x3d3ebe){_0x3d3ebe=_0x3d3ebe||0xc8;return function(_0xd8e067){if(_0xd8e067){return _0x22c2be[_0xba32('0x19')](_0x3d3ebe)['json'](_0xd8e067);}};}function respondWithFilteredResult(_0x4d0b72,_0x56ea88){return function(_0x5c3fe6){if(_0x5c3fe6){var _0x234db9=typeof _0x56ea88[_0xba32('0x1a')]===_0xba32('0x1b')&&typeof _0x56ea88[_0xba32('0x1c')]===_0xba32('0x1b');var _0x1bcce4=_0x5c3fe6['count'];var _0x4f9e48=_0x234db9?0x0:_0x56ea88['offset'];var _0x10de9c=_0x234db9?_0x5c3fe6['count']:_0x56ea88[_0xba32('0x1a')]+_0x56ea88[_0xba32('0x1c')];var _0x4266dc;if(_0x10de9c>=_0x1bcce4){_0x10de9c=_0x1bcce4;_0x4266dc=0xc8;}else{_0x4266dc=0xce;}_0x4d0b72[_0xba32('0x19')](_0x4266dc);return _0x4d0b72[_0xba32('0x1d')](_0xba32('0x1e'),_0x4f9e48+'-'+_0x10de9c+'/'+_0x1bcce4)[_0xba32('0x1f')](_0x5c3fe6);}return null;};}function patchUpdates(_0x503698){return function(_0x1226f2){try{jsonpatch[_0xba32('0x20')](_0x1226f2,_0x503698,!![]);}catch(_0x34a3cd){return BPromise[_0xba32('0x21')](_0x34a3cd);}return _0x1226f2['save']();};}function saveUpdates(_0x4b03a5,_0x2f3318){return function(_0x3a8f30){if(_0x3a8f30){return _0x3a8f30['update'](_0x4b03a5)[_0xba32('0x22')](function(_0x5dcdc4){return _0x5dcdc4;});}return null;};}function removeEntity(_0x37ade0,_0x18f0c8){return function(_0x3c8b78){if(_0x3c8b78){return _0x3c8b78[_0xba32('0x23')]()[_0xba32('0x22')](function(){_0x37ade0[_0xba32('0x19')](0xcc)[_0xba32('0x18')]();});}};}function handleEntityNotFound(_0x54d03d,_0x1e470){return function(_0x424369){if(!_0x424369){_0x54d03d[_0xba32('0x17')](0x194);}return _0x424369;};}function handleError(_0x26c724,_0x3a932f){_0x3a932f=_0x3a932f||0x1f4;return function(_0x168206){logger[_0xba32('0x24')](_0x168206[_0xba32('0x25')]);if(_0x168206[_0xba32('0x26')]){delete _0x168206['name'];}_0x26c724[_0xba32('0x19')](_0x3a932f)[_0xba32('0x27')](_0x168206);};}exports[_0xba32('0x28')]=function(_0x2a466e,_0x30c137){var _0x5f1171={},_0x675e67={},_0x4b5e00={'count':0x0,'rows':[]};var _0x2f0796=_[_0xba32('0x29')](db['UserProfile'][_0xba32('0x2a')],function(_0x1e2433){return{'name':_0x1e2433[_0xba32('0x2b')],'type':_0x1e2433[_0xba32('0x2c')]['key']};});_0x675e67[_0xba32('0x2d')]=_[_0xba32('0x29')](_0x2f0796,'name');_0x675e67[_0xba32('0x2e')]=_[_0xba32('0x2f')](_0x2a466e[_0xba32('0x2e')]);_0x675e67[_0xba32('0x30')]=_['intersection'](_0x675e67[_0xba32('0x2d')],_0x675e67['query']);_0x5f1171[_0xba32('0x31')]=_[_0xba32('0x32')](_0x675e67[_0xba32('0x2d')],qs['fields'](_0x2a466e[_0xba32('0x2e')][_0xba32('0x33')]));_0x5f1171['attributes']=_0x5f1171[_0xba32('0x31')][_0xba32('0x34')]?_0x5f1171[_0xba32('0x31')]:_0x675e67[_0xba32('0x2d')];if(!_0x2a466e['query']['hasOwnProperty'](_0xba32('0x35'))){_0x5f1171['limit']=qs[_0xba32('0x1c')](_0x2a466e[_0xba32('0x2e')][_0xba32('0x1c')]);_0x5f1171[_0xba32('0x1a')]=qs['offset'](_0x2a466e[_0xba32('0x2e')][_0xba32('0x1a')]);}_0x5f1171[_0xba32('0x36')]=qs[_0xba32('0x37')](_0x2a466e['query']['sort']);_0x5f1171[_0xba32('0x38')]=qs[_0xba32('0x30')](_[_0xba32('0x39')](_0x2a466e[_0xba32('0x2e')],_0x675e67[_0xba32('0x30')]),_0x2f0796);if(_0x2a466e[_0xba32('0x2e')][_0xba32('0x3a')]){_0x5f1171[_0xba32('0x38')]=_[_0xba32('0x3b')](_0x5f1171[_0xba32('0x38')],{'$or':_[_0xba32('0x29')](_0x2f0796,function(_0x52445b){if(_0x52445b[_0xba32('0x2c')]!==_0xba32('0x3c')){var _0xa7cc3f={};_0xa7cc3f[_0x52445b[_0xba32('0x26')]]={'$like':'%'+_0x2a466e['query'][_0xba32('0x3a')]+'%'};return _0xa7cc3f;}})});}_0x5f1171=_['merge']({},_0x5f1171,_0x2a466e[_0xba32('0x3d')]);var _0x54b374={'where':_0x5f1171[_0xba32('0x38')]};return db[_0xba32('0x3e')][_0xba32('0x3f')](_0x54b374)[_0xba32('0x22')](function(_0x26284e){_0x4b5e00[_0xba32('0x3f')]=_0x26284e;if(_0x2a466e['query'][_0xba32('0x40')]){_0x5f1171['include']=[{'all':!![]}];}return db[_0xba32('0x3e')][_0xba32('0x41')](_0x5f1171);})[_0xba32('0x22')](function(_0x558d2b){_0x4b5e00[_0xba32('0x42')]=_0x558d2b;return _0x4b5e00;})[_0xba32('0x22')](respondWithFilteredResult(_0x30c137,_0x5f1171))['catch'](handleError(_0x30c137,null));};exports[_0xba32('0x43')]=function(_0x51e938,_0x931d26){var _0x505ea8={'raw':![],'where':{'id':_0x51e938[_0xba32('0x44')]['id']}},_0x1537a3={};_0x1537a3['model']=_[_0xba32('0x2f')](db[_0xba32('0x3e')][_0xba32('0x2a')]);_0x1537a3[_0xba32('0x2e')]=_['keys'](_0x51e938[_0xba32('0x2e')]);_0x1537a3[_0xba32('0x30')]=_['intersection'](_0x1537a3[_0xba32('0x2d')],_0x1537a3[_0xba32('0x2e')]);_0x505ea8['attributes']=_[_0xba32('0x32')](_0x1537a3['model'],qs[_0xba32('0x33')](_0x51e938[_0xba32('0x2e')][_0xba32('0x33')]));_0x505ea8[_0xba32('0x31')]=_0x505ea8[_0xba32('0x31')][_0xba32('0x34')]?_0x505ea8['attributes']:_0x1537a3[_0xba32('0x2d')];if(_0x51e938[_0xba32('0x2e')][_0xba32('0x40')]){_0x505ea8[_0xba32('0x45')]=[{'all':!![]}];}_0x505ea8=_[_0xba32('0x3b')]({},_0x505ea8,_0x51e938['options']);return db[_0xba32('0x3e')][_0xba32('0x46')](_0x505ea8)[_0xba32('0x22')](handleEntityNotFound(_0x931d26,null))['then'](respondWithResult(_0x931d26,null))['catch'](handleError(_0x931d26,null));};exports[_0xba32('0x47')]=function(_0xc8624,_0x58309d){return db['UserProfile'][_0xba32('0x47')](_0xc8624[_0xba32('0x48')],{})[_0xba32('0x22')](respondWithResult(_0x58309d,0xc9))['catch'](handleError(_0x58309d,null));};exports['clone']=function(_0x284848,_0x2bdc42){var _0x3e1433={'where':{'id':_0x284848['params']['id']}},_0x1684b9={};_0x1684b9[_0xba32('0x2d')]=_[_0xba32('0x2f')](db[_0xba32('0x3e')][_0xba32('0x2a')]);_0x3e1433['attributes']=_[_0xba32('0x32')](_0x1684b9[_0xba32('0x2d')],qs[_0xba32('0x33')](_0x284848[_0xba32('0x2e')]['fields']));_0x3e1433[_0xba32('0x31')]=_0x3e1433[_0xba32('0x31')][_0xba32('0x34')]?_0x3e1433[_0xba32('0x31')]:_0x1684b9[_0xba32('0x2d')];if(_0x284848['query'][_0xba32('0x40')]){_0x3e1433[_0xba32('0x45')]=[{'all':!![]}];}_0x3e1433=_[_0xba32('0x3b')]({},_0x3e1433,_0x284848[_0xba32('0x3d')]);return db['UserProfile'][_0xba32('0x46')](_0x3e1433)[_0xba32('0x22')](handleEntityNotFound(_0x2bdc42,null))[_0xba32('0x22')](function(_0x2cbe01){if(_0x2cbe01){var _0x5b673d=_0x2cbe01['get']({'plain':!![]});_0x5b673d=qs[_0xba32('0x49')](_0x5b673d,['id',_0xba32('0x4a'),_0xba32('0x4b'),_0xba32('0x4c')]);_0x284848[_0xba32('0x48')]=_['omit'](_0x284848[_0xba32('0x48')],['id',_0xba32('0x4a'),_0xba32('0x4b')]);return db[_0xba32('0x4d')]['transaction'](function(_0x326e16){return db[_0xba32('0x3e')]['create'](_[_0xba32('0x3b')](_0x5b673d,_0x284848['body']),{'include':_0x284848['query'][_0xba32('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x326e16})[_0xba32('0x22')](function(_0x1d0302){var _0x4afe1e=_0x1d0302[_0xba32('0x4e')]({'plain':!![]});return db[_0xba32('0x4f')][_0xba32('0x41')]({'where':{'userProfileId':_0x284848[_0xba32('0x44')]['id']},'raw':!![]})[_0xba32('0x22')](function(_0x4a8040){if(_0x4a8040){return BPromise[_0xba32('0x50')](_0x4a8040,function(_0x553b97){return new BPromise(function(_0x9217c5,_0x154cf0){if(_0x553b97[_0xba32('0x51')]===null||_0x553b97[_0xba32('0x51')]===0x1)_0x9217c5(null);return db[_0xba32('0x52')][_0xba32('0x41')]({'where':{'sectionId':_0x553b97['id']},'raw':!![]})[_0xba32('0x22')](function(_0x3f4c95){var _0x3d8d18=_[_0xba32('0x29')](_0x3f4c95,function(_0x27646c){return qs[_0xba32('0x49')](_0x27646c,['id',_0xba32('0x4a'),_0xba32('0x4b'),_0xba32('0x53')]);});_0x9217c5(_0x3d8d18);})[_0xba32('0x54')](function(_0x4d68b1){_0x154cf0(_0x4d68b1);});})['then'](function(_0x26e2ad){var _0x34e9ea=qs[_0xba32('0x49')](_0x553b97,['id',_0xba32('0x4a'),_0xba32('0x4b')]);_0x34e9ea[_0xba32('0x55')]=_0x4afe1e['id'];if(_0x26e2ad)_0x34e9ea[_0xba32('0x56')]=_0x26e2ad;return _0x34e9ea;})['then'](function(_0x38a3cd){return db[_0xba32('0x4f')][_0xba32('0x47')](_0x38a3cd,{'include':[{'model':db[_0xba32('0x52')],'as':_0xba32('0x56')}],'raw':!![],'transaction':_0x326e16});});})[_0xba32('0x22')](function(){return _0x4afe1e;});}});});});}})['then'](respondWithResult(_0x2bdc42,0xc9))[_0xba32('0x54')](handleError(_0x2bdc42,null));};exports[_0xba32('0x57')]=function(_0x5a9891,_0x4eb7ec){if(_0x5a9891[_0xba32('0x48')]['id']){delete _0x5a9891['body']['id'];}return db[_0xba32('0x3e')]['find']({'where':{'id':_0x5a9891['params']['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x4eb7ec,null))[_0xba32('0x22')](saveUpdates(_0x5a9891['body'],null))[_0xba32('0x22')](respondWithResult(_0x4eb7ec,null))['catch'](handleError(_0x4eb7ec,null));};exports[_0xba32('0x23')]=function(_0x44aa57,_0x18bde){return db[_0xba32('0x3e')][_0xba32('0x46')]({'where':{'id':_0x44aa57[_0xba32('0x44')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x18bde,null))[_0xba32('0x22')](removeEntity(_0x18bde,null))[_0xba32('0x54')](handleError(_0x18bde,null));};exports[_0xba32('0x58')]=function(_0x3b6979,_0x34d93b){return db[_0xba32('0x3e')][_0xba32('0x58')]()[_0xba32('0x22')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0xba32('0x59')]=function(_0x4217ea,_0x237cf5){var _0x215014=_0x4217ea[_0xba32('0x48')];return db[_0xba32('0x3e')][_0xba32('0x46')]({'where':{'id':_0x4217ea['params']['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x237cf5,null))[_0xba32('0x22')](function(_0x412848){if(_0x412848){return db[_0xba32('0x4d')]['transaction'](function(_0x350f10){return db[_0xba32('0x4f')]['destroy']({'where':{'userProfileId':_0x4217ea['params']['id'],'sectionId':_[_0xba32('0x29')](_0x215014,function(_0x29ca7b){return _0x29ca7b[_0xba32('0x53')];})},'transaction':_0x350f10})[_0xba32('0x22')](function(){var _0x21c945=_[_0xba32('0x29')](_0x215014,function(_0x3c5797){_0x3c5797[_0xba32('0x55')]=_0x4217ea[_0xba32('0x44')]['id'];return _0x3c5797;});var _0x4bc77f=[];return BPromise[_0xba32('0x50')](_0x21c945,function(_0x1646cf){return db[_0xba32('0x4f')][_0xba32('0x47')](_0x1646cf,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x350f10})[_0xba32('0x22')](function(_0xec94d4){_0x4bc77f[_0xba32('0x5a')](_0xec94d4[_0xba32('0x4e')]({'plain':!![]}));});})['then'](function(){return _0x4bc77f;});});});}})[_0xba32('0x22')](function(_0x49db91){return _0x49db91;})['then'](respondWithResult(_0x237cf5,null))[_0xba32('0x54')](handleError(_0x237cf5,null));};exports['removeSections']=function(_0x36f6c8,_0x244998){var _0x776115;return db[_0xba32('0x3e')][_0xba32('0x46')]({'where':{'id':_0x36f6c8[_0xba32('0x44')]['id']},'attributes':['id',_0xba32('0x26')]})['then'](handleEntityNotFound(_0x244998,null))[_0xba32('0x22')](function(_0x9274e0){if(_0x9274e0){_0x776115=_0x9274e0;return db['UserProfileSection'][_0xba32('0x23')]({'where':{'userProfileId':_0x36f6c8[_0xba32('0x44')]['id'],'sectionId':_0x36f6c8[_0xba32('0x2e')]['ids']}});}})[_0xba32('0x22')](function(){return _0x776115;})['then'](respondWithStatusCode(_0x244998,null))['catch'](handleError(_0x244998,null));};exports['getSections']=function(_0x44d139,_0x2cbd94){var _0x1c420e=[];var _0x11d546=[];return db[_0xba32('0x4f')][_0xba32('0x41')]({'where':{'userProfileId':_0x44d139[_0xba32('0x44')]['id']},'raw':!![]})[_0xba32('0x22')](function(_0xf60750){_0x1c420e=_['filter'](_0xf60750,function(_0x15cfff){return _0x15cfff[_0xba32('0x5b')]===0x1||_[_0xba32('0x5c')]([0x3eb,0x709],_0x15cfff[_0xba32('0x53')]);});if(!_['isEmpty'](_0x1c420e)){return _['map'](_0x1c420e,function(_0x100b82){return _0x100b82[_0xba32('0x53')];});}else{return;}})[_0xba32('0x22')](function(_0x5866f4){if(_0x5866f4)_0x11d546=_0x5866f4;if(_['includes'](_0x11d546,0x64)){var _0x2002d5=_['find'](_0x1c420e,{'sectionId':0x64});return hasDefaultDashboard(_0x2002d5)[_0xba32('0x22')](function(_0x47e122){return _[_0xba32('0x29')](_0x1c420e,function(_0x2edeaf){if(_0x2edeaf[_0xba32('0x53')]===0x64){_0x2edeaf['subsections']=_0x47e122;}return _0x2edeaf;});});}else{return;}})[_0xba32('0x22')](function(_0x1eada6){if(_0x1eada6)_0x1c420e=_0x1eada6;if(_['includes'](_0x11d546,0x3eb)){var _0x1a22d8=_[_0xba32('0x46')](_0x1c420e,{'sectionId':0x3eb});return getCustomDashboards(_0x1a22d8)[_0xba32('0x22')](function(_0x5346be){return _['map'](_0x1c420e,function(_0x196a0a){if(_0x1a22d8['enabled']){if(_0x196a0a[_0xba32('0x53')]===0x3eb){_0x196a0a['subsections']=_0x5346be;}}else{if(_0x196a0a['sectionId']===0x64){_0x196a0a[_0xba32('0x5d')]=_0x5346be;}}return _0x196a0a;});});}else{return;}})[_0xba32('0x22')](function(_0x35ce94){if(_0x35ce94)_0x1c420e=_0x35ce94;if(_['includes'](_0x11d546,0x709)){var _0x4ba6f5=_['find'](_0x1c420e,{'sectionId':0x709});return getPlugins(_0x4ba6f5)[_0xba32('0x22')](function(_0x42d8ac){if(_0x4ba6f5[_0xba32('0x5b')]){return _[_0xba32('0x29')](_0x1c420e,function(_0xa27e1f){if(_0xa27e1f[_0xba32('0x53')]===0x709){_0xa27e1f[_0xba32('0x5d')]=_0x42d8ac;}return _0xa27e1f;});}else{var _0x497bc2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x42d8ac};var _0x1da1c6=_[_0xba32('0x29')](_0x1c420e);_0x1da1c6[_0xba32('0x5a')](_0x497bc2);return _0x1da1c6;}});}else{return;}})[_0xba32('0x22')](function(_0x5a3b1c){if(_0x5a3b1c)_0x1c420e=_0x5a3b1c;return _['filter'](_0x1c420e,[_0xba32('0x5b'),0x1]);})[_0xba32('0x22')](respondWithResult(_0x2cbd94,null))[_0xba32('0x54')](handleError(_0x2cbd94,null));};function hasDefaultDashboard(_0x4456f4){var _0x483056=[0x65];return new BPromise(function(_0x4cb06c,_0x29b10f){try{if(_0x4456f4['autoAssociation']){_0x4cb06c(_0x483056);}else{return db[_0xba32('0x52')][_0xba32('0x5e')]({'where':{'sectionId':_0x4456f4['id']},'raw':!![]})[_0xba32('0x22')](function(_0x2a87ba){_0x2a87ba?_0x4cb06c(_0x483056):_0x4cb06c();});}}catch(_0x1c961b){_0x29b10f(_0x1c961b);}});}function getCustomDashboards(_0x9d110c){var _0x426df=[];return new BPromise(function(_0xd65d46,_0xc7deb3){try{if(_0x9d110c[_0xba32('0x51')]){return db['Dashboard'][_0xba32('0x41')]({'raw':!![]})['then'](function(_0x4fbf23){_0x4fbf23['forEach'](function(_0x1022ba){_0x426df[_0xba32('0x5a')](_0x1022ba['id']+0x1869f);});_0xd65d46(_0x426df);});}else{return db[_0xba32('0x52')][_0xba32('0x41')]({'where':{'sectionId':_0x9d110c['id']},'raw':!![]})[_0xba32('0x22')](function(_0x11ac31){_0x11ac31[_0xba32('0x5f')](function(_0x369d88){_0x426df[_0xba32('0x5a')](_0x369d88[_0xba32('0x60')]+0x1869f);});_0xd65d46(_0x426df);});}}catch(_0x4dd4d6){_0xc7deb3(_0x4dd4d6);}});}function getPlugins(_0x362270){var _0x15e783=[];return new BPromise(function(_0x59a887,_0x2e607a){try{if(_0x362270[_0xba32('0x51')]){return db['Plugin'][_0xba32('0x41')]({'raw':!![]})[_0xba32('0x22')](function(_0x23092d){_0x23092d[_0xba32('0x5f')](function(_0x3bdb23){_0x15e783[_0xba32('0x5a')](_0x3bdb23['id']+0x15b38);});_0x59a887(_0x15e783);});}else{return db[_0xba32('0x52')][_0xba32('0x41')]({'where':{'sectionId':_0x362270['id']},'raw':!![]})['then'](function(_0x22ca2a){_0x22ca2a[_0xba32('0x5f')](function(_0x26fd9c){_0x15e783[_0xba32('0x5a')](_0x26fd9c['resourceId']+0x15b38);});_0x59a887(_0x15e783);});}}catch(_0x5ba650){_0x2e607a(_0x5ba650);}});}exports[_0xba32('0x61')]=function(_0x8f9af1,_0x35fafd){return db[_0xba32('0x3e')][_0xba32('0x46')]({'where':{'id':_0x8f9af1[_0xba32('0x44')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x35fafd,null))[_0xba32('0x22')](function(_0x5a8636){if(_0x5a8636){return db[_0xba32('0x4d')][_0xba32('0x62')](function(_0x23080a){return db[_0xba32('0x4f')]['findAll']({'where':{'userProfileId':_0x8f9af1['params']['id']},'attributes':['id'],'raw':!![]})[_0xba32('0x22')](function(_0x16ea06){if(_0x16ea06){return db[_0xba32('0x4f')][_0xba32('0x23')]({'where':{'userProfileId':_0x8f9af1['params']['id'],'id':_['map'](_0x16ea06,function(_0x5a9798){return _0x5a9798['id'];})},'transaction':_0x23080a});}})[_0xba32('0x22')](function(_0x33fa5e){var _0x2b0fb3=_[_0xba32('0x29')](_0x8f9af1[_0xba32('0x48')],function(_0x168ccf){_0x168ccf[_0xba32('0x55')]=_0x8f9af1['params']['id'];return _0x168ccf;});return db[_0xba32('0x4f')][_0xba32('0x63')](_0x2b0fb3,{'raw':!![],'transaction':_0x23080a});})[_0xba32('0x22')](function(_0x2614f6){var _0x11d34e=_[_0xba32('0x3a')](_[_0xba32('0x29')](_0x2614f6,function(_0x3915eb){return _0x3915eb[_0xba32('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x11d34e){return db[_0xba32('0x4f')][_0xba32('0x41')]({'where':{'userProfileId':_0x8f9af1['params']['id'],'sectionId':_[_0xba32('0x29')](_0x11d34e,function(_0x469604){return _0x469604[_0xba32('0x53')];})},'attributes':['id',_0xba32('0x53')],'raw':!![]})[_0xba32('0x22')](function(_0x15c2f5){var _0xf0838b=_[_0xba32('0x29')](_0x8f9af1[_0xba32('0x48')],function(_0x4ecfc0){_0x4ecfc0['userProfileId']=_0x8f9af1['params']['id'];return _0x4ecfc0;});return db['UserProfileResource']['bulkCreate'](_0xf0838b,{'raw':!![],'transaction':_0x23080a});});}})[_0xba32('0x54')](handleError(_0x35fafd,null));});}})[_0xba32('0x22')](function(_0x4ffa9f){var _0x2ed595=_[_0xba32('0x29')](_0x4ffa9f,function(_0x525d70){return _0x525d70[_0xba32('0x4e')]({'plain':!![]});});})[_0xba32('0x22')](respondWithResult(_0x35fafd,null))[_0xba32('0x54')](handleError(_0x35fafd,null));};exports[_0xba32('0x64')]=function(_0x3423e9,_0x58d4a5,_0x4cfa5c){return db[_0xba32('0x3e')]['find']({'where':{'id':_0x3423e9[_0xba32('0x44')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x58d4a5,null))['then'](function(_0x544b4e){if(_0x544b4e){return _0x544b4e[_0xba32('0x64')](_0x3423e9[_0xba32('0x2e')][_0xba32('0x65')]);}})['then'](respondWithStatusCode(_0x58d4a5,null))[_0xba32('0x54')](handleError(_0x58d4a5,null));};exports[_0xba32('0x66')]=function(_0x29042a,_0x1213cd){var _0x32b802={};if(!_0x29042a[_0xba32('0x2e')][_0xba32('0x67')])throw new Error(_0xba32('0x68'));if(!_0x29042a[_0xba32('0x2e')][_0xba32('0x69')](_0xba32('0x35'))){_0x32b802['limit']=qs[_0xba32('0x1c')](_0x29042a[_0xba32('0x2e')][_0xba32('0x1c')]);_0x32b802[_0xba32('0x1a')]=qs[_0xba32('0x1a')](_0x29042a[_0xba32('0x2e')][_0xba32('0x1a')]);}return db[_0xba32('0x3e')][_0xba32('0x46')]({'where':{'id':_0x29042a[_0xba32('0x44')]['id']}})[_0xba32('0x22')](function(_0x4ca9ef){if(!_0x4ca9ef)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x29042a[_0xba32('0x44')]['id']);return db[_0xba32('0x3e')][_0xba32('0x66')](_0x29042a);})[_0xba32('0x22')](respondWithFilteredResult(_0x1213cd,_0x32b802))[_0xba32('0x54')](handleError(_0x1213cd,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f88dfa1..0e133b8 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 _0xd663=['update','remove','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x5b6610,_0x5e99e3){var _0x36d17d=function(_0x1fca06){while(--_0x1fca06){_0x5b6610['push'](_0x5b6610['shift']());}};_0x36d17d(++_0x5e99e3);}(_0xd663,0x1ed));var _0x3d66=function(_0x4cec7c,_0x76f4fa){_0x4cec7c=_0x4cec7c-0x0;var _0x451428=_0xd663[_0x4cec7c];return _0x451428;};'use strict';var EventEmitter=require(_0x3d66('0x0'));var UserProfile=require(_0x3d66('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3d66('0x2')](0x0);var events={'afterCreate':_0x3d66('0x3'),'afterUpdate':_0x3d66('0x4'),'afterDestroy':_0x3d66('0x5')};function emitEvent(_0xb5a453){return function(_0x4e9001,_0x28d76b,_0x533dcc){UserProfileEvents['emit'](_0xb5a453+':'+_0x4e9001['id'],_0x4e9001);UserProfileEvents['emit'](_0xb5a453,_0x4e9001);_0x533dcc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3d66('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x58fece,_0x391c16){var _0x43bbb5=function(_0x570b6a){while(--_0x570b6a){_0x58fece['push'](_0x58fece['shift']());}};_0x43bbb5(++_0x391c16);}(_0x2525,0x1f0));var _0x5252=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2525[_0x92c450];return _0x2a9599;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d5caa00..be06a08 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 _0x9440=['telephone','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','VoiceQueues','QueueCampaigns','agents','telephones','Users','role','admin','user','ZendeskAccount','freshdeskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','then','OpenTabs','define','UserProfile','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','all','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','where','pick','find','foreignKey','forEach','merge','includeAll','include','reportType','DefaultReports','CustomReports','count','rows','CmContact','Tags','color','ThroughTags','tag','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','squel','exports','models','filter','value','findAll','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','CmList','companies','CmCompany','CmCustomField','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','agent','Telephones'];(function(_0x3fc0f8,_0x4fd6fc){var _0x150b02=function(_0x2f7be9){while(--_0x2f7be9){_0x3fc0f8['push'](_0x3fc0f8['shift']());}};_0x150b02(++_0x4fd6fc);}(_0x9440,0x7f));var _0x0944=function(_0x5441e9,_0x580e1b){_0x5441e9=_0x5441e9-0x0;var _0xdd1476=_0x9440[_0x5441e9];return _0xdd1476;};'use strict';var _=require(_0x0944('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0x0944('0x1'));module[_0x0944('0x2')]=function(_0x2bd38b){var _0xc33dac=_0x2bd38b[_0x0944('0x3')];function _0x99605d(_0x5e8bd0,_0x587825){return new Promise(function(_0x1d5a8a,_0x293b24){if(!_0x587825)return _0x1d5a8a(null);var _0x20372b=_0x587825['filter']?{[_0x587825['filter']['field']]:_0x587825[_0x0944('0x4')][_0x0944('0x5')]}:undefined;return _0xc33dac[_0x5e8bd0][_0x0944('0x6')]({'where':_0x20372b,'raw':!![]})['then'](function(_0x29b50d){_0x587825[_0x0944('0x7')]=_[_0x0944('0x8')](_0x29b50d,'id');_0x1d5a8a(_0x587825);})[_0x0944('0x9')](function(_0x176b4d){_0x293b24(_0x176b4d);});});}function _0x24e8c9(_0xea8bb3,_0x3ea51a){return new Promise(function(_0x2926de,_0x3e237b){var _0x3ad18b=_0xea8bb3['filter']?{[_0xea8bb3[_0x0944('0x4')][_0x0944('0xa')]]:_0xea8bb3[_0x0944('0x4')]['value']}:undefined;return _0xc33dac[_0xea8bb3[_0x0944('0xb')]]['findAll']({'where':_0x3ad18b,'raw':!![]})['then'](function(_0x13dd47){_0x3ea51a[_0x0944('0x7')]=_[_0x0944('0x8')](_0x13dd47,function(_0x105aea){return _0x105aea[_0x0944('0xc')];});_0x2926de(_0x3ea51a);})[_0x0944('0x9')](function(_0x29b0ea){_0x3e237b(_0x29b0ea);});});}function _0x32f7cb(_0x41ad9f,_0x2a3ceb,_0x24884f){if(!_0x2a3ceb)return Promise[_0x0944('0xd')](null);return new Promise(function(_0x44831c,_0x3adf2b){return _0xc33dac[_0x0944('0xe')]['findAll']({'where':{'sectionId':_0x2a3ceb['id']},'raw':!![]})['then'](function(_0xdcec2d){if(_0x41ad9f[_0x0944('0xa')]&&_0x41ad9f[_0x0944('0xa')]!=='id'){_0x2a3ceb['associatedResources']=_['map'](_0xdcec2d,function(_0x288d51){return _0x288d51[_0x41ad9f[_0x0944('0xa')]];});}else{if(_0x24884f===_0x0944('0xf')){_0x2a3ceb[_0x0944('0x7')]=_[_0x0944('0x8')](_0xdcec2d,function(_0x21aec8){return{'id':_0x21aec8[_0x0944('0x10')],'type':_0x21aec8[_0x0944('0x11')]};});}else{_0x2a3ceb['associatedResources']=_[_0x0944('0x8')](_0xdcec2d,function(_0x14278f){return _0x14278f[_0x0944('0x10')];});}}_0x44831c(_0x2a3ceb);})[_0x0944('0x9')](function(_0x1e5d46){_0x3adf2b(_0x1e5d46);});});}function _0x1dce1f(_0x254497,_0x9327fe){var _0x190d37={'parentSections':[]};switch(_0x254497['toLowerCase']()){case _0x0944('0x12'):_0x190d37['childModel']=_0x0944('0x13');break;case _0x0944('0x14'):_0x190d37[_0x0944('0x15')]=_0x0944('0x16');break;case'squarerecordings':_0x190d37[_0x0944('0x15')]=_0x0944('0x17');_0x190d37[_0x0944('0x18')]=[{'name':'SquareProjects','field':_0x0944('0xc'),'foreignKey':_0x0944('0x19')}];break;case _0x0944('0x1a'):_0x190d37[_0x0944('0x15')]=_0x0944('0x1b');break;case _0x0944('0x1c'):_0x190d37['childModel']='CmContact';_0x190d37[_0x0944('0x18')]=[{'name':_0x0944('0x1d'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x190d37[_0x0944('0x15')]=_0x0944('0x1e');break;case _0x0944('0x1f'):_0x190d37[_0x0944('0x15')]=_0x0944('0x20');break;case'globalcustomfields':_0x190d37[_0x0944('0x15')]=_0x0944('0x21');break;case'chatqueues':_0x190d37[_0x0944('0x15')]='ChatQueue';break;case _0x0944('0x22'):_0x190d37[_0x0944('0x15')]=_0x0944('0x23');break;case'faxqueues':_0x190d37[_0x0944('0x15')]=_0x0944('0x24');break;case'faxaccounts':_0x190d37['childModel']=_0x0944('0x25');break;case _0x0944('0x26'):case _0x0944('0x27'):case'outboundroutes':_0x190d37['childModel']=_0x0944('0x28');break;case'contexts':_0x190d37['childModel']=_0x0944('0x29');break;case _0x0944('0x2a'):_0x190d37['childModel']=_0x0944('0x2b');break;case'voicerecordings':_0x190d37[_0x0944('0x15')]=_0x0944('0x2c');_0x190d37[_0x0944('0x18')]=[{'name':_0x0944('0x2d'),'field':_0x0944('0xc'),'foreignKey':_0x0944('0x2e'),'model':_0x0944('0x2f'),'filter':{'field':'role','value':[_0x0944('0x30')]}},{'name':_0x0944('0x31'),'field':_0x0944('0xc'),'foreignKey':_0x0944('0x2e'),'model':_0x0944('0x2f'),'filter':{'field':'role','value':[_0x0944('0x32')]}},{'name':'VoiceQueues','field':_0x0944('0xc'),'foreignKey':_0x0944('0x33'),'model':_0x0944('0x34'),'filter':{'field':_0x0944('0x11'),'value':[_0x0944('0x35')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x0944('0x33'),'model':_0x0944('0x34'),'filter':{'field':'type','value':['outbound']}}];break;case _0x0944('0x36'):_0x190d37[_0x0944('0x15')]=_0x0944('0x37');break;case _0x0944('0x38'):_0x190d37[_0x0944('0x15')]='VoiceChanSpy';break;case _0x0944('0x39'):_0x190d37[_0x0944('0x15')]=_0x0944('0x3a');break;case'ivrcampaigns':_0x190d37[_0x0944('0x15')]='Campaign';break;case _0x0944('0x3b'):_0x190d37['childModel']=_0x0944('0x3c');break;case _0x0944('0x3d'):_0x190d37[_0x0944('0x15')]='MailAccount';break;case _0x0944('0x3e'):_0x190d37['childModel']=_0x0944('0x3f');break;case _0x0944('0x40'):_0x190d37[_0x0944('0x15')]='OpenchannelQueue';break;case _0x0944('0x41'):_0x190d37[_0x0944('0x15')]=_0x0944('0x42');break;case'smsqueues':_0x190d37[_0x0944('0x15')]=_0x0944('0x43');break;case _0x0944('0x44'):_0x190d37[_0x0944('0x15')]=_0x0944('0x45');break;case _0x0944('0x46'):_0x190d37[_0x0944('0x15')]=_0x0944('0x47');break;case'whatsappaccounts':_0x190d37[_0x0944('0x15')]='WhatsappAccount';break;case _0x0944('0x48'):_0x190d37['childModel']='Team';break;case'voicequeues':case'queuecampaigns':_0x190d37[_0x0944('0x15')]=_0x0944('0x34');if(_0x9327fe){_0x190d37[_0x0944('0x18')]=[{'name':_0x0944('0x49')},{'name':_0x0944('0x4a')}];}break;case'users':case _0x0944('0x4b'):case _0x0944('0x4c'):_0x190d37['childModel']=_0x0944('0x2f');if(_0x9327fe){_0x190d37[_0x0944('0x18')]=[{'name':_0x0944('0x4d'),'filter':{'field':_0x0944('0x4e'),'value':[_0x0944('0x4f'),_0x0944('0x50')]},'ignore':!![]},{'name':'Agents'},{'name':_0x0944('0x31')}];}break;case'zendeskaccounts':_0x190d37[_0x0944('0x15')]=_0x0944('0x51');break;case'salesforceaccounts':_0x190d37[_0x0944('0x15')]='SalesforceAccount';break;case _0x0944('0x52'):_0x190d37[_0x0944('0x15')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x190d37[_0x0944('0x15')]='SugarcrmAccount';break;case'deskaccounts':_0x190d37[_0x0944('0x15')]=_0x0944('0x53');break;case _0x0944('0x54'):_0x190d37[_0x0944('0x15')]=_0x0944('0x55');break;case'vtigeraccounts':_0x190d37['childModel']=_0x0944('0x2f');break;case _0x0944('0x56'):_0x190d37[_0x0944('0x15')]='CannedAnswer';break;case _0x0944('0x57'):_0x190d37['childModel']=_0x0944('0x58');break;case _0x0944('0x59'):_0x190d37[_0x0944('0x15')]='Dashboard';break;case'intervals':_0x190d37[_0x0944('0x15')]='Interval';break;case _0x0944('0x5a'):_0x190d37['childModel']=_0x0944('0x5b');break;case _0x0944('0x5c'):_0x190d37[_0x0944('0x15')]=_0x0944('0x5d');break;case'sounds':_0x190d37[_0x0944('0x15')]=_0x0944('0x5e');break;case _0x0944('0x5f'):_0x190d37[_0x0944('0x15')]=_0x0944('0x60');break;case _0x0944('0x61'):_0x190d37[_0x0944('0x15')]=_0x0944('0x62');break;case _0x0944('0x63'):_0x190d37[_0x0944('0x15')]='Trigger';break;case _0x0944('0x64'):_0x190d37[_0x0944('0x15')]=_0x0944('0x65');break;case _0x0944('0x66'):_0x190d37[_0x0944('0x15')]=_0x0944('0x67');break;case _0x0944('0x68'):_0x190d37[_0x0944('0x15')]=_0x0944('0x69');break;case _0x0944('0x6a'):_0x190d37[_0x0944('0x15')]=_0x0944('0xf');_0x190d37['parentSections']=[{'name':_0x0944('0x6b'),'field':'id','foreignKey':_0x0944('0x6c')}];break;case _0x0944('0x6d'):_0x190d37[_0x0944('0x15')]=_0x0944('0x6e');break;}return _0x190d37;}function _0x2e44c5(_0x1c9013,_0x4d470a){var _0x919138=_0x1c9013[_0x0944('0x6f')](0x0)[_0x0944('0x70')]()+_0x1c9013[_0x0944('0x71')](0x1);var _0x285ef7={'type':_0xc33dac[_0x0944('0x72')][_0x0944('0x73')][_0x0944('0x74')],'raw':!![]};return new Promise(function(_0x5d994b,_0x5ba3a3){var _0x5f05c5=squel[_0x0944('0x75')]()['field'](_0x0944('0x76')+_0x919138+_0x0944('0x77'),'id')[_0x0944('0xa')](_0x0944('0x78'))['from'](_0x0944('0x79')+_0x1c9013+_0x0944('0x7a'),'ui')['where'](_0x0944('0x7b'),_0x4d470a['id']);return _0xc33dac[_0x0944('0x7c')][_0x0944('0x7d')](_0x5f05c5[_0x0944('0x7e')](),_0x285ef7)[_0x0944('0x7f')](function(_0x412e10){_0x4d470a[_0x919138+_0x0944('0x80')]=_0x412e10;_0x5d994b(_0x412e10);})[_0x0944('0x9')](function(_0x2a382e){_0x5ba3a3(_0x2a382e);});});}return _0x2bd38b[_0x0944('0x81')](_0x0944('0x82'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3d1f43){var _0x113657={'raw':_0x3d1f43['query'][_0x0944('0x83')],'where':{}};var _0x154dd1={};var _0x21c1e3={'count':0x0,'rows':[]};var _0x1172ea=_0x3d1f43[_0x0944('0x7d')][_0x0944('0x84')];var _0x19be8e=_0x3d1f43[_0x0944('0x7d')][_0x0944('0x85')]||![];var _0x523c65=_0x1dce1f(_0x1172ea,_0x19be8e);if(!_0x523c65[_0x0944('0x15')])throw new Error(_0x0944('0x86')+_0x1172ea+'\x27');var _0xe4467e=[{'name':_0x1172ea}];if(!_[_0x0944('0x87')](_0x523c65['parentSections']))_0xe4467e=_0x523c65[_0x0944('0x18')];var _0x32cac6=[];for(var _0x22ac50=0x0;_0x22ac50<_0xe4467e['length'];_0x22ac50++){_0x32cac6[_0x0944('0x88')](_0xc33dac[_0x0944('0x89')]['find']({'where':{'userProfileId':_0x3d1f43[_0x0944('0x8a')]['id'],'name':_0xe4467e[_0x22ac50][_0x0944('0xc')]},'raw':!![]}));}return Promise[_0x0944('0x8b')](_0x32cac6)[_0x0944('0x7f')](function(_0x314ac3){var _0x59a093=_[_0x0944('0x4')](_0x314ac3,function(_0x1505bc){return _0x1505bc?_0x1505bc:undefined;});var _0x4b9838=_[_0x0944('0x4')](_0xe4467e,['ignore',!![]]);var _0x4de442=_[_0x0944('0x87')](_0x59a093)&&_['isEmpty'](_0x4b9838)?null:_['union'](_0x4b9838,_0x59a093);if(!_0x4de442)return null;var _0x511012=[];for(var _0xdcc9af=0x0;_0xdcc9af<_0x4de442['length'];_0xdcc9af++){var _0x51bf16=_['find'](_0xe4467e,function(_0x9964c){return _0x4de442[_0xdcc9af]?_0x9964c['name']===_0x4de442[_0xdcc9af][_0x0944('0xc')]:null;});if(_0x51bf16){if(_0x4de442[_0xdcc9af]['ignore']){_0x511012[_0x0944('0x88')](_0x99605d(_0x523c65['childModel'],_0x4de442[_0xdcc9af]));}else{if(!_0x4de442[_0xdcc9af][_0x0944('0x8c')]){_0x511012['push'](_0x32f7cb(_0x51bf16,_0x4de442[_0xdcc9af],_0x523c65[_0x0944('0x15')]));}else{if(_0x51bf16[_0x0944('0xb')]){_0x511012['push'](_0x24e8c9(_0x51bf16,_0x4de442[_0xdcc9af]));}}}}}return Promise[_0x0944('0x8b')](_0x511012);})['then'](function(_0x40cf15){var _0x518889=_0x40cf15;var _0x4b38a7=null;if(_0x518889){_0x4b38a7=_0x518889['length']===0x1?_0x518889[0x0]:null;}if(!_0x4b38a7&&!_0x518889)return _0x21c1e3;var _0x4239da=_0xc33dac[_0x523c65[_0x0944('0x15')]][_0x0944('0x8d')];_0x154dd1[_0x0944('0xb')]=_[_0x0944('0x8e')](_0x4239da);_0x154dd1['query']=_['keys'](_0x3d1f43[_0x0944('0x7d')]);_0x154dd1[_0x0944('0x8f')]=_[_0x0944('0x90')](_0x154dd1['model'],_0x154dd1[_0x0944('0x7d')]);_0x113657['attributes']=_[_0x0944('0x90')](_0x154dd1[_0x0944('0xb')],qs[_0x0944('0x91')](_0x3d1f43[_0x0944('0x7d')][_0x0944('0x91')]));_0x113657[_0x0944('0x92')]=_0x113657[_0x0944('0x92')][_0x0944('0x93')]?_0x113657[_0x0944('0x92')]:_0x154dd1[_0x0944('0xb')];if(!_0x3d1f43[_0x0944('0x7d')][_0x0944('0x94')](_0x0944('0x95'))){_0x113657[_0x0944('0x96')]=qs['limit'](_0x3d1f43[_0x0944('0x7d')]['limit']);_0x113657[_0x0944('0x97')]=qs[_0x0944('0x97')](_0x3d1f43['query'][_0x0944('0x97')]);}_0x113657['order']=qs['sort'](_0x3d1f43[_0x0944('0x7d')]['sort']);_0x113657[_0x0944('0x98')]=qs[_0x0944('0x8f')](_[_0x0944('0x99')](_0x3d1f43[_0x0944('0x7d')],_0x154dd1[_0x0944('0x8f')]));if(_0x3d1f43[_0x0944('0x7d')][_0x0944('0x4')]){_0x113657[_0x0944('0x98')]=_['merge'](_0x113657[_0x0944('0x98')],{'$or':_['map'](_0x4239da,function(_0x7bd644){if(_0x7bd644[_0x0944('0x11')]['key']!=='VIRTUAL'){var _0x55168f={};_0x55168f[_0x7bd644['field']]={'$like':'%'+_0x3d1f43[_0x0944('0x7d')][_0x0944('0x4')]+'%'};return _0x55168f;}})});}var _0x515a2e=[];var _0x106058=null;var _0x26ce0b={};if(_0x4b38a7){_0x106058=_[_0x0944('0x9a')](_0xe4467e,[_0x0944('0xc'),_0x4b38a7['name']]);if(_0x106058[_0x0944('0xa')]){_0x26ce0b={};if(_0x523c65[_0x0944('0x15')]===_0x0944('0xf')){_0x26ce0b[_0x106058[_0x0944('0x9b')]]=_['map'](_0x4b38a7[_0x0944('0x7')],'id');}else{_0x26ce0b[_0x106058[_0x0944('0x9b')]]=_0x4b38a7[_0x0944('0x7')];}_0x515a2e[_0x0944('0x88')](_0x26ce0b);}else{_0x113657[_0x0944('0x98')]['id']=_0x4b38a7[_0x0944('0x7')];}}else{for(var _0x4cf7fe=0x0;_0x4cf7fe<_0x518889[_0x0944('0x93')];_0x4cf7fe++){_0x106058=_['find'](_0xe4467e,[_0x0944('0xc'),_0x518889[_0x4cf7fe][_0x0944('0xc')]]);if(_0x106058[_0x0944('0xa')]){_0x26ce0b={};_0x26ce0b[_0x106058[_0x0944('0x9b')]]=_0x518889[_0x4cf7fe]['associatedResources'];_0x515a2e['push'](_0x26ce0b);}else{if(!_0x113657['where']['id'])_0x113657[_0x0944('0x98')]['id']=[];_0x518889[_0x4cf7fe]['associatedResources'][_0x0944('0x9c')](function(_0x58b2a7){_0x113657[_0x0944('0x98')]['id'][_0x0944('0x88')](_0x58b2a7);});}}}if(!_['isEmpty'](_0x515a2e)){_0x113657[_0x0944('0x98')]=_[_0x0944('0x9d')](_0x113657[_0x0944('0x98')],{'$and':{'$or':_0x515a2e}});}_0x113657=_['merge']({},_0x113657,_0x3d1f43['options']);if(_0x4b38a7&&!_0x4b38a7[_0x0944('0x8c')]&&_0x523c65[_0x0944('0x15')]==='AnalyticExtractedReport'){if(_0x3d1f43[_0x0944('0x7d')][_0x0944('0x9e')]){_0x113657[_0x0944('0x9f')]=[{'all':!![]}];}return _0xc33dac[_0x523c65[_0x0944('0x15')]][_0x0944('0x6')](_0x113657)['then'](function(_0x3256a8){var _0x2dbfbd=[];_0x3256a8[_0x0944('0x9c')](function(_0x120573){var _0x2fd2af;switch(_0x120573[_0x0944('0xa0')]){case'default':_0x2fd2af=_[_0x0944('0x9a')](_0x4b38a7[_0x0944('0x7')],function(_0x5870f3){return _0x5870f3['id']===_0x120573[_0x0944('0x6c')]&&_0x5870f3[_0x0944('0x11')]===_0x0944('0xa1');});break;case'custom':_0x2fd2af=_['find'](_0x4b38a7[_0x0944('0x7')],function(_0x2faac0){return _0x2faac0['id']===_0x120573['reportId']&&_0x2faac0[_0x0944('0x11')]===_0x0944('0xa2');});break;}if(_0x2fd2af)_0x2dbfbd[_0x0944('0x88')](_0x120573);});_0x21c1e3[_0x0944('0xa3')]=_0x2dbfbd['length'];_0x21c1e3[_0x0944('0xa4')]=_0x2dbfbd;return _0x21c1e3;});}else{return _0xc33dac[_0x523c65[_0x0944('0x15')]][_0x0944('0xa3')]({'where':_0x113657[_0x0944('0x98')]})[_0x0944('0x7f')](function(_0x50c8bf){_0x21c1e3[_0x0944('0xa3')]=_0x50c8bf;if(_0x3d1f43[_0x0944('0x7d')][_0x0944('0x9e')]){if(_0x523c65[_0x0944('0x15')]===_0x0944('0xa5')){_0x113657[_0x0944('0x9f')]=[{'model':_0xc33dac[_0x0944('0x60')],'as':_0x0944('0xa6'),'attributes':['id',_0x0944('0xc'),_0x0944('0xa7')],'required':_0x3d1f43[_0x0944('0x7d')]['tag']?!![]:![]},{'model':_0xc33dac[_0x0944('0x60')],'as':_0x0944('0xa8'),'attributes':['id',_0x0944('0xc'),_0x0944('0xa7')],'through':_0x3d1f43[_0x0944('0x7d')][_0x0944('0xa9')]?{'attributes':[],'where':{'TagId':_0x3d1f43['query'][_0x0944('0xa9')]||undefined}}:{},'required':_0x3d1f43[_0x0944('0x7d')][_0x0944('0xa9')]?!![]:![]}];}else{_0x113657[_0x0944('0x9f')]=[{'all':!![]}];}}return _0xc33dac[_0x523c65['childModel']][_0x0944('0x6')](_0x113657);})[_0x0944('0x7f')](function(_0x4beb03){_0x21c1e3[_0x0944('0xa4')]=_0x4beb03;if(_0x1172ea===_0x0944('0x2d')&&_0x3d1f43[_0x0944('0x7d')]['openTabs']==='true'){var _0x5cf367=[];for(var _0x25ef0e=0x0;_0x25ef0e<_0x21c1e3[_0x0944('0xa4')]['length'];_0x25ef0e++){_0x5cf367[_0x0944('0x88')](_0x2e44c5(_0x0944('0xaa'),_0x21c1e3['rows'][_0x25ef0e][_0x0944('0xab')]));_0x5cf367['push'](_0x2e44c5(_0x0944('0xac'),_0x21c1e3[_0x0944('0xa4')][_0x25ef0e][_0x0944('0xab')]));_0x5cf367[_0x0944('0x88')](_0x2e44c5(_0x0944('0xad'),_0x21c1e3['rows'][_0x25ef0e][_0x0944('0xab')]));_0x5cf367['push'](_0x2e44c5(_0x0944('0xae'),_0x21c1e3[_0x0944('0xa4')][_0x25ef0e][_0x0944('0xab')]));_0x5cf367[_0x0944('0x88')](_0x2e44c5(_0x0944('0xaf'),_0x21c1e3[_0x0944('0xa4')][_0x25ef0e][_0x0944('0xab')]));_0x5cf367['push'](_0x2e44c5(_0x0944('0xb0'),_0x21c1e3[_0x0944('0xa4')][_0x25ef0e]['dataValues']));}return Promise[_0x0944('0x8b')](_0x5cf367)[_0x0944('0x7f')](function(){return _0x21c1e3;});}return _0x21c1e3;});}});}}});}; \ No newline at end of file +var _0x609a=['ignore','push','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','CustomReports','count','rows','tag','color','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','SquareProject','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','childModel','CmContact','Lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','name','User','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','Tag','templates','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','union'];(function(_0x54c5b4,_0x218c30){var _0x1cae76=function(_0x57ff78){while(--_0x57ff78){_0x54c5b4['push'](_0x54c5b4['shift']());}};_0x1cae76(++_0x218c30);}(_0x609a,0x197));var _0xa609=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x609a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa609('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xa609('0x1'));var squel=require('squel');module[_0xa609('0x2')]=function(_0x4d2082){var _0x5c5687=_0x4d2082['models'];function _0x51352a(_0x61c340,_0x4cdad8){return new Promise(function(_0x45f4be,_0x5d49cc){if(!_0x4cdad8)return _0x45f4be(null);var _0x3e8cc2=_0x4cdad8['filter']?{[_0x4cdad8[_0xa609('0x3')][_0xa609('0x4')]]:_0x4cdad8[_0xa609('0x3')][_0xa609('0x5')]}:undefined;return _0x5c5687[_0x61c340][_0xa609('0x6')]({'where':_0x3e8cc2,'raw':!![]})[_0xa609('0x7')](function(_0x7ee66d){_0x4cdad8[_0xa609('0x8')]=_[_0xa609('0x9')](_0x7ee66d,'id');_0x45f4be(_0x4cdad8);})[_0xa609('0xa')](function(_0x2545c2){_0x5d49cc(_0x2545c2);});});}function _0x5a3e61(_0x17b57e,_0x18b77d){return new Promise(function(_0x13a028,_0x27a0e1){var _0xf9f2f5=_0x17b57e[_0xa609('0x3')]?{[_0x17b57e['filter'][_0xa609('0x4')]]:_0x17b57e[_0xa609('0x3')][_0xa609('0x5')]}:undefined;return _0x5c5687[_0x17b57e[_0xa609('0xb')]][_0xa609('0x6')]({'where':_0xf9f2f5,'raw':!![]})[_0xa609('0x7')](function(_0x375020){_0x18b77d[_0xa609('0x8')]=_[_0xa609('0x9')](_0x375020,function(_0x4f11c7){return _0x4f11c7['name'];});_0x13a028(_0x18b77d);})[_0xa609('0xa')](function(_0x3b03b7){_0x27a0e1(_0x3b03b7);});});}function _0x2c7ff9(_0x1fd340,_0x112167,_0x55e31e){if(!_0x112167)return Promise[_0xa609('0xc')](null);return new Promise(function(_0x4f6be8,_0x2ade5d){return _0x5c5687[_0xa609('0xd')]['findAll']({'where':{'sectionId':_0x112167['id']},'raw':!![]})[_0xa609('0x7')](function(_0x2418e8){if(_0x1fd340[_0xa609('0x4')]&&_0x1fd340[_0xa609('0x4')]!=='id'){_0x112167[_0xa609('0x8')]=_[_0xa609('0x9')](_0x2418e8,function(_0x44679f){return _0x44679f[_0x1fd340[_0xa609('0x4')]];});}else{if(_0x55e31e===_0xa609('0xe')){_0x112167[_0xa609('0x8')]=_[_0xa609('0x9')](_0x2418e8,function(_0x19f97e){return{'id':_0x19f97e[_0xa609('0xf')],'type':_0x19f97e[_0xa609('0x10')]};});}else{_0x112167[_0xa609('0x8')]=_['map'](_0x2418e8,function(_0x8bae82){return _0x8bae82['resourceId'];});}}_0x4f6be8(_0x112167);})[_0xa609('0xa')](function(_0x123427){_0x2ade5d(_0x123427);});});}function _0xc855c6(_0x2e1e60,_0x2cb7f0){var _0x3c7a4e={'parentSections':[]};switch(_0x2e1e60['toLowerCase']()){case _0xa609('0x11'):_0x3c7a4e['childModel']=_0xa609('0x12');break;case'odbc':_0x3c7a4e['childModel']=_0xa609('0x13');break;case _0xa609('0x14'):_0x3c7a4e['childModel']='SquareRecording';_0x3c7a4e[_0xa609('0x15')]=[{'name':_0xa609('0x16'),'field':'name','foreignKey':_0xa609('0x17')}];break;case _0xa609('0x18'):_0x3c7a4e['childModel']=_0xa609('0x19');break;case'contacts':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x1b');_0x3c7a4e['parentSections']=[{'name':_0xa609('0x1c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x3c7a4e['childModel']=_0xa609('0x1d');break;case'companies':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x1e');break;case _0xa609('0x1f'):_0x3c7a4e['childModel']=_0xa609('0x20');break;case _0xa609('0x21'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x22');break;case'chatwebsites':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x23');break;case _0xa609('0x24'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x25');break;case'faxaccounts':_0x3c7a4e['childModel']=_0xa609('0x26');break;case'inboundroutes':case _0xa609('0x27'):case _0xa609('0x28'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x29');break;case _0xa609('0x2a'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x2b');break;case _0xa609('0x2c'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x2d');break;case _0xa609('0x2e'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x2f');_0x3c7a4e[_0xa609('0x15')]=[{'name':_0xa609('0x30'),'field':'name','foreignKey':_0xa609('0x31'),'model':'User','filter':{'field':_0xa609('0x32'),'value':[_0xa609('0x33')]}},{'name':'Telephones','field':_0xa609('0x34'),'foreignKey':_0xa609('0x31'),'model':_0xa609('0x35'),'filter':{'field':_0xa609('0x32'),'value':[_0xa609('0x36')]}},{'name':_0xa609('0x37'),'field':_0xa609('0x34'),'foreignKey':'queue','model':_0xa609('0x38'),'filter':{'field':_0xa609('0x10'),'value':[_0xa609('0x39')]}},{'name':'QueueCampaigns','field':_0xa609('0x34'),'foreignKey':_0xa609('0x3a'),'model':_0xa609('0x38'),'filter':{'field':_0xa609('0x10'),'value':[_0xa609('0x3b')]}}];break;case'musiconholds':_0x3c7a4e[_0xa609('0x1a')]='VoiceMusicOnHold';break;case'chanspies':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x3c');break;case _0xa609('0x3d'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x3e');break;case _0xa609('0x3f'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x40');break;case _0xa609('0x41'):_0x3c7a4e['childModel']=_0xa609('0x42');break;case _0xa609('0x43'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x44');break;case'mailsubstatuses':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x45');break;case _0xa609('0x46'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x47');break;case'openchannelaccounts':_0x3c7a4e['childModel']=_0xa609('0x48');break;case'smsqueues':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x49');break;case _0xa609('0x4a'):_0x3c7a4e['childModel']=_0xa609('0x4b');break;case _0xa609('0x4c'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x4d');break;case _0xa609('0x4e'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x4f');break;case'teams':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x50');break;case _0xa609('0x51'):case _0xa609('0x52'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x38');if(_0x2cb7f0){_0x3c7a4e[_0xa609('0x15')]=[{'name':_0xa609('0x37')},{'name':_0xa609('0x53')}];}break;case _0xa609('0x54'):case _0xa609('0x55'):case'telephones':_0x3c7a4e[_0xa609('0x1a')]='User';if(_0x2cb7f0){_0x3c7a4e['parentSections']=[{'name':_0xa609('0x56'),'filter':{'field':_0xa609('0x32'),'value':[_0xa609('0x57'),_0xa609('0x58')]},'ignore':!![]},{'name':_0xa609('0x30')},{'name':_0xa609('0x59')}];}break;case _0xa609('0x5a'):_0x3c7a4e['childModel']=_0xa609('0x5b');break;case'salesforceaccounts':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x5c');break;case _0xa609('0x5d'):_0x3c7a4e[_0xa609('0x1a')]='FreshdeskAccount';break;case _0xa609('0x5e'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x5f');break;case'deskaccounts':_0x3c7a4e[_0xa609('0x1a')]='DeskAccount';break;case'zohoaccounts':_0x3c7a4e['childModel']=_0xa609('0x60');break;case _0xa609('0x61'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x35');break;case _0xa609('0x62'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x63');break;case _0xa609('0x64'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x65');break;case _0xa609('0x66'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x67');break;case _0xa609('0x68'):_0x3c7a4e[_0xa609('0x1a')]='Interval';break;case _0xa609('0x69'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x6a');break;case'scheduler':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x6b');break;case _0xa609('0x6c'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x6d');break;case'tags':_0x3c7a4e['childModel']=_0xa609('0x6e');break;case _0xa609('0x6f'):_0x3c7a4e['childModel']='Template';break;case _0xa609('0x70'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x71');break;case _0xa609('0x72'):_0x3c7a4e[_0xa609('0x1a')]='Trunk';break;case _0xa609('0x73'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x74');break;case _0xa609('0x75'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x76');break;case _0xa609('0x77'):_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0xe');_0x3c7a4e['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xa609('0x78')}];break;case'metrics':_0x3c7a4e[_0xa609('0x1a')]=_0xa609('0x79');break;}return _0x3c7a4e;}function _0x34622e(_0x510506,_0x33996d){var _0x4c46b8=_0x510506[_0xa609('0x7a')](0x0)[_0xa609('0x7b')]()+_0x510506['slice'](0x1);var _0x5900b5={'type':_0x5c5687['Sequelize']['QueryTypes'][_0xa609('0x7c')],'raw':!![]};return new Promise(function(_0x56bcb1,_0xef2b47){var _0x5df9f4=squel[_0xa609('0x7d')]()[_0xa609('0x4')](_0xa609('0x7e')+_0x4c46b8+'InteractionId','id')[_0xa609('0x4')](_0xa609('0x7f'))['from'](_0xa609('0x80')+_0x510506+_0xa609('0x81'),'ui')['where'](_0xa609('0x82'),_0x33996d['id']);return _0x5c5687[_0xa609('0x83')][_0xa609('0x84')](_0x5df9f4[_0xa609('0x85')](),_0x5900b5)[_0xa609('0x7')](function(_0x3fea2f){_0x33996d[_0x4c46b8+_0xa609('0x86')]=_0x3fea2f;_0x56bcb1(_0x3fea2f);})['catch'](function(_0x599f3b){_0xef2b47(_0x599f3b);});});}return _0x4d2082['define'](_0xa609('0x87'),attributes,{'tableName':_0xa609('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2c8ba1){var _0x54e3d0={'raw':_0x2c8ba1['query'][_0xa609('0x89')],'where':{}};var _0x3dce5f={};var _0x24a4d1={'count':0x0,'rows':[]};var _0x34b631=_0x2c8ba1['query'][_0xa609('0x8a')];var _0x497946=_0x2c8ba1[_0xa609('0x84')][_0xa609('0x8b')]||![];var _0x2f7930=_0xc855c6(_0x34b631,_0x497946);if(!_0x2f7930[_0xa609('0x1a')])throw new Error(_0xa609('0x8c')+_0x34b631+'\x27');var _0xe516e5=[{'name':_0x34b631}];if(!_[_0xa609('0x8d')](_0x2f7930['parentSections']))_0xe516e5=_0x2f7930[_0xa609('0x15')];var _0xc793f9=[];for(var _0x398147=0x0;_0x398147<_0xe516e5[_0xa609('0x8e')];_0x398147++){_0xc793f9['push'](_0x5c5687[_0xa609('0x8f')][_0xa609('0x90')]({'where':{'userProfileId':_0x2c8ba1[_0xa609('0x91')]['id'],'name':_0xe516e5[_0x398147]['name']},'raw':!![]}));}return Promise[_0xa609('0x92')](_0xc793f9)[_0xa609('0x7')](function(_0x7bfb5f){var _0x57a8f4=_[_0xa609('0x3')](_0x7bfb5f,function(_0x1bb11b){return _0x1bb11b?_0x1bb11b:undefined;});var _0x10a0b5=_[_0xa609('0x3')](_0xe516e5,['ignore',!![]]);var _0x1ae030=_[_0xa609('0x8d')](_0x57a8f4)&&_[_0xa609('0x8d')](_0x10a0b5)?null:_[_0xa609('0x93')](_0x10a0b5,_0x57a8f4);if(!_0x1ae030)return null;var _0x3c5120=[];for(var _0x109121=0x0;_0x109121<_0x1ae030[_0xa609('0x8e')];_0x109121++){var _0x4f18b3=_[_0xa609('0x90')](_0xe516e5,function(_0x2322ad){return _0x1ae030[_0x109121]?_0x2322ad[_0xa609('0x34')]===_0x1ae030[_0x109121][_0xa609('0x34')]:null;});if(_0x4f18b3){if(_0x1ae030[_0x109121][_0xa609('0x94')]){_0x3c5120[_0xa609('0x95')](_0x51352a(_0x2f7930[_0xa609('0x1a')],_0x1ae030[_0x109121]));}else{if(!_0x1ae030[_0x109121][_0xa609('0x96')]){_0x3c5120[_0xa609('0x95')](_0x2c7ff9(_0x4f18b3,_0x1ae030[_0x109121],_0x2f7930['childModel']));}else{if(_0x4f18b3[_0xa609('0xb')]){_0x3c5120[_0xa609('0x95')](_0x5a3e61(_0x4f18b3,_0x1ae030[_0x109121]));}}}}}return Promise[_0xa609('0x92')](_0x3c5120);})[_0xa609('0x7')](function(_0x4e0d92){var _0xb138f5=_0x4e0d92;var _0x1142fc=null;if(_0xb138f5){_0x1142fc=_0xb138f5[_0xa609('0x8e')]===0x1?_0xb138f5[0x0]:null;}if(!_0x1142fc&&!_0xb138f5)return _0x24a4d1;var _0x29edeb=_0x5c5687[_0x2f7930['childModel']]['rawAttributes'];_0x3dce5f[_0xa609('0xb')]=_[_0xa609('0x97')](_0x29edeb);_0x3dce5f[_0xa609('0x84')]=_[_0xa609('0x97')](_0x2c8ba1['query']);_0x3dce5f[_0xa609('0x98')]=_[_0xa609('0x99')](_0x3dce5f[_0xa609('0xb')],_0x3dce5f[_0xa609('0x84')]);_0x54e3d0[_0xa609('0x9a')]=_[_0xa609('0x99')](_0x3dce5f[_0xa609('0xb')],qs['fields'](_0x2c8ba1[_0xa609('0x84')][_0xa609('0x9b')]));_0x54e3d0[_0xa609('0x9a')]=_0x54e3d0['attributes']['length']?_0x54e3d0[_0xa609('0x9a')]:_0x3dce5f[_0xa609('0xb')];if(!_0x2c8ba1['query'][_0xa609('0x9c')](_0xa609('0x9d'))){_0x54e3d0[_0xa609('0x9e')]=qs[_0xa609('0x9e')](_0x2c8ba1[_0xa609('0x84')][_0xa609('0x9e')]);_0x54e3d0['offset']=qs[_0xa609('0x9f')](_0x2c8ba1['query'][_0xa609('0x9f')]);}_0x54e3d0['order']=qs[_0xa609('0xa0')](_0x2c8ba1[_0xa609('0x84')]['sort']);_0x54e3d0[_0xa609('0xa1')]=qs[_0xa609('0x98')](_[_0xa609('0xa2')](_0x2c8ba1[_0xa609('0x84')],_0x3dce5f[_0xa609('0x98')]));if(_0x2c8ba1['query'][_0xa609('0x3')]){_0x54e3d0[_0xa609('0xa1')]=_['merge'](_0x54e3d0[_0xa609('0xa1')],{'$or':_[_0xa609('0x9')](_0x29edeb,function(_0x225c76){if(_0x225c76[_0xa609('0x10')][_0xa609('0xa3')]!==_0xa609('0xa4')){var _0x5bd638={};_0x5bd638[_0x225c76[_0xa609('0x4')]]={'$like':'%'+_0x2c8ba1['query'][_0xa609('0x3')]+'%'};return _0x5bd638;}})});}var _0x156186=[];var _0x2ab932=null;var _0x59a9d7={};if(_0x1142fc){_0x2ab932=_[_0xa609('0x90')](_0xe516e5,[_0xa609('0x34'),_0x1142fc[_0xa609('0x34')]]);if(_0x2ab932[_0xa609('0x4')]){_0x59a9d7={};if(_0x2f7930['childModel']===_0xa609('0xe')){_0x59a9d7[_0x2ab932['foreignKey']]=_[_0xa609('0x9')](_0x1142fc[_0xa609('0x8')],'id');}else{_0x59a9d7[_0x2ab932['foreignKey']]=_0x1142fc[_0xa609('0x8')];}_0x156186[_0xa609('0x95')](_0x59a9d7);}else{_0x54e3d0[_0xa609('0xa1')]['id']=_0x1142fc['associatedResources'];}}else{for(var _0x325884=0x0;_0x325884<_0xb138f5[_0xa609('0x8e')];_0x325884++){_0x2ab932=_[_0xa609('0x90')](_0xe516e5,[_0xa609('0x34'),_0xb138f5[_0x325884][_0xa609('0x34')]]);if(_0x2ab932[_0xa609('0x4')]){_0x59a9d7={};_0x59a9d7[_0x2ab932[_0xa609('0xa5')]]=_0xb138f5[_0x325884][_0xa609('0x8')];_0x156186[_0xa609('0x95')](_0x59a9d7);}else{if(!_0x54e3d0['where']['id'])_0x54e3d0[_0xa609('0xa1')]['id']=[];_0xb138f5[_0x325884][_0xa609('0x8')][_0xa609('0xa6')](function(_0x1096ad){_0x54e3d0[_0xa609('0xa1')]['id'][_0xa609('0x95')](_0x1096ad);});}}}if(!_[_0xa609('0x8d')](_0x156186)){_0x54e3d0[_0xa609('0xa1')]=_['merge'](_0x54e3d0[_0xa609('0xa1')],{'$and':{'$or':_0x156186}});}_0x54e3d0=_['merge']({},_0x54e3d0,_0x2c8ba1[_0xa609('0xa7')]);if(_0x1142fc&&!_0x1142fc['autoAssociation']&&_0x2f7930[_0xa609('0x1a')]===_0xa609('0xe')){if(_0x2c8ba1['query'][_0xa609('0xa8')]){_0x54e3d0[_0xa609('0xa9')]=[{'all':!![]}];}return _0x5c5687[_0x2f7930[_0xa609('0x1a')]]['findAll'](_0x54e3d0)[_0xa609('0x7')](function(_0x5a5a15){var _0x2001df=[];_0x5a5a15['forEach'](function(_0x531a4c){var _0x350fee;switch(_0x531a4c[_0xa609('0xaa')]){case _0xa609('0xab'):_0x350fee=_[_0xa609('0x90')](_0x1142fc[_0xa609('0x8')],function(_0x1ed52a){return _0x1ed52a['id']===_0x531a4c[_0xa609('0x78')]&&_0x1ed52a['type']==='DefaultReports';});break;case'custom':_0x350fee=_['find'](_0x1142fc[_0xa609('0x8')],function(_0x1f0f6b){return _0x1f0f6b['id']===_0x531a4c['reportId']&&_0x1f0f6b['type']===_0xa609('0xac');});break;}if(_0x350fee)_0x2001df['push'](_0x531a4c);});_0x24a4d1[_0xa609('0xad')]=_0x2001df[_0xa609('0x8e')];_0x24a4d1[_0xa609('0xae')]=_0x2001df;return _0x24a4d1;});}else{return _0x5c5687[_0x2f7930[_0xa609('0x1a')]]['count']({'where':_0x54e3d0[_0xa609('0xa1')]})['then'](function(_0x488276){_0x24a4d1[_0xa609('0xad')]=_0x488276;if(_0x2c8ba1[_0xa609('0x84')][_0xa609('0xa8')]){if(_0x2f7930[_0xa609('0x1a')]===_0xa609('0x1b')){_0x54e3d0[_0xa609('0xa9')]=[{'model':_0x5c5687[_0xa609('0x6e')],'as':'Tags','attributes':['id',_0xa609('0x34'),'color'],'required':_0x2c8ba1[_0xa609('0x84')][_0xa609('0xaf')]?!![]:![]},{'model':_0x5c5687['Tag'],'as':'ThroughTags','attributes':['id','name',_0xa609('0xb0')],'through':_0x2c8ba1[_0xa609('0x84')][_0xa609('0xaf')]?{'attributes':[],'where':{'TagId':_0x2c8ba1[_0xa609('0x84')]['tag']||undefined}}:{},'required':_0x2c8ba1[_0xa609('0x84')][_0xa609('0xaf')]?!![]:![]}];}else{_0x54e3d0['include']=[{'all':!![]}];}}return _0x5c5687[_0x2f7930[_0xa609('0x1a')]]['findAll'](_0x54e3d0);})[_0xa609('0x7')](function(_0x376c67){_0x24a4d1[_0xa609('0xae')]=_0x376c67;if(_0x34b631===_0xa609('0x30')&&_0x2c8ba1[_0xa609('0x84')]['openTabs']===_0xa609('0xb1')){var _0x270f93=[];for(var _0x2da352=0x0;_0x2da352<_0x24a4d1[_0xa609('0xae')][_0xa609('0x8e')];_0x2da352++){_0x270f93[_0xa609('0x95')](_0x34622e(_0xa609('0xb2'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));_0x270f93[_0xa609('0x95')](_0x34622e(_0xa609('0xb4'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));_0x270f93['push'](_0x34622e(_0xa609('0xb5'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));_0x270f93['push'](_0x34622e(_0xa609('0xb6'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));_0x270f93['push'](_0x34622e(_0xa609('0xb7'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));_0x270f93[_0xa609('0x95')](_0x34622e(_0xa609('0xb8'),_0x24a4d1[_0xa609('0xae')][_0x2da352][_0xa609('0xb3')]));}return Promise[_0xa609('0x92')](_0x270f93)['then'](function(){return _0x24a4d1;});}return _0x24a4d1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0b768e8..8b2122d 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 _0xf446=['UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','register','request','then','info'];(function(_0x2abec4,_0x24c1da){var _0x27b8b0=function(_0xa303e4){while(--_0xa303e4){_0x2abec4['push'](_0x2abec4['shift']());}};_0x27b8b0(++_0x24c1da);}(_0xf446,0x1c0));var _0x6f44=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0xf446[_0x1e62b8];return _0x2ab271;};'use strict';var _=require(_0x6f44('0x0'));var util=require('util');var moment=require(_0x6f44('0x1'));var BPromise=require(_0x6f44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f44('0x4'));var logger=require(_0x6f44('0x5'))('rpc');var config=require(_0x6f44('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6f44('0x7')]=_['defaults'](config[_0x6f44('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f44('0x7')]));require('./userProfile.socket')[_0x6f44('0x8')](socket);function respondWithRpcPromise(_0x290e60,_0x3879cb,_0x2dfe9d){return new BPromise(function(_0xf9405a,_0x35ec9b){return client[_0x6f44('0x9')](_0x290e60,_0x2dfe9d)[_0x6f44('0xa')](function(_0x4b5907){logger[_0x6f44('0xb')](_0x6f44('0xc'),_0x3879cb,_0x6f44('0xd'));logger['debug'](_0x6f44('0xe'),_0x3879cb,_0x6f44('0xd'),JSON[_0x6f44('0xf')](_0x4b5907));if(_0x4b5907[_0x6f44('0x10')]){if(_0x4b5907['error'][_0x6f44('0x11')]===0x1f4){logger['error'](_0x6f44('0xc'),_0x3879cb,_0x4b5907['error']['message']);return _0x35ec9b(_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);}logger[_0x6f44('0x10')](_0x6f44('0xc'),_0x3879cb,_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);return _0xf9405a(_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);}else{logger[_0x6f44('0xb')](_0x6f44('0xc'),_0x3879cb,_0x6f44('0xd'));_0xf9405a(_0x4b5907['result'][_0x6f44('0x12')]);}})[_0x6f44('0x13')](function(_0x40f74c){logger[_0x6f44('0x10')](_0x6f44('0xc'),_0x3879cb,_0x40f74c);_0x35ec9b(_0x40f74c);});});} \ No newline at end of file +var _0x56b9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x56b9,0x196));var _0x956b=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x56b9[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var moment=require(_0x956b('0x2'));var BPromise=require(_0x956b('0x3'));var rs=require(_0x956b('0x4'));var fs=require('fs');var Redis=require(_0x956b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x956b('0x6'));var logger=require('../../config/logger')(_0x956b('0x7'));var config=require(_0x956b('0x8'));var jayson=require(_0x956b('0x9'));var client=jayson['client'][_0x956b('0xa')]({'port':0x232a});config[_0x956b('0xb')]=_[_0x956b('0xc')](config[_0x956b('0xb')],{'host':_0x956b('0xd'),'port':0x18eb});var socket=require(_0x956b('0xe'))(new Redis(config[_0x956b('0xb')]));require(_0x956b('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a48c6,_0x14336a,_0x5e2cb3){return new BPromise(function(_0x2cb25a,_0x36617d){return client[_0x956b('0x10')](_0x3a48c6,_0x5e2cb3)[_0x956b('0x11')](function(_0x69504e){logger['info'](_0x956b('0x12'),_0x14336a,_0x956b('0x13'));logger[_0x956b('0x14')](_0x956b('0x15'),_0x14336a,_0x956b('0x13'),JSON[_0x956b('0x16')](_0x69504e));if(_0x69504e[_0x956b('0x17')]){if(_0x69504e[_0x956b('0x17')][_0x956b('0x18')]===0x1f4){logger[_0x956b('0x17')](_0x956b('0x12'),_0x14336a,_0x69504e['error'][_0x956b('0x19')]);return _0x36617d(_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);}logger['error'](_0x956b('0x12'),_0x14336a,_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);return _0x2cb25a(_0x69504e[_0x956b('0x17')][_0x956b('0x19')]);}else{logger[_0x956b('0x1a')](_0x956b('0x12'),_0x14336a,'request\x20sent');_0x2cb25a(_0x69504e[_0x956b('0x1b')][_0x956b('0x19')]);}})[_0x956b('0x1c')](function(_0x4f724b){logger[_0x956b('0x17')](_0x956b('0x12'),_0x14336a,_0x4f724b);_0x36617d(_0x4f724b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3433db2..1e0d7ae 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 _0x72da=['remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x69ca55,_0x3378c0){var _0x1525aa=function(_0x14284a){while(--_0x14284a){_0x69ca55['push'](_0x69ca55['shift']());}};_0x1525aa(++_0x3378c0);}(_0x72da,0x142));var _0xa72d=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x72da[_0x4a7843];return _0x2c57fe;};'use strict';var UserProfileEvents=require(_0xa72d('0x0'));var events=[_0xa72d('0x1'),_0xa72d('0x2'),_0xa72d('0x3')];function createListener(_0x565629,_0x4f1443){return function(_0x362905){_0x4f1443[_0xa72d('0x4')](_0x565629,_0x362905);};}function removeListener(_0x4447c5,_0x3b4e09){return function(){UserProfileEvents[_0xa72d('0x5')](_0x4447c5,_0x3b4e09);};}exports[_0xa72d('0x6')]=function(_0x43d441){for(var _0x2bf78d=0x0,_0x7cdc02=events[_0xa72d('0x7')];_0x2bf78d<_0x7cdc02;_0x2bf78d++){var _0x555918=events[_0x2bf78d];var _0x528d81=createListener(_0xa72d('0x8')+_0x555918,_0x43d441);UserProfileEvents['on'](_0x555918,_0x528d81);}}; \ No newline at end of file +var _0x9daa=['removeListener','length','userProfile:','./userProfile.events','save','remove','update'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x9daa,0xdc));var _0xa9da=function(_0x373d25,_0x296b87){_0x373d25=_0x373d25-0x0;var _0x297df3=_0x9daa[_0x373d25];return _0x297df3;};'use strict';var UserProfileEvents=require(_0xa9da('0x0'));var events=[_0xa9da('0x1'),_0xa9da('0x2'),_0xa9da('0x3')];function createListener(_0xbb77a7,_0x5ef353){return function(_0xf76d99){_0x5ef353['emit'](_0xbb77a7,_0xf76d99);};}function removeListener(_0x1a9afa,_0x133a72){return function(){UserProfileEvents[_0xa9da('0x4')](_0x1a9afa,_0x133a72);};}exports['register']=function(_0x51963c){for(var _0x258548=0x0,_0x4bff53=events[_0xa9da('0x5')];_0x258548<_0x4bff53;_0x258548++){var _0x369f28=events[_0x258548];var _0x9a6146=createListener(_0xa9da('0x6')+_0x369f28,_0x51963c);UserProfileEvents['on'](_0x369f28,_0x9a6146);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f48b728..5046c5c 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 _0x051b=['../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x051b,0xea));var _0xb051=function(_0x53670e,_0x40b16a){_0x53670e=_0x53670e-0x0;var _0x505eca=_0x051b[_0x53670e];return _0x505eca;};'use strict';var multer=require('multer');var util=require(_0xb051('0x0'));var path=require(_0xb051('0x1'));var timeout=require(_0xb051('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb051('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb051('0x4'));var controller=require(_0xb051('0x5'));router[_0xb051('0x6')]('/',auth['isAuthenticated'](),controller[_0xb051('0x7')]);router['get']('/describe',auth[_0xb051('0x8')](),controller[_0xb051('0x9')]);router[_0xb051('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb051('0xa')]);router['post']('/',auth[_0xb051('0x8')](),controller['create']);router[_0xb051('0xb')](_0xb051('0xc'),auth[_0xb051('0x8')](),controller[_0xb051('0xd')]);router[_0xb051('0xe')](_0xb051('0xc'),auth['isAuthenticated'](),controller[_0xb051('0xf')]);module[_0xb051('0x10')]=router; \ No newline at end of file +var _0xfce5=['update','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','post','create','put'];(function(_0x121e66,_0x96aa94){var _0x4e6efe=function(_0x38b462){while(--_0x38b462){_0x121e66['push'](_0x121e66['shift']());}};_0x4e6efe(++_0x96aa94);}(_0xfce5,0x70));var _0x5fce=function(_0x46a658,_0x5d68d7){_0x46a658=_0x46a658-0x0;var _0x55119f=_0xfce5[_0x46a658];return _0x55119f;};'use strict';var multer=require('multer');var util=require(_0x5fce('0x0'));var path=require(_0x5fce('0x1'));var timeout=require(_0x5fce('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5fce('0x3'));var auth=require(_0x5fce('0x4'));var interaction=require(_0x5fce('0x5'));var config=require(_0x5fce('0x6'));var controller=require(_0x5fce('0x7'));router[_0x5fce('0x8')]('/',auth[_0x5fce('0x9')](),controller['index']);router[_0x5fce('0x8')]('/describe',auth[_0x5fce('0x9')](),controller[_0x5fce('0xa')]);router[_0x5fce('0x8')]('/:id',auth[_0x5fce('0x9')](),controller['show']);router[_0x5fce('0xb')]('/',auth[_0x5fce('0x9')](),controller[_0x5fce('0xc')]);router[_0x5fce('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5fce('0xe')]);router['delete'](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x10')]);module[_0x5fce('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9cc3a4e..312a71e 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 _0xc159=['INTEGER','sequelize','exports'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xc159,0xf7));var _0x9c15=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xc159[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x9c15('0x0'));module[_0x9c15('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9c15('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x930f=['INTEGER','sequelize','exports','STRING'];(function(_0x8a8924,_0x111b17){var _0x47f6e2=function(_0x19f604){while(--_0x19f604){_0x8a8924['push'](_0x8a8924['shift']());}};_0x47f6e2(++_0x111b17);}(_0x930f,0xc5));var _0xf930=function(_0x3a74d5,_0x3e668f){_0x3a74d5=_0x3a74d5-0x0;var _0xe4f64c=_0x930f[_0x3a74d5];return _0xe4f64c;};'use strict';var Sequelize=require(_0xf930('0x0'));module[_0xf930('0x1')]={'name':{'type':Sequelize[_0xf930('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf930('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf930('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 4b2932b..5e25173 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 _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x40bb01,_0x4a6b9b){var _0x294bac=function(_0x417730){while(--_0x417730){_0x40bb01['push'](_0x40bb01['shift']());}};_0x294bac(++_0x4a6b9b);}(_0xb016,0x159));var _0x6b01=function(_0x48529d,_0x5bcbb8){_0x48529d=_0x48529d-0x0;var _0x4752eb=_0xb016[_0x48529d];return _0x4752eb;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','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','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x40cdc3,_0x76825d){var _0x5bda2b=function(_0x1fc318){while(--_0x1fc318){_0x40cdc3['push'](_0x40cdc3['shift']());}};_0x5bda2b(++_0x76825d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1672d6,_0x34ccd7){_0x1672d6=_0x1672d6-0x0;var _0x3f949e=_0x5f2f[_0x1672d6];return _0x3f949e;};'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));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7a09b27..cc2fa36 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 _0x2fdd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x397dd0,_0x58a7a8){var _0x4188b2=function(_0x173bb7){while(--_0x173bb7){_0x397dd0['push'](_0x397dd0['shift']());}};_0x4188b2(++_0x58a7a8);}(_0x2fdd,0xbf));var _0xd2fd=function(_0x2a8831,_0x869c22){_0x2a8831=_0x2a8831-0x0;var _0x39652f=_0x2fdd[_0x2a8831];return _0x39652f;};'use strict';var _=require(_0xd2fd('0x0'));var util=require('util');var logger=require(_0xd2fd('0x1'))(_0xd2fd('0x2'));var moment=require(_0xd2fd('0x3'));var BPromise=require(_0xd2fd('0x4'));var rp=require(_0xd2fd('0x5'));var fs=require('fs');var path=require(_0xd2fd('0x6'));var rimraf=require(_0xd2fd('0x7'));var config=require(_0xd2fd('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xd2fd('0x9')]=function(_0x43c841,_0x162a1c){return _0x43c841[_0xd2fd('0xa')](_0xd2fd('0xb'),attributes,{'tableName':_0xd2fd('0xc'),'paranoid':![],'indexes':[{'name':_0xd2fd('0xd'),'fields':[_0xd2fd('0xe'),_0xd2fd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbdb=['define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xcbdb,0x171));var _0xbcbd=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xcbdb[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xbcbd('0x0'));var util=require('util');var logger=require(_0xbcbd('0x1'))(_0xbcbd('0x2'));var moment=require('moment');var BPromise=require(_0xbcbd('0x3'));var rp=require(_0xbcbd('0x4'));var fs=require('fs');var path=require(_0xbcbd('0x5'));var rimraf=require('rimraf');var config=require(_0xbcbd('0x6'));var attributes=require(_0xbcbd('0x7'));module[_0xbcbd('0x8')]=function(_0x16a88b,_0xd1877d){return _0x16a88b[_0xbcbd('0x9')]('UserProfileResource',attributes,{'tableName':_0xbcbd('0xa'),'paranoid':![],'indexes':[{'name':_0xbcbd('0xb'),'fields':[_0xbcbd('0xc'),_0xbcbd('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 7415a4e..fbbcb2d 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 _0x95e3=['http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x95e3,0xf7));var _0x395e=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x95e3[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x395e('0x0'));var util=require('util');var moment=require(_0x395e('0x1'));var BPromise=require(_0x395e('0x2'));var rs=require(_0x395e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x395e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x395e('0x5'));var config=require(_0x395e('0x6'));var jayson=require(_0x395e('0x7'));var client=jayson['client'][_0x395e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xccf2e3,_0x37fee7,_0x428024){return new BPromise(function(_0x19fe7d,_0x32e637){return client[_0x395e('0x9')](_0xccf2e3,_0x428024)['then'](function(_0x458104){logger['info'](_0x395e('0xa'),_0x37fee7,_0x395e('0xb'));logger[_0x395e('0xc')](_0x395e('0xd'),_0x37fee7,_0x395e('0xb'),JSON['stringify'](_0x458104));if(_0x458104[_0x395e('0xe')]){if(_0x458104[_0x395e('0xe')]['code']===0x1f4){logger[_0x395e('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x37fee7,_0x458104[_0x395e('0xe')][_0x395e('0xf')]);return _0x32e637(_0x458104[_0x395e('0xe')][_0x395e('0xf')]);}logger[_0x395e('0xe')](_0x395e('0xa'),_0x37fee7,_0x458104[_0x395e('0xe')][_0x395e('0xf')]);return _0x19fe7d(_0x458104[_0x395e('0xe')][_0x395e('0xf')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x37fee7,_0x395e('0xb'));_0x19fe7d(_0x458104['result'][_0x395e('0xf')]);}})[_0x395e('0x10')](function(_0x3132c8){logger[_0x395e('0xe')](_0x395e('0xa'),_0x37fee7,_0x3132c8);_0x32e637(_0x3132c8);});});} \ No newline at end of file +var _0x17f1=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0x17f1,0x1a9));var _0x117f=function(_0x480b53,_0x1dbda3){_0x480b53=_0x480b53-0x0;var _0x919d34=_0x17f1[_0x480b53];return _0x919d34;};'use strict';var _=require(_0x117f('0x0'));var util=require(_0x117f('0x1'));var moment=require(_0x117f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x117f('0x3'));var db=require(_0x117f('0x4'))['db'];var utils=require(_0x117f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x117f('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404631,_0x3ffa7e,_0x4295e2){return new BPromise(function(_0x369e35,_0x1d28bd){return client[_0x117f('0x7')](_0x404631,_0x4295e2)[_0x117f('0x8')](function(_0x46222a){logger[_0x117f('0x9')](_0x117f('0xa'),_0x3ffa7e,_0x117f('0xb'));logger[_0x117f('0xc')](_0x117f('0xd'),_0x3ffa7e,_0x117f('0xb'),JSON[_0x117f('0xe')](_0x46222a));if(_0x46222a['error']){if(_0x46222a[_0x117f('0xf')][_0x117f('0x10')]===0x1f4){logger[_0x117f('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x3ffa7e,_0x46222a['error'][_0x117f('0x11')]);return _0x1d28bd(_0x46222a['error'][_0x117f('0x11')]);}logger[_0x117f('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x3ffa7e,_0x46222a[_0x117f('0xf')]['message']);return _0x369e35(_0x46222a[_0x117f('0xf')][_0x117f('0x11')]);}else{logger['info'](_0x117f('0xa'),_0x3ffa7e,_0x117f('0xb'));_0x369e35(_0x46222a[_0x117f('0x12')][_0x117f('0x11')]);}})[_0x117f('0x13')](function(_0x56cab2){logger[_0x117f('0xf')](_0x117f('0xa'),_0x3ffa7e,_0x56cab2);_0x1d28bd(_0x56cab2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a01a408..83fe9f7 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 _0x8238=['/describe','describe','get','/:id','show','post','put','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x8238,0x1ab));var _0x8823=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x8238[_0x35d59c];return _0x18cd27;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8823('0x0'));var timeout=require(_0x8823('0x1'));var express=require('express');var router=express[_0x8823('0x2')]();var fs_extra=require(_0x8823('0x3'));var auth=require(_0x8823('0x4'));var interaction=require(_0x8823('0x5'));var config=require(_0x8823('0x6'));var controller=require(_0x8823('0x7'));router['get']('/',auth[_0x8823('0x8')](),controller[_0x8823('0x9')]);router['get'](_0x8823('0xa'),auth[_0x8823('0x8')](),controller[_0x8823('0xb')]);router[_0x8823('0xc')](_0x8823('0xd'),auth[_0x8823('0x8')](),controller[_0x8823('0xe')]);router[_0x8823('0xf')]('/',auth[_0x8823('0x8')](),controller['create']);router[_0x8823('0x10')](_0x8823('0xd'),auth[_0x8823('0x8')](),controller[_0x8823('0x11')]);router['delete']('/:id',auth[_0x8823('0x8')](),controller['destroy']);module[_0x8823('0x12')]=router; \ No newline at end of file +var _0x1cf8=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x11a485,_0x44430f){var _0x19308b=function(_0x337eb6){while(--_0x337eb6){_0x11a485['push'](_0x11a485['shift']());}};_0x19308b(++_0x44430f);}(_0x1cf8,0x178));var _0x81cf=function(_0x3cbb14,_0x3c95a7){_0x3cbb14=_0x3cbb14-0x0;var _0x2bfb35=_0x1cf8[_0x3cbb14];return _0x2bfb35;};'use strict';var multer=require(_0x81cf('0x0'));var util=require(_0x81cf('0x1'));var path=require(_0x81cf('0x2'));var timeout=require(_0x81cf('0x3'));var express=require(_0x81cf('0x4'));var router=express['Router']();var fs_extra=require(_0x81cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x81cf('0x6'));var config=require(_0x81cf('0x7'));var controller=require(_0x81cf('0x8'));router[_0x81cf('0x9')]('/',auth[_0x81cf('0xa')](),controller[_0x81cf('0xb')]);router[_0x81cf('0x9')](_0x81cf('0xc'),auth[_0x81cf('0xa')](),controller[_0x81cf('0xd')]);router[_0x81cf('0x9')](_0x81cf('0xe'),auth[_0x81cf('0xa')](),controller[_0x81cf('0xf')]);router[_0x81cf('0x10')]('/',auth[_0x81cf('0xa')](),controller[_0x81cf('0x11')]);router[_0x81cf('0x12')](_0x81cf('0xe'),auth[_0x81cf('0xa')](),controller[_0x81cf('0x13')]);router[_0x81cf('0x14')](_0x81cf('0xe'),auth[_0x81cf('0xa')](),controller[_0x81cf('0x15')]);module[_0x81cf('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ace99ee..f51cf07 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 _0x2032=['split','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x5b3eb6,_0x24b190){var _0x238e06=function(_0x19a984){while(--_0x19a984){_0x5b3eb6['push'](_0x5b3eb6['shift']());}};_0x238e06(++_0x24b190);}(_0x2032,0xd9));var _0x2203=function(_0x2d3531,_0x3a1088){_0x2d3531=_0x2d3531-0x0;var _0x54bfac=_0x2032[_0x2d3531];return _0x54bfac;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2203('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2203('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x46c49a){this[_0x2203('0x3')](_0x2203('0x4'),_0x46c49a?_0x46c49a[_0x2203('0x5')](''):[]);},'get':function(){return this[_0x2203('0x6')](_0x2203('0x4'))?this[_0x2203('0x6')](_0x2203('0x4'))[_0x2203('0x7')](''):[];}}}; \ No newline at end of file +var _0xeb74=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x2870cc,_0x3abd38){var _0x53cf3d=function(_0xe1b9f){while(--_0xe1b9f){_0x2870cc['push'](_0x2870cc['shift']());}};_0x53cf3d(++_0x3abd38);}(_0xeb74,0xe3));var _0x4eb7=function(_0x258ab5,_0x57b5bc){_0x258ab5=_0x258ab5-0x0;var _0x2c1e0e=_0xeb74[_0x258ab5];return _0x2c1e0e;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'name':{'type':Sequelize[_0x4eb7('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4eb7('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4eb7('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4eb7('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4eb7('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x35c7ca){this[_0x4eb7('0x5')](_0x4eb7('0x6'),_0x35c7ca?_0x35c7ca[_0x4eb7('0x7')](''):[]);},'get':function(){return this[_0x4eb7('0x8')]('crudPermissions')?this[_0x4eb7('0x8')]('crudPermissions')[_0x4eb7('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6690650..b88d6f2 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 _0xc940=['then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','options','includeAll','include','findAll','rows','show','filters','merge','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc940,0x113));var _0x0c94=function(_0x572836,_0x46b220){_0x572836=_0x572836-0x0;var _0x2ae0cc=_0xc940[_0x572836];return _0x2ae0cc;};'use strict';var emlformat=require(_0x0c94('0x0'));var rimraf=require(_0x0c94('0x1'));var zipdir=require(_0x0c94('0x2'));var jsonpatch=require(_0x0c94('0x3'));var rp=require(_0x0c94('0x4'));var moment=require(_0x0c94('0x5'));var BPromise=require(_0x0c94('0x6'));var Mustache=require(_0x0c94('0x7'));var util=require('util');var path=require(_0x0c94('0x8'));var sox=require(_0x0c94('0x9'));var csv=require(_0x0c94('0xa'));var ejs=require(_0x0c94('0xb'));var fs=require('fs');var fs_extra=require(_0x0c94('0xc'));var _=require(_0x0c94('0xd'));var squel=require(_0x0c94('0xe'));var crypto=require('crypto');var jsforce=require(_0x0c94('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0c94('0xa'));var querystring=require(_0x0c94('0x10'));var Papa=require(_0x0c94('0x11'));var Redis=require(_0x0c94('0x12'));var authService=require(_0x0c94('0x13'));var qs=require(_0x0c94('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c94('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0c94('0x16'));var config=require(_0x0c94('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c94('0x18'))['db'];function respondWithStatusCode(_0x4bf8d4,_0x431ab8){_0x431ab8=_0x431ab8||0xcc;return function(_0x34eedc){if(_0x34eedc){return _0x4bf8d4[_0x0c94('0x19')](_0x431ab8);}return _0x4bf8d4['status'](_0x431ab8)[_0x0c94('0x1a')]();};}function respondWithResult(_0x26871b,_0x212362){_0x212362=_0x212362||0xc8;return function(_0x1450a0){if(_0x1450a0){return _0x26871b[_0x0c94('0x1b')](_0x212362)['json'](_0x1450a0);}};}function respondWithFilteredResult(_0x370cd4,_0x25473b){return function(_0x58309b){if(_0x58309b){var _0x515618=typeof _0x25473b[_0x0c94('0x1c')]===_0x0c94('0x1d')&&typeof _0x25473b[_0x0c94('0x1e')]===_0x0c94('0x1d');var _0x3c0307=_0x58309b[_0x0c94('0x1f')];var _0xc41bb9=_0x515618?0x0:_0x25473b[_0x0c94('0x1c')];var _0x3e8647=_0x515618?_0x58309b['count']:_0x25473b[_0x0c94('0x1c')]+_0x25473b[_0x0c94('0x1e')];var _0x16e36a;if(_0x3e8647>=_0x3c0307){_0x3e8647=_0x3c0307;_0x16e36a=0xc8;}else{_0x16e36a=0xce;}_0x370cd4['status'](_0x16e36a);return _0x370cd4[_0x0c94('0x20')](_0x0c94('0x21'),_0xc41bb9+'-'+_0x3e8647+'/'+_0x3c0307)[_0x0c94('0x22')](_0x58309b);}return null;};}function patchUpdates(_0x3d7b60){return function(_0x59578a){try{jsonpatch[_0x0c94('0x23')](_0x59578a,_0x3d7b60,!![]);}catch(_0x3fe281){return BPromise['reject'](_0x3fe281);}return _0x59578a[_0x0c94('0x24')]();};}function saveUpdates(_0x12a1bc,_0x1af9d5){return function(_0x1a6c97){if(_0x1a6c97){return _0x1a6c97['update'](_0x12a1bc)[_0x0c94('0x25')](function(_0x46081e){return _0x46081e;});}return null;};}function removeEntity(_0x380fde,_0x27aa49){return function(_0x4743d9){if(_0x4743d9){return _0x4743d9[_0x0c94('0x26')]()['then'](function(){_0x380fde[_0x0c94('0x1b')](0xcc)[_0x0c94('0x1a')]();});}};}function handleEntityNotFound(_0x4240bc,_0x18a000){return function(_0x275f5d){if(!_0x275f5d){_0x4240bc[_0x0c94('0x19')](0x194);}return _0x275f5d;};}function handleError(_0xafed52,_0x44e538){_0x44e538=_0x44e538||0x1f4;return function(_0x5929e4){logger[_0x0c94('0x27')](_0x5929e4[_0x0c94('0x28')]);if(_0x5929e4[_0x0c94('0x29')]){delete _0x5929e4[_0x0c94('0x29')];}_0xafed52[_0x0c94('0x1b')](_0x44e538)[_0x0c94('0x2a')](_0x5929e4);};}exports[_0x0c94('0x2b')]=function(_0x24c8b9,_0x352fd7){var _0x5a53c4={},_0x136780={},_0x15ceb0={'count':0x0,'rows':[]};var _0x5adbc1=_[_0x0c94('0x2c')](db[_0x0c94('0x2d')][_0x0c94('0x2e')],function(_0x1507da){return{'name':_0x1507da[_0x0c94('0x2f')],'type':_0x1507da[_0x0c94('0x30')][_0x0c94('0x31')]};});_0x136780[_0x0c94('0x32')]=_[_0x0c94('0x2c')](_0x5adbc1,_0x0c94('0x29'));_0x136780[_0x0c94('0x33')]=_[_0x0c94('0x34')](_0x24c8b9[_0x0c94('0x33')]);_0x136780['filters']=_['intersection'](_0x136780[_0x0c94('0x32')],_0x136780['query']);_0x5a53c4[_0x0c94('0x35')]=_[_0x0c94('0x36')](_0x136780['model'],qs[_0x0c94('0x37')](_0x24c8b9[_0x0c94('0x33')]['fields']));_0x5a53c4['attributes']=_0x5a53c4[_0x0c94('0x35')][_0x0c94('0x38')]?_0x5a53c4[_0x0c94('0x35')]:_0x136780['model'];if(!_0x24c8b9[_0x0c94('0x33')][_0x0c94('0x39')](_0x0c94('0x3a'))){_0x5a53c4['limit']=qs[_0x0c94('0x1e')](_0x24c8b9['query'][_0x0c94('0x1e')]);_0x5a53c4[_0x0c94('0x1c')]=qs[_0x0c94('0x1c')](_0x24c8b9[_0x0c94('0x33')]['offset']);}_0x5a53c4[_0x0c94('0x3b')]=qs['sort'](_0x24c8b9[_0x0c94('0x33')]['sort']);_0x5a53c4[_0x0c94('0x3c')]=qs['filters'](_[_0x0c94('0x3d')](_0x24c8b9[_0x0c94('0x33')],_0x136780['filters']),_0x5adbc1);if(_0x24c8b9[_0x0c94('0x33')][_0x0c94('0x3e')]){_0x5a53c4[_0x0c94('0x3c')]=_['merge'](_0x5a53c4[_0x0c94('0x3c')],{'$or':_[_0x0c94('0x2c')](_0x5adbc1,function(_0x430811){if(_0x430811['type']!=='VIRTUAL'){var _0x1406a6={};_0x1406a6[_0x430811[_0x0c94('0x29')]]={'$like':'%'+_0x24c8b9[_0x0c94('0x33')][_0x0c94('0x3e')]+'%'};return _0x1406a6;}})});}_0x5a53c4=_['merge']({},_0x5a53c4,_0x24c8b9[_0x0c94('0x3f')]);var _0x1c9d25={'where':_0x5a53c4[_0x0c94('0x3c')]};return db[_0x0c94('0x2d')][_0x0c94('0x1f')](_0x1c9d25)[_0x0c94('0x25')](function(_0xb7215f){_0x15ceb0[_0x0c94('0x1f')]=_0xb7215f;if(_0x24c8b9[_0x0c94('0x33')][_0x0c94('0x40')]){_0x5a53c4[_0x0c94('0x41')]=[{'all':!![]}];}return db[_0x0c94('0x2d')][_0x0c94('0x42')](_0x5a53c4);})[_0x0c94('0x25')](function(_0x418059){_0x15ceb0[_0x0c94('0x43')]=_0x418059;return _0x15ceb0;})[_0x0c94('0x25')](respondWithFilteredResult(_0x352fd7,_0x5a53c4))['catch'](handleError(_0x352fd7,null));};exports[_0x0c94('0x44')]=function(_0x2d271e,_0x1d713f){var _0x3276f6={'raw':![],'where':{'id':_0x2d271e['params']['id']}},_0x128531={};_0x128531['model']=_[_0x0c94('0x34')](db['UserProfileSection']['rawAttributes']);_0x128531[_0x0c94('0x33')]=_[_0x0c94('0x34')](_0x2d271e['query']);_0x128531[_0x0c94('0x45')]=_[_0x0c94('0x36')](_0x128531[_0x0c94('0x32')],_0x128531['query']);_0x3276f6[_0x0c94('0x35')]=_[_0x0c94('0x36')](_0x128531[_0x0c94('0x32')],qs[_0x0c94('0x37')](_0x2d271e['query'][_0x0c94('0x37')]));_0x3276f6[_0x0c94('0x35')]=_0x3276f6[_0x0c94('0x35')][_0x0c94('0x38')]?_0x3276f6[_0x0c94('0x35')]:_0x128531[_0x0c94('0x32')];if(_0x2d271e[_0x0c94('0x33')]['includeAll']){_0x3276f6[_0x0c94('0x41')]=[{'all':!![]}];}_0x3276f6=_[_0x0c94('0x46')]({},_0x3276f6,_0x2d271e[_0x0c94('0x3f')]);return db[_0x0c94('0x2d')][_0x0c94('0x47')](_0x3276f6)[_0x0c94('0x25')](handleEntityNotFound(_0x1d713f,null))[_0x0c94('0x25')](respondWithResult(_0x1d713f,null))[_0x0c94('0x48')](handleError(_0x1d713f,null));};exports[_0x0c94('0x49')]=function(_0x2c0c0a,_0xa6455c){return db['UserProfileSection'][_0x0c94('0x49')](_0x2c0c0a[_0x0c94('0x4a')],{})[_0x0c94('0x25')](respondWithResult(_0xa6455c,0xc9))[_0x0c94('0x48')](handleError(_0xa6455c,null));};exports[_0x0c94('0x4b')]=function(_0x5221b9,_0x283be0){if(_0x5221b9[_0x0c94('0x4a')]['id']){delete _0x5221b9[_0x0c94('0x4a')]['id'];}return db['UserProfileSection'][_0x0c94('0x47')]({'where':{'id':_0x5221b9[_0x0c94('0x4c')]['id']}})['then'](handleEntityNotFound(_0x283be0,null))[_0x0c94('0x25')](saveUpdates(_0x5221b9[_0x0c94('0x4a')],null))[_0x0c94('0x25')](respondWithResult(_0x283be0,null))['catch'](handleError(_0x283be0,null));};exports['destroy']=function(_0x4b0c81,_0x421467){return db[_0x0c94('0x2d')][_0x0c94('0x47')]({'where':{'id':_0x4b0c81[_0x0c94('0x4c')]['id']}})[_0x0c94('0x25')](handleEntityNotFound(_0x421467,null))[_0x0c94('0x25')](removeEntity(_0x421467,null))[_0x0c94('0x48')](handleError(_0x421467,null));};exports[_0x0c94('0x4d')]=function(_0x42b792,_0x54bad5){return db['UserProfileSection'][_0x0c94('0x4d')]()[_0x0c94('0x25')](respondWithResult(_0x54bad5,null))[_0x0c94('0x48')](handleError(_0x54bad5,null));}; \ No newline at end of file +var _0xc411=['Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','UserProfileSection','keys','options','create','body','params','find','describe','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xc411,0x7c));var _0x1c41=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xc411[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0x1c41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c41('0x2'));var moment=require(_0x1c41('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c41('0x4'));var util=require('util');var path=require(_0x1c41('0x5'));var sox=require(_0x1c41('0x6'));var csv=require(_0x1c41('0x7'));var ejs=require(_0x1c41('0x8'));var fs=require('fs');var fs_extra=require(_0x1c41('0x9'));var _=require(_0x1c41('0xa'));var squel=require(_0x1c41('0xb'));var crypto=require('crypto');var jsforce=require(_0x1c41('0xc'));var deskjs=require(_0x1c41('0xd'));var toCsv=require(_0x1c41('0x7'));var querystring=require(_0x1c41('0xe'));var Papa=require('papaparse');var Redis=require(_0x1c41('0xf'));var authService=require(_0x1c41('0x10'));var qs=require(_0x1c41('0x11'));var as=require(_0x1c41('0x12'));var hardwareService=require(_0x1c41('0x13'));var logger=require('../../config/logger')(_0x1c41('0x14'));var utils=require('../../config/utils');var config=require(_0x1c41('0x15'));var licenseUtil=require(_0x1c41('0x16'));var db=require(_0x1c41('0x17'))['db'];function respondWithStatusCode(_0xc3484c,_0x3582f6){_0x3582f6=_0x3582f6||0xcc;return function(_0x2f6fd6){if(_0x2f6fd6){return _0xc3484c[_0x1c41('0x18')](_0x3582f6);}return _0xc3484c[_0x1c41('0x19')](_0x3582f6)['end']();};}function respondWithResult(_0x2788d8,_0x1d197c){_0x1d197c=_0x1d197c||0xc8;return function(_0x2e2b44){if(_0x2e2b44){return _0x2788d8[_0x1c41('0x19')](_0x1d197c)[_0x1c41('0x1a')](_0x2e2b44);}};}function respondWithFilteredResult(_0x5225f3,_0x27533b){return function(_0x5215b9){if(_0x5215b9){var _0x5b56d1=typeof _0x27533b[_0x1c41('0x1b')]===_0x1c41('0x1c')&&typeof _0x27533b[_0x1c41('0x1d')]===_0x1c41('0x1c');var _0xfb25ac=_0x5215b9['count'];var _0x2d1596=_0x5b56d1?0x0:_0x27533b[_0x1c41('0x1b')];var _0x4d157f=_0x5b56d1?_0x5215b9[_0x1c41('0x1e')]:_0x27533b[_0x1c41('0x1b')]+_0x27533b['limit'];var _0x30315d;if(_0x4d157f>=_0xfb25ac){_0x4d157f=_0xfb25ac;_0x30315d=0xc8;}else{_0x30315d=0xce;}_0x5225f3['status'](_0x30315d);return _0x5225f3[_0x1c41('0x1f')](_0x1c41('0x20'),_0x2d1596+'-'+_0x4d157f+'/'+_0xfb25ac)['json'](_0x5215b9);}return null;};}function patchUpdates(_0x1364e9){return function(_0x54c37c){try{jsonpatch[_0x1c41('0x21')](_0x54c37c,_0x1364e9,!![]);}catch(_0x4ecc93){return BPromise[_0x1c41('0x22')](_0x4ecc93);}return _0x54c37c[_0x1c41('0x23')]();};}function saveUpdates(_0xcffb9c,_0x35929b){return function(_0x320553){if(_0x320553){return _0x320553[_0x1c41('0x24')](_0xcffb9c)['then'](function(_0x121534){return _0x121534;});}return null;};}function removeEntity(_0x5a0389,_0x4ec4fc){return function(_0x229052){if(_0x229052){return _0x229052[_0x1c41('0x25')]()[_0x1c41('0x26')](function(){_0x5a0389[_0x1c41('0x19')](0xcc)[_0x1c41('0x27')]();});}};}function handleEntityNotFound(_0x4339c5,_0x4f41b0){return function(_0x20eb04){if(!_0x20eb04){_0x4339c5[_0x1c41('0x18')](0x194);}return _0x20eb04;};}function handleError(_0x510f1c,_0x4eb3c2){_0x4eb3c2=_0x4eb3c2||0x1f4;return function(_0x52007e){logger[_0x1c41('0x28')](_0x52007e[_0x1c41('0x29')]);if(_0x52007e[_0x1c41('0x2a')]){delete _0x52007e[_0x1c41('0x2a')];}_0x510f1c['status'](_0x4eb3c2)['send'](_0x52007e);};}exports[_0x1c41('0x2b')]=function(_0xf2e36f,_0x32288e){var _0x4bdb64={},_0x332ab8={},_0x431afe={'count':0x0,'rows':[]};var _0x2611bd=_['map'](db['UserProfileSection'][_0x1c41('0x2c')],function(_0x290100){return{'name':_0x290100['fieldName'],'type':_0x290100[_0x1c41('0x2d')][_0x1c41('0x2e')]};});_0x332ab8[_0x1c41('0x2f')]=_[_0x1c41('0x30')](_0x2611bd,_0x1c41('0x2a'));_0x332ab8[_0x1c41('0x31')]=_['keys'](_0xf2e36f[_0x1c41('0x31')]);_0x332ab8[_0x1c41('0x32')]=_[_0x1c41('0x33')](_0x332ab8[_0x1c41('0x2f')],_0x332ab8[_0x1c41('0x31')]);_0x4bdb64[_0x1c41('0x34')]=_[_0x1c41('0x33')](_0x332ab8[_0x1c41('0x2f')],qs['fields'](_0xf2e36f['query'][_0x1c41('0x35')]));_0x4bdb64['attributes']=_0x4bdb64[_0x1c41('0x34')][_0x1c41('0x36')]?_0x4bdb64[_0x1c41('0x34')]:_0x332ab8[_0x1c41('0x2f')];if(!_0xf2e36f[_0x1c41('0x31')][_0x1c41('0x37')](_0x1c41('0x38'))){_0x4bdb64[_0x1c41('0x1d')]=qs[_0x1c41('0x1d')](_0xf2e36f[_0x1c41('0x31')]['limit']);_0x4bdb64[_0x1c41('0x1b')]=qs[_0x1c41('0x1b')](_0xf2e36f[_0x1c41('0x31')]['offset']);}_0x4bdb64[_0x1c41('0x39')]=qs['sort'](_0xf2e36f[_0x1c41('0x31')][_0x1c41('0x3a')]);_0x4bdb64[_0x1c41('0x3b')]=qs[_0x1c41('0x32')](_[_0x1c41('0x3c')](_0xf2e36f[_0x1c41('0x31')],_0x332ab8[_0x1c41('0x32')]),_0x2611bd);if(_0xf2e36f[_0x1c41('0x31')][_0x1c41('0x3d')]){_0x4bdb64[_0x1c41('0x3b')]=_[_0x1c41('0x3e')](_0x4bdb64[_0x1c41('0x3b')],{'$or':_[_0x1c41('0x30')](_0x2611bd,function(_0x4ef24b){if(_0x4ef24b[_0x1c41('0x2d')]!==_0x1c41('0x3f')){var _0x4efb23={};_0x4efb23[_0x4ef24b[_0x1c41('0x2a')]]={'$like':'%'+_0xf2e36f['query'][_0x1c41('0x3d')]+'%'};return _0x4efb23;}})});}_0x4bdb64=_[_0x1c41('0x3e')]({},_0x4bdb64,_0xf2e36f['options']);var _0x40f530={'where':_0x4bdb64[_0x1c41('0x3b')]};return db['UserProfileSection']['count'](_0x40f530)[_0x1c41('0x26')](function(_0x25973f){_0x431afe['count']=_0x25973f;if(_0xf2e36f[_0x1c41('0x31')][_0x1c41('0x40')]){_0x4bdb64[_0x1c41('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1c41('0x42')](_0x4bdb64);})[_0x1c41('0x26')](function(_0x111b3d){_0x431afe[_0x1c41('0x43')]=_0x111b3d;return _0x431afe;})[_0x1c41('0x26')](respondWithFilteredResult(_0x32288e,_0x4bdb64))[_0x1c41('0x44')](handleError(_0x32288e,null));};exports[_0x1c41('0x45')]=function(_0x563a79,_0x30b2a4){var _0x3543ac={'raw':![],'where':{'id':_0x563a79['params']['id']}},_0x45241d={};_0x45241d[_0x1c41('0x2f')]=_['keys'](db[_0x1c41('0x46')]['rawAttributes']);_0x45241d['query']=_[_0x1c41('0x47')](_0x563a79[_0x1c41('0x31')]);_0x45241d[_0x1c41('0x32')]=_['intersection'](_0x45241d['model'],_0x45241d[_0x1c41('0x31')]);_0x3543ac['attributes']=_['intersection'](_0x45241d[_0x1c41('0x2f')],qs[_0x1c41('0x35')](_0x563a79[_0x1c41('0x31')][_0x1c41('0x35')]));_0x3543ac[_0x1c41('0x34')]=_0x3543ac[_0x1c41('0x34')][_0x1c41('0x36')]?_0x3543ac['attributes']:_0x45241d[_0x1c41('0x2f')];if(_0x563a79[_0x1c41('0x31')]['includeAll']){_0x3543ac[_0x1c41('0x41')]=[{'all':!![]}];}_0x3543ac=_[_0x1c41('0x3e')]({},_0x3543ac,_0x563a79[_0x1c41('0x48')]);return db[_0x1c41('0x46')]['find'](_0x3543ac)[_0x1c41('0x26')](handleEntityNotFound(_0x30b2a4,null))[_0x1c41('0x26')](respondWithResult(_0x30b2a4,null))[_0x1c41('0x44')](handleError(_0x30b2a4,null));};exports['create']=function(_0x4ab7e6,_0x7bffa4){return db[_0x1c41('0x46')][_0x1c41('0x49')](_0x4ab7e6[_0x1c41('0x4a')],{})[_0x1c41('0x26')](respondWithResult(_0x7bffa4,0xc9))[_0x1c41('0x44')](handleError(_0x7bffa4,null));};exports[_0x1c41('0x24')]=function(_0x17a3e8,_0x4ae610){if(_0x17a3e8['body']['id']){delete _0x17a3e8['body']['id'];}return db[_0x1c41('0x46')]['find']({'where':{'id':_0x17a3e8[_0x1c41('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ae610,null))[_0x1c41('0x26')](saveUpdates(_0x17a3e8[_0x1c41('0x4a')],null))[_0x1c41('0x26')](respondWithResult(_0x4ae610,null))[_0x1c41('0x44')](handleError(_0x4ae610,null));};exports[_0x1c41('0x25')]=function(_0x479d49,_0x13e157){return db[_0x1c41('0x46')][_0x1c41('0x4c')]({'where':{'id':_0x479d49[_0x1c41('0x4b')]['id']}})[_0x1c41('0x26')](handleEntityNotFound(_0x13e157,null))[_0x1c41('0x26')](removeEntity(_0x13e157,null))[_0x1c41('0x44')](handleError(_0x13e157,null));};exports[_0x1c41('0x4d')]=function(_0x4510cd,_0x5674d2){return db['UserProfileSection']['describe']()[_0x1c41('0x26')](respondWithResult(_0x5674d2,null))[_0x1c41('0x44')](handleError(_0x5674d2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d444323..eeb2244 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 _0x3e30=['bluebird','request-promise','rimraf','./userProfileSection.attributes','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','api','moment'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0x3e30,0x15c));var _0x03e3=function(_0x46fafc,_0x3f5d1f){_0x46fafc=_0x46fafc-0x0;var _0x227d2a=_0x3e30[_0x46fafc];return _0x227d2a;};'use strict';var _=require('lodash');var util=require(_0x03e3('0x0'));var logger=require(_0x03e3('0x1'))(_0x03e3('0x2'));var moment=require(_0x03e3('0x3'));var BPromise=require(_0x03e3('0x4'));var rp=require(_0x03e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x03e3('0x7'));module['exports']=function(_0x864159,_0x1bfc67){return _0x864159['define']('UserProfileSection',attributes,{'tableName':_0x03e3('0x8'),'paranoid':![],'indexes':[{'name':_0x03e3('0x9'),'fields':['sectionId',_0x03e3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc8d=['exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b381e,_0x16cf34){var _0x4e2c73=function(_0x2dee2c){while(--_0x2dee2c){_0x1b381e['push'](_0x1b381e['shift']());}};_0x4e2c73(++_0x16cf34);}(_0xcc8d,0xfc));var _0xdcc8=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xcc8d[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0xdcc8('0x0'));var util=require(_0xdcc8('0x1'));var logger=require('../../config/logger')(_0xdcc8('0x2'));var moment=require('moment');var BPromise=require(_0xdcc8('0x3'));var rp=require(_0xdcc8('0x4'));var fs=require('fs');var path=require(_0xdcc8('0x5'));var rimraf=require(_0xdcc8('0x6'));var config=require(_0xdcc8('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xdcc8('0x8')]=function(_0xf3a05d,_0x50bf40){return _0xf3a05d[_0xdcc8('0x9')](_0xdcc8('0xa'),attributes,{'tableName':_0xdcc8('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xdcc8('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b849142..d5c0c17 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 _0x6bd9=['client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x161f1d,_0x54bc9e){var _0x1c1600=function(_0xc83e72){while(--_0xc83e72){_0x161f1d['push'](_0x161f1d['shift']());}};_0x1c1600(++_0x54bc9e);}(_0x6bd9,0xd5));var _0x96bd=function(_0x12b7cb,_0x3d428e){_0x12b7cb=_0x12b7cb-0x0;var _0x7acbd4=_0x6bd9[_0x12b7cb];return _0x7acbd4;};'use strict';var _=require(_0x96bd('0x0'));var util=require(_0x96bd('0x1'));var moment=require('moment');var BPromise=require(_0x96bd('0x2'));var rs=require(_0x96bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96bd('0x4'))(_0x96bd('0x5'));var config=require(_0x96bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x96bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e63d5,_0x39b9db,_0x3aa51c){return new BPromise(function(_0x50eb0b,_0x5e8cab){return client[_0x96bd('0x8')](_0x1e63d5,_0x3aa51c)[_0x96bd('0x9')](function(_0x23b5e3){logger[_0x96bd('0xa')](_0x96bd('0xb'),_0x39b9db,'request\x20sent');logger[_0x96bd('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x39b9db,'request\x20sent',JSON[_0x96bd('0xd')](_0x23b5e3));if(_0x23b5e3[_0x96bd('0xe')]){if(_0x23b5e3[_0x96bd('0xe')][_0x96bd('0xf')]===0x1f4){logger[_0x96bd('0xe')](_0x96bd('0xb'),_0x39b9db,_0x23b5e3['error'][_0x96bd('0x10')]);return _0x5e8cab(_0x23b5e3[_0x96bd('0xe')][_0x96bd('0x10')]);}logger[_0x96bd('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x39b9db,_0x23b5e3[_0x96bd('0xe')][_0x96bd('0x10')]);return _0x50eb0b(_0x23b5e3[_0x96bd('0xe')]['message']);}else{logger[_0x96bd('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x39b9db,_0x96bd('0x11'));_0x50eb0b(_0x23b5e3[_0x96bd('0x12')][_0x96bd('0x10')]);}})[_0x96bd('0x13')](function(_0x43a7fe){logger[_0x96bd('0xe')](_0x96bd('0xb'),_0x39b9db,_0x43a7fe);_0x5e8cab(_0x43a7fe);});});} \ No newline at end of file +var _0x2cc4=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2cc4,0xdd));var _0x42cc=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x2cc4[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var moment=require(_0x42cc('0x2'));var BPromise=require(_0x42cc('0x3'));var rs=require(_0x42cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42cc('0x5'))['db'];var utils=require(_0x42cc('0x6'));var logger=require('../../config/logger')(_0x42cc('0x7'));var config=require(_0x42cc('0x8'));var jayson=require(_0x42cc('0x9'));var client=jayson[_0x42cc('0xa')][_0x42cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fc8d2,_0x31df59,_0xd28d27){return new BPromise(function(_0x1342f8,_0x272915){return client[_0x42cc('0xc')](_0x4fc8d2,_0xd28d27)[_0x42cc('0xd')](function(_0x4717b7){logger[_0x42cc('0xe')](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));logger[_0x42cc('0x11')](_0x42cc('0x12'),_0x31df59,'request\x20sent',JSON['stringify'](_0x4717b7));if(_0x4717b7['error']){if(_0x4717b7['error'][_0x42cc('0x13')]===0x1f4){logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')]['message']);return _0x272915(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);return _0x1342f8(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}else{logger['info'](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));_0x1342f8(_0x4717b7[_0x42cc('0x16')][_0x42cc('0x15')]);}})[_0x42cc('0x17')](function(_0x5ad460){logger[_0x42cc('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x31df59,_0x5ad460);_0x272915(_0x5ad460);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c94eccd..4d5ead8 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3bd03c,_0x46b7c7){var _0x527037=function(_0x5e1bc5){while(--_0x5e1bc5){_0x3bd03c['push'](_0x3bd03c['shift']());}};_0x527037(++_0x46b7c7);}(_0xedd9,0xfc));var _0x9edd=function(_0x49ab20,_0x204482){_0x49ab20=_0x49ab20-0x0;var _0x3c10b4=_0xedd9[_0x49ab20];return _0x3c10b4;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x39d9d7,_0xb6691){var _0x3b1c1d=function(_0x12cfa6){while(--_0x12cfa6){_0x39d9d7['push'](_0x39d9d7['shift']());}};_0x3b1c1d(++_0xb6691);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 10ddba9..9fa2384 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 _0x15f8=['INTEGER','sequelize'];(function(_0x1915eb,_0x5c976d){var _0x48f67d=function(_0x2e7afa){while(--_0x2e7afa){_0x1915eb['push'](_0x1915eb['shift']());}};_0x48f67d(++_0x5c976d);}(_0x15f8,0x149));var _0x815f=function(_0x385f83,_0x570bc7){_0x385f83=_0x385f83-0x0;var _0x55e5cf=_0x15f8[_0x385f83];return _0x55e5cf;};'use strict';var Sequelize=require(_0x815f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x815f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x705a=['exports','sequelize'];(function(_0x1b29b2,_0x3b6b11){var _0x560b68=function(_0x50a4ea){while(--_0x50a4ea){_0x1b29b2['push'](_0x1b29b2['shift']());}};_0x560b68(++_0x3b6b11);}(_0x705a,0x7d));var _0xa705=function(_0x581462,_0x29734f){_0x581462=_0x581462-0x0;var _0x235ddc=_0x705a[_0x581462];return _0x235ddc;};'use strict';var Sequelize=require(_0xa705('0x0'));module[_0xa705('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 561ec82..b718a2e 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 _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x52b24,_0x4d4184){var _0xea5a5b=function(_0x54e0fe){while(--_0x54e0fe){_0x52b24['push'](_0x52b24['shift']());}};_0xea5a5b(++_0x4d4184);}(_0x9536,0x179));var _0x6953=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x9536[_0x4b6778];return _0x22dbb9;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf970=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xad4d86,_0x318c41){var _0x3b6918=function(_0x1a1342){while(--_0x1a1342){_0xad4d86['push'](_0xad4d86['shift']());}};_0x3b6918(++_0x318c41);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var logger=require(_0x0f97('0x1'))(_0x0f97('0x2'));var moment=require(_0x0f97('0x3'));var BPromise=require(_0x0f97('0x4'));var rp=require(_0x0f97('0x5'));var fs=require('fs');var path=require(_0x0f97('0x6'));var rimraf=require(_0x0f97('0x7'));var config=require('../../config/environment');var attributes=require(_0x0f97('0x8'));module[_0x0f97('0x9')]=function(_0x290200,_0xac501){return _0x290200[_0x0f97('0xa')](_0x0f97('0xb'),attributes,{'tableName':_0x0f97('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 e4efce8..50ee9b9 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 _0x5ea9=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x5ea9,0x146));var _0x95ea=function(_0x31a8af,_0x5ed655){_0x31a8af=_0x31a8af-0x0;var _0x4295e4=_0x5ea9[_0x31a8af];return _0x4295e4;};'use strict';var _=require(_0x95ea('0x0'));var util=require(_0x95ea('0x1'));var moment=require(_0x95ea('0x2'));var BPromise=require(_0x95ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ea('0x5'))(_0x95ea('0x6'));var config=require('../../config/environment');var jayson=require(_0x95ea('0x7'));var client=jayson[_0x95ea('0x8')][_0x95ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18df48,_0x327a86,_0x2c9546){return new BPromise(function(_0x2e6c5e,_0x4f4776){return client[_0x95ea('0xa')](_0x18df48,_0x2c9546)[_0x95ea('0xb')](function(_0x4749a5){logger[_0x95ea('0xc')](_0x95ea('0xd'),_0x327a86,_0x95ea('0xe'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x327a86,_0x95ea('0xe'),JSON[_0x95ea('0xf')](_0x4749a5));if(_0x4749a5['error']){if(_0x4749a5[_0x95ea('0x10')]['code']===0x1f4){logger['error'](_0x95ea('0xd'),_0x327a86,_0x4749a5[_0x95ea('0x10')][_0x95ea('0x11')]);return _0x4f4776(_0x4749a5[_0x95ea('0x10')]['message']);}logger[_0x95ea('0x10')](_0x95ea('0xd'),_0x327a86,_0x4749a5[_0x95ea('0x10')][_0x95ea('0x11')]);return _0x2e6c5e(_0x4749a5[_0x95ea('0x10')][_0x95ea('0x11')]);}else{logger[_0x95ea('0xc')](_0x95ea('0xd'),_0x327a86,'request\x20sent');_0x2e6c5e(_0x4749a5[_0x95ea('0x12')][_0x95ea('0x11')]);}})[_0x95ea('0x13')](function(_0x2f119a){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x327a86,_0x2f119a);_0x4f4776(_0x2f119a);});});} \ No newline at end of file +var _0x9e5e=['info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e5e,0xee));var _0xe9e5=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9e5e[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var moment=require(_0xe9e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e5('0x3'));var fs=require('fs');var Redis=require(_0xe9e5('0x4'));var db=require(_0xe9e5('0x5'))['db'];var utils=require(_0xe9e5('0x6'));var logger=require(_0xe9e5('0x7'))(_0xe9e5('0x8'));var config=require(_0xe9e5('0x9'));var jayson=require(_0xe9e5('0xa'));var client=jayson[_0xe9e5('0xb')][_0xe9e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17b35a,_0x32f683,_0x4dce35){return new BPromise(function(_0x2ae71c,_0x29baa4){return client[_0xe9e5('0xd')](_0x17b35a,_0x4dce35)[_0xe9e5('0xe')](function(_0x450491){logger[_0xe9e5('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x32f683,_0xe9e5('0x10'));logger[_0xe9e5('0x11')](_0xe9e5('0x12'),_0x32f683,_0xe9e5('0x10'),JSON[_0xe9e5('0x13')](_0x450491));if(_0x450491[_0xe9e5('0x14')]){if(_0x450491[_0xe9e5('0x14')]['code']===0x1f4){logger[_0xe9e5('0x14')](_0xe9e5('0x15'),_0x32f683,_0x450491[_0xe9e5('0x14')]['message']);return _0x29baa4(_0x450491[_0xe9e5('0x14')][_0xe9e5('0x16')]);}logger[_0xe9e5('0x14')](_0xe9e5('0x15'),_0x32f683,_0x450491['error'][_0xe9e5('0x16')]);return _0x2ae71c(_0x450491[_0xe9e5('0x14')][_0xe9e5('0x16')]);}else{logger[_0xe9e5('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x32f683,_0xe9e5('0x10'));_0x2ae71c(_0x450491['result'][_0xe9e5('0x16')]);}})['catch'](function(_0x376198){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x32f683,_0x376198);_0x29baa4(_0x376198);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 8bf9f38..d30a2d0 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 _0xa604=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa604,0x184));var _0x4a60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa604[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4a60('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x4a60('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4a60('0x1')]}}; \ No newline at end of file +var _0x6411=['INTEGER','sequelize'];(function(_0x50b050,_0x5ded51){var _0x150e0d=function(_0x296188){while(--_0x296188){_0x50b050['push'](_0x50b050['shift']());}};_0x150e0d(++_0x5ded51);}(_0x6411,0x147));var _0x1641=function(_0x2aa14,_0x55b670){_0x2aa14=_0x2aa14-0x0;var _0x5c9ee1=_0x6411[_0x2aa14];return _0x5c9ee1;};'use strict';var Sequelize=require(_0x1641('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x1641('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x1641('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ae5b72f..7772c99 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(_0x5d7c59,_0x5d15d3){var _0x25115e=function(_0x9838e1){while(--_0x9838e1){_0x5d7c59['push'](_0x5d7c59['shift']());}};_0x25115e(++_0x5d15d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x510d38,_0x353d5b){var _0x1dd1a6=function(_0x19cf80){while(--_0x19cf80){_0x510d38['push'](_0x510d38['shift']());}};_0x1dd1a6(++_0x353d5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 bca3b0a..a8a64a0 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3f4363,_0x113f04){var _0xdef79d=function(_0x5b93d9){while(--_0x5b93d9){_0x3f4363['push'](_0x3f4363['shift']());}};_0xdef79d(++_0x113f04);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x506102,_0x2fda32){var _0x47adbe=function(_0x2e10f7){while(--_0x2e10f7){_0x506102['push'](_0x506102['shift']());}};_0x47adbe(++_0x2fda32);}(_0x70e0,0x17b));var _0x070e=function(_0x567b47,_0x467cb9){_0x567b47=_0x567b47-0x0;var _0x146190=_0x70e0[_0x567b47];return _0x146190;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6998d4d..9280d89 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 _0x46aa=['exports'];(function(_0x230bc4,_0x280f45){var _0x1049c5=function(_0x1f1fcb){while(--_0x1f1fcb){_0x230bc4['push'](_0x230bc4['shift']());}};_0x1049c5(++_0x280f45);}(_0x46aa,0xcb));var _0xa46a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46aa[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0xa46a('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b74=['exports','sequelize'];(function(_0x1d01bb,_0xbed6e2){var _0x2c5a0f=function(_0x5571c5){while(--_0x5571c5){_0x1d01bb['push'](_0x1d01bb['shift']());}};_0x2c5a0f(++_0xbed6e2);}(_0x4b74,0x10f));var _0x44b7=function(_0x8f7a5c,_0x4638f2){_0x8f7a5c=_0x8f7a5c-0x0;var _0x24d7b4=_0x4b74[_0x8f7a5c];return _0x24d7b4;};'use strict';var Sequelize=require(_0x44b7('0x0'));module[_0x44b7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e0041c3..2452ca2 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 _0xf2c8=['exports','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes'];(function(_0x27dce9,_0x10d2f8){var _0x1fec31=function(_0x6e3a9a){while(--_0x6e3a9a){_0x27dce9['push'](_0x27dce9['shift']());}};_0x1fec31(++_0x10d2f8);}(_0xf2c8,0x199));var _0x8f2c=function(_0x2c723c,_0x4219c0){_0x2c723c=_0x2c723c-0x0;var _0x46f408=_0xf2c8[_0x2c723c];return _0x46f408;};'use strict';var _=require(_0x8f2c('0x0'));var util=require(_0x8f2c('0x1'));var logger=require(_0x8f2c('0x2'))(_0x8f2c('0x3'));var moment=require(_0x8f2c('0x4'));var BPromise=require(_0x8f2c('0x5'));var rp=require(_0x8f2c('0x6'));var fs=require('fs');var path=require(_0x8f2c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f2c('0x8'));module[_0x8f2c('0x9')]=function(_0xa10d36,_0x656b09){return _0xa10d36['define'](_0x8f2c('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12d5=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xed62cc,_0x112282){var _0x45f280=function(_0x4a86da){while(--_0x4a86da){_0xed62cc['push'](_0xed62cc['shift']());}};_0x45f280(++_0x112282);}(_0x12d5,0x1d9));var _0x512d=function(_0x3b8e48,_0x5b0519){_0x3b8e48=_0x3b8e48-0x0;var _0x16d541=_0x12d5[_0x3b8e48];return _0x16d541;};'use strict';var _=require('lodash');var util=require(_0x512d('0x0'));var logger=require(_0x512d('0x1'))(_0x512d('0x2'));var moment=require(_0x512d('0x3'));var BPromise=require('bluebird');var rp=require(_0x512d('0x4'));var fs=require('fs');var path=require(_0x512d('0x5'));var rimraf=require(_0x512d('0x6'));var config=require(_0x512d('0x7'));var attributes=require(_0x512d('0x8'));module[_0x512d('0x9')]=function(_0x1e9644,_0x57f7fa){return _0x1e9644[_0x512d('0xa')](_0x512d('0xb'),attributes,{'tableName':_0x512d('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 04cad9b..c04cbde 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 _0x493c=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x486ac9,_0x124c10){var _0x404d97=function(_0x1fe2f9){while(--_0x1fe2f9){_0x486ac9['push'](_0x486ac9['shift']());}};_0x404d97(++_0x124c10);}(_0x493c,0x88));var _0xc493=function(_0x278dd9,_0x2e825c){_0x278dd9=_0x278dd9-0x0;var _0x238e52=_0x493c[_0x278dd9];return _0x238e52;};'use strict';var _=require(_0xc493('0x0'));var util=require(_0xc493('0x1'));var moment=require('moment');var BPromise=require(_0xc493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc493('0x3'));var db=require(_0xc493('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc493('0x5'))(_0xc493('0x6'));var config=require(_0xc493('0x7'));var jayson=require(_0xc493('0x8'));var client=jayson[_0xc493('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0008,_0x5cc5da,_0x2dc55a){return new BPromise(function(_0x330574,_0x1f74b2){return client[_0xc493('0xa')](_0x1c0008,_0x2dc55a)['then'](function(_0xb285c1){logger[_0xc493('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5da,_0xc493('0xc'));logger['debug'](_0xc493('0xd'),_0x5cc5da,'request\x20sent',JSON['stringify'](_0xb285c1));if(_0xb285c1[_0xc493('0xe')]){if(_0xb285c1[_0xc493('0xe')]['code']===0x1f4){logger[_0xc493('0xe')](_0xc493('0xf'),_0x5cc5da,_0xb285c1[_0xc493('0xe')][_0xc493('0x10')]);return _0x1f74b2(_0xb285c1[_0xc493('0xe')]['message']);}logger[_0xc493('0xe')](_0xc493('0xf'),_0x5cc5da,_0xb285c1[_0xc493('0xe')][_0xc493('0x10')]);return _0x330574(_0xb285c1['error'][_0xc493('0x10')]);}else{logger[_0xc493('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5cc5da,_0xc493('0xc'));_0x330574(_0xb285c1[_0xc493('0x11')]['message']);}})[_0xc493('0x12')](function(_0x3d647e){logger['error'](_0xc493('0xf'),_0x5cc5da,_0x3d647e);_0x1f74b2(_0x3d647e);});});} \ No newline at end of file +var _0xb9fc=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info'];(function(_0xbd65ad,_0x13272c){var _0x2d6957=function(_0x2604f8){while(--_0x2604f8){_0xbd65ad['push'](_0xbd65ad['shift']());}};_0x2d6957(++_0x13272c);}(_0xb9fc,0x178));var _0xcb9f=function(_0x457300,_0x27e123){_0x457300=_0x457300-0x0;var _0x372f28=_0xb9fc[_0x457300];return _0x372f28;};'use strict';var _=require('lodash');var util=require(_0xcb9f('0x0'));var moment=require(_0xcb9f('0x1'));var BPromise=require(_0xcb9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb9f('0x3'));var db=require(_0xcb9f('0x4'))['db'];var utils=require(_0xcb9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcb9f('0x6'));var client=jayson[_0xcb9f('0x7')][_0xcb9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d01d4,_0x4446de,_0x58b139){return new BPromise(function(_0x4cc9c2,_0x2b5444){return client[_0xcb9f('0x9')](_0x1d01d4,_0x58b139)[_0xcb9f('0xa')](function(_0x3b6d47){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4446de,'request\x20sent');logger[_0xcb9f('0xb')](_0xcb9f('0xc'),_0x4446de,_0xcb9f('0xd'),JSON[_0xcb9f('0xe')](_0x3b6d47));if(_0x3b6d47[_0xcb9f('0xf')]){if(_0x3b6d47[_0xcb9f('0xf')][_0xcb9f('0x10')]===0x1f4){logger[_0xcb9f('0xf')](_0xcb9f('0x11'),_0x4446de,_0x3b6d47[_0xcb9f('0xf')]['message']);return _0x2b5444(_0x3b6d47[_0xcb9f('0xf')]['message']);}logger[_0xcb9f('0xf')](_0xcb9f('0x11'),_0x4446de,_0x3b6d47[_0xcb9f('0xf')]['message']);return _0x4cc9c2(_0x3b6d47['error'][_0xcb9f('0x12')]);}else{logger[_0xcb9f('0x13')](_0xcb9f('0x11'),_0x4446de,_0xcb9f('0xd'));_0x4cc9c2(_0x3b6d47[_0xcb9f('0x14')][_0xcb9f('0x12')]);}})[_0xcb9f('0x15')](function(_0x59f6ba){logger[_0xcb9f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4446de,_0x59f6ba);_0x2b5444(_0x59f6ba);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 81e7ba6..a5f77bb 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x34e55d,_0x39bd56){var _0x19a3f6=function(_0x3895c9){while(--_0x3895c9){_0x34e55d['push'](_0x34e55d['shift']());}};_0x19a3f6(++_0x39bd56);}(_0xedd9,0xfc));var _0x9edd=function(_0x509dad,_0x459580){_0x509dad=_0x509dad-0x0;var _0x31ae78=_0xedd9[_0x509dad];return _0x31ae78;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3b07ca,_0x56c4bc){var _0x61e09=function(_0x5cd016){while(--_0x5cd016){_0x3b07ca['push'](_0x3b07ca['shift']());}};_0x61e09(++_0x56c4bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5b0994c..2386814 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 _0x102c=['STRING','queue_interface','Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x102c,0xf9));var _0xc102=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x102c[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xc102('0x0'));module[_0xc102('0x1')]={'uniqueid':{'type':Sequelize[_0xc102('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xc102('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc102('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc102('0x4'),'comment':_0xc102('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xc102('0x3')],'allowNull':![],'unique':_0xc102('0x4'),'comment':_0xc102('0x5')},'penalty':{'type':Sequelize[_0xc102('0x2')](0xb),'defaultValue':0x0,'comment':_0xc102('0x5')},'paused':{'type':Sequelize[_0xc102('0x2')](0xb),'defaultValue':0x0,'comment':_0xc102('0x5')}}; \ No newline at end of file +var _0xedb6=['STRING','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xedb6,0x1e9));var _0x6edb=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xedb6[_0xdeefbd];return _0x4ff63f;};'use strict';var Sequelize=require(_0x6edb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6edb('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6edb('0x2')},'membername':{'type':Sequelize[_0x6edb('0x3')],'allowNull':![],'comment':_0x6edb('0x2')},'UserId':{'type':Sequelize[_0x6edb('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6edb('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x6edb('0x2')},'VoiceQueueId':{'type':Sequelize[_0x6edb('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x6edb('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x6edb('0x2')},'penalty':{'type':Sequelize[_0x6edb('0x1')](0xb),'defaultValue':0x0,'comment':_0x6edb('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6edb('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4d476fe..fc6dee5 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 _0x1b13=['save','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1d5e5e,_0x474e2c){var _0x228874=function(_0x1b3826){while(--_0x1b3826){_0x1d5e5e['push'](_0x1d5e5e['shift']());}};_0x228874(++_0x474e2c);}(_0x1b13,0xb0));var _0x31b1=function(_0x24b346,_0x23ae7c){_0x24b346=_0x24b346-0x0;var _0x2e480f=_0x1b13[_0x24b346];return _0x2e480f;};'use strict';var EventEmitter=require(_0x31b1('0x0'));var UserVoiceQueueRt=require(_0x31b1('0x1'))['db'][_0x31b1('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x31b1('0x3')](0x0);var events={'afterCreate':_0x31b1('0x4'),'afterUpdate':'update','afterDestroy':_0x31b1('0x5')};function emitEvent(_0x5a5523){return function(_0x13d797,_0x434e6a,_0x375e2a){UserVoiceQueueRtEvents[_0x31b1('0x6')](_0x5a5523+':'+_0x13d797['id'],_0x13d797);UserVoiceQueueRtEvents['emit'](_0x5a5523,_0x13d797);_0x375e2a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x31b1('0x7')](e,emitEvent(event));}}module[_0x31b1('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc11b=['save','update','remove','emit','hasOwnProperty','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x2c1134,_0x3ab6ab){var _0xeacbb3=function(_0x5e835d){while(--_0x5e835d){_0x2c1134['push'](_0x2c1134['shift']());}};_0xeacbb3(++_0x3ab6ab);}(_0xc11b,0x155));var _0xbc11=function(_0x42f797,_0x7ab4be){_0x42f797=_0x42f797-0x0;var _0x1ee512=_0xc11b[_0x42f797];return _0x1ee512;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xbc11('0x0'))['db'][_0xbc11('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbc11('0x2')](0x0);var events={'afterCreate':_0xbc11('0x3'),'afterUpdate':_0xbc11('0x4'),'afterDestroy':_0xbc11('0x5')};function emitEvent(_0x4ecd0f){return function(_0x1c444c,_0x1dce71,_0x36576b){UserVoiceQueueRtEvents[_0xbc11('0x6')](_0x4ecd0f+':'+_0x1c444c['id'],_0x1c444c);UserVoiceQueueRtEvents[_0xbc11('0x6')](_0x4ecd0f,_0x1c444c);_0x36576b(null);};}for(var e in events){if(events[_0xbc11('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 82f72e7..0569bc4 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 _0xa621=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x46e9b5,_0xe6ebc7){var _0x206f79=function(_0x119506){while(--_0x119506){_0x46e9b5['push'](_0x46e9b5['shift']());}};_0x206f79(++_0xe6ebc7);}(_0xa621,0xb2));var _0x1a62=function(_0x557255,_0x3e546b){_0x557255=_0x557255-0x0;var _0x4550e1=_0xa621[_0x557255];return _0x4550e1;};'use strict';var _=require(_0x1a62('0x0'));var util=require('util');var logger=require(_0x1a62('0x1'))(_0x1a62('0x2'));var moment=require('moment');var BPromise=require(_0x1a62('0x3'));var rp=require(_0x1a62('0x4'));var fs=require('fs');var path=require(_0x1a62('0x5'));var rimraf=require(_0x1a62('0x6'));var config=require(_0x1a62('0x7'));var attributes=require(_0x1a62('0x8'));module['exports']=function(_0x5f33e3,_0x724a71){return _0x5f33e3['define']('UserVoiceQueueRt',attributes,{'tableName':_0x1a62('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41ed=['util','api','moment','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x4c4b26,_0x1f21ca){var _0x19f5e4=function(_0x2ca03a){while(--_0x2ca03a){_0x4c4b26['push'](_0x4c4b26['shift']());}};_0x19f5e4(++_0x1f21ca);}(_0x41ed,0x79));var _0xd41e=function(_0x3734c8,_0x5601a5){_0x3734c8=_0x3734c8-0x0;var _0x344b44=_0x41ed[_0x3734c8];return _0x344b44;};'use strict';var _=require('lodash');var util=require(_0xd41e('0x0'));var logger=require('../../config/logger')(_0xd41e('0x1'));var moment=require(_0xd41e('0x2'));var BPromise=require('bluebird');var rp=require(_0xd41e('0x3'));var fs=require('fs');var path=require(_0xd41e('0x4'));var rimraf=require(_0xd41e('0x5'));var config=require('../../config/environment');var attributes=require(_0xd41e('0x6'));module[_0xd41e('0x7')]=function(_0x36efbb,_0x1ebcf1){return _0x36efbb[_0xd41e('0x8')](_0xd41e('0x9'),attributes,{'tableName':_0xd41e('0xa'),'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 4216744..af59c7a 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 _0x755f=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x755f,0xa5));var _0xf755=function(_0xe2b6d3,_0x3b0d10){_0xe2b6d3=_0xe2b6d3-0x0;var _0x34aa0b=_0x755f[_0xe2b6d3];return _0x34aa0b;};'use strict';var _=require('lodash');var util=require(_0xf755('0x0'));var moment=require(_0xf755('0x1'));var BPromise=require(_0xf755('0x2'));var rs=require(_0xf755('0x3'));var fs=require('fs');var Redis=require(_0xf755('0x4'));var db=require(_0xf755('0x5'))['db'];var utils=require(_0xf755('0x6'));var logger=require('../../config/logger')(_0xf755('0x7'));var config=require(_0xf755('0x8'));var jayson=require(_0xf755('0x9'));var client=jayson[_0xf755('0xa')][_0xf755('0xb')]({'port':0x232a});config[_0xf755('0xc')]=_[_0xf755('0xd')](config[_0xf755('0xc')],{'host':_0xf755('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf755('0xc')]));require(_0xf755('0xf'))[_0xf755('0x10')](socket);function respondWithRpcPromise(_0x9e93b5,_0x2bfbd0,_0x2acabd){return new BPromise(function(_0x363c4c,_0x2553b0){return client['request'](_0x9e93b5,_0x2acabd)[_0xf755('0x11')](function(_0xd75edb){logger[_0xf755('0x12')](_0xf755('0x13'),_0x2bfbd0,_0xf755('0x14'));logger[_0xf755('0x15')](_0xf755('0x16'),_0x2bfbd0,_0xf755('0x14'),JSON[_0xf755('0x17')](_0xd75edb));if(_0xd75edb['error']){if(_0xd75edb['error'][_0xf755('0x18')]===0x1f4){logger[_0xf755('0x19')](_0xf755('0x13'),_0x2bfbd0,_0xd75edb['error']['message']);return _0x2553b0(_0xd75edb[_0xf755('0x19')][_0xf755('0x1a')]);}logger[_0xf755('0x19')](_0xf755('0x13'),_0x2bfbd0,_0xd75edb[_0xf755('0x19')]['message']);return _0x363c4c(_0xd75edb[_0xf755('0x19')][_0xf755('0x1a')]);}else{logger['info'](_0xf755('0x13'),_0x2bfbd0,_0xf755('0x14'));_0x363c4c(_0xd75edb['result']['message']);}})[_0xf755('0x1b')](function(_0x5170ac){logger[_0xf755('0x19')](_0xf755('0x13'),_0x2bfbd0,_0x5170ac);_0x2553b0(_0x5170ac);});});}exports[_0xf755('0x1c')]=function(_0x8be68c){var _0x152136=this;return new Promise(function(_0x2f9d51,_0x259f9d){return db[_0xf755('0x1d')][_0xf755('0x1e')]({'raw':_0x8be68c[_0xf755('0x1f')]?_0x8be68c[_0xf755('0x1f')][_0xf755('0x20')]===undefined?!![]:![]:!![],'where':_0x8be68c['options']?_0x8be68c[_0xf755('0x1f')]['where']||null:null,'attributes':[[db[_0xf755('0x21')]['fn'](_0xf755('0x22'),db['sequelize']['fn']('IF',db[_0xf755('0x21')]['literal'](_0xf755('0x23')))),_0xf755('0x24')]]})['then'](function(_0x3a1b39){logger[_0xf755('0x12')](_0xf755('0x1c'),_0x8be68c);logger[_0xf755('0x15')](_0xf755('0x1c'),_0x8be68c,JSON[_0xf755('0x17')](_0x3a1b39));_0x2f9d51(_0x3a1b39);})['catch'](function(_0x54f7ce){logger[_0xf755('0x19')](_0xf755('0x1c'),_0x54f7ce[_0xf755('0x1a')],_0x8be68c);_0x259f9d(_0x152136[_0xf755('0x19')](0x1f4,_0x54f7ce['message']));});});}; \ No newline at end of file +var _0x3d20=['`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize'];(function(_0x28fcc1,_0x13406b){var _0x501208=function(_0x1201a4){while(--_0x1201a4){_0x28fcc1['push'](_0x28fcc1['shift']());}};_0x501208(++_0x13406b);}(_0x3d20,0xc2));var _0x03d2=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x3d20[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x03d2('0x0'));var BPromise=require(_0x03d2('0x1'));var rs=require(_0x03d2('0x2'));var fs=require('fs');var Redis=require(_0x03d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x03d2('0x4'));var logger=require(_0x03d2('0x5'))(_0x03d2('0x6'));var config=require(_0x03d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x03d2('0x8')]['http']({'port':0x232a});config['redis']=_[_0x03d2('0x9')](config['redis'],{'host':_0x03d2('0xa'),'port':0x18eb});var socket=require(_0x03d2('0xb'))(new Redis(config['redis']));require(_0x03d2('0xc'))['register'](socket);function respondWithRpcPromise(_0x3423d1,_0x549c49,_0x1b3185){return new BPromise(function(_0x5cf79d,_0xf430cf){return client['request'](_0x3423d1,_0x1b3185)[_0x03d2('0xd')](function(_0x3642ad){logger[_0x03d2('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x549c49,_0x03d2('0xf'));logger[_0x03d2('0x10')](_0x03d2('0x11'),_0x549c49,_0x03d2('0xf'),JSON[_0x03d2('0x12')](_0x3642ad));if(_0x3642ad[_0x03d2('0x13')]){if(_0x3642ad[_0x03d2('0x13')][_0x03d2('0x14')]===0x1f4){logger['error'](_0x03d2('0x15'),_0x549c49,_0x3642ad[_0x03d2('0x13')][_0x03d2('0x16')]);return _0xf430cf(_0x3642ad[_0x03d2('0x13')]['message']);}logger[_0x03d2('0x13')](_0x03d2('0x15'),_0x549c49,_0x3642ad['error'][_0x03d2('0x16')]);return _0x5cf79d(_0x3642ad['error']['message']);}else{logger['info'](_0x03d2('0x15'),_0x549c49,_0x03d2('0xf'));_0x5cf79d(_0x3642ad[_0x03d2('0x17')]['message']);}})[_0x03d2('0x18')](function(_0x3de01c){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x549c49,_0x3de01c);_0xf430cf(_0x3de01c);});});}exports[_0x03d2('0x19')]=function(_0xbae3b8){var _0x16610c=this;return new Promise(function(_0x22e82e,_0x1c8e0d){return db[_0x03d2('0x1a')]['findAll']({'raw':_0xbae3b8[_0x03d2('0x1b')]?_0xbae3b8[_0x03d2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xbae3b8[_0x03d2('0x1b')]?_0xbae3b8[_0x03d2('0x1b')][_0x03d2('0x1c')]||null:null,'attributes':[[db[_0x03d2('0x1d')]['fn']('COUNT',db[_0x03d2('0x1d')]['fn']('IF',db[_0x03d2('0x1d')]['literal'](_0x03d2('0x1e')))),_0x03d2('0x1f')]]})[_0x03d2('0xd')](function(_0x4fcc00){logger[_0x03d2('0xe')](_0x03d2('0x19'),_0xbae3b8);logger['debug']('GetVoiceQueueRtPauses',_0xbae3b8,JSON[_0x03d2('0x12')](_0x4fcc00));_0x22e82e(_0x4fcc00);})[_0x03d2('0x18')](function(_0x5e21b3){logger[_0x03d2('0x13')](_0x03d2('0x19'),_0x5e21b3[_0x03d2('0x16')],_0xbae3b8);_0x1c8e0d(_0x16610c[_0x03d2('0x13')](0x1f4,_0x5e21b3['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f8cb656..27e510a 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 _0x8375=['userVoiceQueueRt:','save','remove','update','register'];(function(_0x7f7744,_0x34fe91){var _0x17a0c9=function(_0x53e459){while(--_0x53e459){_0x7f7744['push'](_0x7f7744['shift']());}};_0x17a0c9(++_0x34fe91);}(_0x8375,0x132));var _0x5837=function(_0x22fe70,_0x5943bc){_0x22fe70=_0x22fe70-0x0;var _0x1d04dd=_0x8375[_0x22fe70];return _0x1d04dd;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5837('0x0'),_0x5837('0x1'),_0x5837('0x2')];function createListener(_0x1fb900,_0x3bd795){return function(_0x144751){_0x3bd795['emit'](_0x1fb900,_0x144751);};}function removeListener(_0x2ddfc1,_0x110a7d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2ddfc1,_0x110a7d);};}exports[_0x5837('0x3')]=function(_0x438491){for(var _0x21c9bd=0x0,_0x1e0d00=events['length'];_0x21c9bd<_0x1e0d00;_0x21c9bd++){var _0x23454c=events[_0x21c9bd];var _0x1f4f78=createListener(_0x5837('0x4')+_0x23454c,_0x438491);UserVoiceQueueRtEvents['on'](_0x23454c,_0x1f4f78);}}; \ No newline at end of file +var _0x0c42=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x221eda,_0xcf03bf){var _0x132929=function(_0x18b5d4){while(--_0x18b5d4){_0x221eda['push'](_0x221eda['shift']());}};_0x132929(++_0xcf03bf);}(_0x0c42,0x191));var _0x20c4=function(_0x56d6bd,_0x3590cf){_0x56d6bd=_0x56d6bd-0x0;var _0x420f4b=_0x0c42[_0x56d6bd];return _0x420f4b;};'use strict';var UserVoiceQueueRtEvents=require(_0x20c4('0x0'));var events=[_0x20c4('0x1'),_0x20c4('0x2'),_0x20c4('0x3')];function createListener(_0xe6959,_0x5810aa){return function(_0x5d686d){_0x5810aa[_0x20c4('0x4')](_0xe6959,_0x5d686d);};}function removeListener(_0x1296a8,_0x24bfc1){return function(){UserVoiceQueueRtEvents[_0x20c4('0x5')](_0x1296a8,_0x24bfc1);};}exports[_0x20c4('0x6')]=function(_0x58e1ed){for(var _0x339b15=0x0,_0x4c4f94=events[_0x20c4('0x7')];_0x339b15<_0x4c4f94;_0x339b15++){var _0x5d2014=events[_0x339b15];var _0xc29a61=createListener(_0x20c4('0x8')+_0x5d2014,_0x58e1ed);UserVoiceQueueRtEvents['on'](_0x5d2014,_0xc29a61);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4392f24..7de87bd 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2eca00,_0x2cc89b){var _0x1a1702=function(_0x2c46a1){while(--_0x2c46a1){_0x2eca00['push'](_0x2eca00['shift']());}};_0x1a1702(++_0x2cc89b);}(_0x70e0,0x17b));var _0x070e=function(_0x21523e,_0x4d55b9){_0x21523e=_0x21523e-0x0;var _0x3825f0=_0x70e0[_0x21523e];return _0x3825f0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2e774c,_0x3b70a9){var _0x23d71a=function(_0x3e4ffc){while(--_0x3e4ffc){_0x2e774c['push'](_0x2e774c['shift']());}};_0x23d71a(++_0x3b70a9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xcb91[_0x54edc9];return _0x2ae7a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b894ddf..3770b22 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 _0xfc91=['sequelize','exports'];(function(_0x31d2db,_0x5bf339){var _0x220db2=function(_0x163391){while(--_0x163391){_0x31d2db['push'](_0x31d2db['shift']());}};_0x220db2(++_0x5bf339);}(_0xfc91,0x72));var _0x1fc9=function(_0xeee7b7,_0x5085b1){_0xeee7b7=_0xeee7b7-0x0;var _0x31c9a0=_0xfc91[_0xeee7b7];return _0x31c9a0;};'use strict';var Sequelize=require(_0x1fc9('0x0'));module[_0x1fc9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb63c=['INTEGER','exports'];(function(_0x5918e5,_0x46f037){var _0x56bb6e=function(_0xdd6865){while(--_0xdd6865){_0x5918e5['push'](_0x5918e5['shift']());}};_0x56bb6e(++_0x46f037);}(_0xb63c,0x99));var _0xcb63=function(_0xe88531,_0x54325a){_0xe88531=_0xe88531-0x0;var _0x1cb615=_0xb63c[_0xe88531];return _0x1cb615;};'use strict';var Sequelize=require('sequelize');module[_0xcb63('0x0')]={'penalty':{'type':Sequelize[_0xcb63('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9c4e030..141994f 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 _0xffe4=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','moment','bluebird'];(function(_0x5154bd,_0x234023){var _0x423086=function(_0x3b50ac){while(--_0x3b50ac){_0x5154bd['push'](_0x5154bd['shift']());}};_0x423086(++_0x234023);}(_0xffe4,0x110));var _0x4ffe=function(_0x5b0b5f,_0x470bff){_0x5b0b5f=_0x5b0b5f-0x0;var _0x585d80=_0xffe4[_0x5b0b5f];return _0x585d80;};'use strict';var _=require(_0x4ffe('0x0'));var util=require(_0x4ffe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ffe('0x2'));var BPromise=require(_0x4ffe('0x3'));var rp=require(_0x4ffe('0x4'));var fs=require('fs');var path=require(_0x4ffe('0x5'));var rimraf=require(_0x4ffe('0x6'));var config=require(_0x4ffe('0x7'));var attributes=require(_0x4ffe('0x8'));module[_0x4ffe('0x9')]=function(_0x530722,_0xf890f2){return _0x530722['define'](_0x4ffe('0xa'),attributes,{'tableName':_0x4ffe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51f=['bluebird','rimraf','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x38b1fe,_0x53aedb){var _0x1b3f86=function(_0x2d4112){while(--_0x2d4112){_0x38b1fe['push'](_0x38b1fe['shift']());}};_0x1b3f86(++_0x53aedb);}(_0xe51f,0xba));var _0xfe51=function(_0x451046,_0xb02a2d){_0x451046=_0x451046-0x0;var _0x49cf94=_0xe51f[_0x451046];return _0x49cf94;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var logger=require(_0xfe51('0x2'))(_0xfe51('0x3'));var moment=require('moment');var BPromise=require(_0xfe51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe51('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe51('0x6'));module['exports']=function(_0x5d120d,_0x125fbc){return _0x5d120d[_0xfe51('0x7')](_0xfe51('0x8'),attributes,{'tableName':_0xfe51('0x9'),'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 a9b0014..188d6af 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 _0xfd38=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x366fa4,_0x30e2c2){var _0x413050=function(_0x280aef){while(--_0x280aef){_0x366fa4['push'](_0x366fa4['shift']());}};_0x413050(++_0x30e2c2);}(_0xfd38,0x15d));var _0x8fd3=function(_0x3aad0d,_0x433c70){_0x3aad0d=_0x3aad0d-0x0;var _0x468b91=_0xfd38[_0x3aad0d];return _0x468b91;};'use strict';var _=require(_0x8fd3('0x0'));var util=require(_0x8fd3('0x1'));var moment=require(_0x8fd3('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fd3('0x3'));var fs=require('fs');var Redis=require(_0x8fd3('0x4'));var db=require(_0x8fd3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fd3('0x6'))(_0x8fd3('0x7'));var config=require(_0x8fd3('0x8'));var jayson=require(_0x8fd3('0x9'));var client=jayson[_0x8fd3('0xa')][_0x8fd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49214f,_0x1559fb,_0x429a6c){return new BPromise(function(_0x314f1e,_0x5166ab){return client[_0x8fd3('0xc')](_0x49214f,_0x429a6c)[_0x8fd3('0xd')](function(_0x10ce69){logger[_0x8fd3('0xe')](_0x8fd3('0xf'),_0x1559fb,_0x8fd3('0x10'));logger[_0x8fd3('0x11')](_0x8fd3('0x12'),_0x1559fb,'request\x20sent',JSON['stringify'](_0x10ce69));if(_0x10ce69[_0x8fd3('0x13')]){if(_0x10ce69[_0x8fd3('0x13')][_0x8fd3('0x14')]===0x1f4){logger[_0x8fd3('0x13')](_0x8fd3('0xf'),_0x1559fb,_0x10ce69['error'][_0x8fd3('0x15')]);return _0x5166ab(_0x10ce69[_0x8fd3('0x13')][_0x8fd3('0x15')]);}logger[_0x8fd3('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1559fb,_0x10ce69['error'][_0x8fd3('0x15')]);return _0x314f1e(_0x10ce69[_0x8fd3('0x13')][_0x8fd3('0x15')]);}else{logger[_0x8fd3('0xe')](_0x8fd3('0xf'),_0x1559fb,_0x8fd3('0x10'));_0x314f1e(_0x10ce69[_0x8fd3('0x16')][_0x8fd3('0x15')]);}})['catch'](function(_0x33b073){logger[_0x8fd3('0x13')](_0x8fd3('0xf'),_0x1559fb,_0x33b073);_0x5166ab(_0x33b073);});});} \ No newline at end of file +var _0x77a5=['catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x77a5,0xa9));var _0x577a=function(_0x172fca,_0x3f0686){_0x172fca=_0x172fca-0x0;var _0x45c2ca=_0x77a5[_0x172fca];return _0x45c2ca;};'use strict';var _=require(_0x577a('0x0'));var util=require(_0x577a('0x1'));var moment=require(_0x577a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x577a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x577a('0x4'));var logger=require('../../config/logger')(_0x577a('0x5'));var config=require(_0x577a('0x6'));var jayson=require(_0x577a('0x7'));var client=jayson[_0x577a('0x8')][_0x577a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a4cae,_0x3d9ae7,_0x526e73){return new BPromise(function(_0x4ffbb0,_0x2f7b32){return client['request'](_0x1a4cae,_0x526e73)[_0x577a('0xa')](function(_0x3bb675){logger['info'](_0x577a('0xb'),_0x3d9ae7,'request\x20sent');logger[_0x577a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d9ae7,_0x577a('0xd'),JSON[_0x577a('0xe')](_0x3bb675));if(_0x3bb675[_0x577a('0xf')]){if(_0x3bb675[_0x577a('0xf')][_0x577a('0x10')]===0x1f4){logger[_0x577a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d9ae7,_0x3bb675[_0x577a('0xf')][_0x577a('0x11')]);return _0x2f7b32(_0x3bb675[_0x577a('0xf')]['message']);}logger[_0x577a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d9ae7,_0x3bb675[_0x577a('0xf')][_0x577a('0x11')]);return _0x4ffbb0(_0x3bb675[_0x577a('0xf')][_0x577a('0x11')]);}else{logger[_0x577a('0x12')](_0x577a('0xb'),_0x3d9ae7,'request\x20sent');_0x4ffbb0(_0x3bb675[_0x577a('0x13')]['message']);}})[_0x577a('0x14')](function(_0x459854){logger[_0x577a('0xf')](_0x577a('0xb'),_0x3d9ae7,_0x459854);_0x2f7b32(_0x459854);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e189352..9330057 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 _0xc3fe=['fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','index','get','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0xede1ac,_0x6899ad){var _0x27c24c=function(_0x113b77){while(--_0x113b77){_0xede1ac['push'](_0xede1ac['shift']());}};_0x27c24c(++_0x6899ad);}(_0xc3fe,0xff));var _0xec3f=function(_0x4adf26,_0x20933c){_0x4adf26=_0x4adf26-0x0;var _0x50046a=_0xc3fe[_0x4adf26];return _0x50046a;};'use strict';var multer=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var path=require(_0xec3f('0x2'));var timeout=require('connect-timeout');var express=require(_0xec3f('0x3'));var router=express[_0xec3f('0x4')]();var fs_extra=require(_0xec3f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xec3f('0x6'));var config=require(_0xec3f('0x7'));var controller=require(_0xec3f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xec3f('0x9')]);router[_0xec3f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xec3f('0xb')]);router['post']('/',auth[_0xec3f('0xc')](),controller[_0xec3f('0xd')]);router[_0xec3f('0xe')](_0xec3f('0xf'),auth['isAuthenticated'](),controller[_0xec3f('0x10')]);router[_0xec3f('0x11')](_0xec3f('0xf'),auth[_0xec3f('0xc')](),controller[_0xec3f('0x12')]);module[_0xec3f('0x13')]=router; \ No newline at end of file +var _0x028d=['/:id','show','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1e03ec,_0x14ec17){var _0xdbc63=function(_0x542b7a){while(--_0x542b7a){_0x1e03ec['push'](_0x1e03ec['shift']());}};_0xdbc63(++_0x14ec17);}(_0x028d,0xff));var _0xd028=function(_0x59b3ac,_0x19471a){_0x59b3ac=_0x59b3ac-0x0;var _0x16a9e4=_0x028d[_0x59b3ac];return _0x16a9e4;};'use strict';var multer=require('multer');var util=require(_0xd028('0x0'));var path=require(_0xd028('0x1'));var timeout=require('connect-timeout');var express=require(_0xd028('0x2'));var router=express[_0xd028('0x3')]();var fs_extra=require(_0xd028('0x4'));var auth=require(_0xd028('0x5'));var interaction=require(_0xd028('0x6'));var config=require(_0xd028('0x7'));var controller=require('./variable.controller');router[_0xd028('0x8')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0xa')]);router[_0xd028('0x8')](_0xd028('0xb'),auth[_0xd028('0x9')](),controller[_0xd028('0xc')]);router[_0xd028('0xd')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0xe')]);router[_0xd028('0xf')](_0xd028('0xb'),auth[_0xd028('0x9')](),controller[_0xd028('0x10')]);router['delete'](_0xd028('0xb'),auth[_0xd028('0x9')](),controller[_0xd028('0x11')]);module[_0xd028('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 72da9b1..319ad45 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 _0x5f44=['sequelize','exports','name','STRING'];(function(_0x2645c2,_0x2cc1fe){var _0x590c1b=function(_0x1157aa){while(--_0x1157aa){_0x2645c2['push'](_0x2645c2['shift']());}};_0x590c1b(++_0x2cc1fe);}(_0x5f44,0x1c4));var _0x45f4=function(_0x3d01bf,_0x2129df){_0x3d01bf=_0x3d01bf-0x0;var _0x10becb=_0x5f44[_0x3d01bf];return _0x10becb;};'use strict';var Sequelize=require(_0x45f4('0x0'));module[_0x45f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x45f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x45f4('0x3')]}}; \ No newline at end of file +var _0x7543=['STRING','name','sequelize'];(function(_0x22830d,_0x442493){var _0x27d7ee=function(_0x150ad5){while(--_0x150ad5){_0x22830d['push'](_0x22830d['shift']());}};_0x27d7ee(++_0x442493);}(_0x7543,0x191));var _0x3754=function(_0x5242b3,_0x362d7c){_0x5242b3=_0x5242b3-0x0;var _0x22a265=_0x7543[_0x5242b3];return _0x22a265;};'use strict';var Sequelize=require(_0x3754('0x0'));module['exports']={'name':{'type':Sequelize[_0x3754('0x1')],'unique':_0x3754('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3754('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 378b981..e3f33e8 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 _0x1672=['find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xa0b574,_0x2f9529){var _0x37a811=function(_0x15abfa){while(--_0x15abfa){_0xa0b574['push'](_0xa0b574['shift']());}};_0x37a811(++_0x2f9529);}(_0x1672,0x111));var _0x2167=function(_0x318c5c,_0x3b173a){_0x318c5c=_0x318c5c-0x0;var _0x51e9ee=_0x1672[_0x318c5c];return _0x51e9ee;};'use strict';var emlformat=require(_0x2167('0x0'));var rimraf=require(_0x2167('0x1'));var zipdir=require(_0x2167('0x2'));var jsonpatch=require(_0x2167('0x3'));var rp=require(_0x2167('0x4'));var moment=require(_0x2167('0x5'));var BPromise=require(_0x2167('0x6'));var Mustache=require(_0x2167('0x7'));var util=require(_0x2167('0x8'));var path=require('path');var sox=require(_0x2167('0x9'));var csv=require(_0x2167('0xa'));var ejs=require(_0x2167('0xb'));var fs=require('fs');var fs_extra=require(_0x2167('0xc'));var _=require(_0x2167('0xd'));var squel=require('squel');var crypto=require(_0x2167('0xe'));var jsforce=require(_0x2167('0xf'));var deskjs=require(_0x2167('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2167('0x11'));var Papa=require(_0x2167('0x12'));var Redis=require(_0x2167('0x13'));var authService=require(_0x2167('0x14'));var qs=require(_0x2167('0x15'));var as=require(_0x2167('0x16'));var hardwareService=require(_0x2167('0x17'));var logger=require(_0x2167('0x18'))(_0x2167('0x19'));var utils=require(_0x2167('0x1a'));var config=require(_0x2167('0x1b'));var licenseUtil=require(_0x2167('0x1c'));var db=require(_0x2167('0x1d'))['db'];function respondWithStatusCode(_0x34f4a6,_0x5e00a4){_0x5e00a4=_0x5e00a4||0xcc;return function(_0x13f24c){if(_0x13f24c){return _0x34f4a6[_0x2167('0x1e')](_0x5e00a4);}return _0x34f4a6[_0x2167('0x1f')](_0x5e00a4)[_0x2167('0x20')]();};}function respondWithResult(_0x59dcf5,_0x39ac0d){_0x39ac0d=_0x39ac0d||0xc8;return function(_0x38337a){if(_0x38337a){return _0x59dcf5[_0x2167('0x1f')](_0x39ac0d)['json'](_0x38337a);}};}function respondWithFilteredResult(_0x344246,_0x317b23){return function(_0x1c38bf){if(_0x1c38bf){var _0x20e7b1=typeof _0x317b23['offset']==='undefined'&&typeof _0x317b23[_0x2167('0x21')]===_0x2167('0x22');var _0x5ab289=_0x1c38bf[_0x2167('0x23')];var _0x42a824=_0x20e7b1?0x0:_0x317b23[_0x2167('0x24')];var _0x569014=_0x20e7b1?_0x1c38bf[_0x2167('0x23')]:_0x317b23[_0x2167('0x24')]+_0x317b23[_0x2167('0x21')];var _0x111839;if(_0x569014>=_0x5ab289){_0x569014=_0x5ab289;_0x111839=0xc8;}else{_0x111839=0xce;}_0x344246[_0x2167('0x1f')](_0x111839);return _0x344246[_0x2167('0x25')]('Content-Range',_0x42a824+'-'+_0x569014+'/'+_0x5ab289)[_0x2167('0x26')](_0x1c38bf);}return null;};}function patchUpdates(_0x2106c2){return function(_0x11629c){try{jsonpatch[_0x2167('0x27')](_0x11629c,_0x2106c2,!![]);}catch(_0x47d9b7){return BPromise[_0x2167('0x28')](_0x47d9b7);}return _0x11629c['save']();};}function saveUpdates(_0xd6709b,_0x3c2aac){return function(_0x2e1d74){if(_0x2e1d74){return _0x2e1d74[_0x2167('0x29')](_0xd6709b)[_0x2167('0x2a')](function(_0x1c30f0){return _0x1c30f0;});}return null;};}function removeEntity(_0x597246,_0x2a04f6){return function(_0x4fd7ca){if(_0x4fd7ca){return _0x4fd7ca[_0x2167('0x2b')]()[_0x2167('0x2a')](function(){var _0x4d6559=_0x4fd7ca[_0x2167('0x2c')]({'plain':!![]});var _0x438eca=_0x2167('0x2d');return db[_0x2167('0x2e')][_0x2167('0x2b')]({'where':{'type':_0x438eca,'resourceId':_0x4d6559['id']}})['then'](function(){return _0x4fd7ca;});})[_0x2167('0x2a')](function(){_0x597246['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d42e3,_0x11de93){return function(_0x2bcabf){if(!_0x2bcabf){_0x3d42e3['sendStatus'](0x194);}return _0x2bcabf;};}function handleError(_0xb2eddc,_0x4bb838){_0x4bb838=_0x4bb838||0x1f4;return function(_0xc64f2b){logger['error'](_0xc64f2b[_0x2167('0x2f')]);if(_0xc64f2b[_0x2167('0x30')]){delete _0xc64f2b['name'];}_0xb2eddc[_0x2167('0x1f')](_0x4bb838)[_0x2167('0x31')](_0xc64f2b);};}exports[_0x2167('0x32')]=function(_0x40847a,_0xba38ed){var _0x1e79ba={},_0x12e534={},_0x40122c={'count':0x0,'rows':[]};var _0x451514=_[_0x2167('0x33')](db[_0x2167('0x34')][_0x2167('0x35')],function(_0x13be4c){return{'name':_0x13be4c[_0x2167('0x36')],'type':_0x13be4c[_0x2167('0x37')][_0x2167('0x38')]};});_0x12e534[_0x2167('0x39')]=_[_0x2167('0x33')](_0x451514,_0x2167('0x30'));_0x12e534[_0x2167('0x3a')]=_['keys'](_0x40847a[_0x2167('0x3a')]);_0x12e534[_0x2167('0x3b')]=_[_0x2167('0x3c')](_0x12e534[_0x2167('0x39')],_0x12e534[_0x2167('0x3a')]);_0x1e79ba['attributes']=_[_0x2167('0x3c')](_0x12e534[_0x2167('0x39')],qs[_0x2167('0x3d')](_0x40847a['query'][_0x2167('0x3d')]));_0x1e79ba['attributes']=_0x1e79ba['attributes']['length']?_0x1e79ba[_0x2167('0x3e')]:_0x12e534[_0x2167('0x39')];if(!_0x40847a[_0x2167('0x3a')]['hasOwnProperty'](_0x2167('0x3f'))){_0x1e79ba[_0x2167('0x21')]=qs[_0x2167('0x21')](_0x40847a[_0x2167('0x3a')][_0x2167('0x21')]);_0x1e79ba[_0x2167('0x24')]=qs[_0x2167('0x24')](_0x40847a['query']['offset']);}_0x1e79ba['order']=qs[_0x2167('0x40')](_0x40847a['query'][_0x2167('0x40')]);_0x1e79ba[_0x2167('0x41')]=qs[_0x2167('0x3b')](_[_0x2167('0x42')](_0x40847a[_0x2167('0x3a')],_0x12e534[_0x2167('0x3b')]),_0x451514);if(_0x40847a[_0x2167('0x3a')]['filter']){_0x1e79ba[_0x2167('0x41')]=_[_0x2167('0x43')](_0x1e79ba[_0x2167('0x41')],{'$or':_[_0x2167('0x33')](_0x451514,function(_0x1957e1){if(_0x1957e1[_0x2167('0x37')]!==_0x2167('0x44')){var _0x260eab={};_0x260eab[_0x1957e1[_0x2167('0x30')]]={'$like':'%'+_0x40847a[_0x2167('0x3a')][_0x2167('0x45')]+'%'};return _0x260eab;}})});}_0x1e79ba=_[_0x2167('0x43')]({},_0x1e79ba,_0x40847a[_0x2167('0x46')]);var _0x3e48a6={'where':_0x1e79ba['where']};return db[_0x2167('0x34')]['count'](_0x3e48a6)[_0x2167('0x2a')](function(_0x511a6e){_0x40122c[_0x2167('0x23')]=_0x511a6e;if(_0x40847a[_0x2167('0x3a')][_0x2167('0x47')]){_0x1e79ba[_0x2167('0x48')]=[{'all':!![]}];}return db['Variable'][_0x2167('0x49')](_0x1e79ba);})[_0x2167('0x2a')](function(_0x3e8348){_0x40122c[_0x2167('0x4a')]=_0x3e8348;return _0x40122c;})['then'](respondWithFilteredResult(_0xba38ed,_0x1e79ba))[_0x2167('0x4b')](handleError(_0xba38ed,null));};exports[_0x2167('0x4c')]=function(_0x55e000,_0x576f92){var _0x2304c4={'raw':!![],'where':{'id':_0x55e000[_0x2167('0x4d')]['id']}},_0x356a77={};_0x356a77['model']=_[_0x2167('0x4e')](db[_0x2167('0x34')][_0x2167('0x35')]);_0x356a77[_0x2167('0x3a')]=_[_0x2167('0x4e')](_0x55e000[_0x2167('0x3a')]);_0x356a77[_0x2167('0x3b')]=_['intersection'](_0x356a77['model'],_0x356a77[_0x2167('0x3a')]);_0x2304c4['attributes']=_['intersection'](_0x356a77[_0x2167('0x39')],qs[_0x2167('0x3d')](_0x55e000[_0x2167('0x3a')][_0x2167('0x3d')]));_0x2304c4['attributes']=_0x2304c4[_0x2167('0x3e')]['length']?_0x2304c4[_0x2167('0x3e')]:_0x356a77['model'];if(_0x55e000['query'][_0x2167('0x47')]){_0x2304c4[_0x2167('0x48')]=[{'all':!![]}];}_0x2304c4=_[_0x2167('0x43')]({},_0x2304c4,_0x55e000['options']);return db[_0x2167('0x34')]['find'](_0x2304c4)[_0x2167('0x2a')](handleEntityNotFound(_0x576f92,null))[_0x2167('0x2a')](respondWithResult(_0x576f92,null))[_0x2167('0x4b')](handleError(_0x576f92,null));};exports[_0x2167('0x4f')]=function(_0x58daf3,_0x803e15){return db['Variable'][_0x2167('0x4f')](_0x58daf3['body'],{})[_0x2167('0x2a')](function(_0x5b996a){var _0x2bf12e=_0x58daf3[_0x2167('0x50')][_0x2167('0x2c')]({'plain':!![]});if(!_0x2bf12e)throw new Error(_0x2167('0x51'));if(_0x2bf12e[_0x2167('0x52')]==='user'){var _0x4a9e80=_0x5b996a[_0x2167('0x2c')]({'plain':!![]});var _0x14e9a9=_0x2167('0x2d');return db['UserProfileSection'][_0x2167('0x53')]({'where':{'name':_0x14e9a9,'userProfileId':_0x2bf12e[_0x2167('0x54')]},'raw':!![]})['then'](function(_0x1a76f5){if(_0x1a76f5&&_0x1a76f5[_0x2167('0x55')]===0x0){return db['UserProfileResource'][_0x2167('0x4f')]({'name':_0x4a9e80[_0x2167('0x30')],'resourceId':_0x4a9e80['id'],'type':_0x1a76f5[_0x2167('0x30')],'sectionId':_0x1a76f5['id']},{})[_0x2167('0x2a')](function(){return _0x5b996a;});}else{return _0x5b996a;}})['catch'](function(_0x2795ff){logger[_0x2167('0x56')](_0x2167('0x57'),_0x2795ff);throw _0x2795ff;});}return _0x5b996a;})['then'](respondWithResult(_0x803e15,0xc9))[_0x2167('0x4b')](handleError(_0x803e15,null));};exports[_0x2167('0x29')]=function(_0x46f559,_0x5331d2){if(_0x46f559[_0x2167('0x58')]['id']){delete _0x46f559[_0x2167('0x58')]['id'];}return db[_0x2167('0x34')][_0x2167('0x53')]({'where':{'id':_0x46f559[_0x2167('0x4d')]['id']}})[_0x2167('0x2a')](handleEntityNotFound(_0x5331d2,null))[_0x2167('0x2a')](saveUpdates(_0x46f559[_0x2167('0x58')],null))[_0x2167('0x2a')](respondWithResult(_0x5331d2,null))['catch'](handleError(_0x5331d2,null));};exports[_0x2167('0x2b')]=function(_0xca1ab,_0x18eb18){return db[_0x2167('0x34')][_0x2167('0x53')]({'where':{'id':_0xca1ab[_0x2167('0x4d')]['id']}})[_0x2167('0x2a')](handleEntityNotFound(_0x18eb18,null))[_0x2167('0x2a')](removeEntity(_0x18eb18,null))['catch'](handleError(_0x18eb18,null));}; \ No newline at end of file +var _0x4c95=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','get','Variables','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','Variable','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x44d4e9,_0x52d710){var _0x4c9bd2=function(_0x40fc44){while(--_0x40fc44){_0x44d4e9['push'](_0x44d4e9['shift']());}};_0x4c9bd2(++_0x52d710);}(_0x4c95,0x180));var _0x54c9=function(_0x35b642,_0x3c36f9){_0x35b642=_0x35b642-0x0;var _0x402486=_0x4c95[_0x35b642];return _0x402486;};'use strict';var emlformat=require(_0x54c9('0x0'));var rimraf=require(_0x54c9('0x1'));var zipdir=require(_0x54c9('0x2'));var jsonpatch=require(_0x54c9('0x3'));var rp=require(_0x54c9('0x4'));var moment=require(_0x54c9('0x5'));var BPromise=require(_0x54c9('0x6'));var Mustache=require(_0x54c9('0x7'));var util=require(_0x54c9('0x8'));var path=require(_0x54c9('0x9'));var sox=require(_0x54c9('0xa'));var csv=require(_0x54c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54c9('0xc'));var _=require('lodash');var squel=require(_0x54c9('0xd'));var crypto=require(_0x54c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x54c9('0xf'));var toCsv=require(_0x54c9('0xb'));var querystring=require(_0x54c9('0x10'));var Papa=require(_0x54c9('0x11'));var Redis=require(_0x54c9('0x12'));var authService=require(_0x54c9('0x13'));var qs=require(_0x54c9('0x14'));var as=require(_0x54c9('0x15'));var hardwareService=require(_0x54c9('0x16'));var logger=require(_0x54c9('0x17'))('api');var utils=require(_0x54c9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x54c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1834f0,_0x109729){_0x109729=_0x109729||0xcc;return function(_0x36afc0){if(_0x36afc0){return _0x1834f0[_0x54c9('0x1a')](_0x109729);}return _0x1834f0[_0x54c9('0x1b')](_0x109729)[_0x54c9('0x1c')]();};}function respondWithResult(_0x4b5ae5,_0x379a8c){_0x379a8c=_0x379a8c||0xc8;return function(_0x16b406){if(_0x16b406){return _0x4b5ae5['status'](_0x379a8c)['json'](_0x16b406);}};}function respondWithFilteredResult(_0xce83d1,_0x5139ea){return function(_0x3ffcc6){if(_0x3ffcc6){var _0x1c8b98=typeof _0x5139ea[_0x54c9('0x1d')]==='undefined'&&typeof _0x5139ea[_0x54c9('0x1e')]===_0x54c9('0x1f');var _0x461b96=_0x3ffcc6[_0x54c9('0x20')];var _0x35402a=_0x1c8b98?0x0:_0x5139ea['offset'];var _0x501060=_0x1c8b98?_0x3ffcc6[_0x54c9('0x20')]:_0x5139ea['offset']+_0x5139ea['limit'];var _0xc31fa;if(_0x501060>=_0x461b96){_0x501060=_0x461b96;_0xc31fa=0xc8;}else{_0xc31fa=0xce;}_0xce83d1[_0x54c9('0x1b')](_0xc31fa);return _0xce83d1[_0x54c9('0x21')](_0x54c9('0x22'),_0x35402a+'-'+_0x501060+'/'+_0x461b96)[_0x54c9('0x23')](_0x3ffcc6);}return null;};}function patchUpdates(_0x1beed4){return function(_0x272c9a){try{jsonpatch[_0x54c9('0x24')](_0x272c9a,_0x1beed4,!![]);}catch(_0x40bad6){return BPromise[_0x54c9('0x25')](_0x40bad6);}return _0x272c9a['save']();};}function saveUpdates(_0x41f555,_0x4d7229){return function(_0x3b1b37){if(_0x3b1b37){return _0x3b1b37[_0x54c9('0x26')](_0x41f555)['then'](function(_0x5891db){return _0x5891db;});}return null;};}function removeEntity(_0x8b7d6a,_0x29f220){return function(_0x1f2c90){if(_0x1f2c90){return _0x1f2c90[_0x54c9('0x27')]()[_0x54c9('0x28')](function(){var _0x5f25c7=_0x1f2c90[_0x54c9('0x29')]({'plain':!![]});var _0x17d9a4=_0x54c9('0x2a');return db['UserProfileResource'][_0x54c9('0x27')]({'where':{'type':_0x17d9a4,'resourceId':_0x5f25c7['id']}})[_0x54c9('0x28')](function(){return _0x1f2c90;});})[_0x54c9('0x28')](function(){_0x8b7d6a[_0x54c9('0x1b')](0xcc)[_0x54c9('0x1c')]();});}};}function handleEntityNotFound(_0x474b81,_0x5d36a9){return function(_0x4d0c32){if(!_0x4d0c32){_0x474b81['sendStatus'](0x194);}return _0x4d0c32;};}function handleError(_0x2c28ca,_0x4cc8f7){_0x4cc8f7=_0x4cc8f7||0x1f4;return function(_0x2bb1ee){logger['error'](_0x2bb1ee[_0x54c9('0x2b')]);if(_0x2bb1ee[_0x54c9('0x2c')]){delete _0x2bb1ee['name'];}_0x2c28ca[_0x54c9('0x1b')](_0x4cc8f7)[_0x54c9('0x2d')](_0x2bb1ee);};}exports['index']=function(_0x3b4955,_0x507978){var _0x116a11={},_0x36871f={},_0x311e32={'count':0x0,'rows':[]};var _0x357ec7=_['map'](db['Variable'][_0x54c9('0x2e')],function(_0x3a48ac){return{'name':_0x3a48ac['fieldName'],'type':_0x3a48ac[_0x54c9('0x2f')]['key']};});_0x36871f[_0x54c9('0x30')]=_[_0x54c9('0x31')](_0x357ec7,_0x54c9('0x2c'));_0x36871f[_0x54c9('0x32')]=_[_0x54c9('0x33')](_0x3b4955['query']);_0x36871f[_0x54c9('0x34')]=_[_0x54c9('0x35')](_0x36871f[_0x54c9('0x30')],_0x36871f['query']);_0x116a11[_0x54c9('0x36')]=_[_0x54c9('0x35')](_0x36871f[_0x54c9('0x30')],qs[_0x54c9('0x37')](_0x3b4955[_0x54c9('0x32')][_0x54c9('0x37')]));_0x116a11[_0x54c9('0x36')]=_0x116a11[_0x54c9('0x36')][_0x54c9('0x38')]?_0x116a11['attributes']:_0x36871f[_0x54c9('0x30')];if(!_0x3b4955[_0x54c9('0x32')]['hasOwnProperty'](_0x54c9('0x39'))){_0x116a11[_0x54c9('0x1e')]=qs[_0x54c9('0x1e')](_0x3b4955[_0x54c9('0x32')][_0x54c9('0x1e')]);_0x116a11[_0x54c9('0x1d')]=qs[_0x54c9('0x1d')](_0x3b4955[_0x54c9('0x32')]['offset']);}_0x116a11[_0x54c9('0x3a')]=qs['sort'](_0x3b4955['query'][_0x54c9('0x3b')]);_0x116a11[_0x54c9('0x3c')]=qs[_0x54c9('0x34')](_[_0x54c9('0x3d')](_0x3b4955['query'],_0x36871f[_0x54c9('0x34')]),_0x357ec7);if(_0x3b4955[_0x54c9('0x32')]['filter']){_0x116a11[_0x54c9('0x3c')]=_[_0x54c9('0x3e')](_0x116a11[_0x54c9('0x3c')],{'$or':_[_0x54c9('0x31')](_0x357ec7,function(_0x34fee5){if(_0x34fee5[_0x54c9('0x2f')]!==_0x54c9('0x3f')){var _0x2c2f96={};_0x2c2f96[_0x34fee5['name']]={'$like':'%'+_0x3b4955[_0x54c9('0x32')][_0x54c9('0x40')]+'%'};return _0x2c2f96;}})});}_0x116a11=_['merge']({},_0x116a11,_0x3b4955[_0x54c9('0x41')]);var _0x59c57c={'where':_0x116a11[_0x54c9('0x3c')]};return db['Variable'][_0x54c9('0x20')](_0x59c57c)['then'](function(_0x544a92){_0x311e32['count']=_0x544a92;if(_0x3b4955[_0x54c9('0x32')][_0x54c9('0x42')]){_0x116a11[_0x54c9('0x43')]=[{'all':!![]}];}return db['Variable'][_0x54c9('0x44')](_0x116a11);})[_0x54c9('0x28')](function(_0x2bc3d3){_0x311e32[_0x54c9('0x45')]=_0x2bc3d3;return _0x311e32;})[_0x54c9('0x28')](respondWithFilteredResult(_0x507978,_0x116a11))['catch'](handleError(_0x507978,null));};exports['show']=function(_0x4e5d21,_0x504c79){var _0x3d901b={'raw':!![],'where':{'id':_0x4e5d21[_0x54c9('0x46')]['id']}},_0x4ff02c={};_0x4ff02c[_0x54c9('0x30')]=_[_0x54c9('0x33')](db['Variable'][_0x54c9('0x2e')]);_0x4ff02c[_0x54c9('0x32')]=_['keys'](_0x4e5d21[_0x54c9('0x32')]);_0x4ff02c[_0x54c9('0x34')]=_['intersection'](_0x4ff02c[_0x54c9('0x30')],_0x4ff02c[_0x54c9('0x32')]);_0x3d901b[_0x54c9('0x36')]=_['intersection'](_0x4ff02c[_0x54c9('0x30')],qs[_0x54c9('0x37')](_0x4e5d21[_0x54c9('0x32')][_0x54c9('0x37')]));_0x3d901b[_0x54c9('0x36')]=_0x3d901b[_0x54c9('0x36')]['length']?_0x3d901b[_0x54c9('0x36')]:_0x4ff02c['model'];if(_0x4e5d21[_0x54c9('0x32')][_0x54c9('0x42')]){_0x3d901b[_0x54c9('0x43')]=[{'all':!![]}];}_0x3d901b=_[_0x54c9('0x3e')]({},_0x3d901b,_0x4e5d21[_0x54c9('0x41')]);return db[_0x54c9('0x47')]['find'](_0x3d901b)[_0x54c9('0x28')](handleEntityNotFound(_0x504c79,null))['then'](respondWithResult(_0x504c79,null))['catch'](handleError(_0x504c79,null));};exports['create']=function(_0x51cc17,_0x347486){return db[_0x54c9('0x47')][_0x54c9('0x48')](_0x51cc17['body'],{})['then'](function(_0x42ba3d){var _0x24ecb6=_0x51cc17[_0x54c9('0x49')]['get']({'plain':!![]});if(!_0x24ecb6)throw new Error(_0x54c9('0x4a'));if(_0x24ecb6[_0x54c9('0x4b')]===_0x54c9('0x49')){var _0x560c2d=_0x42ba3d[_0x54c9('0x29')]({'plain':!![]});var _0x11cd93=_0x54c9('0x2a');return db[_0x54c9('0x4c')][_0x54c9('0x4d')]({'where':{'name':_0x11cd93,'userProfileId':_0x24ecb6['userProfileId']},'raw':!![]})['then'](function(_0xe352b1){if(_0xe352b1&&_0xe352b1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x560c2d[_0x54c9('0x2c')],'resourceId':_0x560c2d['id'],'type':_0xe352b1[_0x54c9('0x2c')],'sectionId':_0xe352b1['id']},{})['then'](function(){return _0x42ba3d;});}else{return _0x42ba3d;}})[_0x54c9('0x4e')](function(_0x562abf){logger['error'](_0x54c9('0x4f'),_0x562abf);throw _0x562abf;});}return _0x42ba3d;})[_0x54c9('0x28')](respondWithResult(_0x347486,0xc9))[_0x54c9('0x4e')](handleError(_0x347486,null));};exports['update']=function(_0x23b7d9,_0x4b05d3){if(_0x23b7d9[_0x54c9('0x50')]['id']){delete _0x23b7d9['body']['id'];}return db['Variable'][_0x54c9('0x4d')]({'where':{'id':_0x23b7d9[_0x54c9('0x46')]['id']}})[_0x54c9('0x28')](handleEntityNotFound(_0x4b05d3,null))[_0x54c9('0x28')](saveUpdates(_0x23b7d9[_0x54c9('0x50')],null))[_0x54c9('0x28')](respondWithResult(_0x4b05d3,null))[_0x54c9('0x4e')](handleError(_0x4b05d3,null));};exports[_0x54c9('0x27')]=function(_0x1582ae,_0x4a5576){return db['Variable'][_0x54c9('0x4d')]({'where':{'id':_0x1582ae[_0x54c9('0x46')]['id']}})[_0x54c9('0x28')](handleEntityNotFound(_0x4a5576,null))['then'](removeEntity(_0x4a5576,null))[_0x54c9('0x4e')](handleError(_0x4a5576,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 13c76e1..8ad7b9f 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 _0x399e=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util'];(function(_0x3262af,_0x13ada3){var _0x343899=function(_0x406a2c){while(--_0x406a2c){_0x3262af['push'](_0x3262af['shift']());}};_0x343899(++_0x13ada3);}(_0x399e,0x98));var _0xe399=function(_0x49d21f,_0x6e7f5){_0x49d21f=_0x49d21f-0x0;var _0x1b93f2=_0x399e[_0x49d21f];return _0x1b93f2;};'use strict';var _=require(_0xe399('0x0'));var util=require(_0xe399('0x1'));var logger=require(_0xe399('0x2'))('api');var moment=require(_0xe399('0x3'));var BPromise=require(_0xe399('0x4'));var rp=require(_0xe399('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe399('0x6'));var attributes=require(_0xe399('0x7'));module[_0xe399('0x8')]=function(_0xce1174,_0xc84042){return _0xce1174[_0xe399('0x9')]('Variable',attributes,{'tableName':_0xe399('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf10=['exports','Variable','lodash','moment','path','../../config/environment','./variable.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaf10,0x1ec));var _0x0af1=function(_0x49401c,_0x88233a){_0x49401c=_0x49401c-0x0;var _0x8e157c=_0xaf10[_0x49401c];return _0x8e157c;};'use strict';var _=require(_0x0af1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0af1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0af1('0x2'));var rimraf=require('rimraf');var config=require(_0x0af1('0x3'));var attributes=require(_0x0af1('0x4'));module[_0x0af1('0x5')]=function(_0x3d7e46,_0x107718){return _0x3d7e46['define'](_0x0af1('0x6'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9f0b455..1de859f 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0x12fe70,_0x1d31cb){var _0x270ec9=function(_0x22f5d4){while(--_0x22f5d4){_0x12fe70['push'](_0x12fe70['shift']());}};_0x270ec9(++_0x1d31cb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x7fbe[_0x18baf4];return _0x278ed1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x36aa05,_0x3117cc){var _0x293263=function(_0x1bdc70){while(--_0x1bdc70){_0x36aa05['push'](_0x36aa05['shift']());}};_0x293263(++_0x3117cc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x5fc3[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b796426..3ee74bb 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 _0x3fee=['express','Router','../../components/auth/service','./version.controller','get','/fetch','fetch','/reset','reset','isAuthenticated','canUpdate','pull','restart','/migrations','exports'];(function(_0x3f92d5,_0x54f154){var _0x393550=function(_0x4eea69){while(--_0x4eea69){_0x3f92d5['push'](_0x3f92d5['shift']());}};_0x393550(++_0x54f154);}(_0x3fee,0xb4));var _0xe3fe=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x3fee[_0x1c8c28];return _0x1f59b4;};'use strict';var express=require(_0xe3fe('0x0'));var router=express[_0xe3fe('0x1')]();var auth=require(_0xe3fe('0x2'));var controller=require(_0xe3fe('0x3'));router[_0xe3fe('0x4')]('/',controller['index']);router[_0xe3fe('0x4')](_0xe3fe('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe3fe('0x6')]);router[_0xe3fe('0x4')](_0xe3fe('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe3fe('0x8')]);router[_0xe3fe('0x4')]('/pull',auth[_0xe3fe('0x9')](),auth[_0xe3fe('0xa')](),controller[_0xe3fe('0xb')]);router[_0xe3fe('0x4')]('/restart',auth['isAuthenticated'](),controller[_0xe3fe('0xc')]);router[_0xe3fe('0x4')](_0xe3fe('0xd'),controller['migrations']);module[_0xe3fe('0xe')]=router; \ No newline at end of file +var _0xad08=['/pull','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','get','/fetch','canUpdate','fetch','isAuthenticated'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0xad08,0x131));var _0x8ad0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xad08[_0x1facfa];return _0x9ec701;};'use strict';var express=require('express');var router=express[_0x8ad0('0x0')]();var auth=require(_0x8ad0('0x1'));var controller=require('./version.controller');router[_0x8ad0('0x2')]('/',controller['index']);router['get'](_0x8ad0('0x3'),auth['isAuthenticated'](),auth[_0x8ad0('0x4')](),controller[_0x8ad0('0x5')]);router[_0x8ad0('0x2')]('/reset',auth[_0x8ad0('0x6')](),auth['canUpdate'](),controller['reset']);router[_0x8ad0('0x2')](_0x8ad0('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8ad0('0x8')]);router[_0x8ad0('0x2')](_0x8ad0('0x9'),auth[_0x8ad0('0x6')](),controller[_0x8ad0('0xa')]);router['get'](_0x8ad0('0xb'),controller['migrations']);module[_0x8ad0('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 637a06b..b778e56 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 _0xaf59=['exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','version','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','length','replace','.js','push','sequelize','Migration','constructor','join','server','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','child_process'];(function(_0x2b4fda,_0x3bfc22){var _0x55629a=function(_0x43928f){while(--_0x43928f){_0x2b4fda['push'](_0x2b4fda['shift']());}};_0x55629a(++_0x3bfc22);}(_0xaf59,0x15b));var _0x9af5=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xaf59[_0x4b73a2];return _0x383c66;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x9af5('0x0'));var pkginfo=require(_0x9af5('0x1'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x9af5('0x2'))[_0x9af5('0x3')];var db=require(_0x9af5('0x4'))['db'];var config=require(_0x9af5('0x5'));var pm2=require(_0x9af5('0x6'));var logger=require(_0x9af5('0x7'))(_0x9af5('0x8'));var git=require(_0x9af5('0x9'))(config[_0x9af5('0xa')]);exports[_0x9af5('0xb')]=function(_0x1190d0,_0x37c668){var _0x49ac82={'current':module[_0x9af5('0xc')]['version'],'phonebar':0x2};if(_0x1190d0['query']&&_0x1190d0[_0x9af5('0xd')][_0x9af5('0xe')]){return git[_0x9af5('0xf')]()['tags'](function(_0x2be074,_0x555323){_0x49ac82[_0x9af5('0xe')]=(_0x2be074?module['exports'][_0x9af5('0x10')]:_0x555323[_0x9af5('0xe')])||'2.0.0';return _0x37c668[_0x9af5('0x11')](0xc8)[_0x9af5('0x12')](_0x49ac82);});}else{return _0x37c668['status'](0xc8)['json'](_0x49ac82);}};exports[_0x9af5('0xf')]=function(_0x2945ad,_0x4ec27f){return git[_0x9af5('0xf')]([_0x9af5('0x13'),_0x9af5('0x14')],function(_0x3528d5){if(_0x3528d5){logger[_0x9af5('0x15')](_0x3528d5);return _0x4ec27f[_0x9af5('0x11')](0x1f4)['json'](_0x3528d5);}logger[_0x9af5('0x16')]('git\x20fetch');return _0x4ec27f[_0x9af5('0x11')](0xc8)['json']({'output':_0x9af5('0x17')});});};exports[_0x9af5('0x18')]=function(_0x1f8144,_0x157219){return git[_0x9af5('0x18')]([_0x9af5('0x19'),_0x9af5('0x1a')],function(_0x5a7cfd){if(_0x5a7cfd){logger['error'](_0x5a7cfd);return _0x157219[_0x9af5('0x11')](0x1f4)[_0x9af5('0x12')](_0x5a7cfd);}logger[_0x9af5('0x16')](_0x9af5('0x1b'));return _0x157219['status'](0xc8)[_0x9af5('0x12')]({'output':_0x9af5('0x1c')});});};exports[_0x9af5('0x1d')]=function(_0x2829b7,_0x33a264){exec('npm\x20install\x20--production',function(_0x255ad6,_0x1f954e,_0x22e15c){logger['info'](_0x1f954e);logger[_0x9af5('0x16')](_0x22e15c);if(_0x255ad6){logger[_0x9af5('0x15')](_0x255ad6);return _0x33a264['status'](0x1f4)[_0x9af5('0x12')](_0x255ad6);}return _0x33a264['status'](0xc8)['json']({'output':_0x1f954e});});};exports[_0x9af5('0x1e')]=function(_0x3203ad,_0x503bcb){return pm2[_0x9af5('0x1e')](_0x9af5('0x1f'))[_0x9af5('0x20')](function(_0x32795c){logger['info'](_0x9af5('0x21'),_0x32795c);return _0x503bcb['status'](0xc8)[_0x9af5('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x9af5('0x22')](function(_0x2ce465){logger['error'](_0x2ce465);return _0x503bcb[_0x9af5('0x11')](0x1f4)['json'](_0x2ce465);});};exports[_0x9af5('0x23')]=function(_0x40143e,_0x2de807){var _0x29d39b=fs[_0x9af5('0x24')](path['join'](config[_0x9af5('0xa')],'server',_0x9af5('0x23')));var _0x5b7c93=[];for(var _0x6f07e9=0x0;_0x6f07e9<_0x29d39b[_0x9af5('0x25')];_0x6f07e9++){var _0x31a3be=_0x29d39b[_0x6f07e9][_0x9af5('0x26')](_0x9af5('0x27'),'');if(compareVersions(module[_0x9af5('0xc')][_0x9af5('0x10')],_0x31a3be)===-0x1){_0x5b7c93[_0x9af5('0x28')](_0x31a3be);}}if(_0x5b7c93[_0x9af5('0x25')]){var _0x462708=_0x5b7c93['sort'](compareVersions);var _0x3af326=new Umzug({'storage':_0x9af5('0x29'),'storageOptions':{'model':db[_0x9af5('0x2a')],'modelName':_0x9af5('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0x9af5('0x29')]['getQueryInterface'](),db[_0x9af5('0x29')][_0x9af5('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x9af5('0x2c')](config['root'],_0x9af5('0x2d'),_0x9af5('0x23')),'pattern':/\.js$/}});_0x3af326['up']({'migrations':_[_0x9af5('0x2e')](_0x462708,function(_0x4180ea){return _0x4180ea+_0x9af5('0x27');})})['then'](function(){return _0x2de807[_0x9af5('0x11')](0xc8)[_0x9af5('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9af5('0xc')][_0x9af5('0x10')]+'\x20to\x20'+_[_0x9af5('0x2f')](_0x462708),'migrations':_[_0x9af5('0x2c')](_0x462708)});})['catch'](function(_0x1d8681){if(_0x1d8681 instanceof db[_0x9af5('0x29')][_0x9af5('0x30')]){return _0x2de807[_0x9af5('0x11')](0xc8)[_0x9af5('0x12')]({'output':_0x9af5('0x31')});}else{return _0x2de807[_0x9af5('0x11')](0x1f4)[_0x9af5('0x12')](_0x1d8681);}});}else{return _0x2de807[_0x9af5('0x11')](0xc8)[_0x9af5('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x97e2=['pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','server','length','replace','.js','push','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','join','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','version','query','latest','tags','status','json','fetch','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x5c2abc,_0x5d58ae){var _0xaeda52=function(_0x1d9dfd){while(--_0x1d9dfd){_0x5c2abc['push'](_0x5c2abc['shift']());}};_0xaeda52(++_0x5d58ae);}(_0x97e2,0x199));var _0x297e=function(_0x585425,_0x4f5f8c){_0x585425=_0x585425-0x0;var _0x314cec=_0x97e2[_0x585425];return _0x314cec;};'use strict';var Umzug=require(_0x297e('0x0'));var path=require(_0x297e('0x1'));var fs=require('fs');var _=require(_0x297e('0x2'));var pkginfo=require(_0x297e('0x3'))(module,'version');var compareVersions=require(_0x297e('0x4'));var exec=require(_0x297e('0x5'))[_0x297e('0x6')];var db=require(_0x297e('0x7'))['db'];var config=require(_0x297e('0x8'));var pm2=require(_0x297e('0x9'));var logger=require('../../config/logger')(_0x297e('0xa'));var git=require('simple-git')(config[_0x297e('0xb')]);exports[_0x297e('0xc')]=function(_0x4bd013,_0x5da083){var _0x2dcac6={'current':module[_0x297e('0xd')][_0x297e('0xe')],'phonebar':0x2};if(_0x4bd013[_0x297e('0xf')]&&_0x4bd013[_0x297e('0xf')][_0x297e('0x10')]){return git['fetch']()[_0x297e('0x11')](function(_0x239a11,_0x277ae3){_0x2dcac6[_0x297e('0x10')]=(_0x239a11?module[_0x297e('0xd')][_0x297e('0xe')]:_0x277ae3['latest'])||'2.0.0';return _0x5da083[_0x297e('0x12')](0xc8)['json'](_0x2dcac6);});}else{return _0x5da083[_0x297e('0x12')](0xc8)[_0x297e('0x13')](_0x2dcac6);}};exports[_0x297e('0x14')]=function(_0x1f2019,_0x129909){return git['fetch'](['origin',_0x297e('0x15')],function(_0x21229a){if(_0x21229a){logger[_0x297e('0x16')](_0x21229a);return _0x129909[_0x297e('0x12')](0x1f4)[_0x297e('0x13')](_0x21229a);}logger[_0x297e('0x17')](_0x297e('0x18'));return _0x129909[_0x297e('0x12')](0xc8)[_0x297e('0x13')]({'output':_0x297e('0x19')});});};exports[_0x297e('0x1a')]=function(_0x11ee45,_0x545da6){return git['reset']([_0x297e('0x1b'),_0x297e('0x1c')],function(_0x476ecf){if(_0x476ecf){logger[_0x297e('0x16')](_0x476ecf);return _0x545da6[_0x297e('0x12')](0x1f4)['json'](_0x476ecf);}logger[_0x297e('0x17')](_0x297e('0x1d'));return _0x545da6['status'](0xc8)[_0x297e('0x13')]({'output':_0x297e('0x1e')});});};exports[_0x297e('0x1f')]=function(_0x156a17,_0x25debc){exec(_0x297e('0x20'),function(_0x169a38,_0xcf157c,_0x57fc1c){logger[_0x297e('0x17')](_0xcf157c);logger[_0x297e('0x17')](_0x57fc1c);if(_0x169a38){logger[_0x297e('0x16')](_0x169a38);return _0x25debc[_0x297e('0x12')](0x1f4)['json'](_0x169a38);}return _0x25debc[_0x297e('0x12')](0xc8)[_0x297e('0x13')]({'output':_0xcf157c});});};exports[_0x297e('0x21')]=function(_0x3e260e,_0x368cdb){return pm2[_0x297e('0x21')](_0x297e('0x22'))['then'](function(_0x250018){logger['info'](_0x297e('0x23'),_0x250018);return _0x368cdb[_0x297e('0x12')](0xc8)[_0x297e('0x13')]({'output':_0x297e('0x24')});})['catch'](function(_0x9ed4be){logger[_0x297e('0x16')](_0x9ed4be);return _0x368cdb['status'](0x1f4)['json'](_0x9ed4be);});};exports['migrations']=function(_0x44d766,_0x30bb92){var _0x2328b6=fs[_0x297e('0x25')](path['join'](config[_0x297e('0xb')],_0x297e('0x26'),'migrations'));var _0x22de06=[];for(var _0x41a58a=0x0;_0x41a58a<_0x2328b6[_0x297e('0x27')];_0x41a58a++){var _0x36adbc=_0x2328b6[_0x41a58a][_0x297e('0x28')](_0x297e('0x29'),'');if(compareVersions(module['exports'][_0x297e('0xe')],_0x36adbc)===-0x1){_0x22de06[_0x297e('0x2a')](_0x36adbc);}}if(_0x22de06['length']){var _0x5aab82=_0x22de06[_0x297e('0x2b')](compareVersions);var _0x15ac7b=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x297e('0x2c'),'columnName':_0x297e('0xe')},'migrations':{'params':[db[_0x297e('0x2d')]['getQueryInterface'](),db[_0x297e('0x2d')][_0x297e('0x2e')],function(){throw new Error(_0x297e('0x2f'));}],'path':path['join'](config[_0x297e('0xb')],_0x297e('0x26'),_0x297e('0x30')),'pattern':/\.js$/}});_0x15ac7b['up']({'migrations':_[_0x297e('0x31')](_0x5aab82,function(_0x51e2d5){return _0x51e2d5+_0x297e('0x29');})})[_0x297e('0x32')](function(){return _0x30bb92['status'](0xc8)['json']({'output':_0x297e('0x33')+module['exports'][_0x297e('0xe')]+'\x20to\x20'+_['last'](_0x5aab82),'migrations':_[_0x297e('0x34')](_0x5aab82)});})[_0x297e('0x35')](function(_0x36be9a){if(_0x36be9a instanceof db[_0x297e('0x2d')]['UniqueConstraintError']){return _0x30bb92[_0x297e('0x12')](0xc8)[_0x297e('0x13')]({'output':_0x297e('0x36')});}else{return _0x30bb92[_0x297e('0x12')](0x1f4)['json'](_0x36be9a);}});}else{return _0x30bb92['status'](0xc8)['json']({'output':_0x297e('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b135433..d8a47ee 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 _0x653f=['post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x22c638,_0x18b481){var _0x3bf687=function(_0x4cc20c){while(--_0x4cc20c){_0x22c638['push'](_0x22c638['shift']());}};_0x3bf687(++_0x18b481);}(_0x653f,0x1be));var _0xf653=function(_0x18571a,_0xca7f4d){_0x18571a=_0x18571a-0x0;var _0x530936=_0x653f[_0x18571a];return _0x530936;};'use strict';var multer=require('multer');var util=require(_0xf653('0x0'));var path=require('path');var timeout=require(_0xf653('0x1'));var express=require(_0xf653('0x2'));var router=express[_0xf653('0x3')]();var fs_extra=require(_0xf653('0x4'));var auth=require(_0xf653('0x5'));var interaction=require(_0xf653('0x6'));var config=require(_0xf653('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xf653('0x8')]('/',auth[_0xf653('0x9')](),controller[_0xf653('0xa')]);router[_0xf653('0x8')](_0xf653('0xb'),auth[_0xf653('0x9')](),controller[_0xf653('0xc')]);router[_0xf653('0x8')](_0xf653('0xd'),auth[_0xf653('0x9')](),controller['show']);router[_0xf653('0xe')]('/',auth[_0xf653('0x9')](),controller[_0xf653('0xf')]);router[_0xf653('0x10')]('/:id',auth[_0xf653('0x9')](),controller[_0xf653('0x11')]);router[_0xf653('0x12')]('/:id',auth[_0xf653('0x9')](),controller[_0xf653('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9281=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x4f8cba,_0x51d42b){var _0xe240a6=function(_0x5de3ea){while(--_0x5de3ea){_0x4f8cba['push'](_0x4f8cba['shift']());}};_0xe240a6(++_0x51d42b);}(_0x9281,0xf7));var _0x1928=function(_0x5452bb,_0x1b20f9){_0x5452bb=_0x5452bb-0x0;var _0x5229cf=_0x9281[_0x5452bb];return _0x5229cf;};'use strict';var multer=require('multer');var util=require(_0x1928('0x0'));var path=require(_0x1928('0x1'));var timeout=require(_0x1928('0x2'));var express=require(_0x1928('0x3'));var router=express[_0x1928('0x4')]();var fs_extra=require(_0x1928('0x5'));var auth=require(_0x1928('0x6'));var interaction=require(_0x1928('0x7'));var config=require('../../config/environment');var controller=require(_0x1928('0x8'));router[_0x1928('0x9')]('/',auth[_0x1928('0xa')](),controller['index']);router[_0x1928('0x9')](_0x1928('0xb'),auth['isAuthenticated'](),controller[_0x1928('0xc')]);router['get']('/:id',auth[_0x1928('0xa')](),controller['show']);router[_0x1928('0xd')]('/',auth[_0x1928('0xa')](),controller[_0x1928('0xe')]);router[_0x1928('0xf')]('/:id',auth[_0x1928('0xa')](),controller[_0x1928('0x10')]);router[_0x1928('0x11')]('/:id',auth[_0x1928('0xa')](),controller[_0x1928('0x12')]);module[_0x1928('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 98d78e9..2b25fe3 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 _0xa7db=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x3aae06,_0x5e2534){var _0x58a919=function(_0x32d684){while(--_0x32d684){_0x3aae06['push'](_0x3aae06['shift']());}};_0x58a919(++_0x5e2534);}(_0xa7db,0xbf));var _0xba7d=function(_0x132d88,_0x53aa7f){_0x132d88=_0x132d88-0x0;var _0x39c4c0=_0xa7db[_0x132d88];return _0x39c4c0;};'use strict';var Sequelize=require(_0xba7d('0x0'));module[_0xba7d('0x1')]={'type':{'type':Sequelize[_0xba7d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xba7d('0x2')]},'interface':{'type':Sequelize[_0xba7d('0x2')]},'membername':{'type':Sequelize[_0xba7d('0x2')]},'agentcalledAt':{'type':Sequelize[_0xba7d('0x3')]},'agentconnectAt':{'type':Sequelize[_0xba7d('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xba7d('0x3')]},'agentdumpAt':{'type':Sequelize[_0xba7d('0x3')]},'holdtime':{'type':Sequelize[_0xba7d('0x4')]},'agentcomplete':{'type':Sequelize[_0xba7d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xba7d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xba7d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xba7d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xba7d('0x4')]},'reason':{'type':Sequelize[_0xba7d('0x2')]},'lastevent':{'type':Sequelize[_0xba7d('0x2')]},'channel':{'type':Sequelize[_0xba7d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xba7d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xba7d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xba7d('0x2')]},'accountcode':{'type':Sequelize[_0xba7d('0x2')]},'context':{'type':Sequelize[_0xba7d('0x2')]},'exten':{'type':Sequelize[_0xba7d('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xba7d('0x2')]},'destchannelstate':{'type':Sequelize[_0xba7d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xba7d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xba7d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xba7d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xba7d('0x2')]},'destaccountcode':{'type':Sequelize[_0xba7d('0x2')]},'destcontext':{'type':Sequelize[_0xba7d('0x2')]},'destexten':{'type':Sequelize[_0xba7d('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xba7d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xba7d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xba7d('0x6')},'transferexten':{'type':Sequelize[_0xba7d('0x2')]},'transferuniqueid':{'type':Sequelize[_0xba7d('0x2')]},'agententerreason':{'type':Sequelize[_0xba7d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4ffa=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ffa,0x124));var _0xa4ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ffa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa4ff('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa4ff('0x0')]},'calleridname':{'type':Sequelize[_0xa4ff('0x0')]},'queue':{'type':Sequelize[_0xa4ff('0x0')]},'interface':{'type':Sequelize[_0xa4ff('0x0')]},'membername':{'type':Sequelize[_0xa4ff('0x0')]},'agentcalledAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentdumpAt':{'type':Sequelize[_0xa4ff('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa4ff('0x3')]},'agentacw':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa4ff('0x0')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa4ff('0x0')]},'connectedlinenum':{'type':Sequelize[_0xa4ff('0x0')]},'connectedlinename':{'type':Sequelize[_0xa4ff('0x0')]},'language':{'type':Sequelize[_0xa4ff('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa4ff('0x0')]},'exten':{'type':Sequelize[_0xa4ff('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa4ff('0x0')]},'destchannelstate':{'type':Sequelize[_0xa4ff('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa4ff('0x0')]},'destcalleridname':{'type':Sequelize[_0xa4ff('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa4ff('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa4ff('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xa4ff('0x0')]},'destpriority':{'type':Sequelize[_0xa4ff('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa4ff('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0xa4ff('0x0')]},'transfer':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa4ff('0x0')],'comment':_0xa4ff('0x4')},'transferexten':{'type':Sequelize[_0xa4ff('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa4ff('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e722c18..57ec6f4 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 015f6b6..0ee2f1f 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 _0x44ae=['VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x451d74,_0x543d78){var _0x490af0=function(_0x112278){while(--_0x112278){_0x451d74['push'](_0x451d74['shift']());}};_0x490af0(++_0x543d78);}(_0x44ae,0x17d));var _0xe44a=function(_0x51942a,_0x3bd294){_0x51942a=_0x51942a-0x0;var _0x2ad705=_0x44ae[_0x51942a];return _0x2ad705;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe44a('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash'];(function(_0x390ea3,_0xb41b5f){var _0x4a2aeb=function(_0x1d73d4){while(--_0x1d73d4){_0x390ea3['push'](_0x390ea3['shift']());}};_0x4a2aeb(++_0xb41b5f);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5af709,_0x1481ca){_0x5af709=_0x5af709-0x0;var _0x190c50=_0xd0bb[_0x5af709];return _0x190c50;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbd0b('0xa'),_0xbd0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2fa15a4..f19bb71 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 _0x8916=['result','CreateVoiceAgentReport','VoiceAgentReport','body','options','UpdateVoiceAgentReport','update','raw','attributes','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x337033,_0x2d1ca1){var _0x409a6b=function(_0x483c97){while(--_0x483c97){_0x337033['push'](_0x337033['shift']());}};_0x409a6b(++_0x2d1ca1);}(_0x8916,0x11c));var _0x6891=function(_0x2f408f,_0xf03f42){_0x2f408f=_0x2f408f-0x0;var _0x559b23=_0x8916[_0x2f408f];return _0x559b23;};'use strict';var _=require(_0x6891('0x0'));var util=require(_0x6891('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6891('0x2'))['db'];var utils=require(_0x6891('0x3'));var logger=require(_0x6891('0x4'))('rpc');var config=require(_0x6891('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4d49,_0x69cb0a,_0x95d2e3){return new BPromise(function(_0x2166f9,_0x2697c3){return client[_0x6891('0x6')](_0x5d4d49,_0x95d2e3)[_0x6891('0x7')](function(_0x241fe0){logger['info'](_0x6891('0x8'),_0x69cb0a,_0x6891('0x9'));logger[_0x6891('0xa')](_0x6891('0xb'),_0x69cb0a,_0x6891('0x9'),JSON[_0x6891('0xc')](_0x241fe0));if(_0x241fe0[_0x6891('0xd')]){if(_0x241fe0[_0x6891('0xd')]['code']===0x1f4){logger['error'](_0x6891('0x8'),_0x69cb0a,_0x241fe0[_0x6891('0xd')][_0x6891('0xe')]);return _0x2697c3(_0x241fe0[_0x6891('0xd')][_0x6891('0xe')]);}logger[_0x6891('0xd')](_0x6891('0x8'),_0x69cb0a,_0x241fe0[_0x6891('0xd')]['message']);return _0x2166f9(_0x241fe0[_0x6891('0xd')][_0x6891('0xe')]);}else{logger[_0x6891('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x69cb0a,_0x6891('0x9'));_0x2166f9(_0x241fe0[_0x6891('0x10')][_0x6891('0xe')]);}})['catch'](function(_0x475616){logger[_0x6891('0xd')](_0x6891('0x8'),_0x69cb0a,_0x475616);_0x2697c3(_0x475616);});});}exports[_0x6891('0x11')]=function(_0x24ea2a){var _0x18960e=this;return new Promise(function(_0x1fe319,_0x16293d){return db[_0x6891('0x12')]['create'](_0x24ea2a[_0x6891('0x13')],{'raw':_0x24ea2a[_0x6891('0x14')]?_0x24ea2a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x189da0){logger['info'](_0x6891('0x11'),_0x24ea2a);logger[_0x6891('0xa')](_0x6891('0x11'),_0x24ea2a,JSON[_0x6891('0xc')](_0x189da0));_0x1fe319(_0x189da0);})['catch'](function(_0x219692){logger[_0x6891('0xd')](_0x6891('0x11'),_0x219692[_0x6891('0xe')],_0x24ea2a);_0x16293d(_0x18960e['error'](0x1f4,_0x219692['message']));});});};exports[_0x6891('0x15')]=function(_0x1d4328){var _0x38ed82=this;return new Promise(function(_0x5c623e,_0x589430){return db[_0x6891('0x12')][_0x6891('0x16')](_0x1d4328['body'],{'raw':_0x1d4328['options']?_0x1d4328['options'][_0x6891('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d4328[_0x6891('0x14')]?_0x1d4328[_0x6891('0x14')]['where']||null:null,'attributes':_0x1d4328['options']?_0x1d4328[_0x6891('0x14')][_0x6891('0x18')]||null:null,'limit':_0x1d4328['options']?_0x1d4328[_0x6891('0x14')]['limit']||null:null})[_0x6891('0x7')](function(_0x2e7a47){logger[_0x6891('0xf')](_0x6891('0x15'),_0x1d4328);logger[_0x6891('0xa')](_0x6891('0x15'),_0x1d4328,JSON['stringify'](_0x2e7a47));_0x5c623e(_0x2e7a47);})['catch'](function(_0x2f362b){logger['error'](_0x6891('0x15'),_0x2f362b['message'],_0x1d4328);_0x589430(_0x38ed82[_0x6891('0xd')](0x1f4,_0x2f362b[_0x6891('0xe')]));});});}; \ No newline at end of file +var _0x76a7=['../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','CreateVoiceAgentReport','body','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','limit','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x1e7d18,_0x582c6e){var _0x4ef4fb=function(_0x3c20e9){while(--_0x3c20e9){_0x1e7d18['push'](_0x1e7d18['shift']());}};_0x4ef4fb(++_0x582c6e);}(_0x76a7,0x145));var _0x776a=function(_0x20d900,_0x4da6fe){_0x20d900=_0x20d900-0x0;var _0x209972=_0x76a7[_0x20d900];return _0x209972;};'use strict';var _=require(_0x776a('0x0'));var util=require(_0x776a('0x1'));var moment=require('moment');var BPromise=require(_0x776a('0x2'));var rs=require(_0x776a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x776a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x776a('0x5'))(_0x776a('0x6'));var config=require('../../config/environment');var jayson=require(_0x776a('0x7'));var client=jayson['client'][_0x776a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a7c3e,_0x1d9b4e,_0x490669){return new BPromise(function(_0x57a3e1,_0x553601){return client[_0x776a('0x9')](_0x2a7c3e,_0x490669)[_0x776a('0xa')](function(_0x2858a3){logger[_0x776a('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d9b4e,_0x776a('0xc'));logger[_0x776a('0xd')](_0x776a('0xe'),_0x1d9b4e,'request\x20sent',JSON[_0x776a('0xf')](_0x2858a3));if(_0x2858a3[_0x776a('0x10')]){if(_0x2858a3[_0x776a('0x10')][_0x776a('0x11')]===0x1f4){logger[_0x776a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x1d9b4e,_0x2858a3[_0x776a('0x10')][_0x776a('0x12')]);return _0x553601(_0x2858a3[_0x776a('0x10')][_0x776a('0x12')]);}logger[_0x776a('0x10')](_0x776a('0x13'),_0x1d9b4e,_0x2858a3['error'][_0x776a('0x12')]);return _0x57a3e1(_0x2858a3['error']['message']);}else{logger[_0x776a('0xb')](_0x776a('0x13'),_0x1d9b4e,'request\x20sent');_0x57a3e1(_0x2858a3[_0x776a('0x14')][_0x776a('0x12')]);}})['catch'](function(_0x16cb47){logger[_0x776a('0x10')](_0x776a('0x13'),_0x1d9b4e,_0x16cb47);_0x553601(_0x16cb47);});});}exports[_0x776a('0x15')]=function(_0x534f71){var _0x5e3359=this;return new Promise(function(_0x74ed75,_0x48bf08){return db['VoiceAgentReport']['create'](_0x534f71[_0x776a('0x16')],{'raw':_0x534f71[_0x776a('0x17')]?_0x534f71[_0x776a('0x17')][_0x776a('0x18')]===undefined?!![]:![]:!![]})[_0x776a('0xa')](function(_0x3eec17){logger['info'](_0x776a('0x15'),_0x534f71);logger['debug'](_0x776a('0x15'),_0x534f71,JSON[_0x776a('0xf')](_0x3eec17));_0x74ed75(_0x3eec17);})[_0x776a('0x19')](function(_0x403573){logger['error'](_0x776a('0x15'),_0x403573[_0x776a('0x12')],_0x534f71);_0x48bf08(_0x5e3359[_0x776a('0x10')](0x1f4,_0x403573[_0x776a('0x12')]));});});};exports[_0x776a('0x1a')]=function(_0x171d0e){var _0x263574=this;return new Promise(function(_0x7aa17a,_0x3cf5cc){return db[_0x776a('0x1b')][_0x776a('0x1c')](_0x171d0e['body'],{'raw':_0x171d0e[_0x776a('0x17')]?_0x171d0e['options'][_0x776a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171d0e[_0x776a('0x17')]?_0x171d0e[_0x776a('0x17')]['where']||null:null,'attributes':_0x171d0e[_0x776a('0x17')]?_0x171d0e['options']['attributes']||null:null,'limit':_0x171d0e[_0x776a('0x17')]?_0x171d0e[_0x776a('0x17')][_0x776a('0x1d')]||null:null})['then'](function(_0x5e0e26){logger[_0x776a('0xb')](_0x776a('0x1a'),_0x171d0e);logger[_0x776a('0xd')](_0x776a('0x1a'),_0x171d0e,JSON[_0x776a('0xf')](_0x5e0e26));_0x7aa17a(_0x5e0e26);})[_0x776a('0x19')](function(_0x3c1e70){logger[_0x776a('0x10')](_0x776a('0x1a'),_0x3c1e70[_0x776a('0x12')],_0x171d0e);_0x3cf5cc(_0x263574['error'](0x1f4,_0x3c1e70[_0x776a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e72aa96..5260cb0 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xbd50,0x196));var _0x0bd5=function(_0x199835,_0x199cea){_0x199835=_0x199835-0x0;var _0x4ce830=_0xbd50[_0x199835];return _0x4ce830;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x0309=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','path','express'];(function(_0x1b2781,_0x50b74d){var _0x226750=function(_0x3f46a1){while(--_0x3f46a1){_0x1b2781['push'](_0x1b2781['shift']());}};_0x226750(++_0x50b74d);}(_0x0309,0x165));var _0x9030=function(_0x39ae30,_0x1bac03){_0x39ae30=_0x39ae30-0x0;var _0x567421=_0x0309[_0x39ae30];return _0x567421;};'use strict';var multer=require(_0x9030('0x0'));var util=require('util');var path=require(_0x9030('0x1'));var timeout=require('connect-timeout');var express=require(_0x9030('0x2'));var router=express[_0x9030('0x3')]();var fs_extra=require(_0x9030('0x4'));var auth=require(_0x9030('0x5'));var interaction=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var controller=require(_0x9030('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9030('0x9')]);router[_0x9030('0xa')]('/describe',auth[_0x9030('0xb')](),controller['describe']);router[_0x9030('0xa')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller['show']);router[_0x9030('0xd')]('/',auth[_0x9030('0xb')](),controller[_0x9030('0xe')]);router['put'](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0xf')]);router[_0x9030('0x10')](_0x9030('0xc'),auth[_0x9030('0xb')](),controller[_0x9030('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e27e3fa..d1d66b2 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 _0x5a13=['DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax'];(function(_0x3e1005,_0x411a5c){var _0x322323=function(_0x1b41b3){while(--_0x1b41b3){_0x3e1005['push'](_0x3e1005['shift']());}};_0x322323(++_0x411a5c);}(_0x5a13,0x92));var _0x35a1=function(_0x31e12c,_0x557916){_0x31e12c=_0x31e12c-0x0;var _0x1ec79f=_0x5a13[_0x31e12c];return _0x1ec79f;};'use strict';var Sequelize=require('sequelize');module[_0x35a1('0x0')]={'uniqueid':{'type':Sequelize[_0x35a1('0x1')]},'type':{'type':Sequelize[_0x35a1('0x2')](_0x35a1('0x3'),_0x35a1('0x4'),_0x35a1('0x5'),'inbound-fax',_0x35a1('0x6'),'dialer')},'tag':{'type':Sequelize[_0x35a1('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x35a1('0x1')]},'callerid':{'type':Sequelize[_0x35a1('0x1')]},'channel':{'type':Sequelize[_0x35a1('0x1')]},'destinationchannel':{'type':Sequelize[_0x35a1('0x1')]},'lastapplication':{'type':Sequelize[_0x35a1('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x35a1('0x7')]},'systemanswertime':{'type':Sequelize[_0x35a1('0x7')]},'answertime':{'type':Sequelize[_0x35a1('0x7')]},'endtime':{'type':Sequelize[_0x35a1('0x7')]},'duration':{'type':Sequelize[_0x35a1('0x8')]},'billableseconds':{'type':Sequelize[_0x35a1('0x8')]},'mohtime':{'type':Sequelize[_0x35a1('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x35a1('0x1')]},'amaflags':{'type':Sequelize[_0x35a1('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x35a1('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x35a1('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x35a1('0x1')]},'note':{'type':Sequelize[_0x35a1('0x1')]},'prefix':{'type':Sequelize[_0x35a1('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x35a1('0x1')]}}; \ No newline at end of file +var _0xd679=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x1be360,_0x4d3ee2){var _0x3e2146=function(_0x2b0777){while(--_0x2b0777){_0x1be360['push'](_0x1be360['shift']());}};_0x3e2146(++_0x4d3ee2);}(_0xd679,0xcc));var _0x9d67=function(_0x55de2f,_0x38e86e){_0x55de2f=_0x55de2f-0x0;var _0x208c30=_0xd679[_0x55de2f];return _0x208c30;};'use strict';var Sequelize=require('sequelize');module[_0x9d67('0x0')]={'uniqueid':{'type':Sequelize[_0x9d67('0x1')]},'type':{'type':Sequelize[_0x9d67('0x2')](_0x9d67('0x3'),_0x9d67('0x4'),_0x9d67('0x5'),_0x9d67('0x6'),_0x9d67('0x7'),_0x9d67('0x8'))},'tag':{'type':Sequelize[_0x9d67('0x1')]},'accountcode':{'type':Sequelize[_0x9d67('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x9d67('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9d67('0x1')]},'channel':{'type':Sequelize[_0x9d67('0x1')]},'destinationchannel':{'type':Sequelize[_0x9d67('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x9d67('0x9')]},'starttime':{'type':Sequelize[_0x9d67('0xa')]},'systemanswertime':{'type':Sequelize[_0x9d67('0xa')]},'answertime':{'type':Sequelize[_0x9d67('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9d67('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9d67('0x1')]},'amaflags':{'type':Sequelize[_0x9d67('0x1')]},'userfield':{'type':Sequelize[_0x9d67('0x1')]},'userDisposition':{'type':Sequelize[_0x9d67('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9d67('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9d67('0x1')]},'note':{'type':Sequelize[_0x9d67('0x1')]},'prefix':{'type':Sequelize[_0x9d67('0x1')]},'routeid':{'type':Sequelize[_0x9d67('0xb')]},'sipcallid':{'type':Sequelize[_0x9d67('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 13d69cd..32d00a3 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c2056,_0x3b8eaa){_0x2c2056=_0x2c2056-0x0;var _0x22b5b2=_0x5f2f[_0x2c2056];return _0x22b5b2;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xadb5,0xad));var _0x5adb=function(_0x1b20c6,_0x890885){_0x1b20c6=_0x1b20c6-0x0;var _0xe4e984=_0xadb5[_0x1b20c6];return _0xe4e984;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4cd1651..88d5e66 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 _0x3130=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash'];(function(_0x1367ea,_0x5ad35a){var _0x5d251b=function(_0x54f834){while(--_0x54f834){_0x1367ea['push'](_0x1367ea['shift']());}};_0x5d251b(++_0x5ad35a);}(_0x3130,0xef));var _0x0313=function(_0x4f89ef,_0x4a48b1){_0x4f89ef=_0x4f89ef-0x0;var _0x146be4=_0x3130[_0x4f89ef];return _0x146be4;};'use strict';var _=require(_0x0313('0x0'));var util=require(_0x0313('0x1'));var logger=require('../../config/logger')(_0x0313('0x2'));var moment=require(_0x0313('0x3'));var BPromise=require(_0x0313('0x4'));var rp=require(_0x0313('0x5'));var fs=require('fs');var path=require(_0x0313('0x6'));var rimraf=require(_0x0313('0x7'));var config=require(_0x0313('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x0313('0x9')]=function(_0x53c55b,_0x14a5dc){return _0x53c55b[_0x0313('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x0313('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6681=['api','moment','request-promise','path','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x35d740,_0x32d237){var _0x3dac30=function(_0x222681){while(--_0x222681){_0x35d740['push'](_0x35d740['shift']());}};_0x3dac30(++_0x32d237);}(_0x6681,0x141));var _0x1668=function(_0x433cbc,_0x5714da){_0x433cbc=_0x433cbc-0x0;var _0x1a15d2=_0x6681[_0x433cbc];return _0x1a15d2;};'use strict';var _=require(_0x1668('0x0'));var util=require(_0x1668('0x1'));var logger=require(_0x1668('0x2'))(_0x1668('0x3'));var moment=require(_0x1668('0x4'));var BPromise=require('bluebird');var rp=require(_0x1668('0x5'));var fs=require('fs');var path=require(_0x1668('0x6'));var rimraf=require('rimraf');var config=require(_0x1668('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x1668('0x8')]=function(_0x3ca538,_0x5da1d1){return _0x3ca538['define'](_0x1668('0x9'),attributes,{'tableName':_0x1668('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1668('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 3f05d17..3cf922e 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 _0x0cd0=['attributes','limit','include','map','model','stringify','VoiceCallReport','create','CreateVoiceCallReport','update','body','UpdateVoiceCallReport','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','findAll','raw','options','where'];(function(_0x16d51e,_0x1ca818){var _0x5e1846=function(_0x3cf282){while(--_0x3cf282){_0x16d51e['push'](_0x16d51e['shift']());}};_0x5e1846(++_0x1ca818);}(_0x0cd0,0x10f));var _0x00cd=function(_0x557aea,_0x7339e6){_0x557aea=_0x557aea-0x0;var _0x50fff8=_0x0cd0[_0x557aea];return _0x50fff8;};'use strict';var _=require(_0x00cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00cd('0x1'));var rs=require(_0x00cd('0x2'));var fs=require('fs');var Redis=require(_0x00cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x00cd('0x4'));var logger=require('../../config/logger')(_0x00cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x00cd('0x6'));var client=jayson[_0x00cd('0x7')][_0x00cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a1758,_0x3a4934,_0x2f6f9f){return new BPromise(function(_0x26a0ac,_0x4f8dc6){return client['request'](_0x1a1758,_0x2f6f9f)[_0x00cd('0x9')](function(_0x2de01c){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3a4934,_0x00cd('0xa'));logger[_0x00cd('0xb')](_0x00cd('0xc'),_0x3a4934,_0x00cd('0xa'),JSON['stringify'](_0x2de01c));if(_0x2de01c[_0x00cd('0xd')]){if(_0x2de01c[_0x00cd('0xd')][_0x00cd('0xe')]===0x1f4){logger[_0x00cd('0xd')](_0x00cd('0xf'),_0x3a4934,_0x2de01c['error'][_0x00cd('0x10')]);return _0x4f8dc6(_0x2de01c[_0x00cd('0xd')][_0x00cd('0x10')]);}logger[_0x00cd('0xd')](_0x00cd('0xf'),_0x3a4934,_0x2de01c[_0x00cd('0xd')]['message']);return _0x26a0ac(_0x2de01c['error'][_0x00cd('0x10')]);}else{logger[_0x00cd('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3a4934,_0x00cd('0xa'));_0x26a0ac(_0x2de01c[_0x00cd('0x12')][_0x00cd('0x10')]);}})[_0x00cd('0x13')](function(_0x4f93a0){logger[_0x00cd('0xd')](_0x00cd('0xf'),_0x3a4934,_0x4f93a0);_0x4f8dc6(_0x4f93a0);});});}exports[_0x00cd('0x14')]=function(_0x28b44c){var _0x5b6b14=this;return new Promise(function(_0x1d6823,_0xf49bbe){return db['VoiceCallReport'][_0x00cd('0x15')]({'raw':_0x28b44c['options']?_0x28b44c['options'][_0x00cd('0x16')]===undefined?!![]:![]:!![],'where':_0x28b44c[_0x00cd('0x17')]?_0x28b44c[_0x00cd('0x17')][_0x00cd('0x18')]||null:null,'attributes':_0x28b44c[_0x00cd('0x17')]?_0x28b44c[_0x00cd('0x17')][_0x00cd('0x19')]||null:null,'limit':_0x28b44c[_0x00cd('0x17')]?_0x28b44c[_0x00cd('0x17')][_0x00cd('0x1a')]||null:null,'include':_0x28b44c[_0x00cd('0x17')]?_0x28b44c[_0x00cd('0x17')][_0x00cd('0x1b')]?_[_0x00cd('0x1c')](_0x28b44c['options'][_0x00cd('0x1b')],function(_0x36ceca){return{'model':db[_0x36ceca[_0x00cd('0x1d')]],'as':_0x36ceca['as'],'attributes':_0x36ceca[_0x00cd('0x19')],'include':_0x36ceca[_0x00cd('0x1b')]?_[_0x00cd('0x1c')](_0x36ceca[_0x00cd('0x1b')],function(_0x2fdbf9){return{'model':db[_0x2fdbf9[_0x00cd('0x1d')]],'as':_0x2fdbf9['as'],'attributes':_0x2fdbf9['attributes'],'include':_0x2fdbf9['include']?_[_0x00cd('0x1c')](_0x2fdbf9[_0x00cd('0x1b')],function(_0x4d0606){return{'model':db[_0x4d0606[_0x00cd('0x1d')]],'as':_0x4d0606['as'],'attributes':_0x4d0606[_0x00cd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00cd('0x9')](function(_0x36e996){logger[_0x00cd('0x11')](_0x00cd('0x14'),_0x28b44c);logger[_0x00cd('0xb')](_0x00cd('0x14'),_0x28b44c,JSON[_0x00cd('0x1e')](_0x36e996));_0x1d6823(_0x36e996);})[_0x00cd('0x13')](function(_0x273c05){logger[_0x00cd('0xd')](_0x00cd('0x14'),_0x273c05['message'],_0x28b44c);_0xf49bbe(_0x5b6b14[_0x00cd('0xd')](0x1f4,_0x273c05[_0x00cd('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x4ca7b6){var _0x4639bc=this;return new Promise(function(_0x3a35d1,_0x1f1bf7){return db[_0x00cd('0x1f')][_0x00cd('0x20')](_0x4ca7b6['body'],{'raw':_0x4ca7b6[_0x00cd('0x17')]?_0x4ca7b6[_0x00cd('0x17')][_0x00cd('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2ec36c){logger[_0x00cd('0x11')](_0x00cd('0x21'),_0x4ca7b6);logger['debug']('CreateVoiceCallReport',_0x4ca7b6,JSON['stringify'](_0x2ec36c));_0x3a35d1(_0x2ec36c);})[_0x00cd('0x13')](function(_0x42c94c){logger[_0x00cd('0xd')]('CreateVoiceCallReport',_0x42c94c[_0x00cd('0x10')],_0x4ca7b6);_0x1f1bf7(_0x4639bc[_0x00cd('0xd')](0x1f4,_0x42c94c[_0x00cd('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0x358d4b){var _0x3374e0=this;return new Promise(function(_0x3f691a,_0x1c0451){return db[_0x00cd('0x1f')][_0x00cd('0x22')](_0x358d4b[_0x00cd('0x23')],{'raw':_0x358d4b[_0x00cd('0x17')]?_0x358d4b['options'][_0x00cd('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358d4b['options']?_0x358d4b[_0x00cd('0x17')]['where']||null:null,'attributes':_0x358d4b['options']?_0x358d4b[_0x00cd('0x17')][_0x00cd('0x19')]||null:null,'limit':_0x358d4b[_0x00cd('0x17')]?_0x358d4b['options'][_0x00cd('0x1a')]||null:null})[_0x00cd('0x9')](function(_0x5ed134){logger[_0x00cd('0x11')](_0x00cd('0x24'),_0x358d4b);logger[_0x00cd('0xb')](_0x00cd('0x24'),_0x358d4b,JSON[_0x00cd('0x1e')](_0x5ed134));_0x3f691a(_0x5ed134);})['catch'](function(_0x558ced){logger['error'](_0x00cd('0x24'),_0x558ced['message'],_0x358d4b);_0x1c0451(_0x3374e0[_0x00cd('0xd')](0x1f4,_0x558ced['message']));});});}; \ No newline at end of file +var _0xd48a=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','model','attributes','map','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d9239,_0x41b9a6){var _0xfc2521=function(_0xa2894){while(--_0xa2894){_0x5d9239['push'](_0x5d9239['shift']());}};_0xfc2521(++_0x41b9a6);}(_0xd48a,0x9a));var _0xad48=function(_0x11a60b,_0x721758){_0x11a60b=_0x11a60b-0x0;var _0x36dcb4=_0xd48a[_0x11a60b];return _0x36dcb4;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var moment=require(_0xad48('0x1'));var BPromise=require(_0xad48('0x2'));var rs=require(_0xad48('0x3'));var fs=require('fs');var Redis=require(_0xad48('0x4'));var db=require(_0xad48('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad48('0x6'));var config=require(_0xad48('0x7'));var jayson=require(_0xad48('0x8'));var client=jayson[_0xad48('0x9')][_0xad48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x259189,_0x4aa169,_0x1bf26b){return new BPromise(function(_0x5061f3,_0x14b9ba){return client[_0xad48('0xb')](_0x259189,_0x1bf26b)[_0xad48('0xc')](function(_0x1e82c0){logger[_0xad48('0xd')](_0xad48('0xe'),_0x4aa169,_0xad48('0xf'));logger['debug'](_0xad48('0x10'),_0x4aa169,'request\x20sent',JSON[_0xad48('0x11')](_0x1e82c0));if(_0x1e82c0[_0xad48('0x12')]){if(_0x1e82c0['error'][_0xad48('0x13')]===0x1f4){logger[_0xad48('0x12')](_0xad48('0xe'),_0x4aa169,_0x1e82c0[_0xad48('0x12')]['message']);return _0x14b9ba(_0x1e82c0[_0xad48('0x12')][_0xad48('0x14')]);}logger[_0xad48('0x12')](_0xad48('0xe'),_0x4aa169,_0x1e82c0['error'][_0xad48('0x14')]);return _0x5061f3(_0x1e82c0[_0xad48('0x12')][_0xad48('0x14')]);}else{logger[_0xad48('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x4aa169,_0xad48('0xf'));_0x5061f3(_0x1e82c0[_0xad48('0x15')]['message']);}})[_0xad48('0x16')](function(_0x33badf){logger['error'](_0xad48('0xe'),_0x4aa169,_0x33badf);_0x14b9ba(_0x33badf);});});}exports[_0xad48('0x17')]=function(_0x8d99f2){var _0x2b56e5=this;return new Promise(function(_0x21666c,_0x1aef73){return db[_0xad48('0x18')][_0xad48('0x19')]({'raw':_0x8d99f2['options']?_0x8d99f2[_0xad48('0x1a')][_0xad48('0x1b')]===undefined?!![]:![]:!![],'where':_0x8d99f2[_0xad48('0x1a')]?_0x8d99f2['options'][_0xad48('0x1c')]||null:null,'attributes':_0x8d99f2[_0xad48('0x1a')]?_0x8d99f2[_0xad48('0x1a')]['attributes']||null:null,'limit':_0x8d99f2[_0xad48('0x1a')]?_0x8d99f2[_0xad48('0x1a')]['limit']||null:null,'include':_0x8d99f2['options']?_0x8d99f2[_0xad48('0x1a')][_0xad48('0x1d')]?_['map'](_0x8d99f2[_0xad48('0x1a')][_0xad48('0x1d')],function(_0x44a473){return{'model':db[_0x44a473[_0xad48('0x1e')]],'as':_0x44a473['as'],'attributes':_0x44a473[_0xad48('0x1f')],'include':_0x44a473[_0xad48('0x1d')]?_[_0xad48('0x20')](_0x44a473[_0xad48('0x1d')],function(_0xa3a3b0){return{'model':db[_0xa3a3b0['model']],'as':_0xa3a3b0['as'],'attributes':_0xa3a3b0[_0xad48('0x1f')],'include':_0xa3a3b0[_0xad48('0x1d')]?_[_0xad48('0x20')](_0xa3a3b0[_0xad48('0x1d')],function(_0x4a3794){return{'model':db[_0x4a3794['model']],'as':_0x4a3794['as'],'attributes':_0x4a3794[_0xad48('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xad48('0xc')](function(_0x2fb580){logger[_0xad48('0xd')]('GetVoiceCallReport',_0x8d99f2);logger[_0xad48('0x21')](_0xad48('0x17'),_0x8d99f2,JSON[_0xad48('0x11')](_0x2fb580));_0x21666c(_0x2fb580);})[_0xad48('0x16')](function(_0x446c47){logger[_0xad48('0x12')]('GetVoiceCallReport',_0x446c47[_0xad48('0x14')],_0x8d99f2);_0x1aef73(_0x2b56e5[_0xad48('0x12')](0x1f4,_0x446c47[_0xad48('0x14')]));});});};exports[_0xad48('0x22')]=function(_0x5bd1ec){var _0x2ba8a7=this;return new Promise(function(_0x1e7c22,_0x303696){return db[_0xad48('0x18')][_0xad48('0x23')](_0x5bd1ec['body'],{'raw':_0x5bd1ec['options']?_0x5bd1ec[_0xad48('0x1a')][_0xad48('0x1b')]===undefined?!![]:![]:!![]})[_0xad48('0xc')](function(_0x1dbc7e){logger[_0xad48('0xd')](_0xad48('0x22'),_0x5bd1ec);logger[_0xad48('0x21')]('CreateVoiceCallReport',_0x5bd1ec,JSON['stringify'](_0x1dbc7e));_0x1e7c22(_0x1dbc7e);})[_0xad48('0x16')](function(_0x4266a3){logger[_0xad48('0x12')](_0xad48('0x22'),_0x4266a3['message'],_0x5bd1ec);_0x303696(_0x2ba8a7[_0xad48('0x12')](0x1f4,_0x4266a3['message']));});});};exports[_0xad48('0x24')]=function(_0x19c208){var _0x2737f2=this;return new Promise(function(_0xa9111d,_0x3f6a31){return db[_0xad48('0x18')][_0xad48('0x25')](_0x19c208[_0xad48('0x26')],{'raw':_0x19c208['options']?_0x19c208[_0xad48('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19c208[_0xad48('0x1a')]?_0x19c208['options'][_0xad48('0x1c')]||null:null,'attributes':_0x19c208['options']?_0x19c208[_0xad48('0x1a')][_0xad48('0x1f')]||null:null,'limit':_0x19c208[_0xad48('0x1a')]?_0x19c208['options'][_0xad48('0x27')]||null:null})[_0xad48('0xc')](function(_0x4c880d){logger[_0xad48('0xd')](_0xad48('0x24'),_0x19c208);logger['debug'](_0xad48('0x24'),_0x19c208,JSON[_0xad48('0x11')](_0x4c880d));_0xa9111d(_0x4c880d);})['catch'](function(_0x5d69f0){logger[_0xad48('0x12')](_0xad48('0x24'),_0x5d69f0[_0xad48('0x14')],_0x19c208);_0x3f6a31(_0x2737f2['error'](0x1f4,_0x5d69f0[_0xad48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 00e299d..aef89d7 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 _0x10de=['put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5e5cbf,_0x515f8d){var _0x25abec=function(_0x401792){while(--_0x401792){_0x5e5cbf['push'](_0x5e5cbf['shift']());}};_0x25abec(++_0x515f8d);}(_0x10de,0x15a));var _0xe10d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x10de[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xe10d('0x0'));var util=require(_0xe10d('0x1'));var path=require('path');var timeout=require(_0xe10d('0x2'));var express=require('express');var router=express[_0xe10d('0x3')]();var fs_extra=require(_0xe10d('0x4'));var auth=require(_0xe10d('0x5'));var interaction=require(_0xe10d('0x6'));var config=require(_0xe10d('0x7'));var controller=require(_0xe10d('0x8'));router[_0xe10d('0x9')]('/',auth[_0xe10d('0xa')](),controller[_0xe10d('0xb')]);router['get'](_0xe10d('0xc'),auth[_0xe10d('0xa')](),controller[_0xe10d('0xd')]);router[_0xe10d('0xe')]('/',auth[_0xe10d('0xa')](),controller['create']);router[_0xe10d('0xf')]('/:id',auth[_0xe10d('0xa')](),controller[_0xe10d('0x10')]);router[_0xe10d('0x11')](_0xe10d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe10d('0x12')]=router; \ No newline at end of file +var _0x0b8a=['get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x0b8a,0x1c1));var _0xa0b8=function(_0x2eeb6c,_0x4714df){_0x2eeb6c=_0x2eeb6c-0x0;var _0x546efe=_0x0b8a[_0x2eeb6c];return _0x546efe;};'use strict';var multer=require(_0xa0b8('0x0'));var util=require(_0xa0b8('0x1'));var path=require(_0xa0b8('0x2'));var timeout=require(_0xa0b8('0x3'));var express=require(_0xa0b8('0x4'));var router=express[_0xa0b8('0x5')]();var fs_extra=require(_0xa0b8('0x6'));var auth=require(_0xa0b8('0x7'));var interaction=require(_0xa0b8('0x8'));var config=require(_0xa0b8('0x9'));var controller=require(_0xa0b8('0xa'));router[_0xa0b8('0xb')]('/',auth[_0xa0b8('0xc')](),controller[_0xa0b8('0xd')]);router['get'](_0xa0b8('0xe'),auth['isAuthenticated'](),controller[_0xa0b8('0xf')]);router['post']('/',auth[_0xa0b8('0xc')](),controller[_0xa0b8('0x10')]);router['put'](_0xa0b8('0xe'),auth['isAuthenticated'](),controller[_0xa0b8('0x11')]);router[_0xa0b8('0x12')]('/:id',auth[_0xa0b8('0xc')](),controller['destroy']);module[_0xa0b8('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 065cda5..6e91e87 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 _0xbf89=['split','BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xbf89,0xb6));var _0x9bf8=function(_0x3fd4b3,_0x17d3ef){_0x3fd4b3=_0x3fd4b3-0x0;var _0x2979a3=_0xbf89[_0x3fd4b3];return _0x2979a3;};'use strict';var Sequelize=require(_0x9bf8('0x0'));module['exports']={'name':{'type':Sequelize[_0x9bf8('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x9bf8('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x837a7d){this[_0x9bf8('0x3')](_0x9bf8('0x4'),_0x837a7d?_0x837a7d[_0x9bf8('0x5')](''):[]);},'get':function(){return this[_0x9bf8('0x6')](_0x9bf8('0x4'))?this[_0x9bf8('0x6')](_0x9bf8('0x4'))[_0x9bf8('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9bf8('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9bf8('0x1')]},'record':{'type':Sequelize[_0x9bf8('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9bf8('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c48=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xed18c,_0x532e5d){var _0x2c77a8=function(_0x1f8e61){while(--_0x1f8e61){_0xed18c['push'](_0xed18c['shift']());}};_0x2c77a8(++_0x532e5d);}(_0x1c48,0x1b0));var _0x81c4=function(_0x261879,_0x10f189){_0x261879=_0x261879-0x0;var _0x4e23db=_0x1c48[_0x261879];return _0x4e23db;};'use strict';var Sequelize=require('sequelize');module[_0x81c4('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x81c4('0x1')],'unique':_0x81c4('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x81c4('0x1')],'set':function(_0x559fe0){this[_0x81c4('0x3')](_0x81c4('0x4'),_0x559fe0?_0x559fe0[_0x81c4('0x5')](''):[]);},'get':function(){return this[_0x81c4('0x6')](_0x81c4('0x4'))?this['getDataValue']('options')[_0x81c4('0x7')](''):[];}},'auth':{'type':Sequelize[_0x81c4('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x81c4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index f7d78eb..b3cbbf8 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 _0xac55=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','ChanSpies','status','stack','name','index','VoiceChanSpy','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body'];(function(_0x4105e3,_0x41f1ea){var _0x402641=function(_0x543ac8){while(--_0x543ac8){_0x4105e3['push'](_0x4105e3['shift']());}};_0x402641(++_0x41f1ea);}(_0xac55,0x1c8));var _0x5ac5=function(_0x239322,_0x53236b){_0x239322=_0x239322-0x0;var _0x412909=_0xac55[_0x239322];return _0x412909;};'use strict';var emlformat=require(_0x5ac5('0x0'));var rimraf=require(_0x5ac5('0x1'));var zipdir=require(_0x5ac5('0x2'));var jsonpatch=require(_0x5ac5('0x3'));var rp=require('request-promise');var moment=require(_0x5ac5('0x4'));var BPromise=require(_0x5ac5('0x5'));var Mustache=require(_0x5ac5('0x6'));var util=require(_0x5ac5('0x7'));var path=require(_0x5ac5('0x8'));var sox=require(_0x5ac5('0x9'));var csv=require(_0x5ac5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ac5('0xb'));var squel=require(_0x5ac5('0xc'));var crypto=require(_0x5ac5('0xd'));var jsforce=require(_0x5ac5('0xe'));var deskjs=require(_0x5ac5('0xf'));var toCsv=require(_0x5ac5('0xa'));var querystring=require(_0x5ac5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ac5('0x11'));var qs=require(_0x5ac5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac5('0x13'));var logger=require(_0x5ac5('0x14'))('api');var utils=require(_0x5ac5('0x15'));var config=require(_0x5ac5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ac5('0x17'))['db'];function respondWithStatusCode(_0x1d2b5f,_0x7c4f62){_0x7c4f62=_0x7c4f62||0xcc;return function(_0x13fad8){if(_0x13fad8){return _0x1d2b5f[_0x5ac5('0x18')](_0x7c4f62);}return _0x1d2b5f['status'](_0x7c4f62)[_0x5ac5('0x19')]();};}function respondWithResult(_0x56db18,_0x1ce256){_0x1ce256=_0x1ce256||0xc8;return function(_0x40ee8a){if(_0x40ee8a){return _0x56db18['status'](_0x1ce256)[_0x5ac5('0x1a')](_0x40ee8a);}};}function respondWithFilteredResult(_0x57377b,_0x2a145d){return function(_0x340195){if(_0x340195){var _0x30244d=typeof _0x2a145d[_0x5ac5('0x1b')]===_0x5ac5('0x1c')&&typeof _0x2a145d[_0x5ac5('0x1d')]===_0x5ac5('0x1c');var _0x5510ef=_0x340195[_0x5ac5('0x1e')];var _0x5364a6=_0x30244d?0x0:_0x2a145d[_0x5ac5('0x1b')];var _0x14d164=_0x30244d?_0x340195['count']:_0x2a145d[_0x5ac5('0x1b')]+_0x2a145d['limit'];var _0x264422;if(_0x14d164>=_0x5510ef){_0x14d164=_0x5510ef;_0x264422=0xc8;}else{_0x264422=0xce;}_0x57377b['status'](_0x264422);return _0x57377b['set'](_0x5ac5('0x1f'),_0x5364a6+'-'+_0x14d164+'/'+_0x5510ef)['json'](_0x340195);}return null;};}function patchUpdates(_0x39f3cf){return function(_0x3cb669){try{jsonpatch['apply'](_0x3cb669,_0x39f3cf,!![]);}catch(_0x4066f5){return BPromise['reject'](_0x4066f5);}return _0x3cb669[_0x5ac5('0x20')]();};}function saveUpdates(_0x40bdbc,_0x47993e){return function(_0x47a898){if(_0x47a898){return _0x47a898[_0x5ac5('0x21')](_0x40bdbc)[_0x5ac5('0x22')](function(_0x400308){return _0x400308;});}return null;};}function removeEntity(_0x182683,_0xee1c62){return function(_0x4dec2f){if(_0x4dec2f){return _0x4dec2f[_0x5ac5('0x23')]()[_0x5ac5('0x22')](function(){var _0x387487=_0x4dec2f[_0x5ac5('0x24')]({'plain':!![]});var _0x4b81e2=_0x5ac5('0x25');return db['UserProfileResource'][_0x5ac5('0x23')]({'where':{'type':_0x4b81e2,'resourceId':_0x387487['id']}})[_0x5ac5('0x22')](function(){return _0x4dec2f;});})[_0x5ac5('0x22')](function(){_0x182683[_0x5ac5('0x26')](0xcc)[_0x5ac5('0x19')]();});}};}function handleEntityNotFound(_0x3b3ec0,_0x5ce67c){return function(_0x31f9cc){if(!_0x31f9cc){_0x3b3ec0['sendStatus'](0x194);}return _0x31f9cc;};}function handleError(_0x24e8c7,_0x3d0e6f){_0x3d0e6f=_0x3d0e6f||0x1f4;return function(_0x35535f){logger['error'](_0x35535f[_0x5ac5('0x27')]);if(_0x35535f[_0x5ac5('0x28')]){delete _0x35535f[_0x5ac5('0x28')];}_0x24e8c7[_0x5ac5('0x26')](_0x3d0e6f)['send'](_0x35535f);};}exports[_0x5ac5('0x29')]=function(_0x4e4b3e,_0x3414ba){var _0x383d8c={},_0x2cd6cc={},_0x2fded3={'count':0x0,'rows':[]};var _0x41a83a=_['map'](db[_0x5ac5('0x2a')][_0x5ac5('0x2b')],function(_0x36285d){return{'name':_0x36285d['fieldName'],'type':_0x36285d[_0x5ac5('0x2c')]['key']};});_0x2cd6cc[_0x5ac5('0x2d')]=_[_0x5ac5('0x2e')](_0x41a83a,_0x5ac5('0x28'));_0x2cd6cc[_0x5ac5('0x2f')]=_[_0x5ac5('0x30')](_0x4e4b3e['query']);_0x2cd6cc[_0x5ac5('0x31')]=_['intersection'](_0x2cd6cc[_0x5ac5('0x2d')],_0x2cd6cc['query']);_0x383d8c[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x2cd6cc['model'],qs[_0x5ac5('0x34')](_0x4e4b3e[_0x5ac5('0x2f')]['fields']));_0x383d8c['attributes']=_0x383d8c[_0x5ac5('0x32')][_0x5ac5('0x35')]?_0x383d8c[_0x5ac5('0x32')]:_0x2cd6cc[_0x5ac5('0x2d')];if(!_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x36')]('nolimit')){_0x383d8c['limit']=qs['limit'](_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x1d')]);_0x383d8c['offset']=qs[_0x5ac5('0x1b')](_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x1b')]);}_0x383d8c[_0x5ac5('0x37')]=qs[_0x5ac5('0x38')](_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x38')]);_0x383d8c[_0x5ac5('0x39')]=qs[_0x5ac5('0x31')](_['pick'](_0x4e4b3e[_0x5ac5('0x2f')],_0x2cd6cc['filters']),_0x41a83a);if(_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x3a')]){_0x383d8c[_0x5ac5('0x39')]=_[_0x5ac5('0x3b')](_0x383d8c[_0x5ac5('0x39')],{'$or':_[_0x5ac5('0x2e')](_0x41a83a,function(_0x1d97a9){if(_0x1d97a9[_0x5ac5('0x2c')]!==_0x5ac5('0x3c')){var _0x5105fc={};_0x5105fc[_0x1d97a9[_0x5ac5('0x28')]]={'$like':'%'+_0x4e4b3e[_0x5ac5('0x2f')]['filter']+'%'};return _0x5105fc;}})});}_0x383d8c=_['merge']({},_0x383d8c,_0x4e4b3e[_0x5ac5('0x3d')]);var _0x5bc6b6={'where':_0x383d8c[_0x5ac5('0x39')]};return db[_0x5ac5('0x2a')]['count'](_0x5bc6b6)['then'](function(_0x1e261d){_0x2fded3[_0x5ac5('0x1e')]=_0x1e261d;if(_0x4e4b3e[_0x5ac5('0x2f')][_0x5ac5('0x3e')]){_0x383d8c[_0x5ac5('0x3f')]=[{'all':!![]}];}return db[_0x5ac5('0x2a')][_0x5ac5('0x40')](_0x383d8c);})['then'](function(_0x1d4ef5){_0x2fded3[_0x5ac5('0x41')]=_0x1d4ef5;return _0x2fded3;})[_0x5ac5('0x22')](respondWithFilteredResult(_0x3414ba,_0x383d8c))[_0x5ac5('0x42')](handleError(_0x3414ba,null));};exports[_0x5ac5('0x43')]=function(_0x3abf39,_0x5b5f84){var _0x6db684={'raw':![],'where':{'id':_0x3abf39[_0x5ac5('0x44')]['id']}},_0x24657d={};_0x24657d[_0x5ac5('0x2d')]=_['keys'](db[_0x5ac5('0x2a')][_0x5ac5('0x2b')]);_0x24657d[_0x5ac5('0x2f')]=_['keys'](_0x3abf39['query']);_0x24657d[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x24657d[_0x5ac5('0x2d')],_0x24657d[_0x5ac5('0x2f')]);_0x6db684['attributes']=_[_0x5ac5('0x33')](_0x24657d['model'],qs[_0x5ac5('0x34')](_0x3abf39[_0x5ac5('0x2f')]['fields']));_0x6db684[_0x5ac5('0x32')]=_0x6db684['attributes'][_0x5ac5('0x35')]?_0x6db684[_0x5ac5('0x32')]:_0x24657d[_0x5ac5('0x2d')];if(_0x3abf39['query']['includeAll']){_0x6db684[_0x5ac5('0x3f')]=[{'all':!![]}];}_0x6db684=_[_0x5ac5('0x3b')]({},_0x6db684,_0x3abf39[_0x5ac5('0x3d')]);return db[_0x5ac5('0x2a')][_0x5ac5('0x45')](_0x6db684)[_0x5ac5('0x22')](handleEntityNotFound(_0x5b5f84,null))[_0x5ac5('0x22')](respondWithResult(_0x5b5f84,null))[_0x5ac5('0x42')](handleError(_0x5b5f84,null));};exports[_0x5ac5('0x46')]=function(_0x536765,_0x2d6aa5){return db[_0x5ac5('0x2a')][_0x5ac5('0x46')](_0x536765['body'],{})['then'](function(_0x3c6486){var _0x8168fc=_0x536765[_0x5ac5('0x47')]['get']({'plain':!![]});if(!_0x8168fc)throw new Error(_0x5ac5('0x48'));if(_0x8168fc[_0x5ac5('0x49')]===_0x5ac5('0x47')){var _0x2a3396=_0x3c6486[_0x5ac5('0x24')]({'plain':!![]});var _0x327952=_0x5ac5('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x327952,'userProfileId':_0x8168fc['userProfileId']},'raw':!![]})[_0x5ac5('0x22')](function(_0x44d12b){if(_0x44d12b&&_0x44d12b[_0x5ac5('0x4a')]===0x0){return db['UserProfileResource'][_0x5ac5('0x46')]({'name':_0x2a3396[_0x5ac5('0x28')],'resourceId':_0x2a3396['id'],'type':_0x44d12b[_0x5ac5('0x28')],'sectionId':_0x44d12b['id']},{})[_0x5ac5('0x22')](function(){return _0x3c6486;});}else{return _0x3c6486;}})[_0x5ac5('0x42')](function(_0x4e89a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e89a6);throw _0x4e89a6;});}return _0x3c6486;})[_0x5ac5('0x22')](respondWithResult(_0x2d6aa5,0xc9))[_0x5ac5('0x42')](handleError(_0x2d6aa5,null));};exports[_0x5ac5('0x21')]=function(_0x3fb4c1,_0x3fc780){if(_0x3fb4c1[_0x5ac5('0x4b')]['id']){delete _0x3fb4c1[_0x5ac5('0x4b')]['id'];}return db[_0x5ac5('0x2a')][_0x5ac5('0x45')]({'where':{'id':_0x3fb4c1[_0x5ac5('0x44')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x3fc780,null))[_0x5ac5('0x22')](saveUpdates(_0x3fb4c1[_0x5ac5('0x4b')],null))[_0x5ac5('0x22')](respondWithResult(_0x3fc780,null))[_0x5ac5('0x42')](handleError(_0x3fc780,null));};exports['destroy']=function(_0x3a2945,_0x360fb8){return db['VoiceChanSpy'][_0x5ac5('0x45')]({'where':{'id':_0x3a2945[_0x5ac5('0x44')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x360fb8,null))[_0x5ac5('0x22')](removeEntity(_0x360fb8,null))[_0x5ac5('0x42')](handleError(_0x360fb8,null));}; \ No newline at end of file +var _0x3140=['filter','options','count','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','update','then','get','ChanSpies','UserProfileResource','error','stack','send','map','VoiceChanSpy','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','name'];(function(_0x4568a0,_0x3670bb){var _0x1bb2de=function(_0x3d9824){while(--_0x3d9824){_0x4568a0['push'](_0x4568a0['shift']());}};_0x1bb2de(++_0x3670bb);}(_0x3140,0xaf));var _0x0314=function(_0x141310,_0x4fb243){_0x141310=_0x141310-0x0;var _0x4680ae=_0x3140[_0x141310];return _0x4680ae;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require(_0x0314('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0314('0x4'));var Mustache=require(_0x0314('0x5'));var util=require(_0x0314('0x6'));var path=require(_0x0314('0x7'));var sox=require(_0x0314('0x8'));var csv=require(_0x0314('0x9'));var ejs=require(_0x0314('0xa'));var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0314('0xf'));var toCsv=require(_0x0314('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0314('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0314('0x11'));var as=require(_0x0314('0x12'));var hardwareService=require(_0x0314('0x13'));var logger=require(_0x0314('0x14'))(_0x0314('0x15'));var utils=require(_0x0314('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x17'));var db=require(_0x0314('0x18'))['db'];function respondWithStatusCode(_0xd85ddf,_0x4602ec){_0x4602ec=_0x4602ec||0xcc;return function(_0x153077){if(_0x153077){return _0xd85ddf[_0x0314('0x19')](_0x4602ec);}return _0xd85ddf[_0x0314('0x1a')](_0x4602ec)['end']();};}function respondWithResult(_0x1c26ff,_0xbe0b07){_0xbe0b07=_0xbe0b07||0xc8;return function(_0x1316a0){if(_0x1316a0){return _0x1c26ff[_0x0314('0x1a')](_0xbe0b07)[_0x0314('0x1b')](_0x1316a0);}};}function respondWithFilteredResult(_0x398c91,_0x413bfa){return function(_0x3ea356){if(_0x3ea356){var _0x5e460f=typeof _0x413bfa[_0x0314('0x1c')]===_0x0314('0x1d')&&typeof _0x413bfa[_0x0314('0x1e')]==='undefined';var _0x6c48cb=_0x3ea356['count'];var _0x575b68=_0x5e460f?0x0:_0x413bfa[_0x0314('0x1c')];var _0x329679=_0x5e460f?_0x3ea356['count']:_0x413bfa[_0x0314('0x1c')]+_0x413bfa[_0x0314('0x1e')];var _0x583ffa;if(_0x329679>=_0x6c48cb){_0x329679=_0x6c48cb;_0x583ffa=0xc8;}else{_0x583ffa=0xce;}_0x398c91[_0x0314('0x1a')](_0x583ffa);return _0x398c91['set'](_0x0314('0x1f'),_0x575b68+'-'+_0x329679+'/'+_0x6c48cb)[_0x0314('0x1b')](_0x3ea356);}return null;};}function patchUpdates(_0x16d273){return function(_0x77ddfd){try{jsonpatch[_0x0314('0x20')](_0x77ddfd,_0x16d273,!![]);}catch(_0xdfad84){return BPromise['reject'](_0xdfad84);}return _0x77ddfd['save']();};}function saveUpdates(_0x20305b,_0xbd3ad0){return function(_0x1945f8){if(_0x1945f8){return _0x1945f8[_0x0314('0x21')](_0x20305b)[_0x0314('0x22')](function(_0xd7638b){return _0xd7638b;});}return null;};}function removeEntity(_0x58a1c9,_0x3c743e){return function(_0x43fb0e){if(_0x43fb0e){return _0x43fb0e['destroy']()[_0x0314('0x22')](function(){var _0xfc4893=_0x43fb0e[_0x0314('0x23')]({'plain':!![]});var _0x26c6a4=_0x0314('0x24');return db[_0x0314('0x25')]['destroy']({'where':{'type':_0x26c6a4,'resourceId':_0xfc4893['id']}})[_0x0314('0x22')](function(){return _0x43fb0e;});})[_0x0314('0x22')](function(){_0x58a1c9[_0x0314('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b4b5,_0x5e3eba){return function(_0x47c102){if(!_0x47c102){_0x29b4b5['sendStatus'](0x194);}return _0x47c102;};}function handleError(_0x2fc520,_0x21d6a5){_0x21d6a5=_0x21d6a5||0x1f4;return function(_0x550dc4){logger[_0x0314('0x26')](_0x550dc4[_0x0314('0x27')]);if(_0x550dc4['name']){delete _0x550dc4['name'];}_0x2fc520[_0x0314('0x1a')](_0x21d6a5)[_0x0314('0x28')](_0x550dc4);};}exports['index']=function(_0x44adb3,_0x16e74a){var _0x3d6652={},_0x4da71c={},_0x5b82b2={'count':0x0,'rows':[]};var _0x37ab90=_[_0x0314('0x29')](db[_0x0314('0x2a')]['rawAttributes'],function(_0x1d01b5){return{'name':_0x1d01b5['fieldName'],'type':_0x1d01b5['type'][_0x0314('0x2b')]};});_0x4da71c[_0x0314('0x2c')]=_[_0x0314('0x29')](_0x37ab90,'name');_0x4da71c[_0x0314('0x2d')]=_['keys'](_0x44adb3[_0x0314('0x2d')]);_0x4da71c['filters']=_['intersection'](_0x4da71c[_0x0314('0x2c')],_0x4da71c['query']);_0x3d6652[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x4da71c[_0x0314('0x2c')],qs[_0x0314('0x30')](_0x44adb3[_0x0314('0x2d')][_0x0314('0x30')]));_0x3d6652[_0x0314('0x2e')]=_0x3d6652['attributes'][_0x0314('0x31')]?_0x3d6652[_0x0314('0x2e')]:_0x4da71c[_0x0314('0x2c')];if(!_0x44adb3[_0x0314('0x2d')][_0x0314('0x32')](_0x0314('0x33'))){_0x3d6652['limit']=qs[_0x0314('0x1e')](_0x44adb3['query'][_0x0314('0x1e')]);_0x3d6652['offset']=qs[_0x0314('0x1c')](_0x44adb3['query']['offset']);}_0x3d6652['order']=qs[_0x0314('0x34')](_0x44adb3[_0x0314('0x2d')][_0x0314('0x34')]);_0x3d6652[_0x0314('0x35')]=qs[_0x0314('0x36')](_['pick'](_0x44adb3[_0x0314('0x2d')],_0x4da71c[_0x0314('0x36')]),_0x37ab90);if(_0x44adb3[_0x0314('0x2d')]['filter']){_0x3d6652[_0x0314('0x35')]=_['merge'](_0x3d6652[_0x0314('0x35')],{'$or':_['map'](_0x37ab90,function(_0x24fe65){if(_0x24fe65['type']!=='VIRTUAL'){var _0x370539={};_0x370539[_0x24fe65[_0x0314('0x37')]]={'$like':'%'+_0x44adb3['query'][_0x0314('0x38')]+'%'};return _0x370539;}})});}_0x3d6652=_['merge']({},_0x3d6652,_0x44adb3[_0x0314('0x39')]);var _0x438ddd={'where':_0x3d6652[_0x0314('0x35')]};return db[_0x0314('0x2a')][_0x0314('0x3a')](_0x438ddd)['then'](function(_0x52a71c){_0x5b82b2[_0x0314('0x3a')]=_0x52a71c;if(_0x44adb3[_0x0314('0x2d')]['includeAll']){_0x3d6652[_0x0314('0x3b')]=[{'all':!![]}];}return db[_0x0314('0x2a')][_0x0314('0x3c')](_0x3d6652);})['then'](function(_0x2b328c){_0x5b82b2['rows']=_0x2b328c;return _0x5b82b2;})[_0x0314('0x22')](respondWithFilteredResult(_0x16e74a,_0x3d6652))[_0x0314('0x3d')](handleError(_0x16e74a,null));};exports[_0x0314('0x3e')]=function(_0x583aba,_0xcafd05){var _0xf4c4a1={'raw':![],'where':{'id':_0x583aba['params']['id']}},_0x588e65={};_0x588e65['model']=_[_0x0314('0x3f')](db[_0x0314('0x2a')][_0x0314('0x40')]);_0x588e65['query']=_[_0x0314('0x3f')](_0x583aba[_0x0314('0x2d')]);_0x588e65[_0x0314('0x36')]=_[_0x0314('0x2f')](_0x588e65[_0x0314('0x2c')],_0x588e65['query']);_0xf4c4a1[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x588e65[_0x0314('0x2c')],qs[_0x0314('0x30')](_0x583aba[_0x0314('0x2d')][_0x0314('0x30')]));_0xf4c4a1[_0x0314('0x2e')]=_0xf4c4a1['attributes'][_0x0314('0x31')]?_0xf4c4a1[_0x0314('0x2e')]:_0x588e65['model'];if(_0x583aba[_0x0314('0x2d')][_0x0314('0x41')]){_0xf4c4a1[_0x0314('0x3b')]=[{'all':!![]}];}_0xf4c4a1=_['merge']({},_0xf4c4a1,_0x583aba['options']);return db[_0x0314('0x2a')][_0x0314('0x42')](_0xf4c4a1)[_0x0314('0x22')](handleEntityNotFound(_0xcafd05,null))[_0x0314('0x22')](respondWithResult(_0xcafd05,null))[_0x0314('0x3d')](handleError(_0xcafd05,null));};exports[_0x0314('0x43')]=function(_0x36a72a,_0x478b8b){return db[_0x0314('0x2a')]['create'](_0x36a72a[_0x0314('0x44')],{})[_0x0314('0x22')](function(_0x3003dd){var _0x362b60=_0x36a72a[_0x0314('0x45')]['get']({'plain':!![]});if(!_0x362b60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x362b60[_0x0314('0x46')]===_0x0314('0x45')){var _0x20070c=_0x3003dd[_0x0314('0x23')]({'plain':!![]});var _0x5b3c49=_0x0314('0x24');return db[_0x0314('0x47')][_0x0314('0x42')]({'where':{'name':_0x5b3c49,'userProfileId':_0x362b60[_0x0314('0x48')]},'raw':!![]})[_0x0314('0x22')](function(_0x458bd8){if(_0x458bd8&&_0x458bd8[_0x0314('0x49')]===0x0){return db['UserProfileResource'][_0x0314('0x43')]({'name':_0x20070c[_0x0314('0x37')],'resourceId':_0x20070c['id'],'type':_0x458bd8[_0x0314('0x37')],'sectionId':_0x458bd8['id']},{})['then'](function(){return _0x3003dd;});}else{return _0x3003dd;}})[_0x0314('0x3d')](function(_0x11695d){logger['error'](_0x0314('0x4a'),_0x11695d);throw _0x11695d;});}return _0x3003dd;})[_0x0314('0x22')](respondWithResult(_0x478b8b,0xc9))[_0x0314('0x3d')](handleError(_0x478b8b,null));};exports[_0x0314('0x21')]=function(_0x544a03,_0x39b4c1){if(_0x544a03[_0x0314('0x44')]['id']){delete _0x544a03[_0x0314('0x44')]['id'];}return db[_0x0314('0x2a')][_0x0314('0x42')]({'where':{'id':_0x544a03[_0x0314('0x4b')]['id']}})[_0x0314('0x22')](handleEntityNotFound(_0x39b4c1,null))[_0x0314('0x22')](saveUpdates(_0x544a03[_0x0314('0x44')],null))[_0x0314('0x22')](respondWithResult(_0x39b4c1,null))['catch'](handleError(_0x39b4c1,null));};exports[_0x0314('0x4c')]=function(_0x305568,_0xf29a33){return db[_0x0314('0x2a')][_0x0314('0x42')]({'where':{'id':_0x305568[_0x0314('0x4b')]['id']}})[_0x0314('0x22')](handleEntityNotFound(_0xf29a33,null))['then'](removeEntity(_0xf29a33,null))['catch'](handleError(_0xf29a33,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f9403e9..4f79b9e 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 _0x8189=['merge','Set','format','CDR(type)=%s','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','internal','findAll','agent','exports','models','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push'];(function(_0x1c6355,_0x5d1571){var _0x422fb1=function(_0x4fafaa){while(--_0x4fafaa){_0x1c6355['push'](_0x1c6355['shift']());}};_0x422fb1(++_0x5d1571);}(_0x8189,0x1bf));var _0x9818=function(_0xf9c730,_0x4cbeaa){_0xf9c730=_0xf9c730-0x0;var _0x2c504a=_0x8189[_0xf9c730];return _0x2c504a;};'use strict';var _=require(_0x9818('0x0'));var util=require('util');var BPromise=require(_0x9818('0x1'));var attributes=require(_0x9818('0x2'));var getUserApplications=function(_0x285018,_0x156404,_0x31cb55){var _0x402781=0x1;var _0x5291d5=[];var _0x3008df={'context':_0x156404[_0x9818('0x3')]||'from-sip','exten':util['format'](_0x9818('0x4'),_0x285018[_0x9818('0x5')],_0x31cb55),'type':_0x9818('0x6'),'isApp':![],'ChanSpyId':_0x285018['id'],'UserId':_0x156404['id']};_0x5291d5[_0x9818('0x7')](_[_0x9818('0x8')]({'app':_0x9818('0x9'),'appdata':util[_0x9818('0xa')](_0x9818('0xb'),'chanspy'),'priority':_0x402781++},_0x3008df));if(_0x285018['record']){_0x5291d5['push'](_[_0x9818('0x8')]({'app':_0x9818('0xc'),'appdata':util[_0x9818('0xa')]('${UNIQUEID}.%s,a',_0x285018[_0x9818('0xd')]),'priority':_0x402781++},_0x3008df));}if(_0x285018[_0x9818('0xe')]){_0x5291d5['push'](_[_0x9818('0x8')]({'app':_0x9818('0xf'),'appdata':_0x285018['password'],'priority':_0x402781++},_0x3008df));}_0x5291d5[_0x9818('0x7')](_[_0x9818('0x8')]({'app':_0x9818('0x10'),'appdata':util[_0x9818('0xa')](_0x9818('0x11'),_0x156404[_0x9818('0x12')],_0x285018[_0x9818('0x13')]?_0x285018[_0x9818('0x13')]['join'](''):''),'priority':_0x402781++},_0x3008df));if(_0x285018[_0x9818('0x14')]){_0x5291d5[_0x9818('0x7')](_['merge']({'app':_0x9818('0x15'),'priority':_0x402781++},_0x3008df));}return _0x5291d5;};var getChanSpyApplications=function(_0x283738,_0xf0bda0){var _0x1f463c=[];for(var _0x394757=0x0,_0x5abad8=0x1;_0x394757<_0xf0bda0[_0x9818('0x16')];_0x394757++,_0x5abad8=0x1){_0x1f463c=_0x1f463c[_0x9818('0x17')](getUserApplications(_0x283738,_0xf0bda0[_0x394757],_0xf0bda0[_0x394757][_0x9818('0x18')]));if(_0xf0bda0[_0x394757][_0x9818('0x18')]!=_0xf0bda0[_0x394757]['name']){_0x1f463c=_0x1f463c[_0x9818('0x17')](getUserApplications(_0x283738,_0xf0bda0[_0x394757],_0xf0bda0[_0x394757][_0x9818('0x12')]));}}return _0x1f463c;};var getChanSpyPromise=function(_0x273bcd,_0x2065a7){return new BPromise(function(_0x1674f4,_0x46f4f2){return _0x273bcd['User'][_0x9818('0x19')]({'attributes':['id',_0x9818('0x12'),_0x9818('0x18')],'where':{'role':_0x9818('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x58138e){if(_0x58138e){return _0x1674f4(getChanSpyApplications(_0x2065a7,_0x58138e));}return _0x1674f4([]);})['catch'](function(_0x1a7ac5){_0x46f4f2(_0x1a7ac5);});});};module[_0x9818('0x1b')]=function(_0x1b8e4d,_0x2b629f){var _0x2ae64a=_0x1b8e4d[_0x9818('0x1c')];return _0x1b8e4d['define']('VoiceChanSpy',attributes,{'tableName':_0x9818('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f23f5,_0x113457,_0x38d90e){return getChanSpyPromise(_0x2ae64a,_0x3f23f5)[_0x9818('0x1e')](function(_0x383a62){if(_0x383a62&&_0x383a62['length']){return _0x2ae64a[_0x9818('0x1f')][_0x9818('0x20')](_0x383a62);}})[_0x9818('0x1e')](function(){_0x38d90e();})[_0x9818('0x21')](function(_0x53764d){_0x38d90e(_0x53764d);});},'afterUpdate':function(_0x2ed96f,_0x16e0d5,_0xd6a317){return _0x2ae64a['VoiceExtension'][_0x9818('0x22')]({'where':{'ChanSpyId':_0x2ed96f['id']}})[_0x9818('0x1e')](function(){return getChanSpyPromise(_0x2ae64a,_0x2ed96f);})[_0x9818('0x1e')](function(_0x3bc107){if(_0x3bc107&&_0x3bc107[_0x9818('0x16')]){return _0x2ae64a[_0x9818('0x1f')]['bulkCreate'](_0x3bc107);}})[_0x9818('0x1e')](function(){_0xd6a317();})[_0x9818('0x21')](function(_0x34fe33){_0xd6a317(_0x34fe33);});},'afterDestroy':function(_0x56d2c7,_0xa53b41,_0x8f8215){return _0x2ae64a['VoiceExtension'][_0x9818('0x22')]({'where':{'ChanSpyId':_0x56d2c7['id']}})[_0x9818('0x1e')](function(){_0x8f8215();})['catch'](function(_0x51df20){_0x8f8215(_0x51df20);});}}});}; \ No newline at end of file +var _0x7264=['chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','password','SIP/%s,%s','name','options','record','length','concat','internal','findAll','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','util','./voiceChanSpy.attributes','context','format','%s%s','prefix','Set','CDR(type)=%s'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x7264,0x184));var _0x4726=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7264[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x4726('0x0'));var BPromise=require('bluebird');var attributes=require(_0x4726('0x1'));var getUserApplications=function(_0x4879db,_0x510e3a,_0x504237){var _0x413226=0x1;var _0x39b752=[];var _0x2693c6={'context':_0x510e3a[_0x4726('0x2')]||'from-sip','exten':util[_0x4726('0x3')](_0x4726('0x4'),_0x4879db[_0x4726('0x5')],_0x504237),'type':'system','isApp':![],'ChanSpyId':_0x4879db['id'],'UserId':_0x510e3a['id']};_0x39b752['push'](_['merge']({'app':_0x4726('0x6'),'appdata':util[_0x4726('0x3')](_0x4726('0x7'),_0x4726('0x8')),'priority':_0x413226++},_0x2693c6));if(_0x4879db['record']){_0x39b752['push'](_[_0x4726('0x9')]({'app':_0x4726('0xa'),'appdata':util[_0x4726('0x3')](_0x4726('0xb'),_0x4879db[_0x4726('0xc')]),'priority':_0x413226++},_0x2693c6));}if(_0x4879db[_0x4726('0xd')]){_0x39b752[_0x4726('0xe')](_[_0x4726('0x9')]({'app':'Authenticate','appdata':_0x4879db[_0x4726('0xf')],'priority':_0x413226++},_0x2693c6));}_0x39b752[_0x4726('0xe')](_['merge']({'app':'ChanSpy','appdata':util[_0x4726('0x3')](_0x4726('0x10'),_0x510e3a[_0x4726('0x11')],_0x4879db[_0x4726('0x12')]?_0x4879db['options']['join'](''):''),'priority':_0x413226++},_0x2693c6));if(_0x4879db[_0x4726('0x13')]){_0x39b752[_0x4726('0xe')](_[_0x4726('0x9')]({'app':'StopMixMonitor','priority':_0x413226++},_0x2693c6));}return _0x39b752;};var getChanSpyApplications=function(_0x207a90,_0xf7b095){var _0x13d385=[];for(var _0x3e0c39=0x0,_0x2db870=0x1;_0x3e0c39<_0xf7b095[_0x4726('0x14')];_0x3e0c39++,_0x2db870=0x1){_0x13d385=_0x13d385[_0x4726('0x15')](getUserApplications(_0x207a90,_0xf7b095[_0x3e0c39],_0xf7b095[_0x3e0c39][_0x4726('0x16')]));if(_0xf7b095[_0x3e0c39][_0x4726('0x16')]!=_0xf7b095[_0x3e0c39][_0x4726('0x11')]){_0x13d385=_0x13d385[_0x4726('0x15')](getUserApplications(_0x207a90,_0xf7b095[_0x3e0c39],_0xf7b095[_0x3e0c39][_0x4726('0x11')]));}}return _0x13d385;};var getChanSpyPromise=function(_0x575bfc,_0x2f0df7){return new BPromise(function(_0x274b2b,_0x25b1cc){return _0x575bfc['User'][_0x4726('0x17')]({'attributes':['id',_0x4726('0x11'),'internal'],'where':{'role':_0x4726('0x18'),'chanspy':!![]},'raw':!![]})[_0x4726('0x19')](function(_0x2852d7){if(_0x2852d7){return _0x274b2b(getChanSpyApplications(_0x2f0df7,_0x2852d7));}return _0x274b2b([]);})[_0x4726('0x1a')](function(_0x479b91){_0x25b1cc(_0x479b91);});});};module[_0x4726('0x1b')]=function(_0x5d0aa5,_0x261f0b){var _0x3f67bd=_0x5d0aa5['models'];return _0x5d0aa5['define'](_0x4726('0x1c'),attributes,{'tableName':_0x4726('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d547,_0x5a2cb2,_0x89e8c3){return getChanSpyPromise(_0x3f67bd,_0x22d547)[_0x4726('0x19')](function(_0xba1e58){if(_0xba1e58&&_0xba1e58[_0x4726('0x14')]){return _0x3f67bd[_0x4726('0x1e')]['bulkCreate'](_0xba1e58);}})[_0x4726('0x19')](function(){_0x89e8c3();})[_0x4726('0x1a')](function(_0x3760ea){_0x89e8c3(_0x3760ea);});},'afterUpdate':function(_0x5ec115,_0x59bcaf,_0xd03312){return _0x3f67bd[_0x4726('0x1e')][_0x4726('0x1f')]({'where':{'ChanSpyId':_0x5ec115['id']}})['then'](function(){return getChanSpyPromise(_0x3f67bd,_0x5ec115);})[_0x4726('0x19')](function(_0x14de85){if(_0x14de85&&_0x14de85[_0x4726('0x14')]){return _0x3f67bd[_0x4726('0x1e')][_0x4726('0x20')](_0x14de85);}})[_0x4726('0x19')](function(){_0xd03312();})[_0x4726('0x1a')](function(_0x37c04f){_0xd03312(_0x37c04f);});},'afterDestroy':function(_0x40d44d,_0x48fac0,_0x48262d){return _0x3f67bd['VoiceExtension'][_0x4726('0x1f')]({'where':{'ChanSpyId':_0x40d44d['id']}})[_0x4726('0x19')](function(){_0x48262d();})[_0x4726('0x1a')](function(_0xea5836){_0x48262d(_0xea5836);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 133063a..992ef43 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 _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1a59a9,_0x10fd87){var _0xd9ae3e=function(_0x40593a){while(--_0x40593a){_0x1a59a9['push'](_0x1a59a9['shift']());}};_0xd9ae3e(++_0x10fd87);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x26204d,_0x3e3e59){_0x26204d=_0x26204d-0x0;var _0x13721d=_0x1d2d[_0x26204d];return _0x13721d;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file +var _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x39478e,_0x5a6480){var _0x4bf5f7=function(_0x223bde){while(--_0x223bde){_0x39478e['push'](_0x39478e['shift']());}};_0x4bf5f7(++_0x5a6480);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5dfb570..c045a99 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 _0x4a61=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x353b8d,_0x4dbb46){var _0x50d4c5=function(_0x45f1b8){while(--_0x45f1b8){_0x353b8d['push'](_0x353b8d['shift']());}};_0x50d4c5(++_0x4dbb46);}(_0x4a61,0x12e));var _0x14a6=function(_0x576d40,_0x5ebebd){_0x576d40=_0x576d40-0x0;var _0x5c2cb2=_0x4a61[_0x576d40];return _0x5c2cb2;};'use strict';var multer=require(_0x14a6('0x0'));var util=require('util');var path=require(_0x14a6('0x1'));var timeout=require(_0x14a6('0x2'));var express=require(_0x14a6('0x3'));var router=express[_0x14a6('0x4')]();var fs_extra=require(_0x14a6('0x5'));var auth=require(_0x14a6('0x6'));var interaction=require(_0x14a6('0x7'));var config=require(_0x14a6('0x8'));var controller=require(_0x14a6('0x9'));router[_0x14a6('0xa')]('/',auth['isAuthenticated'](),controller[_0x14a6('0xb')]);router[_0x14a6('0xa')](_0x14a6('0xc'),auth[_0x14a6('0xd')](),controller[_0x14a6('0xe')]);router[_0x14a6('0xf')]('/',auth[_0x14a6('0xd')](),controller[_0x14a6('0x10')]);router[_0x14a6('0x11')](_0x14a6('0xc'),auth[_0x14a6('0xd')](),controller[_0x14a6('0x12')]);router[_0x14a6('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x14a6('0x14')]);module[_0x14a6('0x15')]=router; \ No newline at end of file +var _0x6c4c=['show','post','put','delete','/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1adfb8,_0x18b379){var _0xb34db=function(_0x299b13){while(--_0x299b13){_0x1adfb8['push'](_0x1adfb8['shift']());}};_0xb34db(++_0x18b379);}(_0x6c4c,0x8d));var _0xc6c4=function(_0x376ac8,_0x3990eb){_0x376ac8=_0x376ac8-0x0;var _0x51463d=_0x6c4c[_0x376ac8];return _0x51463d;};'use strict';var multer=require(_0xc6c4('0x0'));var util=require(_0xc6c4('0x1'));var path=require('path');var timeout=require(_0xc6c4('0x2'));var express=require(_0xc6c4('0x3'));var router=express[_0xc6c4('0x4')]();var fs_extra=require(_0xc6c4('0x5'));var auth=require(_0xc6c4('0x6'));var interaction=require(_0xc6c4('0x7'));var config=require(_0xc6c4('0x8'));var controller=require('./voiceContext.controller');router[_0xc6c4('0x9')]('/',auth[_0xc6c4('0xa')](),controller[_0xc6c4('0xb')]);router[_0xc6c4('0x9')]('/:id',auth[_0xc6c4('0xa')](),controller[_0xc6c4('0xc')]);router[_0xc6c4('0xd')]('/',auth[_0xc6c4('0xa')](),controller['create']);router[_0xc6c4('0xe')]('/:id',auth[_0xc6c4('0xa')](),controller['update']);router[_0xc6c4('0xf')](_0xc6c4('0x10'),auth[_0xc6c4('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 22dde4d..67383ff 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 _0xd78d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x456a55,_0x8a89cf){var _0x5e29ef=function(_0x13de76){while(--_0x13de76){_0x456a55['push'](_0x456a55['shift']());}};_0x5e29ef(++_0x8a89cf);}(_0xd78d,0x126));var _0xdd78=function(_0x97a19f,_0x438890){_0x97a19f=_0x97a19f-0x0;var _0x586e24=_0xd78d[_0x97a19f];return _0x586e24;};'use strict';var Sequelize=require(_0xdd78('0x0'));module[_0xdd78('0x1')]={'name':{'type':Sequelize[_0xdd78('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdd78('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9dcc=['STRING','name','BOOLEAN','exports'];(function(_0x4adf3a,_0x5f41e2){var _0x24dd3f=function(_0x2b5d16){while(--_0x2b5d16){_0x4adf3a['push'](_0x4adf3a['shift']());}};_0x24dd3f(++_0x5f41e2);}(_0x9dcc,0x103));var _0xc9dc=function(_0xef8609,_0x14520e){_0xef8609=_0xef8609-0x0;var _0x3941fa=_0x9dcc[_0xef8609];return _0x3941fa;};'use strict';var Sequelize=require('sequelize');module[_0xc9dc('0x0')]={'name':{'type':Sequelize[_0xc9dc('0x1')],'unique':_0xc9dc('0x2')},'description':{'type':Sequelize[_0xc9dc('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc9dc('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 828970c..2384eec 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 _0x1ca3=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceContext','includeAll','findAll','rows','show','include','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ca3,0x6e));var _0x31ca=function(_0x4200df,_0x4ae800){_0x4200df=_0x4200df-0x0;var _0x549a42=_0x1ca3[_0x4200df];return _0x549a42;};'use strict';var emlformat=require(_0x31ca('0x0'));var rimraf=require(_0x31ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x31ca('0x2'));var moment=require(_0x31ca('0x3'));var BPromise=require(_0x31ca('0x4'));var Mustache=require(_0x31ca('0x5'));var util=require(_0x31ca('0x6'));var path=require('path');var sox=require(_0x31ca('0x7'));var csv=require(_0x31ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31ca('0x9'));var squel=require(_0x31ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x31ca('0xb'));var deskjs=require(_0x31ca('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x31ca('0xd'));var Redis=require(_0x31ca('0xe'));var authService=require(_0x31ca('0xf'));var qs=require(_0x31ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31ca('0x11'));var logger=require(_0x31ca('0x12'))(_0x31ca('0x13'));var utils=require(_0x31ca('0x14'));var config=require(_0x31ca('0x15'));var licenseUtil=require(_0x31ca('0x16'));var db=require(_0x31ca('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x31ca('0x18')][_0x31ca('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xa932a5,_0x19b539,_0x521535,_0x3fbc55){return new BPromise(function(_0x3c2165,_0x3d9d0c){var _0x21deeb=_0x3fbc55||client;return _0x21deeb[_0x31ca('0x1a')](_0xa932a5,_0x521535)[_0x31ca('0x1b')](function(_0x145dff){logger[_0x31ca('0x1c')](_0x31ca('0x1d'),_0x19b539,_0x31ca('0x1e'));logger[_0x31ca('0x1f')](_0x31ca('0x20'),_0x19b539,_0x31ca('0x1e'),JSON[_0x31ca('0x21')](_0x145dff));if(_0x145dff[_0x31ca('0x22')]){if(_0x145dff[_0x31ca('0x22')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x19b539,_0x145dff[_0x31ca('0x22')]['message']);return _0x3d9d0c(_0x145dff['error'][_0x31ca('0x23')]);}logger[_0x31ca('0x22')]('VoiceContext,\x20%s,\x20%s',_0x19b539,_0x145dff['error'][_0x31ca('0x23')]);return _0x3c2165(_0x145dff[_0x31ca('0x22')][_0x31ca('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x19b539,'request\x20sent');_0x3c2165(_0x145dff[_0x31ca('0x24')][_0x31ca('0x23')]);}})[_0x31ca('0x25')](function(_0x4d9a20){logger[_0x31ca('0x22')](_0x31ca('0x1d'),_0x19b539,_0x4d9a20);_0x3d9d0c(_0x4d9a20);});});}function respondWithStatusCode(_0x5ae6b3,_0x8ddb){_0x8ddb=_0x8ddb||0xcc;return function(_0x2721b6){if(_0x2721b6){return _0x5ae6b3[_0x31ca('0x26')](_0x8ddb);}return _0x5ae6b3[_0x31ca('0x27')](_0x8ddb)[_0x31ca('0x28')]();};}function respondWithResult(_0x285fd9,_0x4a97c3){_0x4a97c3=_0x4a97c3||0xc8;return function(_0x4f38a1){if(_0x4f38a1){return _0x285fd9['status'](_0x4a97c3)[_0x31ca('0x29')](_0x4f38a1);}};}function respondWithFilteredResult(_0x26a568,_0x13af55){return function(_0x460151){if(_0x460151){var _0x5a0348=typeof _0x13af55['offset']===_0x31ca('0x2a')&&typeof _0x13af55[_0x31ca('0x2b')]===_0x31ca('0x2a');var _0x14224d=_0x460151[_0x31ca('0x2c')];var _0x508892=_0x5a0348?0x0:_0x13af55[_0x31ca('0x2d')];var _0x410567=_0x5a0348?_0x460151[_0x31ca('0x2c')]:_0x13af55['offset']+_0x13af55[_0x31ca('0x2b')];var _0x1f130c;if(_0x410567>=_0x14224d){_0x410567=_0x14224d;_0x1f130c=0xc8;}else{_0x1f130c=0xce;}_0x26a568[_0x31ca('0x27')](_0x1f130c);return _0x26a568[_0x31ca('0x2e')](_0x31ca('0x2f'),_0x508892+'-'+_0x410567+'/'+_0x14224d)[_0x31ca('0x29')](_0x460151);}return null;};}function patchUpdates(_0x291465){return function(_0x34daf3){try{jsonpatch[_0x31ca('0x30')](_0x34daf3,_0x291465,!![]);}catch(_0x20ecc7){return BPromise['reject'](_0x20ecc7);}return _0x34daf3[_0x31ca('0x31')]();};}function saveUpdates(_0x3b4a2e,_0x1e7539){return function(_0x5d8425){if(_0x5d8425){return _0x5d8425[_0x31ca('0x32')](_0x3b4a2e)[_0x31ca('0x1b')](function(_0x16ecec){return _0x16ecec;});}return null;};}function removeEntity(_0x15ebb5,_0x1e3291){return function(_0xf38d57){if(_0xf38d57){return _0xf38d57['destroy']()['then'](function(){var _0xd1769a=_0xf38d57[_0x31ca('0x33')]({'plain':!![]});var _0x52c994=_0x31ca('0x34');return db[_0x31ca('0x35')][_0x31ca('0x36')]({'where':{'type':_0x52c994,'resourceId':_0xd1769a['id']}})[_0x31ca('0x1b')](function(){return _0xf38d57;});})[_0x31ca('0x1b')](function(){_0x15ebb5[_0x31ca('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e2ce,_0x407d56){return function(_0x31275c){if(!_0x31275c){_0x14e2ce['sendStatus'](0x194);}return _0x31275c;};}function handleError(_0x36e8ad,_0x25aacb){_0x25aacb=_0x25aacb||0x1f4;return function(_0x292c8e){logger[_0x31ca('0x22')](_0x292c8e[_0x31ca('0x37')]);if(_0x292c8e[_0x31ca('0x38')]){delete _0x292c8e[_0x31ca('0x38')];}_0x36e8ad[_0x31ca('0x27')](_0x25aacb)[_0x31ca('0x39')](_0x292c8e);};}exports['index']=function(_0xa50f06,_0x22450c){var _0x211b52={},_0x582f30={},_0x4b9f63={'count':0x0,'rows':[]};var _0x32dacf=_['map'](db['VoiceContext'][_0x31ca('0x3a')],function(_0x11b92d){return{'name':_0x11b92d[_0x31ca('0x3b')],'type':_0x11b92d[_0x31ca('0x3c')][_0x31ca('0x3d')]};});_0x582f30['model']=_[_0x31ca('0x3e')](_0x32dacf,_0x31ca('0x38'));_0x582f30['query']=_[_0x31ca('0x3f')](_0xa50f06[_0x31ca('0x40')]);_0x582f30[_0x31ca('0x41')]=_[_0x31ca('0x42')](_0x582f30['model'],_0x582f30[_0x31ca('0x40')]);_0x211b52[_0x31ca('0x43')]=_[_0x31ca('0x42')](_0x582f30[_0x31ca('0x44')],qs[_0x31ca('0x45')](_0xa50f06[_0x31ca('0x40')]['fields']));_0x211b52['attributes']=_0x211b52[_0x31ca('0x43')][_0x31ca('0x46')]?_0x211b52[_0x31ca('0x43')]:_0x582f30[_0x31ca('0x44')];if(!_0xa50f06['query'][_0x31ca('0x47')](_0x31ca('0x48'))){_0x211b52[_0x31ca('0x2b')]=qs[_0x31ca('0x2b')](_0xa50f06['query'][_0x31ca('0x2b')]);_0x211b52[_0x31ca('0x2d')]=qs['offset'](_0xa50f06[_0x31ca('0x40')]['offset']);}_0x211b52[_0x31ca('0x49')]=qs['sort'](_0xa50f06[_0x31ca('0x40')][_0x31ca('0x4a')]);_0x211b52[_0x31ca('0x4b')]=qs['filters'](_[_0x31ca('0x4c')](_0xa50f06[_0x31ca('0x40')],_0x582f30[_0x31ca('0x41')]),_0x32dacf);if(_0xa50f06[_0x31ca('0x40')][_0x31ca('0x4d')]){_0x211b52[_0x31ca('0x4b')]=_[_0x31ca('0x4e')](_0x211b52[_0x31ca('0x4b')],{'$or':_['map'](_0x32dacf,function(_0x5b83ac){if(_0x5b83ac[_0x31ca('0x3c')]!=='VIRTUAL'){var _0xd43722={};_0xd43722[_0x5b83ac[_0x31ca('0x38')]]={'$like':'%'+_0xa50f06[_0x31ca('0x40')][_0x31ca('0x4d')]+'%'};return _0xd43722;}})});}_0x211b52=_[_0x31ca('0x4e')]({},_0x211b52,_0xa50f06[_0x31ca('0x4f')]);var _0x4a9830={'where':_0x211b52['where']};return db[_0x31ca('0x50')][_0x31ca('0x2c')](_0x4a9830)[_0x31ca('0x1b')](function(_0x408065){_0x4b9f63[_0x31ca('0x2c')]=_0x408065;if(_0xa50f06['query'][_0x31ca('0x51')]){_0x211b52['include']=[{'all':!![]}];}return db['VoiceContext'][_0x31ca('0x52')](_0x211b52);})[_0x31ca('0x1b')](function(_0x4365dd){_0x4b9f63[_0x31ca('0x53')]=_0x4365dd;return _0x4b9f63;})[_0x31ca('0x1b')](respondWithFilteredResult(_0x22450c,_0x211b52))[_0x31ca('0x25')](handleError(_0x22450c,null));};exports[_0x31ca('0x54')]=function(_0x4a8fcc,_0x48f12b){var _0x103c89={'raw':![],'where':{'id':_0x4a8fcc['params']['id']}},_0x4766c8={};_0x4766c8['model']=_[_0x31ca('0x3f')](db[_0x31ca('0x50')][_0x31ca('0x3a')]);_0x4766c8[_0x31ca('0x40')]=_['keys'](_0x4a8fcc[_0x31ca('0x40')]);_0x4766c8['filters']=_[_0x31ca('0x42')](_0x4766c8[_0x31ca('0x44')],_0x4766c8[_0x31ca('0x40')]);_0x103c89[_0x31ca('0x43')]=_[_0x31ca('0x42')](_0x4766c8[_0x31ca('0x44')],qs['fields'](_0x4a8fcc[_0x31ca('0x40')][_0x31ca('0x45')]));_0x103c89[_0x31ca('0x43')]=_0x103c89[_0x31ca('0x43')][_0x31ca('0x46')]?_0x103c89['attributes']:_0x4766c8['model'];if(_0x4a8fcc[_0x31ca('0x40')]['includeAll']){_0x103c89[_0x31ca('0x55')]=[{'all':!![]}];}_0x103c89=_[_0x31ca('0x4e')]({},_0x103c89,_0x4a8fcc[_0x31ca('0x4f')]);return db[_0x31ca('0x50')]['find'](_0x103c89)[_0x31ca('0x1b')](handleEntityNotFound(_0x48f12b,null))[_0x31ca('0x1b')](respondWithResult(_0x48f12b,null))[_0x31ca('0x25')](handleError(_0x48f12b,null));};exports[_0x31ca('0x56')]=function(_0x5da767,_0x5b1ea2,_0x229f46){var _0x212002;return db[_0x31ca('0x50')][_0x31ca('0x56')](_0x5da767[_0x31ca('0x57')],{'raw':!![]})[_0x31ca('0x1b')](function(_0x2ca1de){_0x212002=_0x2ca1de;return db[_0x31ca('0x50')][_0x31ca('0x52')]({'raw':!![]});})[_0x31ca('0x1b')](function(_0x5538e1){var _0x1980de=fs[_0x31ca('0x58')](path[_0x31ca('0x59')](config[_0x31ca('0x5a')],_0x31ca('0x5b')),_0x31ca('0x5c'));var _0x4b2601=ejs[_0x31ca('0x5d')](_0x1980de,{'contexts':_0x5538e1||[]});fs[_0x31ca('0x5e')](_0x31ca('0x5f'),_0x4b2601);})['then'](function(){return respondWithRpcPromise(_0x31ca('0x60'),_0x31ca('0x56'),{'module':_0x31ca('0x61')});})[_0x31ca('0x1b')](function(){var _0x474d5a=_0x5da767['user']['get']({'plain':!![]});if(!_0x474d5a)throw new Error(_0x31ca('0x62'));if(_0x474d5a['role']===_0x31ca('0x63')){var _0x3472f3=_0x212002[_0x31ca('0x33')]({'plain':!![]});return db[_0x31ca('0x64')][_0x31ca('0x65')]({'where':{'name':_0x31ca('0x34'),'userProfileId':_0x474d5a[_0x31ca('0x66')]},'raw':!![]})['then'](function(_0x264fdd){if(_0x264fdd&&_0x264fdd[_0x31ca('0x67')]===0x0){return db[_0x31ca('0x35')][_0x31ca('0x56')]({'name':_0x3472f3[_0x31ca('0x38')],'resourceId':_0x3472f3['id'],'type':_0x264fdd['name'],'sectionId':_0x264fdd['id']},{})[_0x31ca('0x1b')](function(){return _0x212002;});}else{return _0x212002;}})[_0x31ca('0x25')](function(_0x3ddfa4){logger['error'](_0x31ca('0x68'),_0x3ddfa4);throw _0x3ddfa4;});}return _0x212002;})[_0x31ca('0x1b')](respondWithResult(_0x5b1ea2,0xc9))[_0x31ca('0x25')](handleError(_0x5b1ea2,null));};exports[_0x31ca('0x32')]=function(_0x306cdc,_0x45a52f,_0x5b7df0){var _0x477fd9;return db[_0x31ca('0x50')][_0x31ca('0x65')]({'where':{'id':_0x306cdc[_0x31ca('0x69')]['id']}})['then'](handleEntityNotFound(_0x45a52f,null))['then'](saveUpdates(_0x306cdc['body'],null))[_0x31ca('0x1b')](function(_0x2b2d2e){if(_0x2b2d2e){_0x477fd9=_0x2b2d2e;return db[_0x31ca('0x50')][_0x31ca('0x52')]({'raw':!![]});}})['then'](function(_0x42611e){var _0x410712=fs[_0x31ca('0x58')](path[_0x31ca('0x59')](config[_0x31ca('0x5a')],_0x31ca('0x5b')),'utf8');var _0x44f43f=ejs[_0x31ca('0x5d')](_0x410712,{'contexts':_0x42611e||[]});fs[_0x31ca('0x5e')](_0x31ca('0x5f'),_0x44f43f);})[_0x31ca('0x1b')](function(){return respondWithRpcPromise(_0x31ca('0x60'),_0x31ca('0x32'),{'module':_0x31ca('0x61')});})[_0x31ca('0x1b')](function(){return _0x477fd9;})[_0x31ca('0x1b')](respondWithResult(_0x45a52f,null))[_0x31ca('0x25')](handleError(_0x45a52f,null));};exports[_0x31ca('0x36')]=function(_0x1469aa,_0x5a30be,_0x276251){var _0x40c1eb;return db[_0x31ca('0x50')]['find']({'where':{'id':_0x1469aa['params']['id']}})[_0x31ca('0x1b')](handleEntityNotFound(_0x5a30be,null))[_0x31ca('0x1b')](removeEntity(_0x5a30be,null))[_0x31ca('0x1b')](function(){return db[_0x31ca('0x50')][_0x31ca('0x52')]({'raw':!![]});})['then'](function(_0x50c8ce){var _0x26b166=fs[_0x31ca('0x58')](path[_0x31ca('0x59')](config[_0x31ca('0x5a')],_0x31ca('0x5b')),_0x31ca('0x5c'));var _0x42fb94=ejs[_0x31ca('0x5d')](_0x26b166,{'contexts':_0x50c8ce});fs[_0x31ca('0x5e')](_0x31ca('0x5f'),_0x42fb94);return respondWithRpcPromise('Reload',_0x31ca('0x36'),{'module':'chan_sip.so'});})[_0x31ca('0x25')](handleError(_0x5a30be,null));}; \ No newline at end of file +var _0x190d=['destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','length','include','options','find','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','writeFileSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x190d,0x1df));var _0xd190=function(_0x1751b3,_0x20798b){_0x1751b3=_0x1751b3-0x0;var _0x1090e5=_0x190d[_0x1751b3];return _0x1090e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd190('0x0'));var zipdir=require(_0xd190('0x1'));var jsonpatch=require(_0xd190('0x2'));var rp=require(_0xd190('0x3'));var moment=require(_0xd190('0x4'));var BPromise=require(_0xd190('0x5'));var Mustache=require('mustache');var util=require(_0xd190('0x6'));var path=require(_0xd190('0x7'));var sox=require('sox');var csv=require(_0xd190('0x8'));var ejs=require(_0xd190('0x9'));var fs=require('fs');var fs_extra=require(_0xd190('0xa'));var _=require(_0xd190('0xb'));var squel=require(_0xd190('0xc'));var crypto=require(_0xd190('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd190('0xe'));var toCsv=require(_0xd190('0x8'));var querystring=require(_0xd190('0xf'));var Papa=require(_0xd190('0x10'));var Redis=require(_0xd190('0x11'));var authService=require(_0xd190('0x12'));var qs=require(_0xd190('0x13'));var as=require(_0xd190('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd190('0x15'))(_0xd190('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd190('0x17'));var db=require(_0xd190('0x18'))['db'];var jayson=require(_0xd190('0x19'));var client=jayson[_0xd190('0x1a')][_0xd190('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xaeeb8d,_0x3fe387,_0x546f34,_0x3c326d){return new BPromise(function(_0x2ac5e1,_0x5a7350){var _0x3de556=_0x3c326d||client;return _0x3de556[_0xd190('0x1c')](_0xaeeb8d,_0x546f34)[_0xd190('0x1d')](function(_0x361a25){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3fe387,_0xd190('0x1e'));logger[_0xd190('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3fe387,'request\x20sent',JSON[_0xd190('0x20')](_0x361a25));if(_0x361a25[_0xd190('0x21')]){if(_0x361a25['error'][_0xd190('0x22')]===0x1f4){logger[_0xd190('0x21')]('VoiceContext,\x20%s,\x20%s',_0x3fe387,_0x361a25[_0xd190('0x21')][_0xd190('0x23')]);return _0x5a7350(_0x361a25[_0xd190('0x21')][_0xd190('0x23')]);}logger[_0xd190('0x21')](_0xd190('0x24'),_0x3fe387,_0x361a25[_0xd190('0x21')][_0xd190('0x23')]);return _0x2ac5e1(_0x361a25['error'][_0xd190('0x23')]);}else{logger[_0xd190('0x25')](_0xd190('0x24'),_0x3fe387,_0xd190('0x1e'));_0x2ac5e1(_0x361a25['result'][_0xd190('0x23')]);}})[_0xd190('0x26')](function(_0x299dd2){logger[_0xd190('0x21')](_0xd190('0x24'),_0x3fe387,_0x299dd2);_0x5a7350(_0x299dd2);});});}function respondWithStatusCode(_0x54f538,_0x566425){_0x566425=_0x566425||0xcc;return function(_0x6ba2ef){if(_0x6ba2ef){return _0x54f538[_0xd190('0x27')](_0x566425);}return _0x54f538[_0xd190('0x28')](_0x566425)[_0xd190('0x29')]();};}function respondWithResult(_0x1891dc,_0x296d04){_0x296d04=_0x296d04||0xc8;return function(_0x392a7f){if(_0x392a7f){return _0x1891dc[_0xd190('0x28')](_0x296d04)[_0xd190('0x2a')](_0x392a7f);}};}function respondWithFilteredResult(_0xf7c56c,_0x583166){return function(_0x18fd20){if(_0x18fd20){var _0x2a36e0=typeof _0x583166[_0xd190('0x2b')]===_0xd190('0x2c')&&typeof _0x583166['limit']===_0xd190('0x2c');var _0x2e3490=_0x18fd20[_0xd190('0x2d')];var _0x17c269=_0x2a36e0?0x0:_0x583166[_0xd190('0x2b')];var _0x3a4983=_0x2a36e0?_0x18fd20['count']:_0x583166[_0xd190('0x2b')]+_0x583166[_0xd190('0x2e')];var _0xea891b;if(_0x3a4983>=_0x2e3490){_0x3a4983=_0x2e3490;_0xea891b=0xc8;}else{_0xea891b=0xce;}_0xf7c56c[_0xd190('0x28')](_0xea891b);return _0xf7c56c[_0xd190('0x2f')]('Content-Range',_0x17c269+'-'+_0x3a4983+'/'+_0x2e3490)[_0xd190('0x2a')](_0x18fd20);}return null;};}function patchUpdates(_0x180692){return function(_0x122d11){try{jsonpatch[_0xd190('0x30')](_0x122d11,_0x180692,!![]);}catch(_0x2e7733){return BPromise['reject'](_0x2e7733);}return _0x122d11[_0xd190('0x31')]();};}function saveUpdates(_0x4910f2,_0x26d0c4){return function(_0x1f0379){if(_0x1f0379){return _0x1f0379[_0xd190('0x32')](_0x4910f2)[_0xd190('0x1d')](function(_0x4857ec){return _0x4857ec;});}return null;};}function removeEntity(_0x3b165e,_0xc4771b){return function(_0x36b3ff){if(_0x36b3ff){return _0x36b3ff[_0xd190('0x33')]()[_0xd190('0x1d')](function(){var _0x80923e=_0x36b3ff['get']({'plain':!![]});var _0x30a3ce=_0xd190('0x34');return db[_0xd190('0x35')][_0xd190('0x33')]({'where':{'type':_0x30a3ce,'resourceId':_0x80923e['id']}})[_0xd190('0x1d')](function(){return _0x36b3ff;});})[_0xd190('0x1d')](function(){_0x3b165e[_0xd190('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9bc0ec,_0x334436){return function(_0x545ed7){if(!_0x545ed7){_0x9bc0ec['sendStatus'](0x194);}return _0x545ed7;};}function handleError(_0x1c5ac1,_0x1cbee5){_0x1cbee5=_0x1cbee5||0x1f4;return function(_0x27f400){logger['error'](_0x27f400[_0xd190('0x36')]);if(_0x27f400[_0xd190('0x37')]){delete _0x27f400[_0xd190('0x37')];}_0x1c5ac1[_0xd190('0x28')](_0x1cbee5)[_0xd190('0x38')](_0x27f400);};}exports[_0xd190('0x39')]=function(_0x5d78df,_0x464261){var _0x529134={},_0x38bbbe={},_0x3732a2={'count':0x0,'rows':[]};var _0x36ff2c=_[_0xd190('0x3a')](db[_0xd190('0x3b')][_0xd190('0x3c')],function(_0x2e0e08){return{'name':_0x2e0e08[_0xd190('0x3d')],'type':_0x2e0e08[_0xd190('0x3e')][_0xd190('0x3f')]};});_0x38bbbe[_0xd190('0x40')]=_[_0xd190('0x3a')](_0x36ff2c,_0xd190('0x37'));_0x38bbbe[_0xd190('0x41')]=_['keys'](_0x5d78df['query']);_0x38bbbe[_0xd190('0x42')]=_['intersection'](_0x38bbbe['model'],_0x38bbbe[_0xd190('0x41')]);_0x529134[_0xd190('0x43')]=_[_0xd190('0x44')](_0x38bbbe[_0xd190('0x40')],qs[_0xd190('0x45')](_0x5d78df[_0xd190('0x41')][_0xd190('0x45')]));_0x529134[_0xd190('0x43')]=_0x529134['attributes']['length']?_0x529134['attributes']:_0x38bbbe[_0xd190('0x40')];if(!_0x5d78df[_0xd190('0x41')][_0xd190('0x46')]('nolimit')){_0x529134[_0xd190('0x2e')]=qs[_0xd190('0x2e')](_0x5d78df[_0xd190('0x41')][_0xd190('0x2e')]);_0x529134[_0xd190('0x2b')]=qs[_0xd190('0x2b')](_0x5d78df[_0xd190('0x41')][_0xd190('0x2b')]);}_0x529134[_0xd190('0x47')]=qs[_0xd190('0x48')](_0x5d78df[_0xd190('0x41')][_0xd190('0x48')]);_0x529134[_0xd190('0x49')]=qs['filters'](_[_0xd190('0x4a')](_0x5d78df[_0xd190('0x41')],_0x38bbbe[_0xd190('0x42')]),_0x36ff2c);if(_0x5d78df[_0xd190('0x41')][_0xd190('0x4b')]){_0x529134[_0xd190('0x49')]=_[_0xd190('0x4c')](_0x529134[_0xd190('0x49')],{'$or':_[_0xd190('0x3a')](_0x36ff2c,function(_0x374283){if(_0x374283[_0xd190('0x3e')]!==_0xd190('0x4d')){var _0x2bef5e={};_0x2bef5e[_0x374283[_0xd190('0x37')]]={'$like':'%'+_0x5d78df[_0xd190('0x41')][_0xd190('0x4b')]+'%'};return _0x2bef5e;}})});}_0x529134=_[_0xd190('0x4c')]({},_0x529134,_0x5d78df['options']);var _0x55ada0={'where':_0x529134[_0xd190('0x49')]};return db[_0xd190('0x3b')][_0xd190('0x2d')](_0x55ada0)[_0xd190('0x1d')](function(_0x185425){_0x3732a2[_0xd190('0x2d')]=_0x185425;if(_0x5d78df[_0xd190('0x41')][_0xd190('0x4e')]){_0x529134['include']=[{'all':!![]}];}return db[_0xd190('0x3b')][_0xd190('0x4f')](_0x529134);})[_0xd190('0x1d')](function(_0x506fbc){_0x3732a2[_0xd190('0x50')]=_0x506fbc;return _0x3732a2;})[_0xd190('0x1d')](respondWithFilteredResult(_0x464261,_0x529134))['catch'](handleError(_0x464261,null));};exports[_0xd190('0x51')]=function(_0x26d795,_0x2d65c6){var _0x50fb0e={'raw':![],'where':{'id':_0x26d795[_0xd190('0x52')]['id']}},_0x44f574={};_0x44f574['model']=_[_0xd190('0x53')](db['VoiceContext'][_0xd190('0x3c')]);_0x44f574[_0xd190('0x41')]=_[_0xd190('0x53')](_0x26d795[_0xd190('0x41')]);_0x44f574[_0xd190('0x42')]=_[_0xd190('0x44')](_0x44f574[_0xd190('0x40')],_0x44f574['query']);_0x50fb0e['attributes']=_[_0xd190('0x44')](_0x44f574['model'],qs[_0xd190('0x45')](_0x26d795['query'][_0xd190('0x45')]));_0x50fb0e[_0xd190('0x43')]=_0x50fb0e[_0xd190('0x43')][_0xd190('0x54')]?_0x50fb0e[_0xd190('0x43')]:_0x44f574[_0xd190('0x40')];if(_0x26d795[_0xd190('0x41')][_0xd190('0x4e')]){_0x50fb0e[_0xd190('0x55')]=[{'all':!![]}];}_0x50fb0e=_[_0xd190('0x4c')]({},_0x50fb0e,_0x26d795[_0xd190('0x56')]);return db[_0xd190('0x3b')][_0xd190('0x57')](_0x50fb0e)[_0xd190('0x1d')](handleEntityNotFound(_0x2d65c6,null))['then'](respondWithResult(_0x2d65c6,null))[_0xd190('0x26')](handleError(_0x2d65c6,null));};exports['create']=function(_0x306beb,_0x225778,_0x3d7c53){var _0x3f6fcd;return db[_0xd190('0x3b')]['create'](_0x306beb['body'],{'raw':!![]})[_0xd190('0x1d')](function(_0x5b53ad){_0x3f6fcd=_0x5b53ad;return db[_0xd190('0x3b')][_0xd190('0x4f')]({'raw':!![]});})[_0xd190('0x1d')](function(_0x20083b){var _0xc1d469=fs[_0xd190('0x58')](path[_0xd190('0x59')](config[_0xd190('0x5a')],_0xd190('0x5b')),_0xd190('0x5c'));var _0x13594d=ejs[_0xd190('0x5d')](_0xc1d469,{'contexts':_0x20083b||[]});fs['writeFileSync'](_0xd190('0x5e'),_0x13594d);})[_0xd190('0x1d')](function(){return respondWithRpcPromise(_0xd190('0x5f'),_0xd190('0x60'),{'module':_0xd190('0x61')});})[_0xd190('0x1d')](function(){var _0x3efe1a=_0x306beb['user'][_0xd190('0x62')]({'plain':!![]});if(!_0x3efe1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3efe1a['role']===_0xd190('0x63')){var _0x33505c=_0x3f6fcd[_0xd190('0x62')]({'plain':!![]});return db[_0xd190('0x64')][_0xd190('0x57')]({'where':{'name':_0xd190('0x34'),'userProfileId':_0x3efe1a[_0xd190('0x65')]},'raw':!![]})[_0xd190('0x1d')](function(_0x5abc77){if(_0x5abc77&&_0x5abc77[_0xd190('0x66')]===0x0){return db[_0xd190('0x35')][_0xd190('0x60')]({'name':_0x33505c[_0xd190('0x37')],'resourceId':_0x33505c['id'],'type':_0x5abc77[_0xd190('0x37')],'sectionId':_0x5abc77['id']},{})[_0xd190('0x1d')](function(){return _0x3f6fcd;});}else{return _0x3f6fcd;}})[_0xd190('0x26')](function(_0x4e7e9c){logger[_0xd190('0x21')](_0xd190('0x67'),_0x4e7e9c);throw _0x4e7e9c;});}return _0x3f6fcd;})['then'](respondWithResult(_0x225778,0xc9))[_0xd190('0x26')](handleError(_0x225778,null));};exports['update']=function(_0xfa9d46,_0x2414e7,_0x18c5e4){var _0x1a980a;return db[_0xd190('0x3b')]['find']({'where':{'id':_0xfa9d46['params']['id']}})[_0xd190('0x1d')](handleEntityNotFound(_0x2414e7,null))[_0xd190('0x1d')](saveUpdates(_0xfa9d46[_0xd190('0x68')],null))[_0xd190('0x1d')](function(_0x53f74d){if(_0x53f74d){_0x1a980a=_0x53f74d;return db[_0xd190('0x3b')][_0xd190('0x4f')]({'raw':!![]});}})[_0xd190('0x1d')](function(_0x56ff70){var _0x3ec333=fs[_0xd190('0x58')](path[_0xd190('0x59')](config[_0xd190('0x5a')],_0xd190('0x5b')),_0xd190('0x5c'));var _0x5353ad=ejs[_0xd190('0x5d')](_0x3ec333,{'contexts':_0x56ff70||[]});fs[_0xd190('0x69')](_0xd190('0x5e'),_0x5353ad);})[_0xd190('0x1d')](function(){return respondWithRpcPromise(_0xd190('0x5f'),_0xd190('0x32'),{'module':_0xd190('0x61')});})[_0xd190('0x1d')](function(){return _0x1a980a;})[_0xd190('0x1d')](respondWithResult(_0x2414e7,null))['catch'](handleError(_0x2414e7,null));};exports['destroy']=function(_0x47a43a,_0x3d37fb,_0x6c13b9){var _0x35ad3f;return db['VoiceContext'][_0xd190('0x57')]({'where':{'id':_0x47a43a[_0xd190('0x52')]['id']}})[_0xd190('0x1d')](handleEntityNotFound(_0x3d37fb,null))[_0xd190('0x1d')](removeEntity(_0x3d37fb,null))['then'](function(){return db[_0xd190('0x3b')][_0xd190('0x4f')]({'raw':!![]});})[_0xd190('0x1d')](function(_0x44ff0b){var _0x2838d9=fs[_0xd190('0x58')](path[_0xd190('0x59')](config[_0xd190('0x5a')],'server/files/templates/context.ejs'),_0xd190('0x5c'));var _0x50325e=ejs[_0xd190('0x5d')](_0x2838d9,{'contexts':_0x44ff0b});fs[_0xd190('0x69')](_0xd190('0x5e'),_0x50325e);return respondWithRpcPromise('Reload',_0xd190('0x33'),{'module':_0xd190('0x61')});})[_0xd190('0x26')](handleError(_0x3d37fb,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8165095..d3aa3fe 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 _0xa402=['VoiceContext','voice_contexts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x709665,_0x2596cb){var _0x31ef83=function(_0xc0bcd9){while(--_0xc0bcd9){_0x709665['push'](_0x709665['shift']());}};_0x31ef83(++_0x2596cb);}(_0xa402,0x1ca));var _0x2a40=function(_0x2bf755,_0x4b156b){_0x2bf755=_0x2bf755-0x0;var _0x2e1810=_0xa402[_0x2bf755];return _0x2e1810;};'use strict';var _=require(_0x2a40('0x0'));var util=require(_0x2a40('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a40('0x2'));var rp=require(_0x2a40('0x3'));var fs=require('fs');var path=require(_0x2a40('0x4'));var rimraf=require(_0x2a40('0x5'));var config=require(_0x2a40('0x6'));var attributes=require(_0x2a40('0x7'));module[_0x2a40('0x8')]=function(_0x1a1f74,_0x212cd6){return _0x1a1f74[_0x2a40('0x9')](_0x2a40('0xa'),attributes,{'tableName':_0x2a40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42a1=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2679e5,_0x89a77f){var _0x5e3aed=function(_0x1c6368){while(--_0x1c6368){_0x2679e5['push'](_0x2679e5['shift']());}};_0x5e3aed(++_0x89a77f);}(_0x42a1,0x123));var _0x142a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x42a1[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var logger=require('../../config/logger')(_0x142a('0x2'));var moment=require(_0x142a('0x3'));var BPromise=require(_0x142a('0x4'));var rp=require(_0x142a('0x5'));var fs=require('fs');var path=require(_0x142a('0x6'));var rimraf=require(_0x142a('0x7'));var config=require('../../config/environment');var attributes=require(_0x142a('0x8'));module[_0x142a('0x9')]=function(_0x5606d9,_0x54d983){return _0x5606d9[_0x142a('0xa')](_0x142a('0xb'),attributes,{'tableName':_0x142a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0fe569e..4554e18 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 _0x10d6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x183c76,_0x29f94c){var _0x29108d=function(_0x4b80b2){while(--_0x4b80b2){_0x183c76['push'](_0x183c76['shift']());}};_0x29108d(++_0x29f94c);}(_0x10d6,0x145));var _0x610d=function(_0x3cbbed,_0x25a421){_0x3cbbed=_0x3cbbed-0x0;var _0x51988c=_0x10d6[_0x3cbbed];return _0x51988c;};'use strict';var _=require('lodash');var util=require(_0x610d('0x0'));var moment=require(_0x610d('0x1'));var BPromise=require(_0x610d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x610d('0x3'));var db=require(_0x610d('0x4'))['db'];var utils=require(_0x610d('0x5'));var logger=require(_0x610d('0x6'))(_0x610d('0x7'));var config=require(_0x610d('0x8'));var jayson=require(_0x610d('0x9'));var client=jayson['client'][_0x610d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f748,_0x289610,_0x1c3d9c){return new BPromise(function(_0x510827,_0x38838d){return client[_0x610d('0xb')](_0x19f748,_0x1c3d9c)[_0x610d('0xc')](function(_0x1bc097){logger[_0x610d('0xd')](_0x610d('0xe'),_0x289610,_0x610d('0xf'));logger[_0x610d('0x10')](_0x610d('0x11'),_0x289610,'request\x20sent',JSON[_0x610d('0x12')](_0x1bc097));if(_0x1bc097[_0x610d('0x13')]){if(_0x1bc097['error'][_0x610d('0x14')]===0x1f4){logger[_0x610d('0x13')]('VoiceContext,\x20%s,\x20%s',_0x289610,_0x1bc097[_0x610d('0x13')][_0x610d('0x15')]);return _0x38838d(_0x1bc097[_0x610d('0x13')]['message']);}logger[_0x610d('0x13')](_0x610d('0xe'),_0x289610,_0x1bc097[_0x610d('0x13')]['message']);return _0x510827(_0x1bc097['error']['message']);}else{logger[_0x610d('0xd')](_0x610d('0xe'),_0x289610,_0x610d('0xf'));_0x510827(_0x1bc097['result'][_0x610d('0x15')]);}})['catch'](function(_0x13b023){logger[_0x610d('0x13')](_0x610d('0xe'),_0x289610,_0x13b023);_0x38838d(_0x13b023);});});} \ No newline at end of file +var _0x6623=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x6623,0x189));var _0x3662=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x6623[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0x3662('0x0'));var moment=require(_0x3662('0x1'));var BPromise=require(_0x3662('0x2'));var rs=require(_0x3662('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3662('0x4'));var logger=require(_0x3662('0x5'))(_0x3662('0x6'));var config=require(_0x3662('0x7'));var jayson=require(_0x3662('0x8'));var client=jayson[_0x3662('0x9')][_0x3662('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26dfe2,_0x198271,_0x53e2a1){return new BPromise(function(_0x2bf943,_0x2e7f45){return client[_0x3662('0xb')](_0x26dfe2,_0x53e2a1)[_0x3662('0xc')](function(_0x57e536){logger[_0x3662('0xd')](_0x3662('0xe'),_0x198271,_0x3662('0xf'));logger[_0x3662('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x198271,_0x3662('0xf'),JSON[_0x3662('0x11')](_0x57e536));if(_0x57e536[_0x3662('0x12')]){if(_0x57e536[_0x3662('0x12')][_0x3662('0x13')]===0x1f4){logger['error'](_0x3662('0xe'),_0x198271,_0x57e536[_0x3662('0x12')][_0x3662('0x14')]);return _0x2e7f45(_0x57e536[_0x3662('0x12')][_0x3662('0x14')]);}logger[_0x3662('0x12')](_0x3662('0xe'),_0x198271,_0x57e536[_0x3662('0x12')][_0x3662('0x14')]);return _0x2bf943(_0x57e536[_0x3662('0x12')][_0x3662('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x198271,_0x3662('0xf'));_0x2bf943(_0x57e536['result'][_0x3662('0x14')]);}})[_0x3662('0x15')](function(_0x275e58){logger['error'](_0x3662('0xe'),_0x198271,_0x275e58);_0x2e7f45(_0x275e58);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 95704ce..8dfe958 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 _0x897d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','create','put','/:id','delete','destroy','exports','path','connect-timeout'];(function(_0x407556,_0x2c5062){var _0x3316b5=function(_0x47da4b){while(--_0x47da4b){_0x407556['push'](_0x407556['shift']());}};_0x3316b5(++_0x2c5062);}(_0x897d,0x1ca));var _0xd897=function(_0x1491f5,_0x5d11a6){_0x1491f5=_0x1491f5-0x0;var _0x17da58=_0x897d[_0x1491f5];return _0x17da58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd897('0x0'));var timeout=require(_0xd897('0x1'));var express=require(_0xd897('0x2'));var router=express[_0xd897('0x3')]();var fs_extra=require(_0xd897('0x4'));var auth=require(_0xd897('0x5'));var interaction=require(_0xd897('0x6'));var config=require(_0xd897('0x7'));var controller=require(_0xd897('0x8'));router['get']('/',auth[_0xd897('0x9')](),controller[_0xd897('0xa')]);router[_0xd897('0xb')](_0xd897('0xc'),auth[_0xd897('0x9')](),controller[_0xd897('0xd')]);router[_0xd897('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd897('0x9')](),controller[_0xd897('0xe')]);router[_0xd897('0xf')](_0xd897('0x10'),auth[_0xd897('0x9')](),controller['update']);router[_0xd897('0x11')]('/:id',auth[_0xd897('0x9')](),controller[_0xd897('0x12')]);module[_0xd897('0x13')]=router; \ No newline at end of file +var _0x06d8=['isAuthenticated','describe','/:id','show','post','put','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x185dea,_0x2b9d1c){var _0x2e601a=function(_0x1495fd){while(--_0x1495fd){_0x185dea['push'](_0x185dea['shift']());}};_0x2e601a(++_0x2b9d1c);}(_0x06d8,0xd4));var _0x806d=function(_0x581be7,_0x412f2c){_0x581be7=_0x581be7-0x0;var _0xf2d578=_0x06d8[_0x581be7];return _0xf2d578;};'use strict';var multer=require(_0x806d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x806d('0x1'));var express=require('express');var router=express[_0x806d('0x2')]();var fs_extra=require(_0x806d('0x3'));var auth=require(_0x806d('0x4'));var interaction=require(_0x806d('0x5'));var config=require(_0x806d('0x6'));var controller=require(_0x806d('0x7'));router[_0x806d('0x8')]('/',auth[_0x806d('0x9')](),controller['index']);router[_0x806d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x806d('0xa')]);router[_0x806d('0x8')](_0x806d('0xb'),auth[_0x806d('0x9')](),controller[_0x806d('0xc')]);router[_0x806d('0xd')]('/',auth[_0x806d('0x9')](),controller['create']);router[_0x806d('0xe')](_0x806d('0xb'),auth[_0x806d('0x9')](),controller['update']);router[_0x806d('0xf')](_0x806d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x806d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5526c55..fbae0dc 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3e74,0x175));var _0x43e7=function(_0x453a04,_0x335ad1){_0x453a04=_0x453a04-0x0;var _0xe39696=_0x3e74[_0x453a04];return _0xe39696;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1f4522,_0x20cfbf){var _0x4ba77=function(_0x45f096){while(--_0x45f096){_0x1f4522['push'](_0x1f4522['shift']());}};_0x4ba77(++_0x20cfbf);}(_0x34e8,0x12c));var _0x834e=function(_0x147499,_0x491c7a){_0x147499=_0x147499-0x0;var _0x2693ae=_0x34e8[_0x147499];return _0x2693ae;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b3e05f6..ed439c8 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 _0xf05a=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceDialReport','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0xf05a,0x119));var _0xaf05=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf05a[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xaf05('0x0'));var rimraf=require(_0xaf05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf05('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaf05('0x3'));var Mustache=require(_0xaf05('0x4'));var util=require('util');var path=require(_0xaf05('0x5'));var sox=require(_0xaf05('0x6'));var csv=require(_0xaf05('0x7'));var ejs=require(_0xaf05('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf05('0x9'));var squel=require('squel');var crypto=require(_0xaf05('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaf05('0xb'));var toCsv=require(_0xaf05('0x7'));var querystring=require(_0xaf05('0xc'));var Papa=require(_0xaf05('0xd'));var Redis=require(_0xaf05('0xe'));var authService=require(_0xaf05('0xf'));var qs=require(_0xaf05('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf05('0x11'))(_0xaf05('0x12'));var utils=require(_0xaf05('0x13'));var config=require(_0xaf05('0x14'));var licenseUtil=require(_0xaf05('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419ab0,_0x5b9108){_0x5b9108=_0x5b9108||0xcc;return function(_0x3d78a8){if(_0x3d78a8){return _0x419ab0[_0xaf05('0x16')](_0x5b9108);}return _0x419ab0['status'](_0x5b9108)[_0xaf05('0x17')]();};}function respondWithResult(_0x705b32,_0x284205){_0x284205=_0x284205||0xc8;return function(_0x2c407b){if(_0x2c407b){return _0x705b32[_0xaf05('0x18')](_0x284205)['json'](_0x2c407b);}};}function respondWithFilteredResult(_0x6ee380,_0x507b00){return function(_0x10e257){if(_0x10e257){var _0xf8371f=typeof _0x507b00[_0xaf05('0x19')]==='undefined'&&typeof _0x507b00[_0xaf05('0x1a')]===_0xaf05('0x1b');var _0x5bf033=_0x10e257['count'];var _0x415d92=_0xf8371f?0x0:_0x507b00[_0xaf05('0x19')];var _0x13df89=_0xf8371f?_0x10e257[_0xaf05('0x1c')]:_0x507b00[_0xaf05('0x19')]+_0x507b00[_0xaf05('0x1a')];var _0x5cd681;if(_0x13df89>=_0x5bf033){_0x13df89=_0x5bf033;_0x5cd681=0xc8;}else{_0x5cd681=0xce;}_0x6ee380[_0xaf05('0x18')](_0x5cd681);return _0x6ee380[_0xaf05('0x1d')](_0xaf05('0x1e'),_0x415d92+'-'+_0x13df89+'/'+_0x5bf033)['json'](_0x10e257);}return null;};}function patchUpdates(_0x2b1464){return function(_0x57f822){try{jsonpatch[_0xaf05('0x1f')](_0x57f822,_0x2b1464,!![]);}catch(_0x2e7b7f){return BPromise[_0xaf05('0x20')](_0x2e7b7f);}return _0x57f822[_0xaf05('0x21')]();};}function saveUpdates(_0x2d9fe2,_0x12679b){return function(_0x146324){if(_0x146324){return _0x146324[_0xaf05('0x22')](_0x2d9fe2)[_0xaf05('0x23')](function(_0x512ba7){return _0x512ba7;});}return null;};}function removeEntity(_0x1975d8,_0x2231be){return function(_0x2a2f60){if(_0x2a2f60){return _0x2a2f60[_0xaf05('0x24')]()[_0xaf05('0x23')](function(){_0x1975d8[_0xaf05('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0958,_0x38155f){return function(_0xdc36c1){if(!_0xdc36c1){_0x5e0958[_0xaf05('0x16')](0x194);}return _0xdc36c1;};}function handleError(_0x129fff,_0x16cd22){_0x16cd22=_0x16cd22||0x1f4;return function(_0x233b08){logger[_0xaf05('0x25')](_0x233b08[_0xaf05('0x26')]);if(_0x233b08[_0xaf05('0x27')]){delete _0x233b08[_0xaf05('0x27')];}_0x129fff[_0xaf05('0x18')](_0x16cd22)[_0xaf05('0x28')](_0x233b08);};}exports['index']=function(_0x578b4e,_0x1a3215){var _0xd44d6c={},_0x4c4e73={},_0x225151={'count':0x0,'rows':[]};var _0x56bff4=_[_0xaf05('0x29')](db['VoiceDialReport'][_0xaf05('0x2a')],function(_0x5ee06a){return{'name':_0x5ee06a[_0xaf05('0x2b')],'type':_0x5ee06a['type'][_0xaf05('0x2c')]};});_0x4c4e73['model']=_[_0xaf05('0x29')](_0x56bff4,_0xaf05('0x27'));_0x4c4e73[_0xaf05('0x2d')]=_[_0xaf05('0x2e')](_0x578b4e[_0xaf05('0x2d')]);_0x4c4e73[_0xaf05('0x2f')]=_['intersection'](_0x4c4e73[_0xaf05('0x30')],_0x4c4e73['query']);_0xd44d6c['attributes']=_[_0xaf05('0x31')](_0x4c4e73['model'],qs[_0xaf05('0x32')](_0x578b4e[_0xaf05('0x2d')]['fields']));_0xd44d6c[_0xaf05('0x33')]=_0xd44d6c[_0xaf05('0x33')][_0xaf05('0x34')]?_0xd44d6c[_0xaf05('0x33')]:_0x4c4e73[_0xaf05('0x30')];if(!_0x578b4e['query'][_0xaf05('0x35')](_0xaf05('0x36'))){_0xd44d6c[_0xaf05('0x1a')]=qs[_0xaf05('0x1a')](_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x1a')]);_0xd44d6c[_0xaf05('0x19')]=qs[_0xaf05('0x19')](_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x19')]);}_0xd44d6c[_0xaf05('0x37')]=qs[_0xaf05('0x38')](_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x38')]);_0xd44d6c[_0xaf05('0x39')]=qs[_0xaf05('0x2f')](_[_0xaf05('0x3a')](_0x578b4e['query'],_0x4c4e73[_0xaf05('0x2f')]),_0x56bff4);if(_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x3b')]){_0xd44d6c[_0xaf05('0x39')]=_[_0xaf05('0x3c')](_0xd44d6c[_0xaf05('0x39')],{'$or':_['map'](_0x56bff4,function(_0x233b55){if(_0x233b55[_0xaf05('0x3d')]!==_0xaf05('0x3e')){var _0x3f352f={};_0x3f352f[_0x233b55['name']]={'$like':'%'+_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x3b')]+'%'};return _0x3f352f;}})});}_0xd44d6c=_[_0xaf05('0x3c')]({},_0xd44d6c,_0x578b4e['options']);var _0x300449={'where':_0xd44d6c['where']};return db[_0xaf05('0x3f')][_0xaf05('0x1c')](_0x300449)[_0xaf05('0x23')](function(_0x16ae3f){_0x225151[_0xaf05('0x1c')]=_0x16ae3f;if(_0x578b4e[_0xaf05('0x2d')][_0xaf05('0x40')]){_0xd44d6c[_0xaf05('0x41')]=[{'all':!![]}];}return db[_0xaf05('0x3f')][_0xaf05('0x42')](_0xd44d6c);})[_0xaf05('0x23')](function(_0x45e7be){_0x225151['rows']=_0x45e7be;return _0x225151;})[_0xaf05('0x23')](respondWithFilteredResult(_0x1a3215,_0xd44d6c))[_0xaf05('0x43')](handleError(_0x1a3215,null));};exports[_0xaf05('0x44')]=function(_0x4abd47,_0x5b1280){var _0x46f364={'raw':!![],'where':{'id':_0x4abd47[_0xaf05('0x45')]['id']}},_0xbcd0e4={};_0xbcd0e4[_0xaf05('0x30')]=_['keys'](db[_0xaf05('0x3f')][_0xaf05('0x2a')]);_0xbcd0e4[_0xaf05('0x2d')]=_[_0xaf05('0x2e')](_0x4abd47[_0xaf05('0x2d')]);_0xbcd0e4[_0xaf05('0x2f')]=_[_0xaf05('0x31')](_0xbcd0e4[_0xaf05('0x30')],_0xbcd0e4[_0xaf05('0x2d')]);_0x46f364['attributes']=_[_0xaf05('0x31')](_0xbcd0e4[_0xaf05('0x30')],qs[_0xaf05('0x32')](_0x4abd47[_0xaf05('0x2d')][_0xaf05('0x32')]));_0x46f364[_0xaf05('0x33')]=_0x46f364[_0xaf05('0x33')][_0xaf05('0x34')]?_0x46f364['attributes']:_0xbcd0e4['model'];if(_0x4abd47[_0xaf05('0x2d')][_0xaf05('0x40')]){_0x46f364[_0xaf05('0x41')]=[{'all':!![]}];}_0x46f364=_['merge']({},_0x46f364,_0x4abd47[_0xaf05('0x46')]);return db[_0xaf05('0x3f')][_0xaf05('0x47')](_0x46f364)[_0xaf05('0x23')](handleEntityNotFound(_0x5b1280,null))[_0xaf05('0x23')](respondWithResult(_0x5b1280,null))['catch'](handleError(_0x5b1280,null));};exports[_0xaf05('0x48')]=function(_0x4c36b8,_0x18d071){return db[_0xaf05('0x3f')][_0xaf05('0x48')](_0x4c36b8[_0xaf05('0x49')],{})[_0xaf05('0x23')](respondWithResult(_0x18d071,0xc9))['catch'](handleError(_0x18d071,null));};exports['update']=function(_0x20fbff,_0x3a5232){if(_0x20fbff[_0xaf05('0x49')]['id']){delete _0x20fbff[_0xaf05('0x49')]['id'];}return db['VoiceDialReport'][_0xaf05('0x47')]({'where':{'id':_0x20fbff['params']['id']}})[_0xaf05('0x23')](handleEntityNotFound(_0x3a5232,null))[_0xaf05('0x23')](saveUpdates(_0x20fbff[_0xaf05('0x49')],null))[_0xaf05('0x23')](respondWithResult(_0x3a5232,null))['catch'](handleError(_0x3a5232,null));};exports['destroy']=function(_0x5d372a,_0x2b7559){return db[_0xaf05('0x3f')][_0xaf05('0x47')]({'where':{'id':_0x5d372a[_0xaf05('0x45')]['id']}})[_0xaf05('0x23')](handleEntityNotFound(_0x2b7559,null))[_0xaf05('0x23')](removeEntity(_0x2b7559,null))[_0xaf05('0x43')](handleError(_0x2b7559,null));};exports[_0xaf05('0x4a')]=function(_0x56c709,_0x4a2771){return db[_0xaf05('0x3f')]['describe']()[_0xaf05('0x23')](respondWithResult(_0x4a2771,null))[_0xaf05('0x43')](handleError(_0x4a2771,null));}; \ No newline at end of file +var _0xc5c5=['length','include','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','intersection'];(function(_0x456924,_0x2ec925){var _0x11dbc7=function(_0xc1a618){while(--_0xc1a618){_0x456924['push'](_0x456924['shift']());}};_0x11dbc7(++_0x2ec925);}(_0xc5c5,0x94));var _0x5c5c=function(_0x3a9395,_0xdddeff){_0x3a9395=_0x3a9395-0x0;var _0x39bd81=_0xc5c5[_0x3a9395];return _0x39bd81;};'use strict';var emlformat=require(_0x5c5c('0x0'));var rimraf=require(_0x5c5c('0x1'));var zipdir=require(_0x5c5c('0x2'));var jsonpatch=require(_0x5c5c('0x3'));var rp=require(_0x5c5c('0x4'));var moment=require(_0x5c5c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5c5c('0x6'));var ejs=require(_0x5c5c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c5c('0x8'));var squel=require(_0x5c5c('0x9'));var crypto=require(_0x5c5c('0xa'));var jsforce=require(_0x5c5c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c5c('0xc'));var authService=require(_0x5c5c('0xd'));var qs=require(_0x5c5c('0xe'));var as=require(_0x5c5c('0xf'));var hardwareService=require(_0x5c5c('0x10'));var logger=require(_0x5c5c('0x11'))(_0x5c5c('0x12'));var utils=require(_0x5c5c('0x13'));var config=require(_0x5c5c('0x14'));var licenseUtil=require(_0x5c5c('0x15'));var db=require(_0x5c5c('0x16'))['db'];function respondWithStatusCode(_0x19542b,_0x5983e4){_0x5983e4=_0x5983e4||0xcc;return function(_0x5f4475){if(_0x5f4475){return _0x19542b[_0x5c5c('0x17')](_0x5983e4);}return _0x19542b['status'](_0x5983e4)['end']();};}function respondWithResult(_0x4b6602,_0x4688ea){_0x4688ea=_0x4688ea||0xc8;return function(_0x25de92){if(_0x25de92){return _0x4b6602[_0x5c5c('0x18')](_0x4688ea)[_0x5c5c('0x19')](_0x25de92);}};}function respondWithFilteredResult(_0x44ed80,_0x72546a){return function(_0x47b41d){if(_0x47b41d){var _0x24cb96=typeof _0x72546a[_0x5c5c('0x1a')]===_0x5c5c('0x1b')&&typeof _0x72546a[_0x5c5c('0x1c')]===_0x5c5c('0x1b');var _0x39e0c1=_0x47b41d[_0x5c5c('0x1d')];var _0x31dbb0=_0x24cb96?0x0:_0x72546a[_0x5c5c('0x1a')];var _0x417a04=_0x24cb96?_0x47b41d['count']:_0x72546a[_0x5c5c('0x1a')]+_0x72546a[_0x5c5c('0x1c')];var _0x3eb161;if(_0x417a04>=_0x39e0c1){_0x417a04=_0x39e0c1;_0x3eb161=0xc8;}else{_0x3eb161=0xce;}_0x44ed80[_0x5c5c('0x18')](_0x3eb161);return _0x44ed80['set'](_0x5c5c('0x1e'),_0x31dbb0+'-'+_0x417a04+'/'+_0x39e0c1)[_0x5c5c('0x19')](_0x47b41d);}return null;};}function patchUpdates(_0x4f0f6f){return function(_0x5e2b6a){try{jsonpatch['apply'](_0x5e2b6a,_0x4f0f6f,!![]);}catch(_0x386b86){return BPromise['reject'](_0x386b86);}return _0x5e2b6a['save']();};}function saveUpdates(_0x395c4d,_0x7bf0af){return function(_0xd5b801){if(_0xd5b801){return _0xd5b801[_0x5c5c('0x1f')](_0x395c4d)[_0x5c5c('0x20')](function(_0xddc79f){return _0xddc79f;});}return null;};}function removeEntity(_0x405831,_0x58ecf9){return function(_0x396300){if(_0x396300){return _0x396300[_0x5c5c('0x21')]()[_0x5c5c('0x20')](function(){_0x405831[_0x5c5c('0x18')](0xcc)[_0x5c5c('0x22')]();});}};}function handleEntityNotFound(_0x429d7b,_0x329c08){return function(_0x796bc0){if(!_0x796bc0){_0x429d7b[_0x5c5c('0x17')](0x194);}return _0x796bc0;};}function handleError(_0x3439af,_0x1f2af4){_0x1f2af4=_0x1f2af4||0x1f4;return function(_0x34de8c){logger[_0x5c5c('0x23')](_0x34de8c[_0x5c5c('0x24')]);if(_0x34de8c[_0x5c5c('0x25')]){delete _0x34de8c[_0x5c5c('0x25')];}_0x3439af[_0x5c5c('0x18')](_0x1f2af4)[_0x5c5c('0x26')](_0x34de8c);};}exports[_0x5c5c('0x27')]=function(_0x15debf,_0x1b65a8){var _0x394e35={},_0x18b587={},_0x4441ff={'count':0x0,'rows':[]};var _0x3a64a6=_[_0x5c5c('0x28')](db['VoiceDialReport'][_0x5c5c('0x29')],function(_0x13555c){return{'name':_0x13555c[_0x5c5c('0x2a')],'type':_0x13555c[_0x5c5c('0x2b')][_0x5c5c('0x2c')]};});_0x18b587[_0x5c5c('0x2d')]=_[_0x5c5c('0x28')](_0x3a64a6,_0x5c5c('0x25'));_0x18b587[_0x5c5c('0x2e')]=_[_0x5c5c('0x2f')](_0x15debf[_0x5c5c('0x2e')]);_0x18b587[_0x5c5c('0x30')]=_['intersection'](_0x18b587[_0x5c5c('0x2d')],_0x18b587[_0x5c5c('0x2e')]);_0x394e35[_0x5c5c('0x31')]=_['intersection'](_0x18b587[_0x5c5c('0x2d')],qs[_0x5c5c('0x32')](_0x15debf[_0x5c5c('0x2e')][_0x5c5c('0x32')]));_0x394e35[_0x5c5c('0x31')]=_0x394e35[_0x5c5c('0x31')]['length']?_0x394e35['attributes']:_0x18b587[_0x5c5c('0x2d')];if(!_0x15debf['query'][_0x5c5c('0x33')]('nolimit')){_0x394e35[_0x5c5c('0x1c')]=qs[_0x5c5c('0x1c')](_0x15debf['query']['limit']);_0x394e35['offset']=qs['offset'](_0x15debf['query'][_0x5c5c('0x1a')]);}_0x394e35[_0x5c5c('0x34')]=qs['sort'](_0x15debf[_0x5c5c('0x2e')][_0x5c5c('0x35')]);_0x394e35['where']=qs[_0x5c5c('0x30')](_[_0x5c5c('0x36')](_0x15debf[_0x5c5c('0x2e')],_0x18b587['filters']),_0x3a64a6);if(_0x15debf['query']['filter']){_0x394e35['where']=_[_0x5c5c('0x37')](_0x394e35[_0x5c5c('0x38')],{'$or':_[_0x5c5c('0x28')](_0x3a64a6,function(_0x328e16){if(_0x328e16[_0x5c5c('0x2b')]!==_0x5c5c('0x39')){var _0x1e54d5={};_0x1e54d5[_0x328e16[_0x5c5c('0x25')]]={'$like':'%'+_0x15debf['query']['filter']+'%'};return _0x1e54d5;}})});}_0x394e35=_[_0x5c5c('0x37')]({},_0x394e35,_0x15debf[_0x5c5c('0x3a')]);var _0xf9e4d0={'where':_0x394e35[_0x5c5c('0x38')]};return db[_0x5c5c('0x3b')]['count'](_0xf9e4d0)['then'](function(_0x576b77){_0x4441ff[_0x5c5c('0x1d')]=_0x576b77;if(_0x15debf['query'][_0x5c5c('0x3c')]){_0x394e35['include']=[{'all':!![]}];}return db[_0x5c5c('0x3b')][_0x5c5c('0x3d')](_0x394e35);})[_0x5c5c('0x20')](function(_0x146672){_0x4441ff[_0x5c5c('0x3e')]=_0x146672;return _0x4441ff;})[_0x5c5c('0x20')](respondWithFilteredResult(_0x1b65a8,_0x394e35))[_0x5c5c('0x3f')](handleError(_0x1b65a8,null));};exports['show']=function(_0x56aad7,_0x4815eb){var _0x4a9d3c={'raw':!![],'where':{'id':_0x56aad7['params']['id']}},_0xda586b={};_0xda586b[_0x5c5c('0x2d')]=_[_0x5c5c('0x2f')](db[_0x5c5c('0x3b')][_0x5c5c('0x29')]);_0xda586b['query']=_[_0x5c5c('0x2f')](_0x56aad7[_0x5c5c('0x2e')]);_0xda586b['filters']=_['intersection'](_0xda586b[_0x5c5c('0x2d')],_0xda586b[_0x5c5c('0x2e')]);_0x4a9d3c[_0x5c5c('0x31')]=_[_0x5c5c('0x40')](_0xda586b['model'],qs['fields'](_0x56aad7[_0x5c5c('0x2e')][_0x5c5c('0x32')]));_0x4a9d3c['attributes']=_0x4a9d3c[_0x5c5c('0x31')][_0x5c5c('0x41')]?_0x4a9d3c[_0x5c5c('0x31')]:_0xda586b['model'];if(_0x56aad7[_0x5c5c('0x2e')][_0x5c5c('0x3c')]){_0x4a9d3c[_0x5c5c('0x42')]=[{'all':!![]}];}_0x4a9d3c=_[_0x5c5c('0x37')]({},_0x4a9d3c,_0x56aad7[_0x5c5c('0x3a')]);return db[_0x5c5c('0x3b')][_0x5c5c('0x43')](_0x4a9d3c)[_0x5c5c('0x20')](handleEntityNotFound(_0x4815eb,null))[_0x5c5c('0x20')](respondWithResult(_0x4815eb,null))[_0x5c5c('0x3f')](handleError(_0x4815eb,null));};exports['create']=function(_0x3dc80f,_0xb22f4a){return db['VoiceDialReport']['create'](_0x3dc80f[_0x5c5c('0x44')],{})['then'](respondWithResult(_0xb22f4a,0xc9))[_0x5c5c('0x3f')](handleError(_0xb22f4a,null));};exports[_0x5c5c('0x1f')]=function(_0x15c821,_0x5b3d23){if(_0x15c821[_0x5c5c('0x44')]['id']){delete _0x15c821['body']['id'];}return db[_0x5c5c('0x3b')][_0x5c5c('0x43')]({'where':{'id':_0x15c821[_0x5c5c('0x45')]['id']}})[_0x5c5c('0x20')](handleEntityNotFound(_0x5b3d23,null))[_0x5c5c('0x20')](saveUpdates(_0x15c821[_0x5c5c('0x44')],null))[_0x5c5c('0x20')](respondWithResult(_0x5b3d23,null))['catch'](handleError(_0x5b3d23,null));};exports[_0x5c5c('0x21')]=function(_0x5f19f4,_0x2e577a){return db[_0x5c5c('0x3b')][_0x5c5c('0x43')]({'where':{'id':_0x5f19f4[_0x5c5c('0x45')]['id']}})[_0x5c5c('0x20')](handleEntityNotFound(_0x2e577a,null))[_0x5c5c('0x20')](removeEntity(_0x2e577a,null))[_0x5c5c('0x3f')](handleError(_0x2e577a,null));};exports[_0x5c5c('0x46')]=function(_0x105783,_0xb2f049){return db[_0x5c5c('0x3b')][_0x5c5c('0x46')]()[_0x5c5c('0x20')](respondWithResult(_0xb2f049,null))[_0x5c5c('0x3f')](handleError(_0xb2f049,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2e2f6ef..c14c8e0 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 _0x0a51=['VoiceDialReport','report_dial','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x129fa8,_0x3dba2a){var _0x546bab=function(_0x2ef689){while(--_0x2ef689){_0x129fa8['push'](_0x129fa8['shift']());}};_0x546bab(++_0x3dba2a);}(_0x0a51,0x158));var _0x10a5=function(_0x17f2b1,_0x512f61){_0x17f2b1=_0x17f2b1-0x0;var _0x4963e2=_0x0a51[_0x17f2b1];return _0x4963e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10a5('0x0'))(_0x10a5('0x1'));var moment=require('moment');var BPromise=require(_0x10a5('0x2'));var rp=require(_0x10a5('0x3'));var fs=require('fs');var path=require(_0x10a5('0x4'));var rimraf=require(_0x10a5('0x5'));var config=require(_0x10a5('0x6'));var attributes=require(_0x10a5('0x7'));module['exports']=function(_0x529357,_0x5cadc0){return _0x529357['define'](_0x10a5('0x8'),attributes,{'tableName':_0x10a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x10a5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc992=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0xeb2969,_0xee087e){var _0xc51e23=function(_0x150d7d){while(--_0x150d7d){_0xeb2969['push'](_0xeb2969['shift']());}};_0xc51e23(++_0xee087e);}(_0xc992,0xbb));var _0x2c99=function(_0x553808,_0x2ce793){_0x553808=_0x553808-0x0;var _0x328d12=_0xc992[_0x553808];return _0x328d12;};'use strict';var _=require(_0x2c99('0x0'));var util=require('util');var logger=require(_0x2c99('0x1'))(_0x2c99('0x2'));var moment=require('moment');var BPromise=require(_0x2c99('0x3'));var rp=require(_0x2c99('0x4'));var fs=require('fs');var path=require(_0x2c99('0x5'));var rimraf=require('rimraf');var config=require(_0x2c99('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x2c99('0x7')]=function(_0x44c15b,_0x299dd9){return _0x44c15b[_0x2c99('0x8')](_0x2c99('0x9'),attributes,{'tableName':_0x2c99('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 37fcd8b..6ea2e2a 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 _0xeeb0=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','UpdateVoiceDialReport','body','where','attributes'];(function(_0x76da6a,_0x1376c5){var _0x5d8c96=function(_0x59ebd4){while(--_0x59ebd4){_0x76da6a['push'](_0x76da6a['shift']());}};_0x5d8c96(++_0x1376c5);}(_0xeeb0,0xf8));var _0x0eeb=function(_0x2c37b2,_0x107055){_0x2c37b2=_0x2c37b2-0x0;var _0x559312=_0xeeb0[_0x2c37b2];return _0x559312;};'use strict';var _=require(_0x0eeb('0x0'));var util=require('util');var moment=require(_0x0eeb('0x1'));var BPromise=require(_0x0eeb('0x2'));var rs=require(_0x0eeb('0x3'));var fs=require('fs');var Redis=require(_0x0eeb('0x4'));var db=require(_0x0eeb('0x5'))['db'];var utils=require(_0x0eeb('0x6'));var logger=require(_0x0eeb('0x7'))(_0x0eeb('0x8'));var config=require(_0x0eeb('0x9'));var jayson=require(_0x0eeb('0xa'));var client=jayson['client'][_0x0eeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141106,_0x3d3014,_0x4ee9e8){return new BPromise(function(_0x28d512,_0x853894){return client['request'](_0x141106,_0x4ee9e8)[_0x0eeb('0xc')](function(_0x1a3178){logger[_0x0eeb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3d3014,_0x0eeb('0xe'));logger[_0x0eeb('0xf')](_0x0eeb('0x10'),_0x3d3014,_0x0eeb('0xe'),JSON[_0x0eeb('0x11')](_0x1a3178));if(_0x1a3178['error']){if(_0x1a3178[_0x0eeb('0x12')][_0x0eeb('0x13')]===0x1f4){logger[_0x0eeb('0x12')](_0x0eeb('0x14'),_0x3d3014,_0x1a3178[_0x0eeb('0x12')][_0x0eeb('0x15')]);return _0x853894(_0x1a3178['error']['message']);}logger['error'](_0x0eeb('0x14'),_0x3d3014,_0x1a3178['error'][_0x0eeb('0x15')]);return _0x28d512(_0x1a3178[_0x0eeb('0x12')][_0x0eeb('0x15')]);}else{logger[_0x0eeb('0xd')](_0x0eeb('0x14'),_0x3d3014,_0x0eeb('0xe'));_0x28d512(_0x1a3178['result']['message']);}})[_0x0eeb('0x16')](function(_0x31e3c0){logger[_0x0eeb('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x3d3014,_0x31e3c0);_0x853894(_0x31e3c0);});});}exports[_0x0eeb('0x17')]=function(_0x5ddbba){var _0x4ab4d2=this;return new Promise(function(_0x1da208,_0x2bd8e5){return db[_0x0eeb('0x18')]['create'](_0x5ddbba['body'],{'raw':_0x5ddbba[_0x0eeb('0x19')]?_0x5ddbba[_0x0eeb('0x19')][_0x0eeb('0x1a')]===undefined?!![]:![]:!![]})[_0x0eeb('0xc')](function(_0x1f709b){logger[_0x0eeb('0xd')]('CreateVoiceDialReport',_0x5ddbba);logger['debug'](_0x0eeb('0x17'),_0x5ddbba,JSON['stringify'](_0x1f709b));_0x1da208(_0x1f709b);})[_0x0eeb('0x16')](function(_0x495f9e){logger[_0x0eeb('0x12')](_0x0eeb('0x17'),_0x495f9e['message'],_0x5ddbba);_0x2bd8e5(_0x4ab4d2[_0x0eeb('0x12')](0x1f4,_0x495f9e[_0x0eeb('0x15')]));});});};exports[_0x0eeb('0x1b')]=function(_0xa6907){var _0x5ef289=this;return new Promise(function(_0x8458d4,_0x89cac8){return db[_0x0eeb('0x18')]['update'](_0xa6907[_0x0eeb('0x1c')],{'raw':_0xa6907[_0x0eeb('0x19')]?_0xa6907[_0x0eeb('0x19')][_0x0eeb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6907['options']?_0xa6907[_0x0eeb('0x19')][_0x0eeb('0x1d')]||null:null,'attributes':_0xa6907[_0x0eeb('0x19')]?_0xa6907['options'][_0x0eeb('0x1e')]||null:null,'limit':_0xa6907[_0x0eeb('0x19')]?_0xa6907[_0x0eeb('0x19')]['limit']||null:null})[_0x0eeb('0xc')](function(_0x4b2b00){logger['info']('UpdateVoiceDialReport',_0xa6907);logger[_0x0eeb('0xf')](_0x0eeb('0x1b'),_0xa6907,JSON[_0x0eeb('0x11')](_0x4b2b00));_0x8458d4(_0x4b2b00);})['catch'](function(_0x1c626f){logger[_0x0eeb('0x12')]('UpdateVoiceDialReport',_0x1c626f[_0x0eeb('0x15')],_0xa6907);_0x89cac8(_0x5ef289[_0x0eeb('0x12')](0x1f4,_0x1c626f[_0x0eeb('0x15')]));});});}; \ No newline at end of file +var _0x6b6c=['UpdateVoiceDialReport','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then'];(function(_0x4a23eb,_0x1e723a){var _0x23ea55=function(_0x3f0584){while(--_0x3f0584){_0x4a23eb['push'](_0x4a23eb['shift']());}};_0x23ea55(++_0x1e723a);}(_0x6b6c,0x1c5));var _0xc6b6=function(_0x5da431,_0x410fd3){_0x5da431=_0x5da431-0x0;var _0x9739aa=_0x6b6c[_0x5da431];return _0x9739aa;};'use strict';var _=require(_0xc6b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6b6('0x1'));var rs=require(_0xc6b6('0x2'));var fs=require('fs');var Redis=require(_0xc6b6('0x3'));var db=require(_0xc6b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6b6('0x5'))(_0xc6b6('0x6'));var config=require(_0xc6b6('0x7'));var jayson=require(_0xc6b6('0x8'));var client=jayson[_0xc6b6('0x9')][_0xc6b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5fcc,_0x1fcb23,_0x5b3a73){return new BPromise(function(_0x212a8e,_0x5608fc){return client['request'](_0x1f5fcc,_0x5b3a73)['then'](function(_0x12836f){logger[_0xc6b6('0xb')](_0xc6b6('0xc'),_0x1fcb23,_0xc6b6('0xd'));logger[_0xc6b6('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1fcb23,_0xc6b6('0xd'),JSON[_0xc6b6('0xf')](_0x12836f));if(_0x12836f[_0xc6b6('0x10')]){if(_0x12836f[_0xc6b6('0x10')][_0xc6b6('0x11')]===0x1f4){logger['error'](_0xc6b6('0xc'),_0x1fcb23,_0x12836f[_0xc6b6('0x10')]['message']);return _0x5608fc(_0x12836f[_0xc6b6('0x10')][_0xc6b6('0x12')]);}logger['error'](_0xc6b6('0xc'),_0x1fcb23,_0x12836f[_0xc6b6('0x10')][_0xc6b6('0x12')]);return _0x212a8e(_0x12836f[_0xc6b6('0x10')][_0xc6b6('0x12')]);}else{logger[_0xc6b6('0xb')](_0xc6b6('0xc'),_0x1fcb23,_0xc6b6('0xd'));_0x212a8e(_0x12836f[_0xc6b6('0x13')][_0xc6b6('0x12')]);}})[_0xc6b6('0x14')](function(_0x541df0){logger[_0xc6b6('0x10')](_0xc6b6('0xc'),_0x1fcb23,_0x541df0);_0x5608fc(_0x541df0);});});}exports[_0xc6b6('0x15')]=function(_0x1c8706){var _0x3ff4f2=this;return new Promise(function(_0xc5fc58,_0x237fdd){return db[_0xc6b6('0x16')][_0xc6b6('0x17')](_0x1c8706[_0xc6b6('0x18')],{'raw':_0x1c8706[_0xc6b6('0x19')]?_0x1c8706[_0xc6b6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc6b6('0x1a')](function(_0x2f92bc){logger[_0xc6b6('0xb')](_0xc6b6('0x15'),_0x1c8706);logger[_0xc6b6('0xe')](_0xc6b6('0x15'),_0x1c8706,JSON[_0xc6b6('0xf')](_0x2f92bc));_0xc5fc58(_0x2f92bc);})[_0xc6b6('0x14')](function(_0xb8d266){logger[_0xc6b6('0x10')](_0xc6b6('0x15'),_0xb8d266[_0xc6b6('0x12')],_0x1c8706);_0x237fdd(_0x3ff4f2[_0xc6b6('0x10')](0x1f4,_0xb8d266['message']));});});};exports[_0xc6b6('0x1b')]=function(_0x39a601){var _0x17fe7f=this;return new Promise(function(_0x454002,_0x57f815){return db['VoiceDialReport']['update'](_0x39a601[_0xc6b6('0x18')],{'raw':_0x39a601[_0xc6b6('0x19')]?_0x39a601[_0xc6b6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a601['options']?_0x39a601[_0xc6b6('0x19')][_0xc6b6('0x1c')]||null:null,'attributes':_0x39a601[_0xc6b6('0x19')]?_0x39a601[_0xc6b6('0x19')]['attributes']||null:null,'limit':_0x39a601['options']?_0x39a601['options'][_0xc6b6('0x1d')]||null:null})[_0xc6b6('0x1a')](function(_0x410220){logger[_0xc6b6('0xb')](_0xc6b6('0x1b'),_0x39a601);logger['debug'](_0xc6b6('0x1b'),_0x39a601,JSON[_0xc6b6('0xf')](_0x410220));_0x454002(_0x410220);})['catch'](function(_0x1d8513){logger[_0xc6b6('0x10')](_0xc6b6('0x1b'),_0x1d8513[_0xc6b6('0x12')],_0x39a601);_0x57f815(_0x17fe7f[_0xc6b6('0x10')](0x1f4,_0x1d8513[_0xc6b6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ca9750e..68b0f60 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 _0xcad6=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','show','post','/:id/applications','addApplications','/:id','update'];(function(_0x2ca9c1,_0x9927a8){var _0x55812e=function(_0x2e1534){while(--_0x2e1534){_0x2ca9c1['push'](_0x2ca9c1['shift']());}};_0x55812e(++_0x9927a8);}(_0xcad6,0x1e7));var _0x6cad=function(_0x1ba6c6,_0x13296f){_0x1ba6c6=_0x1ba6c6-0x0;var _0x4bc1d6=_0xcad6[_0x1ba6c6];return _0x4bc1d6;};'use strict';var multer=require(_0x6cad('0x0'));var util=require(_0x6cad('0x1'));var path=require(_0x6cad('0x2'));var timeout=require(_0x6cad('0x3'));var express=require(_0x6cad('0x4'));var router=express['Router']();var fs_extra=require(_0x6cad('0x5'));var auth=require(_0x6cad('0x6'));var interaction=require(_0x6cad('0x7'));var config=require('../../config/environment');var controller=require(_0x6cad('0x8'));router[_0x6cad('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x6cad('0xa')](),controller[_0x6cad('0xb')]);router[_0x6cad('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6cad('0xc')](_0x6cad('0xd'),auth[_0x6cad('0xa')](),controller[_0x6cad('0xe')]);router['put'](_0x6cad('0xf'),auth['isAuthenticated'](),controller[_0x6cad('0x10')]);router['delete'](_0x6cad('0xf'),auth['isAuthenticated'](),controller[_0x6cad('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0531=['index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x0531,0xbc));var _0x1053=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x0531[_0x4350c2];return _0x8b6406;};'use strict';var multer=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var path=require(_0x1053('0x2'));var timeout=require(_0x1053('0x3'));var express=require('express');var router=express[_0x1053('0x4')]();var fs_extra=require(_0x1053('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1053('0x6'));var config=require('../../config/environment');var controller=require(_0x1053('0x7'));router[_0x1053('0x8')]('/',auth[_0x1053('0x9')](),controller[_0x1053('0xa')]);router[_0x1053('0x8')](_0x1053('0xb'),auth['isAuthenticated'](),controller[_0x1053('0xc')]);router[_0x1053('0xd')]('/',auth['isAuthenticated'](),controller[_0x1053('0xe')]);router['post'](_0x1053('0xf'),auth['isAuthenticated'](),controller[_0x1053('0x10')]);router[_0x1053('0x11')](_0x1053('0xb'),auth[_0x1053('0x9')](),controller[_0x1053('0x12')]);router[_0x1053('0x13')]('/:id',auth[_0x1053('0x9')](),controller[_0x1053('0x14')]);module[_0x1053('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cfe9b99..68694ad 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 _0x8706=['compositeIndex','STRING','NoOp','ENUM','inbound','inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten','exports'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8706,0x1ee));var _0x6870=function(_0x2507b6,_0x2d059a){_0x2507b6=_0x2507b6-0x0;var _0x22c8a4=_0x8706[_0x2507b6];return _0x22c8a4;};'use strict';var Sequelize=require('sequelize');module[_0x6870('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6870('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6870('0x2')],'allowNull':![],'unique':_0x6870('0x1')},'priority':{'type':Sequelize[_0x6870('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6870('0x2')],'allowNull':![],'defaultValue':_0x6870('0x3')},'appdata':{'type':Sequelize[_0x6870('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6870('0x4')](_0x6870('0x5'),'outbound','internal',_0x6870('0x6'),_0x6870('0x7'),'system',_0x6870('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x6870('0x2')]},'interval':{'type':Sequelize[_0x6870('0x2')],'allowNull':![],'defaultValue':_0x6870('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x6870('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x6870('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6870('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6870('0xb')]},'recordingFormat':{'type':Sequelize[_0x6870('0x2')],'defaultValue':_0x6870('0xc')},'answer':{'type':Sequelize[_0x6870('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x28b1b4){return this[_0x6870('0xd')](_0x6870('0xe'));}},'alias':{'type':Sequelize[_0x6870('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1767=['outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','internal','inbound-fax'];(function(_0x12a423,_0x25237f){var _0x512102=function(_0x103c00){while(--_0x103c00){_0x12a423['push'](_0x12a423['shift']());}};_0x512102(++_0x25237f);}(_0x1767,0x171));var _0x7176=function(_0x4ab662,_0x55a147){_0x4ab662=_0x4ab662-0x0;var _0x1f5d2e=_0x1767[_0x4ab662];return _0x1f5d2e;};'use strict';var Sequelize=require(_0x7176('0x0'));module[_0x7176('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7176('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7176('0x3')],'allowNull':![],'unique':_0x7176('0x2')},'priority':{'type':Sequelize[_0x7176('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x7176('0x2')},'tag':{'type':Sequelize[_0x7176('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7176('0x3')],'allowNull':![],'defaultValue':_0x7176('0x4')},'appdata':{'type':Sequelize[_0x7176('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7176('0x5')](_0x7176('0x6'),'outbound',_0x7176('0x7'),_0x7176('0x8'),_0x7176('0x9'),_0x7176('0xa'),_0x7176('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x7176('0x3')]},'interval':{'type':Sequelize[_0x7176('0x3')],'allowNull':![],'defaultValue':_0x7176('0xc')},'IntervalId':{'type':Sequelize[_0x7176('0xd')]},'isApp':{'type':Sequelize[_0x7176('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7176('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x7176('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7176('0xd')]},'recordingFormat':{'type':Sequelize[_0x7176('0x3')],'defaultValue':_0x7176('0xf')},'answer':{'type':Sequelize[_0x7176('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7176('0x10')],'get':function(_0xe1e8e7){return this['getDataValue'](_0x7176('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a3a3d79..cead2e8 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 _0x9243=['mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','outbound','InternalRoutes','filter','ignore','value','includes','find','type','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','OutboundRoutes','internal','UserProfileSection','update','context','description','recordingFormat','cutdigits'];(function(_0x223a7c,_0x11ebdc){var _0x22e78a=function(_0x1dce57){while(--_0x1dce57){_0x223a7c['push'](_0x223a7c['shift']());}};_0x22e78a(++_0x11ebdc);}(_0x9243,0x120));var _0x3924=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x9243[_0x119280];return _0x481797;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x3924('0x0'));var logger=require(_0x3924('0x1'))(_0x3924('0x2'));var config=require(_0x3924('0x3'));var db=require(_0x3924('0x4'))['db'];config[_0x3924('0x5')]=_[_0x3924('0x6')](config['redis'],{'host':_0x3924('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3924('0x5')]));require(_0x3924('0x8'))['register'](socket);function respondWithStatusCode(_0x4f8d95,_0x5a630c){_0x5a630c=_0x5a630c||0xcc;return function(_0x2e0777){if(_0x2e0777){return _0x4f8d95[_0x3924('0x9')](_0x5a630c);}return _0x4f8d95['status'](_0x5a630c)[_0x3924('0xa')]();};}function respondWithResult(_0x7cc9cc,_0xff5f93){_0xff5f93=_0xff5f93||0xc8;return function(_0x2e745a){if(_0x2e745a){return _0x7cc9cc[_0x3924('0xb')](_0xff5f93)[_0x3924('0xc')](_0x2e745a);}};}function respondWithFilteredResult(_0x1eff9b,_0x2b6910){return function(_0x4baefc){if(_0x4baefc){var _0x963e16=typeof _0x2b6910[_0x3924('0xd')]===_0x3924('0xe')&&typeof _0x2b6910[_0x3924('0xf')]==='undefined';var _0x2393ad=_0x4baefc[_0x3924('0x10')];var _0x1f12c8=_0x963e16?0x0:_0x2b6910[_0x3924('0xd')];var _0x4af143=_0x963e16?_0x4baefc[_0x3924('0x10')]:_0x2b6910[_0x3924('0xd')]+_0x2b6910['limit'];var _0x2ae9b8;if(_0x4af143>=_0x2393ad){_0x4af143=_0x2393ad;_0x2ae9b8=0xc8;}else{_0x2ae9b8=0xce;}_0x1eff9b[_0x3924('0xb')](_0x2ae9b8);return _0x1eff9b[_0x3924('0x11')](_0x3924('0x12'),_0x1f12c8+'-'+_0x4af143+'/'+_0x2393ad)[_0x3924('0xc')](_0x4baefc);}return null;};}function removeEntity(_0x1a2370){return function(_0x2ebebf){if(_0x2ebebf){return _0x2ebebf[_0x3924('0x13')]()[_0x3924('0x14')](function(){var _0x3e5e07=_0x2ebebf['get']({'plain':!![]});var _0x325d8e=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x3924('0x15'),'ignore':![]},{'name':_0x3924('0x16'),'value':'internal','ignore':![]}];var _0x428e6f=_(_0x325d8e)[_0x3924('0x17')](_0x3924('0x18'))['map'](_0x3924('0x19'))[_0x3924('0x19')]();if(_[_0x3924('0x1a')](_0x428e6f,_0x3e5e07['type'])){return;}var _0x9244c1=_[_0x3924('0x1b')](_0x325d8e,[_0x3924('0x19'),_0x3e5e07[_0x3924('0x1c')]])['name'];return db[_0x3924('0x1d')][_0x3924('0x13')]({'where':{'type':_0x9244c1,'resourceId':_0x3e5e07['id']}})[_0x3924('0x14')](function(){return _0x2ebebf;});})[_0x3924('0x14')](function(){_0x1a2370['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca9dd){return function(_0x399e8c){if(!_0x399e8c){_0x2ca9dd[_0x3924('0x9')](0x194);}return _0x399e8c;};}function handleError(_0x297186,_0x4d3d2b){_0x4d3d2b=_0x4d3d2b||0x1f4;return function(_0x2054c7){logger[_0x3924('0x1e')](_0x2054c7['stack']);if(_0x2054c7['name']){delete _0x2054c7[_0x3924('0x1f')];}_0x297186['status'](_0x4d3d2b)['send'](_0x2054c7);};}exports[_0x3924('0x20')]=function(_0x2c0aea,_0x32db48){var _0x5831ba={},_0x47bbe7={},_0x4df278={'count':0x0,'rows':[]};var _0xc3d1e=_['map'](db[_0x3924('0x21')][_0x3924('0x22')],function(_0x3d51b6){return{'name':_0x3d51b6[_0x3924('0x23')],'type':_0x3d51b6['type'][_0x3924('0x24')]};});_0x47bbe7[_0x3924('0x25')]=_[_0x3924('0x26')](_0xc3d1e,_0x3924('0x1f'));_0x47bbe7[_0x3924('0x27')]=_[_0x3924('0x28')](_0x2c0aea[_0x3924('0x27')]);_0x47bbe7[_0x3924('0x29')]=_[_0x3924('0x2a')](_0x47bbe7[_0x3924('0x25')],_0x47bbe7['query']);_0x5831ba[_0x3924('0x2b')]=_[_0x3924('0x2a')](_0x47bbe7[_0x3924('0x25')],qs[_0x3924('0x2c')](_0x2c0aea[_0x3924('0x27')][_0x3924('0x2c')]));_0x5831ba['attributes']=_0x5831ba[_0x3924('0x2b')][_0x3924('0x2d')]?_0x5831ba[_0x3924('0x2b')]:_0x47bbe7['model'];if(!_0x2c0aea[_0x3924('0x27')][_0x3924('0x2e')](_0x3924('0x2f'))){_0x5831ba[_0x3924('0xf')]=qs[_0x3924('0xf')](_0x2c0aea['query'][_0x3924('0xf')]);_0x5831ba[_0x3924('0xd')]=qs[_0x3924('0xd')](_0x2c0aea['query'][_0x3924('0xd')]);}_0x5831ba['order']=qs[_0x3924('0x30')](_0x2c0aea[_0x3924('0x27')]['sort']);_0x5831ba[_0x3924('0x31')]=qs[_0x3924('0x29')](_[_0x3924('0x32')](_0x2c0aea[_0x3924('0x27')],_0x47bbe7[_0x3924('0x29')]),_0xc3d1e);if(_0x2c0aea[_0x3924('0x27')]['filter']){_0x5831ba['where']=_[_0x3924('0x33')](_0x5831ba['where'],{'$or':_[_0x3924('0x26')](_0xc3d1e,function(_0x30d064){if(_0x30d064[_0x3924('0x1c')]!==_0x3924('0x34')){var _0x2edff5={};_0x2edff5[_0x30d064[_0x3924('0x1f')]]={'$like':'%'+_0x2c0aea[_0x3924('0x27')][_0x3924('0x17')]+'%'};return _0x2edff5;}})});}_0x5831ba=_[_0x3924('0x33')]({},_0x5831ba,_0x2c0aea[_0x3924('0x35')]);var _0xa50bc7={'where':_0x5831ba['where']};return db[_0x3924('0x21')][_0x3924('0x10')](_0xa50bc7)[_0x3924('0x14')](function(_0x29914a){_0x4df278[_0x3924('0x10')]=_0x29914a;if(_0x2c0aea[_0x3924('0x27')]['includeAll']){_0x5831ba[_0x3924('0x36')]=[{'all':!![]}];}return db[_0x3924('0x21')][_0x3924('0x37')](_0x5831ba);})[_0x3924('0x14')](function(_0xbaaab1){_0x4df278[_0x3924('0x38')]=_0xbaaab1;return _0x4df278;})[_0x3924('0x14')](respondWithFilteredResult(_0x32db48,_0x5831ba))[_0x3924('0x39')](handleError(_0x32db48,null));};exports['show']=function(_0x4cf523,_0xc479c9){var _0x388ada={'raw':![],'where':{'id':_0x4cf523['params']['id']}},_0x174795={};_0x174795[_0x3924('0x25')]=_[_0x3924('0x28')](db['VoiceExtension']['rawAttributes']);_0x174795[_0x3924('0x27')]=_[_0x3924('0x28')](_0x4cf523[_0x3924('0x27')]);_0x174795['filters']=_['intersection'](_0x174795[_0x3924('0x25')],_0x174795[_0x3924('0x27')]);_0x388ada[_0x3924('0x2b')]=_['intersection'](_0x174795[_0x3924('0x25')],qs['fields'](_0x4cf523[_0x3924('0x27')][_0x3924('0x2c')]));_0x388ada[_0x3924('0x2b')]=_0x388ada['attributes']['length']?_0x388ada[_0x3924('0x2b')]:_0x174795[_0x3924('0x25')];if(_0x4cf523[_0x3924('0x27')][_0x3924('0x3a')]){_0x388ada[_0x3924('0x36')]=[{'all':!![]}];}_0x388ada=_[_0x3924('0x33')]({},_0x388ada,_0x4cf523[_0x3924('0x35')]);return db[_0x3924('0x21')][_0x3924('0x1b')](_0x388ada)['then'](handleEntityNotFound(_0xc479c9,null))[_0x3924('0x14')](respondWithResult(_0xc479c9,null))[_0x3924('0x39')](handleError(_0xc479c9,null));};exports[_0x3924('0x13')]=function(_0x2a0b1b,_0x106150){return db[_0x3924('0x21')][_0x3924('0x1b')]({'where':{'id':_0x2a0b1b[_0x3924('0x3b')]['id']}})[_0x3924('0x14')](handleEntityNotFound(_0x106150,null))['then'](removeEntity(_0x106150,null))[_0x3924('0x39')](handleError(_0x106150,null));};exports[_0x3924('0x3c')]=function(_0x4da856,_0xed715){if(_0x4da856[_0x3924('0x3d')][_0x3924('0x1c')]===_0x3924('0x15')&&!_['startsWith'](_0x4da856[_0x3924('0x3d')][_0x3924('0x3e')],'_')){_0x4da856[_0x3924('0x3d')][_0x3924('0x3e')]='_'[_0x3924('0x3f')](_0x4da856[_0x3924('0x3d')][_0x3924('0x3e')]);}return db[_0x3924('0x21')][_0x3924('0x3c')](_0x4da856[_0x3924('0x3d')],{'raw':![]})[_0x3924('0x14')](function(_0x46057e){var _0x556e50=_0x4da856[_0x3924('0x40')][_0x3924('0x41')]({'plain':!![]});if(!_0x556e50)throw new Error(_0x3924('0x42'));if(_0x556e50['role']==='user'){var _0x297855=_0x46057e[_0x3924('0x41')]({'plain':!![]});var _0x1b81a4=[{'name':_0x3924('0x43'),'value':'inbound'},{'name':_0x3924('0x44'),'value':_0x3924('0x15')},{'name':_0x3924('0x16'),'value':_0x3924('0x45')}];var _0x4efbad=_[_0x3924('0x1b')](_0x1b81a4,['value',_0x297855[_0x3924('0x1c')]])['name'];return db[_0x3924('0x46')][_0x3924('0x1b')]({'where':{'name':_0x4efbad,'userProfileId':_0x556e50['userProfileId']},'raw':!![]})[_0x3924('0x14')](function(_0x3fc182){if(_0x3fc182&&_0x3fc182['autoAssociation']===0x0){return db[_0x3924('0x1d')][_0x3924('0x3c')]({'name':_0x297855[_0x3924('0x1f')],'resourceId':_0x297855['id'],'type':_0x3fc182[_0x3924('0x1f')],'sectionId':_0x3fc182['id']},{})['then'](function(){return _0x46057e;});}else{return _0x46057e;}})[_0x3924('0x39')](function(_0x1f6ca4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f6ca4);throw _0x1f6ca4;});}return _0x46057e;})[_0x3924('0x14')](respondWithResult(_0xed715,0xc9))[_0x3924('0x39')](handleError(_0xed715,null));};exports[_0x3924('0x47')]=function(_0x169505,_0x560a4c){if(_0x169505[_0x3924('0x3d')]['id']){delete _0x169505[_0x3924('0x3d')]['id'];}return db['VoiceExtension'][_0x3924('0x1b')]({'where':{'id':_0x169505[_0x3924('0x3b')]['id']}})[_0x3924('0x14')](handleEntityNotFound(_0x560a4c,null))['then'](function(_0x7ebbf6){if(_0x7ebbf6){return db['VoiceExtension']['update'](_['pick'](_0x169505[_0x3924('0x3d')],[_0x3924('0x3e'),_0x3924('0x48'),_0x3924('0x49'),_0x3924('0x4a'),_0x3924('0x4b'),_0x3924('0x4c'),_0x3924('0x4d')]),{'where':{'context':_0x7ebbf6['context'],'exten':_0x7ebbf6['exten']},'individualHooks':!![]})[_0x3924('0x14')](function(_0x3520a6){return _0x3520a6;});}return null;})[_0x3924('0x14')](respondWithStatusCode(_0x560a4c,null))[_0x3924('0x39')](handleError(_0x560a4c,null));};exports['addApplications']=function(_0xca7374,_0x4df07c){var _0x2d3c31=_0xca7374[_0x3924('0x3b')]['id'];var _0x35e92d=_0xca7374[_0x3924('0x3d')];var _0x25697b=0xc8;var _0x5df945=null;return db[_0x3924('0x4e')][_0x3924('0x4f')]({'isolationLevel':db['sequelize'][_0x3924('0x50')][_0x3924('0x51')]['READ_COMMITTED']},function(_0x28ce03){return db['VoiceExtension'][_0x3924('0x52')]({'where':{'id':_0x2d3c31},'transaction':_0x28ce03})[_0x3924('0x14')](function(_0x1827e8){if(_0x1827e8){return db[_0x3924('0x21')][_0x3924('0x13')]({'where':{'VoiceExtensionId':_0x2d3c31},'transaction':_0x28ce03})[_0x3924('0x14')](function(){var _0x53f575=_[_0x3924('0x26')](_0x35e92d,function(_0x5f490e){_0x5f490e[_0x3924('0x53')]=_0x2d3c31;_0x5f490e[_0x3924('0x54')]=!![];return _0x5f490e;});return _0x1827e8[_0x3924('0x55')](_0x53f575);})[_0x3924('0x14')](function(_0x2c00d5){return db[_0x3924('0x21')][_0x3924('0x56')](_0x2c00d5,{'transaction':_0x28ce03});});}else{_0x25697b=0x194;_0x5df945=[];}});})[_0x3924('0x14')](function(){if(_0x25697b!==0x194){return db[_0x3924('0x21')][_0x3924('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2d3c31},'order':_0x3924('0x58')})[_0x3924('0x14')](function(_0x2e72ca){_0x5df945=_0x2e72ca;});}})['catch'](function(_0xb78085){_0x25697b=0x1f4;logger[_0x3924('0x1e')](_0xb78085['stack']);if(_0xb78085['name']){delete _0xb78085[_0x3924('0x1f')];}_0x5df945=_0xb78085;})[_0x3924('0x59')](function(){if(_0x5df945===null){_0x4df07c[_0x3924('0x9')](_0x25697b);}else{if(_0x25697b===0x1f4){_0x4df07c[_0x3924('0xb')](_0x25697b)[_0x3924('0x5a')](_0x5df945);}else{_0x4df07c['status'](_0x25697b)[_0x3924('0xc')](_0x5df945);}}});}; \ No newline at end of file +var _0x256f=['InternalRoutes','ignore','map','value','type','name','UserProfileResource','stack','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','VoiceExtension','rows','catch','show','params','includeAll','options','find','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','findOne','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound'];(function(_0x41dc7f,_0x89a7ae){var _0x4d854a=function(_0x34ceda){while(--_0x34ceda){_0x41dc7f['push'](_0x41dc7f['shift']());}};_0x4d854a(++_0x89a7ae);}(_0x256f,0x140));var _0xf256=function(_0x245b43,_0x445f86){_0x245b43=_0x245b43-0x0;var _0x2ee9ef=_0x256f[_0x245b43];return _0x2ee9ef;};'use strict';var _=require('lodash');var Redis=require(_0xf256('0x0'));var qs=require(_0xf256('0x1'));var logger=require(_0xf256('0x2'))('api');var config=require(_0xf256('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf256('0x4')](config[_0xf256('0x5')],{'host':_0xf256('0x6'),'port':0x18eb});var socket=require(_0xf256('0x7'))(new Redis(config['redis']));require(_0xf256('0x8'))[_0xf256('0x9')](socket);function respondWithStatusCode(_0x2c719f,_0xfb04d9){_0xfb04d9=_0xfb04d9||0xcc;return function(_0x2fd276){if(_0x2fd276){return _0x2c719f[_0xf256('0xa')](_0xfb04d9);}return _0x2c719f[_0xf256('0xb')](_0xfb04d9)[_0xf256('0xc')]();};}function respondWithResult(_0x4da8bb,_0x6ac9bb){_0x6ac9bb=_0x6ac9bb||0xc8;return function(_0x16dff0){if(_0x16dff0){return _0x4da8bb[_0xf256('0xb')](_0x6ac9bb)[_0xf256('0xd')](_0x16dff0);}};}function respondWithFilteredResult(_0x1e4396,_0x4b63a9){return function(_0x574747){if(_0x574747){var _0x31c40f=typeof _0x4b63a9[_0xf256('0xe')]==='undefined'&&typeof _0x4b63a9[_0xf256('0xf')]==='undefined';var _0x743fad=_0x574747[_0xf256('0x10')];var _0x129a86=_0x31c40f?0x0:_0x4b63a9['offset'];var _0x57a016=_0x31c40f?_0x574747[_0xf256('0x10')]:_0x4b63a9[_0xf256('0xe')]+_0x4b63a9[_0xf256('0xf')];var _0x29c910;if(_0x57a016>=_0x743fad){_0x57a016=_0x743fad;_0x29c910=0xc8;}else{_0x29c910=0xce;}_0x1e4396['status'](_0x29c910);return _0x1e4396[_0xf256('0x11')](_0xf256('0x12'),_0x129a86+'-'+_0x57a016+'/'+_0x743fad)[_0xf256('0xd')](_0x574747);}return null;};}function removeEntity(_0x20b5e3){return function(_0x396987){if(_0x396987){return _0x396987[_0xf256('0x13')]()[_0xf256('0x14')](function(){var _0x107f62=_0x396987['get']({'plain':!![]});var _0x206a08=[{'name':'InboundRoutes','value':_0xf256('0x15'),'ignore':![]},{'name':_0xf256('0x16'),'value':_0xf256('0x17'),'ignore':![]},{'name':_0xf256('0x18'),'value':'internal','ignore':![]}];var _0x1017ea=_(_0x206a08)['filter'](_0xf256('0x19'))[_0xf256('0x1a')](_0xf256('0x1b'))[_0xf256('0x1b')]();if(_['includes'](_0x1017ea,_0x107f62[_0xf256('0x1c')])){return;}var _0x20ec72=_['find'](_0x206a08,['value',_0x107f62[_0xf256('0x1c')]])[_0xf256('0x1d')];return db[_0xf256('0x1e')]['destroy']({'where':{'type':_0x20ec72,'resourceId':_0x107f62['id']}})[_0xf256('0x14')](function(){return _0x396987;});})[_0xf256('0x14')](function(){_0x20b5e3[_0xf256('0xb')](0xcc)[_0xf256('0xc')]();});}};}function handleEntityNotFound(_0x117e59){return function(_0x12ad09){if(!_0x12ad09){_0x117e59[_0xf256('0xa')](0x194);}return _0x12ad09;};}function handleError(_0x39b84a,_0xaec394){_0xaec394=_0xaec394||0x1f4;return function(_0x538e0c){logger['error'](_0x538e0c[_0xf256('0x1f')]);if(_0x538e0c[_0xf256('0x1d')]){delete _0x538e0c['name'];}_0x39b84a[_0xf256('0xb')](_0xaec394)[_0xf256('0x20')](_0x538e0c);};}exports[_0xf256('0x21')]=function(_0x11ce17,_0x2bee46){var _0x449840={},_0x3d7e01={},_0x30d176={'count':0x0,'rows':[]};var _0x27b280=_[_0xf256('0x1a')](db['VoiceExtension'][_0xf256('0x22')],function(_0x3861de){return{'name':_0x3861de[_0xf256('0x23')],'type':_0x3861de['type']['key']};});_0x3d7e01[_0xf256('0x24')]=_[_0xf256('0x1a')](_0x27b280,_0xf256('0x1d'));_0x3d7e01[_0xf256('0x25')]=_[_0xf256('0x26')](_0x11ce17[_0xf256('0x25')]);_0x3d7e01[_0xf256('0x27')]=_[_0xf256('0x28')](_0x3d7e01[_0xf256('0x24')],_0x3d7e01['query']);_0x449840[_0xf256('0x29')]=_[_0xf256('0x28')](_0x3d7e01['model'],qs['fields'](_0x11ce17['query'][_0xf256('0x2a')]));_0x449840[_0xf256('0x29')]=_0x449840[_0xf256('0x29')][_0xf256('0x2b')]?_0x449840[_0xf256('0x29')]:_0x3d7e01[_0xf256('0x24')];if(!_0x11ce17[_0xf256('0x25')][_0xf256('0x2c')](_0xf256('0x2d'))){_0x449840[_0xf256('0xf')]=qs[_0xf256('0xf')](_0x11ce17[_0xf256('0x25')][_0xf256('0xf')]);_0x449840['offset']=qs[_0xf256('0xe')](_0x11ce17[_0xf256('0x25')][_0xf256('0xe')]);}_0x449840[_0xf256('0x2e')]=qs[_0xf256('0x2f')](_0x11ce17[_0xf256('0x25')][_0xf256('0x2f')]);_0x449840[_0xf256('0x30')]=qs[_0xf256('0x27')](_[_0xf256('0x31')](_0x11ce17['query'],_0x3d7e01[_0xf256('0x27')]),_0x27b280);if(_0x11ce17[_0xf256('0x25')][_0xf256('0x32')]){_0x449840['where']=_['merge'](_0x449840[_0xf256('0x30')],{'$or':_['map'](_0x27b280,function(_0x8dd692){if(_0x8dd692[_0xf256('0x1c')]!==_0xf256('0x33')){var _0x25604a={};_0x25604a[_0x8dd692['name']]={'$like':'%'+_0x11ce17[_0xf256('0x25')][_0xf256('0x32')]+'%'};return _0x25604a;}})});}_0x449840=_[_0xf256('0x34')]({},_0x449840,_0x11ce17['options']);var _0x391072={'where':_0x449840['where']};return db[_0xf256('0x35')][_0xf256('0x10')](_0x391072)[_0xf256('0x14')](function(_0x26f7df){_0x30d176['count']=_0x26f7df;if(_0x11ce17[_0xf256('0x25')]['includeAll']){_0x449840['include']=[{'all':!![]}];}return db[_0xf256('0x35')]['findAll'](_0x449840);})['then'](function(_0x369ed1){_0x30d176[_0xf256('0x36')]=_0x369ed1;return _0x30d176;})[_0xf256('0x14')](respondWithFilteredResult(_0x2bee46,_0x449840))[_0xf256('0x37')](handleError(_0x2bee46,null));};exports[_0xf256('0x38')]=function(_0x2f9c4f,_0x3b1669){var _0x4e74c3={'raw':![],'where':{'id':_0x2f9c4f[_0xf256('0x39')]['id']}},_0x30ddf2={};_0x30ddf2['model']=_[_0xf256('0x26')](db['VoiceExtension'][_0xf256('0x22')]);_0x30ddf2['query']=_[_0xf256('0x26')](_0x2f9c4f[_0xf256('0x25')]);_0x30ddf2[_0xf256('0x27')]=_['intersection'](_0x30ddf2[_0xf256('0x24')],_0x30ddf2[_0xf256('0x25')]);_0x4e74c3[_0xf256('0x29')]=_[_0xf256('0x28')](_0x30ddf2['model'],qs[_0xf256('0x2a')](_0x2f9c4f['query'][_0xf256('0x2a')]));_0x4e74c3[_0xf256('0x29')]=_0x4e74c3[_0xf256('0x29')][_0xf256('0x2b')]?_0x4e74c3[_0xf256('0x29')]:_0x30ddf2[_0xf256('0x24')];if(_0x2f9c4f['query'][_0xf256('0x3a')]){_0x4e74c3['include']=[{'all':!![]}];}_0x4e74c3=_[_0xf256('0x34')]({},_0x4e74c3,_0x2f9c4f[_0xf256('0x3b')]);return db[_0xf256('0x35')][_0xf256('0x3c')](_0x4e74c3)['then'](handleEntityNotFound(_0x3b1669,null))[_0xf256('0x14')](respondWithResult(_0x3b1669,null))[_0xf256('0x37')](handleError(_0x3b1669,null));};exports[_0xf256('0x13')]=function(_0x4e0837,_0x343c26){return db[_0xf256('0x35')]['find']({'where':{'id':_0x4e0837[_0xf256('0x39')]['id']}})['then'](handleEntityNotFound(_0x343c26,null))[_0xf256('0x14')](removeEntity(_0x343c26,null))['catch'](handleError(_0x343c26,null));};exports[_0xf256('0x3d')]=function(_0x1714c8,_0x332aab){if(_0x1714c8[_0xf256('0x3e')][_0xf256('0x1c')]===_0xf256('0x17')&&!_[_0xf256('0x3f')](_0x1714c8[_0xf256('0x3e')][_0xf256('0x40')],'_')){_0x1714c8['body'][_0xf256('0x40')]='_'[_0xf256('0x41')](_0x1714c8[_0xf256('0x3e')][_0xf256('0x40')]);}return db[_0xf256('0x35')][_0xf256('0x3d')](_0x1714c8[_0xf256('0x3e')],{'raw':![]})['then'](function(_0x49d402){var _0x1e4d1b=_0x1714c8[_0xf256('0x42')][_0xf256('0x43')]({'plain':!![]});if(!_0x1e4d1b)throw new Error(_0xf256('0x44'));if(_0x1e4d1b[_0xf256('0x45')]===_0xf256('0x42')){var _0x3302eb=_0x49d402[_0xf256('0x43')]({'plain':!![]});var _0x5e329b=[{'name':_0xf256('0x46'),'value':'inbound'},{'name':_0xf256('0x16'),'value':'outbound'},{'name':_0xf256('0x18'),'value':_0xf256('0x47')}];var _0x1dcc0c=_[_0xf256('0x3c')](_0x5e329b,[_0xf256('0x1b'),_0x3302eb['type']])[_0xf256('0x1d')];return db['UserProfileSection'][_0xf256('0x3c')]({'where':{'name':_0x1dcc0c,'userProfileId':_0x1e4d1b['userProfileId']},'raw':!![]})['then'](function(_0x5d21f0){if(_0x5d21f0&&_0x5d21f0['autoAssociation']===0x0){return db[_0xf256('0x1e')][_0xf256('0x3d')]({'name':_0x3302eb['name'],'resourceId':_0x3302eb['id'],'type':_0x5d21f0[_0xf256('0x1d')],'sectionId':_0x5d21f0['id']},{})[_0xf256('0x14')](function(){return _0x49d402;});}else{return _0x49d402;}})[_0xf256('0x37')](function(_0x197e27){logger[_0xf256('0x48')](_0xf256('0x49'),_0x197e27);throw _0x197e27;});}return _0x49d402;})[_0xf256('0x14')](respondWithResult(_0x332aab,0xc9))[_0xf256('0x37')](handleError(_0x332aab,null));};exports['update']=function(_0x108932,_0x20f0e2){if(_0x108932[_0xf256('0x3e')]['id']){delete _0x108932[_0xf256('0x3e')]['id'];}return db[_0xf256('0x35')][_0xf256('0x3c')]({'where':{'id':_0x108932[_0xf256('0x39')]['id']}})['then'](handleEntityNotFound(_0x20f0e2,null))[_0xf256('0x14')](function(_0x20aab6){if(_0x20aab6){return db['VoiceExtension']['update'](_[_0xf256('0x31')](_0x108932['body'],[_0xf256('0x40'),_0xf256('0x4a'),_0xf256('0x4b'),_0xf256('0x4c'),_0xf256('0x4d'),_0xf256('0x4e'),_0xf256('0x4f')]),{'where':{'context':_0x20aab6[_0xf256('0x4a')],'exten':_0x20aab6[_0xf256('0x40')]},'individualHooks':!![]})['then'](function(_0x19a13c){return _0x19a13c;});}return null;})[_0xf256('0x14')](respondWithStatusCode(_0x20f0e2,null))[_0xf256('0x37')](handleError(_0x20f0e2,null));};exports['addApplications']=function(_0x5787e1,_0x1483d5){var _0x37a459=_0x5787e1[_0xf256('0x39')]['id'];var _0x22dd3d=_0x5787e1[_0xf256('0x3e')];var _0x344e61=0xc8;var _0x1d7a9b=null;return db[_0xf256('0x50')][_0xf256('0x51')]({'isolationLevel':db[_0xf256('0x50')][_0xf256('0x52')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x2b813e){return db[_0xf256('0x35')][_0xf256('0x53')]({'where':{'id':_0x37a459},'transaction':_0x2b813e})[_0xf256('0x14')](function(_0xc66b8a){if(_0xc66b8a){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x37a459},'transaction':_0x2b813e})[_0xf256('0x14')](function(){var _0x2008ef=_[_0xf256('0x1a')](_0x22dd3d,function(_0x5da591){_0x5da591['VoiceExtensionId']=_0x37a459;_0x5da591['isApp']=!![];return _0x5da591;});return _0xc66b8a['createRouting'](_0x2008ef);})[_0xf256('0x14')](function(_0x3e517f){return db[_0xf256('0x35')]['bulkCreate'](_0x3e517f,{'transaction':_0x2b813e});});}else{_0x344e61=0x194;_0x1d7a9b=[];}});})[_0xf256('0x14')](function(){if(_0x344e61!==0x194){return db[_0xf256('0x35')][_0xf256('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x37a459},'order':_0xf256('0x55')})[_0xf256('0x14')](function(_0x4bab35){_0x1d7a9b=_0x4bab35;});}})[_0xf256('0x37')](function(_0x2af066){_0x344e61=0x1f4;logger[_0xf256('0x48')](_0x2af066['stack']);if(_0x2af066['name']){delete _0x2af066['name'];}_0x1d7a9b=_0x2af066;})['finally'](function(){if(_0x1d7a9b===null){_0x1483d5[_0xf256('0xa')](_0x344e61);}else{if(_0x344e61===0x1f4){_0x1483d5[_0xf256('0xb')](_0x344e61)[_0xf256('0x20')](_0x1d7a9b);}else{_0x1483d5[_0xf256('0xb')](_0x344e61)[_0xf256('0xd')](_0x1d7a9b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9493326..66fd30a 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 _0x1a49=['emit','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x1a49,0x10d));var _0x91a4=function(_0x254571,_0x2db5fb){_0x254571=_0x254571-0x0;var _0x2704cf=_0x1a49[_0x254571];return _0x2704cf;};'use strict';var EventEmitter=require(_0x91a4('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x91a4('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x91a4('0x2')](0x0);var events={'afterCreate':_0x91a4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x229014){return function(_0x3c5311,_0x14a028,_0x4c4161){VoiceExtensionEvents['emit'](_0x229014+':'+_0x3c5311['id'],_0x3c5311);VoiceExtensionEvents[_0x91a4('0x4')](_0x229014,_0x3c5311);_0x4c4161(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x91a4('0x5')](e,emitEvent(event));}}module[_0x91a4('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3043=['update','emit','events','../../mysqldb','VoiceExtension'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3043,0x16a));var _0x3304=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x3043[_0x21549c];return _0x426cbd;};'use strict';var EventEmitter=require(_0x3304('0x0'));var VoiceExtension=require(_0x3304('0x1'))['db'][_0x3304('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3304('0x3'),'afterDestroy':'remove'};function emitEvent(_0x588a3f){return function(_0x1e4096,_0x184691,_0x214225){VoiceExtensionEvents[_0x3304('0x4')](_0x588a3f+':'+_0x1e4096['id'],_0x1e4096);VoiceExtensionEvents[_0x3304('0x4')](_0x588a3f,_0x1e4096);_0x214225(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 343fef7..a574e79 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 _0x04e7=['ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','split','name','phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','length','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','appType','appdata','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}'];(function(_0x24e8db,_0x89fc47){var _0x576cc1=function(_0x58f214){while(--_0x58f214){_0x24e8db['push'](_0x24e8db['shift']());}};_0x576cc1(++_0x89fc47);}(_0x04e7,0x121));var _0x704e=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x04e7[_0x12833b];return _0x3acad3;};'use strict';var _=require(_0x704e('0x0'));var attributes=require(_0x704e('0x1'));module[_0x704e('0x2')]=function(_0x2d3607){var _0x13c834=_0x2d3607[_0x704e('0x3')];function _0x3fd60b(_0x35ae6f){var _0x27d66f=0x2;var _0xfca56f=[{'type':_0x35ae6f[_0x704e('0x4')],'app':_0x704e('0x5'),'appdata':'CDR(type)='+_0x35ae6f[_0x704e('0x4')],'context':_0x35ae6f[_0x704e('0x6')],'exten':_0x35ae6f[_0x704e('0x7')],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']},{'type':_0x35ae6f[_0x704e('0x4')],'app':_0x35ae6f[_0x704e('0x8')]?_0x704e('0x5'):_0x704e('0x9'),'appdata':_0x35ae6f[_0x704e('0x8')]?_0x704e('0xa')+_0x35ae6f[_0x704e('0x8')]:_0x704e('0xb'),'context':_0x35ae6f[_0x704e('0x6')],'exten':_0x35ae6f['exten'],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']}];if(_0x35ae6f[_0x704e('0x4')]===_0x704e('0xc')){_0xfca56f[_0x704e('0xd')]({'type':_0x704e('0xc'),'app':_0x704e('0x5'),'appdata':_0x704e('0xe')+_0x35ae6f['id'],'context':_0x35ae6f[_0x704e('0x6')],'exten':_0x35ae6f['exten'],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']});}_0xfca56f['push']({'type':_0x35ae6f[_0x704e('0x4')],'app':_0x704e('0x5'),'appdata':_0x704e('0xf'),'context':_0x35ae6f[_0x704e('0x6')],'exten':_0x35ae6f[_0x704e('0x7')],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']},{'type':_0x35ae6f[_0x704e('0x4')],'app':_0x704e('0x5'),'appdata':_0x704e('0x10'),'context':_0x35ae6f['context'],'exten':_0x35ae6f[_0x704e('0x7')],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']},{'type':_0x35ae6f[_0x704e('0x4')],'app':_0x704e('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x35ae6f[_0x704e('0x6')],'exten':_0x35ae6f[_0x704e('0x7')],'priority':_0x27d66f++,'VoiceExtensionId':_0x35ae6f['id']});return _0xfca56f;}function _0x3fd07d(_0x5d1e9e){var _0x1b347a=0x2;var _0x1bd0cf=[{'type':_0x704e('0x11'),'app':_0x704e('0x5'),'appdata':_0x704e('0x12'),'context':_0x5d1e9e['context'],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':'outbound','app':_0x5d1e9e[_0x704e('0x8')]?'Set':'NoOp','appdata':_0x5d1e9e['alias']?_0x704e('0xa')+_0x5d1e9e[_0x704e('0x8')]:_0x704e('0xb'),'context':_0x5d1e9e['context'],'exten':_0x5d1e9e['exten'],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':_0x704e('0x5'),'appdata':_0x704e('0x13')+(_0x5d1e9e[_0x704e('0x14')]?_0x704e('0x15')+_0x5d1e9e[_0x704e('0x14')]+'}':_0x704e('0x16')),'context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':_0x704e('0x5'),'appdata':'CDR(routeid)='+_0x5d1e9e['id'],'context':_0x5d1e9e['context'],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':_0x704e('0x17'),'appdata':_0x704e('0x18')+(_0x1b347a+0x2)+_0x704e('0x19')+(_0x1b347a+0x1)+')','context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':'Set','appdata':_0x5d1e9e[_0x704e('0x14')]?_0x704e('0x1a')+_0x5d1e9e[_0x704e('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e['exten'],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':_0x704e('0x5'),'appdata':_0x704e('0xf'),'context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e['exten'],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':'outbound','app':_0x704e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5d1e9e['context'],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':_0x704e('0x11'),'app':_0x704e('0x5'),'appdata':_0x704e('0x1b'),'context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e['exten'],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':'outbound','app':_0x704e('0x5'),'appdata':'outboundrouteid='+_0x5d1e9e['id'],'context':_0x5d1e9e['context'],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']}];if(_0x5d1e9e[_0x704e('0x1c')](_0x704e('0x1d'))&&_0x5d1e9e[_0x704e('0x1d')]!==_0x704e('0x1e')){_0x1bd0cf[_0x704e('0xd')]({'type':_0x704e('0x11'),'app':'Set','appdata':_0x704e('0x1f'),'context':_0x5d1e9e['context'],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']},{'type':'outbound','app':_0x704e('0x5'),'appdata':_0x704e('0x20')+_0x5d1e9e[_0x704e('0x1d')]||_0x704e('0x21'),'context':_0x5d1e9e[_0x704e('0x6')],'exten':_0x5d1e9e[_0x704e('0x7')],'priority':_0x1b347a++,'VoiceExtensionId':_0x5d1e9e['id']});}return _0x1bd0cf;}function _0x307275(_0x1da7be,_0x2c8090){var _0x491d9f=[{'name':_0x704e('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x704e('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x4a21c2={};var _0x3491f3=_0x2c8090[_0x704e('0x24')](',');var _0x5eb0f8=[];for(var _0x1dee62=0x0;_0x1dee62<_0x491d9f['length'];_0x1dee62++){switch(_0x491d9f[_0x1dee62][_0x704e('0x25')]){case _0x704e('0x22'):_0x4a21c2[_0x704e('0x22')]=_0x3491f3[_0x491d9f[_0x1dee62]['param']][_0x704e('0x24')]('/')[0x1];_0x4a21c2[_0x704e('0x26')]=_0x3491f3[_0x491d9f[_0x1dee62][_0x704e('0x27')]][_0x704e('0x24')]('/')[0x2];_0x4a21c2[_0x704e('0x28')]=_0x4a21c2[_0x704e('0x26')]?_0x4a21c2[_0x704e('0x26')][_0x704e('0x24')]('$')[0x0]:undefined;_0x4a21c2[_0x704e('0x26')]=_0x1da7be['cutdigits']?(_0x4a21c2['prefix']||'')+_0x704e('0x15')+_0x1da7be[_0x704e('0x14')]+'}':(_0x4a21c2[_0x704e('0x28')]||'')+'${EXTEN}';_0x5eb0f8[_0x491d9f[_0x1dee62][_0x704e('0x27')]]=[_0x704e('0x29'),_0x4a21c2[_0x704e('0x22')],_0x4a21c2[_0x704e('0x26')]][_0x704e('0x2a')]('/');break;case _0x704e('0x23'):_0x4a21c2[_0x704e('0x23')]=_0x3491f3[_0x491d9f[_0x1dee62][_0x704e('0x27')]];if(_0x1da7be['recordingFormat']!==_0x704e('0x1e')){if(_0x4a21c2[_0x704e('0x23')][_0x704e('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x4a21c2['options']+=_0x704e('0x2c');}}else{_0x4a21c2[_0x704e('0x23')]=_0x4a21c2[_0x704e('0x23')][_0x704e('0x2d')](_0x704e('0x2c'),'');}_0x5eb0f8[_0x491d9f[_0x1dee62]['param']]=_0x4a21c2[_0x704e('0x23')];break;default:_0x5eb0f8[_0x491d9f[_0x1dee62]['param']]=_0x3491f3[_0x491d9f[_0x1dee62]['param']];}}return _0x5eb0f8['join'](',');}function _0x3a51e2(_0x1f5ba0,_0x58820e,_0x46bc99){return new Promise(function(_0xf2bfdb,_0xe6df5e){var _0x7c1129=[];if(_[_0x704e('0x2e')](_0x58820e))return _0xf2bfdb(_0x7c1129);_0x13c834[_0x704e('0x2f')]['findAll']({'attributes':['id',_0x704e('0x30'),_0x704e('0x31')],'raw':!![]})[_0x704e('0x32')](function(_0xc42a6d){for(var _0x49d799=0x0,_0x3a4423=0x0;_0x49d799<_0x58820e[_0x704e('0x33')];_0x49d799++,_0x3a4423=0x0){var _0xe3548=_0x58820e[_0x49d799];var _0x53a96c=[];var _0x191df1=[];delete _0xe3548['id'];if(_0xe3548[_0x704e('0x30')]!=='*,*,*,*'){_0xe3548[_0x704e('0x34')]=[_0xe3548[_0x704e('0x30')]];}else{_0xe3548[_0x704e('0x34')]=_0xe3548[_0x704e('0x31')]?_[_0x704e('0x35')](_[_0x704e('0x36')](_0xc42a6d,{'IntervalId':_0xe3548[_0x704e('0x31')]}),_0x704e('0x30')):[];}_0xe3548['context']=_0x1f5ba0['context'];_0xe3548[_0x704e('0x7')]=_0x1f5ba0[_0x704e('0x7')];if(_0xe3548['type'])_0xe3548['type']=_0xe3548[_0x704e('0x4')][_0x704e('0x37')]();if(_0x1f5ba0[_0x704e('0x4')]===_0x704e('0x11')){if(_0xe3548[_0x704e('0x1c')](_0x704e('0x38'))&&_0xe3548['tag']&&_0xe3548[_0x704e('0x38')]!=='--'){_0x53a96c[_0x704e('0xd')]({'type':_0xe3548['type'][_0x704e('0x37')](),'app':'Set','appdata':'CDR(tag)='+_0xe3548[_0x704e('0x38')],'context':_0x1f5ba0[_0x704e('0x6')],'exten':_0x1f5ba0['exten'],'priority':_0xe3548[_0x704e('0x34')][_0x704e('0x33')]+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});}_0x53a96c['push']({'type':_0xe3548[_0x704e('0x4')][_0x704e('0x37')](),'app':_0x704e('0x17'),'appdata':_0x704e('0x39')+(_0xe3548[_0x704e('0x3a')]?_0x704e('0x3b')+_0xe3548['callerID']+')':_0x704e('0x3c')),'context':_0x1f5ba0[_0x704e('0x6')],'exten':_0x1f5ba0[_0x704e('0x7')],'priority':_0xe3548[_0x704e('0x34')]['length']+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});}else{if(_0xe3548[_0x704e('0x1c')](_0x704e('0x3d'))){if(['queue',_0x704e('0x3e')][_0x704e('0x3f')](_0xe3548[_0x704e('0x40')][_0x704e('0x37')]())&&_0xe3548['appType']!=='custom'){if(_0xe3548[_0x704e('0x3d')]){_0x53a96c[_0x704e('0xd')]({'type':_0xe3548[_0x704e('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x704e('0x41'),'context':_0x1f5ba0['context'],'exten':_0x1f5ba0[_0x704e('0x7')],'priority':_0xe3548['intervals'][_0x704e('0x33')]+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});_0x53a96c['push']({'type':_0xe3548[_0x704e('0x4')][_0x704e('0x37')](),'app':_0x704e('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1f5ba0[_0x704e('0x6')],'exten':_0x1f5ba0['exten'],'priority':_0xe3548['intervals'][_0x704e('0x33')]+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});}else{_0x53a96c['push']({'type':_0xe3548[_0x704e('0x4')][_0x704e('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1f5ba0[_0x704e('0x6')],'exten':_0x1f5ba0[_0x704e('0x7')],'priority':_0xe3548[_0x704e('0x34')][_0x704e('0x33')]+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});_0x53a96c[_0x704e('0xd')]({'type':_0xe3548[_0x704e('0x4')][_0x704e('0x37')](),'app':_0x704e('0x5'),'appdata':_0x704e('0x42'),'context':_0x1f5ba0['context'],'exten':_0x1f5ba0[_0x704e('0x7')],'priority':_0xe3548['intervals'][_0x704e('0x33')]+_0x46bc99+_0x3a4423++,'VoiceExtensionId':_0x1f5ba0['id']});}}}}for(var _0x48075a=0x0;_0x48075a<_0xe3548['intervals'][_0x704e('0x33')];_0x48075a++){var _0x566654=_0x46bc99+_0xe3548[_0x704e('0x34')][_0x704e('0x33')];var _0x58af7f=_0x48075a===_0xe3548['intervals'][_0x704e('0x33')]-0x1?_0x46bc99+_0x53a96c[_0x704e('0x33')]+_0x191df1[_0x704e('0x33')]+0x2:_0x46bc99+_0x48075a+0x1;_0x53a96c[_0x704e('0x43')](_0x48075a,0x0,{'type':_0x1f5ba0['type'],'app':'GotoIfTime','appdata':_0xe3548[_0x704e('0x34')][_0x48075a]+'?'+_0x1f5ba0[_0x704e('0x6')]+',${EXTEN},'+_0x566654+':'+_0x1f5ba0[_0x704e('0x6')]+',${EXTEN},'+_0x58af7f,'exten':_0x1f5ba0[_0x704e('0x7')],'context':_0x1f5ba0[_0x704e('0x6')],'priority':_0x46bc99+_0x48075a,'VoiceExtensionId':_0x1f5ba0['id']});}if(_0xe3548[_0x704e('0x44')]==='outboundDial')_0xe3548['appdata']=_0x307275(_0x1f5ba0,_0xe3548[_0x704e('0x45')]);_0xe3548[_0x704e('0x46')]=_0x53a96c[_0x704e('0x33')]?_[_0x704e('0x47')](_0x53a96c)['priority']+0x1:_0x46bc99;_0x7c1129=_[_0x704e('0x48')](_0x7c1129,_0x53a96c,[_0xe3548],_0x191df1);_0x46bc99=_[_0x704e('0x47')](_0x7c1129)['priority']+0x1;}return _0xf2bfdb(_0x7c1129);})['catch'](function(_0x4e792f){_0xe6df5e(_0x4e792f);});});}return _0x2d3607[_0x704e('0x49')](_0x704e('0x4a'),attributes,{'tableName':_0x704e('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xb489ca){var _0x1baa37=this[_0x704e('0x4c')]({'plain':!![]});var _0x7a1280=_0x1baa37[_0x704e('0x4')]===_0x704e('0x11')?_0x3fd07d(_0x1baa37):_0x3fd60b(_0x1baa37);return _0x3a51e2(_0x1baa37,_0xb489ca,_[_0x704e('0x47')](_0x7a1280)['priority']+0x1)['then'](function(_0x382afe){var _0x49745c=_['concat'](_0x7a1280,_0x382afe);_0x49745c['push']({'type':_0x1baa37[_0x704e('0x4')],'app':_0x704e('0x4d'),'exten':_0x1baa37[_0x704e('0x7')],'context':_0x1baa37[_0x704e('0x6')],'priority':_[_0x704e('0x47')](_0x49745c)[_0x704e('0x46')]+0x1,'VoiceExtensionId':_0x1baa37['id']});return _0x49745c;});}}});}; \ No newline at end of file +var _0xec13=['):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','name','trunk','prefix','phone','join','options','param','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','filter','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x38bcf6,_0xbf92fd){var _0x291894=function(_0x3f95ba){while(--_0x3f95ba){_0x38bcf6['push'](_0x38bcf6['shift']());}};_0x291894(++_0xbf92fd);}(_0xec13,0x8f));var _0x3ec1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xec13[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x3ec1('0x0'));var attributes=require(_0x3ec1('0x1'));module[_0x3ec1('0x2')]=function(_0x4b5aa8){var _0x261351=_0x4b5aa8[_0x3ec1('0x3')];function _0x381387(_0x497446){var _0x201bfb=0x2;var _0x46e3c8=[{'type':_0x497446['type'],'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x5')+_0x497446[_0x3ec1('0x6')],'context':_0x497446['context'],'exten':_0x497446[_0x3ec1('0x7')],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']},{'type':_0x497446[_0x3ec1('0x6')],'app':_0x497446['alias']?_0x3ec1('0x4'):_0x3ec1('0x8'),'appdata':_0x497446[_0x3ec1('0x9')]?_0x3ec1('0xa')+_0x497446[_0x3ec1('0x9')]:_0x3ec1('0xb'),'context':_0x497446[_0x3ec1('0xc')],'exten':_0x497446[_0x3ec1('0x7')],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']}];if(_0x497446[_0x3ec1('0x6')]===_0x3ec1('0xd')){_0x46e3c8[_0x3ec1('0xe')]({'type':_0x3ec1('0xd'),'app':'Set','appdata':_0x3ec1('0xf')+_0x497446['id'],'context':_0x497446[_0x3ec1('0xc')],'exten':_0x497446['exten'],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']});}_0x46e3c8[_0x3ec1('0xe')]({'type':_0x497446['type'],'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x10'),'context':_0x497446[_0x3ec1('0xc')],'exten':_0x497446[_0x3ec1('0x7')],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']},{'type':_0x497446[_0x3ec1('0x6')],'app':'Set','appdata':_0x3ec1('0x11'),'context':_0x497446[_0x3ec1('0xc')],'exten':_0x497446[_0x3ec1('0x7')],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']},{'type':_0x497446[_0x3ec1('0x6')],'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x12'),'context':_0x497446['context'],'exten':_0x497446['exten'],'priority':_0x201bfb++,'VoiceExtensionId':_0x497446['id']});return _0x46e3c8;}function _0x9b54ea(_0x32a3d8){var _0x365bbd=0x2;var _0x4ace49=[{'type':'outbound','app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x13'),'context':_0x32a3d8['context'],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':'outbound','app':_0x32a3d8['alias']?'Set':_0x3ec1('0x8'),'appdata':_0x32a3d8[_0x3ec1('0x9')]?_0x3ec1('0xa')+_0x32a3d8['alias']:_0x3ec1('0xb'),'context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8['exten'],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x15')+(_0x32a3d8['cutdigits']?_0x3ec1('0x16')+_0x32a3d8[_0x3ec1('0x17')]+'}':_0x3ec1('0x18')),'context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8['exten'],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0xf')+_0x32a3d8['id'],'context':_0x32a3d8['context'],'exten':_0x32a3d8['exten'],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x19'),'appdata':_0x3ec1('0x1a')+(_0x365bbd+0x2)+_0x3ec1('0x1b')+(_0x365bbd+0x1)+')','context':_0x32a3d8['context'],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':'outbound','app':'Set','appdata':_0x32a3d8[_0x3ec1('0x17')]?_0x3ec1('0x1c')+_0x32a3d8[_0x3ec1('0x17')]+'}':_0x3ec1('0x1d'),'context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x10'),'context':_0x32a3d8['context'],'exten':_0x32a3d8['exten'],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':'Set','appdata':_0x3ec1('0x11'),'context':_0x32a3d8['context'],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x32a3d8['context'],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x4'),'appdata':'outboundrouteid='+_0x32a3d8['id'],'context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']}];if(_0x32a3d8[_0x3ec1('0x1e')](_0x3ec1('0x1f'))&&_0x32a3d8[_0x3ec1('0x1f')]!=='none'){_0x4ace49[_0x3ec1('0xe')]({'type':'outbound','app':_0x3ec1('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']},{'type':_0x3ec1('0x14'),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x20')+_0x32a3d8['recordingFormat']||_0x3ec1('0x21'),'context':_0x32a3d8[_0x3ec1('0xc')],'exten':_0x32a3d8[_0x3ec1('0x7')],'priority':_0x365bbd++,'VoiceExtensionId':_0x32a3d8['id']});}return _0x4ace49;}function _0x33e2b6(_0x278470,_0x419fa2){var _0x2176a2=[{'name':'trunk','param':0x0},{'name':_0x3ec1('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x3ec1('0x23'),'param':0x3}];var _0x1a5bf9={};var _0x42189e=_0x419fa2[_0x3ec1('0x24')](',');var _0x58771c=[];for(var _0x1112fc=0x0;_0x1112fc<_0x2176a2[_0x3ec1('0x25')];_0x1112fc++){switch(_0x2176a2[_0x1112fc][_0x3ec1('0x26')]){case _0x3ec1('0x27'):_0x1a5bf9[_0x3ec1('0x27')]=_0x42189e[_0x2176a2[_0x1112fc]['param']][_0x3ec1('0x24')]('/')[0x1];_0x1a5bf9['phone']=_0x42189e[_0x2176a2[_0x1112fc]['param']][_0x3ec1('0x24')]('/')[0x2];_0x1a5bf9[_0x3ec1('0x28')]=_0x1a5bf9[_0x3ec1('0x29')]?_0x1a5bf9[_0x3ec1('0x29')][_0x3ec1('0x24')]('$')[0x0]:undefined;_0x1a5bf9[_0x3ec1('0x29')]=_0x278470[_0x3ec1('0x17')]?(_0x1a5bf9['prefix']||'')+_0x3ec1('0x16')+_0x278470[_0x3ec1('0x17')]+'}':(_0x1a5bf9[_0x3ec1('0x28')]||'')+_0x3ec1('0x18');_0x58771c[_0x2176a2[_0x1112fc]['param']]=['SIP',_0x1a5bf9['trunk'],_0x1a5bf9['phone']][_0x3ec1('0x2a')]('/');break;case'options':_0x1a5bf9[_0x3ec1('0x2b')]=_0x42189e[_0x2176a2[_0x1112fc][_0x3ec1('0x2c')]];if(_0x278470[_0x3ec1('0x1f')]!==_0x3ec1('0x2d')){if(_0x1a5bf9['options'][_0x3ec1('0x2e')](_0x3ec1('0x2f'))<0x0){_0x1a5bf9[_0x3ec1('0x2b')]+='U(xcally-mixmonitor-context)';}}else{_0x1a5bf9[_0x3ec1('0x2b')]=_0x1a5bf9['options'][_0x3ec1('0x30')](_0x3ec1('0x2f'),'');}_0x58771c[_0x2176a2[_0x1112fc][_0x3ec1('0x2c')]]=_0x1a5bf9[_0x3ec1('0x2b')];break;default:_0x58771c[_0x2176a2[_0x1112fc][_0x3ec1('0x2c')]]=_0x42189e[_0x2176a2[_0x1112fc][_0x3ec1('0x2c')]];}}return _0x58771c[_0x3ec1('0x2a')](',');}function _0x50f0(_0x254099,_0xfd18c5,_0x4a5f60){return new Promise(function(_0x643c89,_0x427ee2){var _0x1d2495=[];if(_[_0x3ec1('0x31')](_0xfd18c5))return _0x643c89(_0x1d2495);_0x261351[_0x3ec1('0x32')][_0x3ec1('0x33')]({'attributes':['id','interval',_0x3ec1('0x34')],'raw':!![]})['then'](function(_0x16c0a5){for(var _0x4a8cce=0x0,_0x198641=0x0;_0x4a8cce<_0xfd18c5['length'];_0x4a8cce++,_0x198641=0x0){var _0x18450d=_0xfd18c5[_0x4a8cce];var _0x1c31e5=[];var _0x5c5a5f=[];delete _0x18450d['id'];if(_0x18450d[_0x3ec1('0x35')]!==_0x3ec1('0x36')){_0x18450d[_0x3ec1('0x37')]=[_0x18450d[_0x3ec1('0x35')]];}else{_0x18450d['intervals']=_0x18450d[_0x3ec1('0x34')]?_['map'](_[_0x3ec1('0x38')](_0x16c0a5,{'IntervalId':_0x18450d['IntervalId']}),'interval'):[];}_0x18450d['context']=_0x254099[_0x3ec1('0xc')];_0x18450d[_0x3ec1('0x7')]=_0x254099[_0x3ec1('0x7')];if(_0x18450d[_0x3ec1('0x6')])_0x18450d[_0x3ec1('0x6')]=_0x18450d['type']['toLowerCase']();if(_0x254099[_0x3ec1('0x6')]===_0x3ec1('0x14')){if(_0x18450d[_0x3ec1('0x1e')]('tag')&&_0x18450d[_0x3ec1('0x39')]&&_0x18450d['tag']!=='--'){_0x1c31e5['push']({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x3b')+_0x18450d[_0x3ec1('0x39')],'context':_0x254099['context'],'exten':_0x254099['exten'],'priority':_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')]+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});}_0x1c31e5[_0x3ec1('0xe')]({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':_0x3ec1('0x19'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x18450d[_0x3ec1('0x3c')]?_0x3ec1('0x3d')+_0x18450d['callerID']+')':_0x3ec1('0x3e')),'context':_0x254099['context'],'exten':_0x254099[_0x3ec1('0x7')],'priority':_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')]+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});}else{if(_0x18450d[_0x3ec1('0x1e')](_0x3ec1('0x3f'))){if(['queue',_0x3ec1('0x40')][_0x3ec1('0x41')](_0x18450d[_0x3ec1('0x42')]['toLowerCase']())&&_0x18450d['appType']!==_0x3ec1('0x43')){if(_0x18450d['answer']){_0x1c31e5[_0x3ec1('0xe')]({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':_0x3ec1('0x19'),'appdata':_0x3ec1('0x44'),'context':_0x254099[_0x3ec1('0xc')],'exten':_0x254099[_0x3ec1('0x7')],'priority':_0x18450d[_0x3ec1('0x37')]['length']+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});_0x1c31e5[_0x3ec1('0xe')]({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':_0x3ec1('0x4'),'appdata':_0x3ec1('0x45'),'context':_0x254099[_0x3ec1('0xc')],'exten':_0x254099[_0x3ec1('0x7')],'priority':_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')]+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});}else{_0x1c31e5['push']({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':_0x3ec1('0x19'),'appdata':_0x3ec1('0x46'),'context':_0x254099[_0x3ec1('0xc')],'exten':_0x254099[_0x3ec1('0x7')],'priority':_0x18450d['intervals'][_0x3ec1('0x25')]+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});_0x1c31e5[_0x3ec1('0xe')]({'type':_0x18450d[_0x3ec1('0x6')][_0x3ec1('0x3a')](),'app':'Set','appdata':_0x3ec1('0x47'),'context':_0x254099[_0x3ec1('0xc')],'exten':_0x254099[_0x3ec1('0x7')],'priority':_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')]+_0x4a5f60+_0x198641++,'VoiceExtensionId':_0x254099['id']});}}}}for(var _0x1cb289=0x0;_0x1cb289<_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')];_0x1cb289++){var _0x572cd8=_0x4a5f60+_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')];var _0x53675b=_0x1cb289===_0x18450d[_0x3ec1('0x37')][_0x3ec1('0x25')]-0x1?_0x4a5f60+_0x1c31e5[_0x3ec1('0x25')]+_0x5c5a5f[_0x3ec1('0x25')]+0x2:_0x4a5f60+_0x1cb289+0x1;_0x1c31e5[_0x3ec1('0x48')](_0x1cb289,0x0,{'type':_0x254099[_0x3ec1('0x6')],'app':_0x3ec1('0x49'),'appdata':_0x18450d[_0x3ec1('0x37')][_0x1cb289]+'?'+_0x254099['context']+_0x3ec1('0x4a')+_0x572cd8+':'+_0x254099[_0x3ec1('0xc')]+',${EXTEN},'+_0x53675b,'exten':_0x254099[_0x3ec1('0x7')],'context':_0x254099[_0x3ec1('0xc')],'priority':_0x4a5f60+_0x1cb289,'VoiceExtensionId':_0x254099['id']});}if(_0x18450d[_0x3ec1('0x4b')]==='outboundDial')_0x18450d[_0x3ec1('0x4c')]=_0x33e2b6(_0x254099,_0x18450d[_0x3ec1('0x4c')]);_0x18450d[_0x3ec1('0x4d')]=_0x1c31e5['length']?_[_0x3ec1('0x4e')](_0x1c31e5)['priority']+0x1:_0x4a5f60;_0x1d2495=_[_0x3ec1('0x4f')](_0x1d2495,_0x1c31e5,[_0x18450d],_0x5c5a5f);_0x4a5f60=_[_0x3ec1('0x4e')](_0x1d2495)['priority']+0x1;}return _0x643c89(_0x1d2495);})[_0x3ec1('0x50')](function(_0x25aa6f){_0x427ee2(_0x25aa6f);});});}return _0x4b5aa8[_0x3ec1('0x51')]('VoiceExtension',attributes,{'tableName':_0x3ec1('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2b4913){var _0xaebd4c=this[_0x3ec1('0x53')]({'plain':!![]});var _0x2af03f=_0xaebd4c[_0x3ec1('0x6')]===_0x3ec1('0x14')?_0x9b54ea(_0xaebd4c):_0x381387(_0xaebd4c);return _0x50f0(_0xaebd4c,_0x2b4913,_['last'](_0x2af03f)[_0x3ec1('0x4d')]+0x1)['then'](function(_0x412a9e){var _0x48a27b=_[_0x3ec1('0x4f')](_0x2af03f,_0x412a9e);_0x48a27b[_0x3ec1('0xe')]({'type':_0xaebd4c[_0x3ec1('0x6')],'app':_0x3ec1('0x54'),'exten':_0xaebd4c[_0x3ec1('0x7')],'context':_0xaebd4c[_0x3ec1('0xc')],'priority':_['last'](_0x48a27b)[_0x3ec1('0x4d')]+0x1,'VoiceExtensionId':_0xaebd4c['id']});return _0x48a27b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c646f1c..5fcd66e 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 _0x1c75=['http','redis','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceExtension,\x20%s,\x20%s','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5cec85,_0x167ddd){var _0x62c743=function(_0x46ca5f){while(--_0x46ca5f){_0x5cec85['push'](_0x5cec85['shift']());}};_0x62c743(++_0x167ddd);}(_0x1c75,0xce));var _0x51c7=function(_0x153136,_0x2be1b6){_0x153136=_0x153136-0x0;var _0x35abfd=_0x1c75[_0x153136];return _0x35abfd;};'use strict';var _=require(_0x51c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51c7('0x1'));var fs=require('fs');var Redis=require(_0x51c7('0x2'));var db=require(_0x51c7('0x3'))['db'];var utils=require(_0x51c7('0x4'));var logger=require(_0x51c7('0x5'))(_0x51c7('0x6'));var config=require(_0x51c7('0x7'));var jayson=require(_0x51c7('0x8'));var client=jayson[_0x51c7('0x9')][_0x51c7('0xa')]({'port':0x232a});config[_0x51c7('0xb')]=_['defaults'](config[_0x51c7('0xb')],{'host':_0x51c7('0xc'),'port':0x18eb});var socket=require(_0x51c7('0xd'))(new Redis(config[_0x51c7('0xb')]));require('./voiceExtension.socket')[_0x51c7('0xe')](socket);function respondWithRpcPromise(_0x4b02a5,_0x45c45e,_0x5692a7){return new BPromise(function(_0x179902,_0x1830a0){return client['request'](_0x4b02a5,_0x5692a7)[_0x51c7('0xf')](function(_0x115baa){logger[_0x51c7('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x45c45e,'request\x20sent');logger['debug'](_0x51c7('0x11'),_0x45c45e,_0x51c7('0x12'),JSON[_0x51c7('0x13')](_0x115baa));if(_0x115baa['error']){if(_0x115baa[_0x51c7('0x14')]['code']===0x1f4){logger[_0x51c7('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x45c45e,_0x115baa[_0x51c7('0x14')]['message']);return _0x1830a0(_0x115baa[_0x51c7('0x14')][_0x51c7('0x15')]);}logger[_0x51c7('0x14')](_0x51c7('0x16'),_0x45c45e,_0x115baa['error'][_0x51c7('0x15')]);return _0x179902(_0x115baa[_0x51c7('0x14')][_0x51c7('0x15')]);}else{logger[_0x51c7('0x10')](_0x51c7('0x16'),_0x45c45e,_0x51c7('0x12'));_0x179902(_0x115baa['result'][_0x51c7('0x15')]);}})[_0x51c7('0x17')](function(_0x6960a9){logger['error'](_0x51c7('0x16'),_0x45c45e,_0x6960a9);_0x1830a0(_0x6960a9);});});}exports[_0x51c7('0x18')]=function(_0x51f751){var _0x588743=this;return new Promise(function(_0x1fa9d5,_0x1881f3){return db[_0x51c7('0x19')][_0x51c7('0x1a')]({'raw':_0x51f751[_0x51c7('0x1b')]?_0x51f751[_0x51c7('0x1b')][_0x51c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x51f751['options']?_0x51f751[_0x51c7('0x1b')][_0x51c7('0x1d')]||null:null,'attributes':_0x51f751['options']?_0x51f751[_0x51c7('0x1b')]['attributes']||null:null,'limit':_0x51f751[_0x51c7('0x1b')]?_0x51f751[_0x51c7('0x1b')][_0x51c7('0x1e')]||null:null,'include':_0x51f751['options']?_0x51f751[_0x51c7('0x1b')][_0x51c7('0x1f')]?_[_0x51c7('0x20')](_0x51f751[_0x51c7('0x1b')][_0x51c7('0x1f')],function(_0x1c3935){return{'model':db[_0x1c3935['model']],'as':_0x1c3935['as'],'attributes':_0x1c3935[_0x51c7('0x21')],'include':_0x1c3935['include']?_[_0x51c7('0x20')](_0x1c3935[_0x51c7('0x1f')],function(_0x331ad9){return{'model':db[_0x331ad9[_0x51c7('0x22')]],'as':_0x331ad9['as'],'attributes':_0x331ad9[_0x51c7('0x21')],'include':_0x331ad9[_0x51c7('0x1f')]?_[_0x51c7('0x20')](_0x331ad9[_0x51c7('0x1f')],function(_0x42745b){return{'model':db[_0x42745b[_0x51c7('0x22')]],'as':_0x42745b['as'],'attributes':_0x42745b[_0x51c7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x51c7('0xf')](function(_0x59cb23){logger[_0x51c7('0x10')](_0x51c7('0x18'),_0x51f751);logger[_0x51c7('0x23')](_0x51c7('0x18'),_0x51f751,JSON['stringify'](_0x59cb23));_0x1fa9d5(_0x59cb23);})[_0x51c7('0x17')](function(_0x5e90bc){logger[_0x51c7('0x14')](_0x51c7('0x18'),_0x5e90bc[_0x51c7('0x15')],_0x51f751);_0x1881f3(_0x588743['error'](0x1f4,_0x5e90bc[_0x51c7('0x15')]));});});}; \ No newline at end of file +var _0xec46=['stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','attributes','map','model','include','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x1da5f2,_0x40d574){var _0x1bf784=function(_0x1f9c3b){while(--_0x1f9c3b){_0x1da5f2['push'](_0x1da5f2['shift']());}};_0x1bf784(++_0x40d574);}(_0xec46,0x19c));var _0x6ec4=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0xec46[_0x39c684];return _0x3da800;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var moment=require(_0x6ec4('0x2'));var BPromise=require(_0x6ec4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ec4('0x4'))['db'];var utils=require(_0x6ec4('0x5'));var logger=require(_0x6ec4('0x6'))('rpc');var config=require(_0x6ec4('0x7'));var jayson=require(_0x6ec4('0x8'));var client=jayson['client'][_0x6ec4('0x9')]({'port':0x232a});config['redis']=_[_0x6ec4('0xa')](config[_0x6ec4('0xb')],{'host':_0x6ec4('0xc'),'port':0x18eb});var socket=require(_0x6ec4('0xd'))(new Redis(config[_0x6ec4('0xb')]));require(_0x6ec4('0xe'))[_0x6ec4('0xf')](socket);function respondWithRpcPromise(_0x164b81,_0x5e8746,_0x259d07){return new BPromise(function(_0xe51f56,_0x47bfaa){return client['request'](_0x164b81,_0x259d07)[_0x6ec4('0x10')](function(_0x45f738){logger[_0x6ec4('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5e8746,_0x6ec4('0x12'));logger['debug'](_0x6ec4('0x13'),_0x5e8746,'request\x20sent',JSON[_0x6ec4('0x14')](_0x45f738));if(_0x45f738[_0x6ec4('0x15')]){if(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x16')]===0x1f4){logger[_0x6ec4('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x5e8746,_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);return _0x47bfaa(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);}logger[_0x6ec4('0x15')](_0x6ec4('0x18'),_0x5e8746,_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);return _0xe51f56(_0x45f738[_0x6ec4('0x15')][_0x6ec4('0x17')]);}else{logger[_0x6ec4('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5e8746,_0x6ec4('0x12'));_0xe51f56(_0x45f738['result']['message']);}})[_0x6ec4('0x19')](function(_0x49594b){logger[_0x6ec4('0x15')](_0x6ec4('0x18'),_0x5e8746,_0x49594b);_0x47bfaa(_0x49594b);});});}exports[_0x6ec4('0x1a')]=function(_0x591c06){var _0x30b15f=this;return new Promise(function(_0x57da94,_0x574d80){return db[_0x6ec4('0x1b')][_0x6ec4('0x1c')]({'raw':_0x591c06['options']?_0x591c06[_0x6ec4('0x1d')][_0x6ec4('0x1e')]===undefined?!![]:![]:!![],'where':_0x591c06[_0x6ec4('0x1d')]?_0x591c06[_0x6ec4('0x1d')]['where']||null:null,'attributes':_0x591c06[_0x6ec4('0x1d')]?_0x591c06['options']['attributes']||null:null,'limit':_0x591c06[_0x6ec4('0x1d')]?_0x591c06[_0x6ec4('0x1d')][_0x6ec4('0x1f')]||null:null,'include':_0x591c06[_0x6ec4('0x1d')]?_0x591c06[_0x6ec4('0x1d')]['include']?_['map'](_0x591c06[_0x6ec4('0x1d')]['include'],function(_0x1bc94e){return{'model':db[_0x1bc94e['model']],'as':_0x1bc94e['as'],'attributes':_0x1bc94e[_0x6ec4('0x20')],'include':_0x1bc94e['include']?_[_0x6ec4('0x21')](_0x1bc94e['include'],function(_0x48362b){return{'model':db[_0x48362b[_0x6ec4('0x22')]],'as':_0x48362b['as'],'attributes':_0x48362b['attributes'],'include':_0x48362b[_0x6ec4('0x23')]?_[_0x6ec4('0x21')](_0x48362b[_0x6ec4('0x23')],function(_0x51606c){return{'model':db[_0x51606c[_0x6ec4('0x22')]],'as':_0x51606c['as'],'attributes':_0x51606c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ec4('0x10')](function(_0x29cd10){logger[_0x6ec4('0x11')](_0x6ec4('0x1a'),_0x591c06);logger['debug'](_0x6ec4('0x1a'),_0x591c06,JSON[_0x6ec4('0x14')](_0x29cd10));_0x57da94(_0x29cd10);})[_0x6ec4('0x19')](function(_0x441059){logger['error']('GetVoiceExtension',_0x441059[_0x6ec4('0x17')],_0x591c06);_0x574d80(_0x30b15f[_0x6ec4('0x15')](0x1f4,_0x441059['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a5ccbf6..5e4d559 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x220f22,_0x439434){var _0x2619c3=function(_0x2d633e){while(--_0x2d633e){_0x220f22['push'](_0x220f22['shift']());}};_0x2619c3(++_0x439434);}(_0xf494,0x1c6));var _0x4f49=function(_0x5257f6,_0x47f525){_0x5257f6=_0x5257f6-0x0;var _0x4e664a=_0xf494[_0x5257f6];return _0x4e664a;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x4629d8,_0xa9e63e){var _0x4367ee=function(_0x18b052){while(--_0x18b052){_0x4629d8['push'](_0x4629d8['shift']());}};_0x4367ee(++_0xa9e63e);}(_0x1261,0x144));var _0x1126=function(_0x154f21,_0x3c7f37){_0x154f21=_0x154f21-0x0;var _0x5ae16f=_0x1261[_0x154f21];return _0x5ae16f;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 87e1add..9b134fe 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 _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x26b5ce,_0x29880a){var _0x4cb720=function(_0x28e187){while(--_0x28e187){_0x26b5ce['push'](_0x26b5ce['shift']());}};_0x4cb720(++_0x29880a);}(_0x524e,0x15e));var _0xe524=function(_0x54967f,_0x375ffa){_0x54967f=_0x54967f-0x0;var _0x33c374=_0x524e[_0x54967f];return _0x33c374;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4819=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','/:id','show','get','/:id/messages','getMessages','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x365494,_0x3496ba){var _0x4cc0de=function(_0x38f907){while(--_0x38f907){_0x365494['push'](_0x365494['shift']());}};_0x4cc0de(++_0x3496ba);}(_0x4819,0xcd));var _0x9481=function(_0x5c1ade,_0xaa1212){_0x5c1ade=_0x5c1ade-0x0;var _0x4980b4=_0x4819[_0x5c1ade];return _0x4980b4;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['post']('/',auth[_0x9481('0xa')](),controller['create']);router[_0x9481('0x10')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 902e78f..7c6b153 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 _0x5ea2=['INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x5ea2,0x16a));var _0x25ea=function(_0x4372a5,_0x29097d){_0x4372a5=_0x4372a5-0x0;var _0x172be4=_0x5ea2[_0x4372a5];return _0x172be4;};'use strict';var Sequelize=require(_0x25ea('0x0'));module[_0x25ea('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x25ea('0x2')],'defaultValue':_0x25ea('0x3'),'unique':_0x25ea('0x4')},'mailbox':{'type':Sequelize[_0x25ea('0x2')],'defaultValue':'','allowNull':![],'unique':_0x25ea('0x4')},'password':{'type':Sequelize[_0x25ea('0x2')]},'fullname':{'type':Sequelize[_0x25ea('0x2')]},'email':{'type':Sequelize[_0x25ea('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5dec2a){this[_0x25ea('0x5')](_0x25ea('0x6'),typeof _0x5dec2a===_0x25ea('0x7')&&_0x5dec2a[_0x25ea('0x8')]()?_0x5dec2a['trim']():null);}},'pager':{'type':Sequelize[_0x25ea('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x25ea('0x9'),'no'),'defaultValue':_0x25ea('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x25ea('0x2')]},'callback':{'type':Sequelize[_0x25ea('0x2')]},'review':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x25ea('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x25ea('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x25ea('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x25ea('0xa')](_0x25ea('0x9'),'no'),'defaultValue':_0x25ea('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x25ea('0x2')]},'maxsecs':{'type':Sequelize[_0x25ea('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x25ea('0xd')],'get':function(){return this[_0x25ea('0xe')]('fullname')+_0x25ea('0xf')+this[_0x25ea('0xe')](_0x25ea('0x10'));}}}; \ No newline at end of file +var _0x8f5b=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','mailbox'];(function(_0x263f2e,_0x5d327c){var _0x435afd=function(_0x4b2aaf){while(--_0x4b2aaf){_0x263f2e['push'](_0x263f2e['shift']());}};_0x435afd(++_0x5d327c);}(_0x8f5b,0x19e));var _0xb8f5=function(_0x54683b,_0x3f4925){_0x54683b=_0x54683b-0x0;var _0x5b6c5b=_0x8f5b[_0x54683b];return _0x5b6c5b;};'use strict';var Sequelize=require(_0xb8f5('0x0'));module[_0xb8f5('0x1')]={'customer_id':{'type':Sequelize[_0xb8f5('0x2')]},'context':{'type':Sequelize[_0xb8f5('0x2')],'defaultValue':_0xb8f5('0x3'),'unique':_0xb8f5('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xb26b){this[_0xb8f5('0x5')](_0xb8f5('0x6'),typeof _0xb26b===_0xb8f5('0x7')&&_0xb26b[_0xb8f5('0x8')]()?_0xb26b[_0xb8f5('0x8')]():null);}},'pager':{'type':Sequelize[_0xb8f5('0x2')]},'tz':{'type':Sequelize[_0xb8f5('0x2')],'defaultValue':_0xb8f5('0x9')},'attach':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':_0xb8f5('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':_0xb8f5('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb8f5('0x2')]},'callback':{'type':Sequelize[_0xb8f5('0x2')]},'review':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb8f5('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb8f5('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':_0xb8f5('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb8f5('0xa')](_0xb8f5('0xb'),'no'),'defaultValue':_0xb8f5('0xb'),'allowNull':![]},'stamp':{'type':_0xb8f5('0xd')},'emailsubject':{'type':Sequelize[_0xb8f5('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb8f5('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb8f5('0xf')],'get':function(){return this['getDataValue']('fullname')+_0xb8f5('0x10')+this['getDataValue'](_0xb8f5('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 55a42f9..e049b8b 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 _0x0713=['userProfileId','autoAssociation','getMessages','VoiceMailMessage','rawAttributes','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VoiceMail','rows','catch','show','params','keys','fields','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){var _0x2793ef=_0xb05b1d[_0x3071('0x29')]({'plain':!![]});var _0x7a4cb4=_0x3071('0x2a');return db[_0x3071('0x2b')]['destroy']({'where':{'type':_0x7a4cb4,'resourceId':_0x2793ef['id']}})[_0x3071('0x27')](function(){return _0xb05b1d;});})[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb1ca,_0x28792d){return function(_0x163604){if(!_0x163604){_0x4fb1ca[_0x3071('0x2c')](0x194);}return _0x163604;};}function handleError(_0x3fa3b8,_0x25b96b){_0x25b96b=_0x25b96b||0x1f4;return function(_0x177b5f){logger[_0x3071('0x2d')](_0x177b5f[_0x3071('0x2e')]);if(_0x177b5f[_0x3071('0x2f')]){delete _0x177b5f[_0x3071('0x2f')];}_0x3fa3b8['status'](_0x25b96b)['send'](_0x177b5f);};}exports[_0x3071('0x30')]=function(_0x149e0d,_0x6ddf96){var _0x40be95={},_0x3f6d90={},_0x29538c={'count':0x0,'rows':[]};var _0x32b6b1=_[_0x3071('0x31')](db['VoiceMail']['rawAttributes'],function(_0x4ab983){return{'name':_0x4ab983[_0x3071('0x32')],'type':_0x4ab983[_0x3071('0x33')]['key']};});_0x3f6d90[_0x3071('0x34')]=_[_0x3071('0x31')](_0x32b6b1,_0x3071('0x2f'));_0x3f6d90[_0x3071('0x35')]=_['keys'](_0x149e0d[_0x3071('0x35')]);_0x3f6d90[_0x3071('0x36')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],_0x3f6d90[_0x3071('0x35')]);_0x40be95[_0x3071('0x38')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],qs['fields'](_0x149e0d[_0x3071('0x35')]['fields']));_0x40be95['attributes']=_0x40be95[_0x3071('0x38')][_0x3071('0x39')]?_0x40be95['attributes']:_0x3f6d90[_0x3071('0x34')];if(!_0x149e0d[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x40be95[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x149e0d['query'][_0x3071('0x20')]);_0x40be95[_0x3071('0x1e')]=qs['offset'](_0x149e0d[_0x3071('0x35')]['offset']);}_0x40be95[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x149e0d['query']['sort']);_0x40be95[_0x3071('0x3e')]=qs[_0x3071('0x36')](_[_0x3071('0x3f')](_0x149e0d['query'],_0x3f6d90[_0x3071('0x36')]),_0x32b6b1);if(_0x149e0d['query'][_0x3071('0x40')]){_0x40be95['where']=_[_0x3071('0x41')](_0x40be95[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x32b6b1,function(_0x3113ef){if(_0x3113ef[_0x3071('0x33')]!=='VIRTUAL'){var _0x53ed25={};_0x53ed25[_0x3113ef[_0x3071('0x2f')]]={'$like':'%'+_0x149e0d[_0x3071('0x35')][_0x3071('0x40')]+'%'};return _0x53ed25;}})});}_0x40be95=_[_0x3071('0x41')]({},_0x40be95,_0x149e0d['options']);var _0x3cfc05={'where':_0x40be95[_0x3071('0x3e')]};return db[_0x3071('0x42')][_0x3071('0x21')](_0x3cfc05)[_0x3071('0x27')](function(_0xb9a4b8){_0x29538c['count']=_0xb9a4b8;if(_0x149e0d[_0x3071('0x35')]['includeAll']){_0x40be95['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x40be95);})[_0x3071('0x27')](function(_0x1be8b6){_0x29538c[_0x3071('0x43')]=_0x1be8b6;return _0x29538c;})[_0x3071('0x27')](respondWithFilteredResult(_0x6ddf96,_0x40be95))[_0x3071('0x44')](handleError(_0x6ddf96,null));};exports[_0x3071('0x45')]=function(_0xa711b5,_0x2e6c70){var _0x56589e={'raw':!![],'where':{'id':_0xa711b5[_0x3071('0x46')]['id']}},_0x1e8222={};_0x1e8222[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x42')]['rawAttributes']);_0x1e8222['query']=_[_0x3071('0x47')](_0xa711b5[_0x3071('0x35')]);_0x1e8222[_0x3071('0x36')]=_[_0x3071('0x37')](_0x1e8222[_0x3071('0x34')],_0x1e8222['query']);_0x56589e[_0x3071('0x38')]=_['intersection'](_0x1e8222[_0x3071('0x34')],qs['fields'](_0xa711b5['query'][_0x3071('0x48')]));_0x56589e['attributes']=_0x56589e[_0x3071('0x38')]['length']?_0x56589e[_0x3071('0x38')]:_0x1e8222[_0x3071('0x34')];if(_0xa711b5[_0x3071('0x35')][_0x3071('0x49')]){_0x56589e['include']=[{'all':!![]}];}_0x56589e=_[_0x3071('0x41')]({},_0x56589e,_0xa711b5['options']);return db[_0x3071('0x42')]['find'](_0x56589e)[_0x3071('0x27')](handleEntityNotFound(_0x2e6c70,null))[_0x3071('0x27')](respondWithResult(_0x2e6c70,null))['catch'](handleError(_0x2e6c70,null));};exports[_0x3071('0x4a')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x42')][_0x3071('0x4a')](_0x117e73[_0x3071('0x4b')],{})[_0x3071('0x27')](function(_0x577060){var _0x2c6e4c=_0x117e73[_0x3071('0x4c')][_0x3071('0x29')]({'plain':!![]});if(!_0x2c6e4c)throw new Error(_0x3071('0x4d'));if(_0x2c6e4c['role']===_0x3071('0x4c')){var _0x2aea37=_0x577060[_0x3071('0x29')]({'plain':!![]});var _0x2307dd=_0x3071('0x2a');return db[_0x3071('0x4e')][_0x3071('0x4f')]({'where':{'name':_0x2307dd,'userProfileId':_0x2c6e4c[_0x3071('0x50')]},'raw':!![]})[_0x3071('0x27')](function(_0x886f7){if(_0x886f7&&_0x886f7[_0x3071('0x51')]===0x0){return db[_0x3071('0x2b')][_0x3071('0x4a')]({'name':_0x2aea37[_0x3071('0x2f')],'resourceId':_0x2aea37['id'],'type':_0x886f7[_0x3071('0x2f')],'sectionId':_0x886f7['id']},{})[_0x3071('0x27')](function(){return _0x577060;});}else{return _0x577060;}})['catch'](function(_0x47a438){logger[_0x3071('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a438);throw _0x47a438;});}return _0x577060;})[_0x3071('0x27')](respondWithResult(_0x224a70,0xc9))[_0x3071('0x44')](handleError(_0x224a70,null));};exports[_0x3071('0x26')]=function(_0x514821,_0x1ec428){if(_0x514821[_0x3071('0x4b')]['id']){delete _0x514821['body']['id'];}return db['VoiceMail'][_0x3071('0x4f')]({'where':{'id':_0x514821[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1ec428,null))[_0x3071('0x27')](saveUpdates(_0x514821['body'],null))[_0x3071('0x27')](respondWithResult(_0x1ec428,null))[_0x3071('0x44')](handleError(_0x1ec428,null));};exports[_0x3071('0x28')]=function(_0x41f02a,_0x123323){return db['VoiceMail'][_0x3071('0x4f')]({'where':{'id':_0x41f02a[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x123323,null))[_0x3071('0x27')](removeEntity(_0x123323,null))[_0x3071('0x44')](handleError(_0x123323,null));};exports[_0x3071('0x52')]=function(_0x71d921,_0x4bea5d,_0x4d6ed0){return db[_0x3071('0x42')]['findOne']({'where':{'id':_0x71d921[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x4bea5d,null))['then'](function(_0x19dc95){var _0x1bf911;var _0x4d3886={},_0x108b14={};_0x108b14[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x53')][_0x3071('0x54')]);_0x108b14['query']=_[_0x3071('0x47')](_0x71d921[_0x3071('0x35')]);_0x108b14[_0x3071('0x36')]=_['intersection'](_0x108b14[_0x3071('0x34')],_0x108b14[_0x3071('0x35')]);_0x4d3886[_0x3071('0x38')]=_[_0x3071('0x37')](_0x108b14[_0x3071('0x34')],qs[_0x3071('0x48')](_0x71d921[_0x3071('0x35')][_0x3071('0x48')]));_0x4d3886[_0x3071('0x38')]=_0x4d3886['attributes'][_0x3071('0x39')]?_0x4d3886[_0x3071('0x38')]:_0x108b14[_0x3071('0x34')];if(!_0x71d921[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x4d3886[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x71d921[_0x3071('0x35')][_0x3071('0x20')]);_0x4d3886[_0x3071('0x1e')]=qs['offset'](_0x71d921[_0x3071('0x35')][_0x3071('0x1e')]);}_0x4d3886[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x71d921[_0x3071('0x35')][_0x3071('0x3d')]);_0x4d3886[_0x3071('0x3e')]=qs[_0x3071('0x36')](_['pick'](_0x71d921[_0x3071('0x35')],_0x108b14[_0x3071('0x36')]));if(_0x71d921['query']['filter']){_0x4d3886[_0x3071('0x3e')]=_[_0x3071('0x41')](_0x4d3886[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x4d3886['attributes'],function(_0x52955a){var _0x33c39a={};_0x33c39a[_0x52955a]={'$like':'%'+_0x71d921['query']['filter']+'%'};return _0x33c39a;})});}_0x4d3886['where']=_['merge'](_0x4d3886[_0x3071('0x3e')],{'mailboxuser':_0x19dc95[_0x3071('0x55')]});_0x4d3886=_[_0x3071('0x41')]({},_0x4d3886,_0x71d921['options']);return db[_0x3071('0x53')][_0x3071('0x56')](_0x4d3886)[_0x3071('0x27')](respondWithFilteredResult(_0x4bea5d,_0x4d3886));})[_0x3071('0x44')](handleError(_0x4bea5d,null));}; \ No newline at end of file +var _0x0102=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','get','Voicemails','destroy','then','sendStatus','stack','name','send','index','VoiceMail'];(function(_0x21955e,_0x4d06f9){var _0x2b76af=function(_0x4adad8){while(--_0x4adad8){_0x21955e['push'](_0x21955e['shift']());}};_0x2b76af(++_0x4d06f9);}(_0x0102,0x186));var _0x2010=function(_0x3641d9,_0x25e421){_0x3641d9=_0x3641d9-0x0;var _0x893fd0=_0x0102[_0x3641d9];return _0x893fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){var _0xdb57be=_0x277dcc[_0x2010('0x23')]({'plain':!![]});var _0x52b4fe=_0x2010('0x24');return db['UserProfileResource'][_0x2010('0x25')]({'where':{'type':_0x52b4fe,'resourceId':_0xdb57be['id']}})[_0x2010('0x26')](function(){return _0x277dcc;});})[_0x2010('0x26')](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x2f63bb,_0x981b65){return function(_0x3eb4dc){if(!_0x3eb4dc){_0x2f63bb[_0x2010('0x27')](0x194);}return _0x3eb4dc;};}function handleError(_0x103460,_0x122ee3){_0x122ee3=_0x122ee3||0x1f4;return function(_0x2ebdbb){logger['error'](_0x2ebdbb[_0x2010('0x28')]);if(_0x2ebdbb['name']){delete _0x2ebdbb[_0x2010('0x29')];}_0x103460[_0x2010('0x19')](_0x122ee3)[_0x2010('0x2a')](_0x2ebdbb);};}exports[_0x2010('0x2b')]=function(_0x564a64,_0x554f66){var _0x136d5f={},_0x48d9f2={},_0x2839f2={'count':0x0,'rows':[]};var _0x1d5d7a=_['map'](db[_0x2010('0x2c')][_0x2010('0x2d')],function(_0x2b1ff7){return{'name':_0x2b1ff7[_0x2010('0x2e')],'type':_0x2b1ff7[_0x2010('0x2f')]['key']};});_0x48d9f2[_0x2010('0x30')]=_[_0x2010('0x31')](_0x1d5d7a,_0x2010('0x29'));_0x48d9f2['query']=_['keys'](_0x564a64[_0x2010('0x32')]);_0x48d9f2[_0x2010('0x33')]=_[_0x2010('0x34')](_0x48d9f2['model'],_0x48d9f2['query']);_0x136d5f[_0x2010('0x35')]=_[_0x2010('0x34')](_0x48d9f2[_0x2010('0x30')],qs[_0x2010('0x36')](_0x564a64[_0x2010('0x32')]['fields']));_0x136d5f['attributes']=_0x136d5f['attributes'][_0x2010('0x37')]?_0x136d5f[_0x2010('0x35')]:_0x48d9f2[_0x2010('0x30')];if(!_0x564a64['query'][_0x2010('0x38')](_0x2010('0x39'))){_0x136d5f[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x564a64['query'][_0x2010('0x1d')]);_0x136d5f[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x564a64['query'][_0x2010('0x1b')]);}_0x136d5f['order']=qs[_0x2010('0x3a')](_0x564a64[_0x2010('0x32')][_0x2010('0x3a')]);_0x136d5f[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x564a64['query'],_0x48d9f2[_0x2010('0x33')]),_0x1d5d7a);if(_0x564a64['query'][_0x2010('0x3d')]){_0x136d5f[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x136d5f[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x1d5d7a,function(_0x1f053c){if(_0x1f053c[_0x2010('0x2f')]!==_0x2010('0x3f')){var _0x2fcaef={};_0x2fcaef[_0x1f053c[_0x2010('0x29')]]={'$like':'%'+_0x564a64[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x2fcaef;}})});}_0x136d5f=_[_0x2010('0x3e')]({},_0x136d5f,_0x564a64[_0x2010('0x40')]);var _0x4b6251={'where':_0x136d5f['where']};return db[_0x2010('0x2c')][_0x2010('0x1e')](_0x4b6251)[_0x2010('0x26')](function(_0x35d631){_0x2839f2[_0x2010('0x1e')]=_0x35d631;if(_0x564a64[_0x2010('0x32')][_0x2010('0x41')]){_0x136d5f['include']=[{'all':!![]}];}return db[_0x2010('0x2c')]['findAll'](_0x136d5f);})[_0x2010('0x26')](function(_0x3ff496){_0x2839f2[_0x2010('0x42')]=_0x3ff496;return _0x2839f2;})[_0x2010('0x26')](respondWithFilteredResult(_0x554f66,_0x136d5f))[_0x2010('0x43')](handleError(_0x554f66,null));};exports['show']=function(_0x364338,_0x71eb35){var _0x3dd83c={'raw':!![],'where':{'id':_0x364338['params']['id']}},_0x41b3b5={};_0x41b3b5[_0x2010('0x30')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x41b3b5[_0x2010('0x32')]=_[_0x2010('0x44')](_0x364338[_0x2010('0x32')]);_0x41b3b5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],_0x41b3b5['query']);_0x3dd83c[_0x2010('0x35')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],qs['fields'](_0x364338['query'][_0x2010('0x36')]));_0x3dd83c['attributes']=_0x3dd83c[_0x2010('0x35')][_0x2010('0x37')]?_0x3dd83c[_0x2010('0x35')]:_0x41b3b5[_0x2010('0x30')];if(_0x364338['query'][_0x2010('0x41')]){_0x3dd83c[_0x2010('0x45')]=[{'all':!![]}];}_0x3dd83c=_[_0x2010('0x3e')]({},_0x3dd83c,_0x364338[_0x2010('0x40')]);return db[_0x2010('0x2c')][_0x2010('0x46')](_0x3dd83c)['then'](handleEntityNotFound(_0x71eb35,null))[_0x2010('0x26')](respondWithResult(_0x71eb35,null))[_0x2010('0x43')](handleError(_0x71eb35,null));};exports[_0x2010('0x47')]=function(_0x4dc0cf,_0x30e5d0){return db[_0x2010('0x2c')]['create'](_0x4dc0cf[_0x2010('0x48')],{})[_0x2010('0x26')](function(_0x110791){var _0x242274=_0x4dc0cf[_0x2010('0x49')][_0x2010('0x23')]({'plain':!![]});if(!_0x242274)throw new Error(_0x2010('0x4a'));if(_0x242274[_0x2010('0x4b')]==='user'){var _0x5258b9=_0x110791[_0x2010('0x23')]({'plain':!![]});var _0xe1721f='Voicemails';return db[_0x2010('0x4c')][_0x2010('0x46')]({'where':{'name':_0xe1721f,'userProfileId':_0x242274[_0x2010('0x4d')]},'raw':!![]})[_0x2010('0x26')](function(_0x1f1a59){if(_0x1f1a59&&_0x1f1a59['autoAssociation']===0x0){return db['UserProfileResource'][_0x2010('0x47')]({'name':_0x5258b9[_0x2010('0x29')],'resourceId':_0x5258b9['id'],'type':_0x1f1a59[_0x2010('0x29')],'sectionId':_0x1f1a59['id']},{})[_0x2010('0x26')](function(){return _0x110791;});}else{return _0x110791;}})[_0x2010('0x43')](function(_0x2d8164){logger[_0x2010('0x4e')](_0x2010('0x4f'),_0x2d8164);throw _0x2d8164;});}return _0x110791;})[_0x2010('0x26')](respondWithResult(_0x30e5d0,0xc9))[_0x2010('0x43')](handleError(_0x30e5d0,null));};exports[_0x2010('0x50')]=function(_0x5313b5,_0x24421a){if(_0x5313b5[_0x2010('0x48')]['id']){delete _0x5313b5['body']['id'];}return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x5313b5[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x24421a,null))[_0x2010('0x26')](saveUpdates(_0x5313b5[_0x2010('0x48')],null))[_0x2010('0x26')](respondWithResult(_0x24421a,null))[_0x2010('0x43')](handleError(_0x24421a,null));};exports[_0x2010('0x25')]=function(_0x2dbc2c,_0x1c0b2d){return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x2dbc2c[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x1c0b2d,null))[_0x2010('0x26')](removeEntity(_0x1c0b2d,null))[_0x2010('0x43')](handleError(_0x1c0b2d,null));};exports[_0x2010('0x52')]=function(_0x2d7765,_0x6f8565,_0x21ee87){return db[_0x2010('0x2c')][_0x2010('0x53')]({'where':{'id':_0x2d7765['params']['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x6f8565,null))['then'](function(_0x5253d5){var _0x1225d7;var _0x13f33d={},_0x4fb5d5={};_0x4fb5d5[_0x2010('0x30')]=_[_0x2010('0x44')](db[_0x2010('0x54')][_0x2010('0x2d')]);_0x4fb5d5['query']=_[_0x2010('0x44')](_0x2d7765[_0x2010('0x32')]);_0x4fb5d5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x4fb5d5['model'],_0x4fb5d5[_0x2010('0x32')]);_0x13f33d['attributes']=_[_0x2010('0x34')](_0x4fb5d5[_0x2010('0x30')],qs[_0x2010('0x36')](_0x2d7765[_0x2010('0x32')]['fields']));_0x13f33d['attributes']=_0x13f33d[_0x2010('0x35')][_0x2010('0x37')]?_0x13f33d['attributes']:_0x4fb5d5['model'];if(!_0x2d7765[_0x2010('0x32')][_0x2010('0x38')](_0x2010('0x39'))){_0x13f33d[_0x2010('0x1d')]=qs['limit'](_0x2d7765[_0x2010('0x32')]['limit']);_0x13f33d[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x2d7765[_0x2010('0x32')][_0x2010('0x1b')]);}_0x13f33d['order']=qs[_0x2010('0x3a')](_0x2d7765[_0x2010('0x32')]['sort']);_0x13f33d[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x2d7765[_0x2010('0x32')],_0x4fb5d5[_0x2010('0x33')]));if(_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]){_0x13f33d[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x13f33d[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x13f33d[_0x2010('0x35')],function(_0x4ebdca){var _0x3ca7b3={};_0x3ca7b3[_0x4ebdca]={'$like':'%'+_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x3ca7b3;})});}_0x13f33d['where']=_['merge'](_0x13f33d[_0x2010('0x3b')],{'mailboxuser':_0x5253d5[_0x2010('0x55')]});_0x13f33d=_[_0x2010('0x3e')]({},_0x13f33d,_0x2d7765[_0x2010('0x40')]);return db[_0x2010('0x54')][_0x2010('0x56')](_0x13f33d)['then'](respondWithFilteredResult(_0x6f8565,_0x13f33d));})[_0x2010('0x43')](handleError(_0x6f8565,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c5757b2..c32a3ef 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 _0xb1f7=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x373293,_0x3115c1){var _0x3bcef2=function(_0x15b13c){while(--_0x15b13c){_0x373293['push'](_0x373293['shift']());}};_0x3bcef2(++_0x3115c1);}(_0xb1f7,0x1bf));var _0x7b1f=function(_0x4883e5,_0x2d1fa5){_0x4883e5=_0x4883e5-0x0;var _0x1f8eca=_0xb1f7[_0x4883e5];return _0x1f8eca;};'use strict';var _=require(_0x7b1f('0x0'));var util=require('util');var logger=require(_0x7b1f('0x1'))(_0x7b1f('0x2'));var moment=require(_0x7b1f('0x3'));var BPromise=require(_0x7b1f('0x4'));var rp=require(_0x7b1f('0x5'));var fs=require('fs');var path=require(_0x7b1f('0x6'));var rimraf=require(_0x7b1f('0x7'));var config=require(_0x7b1f('0x8'));var attributes=require(_0x7b1f('0x9'));module[_0x7b1f('0xa')]=function(_0xd2e773,_0x58ca10){return _0xd2e773[_0x7b1f('0xb')](_0x7b1f('0xc'),attributes,{'tableName':_0x7b1f('0xd'),'paranoid':![],'indexes':[{'name':_0x7b1f('0xe'),'fields':[_0x7b1f('0xf'),_0x7b1f('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2484=['context','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x2484,0x16d));var _0x4248=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x2484[_0x644560];return _0x41b76b;};'use strict';var _=require(_0x4248('0x0'));var util=require(_0x4248('0x1'));var logger=require(_0x4248('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4248('0x3'));var rp=require(_0x4248('0x4'));var fs=require('fs');var path=require(_0x4248('0x5'));var rimraf=require(_0x4248('0x6'));var config=require('../../config/environment');var attributes=require(_0x4248('0x7'));module['exports']=function(_0x2bc560,_0x58501d){return _0x2bc560[_0x4248('0x8')](_0x4248('0x9'),attributes,{'tableName':_0x4248('0xa'),'paranoid':![],'indexes':[{'name':_0x4248('0xb'),'fields':[_0x4248('0xc'),_0x4248('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a2e9e73..0bc4967 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 _0x6b1c=['rpc','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4685cc,_0xf037d2){var _0x9a0e45=function(_0x395f5b){while(--_0x395f5b){_0x4685cc['push'](_0x4685cc['shift']());}};_0x9a0e45(++_0xf037d2);}(_0x6b1c,0x19e));var _0xc6b1=function(_0x2c90fd,_0x243deb){_0x2c90fd=_0x2c90fd-0x0;var _0x572106=_0x6b1c[_0x2c90fd];return _0x572106;};'use strict';var _=require('lodash');var util=require(_0xc6b1('0x0'));var moment=require('moment');var BPromise=require(_0xc6b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6b1('0x2'));var db=require(_0xc6b1('0x3'))['db'];var utils=require(_0xc6b1('0x4'));var logger=require(_0xc6b1('0x5'))(_0xc6b1('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6b1('0x7'));var client=jayson[_0xc6b1('0x8')][_0xc6b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa5e0d6,_0x195e61,_0x46f2eb){return new BPromise(function(_0x1bf9fe,_0x3d46a6){return client[_0xc6b1('0xa')](_0xa5e0d6,_0x46f2eb)['then'](function(_0x36a619){logger['info'](_0xc6b1('0xb'),_0x195e61,_0xc6b1('0xc'));logger[_0xc6b1('0xd')](_0xc6b1('0xe'),_0x195e61,'request\x20sent',JSON[_0xc6b1('0xf')](_0x36a619));if(_0x36a619[_0xc6b1('0x10')]){if(_0x36a619['error']['code']===0x1f4){logger['error'](_0xc6b1('0xb'),_0x195e61,_0x36a619[_0xc6b1('0x10')]['message']);return _0x3d46a6(_0x36a619[_0xc6b1('0x10')][_0xc6b1('0x11')]);}logger['error'](_0xc6b1('0xb'),_0x195e61,_0x36a619[_0xc6b1('0x10')][_0xc6b1('0x11')]);return _0x1bf9fe(_0x36a619['error'][_0xc6b1('0x11')]);}else{logger[_0xc6b1('0x12')]('VoiceMail,\x20%s,\x20%s',_0x195e61,_0xc6b1('0xc'));_0x1bf9fe(_0x36a619[_0xc6b1('0x13')][_0xc6b1('0x11')]);}})[_0xc6b1('0x14')](function(_0x43725f){logger['error']('VoiceMail,\x20%s,\x20%s',_0x195e61,_0x43725f);_0x3d46a6(_0x43725f);});});} \ No newline at end of file +var _0x2955=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s'];(function(_0xa9fe1b,_0x4dcf36){var _0x3d33c3=function(_0x56a188){while(--_0x56a188){_0xa9fe1b['push'](_0xa9fe1b['shift']());}};_0x3d33c3(++_0x4dcf36);}(_0x2955,0x70));var _0x5295=function(_0x5a64d8,_0x3a426a){_0x5a64d8=_0x5a64d8-0x0;var _0x13d3c9=_0x2955[_0x5a64d8];return _0x13d3c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5295('0x0'));var BPromise=require(_0x5295('0x1'));var rs=require(_0x5295('0x2'));var fs=require('fs');var Redis=require(_0x5295('0x3'));var db=require(_0x5295('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5295('0x5'))(_0x5295('0x6'));var config=require(_0x5295('0x7'));var jayson=require(_0x5295('0x8'));var client=jayson[_0x5295('0x9')][_0x5295('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29e616,_0x18add5,_0x10c048){return new BPromise(function(_0x15f725,_0x4992a){return client[_0x5295('0xb')](_0x29e616,_0x10c048)['then'](function(_0x26fbbc){logger[_0x5295('0xc')](_0x5295('0xd'),_0x18add5,_0x5295('0xe'));logger[_0x5295('0xf')](_0x5295('0x10'),_0x18add5,'request\x20sent',JSON[_0x5295('0x11')](_0x26fbbc));if(_0x26fbbc[_0x5295('0x12')]){if(_0x26fbbc[_0x5295('0x12')]['code']===0x1f4){logger[_0x5295('0x12')]('VoiceMail,\x20%s,\x20%s',_0x18add5,_0x26fbbc['error'][_0x5295('0x13')]);return _0x4992a(_0x26fbbc[_0x5295('0x12')][_0x5295('0x13')]);}logger[_0x5295('0x12')]('VoiceMail,\x20%s,\x20%s',_0x18add5,_0x26fbbc['error']['message']);return _0x15f725(_0x26fbbc[_0x5295('0x12')][_0x5295('0x13')]);}else{logger[_0x5295('0xc')](_0x5295('0xd'),_0x18add5,_0x5295('0xe'));_0x15f725(_0x26fbbc[_0x5295('0x14')][_0x5295('0x13')]);}})['catch'](function(_0x6ad677){logger[_0x5295('0x12')]('VoiceMail,\x20%s,\x20%s',_0x18add5,_0x6ad677);_0x4992a(_0x6ad677);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 94b2fbd..6c11925 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 _0x9d36=['create','put','update','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','show','isAuthenticated','download'];(function(_0x5373fa,_0x22c676){var _0x101a95=function(_0x18b561){while(--_0x18b561){_0x5373fa['push'](_0x5373fa['shift']());}};_0x101a95(++_0x22c676);}(_0x9d36,0xe5));var _0x69d3=function(_0x403e99,_0x3254b2){_0x403e99=_0x403e99-0x0;var _0x5ba086=_0x9d36[_0x403e99];return _0x5ba086;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x69d3('0x0'));var timeout=require(_0x69d3('0x1'));var express=require('express');var router=express[_0x69d3('0x2')]();var fs_extra=require(_0x69d3('0x3'));var auth=require(_0x69d3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x69d3('0x5')]('/',auth['isAuthenticated'](),controller[_0x69d3('0x6')]);router[_0x69d3('0x5')](_0x69d3('0x7'),auth['isAuthenticated'](),controller[_0x69d3('0x8')]);router[_0x69d3('0x5')]('/:id/download',auth[_0x69d3('0x9')](),controller[_0x69d3('0xa')]);router['post']('/',auth[_0x69d3('0x9')](),controller[_0x69d3('0xb')]);router[_0x69d3('0xc')](_0x69d3('0x7'),auth[_0x69d3('0x9')](),controller[_0x69d3('0xd')]);router[_0x69d3('0xe')](_0x69d3('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb6bf=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update','delete','destroy','exports','util'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xb6bf,0x89));var _0xfb6b=function(_0x4c4c9f,_0x3f5603){_0x4c4c9f=_0x4c4c9f-0x0;var _0x578758=_0xb6bf[_0x4c4c9f];return _0x578758;};'use strict';var multer=require('multer');var util=require(_0xfb6b('0x0'));var path=require(_0xfb6b('0x1'));var timeout=require(_0xfb6b('0x2'));var express=require(_0xfb6b('0x3'));var router=express[_0xfb6b('0x4')]();var fs_extra=require(_0xfb6b('0x5'));var auth=require(_0xfb6b('0x6'));var interaction=require(_0xfb6b('0x7'));var config=require(_0xfb6b('0x8'));var controller=require(_0xfb6b('0x9'));router[_0xfb6b('0xa')]('/',auth[_0xfb6b('0xb')](),controller[_0xfb6b('0xc')]);router['get'](_0xfb6b('0xd'),auth[_0xfb6b('0xb')](),controller[_0xfb6b('0xe')]);router[_0xfb6b('0xa')]('/:id/download',auth[_0xfb6b('0xb')](),controller[_0xfb6b('0xf')]);router[_0xfb6b('0x10')]('/',auth[_0xfb6b('0xb')](),controller[_0xfb6b('0x11')]);router[_0xfb6b('0x12')]('/:id',auth[_0xfb6b('0xb')](),controller[_0xfb6b('0x13')]);router[_0xfb6b('0x14')](_0xfb6b('0xd'),auth['isAuthenticated'](),controller[_0xfb6b('0x15')]);module[_0xfb6b('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 67ea799..4e8a5f2 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 _0xd7d8=['exports','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd7d8,0x17a));var _0x8d7d=function(_0x168928,_0x49e53d){_0x168928=_0x168928-0x0;var _0x33d81c=_0xd7d8[_0x168928];return _0x33d81c;};'use strict';var Sequelize=require('sequelize');module[_0x8d7d('0x0')]={'name':{'type':Sequelize[_0x8d7d('0x1')],'get':function(_0x3273c9){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8d7d('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8d7d('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x8d7d('0x4')](_0x8d7d('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8d7d('0x6'),'defaultValue':Sequelize[_0x8d7d('0x7')](_0x8d7d('0x8'))}}; \ No newline at end of file +var _0x592c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB','long'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x592c,0x1ac));var _0xc592=function(_0xc2daf7,_0x2da9c7){_0xc2daf7=_0xc2daf7-0x0;var _0x473501=_0x592c[_0xc2daf7];return _0x473501;};'use strict';var Sequelize=require(_0xc592('0x0'));module['exports']={'name':{'type':Sequelize[_0xc592('0x1')],'get':function(_0x4f126a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xc592('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xc592('0x4')](_0xc592('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc592('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xc592('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 792d0a4..a2e315c 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 _0x73ab=['attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','request-promise','moment','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','send','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','keys','includeAll','include','find','create','body','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found'];(function(_0x70e8fb,_0x388bb9){var _0x50917e=function(_0x928822){while(--_0x928822){_0x70e8fb['push'](_0x70e8fb['shift']());}};_0x50917e(++_0x388bb9);}(_0x73ab,0x1d2));var _0xb73a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x73ab[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb73a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb73a('0x1'));var moment=require(_0xb73a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb73a('0x3'));var path=require('path');var sox=require(_0xb73a('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb73a('0x5'));var _=require(_0xb73a('0x6'));var squel=require(_0xb73a('0x7'));var crypto=require('crypto');var jsforce=require(_0xb73a('0x8'));var deskjs=require(_0xb73a('0x9'));var toCsv=require(_0xb73a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb73a('0xb'));var qs=require(_0xb73a('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb73a('0xd'));var logger=require('../../config/logger')(_0xb73a('0xe'));var utils=require(_0xb73a('0xf'));var config=require(_0xb73a('0x10'));var licenseUtil=require(_0xb73a('0x11'));var db=require(_0xb73a('0x12'))['db'];function respondWithStatusCode(_0x5d89d6,_0x340a6f){_0x340a6f=_0x340a6f||0xcc;return function(_0x11b98e){if(_0x11b98e){return _0x5d89d6[_0xb73a('0x13')](_0x340a6f);}return _0x5d89d6[_0xb73a('0x14')](_0x340a6f)['end']();};}function respondWithResult(_0x5eacbf,_0x337926){_0x337926=_0x337926||0xc8;return function(_0x2b61ef){if(_0x2b61ef){return _0x5eacbf[_0xb73a('0x14')](_0x337926)[_0xb73a('0x15')](_0x2b61ef);}};}function respondWithFilteredResult(_0x5108a6,_0x3fcf78){return function(_0x2cf2ed){if(_0x2cf2ed){var _0x58c0d6=typeof _0x3fcf78[_0xb73a('0x16')]===_0xb73a('0x17')&&typeof _0x3fcf78['limit']===_0xb73a('0x17');var _0x3982a8=_0x2cf2ed[_0xb73a('0x18')];var _0x2f0f96=_0x58c0d6?0x0:_0x3fcf78[_0xb73a('0x16')];var _0x2fef52=_0x58c0d6?_0x2cf2ed['count']:_0x3fcf78[_0xb73a('0x16')]+_0x3fcf78[_0xb73a('0x19')];var _0x31a9f7;if(_0x2fef52>=_0x3982a8){_0x2fef52=_0x3982a8;_0x31a9f7=0xc8;}else{_0x31a9f7=0xce;}_0x5108a6[_0xb73a('0x14')](_0x31a9f7);return _0x5108a6[_0xb73a('0x1a')](_0xb73a('0x1b'),_0x2f0f96+'-'+_0x2fef52+'/'+_0x3982a8)['json'](_0x2cf2ed);}return null;};}function patchUpdates(_0x11879f){return function(_0x3b909b){try{jsonpatch['apply'](_0x3b909b,_0x11879f,!![]);}catch(_0x5525ac){return BPromise[_0xb73a('0x1c')](_0x5525ac);}return _0x3b909b[_0xb73a('0x1d')]();};}function saveUpdates(_0x5c7fef,_0x55416b){return function(_0x709fc3){if(_0x709fc3){return _0x709fc3[_0xb73a('0x1e')](_0x5c7fef)[_0xb73a('0x1f')](function(_0x3d3adf){return _0x3d3adf;});}return null;};}function removeEntity(_0xdcbb9e,_0x152441){return function(_0x2ce4de){if(_0x2ce4de){return _0x2ce4de[_0xb73a('0x20')]()[_0xb73a('0x1f')](function(){_0xdcbb9e['status'](0xcc)[_0xb73a('0x21')]();});}};}function handleEntityNotFound(_0x203766,_0x4aad52){return function(_0x5f1111){if(!_0x5f1111){_0x203766[_0xb73a('0x13')](0x194);}return _0x5f1111;};}function handleError(_0xfb4671,_0x4e54c5){_0x4e54c5=_0x4e54c5||0x1f4;return function(_0x3df5c1){logger[_0xb73a('0x22')](_0x3df5c1['stack']);if(_0x3df5c1['name']){delete _0x3df5c1['name'];}_0xfb4671['status'](_0x4e54c5)[_0xb73a('0x23')](_0x3df5c1);};}exports[_0xb73a('0x24')]=function(_0x18061d,_0x5f1c3a){var _0x339595={},_0x31570f={},_0x4c245f={'count':0x0,'rows':[]};var _0x2cbad4=_[_0xb73a('0x25')](db[_0xb73a('0x26')]['rawAttributes'],function(_0x49b3ab){return{'name':_0x49b3ab[_0xb73a('0x27')],'type':_0x49b3ab[_0xb73a('0x28')][_0xb73a('0x29')]};});_0x31570f[_0xb73a('0x2a')]=_[_0xb73a('0x2b')](_['map'](_0x2cbad4,'name'),['name']);_0x31570f[_0xb73a('0x2c')]=_['keys'](_0x18061d['query']);_0x31570f[_0xb73a('0x2d')]=_[_0xb73a('0x2e')](_0x31570f[_0xb73a('0x2a')],_0x31570f[_0xb73a('0x2c')]);_0x339595[_0xb73a('0x2f')]=_['intersection'](_0x31570f[_0xb73a('0x2a')],qs[_0xb73a('0x30')](_0x18061d['query'][_0xb73a('0x30')]));_0x339595[_0xb73a('0x2f')]=_0x339595[_0xb73a('0x2f')][_0xb73a('0x31')]?_0x339595[_0xb73a('0x2f')]:_0x31570f[_0xb73a('0x2a')];if(!_0x18061d['query']['hasOwnProperty']('nolimit')){_0x339595[_0xb73a('0x19')]=qs[_0xb73a('0x19')](_0x18061d['query']['limit']);_0x339595[_0xb73a('0x16')]=qs[_0xb73a('0x16')](_0x18061d[_0xb73a('0x2c')][_0xb73a('0x16')]);}_0x339595[_0xb73a('0x32')]=qs[_0xb73a('0x33')](_0x18061d[_0xb73a('0x2c')][_0xb73a('0x33')]);_0x339595[_0xb73a('0x34')]=qs['filters'](_[_0xb73a('0x35')](_0x18061d[_0xb73a('0x2c')],_0x31570f['filters']),_0x2cbad4);if(_0x18061d[_0xb73a('0x2c')][_0xb73a('0x36')]){_0x339595[_0xb73a('0x34')]=_[_0xb73a('0x37')](_0x339595[_0xb73a('0x34')],{'$or':_[_0xb73a('0x25')](_0x2cbad4,function(_0x18cd5f){if(_0x18cd5f[_0xb73a('0x28')]!==_0xb73a('0x38')){var _0x412cbf={};_0x412cbf[_0x18cd5f['name']]={'$like':'%'+_0x18061d['query'][_0xb73a('0x36')]+'%'};return _0x412cbf;}})});}_0x339595=_[_0xb73a('0x37')]({},_0x339595,_0x18061d[_0xb73a('0x39')]);var _0x3c56c5={'where':_0x339595[_0xb73a('0x34')]};return db[_0xb73a('0x26')][_0xb73a('0x18')](_0x3c56c5)['then'](function(_0x22d419){_0x4c245f[_0xb73a('0x18')]=_0x22d419;if(_0x18061d[_0xb73a('0x2c')]['includeAll']){_0x339595['include']=[{'all':!![]}];}return db[_0xb73a('0x26')]['findAll'](_0x339595);})[_0xb73a('0x1f')](function(_0x45e431){_0x4c245f[_0xb73a('0x3a')]=_0x45e431;return _0x4c245f;})[_0xb73a('0x1f')](respondWithFilteredResult(_0x5f1c3a,_0x339595))[_0xb73a('0x3b')](handleError(_0x5f1c3a,null));};exports[_0xb73a('0x3c')]=function(_0x21a2ac,_0x2caae6){var _0x3ada8={'raw':!![],'where':{'id':_0x21a2ac['params']['id']}},_0x380ef1={};_0x380ef1['model']=_[_0xb73a('0x3d')](db[_0xb73a('0x26')]['rawAttributes']);_0x380ef1[_0xb73a('0x2c')]=_[_0xb73a('0x3d')](_0x21a2ac[_0xb73a('0x2c')]);_0x380ef1[_0xb73a('0x2d')]=_[_0xb73a('0x2e')](_0x380ef1[_0xb73a('0x2a')],_0x380ef1[_0xb73a('0x2c')]);_0x3ada8[_0xb73a('0x2f')]=_[_0xb73a('0x2e')](_0x380ef1[_0xb73a('0x2a')],qs[_0xb73a('0x30')](_0x21a2ac['query'][_0xb73a('0x30')]));_0x3ada8['attributes']=_0x3ada8[_0xb73a('0x2f')]['length']?_0x3ada8[_0xb73a('0x2f')]:_0x380ef1[_0xb73a('0x2a')];if(_0x21a2ac[_0xb73a('0x2c')][_0xb73a('0x3e')]){_0x3ada8[_0xb73a('0x3f')]=[{'all':!![]}];}_0x3ada8=_[_0xb73a('0x37')]({},_0x3ada8,_0x21a2ac[_0xb73a('0x39')]);return db[_0xb73a('0x26')][_0xb73a('0x40')](_0x3ada8)[_0xb73a('0x1f')](handleEntityNotFound(_0x2caae6,null))[_0xb73a('0x1f')](respondWithResult(_0x2caae6,null))[_0xb73a('0x3b')](handleError(_0x2caae6,null));};exports[_0xb73a('0x41')]=function(_0x34b9fd,_0x1d97d0){return db['VoiceMailMessage'][_0xb73a('0x41')](_0x34b9fd[_0xb73a('0x42')],{})['then'](respondWithResult(_0x1d97d0,0xc9))[_0xb73a('0x3b')](handleError(_0x1d97d0,null));};exports[_0xb73a('0x1e')]=function(_0x4b6870,_0x24e057){if(_0x4b6870[_0xb73a('0x42')]['id']){delete _0x4b6870['body']['id'];}return db[_0xb73a('0x26')][_0xb73a('0x40')]({'where':{'id':_0x4b6870[_0xb73a('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e057,null))[_0xb73a('0x1f')](saveUpdates(_0x4b6870[_0xb73a('0x42')],null))[_0xb73a('0x1f')](respondWithResult(_0x24e057,null))[_0xb73a('0x3b')](handleError(_0x24e057,null));};exports[_0xb73a('0x20')]=function(_0x59e2d6,_0xc2ec){return db[_0xb73a('0x26')][_0xb73a('0x40')]({'where':{'id':_0x59e2d6[_0xb73a('0x43')]['id']}})[_0xb73a('0x1f')](handleEntityNotFound(_0xc2ec,null))[_0xb73a('0x1f')](removeEntity(_0xc2ec,null))['catch'](handleError(_0xc2ec,null));};exports['download']=function(_0x4d1f49,_0x82c307,_0x5d5a22){return db[_0xb73a('0x26')][_0xb73a('0x40')]({'where':{'id':_0x4d1f49[_0xb73a('0x43')]['id']},'attributes':['id',_0xb73a('0x44'),_0xb73a('0x45')]})[_0xb73a('0x1f')](handleEntityNotFound(_0x82c307,null))['then'](function(_0x515ffd){if(_0x515ffd){if(!_0x515ffd[_0xb73a('0x44')]){throw new db[(_0xb73a('0x46'))][(_0xb73a('0x47'))](_0xb73a('0x48'));}var _0x8d4a90={'Content-Type':'audio/wav','Content-Disposition':_0xb73a('0x49')};if(_0x515ffd['msg_id']){_0x8d4a90[_0xb73a('0x4a')]=_0xb73a('0x4b')+_0x515ffd[_0xb73a('0x45')]+_0xb73a('0x4c');}_0x82c307[_0xb73a('0x1a')](_0x8d4a90);return _0x82c307[_0xb73a('0x23')](new Buffer(_0x515ffd[_0xb73a('0x44')]));}})[_0xb73a('0x3b')](handleError(_0x82c307,null));}; \ No newline at end of file +var _0xaead=['save','update','then','stack','name','send','index','map','VoiceMailMessage','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','rawAttributes','find','catch','create','body','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xaead,0x17f));var _0xdaea=function(_0x1e2e56,_0x592b9d){_0x1e2e56=_0x1e2e56-0x0;var _0x15395f=_0xaead[_0x1e2e56];return _0x15395f;};'use strict';var emlformat=require(_0xdaea('0x0'));var rimraf=require(_0xdaea('0x1'));var zipdir=require(_0xdaea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdaea('0x3'));var moment=require(_0xdaea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdaea('0x5'));var util=require('util');var path=require(_0xdaea('0x6'));var sox=require(_0xdaea('0x7'));var csv=require(_0xdaea('0x8'));var ejs=require(_0xdaea('0x9'));var fs=require('fs');var fs_extra=require(_0xdaea('0xa'));var _=require(_0xdaea('0xb'));var squel=require(_0xdaea('0xc'));var crypto=require(_0xdaea('0xd'));var jsforce=require(_0xdaea('0xe'));var deskjs=require(_0xdaea('0xf'));var toCsv=require(_0xdaea('0x8'));var querystring=require(_0xdaea('0x10'));var Papa=require(_0xdaea('0x11'));var Redis=require(_0xdaea('0x12'));var authService=require(_0xdaea('0x13'));var qs=require(_0xdaea('0x14'));var as=require(_0xdaea('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaea('0x16'))(_0xdaea('0x17'));var utils=require(_0xdaea('0x18'));var config=require(_0xdaea('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaea('0x1a'))['db'];function respondWithStatusCode(_0x514e9a,_0x4dc621){_0x4dc621=_0x4dc621||0xcc;return function(_0x18f9c3){if(_0x18f9c3){return _0x514e9a[_0xdaea('0x1b')](_0x4dc621);}return _0x514e9a['status'](_0x4dc621)[_0xdaea('0x1c')]();};}function respondWithResult(_0x293ac3,_0x556edf){_0x556edf=_0x556edf||0xc8;return function(_0x1b6034){if(_0x1b6034){return _0x293ac3[_0xdaea('0x1d')](_0x556edf)[_0xdaea('0x1e')](_0x1b6034);}};}function respondWithFilteredResult(_0x1eec48,_0x50cc0e){return function(_0x136fb0){if(_0x136fb0){var _0x5014b6=typeof _0x50cc0e['offset']===_0xdaea('0x1f')&&typeof _0x50cc0e[_0xdaea('0x20')]===_0xdaea('0x1f');var _0x230067=_0x136fb0[_0xdaea('0x21')];var _0x2557f3=_0x5014b6?0x0:_0x50cc0e['offset'];var _0x3777b6=_0x5014b6?_0x136fb0[_0xdaea('0x21')]:_0x50cc0e[_0xdaea('0x22')]+_0x50cc0e['limit'];var _0x1d2d56;if(_0x3777b6>=_0x230067){_0x3777b6=_0x230067;_0x1d2d56=0xc8;}else{_0x1d2d56=0xce;}_0x1eec48['status'](_0x1d2d56);return _0x1eec48[_0xdaea('0x23')]('Content-Range',_0x2557f3+'-'+_0x3777b6+'/'+_0x230067)[_0xdaea('0x1e')](_0x136fb0);}return null;};}function patchUpdates(_0x5b2517){return function(_0x5608a8){try{jsonpatch[_0xdaea('0x24')](_0x5608a8,_0x5b2517,!![]);}catch(_0x2fc284){return BPromise['reject'](_0x2fc284);}return _0x5608a8[_0xdaea('0x25')]();};}function saveUpdates(_0x4d8941,_0x62945e){return function(_0x3617e2){if(_0x3617e2){return _0x3617e2[_0xdaea('0x26')](_0x4d8941)[_0xdaea('0x27')](function(_0x1bd461){return _0x1bd461;});}return null;};}function removeEntity(_0x856c22,_0x41aa7b){return function(_0x319f7b){if(_0x319f7b){return _0x319f7b['destroy']()[_0xdaea('0x27')](function(){_0x856c22[_0xdaea('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c31f,_0x59f027){return function(_0x47f143){if(!_0x47f143){_0x53c31f[_0xdaea('0x1b')](0x194);}return _0x47f143;};}function handleError(_0x241525,_0x38f3c4){_0x38f3c4=_0x38f3c4||0x1f4;return function(_0x1b0023){logger['error'](_0x1b0023[_0xdaea('0x28')]);if(_0x1b0023[_0xdaea('0x29')]){delete _0x1b0023[_0xdaea('0x29')];}_0x241525[_0xdaea('0x1d')](_0x38f3c4)[_0xdaea('0x2a')](_0x1b0023);};}exports[_0xdaea('0x2b')]=function(_0x57685f,_0x35dbca){var _0x1dad80={},_0x969a80={},_0xe8533b={'count':0x0,'rows':[]};var _0x34d815=_[_0xdaea('0x2c')](db[_0xdaea('0x2d')]['rawAttributes'],function(_0x558440){return{'name':_0x558440['fieldName'],'type':_0x558440[_0xdaea('0x2e')][_0xdaea('0x2f')]};});_0x969a80[_0xdaea('0x30')]=_[_0xdaea('0x31')](_[_0xdaea('0x2c')](_0x34d815,_0xdaea('0x29')),[_0xdaea('0x29')]);_0x969a80[_0xdaea('0x32')]=_[_0xdaea('0x33')](_0x57685f['query']);_0x969a80[_0xdaea('0x34')]=_[_0xdaea('0x35')](_0x969a80[_0xdaea('0x30')],_0x969a80[_0xdaea('0x32')]);_0x1dad80[_0xdaea('0x36')]=_['intersection'](_0x969a80[_0xdaea('0x30')],qs[_0xdaea('0x37')](_0x57685f[_0xdaea('0x32')][_0xdaea('0x37')]));_0x1dad80[_0xdaea('0x36')]=_0x1dad80['attributes'][_0xdaea('0x38')]?_0x1dad80['attributes']:_0x969a80[_0xdaea('0x30')];if(!_0x57685f[_0xdaea('0x32')]['hasOwnProperty'](_0xdaea('0x39'))){_0x1dad80[_0xdaea('0x20')]=qs[_0xdaea('0x20')](_0x57685f[_0xdaea('0x32')][_0xdaea('0x20')]);_0x1dad80[_0xdaea('0x22')]=qs[_0xdaea('0x22')](_0x57685f['query'][_0xdaea('0x22')]);}_0x1dad80[_0xdaea('0x3a')]=qs[_0xdaea('0x3b')](_0x57685f[_0xdaea('0x32')][_0xdaea('0x3b')]);_0x1dad80['where']=qs[_0xdaea('0x34')](_[_0xdaea('0x3c')](_0x57685f['query'],_0x969a80['filters']),_0x34d815);if(_0x57685f['query'][_0xdaea('0x3d')]){_0x1dad80[_0xdaea('0x3e')]=_['merge'](_0x1dad80[_0xdaea('0x3e')],{'$or':_['map'](_0x34d815,function(_0x269b79){if(_0x269b79['type']!==_0xdaea('0x3f')){var _0x5af4a7={};_0x5af4a7[_0x269b79[_0xdaea('0x29')]]={'$like':'%'+_0x57685f[_0xdaea('0x32')][_0xdaea('0x3d')]+'%'};return _0x5af4a7;}})});}_0x1dad80=_[_0xdaea('0x40')]({},_0x1dad80,_0x57685f['options']);var _0x21012c={'where':_0x1dad80[_0xdaea('0x3e')]};return db[_0xdaea('0x2d')][_0xdaea('0x21')](_0x21012c)[_0xdaea('0x27')](function(_0xebbc30){_0xe8533b['count']=_0xebbc30;if(_0x57685f['query'][_0xdaea('0x41')]){_0x1dad80[_0xdaea('0x42')]=[{'all':!![]}];}return db[_0xdaea('0x2d')]['findAll'](_0x1dad80);})[_0xdaea('0x27')](function(_0x39a614){_0xe8533b[_0xdaea('0x43')]=_0x39a614;return _0xe8533b;})['then'](respondWithFilteredResult(_0x35dbca,_0x1dad80))['catch'](handleError(_0x35dbca,null));};exports['show']=function(_0x5c019f,_0x466316){var _0x56af73={'raw':!![],'where':{'id':_0x5c019f['params']['id']}},_0x52810a={};_0x52810a['model']=_['keys'](db[_0xdaea('0x2d')][_0xdaea('0x44')]);_0x52810a[_0xdaea('0x32')]=_[_0xdaea('0x33')](_0x5c019f[_0xdaea('0x32')]);_0x52810a[_0xdaea('0x34')]=_[_0xdaea('0x35')](_0x52810a['model'],_0x52810a[_0xdaea('0x32')]);_0x56af73[_0xdaea('0x36')]=_[_0xdaea('0x35')](_0x52810a['model'],qs[_0xdaea('0x37')](_0x5c019f[_0xdaea('0x32')][_0xdaea('0x37')]));_0x56af73[_0xdaea('0x36')]=_0x56af73[_0xdaea('0x36')][_0xdaea('0x38')]?_0x56af73[_0xdaea('0x36')]:_0x52810a[_0xdaea('0x30')];if(_0x5c019f[_0xdaea('0x32')][_0xdaea('0x41')]){_0x56af73[_0xdaea('0x42')]=[{'all':!![]}];}_0x56af73=_[_0xdaea('0x40')]({},_0x56af73,_0x5c019f['options']);return db[_0xdaea('0x2d')][_0xdaea('0x45')](_0x56af73)[_0xdaea('0x27')](handleEntityNotFound(_0x466316,null))[_0xdaea('0x27')](respondWithResult(_0x466316,null))[_0xdaea('0x46')](handleError(_0x466316,null));};exports[_0xdaea('0x47')]=function(_0x38843e,_0x795b88){return db[_0xdaea('0x2d')][_0xdaea('0x47')](_0x38843e[_0xdaea('0x48')],{})[_0xdaea('0x27')](respondWithResult(_0x795b88,0xc9))['catch'](handleError(_0x795b88,null));};exports[_0xdaea('0x26')]=function(_0x2f7ef1,_0x2c4b80){if(_0x2f7ef1['body']['id']){delete _0x2f7ef1['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x2f7ef1[_0xdaea('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c4b80,null))[_0xdaea('0x27')](saveUpdates(_0x2f7ef1[_0xdaea('0x48')],null))[_0xdaea('0x27')](respondWithResult(_0x2c4b80,null))['catch'](handleError(_0x2c4b80,null));};exports['destroy']=function(_0x5a36f5,_0x49d1a2){return db[_0xdaea('0x2d')][_0xdaea('0x45')]({'where':{'id':_0x5a36f5[_0xdaea('0x49')]['id']}})['then'](handleEntityNotFound(_0x49d1a2,null))[_0xdaea('0x27')](removeEntity(_0x49d1a2,null))[_0xdaea('0x46')](handleError(_0x49d1a2,null));};exports[_0xdaea('0x4a')]=function(_0x1d6a27,_0x2a9e55,_0x9658da){return db[_0xdaea('0x2d')][_0xdaea('0x45')]({'where':{'id':_0x1d6a27['params']['id']},'attributes':['id',_0xdaea('0x4b'),_0xdaea('0x4c')]})[_0xdaea('0x27')](handleEntityNotFound(_0x2a9e55,null))[_0xdaea('0x27')](function(_0x302584){if(_0x302584){if(!_0x302584[_0xdaea('0x4b')]){throw new db[(_0xdaea('0x4d'))][(_0xdaea('0x4e'))](_0xdaea('0x4f'));}var _0x120e31={'Content-Type':_0xdaea('0x50'),'Content-Disposition':_0xdaea('0x51')};if(_0x302584[_0xdaea('0x4c')]){_0x120e31['Content-Disposition']=_0xdaea('0x52')+_0x302584[_0xdaea('0x4c')]+_0xdaea('0x53');}_0x2a9e55['set'](_0x120e31);return _0x2a9e55[_0xdaea('0x2a')](new Buffer(_0x302584[_0xdaea('0x4b')]));}})['catch'](handleError(_0x2a9e55,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7b7f192..64cae2a 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 _0x5eec=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x597beb,_0x452c2f){var _0x18bae6=function(_0x53e203){while(--_0x53e203){_0x597beb['push'](_0x597beb['shift']());}};_0x18bae6(++_0x452c2f);}(_0x5eec,0x133));var _0xc5ee=function(_0x4bda50,_0x3fc4bd){_0x4bda50=_0x4bda50-0x0;var _0x1ef39f=_0x5eec[_0x4bda50];return _0x1ef39f;};'use strict';var _=require('lodash');var util=require(_0xc5ee('0x0'));var logger=require(_0xc5ee('0x1'))(_0xc5ee('0x2'));var moment=require(_0xc5ee('0x3'));var BPromise=require('bluebird');var rp=require(_0xc5ee('0x4'));var fs=require('fs');var path=require(_0xc5ee('0x5'));var rimraf=require(_0xc5ee('0x6'));var config=require(_0xc5ee('0x7'));var attributes=require(_0xc5ee('0x8'));module[_0xc5ee('0x9')]=function(_0x221c4d,_0x175270){return _0x221c4d[_0xc5ee('0xa')](_0xc5ee('0xb'),attributes,{'tableName':_0xc5ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc5ee('0xd'),'fields':[_0xc5ee('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7956=['dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x50bba4,_0x32b523){var _0x444d07=function(_0xdc2f0a){while(--_0xdc2f0a){_0x50bba4['push'](_0x50bba4['shift']());}};_0x444d07(++_0x32b523);}(_0x7956,0x88));var _0x6795=function(_0x20f292,_0x4c8b90){_0x20f292=_0x20f292-0x0;var _0x355c92=_0x7956[_0x20f292];return _0x355c92;};'use strict';var _=require('lodash');var util=require(_0x6795('0x0'));var logger=require(_0x6795('0x1'))(_0x6795('0x2'));var moment=require(_0x6795('0x3'));var BPromise=require(_0x6795('0x4'));var rp=require(_0x6795('0x5'));var fs=require('fs');var path=require(_0x6795('0x6'));var rimraf=require(_0x6795('0x7'));var config=require(_0x6795('0x8'));var attributes=require(_0x6795('0x9'));module[_0x6795('0xa')]=function(_0x6b9c26,_0x554551){return _0x6b9c26[_0x6795('0xb')](_0x6795('0xc'),attributes,{'tableName':_0x6795('0xd'),'paranoid':![],'indexes':[{'name':_0x6795('0xe'),'fields':[_0x6795('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index eb38b09..abbf5cd 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 _0x5ceb=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x2606e7,_0xcbe32c){var _0x56d2b6=function(_0x1836f4){while(--_0x1836f4){_0x2606e7['push'](_0x2606e7['shift']());}};_0x56d2b6(++_0xcbe32c);}(_0x5ceb,0x10b));var _0xb5ce=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x5ceb[_0x519756];return _0x37047e;};'use strict';var _=require(_0xb5ce('0x0'));var util=require(_0xb5ce('0x1'));var moment=require(_0xb5ce('0x2'));var BPromise=require(_0xb5ce('0x3'));var rs=require(_0xb5ce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5ce('0x5'))(_0xb5ce('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5ce('0x7'));var client=jayson[_0xb5ce('0x8')][_0xb5ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45239c,_0x22f5f9,_0xa31ec1){return new BPromise(function(_0x479347,_0x225123){return client[_0xb5ce('0xa')](_0x45239c,_0xa31ec1)[_0xb5ce('0xb')](function(_0x176058){logger[_0xb5ce('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x22f5f9,_0xb5ce('0xd'));logger[_0xb5ce('0xe')](_0xb5ce('0xf'),_0x22f5f9,_0xb5ce('0xd'),JSON[_0xb5ce('0x10')](_0x176058));if(_0x176058['error']){if(_0x176058[_0xb5ce('0x11')]['code']===0x1f4){logger['error'](_0xb5ce('0x12'),_0x22f5f9,_0x176058[_0xb5ce('0x11')]['message']);return _0x225123(_0x176058[_0xb5ce('0x11')]['message']);}logger[_0xb5ce('0x11')](_0xb5ce('0x12'),_0x22f5f9,_0x176058['error']['message']);return _0x479347(_0x176058['error'][_0xb5ce('0x13')]);}else{logger[_0xb5ce('0xc')](_0xb5ce('0x12'),_0x22f5f9,_0xb5ce('0xd'));_0x479347(_0x176058[_0xb5ce('0x14')][_0xb5ce('0x13')]);}})['catch'](function(_0x7deaef){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x22f5f9,_0x7deaef);_0x225123(_0x7deaef);});});} \ No newline at end of file +var _0xd35e=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x57fb4f,_0x5f33dd){var _0xb4189f=function(_0x205e58){while(--_0x205e58){_0x57fb4f['push'](_0x57fb4f['shift']());}};_0xb4189f(++_0x5f33dd);}(_0xd35e,0x124));var _0xed35=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0xd35e[_0x43f552];return _0x17911b;};'use strict';var _=require(_0xed35('0x0'));var util=require('util');var moment=require(_0xed35('0x1'));var BPromise=require(_0xed35('0x2'));var rs=require(_0xed35('0x3'));var fs=require('fs');var Redis=require(_0xed35('0x4'));var db=require(_0xed35('0x5'))['db'];var utils=require(_0xed35('0x6'));var logger=require(_0xed35('0x7'))(_0xed35('0x8'));var config=require(_0xed35('0x9'));var jayson=require(_0xed35('0xa'));var client=jayson[_0xed35('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b57fe,_0x7a42f,_0x20fa2a){return new BPromise(function(_0x379167,_0x28313f){return client[_0xed35('0xc')](_0x4b57fe,_0x20fa2a)[_0xed35('0xd')](function(_0x54e454){logger[_0xed35('0xe')](_0xed35('0xf'),_0x7a42f,_0xed35('0x10'));logger[_0xed35('0x11')](_0xed35('0x12'),_0x7a42f,_0xed35('0x10'),JSON['stringify'](_0x54e454));if(_0x54e454[_0xed35('0x13')]){if(_0x54e454[_0xed35('0x13')][_0xed35('0x14')]===0x1f4){logger[_0xed35('0x13')](_0xed35('0xf'),_0x7a42f,_0x54e454[_0xed35('0x13')][_0xed35('0x15')]);return _0x28313f(_0x54e454[_0xed35('0x13')]['message']);}logger[_0xed35('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x7a42f,_0x54e454[_0xed35('0x13')]['message']);return _0x379167(_0x54e454['error']['message']);}else{logger[_0xed35('0xe')](_0xed35('0xf'),_0x7a42f,_0xed35('0x10'));_0x379167(_0x54e454[_0xed35('0x16')][_0xed35('0x15')]);}})[_0xed35('0x17')](function(_0x529cf3){logger['error'](_0xed35('0xf'),_0x7a42f,_0x529cf3);_0x28313f(_0x529cf3);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7b42ef3..7f4c426 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 _0x52f6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','post','addSound','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x52f6,0x83));var _0x652f=function(_0x152b2d,_0x246e9a){_0x152b2d=_0x152b2d-0x0;var _0x13ea26=_0x52f6[_0x152b2d];return _0x13ea26;};'use strict';var multer=require(_0x652f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x652f('0x1'));var express=require(_0x652f('0x2'));var router=express[_0x652f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x652f('0x4'));var interaction=require(_0x652f('0x5'));var config=require(_0x652f('0x6'));var controller=require(_0x652f('0x7'));router['get']('/',auth[_0x652f('0x8')](),controller['index']);router[_0x652f('0x9')](_0x652f('0xa'),auth[_0x652f('0x8')](),controller[_0x652f('0xb')]);router[_0x652f('0x9')]('/:id/sounds',auth[_0x652f('0x8')](),controller['getSounds']);router[_0x652f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x652f('0xc')]('/:id/sounds',auth[_0x652f('0x8')](),controller[_0x652f('0xd')]);router['put']('/:id',auth[_0x652f('0x8')](),controller['update']);router[_0x652f('0xe')](_0x652f('0xa'),auth['isAuthenticated'](),controller[_0x652f('0xf')]);router[_0x652f('0xe')](_0x652f('0x10'),auth[_0x652f('0x8')](),controller[_0x652f('0x11')]);module[_0x652f('0x12')]=router; \ No newline at end of file +var _0x021b=['removeSound','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2'];(function(_0xfe58,_0x619889){var _0x3ab1f1=function(_0x560ab7){while(--_0x560ab7){_0xfe58['push'](_0xfe58['shift']());}};_0x3ab1f1(++_0x619889);}(_0x021b,0x147));var _0xb021=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0x021b[_0x458848];return _0x20469e;};'use strict';var multer=require(_0xb021('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb021('0x1'));var express=require(_0xb021('0x2'));var router=express[_0xb021('0x3')]();var fs_extra=require(_0xb021('0x4'));var auth=require(_0xb021('0x5'));var interaction=require(_0xb021('0x6'));var config=require(_0xb021('0x7'));var controller=require(_0xb021('0x8'));router[_0xb021('0x9')]('/',auth[_0xb021('0xa')](),controller[_0xb021('0xb')]);router[_0xb021('0x9')](_0xb021('0xc'),auth[_0xb021('0xa')](),controller[_0xb021('0xd')]);router[_0xb021('0x9')](_0xb021('0xe'),auth['isAuthenticated'](),controller[_0xb021('0xf')]);router[_0xb021('0x10')]('/',auth['isAuthenticated'](),controller[_0xb021('0x11')]);router[_0xb021('0x10')](_0xb021('0xe'),auth['isAuthenticated'](),controller[_0xb021('0x12')]);router[_0xb021('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb021('0x14')](_0xb021('0xc'),auth[_0xb021('0xa')](),controller[_0xb021('0x15')]);router[_0xb021('0x14')](_0xb021('0x16'),auth[_0xb021('0xa')](),controller[_0xb021('0x17')]);module[_0xb021('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 942ec23..bf992fc 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 _0xdd67=['ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name'];(function(_0x3cb357,_0x24c730){var _0x1be2cc=function(_0x91acce){while(--_0x91acce){_0x3cb357['push'](_0x3cb357['shift']());}};_0x1be2cc(++_0x24c730);}(_0xdd67,0x105));var _0x7dd6=function(_0x29e79d,_0x28b571){_0x29e79d=_0x29e79d-0x0;var _0x29a3b3=_0xdd67[_0x29e79d];return _0x29a3b3;};'use strict';var Sequelize=require('sequelize');module[_0x7dd6('0x0')]={'name':{'type':Sequelize[_0x7dd6('0x1')],'allowNull':![],'unique':_0x7dd6('0x2')},'mode':{'type':Sequelize[_0x7dd6('0x3')](_0x7dd6('0x4'),_0x7dd6('0x5'),_0x7dd6('0x6'),'quietmp3nb',_0x7dd6('0x7'),_0x7dd6('0x8')),'allowNull':!![],'defaultValue':_0x7dd6('0x5')},'directory':{'type':Sequelize[_0x7dd6('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x7dd6('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7dd6('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7dd6('0x9')},'format':{'type':Sequelize[_0x7dd6('0x1')],'allowNull':!![]},'stamp':{'type':_0x7dd6('0xa')},'defaultEntry':{'type':Sequelize[_0x7dd6('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa69b=['name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','sequelize','exports','STRING'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0xa69b,0xd9));var _0xba69=function(_0x1817ab,_0x3ed5a4){_0x1817ab=_0x1817ab-0x0;var _0x497b79=_0xa69b[_0x1817ab];return _0x497b79;};'use strict';var Sequelize=require(_0xba69('0x0'));module[_0xba69('0x1')]={'name':{'type':Sequelize[_0xba69('0x2')],'allowNull':![],'unique':_0xba69('0x3')},'mode':{'type':Sequelize[_0xba69('0x4')](_0xba69('0x5'),'files',_0xba69('0x6'),_0xba69('0x7'),_0xba69('0x8'),_0xba69('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xba69('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xba69('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xba69('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xba69('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 eee92db..65b3815 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 _0x4f66=['unlinkSync','getSounds','keys','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','include','findAll','rows','params','fields','catch','body','find','create','transaction','mode','files','directory','root','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','join','Sequelize','ValidationError','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','converted_format','format','symlinkSync','message','removeSound','id2'];(function(_0x29b42c,_0xba3cdd){var _0x3cb7e5=function(_0x4146d2){while(--_0x4146d2){_0x29b42c['push'](_0x29b42c['shift']());}};_0x3cb7e5(++_0xba3cdd);}(_0x4f66,0x77));var _0x64f6=function(_0x1d6ff9,_0x14af0c){_0x1d6ff9=_0x1d6ff9-0x0;var _0x56f341=_0x4f66[_0x1d6ff9];return _0x56f341;};'use strict';var emlformat=require(_0x64f6('0x0'));var rimraf=require(_0x64f6('0x1'));var zipdir=require(_0x64f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x64f6('0x4'));var util=require(_0x64f6('0x5'));var path=require(_0x64f6('0x6'));var sox=require(_0x64f6('0x7'));var csv=require(_0x64f6('0x8'));var ejs=require(_0x64f6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64f6('0xa'));var squel=require(_0x64f6('0xb'));var crypto=require(_0x64f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x64f6('0xd'));var toCsv=require(_0x64f6('0x8'));var querystring=require(_0x64f6('0xe'));var Papa=require(_0x64f6('0xf'));var Redis=require(_0x64f6('0x10'));var authService=require(_0x64f6('0x11'));var qs=require(_0x64f6('0x12'));var as=require(_0x64f6('0x13'));var hardwareService=require(_0x64f6('0x14'));var logger=require(_0x64f6('0x15'))(_0x64f6('0x16'));var utils=require('../../config/utils');var config=require(_0x64f6('0x17'));var licenseUtil=require(_0x64f6('0x18'));var db=require(_0x64f6('0x19'))['db'];function respondWithStatusCode(_0x55f419,_0x175cae){_0x175cae=_0x175cae||0xcc;return function(_0x336c93){if(_0x336c93){return _0x55f419[_0x64f6('0x1a')](_0x175cae);}return _0x55f419[_0x64f6('0x1b')](_0x175cae)[_0x64f6('0x1c')]();};}function respondWithResult(_0x3122f5,_0x1d3223){_0x1d3223=_0x1d3223||0xc8;return function(_0x5b3608){if(_0x5b3608){return _0x3122f5[_0x64f6('0x1b')](_0x1d3223)[_0x64f6('0x1d')](_0x5b3608);}};}function respondWithFilteredResult(_0xc46b6e,_0x18b280){return function(_0x59e9fb){if(_0x59e9fb){var _0x4a57fd=typeof _0x18b280[_0x64f6('0x1e')]==='undefined'&&typeof _0x18b280[_0x64f6('0x1f')]===_0x64f6('0x20');var _0x28da58=_0x59e9fb[_0x64f6('0x21')];var _0x2620bf=_0x4a57fd?0x0:_0x18b280[_0x64f6('0x1e')];var _0x9b648f=_0x4a57fd?_0x59e9fb[_0x64f6('0x21')]:_0x18b280[_0x64f6('0x1e')]+_0x18b280[_0x64f6('0x1f')];var _0x6f09ee;if(_0x9b648f>=_0x28da58){_0x9b648f=_0x28da58;_0x6f09ee=0xc8;}else{_0x6f09ee=0xce;}_0xc46b6e[_0x64f6('0x1b')](_0x6f09ee);return _0xc46b6e['set'](_0x64f6('0x22'),_0x2620bf+'-'+_0x9b648f+'/'+_0x28da58)['json'](_0x59e9fb);}return null;};}function patchUpdates(_0x10ff2a){return function(_0xe2d7b9){try{jsonpatch[_0x64f6('0x23')](_0xe2d7b9,_0x10ff2a,!![]);}catch(_0x306dd2){return BPromise['reject'](_0x306dd2);}return _0xe2d7b9['save']();};}function saveUpdates(_0x35e861,_0x3a6161){return function(_0x16e9be){if(_0x16e9be){return _0x16e9be[_0x64f6('0x24')](_0x35e861)['then'](function(_0x38bf89){return _0x38bf89;});}return null;};}function removeEntity(_0x1aaf98,_0x562e00){return function(_0x4d428c){if(_0x4d428c){return _0x4d428c[_0x64f6('0x25')]()[_0x64f6('0x26')](function(){var _0x54086e=_0x4d428c[_0x64f6('0x27')]({'plain':!![]});var _0xc86b82=_0x64f6('0x28');return db[_0x64f6('0x29')][_0x64f6('0x25')]({'where':{'type':_0xc86b82,'resourceId':_0x54086e['id']}})['then'](function(){return _0x4d428c;});})[_0x64f6('0x26')](function(){_0x1aaf98[_0x64f6('0x1b')](0xcc)[_0x64f6('0x1c')]();});}};}function handleEntityNotFound(_0x93d1fb,_0x297e8b){return function(_0x4d0d7e){if(!_0x4d0d7e){_0x93d1fb['sendStatus'](0x194);}return _0x4d0d7e;};}function handleError(_0x3a32f3,_0x1a674b){_0x1a674b=_0x1a674b||0x1f4;return function(_0x5420dd){logger[_0x64f6('0x2a')](_0x5420dd[_0x64f6('0x2b')]);if(_0x5420dd[_0x64f6('0x2c')]){delete _0x5420dd[_0x64f6('0x2c')];}_0x3a32f3['status'](_0x1a674b)[_0x64f6('0x2d')](_0x5420dd);};}exports[_0x64f6('0x2e')]=function(_0x5e952b,_0x4d1823){var _0x50e8f5={},_0x1e5564={},_0x41359b={'count':0x0,'rows':[]};var _0x5d8676=_[_0x64f6('0x2f')](db['VoiceMusicOnHold'][_0x64f6('0x30')],function(_0x9406ef){return{'name':_0x9406ef[_0x64f6('0x31')],'type':_0x9406ef['type'][_0x64f6('0x32')]};});_0x1e5564[_0x64f6('0x33')]=_[_0x64f6('0x2f')](_0x5d8676,_0x64f6('0x2c'));_0x1e5564[_0x64f6('0x34')]=_['keys'](_0x5e952b[_0x64f6('0x34')]);_0x1e5564[_0x64f6('0x35')]=_['intersection'](_0x1e5564[_0x64f6('0x33')],_0x1e5564[_0x64f6('0x34')]);_0x50e8f5[_0x64f6('0x36')]=_[_0x64f6('0x37')](_0x1e5564[_0x64f6('0x33')],qs['fields'](_0x5e952b[_0x64f6('0x34')]['fields']));_0x50e8f5[_0x64f6('0x36')]=_0x50e8f5[_0x64f6('0x36')][_0x64f6('0x38')]?_0x50e8f5[_0x64f6('0x36')]:_0x1e5564[_0x64f6('0x33')];if(!_0x5e952b[_0x64f6('0x34')]['hasOwnProperty']('nolimit')){_0x50e8f5[_0x64f6('0x1f')]=qs['limit'](_0x5e952b[_0x64f6('0x34')][_0x64f6('0x1f')]);_0x50e8f5[_0x64f6('0x1e')]=qs[_0x64f6('0x1e')](_0x5e952b[_0x64f6('0x34')][_0x64f6('0x1e')]);}_0x50e8f5[_0x64f6('0x39')]=qs['sort'](_0x5e952b[_0x64f6('0x34')][_0x64f6('0x3a')]);delete _0x5e952b['query'][_0x64f6('0x3a')];_0x50e8f5[_0x64f6('0x3b')]=qs[_0x64f6('0x35')](_[_0x64f6('0x3c')](_0x5e952b[_0x64f6('0x34')],_0x1e5564[_0x64f6('0x35')]),_0x5d8676);if(_0x5e952b[_0x64f6('0x34')]['filter']){_0x50e8f5[_0x64f6('0x3b')]=_[_0x64f6('0x3d')](_0x50e8f5[_0x64f6('0x3b')],{'$or':_[_0x64f6('0x2f')](_0x5d8676,function(_0x48a9f3){if(_0x48a9f3[_0x64f6('0x3e')]!==_0x64f6('0x3f')){var _0x51ab11={};_0x51ab11[_0x48a9f3[_0x64f6('0x2c')]]={'$like':'%'+_0x5e952b[_0x64f6('0x34')][_0x64f6('0x40')]+'%'};return _0x51ab11;}})});}_0x50e8f5=_[_0x64f6('0x3d')]({},_0x50e8f5,_0x5e952b[_0x64f6('0x41')]);var _0x639094={'where':_0x50e8f5[_0x64f6('0x3b')]};return db[_0x64f6('0x42')][_0x64f6('0x21')](_0x639094)[_0x64f6('0x26')](function(_0x198e52){_0x41359b[_0x64f6('0x21')]=_0x198e52;if(_0x5e952b[_0x64f6('0x34')][_0x64f6('0x43')]){_0x50e8f5[_0x64f6('0x44')]=[{'all':!![]}];}return db[_0x64f6('0x42')][_0x64f6('0x45')](_0x50e8f5);})['then'](function(_0x3eacca){_0x41359b[_0x64f6('0x46')]=_0x3eacca;return _0x41359b;})['then'](respondWithFilteredResult(_0x4d1823,_0x50e8f5))['catch'](handleError(_0x4d1823,null));};exports['show']=function(_0x1543a2,_0x190b60){var _0x2d7cb9={'raw':![],'where':{'id':_0x1543a2[_0x64f6('0x47')]['id']}},_0x5e7a3d={};_0x5e7a3d['model']=_['keys'](db[_0x64f6('0x42')][_0x64f6('0x30')]);_0x5e7a3d[_0x64f6('0x34')]=_['keys'](_0x1543a2[_0x64f6('0x34')]);_0x5e7a3d[_0x64f6('0x35')]=_[_0x64f6('0x37')](_0x5e7a3d[_0x64f6('0x33')],_0x5e7a3d[_0x64f6('0x34')]);_0x2d7cb9[_0x64f6('0x36')]=_[_0x64f6('0x37')](_0x5e7a3d[_0x64f6('0x33')],qs['fields'](_0x1543a2['query'][_0x64f6('0x48')]));_0x2d7cb9[_0x64f6('0x36')]=_0x2d7cb9[_0x64f6('0x36')][_0x64f6('0x38')]?_0x2d7cb9[_0x64f6('0x36')]:_0x5e7a3d[_0x64f6('0x33')];if(_0x1543a2['query'][_0x64f6('0x43')]){_0x2d7cb9['include']=[{'all':!![]}];}_0x2d7cb9=_[_0x64f6('0x3d')]({},_0x2d7cb9,_0x1543a2[_0x64f6('0x41')]);return db[_0x64f6('0x42')]['find'](_0x2d7cb9)['then'](handleEntityNotFound(_0x190b60,null))[_0x64f6('0x26')](respondWithResult(_0x190b60,null))[_0x64f6('0x49')](handleError(_0x190b60,null));};exports[_0x64f6('0x24')]=function(_0x3b1835,_0x2ade15){if(_0x3b1835['body']['id']){delete _0x3b1835[_0x64f6('0x4a')]['id'];}return db[_0x64f6('0x42')][_0x64f6('0x4b')]({'where':{'id':_0x3b1835[_0x64f6('0x47')]['id']}})[_0x64f6('0x26')](handleEntityNotFound(_0x2ade15,null))[_0x64f6('0x26')](saveUpdates(_0x3b1835[_0x64f6('0x4a')],null))[_0x64f6('0x26')](respondWithResult(_0x2ade15,null))[_0x64f6('0x49')](handleError(_0x2ade15,null));};exports[_0x64f6('0x4c')]=function(_0x2d2498,_0x415ebe,_0x27e5b6){return db['sequelize'][_0x64f6('0x4d')](function(_0x584969){if(_0x2d2498['body'][_0x64f6('0x4e')]===_0x64f6('0x4f')){_0x2d2498[_0x64f6('0x4a')][_0x64f6('0x50')]=path['join'](config[_0x64f6('0x51')],'server/files/moh',_0x2d2498[_0x64f6('0x4a')][_0x64f6('0x2c')]);}return db['VoiceMusicOnHold'][_0x64f6('0x4c')](_0x2d2498['body'],{'transaction':_0x584969})['then'](function(_0xeed9be){if(_0x2d2498[_0x64f6('0x4a')][_0x64f6('0x4e')]===_0x64f6('0x4f')){fs['mkdirSync'](_0xeed9be[_0x64f6('0x50')],parseInt(_0x64f6('0x52'),0x8));}var _0x57593a=_0x2d2498[_0x64f6('0x53')][_0x64f6('0x27')]({'plain':!![]});if(!_0x57593a)throw new Error(_0x64f6('0x54'));if(_0x57593a[_0x64f6('0x55')]===_0x64f6('0x53')){var _0x4f7e3a=_0xeed9be['get']({'plain':!![]});return db[_0x64f6('0x56')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x57593a[_0x64f6('0x57')]},'raw':!![]})[_0x64f6('0x26')](function(_0x5ddbd3){if(_0x5ddbd3&&_0x5ddbd3[_0x64f6('0x58')]===0x0){return db[_0x64f6('0x29')]['create']({'name':_0x4f7e3a[_0x64f6('0x2c')],'resourceId':_0x4f7e3a['id'],'type':_0x5ddbd3[_0x64f6('0x2c')],'sectionId':_0x5ddbd3['id']},{})[_0x64f6('0x26')](function(){return _0xeed9be;});}else{return _0xeed9be;}})[_0x64f6('0x49')](function(_0x3f92f4){logger[_0x64f6('0x2a')](_0x64f6('0x59'),_0x3f92f4);});}return _0xeed9be;});})['then'](respondWithResult(_0x415ebe,0xc9))[_0x64f6('0x49')](handleError(_0x415ebe,null));};exports['destroy']=function(_0x1afade,_0xa22b6e,_0x340b79){var _0x2bc1a8;return db['VoiceMusicOnHold'][_0x64f6('0x4b')]({'where':{'id':_0x1afade[_0x64f6('0x47')]['id']}})[_0x64f6('0x26')](function(_0x128573){if(_0x128573){return db[_0x64f6('0x5a')][_0x64f6('0x4d')](function(_0x3ba707){return _0x128573['destroy']({'transaction':_0x3ba707,'raw':!![]})[_0x64f6('0x26')](function(_0x52b802){if(_0x52b802['directory']){fs[_0x64f6('0x5b')](_0x52b802[_0x64f6('0x50')])['forEach'](function(_0x1729aa){fs['unlinkSync'](path[_0x64f6('0x5c')](_0x52b802[_0x64f6('0x50')],_0x1729aa));});fs['rmdirSync'](_0x52b802[_0x64f6('0x50')]);}return _0x52b802;});})[_0x64f6('0x49')](function(_0x19a1a3){throw new db[(_0x64f6('0x5d'))][(_0x64f6('0x5e'))](_0x19a1a3['message']);});}})[_0x64f6('0x26')](handleEntityNotFound(_0xa22b6e,null))['then'](removeEntity(_0xa22b6e,null))[_0x64f6('0x49')](handleError(_0xa22b6e,null));};exports[_0x64f6('0x5f')]=function(_0x59ceb7,_0x27cef1,_0x304b5c){return db[_0x64f6('0x5a')][_0x64f6('0x4d')](function(_0x394fd){var _0x5d561c;return db['VoiceMusicOnHold'][_0x64f6('0x4b')]({'where':{'id':_0x59ceb7[_0x64f6('0x47')]['id']}})[_0x64f6('0x26')](function(_0x16c49a){if(_0x16c49a){_0x5d561c=_0x16c49a;return _0x16c49a[_0x64f6('0x5f')](_0x59ceb7[_0x64f6('0x4a')]['id'],{'transaction':_0x394fd});}})['then'](function(_0x5850ba){if(_0x5850ba){return db[_0x64f6('0x60')][_0x64f6('0x61')]({'where':{'id':_0x59ceb7[_0x64f6('0x4a')]['id']},'attributes':['id',_0x64f6('0x2c'),_0x64f6('0x62'),'converted_format',_0x64f6('0x63')],'raw':!![]});}})[_0x64f6('0x26')](function(_0x56e1e1){if(_0x56e1e1){var _0xbfb5f4=path[_0x64f6('0x5c')](config['root'],_0x64f6('0x64'),util['format'](_0x64f6('0x65'),path[_0x64f6('0x66')](_0x56e1e1[_0x64f6('0x62')],path['extname'](_0x56e1e1[_0x64f6('0x62')])),_0x56e1e1[_0x64f6('0x67')]));var _0x2ec822=path[_0x64f6('0x5c')](config['root'],'server/files/moh',_0x5d561c[_0x64f6('0x2c')],util[_0x64f6('0x68')](_0x64f6('0x65'),_0x56e1e1[_0x64f6('0x2c')],_0x56e1e1['converted_format']));fs[_0x64f6('0x69')](_0xbfb5f4,_0x2ec822);return _0x56e1e1;}})[_0x64f6('0x49')](function(_0x26b7c7){throw new db['Sequelize'][(_0x64f6('0x5e'))](_0x26b7c7[_0x64f6('0x6a')]);});})['then'](handleEntityNotFound(_0x27cef1,null))[_0x64f6('0x26')](respondWithResult(_0x27cef1,0xc9))[_0x64f6('0x49')](handleError(_0x27cef1,null));};exports[_0x64f6('0x6b')]=function(_0x4f6d10,_0xff7f9c,_0x19039f){return db[_0x64f6('0x5a')][_0x64f6('0x4d')](function(_0x5c4e28){var _0x2a4c41;return db[_0x64f6('0x42')]['findOne']({'where':{'id':_0x4f6d10[_0x64f6('0x47')]['id']}})[_0x64f6('0x26')](handleEntityNotFound(_0xff7f9c,null))[_0x64f6('0x26')](function(_0x3f1589){if(_0x3f1589){_0x2a4c41=_0x3f1589;return _0x3f1589['removeSound'](_0x4f6d10['params'][_0x64f6('0x6c')]);}})[_0x64f6('0x26')](function(_0x57956){if(_0x57956){return db[_0x64f6('0x60')][_0x64f6('0x61')]({'where':{'id':_0x4f6d10[_0x64f6('0x47')][_0x64f6('0x6c')]},'attributes':['id','name',_0x64f6('0x62'),_0x64f6('0x67'),_0x64f6('0x63')],'raw':!![]});}})[_0x64f6('0x26')](function(_0x513cca){if(_0x513cca){fs[_0x64f6('0x6d')](path[_0x64f6('0x5c')](_0x2a4c41[_0x64f6('0x50')],util[_0x64f6('0x68')](_0x64f6('0x65'),_0x513cca[_0x64f6('0x2c')],_0x513cca[_0x64f6('0x67')])));return _0x513cca;}})[_0x64f6('0x49')](function(_0x4cd099){throw new db[(_0x64f6('0x5d'))][(_0x64f6('0x5e'))](_0x4cd099[_0x64f6('0x6a')]);});})[_0x64f6('0x26')](handleEntityNotFound(_0xff7f9c,null))[_0x64f6('0x26')](respondWithStatusCode(_0xff7f9c,0xcc))[_0x64f6('0x49')](handleError(_0xff7f9c,null));};exports[_0x64f6('0x6e')]=function(_0x23373b,_0x145462,_0x444a9f){var _0x2e7b52={};var _0x21545e={};var _0x54419b;var _0x3432ff;return db[_0x64f6('0x42')][_0x64f6('0x61')]({'where':{'id':_0x23373b['params']['id']}})[_0x64f6('0x26')](handleEntityNotFound(_0x145462,null))['then'](function(_0x20c361){if(_0x20c361){_0x54419b=_0x20c361;_0x21545e[_0x64f6('0x33')]=_[_0x64f6('0x6f')](db[_0x64f6('0x60')][_0x64f6('0x30')]);_0x21545e[_0x64f6('0x34')]=_['keys'](_0x23373b[_0x64f6('0x34')]);_0x21545e[_0x64f6('0x35')]=_['intersection'](_0x21545e['model'],_0x21545e[_0x64f6('0x34')]);_0x2e7b52['attributes']=_[_0x64f6('0x37')](_0x21545e[_0x64f6('0x33')],qs[_0x64f6('0x48')](_0x23373b['query'][_0x64f6('0x48')]));_0x2e7b52[_0x64f6('0x36')]=_0x2e7b52[_0x64f6('0x36')][_0x64f6('0x38')]?_0x2e7b52[_0x64f6('0x36')]:_0x21545e[_0x64f6('0x33')];_0x2e7b52[_0x64f6('0x39')]=qs[_0x64f6('0x3a')](_0x23373b[_0x64f6('0x34')][_0x64f6('0x3a')]);_0x2e7b52['where']=qs[_0x64f6('0x35')](_['pick'](_0x23373b[_0x64f6('0x34')],_0x21545e[_0x64f6('0x35')]));if(_0x23373b[_0x64f6('0x34')][_0x64f6('0x40')]){_0x2e7b52[_0x64f6('0x3b')]=_[_0x64f6('0x3d')](_0x2e7b52['where'],{'$or':_[_0x64f6('0x2f')](_0x2e7b52['attributes'],function(_0x1ba57a){var _0x589ded={};_0x589ded[_0x1ba57a]={'$like':'%'+_0x23373b[_0x64f6('0x34')][_0x64f6('0x40')]+'%'};return _0x589ded;})});}_0x2e7b52=_[_0x64f6('0x3d')]({},_0x2e7b52,_0x23373b[_0x64f6('0x41')]);return _0x54419b[_0x64f6('0x6e')](_0x2e7b52);}})[_0x64f6('0x26')](function(_0x48dd87){if(_0x48dd87){_0x3432ff=_0x48dd87[_0x64f6('0x38')];if(!_0x23373b[_0x64f6('0x34')][_0x64f6('0x70')](_0x64f6('0x71'))){_0x2e7b52[_0x64f6('0x1f')]=qs['limit'](_0x23373b['query'][_0x64f6('0x1f')]);_0x2e7b52[_0x64f6('0x1e')]=qs[_0x64f6('0x1e')](_0x23373b[_0x64f6('0x34')]['offset']);}return _0x54419b[_0x64f6('0x6e')](_0x2e7b52);}})[_0x64f6('0x26')](function(_0x4a16d4){if(_0x4a16d4){return _0x4a16d4?{'count':_0x3432ff,'rows':_0x4a16d4}:null;}})[_0x64f6('0x26')](respondWithResult(_0x145462,null))[_0x64f6('0x49')](handleError(_0x145462,null));}; \ No newline at end of file +var _0x9edd=['transaction','mode','join','mkdirSync','directory','user','role','userProfileId','autoAssociation','error','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','findOne','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','server/files/moh','symlinkSync','removeSound','id2','Sound','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','length','include','options','VoiceMusicOnHold','find','update','body','params','create'];(function(_0x3c67f3,_0x5a6706){var _0x2c2233=function(_0x2294c0){while(--_0x2294c0){_0x3c67f3['push'](_0x3c67f3['shift']());}};_0x2c2233(++_0x5a6706);}(_0x9edd,0x1df));var _0xd9ed=function(_0x3a1582,_0x1b46a8){_0x3a1582=_0x3a1582-0x0;var _0x540183=_0x9edd[_0x3a1582];return _0x540183;};'use strict';var emlformat=require(_0xd9ed('0x0'));var rimraf=require(_0xd9ed('0x1'));var zipdir=require(_0xd9ed('0x2'));var jsonpatch=require(_0xd9ed('0x3'));var rp=require(_0xd9ed('0x4'));var moment=require('moment');var BPromise=require(_0xd9ed('0x5'));var Mustache=require(_0xd9ed('0x6'));var util=require(_0xd9ed('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd9ed('0x8'));var ejs=require(_0xd9ed('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ed('0xa'));var _=require(_0xd9ed('0xb'));var squel=require(_0xd9ed('0xc'));var crypto=require(_0xd9ed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd9ed('0xe'));var toCsv=require(_0xd9ed('0x8'));var querystring=require(_0xd9ed('0xf'));var Papa=require(_0xd9ed('0x10'));var Redis=require(_0xd9ed('0x11'));var authService=require(_0xd9ed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd9ed('0x13'));var hardwareService=require(_0xd9ed('0x14'));var logger=require('../../config/logger')(_0xd9ed('0x15'));var utils=require(_0xd9ed('0x16'));var config=require(_0xd9ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9ed('0x18'))['db'];function respondWithStatusCode(_0x5d2f5f,_0x940074){_0x940074=_0x940074||0xcc;return function(_0x58fb7d){if(_0x58fb7d){return _0x5d2f5f[_0xd9ed('0x19')](_0x940074);}return _0x5d2f5f[_0xd9ed('0x1a')](_0x940074)[_0xd9ed('0x1b')]();};}function respondWithResult(_0x27f772,_0x3a24d4){_0x3a24d4=_0x3a24d4||0xc8;return function(_0x3763f6){if(_0x3763f6){return _0x27f772[_0xd9ed('0x1a')](_0x3a24d4)[_0xd9ed('0x1c')](_0x3763f6);}};}function respondWithFilteredResult(_0x366e2d,_0x3a8dbc){return function(_0xa1cc0b){if(_0xa1cc0b){var _0x5ed9f4=typeof _0x3a8dbc['offset']===_0xd9ed('0x1d')&&typeof _0x3a8dbc[_0xd9ed('0x1e')]===_0xd9ed('0x1d');var _0x5fdda0=_0xa1cc0b[_0xd9ed('0x1f')];var _0x4d9411=_0x5ed9f4?0x0:_0x3a8dbc[_0xd9ed('0x20')];var _0x43c221=_0x5ed9f4?_0xa1cc0b[_0xd9ed('0x1f')]:_0x3a8dbc[_0xd9ed('0x20')]+_0x3a8dbc[_0xd9ed('0x1e')];var _0x41b475;if(_0x43c221>=_0x5fdda0){_0x43c221=_0x5fdda0;_0x41b475=0xc8;}else{_0x41b475=0xce;}_0x366e2d['status'](_0x41b475);return _0x366e2d[_0xd9ed('0x21')](_0xd9ed('0x22'),_0x4d9411+'-'+_0x43c221+'/'+_0x5fdda0)[_0xd9ed('0x1c')](_0xa1cc0b);}return null;};}function patchUpdates(_0x4aef88){return function(_0x2b34d4){try{jsonpatch[_0xd9ed('0x23')](_0x2b34d4,_0x4aef88,!![]);}catch(_0x429ca5){return BPromise['reject'](_0x429ca5);}return _0x2b34d4[_0xd9ed('0x24')]();};}function saveUpdates(_0x2ac834,_0x135d22){return function(_0x5e971e){if(_0x5e971e){return _0x5e971e['update'](_0x2ac834)[_0xd9ed('0x25')](function(_0x229ffb){return _0x229ffb;});}return null;};}function removeEntity(_0x14c884,_0x37bf01){return function(_0x1b1821){if(_0x1b1821){return _0x1b1821['destroy']()[_0xd9ed('0x25')](function(){var _0x5e8d7b=_0x1b1821[_0xd9ed('0x26')]({'plain':!![]});var _0x2031af='MusicOnHolds';return db[_0xd9ed('0x27')][_0xd9ed('0x28')]({'where':{'type':_0x2031af,'resourceId':_0x5e8d7b['id']}})[_0xd9ed('0x25')](function(){return _0x1b1821;});})['then'](function(){_0x14c884['status'](0xcc)[_0xd9ed('0x1b')]();});}};}function handleEntityNotFound(_0x4d918b,_0x310aac){return function(_0x2df99e){if(!_0x2df99e){_0x4d918b['sendStatus'](0x194);}return _0x2df99e;};}function handleError(_0x1c7b24,_0x465d30){_0x465d30=_0x465d30||0x1f4;return function(_0x1f824d){logger['error'](_0x1f824d['stack']);if(_0x1f824d[_0xd9ed('0x29')]){delete _0x1f824d['name'];}_0x1c7b24[_0xd9ed('0x1a')](_0x465d30)[_0xd9ed('0x2a')](_0x1f824d);};}exports[_0xd9ed('0x2b')]=function(_0x3c0534,_0x26e456){var _0xe64db4={},_0x4f2b37={},_0x7df923={'count':0x0,'rows':[]};var _0x2d39d9=_[_0xd9ed('0x2c')](db['VoiceMusicOnHold'][_0xd9ed('0x2d')],function(_0x3f98ca){return{'name':_0x3f98ca[_0xd9ed('0x2e')],'type':_0x3f98ca['type']['key']};});_0x4f2b37['model']=_[_0xd9ed('0x2c')](_0x2d39d9,_0xd9ed('0x29'));_0x4f2b37['query']=_[_0xd9ed('0x2f')](_0x3c0534[_0xd9ed('0x30')]);_0x4f2b37[_0xd9ed('0x31')]=_[_0xd9ed('0x32')](_0x4f2b37[_0xd9ed('0x33')],_0x4f2b37[_0xd9ed('0x30')]);_0xe64db4[_0xd9ed('0x34')]=_[_0xd9ed('0x32')](_0x4f2b37[_0xd9ed('0x33')],qs[_0xd9ed('0x35')](_0x3c0534[_0xd9ed('0x30')][_0xd9ed('0x35')]));_0xe64db4[_0xd9ed('0x34')]=_0xe64db4[_0xd9ed('0x34')]['length']?_0xe64db4['attributes']:_0x4f2b37[_0xd9ed('0x33')];if(!_0x3c0534[_0xd9ed('0x30')][_0xd9ed('0x36')](_0xd9ed('0x37'))){_0xe64db4[_0xd9ed('0x1e')]=qs[_0xd9ed('0x1e')](_0x3c0534[_0xd9ed('0x30')]['limit']);_0xe64db4[_0xd9ed('0x20')]=qs[_0xd9ed('0x20')](_0x3c0534[_0xd9ed('0x30')]['offset']);}_0xe64db4['order']=qs['sort'](_0x3c0534[_0xd9ed('0x30')][_0xd9ed('0x38')]);delete _0x3c0534[_0xd9ed('0x30')]['sort'];_0xe64db4['where']=qs['filters'](_[_0xd9ed('0x39')](_0x3c0534[_0xd9ed('0x30')],_0x4f2b37[_0xd9ed('0x31')]),_0x2d39d9);if(_0x3c0534[_0xd9ed('0x30')][_0xd9ed('0x3a')]){_0xe64db4[_0xd9ed('0x3b')]=_[_0xd9ed('0x3c')](_0xe64db4[_0xd9ed('0x3b')],{'$or':_[_0xd9ed('0x2c')](_0x2d39d9,function(_0x3e8f6d){if(_0x3e8f6d['type']!==_0xd9ed('0x3d')){var _0x3f4c36={};_0x3f4c36[_0x3e8f6d[_0xd9ed('0x29')]]={'$like':'%'+_0x3c0534['query'][_0xd9ed('0x3a')]+'%'};return _0x3f4c36;}})});}_0xe64db4=_[_0xd9ed('0x3c')]({},_0xe64db4,_0x3c0534['options']);var _0x435365={'where':_0xe64db4['where']};return db['VoiceMusicOnHold'][_0xd9ed('0x1f')](_0x435365)['then'](function(_0x50a23b){_0x7df923[_0xd9ed('0x1f')]=_0x50a23b;if(_0x3c0534[_0xd9ed('0x30')][_0xd9ed('0x3e')]){_0xe64db4['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd9ed('0x3f')](_0xe64db4);})[_0xd9ed('0x25')](function(_0x350507){_0x7df923[_0xd9ed('0x40')]=_0x350507;return _0x7df923;})['then'](respondWithFilteredResult(_0x26e456,_0xe64db4))[_0xd9ed('0x41')](handleError(_0x26e456,null));};exports[_0xd9ed('0x42')]=function(_0x54663e,_0xc8b3c){var _0x2bf3f1={'raw':![],'where':{'id':_0x54663e['params']['id']}},_0x12d484={};_0x12d484['model']=_['keys'](db['VoiceMusicOnHold'][_0xd9ed('0x2d')]);_0x12d484[_0xd9ed('0x30')]=_['keys'](_0x54663e[_0xd9ed('0x30')]);_0x12d484[_0xd9ed('0x31')]=_[_0xd9ed('0x32')](_0x12d484['model'],_0x12d484[_0xd9ed('0x30')]);_0x2bf3f1[_0xd9ed('0x34')]=_[_0xd9ed('0x32')](_0x12d484[_0xd9ed('0x33')],qs[_0xd9ed('0x35')](_0x54663e[_0xd9ed('0x30')][_0xd9ed('0x35')]));_0x2bf3f1[_0xd9ed('0x34')]=_0x2bf3f1['attributes'][_0xd9ed('0x43')]?_0x2bf3f1[_0xd9ed('0x34')]:_0x12d484['model'];if(_0x54663e[_0xd9ed('0x30')][_0xd9ed('0x3e')]){_0x2bf3f1[_0xd9ed('0x44')]=[{'all':!![]}];}_0x2bf3f1=_[_0xd9ed('0x3c')]({},_0x2bf3f1,_0x54663e[_0xd9ed('0x45')]);return db[_0xd9ed('0x46')][_0xd9ed('0x47')](_0x2bf3f1)[_0xd9ed('0x25')](handleEntityNotFound(_0xc8b3c,null))[_0xd9ed('0x25')](respondWithResult(_0xc8b3c,null))[_0xd9ed('0x41')](handleError(_0xc8b3c,null));};exports[_0xd9ed('0x48')]=function(_0x40709e,_0x28c53e){if(_0x40709e[_0xd9ed('0x49')]['id']){delete _0x40709e[_0xd9ed('0x49')]['id'];}return db[_0xd9ed('0x46')][_0xd9ed('0x47')]({'where':{'id':_0x40709e[_0xd9ed('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28c53e,null))[_0xd9ed('0x25')](saveUpdates(_0x40709e[_0xd9ed('0x49')],null))['then'](respondWithResult(_0x28c53e,null))[_0xd9ed('0x41')](handleError(_0x28c53e,null));};exports[_0xd9ed('0x4b')]=function(_0x472742,_0x9cad61,_0x27bccf){return db['sequelize'][_0xd9ed('0x4c')](function(_0x14b452){if(_0x472742[_0xd9ed('0x49')][_0xd9ed('0x4d')]==='files'){_0x472742[_0xd9ed('0x49')]['directory']=path[_0xd9ed('0x4e')](config['root'],'server/files/moh',_0x472742[_0xd9ed('0x49')][_0xd9ed('0x29')]);}return db['VoiceMusicOnHold']['create'](_0x472742[_0xd9ed('0x49')],{'transaction':_0x14b452})['then'](function(_0xec86f0){if(_0x472742[_0xd9ed('0x49')][_0xd9ed('0x4d')]==='files'){fs[_0xd9ed('0x4f')](_0xec86f0[_0xd9ed('0x50')],parseInt('0777',0x8));}var _0x54b06e=_0x472742[_0xd9ed('0x51')][_0xd9ed('0x26')]({'plain':!![]});if(!_0x54b06e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54b06e[_0xd9ed('0x52')]===_0xd9ed('0x51')){var _0xbab7a3=_0xec86f0[_0xd9ed('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xd9ed('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x54b06e[_0xd9ed('0x53')]},'raw':!![]})['then'](function(_0xb23e81){if(_0xb23e81&&_0xb23e81[_0xd9ed('0x54')]===0x0){return db['UserProfileResource'][_0xd9ed('0x4b')]({'name':_0xbab7a3[_0xd9ed('0x29')],'resourceId':_0xbab7a3['id'],'type':_0xb23e81[_0xd9ed('0x29')],'sectionId':_0xb23e81['id']},{})['then'](function(){return _0xec86f0;});}else{return _0xec86f0;}})[_0xd9ed('0x41')](function(_0x4c5c07){logger[_0xd9ed('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c5c07);});}return _0xec86f0;});})[_0xd9ed('0x25')](respondWithResult(_0x9cad61,0xc9))[_0xd9ed('0x41')](handleError(_0x9cad61,null));};exports[_0xd9ed('0x28')]=function(_0x194752,_0x3ea477,_0x1b5575){var _0x3704ad;return db[_0xd9ed('0x46')]['find']({'where':{'id':_0x194752['params']['id']}})['then'](function(_0x6a077d){if(_0x6a077d){return db[_0xd9ed('0x56')][_0xd9ed('0x4c')](function(_0x4a3553){return _0x6a077d[_0xd9ed('0x28')]({'transaction':_0x4a3553,'raw':!![]})[_0xd9ed('0x25')](function(_0x42f1e7){if(_0x42f1e7[_0xd9ed('0x50')]){fs[_0xd9ed('0x57')](_0x42f1e7[_0xd9ed('0x50')])[_0xd9ed('0x58')](function(_0x201cff){fs[_0xd9ed('0x59')](path[_0xd9ed('0x4e')](_0x42f1e7[_0xd9ed('0x50')],_0x201cff));});fs['rmdirSync'](_0x42f1e7[_0xd9ed('0x50')]);}return _0x42f1e7;});})[_0xd9ed('0x41')](function(_0x481551){throw new db[(_0xd9ed('0x5a'))][(_0xd9ed('0x5b'))](_0x481551[_0xd9ed('0x5c')]);});}})[_0xd9ed('0x25')](handleEntityNotFound(_0x3ea477,null))['then'](removeEntity(_0x3ea477,null))[_0xd9ed('0x41')](handleError(_0x3ea477,null));};exports[_0xd9ed('0x5d')]=function(_0x45a97c,_0x114681,_0x44d6e7){return db['sequelize'][_0xd9ed('0x4c')](function(_0x3349be){var _0x354a9e;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x45a97c['params']['id']}})[_0xd9ed('0x25')](function(_0x4c8911){if(_0x4c8911){_0x354a9e=_0x4c8911;return _0x4c8911[_0xd9ed('0x5d')](_0x45a97c[_0xd9ed('0x49')]['id'],{'transaction':_0x3349be});}})[_0xd9ed('0x25')](function(_0x2b0452){if(_0x2b0452){return db['Sound'][_0xd9ed('0x5e')]({'where':{'id':_0x45a97c[_0xd9ed('0x49')]['id']},'attributes':['id',_0xd9ed('0x29'),_0xd9ed('0x5f'),'converted_format',_0xd9ed('0x60')],'raw':!![]});}})[_0xd9ed('0x25')](function(_0x544fa0){if(_0x544fa0){var _0x55d996=path[_0xd9ed('0x4e')](config[_0xd9ed('0x61')],_0xd9ed('0x62'),util[_0xd9ed('0x63')](_0xd9ed('0x64'),path[_0xd9ed('0x65')](_0x544fa0[_0xd9ed('0x5f')],path[_0xd9ed('0x66')](_0x544fa0[_0xd9ed('0x5f')])),_0x544fa0[_0xd9ed('0x67')]));var _0x59a2a1=path[_0xd9ed('0x4e')](config[_0xd9ed('0x61')],_0xd9ed('0x68'),_0x354a9e[_0xd9ed('0x29')],util[_0xd9ed('0x63')](_0xd9ed('0x64'),_0x544fa0[_0xd9ed('0x29')],_0x544fa0[_0xd9ed('0x67')]));fs[_0xd9ed('0x69')](_0x55d996,_0x59a2a1);return _0x544fa0;}})[_0xd9ed('0x41')](function(_0x1e246e){throw new db[(_0xd9ed('0x5a'))]['ValidationError'](_0x1e246e[_0xd9ed('0x5c')]);});})[_0xd9ed('0x25')](handleEntityNotFound(_0x114681,null))[_0xd9ed('0x25')](respondWithResult(_0x114681,0xc9))[_0xd9ed('0x41')](handleError(_0x114681,null));};exports['removeSound']=function(_0x577ca4,_0x249c82,_0x296d87){return db[_0xd9ed('0x56')]['transaction'](function(_0x5c176f){var _0x7a1762;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x577ca4[_0xd9ed('0x4a')]['id']}})[_0xd9ed('0x25')](handleEntityNotFound(_0x249c82,null))[_0xd9ed('0x25')](function(_0x16bc2f){if(_0x16bc2f){_0x7a1762=_0x16bc2f;return _0x16bc2f[_0xd9ed('0x6a')](_0x577ca4['params'][_0xd9ed('0x6b')]);}})[_0xd9ed('0x25')](function(_0x537dbc){if(_0x537dbc){return db[_0xd9ed('0x6c')][_0xd9ed('0x5e')]({'where':{'id':_0x577ca4[_0xd9ed('0x4a')]['id2']},'attributes':['id',_0xd9ed('0x29'),'save_name','converted_format',_0xd9ed('0x60')],'raw':!![]});}})[_0xd9ed('0x25')](function(_0x3438e0){if(_0x3438e0){fs['unlinkSync'](path[_0xd9ed('0x4e')](_0x7a1762['directory'],util['format'](_0xd9ed('0x64'),_0x3438e0['name'],_0x3438e0['converted_format'])));return _0x3438e0;}})[_0xd9ed('0x41')](function(_0x20a4ac){throw new db[(_0xd9ed('0x5a'))][(_0xd9ed('0x5b'))](_0x20a4ac['message']);});})[_0xd9ed('0x25')](handleEntityNotFound(_0x249c82,null))[_0xd9ed('0x25')](respondWithStatusCode(_0x249c82,0xcc))['catch'](handleError(_0x249c82,null));};exports[_0xd9ed('0x6d')]=function(_0x2daffb,_0x535028,_0x3aef04){var _0x3ca901={};var _0x4b1c27={};var _0x519186;var _0x486f39;return db[_0xd9ed('0x46')]['findOne']({'where':{'id':_0x2daffb[_0xd9ed('0x4a')]['id']}})[_0xd9ed('0x25')](handleEntityNotFound(_0x535028,null))[_0xd9ed('0x25')](function(_0x2ea415){if(_0x2ea415){_0x519186=_0x2ea415;_0x4b1c27[_0xd9ed('0x33')]=_[_0xd9ed('0x2f')](db[_0xd9ed('0x6c')][_0xd9ed('0x2d')]);_0x4b1c27[_0xd9ed('0x30')]=_['keys'](_0x2daffb['query']);_0x4b1c27[_0xd9ed('0x31')]=_[_0xd9ed('0x32')](_0x4b1c27[_0xd9ed('0x33')],_0x4b1c27[_0xd9ed('0x30')]);_0x3ca901[_0xd9ed('0x34')]=_[_0xd9ed('0x32')](_0x4b1c27[_0xd9ed('0x33')],qs[_0xd9ed('0x35')](_0x2daffb[_0xd9ed('0x30')][_0xd9ed('0x35')]));_0x3ca901['attributes']=_0x3ca901[_0xd9ed('0x34')]['length']?_0x3ca901[_0xd9ed('0x34')]:_0x4b1c27[_0xd9ed('0x33')];_0x3ca901[_0xd9ed('0x6e')]=qs[_0xd9ed('0x38')](_0x2daffb['query'][_0xd9ed('0x38')]);_0x3ca901[_0xd9ed('0x3b')]=qs[_0xd9ed('0x31')](_['pick'](_0x2daffb[_0xd9ed('0x30')],_0x4b1c27[_0xd9ed('0x31')]));if(_0x2daffb[_0xd9ed('0x30')][_0xd9ed('0x3a')]){_0x3ca901['where']=_[_0xd9ed('0x3c')](_0x3ca901[_0xd9ed('0x3b')],{'$or':_[_0xd9ed('0x2c')](_0x3ca901[_0xd9ed('0x34')],function(_0x479966){var _0x1732af={};_0x1732af[_0x479966]={'$like':'%'+_0x2daffb[_0xd9ed('0x30')][_0xd9ed('0x3a')]+'%'};return _0x1732af;})});}_0x3ca901=_[_0xd9ed('0x3c')]({},_0x3ca901,_0x2daffb[_0xd9ed('0x45')]);return _0x519186[_0xd9ed('0x6d')](_0x3ca901);}})['then'](function(_0x9e9d37){if(_0x9e9d37){_0x486f39=_0x9e9d37[_0xd9ed('0x43')];if(!_0x2daffb['query'][_0xd9ed('0x36')](_0xd9ed('0x37'))){_0x3ca901['limit']=qs[_0xd9ed('0x1e')](_0x2daffb[_0xd9ed('0x30')][_0xd9ed('0x1e')]);_0x3ca901['offset']=qs['offset'](_0x2daffb[_0xd9ed('0x30')][_0xd9ed('0x20')]);}return _0x519186['getSounds'](_0x3ca901);}})[_0xd9ed('0x25')](function(_0x25f8db){if(_0x25f8db){return _0x25f8db?{'count':_0x486f39,'rows':_0x25f8db}:null;}})[_0xd9ed('0x25')](respondWithResult(_0x535028,null))[_0xd9ed('0x41')](handleError(_0x535028,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 17e0a77..d14de06 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 _0xa258=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x48fa90,_0x196754){var _0x1329d0=function(_0x52706d){while(--_0x52706d){_0x48fa90['push'](_0x48fa90['shift']());}};_0x1329d0(++_0x196754);}(_0xa258,0x155));var _0x8a25=function(_0x58391a,_0x3cc666){_0x58391a=_0x58391a-0x0;var _0xe02c18=_0xa258[_0x58391a];return _0xe02c18;};'use strict';var _=require(_0x8a25('0x0'));var util=require(_0x8a25('0x1'));var logger=require(_0x8a25('0x2'))(_0x8a25('0x3'));var moment=require(_0x8a25('0x4'));var BPromise=require(_0x8a25('0x5'));var rp=require(_0x8a25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a25('0x7'));var config=require(_0x8a25('0x8'));var attributes=require(_0x8a25('0x9'));module['exports']=function(_0x196ba8,_0x3c713f){return _0x196ba8[_0x8a25('0xa')](_0x8a25('0xb'),attributes,{'tableName':_0x8a25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d81=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMusicOnHold'];(function(_0x6f56dc,_0x3fe3d7){var _0x55977e=function(_0x359ec3){while(--_0x359ec3){_0x6f56dc['push'](_0x6f56dc['shift']());}};_0x55977e(++_0x3fe3d7);}(_0x8d81,0xe4));var _0x18d8=function(_0x5bbcf0,_0x1875da){_0x5bbcf0=_0x5bbcf0-0x0;var _0x3c150d=_0x8d81[_0x5bbcf0];return _0x3c150d;};'use strict';var _=require(_0x18d8('0x0'));var util=require(_0x18d8('0x1'));var logger=require(_0x18d8('0x2'))(_0x18d8('0x3'));var moment=require(_0x18d8('0x4'));var BPromise=require(_0x18d8('0x5'));var rp=require(_0x18d8('0x6'));var fs=require('fs');var path=require(_0x18d8('0x7'));var rimraf=require(_0x18d8('0x8'));var config=require(_0x18d8('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x18d8('0xa')]=function(_0x12e182,_0x5cc1b6){return _0x12e182['define'](_0x18d8('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 6c228e7..c053352 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x4d9263,_0x44ea9e){var _0x172077=function(_0x125337){while(--_0x125337){_0x4d9263['push'](_0x4d9263['shift']());}};_0x172077(++_0x44ea9e);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x195542,_0x5f3d58){var _0x5a268b=function(_0x124d2b){while(--_0x124d2b){_0x195542['push'](_0x195542['shift']());}};_0x5a268b(++_0x5f3d58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8609c28..32460b4 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 _0xbe6f=['index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xbe6f,0x105));var _0xfbe6=function(_0x2f5556,_0x2b6c90){_0x2f5556=_0x2f5556-0x0;var _0x5523c1=_0xbe6f[_0x2f5556];return _0x5523c1;};'use strict';var multer=require(_0xfbe6('0x0'));var util=require(_0xfbe6('0x1'));var path=require('path');var timeout=require(_0xfbe6('0x2'));var express=require('express');var router=express[_0xfbe6('0x3')]();var fs_extra=require(_0xfbe6('0x4'));var auth=require(_0xfbe6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbe6('0x6'));var controller=require('./voicePrefix.controller');router[_0xfbe6('0x7')]('/',auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x9')]);router[_0xfbe6('0x7')](_0xfbe6('0xa'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0xb')]);router[_0xfbe6('0x7')](_0xfbe6('0xc'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0xd')]);router[_0xfbe6('0x7')](_0xfbe6('0xe'),auth['isAuthenticated'](),controller[_0xfbe6('0xf')]);router[_0xfbe6('0x7')](_0xfbe6('0x10'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x11')]);router[_0xfbe6('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/users',auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x13')]);router[_0xfbe6('0x12')](_0xfbe6('0x10'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x14')]);router[_0xfbe6('0x15')](_0xfbe6('0xc'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x16')]);router[_0xfbe6('0x17')](_0xfbe6('0xc'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x18')]);router[_0xfbe6('0x17')]('/:id/users',auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x19')]);router[_0xfbe6('0x17')](_0xfbe6('0x10'),auth[_0xfbe6('0x8')](),controller[_0xfbe6('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd89f=['create','post','addAgents','addTeams','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams'];(function(_0x2ea980,_0x40912b){var _0x202fd6=function(_0x16344d){while(--_0x16344d){_0x2ea980['push'](_0x2ea980['shift']());}};_0x202fd6(++_0x40912b);}(_0xd89f,0x191));var _0xfd89=function(_0x103913,_0x2053c4){_0x103913=_0x103913-0x0;var _0x3df56b=_0xd89f[_0x103913];return _0x3df56b;};'use strict';var multer=require(_0xfd89('0x0'));var util=require(_0xfd89('0x1'));var path=require(_0xfd89('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd89('0x3'));var router=express[_0xfd89('0x4')]();var fs_extra=require(_0xfd89('0x5'));var auth=require(_0xfd89('0x6'));var interaction=require(_0xfd89('0x7'));var config=require(_0xfd89('0x8'));var controller=require('./voicePrefix.controller');router[_0xfd89('0x9')]('/',auth[_0xfd89('0xa')](),controller[_0xfd89('0xb')]);router[_0xfd89('0x9')](_0xfd89('0xc'),auth[_0xfd89('0xa')](),controller[_0xfd89('0xd')]);router[_0xfd89('0x9')](_0xfd89('0xe'),auth[_0xfd89('0xa')](),controller[_0xfd89('0xf')]);router[_0xfd89('0x9')](_0xfd89('0x10'),auth[_0xfd89('0xa')](),controller[_0xfd89('0x11')]);router['get'](_0xfd89('0x12'),auth[_0xfd89('0xa')](),controller['getTeams']);router['post']('/',auth[_0xfd89('0xa')](),controller[_0xfd89('0x13')]);router[_0xfd89('0x14')](_0xfd89('0x10'),auth['isAuthenticated'](),controller[_0xfd89('0x15')]);router['post'](_0xfd89('0x12'),auth[_0xfd89('0xa')](),controller[_0xfd89('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfd89('0x17')]);router[_0xfd89('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfd89('0x19')]);router[_0xfd89('0x18')](_0xfd89('0x10'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xfd89('0x18')](_0xfd89('0x12'),auth[_0xfd89('0xa')](),controller[_0xfd89('0x1a')]);module[_0xfd89('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ea64a87..c85cd24 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 _0x520b=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x520b,0x71));var _0xb520=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x520b[_0x1dac7a];return _0x4cb363;};'use strict';var Sequelize=require(_0xb520('0x0'));module[_0xb520('0x1')]={'name':{'type':Sequelize[_0xb520('0x2')],'allowNull':![],'unique':_0xb520('0x3')},'prefix':{'type':Sequelize[_0xb520('0x4')],'get':function(_0x34e1d0){return _0xb520('0x5')+this[_0xb520('0x6')](_0xb520('0x3'))+'-';}},'description':{'type':Sequelize[_0xb520('0x2')]},'callerIdAll':{'type':Sequelize[_0xb520('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xb520('0x7')]}}; \ No newline at end of file +var _0x5328=['STRING','name','VIRTUAL','system-','getDataValue','exports'];(function(_0x13a0b0,_0x5b4f02){var _0x9cb7eb=function(_0x1d9603){while(--_0x1d9603){_0x13a0b0['push'](_0x13a0b0['shift']());}};_0x9cb7eb(++_0x5b4f02);}(_0x5328,0x191));var _0x8532=function(_0x595c67,_0x127f9e){_0x595c67=_0x595c67-0x0;var _0x419372=_0x5328[_0x595c67];return _0x419372;};'use strict';var Sequelize=require('sequelize');module[_0x8532('0x0')]={'name':{'type':Sequelize[_0x8532('0x1')],'allowNull':![],'unique':_0x8532('0x2')},'prefix':{'type':Sequelize[_0x8532('0x3')],'get':function(_0x502694){return _0x8532('0x4')+this[_0x8532('0x5')](_0x8532('0x2'))+'-';}},'description':{'type':Sequelize[_0x8532('0x1')]},'callerIdAll':{'type':Sequelize[_0x8532('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 16420e2..3aa1535 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 _0x065e=['localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','VoicePrefixes','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoicePrefix','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','callerIdAll','push','Set','PREFIX-CALLERIDALL=','NoOp','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','findAll','Agents','voicePause','interface','each','upsert','UserVoicePrefix','forEach','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','every','TeamId','includes','all','union','compact','isEmpty','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x39a833,_0x41bdc3){var _0x5913cc=function(_0xec7f31){while(--_0xec7f31){_0x39a833['push'](_0x39a833['shift']());}};_0x5913cc(++_0x41bdc3);}(_0x065e,0x1a7));var _0xe065=function(_0x1b4e63,_0x563570){_0x1b4e63=_0x1b4e63-0x0;var _0x1972ce=_0x065e[_0x1b4e63];return _0x1972ce;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];config[_0xe065('0x16')]=_[_0xe065('0x17')](config['redis'],{'host':_0xe065('0x18'),'port':0x18eb});var socket=require(_0xe065('0x19'))(new Redis(config[_0xe065('0x16')]));require(_0xe065('0x1a'))[_0xe065('0x1b')](socket);function respondWithStatusCode(_0x541985,_0x3d3557){_0x3d3557=_0x3d3557||0xcc;return function(_0x2b4789){if(_0x2b4789){return _0x541985[_0xe065('0x1c')](_0x3d3557);}return _0x541985[_0xe065('0x1d')](_0x3d3557)[_0xe065('0x1e')]();};}function respondWithResult(_0x352206,_0x2e5feb){_0x2e5feb=_0x2e5feb||0xc8;return function(_0x545100){if(_0x545100){return _0x352206[_0xe065('0x1d')](_0x2e5feb)[_0xe065('0x1f')](_0x545100);}};}function respondWithFilteredResult(_0x54d260,_0x2bfec0){return function(_0x1d2f7a){if(_0x1d2f7a){var _0x397f05=typeof _0x2bfec0[_0xe065('0x20')]===_0xe065('0x21')&&typeof _0x2bfec0[_0xe065('0x22')]===_0xe065('0x21');var _0x5000e1=_0x1d2f7a[_0xe065('0x23')];var _0x52e9b2=_0x397f05?0x0:_0x2bfec0[_0xe065('0x20')];var _0x23233d=_0x397f05?_0x1d2f7a['count']:_0x2bfec0[_0xe065('0x20')]+_0x2bfec0['limit'];var _0xe26e9b;if(_0x23233d>=_0x5000e1){_0x23233d=_0x5000e1;_0xe26e9b=0xc8;}else{_0xe26e9b=0xce;}_0x54d260[_0xe065('0x1d')](_0xe26e9b);return _0x54d260[_0xe065('0x24')](_0xe065('0x25'),_0x52e9b2+'-'+_0x23233d+'/'+_0x5000e1)[_0xe065('0x1f')](_0x1d2f7a);}return null;};}function patchUpdates(_0x105cb2){return function(_0x22a0cb){try{jsonpatch[_0xe065('0x26')](_0x22a0cb,_0x105cb2,!![]);}catch(_0x1c5dd9){return BPromise['reject'](_0x1c5dd9);}return _0x22a0cb[_0xe065('0x27')]();};}function saveUpdates(_0x43b712,_0x44ec95){return function(_0x13f6e5){if(_0x13f6e5){return _0x13f6e5['update'](_0x43b712)['then'](function(_0x164965){return _0x164965;});}return null;};}function removeEntity(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(_0x27e669){return _0x27e669[_0xe065('0x28')]()[_0xe065('0x29')](function(){var _0x418731=_0x27e669[_0xe065('0x2a')]({'plain':!![]});var _0x3b1caf=_0xe065('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1caf,'resourceId':_0x418731['id']}})[_0xe065('0x29')](function(){return _0x27e669;});})[_0xe065('0x29')](function(){_0x530dc0[_0xe065('0x1d')](0xcc)[_0xe065('0x1e')]();});}};}function handleEntityNotFound(_0x5b1220,_0x23f573){return function(_0x55ecaa){if(!_0x55ecaa){_0x5b1220['sendStatus'](0x194);}return _0x55ecaa;};}function handleError(_0x182743,_0x2659e6){_0x2659e6=_0x2659e6||0x1f4;return function(_0x2aa766){logger['error'](_0x2aa766[_0xe065('0x2c')]);if(_0x2aa766['name']){delete _0x2aa766[_0xe065('0x2d')];}_0x182743[_0xe065('0x1d')](_0x2659e6)[_0xe065('0x2e')](_0x2aa766);};}exports[_0xe065('0x2f')]=function(_0x58c49b,_0x3f02b2){var _0x4940cf={},_0x3fa56f={},_0x2e4e4a={'count':0x0,'rows':[]};var _0x5d0864=_[_0xe065('0x30')](db['VoicePrefix'][_0xe065('0x31')],function(_0x4999b0){return{'name':_0x4999b0[_0xe065('0x32')],'type':_0x4999b0[_0xe065('0x33')][_0xe065('0x34')]};});_0x3fa56f[_0xe065('0x35')]=_['map'](_0x5d0864,_0xe065('0x2d'));_0x3fa56f[_0xe065('0x36')]=_[_0xe065('0x37')](_0x58c49b[_0xe065('0x36')]);_0x3fa56f[_0xe065('0x38')]=_[_0xe065('0x39')](_0x3fa56f['model'],_0x3fa56f[_0xe065('0x36')]);_0x4940cf[_0xe065('0x3a')]=_['intersection'](_0x3fa56f[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3b')]));_0x4940cf[_0xe065('0x3a')]=_0x4940cf[_0xe065('0x3a')][_0xe065('0x3c')]?_0x4940cf['attributes']:_0x3fa56f[_0xe065('0x35')];if(!_0x58c49b['query'][_0xe065('0x3d')](_0xe065('0x3e'))){_0x4940cf[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x58c49b[_0xe065('0x36')][_0xe065('0x22')]);_0x4940cf['offset']=qs[_0xe065('0x20')](_0x58c49b[_0xe065('0x36')][_0xe065('0x20')]);}_0x4940cf['order']=qs[_0xe065('0x3f')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3f')]);_0x4940cf[_0xe065('0x40')]=qs[_0xe065('0x38')](_['pick'](_0x58c49b[_0xe065('0x36')],_0x3fa56f[_0xe065('0x38')]),_0x5d0864);if(_0x58c49b['query'][_0xe065('0x41')]){_0x4940cf['where']=_[_0xe065('0x42')](_0x4940cf[_0xe065('0x40')],{'$or':_['map'](_0x5d0864,function(_0x3c7e70){if(_0x3c7e70[_0xe065('0x33')]!=='VIRTUAL'){var _0x16b5da={};_0x16b5da[_0x3c7e70[_0xe065('0x2d')]]={'$like':'%'+_0x58c49b[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x16b5da;}})});}_0x4940cf=_[_0xe065('0x42')]({},_0x4940cf,_0x58c49b[_0xe065('0x43')]);var _0x395cc2={'where':_0x4940cf[_0xe065('0x40')]};return db[_0xe065('0x44')][_0xe065('0x23')](_0x395cc2)[_0xe065('0x29')](function(_0x4364c3){_0x2e4e4a[_0xe065('0x23')]=_0x4364c3;if(_0x58c49b['query']['includeAll']){_0x4940cf[_0xe065('0x45')]=[{'all':!![]}];}return db[_0xe065('0x44')]['findAll'](_0x4940cf);})[_0xe065('0x29')](function(_0x448044){_0x2e4e4a[_0xe065('0x46')]=_0x448044;return _0x2e4e4a;})[_0xe065('0x29')](respondWithFilteredResult(_0x3f02b2,_0x4940cf))[_0xe065('0x47')](handleError(_0x3f02b2,null));};exports[_0xe065('0x48')]=function(_0x39440c,_0x11e82d){var _0x1f93e9={'raw':![],'where':{'id':_0x39440c[_0xe065('0x49')]['id']}},_0x52073d={};_0x52073d[_0xe065('0x35')]=_[_0xe065('0x37')](db['VoicePrefix'][_0xe065('0x31')]);_0x52073d[_0xe065('0x36')]=_[_0xe065('0x37')](_0x39440c[_0xe065('0x36')]);_0x52073d['filters']=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],_0x52073d[_0xe065('0x36')]);_0x1f93e9[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x39440c['query'][_0xe065('0x3b')]));_0x1f93e9[_0xe065('0x3a')]=_0x1f93e9[_0xe065('0x3a')][_0xe065('0x3c')]?_0x1f93e9[_0xe065('0x3a')]:_0x52073d[_0xe065('0x35')];if(_0x39440c[_0xe065('0x36')]['includeAll']){_0x1f93e9[_0xe065('0x45')]=[{'all':!![]}];}_0x1f93e9=_['merge']({},_0x1f93e9,_0x39440c[_0xe065('0x43')]);return db[_0xe065('0x44')][_0xe065('0x4a')](_0x1f93e9)['then'](handleEntityNotFound(_0x11e82d,null))[_0xe065('0x29')](respondWithResult(_0x11e82d,null))[_0xe065('0x47')](handleError(_0x11e82d,null));};exports[_0xe065('0x28')]=function(_0x162d11,_0x3c6880){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x162d11[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x3c6880,null))[_0xe065('0x29')](removeEntity(_0x3c6880,null))[_0xe065('0x47')](handleError(_0x3c6880,null));};exports[_0xe065('0x4b')]=function(_0x14327f,_0x490498){return db['VoicePrefix']['describe']()[_0xe065('0x29')](respondWithResult(_0x490498,null))['catch'](handleError(_0x490498,null));};exports[_0xe065('0x4c')]=function(_0x2c5e42,_0x5a7a98){var _0x480aec;return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5cce78){return db[_0xe065('0x44')][_0xe065('0x4c')](_0x2c5e42[_0xe065('0x4f')],{'transaction':_0x5cce78})[_0xe065('0x29')](function(_0x12df39){_0x480aec=_0x12df39[_0xe065('0x2a')]({'plain':!![]});return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0x480aec[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0x49a367){return createVoicePrefixExtensions(_0x480aec,_0x49a367,_0x5cce78);});});})[_0xe065('0x29')](function(){var _0x18eb92=_0x2c5e42[_0xe065('0x52')][_0xe065('0x2a')]({'plain':!![]});if(!_0x18eb92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18eb92[_0xe065('0x53')]===_0xe065('0x52')){var _0x21884d=_0x480aec;return db[_0xe065('0x54')]['find']({'where':{'name':_0xe065('0x2b'),'userProfileId':_0x18eb92[_0xe065('0x55')]},'raw':!![]})[_0xe065('0x29')](function(_0x5320c6){if(_0x5320c6&&_0x5320c6[_0xe065('0x56')]===0x0){return db[_0xe065('0x57')][_0xe065('0x4c')]({'name':_0x21884d[_0xe065('0x2d')],'resourceId':_0x21884d['id'],'type':_0x5320c6[_0xe065('0x2d')],'sectionId':_0x5320c6['id']},{})[_0xe065('0x29')](function(){return _0x480aec;});}else{return _0x480aec;}})[_0xe065('0x47')](function(_0x464ef7){logger[_0xe065('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464ef7);throw _0x464ef7;});}return _0x480aec;})[_0xe065('0x29')](respondWithResult(_0x5a7a98,null))['catch'](handleError(_0x5a7a98,null));};function Extension(_0x44edf0,_0x24fc1c,_0x3c1229,_0x4e9e85){this['context']='from-sip';this[_0xe065('0x59')]=_0x44edf0;this[_0xe065('0x5a')]=_0x3c1229;this[_0xe065('0x33')]=_0xe065('0x5b');this[_0xe065('0x5c')]=_0xe065('0x5d');this[_0xe065('0x5e')]=_0x24fc1c;this[_0xe065('0x5f')]=_0x4e9e85;}function createVoicePrefixExtensions(_0x20abe0,_0x3169fa,_0x25ec8a){return new BPromise(function(_0x590429,_0x544bff){var _0x2fe0ac=new Extension(formatPrefixName(_0x20abe0[_0xe065('0x60')]),0x1,'NoOp',_0xe065('0x61'));_0x2fe0ac['VoicePrefixId']=_0x20abe0['id'];return db['VoiceExtension'][_0xe065('0x4c')](_0x2fe0ac,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4e7275){var _0x96355e=_0x4e7275[_0xe065('0x2a')]({'plain':!![]});var _0x817baf=_[_0xe065('0x30')](addVoicePrefixExtensions(_0x20abe0,_0x3169fa),function(_0x5edc0f){_0x5edc0f[_0xe065('0x51')]=_0x96355e['id'];_0x5edc0f[_0xe065('0x62')]=_0x20abe0['id'];return _0x5edc0f;});return db[_0xe065('0x50')][_0xe065('0x63')](_0x817baf,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4f35a6){if(!_0x4f35a6){return _0x544bff(_0xe065('0x64'));}else{return _0x590429(_0x4f35a6);}})[_0xe065('0x47')](function(_0x29b3f0){return _0x544bff(_0x29b3f0);});});;});};function addVoicePrefixExtensions(_0x155133,_0x2968c5){var _0xfce2e=[];var _0x5af9d5=formatPrefixName(_0x155133['prefix']);_0xfce2e['push'](new Extension(_0x5af9d5,0x2,'Set','CDR(prefix)='+_0x155133[_0xe065('0x2d')]));if(_0x155133[_0xe065('0x65')]){_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x67'),_0xe065('0x68')+_0x155133[_0xe065('0x65')]));}else{_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x69'),'No\x20callerid\x20available'));}_0xfce2e['push'](new Extension(_0x5af9d5,0x4,_0xe065('0x6a'),_0x2968c5[_0xe065('0x6b')]+','+_0xe065('0x6c')+(0x8+_0x155133['name'][_0xe065('0x3c')])+'}'+','+0x1));return _0xfce2e;}function formatPrefixName(_0x268428){var _0x113a0f='_';for(var _0x4765a0=0x0;_0x4765a0<_0x268428[_0xe065('0x3c')];_0x4765a0++){if(_0x268428[_0xe065('0x6d')](_0x4765a0)=='-'){_0x113a0f+=_0x268428[_0xe065('0x6d')](_0x4765a0);}else{_0x113a0f+='['+_0x268428[_0xe065('0x6d')](_0x4765a0)+']';}}_0x113a0f+='.';return _0x113a0f;}exports[_0xe065('0x6e')]=function(_0xecef2,_0x213feb,_0x4493db){var _0xa5310c=_0xecef2[_0xe065('0x4f')];_0xa5310c[_0xe065('0x60')]=_0xe065('0x6f')+_0xa5310c[_0xe065('0x2d')]+'-';return db[_0xe065('0x4d')]['transaction'](function(_0x31d6cb){return db[_0xe065('0x44')][_0xe065('0x6e')](_0xa5310c,{'where':{'id':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x28')]({'where':{'VoicePrefixId':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0xa5310c[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0xa08631){return createVoicePrefixExtensions(_0xa5310c,_0xa08631,_0x31d6cb);});});});})[_0xe065('0x29')](function(){return db[_0xe065('0x44')][_0xe065('0x70')](_0xa5310c['id']);})[_0xe065('0x29')](respondWithResult(_0x213feb,null))[_0xe065('0x47')](handleError(_0x213feb,null));};exports['addAgents']=function(_0x256eef,_0x185b5b,_0x3e2241){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x256eef[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x185b5b,null))[_0xe065('0x29')](function(_0x54b1f2){if(_0x54b1f2){return _0x54b1f2[_0xe065('0x71')](_0x256eef['body']['ids'],_[_0xe065('0x72')](_0x256eef['body'],[_0xe065('0x73'),'id'])||{})['spread'](function(_0x1df721){for(var _0x162482=0x0;_0x162482<_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0xe065('0x3c')];_0x162482+=0x1){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':Number(_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0x162482]),'VoicePrefixId':Number(_0x256eef['params']['id'])});}return _0x1df721;});}})[_0xe065('0x29')](respondWithResult(_0x185b5b,null))[_0xe065('0x47')](handleError(_0x185b5b,null));};exports[_0xe065('0x76')]=function(_0x3f8e32,_0x5858d9,_0x26c427){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3f8e32['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x5858d9,null))[_0xe065('0x29')](function(_0x3c024b){if(_0x3c024b){return _0x3c024b['removeAgents'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])['then'](function(){if(_['isArray'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])){for(var _0x1b8c33=0x0;_0x1b8c33<_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]['length'];_0x1b8c33+=0x1){socket['emit'](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')]['ids'][_0x1b8c33]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}}else{socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}});}})[_0xe065('0x29')](respondWithStatusCode(_0x5858d9,null))[_0xe065('0x47')](handleError(_0x5858d9,null));};exports[_0xe065('0x78')]=function(_0x1ec81f,_0x4d25b9,_0x5d940d){var _0x34174f={};var _0x5336e3={};var _0x2451ec;var _0x45b479;return db[_0xe065('0x44')]['findOne']({'where':{'id':_0x1ec81f[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x4d25b9,null))[_0xe065('0x29')](function(_0x124054){if(_0x124054){_0x2451ec=_0x124054;_0x5336e3[_0xe065('0x35')]=_[_0xe065('0x37')](db[_0xe065('0x79')][_0xe065('0x31')]);_0x5336e3[_0xe065('0x36')]=_[_0xe065('0x37')](_0x1ec81f[_0xe065('0x36')]);_0x5336e3['filters']=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],_0x5336e3[_0xe065('0x36')]);_0x34174f[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3b')]));_0x34174f[_0xe065('0x3a')]=_0x34174f[_0xe065('0x3a')][_0xe065('0x3c')]?_0x34174f['attributes']:_0x5336e3[_0xe065('0x35')];_0x34174f[_0xe065('0x7a')]=qs[_0xe065('0x3f')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3f')]);_0x34174f[_0xe065('0x40')]=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0x1ec81f[_0xe065('0x36')],_0x5336e3[_0xe065('0x38')]));if(_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]){_0x34174f[_0xe065('0x40')]=_[_0xe065('0x42')](_0x34174f[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x34174f[_0xe065('0x3a')],function(_0x47792d){var _0x105eaa={};_0x105eaa[_0x47792d]={'$like':'%'+_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x105eaa;})});}_0x34174f=_[_0xe065('0x42')]({},_0x34174f,_0x1ec81f[_0xe065('0x43')]);return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x428745){if(_0x428745){_0x45b479=_0x428745[_0xe065('0x3c')];if(!_0x1ec81f[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x34174f[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x22')]);_0x34174f[_0xe065('0x20')]=qs[_0xe065('0x20')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x20')]);}return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x4da03f){if(_0x4da03f){return _0x4da03f?{'count':_0x45b479,'rows':_0x4da03f}:null;}})[_0xe065('0x29')](respondWithResult(_0x4d25b9,null))[_0xe065('0x47')](handleError(_0x4d25b9,null));};exports[_0xe065('0x7c')]=function(_0xe199d7,_0x40231d,_0x34b37c){var _0x24ebbd={};var _0x22bc5c={};var _0x5d6761;var _0x2f2f53;return db['VoicePrefix'][_0xe065('0x7d')]({'where':{'id':_0xe199d7['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x40231d,null))[_0xe065('0x29')](function(_0x19e3cf){if(_0x19e3cf){_0x5d6761=_0x19e3cf;_0x22bc5c[_0xe065('0x35')]=_['keys'](db['Team'][_0xe065('0x31')]);_0x22bc5c[_0xe065('0x36')]=_[_0xe065('0x37')](_0xe199d7['query']);_0x22bc5c[_0xe065('0x38')]=_[_0xe065('0x39')](_0x22bc5c[_0xe065('0x35')],_0x22bc5c['query']);_0x24ebbd['attributes']=_['intersection'](_0x22bc5c['model'],qs[_0xe065('0x3b')](_0xe199d7[_0xe065('0x36')][_0xe065('0x3b')]));_0x24ebbd[_0xe065('0x3a')]=_0x24ebbd[_0xe065('0x3a')]['length']?_0x24ebbd[_0xe065('0x3a')]:_0x22bc5c[_0xe065('0x35')];_0x24ebbd['order']=qs[_0xe065('0x3f')](_0xe199d7['query'][_0xe065('0x3f')]);_0x24ebbd['where']=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0xe199d7[_0xe065('0x36')],_0x22bc5c[_0xe065('0x38')]));if(_0xe199d7[_0xe065('0x36')][_0xe065('0x41')]){_0x24ebbd[_0xe065('0x40')]=_[_0xe065('0x42')](_0x24ebbd[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x24ebbd[_0xe065('0x3a')],function(_0x242712){var _0xa89a0e={};_0xa89a0e[_0x242712]={'$like':'%'+_0xe199d7[_0xe065('0x36')]['filter']+'%'};return _0xa89a0e;})});}_0x24ebbd=_['merge']({},_0x24ebbd,_0xe199d7[_0xe065('0x43')]);return _0x5d6761[_0xe065('0x7c')](_0x24ebbd);}})['then'](function(_0x33a5b9){if(_0x33a5b9){_0x2f2f53=_0x33a5b9[_0xe065('0x3c')];if(!_0xe199d7[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x24ebbd[_0xe065('0x22')]=qs[_0xe065('0x22')](_0xe199d7['query']['limit']);_0x24ebbd[_0xe065('0x20')]=qs[_0xe065('0x20')](_0xe199d7[_0xe065('0x36')][_0xe065('0x20')]);}return _0x5d6761['getTeams'](_0x24ebbd);}})[_0xe065('0x29')](function(_0x33f41c){if(_0x33f41c){return _0x33f41c?{'count':_0x2f2f53,'rows':_0x33f41c}:null;}})[_0xe065('0x29')](respondWithResult(_0x40231d,null))[_0xe065('0x47')](handleError(_0x40231d,null));};exports[_0xe065('0x7e')]=function(_0x123188,_0x490961,_0x3cd1c8){var _0x4a63da=_0x123188['body'][_0xe065('0x73')];var _0x14440a;return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x4a63da},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe065('0x81'),'attributes':['id',_0xe065('0x2d'),'online',_0xe065('0x82'),_0xe065('0x83')],'raw':!![]}]})[_0xe065('0x29')](function(_0x29ecc6){if(_0x29ecc6){_0x14440a=_0x29ecc6;var _0x2aab25=_['flatMap'](_0x29ecc6,function(_0x1998ee){var _0x5df1f5=_0x1998ee[_0xe065('0x2a')]({'plain':!![]});return _0x5df1f5['Agents'];});return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x123188[_0xe065('0x49')]['id']}})['then'](function(_0x4d68c2){return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5c61df){return _0x4d68c2[_0xe065('0x7e')](_0x4a63da,{'transaction':_0x5c61df})['then'](function(){return BPromise[_0xe065('0x84')](_0x14440a,function(_0x41c62a){return db['TeamVoicePrefix'][_0xe065('0x85')]({'TeamId':_0x41c62a['id'],'VoicePrefixId':_0x123188[_0xe065('0x49')]['id']},{'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){return BPromise[_0xe065('0x84')](_0x2aab25,function(_0xd8b280){return db[_0xe065('0x86')]['findOrCreate']({'where':{'UserId':_0xd8b280['id'],'VoicePrefixId':_0x123188['params']['id']},'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){_0x2aab25[_0xe065('0x87')](function(_0x41d5b5){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':_0x41d5b5['id'],'VoicePrefixId':_0x4d68c2['id']});});});});});}})['then'](respondWithStatusCode(_0x490961,null))['catch'](handleError(_0x490961,null));};exports['removeTeams']=function(_0x3e51b4,_0xab9cb,_0x5d64af){return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x3e51b4[_0xe065('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe065('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xab9cb,null))[_0xe065('0x29')](function(_0x42afb3){var _0x38119f=_[_0xe065('0x30')](_0x42afb3,'id');var _0x5b7ce9=[];var _0xa80c6d=[];var _0x3a46d3=squel['select']();_0x3a46d3[_0xe065('0x88')](_0xe065('0x89'))[_0xe065('0x8a')]('team_has_voice_prefixes','tq')[_0xe065('0x8b')]('user_has_teams','ut',_0xe065('0x8c'))[_0xe065('0x40')]('VoicePrefixId\x20=\x20?',_0x3e51b4['params']['id']);for(var _0x451186=0x0;_0x451186<_0x42afb3[_0xe065('0x3c')];_0x451186+=0x1){let _0x16e82a=_0x42afb3[_0x451186];for(var _0x243415=0x0;_0x243415<_0x16e82a[_0xe065('0x81')][_0xe065('0x3c')];_0x243415+=0x1){let _0x2b8d04=_0x16e82a['Agents'][_0x243415];var _0x572836=_0x3a46d3['clone']();_0x572836[_0xe065('0x40')](_0xe065('0x8d'),_0x2b8d04['id']);_0xa80c6d['push'](db[_0xe065('0x4d')][_0xe065('0x36')](_0x572836['toString'](),{'type':db[_0xe065('0x4d')]['QueryTypes']['SELECT']})[_0xe065('0x29')](function(_0x1a21c0){if(_0x1a21c0[_0xe065('0x3c')]===0x1){return _0x2b8d04['id'];}else{var _0x5c7e10=_[_0xe065('0x8e')](_[_0xe065('0x30')](_0x1a21c0,_0xe065('0x8f')),function(_0x10a15e){return _[_0xe065('0x90')](_0x38119f,_0x10a15e);});if(_0x5c7e10){return _0x2b8d04['id'];}}}));}}return BPromise[_0xe065('0x91')](_0xa80c6d)[_0xe065('0x29')](function(_0x20c16c){_0x5b7ce9=_(_0x5b7ce9)[_0xe065('0x92')](_0x20c16c)[_0xe065('0x93')]()['value']();return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3e51b4[_0xe065('0x49')]['id']}})[_0xe065('0x29')](function(_0x97b140){return db['sequelize'][_0xe065('0x4e')](function(_0x257ea2){return _0x97b140['removeTeams'](_0x3e51b4['query'][_0xe065('0x73')],{'transaction':_0x257ea2})[_0xe065('0x29')](function(){if(!_[_0xe065('0x94')](_0x5b7ce9)){return _0x97b140[_0xe065('0x76')](_0x5b7ce9,{'transaction':_0x257ea2});}})['then'](function(){_0x5b7ce9[_0xe065('0x87')](function(_0x1113fa){socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':_0x1113fa,'VoicePrefixId':_0x97b140['id']});});});});});});})['then'](respondWithStatusCode(_0xab9cb,null))[_0xe065('0x47')](handleError(_0xab9cb,null));}; \ No newline at end of file +var _0x351d=['isEmpty','forEach','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','VoicePrefix','findAll','catch','show','params','length','merge','options','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','CDR(prefix)=','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','Team','getTeams','addTeams','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','removeTeams','Agents','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x351d,0x90));var _0xd351=function(_0x13af33,_0x2d6f26){_0x13af33=_0x13af33-0x0;var _0x1ba868=_0x351d[_0x13af33];return _0x1ba868;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd351('0x13')]=_[_0xd351('0x14')](config[_0xd351('0x13')],{'host':_0xd351('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd351('0x13')]));require(_0xd351('0x16'))['register'](socket);function respondWithStatusCode(_0xc5a145,_0xb106ef){_0xb106ef=_0xb106ef||0xcc;return function(_0x3c2299){if(_0x3c2299){return _0xc5a145[_0xd351('0x17')](_0xb106ef);}return _0xc5a145[_0xd351('0x18')](_0xb106ef)['end']();};}function respondWithResult(_0x9f790f,_0x49d8bb){_0x49d8bb=_0x49d8bb||0xc8;return function(_0x5bdc03){if(_0x5bdc03){return _0x9f790f[_0xd351('0x18')](_0x49d8bb)['json'](_0x5bdc03);}};}function respondWithFilteredResult(_0x21e591,_0x1de35f){return function(_0x4e0164){if(_0x4e0164){var _0x4c6693=typeof _0x1de35f[_0xd351('0x19')]===_0xd351('0x1a')&&typeof _0x1de35f[_0xd351('0x1b')]===_0xd351('0x1a');var _0x51f265=_0x4e0164[_0xd351('0x1c')];var _0x4abbed=_0x4c6693?0x0:_0x1de35f['offset'];var _0x37d3ac=_0x4c6693?_0x4e0164['count']:_0x1de35f[_0xd351('0x19')]+_0x1de35f[_0xd351('0x1b')];var _0x3634c9;if(_0x37d3ac>=_0x51f265){_0x37d3ac=_0x51f265;_0x3634c9=0xc8;}else{_0x3634c9=0xce;}_0x21e591[_0xd351('0x18')](_0x3634c9);return _0x21e591[_0xd351('0x1d')]('Content-Range',_0x4abbed+'-'+_0x37d3ac+'/'+_0x51f265)[_0xd351('0x1e')](_0x4e0164);}return null;};}function patchUpdates(_0xbbc58){return function(_0x241265){try{jsonpatch['apply'](_0x241265,_0xbbc58,!![]);}catch(_0x1ce7f7){return BPromise[_0xd351('0x1f')](_0x1ce7f7);}return _0x241265[_0xd351('0x20')]();};}function saveUpdates(_0x59fb6d,_0x1ce279){return function(_0x34a5cb){if(_0x34a5cb){return _0x34a5cb[_0xd351('0x21')](_0x59fb6d)[_0xd351('0x22')](function(_0x489c9a){return _0x489c9a;});}return null;};}function removeEntity(_0x40f7f3,_0x483c92){return function(_0x358bff){if(_0x358bff){return _0x358bff[_0xd351('0x23')]()['then'](function(){var _0x2648d0=_0x358bff['get']({'plain':!![]});var _0x50d67e=_0xd351('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x50d67e,'resourceId':_0x2648d0['id']}})[_0xd351('0x22')](function(){return _0x358bff;});})['then'](function(){_0x40f7f3[_0xd351('0x18')](0xcc)[_0xd351('0x25')]();});}};}function handleEntityNotFound(_0x407b50,_0x4d3f48){return function(_0x71ce9c){if(!_0x71ce9c){_0x407b50['sendStatus'](0x194);}return _0x71ce9c;};}function handleError(_0x1c826b,_0x50039b){_0x50039b=_0x50039b||0x1f4;return function(_0x5f07b1){logger[_0xd351('0x26')](_0x5f07b1[_0xd351('0x27')]);if(_0x5f07b1[_0xd351('0x28')]){delete _0x5f07b1[_0xd351('0x28')];}_0x1c826b['status'](_0x50039b)[_0xd351('0x29')](_0x5f07b1);};}exports[_0xd351('0x2a')]=function(_0x38023c,_0x41da60){var _0x140591={},_0x205c79={},_0x103a7b={'count':0x0,'rows':[]};var _0x898949=_[_0xd351('0x2b')](db['VoicePrefix'][_0xd351('0x2c')],function(_0x453270){return{'name':_0x453270[_0xd351('0x2d')],'type':_0x453270[_0xd351('0x2e')]['key']};});_0x205c79[_0xd351('0x2f')]=_[_0xd351('0x2b')](_0x898949,_0xd351('0x28'));_0x205c79[_0xd351('0x30')]=_[_0xd351('0x31')](_0x38023c[_0xd351('0x30')]);_0x205c79[_0xd351('0x32')]=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],_0x205c79['query']);_0x140591['attributes']=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x38023c[_0xd351('0x30')][_0xd351('0x34')]));_0x140591[_0xd351('0x35')]=_0x140591['attributes']['length']?_0x140591[_0xd351('0x35')]:_0x205c79['model'];if(!_0x38023c[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x140591[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x38023c[_0xd351('0x30')][_0xd351('0x1b')]);_0x140591[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38023c[_0xd351('0x30')][_0xd351('0x19')]);}_0x140591['order']=qs[_0xd351('0x38')](_0x38023c['query'][_0xd351('0x38')]);_0x140591[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x38023c[_0xd351('0x30')],_0x205c79[_0xd351('0x32')]),_0x898949);if(_0x38023c['query'][_0xd351('0x3b')]){_0x140591[_0xd351('0x39')]=_['merge'](_0x140591[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x898949,function(_0x382f5b){if(_0x382f5b[_0xd351('0x2e')]!==_0xd351('0x3c')){var _0x5cc105={};_0x5cc105[_0x382f5b['name']]={'$like':'%'+_0x38023c[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x5cc105;}})});}_0x140591=_['merge']({},_0x140591,_0x38023c['options']);var _0x16677f={'where':_0x140591[_0xd351('0x39')]};return db['VoicePrefix']['count'](_0x16677f)[_0xd351('0x22')](function(_0x18f9d1){_0x103a7b[_0xd351('0x1c')]=_0x18f9d1;if(_0x38023c[_0xd351('0x30')][_0xd351('0x3d')]){_0x140591[_0xd351('0x3e')]=[{'all':!![]}];}return db[_0xd351('0x3f')][_0xd351('0x40')](_0x140591);})[_0xd351('0x22')](function(_0x553360){_0x103a7b['rows']=_0x553360;return _0x103a7b;})[_0xd351('0x22')](respondWithFilteredResult(_0x41da60,_0x140591))[_0xd351('0x41')](handleError(_0x41da60,null));};exports[_0xd351('0x42')]=function(_0x35f38f,_0x2bdd8f){var _0x4332e7={'raw':![],'where':{'id':_0x35f38f[_0xd351('0x43')]['id']}},_0xeaf4dc={};_0xeaf4dc[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x3f')][_0xd351('0x2c')]);_0xeaf4dc[_0xd351('0x30')]=_[_0xd351('0x31')](_0x35f38f[_0xd351('0x30')]);_0xeaf4dc[_0xd351('0x32')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],_0xeaf4dc[_0xd351('0x30')]);_0x4332e7[_0xd351('0x35')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x35f38f[_0xd351('0x30')][_0xd351('0x34')]));_0x4332e7[_0xd351('0x35')]=_0x4332e7['attributes'][_0xd351('0x44')]?_0x4332e7['attributes']:_0xeaf4dc[_0xd351('0x2f')];if(_0x35f38f[_0xd351('0x30')]['includeAll']){_0x4332e7['include']=[{'all':!![]}];}_0x4332e7=_[_0xd351('0x45')]({},_0x4332e7,_0x35f38f[_0xd351('0x46')]);return db[_0xd351('0x3f')]['find'](_0x4332e7)[_0xd351('0x22')](handleEntityNotFound(_0x2bdd8f,null))[_0xd351('0x22')](respondWithResult(_0x2bdd8f,null))['catch'](handleError(_0x2bdd8f,null));};exports[_0xd351('0x23')]=function(_0x53a2e8,_0x1eb5f3){return db[_0xd351('0x3f')]['find']({'where':{'id':_0x53a2e8['params']['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x1eb5f3,null))['then'](removeEntity(_0x1eb5f3,null))[_0xd351('0x41')](handleError(_0x1eb5f3,null));};exports[_0xd351('0x47')]=function(_0x9f1cd0,_0x4a27e3){return db[_0xd351('0x3f')]['describe']()['then'](respondWithResult(_0x4a27e3,null))['catch'](handleError(_0x4a27e3,null));};exports[_0xd351('0x48')]=function(_0x292af3,_0x334029){var _0x5a2e9b;return db['sequelize'][_0xd351('0x49')](function(_0x42f248){return db['VoicePrefix'][_0xd351('0x48')](_0x292af3[_0xd351('0x4a')],{'transaction':_0x42f248})['then'](function(_0x24ee0f){_0x5a2e9b=_0x24ee0f['get']({'plain':!![]});return db[_0xd351('0x4b')]['find']({'where':{'id':_0x5a2e9b[_0xd351('0x4c')]},'raw':!![]})[_0xd351('0x22')](function(_0x169ab1){return createVoicePrefixExtensions(_0x5a2e9b,_0x169ab1,_0x42f248);});});})[_0xd351('0x22')](function(){var _0xb5f3ee=_0x292af3[_0xd351('0x4d')][_0xd351('0x4e')]({'plain':!![]});if(!_0xb5f3ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb5f3ee['role']===_0xd351('0x4d')){var _0x624224=_0x5a2e9b;return db['UserProfileSection'][_0xd351('0x4f')]({'where':{'name':_0xd351('0x24'),'userProfileId':_0xb5f3ee[_0xd351('0x50')]},'raw':!![]})['then'](function(_0x169122){if(_0x169122&&_0x169122['autoAssociation']===0x0){return db['UserProfileResource'][_0xd351('0x48')]({'name':_0x624224[_0xd351('0x28')],'resourceId':_0x624224['id'],'type':_0x169122['name'],'sectionId':_0x169122['id']},{})[_0xd351('0x22')](function(){return _0x5a2e9b;});}else{return _0x5a2e9b;}})[_0xd351('0x41')](function(_0x2d9747){logger[_0xd351('0x26')](_0xd351('0x51'),_0x2d9747);throw _0x2d9747;});}return _0x5a2e9b;})[_0xd351('0x22')](respondWithResult(_0x334029,null))['catch'](handleError(_0x334029,null));};function Extension(_0x1e1173,_0x2a7390,_0x36fb5b,_0x8461b){this[_0xd351('0x52')]=_0xd351('0x53');this[_0xd351('0x54')]=_0x1e1173;this['app']=_0x36fb5b;this[_0xd351('0x2e')]='system';this[_0xd351('0x55')]=_0xd351('0x56');this[_0xd351('0x57')]=_0x2a7390;this[_0xd351('0x58')]=_0x8461b;}function createVoicePrefixExtensions(_0x70cdb,_0x4eaf18,_0x413931){return new BPromise(function(_0x4c8038,_0x4685fa){var _0x45bcc7=new Extension(formatPrefixName(_0x70cdb[_0xd351('0x59')]),0x1,_0xd351('0x5a'),_0xd351('0x5b'));_0x45bcc7['VoicePrefixId']=_0x70cdb['id'];return db['VoiceExtension'][_0xd351('0x48')](_0x45bcc7,{'transaction':_0x413931})[_0xd351('0x22')](function(_0x4b9367){var _0x2d2655=_0x4b9367[_0xd351('0x4e')]({'plain':!![]});var _0x2718e9=_['map'](addVoicePrefixExtensions(_0x70cdb,_0x4eaf18),function(_0x2b47ab){_0x2b47ab[_0xd351('0x4c')]=_0x2d2655['id'];_0x2b47ab[_0xd351('0x5c')]=_0x70cdb['id'];return _0x2b47ab;});return db[_0xd351('0x4b')]['bulkCreate'](_0x2718e9,{'transaction':_0x413931})['then'](function(_0x40c78b){if(!_0x40c78b){return _0x4685fa(_0xd351('0x5d'));}else{return _0x4c8038(_0x40c78b);}})[_0xd351('0x41')](function(_0xa000b4){return _0x4685fa(_0xa000b4);});});;});};function addVoicePrefixExtensions(_0x36b38f,_0x3b0993){var _0x2c83fe=[];var _0x5e2e06=formatPrefixName(_0x36b38f[_0xd351('0x59')]);_0x2c83fe['push'](new Extension(_0x5e2e06,0x2,'Set',_0xd351('0x5e')+_0x36b38f[_0xd351('0x28')]));if(_0x36b38f['callerIdAll']){_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,'Set','PREFIX-CALLERIDALL='+_0x36b38f['callerIdAll']));}else{_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,_0xd351('0x5a'),_0xd351('0x60')));}_0x2c83fe['push'](new Extension(_0x5e2e06,0x4,_0xd351('0x61'),_0x3b0993[_0xd351('0x52')]+','+_0xd351('0x62')+(0x8+_0x36b38f[_0xd351('0x28')][_0xd351('0x44')])+'}'+','+0x1));return _0x2c83fe;}function formatPrefixName(_0x475534){var _0x15fcab='_';for(var _0x6bf19c=0x0;_0x6bf19c<_0x475534[_0xd351('0x44')];_0x6bf19c++){if(_0x475534[_0xd351('0x63')](_0x6bf19c)=='-'){_0x15fcab+=_0x475534[_0xd351('0x63')](_0x6bf19c);}else{_0x15fcab+='['+_0x475534['charAt'](_0x6bf19c)+']';}}_0x15fcab+='.';return _0x15fcab;}exports[_0xd351('0x21')]=function(_0x2d59a5,_0x431e91,_0xcc7a10){var _0xf24a29=_0x2d59a5[_0xd351('0x4a')];_0xf24a29['prefix']=_0xd351('0x64')+_0xf24a29[_0xd351('0x28')]+'-';return db['sequelize']['transaction'](function(_0x436e1d){return db[_0xd351('0x3f')][_0xd351('0x21')](_0xf24a29,{'where':{'id':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x23')]({'where':{'VoicePrefixId':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x4f')]({'where':{'id':_0xf24a29['VoiceExtensionId']},'raw':!![]})[_0xd351('0x22')](function(_0x129623){return createVoicePrefixExtensions(_0xf24a29,_0x129623,_0x436e1d);});});});})['then'](function(){return db[_0xd351('0x3f')]['findById'](_0xf24a29['id']);})[_0xd351('0x22')](respondWithResult(_0x431e91,null))['catch'](handleError(_0x431e91,null));};exports[_0xd351('0x65')]=function(_0x406d8a,_0xbd31ca,_0x451445){return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x406d8a[_0xd351('0x43')]['id']}})['then'](handleEntityNotFound(_0xbd31ca,null))[_0xd351('0x22')](function(_0x2558b4){if(_0x2558b4){return _0x2558b4[_0xd351('0x65')](_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')],_['omit'](_0x406d8a[_0xd351('0x4a')],[_0xd351('0x66'),'id'])||{})[_0xd351('0x67')](function(_0x54b38c){for(var _0x38a3ec=0x0;_0x38a3ec<_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0xd351('0x44')];_0x38a3ec+=0x1){socket[_0xd351('0x68')](_0xd351('0x69'),{'UserId':Number(_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0x38a3ec]),'VoicePrefixId':Number(_0x406d8a[_0xd351('0x43')]['id'])});}return _0x54b38c;});}})['then'](respondWithResult(_0xbd31ca,null))[_0xd351('0x41')](handleError(_0xbd31ca,null));};exports[_0xd351('0x6a')]=function(_0x5036e6,_0x44df63,_0x4c1468){return db['VoicePrefix']['find']({'where':{'id':_0x5036e6[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x44df63,null))[_0xd351('0x22')](function(_0x5b2bf9){if(_0x5b2bf9){return _0x5b2bf9[_0xd351('0x6a')](_0x5036e6['query'][_0xd351('0x66')])['then'](function(){if(_[_0xd351('0x6b')](_0x5036e6[_0xd351('0x30')][_0xd351('0x66')])){for(var _0x16dd16=0x0;_0x16dd16<_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0xd351('0x44')];_0x16dd16+=0x1){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0x16dd16]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}}else{socket['emit'](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}});}})[_0xd351('0x22')](respondWithStatusCode(_0x44df63,null))['catch'](handleError(_0x44df63,null));};exports[_0xd351('0x6d')]=function(_0x1e6c85,_0x2adab4,_0x2a1ea4){var _0x4a4b25={};var _0x1fda25={};var _0x36bbee;var _0x48b5ee;return db[_0xd351('0x3f')][_0xd351('0x6e')]({'where':{'id':_0x1e6c85[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x2adab4,null))['then'](function(_0x523895){if(_0x523895){_0x36bbee=_0x523895;_0x1fda25[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x6f')][_0xd351('0x2c')]);_0x1fda25['query']=_[_0xd351('0x31')](_0x1e6c85[_0xd351('0x30')]);_0x1fda25[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1fda25[_0xd351('0x2f')],_0x1fda25['query']);_0x4a4b25[_0xd351('0x35')]=_[_0xd351('0x33')](_0x1fda25['model'],qs[_0xd351('0x34')](_0x1e6c85[_0xd351('0x30')]['fields']));_0x4a4b25[_0xd351('0x35')]=_0x4a4b25['attributes'][_0xd351('0x44')]?_0x4a4b25['attributes']:_0x1fda25[_0xd351('0x2f')];_0x4a4b25[_0xd351('0x70')]=qs[_0xd351('0x38')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x38')]);_0x4a4b25[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x1e6c85[_0xd351('0x30')],_0x1fda25['filters']));if(_0x1e6c85[_0xd351('0x30')][_0xd351('0x3b')]){_0x4a4b25[_0xd351('0x39')]=_[_0xd351('0x45')](_0x4a4b25[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x4a4b25[_0xd351('0x35')],function(_0x54041b){var _0x56458b={};_0x56458b[_0x54041b]={'$like':'%'+_0x1e6c85[_0xd351('0x30')]['filter']+'%'};return _0x56458b;})});}_0x4a4b25=_[_0xd351('0x45')]({},_0x4a4b25,_0x1e6c85[_0xd351('0x46')]);return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x2d5e2b){if(_0x2d5e2b){_0x48b5ee=_0x2d5e2b['length'];if(!_0x1e6c85[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x4a4b25[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x1b')]);_0x4a4b25[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x19')]);}return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x4ddd65){if(_0x4ddd65){return _0x4ddd65?{'count':_0x48b5ee,'rows':_0x4ddd65}:null;}})['then'](respondWithResult(_0x2adab4,null))[_0xd351('0x41')](handleError(_0x2adab4,null));};exports['getTeams']=function(_0x5c202f,_0x426964,_0x4557ed){var _0x3f6826={};var _0x1a5e8e={};var _0x54fc9c;var _0x2443bd;return db['VoicePrefix']['findOne']({'where':{'id':_0x5c202f[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x426964,null))[_0xd351('0x22')](function(_0x15690b){if(_0x15690b){_0x54fc9c=_0x15690b;_0x1a5e8e[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x71')]['rawAttributes']);_0x1a5e8e[_0xd351('0x30')]=_[_0xd351('0x31')](_0x5c202f[_0xd351('0x30')]);_0x1a5e8e[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1a5e8e[_0xd351('0x2f')],_0x1a5e8e['query']);_0x3f6826['attributes']=_[_0xd351('0x33')](_0x1a5e8e['model'],qs[_0xd351('0x34')](_0x5c202f[_0xd351('0x30')]['fields']));_0x3f6826[_0xd351('0x35')]=_0x3f6826[_0xd351('0x35')][_0xd351('0x44')]?_0x3f6826[_0xd351('0x35')]:_0x1a5e8e[_0xd351('0x2f')];_0x3f6826['order']=qs[_0xd351('0x38')](_0x5c202f['query'][_0xd351('0x38')]);_0x3f6826[_0xd351('0x39')]=qs['filters'](_[_0xd351('0x3a')](_0x5c202f[_0xd351('0x30')],_0x1a5e8e[_0xd351('0x32')]));if(_0x5c202f[_0xd351('0x30')]['filter']){_0x3f6826['where']=_['merge'](_0x3f6826[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x3f6826[_0xd351('0x35')],function(_0x40740e){var _0x3606b1={};_0x3606b1[_0x40740e]={'$like':'%'+_0x5c202f[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x3606b1;})});}_0x3f6826=_['merge']({},_0x3f6826,_0x5c202f[_0xd351('0x46')]);return _0x54fc9c['getTeams'](_0x3f6826);}})[_0xd351('0x22')](function(_0x55d564){if(_0x55d564){_0x2443bd=_0x55d564['length'];if(!_0x5c202f[_0xd351('0x30')]['hasOwnProperty'](_0xd351('0x37'))){_0x3f6826[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x5c202f[_0xd351('0x30')][_0xd351('0x1b')]);_0x3f6826[_0xd351('0x19')]=qs['offset'](_0x5c202f['query'][_0xd351('0x19')]);}return _0x54fc9c[_0xd351('0x72')](_0x3f6826);}})['then'](function(_0x3d3cfa){if(_0x3d3cfa){return _0x3d3cfa?{'count':_0x2443bd,'rows':_0x3d3cfa}:null;}})['then'](respondWithResult(_0x426964,null))[_0xd351('0x41')](handleError(_0x426964,null));};exports[_0xd351('0x73')]=function(_0x6fd03b,_0x19d16a,_0x127bf9){var _0x4ab9b9=_0x6fd03b[_0xd351('0x4a')]['ids'];var _0x581e66;return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x4ab9b9},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':'Agents','attributes':['id','name',_0xd351('0x74'),_0xd351('0x75'),_0xd351('0x76')],'raw':!![]}]})[_0xd351('0x22')](function(_0x1ddacf){if(_0x1ddacf){_0x581e66=_0x1ddacf;var _0x4cadbe=_[_0xd351('0x77')](_0x1ddacf,function(_0x269bf6){var _0x3da123=_0x269bf6[_0xd351('0x4e')]({'plain':!![]});return _0x3da123['Agents'];});return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x6fd03b['params']['id']}})[_0xd351('0x22')](function(_0x46745f){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x37d882){return _0x46745f['addTeams'](_0x4ab9b9,{'transaction':_0x37d882})[_0xd351('0x22')](function(){return BPromise[_0xd351('0x79')](_0x581e66,function(_0x5ceda1){return db[_0xd351('0x7a')]['upsert']({'TeamId':_0x5ceda1['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},{'transaction':_0x37d882});});})[_0xd351('0x22')](function(){return BPromise['each'](_0x4cadbe,function(_0x1f0812){return db[_0xd351('0x7b')][_0xd351('0x7c')]({'where':{'UserId':_0x1f0812['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},'transaction':_0x37d882});});})[_0xd351('0x22')](function(){_0x4cadbe['forEach'](function(_0x23b2fe){socket['emit'](_0xd351('0x69'),{'UserId':_0x23b2fe['id'],'VoicePrefixId':_0x46745f['id']});});});});});}})[_0xd351('0x22')](respondWithStatusCode(_0x19d16a,null))[_0xd351('0x41')](handleError(_0x19d16a,null));};exports[_0xd351('0x7d')]=function(_0x160102,_0x24ac40,_0x3b2690){return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x160102['query'][_0xd351('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':_0xd351('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xd351('0x22')](handleEntityNotFound(_0x24ac40,null))['then'](function(_0x280220){var _0x4f8f00=_[_0xd351('0x2b')](_0x280220,'id');var _0x107886=[];var _0x3a3633=[];var _0x403312=squel[_0xd351('0x7f')]();_0x403312['field'](_0xd351('0x80'))[_0xd351('0x81')]('team_has_voice_prefixes','tq')['join'](_0xd351('0x82'),'ut',_0xd351('0x83'))[_0xd351('0x39')](_0xd351('0x84'),_0x160102[_0xd351('0x43')]['id']);for(var _0x1373c0=0x0;_0x1373c0<_0x280220[_0xd351('0x44')];_0x1373c0+=0x1){let _0x78b55c=_0x280220[_0x1373c0];for(var _0x2de03c=0x0;_0x2de03c<_0x78b55c[_0xd351('0x7e')][_0xd351('0x44')];_0x2de03c+=0x1){let _0x6f4c1e=_0x78b55c[_0xd351('0x7e')][_0x2de03c];var _0x56b88b=_0x403312['clone']();_0x56b88b[_0xd351('0x39')]('ut.UserId\x20=\x20?',_0x6f4c1e['id']);_0x3a3633[_0xd351('0x5f')](db[_0xd351('0x78')][_0xd351('0x30')](_0x56b88b[_0xd351('0x85')](),{'type':db[_0xd351('0x78')][_0xd351('0x86')]['SELECT']})[_0xd351('0x22')](function(_0x2725c4){if(_0x2725c4['length']===0x1){return _0x6f4c1e['id'];}else{var _0x31c1dc=_['every'](_['map'](_0x2725c4,_0xd351('0x87')),function(_0x2f188b){return _['includes'](_0x4f8f00,_0x2f188b);});if(_0x31c1dc){return _0x6f4c1e['id'];}}}));}}return BPromise[_0xd351('0x88')](_0x3a3633)[_0xd351('0x22')](function(_0x5126a1){_0x107886=_(_0x107886)[_0xd351('0x89')](_0x5126a1)[_0xd351('0x8a')]()[_0xd351('0x8b')]();return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x160102['params']['id']}})[_0xd351('0x22')](function(_0x1db9db){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x2ef116){return _0x1db9db[_0xd351('0x7d')](_0x160102[_0xd351('0x30')][_0xd351('0x66')],{'transaction':_0x2ef116})[_0xd351('0x22')](function(){if(!_[_0xd351('0x8c')](_0x107886)){return _0x1db9db[_0xd351('0x6a')](_0x107886,{'transaction':_0x2ef116});}})[_0xd351('0x22')](function(){_0x107886[_0xd351('0x8d')](function(_0x585e94){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':_0x585e94,'VoicePrefixId':_0x1db9db['id']});});});});});});})[_0xd351('0x22')](respondWithStatusCode(_0x24ac40,null))[_0xd351('0x41')](handleError(_0x24ac40,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9ca4f75..e37bbc1 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 _0xcdf2=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3dbe13,_0x240d94){var _0x5d7887=function(_0x4e73f0){while(--_0x4e73f0){_0x3dbe13['push'](_0x3dbe13['shift']());}};_0x5d7887(++_0x240d94);}(_0xcdf2,0xed));var _0x2cdf=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xcdf2[_0x3ab928];return _0xf47692;};'use strict';var EventEmitter=require(_0x2cdf('0x0'));var VoicePrefix=require(_0x2cdf('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2cdf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2cdf('0x3'),'afterDestroy':_0x2cdf('0x4')};function emitEvent(_0x114f43){return function(_0x54d53f,_0x37a1ae,_0x548e11){VoicePrefixEvents[_0x2cdf('0x5')](_0x114f43+':'+_0x54d53f['id'],_0x54d53f);VoicePrefixEvents[_0x2cdf('0x5')](_0x114f43,_0x54d53f);_0x548e11(null);};}for(var e in events){if(events[_0x2cdf('0x6')](e)){var event=events[e];VoicePrefix[_0x2cdf('0x7')](e,emitEvent(event));}}module[_0x2cdf('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x7491=['VoicePrefix','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x33d39d,_0x1bc352){var _0x12b74c=function(_0x58df7a){while(--_0x58df7a){_0x33d39d['push'](_0x33d39d['shift']());}};_0x12b74c(++_0x1bc352);}(_0x7491,0x126));var _0x1749=function(_0x15d01c,_0x25eac2){_0x15d01c=_0x15d01c-0x0;var _0x574386=_0x7491[_0x15d01c];return _0x574386;};'use strict';var EventEmitter=require(_0x1749('0x0'));var VoicePrefix=require(_0x1749('0x1'))['db'][_0x1749('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1749('0x3'),'afterDestroy':_0x1749('0x4')};function emitEvent(_0x5e786f){return function(_0x19fffb,_0xa2837b,_0x3d177e){VoicePrefixEvents['emit'](_0x5e786f+':'+_0x19fffb['id'],_0x19fffb);VoicePrefixEvents[_0x1749('0x5')](_0x5e786f,_0x19fffb);_0x3d177e(null);};}for(var e in events){if(events[_0x1749('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x1749('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 73826bc..7bc0a1f 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 _0x5b35=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x1e6660,_0x368ae0){var _0x2b8dfd=function(_0x1f32ec){while(--_0x1f32ec){_0x1e6660['push'](_0x1e6660['shift']());}};_0x2b8dfd(++_0x368ae0);}(_0x5b35,0x1c7));var _0x55b3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b35[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x55b3('0x0'));var logger=require(_0x55b3('0x1'))(_0x55b3('0x2'));var moment=require(_0x55b3('0x3'));var BPromise=require(_0x55b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55b3('0x5'));var rimraf=require(_0x55b3('0x6'));var config=require(_0x55b3('0x7'));var attributes=require(_0x55b3('0x8'));module[_0x55b3('0x9')]=function(_0x1504be,_0x306720){return _0x1504be[_0x55b3('0xa')](_0x55b3('0xb'),attributes,{'tableName':_0x55b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6eb=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x268e0c,_0x1ef7d1){var _0x97a5fb=function(_0x58ccb2){while(--_0x58ccb2){_0x268e0c['push'](_0x268e0c['shift']());}};_0x97a5fb(++_0x1ef7d1);}(_0xb6eb,0x141));var _0xbb6e=function(_0x37db08,_0x228368){_0x37db08=_0x37db08-0x0;var _0x18c160=_0xb6eb[_0x37db08];return _0x18c160;};'use strict';var _=require(_0xbb6e('0x0'));var util=require(_0xbb6e('0x1'));var logger=require(_0xbb6e('0x2'))(_0xbb6e('0x3'));var moment=require(_0xbb6e('0x4'));var BPromise=require(_0xbb6e('0x5'));var rp=require(_0xbb6e('0x6'));var fs=require('fs');var path=require(_0xbb6e('0x7'));var rimraf=require(_0xbb6e('0x8'));var config=require(_0xbb6e('0x9'));var attributes=require(_0xbb6e('0xa'));module[_0xbb6e('0xb')]=function(_0xf52018,_0x1cf595){return _0xf52018[_0xbb6e('0xc')](_0xbb6e('0xd'),attributes,{'tableName':_0xbb6e('0xe'),'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 4358697..41fff97 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 _0x781d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});config['redis']=_[_0xd781('0xc')](config[_0xd781('0xd')],{'host':_0xd781('0xe'),'port':0x18eb});var socket=require(_0xd781('0xf'))(new Redis(config['redis']));require(_0xd781('0x10'))['register'](socket);function respondWithRpcPromise(_0x43d863,_0x16360f,_0x509ca7){return new BPromise(function(_0x346756,_0x29c2a7){return client['request'](_0x43d863,_0x509ca7)['then'](function(_0x40a900){logger[_0xd781('0x11')](_0xd781('0x12'),_0x16360f,_0xd781('0x13'));logger[_0xd781('0x14')](_0xd781('0x15'),_0x16360f,_0xd781('0x13'),JSON[_0xd781('0x16')](_0x40a900));if(_0x40a900[_0xd781('0x17')]){if(_0x40a900[_0xd781('0x17')][_0xd781('0x18')]===0x1f4){logger['error'](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')]['message']);return _0x29c2a7(_0x40a900[_0xd781('0x17')]['message']);}logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);return _0x346756(_0x40a900[_0xd781('0x17')][_0xd781('0x19')]);}else{logger[_0xd781('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x16360f,_0xd781('0x13'));_0x346756(_0x40a900[_0xd781('0x1a')][_0xd781('0x19')]);}})[_0xd781('0x1b')](function(_0x3bf805){logger[_0xd781('0x17')](_0xd781('0x12'),_0x16360f,_0x3bf805);_0x29c2a7(_0x3bf805);});});} \ No newline at end of file +var _0x06ae=['VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','VoicePrefix,\x20%s,\x20%s','debug'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});config[_0xe06a('0xa')]=_[_0xe06a('0xb')](config[_0xe06a('0xa')],{'host':_0xe06a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06a('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x1a9f4e,_0x4eedc5,_0x2212e2){return new BPromise(function(_0x48e52a,_0x521741){return client[_0xe06a('0xd')](_0x1a9f4e,_0x2212e2)[_0xe06a('0xe')](function(_0x574fd0){logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x4eedc5,'request\x20sent');logger[_0xe06a('0x11')](_0xe06a('0x12'),_0x4eedc5,_0xe06a('0x13'),JSON['stringify'](_0x574fd0));if(_0x574fd0[_0xe06a('0x14')]){if(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x15')]===0x1f4){logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0['error'][_0xe06a('0x16')]);return _0x521741(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x16')]);}logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0[_0xe06a('0x14')]['message']);return _0x48e52a(_0x574fd0[_0xe06a('0x14')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x4eedc5,_0xe06a('0x13'));_0x48e52a(_0x574fd0[_0xe06a('0x17')][_0xe06a('0x16')]);}})['catch'](function(_0x614743){logger[_0xe06a('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4eedc5,_0x614743);_0x521741(_0x614743);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7dae2b7..a4954df 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 _0x0565=['update','emit','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x3ccd6e,_0x5baac5){var _0x5cde6b=function(_0x207573){while(--_0x207573){_0x3ccd6e['push'](_0x3ccd6e['shift']());}};_0x5cde6b(++_0x5baac5);}(_0x0565,0xf2));var _0x5056=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0565[_0x59ee6f];return _0x4c0979;};'use strict';var VoicePrefixEvents=require(_0x5056('0x0'));var events=[_0x5056('0x1'),_0x5056('0x2'),_0x5056('0x3')];function createListener(_0x354d5d,_0x397289){return function(_0xd4624d){_0x397289[_0x5056('0x4')](_0x354d5d,_0xd4624d);};}function removeListener(_0x3657a8,_0x2b0883){return function(){VoicePrefixEvents['removeListener'](_0x3657a8,_0x2b0883);};}exports[_0x5056('0x5')]=function(_0x105ea8){for(var _0x1143df=0x0,_0x22afb7=events['length'];_0x1143df<_0x22afb7;_0x1143df++){var _0x52b01f=events[_0x1143df];var _0x38f74=createListener(_0x5056('0x6')+_0x52b01f,_0x105ea8);VoicePrefixEvents['on'](_0x52b01f,_0x38f74);}}; \ No newline at end of file +var _0x325b=['voicePrefix:','./voicePrefix.events','save','remove','removeListener','length'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x325b,0x8b));var _0xb325=function(_0x362e3f,_0x4e14a7){_0x362e3f=_0x362e3f-0x0;var _0x1f189f=_0x325b[_0x362e3f];return _0x1f189f;};'use strict';var VoicePrefixEvents=require(_0xb325('0x0'));var events=[_0xb325('0x1'),_0xb325('0x2'),'update'];function createListener(_0x753472,_0xe5e855){return function(_0x55e779){_0xe5e855['emit'](_0x753472,_0x55e779);};}function removeListener(_0x3a6c20,_0xca6c44){return function(){VoicePrefixEvents[_0xb325('0x3')](_0x3a6c20,_0xca6c44);};}exports['register']=function(_0x4a1ea8){for(var _0x33dcfc=0x0,_0x5a241f=events[_0xb325('0x4')];_0x33dcfc<_0x5a241f;_0x33dcfc++){var _0x2fa16d=events[_0x33dcfc];var _0xda4fa3=createListener(_0xb325('0x5')+_0x2fa16d,_0x4a1ea8);VoicePrefixEvents['on'](_0x2fa16d,_0xda4fa3);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a13e0dd..cc02c37 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(_0x53309a,_0x4fc4f2){var _0x44b63f=function(_0x498832){while(--_0x498832){_0x53309a['push'](_0x53309a['shift']());}};_0x44b63f(++_0x4fc4f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x83609a,_0x4623de){var _0x3de3aa=function(_0x46d4e6){while(--_0x46d4e6){_0x83609a['push'](_0x83609a['shift']());}};_0x3de3aa(++_0x4623de);}(_0xb10b,0x12a));var _0xbb10=function(_0xf1dbd8,_0x1cb2e1){_0xf1dbd8=_0xf1dbd8-0x0;var _0x5ee4be=_0xb10b[_0xf1dbd8];return _0x5ee4be;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 239aa37..6dbb9da 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 _0xabf0=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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)','mandatoryDispositionPauseId','exports','STRING','name','ENUM','outbound','inbound','default','ringall','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','predictive','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\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,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0xfb02c9,_0x43c274){var _0x9afb71=function(_0x56dff0){while(--_0x56dff0){_0xfb02c9['push'](_0xfb02c9['shift']());}};_0x9afb71(++_0x43c274);}(_0xabf0,0xac));var _0x0abf=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xabf0[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x0abf('0x0')]={'name':{'type':Sequelize[_0x0abf('0x1')],'allowNull':![],'unique':_0x0abf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0abf('0x3')]('inbound',_0x0abf('0x4')),'allowNull':![],'defaultValue':_0x0abf('0x5')},'musiconhold':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':_0x0abf('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0abf('0x3')]('rr',_0x0abf('0x7'),'leastrecent','fewestcalls','random',_0x0abf('0x8'),'linear',_0x0abf('0x9'),_0x0abf('0xa')),'allowNull':![],'defaultValue':_0x0abf('0x7'),'set':function(_0x2f1304){this[_0x0abf('0xb')](_0x0abf('0xc'),_0x2f1304?_0x2f1304:_0x0abf('0x8'));},'get':function(){var _0x112e33=this[_0x0abf('0xd')](_0x0abf('0xe'));var _0x434e31=this[_0x0abf('0xd')](_0x0abf('0xf'));var _0x376af0=this['getDataValue'](_0x0abf('0xc'));if(_0x112e33==='inbound'){return _0x376af0;}if(_0x434e31===_0x0abf('0x10')&&_0x376af0===_0x0abf('0x8')||_0x434e31===_0x0abf('0x10')&&_0x376af0==='roundrobin'){return _0x376af0;}if(_0x434e31==='progressive'||_0x434e31===_0x0abf('0x11')||_0x434e31==='power'){return _0x376af0;}return null;}},'servicelevel':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0abf('0x1')]},'weight':{'type':Sequelize[_0x0abf('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':_0x0abf('0x13')},'autopause':{'type':Sequelize['ENUM'](_0x0abf('0x13'),'no',_0x0abf('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0abf('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x0abf('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0abf('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0abf('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':_0x0abf('0x13')},'announce_holdtime':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no',_0x0abf('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x0abf('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0abf('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0abf('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4a91cb){this['setDataValue'](_0x0abf('0x16'),_0x4a91cb?_0x4a91cb[_0x0abf('0x17')](','):[]);},'get':function(){return this[_0x0abf('0xd')](_0x0abf('0x16'))?this[_0x0abf('0xd')](_0x0abf('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':'yes','set':function(_0x3cf038){this[_0x0abf('0xb')](_0x0abf('0x18'),_0x3cf038?_0x3cf038[_0x0abf('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x0abf('0x18'))?this['getDataValue']('joinempty')[_0x0abf('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':'no','set':function(_0x16f151){this[_0x0abf('0xb')](_0x0abf('0x1a'),_0x16f151?_0x16f151[_0x0abf('0x17')](','):undefined);},'get':function(){return this[_0x0abf('0xd')](_0x0abf('0x1a'))?this[_0x0abf('0xd')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0abf('0x1')]},'description':{'type':Sequelize[_0x0abf('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x57d72a){this[_0x0abf('0xb')]('acw',_0x57d72a);if(_0x57d72a){if(this[_0x0abf('0xd')](_0x0abf('0x1b'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0abf('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':0x0,'comment':_0x0abf('0x1d')},'dialMethod':{'type':Sequelize[_0x0abf('0x3')](_0x0abf('0x1e'),_0x0abf('0x1f'),_0x0abf('0x20'),_0x0abf('0x11'),_0x0abf('0x10')),'defaultValue':_0x0abf('0x1f'),'comment':_0x0abf('0x21')},'dialLimitChannel':{'type':Sequelize[_0x0abf('0x12')](0x4)[_0x0abf('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x0abf('0x12')](0x4)[_0x0abf('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0abf('0x23')},'dialPowerLevel':{'type':Sequelize[_0x0abf('0x24')](0x2)[_0x0abf('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0abf('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0abf('0x26'),'dropRate'),'defaultValue':_0x0abf('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0abf('0x24')](0x2)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0abf('0x28')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0abf('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0abf('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0abf('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0abf('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x2c')},'dialQueueProject':{'type':Sequelize[_0x0abf('0x1')],'comment':_0x0abf('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0abf('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0abf('0x32')},'dialTimezone':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':_0x0abf('0x33')},'dialPrefix':{'type':Sequelize[_0x0abf('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0abf('0x3')]('always','never',_0x0abf('0x34')),'defaultValue':_0x0abf('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0abf('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x0abf('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0abf('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0abf('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0abf('0x12')](0x9)[_0x0abf('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0abf('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0abf('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0abf('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x0abf('0x12')](0x9)[_0x0abf('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0abf('0x12')](0x9)[_0x0abf('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0abf('0x12')](0x9)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0abf('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0abf('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0abf('0x12')](0x9)[_0x0abf('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0abf('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x0abf('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0abf('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':0x0,'comment':_0x0abf('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0abf('0x3f'),'ASC'),'defaultValue':_0x0abf('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x0abf('0x1')],'comment':_0x0abf('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0abf('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0abf('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0abf('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0abf('0x12')](0x5)[_0x0abf('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0abf('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0abf('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1db6dc){if(!_0x1db6dc)this[_0x0abf('0xb')](_0x0abf('0x4b'),null);this['setDataValue']('mandatoryDisposition',_0x1db6dc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0abf('0x12')](0x3)[_0x0abf('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0abf('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0x81c4=['join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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','mandatoryDisposition','sequelize','exports','name','outbound','STRING','default','ENUM','leastrecent','fewestcalls','random','linear','rrordered','ringall','strategy','rrmemory','getDataValue','type','inbound','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x81c4,0xe5));var _0x481c=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x81c4[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x481c('0x0'));module[_0x481c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x481c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x481c('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x481c('0x4')],'defaultValue':_0x481c('0x5')},'announce':{'type':Sequelize[_0x481c('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x481c('0x6')]('rr','ringall',_0x481c('0x7'),_0x481c('0x8'),_0x481c('0x9'),'rrmemory',_0x481c('0xa'),'wrandom',_0x481c('0xb')),'allowNull':![],'defaultValue':_0x481c('0xc'),'set':function(_0x5dbcde){this['setDataValue'](_0x481c('0xd'),_0x5dbcde?_0x5dbcde:_0x481c('0xe'));},'get':function(){var _0xc96eb6=this[_0x481c('0xf')](_0x481c('0x10'));var _0x12e09d=this[_0x481c('0xf')]('dialMethod');var _0x26e376=this[_0x481c('0xf')](_0x481c('0xd'));if(_0xc96eb6===_0x481c('0x11')){return _0x26e376;}if(_0x12e09d===_0x481c('0x12')&&_0x26e376===_0x481c('0xe')||_0x12e09d===_0x481c('0x12')&&_0x26e376===_0x481c('0x13')){return _0x26e376;}if(_0x12e09d==='progressive'||_0x12e09d===_0x481c('0x14')||_0x12e09d===_0x481c('0x15')){return _0x26e376;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x481c('0x4')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':_0x481c('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x481c('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x481c('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x481c('0x6')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x481c('0x6')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x481c('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x481c('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x481c('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x481c('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':_0x481c('0x17')},'announce_holdtime':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no',_0x481c('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x481c('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x481c('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x481c('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x481c('0x4')]},'queue_youarenext':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x481c('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x481c('0x4')]},'queue_quantity1':{'type':Sequelize[_0x481c('0x4')]},'queue_quantity2':{'type':Sequelize[_0x481c('0x4')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x481c('0x4')]},'periodic_announce':{'type':Sequelize[_0x481c('0x1a')],'set':function(_0x5994d0){this[_0x481c('0x1b')](_0x481c('0x1c'),_0x5994d0?_0x5994d0[_0x481c('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0x481c('0x1c'))?this[_0x481c('0xf')](_0x481c('0x1c'))[_0x481c('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4f435f){this[_0x481c('0x1b')](_0x481c('0x1f'),_0x4f435f?_0x4f435f[_0x481c('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x481c('0x1f'))?this[_0x481c('0xf')](_0x481c('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x323145){this[_0x481c('0x1b')](_0x481c('0x20'),_0x323145?_0x323145[_0x481c('0x1d')](','):undefined);},'get':function(){return this[_0x481c('0xf')]('leavewhenempty')?this[_0x481c('0xf')](_0x481c('0x20'))[_0x481c('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x481c('0x4')]},'description':{'type':Sequelize[_0x481c('0x4')]},'acw':{'type':Sequelize[_0x481c('0x21')],'defaultValue':0x0,'set':function(_0x20ef82){this['setDataValue'](_0x481c('0x22'),_0x20ef82);if(_0x20ef82){if(this[_0x481c('0xf')](_0x481c('0x23'))<0x2){this['setDataValue'](_0x481c('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x481c('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x481c('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x24'),'progressive',_0x481c('0x15'),_0x481c('0x14'),_0x481c('0x12')),'defaultValue':_0x481c('0x25'),'comment':_0x481c('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x481c('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x481c('0x28')},'dialLimitQueue':{'type':Sequelize[_0x481c('0x16')](0x4)[_0x481c('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x481c('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x481c('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x2b'),_0x481c('0x2c')),'defaultValue':_0x481c('0x2c'),'comment':_0x481c('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x481c('0x29')](0x2)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x481c('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x481c('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x481c('0x30'),'comment':_0x481c('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x32')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x481c('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x481c('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x481c('0x3a')},'dialTimezone':{'type':Sequelize[_0x481c('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x481c('0x4')],'defaultValue':_0x481c('0x3b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x3c'),_0x481c('0x3d'),_0x481c('0x3e')),'defaultValue':_0x481c('0x3c')},'dialAMDActive':{'type':Sequelize[_0x481c('0x21')],'defaultValue':0x0,'comment':_0x481c('0x3f')},'dialAMDInitialSilence':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x481c('0x40')},'dialAMDGreeting':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x481c('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x481c('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x481c('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x481c('0x44')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x481c('0x45')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x481c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x481c('0x46')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x481c('0x16')](0x9)[_0x481c('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x481c('0x47')},'dialRecallMeTimeout':{'type':Sequelize[_0x481c('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x481c('0x6')](_0x481c('0x48'),_0x481c('0x49')),'defaultValue':_0x481c('0x48')},'dialQueueProject2':{'type':Sequelize[_0x481c('0x4')],'comment':_0x481c('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x481c('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x481c('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x481c('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x481c('0x4a')},'dialCutDigit':{'type':Sequelize[_0x481c('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x4c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x4e')},'dialMachineMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x50')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x481c('0x51')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x481c('0x16')](0x5)[_0x481c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x481c('0x52')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x481c('0x16')],'allowNull':!![],'comment':_0x481c('0x53')},'mandatoryDisposition':{'type':Sequelize[_0x481c('0x21')],'defaultValue':![],'comment':_0x481c('0x54'),'set':function(_0x134c9c){if(!_0x134c9c)this[_0x481c('0x1b')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x481c('0x55'),_0x134c9c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x481c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x481c('0x16')](0x3)[_0x481c('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x481c('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x481c('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 b183f37..0b5a38b 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 _0x0cfd=['stack','index','VoiceQueue','rawAttributes','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','user','get','role','outbound','UserProfileSection','userProfileId','autoAssociation','create','clone','params','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','hasOwnProperty','VoiceQueueId','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','userVoiceQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','all','compact','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','cm_hopper','phone','scheduledAt','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','fromQuery','ContactId','ListId\x20=\x20?','into','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error'];(function(_0x1fe865,_0x23bfb7){var _0x2c88b4=function(_0x5cfa98){while(--_0x5cfa98){_0x1fe865['push'](_0x1fe865['shift']());}};_0x2c88b4(++_0x23bfb7);}(_0x0cfd,0x7c));var _0xd0cf=function(_0x13f3ed,_0x1313f7){_0x13f3ed=_0x13f3ed-0x0;var _0x567b57=_0x0cfd[_0x13f3ed];return _0x567b57;};'use strict';var emlformat=require(_0xd0cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0cf('0x1'));var rp=require(_0xd0cf('0x2'));var moment=require(_0xd0cf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd0cf('0x4'));var util=require(_0xd0cf('0x5'));var path=require(_0xd0cf('0x6'));var sox=require('sox');var csv=require(_0xd0cf('0x7'));var ejs=require(_0xd0cf('0x8'));var fs=require('fs');var fs_extra=require(_0xd0cf('0x9'));var _=require(_0xd0cf('0xa'));var squel=require(_0xd0cf('0xb'));var crypto=require(_0xd0cf('0xc'));var jsforce=require(_0xd0cf('0xd'));var deskjs=require(_0xd0cf('0xe'));var toCsv=require(_0xd0cf('0x7'));var querystring=require(_0xd0cf('0xf'));var Papa=require(_0xd0cf('0x10'));var Redis=require(_0xd0cf('0x11'));var authService=require(_0xd0cf('0x12'));var qs=require(_0xd0cf('0x13'));var as=require(_0xd0cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0cf('0x15'));var utils=require(_0xd0cf('0x16'));var config=require(_0xd0cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd0cf('0x18'),'port':0x18eb});var socket=require(_0xd0cf('0x19'))(new Redis(config['redis']));require(_0xd0cf('0x1a'))[_0xd0cf('0x1b')](socket);function respondWithStatusCode(_0x2fa4ac,_0x43efed){_0x43efed=_0x43efed||0xcc;return function(_0x52e0c7){if(_0x52e0c7){return _0x2fa4ac['sendStatus'](_0x43efed);}return _0x2fa4ac[_0xd0cf('0x1c')](_0x43efed)[_0xd0cf('0x1d')]();};}function respondWithResult(_0x5cc945,_0x5c2c8d){_0x5c2c8d=_0x5c2c8d||0xc8;return function(_0x100362){if(_0x100362){return _0x5cc945[_0xd0cf('0x1c')](_0x5c2c8d)[_0xd0cf('0x1e')](_0x100362);}};}function respondWithFilteredResult(_0x4cfba8,_0x140d9e){return function(_0xfd39c8){if(_0xfd39c8){var _0x379c8f=typeof _0x140d9e[_0xd0cf('0x1f')]==='undefined'&&typeof _0x140d9e[_0xd0cf('0x20')]===_0xd0cf('0x21');var _0x4b0523=_0xfd39c8[_0xd0cf('0x22')];var _0x1fa5a9=_0x379c8f?0x0:_0x140d9e[_0xd0cf('0x1f')];var _0x39cc74=_0x379c8f?_0xfd39c8[_0xd0cf('0x22')]:_0x140d9e[_0xd0cf('0x1f')]+_0x140d9e['limit'];var _0x15b77f;if(_0x39cc74>=_0x4b0523){_0x39cc74=_0x4b0523;_0x15b77f=0xc8;}else{_0x15b77f=0xce;}_0x4cfba8[_0xd0cf('0x1c')](_0x15b77f);return _0x4cfba8['set'](_0xd0cf('0x23'),_0x1fa5a9+'-'+_0x39cc74+'/'+_0x4b0523)['json'](_0xfd39c8);}return null;};}function patchUpdates(_0x221980){return function(_0x118a6a){try{jsonpatch[_0xd0cf('0x24')](_0x118a6a,_0x221980,!![]);}catch(_0x41dacd){return BPromise[_0xd0cf('0x25')](_0x41dacd);}return _0x118a6a['save']();};}function saveUpdates(_0x50dc9d,_0x4e2ef0){return function(_0x1c1236){if(_0x1c1236){return _0x1c1236[_0xd0cf('0x26')](_0x50dc9d)[_0xd0cf('0x27')](function(_0x42b560){return _0x42b560;});}return null;};}function removeEntity(_0x5b31fb,_0xb4b90b){return function(_0x3e240d){if(_0x3e240d){return _0x3e240d[_0xd0cf('0x28')]()[_0xd0cf('0x27')](function(){var _0x246b82=_0x3e240d['get']({'plain':!![]});var _0x21e749=[{'name':_0xd0cf('0x29'),'value':_0xd0cf('0x2a'),'ignore':![]},{'name':_0xd0cf('0x2b'),'value':'outbound','ignore':![]}];var _0x26189b=_(_0x21e749)[_0xd0cf('0x2c')](_0xd0cf('0x2d'))[_0xd0cf('0x2e')](_0xd0cf('0x2f'))[_0xd0cf('0x2f')]();if(_[_0xd0cf('0x30')](_0x26189b,_0x246b82[_0xd0cf('0x31')])){return;}var _0x945835=_[_0xd0cf('0x32')](_0x21e749,[_0xd0cf('0x2f'),_0x246b82['type']])[_0xd0cf('0x33')];return db[_0xd0cf('0x34')][_0xd0cf('0x28')]({'where':{'type':_0x945835,'resourceId':_0x246b82['id']}})['then'](function(){return _0x3e240d;});})[_0xd0cf('0x27')](function(){_0x5b31fb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d560,_0xacb5d5){return function(_0x15acac){if(!_0x15acac){_0x22d560[_0xd0cf('0x35')](0x194);}return _0x15acac;};}function handleError(_0x328ca5,_0x497977){_0x497977=_0x497977||0x1f4;return function(_0x3b4dcd){logger[_0xd0cf('0x36')](_0x3b4dcd[_0xd0cf('0x37')]);if(_0x3b4dcd['name']){delete _0x3b4dcd[_0xd0cf('0x33')];}_0x328ca5[_0xd0cf('0x1c')](_0x497977)['send'](_0x3b4dcd);};}exports[_0xd0cf('0x38')]=function(_0x2727e2,_0xb4b405){var _0x2333f3={},_0x18e490={},_0x201188={'count':0x0,'rows':[]};var _0x5343a0=_[_0xd0cf('0x2e')](db[_0xd0cf('0x39')][_0xd0cf('0x3a')],function(_0x48b888){return{'name':_0x48b888['fieldName'],'type':_0x48b888[_0xd0cf('0x31')]['key']};});_0x18e490['model']=_[_0xd0cf('0x2e')](_0x5343a0,_0xd0cf('0x33'));_0x18e490[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x2727e2[_0xd0cf('0x3b')]);_0x18e490[_0xd0cf('0x3d')]=_[_0xd0cf('0x3e')](_0x18e490[_0xd0cf('0x3f')],_0x18e490[_0xd0cf('0x3b')]);_0x2333f3[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x18e490[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x2727e2[_0xd0cf('0x3b')]['fields']));_0x2333f3[_0xd0cf('0x40')]=_0x2333f3[_0xd0cf('0x40')]['length']?_0x2333f3['attributes']:_0x18e490[_0xd0cf('0x3f')];if(!_0x2727e2[_0xd0cf('0x3b')]['hasOwnProperty'](_0xd0cf('0x42'))){_0x2333f3['limit']=qs[_0xd0cf('0x20')](_0x2727e2[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x2333f3['offset']=qs[_0xd0cf('0x1f')](_0x2727e2[_0xd0cf('0x3b')]['offset']);}_0x2333f3[_0xd0cf('0x43')]=qs[_0xd0cf('0x44')](_0x2727e2[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x2333f3['where']=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x2727e2[_0xd0cf('0x3b')],_0x18e490[_0xd0cf('0x3d')]),_0x5343a0);if(_0x2727e2[_0xd0cf('0x3b')]['filter']){_0x2333f3[_0xd0cf('0x46')]=_['merge'](_0x2333f3[_0xd0cf('0x46')],{'$or':_['map'](_0x5343a0,function(_0x4d2ab1){if(_0x4d2ab1['type']!==_0xd0cf('0x47')){var _0x18e165={};_0x18e165[_0x4d2ab1[_0xd0cf('0x33')]]={'$like':'%'+_0x2727e2[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0x18e165;}})});}_0x2333f3=_[_0xd0cf('0x48')]({},_0x2333f3,_0x2727e2[_0xd0cf('0x49')]);var _0x587da3={'where':_0x2333f3[_0xd0cf('0x46')]};return db[_0xd0cf('0x39')][_0xd0cf('0x22')](_0x587da3)['then'](function(_0x3a3a1a){_0x201188[_0xd0cf('0x22')]=_0x3a3a1a;if(_0x2727e2[_0xd0cf('0x3b')][_0xd0cf('0x4a')]){_0x2333f3[_0xd0cf('0x4b')]=[{'all':!![]}];}return db[_0xd0cf('0x39')][_0xd0cf('0x4c')](_0x2333f3);})[_0xd0cf('0x27')](function(_0x8d52d){_0x201188[_0xd0cf('0x4d')]=_0x8d52d;return _0x201188;})['then'](respondWithFilteredResult(_0xb4b405,_0x2333f3))[_0xd0cf('0x4e')](handleError(_0xb4b405,null));};exports[_0xd0cf('0x4f')]=function(_0xee1495,_0x1a857c){var _0x5cb4b8={'raw':![],'where':{'id':_0xee1495['params']['id']}},_0x21faca={};_0x21faca['model']=_[_0xd0cf('0x3c')](db[_0xd0cf('0x39')][_0xd0cf('0x3a')]);_0x21faca[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0xee1495[_0xd0cf('0x3b')]);_0x21faca[_0xd0cf('0x3d')]=_['intersection'](_0x21faca['model'],_0x21faca[_0xd0cf('0x3b')]);_0x5cb4b8[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x21faca[_0xd0cf('0x3f')],qs['fields'](_0xee1495[_0xd0cf('0x3b')]['fields']));_0x5cb4b8['attributes']=_0x5cb4b8[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x5cb4b8[_0xd0cf('0x40')]:_0x21faca[_0xd0cf('0x3f')];if(_0xee1495[_0xd0cf('0x3b')][_0xd0cf('0x4a')]){_0x5cb4b8[_0xd0cf('0x4b')]=[{'all':!![]}];}_0x5cb4b8=_['merge']({},_0x5cb4b8,_0xee1495[_0xd0cf('0x49')]);return db[_0xd0cf('0x39')][_0xd0cf('0x32')](_0x5cb4b8)['then'](handleEntityNotFound(_0x1a857c,null))[_0xd0cf('0x27')](respondWithResult(_0x1a857c,null))[_0xd0cf('0x4e')](handleError(_0x1a857c,null));};exports['create']=function(_0x154e12,_0x4809ed){return db[_0xd0cf('0x39')]['create'](_0x154e12['body'],{})[_0xd0cf('0x27')](function(_0x2c727f){var _0x1f274c=_0x154e12[_0xd0cf('0x51')][_0xd0cf('0x52')]({'plain':!![]});if(!_0x1f274c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f274c[_0xd0cf('0x53')]===_0xd0cf('0x51')){var _0x2b5aac=_0x2c727f[_0xd0cf('0x52')]({'plain':!![]});var _0x4218e3=[{'name':_0xd0cf('0x29'),'value':_0xd0cf('0x2a')},{'name':_0xd0cf('0x2b'),'value':_0xd0cf('0x54')}];var _0x58fb16=_[_0xd0cf('0x32')](_0x4218e3,[_0xd0cf('0x2f'),_0x2b5aac[_0xd0cf('0x31')]])[_0xd0cf('0x33')];return db[_0xd0cf('0x55')][_0xd0cf('0x32')]({'where':{'name':_0x58fb16,'userProfileId':_0x1f274c[_0xd0cf('0x56')]},'raw':!![]})[_0xd0cf('0x27')](function(_0x2bada2){if(_0x2bada2&&_0x2bada2[_0xd0cf('0x57')]===0x0){return db['UserProfileResource'][_0xd0cf('0x58')]({'name':_0x2b5aac[_0xd0cf('0x33')],'resourceId':_0x2b5aac['id'],'type':_0x2bada2[_0xd0cf('0x33')],'sectionId':_0x2bada2['id']},{})['then'](function(){return _0x2c727f;});}else{return _0x2c727f;}})[_0xd0cf('0x4e')](function(_0x1119e1){logger[_0xd0cf('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1119e1);throw _0x1119e1;});}return _0x2c727f;})[_0xd0cf('0x27')](respondWithResult(_0x4809ed,0xc9))[_0xd0cf('0x4e')](handleError(_0x4809ed,null));};exports[_0xd0cf('0x59')]=function(_0x1e22e4,_0x2680f8){var _0xbd8edf={'where':{'id':_0x1e22e4[_0xd0cf('0x5a')]['id']}},_0x470300={};_0x470300[_0xd0cf('0x3f')]=_['keys'](db[_0xd0cf('0x39')][_0xd0cf('0x3a')]);_0xbd8edf[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x470300[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x1e22e4['query'][_0xd0cf('0x41')]));_0xbd8edf[_0xd0cf('0x40')]=_0xbd8edf[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0xbd8edf[_0xd0cf('0x40')]:_0x470300[_0xd0cf('0x3f')];if(_0x1e22e4[_0xd0cf('0x3b')][_0xd0cf('0x4a')]){_0xbd8edf[_0xd0cf('0x4b')]=[{'all':!![]}];}_0xbd8edf=_[_0xd0cf('0x48')]({},_0xbd8edf,_0x1e22e4[_0xd0cf('0x49')]);return db['VoiceQueue'][_0xd0cf('0x32')](_0xbd8edf)['then'](handleEntityNotFound(_0x2680f8,null))['then'](function(_0x488152){if(_0x488152){var _0x2851fd=_0x488152[_0xd0cf('0x52')]({'plain':!![]});_0x2851fd=qs[_0xd0cf('0x5b')](_0x2851fd,['id',_0xd0cf('0x5c'),_0xd0cf('0x5d')]);_0x1e22e4[_0xd0cf('0x5e')]=_['omit'](_0x1e22e4[_0xd0cf('0x5e')],['id',_0xd0cf('0x5c'),_0xd0cf('0x5d')]);return db[_0xd0cf('0x39')][_0xd0cf('0x58')](_[_0xd0cf('0x48')](_0x2851fd,_0x1e22e4[_0xd0cf('0x5e')]),{'include':_0x1e22e4[_0xd0cf('0x3b')][_0xd0cf('0x4a')]?[{'all':!![]}]:undefined})[_0xd0cf('0x27')](function(_0x3a7dd1){var _0x2fe6d4=_0x1e22e4[_0xd0cf('0x51')][_0xd0cf('0x52')]({'plain':!![]});if(!_0x2fe6d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe6d4[_0xd0cf('0x53')]==='user'){var _0x39ea4c=_0x3a7dd1[_0xd0cf('0x52')]({'plain':!![]});var _0x5b1b65=[{'name':'VoiceQueues','value':_0xd0cf('0x2a')},{'name':_0xd0cf('0x2b'),'value':_0xd0cf('0x54')}];var _0x439cb4=_[_0xd0cf('0x32')](_0x5b1b65,[_0xd0cf('0x2f'),_0x39ea4c[_0xd0cf('0x31')]])[_0xd0cf('0x33')];return db[_0xd0cf('0x55')][_0xd0cf('0x32')]({'where':{'name':_0x439cb4,'userProfileId':_0x2fe6d4[_0xd0cf('0x56')]},'raw':!![]})[_0xd0cf('0x27')](function(_0x6ff43c){if(_0x6ff43c&&_0x6ff43c[_0xd0cf('0x57')]===0x0){return db[_0xd0cf('0x34')][_0xd0cf('0x58')]({'name':_0x39ea4c[_0xd0cf('0x33')],'resourceId':_0x39ea4c['id'],'type':_0x6ff43c['name'],'sectionId':_0x6ff43c['id']},{})['then'](function(){return _0x3a7dd1;});}else{return _0x3a7dd1;}})[_0xd0cf('0x4e')](function(_0x46cfa3){logger['error'](_0xd0cf('0x5f'),_0x46cfa3);throw _0x46cfa3;});}return _0x3a7dd1;});}})[_0xd0cf('0x27')](respondWithResult(_0x2680f8,0xc9))['catch'](handleError(_0x2680f8,null));};exports['update']=function(_0x480d78,_0x7a198){if(_0x480d78[_0xd0cf('0x5e')]['id']){delete _0x480d78[_0xd0cf('0x5e')]['id'];}return db['VoiceQueue'][_0xd0cf('0x32')]({'where':{'id':_0x480d78[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x7a198,null))['then'](saveUpdates(_0x480d78[_0xd0cf('0x5e')],null))['then'](respondWithResult(_0x7a198,null))[_0xd0cf('0x4e')](handleError(_0x7a198,null));};exports[_0xd0cf('0x28')]=function(_0x539f1a,_0x3b0143){return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0x539f1a['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x3b0143,null))[_0xd0cf('0x27')](removeEntity(_0x3b0143,null))[_0xd0cf('0x4e')](handleError(_0x3b0143,null));};exports[_0xd0cf('0x60')]=function(_0x5a24b5,_0xcf4f80,_0xa85e4e){var _0x568d4f={'raw':![],'where':{}};var _0x599e5c={};var _0x5ef471={'count':0x0,'rows':[]};return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x5a24b5['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0xcf4f80,null))[_0xd0cf('0x27')](function(_0x232804){if(_0x232804){_0x599e5c[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db['CmHopper']['rawAttributes']);_0x599e5c['query']=_[_0xd0cf('0x3c')](_0x5a24b5[_0xd0cf('0x3b')]);_0x599e5c['filters']=_[_0xd0cf('0x3e')](_0x599e5c['model'],_0x599e5c[_0xd0cf('0x3b')]);_0x568d4f[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x599e5c[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x5a24b5[_0xd0cf('0x3b')][_0xd0cf('0x41')]));_0x568d4f[_0xd0cf('0x40')]=_0x568d4f[_0xd0cf('0x40')]['length']?_0x568d4f[_0xd0cf('0x40')]:_0x599e5c['model'];if(!_0x5a24b5['query'][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x568d4f[_0xd0cf('0x20')]=qs['limit'](_0x5a24b5['query'][_0xd0cf('0x20')]);_0x568d4f['offset']=qs[_0xd0cf('0x1f')](_0x5a24b5['query']['offset']);}_0x568d4f[_0xd0cf('0x43')]=qs[_0xd0cf('0x44')](_0x5a24b5[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x568d4f[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x5a24b5['query'],_0x599e5c[_0xd0cf('0x3d')]));_0x568d4f[_0xd0cf('0x46')][_0xd0cf('0x63')]=_0x232804['id'];if(_0x5a24b5[_0xd0cf('0x3b')][_0xd0cf('0x2c')]){_0x568d4f['where']=_[_0xd0cf('0x48')](_0x568d4f[_0xd0cf('0x46')],{'$or':_[_0xd0cf('0x2e')](_0x568d4f[_0xd0cf('0x40')],function(_0x4bde18){var _0x143de6={};_0x143de6[_0x4bde18]={'$like':'%'+_0x5a24b5[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0x143de6;})});}_0x568d4f=_['merge']({},_0x568d4f,_0x5a24b5[_0xd0cf('0x49')]);return db[_0xd0cf('0x64')][_0xd0cf('0x22')]({'where':_0x568d4f[_0xd0cf('0x46')]})[_0xd0cf('0x27')](function(_0x1ad05e){_0x5ef471['count']=_0x1ad05e;if(_0x5a24b5[_0xd0cf('0x3b')][_0xd0cf('0x4a')]){_0x568d4f[_0xd0cf('0x4b')]=[{'all':!![]}];}return db[_0xd0cf('0x64')][_0xd0cf('0x4c')](_0x568d4f);})[_0xd0cf('0x27')](function(_0x388655){_0x5ef471[_0xd0cf('0x4d')]=_0x388655;return _0x5ef471;});}})['then'](respondWithFilteredResult(_0xcf4f80,_0x568d4f))[_0xd0cf('0x4e')](handleError(_0xcf4f80,null));};exports['getHopperHistories']=function(_0x59686f,_0x129e8f,_0x3b470b){var _0x14a928={'raw':!![],'where':{}};var _0x197744={};var _0x4a6e44={'count':0x0,'rows':[]};return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x59686f['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x129e8f,null))[_0xd0cf('0x27')](function(_0x23569e){if(_0x23569e){_0x197744[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db[_0xd0cf('0x65')][_0xd0cf('0x3a')]);_0x197744[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x59686f[_0xd0cf('0x3b')]);_0x197744[_0xd0cf('0x3d')]=_[_0xd0cf('0x3e')](_0x197744[_0xd0cf('0x3f')],_0x197744[_0xd0cf('0x3b')]);_0x14a928['attributes']=_[_0xd0cf('0x3e')](_0x197744[_0xd0cf('0x3f')],qs['fields'](_0x59686f['query']['fields']));_0x14a928[_0xd0cf('0x40')]=_0x14a928[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x14a928[_0xd0cf('0x40')]:_0x197744[_0xd0cf('0x3f')];if(!_0x59686f[_0xd0cf('0x3b')]['hasOwnProperty']('nolimit')){_0x14a928[_0xd0cf('0x20')]=qs['limit'](_0x59686f[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x14a928['offset']=qs[_0xd0cf('0x1f')](_0x59686f['query']['offset']);}_0x14a928['order']=qs[_0xd0cf('0x44')](_0x59686f[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x14a928[_0xd0cf('0x46')]=qs['filters'](_[_0xd0cf('0x45')](_0x59686f[_0xd0cf('0x3b')],_0x197744[_0xd0cf('0x3d')]));_0x14a928[_0xd0cf('0x46')]['VoiceQueueId']=_0x23569e['id'];if(_0x59686f[_0xd0cf('0x3b')][_0xd0cf('0x2c')]){_0x14a928[_0xd0cf('0x46')]=_[_0xd0cf('0x48')](_0x14a928[_0xd0cf('0x46')],{'$or':_['map'](_0x14a928[_0xd0cf('0x40')],function(_0x8c83ea){var _0x440df8={};_0x440df8[_0x8c83ea]={'$like':'%'+_0x59686f[_0xd0cf('0x3b')]['filter']+'%'};return _0x440df8;})});}_0x14a928=_[_0xd0cf('0x48')]({},_0x14a928,_0x59686f['options']);return db[_0xd0cf('0x65')][_0xd0cf('0x22')]({'where':_0x14a928[_0xd0cf('0x46')]})[_0xd0cf('0x27')](function(_0x2bc630){_0x4a6e44[_0xd0cf('0x22')]=_0x2bc630;if(_0x59686f[_0xd0cf('0x3b')]['includeAll']){_0x14a928[_0xd0cf('0x4b')]=[{'all':!![]}];}return db[_0xd0cf('0x65')][_0xd0cf('0x4c')](_0x14a928);})[_0xd0cf('0x27')](function(_0x5a6835){_0x4a6e44[_0xd0cf('0x4d')]=_0x5a6835;return _0x4a6e44;});}})[_0xd0cf('0x27')](respondWithFilteredResult(_0x129e8f,_0x14a928))[_0xd0cf('0x4e')](handleError(_0x129e8f,null));};exports[_0xd0cf('0x66')]=function(_0x84f975,_0x191009,_0x51bf61){var _0x14fb73={'raw':!![],'where':{}};var _0x27398d={};var _0x1af894={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd0cf('0x61')]({'where':{'id':_0x84f975[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x191009,null))[_0xd0cf('0x27')](function(_0x18c2c6){if(_0x18c2c6){_0x27398d[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db[_0xd0cf('0x67')][_0xd0cf('0x3a')]);_0x27398d[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x84f975[_0xd0cf('0x3b')]);_0x27398d[_0xd0cf('0x3d')]=_[_0xd0cf('0x3e')](_0x27398d[_0xd0cf('0x3f')],_0x27398d[_0xd0cf('0x3b')]);_0x14fb73[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x27398d['model'],qs[_0xd0cf('0x41')](_0x84f975['query']['fields']));_0x14fb73[_0xd0cf('0x40')]=_0x14fb73['attributes'][_0xd0cf('0x50')]?_0x14fb73[_0xd0cf('0x40')]:_0x27398d[_0xd0cf('0x3f')];if(!_0x84f975[_0xd0cf('0x3b')]['hasOwnProperty'](_0xd0cf('0x42'))){_0x14fb73[_0xd0cf('0x20')]=qs[_0xd0cf('0x20')](_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x14fb73['offset']=qs[_0xd0cf('0x1f')](_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x1f')]);}_0x14fb73['order']=qs['sort'](_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x14fb73[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x84f975[_0xd0cf('0x3b')],_0x27398d['filters']));_0x14fb73[_0xd0cf('0x46')][_0xd0cf('0x63')]=_0x18c2c6['id'];if(_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x2c')]){_0x14fb73[_0xd0cf('0x46')]=_[_0xd0cf('0x48')](_0x14fb73[_0xd0cf('0x46')],{'$or':_[_0xd0cf('0x2e')](_0x14fb73[_0xd0cf('0x40')],function(_0x4b8900){var _0x3dc803={};_0x3dc803[_0x4b8900]={'$like':'%'+_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0x3dc803;})});}_0x14fb73=_['merge']({},_0x14fb73,_0x84f975['options']);return db[_0xd0cf('0x67')][_0xd0cf('0x22')]({'where':_0x14fb73[_0xd0cf('0x46')]})[_0xd0cf('0x27')](function(_0xd5eec5){_0x1af894[_0xd0cf('0x22')]=_0xd5eec5;if(_0x84f975[_0xd0cf('0x3b')][_0xd0cf('0x4a')]){_0x14fb73[_0xd0cf('0x4b')]=[{'all':!![]}];}return db[_0xd0cf('0x67')]['findAll'](_0x14fb73);})[_0xd0cf('0x27')](function(_0x5654ea){_0x1af894[_0xd0cf('0x4d')]=_0x5654ea;return _0x1af894;});}})[_0xd0cf('0x27')](respondWithFilteredResult(_0x191009,_0x14fb73))[_0xd0cf('0x4e')](handleError(_0x191009,null));};exports[_0xd0cf('0x68')]=function(_0x355607,_0x563a5e,_0x547e47){var _0x3c5d66={'raw':!![],'where':{}};var _0x3652d9={};var _0x26ee06={'count':0x0,'rows':[]};return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x355607[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x563a5e,null))[_0xd0cf('0x27')](function(_0x1dc7dc){if(_0x1dc7dc){_0x3652d9[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db[_0xd0cf('0x69')]['rawAttributes']);_0x3652d9['query']=_[_0xd0cf('0x3c')](_0x355607['query']);_0x3652d9['filters']=_[_0xd0cf('0x3e')](_0x3652d9[_0xd0cf('0x3f')],_0x3652d9[_0xd0cf('0x3b')]);_0x3c5d66['attributes']=_[_0xd0cf('0x3e')](_0x3652d9['model'],qs[_0xd0cf('0x41')](_0x355607[_0xd0cf('0x3b')]['fields']));_0x3c5d66['attributes']=_0x3c5d66[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x3c5d66[_0xd0cf('0x40')]:_0x3652d9[_0xd0cf('0x3f')];if(!_0x355607[_0xd0cf('0x3b')][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x3c5d66[_0xd0cf('0x20')]=qs['limit'](_0x355607[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x3c5d66['offset']=qs[_0xd0cf('0x1f')](_0x355607[_0xd0cf('0x3b')][_0xd0cf('0x1f')]);}_0x3c5d66['order']=qs['sort'](_0x355607[_0xd0cf('0x3b')]['sort']);_0x3c5d66[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_['pick'](_0x355607['query'],_0x3652d9[_0xd0cf('0x3d')]));_0x3c5d66[_0xd0cf('0x46')][_0xd0cf('0x63')]=_0x1dc7dc['id'];if(_0x355607[_0xd0cf('0x3b')]['filter']){_0x3c5d66['where']=_[_0xd0cf('0x48')](_0x3c5d66[_0xd0cf('0x46')],{'$or':_['map'](_0x3c5d66[_0xd0cf('0x40')],function(_0x5969ef){var _0x31f716={};_0x31f716[_0x5969ef]={'$like':'%'+_0x355607[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0x31f716;})});}_0x3c5d66=_[_0xd0cf('0x48')]({},_0x3c5d66,_0x355607[_0xd0cf('0x49')]);return db[_0xd0cf('0x69')]['count']({'where':_0x3c5d66[_0xd0cf('0x46')]})[_0xd0cf('0x27')](function(_0x48ff4c){_0x26ee06['count']=_0x48ff4c;if(_0x355607['query'][_0xd0cf('0x4a')]){_0x3c5d66[_0xd0cf('0x4b')]=[{'all':!![]}];}return db[_0xd0cf('0x69')]['findAll'](_0x3c5d66);})[_0xd0cf('0x27')](function(_0xb7cbed){_0x26ee06[_0xd0cf('0x4d')]=_0xb7cbed;return _0x26ee06;});}})[_0xd0cf('0x27')](respondWithFilteredResult(_0x563a5e,_0x3c5d66))[_0xd0cf('0x4e')](handleError(_0x563a5e,null));};exports[_0xd0cf('0x6a')]=function(_0x3abf9c,_0x5cdb99,_0x3e0a65){var _0x15ddb6={};var _0x331d6e={};var _0x28833c;var _0x235366;return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x3abf9c['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x5cdb99,null))[_0xd0cf('0x27')](function(_0x43e9b){if(_0x43e9b){_0x28833c=_0x43e9b;_0x331d6e[_0xd0cf('0x3f')]=_['keys'](db[_0xd0cf('0x6b')]['rawAttributes']);_0x331d6e[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x3abf9c[_0xd0cf('0x3b')]);_0x331d6e['filters']=_[_0xd0cf('0x3e')](_0x331d6e[_0xd0cf('0x3f')],_0x331d6e[_0xd0cf('0x3b')]);_0x15ddb6[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x331d6e[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x3abf9c[_0xd0cf('0x3b')][_0xd0cf('0x41')]));_0x15ddb6[_0xd0cf('0x40')]=_0x15ddb6[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x15ddb6[_0xd0cf('0x40')]:_0x331d6e[_0xd0cf('0x3f')];_0x15ddb6['order']=qs['sort'](_0x3abf9c[_0xd0cf('0x3b')]['sort']);_0x15ddb6['where']=qs[_0xd0cf('0x3d')](_['pick'](_0x3abf9c[_0xd0cf('0x3b')],_0x331d6e[_0xd0cf('0x3d')]));if(_0x3abf9c[_0xd0cf('0x3b')][_0xd0cf('0x2c')]){_0x15ddb6[_0xd0cf('0x46')]=_[_0xd0cf('0x48')](_0x15ddb6['where'],{'$or':_[_0xd0cf('0x2e')](_0x15ddb6[_0xd0cf('0x40')],function(_0x55d247){var _0xbdcf98={};_0xbdcf98[_0x55d247]={'$like':'%'+_0x3abf9c[_0xd0cf('0x3b')]['filter']+'%'};return _0xbdcf98;})});}_0x15ddb6=_[_0xd0cf('0x48')]({},_0x15ddb6,_0x3abf9c[_0xd0cf('0x49')]);return _0x28833c['getTeams'](_0x15ddb6);}})[_0xd0cf('0x27')](function(_0x3cc289){if(_0x3cc289){_0x235366=_0x3cc289[_0xd0cf('0x50')];if(!_0x3abf9c[_0xd0cf('0x3b')][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x15ddb6[_0xd0cf('0x20')]=qs[_0xd0cf('0x20')](_0x3abf9c[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x15ddb6[_0xd0cf('0x1f')]=qs['offset'](_0x3abf9c['query'][_0xd0cf('0x1f')]);}return _0x28833c['getTeams'](_0x15ddb6);}})[_0xd0cf('0x27')](function(_0x50b605){if(_0x50b605){return _0x50b605?{'count':_0x235366,'rows':_0x50b605}:null;}})['then'](respondWithResult(_0x5cdb99,null))[_0xd0cf('0x4e')](handleError(_0x5cdb99,null));};exports[_0xd0cf('0x6c')]=function(_0x325fc4,_0x5c0ba6,_0x32a902){var _0x1715e9=_0x325fc4[_0xd0cf('0x5e')][_0xd0cf('0x6d')];var _0x3ba868=_[_0xd0cf('0x2e')](_0x1715e9,'id');return db['Team'][_0xd0cf('0x4c')]({'where':{'id':_0x3ba868},'attributes':['id'],'include':[{'model':db[_0xd0cf('0x6e')],'as':_0xd0cf('0x6f'),'attributes':['id',_0xd0cf('0x33'),_0xd0cf('0x70'),_0xd0cf('0x71'),_0xd0cf('0x72')],'raw':!![]}]})[_0xd0cf('0x27')](function(_0x112ff8){if(_0x112ff8){var _0x1f1dac=_['flatMap'](_0x112ff8,function(_0x50f441){var _0x4a305c=_0x50f441[_0xd0cf('0x52')]({'plain':!![]});_0x4a305c[_0xd0cf('0x6f')][_0xd0cf('0x73')](function(_0x39996a){_0x39996a[_0xd0cf('0x74')]=_[_0xd0cf('0x32')](_0x1715e9,{'id':_0x4a305c['id']})['penalty'];});return _0x4a305c[_0xd0cf('0x6f')];});return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0x325fc4[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](function(_0x58c254){return db['sequelize'][_0xd0cf('0x75')](function(_0x44b86e){return _0x58c254[_0xd0cf('0x6c')](_0x3ba868,{'transaction':_0x44b86e})[_0xd0cf('0x27')](function(){return BPromise[_0xd0cf('0x76')](_0x1715e9,function(_0x353bb9){return db['TeamVoiceQueue'][_0xd0cf('0x77')]({'TeamId':_0x353bb9['id'],'VoiceQueueId':_0x325fc4[_0xd0cf('0x5a')]['id'],'penalty':_0x353bb9[_0xd0cf('0x74')]},{'transaction':_0x44b86e});});})['then'](function(){return BPromise[_0xd0cf('0x76')](_0x1f1dac,function(_0x2f2734){return db[_0xd0cf('0x78')][_0xd0cf('0x79')]({'where':{'UserId':_0x2f2734['id'],'VoiceQueueId':_0x325fc4[_0xd0cf('0x5a')]['id']},'defaults':{'penalty':_0x2f2734['penalty']},'transaction':_0x44b86e});});})[_0xd0cf('0x27')](function(){return BPromise['each'](_[_0xd0cf('0x2c')](_0x1f1dac,{'online':!![]}),function(_0x39097e){return db[_0xd0cf('0x7a')][_0xd0cf('0x77')]({'membername':_0x39097e[_0xd0cf('0x33')],'UserId':_0x39097e['id'],'queue_name':_0x58c254[_0xd0cf('0x33')],'VoiceQueueId':_0x58c254['id'],'interface':_['isNil'](_0x39097e[_0xd0cf('0x72')])?util[_0xd0cf('0x7b')]('SIP/%s',_0x39097e[_0xd0cf('0x33')]):_0x39097e[_0xd0cf('0x72')],'paused':_0x39097e[_0xd0cf('0x71')]||![],'penalty':_0x39097e[_0xd0cf('0x74')]},{'transaction':_0x44b86e});});})[_0xd0cf('0x27')](function(){_0x1f1dac[_0xd0cf('0x73')](function(_0x976752){socket['emit'](_0xd0cf('0x7c'),{'UserId':_0x976752['id'],'VoiceQueueId':_0x58c254['id']});});});});});}})[_0xd0cf('0x27')](respondWithStatusCode(_0x5c0ba6,null))[_0xd0cf('0x4e')](handleError(_0x5c0ba6,null));};exports[_0xd0cf('0x7d')]=function(_0xe48611,_0x16d4cf,_0x29c0a8){return db[_0xd0cf('0x6b')][_0xd0cf('0x4c')]({'where':{'id':_0xe48611[_0xd0cf('0x3b')][_0xd0cf('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xd0cf('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16d4cf,null))['then'](function(_0x40f0cc){var _0x373b5e=_[_0xd0cf('0x2e')](_0x40f0cc,'id');var _0x471fc9=[];var _0x2556d7=[];var _0x1e1a9c=squel[_0xd0cf('0x7f')]();_0x1e1a9c[_0xd0cf('0x80')]('tq.TeamId')[_0xd0cf('0x81')]('team_has_voice_queues','tq')[_0xd0cf('0x82')](_0xd0cf('0x83'),'ut',_0xd0cf('0x84'))[_0xd0cf('0x46')]('VoiceQueueId\x20=\x20?',_0xe48611['params']['id']);for(var _0x5927fb=0x0;_0x5927fb<_0x40f0cc[_0xd0cf('0x50')];_0x5927fb+=0x1){let _0x400833=_0x40f0cc[_0x5927fb];for(var _0x105c1c=0x0;_0x105c1c<_0x400833['Agents']['length'];_0x105c1c+=0x1){let _0x59eb5e=_0x400833[_0xd0cf('0x6f')][_0x105c1c];var _0x37926c=_0x1e1a9c[_0xd0cf('0x59')]();_0x37926c[_0xd0cf('0x46')](_0xd0cf('0x85'),_0x59eb5e['id']);_0x2556d7[_0xd0cf('0x86')](db[_0xd0cf('0x87')][_0xd0cf('0x3b')](_0x37926c[_0xd0cf('0x88')](),{'type':db[_0xd0cf('0x87')]['QueryTypes'][_0xd0cf('0x89')]})[_0xd0cf('0x27')](function(_0x1cc124){if(_0x1cc124[_0xd0cf('0x50')]===0x1){return _0x59eb5e['id'];}else{var _0x24a7d7=_[_0xd0cf('0x8a')](_[_0xd0cf('0x2e')](_0x1cc124,'TeamId'),function(_0x27db77){return _['includes'](_0x373b5e,_0x27db77);});if(_0x24a7d7){return _0x59eb5e['id'];}}}));}}return BPromise[_0xd0cf('0x8b')](_0x2556d7)[_0xd0cf('0x27')](function(_0x1696c6){_0x471fc9=_(_0x471fc9)['union'](_0x1696c6)[_0xd0cf('0x8c')]()[_0xd0cf('0x2f')]();return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0xe48611[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](function(_0x137940){return db[_0xd0cf('0x87')]['transaction'](function(_0x533735){return _0x137940[_0xd0cf('0x7d')](_0xe48611[_0xd0cf('0x3b')][_0xd0cf('0x7e')],{'transaction':_0x533735})[_0xd0cf('0x27')](function(){if(!_[_0xd0cf('0x8d')](_0x471fc9)){return _0x137940[_0xd0cf('0x8e')](_0x471fc9,{'transaction':_0x533735})[_0xd0cf('0x27')](function(){return db[_0xd0cf('0x7a')][_0xd0cf('0x28')]({'where':{'VoiceQueueId':_0xe48611[_0xd0cf('0x5a')]['id'],'UserId':_0x471fc9},'transaction':_0x533735});});}})[_0xd0cf('0x27')](function(){_0x471fc9['forEach'](function(_0x48c09a){socket[_0xd0cf('0x8f')](_0xd0cf('0x90'),{'UserId':_0x48c09a,'VoiceQueueId':_0x137940['id']});});});});});});})[_0xd0cf('0x27')](respondWithStatusCode(_0x16d4cf,null))[_0xd0cf('0x4e')](handleError(_0x16d4cf,null));};exports[_0xd0cf('0x91')]=function(_0x40e3b2,_0x4226b1,_0x154867){var _0x15d836,_0x532c7;return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0x40e3b2[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x4226b1,null))[_0xd0cf('0x27')](function(_0x838900){if(_0x838900){_0x532c7=_0x838900;return _0x838900[_0xd0cf('0x91')](_0x40e3b2['body']['ids'],_['omit'](_0x40e3b2[_0xd0cf('0x5e')],[_0xd0cf('0x7e'),'id'])||{})['spread'](function(_0x2469ea){for(var _0x4d06f4=0x0;_0x4d06f4<_0x40e3b2[_0xd0cf('0x5e')][_0xd0cf('0x7e')][_0xd0cf('0x50')];_0x4d06f4+=0x1){socket[_0xd0cf('0x8f')](_0xd0cf('0x7c'),{'UserId':Number(_0x40e3b2[_0xd0cf('0x5e')]['ids'][_0x4d06f4]),'VoiceQueueId':Number(_0x40e3b2['params']['id'])});}return _0x2469ea;});}})[_0xd0cf('0x27')](function(_0x203076){_0x15d836=_0x203076||[];if(_0x532c7){return db[_0xd0cf('0x6e')]['findAll']({'where':{'id':_0x40e3b2[_0xd0cf('0x5e')][_0xd0cf('0x7e')]},'attributes':['id',_0xd0cf('0x33'),_0xd0cf('0x70'),_0xd0cf('0x71'),_0xd0cf('0x72')],'raw':!![]});}})[_0xd0cf('0x27')](function(_0x2d8886){if(!_[_0xd0cf('0x8d')](_0x2d8886)){var _0x1a2633=[];for(var _0x1ee675=0x0;_0x1ee675<_0x2d8886[_0xd0cf('0x50')];_0x1ee675++){if(_0x2d8886[_0x1ee675][_0xd0cf('0x70')]){_0x1a2633[_0xd0cf('0x86')](db[_0xd0cf('0x7a')][_0xd0cf('0x77')]({'membername':_0x2d8886[_0x1ee675][_0xd0cf('0x33')],'UserId':_0x2d8886[_0x1ee675]['id'],'queue_name':_0x532c7['name'],'VoiceQueueId':_0x532c7['id'],'interface':_['isNil'](_0x2d8886[_0x1ee675][_0xd0cf('0x72')])?util[_0xd0cf('0x7b')](_0xd0cf('0x92'),_0x2d8886[_0x1ee675][_0xd0cf('0x33')]):_0x2d8886[_0x1ee675]['interface'],'paused':_0x2d8886[_0x1ee675]['voicePause']||![],'penalty':_0x40e3b2['body'][_0xd0cf('0x74')]||0x0}));}}return BPromise[_0xd0cf('0x8b')](_0x1a2633);}})[_0xd0cf('0x27')](function(){return _0x15d836;})[_0xd0cf('0x27')](respondWithResult(_0x4226b1,null))[_0xd0cf('0x4e')](handleError(_0x4226b1,null));};exports[_0xd0cf('0x8e')]=function(_0x56215f,_0x4542b9,_0x886751){return db['VoiceQueue']['find']({'where':{'id':_0x56215f[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x4542b9,null))['then'](function(_0x28f92c){if(_0x28f92c){return _0x28f92c['removeAgents'](_0x56215f[_0xd0cf('0x3b')][_0xd0cf('0x7e')])['then'](function(){if(_[_0xd0cf('0x93')](_0x56215f['query']['ids'])){for(var _0x4f8935=0x0;_0x4f8935<_0x56215f['query']['ids']['length'];_0x4f8935+=0x1){socket[_0xd0cf('0x8f')](_0xd0cf('0x90'),{'UserId':Number(_0x56215f[_0xd0cf('0x3b')]['ids'][_0x4f8935]),'VoiceQueueId':Number(_0x56215f['params']['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x56215f[_0xd0cf('0x3b')][_0xd0cf('0x7e')]),'VoiceQueueId':Number(_0x56215f[_0xd0cf('0x5a')]['id'])});}});}})[_0xd0cf('0x27')](function(_0x515ad6){return db['UserVoiceQueueRt'][_0xd0cf('0x28')]({'where':{'VoiceQueueId':_0x56215f[_0xd0cf('0x5a')]['id'],'UserId':_0x56215f['query'][_0xd0cf('0x7e')]}})[_0xd0cf('0x27')](function(){return _0x515ad6;});})[_0xd0cf('0x27')](respondWithStatusCode(_0x4542b9,null))[_0xd0cf('0x4e')](handleError(_0x4542b9,null));};exports[_0xd0cf('0x94')]=function(_0x5d865e,_0x5561f4,_0x2924ca){var _0x4b39fb={};var _0x5e1fc3={};var _0x1126ee;var _0x230be3;return db[_0xd0cf('0x39')]['findOne']({'where':{'id':_0x5d865e[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x5561f4,null))[_0xd0cf('0x27')](function(_0x26364e){if(_0x26364e){_0x1126ee=_0x26364e;_0x5e1fc3[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db[_0xd0cf('0x6e')][_0xd0cf('0x3a')]);_0x5e1fc3[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x5d865e['query']);_0x5e1fc3['filters']=_[_0xd0cf('0x3e')](_0x5e1fc3[_0xd0cf('0x3f')],_0x5e1fc3['query']);_0x4b39fb[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x5e1fc3[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x5d865e[_0xd0cf('0x3b')]['fields']));_0x4b39fb[_0xd0cf('0x40')]=_0x4b39fb[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x4b39fb['attributes']:_0x5e1fc3['model'];_0x4b39fb[_0xd0cf('0x43')]=qs[_0xd0cf('0x44')](_0x5d865e[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x4b39fb['where']=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x5d865e[_0xd0cf('0x3b')],_0x5e1fc3[_0xd0cf('0x3d')]));if(_0x5d865e['query']['filter']){_0x4b39fb[_0xd0cf('0x46')]=_['merge'](_0x4b39fb[_0xd0cf('0x46')],{'$or':_[_0xd0cf('0x2e')](_0x4b39fb['attributes'],function(_0x323d56){var _0x534968={};_0x534968[_0x323d56]={'$like':'%'+_0x5d865e[_0xd0cf('0x3b')]['filter']+'%'};return _0x534968;})});}_0x4b39fb=_[_0xd0cf('0x48')]({},_0x4b39fb,_0x5d865e[_0xd0cf('0x49')]);return _0x1126ee[_0xd0cf('0x94')](_0x4b39fb);}})[_0xd0cf('0x27')](function(_0x2d5bf0){if(_0x2d5bf0){_0x230be3=_0x2d5bf0[_0xd0cf('0x50')];if(!_0x5d865e['query'][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x4b39fb[_0xd0cf('0x20')]=qs[_0xd0cf('0x20')](_0x5d865e[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x4b39fb['offset']=qs[_0xd0cf('0x1f')](_0x5d865e['query'][_0xd0cf('0x1f')]);}return _0x1126ee[_0xd0cf('0x94')](_0x4b39fb);}})[_0xd0cf('0x27')](function(_0x174b0c){if(_0x174b0c){return _0x174b0c?{'count':_0x230be3,'rows':_0x174b0c}:null;}})[_0xd0cf('0x27')](respondWithResult(_0x5561f4,null))[_0xd0cf('0x4e')](handleError(_0x5561f4,null));};exports[_0xd0cf('0x95')]=function(_0x24d575,_0x3c2975,_0x4054fa){var _0x3e52c3={};var _0x13dbe1={};var _0x1ab063;var _0x50e0f5;return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x24d575['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x3c2975,null))['then'](function(_0x1d13a4){if(_0x1d13a4){_0x1ab063=_0x1d13a4;_0x13dbe1[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db['UserVoiceQueueRt']['rawAttributes']);_0x13dbe1[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x24d575[_0xd0cf('0x3b')]);_0x13dbe1[_0xd0cf('0x3d')]=_[_0xd0cf('0x3e')](_0x13dbe1[_0xd0cf('0x3f')],_0x13dbe1[_0xd0cf('0x3b')]);_0x3e52c3['attributes']=_['intersection'](_0x13dbe1[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x24d575['query'][_0xd0cf('0x41')]));_0x3e52c3[_0xd0cf('0x40')]=_0x3e52c3[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x3e52c3[_0xd0cf('0x40')]:_0x13dbe1['model'];_0x3e52c3[_0xd0cf('0x43')]=qs[_0xd0cf('0x44')](_0x24d575['query']['sort']);_0x3e52c3[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_['pick'](_0x24d575[_0xd0cf('0x3b')],_0x13dbe1[_0xd0cf('0x3d')]));if(_0x24d575['query'][_0xd0cf('0x2c')]){_0x3e52c3['where']=_[_0xd0cf('0x48')](_0x3e52c3[_0xd0cf('0x46')],{'$or':_['map'](_0x3e52c3[_0xd0cf('0x40')],function(_0x11e784){var _0xa950ab={};_0xa950ab[_0x11e784]={'$like':'%'+_0x24d575[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0xa950ab;})});}_0x3e52c3=_[_0xd0cf('0x48')]({},_0x3e52c3,_0x24d575[_0xd0cf('0x49')]);return _0x1ab063[_0xd0cf('0x95')](_0x3e52c3);}})[_0xd0cf('0x27')](function(_0xe7feec){if(_0xe7feec){_0x50e0f5=_0xe7feec[_0xd0cf('0x50')];if(!_0x24d575['query'][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x3e52c3[_0xd0cf('0x20')]=qs[_0xd0cf('0x20')](_0x24d575[_0xd0cf('0x3b')]['limit']);_0x3e52c3[_0xd0cf('0x1f')]=qs['offset'](_0x24d575['query'][_0xd0cf('0x1f')]);}return _0x1ab063[_0xd0cf('0x95')](_0x3e52c3);}})[_0xd0cf('0x27')](function(_0x386d36){return _0x386d36?{'count':_0x50e0f5,'rows':_0x386d36}:null;})[_0xd0cf('0x27')](respondWithResult(_0x3c2975,null))[_0xd0cf('0x4e')](handleError(_0x3c2975,null));};exports[_0xd0cf('0x96')]=function(_0x538077,_0x2339c5,_0x37cafa){var _0x3f9348={};var _0x173cac={};var _0x16ade4;var _0x1fdcd9;return db['VoiceQueue']['findOne']({'where':{'id':_0x538077['params']['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x2339c5,null))[_0xd0cf('0x27')](function(_0xef1ec4){if(_0xef1ec4){_0x16ade4=_0xef1ec4;_0x173cac[_0xd0cf('0x3f')]=_['keys'](db[_0xd0cf('0x97')]['rawAttributes']);_0x173cac['query']=_[_0xd0cf('0x3c')](_0x538077[_0xd0cf('0x3b')]);_0x173cac[_0xd0cf('0x3d')]=_[_0xd0cf('0x3e')](_0x173cac['model'],_0x173cac['query']);_0x3f9348[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x173cac[_0xd0cf('0x3f')],qs[_0xd0cf('0x41')](_0x538077[_0xd0cf('0x3b')][_0xd0cf('0x41')]));_0x3f9348['attributes']=_0x3f9348[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x3f9348[_0xd0cf('0x40')]:_0x173cac[_0xd0cf('0x3f')];_0x3f9348[_0xd0cf('0x43')]=qs['sort'](_0x538077[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x3f9348[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x538077[_0xd0cf('0x3b')],_0x173cac[_0xd0cf('0x3d')]));if(_0x538077[_0xd0cf('0x3b')][_0xd0cf('0x2c')]){_0x3f9348[_0xd0cf('0x46')]=_[_0xd0cf('0x48')](_0x3f9348['where'],{'$or':_['map'](_0x3f9348[_0xd0cf('0x40')],function(_0x764a87){var _0x5c4cc8={};_0x5c4cc8[_0x764a87]={'$like':'%'+_0x538077['query']['filter']+'%'};return _0x5c4cc8;})});}_0x3f9348=_['merge']({},_0x3f9348,_0x538077[_0xd0cf('0x49')]);return _0x16ade4[_0xd0cf('0x96')](_0x3f9348);}})[_0xd0cf('0x27')](function(_0x5dbd4c){if(_0x5dbd4c){_0x1fdcd9=_0x5dbd4c['length'];if(!_0x538077[_0xd0cf('0x3b')][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x3f9348[_0xd0cf('0x20')]=qs['limit'](_0x538077[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x3f9348[_0xd0cf('0x1f')]=qs[_0xd0cf('0x1f')](_0x538077['query'][_0xd0cf('0x1f')]);}return _0x16ade4[_0xd0cf('0x96')](_0x3f9348);}})[_0xd0cf('0x27')](function(_0x4a0bd0){if(_0x4a0bd0){return _0x4a0bd0?{'count':_0x1fdcd9,'rows':_0x4a0bd0}:null;}})['then'](respondWithResult(_0x2339c5,null))[_0xd0cf('0x4e')](handleError(_0x2339c5,null));};exports[_0xd0cf('0x98')]=function(_0x3337e1,_0x507fbc,_0x59477f){var _0x2fec6a,_0x5e1eaf;return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0x3337e1[_0xd0cf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x507fbc,null))['then'](function(_0x5e6a0c){if(_0x5e6a0c){_0x5e1eaf=_0x5e6a0c;return _0x5e6a0c['addLists'](_0x3337e1[_0xd0cf('0x5e')]['ids'],_[_0xd0cf('0x5b')](_0x3337e1[_0xd0cf('0x5e')],[_0xd0cf('0x7e'),'id'])||{});}return null;})[_0xd0cf('0x99')](function(_0x2ede7e){var _0x16f33c;_0x2fec6a=_0x2ede7e||[];var _0x2bc314=[];if(_0x2ede7e){for(var _0x3f7045=0x0;_0x3f7045<_0x2ede7e['length'];_0x3f7045+=0x1){var _0x1a9907=_0x2ede7e[_0x3f7045]['get']({'plain':!![]});_0x5e1eaf[_0xd0cf('0x9a')]=_0x3337e1[_0xd0cf('0x5e')][_0xd0cf('0x9a')]?_0x3337e1[_0xd0cf('0x5e')][_0xd0cf('0x9a')]:_0x5e1eaf[_0xd0cf('0x9a')];switch(_0x5e1eaf[_0xd0cf('0x9a')]){case'always':_0x16f33c=squel[_0xd0cf('0x9b')]()['into'](_0xd0cf('0x9c'))['fromQuery']([_0xd0cf('0x9d'),_0xd0cf('0x9e'),'ContactId',_0xd0cf('0x9f'),_0xd0cf('0x63'),'createdAt',_0xd0cf('0x5d')],squel['select']()['field'](_0xd0cf('0x9d'),_0xd0cf('0x9d'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),_0xd0cf('0x9e'))['field']('id','ContactId')['field'](_0x1a9907[_0xd0cf('0xa1')][_0xd0cf('0x88')](),_0xd0cf('0x9f'))[_0xd0cf('0x80')](_0x3337e1['params']['id'][_0xd0cf('0x88')](),_0xd0cf('0x63'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),_0xd0cf('0x5c'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),_0xd0cf('0x5d'))[_0xd0cf('0x81')](_0xd0cf('0xa2'))[_0xd0cf('0x46')](_0xd0cf('0xa3'))['where']('ListId\x20=\x20?',_0x1a9907['CmListId']['toString']())[_0xd0cf('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0xd0cf('0x46')](_0xd0cf('0xa4'),squel[_0xd0cf('0x7f')]()['field'](_0xd0cf('0xa5'))[_0xd0cf('0x81')](_0xd0cf('0xa6'))[_0xd0cf('0x46')]('VoiceQueueId\x20=\x20?',_0x3337e1[_0xd0cf('0x5a')]['id'][_0xd0cf('0x88')]()))[_0xd0cf('0x46')](_0xd0cf('0xa4'),squel[_0xd0cf('0x7f')]()[_0xd0cf('0x80')](_0xd0cf('0xa7'))[_0xd0cf('0x81')](_0xd0cf('0x9c'))[_0xd0cf('0x46')](_0xd0cf('0xa8'),_0x3337e1[_0xd0cf('0x5a')]['id'][_0xd0cf('0x88')]())))[_0xd0cf('0x88')]();break;case _0xd0cf('0xa9'):_0x16f33c=squel[_0xd0cf('0x9b')]()['into'](_0xd0cf('0x9c'))[_0xd0cf('0xaa')]([_0xd0cf('0x9d'),_0xd0cf('0x9e'),_0xd0cf('0xab'),'ListId','VoiceQueueId',_0xd0cf('0x5c'),_0xd0cf('0x5d')],squel[_0xd0cf('0x7f')]()[_0xd0cf('0x80')]('phone',_0xd0cf('0x9d'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),'scheduledAt')[_0xd0cf('0x80')]('id',_0xd0cf('0xab'))[_0xd0cf('0x80')](_0x1a9907[_0xd0cf('0xa1')][_0xd0cf('0x88')](),_0xd0cf('0x9f'))[_0xd0cf('0x80')](_0x3337e1['params']['id']['toString'](),_0xd0cf('0x63'))[_0xd0cf('0x80')]('NOW()',_0xd0cf('0x5c'))[_0xd0cf('0x80')]('NOW()','updatedAt')['from'](_0xd0cf('0xa2'))[_0xd0cf('0x46')](_0xd0cf('0xa3'))[_0xd0cf('0x46')](_0xd0cf('0xac'),_0x1a9907[_0xd0cf('0xa1')][_0xd0cf('0x88')]())[_0xd0cf('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd0cf('0xa4'),squel[_0xd0cf('0x7f')]()[_0xd0cf('0x80')]('COALESCE(phone,\x27\x27)')[_0xd0cf('0x81')]('cm_hopper')['where'](_0xd0cf('0xa8'),_0x3337e1[_0xd0cf('0x5a')]['id'][_0xd0cf('0x88')]())))[_0xd0cf('0x88')]();break;default:_0x16f33c=squel[_0xd0cf('0x9b')]()[_0xd0cf('0xad')](_0xd0cf('0x9c'))['fromQuery']([_0xd0cf('0x9d'),_0xd0cf('0x9e'),_0xd0cf('0xab'),_0xd0cf('0x9f'),'VoiceQueueId',_0xd0cf('0x5c'),'updatedAt'],squel[_0xd0cf('0x7f')]()[_0xd0cf('0x80')](_0xd0cf('0x9d'),_0xd0cf('0x9d'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),'scheduledAt')[_0xd0cf('0x80')]('id','ContactId')[_0xd0cf('0x80')](_0x1a9907[_0xd0cf('0xa1')][_0xd0cf('0x88')](),'ListId')[_0xd0cf('0x80')](_0x3337e1[_0xd0cf('0x5a')]['id'][_0xd0cf('0x88')](),_0xd0cf('0x63'))['field'](_0xd0cf('0xa0'),'createdAt')[_0xd0cf('0x80')]('NOW()',_0xd0cf('0x5d'))[_0xd0cf('0x81')](_0xd0cf('0xa2'))[_0xd0cf('0x46')](_0xd0cf('0xa3'))[_0xd0cf('0x46')](_0xd0cf('0xac'),_0x1a9907['CmListId'][_0xd0cf('0x88')]())[_0xd0cf('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xd0cf('0x88')]();}_0x2bc314['push'](db[_0xd0cf('0x87')]['query'](_0x16f33c));}return BPromise[_0xd0cf('0x8b')](_0x2bc314);}})['then'](function(){return _0x2fec6a;})[_0xd0cf('0x27')](respondWithResult(_0x507fbc,null))[_0xd0cf('0x4e')](handleError(_0x507fbc,null));};exports[_0xd0cf('0xae')]=function(_0x463780,_0x24c747,_0x20aeb8){return db['VoiceQueue'][_0xd0cf('0x32')]({'where':{'id':_0x463780[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x24c747,null))[_0xd0cf('0x27')](function(_0x11d6a4){if(_0x11d6a4){return _0x11d6a4[_0xd0cf('0xae')](_0x463780[_0xd0cf('0x3b')][_0xd0cf('0x7e')]);}})['then'](function(_0x1808dc){if(_0x1808dc){return db[_0xd0cf('0x64')][_0xd0cf('0x28')]({'where':{'ListId':_0x463780[_0xd0cf('0x3b')][_0xd0cf('0x7e')],'VoiceQueueId':_0x463780[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](function(){return _0x1808dc;});}})[_0xd0cf('0x27')](respondWithStatusCode(_0x24c747,null))['catch'](handleError(_0x24c747,null));};exports['getBlackLists']=function(_0x444689,_0x1df491,_0x11e0fd){var _0x2a5c28={};var _0x49e81a={};var _0x5a9512;var _0x313522;return db[_0xd0cf('0x39')][_0xd0cf('0x61')]({'where':{'id':_0x444689[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x1df491,null))[_0xd0cf('0x27')](function(_0x490ed4){if(_0x490ed4){_0x5a9512=_0x490ed4;_0x49e81a[_0xd0cf('0x3f')]=_[_0xd0cf('0x3c')](db[_0xd0cf('0x97')][_0xd0cf('0x3a')]);_0x49e81a[_0xd0cf('0x3b')]=_[_0xd0cf('0x3c')](_0x444689['query']);_0x49e81a[_0xd0cf('0x3d')]=_['intersection'](_0x49e81a[_0xd0cf('0x3f')],_0x49e81a[_0xd0cf('0x3b')]);_0x2a5c28[_0xd0cf('0x40')]=_[_0xd0cf('0x3e')](_0x49e81a['model'],qs['fields'](_0x444689['query'][_0xd0cf('0x41')]));_0x2a5c28[_0xd0cf('0x40')]=_0x2a5c28[_0xd0cf('0x40')][_0xd0cf('0x50')]?_0x2a5c28[_0xd0cf('0x40')]:_0x49e81a['model'];_0x2a5c28[_0xd0cf('0x43')]=qs['sort'](_0x444689[_0xd0cf('0x3b')][_0xd0cf('0x44')]);_0x2a5c28[_0xd0cf('0x46')]=qs[_0xd0cf('0x3d')](_[_0xd0cf('0x45')](_0x444689[_0xd0cf('0x3b')],_0x49e81a[_0xd0cf('0x3d')]));if(_0x444689['query'][_0xd0cf('0x2c')]){_0x2a5c28[_0xd0cf('0x46')]=_[_0xd0cf('0x48')](_0x2a5c28['where'],{'$or':_[_0xd0cf('0x2e')](_0x2a5c28['attributes'],function(_0x4e44c0){var _0x546028={};_0x546028[_0x4e44c0]={'$like':'%'+_0x444689[_0xd0cf('0x3b')][_0xd0cf('0x2c')]+'%'};return _0x546028;})});}_0x2a5c28=_[_0xd0cf('0x48')]({},_0x2a5c28,_0x444689[_0xd0cf('0x49')]);return _0x5a9512[_0xd0cf('0xaf')](_0x2a5c28);}})[_0xd0cf('0x27')](function(_0xa8d51a){if(_0xa8d51a){_0x313522=_0xa8d51a[_0xd0cf('0x50')];if(!_0x444689[_0xd0cf('0x3b')][_0xd0cf('0x62')](_0xd0cf('0x42'))){_0x2a5c28['limit']=qs['limit'](_0x444689[_0xd0cf('0x3b')][_0xd0cf('0x20')]);_0x2a5c28[_0xd0cf('0x1f')]=qs[_0xd0cf('0x1f')](_0x444689[_0xd0cf('0x3b')][_0xd0cf('0x1f')]);}return _0x5a9512[_0xd0cf('0xaf')](_0x2a5c28);}})[_0xd0cf('0x27')](function(_0x4ab37e){if(_0x4ab37e){return _0x4ab37e?{'count':_0x313522,'rows':_0x4ab37e}:null;}})['then'](respondWithResult(_0x1df491,null))[_0xd0cf('0x4e')](handleError(_0x1df491,null));};exports[_0xd0cf('0xb0')]=function(_0x426bf5,_0x6659f3,_0x4423ec){var _0x4ba894,_0x1b69b7;return db[_0xd0cf('0x39')][_0xd0cf('0x32')]({'where':{'id':_0x426bf5[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x6659f3,null))['then'](function(_0x451c14){if(_0x451c14){_0x1b69b7=_0x451c14;return _0x451c14['addBlackLists'](_0x426bf5[_0xd0cf('0x5e')][_0xd0cf('0x7e')],_[_0xd0cf('0x5b')](_0x426bf5[_0xd0cf('0x5e')],['ids','id'])||{});}return null;})[_0xd0cf('0x99')](function(_0xfffdd8){var _0x18de22;_0x4ba894=_0xfffdd8||[];var _0x23fb3c=[];if(_0xfffdd8){for(var _0x4084ce=0x0;_0x4084ce<_0xfffdd8['length'];_0x4084ce+=0x1){var _0x5bcf3a=_0xfffdd8[_0x4084ce]['get']({'plain':!![]});_0x18de22=squel[_0xd0cf('0x9b')]()[_0xd0cf('0xad')](_0xd0cf('0xb1'))[_0xd0cf('0xaa')]([_0xd0cf('0x9d'),'ContactId',_0xd0cf('0x9f'),_0xd0cf('0x63'),_0xd0cf('0x5c'),_0xd0cf('0x5d')],squel['select']()[_0xd0cf('0x80')](_0xd0cf('0x9d'),_0xd0cf('0x9d'))[_0xd0cf('0x80')]('id',_0xd0cf('0xab'))['field'](_0x5bcf3a[_0xd0cf('0xa1')]['toString'](),_0xd0cf('0x9f'))[_0xd0cf('0x80')](_0x426bf5[_0xd0cf('0x5a')]['id']['toString'](),_0xd0cf('0x63'))[_0xd0cf('0x80')](_0xd0cf('0xa0'),_0xd0cf('0x5c'))['field'](_0xd0cf('0xa0'),_0xd0cf('0x5d'))['from'](_0xd0cf('0xa2'))[_0xd0cf('0x46')](_0xd0cf('0xa3'))[_0xd0cf('0x46')](_0xd0cf('0xac'),_0x5bcf3a[_0xd0cf('0xa1')][_0xd0cf('0x88')]())['where'](_0xd0cf('0xb2')))[_0xd0cf('0x88')]();_0x23fb3c[_0xd0cf('0x86')](db[_0xd0cf('0x87')]['query'](_0x18de22));}return BPromise[_0xd0cf('0x8b')](_0x23fb3c);}})[_0xd0cf('0x27')](function(){return _0x4ba894;})[_0xd0cf('0x27')](respondWithResult(_0x6659f3,null))[_0xd0cf('0x4e')](handleError(_0x6659f3,null));};exports['removeBlackLists']=function(_0x296727,_0x433fd6,_0x4105b0){return db[_0xd0cf('0x39')]['find']({'where':{'id':_0x296727[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](handleEntityNotFound(_0x433fd6,null))['then'](function(_0x2e4f5f){if(_0x2e4f5f){return _0x2e4f5f['removeBlackLists'](_0x296727[_0xd0cf('0x3b')][_0xd0cf('0x7e')]);}})[_0xd0cf('0x27')](function(_0x4ac8c7){if(_0x4ac8c7){return db[_0xd0cf('0x69')][_0xd0cf('0x28')]({'where':{'ListId':_0x296727[_0xd0cf('0x3b')]['ids'],'VoiceQueueId':_0x296727[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x27')](function(){return _0x4ac8c7;});}})[_0xd0cf('0x27')](respondWithStatusCode(_0x433fd6,null))[_0xd0cf('0x4e')](handleError(_0x433fd6,null));}; \ No newline at end of file +var _0x22fe=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','name','UserProfileResource','end','error','send','index','map','VoiceQueue','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','CmHopper','VoiceQueueId','include','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','emit','removeTeams','field','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','online','SIP/%s','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','select','NOW()','ContactId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4113c7,_0x1da3ac){var _0x4ae746=function(_0x395262){while(--_0x395262){_0x4113c7['push'](_0x4113c7['shift']());}};_0x4ae746(++_0x1da3ac);}(_0x22fe,0x161));var _0xe22f=function(_0x5c043e,_0x15b30c){_0x5c043e=_0x5c043e-0x0;var _0x23980c=_0x22fe[_0x5c043e];return _0x23980c;};'use strict';var emlformat=require(_0xe22f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe22f('0x1'));var jsonpatch=require(_0xe22f('0x2'));var rp=require(_0xe22f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe22f('0x4'));var util=require(_0xe22f('0x5'));var path=require('path');var sox=require(_0xe22f('0x6'));var csv=require(_0xe22f('0x7'));var ejs=require(_0xe22f('0x8'));var fs=require('fs');var fs_extra=require(_0xe22f('0x9'));var _=require('lodash');var squel=require(_0xe22f('0xa'));var crypto=require(_0xe22f('0xb'));var jsforce=require(_0xe22f('0xc'));var deskjs=require(_0xe22f('0xd'));var toCsv=require(_0xe22f('0x7'));var querystring=require(_0xe22f('0xe'));var Papa=require(_0xe22f('0xf'));var Redis=require(_0xe22f('0x10'));var authService=require(_0xe22f('0x11'));var qs=require(_0xe22f('0x12'));var as=require(_0xe22f('0x13'));var hardwareService=require(_0xe22f('0x14'));var logger=require(_0xe22f('0x15'))(_0xe22f('0x16'));var utils=require(_0xe22f('0x17'));var config=require(_0xe22f('0x18'));var licenseUtil=require(_0xe22f('0x19'));var db=require(_0xe22f('0x1a'))['db'];config[_0xe22f('0x1b')]=_[_0xe22f('0x1c')](config[_0xe22f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe22f('0x1d'))(new Redis(config[_0xe22f('0x1b')]));require('./voiceQueue.socket')[_0xe22f('0x1e')](socket);function respondWithStatusCode(_0x184d00,_0x58f334){_0x58f334=_0x58f334||0xcc;return function(_0x16ee73){if(_0x16ee73){return _0x184d00['sendStatus'](_0x58f334);}return _0x184d00[_0xe22f('0x1f')](_0x58f334)['end']();};}function respondWithResult(_0x571937,_0x428288){_0x428288=_0x428288||0xc8;return function(_0x19e083){if(_0x19e083){return _0x571937[_0xe22f('0x1f')](_0x428288)[_0xe22f('0x20')](_0x19e083);}};}function respondWithFilteredResult(_0x59bc9b,_0x38997b){return function(_0x31d525){if(_0x31d525){var _0x562bd=typeof _0x38997b[_0xe22f('0x21')]===_0xe22f('0x22')&&typeof _0x38997b[_0xe22f('0x23')]===_0xe22f('0x22');var _0x4424ed=_0x31d525['count'];var _0x17f1b6=_0x562bd?0x0:_0x38997b[_0xe22f('0x21')];var _0x593bbb=_0x562bd?_0x31d525[_0xe22f('0x24')]:_0x38997b['offset']+_0x38997b[_0xe22f('0x23')];var _0x5d80cc;if(_0x593bbb>=_0x4424ed){_0x593bbb=_0x4424ed;_0x5d80cc=0xc8;}else{_0x5d80cc=0xce;}_0x59bc9b[_0xe22f('0x1f')](_0x5d80cc);return _0x59bc9b['set'](_0xe22f('0x25'),_0x17f1b6+'-'+_0x593bbb+'/'+_0x4424ed)[_0xe22f('0x20')](_0x31d525);}return null;};}function patchUpdates(_0x52372e){return function(_0xca3d89){try{jsonpatch[_0xe22f('0x26')](_0xca3d89,_0x52372e,!![]);}catch(_0x341463){return BPromise[_0xe22f('0x27')](_0x341463);}return _0xca3d89[_0xe22f('0x28')]();};}function saveUpdates(_0x38e8bd,_0x3fc91d){return function(_0x3f14ca){if(_0x3f14ca){return _0x3f14ca[_0xe22f('0x29')](_0x38e8bd)[_0xe22f('0x2a')](function(_0x26181a){return _0x26181a;});}return null;};}function removeEntity(_0x28208b,_0x525b61){return function(_0x128633){if(_0x128633){return _0x128633[_0xe22f('0x2b')]()[_0xe22f('0x2a')](function(){var _0x3ebc92=_0x128633[_0xe22f('0x2c')]({'plain':!![]});var _0x333dc1=[{'name':_0xe22f('0x2d'),'value':_0xe22f('0x2e'),'ignore':![]},{'name':_0xe22f('0x2f'),'value':_0xe22f('0x30'),'ignore':![]}];var _0x5e8ac7=_(_0x333dc1)[_0xe22f('0x31')](_0xe22f('0x32'))['map'](_0xe22f('0x33'))[_0xe22f('0x33')]();if(_[_0xe22f('0x34')](_0x5e8ac7,_0x3ebc92[_0xe22f('0x35')])){return;}var _0x339e9b=_['find'](_0x333dc1,[_0xe22f('0x33'),_0x3ebc92['type']])[_0xe22f('0x36')];return db[_0xe22f('0x37')][_0xe22f('0x2b')]({'where':{'type':_0x339e9b,'resourceId':_0x3ebc92['id']}})[_0xe22f('0x2a')](function(){return _0x128633;});})['then'](function(){_0x28208b['status'](0xcc)[_0xe22f('0x38')]();});}};}function handleEntityNotFound(_0xcd1f80,_0x425fc0){return function(_0x3b9312){if(!_0x3b9312){_0xcd1f80['sendStatus'](0x194);}return _0x3b9312;};}function handleError(_0x161cbe,_0xe61f71){_0xe61f71=_0xe61f71||0x1f4;return function(_0x571bc2){logger[_0xe22f('0x39')](_0x571bc2['stack']);if(_0x571bc2[_0xe22f('0x36')]){delete _0x571bc2[_0xe22f('0x36')];}_0x161cbe[_0xe22f('0x1f')](_0xe61f71)[_0xe22f('0x3a')](_0x571bc2);};}exports[_0xe22f('0x3b')]=function(_0x4fcb1a,_0x5bf64c){var _0x1edf3c={},_0xb3ac14={},_0x2b7187={'count':0x0,'rows':[]};var _0x1d9426=_[_0xe22f('0x3c')](db[_0xe22f('0x3d')]['rawAttributes'],function(_0x3cf600){return{'name':_0x3cf600[_0xe22f('0x3e')],'type':_0x3cf600[_0xe22f('0x35')][_0xe22f('0x3f')]};});_0xb3ac14[_0xe22f('0x40')]=_[_0xe22f('0x3c')](_0x1d9426,'name');_0xb3ac14['query']=_['keys'](_0x4fcb1a[_0xe22f('0x41')]);_0xb3ac14[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0xb3ac14[_0xe22f('0x40')],_0xb3ac14[_0xe22f('0x41')]);_0x1edf3c['attributes']=_[_0xe22f('0x43')](_0xb3ac14[_0xe22f('0x40')],qs['fields'](_0x4fcb1a['query'][_0xe22f('0x44')]));_0x1edf3c[_0xe22f('0x45')]=_0x1edf3c[_0xe22f('0x45')][_0xe22f('0x46')]?_0x1edf3c[_0xe22f('0x45')]:_0xb3ac14[_0xe22f('0x40')];if(!_0x4fcb1a[_0xe22f('0x41')][_0xe22f('0x47')](_0xe22f('0x48'))){_0x1edf3c[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0x4fcb1a['query']['limit']);_0x1edf3c['offset']=qs[_0xe22f('0x21')](_0x4fcb1a[_0xe22f('0x41')][_0xe22f('0x21')]);}_0x1edf3c[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0x4fcb1a[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x1edf3c[_0xe22f('0x4b')]=qs[_0xe22f('0x42')](_[_0xe22f('0x4c')](_0x4fcb1a[_0xe22f('0x41')],_0xb3ac14[_0xe22f('0x42')]),_0x1d9426);if(_0x4fcb1a[_0xe22f('0x41')][_0xe22f('0x31')]){_0x1edf3c[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x1edf3c[_0xe22f('0x4b')],{'$or':_['map'](_0x1d9426,function(_0x2ae26f){if(_0x2ae26f[_0xe22f('0x35')]!==_0xe22f('0x4e')){var _0x8514e={};_0x8514e[_0x2ae26f[_0xe22f('0x36')]]={'$like':'%'+_0x4fcb1a[_0xe22f('0x41')]['filter']+'%'};return _0x8514e;}})});}_0x1edf3c=_[_0xe22f('0x4d')]({},_0x1edf3c,_0x4fcb1a[_0xe22f('0x4f')]);var _0xb975b0={'where':_0x1edf3c[_0xe22f('0x4b')]};return db[_0xe22f('0x3d')][_0xe22f('0x24')](_0xb975b0)[_0xe22f('0x2a')](function(_0x36b859){_0x2b7187[_0xe22f('0x24')]=_0x36b859;if(_0x4fcb1a[_0xe22f('0x41')][_0xe22f('0x50')]){_0x1edf3c['include']=[{'all':!![]}];}return db[_0xe22f('0x3d')][_0xe22f('0x51')](_0x1edf3c);})[_0xe22f('0x2a')](function(_0x27684a){_0x2b7187[_0xe22f('0x52')]=_0x27684a;return _0x2b7187;})[_0xe22f('0x2a')](respondWithFilteredResult(_0x5bf64c,_0x1edf3c))[_0xe22f('0x53')](handleError(_0x5bf64c,null));};exports[_0xe22f('0x54')]=function(_0x571eb4,_0x51f43c){var _0x39f079={'raw':![],'where':{'id':_0x571eb4[_0xe22f('0x55')]['id']}},_0x5be0fe={};_0x5be0fe[_0xe22f('0x40')]=_[_0xe22f('0x56')](db[_0xe22f('0x3d')][_0xe22f('0x57')]);_0x5be0fe['query']=_['keys'](_0x571eb4['query']);_0x5be0fe[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0x5be0fe[_0xe22f('0x40')],_0x5be0fe[_0xe22f('0x41')]);_0x39f079[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0x5be0fe[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x571eb4[_0xe22f('0x41')][_0xe22f('0x44')]));_0x39f079[_0xe22f('0x45')]=_0x39f079[_0xe22f('0x45')][_0xe22f('0x46')]?_0x39f079[_0xe22f('0x45')]:_0x5be0fe[_0xe22f('0x40')];if(_0x571eb4[_0xe22f('0x41')][_0xe22f('0x50')]){_0x39f079['include']=[{'all':!![]}];}_0x39f079=_[_0xe22f('0x4d')]({},_0x39f079,_0x571eb4['options']);return db['VoiceQueue'][_0xe22f('0x58')](_0x39f079)[_0xe22f('0x2a')](handleEntityNotFound(_0x51f43c,null))['then'](respondWithResult(_0x51f43c,null))[_0xe22f('0x53')](handleError(_0x51f43c,null));};exports[_0xe22f('0x59')]=function(_0x40ccd0,_0x187e54){return db['VoiceQueue'][_0xe22f('0x59')](_0x40ccd0[_0xe22f('0x5a')],{})[_0xe22f('0x2a')](function(_0x5b20ec){var _0x22e14a=_0x40ccd0[_0xe22f('0x5b')][_0xe22f('0x2c')]({'plain':!![]});if(!_0x22e14a)throw new Error(_0xe22f('0x5c'));if(_0x22e14a[_0xe22f('0x5d')]===_0xe22f('0x5b')){var _0x4949fa=_0x5b20ec[_0xe22f('0x2c')]({'plain':!![]});var _0x385c6b=[{'name':_0xe22f('0x2d'),'value':_0xe22f('0x2e')},{'name':_0xe22f('0x2f'),'value':'outbound'}];var _0x35897a=_[_0xe22f('0x58')](_0x385c6b,['value',_0x4949fa[_0xe22f('0x35')]])[_0xe22f('0x36')];return db[_0xe22f('0x5e')]['find']({'where':{'name':_0x35897a,'userProfileId':_0x22e14a[_0xe22f('0x5f')]},'raw':!![]})[_0xe22f('0x2a')](function(_0x10a1b9){if(_0x10a1b9&&_0x10a1b9[_0xe22f('0x60')]===0x0){return db[_0xe22f('0x37')][_0xe22f('0x59')]({'name':_0x4949fa[_0xe22f('0x36')],'resourceId':_0x4949fa['id'],'type':_0x10a1b9[_0xe22f('0x36')],'sectionId':_0x10a1b9['id']},{})[_0xe22f('0x2a')](function(){return _0x5b20ec;});}else{return _0x5b20ec;}})[_0xe22f('0x53')](function(_0x4a361d){logger[_0xe22f('0x39')](_0xe22f('0x61'),_0x4a361d);throw _0x4a361d;});}return _0x5b20ec;})[_0xe22f('0x2a')](respondWithResult(_0x187e54,0xc9))['catch'](handleError(_0x187e54,null));};exports[_0xe22f('0x62')]=function(_0x583318,_0x500423){var _0x37ca95={'where':{'id':_0x583318[_0xe22f('0x55')]['id']}},_0x39dde5={};_0x39dde5[_0xe22f('0x40')]=_[_0xe22f('0x56')](db['VoiceQueue']['rawAttributes']);_0x37ca95['attributes']=_['intersection'](_0x39dde5['model'],qs['fields'](_0x583318[_0xe22f('0x41')][_0xe22f('0x44')]));_0x37ca95[_0xe22f('0x45')]=_0x37ca95[_0xe22f('0x45')][_0xe22f('0x46')]?_0x37ca95[_0xe22f('0x45')]:_0x39dde5[_0xe22f('0x40')];if(_0x583318['query'][_0xe22f('0x50')]){_0x37ca95['include']=[{'all':!![]}];}_0x37ca95=_[_0xe22f('0x4d')]({},_0x37ca95,_0x583318[_0xe22f('0x4f')]);return db['VoiceQueue']['find'](_0x37ca95)[_0xe22f('0x2a')](handleEntityNotFound(_0x500423,null))['then'](function(_0x41066b){if(_0x41066b){var _0x5f119f=_0x41066b[_0xe22f('0x2c')]({'plain':!![]});_0x5f119f=qs[_0xe22f('0x63')](_0x5f119f,['id',_0xe22f('0x64'),_0xe22f('0x65')]);_0x583318[_0xe22f('0x5a')]=_[_0xe22f('0x63')](_0x583318[_0xe22f('0x5a')],['id','createdAt','updatedAt']);return db[_0xe22f('0x3d')][_0xe22f('0x59')](_[_0xe22f('0x4d')](_0x5f119f,_0x583318['body']),{'include':_0x583318[_0xe22f('0x41')][_0xe22f('0x50')]?[{'all':!![]}]:undefined})[_0xe22f('0x2a')](function(_0x2c328b){var _0x20e670=_0x583318['user'][_0xe22f('0x2c')]({'plain':!![]});if(!_0x20e670)throw new Error(_0xe22f('0x5c'));if(_0x20e670[_0xe22f('0x5d')]===_0xe22f('0x5b')){var _0x3abdf3=_0x2c328b[_0xe22f('0x2c')]({'plain':!![]});var _0x3b8ee2=[{'name':_0xe22f('0x2d'),'value':_0xe22f('0x2e')},{'name':'QueueCampaigns','value':_0xe22f('0x30')}];var _0x3e4e62=_[_0xe22f('0x58')](_0x3b8ee2,[_0xe22f('0x33'),_0x3abdf3['type']])[_0xe22f('0x36')];return db['UserProfileSection'][_0xe22f('0x58')]({'where':{'name':_0x3e4e62,'userProfileId':_0x20e670[_0xe22f('0x5f')]},'raw':!![]})['then'](function(_0x1d165a){if(_0x1d165a&&_0x1d165a[_0xe22f('0x60')]===0x0){return db[_0xe22f('0x37')][_0xe22f('0x59')]({'name':_0x3abdf3['name'],'resourceId':_0x3abdf3['id'],'type':_0x1d165a[_0xe22f('0x36')],'sectionId':_0x1d165a['id']},{})[_0xe22f('0x2a')](function(){return _0x2c328b;});}else{return _0x2c328b;}})[_0xe22f('0x53')](function(_0x490adb){logger[_0xe22f('0x39')](_0xe22f('0x61'),_0x490adb);throw _0x490adb;});}return _0x2c328b;});}})[_0xe22f('0x2a')](respondWithResult(_0x500423,0xc9))[_0xe22f('0x53')](handleError(_0x500423,null));};exports[_0xe22f('0x29')]=function(_0x414af1,_0x21bbe1){if(_0x414af1[_0xe22f('0x5a')]['id']){delete _0x414af1[_0xe22f('0x5a')]['id'];}return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x414af1['params']['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x21bbe1,null))[_0xe22f('0x2a')](saveUpdates(_0x414af1['body'],null))[_0xe22f('0x2a')](respondWithResult(_0x21bbe1,null))[_0xe22f('0x53')](handleError(_0x21bbe1,null));};exports['destroy']=function(_0x787ad2,_0xb3c990){return db['VoiceQueue'][_0xe22f('0x58')]({'where':{'id':_0x787ad2[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0xb3c990,null))[_0xe22f('0x2a')](removeEntity(_0xb3c990,null))[_0xe22f('0x53')](handleError(_0xb3c990,null));};exports['getHoppers']=function(_0x22e707,_0x410964,_0x2b1af2){var _0x70acdb={'raw':![],'where':{}};var _0x1867a6={};var _0x39fe16={'count':0x0,'rows':[]};return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x22e707[_0xe22f('0x55')]['id']}})['then'](handleEntityNotFound(_0x410964,null))[_0xe22f('0x2a')](function(_0x4bc8e1){if(_0x4bc8e1){_0x1867a6[_0xe22f('0x40')]=_[_0xe22f('0x56')](db[_0xe22f('0x67')][_0xe22f('0x57')]);_0x1867a6[_0xe22f('0x41')]=_[_0xe22f('0x56')](_0x22e707['query']);_0x1867a6['filters']=_['intersection'](_0x1867a6['model'],_0x1867a6[_0xe22f('0x41')]);_0x70acdb[_0xe22f('0x45')]=_['intersection'](_0x1867a6[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x22e707[_0xe22f('0x41')][_0xe22f('0x44')]));_0x70acdb['attributes']=_0x70acdb[_0xe22f('0x45')][_0xe22f('0x46')]?_0x70acdb['attributes']:_0x1867a6[_0xe22f('0x40')];if(!_0x22e707['query'][_0xe22f('0x47')](_0xe22f('0x48'))){_0x70acdb[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0x22e707[_0xe22f('0x41')][_0xe22f('0x23')]);_0x70acdb[_0xe22f('0x21')]=qs[_0xe22f('0x21')](_0x22e707['query'][_0xe22f('0x21')]);}_0x70acdb[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0x22e707[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x70acdb['where']=qs[_0xe22f('0x42')](_[_0xe22f('0x4c')](_0x22e707[_0xe22f('0x41')],_0x1867a6[_0xe22f('0x42')]));_0x70acdb[_0xe22f('0x4b')][_0xe22f('0x68')]=_0x4bc8e1['id'];if(_0x22e707[_0xe22f('0x41')][_0xe22f('0x31')]){_0x70acdb[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x70acdb[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x70acdb[_0xe22f('0x45')],function(_0x5d861a){var _0xb28870={};_0xb28870[_0x5d861a]={'$like':'%'+_0x22e707[_0xe22f('0x41')][_0xe22f('0x31')]+'%'};return _0xb28870;})});}_0x70acdb=_[_0xe22f('0x4d')]({},_0x70acdb,_0x22e707[_0xe22f('0x4f')]);return db[_0xe22f('0x67')][_0xe22f('0x24')]({'where':_0x70acdb[_0xe22f('0x4b')]})[_0xe22f('0x2a')](function(_0x16310e){_0x39fe16[_0xe22f('0x24')]=_0x16310e;if(_0x22e707[_0xe22f('0x41')]['includeAll']){_0x70acdb[_0xe22f('0x69')]=[{'all':!![]}];}return db[_0xe22f('0x67')][_0xe22f('0x51')](_0x70acdb);})[_0xe22f('0x2a')](function(_0x2188b2){_0x39fe16['rows']=_0x2188b2;return _0x39fe16;});}})[_0xe22f('0x2a')](respondWithFilteredResult(_0x410964,_0x70acdb))[_0xe22f('0x53')](handleError(_0x410964,null));};exports[_0xe22f('0x6a')]=function(_0x5259a2,_0x3c79d8,_0x30b198){var _0x49e0f0={'raw':!![],'where':{}};var _0x39a4b2={};var _0x450f84={'count':0x0,'rows':[]};return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x5259a2['params']['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x3c79d8,null))['then'](function(_0x464cee){if(_0x464cee){_0x39a4b2[_0xe22f('0x40')]=_[_0xe22f('0x56')](db[_0xe22f('0x6b')][_0xe22f('0x57')]);_0x39a4b2[_0xe22f('0x41')]=_['keys'](_0x5259a2[_0xe22f('0x41')]);_0x39a4b2[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0x39a4b2['model'],_0x39a4b2[_0xe22f('0x41')]);_0x49e0f0['attributes']=_[_0xe22f('0x43')](_0x39a4b2['model'],qs['fields'](_0x5259a2[_0xe22f('0x41')]['fields']));_0x49e0f0[_0xe22f('0x45')]=_0x49e0f0[_0xe22f('0x45')][_0xe22f('0x46')]?_0x49e0f0[_0xe22f('0x45')]:_0x39a4b2[_0xe22f('0x40')];if(!_0x5259a2[_0xe22f('0x41')][_0xe22f('0x47')](_0xe22f('0x48'))){_0x49e0f0['limit']=qs[_0xe22f('0x23')](_0x5259a2['query'][_0xe22f('0x23')]);_0x49e0f0[_0xe22f('0x21')]=qs['offset'](_0x5259a2[_0xe22f('0x41')][_0xe22f('0x21')]);}_0x49e0f0[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0x5259a2[_0xe22f('0x41')]['sort']);_0x49e0f0[_0xe22f('0x4b')]=qs['filters'](_[_0xe22f('0x4c')](_0x5259a2['query'],_0x39a4b2[_0xe22f('0x42')]));_0x49e0f0[_0xe22f('0x4b')][_0xe22f('0x68')]=_0x464cee['id'];if(_0x5259a2[_0xe22f('0x41')][_0xe22f('0x31')]){_0x49e0f0[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x49e0f0[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x49e0f0['attributes'],function(_0x33ff5d){var _0x465dee={};_0x465dee[_0x33ff5d]={'$like':'%'+_0x5259a2['query'][_0xe22f('0x31')]+'%'};return _0x465dee;})});}_0x49e0f0=_[_0xe22f('0x4d')]({},_0x49e0f0,_0x5259a2[_0xe22f('0x4f')]);return db[_0xe22f('0x6b')][_0xe22f('0x24')]({'where':_0x49e0f0['where']})[_0xe22f('0x2a')](function(_0x14e901){_0x450f84[_0xe22f('0x24')]=_0x14e901;if(_0x5259a2[_0xe22f('0x41')][_0xe22f('0x50')]){_0x49e0f0[_0xe22f('0x69')]=[{'all':!![]}];}return db[_0xe22f('0x6b')][_0xe22f('0x51')](_0x49e0f0);})[_0xe22f('0x2a')](function(_0xbe9735){_0x450f84[_0xe22f('0x52')]=_0xbe9735;return _0x450f84;});}})[_0xe22f('0x2a')](respondWithFilteredResult(_0x3c79d8,_0x49e0f0))[_0xe22f('0x53')](handleError(_0x3c79d8,null));};exports[_0xe22f('0x6c')]=function(_0x527ab0,_0x1b8154,_0x17f605){var _0x26678d={'raw':!![],'where':{}};var _0xcc2636={};var _0x561367={'count':0x0,'rows':[]};return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x527ab0['params']['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x1b8154,null))[_0xe22f('0x2a')](function(_0x1eb139){if(_0x1eb139){_0xcc2636[_0xe22f('0x40')]=_['keys'](db[_0xe22f('0x6d')][_0xe22f('0x57')]);_0xcc2636[_0xe22f('0x41')]=_['keys'](_0x527ab0[_0xe22f('0x41')]);_0xcc2636[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0xcc2636[_0xe22f('0x40')],_0xcc2636[_0xe22f('0x41')]);_0x26678d[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0xcc2636[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x527ab0[_0xe22f('0x41')][_0xe22f('0x44')]));_0x26678d[_0xe22f('0x45')]=_0x26678d['attributes'][_0xe22f('0x46')]?_0x26678d[_0xe22f('0x45')]:_0xcc2636[_0xe22f('0x40')];if(!_0x527ab0[_0xe22f('0x41')]['hasOwnProperty'](_0xe22f('0x48'))){_0x26678d[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0x527ab0[_0xe22f('0x41')][_0xe22f('0x23')]);_0x26678d['offset']=qs['offset'](_0x527ab0[_0xe22f('0x41')][_0xe22f('0x21')]);}_0x26678d[_0xe22f('0x49')]=qs['sort'](_0x527ab0[_0xe22f('0x41')]['sort']);_0x26678d[_0xe22f('0x4b')]=qs[_0xe22f('0x42')](_['pick'](_0x527ab0['query'],_0xcc2636[_0xe22f('0x42')]));_0x26678d[_0xe22f('0x4b')][_0xe22f('0x68')]=_0x1eb139['id'];if(_0x527ab0[_0xe22f('0x41')][_0xe22f('0x31')]){_0x26678d[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x26678d[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x26678d['attributes'],function(_0x51407f){var _0x4cf968={};_0x4cf968[_0x51407f]={'$like':'%'+_0x527ab0[_0xe22f('0x41')][_0xe22f('0x31')]+'%'};return _0x4cf968;})});}_0x26678d=_[_0xe22f('0x4d')]({},_0x26678d,_0x527ab0['options']);return db['CmHopperFinal'][_0xe22f('0x24')]({'where':_0x26678d[_0xe22f('0x4b')]})[_0xe22f('0x2a')](function(_0x1ad9eb){_0x561367[_0xe22f('0x24')]=_0x1ad9eb;if(_0x527ab0[_0xe22f('0x41')]['includeAll']){_0x26678d[_0xe22f('0x69')]=[{'all':!![]}];}return db[_0xe22f('0x6d')]['findAll'](_0x26678d);})[_0xe22f('0x2a')](function(_0x35b896){_0x561367['rows']=_0x35b896;return _0x561367;});}})[_0xe22f('0x2a')](respondWithFilteredResult(_0x1b8154,_0x26678d))[_0xe22f('0x53')](handleError(_0x1b8154,null));};exports[_0xe22f('0x6e')]=function(_0x28fe3c,_0x58a3df,_0x1b3670){var _0x17045f={'raw':!![],'where':{}};var _0x524ad6={};var _0x47a27a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe22f('0x66')]({'where':{'id':_0x28fe3c[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x58a3df,null))[_0xe22f('0x2a')](function(_0x5de5b8){if(_0x5de5b8){_0x524ad6['model']=_[_0xe22f('0x56')](db[_0xe22f('0x6f')]['rawAttributes']);_0x524ad6[_0xe22f('0x41')]=_[_0xe22f('0x56')](_0x28fe3c[_0xe22f('0x41')]);_0x524ad6[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0x524ad6[_0xe22f('0x40')],_0x524ad6['query']);_0x17045f[_0xe22f('0x45')]=_['intersection'](_0x524ad6[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x28fe3c[_0xe22f('0x41')][_0xe22f('0x44')]));_0x17045f[_0xe22f('0x45')]=_0x17045f[_0xe22f('0x45')][_0xe22f('0x46')]?_0x17045f[_0xe22f('0x45')]:_0x524ad6[_0xe22f('0x40')];if(!_0x28fe3c['query'][_0xe22f('0x47')](_0xe22f('0x48'))){_0x17045f[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0x28fe3c[_0xe22f('0x41')][_0xe22f('0x23')]);_0x17045f['offset']=qs[_0xe22f('0x21')](_0x28fe3c[_0xe22f('0x41')][_0xe22f('0x21')]);}_0x17045f[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0x28fe3c[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x17045f[_0xe22f('0x4b')]=qs['filters'](_[_0xe22f('0x4c')](_0x28fe3c[_0xe22f('0x41')],_0x524ad6[_0xe22f('0x42')]));_0x17045f[_0xe22f('0x4b')]['VoiceQueueId']=_0x5de5b8['id'];if(_0x28fe3c[_0xe22f('0x41')][_0xe22f('0x31')]){_0x17045f[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x17045f['where'],{'$or':_[_0xe22f('0x3c')](_0x17045f[_0xe22f('0x45')],function(_0x5f53fd){var _0x2667b7={};_0x2667b7[_0x5f53fd]={'$like':'%'+_0x28fe3c[_0xe22f('0x41')]['filter']+'%'};return _0x2667b7;})});}_0x17045f=_[_0xe22f('0x4d')]({},_0x17045f,_0x28fe3c[_0xe22f('0x4f')]);return db[_0xe22f('0x6f')]['count']({'where':_0x17045f[_0xe22f('0x4b')]})[_0xe22f('0x2a')](function(_0x33b906){_0x47a27a[_0xe22f('0x24')]=_0x33b906;if(_0x28fe3c[_0xe22f('0x41')]['includeAll']){_0x17045f[_0xe22f('0x69')]=[{'all':!![]}];}return db[_0xe22f('0x6f')][_0xe22f('0x51')](_0x17045f);})[_0xe22f('0x2a')](function(_0x1bcda6){_0x47a27a[_0xe22f('0x52')]=_0x1bcda6;return _0x47a27a;});}})[_0xe22f('0x2a')](respondWithFilteredResult(_0x58a3df,_0x17045f))['catch'](handleError(_0x58a3df,null));};exports['getTeams']=function(_0xd27d74,_0x2636f4,_0xdb746){var _0x2b970e={};var _0x205b8a={};var _0x38d8bb;var _0x3fb9bd;return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0xd27d74['params']['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x2636f4,null))[_0xe22f('0x2a')](function(_0x3b7efe){if(_0x3b7efe){_0x38d8bb=_0x3b7efe;_0x205b8a['model']=_[_0xe22f('0x56')](db[_0xe22f('0x70')][_0xe22f('0x57')]);_0x205b8a['query']=_[_0xe22f('0x56')](_0xd27d74[_0xe22f('0x41')]);_0x205b8a[_0xe22f('0x42')]=_['intersection'](_0x205b8a[_0xe22f('0x40')],_0x205b8a['query']);_0x2b970e[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0x205b8a['model'],qs[_0xe22f('0x44')](_0xd27d74[_0xe22f('0x41')][_0xe22f('0x44')]));_0x2b970e[_0xe22f('0x45')]=_0x2b970e[_0xe22f('0x45')][_0xe22f('0x46')]?_0x2b970e['attributes']:_0x205b8a[_0xe22f('0x40')];_0x2b970e[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0xd27d74[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x2b970e[_0xe22f('0x4b')]=qs[_0xe22f('0x42')](_[_0xe22f('0x4c')](_0xd27d74['query'],_0x205b8a[_0xe22f('0x42')]));if(_0xd27d74[_0xe22f('0x41')][_0xe22f('0x31')]){_0x2b970e[_0xe22f('0x4b')]=_[_0xe22f('0x4d')](_0x2b970e[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x2b970e[_0xe22f('0x45')],function(_0x4af00d){var _0x44d16e={};_0x44d16e[_0x4af00d]={'$like':'%'+_0xd27d74[_0xe22f('0x41')][_0xe22f('0x31')]+'%'};return _0x44d16e;})});}_0x2b970e=_[_0xe22f('0x4d')]({},_0x2b970e,_0xd27d74[_0xe22f('0x4f')]);return _0x38d8bb[_0xe22f('0x71')](_0x2b970e);}})[_0xe22f('0x2a')](function(_0x4d0dfb){if(_0x4d0dfb){_0x3fb9bd=_0x4d0dfb[_0xe22f('0x46')];if(!_0xd27d74['query'][_0xe22f('0x47')]('nolimit')){_0x2b970e[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0xd27d74[_0xe22f('0x41')][_0xe22f('0x23')]);_0x2b970e[_0xe22f('0x21')]=qs[_0xe22f('0x21')](_0xd27d74['query'][_0xe22f('0x21')]);}return _0x38d8bb[_0xe22f('0x71')](_0x2b970e);}})['then'](function(_0x60f25f){if(_0x60f25f){return _0x60f25f?{'count':_0x3fb9bd,'rows':_0x60f25f}:null;}})[_0xe22f('0x2a')](respondWithResult(_0x2636f4,null))['catch'](handleError(_0x2636f4,null));};exports['addTeams']=function(_0x4030e5,_0x429796,_0x3c5b8e){var _0x2acacf=_0x4030e5[_0xe22f('0x5a')][_0xe22f('0x72')];var _0xd0362d=_[_0xe22f('0x3c')](_0x2acacf,'id');return db[_0xe22f('0x70')][_0xe22f('0x51')]({'where':{'id':_0xd0362d},'attributes':['id'],'include':[{'model':db[_0xe22f('0x73')],'as':_0xe22f('0x74'),'attributes':['id',_0xe22f('0x36'),'online',_0xe22f('0x75'),_0xe22f('0x76')],'raw':!![]}]})['then'](function(_0x1be925){if(_0x1be925){var _0x4e671f=_[_0xe22f('0x77')](_0x1be925,function(_0xb099c8){var _0x28ab67=_0xb099c8[_0xe22f('0x2c')]({'plain':!![]});_0x28ab67[_0xe22f('0x74')][_0xe22f('0x78')](function(_0x5758fd){_0x5758fd[_0xe22f('0x79')]=_['find'](_0x2acacf,{'id':_0x28ab67['id']})['penalty'];});return _0x28ab67[_0xe22f('0x74')];});return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x4030e5['params']['id']}})[_0xe22f('0x2a')](function(_0x32d9ae){return db[_0xe22f('0x7a')][_0xe22f('0x7b')](function(_0x43cdd){return _0x32d9ae[_0xe22f('0x7c')](_0xd0362d,{'transaction':_0x43cdd})[_0xe22f('0x2a')](function(){return BPromise[_0xe22f('0x7d')](_0x2acacf,function(_0x4c811a){return db[_0xe22f('0x7e')][_0xe22f('0x7f')]({'TeamId':_0x4c811a['id'],'VoiceQueueId':_0x4030e5['params']['id'],'penalty':_0x4c811a[_0xe22f('0x79')]},{'transaction':_0x43cdd});});})[_0xe22f('0x2a')](function(){return BPromise[_0xe22f('0x7d')](_0x4e671f,function(_0x5e3557){return db[_0xe22f('0x80')][_0xe22f('0x81')]({'where':{'UserId':_0x5e3557['id'],'VoiceQueueId':_0x4030e5[_0xe22f('0x55')]['id']},'defaults':{'penalty':_0x5e3557[_0xe22f('0x79')]},'transaction':_0x43cdd});});})[_0xe22f('0x2a')](function(){return BPromise[_0xe22f('0x7d')](_['filter'](_0x4e671f,{'online':!![]}),function(_0x548f17){return db[_0xe22f('0x82')]['upsert']({'membername':_0x548f17[_0xe22f('0x36')],'UserId':_0x548f17['id'],'queue_name':_0x32d9ae[_0xe22f('0x36')],'VoiceQueueId':_0x32d9ae['id'],'interface':_[_0xe22f('0x83')](_0x548f17[_0xe22f('0x76')])?util[_0xe22f('0x84')]('SIP/%s',_0x548f17['name']):_0x548f17[_0xe22f('0x76')],'paused':_0x548f17['voicePause']||![],'penalty':_0x548f17['penalty']},{'transaction':_0x43cdd});});})[_0xe22f('0x2a')](function(){_0x4e671f[_0xe22f('0x78')](function(_0x30ced8){socket[_0xe22f('0x85')]('userVoiceQueue:save',{'UserId':_0x30ced8['id'],'VoiceQueueId':_0x32d9ae['id']});});});});});}})[_0xe22f('0x2a')](respondWithStatusCode(_0x429796,null))[_0xe22f('0x53')](handleError(_0x429796,null));};exports[_0xe22f('0x86')]=function(_0x26066e,_0x4b5b11,_0x14b875){return db[_0xe22f('0x70')][_0xe22f('0x51')]({'where':{'id':_0x26066e[_0xe22f('0x41')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe22f('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b5b11,null))['then'](function(_0x32f6b8){var _0x1bc3bb=_[_0xe22f('0x3c')](_0x32f6b8,'id');var _0x12de08=[];var _0x1d8751=[];var _0x185de6=squel['select']();_0x185de6[_0xe22f('0x87')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xe22f('0x88')]('user_has_teams','ut',_0xe22f('0x89'))[_0xe22f('0x4b')]('VoiceQueueId\x20=\x20?',_0x26066e[_0xe22f('0x55')]['id']);for(var _0x26d71f=0x0;_0x26d71f<_0x32f6b8[_0xe22f('0x46')];_0x26d71f+=0x1){let _0x7714be=_0x32f6b8[_0x26d71f];for(var _0x9142bf=0x0;_0x9142bf<_0x7714be[_0xe22f('0x74')][_0xe22f('0x46')];_0x9142bf+=0x1){let _0x21273f=_0x7714be[_0xe22f('0x74')][_0x9142bf];var _0x248d73=_0x185de6[_0xe22f('0x62')]();_0x248d73[_0xe22f('0x4b')](_0xe22f('0x8a'),_0x21273f['id']);_0x1d8751[_0xe22f('0x8b')](db[_0xe22f('0x7a')][_0xe22f('0x41')](_0x248d73[_0xe22f('0x8c')](),{'type':db['sequelize']['QueryTypes'][_0xe22f('0x8d')]})[_0xe22f('0x2a')](function(_0x21a294){if(_0x21a294[_0xe22f('0x46')]===0x1){return _0x21273f['id'];}else{var _0x3672d9=_['every'](_[_0xe22f('0x3c')](_0x21a294,_0xe22f('0x8e')),function(_0x47eaed){return _['includes'](_0x1bc3bb,_0x47eaed);});if(_0x3672d9){return _0x21273f['id'];}}}));}}return BPromise[_0xe22f('0x8f')](_0x1d8751)[_0xe22f('0x2a')](function(_0x119c5e){_0x12de08=_(_0x12de08)['union'](_0x119c5e)[_0xe22f('0x90')]()[_0xe22f('0x33')]();return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x26066e[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](function(_0xf2756e){return db[_0xe22f('0x7a')][_0xe22f('0x7b')](function(_0xfc97){return _0xf2756e[_0xe22f('0x86')](_0x26066e[_0xe22f('0x41')][_0xe22f('0x91')],{'transaction':_0xfc97})['then'](function(){if(!_[_0xe22f('0x92')](_0x12de08)){return _0xf2756e[_0xe22f('0x93')](_0x12de08,{'transaction':_0xfc97})['then'](function(){return db[_0xe22f('0x82')][_0xe22f('0x2b')]({'where':{'VoiceQueueId':_0x26066e[_0xe22f('0x55')]['id'],'UserId':_0x12de08},'transaction':_0xfc97});});}})['then'](function(){_0x12de08[_0xe22f('0x78')](function(_0x3083f9){socket[_0xe22f('0x85')](_0xe22f('0x94'),{'UserId':_0x3083f9,'VoiceQueueId':_0xf2756e['id']});});});});});});})['then'](respondWithStatusCode(_0x4b5b11,null))['catch'](handleError(_0x4b5b11,null));};exports[_0xe22f('0x95')]=function(_0x457092,_0x1b98ec,_0xc8dbbf){var _0x16392d,_0x3a82f7;return db['VoiceQueue']['find']({'where':{'id':_0x457092[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x1b98ec,null))['then'](function(_0x4f26b7){if(_0x4f26b7){_0x3a82f7=_0x4f26b7;return _0x4f26b7['addAgents'](_0x457092[_0xe22f('0x5a')][_0xe22f('0x91')],_[_0xe22f('0x63')](_0x457092[_0xe22f('0x5a')],[_0xe22f('0x91'),'id'])||{})[_0xe22f('0x96')](function(_0xd89694){for(var _0x1e5e8e=0x0;_0x1e5e8e<_0x457092[_0xe22f('0x5a')]['ids'][_0xe22f('0x46')];_0x1e5e8e+=0x1){socket['emit'](_0xe22f('0x97'),{'UserId':Number(_0x457092[_0xe22f('0x5a')][_0xe22f('0x91')][_0x1e5e8e]),'VoiceQueueId':Number(_0x457092['params']['id'])});}return _0xd89694;});}})[_0xe22f('0x2a')](function(_0x583925){_0x16392d=_0x583925||[];if(_0x3a82f7){return db['User'][_0xe22f('0x51')]({'where':{'id':_0x457092['body'][_0xe22f('0x91')]},'attributes':['id',_0xe22f('0x36'),_0xe22f('0x98'),_0xe22f('0x75'),_0xe22f('0x76')],'raw':!![]});}})[_0xe22f('0x2a')](function(_0x44c29e){if(!_[_0xe22f('0x92')](_0x44c29e)){var _0x297e48=[];for(var _0x11850d=0x0;_0x11850d<_0x44c29e['length'];_0x11850d++){if(_0x44c29e[_0x11850d][_0xe22f('0x98')]){_0x297e48['push'](db[_0xe22f('0x82')][_0xe22f('0x7f')]({'membername':_0x44c29e[_0x11850d][_0xe22f('0x36')],'UserId':_0x44c29e[_0x11850d]['id'],'queue_name':_0x3a82f7[_0xe22f('0x36')],'VoiceQueueId':_0x3a82f7['id'],'interface':_[_0xe22f('0x83')](_0x44c29e[_0x11850d]['interface'])?util[_0xe22f('0x84')](_0xe22f('0x99'),_0x44c29e[_0x11850d][_0xe22f('0x36')]):_0x44c29e[_0x11850d][_0xe22f('0x76')],'paused':_0x44c29e[_0x11850d][_0xe22f('0x75')]||![],'penalty':_0x457092['body']['penalty']||0x0}));}}return BPromise[_0xe22f('0x8f')](_0x297e48);}})[_0xe22f('0x2a')](function(){return _0x16392d;})['then'](respondWithResult(_0x1b98ec,null))[_0xe22f('0x53')](handleError(_0x1b98ec,null));};exports['removeAgents']=function(_0x2da95a,_0x5d6f9d,_0x4a2dea){return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x2da95a[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x5d6f9d,null))[_0xe22f('0x2a')](function(_0x518fe3){if(_0x518fe3){return _0x518fe3[_0xe22f('0x93')](_0x2da95a[_0xe22f('0x41')][_0xe22f('0x91')])[_0xe22f('0x2a')](function(){if(_['isArray'](_0x2da95a[_0xe22f('0x41')][_0xe22f('0x91')])){for(var _0x164b78=0x0;_0x164b78<_0x2da95a[_0xe22f('0x41')]['ids']['length'];_0x164b78+=0x1){socket[_0xe22f('0x85')](_0xe22f('0x94'),{'UserId':Number(_0x2da95a[_0xe22f('0x41')][_0xe22f('0x91')][_0x164b78]),'VoiceQueueId':Number(_0x2da95a[_0xe22f('0x55')]['id'])});}}else{socket[_0xe22f('0x85')](_0xe22f('0x94'),{'UserId':Number(_0x2da95a[_0xe22f('0x41')][_0xe22f('0x91')]),'VoiceQueueId':Number(_0x2da95a[_0xe22f('0x55')]['id'])});}});}})[_0xe22f('0x2a')](function(_0x2d801f){return db[_0xe22f('0x82')][_0xe22f('0x2b')]({'where':{'VoiceQueueId':_0x2da95a[_0xe22f('0x55')]['id'],'UserId':_0x2da95a[_0xe22f('0x41')][_0xe22f('0x91')]}})[_0xe22f('0x2a')](function(){return _0x2d801f;});})[_0xe22f('0x2a')](respondWithStatusCode(_0x5d6f9d,null))[_0xe22f('0x53')](handleError(_0x5d6f9d,null));};exports[_0xe22f('0x9a')]=function(_0x3a40d5,_0x5315cb,_0x123f2a){var _0xa62571={};var _0xc45e63={};var _0x1bb9c9;var _0x16b6b9;return db['VoiceQueue'][_0xe22f('0x66')]({'where':{'id':_0x3a40d5[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x5315cb,null))[_0xe22f('0x2a')](function(_0x12d0c0){if(_0x12d0c0){_0x1bb9c9=_0x12d0c0;_0xc45e63['model']=_['keys'](db['User'][_0xe22f('0x57')]);_0xc45e63['query']=_[_0xe22f('0x56')](_0x3a40d5[_0xe22f('0x41')]);_0xc45e63[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0xc45e63[_0xe22f('0x40')],_0xc45e63[_0xe22f('0x41')]);_0xa62571[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0xc45e63[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x3a40d5[_0xe22f('0x41')]['fields']));_0xa62571[_0xe22f('0x45')]=_0xa62571['attributes']['length']?_0xa62571[_0xe22f('0x45')]:_0xc45e63[_0xe22f('0x40')];_0xa62571[_0xe22f('0x49')]=qs['sort'](_0x3a40d5[_0xe22f('0x41')]['sort']);_0xa62571[_0xe22f('0x4b')]=qs[_0xe22f('0x42')](_[_0xe22f('0x4c')](_0x3a40d5['query'],_0xc45e63['filters']));if(_0x3a40d5['query'][_0xe22f('0x31')]){_0xa62571['where']=_[_0xe22f('0x4d')](_0xa62571[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0xa62571[_0xe22f('0x45')],function(_0x400ea8){var _0x28b360={};_0x28b360[_0x400ea8]={'$like':'%'+_0x3a40d5[_0xe22f('0x41')]['filter']+'%'};return _0x28b360;})});}_0xa62571=_[_0xe22f('0x4d')]({},_0xa62571,_0x3a40d5[_0xe22f('0x4f')]);return _0x1bb9c9[_0xe22f('0x9a')](_0xa62571);}})['then'](function(_0x32b7bf){if(_0x32b7bf){_0x16b6b9=_0x32b7bf['length'];if(!_0x3a40d5[_0xe22f('0x41')][_0xe22f('0x47')]('nolimit')){_0xa62571[_0xe22f('0x23')]=qs[_0xe22f('0x23')](_0x3a40d5['query'][_0xe22f('0x23')]);_0xa62571['offset']=qs['offset'](_0x3a40d5[_0xe22f('0x41')]['offset']);}return _0x1bb9c9['getAgents'](_0xa62571);}})[_0xe22f('0x2a')](function(_0x4c9754){if(_0x4c9754){return _0x4c9754?{'count':_0x16b6b9,'rows':_0x4c9754}:null;}})[_0xe22f('0x2a')](respondWithResult(_0x5315cb,null))[_0xe22f('0x53')](handleError(_0x5315cb,null));};exports[_0xe22f('0x9b')]=function(_0x3931f2,_0x3b8f5c,_0x1e8501){var _0x395516={};var _0x2e09d2={};var _0x31ceed;var _0x4b7230;return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x3931f2[_0xe22f('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b8f5c,null))[_0xe22f('0x2a')](function(_0x1abe24){if(_0x1abe24){_0x31ceed=_0x1abe24;_0x2e09d2[_0xe22f('0x40')]=_[_0xe22f('0x56')](db[_0xe22f('0x82')][_0xe22f('0x57')]);_0x2e09d2[_0xe22f('0x41')]=_[_0xe22f('0x56')](_0x3931f2['query']);_0x2e09d2[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0x2e09d2['model'],_0x2e09d2[_0xe22f('0x41')]);_0x395516['attributes']=_['intersection'](_0x2e09d2[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x3931f2[_0xe22f('0x41')]['fields']));_0x395516[_0xe22f('0x45')]=_0x395516[_0xe22f('0x45')][_0xe22f('0x46')]?_0x395516[_0xe22f('0x45')]:_0x2e09d2[_0xe22f('0x40')];_0x395516[_0xe22f('0x49')]=qs[_0xe22f('0x4a')](_0x3931f2[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x395516[_0xe22f('0x4b')]=qs['filters'](_[_0xe22f('0x4c')](_0x3931f2[_0xe22f('0x41')],_0x2e09d2[_0xe22f('0x42')]));if(_0x3931f2[_0xe22f('0x41')][_0xe22f('0x31')]){_0x395516['where']=_[_0xe22f('0x4d')](_0x395516[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x395516[_0xe22f('0x45')],function(_0x3b3c92){var _0x5b6588={};_0x5b6588[_0x3b3c92]={'$like':'%'+_0x3931f2[_0xe22f('0x41')][_0xe22f('0x31')]+'%'};return _0x5b6588;})});}_0x395516=_[_0xe22f('0x4d')]({},_0x395516,_0x3931f2['options']);return _0x31ceed[_0xe22f('0x9b')](_0x395516);}})[_0xe22f('0x2a')](function(_0x3fd0f5){if(_0x3fd0f5){_0x4b7230=_0x3fd0f5[_0xe22f('0x46')];if(!_0x3931f2['query']['hasOwnProperty'](_0xe22f('0x48'))){_0x395516['limit']=qs[_0xe22f('0x23')](_0x3931f2['query'][_0xe22f('0x23')]);_0x395516['offset']=qs[_0xe22f('0x21')](_0x3931f2[_0xe22f('0x41')][_0xe22f('0x21')]);}return _0x31ceed[_0xe22f('0x9b')](_0x395516);}})['then'](function(_0x28b265){return _0x28b265?{'count':_0x4b7230,'rows':_0x28b265}:null;})[_0xe22f('0x2a')](respondWithResult(_0x3b8f5c,null))[_0xe22f('0x53')](handleError(_0x3b8f5c,null));};exports[_0xe22f('0x9c')]=function(_0x6a3c81,_0x170f50,_0x2a1ecc){var _0x59f272={};var _0xad1b02={};var _0x27fb61;var _0x354e90;return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x6a3c81['params']['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x170f50,null))[_0xe22f('0x2a')](function(_0x286d49){if(_0x286d49){_0x27fb61=_0x286d49;_0xad1b02['model']=_[_0xe22f('0x56')](db[_0xe22f('0x9d')][_0xe22f('0x57')]);_0xad1b02[_0xe22f('0x41')]=_['keys'](_0x6a3c81[_0xe22f('0x41')]);_0xad1b02[_0xe22f('0x42')]=_['intersection'](_0xad1b02[_0xe22f('0x40')],_0xad1b02[_0xe22f('0x41')]);_0x59f272[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0xad1b02['model'],qs['fields'](_0x6a3c81['query'][_0xe22f('0x44')]));_0x59f272[_0xe22f('0x45')]=_0x59f272[_0xe22f('0x45')][_0xe22f('0x46')]?_0x59f272[_0xe22f('0x45')]:_0xad1b02[_0xe22f('0x40')];_0x59f272[_0xe22f('0x49')]=qs['sort'](_0x6a3c81['query'][_0xe22f('0x4a')]);_0x59f272[_0xe22f('0x4b')]=qs[_0xe22f('0x42')](_[_0xe22f('0x4c')](_0x6a3c81[_0xe22f('0x41')],_0xad1b02[_0xe22f('0x42')]));if(_0x6a3c81[_0xe22f('0x41')][_0xe22f('0x31')]){_0x59f272['where']=_[_0xe22f('0x4d')](_0x59f272['where'],{'$or':_[_0xe22f('0x3c')](_0x59f272[_0xe22f('0x45')],function(_0x1f9d33){var _0x4c2769={};_0x4c2769[_0x1f9d33]={'$like':'%'+_0x6a3c81['query']['filter']+'%'};return _0x4c2769;})});}_0x59f272=_[_0xe22f('0x4d')]({},_0x59f272,_0x6a3c81[_0xe22f('0x4f')]);return _0x27fb61[_0xe22f('0x9c')](_0x59f272);}})[_0xe22f('0x2a')](function(_0x2e1486){if(_0x2e1486){_0x354e90=_0x2e1486[_0xe22f('0x46')];if(!_0x6a3c81[_0xe22f('0x41')][_0xe22f('0x47')](_0xe22f('0x48'))){_0x59f272['limit']=qs['limit'](_0x6a3c81['query'][_0xe22f('0x23')]);_0x59f272['offset']=qs[_0xe22f('0x21')](_0x6a3c81[_0xe22f('0x41')][_0xe22f('0x21')]);}return _0x27fb61[_0xe22f('0x9c')](_0x59f272);}})['then'](function(_0x3c3cfa){if(_0x3c3cfa){return _0x3c3cfa?{'count':_0x354e90,'rows':_0x3c3cfa}:null;}})[_0xe22f('0x2a')](respondWithResult(_0x170f50,null))[_0xe22f('0x53')](handleError(_0x170f50,null));};exports[_0xe22f('0x9e')]=function(_0x99eb7b,_0x4b3068,_0x27fc6){var _0x2a8d5c,_0x4a5d88;return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x99eb7b[_0xe22f('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b3068,null))[_0xe22f('0x2a')](function(_0x16e352){if(_0x16e352){_0x4a5d88=_0x16e352;return _0x16e352[_0xe22f('0x9e')](_0x99eb7b[_0xe22f('0x5a')]['ids'],_[_0xe22f('0x63')](_0x99eb7b['body'],['ids','id'])||{});}return null;})[_0xe22f('0x96')](function(_0x1491c7){var _0x121310;_0x2a8d5c=_0x1491c7||[];var _0x5d4592=[];if(_0x1491c7){for(var _0x5b78ff=0x0;_0x5b78ff<_0x1491c7['length'];_0x5b78ff+=0x1){var _0x52703b=_0x1491c7[_0x5b78ff][_0xe22f('0x2c')]({'plain':!![]});_0x4a5d88['dialCheckDuplicateType']=_0x99eb7b[_0xe22f('0x5a')][_0xe22f('0x9f')]?_0x99eb7b[_0xe22f('0x5a')][_0xe22f('0x9f')]:_0x4a5d88[_0xe22f('0x9f')];switch(_0x4a5d88[_0xe22f('0x9f')]){case _0xe22f('0xa0'):_0x121310=squel[_0xe22f('0xa1')]()[_0xe22f('0xa2')]('cm_hopper')[_0xe22f('0xa3')]([_0xe22f('0xa4'),_0xe22f('0xa5'),'ContactId',_0xe22f('0xa6'),_0xe22f('0x68'),_0xe22f('0x64'),_0xe22f('0x65')],squel[_0xe22f('0xa7')]()['field']('phone','phone')[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0xa5'))[_0xe22f('0x87')]('id',_0xe22f('0xa9'))[_0xe22f('0x87')](_0x52703b[_0xe22f('0xaa')][_0xe22f('0x8c')](),_0xe22f('0xa6'))['field'](_0x99eb7b[_0xe22f('0x55')]['id'][_0xe22f('0x8c')](),'VoiceQueueId')[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0x64'))[_0xe22f('0x87')]('NOW()','updatedAt')['from'](_0xe22f('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0xe22f('0x4b')](_0xe22f('0xac'),_0x52703b['CmListId'][_0xe22f('0x8c')]())[_0xe22f('0x4b')](_0xe22f('0xad'))['where'](_0xe22f('0xae'),squel['select']()[_0xe22f('0x87')]('COALESCE(calleridnum,\x27\x27)')[_0xe22f('0xaf')](_0xe22f('0xb0'))[_0xe22f('0x4b')](_0xe22f('0xb1'),_0x99eb7b[_0xe22f('0x55')]['id'][_0xe22f('0x8c')]()))[_0xe22f('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe22f('0xa7')]()[_0xe22f('0x87')]('COALESCE(phone,\x27\x27)')[_0xe22f('0xaf')](_0xe22f('0xb2'))[_0xe22f('0x4b')](_0xe22f('0xb1'),_0x99eb7b[_0xe22f('0x55')]['id'][_0xe22f('0x8c')]())))[_0xe22f('0x8c')]();break;case _0xe22f('0xb3'):_0x121310=squel[_0xe22f('0xa1')]()[_0xe22f('0xa2')](_0xe22f('0xb2'))['fromQuery']([_0xe22f('0xa4'),_0xe22f('0xa5'),_0xe22f('0xa9'),_0xe22f('0xa6'),'VoiceQueueId',_0xe22f('0x64'),_0xe22f('0x65')],squel['select']()[_0xe22f('0x87')](_0xe22f('0xa4'),'phone')[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0xa5'))['field']('id','ContactId')['field'](_0x52703b['CmListId'][_0xe22f('0x8c')](),_0xe22f('0xa6'))[_0xe22f('0x87')](_0x99eb7b[_0xe22f('0x55')]['id'][_0xe22f('0x8c')](),'VoiceQueueId')[_0xe22f('0x87')]('NOW()',_0xe22f('0x64'))['field'](_0xe22f('0xa8'),_0xe22f('0x65'))[_0xe22f('0xaf')](_0xe22f('0xab'))[_0xe22f('0x4b')](_0xe22f('0xb4'))[_0xe22f('0x4b')]('ListId\x20=\x20?',_0x52703b['CmListId'][_0xe22f('0x8c')]())[_0xe22f('0x4b')](_0xe22f('0xad'))[_0xe22f('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe22f('0xa7')]()[_0xe22f('0x87')](_0xe22f('0xb5'))[_0xe22f('0xaf')]('cm_hopper')[_0xe22f('0x4b')](_0xe22f('0xb1'),_0x99eb7b[_0xe22f('0x55')]['id'][_0xe22f('0x8c')]())))[_0xe22f('0x8c')]();break;default:_0x121310=squel['insert']()[_0xe22f('0xa2')](_0xe22f('0xb2'))['fromQuery']([_0xe22f('0xa4'),_0xe22f('0xa5'),_0xe22f('0xa9'),_0xe22f('0xa6'),_0xe22f('0x68'),_0xe22f('0x64'),'updatedAt'],squel[_0xe22f('0xa7')]()['field'](_0xe22f('0xa4'),_0xe22f('0xa4'))[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0xa5'))[_0xe22f('0x87')]('id',_0xe22f('0xa9'))[_0xe22f('0x87')](_0x52703b['CmListId']['toString'](),_0xe22f('0xa6'))['field'](_0x99eb7b[_0xe22f('0x55')]['id']['toString'](),_0xe22f('0x68'))['field']('NOW()',_0xe22f('0x64'))[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0x65'))[_0xe22f('0xaf')](_0xe22f('0xab'))[_0xe22f('0x4b')](_0xe22f('0xb4'))[_0xe22f('0x4b')](_0xe22f('0xac'),_0x52703b['CmListId']['toString']())[_0xe22f('0x4b')](_0xe22f('0xad')))[_0xe22f('0x8c')]();}_0x5d4592[_0xe22f('0x8b')](db[_0xe22f('0x7a')]['query'](_0x121310));}return BPromise[_0xe22f('0x8f')](_0x5d4592);}})[_0xe22f('0x2a')](function(){return _0x2a8d5c;})[_0xe22f('0x2a')](respondWithResult(_0x4b3068,null))[_0xe22f('0x53')](handleError(_0x4b3068,null));};exports['removeLists']=function(_0x340c02,_0x368bac,_0x23471f){return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x340c02[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x368bac,null))[_0xe22f('0x2a')](function(_0x161aed){if(_0x161aed){return _0x161aed['removeLists'](_0x340c02[_0xe22f('0x41')]['ids']);}})['then'](function(_0x480ff8){if(_0x480ff8){return db[_0xe22f('0x67')][_0xe22f('0x2b')]({'where':{'ListId':_0x340c02[_0xe22f('0x41')]['ids'],'VoiceQueueId':_0x340c02['params']['id']}})[_0xe22f('0x2a')](function(){return _0x480ff8;});}})[_0xe22f('0x2a')](respondWithStatusCode(_0x368bac,null))[_0xe22f('0x53')](handleError(_0x368bac,null));};exports[_0xe22f('0xb6')]=function(_0x4144fa,_0x3727e5,_0x3f8f92){var _0x30919c={};var _0x53d6fc={};var _0x5a42cd;var _0x5572da;return db[_0xe22f('0x3d')][_0xe22f('0x66')]({'where':{'id':_0x4144fa[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x3727e5,null))[_0xe22f('0x2a')](function(_0x110ff8){if(_0x110ff8){_0x5a42cd=_0x110ff8;_0x53d6fc['model']=_['keys'](db['CmList'][_0xe22f('0x57')]);_0x53d6fc[_0xe22f('0x41')]=_[_0xe22f('0x56')](_0x4144fa[_0xe22f('0x41')]);_0x53d6fc[_0xe22f('0x42')]=_[_0xe22f('0x43')](_0x53d6fc[_0xe22f('0x40')],_0x53d6fc[_0xe22f('0x41')]);_0x30919c[_0xe22f('0x45')]=_[_0xe22f('0x43')](_0x53d6fc[_0xe22f('0x40')],qs[_0xe22f('0x44')](_0x4144fa[_0xe22f('0x41')]['fields']));_0x30919c[_0xe22f('0x45')]=_0x30919c[_0xe22f('0x45')][_0xe22f('0x46')]?_0x30919c['attributes']:_0x53d6fc['model'];_0x30919c[_0xe22f('0x49')]=qs['sort'](_0x4144fa[_0xe22f('0x41')][_0xe22f('0x4a')]);_0x30919c[_0xe22f('0x4b')]=qs['filters'](_[_0xe22f('0x4c')](_0x4144fa[_0xe22f('0x41')],_0x53d6fc[_0xe22f('0x42')]));if(_0x4144fa['query'][_0xe22f('0x31')]){_0x30919c[_0xe22f('0x4b')]=_['merge'](_0x30919c[_0xe22f('0x4b')],{'$or':_[_0xe22f('0x3c')](_0x30919c[_0xe22f('0x45')],function(_0x469844){var _0x49f855={};_0x49f855[_0x469844]={'$like':'%'+_0x4144fa[_0xe22f('0x41')]['filter']+'%'};return _0x49f855;})});}_0x30919c=_[_0xe22f('0x4d')]({},_0x30919c,_0x4144fa['options']);return _0x5a42cd[_0xe22f('0xb6')](_0x30919c);}})[_0xe22f('0x2a')](function(_0x2944dc){if(_0x2944dc){_0x5572da=_0x2944dc['length'];if(!_0x4144fa['query']['hasOwnProperty'](_0xe22f('0x48'))){_0x30919c['limit']=qs['limit'](_0x4144fa['query']['limit']);_0x30919c['offset']=qs['offset'](_0x4144fa[_0xe22f('0x41')][_0xe22f('0x21')]);}return _0x5a42cd[_0xe22f('0xb6')](_0x30919c);}})['then'](function(_0x2ce537){if(_0x2ce537){return _0x2ce537?{'count':_0x5572da,'rows':_0x2ce537}:null;}})[_0xe22f('0x2a')](respondWithResult(_0x3727e5,null))[_0xe22f('0x53')](handleError(_0x3727e5,null));};exports[_0xe22f('0xb7')]=function(_0x4eeb23,_0x2a49d3,_0x10b0a2){var _0x15ddb8,_0x13a013;return db[_0xe22f('0x3d')]['find']({'where':{'id':_0x4eeb23[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](handleEntityNotFound(_0x2a49d3,null))[_0xe22f('0x2a')](function(_0x4c53ae){if(_0x4c53ae){_0x13a013=_0x4c53ae;return _0x4c53ae[_0xe22f('0xb7')](_0x4eeb23['body'][_0xe22f('0x91')],_[_0xe22f('0x63')](_0x4eeb23[_0xe22f('0x5a')],[_0xe22f('0x91'),'id'])||{});}return null;})[_0xe22f('0x96')](function(_0x55f77e){var _0x5d13a3;_0x15ddb8=_0x55f77e||[];var _0x240ce2=[];if(_0x55f77e){for(var _0x21363c=0x0;_0x21363c<_0x55f77e[_0xe22f('0x46')];_0x21363c+=0x1){var _0x109172=_0x55f77e[_0x21363c][_0xe22f('0x2c')]({'plain':!![]});_0x5d13a3=squel['insert']()[_0xe22f('0xa2')](_0xe22f('0xb8'))[_0xe22f('0xa3')](['phone','ContactId',_0xe22f('0xa6'),_0xe22f('0x68'),_0xe22f('0x64'),_0xe22f('0x65')],squel['select']()['field'](_0xe22f('0xa4'),_0xe22f('0xa4'))[_0xe22f('0x87')]('id','ContactId')[_0xe22f('0x87')](_0x109172['CmListId']['toString'](),_0xe22f('0xa6'))['field'](_0x4eeb23[_0xe22f('0x55')]['id']['toString'](),_0xe22f('0x68'))[_0xe22f('0x87')](_0xe22f('0xa8'),_0xe22f('0x64'))['field'](_0xe22f('0xa8'),_0xe22f('0x65'))[_0xe22f('0xaf')]('cm_contacts')[_0xe22f('0x4b')]('deletedAt\x20IS\x20NULL')[_0xe22f('0x4b')](_0xe22f('0xac'),_0x109172[_0xe22f('0xaa')][_0xe22f('0x8c')]())['where'](_0xe22f('0xad')))[_0xe22f('0x8c')]();_0x240ce2['push'](db[_0xe22f('0x7a')]['query'](_0x5d13a3));}return BPromise[_0xe22f('0x8f')](_0x240ce2);}})['then'](function(){return _0x15ddb8;})[_0xe22f('0x2a')](respondWithResult(_0x2a49d3,null))[_0xe22f('0x53')](handleError(_0x2a49d3,null));};exports[_0xe22f('0xb9')]=function(_0x535ebb,_0x5a821e,_0x53d63f){return db[_0xe22f('0x3d')][_0xe22f('0x58')]({'where':{'id':_0x535ebb[_0xe22f('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a821e,null))[_0xe22f('0x2a')](function(_0x5cd89e){if(_0x5cd89e){return _0x5cd89e['removeBlackLists'](_0x535ebb[_0xe22f('0x41')][_0xe22f('0x91')]);}})['then'](function(_0x23c68b){if(_0x23c68b){return db['CmHopperBlack'][_0xe22f('0x2b')]({'where':{'ListId':_0x535ebb['query'][_0xe22f('0x91')],'VoiceQueueId':_0x535ebb[_0xe22f('0x55')]['id']}})[_0xe22f('0x2a')](function(){return _0x23c68b;});}})[_0xe22f('0x2a')](respondWithStatusCode(_0x5a821e,null))[_0xe22f('0x53')](handleError(_0x5a821e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6aa48e1..b0ddd6f 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 _0x0b6c=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x0b6c,0x74));var _0xc0b6=function(_0x162871,_0x19b906){_0x162871=_0x162871-0x0;var _0xa0424b=_0x0b6c[_0x162871];return _0xa0424b;};'use strict';var EventEmitter=require(_0xc0b6('0x0'));var VoiceQueue=require(_0xc0b6('0x1'))['db'][_0xc0b6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc0b6('0x3')](0x0);var events={'afterCreate':_0xc0b6('0x4'),'afterUpdate':_0xc0b6('0x5'),'afterDestroy':_0xc0b6('0x6')};function emitEvent(_0x3a48b6){return function(_0x233b37,_0x6bc043,_0x5dda9d){VoiceQueueEvents['emit'](_0x3a48b6+':'+_0x233b37['id'],_0x233b37);VoiceQueueEvents[_0xc0b6('0x7')](_0x3a48b6,_0x233b37);_0x5dda9d(null);};}for(var e in events){if(events[_0xc0b6('0x8')](e)){var event=events[e];VoiceQueue[_0xc0b6('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xfecf=['remove','emit','hook','exports','update'];(function(_0x3eec42,_0x192ed2){var _0x110bf0=function(_0x4ef488){while(--_0x4ef488){_0x3eec42['push'](_0x3eec42['shift']());}};_0x110bf0(++_0x192ed2);}(_0xfecf,0x15d));var _0xffec=function(_0x4fde9d,_0x27819b){_0x4fde9d=_0x4fde9d-0x0;var _0xf4728f=_0xfecf[_0x4fde9d];return _0xf4728f;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xffec('0x0'),'afterDestroy':_0xffec('0x1')};function emitEvent(_0x2473a1){return function(_0x243130,_0x100bcb,_0x281809){VoiceQueueEvents[_0xffec('0x2')](_0x2473a1+':'+_0x243130['id'],_0x243130);VoiceQueueEvents[_0xffec('0x2')](_0x2473a1,_0x243130);_0x281809(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xffec('0x3')](e,emitEvent(event));}}module[_0xffec('0x4')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d7ae54e..9068af1 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x33f1cf,_0x59e316){var _0x4dd630=function(_0x47b9ef){while(--_0x47b9ef){_0x33f1cf['push'](_0x33f1cf['shift']());}};_0x4dd630(++_0x59e316);}(_0xedd9,0xfc));var _0x9edd=function(_0x5c0f18,_0x5f0394){_0x5c0f18=_0x5c0f18-0x0;var _0x4dad1a=_0xedd9[_0x5c0f18];return _0x4dad1a;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x4c0b02,_0x21e019){var _0xef1093=function(_0x4ecfc1){while(--_0x4ecfc1){_0x4c0b02['push'](_0x4c0b02['shift']());}};_0xef1093(++_0x21e019);}(_0x34e8,0x12c));var _0x834e=function(_0x5f3cd5,_0x3cb7fd){_0x5f3cd5=_0x5f3cd5-0x0;var _0x532e9f=_0x34e8[_0x5f3cd5];return _0x532e9f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 353a353..dad6ab1 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 _0x44e3=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceQueue','findAll','options','raw','where','limit','map','include','model','attributes','then','GetVoiceQueue','debug','ShowVoiceQueue'];(function(_0x198f7b,_0x2acdb8){var _0x48b989=function(_0x2a2fc8){while(--_0x2a2fc8){_0x198f7b['push'](_0x198f7b['shift']());}};_0x48b989(++_0x2acdb8);}(_0x44e3,0x1c8));var _0x344e=function(_0x517745,_0x35a2d6){_0x517745=_0x517745-0x0;var _0x8bcdbf=_0x44e3[_0x517745];return _0x8bcdbf;};'use strict';var _=require(_0x344e('0x0'));var util=require(_0x344e('0x1'));var moment=require(_0x344e('0x2'));var BPromise=require('bluebird');var rs=require(_0x344e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x344e('0x4'))['db'];var utils=require(_0x344e('0x5'));var logger=require(_0x344e('0x6'))(_0x344e('0x7'));var config=require(_0x344e('0x8'));var jayson=require(_0x344e('0x9'));var client=jayson[_0x344e('0xa')][_0x344e('0xb')]({'port':0x232a});config[_0x344e('0xc')]=_[_0x344e('0xd')](config['redis'],{'host':_0x344e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x344e('0xc')]));require(_0x344e('0xf'))['register'](socket);function respondWithRpcPromise(_0x57f369,_0x19eeee,_0x332ce3){return new BPromise(function(_0x4a3401,_0xd6b508){return client['request'](_0x57f369,_0x332ce3)['then'](function(_0x259e70){logger[_0x344e('0x10')](_0x344e('0x11'),_0x19eeee,_0x344e('0x12'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19eeee,_0x344e('0x12'),JSON[_0x344e('0x13')](_0x259e70));if(_0x259e70[_0x344e('0x14')]){if(_0x259e70['error'][_0x344e('0x15')]===0x1f4){logger[_0x344e('0x14')](_0x344e('0x11'),_0x19eeee,_0x259e70[_0x344e('0x14')][_0x344e('0x16')]);return _0xd6b508(_0x259e70[_0x344e('0x14')][_0x344e('0x16')]);}logger[_0x344e('0x14')](_0x344e('0x11'),_0x19eeee,_0x259e70[_0x344e('0x14')][_0x344e('0x16')]);return _0x4a3401(_0x259e70[_0x344e('0x14')][_0x344e('0x16')]);}else{logger[_0x344e('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x19eeee,_0x344e('0x12'));_0x4a3401(_0x259e70['result'][_0x344e('0x16')]);}})[_0x344e('0x17')](function(_0x1c45ac){logger[_0x344e('0x14')](_0x344e('0x11'),_0x19eeee,_0x1c45ac);_0xd6b508(_0x1c45ac);});});}exports['GetVoiceQueue']=function(_0x17d50f){var _0x495898=this;return new Promise(function(_0x485cbd,_0x1fa3b5){return db[_0x344e('0x18')][_0x344e('0x19')]({'raw':_0x17d50f[_0x344e('0x1a')]?_0x17d50f[_0x344e('0x1a')][_0x344e('0x1b')]===undefined?!![]:![]:!![],'where':_0x17d50f[_0x344e('0x1a')]?_0x17d50f[_0x344e('0x1a')][_0x344e('0x1c')]||null:null,'attributes':_0x17d50f[_0x344e('0x1a')]?_0x17d50f[_0x344e('0x1a')]['attributes']||null:null,'limit':_0x17d50f[_0x344e('0x1a')]?_0x17d50f['options'][_0x344e('0x1d')]||null:null,'include':_0x17d50f['options']?_0x17d50f[_0x344e('0x1a')]['include']?_[_0x344e('0x1e')](_0x17d50f[_0x344e('0x1a')][_0x344e('0x1f')],function(_0x48b087){return{'model':db[_0x48b087[_0x344e('0x20')]],'as':_0x48b087['as'],'attributes':_0x48b087[_0x344e('0x21')],'include':_0x48b087[_0x344e('0x1f')]?_[_0x344e('0x1e')](_0x48b087['include'],function(_0x27e84b){return{'model':db[_0x27e84b[_0x344e('0x20')]],'as':_0x27e84b['as'],'attributes':_0x27e84b[_0x344e('0x21')],'include':_0x27e84b[_0x344e('0x1f')]?_[_0x344e('0x1e')](_0x27e84b[_0x344e('0x1f')],function(_0x252783){return{'model':db[_0x252783[_0x344e('0x20')]],'as':_0x252783['as'],'attributes':_0x252783['attributes']};}):[]};}):[]};}):[]:[]})[_0x344e('0x22')](function(_0x4104cc){logger[_0x344e('0x10')](_0x344e('0x23'),_0x17d50f);logger[_0x344e('0x24')]('GetVoiceQueue',_0x17d50f,JSON[_0x344e('0x13')](_0x4104cc));_0x485cbd(_0x4104cc);})['catch'](function(_0x3ad2c5){logger[_0x344e('0x14')](_0x344e('0x23'),_0x3ad2c5[_0x344e('0x16')],_0x17d50f);_0x1fa3b5(_0x495898[_0x344e('0x14')](0x1f4,_0x3ad2c5[_0x344e('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x5748d8){var _0x2d9a67=this;return new Promise(function(_0x422474,_0x39d31e){return db[_0x344e('0x18')]['find']({'raw':_0x5748d8[_0x344e('0x1a')]?_0x5748d8[_0x344e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5748d8[_0x344e('0x1a')]?_0x5748d8[_0x344e('0x1a')]['where']||null:null,'attributes':_0x5748d8[_0x344e('0x1a')]?_0x5748d8['options'][_0x344e('0x21')]||null:null,'include':_0x5748d8['options']?_0x5748d8[_0x344e('0x1a')][_0x344e('0x1f')]?_[_0x344e('0x1e')](_0x5748d8[_0x344e('0x1a')]['include'],function(_0x5056a7){return{'model':db[_0x5056a7[_0x344e('0x20')]],'as':_0x5056a7['as'],'attributes':_0x5056a7['attributes'],'include':_0x5056a7['include']?_[_0x344e('0x1e')](_0x5056a7['include'],function(_0x4c77bb){return{'model':db[_0x4c77bb[_0x344e('0x20')]],'as':_0x4c77bb['as'],'attributes':_0x4c77bb[_0x344e('0x21')],'include':_0x4c77bb[_0x344e('0x1f')]?_[_0x344e('0x1e')](_0x4c77bb['include'],function(_0x5365a3){return{'model':db[_0x5365a3[_0x344e('0x20')]],'as':_0x5365a3['as'],'attributes':_0x5365a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x344e('0x22')](function(_0x4c97f9){logger[_0x344e('0x10')](_0x344e('0x25'),_0x5748d8);logger[_0x344e('0x24')](_0x344e('0x25'),_0x5748d8,JSON[_0x344e('0x13')](_0x4c97f9));_0x422474(_0x4c97f9);})[_0x344e('0x17')](function(_0x43818d){logger[_0x344e('0x14')](_0x344e('0x25'),_0x43818d[_0x344e('0x16')],_0x5748d8);_0x39d31e(_0x2d9a67[_0x344e('0x14')](0x1f4,_0x43818d[_0x344e('0x16')]));});});}; \ No newline at end of file +var _0x9d52=['client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','findAll','options','raw','include','map','model','attributes','GetVoiceQueue','debug','stringify','ShowVoiceQueue','VoiceQueue','find','where','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x126cf6,_0x2955b9){var _0x4f7c98=function(_0x5c13e1){while(--_0x5c13e1){_0x126cf6['push'](_0x126cf6['shift']());}};_0x4f7c98(++_0x2955b9);}(_0x9d52,0xbf));var _0x29d5=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x9d52[_0x5ba549];return _0x36e3a1;};'use strict';var _=require(_0x29d5('0x0'));var util=require(_0x29d5('0x1'));var moment=require(_0x29d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x29d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d5('0x4'))['db'];var utils=require(_0x29d5('0x5'));var logger=require(_0x29d5('0x6'))('rpc');var config=require(_0x29d5('0x7'));var jayson=require(_0x29d5('0x8'));var client=jayson[_0x29d5('0x9')][_0x29d5('0xa')]({'port':0x232a});config['redis']=_[_0x29d5('0xb')](config[_0x29d5('0xc')],{'host':_0x29d5('0xd'),'port':0x18eb});var socket=require(_0x29d5('0xe'))(new Redis(config[_0x29d5('0xc')]));require(_0x29d5('0xf'))[_0x29d5('0x10')](socket);function respondWithRpcPromise(_0x149840,_0x2d50e5,_0x9a2690){return new BPromise(function(_0x433a1a,_0x5848bc){return client['request'](_0x149840,_0x9a2690)['then'](function(_0x32a32d){logger['info'](_0x29d5('0x11'),_0x2d50e5,_0x29d5('0x12'));logger['debug'](_0x29d5('0x13'),_0x2d50e5,_0x29d5('0x12'),JSON['stringify'](_0x32a32d));if(_0x32a32d['error']){if(_0x32a32d[_0x29d5('0x14')]['code']===0x1f4){logger[_0x29d5('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2d50e5,_0x32a32d[_0x29d5('0x14')][_0x29d5('0x15')]);return _0x5848bc(_0x32a32d[_0x29d5('0x14')]['message']);}logger[_0x29d5('0x14')](_0x29d5('0x11'),_0x2d50e5,_0x32a32d['error'][_0x29d5('0x15')]);return _0x433a1a(_0x32a32d['error'][_0x29d5('0x15')]);}else{logger[_0x29d5('0x16')](_0x29d5('0x11'),_0x2d50e5,_0x29d5('0x12'));_0x433a1a(_0x32a32d[_0x29d5('0x17')]['message']);}})[_0x29d5('0x18')](function(_0x4f5686){logger[_0x29d5('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2d50e5,_0x4f5686);_0x5848bc(_0x4f5686);});});}exports['GetVoiceQueue']=function(_0x50162c){var _0x5cad5f=this;return new Promise(function(_0x5e9899,_0x14a949){return db['VoiceQueue'][_0x29d5('0x19')]({'raw':_0x50162c[_0x29d5('0x1a')]?_0x50162c['options'][_0x29d5('0x1b')]===undefined?!![]:![]:!![],'where':_0x50162c[_0x29d5('0x1a')]?_0x50162c[_0x29d5('0x1a')]['where']||null:null,'attributes':_0x50162c[_0x29d5('0x1a')]?_0x50162c['options']['attributes']||null:null,'limit':_0x50162c[_0x29d5('0x1a')]?_0x50162c['options']['limit']||null:null,'include':_0x50162c[_0x29d5('0x1a')]?_0x50162c[_0x29d5('0x1a')][_0x29d5('0x1c')]?_[_0x29d5('0x1d')](_0x50162c['options'][_0x29d5('0x1c')],function(_0x55bc30){return{'model':db[_0x55bc30[_0x29d5('0x1e')]],'as':_0x55bc30['as'],'attributes':_0x55bc30['attributes'],'include':_0x55bc30[_0x29d5('0x1c')]?_[_0x29d5('0x1d')](_0x55bc30['include'],function(_0x2afcae){return{'model':db[_0x2afcae['model']],'as':_0x2afcae['as'],'attributes':_0x2afcae[_0x29d5('0x1f')],'include':_0x2afcae[_0x29d5('0x1c')]?_[_0x29d5('0x1d')](_0x2afcae[_0x29d5('0x1c')],function(_0x554824){return{'model':db[_0x554824['model']],'as':_0x554824['as'],'attributes':_0x554824['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e0571){logger[_0x29d5('0x16')](_0x29d5('0x20'),_0x50162c);logger[_0x29d5('0x21')](_0x29d5('0x20'),_0x50162c,JSON[_0x29d5('0x22')](_0x4e0571));_0x5e9899(_0x4e0571);})[_0x29d5('0x18')](function(_0x34382e){logger['error'](_0x29d5('0x20'),_0x34382e[_0x29d5('0x15')],_0x50162c);_0x14a949(_0x5cad5f[_0x29d5('0x14')](0x1f4,_0x34382e[_0x29d5('0x15')]));});});};exports[_0x29d5('0x23')]=function(_0x3f9138){var _0x13ee82=this;return new Promise(function(_0x7fe3be,_0x1246cb){return db[_0x29d5('0x24')][_0x29d5('0x25')]({'raw':_0x3f9138[_0x29d5('0x1a')]?_0x3f9138[_0x29d5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9138[_0x29d5('0x1a')]?_0x3f9138[_0x29d5('0x1a')][_0x29d5('0x26')]||null:null,'attributes':_0x3f9138['options']?_0x3f9138[_0x29d5('0x1a')][_0x29d5('0x1f')]||null:null,'include':_0x3f9138[_0x29d5('0x1a')]?_0x3f9138[_0x29d5('0x1a')][_0x29d5('0x1c')]?_['map'](_0x3f9138['options'][_0x29d5('0x1c')],function(_0x47f4dd){return{'model':db[_0x47f4dd['model']],'as':_0x47f4dd['as'],'attributes':_0x47f4dd[_0x29d5('0x1f')],'include':_0x47f4dd[_0x29d5('0x1c')]?_[_0x29d5('0x1d')](_0x47f4dd['include'],function(_0x4c8ee){return{'model':db[_0x4c8ee[_0x29d5('0x1e')]],'as':_0x4c8ee['as'],'attributes':_0x4c8ee['attributes'],'include':_0x4c8ee['include']?_[_0x29d5('0x1d')](_0x4c8ee[_0x29d5('0x1c')],function(_0x53421f){return{'model':db[_0x53421f[_0x29d5('0x1e')]],'as':_0x53421f['as'],'attributes':_0x53421f[_0x29d5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x29d5('0x27')](function(_0x408dab){logger[_0x29d5('0x16')](_0x29d5('0x23'),_0x3f9138);logger['debug']('ShowVoiceQueue',_0x3f9138,JSON[_0x29d5('0x22')](_0x408dab));_0x7fe3be(_0x408dab);})[_0x29d5('0x18')](function(_0x9a2d60){logger[_0x29d5('0x14')](_0x29d5('0x23'),_0x9a2d60[_0x29d5('0x15')],_0x3f9138);_0x1246cb(_0x13ee82[_0x29d5('0x14')](0x1f4,_0x9a2d60[_0x29d5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6acc7d5..e32bf79 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 _0xd371=['length','./voiceQueue.events','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd371,0x146));var _0x1d37=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xd371[_0x3c2b2e];return _0x27a338;};'use strict';var VoiceQueueEvents=require(_0x1d37('0x0'));var events=['save','remove',_0x1d37('0x1')];function createListener(_0x257039,_0x139ea9){return function(_0x1fe3dc){_0x139ea9[_0x1d37('0x2')](_0x257039,_0x1fe3dc);};}function removeListener(_0x2fee38,_0x132e96){return function(){VoiceQueueEvents[_0x1d37('0x3')](_0x2fee38,_0x132e96);};}exports['register']=function(_0x12ca39){for(var _0x2c3995=0x0,_0x3bfd24=events[_0x1d37('0x4')];_0x2c3995<_0x3bfd24;_0x2c3995++){var _0x1bb143=events[_0x2c3995];var _0x38d2ed=createListener('voiceQueue:'+_0x1bb143,_0x12ca39);VoiceQueueEvents['on'](_0x1bb143,_0x38d2ed);}}; \ No newline at end of file +var _0x23ea=['./voiceQueue.events','save','remove','register','length'];(function(_0x1e5cf6,_0x3853b5){var _0x5d999c=function(_0x1d2f76){while(--_0x1d2f76){_0x1e5cf6['push'](_0x1e5cf6['shift']());}};_0x5d999c(++_0x3853b5);}(_0x23ea,0x1cc));var _0xa23e=function(_0x2afc4c,_0x9e22c7){_0x2afc4c=_0x2afc4c-0x0;var _0x28ab34=_0x23ea[_0x2afc4c];return _0x28ab34;};'use strict';var VoiceQueueEvents=require(_0xa23e('0x0'));var events=[_0xa23e('0x1'),_0xa23e('0x2'),'update'];function createListener(_0x857a9,_0x3f4a40){return function(_0x5d1639){_0x3f4a40['emit'](_0x857a9,_0x5d1639);};}function removeListener(_0x58760d,_0x221a44){return function(){VoiceQueueEvents['removeListener'](_0x58760d,_0x221a44);};}exports[_0xa23e('0x3')]=function(_0x47b099){for(var _0x33e0a5=0x0,_0x8fa183=events[_0xa23e('0x4')];_0x33e0a5<_0x8fa183;_0x33e0a5++){var _0x3aa3d5=events[_0x33e0a5];var _0xdb90eb=createListener('voiceQueue:'+_0x3aa3d5,_0x47b099);VoiceQueueEvents['on'](_0x3aa3d5,_0xdb90eb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8aae573..eee18ec 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 _0x4c41=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x3a14e9,_0x465052){var _0x5ca62d=function(_0x487702){while(--_0x487702){_0x3a14e9['push'](_0x3a14e9['shift']());}};_0x5ca62d(++_0x465052);}(_0x4c41,0x130));var _0x14c4=function(_0x5e6edc,_0x432410){_0x5e6edc=_0x5e6edc-0x0;var _0x2e08e3=_0x4c41[_0x5e6edc];return _0x2e08e3;};'use strict';var multer=require(_0x14c4('0x0'));var util=require(_0x14c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x14c4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x14c4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x14c4('0x4'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x14c4('0x5')](),controller[_0x14c4('0x6')]);router[_0x14c4('0x7')](_0x14c4('0x8'),auth[_0x14c4('0x5')](),controller[_0x14c4('0x9')]);router[_0x14c4('0x7')]('/index',auth[_0x14c4('0x5')](),controller[_0x14c4('0xa')]);router['get'](_0x14c4('0xb'),auth[_0x14c4('0x5')](),controller[_0x14c4('0xc')]);router[_0x14c4('0xd')]('/',auth[_0x14c4('0x5')](),controller[_0x14c4('0xe')]);router[_0x14c4('0xf')](_0x14c4('0xb'),auth[_0x14c4('0x5')](),controller[_0x14c4('0x10')]);router[_0x14c4('0x11')](_0x14c4('0xb'),auth[_0x14c4('0x5')](),controller[_0x14c4('0x12')]);module[_0x14c4('0x13')]=router; \ No newline at end of file +var _0x66f6=['update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x66f6,0xd5));var _0x666f=function(_0x400e7a,_0x3db85a){_0x400e7a=_0x400e7a-0x0;var _0x2ea080=_0x66f6[_0x400e7a];return _0x2ea080;};'use strict';var multer=require(_0x666f('0x0'));var util=require('util');var path=require(_0x666f('0x1'));var timeout=require(_0x666f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x666f('0x3'));var interaction=require(_0x666f('0x4'));var config=require(_0x666f('0x5'));var controller=require(_0x666f('0x6'));router[_0x666f('0x7')]('/',auth[_0x666f('0x8')](),controller[_0x666f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x666f('0xa')]);router[_0x666f('0x7')](_0x666f('0xb'),auth[_0x666f('0x8')](),controller[_0x666f('0xc')]);router[_0x666f('0x7')](_0x666f('0xd'),auth[_0x666f('0x8')](),controller[_0x666f('0xe')]);router[_0x666f('0xf')]('/',auth[_0x666f('0x8')](),controller[_0x666f('0x10')]);router[_0x666f('0x11')](_0x666f('0xd'),auth['isAuthenticated'](),controller[_0x666f('0x12')]);router['delete'](_0x666f('0xd'),auth[_0x666f('0x8')](),controller[_0x666f('0x13')]);module[_0x666f('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 aa2a189..896a643 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 _0x21c0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','INTEGER'];(function(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0x21c0,0x1a1));var _0x021c=function(_0x59048c,_0x5e4fef){_0x59048c=_0x59048c-0x0;var _0x1d4310=_0x21c0[_0x59048c];return _0x1d4310;};'use strict';var Sequelize=require(_0x021c('0x0'));var moment=require(_0x021c('0x1'));module[_0x021c('0x2')]={'type':{'type':Sequelize[_0x021c('0x3')]},'uniqueid':{'type':Sequelize[_0x021c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x021c('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x021c('0x4')],'set':function(_0x574716){var _0x3df5f5=moment(_0x574716);var _0x741bae=moment(this[_0x021c('0x5')](_0x021c('0x6')))[_0x021c('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x320265=_0x3df5f5[_0x021c('0x8')](_0x741bae,_0x021c('0x9'));this[_0x021c('0xa')](_0x021c('0xb'),_0x574716);this['setDataValue'](_0x021c('0xc'),_0x320265||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x021c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x021c('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x021c('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x021c('0xe')]},'channel':{'type':Sequelize[_0x021c('0x3')]},'connectedlinenum':{'type':Sequelize[_0x021c('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x021c('0x3')]},'exten':{'type':Sequelize[_0x021c('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x021c('0xe')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x021c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x021c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x021c('0x3')],'comment':_0x021c('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x021c('0x3')]},'disposition':{'type':Sequelize[_0x021c('0x3')]},'secondDisposition':{'type':Sequelize[_0x021c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x021c('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x021c('0xe')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb0e=['getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x5ec79c,_0x167eb8){var _0x3eb79e=function(_0x3493ad){while(--_0x3493ad){_0x5ec79c['push'](_0x5ec79c['shift']());}};_0x3eb79e(++_0x167eb8);}(_0xfb0e,0x1c6));var _0xefb0=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0xfb0e[_0x11309c];return _0x3fea9c;};'use strict';var Sequelize=require(_0xefb0('0x0'));var moment=require(_0xefb0('0x1'));module[_0xefb0('0x2')]={'type':{'type':Sequelize[_0xefb0('0x3')]},'uniqueid':{'type':Sequelize[_0xefb0('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xefb0('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xefb0('0x4')],'set':function(_0x4de2b0){var _0x14a706=moment(_0x4de2b0);var _0x448196=moment(this[_0xefb0('0x5')]('queuecallerjoinAt'))[_0xefb0('0x6')](_0xefb0('0x7'));var _0x224cd9=_0x14a706[_0xefb0('0x8')](_0x448196,_0xefb0('0x9'));this[_0xefb0('0xa')](_0xefb0('0xb'),_0x4de2b0);this[_0xefb0('0xa')](_0xefb0('0xc'),_0x224cd9||null);}},'position':{'type':Sequelize[_0xefb0('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xefb0('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xefb0('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xefb0('0x3')],'comment':_0xefb0('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xefb0('0x3')]},'connectedlinenum':{'type':Sequelize[_0xefb0('0x3')]},'connectedlinename':{'type':Sequelize[_0xefb0('0x3')]},'accountcode':{'type':Sequelize[_0xefb0('0x3')]},'context':{'type':Sequelize[_0xefb0('0x3')]},'exten':{'type':Sequelize[_0xefb0('0x3')]},'priority':{'type':Sequelize[_0xefb0('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xefb0('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xefb0('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xefb0('0x10')},'transferexten':{'type':Sequelize[_0xefb0('0x3')]},'transferuniqueid':{'type':Sequelize[_0xefb0('0x3')]},'disposition':{'type':Sequelize[_0xefb0('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xefb0('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xefb0('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a143fcc..de8b0c2 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 _0x7a13=['key','model','keys','intersection','query','fields','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','sendStatus','end','status','json','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x2f4baa,_0xb54486){var _0x52288f=function(_0x4671c2){while(--_0x4671c2){_0x2f4baa['push'](_0x2f4baa['shift']());}};_0x52288f(++_0xb54486);}(_0x7a13,0xc2));var _0x37a1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a13[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x37a1('0x0'));var rimraf=require(_0x37a1('0x1'));var zipdir=require(_0x37a1('0x2'));var jsonpatch=require(_0x37a1('0x3'));var rp=require(_0x37a1('0x4'));var moment=require(_0x37a1('0x5'));var BPromise=require(_0x37a1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x37a1('0x7'));var sox=require(_0x37a1('0x8'));var csv=require(_0x37a1('0x9'));var ejs=require(_0x37a1('0xa'));var fs=require('fs');var fs_extra=require(_0x37a1('0xb'));var _=require(_0x37a1('0xc'));var squel=require('squel');var crypto=require(_0x37a1('0xd'));var jsforce=require(_0x37a1('0xe'));var deskjs=require(_0x37a1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x37a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x37a1('0x11'));var authService=require(_0x37a1('0x12'));var qs=require(_0x37a1('0x13'));var as=require(_0x37a1('0x14'));var hardwareService=require(_0x37a1('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x37a1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x37a1('0x17'))['db'];config[_0x37a1('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x37a1('0x19'))(new Redis(config['redis']));require(_0x37a1('0x1a'))['register'](socket);function respondWithStatusCode(_0x11b1ab,_0x286710){_0x286710=_0x286710||0xcc;return function(_0x31dfbb){if(_0x31dfbb){return _0x11b1ab[_0x37a1('0x1b')](_0x286710);}return _0x11b1ab['status'](_0x286710)[_0x37a1('0x1c')]();};}function respondWithResult(_0x220293,_0x1e278e){_0x1e278e=_0x1e278e||0xc8;return function(_0x1baa83){if(_0x1baa83){return _0x220293[_0x37a1('0x1d')](_0x1e278e)[_0x37a1('0x1e')](_0x1baa83);}};}function respondWithFilteredResult(_0x2b76d6,_0x348fec){return function(_0x443631){if(_0x443631){var _0x3264b4=typeof _0x348fec['offset']==='undefined'&&typeof _0x348fec[_0x37a1('0x1f')]==='undefined';var _0x43a4aa=_0x443631[_0x37a1('0x20')];var _0x10a86b=_0x3264b4?0x0:_0x348fec['offset'];var _0x39dac8=_0x3264b4?_0x443631[_0x37a1('0x20')]:_0x348fec[_0x37a1('0x21')]+_0x348fec[_0x37a1('0x1f')];var _0x20d550;if(_0x39dac8>=_0x43a4aa){_0x39dac8=_0x43a4aa;_0x20d550=0xc8;}else{_0x20d550=0xce;}_0x2b76d6['status'](_0x20d550);return _0x2b76d6[_0x37a1('0x22')]('Content-Range',_0x10a86b+'-'+_0x39dac8+'/'+_0x43a4aa)[_0x37a1('0x1e')](_0x443631);}return null;};}function patchUpdates(_0x1b890a){return function(_0x3216bd){try{jsonpatch[_0x37a1('0x23')](_0x3216bd,_0x1b890a,!![]);}catch(_0x5afc87){return BPromise[_0x37a1('0x24')](_0x5afc87);}return _0x3216bd[_0x37a1('0x25')]();};}function saveUpdates(_0x297960,_0x291a00){return function(_0x26332a){if(_0x26332a){return _0x26332a[_0x37a1('0x26')](_0x297960)['then'](function(_0x5dd0b9){return _0x5dd0b9;});}return null;};}function removeEntity(_0x2c8a2e,_0x11a7b9){return function(_0x49d989){if(_0x49d989){return _0x49d989['destroy']()[_0x37a1('0x27')](function(){_0x2c8a2e[_0x37a1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe68ad,_0x46878d){return function(_0x404892){if(!_0x404892){_0xe68ad[_0x37a1('0x1b')](0x194);}return _0x404892;};}function handleError(_0x1b348e,_0xc251a){_0xc251a=_0xc251a||0x1f4;return function(_0xfc53ec){logger[_0x37a1('0x28')](_0xfc53ec[_0x37a1('0x29')]);if(_0xfc53ec[_0x37a1('0x2a')]){delete _0xfc53ec[_0x37a1('0x2a')];}_0x1b348e[_0x37a1('0x1d')](_0xc251a)[_0x37a1('0x2b')](_0xfc53ec);};}exports[_0x37a1('0x2c')]=function(_0x488756,_0x49b8eb){var _0x334aca={},_0x4b453b={},_0x32554b={'count':0x0,'rows':[]};var _0x491457=_[_0x37a1('0x2d')](db['VoiceQueueReport'][_0x37a1('0x2e')],function(_0x5af5f0){return{'name':_0x5af5f0[_0x37a1('0x2f')],'type':_0x5af5f0[_0x37a1('0x30')][_0x37a1('0x31')]};});_0x4b453b[_0x37a1('0x32')]=_[_0x37a1('0x2d')](_0x491457,_0x37a1('0x2a'));_0x4b453b['query']=_[_0x37a1('0x33')](_0x488756['query']);_0x4b453b['filters']=_[_0x37a1('0x34')](_0x4b453b[_0x37a1('0x32')],_0x4b453b[_0x37a1('0x35')]);_0x334aca['attributes']=_[_0x37a1('0x34')](_0x4b453b[_0x37a1('0x32')],qs[_0x37a1('0x36')](_0x488756['query'][_0x37a1('0x36')]));_0x334aca['attributes']=_0x334aca[_0x37a1('0x37')]['length']?_0x334aca[_0x37a1('0x37')]:_0x4b453b[_0x37a1('0x32')];if(!_0x488756['query']['hasOwnProperty'](_0x37a1('0x38'))){_0x334aca['limit']=qs[_0x37a1('0x1f')](_0x488756[_0x37a1('0x35')][_0x37a1('0x1f')]);_0x334aca[_0x37a1('0x21')]=qs[_0x37a1('0x21')](_0x488756[_0x37a1('0x35')][_0x37a1('0x21')]);}_0x334aca['order']=qs[_0x37a1('0x39')](_0x488756[_0x37a1('0x35')]['sort']);_0x334aca[_0x37a1('0x3a')]=qs[_0x37a1('0x3b')](_[_0x37a1('0x3c')](_0x488756[_0x37a1('0x35')],_0x4b453b[_0x37a1('0x3b')]),_0x491457);if(_0x488756['query'][_0x37a1('0x3d')]){_0x334aca[_0x37a1('0x3a')]=_[_0x37a1('0x3e')](_0x334aca[_0x37a1('0x3a')],{'$or':_[_0x37a1('0x2d')](_0x491457,function(_0xa02134){if(_0xa02134[_0x37a1('0x30')]!==_0x37a1('0x3f')){var _0x438831={};_0x438831[_0xa02134[_0x37a1('0x2a')]]={'$like':'%'+_0x488756[_0x37a1('0x35')]['filter']+'%'};return _0x438831;}})});}_0x334aca=_[_0x37a1('0x3e')]({},_0x334aca,_0x488756[_0x37a1('0x40')]);var _0x4522eb={'where':_0x334aca[_0x37a1('0x3a')]};return db[_0x37a1('0x41')][_0x37a1('0x20')](_0x4522eb)['then'](function(_0x3f3da0){_0x32554b[_0x37a1('0x20')]=_0x3f3da0;if(_0x488756['query'][_0x37a1('0x42')]){_0x334aca[_0x37a1('0x43')]=[{'all':!![]}];}return db[_0x37a1('0x41')][_0x37a1('0x44')](_0x334aca);})[_0x37a1('0x27')](function(_0x2df3ef){_0x32554b[_0x37a1('0x45')]=_0x2df3ef;return _0x32554b;})[_0x37a1('0x27')](respondWithFilteredResult(_0x49b8eb,_0x334aca))[_0x37a1('0x46')](handleError(_0x49b8eb,null));};exports[_0x37a1('0x47')]=function(_0x3e3dd6,_0x4f0fc5){var _0x4c462e={'raw':![],'where':{'id':_0x3e3dd6[_0x37a1('0x48')]['id']}},_0x28fc9b={};_0x28fc9b[_0x37a1('0x32')]=_[_0x37a1('0x33')](db[_0x37a1('0x41')]['rawAttributes']);_0x28fc9b[_0x37a1('0x35')]=_['keys'](_0x3e3dd6[_0x37a1('0x35')]);_0x28fc9b['filters']=_[_0x37a1('0x34')](_0x28fc9b['model'],_0x28fc9b[_0x37a1('0x35')]);_0x4c462e[_0x37a1('0x37')]=_[_0x37a1('0x34')](_0x28fc9b['model'],qs[_0x37a1('0x36')](_0x3e3dd6[_0x37a1('0x35')][_0x37a1('0x36')]));_0x4c462e['attributes']=_0x4c462e[_0x37a1('0x37')][_0x37a1('0x49')]?_0x4c462e[_0x37a1('0x37')]:_0x28fc9b['model'];if(_0x3e3dd6[_0x37a1('0x35')][_0x37a1('0x42')]){_0x4c462e[_0x37a1('0x43')]=[{'all':!![]}];}_0x4c462e=_[_0x37a1('0x3e')]({},_0x4c462e,_0x3e3dd6[_0x37a1('0x40')]);return db[_0x37a1('0x41')][_0x37a1('0x4a')](_0x4c462e)[_0x37a1('0x27')](handleEntityNotFound(_0x4f0fc5,null))['then'](respondWithResult(_0x4f0fc5,null))[_0x37a1('0x46')](handleError(_0x4f0fc5,null));};exports[_0x37a1('0x4b')]=function(_0x3b0311,_0x5545c3){return db[_0x37a1('0x41')][_0x37a1('0x4b')](_0x3b0311['body'],{})[_0x37a1('0x27')](respondWithResult(_0x5545c3,0xc9))[_0x37a1('0x46')](handleError(_0x5545c3,null));};exports['update']=function(_0x13d7d2,_0x5c2d3d){if(_0x13d7d2[_0x37a1('0x4c')]['id']){delete _0x13d7d2['body']['id'];}return db[_0x37a1('0x41')][_0x37a1('0x4a')]({'where':{'id':_0x13d7d2[_0x37a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c2d3d,null))[_0x37a1('0x27')](saveUpdates(_0x13d7d2['body'],null))[_0x37a1('0x27')](respondWithResult(_0x5c2d3d,null))[_0x37a1('0x46')](handleError(_0x5c2d3d,null));};exports[_0x37a1('0x4d')]=function(_0x15c1e6,_0xe98730){return db['VoiceQueueReport'][_0x37a1('0x4a')]({'where':{'id':_0x15c1e6[_0x37a1('0x48')]['id']}})['then'](handleEntityNotFound(_0xe98730,null))[_0x37a1('0x27')](removeEntity(_0xe98730,null))[_0x37a1('0x46')](handleError(_0xe98730,null));};exports['describe']=function(_0x4688f2,_0xfe2eb0){return db[_0x37a1('0x41')][_0x37a1('0x4e')]()[_0x37a1('0x27')](respondWithResult(_0xfe2eb0,null))['catch'](handleError(_0xfe2eb0,null));};exports[_0x37a1('0x4f')]=function(_0x302d26,_0x136379){var _0x549d79={},_0x1490a7={},_0x3ac62b={'count':0x0,'rows':[]};_0x1490a7['model']=_[_0x37a1('0x33')](db['VoiceQueueReport']['rawAttributes']);_0x1490a7[_0x37a1('0x35')]=_[_0x37a1('0x33')](_0x302d26['query']);_0x1490a7[_0x37a1('0x3b')]=_['intersection'](_0x1490a7[_0x37a1('0x32')],_0x1490a7[_0x37a1('0x35')]);_0x549d79['attributes']=_[_0x37a1('0x34')](_0x1490a7[_0x37a1('0x32')],qs[_0x37a1('0x36')](_0x302d26['query'][_0x37a1('0x36')]));_0x549d79['attributes']=_0x549d79['attributes'][_0x37a1('0x49')]?_0x549d79[_0x37a1('0x37')]:_0x1490a7[_0x37a1('0x32')];if(!_0x302d26[_0x37a1('0x35')][_0x37a1('0x50')](_0x37a1('0x38'))){_0x549d79['limit']=qs['limit'](_0x302d26[_0x37a1('0x35')][_0x37a1('0x1f')]);_0x549d79['offset']=qs[_0x37a1('0x21')](_0x302d26[_0x37a1('0x35')]['offset']);}_0x549d79['order']=qs[_0x37a1('0x39')](_0x302d26[_0x37a1('0x35')][_0x37a1('0x39')]);_0x549d79['where']=qs[_0x37a1('0x3b')](_['pick'](_0x302d26[_0x37a1('0x35')],_0x1490a7[_0x37a1('0x3b')]));if(_0x302d26[_0x37a1('0x35')]['filter']){_0x549d79[_0x37a1('0x3a')]=_['merge'](_0x549d79[_0x37a1('0x3a')],{'$or':_['map'](_0x549d79[_0x37a1('0x37')],function(_0x4dd8ff){var _0x48f3ca={};_0x48f3ca[_0x4dd8ff]={'$like':'%'+_0x302d26[_0x37a1('0x35')]['filter']+'%'};return _0x48f3ca;})});}_0x549d79=_['merge']({},_0x549d79,_0x302d26[_0x37a1('0x40')]);var _0x2d85e3={'where':_0x549d79[_0x37a1('0x3a')]};return db[_0x37a1('0x41')][_0x37a1('0x20')](_0x2d85e3)[_0x37a1('0x27')](function(_0x587c9e){_0x3ac62b[_0x37a1('0x20')]=_0x587c9e;if(_0x302d26[_0x37a1('0x35')][_0x37a1('0x42')]){_0x549d79[_0x37a1('0x43')]=[{'all':!![]}];}return db[_0x37a1('0x41')][_0x37a1('0x44')](_0x549d79);})['then'](function(_0x13befb){_0x3ac62b[_0x37a1('0x45')]=_0x13befb;return _0x3ac62b;})[_0x37a1('0x27')](respondWithFilteredResult(_0x136379,_0x549d79,'getVoiceQueuesReport'))[_0x37a1('0x46')](handleError(_0x136379,null,_0x37a1('0x4f')));}; \ No newline at end of file +var _0x7938=['defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','getVoiceQueuesReport','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x7938,0xdf));var _0x8793=function(_0x395098,_0x79e7a4){_0x395098=_0x395098-0x0;var _0x1aca9e=_0x7938[_0x395098];return _0x1aca9e;};'use strict';var emlformat=require(_0x8793('0x0'));var rimraf=require(_0x8793('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8793('0x2'));var rp=require(_0x8793('0x3'));var moment=require(_0x8793('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8793('0x5'));var util=require(_0x8793('0x6'));var path=require('path');var sox=require(_0x8793('0x7'));var csv=require(_0x8793('0x8'));var ejs=require(_0x8793('0x9'));var fs=require('fs');var fs_extra=require(_0x8793('0xa'));var _=require(_0x8793('0xb'));var squel=require(_0x8793('0xc'));var crypto=require(_0x8793('0xd'));var jsforce=require(_0x8793('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8793('0x8'));var querystring=require(_0x8793('0xf'));var Papa=require(_0x8793('0x10'));var Redis=require(_0x8793('0x11'));var authService=require(_0x8793('0x12'));var qs=require(_0x8793('0x13'));var as=require(_0x8793('0x14'));var hardwareService=require(_0x8793('0x15'));var logger=require(_0x8793('0x16'))(_0x8793('0x17'));var utils=require(_0x8793('0x18'));var config=require(_0x8793('0x19'));var licenseUtil=require(_0x8793('0x1a'));var db=require(_0x8793('0x1b'))['db'];config[_0x8793('0x1c')]=_[_0x8793('0x1d')](config[_0x8793('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8793('0x1e'))(new Redis(config[_0x8793('0x1c')]));require(_0x8793('0x1f'))[_0x8793('0x20')](socket);function respondWithStatusCode(_0x58c4ee,_0x90a618){_0x90a618=_0x90a618||0xcc;return function(_0x52f826){if(_0x52f826){return _0x58c4ee[_0x8793('0x21')](_0x90a618);}return _0x58c4ee[_0x8793('0x22')](_0x90a618)[_0x8793('0x23')]();};}function respondWithResult(_0x5e8ed1,_0x28d6ab){_0x28d6ab=_0x28d6ab||0xc8;return function(_0x5cef43){if(_0x5cef43){return _0x5e8ed1[_0x8793('0x22')](_0x28d6ab)[_0x8793('0x24')](_0x5cef43);}};}function respondWithFilteredResult(_0x2cf1d0,_0x5aabce){return function(_0x17427d){if(_0x17427d){var _0x4b3292=typeof _0x5aabce[_0x8793('0x25')]===_0x8793('0x26')&&typeof _0x5aabce[_0x8793('0x27')]===_0x8793('0x26');var _0x3d46f3=_0x17427d['count'];var _0x2e4d58=_0x4b3292?0x0:_0x5aabce['offset'];var _0x4d640b=_0x4b3292?_0x17427d[_0x8793('0x28')]:_0x5aabce[_0x8793('0x25')]+_0x5aabce[_0x8793('0x27')];var _0x548b18;if(_0x4d640b>=_0x3d46f3){_0x4d640b=_0x3d46f3;_0x548b18=0xc8;}else{_0x548b18=0xce;}_0x2cf1d0[_0x8793('0x22')](_0x548b18);return _0x2cf1d0[_0x8793('0x29')]('Content-Range',_0x2e4d58+'-'+_0x4d640b+'/'+_0x3d46f3)[_0x8793('0x24')](_0x17427d);}return null;};}function patchUpdates(_0x139f01){return function(_0x235dfd){try{jsonpatch[_0x8793('0x2a')](_0x235dfd,_0x139f01,!![]);}catch(_0x1374d8){return BPromise[_0x8793('0x2b')](_0x1374d8);}return _0x235dfd[_0x8793('0x2c')]();};}function saveUpdates(_0x365ad3,_0x323940){return function(_0x67ff8a){if(_0x67ff8a){return _0x67ff8a[_0x8793('0x2d')](_0x365ad3)[_0x8793('0x2e')](function(_0x5ce883){return _0x5ce883;});}return null;};}function removeEntity(_0x5be35c,_0x3b4750){return function(_0x10b24e){if(_0x10b24e){return _0x10b24e[_0x8793('0x2f')]()[_0x8793('0x2e')](function(){_0x5be35c[_0x8793('0x22')](0xcc)[_0x8793('0x23')]();});}};}function handleEntityNotFound(_0xaaf800,_0x5a389b){return function(_0x4a195d){if(!_0x4a195d){_0xaaf800[_0x8793('0x21')](0x194);}return _0x4a195d;};}function handleError(_0x3b97f5,_0x2f5853){_0x2f5853=_0x2f5853||0x1f4;return function(_0x255d5c){logger[_0x8793('0x30')](_0x255d5c['stack']);if(_0x255d5c['name']){delete _0x255d5c[_0x8793('0x31')];}_0x3b97f5[_0x8793('0x22')](_0x2f5853)[_0x8793('0x32')](_0x255d5c);};}exports['index']=function(_0x2c25d3,_0x1e2dc4){var _0x14e811={},_0x3bef4a={},_0x5e6443={'count':0x0,'rows':[]};var _0x7c5238=_[_0x8793('0x33')](db[_0x8793('0x34')][_0x8793('0x35')],function(_0x1f518c){return{'name':_0x1f518c[_0x8793('0x36')],'type':_0x1f518c['type'][_0x8793('0x37')]};});_0x3bef4a[_0x8793('0x38')]=_[_0x8793('0x33')](_0x7c5238,_0x8793('0x31'));_0x3bef4a[_0x8793('0x39')]=_[_0x8793('0x3a')](_0x2c25d3[_0x8793('0x39')]);_0x3bef4a[_0x8793('0x3b')]=_[_0x8793('0x3c')](_0x3bef4a[_0x8793('0x38')],_0x3bef4a['query']);_0x14e811[_0x8793('0x3d')]=_[_0x8793('0x3c')](_0x3bef4a['model'],qs['fields'](_0x2c25d3[_0x8793('0x39')]['fields']));_0x14e811[_0x8793('0x3d')]=_0x14e811[_0x8793('0x3d')][_0x8793('0x3e')]?_0x14e811['attributes']:_0x3bef4a['model'];if(!_0x2c25d3[_0x8793('0x39')][_0x8793('0x3f')](_0x8793('0x40'))){_0x14e811[_0x8793('0x27')]=qs[_0x8793('0x27')](_0x2c25d3[_0x8793('0x39')][_0x8793('0x27')]);_0x14e811[_0x8793('0x25')]=qs[_0x8793('0x25')](_0x2c25d3['query'][_0x8793('0x25')]);}_0x14e811[_0x8793('0x41')]=qs[_0x8793('0x42')](_0x2c25d3[_0x8793('0x39')][_0x8793('0x42')]);_0x14e811[_0x8793('0x43')]=qs['filters'](_['pick'](_0x2c25d3[_0x8793('0x39')],_0x3bef4a['filters']),_0x7c5238);if(_0x2c25d3[_0x8793('0x39')][_0x8793('0x44')]){_0x14e811[_0x8793('0x43')]=_[_0x8793('0x45')](_0x14e811[_0x8793('0x43')],{'$or':_['map'](_0x7c5238,function(_0x187642){if(_0x187642['type']!=='VIRTUAL'){var _0x456ec4={};_0x456ec4[_0x187642[_0x8793('0x31')]]={'$like':'%'+_0x2c25d3['query']['filter']+'%'};return _0x456ec4;}})});}_0x14e811=_[_0x8793('0x45')]({},_0x14e811,_0x2c25d3[_0x8793('0x46')]);var _0x4f4a0f={'where':_0x14e811[_0x8793('0x43')]};return db[_0x8793('0x34')]['count'](_0x4f4a0f)[_0x8793('0x2e')](function(_0x196c5e){_0x5e6443[_0x8793('0x28')]=_0x196c5e;if(_0x2c25d3['query'][_0x8793('0x47')]){_0x14e811[_0x8793('0x48')]=[{'all':!![]}];}return db[_0x8793('0x34')][_0x8793('0x49')](_0x14e811);})[_0x8793('0x2e')](function(_0xf67cae){_0x5e6443[_0x8793('0x4a')]=_0xf67cae;return _0x5e6443;})[_0x8793('0x2e')](respondWithFilteredResult(_0x1e2dc4,_0x14e811))[_0x8793('0x4b')](handleError(_0x1e2dc4,null));};exports[_0x8793('0x4c')]=function(_0x493c13,_0x261589){var _0x15b130={'raw':![],'where':{'id':_0x493c13[_0x8793('0x4d')]['id']}},_0x433c98={};_0x433c98[_0x8793('0x38')]=_[_0x8793('0x3a')](db['VoiceQueueReport'][_0x8793('0x35')]);_0x433c98[_0x8793('0x39')]=_[_0x8793('0x3a')](_0x493c13[_0x8793('0x39')]);_0x433c98[_0x8793('0x3b')]=_['intersection'](_0x433c98[_0x8793('0x38')],_0x433c98[_0x8793('0x39')]);_0x15b130[_0x8793('0x3d')]=_[_0x8793('0x3c')](_0x433c98[_0x8793('0x38')],qs['fields'](_0x493c13[_0x8793('0x39')]['fields']));_0x15b130[_0x8793('0x3d')]=_0x15b130[_0x8793('0x3d')][_0x8793('0x3e')]?_0x15b130[_0x8793('0x3d')]:_0x433c98[_0x8793('0x38')];if(_0x493c13['query'][_0x8793('0x47')]){_0x15b130[_0x8793('0x48')]=[{'all':!![]}];}_0x15b130=_[_0x8793('0x45')]({},_0x15b130,_0x493c13['options']);return db[_0x8793('0x34')]['find'](_0x15b130)[_0x8793('0x2e')](handleEntityNotFound(_0x261589,null))[_0x8793('0x2e')](respondWithResult(_0x261589,null))[_0x8793('0x4b')](handleError(_0x261589,null));};exports[_0x8793('0x4e')]=function(_0x17510e,_0x2145b0){return db[_0x8793('0x34')][_0x8793('0x4e')](_0x17510e['body'],{})['then'](respondWithResult(_0x2145b0,0xc9))[_0x8793('0x4b')](handleError(_0x2145b0,null));};exports[_0x8793('0x2d')]=function(_0x5f452e,_0x120cfa){if(_0x5f452e[_0x8793('0x4f')]['id']){delete _0x5f452e[_0x8793('0x4f')]['id'];}return db[_0x8793('0x34')][_0x8793('0x50')]({'where':{'id':_0x5f452e[_0x8793('0x4d')]['id']}})[_0x8793('0x2e')](handleEntityNotFound(_0x120cfa,null))['then'](saveUpdates(_0x5f452e[_0x8793('0x4f')],null))['then'](respondWithResult(_0x120cfa,null))['catch'](handleError(_0x120cfa,null));};exports[_0x8793('0x2f')]=function(_0x2dbaf1,_0x914810){return db[_0x8793('0x34')][_0x8793('0x50')]({'where':{'id':_0x2dbaf1[_0x8793('0x4d')]['id']}})[_0x8793('0x2e')](handleEntityNotFound(_0x914810,null))[_0x8793('0x2e')](removeEntity(_0x914810,null))[_0x8793('0x4b')](handleError(_0x914810,null));};exports[_0x8793('0x51')]=function(_0xf41850,_0x383edc){return db['VoiceQueueReport'][_0x8793('0x51')]()[_0x8793('0x2e')](respondWithResult(_0x383edc,null))[_0x8793('0x4b')](handleError(_0x383edc,null));};exports[_0x8793('0x52')]=function(_0xfa9f4f,_0x475bf9){var _0x23758c={},_0x3c2a4c={},_0x1df816={'count':0x0,'rows':[]};_0x3c2a4c[_0x8793('0x38')]=_[_0x8793('0x3a')](db['VoiceQueueReport'][_0x8793('0x35')]);_0x3c2a4c[_0x8793('0x39')]=_[_0x8793('0x3a')](_0xfa9f4f['query']);_0x3c2a4c[_0x8793('0x3b')]=_[_0x8793('0x3c')](_0x3c2a4c[_0x8793('0x38')],_0x3c2a4c[_0x8793('0x39')]);_0x23758c[_0x8793('0x3d')]=_[_0x8793('0x3c')](_0x3c2a4c[_0x8793('0x38')],qs['fields'](_0xfa9f4f[_0x8793('0x39')]['fields']));_0x23758c['attributes']=_0x23758c[_0x8793('0x3d')][_0x8793('0x3e')]?_0x23758c[_0x8793('0x3d')]:_0x3c2a4c[_0x8793('0x38')];if(!_0xfa9f4f[_0x8793('0x39')]['hasOwnProperty']('nolimit')){_0x23758c[_0x8793('0x27')]=qs[_0x8793('0x27')](_0xfa9f4f[_0x8793('0x39')][_0x8793('0x27')]);_0x23758c[_0x8793('0x25')]=qs['offset'](_0xfa9f4f[_0x8793('0x39')][_0x8793('0x25')]);}_0x23758c[_0x8793('0x41')]=qs[_0x8793('0x42')](_0xfa9f4f[_0x8793('0x39')]['sort']);_0x23758c[_0x8793('0x43')]=qs['filters'](_[_0x8793('0x53')](_0xfa9f4f[_0x8793('0x39')],_0x3c2a4c[_0x8793('0x3b')]));if(_0xfa9f4f[_0x8793('0x39')]['filter']){_0x23758c[_0x8793('0x43')]=_[_0x8793('0x45')](_0x23758c[_0x8793('0x43')],{'$or':_[_0x8793('0x33')](_0x23758c['attributes'],function(_0x158d5c){var _0x43c487={};_0x43c487[_0x158d5c]={'$like':'%'+_0xfa9f4f[_0x8793('0x39')][_0x8793('0x44')]+'%'};return _0x43c487;})});}_0x23758c=_[_0x8793('0x45')]({},_0x23758c,_0xfa9f4f[_0x8793('0x46')]);var _0xf30b67={'where':_0x23758c[_0x8793('0x43')]};return db[_0x8793('0x34')]['count'](_0xf30b67)[_0x8793('0x2e')](function(_0x5bd8d6){_0x1df816['count']=_0x5bd8d6;if(_0xfa9f4f['query']['includeAll']){_0x23758c[_0x8793('0x48')]=[{'all':!![]}];}return db[_0x8793('0x34')][_0x8793('0x49')](_0x23758c);})[_0x8793('0x2e')](function(_0x358e4e){_0x1df816['rows']=_0x358e4e;return _0x1df816;})['then'](respondWithFilteredResult(_0x475bf9,_0x23758c,_0x8793('0x52')))[_0x8793('0x4b')](handleError(_0x475bf9,null,_0x8793('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 099ea44..20e777c 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 _0xb4c0=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x4cd34a,_0x59b92b){var _0x1aea33=function(_0x1e4062){while(--_0x1e4062){_0x4cd34a['push'](_0x4cd34a['shift']());}};_0x1aea33(++_0x59b92b);}(_0xb4c0,0x72));var _0x0b4c=function(_0x185acc,_0x3121a5){_0x185acc=_0x185acc-0x0;var _0x100ed4=_0xb4c0[_0x185acc];return _0x100ed4;};'use strict';var EventEmitter=require(_0x0b4c('0x0'));var VoiceQueueReport=require(_0x0b4c('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0b4c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b4c('0x3')};function emitEvent(_0x4bd937){return function(_0x1ab50d,_0x387b22,_0x51ce91){VoiceQueueReportEvents[_0x0b4c('0x4')](_0x4bd937+':'+_0x1ab50d['id'],_0x1ab50d);VoiceQueueReportEvents[_0x0b4c('0x4')](_0x4bd937,_0x1ab50d);_0x51ce91(null);};}for(var e in events){if(events[_0x0b4c('0x5')](e)){var event=events[e];VoiceQueueReport[_0x0b4c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x427d=['update','emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x29233c,_0x2489b4){var _0x295aae=function(_0x1d2c95){while(--_0x1d2c95){_0x29233c['push'](_0x29233c['shift']());}};_0x295aae(++_0x2489b4);}(_0x427d,0x162));var _0xd427=function(_0x515c90,_0x57e0f2){_0x515c90=_0x515c90-0x0;var _0x2895b2=_0x427d[_0x515c90];return _0x2895b2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xd427('0x0'))['db'][_0xd427('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd427('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd427('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1c4d62){return function(_0x50fd3d,_0x1ed277,_0x46dacc){VoiceQueueReportEvents[_0xd427('0x4')](_0x1c4d62+':'+_0x50fd3d['id'],_0x50fd3d);VoiceQueueReportEvents[_0xd427('0x4')](_0x1c4d62,_0x50fd3d);_0x46dacc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xd427('0x5')](e,emitEvent(event));}}module[_0xd427('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 71659ca..dcb7896 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 _0xcea7=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcea7,0xd1));var _0x7cea=function(_0x35cd3f,_0x2e2edb){_0x35cd3f=_0x35cd3f-0x0;var _0x2eb50a=_0xcea7[_0x35cd3f];return _0x2eb50a;};'use strict';var _=require(_0x7cea('0x0'));var util=require(_0x7cea('0x1'));var logger=require(_0x7cea('0x2'))('api');var moment=require(_0x7cea('0x3'));var BPromise=require(_0x7cea('0x4'));var rp=require(_0x7cea('0x5'));var fs=require('fs');var path=require(_0x7cea('0x6'));var rimraf=require('rimraf');var config=require(_0x7cea('0x7'));var attributes=require(_0x7cea('0x8'));module[_0x7cea('0x9')]=function(_0x4d5b50,_0x4544f4){return _0x4d5b50['define'](_0x7cea('0xa'),attributes,{'tableName':_0x7cea('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7cea('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3cf=['path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xc3cf,0xf6));var _0xfc3c=function(_0x272ec0,_0x3a0a46){_0x272ec0=_0x272ec0-0x0;var _0x29a614=_0xc3cf[_0x272ec0];return _0x29a614;};'use strict';var _=require(_0xfc3c('0x0'));var util=require(_0xfc3c('0x1'));var logger=require(_0xfc3c('0x2'))(_0xfc3c('0x3'));var moment=require(_0xfc3c('0x4'));var BPromise=require(_0xfc3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc3c('0x6'));var rimraf=require(_0xfc3c('0x7'));var config=require('../../config/environment');var attributes=require(_0xfc3c('0x8'));module[_0xfc3c('0x9')]=function(_0x44d8b3,_0x143677){return _0x44d8b3[_0xfc3c('0xa')](_0xfc3c('0xb'),attributes,{'tableName':_0xfc3c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xfc3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c91cc1a..808e915 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 _0x835f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','update','lodash','util','moment'];(function(_0xbcdb86,_0x269b4a){var _0xf318f1=function(_0x300922){while(--_0x300922){_0xbcdb86['push'](_0xbcdb86['shift']());}};_0xf318f1(++_0x269b4a);}(_0x835f,0x81));var _0xf835=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x835f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xf835('0x0'));var util=require(_0xf835('0x1'));var moment=require(_0xf835('0x2'));var BPromise=require(_0xf835('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf835('0x4'));var db=require(_0xf835('0x5'))['db'];var utils=require(_0xf835('0x6'));var logger=require(_0xf835('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf835('0x8'));var client=jayson[_0xf835('0x9')][_0xf835('0xa')]({'port':0x232a});config[_0xf835('0xb')]=_[_0xf835('0xc')](config['redis'],{'host':_0xf835('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf835('0xb')]));require('./voiceQueueReport.socket')[_0xf835('0xe')](socket);function respondWithRpcPromise(_0x5f4875,_0x55bcfa,_0x517cd1){return new BPromise(function(_0x208df8,_0x34a5d6){return client[_0xf835('0xf')](_0x5f4875,_0x517cd1)[_0xf835('0x10')](function(_0x39a445){logger[_0xf835('0x11')](_0xf835('0x12'),_0x55bcfa,_0xf835('0x13'));logger['debug'](_0xf835('0x14'),_0x55bcfa,_0xf835('0x13'),JSON[_0xf835('0x15')](_0x39a445));if(_0x39a445[_0xf835('0x16')]){if(_0x39a445[_0xf835('0x16')][_0xf835('0x17')]===0x1f4){logger[_0xf835('0x16')](_0xf835('0x12'),_0x55bcfa,_0x39a445[_0xf835('0x16')][_0xf835('0x18')]);return _0x34a5d6(_0x39a445[_0xf835('0x16')][_0xf835('0x18')]);}logger[_0xf835('0x16')](_0xf835('0x12'),_0x55bcfa,_0x39a445['error']['message']);return _0x208df8(_0x39a445[_0xf835('0x16')][_0xf835('0x18')]);}else{logger[_0xf835('0x11')](_0xf835('0x12'),_0x55bcfa,_0xf835('0x13'));_0x208df8(_0x39a445[_0xf835('0x19')][_0xf835('0x18')]);}})[_0xf835('0x1a')](function(_0x227dfa){logger[_0xf835('0x16')](_0xf835('0x12'),_0x55bcfa,_0x227dfa);_0x34a5d6(_0x227dfa);});});}exports[_0xf835('0x1b')]=function(_0x2d3c87){var _0xf9875d=this;return new Promise(function(_0xa56a06,_0x4b00f2){return db[_0xf835('0x1c')][_0xf835('0x1d')]({'raw':_0x2d3c87[_0xf835('0x1e')]?_0x2d3c87[_0xf835('0x1e')][_0xf835('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d3c87[_0xf835('0x1e')]?_0x2d3c87[_0xf835('0x1e')][_0xf835('0x20')]||null:null,'attributes':_0x2d3c87[_0xf835('0x1e')]?_0x2d3c87[_0xf835('0x1e')][_0xf835('0x21')]||null:null,'limit':_0x2d3c87[_0xf835('0x1e')]?_0x2d3c87['options'][_0xf835('0x22')]||null:null,'include':_0x2d3c87['options']?_0x2d3c87[_0xf835('0x1e')][_0xf835('0x23')]?_[_0xf835('0x24')](_0x2d3c87[_0xf835('0x1e')][_0xf835('0x23')],function(_0x273303){return{'model':db[_0x273303[_0xf835('0x25')]],'as':_0x273303['as'],'attributes':_0x273303[_0xf835('0x21')],'include':_0x273303[_0xf835('0x23')]?_['map'](_0x273303[_0xf835('0x23')],function(_0x5bc1b6){return{'model':db[_0x5bc1b6['model']],'as':_0x5bc1b6['as'],'attributes':_0x5bc1b6[_0xf835('0x21')],'include':_0x5bc1b6[_0xf835('0x23')]?_[_0xf835('0x24')](_0x5bc1b6[_0xf835('0x23')],function(_0x4e1387){return{'model':db[_0x4e1387[_0xf835('0x25')]],'as':_0x4e1387['as'],'attributes':_0x4e1387[_0xf835('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf835('0x10')](function(_0x24a6cb){logger[_0xf835('0x11')](_0xf835('0x1b'),_0x2d3c87);logger['debug'](_0xf835('0x1b'),_0x2d3c87,JSON[_0xf835('0x15')](_0x24a6cb));_0xa56a06(_0x24a6cb);})[_0xf835('0x1a')](function(_0x15b419){logger['error']('GetVoiceQueueReport',_0x15b419[_0xf835('0x18')],_0x2d3c87);_0x4b00f2(_0xf9875d[_0xf835('0x16')](0x1f4,_0x15b419['message']));});});};exports[_0xf835('0x26')]=function(_0x4774d1){var _0x35c872=this;return new Promise(function(_0x2e4c5f,_0x187578){return db['VoiceQueueReport'][_0xf835('0x27')](_0x4774d1[_0xf835('0x28')],{'raw':_0x4774d1['options']?_0x4774d1[_0xf835('0x1e')][_0xf835('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3ee89c){logger[_0xf835('0x11')]('CreateVoiceQueueReport',_0x4774d1);logger[_0xf835('0x29')](_0xf835('0x26'),_0x4774d1,JSON['stringify'](_0x3ee89c));_0x2e4c5f(_0x3ee89c);})[_0xf835('0x1a')](function(_0x4774cf){logger[_0xf835('0x16')](_0xf835('0x26'),_0x4774cf[_0xf835('0x18')],_0x4774d1);_0x187578(_0x35c872[_0xf835('0x16')](0x1f4,_0x4774cf[_0xf835('0x18')]));});});};exports[_0xf835('0x2a')]=function(_0x22f76a){var _0x5c0749=this;return new Promise(function(_0x368dcc,_0x3b545b){return db['VoiceQueueReport'][_0xf835('0x2b')](_0x22f76a[_0xf835('0x28')],{'raw':_0x22f76a[_0xf835('0x1e')]?_0x22f76a[_0xf835('0x1e')][_0xf835('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f76a[_0xf835('0x1e')]?_0x22f76a['options']['where']||null:null,'attributes':_0x22f76a['options']?_0x22f76a[_0xf835('0x1e')][_0xf835('0x21')]||null:null,'limit':_0x22f76a[_0xf835('0x1e')]?_0x22f76a['options']['limit']||null:null})['then'](function(_0x476864){logger['info']('UpdateVoiceQueueReport',_0x22f76a);logger[_0xf835('0x29')](_0xf835('0x2a'),_0x22f76a,JSON[_0xf835('0x15')](_0x476864));_0x368dcc(_0x476864);})['catch'](function(_0x538c0a){logger[_0xf835('0x16')](_0xf835('0x2a'),_0x538c0a[_0xf835('0x18')],_0x22f76a);_0x3b545b(_0x5c0749[_0xf835('0x16')](0x1f4,_0x538c0a[_0xf835('0x18')]));});});}; \ No newline at end of file +var _0xbaec=['then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0xbaec,0xde));var _0xcbae=function(_0x4a6339,_0x30cd3a){_0x4a6339=_0x4a6339-0x0;var _0x5e9a19=_0xbaec[_0x4a6339];return _0x5e9a19;};'use strict';var _=require(_0xcbae('0x0'));var util=require(_0xcbae('0x1'));var moment=require(_0xcbae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbae('0x3'));var db=require(_0xcbae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcbae('0x5'));var jayson=require(_0xcbae('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xcbae('0x7')]=_[_0xcbae('0x8')](config['redis'],{'host':_0xcbae('0x9'),'port':0x18eb});var socket=require(_0xcbae('0xa'))(new Redis(config[_0xcbae('0x7')]));require(_0xcbae('0xb'))['register'](socket);function respondWithRpcPromise(_0x694d00,_0x541d59,_0x3ff4b8){return new BPromise(function(_0x2237c4,_0x1673e6){return client['request'](_0x694d00,_0x3ff4b8)[_0xcbae('0xc')](function(_0x10d88d){logger[_0xcbae('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x541d59,_0xcbae('0xe'));logger[_0xcbae('0xf')](_0xcbae('0x10'),_0x541d59,_0xcbae('0xe'),JSON[_0xcbae('0x11')](_0x10d88d));if(_0x10d88d['error']){if(_0x10d88d[_0xcbae('0x12')][_0xcbae('0x13')]===0x1f4){logger['error'](_0xcbae('0x14'),_0x541d59,_0x10d88d['error'][_0xcbae('0x15')]);return _0x1673e6(_0x10d88d[_0xcbae('0x12')][_0xcbae('0x15')]);}logger[_0xcbae('0x12')](_0xcbae('0x14'),_0x541d59,_0x10d88d[_0xcbae('0x12')][_0xcbae('0x15')]);return _0x2237c4(_0x10d88d[_0xcbae('0x12')][_0xcbae('0x15')]);}else{logger['info'](_0xcbae('0x14'),_0x541d59,_0xcbae('0xe'));_0x2237c4(_0x10d88d[_0xcbae('0x16')]['message']);}})['catch'](function(_0x15aecf){logger[_0xcbae('0x12')](_0xcbae('0x14'),_0x541d59,_0x15aecf);_0x1673e6(_0x15aecf);});});}exports[_0xcbae('0x17')]=function(_0x5c401a){var _0xbec164=this;return new Promise(function(_0x3860ba,_0x230432){return db[_0xcbae('0x18')]['findAll']({'raw':_0x5c401a['options']?_0x5c401a[_0xcbae('0x19')][_0xcbae('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c401a['options']?_0x5c401a[_0xcbae('0x19')][_0xcbae('0x1b')]||null:null,'attributes':_0x5c401a[_0xcbae('0x19')]?_0x5c401a[_0xcbae('0x19')][_0xcbae('0x1c')]||null:null,'limit':_0x5c401a[_0xcbae('0x19')]?_0x5c401a[_0xcbae('0x19')][_0xcbae('0x1d')]||null:null,'include':_0x5c401a[_0xcbae('0x19')]?_0x5c401a[_0xcbae('0x19')][_0xcbae('0x1e')]?_[_0xcbae('0x1f')](_0x5c401a['options']['include'],function(_0x9e5de){return{'model':db[_0x9e5de[_0xcbae('0x20')]],'as':_0x9e5de['as'],'attributes':_0x9e5de[_0xcbae('0x1c')],'include':_0x9e5de[_0xcbae('0x1e')]?_[_0xcbae('0x1f')](_0x9e5de[_0xcbae('0x1e')],function(_0x42bc14){return{'model':db[_0x42bc14[_0xcbae('0x20')]],'as':_0x42bc14['as'],'attributes':_0x42bc14[_0xcbae('0x1c')],'include':_0x42bc14[_0xcbae('0x1e')]?_[_0xcbae('0x1f')](_0x42bc14['include'],function(_0x25b94a){return{'model':db[_0x25b94a[_0xcbae('0x20')]],'as':_0x25b94a['as'],'attributes':_0x25b94a[_0xcbae('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x320090){logger['info'](_0xcbae('0x17'),_0x5c401a);logger[_0xcbae('0xf')](_0xcbae('0x17'),_0x5c401a,JSON[_0xcbae('0x11')](_0x320090));_0x3860ba(_0x320090);})[_0xcbae('0x21')](function(_0x3503af){logger[_0xcbae('0x12')]('GetVoiceQueueReport',_0x3503af['message'],_0x5c401a);_0x230432(_0xbec164[_0xcbae('0x12')](0x1f4,_0x3503af[_0xcbae('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x3c4987){var _0x3766de=this;return new Promise(function(_0x17f295,_0x5033b3){return db[_0xcbae('0x18')][_0xcbae('0x22')](_0x3c4987[_0xcbae('0x23')],{'raw':_0x3c4987[_0xcbae('0x19')]?_0x3c4987['options'][_0xcbae('0x1a')]===undefined?!![]:![]:!![]})[_0xcbae('0xc')](function(_0x14abf4){logger['info'](_0xcbae('0x24'),_0x3c4987);logger['debug'](_0xcbae('0x24'),_0x3c4987,JSON[_0xcbae('0x11')](_0x14abf4));_0x17f295(_0x14abf4);})[_0xcbae('0x21')](function(_0x43762b){logger['error']('CreateVoiceQueueReport',_0x43762b['message'],_0x3c4987);_0x5033b3(_0x3766de[_0xcbae('0x12')](0x1f4,_0x43762b['message']));});});};exports[_0xcbae('0x25')]=function(_0x38ff5c){var _0x48624d=this;return new Promise(function(_0x2e9f43,_0x4cfecf){return db[_0xcbae('0x18')][_0xcbae('0x26')](_0x38ff5c[_0xcbae('0x23')],{'raw':_0x38ff5c['options']?_0x38ff5c[_0xcbae('0x19')][_0xcbae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38ff5c[_0xcbae('0x19')]?_0x38ff5c[_0xcbae('0x19')][_0xcbae('0x1b')]||null:null,'attributes':_0x38ff5c[_0xcbae('0x19')]?_0x38ff5c[_0xcbae('0x19')][_0xcbae('0x1c')]||null:null,'limit':_0x38ff5c[_0xcbae('0x19')]?_0x38ff5c[_0xcbae('0x19')][_0xcbae('0x1d')]||null:null})['then'](function(_0x45d80d){logger['info'](_0xcbae('0x25'),_0x38ff5c);logger[_0xcbae('0xf')](_0xcbae('0x25'),_0x38ff5c,JSON[_0xcbae('0x11')](_0x45d80d));_0x2e9f43(_0x45d80d);})[_0xcbae('0x21')](function(_0x581b3a){logger[_0xcbae('0x12')](_0xcbae('0x25'),_0x581b3a['message'],_0x38ff5c);_0x4cfecf(_0x48624d[_0xcbae('0x12')](0x1f4,_0x581b3a[_0xcbae('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6901ed2..a94612c 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 _0xdcf6=['update','emit','removeListener','save','remove'];(function(_0x57595d,_0x218f07){var _0x5004d3=function(_0x494388){while(--_0x494388){_0x57595d['push'](_0x57595d['shift']());}};_0x5004d3(++_0x218f07);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0xdcf6[_0x3efe9b];return _0x132073;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x6dcf('0x0'),_0x6dcf('0x1'),_0x6dcf('0x2')];function createListener(_0x4402e7,_0x34db3b){return function(_0x17056c){_0x34db3b[_0x6dcf('0x3')](_0x4402e7,_0x17056c);};}function removeListener(_0x513bcb,_0x69f442){return function(){VoiceQueueReportEvents[_0x6dcf('0x4')](_0x513bcb,_0x69f442);};}exports['register']=function(_0x1ff8b6){for(var _0x3364bd=0x0,_0x5abd79=events['length'];_0x3364bd<_0x5abd79;_0x3364bd++){var _0x5766db=events[_0x3364bd];var _0x34517a=createListener('voiceQueueReport:'+_0x5766db,_0x1ff8b6);VoiceQueueReportEvents['on'](_0x5766db,_0x34517a);}}; \ No newline at end of file +var _0xba6c=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba6c,0x113));var _0xcba6=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xba6c[_0x2d4421];return _0x2d3b01;};'use strict';var VoiceQueueReportEvents=require(_0xcba6('0x0'));var events=['save',_0xcba6('0x1'),_0xcba6('0x2')];function createListener(_0x1994bd,_0x20b811){return function(_0x3030b5){_0x20b811[_0xcba6('0x3')](_0x1994bd,_0x3030b5);};}function removeListener(_0x2b34a3,_0x5c911d){return function(){VoiceQueueReportEvents['removeListener'](_0x2b34a3,_0x5c911d);};}exports[_0xcba6('0x4')]=function(_0x1fd901){for(var _0x34d35d=0x0,_0x137300=events[_0xcba6('0x5')];_0x34d35d<_0x137300;_0x34d35d++){var _0x95c2f1=events[_0x34d35d];var _0x308366=createListener(_0xcba6('0x6')+_0x95c2f1,_0x1fd901);VoiceQueueReportEvents['on'](_0x95c2f1,_0x308366);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index bb355d3..8b0a9f2 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 _0xcd0a=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x4cd359,_0x1c1611){var _0x4b7e31=function(_0x536fb6){while(--_0x536fb6){_0x4cd359['push'](_0x4cd359['shift']());}};_0x4b7e31(++_0x1c1611);}(_0xcd0a,0xee));var _0xacd0=function(_0x14e69c,_0x54adb5){_0x14e69c=_0x14e69c-0x0;var _0x459b97=_0xcd0a[_0x14e69c];return _0x459b97;};'use strict';var multer=require(_0xacd0('0x0'));var util=require(_0xacd0('0x1'));var path=require(_0xacd0('0x2'));var timeout=require(_0xacd0('0x3'));var express=require(_0xacd0('0x4'));var router=express[_0xacd0('0x5')]();var fs_extra=require(_0xacd0('0x6'));var auth=require(_0xacd0('0x7'));var interaction=require(_0xacd0('0x8'));var config=require(_0xacd0('0x9'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xacd0('0xa')]);router[_0xacd0('0xb')](_0xacd0('0xc'),auth[_0xacd0('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xacd0('0xe')](_0xacd0('0xc'),auth[_0xacd0('0xd')](),controller[_0xacd0('0xf')]);router['delete'](_0xacd0('0xc'),auth[_0xacd0('0xd')](),controller[_0xacd0('0x10')]);module[_0xacd0('0x11')]=router; \ No newline at end of file +var _0xb3ea=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','create','/:id','destroy','exports','multer'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xb3ea,0x10d));var _0xab3e=function(_0x382e7b,_0x3fc5ac){_0x382e7b=_0x382e7b-0x0;var _0x5ecdd3=_0xb3ea[_0x382e7b];return _0x5ecdd3;};'use strict';var multer=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var path=require(_0xab3e('0x2'));var timeout=require('connect-timeout');var express=require(_0xab3e('0x3'));var router=express['Router']();var fs_extra=require(_0xab3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var controller=require(_0xab3e('0x7'));router[_0xab3e('0x8')]('/',auth[_0xab3e('0x9')](),controller['index']);router[_0xab3e('0x8')]('/:id',auth[_0xab3e('0x9')](),controller[_0xab3e('0xa')]);router['post']('/',auth[_0xab3e('0x9')](),controller[_0xab3e('0xb')]);router['put'](_0xab3e('0xc'),auth[_0xab3e('0x9')](),controller['update']);router['delete'](_0xab3e('0xc'),auth[_0xab3e('0x9')](),controller[_0xab3e('0xd')]);module[_0xab3e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 47c1692..b3ac976 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 _0x73c5=['exports','STRING','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x16d202,_0x5e460d){var _0x267959=function(_0x47f2f1){while(--_0x47f2f1){_0x16d202['push'](_0x16d202['shift']());}};_0x267959(++_0x5e460d);}(_0x73c5,0x197));var _0x573c=function(_0x5bae14,_0xd973a8){_0x5bae14=_0x5bae14-0x0;var _0x22f2b0=_0x73c5[_0x5bae14];return _0x22f2b0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x573c('0x0'));module[_0x573c('0x1')]={'time':{'type':Sequelize[_0x573c('0x2')]},'callid':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x573c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x573c('0x3'))}}; \ No newline at end of file +var _0x9bd9=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x32960c,_0x491736){_0x32960c=_0x32960c-0x0;var _0x10d449=_0x9bd9[_0x32960c];return _0x10d449;};'use strict';var Sequelize=require(_0x99bd('0x0'));var moment=require(_0x99bd('0x1'));module[_0x99bd('0x2')]={'time':{'type':Sequelize[_0x99bd('0x3')]},'callid':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x99bd('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x99bd('0x4')],'allowNull':![],'defaultValue':moment()[_0x99bd('0x5')](_0x99bd('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 623d69e..2a020cc 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 _0x232b=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x13adec,_0x4c3502){var _0x4561cb=function(_0x2754b0){while(--_0x2754b0){_0x13adec['push'](_0x13adec['shift']());}};_0x4561cb(++_0x4c3502);}(_0x232b,0x1d8));var _0xb232=function(_0x3b5819,_0x3d7caf){_0x3b5819=_0x3b5819-0x0;var _0x13c387=_0x232b[_0x3b5819];return _0x13c387;};'use strict';var emlformat=require(_0xb232('0x0'));var rimraf=require(_0xb232('0x1'));var zipdir=require(_0xb232('0x2'));var jsonpatch=require(_0xb232('0x3'));var rp=require(_0xb232('0x4'));var moment=require(_0xb232('0x5'));var BPromise=require(_0xb232('0x6'));var Mustache=require('mustache');var util=require(_0xb232('0x7'));var path=require(_0xb232('0x8'));var sox=require(_0xb232('0x9'));var csv=require(_0xb232('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb232('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb232('0xc'));var jsforce=require(_0xb232('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb232('0xa'));var querystring=require(_0xb232('0xe'));var Papa=require(_0xb232('0xf'));var Redis=require(_0xb232('0x10'));var authService=require(_0xb232('0x11'));var qs=require(_0xb232('0x12'));var as=require(_0xb232('0x13'));var hardwareService=require(_0xb232('0x14'));var logger=require('../../config/logger')(_0xb232('0x15'));var utils=require('../../config/utils');var config=require(_0xb232('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f4765,_0x5c987a){_0x5c987a=_0x5c987a||0xcc;return function(_0x580cb8){if(_0x580cb8){return _0x4f4765[_0xb232('0x17')](_0x5c987a);}return _0x4f4765['status'](_0x5c987a)[_0xb232('0x18')]();};}function respondWithResult(_0x226f7f,_0x4af295){_0x4af295=_0x4af295||0xc8;return function(_0x35539d){if(_0x35539d){return _0x226f7f[_0xb232('0x19')](_0x4af295)[_0xb232('0x1a')](_0x35539d);}};}function respondWithFilteredResult(_0x2840d5,_0x4d7502){return function(_0x2db449){if(_0x2db449){var _0x5858ec=typeof _0x4d7502[_0xb232('0x1b')]===_0xb232('0x1c')&&typeof _0x4d7502[_0xb232('0x1d')]===_0xb232('0x1c');var _0x333cd8=_0x2db449[_0xb232('0x1e')];var _0x50b785=_0x5858ec?0x0:_0x4d7502['offset'];var _0xe827a4=_0x5858ec?_0x2db449[_0xb232('0x1e')]:_0x4d7502[_0xb232('0x1b')]+_0x4d7502[_0xb232('0x1d')];var _0x873433;if(_0xe827a4>=_0x333cd8){_0xe827a4=_0x333cd8;_0x873433=0xc8;}else{_0x873433=0xce;}_0x2840d5[_0xb232('0x19')](_0x873433);return _0x2840d5[_0xb232('0x1f')](_0xb232('0x20'),_0x50b785+'-'+_0xe827a4+'/'+_0x333cd8)[_0xb232('0x1a')](_0x2db449);}return null;};}function patchUpdates(_0x377ddf){return function(_0xa5cf2e){try{jsonpatch[_0xb232('0x21')](_0xa5cf2e,_0x377ddf,!![]);}catch(_0x2568f5){return BPromise['reject'](_0x2568f5);}return _0xa5cf2e[_0xb232('0x22')]();};}function saveUpdates(_0x29772e,_0xfad858){return function(_0x589546){if(_0x589546){return _0x589546['update'](_0x29772e)[_0xb232('0x23')](function(_0x2dcaf3){return _0x2dcaf3;});}return null;};}function removeEntity(_0x5553e5,_0x209ad6){return function(_0x142e67){if(_0x142e67){return _0x142e67[_0xb232('0x24')]()[_0xb232('0x23')](function(){_0x5553e5[_0xb232('0x19')](0xcc)[_0xb232('0x18')]();});}};}function handleEntityNotFound(_0x34f65d,_0x442e46){return function(_0x2afece){if(!_0x2afece){_0x34f65d['sendStatus'](0x194);}return _0x2afece;};}function handleError(_0x4e5c51,_0x5a4c10){_0x5a4c10=_0x5a4c10||0x1f4;return function(_0x47ae95){logger[_0xb232('0x25')](_0x47ae95[_0xb232('0x26')]);if(_0x47ae95[_0xb232('0x27')]){delete _0x47ae95[_0xb232('0x27')];}_0x4e5c51[_0xb232('0x19')](_0x5a4c10)[_0xb232('0x28')](_0x47ae95);};}exports[_0xb232('0x29')]=function(_0xe0ae07,_0x598614){var _0x5a13b3={},_0x56af87={},_0x4d8ded={'count':0x0,'rows':[]};var _0x1aa3d5=_[_0xb232('0x2a')](db[_0xb232('0x2b')][_0xb232('0x2c')],function(_0x4f20fd){return{'name':_0x4f20fd[_0xb232('0x2d')],'type':_0x4f20fd[_0xb232('0x2e')]['key']};});_0x56af87[_0xb232('0x2f')]=_[_0xb232('0x2a')](_0x1aa3d5,_0xb232('0x27'));_0x56af87['query']=_[_0xb232('0x30')](_0xe0ae07[_0xb232('0x31')]);_0x56af87[_0xb232('0x32')]=_[_0xb232('0x33')](_0x56af87[_0xb232('0x2f')],_0x56af87['query']);_0x5a13b3[_0xb232('0x34')]=_['intersection'](_0x56af87[_0xb232('0x2f')],qs[_0xb232('0x35')](_0xe0ae07[_0xb232('0x31')][_0xb232('0x35')]));_0x5a13b3[_0xb232('0x34')]=_0x5a13b3[_0xb232('0x34')][_0xb232('0x36')]?_0x5a13b3[_0xb232('0x34')]:_0x56af87['model'];if(!_0xe0ae07['query'][_0xb232('0x37')](_0xb232('0x38'))){_0x5a13b3[_0xb232('0x1d')]=qs[_0xb232('0x1d')](_0xe0ae07['query']['limit']);_0x5a13b3[_0xb232('0x1b')]=qs['offset'](_0xe0ae07[_0xb232('0x31')][_0xb232('0x1b')]);}_0x5a13b3[_0xb232('0x39')]=qs['sort'](_0xe0ae07[_0xb232('0x31')][_0xb232('0x3a')]);_0x5a13b3[_0xb232('0x3b')]=qs[_0xb232('0x32')](_[_0xb232('0x3c')](_0xe0ae07[_0xb232('0x31')],_0x56af87['filters']),_0x1aa3d5);if(_0xe0ae07['query'][_0xb232('0x3d')]){_0x5a13b3[_0xb232('0x3b')]=_[_0xb232('0x3e')](_0x5a13b3[_0xb232('0x3b')],{'$or':_['map'](_0x1aa3d5,function(_0x49083b){if(_0x49083b['type']!=='VIRTUAL'){var _0x5b4f68={};_0x5b4f68[_0x49083b['name']]={'$like':'%'+_0xe0ae07[_0xb232('0x31')]['filter']+'%'};return _0x5b4f68;}})});}_0x5a13b3=_[_0xb232('0x3e')]({},_0x5a13b3,_0xe0ae07[_0xb232('0x3f')]);var _0x49b2bf={'where':_0x5a13b3[_0xb232('0x3b')]};return db[_0xb232('0x2b')]['count'](_0x49b2bf)[_0xb232('0x23')](function(_0x1e5a62){_0x4d8ded[_0xb232('0x1e')]=_0x1e5a62;if(_0xe0ae07[_0xb232('0x31')][_0xb232('0x40')]){_0x5a13b3[_0xb232('0x41')]=[{'all':!![]}];}return db[_0xb232('0x2b')][_0xb232('0x42')](_0x5a13b3);})[_0xb232('0x23')](function(_0x3ecbdb){_0x4d8ded[_0xb232('0x43')]=_0x3ecbdb;return _0x4d8ded;})[_0xb232('0x23')](respondWithFilteredResult(_0x598614,_0x5a13b3))[_0xb232('0x44')](handleError(_0x598614,null));};exports[_0xb232('0x45')]=function(_0x45dcb6,_0x16a7f8){var _0x2f8c7d={'raw':!![],'where':{'id':_0x45dcb6[_0xb232('0x46')]['id']}},_0x22f030={};_0x22f030[_0xb232('0x2f')]=_[_0xb232('0x30')](db['VoiceQueuesLog'][_0xb232('0x2c')]);_0x22f030[_0xb232('0x31')]=_['keys'](_0x45dcb6[_0xb232('0x31')]);_0x22f030[_0xb232('0x32')]=_[_0xb232('0x33')](_0x22f030[_0xb232('0x2f')],_0x22f030[_0xb232('0x31')]);_0x2f8c7d[_0xb232('0x34')]=_['intersection'](_0x22f030[_0xb232('0x2f')],qs[_0xb232('0x35')](_0x45dcb6[_0xb232('0x31')][_0xb232('0x35')]));_0x2f8c7d[_0xb232('0x34')]=_0x2f8c7d['attributes'][_0xb232('0x36')]?_0x2f8c7d['attributes']:_0x22f030[_0xb232('0x2f')];if(_0x45dcb6[_0xb232('0x31')][_0xb232('0x40')]){_0x2f8c7d[_0xb232('0x41')]=[{'all':!![]}];}_0x2f8c7d=_[_0xb232('0x3e')]({},_0x2f8c7d,_0x45dcb6[_0xb232('0x3f')]);return db[_0xb232('0x2b')]['find'](_0x2f8c7d)['then'](handleEntityNotFound(_0x16a7f8,null))['then'](respondWithResult(_0x16a7f8,null))[_0xb232('0x44')](handleError(_0x16a7f8,null));};exports[_0xb232('0x47')]=function(_0x5e72bf,_0x519e49){return db[_0xb232('0x2b')][_0xb232('0x47')](_0x5e72bf['body'],{})[_0xb232('0x23')](respondWithResult(_0x519e49,0xc9))['catch'](handleError(_0x519e49,null));};exports[_0xb232('0x48')]=function(_0x33d037,_0x1ee768){if(_0x33d037[_0xb232('0x49')]['id']){delete _0x33d037[_0xb232('0x49')]['id'];}return db[_0xb232('0x2b')][_0xb232('0x4a')]({'where':{'id':_0x33d037['params']['id']}})[_0xb232('0x23')](handleEntityNotFound(_0x1ee768,null))['then'](saveUpdates(_0x33d037[_0xb232('0x49')],null))[_0xb232('0x23')](respondWithResult(_0x1ee768,null))[_0xb232('0x44')](handleError(_0x1ee768,null));};exports[_0xb232('0x24')]=function(_0x106207,_0x104574){return db[_0xb232('0x2b')][_0xb232('0x4a')]({'where':{'id':_0x106207[_0xb232('0x46')]['id']}})[_0xb232('0x23')](handleEntityNotFound(_0x104574,null))[_0xb232('0x23')](removeEntity(_0x104574,null))['catch'](handleError(_0x104574,null));}; \ No newline at end of file +var _0xea95=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','length','options','find','catch','create','body','destroy','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','VoiceQueuesLog','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0xea95,0xef));var _0x5ea9=function(_0x53fc5b,_0xa5f41){_0x53fc5b=_0x53fc5b-0x0;var _0x1b3370=_0xea95[_0x53fc5b];return _0x1b3370;};'use strict';var emlformat=require(_0x5ea9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ea9('0x1'));var moment=require(_0x5ea9('0x2'));var BPromise=require(_0x5ea9('0x3'));var Mustache=require(_0x5ea9('0x4'));var util=require('util');var path=require(_0x5ea9('0x5'));var sox=require('sox');var csv=require(_0x5ea9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ea9('0x7'));var squel=require(_0x5ea9('0x8'));var crypto=require(_0x5ea9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5ea9('0xa'));var toCsv=require(_0x5ea9('0x6'));var querystring=require('querystring');var Papa=require(_0x5ea9('0xb'));var Redis=require('ioredis');var authService=require(_0x5ea9('0xc'));var qs=require(_0x5ea9('0xd'));var as=require(_0x5ea9('0xe'));var hardwareService=require(_0x5ea9('0xf'));var logger=require(_0x5ea9('0x10'))(_0x5ea9('0x11'));var utils=require(_0x5ea9('0x12'));var config=require(_0x5ea9('0x13'));var licenseUtil=require(_0x5ea9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a7048,_0x3408df){_0x3408df=_0x3408df||0xcc;return function(_0x33c57f){if(_0x33c57f){return _0x1a7048[_0x5ea9('0x15')](_0x3408df);}return _0x1a7048[_0x5ea9('0x16')](_0x3408df)[_0x5ea9('0x17')]();};}function respondWithResult(_0x5bff7b,_0xa15a56){_0xa15a56=_0xa15a56||0xc8;return function(_0x5f1354){if(_0x5f1354){return _0x5bff7b[_0x5ea9('0x16')](_0xa15a56)['json'](_0x5f1354);}};}function respondWithFilteredResult(_0x5c8cf6,_0x2d6ce4){return function(_0x5440f2){if(_0x5440f2){var _0x38b664=typeof _0x2d6ce4[_0x5ea9('0x18')]===_0x5ea9('0x19')&&typeof _0x2d6ce4[_0x5ea9('0x1a')]===_0x5ea9('0x19');var _0xa0555d=_0x5440f2['count'];var _0x1b18bf=_0x38b664?0x0:_0x2d6ce4[_0x5ea9('0x18')];var _0x21c757=_0x38b664?_0x5440f2[_0x5ea9('0x1b')]:_0x2d6ce4['offset']+_0x2d6ce4[_0x5ea9('0x1a')];var _0x235d94;if(_0x21c757>=_0xa0555d){_0x21c757=_0xa0555d;_0x235d94=0xc8;}else{_0x235d94=0xce;}_0x5c8cf6[_0x5ea9('0x16')](_0x235d94);return _0x5c8cf6[_0x5ea9('0x1c')](_0x5ea9('0x1d'),_0x1b18bf+'-'+_0x21c757+'/'+_0xa0555d)[_0x5ea9('0x1e')](_0x5440f2);}return null;};}function patchUpdates(_0x148a04){return function(_0x17f8e9){try{jsonpatch[_0x5ea9('0x1f')](_0x17f8e9,_0x148a04,!![]);}catch(_0x57f491){return BPromise[_0x5ea9('0x20')](_0x57f491);}return _0x17f8e9[_0x5ea9('0x21')]();};}function saveUpdates(_0xc85927,_0x359869){return function(_0x419a07){if(_0x419a07){return _0x419a07[_0x5ea9('0x22')](_0xc85927)['then'](function(_0x204681){return _0x204681;});}return null;};}function removeEntity(_0x2a601d,_0x4819dc){return function(_0x1598c3){if(_0x1598c3){return _0x1598c3['destroy']()[_0x5ea9('0x23')](function(){_0x2a601d[_0x5ea9('0x16')](0xcc)[_0x5ea9('0x17')]();});}};}function handleEntityNotFound(_0x3fa8b8,_0x3a19af){return function(_0x2c7be9){if(!_0x2c7be9){_0x3fa8b8[_0x5ea9('0x15')](0x194);}return _0x2c7be9;};}function handleError(_0x3dc2d1,_0x3ec6a1){_0x3ec6a1=_0x3ec6a1||0x1f4;return function(_0x2ac6c3){logger[_0x5ea9('0x24')](_0x2ac6c3['stack']);if(_0x2ac6c3[_0x5ea9('0x25')]){delete _0x2ac6c3['name'];}_0x3dc2d1[_0x5ea9('0x16')](_0x3ec6a1)[_0x5ea9('0x26')](_0x2ac6c3);};}exports[_0x5ea9('0x27')]=function(_0x47450a,_0x2b0122){var _0x2deb07={},_0x22be8c={},_0x17737b={'count':0x0,'rows':[]};var _0x21009b=_['map'](db[_0x5ea9('0x28')][_0x5ea9('0x29')],function(_0x479cc9){return{'name':_0x479cc9['fieldName'],'type':_0x479cc9[_0x5ea9('0x2a')][_0x5ea9('0x2b')]};});_0x22be8c['model']=_[_0x5ea9('0x2c')](_0x21009b,_0x5ea9('0x25'));_0x22be8c[_0x5ea9('0x2d')]=_[_0x5ea9('0x2e')](_0x47450a['query']);_0x22be8c[_0x5ea9('0x2f')]=_['intersection'](_0x22be8c[_0x5ea9('0x30')],_0x22be8c[_0x5ea9('0x2d')]);_0x2deb07[_0x5ea9('0x31')]=_[_0x5ea9('0x32')](_0x22be8c[_0x5ea9('0x30')],qs[_0x5ea9('0x33')](_0x47450a['query'][_0x5ea9('0x33')]));_0x2deb07[_0x5ea9('0x31')]=_0x2deb07['attributes']['length']?_0x2deb07[_0x5ea9('0x31')]:_0x22be8c[_0x5ea9('0x30')];if(!_0x47450a[_0x5ea9('0x2d')][_0x5ea9('0x34')](_0x5ea9('0x35'))){_0x2deb07[_0x5ea9('0x1a')]=qs[_0x5ea9('0x1a')](_0x47450a['query'][_0x5ea9('0x1a')]);_0x2deb07['offset']=qs[_0x5ea9('0x18')](_0x47450a[_0x5ea9('0x2d')][_0x5ea9('0x18')]);}_0x2deb07[_0x5ea9('0x36')]=qs['sort'](_0x47450a['query'][_0x5ea9('0x37')]);_0x2deb07[_0x5ea9('0x38')]=qs[_0x5ea9('0x2f')](_[_0x5ea9('0x39')](_0x47450a[_0x5ea9('0x2d')],_0x22be8c['filters']),_0x21009b);if(_0x47450a[_0x5ea9('0x2d')]['filter']){_0x2deb07['where']=_[_0x5ea9('0x3a')](_0x2deb07[_0x5ea9('0x38')],{'$or':_[_0x5ea9('0x2c')](_0x21009b,function(_0x1d8e25){if(_0x1d8e25['type']!==_0x5ea9('0x3b')){var _0x58fbf2={};_0x58fbf2[_0x1d8e25['name']]={'$like':'%'+_0x47450a[_0x5ea9('0x2d')][_0x5ea9('0x3c')]+'%'};return _0x58fbf2;}})});}_0x2deb07=_[_0x5ea9('0x3a')]({},_0x2deb07,_0x47450a['options']);var _0x52d73f={'where':_0x2deb07[_0x5ea9('0x38')]};return db[_0x5ea9('0x28')][_0x5ea9('0x1b')](_0x52d73f)['then'](function(_0x4b9ef1){_0x17737b[_0x5ea9('0x1b')]=_0x4b9ef1;if(_0x47450a['query'][_0x5ea9('0x3d')]){_0x2deb07[_0x5ea9('0x3e')]=[{'all':!![]}];}return db[_0x5ea9('0x28')]['findAll'](_0x2deb07);})['then'](function(_0x156cc6){_0x17737b[_0x5ea9('0x3f')]=_0x156cc6;return _0x17737b;})[_0x5ea9('0x23')](respondWithFilteredResult(_0x2b0122,_0x2deb07))['catch'](handleError(_0x2b0122,null));};exports[_0x5ea9('0x40')]=function(_0x4d29bf,_0x3e06be){var _0x243cc1={'raw':!![],'where':{'id':_0x4d29bf[_0x5ea9('0x41')]['id']}},_0x567e37={};_0x567e37[_0x5ea9('0x30')]=_[_0x5ea9('0x2e')](db[_0x5ea9('0x28')][_0x5ea9('0x29')]);_0x567e37[_0x5ea9('0x2d')]=_[_0x5ea9('0x2e')](_0x4d29bf[_0x5ea9('0x2d')]);_0x567e37[_0x5ea9('0x2f')]=_[_0x5ea9('0x32')](_0x567e37[_0x5ea9('0x30')],_0x567e37['query']);_0x243cc1[_0x5ea9('0x31')]=_[_0x5ea9('0x32')](_0x567e37['model'],qs[_0x5ea9('0x33')](_0x4d29bf['query'][_0x5ea9('0x33')]));_0x243cc1[_0x5ea9('0x31')]=_0x243cc1[_0x5ea9('0x31')][_0x5ea9('0x42')]?_0x243cc1[_0x5ea9('0x31')]:_0x567e37['model'];if(_0x4d29bf['query'][_0x5ea9('0x3d')]){_0x243cc1[_0x5ea9('0x3e')]=[{'all':!![]}];}_0x243cc1=_[_0x5ea9('0x3a')]({},_0x243cc1,_0x4d29bf[_0x5ea9('0x43')]);return db['VoiceQueuesLog'][_0x5ea9('0x44')](_0x243cc1)[_0x5ea9('0x23')](handleEntityNotFound(_0x3e06be,null))[_0x5ea9('0x23')](respondWithResult(_0x3e06be,null))[_0x5ea9('0x45')](handleError(_0x3e06be,null));};exports[_0x5ea9('0x46')]=function(_0x2bbfac,_0x5da8a7){return db[_0x5ea9('0x28')][_0x5ea9('0x46')](_0x2bbfac['body'],{})['then'](respondWithResult(_0x5da8a7,0xc9))[_0x5ea9('0x45')](handleError(_0x5da8a7,null));};exports[_0x5ea9('0x22')]=function(_0xd02033,_0x2844a3){if(_0xd02033[_0x5ea9('0x47')]['id']){delete _0xd02033[_0x5ea9('0x47')]['id'];}return db['VoiceQueuesLog'][_0x5ea9('0x44')]({'where':{'id':_0xd02033[_0x5ea9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2844a3,null))['then'](saveUpdates(_0xd02033[_0x5ea9('0x47')],null))['then'](respondWithResult(_0x2844a3,null))['catch'](handleError(_0x2844a3,null));};exports[_0x5ea9('0x48')]=function(_0x3d5be6,_0x1e9864){return db['VoiceQueuesLog']['find']({'where':{'id':_0x3d5be6[_0x5ea9('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e9864,null))[_0x5ea9('0x23')](removeEntity(_0x1e9864,null))[_0x5ea9('0x45')](handleError(_0x1e9864,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cd9f0c6..0855521 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 _0xe81b=['dtm','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','event_dtm'];(function(_0x5de174,_0x52818d){var _0x301cf8=function(_0x59c774){while(--_0x59c774){_0x5de174['push'](_0x5de174['shift']());}};_0x301cf8(++_0x52818d);}(_0xe81b,0xde));var _0xbe81=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xe81b[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var logger=require('../../config/logger')(_0xbe81('0x2'));var moment=require(_0xbe81('0x3'));var BPromise=require(_0xbe81('0x4'));var rp=require(_0xbe81('0x5'));var fs=require('fs');var path=require(_0xbe81('0x6'));var rimraf=require(_0xbe81('0x7'));var config=require(_0xbe81('0x8'));var attributes=require(_0xbe81('0x9'));module['exports']=function(_0x5766d8,_0x41818b){return _0x5766d8[_0xbe81('0xa')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xbe81('0xb'),'fields':['event',_0xbe81('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4ace=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3429c4,_0x2294a9){var _0x2c1e3a=function(_0x4a5de7){while(--_0x4a5de7){_0x3429c4['push'](_0x3429c4['shift']());}};_0x2c1e3a(++_0x2294a9);}(_0x4ace,0x160));var _0xe4ac=function(_0x5da12a,_0x1f6a94){_0x5da12a=_0x5da12a-0x0;var _0x477c2c=_0x4ace[_0x5da12a];return _0x477c2c;};'use strict';var _=require(_0xe4ac('0x0'));var util=require(_0xe4ac('0x1'));var logger=require(_0xe4ac('0x2'))(_0xe4ac('0x3'));var moment=require(_0xe4ac('0x4'));var BPromise=require(_0xe4ac('0x5'));var rp=require(_0xe4ac('0x6'));var fs=require('fs');var path=require(_0xe4ac('0x7'));var rimraf=require(_0xe4ac('0x8'));var config=require(_0xe4ac('0x9'));var attributes=require(_0xe4ac('0xa'));module[_0xe4ac('0xb')]=function(_0x21f85e,_0x42b95e){return _0x21f85e['define'](_0xe4ac('0xc'),attributes,{'tableName':_0xe4ac('0xd'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xe4ac('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bcd5d9e..82baf04 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 _0x441c=['then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','../../mysqldb','rpc','jayson/promise','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x441c,0x14f));var _0xc441=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x441c[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc441('0x0'));var BPromise=require('bluebird');var rs=require(_0xc441('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc441('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc441('0x3'));var config=require('../../config/environment');var jayson=require(_0xc441('0x4'));var client=jayson['client'][_0xc441('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5c4594,_0x531805,_0x559073){return new BPromise(function(_0xfd789a,_0x23a2b0){return client[_0xc441('0x6')](_0x5c4594,_0x559073)[_0xc441('0x7')](function(_0x27e630){logger[_0xc441('0x8')](_0xc441('0x9'),_0x531805,_0xc441('0xa'));logger[_0xc441('0xb')](_0xc441('0xc'),_0x531805,'request\x20sent',JSON['stringify'](_0x27e630));if(_0x27e630[_0xc441('0xd')]){if(_0x27e630[_0xc441('0xd')][_0xc441('0xe')]===0x1f4){logger['error'](_0xc441('0x9'),_0x531805,_0x27e630[_0xc441('0xd')][_0xc441('0xf')]);return _0x23a2b0(_0x27e630[_0xc441('0xd')][_0xc441('0xf')]);}logger[_0xc441('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x531805,_0x27e630['error']['message']);return _0xfd789a(_0x27e630[_0xc441('0xd')][_0xc441('0xf')]);}else{logger['info'](_0xc441('0x9'),_0x531805,'request\x20sent');_0xfd789a(_0x27e630[_0xc441('0x10')]['message']);}})[_0xc441('0x11')](function(_0x3e409a){logger[_0xc441('0xd')](_0xc441('0x9'),_0x531805,_0x3e409a);_0x23a2b0(_0x3e409a);});});} \ No newline at end of file +var _0x0c08=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d9bc1,_0x52f0a6){var _0x540128=function(_0x2e35ff){while(--_0x2e35ff){_0x1d9bc1['push'](_0x1d9bc1['shift']());}};_0x540128(++_0x52f0a6);}(_0x0c08,0x1e6));var _0x80c0=function(_0x2f1f08,_0x158f35){_0x2f1f08=_0x2f1f08-0x0;var _0x32f365=_0x0c08[_0x2f1f08];return _0x32f365;};'use strict';var _=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var moment=require('moment');var BPromise=require(_0x80c0('0x2'));var rs=require(_0x80c0('0x3'));var fs=require('fs');var Redis=require(_0x80c0('0x4'));var db=require(_0x80c0('0x5'))['db'];var utils=require(_0x80c0('0x6'));var logger=require('../../config/logger')(_0x80c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x80c0('0x8'));var client=jayson[_0x80c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289745,_0x39c069,_0x327af0){return new BPromise(function(_0x333a54,_0x7bed60){return client['request'](_0x289745,_0x327af0)['then'](function(_0xb7bb5d){logger[_0x80c0('0xa')](_0x80c0('0xb'),_0x39c069,_0x80c0('0xc'));logger[_0x80c0('0xd')](_0x80c0('0xe'),_0x39c069,'request\x20sent',JSON[_0x80c0('0xf')](_0xb7bb5d));if(_0xb7bb5d[_0x80c0('0x10')]){if(_0xb7bb5d['error']['code']===0x1f4){logger[_0x80c0('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x39c069,_0xb7bb5d['error']['message']);return _0x7bed60(_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);}logger[_0x80c0('0x10')](_0x80c0('0xb'),_0x39c069,_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);return _0x333a54(_0xb7bb5d[_0x80c0('0x10')][_0x80c0('0x11')]);}else{logger[_0x80c0('0xa')](_0x80c0('0xb'),_0x39c069,_0x80c0('0xc'));_0x333a54(_0xb7bb5d[_0x80c0('0x12')]['message']);}})[_0x80c0('0x13')](function(_0x14d835){logger[_0x80c0('0x10')](_0x80c0('0xb'),_0x39c069,_0x14d835);_0x7bed60(_0x14d835);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 691cd22..b1bc3f8 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 _0xfdde=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','show','download','/:id/downloads','post','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0xfdde,0x8c));var _0xefdd=function(_0x4f58da,_0x51f9a8){_0x4f58da=_0x4f58da-0x0;var _0x7caf41=_0xfdde[_0x4f58da];return _0x7caf41;};'use strict';var multer=require(_0xefdd('0x0'));var util=require(_0xefdd('0x1'));var path=require(_0xefdd('0x2'));var timeout=require(_0xefdd('0x3'));var express=require(_0xefdd('0x4'));var router=express[_0xefdd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xefdd('0x6'));var interaction=require(_0xefdd('0x7'));var config=require(_0xefdd('0x8'));var controller=require(_0xefdd('0x9'));router[_0xefdd('0xa')]('/',auth[_0xefdd('0xb')](),controller[_0xefdd('0xc')]);router['get'](_0xefdd('0xd'),auth[_0xefdd('0xb')](),controller['describe']);router[_0xefdd('0xa')]('/:id',auth[_0xefdd('0xb')](),controller[_0xefdd('0xe')]);router[_0xefdd('0xa')]('/:id/download',auth[_0xefdd('0xb')](),controller[_0xefdd('0xf')]);router[_0xefdd('0xa')](_0xefdd('0x10'),controller['downloads']);router[_0xefdd('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xefdd('0x11')]('/',auth['isAuthenticated'](),controller[_0xefdd('0x12')]);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller[_0xefdd('0x13')]);router[_0xefdd('0x14')]('/:id',auth[_0xefdd('0xb')](),controller[_0xefdd('0x15')]);router[_0xefdd('0x16')]('/:id',auth[_0xefdd('0xb')](),controller[_0xefdd('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe910=['downloadTranscribe','post','create','runTranscribe','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe'];(function(_0x23b02f,_0x55a993){var _0xf38f79=function(_0x2b4109){while(--_0x2b4109){_0x23b02f['push'](_0x23b02f['shift']());}};_0xf38f79(++_0x55a993);}(_0xe910,0x173));var _0x0e91=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xe910[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require(_0x0e91('0x0'));var util=require(_0x0e91('0x1'));var path=require(_0x0e91('0x2'));var timeout=require(_0x0e91('0x3'));var express=require(_0x0e91('0x4'));var router=express[_0x0e91('0x5')]();var fs_extra=require(_0x0e91('0x6'));var auth=require(_0x0e91('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0e91('0x8'));var controller=require('./voiceRecording.controller');router[_0x0e91('0x9')]('/',auth[_0x0e91('0xa')](),controller['index']);router['get'](_0x0e91('0xb'),auth[_0x0e91('0xa')](),controller[_0x0e91('0xc')]);router['get'](_0x0e91('0xd'),auth[_0x0e91('0xa')](),controller['show']);router[_0x0e91('0x9')](_0x0e91('0xe'),auth['isAuthenticated'](),controller[_0x0e91('0xf')]);router[_0x0e91('0x9')](_0x0e91('0x10'),controller[_0x0e91('0x11')]);router[_0x0e91('0x9')](_0x0e91('0x12'),auth['isAuthenticated'](),controller[_0x0e91('0x13')]);router[_0x0e91('0x14')]('/',auth[_0x0e91('0xa')](),controller[_0x0e91('0x15')]);router[_0x0e91('0x14')](_0x0e91('0x12'),auth[_0x0e91('0xa')](),controller[_0x0e91('0x16')]);router['put'](_0x0e91('0xd'),auth['isAuthenticated'](),controller[_0x0e91('0x17')]);router[_0x0e91('0x18')](_0x0e91('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0e91('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a47545f..caf5761 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 cca285f..98f545d 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 _0x2b6c=['Sequelize','ValidationError','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','VoiceRecording','fieldName','type','key','model','differenceBy','map','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','rows','catch','show','keys','rawAttributes','include','options','find','body','params','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording'];(function(_0x28e655,_0xb50ac){var _0x267f07=function(_0x5d0757){while(--_0x5d0757){_0x28e655['push'](_0x28e655['shift']());}};_0x267f07(++_0xb50ac);}(_0x2b6c,0x15f));var _0xc2b6=function(_0x17fed0,_0x281f6f){_0x17fed0=_0x17fed0-0x0;var _0x49fb26=_0x2b6c[_0x17fed0];return _0x49fb26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc2b6('0x0'));var zipdir=require(_0xc2b6('0x1'));var jsonpatch=require(_0xc2b6('0x2'));var rp=require(_0xc2b6('0x3'));var moment=require(_0xc2b6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc2b6('0x5'));var path=require('path');var sox=require(_0xc2b6('0x6'));var csv=require(_0xc2b6('0x7'));var ejs=require(_0xc2b6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2b6('0x9'));var squel=require('squel');var crypto=require(_0xc2b6('0xa'));var jsforce=require(_0xc2b6('0xb'));var deskjs=require(_0xc2b6('0xc'));var toCsv=require(_0xc2b6('0x7'));var querystring=require(_0xc2b6('0xd'));var Papa=require(_0xc2b6('0xe'));var AWS=require(_0xc2b6('0xf'));var uuidv4=require(_0xc2b6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc2b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc2b6('0x12'));var utils=require(_0xc2b6('0x13'));var config=require(_0xc2b6('0x14'));var licenseUtil=require(_0xc2b6('0x15'));var db=require(_0xc2b6('0x16'))['db'];function respondWithStatusCode(_0xec9a4b,_0x5e23d6){_0x5e23d6=_0x5e23d6||0xcc;return function(_0x4a46a8){if(_0x4a46a8){return _0xec9a4b[_0xc2b6('0x17')](_0x5e23d6);}return _0xec9a4b[_0xc2b6('0x18')](_0x5e23d6)[_0xc2b6('0x19')]();};}function respondWithResult(_0x4a8baf,_0x47b66d){_0x47b66d=_0x47b66d||0xc8;return function(_0x2aaeca){if(_0x2aaeca){return _0x4a8baf[_0xc2b6('0x18')](_0x47b66d)[_0xc2b6('0x1a')](_0x2aaeca);}};}function respondWithFilteredResult(_0x1ae1d9,_0x5a3d3d){return function(_0x488f0e){if(_0x488f0e){var _0x327337=typeof _0x5a3d3d['offset']==='undefined'&&typeof _0x5a3d3d[_0xc2b6('0x1b')]===_0xc2b6('0x1c');var _0x2b0365=_0x488f0e['count'];var _0xfb1246=_0x327337?0x0:_0x5a3d3d[_0xc2b6('0x1d')];var _0x5db70a=_0x327337?_0x488f0e[_0xc2b6('0x1e')]:_0x5a3d3d[_0xc2b6('0x1d')]+_0x5a3d3d[_0xc2b6('0x1b')];var _0x1f3ee3;if(_0x5db70a>=_0x2b0365){_0x5db70a=_0x2b0365;_0x1f3ee3=0xc8;}else{_0x1f3ee3=0xce;}_0x1ae1d9['status'](_0x1f3ee3);return _0x1ae1d9['set'](_0xc2b6('0x1f'),_0xfb1246+'-'+_0x5db70a+'/'+_0x2b0365)[_0xc2b6('0x1a')](_0x488f0e);}return null;};}function patchUpdates(_0x5227b8){return function(_0x155650){try{jsonpatch[_0xc2b6('0x20')](_0x155650,_0x5227b8,!![]);}catch(_0x4ccf9b){return BPromise[_0xc2b6('0x21')](_0x4ccf9b);}return _0x155650[_0xc2b6('0x22')]();};}function saveUpdates(_0x41d799,_0x12b1a6){return function(_0x31912e){if(_0x31912e){return _0x31912e[_0xc2b6('0x23')](_0x41d799)[_0xc2b6('0x24')](function(_0x1f74fb){return _0x1f74fb;});}return null;};}function removeEntity(_0x17ee43,_0x3d755a){return function(_0x146919){if(_0x146919){return _0x146919['destroy']()[_0xc2b6('0x24')](function(){_0x17ee43[_0xc2b6('0x18')](0xcc)[_0xc2b6('0x19')]();});}};}function handleEntityNotFound(_0x2cddb9,_0x2ef6a1){return function(_0x217a3c){if(!_0x217a3c){_0x2cddb9[_0xc2b6('0x17')](0x194);}return _0x217a3c;};}function handleError(_0x4451bc,_0x20d457){_0x20d457=_0x20d457||0x1f4;return function(_0x35df82){logger[_0xc2b6('0x25')](_0x35df82[_0xc2b6('0x26')]);if(_0x35df82[_0xc2b6('0x27')]){delete _0x35df82['name'];}_0x4451bc['status'](_0x20d457)['send'](_0x35df82);};}exports[_0xc2b6('0x28')]=function(_0x6b9636,_0x4c1bd9){var _0x535cd0={},_0x530d69={},_0x2ba6c9={'count':0x0,'rows':[]};var _0x3b22d9=_['map'](db[_0xc2b6('0x29')]['rawAttributes'],function(_0x409b1d){return{'name':_0x409b1d[_0xc2b6('0x2a')],'type':_0x409b1d[_0xc2b6('0x2b')][_0xc2b6('0x2c')]};});_0x530d69[_0xc2b6('0x2d')]=_[_0xc2b6('0x2e')](_[_0xc2b6('0x2f')](_0x3b22d9,'name'),[_0xc2b6('0x30')]);_0x530d69[_0xc2b6('0x31')]=_['keys'](_0x6b9636[_0xc2b6('0x31')]);_0x530d69[_0xc2b6('0x32')]=_[_0xc2b6('0x33')](_0x530d69[_0xc2b6('0x2d')],_0x530d69['query']);_0x535cd0['attributes']=_[_0xc2b6('0x33')](_0x530d69[_0xc2b6('0x2d')],qs[_0xc2b6('0x34')](_0x6b9636[_0xc2b6('0x31')]['fields']));_0x535cd0[_0xc2b6('0x35')]=_0x535cd0[_0xc2b6('0x35')][_0xc2b6('0x36')]?_0x535cd0[_0xc2b6('0x35')]:_0x530d69['model'];if(!_0x6b9636[_0xc2b6('0x31')][_0xc2b6('0x37')](_0xc2b6('0x38'))){_0x535cd0[_0xc2b6('0x1b')]=qs[_0xc2b6('0x1b')](_0x6b9636['query'][_0xc2b6('0x1b')]);_0x535cd0[_0xc2b6('0x1d')]=qs[_0xc2b6('0x1d')](_0x6b9636[_0xc2b6('0x31')]['offset']);}_0x535cd0[_0xc2b6('0x39')]=qs[_0xc2b6('0x3a')](_0x6b9636[_0xc2b6('0x31')][_0xc2b6('0x3a')]);_0x535cd0['where']=qs[_0xc2b6('0x32')](_[_0xc2b6('0x3b')](_0x6b9636[_0xc2b6('0x31')],_0x530d69[_0xc2b6('0x32')]),_0x3b22d9);if(_0x6b9636[_0xc2b6('0x31')]['filter']){_0x535cd0[_0xc2b6('0x3c')]=_[_0xc2b6('0x3d')](_0x535cd0[_0xc2b6('0x3c')],{'$or':_['map'](_0x3b22d9,function(_0xbb1063){if(_0xbb1063['type']!=='VIRTUAL'){var _0x57a73f={};_0x57a73f[_0xbb1063[_0xc2b6('0x27')]]={'$like':'%'+_0x6b9636[_0xc2b6('0x31')][_0xc2b6('0x3e')]+'%'};return _0x57a73f;}})});}_0x535cd0=_[_0xc2b6('0x3d')]({},_0x535cd0,_0x6b9636['options']);var _0x561ebd={'where':_0x535cd0['where']};return db[_0xc2b6('0x29')][_0xc2b6('0x1e')](_0x561ebd)[_0xc2b6('0x24')](function(_0x2f7564){_0x2ba6c9['count']=_0x2f7564;if(_0x6b9636[_0xc2b6('0x31')][_0xc2b6('0x3f')]){_0x535cd0['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x535cd0);})[_0xc2b6('0x24')](function(_0x2f179c){_0x2ba6c9[_0xc2b6('0x40')]=_0x2f179c;return _0x2ba6c9;})['then'](respondWithFilteredResult(_0x4c1bd9,_0x535cd0))[_0xc2b6('0x41')](handleError(_0x4c1bd9,null));};exports[_0xc2b6('0x42')]=function(_0xc43291,_0x3d71a3){var _0x455fa7={'raw':![],'where':{'id':_0xc43291['params']['id']}},_0x1b5638={};_0x1b5638['model']=_[_0xc2b6('0x43')](db[_0xc2b6('0x29')][_0xc2b6('0x44')]);_0x1b5638[_0xc2b6('0x31')]=_[_0xc2b6('0x43')](_0xc43291['query']);_0x1b5638[_0xc2b6('0x32')]=_[_0xc2b6('0x33')](_0x1b5638[_0xc2b6('0x2d')],_0x1b5638[_0xc2b6('0x31')]);_0x455fa7['attributes']=_[_0xc2b6('0x33')](_0x1b5638['model'],qs[_0xc2b6('0x34')](_0xc43291[_0xc2b6('0x31')]['fields']));_0x455fa7['attributes']=_0x455fa7[_0xc2b6('0x35')][_0xc2b6('0x36')]?_0x455fa7[_0xc2b6('0x35')]:_0x1b5638[_0xc2b6('0x2d')];if(_0xc43291[_0xc2b6('0x31')]['includeAll']){_0x455fa7[_0xc2b6('0x45')]=[{'all':!![]}];}_0x455fa7=_[_0xc2b6('0x3d')]({},_0x455fa7,_0xc43291[_0xc2b6('0x46')]);return db[_0xc2b6('0x29')][_0xc2b6('0x47')](_0x455fa7)[_0xc2b6('0x24')](handleEntityNotFound(_0x3d71a3,null))['then'](respondWithResult(_0x3d71a3,null))[_0xc2b6('0x41')](handleError(_0x3d71a3,null));};exports['create']=function(_0x33277e,_0x243da0){return db[_0xc2b6('0x29')]['create'](_0x33277e[_0xc2b6('0x48')],{})[_0xc2b6('0x24')](respondWithResult(_0x243da0,0xc9))['catch'](handleError(_0x243da0,null));};exports['update']=function(_0x5f21d7,_0x2ac4d4){if(_0x5f21d7['body']['id']){delete _0x5f21d7['body']['id'];}return db[_0xc2b6('0x29')][_0xc2b6('0x47')]({'where':{'id':_0x5f21d7[_0xc2b6('0x49')]['id']}})[_0xc2b6('0x24')](handleEntityNotFound(_0x2ac4d4,null))[_0xc2b6('0x24')](saveUpdates(_0x5f21d7[_0xc2b6('0x48')],null))[_0xc2b6('0x24')](respondWithResult(_0x2ac4d4,null))[_0xc2b6('0x41')](handleError(_0x2ac4d4,null));};exports['describe']=function(_0x1e187f,_0x192fc8){return db['VoiceRecording'][_0xc2b6('0x4a')]()['then'](respondWithResult(_0x192fc8,null))[_0xc2b6('0x41')](handleError(_0x192fc8,null));};exports['download']=function(_0x435ea0,_0x23e9f6,_0x5d862f){var _0x265f88=require('../../components/encryptor');var _0x58c683=![];var _0x36d159={};if(_0x435ea0['query'][_0xc2b6('0x2b')]&&_0x435ea0['query']['type']===_0xc2b6('0x4b')){_0x36d159[_0xc2b6('0x4b')]=_0x435ea0['params']['id'];}else{_0x36d159['id']=_0x435ea0[_0xc2b6('0x49')]['id'];}return db[_0xc2b6('0x29')]['find']({'where':_0x36d159,'attributes':['id',_0xc2b6('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x23e9f6,null))[_0xc2b6('0x24')](function(_0x593d29){if(_0x593d29){var _0x4bef0b=_0x593d29[_0xc2b6('0x4c')];var _0x3bc84c=util[_0xc2b6('0x30')](_0xc2b6('0x4d'),_0x4bef0b);if(fs[_0xc2b6('0x4e')](_0x3bc84c)){_0x58c683=!![];return _0x265f88[_0xc2b6('0x4f')](_0x3bc84c,_0x4bef0b,config[_0xc2b6('0x50')]['recording'])[_0xc2b6('0x24')](function(){return _0x593d29;});}return _0x593d29;}})['then'](function(_0x53f866){if(_0x53f866){var _0x4054fc=_0x53f866[_0xc2b6('0x4c')];if(!fs['existsSync'](_0x4054fc)){throw new db['Sequelize']['ValidationError'](_0xc2b6('0x51'));}if(_0x53f866[_0xc2b6('0x52')]){return _0x23e9f6['download'](_0x4054fc,_0x53f866[_0xc2b6('0x52')]+path[_0xc2b6('0x53')](_0x4054fc),function(){if(_0x58c683){fs[_0xc2b6('0x54')](_0x4054fc);}});}else{return _0x23e9f6[_0xc2b6('0x55')](_0x4054fc,function(_0x1169db){if(_0x58c683){fs[_0xc2b6('0x54')](_0x4054fc);}});}}})[_0xc2b6('0x41')](function(_0x627e8e){if(_0x627e8e[_0xc2b6('0x56')]==='VoiceRecording\x20not\x20found'){_0x23e9f6['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x23e9f6,null);}});};exports[_0xc2b6('0x57')]=function(_0x103e06,_0x1b1f52,_0xb3be78){var _0x240593=require(_0xc2b6('0x58'));var _0x3e7467=![];var _0x5f13fa={'$and':[db[_0xc2b6('0x59')][_0xc2b6('0x3c')](db[_0xc2b6('0x59')]['fn'](_0xc2b6('0x5a'),db[_0xc2b6('0x59')][_0xc2b6('0x5b')](_0xc2b6('0x4b'))),_0x103e06['query'][_0xc2b6('0x5c')])]};if(_0x103e06['query'][_0xc2b6('0x2b')]&&_0x103e06[_0xc2b6('0x31')][_0xc2b6('0x2b')]===_0xc2b6('0x4b')){_0x5f13fa[_0xc2b6('0x5d')][_0xc2b6('0x5e')]({'uniqueid':_0x103e06[_0xc2b6('0x49')]['id']});}else{_0x5f13fa[_0xc2b6('0x5d')][_0xc2b6('0x5e')]({'id':_0x103e06[_0xc2b6('0x49')]['id']});}return db['VoiceRecording'][_0xc2b6('0x47')]({'where':_0x5f13fa,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1b1f52,null))[_0xc2b6('0x24')](function(_0x35377a){if(_0x35377a){var _0x2e9645=util[_0xc2b6('0x30')](_0xc2b6('0x4d'),_0x35377a[_0xc2b6('0x4c')]);if(fs[_0xc2b6('0x4e')](_0x2e9645)){_0x3e7467=!![];return _0x240593[_0xc2b6('0x4f')](_0x2e9645,_0x35377a['value'],config[_0xc2b6('0x50')][_0xc2b6('0x5f')])[_0xc2b6('0x24')](function(){return _0x35377a;});}return _0x35377a;}})[_0xc2b6('0x24')](function(_0x1d356e){if(_0x1d356e){if(!fs['existsSync'](_0x1d356e['value'])){throw new db[(_0xc2b6('0x60'))][(_0xc2b6('0x61'))]('VoiceRecording\x20not\x20found');}if(_0x1d356e['filename']){return _0x1b1f52['download'](_0x1d356e[_0xc2b6('0x4c')],_0x1d356e[_0xc2b6('0x52')]+path[_0xc2b6('0x53')](_0x1d356e[_0xc2b6('0x4c')]),function(){if(_0x3e7467){fs[_0xc2b6('0x54')](_0x1d356e[_0xc2b6('0x4c')]);}});}else{return _0x1b1f52[_0xc2b6('0x55')](_0x1d356e[_0xc2b6('0x4c')],function(_0x1cb41){if(_0x3e7467){fs[_0xc2b6('0x54')](_0x1d356e['value']);}});}}})[_0xc2b6('0x41')](handleError(_0x1b1f52,null));};exports[_0xc2b6('0x62')]=function(_0x164c9e,_0xab10d6){return db[_0xc2b6('0x29')][_0xc2b6('0x47')]({'where':{'id':_0x164c9e[_0xc2b6('0x49')]['id']}})['then'](function(_0x384dae){if(_[_0xc2b6('0x63')](_0x384dae)){throw new ReferenceError(_0xc2b6('0x64'));}return _0x384dae;})['then'](function(_0x36eb68){var _0x199a11=_0x36eb68[_0xc2b6('0x4c')];logger['info'](_0xc2b6('0x65'),_0x199a11);if(!_[_0xc2b6('0x63')](_0x36eb68[_0xc2b6('0x4c')])&&fs[_0xc2b6('0x4e')](_0x199a11)){logger[_0xc2b6('0x66')](_0xc2b6('0x67')+_0x199a11+_0xc2b6('0x68'));fs[_0xc2b6('0x69')](_0x199a11);}_0x199a11=_0x199a11+'.cypher';if(!_['isNil'](_0x36eb68[_0xc2b6('0x4c')])&&fs[_0xc2b6('0x4e')](_0x199a11)){logger[_0xc2b6('0x66')](_0xc2b6('0x67')+_0x199a11+_0xc2b6('0x68'));fs['unlinkSync'](_0x199a11);}return _0x36eb68;})[_0xc2b6('0x24')](function(_0x522db1){if(!_0x522db1)throw new InternalError();return _0x522db1[_0xc2b6('0x62')]();})[_0xc2b6('0x24')](function(){_0xab10d6[_0xc2b6('0x18')](0xcc)['end']();})[_0xc2b6('0x41')](handleError(_0xab10d6,null));};function getBucketslist(_0x4e815f,_0x3f5202,_0x45ff37){return new Promise(function(_0x2ffee9,_0x17d6bb){var _0x51d6c2=new AWS['S3']({'accessKeyId':_0x3f5202,'secretAccessKey':_0x4e815f,'region':_0x45ff37});_0x51d6c2[_0xc2b6('0x6a')]({},function(_0xa82b48,_0x522271){if(_0xa82b48){return _0x17d6bb(_0xa82b48);}else{return _0x2ffee9(_0x522271);}});});}function createBucket(_0x4e144b,_0x40e1ea,_0xae180b,_0x24a1d1){return new Promise(function(_0x33c08f,_0x38c9fb){var _0x3bb8f7=new AWS['S3']({'accessKeyId':_0x40e1ea,'secretAccessKey':_0x4e144b,'region':_0xae180b});_0x3bb8f7[_0xc2b6('0x6b')]({'Bucket':_0x24a1d1},function(_0x12fd1d,_0x348d79){if(_0x12fd1d){return _0x38c9fb(_0x12fd1d);}else{return _0x33c08f(_0x348d79);}});});}function uploadFile(_0x235e98,_0x103533,_0x2d6f2c,_0xfade78,_0x35c075,_0x25d935){return new Promise(function(_0x1993bc,_0x18541c){var _0x105cd9=new AWS['S3']({'accessKeyId':_0x103533,'secretAccessKey':_0x235e98,'region':_0x2d6f2c});_0x105cd9['upload']({'Bucket':_0xfade78,'Key':_0x35c075,'Body':_0x25d935},function(_0x245a49,_0x5c065b){if(_0x245a49){return _0x18541c(_0x245a49);}else{return _0x1993bc(_0x5c065b);}});});}function startTranscribe(_0x4e56fe,_0x4a8e04,_0x4993f4,_0xf432a9,_0x368431,_0x1c6706){return new Promise(function(_0x23b1fa,_0x50f14e){var _0x549ea9=new AWS['TranscribeService']({'accessKeyId':_0x4a8e04,'secretAccessKey':_0x4e56fe,'region':_0x4993f4});_0x549ea9[_0xc2b6('0x6c')]({'TranscriptionJobName':_0xf432a9,'LanguageCode':_0x368431,'Media':{'MediaFileUri':_0x1c6706}},function(_0x25def1,_0x50b354){if(_0x25def1){return _0x50f14e(_0x25def1);}else{return _0x23b1fa(_0x50b354);}});});}function transcribe(_0x44e062,_0xbdc336,_0x4fdcea,_0x2eed5d,_0x2687d8,_0x1fc5e8,_0x3436f4){return new Promise(function(_0x305ffb,_0x50a742){var _0x507c22={};logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')](_0xc2b6('0x6d'),_0x44e062,_0x2687d8));return uploadFile(_0xbdc336,_0x4fdcea,_0x2eed5d,_0x2687d8,path[_0xc2b6('0x6e')](_0x1fc5e8),fs[_0xc2b6('0x6f')](_0x1fc5e8))['then'](function(_0x1b695f){logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')](_0xc2b6('0x70'),_0x44e062,_0x2687d8,_0x1b695f['Location']));_0x507c22[_0xc2b6('0x71')]=_0x1b695f[_0xc2b6('0x72')];_0x507c22['location']=_0x1b695f[_0xc2b6('0x73')];logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x44e062));return startTranscribe(_0xbdc336,_0x4fdcea,_0x2eed5d,uuidv4(),_0x3436f4,_0x1b695f[_0xc2b6('0x73')]);})[_0xc2b6('0x24')](function(_0x4ea673){logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')](_0xc2b6('0x74'),_0x44e062,_0x4ea673['TranscriptionJob']['TranscriptionJobName']));_0x507c22[_0xc2b6('0x75')]=_0x4ea673[_0xc2b6('0x76')][_0xc2b6('0x77')];_0x507c22[_0xc2b6('0x78')]=_0x4ea673['TranscriptionJob'][_0xc2b6('0x79')];return _0x305ffb(_0x507c22);})['catch'](function(_0x562d0a){return _0x50a742(_0x562d0a);});});}exports['runTranscribe']=function(_0x5b7f0f,_0x4e62c5,_0x32ee16){var _0x44ba9e;var _0x19466a;var _0x4eec8d;var _0x394cc9=require('../../components/encryptor');return db[_0xc2b6('0x29')][_0xc2b6('0x7a')]({'where':{'id':_0x5b7f0f[_0xc2b6('0x49')]['id']}})[_0xc2b6('0x24')](function(_0x6a9035){if(_0x6a9035){var _0x3ad20f=util[_0xc2b6('0x30')]('%s.cypher',_0x6a9035[_0xc2b6('0x4c')]);if(fs[_0xc2b6('0x4e')](_0x3ad20f)){cypher=!![];return _0x394cc9[_0xc2b6('0x4f')](_0x3ad20f,_0x6a9035[_0xc2b6('0x4c')],config['secrets'][_0xc2b6('0x5f')])['then'](function(){return _0x6a9035;});}return _0x6a9035;}})[_0xc2b6('0x24')](function(_0x40f5e8){if(!_0x40f5e8){throw new db['Sequelize'][(_0xc2b6('0x61'))](_0xc2b6('0x7b'));}_0x19466a=_0x40f5e8;return db[_0xc2b6('0x7c')]['findOne']({'where':{'id':0x1}});})[_0xc2b6('0x24')](handleEntityNotFound(_0x4e62c5,null))['then'](function(_0x34fb69){if(_0x34fb69){_0x44ba9e=_0x34fb69;if(!_0x44ba9e['transcribe']||!_0x44ba9e[_0xc2b6('0x7d')]||!_0x44ba9e[_0xc2b6('0x7e')]||!_0x44ba9e['language']||!_0x44ba9e['bucket']){throw new db[(_0xc2b6('0x60'))][(_0xc2b6('0x61'))](_0xc2b6('0x7f'));}if(_0x5b7f0f[_0xc2b6('0x48')][_0xc2b6('0x80')]&&(!_0x44ba9e[_0xc2b6('0x81')]||!_0x44ba9e[_0xc2b6('0x82')]||!_0x44ba9e['sentimentRegion']||!_0x44ba9e[_0xc2b6('0x83')]||!_0x44ba9e[_0xc2b6('0x71')])){throw new db[(_0xc2b6('0x60'))][(_0xc2b6('0x61'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xc2b6('0x84')][_0xc2b6('0x7a')]({'where':{'id':_0x44ba9e[_0xc2b6('0x7d')]}});}})[_0xc2b6('0x24')](function(_0x319cd9){if(!_0x319cd9){throw new db['Sequelize']['ValidationError'](_0xc2b6('0x85'));}if(!_0x319cd9[_0xc2b6('0x86')]||!_0x319cd9[_0xc2b6('0x87')]){throw new db[(_0xc2b6('0x60'))]['ValidationError'](_0xc2b6('0x88'));}_0x4eec8d=_0x319cd9;return getBucketslist(_0x4eec8d[_0xc2b6('0x86')],_0x4eec8d['data2'],_0x44ba9e[_0xc2b6('0x7e')]);})[_0xc2b6('0x24')](function(_0x58b600){if(_0x58b600&&_0x58b600[_0xc2b6('0x89')]){var _0x2e3423=_[_0xc2b6('0x47')](_0x58b600[_0xc2b6('0x89')],function(_0x20c736){return _0x20c736[_0xc2b6('0x8a')]===_0x44ba9e[_0xc2b6('0x71')];});if(!_0x2e3423){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5b7f0f[_0xc2b6('0x49')]['id'],_0x44ba9e[_0xc2b6('0x71')]));return createBucket(_0x4eec8d[_0xc2b6('0x86')],_0x4eec8d[_0xc2b6('0x87')],_0x44ba9e[_0xc2b6('0x7e')],_0x44ba9e[_0xc2b6('0x71')]);}logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')](_0xc2b6('0x8b'),_0x5b7f0f[_0xc2b6('0x49')]['id'],_0x44ba9e['bucket']));return;}})[_0xc2b6('0x24')](function(_0x372998){if(_0x19466a[_0xc2b6('0x78')]===_0xc2b6('0x8c')){return transcribe(_0x5b7f0f[_0xc2b6('0x49')]['id'],_0x4eec8d[_0xc2b6('0x86')],_0x4eec8d['data2'],_0x44ba9e['transcribeRegion'],_0x44ba9e[_0xc2b6('0x71')],_0x19466a['value'],_0x44ba9e[_0xc2b6('0x83')]);}else{logger[_0xc2b6('0x66')](util[_0xc2b6('0x30')](_0xc2b6('0x8d'),_0x5b7f0f[_0xc2b6('0x49')]['id']));return{'transcribeStatus':_0xc2b6('0x8e')};}})[_0xc2b6('0x24')](function(_0x257925){if(_0x257925){_0x257925[_0xc2b6('0x8f')]=_0x5b7f0f['body'][_0xc2b6('0x80')];return _0x19466a[_0xc2b6('0x90')](_0x257925);}})[_0xc2b6('0x24')](respondWithResult(_0x4e62c5,null))[_0xc2b6('0x41')](handleError(_0x4e62c5,null));};function writeFile(_0xfbe052,_0x1864cc){return new Promise(function(_0x11c9e3,_0xebd600){fs[_0xc2b6('0x91')](_0x1864cc,_0xfbe052,function(_0x9c0148,_0x5bfc22){if(_0x9c0148){return _0xebd600(_0x9c0148);}else{return _0x11c9e3(_0x5bfc22);}});});}exports['downloadTranscribe']=function(_0x4d156d,_0x37bdfe,_0x459e25){return db[_0xc2b6('0x29')][_0xc2b6('0x7a')]({'where':{'id':_0x4d156d[_0xc2b6('0x49')]['id']}})[_0xc2b6('0x24')](handleEntityNotFound(_0x37bdfe))['then'](function(_0x5176df){if(_0x5176df&&_0x5176df[_0xc2b6('0x92')]){var _0x166238=_0x5176df['fileText'];var _0x18c77e=config[_0xc2b6('0x93')]+'/server/files/transcribes/transcribe_'+_0x5176df['id']+_0xc2b6('0x94');if(fs[_0xc2b6('0x4e')](_0x18c77e)){return _0x18c77e;}return writeFile(_0x166238,_0x18c77e)[_0xc2b6('0x24')](function(){return _0x18c77e;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})[_0xc2b6('0x24')](function(_0x462093){return _0x37bdfe[_0xc2b6('0x55')](_0x462093);})[_0xc2b6('0x41')](handleError(_0x37bdfe));}; \ No newline at end of file +var _0xc6f2=['name','send','index','rawAttributes','fieldName','type','key','differenceBy','format','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','VoiceRecording','findAll','rows','catch','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','Name','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','apply','update','then','destroy','error','stack'];(function(_0x8789ec,_0x2d1f27){var _0x4b126c=function(_0x524752){while(--_0x524752){_0x8789ec['push'](_0x8789ec['shift']());}};_0x4b126c(++_0x2d1f27);}(_0xc6f2,0x18a));var _0x2c6f=function(_0x1ed078,_0x2b042d){_0x1ed078=_0x1ed078-0x0;var _0x4cefe3=_0xc6f2[_0x1ed078];return _0x4cefe3;};'use strict';var emlformat=require(_0x2c6f('0x0'));var rimraf=require(_0x2c6f('0x1'));var zipdir=require(_0x2c6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c6f('0x4'));var util=require(_0x2c6f('0x5'));var path=require(_0x2c6f('0x6'));var sox=require(_0x2c6f('0x7'));var csv=require(_0x2c6f('0x8'));var ejs=require(_0x2c6f('0x9'));var fs=require('fs');var fs_extra=require(_0x2c6f('0xa'));var _=require('lodash');var squel=require(_0x2c6f('0xb'));var crypto=require(_0x2c6f('0xc'));var jsforce=require(_0x2c6f('0xd'));var deskjs=require(_0x2c6f('0xe'));var toCsv=require(_0x2c6f('0x8'));var querystring=require(_0x2c6f('0xf'));var Papa=require(_0x2c6f('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x2c6f('0x11'));var Redis=require(_0x2c6f('0x12'));var authService=require(_0x2c6f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2c6f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c6f('0x15'))('api');var utils=require(_0x2c6f('0x16'));var config=require(_0x2c6f('0x17'));var licenseUtil=require(_0x2c6f('0x18'));var db=require(_0x2c6f('0x19'))['db'];function respondWithStatusCode(_0x18a156,_0x54e9af){_0x54e9af=_0x54e9af||0xcc;return function(_0x116078){if(_0x116078){return _0x18a156[_0x2c6f('0x1a')](_0x54e9af);}return _0x18a156['status'](_0x54e9af)[_0x2c6f('0x1b')]();};}function respondWithResult(_0x53c95b,_0x551c99){_0x551c99=_0x551c99||0xc8;return function(_0x1d4f39){if(_0x1d4f39){return _0x53c95b['status'](_0x551c99)['json'](_0x1d4f39);}};}function respondWithFilteredResult(_0x13562b,_0x98c04d){return function(_0xf7346d){if(_0xf7346d){var _0x4fc50b=typeof _0x98c04d['offset']===_0x2c6f('0x1c')&&typeof _0x98c04d[_0x2c6f('0x1d')]===_0x2c6f('0x1c');var _0x462ff2=_0xf7346d[_0x2c6f('0x1e')];var _0x4653d8=_0x4fc50b?0x0:_0x98c04d[_0x2c6f('0x1f')];var _0x4e2183=_0x4fc50b?_0xf7346d[_0x2c6f('0x1e')]:_0x98c04d['offset']+_0x98c04d[_0x2c6f('0x1d')];var _0x59e20f;if(_0x4e2183>=_0x462ff2){_0x4e2183=_0x462ff2;_0x59e20f=0xc8;}else{_0x59e20f=0xce;}_0x13562b[_0x2c6f('0x20')](_0x59e20f);return _0x13562b[_0x2c6f('0x21')](_0x2c6f('0x22'),_0x4653d8+'-'+_0x4e2183+'/'+_0x462ff2)['json'](_0xf7346d);}return null;};}function patchUpdates(_0x13f12d){return function(_0x545104){try{jsonpatch[_0x2c6f('0x23')](_0x545104,_0x13f12d,!![]);}catch(_0x47509c){return BPromise['reject'](_0x47509c);}return _0x545104['save']();};}function saveUpdates(_0x704aeb,_0x161d61){return function(_0x24f26c){if(_0x24f26c){return _0x24f26c[_0x2c6f('0x24')](_0x704aeb)[_0x2c6f('0x25')](function(_0x24f1a2){return _0x24f1a2;});}return null;};}function removeEntity(_0x3fab4c,_0x16363e){return function(_0xf1b8ae){if(_0xf1b8ae){return _0xf1b8ae[_0x2c6f('0x26')]()[_0x2c6f('0x25')](function(){_0x3fab4c[_0x2c6f('0x20')](0xcc)[_0x2c6f('0x1b')]();});}};}function handleEntityNotFound(_0x374e40,_0x44b346){return function(_0x2e903c){if(!_0x2e903c){_0x374e40[_0x2c6f('0x1a')](0x194);}return _0x2e903c;};}function handleError(_0x209a6d,_0x1e78b3){_0x1e78b3=_0x1e78b3||0x1f4;return function(_0x17e8c7){logger[_0x2c6f('0x27')](_0x17e8c7[_0x2c6f('0x28')]);if(_0x17e8c7[_0x2c6f('0x29')]){delete _0x17e8c7[_0x2c6f('0x29')];}_0x209a6d[_0x2c6f('0x20')](_0x1e78b3)[_0x2c6f('0x2a')](_0x17e8c7);};}exports[_0x2c6f('0x2b')]=function(_0xe8fe4e,_0x3e80c2){var _0x15357d={},_0x5e3d63={},_0xb66ed3={'count':0x0,'rows':[]};var _0x27ad77=_['map'](db['VoiceRecording'][_0x2c6f('0x2c')],function(_0x3b12d9){return{'name':_0x3b12d9[_0x2c6f('0x2d')],'type':_0x3b12d9[_0x2c6f('0x2e')][_0x2c6f('0x2f')]};});_0x5e3d63['model']=_[_0x2c6f('0x30')](_['map'](_0x27ad77,_0x2c6f('0x29')),[_0x2c6f('0x31')]);_0x5e3d63['query']=_[_0x2c6f('0x32')](_0xe8fe4e[_0x2c6f('0x33')]);_0x5e3d63[_0x2c6f('0x34')]=_['intersection'](_0x5e3d63['model'],_0x5e3d63[_0x2c6f('0x33')]);_0x15357d[_0x2c6f('0x35')]=_[_0x2c6f('0x36')](_0x5e3d63[_0x2c6f('0x37')],qs['fields'](_0xe8fe4e['query'][_0x2c6f('0x38')]));_0x15357d['attributes']=_0x15357d['attributes'][_0x2c6f('0x39')]?_0x15357d[_0x2c6f('0x35')]:_0x5e3d63[_0x2c6f('0x37')];if(!_0xe8fe4e[_0x2c6f('0x33')][_0x2c6f('0x3a')](_0x2c6f('0x3b'))){_0x15357d['limit']=qs['limit'](_0xe8fe4e[_0x2c6f('0x33')][_0x2c6f('0x1d')]);_0x15357d[_0x2c6f('0x1f')]=qs[_0x2c6f('0x1f')](_0xe8fe4e['query'][_0x2c6f('0x1f')]);}_0x15357d[_0x2c6f('0x3c')]=qs[_0x2c6f('0x3d')](_0xe8fe4e[_0x2c6f('0x33')][_0x2c6f('0x3d')]);_0x15357d[_0x2c6f('0x3e')]=qs[_0x2c6f('0x34')](_['pick'](_0xe8fe4e[_0x2c6f('0x33')],_0x5e3d63[_0x2c6f('0x34')]),_0x27ad77);if(_0xe8fe4e['query'][_0x2c6f('0x3f')]){_0x15357d[_0x2c6f('0x3e')]=_[_0x2c6f('0x40')](_0x15357d[_0x2c6f('0x3e')],{'$or':_[_0x2c6f('0x41')](_0x27ad77,function(_0x5c329f){if(_0x5c329f[_0x2c6f('0x2e')]!=='VIRTUAL'){var _0x5b5b55={};_0x5b5b55[_0x5c329f['name']]={'$like':'%'+_0xe8fe4e['query']['filter']+'%'};return _0x5b5b55;}})});}_0x15357d=_[_0x2c6f('0x40')]({},_0x15357d,_0xe8fe4e[_0x2c6f('0x42')]);var _0x2a6b54={'where':_0x15357d['where']};return db['VoiceRecording']['count'](_0x2a6b54)[_0x2c6f('0x25')](function(_0x56f51a){_0xb66ed3[_0x2c6f('0x1e')]=_0x56f51a;if(_0xe8fe4e[_0x2c6f('0x33')][_0x2c6f('0x43')]){_0x15357d[_0x2c6f('0x44')]=[{'all':!![]}];}return db[_0x2c6f('0x45')][_0x2c6f('0x46')](_0x15357d);})[_0x2c6f('0x25')](function(_0x287791){_0xb66ed3[_0x2c6f('0x47')]=_0x287791;return _0xb66ed3;})['then'](respondWithFilteredResult(_0x3e80c2,_0x15357d))[_0x2c6f('0x48')](handleError(_0x3e80c2,null));};exports['show']=function(_0x284c91,_0x145b9a){var _0x2cdf42={'raw':![],'where':{'id':_0x284c91[_0x2c6f('0x49')]['id']}},_0x5cc81c={};_0x5cc81c[_0x2c6f('0x37')]=_['keys'](db[_0x2c6f('0x45')][_0x2c6f('0x2c')]);_0x5cc81c[_0x2c6f('0x33')]=_[_0x2c6f('0x32')](_0x284c91[_0x2c6f('0x33')]);_0x5cc81c['filters']=_['intersection'](_0x5cc81c[_0x2c6f('0x37')],_0x5cc81c[_0x2c6f('0x33')]);_0x2cdf42['attributes']=_[_0x2c6f('0x36')](_0x5cc81c['model'],qs['fields'](_0x284c91['query']['fields']));_0x2cdf42[_0x2c6f('0x35')]=_0x2cdf42['attributes'][_0x2c6f('0x39')]?_0x2cdf42[_0x2c6f('0x35')]:_0x5cc81c['model'];if(_0x284c91['query'][_0x2c6f('0x43')]){_0x2cdf42[_0x2c6f('0x44')]=[{'all':!![]}];}_0x2cdf42=_[_0x2c6f('0x40')]({},_0x2cdf42,_0x284c91[_0x2c6f('0x42')]);return db[_0x2c6f('0x45')]['find'](_0x2cdf42)[_0x2c6f('0x25')](handleEntityNotFound(_0x145b9a,null))[_0x2c6f('0x25')](respondWithResult(_0x145b9a,null))[_0x2c6f('0x48')](handleError(_0x145b9a,null));};exports[_0x2c6f('0x4a')]=function(_0x3e63e8,_0x2b7926){return db[_0x2c6f('0x45')]['create'](_0x3e63e8[_0x2c6f('0x4b')],{})['then'](respondWithResult(_0x2b7926,0xc9))['catch'](handleError(_0x2b7926,null));};exports[_0x2c6f('0x24')]=function(_0x3dbdba,_0x3883f4){if(_0x3dbdba['body']['id']){delete _0x3dbdba[_0x2c6f('0x4b')]['id'];}return db[_0x2c6f('0x45')][_0x2c6f('0x4c')]({'where':{'id':_0x3dbdba['params']['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x3883f4,null))[_0x2c6f('0x25')](saveUpdates(_0x3dbdba[_0x2c6f('0x4b')],null))['then'](respondWithResult(_0x3883f4,null))[_0x2c6f('0x48')](handleError(_0x3883f4,null));};exports[_0x2c6f('0x4d')]=function(_0x122177,_0xb05702){return db[_0x2c6f('0x45')]['describe']()[_0x2c6f('0x25')](respondWithResult(_0xb05702,null))[_0x2c6f('0x48')](handleError(_0xb05702,null));};exports[_0x2c6f('0x4e')]=function(_0x336749,_0x2ec761,_0x19bccc){var _0x2163bb=require(_0x2c6f('0x4f'));var _0x108eaa=![];var _0x2391af={};if(_0x336749[_0x2c6f('0x33')]['type']&&_0x336749[_0x2c6f('0x33')][_0x2c6f('0x2e')]===_0x2c6f('0x50')){_0x2391af[_0x2c6f('0x50')]=_0x336749[_0x2c6f('0x49')]['id'];}else{_0x2391af['id']=_0x336749[_0x2c6f('0x49')]['id'];}return db[_0x2c6f('0x45')][_0x2c6f('0x4c')]({'where':_0x2391af,'attributes':['id',_0x2c6f('0x51')],'raw':!![]})[_0x2c6f('0x25')](handleEntityNotFound(_0x2ec761,null))[_0x2c6f('0x25')](function(_0x4fae36){if(_0x4fae36){var _0x2c23ea=_0x4fae36[_0x2c6f('0x51')];var _0x31621e=util['format'](_0x2c6f('0x52'),_0x2c23ea);if(fs[_0x2c6f('0x53')](_0x31621e)){_0x108eaa=!![];return _0x2163bb[_0x2c6f('0x54')](_0x31621e,_0x2c23ea,config[_0x2c6f('0x55')][_0x2c6f('0x56')])[_0x2c6f('0x25')](function(){return _0x4fae36;});}return _0x4fae36;}})[_0x2c6f('0x25')](function(_0x3dc4b2){if(_0x3dc4b2){var _0x21cf03=_0x3dc4b2['value'];if(!fs[_0x2c6f('0x53')](_0x21cf03)){throw new db[(_0x2c6f('0x57'))][(_0x2c6f('0x58'))](_0x2c6f('0x59'));}if(_0x3dc4b2[_0x2c6f('0x5a')]){return _0x2ec761[_0x2c6f('0x4e')](_0x21cf03,_0x3dc4b2['filename']+path['extname'](_0x21cf03),function(){if(_0x108eaa){fs[_0x2c6f('0x5b')](_0x21cf03);}});}else{return _0x2ec761[_0x2c6f('0x4e')](_0x21cf03,function(_0xdb63c2){if(_0x108eaa){fs[_0x2c6f('0x5b')](_0x21cf03);}});}}})[_0x2c6f('0x48')](function(_0x227e30){if(_0x227e30[_0x2c6f('0x5c')]===_0x2c6f('0x59')){_0x2ec761[_0x2c6f('0x20')](0x194)[_0x2c6f('0x2a')](_0x2c6f('0x5d'));}else{return handleError(_0x2ec761,null);}});};exports['downloads']=function(_0x131021,_0x22f6d1,_0x5e3688){var _0x31a220=require('../../components/encryptor');var _0x8e5484=![];var _0x56456d={'$and':[db['sequelize'][_0x2c6f('0x3e')](db[_0x2c6f('0x5e')]['fn'](_0x2c6f('0x5f'),db[_0x2c6f('0x5e')][_0x2c6f('0x60')](_0x2c6f('0x50'))),_0x131021[_0x2c6f('0x33')][_0x2c6f('0x61')])]};if(_0x131021[_0x2c6f('0x33')]['type']&&_0x131021[_0x2c6f('0x33')]['type']==='uniqueid'){_0x56456d[_0x2c6f('0x62')]['push']({'uniqueid':_0x131021[_0x2c6f('0x49')]['id']});}else{_0x56456d[_0x2c6f('0x62')][_0x2c6f('0x63')]({'id':_0x131021[_0x2c6f('0x49')]['id']});}return db['VoiceRecording']['find']({'where':_0x56456d,'attributes':['id',_0x2c6f('0x51')],'raw':!![]})[_0x2c6f('0x25')](handleEntityNotFound(_0x22f6d1,null))[_0x2c6f('0x25')](function(_0x2dd927){if(_0x2dd927){var _0x5d2cfa=util[_0x2c6f('0x31')](_0x2c6f('0x52'),_0x2dd927[_0x2c6f('0x51')]);if(fs[_0x2c6f('0x53')](_0x5d2cfa)){_0x8e5484=!![];return _0x31a220[_0x2c6f('0x54')](_0x5d2cfa,_0x2dd927[_0x2c6f('0x51')],config[_0x2c6f('0x55')][_0x2c6f('0x56')])[_0x2c6f('0x25')](function(){return _0x2dd927;});}return _0x2dd927;}})[_0x2c6f('0x25')](function(_0xb32037){if(_0xb32037){if(!fs['existsSync'](_0xb32037[_0x2c6f('0x51')])){throw new db[(_0x2c6f('0x57'))][(_0x2c6f('0x58'))](_0x2c6f('0x59'));}if(_0xb32037[_0x2c6f('0x5a')]){return _0x22f6d1['download'](_0xb32037[_0x2c6f('0x51')],_0xb32037['filename']+path['extname'](_0xb32037[_0x2c6f('0x51')]),function(){if(_0x8e5484){fs['unlink'](_0xb32037[_0x2c6f('0x51')]);}});}else{return _0x22f6d1[_0x2c6f('0x4e')](_0xb32037['value'],function(_0x272524){if(_0x8e5484){fs['unlink'](_0xb32037[_0x2c6f('0x51')]);}});}}})[_0x2c6f('0x48')](handleError(_0x22f6d1,null));};exports['destroy']=function(_0x16e2d3,_0x3612ae){return db[_0x2c6f('0x45')][_0x2c6f('0x4c')]({'where':{'id':_0x16e2d3[_0x2c6f('0x49')]['id']}})[_0x2c6f('0x25')](function(_0x2b420d){if(_[_0x2c6f('0x64')](_0x2b420d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2b420d;})[_0x2c6f('0x25')](function(_0x4c4afb){var _0x5e1255=_0x4c4afb[_0x2c6f('0x51')];logger[_0x2c6f('0x65')](_0x2c6f('0x66'),_0x5e1255);if(!_[_0x2c6f('0x64')](_0x4c4afb[_0x2c6f('0x51')])&&fs[_0x2c6f('0x53')](_0x5e1255)){logger['info'](_0x2c6f('0x67')+_0x5e1255+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2c6f('0x68')](_0x5e1255);}_0x5e1255=_0x5e1255+_0x2c6f('0x69');if(!_[_0x2c6f('0x64')](_0x4c4afb['value'])&&fs[_0x2c6f('0x53')](_0x5e1255)){logger[_0x2c6f('0x65')](_0x2c6f('0x67')+_0x5e1255+_0x2c6f('0x6a'));fs[_0x2c6f('0x68')](_0x5e1255);}return _0x4c4afb;})[_0x2c6f('0x25')](function(_0x4150e7){if(!_0x4150e7)throw new InternalError();return _0x4150e7[_0x2c6f('0x26')]();})['then'](function(){_0x3612ae[_0x2c6f('0x20')](0xcc)[_0x2c6f('0x1b')]();})[_0x2c6f('0x48')](handleError(_0x3612ae,null));};function getBucketslist(_0x2c6ef4,_0x31dc01,_0x37258b){return new Promise(function(_0x29e148,_0x2ba575){var _0x1b0652=new AWS['S3']({'accessKeyId':_0x31dc01,'secretAccessKey':_0x2c6ef4,'region':_0x37258b});_0x1b0652[_0x2c6f('0x6b')]({},function(_0x3c13ac,_0x3971f7){if(_0x3c13ac){return _0x2ba575(_0x3c13ac);}else{return _0x29e148(_0x3971f7);}});});}function createBucket(_0x4cc432,_0x286678,_0x1f3031,_0xa65d61){return new Promise(function(_0x40398a,_0x2945ee){var _0x4b0a61=new AWS['S3']({'accessKeyId':_0x286678,'secretAccessKey':_0x4cc432,'region':_0x1f3031});_0x4b0a61[_0x2c6f('0x6c')]({'Bucket':_0xa65d61},function(_0x45a497,_0x4989d9){if(_0x45a497){return _0x2945ee(_0x45a497);}else{return _0x40398a(_0x4989d9);}});});}function uploadFile(_0x2b7e09,_0x537d88,_0x25eccb,_0x4b8eee,_0x21f5dc,_0x106c88){return new Promise(function(_0x16e680,_0x50ec5a){var _0x28ac6a=new AWS['S3']({'accessKeyId':_0x537d88,'secretAccessKey':_0x2b7e09,'region':_0x25eccb});_0x28ac6a[_0x2c6f('0x6d')]({'Bucket':_0x4b8eee,'Key':_0x21f5dc,'Body':_0x106c88},function(_0x30f0fd,_0xd47904){if(_0x30f0fd){return _0x50ec5a(_0x30f0fd);}else{return _0x16e680(_0xd47904);}});});}function startTranscribe(_0x4f79fb,_0x17472b,_0x5f5846,_0x47cc48,_0x26993c,_0x206e70){return new Promise(function(_0x14de47,_0x28b87c){var _0x39fc49=new AWS[(_0x2c6f('0x6e'))]({'accessKeyId':_0x17472b,'secretAccessKey':_0x4f79fb,'region':_0x5f5846});_0x39fc49[_0x2c6f('0x6f')]({'TranscriptionJobName':_0x47cc48,'LanguageCode':_0x26993c,'Media':{'MediaFileUri':_0x206e70}},function(_0x483a7f,_0x178173){if(_0x483a7f){return _0x28b87c(_0x483a7f);}else{return _0x14de47(_0x178173);}});});}function transcribe(_0x34d1a1,_0x3b489e,_0x432302,_0x36f70d,_0x93c991,_0x2a2278,_0x2e364e){return new Promise(function(_0x4ef1ca,_0x33516d){var _0x4dfafa={};logger[_0x2c6f('0x65')](util[_0x2c6f('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x34d1a1,_0x93c991));return uploadFile(_0x3b489e,_0x432302,_0x36f70d,_0x93c991,path[_0x2c6f('0x70')](_0x2a2278),fs[_0x2c6f('0x71')](_0x2a2278))[_0x2c6f('0x25')](function(_0x4f2e80){logger[_0x2c6f('0x65')](util['format'](_0x2c6f('0x72'),_0x34d1a1,_0x93c991,_0x4f2e80[_0x2c6f('0x73')]));_0x4dfafa[_0x2c6f('0x74')]=_0x4f2e80['Bucket'];_0x4dfafa[_0x2c6f('0x75')]=_0x4f2e80['Location'];logger[_0x2c6f('0x65')](util[_0x2c6f('0x31')](_0x2c6f('0x76'),_0x34d1a1));return startTranscribe(_0x3b489e,_0x432302,_0x36f70d,uuidv4(),_0x2e364e,_0x4f2e80[_0x2c6f('0x73')]);})[_0x2c6f('0x25')](function(_0x18a2b3){logger[_0x2c6f('0x65')](util[_0x2c6f('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x34d1a1,_0x18a2b3['TranscriptionJob']['TranscriptionJobName']));_0x4dfafa[_0x2c6f('0x77')]=_0x18a2b3[_0x2c6f('0x78')]['TranscriptionJobName'];_0x4dfafa[_0x2c6f('0x79')]=_0x18a2b3[_0x2c6f('0x78')]['TranscriptionJobStatus'];return _0x4ef1ca(_0x4dfafa);})['catch'](function(_0x4106aa){return _0x33516d(_0x4106aa);});});}exports[_0x2c6f('0x7a')]=function(_0x4ccc9c,_0x50a121,_0x34b28d){var _0x2aacd7;var _0x546bb8;var _0x490ff8;var _0xa5199e=require('../../components/encryptor');return db[_0x2c6f('0x45')][_0x2c6f('0x7b')]({'where':{'id':_0x4ccc9c[_0x2c6f('0x49')]['id']}})[_0x2c6f('0x25')](function(_0x1bd5ac){if(_0x1bd5ac){var _0x303349=util[_0x2c6f('0x31')](_0x2c6f('0x52'),_0x1bd5ac['value']);if(fs[_0x2c6f('0x53')](_0x303349)){cypher=!![];return _0xa5199e['decryptFile'](_0x303349,_0x1bd5ac[_0x2c6f('0x51')],config[_0x2c6f('0x55')][_0x2c6f('0x56')])['then'](function(){return _0x1bd5ac;});}return _0x1bd5ac;}})[_0x2c6f('0x25')](function(_0xf2886a){if(!_0xf2886a){throw new db['Sequelize'][(_0x2c6f('0x58'))](_0x2c6f('0x7c'));}_0x546bb8=_0xf2886a;return db[_0x2c6f('0x7d')]['findOne']({'where':{'id':0x1}});})[_0x2c6f('0x25')](handleEntityNotFound(_0x50a121,null))[_0x2c6f('0x25')](function(_0x2f7eb1){if(_0x2f7eb1){_0x2aacd7=_0x2f7eb1;if(!_0x2aacd7['transcribe']||!_0x2aacd7[_0x2c6f('0x7e')]||!_0x2aacd7[_0x2c6f('0x7f')]||!_0x2aacd7[_0x2c6f('0x80')]||!_0x2aacd7[_0x2c6f('0x74')]){throw new db['Sequelize'][(_0x2c6f('0x58'))](_0x2c6f('0x81'));}if(_0x4ccc9c[_0x2c6f('0x4b')][_0x2c6f('0x82')]&&(!_0x2aacd7['sentiment']||!_0x2aacd7['sentimentAccountId']||!_0x2aacd7[_0x2c6f('0x83')]||!_0x2aacd7[_0x2c6f('0x80')]||!_0x2aacd7[_0x2c6f('0x74')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x2c6f('0x84')][_0x2c6f('0x7b')]({'where':{'id':_0x2aacd7[_0x2c6f('0x7e')]}});}})['then'](function(_0x2a4487){if(!_0x2a4487){throw new db[(_0x2c6f('0x57'))][(_0x2c6f('0x58'))](_0x2c6f('0x85'));}if(!_0x2a4487['data1']||!_0x2a4487[_0x2c6f('0x86')]){throw new db[(_0x2c6f('0x57'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x490ff8=_0x2a4487;return getBucketslist(_0x490ff8[_0x2c6f('0x87')],_0x490ff8['data2'],_0x2aacd7[_0x2c6f('0x7f')]);})[_0x2c6f('0x25')](function(_0x54f27d){if(_0x54f27d&&_0x54f27d['Buckets']){var _0x1bdc48=_[_0x2c6f('0x4c')](_0x54f27d['Buckets'],function(_0x5a6ee6){return _0x5a6ee6[_0x2c6f('0x88')]===_0x2aacd7[_0x2c6f('0x74')];});if(!_0x1bdc48){logger[_0x2c6f('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4ccc9c[_0x2c6f('0x49')]['id'],_0x2aacd7['bucket']));return createBucket(_0x490ff8[_0x2c6f('0x87')],_0x490ff8[_0x2c6f('0x86')],_0x2aacd7['transcribeRegion'],_0x2aacd7[_0x2c6f('0x74')]);}logger['info'](util[_0x2c6f('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4ccc9c['params']['id'],_0x2aacd7['bucket']));return;}})['then'](function(_0x472bf7){if(_0x546bb8['transcribeStatus']==='NEW'){return transcribe(_0x4ccc9c[_0x2c6f('0x49')]['id'],_0x490ff8['data1'],_0x490ff8['data2'],_0x2aacd7[_0x2c6f('0x7f')],_0x2aacd7['bucket'],_0x546bb8[_0x2c6f('0x51')],_0x2aacd7[_0x2c6f('0x80')]);}else{logger[_0x2c6f('0x65')](util[_0x2c6f('0x31')](_0x2c6f('0x89'),_0x4ccc9c['params']['id']));return{'transcribeStatus':_0x2c6f('0x8a')};}})[_0x2c6f('0x25')](function(_0x3f153b){if(_0x3f153b){_0x3f153b[_0x2c6f('0x8b')]=_0x4ccc9c[_0x2c6f('0x4b')][_0x2c6f('0x82')];return _0x546bb8[_0x2c6f('0x8c')](_0x3f153b);}})[_0x2c6f('0x25')](respondWithResult(_0x50a121,null))[_0x2c6f('0x48')](handleError(_0x50a121,null));};function writeFile(_0x2f22c1,_0x4c88b2){return new Promise(function(_0x3bd844,_0x4b4e8c){fs['writeFile'](_0x4c88b2,_0x2f22c1,function(_0x2de055,_0x3d33fa){if(_0x2de055){return _0x4b4e8c(_0x2de055);}else{return _0x3bd844(_0x3d33fa);}});});}exports[_0x2c6f('0x8d')]=function(_0x337600,_0x533b2e,_0x32e419){return db[_0x2c6f('0x45')][_0x2c6f('0x7b')]({'where':{'id':_0x337600[_0x2c6f('0x49')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x533b2e))[_0x2c6f('0x25')](function(_0x3291a6){if(_0x3291a6&&_0x3291a6[_0x2c6f('0x8e')]){var _0x16066b=_0x3291a6['fileText'];var _0x5ac29e=config[_0x2c6f('0x8f')]+_0x2c6f('0x90')+_0x3291a6['id']+'.txt';if(fs[_0x2c6f('0x53')](_0x5ac29e)){return _0x5ac29e;}return writeFile(_0x16066b,_0x5ac29e)[_0x2c6f('0x25')](function(){return _0x5ac29e;});}else{throw new db[(_0x2c6f('0x57'))][(_0x2c6f('0x58'))]('Transcript\x20not\x20available');}})[_0x2c6f('0x25')](function(_0x55ea7b){return _0x533b2e['download'](_0x55ea7b);})[_0x2c6f('0x48')](handleError(_0x533b2e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 48476ac..a44e33f 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 _0xbc95=['moment','rimraf','../../config/environment','VoiceRecording','uniqueid','lodash','util','../../config/logger','api'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x5ba8a2,_0x2353f2){_0x5ba8a2=_0x5ba8a2-0x0;var _0x343652=_0xbc95[_0x5ba8a2];return _0x343652;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var logger=require(_0x5bc9('0x2'))(_0x5bc9('0x3'));var moment=require(_0x5bc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc9('0x5'));var config=require(_0x5bc9('0x6'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x5cca07,_0x889a0e){return _0x5cca07['define'](_0x5bc9('0x7'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5bc9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x192f=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x400261,_0x18cbaa){var _0xdcd1a8=function(_0x2b3ee8){while(--_0x2b3ee8){_0x400261['push'](_0x400261['shift']());}};_0xdcd1a8(++_0x18cbaa);}(_0x192f,0xd3));var _0xf192=function(_0x4eb8dd,_0x3990fd){_0x4eb8dd=_0x4eb8dd-0x0;var _0x23116f=_0x192f[_0x4eb8dd];return _0x23116f;};'use strict';var _=require(_0xf192('0x0'));var util=require(_0xf192('0x1'));var logger=require(_0xf192('0x2'))('api');var moment=require(_0xf192('0x3'));var BPromise=require(_0xf192('0x4'));var rp=require(_0xf192('0x5'));var fs=require('fs');var path=require(_0xf192('0x6'));var rimraf=require(_0xf192('0x7'));var config=require(_0xf192('0x8'));var attributes=require(_0xf192('0x9'));module[_0xf192('0xa')]=function(_0x23d13e,_0x5d5f0d){return _0x23d13e[_0xf192('0xb')](_0xf192('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf192('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 39a3934..be5ea15 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 _0x583c=['options','raw','where','attributes','limit','debug','stringify','catch','Setting','callRecordingEncryption','create','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','UpdateVoiceRecording','VoiceRecording','body'];(function(_0x4840f0,_0x25facf){var _0x39edf5=function(_0x58b4eb){while(--_0x58b4eb){_0x4840f0['push'](_0x4840f0['shift']());}};_0x39edf5(++_0x25facf);}(_0x583c,0x12b));var _0xc583=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x583c[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['update'](_0x8a2d84[_0xc583('0x14')],{'raw':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x17')]||null:null,'attributes':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x18')]||null:null,'limit':_0x8a2d84[_0xc583('0x15')]?_0x8a2d84[_0xc583('0x15')][_0xc583('0x19')]||null:null})['then'](function(_0x542256){logger[_0xc583('0xb')](_0xc583('0x12'),_0x8a2d84);logger[_0xc583('0x1a')]('UpdateVoiceRecording',_0x8a2d84,JSON[_0xc583('0x1b')](_0x542256));_0x36e0fd(_0x542256);})[_0xc583('0x1c')](function(_0x37f156){logger[_0xc583('0xf')](_0xc583('0x12'),_0x37f156['message'],_0x8a2d84);_0x5433ec(_0x12aac2['error'](0x1f4,_0x37f156[_0xc583('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x45ef74){var _0xcbe9b2=this;return new Promise(function(_0xbabf24,_0x1e7809){var _0x24aab5=require('../../components/encryptor');var _0x2dafb4;return db[_0xc583('0x1d')]['findOne']({'attributes':['id',_0xc583('0x1e')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x2c9088){_0x2dafb4=_0x2c9088;return db[_0xc583('0x13')][_0xc583('0x1f')](_0x45ef74[_0xc583('0x14')]);})[_0xc583('0xa')](function(_0x19079b){if(_0x2dafb4[_0xc583('0x1e')]&&fs['existsSync'](_0x19079b[_0xc583('0x20')])){var _0x390bc3=util[_0xc583('0x21')](_0xc583('0x22'),_0x19079b[_0xc583('0x20')]);return _0x24aab5[_0xc583('0x23')](_0x19079b['value'],_0x390bc3,config[_0xc583('0x24')]['recording'])['then'](function(){fs[_0xc583('0x25')](_0x19079b[_0xc583('0x20')]);logger[_0xc583('0xb')](_0xc583('0x26'));return _0x19079b;});}return _0x19079b;})[_0xc583('0xa')](function(_0x4a9679){logger[_0xc583('0xb')](_0xc583('0x27'),_0x45ef74);logger[_0xc583('0x1a')]('CreateVoiceRecording',_0x45ef74,JSON[_0xc583('0x1b')](_0x4a9679));_0xbabf24(_0x4a9679);})['catch'](function(_0x1aa62a){logger[_0xc583('0xf')](_0xc583('0x27'),_0x1aa62a[_0xc583('0x10')],_0x45ef74);_0x1e7809(_0xcbe9b2[_0xc583('0xf')](0x1f4,_0x1aa62a['message']));});});}; \ No newline at end of file +var _0x57ca=['update','body','options','where','limit','then','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording'];(function(_0x9620ac,_0x1dd664){var _0x561bd9=function(_0xfd8ffb){while(--_0xfd8ffb){_0x9620ac['push'](_0x9620ac['shift']());}};_0x561bd9(++_0x1dd664);}(_0x57ca,0x108));var _0xa57c=function(_0x423fd6,_0x23c405){_0x423fd6=_0x423fd6-0x0;var _0x344bc6=_0x57ca[_0x423fd6];return _0x344bc6;};'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')]('VoiceRecording,\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')]('VoiceRecording,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});}exports[_0xa57c('0x15')]=function(_0x3d781d){var _0x93462c=this;return new Promise(function(_0xe3d505,_0x1fd0d8){return db[_0xa57c('0x16')][_0xa57c('0x17')](_0x3d781d[_0xa57c('0x18')],{'raw':_0x3d781d['options']?_0x3d781d[_0xa57c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d781d['options']?_0x3d781d[_0xa57c('0x19')][_0xa57c('0x1a')]||null:null,'attributes':_0x3d781d[_0xa57c('0x19')]?_0x3d781d[_0xa57c('0x19')]['attributes']||null:null,'limit':_0x3d781d[_0xa57c('0x19')]?_0x3d781d[_0xa57c('0x19')][_0xa57c('0x1b')]||null:null})[_0xa57c('0x1c')](function(_0x3bb969){logger[_0xa57c('0xc')](_0xa57c('0x15'),_0x3d781d);logger[_0xa57c('0x1d')](_0xa57c('0x15'),_0x3d781d,JSON[_0xa57c('0x1e')](_0x3bb969));_0xe3d505(_0x3bb969);})[_0xa57c('0x14')](function(_0x1e7f7a){logger[_0xa57c('0xf')](_0xa57c('0x15'),_0x1e7f7a[_0xa57c('0x12')],_0x3d781d);_0x1fd0d8(_0x93462c['error'](0x1f4,_0x1e7f7a[_0xa57c('0x12')]));});});};exports[_0xa57c('0x1f')]=function(_0x27884d){var _0x5228b9=this;return new Promise(function(_0x315ad7,_0x1e8e45){var _0x8ee1c0=require(_0xa57c('0x20'));var _0x337f97;return db[_0xa57c('0x21')]['findOne']({'attributes':['id',_0xa57c('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54a18b){_0x337f97=_0x54a18b;return db[_0xa57c('0x16')][_0xa57c('0x23')](_0x27884d['body']);})[_0xa57c('0x1c')](function(_0x1ef331){if(_0x337f97[_0xa57c('0x22')]&&fs['existsSync'](_0x1ef331[_0xa57c('0x24')])){var _0x58d46f=util[_0xa57c('0x25')]('%s.cypher',_0x1ef331[_0xa57c('0x24')]);return _0x8ee1c0['encryptFile'](_0x1ef331[_0xa57c('0x24')],_0x58d46f,config['secrets'][_0xa57c('0x26')])[_0xa57c('0x1c')](function(){fs[_0xa57c('0x27')](_0x1ef331[_0xa57c('0x24')]);logger[_0xa57c('0xc')](_0xa57c('0x28'));return _0x1ef331;});}return _0x1ef331;})[_0xa57c('0x1c')](function(_0x5aa91e){logger[_0xa57c('0xc')]('CreateVoiceRecording',_0x27884d);logger[_0xa57c('0x1d')](_0xa57c('0x1f'),_0x27884d,JSON[_0xa57c('0x1e')](_0x5aa91e));_0x315ad7(_0x5aa91e);})['catch'](function(_0x289174){logger['error'](_0xa57c('0x1f'),_0x289174['message'],_0x27884d);_0x1e8e45(_0x5228b9[_0xa57c('0xf')](0x1f4,_0x289174['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5bf4179..7f8bfbc 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 _0x7f81=['post','create','/:id','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','show'];(function(_0x5b0116,_0x5ce6c3){var _0x30b871=function(_0x463ab2){while(--_0x463ab2){_0x5b0116['push'](_0x5b0116['shift']());}};_0x30b871(++_0x5ce6c3);}(_0x7f81,0x1b5));var _0x17f8=function(_0x295e65,_0x75dcbc){_0x295e65=_0x295e65-0x0;var _0x5a304d=_0x7f81[_0x295e65];return _0x5a304d;};'use strict';var multer=require('multer');var util=require(_0x17f8('0x0'));var path=require(_0x17f8('0x1'));var timeout=require(_0x17f8('0x2'));var express=require('express');var router=express[_0x17f8('0x3')]();var fs_extra=require(_0x17f8('0x4'));var auth=require(_0x17f8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x17f8('0x6'));router['get']('/',auth[_0x17f8('0x7')](),controller[_0x17f8('0x8')]);router[_0x17f8('0x9')](_0x17f8('0xa'),auth['isAuthenticated'](),controller[_0x17f8('0xb')]);router[_0x17f8('0x9')]('/:id',auth[_0x17f8('0x7')](),controller[_0x17f8('0xc')]);router[_0x17f8('0xd')]('/',auth[_0x17f8('0x7')](),controller[_0x17f8('0xe')]);router['put'](_0x17f8('0xf'),auth['isAuthenticated'](),controller[_0x17f8('0x10')]);router[_0x17f8('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ce6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','connect-timeout','express','Router','fs-extra'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x5ce6,0x114));var _0x65ce=function(_0x552c27,_0x478dc2){_0x552c27=_0x552c27-0x0;var _0x2a0922=_0x5ce6[_0x552c27];return _0x2a0922;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x65ce('0x0'));var express=require(_0x65ce('0x1'));var router=express[_0x65ce('0x2')]();var fs_extra=require(_0x65ce('0x3'));var auth=require(_0x65ce('0x4'));var interaction=require(_0x65ce('0x5'));var config=require(_0x65ce('0x6'));var controller=require(_0x65ce('0x7'));router[_0x65ce('0x8')]('/',auth[_0x65ce('0x9')](),controller['index']);router[_0x65ce('0x8')](_0x65ce('0xa'),auth[_0x65ce('0x9')](),controller[_0x65ce('0xb')]);router[_0x65ce('0x8')](_0x65ce('0xc'),auth[_0x65ce('0x9')](),controller[_0x65ce('0xd')]);router[_0x65ce('0xe')]('/',auth[_0x65ce('0x9')](),controller[_0x65ce('0xf')]);router[_0x65ce('0x10')]('/:id',auth[_0x65ce('0x9')](),controller[_0x65ce('0x11')]);router[_0x65ce('0x12')](_0x65ce('0xc'),auth[_0x65ce('0x9')](),controller[_0x65ce('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 84ac8e5..8c66d31 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 _0xd948=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd948,0xa4));var _0x8d94=function(_0x3baaf2,_0x2d906f){_0x3baaf2=_0x3baaf2-0x0;var _0x3914b3=_0xd948[_0x3baaf2];return _0x3914b3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8d94('0x0'));module[_0x8d94('0x1')]={'type':{'type':Sequelize[_0x8d94('0x2')](_0x8d94('0x3'),_0x8d94('0x4'))},'result':{'type':Sequelize[_0x8d94('0x5')]},'transfererchannel':{'type':Sequelize[_0x8d94('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8d94('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8d94('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8d94('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8d94('0x5')]},'transferercontext':{'type':Sequelize[_0x8d94('0x5')]},'transfererexten':{'type':Sequelize[_0x8d94('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8d94('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x8d94('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8d94('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x8d94('0x5')]},'transfereecontext':{'type':Sequelize[_0x8d94('0x5')]},'transfereeexten':{'type':Sequelize[_0x8d94('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8d94('0x5')]},'isexternal':{'type':Sequelize[_0x8d94('0x2')](_0x8d94('0x6'),'No')},'context':{'type':Sequelize[_0x8d94('0x5')]},'extension':{'type':Sequelize[_0x8d94('0x5')]}}; \ No newline at end of file +var _0xc4b1=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x570dde,_0x28aa86){var _0x8e5b39=function(_0x8c3913){while(--_0x8c3913){_0x570dde['push'](_0x570dde['shift']());}};_0x8e5b39(++_0x28aa86);}(_0xc4b1,0xb7));var _0x1c4b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc4b1[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x1c4b('0x0'));var moment=require(_0x1c4b('0x1'));module[_0x1c4b('0x2')]={'type':{'type':Sequelize[_0x1c4b('0x3')](_0x1c4b('0x4'),_0x1c4b('0x5'))},'result':{'type':Sequelize[_0x1c4b('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x1c4b('0x6')]},'transferercalleridname':{'type':Sequelize[_0x1c4b('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1c4b('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1c4b('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x1c4b('0x6')]},'transfererexten':{'type':Sequelize[_0x1c4b('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1c4b('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x1c4b('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x1c4b('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x1c4b('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x1c4b('0x6')]},'transfereecontext':{'type':Sequelize[_0x1c4b('0x6')]},'transfereeexten':{'type':Sequelize[_0x1c4b('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x1c4b('0x6')]},'isexternal':{'type':Sequelize[_0x1c4b('0x3')](_0x1c4b('0x7'),'No')},'context':{'type':Sequelize[_0x1c4b('0x6')]},'extension':{'type':Sequelize[_0x1c4b('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 169c8c7..d7f0c9b 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 _0x9766=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','name','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','find','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x39a5e9,_0x5906dd){var _0x1d5312=function(_0x7a8330){while(--_0x7a8330){_0x39a5e9['push'](_0x39a5e9['shift']());}};_0x1d5312(++_0x5906dd);}(_0x9766,0xca));var _0x6976=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x9766[_0x4bd06e];return _0x85ebb;};'use strict';var emlformat=require(_0x6976('0x0'));var rimraf=require(_0x6976('0x1'));var zipdir=require(_0x6976('0x2'));var jsonpatch=require(_0x6976('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6976('0x4'));var Mustache=require(_0x6976('0x5'));var util=require('util');var path=require(_0x6976('0x6'));var sox=require('sox');var csv=require(_0x6976('0x7'));var ejs=require(_0x6976('0x8'));var fs=require('fs');var fs_extra=require(_0x6976('0x9'));var _=require(_0x6976('0xa'));var squel=require(_0x6976('0xb'));var crypto=require(_0x6976('0xc'));var jsforce=require(_0x6976('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6976('0x7'));var querystring=require('querystring');var Papa=require(_0x6976('0xe'));var Redis=require(_0x6976('0xf'));var authService=require(_0x6976('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6976('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6976('0x12'))(_0x6976('0x13'));var utils=require(_0x6976('0x14'));var config=require(_0x6976('0x15'));var licenseUtil=require(_0x6976('0x16'));var db=require(_0x6976('0x17'))['db'];function respondWithStatusCode(_0x65bac2,_0x1b6ba9){_0x1b6ba9=_0x1b6ba9||0xcc;return function(_0x3601dc){if(_0x3601dc){return _0x65bac2[_0x6976('0x18')](_0x1b6ba9);}return _0x65bac2['status'](_0x1b6ba9)['end']();};}function respondWithResult(_0x45ac8d,_0x29c8c9){_0x29c8c9=_0x29c8c9||0xc8;return function(_0x498d52){if(_0x498d52){return _0x45ac8d[_0x6976('0x19')](_0x29c8c9)[_0x6976('0x1a')](_0x498d52);}};}function respondWithFilteredResult(_0x12dbc0,_0x2d14b8){return function(_0x53fd82){if(_0x53fd82){var _0x2fff7b=typeof _0x2d14b8['offset']===_0x6976('0x1b')&&typeof _0x2d14b8['limit']===_0x6976('0x1b');var _0x28cf28=_0x53fd82[_0x6976('0x1c')];var _0x2da7e0=_0x2fff7b?0x0:_0x2d14b8[_0x6976('0x1d')];var _0x4d56c7=_0x2fff7b?_0x53fd82[_0x6976('0x1c')]:_0x2d14b8[_0x6976('0x1d')]+_0x2d14b8[_0x6976('0x1e')];var _0x535ec6;if(_0x4d56c7>=_0x28cf28){_0x4d56c7=_0x28cf28;_0x535ec6=0xc8;}else{_0x535ec6=0xce;}_0x12dbc0['status'](_0x535ec6);return _0x12dbc0[_0x6976('0x1f')](_0x6976('0x20'),_0x2da7e0+'-'+_0x4d56c7+'/'+_0x28cf28)[_0x6976('0x1a')](_0x53fd82);}return null;};}function patchUpdates(_0x107295){return function(_0xa34273){try{jsonpatch[_0x6976('0x21')](_0xa34273,_0x107295,!![]);}catch(_0x398524){return BPromise['reject'](_0x398524);}return _0xa34273[_0x6976('0x22')]();};}function saveUpdates(_0x5b7aef,_0x2918e9){return function(_0x42a4b4){if(_0x42a4b4){return _0x42a4b4[_0x6976('0x23')](_0x5b7aef)[_0x6976('0x24')](function(_0x456d13){return _0x456d13;});}return null;};}function removeEntity(_0x50be3a,_0x5794f0){return function(_0x2c218e){if(_0x2c218e){return _0x2c218e[_0x6976('0x25')]()[_0x6976('0x24')](function(){_0x50be3a[_0x6976('0x19')](0xcc)[_0x6976('0x26')]();});}};}function handleEntityNotFound(_0x3ca067,_0x1796da){return function(_0x4d1b5c){if(!_0x4d1b5c){_0x3ca067['sendStatus'](0x194);}return _0x4d1b5c;};}function handleError(_0x507f34,_0x7bb800){_0x7bb800=_0x7bb800||0x1f4;return function(_0x5b7ea1){logger['error'](_0x5b7ea1['stack']);if(_0x5b7ea1[_0x6976('0x27')]){delete _0x5b7ea1['name'];}_0x507f34[_0x6976('0x19')](_0x7bb800)['send'](_0x5b7ea1);};}exports[_0x6976('0x28')]=function(_0x28124a,_0x1a201d){var _0x596c22={},_0x58fe02={},_0x3804df={'count':0x0,'rows':[]};var _0x2b238d=_['map'](db[_0x6976('0x29')][_0x6976('0x2a')],function(_0x4b3446){return{'name':_0x4b3446[_0x6976('0x2b')],'type':_0x4b3446[_0x6976('0x2c')][_0x6976('0x2d')]};});_0x58fe02[_0x6976('0x2e')]=_[_0x6976('0x2f')](_0x2b238d,_0x6976('0x27'));_0x58fe02[_0x6976('0x30')]=_[_0x6976('0x31')](_0x28124a['query']);_0x58fe02[_0x6976('0x32')]=_[_0x6976('0x33')](_0x58fe02[_0x6976('0x2e')],_0x58fe02[_0x6976('0x30')]);_0x596c22['attributes']=_['intersection'](_0x58fe02[_0x6976('0x2e')],qs[_0x6976('0x34')](_0x28124a[_0x6976('0x30')]['fields']));_0x596c22['attributes']=_0x596c22[_0x6976('0x35')][_0x6976('0x36')]?_0x596c22[_0x6976('0x35')]:_0x58fe02[_0x6976('0x2e')];if(!_0x28124a[_0x6976('0x30')]['hasOwnProperty'](_0x6976('0x37'))){_0x596c22[_0x6976('0x1e')]=qs[_0x6976('0x1e')](_0x28124a[_0x6976('0x30')][_0x6976('0x1e')]);_0x596c22[_0x6976('0x1d')]=qs[_0x6976('0x1d')](_0x28124a['query'][_0x6976('0x1d')]);}_0x596c22[_0x6976('0x38')]=qs[_0x6976('0x39')](_0x28124a[_0x6976('0x30')][_0x6976('0x39')]);_0x596c22[_0x6976('0x3a')]=qs[_0x6976('0x32')](_[_0x6976('0x3b')](_0x28124a[_0x6976('0x30')],_0x58fe02[_0x6976('0x32')]),_0x2b238d);if(_0x28124a[_0x6976('0x30')]['filter']){_0x596c22[_0x6976('0x3a')]=_[_0x6976('0x3c')](_0x596c22['where'],{'$or':_[_0x6976('0x2f')](_0x2b238d,function(_0x266ed8){if(_0x266ed8[_0x6976('0x2c')]!=='VIRTUAL'){var _0x1111f5={};_0x1111f5[_0x266ed8[_0x6976('0x27')]]={'$like':'%'+_0x28124a[_0x6976('0x30')][_0x6976('0x3d')]+'%'};return _0x1111f5;}})});}_0x596c22=_[_0x6976('0x3c')]({},_0x596c22,_0x28124a[_0x6976('0x3e')]);var _0x38a1ae={'where':_0x596c22[_0x6976('0x3a')]};return db['VoiceTransferReport'][_0x6976('0x1c')](_0x38a1ae)[_0x6976('0x24')](function(_0x255e97){_0x3804df[_0x6976('0x1c')]=_0x255e97;if(_0x28124a['query'][_0x6976('0x3f')]){_0x596c22[_0x6976('0x40')]=[{'all':!![]}];}return db[_0x6976('0x29')][_0x6976('0x41')](_0x596c22);})[_0x6976('0x24')](function(_0x48d658){_0x3804df[_0x6976('0x42')]=_0x48d658;return _0x3804df;})[_0x6976('0x24')](respondWithFilteredResult(_0x1a201d,_0x596c22))['catch'](handleError(_0x1a201d,null));};exports[_0x6976('0x43')]=function(_0x4b4c91,_0x3c4987){var _0x10843={'raw':!![],'where':{'id':_0x4b4c91['params']['id']}},_0x11d474={};_0x11d474[_0x6976('0x2e')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x11d474['query']=_[_0x6976('0x31')](_0x4b4c91[_0x6976('0x30')]);_0x11d474['filters']=_[_0x6976('0x33')](_0x11d474[_0x6976('0x2e')],_0x11d474[_0x6976('0x30')]);_0x10843[_0x6976('0x35')]=_['intersection'](_0x11d474['model'],qs[_0x6976('0x34')](_0x4b4c91[_0x6976('0x30')][_0x6976('0x34')]));_0x10843[_0x6976('0x35')]=_0x10843[_0x6976('0x35')][_0x6976('0x36')]?_0x10843[_0x6976('0x35')]:_0x11d474[_0x6976('0x2e')];if(_0x4b4c91[_0x6976('0x30')]['includeAll']){_0x10843[_0x6976('0x40')]=[{'all':!![]}];}_0x10843=_[_0x6976('0x3c')]({},_0x10843,_0x4b4c91[_0x6976('0x3e')]);return db[_0x6976('0x29')][_0x6976('0x44')](_0x10843)[_0x6976('0x24')](handleEntityNotFound(_0x3c4987,null))[_0x6976('0x24')](respondWithResult(_0x3c4987,null))['catch'](handleError(_0x3c4987,null));};exports[_0x6976('0x45')]=function(_0x3af80d,_0x420710){return db[_0x6976('0x29')][_0x6976('0x45')](_0x3af80d['body'],{})[_0x6976('0x24')](respondWithResult(_0x420710,0xc9))[_0x6976('0x46')](handleError(_0x420710,null));};exports[_0x6976('0x23')]=function(_0x3335ed,_0x6f6d36){if(_0x3335ed[_0x6976('0x47')]['id']){delete _0x3335ed[_0x6976('0x47')]['id'];}return db[_0x6976('0x29')]['find']({'where':{'id':_0x3335ed[_0x6976('0x48')]['id']}})[_0x6976('0x24')](handleEntityNotFound(_0x6f6d36,null))['then'](saveUpdates(_0x3335ed['body'],null))['then'](respondWithResult(_0x6f6d36,null))[_0x6976('0x46')](handleError(_0x6f6d36,null));};exports[_0x6976('0x25')]=function(_0x3924e2,_0x4b8d72){return db[_0x6976('0x29')][_0x6976('0x44')]({'where':{'id':_0x3924e2[_0x6976('0x48')]['id']}})[_0x6976('0x24')](handleEntityNotFound(_0x4b8d72,null))[_0x6976('0x24')](removeEntity(_0x4b8d72,null))[_0x6976('0x46')](handleError(_0x4b8d72,null));};exports['describe']=function(_0x34244b,_0x545f79){return db['VoiceTransferReport']['describe']()[_0x6976('0x24')](respondWithResult(_0x545f79,null))['catch'](handleError(_0x545f79,null));}; \ No newline at end of file +var _0x5deb=['merge','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','filters','model','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x5deb,0xf1));var _0xb5de=function(_0x4e7fa9,_0x29d247){_0x4e7fa9=_0x4e7fa9-0x0;var _0x401f9e=_0x5deb[_0x4e7fa9];return _0x401f9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5de('0x0'));var zipdir=require(_0xb5de('0x1'));var jsonpatch=require(_0xb5de('0x2'));var rp=require('request-promise');var moment=require(_0xb5de('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb5de('0x4'));var util=require(_0xb5de('0x5'));var path=require(_0xb5de('0x6'));var sox=require(_0xb5de('0x7'));var csv=require(_0xb5de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5de('0x9'));var _=require(_0xb5de('0xa'));var squel=require(_0xb5de('0xb'));var crypto=require(_0xb5de('0xc'));var jsforce=require(_0xb5de('0xd'));var deskjs=require(_0xb5de('0xe'));var toCsv=require(_0xb5de('0x8'));var querystring=require(_0xb5de('0xf'));var Papa=require(_0xb5de('0x10'));var Redis=require(_0xb5de('0x11'));var authService=require(_0xb5de('0x12'));var qs=require(_0xb5de('0x13'));var as=require(_0xb5de('0x14'));var hardwareService=require(_0xb5de('0x15'));var logger=require(_0xb5de('0x16'))('api');var utils=require(_0xb5de('0x17'));var config=require(_0xb5de('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5de('0x19'))['db'];function respondWithStatusCode(_0x3ad10d,_0x59831b){_0x59831b=_0x59831b||0xcc;return function(_0x4ee58c){if(_0x4ee58c){return _0x3ad10d['sendStatus'](_0x59831b);}return _0x3ad10d[_0xb5de('0x1a')](_0x59831b)['end']();};}function respondWithResult(_0x5cc59d,_0x3f06b8){_0x3f06b8=_0x3f06b8||0xc8;return function(_0x4cd49b){if(_0x4cd49b){return _0x5cc59d[_0xb5de('0x1a')](_0x3f06b8)[_0xb5de('0x1b')](_0x4cd49b);}};}function respondWithFilteredResult(_0x424b38,_0x14ba62){return function(_0x27834a){if(_0x27834a){var _0x3f5ae6=typeof _0x14ba62[_0xb5de('0x1c')]===_0xb5de('0x1d')&&typeof _0x14ba62['limit']==='undefined';var _0x2d40a7=_0x27834a[_0xb5de('0x1e')];var _0x531f32=_0x3f5ae6?0x0:_0x14ba62[_0xb5de('0x1c')];var _0x592cee=_0x3f5ae6?_0x27834a[_0xb5de('0x1e')]:_0x14ba62[_0xb5de('0x1c')]+_0x14ba62[_0xb5de('0x1f')];var _0x1a7c78;if(_0x592cee>=_0x2d40a7){_0x592cee=_0x2d40a7;_0x1a7c78=0xc8;}else{_0x1a7c78=0xce;}_0x424b38['status'](_0x1a7c78);return _0x424b38[_0xb5de('0x20')](_0xb5de('0x21'),_0x531f32+'-'+_0x592cee+'/'+_0x2d40a7)[_0xb5de('0x1b')](_0x27834a);}return null;};}function patchUpdates(_0x2408d1){return function(_0x734373){try{jsonpatch[_0xb5de('0x22')](_0x734373,_0x2408d1,!![]);}catch(_0x267f6f){return BPromise[_0xb5de('0x23')](_0x267f6f);}return _0x734373['save']();};}function saveUpdates(_0x9c3af4,_0x20f91c){return function(_0xd9525b){if(_0xd9525b){return _0xd9525b[_0xb5de('0x24')](_0x9c3af4)[_0xb5de('0x25')](function(_0x5e1510){return _0x5e1510;});}return null;};}function removeEntity(_0x4df6da,_0x262b80){return function(_0x391c96){if(_0x391c96){return _0x391c96[_0xb5de('0x26')]()[_0xb5de('0x25')](function(){_0x4df6da[_0xb5de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e382,_0x5152b2){return function(_0x5ef928){if(!_0x5ef928){_0x19e382[_0xb5de('0x27')](0x194);}return _0x5ef928;};}function handleError(_0x498115,_0x5b022b){_0x5b022b=_0x5b022b||0x1f4;return function(_0x48df2f){logger[_0xb5de('0x28')](_0x48df2f[_0xb5de('0x29')]);if(_0x48df2f['name']){delete _0x48df2f[_0xb5de('0x2a')];}_0x498115['status'](_0x5b022b)['send'](_0x48df2f);};}exports[_0xb5de('0x2b')]=function(_0x63595,_0x33d83f){var _0x4ef68d={},_0x401ebe={},_0x36558d={'count':0x0,'rows':[]};var _0x2d5bd8=_[_0xb5de('0x2c')](db[_0xb5de('0x2d')][_0xb5de('0x2e')],function(_0xf4e2fe){return{'name':_0xf4e2fe[_0xb5de('0x2f')],'type':_0xf4e2fe['type'][_0xb5de('0x30')]};});_0x401ebe['model']=_[_0xb5de('0x2c')](_0x2d5bd8,_0xb5de('0x2a'));_0x401ebe['query']=_['keys'](_0x63595['query']);_0x401ebe[_0xb5de('0x31')]=_['intersection'](_0x401ebe[_0xb5de('0x32')],_0x401ebe['query']);_0x4ef68d['attributes']=_[_0xb5de('0x33')](_0x401ebe[_0xb5de('0x32')],qs[_0xb5de('0x34')](_0x63595['query'][_0xb5de('0x34')]));_0x4ef68d[_0xb5de('0x35')]=_0x4ef68d[_0xb5de('0x35')][_0xb5de('0x36')]?_0x4ef68d[_0xb5de('0x35')]:_0x401ebe[_0xb5de('0x32')];if(!_0x63595[_0xb5de('0x37')][_0xb5de('0x38')](_0xb5de('0x39'))){_0x4ef68d[_0xb5de('0x1f')]=qs['limit'](_0x63595[_0xb5de('0x37')][_0xb5de('0x1f')]);_0x4ef68d[_0xb5de('0x1c')]=qs[_0xb5de('0x1c')](_0x63595[_0xb5de('0x37')]['offset']);}_0x4ef68d['order']=qs['sort'](_0x63595[_0xb5de('0x37')][_0xb5de('0x3a')]);_0x4ef68d[_0xb5de('0x3b')]=qs[_0xb5de('0x31')](_['pick'](_0x63595['query'],_0x401ebe['filters']),_0x2d5bd8);if(_0x63595[_0xb5de('0x37')]['filter']){_0x4ef68d[_0xb5de('0x3b')]=_['merge'](_0x4ef68d[_0xb5de('0x3b')],{'$or':_[_0xb5de('0x2c')](_0x2d5bd8,function(_0x4bbb57){if(_0x4bbb57[_0xb5de('0x3c')]!==_0xb5de('0x3d')){var _0x42a9f1={};_0x42a9f1[_0x4bbb57[_0xb5de('0x2a')]]={'$like':'%'+_0x63595['query'][_0xb5de('0x3e')]+'%'};return _0x42a9f1;}})});}_0x4ef68d=_[_0xb5de('0x3f')]({},_0x4ef68d,_0x63595[_0xb5de('0x40')]);var _0x16f372={'where':_0x4ef68d['where']};return db[_0xb5de('0x2d')]['count'](_0x16f372)[_0xb5de('0x25')](function(_0xdad0a8){_0x36558d[_0xb5de('0x1e')]=_0xdad0a8;if(_0x63595[_0xb5de('0x37')][_0xb5de('0x41')]){_0x4ef68d['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb5de('0x42')](_0x4ef68d);})['then'](function(_0x24c39d){_0x36558d[_0xb5de('0x43')]=_0x24c39d;return _0x36558d;})[_0xb5de('0x25')](respondWithFilteredResult(_0x33d83f,_0x4ef68d))[_0xb5de('0x44')](handleError(_0x33d83f,null));};exports[_0xb5de('0x45')]=function(_0x3171ad,_0x1a6424){var _0x269d85={'raw':!![],'where':{'id':_0x3171ad[_0xb5de('0x46')]['id']}},_0x392587={};_0x392587[_0xb5de('0x32')]=_['keys'](db[_0xb5de('0x2d')]['rawAttributes']);_0x392587['query']=_[_0xb5de('0x47')](_0x3171ad[_0xb5de('0x37')]);_0x392587['filters']=_[_0xb5de('0x33')](_0x392587[_0xb5de('0x32')],_0x392587[_0xb5de('0x37')]);_0x269d85[_0xb5de('0x35')]=_[_0xb5de('0x33')](_0x392587[_0xb5de('0x32')],qs[_0xb5de('0x34')](_0x3171ad[_0xb5de('0x37')][_0xb5de('0x34')]));_0x269d85[_0xb5de('0x35')]=_0x269d85[_0xb5de('0x35')]['length']?_0x269d85[_0xb5de('0x35')]:_0x392587[_0xb5de('0x32')];if(_0x3171ad[_0xb5de('0x37')]['includeAll']){_0x269d85['include']=[{'all':!![]}];}_0x269d85=_['merge']({},_0x269d85,_0x3171ad[_0xb5de('0x40')]);return db[_0xb5de('0x2d')][_0xb5de('0x48')](_0x269d85)[_0xb5de('0x25')](handleEntityNotFound(_0x1a6424,null))['then'](respondWithResult(_0x1a6424,null))[_0xb5de('0x44')](handleError(_0x1a6424,null));};exports[_0xb5de('0x49')]=function(_0x1fa0a8,_0x14b280){return db[_0xb5de('0x2d')][_0xb5de('0x49')](_0x1fa0a8['body'],{})[_0xb5de('0x25')](respondWithResult(_0x14b280,0xc9))['catch'](handleError(_0x14b280,null));};exports[_0xb5de('0x24')]=function(_0x319bc4,_0x3fa9ca){if(_0x319bc4[_0xb5de('0x4a')]['id']){delete _0x319bc4[_0xb5de('0x4a')]['id'];}return db['VoiceTransferReport'][_0xb5de('0x48')]({'where':{'id':_0x319bc4[_0xb5de('0x46')]['id']}})[_0xb5de('0x25')](handleEntityNotFound(_0x3fa9ca,null))['then'](saveUpdates(_0x319bc4[_0xb5de('0x4a')],null))['then'](respondWithResult(_0x3fa9ca,null))[_0xb5de('0x44')](handleError(_0x3fa9ca,null));};exports[_0xb5de('0x26')]=function(_0x1a8254,_0x114834){return db[_0xb5de('0x2d')][_0xb5de('0x48')]({'where':{'id':_0x1a8254[_0xb5de('0x46')]['id']}})[_0xb5de('0x25')](handleEntityNotFound(_0x114834,null))[_0xb5de('0x25')](removeEntity(_0x114834,null))[_0xb5de('0x44')](handleError(_0x114834,null));};exports[_0xb5de('0x4b')]=function(_0xcd0bee,_0x9618c0){return db[_0xb5de('0x2d')][_0xb5de('0x4b')]()[_0xb5de('0x25')](respondWithResult(_0x9618c0,null))['catch'](handleError(_0x9618c0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 0779c18..5fdb01e 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 _0x5559=['VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x5559,0x9a));var _0x9555=function(_0x12554a,_0x2b55f3){_0x12554a=_0x12554a-0x0;var _0x93e9ef=_0x5559[_0x12554a];return _0x93e9ef;};'use strict';var _=require(_0x9555('0x0'));var util=require(_0x9555('0x1'));var logger=require(_0x9555('0x2'))(_0x9555('0x3'));var moment=require(_0x9555('0x4'));var BPromise=require(_0x9555('0x5'));var rp=require(_0x9555('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9555('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x381dc9,_0x263188){return _0x381dc9['define'](_0x9555('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bce=['path','../../config/environment','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','bluebird'];(function(_0x28dab5,_0xee8fd4){var _0x268d1b=function(_0x1b57ac){while(--_0x1b57ac){_0x28dab5['push'](_0x28dab5['shift']());}};_0x268d1b(++_0xee8fd4);}(_0x3bce,0x6d));var _0xe3bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3bce[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xe3bc('0x0'));var logger=require(_0xe3bc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe3bc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3bc('0x3'));var rimraf=require('rimraf');var config=require(_0xe3bc('0x4'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x174cd6,_0x58e56d){return _0x174cd6[_0xe3bc('0x5')](_0xe3bc('0x6'),attributes,{'tableName':_0xe3bc('0x7'),'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 29bb4e8..f2bb57c 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 _0x354a=['jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceTransferReport','create','body','options','stringify','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b2993,_0xd46430){var _0x480074=function(_0x37e7fc){while(--_0x37e7fc){_0x4b2993['push'](_0x4b2993['shift']());}};_0x480074(++_0xd46430);}(_0x354a,0xca));var _0xa354=function(_0x1421c3,_0x3cb122){_0x1421c3=_0x1421c3-0x0;var _0x4b791d=_0x354a[_0x1421c3];return _0x4b791d;};'use strict';var _=require('lodash');var util=require(_0xa354('0x0'));var moment=require('moment');var BPromise=require(_0xa354('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa354('0x2'))['db'];var utils=require(_0xa354('0x3'));var logger=require(_0xa354('0x4'))(_0xa354('0x5'));var config=require('../../config/environment');var jayson=require(_0xa354('0x6'));var client=jayson[_0xa354('0x7')][_0xa354('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x385faf,_0x3346cb,_0x5b1e5c){return new BPromise(function(_0x4759c7,_0x1e5f60){return client[_0xa354('0x9')](_0x385faf,_0x5b1e5c)[_0xa354('0xa')](function(_0x52448e){logger[_0xa354('0xb')](_0xa354('0xc'),_0x3346cb,'request\x20sent');logger[_0xa354('0xd')](_0xa354('0xe'),_0x3346cb,'request\x20sent',JSON['stringify'](_0x52448e));if(_0x52448e[_0xa354('0xf')]){if(_0x52448e[_0xa354('0xf')][_0xa354('0x10')]===0x1f4){logger[_0xa354('0xf')](_0xa354('0xc'),_0x3346cb,_0x52448e['error'][_0xa354('0x11')]);return _0x1e5f60(_0x52448e[_0xa354('0xf')][_0xa354('0x11')]);}logger[_0xa354('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3346cb,_0x52448e['error'][_0xa354('0x11')]);return _0x4759c7(_0x52448e[_0xa354('0xf')][_0xa354('0x11')]);}else{logger[_0xa354('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x3346cb,_0xa354('0x12'));_0x4759c7(_0x52448e[_0xa354('0x13')][_0xa354('0x11')]);}})[_0xa354('0x14')](function(_0x3b56df){logger['error'](_0xa354('0xc'),_0x3346cb,_0x3b56df);_0x1e5f60(_0x3b56df);});});}exports[_0xa354('0x15')]=function(_0x11dc13){var _0xd46feb=this;return new Promise(function(_0xf7492f,_0x41bc53){return db['VoiceTransferReport'][_0xa354('0x16')](_0x11dc13[_0xa354('0x17')],{'raw':_0x11dc13[_0xa354('0x18')]?_0x11dc13['options']['raw']===undefined?!![]:![]:!![]})[_0xa354('0xa')](function(_0x523750){logger['info']('CreateVoiceTransferReport',_0x11dc13);logger[_0xa354('0xd')](_0xa354('0x15'),_0x11dc13,JSON[_0xa354('0x19')](_0x523750));_0xf7492f(_0x523750);})[_0xa354('0x14')](function(_0x1f022a){logger[_0xa354('0xf')](_0xa354('0x15'),_0x1f022a[_0xa354('0x11')],_0x11dc13);_0x41bc53(_0xd46feb[_0xa354('0xf')](0x1f4,_0x1f022a[_0xa354('0x11')]));});});}; \ No newline at end of file +var _0xcb8f=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','create','body','options','raw','info','CreateVoiceTransferReport'];(function(_0x386f0d,_0x2aafc3){var _0x3f28db=function(_0x2c0369){while(--_0x2c0369){_0x386f0d['push'](_0x386f0d['shift']());}};_0x3f28db(++_0x2aafc3);}(_0xcb8f,0xe0));var _0xfcb8=function(_0x272f5d,_0x578e81){_0x272f5d=_0x272f5d-0x0;var _0x1ce859=_0xcb8f[_0x272f5d];return _0x1ce859;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcb8('0x0'));var BPromise=require(_0xfcb8('0x1'));var rs=require(_0xfcb8('0x2'));var fs=require('fs');var Redis=require(_0xfcb8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcb8('0x4'));var logger=require('../../config/logger')(_0xfcb8('0x5'));var config=require(_0xfcb8('0x6'));var jayson=require(_0xfcb8('0x7'));var client=jayson[_0xfcb8('0x8')][_0xfcb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b9d54,_0x4de287,_0x42e7a2){return new BPromise(function(_0x3eff4c,_0x32c7f9){return client[_0xfcb8('0xa')](_0x1b9d54,_0x42e7a2)[_0xfcb8('0xb')](function(_0x4d0343){logger['info'](_0xfcb8('0xc'),_0x4de287,'request\x20sent');logger[_0xfcb8('0xd')](_0xfcb8('0xe'),_0x4de287,_0xfcb8('0xf'),JSON[_0xfcb8('0x10')](_0x4d0343));if(_0x4d0343[_0xfcb8('0x11')]){if(_0x4d0343[_0xfcb8('0x11')][_0xfcb8('0x12')]===0x1f4){logger[_0xfcb8('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x4de287,_0x4d0343[_0xfcb8('0x11')][_0xfcb8('0x13')]);return _0x32c7f9(_0x4d0343['error'][_0xfcb8('0x13')]);}logger[_0xfcb8('0x11')](_0xfcb8('0xc'),_0x4de287,_0x4d0343['error']['message']);return _0x3eff4c(_0x4d0343['error'][_0xfcb8('0x13')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x4de287,_0xfcb8('0xf'));_0x3eff4c(_0x4d0343['result'][_0xfcb8('0x13')]);}})[_0xfcb8('0x14')](function(_0x4b1efb){logger[_0xfcb8('0x11')](_0xfcb8('0xc'),_0x4de287,_0x4b1efb);_0x32c7f9(_0x4b1efb);});});}exports['CreateVoiceTransferReport']=function(_0x1462c3){var _0x36f04a=this;return new Promise(function(_0x4a6c0e,_0x143637){return db[_0xfcb8('0x15')][_0xfcb8('0x16')](_0x1462c3[_0xfcb8('0x17')],{'raw':_0x1462c3[_0xfcb8('0x18')]?_0x1462c3[_0xfcb8('0x18')][_0xfcb8('0x19')]===undefined?!![]:![]:!![]})[_0xfcb8('0xb')](function(_0x4e2397){logger[_0xfcb8('0x1a')](_0xfcb8('0x1b'),_0x1462c3);logger[_0xfcb8('0xd')]('CreateVoiceTransferReport',_0x1462c3,JSON[_0xfcb8('0x10')](_0x4e2397));_0x4a6c0e(_0x4e2397);})[_0xfcb8('0x14')](function(_0x4c3eec){logger[_0xfcb8('0x11')]('CreateVoiceTransferReport',_0x4c3eec[_0xfcb8('0x13')],_0x1462c3);_0x143637(_0x36f04a[_0xfcb8('0x11')](0x1f4,_0x4c3eec[_0xfcb8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e7395c5..eab65a7 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 _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x4c09ff,_0x33c3d5){var _0x5e3806=function(_0x34e354){while(--_0x34e354){_0x4c09ff['push'](_0x4c09ff['shift']());}};_0x5e3806(++_0x33c3d5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x40213c,_0x2e1cf0){_0x40213c=_0x40213c-0x0;var _0x30be08=_0x6f0d[_0x40213c];return _0x30be08;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x45e777,_0x4e19db){var _0x2dbb8f=function(_0x506555){while(--_0x506555){_0x45e777['push'](_0x45e777['shift']());}};_0x2dbb8f(++_0x4e19db);}(_0xdace,0xc5));var _0xedac=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xdace[_0x489b87];return _0x1823b6;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b9f31d8..03eee30 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 _0x6308=['userId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','status','json','callNumber','callerId','callbackUrl','info','entityFound:','format','user:%s','hangup','hangup\x20fired:','userId','sessionId','webbar:hangup','catch','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','redis','localhost','socket.io-emitter','validate','number','string'];(function(_0x94f9f5,_0x5a67d1){var _0x3a1b8d=function(_0x2d496f){while(--_0x2d496f){_0x94f9f5['push'](_0x94f9f5['shift']());}};_0x3a1b8d(++_0x5a67d1);}(_0x6308,0x1f2));var _0x8630=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x6308[_0xa8883];return _0x479426;};'use strict';var path=require(_0x8630('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8630('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x8630('0x2'));var jayson=require(_0x8630('0x3'));var amiClient=jayson[_0x8630('0x4')][_0x8630('0x5')]({'port':0x232a});var logger=require(_0x8630('0x6'))('webbarapi');var Redis=require('ioredis');config[_0x8630('0x7')]=_['defaults'](config[_0x8630('0x7')],{'host':_0x8630('0x8'),'port':0x18eb});var io=require(_0x8630('0x9'))(new Redis(config[_0x8630('0x7')]));var Schema=require(_0x8630('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8630('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8630('0xc')},'callbackUrl':{'type':_0x8630('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8630('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],_0x8630('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],_0x8630('0xd')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x8630('0xc'),'required':[!![],_0x8630('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8630('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8630('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8630('0xb'),'required':[!![],_0x8630('0xd')]}});function emit(_0x49fce1,_0x5c0ba0,_0x3ea754){logger['info'](_0x49fce1,_0x5c0ba0,JSON[_0x8630('0xf')](_0x3ea754));io['to'](_0x49fce1)[_0x8630('0x10')](_0x5c0ba0,_0x3ea754);}function handleError(_0x2c360d){return function(_0x20f462){console[_0x8630('0x11')](_0x8630('0x12'),_0x20f462,_0x20f462 instanceof RangeError);logger[_0x8630('0x13')](_0x20f462[_0x8630('0x14')]);if(_0x20f462 instanceof RangeError){if(_0x20f462[_0x8630('0x15')]){delete _0x20f462['name'];}_0x2c360d['status'](0x194)[_0x8630('0x16')](_0x20f462);}else{if(_0x20f462[_0x8630('0x15')]){delete _0x20f462['name'];}_0x2c360d['status'](0x1f4)[_0x8630('0x16')](_0x20f462);}};}function checkError(){return function(_0x441918){if(!_0x441918){throw new RangeError(_0x8630('0x17'));}return _0x441918;};}function respondWithRpcPromise(_0x491c65,_0x5ce487){return new BPromise(function(_0xcc7454,_0x58c0b5){var _0x30fb4d=amiClient;return _0x30fb4d[_0x8630('0x18')](_0x491c65,_0x5ce487)[_0x8630('0x19')](function(_0x469de3){if(_0x469de3['error']){if(_0x469de3[_0x8630('0x13')][_0x8630('0x1a')]===0x1f4){return _0x58c0b5(_0x469de3[_0x8630('0x13')][_0x8630('0x1b')]);}return _0xcc7454(_0x469de3[_0x8630('0x13')][_0x8630('0x1b')]);}else{_0xcc7454(_0x469de3[_0x8630('0x1c')]);}})['catch'](function(_0x5b2823){_0x58c0b5(_0x5b2823);});});}function getAgent(_0x18fd53){return db[_0x8630('0x1d')][_0x8630('0x1e')]({'where':{'id':_0x18fd53,'role':_0x8630('0x1f')}})[_0x8630('0x19')](checkError());}function getAgentCheckSession(_0x1c012d,_0x149a8e){return new BPromise(function(_0x349c4d,_0x306ca2){var _0x357c15=respondWithRpcPromise(_0x8630('0x20'));var _0x41f74c=getAgent(_0x1c012d);Promise[_0x8630('0x21')]([_0x357c15,_0x41f74c])[_0x8630('0x19')](function(_0xbb1a58){var _0x190216=_0xbb1a58[0x0];var _0x2d3f0b=_0xbb1a58[0x1];var _0x4d42c6=_[_0x8630('0x22')](_0x190216[_0x8630('0x23')],function(_0x24d85d){return _0x24d85d[_0x8630('0x24')]==_0x2d3f0b['id']&&_0x24d85d['sessionId']==_0x149a8e;});if(_0x4d42c6[_0x8630('0x25')]==0x1){_0x349c4d(_0x2d3f0b);}else{_0x306ca2(new RangeError(_0x8630('0x26')+_0x149a8e+_0x8630('0x27')));}});});}exports[_0x8630('0x28')]=function(_0x35b7b2,_0x32f4fd){logger['info'](_0x8630('0x29'),_0x35b7b2[_0x8630('0x2a')]);var _0x24e6af=originateValidation['validate'](_0x35b7b2[_0x8630('0x2a')]);if(_0x24e6af[_0x8630('0x25')]>0x0){return _0x32f4fd[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x24e6af);}var _0x2e0352=_0x35b7b2[_0x8630('0x2a')]['userId'];var _0x7deb1e=_0x35b7b2[_0x8630('0x2a')][_0x8630('0x2d')];var _0x16370e=_0x35b7b2[_0x8630('0x2a')][_0x8630('0x2e')];var _0x2843a6=_0x35b7b2[_0x8630('0x2a')][_0x8630('0x2f')];return getAgent(_0x2e0352)[_0x8630('0x19')](function(_0x396b2c){logger[_0x8630('0x30')](_0x8630('0x31'),_0x396b2c[_0x8630('0x15')]);emit(util[_0x8630('0x32')](_0x8630('0x33'),_0x396b2c[_0x8630('0x15')]),'webbar:originate',{'callNumber':_0x7deb1e,'callerId':_0x16370e,'callbackUrl':_0x2843a6});return _0x32f4fd[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x32f4fd));};exports[_0x8630('0x34')]=function(_0x1c2281,_0x28f75d){logger[_0x8630('0x30')](_0x8630('0x35'),_0x1c2281['body']);var _0x21e879=hangupValidation[_0x8630('0xa')](_0x1c2281[_0x8630('0x2a')]);if(_0x21e879[_0x8630('0x25')]>0x0){return _0x28f75d['status'](0x190)[_0x8630('0x2c')](_0x21e879);}var _0x437fde=_0x1c2281[_0x8630('0x2a')][_0x8630('0x36')];var _0x411a5c=_0x1c2281[_0x8630('0x2a')][_0x8630('0x37')];return getAgent(_0x437fde)['then'](function(_0x1076f4){logger[_0x8630('0x30')](_0x8630('0x31'),_0x1076f4[_0x8630('0x15')]);emit(util[_0x8630('0x32')](_0x8630('0x33'),_0x1076f4[_0x8630('0x15')]),_0x8630('0x38'),{'sessionId':_0x411a5c});return _0x28f75d[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0x8630('0x39')](handleError(_0x28f75d));};exports['answer']=function(_0x8b40e1,_0x475bb4){logger[_0x8630('0x30')](_0x8630('0x3a'),_0x8b40e1[_0x8630('0x2a')]);var _0x2f1fec=answerValidation['validate'](_0x8b40e1[_0x8630('0x2a')]);if(_0x2f1fec[_0x8630('0x25')]>0x0){return _0x475bb4[_0x8630('0x2b')](0x190)['json'](_0x2f1fec);}var _0x79385=_0x8b40e1[_0x8630('0x2a')][_0x8630('0x36')];var _0x327466=_0x8b40e1[_0x8630('0x2a')][_0x8630('0x37')];return getAgent(_0x79385)['then'](function(_0x348bb3){logger[_0x8630('0x30')](_0x8630('0x31'),_0x348bb3['name']);emit(util[_0x8630('0x32')](_0x8630('0x33'),_0x348bb3['name']),_0x8630('0x3b'),{'sessionId':_0x327466});return _0x475bb4[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x475bb4));};exports[_0x8630('0x3c')]=function(_0x4ab99a,_0x4f33bf){logger[_0x8630('0x30')]('hold\x20fired:',_0x4ab99a[_0x8630('0x2a')]);var _0x35a3c8=holdValidation['validate'](_0x4ab99a[_0x8630('0x2a')]);if(_0x35a3c8[_0x8630('0x25')]>0x0){return _0x4f33bf[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x35a3c8);}var _0x121e83=_0x4ab99a['body'][_0x8630('0x36')];var _0x231289=_0x4ab99a['body'][_0x8630('0x37')];return getAgent(_0x121e83)[_0x8630('0x19')](function(_0x3ff20b){logger['info'](_0x8630('0x31'),_0x3ff20b[_0x8630('0x15')]);emit(util[_0x8630('0x32')](_0x8630('0x33'),_0x3ff20b[_0x8630('0x15')]),_0x8630('0x3d'),{'sessionId':_0x231289});return _0x4f33bf[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'error':![],'message':_0x8630('0x3e')});})['catch'](handleError(_0x4f33bf));};exports['unhold']=function(_0x1b8328,_0x13326d){logger[_0x8630('0x30')](_0x8630('0x3f'),_0x1b8328[_0x8630('0x2a')]);var _0x24a363=unholdValidation[_0x8630('0xa')](_0x1b8328['body']);if(_0x24a363[_0x8630('0x25')]>0x0){return _0x13326d[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x24a363);}var _0x16c286=_0x1b8328[_0x8630('0x2a')]['userId'];var _0x398ea7=_0x1b8328[_0x8630('0x2a')][_0x8630('0x37')];return getAgent(_0x16c286)[_0x8630('0x19')](function(_0x503f2b){logger[_0x8630('0x30')](_0x8630('0x31'),_0x503f2b['name']);emit(util[_0x8630('0x32')](_0x8630('0x33'),_0x503f2b[_0x8630('0x15')]),_0x8630('0x40'),{'sessionId':_0x398ea7});return _0x13326d['status'](0xc8)[_0x8630('0x2c')]({'error':![],'message':_0x8630('0x41')});})['catch'](handleError(_0x13326d));};exports['calls']=function(_0x438a56,_0x9fef86){logger['info'](_0x8630('0x42'),_0x9fef86['body']);var _0x2e49c8=callsValidation[_0x8630('0xa')](_0x438a56[_0x8630('0x2a')]);if(_0x2e49c8['length']>0x0){return _0x9fef86[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x2e49c8);}var _0x7615f5=_0x438a56[_0x8630('0x2a')][_0x8630('0x36')];var _0x1c28dc=respondWithRpcPromise(_0x8630('0x20'));var _0x49c2bc=getAgent(_0x7615f5);return Promise[_0x8630('0x21')]([_0x1c28dc,_0x49c2bc])[_0x8630('0x19')](function(_0x2c3e6e){var _0x50ce41=_0x2c3e6e[0x0];var _0x535add=_0x2c3e6e[0x1];var _0x388e1f=_['filter'](_0x50ce41[_0x8630('0x23')],function(_0x83b818){return _0x83b818['UserId']==_0x535add['id'];});return _0x9fef86[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'count':_0x388e1f[_0x8630('0x25')],'rows':_0x388e1f});})[_0x8630('0x39')](handleError(_0x9fef86));};exports['conference']=function(_0x19af58,_0x1b33c3){logger[_0x8630('0x30')]('conference\x20fired:',_0x19af58['body']);var _0x4d32ac=conferenceValidation[_0x8630('0xa')](_0x19af58[_0x8630('0x2a')]);if(_0x4d32ac[_0x8630('0x25')]>0x0){return _0x1b33c3[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x4d32ac);}var _0x59f0d3=_0x19af58[_0x8630('0x2a')][_0x8630('0x36')];return getAgent(_0x59f0d3)[_0x8630('0x19')](function(_0x4f352b){logger['info'](_0x8630('0x31'),_0x4f352b[_0x8630('0x15')]);emit(util['format'](_0x8630('0x33'),_0x4f352b['name']),_0x8630('0x43'));return _0x1b33c3[_0x8630('0x2b')](0xc8)[_0x8630('0x2c')]({'error':![],'message':_0x8630('0x44')});})[_0x8630('0x39')](handleError(_0x1b33c3));};exports['transfer']=function(_0x5f02ac,_0x5b9d39){logger[_0x8630('0x30')](_0x8630('0x45'),_0x5f02ac[_0x8630('0x2a')]);var _0x3da5cb=transferValidation[_0x8630('0xa')](_0x5f02ac[_0x8630('0x2a')]);if(_0x3da5cb[_0x8630('0x25')]>0x0){return _0x5b9d39[_0x8630('0x2b')](0x190)[_0x8630('0x2c')](_0x3da5cb);}var _0x36a55b=_0x5f02ac[_0x8630('0x2a')][_0x8630('0x36')];var _0x4bccab=_0x5f02ac[_0x8630('0x2a')]['sessionId'];var _0x427d94=_0x5f02ac[_0x8630('0x2a')][_0x8630('0x46')];return getAgent(_0x36a55b)[_0x8630('0x19')](function(_0x4beca1){logger['info'](_0x8630('0x31'),_0x4beca1[_0x8630('0x15')]);emit(util[_0x8630('0x32')]('user:%s',_0x4beca1[_0x8630('0x15')]),_0x8630('0x47'),{'sessionId':_0x4bccab,'transferNumber':_0x427d94});return _0x5b9d39['status'](0xc8)[_0x8630('0x2c')]({'error':![],'message':_0x8630('0x48')});})[_0x8630('0x39')](handleError(_0x5b9d39));}; \ No newline at end of file +var _0x2dae=['format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','user:%s','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all','filter','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dae,0xc3));var _0xe2da=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x2dae[_0x3cc9d9];return _0x1a425d;};'use strict';var path=require(_0xe2da('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xe2da('0x1'))['db'];var config=require(_0xe2da('0x2'));var util=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var jayson=require(_0xe2da('0x5'));var amiClient=jayson['client'][_0xe2da('0x6')]({'port':0x232a});var logger=require(_0xe2da('0x7'))(_0xe2da('0x8'));var Redis=require(_0xe2da('0x9'));config['redis']=_[_0xe2da('0xa')](config[_0xe2da('0xb')],{'host':_0xe2da('0xc'),'port':0x18eb});var io=require(_0xe2da('0xd'))(new Redis(config[_0xe2da('0xb')]));var Schema=require(_0xe2da('0xe'));var originateValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'callNumber':{'type':_0xe2da('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xe2da('0x11')},'callbackUrl':{'type':_0xe2da('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe2da('0x10')]},'sessionId':{'type':'string','required':[!![],_0xe2da('0x12')]},'transferNumber':{'type':_0xe2da('0x11'),'required':[!![],_0xe2da('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]}});function emit(_0x33f919,_0x4dc58b,_0x25d4fa){logger[_0xe2da('0x14')](_0x33f919,_0x4dc58b,JSON[_0xe2da('0x15')](_0x25d4fa));io['to'](_0x33f919)[_0xe2da('0x16')](_0x4dc58b,_0x25d4fa);}function handleError(_0x4e1623){return function(_0x45bb92){console[_0xe2da('0x17')](_0xe2da('0x18'),_0x45bb92,_0x45bb92 instanceof RangeError);logger[_0xe2da('0x19')](_0x45bb92[_0xe2da('0x1a')]);if(_0x45bb92 instanceof RangeError){if(_0x45bb92['name']){delete _0x45bb92[_0xe2da('0x1b')];}_0x4e1623[_0xe2da('0x1c')](0x194)['send'](_0x45bb92);}else{if(_0x45bb92[_0xe2da('0x1b')]){delete _0x45bb92[_0xe2da('0x1b')];}_0x4e1623[_0xe2da('0x1c')](0x1f4)[_0xe2da('0x1d')](_0x45bb92);}};}function checkError(){return function(_0x336415){if(!_0x336415){throw new RangeError(_0xe2da('0x1e'));}return _0x336415;};}function respondWithRpcPromise(_0x5a9ffe,_0x467cd6){return new BPromise(function(_0x53cc4e,_0x30efdc){var _0x191d38=amiClient;return _0x191d38[_0xe2da('0x1f')](_0x5a9ffe,_0x467cd6)[_0xe2da('0x20')](function(_0x30dea4){if(_0x30dea4[_0xe2da('0x19')]){if(_0x30dea4[_0xe2da('0x19')][_0xe2da('0x21')]===0x1f4){return _0x30efdc(_0x30dea4['error'][_0xe2da('0x22')]);}return _0x53cc4e(_0x30dea4[_0xe2da('0x19')][_0xe2da('0x22')]);}else{_0x53cc4e(_0x30dea4[_0xe2da('0x23')]);}})[_0xe2da('0x24')](function(_0x230fb8){_0x30efdc(_0x230fb8);});});}function getAgent(_0x124d93){return db['User'][_0xe2da('0x25')]({'where':{'id':_0x124d93,'role':_0xe2da('0x26')}})[_0xe2da('0x20')](checkError());}function getAgentCheckSession(_0x38ee5e,_0x36ca43){return new BPromise(function(_0x2b6c9e,_0x1b4aff){var _0x39f60e=respondWithRpcPromise('VoiceChannels');var _0x487a7c=getAgent(_0x38ee5e);Promise['all']([_0x39f60e,_0x487a7c])[_0xe2da('0x20')](function(_0x8c91db){var _0x4146ad=_0x8c91db[0x0];var _0x1ab91a=_0x8c91db[0x1];var _0x5de7fb=_['filter'](_0x4146ad[_0xe2da('0x27')],function(_0x1ec8ca){return _0x1ec8ca[_0xe2da('0x28')]==_0x1ab91a['id']&&_0x1ec8ca[_0xe2da('0x29')]==_0x36ca43;});if(_0x5de7fb[_0xe2da('0x2a')]==0x1){_0x2b6c9e(_0x1ab91a);}else{_0x1b4aff(new RangeError(_0xe2da('0x2b')+_0x36ca43+_0xe2da('0x2c')));}});});}exports[_0xe2da('0x2d')]=function(_0x461610,_0x499400){logger['info'](_0xe2da('0x2e'),_0x461610[_0xe2da('0x2f')]);var _0x2cb457=originateValidation[_0xe2da('0xe')](_0x461610[_0xe2da('0x2f')]);if(_0x2cb457[_0xe2da('0x2a')]>0x0){return _0x499400[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x2cb457);}var _0x28e61a=_0x461610[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2386b8=_0x461610[_0xe2da('0x2f')][_0xe2da('0x32')];var _0x3649cd=_0x461610[_0xe2da('0x2f')][_0xe2da('0x33')];var _0x3a6f08=_0x461610['body'][_0xe2da('0x34')];return getAgent(_0x28e61a)[_0xe2da('0x20')](function(_0x39dae5){logger['info'](_0xe2da('0x35'),_0x39dae5[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')]('user:%s',_0x39dae5['name']),_0xe2da('0x37'),{'callNumber':_0x2386b8,'callerId':_0x3649cd,'callbackUrl':_0x3a6f08});return _0x499400[_0xe2da('0x1c')](0xc8)['json']({'error':![],'message':_0xe2da('0x38')});})[_0xe2da('0x24')](handleError(_0x499400));};exports[_0xe2da('0x39')]=function(_0x256a0c,_0x3a6ca3){logger['info'](_0xe2da('0x3a'),_0x256a0c['body']);var _0x59489e=hangupValidation[_0xe2da('0xe')](_0x256a0c['body']);if(_0x59489e[_0xe2da('0x2a')]>0x0){return _0x3a6ca3[_0xe2da('0x1c')](0x190)['json'](_0x59489e);}var _0x365968=_0x256a0c[_0xe2da('0x2f')]['userId'];var _0x4e14a6=_0x256a0c['body'][_0xe2da('0x29')];return getAgent(_0x365968)[_0xe2da('0x20')](function(_0x26ba99){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x26ba99[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')]('user:%s',_0x26ba99[_0xe2da('0x1b')]),_0xe2da('0x3b'),{'sessionId':_0x4e14a6});return _0x3a6ca3[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x3c')});})['catch'](handleError(_0x3a6ca3));};exports[_0xe2da('0x3d')]=function(_0x22d6c2,_0x3da65f){logger['info'](_0xe2da('0x3e'),_0x22d6c2[_0xe2da('0x2f')]);var _0x1529f4=answerValidation[_0xe2da('0xe')](_0x22d6c2[_0xe2da('0x2f')]);if(_0x1529f4[_0xe2da('0x2a')]>0x0){return _0x3da65f[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x1529f4);}var _0x4aec15=_0x22d6c2[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2113e8=_0x22d6c2[_0xe2da('0x2f')][_0xe2da('0x29')];return getAgent(_0x4aec15)['then'](function(_0x46b7fc){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x46b7fc[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x46b7fc[_0xe2da('0x1b')]),'webbar:answer',{'sessionId':_0x2113e8});return _0x3da65f[_0xe2da('0x1c')](0xc8)['json']({'error':![],'message':_0xe2da('0x40')});})[_0xe2da('0x24')](handleError(_0x3da65f));};exports[_0xe2da('0x41')]=function(_0x4b569e,_0x2dd7dc){logger[_0xe2da('0x14')]('hold\x20fired:',_0x4b569e[_0xe2da('0x2f')]);var _0x369dea=holdValidation[_0xe2da('0xe')](_0x4b569e['body']);if(_0x369dea[_0xe2da('0x2a')]>0x0){return _0x2dd7dc['status'](0x190)['json'](_0x369dea);}var _0x16a393=_0x4b569e['body'][_0xe2da('0x31')];var _0x422449=_0x4b569e['body'][_0xe2da('0x29')];return getAgent(_0x16a393)[_0xe2da('0x20')](function(_0x482547){logger['info'](_0xe2da('0x35'),_0x482547['name']);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x482547[_0xe2da('0x1b')]),_0xe2da('0x42'),{'sessionId':_0x422449});return _0x2dd7dc[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x43')});})[_0xe2da('0x24')](handleError(_0x2dd7dc));};exports[_0xe2da('0x44')]=function(_0x515f9b,_0x3ce9a8){logger[_0xe2da('0x14')](_0xe2da('0x45'),_0x515f9b['body']);var _0x17b64f=unholdValidation[_0xe2da('0xe')](_0x515f9b[_0xe2da('0x2f')]);if(_0x17b64f[_0xe2da('0x2a')]>0x0){return _0x3ce9a8[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x17b64f);}var _0x246384=_0x515f9b['body']['userId'];var _0x33bf4c=_0x515f9b[_0xe2da('0x2f')][_0xe2da('0x29')];return getAgent(_0x246384)['then'](function(_0x572690){logger[_0xe2da('0x14')]('entityFound:',_0x572690[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x572690[_0xe2da('0x1b')]),_0xe2da('0x46'),{'sessionId':_0x33bf4c});return _0x3ce9a8[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x47')});})[_0xe2da('0x24')](handleError(_0x3ce9a8));};exports['calls']=function(_0x26a9f0,_0x2f763b){logger[_0xe2da('0x14')](_0xe2da('0x48'),_0x2f763b['body']);var _0x25b8a7=callsValidation[_0xe2da('0xe')](_0x26a9f0[_0xe2da('0x2f')]);if(_0x25b8a7['length']>0x0){return _0x2f763b[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x25b8a7);}var _0x3e6e98=_0x26a9f0[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x22a571=respondWithRpcPromise(_0xe2da('0x49'));var _0x377db9=getAgent(_0x3e6e98);return Promise[_0xe2da('0x4a')]([_0x22a571,_0x377db9])[_0xe2da('0x20')](function(_0x154877){var _0x3b4d10=_0x154877[0x0];var _0x505c24=_0x154877[0x1];var _0x2b50cb=_[_0xe2da('0x4b')](_0x3b4d10[_0xe2da('0x27')],function(_0x268052){return _0x268052[_0xe2da('0x28')]==_0x505c24['id'];});return _0x2f763b[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'count':_0x2b50cb['length'],'rows':_0x2b50cb});})[_0xe2da('0x24')](handleError(_0x2f763b));};exports['conference']=function(_0x3abde9,_0x18ff95){logger['info']('conference\x20fired:',_0x3abde9[_0xe2da('0x2f')]);var _0x5651f9=conferenceValidation[_0xe2da('0xe')](_0x3abde9['body']);if(_0x5651f9[_0xe2da('0x2a')]>0x0){return _0x18ff95[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x5651f9);}var _0x4a2d10=_0x3abde9['body']['userId'];return getAgent(_0x4a2d10)[_0xe2da('0x20')](function(_0x1fa149){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x1fa149['name']);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x1fa149[_0xe2da('0x1b')]),_0xe2da('0x4c'));return _0x18ff95[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x4d')});})['catch'](handleError(_0x18ff95));};exports[_0xe2da('0x4e')]=function(_0x4666b3,_0x3f0a4b){logger[_0xe2da('0x14')](_0xe2da('0x4f'),_0x4666b3['body']);var _0x841de3=transferValidation['validate'](_0x4666b3[_0xe2da('0x2f')]);if(_0x841de3['length']>0x0){return _0x3f0a4b[_0xe2da('0x1c')](0x190)['json'](_0x841de3);}var _0x58f9db=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2cff55=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x29')];var _0x44b96e=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x50')];return getAgent(_0x58f9db)[_0xe2da('0x20')](function(_0x17af45){logger['info'](_0xe2da('0x35'),_0x17af45[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x17af45['name']),_0xe2da('0x51'),{'sessionId':_0x2cff55,'transferNumber':_0x44b96e});return _0x3f0a4b[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x52')});})['catch'](handleError(_0x3f0a4b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ece8dfc..4f3a0ea 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 _0x9536=['getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x36c55d,_0x1c8efa){var _0xa16625=function(_0x3071f7){while(--_0x3071f7){_0x36c55d['push'](_0x36c55d['shift']());}};_0xa16625(++_0x1c8efa);}(_0x9536,0x179));var _0x6953=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x9536[_0x146a97];return _0x259d5c;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['get'](_0x6953('0x16'),auth[_0x6953('0xc')](),controller[_0x6953('0x17')]);router[_0x6953('0x18')]('/',auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x18')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x1a')]);router[_0x6953('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x18')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller['addAgents']);router[_0x6953('0x18')](_0x6953('0x16'),auth['isAuthenticated'](),controller[_0x6953('0x1c')]);router[_0x6953('0x18')](_0x6953('0x1d'),controller[_0x6953('0x1e')]);router[_0x6953('0x18')]('/:id/send',auth[_0x6953('0xc')](),controller[_0x6953('0x1f')]);router[_0x6953('0x20')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['update']);router[_0x6953('0x21')](_0x6953('0xe'),auth['isAuthenticated'](),controller[_0x6953('0x22')]);router[_0x6953('0x21')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller['removeDispositions']);router[_0x6953('0x21')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x6953('0xc')](),controller[_0x6953('0x23')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x53d7a3,_0x1796f2){var _0x33f4d8=function(_0x5ca089){while(--_0x5ca089){_0x53d7a3['push'](_0x53d7a3['shift']());}};_0x33f4d8(++_0x1796f2);}(_0xdb28,0x106));var _0x8db2=function(_0x34e0da,_0x380206){_0x34e0da=_0x34e0da-0x0;var _0x17ee1c=_0xdb28[_0x34e0da];return _0x17ee1c;};'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('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5d6c345..f1173cb 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 _0x70f4=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x35bd68,_0x45c983){var _0xd74da8=function(_0x38187d){while(--_0x38187d){_0x35bd68['push'](_0x35bd68['shift']());}};_0xd74da8(++_0x45c983);}(_0x70f4,0xc7));var _0x470f=function(_0x398140,_0x55b247){_0x398140=_0x398140-0x0;var _0x39f02f=_0x70f4[_0x398140];return _0x39f02f;};'use strict';var Sequelize=require(_0x470f('0x0'));var rs=require('randomstring');module[_0x470f('0x1')]={'name':{'type':Sequelize[_0x470f('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x470f('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x470f('0x2')],'defaultValue':function(){return rs[_0x470f('0x3')]();}},'phone':{'type':Sequelize[_0x470f('0x2')]},'type':{'type':Sequelize[_0x470f('0x4')](_0x470f('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x470f('0x2')]},'baseUrl':{'type':Sequelize[_0x470f('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x470f('0x6')],'defaultValue':function(){return _0x470f('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x470f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x470f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x470f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x470f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x470f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x470f('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x470f('0x8')],'defaultValue':![],'comment':_0x470f('0xa'),'set':function(_0x57d9a9){if(!_0x57d9a9){this[_0x470f('0xb')](_0x470f('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x57d9a9);}},'description':{'type':Sequelize[_0x470f('0x2')]}}; \ No newline at end of file +var _0x3cc3=['twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3cc3,0x158));var _0x33cc=function(_0x21321e,_0x2bb02a){_0x21321e=_0x21321e-0x0;var _0xb93a14=_0x3cc3[_0x21321e];return _0xb93a14;};'use strict';var Sequelize=require(_0x33cc('0x0'));var rs=require('randomstring');module[_0x33cc('0x1')]={'name':{'type':Sequelize[_0x33cc('0x2')],'unique':_0x33cc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x33cc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x33cc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x33cc('0x2')],'defaultValue':function(){return rs[_0x33cc('0x4')]();}},'phone':{'type':Sequelize[_0x33cc('0x2')]},'type':{'type':Sequelize[_0x33cc('0x5')](_0x33cc('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x33cc('0x2')]},'baseUrl':{'type':Sequelize[_0x33cc('0x2')]},'authToken':{'type':Sequelize[_0x33cc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x33cc('0x7')],'defaultValue':function(){return _0x33cc('0x8');}},'notificationSound':{'type':Sequelize[_0x33cc('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x33cc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x33cc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x33cc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0x33cc('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x33cc('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f9240){if(!_0x3f9240){this[_0x33cc('0xb')](_0x33cc('0xc'),null);}this[_0x33cc('0xb')](_0x33cc('0xd'),_0x3f9240);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b51a9f3..66b198b 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 _0x9085=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','get','WhatsappAccounts','stack','name','send','index','map','WhatsappAccount','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','Pause','mandatoryDispositionPause','rawAttributes','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','length','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','message_id','applications','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','WhatsappInteraction','interaction','push','close','unmanaged','created','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','List','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir'];(function(_0x189033,_0x1392b7){var _0x48d33e=function(_0x5c5d7c){while(--_0x5c5d7c){_0x189033['push'](_0x189033['shift']());}};_0x48d33e(++_0x1392b7);}(_0x9085,0x17b));var _0x5908=function(_0x2a7b74,_0x45b0d5){_0x2a7b74=_0x2a7b74-0x0;var _0x114666=_0x9085[_0x2a7b74];return _0x114666;};'use strict';var emlformat=require(_0x5908('0x0'));var rimraf=require(_0x5908('0x1'));var zipdir=require(_0x5908('0x2'));var jsonpatch=require(_0x5908('0x3'));var rp=require('request-promise');var moment=require(_0x5908('0x4'));var BPromise=require(_0x5908('0x5'));var Mustache=require('mustache');var util=require(_0x5908('0x6'));var path=require(_0x5908('0x7'));var sox=require(_0x5908('0x8'));var csv=require(_0x5908('0x9'));var ejs=require(_0x5908('0xa'));var fs=require('fs');var fs_extra=require(_0x5908('0xb'));var _=require(_0x5908('0xc'));var squel=require(_0x5908('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5908('0x9'));var querystring=require(_0x5908('0xe'));var Papa=require(_0x5908('0xf'));var Redis=require(_0x5908('0x10'));var authService=require(_0x5908('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5908('0x12'));var hardwareService=require(_0x5908('0x13'));var logger=require(_0x5908('0x14'))('api');var utils=require(_0x5908('0x15'));var config=require(_0x5908('0x16'));var licenseUtil=require(_0x5908('0x17'));var db=require('../../mysqldb')['db'];config[_0x5908('0x18')]=_[_0x5908('0x19')](config[_0x5908('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5908('0x18')]));require('./whatsappAccount.socket')[_0x5908('0x1a')](socket);var jayson=require(_0x5908('0x1b'));var client=jayson[_0x5908('0x1c')][_0x5908('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x26ad39,_0x5b662d,_0x4ba651,_0x5e9afe){return new BPromise(function(_0x21abe2,_0x56b15b){var _0x449683=_0x5e9afe||client;return _0x449683[_0x5908('0x1e')](_0x26ad39,_0x4ba651)['then'](function(_0x23e8f3){logger[_0x5908('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x5b662d,'request\x20sent');logger['debug'](_0x5908('0x20'),_0x5b662d,_0x5908('0x21'),JSON[_0x5908('0x22')](_0x23e8f3));if(_0x23e8f3[_0x5908('0x23')]){if(_0x23e8f3['error'][_0x5908('0x24')]===0x1f4){logger[_0x5908('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x5b662d,_0x23e8f3[_0x5908('0x23')][_0x5908('0x25')]);return _0x56b15b(_0x23e8f3[_0x5908('0x23')][_0x5908('0x25')]);}logger[_0x5908('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x5b662d,_0x23e8f3[_0x5908('0x23')][_0x5908('0x25')]);return _0x21abe2(_0x23e8f3[_0x5908('0x23')][_0x5908('0x25')]);}else{logger[_0x5908('0x1f')](_0x5908('0x26'),_0x5b662d,'request\x20sent');_0x21abe2(_0x23e8f3['result'][_0x5908('0x25')]);}})[_0x5908('0x27')](function(_0x12b7e0){logger[_0x5908('0x23')](_0x5908('0x26'),_0x5b662d,_0x12b7e0);_0x56b15b(_0x12b7e0);});});}function respondWithStatusCode(_0x2f031d,_0x3789fa){_0x3789fa=_0x3789fa||0xcc;return function(_0x1074e8){if(_0x1074e8){return _0x2f031d[_0x5908('0x28')](_0x3789fa);}return _0x2f031d[_0x5908('0x29')](_0x3789fa)[_0x5908('0x2a')]();};}function respondWithResult(_0xd66c30,_0x288fe6){_0x288fe6=_0x288fe6||0xc8;return function(_0x4d4e27){if(_0x4d4e27){return _0xd66c30[_0x5908('0x29')](_0x288fe6)['json'](_0x4d4e27);}};}function respondWithFilteredResult(_0x515df6,_0x17cf99){return function(_0x55c98a){if(_0x55c98a){var _0x13856f=typeof _0x17cf99[_0x5908('0x2b')]===_0x5908('0x2c')&&typeof _0x17cf99[_0x5908('0x2d')]==='undefined';var _0x33c310=_0x55c98a['count'];var _0x4b3a91=_0x13856f?0x0:_0x17cf99[_0x5908('0x2b')];var _0x86776c=_0x13856f?_0x55c98a[_0x5908('0x2e')]:_0x17cf99[_0x5908('0x2b')]+_0x17cf99['limit'];var _0x264ea8;if(_0x86776c>=_0x33c310){_0x86776c=_0x33c310;_0x264ea8=0xc8;}else{_0x264ea8=0xce;}_0x515df6['status'](_0x264ea8);return _0x515df6[_0x5908('0x2f')]('Content-Range',_0x4b3a91+'-'+_0x86776c+'/'+_0x33c310)[_0x5908('0x30')](_0x55c98a);}return null;};}function patchUpdates(_0x287874){return function(_0x3aec29){try{jsonpatch['apply'](_0x3aec29,_0x287874,!![]);}catch(_0x1135be){return BPromise[_0x5908('0x31')](_0x1135be);}return _0x3aec29[_0x5908('0x32')]();};}function saveUpdates(_0x466c40,_0x38900e){return function(_0x4017ab){if(_0x4017ab){return _0x4017ab[_0x5908('0x33')](_0x466c40)[_0x5908('0x34')](function(_0x4dfdbd){return _0x4dfdbd;});}return null;};}function removeEntity(_0x3a6532,_0x52fbec){return function(_0x7949ea){if(_0x7949ea){return _0x7949ea[_0x5908('0x35')]()[_0x5908('0x34')](function(){var _0x205cd4=_0x7949ea[_0x5908('0x36')]({'plain':!![]});var _0x431c3c=_0x5908('0x37');return db['UserProfileResource'][_0x5908('0x35')]({'where':{'type':_0x431c3c,'resourceId':_0x205cd4['id']}})[_0x5908('0x34')](function(){return _0x7949ea;});})[_0x5908('0x34')](function(){_0x3a6532[_0x5908('0x29')](0xcc)[_0x5908('0x2a')]();});}};}function handleEntityNotFound(_0x48b785,_0x2bef6c){return function(_0x36099f){if(!_0x36099f){_0x48b785[_0x5908('0x28')](0x194);}return _0x36099f;};}function handleError(_0x2171e1,_0x58971a){_0x58971a=_0x58971a||0x1f4;return function(_0x1ac1c3){logger[_0x5908('0x23')](_0x1ac1c3[_0x5908('0x38')]);if(_0x1ac1c3['name']){delete _0x1ac1c3[_0x5908('0x39')];}_0x2171e1[_0x5908('0x29')](_0x58971a)[_0x5908('0x3a')](_0x1ac1c3);};}exports[_0x5908('0x3b')]=function(_0x4713f2,_0x29c7b6){var _0x39d128={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4f11ef={},_0x2e1131={'count':0x0,'rows':[]};var _0x2c5e46=_[_0x5908('0x3c')](db[_0x5908('0x3d')]['rawAttributes'],function(_0x281e2a){return{'name':_0x281e2a['fieldName'],'type':_0x281e2a[_0x5908('0x3e')][_0x5908('0x3f')]};});_0x4f11ef[_0x5908('0x40')]=_[_0x5908('0x3c')](_0x2c5e46,_0x5908('0x39'));_0x4f11ef[_0x5908('0x41')]=_[_0x5908('0x42')](_0x4713f2[_0x5908('0x41')]);_0x4f11ef[_0x5908('0x43')]=_[_0x5908('0x44')](_0x4f11ef[_0x5908('0x40')],_0x4f11ef[_0x5908('0x41')]);_0x39d128[_0x5908('0x45')]=_[_0x5908('0x44')](_0x4f11ef['model'],qs['fields'](_0x4713f2[_0x5908('0x41')]['fields']));_0x39d128['attributes']=_0x39d128['attributes']['length']?_0x39d128[_0x5908('0x45')]:_0x4f11ef[_0x5908('0x40')];if(!_0x4713f2[_0x5908('0x41')][_0x5908('0x46')](_0x5908('0x47'))){_0x39d128[_0x5908('0x2d')]=qs[_0x5908('0x2d')](_0x4713f2[_0x5908('0x41')][_0x5908('0x2d')]);_0x39d128[_0x5908('0x2b')]=qs[_0x5908('0x2b')](_0x4713f2[_0x5908('0x41')][_0x5908('0x2b')]);}_0x39d128['order']=qs[_0x5908('0x48')](_0x4713f2[_0x5908('0x41')]['sort']);_0x39d128[_0x5908('0x49')]=qs[_0x5908('0x43')](_[_0x5908('0x4a')](_0x4713f2[_0x5908('0x41')],_0x4f11ef['filters']),_0x2c5e46);if(_0x4713f2[_0x5908('0x41')][_0x5908('0x4b')]){_0x39d128[_0x5908('0x49')]=_[_0x5908('0x4c')](_0x39d128[_0x5908('0x49')],{'$or':_[_0x5908('0x3c')](_0x2c5e46,function(_0x2c12b4){if(_0x2c12b4[_0x5908('0x3e')]!==_0x5908('0x4d')){var _0x34a80a={};_0x34a80a[_0x2c12b4[_0x5908('0x39')]]={'$like':'%'+_0x4713f2[_0x5908('0x41')][_0x5908('0x4b')]+'%'};return _0x34a80a;}})});}_0x39d128=_[_0x5908('0x4c')]({},_0x39d128,_0x4713f2[_0x5908('0x4e')]);var _0x27e419={'where':_0x39d128[_0x5908('0x49')]};return db['WhatsappAccount']['count'](_0x27e419)[_0x5908('0x34')](function(_0x29e75c){_0x2e1131['count']=_0x29e75c;if(_0x4713f2[_0x5908('0x41')][_0x5908('0x4f')]){_0x39d128['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x39d128);})['then'](function(_0x454849){_0x2e1131[_0x5908('0x50')]=_0x454849;return _0x2e1131;})[_0x5908('0x34')](respondWithFilteredResult(_0x29c7b6,_0x39d128))[_0x5908('0x27')](handleError(_0x29c7b6,null));};exports['show']=function(_0x3ab267,_0x2dcecd){var _0x45f733={'raw':![],'where':{'id':_0x3ab267[_0x5908('0x51')]['id']},'include':[{'model':db[_0x5908('0x52')],'as':_0x5908('0x53')}]},_0x31acab={};_0x31acab[_0x5908('0x40')]=_[_0x5908('0x42')](db['WhatsappAccount'][_0x5908('0x54')]);_0x31acab[_0x5908('0x41')]=_['keys'](_0x3ab267[_0x5908('0x41')]);_0x31acab[_0x5908('0x43')]=_[_0x5908('0x44')](_0x31acab['model'],_0x31acab['query']);_0x45f733[_0x5908('0x45')]=_['intersection'](_0x31acab[_0x5908('0x40')],qs[_0x5908('0x55')](_0x3ab267[_0x5908('0x41')][_0x5908('0x55')]));_0x45f733[_0x5908('0x45')]=_0x45f733['attributes']['length']?_0x45f733[_0x5908('0x45')]:_0x31acab[_0x5908('0x40')];if(_0x3ab267[_0x5908('0x41')]['includeAll']){_0x45f733[_0x5908('0x56')]=[{'all':!![]}];}_0x45f733=_[_0x5908('0x4c')]({},_0x45f733,_0x3ab267[_0x5908('0x4e')]);return db['WhatsappAccount'][_0x5908('0x57')](_0x45f733)[_0x5908('0x34')](handleEntityNotFound(_0x2dcecd,null))[_0x5908('0x34')](respondWithResult(_0x2dcecd,null))[_0x5908('0x27')](handleError(_0x2dcecd,null));};exports['create']=function(_0xb3ecb,_0x43247f){return db[_0x5908('0x3d')][_0x5908('0x58')](_0xb3ecb['body'],{})['then'](function(_0x469bcd){var _0x4e46fa=_0xb3ecb[_0x5908('0x59')][_0x5908('0x36')]({'plain':!![]});if(!_0x4e46fa)throw new Error(_0x5908('0x5a'));if(_0x4e46fa[_0x5908('0x5b')]==='user'){var _0x17e2ac=_0x469bcd[_0x5908('0x36')]({'plain':!![]});var _0x421ef0='WhatsappAccounts';return db[_0x5908('0x5c')][_0x5908('0x57')]({'where':{'name':_0x421ef0,'userProfileId':_0x4e46fa[_0x5908('0x5d')]},'raw':!![]})['then'](function(_0x1fd18e){if(_0x1fd18e&&_0x1fd18e[_0x5908('0x5e')]===0x0){return db[_0x5908('0x5f')]['create']({'name':_0x17e2ac['name'],'resourceId':_0x17e2ac['id'],'type':_0x1fd18e['name'],'sectionId':_0x1fd18e['id']},{})[_0x5908('0x34')](function(){return _0x469bcd;});}else{return _0x469bcd;}})[_0x5908('0x27')](function(_0x365fde){logger[_0x5908('0x23')](_0x5908('0x60'),_0x365fde);throw _0x365fde;});}return _0x469bcd;})['then'](respondWithResult(_0x43247f,0xc9))[_0x5908('0x27')](handleError(_0x43247f,null));};exports['update']=function(_0x2c1f6a,_0x524179){if(_0x2c1f6a[_0x5908('0x61')]['id']){delete _0x2c1f6a[_0x5908('0x61')]['id'];}return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x2c1f6a[_0x5908('0x51')]['id']},'include':[{'model':db[_0x5908('0x52')],'as':_0x5908('0x53')}]})[_0x5908('0x34')](handleEntityNotFound(_0x524179,null))['then'](saveUpdates(_0x2c1f6a[_0x5908('0x61')],null))[_0x5908('0x34')](respondWithResult(_0x524179,null))[_0x5908('0x27')](handleError(_0x524179,null));};exports[_0x5908('0x35')]=function(_0x3e3cc6,_0x1b73d5){return db['WhatsappAccount'][_0x5908('0x57')]({'where':{'id':_0x3e3cc6['params']['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x1b73d5,null))[_0x5908('0x34')](removeEntity(_0x1b73d5,null))['catch'](handleError(_0x1b73d5,null));};exports[_0x5908('0x62')]=function(_0x273416,_0x2644c6){return db['WhatsappAccount']['describe']()[_0x5908('0x34')](respondWithResult(_0x2644c6,null))[_0x5908('0x27')](handleError(_0x2644c6,null));};exports[_0x5908('0x63')]=function(_0x37547f,_0x2233d7,_0x4edb31){if(_0x37547f[_0x5908('0x61')]['id']){delete _0x37547f[_0x5908('0x61')]['id'];}return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x37547f[_0x5908('0x51')]['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x2233d7,null))[_0x5908('0x34')](function(_0x1f2d99){if(_0x1f2d99){_0x37547f[_0x5908('0x61')][_0x5908('0x64')]=_0x1f2d99['id'];return db[_0x5908('0x65')][_0x5908('0x58')](_0x37547f['body']);}})[_0x5908('0x34')](respondWithResult(_0x2233d7,null))[_0x5908('0x27')](handleError(_0x2233d7,null));};exports['getDispositions']=function(_0x17152e,_0xb9cc42,_0x113408){var _0x3d0de5={'raw':![],'where':{}};var _0x4d082f={};var _0x10a4f8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5908('0x66')]({'where':{'id':_0x17152e['params']['id']}})[_0x5908('0x34')](handleEntityNotFound(_0xb9cc42,null))[_0x5908('0x34')](function(_0x171553){if(_0x171553){_0x4d082f[_0x5908('0x40')]=_[_0x5908('0x42')](db[_0x5908('0x65')][_0x5908('0x54')]);_0x4d082f[_0x5908('0x41')]=_[_0x5908('0x42')](_0x17152e[_0x5908('0x41')]);_0x4d082f[_0x5908('0x43')]=_[_0x5908('0x44')](_0x4d082f[_0x5908('0x40')],_0x4d082f['query']);_0x3d0de5['attributes']=_[_0x5908('0x44')](_0x4d082f[_0x5908('0x40')],qs['fields'](_0x17152e['query'][_0x5908('0x55')]));_0x3d0de5[_0x5908('0x45')]=_0x3d0de5[_0x5908('0x45')]['length']?_0x3d0de5['attributes']:_0x4d082f[_0x5908('0x40')];if(!_0x17152e[_0x5908('0x41')]['hasOwnProperty'](_0x5908('0x47'))){_0x3d0de5[_0x5908('0x2d')]=qs['limit'](_0x17152e[_0x5908('0x41')]['limit']);_0x3d0de5[_0x5908('0x2b')]=qs[_0x5908('0x2b')](_0x17152e[_0x5908('0x41')][_0x5908('0x2b')]);}_0x3d0de5[_0x5908('0x67')]=qs[_0x5908('0x48')](_0x17152e['query'][_0x5908('0x48')]);_0x3d0de5[_0x5908('0x49')]=qs['filters'](_[_0x5908('0x4a')](_0x17152e[_0x5908('0x41')],_0x4d082f['filters']));_0x3d0de5['where'][_0x5908('0x64')]=_0x171553['id'];if(_0x17152e['query'][_0x5908('0x4b')]){_0x3d0de5[_0x5908('0x49')]=_['merge'](_0x3d0de5[_0x5908('0x49')],{'$or':_['map'](_0x3d0de5['attributes'],function(_0x43ed04){var _0xb33f03={};_0xb33f03[_0x43ed04]={'$like':'%'+_0x17152e['query'][_0x5908('0x4b')]+'%'};return _0xb33f03;})});}_0x3d0de5=_[_0x5908('0x4c')]({},_0x3d0de5,_0x17152e[_0x5908('0x4e')]);return db['Disposition']['count']({'where':_0x3d0de5[_0x5908('0x49')]})['then'](function(_0x18624b){_0x10a4f8[_0x5908('0x2e')]=_0x18624b;if(_0x17152e[_0x5908('0x41')][_0x5908('0x4f')]){_0x3d0de5[_0x5908('0x56')]=[{'all':!![]}];}return db[_0x5908('0x65')][_0x5908('0x68')](_0x3d0de5);})[_0x5908('0x34')](function(_0x13b6cb){_0x10a4f8[_0x5908('0x50')]=_0x13b6cb;return _0x10a4f8;});}})['then'](respondWithFilteredResult(_0xb9cc42,_0x3d0de5))[_0x5908('0x27')](handleError(_0xb9cc42,null));};exports[_0x5908('0x69')]=function(_0x1f36ee,_0x4619e4,_0x59e1b8){return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x1f36ee['params']['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x4619e4,null))['then'](function(_0x131ada){if(_0x131ada){return _0x131ada[_0x5908('0x69')](_0x1f36ee[_0x5908('0x41')][_0x5908('0x6a')]);}})['then'](respondWithStatusCode(_0x4619e4,null))[_0x5908('0x27')](handleError(_0x4619e4,null));};exports['addAnswer']=function(_0x535262,_0x51c0df,_0x884876){if(_0x535262[_0x5908('0x61')]['id']){delete _0x535262['body']['id'];}return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x535262['params']['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x51c0df,null))[_0x5908('0x34')](function(_0x1a06be){if(_0x1a06be){_0x535262[_0x5908('0x61')][_0x5908('0x64')]=_0x1a06be['id'];return db[_0x5908('0x6b')]['create'](_0x535262[_0x5908('0x61')]);}})[_0x5908('0x34')](respondWithResult(_0x51c0df,null))[_0x5908('0x27')](handleError(_0x51c0df,null));};exports[_0x5908('0x6c')]=function(_0x2cde77,_0x6feca6,_0x388e7b){var _0x29c8ab={'raw':![],'where':{}};var _0x265b0b={};var _0x2e6efe={'count':0x0,'rows':[]};return db[_0x5908('0x3d')][_0x5908('0x66')]({'where':{'id':_0x2cde77['params']['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x6feca6,null))[_0x5908('0x34')](function(_0x18768c){if(_0x18768c){_0x265b0b[_0x5908('0x40')]=_[_0x5908('0x42')](db[_0x5908('0x6b')][_0x5908('0x54')]);_0x265b0b[_0x5908('0x41')]=_[_0x5908('0x42')](_0x2cde77[_0x5908('0x41')]);_0x265b0b[_0x5908('0x43')]=_[_0x5908('0x44')](_0x265b0b[_0x5908('0x40')],_0x265b0b[_0x5908('0x41')]);_0x29c8ab[_0x5908('0x45')]=_['intersection'](_0x265b0b['model'],qs[_0x5908('0x55')](_0x2cde77[_0x5908('0x41')][_0x5908('0x55')]));_0x29c8ab['attributes']=_0x29c8ab[_0x5908('0x45')][_0x5908('0x6d')]?_0x29c8ab[_0x5908('0x45')]:_0x265b0b[_0x5908('0x40')];if(!_0x2cde77[_0x5908('0x41')][_0x5908('0x46')]('nolimit')){_0x29c8ab[_0x5908('0x2d')]=qs[_0x5908('0x2d')](_0x2cde77[_0x5908('0x41')]['limit']);_0x29c8ab[_0x5908('0x2b')]=qs['offset'](_0x2cde77[_0x5908('0x41')][_0x5908('0x2b')]);}_0x29c8ab['order']=qs[_0x5908('0x48')](_0x2cde77[_0x5908('0x41')]['sort']);_0x29c8ab[_0x5908('0x49')]=qs[_0x5908('0x43')](_[_0x5908('0x4a')](_0x2cde77['query'],_0x265b0b[_0x5908('0x43')]));_0x29c8ab[_0x5908('0x49')][_0x5908('0x64')]=_0x18768c['id'];if(_0x2cde77[_0x5908('0x41')]['filter']){_0x29c8ab['where']=_[_0x5908('0x4c')](_0x29c8ab[_0x5908('0x49')],{'$or':_['map'](_0x29c8ab[_0x5908('0x45')],function(_0x3427eb){var _0x1a4c71={};_0x1a4c71[_0x3427eb]={'$like':'%'+_0x2cde77[_0x5908('0x41')][_0x5908('0x4b')]+'%'};return _0x1a4c71;})});}_0x29c8ab=_[_0x5908('0x4c')]({},_0x29c8ab,_0x2cde77[_0x5908('0x4e')]);return db['CannedAnswer']['count']({'where':_0x29c8ab['where']})[_0x5908('0x34')](function(_0x51da03){_0x2e6efe[_0x5908('0x2e')]=_0x51da03;if(_0x2cde77[_0x5908('0x41')]['includeAll']){_0x29c8ab[_0x5908('0x56')]=[{'all':!![]}];}return db[_0x5908('0x6b')]['findAll'](_0x29c8ab);})[_0x5908('0x34')](function(_0x188ccc){_0x2e6efe['rows']=_0x188ccc;return _0x2e6efe;});}})[_0x5908('0x34')](respondWithFilteredResult(_0x6feca6,_0x29c8ab))[_0x5908('0x27')](handleError(_0x6feca6,null));};exports[_0x5908('0x6e')]=function(_0x5be9bc,_0x3385cd,_0x1d5744){return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x5be9bc['params']['id']}})['then'](handleEntityNotFound(_0x3385cd,null))[_0x5908('0x34')](function(_0x3ed153){if(_0x3ed153){return _0x3ed153[_0x5908('0x6e')](_0x5be9bc[_0x5908('0x41')][_0x5908('0x6a')]);}})['then'](respondWithStatusCode(_0x3385cd,null))['catch'](handleError(_0x3385cd,null));};exports[_0x5908('0x6f')]=function(_0x29ef30,_0x44ad52,_0x3a2fc2){return db[_0x5908('0x3d')]['find']({'where':{'id':_0x29ef30[_0x5908('0x51')]['id']}})['then'](handleEntityNotFound(_0x44ad52,null))[_0x5908('0x34')](function(_0x4455ba){if(_0x4455ba){return _0x4455ba['addAgents'](_0x29ef30[_0x5908('0x61')][_0x5908('0x6a')],_[_0x5908('0x70')](_0x29ef30[_0x5908('0x61')],[_0x5908('0x6a'),'id'])||{})[_0x5908('0x71')](function(_0x16a8fe){for(var _0x28272e=0x0;_0x28272e<_0x29ef30[_0x5908('0x61')][_0x5908('0x6a')][_0x5908('0x6d')];_0x28272e+=0x1){socket[_0x5908('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x29ef30[_0x5908('0x61')]['ids'][_0x28272e]),'WhatsappAccountId':Number(_0x29ef30['params']['id'])});}return _0x16a8fe;});}})[_0x5908('0x34')](respondWithResult(_0x44ad52,null))['catch'](handleError(_0x44ad52,null));};exports[_0x5908('0x73')]=function(_0x34bf01,_0x239eb9,_0xb36eae){return db['WhatsappAccount'][_0x5908('0x57')]({'where':{'id':_0x34bf01[_0x5908('0x51')]['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x239eb9,null))[_0x5908('0x34')](function(_0x133c7a){if(_0x133c7a){return _0x133c7a[_0x5908('0x73')](_0x34bf01[_0x5908('0x41')][_0x5908('0x6a')])[_0x5908('0x34')](function(){if(_[_0x5908('0x74')](_0x34bf01[_0x5908('0x41')][_0x5908('0x6a')])){for(var _0x58681c=0x0;_0x58681c<_0x34bf01[_0x5908('0x41')][_0x5908('0x6a')][_0x5908('0x6d')];_0x58681c+=0x1){socket[_0x5908('0x72')](_0x5908('0x75'),{'UserId':Number(_0x34bf01[_0x5908('0x41')]['ids'][_0x58681c]),'WhatsappAccountId':Number(_0x34bf01[_0x5908('0x51')]['id'])});}}else{socket[_0x5908('0x72')](_0x5908('0x75'),{'UserId':Number(_0x34bf01['query'][_0x5908('0x6a')]),'WhatsappAccountId':Number(_0x34bf01[_0x5908('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x239eb9,null))['catch'](handleError(_0x239eb9,null));};exports[_0x5908('0x76')]=function(_0x5ce5e5,_0x5d46f,_0x33b4b5){var _0x3ab32e={};var _0x255608={};var _0xc8cccc;var _0x1395a6;return db['WhatsappAccount'][_0x5908('0x66')]({'where':{'id':_0x5ce5e5[_0x5908('0x51')]['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x5d46f,null))['then'](function(_0x52f91c){if(_0x52f91c){_0xc8cccc=_0x52f91c;_0x255608['model']=_[_0x5908('0x42')](db['User'][_0x5908('0x54')]);_0x255608['query']=_[_0x5908('0x42')](_0x5ce5e5[_0x5908('0x41')]);_0x255608[_0x5908('0x43')]=_['intersection'](_0x255608[_0x5908('0x40')],_0x255608['query']);_0x3ab32e[_0x5908('0x45')]=_['intersection'](_0x255608[_0x5908('0x40')],qs[_0x5908('0x55')](_0x5ce5e5[_0x5908('0x41')][_0x5908('0x55')]));_0x3ab32e[_0x5908('0x45')]=_0x3ab32e['attributes']['length']?_0x3ab32e[_0x5908('0x45')]:_0x255608[_0x5908('0x40')];_0x3ab32e[_0x5908('0x67')]=qs[_0x5908('0x48')](_0x5ce5e5[_0x5908('0x41')]['sort']);_0x3ab32e['where']=qs[_0x5908('0x43')](_[_0x5908('0x4a')](_0x5ce5e5['query'],_0x255608[_0x5908('0x43')]));if(_0x5ce5e5[_0x5908('0x41')]['filter']){_0x3ab32e[_0x5908('0x49')]=_[_0x5908('0x4c')](_0x3ab32e[_0x5908('0x49')],{'$or':_['map'](_0x3ab32e[_0x5908('0x45')],function(_0x43ebab){var _0x597a72={};_0x597a72[_0x43ebab]={'$like':'%'+_0x5ce5e5[_0x5908('0x41')][_0x5908('0x4b')]+'%'};return _0x597a72;})});}_0x3ab32e=_[_0x5908('0x4c')]({},_0x3ab32e,_0x5ce5e5[_0x5908('0x4e')]);return _0xc8cccc[_0x5908('0x76')](_0x3ab32e);}})[_0x5908('0x34')](function(_0x29ac70){if(_0x29ac70){_0x1395a6=_0x29ac70[_0x5908('0x6d')];if(!_0x5ce5e5[_0x5908('0x41')][_0x5908('0x46')]('nolimit')){_0x3ab32e[_0x5908('0x2d')]=qs['limit'](_0x5ce5e5['query']['limit']);_0x3ab32e['offset']=qs[_0x5908('0x2b')](_0x5ce5e5[_0x5908('0x41')]['offset']);}return _0xc8cccc['getAgents'](_0x3ab32e);}})[_0x5908('0x34')](function(_0x58b152){if(_0x58b152){return _0x58b152?{'count':_0x1395a6,'rows':_0x58b152}:null;}})[_0x5908('0x34')](respondWithResult(_0x5d46f,null))['catch'](handleError(_0x5d46f,null));};exports['addApplications']=function(_0x1e8dfc,_0x429698){var _0x1bfde0=_0x1e8dfc[_0x5908('0x51')]['id'];var _0xaff5c0=_0x1e8dfc[_0x5908('0x61')];var _0x52d509=0xc8;var _0x1eb9bc=null;return db[_0x5908('0x77')]['transaction']({'isolationLevel':db[_0x5908('0x77')][_0x5908('0x78')]['ISOLATION_LEVELS'][_0x5908('0x79')]},function(_0x8b6b77){return db['WhatsappAccount'][_0x5908('0x66')]({'where':{'id':_0x1bfde0},'transaction':_0x8b6b77})[_0x5908('0x34')](function(_0x44849a){if(_0x44849a){return db[_0x5908('0x7a')][_0x5908('0x35')]({'where':{'WhatsappAccountId':_0x1bfde0},'transaction':_0x8b6b77})[_0x5908('0x34')](function(){var _0x107234=_['map'](_0xaff5c0,function(_0xb9c48b){_0xb9c48b[_0x5908('0x64')]=_0x1bfde0;return _0xb9c48b;});return db['WhatsappApplication'][_0x5908('0x7b')](_0x107234,{'transaction':_0x8b6b77});});}else{_0x52d509=0x194;_0x1eb9bc=[];}});})[_0x5908('0x34')](function(){if(_0x52d509!==0x194){return db[_0x5908('0x7a')][_0x5908('0x7c')]({'where':{'WhatsappAccountId':_0x1bfde0},'order':'priority'})[_0x5908('0x34')](function(_0x14b4d0){_0x1eb9bc=_0x14b4d0;});}})[_0x5908('0x27')](function(_0x33fa0b){_0x52d509=0x1f4;logger['error'](_0x33fa0b[_0x5908('0x38')]);if(_0x33fa0b['name']){delete _0x33fa0b['name'];}_0x1eb9bc=_0x33fa0b;})['finally'](function(){if(_0x1eb9bc===null){_0x429698['sendStatus'](_0x52d509);}else{if(_0x52d509===0x1f4){_0x429698[_0x5908('0x29')](_0x52d509)[_0x5908('0x3a')](_0x1eb9bc);}else{_0x429698[_0x5908('0x29')](_0x52d509)[_0x5908('0x30')](_0x1eb9bc);}}});};exports[_0x5908('0x7d')]=function(_0x4f47b5,_0x4fd9ee,_0x21e03a){var _0x56115d={};var _0x19b7a4={};var _0x299f7f;var _0x599bd5;return db['WhatsappAccount'][_0x5908('0x66')]({'where':{'id':_0x4f47b5[_0x5908('0x51')]['id']}})[_0x5908('0x34')](handleEntityNotFound(_0x4fd9ee,null))[_0x5908('0x34')](function(_0x519873){if(_0x519873){_0x299f7f=_0x519873;_0x19b7a4[_0x5908('0x40')]=_['keys'](db[_0x5908('0x7a')][_0x5908('0x54')]);_0x19b7a4['query']=_[_0x5908('0x42')](_0x4f47b5[_0x5908('0x41')]);_0x19b7a4[_0x5908('0x43')]=_[_0x5908('0x44')](_0x19b7a4[_0x5908('0x40')],_0x19b7a4[_0x5908('0x41')]);_0x56115d[_0x5908('0x45')]=_[_0x5908('0x44')](_0x19b7a4[_0x5908('0x40')],qs[_0x5908('0x55')](_0x4f47b5[_0x5908('0x41')]['fields']));_0x56115d['attributes']=_0x56115d['attributes'][_0x5908('0x6d')]?_0x56115d[_0x5908('0x45')]:_0x19b7a4[_0x5908('0x40')];_0x56115d[_0x5908('0x67')]=qs[_0x5908('0x48')](_0x4f47b5[_0x5908('0x41')][_0x5908('0x48')]);_0x56115d['where']=qs[_0x5908('0x43')](_['pick'](_0x4f47b5[_0x5908('0x41')],_0x19b7a4['filters']));if(_0x4f47b5[_0x5908('0x41')]['filter']){_0x56115d['where']=_[_0x5908('0x4c')](_0x56115d['where'],{'$or':_['map'](_0x56115d[_0x5908('0x45')],function(_0x304d0f){var _0x1ba10c={};_0x1ba10c[_0x304d0f]={'$like':'%'+_0x4f47b5[_0x5908('0x41')]['filter']+'%'};return _0x1ba10c;})});}_0x56115d=_[_0x5908('0x4c')]({},_0x56115d,_0x4f47b5['options']);return _0x299f7f[_0x5908('0x7d')](_0x56115d);}})[_0x5908('0x34')](function(_0x23d157){if(_0x23d157){_0x599bd5=_0x23d157[_0x5908('0x6d')];if(!_0x4f47b5[_0x5908('0x41')]['hasOwnProperty'](_0x5908('0x47'))){_0x56115d[_0x5908('0x2d')]=qs[_0x5908('0x2d')](_0x4f47b5[_0x5908('0x41')][_0x5908('0x2d')]);_0x56115d['offset']=qs[_0x5908('0x2b')](_0x4f47b5[_0x5908('0x41')][_0x5908('0x2b')]);}return _0x299f7f['getApplications'](_0x56115d);}})[_0x5908('0x34')](function(_0x1533f9){if(_0x1533f9){return _0x1533f9?{'count':_0x599bd5,'rows':_0x1533f9}:null;}})['then'](respondWithResult(_0x4fd9ee,null))[_0x5908('0x27')](handleError(_0x4fd9ee,null));};exports[_0x5908('0x7e')]=function(_0x41f325,_0x593bd7,_0x2dcf99){var _0x3fb24a={'channel':_0x5908('0x7f')};var _0x1695fc=[];var _0x5086ef=[];var _0x2783f7={};return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x41f325[_0x5908('0x51')]['id']},'include':[{'model':db[_0x5908('0x7a')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x593bd7,null))[_0x5908('0x34')](function(_0x24ab45){_0x3fb24a['account']=_0x24ab45;if(_0x3fb24a[_0x5908('0x80')]&&_0x3fb24a[_0x5908('0x80')][_0x5908('0x3e')]===_0x5908('0x81')&&_0x41f325[_0x5908('0x61')][_0x5908('0x82')]){if(_0x41f325['body'][_0x5908('0x82')][_0x5908('0x6d')]===0x0)return;if(_0x41f325['body'][_0x5908('0x82')][0x0]['state']!==_0x5908('0x83'))return;return db[_0x5908('0x84')][_0x5908('0x33')]({'read':!![],'readAt':_0x41f325['body'][_0x5908('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x41f325[_0x5908('0x61')]['statuses'][0x0][_0x5908('0x85')]},'individualHooks':!![]})[_0x5908('0x34')](function(_0x3c5d43){return _0x593bd7[_0x5908('0x29')](0xc8)['json'](_0x3c5d43);});}_0x3fb24a[_0x5908('0x86')]=_[_0x5908('0x87')](_0x24ab45[_0x5908('0x88')],['priority'],[_0x5908('0x89')]);if(_0x3fb24a[_0x5908('0x80')][_0x5908('0x88')]){delete _0x3fb24a[_0x5908('0x80')][_0x5908('0x88')];}return db[_0x5908('0x8a')][_0x5908('0x62')]()[_0x5908('0x34')](function(_0x2fbf72){if(!_0x2fbf72){throw new db['Sequelize'][(_0x5908('0x8b'))](_0x5908('0x8c'));}_0x1695fc=_[_0x5908('0x8d')](_[_0x5908('0x42')](_0x2fbf72),[_0x5908('0x8e'),_0x5908('0x8f')]);_0x5086ef=_[_0x5908('0x8d')](_[_0x5908('0x42')](_0x2fbf72),[_0x5908('0x8e'),_0x5908('0x8f'),_0x5908('0x90'),'ListId']);_0x3fb24a[_0x5908('0x61')]={'mapKey':'mobile'};if(_0x3fb24a['account']&&_0x3fb24a[_0x5908('0x80')][_0x5908('0x3e')]===_0x5908('0x91')){_0x3fb24a[_0x5908('0x61')][_0x5908('0x92')]=_0x41f325[_0x5908('0x61')][_0x5908('0x93')]['replace'](_0x5908('0x94'),'');_0x3fb24a[_0x5908('0x61')][_0x5908('0x61')]=_0x41f325['body'][_0x5908('0x95')];_0x3fb24a[_0x5908('0x61')][_0x5908('0x96')]=_0x41f325[_0x5908('0x61')][_0x5908('0x97')];}if(_0x3fb24a[_0x5908('0x80')]&&_0x3fb24a[_0x5908('0x80')][_0x5908('0x3e')]==='sinch'){_0x3fb24a[_0x5908('0x61')][_0x5908('0x92')]=_0x41f325[_0x5908('0x61')][_0x5908('0x98')][0x0]['from'];_0x3fb24a['body'][_0x5908('0x61')]=_0x41f325[_0x5908('0x61')][_0x5908('0x98')][0x0][_0x5908('0x25')][_0x5908('0x61')];_0x3fb24a[_0x5908('0x61')][_0x5908('0x96')]=_0x41f325[_0x5908('0x61')]['notifications'][0x0][_0x5908('0x85')];}if(_0x3fb24a['body']['id']){delete _0x3fb24a[_0x5908('0x61')]['id'];}if(_[_0x5908('0x99')](_0x3fb24a[_0x5908('0x61')][_0x5908('0x92')])){throw new db[(_0x5908('0x9a'))][(_0x5908('0x8b'))](_0x5908('0x9b'));}if(_['isNil'](_0x3fb24a[_0x5908('0x61')][_0x5908('0x61')])||_0x3fb24a['body']['body']===''){throw new db['Sequelize'][(_0x5908('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5908('0x99')](_0x3fb24a[_0x5908('0x61')][_0x5908('0x9c')])){throw new db[(_0x5908('0x9a'))][(_0x5908('0x8b'))](_0x5908('0x9d')+_0x5086ef);}if(!_[_0x5908('0x9e')](_0x5086ef,_0x3fb24a['body'][_0x5908('0x9c')])){throw new db[(_0x5908('0x9a'))][(_0x5908('0x8b'))](_0x5908('0x9f')+_0x5086ef);}_0x2783f7[_0x3fb24a[_0x5908('0x61')]['mapKey']]=_0x3fb24a[_0x5908('0x61')]['from'];return db['CmList']['find']({'where':{'id':_0x3fb24a['account']['ListId']},'include':[{'model':db[_0x5908('0x8a')],'as':_0x5908('0xa0'),'where':_0x2783f7,'limit':0x1,'order':[[_0x5908('0x8f'),_0x5908('0xa1')]]}]});})[_0x5908('0x34')](handleEntityNotFound(_0x593bd7,null))[_0x5908('0x34')](function(_0x258401){if(_0x258401){_0x3fb24a[_0x5908('0xa2')]=_['omit'](_0x258401,['Contacts']);if(_0x258401[_0x5908('0xa0')][_0x5908('0x6d')]){return _0x258401[_0x5908('0xa0')][0x0];}var _0x11cb72=_[_0x5908('0x19')](_0x3fb24a[_0x5908('0x61')],{'firstName':_0x3fb24a[_0x5908('0x61')][_0x5908('0x92')],'ListId':_0x258401['id']});_0x11cb72[_0x3fb24a['body']['mapKey']]=_0x3fb24a['body'][_0x5908('0x92')];return db['CmContact'][_0x5908('0x58')](_0x11cb72,{'fields':_0x1695fc,'raw':!![]});}})[_0x5908('0x34')](handleEntityNotFound(_0x593bd7,null))[_0x5908('0x34')](function(_0xd3f3f0){if(_0xd3f3f0){_0x3fb24a[_0x5908('0xa3')]=_0xd3f3f0;var _0xfe919c={'ContactId':_0xd3f3f0['id'],'phone':_0x3fb24a[_0x5908('0x61')][_0x5908('0x92')],'WhatsappAccountId':_0x41f325[_0x5908('0x51')]['id']};var _0x25efd0={'ContactId':_0xd3f3f0['id'],'WhatsappAccountId':_0x41f325[_0x5908('0x51')]['id'],'closed':![]};return db[_0x5908('0xa4')]['find']({'where':_0x25efd0})[_0x5908('0x34')](function(_0xbaab5b){if(_0xbaab5b){return[_0xbaab5b,![]];}return db['WhatsappInteraction'][_0x5908('0x58')](_0xfe919c)[_0x5908('0x34')](function(_0xbb0707){return[_0xbb0707,!![]];});});}})[_0x5908('0x71')](function(_0x589798,_0x4e31ce){_0x3fb24a[_0x5908('0xa5')]=_0x589798['get']({'plain':!![]});_0x3fb24a[_0x5908('0xa5')]['created']=![];if(_0x4e31ce){if(_0x3fb24a[_0x5908('0x80')]['autoclose']){_0x3fb24a['applications'][_0x5908('0xa6')]({'id':0x0,'priority':_0x3fb24a[_0x5908('0x86')][_0x5908('0x6d')]+0x1,'app':_0x5908('0xa7'),'appdata':_0x5908('0xa8'),'interval':'*,*,*,*'});}_0x3fb24a[_0x5908('0xa5')][_0x5908('0xa9')]=!![];}return db['WhatsappMessage'][_0x5908('0x58')]({'phone':_0x3fb24a[_0x5908('0x61')]['from'],'messageId':_0x3fb24a[_0x5908('0x61')][_0x5908('0x96')],'body':_0x3fb24a[_0x5908('0x61')][_0x5908('0x61')],'WhatsappAccountId':_0x41f325['params']['id'],'WhatsappInteractionId':_0x589798['id'],'direction':'in','ContactId':_0x589798[_0x5908('0xaa')],'AttachmentId':_0x3fb24a[_0x5908('0x61')][_0x5908('0xab')]});})[_0x5908('0x34')](function(_0x4c1b73){_0x3fb24a['message']=_0x4c1b73;if(_0x3fb24a[_0x5908('0xa5')][_0x5908('0xac')]){return db[_0x5908('0xad')][_0x5908('0x57')]({'attributes':['id',_0x5908('0x39')],'where':{'id':_0x3fb24a[_0x5908('0xa5')][_0x5908('0xac')]}})[_0x5908('0x34')](function(_0x31d9d4){if(_0x31d9d4){_0x3fb24a[_0x5908('0x86')][_0x5908('0xae')]({'id':0x0,'priority':0x0,'app':_0x5908('0xaf'),'appdata':_0x31d9d4[_0x5908('0x39')]+','+(_0x3fb24a[_0x5908('0x80')][_0x5908('0xb0')]||0xa),'interval':_0x5908('0xb1')});}return respondWithRpcPromise(_0x5908('0xb2'),_0x5908('0xb3'),_0x3fb24a);});}return respondWithRpcPromise('Start',_0x5908('0xb3'),_0x3fb24a);})[_0x5908('0x34')](function(_0x24f90d){if(_0x24f90d){var _0x361efa=0xc8;var _0x4af367='receiveMessage';logger[_0x5908('0x1f')](_0x5908('0x20'),_0x4af367,_0x361efa,'entity\x20found');logger[_0x5908('0xb4')](_0x5908('0xb5'),_0x4af367,_0x361efa,_0x5908('0xb6'),JSON[_0x5908('0x22')](_0x24f90d));if(_0x3fb24a[_0x5908('0x80')][_0x5908('0x3e')]===_0x5908('0x91')){return _0x593bd7[_0x5908('0x29')](_0x361efa)[_0x5908('0x2f')](_0x5908('0xb7'),_0x5908('0xb8'))['send']('\x0a');}else{return _0x593bd7[_0x5908('0x29')](_0x361efa)[_0x5908('0x30')](_0x24f90d);}}});})[_0x5908('0x27')](handleError(_0x593bd7,null));};exports[_0x5908('0x3a')]=function(_0x4d0742,_0x3f3fa1,_0x1a871f){var _0x51060d,_0x30cf19,_0x1937c4;if(_[_0x5908('0x99')](_0x4d0742[_0x5908('0x61')][_0x5908('0x61')])||_0x4d0742[_0x5908('0x61')][_0x5908('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0x5908('0xb9'));}if(_['isNil'](_0x4d0742[_0x5908('0x61')]['to'])){throw new db[(_0x5908('0x9a'))]['ValidationError']('to\x20is\x20mandatory');}_0x51060d=_0x4d0742[_0x5908('0x61')]['to'];return db[_0x5908('0x3d')][_0x5908('0x57')]({'where':{'id':_0x4d0742[_0x5908('0x51')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x5908('0xa0'),'where':{'mobile':_0x51060d},'limit':0x1,'order':[[_0x5908('0x8f'),_0x5908('0xa1')]]}]}]})[_0x5908('0x34')](handleEntityNotFound(_0x3f3fa1,null))['then'](function(_0x3603be){if(_0x3603be&&_0x3603be[_0x5908('0xba')]){_0x30cf19=_0x3603be[_0x5908('0x36')]({'plain':!![]});if(_0x30cf19[_0x5908('0xba')]&&_0x30cf19['List'][_0x5908('0xa0')][_0x5908('0x6d')]){return _0x30cf19[_0x5908('0xba')][_0x5908('0xa0')][0x0];}return db[_0x5908('0x8a')][_0x5908('0x58')](_['defaults'](_0x4d0742[_0x5908('0x61')],{'firstName':_0x51060d,'mobile':_0x51060d,'phone':_0x51060d,'ListId':_0x30cf19[_0x5908('0xbb')]}));}})[_0x5908('0x34')](handleEntityNotFound(_0x3f3fa1,null))[_0x5908('0x34')](function(_0x17549f){if(_0x17549f){_0x1937c4=_0x17549f;return db['WhatsappInteraction'][_0x5908('0x57')]({'where':{'ContactId':_0x1937c4['id'],'closed':![],'WhatsappAccountId':_0x30cf19['id']}})['then'](function(_0x558baa){if(_0x558baa){return[_0x558baa,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x4d0742[_0x5908('0x59')]['id'],'ContactId':_0x1937c4['id'],'WhatsappAccountId':_0x30cf19['id'],'phone':_0x51060d,'firstMsgDirection':_0x5908('0xbc'),'Messages':[_[_0x5908('0x4c')](_0x4d0742[_0x5908('0x61')],{'read':![],'body':_0x4d0742[_0x5908('0x61')][_0x5908('0x61')],'phone':_0x51060d,'WhatsappAccountId':_0x30cf19['id'],'UserId':_0x4d0742[_0x5908('0x59')]['id'],'ContactId':_0x1937c4['id']})]},{'include':[{'model':db[_0x5908('0x84')],'as':_0x5908('0xbd')}]})[_0x5908('0x34')](function(_0x207705){return[_0x207705,!![]];});});}})[_0x5908('0x71')](function(_0x1ecddf,_0x2657b5){if(_0x2657b5){return _0x1ecddf;}return db[_0x5908('0x84')][_0x5908('0x58')](_['merge'](_0x4d0742[_0x5908('0x61')],{'read':![],'body':_0x4d0742[_0x5908('0x61')]['body'],'phone':_0x51060d,'WhatsappAccountId':_0x30cf19['id'],'WhatsappInteractionId':_0x1ecddf['id'],'UserId':_0x4d0742[_0x5908('0x59')]['id'],'ContactId':_0x1937c4['id']}))[_0x5908('0x34')](function(_0x41b23f){_0x1ecddf['dataValues'][_0x5908('0xbd')]=[];_0x1ecddf[_0x5908('0xbe')][_0x5908('0xbd')][_0x5908('0xa6')](_0x41b23f['dataValues']);return _0x1ecddf;});})[_0x5908('0x34')](respondWithResult(_0x3f3fa1,null))[_0x5908('0x27')](handleError(_0x3f3fa1,null));}; \ No newline at end of file +var _0x4e51=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','get','WhatsappAccounts','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','Pause','rawAttributes','keys','options','find','body','user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','pick','Disposition','rows','ids','WhatsappAccountId','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','findOne','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','Body','notifications','messageId','message_id','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','CmContact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','set','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','to\x20is\x20mandatory','DESC','List','out','dataValues','Messages','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x151bf6,_0x1f9854){var _0xc70081=function(_0x2070b5){while(--_0x2070b5){_0x151bf6['push'](_0x151bf6['shift']());}};_0xc70081(++_0x1f9854);}(_0x4e51,0xb2));var _0x14e5=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x4e51[_0x3acee8];return _0x5046cc;};'use strict';var emlformat=require(_0x14e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14e5('0x1'));var jsonpatch=require(_0x14e5('0x2'));var rp=require(_0x14e5('0x3'));var moment=require(_0x14e5('0x4'));var BPromise=require(_0x14e5('0x5'));var Mustache=require('mustache');var util=require(_0x14e5('0x6'));var path=require(_0x14e5('0x7'));var sox=require(_0x14e5('0x8'));var csv=require('to-csv');var ejs=require(_0x14e5('0x9'));var fs=require('fs');var fs_extra=require(_0x14e5('0xa'));var _=require(_0x14e5('0xb'));var squel=require('squel');var crypto=require(_0x14e5('0xc'));var jsforce=require(_0x14e5('0xd'));var deskjs=require(_0x14e5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x14e5('0xf'));var Papa=require(_0x14e5('0x10'));var Redis=require(_0x14e5('0x11'));var authService=require(_0x14e5('0x12'));var qs=require(_0x14e5('0x13'));var as=require(_0x14e5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14e5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x14e5('0x16'));var licenseUtil=require(_0x14e5('0x17'));var db=require(_0x14e5('0x18'))['db'];config['redis']=_[_0x14e5('0x19')](config[_0x14e5('0x1a')],{'host':_0x14e5('0x1b'),'port':0x18eb});var socket=require(_0x14e5('0x1c'))(new Redis(config['redis']));require(_0x14e5('0x1d'))[_0x14e5('0x1e')](socket);var jayson=require(_0x14e5('0x1f'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1ecf6f,_0x162518,_0x3b1277,_0x9e345b){return new BPromise(function(_0x4035d0,_0x228b2c){var _0x183461=_0x9e345b||client;return _0x183461['request'](_0x1ecf6f,_0x3b1277)['then'](function(_0xc4da0c){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x162518,_0x14e5('0x20'));logger[_0x14e5('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x162518,_0x14e5('0x20'),JSON[_0x14e5('0x22')](_0xc4da0c));if(_0xc4da0c[_0x14e5('0x23')]){if(_0xc4da0c[_0x14e5('0x23')][_0x14e5('0x24')]===0x1f4){logger[_0x14e5('0x23')](_0x14e5('0x25'),_0x162518,_0xc4da0c[_0x14e5('0x23')]['message']);return _0x228b2c(_0xc4da0c['error'][_0x14e5('0x26')]);}logger[_0x14e5('0x23')](_0x14e5('0x25'),_0x162518,_0xc4da0c['error'][_0x14e5('0x26')]);return _0x4035d0(_0xc4da0c['error'][_0x14e5('0x26')]);}else{logger[_0x14e5('0x27')](_0x14e5('0x25'),_0x162518,'request\x20sent');_0x4035d0(_0xc4da0c[_0x14e5('0x28')]['message']);}})[_0x14e5('0x29')](function(_0x65307c){logger[_0x14e5('0x23')](_0x14e5('0x25'),_0x162518,_0x65307c);_0x228b2c(_0x65307c);});});}function respondWithStatusCode(_0x5a6b49,_0xaa49ab){_0xaa49ab=_0xaa49ab||0xcc;return function(_0x42112a){if(_0x42112a){return _0x5a6b49[_0x14e5('0x2a')](_0xaa49ab);}return _0x5a6b49[_0x14e5('0x2b')](_0xaa49ab)[_0x14e5('0x2c')]();};}function respondWithResult(_0x598beb,_0x448c37){_0x448c37=_0x448c37||0xc8;return function(_0x27525d){if(_0x27525d){return _0x598beb['status'](_0x448c37)[_0x14e5('0x2d')](_0x27525d);}};}function respondWithFilteredResult(_0x32bb92,_0xd9d421){return function(_0x567662){if(_0x567662){var _0x5950a9=typeof _0xd9d421['offset']===_0x14e5('0x2e')&&typeof _0xd9d421[_0x14e5('0x2f')]===_0x14e5('0x2e');var _0x1015d8=_0x567662[_0x14e5('0x30')];var _0x53868d=_0x5950a9?0x0:_0xd9d421[_0x14e5('0x31')];var _0x1a929e=_0x5950a9?_0x567662['count']:_0xd9d421[_0x14e5('0x31')]+_0xd9d421[_0x14e5('0x2f')];var _0x59d213;if(_0x1a929e>=_0x1015d8){_0x1a929e=_0x1015d8;_0x59d213=0xc8;}else{_0x59d213=0xce;}_0x32bb92[_0x14e5('0x2b')](_0x59d213);return _0x32bb92['set'](_0x14e5('0x32'),_0x53868d+'-'+_0x1a929e+'/'+_0x1015d8)[_0x14e5('0x2d')](_0x567662);}return null;};}function patchUpdates(_0x457560){return function(_0x5a7ffd){try{jsonpatch[_0x14e5('0x33')](_0x5a7ffd,_0x457560,!![]);}catch(_0xd81dfd){return BPromise['reject'](_0xd81dfd);}return _0x5a7ffd[_0x14e5('0x34')]();};}function saveUpdates(_0x52a927,_0x525112){return function(_0x2b2f1b){if(_0x2b2f1b){return _0x2b2f1b['update'](_0x52a927)[_0x14e5('0x35')](function(_0xc34435){return _0xc34435;});}return null;};}function removeEntity(_0x56dd16,_0x232afe){return function(_0x22d18c){if(_0x22d18c){return _0x22d18c[_0x14e5('0x36')]()[_0x14e5('0x35')](function(){var _0x55baa5=_0x22d18c[_0x14e5('0x37')]({'plain':!![]});var _0x463134=_0x14e5('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x463134,'resourceId':_0x55baa5['id']}})[_0x14e5('0x35')](function(){return _0x22d18c;});})['then'](function(){_0x56dd16[_0x14e5('0x2b')](0xcc)[_0x14e5('0x2c')]();});}};}function handleEntityNotFound(_0x3e3f5d,_0x184c06){return function(_0x565698){if(!_0x565698){_0x3e3f5d[_0x14e5('0x2a')](0x194);}return _0x565698;};}function handleError(_0x3af66f,_0x144ea8){_0x144ea8=_0x144ea8||0x1f4;return function(_0x1a5815){logger['error'](_0x1a5815[_0x14e5('0x39')]);if(_0x1a5815[_0x14e5('0x3a')]){delete _0x1a5815[_0x14e5('0x3a')];}_0x3af66f[_0x14e5('0x2b')](_0x144ea8)[_0x14e5('0x3b')](_0x1a5815);};}exports[_0x14e5('0x3c')]=function(_0x4b9726,_0x4a1722){var _0x5bf239={'include':[{'model':db['Pause'],'as':_0x14e5('0x3d')}]},_0x5552a2={},_0x1b3f0a={'count':0x0,'rows':[]};var _0x471009=_[_0x14e5('0x3e')](db[_0x14e5('0x3f')]['rawAttributes'],function(_0x2be2bb){return{'name':_0x2be2bb[_0x14e5('0x40')],'type':_0x2be2bb[_0x14e5('0x41')]['key']};});_0x5552a2[_0x14e5('0x42')]=_[_0x14e5('0x3e')](_0x471009,'name');_0x5552a2['query']=_['keys'](_0x4b9726[_0x14e5('0x43')]);_0x5552a2[_0x14e5('0x44')]=_[_0x14e5('0x45')](_0x5552a2[_0x14e5('0x42')],_0x5552a2['query']);_0x5bf239[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x5552a2[_0x14e5('0x42')],qs[_0x14e5('0x47')](_0x4b9726[_0x14e5('0x43')][_0x14e5('0x47')]));_0x5bf239[_0x14e5('0x46')]=_0x5bf239[_0x14e5('0x46')][_0x14e5('0x48')]?_0x5bf239['attributes']:_0x5552a2[_0x14e5('0x42')];if(!_0x4b9726['query'][_0x14e5('0x49')](_0x14e5('0x4a'))){_0x5bf239['limit']=qs[_0x14e5('0x2f')](_0x4b9726[_0x14e5('0x43')][_0x14e5('0x2f')]);_0x5bf239['offset']=qs[_0x14e5('0x31')](_0x4b9726[_0x14e5('0x43')][_0x14e5('0x31')]);}_0x5bf239[_0x14e5('0x4b')]=qs['sort'](_0x4b9726[_0x14e5('0x43')][_0x14e5('0x4c')]);_0x5bf239[_0x14e5('0x4d')]=qs[_0x14e5('0x44')](_['pick'](_0x4b9726[_0x14e5('0x43')],_0x5552a2[_0x14e5('0x44')]),_0x471009);if(_0x4b9726['query'][_0x14e5('0x4e')]){_0x5bf239[_0x14e5('0x4d')]=_['merge'](_0x5bf239['where'],{'$or':_[_0x14e5('0x3e')](_0x471009,function(_0x5266f6){if(_0x5266f6[_0x14e5('0x41')]!==_0x14e5('0x4f')){var _0x53d569={};_0x53d569[_0x5266f6[_0x14e5('0x3a')]]={'$like':'%'+_0x4b9726['query'][_0x14e5('0x4e')]+'%'};return _0x53d569;}})});}_0x5bf239=_[_0x14e5('0x50')]({},_0x5bf239,_0x4b9726['options']);var _0x2b9941={'where':_0x5bf239[_0x14e5('0x4d')]};return db[_0x14e5('0x3f')][_0x14e5('0x30')](_0x2b9941)[_0x14e5('0x35')](function(_0x203b35){_0x1b3f0a[_0x14e5('0x30')]=_0x203b35;if(_0x4b9726[_0x14e5('0x43')][_0x14e5('0x51')]){_0x5bf239[_0x14e5('0x52')]=[{'all':!![]}];}return db[_0x14e5('0x3f')][_0x14e5('0x53')](_0x5bf239);})[_0x14e5('0x35')](function(_0x3b661f){_0x1b3f0a['rows']=_0x3b661f;return _0x1b3f0a;})[_0x14e5('0x35')](respondWithFilteredResult(_0x4a1722,_0x5bf239))[_0x14e5('0x29')](handleError(_0x4a1722,null));};exports[_0x14e5('0x54')]=function(_0x492e39,_0x4abe12){var _0x1c188e={'raw':![],'where':{'id':_0x492e39[_0x14e5('0x55')]['id']},'include':[{'model':db[_0x14e5('0x56')],'as':_0x14e5('0x3d')}]},_0x1a2aea={};_0x1a2aea[_0x14e5('0x42')]=_['keys'](db[_0x14e5('0x3f')][_0x14e5('0x57')]);_0x1a2aea[_0x14e5('0x43')]=_[_0x14e5('0x58')](_0x492e39[_0x14e5('0x43')]);_0x1a2aea['filters']=_[_0x14e5('0x45')](_0x1a2aea[_0x14e5('0x42')],_0x1a2aea['query']);_0x1c188e[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x1a2aea[_0x14e5('0x42')],qs[_0x14e5('0x47')](_0x492e39[_0x14e5('0x43')][_0x14e5('0x47')]));_0x1c188e[_0x14e5('0x46')]=_0x1c188e[_0x14e5('0x46')][_0x14e5('0x48')]?_0x1c188e[_0x14e5('0x46')]:_0x1a2aea['model'];if(_0x492e39[_0x14e5('0x43')][_0x14e5('0x51')]){_0x1c188e['include']=[{'all':!![]}];}_0x1c188e=_[_0x14e5('0x50')]({},_0x1c188e,_0x492e39[_0x14e5('0x59')]);return db[_0x14e5('0x3f')][_0x14e5('0x5a')](_0x1c188e)[_0x14e5('0x35')](handleEntityNotFound(_0x4abe12,null))[_0x14e5('0x35')](respondWithResult(_0x4abe12,null))[_0x14e5('0x29')](handleError(_0x4abe12,null));};exports['create']=function(_0x386253,_0xc0153a){return db['WhatsappAccount']['create'](_0x386253[_0x14e5('0x5b')],{})['then'](function(_0xb9a206){var _0x387753=_0x386253[_0x14e5('0x5c')][_0x14e5('0x37')]({'plain':!![]});if(!_0x387753)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x387753['role']==='user'){var _0x502a42=_0xb9a206[_0x14e5('0x37')]({'plain':!![]});var _0x3548c4=_0x14e5('0x38');return db[_0x14e5('0x5d')][_0x14e5('0x5a')]({'where':{'name':_0x3548c4,'userProfileId':_0x387753[_0x14e5('0x5e')]},'raw':!![]})['then'](function(_0x371c7b){if(_0x371c7b&&_0x371c7b['autoAssociation']===0x0){return db[_0x14e5('0x5f')][_0x14e5('0x60')]({'name':_0x502a42[_0x14e5('0x3a')],'resourceId':_0x502a42['id'],'type':_0x371c7b[_0x14e5('0x3a')],'sectionId':_0x371c7b['id']},{})[_0x14e5('0x35')](function(){return _0xb9a206;});}else{return _0xb9a206;}})['catch'](function(_0x396c47){logger['error'](_0x14e5('0x61'),_0x396c47);throw _0x396c47;});}return _0xb9a206;})['then'](respondWithResult(_0xc0153a,0xc9))[_0x14e5('0x29')](handleError(_0xc0153a,null));};exports[_0x14e5('0x62')]=function(_0x2cc0bb,_0x41e07f){if(_0x2cc0bb[_0x14e5('0x5b')]['id']){delete _0x2cc0bb[_0x14e5('0x5b')]['id'];}return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x2cc0bb[_0x14e5('0x55')]['id']},'include':[{'model':db[_0x14e5('0x56')],'as':'mandatoryDispositionPause'}]})[_0x14e5('0x35')](handleEntityNotFound(_0x41e07f,null))[_0x14e5('0x35')](saveUpdates(_0x2cc0bb[_0x14e5('0x5b')],null))[_0x14e5('0x35')](respondWithResult(_0x41e07f,null))[_0x14e5('0x29')](handleError(_0x41e07f,null));};exports[_0x14e5('0x36')]=function(_0x417f7f,_0x29a839){return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x417f7f['params']['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x29a839,null))['then'](removeEntity(_0x29a839,null))[_0x14e5('0x29')](handleError(_0x29a839,null));};exports[_0x14e5('0x63')]=function(_0x22d605,_0x343cdb){return db[_0x14e5('0x3f')][_0x14e5('0x63')]()[_0x14e5('0x35')](respondWithResult(_0x343cdb,null))[_0x14e5('0x29')](handleError(_0x343cdb,null));};exports[_0x14e5('0x64')]=function(_0x56912f,_0x1f5ff2,_0x4e6ae2){if(_0x56912f[_0x14e5('0x5b')]['id']){delete _0x56912f[_0x14e5('0x5b')]['id'];}return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x56912f[_0x14e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f5ff2,null))[_0x14e5('0x35')](function(_0x30d872){if(_0x30d872){_0x56912f[_0x14e5('0x5b')]['WhatsappAccountId']=_0x30d872['id'];return db['Disposition'][_0x14e5('0x60')](_0x56912f[_0x14e5('0x5b')]);}})[_0x14e5('0x35')](respondWithResult(_0x1f5ff2,null))[_0x14e5('0x29')](handleError(_0x1f5ff2,null));};exports['getDispositions']=function(_0xa96fc3,_0x469cd5,_0x2c6d59){var _0x58c8c4={'raw':![],'where':{}};var _0x5e4b35={};var _0x5adbe5={'count':0x0,'rows':[]};return db[_0x14e5('0x3f')]['findOne']({'where':{'id':_0xa96fc3[_0x14e5('0x55')]['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x469cd5,null))[_0x14e5('0x35')](function(_0x261f1e){if(_0x261f1e){_0x5e4b35[_0x14e5('0x42')]=_['keys'](db['Disposition'][_0x14e5('0x57')]);_0x5e4b35[_0x14e5('0x43')]=_[_0x14e5('0x58')](_0xa96fc3[_0x14e5('0x43')]);_0x5e4b35['filters']=_[_0x14e5('0x45')](_0x5e4b35[_0x14e5('0x42')],_0x5e4b35['query']);_0x58c8c4[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x5e4b35[_0x14e5('0x42')],qs['fields'](_0xa96fc3[_0x14e5('0x43')][_0x14e5('0x47')]));_0x58c8c4[_0x14e5('0x46')]=_0x58c8c4[_0x14e5('0x46')][_0x14e5('0x48')]?_0x58c8c4['attributes']:_0x5e4b35[_0x14e5('0x42')];if(!_0xa96fc3[_0x14e5('0x43')][_0x14e5('0x49')](_0x14e5('0x4a'))){_0x58c8c4[_0x14e5('0x2f')]=qs[_0x14e5('0x2f')](_0xa96fc3['query'][_0x14e5('0x2f')]);_0x58c8c4[_0x14e5('0x31')]=qs[_0x14e5('0x31')](_0xa96fc3[_0x14e5('0x43')]['offset']);}_0x58c8c4[_0x14e5('0x4b')]=qs[_0x14e5('0x4c')](_0xa96fc3['query'][_0x14e5('0x4c')]);_0x58c8c4['where']=qs[_0x14e5('0x44')](_[_0x14e5('0x65')](_0xa96fc3[_0x14e5('0x43')],_0x5e4b35['filters']));_0x58c8c4['where']['WhatsappAccountId']=_0x261f1e['id'];if(_0xa96fc3['query']['filter']){_0x58c8c4[_0x14e5('0x4d')]=_['merge'](_0x58c8c4[_0x14e5('0x4d')],{'$or':_['map'](_0x58c8c4[_0x14e5('0x46')],function(_0x31c646){var _0x332a53={};_0x332a53[_0x31c646]={'$like':'%'+_0xa96fc3[_0x14e5('0x43')]['filter']+'%'};return _0x332a53;})});}_0x58c8c4=_[_0x14e5('0x50')]({},_0x58c8c4,_0xa96fc3[_0x14e5('0x59')]);return db[_0x14e5('0x66')][_0x14e5('0x30')]({'where':_0x58c8c4[_0x14e5('0x4d')]})[_0x14e5('0x35')](function(_0x65b2e6){_0x5adbe5[_0x14e5('0x30')]=_0x65b2e6;if(_0xa96fc3[_0x14e5('0x43')][_0x14e5('0x51')]){_0x58c8c4[_0x14e5('0x52')]=[{'all':!![]}];}return db[_0x14e5('0x66')][_0x14e5('0x53')](_0x58c8c4);})['then'](function(_0x1ed830){_0x5adbe5[_0x14e5('0x67')]=_0x1ed830;return _0x5adbe5;});}})['then'](respondWithFilteredResult(_0x469cd5,_0x58c8c4))[_0x14e5('0x29')](handleError(_0x469cd5,null));};exports['removeDispositions']=function(_0x348cfe,_0x1048ad,_0x23274e){return db['WhatsappAccount'][_0x14e5('0x5a')]({'where':{'id':_0x348cfe[_0x14e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x1048ad,null))[_0x14e5('0x35')](function(_0x76a420){if(_0x76a420){return _0x76a420['removeDispositions'](_0x348cfe[_0x14e5('0x43')][_0x14e5('0x68')]);}})[_0x14e5('0x35')](respondWithStatusCode(_0x1048ad,null))[_0x14e5('0x29')](handleError(_0x1048ad,null));};exports['addAnswer']=function(_0x4635af,_0x1de00a,_0x4adc15){if(_0x4635af[_0x14e5('0x5b')]['id']){delete _0x4635af[_0x14e5('0x5b')]['id'];}return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x4635af[_0x14e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x1de00a,null))[_0x14e5('0x35')](function(_0xe11ef4){if(_0xe11ef4){_0x4635af[_0x14e5('0x5b')][_0x14e5('0x69')]=_0xe11ef4['id'];return db['CannedAnswer'][_0x14e5('0x60')](_0x4635af[_0x14e5('0x5b')]);}})['then'](respondWithResult(_0x1de00a,null))['catch'](handleError(_0x1de00a,null));};exports['getAnswers']=function(_0x51faf0,_0x2f965d,_0xe64c53){var _0x29340f={'raw':![],'where':{}};var _0x3f03a8={};var _0x89ea71={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x51faf0['params']['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x2f965d,null))['then'](function(_0x503890){if(_0x503890){_0x3f03a8[_0x14e5('0x42')]=_[_0x14e5('0x58')](db[_0x14e5('0x6a')][_0x14e5('0x57')]);_0x3f03a8[_0x14e5('0x43')]=_['keys'](_0x51faf0[_0x14e5('0x43')]);_0x3f03a8[_0x14e5('0x44')]=_[_0x14e5('0x45')](_0x3f03a8[_0x14e5('0x42')],_0x3f03a8[_0x14e5('0x43')]);_0x29340f[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x3f03a8[_0x14e5('0x42')],qs[_0x14e5('0x47')](_0x51faf0[_0x14e5('0x43')]['fields']));_0x29340f['attributes']=_0x29340f[_0x14e5('0x46')][_0x14e5('0x48')]?_0x29340f[_0x14e5('0x46')]:_0x3f03a8[_0x14e5('0x42')];if(!_0x51faf0[_0x14e5('0x43')]['hasOwnProperty']('nolimit')){_0x29340f['limit']=qs[_0x14e5('0x2f')](_0x51faf0['query'][_0x14e5('0x2f')]);_0x29340f['offset']=qs[_0x14e5('0x31')](_0x51faf0[_0x14e5('0x43')]['offset']);}_0x29340f['order']=qs[_0x14e5('0x4c')](_0x51faf0['query'][_0x14e5('0x4c')]);_0x29340f[_0x14e5('0x4d')]=qs[_0x14e5('0x44')](_[_0x14e5('0x65')](_0x51faf0['query'],_0x3f03a8[_0x14e5('0x44')]));_0x29340f[_0x14e5('0x4d')][_0x14e5('0x69')]=_0x503890['id'];if(_0x51faf0[_0x14e5('0x43')][_0x14e5('0x4e')]){_0x29340f[_0x14e5('0x4d')]=_[_0x14e5('0x50')](_0x29340f[_0x14e5('0x4d')],{'$or':_[_0x14e5('0x3e')](_0x29340f[_0x14e5('0x46')],function(_0x434033){var _0x1cb8f9={};_0x1cb8f9[_0x434033]={'$like':'%'+_0x51faf0[_0x14e5('0x43')][_0x14e5('0x4e')]+'%'};return _0x1cb8f9;})});}_0x29340f=_[_0x14e5('0x50')]({},_0x29340f,_0x51faf0[_0x14e5('0x59')]);return db[_0x14e5('0x6a')][_0x14e5('0x30')]({'where':_0x29340f['where']})[_0x14e5('0x35')](function(_0x3b50da){_0x89ea71[_0x14e5('0x30')]=_0x3b50da;if(_0x51faf0[_0x14e5('0x43')]['includeAll']){_0x29340f['include']=[{'all':!![]}];}return db[_0x14e5('0x6a')]['findAll'](_0x29340f);})[_0x14e5('0x35')](function(_0x4492ae){_0x89ea71[_0x14e5('0x67')]=_0x4492ae;return _0x89ea71;});}})[_0x14e5('0x35')](respondWithFilteredResult(_0x2f965d,_0x29340f))[_0x14e5('0x29')](handleError(_0x2f965d,null));};exports[_0x14e5('0x6b')]=function(_0x29242c,_0x403a54,_0x49eee6){return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x29242c['params']['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x403a54,null))['then'](function(_0x5dc775){if(_0x5dc775){return _0x5dc775[_0x14e5('0x6b')](_0x29242c[_0x14e5('0x43')][_0x14e5('0x68')]);}})[_0x14e5('0x35')](respondWithStatusCode(_0x403a54,null))[_0x14e5('0x29')](handleError(_0x403a54,null));};exports[_0x14e5('0x6c')]=function(_0x5ced22,_0x2121c5,_0x7dbf){return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x5ced22[_0x14e5('0x55')]['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x2121c5,null))[_0x14e5('0x35')](function(_0x104326){if(_0x104326){return _0x104326[_0x14e5('0x6c')](_0x5ced22[_0x14e5('0x5b')]['ids'],_[_0x14e5('0x6d')](_0x5ced22[_0x14e5('0x5b')],[_0x14e5('0x68'),'id'])||{})[_0x14e5('0x6e')](function(_0x182173){for(var _0x61656d=0x0;_0x61656d<_0x5ced22['body'][_0x14e5('0x68')][_0x14e5('0x48')];_0x61656d+=0x1){socket['emit'](_0x14e5('0x6f'),{'UserId':Number(_0x5ced22[_0x14e5('0x5b')][_0x14e5('0x68')][_0x61656d]),'WhatsappAccountId':Number(_0x5ced22[_0x14e5('0x55')]['id'])});}return _0x182173;});}})[_0x14e5('0x35')](respondWithResult(_0x2121c5,null))[_0x14e5('0x29')](handleError(_0x2121c5,null));};exports[_0x14e5('0x70')]=function(_0xe76e92,_0x1bffa1,_0x2556a5){return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0xe76e92[_0x14e5('0x55')]['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x1bffa1,null))['then'](function(_0x2347bc){if(_0x2347bc){return _0x2347bc['removeAgents'](_0xe76e92[_0x14e5('0x43')][_0x14e5('0x68')])[_0x14e5('0x35')](function(){if(_[_0x14e5('0x71')](_0xe76e92[_0x14e5('0x43')][_0x14e5('0x68')])){for(var _0x3f0c80=0x0;_0x3f0c80<_0xe76e92[_0x14e5('0x43')][_0x14e5('0x68')]['length'];_0x3f0c80+=0x1){socket[_0x14e5('0x72')](_0x14e5('0x73'),{'UserId':Number(_0xe76e92[_0x14e5('0x43')][_0x14e5('0x68')][_0x3f0c80]),'WhatsappAccountId':Number(_0xe76e92['params']['id'])});}}else{socket[_0x14e5('0x72')](_0x14e5('0x73'),{'UserId':Number(_0xe76e92[_0x14e5('0x43')][_0x14e5('0x68')]),'WhatsappAccountId':Number(_0xe76e92['params']['id'])});}});}})[_0x14e5('0x35')](respondWithStatusCode(_0x1bffa1,null))['catch'](handleError(_0x1bffa1,null));};exports[_0x14e5('0x74')]=function(_0x562492,_0x44c2d0,_0x1d7e44){var _0x1e61bc={};var _0x18f418={};var _0x39fa42;var _0x4fff28;return db[_0x14e5('0x3f')][_0x14e5('0x75')]({'where':{'id':_0x562492[_0x14e5('0x55')]['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x44c2d0,null))[_0x14e5('0x35')](function(_0xda5574){if(_0xda5574){_0x39fa42=_0xda5574;_0x18f418[_0x14e5('0x42')]=_[_0x14e5('0x58')](db[_0x14e5('0x76')][_0x14e5('0x57')]);_0x18f418[_0x14e5('0x43')]=_[_0x14e5('0x58')](_0x562492['query']);_0x18f418['filters']=_['intersection'](_0x18f418[_0x14e5('0x42')],_0x18f418[_0x14e5('0x43')]);_0x1e61bc[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x18f418[_0x14e5('0x42')],qs[_0x14e5('0x47')](_0x562492[_0x14e5('0x43')][_0x14e5('0x47')]));_0x1e61bc[_0x14e5('0x46')]=_0x1e61bc[_0x14e5('0x46')]['length']?_0x1e61bc['attributes']:_0x18f418['model'];_0x1e61bc[_0x14e5('0x4b')]=qs[_0x14e5('0x4c')](_0x562492[_0x14e5('0x43')][_0x14e5('0x4c')]);_0x1e61bc['where']=qs['filters'](_[_0x14e5('0x65')](_0x562492[_0x14e5('0x43')],_0x18f418[_0x14e5('0x44')]));if(_0x562492[_0x14e5('0x43')]['filter']){_0x1e61bc[_0x14e5('0x4d')]=_[_0x14e5('0x50')](_0x1e61bc[_0x14e5('0x4d')],{'$or':_[_0x14e5('0x3e')](_0x1e61bc[_0x14e5('0x46')],function(_0x567cc4){var _0x1cd297={};_0x1cd297[_0x567cc4]={'$like':'%'+_0x562492['query'][_0x14e5('0x4e')]+'%'};return _0x1cd297;})});}_0x1e61bc=_['merge']({},_0x1e61bc,_0x562492[_0x14e5('0x59')]);return _0x39fa42[_0x14e5('0x74')](_0x1e61bc);}})[_0x14e5('0x35')](function(_0x26ca8c){if(_0x26ca8c){_0x4fff28=_0x26ca8c[_0x14e5('0x48')];if(!_0x562492[_0x14e5('0x43')][_0x14e5('0x49')]('nolimit')){_0x1e61bc['limit']=qs[_0x14e5('0x2f')](_0x562492[_0x14e5('0x43')][_0x14e5('0x2f')]);_0x1e61bc[_0x14e5('0x31')]=qs['offset'](_0x562492[_0x14e5('0x43')]['offset']);}return _0x39fa42[_0x14e5('0x74')](_0x1e61bc);}})[_0x14e5('0x35')](function(_0x4ba841){if(_0x4ba841){return _0x4ba841?{'count':_0x4fff28,'rows':_0x4ba841}:null;}})['then'](respondWithResult(_0x44c2d0,null))[_0x14e5('0x29')](handleError(_0x44c2d0,null));};exports['addApplications']=function(_0x657616,_0x64412){var _0x58baef=_0x657616[_0x14e5('0x55')]['id'];var _0x32eb43=_0x657616[_0x14e5('0x5b')];var _0x16d07d=0xc8;var _0x251975=null;return db[_0x14e5('0x77')][_0x14e5('0x78')]({'isolationLevel':db[_0x14e5('0x77')][_0x14e5('0x79')][_0x14e5('0x7a')][_0x14e5('0x7b')]},function(_0x3d60e5){return db['WhatsappAccount'][_0x14e5('0x75')]({'where':{'id':_0x58baef},'transaction':_0x3d60e5})[_0x14e5('0x35')](function(_0x229c6e){if(_0x229c6e){return db['WhatsappApplication'][_0x14e5('0x36')]({'where':{'WhatsappAccountId':_0x58baef},'transaction':_0x3d60e5})['then'](function(){var _0x498381=_[_0x14e5('0x3e')](_0x32eb43,function(_0x3ab692){_0x3ab692[_0x14e5('0x69')]=_0x58baef;return _0x3ab692;});return db[_0x14e5('0x7c')][_0x14e5('0x7d')](_0x498381,{'transaction':_0x3d60e5});});}else{_0x16d07d=0x194;_0x251975=[];}});})[_0x14e5('0x35')](function(){if(_0x16d07d!==0x194){return db[_0x14e5('0x7c')][_0x14e5('0x7e')]({'where':{'WhatsappAccountId':_0x58baef},'order':_0x14e5('0x7f')})['then'](function(_0x412bcf){_0x251975=_0x412bcf;});}})['catch'](function(_0x560de7){_0x16d07d=0x1f4;logger['error'](_0x560de7[_0x14e5('0x39')]);if(_0x560de7['name']){delete _0x560de7[_0x14e5('0x3a')];}_0x251975=_0x560de7;})[_0x14e5('0x80')](function(){if(_0x251975===null){_0x64412[_0x14e5('0x2a')](_0x16d07d);}else{if(_0x16d07d===0x1f4){_0x64412[_0x14e5('0x2b')](_0x16d07d)[_0x14e5('0x3b')](_0x251975);}else{_0x64412['status'](_0x16d07d)['json'](_0x251975);}}});};exports[_0x14e5('0x81')]=function(_0x234559,_0x273a37,_0x6226f2){var _0x240987={};var _0x244bf5={};var _0x2d9e9f;var _0x47901d;return db[_0x14e5('0x3f')][_0x14e5('0x75')]({'where':{'id':_0x234559[_0x14e5('0x55')]['id']}})[_0x14e5('0x35')](handleEntityNotFound(_0x273a37,null))[_0x14e5('0x35')](function(_0x3e193d){if(_0x3e193d){_0x2d9e9f=_0x3e193d;_0x244bf5[_0x14e5('0x42')]=_[_0x14e5('0x58')](db[_0x14e5('0x7c')]['rawAttributes']);_0x244bf5[_0x14e5('0x43')]=_['keys'](_0x234559[_0x14e5('0x43')]);_0x244bf5[_0x14e5('0x44')]=_['intersection'](_0x244bf5['model'],_0x244bf5[_0x14e5('0x43')]);_0x240987[_0x14e5('0x46')]=_[_0x14e5('0x45')](_0x244bf5['model'],qs['fields'](_0x234559[_0x14e5('0x43')]['fields']));_0x240987['attributes']=_0x240987[_0x14e5('0x46')][_0x14e5('0x48')]?_0x240987['attributes']:_0x244bf5[_0x14e5('0x42')];_0x240987[_0x14e5('0x4b')]=qs[_0x14e5('0x4c')](_0x234559[_0x14e5('0x43')][_0x14e5('0x4c')]);_0x240987[_0x14e5('0x4d')]=qs[_0x14e5('0x44')](_['pick'](_0x234559[_0x14e5('0x43')],_0x244bf5['filters']));if(_0x234559[_0x14e5('0x43')]['filter']){_0x240987[_0x14e5('0x4d')]=_[_0x14e5('0x50')](_0x240987['where'],{'$or':_[_0x14e5('0x3e')](_0x240987[_0x14e5('0x46')],function(_0x46d351){var _0x5762e4={};_0x5762e4[_0x46d351]={'$like':'%'+_0x234559[_0x14e5('0x43')][_0x14e5('0x4e')]+'%'};return _0x5762e4;})});}_0x240987=_[_0x14e5('0x50')]({},_0x240987,_0x234559[_0x14e5('0x59')]);return _0x2d9e9f[_0x14e5('0x81')](_0x240987);}})[_0x14e5('0x35')](function(_0x8af5cb){if(_0x8af5cb){_0x47901d=_0x8af5cb[_0x14e5('0x48')];if(!_0x234559[_0x14e5('0x43')]['hasOwnProperty'](_0x14e5('0x4a'))){_0x240987['limit']=qs['limit'](_0x234559[_0x14e5('0x43')][_0x14e5('0x2f')]);_0x240987[_0x14e5('0x31')]=qs[_0x14e5('0x31')](_0x234559[_0x14e5('0x43')][_0x14e5('0x31')]);}return _0x2d9e9f[_0x14e5('0x81')](_0x240987);}})[_0x14e5('0x35')](function(_0x2704d2){if(_0x2704d2){return _0x2704d2?{'count':_0x47901d,'rows':_0x2704d2}:null;}})[_0x14e5('0x35')](respondWithResult(_0x273a37,null))['catch'](handleError(_0x273a37,null));};exports[_0x14e5('0x82')]=function(_0x19b4f2,_0x32cdfb,_0x4eb9f7){var _0x13db0e={'channel':'whatsapp'};var _0x574629=[];var _0x2c0dcb=[];var _0x2dae71={};return db[_0x14e5('0x3f')]['find']({'where':{'id':_0x19b4f2[_0x14e5('0x55')]['id']},'include':[{'model':db[_0x14e5('0x7c')],'as':_0x14e5('0x83')}]})['then'](handleEntityNotFound(_0x32cdfb,null))[_0x14e5('0x35')](function(_0x13099a){_0x13db0e[_0x14e5('0x84')]=_0x13099a;if(_0x13db0e[_0x14e5('0x84')]&&_0x13db0e[_0x14e5('0x84')][_0x14e5('0x41')]===_0x14e5('0x85')&&_0x19b4f2[_0x14e5('0x5b')]['statuses']){if(_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x86')][_0x14e5('0x48')]===0x0)return;if(_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x86')][0x0][_0x14e5('0x87')]!==_0x14e5('0x88'))return;return db[_0x14e5('0x89')][_0x14e5('0x62')]({'read':!![],'readAt':_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x86')][0x0][_0x14e5('0x8a')]},{'where':{'messageId':_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x14e5('0x35')](function(_0x27c45a){return _0x32cdfb[_0x14e5('0x2b')](0xc8)[_0x14e5('0x2d')](_0x27c45a);});}_0x13db0e[_0x14e5('0x8b')]=_[_0x14e5('0x8c')](_0x13099a[_0x14e5('0x83')],[_0x14e5('0x7f')],[_0x14e5('0x8d')]);if(_0x13db0e[_0x14e5('0x84')]['Applications']){delete _0x13db0e[_0x14e5('0x84')][_0x14e5('0x83')];}return db['CmContact'][_0x14e5('0x63')]()['then'](function(_0x11bcc7){if(!_0x11bcc7){throw new db[(_0x14e5('0x8e'))]['ValidationError'](_0x14e5('0x8f'));}_0x574629=_[_0x14e5('0x90')](_[_0x14e5('0x58')](_0x11bcc7),[_0x14e5('0x91'),_0x14e5('0x92')]);_0x2c0dcb=_[_0x14e5('0x90')](_[_0x14e5('0x58')](_0x11bcc7),[_0x14e5('0x91'),_0x14e5('0x92'),_0x14e5('0x93'),'ListId']);_0x13db0e['body']={'mapKey':_0x14e5('0x94')};if(_0x13db0e[_0x14e5('0x84')]&&_0x13db0e[_0x14e5('0x84')][_0x14e5('0x41')]===_0x14e5('0x95')){_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')]=_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x97')]['replace'](_0x14e5('0x98'),'');_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x5b')]=_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x99')];_0x13db0e['body']['messageId']=_0x19b4f2['body']['MessageSid'];}if(_0x13db0e[_0x14e5('0x84')]&&_0x13db0e[_0x14e5('0x84')][_0x14e5('0x41')]==='sinch'){_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')]=_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x9a')][0x0][_0x14e5('0x96')];_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x5b')]=_0x19b4f2['body'][_0x14e5('0x9a')][0x0][_0x14e5('0x26')][_0x14e5('0x5b')];_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x9b')]=_0x19b4f2[_0x14e5('0x5b')][_0x14e5('0x9a')][0x0][_0x14e5('0x9c')];}if(_0x13db0e[_0x14e5('0x5b')]['id']){delete _0x13db0e['body']['id'];}if(_['isNil'](_0x13db0e['body'][_0x14e5('0x96')])){throw new db[(_0x14e5('0x8e'))]['ValidationError'](_0x14e5('0x9d'));}if(_['isNil'](_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x5b')])||_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x5b')]===''){throw new db[(_0x14e5('0x8e'))][(_0x14e5('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x13db0e[_0x14e5('0x5b')]['mapKey'])){throw new db[(_0x14e5('0x8e'))][(_0x14e5('0x9e'))](_0x14e5('0x9f')+_0x2c0dcb);}if(!_[_0x14e5('0xa0')](_0x2c0dcb,_0x13db0e['body'][_0x14e5('0xa1')])){throw new db[(_0x14e5('0x8e'))][(_0x14e5('0x9e'))](_0x14e5('0xa2')+_0x2c0dcb);}_0x2dae71[_0x13db0e[_0x14e5('0x5b')][_0x14e5('0xa1')]]=_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')];return db[_0x14e5('0xa3')][_0x14e5('0x5a')]({'where':{'id':_0x13db0e[_0x14e5('0x84')][_0x14e5('0xa4')]},'include':[{'model':db['CmContact'],'as':_0x14e5('0xa5'),'where':_0x2dae71,'limit':0x1,'order':[[_0x14e5('0x92'),'DESC']]}]});})[_0x14e5('0x35')](handleEntityNotFound(_0x32cdfb,null))[_0x14e5('0x35')](function(_0x162886){if(_0x162886){_0x13db0e[_0x14e5('0xa6')]=_[_0x14e5('0x6d')](_0x162886,[_0x14e5('0xa5')]);if(_0x162886['Contacts'][_0x14e5('0x48')]){return _0x162886[_0x14e5('0xa5')][0x0];}var _0x34b82a=_['defaults'](_0x13db0e['body'],{'firstName':_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')],'ListId':_0x162886['id']});_0x34b82a[_0x13db0e[_0x14e5('0x5b')]['mapKey']]=_0x13db0e['body'][_0x14e5('0x96')];return db[_0x14e5('0xa7')][_0x14e5('0x60')](_0x34b82a,{'fields':_0x574629,'raw':!![]});}})[_0x14e5('0x35')](handleEntityNotFound(_0x32cdfb,null))['then'](function(_0x4526b7){if(_0x4526b7){_0x13db0e['contact']=_0x4526b7;var _0x1b6715={'ContactId':_0x4526b7['id'],'phone':_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')],'WhatsappAccountId':_0x19b4f2['params']['id']};var _0x59d269={'ContactId':_0x4526b7['id'],'WhatsappAccountId':_0x19b4f2[_0x14e5('0x55')]['id'],'closed':![]};return db[_0x14e5('0xa8')]['find']({'where':_0x59d269})[_0x14e5('0x35')](function(_0x289225){if(_0x289225){return[_0x289225,![]];}return db[_0x14e5('0xa8')][_0x14e5('0x60')](_0x1b6715)[_0x14e5('0x35')](function(_0x39bff3){return[_0x39bff3,!![]];});});}})[_0x14e5('0x6e')](function(_0x1cf3c5,_0x2b17a1){_0x13db0e[_0x14e5('0xa9')]=_0x1cf3c5[_0x14e5('0x37')]({'plain':!![]});_0x13db0e[_0x14e5('0xa9')]['created']=![];if(_0x2b17a1){if(_0x13db0e[_0x14e5('0x84')][_0x14e5('0xaa')]){_0x13db0e[_0x14e5('0x8b')]['push']({'id':0x0,'priority':_0x13db0e[_0x14e5('0x8b')][_0x14e5('0x48')]+0x1,'app':'close','appdata':_0x14e5('0xab'),'interval':_0x14e5('0xac')});}_0x13db0e[_0x14e5('0xa9')][_0x14e5('0xad')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x96')],'messageId':_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x9b')],'body':_0x13db0e[_0x14e5('0x5b')][_0x14e5('0x5b')],'WhatsappAccountId':_0x19b4f2[_0x14e5('0x55')]['id'],'WhatsappInteractionId':_0x1cf3c5['id'],'direction':'in','ContactId':_0x1cf3c5['ContactId'],'AttachmentId':_0x13db0e[_0x14e5('0x5b')]['AttachmentId']});})[_0x14e5('0x35')](function(_0x4120bc){_0x13db0e[_0x14e5('0x26')]=_0x4120bc;if(_0x13db0e['interaction'][_0x14e5('0xae')]){return db['User'][_0x14e5('0x5a')]({'attributes':['id','name'],'where':{'id':_0x13db0e['interaction'][_0x14e5('0xae')]}})['then'](function(_0x39e761){if(_0x39e761){_0x13db0e[_0x14e5('0x8b')][_0x14e5('0xaf')]({'id':0x0,'priority':0x0,'app':_0x14e5('0xb0'),'appdata':_0x39e761['name']+','+(_0x13db0e[_0x14e5('0x84')][_0x14e5('0xb1')]||0xa),'interval':_0x14e5('0xac')});}return respondWithRpcPromise(_0x14e5('0xb2'),_0x14e5('0xb3'),_0x13db0e);});}return respondWithRpcPromise(_0x14e5('0xb2'),_0x14e5('0xb3'),_0x13db0e);})[_0x14e5('0x35')](function(_0x160f37){if(_0x160f37){var _0xa7cd3a=0xc8;var _0x1b3aac=_0x14e5('0xb4');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1b3aac,_0xa7cd3a,_0x14e5('0xb5'));logger[_0x14e5('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1b3aac,_0xa7cd3a,_0x14e5('0xb5'),JSON[_0x14e5('0x22')](_0x160f37));if(_0x13db0e[_0x14e5('0x84')][_0x14e5('0x41')]===_0x14e5('0x95')){return _0x32cdfb['status'](_0xa7cd3a)[_0x14e5('0xb6')](_0x14e5('0xb7'),_0x14e5('0xb8'))[_0x14e5('0x3b')]('\x0a');}else{return _0x32cdfb[_0x14e5('0x2b')](_0xa7cd3a)['json'](_0x160f37);}}});})[_0x14e5('0x29')](handleError(_0x32cdfb,null));};exports[_0x14e5('0x3b')]=function(_0x50bc95,_0x5dd67d,_0x3b6c0c){var _0x553894,_0x445c44,_0x19d34e;if(_['isNil'](_0x50bc95[_0x14e5('0x5b')][_0x14e5('0x5b')])||_0x50bc95['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x14e5('0xb9'));}if(_[_0x14e5('0xba')](_0x50bc95['body']['to'])){throw new db['Sequelize'][(_0x14e5('0x9e'))](_0x14e5('0xbb'));}_0x553894=_0x50bc95[_0x14e5('0x5b')]['to'];return db[_0x14e5('0x3f')][_0x14e5('0x5a')]({'where':{'id':_0x50bc95['params']['id']},'include':[{'model':db[_0x14e5('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x553894},'limit':0x1,'order':[['updatedAt',_0x14e5('0xbc')]]}]}]})[_0x14e5('0x35')](handleEntityNotFound(_0x5dd67d,null))[_0x14e5('0x35')](function(_0x1bb799){if(_0x1bb799&&_0x1bb799[_0x14e5('0xbd')]){_0x445c44=_0x1bb799[_0x14e5('0x37')]({'plain':!![]});if(_0x445c44[_0x14e5('0xbd')]&&_0x445c44['List'][_0x14e5('0xa5')]['length']){return _0x445c44[_0x14e5('0xbd')]['Contacts'][0x0];}return db[_0x14e5('0xa7')][_0x14e5('0x60')](_[_0x14e5('0x19')](_0x50bc95['body'],{'firstName':_0x553894,'mobile':_0x553894,'phone':_0x553894,'ListId':_0x445c44[_0x14e5('0xa4')]}));}})[_0x14e5('0x35')](handleEntityNotFound(_0x5dd67d,null))[_0x14e5('0x35')](function(_0x13cdff){if(_0x13cdff){_0x19d34e=_0x13cdff;return db[_0x14e5('0xa8')][_0x14e5('0x5a')]({'where':{'ContactId':_0x19d34e['id'],'closed':![],'WhatsappAccountId':_0x445c44['id']}})[_0x14e5('0x35')](function(_0x3464f9){if(_0x3464f9){return[_0x3464f9,![]];}return db['WhatsappInteraction'][_0x14e5('0x60')]({'UserId':_0x50bc95['user']['id'],'ContactId':_0x19d34e['id'],'WhatsappAccountId':_0x445c44['id'],'phone':_0x553894,'firstMsgDirection':_0x14e5('0xbe'),'Messages':[_['merge'](_0x50bc95[_0x14e5('0x5b')],{'read':![],'body':_0x50bc95[_0x14e5('0x5b')][_0x14e5('0x5b')],'phone':_0x553894,'WhatsappAccountId':_0x445c44['id'],'UserId':_0x50bc95[_0x14e5('0x5c')]['id'],'ContactId':_0x19d34e['id']})]},{'include':[{'model':db[_0x14e5('0x89')],'as':'Messages'}]})[_0x14e5('0x35')](function(_0x3870d0){return[_0x3870d0,!![]];});});}})[_0x14e5('0x6e')](function(_0x41ac59,_0x81f017){if(_0x81f017){return _0x41ac59;}return db[_0x14e5('0x89')]['create'](_[_0x14e5('0x50')](_0x50bc95[_0x14e5('0x5b')],{'read':![],'body':_0x50bc95[_0x14e5('0x5b')]['body'],'phone':_0x553894,'WhatsappAccountId':_0x445c44['id'],'WhatsappInteractionId':_0x41ac59['id'],'UserId':_0x50bc95[_0x14e5('0x5c')]['id'],'ContactId':_0x19d34e['id']}))['then'](function(_0x29d68e){_0x41ac59[_0x14e5('0xbf')][_0x14e5('0xc0')]=[];_0x41ac59[_0x14e5('0xbf')][_0x14e5('0xc0')][_0x14e5('0xc1')](_0x29d68e[_0x14e5('0xbf')]);return _0x41ac59;});})[_0x14e5('0x35')](respondWithResult(_0x5dd67d,null))[_0x14e5('0x29')](handleError(_0x5dd67d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 86e7a8b..81c5ab2 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 _0xed08=['setMaxListeners','update','remove','hook','exports','events','WhatsappAccount'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xed08,0x91));var _0x8ed0=function(_0x13b30b,_0x57bb53){_0x13b30b=_0x13b30b-0x0;var _0x204394=_0xed08[_0x13b30b];return _0x204394;};'use strict';var EventEmitter=require(_0x8ed0('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x8ed0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8ed0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ed0('0x3'),'afterDestroy':_0x8ed0('0x4')};function emitEvent(_0x29c699){return function(_0x31c269,_0x31a39d,_0x281ac5){WhatsappAccountEvents['emit'](_0x29c699+':'+_0x31c269['id'],_0x31c269);WhatsappAccountEvents['emit'](_0x29c699,_0x31c269);_0x281ac5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x8ed0('0x5')](e,emitEvent(event));}}module[_0x8ed0('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3862=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x3862,0x145));var _0x2386=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x3862[_0x51d129];return _0x44c377;};'use strict';var EventEmitter=require(_0x2386('0x0'));var WhatsappAccount=require(_0x2386('0x1'))['db'][_0x2386('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2386('0x3')](0x0);var events={'afterCreate':_0x2386('0x4'),'afterUpdate':_0x2386('0x5'),'afterDestroy':_0x2386('0x6')};function emitEvent(_0x5dc024){return function(_0x3fbb73,_0xa60336,_0x758046){WhatsappAccountEvents[_0x2386('0x7')](_0x5dc024+':'+_0x3fbb73['id'],_0x3fbb73);WhatsappAccountEvents[_0x2386('0x7')](_0x5dc024,_0x3fbb73);_0x758046(null);};}for(var e in events){if(events[_0x2386('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2386('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6264f30..e185edf 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 _0xb9b1=['../../config/logger','bluebird','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','util'];(function(_0x4bf814,_0x431c38){var _0xd4452c=function(_0x4648de){while(--_0x4648de){_0x4bf814['push'](_0x4bf814['shift']());}};_0xd4452c(++_0x431c38);}(_0xb9b1,0x11f));var _0x1b9b=function(_0x5ca51c,_0x2eae62){_0x5ca51c=_0x5ca51c-0x0;var _0x3c856c=_0xb9b1[_0x5ca51c];return _0x3c856c;};'use strict';var _=require('lodash');var util=require(_0x1b9b('0x0'));var logger=require(_0x1b9b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b9b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b9b('0x3'));var rimraf=require(_0x1b9b('0x4'));var config=require('../../config/environment');var attributes=require(_0x1b9b('0x5'));module[_0x1b9b('0x6')]=function(_0x590f8d,_0x2b8ceb){return _0x590f8d[_0x1b9b('0x7')](_0x1b9b('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf4a=['define','WhatsappAccount','whatsapp_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x226c91,_0x481a5f){var _0x2c943f=function(_0x32ce70){while(--_0x32ce70){_0x226c91['push'](_0x226c91['shift']());}};_0x2c943f(++_0x481a5f);}(_0xdf4a,0x13b));var _0xadf4=function(_0x388796,_0xaea22e){_0x388796=_0x388796-0x0;var _0xd969a3=_0xdf4a[_0x388796];return _0xd969a3;};'use strict';var _=require('lodash');var util=require(_0xadf4('0x0'));var logger=require('../../config/logger')(_0xadf4('0x1'));var moment=require(_0xadf4('0x2'));var BPromise=require(_0xadf4('0x3'));var rp=require(_0xadf4('0x4'));var fs=require('fs');var path=require(_0xadf4('0x5'));var rimraf=require(_0xadf4('0x6'));var config=require(_0xadf4('0x7'));var attributes=require(_0xadf4('0x8'));module[_0xadf4('0x9')]=function(_0x27bd79,_0xd46a9b){return _0x27bd79[_0xadf4('0xa')](_0xadf4('0xb'),attributes,{'tableName':_0xadf4('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 0b574de..8f6c9e2 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 _0x8972=['redis','defaults','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','where','map','include','attributes','model','ShowWhatsappAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x8972,0xd8));var _0x2897=function(_0x580e8b,_0x6d90eb){_0x580e8b=_0x580e8b-0x0;var _0x21b8b7=_0x8972[_0x580e8b];return _0x21b8b7;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var moment=require(_0x2897('0x2'));var BPromise=require('bluebird');var rs=require(_0x2897('0x3'));var fs=require('fs');var Redis=require(_0x2897('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2897('0x5'));var logger=require(_0x2897('0x6'))(_0x2897('0x7'));var config=require(_0x2897('0x8'));var jayson=require(_0x2897('0x9'));var client=jayson[_0x2897('0xa')][_0x2897('0xb')]({'port':0x232a});config[_0x2897('0xc')]=_[_0x2897('0xd')](config[_0x2897('0xc')],{'host':_0x2897('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2897('0xf'))['register'](socket);function respondWithRpcPromise(_0x213fc5,_0x9cf98f,_0xc60c43){return new BPromise(function(_0x19b771,_0x291116){return client[_0x2897('0x10')](_0x213fc5,_0xc60c43)[_0x2897('0x11')](function(_0x56ff3e){logger[_0x2897('0x12')](_0x2897('0x13'),_0x9cf98f,_0x2897('0x14'));logger[_0x2897('0x15')](_0x2897('0x16'),_0x9cf98f,'request\x20sent',JSON[_0x2897('0x17')](_0x56ff3e));if(_0x56ff3e[_0x2897('0x18')]){if(_0x56ff3e[_0x2897('0x18')][_0x2897('0x19')]===0x1f4){logger[_0x2897('0x18')](_0x2897('0x13'),_0x9cf98f,_0x56ff3e['error'][_0x2897('0x1a')]);return _0x291116(_0x56ff3e[_0x2897('0x18')][_0x2897('0x1a')]);}logger[_0x2897('0x18')](_0x2897('0x13'),_0x9cf98f,_0x56ff3e[_0x2897('0x18')][_0x2897('0x1a')]);return _0x19b771(_0x56ff3e[_0x2897('0x18')][_0x2897('0x1a')]);}else{logger[_0x2897('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x9cf98f,'request\x20sent');_0x19b771(_0x56ff3e[_0x2897('0x1b')][_0x2897('0x1a')]);}})[_0x2897('0x1c')](function(_0x308273){logger[_0x2897('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x9cf98f,_0x308273);_0x291116(_0x308273);});});}exports['ShowWhatsappAccount']=function(_0x423443){var _0x25727a=this;return new Promise(function(_0x51062e,_0x6fa1af){return db[_0x2897('0x1d')]['find']({'raw':_0x423443[_0x2897('0x1e')]?_0x423443['options'][_0x2897('0x1f')]===undefined?!![]:![]:!![],'where':_0x423443[_0x2897('0x1e')]?_0x423443[_0x2897('0x1e')][_0x2897('0x20')]||null:null,'attributes':_0x423443['options']?_0x423443[_0x2897('0x1e')]['attributes']||null:null,'include':_0x423443[_0x2897('0x1e')]?_0x423443['options']['include']?_[_0x2897('0x21')](_0x423443[_0x2897('0x1e')][_0x2897('0x22')],function(_0x2c006a){return{'model':db[_0x2c006a['model']],'as':_0x2c006a['as'],'attributes':_0x2c006a[_0x2897('0x23')],'include':_0x2c006a['include']?_['map'](_0x2c006a['include'],function(_0x37a20e){return{'model':db[_0x37a20e['model']],'as':_0x37a20e['as'],'attributes':_0x37a20e[_0x2897('0x23')],'include':_0x37a20e['include']?_['map'](_0x37a20e['include'],function(_0x4f8c12){return{'model':db[_0x4f8c12[_0x2897('0x24')]],'as':_0x4f8c12['as'],'attributes':_0x4f8c12[_0x2897('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2897('0x11')](function(_0x84bc74){logger[_0x2897('0x12')](_0x2897('0x25'),_0x423443);logger[_0x2897('0x15')](_0x2897('0x25'),_0x423443,JSON[_0x2897('0x17')](_0x84bc74));_0x51062e(_0x84bc74);})[_0x2897('0x1c')](function(_0x1680be){logger[_0x2897('0x18')](_0x2897('0x25'),_0x1680be[_0x2897('0x1a')],_0x423443);_0x6fa1af(_0x25727a['error'](0x1f4,_0x1680be['message']));});});}; \ No newline at end of file +var _0x48f7=['error','code','message','info','result','catch','find','options','raw','where','attributes','map','model','include','ShowWhatsappAccount','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x48f7,0x130));var _0x748f=function(_0x30d762,_0x4c7f2d){_0x30d762=_0x30d762-0x0;var _0x3605c8=_0x48f7[_0x30d762];return _0x3605c8;};'use strict';var _=require('lodash');var util=require(_0x748f('0x0'));var moment=require(_0x748f('0x1'));var BPromise=require(_0x748f('0x2'));var rs=require(_0x748f('0x3'));var fs=require('fs');var Redis=require(_0x748f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x748f('0x5'));var logger=require('../../config/logger')(_0x748f('0x6'));var config=require(_0x748f('0x7'));var jayson=require(_0x748f('0x8'));var client=jayson[_0x748f('0x9')][_0x748f('0xa')]({'port':0x232a});config['redis']=_[_0x748f('0xb')](config[_0x748f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x748f('0xd'))(new Redis(config[_0x748f('0xc')]));require('./whatsappAccount.socket')[_0x748f('0xe')](socket);function respondWithRpcPromise(_0x51a757,_0x2c50b2,_0x233b96){return new BPromise(function(_0x3054ec,_0x35ca8a){return client['request'](_0x51a757,_0x233b96)[_0x748f('0xf')](function(_0x34d3cb){logger['info'](_0x748f('0x10'),_0x2c50b2,_0x748f('0x11'));logger['debug'](_0x748f('0x12'),_0x2c50b2,'request\x20sent',JSON[_0x748f('0x13')](_0x34d3cb));if(_0x34d3cb[_0x748f('0x14')]){if(_0x34d3cb[_0x748f('0x14')][_0x748f('0x15')]===0x1f4){logger[_0x748f('0x14')](_0x748f('0x10'),_0x2c50b2,_0x34d3cb[_0x748f('0x14')][_0x748f('0x16')]);return _0x35ca8a(_0x34d3cb[_0x748f('0x14')][_0x748f('0x16')]);}logger[_0x748f('0x14')](_0x748f('0x10'),_0x2c50b2,_0x34d3cb[_0x748f('0x14')]['message']);return _0x3054ec(_0x34d3cb[_0x748f('0x14')]['message']);}else{logger[_0x748f('0x17')](_0x748f('0x10'),_0x2c50b2,'request\x20sent');_0x3054ec(_0x34d3cb[_0x748f('0x18')][_0x748f('0x16')]);}})[_0x748f('0x19')](function(_0x2496c8){logger[_0x748f('0x14')](_0x748f('0x10'),_0x2c50b2,_0x2496c8);_0x35ca8a(_0x2496c8);});});}exports['ShowWhatsappAccount']=function(_0x334c97){var _0x21ed0c=this;return new Promise(function(_0x24015f,_0x225075){return db['WhatsappAccount'][_0x748f('0x1a')]({'raw':_0x334c97[_0x748f('0x1b')]?_0x334c97[_0x748f('0x1b')][_0x748f('0x1c')]===undefined?!![]:![]:!![],'where':_0x334c97['options']?_0x334c97[_0x748f('0x1b')][_0x748f('0x1d')]||null:null,'attributes':_0x334c97[_0x748f('0x1b')]?_0x334c97[_0x748f('0x1b')][_0x748f('0x1e')]||null:null,'include':_0x334c97[_0x748f('0x1b')]?_0x334c97[_0x748f('0x1b')]['include']?_[_0x748f('0x1f')](_0x334c97['options']['include'],function(_0x2c01b5){return{'model':db[_0x2c01b5[_0x748f('0x20')]],'as':_0x2c01b5['as'],'attributes':_0x2c01b5['attributes'],'include':_0x2c01b5[_0x748f('0x21')]?_['map'](_0x2c01b5['include'],function(_0xd64c73){return{'model':db[_0xd64c73['model']],'as':_0xd64c73['as'],'attributes':_0xd64c73[_0x748f('0x1e')],'include':_0xd64c73[_0x748f('0x21')]?_[_0x748f('0x1f')](_0xd64c73[_0x748f('0x21')],function(_0x600af0){return{'model':db[_0x600af0[_0x748f('0x20')]],'as':_0x600af0['as'],'attributes':_0x600af0[_0x748f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x748f('0xf')](function(_0x851870){logger[_0x748f('0x17')](_0x748f('0x22'),_0x334c97);logger[_0x748f('0x23')](_0x748f('0x22'),_0x334c97,JSON['stringify'](_0x851870));_0x24015f(_0x851870);})[_0x748f('0x19')](function(_0x401c90){logger[_0x748f('0x14')](_0x748f('0x22'),_0x401c90[_0x748f('0x16')],_0x334c97);_0x225075(_0x21ed0c[_0x748f('0x14')](0x1f4,_0x401c90[_0x748f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a84aeb6..e1da4e3 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 _0xb795=['save','remove','update','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x37306a,_0x435902){var _0x552039=function(_0x1ea1a5){while(--_0x1ea1a5){_0x37306a['push'](_0x37306a['shift']());}};_0x552039(++_0x435902);}(_0xb795,0x8f));var _0x5b79=function(_0xf7fe97,_0x432968){_0xf7fe97=_0xf7fe97-0x0;var _0x55b1a5=_0xb795[_0xf7fe97];return _0x55b1a5;};'use strict';var WhatsappAccountEvents=require(_0x5b79('0x0'));var events=[_0x5b79('0x1'),_0x5b79('0x2'),_0x5b79('0x3')];function createListener(_0x3c42a2,_0x5e531b){return function(_0x3bd231){_0x5e531b[_0x5b79('0x4')](_0x3c42a2,_0x3bd231);};}function removeListener(_0x2836bf,_0xca8849){return function(){WhatsappAccountEvents[_0x5b79('0x5')](_0x2836bf,_0xca8849);};}exports[_0x5b79('0x6')]=function(_0x5563f6){for(var _0x117ac6=0x0,_0x1cf388=events[_0x5b79('0x7')];_0x117ac6<_0x1cf388;_0x117ac6++){var _0x19d074=events[_0x117ac6];var _0x3066eb=createListener('whatsappAccount:'+_0x19d074,_0x5563f6);WhatsappAccountEvents['on'](_0x19d074,_0x3066eb);}}; \ No newline at end of file +var _0x0df9=['length','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x222707,_0x46c40a){var _0x997a76=function(_0x446a08){while(--_0x446a08){_0x222707['push'](_0x222707['shift']());}};_0x997a76(++_0x46c40a);}(_0x0df9,0x166));var _0x90df=function(_0x46a647,_0x1d94ae){_0x46a647=_0x46a647-0x0;var _0x2d2a38=_0x0df9[_0x46a647];return _0x2d2a38;};'use strict';var WhatsappAccountEvents=require(_0x90df('0x0'));var events=[_0x90df('0x1'),_0x90df('0x2'),_0x90df('0x3')];function createListener(_0x53e65e,_0x111559){return function(_0x2058dd){_0x111559[_0x90df('0x4')](_0x53e65e,_0x2058dd);};}function removeListener(_0xd45d69,_0x455180){return function(){WhatsappAccountEvents[_0x90df('0x5')](_0xd45d69,_0x455180);};}exports['register']=function(_0x564337){for(var _0x4a788f=0x0,_0x41d47c=events[_0x90df('0x6')];_0x4a788f<_0x41d47c;_0x4a788f++){var _0x56d1da=events[_0x4a788f];var _0x214869=createListener('whatsappAccount:'+_0x56d1da,_0x564337);WhatsappAccountEvents['on'](_0x56d1da,_0x214869);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f36c76a..c6d872e 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 _0x6217=['connect-timeout','express','fs-extra','../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x29755f,_0x53fa76){var _0xe66967=function(_0x55be19){while(--_0x55be19){_0x29755f['push'](_0x29755f['shift']());}};_0xe66967(++_0x53fa76);}(_0x6217,0x153));var _0x7621=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0x6217[_0x44ca6e];return _0x2edab2;};'use strict';var multer=require(_0x7621('0x0'));var util=require(_0x7621('0x1'));var path=require(_0x7621('0x2'));var timeout=require(_0x7621('0x3'));var express=require(_0x7621('0x4'));var router=express['Router']();var fs_extra=require(_0x7621('0x5'));var auth=require(_0x7621('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7621('0x7'));router[_0x7621('0x8')]('/',auth[_0x7621('0x9')](),controller[_0x7621('0xa')]);router[_0x7621('0x8')](_0x7621('0xb'),auth[_0x7621('0x9')](),controller[_0x7621('0xc')]);router[_0x7621('0xd')]('/',auth[_0x7621('0x9')](),controller[_0x7621('0xe')]);router[_0x7621('0xf')]('/:id',auth[_0x7621('0x9')](),controller[_0x7621('0x10')]);router[_0x7621('0x11')](_0x7621('0xb'),auth[_0x7621('0x9')](),controller[_0x7621('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0571=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','index','get','isAuthenticated','show','post','create','put','/:id','delete','exports','multer','path'];(function(_0xdbeb66,_0x3cbc4d){var _0x4cd3a2=function(_0x206460){while(--_0x206460){_0xdbeb66['push'](_0xdbeb66['shift']());}};_0x4cd3a2(++_0x3cbc4d);}(_0x0571,0x96));var _0x1057=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x0571[_0x2f48cd];return _0x193ae2;};'use strict';var multer=require(_0x1057('0x0'));var util=require('util');var path=require(_0x1057('0x1'));var timeout=require(_0x1057('0x2'));var express=require(_0x1057('0x3'));var router=express['Router']();var fs_extra=require(_0x1057('0x4'));var auth=require(_0x1057('0x5'));var interaction=require(_0x1057('0x6'));var config=require(_0x1057('0x7'));var controller=require(_0x1057('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1057('0x9')]);router[_0x1057('0xa')]('/:id',auth[_0x1057('0xb')](),controller[_0x1057('0xc')]);router[_0x1057('0xd')]('/',auth[_0x1057('0xb')](),controller[_0x1057('0xe')]);router[_0x1057('0xf')](_0x1057('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1057('0x11')](_0x1057('0x10'),auth[_0x1057('0xb')](),controller['destroy']);module[_0x1057('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index bdd5e65..de47377 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 _0x097e=['sequelize','exports','INTEGER','noop','TEXT','*,*,*,*'];(function(_0x304429,_0x5c956f){var _0x26a77f=function(_0xe50d9d){while(--_0xe50d9d){_0x304429['push'](_0x304429['shift']());}};_0x26a77f(++_0x5c956f);}(_0x097e,0x150));var _0xe097=function(_0x391298,_0x20fb05){_0x391298=_0x391298-0x0;var _0x514d06=_0x097e[_0x391298];return _0x514d06;};'use strict';var Sequelize=require(_0xe097('0x0'));module[_0xe097('0x1')]={'priority':{'type':Sequelize[_0xe097('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe097('0x3')},'appdata':{'type':Sequelize[_0xe097('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe097('0x5')}}; \ No newline at end of file +var _0x8508=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x8508,0x115));var _0x8850=function(_0x23efbf,_0x5383d2){_0x23efbf=_0x23efbf-0x0;var _0x5e353c=_0x8508[_0x23efbf];return _0x5e353c;};'use strict';var Sequelize=require(_0x8850('0x0'));module[_0x8850('0x1')]={'priority':{'type':Sequelize[_0x8850('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8850('0x3')],'allowNull':![],'defaultValue':_0x8850('0x4')},'appdata':{'type':Sequelize[_0x8850('0x5')]()},'description':{'type':Sequelize[_0x8850('0x3')]},'interval':{'type':Sequelize[_0x8850('0x3')],'defaultValue':_0x8850('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 45a5714..63b4102 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 _0xe953=['fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe953,0xf9));var _0x3e95=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe953[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require(_0x3e95('0x0'));var rimraf=require(_0x3e95('0x1'));var zipdir=require(_0x3e95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e95('0x3'));var moment=require(_0x3e95('0x4'));var BPromise=require(_0x3e95('0x5'));var Mustache=require(_0x3e95('0x6'));var util=require(_0x3e95('0x7'));var path=require(_0x3e95('0x8'));var sox=require(_0x3e95('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e95('0xa'));var _=require('lodash');var squel=require(_0x3e95('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e95('0xc'));var deskjs=require(_0x3e95('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e95('0xe'));var Redis=require('ioredis');var authService=require(_0x3e95('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e95('0x10'));var logger=require(_0x3e95('0x11'))(_0x3e95('0x12'));var utils=require('../../config/utils');var config=require(_0x3e95('0x13'));var licenseUtil=require(_0x3e95('0x14'));var db=require(_0x3e95('0x15'))['db'];function respondWithStatusCode(_0x330721,_0x405503){_0x405503=_0x405503||0xcc;return function(_0x5576cf){if(_0x5576cf){return _0x330721[_0x3e95('0x16')](_0x405503);}return _0x330721[_0x3e95('0x17')](_0x405503)[_0x3e95('0x18')]();};}function respondWithResult(_0x570618,_0x32b58a){_0x32b58a=_0x32b58a||0xc8;return function(_0x6be4fa){if(_0x6be4fa){return _0x570618[_0x3e95('0x17')](_0x32b58a)[_0x3e95('0x19')](_0x6be4fa);}};}function respondWithFilteredResult(_0x29f794,_0x2a7a6c){return function(_0x54d548){if(_0x54d548){var _0x4b4a6a=typeof _0x2a7a6c[_0x3e95('0x1a')]===_0x3e95('0x1b')&&typeof _0x2a7a6c[_0x3e95('0x1c')]==='undefined';var _0x2ca38c=_0x54d548[_0x3e95('0x1d')];var _0x13c486=_0x4b4a6a?0x0:_0x2a7a6c['offset'];var _0x557d0a=_0x4b4a6a?_0x54d548[_0x3e95('0x1d')]:_0x2a7a6c['offset']+_0x2a7a6c['limit'];var _0xef8818;if(_0x557d0a>=_0x2ca38c){_0x557d0a=_0x2ca38c;_0xef8818=0xc8;}else{_0xef8818=0xce;}_0x29f794['status'](_0xef8818);return _0x29f794[_0x3e95('0x1e')](_0x3e95('0x1f'),_0x13c486+'-'+_0x557d0a+'/'+_0x2ca38c)[_0x3e95('0x19')](_0x54d548);}return null;};}function patchUpdates(_0x4f59d7){return function(_0x2861af){try{jsonpatch['apply'](_0x2861af,_0x4f59d7,!![]);}catch(_0x35e98c){return BPromise[_0x3e95('0x20')](_0x35e98c);}return _0x2861af[_0x3e95('0x21')]();};}function saveUpdates(_0x4c071b,_0x4c6181){return function(_0x13c2c5){if(_0x13c2c5){return _0x13c2c5['update'](_0x4c071b)[_0x3e95('0x22')](function(_0x307a75){return _0x307a75;});}return null;};}function removeEntity(_0x562a5a,_0xb4c720){return function(_0x51b673){if(_0x51b673){return _0x51b673[_0x3e95('0x23')]()[_0x3e95('0x22')](function(){_0x562a5a[_0x3e95('0x17')](0xcc)[_0x3e95('0x18')]();});}};}function handleEntityNotFound(_0x421498,_0x3b474c){return function(_0x296991){if(!_0x296991){_0x421498[_0x3e95('0x16')](0x194);}return _0x296991;};}function handleError(_0x59b34f,_0x524abf){_0x524abf=_0x524abf||0x1f4;return function(_0x384298){logger[_0x3e95('0x24')](_0x384298['stack']);if(_0x384298[_0x3e95('0x25')]){delete _0x384298[_0x3e95('0x25')];}_0x59b34f[_0x3e95('0x17')](_0x524abf)[_0x3e95('0x26')](_0x384298);};}exports[_0x3e95('0x27')]=function(_0x456ac3,_0x1dc0fa){var _0x4749f3={},_0x2eb95f={},_0x2a98c2={'count':0x0,'rows':[]};var _0x3c0968=_[_0x3e95('0x28')](db[_0x3e95('0x29')][_0x3e95('0x2a')],function(_0x21e1aa){return{'name':_0x21e1aa[_0x3e95('0x2b')],'type':_0x21e1aa[_0x3e95('0x2c')]['key']};});_0x2eb95f[_0x3e95('0x2d')]=_['map'](_0x3c0968,_0x3e95('0x25'));_0x2eb95f[_0x3e95('0x2e')]=_[_0x3e95('0x2f')](_0x456ac3['query']);_0x2eb95f['filters']=_[_0x3e95('0x30')](_0x2eb95f[_0x3e95('0x2d')],_0x2eb95f[_0x3e95('0x2e')]);_0x4749f3['attributes']=_['intersection'](_0x2eb95f[_0x3e95('0x2d')],qs[_0x3e95('0x31')](_0x456ac3['query'][_0x3e95('0x31')]));_0x4749f3['attributes']=_0x4749f3[_0x3e95('0x32')][_0x3e95('0x33')]?_0x4749f3['attributes']:_0x2eb95f[_0x3e95('0x2d')];if(!_0x456ac3[_0x3e95('0x2e')][_0x3e95('0x34')](_0x3e95('0x35'))){_0x4749f3[_0x3e95('0x1c')]=qs[_0x3e95('0x1c')](_0x456ac3[_0x3e95('0x2e')][_0x3e95('0x1c')]);_0x4749f3[_0x3e95('0x1a')]=qs[_0x3e95('0x1a')](_0x456ac3[_0x3e95('0x2e')][_0x3e95('0x1a')]);}_0x4749f3[_0x3e95('0x36')]=qs['sort'](_0x456ac3[_0x3e95('0x2e')][_0x3e95('0x37')]);_0x4749f3[_0x3e95('0x38')]=qs['filters'](_[_0x3e95('0x39')](_0x456ac3[_0x3e95('0x2e')],_0x2eb95f[_0x3e95('0x3a')]),_0x3c0968);if(_0x456ac3['query'][_0x3e95('0x3b')]){_0x4749f3[_0x3e95('0x38')]=_['merge'](_0x4749f3[_0x3e95('0x38')],{'$or':_[_0x3e95('0x28')](_0x3c0968,function(_0x8ca2b3){if(_0x8ca2b3[_0x3e95('0x2c')]!==_0x3e95('0x3c')){var _0x1f0510={};_0x1f0510[_0x8ca2b3[_0x3e95('0x25')]]={'$like':'%'+_0x456ac3['query']['filter']+'%'};return _0x1f0510;}})});}_0x4749f3=_[_0x3e95('0x3d')]({},_0x4749f3,_0x456ac3[_0x3e95('0x3e')]);var _0x2e46e1={'where':_0x4749f3[_0x3e95('0x38')]};return db['WhatsappApplication']['count'](_0x2e46e1)[_0x3e95('0x22')](function(_0x3928ad){_0x2a98c2['count']=_0x3928ad;if(_0x456ac3[_0x3e95('0x2e')][_0x3e95('0x3f')]){_0x4749f3[_0x3e95('0x40')]=[{'all':!![]}];}return db[_0x3e95('0x29')][_0x3e95('0x41')](_0x4749f3);})['then'](function(_0x4feb74){_0x2a98c2[_0x3e95('0x42')]=_0x4feb74;return _0x2a98c2;})[_0x3e95('0x22')](respondWithFilteredResult(_0x1dc0fa,_0x4749f3))[_0x3e95('0x43')](handleError(_0x1dc0fa,null));};exports[_0x3e95('0x44')]=function(_0xc58ff7,_0x4b89c7){var _0x445eec={'raw':!![],'where':{'id':_0xc58ff7[_0x3e95('0x45')]['id']}},_0x30e6c0={};_0x30e6c0['model']=_['keys'](db['WhatsappApplication'][_0x3e95('0x2a')]);_0x30e6c0[_0x3e95('0x2e')]=_[_0x3e95('0x2f')](_0xc58ff7['query']);_0x30e6c0[_0x3e95('0x3a')]=_[_0x3e95('0x30')](_0x30e6c0[_0x3e95('0x2d')],_0x30e6c0[_0x3e95('0x2e')]);_0x445eec[_0x3e95('0x32')]=_[_0x3e95('0x30')](_0x30e6c0[_0x3e95('0x2d')],qs[_0x3e95('0x31')](_0xc58ff7[_0x3e95('0x2e')][_0x3e95('0x31')]));_0x445eec[_0x3e95('0x32')]=_0x445eec[_0x3e95('0x32')][_0x3e95('0x33')]?_0x445eec[_0x3e95('0x32')]:_0x30e6c0[_0x3e95('0x2d')];if(_0xc58ff7[_0x3e95('0x2e')][_0x3e95('0x3f')]){_0x445eec['include']=[{'all':!![]}];}_0x445eec=_[_0x3e95('0x3d')]({},_0x445eec,_0xc58ff7[_0x3e95('0x3e')]);return db[_0x3e95('0x29')][_0x3e95('0x46')](_0x445eec)[_0x3e95('0x22')](handleEntityNotFound(_0x4b89c7,null))[_0x3e95('0x22')](respondWithResult(_0x4b89c7,null))[_0x3e95('0x43')](handleError(_0x4b89c7,null));};exports[_0x3e95('0x47')]=function(_0x3d2547,_0x926bc5){return db['WhatsappApplication'][_0x3e95('0x47')](_0x3d2547[_0x3e95('0x48')],{})[_0x3e95('0x22')](respondWithResult(_0x926bc5,0xc9))['catch'](handleError(_0x926bc5,null));};exports['update']=function(_0x5d61ba,_0x5d0b51){if(_0x5d61ba[_0x3e95('0x48')]['id']){delete _0x5d61ba[_0x3e95('0x48')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x5d61ba[_0x3e95('0x45')]['id']}})[_0x3e95('0x22')](handleEntityNotFound(_0x5d0b51,null))[_0x3e95('0x22')](saveUpdates(_0x5d61ba[_0x3e95('0x48')],null))[_0x3e95('0x22')](respondWithResult(_0x5d0b51,null))['catch'](handleError(_0x5d0b51,null));};exports[_0x3e95('0x23')]=function(_0x5ef982,_0x31a801){return db[_0x3e95('0x29')][_0x3e95('0x46')]({'where':{'id':_0x5ef982[_0x3e95('0x45')]['id']}})[_0x3e95('0x22')](handleEntityNotFound(_0x31a801,null))[_0x3e95('0x22')](removeEntity(_0x31a801,null))[_0x3e95('0x43')](handleError(_0x31a801,null));}; \ No newline at end of file +var _0x39d2=['sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','WhatsappApplication','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x32f91b,_0x460016){var _0x3ee8f3=function(_0x39b27d){while(--_0x39b27d){_0x32f91b['push'](_0x32f91b['shift']());}};_0x3ee8f3(++_0x460016);}(_0x39d2,0xf5));var _0x239d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x39d2[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require(_0x239d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x239d('0x1'));var jsonpatch=require(_0x239d('0x2'));var rp=require(_0x239d('0x3'));var moment=require(_0x239d('0x4'));var BPromise=require(_0x239d('0x5'));var Mustache=require(_0x239d('0x6'));var util=require(_0x239d('0x7'));var path=require(_0x239d('0x8'));var sox=require(_0x239d('0x9'));var csv=require(_0x239d('0xa'));var ejs=require(_0x239d('0xb'));var fs=require('fs');var fs_extra=require(_0x239d('0xc'));var _=require(_0x239d('0xd'));var squel=require('squel');var crypto=require(_0x239d('0xe'));var jsforce=require(_0x239d('0xf'));var deskjs=require(_0x239d('0x10'));var toCsv=require(_0x239d('0xa'));var querystring=require(_0x239d('0x11'));var Papa=require(_0x239d('0x12'));var Redis=require(_0x239d('0x13'));var authService=require(_0x239d('0x14'));var qs=require(_0x239d('0x15'));var as=require(_0x239d('0x16'));var hardwareService=require(_0x239d('0x17'));var logger=require(_0x239d('0x18'))(_0x239d('0x19'));var utils=require(_0x239d('0x1a'));var config=require(_0x239d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d366f,_0x2832da){_0x2832da=_0x2832da||0xcc;return function(_0x2c4158){if(_0x2c4158){return _0x1d366f[_0x239d('0x1c')](_0x2832da);}return _0x1d366f[_0x239d('0x1d')](_0x2832da)[_0x239d('0x1e')]();};}function respondWithResult(_0x138c4a,_0x1f7319){_0x1f7319=_0x1f7319||0xc8;return function(_0x269134){if(_0x269134){return _0x138c4a['status'](_0x1f7319)[_0x239d('0x1f')](_0x269134);}};}function respondWithFilteredResult(_0x430f26,_0x17933b){return function(_0x6c9d2a){if(_0x6c9d2a){var _0x132915=typeof _0x17933b['offset']==='undefined'&&typeof _0x17933b[_0x239d('0x20')]==='undefined';var _0x1b62eb=_0x6c9d2a['count'];var _0x33f01d=_0x132915?0x0:_0x17933b[_0x239d('0x21')];var _0x1d6687=_0x132915?_0x6c9d2a[_0x239d('0x22')]:_0x17933b[_0x239d('0x21')]+_0x17933b[_0x239d('0x20')];var _0x2b1130;if(_0x1d6687>=_0x1b62eb){_0x1d6687=_0x1b62eb;_0x2b1130=0xc8;}else{_0x2b1130=0xce;}_0x430f26[_0x239d('0x1d')](_0x2b1130);return _0x430f26['set'](_0x239d('0x23'),_0x33f01d+'-'+_0x1d6687+'/'+_0x1b62eb)['json'](_0x6c9d2a);}return null;};}function patchUpdates(_0x519d25){return function(_0x44a311){try{jsonpatch[_0x239d('0x24')](_0x44a311,_0x519d25,!![]);}catch(_0x5abe81){return BPromise[_0x239d('0x25')](_0x5abe81);}return _0x44a311[_0x239d('0x26')]();};}function saveUpdates(_0x1e8f55,_0x344fab){return function(_0xb77bfe){if(_0xb77bfe){return _0xb77bfe[_0x239d('0x27')](_0x1e8f55)[_0x239d('0x28')](function(_0x2b8ad0){return _0x2b8ad0;});}return null;};}function removeEntity(_0x1a5c2d,_0x4f1142){return function(_0x13131e){if(_0x13131e){return _0x13131e[_0x239d('0x29')]()[_0x239d('0x28')](function(){_0x1a5c2d[_0x239d('0x1d')](0xcc)[_0x239d('0x1e')]();});}};}function handleEntityNotFound(_0x72802,_0xe97415){return function(_0x281f57){if(!_0x281f57){_0x72802[_0x239d('0x1c')](0x194);}return _0x281f57;};}function handleError(_0x54dfe7,_0x1b9379){_0x1b9379=_0x1b9379||0x1f4;return function(_0x395cc4){logger['error'](_0x395cc4['stack']);if(_0x395cc4[_0x239d('0x2a')]){delete _0x395cc4['name'];}_0x54dfe7['status'](_0x1b9379)[_0x239d('0x2b')](_0x395cc4);};}exports[_0x239d('0x2c')]=function(_0x59bb0d,_0x3dba9e){var _0x4f779e={},_0x5de926={},_0x4e91c7={'count':0x0,'rows':[]};var _0x34e92b=_[_0x239d('0x2d')](db[_0x239d('0x2e')][_0x239d('0x2f')],function(_0x5cc2d2){return{'name':_0x5cc2d2['fieldName'],'type':_0x5cc2d2['type'][_0x239d('0x30')]};});_0x5de926[_0x239d('0x31')]=_[_0x239d('0x2d')](_0x34e92b,_0x239d('0x2a'));_0x5de926['query']=_[_0x239d('0x32')](_0x59bb0d[_0x239d('0x33')]);_0x5de926[_0x239d('0x34')]=_[_0x239d('0x35')](_0x5de926[_0x239d('0x31')],_0x5de926['query']);_0x4f779e[_0x239d('0x36')]=_[_0x239d('0x35')](_0x5de926[_0x239d('0x31')],qs[_0x239d('0x37')](_0x59bb0d[_0x239d('0x33')][_0x239d('0x37')]));_0x4f779e[_0x239d('0x36')]=_0x4f779e[_0x239d('0x36')][_0x239d('0x38')]?_0x4f779e[_0x239d('0x36')]:_0x5de926[_0x239d('0x31')];if(!_0x59bb0d[_0x239d('0x33')]['hasOwnProperty'](_0x239d('0x39'))){_0x4f779e[_0x239d('0x20')]=qs[_0x239d('0x20')](_0x59bb0d[_0x239d('0x33')][_0x239d('0x20')]);_0x4f779e[_0x239d('0x21')]=qs['offset'](_0x59bb0d[_0x239d('0x33')]['offset']);}_0x4f779e[_0x239d('0x3a')]=qs[_0x239d('0x3b')](_0x59bb0d['query'][_0x239d('0x3b')]);_0x4f779e[_0x239d('0x3c')]=qs[_0x239d('0x34')](_[_0x239d('0x3d')](_0x59bb0d['query'],_0x5de926['filters']),_0x34e92b);if(_0x59bb0d[_0x239d('0x33')][_0x239d('0x3e')]){_0x4f779e[_0x239d('0x3c')]=_[_0x239d('0x3f')](_0x4f779e[_0x239d('0x3c')],{'$or':_['map'](_0x34e92b,function(_0x5dc771){if(_0x5dc771[_0x239d('0x40')]!=='VIRTUAL'){var _0x296904={};_0x296904[_0x5dc771['name']]={'$like':'%'+_0x59bb0d[_0x239d('0x33')]['filter']+'%'};return _0x296904;}})});}_0x4f779e=_[_0x239d('0x3f')]({},_0x4f779e,_0x59bb0d[_0x239d('0x41')]);var _0x5c621={'where':_0x4f779e[_0x239d('0x3c')]};return db['WhatsappApplication'][_0x239d('0x22')](_0x5c621)[_0x239d('0x28')](function(_0x437641){_0x4e91c7[_0x239d('0x22')]=_0x437641;if(_0x59bb0d[_0x239d('0x33')][_0x239d('0x42')]){_0x4f779e[_0x239d('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x239d('0x44')](_0x4f779e);})[_0x239d('0x28')](function(_0x182e60){_0x4e91c7[_0x239d('0x45')]=_0x182e60;return _0x4e91c7;})[_0x239d('0x28')](respondWithFilteredResult(_0x3dba9e,_0x4f779e))[_0x239d('0x46')](handleError(_0x3dba9e,null));};exports[_0x239d('0x47')]=function(_0x99c39f,_0x4700a9){var _0x33e536={'raw':!![],'where':{'id':_0x99c39f[_0x239d('0x48')]['id']}},_0x4ad022={};_0x4ad022['model']=_[_0x239d('0x32')](db['WhatsappApplication'][_0x239d('0x2f')]);_0x4ad022[_0x239d('0x33')]=_[_0x239d('0x32')](_0x99c39f[_0x239d('0x33')]);_0x4ad022[_0x239d('0x34')]=_['intersection'](_0x4ad022['model'],_0x4ad022[_0x239d('0x33')]);_0x33e536[_0x239d('0x36')]=_[_0x239d('0x35')](_0x4ad022[_0x239d('0x31')],qs['fields'](_0x99c39f[_0x239d('0x33')][_0x239d('0x37')]));_0x33e536[_0x239d('0x36')]=_0x33e536['attributes'][_0x239d('0x38')]?_0x33e536[_0x239d('0x36')]:_0x4ad022[_0x239d('0x31')];if(_0x99c39f[_0x239d('0x33')]['includeAll']){_0x33e536[_0x239d('0x43')]=[{'all':!![]}];}_0x33e536=_[_0x239d('0x3f')]({},_0x33e536,_0x99c39f['options']);return db['WhatsappApplication']['find'](_0x33e536)[_0x239d('0x28')](handleEntityNotFound(_0x4700a9,null))[_0x239d('0x28')](respondWithResult(_0x4700a9,null))[_0x239d('0x46')](handleError(_0x4700a9,null));};exports[_0x239d('0x49')]=function(_0x49cf9e,_0x57456b){return db[_0x239d('0x2e')][_0x239d('0x49')](_0x49cf9e['body'],{})[_0x239d('0x28')](respondWithResult(_0x57456b,0xc9))[_0x239d('0x46')](handleError(_0x57456b,null));};exports['update']=function(_0x3cf85f,_0x37f24b){if(_0x3cf85f[_0x239d('0x4a')]['id']){delete _0x3cf85f['body']['id'];}return db[_0x239d('0x2e')][_0x239d('0x4b')]({'where':{'id':_0x3cf85f['params']['id']}})['then'](handleEntityNotFound(_0x37f24b,null))[_0x239d('0x28')](saveUpdates(_0x3cf85f['body'],null))[_0x239d('0x28')](respondWithResult(_0x37f24b,null))[_0x239d('0x46')](handleError(_0x37f24b,null));};exports[_0x239d('0x29')]=function(_0x1073a7,_0x31c192){return db['WhatsappApplication']['find']({'where':{'id':_0x1073a7[_0x239d('0x48')]['id']}})['then'](handleEntityNotFound(_0x31c192,null))[_0x239d('0x28')](removeEntity(_0x31c192,null))[_0x239d('0x46')](handleError(_0x31c192,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d79825c..74792e9 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 _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x371d05,_0x598ae4){var _0x2f5e21=function(_0x3ee4dc){while(--_0x3ee4dc){_0x371d05['push'](_0x371d05['shift']());}};_0x2f5e21(++_0x598ae4);}(_0xef8b,0x192));var _0xbef8=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0xef8b[_0x2aeca6];return _0x48c8c9;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbef8('0xd'),'collate':_0xbef8('0xe')});}; \ No newline at end of file +var _0x83d3=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappApplication'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x83d3,0x17c));var _0x383d=function(_0xeb7786,_0x53a053){_0xeb7786=_0xeb7786-0x0;var _0x120bbc=_0x83d3[_0xeb7786];return _0x120bbc;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x383d('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0f42a2c..d928c37 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 _0xbec5=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0xbec5,0xe5));var _0x5bec=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0xbec5[_0x2fc113];return _0x5144ce;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4f0ebf,_0x1c531b){var _0x3224e5=function(_0x3e2b35){while(--_0x3e2b35){_0x4f0ebf['push'](_0x4f0ebf['shift']());}};_0x3224e5(++_0x1c531b);}(_0x84ab,0x12f));var _0xb84a=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x84ab[_0x5b740b];return _0x6f8f4e;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 66ec3fb..a064d25 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 _0xed1c=['whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','tracked'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xed1c,0xe4));var _0xced1=function(_0x71c006,_0x599ac7){_0x71c006=_0x71c006-0x0;var _0x5d552d=_0xed1c[_0x71c006];return _0x5d552d;};'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('0x6')]('/:id/messages',auth[_0xced1('0x7')](),controller['getMessages']);router[_0xced1('0x6')](_0xced1('0xd'),auth[_0xced1('0x7')](),controller[_0xced1('0xe')]);router[_0xced1('0xf')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x10')]);router['post'](_0xced1('0x11'),auth[_0xced1('0x7')](),controller[_0xced1('0x12')]);router[_0xced1('0xf')]('/:id/tags',auth[_0xced1('0x7')](),interaction[_0xced1('0x13')]('whatsapp',_0xced1('0x14')),controller[_0xced1('0x15')]);router[_0xced1('0x16')](_0xced1('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xced1('0x17'),_0xced1('0x18')),controller[_0xced1('0x19')]);router[_0xced1('0x1a')](_0xced1('0xb'),auth[_0xced1('0x7')](),interaction['tracked']('whatsapp',_0xced1('0x1b')),controller[_0xced1('0x1c')]);router[_0xced1('0x1a')]('/:id/tags',auth[_0xced1('0x7')](),controller[_0xced1('0x1d')]);module[_0xced1('0x1e')]=router; \ No newline at end of file +var _0x1db9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id/messages','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1db9,0x176));var _0x91db=function(_0x4b3bac,_0x1261b4){_0x4b3bac=_0x4b3bac-0x0;var _0x50b0f4=_0x1db9[_0x4b3bac];return _0x50b0f4;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0x8')](_0x91db('0xc'),auth[_0x91db('0xa')](),controller['getMessages']);router[_0x91db('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x91db('0xd')]('/',auth[_0x91db('0xa')](),controller['create']);router['post'](_0x91db('0xc'),auth[_0x91db('0xa')](),controller[_0x91db('0xe')]);router[_0x91db('0xd')](_0x91db('0xf'),auth['isAuthenticated'](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x12')),controller[_0x91db('0x13')]);router[_0x91db('0x14')](_0x91db('0x15'),auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x16')),controller[_0x91db('0x17')]);router[_0x91db('0x18')]('/:id',auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x19')),controller[_0x91db('0x1a')]);router[_0x91db('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x91db('0x1b')]);module[_0x91db('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0d363e5..f15eae1 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 _0xab3f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0xf28958,_0x53f0ed){var _0x4a4ce4=function(_0x5275fb){while(--_0x5275fb){_0xf28958['push'](_0xf28958['shift']());}};_0x4a4ce4(++_0x53f0ed);}(_0xab3f,0x72));var _0xfab3=function(_0x2f6be3,_0x3b9500){_0x2f6be3=_0x2f6be3-0x0;var _0x29a79d=_0xab3f[_0x2f6be3];return _0x29a79d;};'use strict';var Sequelize=require(_0xfab3('0x0'));var moment=require('moment');module[_0xfab3('0x1')]={'closed':{'type':Sequelize[_0xfab3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfab3('0x3')]},'disposition':{'type':Sequelize[_0xfab3('0x4')]},'secondDisposition':{'type':Sequelize[_0xfab3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfab3('0x4')]},'note':{'type':Sequelize[_0xfab3('0x4')]},'phone':{'type':Sequelize[_0xfab3('0x4')]},'read1stAt':{'type':Sequelize[_0xfab3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfab3('0x5')]('in',_0xfab3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfab3('0x5')]('in',_0xfab3('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfab3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x29b1=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x2ab737,_0x1a424d){var _0x46bb68=function(_0x4bd7f8){while(--_0x4bd7f8){_0x2ab737['push'](_0x2ab737['shift']());}};_0x46bb68(++_0x1a424d);}(_0x29b1,0x13b));var _0x129b=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x29b1[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x129b('0x0')]={'closed':{'type':Sequelize[_0x129b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x129b('0x2')]},'disposition':{'type':Sequelize[_0x129b('0x3')]},'secondDisposition':{'type':Sequelize[_0x129b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x129b('0x3')]},'note':{'type':Sequelize[_0x129b('0x3')]},'phone':{'type':Sequelize[_0x129b('0x3')]},'read1stAt':{'type':Sequelize[_0x129b('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x129b('0x4')]('in',_0x129b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x129b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x129b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 15c8f06..805e7c7 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 _0x7a52=['undefined','limit','count','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','then','waiting','talking','unmanaged','closed','UserId','answered','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','text','keys','some','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','rows','catch','includeAll','include','body','params','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','closedAt','basename','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset'];(function(_0x492fc0,_0x47b793){var _0x4a55c1=function(_0x2c0890){while(--_0x2c0890){_0x492fc0['push'](_0x492fc0['shift']());}};_0x4a55c1(++_0x47b793);}(_0x7a52,0x1bd));var _0x27a5=function(_0x4ed55b,_0x394199){_0x4ed55b=_0x4ed55b-0x0;var _0xf5b24c=_0x7a52[_0x4ed55b];return _0xf5b24c;};'use strict';var emlformat=require(_0x27a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27a5('0x1'));var jsonpatch=require(_0x27a5('0x2'));var rp=require(_0x27a5('0x3'));var moment=require(_0x27a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27a5('0x5'));var util=require(_0x27a5('0x6'));var path=require(_0x27a5('0x7'));var sox=require(_0x27a5('0x8'));var csv=require(_0x27a5('0x9'));var ejs=require(_0x27a5('0xa'));var fs=require('fs');var fs_extra=require(_0x27a5('0xb'));var _=require('lodash');var squel=require(_0x27a5('0xc'));var crypto=require(_0x27a5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27a5('0x9'));var querystring=require('querystring');var Papa=require(_0x27a5('0xe'));var Redis=require(_0x27a5('0xf'));var authService=require(_0x27a5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x27a5('0x11'));var pdf=require(_0x27a5('0x12'));var hardwareService=require(_0x27a5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x27a5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x27a5('0x15'))['db'];config[_0x27a5('0x16')]=_[_0x27a5('0x17')](config[_0x27a5('0x16')],{'host':_0x27a5('0x18'),'port':0x18eb});var socket=require(_0x27a5('0x19'))(new Redis(config[_0x27a5('0x16')]));require('./whatsappInteraction.socket')[_0x27a5('0x1a')](socket);function respondWithStatusCode(_0x368d9,_0x14d262){_0x14d262=_0x14d262||0xcc;return function(_0x5e1ad6){if(_0x5e1ad6){return _0x368d9['sendStatus'](_0x14d262);}return _0x368d9[_0x27a5('0x1b')](_0x14d262)[_0x27a5('0x1c')]();};}function respondWithResult(_0x4500c4,_0x25e512){_0x25e512=_0x25e512||0xc8;return function(_0x398354){if(_0x398354){return _0x4500c4[_0x27a5('0x1b')](_0x25e512)[_0x27a5('0x1d')](_0x398354);}};}function respondWithFilteredResult(_0xad446a,_0x55facb){return function(_0x249855){if(_0x249855){var _0x1071ab=typeof _0x55facb[_0x27a5('0x1e')]===_0x27a5('0x1f')&&typeof _0x55facb[_0x27a5('0x20')]===_0x27a5('0x1f');var _0x110b3d=_0x249855['count'];var _0x31cf07=_0x1071ab?0x0:_0x55facb[_0x27a5('0x1e')];var _0x499b6d=_0x1071ab?_0x249855[_0x27a5('0x21')]:_0x55facb[_0x27a5('0x1e')]+_0x55facb[_0x27a5('0x20')];var _0x139f9e;if(_0x499b6d>=_0x110b3d){_0x499b6d=_0x110b3d;_0x139f9e=0xc8;}else{_0x139f9e=0xce;}_0xad446a[_0x27a5('0x1b')](_0x139f9e);return _0xad446a['set'](_0x27a5('0x22'),_0x31cf07+'-'+_0x499b6d+'/'+_0x110b3d)[_0x27a5('0x1d')](_0x249855);}return null;};}function patchUpdates(_0x51605e){return function(_0x5ee7a1){try{jsonpatch[_0x27a5('0x23')](_0x5ee7a1,_0x51605e,!![]);}catch(_0x424e3c){return BPromise[_0x27a5('0x24')](_0x424e3c);}return _0x5ee7a1[_0x27a5('0x25')]();};}function saveUpdates(_0x5b7313,_0x188b95){return function(_0x49e862){if(_0x49e862){return _0x49e862[_0x27a5('0x26')](_0x5b7313)['then'](function(_0x38075e){return _0x38075e;});}return null;};}function removeEntity(_0x2158b2,_0x34b5fc){return function(_0x49d26c){if(_0x49d26c){return _0x49d26c['destroy']()['then'](function(){_0x2158b2[_0x27a5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25266d,_0x3b2ca2){return function(_0xe90f99){if(!_0xe90f99){_0x25266d[_0x27a5('0x27')](0x194);}return _0xe90f99;};}function handleError(_0x45a33e,_0x1df29d){_0x1df29d=_0x1df29d||0x1f4;return function(_0x6cdab1){logger[_0x27a5('0x28')](_0x6cdab1[_0x27a5('0x29')]);if(_0x6cdab1[_0x27a5('0x2a')]){delete _0x6cdab1[_0x27a5('0x2a')];}_0x45a33e[_0x27a5('0x1b')](_0x1df29d)[_0x27a5('0x2b')](_0x6cdab1);};}function getInteractionUsers(_0x4f8145,_0x40cbef){return new BPromise(function(_0x433740,_0x45417e){try{if(_0x40cbef[_0x4f8145['id']]){_0x4f8145[_0x27a5('0x2c')]=_['map'](_0x40cbef[_0x4f8145['id']],function(_0x40e7ce){return{'id':_0x40e7ce['id'],'fullname':_0x40e7ce[_0x27a5('0x2d')]};});}}catch(_0x3e8904){_0x45417e(_0x3e8904);}_0x433740(_0x4f8145);});}function getInteractionTags(_0x2e8801,_0x98dde8){return new BPromise(function(_0x2b87c1,_0x13793c){try{if(_0x2e8801[_0x27a5('0x2e')]){_0x2e8801[_0x27a5('0x2f')]=[];_0x2e8801[_0x27a5('0x2e')]['split'](',')[_0x27a5('0x30')](function(_0x3bb59f){_0x2e8801['Tags']['push'](_0x98dde8[_0x3bb59f]);});}delete _0x2e8801[_0x27a5('0x2e')];}catch(_0x537da0){_0x13793c(_0x537da0);}_0x2b87c1(_0x2e8801);});}function updateWhatsappInteraction(_0xe22fc8,_0x25c871,_0x335829){return new BPromise(function(_0x7a51a6,_0xefa1b6){return getInteractionUsers(_0xe22fc8,_0x335829)[_0x27a5('0x31')](function(_0xac327c){return getInteractionTags(_0xac327c,_0x25c871);})[_0x27a5('0x31')](function(_0x25c42f){return getStateInteraction(_0x25c42f);})[_0x27a5('0x31')](function(_0x97cb27){_0x7a51a6(_0x97cb27);})['catch'](function(_0x1ab750){_0xefa1b6(_0x1ab750);});});}function getStateInteraction(_0x5518b4){return new BPromise(function(_0xbfc942){_0x5518b4[_0x27a5('0x32')]=0x0;_0x5518b4[_0x27a5('0x33')]=0x0;_0x5518b4['answered']=0x0;_0x5518b4[_0x27a5('0x34')]=0x0;_0x5518b4['total']=0x0;if(!_0x5518b4[_0x27a5('0x35')]&&!_0x5518b4[_0x27a5('0x36')]){_0x5518b4['waiting']+=0x1;}if(!_0x5518b4['closed']&&_0x5518b4[_0x27a5('0x36')]){_0x5518b4[_0x27a5('0x33')]+=0x1;if(_0x5518b4['waiting']){_0x5518b4['waiting']-=0x1;}}if(_0x5518b4[_0x27a5('0x35')]&&_0x5518b4[_0x27a5('0x36')]){_0x5518b4[_0x27a5('0x37')]+=0x1;if(_0x5518b4['talking']){_0x5518b4[_0x27a5('0x33')]-=0x1;}}if(_0x5518b4[_0x27a5('0x35')]&&!_0x5518b4[_0x27a5('0x36')]){_0x5518b4[_0x27a5('0x34')]+=0x1;if(_0x5518b4[_0x27a5('0x32')]){_0x5518b4['waiting']-=0x1;}}_0x5518b4['total']+=0x1;_0xbfc942(_0x5518b4);});}exports[_0x27a5('0x38')]=function(_0x106eb2,_0x23a787){var _0xdedbbb={},_0xdf0df9={},_0x5cac0f={'count':0x0,'rows':[]};var _0x4615ab=_[_0x27a5('0x39')](db[_0x27a5('0x3a')][_0x27a5('0x3b')],function(_0x5a4f42){return{'name':_0x5a4f42[_0x27a5('0x3c')],'type':_0x5a4f42[_0x27a5('0x3d')][_0x27a5('0x3e')]};});_0xdf0df9[_0x27a5('0x3f')]=_[_0x27a5('0x39')](_0x4615ab,_0x27a5('0x2a'));_0xdf0df9['query']=_['keys'](_0x106eb2[_0x27a5('0x40')]);_0xdf0df9[_0x27a5('0x41')]=_['intersection'](_0xdf0df9[_0x27a5('0x3f')],_0xdf0df9[_0x27a5('0x40')]);_0xdedbbb[_0x27a5('0x42')]=_[_0x27a5('0x43')](_0xdf0df9[_0x27a5('0x3f')],qs[_0x27a5('0x44')](_0x106eb2[_0x27a5('0x40')][_0x27a5('0x44')]));_0xdedbbb[_0x27a5('0x42')]=_0xdedbbb[_0x27a5('0x42')]['length']?_0xdedbbb[_0x27a5('0x42')]:_0xdf0df9[_0x27a5('0x3f')];if(!_0x106eb2[_0x27a5('0x40')][_0x27a5('0x45')](_0x27a5('0x46'))){_0xdedbbb[_0x27a5('0x20')]=qs[_0x27a5('0x20')](_0x106eb2[_0x27a5('0x40')][_0x27a5('0x20')]);_0xdedbbb[_0x27a5('0x1e')]=qs[_0x27a5('0x1e')](_0x106eb2['query'][_0x27a5('0x1e')]);}_0xdedbbb['order']=qs[_0x27a5('0x47')](_0x106eb2[_0x27a5('0x40')][_0x27a5('0x47')]);_0xdedbbb['where']=qs['filters'](_[_0x27a5('0x48')](_0x106eb2['query'],_0xdf0df9[_0x27a5('0x41')]),_0x4615ab);var _0x42d0ce=[];var _0x3550dd=squel[_0x27a5('0x49')]()[_0x27a5('0x4a')]('id')[_0x27a5('0x4a')](_0x27a5('0x2a'))[_0x27a5('0x4a')](_0x27a5('0x4b'))['from'](_0x27a5('0x4c'));var _0x2fd347=squel[_0x27a5('0x49')]()[_0x27a5('0x4a')]('u.id')[_0x27a5('0x4a')](_0x27a5('0x4d'))[_0x27a5('0x4a')](_0x27a5('0x4e'))[_0x27a5('0x4f')](_0x27a5('0x50'),'ui')[_0x27a5('0x51')]('users','u',_0x27a5('0x52'));var _0x140ee6=squel[_0x27a5('0x49')]()[_0x27a5('0x4f')](_0x27a5('0x53'),'i')['left_join'](_0x27a5('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x27a5('0x55'),'o',_0x27a5('0x56'))['left_join'](_0x27a5('0x57'),'a',_0x27a5('0x58'))[_0x27a5('0x51')](_0x27a5('0x59'),'me',_0x27a5('0x5a'))[_0x27a5('0x51')]('whatsapp_interaction_has_tags','it',_0x27a5('0x5b'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x8f4834=squel[_0x27a5('0x5c')]();var _0x3372c1=[];var _0x32eb25=squel[_0x27a5('0x5c')]();var _0x2ab0a1;if(_0x106eb2[_0x27a5('0x40')][_0x27a5('0x5d')]){_0x2ab0a1=as[_0x27a5('0x5e')](_0x106eb2[_0x27a5('0x40')][_0x27a5('0x5d')]);var _0x422fec=_0x2ab0a1['sqlOperator'];for(var _0x3a3ea9=0x0;_0x3a3ea9<_0x2ab0a1[_0x27a5('0x5f')][_0x27a5('0x60')];_0x3a3ea9++){var _0x48d065=_0x2ab0a1[_0x27a5('0x5f')][_0x3a3ea9];var _0xee1528='i';var _0x567b41=_[_0x27a5('0x61')](_0x4615ab,[_0x27a5('0x2a'),_0x48d065[_0x27a5('0x4a')]]);if(!_0x567b41){switch(_0x48d065[_0x27a5('0x4a')]){case _0x27a5('0x62'):if(_0x48d065[_0x27a5('0x63')]==0x1){_0x140ee6['having']('`'+_0x48d065['field']+_0x27a5('0x64'));}else{_0x140ee6[_0x27a5('0x65')]('`'+_0x48d065[_0x27a5('0x4a')]+'`\x20>\x200');}break;case _0x27a5('0x66'):if(_0x48d065[_0x27a5('0x67')]===_0x27a5('0x68')){if(_0x48d065[_0x27a5('0x63')][_0x27a5('0x69')]('\x20')[_0x27a5('0x60')]>0x1){_0x8f4834[_0x422fec](_0x27a5('0x6a'),qs[_0x27a5('0x6b')](_0x48d065['value']),null);}else{var _0x3f89b7='%'+_0x48d065[_0x27a5('0x63')]+'%';_0x8f4834[_0x422fec](_0x27a5('0x6c'),_0x3f89b7,_0x3f89b7,_0x3f89b7);}}else{_0x567b41=_['find'](_0x4615ab,['name',_0x27a5('0x6d')]);_0x48d065['field']=_0x27a5('0x6d');_0x555062=as[_0x27a5('0x6e')](_0xee1528,_0x567b41[_0x27a5('0x3d')],_0x48d065);_0x8f4834[_0x422fec](_0x555062['text'],_0x555062[_0x27a5('0x63')][_0x27a5('0x6f')],_0x555062[_0x27a5('0x63')][_0x27a5('0x1c')]);}break;case _0x27a5('0x70'):var _0x23af60=_0x48d065['value'][_0x27a5('0x69')](',')[_0x27a5('0x39')](function(_0x20f0d6){return Number(_0x20f0d6);});_0x23af60[_0x27a5('0x30')](function(_0x4a3dd4){_0x32eb25['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a3dd4+',%');});_0x3372c1=_[_0x27a5('0x71')](_0x3372c1,_0x23af60);break;case'User':if(_0x48d065[_0x27a5('0x67')]===_0x27a5('0x68')){_0x8f4834[_0x422fec]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x48d065['value']+'%',null);}else{_0x567b41=_[_0x27a5('0x61')](_0x4615ab,[_0x27a5('0x2a'),_0x27a5('0x36')]);_0x48d065[_0x27a5('0x4a')]=_0x27a5('0x36');_0x555062=as[_0x27a5('0x6e')](_0xee1528,_0x567b41[_0x27a5('0x3d')],_0x48d065);_0x8f4834[_0x422fec](_0x555062[_0x27a5('0x72')],_0x555062['value'][_0x27a5('0x6f')],_0x555062['value'][_0x27a5('0x1c')]);}break;case'body':_0x555062=as[_0x27a5('0x6e')]('me',null,_0x48d065);_0x8f4834[_0x422fec](_0x555062[_0x27a5('0x72')],_0x555062[_0x27a5('0x63')][_0x27a5('0x6f')],_0x555062[_0x27a5('0x63')]['end']);break;}}else{var _0x555062=as['buildExpression'](_0xee1528,_0x567b41['type'],_0x48d065);_0x8f4834[_0x422fec](_0x555062[_0x27a5('0x72')],_0x555062[_0x27a5('0x63')][_0x27a5('0x6f')],_0x555062[_0x27a5('0x63')][_0x27a5('0x1c')]);}}}else{var _0x4ad71c=_(_0x106eb2[_0x27a5('0x40')])[_0x27a5('0x73')]()[_0x27a5('0x39')](function(_0x2c6fd8){return _[_0x27a5('0x74')](_0x4615ab,[_0x27a5('0x2a'),_0x2c6fd8])?_0x2c6fd8:undefined;})['compact']()[_0x27a5('0x63')]();if(!_[_0x27a5('0x75')](_0x4ad71c)){_0x4ad71c[_0x27a5('0x30')](function(_0x5448b0){if(_0x5448b0===_0x27a5('0x76')){_0x140ee6[_0x27a5('0x77')](_0x27a5('0x78'),[][_0x27a5('0x79')](_0x106eb2[_0x27a5('0x40')][_0x5448b0]));}else if(_0x5448b0===_0x27a5('0x7a')){var _0x3cc769=JSON['parse'](_0x106eb2[_0x27a5('0x40')][_0x5448b0])[_0x27a5('0x7b')];var _0x856f12=JSON['parse'](_0x106eb2[_0x27a5('0x40')][_0x5448b0])[_0x27a5('0x7c')];_0x140ee6[_0x27a5('0x77')](_0x27a5('0x7d'),_0x3cc769,_0x856f12);}else{if(_0x106eb2['query'][_0x5448b0]===_0x27a5('0x7e')){_0x140ee6[_0x27a5('0x77')]('i.'+_0x5448b0+_0x27a5('0x7f'));}else{_0x140ee6[_0x27a5('0x77')]('i.'+_0x5448b0+_0x27a5('0x80'),_0x106eb2['query'][_0x5448b0]);}}});}if(_0x106eb2['query'][_0x27a5('0x81')]){if(_0x106eb2[_0x27a5('0x40')]['read']==0x1){_0x140ee6[_0x27a5('0x65')](_0x27a5('0x82'));}else{_0x140ee6[_0x27a5('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x106eb2[_0x27a5('0x40')]['tag']){_0x3372c1=_[_0x27a5('0x83')](_0x106eb2[_0x27a5('0x40')][_0x27a5('0x84')])?_0x106eb2[_0x27a5('0x40')][_0x27a5('0x84')]:new Array(_0x106eb2[_0x27a5('0x40')]['tag']);_0x3372c1['forEach'](function(_0x58718c){_0x32eb25['or'](_0x27a5('0x85'),'%,'+_0x58718c+',%');});}if(_0x106eb2['query'][_0x27a5('0x86')]){var _0x575610=_0x106eb2[_0x27a5('0x40')][_0x27a5('0x86')]['replace']('\x5c','\x5c\x5c')[_0x27a5('0x87')](/'/g,'\x27\x27');if(qs[_0x27a5('0x88')](_0x575610)){_0x8f4834['or']('i.id\x20LIKE\x20?',_0x575610+'%')['or'](_0x27a5('0x89'),_0x575610+'%');}else{_0x8f4834['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x27a5('0x6b')](_0x575610))['or'](_0x27a5('0x8a'),_0x575610+'%');}}}_0x140ee6[_0x27a5('0x77')](_0x8f4834);_0x140ee6[_0x27a5('0x8b')]('i.id');var _0x50785a={'type':db[_0x27a5('0x8c')][_0x27a5('0x8d')]['SELECT'],'raw':!![]};var _0x1dce71=_0x140ee6[_0x27a5('0x8e')]();_0x1dce71['field']('i.id');_0x1dce71[_0x27a5('0x4a')](_0x27a5('0x8f'),_0x27a5('0x62'));if(_0xdedbbb[_0x27a5('0x90')]){_0xdedbbb[_0x27a5('0x90')][_0x27a5('0x30')](function(_0x5dd728){var _0x402b33=_0x5dd728[0x0]===_0x27a5('0x91')?_0x5dd728[0x0]:'i.'+_0x5dd728[0x0];_0x140ee6[_0x27a5('0x90')](_0x402b33,_0x5dd728[0x1]===_0x27a5('0x92')?![]:!![]);});}if(!_[_0x27a5('0x75')](_0x3372c1)){_0x140ee6['having'](_0x32eb25);_0x1dce71['where'](_0x27a5('0x93'),_0x3372c1);}BPromise['resolve']()[_0x27a5('0x31')](function(){if(!_0x2ab0a1){if(_0x106eb2['query']['WhatsappAccountId'])return;_0x1dce71[_0x27a5('0x77')](_0x27a5('0x94'));_0x140ee6[_0x27a5('0x77')](_0x27a5('0x94'));return;}if(_0x106eb2[_0x27a5('0x95')][_0x27a5('0x96')]!==_0x27a5('0x97'))return;return _0x106eb2['user'][_0x27a5('0x98')]({'attributes':['id'],'raw':!![]})[_0x27a5('0x31')](function(_0x4d1e73){if(_[_0x27a5('0x75')](_0x4d1e73)){_0x1dce71[_0x27a5('0x77')](_0x27a5('0x99'));_0x140ee6[_0x27a5('0x77')](_0x27a5('0x99'));}else{_0x1dce71['where'](_0x27a5('0x78'),_[_0x27a5('0x39')](_0x4d1e73,'id'));_0x140ee6[_0x27a5('0x77')](_0x27a5('0x78'),_[_0x27a5('0x39')](_0x4d1e73,'id'));}});})['then'](function(){if(_0x106eb2['user'][_0x27a5('0x96')]==='agent'&&!_0x2ab0a1&&!_0x106eb2[_0x27a5('0x40')]['WhatsappAccountId'])return[];return db[_0x27a5('0x9a')][_0x27a5('0x40')](_0x1dce71[_0x27a5('0x9b')](),_0x50785a);})[_0x27a5('0x31')](function(_0x54fe7a){_0x5cac0f['count']=_0x54fe7a[_0x27a5('0x60')];if(_0x5cac0f['count']===0x0)return[];return db[_0x27a5('0x9a')][_0x27a5('0x40')](_0x3550dd[_0x27a5('0x9b')](),_0x50785a)[_0x27a5('0x31')](function(_0xc8a9ee){_0x42d0ce=_[_0x27a5('0x9c')](_0xc8a9ee,'id');_0x50785a=_[_0x27a5('0x9d')](_0x50785a,{'model':db[_0x27a5('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x106eb2[_0x27a5('0x40')]['fields']){_0xdedbbb[_0x27a5('0x42')]['forEach'](function(_0x5c94a1){_0x140ee6[_0x27a5('0x4a')]('i.'+_0x5c94a1);});}else{_0x140ee6[_0x27a5('0x4a')](_0x27a5('0x8f'),_0x27a5('0x62'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0x9e'),'Account.key');_0x140ee6[_0x27a5('0x4a')](_0x27a5('0x9f'),_0x27a5('0xa0'));_0x140ee6['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x27a5('0x91'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xa1'));_0x140ee6[_0x27a5('0x4a')]('c.firstName',_0x27a5('0xa2'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xa3'),_0x27a5('0xa4'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xa5'),_0x27a5('0xa6'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xa7'),'Contact.phone');_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xa8'),_0x27a5('0xa9'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xaa'),'Contact.fax');_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xab'),_0x27a5('0xac'));_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xad'),'Owner.internal');_0x140ee6[_0x27a5('0x4a')](_0x27a5('0xae'),'TagIds');}if(_0xdedbbb[_0x27a5('0x20')])_0x140ee6[_0x27a5('0x20')](_0xdedbbb['limit']);if(_0xdedbbb[_0x27a5('0x1e')])_0x140ee6[_0x27a5('0x1e')](_0xdedbbb[_0x27a5('0x1e')]);return db[_0x27a5('0x9a')]['query'](_0x140ee6[_0x27a5('0x9b')](),_0x50785a);})[_0x27a5('0x31')](function(_0x11419e){if(_0x11419e['length']>0x0)_0x2fd347[_0x27a5('0x77')](_0x27a5('0xaf'),_[_0x27a5('0x39')](_0x11419e,'id'));return db['sequelize']['query'](_0x2fd347[_0x27a5('0x9b')](),_0x50785a)[_0x27a5('0x31')](function(_0x337adc){var _0x2f5960=_['groupBy'](_0x337adc,_0x27a5('0xb0'));var _0x376420=[];_0x11419e['forEach'](function(_0x91d76){_0x376420[_0x27a5('0xb1')](updateWhatsappInteraction(_0x91d76,_0x42d0ce,_0x2f5960));});return BPromise['all'](_0x376420);});});})[_0x27a5('0x31')](function(_0x3d30b1){_0x5cac0f[_0x27a5('0xb2')]=_0x3d30b1;return _0x5cac0f;})[_0x27a5('0x31')](respondWithFilteredResult(_0x23a787,_0xdedbbb))[_0x27a5('0xb3')](handleError(_0x23a787,null));};exports['show']=function(_0x2b7dab,_0x4c8f96){var _0x417789={'raw':![],'where':{'id':_0x2b7dab['params']['id']}},_0x4972d6={};_0x4972d6[_0x27a5('0x3f')]=_['keys'](db[_0x27a5('0x3a')]['rawAttributes']);_0x4972d6[_0x27a5('0x40')]=_[_0x27a5('0x73')](_0x2b7dab['query']);_0x4972d6[_0x27a5('0x41')]=_[_0x27a5('0x43')](_0x4972d6['model'],_0x4972d6[_0x27a5('0x40')]);_0x417789[_0x27a5('0x42')]=_[_0x27a5('0x43')](_0x4972d6[_0x27a5('0x3f')],qs[_0x27a5('0x44')](_0x2b7dab[_0x27a5('0x40')][_0x27a5('0x44')]));_0x417789[_0x27a5('0x42')]=_0x417789[_0x27a5('0x42')][_0x27a5('0x60')]?_0x417789[_0x27a5('0x42')]:_0x4972d6[_0x27a5('0x3f')];if(_0x2b7dab['query'][_0x27a5('0xb4')]){_0x417789[_0x27a5('0xb5')]=[{'all':!![]}];}_0x417789=_[_0x27a5('0x9d')]({},_0x417789,_0x2b7dab['options']);return db[_0x27a5('0x3a')][_0x27a5('0x61')](_0x417789)[_0x27a5('0x31')](handleEntityNotFound(_0x4c8f96,null))['then'](respondWithResult(_0x4c8f96,null))[_0x27a5('0xb3')](handleError(_0x4c8f96,null));};exports['create']=function(_0x89ff8b,_0x5a7c47){return db[_0x27a5('0x3a')]['create'](_0x89ff8b[_0x27a5('0xb6')],{})[_0x27a5('0x31')](respondWithResult(_0x5a7c47,0xc9))[_0x27a5('0xb3')](handleError(_0x5a7c47,null));};exports[_0x27a5('0x26')]=function(_0x182eb6,_0x2b2ebf){if(_0x182eb6[_0x27a5('0xb6')]['id']){delete _0x182eb6[_0x27a5('0xb6')]['id'];}return db['WhatsappInteraction'][_0x27a5('0x61')]({'where':{'id':_0x182eb6[_0x27a5('0xb7')]['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x2b2ebf,null))[_0x27a5('0x31')](saveUpdates(_0x182eb6['body'],null))[_0x27a5('0x31')](respondWithResult(_0x2b2ebf,null))[_0x27a5('0xb3')](handleError(_0x2b2ebf,null));};exports[_0x27a5('0xb8')]=function(_0xf03072,_0x50c26e){return db['WhatsappInteraction'][_0x27a5('0x61')]({'where':{'id':_0xf03072[_0x27a5('0xb7')]['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x50c26e,null))[_0x27a5('0x31')](removeEntity(_0x50c26e,null))['catch'](handleError(_0x50c26e,null));};exports[_0x27a5('0xb9')]=function(_0x1d06e9,_0x4497ae){return db[_0x27a5('0x3a')]['describe']()[_0x27a5('0x31')](respondWithResult(_0x4497ae,null))[_0x27a5('0xb3')](handleError(_0x4497ae,null));};exports[_0x27a5('0xba')]=function(_0x441257,_0x5399eb,_0xa64951){return db[_0x27a5('0xbb')]['find']({'where':{'id':_0x441257[_0x27a5('0xb7')]['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x5399eb,null))[_0x27a5('0x31')](function(_0x35b060){if(_0x35b060){return _0x35b060[_0x27a5('0xba')](_0x441257[_0x27a5('0xb6')][_0x27a5('0xbc')],_[_0x27a5('0xbd')](_0x441257[_0x27a5('0xb6')],['ids','id'])||{});}})[_0x27a5('0x31')](respondWithResult(_0x5399eb,null))[_0x27a5('0xb3')](handleError(_0x5399eb,null));};exports[_0x27a5('0xbe')]=function(_0x405e93,_0x5799d5,_0x58ccd3){var _0x39a7e0={'raw':![],'where':{}};var _0x3b84f8={};var _0x4a2346={'count':0x0,'rows':[]};return db[_0x27a5('0x3a')][_0x27a5('0xbf')]({'where':{'id':_0x405e93['params']['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x5799d5,null))[_0x27a5('0x31')](function(_0x3f3242){if(_0x3f3242){_0x3b84f8[_0x27a5('0x3f')]=_[_0x27a5('0x73')](db['WhatsappMessage'][_0x27a5('0x3b')]);_0x3b84f8[_0x27a5('0x40')]=_[_0x27a5('0x73')](_0x405e93[_0x27a5('0x40')]);_0x3b84f8[_0x27a5('0x41')]=_[_0x27a5('0x43')](_0x3b84f8[_0x27a5('0x3f')],_0x3b84f8[_0x27a5('0x40')]);_0x39a7e0[_0x27a5('0x42')]=_[_0x27a5('0x43')](_0x3b84f8[_0x27a5('0x3f')],qs[_0x27a5('0x44')](_0x405e93[_0x27a5('0x40')][_0x27a5('0x44')]));_0x39a7e0[_0x27a5('0x42')]=_0x39a7e0[_0x27a5('0x42')][_0x27a5('0x60')]?_0x39a7e0['attributes']:_0x3b84f8[_0x27a5('0x3f')];if(!_0x405e93['query'][_0x27a5('0x45')]('nolimit')){_0x39a7e0['limit']=qs['limit'](_0x405e93[_0x27a5('0x40')][_0x27a5('0x20')]);_0x39a7e0['offset']=qs['offset'](_0x405e93['query'][_0x27a5('0x1e')]);}_0x39a7e0[_0x27a5('0x90')]=qs[_0x27a5('0x47')](_0x405e93[_0x27a5('0x40')]['sort']);_0x39a7e0[_0x27a5('0x77')]=qs[_0x27a5('0x41')](_[_0x27a5('0x48')](_0x405e93[_0x27a5('0x40')],_0x3b84f8[_0x27a5('0x41')]));_0x39a7e0[_0x27a5('0x77')]['WhatsappInteractionId']=_0x3f3242['id'];if(_0x405e93['query'][_0x27a5('0x86')]){_0x39a7e0[_0x27a5('0x77')]=_[_0x27a5('0x9d')](_0x39a7e0['where'],{'$or':_[_0x27a5('0x39')](_0x39a7e0[_0x27a5('0x42')],function(_0x73ccde){var _0x2ff3c0={};_0x2ff3c0[_0x73ccde]={'$like':'%'+_0x405e93[_0x27a5('0x40')]['filter']+'%'};return _0x2ff3c0;})});}if(_0x405e93[_0x27a5('0x40')][_0x27a5('0x7b')]){var _0x1b0ae7=_0x405e93[_0x27a5('0x40')][_0x27a5('0x7b')]['split'](',');var _0x3d3398={};_0x3d3398[_0x1b0ae7[0x0]]={'$gte':moment(_0x1b0ae7[0x1])[_0x27a5('0xc0')](_0x27a5('0xc1'))};_0x39a7e0[_0x27a5('0x77')]=_[_0x27a5('0x9d')](_0x39a7e0[_0x27a5('0x77')],_0x3d3398);}_0x39a7e0=_['merge']({},_0x39a7e0,_0x405e93[_0x27a5('0xc2')]);return db[_0x27a5('0xbb')][_0x27a5('0x21')]({'where':_0x39a7e0[_0x27a5('0x77')]})[_0x27a5('0x31')](function(_0x20e8d7){_0x4a2346[_0x27a5('0x21')]=_0x20e8d7;if(_0x405e93[_0x27a5('0x40')][_0x27a5('0xb4')]){_0x39a7e0[_0x27a5('0xb5')]=[{'all':!![]}];}return db[_0x27a5('0xbb')][_0x27a5('0xc3')](_0x39a7e0);})[_0x27a5('0x31')](function(_0x31c9be){_0x4a2346[_0x27a5('0xb2')]=_0x31c9be;return _0x4a2346;});}})[_0x27a5('0x31')](respondWithFilteredResult(_0x5799d5,_0x39a7e0))[_0x27a5('0xb3')](handleError(_0x5799d5,null));};exports[_0x27a5('0xc4')]=function(_0x5ec779,_0x36b32f,_0x58cde1){return db['WhatsappInteraction'][_0x27a5('0x61')]({'where':{'id':_0x5ec779[_0x27a5('0xb7')]['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x36b32f,null))[_0x27a5('0x31')](function(_0x4d076b){if(_0x4d076b){return _0x4d076b['setTags'](_0x5ec779[_0x27a5('0xb6')][_0x27a5('0xbc')],_[_0x27a5('0xbd')](_0x5ec779[_0x27a5('0xb6')],[_0x27a5('0xbc'),'id'])||{})[_0x27a5('0xc5')](function(){return db[_0x27a5('0x70')][_0x27a5('0xc3')]({'attributes':['id',_0x27a5('0x2a'),'color'],'where':{'id':_0x5ec779['body']['ids']}});})[_0x27a5('0x31')](function(_0x100f26){socket[_0x27a5('0xc6')](_0x27a5('0xc7'),{'id':Number(_0x5ec779[_0x27a5('0xb7')]['id']),'tags':_0x100f26||[]});return{'id':Number(_0x5ec779[_0x27a5('0xb7')]['id']),'tags':_0x100f26||[]};});}})['then'](respondWithResult(_0x36b32f,null))[_0x27a5('0xb3')](handleError(_0x36b32f,null));};exports[_0x27a5('0xc8')]=function(_0x2825b8,_0x4de252,_0x5ac8ef){return db['WhatsappInteraction'][_0x27a5('0x61')]({'where':{'id':_0x2825b8[_0x27a5('0xb7')]['id']}})[_0x27a5('0x31')](handleEntityNotFound(_0x4de252,null))[_0x27a5('0x31')](function(_0x47df08){if(_0x47df08){return _0x47df08[_0x27a5('0xc8')](_0x2825b8[_0x27a5('0x40')][_0x27a5('0xbc')]);}})[_0x27a5('0x31')](respondWithStatusCode(_0x4de252,null))[_0x27a5('0xb3')](handleError(_0x4de252,null));};exports[_0x27a5('0xc9')]=function(_0x12eefd,_0x348bf5){var _0x6dfc34=moment()[_0x27a5('0xca')]()[_0x27a5('0x9b')]();var _0x558b5=path[_0x27a5('0xcb')](config['root'],_0x27a5('0xcc'),_0x27a5('0xcd'),_0x27a5('0xce'));var _0x2ba160=path[_0x27a5('0xcb')](config[_0x27a5('0xcf')],_0x27a5('0xcc'),_0x27a5('0xcd'),_0x27a5('0xd0'));var _0x3cd2ea=path[_0x27a5('0xcb')](_0x558b5,_0x6dfc34);var _0x37de41=util['format'](_0x27a5('0xd1'),_0x12eefd[_0x27a5('0xb7')]['id'],_0x6dfc34);var _0x5c14e7=path['join'](_0x558b5,_0x37de41);var _0x1c1a7b=[];_0x1c1a7b[_0x27a5('0xb1')]({'model':db[_0x27a5('0xd2')],'as':'User','attributes':['id',_0x27a5('0x2d')],'raw':!![]});_0x1c1a7b[_0x27a5('0xb1')]({'model':db[_0x27a5('0xd3')],'as':'Contact','attributes':['id',_0x27a5('0xd4'),_0x27a5('0xd5')],'raw':!![]});if(_0x12eefd['query']['attachments']){_0x1c1a7b[_0x27a5('0xb1')]({'model':db[_0x27a5('0xd6')],'as':'Attachment','raw':!![]});}var _0x35ddc0=[{'model':db['WhatsappMessage'],'as':_0x27a5('0xd7'),'attributes':['id','body','createdAt',_0x27a5('0xd8'),_0x27a5('0xd9'),_0x27a5('0x81')],'include':_0x1c1a7b}];_0x35ddc0[_0x27a5('0xb1')]({'model':db[_0x27a5('0xda')],'as':_0x27a5('0xdb'),'attributes':['id','name']});_0x35ddc0['push']({'model':db[_0x27a5('0xd2')],'as':_0x27a5('0xdc'),'attributes':['id','fullname']});return db[_0x27a5('0x3a')][_0x27a5('0x61')]({'where':{'id':_0x12eefd[_0x27a5('0xb7')]['id']},'include':_0x35ddc0})[_0x27a5('0x31')](handleEntityNotFound(_0x348bf5,null))['then'](function(_0x497c1f){if(_0x497c1f){var _0x35bc5f=_0x497c1f[_0x27a5('0xdd')]({'plain':!![]});fs[_0x27a5('0xde')](_0x3cd2ea);var _0x597b74={'channel':'Whatsapp','account':_0x35bc5f[_0x27a5('0xdb')][_0x27a5('0x2a')],'agent':_0x35bc5f[_0x27a5('0xdc')]?_0x35bc5f[_0x27a5('0xdc')][_0x27a5('0x2d')]:'N.A.','createdAt':moment(_0x35bc5f[_0x27a5('0x7a')])['format'](_0x27a5('0xc1'))[_0x27a5('0x9b')](),'closedAt':_0x35bc5f[_0x27a5('0x35')]?moment(_0x35bc5f[_0x27a5('0xdf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x27a5('0x9b')]():'','disposition':_0x35bc5f['disposition'],'messages':_(_0x35bc5f[_0x27a5('0xd7')])['filter']({'secret':![]})[_0x27a5('0x39')](function(_0x2278e5){if(_0x2278e5[_0x27a5('0xd6')]){var _0x2280a3=path[_0x27a5('0xcb')](_0x2ba160,_0x2278e5[_0x27a5('0xd6')][_0x27a5('0xe0')]);if(fs['existsSync'](_0x2280a3)){fs[_0x27a5('0xe1')](_0x2280a3)['pipe'](fs[_0x27a5('0xe2')](path['join'](_0x3cd2ea,_0x2278e5[_0x27a5('0xd6')][_0x27a5('0xe0')])));}}return{'date':moment(_0x2278e5[_0x27a5('0x7a')])['format'](_0x27a5('0xc1'))[_0x27a5('0x9b')](),'sender':_0x2278e5['direction']===_0x27a5('0xe3')?_0x2278e5[_0x27a5('0xd2')]?_0x2278e5[_0x27a5('0xd2')][_0x27a5('0x2d')]:_0x27a5('0xe4'):_0x2278e5[_0x27a5('0x66')][_0x27a5('0xd4')]+(_0x2278e5[_0x27a5('0x66')][_0x27a5('0xd5')]?'\x20'+_0x2278e5[_0x27a5('0x66')][_0x27a5('0xd5')]:''),'body':_0x2278e5[_0x27a5('0xd6')]?_0x2278e5[_0x27a5('0xd6')][_0x27a5('0xe0')]:_0x2278e5['body'],'direction':_0x2278e5[_0x27a5('0xd8')]===_0x27a5('0xe3')?'A':'C','secret':_0x2278e5[_0x27a5('0xd9')],'read':_0x2278e5['read'],'attachment':_0x2278e5[_0x27a5('0xd6')]};})[_0x27a5('0x63')]()};return ejs[_0x27a5('0xe5')](path[_0x27a5('0xcb')](config[_0x27a5('0xcf')],_0x27a5('0xcc'),_0x27a5('0xe6'),_0x27a5('0xe7')),{'interaction':_0x597b74})[_0x27a5('0x31')](function(_0x1335bc){var _0x119ec5=path[_0x27a5('0xcb')](_0x3cd2ea,_0x27a5('0xe8')+_0x35bc5f['id']+'-'+_0x6dfc34+_0x27a5('0xe9'));var _0x185e73={'path':_0x119ec5,'channel':'Whatsapp','interactionId':_0x35bc5f['id']};return pdf[_0x27a5('0xea')](_0x1335bc,_0x185e73);})[_0x27a5('0x31')](function(){return new BPromise(function(_0x3f6113,_0x23286d){zipdir(_0x3cd2ea,{'saveTo':_0x5c14e7},function(_0x5b100e,_0x305c39){if(_0x5b100e)return _0x23286d(_0x5b100e);return _0x3f6113(_0x305c39);});})['then'](function(){return new BPromise(function(_0x338483,_0x474407){rimraf(_0x3cd2ea,function(_0x5b45e5){if(_0x5b45e5)_0x474407(_0x5b45e5);return _0x338483();});});})['then'](function(){return _0x348bf5[_0x27a5('0xc9')](_0x5c14e7,_0x37de41,function(_0x2feb76){if(_0x2feb76){console[_0x27a5('0xeb')](_0x27a5('0xec'),_0x2feb76);}else{fs[_0x27a5('0xed')](_0x5c14e7);}});});});}else{return _0x348bf5[_0x27a5('0x27')](0xc8);}})['catch'](handleError(_0x348bf5,null));}; \ No newline at end of file +var _0x5713=['../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','map','fullname','TagIds','split','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','select','field','color','from','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','rows','show','includeAll','include','options','create','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','pick','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','Contact','firstName','Attachment','Messages','direction','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closedAt','createReadStream','pipe','createWriteStream','basename','out','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x5713,0x1c7));var _0x3571=function(_0x492319,_0x4edcc3){_0x492319=_0x492319-0x0;var _0x3b43dd=_0x5713[_0x492319];return _0x3b43dd;};'use strict';var emlformat=require(_0x3571('0x0'));var rimraf=require(_0x3571('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3571('0x2'));var rp=require('request-promise');var moment=require(_0x3571('0x3'));var BPromise=require(_0x3571('0x4'));var Mustache=require(_0x3571('0x5'));var util=require(_0x3571('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3571('0x7'));var ejs=require(_0x3571('0x8'));var fs=require('fs');var fs_extra=require(_0x3571('0x9'));var _=require(_0x3571('0xa'));var squel=require(_0x3571('0xb'));var crypto=require(_0x3571('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3571('0xd'));var toCsv=require(_0x3571('0x7'));var querystring=require(_0x3571('0xe'));var Papa=require(_0x3571('0xf'));var Redis=require(_0x3571('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3571('0x11'));var pdf=require(_0x3571('0x12'));var hardwareService=require(_0x3571('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3571('0x14'));var db=require(_0x3571('0x15'))['db'];config[_0x3571('0x16')]=_[_0x3571('0x17')](config[_0x3571('0x16')],{'host':_0x3571('0x18'),'port':0x18eb});var socket=require(_0x3571('0x19'))(new Redis(config[_0x3571('0x16')]));require(_0x3571('0x1a'))[_0x3571('0x1b')](socket);function respondWithStatusCode(_0x432441,_0x3a51ef){_0x3a51ef=_0x3a51ef||0xcc;return function(_0x17cf63){if(_0x17cf63){return _0x432441[_0x3571('0x1c')](_0x3a51ef);}return _0x432441[_0x3571('0x1d')](_0x3a51ef)[_0x3571('0x1e')]();};}function respondWithResult(_0x5da167,_0x5a27e1){_0x5a27e1=_0x5a27e1||0xc8;return function(_0x48c77e){if(_0x48c77e){return _0x5da167[_0x3571('0x1d')](_0x5a27e1)['json'](_0x48c77e);}};}function respondWithFilteredResult(_0x2b5b9c,_0x37881f){return function(_0x4b745a){if(_0x4b745a){var _0x22a418=typeof _0x37881f[_0x3571('0x1f')]===_0x3571('0x20')&&typeof _0x37881f[_0x3571('0x21')]===_0x3571('0x20');var _0x296346=_0x4b745a['count'];var _0x3d4248=_0x22a418?0x0:_0x37881f['offset'];var _0x1cdda8=_0x22a418?_0x4b745a[_0x3571('0x22')]:_0x37881f['offset']+_0x37881f['limit'];var _0x4c0670;if(_0x1cdda8>=_0x296346){_0x1cdda8=_0x296346;_0x4c0670=0xc8;}else{_0x4c0670=0xce;}_0x2b5b9c[_0x3571('0x1d')](_0x4c0670);return _0x2b5b9c[_0x3571('0x23')](_0x3571('0x24'),_0x3d4248+'-'+_0x1cdda8+'/'+_0x296346)[_0x3571('0x25')](_0x4b745a);}return null;};}function patchUpdates(_0x251cac){return function(_0x531dbe){try{jsonpatch[_0x3571('0x26')](_0x531dbe,_0x251cac,!![]);}catch(_0x36385c){return BPromise[_0x3571('0x27')](_0x36385c);}return _0x531dbe[_0x3571('0x28')]();};}function saveUpdates(_0x234cb5,_0x5c5750){return function(_0x2245e7){if(_0x2245e7){return _0x2245e7[_0x3571('0x29')](_0x234cb5)['then'](function(_0x46d4cd){return _0x46d4cd;});}return null;};}function removeEntity(_0x48a47b,_0xbcb9c1){return function(_0x374e41){if(_0x374e41){return _0x374e41[_0x3571('0x2a')]()[_0x3571('0x2b')](function(){_0x48a47b[_0x3571('0x1d')](0xcc)[_0x3571('0x1e')]();});}};}function handleEntityNotFound(_0x400560,_0x4cbaae){return function(_0x40db97){if(!_0x40db97){_0x400560[_0x3571('0x1c')](0x194);}return _0x40db97;};}function handleError(_0x7341f0,_0x4fbe35){_0x4fbe35=_0x4fbe35||0x1f4;return function(_0x5eded6){logger['error'](_0x5eded6[_0x3571('0x2c')]);if(_0x5eded6['name']){delete _0x5eded6[_0x3571('0x2d')];}_0x7341f0[_0x3571('0x1d')](_0x4fbe35)[_0x3571('0x2e')](_0x5eded6);};}function getInteractionUsers(_0x56e865,_0x559a26){return new BPromise(function(_0x7c1c2a,_0x40eea0){try{if(_0x559a26[_0x56e865['id']]){_0x56e865['Users']=_[_0x3571('0x2f')](_0x559a26[_0x56e865['id']],function(_0x5eec88){return{'id':_0x5eec88['id'],'fullname':_0x5eec88[_0x3571('0x30')]};});}}catch(_0x4256ca){_0x40eea0(_0x4256ca);}_0x7c1c2a(_0x56e865);});}function getInteractionTags(_0x4205bd,_0x2d8a00){return new BPromise(function(_0x3864cc,_0x2ce9c7){try{if(_0x4205bd[_0x3571('0x31')]){_0x4205bd['Tags']=[];_0x4205bd[_0x3571('0x31')][_0x3571('0x32')](',')[_0x3571('0x33')](function(_0x2202fa){_0x4205bd['Tags'][_0x3571('0x34')](_0x2d8a00[_0x2202fa]);});}delete _0x4205bd['TagIds'];}catch(_0xc29a25){_0x2ce9c7(_0xc29a25);}_0x3864cc(_0x4205bd);});}function updateWhatsappInteraction(_0x16c5a0,_0x3bd657,_0x2328ec){return new BPromise(function(_0x1091d5,_0x59d3e2){return getInteractionUsers(_0x16c5a0,_0x2328ec)['then'](function(_0x525842){return getInteractionTags(_0x525842,_0x3bd657);})['then'](function(_0x13339b){return getStateInteraction(_0x13339b);})['then'](function(_0x5fad2d){_0x1091d5(_0x5fad2d);})[_0x3571('0x35')](function(_0xa0d2d3){_0x59d3e2(_0xa0d2d3);});});}function getStateInteraction(_0x3dd8d3){return new BPromise(function(_0x10fa1e){_0x3dd8d3[_0x3571('0x36')]=0x0;_0x3dd8d3[_0x3571('0x37')]=0x0;_0x3dd8d3['answered']=0x0;_0x3dd8d3[_0x3571('0x38')]=0x0;_0x3dd8d3[_0x3571('0x39')]=0x0;if(!_0x3dd8d3[_0x3571('0x3a')]&&!_0x3dd8d3[_0x3571('0x3b')]){_0x3dd8d3[_0x3571('0x36')]+=0x1;}if(!_0x3dd8d3['closed']&&_0x3dd8d3[_0x3571('0x3b')]){_0x3dd8d3[_0x3571('0x37')]+=0x1;if(_0x3dd8d3[_0x3571('0x36')]){_0x3dd8d3[_0x3571('0x36')]-=0x1;}}if(_0x3dd8d3[_0x3571('0x3a')]&&_0x3dd8d3['UserId']){_0x3dd8d3['answered']+=0x1;if(_0x3dd8d3['talking']){_0x3dd8d3[_0x3571('0x37')]-=0x1;}}if(_0x3dd8d3['closed']&&!_0x3dd8d3[_0x3571('0x3b')]){_0x3dd8d3[_0x3571('0x38')]+=0x1;if(_0x3dd8d3[_0x3571('0x36')]){_0x3dd8d3[_0x3571('0x36')]-=0x1;}}_0x3dd8d3[_0x3571('0x39')]+=0x1;_0x10fa1e(_0x3dd8d3);});}exports[_0x3571('0x3c')]=function(_0x54726b,_0x16f6ac){var _0x442c07={},_0x4bb65c={},_0x4a7d4e={'count':0x0,'rows':[]};var _0x428dd8=_[_0x3571('0x2f')](db[_0x3571('0x3d')][_0x3571('0x3e')],function(_0x26260e){return{'name':_0x26260e[_0x3571('0x3f')],'type':_0x26260e['type'][_0x3571('0x40')]};});_0x4bb65c[_0x3571('0x41')]=_[_0x3571('0x2f')](_0x428dd8,'name');_0x4bb65c[_0x3571('0x42')]=_['keys'](_0x54726b[_0x3571('0x42')]);_0x4bb65c['filters']=_[_0x3571('0x43')](_0x4bb65c[_0x3571('0x41')],_0x4bb65c[_0x3571('0x42')]);_0x442c07[_0x3571('0x44')]=_[_0x3571('0x43')](_0x4bb65c[_0x3571('0x41')],qs[_0x3571('0x45')](_0x54726b[_0x3571('0x42')]['fields']));_0x442c07['attributes']=_0x442c07[_0x3571('0x44')][_0x3571('0x46')]?_0x442c07[_0x3571('0x44')]:_0x4bb65c[_0x3571('0x41')];if(!_0x54726b[_0x3571('0x42')][_0x3571('0x47')](_0x3571('0x48'))){_0x442c07['limit']=qs['limit'](_0x54726b[_0x3571('0x42')][_0x3571('0x21')]);_0x442c07[_0x3571('0x1f')]=qs[_0x3571('0x1f')](_0x54726b[_0x3571('0x42')][_0x3571('0x1f')]);}_0x442c07[_0x3571('0x49')]=qs[_0x3571('0x4a')](_0x54726b[_0x3571('0x42')][_0x3571('0x4a')]);_0x442c07['where']=qs[_0x3571('0x4b')](_['pick'](_0x54726b[_0x3571('0x42')],_0x4bb65c[_0x3571('0x4b')]),_0x428dd8);var _0x5eb132=[];var _0x480a3f=squel[_0x3571('0x4c')]()[_0x3571('0x4d')]('id')[_0x3571('0x4d')](_0x3571('0x2d'))[_0x3571('0x4d')](_0x3571('0x4e'))[_0x3571('0x4f')]('tools_tags');var _0x3b37ff=squel['select']()[_0x3571('0x4d')]('u.id')[_0x3571('0x4d')](_0x3571('0x50'))['field'](_0x3571('0x51'))[_0x3571('0x4f')]('user_has_whatsapp_interactions','ui')['left_join'](_0x3571('0x52'),'u',_0x3571('0x53'));var _0x1cb1c3=squel[_0x3571('0x4c')]()[_0x3571('0x4f')](_0x3571('0x54'),'i')['left_join'](_0x3571('0x55'),'c',_0x3571('0x56'))[_0x3571('0x57')](_0x3571('0x52'),'o',_0x3571('0x58'))['left_join'](_0x3571('0x59'),'a',_0x3571('0x5a'))[_0x3571('0x57')](_0x3571('0x5b'),'me',_0x3571('0x5c'))[_0x3571('0x57')]('whatsapp_interaction_has_tags','it',_0x3571('0x5d'))[_0x3571('0x57')](_0x3571('0x5e'),'t','t.id\x20=\x20it.TagId');var _0xe0e247=squel[_0x3571('0x5f')]();var _0x1ffc54=[];var _0x141ca0=squel['expr']();var _0x5cb293;if(_0x54726b[_0x3571('0x42')][_0x3571('0x60')]){_0x5cb293=as[_0x3571('0x61')](_0x54726b[_0x3571('0x42')][_0x3571('0x60')]);var _0x5af9aa=_0x5cb293['sqlOperator'];for(var _0x5986fb=0x0;_0x5986fb<_0x5cb293[_0x3571('0x62')][_0x3571('0x46')];_0x5986fb++){var _0x1c9036=_0x5cb293[_0x3571('0x62')][_0x5986fb];var _0x3d6e18='i';var _0x3ddb40=_[_0x3571('0x63')](_0x428dd8,[_0x3571('0x2d'),_0x1c9036[_0x3571('0x4d')]]);if(!_0x3ddb40){switch(_0x1c9036['field']){case _0x3571('0x64'):if(_0x1c9036[_0x3571('0x65')]==0x1){_0x1cb1c3[_0x3571('0x66')]('`'+_0x1c9036[_0x3571('0x4d')]+_0x3571('0x67'));}else{_0x1cb1c3[_0x3571('0x66')]('`'+_0x1c9036['field']+'`\x20>\x200');}break;case'Contact':if(_0x1c9036[_0x3571('0x68')]===_0x3571('0x69')){if(_0x1c9036[_0x3571('0x65')][_0x3571('0x32')]('\x20')[_0x3571('0x46')]>0x1){_0xe0e247[_0x5af9aa](_0x3571('0x6a'),qs[_0x3571('0x6b')](_0x1c9036[_0x3571('0x65')]),null);}else{var _0x536c3b='%'+_0x1c9036[_0x3571('0x65')]+'%';_0xe0e247[_0x5af9aa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x536c3b,_0x536c3b,_0x536c3b);}}else{_0x3ddb40=_['find'](_0x428dd8,[_0x3571('0x2d'),'ContactId']);_0x1c9036['field']=_0x3571('0x6c');_0x53f57=as['buildExpression'](_0x3d6e18,_0x3ddb40[_0x3571('0x6d')],_0x1c9036);_0xe0e247[_0x5af9aa](_0x53f57[_0x3571('0x6e')],_0x53f57[_0x3571('0x65')][_0x3571('0x6f')],_0x53f57['value'][_0x3571('0x1e')]);}break;case'Tag':var _0x29d53a=_0x1c9036[_0x3571('0x65')][_0x3571('0x32')](',')[_0x3571('0x2f')](function(_0x466e22){return Number(_0x466e22);});_0x29d53a[_0x3571('0x33')](function(_0x42b5aa){_0x141ca0['or'](_0x3571('0x70'),'%,'+_0x42b5aa+',%');});_0x1ffc54=_[_0x3571('0x71')](_0x1ffc54,_0x29d53a);break;case _0x3571('0x72'):if(_0x1c9036['operator']===_0x3571('0x69')){_0xe0e247[_0x5af9aa](_0x3571('0x73'),'%'+_0x1c9036[_0x3571('0x65')]+'%',null);}else{_0x3ddb40=_[_0x3571('0x63')](_0x428dd8,[_0x3571('0x2d'),_0x3571('0x3b')]);_0x1c9036['field']=_0x3571('0x3b');_0x53f57=as['buildExpression'](_0x3d6e18,_0x3ddb40[_0x3571('0x6d')],_0x1c9036);_0xe0e247[_0x5af9aa](_0x53f57[_0x3571('0x6e')],_0x53f57[_0x3571('0x65')][_0x3571('0x6f')],_0x53f57[_0x3571('0x65')]['end']);}break;case _0x3571('0x74'):_0x53f57=as[_0x3571('0x75')]('me',null,_0x1c9036);_0xe0e247[_0x5af9aa](_0x53f57[_0x3571('0x6e')],_0x53f57['value'][_0x3571('0x6f')],_0x53f57[_0x3571('0x65')][_0x3571('0x1e')]);break;}}else{var _0x53f57=as['buildExpression'](_0x3d6e18,_0x3ddb40[_0x3571('0x6d')],_0x1c9036);_0xe0e247[_0x5af9aa](_0x53f57[_0x3571('0x6e')],_0x53f57[_0x3571('0x65')][_0x3571('0x6f')],_0x53f57[_0x3571('0x65')][_0x3571('0x1e')]);}}}else{var _0x74bff2=_(_0x54726b[_0x3571('0x42')])[_0x3571('0x76')]()[_0x3571('0x2f')](function(_0xcfeb0a){return _[_0x3571('0x77')](_0x428dd8,[_0x3571('0x2d'),_0xcfeb0a])?_0xcfeb0a:undefined;})[_0x3571('0x78')]()[_0x3571('0x65')]();if(!_['isEmpty'](_0x74bff2)){_0x74bff2[_0x3571('0x33')](function(_0x5cebbd){if(_0x5cebbd===_0x3571('0x79')){_0x1cb1c3[_0x3571('0x7a')](_0x3571('0x7b'),[][_0x3571('0x7c')](_0x54726b[_0x3571('0x42')][_0x5cebbd]));}else if(_0x5cebbd===_0x3571('0x7d')){var _0x5429ac=JSON['parse'](_0x54726b['query'][_0x5cebbd])['$gte'];var _0x53fd0c=JSON[_0x3571('0x7e')](_0x54726b['query'][_0x5cebbd])['$lte'];_0x1cb1c3[_0x3571('0x7a')](_0x3571('0x7f'),_0x5429ac,_0x53fd0c);}else{if(_0x54726b[_0x3571('0x42')][_0x5cebbd]===_0x3571('0x80')){_0x1cb1c3['where']('i.'+_0x5cebbd+_0x3571('0x81'));}else{_0x1cb1c3[_0x3571('0x7a')]('i.'+_0x5cebbd+'\x20=\x20?',_0x54726b['query'][_0x5cebbd]);}}});}if(_0x54726b[_0x3571('0x42')][_0x3571('0x82')]){if(_0x54726b[_0x3571('0x42')][_0x3571('0x82')]==0x1){_0x1cb1c3[_0x3571('0x66')](_0x3571('0x83'));}else{_0x1cb1c3['having'](_0x3571('0x84'));}}if(_0x54726b[_0x3571('0x42')]['tag']){_0x1ffc54=_['isArray'](_0x54726b['query'][_0x3571('0x85')])?_0x54726b[_0x3571('0x42')][_0x3571('0x85')]:new Array(_0x54726b[_0x3571('0x42')]['tag']);_0x1ffc54[_0x3571('0x33')](function(_0x4cb48b){_0x141ca0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4cb48b+',%');});}if(_0x54726b[_0x3571('0x42')]['filter']){var _0x38e4d1=_0x54726b[_0x3571('0x42')][_0x3571('0x86')][_0x3571('0x87')]('\x5c','\x5c\x5c')[_0x3571('0x87')](/'/g,'\x27\x27');if(qs[_0x3571('0x88')](_0x38e4d1)){_0xe0e247['or'](_0x3571('0x89'),_0x38e4d1+'%')['or'](_0x3571('0x8a'),_0x38e4d1+'%');}else{_0xe0e247['or'](_0x3571('0x8b'),qs['getFullTextValue'](_0x38e4d1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x38e4d1+'%');}}}_0x1cb1c3[_0x3571('0x7a')](_0xe0e247);_0x1cb1c3[_0x3571('0x8c')]('i.id');var _0x41d9ef={'type':db[_0x3571('0x8d')]['QueryTypes'][_0x3571('0x8e')],'raw':!![]};var _0x4d30db=_0x1cb1c3['clone']();_0x4d30db['field']('i.id');_0x4d30db[_0x3571('0x4d')](_0x3571('0x8f'),_0x3571('0x64'));if(_0x442c07[_0x3571('0x49')]){_0x442c07[_0x3571('0x49')][_0x3571('0x33')](function(_0x441d2c){var _0xd6e00e=_0x441d2c[0x0]==='contactName'?_0x441d2c[0x0]:'i.'+_0x441d2c[0x0];_0x1cb1c3[_0x3571('0x49')](_0xd6e00e,_0x441d2c[0x1]===_0x3571('0x90')?![]:!![]);});}if(!_[_0x3571('0x91')](_0x1ffc54)){_0x1cb1c3[_0x3571('0x66')](_0x141ca0);_0x4d30db['where'](_0x3571('0x92'),_0x1ffc54);}BPromise[_0x3571('0x93')]()[_0x3571('0x2b')](function(){if(!_0x5cb293){if(_0x54726b[_0x3571('0x42')]['WhatsappAccountId'])return;_0x4d30db[_0x3571('0x7a')](_0x3571('0x94'));_0x1cb1c3[_0x3571('0x7a')](_0x3571('0x94'));return;}if(_0x54726b[_0x3571('0x95')]['role']!==_0x3571('0x96'))return;return _0x54726b['user'][_0x3571('0x97')]({'attributes':['id'],'raw':!![]})[_0x3571('0x2b')](function(_0x1be481){if(_[_0x3571('0x91')](_0x1be481)){_0x4d30db['where'](_0x3571('0x98'));_0x1cb1c3[_0x3571('0x7a')](_0x3571('0x98'));}else{_0x4d30db['where'](_0x3571('0x7b'),_['map'](_0x1be481,'id'));_0x1cb1c3[_0x3571('0x7a')]('i.WhatsappAccountId\x20IN\x20?',_[_0x3571('0x2f')](_0x1be481,'id'));}});})[_0x3571('0x2b')](function(){if(_0x54726b['user']['role']==='agent'&&!_0x5cb293&&!_0x54726b[_0x3571('0x42')][_0x3571('0x79')])return[];return db['sequelize'][_0x3571('0x42')](_0x4d30db[_0x3571('0x99')](),_0x41d9ef);})[_0x3571('0x2b')](function(_0xf5aa8e){_0x4a7d4e['count']=_0xf5aa8e[_0x3571('0x46')];if(_0x4a7d4e['count']===0x0)return[];return db[_0x3571('0x9a')][_0x3571('0x42')](_0x480a3f[_0x3571('0x99')](),_0x41d9ef)[_0x3571('0x2b')](function(_0x1d1915){_0x5eb132=_[_0x3571('0x9b')](_0x1d1915,'id');_0x41d9ef=_[_0x3571('0x9c')](_0x41d9ef,{'model':db[_0x3571('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54726b[_0x3571('0x42')][_0x3571('0x45')]){_0x442c07[_0x3571('0x44')][_0x3571('0x33')](function(_0x4602e6){_0x1cb1c3[_0x3571('0x4d')]('i.'+_0x4602e6);});}else{_0x1cb1c3[_0x3571('0x4d')](_0x3571('0x8f'),_0x3571('0x64'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0x9d'),_0x3571('0x9e'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0x9f'),_0x3571('0xa0'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xa1'),_0x3571('0xa2'));_0x1cb1c3['field'](_0x3571('0xa3'));_0x1cb1c3['field'](_0x3571('0xa4'),_0x3571('0xa5'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xa6'),_0x3571('0xa7'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xa8'),_0x3571('0xa9'));_0x1cb1c3['field']('c.phone',_0x3571('0xaa'));_0x1cb1c3[_0x3571('0x4d')]('c.mobile',_0x3571('0xab'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xac'),_0x3571('0xad'));_0x1cb1c3[_0x3571('0x4d')]('o.fullname','Owner.fullname');_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xae'),_0x3571('0xaf'));_0x1cb1c3[_0x3571('0x4d')](_0x3571('0xb0'),'TagIds');}if(_0x442c07[_0x3571('0x21')])_0x1cb1c3['limit'](_0x442c07[_0x3571('0x21')]);if(_0x442c07[_0x3571('0x1f')])_0x1cb1c3['offset'](_0x442c07[_0x3571('0x1f')]);return db[_0x3571('0x9a')]['query'](_0x1cb1c3[_0x3571('0x99')](),_0x41d9ef);})[_0x3571('0x2b')](function(_0x380e26){if(_0x380e26['length']>0x0)_0x3b37ff[_0x3571('0x7a')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x3571('0x2f')](_0x380e26,'id'));return db[_0x3571('0x9a')]['query'](_0x3b37ff['toString'](),_0x41d9ef)[_0x3571('0x2b')](function(_0x49509d){var _0x1a8d3b=_['groupBy'](_0x49509d,'WhatsappInteractionId');var _0x13ba2c=[];_0x380e26[_0x3571('0x33')](function(_0x1d3404){_0x13ba2c[_0x3571('0x34')](updateWhatsappInteraction(_0x1d3404,_0x5eb132,_0x1a8d3b));});return BPromise[_0x3571('0xb1')](_0x13ba2c);});});})['then'](function(_0x3d1c44){_0x4a7d4e[_0x3571('0xb2')]=_0x3d1c44;return _0x4a7d4e;})[_0x3571('0x2b')](respondWithFilteredResult(_0x16f6ac,_0x442c07))[_0x3571('0x35')](handleError(_0x16f6ac,null));};exports[_0x3571('0xb3')]=function(_0x132f44,_0x3c0a8f){var _0x22f56b={'raw':![],'where':{'id':_0x132f44['params']['id']}},_0x53f98e={};_0x53f98e['model']=_['keys'](db[_0x3571('0x3d')][_0x3571('0x3e')]);_0x53f98e['query']=_[_0x3571('0x76')](_0x132f44[_0x3571('0x42')]);_0x53f98e[_0x3571('0x4b')]=_['intersection'](_0x53f98e[_0x3571('0x41')],_0x53f98e[_0x3571('0x42')]);_0x22f56b[_0x3571('0x44')]=_[_0x3571('0x43')](_0x53f98e[_0x3571('0x41')],qs[_0x3571('0x45')](_0x132f44[_0x3571('0x42')][_0x3571('0x45')]));_0x22f56b[_0x3571('0x44')]=_0x22f56b[_0x3571('0x44')]['length']?_0x22f56b[_0x3571('0x44')]:_0x53f98e['model'];if(_0x132f44['query'][_0x3571('0xb4')]){_0x22f56b[_0x3571('0xb5')]=[{'all':!![]}];}_0x22f56b=_[_0x3571('0x9c')]({},_0x22f56b,_0x132f44[_0x3571('0xb6')]);return db[_0x3571('0x3d')][_0x3571('0x63')](_0x22f56b)[_0x3571('0x2b')](handleEntityNotFound(_0x3c0a8f,null))[_0x3571('0x2b')](respondWithResult(_0x3c0a8f,null))[_0x3571('0x35')](handleError(_0x3c0a8f,null));};exports[_0x3571('0xb7')]=function(_0x563b16,_0x551184){return db[_0x3571('0x3d')]['create'](_0x563b16['body'],{})[_0x3571('0x2b')](respondWithResult(_0x551184,0xc9))[_0x3571('0x35')](handleError(_0x551184,null));};exports[_0x3571('0x29')]=function(_0x3055c4,_0x579ce5){if(_0x3055c4[_0x3571('0x74')]['id']){delete _0x3055c4[_0x3571('0x74')]['id'];}return db[_0x3571('0x3d')]['find']({'where':{'id':_0x3055c4['params']['id']}})[_0x3571('0x2b')](handleEntityNotFound(_0x579ce5,null))[_0x3571('0x2b')](saveUpdates(_0x3055c4[_0x3571('0x74')],null))[_0x3571('0x2b')](respondWithResult(_0x579ce5,null))[_0x3571('0x35')](handleError(_0x579ce5,null));};exports[_0x3571('0x2a')]=function(_0x16e45d,_0x4df643){return db[_0x3571('0x3d')]['find']({'where':{'id':_0x16e45d[_0x3571('0xb8')]['id']}})[_0x3571('0x2b')](handleEntityNotFound(_0x4df643,null))[_0x3571('0x2b')](removeEntity(_0x4df643,null))[_0x3571('0x35')](handleError(_0x4df643,null));};exports[_0x3571('0xb9')]=function(_0x189956,_0x320f06){return db[_0x3571('0x3d')][_0x3571('0xb9')]()[_0x3571('0x2b')](respondWithResult(_0x320f06,null))[_0x3571('0x35')](handleError(_0x320f06,null));};exports[_0x3571('0xba')]=function(_0x5379e2,_0x140e3f,_0x588e33){return db[_0x3571('0xbb')][_0x3571('0x63')]({'where':{'id':_0x5379e2[_0x3571('0xb8')]['id']}})[_0x3571('0x2b')](handleEntityNotFound(_0x140e3f,null))['then'](function(_0x28ab60){if(_0x28ab60){return _0x28ab60[_0x3571('0xba')](_0x5379e2[_0x3571('0x74')][_0x3571('0xbc')],_['omit'](_0x5379e2[_0x3571('0x74')],[_0x3571('0xbc'),'id'])||{});}})[_0x3571('0x2b')](respondWithResult(_0x140e3f,null))[_0x3571('0x35')](handleError(_0x140e3f,null));};exports[_0x3571('0xbd')]=function(_0x4ec727,_0x329a00,_0xfabc0b){var _0x5d68f8={'raw':![],'where':{}};var _0x253107={};var _0xed70a8={'count':0x0,'rows':[]};return db[_0x3571('0x3d')][_0x3571('0xbe')]({'where':{'id':_0x4ec727[_0x3571('0xb8')]['id']}})[_0x3571('0x2b')](handleEntityNotFound(_0x329a00,null))[_0x3571('0x2b')](function(_0x3988a2){if(_0x3988a2){_0x253107[_0x3571('0x41')]=_['keys'](db[_0x3571('0xbb')][_0x3571('0x3e')]);_0x253107[_0x3571('0x42')]=_[_0x3571('0x76')](_0x4ec727[_0x3571('0x42')]);_0x253107[_0x3571('0x4b')]=_['intersection'](_0x253107[_0x3571('0x41')],_0x253107[_0x3571('0x42')]);_0x5d68f8[_0x3571('0x44')]=_[_0x3571('0x43')](_0x253107[_0x3571('0x41')],qs[_0x3571('0x45')](_0x4ec727['query'][_0x3571('0x45')]));_0x5d68f8[_0x3571('0x44')]=_0x5d68f8[_0x3571('0x44')][_0x3571('0x46')]?_0x5d68f8[_0x3571('0x44')]:_0x253107[_0x3571('0x41')];if(!_0x4ec727['query'][_0x3571('0x47')]('nolimit')){_0x5d68f8[_0x3571('0x21')]=qs['limit'](_0x4ec727['query'][_0x3571('0x21')]);_0x5d68f8[_0x3571('0x1f')]=qs[_0x3571('0x1f')](_0x4ec727[_0x3571('0x42')][_0x3571('0x1f')]);}_0x5d68f8[_0x3571('0x49')]=qs['sort'](_0x4ec727[_0x3571('0x42')]['sort']);_0x5d68f8['where']=qs[_0x3571('0x4b')](_[_0x3571('0xbf')](_0x4ec727[_0x3571('0x42')],_0x253107[_0x3571('0x4b')]));_0x5d68f8['where'][_0x3571('0xc0')]=_0x3988a2['id'];if(_0x4ec727[_0x3571('0x42')][_0x3571('0x86')]){_0x5d68f8[_0x3571('0x7a')]=_[_0x3571('0x9c')](_0x5d68f8[_0x3571('0x7a')],{'$or':_[_0x3571('0x2f')](_0x5d68f8[_0x3571('0x44')],function(_0x295741){var _0x2be7e8={};_0x2be7e8[_0x295741]={'$like':'%'+_0x4ec727[_0x3571('0x42')]['filter']+'%'};return _0x2be7e8;})});}if(_0x4ec727[_0x3571('0x42')]['$gte']){var _0xaf6510=_0x4ec727[_0x3571('0x42')][_0x3571('0xc1')][_0x3571('0x32')](',');var _0x18941c={};_0x18941c[_0xaf6510[0x0]]={'$gte':moment(_0xaf6510[0x1])[_0x3571('0xc2')](_0x3571('0xc3'))};_0x5d68f8[_0x3571('0x7a')]=_[_0x3571('0x9c')](_0x5d68f8[_0x3571('0x7a')],_0x18941c);}_0x5d68f8=_[_0x3571('0x9c')]({},_0x5d68f8,_0x4ec727[_0x3571('0xb6')]);return db[_0x3571('0xbb')][_0x3571('0x22')]({'where':_0x5d68f8['where']})[_0x3571('0x2b')](function(_0x18b3ef){_0xed70a8[_0x3571('0x22')]=_0x18b3ef;if(_0x4ec727[_0x3571('0x42')][_0x3571('0xb4')]){_0x5d68f8['include']=[{'all':!![]}];}return db[_0x3571('0xbb')][_0x3571('0xc4')](_0x5d68f8);})[_0x3571('0x2b')](function(_0xddc7f){_0xed70a8[_0x3571('0xb2')]=_0xddc7f;return _0xed70a8;});}})[_0x3571('0x2b')](respondWithFilteredResult(_0x329a00,_0x5d68f8))['catch'](handleError(_0x329a00,null));};exports[_0x3571('0xc5')]=function(_0x2422e6,_0x130ed4,_0x40782b){return db[_0x3571('0x3d')]['find']({'where':{'id':_0x2422e6[_0x3571('0xb8')]['id']}})['then'](handleEntityNotFound(_0x130ed4,null))[_0x3571('0x2b')](function(_0x2ed5ae){if(_0x2ed5ae){return _0x2ed5ae[_0x3571('0xc6')](_0x2422e6['body'][_0x3571('0xbc')],_[_0x3571('0xc7')](_0x2422e6[_0x3571('0x74')],[_0x3571('0xbc'),'id'])||{})[_0x3571('0xc8')](function(){return db['Tag'][_0x3571('0xc4')]({'attributes':['id',_0x3571('0x2d'),'color'],'where':{'id':_0x2422e6[_0x3571('0x74')]['ids']}});})[_0x3571('0x2b')](function(_0xda109b){socket[_0x3571('0xc9')](_0x3571('0xca'),{'id':Number(_0x2422e6[_0x3571('0xb8')]['id']),'tags':_0xda109b||[]});return{'id':Number(_0x2422e6[_0x3571('0xb8')]['id']),'tags':_0xda109b||[]};});}})[_0x3571('0x2b')](respondWithResult(_0x130ed4,null))['catch'](handleError(_0x130ed4,null));};exports[_0x3571('0xcb')]=function(_0x3bdfe8,_0x483285,_0x3b1079){return db[_0x3571('0x3d')][_0x3571('0x63')]({'where':{'id':_0x3bdfe8['params']['id']}})[_0x3571('0x2b')](handleEntityNotFound(_0x483285,null))['then'](function(_0x3885c8){if(_0x3885c8){return _0x3885c8[_0x3571('0xcb')](_0x3bdfe8[_0x3571('0x42')][_0x3571('0xbc')]);}})['then'](respondWithStatusCode(_0x483285,null))[_0x3571('0x35')](handleError(_0x483285,null));};exports[_0x3571('0xcc')]=function(_0x3d2ab4,_0x32548e){var _0x474f5f=moment()[_0x3571('0xcd')]()[_0x3571('0x99')]();var _0x44a7c6=path[_0x3571('0xce')](config[_0x3571('0xcf')],'server',_0x3571('0xd0'),_0x3571('0xd1'));var _0xe50601=path['join'](config[_0x3571('0xcf')],_0x3571('0xd2'),_0x3571('0xd0'),_0x3571('0xd3'));var _0x3e7c26=path['join'](_0x44a7c6,_0x474f5f);var _0x5e052a=util[_0x3571('0xc2')]('transcript-%d-%s.zip',_0x3d2ab4[_0x3571('0xb8')]['id'],_0x474f5f);var _0x51ba59=path[_0x3571('0xce')](_0x44a7c6,_0x5e052a);var _0x47907a=[];_0x47907a[_0x3571('0x34')]({'model':db[_0x3571('0x72')],'as':_0x3571('0x72'),'attributes':['id',_0x3571('0x30')],'raw':!![]});_0x47907a[_0x3571('0x34')]({'model':db['CmContact'],'as':_0x3571('0xd4'),'attributes':['id',_0x3571('0xd5'),'lastName'],'raw':!![]});if(_0x3d2ab4[_0x3571('0x42')][_0x3571('0xd3')]){_0x47907a[_0x3571('0x34')]({'model':db['Attachment'],'as':_0x3571('0xd6'),'raw':!![]});}var _0x1f9f3d=[{'model':db[_0x3571('0xbb')],'as':_0x3571('0xd7'),'attributes':['id',_0x3571('0x74'),_0x3571('0x7d'),_0x3571('0xd8'),'secret',_0x3571('0x82')],'include':_0x47907a}];_0x1f9f3d['push']({'model':db[_0x3571('0xd9')],'as':_0x3571('0xda'),'attributes':['id',_0x3571('0x2d')]});_0x1f9f3d['push']({'model':db[_0x3571('0x72')],'as':_0x3571('0xdb'),'attributes':['id',_0x3571('0x30')]});return db[_0x3571('0x3d')][_0x3571('0x63')]({'where':{'id':_0x3d2ab4[_0x3571('0xb8')]['id']},'include':_0x1f9f3d})['then'](handleEntityNotFound(_0x32548e,null))[_0x3571('0x2b')](function(_0x182a1f){if(_0x182a1f){var _0x53df04=_0x182a1f[_0x3571('0xdc')]({'plain':!![]});fs[_0x3571('0xdd')](_0x3e7c26);var _0x255c7e={'channel':_0x3571('0xde'),'account':_0x53df04[_0x3571('0xda')][_0x3571('0x2d')],'agent':_0x53df04[_0x3571('0xdb')]?_0x53df04[_0x3571('0xdb')][_0x3571('0x30')]:'N.A.','createdAt':moment(_0x53df04[_0x3571('0x7d')])[_0x3571('0xc2')](_0x3571('0xc3'))[_0x3571('0x99')](),'closedAt':_0x53df04[_0x3571('0x3a')]?moment(_0x53df04[_0x3571('0xdf')])[_0x3571('0xc2')](_0x3571('0xc3'))[_0x3571('0x99')]():'','disposition':_0x53df04['disposition'],'messages':_(_0x53df04[_0x3571('0xd7')])['filter']({'secret':![]})[_0x3571('0x2f')](function(_0xa18cd){if(_0xa18cd['Attachment']){var _0x4aa70f=path[_0x3571('0xce')](_0xe50601,_0xa18cd[_0x3571('0xd6')]['basename']);if(fs['existsSync'](_0x4aa70f)){fs[_0x3571('0xe0')](_0x4aa70f)[_0x3571('0xe1')](fs[_0x3571('0xe2')](path[_0x3571('0xce')](_0x3e7c26,_0xa18cd['Attachment'][_0x3571('0xe3')])));}}return{'date':moment(_0xa18cd['createdAt'])[_0x3571('0xc2')](_0x3571('0xc3'))[_0x3571('0x99')](),'sender':_0xa18cd[_0x3571('0xd8')]===_0x3571('0xe4')?_0xa18cd[_0x3571('0x72')]?_0xa18cd['User']['fullname']:'System':_0xa18cd[_0x3571('0xd4')][_0x3571('0xd5')]+(_0xa18cd['Contact'][_0x3571('0xe5')]?'\x20'+_0xa18cd[_0x3571('0xd4')][_0x3571('0xe5')]:''),'body':_0xa18cd[_0x3571('0xd6')]?_0xa18cd['Attachment'][_0x3571('0xe3')]:_0xa18cd[_0x3571('0x74')],'direction':_0xa18cd[_0x3571('0xd8')]==='out'?'A':'C','secret':_0xa18cd['secret'],'read':_0xa18cd[_0x3571('0x82')],'attachment':_0xa18cd['Attachment']};})[_0x3571('0x65')]()};return ejs[_0x3571('0xe6')](path[_0x3571('0xce')](config[_0x3571('0xcf')],_0x3571('0xd2'),'views',_0x3571('0xe7')),{'interaction':_0x255c7e})[_0x3571('0x2b')](function(_0x103b21){var _0x369e5b=path[_0x3571('0xce')](_0x3e7c26,_0x3571('0xe8')+_0x53df04['id']+'-'+_0x474f5f+_0x3571('0xe9'));var _0x396028={'path':_0x369e5b,'channel':_0x3571('0xde'),'interactionId':_0x53df04['id']};return pdf[_0x3571('0xea')](_0x103b21,_0x396028);})[_0x3571('0x2b')](function(){return new BPromise(function(_0x509893,_0x2585ac){zipdir(_0x3e7c26,{'saveTo':_0x51ba59},function(_0x2623b4,_0x1f4458){if(_0x2623b4)return _0x2585ac(_0x2623b4);return _0x509893(_0x1f4458);});})['then'](function(){return new BPromise(function(_0x32037c,_0x6bdeea){rimraf(_0x3e7c26,function(_0x24c128){if(_0x24c128)_0x6bdeea(_0x24c128);return _0x32037c();});});})['then'](function(){return _0x32548e['download'](_0x51ba59,_0x5e052a,function(_0x47b11b){if(_0x47b11b){console['log'](_0x3571('0xeb'),_0x47b11b);}else{fs['unlinkSync'](_0x51ba59);}});});});}else{return _0x32548e['sendStatus'](0xc8);}})[_0x3571('0x35')](handleError(_0x32548e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fa72808..8eff40f 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 _0x70e0=['exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x70e0,0x17b));var _0x070e=function(_0x582744,_0x4b9486){_0x582744=_0x582744-0x0;var _0x45b52e=_0x70e0[_0x582744];return _0x45b52e;};'use strict';var EventEmitter=require(_0x070e('0x0'));var WhatsappInteraction=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x070e('0x3')](0x0);var events={'afterCreate':_0x070e('0x4'),'afterUpdate':_0x070e('0x5'),'afterDestroy':_0x070e('0x6')};function emitEvent(_0x5c90fc){return function(_0x7bce9b,_0x579a6b,_0x46fe68){_0x7bce9b['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5032e5){_0x7bce9b[_0x070e('0x7')](_0x070e('0x8'),_0x5032e5[_0x070e('0x9')](function(_0x2611e6){return{'id':_0x2611e6['id']};}));return WhatsappMessage[_0x070e('0xa')]({'where':{'WhatsappInteractionId':_0x7bce9b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x070e('0xb')](function(_0x11ffa8){_0x7bce9b['setDataValue']('unreadMessages',_0x11ffa8[_0x070e('0xc')]);WhatsappInteractionEvents[_0x070e('0xd')](_0x5c90fc+':'+_0x7bce9b['id'],_0x7bce9b);WhatsappInteractionEvents[_0x070e('0xd')](_0x5c90fc,_0x7bce9b);_0x46fe68(null);})[_0x070e('0xe')](_0x46fe68(null));};}for(var e in events){if(events[_0x070e('0xf')](e)){var event=events[e];WhatsappInteraction[_0x070e('0x10')](e,emitEvent(event));}}module[_0x070e('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x37dc=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','update','getUsers','then'];(function(_0x2681f7,_0x5a8d5c){var _0x4015bc=function(_0x5c454e){while(--_0x5c454e){_0x2681f7['push'](_0x2681f7['shift']());}};_0x4015bc(++_0x5a8d5c);}(_0x37dc,0x1e9));var _0xc37d=function(_0x11f93a,_0x2c2ee7){_0x11f93a=_0x11f93a-0x0;var _0x5381a4=_0x37dc[_0x11f93a];return _0x5381a4;};'use strict';var EventEmitter=require(_0xc37d('0x0'));var WhatsappInteraction=require(_0xc37d('0x1'))['db'][_0xc37d('0x2')];var WhatsappMessage=require(_0xc37d('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc37d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc37d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5ecb1f){return function(_0x5458fb,_0x4eabf9,_0x33c9db){_0x5458fb[_0xc37d('0x5')]({'attributes':['id'],'raw':!![]})[_0xc37d('0x6')](function(_0x368c3b){_0x5458fb[_0xc37d('0x7')](_0xc37d('0x8'),_0x368c3b[_0xc37d('0x9')](function(_0x32dba2){return{'id':_0x32dba2['id']};}));return WhatsappMessage[_0xc37d('0xa')]({'where':{'WhatsappInteractionId':_0x5458fb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a982d){_0x5458fb[_0xc37d('0x7')]('unreadMessages',_0x3a982d[_0xc37d('0xb')]);WhatsappInteractionEvents[_0xc37d('0xc')](_0x5ecb1f+':'+_0x5458fb['id'],_0x5458fb);WhatsappInteractionEvents['emit'](_0x5ecb1f,_0x5458fb);_0x33c9db(null);})[_0xc37d('0xd')](_0x33c9db(null));};}for(var e in events){if(events[_0xc37d('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc37d('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7401739..a8aae3c 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 _0x5934=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x45e21e,_0x1dd950){var _0x27b0aa=function(_0xb0d6e0){while(--_0xb0d6e0){_0x45e21e['push'](_0x45e21e['shift']());}};_0x27b0aa(++_0x1dd950);}(_0x5934,0x84));var _0x4593=function(_0x2805c0,_0xc8f4f4){_0x2805c0=_0x2805c0-0x0;var _0x30b40f=_0x5934[_0x2805c0];return _0x30b40f;};'use strict';var _=require(_0x4593('0x0'));var util=require(_0x4593('0x1'));var logger=require(_0x4593('0x2'))(_0x4593('0x3'));var moment=require(_0x4593('0x4'));var BPromise=require(_0x4593('0x5'));var rp=require(_0x4593('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4593('0x7'));var config=require(_0x4593('0x8'));var attributes=require(_0x4593('0x9'));module[_0x4593('0xa')]=function(_0x5f4244,_0x4946d3){return _0x5f4244['define']('WhatsappInteraction',attributes,{'tableName':_0x4593('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc42541,_0x68b016,_0x3399f0){if(_0xc42541[_0x4593('0xc')]('closed')){_0xc42541[_0x4593('0xd')]=moment()['format'](_0x4593('0xe'));}_0x3399f0(null,_0xc42541);}}});}; \ No newline at end of file +var _0x749a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','WhatsappInteraction','changed','closed'];(function(_0x50cc30,_0x58c578){var _0x382624=function(_0x2ca5ee){while(--_0x2ca5ee){_0x50cc30['push'](_0x50cc30['shift']());}};_0x382624(++_0x58c578);}(_0x749a,0x73));var _0xa749=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x749a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xa749('0x0'));var util=require(_0xa749('0x1'));var logger=require(_0xa749('0x2'))(_0xa749('0x3'));var moment=require(_0xa749('0x4'));var BPromise=require(_0xa749('0x5'));var rp=require(_0xa749('0x6'));var fs=require('fs');var path=require(_0xa749('0x7'));var rimraf=require('rimraf');var config=require(_0xa749('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xa749('0x9')]=function(_0x5bd1ce,_0x4254ff){return _0x5bd1ce['define'](_0xa749('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ea2f1,_0x5bd577,_0x3a4644){if(_0x4ea2f1[_0xa749('0xb')](_0xa749('0xc'))){_0x4ea2f1[_0xa749('0xd')]=moment()[_0xa749('0xe')](_0xa749('0xf'));}_0x3a4644(null,_0x4ea2f1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a0578f0..7fe3f25 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 _0xa96d=['raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','body','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xa96d,0xb7));var _0xda96=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0xa96d[_0xb0975b];return _0x320d30;};'use strict';var _=require('lodash');var util=require(_0xda96('0x0'));var moment=require('moment');var BPromise=require(_0xda96('0x1'));var rs=require(_0xda96('0x2'));var fs=require('fs');var Redis=require(_0xda96('0x3'));var db=require(_0xda96('0x4'))['db'];var utils=require(_0xda96('0x5'));var logger=require('../../config/logger')(_0xda96('0x6'));var config=require(_0xda96('0x7'));var jayson=require(_0xda96('0x8'));var client=jayson[_0xda96('0x9')][_0xda96('0xa')]({'port':0x232a});config[_0xda96('0xb')]=_[_0xda96('0xc')](config[_0xda96('0xb')],{'host':_0xda96('0xd'),'port':0x18eb});var socket=require(_0xda96('0xe'))(new Redis(config['redis']));require(_0xda96('0xf'))[_0xda96('0x10')](socket);function respondWithRpcPromise(_0x4c99a0,_0x429d0a,_0x309f02){return new BPromise(function(_0x525765,_0x28e837){return client['request'](_0x4c99a0,_0x309f02)[_0xda96('0x11')](function(_0x503bfd){logger[_0xda96('0x12')](_0xda96('0x13'),_0x429d0a,_0xda96('0x14'));logger[_0xda96('0x15')](_0xda96('0x16'),_0x429d0a,_0xda96('0x14'),JSON[_0xda96('0x17')](_0x503bfd));if(_0x503bfd[_0xda96('0x18')]){if(_0x503bfd['error'][_0xda96('0x19')]===0x1f4){logger[_0xda96('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x429d0a,_0x503bfd[_0xda96('0x18')][_0xda96('0x1a')]);return _0x28e837(_0x503bfd[_0xda96('0x18')]['message']);}logger['error'](_0xda96('0x13'),_0x429d0a,_0x503bfd[_0xda96('0x18')]['message']);return _0x525765(_0x503bfd['error']['message']);}else{logger[_0xda96('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x429d0a,_0xda96('0x14'));_0x525765(_0x503bfd[_0xda96('0x1b')]['message']);}})[_0xda96('0x1c')](function(_0x33d1ce){logger[_0xda96('0x18')](_0xda96('0x13'),_0x429d0a,_0x33d1ce);_0x28e837(_0x33d1ce);});});}exports[_0xda96('0x1d')]=function(_0x953216){var _0x4d57f1=this;return new Promise(function(_0x4b81e0,_0x232d08){return db[_0xda96('0x1e')]['update'](_0x953216['body'],{'raw':_0x953216[_0xda96('0x1f')]?_0x953216[_0xda96('0x1f')][_0xda96('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x953216[_0xda96('0x1f')]?_0x953216[_0xda96('0x1f')][_0xda96('0x21')]||null:null,'attributes':_0x953216[_0xda96('0x1f')]?_0x953216[_0xda96('0x1f')][_0xda96('0x22')]||null:null,'limit':_0x953216[_0xda96('0x1f')]?_0x953216['options'][_0xda96('0x23')]||null:null})[_0xda96('0x11')](function(_0x1cb8f2){logger[_0xda96('0x12')](_0xda96('0x1d'),_0x953216);logger['debug']('UpdateWhatsappInteraction',_0x953216,JSON[_0xda96('0x17')](_0x1cb8f2));_0x4b81e0(_0x1cb8f2);})['catch'](function(_0x3a68e0){logger[_0xda96('0x18')](_0xda96('0x1d'),_0x3a68e0['message'],_0x953216);_0x232d08(_0x4d57f1[_0xda96('0x18')](0x1f4,_0x3a68e0[_0xda96('0x1a')]));});});};exports[_0xda96('0x24')]=function(_0x399a84){return new Promise(function(_0x227ead,_0x58a2b2){return db[_0xda96('0x1e')][_0xda96('0x25')]({'where':_0x399a84['options']?_0x399a84[_0xda96('0x1f')][_0xda96('0x21')]||null:null})[_0xda96('0x11')](function(_0xe5d7c6){if(_0xe5d7c6){return _0xe5d7c6['addTags'](_0x399a84['body'][_0xda96('0x26')],_[_0xda96('0x27')](_0x399a84[_0xda96('0x28')],[_0xda96('0x26'),'id'])||{});}})[_0xda96('0x29')](function(_0x5c4a46){logger['info'](_0xda96('0x2a'),_0x399a84);logger['debug'](_0xda96('0x2a'),_0x399a84,JSON['stringify'](_0x5c4a46));_0x227ead(_0x5c4a46);})[_0xda96('0x1c')](function(_0x1b214e){logger['error'](_0xda96('0x2a'),_0x1b214e['message'],_0x399a84);_0x58a2b2(_this[_0xda96('0x18')](0x1f4,_0x1b214e[_0xda96('0x1a')]));});});}; \ No newline at end of file +var _0x90d1=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0x90d1,0x1a8));var _0x190d=function(_0x46f7f0,_0x4ef418){_0x46f7f0=_0x46f7f0-0x0;var _0x783786=_0x90d1[_0x46f7f0];return _0x783786;};'use strict';var _=require(_0x190d('0x0'));var util=require(_0x190d('0x1'));var moment=require(_0x190d('0x2'));var BPromise=require(_0x190d('0x3'));var rs=require(_0x190d('0x4'));var fs=require('fs');var Redis=require(_0x190d('0x5'));var db=require(_0x190d('0x6'))['db'];var utils=require(_0x190d('0x7'));var logger=require(_0x190d('0x8'))('rpc');var config=require(_0x190d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x190d('0xa')]({'port':0x232a});config[_0x190d('0xb')]=_[_0x190d('0xc')](config[_0x190d('0xb')],{'host':_0x190d('0xd'),'port':0x18eb});var socket=require(_0x190d('0xe'))(new Redis(config[_0x190d('0xb')]));require('./whatsappInteraction.socket')[_0x190d('0xf')](socket);function respondWithRpcPromise(_0x421b44,_0x1acc28,_0x1a231c){return new BPromise(function(_0x1df49b,_0x4d4aa5){return client[_0x190d('0x10')](_0x421b44,_0x1a231c)[_0x190d('0x11')](function(_0x5cac38){logger[_0x190d('0x12')](_0x190d('0x13'),_0x1acc28,_0x190d('0x14'));logger[_0x190d('0x15')](_0x190d('0x16'),_0x1acc28,_0x190d('0x14'),JSON[_0x190d('0x17')](_0x5cac38));if(_0x5cac38[_0x190d('0x18')]){if(_0x5cac38[_0x190d('0x18')]['code']===0x1f4){logger[_0x190d('0x18')](_0x190d('0x13'),_0x1acc28,_0x5cac38[_0x190d('0x18')][_0x190d('0x19')]);return _0x4d4aa5(_0x5cac38[_0x190d('0x18')][_0x190d('0x19')]);}logger[_0x190d('0x18')](_0x190d('0x13'),_0x1acc28,_0x5cac38[_0x190d('0x18')][_0x190d('0x19')]);return _0x1df49b(_0x5cac38[_0x190d('0x18')][_0x190d('0x19')]);}else{logger['info'](_0x190d('0x13'),_0x1acc28,_0x190d('0x14'));_0x1df49b(_0x5cac38['result'][_0x190d('0x19')]);}})[_0x190d('0x1a')](function(_0x3f9d30){logger[_0x190d('0x18')](_0x190d('0x13'),_0x1acc28,_0x3f9d30);_0x4d4aa5(_0x3f9d30);});});}exports[_0x190d('0x1b')]=function(_0x5aca2a){var _0x44fe90=this;return new Promise(function(_0x15fd6e,_0x43e613){return db[_0x190d('0x1c')][_0x190d('0x1d')](_0x5aca2a[_0x190d('0x1e')],{'raw':_0x5aca2a[_0x190d('0x1f')]?_0x5aca2a[_0x190d('0x1f')][_0x190d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aca2a[_0x190d('0x1f')]?_0x5aca2a[_0x190d('0x1f')][_0x190d('0x21')]||null:null,'attributes':_0x5aca2a[_0x190d('0x1f')]?_0x5aca2a[_0x190d('0x1f')][_0x190d('0x22')]||null:null,'limit':_0x5aca2a['options']?_0x5aca2a['options'][_0x190d('0x23')]||null:null})[_0x190d('0x11')](function(_0x2df06e){logger[_0x190d('0x12')]('UpdateWhatsappInteraction',_0x5aca2a);logger[_0x190d('0x15')]('UpdateWhatsappInteraction',_0x5aca2a,JSON[_0x190d('0x17')](_0x2df06e));_0x15fd6e(_0x2df06e);})[_0x190d('0x1a')](function(_0xc592e4){logger[_0x190d('0x18')]('UpdateWhatsappInteraction',_0xc592e4[_0x190d('0x19')],_0x5aca2a);_0x43e613(_0x44fe90[_0x190d('0x18')](0x1f4,_0xc592e4[_0x190d('0x19')]));});});};exports[_0x190d('0x24')]=function(_0x5536ef){return new Promise(function(_0x457f4f,_0x399499){return db['WhatsappInteraction'][_0x190d('0x25')]({'where':_0x5536ef[_0x190d('0x1f')]?_0x5536ef[_0x190d('0x1f')][_0x190d('0x21')]||null:null})[_0x190d('0x11')](function(_0x4e89b0){if(_0x4e89b0){return _0x4e89b0[_0x190d('0x26')](_0x5536ef[_0x190d('0x1e')][_0x190d('0x27')],_['omit'](_0x5536ef[_0x190d('0x1e')],['ids','id'])||{});}})[_0x190d('0x28')](function(_0x29046a){logger['info'](_0x190d('0x29'),_0x5536ef);logger[_0x190d('0x15')](_0x190d('0x29'),_0x5536ef,JSON[_0x190d('0x17')](_0x29046a));_0x457f4f(_0x29046a);})[_0x190d('0x1a')](function(_0x279c5a){logger['error']('AddTags',_0x279c5a['message'],_0x5536ef);_0x399499(_this[_0x190d('0x18')](0x1f4,_0x279c5a[_0x190d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 04b9892..6c8738f 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 _0xa887=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x577c4f,_0x1f1f69){var _0x9da5a0=function(_0x494837){while(--_0x494837){_0x577c4f['push'](_0x577c4f['shift']());}};_0x9da5a0(++_0x1f1f69);}(_0xa887,0xe5));var _0x7a88=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa887[_0x34bf97];return _0x292719;};'use strict';var WhatsappInteractionEvents=require(_0x7a88('0x0'));var events=['save',_0x7a88('0x1'),_0x7a88('0x2')];function createListener(_0x4e7561,_0xfac572){return function(_0x30abec){_0xfac572[_0x7a88('0x3')](_0x4e7561,_0x30abec);};}function removeListener(_0x47507f,_0x31a065){return function(){WhatsappInteractionEvents[_0x7a88('0x4')](_0x47507f,_0x31a065);};}exports[_0x7a88('0x5')]=function(_0x47ef89){for(var _0x2c5665=0x0,_0x2f90eb=events[_0x7a88('0x6')];_0x2c5665<_0x2f90eb;_0x2c5665++){var _0x43dccb=events[_0x2c5665];var _0x390948=createListener(_0x7a88('0x7')+_0x43dccb,_0x47ef89);WhatsappInteractionEvents['on'](_0x43dccb,_0x390948);}}; \ No newline at end of file +var _0x2f52=['./whatsappInteraction.events','save','remove','emit','register','whatsappInteraction:'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x2f52,0xfc));var _0x22f5=function(_0x18a794,_0x335c63){_0x18a794=_0x18a794-0x0;var _0x4fadaa=_0x2f52[_0x18a794];return _0x4fadaa;};'use strict';var WhatsappInteractionEvents=require(_0x22f5('0x0'));var events=[_0x22f5('0x1'),_0x22f5('0x2'),'update'];function createListener(_0x372791,_0x5dac33){return function(_0x4cdb57){_0x5dac33[_0x22f5('0x3')](_0x372791,_0x4cdb57);};}function removeListener(_0x1e3aab,_0x579c4c){return function(){WhatsappInteractionEvents['removeListener'](_0x1e3aab,_0x579c4c);};}exports[_0x22f5('0x4')]=function(_0x340978){for(var _0x3518f7=0x0,_0x10fb70=events['length'];_0x3518f7<_0x10fb70;_0x3518f7++){var _0x58e11a=events[_0x3518f7];var _0x3f47d4=createListener(_0x22f5('0x5')+_0x58e11a,_0x340978);WhatsappInteractionEvents['on'](_0x58e11a,_0x3f47d4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d8b4c25..e61b283 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 _0x1fe9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','/describe','/:id','show','post','isAuthenticated','tracked','whatsappmessage:create','/:id/status','put','update','/:id/reject','reject','delete','destroy'];(function(_0x10c624,_0x3a18c7){var _0x5a90bc=function(_0x2f571b){while(--_0x2f571b){_0x10c624['push'](_0x10c624['shift']());}};_0x5a90bc(++_0x3a18c7);}(_0x1fe9,0x114));var _0x91fe=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1fe9[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x91fe('0x0'));var util=require(_0x91fe('0x1'));var path=require(_0x91fe('0x2'));var timeout=require(_0x91fe('0x3'));var express=require(_0x91fe('0x4'));var router=express[_0x91fe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91fe('0x6'));var interaction=require(_0x91fe('0x7'));var config=require('../../config/environment');var controller=require(_0x91fe('0x8'));router[_0x91fe('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91fe('0x9')](_0x91fe('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x91fe('0xb'),auth['isAuthenticated'](),controller[_0x91fe('0xc')]);router[_0x91fe('0xd')]('/',auth[_0x91fe('0xe')](),interaction[_0x91fe('0xf')]('whatsapp',_0x91fe('0x10')),controller['create']);router[_0x91fe('0xd')](_0x91fe('0x11'),controller['status']);router[_0x91fe('0x12')](_0x91fe('0xb'),auth[_0x91fe('0xe')](),controller[_0x91fe('0x13')]);router['put']('/:id/accept',auth[_0x91fe('0xe')](),controller['accept']);router[_0x91fe('0x12')](_0x91fe('0x14'),auth[_0x91fe('0xe')](),controller[_0x91fe('0x15')]);router[_0x91fe('0x16')](_0x91fe('0xb'),auth[_0x91fe('0xe')](),controller[_0x91fe('0x17')]);module[_0x91fe('0x18')]=router; \ No newline at end of file +var _0x5d57=['tracked','whatsapp','whatsappmessage:create','create','status','put','/:id','update','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post'];(function(_0x394ee8,_0x4565ff){var _0x124424=function(_0x5df904){while(--_0x5df904){_0x394ee8['push'](_0x394ee8['shift']());}};_0x124424(++_0x4565ff);}(_0x5d57,0x186));var _0x75d5=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0x5d57[_0x30121e];return _0x4ba328;};'use strict';var multer=require('multer');var util=require(_0x75d5('0x0'));var path=require(_0x75d5('0x1'));var timeout=require(_0x75d5('0x2'));var express=require(_0x75d5('0x3'));var router=express[_0x75d5('0x4')]();var fs_extra=require(_0x75d5('0x5'));var auth=require(_0x75d5('0x6'));var interaction=require(_0x75d5('0x7'));var config=require(_0x75d5('0x8'));var controller=require('./whatsappMessage.controller');router[_0x75d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x75d5('0xa')]);router[_0x75d5('0x9')](_0x75d5('0xb'),auth[_0x75d5('0xc')](),controller[_0x75d5('0xd')]);router[_0x75d5('0x9')]('/:id',auth[_0x75d5('0xc')](),controller[_0x75d5('0xe')]);router[_0x75d5('0xf')]('/',auth[_0x75d5('0xc')](),interaction[_0x75d5('0x10')](_0x75d5('0x11'),_0x75d5('0x12')),controller[_0x75d5('0x13')]);router[_0x75d5('0xf')]('/:id/status',controller[_0x75d5('0x14')]);router[_0x75d5('0x15')](_0x75d5('0x16'),auth[_0x75d5('0xc')](),controller[_0x75d5('0x17')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x75d5('0x18')]);router[_0x75d5('0x15')](_0x75d5('0x19'),auth[_0x75d5('0xc')](),controller[_0x75d5('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x75d5('0x1b')]);module[_0x75d5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9c1d8c2..955b676 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 _0x2873=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2873,0x1f2));var _0x3287=function(_0x3d26a3,_0x57f40a){_0x3d26a3=_0x3d26a3-0x0;var _0x4bec22=_0x2873[_0x3d26a3];return _0x4bec22;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'body':{'type':Sequelize[_0x3287('0x2')](_0x3287('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3287('0x4')]('in',_0x3287('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3287('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3287('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3287('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3287('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0eab=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x1a054c,_0x2cb620){var _0xe9556=function(_0x136152){while(--_0x136152){_0x1a054c['push'](_0x1a054c['shift']());}};_0xe9556(++_0x2cb620);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x16a95e,_0x1c79f4){_0x16a95e=_0x16a95e-0x0;var _0x2134eb=_0x0eab[_0x16a95e];return _0x2134eb;};'use strict';var Sequelize=require(_0xb0ea('0x0'));module[_0xb0ea('0x1')]={'body':{'type':Sequelize[_0xb0ea('0x2')](_0xb0ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb0ea('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb0ea('0x5')]('in',_0xb0ea('0x6')),'defaultValue':_0xb0ea('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb0ea('0x7')](0xbe)},'phone':{'type':Sequelize[_0xb0ea('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xb0ea('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb0ea('0x7')]},'providerResponse':{'type':Sequelize[_0xb0ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1c3652d..603dadb 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 _0x0ec0=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','params','include','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','User','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','query','keys','filters','intersection'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0ec0,0x162));var _0x00ec=function(_0x16a430,_0x5229e9){_0x16a430=_0x16a430-0x0;var _0x4f75a6=_0x0ec0[_0x16a430];return _0x4f75a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00ec('0x0'));var zipdir=require(_0x00ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00ec('0x2'));var moment=require(_0x00ec('0x3'));var BPromise=require(_0x00ec('0x4'));var Mustache=require(_0x00ec('0x5'));var util=require(_0x00ec('0x6'));var path=require(_0x00ec('0x7'));var sox=require('sox');var csv=require(_0x00ec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00ec('0x9'));var squel=require('squel');var crypto=require(_0x00ec('0xa'));var jsforce=require(_0x00ec('0xb'));var deskjs=require(_0x00ec('0xc'));var toCsv=require(_0x00ec('0x8'));var querystring=require(_0x00ec('0xd'));var Papa=require(_0x00ec('0xe'));var Redis=require(_0x00ec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x00ec('0x10'));var as=require(_0x00ec('0x11'));var hardwareService=require(_0x00ec('0x12'));var logger=require(_0x00ec('0x13'))('api');var utils=require(_0x00ec('0x14'));var config=require(_0x00ec('0x15'));var licenseUtil=require(_0x00ec('0x16'));var db=require('../../mysqldb')['db'];config[_0x00ec('0x17')]=_[_0x00ec('0x18')](config[_0x00ec('0x17')],{'host':_0x00ec('0x19'),'port':0x18eb});var socket=require(_0x00ec('0x1a'))(new Redis(config[_0x00ec('0x17')]));require(_0x00ec('0x1b'))[_0x00ec('0x1c')](socket);var jayson=require(_0x00ec('0x1d'));var client=jayson['client'][_0x00ec('0x1e')]({'port':0x232c});var client9002=jayson[_0x00ec('0x1f')][_0x00ec('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4c7961,_0x5c9a5c,_0x3b656c,_0x2d7c3e){return new BPromise(function(_0x476047,_0xd380bd){var _0x49d910=_0x2d7c3e||client;return _0x49d910[_0x00ec('0x20')](_0x4c7961,_0x3b656c)['then'](function(_0x23b2b8){logger['info'](_0x00ec('0x21'),_0x5c9a5c,_0x00ec('0x22'));logger[_0x00ec('0x23')](_0x00ec('0x24'),_0x5c9a5c,_0x00ec('0x22'),JSON[_0x00ec('0x25')](_0x23b2b8));if(_0x23b2b8[_0x00ec('0x26')]){if(_0x23b2b8[_0x00ec('0x26')][_0x00ec('0x27')]===0x1f4){logger[_0x00ec('0x26')](_0x00ec('0x21'),_0x5c9a5c,_0x23b2b8['error'][_0x00ec('0x28')]);return _0xd380bd(_0x23b2b8[_0x00ec('0x26')][_0x00ec('0x28')]);}logger['error'](_0x00ec('0x21'),_0x5c9a5c,_0x23b2b8[_0x00ec('0x26')][_0x00ec('0x28')]);return _0x476047(_0x23b2b8[_0x00ec('0x26')]['message']);}else{logger[_0x00ec('0x29')](_0x00ec('0x21'),_0x5c9a5c,'request\x20sent');_0x476047(_0x23b2b8['result'][_0x00ec('0x28')]);}})[_0x00ec('0x2a')](function(_0x15a064){logger['error'](_0x00ec('0x21'),_0x5c9a5c,_0x15a064);_0xd380bd(_0x15a064);});});}function respondWithStatusCode(_0x18d5da,_0x4fff15){_0x4fff15=_0x4fff15||0xcc;return function(_0x470263){if(_0x470263){return _0x18d5da[_0x00ec('0x2b')](_0x4fff15);}return _0x18d5da[_0x00ec('0x2c')](_0x4fff15)['end']();};}function respondWithResult(_0x28bd4f,_0x4e6d61){_0x4e6d61=_0x4e6d61||0xc8;return function(_0x1514b9){if(_0x1514b9){return _0x28bd4f[_0x00ec('0x2c')](_0x4e6d61)['json'](_0x1514b9);}};}function respondWithFilteredResult(_0x52bf9a,_0x44defc){return function(_0x58eb45){if(_0x58eb45){var _0x18899c=typeof _0x44defc['offset']==='undefined'&&typeof _0x44defc[_0x00ec('0x2d')]===_0x00ec('0x2e');var _0x258e98=_0x58eb45[_0x00ec('0x2f')];var _0x2da96b=_0x18899c?0x0:_0x44defc[_0x00ec('0x30')];var _0x5676e8=_0x18899c?_0x58eb45[_0x00ec('0x2f')]:_0x44defc['offset']+_0x44defc['limit'];var _0x4ae4ec;if(_0x5676e8>=_0x258e98){_0x5676e8=_0x258e98;_0x4ae4ec=0xc8;}else{_0x4ae4ec=0xce;}_0x52bf9a[_0x00ec('0x2c')](_0x4ae4ec);return _0x52bf9a[_0x00ec('0x31')](_0x00ec('0x32'),_0x2da96b+'-'+_0x5676e8+'/'+_0x258e98)[_0x00ec('0x33')](_0x58eb45);}return null;};}function patchUpdates(_0x12f0ad){return function(_0x1d321b){try{jsonpatch[_0x00ec('0x34')](_0x1d321b,_0x12f0ad,!![]);}catch(_0x32d2eb){return BPromise[_0x00ec('0x35')](_0x32d2eb);}return _0x1d321b[_0x00ec('0x36')]();};}function saveUpdates(_0xad865d,_0x1942eb){return function(_0x559337){if(_0x559337){return _0x559337[_0x00ec('0x37')](_0xad865d)[_0x00ec('0x38')](function(_0x3e40f5){return _0x3e40f5;});}return null;};}function removeEntity(_0x4d2981,_0x58b3c4){return function(_0x9707d3){if(_0x9707d3){return _0x9707d3['destroy']()[_0x00ec('0x38')](function(){_0x4d2981[_0x00ec('0x2c')](0xcc)[_0x00ec('0x39')]();});}};}function handleEntityNotFound(_0x130176,_0x389d45){return function(_0x557e78){if(!_0x557e78){_0x130176[_0x00ec('0x2b')](0x194);}return _0x557e78;};}function handleError(_0x12d116,_0x50541a){_0x50541a=_0x50541a||0x1f4;return function(_0x5adcca){logger[_0x00ec('0x26')](_0x5adcca['stack']);if(_0x5adcca[_0x00ec('0x3a')]){delete _0x5adcca['name'];}_0x12d116[_0x00ec('0x2c')](_0x50541a)[_0x00ec('0x3b')](_0x5adcca);};}exports[_0x00ec('0x3c')]=function(_0x1aada8,_0x435042){var _0x2c66b2={},_0x3e3387={},_0x436bc4={'count':0x0,'rows':[]};var _0x36c619=_[_0x00ec('0x3d')](db[_0x00ec('0x3e')][_0x00ec('0x3f')],function(_0x25ac07){return{'name':_0x25ac07[_0x00ec('0x40')],'type':_0x25ac07['type']['key']};});_0x3e3387['model']=_[_0x00ec('0x3d')](_0x36c619,_0x00ec('0x3a'));_0x3e3387[_0x00ec('0x41')]=_[_0x00ec('0x42')](_0x1aada8[_0x00ec('0x41')]);_0x3e3387[_0x00ec('0x43')]=_[_0x00ec('0x44')](_0x3e3387[_0x00ec('0x45')],_0x3e3387[_0x00ec('0x41')]);_0x2c66b2[_0x00ec('0x46')]=_[_0x00ec('0x44')](_0x3e3387[_0x00ec('0x45')],qs[_0x00ec('0x47')](_0x1aada8['query']['fields']));_0x2c66b2[_0x00ec('0x46')]=_0x2c66b2[_0x00ec('0x46')][_0x00ec('0x48')]?_0x2c66b2[_0x00ec('0x46')]:_0x3e3387[_0x00ec('0x45')];if(!_0x1aada8[_0x00ec('0x41')][_0x00ec('0x49')](_0x00ec('0x4a'))){_0x2c66b2[_0x00ec('0x2d')]=qs['limit'](_0x1aada8[_0x00ec('0x41')][_0x00ec('0x2d')]);_0x2c66b2[_0x00ec('0x30')]=qs['offset'](_0x1aada8[_0x00ec('0x41')][_0x00ec('0x30')]);}_0x2c66b2['order']=qs[_0x00ec('0x4b')](_0x1aada8[_0x00ec('0x41')][_0x00ec('0x4b')]);_0x2c66b2[_0x00ec('0x4c')]=qs['filters'](_[_0x00ec('0x4d')](_0x1aada8['query'],_0x3e3387[_0x00ec('0x43')]),_0x36c619);if(_0x1aada8[_0x00ec('0x41')][_0x00ec('0x4e')]){_0x2c66b2[_0x00ec('0x4c')]=_[_0x00ec('0x4f')](_0x2c66b2['where'],{'$or':_[_0x00ec('0x3d')](_0x36c619,function(_0x437c90){if(_0x437c90[_0x00ec('0x50')]!==_0x00ec('0x51')){var _0x6ebce2={};_0x6ebce2[_0x437c90[_0x00ec('0x3a')]]={'$like':'%'+_0x1aada8[_0x00ec('0x41')][_0x00ec('0x4e')]+'%'};return _0x6ebce2;}})});}_0x2c66b2=_['merge']({},_0x2c66b2,_0x1aada8['options']);var _0xd26f75={'where':_0x2c66b2[_0x00ec('0x4c')]};return db[_0x00ec('0x3e')][_0x00ec('0x2f')](_0xd26f75)[_0x00ec('0x38')](function(_0xa8f89a){_0x436bc4[_0x00ec('0x2f')]=_0xa8f89a;if(_0x1aada8['query'][_0x00ec('0x52')]){_0x2c66b2['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x2c66b2);})[_0x00ec('0x38')](function(_0x324986){_0x436bc4[_0x00ec('0x53')]=_0x324986;return _0x436bc4;})[_0x00ec('0x38')](respondWithFilteredResult(_0x435042,_0x2c66b2))[_0x00ec('0x2a')](handleError(_0x435042,null));};exports[_0x00ec('0x54')]=function(_0x480319,_0x3bd9f4){var _0x2c3732={'raw':!![],'where':{'id':_0x480319[_0x00ec('0x55')]['id']}},_0x149473={};_0x149473['model']=_[_0x00ec('0x42')](db[_0x00ec('0x3e')][_0x00ec('0x3f')]);_0x149473['query']=_[_0x00ec('0x42')](_0x480319[_0x00ec('0x41')]);_0x149473['filters']=_[_0x00ec('0x44')](_0x149473['model'],_0x149473[_0x00ec('0x41')]);_0x2c3732['attributes']=_['intersection'](_0x149473[_0x00ec('0x45')],qs[_0x00ec('0x47')](_0x480319[_0x00ec('0x41')][_0x00ec('0x47')]));_0x2c3732[_0x00ec('0x46')]=_0x2c3732[_0x00ec('0x46')][_0x00ec('0x48')]?_0x2c3732[_0x00ec('0x46')]:_0x149473[_0x00ec('0x45')];if(_0x480319[_0x00ec('0x41')][_0x00ec('0x52')]){_0x2c3732[_0x00ec('0x56')]=[{'all':!![]}];}_0x2c3732=_[_0x00ec('0x4f')]({},_0x2c3732,_0x480319[_0x00ec('0x57')]);return db[_0x00ec('0x3e')][_0x00ec('0x58')](_0x2c3732)[_0x00ec('0x38')](handleEntityNotFound(_0x3bd9f4,null))[_0x00ec('0x38')](respondWithResult(_0x3bd9f4,null))[_0x00ec('0x2a')](handleError(_0x3bd9f4,null));};exports[_0x00ec('0x59')]=function(_0x13171a,_0x4c5418){return db[_0x00ec('0x3e')][_0x00ec('0x59')](_0x13171a[_0x00ec('0x5a')],{})[_0x00ec('0x38')](respondWithResult(_0x4c5418,0xc9))[_0x00ec('0x2a')](handleError(_0x4c5418,null));};exports[_0x00ec('0x37')]=function(_0x20f9ca,_0x3534e5){if(_0x20f9ca['body']['id']){delete _0x20f9ca[_0x00ec('0x5a')]['id'];}return db[_0x00ec('0x3e')]['find']({'where':{'id':_0x20f9ca[_0x00ec('0x55')]['id']}})[_0x00ec('0x38')](handleEntityNotFound(_0x3534e5,null))[_0x00ec('0x38')](saveUpdates(_0x20f9ca[_0x00ec('0x5a')],null))['then'](respondWithResult(_0x3534e5,null))[_0x00ec('0x2a')](handleError(_0x3534e5,null));};exports['destroy']=function(_0x2351be,_0x12f199){return db[_0x00ec('0x3e')][_0x00ec('0x58')]({'where':{'id':_0x2351be['params']['id']}})[_0x00ec('0x38')](handleEntityNotFound(_0x12f199,null))[_0x00ec('0x38')](removeEntity(_0x12f199,null))[_0x00ec('0x2a')](handleError(_0x12f199,null));};exports[_0x00ec('0x5b')]=function(_0x336e1d,_0x448094){return db[_0x00ec('0x3e')]['describe']()[_0x00ec('0x38')](respondWithResult(_0x448094,null))[_0x00ec('0x2a')](handleError(_0x448094,null));};var interaction_log=require('../../config/logger')(_0x00ec('0x5c'));exports[_0x00ec('0x5d')]=function(_0x72b9b0,_0x1cdb5a,_0x1b6909){var _0x208d7f={'agent':{},'channel':_0x00ec('0x5e')};if(_0x72b9b0[_0x00ec('0x5a')]['id']){delete _0x72b9b0['body']['id'];}_0x72b9b0['body'][_0x00ec('0x5f')]=!![];_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x60')]=moment()[_0x00ec('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x72b9b0['body']['UserId']=_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x62')]||_0x72b9b0['user']['id'];_0x208d7f['agent']['id']=_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x62')];return db[_0x00ec('0x3e')][_0x00ec('0x58')]({'where':{'id':_0x72b9b0[_0x00ec('0x55')]['id'],'UserId':null}})[_0x00ec('0x38')](handleEntityNotFound(_0x1cdb5a,null))[_0x00ec('0x38')](saveUpdates(_0x72b9b0[_0x00ec('0x5a')],null))['then'](function(_0x425e14){if(_0x425e14){_0x208d7f[_0x00ec('0x28')]=_0x425e14[_0x00ec('0x63')]({'plain':!![]});return db[_0x00ec('0x64')]['find']({'where':{'id':_0x425e14[_0x00ec('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1cdb5a,null))[_0x00ec('0x38')](function(_0x8daf08){if(_0x8daf08){return _0x8daf08['update']({'UserId':_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x62')],'read1stAt':_[_0x00ec('0x66')](_0x8daf08[_0x00ec('0x67')])?moment()[_0x00ec('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x00ec('0x38')](function(_0x4e3c1c){if(_0x4e3c1c){_0x208d7f[_0x00ec('0x68')]=_0x4e3c1c[_0x00ec('0x63')]({'plain':!![]});interaction_log[_0x00ec('0x29')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x72b9b0[_0x00ec('0x69')]['id'],_0x72b9b0[_0x00ec('0x69')]['name'],_0x72b9b0[_0x00ec('0x69')]['role'],_0x208d7f[_0x00ec('0x68')]['id'],_0x72b9b0['body']?JSON['stringify'](_0x72b9b0[_0x00ec('0x5a')]):'null');return respondWithRpcPromise(_0x00ec('0x6a'),_0x00ec('0x6b'),_0x208d7f);}return null;})[_0x00ec('0x38')](function(_0x36437a){var _0x25f817=_0x00ec('0x6c')+_0x36437a[_0x00ec('0x28')]['ContactId'];return db[_0x00ec('0x6d')][_0x00ec('0x41')](_0x25f817,{'type':db[_0x00ec('0x6e')][_0x00ec('0x6f')]['SELECT'],'raw':!![]})[_0x00ec('0x38')](function(_0x4f0c56){return _0x4f0c56;});})[_0x00ec('0x38')](function(_0x2c41e9){if(_0x2c41e9){_0x208d7f[_0x00ec('0x28')]['contact']=_0x2c41e9[0x0];if(!_0x72b9b0[_0x00ec('0x5a')]['UserId'])return;return db['User'][_0x00ec('0x58')]({'where':{'id':_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x62')],'role':_0x00ec('0x70')},'attributes':['id',_0x00ec('0x3a'),_0x00ec('0x71'),_0x00ec('0x72'),_0x00ec('0x73')],'raw':!![]});}return null;})[_0x00ec('0x38')](function(_0x2e9adf){if(!_0x2e9adf)return null;_0x208d7f[_0x00ec('0x28')]['agent']=_0x2e9adf;return _0x208d7f;})[_0x00ec('0x38')](function(_0x5e86f2){if(_0x5e86f2){if(_0x72b9b0[_0x00ec('0x5a')][_0x00ec('0x74')]){_0x208d7f['message'][_0x00ec('0x75')]=util['format'](_0x00ec('0x76'),_0x72b9b0[_0x00ec('0x69')][_0x00ec('0x3a')]);_0x208d7f[_0x00ec('0x28')][_0x00ec('0x77')]=_0x208d7f[_0x00ec('0x77')];_0x208d7f[_0x00ec('0x28')][_0x00ec('0x78')]=_0x208d7f[_0x00ec('0x77')];_0x208d7f[_0x00ec('0x28')]['event']='accept';return respondWithRpcPromise(_0x00ec('0x79'),'EventManager',{'event':_0x00ec('0x7a'),'message':_0x208d7f['message']},client9002)['then'](function(){return _0x208d7f;});}return _0x208d7f;}return null;})['then'](respondWithResult(_0x1cdb5a,null))[_0x00ec('0x2a')](handleError(_0x1cdb5a,null));};var interaction_log=require(_0x00ec('0x13'))(_0x00ec('0x5c'));exports[_0x00ec('0x35')]=function(_0x2b2d62,_0x444a1a,_0x112880){var _0x5d22d6={'agent':{},'channel':_0x00ec('0x5e')};if(_0x2b2d62[_0x00ec('0x5a')]['id']){delete _0x2b2d62[_0x00ec('0x5a')]['id'];}_0x2b2d62[_0x00ec('0x5a')][_0x00ec('0x62')]=_0x2b2d62[_0x00ec('0x5a')][_0x00ec('0x62')]||_0x2b2d62[_0x00ec('0x69')]['id'];_0x5d22d6[_0x00ec('0x70')]['id']=_0x2b2d62[_0x00ec('0x5a')][_0x00ec('0x62')];return db['WhatsappMessage']['find']({'where':{'id':_0x2b2d62[_0x00ec('0x55')]['id'],'UserId':null}})[_0x00ec('0x38')](handleEntityNotFound(_0x444a1a,null))[_0x00ec('0x38')](function(_0xa8c3ab){if(_0xa8c3ab){_0x5d22d6[_0x00ec('0x28')]=_0xa8c3ab['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0xa8c3ab[_0x00ec('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x444a1a,null))[_0x00ec('0x38')](function(_0x5a6fec){if(_0x5a6fec){_0x5d22d6['interaction']=_0x5a6fec[_0x00ec('0x63')]({'plain':!![]});interaction_log[_0x00ec('0x29')](_0x00ec('0x7b'),_0x2b2d62[_0x00ec('0x69')]['id'],_0x2b2d62[_0x00ec('0x69')]['name'],_0x2b2d62[_0x00ec('0x69')][_0x00ec('0x7c')],_0x5d22d6[_0x00ec('0x68')]['id'],_0x2b2d62[_0x00ec('0x5a')]?JSON[_0x00ec('0x25')](_0x2b2d62[_0x00ec('0x5a')]):_0x00ec('0x7d'));return respondWithRpcPromise(_0x00ec('0x7e'),_0x00ec('0x7f'),_0x5d22d6);}return null;})[_0x00ec('0x38')](function(_0x4996ae){var _0x460d9b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4996ae['message'][_0x00ec('0x80')];return db[_0x00ec('0x6d')][_0x00ec('0x41')](_0x460d9b,{'type':db[_0x00ec('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x00ec('0x38')](function(_0x30caca){return _0x30caca;});})[_0x00ec('0x38')](function(_0x5cc3d3){if(_0x5cc3d3){_0x5d22d6[_0x00ec('0x28')]['contact']=_0x5cc3d3[0x0];if(!_0x2b2d62['body'][_0x00ec('0x62')])return;return db[_0x00ec('0x81')][_0x00ec('0x58')]({'where':{'id':_0x2b2d62[_0x00ec('0x5a')][_0x00ec('0x62')],'role':_0x00ec('0x70')},'attributes':['id','name','fullname','email',_0x00ec('0x73')],'raw':!![]});}return null;})[_0x00ec('0x38')](function(_0x5af7ba){if(!_0x5af7ba)return null;_0x5d22d6[_0x00ec('0x28')][_0x00ec('0x70')]=_0x5af7ba;return _0x5d22d6;})[_0x00ec('0x38')](function(_0x6cf35d){if(_0x6cf35d){_0x6cf35d[_0x00ec('0x28')][_0x00ec('0x75')]=util[_0x00ec('0x61')](_0x00ec('0x76'),_0x2b2d62[_0x00ec('0x69')][_0x00ec('0x3a')]);_0x6cf35d['message']['channel']=_0x5d22d6['channel'];_0x6cf35d[_0x00ec('0x28')]['motionChannel']=_0x5d22d6['channel'];_0x6cf35d[_0x00ec('0x28')][_0x00ec('0x82')]='reject';respondWithRpcPromise(_0x00ec('0x79'),_0x00ec('0x79'),{'event':_0x00ec('0x83'),'message':_0x6cf35d[_0x00ec('0x28')]},client9002);return _0x5d22d6;}return null;})[_0x00ec('0x38')](respondWithResult(_0x444a1a,null))['catch'](handleError(_0x444a1a,null));};exports[_0x00ec('0x2c')]=function(_0x47992e,_0x42097a,_0x20fba2){if(_0x47992e[_0x00ec('0x5a')]['id']){delete _0x47992e[_0x00ec('0x5a')]['id'];}var _0x2699be;return db[_0x00ec('0x3e')][_0x00ec('0x58')]({'where':{'id':_0x47992e['params']['id']}})[_0x00ec('0x38')](handleEntityNotFound(_0x42097a,null))[_0x00ec('0x38')](function(_0x1eae4e){if(_0x1eae4e){_0x2699be=_0x1eae4e;return db[_0x00ec('0x84')][_0x00ec('0x58')]({'where':{'id':_0x1eae4e[_0x00ec('0x85')]}});}})[_0x00ec('0x38')](handleEntityNotFound(_0x42097a,null))['then'](function(_0xfdfa2a){if(_0xfdfa2a){logger[_0x00ec('0x23')](_0x00ec('0x86'),_0x00ec('0x2c'),'received\x20delivery\x20report\x20from',_0xfdfa2a['type'],util[_0x00ec('0x87')](_0x47992e[_0x00ec('0x5a')],{'showHidden':![],'depth':null}));switch(_0xfdfa2a[_0x00ec('0x50')]){case _0x00ec('0x88'):if(_0x47992e[_0x00ec('0x5a')][_0x00ec('0x89')]&&_0x47992e[_0x00ec('0x5a')]['MessageSid']===_0x2699be[_0x00ec('0x8a')]&&_0x47992e[_0x00ec('0x5a')][_0x00ec('0x8b')]&&_0x47992e[_0x00ec('0x5a')][_0x00ec('0x8b')]===_0x00ec('0x5f')){return _0x2699be[_0x00ec('0x37')]({'read':!![]});}else{logger[_0x00ec('0x26')](_0x00ec('0x8c'),_0x00ec('0x2c'),_0x00ec('0x88'),util['inspect'](_0x47992e[_0x00ec('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2699be;}})[_0x00ec('0x38')](respondWithResult(_0x42097a,null))[_0x00ec('0x2a')](handleError(_0x42097a,null));}; \ No newline at end of file +var _0x7c50=['stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','motionChannel','event','rejectmessage','WhatsappAccount','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','json','apply','save','update','destroy','sendStatus','name','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','role'];(function(_0x47937f,_0x73cd3){var _0x73dba4=function(_0xdf5ed7){while(--_0xdf5ed7){_0x47937f['push'](_0x47937f['shift']());}};_0x73dba4(++_0x73cd3);}(_0x7c50,0x190));var _0x07c5=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x7c50[_0x1bbc08];return _0x5d825b;};'use strict';var emlformat=require(_0x07c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07c5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07c5('0x2'));var moment=require(_0x07c5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07c5('0x4'));var util=require(_0x07c5('0x5'));var path=require(_0x07c5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07c5('0x7'));var _=require(_0x07c5('0x8'));var squel=require(_0x07c5('0x9'));var crypto=require(_0x07c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x07c5('0xb'));var toCsv=require(_0x07c5('0xc'));var querystring=require(_0x07c5('0xd'));var Papa=require('papaparse');var Redis=require(_0x07c5('0xe'));var authService=require(_0x07c5('0xf'));var qs=require(_0x07c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07c5('0x11'))(_0x07c5('0x12'));var utils=require(_0x07c5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x07c5('0x14'));var db=require(_0x07c5('0x15'))['db'];config[_0x07c5('0x16')]=_[_0x07c5('0x17')](config[_0x07c5('0x16')],{'host':_0x07c5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07c5('0x16')]));require('./whatsappMessage.socket')[_0x07c5('0x19')](socket);var jayson=require(_0x07c5('0x1a'));var client=jayson['client'][_0x07c5('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x07c5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x310cd4,_0x4436d4,_0x5ca369,_0x3e693a){return new BPromise(function(_0xbe7149,_0x41c5fb){var _0x3d2dc8=_0x3e693a||client;return _0x3d2dc8[_0x07c5('0x1c')](_0x310cd4,_0x5ca369)[_0x07c5('0x1d')](function(_0xb9e7be){logger[_0x07c5('0x1e')](_0x07c5('0x1f'),_0x4436d4,_0x07c5('0x20'));logger[_0x07c5('0x21')](_0x07c5('0x22'),_0x4436d4,_0x07c5('0x20'),JSON['stringify'](_0xb9e7be));if(_0xb9e7be[_0x07c5('0x23')]){if(_0xb9e7be['error'][_0x07c5('0x24')]===0x1f4){logger[_0x07c5('0x23')](_0x07c5('0x1f'),_0x4436d4,_0xb9e7be[_0x07c5('0x23')][_0x07c5('0x25')]);return _0x41c5fb(_0xb9e7be[_0x07c5('0x23')][_0x07c5('0x25')]);}logger[_0x07c5('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x4436d4,_0xb9e7be[_0x07c5('0x23')]['message']);return _0xbe7149(_0xb9e7be[_0x07c5('0x23')][_0x07c5('0x25')]);}else{logger['info'](_0x07c5('0x1f'),_0x4436d4,'request\x20sent');_0xbe7149(_0xb9e7be[_0x07c5('0x26')][_0x07c5('0x25')]);}})[_0x07c5('0x27')](function(_0xbec45){logger['error'](_0x07c5('0x1f'),_0x4436d4,_0xbec45);_0x41c5fb(_0xbec45);});});}function respondWithStatusCode(_0x43abf0,_0x53b5a6){_0x53b5a6=_0x53b5a6||0xcc;return function(_0x2cbe9a){if(_0x2cbe9a){return _0x43abf0['sendStatus'](_0x53b5a6);}return _0x43abf0[_0x07c5('0x28')](_0x53b5a6)[_0x07c5('0x29')]();};}function respondWithResult(_0x4805ae,_0x2a2091){_0x2a2091=_0x2a2091||0xc8;return function(_0x2b19c4){if(_0x2b19c4){return _0x4805ae[_0x07c5('0x28')](_0x2a2091)['json'](_0x2b19c4);}};}function respondWithFilteredResult(_0x26e7d3,_0x435d25){return function(_0x13bd0a){if(_0x13bd0a){var _0x241fdc=typeof _0x435d25['offset']===_0x07c5('0x2a')&&typeof _0x435d25[_0x07c5('0x2b')]===_0x07c5('0x2a');var _0x4b88f8=_0x13bd0a[_0x07c5('0x2c')];var _0x344e9d=_0x241fdc?0x0:_0x435d25[_0x07c5('0x2d')];var _0x4c6830=_0x241fdc?_0x13bd0a['count']:_0x435d25[_0x07c5('0x2d')]+_0x435d25[_0x07c5('0x2b')];var _0x455cf6;if(_0x4c6830>=_0x4b88f8){_0x4c6830=_0x4b88f8;_0x455cf6=0xc8;}else{_0x455cf6=0xce;}_0x26e7d3[_0x07c5('0x28')](_0x455cf6);return _0x26e7d3[_0x07c5('0x2e')]('Content-Range',_0x344e9d+'-'+_0x4c6830+'/'+_0x4b88f8)[_0x07c5('0x2f')](_0x13bd0a);}return null;};}function patchUpdates(_0x584e0c){return function(_0x2246d5){try{jsonpatch[_0x07c5('0x30')](_0x2246d5,_0x584e0c,!![]);}catch(_0x192ea0){return BPromise['reject'](_0x192ea0);}return _0x2246d5[_0x07c5('0x31')]();};}function saveUpdates(_0x59695d,_0x553b6a){return function(_0x1738df){if(_0x1738df){return _0x1738df[_0x07c5('0x32')](_0x59695d)[_0x07c5('0x1d')](function(_0x504b9f){return _0x504b9f;});}return null;};}function removeEntity(_0x156c91,_0x295f66){return function(_0x37e461){if(_0x37e461){return _0x37e461[_0x07c5('0x33')]()['then'](function(){_0x156c91[_0x07c5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf78042,_0x4f68b0){return function(_0x38220e){if(!_0x38220e){_0xf78042[_0x07c5('0x34')](0x194);}return _0x38220e;};}function handleError(_0x137015,_0x366bc8){_0x366bc8=_0x366bc8||0x1f4;return function(_0x45bdb0){logger[_0x07c5('0x23')](_0x45bdb0['stack']);if(_0x45bdb0[_0x07c5('0x35')]){delete _0x45bdb0[_0x07c5('0x35')];}_0x137015['status'](_0x366bc8)['send'](_0x45bdb0);};}exports['index']=function(_0x4e6418,_0x1ff820){var _0x2f2a10={},_0x376692={},_0x9ed9b1={'count':0x0,'rows':[]};var _0x540abf=_[_0x07c5('0x36')](db['WhatsappMessage']['rawAttributes'],function(_0x783760){return{'name':_0x783760['fieldName'],'type':_0x783760[_0x07c5('0x37')][_0x07c5('0x38')]};});_0x376692[_0x07c5('0x39')]=_[_0x07c5('0x36')](_0x540abf,_0x07c5('0x35'));_0x376692[_0x07c5('0x3a')]=_[_0x07c5('0x3b')](_0x4e6418[_0x07c5('0x3a')]);_0x376692[_0x07c5('0x3c')]=_[_0x07c5('0x3d')](_0x376692['model'],_0x376692[_0x07c5('0x3a')]);_0x2f2a10[_0x07c5('0x3e')]=_[_0x07c5('0x3d')](_0x376692['model'],qs[_0x07c5('0x3f')](_0x4e6418[_0x07c5('0x3a')][_0x07c5('0x3f')]));_0x2f2a10[_0x07c5('0x3e')]=_0x2f2a10[_0x07c5('0x3e')]['length']?_0x2f2a10[_0x07c5('0x3e')]:_0x376692['model'];if(!_0x4e6418['query'][_0x07c5('0x40')](_0x07c5('0x41'))){_0x2f2a10[_0x07c5('0x2b')]=qs[_0x07c5('0x2b')](_0x4e6418[_0x07c5('0x3a')][_0x07c5('0x2b')]);_0x2f2a10['offset']=qs[_0x07c5('0x2d')](_0x4e6418[_0x07c5('0x3a')][_0x07c5('0x2d')]);}_0x2f2a10['order']=qs[_0x07c5('0x42')](_0x4e6418['query'][_0x07c5('0x42')]);_0x2f2a10[_0x07c5('0x43')]=qs[_0x07c5('0x3c')](_['pick'](_0x4e6418[_0x07c5('0x3a')],_0x376692[_0x07c5('0x3c')]),_0x540abf);if(_0x4e6418['query'][_0x07c5('0x44')]){_0x2f2a10[_0x07c5('0x43')]=_['merge'](_0x2f2a10[_0x07c5('0x43')],{'$or':_['map'](_0x540abf,function(_0x40de9b){if(_0x40de9b[_0x07c5('0x37')]!=='VIRTUAL'){var _0x535593={};_0x535593[_0x40de9b[_0x07c5('0x35')]]={'$like':'%'+_0x4e6418[_0x07c5('0x3a')][_0x07c5('0x44')]+'%'};return _0x535593;}})});}_0x2f2a10=_[_0x07c5('0x45')]({},_0x2f2a10,_0x4e6418[_0x07c5('0x46')]);var _0x131918={'where':_0x2f2a10[_0x07c5('0x43')]};return db[_0x07c5('0x47')][_0x07c5('0x2c')](_0x131918)[_0x07c5('0x1d')](function(_0xfa1497){_0x9ed9b1[_0x07c5('0x2c')]=_0xfa1497;if(_0x4e6418[_0x07c5('0x3a')][_0x07c5('0x48')]){_0x2f2a10[_0x07c5('0x49')]=[{'all':!![]}];}return db[_0x07c5('0x47')][_0x07c5('0x4a')](_0x2f2a10);})['then'](function(_0x5068d8){_0x9ed9b1[_0x07c5('0x4b')]=_0x5068d8;return _0x9ed9b1;})[_0x07c5('0x1d')](respondWithFilteredResult(_0x1ff820,_0x2f2a10))['catch'](handleError(_0x1ff820,null));};exports[_0x07c5('0x4c')]=function(_0x42afc8,_0x4495bd){var _0x38a665={'raw':!![],'where':{'id':_0x42afc8[_0x07c5('0x4d')]['id']}},_0x2eeef8={};_0x2eeef8[_0x07c5('0x39')]=_[_0x07c5('0x3b')](db[_0x07c5('0x47')]['rawAttributes']);_0x2eeef8[_0x07c5('0x3a')]=_[_0x07c5('0x3b')](_0x42afc8['query']);_0x2eeef8[_0x07c5('0x3c')]=_[_0x07c5('0x3d')](_0x2eeef8['model'],_0x2eeef8['query']);_0x38a665['attributes']=_[_0x07c5('0x3d')](_0x2eeef8[_0x07c5('0x39')],qs[_0x07c5('0x3f')](_0x42afc8[_0x07c5('0x3a')][_0x07c5('0x3f')]));_0x38a665['attributes']=_0x38a665[_0x07c5('0x3e')][_0x07c5('0x4e')]?_0x38a665[_0x07c5('0x3e')]:_0x2eeef8[_0x07c5('0x39')];if(_0x42afc8[_0x07c5('0x3a')][_0x07c5('0x48')]){_0x38a665[_0x07c5('0x49')]=[{'all':!![]}];}_0x38a665=_[_0x07c5('0x45')]({},_0x38a665,_0x42afc8[_0x07c5('0x46')]);return db['WhatsappMessage'][_0x07c5('0x4f')](_0x38a665)[_0x07c5('0x1d')](handleEntityNotFound(_0x4495bd,null))[_0x07c5('0x1d')](respondWithResult(_0x4495bd,null))['catch'](handleError(_0x4495bd,null));};exports['create']=function(_0x3f0238,_0x3c2609){return db['WhatsappMessage'][_0x07c5('0x50')](_0x3f0238['body'],{})[_0x07c5('0x1d')](respondWithResult(_0x3c2609,0xc9))['catch'](handleError(_0x3c2609,null));};exports[_0x07c5('0x32')]=function(_0x215265,_0x10b1ce){if(_0x215265[_0x07c5('0x51')]['id']){delete _0x215265[_0x07c5('0x51')]['id'];}return db[_0x07c5('0x47')]['find']({'where':{'id':_0x215265[_0x07c5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x10b1ce,null))[_0x07c5('0x1d')](saveUpdates(_0x215265[_0x07c5('0x51')],null))[_0x07c5('0x1d')](respondWithResult(_0x10b1ce,null))[_0x07c5('0x27')](handleError(_0x10b1ce,null));};exports[_0x07c5('0x33')]=function(_0x48ab12,_0x58bcda){return db[_0x07c5('0x47')][_0x07c5('0x4f')]({'where':{'id':_0x48ab12[_0x07c5('0x4d')]['id']}})[_0x07c5('0x1d')](handleEntityNotFound(_0x58bcda,null))[_0x07c5('0x1d')](removeEntity(_0x58bcda,null))[_0x07c5('0x27')](handleError(_0x58bcda,null));};exports[_0x07c5('0x52')]=function(_0x19f484,_0x44e87d){return db[_0x07c5('0x47')]['describe']()[_0x07c5('0x1d')](respondWithResult(_0x44e87d,null))['catch'](handleError(_0x44e87d,null));};var interaction_log=require(_0x07c5('0x11'))(_0x07c5('0x53'));exports[_0x07c5('0x54')]=function(_0x17692a,_0x4b16b5,_0x26bc99){var _0x720282={'agent':{},'channel':_0x07c5('0x55')};if(_0x17692a[_0x07c5('0x51')]['id']){delete _0x17692a[_0x07c5('0x51')]['id'];}_0x17692a[_0x07c5('0x51')][_0x07c5('0x56')]=!![];_0x17692a[_0x07c5('0x51')][_0x07c5('0x57')]=moment()[_0x07c5('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x17692a[_0x07c5('0x51')][_0x07c5('0x59')]=_0x17692a[_0x07c5('0x51')][_0x07c5('0x59')]||_0x17692a[_0x07c5('0x5a')]['id'];_0x720282['agent']['id']=_0x17692a[_0x07c5('0x51')][_0x07c5('0x59')];return db[_0x07c5('0x47')][_0x07c5('0x4f')]({'where':{'id':_0x17692a['params']['id'],'UserId':null}})[_0x07c5('0x1d')](handleEntityNotFound(_0x4b16b5,null))['then'](saveUpdates(_0x17692a['body'],null))['then'](function(_0x5ea005){if(_0x5ea005){_0x720282[_0x07c5('0x25')]=_0x5ea005['get']({'plain':!![]});return db[_0x07c5('0x5b')][_0x07c5('0x4f')]({'where':{'id':_0x5ea005[_0x07c5('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x4b16b5,null))[_0x07c5('0x1d')](function(_0x155ad5){if(_0x155ad5){return _0x155ad5[_0x07c5('0x32')]({'UserId':_0x17692a[_0x07c5('0x51')]['UserId'],'read1stAt':_[_0x07c5('0x5d')](_0x155ad5[_0x07c5('0x5e')])?moment()['format'](_0x07c5('0x5f')):undefined});}return null;})[_0x07c5('0x1d')](function(_0x2ec2a4){if(_0x2ec2a4){_0x720282[_0x07c5('0x60')]=_0x2ec2a4[_0x07c5('0x61')]({'plain':!![]});interaction_log[_0x07c5('0x1e')](_0x07c5('0x62'),_0x17692a[_0x07c5('0x5a')]['id'],_0x17692a[_0x07c5('0x5a')][_0x07c5('0x35')],_0x17692a[_0x07c5('0x5a')]['role'],_0x720282[_0x07c5('0x60')]['id'],_0x17692a['body']?JSON['stringify'](_0x17692a['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x720282);}return null;})[_0x07c5('0x1d')](function(_0x309718){var _0xdce38f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x309718['message'][_0x07c5('0x63')];return db[_0x07c5('0x64')][_0x07c5('0x3a')](_0xdce38f,{'type':db[_0x07c5('0x65')][_0x07c5('0x66')][_0x07c5('0x67')],'raw':!![]})['then'](function(_0x4a5168){return _0x4a5168;});})['then'](function(_0x1aa5df){if(_0x1aa5df){_0x720282['message']['contact']=_0x1aa5df[0x0];if(!_0x17692a['body'][_0x07c5('0x59')])return;return db[_0x07c5('0x68')][_0x07c5('0x4f')]({'where':{'id':_0x17692a[_0x07c5('0x51')]['UserId'],'role':_0x07c5('0x69')},'attributes':['id',_0x07c5('0x35'),_0x07c5('0x6a'),'email',_0x07c5('0x6b')],'raw':!![]});}return null;})[_0x07c5('0x1d')](function(_0x58607e){if(!_0x58607e)return null;_0x720282[_0x07c5('0x25')][_0x07c5('0x69')]=_0x58607e;return _0x720282;})[_0x07c5('0x1d')](function(_0x2bb36b){if(_0x2bb36b){if(_0x17692a[_0x07c5('0x51')][_0x07c5('0x6c')]){_0x720282[_0x07c5('0x25')][_0x07c5('0x6d')]=util['format'](_0x07c5('0x6e'),_0x17692a[_0x07c5('0x5a')][_0x07c5('0x35')]);_0x720282[_0x07c5('0x25')]['channel']=_0x720282[_0x07c5('0x6f')];_0x720282[_0x07c5('0x25')]['motionChannel']=_0x720282[_0x07c5('0x6f')];_0x720282[_0x07c5('0x25')]['event']=_0x07c5('0x54');return respondWithRpcPromise(_0x07c5('0x70'),_0x07c5('0x70'),{'event':_0x07c5('0x71'),'message':_0x720282[_0x07c5('0x25')]},client9002)['then'](function(){return _0x720282;});}return _0x720282;}return null;})[_0x07c5('0x1d')](respondWithResult(_0x4b16b5,null))[_0x07c5('0x27')](handleError(_0x4b16b5,null));};var interaction_log=require('../../config/logger')(_0x07c5('0x53'));exports[_0x07c5('0x72')]=function(_0x4beeff,_0x4eae1f,_0x390ad6){var _0x2d7a09={'agent':{},'channel':'whatsapp'};if(_0x4beeff[_0x07c5('0x51')]['id']){delete _0x4beeff[_0x07c5('0x51')]['id'];}_0x4beeff['body'][_0x07c5('0x59')]=_0x4beeff[_0x07c5('0x51')][_0x07c5('0x59')]||_0x4beeff['user']['id'];_0x2d7a09[_0x07c5('0x69')]['id']=_0x4beeff['body'][_0x07c5('0x59')];return db[_0x07c5('0x47')][_0x07c5('0x4f')]({'where':{'id':_0x4beeff['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4eae1f,null))['then'](function(_0x47ebf3){if(_0x47ebf3){_0x2d7a09['message']=_0x47ebf3[_0x07c5('0x61')]({'plain':!![]});return db[_0x07c5('0x5b')][_0x07c5('0x4f')]({'where':{'id':_0x47ebf3[_0x07c5('0x5c')]}});}return null;})[_0x07c5('0x1d')](handleEntityNotFound(_0x4eae1f,null))[_0x07c5('0x1d')](function(_0x1ede48){if(_0x1ede48){_0x2d7a09['interaction']=_0x1ede48[_0x07c5('0x61')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4beeff[_0x07c5('0x5a')]['id'],_0x4beeff['user'][_0x07c5('0x35')],_0x4beeff['user'][_0x07c5('0x73')],_0x2d7a09[_0x07c5('0x60')]['id'],_0x4beeff[_0x07c5('0x51')]?JSON[_0x07c5('0x74')](_0x4beeff[_0x07c5('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0x07c5('0x75'),_0x2d7a09);}return null;})[_0x07c5('0x1d')](function(_0x281f7f){var _0xfd36c=_0x07c5('0x76')+_0x281f7f[_0x07c5('0x25')][_0x07c5('0x63')];return db['sequelize']['query'](_0xfd36c,{'type':db[_0x07c5('0x65')]['QueryTypes'][_0x07c5('0x67')],'raw':!![]})[_0x07c5('0x1d')](function(_0x21e585){return _0x21e585;});})['then'](function(_0x5bd129){if(_0x5bd129){_0x2d7a09[_0x07c5('0x25')][_0x07c5('0x77')]=_0x5bd129[0x0];if(!_0x4beeff[_0x07c5('0x51')]['UserId'])return;return db[_0x07c5('0x68')][_0x07c5('0x4f')]({'where':{'id':_0x4beeff[_0x07c5('0x51')][_0x07c5('0x59')],'role':'agent'},'attributes':['id',_0x07c5('0x35'),_0x07c5('0x6a'),'email',_0x07c5('0x6b')],'raw':!![]});}return null;})['then'](function(_0x269004){if(!_0x269004)return null;_0x2d7a09[_0x07c5('0x25')][_0x07c5('0x69')]=_0x269004;return _0x2d7a09;})[_0x07c5('0x1d')](function(_0x3f8679){if(_0x3f8679){_0x3f8679['message'][_0x07c5('0x6d')]=util[_0x07c5('0x58')](_0x07c5('0x6e'),_0x4beeff['user']['name']);_0x3f8679['message']['channel']=_0x2d7a09[_0x07c5('0x6f')];_0x3f8679[_0x07c5('0x25')][_0x07c5('0x78')]=_0x2d7a09['channel'];_0x3f8679[_0x07c5('0x25')][_0x07c5('0x79')]=_0x07c5('0x72');respondWithRpcPromise('EventManager','EventManager',{'event':_0x07c5('0x7a'),'message':_0x3f8679['message']},client9002);return _0x2d7a09;}return null;})[_0x07c5('0x1d')](respondWithResult(_0x4eae1f,null))[_0x07c5('0x27')](handleError(_0x4eae1f,null));};exports[_0x07c5('0x28')]=function(_0x3a26b0,_0x495b0e,_0x4c250b){if(_0x3a26b0[_0x07c5('0x51')]['id']){delete _0x3a26b0[_0x07c5('0x51')]['id'];}var _0x4e10bf;return db[_0x07c5('0x47')][_0x07c5('0x4f')]({'where':{'id':_0x3a26b0['params']['id']}})[_0x07c5('0x1d')](handleEntityNotFound(_0x495b0e,null))[_0x07c5('0x1d')](function(_0x2c785e){if(_0x2c785e){_0x4e10bf=_0x2c785e;return db[_0x07c5('0x7b')][_0x07c5('0x4f')]({'where':{'id':_0x2c785e['WhatsappAccountId']}});}})[_0x07c5('0x1d')](handleEntityNotFound(_0x495b0e,null))['then'](function(_0x3dee71){if(_0x3dee71){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x07c5('0x28'),'received\x20delivery\x20report\x20from',_0x3dee71[_0x07c5('0x37')],util[_0x07c5('0x7c')](_0x3a26b0[_0x07c5('0x51')],{'showHidden':![],'depth':null}));switch(_0x3dee71[_0x07c5('0x37')]){case _0x07c5('0x7d'):if(_0x3a26b0[_0x07c5('0x51')][_0x07c5('0x7e')]&&_0x3a26b0[_0x07c5('0x51')]['MessageSid']===_0x4e10bf[_0x07c5('0x7f')]&&_0x3a26b0[_0x07c5('0x51')]['MessageStatus']&&_0x3a26b0[_0x07c5('0x51')]['MessageStatus']==='read'){return _0x4e10bf[_0x07c5('0x32')]({'read':!![]});}else{logger[_0x07c5('0x23')](_0x07c5('0x80'),_0x07c5('0x28'),'twilio',util[_0x07c5('0x7c')](_0x3a26b0[_0x07c5('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x4e10bf;}})[_0x07c5('0x1d')](respondWithResult(_0x495b0e,null))['catch'](handleError(_0x495b0e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 4394914..0d63232 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 _0xe28e=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xe28e,0x1ba));var _0xee28=function(_0x207a26,_0x221fce){_0x207a26=_0x207a26-0x0;var _0x549ac7=_0xe28e[_0x207a26];return _0x549ac7;};'use strict';var EventEmitter=require(_0xee28('0x0'));var WhatsappMessage=require(_0xee28('0x1'))['db'][_0xee28('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xee28('0x3')](0x0);var events={'afterCreate':_0xee28('0x4'),'afterUpdate':_0xee28('0x5'),'afterDestroy':_0xee28('0x6')};function emitEvent(_0x9f2216){return function(_0xdc22c0,_0x40fdf8,_0x1c7cb1){WhatsappMessageEvents[_0xee28('0x7')](_0x9f2216+':'+_0xdc22c0['id'],_0xdc22c0);WhatsappMessageEvents[_0xee28('0x7')](_0x9f2216,_0xdc22c0);_0x1c7cb1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xee28('0x8')](e,emitEvent(event));}}module[_0xee28('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4fc2=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x4fc2,0x111));var _0x24fc=function(_0x5e8a2e,_0x3deead){_0x5e8a2e=_0x5e8a2e-0x0;var _0x20a417=_0x4fc2[_0x5e8a2e];return _0x20a417;};'use strict';var EventEmitter=require(_0x24fc('0x0'));var WhatsappMessage=require(_0x24fc('0x1'))['db'][_0x24fc('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x24fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x24fc('0x4'),'afterDestroy':_0x24fc('0x5')};function emitEvent(_0x1e7fdf){return function(_0x541ad2,_0x126d90,_0x3772eb){WhatsappMessageEvents['emit'](_0x1e7fdf+':'+_0x541ad2['id'],_0x541ad2);WhatsappMessageEvents[_0x24fc('0x6')](_0x1e7fdf,_0x541ad2);_0x3772eb(null);};}for(var e in events){if(events[_0x24fc('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x24fc('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 96d0a34..5750f60 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 _0xd72c=['message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json'];(function(_0x139325,_0x2052ea){var _0x585d8c=function(_0x4e683f){while(--_0x4e683f){_0x139325['push'](_0x139325['shift']());}};_0x585d8c(++_0x2052ea);}(_0xd72c,0xb0));var _0xcd72=function(_0x4048ff,_0x3f346a){_0x4048ff=_0x4048ff-0x0;var _0x267efb=_0xd72c[_0x4048ff];return _0x267efb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcd72('0x0'));var BPromise=require(_0xcd72('0x1'));var rp=require(_0xcd72('0x2'));var fetch=require(_0xcd72('0x3'));var fs=require('fs');var path=require(_0xcd72('0x4'));var rimraf=require(_0xcd72('0x5'));var config=require(_0xcd72('0x6'));var attributes=require(_0xcd72('0x7'));module[_0xcd72('0x8')]=function(_0x2d0a23,_0x2d6ec1){return _0x2d0a23[_0xcd72('0x9')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcd72('0xa')]},{'name':_0xcd72('0xb'),'fields':[_0xcd72('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3edabd,_0x28fa52,_0x31acc2){var _0x1a17b4=_0x2d0a23[_0xcd72('0xd')];var _0x529c0a=_0x3edabd[_0xcd72('0xe')]({'plain':!![]});if(_0x529c0a[_0xcd72('0xf')][_0xcd72('0x10')]()==='in'||_0x529c0a[_0xcd72('0xf')][_0xcd72('0x10')]()===_0xcd72('0x11')&&!_0x529c0a[_0xcd72('0x12')]&&!_['isNil'](_0x529c0a[_0xcd72('0x13')])){_0x1a17b4['WhatsappInteraction'][_0xcd72('0x14')]({'where':{'id':_0x529c0a[_0xcd72('0x15')]}})['then'](function(_0x435f70){if(_0x435f70){_0x435f70[_0xcd72('0x16')]({'lastMsgAt':_0x529c0a[_0xcd72('0x17')],'lastMsgDirection':_0x529c0a[_0xcd72('0xf')][_0xcd72('0x10')]()});}})[_0xcd72('0x18')](function(_0xc43064){console[_0xcd72('0x19')](_0xc43064);});}if(_0x529c0a['direction']===_0xcd72('0x11')&&!_0x529c0a[_0xcd72('0x12')]){var _0x1aca59;_0x1a17b4[_0xcd72('0x1a')][_0xcd72('0x1b')]({'where':{'id':_0x529c0a[_0xcd72('0x1c')]},'raw':!![]})[_0xcd72('0x1d')](function(_0x4e2419){_0x1aca59=_0x4e2419;if(_0x1aca59&&_0x1aca59[_0xcd72('0x1e')]){switch(_0x1aca59[_0xcd72('0x1e')]){case _0xcd72('0x1f'):var _0x329c47=require(_0xcd72('0x1f'));if(_0x1aca59[_0xcd72('0x20')]&&_0x1aca59['authToken']&&_0x1aca59['phone']){var _0x599854=new _0x329c47(_0x1aca59[_0xcd72('0x20')],_0x1aca59['authToken']);_0x599854[_0xcd72('0x21')][_0xcd72('0x22')]({'body':_0x529c0a[_0xcd72('0xc')],'to':_0xcd72('0x23')+_0x529c0a[_0xcd72('0x24')],'from':_0xcd72('0x23')+_0x1aca59['phone'],'statusCallback':_0x1aca59[_0xcd72('0x25')]+'/api/whatsapp/messages/'+_0x529c0a['id']+_0xcd72('0x26')+_0x1aca59[_0xcd72('0x27')]})[_0xcd72('0x1d')](function(_0x2213a3){if(_0x2213a3[_0xcd72('0x28')]){return _0x3edabd[_0xcd72('0x16')]({'messageId':_0x2213a3[_0xcd72('0x28')]});}})[_0xcd72('0x18')](function(_0x1522d3){logger[_0xcd72('0x19')](_0xcd72('0x29'),_0xcd72('0x2a'),_0xcd72('0x1f'),util[_0xcd72('0x2b')](_0x1522d3,{'showHidden':![],'depth':null}));});}else{logger[_0xcd72('0x19')](_0xcd72('0x29'),_0xcd72('0x2a'),_0xcd72('0x1f'),_0xcd72('0x2c'));}break;case _0xcd72('0x2d'):var _0x369c06=_0x1aca59[_0xcd72('0x20')];var _0x908da1=_0x1aca59[_0xcd72('0x2e')];var _0x3b248d=_0x1aca59[_0xcd72('0x2f')]+_0xcd72('0x30')+_0x369c06+'/messages/';var _0x43cee8={'to':[_0x529c0a[_0xcd72('0x24')]],'message':{'type':'text','text':_0x529c0a[_0xcd72('0xc')]}};var _0x1be63c={'method':_0xcd72('0x31'),'uri':_0x3b248d,'headers':{'Authorization':_0xcd72('0x32')+_0x908da1,'Content-Type':_0xcd72('0x33')},'body':_0x43cee8,'json':!![]};rp(_0x1be63c)[_0xcd72('0x1d')](function(_0x54566d){if(_0x54566d['statuses'][0x0][_0xcd72('0x34')]){return _0x3edabd[_0xcd72('0x16')]({'messageId':_0x54566d['statuses'][0x0][_0xcd72('0x34')]});}})['catch'](function(_0x436b6d){logger[_0xcd72('0x35')](_0xcd72('0x36'),_0x436b6d);});break;}}})[_0xcd72('0x37')](function(){_0x31acc2();});}else{_0x31acc2();}}},'charset':_0xcd72('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdfc7=['exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','get','direction','toLowerCase','out','isNil','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','authToken','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdfc7,0x105));var _0x7dfc=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xdfc7[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x7dfc('0x0'));var util=require('util');var logger=require(_0x7dfc('0x1'))(_0x7dfc('0x2'));var moment=require(_0x7dfc('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dfc('0x4'));var fetch=require(_0x7dfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7dfc('0x6'));var config=require(_0x7dfc('0x7'));var attributes=require(_0x7dfc('0x8'));module[_0x7dfc('0x9')]=function(_0x42b304,_0x28c980){return _0x42b304[_0x7dfc('0xa')](_0x7dfc('0xb'),attributes,{'tableName':_0x7dfc('0xc'),'paranoid':![],'indexes':[{'name':_0x7dfc('0xd'),'fields':[_0x7dfc('0xd')]},{'name':_0x7dfc('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x938c51,_0xbaab6a,_0x2e3973){var _0x10d442=_0x42b304['models'];var _0x3b5580=_0x938c51[_0x7dfc('0xf')]({'plain':!![]});if(_0x3b5580[_0x7dfc('0x10')][_0x7dfc('0x11')]()==='in'||_0x3b5580['direction'][_0x7dfc('0x11')]()===_0x7dfc('0x12')&&!_0x3b5580['secret']&&!_[_0x7dfc('0x13')](_0x3b5580['UserId'])){_0x10d442['WhatsappInteraction']['findOne']({'where':{'id':_0x3b5580[_0x7dfc('0x14')]}})[_0x7dfc('0x15')](function(_0x45d7ed){if(_0x45d7ed){_0x45d7ed[_0x7dfc('0x16')]({'lastMsgAt':_0x3b5580[_0x7dfc('0x17')],'lastMsgDirection':_0x3b5580[_0x7dfc('0x10')][_0x7dfc('0x11')]()});}})[_0x7dfc('0x18')](function(_0xd21270){console[_0x7dfc('0x19')](_0xd21270);});}if(_0x3b5580[_0x7dfc('0x10')]===_0x7dfc('0x12')&&!_0x3b5580['secret']){var _0x15b78b;_0x10d442[_0x7dfc('0x1a')][_0x7dfc('0x1b')]({'where':{'id':_0x3b5580['WhatsappAccountId']},'raw':!![]})[_0x7dfc('0x15')](function(_0x14f353){_0x15b78b=_0x14f353;if(_0x15b78b&&_0x15b78b[_0x7dfc('0x1c')]){switch(_0x15b78b['type']){case _0x7dfc('0x1d'):var _0x587d18=require(_0x7dfc('0x1d'));if(_0x15b78b[_0x7dfc('0x1e')]&&_0x15b78b['authToken']&&_0x15b78b['phone']){var _0xdcf081=new _0x587d18(_0x15b78b['accountSid'],_0x15b78b['authToken']);_0xdcf081[_0x7dfc('0x1f')][_0x7dfc('0x20')]({'body':_0x3b5580[_0x7dfc('0x21')],'to':_0x7dfc('0x22')+_0x3b5580[_0x7dfc('0x23')],'from':_0x7dfc('0x22')+_0x15b78b[_0x7dfc('0x23')],'statusCallback':_0x15b78b[_0x7dfc('0x24')]+_0x7dfc('0x25')+_0x3b5580['id']+'/status?token='+_0x15b78b[_0x7dfc('0x26')]})['then'](function(_0x25444f){if(_0x25444f['sid']){return _0x938c51['update']({'messageId':_0x25444f['sid']});}})[_0x7dfc('0x18')](function(_0x5e23ed){logger['error'](_0x7dfc('0x27'),'afterCreate',_0x7dfc('0x1d'),util[_0x7dfc('0x28')](_0x5e23ed,{'showHidden':![],'depth':null}));});}else{logger[_0x7dfc('0x19')](_0x7dfc('0x27'),_0x7dfc('0x29'),_0x7dfc('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7dfc('0x2a'):var _0x2a4bb0=_0x15b78b['accountSid'];var _0x362b08=_0x15b78b[_0x7dfc('0x2b')];var _0x3edb48=_0x15b78b['baseUrl']+_0x7dfc('0x2c')+_0x2a4bb0+'/messages/';var _0x386191={'to':[_0x3b5580['phone']],'message':{'type':_0x7dfc('0x2d'),'text':_0x3b5580[_0x7dfc('0x21')]}};var _0x4a1e12={'method':_0x7dfc('0x2e'),'uri':_0x3edb48,'headers':{'Authorization':_0x7dfc('0x2f')+_0x362b08,'Content-Type':_0x7dfc('0x30')},'body':_0x386191,'json':!![]};rp(_0x4a1e12)[_0x7dfc('0x15')](function(_0x20baed){if(_0x20baed[_0x7dfc('0x31')][0x0][_0x7dfc('0x32')]){return _0x938c51[_0x7dfc('0x16')]({'messageId':_0x20baed['statuses'][0x0][_0x7dfc('0x32')]});}})['catch'](function(_0x1a594e){logger[_0x7dfc('0x33')](_0x7dfc('0x34'),_0x1a594e);});break;}}})['finally'](function(){_0x2e3973();});}else{_0x2e3973();}}},'charset':'utf8mb4','collate':_0x7dfc('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 12150bb..322f825 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 _0x3283=['catch','CreateWhatsappMessage','body','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x44fc19,_0x2113d5){var _0x220365=function(_0x462216){while(--_0x462216){_0x44fc19['push'](_0x44fc19['shift']());}};_0x220365(++_0x2113d5);}(_0x3283,0x17e));var _0x3328=function(_0x38e3fc,_0x3dcda4){_0x38e3fc=_0x38e3fc-0x0;var _0x3b822f=_0x3283[_0x38e3fc];return _0x3b822f;};'use strict';var _=require(_0x3328('0x0'));var util=require('util');var moment=require(_0x3328('0x1'));var BPromise=require(_0x3328('0x2'));var rs=require(_0x3328('0x3'));var fs=require('fs');var Redis=require(_0x3328('0x4'));var db=require(_0x3328('0x5'))['db'];var utils=require(_0x3328('0x6'));var logger=require(_0x3328('0x7'))(_0x3328('0x8'));var config=require(_0x3328('0x9'));var jayson=require(_0x3328('0xa'));var client=jayson['client'][_0x3328('0xb')]({'port':0x232a});config[_0x3328('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3328('0xc')]));require(_0x3328('0xd'))[_0x3328('0xe')](socket);function respondWithRpcPromise(_0x5cfb21,_0x13f8a1,_0x8aa1d0){return new BPromise(function(_0xe4ff26,_0x4a8fca){return client[_0x3328('0xf')](_0x5cfb21,_0x8aa1d0)[_0x3328('0x10')](function(_0x5c232f){logger[_0x3328('0x11')](_0x3328('0x12'),_0x13f8a1,_0x3328('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x13f8a1,'request\x20sent',JSON[_0x3328('0x14')](_0x5c232f));if(_0x5c232f['error']){if(_0x5c232f[_0x3328('0x15')]['code']===0x1f4){logger[_0x3328('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x13f8a1,_0x5c232f[_0x3328('0x15')][_0x3328('0x16')]);return _0x4a8fca(_0x5c232f[_0x3328('0x15')][_0x3328('0x16')]);}logger[_0x3328('0x15')](_0x3328('0x12'),_0x13f8a1,_0x5c232f[_0x3328('0x15')][_0x3328('0x16')]);return _0xe4ff26(_0x5c232f[_0x3328('0x15')][_0x3328('0x16')]);}else{logger[_0x3328('0x11')](_0x3328('0x12'),_0x13f8a1,_0x3328('0x13'));_0xe4ff26(_0x5c232f[_0x3328('0x17')][_0x3328('0x16')]);}})[_0x3328('0x18')](function(_0x5adf0a){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x13f8a1,_0x5adf0a);_0x4a8fca(_0x5adf0a);});});}exports[_0x3328('0x19')]=function(_0x2786b8){var _0x55a169=this;return new Promise(function(_0x3460d5,_0x2c620e){return db['WhatsappMessage']['create'](_0x2786b8[_0x3328('0x1a')],{'raw':_0x2786b8['options']?_0x2786b8['options'][_0x3328('0x1b')]===undefined?!![]:![]:!![]})[_0x3328('0x10')](function(_0x1e8630){logger['info']('CreateWhatsappMessage',_0x2786b8);logger[_0x3328('0x1c')](_0x3328('0x19'),_0x2786b8,JSON[_0x3328('0x14')](_0x1e8630));_0x3460d5(_0x1e8630);})['catch'](function(_0x383b8e){logger[_0x3328('0x15')]('CreateWhatsappMessage',_0x383b8e[_0x3328('0x16')],_0x2786b8);_0x2c620e(_0x55a169[_0x3328('0x15')](0x1f4,_0x383b8e['message']));});});}; \ No newline at end of file +var _0x8c86=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateWhatsappMessage','WhatsappMessage','create','raw','catch','lodash','util','bluebird'];(function(_0x134b6e,_0x21b5ca){var _0x2229a9=function(_0x3fd3f5){while(--_0x3fd3f5){_0x134b6e['push'](_0x134b6e['shift']());}};_0x2229a9(++_0x21b5ca);}(_0x8c86,0xf9));var _0x68c8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8c86[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x68c8('0x0'));var util=require(_0x68c8('0x1'));var moment=require('moment');var BPromise=require(_0x68c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68c8('0x3'));var db=require(_0x68c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x68c8('0x5'))(_0x68c8('0x6'));var config=require(_0x68c8('0x7'));var jayson=require(_0x68c8('0x8'));var client=jayson['client'][_0x68c8('0x9')]({'port':0x232a});config[_0x68c8('0xa')]=_[_0x68c8('0xb')](config[_0x68c8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68c8('0xa')]));require('./whatsappMessage.socket')[_0x68c8('0xc')](socket);function respondWithRpcPromise(_0x8347bf,_0x5477e9,_0x549867){return new BPromise(function(_0x17cf47,_0x3d34d5){return client[_0x68c8('0xd')](_0x8347bf,_0x549867)[_0x68c8('0xe')](function(_0x531e9e){logger[_0x68c8('0xf')](_0x68c8('0x10'),_0x5477e9,'request\x20sent');logger[_0x68c8('0x11')](_0x68c8('0x12'),_0x5477e9,_0x68c8('0x13'),JSON['stringify'](_0x531e9e));if(_0x531e9e[_0x68c8('0x14')]){if(_0x531e9e['error']['code']===0x1f4){logger['error'](_0x68c8('0x10'),_0x5477e9,_0x531e9e[_0x68c8('0x14')][_0x68c8('0x15')]);return _0x3d34d5(_0x531e9e['error'][_0x68c8('0x15')]);}logger[_0x68c8('0x14')](_0x68c8('0x10'),_0x5477e9,_0x531e9e['error'][_0x68c8('0x15')]);return _0x17cf47(_0x531e9e[_0x68c8('0x14')][_0x68c8('0x15')]);}else{logger[_0x68c8('0xf')](_0x68c8('0x10'),_0x5477e9,'request\x20sent');_0x17cf47(_0x531e9e[_0x68c8('0x16')][_0x68c8('0x15')]);}})['catch'](function(_0x56eb70){logger['error'](_0x68c8('0x10'),_0x5477e9,_0x56eb70);_0x3d34d5(_0x56eb70);});});}exports[_0x68c8('0x17')]=function(_0x3e7da1){var _0x2aba82=this;return new Promise(function(_0xd6ba6e,_0x11c09c){return db[_0x68c8('0x18')][_0x68c8('0x19')](_0x3e7da1['body'],{'raw':_0x3e7da1['options']?_0x3e7da1['options'][_0x68c8('0x1a')]===undefined?!![]:![]:!![]})[_0x68c8('0xe')](function(_0x393b0f){logger[_0x68c8('0xf')](_0x68c8('0x17'),_0x3e7da1);logger['debug'](_0x68c8('0x17'),_0x3e7da1,JSON['stringify'](_0x393b0f));_0xd6ba6e(_0x393b0f);})[_0x68c8('0x1b')](function(_0x205660){logger[_0x68c8('0x14')](_0x68c8('0x17'),_0x205660[_0x68c8('0x15')],_0x3e7da1);_0x11c09c(_0x2aba82[_0x68c8('0x14')](0x1f4,_0x205660['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4bb7381..70329aa 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 _0xa040=['remove','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x4b4756,_0x4fbd44){var _0x3bce27=function(_0x4763a3){while(--_0x4763a3){_0x4b4756['push'](_0x4b4756['shift']());}};_0x3bce27(++_0x4fbd44);}(_0xa040,0x1c5));var _0x0a04=function(_0xccb6b6,_0x580021){_0xccb6b6=_0xccb6b6-0x0;var _0x141983=_0xa040[_0xccb6b6];return _0x141983;};'use strict';var WhatsappMessageEvents=require(_0x0a04('0x0'));var events=[_0x0a04('0x1'),_0x0a04('0x2'),'update'];function createListener(_0x115c71,_0x4153c7){return function(_0xca9ef){_0x4153c7[_0x0a04('0x3')](_0x115c71,_0xca9ef);};}function removeListener(_0x31858c,_0x45997c){return function(){WhatsappMessageEvents['removeListener'](_0x31858c,_0x45997c);};}exports[_0x0a04('0x4')]=function(_0x2c2b0b){for(var _0x54fbe4=0x0,_0x34b43e=events[_0x0a04('0x5')];_0x54fbe4<_0x34b43e;_0x54fbe4++){var _0x132216=events[_0x54fbe4];var _0x5334d9=createListener(_0x0a04('0x6')+_0x132216,_0x2c2b0b);WhatsappMessageEvents['on'](_0x132216,_0x5334d9);}}; \ No newline at end of file +var _0x83c6=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register'];(function(_0xf4cbbe,_0x2b1ef2){var _0x1b1494=function(_0x286115){while(--_0x286115){_0xf4cbbe['push'](_0xf4cbbe['shift']());}};_0x1b1494(++_0x2b1ef2);}(_0x83c6,0x92));var _0x683c=function(_0x5d93ec,_0xf45924){_0x5d93ec=_0x5d93ec-0x0;var _0x456a2e=_0x83c6[_0x5d93ec];return _0x456a2e;};'use strict';var WhatsappMessageEvents=require(_0x683c('0x0'));var events=[_0x683c('0x1'),_0x683c('0x2'),_0x683c('0x3')];function createListener(_0x1fa19b,_0x4e1feb){return function(_0x57cda0){_0x4e1feb['emit'](_0x1fa19b,_0x57cda0);};}function removeListener(_0x4e4749,_0x2deba9){return function(){WhatsappMessageEvents[_0x683c('0x4')](_0x4e4749,_0x2deba9);};}exports[_0x683c('0x5')]=function(_0x23379d){for(var _0x7d1512=0x0,_0x383c05=events[_0x683c('0x6')];_0x7d1512<_0x383c05;_0x7d1512++){var _0x53bda1=events[_0x7d1512];var _0x5e1ccf=createListener(_0x683c('0x7')+_0x53bda1,_0x23379d);WhatsappMessageEvents['on'](_0x53bda1,_0x5e1ccf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5c6520e..254eaf1 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 _0xb2a1=['/:id/users','getAgents','create','post','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xb2a1,0xb9));var _0x1b2a=function(_0x9bb4a3,_0x24e6cc){_0x9bb4a3=_0x9bb4a3-0x0;var _0x4ed4c3=_0xb2a1[_0x9bb4a3];return _0x4ed4c3;};'use strict';var multer=require(_0x1b2a('0x0'));var util=require(_0x1b2a('0x1'));var path=require(_0x1b2a('0x2'));var timeout=require(_0x1b2a('0x3'));var express=require(_0x1b2a('0x4'));var router=express[_0x1b2a('0x5')]();var fs_extra=require(_0x1b2a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1b2a('0x7'));var config=require(_0x1b2a('0x8'));var controller=require(_0x1b2a('0x9'));router[_0x1b2a('0xa')]('/',auth[_0x1b2a('0xb')](),controller['index']);router[_0x1b2a('0xa')](_0x1b2a('0xc'),auth[_0x1b2a('0xb')](),controller['describe']);router['get'](_0x1b2a('0xd'),auth[_0x1b2a('0xb')](),controller[_0x1b2a('0xe')]);router[_0x1b2a('0xa')]('/:id/members',auth[_0x1b2a('0xb')](),controller[_0x1b2a('0xf')]);router[_0x1b2a('0xa')](_0x1b2a('0x10'),auth[_0x1b2a('0xb')](),controller[_0x1b2a('0x11')]);router[_0x1b2a('0xa')](_0x1b2a('0x12'),auth[_0x1b2a('0xb')](),controller[_0x1b2a('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b2a('0x14')]);router[_0x1b2a('0x15')]('/:id/teams',auth[_0x1b2a('0xb')](),controller['addTeams']);router[_0x1b2a('0x15')](_0x1b2a('0x12'),auth['isAuthenticated'](),controller[_0x1b2a('0x16')]);router[_0x1b2a('0x17')](_0x1b2a('0xd'),auth[_0x1b2a('0xb')](),controller[_0x1b2a('0x18')]);router['delete']('/:id',auth[_0x1b2a('0xb')](),controller[_0x1b2a('0x19')]);router[_0x1b2a('0x1a')](_0x1b2a('0x10'),auth[_0x1b2a('0xb')](),controller[_0x1b2a('0x1b')]);router[_0x1b2a('0x1a')](_0x1b2a('0x12'),auth[_0x1b2a('0xb')](),controller['removeAgents']);module[_0x1b2a('0x1c')]=router; \ No newline at end of file +var _0xb68b=['./whatsappQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f0c5b,_0x2994f4){var _0x2a10c8=function(_0xef76ce){while(--_0xef76ce){_0x1f0c5b['push'](_0x1f0c5b['shift']());}};_0x2a10c8(++_0x2994f4);}(_0xb68b,0x158));var _0xbb68=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb68b[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xbb68('0x0'));var path=require('path');var timeout=require(_0xbb68('0x1'));var express=require(_0xbb68('0x2'));var router=express[_0xbb68('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbb68('0x4'));var interaction=require(_0xbb68('0x5'));var config=require(_0xbb68('0x6'));var controller=require(_0xbb68('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb68('0x8')]);router[_0xbb68('0x9')](_0xbb68('0xa'),auth['isAuthenticated'](),controller[_0xbb68('0xb')]);router[_0xbb68('0x9')](_0xbb68('0xc'),auth[_0xbb68('0xd')](),controller['show']);router[_0xbb68('0x9')](_0xbb68('0xe'),auth[_0xbb68('0xd')](),controller[_0xbb68('0xf')]);router[_0xbb68('0x9')](_0xbb68('0x10'),auth[_0xbb68('0xd')](),controller[_0xbb68('0x11')]);router[_0xbb68('0x9')]('/:id/users',auth[_0xbb68('0xd')](),controller[_0xbb68('0x12')]);router[_0xbb68('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbb68('0x10'),auth[_0xbb68('0xd')](),controller['addTeams']);router[_0xbb68('0x13')]('/:id/users',auth[_0xbb68('0xd')](),controller[_0xbb68('0x14')]);router[_0xbb68('0x15')](_0xbb68('0xc'),auth[_0xbb68('0xd')](),controller[_0xbb68('0x16')]);router[_0xbb68('0x17')]('/:id',auth[_0xbb68('0xd')](),controller[_0xbb68('0x18')]);router[_0xbb68('0x17')]('/:id/teams',auth[_0xbb68('0xd')](),controller['removeTeams']);router[_0xbb68('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb68('0x19')]);module[_0xbb68('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d862695..3c20620 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 _0x76bb=['rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x52c613,_0x2f3b3d){var _0x13f12f=function(_0x360291){while(--_0x360291){_0x52c613['push'](_0x52c613['shift']());}};_0x13f12f(++_0x2f3b3d);}(_0x76bb,0x16a));var _0xb76b=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x76bb[_0x289a67];return _0x572b49;};'use strict';var Sequelize=require('sequelize');module[_0xb76b('0x0')]={'name':{'type':Sequelize[_0xb76b('0x1')],'unique':_0xb76b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb76b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb76b('0x4'),_0xb76b('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xb76b('0x1')]}}; \ No newline at end of file +var _0xd382=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x1f0d02,_0x544507){var _0x7cb25=function(_0x12d57b){while(--_0x12d57b){_0x1f0d02['push'](_0x1f0d02['shift']());}};_0x7cb25(++_0x544507);}(_0xd382,0x1b6));var _0x2d38=function(_0x5283ec,_0x2a6fb7){_0x5283ec=_0x5283ec-0x0;var _0x2eea90=_0xd382[_0x5283ec];return _0x2eea90;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'name':{'type':Sequelize[_0x2d38('0x2')],'unique':_0x2d38('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2d38('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d38('0x5')](_0x2d38('0x6'),_0x2d38('0x7'),_0x2d38('0x8'))},'description':{'type':Sequelize[_0x2d38('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8a254e3..4e1c6db 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 _0x613e=['socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','sendStatus','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x613e,0x104));var _0xe613=function(_0x1fad66,_0x14a0c0){_0x1fad66=_0x1fad66-0x0;var _0x969af=_0x613e[_0x1fad66];return _0x969af;};'use strict';var emlformat=require(_0xe613('0x0'));var rimraf=require(_0xe613('0x1'));var zipdir=require(_0xe613('0x2'));var jsonpatch=require(_0xe613('0x3'));var rp=require(_0xe613('0x4'));var moment=require(_0xe613('0x5'));var BPromise=require(_0xe613('0x6'));var Mustache=require(_0xe613('0x7'));var util=require(_0xe613('0x8'));var path=require('path');var sox=require(_0xe613('0x9'));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(_0xe613('0xa'));var crypto=require(_0xe613('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe613('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe613('0xd'));var qs=require(_0xe613('0xe'));var as=require(_0xe613('0xf'));var hardwareService=require(_0xe613('0x10'));var logger=require(_0xe613('0x11'))('api');var utils=require(_0xe613('0x12'));var config=require(_0xe613('0x13'));var licenseUtil=require(_0xe613('0x14'));var db=require('../../mysqldb')['db'];config[_0xe613('0x15')]=_[_0xe613('0x16')](config[_0xe613('0x15')],{'host':_0xe613('0x17'),'port':0x18eb});var socket=require(_0xe613('0x18'))(new Redis(config[_0xe613('0x15')]));require(_0xe613('0x19'))[_0xe613('0x1a')](socket);function respondWithStatusCode(_0x16962c,_0x2a923e){_0x2a923e=_0x2a923e||0xcc;return function(_0x13350d){if(_0x13350d){return _0x16962c['sendStatus'](_0x2a923e);}return _0x16962c[_0xe613('0x1b')](_0x2a923e)['end']();};}function respondWithResult(_0x1aa7c5,_0x46c56d){_0x46c56d=_0x46c56d||0xc8;return function(_0xe3c34a){if(_0xe3c34a){return _0x1aa7c5[_0xe613('0x1b')](_0x46c56d)[_0xe613('0x1c')](_0xe3c34a);}};}function respondWithFilteredResult(_0x56a5b2,_0x857bed){return function(_0x321ca3){if(_0x321ca3){var _0xe4e954=typeof _0x857bed[_0xe613('0x1d')]===_0xe613('0x1e')&&typeof _0x857bed[_0xe613('0x1f')]===_0xe613('0x1e');var _0x495471=_0x321ca3[_0xe613('0x20')];var _0x5e6b49=_0xe4e954?0x0:_0x857bed[_0xe613('0x1d')];var _0x3c019a=_0xe4e954?_0x321ca3[_0xe613('0x20')]:_0x857bed[_0xe613('0x1d')]+_0x857bed[_0xe613('0x1f')];var _0x2484bd;if(_0x3c019a>=_0x495471){_0x3c019a=_0x495471;_0x2484bd=0xc8;}else{_0x2484bd=0xce;}_0x56a5b2[_0xe613('0x1b')](_0x2484bd);return _0x56a5b2[_0xe613('0x21')]('Content-Range',_0x5e6b49+'-'+_0x3c019a+'/'+_0x495471)[_0xe613('0x1c')](_0x321ca3);}return null;};}function patchUpdates(_0x26ecc0){return function(_0x6f13d7){try{jsonpatch[_0xe613('0x22')](_0x6f13d7,_0x26ecc0,!![]);}catch(_0x30fc2f){return BPromise[_0xe613('0x23')](_0x30fc2f);}return _0x6f13d7[_0xe613('0x24')]();};}function saveUpdates(_0x1957ae,_0x5dc73f){return function(_0x30a0b7){if(_0x30a0b7){return _0x30a0b7[_0xe613('0x25')](_0x1957ae)[_0xe613('0x26')](function(_0x4a61d1){return _0x4a61d1;});}return null;};}function removeEntity(_0x6216ad,_0x216e8b){return function(_0x137dc7){if(_0x137dc7){return _0x137dc7[_0xe613('0x27')]()[_0xe613('0x26')](function(){var _0x2fe142=_0x137dc7[_0xe613('0x28')]({'plain':!![]});var _0x47d022=_0xe613('0x29');return db['UserProfileResource'][_0xe613('0x27')]({'where':{'type':_0x47d022,'resourceId':_0x2fe142['id']}})['then'](function(){return _0x137dc7;});})[_0xe613('0x26')](function(){_0x6216ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed239,_0xf5f5f2){return function(_0x495090){if(!_0x495090){_0x2ed239[_0xe613('0x2a')](0x194);}return _0x495090;};}function handleError(_0x37e4a6,_0x33cbe2){_0x33cbe2=_0x33cbe2||0x1f4;return function(_0x1b6f27){logger[_0xe613('0x2b')](_0x1b6f27[_0xe613('0x2c')]);if(_0x1b6f27[_0xe613('0x2d')]){delete _0x1b6f27[_0xe613('0x2d')];}_0x37e4a6[_0xe613('0x1b')](_0x33cbe2)[_0xe613('0x2e')](_0x1b6f27);};}exports['index']=function(_0x4391db,_0x1418d0){var _0x566096={},_0x242a1d={},_0x8ee63f={'count':0x0,'rows':[]};var _0x5283d7=_[_0xe613('0x2f')](db[_0xe613('0x30')][_0xe613('0x31')],function(_0x105a5b){return{'name':_0x105a5b[_0xe613('0x32')],'type':_0x105a5b[_0xe613('0x33')][_0xe613('0x34')]};});_0x242a1d['model']=_[_0xe613('0x2f')](_0x5283d7,_0xe613('0x2d'));_0x242a1d[_0xe613('0x35')]=_[_0xe613('0x36')](_0x4391db['query']);_0x242a1d['filters']=_['intersection'](_0x242a1d[_0xe613('0x37')],_0x242a1d[_0xe613('0x35')]);_0x566096[_0xe613('0x38')]=_['intersection'](_0x242a1d['model'],qs[_0xe613('0x39')](_0x4391db[_0xe613('0x35')]['fields']));_0x566096[_0xe613('0x38')]=_0x566096['attributes']['length']?_0x566096['attributes']:_0x242a1d[_0xe613('0x37')];if(!_0x4391db['query'][_0xe613('0x3a')]('nolimit')){_0x566096[_0xe613('0x1f')]=qs[_0xe613('0x1f')](_0x4391db[_0xe613('0x35')][_0xe613('0x1f')]);_0x566096[_0xe613('0x1d')]=qs[_0xe613('0x1d')](_0x4391db[_0xe613('0x35')]['offset']);}_0x566096[_0xe613('0x3b')]=qs[_0xe613('0x3c')](_0x4391db[_0xe613('0x35')][_0xe613('0x3c')]);_0x566096[_0xe613('0x3d')]=qs[_0xe613('0x3e')](_['pick'](_0x4391db[_0xe613('0x35')],_0x242a1d[_0xe613('0x3e')]),_0x5283d7);if(_0x4391db[_0xe613('0x35')]['filter']){_0x566096['where']=_[_0xe613('0x3f')](_0x566096['where'],{'$or':_['map'](_0x5283d7,function(_0x4ab717){if(_0x4ab717[_0xe613('0x33')]!=='VIRTUAL'){var _0x2e30c8={};_0x2e30c8[_0x4ab717[_0xe613('0x2d')]]={'$like':'%'+_0x4391db[_0xe613('0x35')][_0xe613('0x40')]+'%'};return _0x2e30c8;}})});}_0x566096=_[_0xe613('0x3f')]({},_0x566096,_0x4391db[_0xe613('0x41')]);var _0x122efd={'where':_0x566096[_0xe613('0x3d')]};return db[_0xe613('0x30')][_0xe613('0x20')](_0x122efd)[_0xe613('0x26')](function(_0x3b8529){_0x8ee63f[_0xe613('0x20')]=_0x3b8529;if(_0x4391db[_0xe613('0x35')][_0xe613('0x42')]){_0x566096[_0xe613('0x43')]=[{'all':!![]}];}return db[_0xe613('0x30')][_0xe613('0x44')](_0x566096);})[_0xe613('0x26')](function(_0x4c77f0){_0x8ee63f[_0xe613('0x45')]=_0x4c77f0;return _0x8ee63f;})[_0xe613('0x26')](respondWithFilteredResult(_0x1418d0,_0x566096))[_0xe613('0x46')](handleError(_0x1418d0,null));};exports[_0xe613('0x47')]=function(_0x592abe,_0x4111a4){var _0x1bee2b={'raw':!![],'where':{'id':_0x592abe['params']['id']}},_0x4808a1={};_0x4808a1[_0xe613('0x37')]=_['keys'](db[_0xe613('0x30')][_0xe613('0x31')]);_0x4808a1[_0xe613('0x35')]=_['keys'](_0x592abe[_0xe613('0x35')]);_0x4808a1[_0xe613('0x3e')]=_[_0xe613('0x48')](_0x4808a1['model'],_0x4808a1[_0xe613('0x35')]);_0x1bee2b[_0xe613('0x38')]=_[_0xe613('0x48')](_0x4808a1[_0xe613('0x37')],qs['fields'](_0x592abe['query'][_0xe613('0x39')]));_0x1bee2b[_0xe613('0x38')]=_0x1bee2b[_0xe613('0x38')][_0xe613('0x49')]?_0x1bee2b[_0xe613('0x38')]:_0x4808a1[_0xe613('0x37')];if(_0x592abe[_0xe613('0x35')]['includeAll']){_0x1bee2b[_0xe613('0x43')]=[{'all':!![]}];}_0x1bee2b=_[_0xe613('0x3f')]({},_0x1bee2b,_0x592abe[_0xe613('0x41')]);return db[_0xe613('0x30')][_0xe613('0x4a')](_0x1bee2b)[_0xe613('0x26')](handleEntityNotFound(_0x4111a4,null))['then'](respondWithResult(_0x4111a4,null))[_0xe613('0x46')](handleError(_0x4111a4,null));};exports[_0xe613('0x4b')]=function(_0x593896,_0x1f1026){return db[_0xe613('0x30')][_0xe613('0x4b')](_0x593896[_0xe613('0x4c')],{})['then'](function(_0x37db53){var _0x178a45=_0x593896['user'][_0xe613('0x28')]({'plain':!![]});if(!_0x178a45)throw new Error(_0xe613('0x4d'));if(_0x178a45[_0xe613('0x4e')]===_0xe613('0x4f')){var _0x145a8d=_0x37db53[_0xe613('0x28')]({'plain':!![]});var _0x4898b9='WhatsappQueues';return db['UserProfileSection'][_0xe613('0x4a')]({'where':{'name':_0x4898b9,'userProfileId':_0x178a45['userProfileId']},'raw':!![]})['then'](function(_0x4d91a5){if(_0x4d91a5&&_0x4d91a5[_0xe613('0x50')]===0x0){return db[_0xe613('0x51')][_0xe613('0x4b')]({'name':_0x145a8d[_0xe613('0x2d')],'resourceId':_0x145a8d['id'],'type':_0x4d91a5[_0xe613('0x2d')],'sectionId':_0x4d91a5['id']},{})[_0xe613('0x26')](function(){return _0x37db53;});}else{return _0x37db53;}})[_0xe613('0x46')](function(_0x28c3c0){logger[_0xe613('0x2b')](_0xe613('0x52'),_0x28c3c0);throw _0x28c3c0;});}return _0x37db53;})[_0xe613('0x26')](respondWithResult(_0x1f1026,0xc9))[_0xe613('0x46')](handleError(_0x1f1026,null));};exports['update']=function(_0x2e21ab,_0x22682e){if(_0x2e21ab['body']['id']){delete _0x2e21ab[_0xe613('0x4c')]['id'];}return db['WhatsappQueue'][_0xe613('0x4a')]({'where':{'id':_0x2e21ab[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x22682e,null))[_0xe613('0x26')](saveUpdates(_0x2e21ab[_0xe613('0x4c')],null))['then'](respondWithResult(_0x22682e,null))[_0xe613('0x46')](handleError(_0x22682e,null));};exports['destroy']=function(_0x309a73,_0x1b81a8){return db[_0xe613('0x30')][_0xe613('0x4a')]({'where':{'id':_0x309a73[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x1b81a8,null))['then'](removeEntity(_0x1b81a8,null))[_0xe613('0x46')](handleError(_0x1b81a8,null));};exports['describe']=function(_0x55e1e4,_0xfc10f9){return db[_0xe613('0x30')][_0xe613('0x54')]()[_0xe613('0x26')](respondWithResult(_0xfc10f9,null))[_0xe613('0x46')](handleError(_0xfc10f9,null));};exports[_0xe613('0x55')]=function(_0x3553a9,_0x516ee2,_0x304e14){var _0x53a812={'raw':!![],'where':{}},_0x13ff6b={},_0x366b1f;return db[_0xe613('0x30')][_0xe613('0x56')]({'where':{'id':_0x3553a9[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x516ee2,null))[_0xe613('0x26')](function(_0x2f9683){if(_0x2f9683){_0x366b1f=_0x2f9683[_0xe613('0x28')]({'plain':!![]});_0x13ff6b['model']=_[_0xe613('0x36')](db[_0xe613('0x57')][_0xe613('0x31')]);_0x13ff6b[_0xe613('0x35')]=_['keys'](_0x3553a9['query']);_0x13ff6b['filters']=_[_0xe613('0x48')](_0x13ff6b['model'],_0x13ff6b[_0xe613('0x35')]);_0x53a812[_0xe613('0x38')]=_['intersection'](_0x13ff6b[_0xe613('0x37')],qs[_0xe613('0x39')](_0x3553a9[_0xe613('0x35')][_0xe613('0x39')]));_0x53a812[_0xe613('0x38')]=_0x53a812[_0xe613('0x38')][_0xe613('0x49')]?_0x53a812[_0xe613('0x38')]:_0x13ff6b[_0xe613('0x37')];if(!_0x3553a9[_0xe613('0x35')]['hasOwnProperty'](_0xe613('0x58'))){_0x53a812[_0xe613('0x1f')]=qs['limit'](_0x3553a9[_0xe613('0x35')][_0xe613('0x1f')]);_0x53a812['offset']=qs[_0xe613('0x1d')](_0x3553a9['query'][_0xe613('0x1d')]);}_0x53a812['order']=qs[_0xe613('0x3c')](_0x3553a9[_0xe613('0x35')]['sort']);_0x53a812[_0xe613('0x3d')]=qs['filters'](_['pick'](_0x3553a9[_0xe613('0x35')],_0x13ff6b[_0xe613('0x3e')]));_0x53a812[_0xe613('0x3d')][_0xe613('0x59')]=_0x2f9683['id'];if(_0x3553a9[_0xe613('0x35')]['filter']){_0x53a812[_0xe613('0x3d')]=_[_0xe613('0x3f')](_0x53a812[_0xe613('0x3d')],{'$or':_[_0xe613('0x2f')](_0x53a812[_0xe613('0x38')],function(_0x59830a){var _0x26dda7={};_0x26dda7[_0x59830a]={'$like':'%'+_0x3553a9[_0xe613('0x35')][_0xe613('0x40')]+'%'};return _0x26dda7;})});}_0x53a812=_[_0xe613('0x3f')]({},_0x53a812,_0x3553a9['options']);return db['UserWhatsappQueue'][_0xe613('0x44')](_0x53a812);}})['then'](function(_0x21bd4b){if(_0x21bd4b){return db['User'][_0xe613('0x5a')]({'where':{'id':_[_0xe613('0x2f')](_0x21bd4b,_0xe613('0x5b')),'role':_0xe613('0x5c')},'attributes':['id','name',_0xe613('0x5d'),_0xe613('0x5e'),_0xe613('0x5f')]});}})[_0xe613('0x26')](function(_0x1df055){if(_0x1df055){return{'count':_0x1df055['count'],'rows':_[_0xe613('0x2f')](_0x1df055[_0xe613('0x45')],function(_0x280958){return{'membername':_0x280958['name'],'UserId':_0x280958['id'],'queue_name':_0x366b1f[_0xe613('0x2d')],'WhatsappQueueId':_0x366b1f['id'],'interface':util[_0xe613('0x60')](_0xe613('0x61'),_0xe613('0x62'),_0x280958[_0xe613('0x2d')]),'penalty':0x0,'paused':_0x280958[_0xe613('0x5d')],'createdAt':_0x280958[_0xe613('0x5f')],'updatedAt':_0x280958[_0xe613('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x516ee2,_0x53a812))[_0xe613('0x46')](handleError(_0x516ee2,null));};exports[_0xe613('0x63')]=function(_0x45fbd6,_0xf143e2,_0xb3ae73){var _0x1d9e76={};var _0x306c68={};var _0x2c7b0a;var _0x4e4818;return db['WhatsappQueue']['findOne']({'where':{'id':_0x45fbd6[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0xf143e2,null))['then'](function(_0x128b84){if(_0x128b84){_0x2c7b0a=_0x128b84;_0x306c68[_0xe613('0x37')]=_[_0xe613('0x36')](db[_0xe613('0x64')]['rawAttributes']);_0x306c68[_0xe613('0x35')]=_[_0xe613('0x36')](_0x45fbd6[_0xe613('0x35')]);_0x306c68['filters']=_['intersection'](_0x306c68[_0xe613('0x37')],_0x306c68[_0xe613('0x35')]);_0x1d9e76['attributes']=_[_0xe613('0x48')](_0x306c68[_0xe613('0x37')],qs[_0xe613('0x39')](_0x45fbd6[_0xe613('0x35')][_0xe613('0x39')]));_0x1d9e76['attributes']=_0x1d9e76[_0xe613('0x38')][_0xe613('0x49')]?_0x1d9e76[_0xe613('0x38')]:_0x306c68[_0xe613('0x37')];_0x1d9e76['order']=qs[_0xe613('0x3c')](_0x45fbd6[_0xe613('0x35')][_0xe613('0x3c')]);_0x1d9e76['where']=qs[_0xe613('0x3e')](_[_0xe613('0x65')](_0x45fbd6[_0xe613('0x35')],_0x306c68[_0xe613('0x3e')]));if(_0x45fbd6[_0xe613('0x35')]['filter']){_0x1d9e76[_0xe613('0x3d')]=_[_0xe613('0x3f')](_0x1d9e76['where'],{'$or':_[_0xe613('0x2f')](_0x1d9e76[_0xe613('0x38')],function(_0x25be7d){var _0x3ec21f={};_0x3ec21f[_0x25be7d]={'$like':'%'+_0x45fbd6['query'][_0xe613('0x40')]+'%'};return _0x3ec21f;})});}_0x1d9e76=_['merge']({},_0x1d9e76,_0x45fbd6['options']);return _0x2c7b0a[_0xe613('0x63')](_0x1d9e76);}})[_0xe613('0x26')](function(_0x15bb10){if(_0x15bb10){_0x4e4818=_0x15bb10[_0xe613('0x49')];if(!_0x45fbd6[_0xe613('0x35')]['hasOwnProperty'](_0xe613('0x58'))){_0x1d9e76[_0xe613('0x1f')]=qs[_0xe613('0x1f')](_0x45fbd6[_0xe613('0x35')]['limit']);_0x1d9e76[_0xe613('0x1d')]=qs[_0xe613('0x1d')](_0x45fbd6['query'][_0xe613('0x1d')]);}return _0x2c7b0a[_0xe613('0x63')](_0x1d9e76);}})[_0xe613('0x26')](function(_0x229f7a){if(_0x229f7a){return _0x229f7a?{'count':_0x4e4818,'rows':_0x229f7a}:null;}})['then'](respondWithResult(_0xf143e2,null))[_0xe613('0x46')](handleError(_0xf143e2,null));};exports[_0xe613('0x66')]=function(_0x299e06,_0x168575,_0x4700a3){var _0xaccfd3=_0x299e06[_0xe613('0x4c')][_0xe613('0x67')];return db['Team'][_0xe613('0x44')]({'where':{'id':_0xaccfd3},'attributes':['id'],'include':[{'model':db[_0xe613('0x68')],'as':_0xe613('0x69'),'attributes':['id',_0xe613('0x2d'),_0xe613('0x6a'),_0xe613('0x6b'),_0xe613('0x6c')],'raw':!![]}]})[_0xe613('0x26')](function(_0x566296){if(_0x566296){var _0x30cfff=_[_0xe613('0x6d')](_0x566296,function(_0x5a39eb){var _0x497e9b=_0x5a39eb[_0xe613('0x28')]({'plain':!![]});return _0x497e9b[_0xe613('0x69')];});return db[_0xe613('0x30')][_0xe613('0x4a')]({'where':{'id':_0x299e06[_0xe613('0x53')]['id']}})['then'](function(_0xd44acc){return db[_0xe613('0x6e')][_0xe613('0x6f')](function(_0x55bfd7){return _0xd44acc['addTeams'](_0xaccfd3,{'transaction':_0x55bfd7})['then'](function(){return BPromise['each'](_0x30cfff,function(_0x177dd8){return db[_0xe613('0x57')][_0xe613('0x70')]({'where':{'UserId':_0x177dd8['id'],'WhatsappQueueId':_0x299e06['params']['id']},'transaction':_0x55bfd7});});})[_0xe613('0x26')](function(){_0x30cfff[_0xe613('0x71')](function(_0x15c48c){socket[_0xe613('0x72')](_0xe613('0x73'),{'UserId':_0x15c48c['id'],'WhatsappQueueId':_0xd44acc['id']});});});});});}})[_0xe613('0x26')](respondWithStatusCode(_0x168575,null))[_0xe613('0x46')](handleError(_0x168575,null));};exports[_0xe613('0x74')]=function(_0x50402f,_0x4c99fa,_0x1426ac){return db['Team'][_0xe613('0x44')]({'where':{'id':_0x50402f[_0xe613('0x35')][_0xe613('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe613('0x68')],'as':_0xe613('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe613('0x26')](handleEntityNotFound(_0x4c99fa,null))[_0xe613('0x26')](function(_0x488db9){var _0x4556d2=_['map'](_0x488db9,'id');var _0x4470bf=[];var _0x587fe0=[];var _0x5c14d6=squel[_0xe613('0x75')]();_0x5c14d6[_0xe613('0x76')](_0xe613('0x77'))['from'](_0xe613('0x78'),'tq')[_0xe613('0x79')](_0xe613('0x7a'),'ut',_0xe613('0x7b'))[_0xe613('0x3d')](_0xe613('0x7c'),_0x50402f[_0xe613('0x53')]['id']);for(var _0x943f9f=0x0;_0x943f9f<_0x488db9[_0xe613('0x49')];_0x943f9f+=0x1){let _0x45f9e9=_0x488db9[_0x943f9f];for(var _0x303b58=0x0;_0x303b58<_0x45f9e9[_0xe613('0x69')][_0xe613('0x49')];_0x303b58+=0x1){let _0x9b0e4b=_0x45f9e9[_0xe613('0x69')][_0x303b58];var _0x2a110a=_0x5c14d6[_0xe613('0x7d')]();_0x2a110a['where']('ut.UserId\x20=\x20?',_0x9b0e4b['id']);_0x587fe0[_0xe613('0x7e')](db[_0xe613('0x6e')]['query'](_0x2a110a['toString'](),{'type':db['sequelize'][_0xe613('0x7f')][_0xe613('0x80')]})[_0xe613('0x26')](function(_0x8a288b){if(_0x8a288b['length']===0x1){return _0x9b0e4b['id'];}else{var _0x1863ec=_['every'](_[_0xe613('0x2f')](_0x8a288b,_0xe613('0x81')),function(_0x404c89){return _[_0xe613('0x82')](_0x4556d2,_0x404c89);});if(_0x1863ec){return _0x9b0e4b['id'];}}}));}}return BPromise[_0xe613('0x83')](_0x587fe0)[_0xe613('0x26')](function(_0x2428f0){_0x4470bf=_(_0x4470bf)[_0xe613('0x84')](_0x2428f0)[_0xe613('0x85')]()[_0xe613('0x86')]();return db[_0xe613('0x30')][_0xe613('0x4a')]({'where':{'id':_0x50402f[_0xe613('0x53')]['id']}})['then'](function(_0x18bd36){return db[_0xe613('0x6e')][_0xe613('0x6f')](function(_0x30c9d4){return _0x18bd36[_0xe613('0x74')](_0x50402f[_0xe613('0x35')][_0xe613('0x67')],{'transaction':_0x30c9d4})[_0xe613('0x26')](function(){if(!_['isEmpty'](_0x4470bf)){return _0x18bd36[_0xe613('0x87')](_0x4470bf,{'transaction':_0x30c9d4});}})[_0xe613('0x26')](function(){_0x4470bf[_0xe613('0x71')](function(_0x56a738){socket['emit'](_0xe613('0x88'),{'UserId':_0x56a738,'WhatsappQueueId':_0x18bd36['id']});});});});});});})[_0xe613('0x26')](respondWithStatusCode(_0x4c99fa,null))[_0xe613('0x46')](handleError(_0x4c99fa,null));};exports[_0xe613('0x89')]=function(_0x184ec1,_0x25fe04,_0x2ee7a8){return db[_0xe613('0x30')][_0xe613('0x4a')]({'where':{'id':_0x184ec1[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x25fe04,null))['then'](function(_0x594cbd){if(_0x594cbd){return _0x594cbd['addAgents'](_0x184ec1['body'][_0xe613('0x67')],_[_0xe613('0x8a')](_0x184ec1[_0xe613('0x4c')],['ids','id'])||{})[_0xe613('0x8b')](function(_0x47efc8){for(var _0x3a2fe5=0x0;_0x3a2fe5<_0x184ec1[_0xe613('0x4c')]['ids'][_0xe613('0x49')];_0x3a2fe5+=0x1){socket[_0xe613('0x72')](_0xe613('0x73'),{'UserId':Number(_0x184ec1[_0xe613('0x4c')][_0xe613('0x67')][_0x3a2fe5]),'WhatsappQueueId':Number(_0x184ec1[_0xe613('0x53')]['id'])});}return _0x47efc8;});}})[_0xe613('0x26')](respondWithResult(_0x25fe04,null))[_0xe613('0x46')](handleError(_0x25fe04,null));};exports[_0xe613('0x87')]=function(_0x4cd500,_0x12d77d,_0x6221ea){return db[_0xe613('0x30')][_0xe613('0x4a')]({'where':{'id':_0x4cd500['params']['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x12d77d,null))[_0xe613('0x26')](function(_0x2d720e){if(_0x2d720e){return _0x2d720e[_0xe613('0x87')](_0x4cd500['query'][_0xe613('0x67')])[_0xe613('0x26')](function(){if(_[_0xe613('0x8c')](_0x4cd500[_0xe613('0x35')][_0xe613('0x67')])){for(var _0x13d237=0x0;_0x13d237<_0x4cd500[_0xe613('0x35')][_0xe613('0x67')][_0xe613('0x49')];_0x13d237+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x4cd500[_0xe613('0x35')][_0xe613('0x67')][_0x13d237]),'WhatsappQueueId':Number(_0x4cd500['params']['id'])});}}else{socket[_0xe613('0x72')](_0xe613('0x88'),{'UserId':Number(_0x4cd500['query'][_0xe613('0x67')]),'WhatsappQueueId':Number(_0x4cd500[_0xe613('0x53')]['id'])});}});}})[_0xe613('0x26')](respondWithStatusCode(_0x12d77d,null))[_0xe613('0x46')](handleError(_0x12d77d,null));};exports[_0xe613('0x8d')]=function(_0x1b3d5f,_0x521361,_0x4ff873){var _0x4b5603={};var _0x3289d4={};var _0xb011f2;var _0x18cadf;return db[_0xe613('0x30')]['findOne']({'where':{'id':_0x1b3d5f[_0xe613('0x53')]['id']}})[_0xe613('0x26')](handleEntityNotFound(_0x521361,null))[_0xe613('0x26')](function(_0x7eda99){if(_0x7eda99){_0xb011f2=_0x7eda99;_0x3289d4[_0xe613('0x37')]=_[_0xe613('0x36')](db['User'][_0xe613('0x31')]);_0x3289d4[_0xe613('0x35')]=_['keys'](_0x1b3d5f[_0xe613('0x35')]);_0x3289d4[_0xe613('0x3e')]=_[_0xe613('0x48')](_0x3289d4['model'],_0x3289d4[_0xe613('0x35')]);_0x4b5603[_0xe613('0x38')]=_[_0xe613('0x48')](_0x3289d4[_0xe613('0x37')],qs[_0xe613('0x39')](_0x1b3d5f['query'][_0xe613('0x39')]));_0x4b5603['attributes']=_0x4b5603[_0xe613('0x38')][_0xe613('0x49')]?_0x4b5603[_0xe613('0x38')]:_0x3289d4['model'];_0x4b5603[_0xe613('0x3b')]=qs[_0xe613('0x3c')](_0x1b3d5f['query'][_0xe613('0x3c')]);_0x4b5603[_0xe613('0x3d')]=qs['filters'](_[_0xe613('0x65')](_0x1b3d5f[_0xe613('0x35')],_0x3289d4[_0xe613('0x3e')]));if(_0x1b3d5f['query'][_0xe613('0x40')]){_0x4b5603['where']=_[_0xe613('0x3f')](_0x4b5603[_0xe613('0x3d')],{'$or':_[_0xe613('0x2f')](_0x4b5603[_0xe613('0x38')],function(_0x4b7cf9){var _0x5290db={};_0x5290db[_0x4b7cf9]={'$like':'%'+_0x1b3d5f[_0xe613('0x35')][_0xe613('0x40')]+'%'};return _0x5290db;})});}_0x4b5603=_[_0xe613('0x3f')]({},_0x4b5603,_0x1b3d5f['options']);return _0xb011f2['getAgents'](_0x4b5603);}})['then'](function(_0x57447f){if(_0x57447f){_0x18cadf=_0x57447f[_0xe613('0x49')];if(!_0x1b3d5f[_0xe613('0x35')][_0xe613('0x3a')]('nolimit')){_0x4b5603['limit']=qs[_0xe613('0x1f')](_0x1b3d5f[_0xe613('0x35')][_0xe613('0x1f')]);_0x4b5603['offset']=qs[_0xe613('0x1d')](_0x1b3d5f['query'][_0xe613('0x1d')]);}return _0xb011f2['getAgents'](_0x4b5603);}})['then'](function(_0x35ea7a){if(_0x35ea7a){return _0x35ea7a?{'count':_0x18cadf,'rows':_0x35ea7a}:null;}})[_0xe613('0x26')](respondWithResult(_0x521361,null))[_0xe613('0x46')](handleError(_0x521361,null));}; \ No newline at end of file +var _0xb51d=['fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','destroy','error','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserWhatsappQueue','order','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','push','sequelize','toString','every','TeamId','all','compact','value','transaction','userWhatsappQueue:remove','omit','spread','userWhatsappQueue:save','removeAgents','getAgents','eml-format'];(function(_0x233cc1,_0x2b6cb){var _0x225225=function(_0x4e03e2){while(--_0x4e03e2){_0x233cc1['push'](_0x233cc1['shift']());}};_0x225225(++_0x2b6cb);}(_0xb51d,0x182));var _0xdb51=function(_0xc3bac3,_0x322cd1){_0xc3bac3=_0xc3bac3-0x0;var _0x1326d7=_0xb51d[_0xc3bac3];return _0x1326d7;};'use strict';var emlformat=require(_0xdb51('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb51('0x1'));var rp=require(_0xdb51('0x2'));var moment=require(_0xdb51('0x3'));var BPromise=require(_0xdb51('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb51('0x5'));var sox=require(_0xdb51('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb51('0x7'));var _=require('lodash');var squel=require(_0xdb51('0x8'));var crypto=require('crypto');var jsforce=require(_0xdb51('0x9'));var deskjs=require(_0xdb51('0xa'));var toCsv=require(_0xdb51('0xb'));var querystring=require(_0xdb51('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb51('0xd'));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(_0xdb51('0xe'))(_0xdb51('0xf'));var utils=require(_0xdb51('0x10'));var config=require(_0xdb51('0x11'));var licenseUtil=require(_0xdb51('0x12'));var db=require(_0xdb51('0x13'))['db'];config['redis']=_[_0xdb51('0x14')](config['redis'],{'host':_0xdb51('0x15'),'port':0x18eb});var socket=require(_0xdb51('0x16'))(new Redis(config['redis']));require(_0xdb51('0x17'))[_0xdb51('0x18')](socket);function respondWithStatusCode(_0x770c29,_0x536534){_0x536534=_0x536534||0xcc;return function(_0x5aac34){if(_0x5aac34){return _0x770c29[_0xdb51('0x19')](_0x536534);}return _0x770c29[_0xdb51('0x1a')](_0x536534)[_0xdb51('0x1b')]();};}function respondWithResult(_0x55e9eb,_0x1065c4){_0x1065c4=_0x1065c4||0xc8;return function(_0x3d7e34){if(_0x3d7e34){return _0x55e9eb[_0xdb51('0x1a')](_0x1065c4)[_0xdb51('0x1c')](_0x3d7e34);}};}function respondWithFilteredResult(_0xfb61fa,_0x577e31){return function(_0x4daba9){if(_0x4daba9){var _0x282a78=typeof _0x577e31[_0xdb51('0x1d')]===_0xdb51('0x1e')&&typeof _0x577e31[_0xdb51('0x1f')]===_0xdb51('0x1e');var _0x32fae5=_0x4daba9['count'];var _0x4aa918=_0x282a78?0x0:_0x577e31[_0xdb51('0x1d')];var _0x54fc94=_0x282a78?_0x4daba9[_0xdb51('0x20')]:_0x577e31[_0xdb51('0x1d')]+_0x577e31[_0xdb51('0x1f')];var _0x2d8f3b;if(_0x54fc94>=_0x32fae5){_0x54fc94=_0x32fae5;_0x2d8f3b=0xc8;}else{_0x2d8f3b=0xce;}_0xfb61fa[_0xdb51('0x1a')](_0x2d8f3b);return _0xfb61fa[_0xdb51('0x21')]('Content-Range',_0x4aa918+'-'+_0x54fc94+'/'+_0x32fae5)[_0xdb51('0x1c')](_0x4daba9);}return null;};}function patchUpdates(_0x5e1e80){return function(_0x336d2b){try{jsonpatch[_0xdb51('0x22')](_0x336d2b,_0x5e1e80,!![]);}catch(_0x7d554b){return BPromise[_0xdb51('0x23')](_0x7d554b);}return _0x336d2b[_0xdb51('0x24')]();};}function saveUpdates(_0x3561f5,_0x2df571){return function(_0x1ee638){if(_0x1ee638){return _0x1ee638['update'](_0x3561f5)[_0xdb51('0x25')](function(_0x49d93f){return _0x49d93f;});}return null;};}function removeEntity(_0x27e71d,_0x1f035a){return function(_0x25696b){if(_0x25696b){return _0x25696b['destroy']()[_0xdb51('0x25')](function(){var _0x3a5c5c=_0x25696b[_0xdb51('0x26')]({'plain':!![]});var _0xf209b2='WhatsappQueues';return db['UserProfileResource'][_0xdb51('0x27')]({'where':{'type':_0xf209b2,'resourceId':_0x3a5c5c['id']}})['then'](function(){return _0x25696b;});})['then'](function(){_0x27e71d[_0xdb51('0x1a')](0xcc)[_0xdb51('0x1b')]();});}};}function handleEntityNotFound(_0x21eb2d,_0x3b9d7f){return function(_0x323f32){if(!_0x323f32){_0x21eb2d[_0xdb51('0x19')](0x194);}return _0x323f32;};}function handleError(_0x2ee832,_0x18d79d){_0x18d79d=_0x18d79d||0x1f4;return function(_0x193619){logger[_0xdb51('0x28')](_0x193619['stack']);if(_0x193619[_0xdb51('0x29')]){delete _0x193619['name'];}_0x2ee832[_0xdb51('0x1a')](_0x18d79d)[_0xdb51('0x2a')](_0x193619);};}exports['index']=function(_0x5f0994,_0x464937){var _0x125739={},_0x2c7038={},_0x4f240e={'count':0x0,'rows':[]};var _0x49a6f8=_[_0xdb51('0x2b')](db[_0xdb51('0x2c')][_0xdb51('0x2d')],function(_0x497f05){return{'name':_0x497f05[_0xdb51('0x2e')],'type':_0x497f05[_0xdb51('0x2f')][_0xdb51('0x30')]};});_0x2c7038[_0xdb51('0x31')]=_['map'](_0x49a6f8,_0xdb51('0x29'));_0x2c7038[_0xdb51('0x32')]=_[_0xdb51('0x33')](_0x5f0994[_0xdb51('0x32')]);_0x2c7038[_0xdb51('0x34')]=_[_0xdb51('0x35')](_0x2c7038['model'],_0x2c7038[_0xdb51('0x32')]);_0x125739[_0xdb51('0x36')]=_[_0xdb51('0x35')](_0x2c7038[_0xdb51('0x31')],qs[_0xdb51('0x37')](_0x5f0994[_0xdb51('0x32')][_0xdb51('0x37')]));_0x125739[_0xdb51('0x36')]=_0x125739[_0xdb51('0x36')][_0xdb51('0x38')]?_0x125739['attributes']:_0x2c7038[_0xdb51('0x31')];if(!_0x5f0994[_0xdb51('0x32')][_0xdb51('0x39')]('nolimit')){_0x125739[_0xdb51('0x1f')]=qs[_0xdb51('0x1f')](_0x5f0994[_0xdb51('0x32')]['limit']);_0x125739[_0xdb51('0x1d')]=qs[_0xdb51('0x1d')](_0x5f0994[_0xdb51('0x32')][_0xdb51('0x1d')]);}_0x125739['order']=qs[_0xdb51('0x3a')](_0x5f0994[_0xdb51('0x32')]['sort']);_0x125739[_0xdb51('0x3b')]=qs[_0xdb51('0x34')](_[_0xdb51('0x3c')](_0x5f0994[_0xdb51('0x32')],_0x2c7038[_0xdb51('0x34')]),_0x49a6f8);if(_0x5f0994[_0xdb51('0x32')][_0xdb51('0x3d')]){_0x125739[_0xdb51('0x3b')]=_['merge'](_0x125739[_0xdb51('0x3b')],{'$or':_[_0xdb51('0x2b')](_0x49a6f8,function(_0xb007bf){if(_0xb007bf[_0xdb51('0x2f')]!==_0xdb51('0x3e')){var _0x7f60fd={};_0x7f60fd[_0xb007bf[_0xdb51('0x29')]]={'$like':'%'+_0x5f0994[_0xdb51('0x32')]['filter']+'%'};return _0x7f60fd;}})});}_0x125739=_[_0xdb51('0x3f')]({},_0x125739,_0x5f0994[_0xdb51('0x40')]);var _0x4ab994={'where':_0x125739[_0xdb51('0x3b')]};return db[_0xdb51('0x2c')]['count'](_0x4ab994)[_0xdb51('0x25')](function(_0xd97007){_0x4f240e['count']=_0xd97007;if(_0x5f0994[_0xdb51('0x32')][_0xdb51('0x41')]){_0x125739['include']=[{'all':!![]}];}return db[_0xdb51('0x2c')][_0xdb51('0x42')](_0x125739);})[_0xdb51('0x25')](function(_0x3cf18d){_0x4f240e[_0xdb51('0x43')]=_0x3cf18d;return _0x4f240e;})[_0xdb51('0x25')](respondWithFilteredResult(_0x464937,_0x125739))[_0xdb51('0x44')](handleError(_0x464937,null));};exports[_0xdb51('0x45')]=function(_0x156f0d,_0x34f822){var _0x189c44={'raw':!![],'where':{'id':_0x156f0d[_0xdb51('0x46')]['id']}},_0x2c27fd={};_0x2c27fd[_0xdb51('0x31')]=_['keys'](db[_0xdb51('0x2c')][_0xdb51('0x2d')]);_0x2c27fd['query']=_['keys'](_0x156f0d[_0xdb51('0x32')]);_0x2c27fd[_0xdb51('0x34')]=_[_0xdb51('0x35')](_0x2c27fd[_0xdb51('0x31')],_0x2c27fd[_0xdb51('0x32')]);_0x189c44['attributes']=_[_0xdb51('0x35')](_0x2c27fd[_0xdb51('0x31')],qs[_0xdb51('0x37')](_0x156f0d[_0xdb51('0x32')][_0xdb51('0x37')]));_0x189c44[_0xdb51('0x36')]=_0x189c44[_0xdb51('0x36')][_0xdb51('0x38')]?_0x189c44['attributes']:_0x2c27fd[_0xdb51('0x31')];if(_0x156f0d[_0xdb51('0x32')][_0xdb51('0x41')]){_0x189c44['include']=[{'all':!![]}];}_0x189c44=_[_0xdb51('0x3f')]({},_0x189c44,_0x156f0d[_0xdb51('0x40')]);return db[_0xdb51('0x2c')][_0xdb51('0x47')](_0x189c44)[_0xdb51('0x25')](handleEntityNotFound(_0x34f822,null))[_0xdb51('0x25')](respondWithResult(_0x34f822,null))[_0xdb51('0x44')](handleError(_0x34f822,null));};exports['create']=function(_0x366ff1,_0x229c2c){return db[_0xdb51('0x2c')]['create'](_0x366ff1[_0xdb51('0x48')],{})[_0xdb51('0x25')](function(_0x1e9ce8){var _0x588026=_0x366ff1[_0xdb51('0x49')][_0xdb51('0x26')]({'plain':!![]});if(!_0x588026)throw new Error(_0xdb51('0x4a'));if(_0x588026['role']===_0xdb51('0x49')){var _0x378e0c=_0x1e9ce8[_0xdb51('0x26')]({'plain':!![]});var _0x2ab11e=_0xdb51('0x4b');return db['UserProfileSection'][_0xdb51('0x47')]({'where':{'name':_0x2ab11e,'userProfileId':_0x588026[_0xdb51('0x4c')]},'raw':!![]})['then'](function(_0x144345){if(_0x144345&&_0x144345[_0xdb51('0x4d')]===0x0){return db[_0xdb51('0x4e')]['create']({'name':_0x378e0c['name'],'resourceId':_0x378e0c['id'],'type':_0x144345[_0xdb51('0x29')],'sectionId':_0x144345['id']},{})[_0xdb51('0x25')](function(){return _0x1e9ce8;});}else{return _0x1e9ce8;}})[_0xdb51('0x44')](function(_0x1b237f){logger[_0xdb51('0x28')](_0xdb51('0x4f'),_0x1b237f);throw _0x1b237f;});}return _0x1e9ce8;})[_0xdb51('0x25')](respondWithResult(_0x229c2c,0xc9))['catch'](handleError(_0x229c2c,null));};exports[_0xdb51('0x50')]=function(_0x5ce7ff,_0x401314){if(_0x5ce7ff[_0xdb51('0x48')]['id']){delete _0x5ce7ff['body']['id'];}return db[_0xdb51('0x2c')][_0xdb51('0x47')]({'where':{'id':_0x5ce7ff[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](handleEntityNotFound(_0x401314,null))[_0xdb51('0x25')](saveUpdates(_0x5ce7ff[_0xdb51('0x48')],null))[_0xdb51('0x25')](respondWithResult(_0x401314,null))[_0xdb51('0x44')](handleError(_0x401314,null));};exports[_0xdb51('0x27')]=function(_0x2ac330,_0x327cc7){return db['WhatsappQueue'][_0xdb51('0x47')]({'where':{'id':_0x2ac330[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](handleEntityNotFound(_0x327cc7,null))['then'](removeEntity(_0x327cc7,null))[_0xdb51('0x44')](handleError(_0x327cc7,null));};exports[_0xdb51('0x51')]=function(_0x240b58,_0x4ab4e1){return db[_0xdb51('0x2c')]['describe']()['then'](respondWithResult(_0x4ab4e1,null))[_0xdb51('0x44')](handleError(_0x4ab4e1,null));};exports['getMembers']=function(_0x5a5761,_0x3284ef,_0x496c5d){var _0x4e3d43={'raw':!![],'where':{}},_0x3f2bfc={},_0x298260;return db[_0xdb51('0x2c')][_0xdb51('0x52')]({'where':{'id':_0x5a5761[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](handleEntityNotFound(_0x3284ef,null))[_0xdb51('0x25')](function(_0x1e159a){if(_0x1e159a){_0x298260=_0x1e159a[_0xdb51('0x26')]({'plain':!![]});_0x3f2bfc[_0xdb51('0x31')]=_['keys'](db[_0xdb51('0x53')][_0xdb51('0x2d')]);_0x3f2bfc[_0xdb51('0x32')]=_[_0xdb51('0x33')](_0x5a5761[_0xdb51('0x32')]);_0x3f2bfc[_0xdb51('0x34')]=_[_0xdb51('0x35')](_0x3f2bfc[_0xdb51('0x31')],_0x3f2bfc[_0xdb51('0x32')]);_0x4e3d43['attributes']=_[_0xdb51('0x35')](_0x3f2bfc[_0xdb51('0x31')],qs['fields'](_0x5a5761[_0xdb51('0x32')][_0xdb51('0x37')]));_0x4e3d43[_0xdb51('0x36')]=_0x4e3d43[_0xdb51('0x36')]['length']?_0x4e3d43[_0xdb51('0x36')]:_0x3f2bfc['model'];if(!_0x5a5761[_0xdb51('0x32')]['hasOwnProperty']('nolimit')){_0x4e3d43[_0xdb51('0x1f')]=qs[_0xdb51('0x1f')](_0x5a5761[_0xdb51('0x32')][_0xdb51('0x1f')]);_0x4e3d43[_0xdb51('0x1d')]=qs[_0xdb51('0x1d')](_0x5a5761[_0xdb51('0x32')][_0xdb51('0x1d')]);}_0x4e3d43[_0xdb51('0x54')]=qs[_0xdb51('0x3a')](_0x5a5761['query']['sort']);_0x4e3d43[_0xdb51('0x3b')]=qs[_0xdb51('0x34')](_[_0xdb51('0x3c')](_0x5a5761[_0xdb51('0x32')],_0x3f2bfc[_0xdb51('0x34')]));_0x4e3d43[_0xdb51('0x3b')]['WhatsappQueueId']=_0x1e159a['id'];if(_0x5a5761['query'][_0xdb51('0x3d')]){_0x4e3d43[_0xdb51('0x3b')]=_[_0xdb51('0x3f')](_0x4e3d43[_0xdb51('0x3b')],{'$or':_['map'](_0x4e3d43[_0xdb51('0x36')],function(_0xcf270b){var _0x3b16c1={};_0x3b16c1[_0xcf270b]={'$like':'%'+_0x5a5761[_0xdb51('0x32')][_0xdb51('0x3d')]+'%'};return _0x3b16c1;})});}_0x4e3d43=_[_0xdb51('0x3f')]({},_0x4e3d43,_0x5a5761[_0xdb51('0x40')]);return db[_0xdb51('0x53')][_0xdb51('0x42')](_0x4e3d43);}})[_0xdb51('0x25')](function(_0x413c04){if(_0x413c04){return db[_0xdb51('0x55')][_0xdb51('0x56')]({'where':{'id':_[_0xdb51('0x2b')](_0x413c04,_0xdb51('0x57')),'role':'agent'},'attributes':['id',_0xdb51('0x29'),_0xdb51('0x58'),_0xdb51('0x59'),'createdAt']});}})[_0xdb51('0x25')](function(_0x4cb1ce){if(_0x4cb1ce){return{'count':_0x4cb1ce[_0xdb51('0x20')],'rows':_['map'](_0x4cb1ce[_0xdb51('0x43')],function(_0x241194){return{'membername':_0x241194[_0xdb51('0x29')],'UserId':_0x241194['id'],'queue_name':_0x298260[_0xdb51('0x29')],'WhatsappQueueId':_0x298260['id'],'interface':util[_0xdb51('0x5a')](_0xdb51('0x5b'),_0xdb51('0x5c'),_0x241194[_0xdb51('0x29')]),'penalty':0x0,'paused':_0x241194[_0xdb51('0x58')],'createdAt':_0x241194[_0xdb51('0x5d')],'updatedAt':_0x241194['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdb51('0x25')](respondWithFilteredResult(_0x3284ef,_0x4e3d43))[_0xdb51('0x44')](handleError(_0x3284ef,null));};exports['getTeams']=function(_0x5941d8,_0x190ff7,_0x487dd7){var _0x5ec21b={};var _0x4c8212={};var _0x418cb6;var _0x1759b5;return db[_0xdb51('0x2c')]['findOne']({'where':{'id':_0x5941d8['params']['id']}})['then'](handleEntityNotFound(_0x190ff7,null))[_0xdb51('0x25')](function(_0x4031af){if(_0x4031af){_0x418cb6=_0x4031af;_0x4c8212[_0xdb51('0x31')]=_['keys'](db[_0xdb51('0x5e')]['rawAttributes']);_0x4c8212[_0xdb51('0x32')]=_['keys'](_0x5941d8['query']);_0x4c8212[_0xdb51('0x34')]=_[_0xdb51('0x35')](_0x4c8212[_0xdb51('0x31')],_0x4c8212[_0xdb51('0x32')]);_0x5ec21b[_0xdb51('0x36')]=_[_0xdb51('0x35')](_0x4c8212[_0xdb51('0x31')],qs[_0xdb51('0x37')](_0x5941d8[_0xdb51('0x32')][_0xdb51('0x37')]));_0x5ec21b[_0xdb51('0x36')]=_0x5ec21b[_0xdb51('0x36')]['length']?_0x5ec21b['attributes']:_0x4c8212[_0xdb51('0x31')];_0x5ec21b[_0xdb51('0x54')]=qs[_0xdb51('0x3a')](_0x5941d8['query']['sort']);_0x5ec21b['where']=qs[_0xdb51('0x34')](_[_0xdb51('0x3c')](_0x5941d8[_0xdb51('0x32')],_0x4c8212[_0xdb51('0x34')]));if(_0x5941d8[_0xdb51('0x32')][_0xdb51('0x3d')]){_0x5ec21b['where']=_[_0xdb51('0x3f')](_0x5ec21b[_0xdb51('0x3b')],{'$or':_[_0xdb51('0x2b')](_0x5ec21b['attributes'],function(_0x17d692){var _0xed5c85={};_0xed5c85[_0x17d692]={'$like':'%'+_0x5941d8[_0xdb51('0x32')][_0xdb51('0x3d')]+'%'};return _0xed5c85;})});}_0x5ec21b=_[_0xdb51('0x3f')]({},_0x5ec21b,_0x5941d8[_0xdb51('0x40')]);return _0x418cb6[_0xdb51('0x5f')](_0x5ec21b);}})['then'](function(_0x535d2f){if(_0x535d2f){_0x1759b5=_0x535d2f['length'];if(!_0x5941d8['query'][_0xdb51('0x39')](_0xdb51('0x60'))){_0x5ec21b[_0xdb51('0x1f')]=qs[_0xdb51('0x1f')](_0x5941d8[_0xdb51('0x32')][_0xdb51('0x1f')]);_0x5ec21b[_0xdb51('0x1d')]=qs[_0xdb51('0x1d')](_0x5941d8[_0xdb51('0x32')][_0xdb51('0x1d')]);}return _0x418cb6[_0xdb51('0x5f')](_0x5ec21b);}})['then'](function(_0x161ad8){if(_0x161ad8){return _0x161ad8?{'count':_0x1759b5,'rows':_0x161ad8}:null;}})['then'](respondWithResult(_0x190ff7,null))['catch'](handleError(_0x190ff7,null));};exports[_0xdb51('0x61')]=function(_0x140a84,_0x4bb578,_0x191a1b){var _0xadcec6=_0x140a84[_0xdb51('0x48')][_0xdb51('0x62')];return db[_0xdb51('0x5e')]['findAll']({'where':{'id':_0xadcec6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdb51('0x63'),'attributes':['id',_0xdb51('0x29'),'online',_0xdb51('0x64'),_0xdb51('0x65')],'raw':!![]}]})[_0xdb51('0x25')](function(_0x24a423){if(_0x24a423){var _0x431246=_[_0xdb51('0x66')](_0x24a423,function(_0x23b0e5){var _0x2a18ea=_0x23b0e5[_0xdb51('0x26')]({'plain':!![]});return _0x2a18ea[_0xdb51('0x63')];});return db[_0xdb51('0x2c')]['find']({'where':{'id':_0x140a84[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](function(_0x6c55aa){return db['sequelize']['transaction'](function(_0x4f9c2a){return _0x6c55aa[_0xdb51('0x61')](_0xadcec6,{'transaction':_0x4f9c2a})['then'](function(){return BPromise['each'](_0x431246,function(_0x3b1e6a){return db['UserWhatsappQueue'][_0xdb51('0x67')]({'where':{'UserId':_0x3b1e6a['id'],'WhatsappQueueId':_0x140a84[_0xdb51('0x46')]['id']},'transaction':_0x4f9c2a});});})[_0xdb51('0x25')](function(){_0x431246[_0xdb51('0x68')](function(_0x526883){socket[_0xdb51('0x69')]('userWhatsappQueue:save',{'UserId':_0x526883['id'],'WhatsappQueueId':_0x6c55aa['id']});});});});});}})[_0xdb51('0x25')](respondWithStatusCode(_0x4bb578,null))[_0xdb51('0x44')](handleError(_0x4bb578,null));};exports[_0xdb51('0x6a')]=function(_0x4700c6,_0x49a171,_0xffbe93){return db[_0xdb51('0x5e')][_0xdb51('0x42')]({'where':{'id':_0x4700c6[_0xdb51('0x32')][_0xdb51('0x62')]},'attributes':['id'],'include':[{'model':db[_0xdb51('0x55')],'as':_0xdb51('0x63'),'attributes':['id'],'raw':!![]}]})[_0xdb51('0x25')](handleEntityNotFound(_0x49a171,null))['then'](function(_0x4dbc3a){var _0x202781=_['map'](_0x4dbc3a,'id');var _0x34f47b=[];var _0x357e0a=[];var _0x10317b=squel['select']();_0x10317b[_0xdb51('0x6b')](_0xdb51('0x6c'))[_0xdb51('0x6d')](_0xdb51('0x6e'),'tq')[_0xdb51('0x6f')](_0xdb51('0x70'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdb51('0x3b')]('WhatsappQueueId\x20=\x20?',_0x4700c6[_0xdb51('0x46')]['id']);for(var _0x429410=0x0;_0x429410<_0x4dbc3a[_0xdb51('0x38')];_0x429410+=0x1){let _0x2b7355=_0x4dbc3a[_0x429410];for(var _0x285921=0x0;_0x285921<_0x2b7355['Agents'][_0xdb51('0x38')];_0x285921+=0x1){let _0x3eece4=_0x2b7355[_0xdb51('0x63')][_0x285921];var _0x535850=_0x10317b[_0xdb51('0x71')]();_0x535850['where']('ut.UserId\x20=\x20?',_0x3eece4['id']);_0x357e0a[_0xdb51('0x72')](db[_0xdb51('0x73')][_0xdb51('0x32')](_0x535850[_0xdb51('0x74')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xdb51('0x25')](function(_0x4374dd){if(_0x4374dd[_0xdb51('0x38')]===0x1){return _0x3eece4['id'];}else{var _0x529e18=_[_0xdb51('0x75')](_[_0xdb51('0x2b')](_0x4374dd,_0xdb51('0x76')),function(_0x4381fc){return _['includes'](_0x202781,_0x4381fc);});if(_0x529e18){return _0x3eece4['id'];}}}));}}return BPromise[_0xdb51('0x77')](_0x357e0a)[_0xdb51('0x25')](function(_0x2973b9){_0x34f47b=_(_0x34f47b)['union'](_0x2973b9)[_0xdb51('0x78')]()[_0xdb51('0x79')]();return db[_0xdb51('0x2c')][_0xdb51('0x47')]({'where':{'id':_0x4700c6[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](function(_0x37e79c){return db[_0xdb51('0x73')][_0xdb51('0x7a')](function(_0x4bf786){return _0x37e79c[_0xdb51('0x6a')](_0x4700c6[_0xdb51('0x32')][_0xdb51('0x62')],{'transaction':_0x4bf786})['then'](function(){if(!_['isEmpty'](_0x34f47b)){return _0x37e79c['removeAgents'](_0x34f47b,{'transaction':_0x4bf786});}})['then'](function(){_0x34f47b[_0xdb51('0x68')](function(_0x3c6f5e){socket[_0xdb51('0x69')](_0xdb51('0x7b'),{'UserId':_0x3c6f5e,'WhatsappQueueId':_0x37e79c['id']});});});});});});})[_0xdb51('0x25')](respondWithStatusCode(_0x49a171,null))[_0xdb51('0x44')](handleError(_0x49a171,null));};exports['addAgents']=function(_0x309512,_0x329940,_0x4acf45){return db[_0xdb51('0x2c')][_0xdb51('0x47')]({'where':{'id':_0x309512[_0xdb51('0x46')]['id']}})['then'](handleEntityNotFound(_0x329940,null))['then'](function(_0x974ddb){if(_0x974ddb){return _0x974ddb['addAgents'](_0x309512[_0xdb51('0x48')][_0xdb51('0x62')],_[_0xdb51('0x7c')](_0x309512[_0xdb51('0x48')],[_0xdb51('0x62'),'id'])||{})[_0xdb51('0x7d')](function(_0x5af202){for(var _0x1efd7f=0x0;_0x1efd7f<_0x309512['body'][_0xdb51('0x62')][_0xdb51('0x38')];_0x1efd7f+=0x1){socket[_0xdb51('0x69')](_0xdb51('0x7e'),{'UserId':Number(_0x309512[_0xdb51('0x48')]['ids'][_0x1efd7f]),'WhatsappQueueId':Number(_0x309512[_0xdb51('0x46')]['id'])});}return _0x5af202;});}})['then'](respondWithResult(_0x329940,null))[_0xdb51('0x44')](handleError(_0x329940,null));};exports['removeAgents']=function(_0x249565,_0x4d21ad,_0x26832e){return db[_0xdb51('0x2c')][_0xdb51('0x47')]({'where':{'id':_0x249565[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](handleEntityNotFound(_0x4d21ad,null))[_0xdb51('0x25')](function(_0x21c01f){if(_0x21c01f){return _0x21c01f[_0xdb51('0x7f')](_0x249565[_0xdb51('0x32')][_0xdb51('0x62')])[_0xdb51('0x25')](function(){if(_['isArray'](_0x249565[_0xdb51('0x32')][_0xdb51('0x62')])){for(var _0x4d8c33=0x0;_0x4d8c33<_0x249565[_0xdb51('0x32')][_0xdb51('0x62')][_0xdb51('0x38')];_0x4d8c33+=0x1){socket[_0xdb51('0x69')]('userWhatsappQueue:remove',{'UserId':Number(_0x249565[_0xdb51('0x32')][_0xdb51('0x62')][_0x4d8c33]),'WhatsappQueueId':Number(_0x249565['params']['id'])});}}else{socket[_0xdb51('0x69')](_0xdb51('0x7b'),{'UserId':Number(_0x249565['query']['ids']),'WhatsappQueueId':Number(_0x249565[_0xdb51('0x46')]['id'])});}});}})[_0xdb51('0x25')](respondWithStatusCode(_0x4d21ad,null))['catch'](handleError(_0x4d21ad,null));};exports['getAgents']=function(_0x440e92,_0x21d670,_0x5de0a3){var _0xe99dea={};var _0x54cd77={};var _0x325a9b;var _0x44e8d4;return db[_0xdb51('0x2c')][_0xdb51('0x52')]({'where':{'id':_0x440e92[_0xdb51('0x46')]['id']}})[_0xdb51('0x25')](handleEntityNotFound(_0x21d670,null))['then'](function(_0x1c442c){if(_0x1c442c){_0x325a9b=_0x1c442c;_0x54cd77[_0xdb51('0x31')]=_[_0xdb51('0x33')](db[_0xdb51('0x55')][_0xdb51('0x2d')]);_0x54cd77['query']=_[_0xdb51('0x33')](_0x440e92[_0xdb51('0x32')]);_0x54cd77[_0xdb51('0x34')]=_[_0xdb51('0x35')](_0x54cd77[_0xdb51('0x31')],_0x54cd77[_0xdb51('0x32')]);_0xe99dea[_0xdb51('0x36')]=_[_0xdb51('0x35')](_0x54cd77[_0xdb51('0x31')],qs[_0xdb51('0x37')](_0x440e92['query']['fields']));_0xe99dea[_0xdb51('0x36')]=_0xe99dea['attributes']['length']?_0xe99dea[_0xdb51('0x36')]:_0x54cd77[_0xdb51('0x31')];_0xe99dea['order']=qs['sort'](_0x440e92[_0xdb51('0x32')][_0xdb51('0x3a')]);_0xe99dea[_0xdb51('0x3b')]=qs['filters'](_[_0xdb51('0x3c')](_0x440e92[_0xdb51('0x32')],_0x54cd77[_0xdb51('0x34')]));if(_0x440e92[_0xdb51('0x32')][_0xdb51('0x3d')]){_0xe99dea['where']=_[_0xdb51('0x3f')](_0xe99dea[_0xdb51('0x3b')],{'$or':_['map'](_0xe99dea[_0xdb51('0x36')],function(_0x52d729){var _0x3e6b0c={};_0x3e6b0c[_0x52d729]={'$like':'%'+_0x440e92[_0xdb51('0x32')]['filter']+'%'};return _0x3e6b0c;})});}_0xe99dea=_['merge']({},_0xe99dea,_0x440e92[_0xdb51('0x40')]);return _0x325a9b[_0xdb51('0x80')](_0xe99dea);}})['then'](function(_0x1750ea){if(_0x1750ea){_0x44e8d4=_0x1750ea[_0xdb51('0x38')];if(!_0x440e92[_0xdb51('0x32')][_0xdb51('0x39')](_0xdb51('0x60'))){_0xe99dea[_0xdb51('0x1f')]=qs[_0xdb51('0x1f')](_0x440e92['query'][_0xdb51('0x1f')]);_0xe99dea['offset']=qs[_0xdb51('0x1d')](_0x440e92['query'][_0xdb51('0x1d')]);}return _0x325a9b['getAgents'](_0xe99dea);}})[_0xdb51('0x25')](function(_0x2d7320){if(_0x2d7320){return _0x2d7320?{'count':_0x44e8d4,'rows':_0x2d7320}:null;}})[_0xdb51('0x25')](respondWithResult(_0x21d670,null))[_0xdb51('0x44')](handleError(_0x21d670,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5ec01c9..8f6aefb 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 _0x8c40=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x597c4f,_0x1cb063){var _0x29438f=function(_0x462a2a){while(--_0x462a2a){_0x597c4f['push'](_0x597c4f['shift']());}};_0x29438f(++_0x1cb063);}(_0x8c40,0xe1));var _0x08c4=function(_0xa7a73a,_0x5ebd13){_0xa7a73a=_0xa7a73a-0x0;var _0x3ac453=_0x8c40[_0xa7a73a];return _0x3ac453;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x08c4('0x0'))['db'][_0x08c4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x08c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x08c4('0x3'),'afterDestroy':_0x08c4('0x4')};function emitEvent(_0x91ce5b){return function(_0x388056,_0x3bd0e0,_0x4ca29d){WhatsappQueueEvents['emit'](_0x91ce5b+':'+_0x388056['id'],_0x388056);WhatsappQueueEvents[_0x08c4('0x5')](_0x91ce5b,_0x388056);_0x4ca29d(null);};}for(var e in events){if(events[_0x08c4('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x08c4('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x335c=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x24fbe0,_0x87d557){var _0x4bf289=function(_0x1e7c8f){while(--_0x1e7c8f){_0x24fbe0['push'](_0x24fbe0['shift']());}};_0x4bf289(++_0x87d557);}(_0x335c,0x152));var _0xc335=function(_0x50933e,_0x15d245){_0x50933e=_0x50933e-0x0;var _0x42060d=_0x335c[_0x50933e];return _0x42060d;};'use strict';var EventEmitter=require(_0xc335('0x0'));var WhatsappQueue=require(_0xc335('0x1'))['db'][_0xc335('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc335('0x3')](0x0);var events={'afterCreate':_0xc335('0x4'),'afterUpdate':'update','afterDestroy':_0xc335('0x5')};function emitEvent(_0x3df089){return function(_0x46c1ee,_0x5358f5,_0x11d37e){WhatsappQueueEvents['emit'](_0x3df089+':'+_0x46c1ee['id'],_0x46c1ee);WhatsappQueueEvents['emit'](_0x3df089,_0x46c1ee);_0x11d37e(null);};}for(var e in events){if(events[_0xc335('0x6')](e)){var event=events[e];WhatsappQueue[_0xc335('0x7')](e,emitEvent(event));}}module[_0xc335('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 902633f..904bcc5 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 _0x725a=['define','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x10e0de,_0x23e263){var _0x277fd=function(_0x5e506b){while(--_0x5e506b){_0x10e0de['push'](_0x10e0de['shift']());}};_0x277fd(++_0x23e263);}(_0x725a,0x10a));var _0xa725=function(_0x4a74e5,_0x108772){_0x4a74e5=_0x4a74e5-0x0;var _0x1339c6=_0x725a[_0x4a74e5];return _0x1339c6;};'use strict';var _=require(_0xa725('0x0'));var util=require(_0xa725('0x1'));var logger=require(_0xa725('0x2'))(_0xa725('0x3'));var moment=require('moment');var BPromise=require(_0xa725('0x4'));var rp=require(_0xa725('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa725('0x6'));var config=require(_0xa725('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xa725('0x8')]=function(_0x3a986e,_0x3e2342){return _0x3a986e[_0xa725('0x9')]('WhatsappQueue',attributes,{'tableName':_0xa725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c2=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x20a270,_0x8b8437){var _0x49429a=function(_0x4dc00b){while(--_0x4dc00b){_0x20a270['push'](_0x20a270['shift']());}};_0x49429a(++_0x8b8437);}(_0xd2c2,0x156));var _0x2d2c=function(_0x5ad5b8,_0x655213){_0x5ad5b8=_0x5ad5b8-0x0;var _0x4db5ed=_0xd2c2[_0x5ad5b8];return _0x4db5ed;};'use strict';var _=require('lodash');var util=require(_0x2d2c('0x0'));var logger=require(_0x2d2c('0x1'))(_0x2d2c('0x2'));var moment=require('moment');var BPromise=require(_0x2d2c('0x3'));var rp=require(_0x2d2c('0x4'));var fs=require('fs');var path=require(_0x2d2c('0x5'));var rimraf=require('rimraf');var config=require(_0x2d2c('0x6'));var attributes=require(_0x2d2c('0x7'));module[_0x2d2c('0x8')]=function(_0x54abb7,_0x422535){return _0x54abb7[_0x2d2c('0x9')](_0x2d2c('0xa'),attributes,{'tableName':_0x2d2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 05111fa..66b5477 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 _0x231a=['raw','where','limit','include','map','attributes','model','ShowWhatsappQueue','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x231a,0x15f));var _0xa231=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x231a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa231('0x0'));var util=require(_0xa231('0x1'));var moment=require('moment');var BPromise=require(_0xa231('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa231('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa231('0x4'))('rpc');var config=require(_0xa231('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa231('0x6')][_0xa231('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa231('0x8'),'port':0x18eb});var socket=require(_0xa231('0x9'))(new Redis(config[_0xa231('0xa')]));require(_0xa231('0xb'))[_0xa231('0xc')](socket);function respondWithRpcPromise(_0x303039,_0x5eec04,_0xdef2c3){return new BPromise(function(_0x12f34a,_0x129ab5){return client[_0xa231('0xd')](_0x303039,_0xdef2c3)[_0xa231('0xe')](function(_0x47903f){logger[_0xa231('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x5eec04,_0xa231('0x10'));logger[_0xa231('0x11')](_0xa231('0x12'),_0x5eec04,'request\x20sent',JSON[_0xa231('0x13')](_0x47903f));if(_0x47903f[_0xa231('0x14')]){if(_0x47903f[_0xa231('0x14')][_0xa231('0x15')]===0x1f4){logger['error'](_0xa231('0x16'),_0x5eec04,_0x47903f['error']['message']);return _0x129ab5(_0x47903f['error'][_0xa231('0x17')]);}logger[_0xa231('0x14')](_0xa231('0x16'),_0x5eec04,_0x47903f[_0xa231('0x14')][_0xa231('0x17')]);return _0x12f34a(_0x47903f[_0xa231('0x14')][_0xa231('0x17')]);}else{logger[_0xa231('0xf')](_0xa231('0x16'),_0x5eec04,_0xa231('0x10'));_0x12f34a(_0x47903f[_0xa231('0x18')][_0xa231('0x17')]);}})['catch'](function(_0xed6b2f){logger[_0xa231('0x14')](_0xa231('0x16'),_0x5eec04,_0xed6b2f);_0x129ab5(_0xed6b2f);});});}exports[_0xa231('0x19')]=function(_0x213a89){var _0x190183=this;return new Promise(function(_0x8ea762,_0x490c1f){return db[_0xa231('0x1a')][_0xa231('0x1b')]({'raw':_0x213a89[_0xa231('0x1c')]?_0x213a89[_0xa231('0x1c')][_0xa231('0x1d')]===undefined?!![]:![]:!![],'where':_0x213a89[_0xa231('0x1c')]?_0x213a89['options'][_0xa231('0x1e')]||null:null,'attributes':_0x213a89[_0xa231('0x1c')]?_0x213a89['options']['attributes']||null:null,'limit':_0x213a89[_0xa231('0x1c')]?_0x213a89['options'][_0xa231('0x1f')]||null:null,'include':_0x213a89[_0xa231('0x1c')]?_0x213a89[_0xa231('0x1c')][_0xa231('0x20')]?_[_0xa231('0x21')](_0x213a89[_0xa231('0x1c')][_0xa231('0x20')],function(_0x4b57a3){return{'model':db[_0x4b57a3['model']],'as':_0x4b57a3['as'],'attributes':_0x4b57a3['attributes'],'include':_0x4b57a3[_0xa231('0x20')]?_[_0xa231('0x21')](_0x4b57a3[_0xa231('0x20')],function(_0x2f0e12){return{'model':db[_0x2f0e12['model']],'as':_0x2f0e12['as'],'attributes':_0x2f0e12[_0xa231('0x22')],'include':_0x2f0e12[_0xa231('0x20')]?_[_0xa231('0x21')](_0x2f0e12['include'],function(_0x2d7e35){return{'model':db[_0x2d7e35[_0xa231('0x23')]],'as':_0x2d7e35['as'],'attributes':_0x2d7e35[_0xa231('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa231('0xe')](function(_0x24837){logger[_0xa231('0xf')]('GetWhatsappQueue',_0x213a89);logger['debug']('GetWhatsappQueue',_0x213a89,JSON[_0xa231('0x13')](_0x24837));_0x8ea762(_0x24837);})['catch'](function(_0x4222cb){logger[_0xa231('0x14')](_0xa231('0x19'),_0x4222cb['message'],_0x213a89);_0x490c1f(_0x190183[_0xa231('0x14')](0x1f4,_0x4222cb[_0xa231('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0xd7a8c1){var _0x579d1f=this;return new Promise(function(_0x5f37cf,_0x1494c2){return db[_0xa231('0x1a')]['find']({'raw':_0xd7a8c1[_0xa231('0x1c')]?_0xd7a8c1[_0xa231('0x1c')][_0xa231('0x1d')]===undefined?!![]:![]:!![],'where':_0xd7a8c1[_0xa231('0x1c')]?_0xd7a8c1[_0xa231('0x1c')][_0xa231('0x1e')]||null:null,'attributes':_0xd7a8c1[_0xa231('0x1c')]?_0xd7a8c1[_0xa231('0x1c')][_0xa231('0x22')]||null:null,'include':_0xd7a8c1[_0xa231('0x1c')]?_0xd7a8c1[_0xa231('0x1c')][_0xa231('0x20')]?_[_0xa231('0x21')](_0xd7a8c1[_0xa231('0x1c')]['include'],function(_0x1bddfb){return{'model':db[_0x1bddfb[_0xa231('0x23')]],'as':_0x1bddfb['as'],'attributes':_0x1bddfb['attributes'],'include':_0x1bddfb[_0xa231('0x20')]?_[_0xa231('0x21')](_0x1bddfb[_0xa231('0x20')],function(_0x4a2bf1){return{'model':db[_0x4a2bf1[_0xa231('0x23')]],'as':_0x4a2bf1['as'],'attributes':_0x4a2bf1[_0xa231('0x22')],'include':_0x4a2bf1[_0xa231('0x20')]?_[_0xa231('0x21')](_0x4a2bf1[_0xa231('0x20')],function(_0x327fbe){return{'model':db[_0x327fbe['model']],'as':_0x327fbe['as'],'attributes':_0x327fbe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x153638){logger[_0xa231('0xf')](_0xa231('0x24'),_0xd7a8c1);logger[_0xa231('0x11')](_0xa231('0x24'),_0xd7a8c1,JSON['stringify'](_0x153638));_0x5f37cf(_0x153638);})[_0xa231('0x25')](function(_0x5772c4){logger[_0xa231('0x14')]('ShowWhatsappQueue',_0x5772c4[_0xa231('0x17')],_0xd7a8c1);_0x1494c2(_0x579d1f['error'](0x1f4,_0x5772c4[_0xa231('0x17')]));});});}; \ No newline at end of file +var _0xd90d=['defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2f0fba,_0x122511){var _0x17736f=function(_0x120a06){while(--_0x120a06){_0x2f0fba['push'](_0x2f0fba['shift']());}};_0x17736f(++_0x122511);}(_0xd90d,0x98));var _0xdd90=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xd90d[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xdd90('0x0'));var util=require(_0xdd90('0x1'));var moment=require('moment');var BPromise=require(_0xdd90('0x2'));var rs=require(_0xdd90('0x3'));var fs=require('fs');var Redis=require(_0xdd90('0x4'));var db=require(_0xdd90('0x5'))['db'];var utils=require(_0xdd90('0x6'));var logger=require('../../config/logger')(_0xdd90('0x7'));var config=require(_0xdd90('0x8'));var jayson=require(_0xdd90('0x9'));var client=jayson[_0xdd90('0xa')][_0xdd90('0xb')]({'port':0x232a});config['redis']=_[_0xdd90('0xc')](config[_0xdd90('0xd')],{'host':_0xdd90('0xe'),'port':0x18eb});var socket=require(_0xdd90('0xf'))(new Redis(config[_0xdd90('0xd')]));require(_0xdd90('0x10'))[_0xdd90('0x11')](socket);function respondWithRpcPromise(_0x5e9862,_0x404c28,_0x1249da){return new BPromise(function(_0x569107,_0xba31af){return client['request'](_0x5e9862,_0x1249da)[_0xdd90('0x12')](function(_0x3074be){logger['info'](_0xdd90('0x13'),_0x404c28,_0xdd90('0x14'));logger[_0xdd90('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x404c28,_0xdd90('0x14'),JSON[_0xdd90('0x16')](_0x3074be));if(_0x3074be[_0xdd90('0x17')]){if(_0x3074be[_0xdd90('0x17')]['code']===0x1f4){logger[_0xdd90('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x404c28,_0x3074be['error'][_0xdd90('0x18')]);return _0xba31af(_0x3074be['error'][_0xdd90('0x18')]);}logger[_0xdd90('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x404c28,_0x3074be[_0xdd90('0x17')][_0xdd90('0x18')]);return _0x569107(_0x3074be[_0xdd90('0x17')][_0xdd90('0x18')]);}else{logger[_0xdd90('0x19')](_0xdd90('0x13'),_0x404c28,_0xdd90('0x14'));_0x569107(_0x3074be[_0xdd90('0x1a')]['message']);}})[_0xdd90('0x1b')](function(_0x3dc2c4){logger[_0xdd90('0x17')](_0xdd90('0x13'),_0x404c28,_0x3dc2c4);_0xba31af(_0x3dc2c4);});});}exports[_0xdd90('0x1c')]=function(_0x5ebfff){var _0x45c239=this;return new Promise(function(_0x2b26f9,_0xc8de2b){return db[_0xdd90('0x1d')][_0xdd90('0x1e')]({'raw':_0x5ebfff[_0xdd90('0x1f')]?_0x5ebfff['options'][_0xdd90('0x20')]===undefined?!![]:![]:!![],'where':_0x5ebfff['options']?_0x5ebfff[_0xdd90('0x1f')][_0xdd90('0x21')]||null:null,'attributes':_0x5ebfff[_0xdd90('0x1f')]?_0x5ebfff[_0xdd90('0x1f')][_0xdd90('0x22')]||null:null,'limit':_0x5ebfff[_0xdd90('0x1f')]?_0x5ebfff[_0xdd90('0x1f')][_0xdd90('0x23')]||null:null,'include':_0x5ebfff[_0xdd90('0x1f')]?_0x5ebfff[_0xdd90('0x1f')]['include']?_[_0xdd90('0x24')](_0x5ebfff['options'][_0xdd90('0x25')],function(_0x414441){return{'model':db[_0x414441[_0xdd90('0x26')]],'as':_0x414441['as'],'attributes':_0x414441[_0xdd90('0x22')],'include':_0x414441[_0xdd90('0x25')]?_[_0xdd90('0x24')](_0x414441[_0xdd90('0x25')],function(_0x283ff5){return{'model':db[_0x283ff5[_0xdd90('0x26')]],'as':_0x283ff5['as'],'attributes':_0x283ff5[_0xdd90('0x22')],'include':_0x283ff5[_0xdd90('0x25')]?_['map'](_0x283ff5['include'],function(_0x25e648){return{'model':db[_0x25e648[_0xdd90('0x26')]],'as':_0x25e648['as'],'attributes':_0x25e648[_0xdd90('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28b866){logger[_0xdd90('0x19')](_0xdd90('0x1c'),_0x5ebfff);logger[_0xdd90('0x15')]('GetWhatsappQueue',_0x5ebfff,JSON['stringify'](_0x28b866));_0x2b26f9(_0x28b866);})[_0xdd90('0x1b')](function(_0x5aa62a){logger[_0xdd90('0x17')](_0xdd90('0x1c'),_0x5aa62a[_0xdd90('0x18')],_0x5ebfff);_0xc8de2b(_0x45c239[_0xdd90('0x17')](0x1f4,_0x5aa62a['message']));});});};exports[_0xdd90('0x27')]=function(_0x21ac8b){var _0x916d5=this;return new Promise(function(_0x1e60e2,_0x13c14c){return db['WhatsappQueue'][_0xdd90('0x28')]({'raw':_0x21ac8b[_0xdd90('0x1f')]?_0x21ac8b[_0xdd90('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x21ac8b['options']?_0x21ac8b[_0xdd90('0x1f')]['where']||null:null,'attributes':_0x21ac8b[_0xdd90('0x1f')]?_0x21ac8b['options'][_0xdd90('0x22')]||null:null,'include':_0x21ac8b['options']?_0x21ac8b[_0xdd90('0x1f')]['include']?_[_0xdd90('0x24')](_0x21ac8b[_0xdd90('0x1f')][_0xdd90('0x25')],function(_0x599489){return{'model':db[_0x599489[_0xdd90('0x26')]],'as':_0x599489['as'],'attributes':_0x599489['attributes'],'include':_0x599489[_0xdd90('0x25')]?_[_0xdd90('0x24')](_0x599489[_0xdd90('0x25')],function(_0x4c86df){return{'model':db[_0x4c86df[_0xdd90('0x26')]],'as':_0x4c86df['as'],'attributes':_0x4c86df[_0xdd90('0x22')],'include':_0x4c86df[_0xdd90('0x25')]?_[_0xdd90('0x24')](_0x4c86df[_0xdd90('0x25')],function(_0x27d7ee){return{'model':db[_0x27d7ee[_0xdd90('0x26')]],'as':_0x27d7ee['as'],'attributes':_0x27d7ee[_0xdd90('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdd90('0x12')](function(_0x119bb2){logger[_0xdd90('0x19')]('ShowWhatsappQueue',_0x21ac8b);logger[_0xdd90('0x15')](_0xdd90('0x27'),_0x21ac8b,JSON['stringify'](_0x119bb2));_0x1e60e2(_0x119bb2);})[_0xdd90('0x1b')](function(_0x5160ad){logger[_0xdd90('0x17')](_0xdd90('0x27'),_0x5160ad[_0xdd90('0x18')],_0x21ac8b);_0x13c14c(_0x916d5[_0xdd90('0x17')](0x1f4,_0x5160ad[_0xdd90('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fe5c842..9a03a5e 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 _0xbaca=['length','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4887e6,_0x3bae8d){var _0x1a7914=function(_0x576269){while(--_0x576269){_0x4887e6['push'](_0x4887e6['shift']());}};_0x1a7914(++_0x3bae8d);}(_0xbaca,0x131));var _0xabac=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0xbaca[_0x2a8860];return _0x2f47a4;};'use strict';var WhatsappQueueEvents=require(_0xabac('0x0'));var events=[_0xabac('0x1'),_0xabac('0x2'),_0xabac('0x3')];function createListener(_0x2b277e,_0x2e449e){return function(_0x121e12){_0x2e449e[_0xabac('0x4')](_0x2b277e,_0x121e12);};}function removeListener(_0x14a60c,_0x14f310){return function(){WhatsappQueueEvents[_0xabac('0x5')](_0x14a60c,_0x14f310);};}exports[_0xabac('0x6')]=function(_0x5daea1){for(var _0x31a9e8=0x0,_0x5fa4cd=events[_0xabac('0x7')];_0x31a9e8<_0x5fa4cd;_0x31a9e8++){var _0x8ebcf=events[_0x31a9e8];var _0x2ba256=createListener('whatsappQueue:'+_0x8ebcf,_0x5daea1);WhatsappQueueEvents['on'](_0x8ebcf,_0x2ba256);}}; \ No newline at end of file +var _0x3061=['./whatsappQueue.events','update','emit','register','length','whatsappQueue:'];(function(_0x45dcf6,_0x19a666){var _0x70fc84=function(_0x429bf6){while(--_0x429bf6){_0x45dcf6['push'](_0x45dcf6['shift']());}};_0x70fc84(++_0x19a666);}(_0x3061,0x156));var _0x1306=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0x3061[_0x54e6f5];return _0x5e8794;};'use strict';var WhatsappQueueEvents=require(_0x1306('0x0'));var events=['save','remove',_0x1306('0x1')];function createListener(_0x3d7744,_0x5a2224){return function(_0x523cff){_0x5a2224[_0x1306('0x2')](_0x3d7744,_0x523cff);};}function removeListener(_0xc0fbca,_0x281577){return function(){WhatsappQueueEvents['removeListener'](_0xc0fbca,_0x281577);};}exports[_0x1306('0x3')]=function(_0x5b8b24){for(var _0xef7ac7=0x0,_0xf62e5d=events[_0x1306('0x4')];_0xef7ac7<_0xf62e5d;_0xef7ac7++){var _0x517edb=events[_0xef7ac7];var _0x18b987=createListener(_0x1306('0x5')+_0x517edb,_0x5b8b24);WhatsappQueueEvents['on'](_0x517edb,_0x18b987);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b0f00a3..c71ad01 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 _0x81b8=['post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x81b8,0x1ce));var _0x881b=function(_0x32c4bf,_0x66ddd9){_0x32c4bf=_0x32c4bf-0x0;var _0x4f410a=_0x81b8[_0x32c4bf];return _0x4f410a;};'use strict';var multer=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var path=require(_0x881b('0x2'));var timeout=require(_0x881b('0x3'));var express=require(_0x881b('0x4'));var router=express[_0x881b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x881b('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x881b('0x7')]('/',auth[_0x881b('0x8')](),controller[_0x881b('0x9')]);router[_0x881b('0x7')](_0x881b('0xa'),auth['isAuthenticated'](),controller[_0x881b('0xb')]);router[_0x881b('0x7')]('/:id',auth[_0x881b('0x8')](),controller[_0x881b('0xc')]);router[_0x881b('0xd')]('/',auth['isAuthenticated'](),controller[_0x881b('0xe')]);router[_0x881b('0xf')](_0x881b('0x10'),auth[_0x881b('0x8')](),controller['update']);router[_0x881b('0x11')](_0x881b('0x10'),auth['isAuthenticated'](),controller[_0x881b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x240d=['create','update','destroy','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x240d,0xbf));var _0xd240=function(_0x45e465,_0x1ada98){_0x45e465=_0x45e465-0x0;var _0x5106f6=_0x240d[_0x45e465];return _0x5106f6;};'use strict';var multer=require(_0xd240('0x0'));var util=require('util');var path=require(_0xd240('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd240('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd240('0x3'));var config=require(_0xd240('0x4'));var controller=require(_0xd240('0x5'));router[_0xd240('0x6')]('/',auth[_0xd240('0x7')](),controller[_0xd240('0x8')]);router[_0xd240('0x6')](_0xd240('0x9'),auth[_0xd240('0x7')](),controller[_0xd240('0xa')]);router[_0xd240('0x6')](_0xd240('0xb'),auth[_0xd240('0x7')](),controller[_0xd240('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd240('0xd')]);router['put'](_0xd240('0xb'),auth[_0xd240('0x7')](),controller[_0xd240('0xe')]);router['delete'](_0xd240('0xb'),auth['isAuthenticated'](),controller[_0xd240('0xf')]);module[_0xd240('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c9287a1..9335ff6 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x129ae9,_0x4ef6e8){var _0x1cffaa=function(_0x52d0d5){while(--_0x52d0d5){_0x129ae9['push'](_0x129ae9['shift']());}};_0x1cffaa(++_0x4ef6e8);}(_0x7a54,0x106));var _0x47a5=function(_0x4a10fb,_0x2a1599){_0x4a10fb=_0x4a10fb-0x0;var _0x5d3ce1=_0x7a54[_0x4a10fb];return _0x5d3ce1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5661bd,_0x52e180){var _0x344c84=function(_0x363bbf){while(--_0x363bbf){_0x5661bd['push'](_0x5661bd['shift']());}};_0x344c84(++_0x52e180);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 5e20d21..9c4b24d 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 _0x0972=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','catch','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x10d61b,_0x6edfea){var _0x534809=function(_0xb071c2){while(--_0xb071c2){_0x10d61b['push'](_0x10d61b['shift']());}};_0x534809(++_0x6edfea);}(_0x0972,0x64));var _0x2097=function(_0x50604d,_0x510952){_0x50604d=_0x50604d-0x0;var _0x571e99=_0x0972[_0x50604d];return _0x571e99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)[_0x2097('0x1c')]();});}};}function handleEntityNotFound(_0x345875,_0x9f59bc){return function(_0x499988){if(!_0x499988){_0x345875[_0x2097('0x1a')](0x194);}return _0x499988;};}function handleError(_0x80c5ee,_0x56af3b){_0x56af3b=_0x56af3b||0x1f4;return function(_0x1229fc){logger['error'](_0x1229fc[_0x2097('0x28')]);if(_0x1229fc['name']){delete _0x1229fc[_0x2097('0x29')];}_0x80c5ee[_0x2097('0x1b')](_0x56af3b)[_0x2097('0x2a')](_0x1229fc);};}exports[_0x2097('0x2b')]=function(_0x410afa,_0x36228c){var _0x450e0b={},_0x4b443d={},_0x11242f={'count':0x0,'rows':[]};var _0x14d964=_['map'](db[_0x2097('0x2c')][_0x2097('0x2d')],function(_0x59fb84){return{'name':_0x59fb84['fieldName'],'type':_0x59fb84[_0x2097('0x2e')][_0x2097('0x2f')]};});_0x4b443d[_0x2097('0x30')]=_[_0x2097('0x31')](_0x14d964,_0x2097('0x29'));_0x4b443d[_0x2097('0x32')]=_['keys'](_0x410afa[_0x2097('0x32')]);_0x4b443d['filters']=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x30')],_0x4b443d[_0x2097('0x32')]);_0x450e0b[_0x2097('0x34')]=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x30')],qs[_0x2097('0x35')](_0x410afa[_0x2097('0x32')][_0x2097('0x35')]));_0x450e0b['attributes']=_0x450e0b[_0x2097('0x34')][_0x2097('0x36')]?_0x450e0b[_0x2097('0x34')]:_0x4b443d['model'];if(!_0x410afa[_0x2097('0x32')][_0x2097('0x37')](_0x2097('0x38'))){_0x450e0b[_0x2097('0x1f')]=qs['limit'](_0x410afa['query']['limit']);_0x450e0b[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x410afa[_0x2097('0x32')][_0x2097('0x1e')]);}_0x450e0b[_0x2097('0x39')]=qs[_0x2097('0x3a')](_0x410afa['query'][_0x2097('0x3a')]);_0x450e0b[_0x2097('0x3b')]=qs[_0x2097('0x3c')](_[_0x2097('0x3d')](_0x410afa[_0x2097('0x32')],_0x4b443d[_0x2097('0x3c')]),_0x14d964);if(_0x410afa['query'][_0x2097('0x3e')]){_0x450e0b[_0x2097('0x3b')]=_[_0x2097('0x3f')](_0x450e0b['where'],{'$or':_['map'](_0x14d964,function(_0x57649e){if(_0x57649e[_0x2097('0x2e')]!==_0x2097('0x40')){var _0x85b01e={};_0x85b01e[_0x57649e[_0x2097('0x29')]]={'$like':'%'+_0x410afa[_0x2097('0x32')][_0x2097('0x3e')]+'%'};return _0x85b01e;}})});}_0x450e0b=_[_0x2097('0x3f')]({},_0x450e0b,_0x410afa[_0x2097('0x41')]);var _0x3bfb5c={'where':_0x450e0b[_0x2097('0x3b')]};return db[_0x2097('0x2c')]['count'](_0x3bfb5c)[_0x2097('0x26')](function(_0x2f5378){_0x11242f[_0x2097('0x21')]=_0x2f5378;if(_0x410afa['query'][_0x2097('0x42')]){_0x450e0b[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2c')][_0x2097('0x44')](_0x450e0b);})[_0x2097('0x26')](function(_0xd4d89e){_0x11242f[_0x2097('0x45')]=_0xd4d89e;return _0x11242f;})[_0x2097('0x26')](respondWithFilteredResult(_0x36228c,_0x450e0b))['catch'](handleError(_0x36228c,null));};exports[_0x2097('0x46')]=function(_0x283adc,_0x186ca5){var _0x3288ae={'raw':!![],'where':{'id':_0x283adc[_0x2097('0x47')]['id']}},_0x12e0e2={};_0x12e0e2[_0x2097('0x30')]=_[_0x2097('0x48')](db['WhatsappQueueReport'][_0x2097('0x2d')]);_0x12e0e2['query']=_[_0x2097('0x48')](_0x283adc[_0x2097('0x32')]);_0x12e0e2[_0x2097('0x3c')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x30')],_0x12e0e2['query']);_0x3288ae[_0x2097('0x34')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x30')],qs[_0x2097('0x35')](_0x283adc[_0x2097('0x32')]['fields']));_0x3288ae[_0x2097('0x34')]=_0x3288ae[_0x2097('0x34')][_0x2097('0x36')]?_0x3288ae[_0x2097('0x34')]:_0x12e0e2[_0x2097('0x30')];if(_0x283adc[_0x2097('0x32')][_0x2097('0x42')]){_0x3288ae[_0x2097('0x43')]=[{'all':!![]}];}_0x3288ae=_['merge']({},_0x3288ae,_0x283adc[_0x2097('0x41')]);return db[_0x2097('0x2c')][_0x2097('0x49')](_0x3288ae)[_0x2097('0x26')](handleEntityNotFound(_0x186ca5,null))['then'](respondWithResult(_0x186ca5,null))['catch'](handleError(_0x186ca5,null));};exports['create']=function(_0xdf0b6e,_0x396979){return db['WhatsappQueueReport'][_0x2097('0x4a')](_0xdf0b6e[_0x2097('0x4b')],{})['then'](respondWithResult(_0x396979,0xc9))['catch'](handleError(_0x396979,null));};exports[_0x2097('0x25')]=function(_0x21829d,_0x1b4de6){if(_0x21829d['body']['id']){delete _0x21829d[_0x2097('0x4b')]['id'];}return db[_0x2097('0x2c')]['find']({'where':{'id':_0x21829d[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x1b4de6,null))[_0x2097('0x26')](saveUpdates(_0x21829d[_0x2097('0x4b')],null))[_0x2097('0x26')](respondWithResult(_0x1b4de6,null))['catch'](handleError(_0x1b4de6,null));};exports['destroy']=function(_0x140b41,_0x39f9cb){return db[_0x2097('0x2c')]['find']({'where':{'id':_0x140b41['params']['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x39f9cb,null))[_0x2097('0x26')](removeEntity(_0x39f9cb,null))['catch'](handleError(_0x39f9cb,null));};exports[_0x2097('0x4c')]=function(_0x33583e,_0x12bdbd){return db[_0x2097('0x2c')][_0x2097('0x4c')]()['then'](respondWithResult(_0x12bdbd,null))[_0x2097('0x4d')](handleError(_0x12bdbd,null));}; \ No newline at end of file +var _0xb78e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xd42fed,_0x4b36a7){var _0x394f68=function(_0x21e8dd){while(--_0x21e8dd){_0xd42fed['push'](_0xd42fed['shift']());}};_0x394f68(++_0x4b36a7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3692f8,_0x5e2071){_0x3692f8=_0x3692f8-0x0;var _0x1561f3=_0xb78e[_0x3692f8];return _0x1561f3;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){_0x3c8e66[_0xeb78('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a00b,_0x5fc575){return function(_0x315f98){if(!_0x315f98){_0x9a00b[_0xeb78('0x1d')](0x194);}return _0x315f98;};}function handleError(_0x4bcdcf,_0x108052){_0x108052=_0x108052||0x1f4;return function(_0x515158){logger[_0xeb78('0x28')](_0x515158[_0xeb78('0x29')]);if(_0x515158[_0xeb78('0x2a')]){delete _0x515158['name'];}_0x4bcdcf[_0xeb78('0x1e')](_0x108052)[_0xeb78('0x2b')](_0x515158);};}exports[_0xeb78('0x2c')]=function(_0x381b2f,_0x3d4a97){var _0x3516b8={},_0x1131a9={},_0x22c25f={'count':0x0,'rows':[]};var _0x29d6cf=_[_0xeb78('0x2d')](db[_0xeb78('0x2e')]['rawAttributes'],function(_0x555d89){return{'name':_0x555d89['fieldName'],'type':_0x555d89[_0xeb78('0x2f')][_0xeb78('0x30')]};});_0x1131a9[_0xeb78('0x31')]=_['map'](_0x29d6cf,_0xeb78('0x2a'));_0x1131a9[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x381b2f[_0xeb78('0x32')]);_0x1131a9[_0xeb78('0x34')]=_[_0xeb78('0x35')](_0x1131a9[_0xeb78('0x31')],_0x1131a9[_0xeb78('0x32')]);_0x3516b8[_0xeb78('0x36')]=_['intersection'](_0x1131a9[_0xeb78('0x31')],qs['fields'](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x37')]));_0x3516b8[_0xeb78('0x36')]=_0x3516b8[_0xeb78('0x36')][_0xeb78('0x38')]?_0x3516b8[_0xeb78('0x36')]:_0x1131a9['model'];if(!_0x381b2f['query'][_0xeb78('0x39')](_0xeb78('0x3a'))){_0x3516b8[_0xeb78('0x3b')]=qs[_0xeb78('0x3b')](_0x381b2f[_0xeb78('0x32')]['limit']);_0x3516b8[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x20')]);}_0x3516b8[_0xeb78('0x3c')]=qs[_0xeb78('0x3d')](_0x381b2f['query']['sort']);_0x3516b8['where']=qs['filters'](_[_0xeb78('0x3e')](_0x381b2f[_0xeb78('0x32')],_0x1131a9[_0xeb78('0x34')]),_0x29d6cf);if(_0x381b2f['query'][_0xeb78('0x3f')]){_0x3516b8[_0xeb78('0x40')]=_['merge'](_0x3516b8['where'],{'$or':_['map'](_0x29d6cf,function(_0xbea3b8){if(_0xbea3b8[_0xeb78('0x2f')]!==_0xeb78('0x41')){var _0x4ea5e2={};_0x4ea5e2[_0xbea3b8[_0xeb78('0x2a')]]={'$like':'%'+_0x381b2f[_0xeb78('0x32')][_0xeb78('0x3f')]+'%'};return _0x4ea5e2;}})});}_0x3516b8=_['merge']({},_0x3516b8,_0x381b2f[_0xeb78('0x42')]);var _0x119848={'where':_0x3516b8[_0xeb78('0x40')]};return db[_0xeb78('0x2e')]['count'](_0x119848)['then'](function(_0x45eaa1){_0x22c25f[_0xeb78('0x22')]=_0x45eaa1;if(_0x381b2f[_0xeb78('0x32')][_0xeb78('0x43')]){_0x3516b8[_0xeb78('0x44')]=[{'all':!![]}];}return db[_0xeb78('0x2e')][_0xeb78('0x45')](_0x3516b8);})[_0xeb78('0x46')](function(_0x47567d){_0x22c25f['rows']=_0x47567d;return _0x22c25f;})[_0xeb78('0x46')](respondWithFilteredResult(_0x3d4a97,_0x3516b8))[_0xeb78('0x47')](handleError(_0x3d4a97,null));};exports[_0xeb78('0x48')]=function(_0x4dfb67,_0x382d6d){var _0x47d80b={'raw':!![],'where':{'id':_0x4dfb67[_0xeb78('0x49')]['id']}},_0x21f81b={};_0x21f81b[_0xeb78('0x31')]=_['keys'](db[_0xeb78('0x2e')][_0xeb78('0x4a')]);_0x21f81b[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x4dfb67[_0xeb78('0x32')]);_0x21f81b['filters']=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],_0x21f81b['query']);_0x47d80b[_0xeb78('0x36')]=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],qs['fields'](_0x4dfb67[_0xeb78('0x32')][_0xeb78('0x37')]));_0x47d80b[_0xeb78('0x36')]=_0x47d80b[_0xeb78('0x36')][_0xeb78('0x38')]?_0x47d80b[_0xeb78('0x36')]:_0x21f81b['model'];if(_0x4dfb67['query'][_0xeb78('0x43')]){_0x47d80b[_0xeb78('0x44')]=[{'all':!![]}];}_0x47d80b=_['merge']({},_0x47d80b,_0x4dfb67[_0xeb78('0x42')]);return db[_0xeb78('0x2e')][_0xeb78('0x4b')](_0x47d80b)[_0xeb78('0x46')](handleEntityNotFound(_0x382d6d,null))[_0xeb78('0x46')](respondWithResult(_0x382d6d,null))[_0xeb78('0x47')](handleError(_0x382d6d,null));};exports[_0xeb78('0x4c')]=function(_0x8b7c79,_0x9d5b17){return db[_0xeb78('0x2e')][_0xeb78('0x4c')](_0x8b7c79[_0xeb78('0x4d')],{})[_0xeb78('0x46')](respondWithResult(_0x9d5b17,0xc9))[_0xeb78('0x47')](handleError(_0x9d5b17,null));};exports[_0xeb78('0x4e')]=function(_0x58e361,_0x2c4616){if(_0x58e361[_0xeb78('0x4d')]['id']){delete _0x58e361[_0xeb78('0x4d')]['id'];}return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x58e361[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x2c4616,null))[_0xeb78('0x46')](saveUpdates(_0x58e361[_0xeb78('0x4d')],null))[_0xeb78('0x46')](respondWithResult(_0x2c4616,null))['catch'](handleError(_0x2c4616,null));};exports['destroy']=function(_0x553f6d,_0x438c20){return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x553f6d[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x438c20,null))[_0xeb78('0x46')](removeEntity(_0x438c20,null))['catch'](handleError(_0x438c20,null));};exports['describe']=function(_0x39a4d1,_0x48e2){return db[_0xeb78('0x2e')]['describe']()[_0xeb78('0x46')](respondWithResult(_0x48e2,null))[_0xeb78('0x47')](handleError(_0x48e2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 67e4617..d7c2eda 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 _0x50e0=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x37644a,_0x1a223a){var _0x48c516=function(_0x1fa32c){while(--_0x1fa32c){_0x37644a['push'](_0x37644a['shift']());}};_0x48c516(++_0x1a223a);}(_0x50e0,0x18a));var _0x050e=function(_0x198be1,_0x25dd10){_0x198be1=_0x198be1-0x0;var _0x1d4a19=_0x50e0[_0x198be1];return _0x1d4a19;};'use strict';var _=require(_0x050e('0x0'));var util=require(_0x050e('0x1'));var logger=require(_0x050e('0x2'))('api');var moment=require(_0x050e('0x3'));var BPromise=require('bluebird');var rp=require(_0x050e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x050e('0x5'));var config=require(_0x050e('0x6'));var attributes=require(_0x050e('0x7'));module[_0x050e('0x8')]=function(_0x179775,_0x2013ff){return _0x179775[_0x050e('0x9')](_0x050e('0xa'),attributes,{'tableName':_0x050e('0xb'),'paranoid':![],'indexes':[{'name':_0x050e('0xc'),'fields':[_0x050e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb69=['rimraf','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x79d1b1,_0x196653){var _0x292007=function(_0x5afdb2){while(--_0x5afdb2){_0x79d1b1['push'](_0x79d1b1['shift']());}};_0x292007(++_0x196653);}(_0xeb69,0x1b2));var _0x9eb6=function(_0x28e001,_0x4f27be){_0x28e001=_0x28e001-0x0;var _0x2a2b2=_0xeb69[_0x28e001];return _0x2a2b2;};'use strict';var _=require(_0x9eb6('0x0'));var util=require(_0x9eb6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9eb6('0x2'));var BPromise=require(_0x9eb6('0x3'));var rp=require(_0x9eb6('0x4'));var fs=require('fs');var path=require(_0x9eb6('0x5'));var rimraf=require(_0x9eb6('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x9eb6('0x7')]=function(_0x4cf80e,_0x12a391){return _0x4cf80e['define'](_0x9eb6('0x8'),attributes,{'tableName':_0x9eb6('0x9'),'paranoid':![],'indexes':[{'name':_0x9eb6('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5e99b20..769e0d3 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 _0x2400=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappQueueReport','body','raw','info','CreateWhatsappQueueReport','debug','update','options','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x615ec1,_0x24f166){var _0x4c6bc7=function(_0x438545){while(--_0x438545){_0x615ec1['push'](_0x615ec1['shift']());}};_0x4c6bc7(++_0x24f166);}(_0x2400,0xdf));var _0x0240=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x2400[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x0240('0x0'));var util=require(_0x0240('0x1'));var moment=require(_0x0240('0x2'));var BPromise=require(_0x0240('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0240('0x4'));var db=require(_0x0240('0x5'))['db'];var utils=require(_0x0240('0x6'));var logger=require('../../config/logger')(_0x0240('0x7'));var config=require(_0x0240('0x8'));var jayson=require(_0x0240('0x9'));var client=jayson[_0x0240('0xa')][_0x0240('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50036c,_0xe258f,_0xd5c66a){return new BPromise(function(_0x42dc0d,_0x4dfe82){return client[_0x0240('0xc')](_0x50036c,_0xd5c66a)[_0x0240('0xd')](function(_0x1d6e74){logger['info'](_0x0240('0xe'),_0xe258f,'request\x20sent');logger['debug'](_0x0240('0xf'),_0xe258f,_0x0240('0x10'),JSON[_0x0240('0x11')](_0x1d6e74));if(_0x1d6e74['error']){if(_0x1d6e74[_0x0240('0x12')][_0x0240('0x13')]===0x1f4){logger[_0x0240('0x12')](_0x0240('0xe'),_0xe258f,_0x1d6e74['error']['message']);return _0x4dfe82(_0x1d6e74[_0x0240('0x12')]['message']);}logger['error'](_0x0240('0xe'),_0xe258f,_0x1d6e74[_0x0240('0x12')]['message']);return _0x42dc0d(_0x1d6e74['error'][_0x0240('0x14')]);}else{logger['info'](_0x0240('0xe'),_0xe258f,'request\x20sent');_0x42dc0d(_0x1d6e74[_0x0240('0x15')][_0x0240('0x14')]);}})[_0x0240('0x16')](function(_0x46a284){logger[_0x0240('0x12')](_0x0240('0xe'),_0xe258f,_0x46a284);_0x4dfe82(_0x46a284);});});}exports['CreateWhatsappQueueReport']=function(_0x2f30ec){var _0x4613c0=this;return new Promise(function(_0x1fdfa9,_0x570747){return db[_0x0240('0x17')]['create'](_0x2f30ec[_0x0240('0x18')],{'raw':_0x2f30ec['options']?_0x2f30ec['options'][_0x0240('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a6086){logger[_0x0240('0x1a')](_0x0240('0x1b'),_0x2f30ec);logger[_0x0240('0x1c')](_0x0240('0x1b'),_0x2f30ec,JSON[_0x0240('0x11')](_0x5a6086));_0x1fdfa9(_0x5a6086);})[_0x0240('0x16')](function(_0x5dd6b4){logger[_0x0240('0x12')]('CreateWhatsappQueueReport',_0x5dd6b4[_0x0240('0x14')],_0x2f30ec);_0x570747(_0x4613c0[_0x0240('0x12')](0x1f4,_0x5dd6b4[_0x0240('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4aa401){var _0x40e5eb=this;return new Promise(function(_0x12a39e,_0x6a7885){return db[_0x0240('0x17')][_0x0240('0x1d')](_0x4aa401[_0x0240('0x18')],{'raw':_0x4aa401[_0x0240('0x1e')]?_0x4aa401[_0x0240('0x1e')][_0x0240('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aa401[_0x0240('0x1e')]?_0x4aa401[_0x0240('0x1e')][_0x0240('0x1f')]||null:null,'attributes':_0x4aa401[_0x0240('0x1e')]?_0x4aa401[_0x0240('0x1e')][_0x0240('0x20')]||null:null,'limit':_0x4aa401[_0x0240('0x1e')]?_0x4aa401[_0x0240('0x1e')][_0x0240('0x21')]||null:null})[_0x0240('0xd')](function(_0xfc420d){logger['info']('UpdateWhatsappQueueReport',_0x4aa401);logger[_0x0240('0x1c')]('UpdateWhatsappQueueReport',_0x4aa401,JSON[_0x0240('0x11')](_0xfc420d));_0x12a39e(_0xfc420d);})['catch'](function(_0xef9101){logger[_0x0240('0x12')]('UpdateWhatsappQueueReport',_0xef9101[_0x0240('0x14')],_0x4aa401);_0x6a7885(_0x40e5eb[_0x0240('0x12')](0x1f4,_0xef9101['message']));});});}; \ No newline at end of file +var _0xad69=['code','message','info','result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d3a07,_0x598357){var _0x190720=function(_0x12b938){while(--_0x12b938){_0x2d3a07['push'](_0x2d3a07['shift']());}};_0x190720(++_0x598357);}(_0xad69,0x154));var _0x9ad6=function(_0x1038a1,_0x29f1ff){_0x1038a1=_0x1038a1-0x0;var _0x53f0e2=_0xad69[_0x1038a1];return _0x53f0e2;};'use strict';var _=require(_0x9ad6('0x0'));var util=require(_0x9ad6('0x1'));var moment=require(_0x9ad6('0x2'));var BPromise=require(_0x9ad6('0x3'));var rs=require(_0x9ad6('0x4'));var fs=require('fs');var Redis=require(_0x9ad6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ad6('0x6'));var logger=require(_0x9ad6('0x7'))('rpc');var config=require(_0x9ad6('0x8'));var jayson=require(_0x9ad6('0x9'));var client=jayson[_0x9ad6('0xa')][_0x9ad6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x178260,_0x8af18e,_0x787e24){return new BPromise(function(_0x50541f,_0x270d48){return client[_0x9ad6('0xc')](_0x178260,_0x787e24)[_0x9ad6('0xd')](function(_0x1d4885){logger['info'](_0x9ad6('0xe'),_0x8af18e,'request\x20sent');logger[_0x9ad6('0xf')](_0x9ad6('0x10'),_0x8af18e,_0x9ad6('0x11'),JSON[_0x9ad6('0x12')](_0x1d4885));if(_0x1d4885[_0x9ad6('0x13')]){if(_0x1d4885[_0x9ad6('0x13')][_0x9ad6('0x14')]===0x1f4){logger[_0x9ad6('0x13')](_0x9ad6('0xe'),_0x8af18e,_0x1d4885[_0x9ad6('0x13')][_0x9ad6('0x15')]);return _0x270d48(_0x1d4885[_0x9ad6('0x13')]['message']);}logger[_0x9ad6('0x13')](_0x9ad6('0xe'),_0x8af18e,_0x1d4885[_0x9ad6('0x13')][_0x9ad6('0x15')]);return _0x50541f(_0x1d4885[_0x9ad6('0x13')]['message']);}else{logger[_0x9ad6('0x16')](_0x9ad6('0xe'),_0x8af18e,'request\x20sent');_0x50541f(_0x1d4885[_0x9ad6('0x17')]['message']);}})[_0x9ad6('0x18')](function(_0x323dc4){logger[_0x9ad6('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8af18e,_0x323dc4);_0x270d48(_0x323dc4);});});}exports[_0x9ad6('0x19')]=function(_0x3df459){var _0x1052c5=this;return new Promise(function(_0x5b4619,_0x3994f5){return db['WhatsappQueueReport'][_0x9ad6('0x1a')](_0x3df459[_0x9ad6('0x1b')],{'raw':_0x3df459[_0x9ad6('0x1c')]?_0x3df459['options'][_0x9ad6('0x1d')]===undefined?!![]:![]:!![]})[_0x9ad6('0xd')](function(_0x259fea){logger['info'](_0x9ad6('0x19'),_0x3df459);logger['debug'](_0x9ad6('0x19'),_0x3df459,JSON[_0x9ad6('0x12')](_0x259fea));_0x5b4619(_0x259fea);})[_0x9ad6('0x18')](function(_0x166b02){logger['error']('CreateWhatsappQueueReport',_0x166b02[_0x9ad6('0x15')],_0x3df459);_0x3994f5(_0x1052c5[_0x9ad6('0x13')](0x1f4,_0x166b02['message']));});});};exports[_0x9ad6('0x1e')]=function(_0x2588dd){var _0x14fa2f=this;return new Promise(function(_0x157224,_0x1e0ca4){return db[_0x9ad6('0x1f')][_0x9ad6('0x20')](_0x2588dd[_0x9ad6('0x1b')],{'raw':_0x2588dd[_0x9ad6('0x1c')]?_0x2588dd[_0x9ad6('0x1c')][_0x9ad6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2588dd[_0x9ad6('0x1c')]?_0x2588dd[_0x9ad6('0x1c')][_0x9ad6('0x21')]||null:null,'attributes':_0x2588dd['options']?_0x2588dd[_0x9ad6('0x1c')][_0x9ad6('0x22')]||null:null,'limit':_0x2588dd[_0x9ad6('0x1c')]?_0x2588dd[_0x9ad6('0x1c')][_0x9ad6('0x23')]||null:null})[_0x9ad6('0xd')](function(_0x1aa4d0){logger['info'](_0x9ad6('0x1e'),_0x2588dd);logger['debug']('UpdateWhatsappQueueReport',_0x2588dd,JSON[_0x9ad6('0x12')](_0x1aa4d0));_0x157224(_0x1aa4d0);})[_0x9ad6('0x18')](function(_0x55d4f1){logger[_0x9ad6('0x13')]('UpdateWhatsappQueueReport',_0x55d4f1[_0x9ad6('0x15')],_0x2588dd);_0x1e0ca4(_0x14fa2f[_0x9ad6('0x13')](0x1f4,_0x55d4f1[_0x9ad6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1869fb0..ca6cfe3 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 _0x1abc=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x59148a,_0x286f69){var _0x1319f1=function(_0x36e185){while(--_0x36e185){_0x59148a['push'](_0x59148a['shift']());}};_0x1319f1(++_0x286f69);}(_0x1abc,0x149));var _0xc1ab=function(_0x239ad9,_0xc388ca){_0x239ad9=_0x239ad9-0x0;var _0x277524=_0x1abc[_0x239ad9];return _0x277524;};'use strict';var multer=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var path=require(_0xc1ab('0x2'));var timeout=require(_0xc1ab('0x3'));var express=require(_0xc1ab('0x4'));var router=express['Router']();var fs_extra=require(_0xc1ab('0x5'));var auth=require(_0xc1ab('0x6'));var interaction=require(_0xc1ab('0x7'));var config=require(_0xc1ab('0x8'));var controller=require(_0xc1ab('0x9'));router[_0xc1ab('0xa')]('/',auth[_0xc1ab('0xb')](),controller[_0xc1ab('0xc')]);router[_0xc1ab('0xa')]('/describe',auth[_0xc1ab('0xb')](),controller[_0xc1ab('0xd')]);router[_0xc1ab('0xa')](_0xc1ab('0xe'),auth[_0xc1ab('0xb')](),controller[_0xc1ab('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc1ab('0x10')]);router[_0xc1ab('0x11')](_0xc1ab('0xe'),auth[_0xc1ab('0xb')](),controller[_0xc1ab('0x12')]);router[_0xc1ab('0x13')](_0xc1ab('0xe'),auth['isAuthenticated'](),controller[_0xc1ab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7d74=['create','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','describe','isAuthenticated','show','post'];(function(_0x41c18a,_0x2cf0f2){var _0x5af13c=function(_0x1d26c5){while(--_0x1d26c5){_0x41c18a['push'](_0x41c18a['shift']());}};_0x5af13c(++_0x2cf0f2);}(_0x7d74,0xa5));var _0x47d7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7d74[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var path=require(_0x47d7('0x2'));var timeout=require(_0x47d7('0x3'));var express=require(_0x47d7('0x4'));var router=express[_0x47d7('0x5')]();var fs_extra=require(_0x47d7('0x6'));var auth=require(_0x47d7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x47d7('0x8'));var controller=require(_0x47d7('0x9'));router[_0x47d7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x47d7('0xb')]);router[_0x47d7('0xa')]('/:id',auth[_0x47d7('0xc')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')]('/',auth[_0x47d7('0xc')](),controller[_0x47d7('0xf')]);router['put']('/:id',auth[_0x47d7('0xc')](),controller[_0x47d7('0x10')]);router[_0x47d7('0x11')](_0x47d7('0x12'),auth[_0x47d7('0xc')](),controller[_0x47d7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 120b04f..a4913ff 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 _0x1d21=['DATE','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1d21,0x158));var _0x11d2=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x1d21[_0xbb14db];return _0x36bed7;};'use strict';var Sequelize=require(_0x11d2('0x0'));module[_0x11d2('0x1')]={'uniqueid':{'type':Sequelize[_0x11d2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x11d2('0x3')]('account',_0x11d2('0x4'),_0x11d2('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x11d2('0x6')]}}; \ No newline at end of file +var _0x9805=['ENUM','queue','DATE','sequelize','exports','STRING'];(function(_0x1a88db,_0x21742f){var _0xd393f7=function(_0x56b5c2){while(--_0x56b5c2){_0x1a88db['push'](_0x1a88db['shift']());}};_0xd393f7(++_0x21742f);}(_0x9805,0x18f));var _0x5980=function(_0x2e19ac,_0x5ee48a){_0x2e19ac=_0x2e19ac-0x0;var _0x29d578=_0x9805[_0x2e19ac];return _0x29d578;};'use strict';var Sequelize=require(_0x5980('0x0'));module[_0x5980('0x1')]={'uniqueid':{'type':Sequelize[_0x5980('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5980('0x3')]('account','agent',_0x5980('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5980('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 754b0df..e9a5d62 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 _0x4332=['mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappTransferReport','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','rawAttributes','options','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2504cf,_0xcb86f4){var _0x601ec7=function(_0x4442c5){while(--_0x4442c5){_0x2504cf['push'](_0x2504cf['shift']());}};_0x601ec7(++_0xcb86f4);}(_0x4332,0x8b));var _0x2433=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4332[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2433('0x0'));var jsonpatch=require(_0x2433('0x1'));var rp=require(_0x2433('0x2'));var moment=require(_0x2433('0x3'));var BPromise=require(_0x2433('0x4'));var Mustache=require(_0x2433('0x5'));var util=require(_0x2433('0x6'));var path=require('path');var sox=require(_0x2433('0x7'));var csv=require(_0x2433('0x8'));var ejs=require(_0x2433('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2433('0xa'));var squel=require('squel');var crypto=require(_0x2433('0xb'));var jsforce=require(_0x2433('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2433('0x8'));var querystring=require(_0x2433('0xd'));var Papa=require(_0x2433('0xe'));var Redis=require('ioredis');var authService=require(_0x2433('0xf'));var qs=require(_0x2433('0x10'));var as=require(_0x2433('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2433('0x12'))('api');var utils=require(_0x2433('0x13'));var config=require(_0x2433('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2433('0x15'))['db'];function respondWithStatusCode(_0x5a3e46,_0x37ccd9){_0x37ccd9=_0x37ccd9||0xcc;return function(_0x2d0df4){if(_0x2d0df4){return _0x5a3e46['sendStatus'](_0x37ccd9);}return _0x5a3e46[_0x2433('0x16')](_0x37ccd9)['end']();};}function respondWithResult(_0x1206ae,_0x4edb33){_0x4edb33=_0x4edb33||0xc8;return function(_0x131dd8){if(_0x131dd8){return _0x1206ae[_0x2433('0x16')](_0x4edb33)['json'](_0x131dd8);}};}function respondWithFilteredResult(_0x5af940,_0xc956ca){return function(_0x2e36f3){if(_0x2e36f3){var _0x1cfc37=typeof _0xc956ca['offset']===_0x2433('0x17')&&typeof _0xc956ca[_0x2433('0x18')]===_0x2433('0x17');var _0x902d51=_0x2e36f3[_0x2433('0x19')];var _0x44fd71=_0x1cfc37?0x0:_0xc956ca[_0x2433('0x1a')];var _0x1be88b=_0x1cfc37?_0x2e36f3[_0x2433('0x19')]:_0xc956ca[_0x2433('0x1a')]+_0xc956ca[_0x2433('0x18')];var _0x1c3389;if(_0x1be88b>=_0x902d51){_0x1be88b=_0x902d51;_0x1c3389=0xc8;}else{_0x1c3389=0xce;}_0x5af940[_0x2433('0x16')](_0x1c3389);return _0x5af940[_0x2433('0x1b')](_0x2433('0x1c'),_0x44fd71+'-'+_0x1be88b+'/'+_0x902d51)[_0x2433('0x1d')](_0x2e36f3);}return null;};}function patchUpdates(_0x19cdc1){return function(_0x4838d9){try{jsonpatch[_0x2433('0x1e')](_0x4838d9,_0x19cdc1,!![]);}catch(_0xb1c107){return BPromise[_0x2433('0x1f')](_0xb1c107);}return _0x4838d9[_0x2433('0x20')]();};}function saveUpdates(_0xf9a1c3,_0x152af1){return function(_0x3de18c){if(_0x3de18c){return _0x3de18c[_0x2433('0x21')](_0xf9a1c3)[_0x2433('0x22')](function(_0xa71614){return _0xa71614;});}return null;};}function removeEntity(_0x10a155,_0x331a10){return function(_0x3f74be){if(_0x3f74be){return _0x3f74be[_0x2433('0x23')]()[_0x2433('0x22')](function(){_0x10a155['status'](0xcc)[_0x2433('0x24')]();});}};}function handleEntityNotFound(_0x2ffea9,_0x1e1f2e){return function(_0x1a48dd){if(!_0x1a48dd){_0x2ffea9[_0x2433('0x25')](0x194);}return _0x1a48dd;};}function handleError(_0x1dd664,_0x1b96a0){_0x1b96a0=_0x1b96a0||0x1f4;return function(_0x1a7137){logger[_0x2433('0x26')](_0x1a7137['stack']);if(_0x1a7137[_0x2433('0x27')]){delete _0x1a7137[_0x2433('0x27')];}_0x1dd664[_0x2433('0x16')](_0x1b96a0)[_0x2433('0x28')](_0x1a7137);};}exports[_0x2433('0x29')]=function(_0x4deacd,_0x5158c3){var _0x285bff={},_0x1f02a8={},_0x42bd62={'count':0x0,'rows':[]};var _0x4cf268=_[_0x2433('0x2a')](db[_0x2433('0x2b')]['rawAttributes'],function(_0x4a9154){return{'name':_0x4a9154['fieldName'],'type':_0x4a9154['type'][_0x2433('0x2c')]};});_0x1f02a8['model']=_[_0x2433('0x2a')](_0x4cf268,_0x2433('0x27'));_0x1f02a8['query']=_[_0x2433('0x2d')](_0x4deacd[_0x2433('0x2e')]);_0x1f02a8[_0x2433('0x2f')]=_[_0x2433('0x30')](_0x1f02a8[_0x2433('0x31')],_0x1f02a8['query']);_0x285bff[_0x2433('0x32')]=_['intersection'](_0x1f02a8[_0x2433('0x31')],qs[_0x2433('0x33')](_0x4deacd[_0x2433('0x2e')]['fields']));_0x285bff[_0x2433('0x32')]=_0x285bff[_0x2433('0x32')][_0x2433('0x34')]?_0x285bff[_0x2433('0x32')]:_0x1f02a8[_0x2433('0x31')];if(!_0x4deacd['query'][_0x2433('0x35')](_0x2433('0x36'))){_0x285bff['limit']=qs[_0x2433('0x18')](_0x4deacd[_0x2433('0x2e')]['limit']);_0x285bff[_0x2433('0x1a')]=qs['offset'](_0x4deacd['query'][_0x2433('0x1a')]);}_0x285bff['order']=qs['sort'](_0x4deacd[_0x2433('0x2e')][_0x2433('0x37')]);_0x285bff[_0x2433('0x38')]=qs[_0x2433('0x2f')](_[_0x2433('0x39')](_0x4deacd[_0x2433('0x2e')],_0x1f02a8[_0x2433('0x2f')]),_0x4cf268);if(_0x4deacd[_0x2433('0x2e')][_0x2433('0x3a')]){_0x285bff[_0x2433('0x38')]=_[_0x2433('0x3b')](_0x285bff['where'],{'$or':_[_0x2433('0x2a')](_0x4cf268,function(_0x201d8f){if(_0x201d8f['type']!==_0x2433('0x3c')){var _0x24d673={};_0x24d673[_0x201d8f[_0x2433('0x27')]]={'$like':'%'+_0x4deacd[_0x2433('0x2e')][_0x2433('0x3a')]+'%'};return _0x24d673;}})});}_0x285bff=_['merge']({},_0x285bff,_0x4deacd['options']);var _0x15bffb={'where':_0x285bff[_0x2433('0x38')]};return db['WhatsappTransferReport']['count'](_0x15bffb)['then'](function(_0x267371){_0x42bd62[_0x2433('0x19')]=_0x267371;if(_0x4deacd[_0x2433('0x2e')]['includeAll']){_0x285bff[_0x2433('0x3d')]=[{'all':!![]}];}return db[_0x2433('0x2b')][_0x2433('0x3e')](_0x285bff);})[_0x2433('0x22')](function(_0x40e0af){_0x42bd62['rows']=_0x40e0af;return _0x42bd62;})[_0x2433('0x22')](respondWithFilteredResult(_0x5158c3,_0x285bff))[_0x2433('0x3f')](handleError(_0x5158c3,null));};exports[_0x2433('0x40')]=function(_0x1516b5,_0x1bb1c6){var _0x53c59d={'raw':!![],'where':{'id':_0x1516b5['params']['id']}},_0x3cb538={};_0x3cb538[_0x2433('0x31')]=_[_0x2433('0x2d')](db[_0x2433('0x2b')][_0x2433('0x41')]);_0x3cb538[_0x2433('0x2e')]=_[_0x2433('0x2d')](_0x1516b5['query']);_0x3cb538['filters']=_[_0x2433('0x30')](_0x3cb538['model'],_0x3cb538[_0x2433('0x2e')]);_0x53c59d[_0x2433('0x32')]=_['intersection'](_0x3cb538[_0x2433('0x31')],qs[_0x2433('0x33')](_0x1516b5[_0x2433('0x2e')][_0x2433('0x33')]));_0x53c59d['attributes']=_0x53c59d['attributes'][_0x2433('0x34')]?_0x53c59d[_0x2433('0x32')]:_0x3cb538[_0x2433('0x31')];if(_0x1516b5[_0x2433('0x2e')]['includeAll']){_0x53c59d[_0x2433('0x3d')]=[{'all':!![]}];}_0x53c59d=_[_0x2433('0x3b')]({},_0x53c59d,_0x1516b5[_0x2433('0x42')]);return db[_0x2433('0x2b')]['find'](_0x53c59d)[_0x2433('0x22')](handleEntityNotFound(_0x1bb1c6,null))[_0x2433('0x22')](respondWithResult(_0x1bb1c6,null))['catch'](handleError(_0x1bb1c6,null));};exports[_0x2433('0x43')]=function(_0x3d9452,_0x21caa1){return db[_0x2433('0x2b')][_0x2433('0x43')](_0x3d9452['body'],{})[_0x2433('0x22')](respondWithResult(_0x21caa1,0xc9))['catch'](handleError(_0x21caa1,null));};exports[_0x2433('0x21')]=function(_0x2664db,_0x267fb4){if(_0x2664db[_0x2433('0x44')]['id']){delete _0x2664db[_0x2433('0x44')]['id'];}return db[_0x2433('0x2b')][_0x2433('0x45')]({'where':{'id':_0x2664db[_0x2433('0x46')]['id']}})[_0x2433('0x22')](handleEntityNotFound(_0x267fb4,null))[_0x2433('0x22')](saveUpdates(_0x2664db[_0x2433('0x44')],null))['then'](respondWithResult(_0x267fb4,null))['catch'](handleError(_0x267fb4,null));};exports[_0x2433('0x23')]=function(_0x22bed9,_0x4a002f){return db['WhatsappTransferReport'][_0x2433('0x45')]({'where':{'id':_0x22bed9['params']['id']}})['then'](handleEntityNotFound(_0x4a002f,null))['then'](removeEntity(_0x4a002f,null))[_0x2433('0x3f')](handleError(_0x4a002f,null));};exports[_0x2433('0x47')]=function(_0x3dbd0f,_0x147f26){return db[_0x2433('0x2b')]['describe']()[_0x2433('0x22')](respondWithResult(_0x147f26,null))['catch'](handleError(_0x147f26,null));}; \ No newline at end of file +var _0xd3ee=['query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','stack','name','map','WhatsappTransferReport','type','key','model'];(function(_0x51d18d,_0x7197fe){var _0x35dde4=function(_0x10bd54){while(--_0x10bd54){_0x51d18d['push'](_0x51d18d['shift']());}};_0x35dde4(++_0x7197fe);}(_0xd3ee,0x190));var _0xed3e=function(_0x3ba57e,_0x2e6810){_0x3ba57e=_0x3ba57e-0x0;var _0x5d95cf=_0xd3ee[_0x3ba57e];return _0x5d95cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed3e('0x0'));var zipdir=require(_0xed3e('0x1'));var jsonpatch=require(_0xed3e('0x2'));var rp=require(_0xed3e('0x3'));var moment=require(_0xed3e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed3e('0x5'));var path=require(_0xed3e('0x6'));var sox=require(_0xed3e('0x7'));var csv=require(_0xed3e('0x8'));var ejs=require(_0xed3e('0x9'));var fs=require('fs');var fs_extra=require(_0xed3e('0xa'));var _=require(_0xed3e('0xb'));var squel=require(_0xed3e('0xc'));var crypto=require(_0xed3e('0xd'));var jsforce=require(_0xed3e('0xe'));var deskjs=require(_0xed3e('0xf'));var toCsv=require(_0xed3e('0x8'));var querystring=require(_0xed3e('0x10'));var Papa=require(_0xed3e('0x11'));var Redis=require('ioredis');var authService=require(_0xed3e('0x12'));var qs=require(_0xed3e('0x13'));var as=require(_0xed3e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed3e('0x15'));var utils=require('../../config/utils');var config=require(_0xed3e('0x16'));var licenseUtil=require(_0xed3e('0x17'));var db=require(_0xed3e('0x18'))['db'];function respondWithStatusCode(_0x1132cb,_0x2df230){_0x2df230=_0x2df230||0xcc;return function(_0x38d38e){if(_0x38d38e){return _0x1132cb[_0xed3e('0x19')](_0x2df230);}return _0x1132cb[_0xed3e('0x1a')](_0x2df230)[_0xed3e('0x1b')]();};}function respondWithResult(_0x367723,_0x33e826){_0x33e826=_0x33e826||0xc8;return function(_0x338902){if(_0x338902){return _0x367723[_0xed3e('0x1a')](_0x33e826)[_0xed3e('0x1c')](_0x338902);}};}function respondWithFilteredResult(_0x2d4f23,_0xff6e2e){return function(_0x1135ee){if(_0x1135ee){var _0x1c3db1=typeof _0xff6e2e[_0xed3e('0x1d')]===_0xed3e('0x1e')&&typeof _0xff6e2e[_0xed3e('0x1f')]===_0xed3e('0x1e');var _0x11abbf=_0x1135ee[_0xed3e('0x20')];var _0x38ad91=_0x1c3db1?0x0:_0xff6e2e['offset'];var _0xe9834f=_0x1c3db1?_0x1135ee[_0xed3e('0x20')]:_0xff6e2e[_0xed3e('0x1d')]+_0xff6e2e[_0xed3e('0x1f')];var _0x52660a;if(_0xe9834f>=_0x11abbf){_0xe9834f=_0x11abbf;_0x52660a=0xc8;}else{_0x52660a=0xce;}_0x2d4f23[_0xed3e('0x1a')](_0x52660a);return _0x2d4f23[_0xed3e('0x21')](_0xed3e('0x22'),_0x38ad91+'-'+_0xe9834f+'/'+_0x11abbf)[_0xed3e('0x1c')](_0x1135ee);}return null;};}function patchUpdates(_0x111702){return function(_0x4f885c){try{jsonpatch['apply'](_0x4f885c,_0x111702,!![]);}catch(_0x19d377){return BPromise['reject'](_0x19d377);}return _0x4f885c[_0xed3e('0x23')]();};}function saveUpdates(_0x5e4722,_0x4d4794){return function(_0x3724c2){if(_0x3724c2){return _0x3724c2['update'](_0x5e4722)[_0xed3e('0x24')](function(_0x223251){return _0x223251;});}return null;};}function removeEntity(_0x667f6f,_0x525085){return function(_0x4056de){if(_0x4056de){return _0x4056de['destroy']()[_0xed3e('0x24')](function(){_0x667f6f[_0xed3e('0x1a')](0xcc)[_0xed3e('0x1b')]();});}};}function handleEntityNotFound(_0x31fc7f,_0x26333f){return function(_0x410b04){if(!_0x410b04){_0x31fc7f['sendStatus'](0x194);}return _0x410b04;};}function handleError(_0x432b92,_0x5ac676){_0x5ac676=_0x5ac676||0x1f4;return function(_0x11b607){logger['error'](_0x11b607[_0xed3e('0x25')]);if(_0x11b607['name']){delete _0x11b607[_0xed3e('0x26')];}_0x432b92[_0xed3e('0x1a')](_0x5ac676)['send'](_0x11b607);};}exports['index']=function(_0x1cdd33,_0x2a6f15){var _0x19c55b={},_0x2be05d={},_0x14feb2={'count':0x0,'rows':[]};var _0xf768b2=_[_0xed3e('0x27')](db[_0xed3e('0x28')]['rawAttributes'],function(_0x56ed90){return{'name':_0x56ed90['fieldName'],'type':_0x56ed90[_0xed3e('0x29')][_0xed3e('0x2a')]};});_0x2be05d[_0xed3e('0x2b')]=_[_0xed3e('0x27')](_0xf768b2,'name');_0x2be05d[_0xed3e('0x2c')]=_[_0xed3e('0x2d')](_0x1cdd33[_0xed3e('0x2c')]);_0x2be05d[_0xed3e('0x2e')]=_['intersection'](_0x2be05d[_0xed3e('0x2b')],_0x2be05d[_0xed3e('0x2c')]);_0x19c55b[_0xed3e('0x2f')]=_['intersection'](_0x2be05d['model'],qs[_0xed3e('0x30')](_0x1cdd33['query'][_0xed3e('0x30')]));_0x19c55b['attributes']=_0x19c55b[_0xed3e('0x2f')][_0xed3e('0x31')]?_0x19c55b[_0xed3e('0x2f')]:_0x2be05d['model'];if(!_0x1cdd33[_0xed3e('0x2c')][_0xed3e('0x32')](_0xed3e('0x33'))){_0x19c55b[_0xed3e('0x1f')]=qs['limit'](_0x1cdd33[_0xed3e('0x2c')]['limit']);_0x19c55b['offset']=qs['offset'](_0x1cdd33[_0xed3e('0x2c')][_0xed3e('0x1d')]);}_0x19c55b[_0xed3e('0x34')]=qs[_0xed3e('0x35')](_0x1cdd33[_0xed3e('0x2c')][_0xed3e('0x35')]);_0x19c55b[_0xed3e('0x36')]=qs[_0xed3e('0x2e')](_[_0xed3e('0x37')](_0x1cdd33[_0xed3e('0x2c')],_0x2be05d[_0xed3e('0x2e')]),_0xf768b2);if(_0x1cdd33['query'][_0xed3e('0x38')]){_0x19c55b[_0xed3e('0x36')]=_[_0xed3e('0x39')](_0x19c55b['where'],{'$or':_['map'](_0xf768b2,function(_0x5053dc){if(_0x5053dc[_0xed3e('0x29')]!==_0xed3e('0x3a')){var _0x4c58a0={};_0x4c58a0[_0x5053dc['name']]={'$like':'%'+_0x1cdd33[_0xed3e('0x2c')][_0xed3e('0x38')]+'%'};return _0x4c58a0;}})});}_0x19c55b=_[_0xed3e('0x39')]({},_0x19c55b,_0x1cdd33['options']);var _0x49c2de={'where':_0x19c55b['where']};return db['WhatsappTransferReport'][_0xed3e('0x20')](_0x49c2de)[_0xed3e('0x24')](function(_0x63974f){_0x14feb2[_0xed3e('0x20')]=_0x63974f;if(_0x1cdd33[_0xed3e('0x2c')]['includeAll']){_0x19c55b[_0xed3e('0x3b')]=[{'all':!![]}];}return db[_0xed3e('0x28')][_0xed3e('0x3c')](_0x19c55b);})['then'](function(_0x40c6e5){_0x14feb2['rows']=_0x40c6e5;return _0x14feb2;})['then'](respondWithFilteredResult(_0x2a6f15,_0x19c55b))[_0xed3e('0x3d')](handleError(_0x2a6f15,null));};exports[_0xed3e('0x3e')]=function(_0x498947,_0x5e1784){var _0x3d8d4e={'raw':!![],'where':{'id':_0x498947[_0xed3e('0x3f')]['id']}},_0x4a7646={};_0x4a7646[_0xed3e('0x2b')]=_[_0xed3e('0x2d')](db[_0xed3e('0x28')][_0xed3e('0x40')]);_0x4a7646[_0xed3e('0x2c')]=_['keys'](_0x498947[_0xed3e('0x2c')]);_0x4a7646[_0xed3e('0x2e')]=_['intersection'](_0x4a7646[_0xed3e('0x2b')],_0x4a7646[_0xed3e('0x2c')]);_0x3d8d4e[_0xed3e('0x2f')]=_[_0xed3e('0x41')](_0x4a7646[_0xed3e('0x2b')],qs[_0xed3e('0x30')](_0x498947[_0xed3e('0x2c')]['fields']));_0x3d8d4e[_0xed3e('0x2f')]=_0x3d8d4e[_0xed3e('0x2f')][_0xed3e('0x31')]?_0x3d8d4e['attributes']:_0x4a7646[_0xed3e('0x2b')];if(_0x498947[_0xed3e('0x2c')][_0xed3e('0x42')]){_0x3d8d4e['include']=[{'all':!![]}];}_0x3d8d4e=_['merge']({},_0x3d8d4e,_0x498947[_0xed3e('0x43')]);return db['WhatsappTransferReport']['find'](_0x3d8d4e)[_0xed3e('0x24')](handleEntityNotFound(_0x5e1784,null))[_0xed3e('0x24')](respondWithResult(_0x5e1784,null))[_0xed3e('0x3d')](handleError(_0x5e1784,null));};exports[_0xed3e('0x44')]=function(_0x516451,_0x4149b7){return db[_0xed3e('0x28')]['create'](_0x516451[_0xed3e('0x45')],{})[_0xed3e('0x24')](respondWithResult(_0x4149b7,0xc9))['catch'](handleError(_0x4149b7,null));};exports[_0xed3e('0x46')]=function(_0x4c9d57,_0x4b5ad7){if(_0x4c9d57['body']['id']){delete _0x4c9d57[_0xed3e('0x45')]['id'];}return db[_0xed3e('0x28')][_0xed3e('0x47')]({'where':{'id':_0x4c9d57[_0xed3e('0x3f')]['id']}})[_0xed3e('0x24')](handleEntityNotFound(_0x4b5ad7,null))[_0xed3e('0x24')](saveUpdates(_0x4c9d57[_0xed3e('0x45')],null))[_0xed3e('0x24')](respondWithResult(_0x4b5ad7,null))['catch'](handleError(_0x4b5ad7,null));};exports[_0xed3e('0x48')]=function(_0x4cbcda,_0x4d97f0){return db[_0xed3e('0x28')]['find']({'where':{'id':_0x4cbcda[_0xed3e('0x3f')]['id']}})[_0xed3e('0x24')](handleEntityNotFound(_0x4d97f0,null))[_0xed3e('0x24')](removeEntity(_0x4d97f0,null))[_0xed3e('0x3d')](handleError(_0x4d97f0,null));};exports[_0xed3e('0x49')]=function(_0x24ea3f,_0x14a60c){return db[_0xed3e('0x28')]['describe']()[_0xed3e('0x24')](respondWithResult(_0x14a60c,null))[_0xed3e('0x3d')](handleError(_0x14a60c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1446bb2..b2b104c 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 _0x6c05=['uniqueid','lodash','api','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','report_whatsapp_transfer'];(function(_0x87b6e8,_0x2661a1){var _0x255b2f=function(_0x52999b){while(--_0x52999b){_0x87b6e8['push'](_0x87b6e8['shift']());}};_0x255b2f(++_0x2661a1);}(_0x6c05,0x199));var _0x56c0=function(_0x58c962,_0x1c2d42){_0x58c962=_0x58c962-0x0;var _0x229667=_0x6c05[_0x58c962];return _0x229667;};'use strict';var _=require(_0x56c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x56c0('0x1'));var moment=require('moment');var BPromise=require(_0x56c0('0x2'));var rp=require(_0x56c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56c0('0x4'));var config=require('../../config/environment');var attributes=require(_0x56c0('0x5'));module['exports']=function(_0x121c18,_0x5dc32e){return _0x121c18['define']('WhatsappTransferReport',attributes,{'tableName':_0x56c0('0x6'),'paranoid':![],'indexes':[{'name':_0x56c0('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d2e=['moment','bluebird','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x8d2e,0xf8));var _0xe8d2=function(_0x5b06b7,_0x1c7d5d){_0x5b06b7=_0x5b06b7-0x0;var _0x3fe416=_0x8d2e[_0x5b06b7];return _0x3fe416;};'use strict';var _=require(_0xe8d2('0x0'));var util=require(_0xe8d2('0x1'));var logger=require(_0xe8d2('0x2'))(_0xe8d2('0x3'));var moment=require(_0xe8d2('0x4'));var BPromise=require(_0xe8d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8d2('0x6'));var rimraf=require(_0xe8d2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe8d2('0x8'));module[_0xe8d2('0x9')]=function(_0x18be16,_0x5f319e){return _0x18be16[_0xe8d2('0xa')](_0xe8d2('0xb'),attributes,{'tableName':_0xe8d2('0xc'),'paranoid':![],'indexes':[{'name':_0xe8d2('0xd'),'fields':[_0xe8d2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a1e8782..597117e 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 _0x862f=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x10298d,_0x29c3ff){var _0x1f770e=function(_0x22a556){while(--_0x22a556){_0x10298d['push'](_0x10298d['shift']());}};_0x1f770e(++_0x29c3ff);}(_0x862f,0x1db));var _0xf862=function(_0x5f3ef9,_0x4c8a49){_0x5f3ef9=_0x5f3ef9-0x0;var _0x4d978b=_0x862f[_0x5f3ef9];return _0x4d978b;};'use strict';var _=require(_0xf862('0x0'));var util=require('util');var moment=require(_0xf862('0x1'));var BPromise=require('bluebird');var rs=require(_0xf862('0x2'));var fs=require('fs');var Redis=require(_0xf862('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf862('0x4'));var logger=require(_0xf862('0x5'))('rpc');var config=require(_0xf862('0x6'));var jayson=require(_0xf862('0x7'));var client=jayson[_0xf862('0x8')][_0xf862('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f6c37,_0x473bd3,_0x4383d6){return new BPromise(function(_0x44753c,_0x25e198){return client[_0xf862('0xa')](_0x1f6c37,_0x4383d6)[_0xf862('0xb')](function(_0x43d234){logger[_0xf862('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x473bd3,_0xf862('0xd'));logger['debug'](_0xf862('0xe'),_0x473bd3,'request\x20sent',JSON[_0xf862('0xf')](_0x43d234));if(_0x43d234[_0xf862('0x10')]){if(_0x43d234[_0xf862('0x10')]['code']===0x1f4){logger[_0xf862('0x10')](_0xf862('0x11'),_0x473bd3,_0x43d234[_0xf862('0x10')][_0xf862('0x12')]);return _0x25e198(_0x43d234[_0xf862('0x10')]['message']);}logger[_0xf862('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x473bd3,_0x43d234[_0xf862('0x10')][_0xf862('0x12')]);return _0x44753c(_0x43d234[_0xf862('0x10')]['message']);}else{logger[_0xf862('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x473bd3,_0xf862('0xd'));_0x44753c(_0x43d234['result'][_0xf862('0x12')]);}})[_0xf862('0x13')](function(_0x26343a){logger[_0xf862('0x10')](_0xf862('0x11'),_0x473bd3,_0x26343a);_0x25e198(_0x26343a);});});} \ No newline at end of file +var _0x92fe=['error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','stringify'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x92fe,0x10f));var _0xe92f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe92f('0x0'));var util=require(_0xe92f('0x1'));var moment=require(_0xe92f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe92f('0x3'));var fs=require('fs');var Redis=require(_0xe92f('0x4'));var db=require(_0xe92f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe92f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe92f('0x7')][_0xe92f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b85fa,_0x244606,_0x329704){return new BPromise(function(_0x40cb70,_0x20f18b){return client[_0xe92f('0x9')](_0x3b85fa,_0x329704)[_0xe92f('0xa')](function(_0xd3b53e){logger[_0xe92f('0xb')](_0xe92f('0xc'),_0x244606,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x244606,'request\x20sent',JSON[_0xe92f('0xd')](_0xd3b53e));if(_0xd3b53e[_0xe92f('0xe')]){if(_0xd3b53e[_0xe92f('0xe')][_0xe92f('0xf')]===0x1f4){logger[_0xe92f('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x244606,_0xd3b53e['error'][_0xe92f('0x10')]);return _0x20f18b(_0xd3b53e[_0xe92f('0xe')][_0xe92f('0x10')]);}logger[_0xe92f('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x244606,_0xd3b53e[_0xe92f('0xe')][_0xe92f('0x10')]);return _0x40cb70(_0xd3b53e[_0xe92f('0xe')]['message']);}else{logger[_0xe92f('0xb')](_0xe92f('0xc'),_0x244606,_0xe92f('0x11'));_0x40cb70(_0xd3b53e['result'][_0xe92f('0x10')]);}})[_0xe92f('0x12')](function(_0x46c5fb){logger['error'](_0xe92f('0xc'),_0x244606,_0x46c5fb);_0x20f18b(_0x46c5fb);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7459bb7..69878ec 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c81=['lodash','./mysqldb','./config/license','./rpc','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','./config/socketio','redis','localhost','sequelize','sync','then','seedDB','default','User','findAll','agent','forEach','getAgentKey','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','join','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x274261,_0x35107d){var _0x19a57a=function(_0x547bcc){while(--_0x547bcc){_0x274261['push'](_0x274261['shift']());}};_0x19a57a(++_0x35107d);}(_0x3c81,0x102));var _0x13c8=function(_0x159c7d,_0x357cc1){_0x159c7d=_0x159c7d-0x0;var _0x4f4425=_0x3c81[_0x159c7d];return _0x4f4425;};'use strict';var _=require(_0x13c8('0x0'));var db=require(_0x13c8('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x13c8('0x2'));var rpc=require(_0x13c8('0x3'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0x13c8('0x4'));var schedule=require(_0x13c8('0x5'));var chat=require(_0x13c8('0x6'));var whatsapp=require(_0x13c8('0x7'));var transcribe=require(_0x13c8('0x8'));var provider=require(_0x13c8('0x9'));var socketio=require(_0x13c8('0xa'));var Redis=require('ioredis');config[_0x13c8('0xb')]=_['defaults'](config[_0x13c8('0xb')],{'host':_0x13c8('0xc'),'port':0x18eb});var redis=new Redis(config[_0x13c8('0xb')]);function main(){return db[_0x13c8('0xd')][_0x13c8('0xe')]()[_0x13c8('0xf')](function(){if(config[_0x13c8('0x10')]){return seedDb[_0x13c8('0x11')]();}})[_0x13c8('0xf')](function(){return checkLicense[_0x13c8('0x11')]();})[_0x13c8('0xf')](function(){return db[_0x13c8('0x12')][_0x13c8('0x13')]({'where':{'role':_0x13c8('0x14')},'attributes':['id','name'],'raw':!![]});})[_0x13c8('0xf')](function(_0x7b6da8){_0x7b6da8[_0x13c8('0x15')](function(_0x1f9b6f){var _0x4a077c=socketio[_0x13c8('0x16')](_0x1f9b6f);redis['del'](_0x4a077c);redis['del'](_0x4a077c+'_expire');});return;})[_0x13c8('0xf')](function(){return rpc['listen']();})[_0x13c8('0xf')](function(_0x17a3c1){logger[_0x13c8('0x17')](_0x17a3c1);return chat[_0x13c8('0x18')]();})['then'](function(){return whatsapp[_0x13c8('0x18')]();})[_0x13c8('0xf')](function(){return schedule[_0x13c8('0x18')]();})[_0x13c8('0xf')](function(){return transcribe[_0x13c8('0x18')]();})[_0x13c8('0xf')](function(){return provider[_0x13c8('0x18')]();})[_0x13c8('0xf')](function(_0x34fbc0){logger[_0x13c8('0x17')](_0x34fbc0);return pm2[_0x13c8('0x18')](pm2Config);})['then'](function(_0x3b8eac){var _0x37242f=_0x3b8eac[_0x13c8('0x19')](function(_0x313ea3){return typeof _0x313ea3['exitCode']===_0x13c8('0x1a')&&_0x313ea3[_0x13c8('0x1b')]>=0x0;});if(_0x37242f[_0x13c8('0x1c')]>0x0){throw new Error(_0x37242f[_0x13c8('0x1c')]+_0x13c8('0x1d')+_[_0x13c8('0x1e')](_0x37242f,function(_0x5ab47f){return'\x22'+_0x5ab47f[_0x13c8('0x1f')][_0x13c8('0x20')]+'\x22';}));}logger[_0x13c8('0x17')](_0x13c8('0x21'),_['map'](_[_0x13c8('0x19')](_0x3b8eac,{'status':_0x13c8('0x22')}),'name')['join']());logger[_0x13c8('0x17')](_0x13c8('0x23'),_['map'](_['filter'](_0x3b8eac,function(_0x288c3c){return _0x288c3c[_0x13c8('0x24')]!=='online';}),'name')[_0x13c8('0x25')]()||'None');console['log'](_0x13c8('0x26'));})[_0x13c8('0x27')](function(_0x34fdbe){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x34fdbe);logger[_0x13c8('0x28')](_0x13c8('0x29'),_0x34fdbe);process[_0x13c8('0x2a')](0x1);});}main(); \ No newline at end of file +var _0x3d7f=['name','Online\x20apps:','online','join','Offline\x20apps:','status','None','App\x20Ready!','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','./config/socketio','ioredis','defaults','redis','localhost','sequelize','sync','then','seedDB','default','findAll','agent','forEach','getAgentKey','del','_expire','info','start','filter','exitCode','number','length','map','pm2_env'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x3d7f[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xf3d7('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xf3d7('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xf3d7('0x2'));var config=require(_0xf3d7('0x3'));var logger=require(_0xf3d7('0x4'))(_0xf3d7('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xf3d7('0x6'));var chat=require(_0xf3d7('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xf3d7('0x8'));var socketio=require(_0xf3d7('0x9'));var Redis=require(_0xf3d7('0xa'));config['redis']=_[_0xf3d7('0xb')](config[_0xf3d7('0xc')],{'host':_0xf3d7('0xd'),'port':0x18eb});var redis=new Redis(config[_0xf3d7('0xc')]);function main(){return db[_0xf3d7('0xe')][_0xf3d7('0xf')]()[_0xf3d7('0x10')](function(){if(config[_0xf3d7('0x11')]){return seedDb[_0xf3d7('0x12')]();}})[_0xf3d7('0x10')](function(){return checkLicense[_0xf3d7('0x12')]();})['then'](function(){return db['User'][_0xf3d7('0x13')]({'where':{'role':_0xf3d7('0x14')},'attributes':['id','name'],'raw':!![]});})[_0xf3d7('0x10')](function(_0xecd54c){_0xecd54c[_0xf3d7('0x15')](function(_0x482977){var _0x20ee44=socketio[_0xf3d7('0x16')](_0x482977);redis[_0xf3d7('0x17')](_0x20ee44);redis[_0xf3d7('0x17')](_0x20ee44+_0xf3d7('0x18'));});return;})[_0xf3d7('0x10')](function(){return rpc['listen']();})[_0xf3d7('0x10')](function(_0x24e584){logger[_0xf3d7('0x19')](_0x24e584);return chat[_0xf3d7('0x1a')]();})[_0xf3d7('0x10')](function(){return whatsapp[_0xf3d7('0x1a')]();})[_0xf3d7('0x10')](function(){return schedule['start']();})[_0xf3d7('0x10')](function(){return transcribe[_0xf3d7('0x1a')]();})[_0xf3d7('0x10')](function(){return provider[_0xf3d7('0x1a')]();})[_0xf3d7('0x10')](function(_0x1472d9){logger['info'](_0x1472d9);return pm2[_0xf3d7('0x1a')](pm2Config);})[_0xf3d7('0x10')](function(_0x3b3eb9){var _0x88bf35=_0x3b3eb9[_0xf3d7('0x1b')](function(_0x43df6a){return typeof _0x43df6a[_0xf3d7('0x1c')]===_0xf3d7('0x1d')&&_0x43df6a[_0xf3d7('0x1c')]>=0x0;});if(_0x88bf35[_0xf3d7('0x1e')]>0x0){throw new Error(_0x88bf35[_0xf3d7('0x1e')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xf3d7('0x1f')](_0x88bf35,function(_0x1c2a31){return'\x22'+_0x1c2a31[_0xf3d7('0x20')][_0xf3d7('0x21')]+'\x22';}));}logger[_0xf3d7('0x19')](_0xf3d7('0x22'),_['map'](_[_0xf3d7('0x1b')](_0x3b3eb9,{'status':_0xf3d7('0x23')}),_0xf3d7('0x21'))[_0xf3d7('0x24')]());logger[_0xf3d7('0x19')](_0xf3d7('0x25'),_[_0xf3d7('0x1f')](_['filter'](_0x3b3eb9,function(_0x3ca4d9){return _0x3ca4d9[_0xf3d7('0x26')]!==_0xf3d7('0x23');}),'name')['join']()||_0xf3d7('0x27'));console['log'](_0xf3d7('0x28'));})['catch'](function(_0x8f8013){console[_0xf3d7('0x29')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x8f8013);logger[_0xf3d7('0x2a')](_0xf3d7('0x2b'),_0x8f8013);process[_0xf3d7('0x2c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c1c6ae1..ee9db21 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 _0x5078=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','promisify','sign','secret','secrets','session','payload','options','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','json','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase'];(function(_0x5a78a4,_0x5772e1){var _0x49a59f=function(_0x4311e1){while(--_0x4311e1){_0x5a78a4['push'](_0x5a78a4['shift']());}};_0x49a59f(++_0x5772e1);}(_0x5078,0x92));var _0x8507=function(_0x19fa39,_0x2de46b){_0x19fa39=_0x19fa39-0x0;var _0xb21667=_0x5078[_0x19fa39];return _0xb21667;};'use strict';var db=require(_0x8507('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x8507('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x8507('0x2'));var _=require('lodash');var jwt=require(_0x8507('0x3'));var expressJwt=require(_0x8507('0x4'));var compose=require(_0x8507('0x5'));var basicAuth=require(_0x8507('0x6'));var crypto=require(_0x8507('0x7'));var BPromise=require(_0x8507('0x8'));var util=require(_0x8507('0x9'));var moment=require(_0x8507('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x8507('0xb'),_0x8507('0xc'),_0x8507('0xd'),_0x8507('0xe'),_0x8507('0xf'),_0x8507('0x10'),_0x8507('0x11'),_0x8507('0x12'),_0x8507('0x13'),'chatPause',_0x8507('0x14'),'faxPause','smsPause','openchannelPause',_0x8507('0x15'),_0x8507('0x16'),_0x8507('0x17'),_0x8507('0x18'),_0x8507('0x19'),_0x8507('0x1a'),_0x8507('0x1b'),_0x8507('0x1c'),_0x8507('0x1d'),_0x8507('0x1e'),'phoneBarDnd',_0x8507('0x1f'),_0x8507('0x20'),_0x8507('0x21'),_0x8507('0x22'),'phoneBarPrefixRequired',_0x8507('0x23'),_0x8507('0x24'),'hotdesk',_0x8507('0x25'),'userProfileId','privacyEnabled',_0x8507('0x26'),'wssPort',_0x8507('0x27'),_0x8507('0x28'),_0x8507('0x29'),_0x8507('0x2a'),_0x8507('0x2b')];exports[_0x8507('0x2c')]=function(){return this[_0x8507('0x2d')](!![])['use'](function(_0x518d14,_0x5724f2,_0x4e7216){if(_0x518d14[_0x8507('0x2e')]){_0x4e7216();}else{return db['ChatInteraction'][_0x8507('0x2f')]({'where':{'id':_0x518d14[_0x8507('0x30')]['id']},'attributes':['id',_0x8507('0x31'),_0x8507('0x32')],'raw':!![]})[_0x8507('0x33')](function(_0x3e9bbf){if(_0x3e9bbf&&_0x3e9bbf[_0x8507('0x31')]){return _0x5724f2[_0x8507('0x34')](_0x3e9bbf[_0x8507('0x32')]===_0x8507('0x35')?0x195:0x193)['json']({'message':_0x3e9bbf[_0x8507('0x32')]===_0x8507('0x35')?_0x8507('0x36'):_0x8507('0x37')});}else{_0x4e7216();}})[_0x8507('0x38')](function(_0xa60304){_0x4e7216(_0xa60304);});}});};exports[_0x8507('0x2d')]=function isAuthenticated(_0x24a2ee){return compose()['use'](function(_0x25e025,_0x7348e1,_0x5a939d){var _0x3723e8;if(_0x25e025[_0x8507('0x39')][_0x8507('0x3a')]){if(_[_0x8507('0x3b')](_0x25e025[_0x8507('0x39')]['authorization'],_0x8507('0x3c'))){var _0x51dae6=basicAuth(_0x25e025);db[_0x8507('0x3d')][_0x8507('0x3e')]({'where':{'name':_0x51dae6[_0x8507('0xd')]}})[_0x8507('0x33')](function(_0x21b612){if(!_0x21b612||!_0x21b612[_0x8507('0x3f')](_0x51dae6[_0x8507('0x40')])){return _0x7348e1['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x25e025['user']={'id':_0x21b612['id']};_0x5a939d();})[_0x8507('0x38')](function(_0x5b8b74){_0x5a939d(_0x5b8b74);});}else if(_[_0x8507('0x3b')](_0x25e025[_0x8507('0x39')]['authorization'],'Bearer')){validateJwt(_0x25e025,_0x7348e1,_0x5a939d);}else{if(_0x24a2ee){_0x5a939d();}else{return _0x7348e1[_0x8507('0x34')](0x193)['json']({'message':_0x8507('0x41')});}}}else if(_0x25e025[_0x8507('0x42')][_0x8507('0x43')]){try{var _0x116150={'audience':hardwareConf[_0x8507('0x44')](),'issuer':hardwareConf[_0x8507('0x44')]()};verifyJwt(_0x25e025['query']['apikey'],_0x116150)['then'](function(_0x334f27){return db[_0x8507('0x3d')][_0x8507('0x3e')]({'where':{'id':_0x334f27[_0x8507('0x45')]}})['then'](function(_0x268cb4){_0x3723e8=_0x268cb4;return db['Setting'][_0x8507('0x2f')]({'where':{'id':0x1},'attributes':[_0x8507('0x46'),_0x8507('0x47')],'raw':!![]});})[_0x8507('0x33')](function(_0x505853){if(!_0x3723e8||!_['isEqual'](_0x3723e8[_0x8507('0x48')],_0x334f27[_0x8507('0x49')])){return _0x7348e1[_0x8507('0x34')](0x191)['json']({'message':_0x8507('0x4a')});}if(_0x3723e8[_0x8507('0x4b')]){return _0x7348e1['status'](0x191)[_0x8507('0x4c')]({'message':_0x8507('0x4d')});}if(_0x3723e8[_0x8507('0x4e')]){if(_0x505853[_0x8507('0x47')]>0x0){if(moment(_0x3723e8[_0x8507('0x4f')])[_0x8507('0x50')](_0x505853['blockDuration'],_0x8507('0x51'))>moment()){return _0x7348e1[_0x8507('0x34')](0x191)[_0x8507('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x7348e1[_0x8507('0x34')](0x191)[_0x8507('0x4c')]({'message':_0x8507('0x4d')});}}_0x25e025['user']={'id':_0x3723e8['id']};_0x5a939d();});})['catch'](function(){return _0x7348e1[_0x8507('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x37a9ed){_0x5a939d(_0x37a9ed);}}else if(_0x24a2ee){_0x5a939d();}else{return _0x7348e1[_0x8507('0x34')](0x193)[_0x8507('0x4c')]({'message':_0x8507('0x41')});}})[_0x8507('0x52')](function(_0x293b6f,_0x423e9d,_0x38aa90){if(_0x293b6f['user']){db['User'][_0x8507('0x3e')]({'where':{'id':_0x293b6f[_0x8507('0x2e')]['id']},'attributes':userAttributes})[_0x8507('0x33')](function(_0x25ca6e){if(!_0x25ca6e){return _0x423e9d[_0x8507('0x34')](0x194)[_0x8507('0x4c')]({'message':_0x8507('0x53')});}_0x293b6f[_0x8507('0x2e')]=_0x25ca6e;_0x38aa90();})[_0x8507('0x38')](function(_0x31d1a8){_0x38aa90(_0x31d1a8);});}else if(_0x24a2ee){_0x38aa90();}else{return _0x423e9d[_0x8507('0x34')](0x194)[_0x8507('0x4c')]({'message':_0x8507('0x54')});}});};exports[_0x8507('0x55')]=function canUpdate(){return compose()['use'](function(_0x4313d7,_0x18d859,_0x2db4a0){return licenseUtil[_0x8507('0x56')]()[_0x8507('0x33')](function(_0x573c22){if(_0x573c22[_0x8507('0x57')]){_0x2db4a0();}else{return _0x18d859['status'](0x193)[_0x8507('0x4c')]({'message':'Forbidden'});}})['catch'](function(_0xb15cb5){_0x2db4a0(_0xb15cb5);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x8507('0x52')](function(_0x58e1af,_0x524375,_0x2df35a){return licenseUtil[_0x8507('0x56')]()[_0x8507('0x33')](function(_0x4dda9f){if(_0x4dda9f['webrtc']){_0x2df35a();}else{return _0x524375[_0x8507('0x34')](0x193)[_0x8507('0x4c')]({'message':'Forbidden'});}})[_0x8507('0x38')](function(_0x1e873c){_0x2df35a(_0x1e873c);});});};exports[_0x8507('0x58')]=function(_0xd2f7a3,_0x2e0251,_0x2ab933){_0xd2f7a3[_0x8507('0x58')]=!![];return _0x2ab933();};exports[_0x8507('0x59')]=function signToken(_0x297aac){return signJwt(_0x297aac);};exports[_0x8507('0x5a')]=function(_0x4fcca3,_0x169e14){if(!_0x4fcca3['user']){return _0x169e14[_0x8507('0x34')](0x194)[_0x8507('0x4c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4039a3={'payload':{'id':_0x4fcca3[_0x8507('0x2e')]['id'],'role':_0x4fcca3[_0x8507('0x2e')][_0x8507('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4039a3)[_0x8507('0x33')](function(_0xd84079){_0x169e14[_0x8507('0x5b')](_0x8507('0x5c'),_0xd84079);_0x169e14[_0x8507('0x5d')](_0x8507('0x5e'));})[_0x8507('0x38')](function(_0x466620){return _0x169e14[_0x8507('0x34')](0x1f4)[_0x8507('0x5f')](_0x466620);});};exports['retrieveApiKey']=function(_0x20ce6f){if(_['isNil'](_0x20ce6f['apiKeyNonce'])||_[_0x8507('0x60')](_0x20ce6f[_0x8507('0x61')])){return null;}else{return createJwt(_0x20ce6f);}};exports[_0x8507('0x62')]=function(_0x1c5ad4){_0x1c5ad4[_0x8507('0x48')]=generateNonce();_0x1c5ad4[_0x8507('0x61')]=generateIssuedAt();return createJwt(_0x1c5ad4);};exports['regenerateApiKey']=function(_0x127144,_0x5321b7){var _0x1bb9ae=_0x127144[_0x8507('0x42')][_0x8507('0x43')];if(_0x1bb9ae){var _0x515ec6={'nonce':_0x5321b7['apiKeyNonce'],'iat':_0x5321b7[_0x8507('0x61')],'audience':hardwareConf[_0x8507('0x44')](),'issuer':hardwareConf[_0x8507('0x44')]()};return verifyJwt(_0x1bb9ae,_0x515ec6)[_0x8507('0x33')](function(){return generateApiKey(_0x5321b7);});}else{throw{'message':_0x8507('0x63')};}};exports[_0x8507('0x64')]=function(_0x50e992){var _0x39fee4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x39fee4[_0x8507('0x65')](_0x50e992))throw new db[(_0x8507('0x66'))][(_0x8507('0x67'))](_0x8507('0x68'));return;};exports[_0x8507('0x69')]=function(_0x1e8a9f,_0x15cef0,_0x5b3153){var _0x2d5c38=encryptor[_0x8507('0x6a')](_0x15cef0)['split'](',');for(var _0x39ce17=0x0;_0x39ce17<_0x5b3153;_0x39ce17++){if(!_0x2d5c38[_0x39ce17])break;if(_0x1e8a9f[_0x8507('0x6b')]()===_0x2d5c38[_0x39ce17][_0x8507('0x6b')]()){var _0x488913=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5b3153);if(_0x5b3153===0x1){_0x488913=_0x8507('0x6c');}throw new db[(_0x8507('0x66'))]['ValidationError'](_0x488913);}}return;};exports[_0x8507('0x6d')]=function(_0x56934d,_0x169549){var _0x29fa27=_0x169549?encryptor[_0x8507('0x6a')](_0x169549)[_0x8507('0x6e')](','):[];if(_0x29fa27[_0x8507('0x6f')]===0x5){_0x29fa27[_0x8507('0x70')](-0x1,0x1);}_0x29fa27[_0x8507('0x71')](_0x56934d);return encryptor[_0x8507('0x72')](_0x29fa27['join'](','));};function signJwt(_0x1d867f){var _0x23e284=BPromise[_0x8507('0x73')](jwt[_0x8507('0x74')],{'context':jwt});var _0x2e0ff7=_0x1d867f[_0x8507('0x75')]||config[_0x8507('0x76')][_0x8507('0x77')];return new BPromise(function(_0x43e64f,_0x1a6651){_0x23e284(_0x1d867f[_0x8507('0x78')],_0x2e0ff7,_0x1d867f[_0x8507('0x79')])[_0x8507('0x33')](function(_0x3ed0ba){_0x43e64f(_0x3ed0ba);})[_0x8507('0x38')](function(_0x5df2dd){_0x1a6651(_0x5df2dd);});});}function verifyJwt(_0x56b31f,_0x17f247,_0x30fd3a){var _0x6338af=BPromise[_0x8507('0x73')](jwt['verify'],{'context':jwt});var _0x4804d2=_0x30fd3a||config[_0x8507('0x76')][_0x8507('0x77')];return new BPromise(function(_0xd1f42,_0x1bf02f){_0x6338af(_0x56b31f,_0x4804d2,_0x17f247)[_0x8507('0x33')](function(_0x4132c1){_0xd1f42(_0x4132c1);})['catch'](function(_0x5d6d88){_0x1bf02f(_0x5d6d88);});});}function generateNonce(){return crypto[_0x8507('0x7a')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x8507('0x7b')](Date[_0x8507('0x7c')]()/0x3e8)[_0x8507('0x7d')]();}function createJwt(_0x2075ee){var _0xafc01d={'payload':{'iat':_0x2075ee[_0x8507('0x61')],'nonce':_0x2075ee[_0x8507('0x48')]},'options':{'algorithm':_0x8507('0x7e'),'subject':_0x2075ee['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x8507('0x44')]()}};return signJwt(_0xafc01d)[_0x8507('0x33')](function(_0x2c9615){return{'iat':_0x2075ee[_0x8507('0x61')],'nonce':_0x2075ee[_0x8507('0x48')],'token':_0x2c9615};});} \ No newline at end of file +var _0xf7a1=['../../config/license/util','jsonwebtoken','express-jwt','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','closed','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','startsWith','headers','authorization','Basic','User','authenticate','Wrong\x20credentials.','user','catch','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','then','find','sub','allowedLoginAttempts','blockDuration','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','update','Forbidden','getLicense','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','sign','payload','options','verify','hex','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xf7a1,0x76));var _0x1f7a=function(_0x258690,_0x227ed1){_0x258690=_0x258690-0x0;var _0x261526=_0xf7a1[_0x258690];return _0x261526;};'use strict';var db=require(_0x1f7a('0x0'))['db'];var config=require(_0x1f7a('0x1'));var hardwareConf=require(_0x1f7a('0x2'));var licenseUtil=require(_0x1f7a('0x3'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x1f7a('0x4'));var expressJwt=require(_0x1f7a('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x1f7a('0x6'));var util=require(_0x1f7a('0x7'));var moment=require(_0x1f7a('0x8'));var validateJwt=expressJwt({'secret':config[_0x1f7a('0x9')][_0x1f7a('0xa')]});var userAttributes=['id',_0x1f7a('0xb'),_0x1f7a('0xc'),_0x1f7a('0xd'),_0x1f7a('0xe'),_0x1f7a('0xf'),'userpic',_0x1f7a('0x10'),_0x1f7a('0x11'),_0x1f7a('0x12'),_0x1f7a('0x13'),_0x1f7a('0x14'),'faxPause',_0x1f7a('0x15'),'openchannelPause',_0x1f7a('0x16'),'showWebBar','lastLoginAt',_0x1f7a('0x17'),_0x1f7a('0x18'),'allowmessenger',_0x1f7a('0x19'),_0x1f7a('0x1a'),'phoneBarAutoAnswer',_0x1f7a('0x1b'),_0x1f7a('0x1c'),_0x1f7a('0x1d'),_0x1f7a('0x1e'),_0x1f7a('0x1f'),_0x1f7a('0x20'),_0x1f7a('0x21'),'phoneBarRemoteControl',_0x1f7a('0x22'),_0x1f7a('0x23'),_0x1f7a('0x24'),'userProfileId',_0x1f7a('0x25'),'settingsEnabled',_0x1f7a('0x26'),_0x1f7a('0x27'),_0x1f7a('0x28'),_0x1f7a('0x29'),'ignorePauseForPreviewCalls',_0x1f7a('0x2a')];exports[_0x1f7a('0x2b')]=function(){return this[_0x1f7a('0x2c')](!![])[_0x1f7a('0x2d')](function(_0x29228a,_0xc1721f,_0x2f3e9b){if(_0x29228a['user']){_0x2f3e9b();}else{return db[_0x1f7a('0x2e')][_0x1f7a('0x2f')]({'where':{'id':_0x29228a['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x56561a){if(_0x56561a&&_0x56561a[_0x1f7a('0x30')]){return _0xc1721f[_0x1f7a('0x31')](_0x56561a[_0x1f7a('0x32')]===_0x1f7a('0x33')?0x195:0x193)[_0x1f7a('0x34')]({'message':_0x56561a['disposition']===_0x1f7a('0x33')?_0x1f7a('0x35'):_0x1f7a('0x36')});}else{_0x2f3e9b();}})['catch'](function(_0xaf57c8){_0x2f3e9b(_0xaf57c8);});}});};exports[_0x1f7a('0x2c')]=function isAuthenticated(_0xa28cd0){return compose()['use'](function(_0x5a7df9,_0x5c0860,_0x5902dc){var _0x4cedac;if(_0x5a7df9['headers']['authorization']){if(_[_0x1f7a('0x37')](_0x5a7df9[_0x1f7a('0x38')][_0x1f7a('0x39')],_0x1f7a('0x3a'))){var _0x4abc5a=basicAuth(_0x5a7df9);db[_0x1f7a('0x3b')]['find']({'where':{'name':_0x4abc5a[_0x1f7a('0xd')]}})['then'](function(_0x2dca76){if(!_0x2dca76||!_0x2dca76[_0x1f7a('0x3c')](_0x4abc5a['pass'])){return _0x5c0860['status'](0x191)[_0x1f7a('0x34')]({'message':_0x1f7a('0x3d')});}_0x5a7df9[_0x1f7a('0x3e')]={'id':_0x2dca76['id']};_0x5902dc();})[_0x1f7a('0x3f')](function(_0x4ddf0a){_0x5902dc(_0x4ddf0a);});}else if(_[_0x1f7a('0x37')](_0x5a7df9[_0x1f7a('0x38')][_0x1f7a('0x39')],_0x1f7a('0x40'))){validateJwt(_0x5a7df9,_0x5c0860,_0x5902dc);}else{if(_0xa28cd0){_0x5902dc();}else{return _0x5c0860['status'](0x193)[_0x1f7a('0x34')]({'message':_0x1f7a('0x41')});}}}else if(_0x5a7df9[_0x1f7a('0x42')]['apikey']){try{var _0x912970={'audience':hardwareConf[_0x1f7a('0x43')](),'issuer':hardwareConf[_0x1f7a('0x43')]()};verifyJwt(_0x5a7df9[_0x1f7a('0x42')][_0x1f7a('0x44')],_0x912970)[_0x1f7a('0x45')](function(_0x78a10c){return db['User'][_0x1f7a('0x46')]({'where':{'id':_0x78a10c[_0x1f7a('0x47')]}})[_0x1f7a('0x45')](function(_0x18d2f8){_0x4cedac=_0x18d2f8;return db['Setting'][_0x1f7a('0x2f')]({'where':{'id':0x1},'attributes':[_0x1f7a('0x48'),_0x1f7a('0x49')],'raw':!![]});})['then'](function(_0x55666b){if(!_0x4cedac||!_['isEqual'](_0x4cedac['apiKeyNonce'],_0x78a10c[_0x1f7a('0x4a')])){return _0x5c0860['status'](0x191)[_0x1f7a('0x34')]({'message':_0x1f7a('0x4b')});}if(_0x4cedac[_0x1f7a('0x4c')]){return _0x5c0860[_0x1f7a('0x31')](0x191)[_0x1f7a('0x34')]({'message':_0x1f7a('0x4d')});}if(_0x4cedac[_0x1f7a('0x4e')]){if(_0x55666b[_0x1f7a('0x49')]>0x0){if(moment(_0x4cedac[_0x1f7a('0x4f')])[_0x1f7a('0x50')](_0x55666b[_0x1f7a('0x49')],_0x1f7a('0x51'))>moment()){return _0x5c0860['status'](0x191)['json']({'message':_0x1f7a('0x4d')});}}else{return _0x5c0860[_0x1f7a('0x31')](0x191)[_0x1f7a('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5a7df9[_0x1f7a('0x3e')]={'id':_0x4cedac['id']};_0x5902dc();});})[_0x1f7a('0x3f')](function(){return _0x5c0860[_0x1f7a('0x31')](0x191)[_0x1f7a('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x430db6){_0x5902dc(_0x430db6);}}else if(_0xa28cd0){_0x5902dc();}else{return _0x5c0860[_0x1f7a('0x31')](0x193)[_0x1f7a('0x34')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0xfc7e64,_0xb54523,_0x84f538){if(_0xfc7e64[_0x1f7a('0x3e')]){db[_0x1f7a('0x3b')][_0x1f7a('0x46')]({'where':{'id':_0xfc7e64[_0x1f7a('0x3e')]['id']},'attributes':userAttributes})[_0x1f7a('0x45')](function(_0x1026ca){if(!_0x1026ca){return _0xb54523[_0x1f7a('0x31')](0x194)[_0x1f7a('0x34')]({'message':_0x1f7a('0x52')});}_0xfc7e64[_0x1f7a('0x3e')]=_0x1026ca;_0x84f538();})['catch'](function(_0x386f97){_0x84f538(_0x386f97);});}else if(_0xa28cd0){_0x84f538();}else{return _0xb54523['status'](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x1f7a('0x2d')](function(_0xeb9f7a,_0x2ad860,_0x13c476){return licenseUtil['getLicense']()[_0x1f7a('0x45')](function(_0x53588b){if(_0x53588b[_0x1f7a('0x53')]){_0x13c476();}else{return _0x2ad860[_0x1f7a('0x31')](0x193)[_0x1f7a('0x34')]({'message':_0x1f7a('0x54')});}})['catch'](function(_0x44b929){_0x13c476(_0x44b929);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x1f7a('0x2d')](function(_0x1284fb,_0x3c1766,_0x14b5a7){return licenseUtil[_0x1f7a('0x55')]()[_0x1f7a('0x45')](function(_0x2bbdff){if(_0x2bbdff[_0x1f7a('0x56')]){_0x14b5a7();}else{return _0x3c1766[_0x1f7a('0x31')](0x193)[_0x1f7a('0x34')]({'message':_0x1f7a('0x54')});}})['catch'](function(_0x2bae42){_0x14b5a7(_0x2bae42);});});};exports['isMiddleware']=function(_0x40baea,_0x5e864c,_0x13a6ed){_0x40baea[_0x1f7a('0x57')]=!![];return _0x13a6ed();};exports['signToken']=function signToken(_0x5d1701){return signJwt(_0x5d1701);};exports['setTokenCookie']=function(_0x157cfa,_0x41afb5){if(!_0x157cfa[_0x1f7a('0x3e')]){return _0x41afb5[_0x1f7a('0x31')](0x194)[_0x1f7a('0x34')]({'message':_0x1f7a('0x58')});}var _0x50ef9d={'payload':{'id':_0x157cfa[_0x1f7a('0x3e')]['id'],'role':_0x157cfa['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x50ef9d)[_0x1f7a('0x45')](function(_0x43454b){_0x41afb5[_0x1f7a('0x59')](_0x1f7a('0x5a'),_0x43454b);_0x41afb5[_0x1f7a('0x5b')](_0x1f7a('0x5c'));})['catch'](function(_0x23b2b4){return _0x41afb5[_0x1f7a('0x31')](0x1f4)[_0x1f7a('0x5d')](_0x23b2b4);});};exports[_0x1f7a('0x5e')]=function(_0x319040){if(_[_0x1f7a('0x5f')](_0x319040['apiKeyNonce'])||_['isNil'](_0x319040[_0x1f7a('0x60')])){return null;}else{return createJwt(_0x319040);}};exports[_0x1f7a('0x61')]=function(_0x40bdaa){_0x40bdaa['apiKeyNonce']=generateNonce();_0x40bdaa[_0x1f7a('0x60')]=generateIssuedAt();return createJwt(_0x40bdaa);};exports[_0x1f7a('0x62')]=function(_0x759407,_0x4cf6e1){var _0x5de3df=_0x759407[_0x1f7a('0x42')]['apikey'];if(_0x5de3df){var _0x52cda8={'nonce':_0x4cf6e1[_0x1f7a('0x63')],'iat':_0x4cf6e1['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1f7a('0x43')]()};return verifyJwt(_0x5de3df,_0x52cda8)[_0x1f7a('0x45')](function(){return generateApiKey(_0x4cf6e1);});}else{throw{'message':_0x1f7a('0x64')};}};exports[_0x1f7a('0x65')]=function(_0x87a700){var _0x3bd1f9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3bd1f9[_0x1f7a('0x66')](_0x87a700))throw new db[(_0x1f7a('0x67'))][(_0x1f7a('0x68'))](_0x1f7a('0x69'));return;};exports['validatePasswordHistory']=function(_0x2018f2,_0x1c2e40,_0x28e1b0){var _0x526c3e=encryptor[_0x1f7a('0x6a')](_0x1c2e40)[_0x1f7a('0x6b')](',');for(var _0x5aca7a=0x0;_0x5aca7a<_0x28e1b0;_0x5aca7a++){if(!_0x526c3e[_0x5aca7a])break;if(_0x2018f2[_0x1f7a('0x6c')]()===_0x526c3e[_0x5aca7a]['toLowerCase']()){var _0x351e99=util['format'](_0x1f7a('0x6d'),_0x28e1b0);if(_0x28e1b0===0x1){_0x351e99='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x1f7a('0x67'))][(_0x1f7a('0x68'))](_0x351e99);}}return;};exports[_0x1f7a('0x6e')]=function(_0x5eeb0b,_0x5ea8c3){var _0x5b92ba=_0x5ea8c3?encryptor[_0x1f7a('0x6a')](_0x5ea8c3)[_0x1f7a('0x6b')](','):[];if(_0x5b92ba['length']===0x5){_0x5b92ba[_0x1f7a('0x6f')](-0x1,0x1);}_0x5b92ba[_0x1f7a('0x70')](_0x5eeb0b);return encryptor['encryptString'](_0x5b92ba['join'](','));};function signJwt(_0x18bed5){var _0xee0092=BPromise['promisify'](jwt[_0x1f7a('0x71')],{'context':jwt});var _0x5a22fa=_0x18bed5['secret']||config[_0x1f7a('0x9')]['session'];return new BPromise(function(_0x39eb4f,_0x1abb51){_0xee0092(_0x18bed5[_0x1f7a('0x72')],_0x5a22fa,_0x18bed5[_0x1f7a('0x73')])[_0x1f7a('0x45')](function(_0x40070a){_0x39eb4f(_0x40070a);})['catch'](function(_0x5ce7b8){_0x1abb51(_0x5ce7b8);});});}function verifyJwt(_0x573e61,_0x7ad701,_0x50c5fe){var _0x33035b=BPromise['promisify'](jwt[_0x1f7a('0x74')],{'context':jwt});var _0x1e3002=_0x50c5fe||config['secrets'][_0x1f7a('0xa')];return new BPromise(function(_0x2695aa,_0x30fb85){_0x33035b(_0x573e61,_0x1e3002,_0x7ad701)[_0x1f7a('0x45')](function(_0x6b7e03){_0x2695aa(_0x6b7e03);})[_0x1f7a('0x3f')](function(_0x22e575){_0x30fb85(_0x22e575);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x1f7a('0x75'));}function generateIssuedAt(){return Math['floor'](Date[_0x1f7a('0x76')]()/0x3e8)[_0x1f7a('0x77')]();}function createJwt(_0x2921af){var _0x3e6cd2={'payload':{'iat':_0x2921af[_0x1f7a('0x60')],'nonce':_0x2921af[_0x1f7a('0x63')]},'options':{'algorithm':_0x1f7a('0x78'),'subject':_0x2921af['id'][_0x1f7a('0x77')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x1f7a('0x43')]()}};return signJwt(_0x3e6cd2)['then'](function(_0x46242f){return{'iat':_0x2921af[_0x1f7a('0x60')],'nonce':_0x2921af['apiKeyNonce'],'token':_0x46242f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index eebe62a..78f0a96 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 _0x1ba1=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary','write','end','final','close','unlink','decryptFile','createWriteStream','data','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x1ba1,0x1e2));var _0x11ba=function(_0x42afc6,_0x57f8a1){_0x42afc6=_0x42afc6-0x0;var _0x52ef7d=_0x1ba1[_0x42afc6];return _0x52ef7d;};'use strict';var crypto=require(_0x11ba('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x11ba('0x1'));var config=require(_0x11ba('0x2'));var logger=require(_0x11ba('0x3'))(_0x11ba('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x11ba('0x5')],'algorithm':_0x11ba('0x6')};const fileOptions={'algorithm':_0x11ba('0x7')};if(config[_0x11ba('0x8')]&&config[_0x11ba('0x8')][_0x11ba('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x11ba('0x9')]);if(isSupported){fileOptions[_0x11ba('0x9')]=config[_0x11ba('0x8')][_0x11ba('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x11ba('0xa')](',\x20');logger[_0x11ba('0xb')](config[_0x11ba('0x8')]['algorithm'],_0x11ba('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0xffe211){return AES_SUPPORTED_RX['test'](_0xffe211);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x11ba('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1f5d0c){return getSupportedCiphers()[_0x11ba('0xe')](_0x1f5d0c)>-0x1;}function combineOptions(_0x1b7734){var _0x5e9058={};for(var _0x1ffe7a in fileOptions){if(fileOptions['hasOwnProperty'](_0x1ffe7a)){_0x5e9058[_0x1ffe7a]=fileOptions[_0x1ffe7a];}}if(_0x1b7734){for(var _0x2d48ed in _0x1b7734){if(_0x1b7734[_0x11ba('0xf')](_0x2d48ed)){_0x5e9058[_0x2d48ed]=_0x1b7734[_0x2d48ed];}}}return _0x5e9058;}exports[_0x11ba('0x10')]=function(_0x125926,_0x4314bf,_0x179dd4,_0x2be9f7){return new BPromise(function(_0xbef9cf,_0x294e2d){_0x2be9f7=combineOptions(_0x2be9f7);var _0x1e09b7=new Buffer(_0x179dd4);var _0x9a20ee=fs[_0x11ba('0x11')](_0x125926);var _0x36a8db=fs['createWriteStream'](_0x4314bf);var _0x518b8d=crypto[_0x11ba('0x12')](_0x2be9f7[_0x11ba('0x9')],_0x1e09b7);_0x9a20ee['on']('data',function(_0x253576){var _0x15642d=new Buffer(_0x518b8d[_0x11ba('0x13')](_0x253576),_0x11ba('0x14'));_0x36a8db[_0x11ba('0x15')](_0x15642d);});_0x9a20ee['on'](_0x11ba('0x16'),function(){try{var _0x3c4c04=new Buffer(_0x518b8d[_0x11ba('0x17')](_0x11ba('0x14')),_0x11ba('0x14'));_0x36a8db[_0x11ba('0x15')](_0x3c4c04);_0x36a8db[_0x11ba('0x16')]();_0x36a8db['on'](_0x11ba('0x18'),function(){return _0xbef9cf(_0x4314bf);});}catch(_0x5196ae){fs[_0x11ba('0x19')](_0x4314bf);return _0x294e2d(_0x5196ae);}});});};exports[_0x11ba('0x1a')]=function(_0x1a62c0,_0x139d9e,_0x57e56b,_0x309f5b){return new BPromise(function(_0x16d9b8,_0x3f6f01){_0x309f5b=combineOptions(_0x309f5b);var _0x29a0c6=new Buffer(_0x57e56b);var _0x5a2ec5=fs[_0x11ba('0x11')](_0x1a62c0);var _0x1e95a4=fs[_0x11ba('0x1b')](_0x139d9e);var _0x5cc17c=crypto['createDecipher'](_0x309f5b[_0x11ba('0x9')],_0x29a0c6);_0x5a2ec5['on'](_0x11ba('0x1c'),function(_0x1ddb35){var _0x4ebe9e=new Buffer(_0x5cc17c[_0x11ba('0x13')](_0x1ddb35),_0x11ba('0x14'));_0x1e95a4['write'](_0x4ebe9e);});_0x5a2ec5['on']('end',function(){try{var _0x36afb9=new Buffer(_0x5cc17c[_0x11ba('0x17')](_0x11ba('0x14')),'binary');_0x1e95a4['write'](_0x36afb9);_0x1e95a4['end']();_0x1e95a4['on'](_0x11ba('0x18'),function(){return _0x16d9b8(_0x139d9e);});}catch(_0x8a62c1){fs['unlink'](_0x139d9e);return _0x3f6f01(_0x8a62c1);}});});};exports[_0x11ba('0x1d')]=function(_0x18e684,_0xb0aa32,_0x881652){var _0x2f0172=_0x881652||stringOptions[_0x11ba('0x9')];var _0x25d29b=_0xb0aa32||stringOptions[_0x11ba('0x1e')];var _0x1fcb42=crypto[_0x11ba('0x12')](_0x2f0172,_0x25d29b);var _0x3c35ca=_0x1fcb42[_0x11ba('0x13')](_0x18e684,_0x11ba('0x1f'),'base64');_0x3c35ca+=_0x1fcb42['final'](_0x11ba('0x20'));return _0x3c35ca;};exports[_0x11ba('0x21')]=function(_0x5262ac,_0x2f0877,_0x3fd3c1){var _0x5441a0=_0x3fd3c1||stringOptions[_0x11ba('0x9')];var _0x23f1b8=_0x2f0877||stringOptions[_0x11ba('0x1e')];var _0x2001e3=crypto[_0x11ba('0x22')](_0x5441a0,_0x23f1b8);var _0xd11271=_0x2001e3[_0x11ba('0x13')](_0x5262ac,_0x11ba('0x20'),_0x11ba('0x1f'));_0xd11271+=_0x2001e3['final']('utf8');return _0xd11271;}; \ No newline at end of file +var _0x3d0d=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','filter','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile','createReadStream','createDecipher','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x187cc6,_0x24223a){var _0x572d1c=function(_0x20dfbe){while(--_0x20dfbe){_0x187cc6['push'](_0x187cc6['shift']());}};_0x572d1c(++_0x24223a);}(_0x3d0d,0x10b));var _0xd3d0=function(_0x221750,_0x33b1ad){_0x221750=_0x221750-0x0;var _0x2f6ec8=_0x3d0d[_0x221750];return _0x2f6ec8;};'use strict';var crypto=require(_0xd3d0('0x0'));var fs=require('fs');var BPromise=require(_0xd3d0('0x1'));var _=require(_0xd3d0('0x2'));var config=require(_0xd3d0('0x3'));var logger=require(_0xd3d0('0x4'))(_0xd3d0('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd3d0('0x6')][_0xd3d0('0x7')],'algorithm':_0xd3d0('0x8')};const fileOptions={'algorithm':_0xd3d0('0x9')};if(config[_0xd3d0('0xa')]&&config[_0xd3d0('0xa')][_0xd3d0('0xb')]){var isSupported=isAlgorithmSupported(config[_0xd3d0('0xa')]['algorithm']);if(isSupported){fileOptions[_0xd3d0('0xb')]=config[_0xd3d0('0xa')][_0xd3d0('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xd3d0('0xc')](config[_0xd3d0('0xa')][_0xd3d0('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x54ea56){return AES_SUPPORTED_RX['test'](_0x54ea56);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xd3d0('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x172fbd){return getSupportedCiphers()['indexOf'](_0x172fbd)>-0x1;}function combineOptions(_0x47c4ba){var _0x54d58e={};for(var _0x1aaa47 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1aaa47)){_0x54d58e[_0x1aaa47]=fileOptions[_0x1aaa47];}}if(_0x47c4ba){for(var _0x99992 in _0x47c4ba){if(_0x47c4ba[_0xd3d0('0xe')](_0x99992)){_0x54d58e[_0x99992]=_0x47c4ba[_0x99992];}}}return _0x54d58e;}exports[_0xd3d0('0xf')]=function(_0x4b0adc,_0x530ad5,_0x419620,_0x2ba44c){return new BPromise(function(_0x30e3d7,_0x77089d){_0x2ba44c=combineOptions(_0x2ba44c);var _0x4502e0=new Buffer(_0x419620);var _0x3cd0f4=fs['createReadStream'](_0x4b0adc);var _0x10ec09=fs[_0xd3d0('0x10')](_0x530ad5);var _0x55866b=crypto[_0xd3d0('0x11')](_0x2ba44c[_0xd3d0('0xb')],_0x4502e0);_0x3cd0f4['on'](_0xd3d0('0x12'),function(_0x3b3125){var _0x2c7b67=new Buffer(_0x55866b[_0xd3d0('0x13')](_0x3b3125),_0xd3d0('0x14'));_0x10ec09[_0xd3d0('0x15')](_0x2c7b67);});_0x3cd0f4['on'](_0xd3d0('0x16'),function(){try{var _0x404692=new Buffer(_0x55866b['final'](_0xd3d0('0x14')),'binary');_0x10ec09['write'](_0x404692);_0x10ec09[_0xd3d0('0x16')]();_0x10ec09['on'](_0xd3d0('0x17'),function(){return _0x30e3d7(_0x530ad5);});}catch(_0x2bbd39){fs[_0xd3d0('0x18')](_0x530ad5);return _0x77089d(_0x2bbd39);}});});};exports[_0xd3d0('0x19')]=function(_0xb702a5,_0x11374a,_0x18e490,_0x37ca45){return new BPromise(function(_0x27d7e5,_0x27fee0){_0x37ca45=combineOptions(_0x37ca45);var _0x9a3f5c=new Buffer(_0x18e490);var _0x5232ea=fs[_0xd3d0('0x1a')](_0xb702a5);var _0x3e593d=fs[_0xd3d0('0x10')](_0x11374a);var _0x353b03=crypto[_0xd3d0('0x1b')](_0x37ca45[_0xd3d0('0xb')],_0x9a3f5c);_0x5232ea['on'](_0xd3d0('0x12'),function(_0xd2bea1){var _0x108820=new Buffer(_0x353b03[_0xd3d0('0x13')](_0xd2bea1),_0xd3d0('0x14'));_0x3e593d['write'](_0x108820);});_0x5232ea['on'](_0xd3d0('0x16'),function(){try{var _0x480eb4=new Buffer(_0x353b03[_0xd3d0('0x1c')](_0xd3d0('0x14')),_0xd3d0('0x14'));_0x3e593d['write'](_0x480eb4);_0x3e593d[_0xd3d0('0x16')]();_0x3e593d['on'](_0xd3d0('0x17'),function(){return _0x27d7e5(_0x11374a);});}catch(_0x2277c3){fs['unlink'](_0x11374a);return _0x27fee0(_0x2277c3);}});});};exports[_0xd3d0('0x1d')]=function(_0x1bace9,_0x492a85,_0x147bec){var _0x33f627=_0x147bec||stringOptions['algorithm'];var _0x210e9d=_0x492a85||stringOptions[_0xd3d0('0x1e')];var _0x5dbb81=crypto['createCipher'](_0x33f627,_0x210e9d);var _0x44ddf4=_0x5dbb81['update'](_0x1bace9,_0xd3d0('0x1f'),_0xd3d0('0x20'));_0x44ddf4+=_0x5dbb81[_0xd3d0('0x1c')](_0xd3d0('0x20'));return _0x44ddf4;};exports[_0xd3d0('0x21')]=function(_0xfb1bcf,_0x5aeac8,_0x513695){var _0x423983=_0x513695||stringOptions[_0xd3d0('0xb')];var _0x23049e=_0x5aeac8||stringOptions[_0xd3d0('0x1e')];var _0x36d9e9=crypto['createDecipher'](_0x423983,_0x23049e);var _0x19f100=_0x36d9e9[_0xd3d0('0x13')](_0xfb1bcf,_0xd3d0('0x20'),_0xd3d0('0x1f'));_0x19f100+=_0x36d9e9[_0xd3d0('0x1c')](_0xd3d0('0x1f'));return _0x19f100;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c1bbe15..8e45205 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 _0x448f=['splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Setting','find','split'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x448f,0x111));var _0xf448=function(_0x285c24,_0x56b663){_0x285c24=_0x285c24-0x0;var _0x5c08ab=_0x448f[_0x285c24];return _0x5c08ab;};'use strict';var util=require('util');var path=require(_0xf448('0x0'));var _=require('lodash');var csv=require(_0xf448('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf448('0x2'));var rimraf=require('rimraf');var db=require(_0xf448('0x3'))['db'];var dbH=require(_0xf448('0x3'))[_0xf448('0x4')];var logger=require(_0xf448('0x5'))(_0xf448('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf448('0x7')][0x3];var PATH=process[_0xf448('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4579ae,_0x304b85){var _0x10c33f={'status':_0x4579ae};var _0x451205={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x304b85){_0x10c33f[_0xf448('0x8')]=_0x304b85;}return db[_0xf448('0x9')]['update'](_0x10c33f,_0x451205);}function main(){var _0x5683dd=0x1388;var _0x46c0df;logger[_0xf448('0xa')](util[_0xf448('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xf448('0xc')][_0xf448('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf448('0xe'),_0xf448('0xf')]})['then'](function(_0x55507f){if(_0x55507f){_0x46c0df=_0x55507f;_0x5683dd=_0x46c0df[_0xf448('0xf')]||0x1388;}})[_0xf448('0x10')](function(){return dbH['sequelize'][_0xf448('0x11')](util[_0xf448('0xb')](_0xf448('0x12'),QUERY),{'type':dbH[_0xf448('0x13')][_0xf448('0x14')][_0xf448('0x15')]});})[_0xf448('0x10')](function(_0x5d9868){if(!_0x5d9868[0x0]['num']){return analyticExtractedReport(_0xf448('0x16'));}var _0x33d6ea=[];var _0x544ee8=0x0;if(_0x46c0df[_0xf448('0xe')]){if(_0x5d9868&&_0x5d9868['length']){var _0x16345d=_[_0xf448('0x17')](_0x5d9868[0x0][_0xf448('0x18')]/_0x5683dd);var _0x349cdb=Number['isInteger'](_0x5d9868[0x0][_0xf448('0x18')]/_0x5683dd)?_0x5d9868[0x0][_0xf448('0x18')]%_0x5683dd:0x0;_0x16345d[_0xf448('0x19')](function(_0x4af8e8){if(_0x4af8e8>0x0){_0x544ee8+=_0x5683dd;}_0x33d6ea['push'](dbH[_0xf448('0x13')][_0xf448('0x11')](util[_0xf448('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5683dd,_0x544ee8),{'type':dbH[_0xf448('0x13')][_0xf448('0x14')][_0xf448('0x15')]}));});if(_0x349cdb>0x0){_0x544ee8+=_0x5683dd;_0x33d6ea[_0xf448('0x1a')](dbH[_0xf448('0x13')]['query'](util['format'](_0xf448('0x1b'),QUERY,_0x349cdb,_0x544ee8),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x33d6ea['push'](dbH[_0xf448('0x13')]['query'](QUERY,{'type':dbH['sequelize'][_0xf448('0x14')][_0xf448('0x15')]}));}var _0x44abe3=path[_0xf448('0x1c')](PATH);var _0x2cfeaa=path['basename'](PATH,_0xf448('0x1d'));var _0x35879e=_0x46c0df[_0xf448('0xe')]&&_0x33d6ea['length']>0x1;var _0x41eb23=[];if(!fs[_0xf448('0x1e')](path[_0xf448('0x1f')](_0x44abe3,_0x2cfeaa))&&_0x35879e){fs[_0xf448('0x20')](path['join'](_0x44abe3,_0x2cfeaa));}return BPromise[_0xf448('0x21')](_0x33d6ea,function(_0x218469){_0x41eb23[_0xf448('0x1a')](_0x218469);})[_0xf448('0x10')](function(){for(var _0x513bbc=0x0;_0x513bbc<_0x41eb23['length'];_0x513bbc+=0x1){var _0x20c1e4;var _0x3e9bf3=_0x41eb23[_0x513bbc];if(_0x35879e){_0x20c1e4=path['join'](_0x44abe3,_0x2cfeaa,util[_0xf448('0xb')](_0xf448('0x22'),_0x2cfeaa,_0x513bbc,'csv'));}else{_0x20c1e4=path[_0xf448('0x1f')](_0x44abe3,util[_0xf448('0xb')](_0xf448('0x23'),_0x2cfeaa,_0xf448('0x24')));}fs[_0xf448('0x25')](_0x20c1e4,csv(_0x3e9bf3));}})[_0xf448('0x10')](function(){if(_0x35879e){return new Promise(function(_0x363087){zipdir(path['join'](_0x44abe3,_0x2cfeaa),{'saveTo':path['join'](_0x44abe3,util[_0xf448('0xb')](_0xf448('0x23'),_0x2cfeaa,'zip'))},function(_0x22da81,_0x4ebbec){rimraf(path[_0xf448('0x1f')](_0x44abe3,_0x2cfeaa),function(){});_0x363087(_0xf448('0x26'));});});}})[_0xf448('0x10')](function(){logger[_0xf448('0xa')](util[_0xf448('0xb')](_0xf448('0x27'),EXTRACTED_REPORT_ID,_0xf448('0x28')));return analyticExtractedReport(_0xf448('0x29'),_0x35879e?util[_0xf448('0xb')](_0xf448('0x23'),_0x2cfeaa,_0x35879e?_0xf448('0x2a'):'csv'):null);});})[_0xf448('0x2b')](function(_0xfc09fc){logger[_0xf448('0xa')](util['format'](_0xf448('0x2c'),EXTRACTED_REPORT_ID,_0xf448('0x28')),util['inspect'](_0xfc09fc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf448('0x2d'));})[_0xf448('0x2e')](function(){process[_0xf448('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf370=['rimraf','../../mysqldb','../../config/logger','analytics','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf370,0xbf));var _0x0f37=function(_0x169724,_0x3c77f4){_0x169724=_0x169724-0x0;var _0x9c9c94=_0xf370[_0x169724];return _0x9c9c94;};'use strict';var util=require(_0x0f37('0x0'));var path=require(_0x0f37('0x1'));var _=require(_0x0f37('0x2'));var csv=require(_0x0f37('0x3'));var fs=require('fs');var BPromise=require(_0x0f37('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x0f37('0x5'));var db=require(_0x0f37('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x0f37('0x7'))(_0x0f37('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0f37('0x9')][0x3];var PATH=process[_0x0f37('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x555928,_0x2c4bb9){var _0x377779={'status':_0x555928};var _0x5223f8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c4bb9){_0x377779['savename']=_0x2c4bb9;}return db['AnalyticExtractedReport'][_0x0f37('0xa')](_0x377779,_0x5223f8);}function main(){var _0x36deb9=0x1388;var _0x3a05f1;logger[_0x0f37('0xb')](util['format'](_0x0f37('0xc'),EXTRACTED_REPORT_ID,_0x0f37('0xd')));return db[_0x0f37('0xe')][_0x0f37('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0f37('0x10'),_0x0f37('0x11')]})[_0x0f37('0x12')](function(_0x2f64a2){if(_0x2f64a2){_0x3a05f1=_0x2f64a2;_0x36deb9=_0x3a05f1[_0x0f37('0x11')]||0x1388;}})[_0x0f37('0x12')](function(){return dbH[_0x0f37('0x13')][_0x0f37('0x14')](util['format'](_0x0f37('0x15'),QUERY),{'type':dbH[_0x0f37('0x13')][_0x0f37('0x16')][_0x0f37('0x17')]});})[_0x0f37('0x12')](function(_0x43c156){if(!_0x43c156[0x0][_0x0f37('0x18')]){return analyticExtractedReport(_0x0f37('0x19'));}var _0x408d47=[];var _0x33c9ad=0x0;if(_0x3a05f1['split']){if(_0x43c156&&_0x43c156[_0x0f37('0x1a')]){var _0x48ecf5=_['range'](_0x43c156[0x0][_0x0f37('0x18')]/_0x36deb9);var _0x4c275e=Number['isInteger'](_0x43c156[0x0][_0x0f37('0x18')]/_0x36deb9)?_0x43c156[0x0][_0x0f37('0x18')]%_0x36deb9:0x0;_0x48ecf5['forEach'](function(_0x494998){if(_0x494998>0x0){_0x33c9ad+=_0x36deb9;}_0x408d47[_0x0f37('0x1b')](dbH[_0x0f37('0x13')][_0x0f37('0x14')](util[_0x0f37('0x1c')](_0x0f37('0x1d'),QUERY,_0x36deb9,_0x33c9ad),{'type':dbH[_0x0f37('0x13')][_0x0f37('0x16')][_0x0f37('0x17')]}));});if(_0x4c275e>0x0){_0x33c9ad+=_0x36deb9;_0x408d47[_0x0f37('0x1b')](dbH[_0x0f37('0x13')]['query'](util[_0x0f37('0x1c')](_0x0f37('0x1d'),QUERY,_0x4c275e,_0x33c9ad),{'type':dbH[_0x0f37('0x13')][_0x0f37('0x16')][_0x0f37('0x17')]}));}}}else{_0x408d47[_0x0f37('0x1b')](dbH['sequelize'][_0x0f37('0x14')](QUERY,{'type':dbH['sequelize'][_0x0f37('0x16')][_0x0f37('0x17')]}));}var _0x4fd7ad=path[_0x0f37('0x1e')](PATH);var _0x13ba62=path[_0x0f37('0x1f')](PATH,_0x0f37('0x20'));var _0x21c33d=_0x3a05f1[_0x0f37('0x10')]&&_0x408d47[_0x0f37('0x1a')]>0x1;var _0x3d69e2=[];if(!fs[_0x0f37('0x21')](path['join'](_0x4fd7ad,_0x13ba62))&&_0x21c33d){fs[_0x0f37('0x22')](path[_0x0f37('0x23')](_0x4fd7ad,_0x13ba62));}return BPromise[_0x0f37('0x24')](_0x408d47,function(_0x23eb79){_0x3d69e2['push'](_0x23eb79);})['then'](function(){for(var _0x46a378=0x0;_0x46a378<_0x3d69e2['length'];_0x46a378+=0x1){var _0x152d6a;var _0x472d83=_0x3d69e2[_0x46a378];if(_0x21c33d){_0x152d6a=path[_0x0f37('0x23')](_0x4fd7ad,_0x13ba62,util['format'](_0x0f37('0x25'),_0x13ba62,_0x46a378,_0x0f37('0x26')));}else{_0x152d6a=path[_0x0f37('0x23')](_0x4fd7ad,util[_0x0f37('0x1c')](_0x0f37('0x27'),_0x13ba62,_0x0f37('0x26')));}fs[_0x0f37('0x28')](_0x152d6a,csv(_0x472d83));}})['then'](function(){if(_0x21c33d){return new Promise(function(_0x3e3eb4){zipdir(path[_0x0f37('0x23')](_0x4fd7ad,_0x13ba62),{'saveTo':path[_0x0f37('0x23')](_0x4fd7ad,util[_0x0f37('0x1c')]('%s.%s',_0x13ba62,_0x0f37('0x29')))},function(_0x36d81d,_0x392196){rimraf(path[_0x0f37('0x23')](_0x4fd7ad,_0x13ba62),function(){});_0x3e3eb4(_0x0f37('0x2a'));});});}})[_0x0f37('0x12')](function(){logger[_0x0f37('0xb')](util[_0x0f37('0x1c')](_0x0f37('0x2b'),EXTRACTED_REPORT_ID,_0x0f37('0xd')));return analyticExtractedReport('Completed',_0x21c33d?util[_0x0f37('0x1c')](_0x0f37('0x27'),_0x13ba62,_0x21c33d?_0x0f37('0x29'):_0x0f37('0x26')):null);});})[_0x0f37('0x2c')](function(_0x50f614){logger[_0x0f37('0xb')](util['format'](_0x0f37('0x2d'),EXTRACTED_REPORT_ID,_0x0f37('0xd')),util[_0x0f37('0x2e')](_0x50f614,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0f37('0x2f'));})['finally'](function(){process[_0x0f37('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 51c6c24..fd06ca0 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 _0x1cea=['format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','lodash','util','path','moment','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','auto','push','body','concat','keys','forEach'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cea,0xa5));var _0xa1ce=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x1cea[_0x5311a1];return _0x2acb9f;};'use strict';var _=require(_0xa1ce('0x0'));var fs=require('fs');var util=require(_0xa1ce('0x1'));var path=require(_0xa1ce('0x2'));var moment=require(_0xa1ce('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa1ce('0x4'));var rimraf=require(_0xa1ce('0x5'));var JSDOM=require(_0xa1ce('0x6'))[_0xa1ce('0x7')];var window=new JSDOM('')[_0xa1ce('0x8')];var BPromise=require('bluebird');var db=require(_0xa1ce('0x9'))['db'];var dbH=require('../../mysqldb')[_0xa1ce('0xa')];var logger=require(_0xa1ce('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa1ce('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa1ce('0xc')][0x4];var NAME=process[_0xa1ce('0xc')][0x5];var FORMAT=_0xa1ce('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x19661c,_0x237b8d){var _0x4ba1f3={'status':_0x19661c};var _0x21679c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x237b8d){_0x4ba1f3[_0xa1ce('0xe')]=_0x237b8d;}return db[_0xa1ce('0xf')][_0xa1ce('0x10')](_0x4ba1f3,_0x21679c);}function getHeaders(_0x4ee1f2){return _[_0xa1ce('0x11')](_0x4ee1f2,function(_0x25dee9){return{'text':_0x25dee9,'style':_0xa1ce('0x12')};});}function getRows(_0x36cb3c,_0xb18b85){return _[_0xa1ce('0x11')](_0xb18b85,function(_0x2f7d43){return _(_0x2f7d43)['pick'](_0x36cb3c)[_0xa1ce('0x11')](function(_0x28de54){return _0x28de54?_['toString'](_0x28de54):'';})[_0xa1ce('0x13')]();});}function createTable(_0x2afc73,_0x2fc554){var _0x4fcd20={'widths':_[_0xa1ce('0x14')](Array(_0x2afc73['length']),0x91),'heights':function(_0x1e5fd6){return _0x1e5fd6===0x0?_0xa1ce('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4c8caf=getHeaders(_0x2afc73);_0x4fcd20['body'][_0xa1ce('0x16')](_0x4c8caf);var _0x238c14=getRows(_0x2afc73,_0x2fc554);_0x4fcd20[_0xa1ce('0x17')]=_0x4fcd20[_0xa1ce('0x17')][_0xa1ce('0x18')](_0x238c14);return _0x4fcd20;}function createTables(_0xdc19d){var _0xf1f38c=[];var _0x35e66e=_['chunk'](Object[_0xa1ce('0x19')](_0xdc19d[0x0]),0x5);_0x35e66e[_0xa1ce('0x1a')](function(_0x52440d){_0xf1f38c['push'](createTable(_0x52440d,_0xdc19d));});return _0xf1f38c;}function getPDFDocDefinition(_0x27d601){var _0x218cce=util[_0xa1ce('0x1b')](_0xa1ce('0x1c'),NAME,EXTRACTED_REPORT[_0xa1ce('0x1d')],moment(EXTRACTED_REPORT[_0xa1ce('0x1e')])[_0xa1ce('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0xa1ce('0x1f')])[_0xa1ce('0x1b')](FORMAT));var _0x1620fd=[];for(var _0x278cb2=0x0;_0x278cb2<_0x27d601[_0xa1ce('0x20')];_0x278cb2++){var _0x24b932=[];if(_0x278cb2===0x0){_0x24b932[_0xa1ce('0x16')]({'text':_0x218cce,'style':_0xa1ce('0x21')});}var _0x16dd8a={'table':_0x27d601[_0x278cb2]};if(_0x278cb2>0x0){_0x16dd8a[_0xa1ce('0x22')]=_0xa1ce('0x23');_0x16dd8a[_0xa1ce('0x24')]=[0x0,0x46,0x0,0x0];}_0x24b932[_0xa1ce('0x16')](_0x16dd8a);_0x1620fd['push'](_0x24b932);}return{'pageSize':'A4','pageOrientation':_0xa1ce('0x25'),'content':_0x1620fd,'footer':function(_0x510660,_0x50832d){return{'text':_0x510660[_0xa1ce('0x26')]()+_0xa1ce('0x27')+_0x50832d,'style':_0xa1ce('0x28')};},'defaultStyle':{'font':_0xa1ce('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa1ce('0x2a')},'footer':{'alignment':_0xa1ce('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x479fc1){var _0x33cb7b=0x1388;var _0x41e15e;if(!_0x479fc1[0x0][_0xa1ce('0x2c')]){return analyticExtractedReport(_0xa1ce('0x2d'));}return db[_0xa1ce('0x2e')][_0xa1ce('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa1ce('0x30'),_0xa1ce('0x31')]})['then'](function(_0x5b004a){if(_0x5b004a){_0x41e15e=_0x5b004a;_0x33cb7b=_0x41e15e['splitSizePdf']||0x3e8;}})[_0xa1ce('0x32')](function(){var _0x553347=[];var _0x18865b=0x0;if(_0x41e15e[_0xa1ce('0x30')]){if(_0x479fc1&&_0x479fc1[_0xa1ce('0x20')]){var _0x179aa6=_[_0xa1ce('0x33')](_0x479fc1[0x0]['num']/_0x33cb7b);var _0xf0c077=Number[_0xa1ce('0x34')](_0x479fc1[0x0][_0xa1ce('0x2c')]/_0x33cb7b)?_0x479fc1[0x0][_0xa1ce('0x2c')]%_0x33cb7b:0x0;_0x179aa6[_0xa1ce('0x1a')](function(_0x208ef5){if(_0x208ef5>0x0){_0x18865b+=_0x33cb7b;}_0x553347[_0xa1ce('0x16')](dbH['sequelize'][_0xa1ce('0x35')](util[_0xa1ce('0x1b')](_0xa1ce('0x36'),QUERY,_0x33cb7b,_0x18865b),{'type':dbH[_0xa1ce('0x37')][_0xa1ce('0x38')][_0xa1ce('0x39')]}));});if(_0xf0c077>0x0){_0x18865b+=_0x33cb7b;_0x553347[_0xa1ce('0x16')](dbH[_0xa1ce('0x37')][_0xa1ce('0x35')](util[_0xa1ce('0x1b')](_0xa1ce('0x36'),QUERY,_0xf0c077,_0x18865b),{'type':dbH[_0xa1ce('0x37')]['QueryTypes']['SELECT']}));}}}else{_0x553347['push'](dbH[_0xa1ce('0x37')][_0xa1ce('0x35')](QUERY,{'type':dbH[_0xa1ce('0x37')][_0xa1ce('0x38')][_0xa1ce('0x39')]}));}var _0x34f60c=path[_0xa1ce('0x3a')](PATH);var _0x39072c=path[_0xa1ce('0x3b')](PATH,_0xa1ce('0x3c'));var _0x25f690=_0x41e15e['split']&&_0x553347[_0xa1ce('0x20')]>0x1;var _0x563c85=[];if(!fs[_0xa1ce('0x3d')](path[_0xa1ce('0x3e')](_0x34f60c,_0x39072c))&&_0x25f690){fs['mkdirSync'](path['join'](_0x34f60c,_0x39072c));}return BPromise[_0xa1ce('0x3f')](_0x553347,function(_0x1d713a){_0x563c85[_0xa1ce('0x16')](_0x1d713a);})['then'](function(){var _0x25d2b8=[];for(var _0x1cf245=0x0;_0x1cf245<_0x563c85[_0xa1ce('0x20')];_0x1cf245+=0x1){var _0x14c763=_0x563c85[_0x1cf245];var _0x47908f=createTables(_[_0xa1ce('0x40')](_0x14c763));var _0x3f023c;var _0x4878c4=getPDFDocDefinition(_0x47908f);var _0x31c5b0=getPDFPrinter();var _0x5d5de0=_0x31c5b0[_0xa1ce('0x41')](_0x4878c4);if(_0x25f690){_0x3f023c=path[_0xa1ce('0x3e')](_0x34f60c,_0x39072c,util[_0xa1ce('0x1b')](_0xa1ce('0x42'),_0x39072c,_0x1cf245,_0xa1ce('0x43')));}else{_0x3f023c=path[_0xa1ce('0x3e')](_0x34f60c,util[_0xa1ce('0x1b')](_0xa1ce('0x44'),_0x39072c,'pdf'));}_0x25d2b8[_0xa1ce('0x16')](writePDFDocument(_0x5d5de0,_0x3f023c));}return Promise[_0xa1ce('0x45')](_0x25d2b8);})[_0xa1ce('0x32')](function(){if(_0x25f690){return new Promise(function(_0x2d3a53){zipdir(path[_0xa1ce('0x3e')](_0x34f60c,_0x39072c),{'saveTo':path[_0xa1ce('0x3e')](_0x34f60c,util['format'](_0xa1ce('0x44'),_0x39072c,_0xa1ce('0x46')))},function(){rimraf(path[_0xa1ce('0x3e')](_0x34f60c,_0x39072c),function(){});_0x2d3a53(_0xa1ce('0x47'));});});}})['then'](function(){if(!_0x25f690)return;rimraf(path[_0xa1ce('0x3e')](_0x34f60c,_0x39072c),function(){});})[_0xa1ce('0x32')](function(){logger['info'](util['format'](_0xa1ce('0x48'),EXTRACTED_REPORT_ID,_0xa1ce('0x49')));return analyticExtractedReport('Completed',_0x25f690?util[_0xa1ce('0x1b')](_0xa1ce('0x44'),_0x39072c,_0x25f690?_0xa1ce('0x46'):_0xa1ce('0x43')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa1ce('0x4a')](util[_0xa1ce('0x1b')](_0xa1ce('0x4b'),EXTRACTED_REPORT_ID,_0xa1ce('0x49')));return db[_0xa1ce('0xf')][_0xa1ce('0x4c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa1ce('0x32')](function(_0x183582){EXTRACTED_REPORT=_0x183582;return dbH['sequelize']['query'](util['format'](_0xa1ce('0x4d'),QUERY),{'type':dbH[_0xa1ce('0x37')]['QueryTypes'][_0xa1ce('0x39')]});})['then'](extractReport)[_0xa1ce('0x4e')](function(_0xeebb3a){logger[_0xa1ce('0x4a')](util[_0xa1ce('0x1b')](_0xa1ce('0x4f'),EXTRACTED_REPORT_ID,'PDF'),util[_0xa1ce('0x50')](_0xeebb3a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa1ce('0x51'));})[_0xa1ce('0x52')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5e2151=new PdfPrinter({'Arial':{'normal':__dirname+_0xa1ce('0x53'),'bold':__dirname+_0xa1ce('0x54'),'italics':__dirname+_0xa1ce('0x55'),'bolditalics':__dirname+_0xa1ce('0x56')}});return _0x5e2151;}function getPDFDocDefinitionFromHTML(_0x3377e8,_0x339c44){var _0x4c68be=util[_0xa1ce('0x1b')](_0xa1ce('0x57'),_0x339c44[_0xa1ce('0x58')],_0x339c44['interactionId']);var _0x40dbc2=moment()[_0xa1ce('0x1b')](_0xa1ce('0x59'))[_0xa1ce('0x26')]();var _0x3a27f1=htmlToPdfmake(_0x3377e8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3a27f1],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa1ce('0x5a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa1ce('0x5a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa1ce('0x5a')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa1ce('0x21')}];},'footer':function(_0xd9c82a,_0x79738a){return[{'text':util[_0xa1ce('0x1b')](_0xa1ce('0x5b'),_0x4c68be,_0xd9c82a,_0x79738a,_0x40dbc2),'style':_0xa1ce('0x28')}];}};}function writePDFDocument(_0x4ba0a2,_0x28b6a5){return new Promise(function(_0x52c92d,_0xbd5be0){var _0x16dc0b=_0x4ba0a2[_0xa1ce('0x5c')](fs[_0xa1ce('0x5d')](_0x28b6a5));_0x16dc0b['on']('finish',function(){_0x52c92d(_0xa1ce('0x5e'));});_0x16dc0b['on'](_0xa1ce('0x5f'),function(_0x32ced5){_0xbd5be0(_0x32ced5);});_0x4ba0a2['end']();});}exports['createPdfFromHTML']=function(_0x2855e1,_0x1ca866){var _0x468866=getPDFPrinter();var _0x51c995=getPDFDocDefinitionFromHTML(_0x2855e1,_0x1ca866);var _0x5f2066=_0x468866[_0xa1ce('0x41')](_0x51c995);return writePDFDocument(_0x5f2066,_0x1ca866[_0xa1ce('0x2')])['catch'](function(_0x30bc7b){throw _0x30bc7b;});}; \ No newline at end of file +var _0x46ca=['flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','footer','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','zip-dir','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','auto','body','push','concat','chunk','keys','format','name','endDate','header','before','margin','landscape','\x20/\x20','black','right','num','Empty','find','split','then','splitSizePdf','length','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each'];(function(_0x2676c2,_0x3c619d){var _0x3de2bf=function(_0x3ebd19){while(--_0x3ebd19){_0x2676c2['push'](_0x2676c2['shift']());}};_0x3de2bf(++_0x3c619d);}(_0x46ca,0x1cd));var _0xa46c=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0x46ca[_0x4e28c0];return _0x4039d4;};'use strict';var _=require(_0xa46c('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xa46c('0x1'));var moment=require(_0xa46c('0x2'));var htmlToPdfmake=require(_0xa46c('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa46c('0x4'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xa46c('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0xa46c('0x6'));var db=require(_0xa46c('0x7'))['db'];var dbH=require(_0xa46c('0x7'))['dbH'];var logger=require(_0xa46c('0x8'))(_0xa46c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xa46c('0xa')][0x2]);var QUERY=process[_0xa46c('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b2496,_0x337393){var _0x462b51={'status':_0x1b2496};var _0x5531c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x337393){_0x462b51[_0xa46c('0xb')]=_0x337393;}return db[_0xa46c('0xc')][_0xa46c('0xd')](_0x462b51,_0x5531c9);}function getHeaders(_0x509f71){return _[_0xa46c('0xe')](_0x509f71,function(_0x75859b){return{'text':_0x75859b,'style':_0xa46c('0xf')};});}function getRows(_0x440e07,_0x190898){return _[_0xa46c('0xe')](_0x190898,function(_0x1ecbe8){return _(_0x1ecbe8)[_0xa46c('0x10')](_0x440e07)[_0xa46c('0xe')](function(_0x1d4744){return _0x1d4744?_[_0xa46c('0x11')](_0x1d4744):'';})['value']();});}function createTable(_0x1224f2,_0x2b0e53){var _0x56cd6e={'widths':_[_0xa46c('0x12')](Array(_0x1224f2['length']),0x91),'heights':function(_0x5a8e5d){return _0x5a8e5d===0x0?_0xa46c('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x183e5f=getHeaders(_0x1224f2);_0x56cd6e[_0xa46c('0x14')][_0xa46c('0x15')](_0x183e5f);var _0x4d202e=getRows(_0x1224f2,_0x2b0e53);_0x56cd6e['body']=_0x56cd6e[_0xa46c('0x14')][_0xa46c('0x16')](_0x4d202e);return _0x56cd6e;}function createTables(_0x384d6f){var _0x1724c2=[];var _0x43f041=_[_0xa46c('0x17')](Object[_0xa46c('0x18')](_0x384d6f[0x0]),0x5);_0x43f041['forEach'](function(_0x5961d0){_0x1724c2[_0xa46c('0x15')](createTable(_0x5961d0,_0x384d6f));});return _0x1724c2;}function getPDFDocDefinition(_0x2a408b){var _0x2d8f06=util[_0xa46c('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xa46c('0x1a')],moment(EXTRACTED_REPORT['startDate'])[_0xa46c('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xa46c('0x1b')])[_0xa46c('0x19')](FORMAT));var _0x4a4921=[];for(var _0x3a311f=0x0;_0x3a311f<_0x2a408b['length'];_0x3a311f++){var _0x2d8a26=[];if(_0x3a311f===0x0){_0x2d8a26[_0xa46c('0x15')]({'text':_0x2d8f06,'style':_0xa46c('0x1c')});}var _0x5a9693={'table':_0x2a408b[_0x3a311f]};if(_0x3a311f>0x0){_0x5a9693['pageBreak']=_0xa46c('0x1d');_0x5a9693[_0xa46c('0x1e')]=[0x0,0x46,0x0,0x0];}_0x2d8a26['push'](_0x5a9693);_0x4a4921['push'](_0x2d8a26);}return{'pageSize':'A4','pageOrientation':_0xa46c('0x1f'),'content':_0x4a4921,'footer':function(_0x3a372f,_0x2f657f){return{'text':_0x3a372f[_0xa46c('0x11')]()+_0xa46c('0x20')+_0x2f657f,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa46c('0x21')},'footer':{'alignment':_0xa46c('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xcdf059){var _0x5c7022=0x1388;var _0x17e812;if(!_0xcdf059[0x0][_0xa46c('0x23')]){return analyticExtractedReport(_0xa46c('0x24'));}return db['Setting'][_0xa46c('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa46c('0x26'),'splitSizePdf']})[_0xa46c('0x27')](function(_0xe54ddf){if(_0xe54ddf){_0x17e812=_0xe54ddf;_0x5c7022=_0x17e812[_0xa46c('0x28')]||0x3e8;}})['then'](function(){var _0x3cdf48=[];var _0x1dfcf6=0x0;if(_0x17e812[_0xa46c('0x26')]){if(_0xcdf059&&_0xcdf059[_0xa46c('0x29')]){var _0x1f1b4d=_['range'](_0xcdf059[0x0]['num']/_0x5c7022);var _0x1e8514=Number[_0xa46c('0x2a')](_0xcdf059[0x0][_0xa46c('0x23')]/_0x5c7022)?_0xcdf059[0x0][_0xa46c('0x23')]%_0x5c7022:0x0;_0x1f1b4d[_0xa46c('0x2b')](function(_0x9b4127){if(_0x9b4127>0x0){_0x1dfcf6+=_0x5c7022;}_0x3cdf48[_0xa46c('0x15')](dbH[_0xa46c('0x2c')][_0xa46c('0x2d')](util['format'](_0xa46c('0x2e'),QUERY,_0x5c7022,_0x1dfcf6),{'type':dbH['sequelize'][_0xa46c('0x2f')]['SELECT']}));});if(_0x1e8514>0x0){_0x1dfcf6+=_0x5c7022;_0x3cdf48[_0xa46c('0x15')](dbH[_0xa46c('0x2c')][_0xa46c('0x2d')](util['format'](_0xa46c('0x2e'),QUERY,_0x1e8514,_0x1dfcf6),{'type':dbH[_0xa46c('0x2c')][_0xa46c('0x2f')][_0xa46c('0x30')]}));}}}else{_0x3cdf48[_0xa46c('0x15')](dbH[_0xa46c('0x2c')][_0xa46c('0x2d')](QUERY,{'type':dbH[_0xa46c('0x2c')][_0xa46c('0x2f')][_0xa46c('0x30')]}));}var _0x558bd4=path[_0xa46c('0x31')](PATH);var _0x86d812=path[_0xa46c('0x32')](PATH,_0xa46c('0x33'));var _0x1e8f6b=_0x17e812[_0xa46c('0x26')]&&_0x3cdf48[_0xa46c('0x29')]>0x1;var _0x222b25=[];if(!fs['existsSync'](path[_0xa46c('0x34')](_0x558bd4,_0x86d812))&&_0x1e8f6b){fs[_0xa46c('0x35')](path[_0xa46c('0x34')](_0x558bd4,_0x86d812));}return BPromise[_0xa46c('0x36')](_0x3cdf48,function(_0x36439b){_0x222b25[_0xa46c('0x15')](_0x36439b);})['then'](function(){var _0x3da93a=[];for(var _0x182b6e=0x0;_0x182b6e<_0x222b25[_0xa46c('0x29')];_0x182b6e+=0x1){var _0x188f1a=_0x222b25[_0x182b6e];var _0x6adbbc=createTables(_[_0xa46c('0x37')](_0x188f1a));var _0x3f7b1d;var _0x38b580=getPDFDocDefinition(_0x6adbbc);var _0x119df6=getPDFPrinter();var _0x2e21c9=_0x119df6[_0xa46c('0x38')](_0x38b580);if(_0x1e8f6b){_0x3f7b1d=path[_0xa46c('0x34')](_0x558bd4,_0x86d812,util['format'](_0xa46c('0x39'),_0x86d812,_0x182b6e,'pdf'));}else{_0x3f7b1d=path[_0xa46c('0x34')](_0x558bd4,util[_0xa46c('0x19')](_0xa46c('0x3a'),_0x86d812,_0xa46c('0x3b')));}_0x3da93a[_0xa46c('0x15')](writePDFDocument(_0x2e21c9,_0x3f7b1d));}return Promise[_0xa46c('0x3c')](_0x3da93a);})['then'](function(){if(_0x1e8f6b){return new Promise(function(_0x4ede47){zipdir(path[_0xa46c('0x34')](_0x558bd4,_0x86d812),{'saveTo':path[_0xa46c('0x34')](_0x558bd4,util[_0xa46c('0x19')]('%s.%s',_0x86d812,_0xa46c('0x3d')))},function(){rimraf(path[_0xa46c('0x34')](_0x558bd4,_0x86d812),function(){});_0x4ede47(_0xa46c('0x3e'));});});}})[_0xa46c('0x27')](function(){if(!_0x1e8f6b)return;rimraf(path['join'](_0x558bd4,_0x86d812),function(){});})[_0xa46c('0x27')](function(){logger['info'](util[_0xa46c('0x19')](_0xa46c('0x3f'),EXTRACTED_REPORT_ID,_0xa46c('0x40')));return analyticExtractedReport(_0xa46c('0x41'),_0x1e8f6b?util['format'](_0xa46c('0x3a'),_0x86d812,_0x1e8f6b?'zip':_0xa46c('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa46c('0x42')](util[_0xa46c('0x19')](_0xa46c('0x43'),EXTRACTED_REPORT_ID,_0xa46c('0x40')));return db['AnalyticExtractedReport'][_0xa46c('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa46c('0x27')](function(_0x4f6e92){EXTRACTED_REPORT=_0x4f6e92;return dbH[_0xa46c('0x2c')][_0xa46c('0x2d')](util[_0xa46c('0x19')](_0xa46c('0x45'),QUERY),{'type':dbH[_0xa46c('0x2c')]['QueryTypes'][_0xa46c('0x30')]});})[_0xa46c('0x27')](extractReport)[_0xa46c('0x46')](function(_0x38de0c){logger[_0xa46c('0x42')](util[_0xa46c('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa46c('0x40')),util[_0xa46c('0x47')](_0x38de0c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa46c('0x48'));})['finally'](function(){process[_0xa46c('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1df69c=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa46c('0x4a'),'bolditalics':__dirname+_0xa46c('0x4b')}});return _0x1df69c;}function getPDFDocDefinitionFromHTML(_0x234b26,_0x44c662){var _0x2ae7b8=util[_0xa46c('0x19')](_0xa46c('0x4c'),_0x44c662[_0xa46c('0x4d')],_0x44c662[_0xa46c('0x4e')]);var _0x1d7149=moment()['format']('YYYY-MM-DD')['toString']();var _0x3e134d=htmlToPdfmake(_0x234b26,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3e134d],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa46c('0x4f'),'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':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa46c('0x1c')}];},'footer':function(_0x1a6587,_0x21b2bb){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2ae7b8,_0x1a6587,_0x21b2bb,_0x1d7149),'style':_0xa46c('0x50')}];}};}function writePDFDocument(_0x445763,_0x2355e0){return new Promise(function(_0x5e63bd,_0x4d6b4a){var _0x1ddfde=_0x445763[_0xa46c('0x51')](fs[_0xa46c('0x52')](_0x2355e0));_0x1ddfde['on'](_0xa46c('0x53'),function(){_0x5e63bd(_0xa46c('0x53'));});_0x1ddfde['on'](_0xa46c('0x54'),function(_0x2405f9){_0x4d6b4a(_0x2405f9);});_0x445763['end']();});}exports[_0xa46c('0x55')]=function(_0x31bc2e,_0x562d1b){var _0x425d4c=getPDFPrinter();var _0x2b9673=getPDFDocDefinitionFromHTML(_0x31bc2e,_0x562d1b);var _0x5f3250=_0x425d4c['createPdfKitDocument'](_0x2b9673);return writePDFDocument(_0x5f3250,_0x562d1b['path'])[_0xa46c('0x46')](function(_0xbd94ba){throw _0xbd94ba;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5659549..63bda03 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 _0x7b31=['split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','length','range','isInteger','forEach','QueryTypes','SELECT','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX'];(function(_0x6bc38d,_0x55d87d){var _0x589eef=function(_0x31f5c1){while(--_0x31f5c1){_0x6bc38d['push'](_0x6bc38d['shift']());}};_0x589eef(++_0x55d87d);}(_0x7b31,0xb5));var _0x17b3=function(_0x52030c,_0x53786a){_0x52030c=_0x52030c-0x0;var _0x42ff48=_0x7b31[_0x52030c];return _0x42ff48;};'use strict';var util=require('util');var path=require(_0x17b3('0x0'));var _=require(_0x17b3('0x1'));var fs=require('fs');var json2xls=require(_0x17b3('0x2'));var BPromise=require(_0x17b3('0x3'));var zipdir=require(_0x17b3('0x4'));var rimraf=require(_0x17b3('0x5'));var db=require(_0x17b3('0x6'))['db'];var dbH=require(_0x17b3('0x6'))[_0x17b3('0x7')];var logger=require('../../config/logger')(_0x17b3('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x17b3('0x9')][0x3];var PATH=process[_0x17b3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe85ac,_0x56591a){var _0x2e451d={'status':_0xe85ac};var _0x527045={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x56591a){_0x2e451d['savename']=_0x56591a;}return db[_0x17b3('0xa')]['update'](_0x2e451d,_0x527045);}function main(){var _0x763ca5=0x1388;var _0x4feec6;logger[_0x17b3('0xb')](util[_0x17b3('0xc')](_0x17b3('0xd'),EXTRACTED_REPORT_ID,_0x17b3('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x17b3('0xf'),_0x17b3('0x10')]})[_0x17b3('0x11')](function(_0x10cc9e){if(_0x10cc9e){_0x4feec6=_0x10cc9e;_0x763ca5=_0x4feec6[_0x17b3('0x10')]||0x1388;}})[_0x17b3('0x11')](function(){return dbH[_0x17b3('0x12')][_0x17b3('0x13')](util[_0x17b3('0xc')](_0x17b3('0x14'),QUERY),{'type':dbH[_0x17b3('0x12')]['QueryTypes']['SELECT']});})[_0x17b3('0x11')](function(_0x22463e){if(!_0x22463e[0x0][_0x17b3('0x15')]){return analyticExtractedReport('Empty');}var _0x5bfe46=[];var _0x2cf71a=0x0;if(_0x4feec6[_0x17b3('0xf')]){if(_0x22463e&&_0x22463e[_0x17b3('0x16')]){var _0x160142=_[_0x17b3('0x17')](_0x22463e[0x0][_0x17b3('0x15')]/_0x763ca5);var _0x24135c=Number[_0x17b3('0x18')](_0x22463e[0x0]['num']/_0x763ca5)?_0x22463e[0x0]['num']%_0x763ca5:0x0;_0x160142[_0x17b3('0x19')](function(_0x4f3126){if(_0x4f3126>0x0){_0x2cf71a+=_0x763ca5;}_0x5bfe46['push'](dbH[_0x17b3('0x12')][_0x17b3('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x763ca5,_0x2cf71a),{'type':dbH[_0x17b3('0x12')][_0x17b3('0x1a')][_0x17b3('0x1b')]}));});if(_0x24135c>0x0){_0x2cf71a+=_0x763ca5;_0x5bfe46[_0x17b3('0x1c')](dbH['sequelize'][_0x17b3('0x13')](util[_0x17b3('0xc')](_0x17b3('0x1d'),QUERY,_0x24135c,_0x2cf71a),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x5bfe46[_0x17b3('0x1c')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x17b3('0x12')][_0x17b3('0x1a')][_0x17b3('0x1b')]}));}var _0x25634a=path['dirname'](PATH);var _0x2b8620=path[_0x17b3('0x1e')](PATH,_0x17b3('0x1f'));var _0x28089d=_0x4feec6[_0x17b3('0xf')]&&_0x5bfe46[_0x17b3('0x16')]>0x1;var _0x126892=[];if(!fs[_0x17b3('0x20')](path[_0x17b3('0x21')](_0x25634a,_0x2b8620))&&_0x28089d){fs[_0x17b3('0x22')](path[_0x17b3('0x21')](_0x25634a,_0x2b8620));}return BPromise[_0x17b3('0x23')](_0x5bfe46,function(_0x5e87fe){_0x126892[_0x17b3('0x1c')](_0x5e87fe);})[_0x17b3('0x11')](function(){for(var _0x13c40f=0x0;_0x13c40f<_0x126892[_0x17b3('0x16')];_0x13c40f+=0x1){var _0x4310f5;var _0x5ec47b=_0x126892[_0x13c40f];if(_0x28089d){_0x4310f5=path[_0x17b3('0x21')](_0x25634a,_0x2b8620,util[_0x17b3('0xc')](_0x17b3('0x24'),_0x2b8620,_0x13c40f,_0x17b3('0x25')));}else{_0x4310f5=path[_0x17b3('0x21')](_0x25634a,util[_0x17b3('0xc')](_0x17b3('0x26'),_0x2b8620,_0x17b3('0x25')));}fs[_0x17b3('0x27')](_0x4310f5,json2xls(_0x5ec47b),_0x17b3('0x28'));}})['then'](function(){if(_0x28089d){return new Promise(function(_0x58e769){zipdir(path[_0x17b3('0x21')](_0x25634a,_0x2b8620),{'saveTo':path['join'](_0x25634a,util[_0x17b3('0xc')](_0x17b3('0x26'),_0x2b8620,_0x17b3('0x29')))},function(_0xb6524b,_0x235195){rimraf(path[_0x17b3('0x21')](_0x25634a,_0x2b8620),function(){});_0x58e769(_0x17b3('0x2a'));});});}})[_0x17b3('0x11')](function(){logger[_0x17b3('0xb')](util[_0x17b3('0xc')](_0x17b3('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x17b3('0x2c'),_0x28089d?util[_0x17b3('0xc')](_0x17b3('0x26'),_0x2b8620,_0x28089d?_0x17b3('0x29'):'xlsx'):null);});})['catch'](function(_0x251bfa){logger[_0x17b3('0xb')](util['format'](_0x17b3('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x17b3('0x2e')](_0x251bfa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17b3('0x2f'));})[_0x17b3('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9972=['.xlsx','existsSync','join','mkdirSync','%s%d.%s','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename'];(function(_0x52770c,_0x31c089){var _0x187fe9=function(_0x543480){while(--_0x543480){_0x52770c['push'](_0x52770c['shift']());}};_0x187fe9(++_0x31c089);}(_0x9972,0xaa));var _0x2997=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9972[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x2997('0x0'));var path=require(_0x2997('0x1'));var _=require(_0x2997('0x2'));var fs=require('fs');var json2xls=require(_0x2997('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x2997('0x4'));var rimraf=require('rimraf');var db=require(_0x2997('0x5'))['db'];var dbH=require('../../mysqldb')[_0x2997('0x6')];var logger=require(_0x2997('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2997('0x8')][0x2]);var QUERY=process[_0x2997('0x8')][0x3];var PATH=process[_0x2997('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x581ed1,_0x1820dc){var _0x4445bb={'status':_0x581ed1};var _0x1fe2bb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1820dc){_0x4445bb[_0x2997('0x9')]=_0x1820dc;}return db[_0x2997('0xa')][_0x2997('0xb')](_0x4445bb,_0x1fe2bb);}function main(){var _0x56ec22=0x1388;var _0x2070e8;logger[_0x2997('0xc')](util['format'](_0x2997('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x2997('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2997('0xf'),_0x2997('0x10')]})[_0x2997('0x11')](function(_0x5974bf){if(_0x5974bf){_0x2070e8=_0x5974bf;_0x56ec22=_0x2070e8[_0x2997('0x10')]||0x1388;}})[_0x2997('0x11')](function(){return dbH['sequelize'][_0x2997('0x12')](util[_0x2997('0x13')](_0x2997('0x14'),QUERY),{'type':dbH[_0x2997('0x15')][_0x2997('0x16')][_0x2997('0x17')]});})[_0x2997('0x11')](function(_0x51e834){if(!_0x51e834[0x0][_0x2997('0x18')]){return analyticExtractedReport(_0x2997('0x19'));}var _0xd3251c=[];var _0x48bee9=0x0;if(_0x2070e8[_0x2997('0xf')]){if(_0x51e834&&_0x51e834[_0x2997('0x1a')]){var _0x400fbf=_[_0x2997('0x1b')](_0x51e834[0x0][_0x2997('0x18')]/_0x56ec22);var _0x488d5b=Number[_0x2997('0x1c')](_0x51e834[0x0]['num']/_0x56ec22)?_0x51e834[0x0][_0x2997('0x18')]%_0x56ec22:0x0;_0x400fbf[_0x2997('0x1d')](function(_0x5d2a65){if(_0x5d2a65>0x0){_0x48bee9+=_0x56ec22;}_0xd3251c[_0x2997('0x1e')](dbH[_0x2997('0x15')][_0x2997('0x12')](util[_0x2997('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x56ec22,_0x48bee9),{'type':dbH[_0x2997('0x15')][_0x2997('0x16')][_0x2997('0x17')]}));});if(_0x488d5b>0x0){_0x48bee9+=_0x56ec22;_0xd3251c[_0x2997('0x1e')](dbH['sequelize']['query'](util[_0x2997('0x13')](_0x2997('0x1f'),QUERY,_0x488d5b,_0x48bee9),{'type':dbH[_0x2997('0x15')]['QueryTypes']['SELECT']}));}}}else{_0xd3251c[_0x2997('0x1e')](dbH[_0x2997('0x15')][_0x2997('0x12')](QUERY,{'type':dbH[_0x2997('0x15')][_0x2997('0x16')][_0x2997('0x17')]}));}var _0x1e52c1=path[_0x2997('0x20')](PATH);var _0x2510b2=path[_0x2997('0x21')](PATH,_0x2997('0x22'));var _0x56eebd=_0x2070e8[_0x2997('0xf')]&&_0xd3251c['length']>0x1;var _0x3630d5=[];if(!fs[_0x2997('0x23')](path[_0x2997('0x24')](_0x1e52c1,_0x2510b2))&&_0x56eebd){fs[_0x2997('0x25')](path[_0x2997('0x24')](_0x1e52c1,_0x2510b2));}return BPromise['each'](_0xd3251c,function(_0x6639be){_0x3630d5['push'](_0x6639be);})[_0x2997('0x11')](function(){for(var _0x1f088e=0x0;_0x1f088e<_0x3630d5['length'];_0x1f088e+=0x1){var _0x5d5d59;var _0x1029a6=_0x3630d5[_0x1f088e];if(_0x56eebd){_0x5d5d59=path[_0x2997('0x24')](_0x1e52c1,_0x2510b2,util[_0x2997('0x13')](_0x2997('0x26'),_0x2510b2,_0x1f088e,'xlsx'));}else{_0x5d5d59=path[_0x2997('0x24')](_0x1e52c1,util['format'](_0x2997('0x27'),_0x2510b2,'xlsx'));}fs['writeFileSync'](_0x5d5d59,json2xls(_0x1029a6),'binary');}})[_0x2997('0x11')](function(){if(_0x56eebd){return new Promise(function(_0x51827e){zipdir(path[_0x2997('0x24')](_0x1e52c1,_0x2510b2),{'saveTo':path[_0x2997('0x24')](_0x1e52c1,util['format']('%s.%s',_0x2510b2,_0x2997('0x28')))},function(_0x3360d7,_0x376e4f){rimraf(path[_0x2997('0x24')](_0x1e52c1,_0x2510b2),function(){});_0x51827e(_0x2997('0x29'));});});}})[_0x2997('0x11')](function(){logger[_0x2997('0xc')](util[_0x2997('0x13')](_0x2997('0x2a'),EXTRACTED_REPORT_ID,_0x2997('0x2b')));return analyticExtractedReport(_0x2997('0x2c'),_0x56eebd?util['format']('%s.%s',_0x2510b2,_0x56eebd?'zip':_0x2997('0x2d')):null);});})[_0x2997('0x2e')](function(_0x26db5d){logger[_0x2997('0xc')](util[_0x2997('0x13')](_0x2997('0x2f'),EXTRACTED_REPORT_ID,_0x2997('0x2b')),util[_0x2997('0x30')](_0x26db5d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2997('0x31'));})[_0x2997('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0ff19cb..ef896a1 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 _0xc0a3=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','playback','hasOwnProperty','priority','extension','find','Set','format','CDR(type)=%s','context','VoiceExtensionId','type','inbound','push','CDR(routeid)=','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app'];(function(_0x3dfea6,_0x5cd685){var _0x567aca=function(_0x100a5f){while(--_0x100a5f){_0x3dfea6['push'](_0x3dfea6['shift']());}};_0x567aca(++_0x5cd685);}(_0xc0a3,0x1bb));var _0x3c0a=function(_0xb52c4,_0x57e743){_0xb52c4=_0xb52c4-0x0;var _0x241098=_0xc0a3[_0xb52c4];return _0x241098;};'use strict';var _=require(_0x3c0a('0x0'));var util=require(_0x3c0a('0x1'));function rewrite(_0x12bd97,_0x51cee7){var _0x5bb7f6=this;return _0x12bd97[_0x3c0a('0x2')][_0x3c0a('0x3')][_0x3c0a('0x4')]({'raw':!![]})[_0x3c0a('0x5')](function(_0x2a197a){_0x5bb7f6[_0x3c0a('0x6')]=_0x2a197a;return _0x12bd97['models']['VoiceExtension'][_0x3c0a('0x4')]({'where':{'IntervalId':_0x51cee7[_0x3c0a('0x7')]},'raw':!![]});})['then'](function(_0x342a6e){return _0x12bd97[_0x3c0a('0x2')][_0x3c0a('0x8')][_0x3c0a('0x4')]({'where':{'exten':{'$in':_[_0x3c0a('0x9')](_[_0x3c0a('0xa')](_0x342a6e,'exten'))}},'order':[{'raw':_0x3c0a('0xb')}],'raw':!![]});})['then'](function(_0x1157c9){var _0x21695e=_[_0x3c0a('0xc')](_0x1157c9,{'priority':'1'});var _0x34ebf3=_[_0x3c0a('0xc')](_0x1157c9,{'isApp':0x1});var _0x49c363=_['groupBy'](_0x34ebf3,_0x3c0a('0xd'));var _0x2b1b80=['queue',_0x3c0a('0xe')];var _0x2e0e99=[];var _0x4fec0a=[];for(var _0x47ead8 in _0x49c363){if(_0x49c363[_0x3c0a('0xf')](_0x47ead8)){_0x5bb7f6[_0x3c0a('0x10')]=0x2;_0x5bb7f6['extensions']=[];_0x5bb7f6[_0x3c0a('0x11')]=_[_0x3c0a('0x12')](_0x21695e,{'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')]});_0x5bb7f6['extensions']['push']({'type':_0x49c363[_0x47ead8][0x0]['type'],'app':_0x3c0a('0x13'),'appdata':util[_0x3c0a('0x14')](_0x3c0a('0x15'),_0x49c363[_0x47ead8][0x0]['type']),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});if(_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')]===_0x3c0a('0x19')){_0x5bb7f6['extensions'][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x1b')+_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')],'context':_0x49c363[_0x47ead8][0x0]['context'],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});}else if(_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')]===_0x3c0a('0x1c')){if(_0x5bb7f6[_0x3c0a('0x11')]){_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x1e')+(_0x5bb7f6[_0x3c0a('0x11')][_0x3c0a('0x1f')]?'${EXTEN:'+_0x5bb7f6[_0x3c0a('0x11')]['cutdigits']+'}':_0x3c0a('0x20')),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6['priority']++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});}_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':'Set','appdata':_0x3c0a('0x1b')+_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')],'context':_0x49c363[_0x47ead8][0x0]['context'],'exten':_0x49c363[_0x47ead8][0x0]['exten'],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});var _0x274abd=_0x5bb7f6[_0x3c0a('0x10')]++;_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':_0x3c0a('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x274abd+0x2)+_0x3c0a('0x22')+(_0x274abd+0x1)+')','context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x274abd,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});if(_0x5bb7f6['extension']){_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0]['type'],'app':_0x3c0a('0x13'),'appdata':_0x5bb7f6[_0x3c0a('0x11')][_0x3c0a('0x1f')]?_0x3c0a('0x23')+_0x5bb7f6[_0x3c0a('0x11')][_0x3c0a('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});}_0x5bb7f6['extensions'][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0]['type'],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x24')+_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')],'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0]['VoiceExtensionId']});if(_0x5bb7f6[_0x3c0a('0x11')]&&_0x5bb7f6[_0x3c0a('0x11')][_0x3c0a('0xf')](_0x3c0a('0x25'))&&_0x5bb7f6[_0x3c0a('0x11')]['recordingFormat']!=='none'){_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x26'),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});_0x5bb7f6[_0x3c0a('0x1d')]['push']({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':'Set','appdata':_0x3c0a('0x27')+_0x5bb7f6[_0x3c0a('0x11')][_0x3c0a('0x25')]||_0x3c0a('0x28'),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});}}_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':'Set','appdata':_0x3c0a('0x29'),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0]['type'],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x2a'),'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0]['exten'],'priority':_0x5bb7f6[_0x3c0a('0x10')]++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});_0x5bb7f6[_0x3c0a('0x1d')][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'exten':_0x49c363[_0x47ead8][0x0]['exten'],'priority':_0x5bb7f6['priority']++,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});for(var _0x171f49=0x0,_0x4a6422=0x0;_0x171f49<_0x49c363[_0x47ead8][_0x3c0a('0x2b')];_0x171f49+=0x1,_0x4a6422=0x0){var _0x836480=_0x49c363[_0x47ead8][_0x171f49];if(_0x836480[_0x3c0a('0x18')]){_0x836480['type']=_0x836480['type'][_0x3c0a('0x2c')]();}var _0x45ff6f=[];var _0xd4c4e8=[];delete _0x836480['id'];delete _0x836480[_0x3c0a('0x2d')];delete _0x836480[_0x3c0a('0x2e')];var _0x1dc9c2=_0x836480[_0x3c0a('0x2f')]!==_0x3c0a('0x30')?[_0x836480[_0x3c0a('0x2f')]]:_0x836480[_0x3c0a('0x7')]?_[_0x3c0a('0xa')](_[_0x3c0a('0xc')](_0x5bb7f6[_0x3c0a('0x6')],{'IntervalId':_0x836480[_0x3c0a('0x7')]}),'interval'):[];if(_0x836480[_0x3c0a('0xf')](_0x3c0a('0x31'))){if(_0x836480['tag']&&_0x836480[_0x3c0a('0x31')]!=='--'){_0x45ff6f[_0x3c0a('0x1a')]({'type':_0x836480[_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':'CDR(tag)='+_0x836480[_0x3c0a('0x31')],'context':_0x836480[_0x3c0a('0x16')],'exten':_0x836480['exten'],'priority':_0x1dc9c2['length']+_0x5bb7f6[_0x3c0a('0x10')]+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});}}if(_0x836480[_0x3c0a('0x18')]==='outbound'&&_0x836480[_0x3c0a('0xf')](_0x3c0a('0x32'))){if(_0x836480['callerID']){_0x45ff6f[_0x3c0a('0x1a')]({'type':_0x836480[_0x3c0a('0x18')],'app':_0x3c0a('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x836480['callerID']+')','context':_0x836480[_0x3c0a('0x16')],'exten':_0x836480[_0x3c0a('0xd')],'priority':_0x1dc9c2[_0x3c0a('0x2b')]+_0x5bb7f6[_0x3c0a('0x10')]+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});}else{_0x45ff6f[_0x3c0a('0x1a')]({'type':_0x836480[_0x3c0a('0x18')],'app':'ExecIf','appdata':_0x3c0a('0x33'),'context':_0x836480['context'],'exten':_0x836480[_0x3c0a('0xd')],'priority':_0x1dc9c2[_0x3c0a('0x2b')]+_0x5bb7f6[_0x3c0a('0x10')]+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});}}if(_0x836480[_0x3c0a('0xf')](_0x3c0a('0x34'))){if(_0x2b1b80['indexOf'](_0x836480[_0x3c0a('0x35')][_0x3c0a('0x2c')]())>=0x0&&_0x836480[_0x3c0a('0x36')]!==_0x3c0a('0x37')){if(_0x836480[_0x3c0a('0x34')]){_0x45ff6f['push']({'type':_0x836480['type'],'app':_0x3c0a('0x21'),'appdata':_0x3c0a('0x38'),'context':_0x836480[_0x3c0a('0x16')],'exten':_0x836480['exten'],'priority':_0x1dc9c2['length']+_0x5bb7f6['priority']+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});_0x45ff6f[_0x3c0a('0x1a')]({'type':_0x836480['type'],'app':'Set','appdata':_0x3c0a('0x39'),'context':_0x836480['context'],'exten':_0x836480[_0x3c0a('0xd')],'priority':_0x1dc9c2[_0x3c0a('0x2b')]+_0x5bb7f6[_0x3c0a('0x10')]+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});}else{_0x45ff6f['push']({'type':_0x836480[_0x3c0a('0x18')],'app':_0x3c0a('0x21'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x836480[_0x3c0a('0x16')],'exten':_0x836480['exten'],'priority':_0x1dc9c2[_0x3c0a('0x2b')]+_0x5bb7f6['priority']+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});_0x45ff6f[_0x3c0a('0x1a')]({'type':_0x836480[_0x3c0a('0x18')],'app':_0x3c0a('0x13'),'appdata':_0x3c0a('0x3a'),'context':_0x836480[_0x3c0a('0x16')],'exten':_0x836480['exten'],'priority':_0x1dc9c2[_0x3c0a('0x2b')]+_0x5bb7f6[_0x3c0a('0x10')]+_0x4a6422++,'VoiceExtensionId':_0x836480[_0x3c0a('0x17')]});}}}for(var _0x2daf68=0x0;_0x2daf68<_0x1dc9c2[_0x3c0a('0x2b')];_0x2daf68+=0x1){var _0x424786=_0x5bb7f6[_0x3c0a('0x10')]+_0x1dc9c2[_0x3c0a('0x2b')];var _0x48896d=_0x2daf68===_0x1dc9c2[_0x3c0a('0x2b')]-0x1?_0x5bb7f6[_0x3c0a('0x10')]+_0x45ff6f[_0x3c0a('0x2b')]+_0xd4c4e8[_0x3c0a('0x2b')]+0x2:_0x5bb7f6['priority']+_0x2daf68+0x1;_0x45ff6f[_0x3c0a('0x3b')](_0x2daf68,0x0,{'type':_0x836480[_0x3c0a('0x18')],'app':_0x3c0a('0x3c'),'appdata':_0x1dc9c2[_0x2daf68]+'?'+_0x836480['context']+',${EXTEN},'+_0x424786+':'+_0x836480[_0x3c0a('0x16')]+_0x3c0a('0x3d')+_0x48896d,'exten':_0x836480[_0x3c0a('0xd')],'context':_0x836480[_0x3c0a('0x16')],'priority':_0x5bb7f6[_0x3c0a('0x10')]+_0x2daf68,'VoiceExtensionId':_0x49c363[_0x47ead8][0x0]['VoiceExtensionId']});}_0x836480[_0x3c0a('0x10')]=_0x45ff6f['length']?_[_0x3c0a('0x3e')](_0x45ff6f)[_0x3c0a('0x10')]+0x1:_0x5bb7f6[_0x3c0a('0x10')];_0x5bb7f6[_0x3c0a('0x10')]=(_0xd4c4e8[_0x3c0a('0x2b')]?_['last'](_0xd4c4e8)['priority']:_0x836480['priority'])+0x1;_0x5bb7f6[_0x3c0a('0x1d')]=_['concat'](_0x5bb7f6[_0x3c0a('0x1d')],_0x45ff6f,[_0x836480],_0xd4c4e8);}_0x5bb7f6['extensions'][_0x3c0a('0x1a')]({'type':_0x49c363[_0x47ead8][0x0]['type'],'app':_0x3c0a('0x3f'),'exten':_0x49c363[_0x47ead8][0x0][_0x3c0a('0xd')],'context':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x16')],'priority':_0x5bb7f6[_0x3c0a('0x10')],'VoiceExtensionId':_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]});_0x2e0e99['push'](_0x49c363[_0x47ead8][0x0][_0x3c0a('0x17')]);_0x4fec0a=_[_0x3c0a('0x40')](_0x4fec0a,_0x5bb7f6[_0x3c0a('0x1d')]);}}return _0x12bd97[_0x3c0a('0x41')](function(_0x5f28eb){return _0x12bd97[_0x3c0a('0x2')][_0x3c0a('0x8')][_0x3c0a('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2e0e99}},'transaction':_0x5f28eb})['then'](function(_0x3c51a4){return _0x12bd97[_0x3c0a('0x2')][_0x3c0a('0x8')]['bulkCreate'](_[_0x3c0a('0x43')](_0x4fec0a,_0x3c0a('0x10')),{'transaction':_0x5f28eb});});});})[_0x3c0a('0x44')](function(_0x16f683){console[_0x3c0a('0x45')](_0x16f683);});}exports[_0x3c0a('0x46')]=rewrite; \ No newline at end of file +var _0x617b=['indexOf','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','hasOwnProperty','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','extensions','CDR(routeid)=','priority','outbound','extension','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)'];(function(_0x1f9990,_0x4e6868){var _0x5a2996=function(_0x24f280){while(--_0x24f280){_0x1f9990['push'](_0x1f9990['shift']());}};_0x5a2996(++_0x4e6868);}(_0x617b,0x124));var _0xb617=function(_0x4ad2f1,_0x2dcb1f){_0x4ad2f1=_0x4ad2f1-0x0;var _0x2cecc3=_0x617b[_0x4ad2f1];return _0x2cecc3;};'use strict';var _=require(_0xb617('0x0'));var util=require(_0xb617('0x1'));function rewrite(_0x52af14,_0xd0ff62){var _0x3a0857=this;return _0x52af14[_0xb617('0x2')][_0xb617('0x3')][_0xb617('0x4')]({'raw':!![]})[_0xb617('0x5')](function(_0x29adc8){_0x3a0857['intervals']=_0x29adc8;return _0x52af14[_0xb617('0x2')][_0xb617('0x6')][_0xb617('0x4')]({'where':{'IntervalId':_0xd0ff62['IntervalId']},'raw':!![]});})[_0xb617('0x5')](function(_0x28fda8){return _0x52af14[_0xb617('0x2')][_0xb617('0x6')][_0xb617('0x4')]({'where':{'exten':{'$in':_[_0xb617('0x7')](_[_0xb617('0x8')](_0x28fda8,'exten'))}},'order':[{'raw':_0xb617('0x9')}],'raw':!![]});})[_0xb617('0x5')](function(_0x254bcb){var _0x6d2109=_[_0xb617('0xa')](_0x254bcb,{'priority':'1'});var _0x42b4c7=_[_0xb617('0xa')](_0x254bcb,{'isApp':0x1});var _0x17fd4f=_['groupBy'](_0x42b4c7,_0xb617('0xb'));var _0x2753cf=[_0xb617('0xc'),'playback'];var _0x23cf54=[];var _0x5e1fd0=[];for(var _0x31808e in _0x17fd4f){if(_0x17fd4f[_0xb617('0xd')](_0x31808e)){_0x3a0857['priority']=0x2;_0x3a0857['extensions']=[];_0x3a0857['extension']=_[_0xb617('0xe')](_0x6d2109,{'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')]});_0x3a0857['extensions']['push']({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':util[_0xb617('0x11')](_0xb617('0x12'),_0x17fd4f[_0x31808e][0x0]['type']),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0]['exten'],'priority':_0x3a0857['priority']++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});if(_0x17fd4f[_0x31808e][0x0]['type']===_0xb617('0x15')){_0x3a0857[_0xb617('0x16')]['push']({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':_0xb617('0x17')+_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId'],'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});}else if(_0x17fd4f[_0x31808e][0x0]['type']===_0xb617('0x19')){if(_0x3a0857[_0xb617('0x1a')]){_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0]['type'],'app':_0xb617('0x10'),'appdata':_0xb617('0x1c')+(_0x3a0857[_0xb617('0x1a')][_0xb617('0x1d')]?_0xb617('0x1e')+_0x3a0857[_0xb617('0x1a')][_0xb617('0x1d')]+'}':_0xb617('0x1f')),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0]['exten'],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});}_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':'CDR(routeid)='+_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId'],'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});var _0x3db253=_0x3a0857[_0xb617('0x18')]++;_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x20'),'appdata':_0xb617('0x21')+(_0x3db253+0x2)+'):Goto('+(_0x3db253+0x1)+')','context':_0x17fd4f[_0x31808e][0x0]['context'],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3db253,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});if(_0x3a0857['extension']){_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':'Set','appdata':_0x3a0857[_0xb617('0x1a')]['cutdigits']?_0xb617('0x22')+_0x3a0857[_0xb617('0x1a')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857['priority']++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId']});}_0x3a0857[_0xb617('0x16')]['push']({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':'Set','appdata':_0xb617('0x23')+_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId'],'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});if(_0x3a0857['extension']&&_0x3a0857[_0xb617('0x1a')][_0xb617('0xd')](_0xb617('0x24'))&&_0x3a0857[_0xb617('0x1a')][_0xb617('0x24')]!=='none'){_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':_0xb617('0x25'),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857['priority']++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':_0xb617('0x26')+_0x3a0857[_0xb617('0x1a')][_0xb617('0x24')]||_0xb617('0x27'),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});}}_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':'Set','appdata':_0xb617('0x28'),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0]['exten'],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});_0x3a0857[_0xb617('0x16')][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':'Set','appdata':_0xb617('0x29'),'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});_0x3a0857[_0xb617('0x16')]['push']({'type':_0x17fd4f[_0x31808e][0x0]['type'],'app':_0xb617('0x10'),'appdata':'MONITOR_OPTIONS=ab','context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'priority':_0x3a0857[_0xb617('0x18')]++,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId']});for(var _0x44b7c6=0x0,_0x597df0=0x0;_0x44b7c6<_0x17fd4f[_0x31808e][_0xb617('0x2a')];_0x44b7c6+=0x1,_0x597df0=0x0){var _0xcd8a3b=_0x17fd4f[_0x31808e][_0x44b7c6];if(_0xcd8a3b[_0xb617('0xf')]){_0xcd8a3b[_0xb617('0xf')]=_0xcd8a3b['type'][_0xb617('0x2b')]();}var _0x2b0641=[];var _0x60ed1a=[];delete _0xcd8a3b['id'];delete _0xcd8a3b['createdAt'];delete _0xcd8a3b['updatedAt'];var _0x4ec584=_0xcd8a3b[_0xb617('0x2c')]!==_0xb617('0x2d')?[_0xcd8a3b['interval']]:_0xcd8a3b[_0xb617('0x2e')]?_[_0xb617('0x8')](_[_0xb617('0xa')](_0x3a0857[_0xb617('0x2f')],{'IntervalId':_0xcd8a3b[_0xb617('0x2e')]}),'interval'):[];if(_0xcd8a3b[_0xb617('0xd')](_0xb617('0x30'))){if(_0xcd8a3b['tag']&&_0xcd8a3b[_0xb617('0x30')]!=='--'){_0x2b0641['push']({'type':_0xcd8a3b[_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':_0xb617('0x31')+_0xcd8a3b['tag'],'context':_0xcd8a3b[_0xb617('0x13')],'exten':_0xcd8a3b['exten'],'priority':_0x4ec584['length']+_0x3a0857[_0xb617('0x18')]+_0x597df0++,'VoiceExtensionId':_0xcd8a3b['VoiceExtensionId']});}}if(_0xcd8a3b[_0xb617('0xf')]===_0xb617('0x19')&&_0xcd8a3b[_0xb617('0xd')](_0xb617('0x32'))){if(_0xcd8a3b[_0xb617('0x32')]){_0x2b0641[_0xb617('0x1b')]({'type':_0xcd8a3b[_0xb617('0xf')],'app':_0xb617('0x20'),'appdata':_0xb617('0x33')+_0xcd8a3b['callerID']+')','context':_0xcd8a3b[_0xb617('0x13')],'exten':_0xcd8a3b[_0xb617('0xb')],'priority':_0x4ec584[_0xb617('0x2a')]+_0x3a0857[_0xb617('0x18')]+_0x597df0++,'VoiceExtensionId':_0xcd8a3b[_0xb617('0x14')]});}else{_0x2b0641[_0xb617('0x1b')]({'type':_0xcd8a3b[_0xb617('0xf')],'app':'ExecIf','appdata':_0xb617('0x34'),'context':_0xcd8a3b[_0xb617('0x13')],'exten':_0xcd8a3b[_0xb617('0xb')],'priority':_0x4ec584[_0xb617('0x2a')]+_0x3a0857[_0xb617('0x18')]+_0x597df0++,'VoiceExtensionId':_0xcd8a3b[_0xb617('0x14')]});}}if(_0xcd8a3b[_0xb617('0xd')]('answer')){if(_0x2753cf[_0xb617('0x35')](_0xcd8a3b['app'][_0xb617('0x2b')]())>=0x0&&_0xcd8a3b['appType']!==_0xb617('0x36')){if(_0xcd8a3b[_0xb617('0x37')]){_0x2b0641['push']({'type':_0xcd8a3b[_0xb617('0xf')],'app':_0xb617('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xcd8a3b[_0xb617('0x13')],'exten':_0xcd8a3b[_0xb617('0xb')],'priority':_0x4ec584['length']+_0x3a0857['priority']+_0x597df0++,'VoiceExtensionId':_0xcd8a3b[_0xb617('0x14')]});_0x2b0641[_0xb617('0x1b')]({'type':_0xcd8a3b[_0xb617('0xf')],'app':_0xb617('0x10'),'appdata':_0xb617('0x38'),'context':_0xcd8a3b['context'],'exten':_0xcd8a3b[_0xb617('0xb')],'priority':_0x4ec584['length']+_0x3a0857[_0xb617('0x18')]+_0x597df0++,'VoiceExtensionId':_0xcd8a3b['VoiceExtensionId']});}else{_0x2b0641[_0xb617('0x1b')]({'type':_0xcd8a3b[_0xb617('0xf')],'app':'ExecIf','appdata':_0xb617('0x39'),'context':_0xcd8a3b['context'],'exten':_0xcd8a3b['exten'],'priority':_0x4ec584[_0xb617('0x2a')]+_0x3a0857[_0xb617('0x18')]+_0x597df0++,'VoiceExtensionId':_0xcd8a3b['VoiceExtensionId']});_0x2b0641[_0xb617('0x1b')]({'type':_0xcd8a3b['type'],'app':_0xb617('0x10'),'appdata':_0xb617('0x3a'),'context':_0xcd8a3b[_0xb617('0x13')],'exten':_0xcd8a3b[_0xb617('0xb')],'priority':_0x4ec584[_0xb617('0x2a')]+_0x3a0857['priority']+_0x597df0++,'VoiceExtensionId':_0xcd8a3b[_0xb617('0x14')]});}}}for(var _0x24c9b7=0x0;_0x24c9b7<_0x4ec584[_0xb617('0x2a')];_0x24c9b7+=0x1){var _0x253ab0=_0x3a0857['priority']+_0x4ec584['length'];var _0x2804e4=_0x24c9b7===_0x4ec584[_0xb617('0x2a')]-0x1?_0x3a0857['priority']+_0x2b0641[_0xb617('0x2a')]+_0x60ed1a[_0xb617('0x2a')]+0x2:_0x3a0857['priority']+_0x24c9b7+0x1;_0x2b0641['splice'](_0x24c9b7,0x0,{'type':_0xcd8a3b[_0xb617('0xf')],'app':_0xb617('0x3b'),'appdata':_0x4ec584[_0x24c9b7]+'?'+_0xcd8a3b[_0xb617('0x13')]+_0xb617('0x3c')+_0x253ab0+':'+_0xcd8a3b['context']+_0xb617('0x3c')+_0x2804e4,'exten':_0xcd8a3b['exten'],'context':_0xcd8a3b[_0xb617('0x13')],'priority':_0x3a0857[_0xb617('0x18')]+_0x24c9b7,'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});}_0xcd8a3b['priority']=_0x2b0641['length']?_['last'](_0x2b0641)[_0xb617('0x18')]+0x1:_0x3a0857[_0xb617('0x18')];_0x3a0857[_0xb617('0x18')]=(_0x60ed1a[_0xb617('0x2a')]?_['last'](_0x60ed1a)[_0xb617('0x18')]:_0xcd8a3b[_0xb617('0x18')])+0x1;_0x3a0857['extensions']=_[_0xb617('0x3d')](_0x3a0857[_0xb617('0x16')],_0x2b0641,[_0xcd8a3b],_0x60ed1a);}_0x3a0857['extensions'][_0xb617('0x1b')]({'type':_0x17fd4f[_0x31808e][0x0][_0xb617('0xf')],'app':_0xb617('0x3e'),'exten':_0x17fd4f[_0x31808e][0x0][_0xb617('0xb')],'context':_0x17fd4f[_0x31808e][0x0][_0xb617('0x13')],'priority':_0x3a0857[_0xb617('0x18')],'VoiceExtensionId':_0x17fd4f[_0x31808e][0x0][_0xb617('0x14')]});_0x23cf54['push'](_0x17fd4f[_0x31808e][0x0]['VoiceExtensionId']);_0x5e1fd0=_['concat'](_0x5e1fd0,_0x3a0857[_0xb617('0x16')]);}}return _0x52af14['transaction'](function(_0xd79af1){return _0x52af14[_0xb617('0x2')][_0xb617('0x6')][_0xb617('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x23cf54}},'transaction':_0xd79af1})[_0xb617('0x5')](function(_0x2a91ed){return _0x52af14[_0xb617('0x2')][_0xb617('0x6')][_0xb617('0x40')](_[_0xb617('0x41')](_0x5e1fd0,_0xb617('0x18')),{'transaction':_0xd79af1});});});})[_0xb617('0x42')](function(_0x33a44d){console[_0xb617('0x43')](_0x33a44d);});}exports[_0xb617('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 01ff136..41e5a81 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 _0x02df=['Lists','CampaignId','get','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','emit','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','inspect','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','insert','str','calleridnum','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','all','CmList','Campaign'];(function(_0x16c707,_0x178483){var _0x15d6e0=function(_0x54b147){while(--_0x54b147){_0x16c707['push'](_0x16c707['shift']());}};_0x15d6e0(++_0x178483);}(_0x02df,0x1b1));var _0xf02d=function(_0x7611d6,_0x235fa7){_0x7611d6=_0x7611d6-0x0;var _0x9a2245=_0x02df[_0x7611d6];return _0x9a2245;};'use strict';var BPromise=require(_0xf02d('0x0'));var util=require('util');var _=require(_0xf02d('0x1'));var fs=require('fs');var squel=require(_0xf02d('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xf02d('0x3'))['db'];var config=require(_0xf02d('0x4'));var logger=require('../../../config/logger')(_0xf02d('0x5'));config[_0xf02d('0x6')]=_[_0xf02d('0x7')](config[_0xf02d('0x6')],{'host':_0xf02d('0x8'),'port':0x18eb});var socket=require(_0xf02d('0x9'))(new Redis(config[_0xf02d('0x6')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0xf02d('0xa')][0x2]||process[_0xf02d('0xa')][0x2]===_0xf02d('0xb')||process[_0xf02d('0xa')][0x2]===_0xf02d('0xc')){throw new Error(_0xf02d('0xd'));}var FILEPATH=process[_0xf02d('0xa')][0x2];if(!process[_0xf02d('0xa')][0x3]||process[_0xf02d('0xa')][0x3]===_0xf02d('0xb')||process[_0xf02d('0xa')][0x3]===_0xf02d('0xc')||!process['argv'][0x4]||process[_0xf02d('0xa')][0x4]==='undefined'||process[_0xf02d('0xa')][0x4]===_0xf02d('0xc')){throw new Error(_0xf02d('0xe'));}var FIELDS=_[_0xf02d('0xf')](process['argv'][0x3]['split'](','),process['argv'][0x4][_0xf02d('0x10')](','));if(!process['argv'][0x5]||process[_0xf02d('0xa')][0x5]==='undefined'||process[_0xf02d('0xa')][0x5]===_0xf02d('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xf02d('0xa')][0x6]&&process[_0xf02d('0xa')][0x6]!=='undefined'&&process[_0xf02d('0xa')][0x6]!=='null'?process[_0xf02d('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xf02d('0xa')][0x7]!==_0xf02d('0xb')&&process['argv'][0x7]!==_0xf02d('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xf02d('0xa')][0x8]===_0xf02d('0xb')||process[_0xf02d('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x55db73){logger[_0xf02d('0x11')](_0x55db73);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(_0x8fe289,_0x260161,_0x1ba2de,_0x161321){var _0x48665e={'message':_0x260161};_0x48665e[_0x8fe289]=!![];if(_0x1ba2de){_0x48665e[_0xf02d('0x12')]=_0x1ba2de;}if(_0x161321){_0x48665e['index']=_0x161321;}return _0x48665e;}function isEmail(_0xc6031f){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))*$/[_0xf02d('0x13')](_0xc6031f);}function checkRow(_0x103d8d,_0x29558d,_0x5b8230){return new BPromise(function(_0x1ee33b,_0x40a4b8){if(_[_0xf02d('0x14')](_0x103d8d)){return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),_0xf02d('0x15'),null,_0x5b8230));}if(_0x103d8d[_0xf02d('0x16')]&&_0x103d8d['errors'][_0xf02d('0x17')]){var _0x475831=_[_0xf02d('0x18')](_0x103d8d[_0xf02d('0x16')],'message')[_0xf02d('0x19')](';');return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),_0x475831,null,_0x5b8230));}var _0x14f7e3={};for(var _0x49e0ab in FIELDS){if(FIELDS['hasOwnProperty'](_0x49e0ab)&&FIELDS[_0x49e0ab]){_0x14f7e3[_0x49e0ab]=_0x103d8d[_0xf02d('0x1a')][0x0][FIELDS[_0x49e0ab]]||_0x103d8d[_0xf02d('0x1a')][0x0]['\ufeff'+FIELDS[_0x49e0ab]];}}if(!_0x14f7e3[_0xf02d('0x1b')]){return _0x40a4b8(handleCheckRowError('error',_0xf02d('0x1c'),null,_0x5b8230));}if(!_0x14f7e3['phone']){return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),_0xf02d('0x1d'),null,_0x5b8230));}if(_0x14f7e3['birthDate']){var _0x4b58bf=moment(_0x14f7e3['birthDate'],'YYYY-MM-DD');if(!_0x4b58bf['isValid']()){return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5b8230));}}if(_0x14f7e3[_0xf02d('0x1e')]){if(!isEmail(_0x14f7e3[_0xf02d('0x1e')])){return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),_0xf02d('0x1f'),null,_0x5b8230));}}_0x14f7e3[_0xf02d('0x20')]=LISTID;_0x14f7e3[_0xf02d('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x29558d){var _0x5993c6={};for(var _0x5da0e4=0x0,_0x27b402=DUPLICATES['length'];_0x5da0e4<_0x27b402;_0x5da0e4+=0x1){_0x5993c6[DUPLICATES[_0x5da0e4]]=_0x14f7e3[DUPLICATES[_0x5da0e4]];}var _0x4bd52c=_['find'](_0x29558d,_0x5993c6);if(_0x4bd52c){return _0x40a4b8(handleCheckRowError(_0xf02d('0x22'),_0xf02d('0x23'),_0x4bd52c,_0x5b8230));}}return db[_0xf02d('0x24')][_0xf02d('0x25')](_0x14f7e3,{'raw':!![],'hooks':![],'fields':_[_0xf02d('0x26')](_0x14f7e3)})[_0xf02d('0x27')](function(_0x5aac39){if(DUPLICATES&&DUPLICATES[_0xf02d('0x17')]&&_0x29558d){_0x29558d[_0xf02d('0x28')](_[_0xf02d('0x29')](_0x14f7e3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5aac39['id'];return _0x1ee33b();})[_0xf02d('0x2a')](function(_0x3b7fb9){return _0x40a4b8(handleCheckRowError(_0xf02d('0x11'),_0xf02d('0x2b')+(_0x3b7fb9[_0xf02d('0x2c')]||JSON['stringify'](_0x3b7fb9)),null,_0x5b8230));});});}function checkHopper(){function _0x486d61(){return function(_0x271f28){logger['error'](_0xf02d('0x2d'),'checkHopper',util[_0xf02d('0x2e')](_0x271f28,{'showHidden':![],'depth':null}));};}var _0x2a6327=function(_0x7e6e0f,_0x2cc823){var _0x48f1ec=squel['insert']()[_0xf02d('0x2f')](_0xf02d('0x30'))[_0xf02d('0x31')]([_0xf02d('0x32'),_0xf02d('0x33'),_0xf02d('0x34'),'ListId',_0x2cc823,_0xf02d('0x35'),_0xf02d('0x36')],squel['select']()['field'](_0xf02d('0x32'),'phone')[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x33'))[_0xf02d('0x37')]('id',_0xf02d('0x34'))[_0xf02d('0x37')](LISTID[_0xf02d('0x39')](),'ListId')[_0xf02d('0x37')](_0x7e6e0f['id'][_0xf02d('0x39')](),_0x2cc823)[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x35'))[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x36'))[_0xf02d('0x3a')](_0xf02d('0x3b'))[_0xf02d('0x3c')](_0xf02d('0x3d'))[_0xf02d('0x3c')](_0xf02d('0x3e'),LISTID['toString']())[_0xf02d('0x3c')](_0xf02d('0x3f'))[_0xf02d('0x3c')](_0xf02d('0x40'),squel[_0xf02d('0x41')]()['field'](_0xf02d('0x32'))[_0xf02d('0x3a')](_0xf02d('0x30'))[_0xf02d('0x3c')](_0x2cc823+_0xf02d('0x42'),_0x7e6e0f['id'][_0xf02d('0x39')]())))['toString']();return _0x48f1ec;};var _0x53058a=function(_0xe2c2ab,_0x2d25e7){var _0xf2fc1e=squel[_0xf02d('0x43')]()['into'](_0xf02d('0x30'))[_0xf02d('0x31')]([_0xf02d('0x32'),_0xf02d('0x33'),_0xf02d('0x34'),_0xf02d('0x20'),_0x2d25e7,_0xf02d('0x35'),'updatedAt'],squel['select']()['field'](_0xf02d('0x32'),_0xf02d('0x32'))[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x33'))[_0xf02d('0x37')]('id',_0xf02d('0x34'))['field'](LISTID[_0xf02d('0x39')](),'ListId')[_0xf02d('0x37')](_0xe2c2ab['id'][_0xf02d('0x39')](),_0x2d25e7)[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x35'))['field'](_0xf02d('0x38'),'updatedAt')['from'](_0xf02d('0x3b'))['where']('deletedAt\x20IS\x20NULL')[_0xf02d('0x3c')](_0xf02d('0x3e'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0xf02d('0x44')](hopperContacts))[_0xf02d('0x3c')](_0xf02d('0x3f'))[_0xf02d('0x3c')](_0xf02d('0x40'),squel[_0xf02d('0x41')]()['field'](_0xf02d('0x45'))[_0xf02d('0x3a')]('cm_hopper_final')[_0xf02d('0x3c')](_0x2d25e7+_0xf02d('0x42'),_0xe2c2ab['id'][_0xf02d('0x39')]()))[_0xf02d('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf02d('0x37')](_0xf02d('0x32'))['from'](_0xf02d('0x30'))[_0xf02d('0x3c')](_0x2d25e7+_0xf02d('0x42'),_0xe2c2ab['id'][_0xf02d('0x39')]())))[_0xf02d('0x39')]();return _0xf2fc1e;};function _0x2c3f6d(_0xf2c794,_0xac8f34){var _0x240eac=squel[_0xf02d('0x43')]()[_0xf02d('0x2f')](_0xf02d('0x30'))[_0xf02d('0x31')]([_0xf02d('0x32'),_0xf02d('0x33'),'ContactId','ListId',_0xac8f34,_0xf02d('0x35'),_0xf02d('0x36')],squel[_0xf02d('0x41')]()[_0xf02d('0x37')](_0xf02d('0x32'),_0xf02d('0x32'))['field']('NOW()',_0xf02d('0x33'))['field']('id','ContactId')['field'](LISTID[_0xf02d('0x39')](),_0xf02d('0x20'))[_0xf02d('0x37')](_0xf2c794['id'][_0xf02d('0x39')](),_0xac8f34)[_0xf02d('0x37')](_0xf02d('0x38'),_0xf02d('0x35'))[_0xf02d('0x37')]('NOW()','updatedAt')[_0xf02d('0x3a')](_0xf02d('0x3b'))['where']('deletedAt\x20IS\x20NULL')[_0xf02d('0x3c')]('ListId\x20=\x20?',LISTID[_0xf02d('0x39')]())[_0xf02d('0x3c')](_0xf02d('0x46'),squel[_0xf02d('0x44')](hopperContacts))[_0xf02d('0x3c')](_0xf02d('0x3f')))[_0xf02d('0x39')]();return _0x240eac;}function _0x2622c4(_0xa0e5f,_0x4dcd45){var _0x4c3064=squel[_0xf02d('0x43')]()['into']('cm_hopper_black')[_0xf02d('0x31')]([_0xf02d('0x32'),_0xf02d('0x34'),_0xf02d('0x20'),_0x4dcd45,_0xf02d('0x35'),_0xf02d('0x36')],squel[_0xf02d('0x41')]()['field'](_0xf02d('0x32'),_0xf02d('0x32'))['field']('id',_0xf02d('0x34'))[_0xf02d('0x37')](LISTID[_0xf02d('0x39')](),_0xf02d('0x20'))[_0xf02d('0x37')](_0xa0e5f['id'][_0xf02d('0x39')](),_0x4dcd45)[_0xf02d('0x37')]('NOW()',_0xf02d('0x35'))[_0xf02d('0x37')](_0xf02d('0x38'),'updatedAt')[_0xf02d('0x3a')](_0xf02d('0x3b'))[_0xf02d('0x3c')]('deletedAt\x20IS\x20NULL')[_0xf02d('0x3c')](_0xf02d('0x3e'),LISTID['toString']())[_0xf02d('0x3c')](_0xf02d('0x46'),squel[_0xf02d('0x44')](hopperContacts))[_0xf02d('0x3c')](_0xf02d('0x3f')))[_0xf02d('0x39')]();return _0x4c3064;}return db[_0xf02d('0x47')][_0xf02d('0x48')]({'where':{'type':_0xf02d('0x49')},'attributes':['id',_0xf02d('0x4a')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x5db144){var _0x169bd0=[];if(_0x5db144){var _0x157f88;for(var _0x5ae487=0x0,_0x3f8413;_0x5ae487<_0x5db144['length'];_0x5ae487+=0x1){_0x3f8413=_0x5db144[_0x5ae487]['get']({'plain':!![]});switch(_0x3f8413['dialCheckDuplicateType']){case _0xf02d('0x4b'):_0x169bd0[_0xf02d('0x28')](db[_0xf02d('0x4c')][_0xf02d('0x4d')](_0x53058a(_0x3f8413,_0xf02d('0x4e')))[_0xf02d('0x27')](function(){})[_0xf02d('0x2a')](_0x486d61()));break;case'onlyIfOpen':_0x169bd0[_0xf02d('0x28')](db[_0xf02d('0x4c')][_0xf02d('0x4d')](_0x2a6327(_0x3f8413,_0xf02d('0x4e')))[_0xf02d('0x27')](function(){})[_0xf02d('0x2a')](_0x486d61()));break;default:_0x169bd0[_0xf02d('0x28')](db[_0xf02d('0x4c')]['query'](_0x2c3f6d(_0x3f8413,_0xf02d('0x4e')))[_0xf02d('0x27')](function(){})[_0xf02d('0x2a')](_0x486d61()));}}}return _0x169bd0;})[_0xf02d('0x4f')]()[_0xf02d('0x27')](function(){return db[_0xf02d('0x47')]['findAll']({'where':{'type':_0xf02d('0x49')},'attributes':['id'],'include':[{'model':db[_0xf02d('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf02d('0x27')](function(_0x16fa2a){var _0x1293f6=[];if(_0x16fa2a){var _0x579322;for(var _0x1c0d54=0x0,_0x5dda34;_0x1c0d54<_0x16fa2a['length'];_0x1c0d54+=0x1){_0x5dda34=_0x16fa2a[_0x1c0d54]['get']({'plain':!![]});_0x1293f6[_0xf02d('0x28')](db[_0xf02d('0x4c')][_0xf02d('0x4d')](_0x2622c4(_0x5dda34,_0xf02d('0x4e')))['then'](function(){})[_0xf02d('0x2a')](_0x486d61()));}}return _0x1293f6;})[_0xf02d('0x4f')]();})[_0xf02d('0x27')](function(){return db[_0xf02d('0x51')][_0xf02d('0x48')]({'attributes':['id',_0xf02d('0x4a')],'include':[{'model':db[_0xf02d('0x50')],'as':_0xf02d('0x52'),'where':{'id':LISTID}}]})[_0xf02d('0x27')](function(_0x1963ee){var _0x17e201=[];if(_0x1963ee){for(var _0x31b46e=0x0,_0x48aebb;_0x31b46e<_0x1963ee['length'];_0x31b46e+=0x1){_0x48aebb=_0x1963ee[_0x31b46e]['get']({'plain':!![]});switch(_0x48aebb[_0xf02d('0x4a')]){case _0xf02d('0x4b'):_0x17e201['push'](db[_0xf02d('0x4c')][_0xf02d('0x4d')](_0x53058a(_0x48aebb,_0xf02d('0x53')))[_0xf02d('0x27')](function(){})['catch'](_0x486d61()));break;case'onlyIfOpen':_0x17e201['push'](db[_0xf02d('0x4c')]['query'](_0x2a6327(_0x48aebb,_0xf02d('0x53')))[_0xf02d('0x27')](function(){})[_0xf02d('0x2a')](_0x486d61()));break;default:_0x17e201['push'](db[_0xf02d('0x4c')]['query'](_0x2c3f6d(_0x48aebb,_0xf02d('0x53')))['then'](function(){})['catch'](_0x486d61()));}}}return _0x17e201;})['all']();})[_0xf02d('0x27')](function(){return db[_0xf02d('0x51')][_0xf02d('0x48')]({'attributes':['id'],'include':[{'model':db[_0xf02d('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf02d('0x27')](function(_0x2c3de8){var _0x475c26=[];if(_0x2c3de8){for(var _0x3cf709=0x0,_0x5a1841;_0x3cf709<_0x2c3de8['length'];_0x3cf709+=0x1){_0x5a1841=_0x2c3de8[_0x3cf709][_0xf02d('0x54')]({'plain':!![]});_0x475c26[_0xf02d('0x28')](db[_0xf02d('0x4c')]['query'](_0x2622c4(_0x5a1841,'CampaignId'))['then'](function(){})[_0xf02d('0x2a')](_0x486d61()));}}return _0x475c26;})[_0xf02d('0x4f')]();})[_0xf02d('0x2a')](function(_0x2136e4){logger[_0xf02d('0x11')](_0xf02d('0x55'),_0xf02d('0x56'),_0x2136e4[_0xf02d('0x2c')]);});}var processPromises=function(_0x4e823e){return BPromise[_0xf02d('0x4f')](promises)[_0xf02d('0x27')](function(_0x25faa3){})['catch'](function(_0x3b6df2){logger[_0xf02d('0x11')]('Error\x20processing\x20rows\x20block:',JSON[_0xf02d('0x57')](_0x3b6df2));})[_0xf02d('0x58')](function(){socket[_0xf02d('0x59')](_0xf02d('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4e823e){return _0x4e823e['resume']();}});};var endCsv=function(){return BPromise[_0xf02d('0x5b')]()[_0xf02d('0x27')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xf02d('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xf02d('0x5c')](FILEPATH);}catch(_0x19a9dd){logger[_0xf02d('0x11')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x19a9dd));}finally{process[_0xf02d('0x5d')](0x0);}});};process['on'](_0xf02d('0x5e'),function(){logger[_0xf02d('0x5f')](_0xf02d('0x60'));endCsv();});function main(){return BPromise['resolve']()[_0xf02d('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xf02d('0x24')][_0xf02d('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xf02d('0x27')](function(_0x42fd8e){var _0x2094b8=fs[_0xf02d('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xf02d('0x62')](_0x2094b8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x345077,_0xcfeb99){total+=0x1;var _0x142c34=total;promises['push'](checkRow(_0x345077,_0x42fd8e,_0x142c34)['then'](function(){success+=0x1;})['catch'](function(_0xe8764a){if(_0xe8764a[_0xf02d('0x11')]){errors+=0x1;delete _0xe8764a['error'];}else if(_0xe8764a[_0xf02d('0x22')]){duplicates+=0x1;delete _0xe8764a['duplicate'];}rows['push'](_0xe8764a);}));if(total%0xc8===0x0){_0xcfeb99[_0xf02d('0x63')]();return processPromises(_0xcfeb99);}},'complete':function(){return processPromises()[_0xf02d('0x27')](function(){logger[_0xf02d('0x5f')](_0xf02d('0x64'));endCsv();});},'error':function(_0xbf77c3,_0x4ec71d){logger[_0xf02d('0x5f')](_0xf02d('0x65'),JSON[_0xf02d('0x57')](_0xbf77c3));endCsv();}});})[_0xf02d('0x2a')](function(_0x273c11){logger[_0xf02d('0x11')](_0xf02d('0x66'),JSON[_0xf02d('0x57')](_0x273c11));});}main(); \ No newline at end of file +var _0x811b=['VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','catch','onlyIfOpen','sequelize','VoiceQueueId','all','findAll','Campaign','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','createReadStream','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','phone','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x811b,0x1d0));var _0xb811=function(_0x10bd3d,_0x478dfb){_0x10bd3d=_0x10bd3d-0x0;var _0x48d6fd=_0x811b[_0x10bd3d];return _0x48d6fd;};'use strict';var BPromise=require(_0xb811('0x0'));var util=require(_0xb811('0x1'));var _=require(_0xb811('0x2'));var fs=require('fs');var squel=require(_0xb811('0x3'));var Papa=require(_0xb811('0x4'));var Redis=require(_0xb811('0x5'));var db=require(_0xb811('0x6'))['db'];var config=require(_0xb811('0x7'));var logger=require(_0xb811('0x8'))(_0xb811('0x9'));config[_0xb811('0xa')]=_[_0xb811('0xb')](config[_0xb811('0xa')],{'host':_0xb811('0xc'),'port':0x18eb});var socket=require(_0xb811('0xd'))(new Redis(config['redis']));require(_0xb811('0xe'))['register'](socket);try{if(!process['argv'][0x2]||process[_0xb811('0xf')][0x2]==='undefined'||process[_0xb811('0xf')][0x2]==='null'){throw new Error(_0xb811('0x10'));}var FILEPATH=process[_0xb811('0xf')][0x2];if(!process[_0xb811('0xf')][0x3]||process[_0xb811('0xf')][0x3]===_0xb811('0x11')||process[_0xb811('0xf')][0x3]===_0xb811('0x12')||!process[_0xb811('0xf')][0x4]||process['argv'][0x4]===_0xb811('0x11')||process[_0xb811('0xf')][0x4]==='null'){throw new Error(_0xb811('0x13'));}var FIELDS=_[_0xb811('0x14')](process[_0xb811('0xf')][0x3][_0xb811('0x15')](','),process[_0xb811('0xf')][0x4]['split'](','));if(!process[_0xb811('0xf')][0x5]||process['argv'][0x5]===_0xb811('0x11')||process[_0xb811('0xf')][0x5]===_0xb811('0x12')){throw new Error(_0xb811('0x16'));}var LISTID=process[_0xb811('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xb811('0xf')][0x6]!==_0xb811('0x11')&&process[_0xb811('0xf')][0x6]!==_0xb811('0x12')?process['argv'][0x6]:null;var DUPLICATES=process[_0xb811('0xf')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xb811('0xf')][0x7]!==_0xb811('0x12')?process[_0xb811('0xf')][0x7]:null;if(!process[_0xb811('0xf')][0x8]||process[_0xb811('0xf')][0x8]===_0xb811('0x11')||process[_0xb811('0xf')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xb811('0xf')][0x8];}catch(_0x5c60a7){logger[_0xb811('0x17')](_0x5c60a7);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(_0x95a1d6,_0x5545fe,_0x969259,_0x384465){var _0x2c0f5a={'message':_0x5545fe};_0x2c0f5a[_0x95a1d6]=!![];if(_0x969259){_0x2c0f5a[_0xb811('0x18')]=_0x969259;}if(_0x384465){_0x2c0f5a[_0xb811('0x19')]=_0x384465;}return _0x2c0f5a;}function isEmail(_0x2ef199){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'](_0x2ef199);}function checkRow(_0x5db2f7,_0x3d87a0,_0x5376bd){return new BPromise(function(_0x180de2,_0x29817e){if(_['isNil'](_0x5db2f7)){return _0x29817e(handleCheckRowError(_0xb811('0x17'),_0xb811('0x1a'),null,_0x5376bd));}if(_0x5db2f7['errors']&&_0x5db2f7[_0xb811('0x1b')][_0xb811('0x1c')]){var _0x4a3fed=_['map'](_0x5db2f7[_0xb811('0x1b')],_0xb811('0x1d'))[_0xb811('0x1e')](';');return _0x29817e(handleCheckRowError(_0xb811('0x17'),_0x4a3fed,null,_0x5376bd));}var _0x5708fd={};for(var _0x5c9117 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5c9117)&&FIELDS[_0x5c9117]){_0x5708fd[_0x5c9117]=_0x5db2f7[_0xb811('0x1f')][0x0][FIELDS[_0x5c9117]]||_0x5db2f7[_0xb811('0x1f')][0x0]['\ufeff'+FIELDS[_0x5c9117]];}}if(!_0x5708fd[_0xb811('0x20')]){return _0x29817e(handleCheckRowError(_0xb811('0x17'),'firstName\x20not\x20specified!',null,_0x5376bd));}if(!_0x5708fd['phone']){return _0x29817e(handleCheckRowError('error',_0xb811('0x21'),null,_0x5376bd));}if(_0x5708fd[_0xb811('0x22')]){var _0x4e0af2=moment(_0x5708fd[_0xb811('0x22')],_0xb811('0x23'));if(!_0x4e0af2[_0xb811('0x24')]()){return _0x29817e(handleCheckRowError(_0xb811('0x17'),_0xb811('0x25'),null,_0x5376bd));}}if(_0x5708fd[_0xb811('0x26')]){if(!isEmail(_0x5708fd['email'])){return _0x29817e(handleCheckRowError('error',_0xb811('0x27'),null,_0x5376bd));}}_0x5708fd[_0xb811('0x28')]=LISTID;_0x5708fd[_0xb811('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb811('0x1c')]&&_0x3d87a0){var _0x5400b4={};for(var _0x495ba6=0x0,_0x2b261c=DUPLICATES['length'];_0x495ba6<_0x2b261c;_0x495ba6+=0x1){_0x5400b4[DUPLICATES[_0x495ba6]]=_0x5708fd[DUPLICATES[_0x495ba6]];}var _0x22bc47=_[_0xb811('0x2a')](_0x3d87a0,_0x5400b4);if(_0x22bc47){return _0x29817e(handleCheckRowError(_0xb811('0x2b'),_0xb811('0x2c'),_0x22bc47,_0x5376bd));}}return db[_0xb811('0x2d')][_0xb811('0x2e')](_0x5708fd,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5708fd)})[_0xb811('0x2f')](function(_0x38b3f1){if(DUPLICATES&&DUPLICATES['length']&&_0x3d87a0){_0x3d87a0[_0xb811('0x30')](_[_0xb811('0x31')](_0x5708fd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x38b3f1['id'];return _0x180de2();})['catch'](function(_0x550991){return _0x29817e(handleCheckRowError(_0xb811('0x17'),_0xb811('0x32')+(_0x550991[_0xb811('0x1d')]||JSON['stringify'](_0x550991)),null,_0x5376bd));});});}function checkHopper(){function _0x13e779(){return function(_0x3f4b2){logger[_0xb811('0x17')](_0xb811('0x33'),'checkHopper',util[_0xb811('0x34')](_0x3f4b2,{'showHidden':![],'depth':null}));};}var _0x432255=function(_0x335e,_0x1e6c58){var _0x182af5=squel[_0xb811('0x35')]()[_0xb811('0x36')](_0xb811('0x37'))[_0xb811('0x38')](['phone',_0xb811('0x39'),_0xb811('0x3a'),'ListId',_0x1e6c58,_0xb811('0x3b'),_0xb811('0x3c')],squel['select']()[_0xb811('0x3d')](_0xb811('0x3e'),_0xb811('0x3e'))[_0xb811('0x3d')](_0xb811('0x3f'),'scheduledAt')[_0xb811('0x3d')]('id',_0xb811('0x3a'))[_0xb811('0x3d')](LISTID[_0xb811('0x40')](),'ListId')[_0xb811('0x3d')](_0x335e['id'][_0xb811('0x40')](),_0x1e6c58)[_0xb811('0x3d')](_0xb811('0x3f'),_0xb811('0x3b'))[_0xb811('0x3d')](_0xb811('0x3f'),'updatedAt')[_0xb811('0x41')](_0xb811('0x42'))[_0xb811('0x43')](_0xb811('0x44'))[_0xb811('0x43')]('ListId\x20=\x20?',LISTID['toString']())[_0xb811('0x43')](_0xb811('0x45'))[_0xb811('0x43')](_0xb811('0x46'),squel[_0xb811('0x47')]()[_0xb811('0x3d')](_0xb811('0x3e'))['from'](_0xb811('0x37'))[_0xb811('0x43')](_0x1e6c58+_0xb811('0x48'),_0x335e['id'][_0xb811('0x40')]())))[_0xb811('0x40')]();return _0x182af5;};var _0x6a23a9=function(_0x252a0a,_0x202d6b){var _0x24ed8d=squel['insert']()[_0xb811('0x36')](_0xb811('0x37'))[_0xb811('0x38')]([_0xb811('0x3e'),'scheduledAt','ContactId',_0xb811('0x28'),_0x202d6b,_0xb811('0x3b'),'updatedAt'],squel[_0xb811('0x47')]()[_0xb811('0x3d')](_0xb811('0x3e'),_0xb811('0x3e'))[_0xb811('0x3d')](_0xb811('0x3f'),_0xb811('0x39'))[_0xb811('0x3d')]('id',_0xb811('0x3a'))[_0xb811('0x3d')](LISTID['toString'](),'ListId')[_0xb811('0x3d')](_0x252a0a['id'][_0xb811('0x40')](),_0x202d6b)[_0xb811('0x3d')](_0xb811('0x3f'),_0xb811('0x3b'))[_0xb811('0x3d')](_0xb811('0x3f'),_0xb811('0x3c'))[_0xb811('0x41')](_0xb811('0x42'))[_0xb811('0x43')]('deletedAt\x20IS\x20NULL')[_0xb811('0x43')](_0xb811('0x49'),LISTID[_0xb811('0x40')]())[_0xb811('0x43')](_0xb811('0x4a'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xb811('0x43')](_0xb811('0x46'),squel[_0xb811('0x47')]()[_0xb811('0x3d')]('calleridnum')[_0xb811('0x41')]('cm_hopper_final')[_0xb811('0x43')](_0x202d6b+'\x20=\x20?',_0x252a0a['id'][_0xb811('0x40')]()))[_0xb811('0x43')](_0xb811('0x46'),squel['select']()[_0xb811('0x3d')]('phone')[_0xb811('0x41')](_0xb811('0x37'))['where'](_0x202d6b+'\x20=\x20?',_0x252a0a['id']['toString']())))[_0xb811('0x40')]();return _0x24ed8d;};function _0x11cda6(_0x3f6123,_0x3b684e){var _0xe64781=squel[_0xb811('0x35')]()[_0xb811('0x36')]('cm_hopper')[_0xb811('0x38')]([_0xb811('0x3e'),_0xb811('0x39'),_0xb811('0x3a'),_0xb811('0x28'),_0x3b684e,'createdAt',_0xb811('0x3c')],squel[_0xb811('0x47')]()[_0xb811('0x3d')](_0xb811('0x3e'),_0xb811('0x3e'))['field'](_0xb811('0x3f'),'scheduledAt')[_0xb811('0x3d')]('id',_0xb811('0x3a'))[_0xb811('0x3d')](LISTID[_0xb811('0x40')](),_0xb811('0x28'))['field'](_0x3f6123['id']['toString'](),_0x3b684e)[_0xb811('0x3d')](_0xb811('0x3f'),_0xb811('0x3b'))['field'](_0xb811('0x3f'),_0xb811('0x3c'))[_0xb811('0x41')](_0xb811('0x42'))['where'](_0xb811('0x44'))[_0xb811('0x43')](_0xb811('0x49'),LISTID[_0xb811('0x40')]())[_0xb811('0x43')](_0xb811('0x4a'),squel['str'](hopperContacts))[_0xb811('0x43')](_0xb811('0x45')))[_0xb811('0x40')]();return _0xe64781;}function _0x35c0a0(_0x201900,_0x537f5a){var _0x288db0=squel[_0xb811('0x35')]()[_0xb811('0x36')]('cm_hopper_black')[_0xb811('0x38')](['phone',_0xb811('0x3a'),_0xb811('0x28'),_0x537f5a,_0xb811('0x3b'),_0xb811('0x3c')],squel[_0xb811('0x47')]()[_0xb811('0x3d')]('phone',_0xb811('0x3e'))[_0xb811('0x3d')]('id',_0xb811('0x3a'))[_0xb811('0x3d')](LISTID[_0xb811('0x40')](),_0xb811('0x28'))[_0xb811('0x3d')](_0x201900['id']['toString'](),_0x537f5a)['field']('NOW()','createdAt')['field']('NOW()',_0xb811('0x3c'))[_0xb811('0x41')](_0xb811('0x42'))[_0xb811('0x43')](_0xb811('0x44'))[_0xb811('0x43')](_0xb811('0x49'),LISTID[_0xb811('0x40')]())[_0xb811('0x43')]('id\x20IN\x20?',squel[_0xb811('0x4b')](hopperContacts))['where'](_0xb811('0x45')))[_0xb811('0x40')]();return _0x288db0;}return db[_0xb811('0x4c')]['findAll']({'where':{'type':_0xb811('0x4d')},'attributes':['id',_0xb811('0x4e')],'include':[{'model':db[_0xb811('0x4f')],'as':_0xb811('0x50'),'where':{'id':LISTID}}]})[_0xb811('0x2f')](function(_0xd2ecea){var _0x132d73=[];if(_0xd2ecea){var _0x3c2498;for(var _0x4fccdd=0x0,_0x143745;_0x4fccdd<_0xd2ecea[_0xb811('0x1c')];_0x4fccdd+=0x1){_0x143745=_0xd2ecea[_0x4fccdd][_0xb811('0x51')]({'plain':!![]});switch(_0x143745[_0xb811('0x4e')]){case _0xb811('0x52'):_0x132d73[_0xb811('0x30')](db['sequelize'][_0xb811('0x53')](_0x6a23a9(_0x143745,'VoiceQueueId'))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));break;case _0xb811('0x55'):_0x132d73['push'](db[_0xb811('0x56')]['query'](_0x432255(_0x143745,'VoiceQueueId'))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));break;default:_0x132d73[_0xb811('0x30')](db[_0xb811('0x56')]['query'](_0x11cda6(_0x143745,_0xb811('0x57')))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));}}}return _0x132d73;})[_0xb811('0x58')]()[_0xb811('0x2f')](function(){return db[_0xb811('0x4c')][_0xb811('0x59')]({'where':{'type':_0xb811('0x4d')},'attributes':['id'],'include':[{'model':db[_0xb811('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xb811('0x2f')](function(_0x268194){var _0x2db990=[];if(_0x268194){var _0x1a44fa;for(var _0x46d73c=0x0,_0x5cb3d5;_0x46d73c<_0x268194[_0xb811('0x1c')];_0x46d73c+=0x1){_0x5cb3d5=_0x268194[_0x46d73c]['get']({'plain':!![]});_0x2db990[_0xb811('0x30')](db[_0xb811('0x56')]['query'](_0x35c0a0(_0x5cb3d5,_0xb811('0x57')))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));}}return _0x2db990;})['all']();})[_0xb811('0x2f')](function(){return db[_0xb811('0x5a')]['findAll']({'attributes':['id',_0xb811('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xb811('0x2f')](function(_0x28aeda){var _0x4005b4=[];if(_0x28aeda){for(var _0x38d25b=0x0,_0x702160;_0x38d25b<_0x28aeda[_0xb811('0x1c')];_0x38d25b+=0x1){_0x702160=_0x28aeda[_0x38d25b][_0xb811('0x51')]({'plain':!![]});switch(_0x702160[_0xb811('0x4e')]){case _0xb811('0x52'):_0x4005b4[_0xb811('0x30')](db['sequelize'][_0xb811('0x53')](_0x6a23a9(_0x702160,_0xb811('0x5b')))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));break;case _0xb811('0x55'):_0x4005b4[_0xb811('0x30')](db[_0xb811('0x56')][_0xb811('0x53')](_0x432255(_0x702160,_0xb811('0x5b')))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));break;default:_0x4005b4[_0xb811('0x30')](db['sequelize']['query'](_0x11cda6(_0x702160,_0xb811('0x5b')))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));}}}return _0x4005b4;})[_0xb811('0x58')]();})[_0xb811('0x2f')](function(){return db['Campaign'][_0xb811('0x59')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb811('0x5c'),'where':{'id':LISTID}}]})[_0xb811('0x2f')](function(_0x2a0afc){var _0x1f377e=[];if(_0x2a0afc){for(var _0x653afb=0x0,_0x3a5331;_0x653afb<_0x2a0afc[_0xb811('0x1c')];_0x653afb+=0x1){_0x3a5331=_0x2a0afc[_0x653afb]['get']({'plain':!![]});_0x1f377e[_0xb811('0x30')](db['sequelize'][_0xb811('0x53')](_0x35c0a0(_0x3a5331,'CampaignId'))[_0xb811('0x2f')](function(){})[_0xb811('0x54')](_0x13e779()));}}return _0x1f377e;})['all']();})[_0xb811('0x54')](function(_0x174444){logger[_0xb811('0x17')]('cmContact,\x20%s,\x20%s',_0xb811('0x5d'),_0x174444[_0xb811('0x1d')]);});}var processPromises=function(_0x1735bc){return BPromise[_0xb811('0x58')](promises)[_0xb811('0x2f')](function(_0x2e87f1){})[_0xb811('0x54')](function(_0x5416a8){logger[_0xb811('0x17')](_0xb811('0x5e'),JSON[_0xb811('0x5f')](_0x5416a8));})[_0xb811('0x60')](function(){socket[_0xb811('0x61')](_0xb811('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1735bc){return _0x1735bc[_0xb811('0x63')]();}});};var endCsv=function(){return BPromise[_0xb811('0x64')]()[_0xb811('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xb811('0x61')](_0xb811('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2f11a1){logger[_0xb811('0x17')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x2f11a1));}finally{process[_0xb811('0x65')](0x0);}});};process['on'](_0xb811('0x66'),function(){logger[_0xb811('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xb811('0x64')]()[_0xb811('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb811('0x15')](',');return db[_0xb811('0x2d')][_0xb811('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb811('0x2f')](function(_0x51b672){var _0x273767=fs[_0xb811('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb811('0x69')](_0x273767,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a3ed4,_0x1bb0bf){total+=0x1;var _0x3d4a59=total;promises[_0xb811('0x30')](checkRow(_0x1a3ed4,_0x51b672,_0x3d4a59)[_0xb811('0x2f')](function(){success+=0x1;})[_0xb811('0x54')](function(_0x53efec){if(_0x53efec[_0xb811('0x17')]){errors+=0x1;delete _0x53efec['error'];}else if(_0x53efec[_0xb811('0x2b')]){duplicates+=0x1;delete _0x53efec[_0xb811('0x2b')];}rows[_0xb811('0x30')](_0x53efec);}));if(total%0xc8===0x0){_0x1bb0bf[_0xb811('0x6a')]();return processPromises(_0x1bb0bf);}},'complete':function(){return processPromises()[_0xb811('0x2f')](function(){logger[_0xb811('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x108956,_0x241689){logger[_0xb811('0x67')]('CSV\x20parse\x20error',JSON[_0xb811('0x5f')](_0x108956));endCsv();}});})[_0xb811('0x54')](function(_0x232f7f){logger['error'](_0xb811('0x6b'),JSON[_0xb811('0x5f')](_0x232f7f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 43b84dd..b0d4065 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 _0xf7d7=['\x20=\x20?','toString','cm_contacts.UserId','UserId','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','message','exit','errors','push','code','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.id','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','socket_timestamp','root','.csv','includes','header',',utcOffset','parse','createReadStream','rows','hasOwnProperty','data','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','CampaignId','affectedRows','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','insert','cm_hopper_black','ListId','updatedAt','.CmListId','.id\x20=\x20'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0xf7d7,0x64));var _0x7f7d=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf7d7[_0xc0a3d3];return _0x3386e8;};'use strict';var fs=require('fs');var path=require(_0x7f7d('0x0'));var _=require('lodash');var Papa=require(_0x7f7d('0x1'));var util=require(_0x7f7d('0x2'));var BPromise=require(_0x7f7d('0x3'));var moment=require(_0x7f7d('0x4'));var squel=require(_0x7f7d('0x5'));var Redis=require(_0x7f7d('0x6'));var db=require(_0x7f7d('0x7'))['db'];var config=require(_0x7f7d('0x8'));var shared=require(_0x7f7d('0x9'));var logger=require(_0x7f7d('0xa'))(_0x7f7d('0xb'));config[_0x7f7d('0xc')]=_[_0x7f7d('0xd')](config[_0x7f7d('0xc')],{'host':_0x7f7d('0xe'),'port':0x18eb});var socket=require(_0x7f7d('0xf'))(new Redis(config[_0x7f7d('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7f7d('0x10')](_0x7f7d('0x11'));function isEmail(_0x55dda2){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'](_0x55dda2);}function selectNotIn(_0x10756e,_0x31464b,_0x1a8a5f,_0x28e161,_0x524195){return squel[_0x7f7d('0x12')]()[_0x7f7d('0x13')](_0x7f7d('0x14'))[_0x7f7d('0x15')](_0x28e161)[_0x7f7d('0x16')](_0x31464b,null,_0x31464b+'.id\x20=\x20'+_0x28e161+'.'+_0x1a8a5f)[_0x7f7d('0x17')](_0x28e161+'.'+_0x1a8a5f+_0x7f7d('0x18')+_0x10756e+'.'+_0x1a8a5f)['where'](_0x31464b+_0x7f7d('0x19')+_0x524195[_0x7f7d('0x16')]()+')');}function insertCmHopper(_0x462307,_0x112bb4,_0x3710bd,_0xa4ef36,_0x3e66be){var _0x154ebb=[_0x7f7d('0x1a'),'cm_contacts.scheduledat',_0x7f7d('0x1b'),_0x7f7d('0x1c'),_0x112bb4+'.'+_0xa4ef36,'cm_contacts.createdAt',_0x7f7d('0x1d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3e66be+'\x22'];return squel['insert']()[_0x7f7d('0x1e')](_0x7f7d('0x1f'))[_0x7f7d('0x20')]([_0x7f7d('0x14'),_0x7f7d('0x21'),_0x7f7d('0x22'),'ListId',_0xa4ef36,_0x7f7d('0x23'),'updatedAt','priority','UserId',_0x7f7d('0x24')],squel[_0x7f7d('0x12')]()[_0x7f7d('0x25')](_0x154ebb)['from'](_0x112bb4)[_0x7f7d('0x16')](_0x7f7d('0x26'),null,_0x7f7d('0x27')+_0x112bb4+'.CmListId')['join'](_0x3710bd,null,_0x3710bd+'.id\x20=\x20'+_0x112bb4+'.'+_0xa4ef36)['where'](_0x112bb4+_0x7f7d('0x28'),_0x462307)['where'](_0x7f7d('0x29'),NOW)[_0x7f7d('0x17')](_0x7f7d('0x2a'),selectNotIn(_0x112bb4,_0x3710bd,_0xa4ef36,_0x7f7d('0x1f'),[_0x7f7d('0x2b'),_0x7f7d('0x2c')]))[_0x7f7d('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x112bb4,_0x3710bd,_0xa4ef36,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x501971,_0x40f655,_0x1bfb21,_0x45ac13){var _0x7e1d70=[_0x7f7d('0x1a'),_0x7f7d('0x1b'),_0x7f7d('0x1c'),_0x40f655+'.'+_0x45ac13,_0x7f7d('0x2d'),_0x7f7d('0x1d')];return squel[_0x7f7d('0x2e')]()[_0x7f7d('0x1e')](_0x7f7d('0x2f'))['fromQuery']([_0x7f7d('0x14'),_0x7f7d('0x22'),_0x7f7d('0x30'),_0x45ac13,_0x7f7d('0x23'),_0x7f7d('0x31')],squel['select']()[_0x7f7d('0x25')](_0x7e1d70)[_0x7f7d('0x15')](_0x40f655)[_0x7f7d('0x16')](_0x7f7d('0x26'),null,_0x7f7d('0x27')+_0x40f655+_0x7f7d('0x32'))['join'](_0x1bfb21,null,_0x1bfb21+_0x7f7d('0x33')+_0x40f655+'.'+_0x45ac13)[_0x7f7d('0x17')](_0x40f655+_0x7f7d('0x28'),_0x501971)[_0x7f7d('0x17')](_0x7f7d('0x29'),NOW)[_0x7f7d('0x17')](_0x7f7d('0x2a'),squel[_0x7f7d('0x12')]()['field'](_0x7f7d('0x14'))[_0x7f7d('0x15')](_0x7f7d('0x2f'))[_0x7f7d('0x17')]('ListId\x20=\x20?',_0x501971)[_0x7f7d('0x17')](_0x45ac13+_0x7f7d('0x34'),_0x40f655+'.'+_0x45ac13)))[_0x7f7d('0x35')]();}function insertTzCmHopper(_0x2ff5e2,_0x2755e5,_0x9ab0b,_0x63e184,_0x438a44,_0x2c9c13){var _0x41075a=[_0x7f7d('0x1a'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x2c9c13+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x7f7d('0x1c'),_0x2755e5+'.'+_0x63e184,_0x7f7d('0x2d'),_0x7f7d('0x1d'),'cm_contacts.priority',_0x7f7d('0x36'),'\x22'+_0x438a44+'\x22'];var _0x541382=squel[_0x7f7d('0x2e')]()[_0x7f7d('0x1e')](_0x7f7d('0x1f'))[_0x7f7d('0x20')](['phone',_0x7f7d('0x21'),_0x7f7d('0x22'),_0x7f7d('0x30'),_0x63e184,_0x7f7d('0x23'),_0x7f7d('0x31'),'priority',_0x7f7d('0x37'),_0x7f7d('0x24')],squel['select']()[_0x7f7d('0x25')](_0x41075a)[_0x7f7d('0x15')](_0x2755e5)[_0x7f7d('0x16')](_0x7f7d('0x26'),null,_0x7f7d('0x27')+_0x2755e5+_0x7f7d('0x32'))[_0x7f7d('0x16')](_0x9ab0b,null,_0x9ab0b+_0x7f7d('0x33')+_0x2755e5+'.'+_0x63e184)[_0x7f7d('0x16')](_0x2c9c13,null,_0x2c9c13+_0x7f7d('0x33')+_0x2755e5+'.'+_0x63e184)[_0x7f7d('0x17')](_0x2755e5+'.CmListId\x20=\x20?',_0x2ff5e2)[_0x7f7d('0x17')](_0x7f7d('0x29'),NOW)['where'](_0x7f7d('0x2a'),selectNotIn(_0x2755e5,_0x9ab0b,_0x63e184,_0x7f7d('0x1f'),['\x22always\x22',_0x7f7d('0x2c')]))[_0x7f7d('0x17')](_0x7f7d('0x2a'),selectNotIn(_0x2755e5,_0x9ab0b,_0x63e184,_0x7f7d('0x1f'),[_0x7f7d('0x2b')])))['toString']();return _0x541382;}function insertTzCmHopperBlack(_0x42a1b3,_0x542c31,_0x2314cf,_0x46edc7){var _0x2f031b=[_0x7f7d('0x1a'),_0x7f7d('0x1b'),'cm_contacts.ListId',_0x542c31+'.'+_0x46edc7,_0x7f7d('0x2d'),_0x7f7d('0x1d')];return squel[_0x7f7d('0x2e')]()[_0x7f7d('0x1e')](_0x7f7d('0x2f'))['fromQuery']([_0x7f7d('0x14'),'ContactId',_0x7f7d('0x30'),_0x46edc7,_0x7f7d('0x23'),'updatedAt'],squel[_0x7f7d('0x12')]()['fields'](_0x2f031b)[_0x7f7d('0x15')](_0x542c31)['join'](_0x7f7d('0x26'),null,_0x7f7d('0x27')+_0x542c31+_0x7f7d('0x32'))[_0x7f7d('0x16')](_0x2314cf,null,_0x2314cf+_0x7f7d('0x33')+_0x542c31+'.'+_0x46edc7)[_0x7f7d('0x17')](_0x542c31+_0x7f7d('0x28'),_0x42a1b3)[_0x7f7d('0x17')](_0x7f7d('0x29'),NOW)[_0x7f7d('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7f7d('0x12')]()[_0x7f7d('0x13')]('phone')[_0x7f7d('0x15')](_0x7f7d('0x2f'))[_0x7f7d('0x17')](_0x7f7d('0x38'),_0x42a1b3)[_0x7f7d('0x17')](_0x46edc7+'\x20=\x20?',_0x542c31+'.'+_0x46edc7)))[_0x7f7d('0x35')]();}function insertCmContact(_0x1362be,_0x5ccfed,_0x2d0eab,_0x302813){var _0x4dea49=_[_0x7f7d('0x39')](_[_0x7f7d('0x3a')](_0x302813),['ListId',_0x7f7d('0x3b'),_0x7f7d('0x23'),_0x7f7d('0x31')]);return squel[_0x7f7d('0x2e')]()['into'](_0x7f7d('0x26'))[_0x7f7d('0x20')](_0x4dea49,squel[_0x7f7d('0x12')]()['fields'](_0x4dea49)['from'](_0x5ccfed)[_0x7f7d('0x17')]('('+_0x2d0eab[_0x7f7d('0x16')](',')+_0x7f7d('0x3c'),squel[_0x7f7d('0x12')]()['fields'](_0x2d0eab)[_0x7f7d('0x15')](_0x7f7d('0x26'))[_0x7f7d('0x17')](_0x7f7d('0x38'),_0x1362be)['where'](_0x7f7d('0x3d')))['where'](_0x7f7d('0x3e'),squel[_0x7f7d('0x12')]()[_0x7f7d('0x13')]('MIN(id)',_0x7f7d('0x3f'))[_0x7f7d('0x15')](_0x5ccfed)[_0x7f7d('0x40')](_0x2d0eab[_0x7f7d('0x16')](','))))[_0x7f7d('0x35')]();}function handleStop(){logger[_0x7f7d('0x41')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1a2ac1){logger['error'](_0x1a2ac1[_0x7f7d('0x42')]);process[_0x7f7d('0x43')](0x1);}function handleError(_0x6ad596,_0x42c7aa){stats[_0x7f7d('0x44')][_0x7f7d('0x45')]({'name':_0x42c7aa[_0x7f7d('0x46')],'message':_0x42c7aa['message'],'row':_0x6ad596});}function handleQuery(_0x13d4df){logger[_0x7f7d('0x41')](_0x13d4df);return db[_0x7f7d('0x47')][_0x7f7d('0x48')](_0x13d4df)[_0x7f7d('0x49')](function(_0xc276d0){results[_0x7f7d('0x45')](_0xc276d0);})[_0x7f7d('0x4a')](function(_0x54a630){logger[_0x7f7d('0x4b')](_0x54a630[_0x7f7d('0x42')]);});}function updateTzCampaigns(_0x2180c2){return new Promise(function(_0x2dfa4f,_0x9cceb4){var _0x16c0b0=squel[_0x7f7d('0x12')]()[_0x7f7d('0x25')]([_0x7f7d('0x4c'),_0x7f7d('0x4d')])[_0x7f7d('0x15')](_0x7f7d('0x4e'))[_0x7f7d('0x16')]('campaigns_has_cm_lists',null,_0x7f7d('0x4f'))[_0x7f7d('0x17')](_0x7f7d('0x50')+_0x2180c2);db[_0x7f7d('0x47')][_0x7f7d('0x48')](_0x16c0b0[_0x7f7d('0x35')]())[_0x7f7d('0x49')](function(_0x32d36b){var _0x179046=[];for(var _0x390198=0x0;_0x390198<_0x32d36b[_0x7f7d('0x51')];_0x390198++){_0x179046[_0x7f7d('0x45')](getTimezoneData(_0x32d36b[_0x390198],tmp_campaigns));}BPromise[_0x7f7d('0x52')](_0x179046)[_0x7f7d('0x53')](function(){_0x2dfa4f({'val':0x1});});})['catch'](function(_0x4b9025){logger[_0x7f7d('0x4b')](_0x4b9025['message']);_0x2dfa4f({'val':0x0});});});}function updateTzVoiceQueues(_0x21292f){return new Promise(function(_0x27d050,_0x1125b0){var _0x212135=squel[_0x7f7d('0x12')]()[_0x7f7d('0x25')]([_0x7f7d('0x54'),'voice_queues.dialTimezone'])[_0x7f7d('0x15')]('voice_queues')['join']('voice_queues_has_cm_lists',null,_0x7f7d('0x55'))[_0x7f7d('0x17')](_0x7f7d('0x56')+_0x21292f);db[_0x7f7d('0x47')][_0x7f7d('0x48')](_0x212135[_0x7f7d('0x35')]())[_0x7f7d('0x49')](function(_0x8bb9e8){var _0x20b341=[];for(var _0x33342e=0x0;_0x33342e<_0x8bb9e8[_0x7f7d('0x51')];_0x33342e++){_0x20b341['push'](getTimezoneData(_0x8bb9e8[_0x33342e],tmp_voice_queues));}BPromise[_0x7f7d('0x52')](_0x20b341)[_0x7f7d('0x53')](function(){_0x27d050({'val':0x1});});})['catch'](function(_0x18671e){logger[_0x7f7d('0x4b')](_0x18671e[_0x7f7d('0x42')]);_0x27d050({'val':0x0});});});}function getTimezoneData(_0x2315a4,_0x202916){return new Promise(function(_0x428651,_0x5504f5){var _0x1e0008=shared[_0x7f7d('0x57')];var _0x1af394=_0x1e0008[_0x2315a4[_0x7f7d('0x58')]];if(_[_0x7f7d('0x59')](_0x1af394)){_0x428651({'ret':0x1});}else{var _0x578a24=_0x1af394[_0x7f7d('0x5a')];var _0x39ae66=squel[_0x7f7d('0x2e')]()['into'](_0x202916)[_0x7f7d('0x5b')]('id',_0x2315a4['id'])[_0x7f7d('0x5b')](_0x7f7d('0x5c'),_0x578a24)[_0x7f7d('0x5b')](_0x7f7d('0x58'),_0x2315a4['dialTimezone'])['toString']();return db[_0x7f7d('0x47')][_0x7f7d('0x48')](_0x39ae66)[_0x7f7d('0x49')](function(_0xff2dc5){_0x428651({'ret':0x1});})[_0x7f7d('0x4a')](function(_0x1ea177){logger[_0x7f7d('0x4b')](_0x1ea177[_0x7f7d('0x42')]);_0x5504f5({'ret':0x1});});}});}function handleTZQuery(_0x52a9ee){logger[_0x7f7d('0x41')](_0x52a9ee);return db[_0x7f7d('0x47')][_0x7f7d('0x48')](_0x52a9ee)[_0x7f7d('0x49')](function(_0x2ad5b1){})[_0x7f7d('0x4a')](function(_0xd7de82){logger[_0x7f7d('0x4b')](_0xd7de82[_0x7f7d('0x42')]);});}function main(_0xc2ba66,_0x2f7f7a,_0x2786e2,_0x54a049){logger['info'](_0x7f7d('0x5d'),_0xc2ba66,JSON[_0x7f7d('0x5e')](_0x2f7f7a));process['send'](_0x7f7d('0x5f'));var _0xcd3ab7=_0x2f7f7a[_0x7f7d('0x60')];var _0x25185d=_0x2f7f7a[_0x7f7d('0x61')];var _0x329aec=path[_0x7f7d('0x16')](config[_0x7f7d('0x62')],'server/files/tmp',_0x25185d+_0x7f7d('0x63'));hasTZ=_[_0x7f7d('0x3a')](_0xcd3ab7)[_0x7f7d('0x64')](_0x7f7d('0x58'));var _0x136918=_[_0x7f7d('0x3a')](_0xcd3ab7)[_0x7f7d('0x16')]();logger[_0x7f7d('0x41')](_0x7f7d('0x65'),_0x136918);if(hasTZ)_0x136918+=_0x7f7d('0x66');fs['writeFileSync'](_0x329aec,_0x136918+'\x0a');Papa[_0x7f7d('0x67')](fs[_0x7f7d('0x68')](_0xc2ba66),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12eb3b,_0x4309e2){try{for(var _0x4445ff=0x0,_0x2544ee=[];_0x4445ff<_0x12eb3b['data'][_0x7f7d('0x51')];_0x4445ff++){stats[_0x7f7d('0x69')]+=0x1;if(_0x12eb3b[_0x7f7d('0x44')][_0x4445ff]){handleError(_0x12eb3b['data'][_0x4445ff],_0x12eb3b['errors'][_0x4445ff]);}else{var _0x5479fd=[];for(var _0xed9084 in _0xcd3ab7){if(_0xcd3ab7[_0x7f7d('0x6a')](_0xed9084)){if(_0x12eb3b[_0x7f7d('0x6b')][_0x4445ff][_0xcd3ab7[_0xed9084]]){var _0x220cdd=_['trim'](_0x12eb3b['data'][_0x4445ff][_0xcd3ab7[_0xed9084]][_0x7f7d('0x6c')](/"/g,'\x27'));switch(_0xed9084){case _0x7f7d('0x21'):var _0x473f0b=moment(_0x220cdd,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x473f0b[_0x7f7d('0x6d')]()){_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x220cdd+'\x22');}else{_0x5479fd[_0x7f7d('0x45')](_0x7f7d('0x6e'));}break;case'priority':var _0x13c2ba=parseInt(_0x220cdd);_0x220cdd=_['isNaN'](_0x13c2ba)||_0x13c2ba<0x0||_0x13c2ba>0x4?_0x54a049?0x3:0x2:_0x13c2ba;_0x2544ee['push']('\x22'+_0x220cdd+'\x22');break;case _0x7f7d('0x37'):var _0x4813fc=parseInt(_0x220cdd);if(_[_0x7f7d('0x6f')](_0x4813fc)&&_[_0x7f7d('0x64')](_0x2786e2,_0x4813fc)){_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x4813fc+'\x22');}else{_0x5479fd['push'](_0x7f7d('0x70'));}break;case _0x7f7d('0x71'):if(isEmail(_0x220cdd)){_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x220cdd+'\x22');}else{_0x5479fd['push']('email\x20wrong\x20format');}break;case _0x7f7d('0x72'):var _0x5bfd6d=moment(_0x220cdd,_0x7f7d('0x73'),!![]);if(_0x5bfd6d['isValid']()){_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x220cdd+'\x22');}else{_0x5479fd[_0x7f7d('0x45')](_0x7f7d('0x74'));}break;case _0x7f7d('0x58'):var _0x14b0d9=shared['timezones'];var _0x379b09=_0x14b0d9[_0x220cdd];if(!_[_0x7f7d('0x59')](_0x379b09)){var _0x1f721d=_0x379b09['utcOffset'];_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x220cdd+'\x22');_0x2544ee['push']('\x22'+_0x1f721d+'\x22');}break;default:_0x2544ee[_0x7f7d('0x45')]('\x22'+_0x220cdd+'\x22');}}else{switch(_0xed9084){case'firstName':case _0x7f7d('0x14'):_0x5479fd[_0x7f7d('0x45')](_0xed9084+_0x7f7d('0x75'));break;default:_0x2544ee[_0x7f7d('0x45')]('\x22\x22');}}}}if(_0x5479fd[_0x7f7d('0x51')]){handleError(_0x12eb3b['data'][_0x4445ff],{'code':_0x7f7d('0x76'),'message':_0x5479fd[_0x7f7d('0x16')]()});}else{fs[_0x7f7d('0x77')](_0x329aec,_0x2544ee[_0x7f7d('0x16')]()+'\x0a');}_0x2544ee=[];}if(!(stats[_0x7f7d('0x69')]%0xc8)){socket[_0x7f7d('0x78')]('contact:import:'+_0x25185d,stats);stats['errors']=[];}}if(stopped){logger[_0x7f7d('0x41')](_0x7f7d('0x79'));_0x4309e2[_0x7f7d('0x7a')]();}}catch(_0x32a30f){handleError(_0x12eb3b[_0x7f7d('0x6b')][_0x4445ff],{'code':_0x7f7d('0x7b'),'message':_0x32a30f[_0x7f7d('0x42')]});logger[_0x7f7d('0x4b')](_0x7f7d('0x7c'),_0x32a30f[_0x7f7d('0x42')]);}},'complete':function(){try{var _0x1656f0=[];var _0x17bc5f=[];var _0x4dfb53=_0x7f7d('0x26');if(_0x2f7f7a[_0x7f7d('0x7d')]&&_0x2f7f7a[_0x7f7d('0x7d')][_0x7f7d('0x51')]){_0x4dfb53='cm_contacts_'+_0x25185d;_0x1656f0['push'](_0x7f7d('0x7e')+_0x4dfb53+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7f7d('0x7f')+_0x25185d;tmp_voice_queues=_0x7f7d('0x80')+_0x25185d;_0x17bc5f[_0x7f7d('0x45')](_0x7f7d('0x7e')+tmp_campaigns+_0x7f7d('0x81'));_0x17bc5f[_0x7f7d('0x45')](_0x7f7d('0x7e')+tmp_voice_queues+_0x7f7d('0x81'));BPromise[_0x7f7d('0x82')](_0x17bc5f,handleTZQuery)['then'](function(_0x147a5e){updateTzCampaigns(_0x2f7f7a[_0x7f7d('0x30')])[_0x7f7d('0x53')](function(_0x26a5ff){updateTzVoiceQueues(_0x2f7f7a[_0x7f7d('0x30')])['then'](function(_0x5429d2){var _0x5ac0e0=util[_0x7f7d('0x10')](_0x7f7d('0x83'),_0x329aec,_0x4dfb53,_0x136918,_0x2f7f7a[_0x7f7d('0x30')],_0x2f7f7a[_0x7f7d('0x3b')]||null,NOW,NOW);if(_['isNil'](_0xcd3ab7[_0x7f7d('0x21')])){_0x5ac0e0+=',\x20scheduledAt\x20=\x20NOW()';}_0x1656f0[_0x7f7d('0x45')](_0x5ac0e0);if(_0x2f7f7a[_0x7f7d('0x7d')]&&_0x2f7f7a['duplicates'][_0x7f7d('0x51')]){_0x1656f0['push'](insertCmContact(_0x2f7f7a[_0x7f7d('0x30')],_0x4dfb53,_0x2f7f7a[_0x7f7d('0x7d')],_0xcd3ab7));_0x1656f0[_0x7f7d('0x45')](_0x7f7d('0x84')+_0x4dfb53+';');}if(hasTZ){_0x1656f0['push'](insertTzCmHopper(_0x2f7f7a['ListId'],_0x7f7d('0x85'),_0x7f7d('0x86'),'VoiceQueueId',_0x54a049,tmp_voice_queues));_0x1656f0[_0x7f7d('0x45')](insertTzCmHopperBlack(_0x2f7f7a[_0x7f7d('0x30')],_0x7f7d('0x87'),_0x7f7d('0x86'),_0x7f7d('0x88')));_0x1656f0[_0x7f7d('0x45')](insertTzCmHopper(_0x2f7f7a[_0x7f7d('0x30')],_0x7f7d('0x89'),'campaigns',_0x7f7d('0x8a'),_0x54a049,tmp_campaigns));_0x1656f0[_0x7f7d('0x45')](insertTzCmHopperBlack(_0x2f7f7a[_0x7f7d('0x30')],'campaigns_has_cm_blacklists','campaigns',_0x7f7d('0x8a')));}else{_0x1656f0['push'](insertCmHopper(_0x2f7f7a[_0x7f7d('0x30')],_0x7f7d('0x85'),_0x7f7d('0x86'),'VoiceQueueId',_0x54a049));_0x1656f0[_0x7f7d('0x45')](insertCmHopperBlack(_0x2f7f7a['ListId'],_0x7f7d('0x87'),'voice_queues',_0x7f7d('0x88')));_0x1656f0[_0x7f7d('0x45')](insertCmHopper(_0x2f7f7a[_0x7f7d('0x30')],'campaigns_has_cm_lists','campaigns','CampaignId',_0x54a049));_0x1656f0[_0x7f7d('0x45')](insertCmHopperBlack(_0x2f7f7a[_0x7f7d('0x30')],'campaigns_has_cm_blacklists',_0x7f7d('0x4e'),'CampaignId'));}_0x1656f0[_0x7f7d('0x45')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x1656f0[_0x7f7d('0x45')](_0x7f7d('0x84')+tmp_voice_queues+';');BPromise['each'](_0x1656f0,handleQuery)[_0x7f7d('0x53')](function(_0x2801b8){stats['finish']=!![];stats[_0x7f7d('0x8b')]=_0x2f7f7a['duplicates']&&_0x2f7f7a[_0x7f7d('0x7d')]['length']?results[0x2][_0x7f7d('0x8b')]:results[0x0][_0x7f7d('0x8b')];socket[_0x7f7d('0x78')]('contact:import:'+_0x25185d,stats);fs['unlink'](_0xc2ba66);fs[_0x7f7d('0x8c')](_0x329aec);process['exit'](0x0);})[_0x7f7d('0x4a')](function(_0x11a54b){logger[_0x7f7d('0x4b')](_0x11a54b[_0x7f7d('0x42')]);process[_0x7f7d('0x43')](0x1);});});});});}catch(_0x4a6013){logger[_0x7f7d('0x4b')]('complete',_0x4a6013['message']);process[_0x7f7d('0x43')](0x1);}},'error':function(_0x9675ca,_0x31cb2f,_0x185e17,_0x3ae5d4){throw new Error(_0x3ae5d4);}});}function validate(){if(process[_0x7f7d('0x8d')]&&process['argv'][_0x7f7d('0x51')]<0x4){throw new Error(_0x7f7d('0x8e'));}var _0x5cd5fb=path[_0x7f7d('0x16')](config[_0x7f7d('0x62')],_0x7f7d('0x8f'),process[_0x7f7d('0x8d')][0x2]);if(!fs[_0x7f7d('0x90')](_0x5cd5fb)){throw new Error(_0x7f7d('0x91'));}var _0xbccc96={};try{_0xbccc96=JSON[_0x7f7d('0x67')](process['argv'][0x3]);if(!_0xbccc96[_0x7f7d('0x60')]){throw new Error(_0x7f7d('0x92'));}if(!_0xbccc96[_0x7f7d('0x60')][_0x7f7d('0x14')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xbccc96['binding'][_0x7f7d('0x93')]){throw new Error(_0x7f7d('0x94'));}var _0x55692a=0x0;if(_0xbccc96[_0x7f7d('0x60')][_0x7f7d('0x37')]){_0x55692a=0x1;}if(!_0xbccc96['ListId']){throw new Error(_0x7f7d('0x95'));}}catch(_0x1dfb49){throw new Error(_0x7f7d('0x96'));}var _0x1eac8a=[];try{_0x1eac8a=_[_0x7f7d('0x97')](JSON[_0x7f7d('0x67')](process[_0x7f7d('0x8d')][0x4]),'id');}catch(_0x1a0288){logger[_0x7f7d('0x41')]('No\x20agent\x20available');}main(_0x5cd5fb,_0xbccc96,_0x1eac8a,_0x55692a);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xf6f1=['then','format','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','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','into','updatedAt','from','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','cm_hopper','scheduledat','cm_contacts.createdAt\x20=\x20?','field','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','sequelize','query','catch','message','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','length','push','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists.CmListId=','spread','timezones','isNil','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);'];(function(_0x5e0356,_0x3c3c36){var _0x1a9926=function(_0x39ae04){while(--_0x39ae04){_0x5e0356['push'](_0x5e0356['shift']());}};_0x1a9926(++_0x3c3c36);}(_0xf6f1,0xb7));var _0x1f6f=function(_0xea0729,_0x45527a){_0xea0729=_0xea0729-0x0;var _0x49eeb3=_0xf6f1[_0xea0729];return _0x49eeb3;};'use strict';var fs=require('fs');var path=require(_0x1f6f('0x0'));var _=require(_0x1f6f('0x1'));var Papa=require(_0x1f6f('0x2'));var util=require(_0x1f6f('0x3'));var BPromise=require('bluebird');var moment=require(_0x1f6f('0x4'));var squel=require(_0x1f6f('0x5'));var Redis=require(_0x1f6f('0x6'));var db=require(_0x1f6f('0x7'))['db'];var config=require(_0x1f6f('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x1f6f('0x9'))('import');config[_0x1f6f('0xa')]=_[_0x1f6f('0xb')](config['redis'],{'host':_0x1f6f('0xc'),'port':0x18eb});var socket=require(_0x1f6f('0xd'))(new Redis(config[_0x1f6f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x419291){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))*$/[_0x1f6f('0xe')](_0x419291);}function selectNotIn(_0x2a546e,_0x3877b5,_0x3adf65,_0x421703,_0x4e5b97){return squel[_0x1f6f('0xf')]()['field'](_0x1f6f('0x10'))['from'](_0x421703)[_0x1f6f('0x11')](_0x3877b5,null,_0x3877b5+_0x1f6f('0x12')+_0x421703+'.'+_0x3adf65)[_0x1f6f('0x13')](_0x421703+'.'+_0x3adf65+_0x1f6f('0x14')+_0x2a546e+'.'+_0x3adf65)[_0x1f6f('0x13')](_0x3877b5+_0x1f6f('0x15')+_0x4e5b97[_0x1f6f('0x11')]()+')');}function insertCmHopper(_0xc3baa6,_0x68b64b,_0x1e3ab0,_0x40e8be,_0x13eb63){var _0x5ca5fc=[_0x1f6f('0x16'),_0x1f6f('0x17'),_0x1f6f('0x18'),_0x1f6f('0x19'),_0x68b64b+'.'+_0x40e8be,_0x1f6f('0x1a'),'cm_contacts.updatedAt',_0x1f6f('0x1b'),'cm_contacts.UserId','\x22'+_0x13eb63+'\x22'];return squel[_0x1f6f('0x1c')]()['into']('cm_hopper')[_0x1f6f('0x1d')]([_0x1f6f('0x10'),'scheduledat',_0x1f6f('0x1e'),_0x1f6f('0x1f'),_0x40e8be,_0x1f6f('0x20'),'updatedAt',_0x1f6f('0x21'),_0x1f6f('0x22'),_0x1f6f('0x23')],squel[_0x1f6f('0xf')]()[_0x1f6f('0x24')](_0x5ca5fc)['from'](_0x68b64b)[_0x1f6f('0x11')](_0x1f6f('0x25'),null,_0x1f6f('0x26')+_0x68b64b+_0x1f6f('0x27'))['join'](_0x1e3ab0,null,_0x1e3ab0+_0x1f6f('0x12')+_0x68b64b+'.'+_0x40e8be)['where'](_0x68b64b+_0x1f6f('0x28'),_0xc3baa6)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x1f6f('0x29'),selectNotIn(_0x68b64b,_0x1e3ab0,_0x40e8be,'cm_hopper',[_0x1f6f('0x2a'),_0x1f6f('0x2b')]))[_0x1f6f('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x68b64b,_0x1e3ab0,_0x40e8be,'cm_hopper',[_0x1f6f('0x2a')])))[_0x1f6f('0x2c')]();}function insertCmHopperBlack(_0x280c9a,_0x5c855d,_0x4735bc,_0x3af42b){var _0x27ffcb=[_0x1f6f('0x16'),_0x1f6f('0x18'),_0x1f6f('0x19'),_0x5c855d+'.'+_0x3af42b,_0x1f6f('0x1a'),_0x1f6f('0x2d')];return squel[_0x1f6f('0x1c')]()[_0x1f6f('0x2e')]('cm_hopper_black')['fromQuery'](['phone',_0x1f6f('0x1e'),_0x1f6f('0x1f'),_0x3af42b,_0x1f6f('0x20'),_0x1f6f('0x2f')],squel[_0x1f6f('0xf')]()[_0x1f6f('0x24')](_0x27ffcb)['from'](_0x5c855d)[_0x1f6f('0x11')](_0x1f6f('0x25'),null,_0x1f6f('0x26')+_0x5c855d+_0x1f6f('0x27'))[_0x1f6f('0x11')](_0x4735bc,null,_0x4735bc+_0x1f6f('0x12')+_0x5c855d+'.'+_0x3af42b)[_0x1f6f('0x13')](_0x5c855d+_0x1f6f('0x28'),_0x280c9a)[_0x1f6f('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1f6f('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x1f6f('0xf')]()['field'](_0x1f6f('0x10'))[_0x1f6f('0x30')](_0x1f6f('0x31'))['where'](_0x1f6f('0x32'),_0x280c9a)['where'](_0x3af42b+_0x1f6f('0x33'),_0x5c855d+'.'+_0x3af42b)))[_0x1f6f('0x2c')]();}function insertTzCmHopper(_0x23a46e,_0x1afe92,_0x2c3911,_0x28701a,_0x3b1c23,_0x99252e){var _0x381067=[_0x1f6f('0x16'),_0x1f6f('0x34')+_0x99252e+_0x1f6f('0x35'),'cm_contacts.id','cm_contacts.ListId',_0x1afe92+'.'+_0x28701a,_0x1f6f('0x1a'),'cm_contacts.updatedAt',_0x1f6f('0x1b'),_0x1f6f('0x36'),'\x22'+_0x3b1c23+'\x22'];var _0x27cbeb=squel[_0x1f6f('0x1c')]()[_0x1f6f('0x2e')](_0x1f6f('0x37'))[_0x1f6f('0x1d')]([_0x1f6f('0x10'),_0x1f6f('0x38'),_0x1f6f('0x1e'),_0x1f6f('0x1f'),_0x28701a,'createdAt',_0x1f6f('0x2f'),_0x1f6f('0x21'),_0x1f6f('0x22'),_0x1f6f('0x23')],squel[_0x1f6f('0xf')]()[_0x1f6f('0x24')](_0x381067)[_0x1f6f('0x30')](_0x1afe92)[_0x1f6f('0x11')](_0x1f6f('0x25'),null,_0x1f6f('0x26')+_0x1afe92+'.CmListId')[_0x1f6f('0x11')](_0x2c3911,null,_0x2c3911+_0x1f6f('0x12')+_0x1afe92+'.'+_0x28701a)[_0x1f6f('0x11')](_0x99252e,null,_0x99252e+_0x1f6f('0x12')+_0x1afe92+'.'+_0x28701a)['where'](_0x1afe92+_0x1f6f('0x28'),_0x23a46e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1f6f('0x13')](_0x1f6f('0x29'),selectNotIn(_0x1afe92,_0x2c3911,_0x28701a,'cm_hopper',[_0x1f6f('0x2a'),'\x22onlyIfOpen\x22']))['where'](_0x1f6f('0x29'),selectNotIn(_0x1afe92,_0x2c3911,_0x28701a,'cm_hopper',[_0x1f6f('0x2a')])))[_0x1f6f('0x2c')]();return _0x27cbeb;}function insertTzCmHopperBlack(_0x36554e,_0x4f3079,_0x2f2678,_0x374401){var _0x4149ee=['cm_contacts.phone',_0x1f6f('0x18'),_0x1f6f('0x19'),_0x4f3079+'.'+_0x374401,_0x1f6f('0x1a'),'cm_contacts.updatedAt'];return squel['insert']()[_0x1f6f('0x2e')](_0x1f6f('0x31'))[_0x1f6f('0x1d')]([_0x1f6f('0x10'),_0x1f6f('0x1e'),_0x1f6f('0x1f'),_0x374401,'createdAt',_0x1f6f('0x2f')],squel['select']()[_0x1f6f('0x24')](_0x4149ee)[_0x1f6f('0x30')](_0x4f3079)[_0x1f6f('0x11')](_0x1f6f('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x4f3079+'.CmListId')[_0x1f6f('0x11')](_0x2f2678,null,_0x2f2678+_0x1f6f('0x12')+_0x4f3079+'.'+_0x374401)[_0x1f6f('0x13')](_0x4f3079+'.CmListId\x20=\x20?',_0x36554e)[_0x1f6f('0x13')](_0x1f6f('0x39'),NOW)[_0x1f6f('0x13')](_0x1f6f('0x29'),squel[_0x1f6f('0xf')]()[_0x1f6f('0x3a')](_0x1f6f('0x10'))[_0x1f6f('0x30')](_0x1f6f('0x31'))['where']('ListId\x20=\x20?',_0x36554e)[_0x1f6f('0x13')](_0x374401+'\x20=\x20?',_0x4f3079+'.'+_0x374401)))['toString']();}function insertCmContact(_0xb656de,_0x13ea5e,_0xa4c2a,_0x15bf82){var _0x51358a=_[_0x1f6f('0x3b')](_[_0x1f6f('0x3c')](_0x15bf82),[_0x1f6f('0x1f'),_0x1f6f('0x3d'),'createdAt',_0x1f6f('0x2f')]);return squel['insert']()[_0x1f6f('0x2e')](_0x1f6f('0x25'))['fromQuery'](_0x51358a,squel['select']()[_0x1f6f('0x24')](_0x51358a)['from'](_0x13ea5e)['where']('('+_0xa4c2a[_0x1f6f('0x11')](',')+_0x1f6f('0x3e'),squel['select']()[_0x1f6f('0x24')](_0xa4c2a)[_0x1f6f('0x30')]('cm_contacts')[_0x1f6f('0x13')](_0x1f6f('0x32'),_0xb656de)[_0x1f6f('0x13')]('deletedAt\x20IS\x20NULL'))['where'](_0x1f6f('0x3f'),squel[_0x1f6f('0xf')]()[_0x1f6f('0x3a')](_0x1f6f('0x40'),_0x1f6f('0x41'))[_0x1f6f('0x30')](_0x13ea5e)['group'](_0xa4c2a[_0x1f6f('0x11')](','))))[_0x1f6f('0x2c')]();}function handleStop(){logger[_0x1f6f('0x42')](_0x1f6f('0x43'));stopped=!![];}function handleUncaughtException(_0x49d655){logger[_0x1f6f('0x44')](_0x49d655['message']);process[_0x1f6f('0x45')](0x1);}function handleError(_0x25313e,_0x52dd83){stats[_0x1f6f('0x46')]['push']({'name':_0x52dd83['code'],'message':_0x52dd83['message'],'row':_0x25313e});}function handleQuery(_0x4b7b03){logger[_0x1f6f('0x42')](_0x4b7b03);return db[_0x1f6f('0x47')][_0x1f6f('0x48')](_0x4b7b03)['spread'](function(_0x55c580){results['push'](_0x55c580);})[_0x1f6f('0x49')](function(_0x30b430){logger[_0x1f6f('0x44')](_0x30b430[_0x1f6f('0x4a')]);});}function updateTzCampaigns(_0x15393c){return new Promise(function(_0xc048b0,_0x374207){var _0x1264af=squel[_0x1f6f('0xf')]()['fields']([_0x1f6f('0x4b'),'campaigns.dialTimezone'])[_0x1f6f('0x30')](_0x1f6f('0x4c'))['join'](_0x1f6f('0x4d'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x1f6f('0x13')](_0x1f6f('0x4e')+_0x15393c);db[_0x1f6f('0x47')][_0x1f6f('0x48')](_0x1264af[_0x1f6f('0x2c')]())['spread'](function(_0x443bda){var _0x453eda=[];for(var _0x3e2c1b=0x0;_0x3e2c1b<_0x443bda[_0x1f6f('0x4f')];_0x3e2c1b++){_0x453eda[_0x1f6f('0x50')](getTimezoneData(_0x443bda[_0x3e2c1b],tmp_campaigns));}BPromise[_0x1f6f('0x51')](_0x453eda)['then'](function(){_0xc048b0({'val':0x1});});})['catch'](function(_0x2e5680){logger[_0x1f6f('0x44')](_0x2e5680[_0x1f6f('0x4a')]);_0xc048b0({'val':0x0});});});}function updateTzVoiceQueues(_0x23482a){return new Promise(function(_0x48b2d2,_0x1efb6b){var _0x59fccb=squel[_0x1f6f('0xf')]()[_0x1f6f('0x24')]([_0x1f6f('0x52'),_0x1f6f('0x53')])[_0x1f6f('0x30')](_0x1f6f('0x54'))[_0x1f6f('0x11')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x1f6f('0x13')](_0x1f6f('0x55')+_0x23482a);db[_0x1f6f('0x47')][_0x1f6f('0x48')](_0x59fccb['toString']())[_0x1f6f('0x56')](function(_0x365b14){var _0x4b54a8=[];for(var _0x12515a=0x0;_0x12515a<_0x365b14[_0x1f6f('0x4f')];_0x12515a++){_0x4b54a8['push'](getTimezoneData(_0x365b14[_0x12515a],tmp_voice_queues));}BPromise['all'](_0x4b54a8)['then'](function(){_0x48b2d2({'val':0x1});});})[_0x1f6f('0x49')](function(_0x710425){logger[_0x1f6f('0x44')](_0x710425[_0x1f6f('0x4a')]);_0x48b2d2({'val':0x0});});});}function getTimezoneData(_0x42f2fa,_0x469787){return new Promise(function(_0x16440c,_0x48f9e7){var _0x18a885=shared[_0x1f6f('0x57')];var _0x5f0666=_0x18a885[_0x42f2fa['dialTimezone']];if(_[_0x1f6f('0x58')](_0x5f0666)){_0x16440c({'ret':0x1});}else{var _0x2ac220=_0x5f0666[_0x1f6f('0x59')];var _0x5bede2=squel['insert']()[_0x1f6f('0x2e')](_0x469787)['set']('id',_0x42f2fa['id'])[_0x1f6f('0x5a')](_0x1f6f('0x5b'),_0x2ac220)[_0x1f6f('0x5a')]('dialTimezone',_0x42f2fa[_0x1f6f('0x5c')])[_0x1f6f('0x2c')]();return db['sequelize'][_0x1f6f('0x48')](_0x5bede2)[_0x1f6f('0x56')](function(_0xe59721){_0x16440c({'ret':0x1});})[_0x1f6f('0x49')](function(_0x4ad18d){logger[_0x1f6f('0x44')](_0x4ad18d[_0x1f6f('0x4a')]);_0x48f9e7({'ret':0x1});});}});}function handleTZQuery(_0x3ed3b7){logger[_0x1f6f('0x42')](_0x3ed3b7);return db[_0x1f6f('0x47')][_0x1f6f('0x48')](_0x3ed3b7)[_0x1f6f('0x56')](function(_0x30bcf4){})['catch'](function(_0x995a8e){logger['error'](_0x995a8e[_0x1f6f('0x4a')]);});}function main(_0x53b92a,_0xde9e31,_0x23d602,_0x577d3c){logger[_0x1f6f('0x42')](_0x1f6f('0x5d'),_0x53b92a,JSON[_0x1f6f('0x5e')](_0xde9e31));process[_0x1f6f('0x5f')](_0x1f6f('0x60'));var _0x2d11b1=_0xde9e31[_0x1f6f('0x61')];var _0x4110bc=_0xde9e31[_0x1f6f('0x62')];var _0x54ef00=path[_0x1f6f('0x11')](config[_0x1f6f('0x63')],_0x1f6f('0x64'),_0x4110bc+_0x1f6f('0x65'));hasTZ=_['keys'](_0x2d11b1)[_0x1f6f('0x66')](_0x1f6f('0x5c'));var _0x1bd6fa=_['keys'](_0x2d11b1)['join']();logger[_0x1f6f('0x42')](_0x1f6f('0x67'),_0x1bd6fa);if(hasTZ)_0x1bd6fa+=_0x1f6f('0x68');fs[_0x1f6f('0x69')](_0x54ef00,_0x1bd6fa+'\x0a');Papa[_0x1f6f('0x6a')](fs[_0x1f6f('0x6b')](_0x53b92a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4df1f9,_0x1a4ec6){try{for(var _0x521c5b=0x0,_0x16756b=[];_0x521c5b<_0x4df1f9[_0x1f6f('0x6c')][_0x1f6f('0x4f')];_0x521c5b++){stats[_0x1f6f('0x6d')]+=0x1;if(_0x4df1f9[_0x1f6f('0x46')][_0x521c5b]){handleError(_0x4df1f9['data'][_0x521c5b],_0x4df1f9[_0x1f6f('0x46')][_0x521c5b]);}else{var _0x57de1e=[];for(var _0x2ed2bb in _0x2d11b1){if(_0x2d11b1[_0x1f6f('0x6e')](_0x2ed2bb)){if(_0x4df1f9[_0x1f6f('0x6c')][_0x521c5b][_0x2d11b1[_0x2ed2bb]]){var _0x53e71c=_[_0x1f6f('0x6f')](_0x4df1f9['data'][_0x521c5b][_0x2d11b1[_0x2ed2bb]][_0x1f6f('0x70')](/"/g,'\x27'));switch(_0x2ed2bb){case _0x1f6f('0x38'):var _0x182f32=moment(_0x53e71c,_0x1f6f('0x71'),!![]);if(_0x182f32['isValid']()){_0x16756b[_0x1f6f('0x50')]('\x22'+_0x53e71c+'\x22');}else{_0x57de1e[_0x1f6f('0x50')](_0x1f6f('0x72'));}break;case _0x1f6f('0x21'):var _0x10cd2d=parseInt(_0x53e71c);_0x53e71c=_[_0x1f6f('0x73')](_0x10cd2d)||_0x10cd2d<0x0||_0x10cd2d>0x4?_0x577d3c?0x3:0x2:_0x10cd2d;_0x16756b['push']('\x22'+_0x53e71c+'\x22');break;case _0x1f6f('0x22'):var _0x18d6f8=parseInt(_0x53e71c);if(_[_0x1f6f('0x74')](_0x18d6f8)&&_[_0x1f6f('0x66')](_0x23d602,_0x18d6f8)){_0x16756b['push']('\x22'+_0x18d6f8+'\x22');}else{_0x57de1e[_0x1f6f('0x50')](_0x1f6f('0x75'));}break;case'email':if(isEmail(_0x53e71c)){_0x16756b[_0x1f6f('0x50')]('\x22'+_0x53e71c+'\x22');}else{_0x57de1e['push'](_0x1f6f('0x76'));}break;case'dateOfBirth':var _0x3d1dc6=moment(_0x53e71c,_0x1f6f('0x77'),!![]);if(_0x3d1dc6[_0x1f6f('0x78')]()){_0x16756b['push']('\x22'+_0x53e71c+'\x22');}else{_0x57de1e[_0x1f6f('0x50')](_0x1f6f('0x79'));}break;case _0x1f6f('0x5c'):var _0x52e195=shared['timezones'];var _0x1c5d06=_0x52e195[_0x53e71c];if(!_[_0x1f6f('0x58')](_0x1c5d06)){var _0x9dd1ec=_0x1c5d06[_0x1f6f('0x59')];_0x16756b[_0x1f6f('0x50')]('\x22'+_0x53e71c+'\x22');_0x16756b['push']('\x22'+_0x9dd1ec+'\x22');}break;default:_0x16756b[_0x1f6f('0x50')]('\x22'+_0x53e71c+'\x22');}}else{switch(_0x2ed2bb){case _0x1f6f('0x7a'):case _0x1f6f('0x10'):_0x57de1e[_0x1f6f('0x50')](_0x2ed2bb+_0x1f6f('0x7b'));break;default:_0x16756b['push']('\x22\x22');}}}}if(_0x57de1e[_0x1f6f('0x4f')]){handleError(_0x4df1f9['data'][_0x521c5b],{'code':_0x1f6f('0x7c'),'message':_0x57de1e[_0x1f6f('0x11')]()});}else{fs[_0x1f6f('0x7d')](_0x54ef00,_0x16756b[_0x1f6f('0x11')]()+'\x0a');}_0x16756b=[];}if(!(stats[_0x1f6f('0x6d')]%0xc8)){socket[_0x1f6f('0x7e')](_0x1f6f('0x7f')+_0x4110bc,stats);stats[_0x1f6f('0x46')]=[];}}if(stopped){logger[_0x1f6f('0x42')]('Abort\x20parser');_0x1a4ec6[_0x1f6f('0x80')]();}}catch(_0x1e87e0){handleError(_0x4df1f9['data'][_0x521c5b],{'code':_0x1f6f('0x81'),'message':_0x1e87e0['message']});logger['error'](_0x1f6f('0x82'),_0x1e87e0[_0x1f6f('0x4a')]);}},'complete':function(){try{var _0x3a6cb3=[];var _0x1f1371=[];var _0x157053=_0x1f6f('0x25');if(_0xde9e31[_0x1f6f('0x83')]&&_0xde9e31[_0x1f6f('0x83')][_0x1f6f('0x4f')]){_0x157053=_0x1f6f('0x84')+_0x4110bc;_0x3a6cb3[_0x1f6f('0x50')](_0x1f6f('0x85')+_0x157053+_0x1f6f('0x86'));}tmp_campaigns='campaigns_'+_0x4110bc;tmp_voice_queues=_0x1f6f('0x87')+_0x4110bc;_0x1f1371['push'](_0x1f6f('0x85')+tmp_campaigns+_0x1f6f('0x88'));_0x1f1371[_0x1f6f('0x50')](_0x1f6f('0x85')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x1f1371,handleTZQuery)[_0x1f6f('0x89')](function(_0x5f1c3d){updateTzCampaigns(_0xde9e31[_0x1f6f('0x1f')])['then'](function(_0x1ce5a3){updateTzVoiceQueues(_0xde9e31[_0x1f6f('0x1f')])[_0x1f6f('0x89')](function(_0x319665){var _0x579717=util[_0x1f6f('0x8a')](_0x1f6f('0x8b'),_0x54ef00,_0x157053,_0x1bd6fa,_0xde9e31[_0x1f6f('0x1f')],_0xde9e31[_0x1f6f('0x3d')]||null,NOW,NOW);if(_[_0x1f6f('0x58')](_0x2d11b1[_0x1f6f('0x38')])){_0x579717+=',\x20scheduledAt\x20=\x20NOW()';}_0x3a6cb3['push'](_0x579717);if(_0xde9e31[_0x1f6f('0x83')]&&_0xde9e31[_0x1f6f('0x83')][_0x1f6f('0x4f')]){_0x3a6cb3[_0x1f6f('0x50')](insertCmContact(_0xde9e31[_0x1f6f('0x1f')],_0x157053,_0xde9e31[_0x1f6f('0x83')],_0x2d11b1));_0x3a6cb3['push'](_0x1f6f('0x8c')+_0x157053+';');}if(hasTZ){_0x3a6cb3[_0x1f6f('0x50')](insertTzCmHopper(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x8d'),'voice_queues','VoiceQueueId',_0x577d3c,tmp_voice_queues));_0x3a6cb3[_0x1f6f('0x50')](insertTzCmHopperBlack(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x8e'),_0x1f6f('0x54'),_0x1f6f('0x8f')));_0x3a6cb3[_0x1f6f('0x50')](insertTzCmHopper(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x4d'),_0x1f6f('0x4c'),_0x1f6f('0x90'),_0x577d3c,tmp_campaigns));_0x3a6cb3[_0x1f6f('0x50')](insertTzCmHopperBlack(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x91'),_0x1f6f('0x4c'),'CampaignId'));}else{_0x3a6cb3[_0x1f6f('0x50')](insertCmHopper(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x8d'),_0x1f6f('0x54'),'VoiceQueueId',_0x577d3c));_0x3a6cb3[_0x1f6f('0x50')](insertCmHopperBlack(_0xde9e31[_0x1f6f('0x1f')],'voice_queues_has_cm_blacklists',_0x1f6f('0x54'),'VoiceQueueId'));_0x3a6cb3[_0x1f6f('0x50')](insertCmHopper(_0xde9e31[_0x1f6f('0x1f')],_0x1f6f('0x4d'),_0x1f6f('0x4c'),_0x1f6f('0x90'),_0x577d3c));_0x3a6cb3[_0x1f6f('0x50')](insertCmHopperBlack(_0xde9e31['ListId'],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}_0x3a6cb3[_0x1f6f('0x50')](_0x1f6f('0x8c')+tmp_campaigns+';');_0x3a6cb3[_0x1f6f('0x50')](_0x1f6f('0x8c')+tmp_voice_queues+';');BPromise['each'](_0x3a6cb3,handleQuery)['then'](function(_0x1427e3){stats[_0x1f6f('0x92')]=!![];stats['affectedRows']=_0xde9e31[_0x1f6f('0x83')]&&_0xde9e31[_0x1f6f('0x83')][_0x1f6f('0x4f')]?results[0x2]['affectedRows']:results[0x0][_0x1f6f('0x93')];socket[_0x1f6f('0x7e')](_0x1f6f('0x7f')+_0x4110bc,stats);fs[_0x1f6f('0x94')](_0x53b92a);fs['unlink'](_0x54ef00);process[_0x1f6f('0x45')](0x0);})[_0x1f6f('0x49')](function(_0x34c68b){logger[_0x1f6f('0x44')](_0x34c68b['message']);process['exit'](0x1);});});});});}catch(_0x1d4843){logger['error'](_0x1f6f('0x95'),_0x1d4843[_0x1f6f('0x4a')]);process[_0x1f6f('0x45')](0x1);}},'error':function(_0x12d46a,_0x3869f1,_0x313390,_0x5dbc05){throw new Error(_0x5dbc05);}});}function validate(){if(process[_0x1f6f('0x96')]&&process['argv'][_0x1f6f('0x4f')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x5baedc=path['join'](config[_0x1f6f('0x63')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x1f6f('0x97')](_0x5baedc)){throw new Error(_0x1f6f('0x98'));}var _0xd8f9de={};try{_0xd8f9de=JSON[_0x1f6f('0x6a')](process['argv'][0x3]);if(!_0xd8f9de[_0x1f6f('0x61')]){throw new Error(_0x1f6f('0x99'));}if(!_0xd8f9de[_0x1f6f('0x61')][_0x1f6f('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xd8f9de[_0x1f6f('0x61')][_0x1f6f('0x7a')]){throw new Error(_0x1f6f('0x9a'));}var _0x3a454e=0x0;if(_0xd8f9de[_0x1f6f('0x61')][_0x1f6f('0x22')]){_0x3a454e=0x1;}if(!_0xd8f9de[_0x1f6f('0x1f')]){throw new Error(_0x1f6f('0x9b'));}}catch(_0x54f691){throw new Error(_0x1f6f('0x9c'));}var _0x1299d1=[];try{_0x1299d1=_[_0x1f6f('0x9d')](JSON[_0x1f6f('0x6a')](process['argv'][0x4]),'id');}catch(_0x1d012b){logger[_0x1f6f('0x42')]('No\x20agent\x20available');}main(_0x5baedc,_0xd8f9de,_0x1299d1,_0x3a454e);}validate();process['on'](_0x1f6f('0x9e'),handleStop);process['on'](_0x1f6f('0x9f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index eb81395..420972f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfb4=['Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Talk\x20Time','talktime','Called\x20Number'];(function(_0x50d967,_0x231fe9){var _0x5596c3=function(_0x34e0c7){while(--_0x34e0c7){_0x50d967['push'](_0x50d967['shift']());}};_0x5596c3(++_0x231fe9);}(_0xcfb4,0x1d6));var _0x4cfb=function(_0x23096b,_0x35ebc1){_0x23096b=_0x23096b-0x0;var _0x24c0f4=_0xcfb4[_0x23096b];return _0x24c0f4;};'use strict';exports[_0x4cfb('0x0')]=function(_0x271396,_0x3e7840){var _0x3a9f2c=[{'type':_0x4cfb('0x1'),'content':_0x4cfb('0x2'),'variableName':null}];switch(_0x271396[_0x4cfb('0x3')]()){case _0x4cfb('0x4'):switch(_0x3e7840[_0x4cfb('0x3')]()){case _0x4cfb('0x5'):_0x3a9f2c[_0x4cfb('0x6')]({'type':_0x4cfb('0x7'),'content':'','variableName':_0x4cfb('0x8')});_0x3a9f2c['push']({'type':_0x4cfb('0x7'),'content':'','variableName':_0x4cfb('0x9')});break;case _0x4cfb('0xa'):_0x3a9f2c[_0x4cfb('0x6')]({'type':_0x4cfb('0x1'),'content':_0x4cfb('0xb'),'variableName':null});_0x3a9f2c['push']({'type':_0x4cfb('0x7'),'content':'','variableName':_0x4cfb('0xc')});break;}}return _0x3a9f2c;};exports[_0x4cfb('0xd')]=function(_0x36205e,_0xae9e3f){var _0x20f68f=[];switch(_0x36205e[_0x4cfb('0x3')]()){case _0x4cfb('0x4'):switch(_0xae9e3f[_0x4cfb('0x3')]()){case _0x4cfb('0x5'):_0x20f68f=[{'type':'string','content':_0x4cfb('0xe'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x9')},{'type':_0x4cfb('0xf'),'content':'','key':'Caller\x20Name','keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x10')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x11'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x12')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x13'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x8')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x14'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x15')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x16'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x4cfb('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x17'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x18')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x19'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0xc')},{'type':_0x4cfb('0x1'),'content':_0x4cfb('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4cfb('0x1b'),'keyType':_0x4cfb('0x7'),'variableName':_0x4cfb('0x1c')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x1d'),'keyType':'variable','variableName':_0x4cfb('0x1e')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x1f'),'keyType':'variable','variableName':_0x4cfb('0x20')},{'type':_0x4cfb('0xf'),'content':'','key':'Hold\x20Time','keyType':_0x4cfb('0x7'),'variableName':'holdtime'},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x21'),'keyType':'variable','variableName':_0x4cfb('0x22')}];break;case _0x4cfb('0xa'):_0x20f68f=[{'type':'string','content':_0x4cfb('0xe'),'variableName':null},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x23'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x4cfb('0x24'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x25')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x15')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x16'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x26')},{'type':'string','content':_0x4cfb('0x1a')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x27'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x28')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x29'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x2a')},{'type':'keyValue','content':'','key':_0x4cfb('0x2b'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':_0x4cfb('0x2c')},{'type':_0x4cfb('0xf'),'content':'','key':_0x4cfb('0x2d'),'keyType':_0x4cfb('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x20f68f;}; \ No newline at end of file +var _0xbaa4=['***\x20Call\x20Info\x20***','keyValue','calleridnum','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','toLowerCase','inbound','push','variable','Outbound\x20Call','destcalleridnum','getDescriptions','voice'];(function(_0x4b7eae,_0x2be7a6){var _0x1e13c2=function(_0x3bd5ec){while(--_0x3bd5ec){_0x4b7eae['push'](_0x4b7eae['shift']());}};_0x1e13c2(++_0x2be7a6);}(_0xbaa4,0x11c));var _0x4baa=function(_0x4dccdc,_0x531553){_0x4dccdc=_0x4dccdc-0x0;var _0x57a2e4=_0xbaa4[_0x4dccdc];return _0x57a2e4;};'use strict';exports[_0x4baa('0x0')]=function(_0x586f71,_0x5ba349){var _0x265187=[{'type':_0x4baa('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x586f71[_0x4baa('0x2')]()){case'voice':switch(_0x5ba349[_0x4baa('0x2')]()){case _0x4baa('0x3'):_0x265187[_0x4baa('0x4')]({'type':_0x4baa('0x5'),'content':'','variableName':'queue'});_0x265187[_0x4baa('0x4')]({'type':_0x4baa('0x5'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x265187['push']({'type':_0x4baa('0x1'),'content':_0x4baa('0x6'),'variableName':null});_0x265187['push']({'type':_0x4baa('0x5'),'content':'','variableName':_0x4baa('0x7')});break;}}return _0x265187;};exports[_0x4baa('0x8')]=function(_0x5204b6,_0x27c9d9){var _0x2607c1=[];switch(_0x5204b6[_0x4baa('0x2')]()){case _0x4baa('0x9'):switch(_0x27c9d9[_0x4baa('0x2')]()){case'inbound':_0x2607c1=[{'type':_0x4baa('0x1'),'content':_0x4baa('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x4baa('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x4baa('0x5'),'variableName':_0x4baa('0xc')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x4baa('0x5'),'variableName':_0x4baa('0xd')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0xe'),'keyType':_0x4baa('0x5'),'variableName':_0x4baa('0xf')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x10'),'keyType':_0x4baa('0x5'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x4baa('0x11'),'keyType':_0x4baa('0x5'),'variableName':_0x4baa('0x12')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x13'),'keyType':_0x4baa('0x5'),'variableName':_0x4baa('0x14')},{'type':_0x4baa('0x1'),'content':_0x4baa('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4baa('0x16'),'keyType':_0x4baa('0x5'),'variableName':'destcalleridname'},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x17'),'keyType':_0x4baa('0x5'),'variableName':'destcalleridnum'},{'type':_0x4baa('0x1'),'content':_0x4baa('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4baa('0x19'),'keyType':_0x4baa('0x5'),'variableName':'agentcalledAt'},{'type':_0x4baa('0xb'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x4baa('0x1a')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x1b'),'keyType':_0x4baa('0x5'),'variableName':'agentcompleteAt'},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x1c'),'keyType':_0x4baa('0x5'),'variableName':_0x4baa('0x1d')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x1e'),'keyType':_0x4baa('0x5'),'variableName':_0x4baa('0x1f')}];break;case _0x4baa('0x20'):_0x2607c1=[{'type':_0x4baa('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x4baa('0x5'),'keyContent':'','variableName':_0x4baa('0x7')},{'type':'keyValue','content':'','key':_0x4baa('0x21'),'keyType':_0x4baa('0x5'),'keyContent':'','variableName':'membername'},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x11'),'keyType':'variable','keyContent':'','variableName':_0x4baa('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0x4baa('0x5'),'keyContent':'','variableName':_0x4baa('0x22')},{'type':_0x4baa('0x1'),'content':_0x4baa('0x18')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x23'),'keyType':_0x4baa('0x5'),'keyContent':'','variableName':_0x4baa('0x24')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x25'),'keyType':'variable','keyContent':'','variableName':_0x4baa('0x26')},{'type':_0x4baa('0xb'),'content':'','key':_0x4baa('0x27'),'keyType':_0x4baa('0x5'),'keyContent':'','variableName':_0x4baa('0x28')},{'type':_0x4baa('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x4baa('0x5'),'keyContent':'','variableName':_0x4baa('0x29')}];break;}}return _0x2607c1;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 60f646c..74605ac 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13c4=['toUpperCase','name','stringify','null','Interaction','then','update','error','tracked','user','query','clone','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x37ecf7,_0x23c7ed){var _0x43ea2c=function(_0x3c671d){while(--_0x3c671d){_0x37ecf7['push'](_0x37ecf7['shift']());}};_0x43ea2c(++_0x23c7ed);}(_0x13c4,0xf9));var _0x413c=function(_0x20477e,_0x5dbc9f){_0x20477e=_0x20477e-0x0;var _0x1374f1=_0x13c4[_0x20477e];return _0x1374f1;};'use strict';var _=require(_0x413c('0x0'));var db=require(_0x413c('0x1'))['db'];var loggers={'openchannel':require(_0x413c('0x2'))(_0x413c('0x3')),'mail':require(_0x413c('0x2'))(_0x413c('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x413c('0x5')),'chat':require(_0x413c('0x2'))('chat-interactions'),'whatsapp':require(_0x413c('0x2'))(_0x413c('0x6'))};function getInteractionId(_0x1f057e,_0x1d1b80,_0x11bc3d){if(_0x1f057e&&_0x1f057e[_[_0x413c('0x7')](_0x11bc3d)+_0x413c('0x8')]){return _0x1f057e[_[_0x413c('0x7')](_0x11bc3d)+_0x413c('0x8')];}else if(_0x1f057e&&_0x1f057e['id']){return _0x1f057e['id'];}else if(_0x1d1b80&&_0x1d1b80['id']){return _0x1d1b80['id'];}else{return _0x413c('0x9');}}function log(_0x5005a0,_0x3a2eb9,_0x3f1bf2,_0x390020,_0x15764f,_0xd0ba0c){loggers[_0x15764f[_0x413c('0xa')]()][_0x5005a0](_0x413c('0xb'),_0xd0ba0c[_0x413c('0xc')](),_0x3a2eb9?_0x3a2eb9['id']:null,_0x3a2eb9?_0x3a2eb9[_0x413c('0xd')]:null,_0x3a2eb9?_0x3a2eb9['role']:null,getInteractionId(_0x3f1bf2,_0x390020,_0x15764f),_0x3f1bf2?JSON[_0x413c('0xe')](_0x3f1bf2):_0x413c('0xf'));}function updateUser(_0x84e77c,_0x40193a,_0x2c5245,_0x4a3fca,_0x46b7a8){db[_[_0x413c('0x7')](_0x4a3fca)+_0x413c('0x10')]['findOne']({'where':{'id':getInteractionId(_0x40193a,_0x2c5245,_0x4a3fca)}})[_0x413c('0x11')](function(_0xff0f28){if(_0xff0f28){return _0xff0f28[_0x413c('0x12')]({'UserId':_0x84e77c?_0x84e77c['id']:null});}})[_0x413c('0x11')](function(_0x2a45be){if(_0x2a45be){log('info',_0x84e77c,_0x40193a,_0x2c5245,_0x4a3fca,_0x46b7a8);}})['catch'](function(){log(_0x413c('0x13'),_0x84e77c,_0x40193a,_0x2c5245,_0x4a3fca,_0x46b7a8);});}exports[_0x413c('0x14')]=function(_0x58e368,_0x1b8463){return function(_0x3df3f0,_0x30a494,_0x56954b){var _0x479045=_0x3df3f0[_0x413c('0x15')];var _0x58cd47={};var _0x4b2aa9=_0x3df3f0[_0x413c('0x16')];if(_0x58cd47){_0x58cd47=_[_0x413c('0x17')](_0x3df3f0[_0x413c('0x18')]);_0x58cd47=_['omit'](_0x58cd47,['body',_0x413c('0x19'),_0x413c('0x1a'),_0x413c('0x1b'),_0x413c('0x1c')]);}updateUser(_0x479045,_0x58cd47,_0x4b2aa9,_0x58e368,_0x1b8463);_0x56954b(null);};}; \ No newline at end of file +var _0x3028=['clone','body','html','phone','fax','mobile','lodash','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','info','catch','error','tracked','user','query'];(function(_0xad03fa,_0x47a089){var _0x2e2a8f=function(_0x44c394){while(--_0x44c394){_0xad03fa['push'](_0xad03fa['shift']());}};_0x2e2a8f(++_0x47a089);}(_0x3028,0x1d7));var _0x8302=function(_0x40a42f,_0x150091){_0x40a42f=_0x40a42f-0x0;var _0x16a078=_0x3028[_0x40a42f];return _0x16a078;};'use strict';var _=require(_0x8302('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x8302('0x1')),'mail':require(_0x8302('0x2'))(_0x8302('0x3')),'fax':require(_0x8302('0x2'))(_0x8302('0x4')),'sms':require(_0x8302('0x2'))(_0x8302('0x5')),'chat':require(_0x8302('0x2'))(_0x8302('0x6')),'whatsapp':require(_0x8302('0x2'))(_0x8302('0x7'))};function getInteractionId(_0x105f6b,_0x2a791f,_0x57b176){if(_0x105f6b&&_0x105f6b[_[_0x8302('0x8')](_0x57b176)+_0x8302('0x9')]){return _0x105f6b[_[_0x8302('0x8')](_0x57b176)+_0x8302('0x9')];}else if(_0x105f6b&&_0x105f6b['id']){return _0x105f6b['id'];}else if(_0x2a791f&&_0x2a791f['id']){return _0x2a791f['id'];}else{return'unknown';}}function log(_0x35d77c,_0x1721d9,_0x3dff8e,_0x2bd2ba,_0x5a3f49,_0x4cdc34){loggers[_0x5a3f49[_0x8302('0xa')]()][_0x35d77c](_0x8302('0xb'),_0x4cdc34[_0x8302('0xc')](),_0x1721d9?_0x1721d9['id']:null,_0x1721d9?_0x1721d9['name']:null,_0x1721d9?_0x1721d9[_0x8302('0xd')]:null,getInteractionId(_0x3dff8e,_0x2bd2ba,_0x5a3f49),_0x3dff8e?JSON[_0x8302('0xe')](_0x3dff8e):_0x8302('0xf'));}function updateUser(_0x257ce1,_0x34907d,_0x8bfb8d,_0x3b65af,_0x358e4f){db[_['upperFirst'](_0x3b65af)+_0x8302('0x10')][_0x8302('0x11')]({'where':{'id':getInteractionId(_0x34907d,_0x8bfb8d,_0x3b65af)}})[_0x8302('0x12')](function(_0x14145d){if(_0x14145d){return _0x14145d['update']({'UserId':_0x257ce1?_0x257ce1['id']:null});}})[_0x8302('0x12')](function(_0x12603c){if(_0x12603c){log(_0x8302('0x13'),_0x257ce1,_0x34907d,_0x8bfb8d,_0x3b65af,_0x358e4f);}})[_0x8302('0x14')](function(){log(_0x8302('0x15'),_0x257ce1,_0x34907d,_0x8bfb8d,_0x3b65af,_0x358e4f);});}exports[_0x8302('0x16')]=function(_0x4aaa66,_0xb1bf6){return function(_0x3246bd,_0x15a0f3,_0xe3455f){var _0x226f9e=_0x3246bd[_0x8302('0x17')];var _0x2025a9={};var _0x33b8a3=_0x3246bd[_0x8302('0x18')];if(_0x2025a9){_0x2025a9=_[_0x8302('0x19')](_0x3246bd['body']);_0x2025a9=_['omit'](_0x2025a9,[_0x8302('0x1a'),_0x8302('0x1b'),_0x8302('0x1c'),_0x8302('0x1d'),_0x8302('0x1e')]);}updateUser(_0x226f9e,_0x2025a9,_0x33b8a3,_0x4aaa66,_0xb1bf6);_0xe3455f(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index df2ada5..65e19c8 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 _0x6c0e=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user','isUserLimit','crypto','util'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x6c0e,0x66));var _0xe6c0=function(_0x3d5ccc,_0x4f7680){_0x3d5ccc=_0x3d5ccc-0x0;var _0x28016f=_0x6c0e[_0x3d5ccc];return _0x28016f;};'use strict';var crypto=require(_0xe6c0('0x0'));var util=require(_0xe6c0('0x1'));var compose=require('composable-middleware');var db=require(_0xe6c0('0x2'))['db'];var config=require(_0xe6c0('0x3'));function getValueFromLicense(_0x4b5513,_0xa33efb){if(_0x4b5513&&_0xa33efb){if(_0xa33efb[_0xe6c0('0x4')]&&_0xa33efb[_0xe6c0('0x5')]){var _0x5767b6=_0xa33efb[_0xe6c0('0x4')];var _0x3afbb1=_0xa33efb['license'];var _0x5288ae=_0x5767b6[_0xe6c0('0x6')]('-')[0x4];var _0x4c780a=_0x5767b6['split']('-')[0x0];var _0xbba68d=crypto[_0xe6c0('0x7')](_0xe6c0('0x8'),util[_0xe6c0('0x9')](_0xe6c0('0xa'),_0x5288ae,_0x5767b6,_0x4c780a));var _0x30e705=_0xbba68d[_0xe6c0('0xb')](_0x3afbb1,_0xe6c0('0xc'),_0xe6c0('0xd'));_0x30e705+=_0xbba68d[_0xe6c0('0xe')](_0xe6c0('0xd'));var _0x11f6da=JSON['parse'](_0x30e705);return _0x11f6da[_0xe6c0('0xf')](_0x4b5513)?_0x11f6da[_0x4b5513]:null;}}return null;}function isLimit(_0x4fa26f,_0x4f02fc,_0x309883,_0x41c3c2){var _0x77efd=_0x4f02fc;return compose()[_0xe6c0('0x10')](function(_0x287c43,_0x2326c1,_0x5e4d5f){return db[_0xe6c0('0x11')][_0xe6c0('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xe6c0('0x13')](function(_0x175579){var _0x64247e=getValueFromLicense(_0x4fa26f,_0x175579);return _0x64247e?_0x64247e:_0x77efd;})[_0xe6c0('0x13')](function(_0x134c58){_0x77efd=_0x134c58;return _0x309883[_0xe6c0('0x14')](_0x41c3c2);})['then'](function(_0x5b2de6){if(_0x5b2de6>=_0x77efd){return _0x2326c1['status'](0x193)[_0xe6c0('0x15')]({'message':util['format'](_0xe6c0('0x16'),_0x4fa26f)});}_0x5e4d5f();})[_0xe6c0('0x17')](function(_0x553271){_0x5e4d5f(_0x553271);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xe6c0('0x18')}]}});}exports[_0xe6c0('0x19')]=isUserLimit; \ No newline at end of file +var _0xf492=['hasOwnProperty','License','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','utf8','parse'];(function(_0x159152,_0x174251){var _0x50a4aa=function(_0x1a46f7){while(--_0x1a46f7){_0x159152['push'](_0x159152['shift']());}};_0x50a4aa(++_0x174251);}(_0xf492,0xe2));var _0x2f49=function(_0x2b507a,_0x2c757b){_0x2b507a=_0x2b507a-0x0;var _0x5258d9=_0xf492[_0x2b507a];return _0x5258d9;};'use strict';var crypto=require(_0x2f49('0x0'));var util=require(_0x2f49('0x1'));var compose=require(_0x2f49('0x2'));var db=require(_0x2f49('0x3'))['db'];var config=require(_0x2f49('0x4'));function getValueFromLicense(_0x57bc26,_0x572e80){if(_0x57bc26&&_0x572e80){if(_0x572e80[_0x2f49('0x5')]&&_0x572e80[_0x2f49('0x6')]){var _0x521515=_0x572e80[_0x2f49('0x5')];var _0x12afd6=_0x572e80['license'];var _0x175887=_0x521515[_0x2f49('0x7')]('-')[0x4];var _0x46a643=_0x521515[_0x2f49('0x7')]('-')[0x0];var _0x40756b=crypto['createDecipher'](_0x2f49('0x8'),util[_0x2f49('0x9')](_0x2f49('0xa'),_0x175887,_0x521515,_0x46a643));var _0x1f6a49=_0x40756b[_0x2f49('0xb')](_0x12afd6,'base64',_0x2f49('0xc'));_0x1f6a49+=_0x40756b['final'](_0x2f49('0xc'));var _0x5c7149=JSON[_0x2f49('0xd')](_0x1f6a49);return _0x5c7149[_0x2f49('0xe')](_0x57bc26)?_0x5c7149[_0x57bc26]:null;}}return null;}function isLimit(_0x1e4b68,_0x4e995e,_0x41bea4,_0xfa667c){var _0x338d4c=_0x4e995e;return compose()['use'](function(_0x466b20,_0x244fc7,_0x210989){return db[_0x2f49('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x40a3a1){var _0x587380=getValueFromLicense(_0x1e4b68,_0x40a3a1);return _0x587380?_0x587380:_0x338d4c;})[_0x2f49('0x10')](function(_0x492f7e){_0x338d4c=_0x492f7e;return _0x41bea4['count'](_0xfa667c);})[_0x2f49('0x10')](function(_0x3a042f){if(_0x3a042f>=_0x338d4c){return _0x244fc7[_0x2f49('0x11')](0x193)['json']({'message':util[_0x2f49('0x9')](_0x2f49('0x12'),_0x1e4b68)});}_0x210989();})[_0x2f49('0x13')](function(_0x13503d){_0x210989(_0x13503d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x2f49('0x14')],{'where':{'$or':[{'role':_0x2f49('0x15')},{'role':_0x2f49('0x16')}]}});}exports[_0x2f49('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 84eb6ea..4209cfd 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 _0x0fae=['>\x20?','<=\x20?','$gte','>=\x20?','start','shift','utcOffset','hours','add','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','split','slice','forEach','match','filter','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x0fae,0x79));var _0xe0fa=function(_0x59fd85,_0x507b62){_0x59fd85=_0x59fd85-0x0;var _0x599021=_0x0fae[_0x59fd85];return _0x599021;};'use strict';var _=require(_0xe0fa('0x0'));var moment=require('moment');exports[_0xe0fa('0x1')]=function(_0x110b3e){var _0x3918b3={'conditions':[]};_0x3918b3['sqlOperator']=_[_0xe0fa('0x2')](_0x110b3e,_0xe0fa('0x3'))?'or':_0xe0fa('0x4');var _0x32deb8=_0x110b3e['replace']('[$and]','')[_0xe0fa('0x5')](_0xe0fa('0x3'),'')[_0xe0fa('0x6')]('||');for(var _0xb9b2dc=0x0;_0xb9b2dc<_0x32deb8['length'];_0xb9b2dc++){var _0x1de53d=_0x32deb8[_0xb9b2dc][_0xe0fa('0x6')](':=');var _0x4a6f32=_0x1de53d[0x0];var _0x49763f=_0x1de53d[_0xe0fa('0x7')](0x1);_0x49763f[_0xe0fa('0x8')](function(_0x352803){var _0x505ce2=_0x352803[_0xe0fa('0x6')]('[')['shift']();var _0x1ca069=_0x352803[_0xe0fa('0x9')](/\[(.*?)\]/g);_0x1ca069['forEach'](function(_0x2df0b0){var _0x4090f1=_0x2df0b0[_0xe0fa('0x6')]('[')[_0xe0fa('0xa')](function(_0x38ecff){return _0x38ecff['indexOf'](']')>-0x1;})[_0xe0fa('0xb')](function(_0x2c1110){return _0x2c1110['split'](']')[0x0];})[0x0];_0x3918b3['conditions'][_0xe0fa('0xc')]({'field':_0x4a6f32,'operator':_0x505ce2,'value':_0x4090f1});});});}return _0x3918b3;};exports[_0xe0fa('0xd')]=function(_0x1f1186,_0x214794,_0x257a38){var _0x582ffd={};if(_0x214794===_0xe0fa('0xe')){if(_0x257a38[_0xe0fa('0xf')]===_0xe0fa('0x10')){_0x257a38[_0xe0fa('0xf')]=_0xe0fa('0x11');_0x257a38[_0xe0fa('0x12')]+=','+_0x257a38[_0xe0fa('0x12')];}else if(_[_0xe0fa('0x13')]([_0xe0fa('0x14'),_0xe0fa('0x15')],_0x257a38[_0xe0fa('0xf')])){_0x257a38[_0xe0fa('0x12')]=moment(_0x257a38[_0xe0fa('0x12')])['add'](0x1,_0xe0fa('0x16'))[_0xe0fa('0x17')](_0xe0fa('0x18'));}}if(_0x257a38[_0xe0fa('0x19')]){_0x214794=_0x257a38['castTo'];_0x582ffd['text']=_0xe0fa('0x1a')+_0x1f1186+'.'+_0x257a38[_0xe0fa('0x1b')]+_0xe0fa('0x1c')+_0x257a38[_0xe0fa('0x19')]+')\x20'+parseOperator(_0x257a38[_0xe0fa('0xf')]);}else{_0x582ffd['text']=_0x1f1186+'.'+_0x257a38[_0xe0fa('0x1b')]+'\x20'+parseOperator(_0x257a38['operator']);}if(_[_0xe0fa('0x13')]([_0xe0fa('0x1d'),_0xe0fa('0x1e')],_0x257a38[_0xe0fa('0xf')]))_0x582ffd[_0xe0fa('0x1f')]='('+_0x582ffd[_0xe0fa('0x1f')]+_0xe0fa('0x20')+_0x1f1186+'.'+_0x257a38[_0xe0fa('0x1b')]+_0xe0fa('0x21');_0x582ffd[_0xe0fa('0x12')]=parseValue(_0x214794,_0x257a38['operator'],_0x257a38[_0xe0fa('0x12')]);return _0x582ffd;};function parseOperator(_0xb1ed56){var _0xb17e5b;switch(_0xb1ed56){case _0xe0fa('0x22'):_0xb17e5b=_0xe0fa('0x23');break;case _0xe0fa('0x1e'):_0xb17e5b=_0xe0fa('0x24');break;case'$eq':_0xb17e5b=_0xe0fa('0x25');break;case _0xe0fa('0x1d'):_0xb17e5b=_0xe0fa('0x26');break;case _0xe0fa('0x27'):case _0xe0fa('0x28'):case _0xe0fa('0x29'):_0xb17e5b=_0xe0fa('0x2a');break;case _0xe0fa('0x2b'):_0xb17e5b='<\x20?';break;case _0xe0fa('0x14'):_0xb17e5b=_0xe0fa('0x2c');break;case _0xe0fa('0x15'):_0xb17e5b=_0xe0fa('0x2d');break;case _0xe0fa('0x2e'):_0xb17e5b=_0xe0fa('0x2f');break;case _0xe0fa('0x11'):_0xb17e5b='BETWEEN\x20?\x20AND\x20?';break;}return _0xb17e5b;}function parseValue(_0x2dafda,_0x425254,_0x4b2918){var _0x50a343={'start':undefined,'end':undefined};switch(_0x425254){case _0xe0fa('0x22'):case _0xe0fa('0x1e'):_0x50a343['start']=_0x4b2918[_0xe0fa('0x6')](',');break;case _0xe0fa('0x27'):_0x50a343['start']='%'+_0x4b2918+'%';break;case _0xe0fa('0x28'):_0x50a343[_0xe0fa('0x30')]=_0x4b2918+'%';break;case _0xe0fa('0x29'):_0x50a343[_0xe0fa('0x30')]='%'+_0x4b2918;break;case _0xe0fa('0x11'):var _0x88587b=_0x4b2918[_0xe0fa('0x6')](',');var _0x4b2918=_0x88587b[_0xe0fa('0x31')]();var _0x17b282=_0x88587b['pop']();if(_0x2dafda===_0xe0fa('0xe')){_0x4b2918=moment(_0x4b2918)[_0xe0fa('0x32')](0x0,!![])['format']();_0x17b282=moment(_0x17b282)[_0xe0fa('0x32')](0x0,!![])['add'](0x17,_0xe0fa('0x33'))[_0xe0fa('0x34')](0x3b,_0xe0fa('0x35'))['add'](0x3b,_0xe0fa('0x36'))['format']();}_0x50a343={'start':_0x4b2918,'end':_0x17b282};break;default:_0x50a343[_0xe0fa('0x30')]=_0x4b2918;break;}return _0x50a343;} \ No newline at end of file +var _0x34db=['$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$startsWith','shift','pop','utcOffset','add','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','length','slice','split','match','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','<>\x20?'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x34db,0x162));var _0xb34d=function(_0xa8b861,_0x4d9c09){_0xa8b861=_0xa8b861-0x0;var _0xa4e1ab=_0x34db[_0xa8b861];return _0xa4e1ab;};'use strict';var _=require(_0xb34d('0x0'));var moment=require(_0xb34d('0x1'));exports[_0xb34d('0x2')]=function(_0x26f1f5){var _0x48aabc={'conditions':[]};_0x48aabc[_0xb34d('0x3')]=_['startsWith'](_0x26f1f5,_0xb34d('0x4'))?'or':_0xb34d('0x5');var _0x5ded0d=_0x26f1f5[_0xb34d('0x6')](_0xb34d('0x7'),'')[_0xb34d('0x6')]('[$or]','')['split']('||');for(var _0x17a25c=0x0;_0x17a25c<_0x5ded0d[_0xb34d('0x8')];_0x17a25c++){var _0x7604b1=_0x5ded0d[_0x17a25c]['split'](':=');var _0x47b987=_0x7604b1[0x0];var _0x1d8a97=_0x7604b1[_0xb34d('0x9')](0x1);_0x1d8a97['forEach'](function(_0x340c07){var _0x296c31=_0x340c07[_0xb34d('0xa')]('[')['shift']();var _0x4d179c=_0x340c07[_0xb34d('0xb')](/\[(.*?)\]/g);_0x4d179c[_0xb34d('0xc')](function(_0x28810a){var _0x466cf2=_0x28810a[_0xb34d('0xa')]('[')[_0xb34d('0xd')](function(_0x3bcd45){return _0x3bcd45[_0xb34d('0xe')](']')>-0x1;})[_0xb34d('0xf')](function(_0x3216bf){return _0x3216bf[_0xb34d('0xa')](']')[0x0];})[0x0];_0x48aabc[_0xb34d('0x10')][_0xb34d('0x11')]({'field':_0x47b987,'operator':_0x296c31,'value':_0x466cf2});});});}return _0x48aabc;};exports[_0xb34d('0x12')]=function(_0x3453ae,_0xbb9565,_0xb28ef8){var _0x2eddd0={};if(_0xbb9565==='DATE'){if(_0xb28ef8[_0xb34d('0x13')]===_0xb34d('0x14')){_0xb28ef8[_0xb34d('0x13')]=_0xb34d('0x15');_0xb28ef8[_0xb34d('0x16')]+=','+_0xb28ef8[_0xb34d('0x16')];}else if(_[_0xb34d('0x17')]([_0xb34d('0x18'),'$lte'],_0xb28ef8[_0xb34d('0x13')])){_0xb28ef8[_0xb34d('0x16')]=moment(_0xb28ef8['value'])['add'](0x1,_0xb34d('0x19'))[_0xb34d('0x1a')](_0xb34d('0x1b'));}}if(_0xb28ef8[_0xb34d('0x1c')]){_0xbb9565=_0xb28ef8['castTo'];_0x2eddd0[_0xb34d('0x1d')]='CAST('+_0x3453ae+'.'+_0xb28ef8[_0xb34d('0x1e')]+_0xb34d('0x1f')+_0xb28ef8[_0xb34d('0x1c')]+')\x20'+parseOperator(_0xb28ef8[_0xb34d('0x13')]);}else{_0x2eddd0[_0xb34d('0x1d')]=_0x3453ae+'.'+_0xb28ef8[_0xb34d('0x1e')]+'\x20'+parseOperator(_0xb28ef8[_0xb34d('0x13')]);}if(_['includes']([_0xb34d('0x20'),_0xb34d('0x21')],_0xb28ef8[_0xb34d('0x13')]))_0x2eddd0[_0xb34d('0x1d')]='('+_0x2eddd0[_0xb34d('0x1d')]+_0xb34d('0x22')+_0x3453ae+'.'+_0xb28ef8['field']+'\x20IS\x20NULL)';_0x2eddd0[_0xb34d('0x16')]=parseValue(_0xbb9565,_0xb28ef8['operator'],_0xb28ef8[_0xb34d('0x16')]);return _0x2eddd0;};function parseOperator(_0x1f9030){var _0x5abc4f;switch(_0x1f9030){case'$in':_0x5abc4f=_0xb34d('0x23');break;case _0xb34d('0x21'):_0x5abc4f=_0xb34d('0x24');break;case _0xb34d('0x14'):_0x5abc4f='=\x20?';break;case _0xb34d('0x20'):_0x5abc4f=_0xb34d('0x25');break;case'$substring':case'$startsWith':case _0xb34d('0x26'):_0x5abc4f=_0xb34d('0x27');break;case _0xb34d('0x28'):_0x5abc4f='<\x20?';break;case _0xb34d('0x18'):_0x5abc4f=_0xb34d('0x29');break;case _0xb34d('0x2a'):_0x5abc4f=_0xb34d('0x2b');break;case _0xb34d('0x2c'):_0x5abc4f=_0xb34d('0x2d');break;case _0xb34d('0x15'):_0x5abc4f=_0xb34d('0x2e');break;}return _0x5abc4f;}function parseValue(_0x4dac5d,_0x5aa6b8,_0x34cfea){var _0xf58ab9={'start':undefined,'end':undefined};switch(_0x5aa6b8){case _0xb34d('0x2f'):case _0xb34d('0x21'):_0xf58ab9[_0xb34d('0x30')]=_0x34cfea[_0xb34d('0xa')](',');break;case _0xb34d('0x31'):_0xf58ab9[_0xb34d('0x30')]='%'+_0x34cfea+'%';break;case _0xb34d('0x32'):_0xf58ab9[_0xb34d('0x30')]=_0x34cfea+'%';break;case _0xb34d('0x26'):_0xf58ab9[_0xb34d('0x30')]='%'+_0x34cfea;break;case'$between':var _0x191e29=_0x34cfea[_0xb34d('0xa')](',');var _0x34cfea=_0x191e29[_0xb34d('0x33')]();var _0x155b6b=_0x191e29[_0xb34d('0x34')]();if(_0x4dac5d==='DATE'){_0x34cfea=moment(_0x34cfea)[_0xb34d('0x35')](0x0,!![])['format']();_0x155b6b=moment(_0x155b6b)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0xb34d('0x36')](0x3b,'minutes')[_0xb34d('0x36')](0x3b,_0xb34d('0x37'))[_0xb34d('0x1a')]();}_0xf58ab9={'start':_0x34cfea,'end':_0x155b6b};break;default:_0xf58ab9['start']=_0x34cfea;break;}return _0xf58ab9;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e4a7178..bee0240 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 _0x7da7=['attributes','length','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','limit','offset','sort','map','indexOf','priority','cast','unsigned','DESC','col','ASC','isEmpty','isArray','omit','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters'];(function(_0x521c3b,_0x44654f){var _0x4d4309=function(_0x42b263){while(--_0x42b263){_0x521c3b['push'](_0x521c3b['shift']());}};_0x4d4309(++_0x44654f);}(_0x7da7,0x10d));var _0x77da=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x7da7[_0x459a0a];return _0x4ab46c;};'use strict';var _=require(_0x77da('0x0'));var sequelize=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x571213){var _0x59892b=['ne'];try{var _0x37667b=JSON[_0x77da('0x3')](_0x571213);var _0x4f60c3=Object[_0x77da('0x4')](_0x37667b)[0x0];return _0x59892b[_0x77da('0x5')](_0x4f60c3);}catch(_0x56458c){return![];}}function getOperatorValue(_0x19331c){var _0xc54a12=JSON['parse'](_0x19331c);var _0x30afe0=Object['keys'](_0xc54a12)[0x0];var _0x1191de=_0xc54a12[_0x30afe0];return{['$'+_0x30afe0]:_0x1191de};}exports[_0x77da('0x6')]=function(_0x37c5ab){var _0x910e5b=null;if(_0x37c5ab){_0x910e5b=_0x37c5ab[_0x77da('0x7')](',');}return _0x910e5b;};exports['filters']=function(_0x40c86e,_0xb55827){var _0x172d7f={};if(!_['isEmpty'](_0x40c86e)){_[_0x77da('0x8')](_0x40c86e,function(_0x1ab717,_0x163350){try{if(_0xb55827){var _0x2a675a=_['find'](_0xb55827,{'name':_0x163350})||{};if(hasSequelizeOperator(_0x1ab717)){_0x172d7f[_0x163350]=getOperatorValue(_0x1ab717);}else if(_0x2a675a[_0x77da('0x9')]===_0x77da('0xa')&&_[_0x77da('0xb')](_0x1ab717)){var _0x5d6e2f=JSON['parse'](_0x1ab717);var _0x26e3ff={'$gte':moment(moment(_0x5d6e2f[_0x77da('0xc')])['format'](_0x77da('0xd')))[_0x77da('0xe')]()[_0x77da('0xf')](),'$lte':moment(moment(_0x5d6e2f[_0x77da('0x10')])['format'](_0x77da('0xd')))['utc']()[_0x77da('0x11')](0x1,'s')[_0x77da('0xf')]()};_0x172d7f[_0x163350]=_0x26e3ff;}else if(_0x2a675a[_0x77da('0x12')]===_0x77da('0x13')){_0x172d7f[_0x163350]=_0x1ab717;}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}catch(_0x103e46){_0x172d7f[_0x163350]=_0x1ab717[_0x77da('0x7')](',');}});}return _0x172d7f;};exports[_0x77da('0x14')]=function(_0x335dcb){_0x335dcb=parseInt(_0x335dcb,0xa);if(!_0x335dcb||_0x335dcb<0x0){_0x335dcb=LIMIT_VALUE;}return _0x335dcb;};exports[_0x77da('0x15')]=function(_0x12d2b1){_0x12d2b1=parseInt(_0x12d2b1,0xa);if(!_0x12d2b1||_0x12d2b1<0x0){_0x12d2b1=0x0;}return _0x12d2b1;};exports[_0x77da('0x16')]=function(_0x3b6dde){var _0x544104,_0x492063=null;if(_0x3b6dde){_0x544104=_0x3b6dde[_0x77da('0x7')](',');_0x492063=_[_0x77da('0x17')](_0x544104,function(_0x507979){if(_0x507979[_0x77da('0x18')]('-')===0x0){return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize['col']('priority'),_0x77da('0x1b')):_0x507979['substr'](0x1),_0x77da('0x1c')];}else{return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize[_0x77da('0x1d')](_0x77da('0x19')),_0x77da('0x1b')):_0x507979,_0x77da('0x1e')];}});}return _0x492063;};exports['omit']=function(_0x4885ec,_0xfd160){if(_[_0x77da('0x1f')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x20')](_0x4885ec)){for(var _0xbd06b7=0x0;_0xbd06b7<_0x4885ec['length'];_0xbd06b7+=0x1){_0x4885ec[_0xbd06b7]=this[_0x77da('0x21')](_0x4885ec[_0xbd06b7],_0xfd160);}return _0x4885ec;}if(!_[_0x77da('0x22')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x23')](_0xfd160)){_0xfd160=[_0xfd160];}if(!_[_0x77da('0x20')](_0xfd160)){return _0x4885ec;}for(var _0x446ae7=0x0;_0x446ae7<_0xfd160['length'];_0x446ae7+=0x1){_[_0x77da('0x24')](_0x4885ec,_0xfd160[_0x446ae7]);}for(var _0x3e090d in _0x4885ec){if(_0x4885ec[_0x77da('0x25')](_0x3e090d)){_0x4885ec[_0x3e090d]=this[_0x77da('0x21')](_0x4885ec[_0x3e090d],_0xfd160);}}return _0x4885ec;};exports['isNumeric']=function(_0x5b4638){return _0x5b4638['match'](RegExp(_0x77da('0x26')))?!![]:![];};exports[_0x77da('0x27')]=function(_0x410d09){return _0x410d09[_0x77da('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x77da('0x29')]=function(_0x4eeb99){var _0x350b4e=[];_0x4eeb99[_0x77da('0x7')](/[ ,]+/)[_0x77da('0x2a')](function(_0x1d381b){_0x1d381b=_0x1d381b[_0x77da('0x2b')](/([^:]")"+/g,'$1');_0x1d381b='+'+_0x1d381b+'*';var _0x46e6b4=/[ `!@#$%^&*()_\-?~]/;if(_0x1d381b['match'](_0x46e6b4))_0x1d381b='\x22'+_0x1d381b+'\x22';_0x350b4e[_0x77da('0x2c')](_0x1d381b);});return _0x350b4e[_0x77da('0x2d')]('\x20');};exports[_0x77da('0x2e')]=function(_0x38643a,_0x3c3c64,_0x12ea16){var _0x3343b4={},_0x2c790d={};if(_0x3c3c64['query']['$id']){_0x3c3c64[_0x77da('0x2f')]['id']=_0x3c3c64[_0x77da('0x2f')]['$id'];delete _0x3c3c64[_0x77da('0x2f')][_0x77da('0x30')];}_0x3343b4[_0x77da('0x31')]=_[_0x77da('0x17')](_0x38643a,_0x77da('0x12'));_0x3343b4[_0x77da('0x2f')]=_[_0x77da('0x4')](_0x3c3c64['query']);_0x3343b4[_0x77da('0x32')]=_['intersection'](_0x3343b4['model'],_0x3343b4['query']);_0x2c790d[_0x77da('0x33')]=_['intersection'](_0x3343b4[_0x77da('0x31')],this[_0x77da('0x6')](_0x3c3c64[_0x77da('0x2f')][_0x77da('0x6')]));_0x2c790d[_0x77da('0x33')]=_0x2c790d[_0x77da('0x33')][_0x77da('0x34')]?_0x2c790d['attributes']:_0x3343b4[_0x77da('0x31')];if(!_0x3c3c64[_0x77da('0x2f')][_0x77da('0x25')](_0x77da('0x35'))){_0x2c790d[_0x77da('0x14')]=this[_0x77da('0x14')](_0x3c3c64['query'][_0x77da('0x14')]);_0x2c790d[_0x77da('0x15')]=this[_0x77da('0x15')](_0x3c3c64['query'][_0x77da('0x15')]);}_0x2c790d['order']=this['sort'](_0x3c3c64['query']['sort']);_0x2c790d[_0x77da('0x36')]=this[_0x77da('0x32')](_[_0x77da('0x37')](_0x3c3c64['query'],_0x3343b4[_0x77da('0x32')]),_0x38643a);if(_0x3c3c64['query'][_0x77da('0x38')]){var _0x517bd0=_0x38643a;var _0x3c216f=_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')];if(typeof _0x3c216f===_0x77da('0x39')){_0x517bd0=_[_0x77da('0x38')](_0x38643a,function(_0x5ecf12){return _[_0x77da('0x5')](_0x3c216f[_0x77da('0x3a')],_0x5ecf12[_0x77da('0x12')]);});_0x3c216f=_0x3c216f[_0x77da('0x3b')];}_0x2c790d[_0x77da('0x36')]=_[_0x77da('0x3c')](_0x2c790d['where'],{'$or':_[_0x77da('0x17')](_0x517bd0,function(_0x2f0495){if(_0x2f0495[_0x77da('0x9')]!==_0x77da('0x3d')){if(_0x12ea16){return sequelize[_0x77da('0x36')](sequelize['fn'](_0x77da('0x3e'),sequelize['col'](_0x2f0495[_0x77da('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%')});}else{var _0x40a492={};_0x40a492[_0x2f0495['name']]={'$like':'%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%'};return _0x40a492;}}})});}_0x2c790d=_[_0x77da('0x3c')]({},_0x2c790d,_0x3c3c64[_0x77da('0x3f')]);return _0x2c790d;}; \ No newline at end of file +var _0xf2ca=['isArray','split','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','attributes','nolimit','order','where','pick','filter','object','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid'];(function(_0x53083a,_0x587d9a){var _0x1a3c48=function(_0x57231b){while(--_0x57231b){_0x53083a['push'](_0x53083a['shift']());}};_0x1a3c48(++_0x587d9a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0xf2ca[_0x7ea1fb];return _0x478241;};'use strict';var _=require(_0xaf2c('0x0'));var sequelize=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x598667){var _0xbb7f52=['ne'];try{var _0x2102e2=JSON[_0xaf2c('0x3')](_0x598667);var _0x219511=Object[_0xaf2c('0x4')](_0x2102e2)[0x0];return _0xbb7f52[_0xaf2c('0x5')](_0x219511);}catch(_0x5b8c81){return![];}}function getOperatorValue(_0x1fd101){var _0x100d17=JSON[_0xaf2c('0x3')](_0x1fd101);var _0x1f9531=Object['keys'](_0x100d17)[0x0];var _0x37fedd=_0x100d17[_0x1f9531];return{['$'+_0x1f9531]:_0x37fedd};}exports[_0xaf2c('0x6')]=function(_0x4a7397){var _0x2a011d=null;if(_0x4a7397){_0x2a011d=_0x4a7397['split'](',');}return _0x2a011d;};exports[_0xaf2c('0x7')]=function(_0x4a0064,_0x2f5099){var _0x144a7a={};if(!_[_0xaf2c('0x8')](_0x4a0064)){_[_0xaf2c('0x9')](_0x4a0064,function(_0x5ad9b0,_0x4adc8c){try{if(_0x2f5099){var _0x2c0d88=_[_0xaf2c('0xa')](_0x2f5099,{'name':_0x4adc8c})||{};if(hasSequelizeOperator(_0x5ad9b0)){_0x144a7a[_0x4adc8c]=getOperatorValue(_0x5ad9b0);}else if(_0x2c0d88[_0xaf2c('0xb')]===_0xaf2c('0xc')&&_[_0xaf2c('0xd')](_0x5ad9b0)){var _0x59a59b=JSON['parse'](_0x5ad9b0);var _0x15ccb4={'$gte':moment(moment(_0x59a59b[_0xaf2c('0xe')])[_0xaf2c('0xf')](_0xaf2c('0x10')))[_0xaf2c('0x11')]()[_0xaf2c('0xf')](),'$lte':moment(moment(_0x59a59b[_0xaf2c('0x12')])[_0xaf2c('0xf')](_0xaf2c('0x10')))[_0xaf2c('0x11')]()[_0xaf2c('0x13')](0x1,'s')[_0xaf2c('0xf')]()};_0x144a7a[_0x4adc8c]=_0x15ccb4;}else if(_0x2c0d88[_0xaf2c('0x14')]===_0xaf2c('0x15')){_0x144a7a[_0x4adc8c]=_0x5ad9b0;}else{_0x144a7a[_0x4adc8c]=_[_0xaf2c('0x16')](_0x5ad9b0)?_0x5ad9b0:JSON['parse'](_0x5ad9b0);}}else{_0x144a7a[_0x4adc8c]=_[_0xaf2c('0x16')](_0x5ad9b0)?_0x5ad9b0:JSON['parse'](_0x5ad9b0);}}catch(_0x278a28){_0x144a7a[_0x4adc8c]=_0x5ad9b0[_0xaf2c('0x17')](',');}});}return _0x144a7a;};exports[_0xaf2c('0x18')]=function(_0x578492){_0x578492=parseInt(_0x578492,0xa);if(!_0x578492||_0x578492<0x0){_0x578492=LIMIT_VALUE;}return _0x578492;};exports[_0xaf2c('0x19')]=function(_0x297bcd){_0x297bcd=parseInt(_0x297bcd,0xa);if(!_0x297bcd||_0x297bcd<0x0){_0x297bcd=0x0;}return _0x297bcd;};exports[_0xaf2c('0x1a')]=function(_0x20000b){var _0x3f977c,_0x1b7f07=null;if(_0x20000b){_0x3f977c=_0x20000b['split'](',');_0x1b7f07=_[_0xaf2c('0x1b')](_0x3f977c,function(_0x164bcb){if(_0x164bcb[_0xaf2c('0x1c')]('-')===0x0){return[_0x164bcb===_0xaf2c('0x1d')?sequelize[_0xaf2c('0x1e')](sequelize['col'](_0xaf2c('0x1d')),_0xaf2c('0x1f')):_0x164bcb[_0xaf2c('0x20')](0x1),'DESC'];}else{return[_0x164bcb==='priority'?sequelize[_0xaf2c('0x1e')](sequelize[_0xaf2c('0x21')](_0xaf2c('0x1d')),_0xaf2c('0x1f')):_0x164bcb,'ASC'];}});}return _0x1b7f07;};exports[_0xaf2c('0x22')]=function(_0xf1a7cf,_0x3a0145){if(_[_0xaf2c('0x8')](_0xf1a7cf)){return _0xf1a7cf;}if(_[_0xaf2c('0x16')](_0xf1a7cf)){for(var _0xff396f=0x0;_0xff396f<_0xf1a7cf[_0xaf2c('0x23')];_0xff396f+=0x1){_0xf1a7cf[_0xff396f]=this['omit'](_0xf1a7cf[_0xff396f],_0x3a0145);}return _0xf1a7cf;}if(!_[_0xaf2c('0x24')](_0xf1a7cf)){return _0xf1a7cf;}if(_[_0xaf2c('0x25')](_0x3a0145)){_0x3a0145=[_0x3a0145];}if(!_[_0xaf2c('0x16')](_0x3a0145)){return _0xf1a7cf;}for(var _0x410536=0x0;_0x410536<_0x3a0145['length'];_0x410536+=0x1){_[_0xaf2c('0x26')](_0xf1a7cf,_0x3a0145[_0x410536]);}for(var _0x589d47 in _0xf1a7cf){if(_0xf1a7cf[_0xaf2c('0x27')](_0x589d47)){_0xf1a7cf[_0x589d47]=this[_0xaf2c('0x22')](_0xf1a7cf[_0x589d47],_0x3a0145);}}return _0xf1a7cf;};exports[_0xaf2c('0x28')]=function(_0x5d685a){return _0x5d685a[_0xaf2c('0x29')](RegExp(_0xaf2c('0x2a')))?!![]:![];};exports[_0xaf2c('0x2b')]=function(_0x4a96d2){return _0x4a96d2[_0xaf2c('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xaf2c('0x2c')]=function(_0x42e2a5){var _0x19364e=[];_0x42e2a5['split'](/[ ,]+/)[_0xaf2c('0x2d')](function(_0x4072ff){_0x4072ff=_0x4072ff[_0xaf2c('0x2e')](/([^:]")"+/g,'$1');_0x4072ff='+'+_0x4072ff+'*';var _0x51a49c=/[ `!@#$%^&*()_\-?~]/;if(_0x4072ff['match'](_0x51a49c))_0x4072ff='\x22'+_0x4072ff+'\x22';_0x19364e[_0xaf2c('0x2f')](_0x4072ff);});return _0x19364e['join']('\x20');};exports[_0xaf2c('0x30')]=function(_0x5e7247,_0x337cea,_0x1e4de2){var _0x4ffbb9={},_0x1408e3={};if(_0x337cea[_0xaf2c('0x31')]['$id']){_0x337cea[_0xaf2c('0x31')]['id']=_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x32')];delete _0x337cea[_0xaf2c('0x31')][_0xaf2c('0x32')];}_0x4ffbb9[_0xaf2c('0x33')]=_['map'](_0x5e7247,_0xaf2c('0x14'));_0x4ffbb9['query']=_[_0xaf2c('0x4')](_0x337cea['query']);_0x4ffbb9[_0xaf2c('0x7')]=_['intersection'](_0x4ffbb9[_0xaf2c('0x33')],_0x4ffbb9['query']);_0x1408e3[_0xaf2c('0x34')]=_['intersection'](_0x4ffbb9[_0xaf2c('0x33')],this[_0xaf2c('0x6')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x6')]));_0x1408e3[_0xaf2c('0x34')]=_0x1408e3['attributes']['length']?_0x1408e3[_0xaf2c('0x34')]:_0x4ffbb9[_0xaf2c('0x33')];if(!_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x27')](_0xaf2c('0x35'))){_0x1408e3[_0xaf2c('0x18')]=this['limit'](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x18')]);_0x1408e3['offset']=this[_0xaf2c('0x19')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x19')]);}_0x1408e3[_0xaf2c('0x36')]=this[_0xaf2c('0x1a')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x1a')]);_0x1408e3[_0xaf2c('0x37')]=this[_0xaf2c('0x7')](_[_0xaf2c('0x38')](_0x337cea[_0xaf2c('0x31')],_0x4ffbb9[_0xaf2c('0x7')]),_0x5e7247);if(_0x337cea[_0xaf2c('0x31')]['filter']){var _0x54a953=_0x5e7247;var _0x4db7d0=_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x39')];if(typeof _0x4db7d0===_0xaf2c('0x3a')){_0x54a953=_[_0xaf2c('0x39')](_0x5e7247,function(_0x715f39){return _[_0xaf2c('0x5')](_0x4db7d0['columns'],_0x715f39[_0xaf2c('0x14')]);});_0x4db7d0=_0x4db7d0[_0xaf2c('0x3b')];}_0x1408e3[_0xaf2c('0x37')]=_['merge'](_0x1408e3['where'],{'$or':_[_0xaf2c('0x1b')](_0x54a953,function(_0x4f8440){if(_0x4f8440[_0xaf2c('0xb')]!==_0xaf2c('0x3c')){if(_0x1e4de2){return sequelize[_0xaf2c('0x37')](sequelize['fn'](_0xaf2c('0x3d'),sequelize['col'](_0x4f8440[_0xaf2c('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x39')]+'%')});}else{var _0x58bd9b={};_0x58bd9b[_0x4f8440[_0xaf2c('0x14')]]={'$like':'%'+_0x337cea['query'][_0xaf2c('0x39')]+'%'};return _0x58bd9b;}}})});}_0x1408e3=_[_0xaf2c('0x3e')]({},_0x1408e3,_0x337cea[_0xaf2c('0x3f')]);return _0x1408e3;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e188d42..e196efb 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 4408d97..168e557 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 _0xd985=['substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','length','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','map','model','join','createHash','update','hex','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','md5','digest'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd985,0x101));var _0x5d98=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xd985[_0x34aec4];return _0x51e1a7;};'use strict';var _=require(_0x5d98('0x0'));var os=require('os');var crypto=require(_0x5d98('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x5d98('0x2'))[_0x5d98('0x3')];var config=require('../environment');function getInterfaces(){var _0x33bd0c=[];var _0x1105f6=os[_0x5d98('0x4')]();var _0x16ca47=_[_0x5d98('0x5')](_['keys'](_0x1105f6));for(var _0x2886ec=0x0;_0x2886ec<_0x16ca47[_0x5d98('0x6')];_0x2886ec++){var _0x5040a9=_0x1105f6[_0x16ca47[_0x2886ec]]['filter'](function(_0x7acb9f){return _0x7acb9f['family']===_0x5d98('0x7')&&_0x7acb9f[_0x5d98('0x8')]===![];});_0x33bd0c=_0x33bd0c[_0x5d98('0x9')](_0x5040a9);}return _0x33bd0c;}function getFirstInterface(){var _0x5c951d=_[_0x5d98('0xa')](getInterfaces());return{'macAddress':_0x5c951d&&_0x5c951d[_0x5d98('0xb')]?_0x5c951d['mac']:'00:00:00:00:00:00','ipAddress':_0x5c951d&&_0x5c951d[_0x5d98('0xc')]?_0x5c951d[_0x5d98('0xc')]:_0x5d98('0xd')};}exports[_0x5d98('0xe')]=getFirstInterface;function getCPUhash(){var _0x996939=_['orderBy'](os['cpus']()[_0x5d98('0xf')](function(_0x24da32){return _0x24da32[_0x5d98('0x10')];}))[_0x5d98('0x11')](':');return crypto[_0x5d98('0x12')]('md5')[_0x5d98('0x13')](_0x996939)['digest'](_0x5d98('0x14'));}exports['getUuid']=function(){var _0x2a9358=os[_0x5d98('0x15')]();var _0x2b74e9=/[0-9a-f-]{36}/;if(config[_0x5d98('0x16')]&&_0x2b74e9[_0x5d98('0x17')](config[_0x5d98('0x16')])){return config['licenseToken'];}else if(_0x2a9358==='win32'){return exec(_0x5d98('0x18'),{'encoding':_0x5d98('0x19')})[_0x5d98('0x1a')]('\x0d\x0a','');}else{var _0x138ef9=getFirstInterface();var _0x3a42f8=getCPUhash();var _0x3ff757=_0x3a42f8+'|'+os['hostname']()+'|'+_0x138ef9[_0x5d98('0x1b')]+'|'+_0x138ef9[_0x5d98('0x1c')];var _0x397b6f=crypto[_0x5d98('0x12')](_0x5d98('0x1d'))[_0x5d98('0x13')](_0x3ff757)[_0x5d98('0x1e')](_0x5d98('0x14'));return _0x397b6f[_0x5d98('0x1f')](0x0,0x8)+'-'+_0x397b6f['substring'](0x8,0xc)+'-'+_0x397b6f[_0x5d98('0x1f')](0xc,0x10)+'-'+_0x397b6f['substring'](0x10,0x14)+'-'+_0x397b6f[_0x5d98('0x1f')](0x14);}}; \ No newline at end of file +var _0x5450=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','platform','test','licenseToken'];(function(_0xaf48b,_0x46f3f7){var _0x29c85e=function(_0x5aa49f){while(--_0x5aa49f){_0xaf48b['push'](_0xaf48b['shift']());}};_0x29c85e(++_0x46f3f7);}(_0x5450,0xbc));var _0x0545=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5450[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x0545('0x0'));var os=require('os');var crypto=require(_0x0545('0x1'));var machine=require(_0x0545('0x2'));var exec=require(_0x0545('0x3'))[_0x0545('0x4')];var config=require(_0x0545('0x5'));function getInterfaces(){var _0x27cfd3=[];var _0x557015=os[_0x0545('0x6')]();var _0x16a44e=_[_0x0545('0x7')](_[_0x0545('0x8')](_0x557015));for(var _0x4e7532=0x0;_0x4e7532<_0x16a44e[_0x0545('0x9')];_0x4e7532++){var _0x2aadd0=_0x557015[_0x16a44e[_0x4e7532]]['filter'](function(_0x11fccd){return _0x11fccd['family']==='IPv4'&&_0x11fccd[_0x0545('0xa')]===![];});_0x27cfd3=_0x27cfd3[_0x0545('0xb')](_0x2aadd0);}return _0x27cfd3;}function getFirstInterface(){var _0x1a5e26=_[_0x0545('0xc')](getInterfaces());return{'macAddress':_0x1a5e26&&_0x1a5e26[_0x0545('0xd')]?_0x1a5e26[_0x0545('0xd')]:'00:00:00:00:00:00','ipAddress':_0x1a5e26&&_0x1a5e26[_0x0545('0xe')]?_0x1a5e26[_0x0545('0xe')]:_0x0545('0xf')};}exports[_0x0545('0x10')]=getFirstInterface;function getCPUhash(){var _0x3a33ea=_['orderBy'](os[_0x0545('0x11')]()[_0x0545('0x12')](function(_0x3e1093){return _0x3e1093[_0x0545('0x13')];}))[_0x0545('0x14')](':');return crypto[_0x0545('0x15')](_0x0545('0x16'))[_0x0545('0x17')](_0x3a33ea)['digest'](_0x0545('0x18'));}exports['getUuid']=function(){var _0x4c0bf6=os[_0x0545('0x19')]();var _0x5241ac=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5241ac[_0x0545('0x1a')](config[_0x0545('0x1b')])){return config[_0x0545('0x1b')];}else if(_0x4c0bf6===_0x0545('0x1c')){return exec(_0x0545('0x1d'),{'encoding':_0x0545('0x1e')})[_0x0545('0x1f')]('\x0d\x0a','');}else{var _0x430b54=getFirstInterface();var _0x50c4a5=getCPUhash();var _0x1370b0=_0x50c4a5+'|'+os['hostname']()+'|'+_0x430b54[_0x0545('0x20')]+'|'+_0x430b54[_0x0545('0x21')];var _0x13628c=crypto[_0x0545('0x15')](_0x0545('0x16'))[_0x0545('0x17')](_0x1370b0)[_0x0545('0x22')]('hex');return _0x13628c[_0x0545('0x23')](0x0,0x8)+'-'+_0x13628c['substring'](0x8,0xc)+'-'+_0x13628c[_0x0545('0x23')](0xc,0x10)+'-'+_0x13628c['substring'](0x10,0x14)+'-'+_0x13628c[_0x0545('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 58a37c1..6a35a42 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 _0x6253=['license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6253,0x73));var _0x3625=function(_0x49b060,_0x417fdf){_0x49b060=_0x49b060-0x0;var _0x9c1f08=_0x6253[_0x49b060];return _0x9c1f08;};'use strict';var util=require('util');var moment=require(_0x3625('0x0'));var rp=require(_0x3625('0x1'));var BPromise=require(_0x3625('0x2'));var pkginfo=require(_0x3625('0x3'))(module,_0x3625('0x4'));var db=require(_0x3625('0x5'))['db'];var encryptor=require(_0x3625('0x6'));var hardware=require('./hardware');var logger=require(_0x3625('0x7'))(_0x3625('0x8'));var HOST=_0x3625('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5447d7){return new BPromise(function(_0x278ac7,_0x2aaabb){var _0x55f07d=util[_0x3625('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x5447d7,module[_0x3625('0xb')][_0x3625('0x4')]);if(oldToken){_0x55f07d=util[_0x3625('0xa')](_0x3625('0xc'),HOST,_0x5447d7,module['exports'][_0x3625('0x4')],oldToken);}var _0x35727c={'uri':_0x55f07d,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x35727c)[_0x3625('0xd')](function(_0x2ad5b2){_0x278ac7(_0x2ad5b2);})[_0x3625('0xe')](function(_0x596158){_0x2aaabb(_0x596158);});});}function manageLicense(_0x50f185,_0x345e50){var _0x1dc692=_0x345e50['get']({'plain':!![]});if(!isOldTokenSent&&_0x1dc692[_0x3625('0xf')]!==_0x50f185&&!_0x1dc692[_0x3625('0x10')]){oldToken=_0x1dc692['data1'];}httpRequest(_0x50f185)[_0x3625('0xd')](function(_0x33a7af){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x33a7af[_0x3625('0x11')]){isOldTokenSent=![];if(!_0x1dc692[_0x3625('0x8')]&&_0x1dc692['license']!=_0x33a7af[_0x3625('0x8')]||_0x1dc692[_0x3625('0x8')]&&_0x1dc692['data2']){logger[_0x3625('0x12')](_0x3625('0x13'));}if(_0x1dc692[_0x3625('0x8')]&&!_0x1dc692[_0x3625('0x10')]&&_0x1dc692[_0x3625('0x8')]!=_0x33a7af[_0x3625('0x8')]){logger[_0x3625('0x12')](_0x3625('0x14'));}if(_0x1dc692[_0x3625('0x8')]&&!_0x1dc692[_0x3625('0x10')]&&_0x1dc692[_0x3625('0x8')]==_0x33a7af[_0x3625('0x8')]){return _0x345e50;}return _0x345e50['update']({'data1':_0x50f185,'data2':null,'license':_0x33a7af['license']});}else{if(_0x33a7af['license']||_0x1dc692[_0x3625('0x8')]){if(!_0x1dc692[_0x3625('0x10')]){if(_0x1dc692[_0x3625('0xf')]==_0x50f185){GRAY_PERIOD_REASON=_0x3625('0x15');logger[_0x3625('0x12')](_0x3625('0x16'));}else{GRAY_PERIOD_REASON=_0x3625('0x17');logger['info'](_0x3625('0x18'),_0x1dc692[_0x3625('0xf')],_0x50f185);}logger['info'](_0x3625('0x19'),GRAY_PERIOD_REASON[_0x3625('0x1a')](),moment()[_0x3625('0xa')](_0x3625('0x1b')));return _0x345e50[_0x3625('0x1c')]({'data2':encryptor[_0x3625('0x1d')](moment()[_0x3625('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x3625('0x1e')](encryptor[_0x3625('0x1f')](_0x1dc692[_0x3625('0x10')]),_0x3625('0x20'))>DAYS){logger['info'](_0x3625('0x21'),moment()['format'](_0x3625('0x1b')));isOldTokenSent=![];return _0x345e50[_0x3625('0x1c')]({'data1':_0x50f185,'data2':null,'license':null});}}}else{if(_0x1dc692['data1']!=_0x50f185){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1dc692['data1'],_0x50f185);return _0x345e50['update']({'data1':_0x50f185,'data2':null,'license':null});}}}return _0x345e50;})['then'](function(_0x17ee55){_0x345e50=_0x17ee55;})['catch'](function(_0x19a4e6){logger[_0x3625('0x22')](_0x19a4e6[_0x3625('0x23')]);})[_0x3625('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x3625('0x25')](),_0x345e50);},TIME);});}function defaultLicense(){var _0x1b8636=hardware['getUuid']();if(_0x1b8636){return db[_0x3625('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1b8636}})[_0x3625('0x27')](function(_0x57d53a,_0x4f4e83){logger[_0x3625('0x12')](_0x3625('0x28'),_0x1b8636);manageLicense(_0x1b8636,_0x57d53a);})[_0x3625('0xe')](function(_0x87bcbd){logger['error'](_0x87bcbd[_0x3625('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xfa7a=['catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then'];(function(_0x3af4d3,_0x2faf1c){var _0x430197=function(_0x1a6515){while(--_0x1a6515){_0x3af4d3['push'](_0x3af4d3['shift']());}};_0x430197(++_0x2faf1c);}(_0xfa7a,0x1d1));var _0xafa7=function(_0x468f27,_0xeb524f){_0x468f27=_0x468f27-0x0;var _0x4c17bc=_0xfa7a[_0x468f27];return _0x4c17bc;};'use strict';var util=require(_0xafa7('0x0'));var moment=require(_0xafa7('0x1'));var rp=require(_0xafa7('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xafa7('0x3'));var db=require(_0xafa7('0x4'))['db'];var encryptor=require(_0xafa7('0x5'));var hardware=require(_0xafa7('0x6'));var logger=require(_0xafa7('0x7'))(_0xafa7('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x27e29d){return new BPromise(function(_0x1a21f8,_0x3f3827){var _0x3fe293=util[_0xafa7('0x9')](_0xafa7('0xa'),HOST,_0x27e29d,module[_0xafa7('0xb')]['version']);if(oldToken){_0x3fe293=util['format'](_0xafa7('0xc'),HOST,_0x27e29d,module[_0xafa7('0xb')][_0xafa7('0x3')],oldToken);}var _0xeb0f1d={'uri':_0x3fe293,'method':_0xafa7('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xeb0f1d)[_0xafa7('0xe')](function(_0x4bd643){_0x1a21f8(_0x4bd643);})[_0xafa7('0xf')](function(_0x339fd7){_0x3f3827(_0x339fd7);});});}function manageLicense(_0x1fe960,_0x1f28c3){var _0x4da55f=_0x1f28c3[_0xafa7('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4da55f[_0xafa7('0x11')]!==_0x1fe960&&!_0x4da55f[_0xafa7('0x12')]){oldToken=_0x4da55f[_0xafa7('0x11')];}httpRequest(_0x1fe960)[_0xafa7('0xe')](function(_0x30e954){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x30e954['active']){isOldTokenSent=![];if(!_0x4da55f[_0xafa7('0x8')]&&_0x4da55f['license']!=_0x30e954[_0xafa7('0x8')]||_0x4da55f[_0xafa7('0x8')]&&_0x4da55f[_0xafa7('0x12')]){logger[_0xafa7('0x13')](_0xafa7('0x14'));}if(_0x4da55f[_0xafa7('0x8')]&&!_0x4da55f[_0xafa7('0x12')]&&_0x4da55f[_0xafa7('0x8')]!=_0x30e954[_0xafa7('0x8')]){logger[_0xafa7('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4da55f['license']&&!_0x4da55f['data2']&&_0x4da55f['license']==_0x30e954[_0xafa7('0x8')]){return _0x1f28c3;}return _0x1f28c3['update']({'data1':_0x1fe960,'data2':null,'license':_0x30e954[_0xafa7('0x8')]});}else{if(_0x30e954['license']||_0x4da55f[_0xafa7('0x8')]){if(!_0x4da55f['data2']){if(_0x4da55f['data1']==_0x1fe960){GRAY_PERIOD_REASON=_0xafa7('0x15');logger[_0xafa7('0x13')](_0xafa7('0x16'));}else{GRAY_PERIOD_REASON=_0xafa7('0x17');logger[_0xafa7('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4da55f[_0xafa7('0x11')],_0x1fe960);}logger[_0xafa7('0x13')](_0xafa7('0x18'),GRAY_PERIOD_REASON[_0xafa7('0x19')](),moment()[_0xafa7('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x1f28c3[_0xafa7('0x1a')]({'data2':encryptor['encryptString'](moment()[_0xafa7('0x9')](_0xafa7('0x1b')))});}else{if(moment()['diff'](encryptor[_0xafa7('0x1c')](_0x4da55f[_0xafa7('0x12')]),_0xafa7('0x1d'))>DAYS){logger[_0xafa7('0x13')](_0xafa7('0x1e'),moment()[_0xafa7('0x9')](_0xafa7('0x1b')));isOldTokenSent=![];return _0x1f28c3['update']({'data1':_0x1fe960,'data2':null,'license':null});}}}else{if(_0x4da55f[_0xafa7('0x11')]!=_0x1fe960){logger[_0xafa7('0x13')](_0xafa7('0x1f'),_0x4da55f[_0xafa7('0x11')],_0x1fe960);return _0x1f28c3[_0xafa7('0x1a')]({'data1':_0x1fe960,'data2':null,'license':null});}}}return _0x1f28c3;})[_0xafa7('0xe')](function(_0x1b042f){_0x1f28c3=_0x1b042f;})[_0xafa7('0xf')](function(_0x22dc5c){logger[_0xafa7('0x20')](_0x22dc5c[_0xafa7('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xafa7('0x22')](),_0x1f28c3);},TIME);});}function defaultLicense(){var _0x4e8797=hardware[_0xafa7('0x22')]();if(_0x4e8797){return db[_0xafa7('0x23')][_0xafa7('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x4e8797}})[_0xafa7('0x25')](function(_0x31d669,_0xf5442a){logger[_0xafa7('0x13')](_0xafa7('0x26'),_0x4e8797);manageLicense(_0x4e8797,_0x31d669);})[_0xafa7('0xf')](function(_0x20061c){logger[_0xafa7('0x20')](_0x20061c['message']);});}}exports[_0xafa7('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 635525a..2e04f26 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 _0x6011=['message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','grayReason','changed','disabled'];(function(_0x10cd08,_0x18362f){var _0x3c2a36=function(_0x27de04){while(--_0x27de04){_0x10cd08['push'](_0x10cd08['shift']());}};_0x3c2a36(++_0x18362f);}(_0x6011,0x1a6));var _0x1601=function(_0x2c3c24,_0x2be604){_0x2c3c24=_0x2c3c24-0x0;var _0x1d1242=_0x6011[_0x2c3c24];return _0x1d1242;};'use strict';var util=require(_0x1601('0x0'));var _=require(_0x1601('0x1'));var moment=require(_0x1601('0x2'));var BPromise=require(_0x1601('0x3'));var hardware=require(_0x1601('0x4'));var encryptor=require(_0x1601('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1601('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1601('0x7'),'machineUuid':hardware[_0x1601('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1601('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1601('0x9'),'machineUuid':hardware[_0x1601('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x111a8d){return new BPromise(function(_0x5d97cc,_0x1b611e){return db[_0x1601('0xa')][_0x1601('0xb')](_['defaults'](_0x111a8d,{'raw':!![],'where':{'id':0x1}}))[_0x1601('0xc')](function(_0x2f7e90){return checkLicense(_0x2f7e90,null);})[_0x1601('0xc')](function(_0x3ab5cb){_0x5d97cc(_0x3ab5cb);return;})[_0x1601('0xd')](function(_0x15faaa){_0x1b611e(_0x15faaa);});});}function checkLicense(_0x24a238,_0x23dd1a){if(!_0x24a238){demoLicense[_0x1601('0xe')]=_0x24a238[_0x1601('0xf')];return demoLicense;}try{var _0x1e52f9=_0x23dd1a||_0x24a238['license'];if(_[_0x1601('0x10')](_0x1e52f9)){throw new Error(_0x1601('0x11'));}var _0x4022df=_0x24a238[_0x1601('0xf')];var _0x3c619c=_0x24a238['data2'];var _0x4679a7=_0x4022df[_0x1601('0x12')]('-')[0x4];var _0xdd3b53=_0x4022df[_0x1601('0x12')]('-')[0x0];var _0x48d8ae=encryptor[_0x1601('0x13')](_0x1e52f9,util[_0x1601('0x14')](_0x1601('0x15'),_0x4679a7,_0x4022df,_0xdd3b53));var _0xc36899=JSON['parse'](_0x48d8ae);_0xc36899[_0x1601('0x16')]=![];_0xc36899['uuid']=_0x4022df;_0xc36899[_0x1601('0x17')]=hardware[_0x1601('0x8')]();if(_0x3c619c){var _0x2901b3=encryptor[_0x1601('0x13')](_0x3c619c);_0xc36899[_0x1601('0x18')]=_0x2901b3;_0xc36899['deadline']=moment(_0x2901b3)['add'](0x7,'days')['format']();_0xc36899[_0x1601('0x19')]=_0xc36899[_0x1601('0xe')]!=_0xc36899[_0x1601('0x17')]?_0x1601('0x1a'):_0x1601('0x1b');}return _0xc36899;}catch(_0x317c06){breakingLicense[_0x1601('0xe')]=_0x24a238[_0x1601('0xf')];breakingLicense[_0x1601('0x1c')]=_0x317c06['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x433e45,_0x28d589){getLicense()[_0x1601('0xc')](function(_0x4c0672){return db['User'][_0x1601('0x1d')]({'attributes':[_0x1601('0x1e'),[db[_0x1601('0x1f')]['fn'](_0x1601('0x20'),db[_0x1601('0x1f')][_0x1601('0x21')](_0x1601('0x1e'))),_0x1601('0x22')]],'group':'role','where':{'role':{'$or':[_0x1601('0x23'),_0x1601('0x24'),_0x1601('0x25')]}},'raw':!![]})[_0x1601('0xc')](function(_0x472513){var _0x25b7dc={'user':_0x4c0672[_0x1601('0x26')]||0x0,'telephone':_0x4c0672[_0x1601('0x27')]||0x0};_0x472513['forEach'](function(_0x2ba7ad){var _0x243ad2=_0x2ba7ad[_0x1601('0x1e')]===_0x1601('0x23')?_0x1601('0x24'):_0x2ba7ad[_0x1601('0x1e')];_0x25b7dc[_0x243ad2]-=_0x2ba7ad[_0x1601('0x22')];if(_0x25b7dc[_0x243ad2]<0x0)_0x25b7dc[_0x243ad2]=0x0;});_0x433e45(_0x25b7dc);return;});})[_0x1601('0xd')](function(_0x406447){_0x28d589(_0x406447);});});}function checkUserLimits(_0x27e11d){return new BPromise(function(_0x5004e4,_0x46700a){getLimits()[_0x1601('0xc')](function(_0x336209){var _0x46167c=_[_0x1601('0x28')](_[_0x1601('0x29')](_0x27e11d,_0x1601('0x1e')),[_0x1601('0x23'),_0x1601('0x24'),_0x1601('0x25')]);var _0x27a5f6=(_0x46167c['admin']||0x0)+(_0x46167c['user']||0x0);var _0x5a15e=_0x46167c['telephone']||0x0;if(_0x27a5f6>_0x336209['user'])return _0x46700a(_0x1601('0x2a'));if(_0x5a15e>_0x336209[_0x1601('0x25')])return _0x46700a(_0x1601('0x2b'));return _0x5004e4();})['catch'](function(_0x57b60a){_0x46700a(_0x57b60a);});});}module[_0x1601('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x56d0=['catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','sequelize','col','user','telephone','telephones','forEach','role','admin','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','defaults','then'];(function(_0x484e47,_0x155a54){var _0x5c6ea5=function(_0x312683){while(--_0x312683){_0x484e47['push'](_0x484e47['shift']());}};_0x5c6ea5(++_0x155a54);}(_0x56d0,0x79));var _0x056d=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x56d0[_0x10791d];return _0x1b4f9c;};'use strict';var util=require('util');var _=require(_0x056d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x056d('0x1'));var encryptor=require(_0x056d('0x2'));var db=require(_0x056d('0x3'))['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':_0x056d('0x4'),'machineUuid':hardware[_0x056d('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x056d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x056d('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2d6250){return new BPromise(function(_0x4a4a86,_0x1d291f){return db['License'][_0x056d('0x8')](_[_0x056d('0x9')](_0x2d6250,{'raw':!![],'where':{'id':0x1}}))[_0x056d('0xa')](function(_0x1f3b35){return checkLicense(_0x1f3b35,null);})[_0x056d('0xa')](function(_0x4f9669){_0x4a4a86(_0x4f9669);return;})[_0x056d('0xb')](function(_0x48ef0d){_0x1d291f(_0x48ef0d);});});}function checkLicense(_0x2eb9a2,_0x8c8511){if(!_0x2eb9a2){demoLicense[_0x056d('0xc')]=_0x2eb9a2[_0x056d('0xd')];return demoLicense;}try{var _0x861953=_0x8c8511||_0x2eb9a2[_0x056d('0xe')];if(_[_0x056d('0xf')](_0x861953)){throw new Error(_0x056d('0x10'));}var _0x243d73=_0x2eb9a2['data1'];var _0x32a594=_0x2eb9a2[_0x056d('0x11')];var _0x2521f8=_0x243d73[_0x056d('0x12')]('-')[0x4];var _0x53bf76=_0x243d73[_0x056d('0x12')]('-')[0x0];var _0x452420=encryptor[_0x056d('0x13')](_0x861953,util[_0x056d('0x14')](_0x056d('0x15'),_0x2521f8,_0x243d73,_0x53bf76));var _0x477a5a=JSON['parse'](_0x452420);_0x477a5a[_0x056d('0x16')]=![];_0x477a5a['uuid']=_0x243d73;_0x477a5a[_0x056d('0x17')]=hardware[_0x056d('0x5')]();if(_0x32a594){var _0x19cf81=encryptor[_0x056d('0x13')](_0x32a594);_0x477a5a[_0x056d('0x18')]=_0x19cf81;_0x477a5a[_0x056d('0x19')]=moment(_0x19cf81)[_0x056d('0x1a')](0x7,_0x056d('0x1b'))['format']();_0x477a5a['grayReason']=_0x477a5a[_0x056d('0xc')]!=_0x477a5a['machineUuid']?_0x056d('0x1c'):_0x056d('0x1d');}return _0x477a5a;}catch(_0x2fea68){breakingLicense['uuid']=_0x2eb9a2[_0x056d('0xd')];breakingLicense['message']=_0x2fea68[_0x056d('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x502d36,_0x3501e2){getLicense()[_0x056d('0xa')](function(_0x24b6c1){return db[_0x056d('0x1f')]['findAll']({'attributes':['role',[db[_0x056d('0x20')]['fn']('COUNT',db[_0x056d('0x20')][_0x056d('0x21')]('role')),'count']],'group':'role','where':{'role':{'$or':['admin',_0x056d('0x22'),_0x056d('0x23')]}},'raw':!![]})[_0x056d('0xa')](function(_0x121947){var _0x357929={'user':_0x24b6c1['users']||0x0,'telephone':_0x24b6c1[_0x056d('0x24')]||0x0};_0x121947[_0x056d('0x25')](function(_0x57c24b){var _0x180b18=_0x57c24b[_0x056d('0x26')]===_0x056d('0x27')?_0x056d('0x22'):_0x57c24b['role'];_0x357929[_0x180b18]-=_0x57c24b['count'];if(_0x357929[_0x180b18]<0x0)_0x357929[_0x180b18]=0x0;});_0x502d36(_0x357929);return;});})[_0x056d('0xb')](function(_0x3be084){_0x3501e2(_0x3be084);});});}function checkUserLimits(_0x385da0){return new BPromise(function(_0x4f53b0,_0xbf1df0){getLimits()['then'](function(_0x1bbabf){var _0x28eb1c=_['pick'](_[_0x056d('0x28')](_0x385da0,_0x056d('0x26')),[_0x056d('0x27'),_0x056d('0x22'),_0x056d('0x23')]);var _0x746979=(_0x28eb1c[_0x056d('0x27')]||0x0)+(_0x28eb1c[_0x056d('0x22')]||0x0);var _0x57a2c5=_0x28eb1c[_0x056d('0x23')]||0x0;if(_0x746979>_0x1bbabf[_0x056d('0x22')])return _0xbf1df0(_0x056d('0x29'));if(_0x57a2c5>_0x1bbabf[_0x056d('0x23')])return _0xbf1df0(_0x056d('0x2a'));return _0x4f53b0();})['catch'](function(_0xe7c5b9){_0xbf1df0(_0xe7c5b9);});});}module[_0x056d('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 942c6c2..9d49451 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 _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4285a0,_0x1dfb9d){_0x4285a0=_0x4285a0-0x0;var _0x1615c4=_0xf7b4[_0x4285a0];return _0x1615c4;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x236c=['secret','exports','myappanuglar-secret','app-id'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x236c,0x155));var _0xc236=function(_0x29bcc9,_0x5326a9){_0x29bcc9=_0x29bcc9-0x0;var _0x19c509=_0x236c[_0x29bcc9];return _0x19c509;};'use strict';module[_0xc236('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc236('0x1'),'GOOGLE_ID':_0xc236('0x2'),'GOOGLE_SECRET':_0xc236('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 71c00a2..3c2b067 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08aa=['exports','../utils/loggers'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x08aa,0x1ed));var _0xa08a=function(_0x1d4e9f,_0x5d69ac){_0x1d4e9f=_0x1d4e9f-0x0;var _0x8b15e=_0x08aa[_0x1d4e9f];return _0x8b15e;};'use strict';var fileLogger=require(_0xa08a('0x0'))['fileLogger'];module[_0xa08a('0x1')]=fileLogger; \ No newline at end of file +var _0xfdd3=['exports','../utils/loggers','fileLogger'];(function(_0x3e9d53,_0xdc99b4){var _0x26ccaf=function(_0x4c728d){while(--_0x4c728d){_0x3e9d53['push'](_0x3e9d53['shift']());}};_0x26ccaf(++_0xdc99b4);}(_0xfdd3,0x178));var _0x3fdd=function(_0xc1b2f6,_0x219ad5){_0xc1b2f6=_0xc1b2f6-0x0;var _0x301bda=_0xfdd3[_0xc1b2f6];return _0x301bda;};'use strict';var fileLogger=require(_0x3fdd('0x0'))[_0x3fdd('0x1')];module[_0x3fdd('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 47f1076..67a065c 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 _0x4ced=['express','join','../../services/express/index.js','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','path'];(function(_0x3e3242,_0x3125ea){var _0x3705b7=function(_0x53d05a){while(--_0x53d05a){_0x3e3242['push'](_0x3e3242['shift']());}};_0x3705b7(++_0x3125ea);}(_0x4ced,0xbc));var _0xd4ce=function(_0x20a394,_0x5c4e0c){_0x20a394=_0x20a394-0x0;var _0x8a454f=_0x4ced[_0x20a394];return _0x8a454f;};'use strict';var path=require(_0xd4ce('0x0'));var os=require('os');var config={'apps':[{'name':_0xd4ce('0x1'),'script':path[_0xd4ce('0x2')](__dirname,_0xd4ce('0x3'))},{'name':'ami','script':path[_0xd4ce('0x2')](__dirname,_0xd4ce('0x4'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xd4ce('0x5'),'script':path[_0xd4ce('0x2')](__dirname,_0xd4ce('0x6'))},{'name':_0xd4ce('0x7'),'script':path[_0xd4ce('0x2')](__dirname,_0xd4ce('0x8'))},{'name':'xdr','script':path[_0xd4ce('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x4f92=['email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4f92,0xb0));var _0x24f9=function(_0xa9d560,_0x2f615e){_0xa9d560=_0xa9d560-0x0;var _0x48d8c2=_0x4f92[_0xa9d560];return _0x48d8c2;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x24f9('0x0')](__dirname,_0x24f9('0x1'))},{'name':_0x24f9('0x2'),'script':path[_0x24f9('0x0')](__dirname,_0x24f9('0x3'))},{'name':'agi','script':path[_0x24f9('0x0')](__dirname,'../../services/agi/index.js')},{'name':_0x24f9('0x4'),'script':path[_0x24f9('0x0')](__dirname,_0x24f9('0x5'))},{'name':_0x24f9('0x6'),'script':path[_0x24f9('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0x24f9('0x7'),'script':path[_0x24f9('0x0')](__dirname,_0x24f9('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b913a12..3cc710a 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 _0xbfef=['saved','pm2','./config','connected','start','disconnect','stop','then','restart','list','describe','delete','dump'];(function(_0x1c0e0a,_0x3df5cf){var _0x339c78=function(_0xbf3b80){while(--_0xbf3b80){_0x1c0e0a['push'](_0x1c0e0a['shift']());}};_0x339c78(++_0x3df5cf);}(_0xbfef,0x153));var _0xfbfe=function(_0x1e9452,_0xed09a9){_0x1e9452=_0x1e9452-0x0;var _0x4cbafe=_0xbfef[_0x1e9452];return _0x4cbafe;};'use strict';var pm2=require(_0xfbfe('0x0'));var BPromise=require('bluebird');var config=require(_0xfbfe('0x1'));function connect(){return new BPromise(function(_0x43e25a,_0x4aecc1){return pm2['connect'](function(_0xfdca91){if(_0xfdca91){return _0x4aecc1(_0xfdca91);}return _0x43e25a(_0xfbfe('0x2'));});});};exports[_0xfbfe('0x3')]=function(_0x3b232c){return connect()['then'](function(){return new BPromise(function(_0x472a9f,_0xed5132){return pm2[_0xfbfe('0x3')](_0x3b232c,function(_0x784577,_0x4bdd7d){if(_0x784577){return _0xed5132(_0x784577);}pm2[_0xfbfe('0x4')]();return _0x472a9f(_0x4bdd7d);});});});};exports[_0xfbfe('0x5')]=function(_0x19f1ce){return connect()[_0xfbfe('0x6')](function(){return new BPromise(function(_0x21c02f,_0x1ce2bd){return pm2[_0xfbfe('0x5')](_0x19f1ce,function(_0x26d473,_0x2a4343){if(_0x26d473){return _0x1ce2bd(_0x26d473);}pm2['disconnect']();return _0x21c02f(_0x2a4343);});});});};exports['restart']=function(_0x44828c){return connect()['then'](function(){return new BPromise(function(_0x50d517,_0x5aca28){return pm2[_0xfbfe('0x7')](_0x44828c,function(_0x3397e2,_0x171b24){if(_0x3397e2){return _0x5aca28(_0x3397e2);}pm2[_0xfbfe('0x4')]();return _0x50d517(_0x171b24);});});});};exports['list']=function(){return connect()[_0xfbfe('0x6')](function(){return new BPromise(function(_0x489892,_0x3375a9){return pm2[_0xfbfe('0x8')](function(_0x82f50b,_0x32d598){if(_0x82f50b){return _0x3375a9(_0x82f50b);}pm2['disconnect']();return _0x489892(_0x32d598);});});});};exports[_0xfbfe('0x9')]=function(_0x1e5e55){return connect()[_0xfbfe('0x6')](function(){return new BPromise(function(_0x4bb403,_0x46be3f){return pm2[_0xfbfe('0x9')](_0x1e5e55,function(_0x23d501,_0x1bda1c){if(_0x23d501){return _0x46be3f(_0x23d501);}pm2[_0xfbfe('0x4')]();return _0x4bb403(_0x1bda1c);});});});};exports[_0xfbfe('0xa')]=function(_0x4cdc1c){return connect()[_0xfbfe('0x6')](function(){return new BPromise(function(_0xc4f9b8,_0x2546fc){return pm2[_0xfbfe('0xa')](_0x4cdc1c,function(_0x5c35ea,_0x2fc320){if(_0x5c35ea){return _0x2546fc(_0x5c35ea);}pm2[_0xfbfe('0x4')]();return _0xc4f9b8(_0x2fc320);});});});};exports[_0xfbfe('0xb')]=function(){return connect()[_0xfbfe('0x6')](function(){return new BPromise(function(_0x1fc01b,_0x40a9e3){return pm2[_0xfbfe('0xb')](function(_0x3235ea){if(_0x3235ea){return _0x40a9e3(_0x3235ea);}return _0x1fc01b(_0xfbfe('0xc'));});});});}; \ No newline at end of file +var _0x9d48=['then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start'];(function(_0x4622b1,_0x52683c){var _0x1d747d=function(_0x3ce95e){while(--_0x3ce95e){_0x4622b1['push'](_0x4622b1['shift']());}};_0x1d747d(++_0x52683c);}(_0x9d48,0x105));var _0x89d4=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x9d48[_0x3e85a4];return _0x21e7d1;};'use strict';var pm2=require(_0x89d4('0x0'));var BPromise=require(_0x89d4('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x9029f5,_0x3a032b){return pm2[_0x89d4('0x2')](function(_0x13bfe9){if(_0x13bfe9){return _0x3a032b(_0x13bfe9);}return _0x9029f5(_0x89d4('0x3'));});});};exports[_0x89d4('0x4')]=function(_0x65f51e){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x4552b4,_0x23cbe6){return pm2['start'](_0x65f51e,function(_0xffafcb,_0x14655f){if(_0xffafcb){return _0x23cbe6(_0xffafcb);}pm2['disconnect']();return _0x4552b4(_0x14655f);});});});};exports[_0x89d4('0x6')]=function(_0x408b5a){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x40ca1d,_0x180ea5){return pm2['stop'](_0x408b5a,function(_0x30ac5a,_0x591e42){if(_0x30ac5a){return _0x180ea5(_0x30ac5a);}pm2[_0x89d4('0x7')]();return _0x40ca1d(_0x591e42);});});});};exports[_0x89d4('0x8')]=function(_0x406905){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x2091d2,_0x5e99d9){return pm2[_0x89d4('0x8')](_0x406905,function(_0x10f001,_0x307a63){if(_0x10f001){return _0x5e99d9(_0x10f001);}pm2[_0x89d4('0x7')]();return _0x2091d2(_0x307a63);});});});};exports[_0x89d4('0x9')]=function(){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x27151d,_0x45dd74){return pm2['list'](function(_0x315bb1,_0x23557d){if(_0x315bb1){return _0x45dd74(_0x315bb1);}pm2[_0x89d4('0x7')]();return _0x27151d(_0x23557d);});});});};exports[_0x89d4('0xa')]=function(_0x52d4a7){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x272f28,_0x20bf6b){return pm2[_0x89d4('0xa')](_0x52d4a7,function(_0x2661b7,_0x20dfa5){if(_0x2661b7){return _0x20bf6b(_0x2661b7);}pm2[_0x89d4('0x7')]();return _0x272f28(_0x20dfa5);});});});};exports['delete']=function(_0xf9a0cc){return connect()[_0x89d4('0x5')](function(){return new BPromise(function(_0x50468f,_0x3f3840){return pm2[_0x89d4('0xb')](_0xf9a0cc,function(_0x5970ae,_0x32d48a){if(_0x5970ae){return _0x3f3840(_0x5970ae);}pm2[_0x89d4('0x7')]();return _0x50468f(_0x32d48a);});});});};exports[_0x89d4('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x26b73b,_0x18a89a){return pm2[_0x89d4('0xc')](function(_0x987f89){if(_0x987f89){return _0x18a89a(_0x987f89);}return _0x26b73b(_0x89d4('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/auth.js b/server/config/schedule/auth.js index a0fcf5b..8254790 100644 --- a/server/config/schedule/auth.js +++ b/server/config/schedule/auth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9572=['format','YYYY-MM-DD\x20HH:mm:ss','catch','error','SIP/%s','name','getChannels','role','internal','forEach','push','web','moment','../../mysqldb','../logger','redis','forceLogoutByid','Invalid\x20user\x20object','User','then','MemberReport','update'];(function(_0x3c41f9,_0x28cf71){var _0x70c889=function(_0x5b80d5){while(--_0x5b80d5){_0x3c41f9['push'](_0x3c41f9['shift']());}};_0x70c889(++_0x28cf71);}(_0x9572,0xbc));var _0x2957=function(_0x396c0c,_0x427eee){_0x396c0c=_0x396c0c-0x0;var _0x5cb572=_0x9572[_0x396c0c];return _0x5cb572;};'use strict';var _=require('lodash');var moment=require(_0x2957('0x0'));var util=require('util');var db=require(_0x2957('0x1'))['db'];var config=require('../environment');var utils=require('../utils');var logger=require(_0x2957('0x2'))('schedule');config[_0x2957('0x3')]=_['defaults'](config[_0x2957('0x3')],{'host':'localhost','port':0x18eb});exports[_0x2957('0x4')]=function(_0x14b9c4){if(!_0x14b9c4)throw new Error(_0x2957('0x5'),_0x14b9c4);return db[_0x2957('0x6')]['update']({'online':0x0},{'where':{'id':_0x14b9c4['id']}})[_0x2957('0x7')](function(){return db[_0x2957('0x8')][_0x2957('0x9')]({'exitAt':moment()[_0x2957('0xa')](_0x2957('0xb'))},{'where':{'membername':_0x14b9c4['name'],'exitAt':null}});})[_0x2957('0xc')](function(_0x4ee8ba){logger[_0x2957('0xd')](_0x4ee8ba);});};exports['forceLoginByid']=function(_0x432dbf){if(!_0x432dbf)throw new Error('Invalid\x20user\x20object',_0x432dbf);return db[_0x2957('0x6')][_0x2957('0x9')]({'online':0x1},{'where':{'id':_0x432dbf['id']}})[_0x2957('0x7')](function(){var _0x3aadb5=util['format'](_0x2957('0xe'),_0x432dbf[_0x2957('0xf')]);var _0x32f16a=[];var _0x229a38=utils[_0x2957('0x10')]();var _0x52831b={'membername':_0x432dbf[_0x2957('0xf')],'interface':_0x3aadb5,'enterAt':moment()['format'](_0x2957('0xb')),'role':_0x432dbf[_0x2957('0x11')],'internal':_0x432dbf[_0x2957('0x12')]};_0x229a38[_0x2957('0x13')](function(_0x15d130){_0x32f16a[_0x2957('0x14')](_['merge']({'channel':_0x15d130,'type':'LOGIN','data1':_0x2957('0x15'),'data2':_0x3aadb5},_0x52831b));});return db[_0x2957('0x8')]['bulkCreate'](_0x32f16a,{'individualHooks':!![]});})[_0x2957('0xc')](function(_0xbf7bda){logger[_0x2957('0xd')](_0xbf7bda);});}; \ No newline at end of file +var _0xaf0a=['web','bulkCreate','error','lodash','moment','util','../../mysqldb','../environment','../utils','../logger','redis','localhost','forceLogoutByid','Invalid\x20user\x20object','User','update','format','name','catch','then','getChannels','YYYY-MM-DD\x20HH:mm:ss','role','merge','LOGIN'];(function(_0xbd7457,_0x3e26ad){var _0x11dccd=function(_0x322861){while(--_0x322861){_0xbd7457['push'](_0xbd7457['shift']());}};_0x11dccd(++_0x3e26ad);}(_0xaf0a,0x12f));var _0xaaf0=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xaf0a[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xaaf0('0x0'));var moment=require(_0xaaf0('0x1'));var util=require(_0xaaf0('0x2'));var db=require(_0xaaf0('0x3'))['db'];var config=require(_0xaaf0('0x4'));var utils=require(_0xaaf0('0x5'));var logger=require(_0xaaf0('0x6'))('schedule');config[_0xaaf0('0x7')]=_['defaults'](config['redis'],{'host':_0xaaf0('0x8'),'port':0x18eb});exports[_0xaaf0('0x9')]=function(_0x3ac6ab){if(!_0x3ac6ab)throw new Error(_0xaaf0('0xa'),_0x3ac6ab);return db[_0xaaf0('0xb')][_0xaaf0('0xc')]({'online':0x0},{'where':{'id':_0x3ac6ab['id']}})['then'](function(){return db['MemberReport'][_0xaaf0('0xc')]({'exitAt':moment()[_0xaaf0('0xd')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'membername':_0x3ac6ab[_0xaaf0('0xe')],'exitAt':null}});})[_0xaaf0('0xf')](function(_0x3ca193){logger['error'](_0x3ca193);});};exports['forceLoginByid']=function(_0x228424){if(!_0x228424)throw new Error(_0xaaf0('0xa'),_0x228424);return db[_0xaaf0('0xb')]['update']({'online':0x1},{'where':{'id':_0x228424['id']}})[_0xaaf0('0x10')](function(){var _0x17f93c=util[_0xaaf0('0xd')]('SIP/%s',_0x228424[_0xaaf0('0xe')]);var _0x2bf925=[];var _0x4009f4=utils[_0xaaf0('0x11')]();var _0x5532c7={'membername':_0x228424[_0xaaf0('0xe')],'interface':_0x17f93c,'enterAt':moment()[_0xaaf0('0xd')](_0xaaf0('0x12')),'role':_0x228424[_0xaaf0('0x13')],'internal':_0x228424['internal']};_0x4009f4['forEach'](function(_0xb09885){_0x2bf925['push'](_[_0xaaf0('0x14')]({'channel':_0xb09885,'type':_0xaaf0('0x15'),'data1':_0xaaf0('0x16'),'data2':_0x17f93c},_0x5532c7));});return db['MemberReport'][_0xaaf0('0x17')](_0x2bf925,{'individualHooks':!![]});})['catch'](function(_0x43a8e5){logger[_0xaaf0('0x18')](_0x43a8e5);});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 3104397..d0f1f96 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 _0xb0a4=['timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','inspect','start','moment','../../config/environment','../../mysqldb','../logger','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','map','info','update','system'];(function(_0x31095a,_0x5d94f6){var _0xf0ca0=function(_0x5e9d3f){while(--_0x5e9d3f){_0x31095a['push'](_0x31095a['shift']());}};_0xf0ca0(++_0x5d94f6);}(_0xb0a4,0x13d));var _0x4b0a=function(_0x4d29f3,_0x16bb30){_0x4d29f3=_0x4d29f3-0x0;var _0x5d48b7=_0xb0a4[_0x4d29f3];return _0x5d48b7;};'use strict';var _=require('lodash');var moment=require(_0x4b0a('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x4b0a('0x1'));var db=require(_0x4b0a('0x2'))['db'];var logger=require(_0x4b0a('0x3'))('schedule');config['redis']=_[_0x4b0a('0x4')](config[_0x4b0a('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x4b0a('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x3168e7=0x0;var _0x2058a5=[];return db[_0x4b0a('0x7')][_0x4b0a('0x8')]({'raw':!![],'attributes':['id',_0x4b0a('0x9')],'where':{'id':0x1}})[_0x4b0a('0xa')](function(_0x180622){_0x3168e7=_0x180622['chatTimeout'];if(_0x3168e7){return db[_0x4b0a('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x4b0a('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b0a('0xd')](_0x180622['chatTimeout'],_0x4b0a('0xe'))}}});}else{return[];}})[_0x4b0a('0xa')](function(_0x333f71){if(_0x333f71&&_0x333f71['length']){_0x2058a5=_[_0x4b0a('0xf')](_0x333f71||[],'id');logger[_0x4b0a('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2058a5['join']());return db[_0x4b0a('0xb')][_0x4b0a('0x11')]({'closeReason':_0x4b0a('0x12'),'disposition':_0x4b0a('0x13'),'closed':!![],'closedAt':moment()[_0x4b0a('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2058a5}});}})[_0x4b0a('0xa')](function(){if(_0x2058a5&&_0x2058a5[_0x4b0a('0x15')]){logger[_0x4b0a('0x10')](_0x4b0a('0x16'),_0x2058a5['join']());for(var _0xefb580=0x0;_0xefb580<_0x2058a5[_0x4b0a('0x15')];_0xefb580++){io[_0x4b0a('0x17')](_0x4b0a('0x18'),{'id':_0x2058a5[_0xefb580],'closed':!![]});}}})[_0x4b0a('0x19')](function(_0x1a92bc){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x1a92bc?util[_0x4b0a('0x1a')](_0x1a92bc,{'showHidden':![],'depth':null}):'');});}exports[_0x4b0a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9902=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x4f71d4,_0x15c65a){var _0x12918e=function(_0x2b2335){while(--_0x2b2335){_0x4f71d4['push'](_0x4f71d4['shift']());}};_0x12918e(++_0x15c65a);}(_0x9902,0x1a1));var _0x2990=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9902[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2990('0x0'));var moment=require(_0x2990('0x1'));var Redis=require(_0x2990('0x2'));var util=require(_0x2990('0x3'));var config=require(_0x2990('0x4'));var db=require(_0x2990('0x5'))['db'];var logger=require(_0x2990('0x6'))(_0x2990('0x7'));config[_0x2990('0x8')]=_[_0x2990('0x9')](config[_0x2990('0x8')],{'host':_0x2990('0xa'),'port':0x18eb});var io=require(_0x2990('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x2c0da7=0x0;var _0x3e201a=[];return db['Setting'][_0x2990('0xc')]({'raw':!![],'attributes':['id',_0x2990('0xd')],'where':{'id':0x1}})[_0x2990('0xe')](function(_0xfa34fb){_0x2c0da7=_0xfa34fb[_0x2990('0xd')];if(_0x2c0da7){return db[_0x2990('0xf')][_0x2990('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xfa34fb[_0x2990('0xd')],_0x2990('0x11'))}}});}else{return[];}})[_0x2990('0xe')](function(_0x1543ca){if(_0x1543ca&&_0x1543ca['length']){_0x3e201a=_[_0x2990('0x12')](_0x1543ca||[],'id');logger['info'](_0x2990('0x13'),_0x3e201a['join']());return db[_0x2990('0xf')][_0x2990('0x14')]({'closeReason':_0x2990('0x15'),'disposition':_0x2990('0x16'),'closed':!![],'closedAt':moment()[_0x2990('0x17')](_0x2990('0x18'))},{'where':{'id':_0x3e201a}});}})[_0x2990('0xe')](function(){if(_0x3e201a&&_0x3e201a[_0x2990('0x19')]){logger[_0x2990('0x1a')](_0x2990('0x1b'),_0x3e201a[_0x2990('0x1c')]());for(var _0x32056b=0x0;_0x32056b<_0x3e201a['length'];_0x32056b++){io['emit'](_0x2990('0x1d'),{'id':_0x3e201a[_0x32056b],'closed':!![]});}}})[_0x2990('0x1e')](function(_0x28db03){logger[_0x2990('0x1f')](_0x2990('0x20'),_0x28db03?util[_0x2990('0x21')](_0x28db03,{'showHidden':![],'depth':null}):'');});}exports[_0x2990('0x22')]=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 38e9265..13abe3d 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 _0xf0bc=['startAllRefreshIntervals'];(function(_0x4a87ec,_0x5832aa){var _0x5f71f2=function(_0xba02c5){while(--_0xba02c5){_0x4a87ec['push'](_0x4a87ec['shift']());}};_0x5f71f2(++_0x5832aa);}(_0xf0bc,0x143));var _0xcf0b=function(_0x3c3cca,_0x40c35d){_0x3c3cca=_0x3c3cca-0x0;var _0x185eb5=_0xf0bc[_0x3c3cca];return _0x185eb5;};'use strict';function start(){var _0x4782f3=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4782f3[_0xcf0b('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x247a=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x151b2a,_0x2b88b8){var _0x5c2c04=function(_0x1786d0){while(--_0x1786d0){_0x151b2a['push'](_0x151b2a['shift']());}};_0x5c2c04(++_0x2b88b8);}(_0x247a,0x108));var _0xa247=function(_0x154584,_0x421e12){_0x154584=_0x154584-0x0;var _0x969074=_0x247a[_0x154584];return _0x969074;};'use strict';function start(){var _0x2618c1=require(_0xa247('0x0'));return _0x2618c1[_0xa247('0x1')]();}module[_0xa247('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 f7ce4a2..43d7ea3 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 _0x518d=['jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','resolve','cron','active','isBetween','add\x20cron','stop','stop\x20cron','endAt','update','run','util','path','lodash','cron-job-manager'];(function(_0x30a882,_0x3961e9){var _0x253582=function(_0x2ec1a8){while(--_0x2ec1a8){_0x30a882['push'](_0x30a882['shift']());}};_0x253582(++_0x3961e9);}(_0x518d,0x140));var _0xd518=function(_0x128a04,_0x49d9f1){_0x128a04=_0x128a04-0x0;var _0x58d800=_0x518d[_0x128a04];return _0x58d800;};'use strict';var fs=require('fs');var util=require(_0xd518('0x0'));var path=require(_0xd518('0x1'));var _=require(_0xd518('0x2'));var moment=require('moment');var CronJobManager=require(_0xd518('0x3'));var jayson=require(_0xd518('0x4'));var BPromise=require('bluebird');var logger=require(_0xd518('0x5'))(_0xd518('0x6'));var db=require(_0xd518('0x7'))['db'];var analyticCustomReportController=require(_0xd518('0x8'));var analyticDefaultReportController=require(_0xd518('0x9'));var client=jayson[_0xd518('0xa')][_0xd518('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x37fb9f,_0x141bc4){return function(){logger[_0xd518('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x37fb9f[_0xd518('0xd')]);var _0x3dd7ce=!![];var _0x4a0e06=_0x37fb9f[_0xd518('0xe')][_0xd518('0xf')]();var _0x30f257={'account':_0x4a0e06,'message':{'from':util['format'](_0xd518('0x10'),_0x37fb9f[_0xd518('0xe')][_0xd518('0x11')],_0x37fb9f[_0xd518('0xe')][_0xd518('0xd')]||_0x37fb9f[_0xd518('0xe')]['Smtp'][_0xd518('0x12')]),'to':_0x37fb9f[_0xd518('0xd')],'cc':_0x37fb9f['cc'],'bcc':_0x37fb9f[_0xd518('0x13')],'subject':util[_0xd518('0x14')](_0xd518('0x15'),_0x141bc4['name'],_0x37fb9f['subtractNumber'],_0x37fb9f[_0xd518('0x16')])}};var _0x5585f1=path[_0xd518('0x17')](__dirname,_0xd518('0x18'));var _0x11c974=_0x141bc4[_0xd518('0x19')];var _0x23ea7e=util[_0xd518('0x14')](_0xd518('0x1a'),path['basename'](_0x141bc4['savename'],path[_0xd518('0x1b')](_0x141bc4['savename'])),_0xd518('0x1c'));var _0x1383a4=path[_0xd518('0x17')](_0x5585f1,_0x11c974);var _0x58c0d7=path['join'](_0x5585f1,_0x23ea7e);if(fs[_0xd518('0x1d')](_0x1383a4)){_0x141bc4['status']=_0xd518('0x1e');_0x30f257[_0xd518('0x1f')]['attachments']=[{'filename':_0x11c974,'path':_0x1383a4}];_0x30f257[_0xd518('0x1f')]['text']=util['format'](_0xd518('0x20'),JSON[_0xd518('0x21')](_0x141bc4,null,0x2));}else if(fs[_0xd518('0x1d')](_0x58c0d7)){_0x141bc4[_0xd518('0x22')]='Sent';_0x30f257[_0xd518('0x1f')][_0xd518('0x23')]=[{'filename':_0x23ea7e,'path':_0x58c0d7}];}else{_0x30f257[_0xd518('0x1f')][_0xd518('0x24')]=_0xd518('0x25');if(!_0x37fb9f[_0xd518('0x26')]){_0x3dd7ce=![];logger[_0xd518('0xc')](_0xd518('0x27'));}}if(_0x3dd7ce){return client['request']('SendMail',_0x30f257)[_0xd518('0x28')](function(_0xa88321){if(_0xa88321['error']){return logger[_0xd518('0x29')](_0xd518('0x2a'),JSON[_0xd518('0x21')](_0xa88321));}return logger[_0xd518('0xc')](_0xd518('0x2b'));})[_0xd518('0x2c')](function(_0x16a234){return logger[_0xd518('0x29')](_0xd518('0x2a'),JSON['stringify'](_0x16a234));});}};}function handleError(){return function(_0x56e7af){return logger[_0xd518('0x29')](JSON[_0xd518('0x21')](_0x56e7af));};}function handleResult(_0x5d405a){return function(_0x3af920){logger['info'](_0xd518('0x2d'),JSON[_0xd518('0x21')](_0x3af920));if(_0x5d405a[_0xd518('0xe')]&&_0x5d405a[_0xd518('0xe')][_0xd518('0x2e')]&&!_[_0xd518('0x2f')](_0x5d405a[_0xd518('0xd')])){setTimeout(handleSendEmail(_0x5d405a,_0x3af920),0x3c*0x3e8);}};}function handleJob(_0x55e78a){return function(){try{if(_[_0xd518('0x2f')](_0x55e78a['subtractNumber'])){return logger[_0xd518('0xc')](_0xd518('0x30'));}if(_[_0xd518('0x2f')](_0x55e78a['subtractUnit'])){return logger[_0xd518('0xc')](_0xd518('0x31'));}var _0x37fb35={'startDate':moment()['subtract'](_0x55e78a[_0xd518('0x32')],_0x55e78a[_0xd518('0x16')])[_0xd518('0x14')](_0xd518('0x33')),'endDate':moment()['format'](_0xd518('0x33')),'type':_0xd518('0x34'),'output':_0x55e78a['output'],'name':_0x55e78a['name']};if(!_[_0xd518('0x2f')](_0x55e78a[_0xd518('0x35')])){logger['info'](_0xd518('0x36'),_0x55e78a['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x55e78a[_0xd518('0x35')]},_0x37fb35)[_0xd518('0x28')](handleResult(_0x55e78a))[_0xd518('0x2c')](handleError());}if(!_['isNil'](_0x55e78a[_0xd518('0x37')])){logger[_0xd518('0xc')]('exec\x20custom\x20report\x20id:%s',_0x55e78a[_0xd518('0x37')]);return analyticCustomReportController['runReport']({'id':_0x55e78a['CustomReportId']},_0x37fb35)[_0xd518('0x28')](handleResult(_0x55e78a))['catch'](handleError());}}catch(_0x520f8a){logger[_0xd518('0x29')](JSON[_0xd518('0x21')](_0x520f8a));}return logger[_0xd518('0xc')](_0xd518('0x38'));};}function getJobs(_0x2e41c3){var _0x300d6d={};if(_0x2e41c3){_0x300d6d['id']=_0x2e41c3;}return db['Schedule'][_0xd518('0x39')]({'where':_0x300d6d,'include':[{'model':db[_0xd518('0xe')],'attributes':['id','name','email'],'include':[{'model':db[_0xd518('0x3a')],'as':_0xd518('0x2e'),'include':[{'model':db[_0xd518('0x3b')],'as':_0xd518('0x3b')}]}]}]})[_0xd518('0x28')](function(_0x549a98){var _0x4aa174=_[_0xd518('0x3c')](manager[_0xd518('0x3d')]);var _0x5d390e=_['map'](_0x549a98,function(_0x1124d6){return _0x1124d6['id']['toString']();});var _0x5341be=_[_0xd518('0x3e')](_0x549a98,function(_0x4a3451){return _0x4a3451['id'][_0xd518('0x3f')]();});var _0x52da31=_0x2e41c3?_0x5d390e:_[_0xd518('0x40')](_0x5d390e,_0x4aa174);var _0x1d256c=_[_0xd518('0x41')](_0x5d390e,_0x4aa174);var _0x5a3f47=_[_0xd518('0x40')](_0x4aa174,_0x5d390e);var _0x6cf30d;var _0x3298b7;for(_0x6cf30d=0x0;_0x6cf30d<_0x5a3f47[_0xd518('0x42')]&&!_0x2e41c3;_0x6cf30d+=0x1){_0x3298b7=_0x5a3f47[_0x6cf30d][_0xd518('0x3f')]();if(manager[_0xd518('0x43')](_0x3298b7)){manager['stop'](_0x3298b7);manager[_0xd518('0x44')](_0x3298b7);logger[_0xd518('0xc')](_0xd518('0x45'),_0x3298b7);}}logger[_0xd518('0xc')](_0xd518('0x46'),JSON[_0xd518('0x21')](_0x52da31));for(_0x6cf30d=0x0;_0x6cf30d<_0x52da31[_0xd518('0x42')];_0x6cf30d+=0x1){_0x3298b7=_0x52da31[_0x6cf30d]['toString']();logger['info']('index',_0x3298b7);if(_0x2e41c3){logger['info']('my\x20id',_0x2e41c3);logger[_0xd518('0xc')](JSON[_0xd518('0x21')](_0x5341be[_0x3298b7]));BPromise[_0xd518('0x47')]()[_0xd518('0x28')](handleJob(_0x5341be[_0x3298b7]));logger['info']('run\x20job',_0x5341be[_0x3298b7][_0xd518('0x11')],_0x5341be[_0x3298b7][_0xd518('0x48')]);}else if(_0x5341be[_0x3298b7][_0xd518('0x48')]&&_0x5341be[_0x3298b7][_0xd518('0x49')]&&moment()[_0xd518('0x4a')](_0x5341be[_0x3298b7]['startAt'],_0x5341be[_0x3298b7]['endAt'])){manager['add'](_0x3298b7,_0x5341be[_0x3298b7][_0xd518('0x48')],handleJob(_0x5341be[_0x3298b7]));manager['start'](_0x3298b7);logger[_0xd518('0xc')](_0xd518('0x4b'),_0x5341be[_0x3298b7]['name'],_0x5341be[_0x3298b7][_0xd518('0x48')]);}else if(manager[_0xd518('0x43')](_0x3298b7)){manager[_0xd518('0x4c')](_0x3298b7);manager['deleteJob'](_0x3298b7);logger['info'](_0xd518('0x4d'),_0x5341be[_0x3298b7][_0xd518('0x11')],_0x5341be[_0x3298b7][_0xd518('0x48')]);}}for(_0x6cf30d=0x0,_0x3298b7;_0x6cf30d<_0x1d256c['length']&&!_0x2e41c3;_0x6cf30d+=0x1){_0x3298b7=_0x1d256c[_0x6cf30d][_0xd518('0x3f')]();if(manager['exists'](_0x3298b7)){if(_0x5341be[_0x3298b7][_0xd518('0x48')]&&_0x5341be[_0x3298b7][_0xd518('0x49')]&&moment()[_0xd518('0x4a')](_0x5341be[_0x3298b7]['startAt'],_0x5341be[_0x3298b7][_0xd518('0x4e')])){manager[_0xd518('0x4f')](_0x3298b7,_0x5341be[_0x3298b7][_0xd518('0x48')],handleJob(_0x5341be[_0x3298b7]));logger[_0xd518('0xc')]('update\x20cron',_0x5341be[_0x3298b7][_0xd518('0x11')],_0x5341be[_0x3298b7][_0xd518('0x48')]);}else{manager[_0xd518('0x4c')](_0x3298b7);manager[_0xd518('0x44')](_0x3298b7);logger['info']('stop\x20cron',_0x5341be[_0x3298b7][_0xd518('0x11')],_0x5341be[_0x3298b7][_0xd518('0x48')]);}}}})['catch'](function(_0x235545){logger[_0xd518('0x29')](JSON[_0xd518('0x21')](_0x235545));});}exports[_0xd518('0x50')]=function(_0x593291){return getJobs(_0x593291);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x749c=['email','MailAccount','name','Smtp','user','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','email\x20sent','catch','error','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','intersection','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','deleteJob','stop\x20cron','update','update\x20cron','run','start','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x44de84,_0x384a9e){var _0x5ec10f=function(_0x29d6da){while(--_0x29d6da){_0x44de84['push'](_0x44de84['shift']());}};_0x5ec10f(++_0x384a9e);}(_0x749c,0xf1));var _0xc749=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x749c[_0x3b19ea];return _0x40ece9;};'use strict';var fs=require('fs');var util=require(_0xc749('0x0'));var path=require(_0xc749('0x1'));var _=require(_0xc749('0x2'));var moment=require(_0xc749('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xc749('0x4'));var BPromise=require(_0xc749('0x5'));var logger=require(_0xc749('0x6'))(_0xc749('0x7'));var db=require(_0xc749('0x8'))['db'];var analyticCustomReportController=require(_0xc749('0x9'));var analyticDefaultReportController=require(_0xc749('0xa'));var client=jayson[_0xc749('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4c1a2a,_0x31f8a5){return function(){logger[_0xc749('0xc')](_0xc749('0xd'),_0x4c1a2a[_0xc749('0xe')]);var _0x412fc2=!![];var _0x3118c0=_0x4c1a2a[_0xc749('0xf')]['getSmtpOptions']();var _0x29b54b={'account':_0x3118c0,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4c1a2a['MailAccount'][_0xc749('0x10')],_0x4c1a2a[_0xc749('0xf')][_0xc749('0xe')]||_0x4c1a2a[_0xc749('0xf')][_0xc749('0x11')][_0xc749('0x12')]),'to':_0x4c1a2a[_0xc749('0xe')],'cc':_0x4c1a2a['cc'],'bcc':_0x4c1a2a[_0xc749('0x13')],'subject':util[_0xc749('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x31f8a5[_0xc749('0x10')],_0x4c1a2a[_0xc749('0x15')],_0x4c1a2a[_0xc749('0x16')])}};var _0x31ccf8=path[_0xc749('0x17')](__dirname,_0xc749('0x18'));var _0x18c202=_0x31f8a5[_0xc749('0x19')];var _0x206bcc=util[_0xc749('0x14')](_0xc749('0x1a'),path[_0xc749('0x1b')](_0x31f8a5[_0xc749('0x19')],path[_0xc749('0x1c')](_0x31f8a5[_0xc749('0x19')])),_0xc749('0x1d'));var _0x9bd448=path['join'](_0x31ccf8,_0x18c202);var _0x24d346=path[_0xc749('0x17')](_0x31ccf8,_0x206bcc);if(fs[_0xc749('0x1e')](_0x9bd448)){_0x31f8a5[_0xc749('0x1f')]=_0xc749('0x20');_0x29b54b[_0xc749('0x21')][_0xc749('0x22')]=[{'filename':_0x18c202,'path':_0x9bd448}];_0x29b54b[_0xc749('0x21')]['text']=util[_0xc749('0x14')](_0xc749('0x23'),JSON[_0xc749('0x24')](_0x31f8a5,null,0x2));}else if(fs[_0xc749('0x1e')](_0x24d346)){_0x31f8a5['status']=_0xc749('0x20');_0x29b54b[_0xc749('0x21')]['attachments']=[{'filename':_0x206bcc,'path':_0x24d346}];}else{_0x29b54b['message'][_0xc749('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4c1a2a['sendIfEmpty']){_0x412fc2=![];logger[_0xc749('0xc')](_0xc749('0x26'));}}if(_0x412fc2){return client['request'](_0xc749('0x27'),_0x29b54b)[_0xc749('0x28')](function(_0x3eb8f8){if(_0x3eb8f8['error']){return logger['error'](_0xc749('0x29'),JSON[_0xc749('0x24')](_0x3eb8f8));}return logger[_0xc749('0xc')](_0xc749('0x2a'));})[_0xc749('0x2b')](function(_0x1263ef){return logger['error'](_0xc749('0x29'),JSON[_0xc749('0x24')](_0x1263ef));});}};}function handleError(){return function(_0x3e96e2){return logger[_0xc749('0x2c')](JSON[_0xc749('0x24')](_0x3e96e2));};}function handleResult(_0x44ccdc){return function(_0x3e727c){logger[_0xc749('0xc')]('data',JSON[_0xc749('0x24')](_0x3e727c));if(_0x44ccdc[_0xc749('0xf')]&&_0x44ccdc[_0xc749('0xf')]['Smtp']&&!_[_0xc749('0x2d')](_0x44ccdc[_0xc749('0xe')])){setTimeout(handleSendEmail(_0x44ccdc,_0x3e727c),0x3c*0x3e8);}};}function handleJob(_0x41e1c9){return function(){try{if(_[_0xc749('0x2d')](_0x41e1c9[_0xc749('0x15')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xc749('0x2d')](_0x41e1c9[_0xc749('0x16')])){return logger['info'](_0xc749('0x2e'));}var _0x3de5bf={'startDate':moment()[_0xc749('0x2f')](_0x41e1c9[_0xc749('0x15')],_0x41e1c9['subtractUnit'])[_0xc749('0x14')](_0xc749('0x30')),'endDate':moment()['format'](_0xc749('0x30')),'type':_0xc749('0x31'),'output':_0x41e1c9[_0xc749('0x32')],'name':_0x41e1c9[_0xc749('0x10')]};if(!_[_0xc749('0x2d')](_0x41e1c9[_0xc749('0x33')])){logger[_0xc749('0xc')](_0xc749('0x34'),_0x41e1c9[_0xc749('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x41e1c9[_0xc749('0x33')]},_0x3de5bf)[_0xc749('0x28')](handleResult(_0x41e1c9))['catch'](handleError());}if(!_[_0xc749('0x2d')](_0x41e1c9['CustomReportId'])){logger[_0xc749('0xc')]('exec\x20custom\x20report\x20id:%s',_0x41e1c9[_0xc749('0x35')]);return analyticCustomReportController[_0xc749('0x36')]({'id':_0x41e1c9[_0xc749('0x35')]},_0x3de5bf)[_0xc749('0x28')](handleResult(_0x41e1c9))[_0xc749('0x2b')](handleError());}}catch(_0x5044d3){logger['error'](JSON[_0xc749('0x24')](_0x5044d3));}return logger[_0xc749('0xc')](_0xc749('0x37'));};}function getJobs(_0x2f537e){var _0x3998e={};if(_0x2f537e){_0x3998e['id']=_0x2f537e;}return db[_0xc749('0x38')][_0xc749('0x39')]({'where':_0x3998e,'include':[{'model':db['MailAccount'],'attributes':['id',_0xc749('0x10'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xc749('0x11'),'include':[{'model':db[_0xc749('0x3a')],'as':_0xc749('0x3a')}]}]}]})[_0xc749('0x28')](function(_0x4139b1){var _0x4852dc=_[_0xc749('0x3b')](manager[_0xc749('0x3c')]);var _0x1aaed4=_[_0xc749('0x3d')](_0x4139b1,function(_0x320189){return _0x320189['id']['toString']();});var _0x3b474d=_['keyBy'](_0x4139b1,function(_0x427de6){return _0x427de6['id'][_0xc749('0x3e')]();});var _0x31e8fd=_0x2f537e?_0x1aaed4:_['difference'](_0x1aaed4,_0x4852dc);var _0x86fbe3=_[_0xc749('0x3f')](_0x1aaed4,_0x4852dc);var _0x2c4bc4=_[_0xc749('0x40')](_0x4852dc,_0x1aaed4);var _0x536c67;var _0xb7053c;for(_0x536c67=0x0;_0x536c67<_0x2c4bc4[_0xc749('0x41')]&&!_0x2f537e;_0x536c67+=0x1){_0xb7053c=_0x2c4bc4[_0x536c67][_0xc749('0x3e')]();if(manager[_0xc749('0x42')](_0xb7053c)){manager[_0xc749('0x43')](_0xb7053c);manager['deleteJob'](_0xb7053c);logger[_0xc749('0xc')](_0xc749('0x44'),_0xb7053c);}}logger['info'](_0xc749('0x45'),JSON['stringify'](_0x31e8fd));for(_0x536c67=0x0;_0x536c67<_0x31e8fd[_0xc749('0x41')];_0x536c67+=0x1){_0xb7053c=_0x31e8fd[_0x536c67][_0xc749('0x3e')]();logger[_0xc749('0xc')](_0xc749('0x46'),_0xb7053c);if(_0x2f537e){logger[_0xc749('0xc')](_0xc749('0x47'),_0x2f537e);logger['info'](JSON[_0xc749('0x24')](_0x3b474d[_0xb7053c]));BPromise[_0xc749('0x48')]()[_0xc749('0x28')](handleJob(_0x3b474d[_0xb7053c]));logger[_0xc749('0xc')]('run\x20job',_0x3b474d[_0xb7053c]['name'],_0x3b474d[_0xb7053c][_0xc749('0x49')]);}else if(_0x3b474d[_0xb7053c][_0xc749('0x49')]&&_0x3b474d[_0xb7053c][_0xc749('0x4a')]&&moment()[_0xc749('0x4b')](_0x3b474d[_0xb7053c][_0xc749('0x4c')],_0x3b474d[_0xb7053c][_0xc749('0x4d')])){manager[_0xc749('0x4e')](_0xb7053c,_0x3b474d[_0xb7053c][_0xc749('0x49')],handleJob(_0x3b474d[_0xb7053c]));manager['start'](_0xb7053c);logger[_0xc749('0xc')]('add\x20cron',_0x3b474d[_0xb7053c][_0xc749('0x10')],_0x3b474d[_0xb7053c][_0xc749('0x49')]);}else if(manager[_0xc749('0x42')](_0xb7053c)){manager[_0xc749('0x43')](_0xb7053c);manager[_0xc749('0x4f')](_0xb7053c);logger[_0xc749('0xc')](_0xc749('0x50'),_0x3b474d[_0xb7053c][_0xc749('0x10')],_0x3b474d[_0xb7053c][_0xc749('0x49')]);}}for(_0x536c67=0x0,_0xb7053c;_0x536c67<_0x86fbe3[_0xc749('0x41')]&&!_0x2f537e;_0x536c67+=0x1){_0xb7053c=_0x86fbe3[_0x536c67]['toString']();if(manager['exists'](_0xb7053c)){if(_0x3b474d[_0xb7053c][_0xc749('0x49')]&&_0x3b474d[_0xb7053c][_0xc749('0x4a')]&&moment()[_0xc749('0x4b')](_0x3b474d[_0xb7053c]['startAt'],_0x3b474d[_0xb7053c][_0xc749('0x4d')])){manager[_0xc749('0x51')](_0xb7053c,_0x3b474d[_0xb7053c][_0xc749('0x49')],handleJob(_0x3b474d[_0xb7053c]));logger['info'](_0xc749('0x52'),_0x3b474d[_0xb7053c][_0xc749('0x10')],_0x3b474d[_0xb7053c]['cron']);}else{manager['stop'](_0xb7053c);manager[_0xc749('0x4f')](_0xb7053c);logger[_0xc749('0xc')](_0xc749('0x50'),_0x3b474d[_0xb7053c][_0xc749('0x10')],_0x3b474d[_0xb7053c][_0xc749('0x49')]);}}}})[_0xc749('0x2b')](function(_0x4afda1){logger[_0xc749('0x2c')](JSON[_0xc749('0x24')](_0x4afda1));});}exports[_0xc749('0x53')]=function(_0x9d3aa8){return getJobs(_0x9d3aa8);};exports[_0xc749('0x54')]=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 6e9c334..142f2e8 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 _0x0833=['sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','Positive','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','forEach','start','lodash','aws-sdk','request-promise','util','bluebird','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x3ee0af,_0x28ca7b){var _0x39271f=function(_0x88217c){while(--_0x88217c){_0x3ee0af['push'](_0x3ee0af['shift']());}};_0x39271f(++_0x28ca7b);}(_0x0833,0x1bd));var _0x3083=function(_0x2101cb,_0x259fb8){_0x2101cb=_0x2101cb-0x0;var _0x45200b=_0x0833[_0x2101cb];return _0x45200b;};var _=require(_0x3083('0x0'));var AWS=require(_0x3083('0x1'));var rp=require(_0x3083('0x2'));var util=require(_0x3083('0x3'));var BPromise=require(_0x3083('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x22717c,_0x58a865,_0xa26470,_0x1d8d6e){return new Promise(function(_0x914cec,_0x58ed49){var _0x2f9c3a=new AWS[(_0x3083('0x5'))]({'accessKeyId':_0x58a865,'secretAccessKey':_0x22717c,'region':_0xa26470});_0x2f9c3a['getTranscriptionJob']({'TranscriptionJobName':_0x1d8d6e},function(_0x5591b0,_0x4f51da){if(_0x5591b0){return _0x58ed49(_0x5591b0);}else{return _0x914cec(_0x4f51da);}});});}function sentiment(_0x44b807,_0x5f1109,_0x5cce3c,_0x43f038,_0x2e7419){return new Promise(function(_0xb187b0,_0x18d150){var _0x312ee7=new AWS[(_0x3083('0x6'))]({'accessKeyId':_0x5f1109,'secretAccessKey':_0x44b807,'region':_0x5cce3c});_0x312ee7[_0x3083('0x7')]({'Text':_0x43f038,'LanguageCode':_0x2e7419[_0x3083('0x8')](0x0,0x2)},function(_0x133231,_0xb16222){if(_0x133231){return _0x18d150(_0x133231);}else{return _0xb187b0(_0xb16222);}});});}function checkTranscribeJob(_0x3a2460,_0x4960f9,_0x126765){var _0x2dc6ab;return new BPromise(function(_0x1b33f3,_0x537a99){logger[_0x3083('0x9')](util[_0x3083('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3a2460['id'],_0x3a2460[_0x3083('0xb')]));return getTranscriptionJob(_0x126765[_0x3083('0xc')],_0x126765['data2'],_0x4960f9[_0x3083('0xd')],_0x3a2460[_0x3083('0xb')])[_0x3083('0xe')](function(_0x143cac){logger[_0x3083('0x9')](util[_0x3083('0xa')](_0x3083('0xf'),_0x3a2460['id'],_0x3a2460['transcribeName'],_0x143cac['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x3a2460[_0x3083('0x10')]){switch(_0x143cac['TranscriptionJob'][_0x3083('0x11')]){case _0x3083('0x12'):var _0x419c95={'transcribeStatus':_0x143cac[_0x3083('0x13')][_0x3083('0x11')],'fileUri':_0x143cac[_0x3083('0x13')][_0x3083('0x14')][_0x3083('0x15')]};logger[_0x3083('0x9')](util[_0x3083('0xa')](_0x3083('0x16'),_0x3a2460['id']));return rp({'uri':_0x143cac[_0x3083('0x13')][_0x3083('0x14')][_0x3083('0x15')],'json':!![]})['then'](function(_0x4c2a0b){logger[_0x3083('0x9')](util['format'](_0x3083('0x17'),_0x3a2460['id']));if(_0x4c2a0b&&_0x4c2a0b[_0x3083('0x18')]&&_0x4c2a0b[_0x3083('0x18')][_0x3083('0x19')]&&_0x4c2a0b[_0x3083('0x18')][_0x3083('0x19')][_0x3083('0x1a')]){_0x419c95[_0x3083('0x10')]='';for(var _0x4501b2=0x0;_0x4501b2<_0x4c2a0b['results'][_0x3083('0x19')]['length'];_0x4501b2++){_0x419c95['fileText']+=_0x4c2a0b[_0x3083('0x18')][_0x3083('0x19')][_0x4501b2][_0x3083('0x1b')]+'';}}return _0x3a2460[_0x3083('0x1c')](_0x419c95);})[_0x3083('0xe')](function(){logger[_0x3083('0x9')](util['format'](_0x3083('0x1d'),_0x3a2460['id']));if(!_0x3a2460[_0x3083('0x1e')]){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4960f9[_0x3083('0x21')]||!_0x4960f9['sentimentAccountId']||!_0x4960f9['sentimentRegion']||!_0x4960f9[_0x3083('0x22')]||!_0x4960f9[_0x3083('0x23')]){throw new db[(_0x3083('0x1f'))]['ValidationError'](_0x3083('0x24'));}if(!_0x419c95[_0x3083('0x10')]){throw new Error(_0x3083('0x25'));}if(_0x4960f9[_0x3083('0x26')]===_0x126765['id']){return _0x126765;}else{return db[_0x3083('0x27')][_0x3083('0x28')]({'where':{'id':_settings[_0x3083('0x26')]}});}})[_0x3083('0xe')](function(_0x31f840){if(!_0x31f840){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x29'));}if(!_0x31f840[_0x3083('0xc')]||!_0x31f840[_0x3083('0x2a')]){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x2b'));}_0x2dc6ab=_0x31f840;logger[_0x3083('0x9')](util[_0x3083('0xa')](_0x3083('0x2c'),_0x3a2460['id']));return sentiment(_0x2dc6ab['data1'],_0x2dc6ab[_0x3083('0x2a')],_0x4960f9[_0x3083('0x2d')],_0x419c95['fileText'],_0x4960f9[_0x3083('0x22')]);})[_0x3083('0xe')](function(_0x4b92b5){logger['info'](util[_0x3083('0xa')](_0x3083('0x2e'),_0x3a2460['id']));return _0x3a2460[_0x3083('0x1c')]({'sentiment':_0x4b92b5[_0x3083('0x2f')],'sPositive':_0x4b92b5['SentimentScore']['Positive'],'sNegative':_0x4b92b5[_0x3083('0x30')][_0x3083('0x31')],'sMixed':_0x4b92b5[_0x3083('0x30')]['Mixed'],'sNeutral':_0x4b92b5[_0x3083('0x30')][_0x3083('0x32')]});})[_0x3083('0xe')](function(){logger[_0x3083('0x9')](util[_0x3083('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3a2460['id']));_0x1b33f3();});case'FAILED':return _0x3a2460[_0x3083('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x143cac[_0x3083('0x13')][_0x3083('0x33')]})[_0x3083('0xe')](function(){logger[_0x3083('0x9')](util['format'](_0x3083('0x1d'),_0x3a2460['id']));_0x1b33f3();});default:logger[_0x3083('0x9')](util[_0x3083('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3a2460['id']));break;}}else{return BPromise[_0x3083('0x34')]()['then'](function(){if(!_0x3a2460[_0x3083('0x1e')]){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x35'));}if(!_0x4960f9['sentiment']||!_0x4960f9[_0x3083('0x26')]||!_0x4960f9['sentimentRegion']||!_0x4960f9[_0x3083('0x22')]||!_0x4960f9[_0x3083('0x23')]){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x24'));}if(!_0x3a2460['fileText']){throw new Error(_0x3083('0x25'));}if(_0x4960f9[_0x3083('0x26')]===_0x126765['id']){return _0x126765;}else{return db[_0x3083('0x27')][_0x3083('0x28')]({'where':{'id':_settings[_0x3083('0x26')]}});}})[_0x3083('0xe')](function(_0x7c08d7){if(!_0x7c08d7){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x29'));}if(!_0x7c08d7['data1']||!_0x7c08d7[_0x3083('0x2a')]){throw new db['Sequelize']['ValidationError'](_0x3083('0x2b'));}_0x2dc6ab=_0x7c08d7;logger[_0x3083('0x9')](util[_0x3083('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3a2460['id']));return sentiment(_0x2dc6ab[_0x3083('0xc')],_0x2dc6ab[_0x3083('0x2a')],_0x4960f9[_0x3083('0x2d')],_0x3a2460['fileText'],_0x4960f9[_0x3083('0x22')]);})['then'](function(_0x778e0){logger['info'](util[_0x3083('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3a2460['id']));return _0x3a2460['update']({'sentiment':_0x778e0['Sentiment'],'sPositive':_0x778e0['SentimentScore'][_0x3083('0x36')],'sNegative':_0x778e0[_0x3083('0x30')][_0x3083('0x31')],'sMixed':_0x778e0[_0x3083('0x30')][_0x3083('0x37')],'sNeutral':_0x778e0[_0x3083('0x30')][_0x3083('0x32')],'transcribeStatus':_0x3083('0x12')});})[_0x3083('0xe')](function(){logger[_0x3083('0x9')](util['format'](_0x3083('0x1d'),_0x3a2460['id']));_0x1b33f3();});}})[_0x3083('0x38')](function(_0x3eebe3){if(_0x3eebe3){if(!_0x3eebe3[_0x3083('0x39')]||_0x3eebe3['name']!==_0x3083('0x3a')){logger[_0x3083('0x3b')](util[_0x3083('0xa')](_0x3083('0x3c'),_0x3a2460['id']),util[_0x3083('0x3d')](_0x3eebe3,{'showHidden':![],'depth':null}));}}_0x1b33f3();});});}function checkTranscribe(){var _0x22acd6;var _0x437150;var _0x5cf5cd;return db[_0x3083('0x3e')][_0x3083('0x3f')]({'where':{'transcribeStatus':_0x3083('0x40')}})[_0x3083('0xe')](function(_0xeac2cd){if(!_0xeac2cd||!_0xeac2cd[_0x3083('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x3083('0x41'));}_0x22acd6=_0xeac2cd;return db['Setting'][_0x3083('0x28')]({'where':{'id':0x1}});})[_0x3083('0xe')](function(_0x1c4135){if(!_0x1c4135){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x42'));}_0x437150=_0x1c4135;if(!_0x437150[_0x3083('0x43')]||!_0x437150['transcribeAccountId']||!_0x437150[_0x3083('0xd')]||!_0x437150[_0x3083('0x22')]||!_0x437150[_0x3083('0x23')]){throw new db['Sequelize'][(_0x3083('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x3083('0x27')][_0x3083('0x28')]({'where':{'id':_0x437150['transcribeAccountId']}});})[_0x3083('0xe')](function(_0x2182ef){if(!_0x2182ef){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2182ef['data1']||!_0x2182ef[_0x3083('0x2a')]){throw new db[(_0x3083('0x1f'))][(_0x3083('0x20'))](_0x3083('0x2b'));}_0x5cf5cd=_0x2182ef;var _0x15e33e=[];_0x22acd6[_0x3083('0x44')](function(_0xdc541e){_0x15e33e['push'](checkTranscribeJob(_0xdc541e,_0x437150,_0x5cf5cd));});return BPromise['all'](_0x15e33e);})[_0x3083('0x38')](function(_0x6f8acb){if(_0x6f8acb){if(!_0x6f8acb['name']||_0x6f8acb[_0x3083('0x39')]!==_0x3083('0x3a')){logger[_0x3083('0x3b')](util[_0x3083('0x3d')](_0x6f8acb,{'showHidden':![],'depth':null}));}}});}exports[_0x3083('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8eba=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x342c4d,_0x1bb93b){var _0xbf6c68=function(_0x4a28d1){while(--_0x4a28d1){_0x342c4d['push'](_0x342c4d['shift']());}};_0xbf6c68(++_0x1bb93b);}(_0x8eba,0xc3));var _0xa8eb=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x8eba[_0x193e28];return _0x20ef59;};var _=require(_0xa8eb('0x0'));var AWS=require(_0xa8eb('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xa8eb('0x2'))['db'];var logger=require(_0xa8eb('0x3'))(_0xa8eb('0x4'));function getTranscriptionJob(_0x2cdf40,_0x52533a,_0x3a665b,_0x187bf0){return new Promise(function(_0x5abab9,_0x321f2f){var _0x5ece80=new AWS[(_0xa8eb('0x5'))]({'accessKeyId':_0x52533a,'secretAccessKey':_0x2cdf40,'region':_0x3a665b});_0x5ece80[_0xa8eb('0x6')]({'TranscriptionJobName':_0x187bf0},function(_0x509b54,_0x8b2ae9){if(_0x509b54){return _0x321f2f(_0x509b54);}else{return _0x5abab9(_0x8b2ae9);}});});}function sentiment(_0x5d6360,_0x21e416,_0x3010d0,_0x5eb605,_0x47032d){return new Promise(function(_0x796060,_0x3e45e7){var _0x4693d6=new AWS['Comprehend']({'accessKeyId':_0x21e416,'secretAccessKey':_0x5d6360,'region':_0x3010d0});_0x4693d6[_0xa8eb('0x7')]({'Text':_0x5eb605,'LanguageCode':_0x47032d['substring'](0x0,0x2)},function(_0x20a4ca,_0x501134){if(_0x20a4ca){return _0x3e45e7(_0x20a4ca);}else{return _0x796060(_0x501134);}});});}function checkTranscribeJob(_0x193a53,_0x47149c,_0x5b21fc){var _0x2c7cff;return new BPromise(function(_0x490c4f,_0x289ed3){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0xa'),_0x193a53['id'],_0x193a53['transcribeName']));return getTranscriptionJob(_0x5b21fc[_0xa8eb('0xb')],_0x5b21fc['data2'],_0x47149c[_0xa8eb('0xc')],_0x193a53[_0xa8eb('0xd')])[_0xa8eb('0xe')](function(_0x102a81){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0xf'),_0x193a53['id'],_0x193a53[_0xa8eb('0xd')],_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]));if(!_0x193a53['fileText']){switch(_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]){case _0xa8eb('0x12'):var _0x445cc6={'transcribeStatus':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')],'fileUri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0xa8eb('0x14'),_0x193a53['id']));return rp({'uri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri'],'json':!![]})[_0xa8eb('0xe')](function(_0x1025ef){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x15'),_0x193a53['id']));if(_0x1025ef&&_0x1025ef[_0xa8eb('0x16')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xa8eb('0x18')]){_0x445cc6[_0xa8eb('0x19')]='';for(var _0xee9db2=0x0;_0xee9db2<_0x1025ef['results'][_0xa8eb('0x17')][_0xa8eb('0x18')];_0xee9db2++){_0x445cc6[_0xa8eb('0x19')]+=_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xee9db2]['transcript']+'';}}return _0x193a53[_0xa8eb('0x1a')](_0x445cc6);})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x1b'),_0x193a53['id']));if(!_0x193a53['tempSentiment']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x1d'));}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x23'));}if(!_0x445cc6[_0xa8eb('0x19')]){throw new Error(_0xa8eb('0x24'));}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db['CloudProvider'][_0xa8eb('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa8eb('0xe')](function(_0xdd5171){if(!_0xdd5171){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd5171[_0xa8eb('0xb')]||!_0xdd5171[_0xa8eb('0x26')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c7cff=_0xdd5171;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x445cc6['fileText'],_0x47149c[_0xa8eb('0x28')]);})['then'](function(_0x4a2a65){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x4a2a65[_0xa8eb('0x2a')],'sPositive':_0x4a2a65[_0xa8eb('0x2b')]['Positive'],'sNegative':_0x4a2a65['SentimentScore'][_0xa8eb('0x2c')],'sMixed':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2e')]});})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});case'FAILED':return _0x193a53[_0xa8eb('0x1a')]({'transcribeStatus':_0xa8eb('0x2f'),'failureReason':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x30')]})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});default:logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x31'),_0x193a53['id']));break;}}else{return BPromise['resolve']()[_0xa8eb('0xe')](function(){if(!_0x193a53[_0xa8eb('0x32')]){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db['Sequelize']['ValidationError'](_0xa8eb('0x23'));}if(!_0x193a53[_0xa8eb('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db[_0xa8eb('0x33')][_0xa8eb('0x25')]({'where':{'id':_settings[_0xa8eb('0x1f')]}});}})[_0xa8eb('0xe')](function(_0x141986){if(!_0x141986){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x34'));}if(!_0x141986[_0xa8eb('0xb')]||!_0x141986['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x2c7cff=_0x141986;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x193a53['fileText'],_0x47149c['language']);})[_0xa8eb('0xe')](function(_0x1548b5){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x1548b5[_0xa8eb('0x2a')],'sPositive':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x36')],'sNegative':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2c')],'sMixed':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x1548b5['SentimentScore'][_0xa8eb('0x2e')],'transcribeStatus':'COMPLETED'});})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x193a53['id']));_0x490c4f();});}})[_0xa8eb('0x37')](function(_0x1b3c2b){if(_0x1b3c2b){if(!_0x1b3c2b[_0xa8eb('0x38')]||_0x1b3c2b[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x9')](_0xa8eb('0x3b'),_0x193a53['id']),util[_0xa8eb('0x3c')](_0x1b3c2b,{'showHidden':![],'depth':null}));}}_0x490c4f();});});}function checkTranscribe(){var _0x54ae6b;var _0x481560;var _0x273fd0;return db[_0xa8eb('0x3d')][_0xa8eb('0x3e')]({'where':{'transcribeStatus':_0xa8eb('0x3f')}})['then'](function(_0x53dc8a){if(!_0x53dc8a||!_0x53dc8a['length']){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x40'));}_0x54ae6b=_0x53dc8a;return db[_0xa8eb('0x41')][_0xa8eb('0x25')]({'where':{'id':0x1}});})[_0xa8eb('0xe')](function(_0x31b4f7){if(!_0x31b4f7){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x42'));}_0x481560=_0x31b4f7;if(!_0x481560[_0xa8eb('0x4')]||!_0x481560[_0xa8eb('0x43')]||!_0x481560[_0xa8eb('0xc')]||!_0x481560[_0xa8eb('0x28')]||!_0x481560[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x44'));}return db[_0xa8eb('0x33')]['findOne']({'where':{'id':_0x481560['transcribeAccountId']}});})[_0xa8eb('0xe')](function(_0x5edfbe){if(!_0x5edfbe){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x34'));}if(!_0x5edfbe[_0xa8eb('0xb')]||!_0x5edfbe['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x273fd0=_0x5edfbe;var _0x1251cd=[];_0x54ae6b[_0xa8eb('0x45')](function(_0x3a52d2){_0x1251cd[_0xa8eb('0x46')](checkTranscribeJob(_0x3a52d2,_0x481560,_0x273fd0));});return BPromise[_0xa8eb('0x47')](_0x1251cd);})[_0xa8eb('0x37')](function(_0x18e535){if(_0x18e535){if(!_0x18e535[_0xa8eb('0x38')]||_0x18e535[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x3c')](_0x18e535,{'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 48e7449..0c8c636 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 _0x5f76=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','start','lodash','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0x5f76,0x8e));var _0x65f7=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x5f76[_0x367a3d];return _0x460539;};'use strict';var _=require(_0x65f7('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x65f7('0x1'));var config=require(_0x65f7('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x65f7('0x3'))(_0x65f7('0x4'));config[_0x65f7('0x5')]=_['defaults'](config[_0x65f7('0x5')],{'host':_0x65f7('0x6'),'port':0x18eb});var io=require(_0x65f7('0x7'))(new Redis(config[_0x65f7('0x5')]));function closeInteractions(){var _0x7ffa0e=[];return db[_0x65f7('0x8')][_0x65f7('0x9')]({'raw':!![],'attributes':['id',_0x65f7('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x65f7('0xb')](0x18,'hours')}}})[_0x65f7('0xc')](function(_0x2e20b6){if(_0x2e20b6&&_0x2e20b6[_0x65f7('0xd')]){_0x7ffa0e=_[_0x65f7('0xe')](_0x2e20b6||[],'id');logger[_0x65f7('0xf')](_0x65f7('0x10'),_0x7ffa0e[_0x65f7('0x11')]());return db['WhatsappInteraction'][_0x65f7('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x65f7('0x13')](_0x65f7('0x14'))},{'where':{'id':_0x7ffa0e}});}})[_0x65f7('0xc')](function(){if(_0x7ffa0e&&_0x7ffa0e[_0x65f7('0xd')]){logger['info'](_0x65f7('0x15'),_0x7ffa0e[_0x65f7('0x11')]());for(var _0x7d73e7=0x0;_0x7d73e7<_0x7ffa0e['length'];_0x7d73e7++){io[_0x65f7('0x16')]('whatsappInteraction:update',{'id':_0x7ffa0e[_0x7d73e7],'closed':!![]});}}})[_0x65f7('0x17')](function(_0x4bf5f8){logger[_0x65f7('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4bf5f8?util[_0x65f7('0x19')](_0x4bf5f8,{'showHidden':![],'depth':null}):'');});}exports[_0x65f7('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5d07=['WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','join','timeout','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost'];(function(_0x24b7db,_0x47d79f){var _0x49a7cd=function(_0x194815){while(--_0x194815){_0x24b7db['push'](_0x24b7db['shift']());}};_0x49a7cd(++_0x47d79f);}(_0x5d07,0x11f));var _0x75d0=function(_0xff848,_0xdf62af){_0xff848=_0xff848-0x0;var _0x2015aa=_0x5d07[_0xff848];return _0x2015aa;};'use strict';var _=require(_0x75d0('0x0'));var moment=require(_0x75d0('0x1'));var Redis=require(_0x75d0('0x2'));var util=require(_0x75d0('0x3'));var config=require(_0x75d0('0x4'));var db=require(_0x75d0('0x5'))['db'];var logger=require('../logger')(_0x75d0('0x6'));config[_0x75d0('0x7')]=_[_0x75d0('0x8')](config[_0x75d0('0x7')],{'host':_0x75d0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x75d0('0x7')]));function closeInteractions(){var _0x2124e0=[];return db[_0x75d0('0xa')][_0x75d0('0xb')]({'raw':!![],'attributes':['id',_0x75d0('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x75d0('0xd')](0x18,_0x75d0('0xe'))}}})[_0x75d0('0xf')](function(_0x4b6593){if(_0x4b6593&&_0x4b6593['length']){_0x2124e0=_[_0x75d0('0x10')](_0x4b6593||[],'id');logger[_0x75d0('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2124e0[_0x75d0('0x12')]());return db[_0x75d0('0xa')]['update']({'closeReason':'system','disposition':_0x75d0('0x13'),'closed':!![],'closedAt':moment()['format'](_0x75d0('0x14'))},{'where':{'id':_0x2124e0}});}})[_0x75d0('0xf')](function(){if(_0x2124e0&&_0x2124e0[_0x75d0('0x15')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2124e0['join']());for(var _0x3542bb=0x0;_0x3542bb<_0x2124e0[_0x75d0('0x15')];_0x3542bb++){io[_0x75d0('0x16')](_0x75d0('0x17'),{'id':_0x2124e0[_0x3542bb],'closed':!![]});}}})[_0x75d0('0x18')](function(_0x33147c){logger[_0x75d0('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x33147c?util['inspect'](_0x33147c,{'showHidden':![],'depth':null}):'');});}exports[_0x75d0('0x1a')]=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 9e334d7..7498a76 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x194f=['push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x194f,0x141));var _0xf194=function(_0x441c66,_0x32c91b){_0x441c66=_0x441c66-0x0;var _0x1d5019=_0x194f[_0x441c66];return _0x1d5019;};'use strict';var util=require(_0xf194('0x0'));var db=require(_0xf194('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf194('0x2')]({'id':i,'firstName':_0xf194('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf194('0x4')+i+_0xf194('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf194('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf194('0x6')](),'updatedAt':Date[_0xf194('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf194('0x3')+i,'lastName':_0xf194('0x7')+i,'phone':0xf879fb460+i,'email':_0xf194('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf194('0x6')](),'updatedAt':Date[_0xf194('0x6')]()});}db[_0xf194('0x8')][_0xf194('0x9')]({'where':{}})['then'](function(){return db[_0xf194('0x8')][_0xf194('0xa')](contacts);})[_0xf194('0xb')](function(){console[_0xf194('0xc')]('finished\x20populating',_0xf194('0xd'));return db[_0xf194('0xe')][_0xf194('0x9')]({'where':{}});})['then'](function(){return db[_0xf194('0xe')][_0xf194('0xa')](hopper);})[_0xf194('0xb')](function(){console['log'](_0xf194('0xf'),'hopper1');return db[_0xf194('0x8')][_0xf194('0xa')](contacts2);})[_0xf194('0xb')](function(){console[_0xf194('0xc')](_0xf194('0xf'),_0xf194('0x10'));return db[_0xf194('0xe')][_0xf194('0xa')](hopper2);})['then'](function(){console[_0xf194('0xc')](_0xf194('0xf'),_0xf194('0x11'));})[_0xf194('0x12')](function(_0x245af9){console['log'](_0x245af9);}); \ No newline at end of file +var _0x5628=['contacts2','catch','../mysqldb','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x5628,0x178));var _0x8562=function(_0x14192f,_0x5b9a16){_0x14192f=_0x14192f-0x0;var _0x5d6097=_0x5628[_0x14192f];return _0x5d6097;};'use strict';var util=require('util');var db=require(_0x8562('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8562('0x1')]({'id':i,'firstName':_0x8562('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8562('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8562('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x8562('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8562('0x4')](),'updatedAt':Date[_0x8562('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8562('0x1')]({'id':i,'firstName':_0x8562('0x2')+i,'lastName':_0x8562('0x5')+i,'phone':0xf879fb460+i,'email':_0x8562('0x6')+i+_0x8562('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8562('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x8562('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8562('0x4')](),'updatedAt':Date[_0x8562('0x4')]()});}db[_0x8562('0x7')][_0x8562('0x8')]({'where':{}})[_0x8562('0x9')](function(){return db[_0x8562('0x7')][_0x8562('0xa')](contacts);})[_0x8562('0x9')](function(){console[_0x8562('0xb')](_0x8562('0xc'),_0x8562('0xd'));return db[_0x8562('0xe')][_0x8562('0x8')]({'where':{}});})[_0x8562('0x9')](function(){return db[_0x8562('0xe')][_0x8562('0xa')](hopper);})[_0x8562('0x9')](function(){console['log'](_0x8562('0xc'),'hopper1');return db[_0x8562('0x7')]['bulkCreate'](contacts2);})[_0x8562('0x9')](function(){console['log'](_0x8562('0xc'),_0x8562('0xf'));return db[_0x8562('0xe')]['bulkCreate'](hopper2);})[_0x8562('0x9')](function(){console[_0x8562('0xb')](_0x8562('0xc'),'hopper2');})[_0x8562('0x10')](function(_0x1d6e2a){console[_0x8562('0xb')](_0x1d6e2a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a307c40..b484a42 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72f0=['add\x20user','catch','log','util','../mysqldb','push','%s%s','format','agent','%s%s@xcally.com','password','friend','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x209c67,_0x51be4e){var _0xcbbe32=function(_0x1184d4){while(--_0x1184d4){_0x209c67['push'](_0x209c67['shift']());}};_0xcbbe32(++_0x51be4e);}(_0x72f0,0x121));var _0x072f=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x72f0[_0x5de818];return _0x345670;};'use strict';var util=require(_0x072f('0x0'));var db=require(_0x072f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x072f('0x2')]({'name':util['format'](_0x072f('0x3'),'agent',i),'fullname':util[_0x072f('0x4')]('%s%s',_0x072f('0x5'),i),'email':util[_0x072f('0x4')](_0x072f('0x6'),_0x072f('0x5'),i),'role':_0x072f('0x5'),'password':_0x072f('0x7'),'internal':0xfa0+i,'type':_0x072f('0x8'),'transport':[_0x072f('0x9'),'ws',_0x072f('0xa')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x072f('0x4')](_0x072f('0x3'),_0x072f('0x5'),i),'encryption':_0x072f('0xb'),'avpf':_0x072f('0xb'),'force_avp':_0x072f('0xb'),'icesupport':'yes','dtlsenable':_0x072f('0xb'),'dtlsverify':'no','dtlscertfile':_0x072f('0xc'),'dtlsprivatekey':_0x072f('0xd'),'dtlssetup':_0x072f('0xe'),'callerid':util[_0x072f('0x4')](_0x072f('0xf'),util[_0x072f('0x4')](_0x072f('0x3'),_0x072f('0x5'),i),0xfa0+i)});}db[_0x072f('0x10')][_0x072f('0x11')](users)[_0x072f('0x12')](function(){console['log'](_0x072f('0x13'));})[_0x072f('0x14')](function(_0x2c25a4){console[_0x072f('0x15')](_0x2c25a4);}); \ No newline at end of file +var _0x8e3b=['agent','%s%s','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','push','format'];(function(_0x5c2968,_0xb2cbc0){var _0x56b0bd=function(_0x1eaa8d){while(--_0x1eaa8d){_0x5c2968['push'](_0x5c2968['shift']());}};_0x56b0bd(++_0xb2cbc0);}(_0x8e3b,0x1ae));var _0xb8e3=function(_0x2ced4f,_0x3e2bec){_0x2ced4f=_0x2ced4f-0x0;var _0x4cf01a=_0x8e3b[_0x2ced4f];return _0x4cf01a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb8e3('0x0')]({'name':util[_0xb8e3('0x1')]('%s%s',_0xb8e3('0x2'),i),'fullname':util[_0xb8e3('0x1')](_0xb8e3('0x3'),_0xb8e3('0x2'),i),'email':util[_0xb8e3('0x1')]('%s%s@xcally.com',_0xb8e3('0x2'),i),'role':_0xb8e3('0x2'),'password':_0xb8e3('0x4'),'internal':0xfa0+i,'type':_0xb8e3('0x5'),'transport':[_0xb8e3('0x6'),'ws',_0xb8e3('0x7')],'disallow':[_0xb8e3('0x8')],'allow':[_0xb8e3('0x9')],'defaultuser':util[_0xb8e3('0x1')](_0xb8e3('0x3'),_0xb8e3('0x2'),i),'encryption':_0xb8e3('0xa'),'avpf':_0xb8e3('0xa'),'force_avp':_0xb8e3('0xa'),'icesupport':_0xb8e3('0xa'),'dtlsenable':_0xb8e3('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xb8e3('0xb'),'dtlssetup':'actpass','callerid':util[_0xb8e3('0x1')](_0xb8e3('0xc'),util[_0xb8e3('0x1')](_0xb8e3('0x3'),'agent',i),0xfa0+i)});}db['User'][_0xb8e3('0xd')](users)[_0xb8e3('0xe')](function(){console['log']('add\x20user');})['catch'](function(_0x2772f5){console[_0xb8e3('0xf')](_0x2772f5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9ccfead..0f6fa2d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8e8=['isNil','decr','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','ChatQueue','FaxQueue','WhatsappQueues','IvrCampaigns','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','forceLogout','set','online','forceLoginByid','log','checkUserIsOnline','forceLogoutByid','error','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','userId','merge','CONNECTED','lodash','util','./logger','app','disconnectionTimeout','name','Agents','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','User','role','where','type','format','length','del','catch','get','_expire','incr'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x4f8f68,_0x533f9b){_0x4f8f68=_0x4f8f68-0x0;var _0x41237d=_0xe8e8[_0x4f8f68];return _0x41237d;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var db=require('../mysqldb')['db'];var auth=require('./schedule/auth');var logger=require(_0x8e8e('0x2'))(_0x8e8e('0x3'));var pub;var usersDisconnectionOptions={};function getDisconnectionTimeout(){return db['Setting']['find']({'attributes':['id',_0x8e8e('0x4')],'where':{'id':0x1}})['then'](function(_0x2e498a){return _0x2e498a[_0x8e8e('0x4')];});}var queryQueues={'attributes':['id',_0x8e8e('0x5')],'include':[{'as':_0x8e8e('0x6'),'model':db['User'],'attributes':['id',_0x8e8e('0x5'),'role'],'raw':!![],'where':{'role':_0x8e8e('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8e8e('0x5')],'where':{'role':_0x8e8e('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8e8e('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x8e8e('0x5')],'where':{'role':_0x8e8e('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8e8e('0x5'),'type'],'where':{'type':_0x8e8e('0x9')}};function getAssociatedResources(_0x20134b,_0x31291a,_0x146819){return db['UserProfileSection'][_0x8e8e('0xa')]({'where':{'name':_0x20134b,'userProfileId':_0x31291a},'raw':!![]})[_0x8e8e('0xb')](function(_0x254d13){if(_0x254d13){if(_0x254d13[_0x8e8e('0xc')]){switch(_0x20134b){case _0x8e8e('0xd'):case _0x8e8e('0xe'):case _0x8e8e('0xf'):case _0x8e8e('0x10'):case _0x8e8e('0x11'):case _0x8e8e('0x12'):case'WhatsappQueues':return db[_0x146819][_0x8e8e('0x13')](queryQueues);case _0x8e8e('0x14'):return db[_0x146819]['findAll'](queryTelephones);case _0x8e8e('0x15'):return db[_0x146819][_0x8e8e('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x146819][_0x8e8e('0x13')](queryCampaigns);}}else{return db[_0x8e8e('0x16')][_0x8e8e('0x13')]({'attributes':[_0x8e8e('0x17')],'where':{'sectionId':_0x254d13['id']},'raw':!![]})[_0x8e8e('0xb')](function(_0x36c329){if(_0x36c329){var _0xa802b9={'where':{'id':_[_0x8e8e('0x18')](_0x36c329,_0x8e8e('0x17'))},'raw':!![]};switch(_0x146819){case _0x8e8e('0x19'):_0xa802b9['where'][_0x8e8e('0x1a')]=_0x8e8e('0x8');break;case'Campaign':_0xa802b9[_0x8e8e('0x1b')][_0x8e8e('0x1c')]=_0x8e8e('0x9');break;}return db[_0x146819][_0x8e8e('0x13')](_0xa802b9);}else{return[];}});}}else{return[];}})['then'](function(_0x586b7e){return _0x586b7e;});}function joinOrLeaveQueues(_0x52b71e,_0x2676f3,_0x3a0d03,_0x351b2b){_0x52b71e[_0x2676f3](util[_0x8e8e('0x1d')]('%s:queue:%s',_0x3a0d03,_0x351b2b[_0x8e8e('0x5')]));if(_0x351b2b[_0x8e8e('0x6')]){for(var _0x9fa208=0x0;_0x9fa208<_0x351b2b['Agents'][_0x8e8e('0x1e')];_0x9fa208+=0x1){_0x52b71e[_0x2676f3](util['format']('user:%s',_0x351b2b[_0x8e8e('0x6')][_0x9fa208][_0x8e8e('0x5')]));}}}function removeExpireKey(_0x4ada9d){return pub[_0x8e8e('0x1f')](_0x4ada9d)[_0x8e8e('0xb')](function(_0x32899c){return _0x32899c>0x0?!![]:![];})[_0x8e8e('0x20')](function(){return![];});}function incrementConnectionCounter(_0x4e16c3){return new Promise(function(_0x344830,_0x1dfed4){var _0x1ca842=getAgentKey(_0x4e16c3);pub[_0x8e8e('0x21')](_0x1ca842,function(_0xa24bae,_0x1eba2a){if(_0xa24bae)return _0x1dfed4(_0xa24bae);return removeExpireKey(_0x1ca842+_0x8e8e('0x22'))[_0x8e8e('0xb')](function(_0x2b5e17){if(_0x2b5e17)return _0x1eba2a;return pub[_0x8e8e('0x23')](_0x1ca842);})['then'](function(_0x3fca96){_0x344830(_0x3fca96);})[_0x8e8e('0x20')](function(_0x2536df){return _0x1dfed4(_0x2536df);});});});}function decrementConnectionCounter(_0x4929ab){return new Promise(function(_0xaba2cc,_0x9826e0){var _0x2580eb=getAgentKey(_0x4929ab);pub[_0x8e8e('0x21')](_0x2580eb,function(_0x5edf41,_0x2bc5a5){if(_0x5edf41)return _0x9826e0(_0x5edf41);if(_[_0x8e8e('0x24')](_0x2bc5a5))return 0x0;if(parseInt(_0x2bc5a5)===0x0)return 0x0;return pub[_0x8e8e('0x25')](_0x2580eb)['then'](function(_0x4609fe){_0xaba2cc(_0x4609fe);})[_0x8e8e('0x20')](function(_0x5a8cfe){return _0x9826e0(_0x5a8cfe);});});});}function joinOrLeave(_0x198ae2,_0x1aadd3,_0x4b3f0c){var _0x52a135;if(_0x198ae2['handshake'][_0x8e8e('0x26')]['id']){db[_0x8e8e('0x19')][_0x8e8e('0x27')]({'attributes':['id',_0x8e8e('0x5'),'role',_0x8e8e('0x28'),'online','internal'],'where':{'id':_0x198ae2[_0x8e8e('0x29')][_0x8e8e('0x26')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8e8e('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e8e('0x2b')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8e8e('0x2c')],'as':_0x8e8e('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e8e('0x2e')],'as':_0x8e8e('0x2f'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e8e('0x30')],'as':_0x8e8e('0x31'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e8e('0x32')],'as':_0x8e8e('0x33'),'attributes':['id'],'raw':!![]}]})[_0x8e8e('0xb')](function(_0x89f8d0){if(_0x89f8d0){_0x52a135=_0x89f8d0;_0x198ae2[_0x1aadd3](util[_0x8e8e('0x1d')]('user:%s',_0x89f8d0[_0x8e8e('0x5')]));var _0x4d48ec=[];switch(_0x89f8d0[_0x8e8e('0x1a')]){case _0x8e8e('0x34'):_0x198ae2[_0x1aadd3](_0x8e8e('0x35'));_0x198ae2[_0x1aadd3](_0x8e8e('0x36'));if(queryQueues[_0x8e8e('0x37')]('include')){delete queryQueues[_0x8e8e('0x38')];}_0x4d48ec['push'](db[_0x8e8e('0x39')][_0x8e8e('0x13')](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db['ChatQueue'][_0x8e8e('0x13')](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db['FaxQueue'][_0x8e8e('0x13')](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db[_0x8e8e('0x3b')][_0x8e8e('0x13')](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db[_0x8e8e('0x3c')]['findAll'](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db[_0x8e8e('0x3d')][_0x8e8e('0x13')](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db[_0x8e8e('0x3e')]['findAll'](queryQueues));_0x4d48ec[_0x8e8e('0x3a')](db['User'][_0x8e8e('0x13')](queryTelephones));_0x4d48ec['push'](db['Trunk'][_0x8e8e('0x13')](queryTrunks));_0x4d48ec[_0x8e8e('0x3a')](db[_0x8e8e('0x3f')]['findAll'](queryCampaigns));_0x4d48ec[_0x8e8e('0x3a')](db['User'][_0x8e8e('0x13')](queryAgents));break;case'user':_0x198ae2[_0x1aadd3](_0x8e8e('0x35'));_0x198ae2[_0x1aadd3](_0x8e8e('0x36'));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources('VoiceQueues',_0x89f8d0[_0x8e8e('0x28')],'VoiceQueue'));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources('ChatQueues',_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x40')));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0xf'),_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x41')));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0x10'),_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x3b')));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources('MailQueues',_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x3c')));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0x12'),_0x89f8d0[_0x8e8e('0x28')],'OpenchannelQueue'));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0x42'),_0x89f8d0[_0x8e8e('0x28')],'WhatsappQueue'));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0x14'),_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x19')));_0x4d48ec[_0x8e8e('0x3a')](getAssociatedResources(_0x8e8e('0x15'),_0x89f8d0[_0x8e8e('0x28')],'Trunk'));_0x4d48ec['push'](getAssociatedResources(_0x8e8e('0x43'),_0x89f8d0[_0x8e8e('0x28')],_0x8e8e('0x3f')));_0x4d48ec[_0x8e8e('0x3a')](db['User'][_0x8e8e('0x13')](queryAgents));break;case _0x8e8e('0x7'):_0x198ae2[_0x1aadd3](_0x8e8e('0x35'));_0x198ae2[_0x1aadd3](_0x8e8e('0x36'));_0x4d48ec[_0x8e8e('0x3a')](_0x89f8d0['getVoiceQueues']({'attributes':['id','name']}));_0x4d48ec['push'](_0x89f8d0[_0x8e8e('0x44')]({'attributes':['id',_0x8e8e('0x5')]}));_0x4d48ec[_0x8e8e('0x3a')](_0x89f8d0['getFaxQueues']({'attributes':['id',_0x8e8e('0x5')]}));_0x4d48ec[_0x8e8e('0x3a')](_0x89f8d0[_0x8e8e('0x45')]({'attributes':['id','name']}));_0x4d48ec[_0x8e8e('0x3a')](_0x89f8d0[_0x8e8e('0x46')]({'attributes':['id',_0x8e8e('0x5')]}));_0x4d48ec['push'](_0x89f8d0[_0x8e8e('0x47')]({'attributes':['id',_0x8e8e('0x5')]}));_0x4d48ec['push'](_0x89f8d0['getWhatsappQueues']({'attributes':['id',_0x8e8e('0x5')]}));break;}return Promise[_0x8e8e('0x48')](_0x4d48ec);}})['then'](function(_0x963051){if(_0x963051&&_0x963051[_0x8e8e('0x1e')]){for(var _0x15f544=0x0;_0x15f544<_0x963051[_0x8e8e('0x1e')];_0x15f544+=0x1){for(var _0x20451f=0x0;_0x20451f<_0x963051[_0x15f544]['length'];_0x20451f+=0x1){switch(_0x15f544){case 0x0:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x49'),_0x963051[_0x15f544][_0x20451f]);break;case 0x1:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x4a'),_0x963051[_0x15f544][_0x20451f]);break;case 0x2:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x4b'),_0x963051[_0x15f544][_0x20451f]);break;case 0x3:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,'sms',_0x963051[_0x15f544][_0x20451f]);break;case 0x4:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x4c'),_0x963051[_0x15f544][_0x20451f]);break;case 0x5:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x4d'),_0x963051[_0x15f544][_0x20451f]);break;case 0x6:joinOrLeaveQueues(_0x198ae2,_0x1aadd3,_0x8e8e('0x4e'),_0x963051[_0x15f544][_0x20451f]);break;case 0x7:if(_0x52a135['role']!==_0x8e8e('0x7'))_0x198ae2[_0x1aadd3](util[_0x8e8e('0x1d')](_0x8e8e('0x4f'),_0x963051[_0x15f544][_0x20451f][_0x8e8e('0x5')]));break;case 0x8:if(_0x52a135[_0x8e8e('0x1a')]!==_0x8e8e('0x7'))_0x198ae2[_0x1aadd3](util[_0x8e8e('0x1d')](_0x8e8e('0x50'),_0x963051[_0x15f544][_0x20451f][_0x8e8e('0x5')]));break;case 0x9:if(_0x52a135['role']!==_0x8e8e('0x7'))_0x198ae2[_0x1aadd3](util[_0x8e8e('0x1d')](_0x8e8e('0x51'),_0x963051[_0x15f544][_0x20451f][_0x8e8e('0x1c')],_0x963051[_0x15f544][_0x20451f][_0x8e8e('0x5')]));break;case 0xa:_0x198ae2[_0x1aadd3](util[_0x8e8e('0x1d')](_0x8e8e('0x52'),_0x963051[_0x15f544][_0x20451f]['name']));break;}}}}})[_0x8e8e('0xb')](function(){if(_0x1aadd3===_0x8e8e('0x53')){var _0x35b21d=_[_0x8e8e('0x18')](_0x52a135[_0x8e8e('0x2a')],'id');return _0x52a135[_0x8e8e('0x54')](_0x35b21d)[_0x8e8e('0xb')](function(){for(var _0x3866d1=0x0;_0x3866d1<_0x35b21d[_0x8e8e('0x1e')];_0x3866d1+=0x1){_0x4b3f0c[_0x8e8e('0x55')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x35b21d[_0x3866d1]),'UserId':Number(_0x52a135['id'])});}});}})[_0x8e8e('0xb')](function(){if(_0x1aadd3===_0x8e8e('0x53')){var _0x2a28b9=_[_0x8e8e('0x18')](_0x52a135[_0x8e8e('0x56')],'id');return _0x52a135[_0x8e8e('0x57')](_0x2a28b9)[_0x8e8e('0xb')](function(){for(var _0x530bfe=0x0;_0x530bfe<_0x2a28b9[_0x8e8e('0x1e')];_0x530bfe+=0x1){_0x4b3f0c[_0x8e8e('0x55')](_0x8e8e('0x58'),{'MailInteractionId':Number(_0x2a28b9[_0x530bfe]),'UserId':Number(_0x52a135['id'])});}});}})[_0x8e8e('0xb')](function(){if(_0x1aadd3==='leave'){var _0x12814c=_[_0x8e8e('0x18')](_0x52a135[_0x8e8e('0x2d')],'id');return _0x52a135[_0x8e8e('0x59')](_0x12814c)['then'](function(){for(var _0x1b2058=0x0;_0x1b2058<_0x12814c[_0x8e8e('0x1e')];_0x1b2058+=0x1){_0x4b3f0c['emit'](_0x8e8e('0x5a'),{'FaxInteractionId':Number(_0x12814c[_0x1b2058]),'UserId':Number(_0x52a135['id'])});}});}})['then'](function(){if(_0x1aadd3==='leave'){var _0x4cadb8=_['map'](_0x52a135[_0x8e8e('0x2f')],'id');return _0x52a135[_0x8e8e('0x5b')](_0x4cadb8)[_0x8e8e('0xb')](function(){for(var _0x162c1a=0x0;_0x162c1a<_0x4cadb8[_0x8e8e('0x1e')];_0x162c1a+=0x1){_0x4b3f0c['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4cadb8[_0x162c1a]),'UserId':Number(_0x52a135['id'])});}});}})[_0x8e8e('0xb')](function(){if(_0x1aadd3===_0x8e8e('0x53')){var _0x7068f0=_[_0x8e8e('0x18')](_0x52a135[_0x8e8e('0x31')],'id');return _0x52a135['removeOpenchannelInteractions'](_0x7068f0)['then'](function(){for(var _0x732da9=0x0;_0x732da9<_0x7068f0[_0x8e8e('0x1e')];_0x732da9+=0x1){_0x4b3f0c[_0x8e8e('0x55')](_0x8e8e('0x5c'),{'OpenchannelInteractionId':Number(_0x7068f0[_0x732da9]),'UserId':Number(_0x52a135['id'])});}});}})['then'](function(){if(_0x1aadd3===_0x8e8e('0x53')){var _0xb1777f=_[_0x8e8e('0x18')](_0x52a135[_0x8e8e('0x33')],'id');return _0x52a135[_0x8e8e('0x5d')](_0xb1777f)[_0x8e8e('0xb')](function(){for(var _0x59b2c5=0x0;_0x59b2c5<_0xb1777f[_0x8e8e('0x1e')];_0x59b2c5+=0x1){_0x4b3f0c['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xb1777f[_0x59b2c5]),'UserId':Number(_0x52a135['id'])});}});}})[_0x8e8e('0xb')](function(){if(_0x52a135[_0x8e8e('0x1a')]!=='agent')return;return _0x1aadd3===_0x8e8e('0x5e')?incrementConnectionCounter(_0x52a135):decrementConnectionCounter(_0x52a135);})[_0x8e8e('0xb')](function(_0x4e729b){if(_0x52a135[_0x8e8e('0x1a')]!==_0x8e8e('0x7'))return;if(_0x1aadd3===_0x8e8e('0x53')){if(_0x4e729b===0x0){if(usersDisconnectionOptions[_0x52a135['id']]&&usersDisconnectionOptions[_0x52a135['id']][_0x8e8e('0x5f')]){delete usersDisconnectionOptions[_0x52a135['id']];return;}return getDisconnectionTimeout()['then'](function(_0x28a769){var _0x15c363=_0x28a769*0x3c;var _0x135957=getAgentKey(_0x52a135);pub[_0x8e8e('0x60')](_0x135957+_0x8e8e('0x22'),_0x15c363,'EX',_0x15c363);});}}else{if(_0x52a135[_0x8e8e('0x61')])return;return auth[_0x8e8e('0x62')](_0x52a135);}})['catch'](function(_0x1e9da1){_0x198ae2[_0x8e8e('0x63')](_0x1e9da1);});}}function onDisconnect(_0x7701cc,_0x3123b2){joinOrLeave(_0x7701cc,_0x8e8e('0x53'),_0x3123b2);}function onConnect(_0x4d1878,_0x4b7766){joinOrLeave(_0x4d1878,'join',_0x4b7766);}function getAgentKey(_0x3ba266){return _0x3ba266['id']+':'+_0x3ba266[_0x8e8e('0x5')];}exports['getAgentKey']=getAgentKey;exports[_0x8e8e('0x64')]=function(_0x33de63){return db['User'][_0x8e8e('0xa')]({'attributes':['id','name',_0x8e8e('0x61')],'where':{'id':_0x33de63['id']},'raw':!![]})[_0x8e8e('0xb')](function(_0x22a225){if(!_0x22a225||!_0x22a225['online'])return;var _0x33a6d4=getAgentKey(_0x22a225);pub[_0x8e8e('0x1f')](_0x33a6d4);return auth[_0x8e8e('0x65')](_0x22a225);})[_0x8e8e('0x20')](function(_0xdc60ea){logger[_0x8e8e('0x66')](_0xdc60ea);});};exports[_0x8e8e('0x67')]=function(_0x1554a0,_0x35565c){pub=_0x35565c;_0x1554a0['on']('connection',function(_0x4cacef){_0x4cacef[_0x8e8e('0x68')](0x0);_0x4cacef[_0x8e8e('0x69')]=_0x4cacef['request'][_0x8e8e('0x6a')][_0x8e8e('0x6b')]+':'+_0x4cacef[_0x8e8e('0x6c')][_0x8e8e('0x6a')][_0x8e8e('0x6d')];_0x4cacef['connectedAt']=new Date();_0x4cacef['log']=function(_0x35cd59){console[_0x8e8e('0x63')](_0x8e8e('0x6e')+_0x4cacef[_0x8e8e('0x6f')][_0x8e8e('0x5')]+'['+_0x4cacef[_0x8e8e('0x69')]+']',_0x35cd59);};_0x4cacef['on'](_0x8e8e('0x70'),function(){onDisconnect(_0x4cacef,_0x1554a0);_0x4cacef[_0x8e8e('0x63')](_0x8e8e('0x71'));});_0x4cacef['on']('set-disconnect-options',function(_0x48f2d1,_0x2657b9){if(!_0x48f2d1[_0x8e8e('0x72')])return _0x2657b9();var _0x5ad052={[_0x48f2d1[_0x8e8e('0x72')]]:{'forceLogout':_0x48f2d1[_0x8e8e('0x5f')]}};usersDisconnectionOptions=_[_0x8e8e('0x73')](usersDisconnectionOptions,_0x5ad052);return _0x2657b9();});onConnect(_0x4cacef,_0x1554a0);_0x4cacef[_0x8e8e('0x63')](_0x8e8e('0x74'));});}; \ No newline at end of file +var _0x54e1=['userProfileId','online','internal','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','emit','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','join','forceLogout','set','log','getAgentKey','checkUserIsOnline','findOne','forceLogoutByid','default','setMaxListeners','address','remoteAddress','request','connection','remotePort','SocketIO\x20','disconnect','DISCONNECTED','set-disconnect-options','userId','merge','CONNECTED','lodash','util','../mysqldb','./logger','app','find','disconnectionTimeout','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','format','length','del','catch','get','_expire','incr','isNil','decr','handshake','query'];(function(_0x69c353,_0x264061){var _0x9a5a1f=function(_0x2cc31d){while(--_0x2cc31d){_0x69c353['push'](_0x69c353['shift']());}};_0x9a5a1f(++_0x264061);}(_0x54e1,0x147));var _0x154e=function(_0x5c4008,_0x5893ac){_0x5c4008=_0x5c4008-0x0;var _0x39343f=_0x54e1[_0x5c4008];return _0x39343f;};'use strict';var _=require(_0x154e('0x0'));var util=require(_0x154e('0x1'));var db=require(_0x154e('0x2'))['db'];var auth=require('./schedule/auth');var logger=require(_0x154e('0x3'))(_0x154e('0x4'));var pub;var usersDisconnectionOptions={};function getDisconnectionTimeout(){return db['Setting'][_0x154e('0x5')]({'attributes':['id',_0x154e('0x6')],'where':{'id':0x1}})['then'](function(_0x2431df){return _0x2431df[_0x154e('0x6')];});}var queryQueues={'attributes':['id',_0x154e('0x7')],'include':[{'as':_0x154e('0x8'),'model':db[_0x154e('0x9')],'attributes':['id',_0x154e('0x7'),_0x154e('0xa')],'raw':!![],'where':{'role':_0x154e('0xb')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x154e('0x7')],'where':{'role':_0x154e('0xc')}};var queryTrunks={'raw':!![],'attributes':['id',_0x154e('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x154e('0x7')],'where':{'role':_0x154e('0xb')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x154e('0x7'),_0x154e('0xd')],'where':{'type':_0x154e('0xe')}};function getAssociatedResources(_0x5ad7b1,_0x3fcb0a,_0x557d26){return db[_0x154e('0xf')]['findOne']({'where':{'name':_0x5ad7b1,'userProfileId':_0x3fcb0a},'raw':!![]})[_0x154e('0x10')](function(_0x3696da){if(_0x3696da){if(_0x3696da[_0x154e('0x11')]){switch(_0x5ad7b1){case _0x154e('0x12'):case _0x154e('0x13'):case _0x154e('0x14'):case _0x154e('0x15'):case _0x154e('0x16'):case _0x154e('0x17'):case _0x154e('0x18'):return db[_0x557d26][_0x154e('0x19')](queryQueues);case _0x154e('0x1a'):return db[_0x557d26][_0x154e('0x19')](queryTelephones);case _0x154e('0x1b'):return db[_0x557d26][_0x154e('0x19')](queryTrunks);case _0x154e('0x1c'):return db[_0x557d26]['findAll'](queryCampaigns);}}else{return db[_0x154e('0x1d')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x3696da['id']},'raw':!![]})[_0x154e('0x10')](function(_0xd925c0){if(_0xd925c0){var _0x1f1ad6={'where':{'id':_[_0x154e('0x1e')](_0xd925c0,_0x154e('0x1f'))},'raw':!![]};switch(_0x557d26){case _0x154e('0x9'):_0x1f1ad6[_0x154e('0x20')][_0x154e('0xa')]=_0x154e('0xc');break;case _0x154e('0x21'):_0x1f1ad6[_0x154e('0x20')][_0x154e('0xd')]='ivr';break;}return db[_0x557d26][_0x154e('0x19')](_0x1f1ad6);}else{return[];}});}}else{return[];}})[_0x154e('0x10')](function(_0xda0d9e){return _0xda0d9e;});}function joinOrLeaveQueues(_0x194e53,_0x1a6bed,_0x35d136,_0x19342b){_0x194e53[_0x1a6bed](util[_0x154e('0x22')]('%s:queue:%s',_0x35d136,_0x19342b[_0x154e('0x7')]));if(_0x19342b[_0x154e('0x8')]){for(var _0x52f391=0x0;_0x52f391<_0x19342b['Agents'][_0x154e('0x23')];_0x52f391+=0x1){_0x194e53[_0x1a6bed](util[_0x154e('0x22')]('user:%s',_0x19342b[_0x154e('0x8')][_0x52f391][_0x154e('0x7')]));}}}function removeExpireKey(_0x5f465b){return pub[_0x154e('0x24')](_0x5f465b)['then'](function(_0x15b247){return _0x15b247>0x0?!![]:![];})[_0x154e('0x25')](function(){return![];});}function incrementConnectionCounter(_0x554d75){return new Promise(function(_0x5eb288,_0x26d95f){var _0x2d6953=getAgentKey(_0x554d75);pub[_0x154e('0x26')](_0x2d6953,function(_0x5bd134,_0x46e0f6){if(_0x5bd134)return _0x26d95f(_0x5bd134);return removeExpireKey(_0x2d6953+_0x154e('0x27'))['then'](function(_0x109b31){if(_0x109b31)return _0x46e0f6;return pub[_0x154e('0x28')](_0x2d6953);})[_0x154e('0x10')](function(_0x40d5e4){_0x5eb288(_0x40d5e4);})[_0x154e('0x25')](function(_0xb3ef4b){return _0x26d95f(_0xb3ef4b);});});});}function decrementConnectionCounter(_0x54615b){return new Promise(function(_0x6a6c48,_0x18b6a4){var _0xd032ae=getAgentKey(_0x54615b);pub[_0x154e('0x26')](_0xd032ae,function(_0x48e70d,_0x93ffa6){if(_0x48e70d)return _0x18b6a4(_0x48e70d);if(_[_0x154e('0x29')](_0x93ffa6))return 0x0;if(parseInt(_0x93ffa6)===0x0)return 0x0;return pub[_0x154e('0x2a')](_0xd032ae)[_0x154e('0x10')](function(_0x12ec49){_0x6a6c48(_0x12ec49);})[_0x154e('0x25')](function(_0x5919ef){return _0x18b6a4(_0x5919ef);});});});}function joinOrLeave(_0x545d11,_0x1f922d,_0x31db2d){var _0x5d3bfd;if(_0x545d11[_0x154e('0x2b')][_0x154e('0x2c')]['id']){db['User'][_0x154e('0x5')]({'attributes':['id',_0x154e('0x7'),_0x154e('0xa'),_0x154e('0x2d'),_0x154e('0x2e'),_0x154e('0x2f')],'where':{'id':_0x545d11[_0x154e('0x2b')]['query']['id']},'include':[{'model':db[_0x154e('0x30')],'as':_0x154e('0x31'),'attributes':['id'],'raw':!![]},{'model':db[_0x154e('0x32')],'as':_0x154e('0x33'),'attributes':['id'],'raw':!![]},{'model':db[_0x154e('0x34')],'as':_0x154e('0x35'),'attributes':['id'],'raw':!![]},{'model':db[_0x154e('0x36')],'as':_0x154e('0x37'),'attributes':['id'],'raw':!![]},{'model':db[_0x154e('0x38')],'as':_0x154e('0x39'),'attributes':['id'],'raw':!![]},{'model':db[_0x154e('0x3a')],'as':_0x154e('0x3b'),'attributes':['id'],'raw':!![]}]})[_0x154e('0x10')](function(_0x5d0538){if(_0x5d0538){_0x5d3bfd=_0x5d0538;_0x545d11[_0x1f922d](util['format'](_0x154e('0x3c'),_0x5d0538[_0x154e('0x7')]));var _0xce5150=[];switch(_0x5d0538[_0x154e('0xa')]){case _0x154e('0x3d'):_0x545d11[_0x1f922d]('voice:inbound');_0x545d11[_0x1f922d](_0x154e('0x3e'));if(queryQueues[_0x154e('0x3f')](_0x154e('0x40'))){delete queryQueues[_0x154e('0x40')];}_0xce5150[_0x154e('0x41')](db[_0x154e('0x42')][_0x154e('0x19')](queryQueues));_0xce5150[_0x154e('0x41')](db[_0x154e('0x43')][_0x154e('0x19')](queryQueues));_0xce5150['push'](db['FaxQueue'][_0x154e('0x19')](queryQueues));_0xce5150['push'](db[_0x154e('0x44')][_0x154e('0x19')](queryQueues));_0xce5150[_0x154e('0x41')](db[_0x154e('0x45')][_0x154e('0x19')](queryQueues));_0xce5150['push'](db[_0x154e('0x46')][_0x154e('0x19')](queryQueues));_0xce5150[_0x154e('0x41')](db[_0x154e('0x47')][_0x154e('0x19')](queryQueues));_0xce5150[_0x154e('0x41')](db['User']['findAll'](queryTelephones));_0xce5150[_0x154e('0x41')](db[_0x154e('0x48')]['findAll'](queryTrunks));_0xce5150[_0x154e('0x41')](db[_0x154e('0x21')][_0x154e('0x19')](queryCampaigns));_0xce5150[_0x154e('0x41')](db['User'][_0x154e('0x19')](queryAgents));break;case _0x154e('0x49'):_0x545d11[_0x1f922d](_0x154e('0x4a'));_0x545d11[_0x1f922d](_0x154e('0x3e'));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x12'),_0x5d0538[_0x154e('0x2d')],'VoiceQueue'));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x13'),_0x5d0538[_0x154e('0x2d')],_0x154e('0x43')));_0xce5150['push'](getAssociatedResources(_0x154e('0x14'),_0x5d0538[_0x154e('0x2d')],'FaxQueue'));_0xce5150['push'](getAssociatedResources(_0x154e('0x15'),_0x5d0538[_0x154e('0x2d')],_0x154e('0x44')));_0xce5150['push'](getAssociatedResources('MailQueues',_0x5d0538[_0x154e('0x2d')],_0x154e('0x45')));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x17'),_0x5d0538['userProfileId'],_0x154e('0x46')));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x18'),_0x5d0538['userProfileId'],_0x154e('0x47')));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x1a'),_0x5d0538[_0x154e('0x2d')],_0x154e('0x9')));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x1b'),_0x5d0538[_0x154e('0x2d')],_0x154e('0x48')));_0xce5150[_0x154e('0x41')](getAssociatedResources(_0x154e('0x1c'),_0x5d0538[_0x154e('0x2d')],'Campaign'));_0xce5150['push'](db[_0x154e('0x9')]['findAll'](queryAgents));break;case _0x154e('0xb'):_0x545d11[_0x1f922d](_0x154e('0x4a'));_0x545d11[_0x1f922d](_0x154e('0x3e'));_0xce5150['push'](_0x5d0538[_0x154e('0x4b')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150[_0x154e('0x41')](_0x5d0538[_0x154e('0x4c')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150['push'](_0x5d0538[_0x154e('0x4d')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150['push'](_0x5d0538[_0x154e('0x4e')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150['push'](_0x5d0538[_0x154e('0x4f')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150[_0x154e('0x41')](_0x5d0538[_0x154e('0x50')]({'attributes':['id',_0x154e('0x7')]}));_0xce5150[_0x154e('0x41')](_0x5d0538[_0x154e('0x51')]({'attributes':['id',_0x154e('0x7')]}));break;}return Promise[_0x154e('0x52')](_0xce5150);}})[_0x154e('0x10')](function(_0x367ea0){if(_0x367ea0&&_0x367ea0[_0x154e('0x23')]){for(var _0xfe5bfa=0x0;_0xfe5bfa<_0x367ea0[_0x154e('0x23')];_0xfe5bfa+=0x1){for(var _0x3b62fa=0x0;_0x3b62fa<_0x367ea0[_0xfe5bfa][_0x154e('0x23')];_0x3b62fa+=0x1){switch(_0xfe5bfa){case 0x0:joinOrLeaveQueues(_0x545d11,_0x1f922d,'voice',_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x1:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x53'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x2:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x54'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x3:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x55'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x4:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x56'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x5:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x57'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x6:joinOrLeaveQueues(_0x545d11,_0x1f922d,_0x154e('0x58'),_0x367ea0[_0xfe5bfa][_0x3b62fa]);break;case 0x7:if(_0x5d3bfd[_0x154e('0xa')]!==_0x154e('0xb'))_0x545d11[_0x1f922d](util['format']('telephone:%s',_0x367ea0[_0xfe5bfa][_0x3b62fa][_0x154e('0x7')]));break;case 0x8:if(_0x5d3bfd['role']!==_0x154e('0xb'))_0x545d11[_0x1f922d](util[_0x154e('0x22')](_0x154e('0x59'),_0x367ea0[_0xfe5bfa][_0x3b62fa]['name']));break;case 0x9:if(_0x5d3bfd[_0x154e('0xa')]!==_0x154e('0xb'))_0x545d11[_0x1f922d](util[_0x154e('0x22')](_0x154e('0x5a'),_0x367ea0[_0xfe5bfa][_0x3b62fa]['type'],_0x367ea0[_0xfe5bfa][_0x3b62fa][_0x154e('0x7')]));break;case 0xa:_0x545d11[_0x1f922d](util['format']('user:%s',_0x367ea0[_0xfe5bfa][_0x3b62fa][_0x154e('0x7')]));break;}}}}})['then'](function(){if(_0x1f922d===_0x154e('0x5b')){var _0x50a0a4=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x31')],'id');return _0x5d3bfd[_0x154e('0x5c')](_0x50a0a4)['then'](function(){for(var _0x405402=0x0;_0x405402<_0x50a0a4[_0x154e('0x23')];_0x405402+=0x1){_0x31db2d['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x50a0a4[_0x405402]),'UserId':Number(_0x5d3bfd['id'])});}});}})['then'](function(){if(_0x1f922d===_0x154e('0x5b')){var _0x4b8565=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x33')],'id');return _0x5d3bfd[_0x154e('0x5d')](_0x4b8565)[_0x154e('0x10')](function(){for(var _0x3a2952=0x0;_0x3a2952<_0x4b8565[_0x154e('0x23')];_0x3a2952+=0x1){_0x31db2d['emit'](_0x154e('0x5e'),{'MailInteractionId':Number(_0x4b8565[_0x3a2952]),'UserId':Number(_0x5d3bfd['id'])});}});}})[_0x154e('0x10')](function(){if(_0x1f922d===_0x154e('0x5b')){var _0x9b2ced=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x35')],'id');return _0x5d3bfd[_0x154e('0x5f')](_0x9b2ced)[_0x154e('0x10')](function(){for(var _0x4dad06=0x0;_0x4dad06<_0x9b2ced[_0x154e('0x23')];_0x4dad06+=0x1){_0x31db2d['emit'](_0x154e('0x60'),{'FaxInteractionId':Number(_0x9b2ced[_0x4dad06]),'UserId':Number(_0x5d3bfd['id'])});}});}})[_0x154e('0x10')](function(){if(_0x1f922d===_0x154e('0x5b')){var _0x51307d=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x37')],'id');return _0x5d3bfd[_0x154e('0x61')](_0x51307d)[_0x154e('0x10')](function(){for(var _0x527e49=0x0;_0x527e49<_0x51307d[_0x154e('0x23')];_0x527e49+=0x1){_0x31db2d[_0x154e('0x62')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x51307d[_0x527e49]),'UserId':Number(_0x5d3bfd['id'])});}});}})[_0x154e('0x10')](function(){if(_0x1f922d==='leave'){var _0x3a7680=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x39')],'id');return _0x5d3bfd[_0x154e('0x63')](_0x3a7680)[_0x154e('0x10')](function(){for(var _0x25ceb9=0x0;_0x25ceb9<_0x3a7680[_0x154e('0x23')];_0x25ceb9+=0x1){_0x31db2d[_0x154e('0x62')](_0x154e('0x64'),{'OpenchannelInteractionId':Number(_0x3a7680[_0x25ceb9]),'UserId':Number(_0x5d3bfd['id'])});}});}})[_0x154e('0x10')](function(){if(_0x1f922d===_0x154e('0x5b')){var _0x4b6059=_[_0x154e('0x1e')](_0x5d3bfd[_0x154e('0x3b')],'id');return _0x5d3bfd['removeWhatsappInteractions'](_0x4b6059)[_0x154e('0x10')](function(){for(var _0x1a6d97=0x0;_0x1a6d97<_0x4b6059[_0x154e('0x23')];_0x1a6d97+=0x1){_0x31db2d[_0x154e('0x62')](_0x154e('0x65'),{'WhatsappInteractionId':Number(_0x4b6059[_0x1a6d97]),'UserId':Number(_0x5d3bfd['id'])});}});}})[_0x154e('0x10')](function(){if(_0x5d3bfd[_0x154e('0xa')]!==_0x154e('0xb'))return;return _0x1f922d===_0x154e('0x66')?incrementConnectionCounter(_0x5d3bfd):decrementConnectionCounter(_0x5d3bfd);})[_0x154e('0x10')](function(_0x42b831){if(_0x5d3bfd['role']!==_0x154e('0xb'))return;if(_0x1f922d===_0x154e('0x5b')){if(_0x42b831===0x0){if(usersDisconnectionOptions[_0x5d3bfd['id']]&&usersDisconnectionOptions[_0x5d3bfd['id']][_0x154e('0x67')]){delete usersDisconnectionOptions[_0x5d3bfd['id']];return;}return getDisconnectionTimeout()[_0x154e('0x10')](function(_0x5d636e){var _0x45f587=_0x5d636e*0x3c;var _0x48c00b=getAgentKey(_0x5d3bfd);pub[_0x154e('0x68')](_0x48c00b+'_expire',_0x45f587,'EX',_0x45f587);});}}else{if(_0x5d3bfd['online'])return;return auth['forceLoginByid'](_0x5d3bfd);}})[_0x154e('0x25')](function(_0x2f3a27){_0x545d11[_0x154e('0x69')](_0x2f3a27);});}}function onDisconnect(_0x12f446,_0x201f8){joinOrLeave(_0x12f446,_0x154e('0x5b'),_0x201f8);}function onConnect(_0x198113,_0x59d1ec){joinOrLeave(_0x198113,_0x154e('0x66'),_0x59d1ec);}function getAgentKey(_0x34f6af){return _0x34f6af['id']+':'+_0x34f6af['name'];}exports[_0x154e('0x6a')]=getAgentKey;exports[_0x154e('0x6b')]=function(_0x53baa5){return db[_0x154e('0x9')][_0x154e('0x6c')]({'attributes':['id',_0x154e('0x7'),_0x154e('0x2e')],'where':{'id':_0x53baa5['id']},'raw':!![]})[_0x154e('0x10')](function(_0x395bfb){if(!_0x395bfb||!_0x395bfb[_0x154e('0x2e')])return;var _0x309c67=getAgentKey(_0x395bfb);pub[_0x154e('0x24')](_0x309c67);return auth[_0x154e('0x6d')](_0x395bfb);})[_0x154e('0x25')](function(_0x8c931c){logger['error'](_0x8c931c);});};exports[_0x154e('0x6e')]=function(_0x468d4e,_0xf3f3e9){pub=_0xf3f3e9;_0x468d4e['on']('connection',function(_0x297c59){_0x297c59[_0x154e('0x6f')](0x0);_0x297c59[_0x154e('0x70')]=_0x297c59['request']['connection'][_0x154e('0x71')]+':'+_0x297c59[_0x154e('0x72')][_0x154e('0x73')][_0x154e('0x74')];_0x297c59['connectedAt']=new Date();_0x297c59[_0x154e('0x69')]=function(_0x2a62e1){console[_0x154e('0x69')](_0x154e('0x75')+_0x297c59['nsp']['name']+'['+_0x297c59[_0x154e('0x70')]+']',_0x2a62e1);};_0x297c59['on'](_0x154e('0x76'),function(){onDisconnect(_0x297c59,_0x468d4e);_0x297c59[_0x154e('0x69')](_0x154e('0x77'));});_0x297c59['on'](_0x154e('0x78'),function(_0x1bf2c1,_0x49c825){if(!_0x1bf2c1[_0x154e('0x79')])return _0x49c825();var _0x141044={[_0x1bf2c1['userId']]:{'forceLogout':_0x1bf2c1[_0x154e('0x67')]}};usersDisconnectionOptions=_[_0x154e('0x7a')](usersDisconnectionOptions,_0x141044);return _0x49c825();});onConnect(_0x297c59,_0x468d4e);_0x297c59[_0x154e('0x69')](_0x154e('0x7b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 375e942..bfdf954 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 _0xa53b=['ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappInteraction','afterUpdate','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','channel','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','get','offlineMessage','opened','ContactId','query','AfterCreate','changed','closed','substatus','sequelize','AfterUpdate','User','find','fullname','email','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','http','Chat'];(function(_0x5ce1a6,_0x8a004b){var _0x22f020=function(_0x56fb83){while(--_0x56fb83){_0x5ce1a6['push'](_0x5ce1a6['shift']());}};_0x22f020(++_0x8a004b);}(_0xa53b,0x8e));var _0xba53=function(_0x285bcd,_0xebb273){_0x285bcd=_0x285bcd-0x0;var _0x293c3e=_0xa53b[_0x285bcd];return _0x293c3e;};'use strict';var util=require(_0xba53('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xba53('0x1'));var logger=require(_0xba53('0x2'))(_0xba53('0x3'));var client=jayson['client'][_0xba53('0x4')]({'port':0x232a});var triggers=[{'channel':_0xba53('0x5'),'model':_0xba53('0x6'),'event':_0xba53('0x7'),'condition':_0xba53('0x8'),'callback':afterCreate},{'channel':_0xba53('0x5'),'model':'ChatInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xba53('0x5'),'model':_0xba53('0x9'),'event':_0xba53('0x7'),'condition':_0xba53('0xa'),'callback':afterCreateMessage},{'channel':_0xba53('0x5'),'model':'ChatOfflineMessage','event':_0xba53('0x7'),'condition':_0xba53('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0xba53('0xb'),'model':_0xba53('0xc'),'event':_0xba53('0x7'),'condition':_0xba53('0x8'),'callback':afterCreate},{'channel':_0xba53('0xb'),'model':_0xba53('0xc'),'event':'afterUpdate','condition':_0xba53('0xd'),'callback':afterUpdate},{'channel':_0xba53('0xb'),'model':'SmsMessage','event':_0xba53('0x7'),'condition':_0xba53('0xa'),'callback':afterCreateMessage},{'channel':_0xba53('0xe'),'model':'WhatsappInteraction','event':_0xba53('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xba53('0xe'),'model':_0xba53('0xf'),'event':_0xba53('0x10'),'condition':_0xba53('0xd'),'callback':afterUpdate},{'channel':_0xba53('0xe'),'model':_0xba53('0x11'),'event':_0xba53('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xba53('0x12'),'model':'FaxInteraction','event':_0xba53('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xba53('0x12'),'model':'FaxInteraction','event':'afterUpdate','condition':_0xba53('0xd'),'callback':afterUpdate},{'channel':_0xba53('0x12'),'model':_0xba53('0x13'),'event':_0xba53('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xba53('0x14'),'model':_0xba53('0x15'),'event':'afterCreate','condition':_0xba53('0x8'),'callback':afterCreate},{'channel':_0xba53('0x14'),'model':_0xba53('0x15'),'event':_0xba53('0x10'),'condition':_0xba53('0xd'),'callback':afterUpdate},{'channel':_0xba53('0x14'),'model':_0xba53('0x16'),'event':_0xba53('0x7'),'condition':_0xba53('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xba53('0x17'),'event':_0xba53('0x7'),'condition':_0xba53('0x8'),'callback':afterCreate},{'channel':_0xba53('0x18'),'model':'OpenchannelInteraction','event':_0xba53('0x10'),'condition':_0xba53('0xd'),'callback':afterUpdate},{'channel':_0xba53('0x18'),'model':_0xba53('0x19'),'event':_0xba53('0x7'),'condition':_0xba53('0xa'),'callback':afterCreateMessage}];function request(_0x747c3e){return client[_0xba53('0x1a')](_0xba53('0x1b'),_0x747c3e)[_0xba53('0x1c')](function(_0x55155c){logger[_0xba53('0x1d')](_0xba53('0x1e'),_0xba53('0x1b'),_0x55155c);if(_0x55155c[_0xba53('0x1f')]){if(_0x55155c['error']['code']===0x1f4){logger[_0xba53('0x1f')](_0xba53('0x1e'),'EventManager',_0x55155c['error']);}}})[_0xba53('0x20')](function(_0x4a02c8){logger[_0xba53('0x1f')](_0xba53('0x1e'),_0xba53('0x1b'),_0x4a02c8);});}function afterCreateMessage(_0x3d60ab){return function(_0x4f0fd8){_0x4f0fd8=_0x4f0fd8['get']({'plain':!![]});_0x4f0fd8[_0xba53('0x21')]=_0x3d60ab;_0x4f0fd8[_0xba53('0x22')]=_0x3d60ab;_0x4f0fd8[_0xba53('0x23')]=_0x4f0fd8[_0xba53('0x24')];Promise[_0xba53('0x25')]()[_0xba53('0x1c')](function(){if(typeof _0x4f0fd8['ContactId']===_0xba53('0x26'))return null;var _0x5555cb=_0xba53('0x27')+_0x4f0fd8['ContactId'];return db['sequelize']['query'](_0x5555cb,{'type':db[_0xba53('0x28')][_0xba53('0x29')][_0xba53('0x2a')],'raw':!![]});})[_0xba53('0x1c')](function(_0x43e90e){if(_0x43e90e){_0x4f0fd8[_0xba53('0x2b')]=_0x43e90e[0x0];}if(typeof _0x4f0fd8[_0xba53('0x2c')]==='undefined')return;return getAgent(_0x4f0fd8[_0xba53('0x2c')]);})[_0xba53('0x1c')](function(_0x36eb59){if(_0x36eb59){_0x4f0fd8[_0xba53('0x2d')]=util[_0xba53('0x2e')](_0xba53('0x2f'),_0x36eb59[_0xba53('0x30')]);_0x4f0fd8[_0xba53('0x31')]=_0x36eb59;_0x4f0fd8[_0xba53('0x21')]=_0x3d60ab;return request({'event':_0xba53('0x32'),'message':_0x4f0fd8});}else{return request({'event':'outgoingmessage','message':_0x4f0fd8});}})['catch'](function(_0x6a6fc2){logger[_0xba53('0x1f')](_0xba53('0x1e'),'AfterCreateMessage',_0x6a6fc2);});};}function afterCreateOfflineMessage(_0x4f9fae){return function(_0x491f83){_0x491f83=_0x491f83[_0xba53('0x33')]({'plain':!![]});_0x491f83[_0xba53('0x21')]=_0x4f9fae;_0x491f83[_0xba53('0x22')]=_0x4f9fae;_0x491f83[_0xba53('0x23')]=_0xba53('0x34');return request({'event':_0x491f83[_0xba53('0x23')],'message':_0x491f83});};}function afterCreate(_0x5402ba,_0x5318c2){return function(_0x5c678d){_0x5c678d=_0x5c678d[_0xba53('0x33')]({'plain':!![]});_0x5c678d[_0xba53('0x21')]=_0x5402ba;_0x5c678d[_0xba53('0x22')]=_0x5402ba;_0x5c678d[_0xba53('0x23')]=_0xba53('0x35');Promise[_0xba53('0x25')]()[_0xba53('0x1c')](function(){var _0x3c7aec=_0xba53('0x27')+_0x5c678d[_0xba53('0x36')];return db['sequelize'][_0xba53('0x37')](_0x3c7aec,{'type':db[_0xba53('0x28')][_0xba53('0x29')]['SELECT'],'raw':!![]});})[_0xba53('0x1c')](function(_0x59b3f4){if(_0x59b3f4){_0x5c678d[_0xba53('0x2b')]=_0x59b3f4[0x0];}if(typeof _0x5c678d[_0xba53('0x2c')]===_0xba53('0x26'))return;return getAgent(_0x5c678d[_0xba53('0x2c')]);})[_0xba53('0x1c')](function(_0x47af3d){if(_0x47af3d){_0x5c678d[_0xba53('0x2d')]=util[_0xba53('0x2e')](_0xba53('0x2f'),_0x47af3d[_0xba53('0x30')]);_0x5c678d['agent']=_0x47af3d;}return request({'event':_0x5318c2,'message':_0x5c678d});})[_0xba53('0x20')](function(_0x119654){logger[_0xba53('0x1f')](_0xba53('0x1e'),_0xba53('0x38'),_0x119654);});};}function afterUpdate(_0x38c93b){return function(_0x1cf73d){var _0x59ec96=_0x1cf73d[_0xba53('0x39')](_0xba53('0x3a'))&&_0x1cf73d[_0xba53('0x3a')];var _0x1115bb=_0x1cf73d[_0xba53('0x39')](_0xba53('0x3b'));if(_0x59ec96||_0x1115bb){var _0x5968d7=_0x59ec96?'closedinteraction':'substatus';var _0x9f2825=_0x1cf73d['get']({'plain':!![]});_0x9f2825['channel']=_0x38c93b;_0x9f2825[_0xba53('0x22')]=_0x38c93b;_0x9f2825[_0xba53('0x23')]=_0x59ec96?'closed':_0xba53('0x3b');var _0x502b7b=_0xba53('0x27')+_0x9f2825[_0xba53('0x36')];return db[_0xba53('0x3c')][_0xba53('0x37')](_0x502b7b,{'type':db[_0xba53('0x28')]['QueryTypes'][_0xba53('0x2a')],'raw':!![]})[_0xba53('0x1c')](function(_0x1ea318){if(_0x1ea318){_0x9f2825[_0xba53('0x2b')]=_0x1ea318[0x0];}if(typeof _0x9f2825[_0xba53('0x2c')]===_0xba53('0x26'))return;return getAgent(_0x9f2825[_0xba53('0x2c')]);})[_0xba53('0x1c')](function(_0xa67857){if(_0xa67857){_0x9f2825['interface']=util[_0xba53('0x2e')](_0xba53('0x2f'),_0xa67857[_0xba53('0x30')]);_0x9f2825[_0xba53('0x31')]=_0xa67857;}return request({'event':_0x5968d7,'message':_0x9f2825});})[_0xba53('0x20')](function(_0x320059){logger[_0xba53('0x1f')](_0xba53('0x1e'),_0xba53('0x3d'),_0x320059);});}};}function getAgent(_0x345e57){return db[_0xba53('0x3e')][_0xba53('0x3f')]({'where':{'id':_0x345e57},'attributes':['id',_0xba53('0x30'),_0xba53('0x40'),_0xba53('0x41'),'internal'],'raw':!![]})[_0xba53('0x1c')](function(_0x986d13){return _0x986d13;});}exports[_0xba53('0x42')]=function(){for(var _0x4ddd93=0x0;_0x4ddd93=_0x26d549[_0x54f9('0x14')]){throw Error(_0x54f9('0x15'));}_0x4da0e1(_0x4301a4);})[_0x54f9('0x16')](function(_0xdc1349){_0x831cd4(_0xdc1349);});});}; \ No newline at end of file +var _0x794a=['clearBlockUser','isUndefined','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x794a,0xb3));var _0xa794=function(_0x3599a4,_0x4dd464){_0x3599a4=_0x3599a4-0x0;var _0x37c266=_0x794a[_0x3599a4];return _0x37c266;};'use strict';var _=require(_0xa794('0x0'));var BPromise=require(_0xa794('0x1'));var db=require(_0xa794('0x2'))['db'];var util=require(_0xa794('0x3'));var channels=['voice',_0xa794('0x4'),_0xa794('0x5'),_0xa794('0x6'),_0xa794('0x7'),'whatsapp',_0xa794('0x8')];exports[_0xa794('0x9')]=function(){return channels;};exports[_0xa794('0xa')]=function(_0x3afb5f){_0x3afb5f=_0x3afb5f[_0xa794('0xb')]();return _[_0xa794('0xc')](channels,_0x3afb5f);};exports[_0xa794('0xd')]=function(_0x1383ad,_0x3579d4,_0x98139,_0x1f424d){var _0x75ccdb={'loginAttempts':_0x3579d4,'blocked':_0x98139};if(!_[_0xa794('0xe')](_0x1f424d)){_0x75ccdb['blockedAt']=_0x1f424d;}return _0x1383ad['updateAttributes'](_0x75ccdb);};exports[_0xa794('0xf')]=function(_0x12049c){return new BPromise(function(_0x16ae9d,_0x35c587){var _0x2e58da=0x0;if(_0x12049c[_0xa794('0x10')]!==_0xa794('0x11')){_0x16ae9d(_0x12049c);}db[_0xa794('0x12')][_0xa794('0x13')]({'where':{'role':_0xa794('0x11'),'online':!![],'id':{'$ne':_0x12049c['id']}}})[_0xa794('0x14')](function(_0x3984e4){_0x2e58da=_0x3984e4;return util['getLicense']();})[_0xa794('0x14')](function(_0x49a277){if(_0x49a277&&_0x49a277[_0xa794('0x15')]&&_0x2e58da>=_0x49a277[_0xa794('0x15')]){throw Error(_0xa794('0x16'));}_0x16ae9d(_0x12049c);})[_0xa794('0x17')](function(_0x2cea6f){_0x35c587(_0x2cea6f);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 4a7f4c9..59dd5f4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfde6=['status','render','send','404'];(function(_0x20cdf0,_0x519950){var _0x3cf8bb=function(_0x14aa89){while(--_0x14aa89){_0x20cdf0['push'](_0x20cdf0['shift']());}};_0x3cf8bb(++_0x519950);}(_0xfde6,0xaf));var _0x6fde=function(_0x25302e,_0x575b73){_0x25302e=_0x25302e-0x0;var _0x438f4a=_0xfde6[_0x25302e];return _0x438f4a;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1ba19d,_0x15df7a){var _0x4f5f65=_0x6fde('0x0');var _0x57ad31=0x194;var _0x3b0d03={'status':_0x57ad31};_0x15df7a[_0x6fde('0x1')](_0x3b0d03['status']);_0x15df7a[_0x6fde('0x2')](_0x4f5f65,{},function(_0x43e3b6,_0xd3f939){if(_0x43e3b6){return _0x15df7a[_0x6fde('0x1')](_0x3b0d03['status'])['json'](_0x3b0d03);}_0x15df7a[_0x6fde('0x3')](_0xd3f939);});}; \ No newline at end of file +var _0xcf31=['render','json','send','exports','404','status'];(function(_0x42926c,_0x41d8c5){var _0x2a08dc=function(_0x361111){while(--_0x361111){_0x42926c['push'](_0x42926c['shift']());}};_0x2a08dc(++_0x41d8c5);}(_0xcf31,0x7b));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';module[_0x1cf3('0x0')][0x194]=function pageNotFound(_0x11a6de,_0x326f03){var _0x4272b4=_0x1cf3('0x1');var _0x53846c=0x194;var _0x4b9de5={'status':_0x53846c};_0x326f03[_0x1cf3('0x2')](_0x4b9de5[_0x1cf3('0x2')]);_0x326f03[_0x1cf3('0x3')](_0x4272b4,{},function(_0x53d9a5,_0x34d640){if(_0x53d9a5){return _0x326f03[_0x1cf3('0x2')](_0x4b9de5[_0x1cf3('0x2')])[_0x1cf3('0x4')](_0x4b9de5);}_0x326f03[_0x1cf3('0x5')](_0x34d640);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8a0c83b..b82a417 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbff3=['OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','Team','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','MailMessage','Interactions','List','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','ListId','Items','FaxAccount','Dispositions','FaxAccountId','Answers','Tag','Owner','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','JscriptySessions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','Action','Actions','AutomationId','Intervals','SmsApplications','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','SalesforceAccount','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','Configurations','DeskField','int_desk_configuration_has_tags','Subject','ZohoField','ZendeskAccount','FreshdeskField','FreshdeskConfiguration','VtigerField','ServicenowField','FreshsalesAccount','FromId','SessionId','JscriptyAnswerReport','ProjectId','team_has_whatsapp_queues','WhatsappQueues','TeamVoicePrefix','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','FromChatWebsiteId','ToAgent','ToChatQueueId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','xcall','mysql','utf8_general_ci','database','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../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','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../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','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0xbff3,0xdc));var _0x3bff=function(_0x39dd95,_0x56e859){_0x39dd95=_0x39dd95-0x0;var _0x13a2af=_0xbff3[_0x39dd95];return _0x13a2af;};'use strict';var config=require(_0x3bff('0x0'));var Sequelize=require('sequelize');var _=require(_0x3bff('0x1'));var jstz=require(_0x3bff('0x2'));var timezone=jstz[_0x3bff('0x3')]();config[_0x3bff('0x4')]=_[_0x3bff('0x5')](config['sequelize'],{'database':_0x3bff('0x6'),'username':'xcall','password':_0x3bff('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x3bff('0x8')},'logging':![],'timezone':timezone[_0x3bff('0x9')](),'define':{'charset':_0x3bff('0xa'),'collate':'utf8_general_ci'}}});config[_0x3bff('0xb')]=_[_0x3bff('0x5')](config[_0x3bff('0xb')],{'database':_0x3bff('0x6'),'username':_0x3bff('0xc'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3bff('0xd'),'dialectOptions':{'charset':_0x3bff('0x8')},'logging':![],'timezone':timezone[_0x3bff('0x9')](),'define':{'charset':_0x3bff('0xa'),'collate':_0x3bff('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3bff('0x4')][_0x3bff('0xf')],config[_0x3bff('0x4')]['username'],config['sequelize'][_0x3bff('0x10')],config[_0x3bff('0x4')][_0x3bff('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x3bff('0xb')][_0x3bff('0x12')],config[_0x3bff('0xb')]['password'],config['sequelizeHistory'][_0x3bff('0x11')])};db['User']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x14'));db[_0x3bff('0x15')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x16'));db[_0x3bff('0x17')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x18'));db[_0x3bff('0x19')]=db[_0x3bff('0x4')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x3bff('0x1a')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x1b'));db[_0x3bff('0x1c')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x1d'));db['VoiceRecording']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x1e'));db['ScreenRecording']=db['sequelize']['import'](_0x3bff('0x1f'));db[_0x3bff('0x20')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x21'));db[_0x3bff('0x22')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x23'));db['VoiceCallReport']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x24'));db['VoiceDialReport']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x25'));db[_0x3bff('0x26')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x27'));db[_0x3bff('0x28')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x29'));db[_0x3bff('0x2a')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x2b'));db[_0x3bff('0x2c')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x2d'));db[_0x3bff('0x2e')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x3bff('0x2f')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x3bff('0x30')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x31'));db[_0x3bff('0x32')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x33'));db[_0x3bff('0x34')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x35'));db[_0x3bff('0x36')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x37'));db[_0x3bff('0x38')]=db[_0x3bff('0x4')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x3bff('0x39')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x3a'));db['UserWhatsappQueue']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x3b'));db[_0x3bff('0x3c')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x3bff('0x3d')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x3e'));db[_0x3bff('0x3f')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x40'));db[_0x3bff('0x41')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x42'));db[_0x3bff('0x43')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3bff('0x44')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x45'));db['MailMessage']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/mailMessage/mailMessage.model');db[_0x3bff('0x46')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x47'));db[_0x3bff('0x48')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x49'));db[_0x3bff('0x4a')]=db['sequelize'][_0x3bff('0x13')]('../api/dashboard/dashboard.model');db[_0x3bff('0x4b')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x4c'));db['FaxAccount']=db[_0x3bff('0x4')]['import']('../api/faxAccount/faxAccount.model');db[_0x3bff('0x4d')]=db['sequelize'][_0x3bff('0x13')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x4e'));db[_0x3bff('0x4f')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x50'));db['FaxQueue']=db[_0x3bff('0x4')]['import'](_0x3bff('0x51'));db['FaxQueueReport']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x52'));db[_0x3bff('0x53')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x54'));db[_0x3bff('0x55')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/smsApplication/smsApplication.model');db[_0x3bff('0x56')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x57'));db[_0x3bff('0x58')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x59'));db['SmsQueue']=db[_0x3bff('0x4')]['import'](_0x3bff('0x5a'));db['OpenchannelAccount']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x3bff('0x5b')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x5c'));db['OpenchannelInteraction']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x5d'));db[_0x3bff('0x5e')]=db[_0x3bff('0x4')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x3bff('0x5f')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x60'));db[_0x3bff('0x61')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x62'));db[_0x3bff('0x63')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x64'));db[_0x3bff('0x65')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x66'));db[_0x3bff('0x67')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x68'));db[_0x3bff('0x69')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x6a'));db[_0x3bff('0x6b')]=db['sequelize']['import'](_0x3bff('0x6c'));db[_0x3bff('0x6d')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x6e'));db[_0x3bff('0x6f')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/chatGroup/chatGroup.model');db[_0x3bff('0x70')]=db[_0x3bff('0x4')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x71'));db[_0x3bff('0x72')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x73'));db[_0x3bff('0x74')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x75'));db[_0x3bff('0x76')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x3bff('0x77')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x78'));db[_0x3bff('0x79')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x7a'));db['ReportAgentPreview']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3bff('0x7b')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x7c'));db[_0x3bff('0x7d')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x7e'));db[_0x3bff('0x7f')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x80'));db[_0x3bff('0x81')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/disposition/disposition.model');db[_0x3bff('0x82')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x83'));db[_0x3bff('0x84')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x85'));db[_0x3bff('0x86')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x87'));db[_0x3bff('0x88')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x89'));db[_0x3bff('0x8a')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x8b'));db[_0x3bff('0x8c')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x8d'));db[_0x3bff('0x8e')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x8f'));db['Tag']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/tag/tag.model');db[_0x3bff('0x90')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x91'));db[_0x3bff('0x92')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x93'));db[_0x3bff('0x94')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/variable/variable.model');db[_0x3bff('0x95')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x96'));db[_0x3bff('0x97')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x98'));db[_0x3bff('0x99')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x9a'));db[_0x3bff('0x9b')]=db[_0x3bff('0x4')]['import'](_0x3bff('0x9c'));db['AnalyticExtractedReport']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x9d'));db[_0x3bff('0x9e')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x9f'));db['AnalyticFieldReport']=db['sequelize']['import'](_0x3bff('0xa0'));db[_0x3bff('0xa1')]=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xa2'));db[_0x3bff('0xa3')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xa4'));db[_0x3bff('0xa5')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x3bff('0xa6')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x3bff('0xa7')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xa8'));db[_0x3bff('0xa9')]=db[_0x3bff('0x4')]['import'](_0x3bff('0xaa'));db[_0x3bff('0xab')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xac'));db[_0x3bff('0xad')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x3bff('0x4')]['import'](_0x3bff('0xae'));db[_0x3bff('0xaf')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xb0'));db[_0x3bff('0xb1')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xb2'));db['ZendeskAccount']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3bff('0xb3')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3bff('0xb4')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xb5'));db[_0x3bff('0xb6')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xb7'));db['FreshdeskConfiguration']=db['sequelize'][_0x3bff('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db['sequelize']['import'](_0x3bff('0xb8'));db[_0x3bff('0xb9')]=db[_0x3bff('0x4')]['import'](_0x3bff('0xba'));db[_0x3bff('0xbb')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xbc'));db['VtigerField']=db['sequelize']['import'](_0x3bff('0xbd'));db[_0x3bff('0xbe')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xbf'));db[_0x3bff('0xc0')]=db['sequelize']['import'](_0x3bff('0xc1'));db['ServicenowField']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xc2'));db[_0x3bff('0xc3')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xc4'));db[_0x3bff('0xc5')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xc6'));db[_0x3bff('0xc7')]=db['sequelize']['import'](_0x3bff('0xc8'));db['FreshsalesAccount']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xc9'));db[_0x3bff('0xca')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x3bff('0xcb')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xcc'));db[_0x3bff('0x95')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x96'));db['Network']=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xcd'));db[_0x3bff('0xce')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xcf'));db[_0x3bff('0xd0')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xd1'));db['JscriptyAnswerReport']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xd2'));db[_0x3bff('0xd3')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x3bff('0xd4')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xd5'));db[_0x3bff('0xd6')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xd7'));db[_0x3bff('0xd8')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xd9'));db[_0x3bff('0xda')]=db[_0x3bff('0x4')]['import'](_0x3bff('0xdb'));db[_0x3bff('0xdc')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xdd'));db['Setting']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xde'));db[_0x3bff('0xdf')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xe0'));db[_0x3bff('0xe1')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xe2'));db['SquareRecording']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xe3'));db[_0x3bff('0xe4')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xe5'));db['Team']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xe6'));db[_0x3bff('0xe7')]=db[_0x3bff('0x4')]['import'](_0x3bff('0xe8'));db[_0x3bff('0xe9')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xea'));db[_0x3bff('0xeb')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xec'));db[_0x3bff('0xed')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0xee'));db[_0x3bff('0xef')]=db[_0x3bff('0x4')]['import']('../api/plugin/plugin.model');db[_0x3bff('0xf0')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x3bff('0xf1')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xf2'));db['FaxTransferReport']=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x3bff('0xf3')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xf4'));db[_0x3bff('0xf5')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xf6'));db[_0x3bff('0xf7')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xf8'));db[_0x3bff('0xf9')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xfa'));db[_0x3bff('0xfb')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xfc'));db[_0x3bff('0xfd')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x3bff('0xfe')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0xff'));db[_0x3bff('0x100')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x101'));db[_0x3bff('0x102')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x103'));db[_0x3bff('0x104')]=db['sequelize'][_0x3bff('0x13')](_0x3bff('0x105'));db[_0x3bff('0x106')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x107'));db[_0x3bff('0x108')]=db['sequelize']['import'](_0x3bff('0x109'));db['WhatsappTransferReport']=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x3bff('0x4')]['import'](_0x3bff('0x10a'));db[_0x3bff('0x10b')]=db[_0x3bff('0x4')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x3bff('0x10c')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x10d'));db['TeamVoicePrefix']=db['sequelize'][_0x3bff('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x3bff('0x10e')]=db[_0x3bff('0x4')][_0x3bff('0x13')](_0x3bff('0x10f'));db[_0x3bff('0x110')]=db[_0x3bff('0x4')][_0x3bff('0x13')]('../api/user-setting/user-setting.model');db[_0x3bff('0x111')][_0x3bff('0x112')](db[_0x3bff('0x20')],{'as':_0x3bff('0x20'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x112')](db[_0x3bff('0x110')],{'as':_0x3bff('0x115'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x116')](db['VoiceRecording'],{'as':_0x3bff('0x117'),'foreignKey':_0x3bff('0x114')});db['User'][_0x3bff('0x116')](db['UserVoiceQueueRt'],{'as':_0x3bff('0x118'),'foreignKey':_0x3bff('0x114')});db['User']['hasMany'](db[_0x3bff('0x19')],{'as':_0x3bff('0x119'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db['User']['hasMany'](db[_0x3bff('0x77')],{'as':_0x3bff('0x11a'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x116')](db[_0x3bff('0x79')],{'as':_0x3bff('0x11b'),'foreignKey':'UserId'});db[_0x3bff('0x111')][_0x3bff('0x116')](db[_0x3bff('0x11c')],{'as':_0x3bff('0x11c'),'foreignKey':_0x3bff('0x114')});db['User'][_0x3bff('0x116')](db[_0x3bff('0x11d')],{'as':_0x3bff('0x11e'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')]['hasMany'](db[_0x3bff('0x67')],{'as':_0x3bff('0x11f'),'foreignKey':_0x3bff('0x114')});db['User'][_0x3bff('0x116')](db[_0x3bff('0x56')],{'as':_0x3bff('0x120'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x116')](db[_0x3bff('0x121')],{'as':'FaxInteractions','foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x116')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x3bff('0x114')});db[_0x3bff('0x111')][_0x3bff('0x116')](db[_0x3bff('0x104')],{'as':_0x3bff('0x122'),'foreignKey':'UserId'});db[_0x3bff('0x111')][_0x3bff('0x116')](db[_0x3bff('0x100')],{'as':_0x3bff('0x123'),'foreignKey':_0x3bff('0x124')});db['User'][_0x3bff('0x125')](db['UserProfile'],{'as':_0x3bff('0xfb'),'foreignKey':'userProfileId'});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x6f')],{'as':_0x3bff('0x127'),'through':_0x3bff('0x128')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x72')],{'as':_0x3bff('0x129'),'through':'cm_user_has_contacts'});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x12a'),'through':_0x3bff('0x12b')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':'user_has_teams'});db[_0x3bff('0x111')]['belongsToMany'](db['MailInteraction'],{'as':_0x3bff('0x12d'),'through':_0x3bff('0x12e')});db[_0x3bff('0x111')][_0x3bff('0x126')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x3bff('0x12f')});db['User'][_0x3bff('0x126')](db['FaxInteraction'],{'as':_0x3bff('0x130'),'through':'user_has_fax_interactions'});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x56')],{'as':_0x3bff('0x120'),'through':'user_has_sms_interactions'});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x11d')],{'as':_0x3bff('0x11e'),'through':_0x3bff('0x131')});db['User'][_0x3bff('0x126')](db['WhatsappInteraction'],{'as':_0x3bff('0x122'),'through':_0x3bff('0x132')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x1c')],{'as':_0x3bff('0x133'),'through':_0x3bff('0x30'),'required':![]});db[_0x3bff('0x111')][_0x3bff('0x126')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x3bff('0x10e'),'required':![]});db['User'][_0x3bff('0x126')](db['MailQueue'],{'as':_0x3bff('0x134'),'through':_0x3bff('0x34'),'required':![]});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x6d')],{'as':_0x3bff('0x135'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x3bff('0x111')]['belongsToMany'](db[_0x3bff('0x136')],{'as':_0x3bff('0x137'),'through':_0x3bff('0x36'),'required':![]});db['User']['belongsToMany'](db[_0x3bff('0x138')],{'as':_0x3bff('0x139'),'through':_0x3bff('0x38'),'required':![]});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x5f')],{'as':_0x3bff('0x13a'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x3bff('0x126')](db[_0x3bff('0x13b')],{'as':'WhatsappQueues','through':_0x3bff('0x13c'),'required':![]});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0xf7')],{'through':_0x3bff('0x12b')});db['User'][_0x3bff('0x126')](db[_0x3bff('0x61')],{'as':'ChatWebsites','through':_0x3bff('0x13d')});db['User'][_0x3bff('0x126')](db['FaxAccount'],{'as':_0x3bff('0x13e'),'through':_0x3bff('0x13f')});db['User'][_0x3bff('0x126')](db[_0x3bff('0x3f')],{'as':_0x3bff('0x140'),'through':_0x3bff('0x141')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x142')],{'as':'OpenchannelAccounts','through':_0x3bff('0x143')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0x53')],{'as':_0x3bff('0x144'),'through':_0x3bff('0x145')});db[_0x3bff('0x111')][_0x3bff('0x126')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x3bff('0x146')});db[_0x3bff('0x111')][_0x3bff('0x126')](db[_0x3bff('0xe1')],{'as':_0x3bff('0x147'),'through':_0x3bff('0x148')});db[_0x3bff('0x15')][_0x3bff('0x116')](db[_0x3bff('0x19')],{'as':'SpiedAgents','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x149')});db['VoiceContext']['hasMany'](db['VoiceExtension'],{'onDelete':_0x3bff('0x113')});db[_0x3bff('0x19')][_0x3bff('0x116')](db['VoiceExtension'],{'as':_0x3bff('0x14a'),'onDelete':'cascade'});db[_0x3bff('0x1a')][_0x3bff('0x126')](db[_0x3bff('0x8e')],{'as':_0x3bff('0x14b'),'through':_0x3bff('0x14c')});db[_0x3bff('0x1c')][_0x3bff('0x116')](db[_0x3bff('0x2f')],{'as':_0x3bff('0x14d'),'foreignKey':_0x3bff('0x14e')});db['VoiceQueue']['hasMany'](db[_0x3bff('0x74')],{'as':_0x3bff('0x14f'),'foreignKey':_0x3bff('0x14e')});db['VoiceQueue'][_0x3bff('0x116')](db[_0x3bff('0x77')],{'as':_0x3bff('0x11a'),'foreignKey':_0x3bff('0x14e')});db[_0x3bff('0x1c')]['hasMany'](db[_0x3bff('0x79')],{'as':_0x3bff('0x150'),'foreignKey':_0x3bff('0x14e')});db[_0x3bff('0x1c')][_0x3bff('0x116')](db[_0x3bff('0x11c')],{'as':'ReportAgentPreview','foreignKey':_0x3bff('0x14e')});db[_0x3bff('0x1c')][_0x3bff('0x116')](db[_0x3bff('0x76')],{'as':_0x3bff('0x151'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x3bff('0xd4')],{'as':'JscriptySessions','foreignKey':_0x3bff('0x14e')});db[_0x3bff('0x1c')][_0x3bff('0x125')](db[_0x3bff('0x2c')],{'as':_0x3bff('0x2c'),'foreignKey':_0x3bff('0x152')});db['VoiceQueue']['belongsTo'](db[_0x3bff('0x2c')],{'as':_0x3bff('0x153'),'foreignKey':_0x3bff('0x154')});db['VoiceQueue'][_0x3bff('0x125')](db['Interval'],{'as':_0x3bff('0x84'),'foreignKey':_0x3bff('0x155')});db[_0x3bff('0x1c')]['belongsTo'](db[_0x3bff('0x86')],{'as':_0x3bff('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x3bff('0x126')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x12a'),'through':_0x3bff('0x157')});db['VoiceQueue'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x30')});db['VoiceQueue'][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'as':_0x3bff('0x159'),'through':_0x3bff('0x10c')});db['VoiceQueue']['belongsToMany'](db[_0x3bff('0xf7')],{'as':_0x3bff('0x15a'),'through':_0x3bff('0x15b')});db[_0x3bff('0x15c')][_0x3bff('0x125')](db['User'],{'as':'User','foreignKey':_0x3bff('0x114')});db['ScreenRecording'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':_0x3bff('0x111'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x20')][_0x3bff('0x116')](db[_0x3bff('0x22')],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':'mailboxuser','sourceKey':_0x3bff('0x15e')});db[_0x3bff('0x22')][_0x3bff('0x125')](db[_0x3bff('0x20')],{'foreignKey':_0x3bff('0x15f'),'targetKey':_0x3bff('0x15e')});db[_0x3bff('0x160')][_0x3bff('0x116')](db[_0x3bff('0x28')],{'as':_0x3bff('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0x3bff('0x160')]['hasMany'](db[_0x3bff('0x26')],{'as':'AgentReports','foreignKey':_0x3bff('0x162'),'constraints':![]});db[_0x3bff('0x160')]['belongsTo'](db[_0x3bff('0x111')],{'as':_0x3bff('0x111'),'foreignKey':_0x3bff('0x114')});db['VoiceCallReport'][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x3c')][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'as':'MailAccount','foreignKey':_0x3bff('0x165')});db['MailServerIn'][_0x3bff('0x125')](db[_0x3bff('0x10b')],{'as':_0x3bff('0x10b'),'foreignKey':_0x3bff('0x166'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x3d')][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'as':_0x3bff('0x3f'),'foreignKey':'MailAccountId'});db[_0x3bff('0x3d')]['belongsTo'](db[_0x3bff('0x10b')],{'as':_0x3bff('0x10b'),'foreignKey':_0x3bff('0x166'),'onDelete':_0x3bff('0x167')});db['MailAccount'][_0x3bff('0x112')](db[_0x3bff('0x3c')],{'as':'Imap','onDelete':_0x3bff('0x113')});db[_0x3bff('0x3f')][_0x3bff('0x112')](db[_0x3bff('0x3d')],{'as':_0x3bff('0x168'),'onDelete':_0x3bff('0x113')});db['MailAccount'][_0x3bff('0x116')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x3bff('0x165'),'onDelete':_0x3bff('0x113')});db['MailAccount'][_0x3bff('0x116')](db[_0x3bff('0x7f')],{'as':'Answers','foreignKey':_0x3bff('0x165')});db[_0x3bff('0x3f')]['hasMany'](db[_0x3bff('0x169')],{'as':'Messages','foreignKey':_0x3bff('0x165')});db['MailAccount']['hasMany'](db[_0x3bff('0x44')],{'as':_0x3bff('0x16a')});db[_0x3bff('0x3f')][_0x3bff('0x116')](db[_0x3bff('0x46')],{'as':_0x3bff('0x14a')});db['MailAccount'][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db['Template'],{'as':_0x3bff('0x90'),'foreignKey':_0x3bff('0x16c')});db[_0x3bff('0x3f')][_0x3bff('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x3bff('0x16d')});db[_0x3bff('0x3f')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':'Agents','through':_0x3bff('0x141')});db[_0x3bff('0x41')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x34')});db[_0x3bff('0x41')][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':_0x3bff('0x16e'),'as':_0x3bff('0x159')});db[_0x3bff('0x44')][_0x3bff('0x116')](db[_0x3bff('0x169')],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x16f')});db[_0x3bff('0x44')][_0x3bff('0x125')](db['MailAccount'],{'as':'Account','foreignKey':_0x3bff('0x165')});db[_0x3bff('0x44')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':'ContactId'});db['MailInteraction'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':'Owner','foreignKey':'UserId'});db[_0x3bff('0x44')]['belongsToMany'](db['Tag'],{'through':_0x3bff('0x170'),'as':_0x3bff('0x171')});db['MailInteraction'][_0x3bff('0x126')](db['Tag'],{'through':_0x3bff('0x170'),'as':_0x3bff('0x172')});db['MailInteraction'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':_0x3bff('0x12e'),'foreignKey':_0x3bff('0x16f')});db[_0x3bff('0x169')]['hasMany'](db[_0x3bff('0xed')],{'as':_0x3bff('0x174'),'onDelete':_0x3bff('0x113')});db['MailMessage'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':'User'});db[_0x3bff('0x169')][_0x3bff('0x125')](db['CmContact'],{'onDelete':_0x3bff('0x113'),'as':'Contact'});db[_0x3bff('0x169')]['belongsTo'](db['MailInteraction'],{'as':_0x3bff('0x175'),'foreignKey':_0x3bff('0x16f')});db[_0x3bff('0x169')][_0x3bff('0x125')](db['MailAccount'],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x165')});db['MailMessage'][_0x3bff('0x125')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x3bff('0x177')});db[_0x3bff('0x169')][_0x3bff('0x125')](db[_0x3bff('0x6b')],{'as':_0x3bff('0x6b'),'foreignKey':_0x3bff('0x178')});db['MailApplication'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x46')]['belongsTo'](db[_0x3bff('0x41')],{'onDelete':_0x3bff('0x167')});db['MailApplication'][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'onDelete':_0x3bff('0x167')});db['MailApplication'][_0x3bff('0x125')](db[_0x3bff('0x84')],{'onDelete':'restrict','foreignKey':_0x3bff('0x155')});db[_0x3bff('0x46')]['belongsTo'](db['Tag'],{'onDelete':_0x3bff('0x167'),'foreignKey':_0x3bff('0x179')});db[_0x3bff('0x48')]['belongsTo'](db[_0x3bff('0x3f')],{});db[_0x3bff('0x48')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':'List','foreignKey':_0x3bff('0x17a')});db[_0x3bff('0x48')]['belongsTo'](db['CmContact'],{'as':_0x3bff('0x163'),'foreignKey':'ContactId'});db[_0x3bff('0x48')][_0x3bff('0x125')](db['MailInteraction'],{});db[_0x3bff('0x48')][_0x3bff('0x125')](db[_0x3bff('0x169')],{});db[_0x3bff('0x48')][_0x3bff('0x125')](db[_0x3bff('0x111')],{});db[_0x3bff('0x48')]['belongsTo'](db[_0x3bff('0x41')],{});db[_0x3bff('0x4a')][_0x3bff('0x116')](db[_0x3bff('0x4b')],{'as':_0x3bff('0x17b'),'onDelete':'cascade'});db[_0x3bff('0x17c')]['hasMany'](db[_0x3bff('0x81')],{'as':_0x3bff('0x17d'),'foreignKey':_0x3bff('0x17e'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x17c')][_0x3bff('0x116')](db[_0x3bff('0x7f')],{'as':_0x3bff('0x17f'),'foreignKey':_0x3bff('0x17e')});db['FaxAccount'][_0x3bff('0x116')](db['FaxInteraction'],{'as':'Interactions'});db['FaxAccount'][_0x3bff('0x116')](db[_0x3bff('0x4d')],{'as':_0x3bff('0x14a')});db['FaxAccount']['hasMany'](db[_0x3bff('0x19')],{'as':'Exntensions','onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x3bff('0x4f')],{'as':_0x3bff('0x15d')});db[_0x3bff('0x17c')]['belongsTo'](db[_0x3bff('0x2c')],{'as':_0x3bff('0x2c')});db[_0x3bff('0x17c')][_0x3bff('0x125')](db['CmList'],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a')});db['FaxAccount'][_0x3bff('0x125')](db[_0x3bff('0x86')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3bff('0x17c')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x13f')});db['FaxApplication'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x4d')]['belongsTo'](db[_0x3bff('0x136')],{'onDelete':'restrict'});db[_0x3bff('0x4d')][_0x3bff('0x125')](db[_0x3bff('0x17c')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x4d')]['belongsTo'](db[_0x3bff('0x180')],{'onDelete':'restrict','foreignKey':_0x3bff('0x179')});db[_0x3bff('0x121')]['hasMany'](db['FaxMessage'],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x3bff('0x125')](db[_0x3bff('0x17c')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x17e')});db[_0x3bff('0x121')][_0x3bff('0x125')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x3bff('0x121')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':_0x3bff('0x181'),'foreignKey':'UserId'});db[_0x3bff('0x121')]['belongsToMany'](db[_0x3bff('0x180')],{'through':_0x3bff('0x182'),'as':_0x3bff('0x171')});db[_0x3bff('0x121')][_0x3bff('0x126')](db['Tag'],{'through':_0x3bff('0x182'),'as':_0x3bff('0x172')});db['FaxInteraction'][_0x3bff('0x126')](db['User'],{'as':'Users','through':_0x3bff('0x183'),'foreignKey':_0x3bff('0x184')});db[_0x3bff('0x4f')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x111')});db[_0x3bff('0x4f')][_0x3bff('0x125')](db[_0x3bff('0x121')],{'as':_0x3bff('0x175'),'foreignKey':_0x3bff('0x184')});db['FaxMessage'][_0x3bff('0x125')](db['CmContact'],{'onDelete':_0x3bff('0x113'),'as':'Contact'});db['FaxMessage'][_0x3bff('0x125')](db[_0x3bff('0xed')],{'as':_0x3bff('0xed'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x3bff('0x125')](db[_0x3bff('0x17c')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x17e')});db[_0x3bff('0x136')][_0x3bff('0x126')](db['User'],{'as':_0x3bff('0x158'),'through':_0x3bff('0x36')});db[_0x3bff('0x136')][_0x3bff('0x126')](db['Team'],{'through':_0x3bff('0x185'),'as':_0x3bff('0x159')});db[_0x3bff('0x186')][_0x3bff('0x125')](db['FaxAccount'],{});db[_0x3bff('0x186')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':'List','foreignKey':_0x3bff('0x17a')});db[_0x3bff('0x186')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':'ContactId'});db[_0x3bff('0x186')][_0x3bff('0x125')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x3bff('0x125')](db['FaxMessage'],{});db[_0x3bff('0x186')][_0x3bff('0x125')](db[_0x3bff('0x111')],{});db[_0x3bff('0x186')][_0x3bff('0x125')](db[_0x3bff('0x136')],{});db[_0x3bff('0x53')][_0x3bff('0x116')](db[_0x3bff('0x81')],{'as':_0x3bff('0x17d'),'foreignKey':_0x3bff('0x187'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x53')][_0x3bff('0x116')](db['CannedAnswer'],{'as':_0x3bff('0x17f'),'foreignKey':_0x3bff('0x187')});db[_0x3bff('0x53')][_0x3bff('0x116')](db[_0x3bff('0x58')],{'as':'Messages','foreignKey':_0x3bff('0x187')});db[_0x3bff('0x53')][_0x3bff('0x116')](db[_0x3bff('0x56')],{'as':'Interactions'});db[_0x3bff('0x53')]['hasMany'](db[_0x3bff('0x55')],{'as':_0x3bff('0x14a')});db[_0x3bff('0x53')]['belongsTo'](db['CmList'],{'as':_0x3bff('0x16b'),'foreignKey':'ListId'});db['SmsAccount'][_0x3bff('0x125')](db[_0x3bff('0x86')],{'as':_0x3bff('0x156'),'foreignKey':_0x3bff('0x16d')});db[_0x3bff('0x53')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':'Agents','through':_0x3bff('0x145')});db['SmsApplication'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x55')][_0x3bff('0x125')](db[_0x3bff('0x138')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x55')][_0x3bff('0x125')](db[_0x3bff('0x53')],{'onDelete':'restrict'});db[_0x3bff('0x55')][_0x3bff('0x125')](db[_0x3bff('0x84')],{'onDelete':_0x3bff('0x167'),'foreignKey':_0x3bff('0x155')});db[_0x3bff('0x55')][_0x3bff('0x125')](db[_0x3bff('0x180')],{'onDelete':_0x3bff('0x167'),'foreignKey':'TagId'});db[_0x3bff('0x56')][_0x3bff('0x116')](db[_0x3bff('0x58')],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x188')});db['SmsInteraction'][_0x3bff('0x125')](db[_0x3bff('0x53')],{'as':'Account','foreignKey':_0x3bff('0x187')});db['SmsInteraction'][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':'Contact','foreignKey':_0x3bff('0x164')});db[_0x3bff('0x56')]['belongsTo'](db[_0x3bff('0x111')],{'as':_0x3bff('0x181'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x56')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x189'),'as':_0x3bff('0x171')});db[_0x3bff('0x56')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x189'),'as':_0x3bff('0x172')});db['SmsInteraction'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':'user_has_sms_interactions','foreignKey':_0x3bff('0x188')});db[_0x3bff('0x58')][_0x3bff('0x125')](db['User'],{'as':_0x3bff('0x111')});db['SmsMessage'][_0x3bff('0x125')](db[_0x3bff('0x72')],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x163')});db['SmsMessage'][_0x3bff('0x125')](db[_0x3bff('0x56')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x3bff('0x188')});db['SmsMessage'][_0x3bff('0x125')](db['SmsAccount'],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x187')});db[_0x3bff('0x138')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x38'),'foreignKey':_0x3bff('0x18a')});db[_0x3bff('0x138')]['belongsToMany'](db[_0x3bff('0x12c')],{'through':_0x3bff('0x18b'),'as':'Teams'});db['OpenchannelAccount']['hasMany'](db[_0x3bff('0x81')],{'as':'Dispositions','foreignKey':_0x3bff('0x18c'),'onDelete':'cascade'});db[_0x3bff('0x142')]['hasMany'](db[_0x3bff('0x7f')],{'as':_0x3bff('0x17f'),'foreignKey':_0x3bff('0x18c')});db[_0x3bff('0x142')][_0x3bff('0x116')](db[_0x3bff('0x11d')],{'as':'Interactions','foreignKey':_0x3bff('0x18c')});db[_0x3bff('0x142')][_0x3bff('0x116')](db[_0x3bff('0x5e')],{'as':'Messages','foreignKey':_0x3bff('0x18c')});db[_0x3bff('0x142')][_0x3bff('0x116')](db[_0x3bff('0x5b')],{'as':_0x3bff('0x14a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x3bff('0x125')](db['CmList'],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0x142')]['belongsTo'](db['Pause'],{'as':_0x3bff('0x156'),'foreignKey':_0x3bff('0x16d')});db[_0x3bff('0x142')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x143')});db[_0x3bff('0x5b')]['belongsTo'](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x5b')]['belongsTo'](db[_0x3bff('0x5f')],{'onDelete':'restrict','foreignKey':_0x3bff('0x18d')});db[_0x3bff('0x5b')][_0x3bff('0x125')](db[_0x3bff('0x142')],{'onDelete':_0x3bff('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0x3bff('0x5b')][_0x3bff('0x125')](db[_0x3bff('0x84')],{'onDelete':'restrict','foreignKey':_0x3bff('0x155')});db[_0x3bff('0x5b')][_0x3bff('0x125')](db[_0x3bff('0x180')],{'onDelete':_0x3bff('0x167'),'foreignKey':_0x3bff('0x179')});db[_0x3bff('0x11d')][_0x3bff('0x116')](db[_0x3bff('0x5e')],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x18e')});db[_0x3bff('0x11d')][_0x3bff('0x125')](db[_0x3bff('0x142')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x18c')});db[_0x3bff('0x11d')][_0x3bff('0x125')](db['CmContact'],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db['OpenchannelInteraction'][_0x3bff('0x125')](db['User'],{'as':_0x3bff('0x181'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x11d')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x18f'),'as':_0x3bff('0x171')});db[_0x3bff('0x11d')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x3bff('0x11d')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':'user_has_openchannel_interactions','foreignKey':_0x3bff('0x18e')});db['OpenchannelMessage'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x111')});db[_0x3bff('0x5e')][_0x3bff('0x125')](db['CmContact'],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x163')});db[_0x3bff('0x5e')]['belongsTo'](db[_0x3bff('0x11d')],{'onDelete':'cascade','as':_0x3bff('0x175'),'foreignKey':_0x3bff('0x18e')});db[_0x3bff('0x5e')]['belongsTo'](db[_0x3bff('0xed')],{'as':_0x3bff('0xed'),'foreignKey':_0x3bff('0x190')});db['OpenchannelMessage'][_0x3bff('0x125')](db['OpenchannelAccount'],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x18c')});db['OpenchannelQueue']['belongsToMany'](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x39'),'foreignKey':_0x3bff('0x18d')});db[_0x3bff('0x5f')][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':_0x3bff('0x191'),'as':_0x3bff('0x159')});db[_0x3bff('0x61')][_0x3bff('0x116')](db['Disposition'],{'as':_0x3bff('0x17d'),'foreignKey':_0x3bff('0x177'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x61')][_0x3bff('0x116')](db[_0x3bff('0x7f')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x3bff('0x61')][_0x3bff('0x116')](db[_0x3bff('0x70')],{'as':_0x3bff('0x192')});db[_0x3bff('0x61')][_0x3bff('0x116')](db['ChatInteraction'],{'as':_0x3bff('0x16a')});db[_0x3bff('0x61')][_0x3bff('0x116')](db['ChatApplication'],{'as':_0x3bff('0x14a')});db[_0x3bff('0x61')]['hasMany'](db['ChatMessage'],{'as':_0x3bff('0x15d')});db[_0x3bff('0x61')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0x3bff('0x61')][_0x3bff('0x125')](db[_0x3bff('0x84')],{'as':'Interval','foreignKey':_0x3bff('0x155')});db['ChatWebsite'][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'as':_0x3bff('0x3f'),'foreignKey':_0x3bff('0x165')});db[_0x3bff('0x61')][_0x3bff('0x125')](db[_0x3bff('0x86')],{'as':_0x3bff('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3bff('0x61')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x13d')});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0x142')],{});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0x11d')],{});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0x5e')],{});db['OpenchannelQueueReport'][_0x3bff('0x125')](db[_0x3bff('0x111')],{});db[_0x3bff('0x63')][_0x3bff('0x125')](db[_0x3bff('0x5f')],{});db[_0x3bff('0x65')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x3bff('0x114'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x65')][_0x3bff('0x125')](db['ChatQueue'],{'as':_0x3bff('0x193'),'foreignKey':_0x3bff('0x194'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x65')][_0x3bff('0x125')](db[_0x3bff('0x61')],{'as':_0x3bff('0x195'),'foreignKey':_0x3bff('0x177'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x65')][_0x3bff('0x125')](db[_0x3bff('0x180')],{'onDelete':_0x3bff('0x167'),'foreignKey':_0x3bff('0x179')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x196')});db[_0x3bff('0x67')][_0x3bff('0x125')](db[_0x3bff('0x61')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x177')});db['ChatInteraction'][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':'ContactId'});db[_0x3bff('0x67')]['belongsTo'](db['User'],{'as':_0x3bff('0x181'),'foreignKey':_0x3bff('0x114')});db[_0x3bff('0x67')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x197'),'as':'Tags'});db[_0x3bff('0x67')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x197'),'as':'ThroughTags'});db['ChatInteraction'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':_0x3bff('0x12f'),'foreignKey':'ChatInteractionId'});db[_0x3bff('0x69')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':'cascade','as':_0x3bff('0x111')});db[_0x3bff('0x69')]['belongsTo'](db[_0x3bff('0x72')],{'onDelete':'cascade','as':_0x3bff('0x163'),'foreignKey':'ContactId'});db['ChatMessage'][_0x3bff('0x125')](db['ChatInteraction'],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x175'),'foreignKey':'ChatInteractionId'});db[_0x3bff('0x69')][_0x3bff('0x125')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage'][_0x3bff('0x125')](db['ChatWebsite'],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x177')});db[_0x3bff('0x6b')]['hasMany'](db[_0x3bff('0xed')],{'as':'Attachments','foreignKey':_0x3bff('0x178'),'onDelete':'cascade','hooks':!![]});db[_0x3bff('0x6b')][_0x3bff('0x125')](db['CmContact'],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db['ChatOfflineMessage'][_0x3bff('0x125')](db[_0x3bff('0x61')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x177')});db['ChatQueue']['belongsToMany'](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':_0x3bff('0x32'),'hooks':!![]});db['ChatQueue'][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':_0x3bff('0x198'),'as':_0x3bff('0x159')});db[_0x3bff('0x6f')][_0x3bff('0x116')](db['ChatInternalMessage'],{'as':_0x3bff('0x15d'),'foreignKey':_0x3bff('0x199'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x6f')]['belongsToMany'](db[_0x3bff('0x111')],{'as':_0x3bff('0x14d'),'through':'chat_group_has_users'});db[_0x3bff('0x70')]['belongsTo'](db[_0x3bff('0x61')],{'as':_0x3bff('0x195'),'foreignKey':_0x3bff('0x177')});db[_0x3bff('0x19a')]['hasMany'](db[_0x3bff('0x72')],{'as':'Contacts','foreignKey':_0x3bff('0x19b')});db[_0x3bff('0x72')][_0x3bff('0x116')](db['CmHopper'],{'as':_0x3bff('0x14f'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x72')]['hasMany'](db[_0x3bff('0x77')],{'as':_0x3bff('0x11a'),'foreignKey':_0x3bff('0x164')});db['CmContact'][_0x3bff('0x116')](db['CmHopperHistory'],{'as':_0x3bff('0x150'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x72')]['hasMany'](db[_0x3bff('0x11c')],{'as':_0x3bff('0x11c'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x72')][_0x3bff('0x116')](db[_0x3bff('0xd4')],{'as':_0x3bff('0x19c'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x72')][_0x3bff('0x116')](db[_0x3bff('0x11d')],{'as':_0x3bff('0x11e'),'foreignKey':'ContactId','onDelete':_0x3bff('0x167')});db[_0x3bff('0x72')][_0x3bff('0x116')](db['ChatInteraction'],{'as':_0x3bff('0x11f'),'foreignKey':_0x3bff('0x164'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x72')][_0x3bff('0x116')](db[_0x3bff('0x56')],{'as':_0x3bff('0x120'),'foreignKey':_0x3bff('0x164'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x72')][_0x3bff('0x116')](db[_0x3bff('0x121')],{'as':_0x3bff('0x130'),'foreignKey':_0x3bff('0x164'),'onDelete':'restrict'});db['CmContact'][_0x3bff('0x116')](db[_0x3bff('0x44')],{'as':'MailInteractions','foreignKey':_0x3bff('0x164'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x72')][_0x3bff('0x125')](db['CmCompany'],{'as':_0x3bff('0x19d'),'foreignKey':_0x3bff('0x19b')});db[_0x3bff('0x72')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':'ListId','onDelete':_0x3bff('0x113')});db[_0x3bff('0x72')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':'cm_user_has_contacts'});db[_0x3bff('0x72')][_0x3bff('0x126')](db['Tag'],{'as':_0x3bff('0x171'),'through':_0x3bff('0x19e')});db[_0x3bff('0x72')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x19e'),'as':_0x3bff('0x172')});db[_0x3bff('0x74')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164'),'onDelete':'cascade'});db[_0x3bff('0x74')]['belongsTo'](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x74')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':'Agent','foreignKey':_0x3bff('0x114')});db['CmHopper'][_0x3bff('0x125')](db[_0x3bff('0x1c')],{'as':'Queue','foreignKey':_0x3bff('0x14e'),'onDelete':'cascade'});db[_0x3bff('0x74')]['belongsTo'](db[_0x3bff('0xe9')],{'as':_0x3bff('0xe9'),'foreignKey':_0x3bff('0x19f'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x74')]['belongsTo'](db[_0x3bff('0x111')],{'as':_0x3bff('0x181'),'foreignKey':_0x3bff('0x1a0')});db['CmHopperBlack'][_0x3bff('0x125')](db['CmContact'],{'as':_0x3bff('0x163'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x3bff('0x76')]['belongsTo'](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x3bff('0x76')][_0x3bff('0x125')](db[_0x3bff('0x1c')],{'as':_0x3bff('0x193'),'foreignKey':_0x3bff('0x14e'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x76')][_0x3bff('0x125')](db['Campaign'],{'as':'Campaign','foreignKey':_0x3bff('0x19f'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x7d')]['hasMany'](db['Condition'],{'as':{'plural':_0x3bff('0x1a1'),'singular':_0x3bff('0x1a2')},'foreignKey':_0x3bff('0x1a3'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db[_0x3bff('0x7d')][_0x3bff('0x116')](db[_0x3bff('0x82')],{'as':{'plural':'Any','singular':_0x3bff('0x1a4')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x3bff('0x7d')][_0x3bff('0x116')](db[_0x3bff('0x1a5')],{'as':_0x3bff('0x1a6'),'foreignKey':_0x3bff('0x1a7'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db[_0x3bff('0x81')][_0x3bff('0x116')](db[_0x3bff('0x81')],{'as':_0x3bff('0x17d'),'foreignKey':'ParentId','onDelete':_0x3bff('0x113')});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x84')],{'as':_0x3bff('0x1a8'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x19')],{'as':'Extensions','foreignKey':_0x3bff('0x155'),'onDelete':_0x3bff('0x167')});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x46')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x65')],{'as':'ChatApplications','foreignKey':_0x3bff('0x155')});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x4d')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x3bff('0x84')][_0x3bff('0x116')](db[_0x3bff('0x55')],{'as':_0x3bff('0x1a9'),'foreignKey':_0x3bff('0x155')});db[_0x3bff('0x8c')]['belongsTo'](db[_0x3bff('0x3f')],{});db[_0x3bff('0x8c')][_0x3bff('0x125')](db[_0x3bff('0x9b')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0x3bff('0x99')],{'foreignKey':'CustomReportId'});db[_0x3bff('0x8e')][_0x3bff('0x126')](db['VoiceMusicOnHold'],{'as':_0x3bff('0x1aa'),'through':_0x3bff('0x14c'),'onDelete':_0x3bff('0x167')});db['Tag'][_0x3bff('0x126')](db['CmContact'],{'through':_0x3bff('0x19e')});db['Tag'][_0x3bff('0x126')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x3bff('0x180')]['belongsToMany'](db['MailInteraction'],{'through':_0x3bff('0x170')});db[_0x3bff('0x180')][_0x3bff('0x126')](db[_0x3bff('0x56')],{'through':'sms_interaction_has_tags'});db[_0x3bff('0x180')][_0x3bff('0x126')](db[_0x3bff('0x121')],{'through':_0x3bff('0x182')});db['Tag'][_0x3bff('0x126')](db['OpenchannelInteraction'],{'through':_0x3bff('0x18f')});db[_0x3bff('0x180')][_0x3bff('0x126')](db['WhatsappInteraction'],{'through':_0x3bff('0x1ab')});db['Trigger'][_0x3bff('0x116')](db[_0x3bff('0x82')],{'as':{'plural':_0x3bff('0x1ac'),'singular':'AllCondition'},'foreignKey':_0x3bff('0x1ad'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x3bff('0x82')],{'as':{'plural':_0x3bff('0x1ae'),'singular':_0x3bff('0x1af')},'foreignKey':_0x3bff('0x1b0'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db[_0x3bff('0x92')][_0x3bff('0x116')](db[_0x3bff('0x1a5')],{'as':_0x3bff('0x1a6'),'foreignKey':_0x3bff('0x1b1'),'onDelete':_0x3bff('0x113'),'hooks':!![]});db[_0x3bff('0x99')][_0x3bff('0x116')](db[_0x3bff('0x1b2')],{'as':_0x3bff('0x1b3'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b4'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x3bff('0x1b3'),'onDelete':_0x3bff('0x113'),'foreignKey':'DefaultReportId'});db[_0x3bff('0x9e')]['hasMany'](db[_0x3bff('0x1b2')],{'as':_0x3bff('0x1b3'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b5')});db[_0x3bff('0x1b2')][_0x3bff('0x125')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x3bff('0x1b6')]['hasMany'](db[_0x3bff('0xa3')],{'as':'Configurations','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db['SalesforceConfiguration'][_0x3bff('0x116')](db[_0x3bff('0xa5')],{'as':_0x3bff('0x1b8'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b9')});db['SalesforceConfiguration'][_0x3bff('0x116')](db[_0x3bff('0xa5')],{'as':_0x3bff('0x1ba'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0xa3')][_0x3bff('0x116')](db[_0x3bff('0xa5')],{'as':_0x3bff('0x1b3'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xa3')]['belongsTo'](db[_0x3bff('0x1b6')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x1b7')});db['SalesforceField']['hasMany'](db[_0x3bff('0xa5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3bff('0xa5')][_0x3bff('0x116')](db[_0x3bff('0xa5')],{'as':_0x3bff('0x1bd'),'foreignKey':'DescriptionId'});db[_0x3bff('0xa5')][_0x3bff('0x116')](db['SalesforceField'],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xa5')][_0x3bff('0x125')](db['Variable'],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0xa6')][_0x3bff('0x116')](db['SugarcrmConfiguration'],{'as':_0x3bff('0x1c0'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db[_0x3bff('0xa9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xa7')][_0x3bff('0x116')](db['SugarcrmField'],{'as':_0x3bff('0x1ba'),'onDelete':_0x3bff('0x113'),'foreignKey':'DescriptionId'});db[_0x3bff('0xa7')][_0x3bff('0x116')](db[_0x3bff('0xa9')],{'as':'Fields','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xa7')][_0x3bff('0x125')](db[_0x3bff('0xa6')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xa9')][_0x3bff('0x116')](db[_0x3bff('0xa9')],{'as':'Subject','foreignKey':_0x3bff('0x1b9')});db['SugarcrmField'][_0x3bff('0x116')](db[_0x3bff('0xa9')],{'as':_0x3bff('0x1bd'),'foreignKey':'DescriptionId'});db[_0x3bff('0xa9')][_0x3bff('0x116')](db[_0x3bff('0xa9')],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db['SugarcrmField'][_0x3bff('0x125')](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0xab')][_0x3bff('0x116')](db[_0x3bff('0xad')],{'as':'Configurations','onDelete':_0x3bff('0x113'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x3bff('0x1c1')],{'as':_0x3bff('0x1b8'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xad')][_0x3bff('0x116')](db['DeskField'],{'as':_0x3bff('0x1ba'),'onDelete':'cascade','foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0xad')][_0x3bff('0x116')](db[_0x3bff('0x1c1')],{'as':_0x3bff('0x1b3'),'onDelete':_0x3bff('0x113'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x3bff('0x125')](db[_0x3bff('0xab')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xad')][_0x3bff('0x126')](db[_0x3bff('0x180')],{'through':_0x3bff('0x1c2')});db[_0x3bff('0x1c1')][_0x3bff('0x116')](db['DeskField'],{'as':_0x3bff('0x1c3'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0x1c1')][_0x3bff('0x116')](db['DeskField'],{'as':_0x3bff('0x1bd'),'foreignKey':'DescriptionId'});db[_0x3bff('0x1c1')]['hasMany'](db[_0x3bff('0x1c1')],{'as':'Field','foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0x1c1')]['belongsTo'](db['Variable'],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db['ZohoAccount'][_0x3bff('0x116')](db[_0x3bff('0xb1')],{'as':_0x3bff('0x1c0'),'onDelete':_0x3bff('0x113'),'foreignKey':'AccountId'});db[_0x3bff('0xb1')]['hasMany'](db[_0x3bff('0x1c4')],{'as':_0x3bff('0x1b8'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xb1')][_0x3bff('0x116')](db[_0x3bff('0x1c4')],{'as':_0x3bff('0x1ba'),'onDelete':_0x3bff('0x113'),'foreignKey':'DescriptionId'});db[_0x3bff('0xb1')][_0x3bff('0x116')](db[_0x3bff('0x1c4')],{'as':'Fields','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xb1')]['belongsTo'](db[_0x3bff('0xaf')],{'as':_0x3bff('0x176'),'foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0x1c4')]['hasMany'](db['ZohoField'],{'as':_0x3bff('0x1c3'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0x1c4')][_0x3bff('0x116')](db[_0x3bff('0x1c4')],{'as':_0x3bff('0x1bd'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0x1c4')][_0x3bff('0x116')](db[_0x3bff('0x1c4')],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db['ZohoField'][_0x3bff('0x125')](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0x1c5')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x3bff('0x1c0'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xb3')][_0x3bff('0x116')](db[_0x3bff('0xb4')],{'as':'Subjects','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xb3')][_0x3bff('0x116')](db[_0x3bff('0xb4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x3bff('0xb4')],{'as':_0x3bff('0x1b3'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xb3')]['belongsTo'](db[_0x3bff('0x1c5')],{'as':_0x3bff('0x176'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x3bff('0x126')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x3bff('0x116')](db[_0x3bff('0xb4')],{'as':_0x3bff('0x1c3'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xb4')][_0x3bff('0x116')](db[_0x3bff('0xb4')],{'as':_0x3bff('0x1bd'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x3bff('0x116')](db[_0x3bff('0xb4')],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xb4')][_0x3bff('0x125')](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0xb6')][_0x3bff('0x116')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db['FreshdeskConfiguration'][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':_0x3bff('0x1b8'),'onDelete':_0x3bff('0x113'),'foreignKey':'SubjectId'});db[_0x3bff('0x1c7')][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':'Descriptions','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0x1c7')][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':_0x3bff('0x1b3'),'onDelete':'cascade','foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0x1c7')][_0x3bff('0x125')](db[_0x3bff('0xb6')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0x1c7')]['belongsToMany'](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x3bff('0x1c6')][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':'Subject','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0x1c6')][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':_0x3bff('0x1bd'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0x1c6')][_0x3bff('0x116')](db[_0x3bff('0x1c6')],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0x1c6')]['belongsTo'](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':'VariableId'});db[_0x3bff('0xb9')]['hasMany'](db[_0x3bff('0xbb')],{'as':_0x3bff('0x1c0'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db['VtigerConfiguration']['hasMany'](db[_0x3bff('0x1c8')],{'as':_0x3bff('0x1b8'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xbb')][_0x3bff('0x116')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0xbb')][_0x3bff('0x116')](db[_0x3bff('0x1c8')],{'as':_0x3bff('0x1b3'),'foreignKey':_0x3bff('0x1bc')});db['VtigerConfiguration'][_0x3bff('0x125')](db[_0x3bff('0xb9')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0x1c8')][_0x3bff('0x116')](db[_0x3bff('0x1c8')],{'as':_0x3bff('0x1c3'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0x1c8')][_0x3bff('0x116')](db[_0x3bff('0x1c8')],{'as':_0x3bff('0x1bd'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0x1c8')][_0x3bff('0x116')](db['VtigerField'],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0x1c8')]['belongsTo'](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0xbe')][_0x3bff('0x116')](db[_0x3bff('0xc0')],{'as':_0x3bff('0x1c0'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xc0')]['hasMany'](db[_0x3bff('0x1c9')],{'as':'Subjects','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xc0')][_0x3bff('0x116')](db['ServicenowField'],{'as':_0x3bff('0x1ba'),'foreignKey':'DescriptionId'});db[_0x3bff('0xc0')]['hasMany'](db[_0x3bff('0x1c9')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x3bff('0x125')](db[_0x3bff('0xbe')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db['ServicenowField'][_0x3bff('0x116')](db[_0x3bff('0x1c9')],{'as':'Subject','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0x1c9')]['hasMany'](db[_0x3bff('0x1c9')],{'as':_0x3bff('0x1bd'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0x1c9')][_0x3bff('0x116')](db[_0x3bff('0x1c9')],{'as':_0x3bff('0x1be'),'foreignKey':'FieldId'});db[_0x3bff('0x1c9')][_0x3bff('0x125')](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db[_0x3bff('0xc3')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x3bff('0x1c0'),'onDelete':'cascade','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xc3')][_0x3bff('0x125')](db['CloudProvider'],{'as':_0x3bff('0x10b'),'foreignKey':_0x3bff('0x166')});db[_0x3bff('0xc5')][_0x3bff('0x116')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xc5')][_0x3bff('0x116')](db[_0x3bff('0xc7')],{'as':'Descriptions','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0xc5')][_0x3bff('0x116')](db['Dynamics365Field'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xc5')][_0x3bff('0x125')](db[_0x3bff('0xc3')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xc7')][_0x3bff('0x116')](db[_0x3bff('0xc7')],{'as':_0x3bff('0x1c3'),'foreignKey':'SubjectId'});db[_0x3bff('0xc7')][_0x3bff('0x116')](db[_0x3bff('0xc7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3bff('0xc7')][_0x3bff('0x116')](db[_0x3bff('0xc7')],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xc7')]['belongsTo'](db[_0x3bff('0x94')],{'as':_0x3bff('0x94'),'foreignKey':_0x3bff('0x1bf')});db['FreshsalesAccount'][_0x3bff('0x116')](db[_0x3bff('0xca')],{'as':'Configurations','onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xca')][_0x3bff('0x116')](db[_0x3bff('0xcb')],{'as':'Subjects','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xca')]['hasMany'](db[_0x3bff('0xcb')],{'as':'Descriptions','foreignKey':_0x3bff('0x1bb')});db[_0x3bff('0xca')]['hasMany'](db[_0x3bff('0xcb')],{'as':_0x3bff('0x1b3'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xca')][_0x3bff('0x125')](db[_0x3bff('0x1ca')],{'as':'Account','foreignKey':_0x3bff('0x1b7')});db[_0x3bff('0xcb')][_0x3bff('0x116')](db[_0x3bff('0xcb')],{'as':'Subject','foreignKey':_0x3bff('0x1b9')});db[_0x3bff('0xcb')][_0x3bff('0x116')](db['FreshsalesField'],{'as':_0x3bff('0x1bd'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x3bff('0x116')](db['FreshsalesField'],{'as':_0x3bff('0x1be'),'foreignKey':_0x3bff('0x1bc')});db[_0x3bff('0xcb')][_0x3bff('0x125')](db[_0x3bff('0x94')],{'as':'Variable','foreignKey':_0x3bff('0x1bf')});db['ChatQueueReport'][_0x3bff('0x125')](db['ChatWebsite'],{});db[_0x3bff('0xce')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':'ListId'});db[_0x3bff('0xce')]['belongsTo'](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':'ContactId'});db[_0x3bff('0xce')][_0x3bff('0x125')](db[_0x3bff('0x67')],{});db[_0x3bff('0xce')][_0x3bff('0x125')](db[_0x3bff('0x69')],{});db[_0x3bff('0xce')][_0x3bff('0x125')](db[_0x3bff('0x111')],{});db[_0x3bff('0xce')][_0x3bff('0x125')](db[_0x3bff('0x6d')],{});db[_0x3bff('0xd0')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1cb')});db[_0x3bff('0xd0')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'onDelete':_0x3bff('0x113'),'foreignKey':'ToId'});db[_0x3bff('0xd4')][_0x3bff('0x116')](db[_0x3bff('0xd3')],{'foreignKey':_0x3bff('0x1cc'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0xd4')][_0x3bff('0x116')](db[_0x3bff('0x1cd')],{'foreignKey':_0x3bff('0x1cc'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0xd6')][_0x3bff('0x125')](db[_0x3bff('0x53')],{});db[_0x3bff('0xd6')]['belongsTo'](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x3bff('0x72')],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0xd6')][_0x3bff('0x125')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x3bff('0x125')](db[_0x3bff('0x58')],{});db['SmsQueueReport']['belongsTo'](db[_0x3bff('0x111')],{});db[_0x3bff('0xd6')][_0x3bff('0x125')](db[_0x3bff('0x138')],{});db['JscriptyProject']['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x3bff('0x1ce')});db[_0x3bff('0xdc')][_0x3bff('0x116')](db['JscriptyQuestionReport'],{'foreignKey':_0x3bff('0x1ce')});db[_0x3bff('0xdc')][_0x3bff('0x116')](db[_0x3bff('0x1cd')],{'foreignKey':_0x3bff('0x1ce')});db[_0x3bff('0xe1')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':'user_has_square_projects'});db[_0x3bff('0x12c')]['belongsToMany'](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':'user_has_teams'});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0x1c')],{'through':_0x3bff('0x10c'),'as':_0x3bff('0x133')});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0x41')],{'through':_0x3bff('0x16e'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0x3bff('0x6d')],{'through':_0x3bff('0x198'),'as':_0x3bff('0x135')});db['Team'][_0x3bff('0x126')](db['FaxQueue'],{'through':_0x3bff('0x185'),'as':'FaxQueues'});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0x138')],{'through':'team_has_sms_queues','as':_0x3bff('0x139')});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0x5f')],{'through':_0x3bff('0x191'),'as':'OpenchannelQueues'});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0x13b')],{'through':_0x3bff('0x1cf'),'as':_0x3bff('0x1d0')});db[_0x3bff('0x12c')][_0x3bff('0x126')](db[_0x3bff('0xf9')],{'through':_0x3bff('0x1d1'),'as':_0x3bff('0x1d2')});db[_0x3bff('0xe9')]['hasMany'](db[_0x3bff('0x74')],{'as':'Hoppers','foreignKey':_0x3bff('0x19f')});db[_0x3bff('0xe9')][_0x3bff('0x116')](db[_0x3bff('0x77')],{'as':_0x3bff('0x11a'),'foreignKey':_0x3bff('0x19f')});db[_0x3bff('0xe9')][_0x3bff('0x116')](db[_0x3bff('0x79')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x3bff('0xe9')][_0x3bff('0x116')](db[_0x3bff('0x76')],{'as':_0x3bff('0x151'),'foreignKey':_0x3bff('0x19f')});db['Campaign'][_0x3bff('0x125')](db[_0x3bff('0x2c')],{'as':_0x3bff('0x2c'),'foreignKey':'TrunkId'});db[_0x3bff('0xe9')][_0x3bff('0x125')](db['Trunk'],{'as':_0x3bff('0x153'),'foreignKey':_0x3bff('0x154')});db[_0x3bff('0xe9')][_0x3bff('0x125')](db[_0x3bff('0x84')],{'as':'Interval','foreignKey':_0x3bff('0x155')});db[_0x3bff('0xe9')][_0x3bff('0x125')](db[_0x3bff('0xe1')],{'as':'SquareProject','foreignKey':_0x3bff('0x1d3')});db[_0x3bff('0xe9')][_0x3bff('0x126')](db['CmList'],{'as':_0x3bff('0x12a'),'through':_0x3bff('0x1d4')});db[_0x3bff('0xe9')]['belongsToMany'](db[_0x3bff('0xf7')],{'as':'BlackLists','through':_0x3bff('0x1d5')});db[_0x3bff('0xed')][_0x3bff('0x125')](db['ChatOfflineMessage'],{'as':_0x3bff('0x6b'),'foreignKey':'ChatOfflineMessageId'});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x169')],{});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x44')],{});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'foreignKey':'FromMailAccountId','as':_0x3bff('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d7'),'as':_0x3bff('0x1d8')});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d9'),'as':'ToAgent'});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x41')],{'foreignKey':_0x3bff('0x1da'),'as':_0x3bff('0x1db')});db[_0x3bff('0xf0')][_0x3bff('0x125')](db[_0x3bff('0x3f')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x3bff('0xf1')][_0x3bff('0x125')](db[_0x3bff('0x69')],{});db[_0x3bff('0xf1')]['belongsTo'](db[_0x3bff('0x67')],{});db[_0x3bff('0xf1')][_0x3bff('0x125')](db[_0x3bff('0x61')],{'foreignKey':_0x3bff('0x1dc'),'as':_0x3bff('0x1d6')});db['ChatTransferReport'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d7'),'as':_0x3bff('0x1d8')});db[_0x3bff('0xf1')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d9'),'as':_0x3bff('0x1dd')});db[_0x3bff('0xf1')][_0x3bff('0x125')](db[_0x3bff('0x6d')],{'foreignKey':_0x3bff('0x1de'),'as':_0x3bff('0x1db')});db[_0x3bff('0xf1')]['belongsTo'](db[_0x3bff('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0x3bff('0x1df')});db[_0x3bff('0x1e0')][_0x3bff('0x125')](db[_0x3bff('0x4f')],{});db[_0x3bff('0x1e0')]['belongsTo'](db[_0x3bff('0x121')],{});db[_0x3bff('0x1e0')][_0x3bff('0x125')](db[_0x3bff('0x17c')],{'foreignKey':_0x3bff('0x1e1'),'as':_0x3bff('0x1d6')});db[_0x3bff('0x1e0')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d7'),'as':_0x3bff('0x1d8')});db[_0x3bff('0x1e0')][_0x3bff('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x3bff('0x1dd')});db[_0x3bff('0x1e0')][_0x3bff('0x125')](db[_0x3bff('0x136')],{'foreignKey':_0x3bff('0x1e2'),'as':_0x3bff('0x1db')});db['FaxTransferReport'][_0x3bff('0x125')](db[_0x3bff('0x17c')],{'foreignKey':_0x3bff('0x1e3'),'as':_0x3bff('0x1df')});db[_0x3bff('0xf3')][_0x3bff('0x125')](db[_0x3bff('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x3bff('0xf3')][_0x3bff('0x125')](db[_0x3bff('0x142')],{'foreignKey':_0x3bff('0x1e4'),'as':'FromAccount'});db[_0x3bff('0xf3')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d7'),'as':_0x3bff('0x1d8')});db[_0x3bff('0xf3')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':'ToUserId','as':_0x3bff('0x1dd')});db[_0x3bff('0xf3')][_0x3bff('0x125')](db['OpenchannelQueue'],{'foreignKey':_0x3bff('0x1e5'),'as':_0x3bff('0x1db')});db[_0x3bff('0xf3')][_0x3bff('0x125')](db[_0x3bff('0x142')],{'foreignKey':_0x3bff('0x1e6'),'as':'ToAccount'});db[_0x3bff('0xf5')]['belongsTo'](db['SmsMessage'],{});db[_0x3bff('0xf5')][_0x3bff('0x125')](db[_0x3bff('0x56')],{});db[_0x3bff('0xf5')][_0x3bff('0x125')](db[_0x3bff('0x53')],{'foreignKey':'FromSmsAccountId','as':_0x3bff('0x1d6')});db[_0x3bff('0xf5')]['belongsTo'](db[_0x3bff('0x111')],{'foreignKey':'FromUserId','as':_0x3bff('0x1d8')});db[_0x3bff('0xf5')]['belongsTo'](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d9'),'as':_0x3bff('0x1dd')});db[_0x3bff('0xf5')]['belongsTo'](db[_0x3bff('0x138')],{'foreignKey':_0x3bff('0x1e7'),'as':_0x3bff('0x1db')});db[_0x3bff('0xf5')][_0x3bff('0x125')](db[_0x3bff('0x53')],{'foreignKey':_0x3bff('0x1e8'),'as':'ToAccount'});db['CmList'][_0x3bff('0x116')](db[_0x3bff('0x81')],{'as':_0x3bff('0x17d'),'foreignKey':_0x3bff('0x17a'),'onDelete':_0x3bff('0x113')});db['CmList'][_0x3bff('0x116')](db['CmCustomField'],{'as':_0x3bff('0x1e9'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0xf7')]['hasMany'](db['CmContact'],{'as':_0x3bff('0x129'),'onDelete':_0x3bff('0x113'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmHopperFinal'],{'as':_0x3bff('0x11a'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0xf7')][_0x3bff('0x116')](db[_0x3bff('0x79')],{'as':'HopperHistory','foreignKey':_0x3bff('0x17a')});db[_0x3bff('0xf7')][_0x3bff('0x116')](db[_0x3bff('0x11c')],{'as':_0x3bff('0x11c'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0xf7')]['belongsToMany'](db[_0x3bff('0x1c')],{'as':_0x3bff('0x1ea'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x3bff('0xf9')][_0x3bff('0x116')](db[_0x3bff('0x19')],{'as':_0x3bff('0x119'),'onDelete':_0x3bff('0x113')});db['VoicePrefix'][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x3bff('0xf9')][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':'TeamVoicePrefix','as':_0x3bff('0x159')});db[_0x3bff('0xfb')][_0x3bff('0x116')](db['User'],{'as':_0x3bff('0x173'),'foreignKey':'userProfileId'});db[_0x3bff('0xfb')]['hasMany'](db[_0x3bff('0xfd')],{'as':_0x3bff('0x1eb'),'foreignKey':_0x3bff('0x1ec'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0xfd')]['hasMany'](db[_0x3bff('0xfe')],{'as':_0x3bff('0x1ed'),'foreignKey':_0x3bff('0x1ee'),'onDelete':_0x3bff('0x113')});db['WhatsappAccount'][_0x3bff('0x116')](db['Disposition'],{'as':_0x3bff('0x17d'),'foreignKey':_0x3bff('0x1ef'),'onDelete':_0x3bff('0x113')});db[_0x3bff('0x1f0')]['hasMany'](db[_0x3bff('0x7f')],{'as':_0x3bff('0x17f'),'foreignKey':'WhatsappAccountId'});db[_0x3bff('0x1f0')][_0x3bff('0x116')](db[_0x3bff('0x106')],{'as':_0x3bff('0x15d'),'foreignKey':_0x3bff('0x1ef')});db[_0x3bff('0x1f0')][_0x3bff('0x116')](db[_0x3bff('0x104')],{'as':_0x3bff('0x16a')});db['WhatsappAccount']['hasMany'](db[_0x3bff('0x102')],{'as':'Applications'});db[_0x3bff('0x1f0')][_0x3bff('0x125')](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a')});db[_0x3bff('0x1f0')][_0x3bff('0x125')](db['Pause'],{'as':_0x3bff('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0x3bff('0x111')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x3bff('0x125')](db['User'],{'onDelete':_0x3bff('0x167')});db[_0x3bff('0x102')][_0x3bff('0x125')](db[_0x3bff('0x13b')],{'onDelete':_0x3bff('0x167')});db['WhatsappApplication']['belongsTo'](db[_0x3bff('0x1f0')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x3bff('0x84')],{'onDelete':'restrict','foreignKey':_0x3bff('0x155')});db[_0x3bff('0x102')][_0x3bff('0x125')](db[_0x3bff('0x180')],{'onDelete':_0x3bff('0x167'),'foreignKey':_0x3bff('0x179')});db[_0x3bff('0x104')][_0x3bff('0x116')](db[_0x3bff('0x106')],{'as':_0x3bff('0x15d'),'onDelete':_0x3bff('0x113'),'foreignKey':_0x3bff('0x1f1')});db[_0x3bff('0x104')]['belongsTo'](db[_0x3bff('0x1f0')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x3bff('0x104')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':_0x3bff('0x181'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x3bff('0x126')](db['Tag'],{'through':_0x3bff('0x1ab'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0x3bff('0x180')],{'through':_0x3bff('0x1ab'),'as':_0x3bff('0x172')});db[_0x3bff('0x104')][_0x3bff('0x126')](db[_0x3bff('0x111')],{'as':_0x3bff('0x173'),'through':_0x3bff('0x132'),'foreignKey':_0x3bff('0x1f1')});db[_0x3bff('0x106')][_0x3bff('0x125')](db[_0x3bff('0x111')],{'as':_0x3bff('0x111')});db[_0x3bff('0x106')][_0x3bff('0x125')](db[_0x3bff('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x3bff('0x106')][_0x3bff('0x125')](db[_0x3bff('0x104')],{'onDelete':_0x3bff('0x113'),'as':_0x3bff('0x175'),'foreignKey':'WhatsappInteractionId'});db[_0x3bff('0x106')][_0x3bff('0x125')](db['WhatsappAccount'],{'as':_0x3bff('0x176'),'foreignKey':'WhatsappAccountId'});db[_0x3bff('0x108')][_0x3bff('0x125')](db[_0x3bff('0x1f0')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x3bff('0xf7')],{'as':_0x3bff('0x16b'),'foreignKey':_0x3bff('0x17a')});db['WhatsappQueueReport'][_0x3bff('0x125')](db['CmContact'],{'as':_0x3bff('0x163'),'foreignKey':_0x3bff('0x164')});db[_0x3bff('0x108')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x3bff('0x108')][_0x3bff('0x125')](db[_0x3bff('0x13b')],{});db[_0x3bff('0x108')]['belongsTo'](db[_0x3bff('0x106')],{});db[_0x3bff('0x108')]['belongsTo'](db[_0x3bff('0x111')],{});db['WhatsappTransferReport'][_0x3bff('0x125')](db[_0x3bff('0x106')],{});db[_0x3bff('0x1f2')][_0x3bff('0x125')](db[_0x3bff('0x104')],{});db[_0x3bff('0x1f2')][_0x3bff('0x125')](db[_0x3bff('0x1f0')],{'foreignKey':_0x3bff('0x1f3'),'as':_0x3bff('0x1d6')});db[_0x3bff('0x1f2')]['belongsTo'](db[_0x3bff('0x1f0')],{'foreignKey':_0x3bff('0x1f4'),'as':_0x3bff('0x1df')});db[_0x3bff('0x1f2')]['belongsTo'](db[_0x3bff('0x13b')],{'foreignKey':_0x3bff('0x1f5'),'as':_0x3bff('0x1db')});db[_0x3bff('0x1f2')]['belongsTo'](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d7'),'as':_0x3bff('0x1d8')});db['WhatsappTransferReport'][_0x3bff('0x125')](db[_0x3bff('0x111')],{'foreignKey':_0x3bff('0x1d9'),'as':'ToAgent'});db[_0x3bff('0x13b')]['belongsToMany'](db[_0x3bff('0x111')],{'as':_0x3bff('0x158'),'through':'UserWhatsappQueue','foreignKey':_0x3bff('0x1f6')});db[_0x3bff('0x13b')][_0x3bff('0x126')](db[_0x3bff('0x12c')],{'through':_0x3bff('0x1cf'),'as':_0x3bff('0x159')});db['UserSetting']['belongsTo'](db['User'],{'as':_0x3bff('0x1f7'),'foreignKey':_0x3bff('0x114'),'onDelete':'cascade','hooks':!![]});db[_0x3bff('0x10b')][_0x3bff('0x112')](db[_0x3bff('0xc3')],{'as':'Dynamics365Account','onDelete':_0x3bff('0x167')});db[_0x3bff('0x10b')][_0x3bff('0x112')](db['MailServerIn'],{'as':_0x3bff('0x1f8'),'onDelete':_0x3bff('0x167')});db['CloudProvider'][_0x3bff('0x112')](db[_0x3bff('0x3d')],{'as':_0x3bff('0x168'),'onDelete':_0x3bff('0x167')});module[_0x3bff('0x1f9')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xefbe=['OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','userSetting','cascade','hasMany','VoiceRecording','Recordings','UserId','Extensions','CmHopperFinal','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','CmContact','cm_user_has_contacts','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','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceExtension','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','ContactId','CloudProviderId','MailAccountId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','Applications','List','ListId','TemplateId','Agents','MailInteraction','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxMessage','Account','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsMessage','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','CmCompany','Contacts','CompanyId','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Automation','AutomationAnyId','Actions','ParentId','Intervals','DefaultReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Variable','VariableId','Field','DeskField','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','team_has_mail_queues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','HopperHistory','Queues','cm_user_has_lists','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','mysql','username','password','options','database','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../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','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport'];(function(_0x23a0f4,_0x57d068){var _0x5242b0=function(_0x9a6a55){while(--_0x9a6a55){_0x23a0f4['push'](_0x23a0f4['shift']());}};_0x5242b0(++_0x57d068);}(_0xefbe,0x114));var _0xeefb=function(_0x230e83,_0x13e668){_0x230e83=_0x230e83-0x0;var _0x41aa55=_0xefbe[_0x230e83];return _0x41aa55;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xeefb('0x0'));var _=require(_0xeefb('0x1'));var jstz=require(_0xeefb('0x2'));var timezone=jstz['determine']();config[_0xeefb('0x0')]=_[_0xeefb('0x3')](config['sequelize'],{'database':_0xeefb('0x4'),'username':_0xeefb('0x5'),'password':_0xeefb('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xeefb('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xeefb('0x8'),'collate':_0xeefb('0x9')}}});config[_0xeefb('0xa')]=_[_0xeefb('0x3')](config[_0xeefb('0xa')],{'database':_0xeefb('0x4'),'username':_0xeefb('0x5'),'password':_0xeefb('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xeefb('0xb'),'dialectOptions':{'charset':_0xeefb('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xeefb('0x8'),'collate':_0xeefb('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xeefb('0x0')]['database'],config[_0xeefb('0x0')][_0xeefb('0xc')],config['sequelize'][_0xeefb('0xd')],config[_0xeefb('0x0')][_0xeefb('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xeefb('0xa')][_0xeefb('0xf')],config['sequelizeHistory'][_0xeefb('0xc')],config[_0xeefb('0xa')][_0xeefb('0xd')],config['sequelizeHistory'][_0xeefb('0xe')])};db[_0xeefb('0x10')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x12'));db['VoiceChanSpy']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xeefb('0x13')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x14'));db['VoiceExtension']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x15'));db[_0xeefb('0x16')]=db['sequelize']['import'](_0xeefb('0x17'));db[_0xeefb('0x18')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0xeefb('0x0')]['import'](_0xeefb('0x19'));db[_0xeefb('0x1a')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x1b'));db[_0xeefb('0x1c')]=db['sequelize']['import'](_0xeefb('0x1d'));db[_0xeefb('0x1e')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x1f'));db[_0xeefb('0x20')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x21'));db[_0xeefb('0x22')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x23'));db['VoiceAgentReport']=db[_0xeefb('0x0')]['import'](_0xeefb('0x24'));db[_0xeefb('0x25')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xeefb('0x0')]['import'](_0xeefb('0x26'));db[_0xeefb('0x27')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x28'));db[_0xeefb('0x29')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x2a'));db[_0xeefb('0x2b')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x2c'));db[_0xeefb('0x2d')]=db['sequelize']['import'](_0xeefb('0x2e'));db[_0xeefb('0x2f')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x30'));db[_0xeefb('0x31')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x32'));db[_0xeefb('0x33')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x34'));db['UserSmsQueue']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x35'));db[_0xeefb('0x36')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x37'));db[_0xeefb('0x38')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x39'));db[_0xeefb('0x3a')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/mailServerIn/mailServerIn.model');db[_0xeefb('0x3b')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x3c'));db[_0xeefb('0x3d')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x3e'));db[_0xeefb('0x3f')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x40'));db[_0xeefb('0x41')]=db['sequelize'][_0xeefb('0x11')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xeefb('0x0')]['import'](_0xeefb('0x42'));db[_0xeefb('0x43')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x44'));db[_0xeefb('0x45')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x46'));db[_0xeefb('0x47')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x48'));db[_0xeefb('0x49')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x4a'));db[_0xeefb('0x4b')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x4c'));db[_0xeefb('0x4d')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x4e'));db[_0xeefb('0x4f')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x50'));db[_0xeefb('0x51')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x52'));db['FaxMessage']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x53'));db[_0xeefb('0x54')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x55'));db[_0xeefb('0x56')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x57'));db['SmsAccount']=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x58'));db[_0xeefb('0x59')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x5a'));db['SmsInteraction']=db[_0xeefb('0x0')]['import'](_0xeefb('0x5b'));db['SmsMessage']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x5c'));db[_0xeefb('0x5d')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x5e'));db[_0xeefb('0x5f')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x60'));db[_0xeefb('0x61')]=db['sequelize'][_0xeefb('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0xeefb('0x62')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x63'));db[_0xeefb('0x64')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x65'));db[_0xeefb('0x66')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0xeefb('0x67')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x68'));db[_0xeefb('0x69')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x6a'));db[_0xeefb('0x6b')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x6c'));db[_0xeefb('0x6d')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x6e'));db['ChatMessage']=db[_0xeefb('0x0')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0xeefb('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xeefb('0x6f')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x70'));db['ChatGroup']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x71'));db['ChatProactiveAction']=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x72'));db['CmCompany']=db[_0xeefb('0x0')]['import'](_0xeefb('0x73'));db['CmContact']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x74'));db[_0xeefb('0x75')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x76'));db[_0xeefb('0x77')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xeefb('0x0')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xeefb('0x0')]['import'](_0xeefb('0x78'));db[_0xeefb('0x79')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x7a'));db['CmCustomField']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x7b'));db[_0xeefb('0x7c')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/action/action.model');db['Automation']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x7d'));db['CannedAnswer']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/cannedAnswer/cannedAnswer.model');db[_0xeefb('0x7e')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0xeefb('0x7f')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x80'));db[_0xeefb('0x81')]=db[_0xeefb('0x0')]['import']('../api/interval/interval.model');db[_0xeefb('0x82')]=db[_0xeefb('0x0')]['import']('../api/pause/pause.model');db[_0xeefb('0x83')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x84'));db[_0xeefb('0x85')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x86'));db[_0xeefb('0x87')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x88'));db['Sound']=db[_0xeefb('0x0')]['import'](_0xeefb('0x89'));db[_0xeefb('0x8a')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x8b'));db[_0xeefb('0x8c')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x8d'));db['Trigger']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x8e'));db['Variable']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x8f'));db['Integration']=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x90'));db[_0xeefb('0x91')]=db['sequelize']['import'](_0xeefb('0x92'));db[_0xeefb('0x93')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x94'));db[_0xeefb('0x95')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x96'));db[_0xeefb('0x97')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x98'));db[_0xeefb('0x99')]=db[_0xeefb('0x0')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xeefb('0x9a')]=db['sequelize'][_0xeefb('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x9b'));db[_0xeefb('0x9c')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x9d'));db[_0xeefb('0x9e')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xeefb('0x9f')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xa0'));db[_0xeefb('0xa1')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xeefb('0xa2')]=db[_0xeefb('0x0')]['import'](_0xeefb('0xa3'));db[_0xeefb('0xa4')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xa5'));db[_0xeefb('0xa6')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xa7'));db[_0xeefb('0xa8')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xa9'));db['DeskField']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xaa'));db[_0xeefb('0xab')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xac'));db[_0xeefb('0xad')]=db[_0xeefb('0x0')]['import'](_0xeefb('0xae'));db[_0xeefb('0xaf')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xb0'));db[_0xeefb('0xb1')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xb2'));db['ZendeskConfiguration']=db[_0xeefb('0x0')]['import'](_0xeefb('0xb3'));db[_0xeefb('0xb4')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xb5'));db[_0xeefb('0xb6')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xeefb('0x0')]['import'](_0xeefb('0xb7'));db[_0xeefb('0xb8')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xb9'));db[_0xeefb('0xba')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xbb'));db['VtigerConfiguration']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xbc'));db['VtigerField']=db['sequelize']['import'](_0xeefb('0xbd'));db[_0xeefb('0xbe')]=db['sequelize']['import'](_0xeefb('0xbf'));db[_0xeefb('0xc0')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc1'));db[_0xeefb('0xc2')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc3'));db['Dynamics365Account']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc4'));db['Dynamics365Configuration']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc5'));db['FreshsalesAccount']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc6'));db['FreshsalesField']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc7'));db[_0xeefb('0xc8')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x90'));db['Network']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xc9'));db[_0xeefb('0xca')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xcb'));db[_0xeefb('0xcc')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xcd'));db[_0xeefb('0xce')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xcf'));db['JscriptyQuestionReport']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xd0'));db[_0xeefb('0xd1')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xd2'));db[_0xeefb('0xd3')]=db['sequelize'][_0xeefb('0x11')]('../api/squareReport/squareReport.model');db[_0xeefb('0xd4')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xd5'));db[_0xeefb('0xd6')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xd7'));db['Setting']=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xd8'));db[_0xeefb('0xd9')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xda'));db['SquareProject']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xdb'));db[_0xeefb('0xdc')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xdd'));db[_0xeefb('0xde')]=db['sequelize'][_0xeefb('0x11')]('../api/squareMessage/squareMessage.model');db[_0xeefb('0xdf')]=db['sequelize']['import'](_0xeefb('0xe0'));db[_0xeefb('0xe1')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xe2'));db['Campaign']=db[_0xeefb('0x0')]['import'](_0xeefb('0xe3'));db[_0xeefb('0xe4')]=db[_0xeefb('0x0')]['import'](_0xeefb('0xe5'));db[_0xeefb('0xe6')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0xe7'));db[_0xeefb('0xe8')]=db[_0xeefb('0x0')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xe9'));db['ChatTransferReport']=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/chatTransferReport/chatTransferReport.model');db[_0xeefb('0xea')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0xeefb('0xeb')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xec'));db['SmsTransferReport']=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xed'));db[_0xeefb('0xee')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0xeefb('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0xeefb('0xef')]=db[_0xeefb('0x0')]['import'](_0xeefb('0xf0'));db[_0xeefb('0xf1')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xf2'));db[_0xeefb('0xf3')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0xeefb('0xf4')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xf5'));db[_0xeefb('0xf6')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/whatsappAccount/whatsappAccount.model');db[_0xeefb('0xf7')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xf8'));db[_0xeefb('0xf9')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xfa'));db[_0xeefb('0xfb')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0xfc'));db[_0xeefb('0xfd')]=db['sequelize']['import'](_0xeefb('0xfe'));db[_0xeefb('0xff')]=db[_0xeefb('0x0')]['import'](_0xeefb('0x100'));db[_0xeefb('0x101')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0xeefb('0x102')]=db['sequelize'][_0xeefb('0x11')](_0xeefb('0x103'));db[_0xeefb('0x104')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x105'));db[_0xeefb('0x106')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x107'));db[_0xeefb('0x108')]=db[_0xeefb('0x0')][_0xeefb('0x11')](_0xeefb('0x109'));db[_0xeefb('0x10a')]=db[_0xeefb('0x0')][_0xeefb('0x11')]('../api/user-setting/user-setting.model');db[_0xeefb('0x10')][_0xeefb('0x10b')](db[_0xeefb('0x1c')],{'as':_0xeefb('0x1c'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xeefb('0x10')][_0xeefb('0x10b')](db[_0xeefb('0x10a')],{'as':_0xeefb('0x10c'),'onDelete':_0xeefb('0x10d'),'foreignKey':'UserId'});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x10f')],{'as':_0xeefb('0x110'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db['VoiceExtension'],{'as':_0xeefb('0x112'),'onDelete':_0xeefb('0x10d'),'hooks':!![]});db[_0xeefb('0x10')]['hasMany'](db[_0xeefb('0x113')],{'as':_0xeefb('0x114'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x115')],{'as':'HopperHistory','foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x79')],{'as':_0xeefb('0x79'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db['OpenchannelInteraction'],{'as':_0xeefb('0x116'),'foreignKey':'UserId'});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x6d')],{'as':_0xeefb('0x117'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x118')],{'as':_0xeefb('0x119'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db[_0xeefb('0x51')],{'as':_0xeefb('0x11a'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')][_0xeefb('0x10e')](db['MailInteraction'],{'as':_0xeefb('0x11b'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')]['hasMany'](db['WhatsappInteraction'],{'as':_0xeefb('0x11c'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x10')]['hasMany'](db[_0xeefb('0xf4')],{'as':'UserNotifications','foreignKey':_0xeefb('0x11d')});db[_0xeefb('0x10')][_0xeefb('0x11e')](db[_0xeefb('0xef')],{'as':_0xeefb('0xef'),'foreignKey':_0xeefb('0x11f')});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x121')],{'as':_0xeefb('0x122'),'through':'chat_group_has_users'});db['User'][_0xeefb('0x120')](db[_0xeefb('0x123')],{'as':'Contacts','through':_0xeefb('0x124')});db['User']['belongsToMany'](db[_0xeefb('0xee')],{'as':_0xeefb('0x125'),'through':'cm_user_has_lists'});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0xdf')],{'through':_0xeefb('0x126')});db['User'][_0xeefb('0x120')](db['MailInteraction'],{'as':'MailInteractions','through':_0xeefb('0x127')});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x6d')],{'as':_0xeefb('0x117'),'through':_0xeefb('0x128')});db['User'][_0xeefb('0x120')](db[_0xeefb('0x51')],{'as':_0xeefb('0x11a'),'through':_0xeefb('0x129')});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x118')],{'as':_0xeefb('0x119'),'through':_0xeefb('0x12a')});db['User'][_0xeefb('0x120')](db['OpenchannelInteraction'],{'as':_0xeefb('0x116'),'through':_0xeefb('0x12b')});db['User'][_0xeefb('0x120')](db[_0xeefb('0xf9')],{'as':_0xeefb('0x11c'),'through':_0xeefb('0x12c')});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x18')],{'as':_0xeefb('0x12d'),'through':_0xeefb('0x2d'),'required':![]});db['User']['belongsToMany'](db[_0xeefb('0x12e')],{'as':_0xeefb('0x12f'),'through':'UserVoicePrefix','required':![]});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x3f')],{'as':_0xeefb('0x130'),'through':_0xeefb('0x31'),'required':![]});db['User'][_0xeefb('0x120')](db[_0xeefb('0x6f')],{'as':_0xeefb('0x131'),'through':_0xeefb('0x2f'),'required':![],'hooks':!![]});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x54')],{'as':_0xeefb('0x132'),'through':_0xeefb('0x33'),'required':![]});db['User'][_0xeefb('0x120')](db['SmsQueue'],{'as':_0xeefb('0x133'),'through':_0xeefb('0x134'),'required':![]});db['User'][_0xeefb('0x120')](db[_0xeefb('0x66')],{'as':_0xeefb('0x135'),'through':_0xeefb('0x36'),'required':![]});db[_0xeefb('0x10')]['belongsToMany'](db[_0xeefb('0x101')],{'as':_0xeefb('0x136'),'through':_0xeefb('0x38'),'required':![]});db[_0xeefb('0x10')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x67')],{'as':_0xeefb('0x137'),'through':_0xeefb('0x138')});db[_0xeefb('0x10')][_0xeefb('0x120')](db['FaxAccount'],{'as':_0xeefb('0x139'),'through':'user_has_fax_accounts'});db[_0xeefb('0x10')][_0xeefb('0x120')](db[_0xeefb('0x3d')],{'as':_0xeefb('0x13a'),'through':_0xeefb('0x13b')});db[_0xeefb('0x10')]['belongsToMany'](db[_0xeefb('0x5f')],{'as':'OpenchannelAccounts','through':_0xeefb('0x13c')});db[_0xeefb('0x10')]['belongsToMany'](db[_0xeefb('0x13d')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xeefb('0x10')][_0xeefb('0x120')](db['WhatsappAccount'],{'as':_0xeefb('0x13e'),'through':_0xeefb('0x13f')});db['User']['belongsToMany'](db[_0xeefb('0x140')],{'as':_0xeefb('0x141'),'through':_0xeefb('0x142')});db['VoiceChanSpy'][_0xeefb('0x10e')](db[_0xeefb('0x143')],{'as':_0xeefb('0x144'),'onDelete':'cascade','foreignKey':_0xeefb('0x145')});db[_0xeefb('0x13')]['hasMany'](db[_0xeefb('0x143')],{'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x143')][_0xeefb('0x10e')](db[_0xeefb('0x143')],{'as':'Applications','onDelete':_0xeefb('0x10d')});db[_0xeefb('0x16')]['belongsToMany'](db[_0xeefb('0x146')],{'as':_0xeefb('0x147'),'through':_0xeefb('0x148')});db[_0xeefb('0x18')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xeefb('0x149'),'foreignKey':'VoiceQueueId'});db[_0xeefb('0x18')][_0xeefb('0x10e')](db[_0xeefb('0x75')],{'as':_0xeefb('0x14a'),'foreignKey':_0xeefb('0x14b')});db['VoiceQueue'][_0xeefb('0x10e')](db[_0xeefb('0x113')],{'as':_0xeefb('0x114'),'foreignKey':_0xeefb('0x14b')});db[_0xeefb('0x18')]['hasMany'](db['CmHopperHistory'],{'as':_0xeefb('0x14c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xeefb('0x10e')](db['ReportAgentPreview'],{'as':_0xeefb('0x79'),'foreignKey':_0xeefb('0x14b')});db[_0xeefb('0x18')][_0xeefb('0x10e')](db[_0xeefb('0x77')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xeefb('0x18')][_0xeefb('0x10e')](db[_0xeefb('0x14d')],{'as':_0xeefb('0x14e'),'foreignKey':_0xeefb('0x14b')});db[_0xeefb('0x18')][_0xeefb('0x11e')](db[_0xeefb('0x27')],{'as':'Trunk','foreignKey':_0xeefb('0x14f')});db[_0xeefb('0x18')]['belongsTo'](db[_0xeefb('0x27')],{'as':_0xeefb('0x150'),'foreignKey':_0xeefb('0x151')});db[_0xeefb('0x18')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'as':_0xeefb('0x81'),'foreignKey':'IntervalId'});db[_0xeefb('0x18')][_0xeefb('0x11e')](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db[_0xeefb('0x18')][_0xeefb('0x120')](db[_0xeefb('0xee')],{'as':'Lists','through':_0xeefb('0x154')});db['VoiceQueue'][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Agents','through':_0xeefb('0x2d')});db[_0xeefb('0x18')][_0xeefb('0x120')](db[_0xeefb('0xdf')],{'as':_0xeefb('0x155'),'through':_0xeefb('0x104')});db[_0xeefb('0x18')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0xeefb('0x156')});db[_0xeefb('0x10f')]['belongsTo'](db[_0xeefb('0x10')],{'as':_0xeefb('0x10'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x1a')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x10'),'foreignKey':_0xeefb('0x111')});db['VoiceMail'][_0xeefb('0x10e')](db[_0xeefb('0x1e')],{'as':_0xeefb('0x157'),'onDelete':_0xeefb('0x10d'),'foreignKey':'mailboxuser','sourceKey':_0xeefb('0x158')});db[_0xeefb('0x1e')]['belongsTo'](db[_0xeefb('0x1c')],{'foreignKey':_0xeefb('0x159'),'targetKey':_0xeefb('0x158')});db[_0xeefb('0x20')][_0xeefb('0x10e')](db[_0xeefb('0x25')],{'as':_0xeefb('0x15a'),'foreignKey':'uniqueid','constraints':![]});db[_0xeefb('0x20')][_0xeefb('0x10e')](db['VoiceAgentReport'],{'as':_0xeefb('0x15b'),'foreignKey':_0xeefb('0x15c'),'constraints':![]});db[_0xeefb('0x20')]['belongsTo'](db[_0xeefb('0x10')],{'as':'User','foreignKey':'UserId'});db[_0xeefb('0x20')][_0xeefb('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x3a')][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{'as':_0xeefb('0x3d'),'foreignKey':'MailAccountId'});db['MailServerIn'][_0xeefb('0x11e')](db[_0xeefb('0x102')],{'as':_0xeefb('0x102'),'foreignKey':_0xeefb('0x15e'),'onDelete':'restrict'});db[_0xeefb('0x3b')]['belongsTo'](db[_0xeefb('0x3d')],{'as':_0xeefb('0x3d'),'foreignKey':_0xeefb('0x15f')});db['MailServerOut'][_0xeefb('0x11e')](db[_0xeefb('0x102')],{'as':_0xeefb('0x102'),'foreignKey':_0xeefb('0x15e'),'onDelete':_0xeefb('0x160')});db['MailAccount'][_0xeefb('0x10b')](db[_0xeefb('0x3a')],{'as':_0xeefb('0x161'),'onDelete':'cascade'});db[_0xeefb('0x3d')][_0xeefb('0x10b')](db[_0xeefb('0x3b')],{'as':_0xeefb('0x162'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x3d')][_0xeefb('0x10e')](db['Disposition'],{'as':_0xeefb('0x163'),'foreignKey':'MailAccountId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0x3d')][_0xeefb('0x10e')](db[_0xeefb('0x164')],{'as':_0xeefb('0x165'),'foreignKey':_0xeefb('0x15f')});db[_0xeefb('0x3d')][_0xeefb('0x10e')](db['MailMessage'],{'as':_0xeefb('0x157'),'foreignKey':'MailAccountId'});db[_0xeefb('0x3d')][_0xeefb('0x10e')](db['MailInteraction'],{'as':_0xeefb('0x166')});db['MailAccount'][_0xeefb('0x10e')](db[_0xeefb('0x45')],{'as':_0xeefb('0x167')});db['MailAccount'][_0xeefb('0x11e')](db['CmList'],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x3d')][_0xeefb('0x11e')](db['Template'],{'as':_0xeefb('0x8c'),'foreignKey':_0xeefb('0x16a')});db[_0xeefb('0x3d')][_0xeefb('0x11e')](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db[_0xeefb('0x3d')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':'user_has_mail_accounts'});db[_0xeefb('0x3f')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Agents','through':'UserMailQueue'});db[_0xeefb('0x3f')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0xeefb('0x155')});db[_0xeefb('0x16c')][_0xeefb('0x10e')](db[_0xeefb('0x43')],{'as':'Messages','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x16d')});db[_0xeefb('0x16c')][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xeefb('0x16c')]['belongsTo'](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':'ContactId'});db[_0xeefb('0x16c')]['belongsTo'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16f'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0x16c')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x170'),'as':_0xeefb('0x171')});db[_0xeefb('0x16c')]['belongsToMany'](db[_0xeefb('0x8a')],{'through':'mail_interaction_has_tags','as':_0xeefb('0x172')});db[_0xeefb('0x16c')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':_0xeefb('0x173'),'through':_0xeefb('0x127'),'foreignKey':_0xeefb('0x16d')});db[_0xeefb('0x43')][_0xeefb('0x10e')](db[_0xeefb('0xe6')],{'as':_0xeefb('0x174'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x43')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x10')});db['MailMessage'][_0xeefb('0x11e')](db['CmContact'],{'onDelete':_0xeefb('0x10d'),'as':_0xeefb('0x16e')});db[_0xeefb('0x43')][_0xeefb('0x11e')](db[_0xeefb('0x16c')],{'as':_0xeefb('0x175'),'foreignKey':'MailInteractionId'});db[_0xeefb('0x43')][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{'as':'Account','foreignKey':_0xeefb('0x15f')});db[_0xeefb('0x43')]['belongsTo'](db[_0xeefb('0x67')],{'as':'ChatWebsite','foreignKey':_0xeefb('0x176')});db[_0xeefb('0x43')][_0xeefb('0x11e')](db[_0xeefb('0x177')],{'as':'ChatOfflineMessage','foreignKey':_0xeefb('0x178')});db['MailApplication']['belongsTo'](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x45')]['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db[_0xeefb('0x45')]['belongsTo'](db[_0xeefb('0x3d')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x45')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x179')});db[_0xeefb('0x45')][_0xeefb('0x11e')](db[_0xeefb('0x8a')],{'onDelete':'restrict','foreignKey':_0xeefb('0x17a')});db[_0xeefb('0x47')]['belongsTo'](db['MailAccount'],{});db[_0xeefb('0x47')]['belongsTo'](db[_0xeefb('0xee')],{'as':'List','foreignKey':_0xeefb('0x169')});db[_0xeefb('0x47')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':'Contact','foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x47')][_0xeefb('0x11e')](db[_0xeefb('0x16c')],{});db[_0xeefb('0x47')][_0xeefb('0x11e')](db[_0xeefb('0x43')],{});db[_0xeefb('0x47')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{});db[_0xeefb('0x47')][_0xeefb('0x11e')](db['MailQueue'],{});db[_0xeefb('0x49')][_0xeefb('0x10e')](db[_0xeefb('0x4b')],{'as':_0xeefb('0x17b'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x4d')][_0xeefb('0x10e')](db[_0xeefb('0x7e')],{'as':_0xeefb('0x163'),'foreignKey':_0xeefb('0x17c'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x4d')][_0xeefb('0x10e')](db[_0xeefb('0x164')],{'as':'Answers','foreignKey':_0xeefb('0x17c')});db[_0xeefb('0x4d')]['hasMany'](db[_0xeefb('0x51')],{'as':_0xeefb('0x166')});db['FaxAccount'][_0xeefb('0x10e')](db['FaxApplication'],{'as':_0xeefb('0x167')});db[_0xeefb('0x4d')][_0xeefb('0x10e')](db[_0xeefb('0x143')],{'as':_0xeefb('0x17d'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x4d')][_0xeefb('0x10e')](db['FaxMessage'],{'as':_0xeefb('0x157')});db[_0xeefb('0x4d')][_0xeefb('0x11e')](db[_0xeefb('0x27')],{'as':_0xeefb('0x27')});db[_0xeefb('0x4d')][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x4d')][_0xeefb('0x11e')](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db[_0xeefb('0x4d')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x17e')});db[_0xeefb('0x4f')]['belongsTo'](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x4f')][_0xeefb('0x11e')](db[_0xeefb('0x54')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x4f')][_0xeefb('0x11e')](db[_0xeefb('0x4d')],{'onDelete':'restrict'});db[_0xeefb('0x4f')]['belongsTo'](db[_0xeefb('0x8a')],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x17a')});db[_0xeefb('0x51')][_0xeefb('0x10e')](db[_0xeefb('0x17f')],{'as':'Messages','onDelete':_0xeefb('0x10d'),'foreignKey':'FaxInteractionId'});db[_0xeefb('0x51')][_0xeefb('0x11e')](db['FaxAccount'],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x17c')});db[_0xeefb('0x51')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db['FaxInteraction'][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x16f'),'foreignKey':'UserId'});db[_0xeefb('0x51')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x181'),'as':_0xeefb('0x171')});db['FaxInteraction'][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x181'),'as':'ThroughTags'});db['FaxInteraction'][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':_0xeefb('0x173'),'through':_0xeefb('0x129'),'foreignKey':'FaxInteractionId'});db[_0xeefb('0x17f')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x10d'),'as':'User'});db[_0xeefb('0x17f')][_0xeefb('0x11e')](db['FaxInteraction'],{'as':_0xeefb('0x175'),'foreignKey':_0xeefb('0x182')});db['FaxMessage'][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'onDelete':_0xeefb('0x10d'),'as':_0xeefb('0x16e')});db[_0xeefb('0x17f')]['belongsTo'](db[_0xeefb('0xe6')],{'as':_0xeefb('0xe6'),'foreignKey':'AttachmentId'});db[_0xeefb('0x17f')][_0xeefb('0x11e')](db['FaxAccount'],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x17c')});db['FaxQueue']['belongsToMany'](db[_0xeefb('0x10')],{'as':'Agents','through':'UserFaxQueue'});db[_0xeefb('0x54')]['belongsToMany'](db[_0xeefb('0xdf')],{'through':_0xeefb('0x183'),'as':'Teams'});db[_0xeefb('0x56')]['belongsTo'](db[_0xeefb('0x4d')],{});db['FaxQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x56')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x56')]['belongsTo'](db[_0xeefb('0x51')],{});db[_0xeefb('0x56')]['belongsTo'](db[_0xeefb('0x17f')],{});db[_0xeefb('0x56')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{});db['FaxQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x54')],{});db['SmsAccount'][_0xeefb('0x10e')](db['Disposition'],{'as':_0xeefb('0x163'),'foreignKey':_0xeefb('0x184'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x13d')][_0xeefb('0x10e')](db['CannedAnswer'],{'as':_0xeefb('0x165'),'foreignKey':_0xeefb('0x184')});db[_0xeefb('0x13d')][_0xeefb('0x10e')](db['SmsMessage'],{'as':_0xeefb('0x157'),'foreignKey':_0xeefb('0x184')});db[_0xeefb('0x13d')][_0xeefb('0x10e')](db['SmsInteraction'],{'as':_0xeefb('0x166')});db[_0xeefb('0x13d')][_0xeefb('0x10e')](db['SmsApplication'],{'as':_0xeefb('0x167')});db['SmsAccount'][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x13d')][_0xeefb('0x11e')](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db['SmsAccount'][_0xeefb('0x120')](db['User'],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x185')});db[_0xeefb('0x59')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x160')});db['SmsApplication'][_0xeefb('0x11e')](db[_0xeefb('0x5d')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x59')][_0xeefb('0x11e')](db['SmsAccount'],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x59')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xeefb('0x59')][_0xeefb('0x11e')](db[_0xeefb('0x8a')],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x17a')});db[_0xeefb('0x118')][_0xeefb('0x10e')](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xeefb('0x186')});db[_0xeefb('0x118')][_0xeefb('0x11e')](db['SmsAccount'],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x184')});db[_0xeefb('0x118')][_0xeefb('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x118')]['belongsTo'](db[_0xeefb('0x10')],{'as':'Owner','foreignKey':_0xeefb('0x111')});db[_0xeefb('0x118')][_0xeefb('0x120')](db['Tag'],{'through':_0xeefb('0x187'),'as':_0xeefb('0x171')});db[_0xeefb('0x118')][_0xeefb('0x120')](db['Tag'],{'through':_0xeefb('0x187'),'as':_0xeefb('0x172')});db[_0xeefb('0x118')][_0xeefb('0x120')](db['User'],{'as':'Users','through':_0xeefb('0x12a'),'foreignKey':'SmsInteractionId'});db[_0xeefb('0x188')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x10')});db[_0xeefb('0x188')][_0xeefb('0x11e')](db['CmContact'],{'onDelete':'cascade','as':_0xeefb('0x16e')});db[_0xeefb('0x188')]['belongsTo'](db[_0xeefb('0x118')],{'onDelete':_0xeefb('0x10d'),'as':_0xeefb('0x175'),'foreignKey':_0xeefb('0x186')});db[_0xeefb('0x188')][_0xeefb('0x11e')](db['SmsAccount'],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x184')});db[_0xeefb('0x5d')]['belongsToMany'](db[_0xeefb('0x10')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0xeefb('0x189')});db['SmsQueue'][_0xeefb('0x120')](db['Team'],{'through':_0xeefb('0x18a'),'as':_0xeefb('0x155')});db[_0xeefb('0x5f')][_0xeefb('0x10e')](db[_0xeefb('0x7e')],{'as':_0xeefb('0x163'),'foreignKey':_0xeefb('0x18b'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x5f')]['hasMany'](db[_0xeefb('0x164')],{'as':'Answers','foreignKey':_0xeefb('0x18b')});db[_0xeefb('0x5f')][_0xeefb('0x10e')](db[_0xeefb('0x62')],{'as':_0xeefb('0x166'),'foreignKey':_0xeefb('0x18b')});db[_0xeefb('0x5f')]['hasMany'](db['OpenchannelMessage'],{'as':_0xeefb('0x157'),'foreignKey':_0xeefb('0x18b')});db[_0xeefb('0x5f')][_0xeefb('0x10e')](db['OpenchannelApplication'],{'as':_0xeefb('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xeefb('0x5f')]['belongsTo'](db['CmList'],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x5f')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xeefb('0x153')});db[_0xeefb('0x5f')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x13c')});db[_0xeefb('0x61')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0x61')][_0xeefb('0x11e')](db['OpenchannelQueue'],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x18c')});db[_0xeefb('0x61')][_0xeefb('0x11e')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xeefb('0x18b')});db[_0xeefb('0x61')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'onDelete':'restrict','foreignKey':_0xeefb('0x179')});db[_0xeefb('0x61')][_0xeefb('0x11e')](db['Tag'],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x17a')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':_0xeefb('0x157'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x18d')});db[_0xeefb('0x62')][_0xeefb('0x11e')](db[_0xeefb('0x5f')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x18b')});db['OpenchannelInteraction'][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':'Contact','foreignKey':_0xeefb('0x15d')});db['OpenchannelInteraction']['belongsTo'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16f'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0xeefb('0x171')});db[_0xeefb('0x62')][_0xeefb('0x120')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xeefb('0x172')});db[_0xeefb('0x62')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Users','through':_0xeefb('0x12b'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'onDelete':_0xeefb('0x10d'),'as':'User'});db[_0xeefb('0x64')]['belongsTo'](db['CmContact'],{'onDelete':_0xeefb('0x10d'),'as':'Contact'});db[_0xeefb('0x64')][_0xeefb('0x11e')](db[_0xeefb('0x62')],{'onDelete':_0xeefb('0x10d'),'as':'Interaction','foreignKey':_0xeefb('0x18d')});db[_0xeefb('0x64')][_0xeefb('0x11e')](db[_0xeefb('0xe6')],{'as':'Attachment','foreignKey':_0xeefb('0x18e')});db[_0xeefb('0x64')]['belongsTo'](db[_0xeefb('0x5f')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x18b')});db[_0xeefb('0x66')][_0xeefb('0x120')](db['User'],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x36'),'foreignKey':_0xeefb('0x18c')});db[_0xeefb('0x66')][_0xeefb('0x120')](db[_0xeefb('0xdf')],{'through':_0xeefb('0x18f'),'as':_0xeefb('0x155')});db[_0xeefb('0x67')][_0xeefb('0x10e')](db[_0xeefb('0x7e')],{'as':_0xeefb('0x163'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite'][_0xeefb('0x10e')](db[_0xeefb('0x164')],{'as':'Answers','foreignKey':_0xeefb('0x176')});db[_0xeefb('0x67')][_0xeefb('0x10e')](db[_0xeefb('0x190')],{'as':_0xeefb('0x191')});db[_0xeefb('0x67')]['hasMany'](db[_0xeefb('0x6d')],{'as':_0xeefb('0x166')});db[_0xeefb('0x67')][_0xeefb('0x10e')](db['ChatApplication'],{'as':_0xeefb('0x167')});db[_0xeefb('0x67')][_0xeefb('0x10e')](db[_0xeefb('0x192')],{'as':'Messages'});db[_0xeefb('0x67')]['belongsTo'](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0x67')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'as':_0xeefb('0x81'),'foreignKey':'IntervalId'});db[_0xeefb('0x67')][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{'as':_0xeefb('0x3d'),'foreignKey':'MailAccountId'});db[_0xeefb('0x67')][_0xeefb('0x11e')](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db[_0xeefb('0x67')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Agents','through':_0xeefb('0x138')});db[_0xeefb('0x69')][_0xeefb('0x11e')](db['OpenchannelAccount'],{});db[_0xeefb('0x69')]['belongsTo'](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':'ListId'});db[_0xeefb('0x69')][_0xeefb('0x11e')](db['CmContact'],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x69')][_0xeefb('0x11e')](db['OpenchannelInteraction'],{});db[_0xeefb('0x69')][_0xeefb('0x11e')](db[_0xeefb('0x64')],{});db[_0xeefb('0x69')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{});db['OpenchannelQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x66')],{});db[_0xeefb('0x6b')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x193'),'foreignKey':'UserId','onDelete':_0xeefb('0x160')});db[_0xeefb('0x6b')][_0xeefb('0x11e')](db[_0xeefb('0x6f')],{'as':_0xeefb('0x194'),'foreignKey':'ChatQueueId','onDelete':_0xeefb('0x160')});db['ChatApplication'][_0xeefb('0x11e')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xeefb('0x176'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x6b')][_0xeefb('0x11e')](db[_0xeefb('0x8a')],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x17a')});db[_0xeefb('0x6d')][_0xeefb('0x10e')](db['ChatMessage'],{'as':_0xeefb('0x157'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x195')});db['ChatInteraction'][_0xeefb('0x11e')](db['ChatWebsite'],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x176')});db[_0xeefb('0x6d')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x6d')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x16f'),'foreignKey':_0xeefb('0x111')});db['ChatInteraction'][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x196'),'as':_0xeefb('0x171')});db[_0xeefb('0x6d')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x196'),'as':_0xeefb('0x172')});db[_0xeefb('0x6d')]['belongsToMany'](db['User'],{'as':'Users','through':_0xeefb('0x128'),'foreignKey':_0xeefb('0x195')});db['ChatMessage']['belongsTo'](db[_0xeefb('0x10')],{'onDelete':'cascade','as':_0xeefb('0x10')});db[_0xeefb('0x192')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'onDelete':'cascade','as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x192')][_0xeefb('0x11e')](db['ChatInteraction'],{'onDelete':_0xeefb('0x10d'),'as':_0xeefb('0x175'),'foreignKey':'ChatInteractionId'});db[_0xeefb('0x192')]['belongsTo'](db[_0xeefb('0xe6')],{'as':_0xeefb('0xe6'),'foreignKey':_0xeefb('0x18e')});db[_0xeefb('0x192')][_0xeefb('0x11e')](db[_0xeefb('0x67')],{'as':_0xeefb('0x180'),'foreignKey':'ChatWebsiteId'});db[_0xeefb('0x177')]['hasMany'](db[_0xeefb('0xe6')],{'as':_0xeefb('0x174'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xeefb('0x177')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'onDelete':'cascade','as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db['ChatOfflineMessage'][_0xeefb('0x11e')](db[_0xeefb('0x67')],{'as':_0xeefb('0x180'),'foreignKey':'ChatWebsiteId'});db[_0xeefb('0x6f')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x2f'),'hooks':!![]});db[_0xeefb('0x6f')][_0xeefb('0x120')](db[_0xeefb('0xdf')],{'through':_0xeefb('0x197'),'as':_0xeefb('0x155')});db[_0xeefb('0x121')][_0xeefb('0x10e')](db[_0xeefb('0xcc')],{'as':_0xeefb('0x157'),'foreignKey':_0xeefb('0x198'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x121')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':_0xeefb('0x149'),'through':_0xeefb('0x199')});db[_0xeefb('0x190')][_0xeefb('0x11e')](db[_0xeefb('0x67')],{'as':_0xeefb('0x19a'),'foreignKey':_0xeefb('0x176')});db[_0xeefb('0x19b')][_0xeefb('0x10e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x19c'),'foreignKey':_0xeefb('0x19d')});db[_0xeefb('0x123')][_0xeefb('0x10e')](db[_0xeefb('0x75')],{'as':_0xeefb('0x14a'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x123')]['hasMany'](db[_0xeefb('0x113')],{'as':_0xeefb('0x114'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x123')][_0xeefb('0x10e')](db[_0xeefb('0x115')],{'as':_0xeefb('0x14c'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x123')]['hasMany'](db[_0xeefb('0x79')],{'as':_0xeefb('0x79'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0x123')]['hasMany'](db[_0xeefb('0x14d')],{'as':_0xeefb('0x14e'),'foreignKey':'ContactId'});db[_0xeefb('0x123')][_0xeefb('0x10e')](db[_0xeefb('0x62')],{'as':_0xeefb('0x116'),'foreignKey':_0xeefb('0x15d'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x123')][_0xeefb('0x10e')](db[_0xeefb('0x6d')],{'as':_0xeefb('0x117'),'foreignKey':_0xeefb('0x15d'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x123')]['hasMany'](db[_0xeefb('0x118')],{'as':_0xeefb('0x119'),'foreignKey':_0xeefb('0x15d'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x123')]['hasMany'](db[_0xeefb('0x51')],{'as':_0xeefb('0x11a'),'foreignKey':'ContactId','onDelete':_0xeefb('0x160')});db[_0xeefb('0x123')][_0xeefb('0x10e')](db[_0xeefb('0x16c')],{'as':'MailInteractions','foreignKey':_0xeefb('0x15d'),'onDelete':'restrict'});db[_0xeefb('0x123')][_0xeefb('0x11e')](db[_0xeefb('0x19b')],{'as':_0xeefb('0x19e'),'foreignKey':_0xeefb('0x19d')});db['CmContact'][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':'ListId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0x123')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Users','through':'cm_user_has_contacts'});db[_0xeefb('0x123')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'as':_0xeefb('0x171'),'through':_0xeefb('0x19f')});db[_0xeefb('0x123')][_0xeefb('0x120')](db['Tag'],{'through':_0xeefb('0x19f'),'as':_0xeefb('0x172')});db[_0xeefb('0x75')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x75')][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169'),'onDelete':'cascade'});db[_0xeefb('0x75')]['belongsTo'](db[_0xeefb('0x10')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0xeefb('0x11e')](db['VoiceQueue'],{'as':_0xeefb('0x194'),'foreignKey':_0xeefb('0x14b'),'onDelete':'cascade'});db[_0xeefb('0x75')][_0xeefb('0x11e')](db[_0xeefb('0x1a0')],{'as':_0xeefb('0x1a0'),'foreignKey':_0xeefb('0x1a1'),'onDelete':_0xeefb('0x10d')});db['CmHopper'][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':'Owner','foreignKey':_0xeefb('0x1a2')});db[_0xeefb('0x77')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d'),'onDelete':'cascade'});db[_0xeefb('0x77')][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':'ListId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0x77')][_0xeefb('0x11e')](db[_0xeefb('0x18')],{'as':_0xeefb('0x194'),'foreignKey':_0xeefb('0x14b'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x77')][_0xeefb('0x11e')](db[_0xeefb('0x1a0')],{'as':_0xeefb('0x1a0'),'foreignKey':_0xeefb('0x1a1'),'onDelete':_0xeefb('0x10d')});db['Automation'][_0xeefb('0x10e')](db[_0xeefb('0x7f')],{'as':{'plural':_0xeefb('0x1a3'),'singular':_0xeefb('0x1a4')},'foreignKey':_0xeefb('0x1a5'),'onDelete':_0xeefb('0x10d'),'hooks':!![]});db[_0xeefb('0x1a6')][_0xeefb('0x10e')](db[_0xeefb('0x7f')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xeefb('0x1a7'),'onDelete':_0xeefb('0x10d'),'hooks':!![]});db[_0xeefb('0x1a6')][_0xeefb('0x10e')](db['Action'],{'as':_0xeefb('0x1a8'),'foreignKey':'AutomationId','onDelete':_0xeefb('0x10d'),'hooks':!![]});db['Disposition'][_0xeefb('0x10e')](db[_0xeefb('0x7e')],{'as':_0xeefb('0x163'),'foreignKey':_0xeefb('0x1a9'),'onDelete':'cascade'});db[_0xeefb('0x81')]['hasMany'](db[_0xeefb('0x81')],{'as':_0xeefb('0x1aa'),'foreignKey':_0xeefb('0x179'),'onDelete':_0xeefb('0x10d'),'hooks':!![],'required':![]});db[_0xeefb('0x81')][_0xeefb('0x10e')](db[_0xeefb('0x143')],{'as':_0xeefb('0x112'),'foreignKey':_0xeefb('0x179'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x81')][_0xeefb('0x10e')](db[_0xeefb('0x45')],{'as':'MailApplications','foreignKey':_0xeefb('0x179')});db['Interval']['hasMany'](db[_0xeefb('0x6b')],{'as':'ChatApplications','foreignKey':_0xeefb('0x179')});db[_0xeefb('0x81')][_0xeefb('0x10e')](db[_0xeefb('0x4f')],{'as':'FaxApplications','foreignKey':_0xeefb('0x179')});db[_0xeefb('0x81')][_0xeefb('0x10e')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xeefb('0x179')});db['Schedule'][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{});db[_0xeefb('0x87')][_0xeefb('0x11e')](db[_0xeefb('0x95')],{'foreignKey':_0xeefb('0x1ab')});db[_0xeefb('0x87')]['belongsTo'](db[_0xeefb('0x93')],{'foreignKey':'CustomReportId'});db['Sound'][_0xeefb('0x120')](db[_0xeefb('0x16')],{'as':'Mohs','through':_0xeefb('0x148'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x8a')][_0xeefb('0x120')](db[_0xeefb('0x123')],{'through':_0xeefb('0x19f')});db[_0xeefb('0x8a')][_0xeefb('0x120')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xeefb('0x8a')][_0xeefb('0x120')](db[_0xeefb('0x16c')],{'through':_0xeefb('0x170')});db[_0xeefb('0x8a')]['belongsToMany'](db[_0xeefb('0x118')],{'through':_0xeefb('0x187')});db['Tag']['belongsToMany'](db[_0xeefb('0x51')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xeefb('0x120')](db[_0xeefb('0x62')],{'through':_0xeefb('0x1ac')});db['Tag'][_0xeefb('0x120')](db[_0xeefb('0xf9')],{'through':_0xeefb('0x1ad')});db[_0xeefb('0x1ae')][_0xeefb('0x10e')](db[_0xeefb('0x7f')],{'as':{'plural':_0xeefb('0x1af'),'singular':_0xeefb('0x1b0')},'foreignKey':'TriggerAllId','onDelete':_0xeefb('0x10d'),'hooks':!![]});db['Trigger'][_0xeefb('0x10e')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0xeefb('0x1b1')},'foreignKey':_0xeefb('0x1b2'),'onDelete':_0xeefb('0x10d'),'hooks':!![]});db[_0xeefb('0x1ae')][_0xeefb('0x10e')](db[_0xeefb('0x7c')],{'as':_0xeefb('0x1a8'),'foreignKey':_0xeefb('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0xeefb('0x93')][_0xeefb('0x10e')](db[_0xeefb('0x9a')],{'as':'Fields','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b4'),'hooks':!![]});db[_0xeefb('0x95')][_0xeefb('0x10e')](db[_0xeefb('0x9a')],{'as':'Fields','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1ab')});db[_0xeefb('0x99')]['hasMany'](db[_0xeefb('0x9a')],{'as':_0xeefb('0x1b5'),'onDelete':'cascade','foreignKey':_0xeefb('0x1b6')});db[_0xeefb('0x9a')][_0xeefb('0x11e')](db[_0xeefb('0x99')],{'foreignKey':_0xeefb('0x1b6')});db[_0xeefb('0x9c')][_0xeefb('0x10e')](db[_0xeefb('0x9e')],{'as':_0xeefb('0x1b7'),'onDelete':'cascade','foreignKey':_0xeefb('0x1b8')});db['SalesforceConfiguration'][_0xeefb('0x10e')](db['SalesforceField'],{'as':_0xeefb('0x1b9'),'onDelete':_0xeefb('0x10d'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0x9f')],{'as':_0xeefb('0x1ba'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x9e')][_0xeefb('0x10e')](db[_0xeefb('0x9f')],{'as':_0xeefb('0x1b5'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x9e')][_0xeefb('0x11e')](db[_0xeefb('0x9c')],{'as':'Account','foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x9f')][_0xeefb('0x10e')](db['SalesforceField'],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db['SalesforceField']['hasMany'](db[_0xeefb('0x9f')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x9f')]['hasMany'](db[_0xeefb('0x9f')],{'as':'Field','foreignKey':'FieldId'});db[_0xeefb('0x9f')][_0xeefb('0x11e')](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0xa1')]['hasMany'](db[_0xeefb('0xa2')],{'as':_0xeefb('0x1b7'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xa2')][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1b9'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1be')});db['SugarcrmConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1ba'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db['SugarcrmConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1b5'),'onDelete':'cascade','foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0xa2')]['belongsTo'](db[_0xeefb('0xa1')],{'as':_0xeefb('0x180'),'foreignKey':'AccountId'});db[_0xeefb('0xa4')][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1bd'),'foreignKey':'SubjectId'});db[_0xeefb('0xa4')][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xa4')][_0xeefb('0x10e')](db[_0xeefb('0xa4')],{'as':_0xeefb('0x1c2'),'foreignKey':_0xeefb('0x1bc')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0xa6')][_0xeefb('0x10e')](db[_0xeefb('0xa8')],{'as':_0xeefb('0x1b7'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xa8')][_0xeefb('0x10e')](db[_0xeefb('0x1c3')],{'as':_0xeefb('0x1b9'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xeefb('0xa8')]['hasMany'](db[_0xeefb('0x1c3')],{'as':_0xeefb('0x1ba'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xa8')][_0xeefb('0x10e')](db[_0xeefb('0x1c3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0xa8')][_0xeefb('0x11e')](db[_0xeefb('0xa6')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xa8')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x1c4')});db[_0xeefb('0x1c3')][_0xeefb('0x10e')](db[_0xeefb('0x1c3')],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1c3')][_0xeefb('0x10e')](db[_0xeefb('0x1c3')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1c3')][_0xeefb('0x10e')](db[_0xeefb('0x1c3')],{'as':_0xeefb('0x1c2'),'foreignKey':'FieldId'});db[_0xeefb('0x1c3')]['belongsTo'](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':'VariableId'});db[_0xeefb('0xab')][_0xeefb('0x10e')](db['ZohoConfiguration'],{'as':_0xeefb('0x1b7'),'onDelete':'cascade','foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xad')][_0xeefb('0x10e')](db['ZohoField'],{'as':'Subjects','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0xad')]['hasMany'](db[_0xeefb('0xaf')],{'as':_0xeefb('0x1ba'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db['ZohoConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0xaf')],{'as':_0xeefb('0x1b5'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0xad')][_0xeefb('0x11e')](db[_0xeefb('0xab')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xaf')][_0xeefb('0x10e')](db[_0xeefb('0xaf')],{'as':_0xeefb('0x1bd'),'foreignKey':'SubjectId'});db['ZohoField'][_0xeefb('0x10e')](db[_0xeefb('0xaf')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db['ZohoField']['hasMany'](db[_0xeefb('0xaf')],{'as':_0xeefb('0x1c2'),'foreignKey':_0xeefb('0x1bc')});db['ZohoField'][_0xeefb('0x11e')](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db['ZendeskAccount']['hasMany'](db[_0xeefb('0x1c5')],{'as':_0xeefb('0x1b7'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x1c5')][_0xeefb('0x10e')](db[_0xeefb('0xb4')],{'as':_0xeefb('0x1b9'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1c5')][_0xeefb('0x10e')](db[_0xeefb('0xb4')],{'as':_0xeefb('0x1ba'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1c5')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xeefb('0x1c5')][_0xeefb('0x11e')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x1c5')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x1c6')});db[_0xeefb('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0xb4')]['hasMany'](db[_0xeefb('0xb4')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xb4')][_0xeefb('0x10e')](db[_0xeefb('0xb4')],{'as':_0xeefb('0x1c2'),'foreignKey':_0xeefb('0x1bc')});db['ZendeskField'][_0xeefb('0x11e')](db[_0xeefb('0x1c0')],{'as':'Variable','foreignKey':'VariableId'});db[_0xeefb('0xb6')]['hasMany'](db[_0xeefb('0x1c7')],{'as':'Configurations','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x1c7')][_0xeefb('0x10e')](db[_0xeefb('0xb8')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1c7')][_0xeefb('0x10e')](db[_0xeefb('0xb8')],{'as':'Descriptions','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1c7')][_0xeefb('0x10e')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x1c7')][_0xeefb('0x11e')](db[_0xeefb('0xb6')],{'as':'Account','foreignKey':_0xeefb('0x1b8')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xeefb('0x8a')],{'through':_0xeefb('0x1c8')});db['FreshdeskField'][_0xeefb('0x10e')](db[_0xeefb('0xb8')],{'as':_0xeefb('0x1bd'),'foreignKey':'SubjectId'});db[_0xeefb('0xb8')][_0xeefb('0x10e')](db[_0xeefb('0xb8')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xb8')][_0xeefb('0x10e')](db[_0xeefb('0xb8')],{'as':_0xeefb('0x1c2'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xeefb('0x11e')](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0xba')][_0xeefb('0x10e')](db[_0xeefb('0x1c9')],{'as':_0xeefb('0x1b7'),'onDelete':'cascade','foreignKey':_0xeefb('0x1b8')});db['VtigerConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0x1ca')],{'as':_0xeefb('0x1b9'),'foreignKey':_0xeefb('0x1be')});db['VtigerConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0x1ca')],{'as':_0xeefb('0x1ba'),'foreignKey':'DescriptionId'});db[_0xeefb('0x1c9')][_0xeefb('0x10e')](db['VtigerField'],{'as':_0xeefb('0x1b5'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x1c9')][_0xeefb('0x11e')](db['VtigerAccount'],{'as':_0xeefb('0x180'),'foreignKey':'AccountId'});db['VtigerField'][_0xeefb('0x10e')](db[_0xeefb('0x1ca')],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1ca')][_0xeefb('0x10e')](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xeefb('0x1ca')][_0xeefb('0x10e')](db['VtigerField'],{'as':_0xeefb('0x1c2'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x1ca')][_0xeefb('0x11e')](db[_0xeefb('0x1c0')],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0xbe')][_0xeefb('0x10e')](db[_0xeefb('0xc0')],{'as':_0xeefb('0x1b7'),'onDelete':_0xeefb('0x10d'),'foreignKey':'AccountId'});db[_0xeefb('0xc0')]['hasMany'](db[_0xeefb('0xc2')],{'as':_0xeefb('0x1b9'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0xc0')]['hasMany'](db['ServicenowField'],{'as':_0xeefb('0x1ba'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xc0')][_0xeefb('0x10e')](db['ServicenowField'],{'as':_0xeefb('0x1b5'),'foreignKey':_0xeefb('0x1bc')});db['ServicenowConfiguration'][_0xeefb('0x11e')](db[_0xeefb('0xbe')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0xc2')][_0xeefb('0x10e')](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xeefb('0xc2')][_0xeefb('0x10e')](db[_0xeefb('0xc2')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0xc2')][_0xeefb('0x10e')](db['ServicenowField'],{'as':_0xeefb('0x1c2'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0xc2')][_0xeefb('0x11e')](db[_0xeefb('0x1c0')],{'as':_0xeefb('0x1c0'),'foreignKey':'VariableId'});db[_0xeefb('0x1cb')][_0xeefb('0x10e')](db[_0xeefb('0x1cc')],{'as':'Configurations','onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x1cb')][_0xeefb('0x11e')](db[_0xeefb('0x102')],{'as':_0xeefb('0x102'),'foreignKey':'CloudProviderId'});db[_0xeefb('0x1cc')]['hasMany'](db[_0xeefb('0x1cd')],{'as':_0xeefb('0x1b9'),'onDelete':_0xeefb('0x10d'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xeefb('0x1ba'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1cc')]['hasMany'](db[_0xeefb('0x1cd')],{'as':_0xeefb('0x1b5'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1bc')});db['Dynamics365Configuration']['belongsTo'](db[_0xeefb('0x1cb')],{'as':_0xeefb('0x180'),'foreignKey':'AccountId'});db[_0xeefb('0x1cd')][_0xeefb('0x10e')](db['Dynamics365Field'],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1cd')][_0xeefb('0x10e')](db[_0xeefb('0x1cd')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db['Dynamics365Field'][_0xeefb('0x10e')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x1cd')][_0xeefb('0x11e')](db[_0xeefb('0x1c0')],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0x1ce')][_0xeefb('0x10e')](db[_0xeefb('0x1cf')],{'as':_0xeefb('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xeefb('0x10e')](db[_0xeefb('0x1d0')],{'as':_0xeefb('0x1b9'),'foreignKey':'SubjectId'});db[_0xeefb('0x1cf')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1cf')][_0xeefb('0x10e')](db[_0xeefb('0x1d0')],{'as':_0xeefb('0x1b5'),'foreignKey':_0xeefb('0x1bc')});db[_0xeefb('0x1cf')][_0xeefb('0x11e')](db[_0xeefb('0x1ce')],{'as':_0xeefb('0x180'),'foreignKey':_0xeefb('0x1b8')});db[_0xeefb('0x1d0')][_0xeefb('0x10e')](db[_0xeefb('0x1d0')],{'as':_0xeefb('0x1bd'),'foreignKey':_0xeefb('0x1be')});db[_0xeefb('0x1d0')][_0xeefb('0x10e')](db[_0xeefb('0x1d0')],{'as':_0xeefb('0x1bf'),'foreignKey':_0xeefb('0x1bb')});db[_0xeefb('0x1d0')]['hasMany'](db[_0xeefb('0x1d0')],{'as':'Field','foreignKey':_0xeefb('0x1bc')});db['FreshsalesField'][_0xeefb('0x11e')](db['Variable'],{'as':_0xeefb('0x1c0'),'foreignKey':_0xeefb('0x1c1')});db[_0xeefb('0xca')][_0xeefb('0x11e')](db[_0xeefb('0x67')],{});db[_0xeefb('0xca')][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db['ChatQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0xca')]['belongsTo'](db[_0xeefb('0x6d')],{});db[_0xeefb('0xca')][_0xeefb('0x11e')](db[_0xeefb('0x192')],{});db[_0xeefb('0xca')][_0xeefb('0x11e')](db['User'],{});db[_0xeefb('0xca')][_0xeefb('0x11e')](db[_0xeefb('0x6f')],{});db[_0xeefb('0xcc')]['belongsTo'](db['User'],{'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1d1')});db[_0xeefb('0xcc')][_0xeefb('0x11e')](db['User'],{'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1d2')});db[_0xeefb('0x14d')][_0xeefb('0x10e')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0x14d')][_0xeefb('0x10e')](db[_0xeefb('0xce')],{'foreignKey':_0xeefb('0x1d3'),'onDelete':_0xeefb('0x10d')});db['SmsQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x13d')],{});db['SmsQueueReport']['belongsTo'](db[_0xeefb('0xee')],{'as':'List','foreignKey':_0xeefb('0x169')});db[_0xeefb('0xd1')]['belongsTo'](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0xeefb('0x118')],{});db['SmsQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x188')],{});db[_0xeefb('0xd1')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{});db['SmsQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0x5d')],{});db[_0xeefb('0xd6')]['hasMany'](db[_0xeefb('0x14d')],{'foreignKey':_0xeefb('0x1d4')});db[_0xeefb('0xd6')][_0xeefb('0x10e')](db[_0xeefb('0x1d5')],{'foreignKey':_0xeefb('0x1d4')});db[_0xeefb('0xd6')][_0xeefb('0x10e')](db[_0xeefb('0xce')],{'foreignKey':_0xeefb('0x1d4')});db['SquareProject'][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':_0xeefb('0x173'),'through':_0xeefb('0x142')});db[_0xeefb('0xdf')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Agents','through':_0xeefb('0x126')});db[_0xeefb('0xdf')][_0xeefb('0x120')](db['VoiceQueue'],{'through':_0xeefb('0x104'),'as':_0xeefb('0x12d')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0xeefb('0x1d6'),'as':_0xeefb('0x130')});db[_0xeefb('0xdf')][_0xeefb('0x120')](db[_0xeefb('0x6f')],{'through':_0xeefb('0x197'),'as':'ChatQueues'});db[_0xeefb('0xdf')][_0xeefb('0x120')](db['FaxQueue'],{'through':_0xeefb('0x183'),'as':_0xeefb('0x132')});db[_0xeefb('0xdf')]['belongsToMany'](db[_0xeefb('0x5d')],{'through':_0xeefb('0x18a'),'as':_0xeefb('0x133')});db[_0xeefb('0xdf')][_0xeefb('0x120')](db['OpenchannelQueue'],{'through':_0xeefb('0x18f'),'as':'OpenchannelQueues'});db[_0xeefb('0xdf')][_0xeefb('0x120')](db[_0xeefb('0x101')],{'through':_0xeefb('0x1d7'),'as':'WhatsappQueues'});db[_0xeefb('0xdf')][_0xeefb('0x120')](db['VoicePrefix'],{'through':_0xeefb('0x106'),'as':'VoicePrefixes'});db[_0xeefb('0x1a0')][_0xeefb('0x10e')](db[_0xeefb('0x75')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xeefb('0x1a0')]['hasMany'](db[_0xeefb('0x113')],{'as':_0xeefb('0x114'),'foreignKey':_0xeefb('0x1a1')});db[_0xeefb('0x1a0')][_0xeefb('0x10e')](db[_0xeefb('0x115')],{'as':_0xeefb('0x14c'),'foreignKey':_0xeefb('0x1a1')});db[_0xeefb('0x1a0')]['hasMany'](db[_0xeefb('0x77')],{'as':_0xeefb('0x1d8'),'foreignKey':_0xeefb('0x1a1')});db[_0xeefb('0x1a0')][_0xeefb('0x11e')](db['Trunk'],{'as':_0xeefb('0x27'),'foreignKey':'TrunkId'});db[_0xeefb('0x1a0')][_0xeefb('0x11e')](db[_0xeefb('0x27')],{'as':'TrunkBackup','foreignKey':_0xeefb('0x151')});db[_0xeefb('0x1a0')][_0xeefb('0x11e')](db[_0xeefb('0x81')],{'as':_0xeefb('0x81'),'foreignKey':_0xeefb('0x179')});db['Campaign'][_0xeefb('0x11e')](db[_0xeefb('0x140')],{'as':_0xeefb('0x140'),'foreignKey':_0xeefb('0x1d9')});db[_0xeefb('0x1a0')][_0xeefb('0x120')](db[_0xeefb('0xee')],{'as':_0xeefb('0x125'),'through':'campaigns_has_cm_lists'});db[_0xeefb('0x1a0')][_0xeefb('0x120')](db[_0xeefb('0xee')],{'as':_0xeefb('0x1da'),'through':_0xeefb('0x1db')});db[_0xeefb('0xe6')][_0xeefb('0x11e')](db['ChatOfflineMessage'],{'as':_0xeefb('0x177'),'foreignKey':_0xeefb('0x178')});db[_0xeefb('0x1dc')][_0xeefb('0x11e')](db[_0xeefb('0x43')],{});db[_0xeefb('0x1dc')][_0xeefb('0x11e')](db[_0xeefb('0x16c')],{});db[_0xeefb('0x1dc')][_0xeefb('0x11e')](db[_0xeefb('0x3d')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0xeefb('0x1dc')]['belongsTo'](db['User'],{'foreignKey':_0xeefb('0x1dd'),'as':_0xeefb('0x1de')});db[_0xeefb('0x1dc')][_0xeefb('0x11e')](db['User'],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db['MailTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x3f')],{'foreignKey':_0xeefb('0x1e1'),'as':_0xeefb('0x1e2')});db[_0xeefb('0x1dc')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xeefb('0x1e3'),'as':_0xeefb('0x1e4')});db['ChatTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x192')],{});db[_0xeefb('0x1e5')][_0xeefb('0x11e')](db[_0xeefb('0x6d')],{});db['ChatTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x67')],{'foreignKey':_0xeefb('0x1e6'),'as':_0xeefb('0x1e7')});db[_0xeefb('0x1e5')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'foreignKey':_0xeefb('0x1dd'),'as':_0xeefb('0x1de')});db[_0xeefb('0x1e5')][_0xeefb('0x11e')](db['User'],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db['ChatTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x6f')],{'foreignKey':_0xeefb('0x1e8'),'as':_0xeefb('0x1e2')});db[_0xeefb('0x1e5')]['belongsTo'](db[_0xeefb('0x67')],{'foreignKey':_0xeefb('0x1e9'),'as':_0xeefb('0x1e4')});db['FaxTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x17f')],{});db[_0xeefb('0xea')][_0xeefb('0x11e')](db[_0xeefb('0x51')],{});db['FaxTransferReport']['belongsTo'](db[_0xeefb('0x4d')],{'foreignKey':_0xeefb('0x1ea'),'as':_0xeefb('0x1e7')});db[_0xeefb('0xea')]['belongsTo'](db[_0xeefb('0x10')],{'foreignKey':_0xeefb('0x1dd'),'as':_0xeefb('0x1de')});db[_0xeefb('0xea')]['belongsTo'](db['User'],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db[_0xeefb('0xea')][_0xeefb('0x11e')](db[_0xeefb('0x54')],{'foreignKey':'ToFaxQueueId','as':_0xeefb('0x1e2')});db['FaxTransferReport'][_0xeefb('0x11e')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xeefb('0x1e4')});db[_0xeefb('0xeb')][_0xeefb('0x11e')](db[_0xeefb('0x64')],{});db[_0xeefb('0xeb')]['belongsTo'](db[_0xeefb('0x62')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xeefb('0x5f')],{'foreignKey':_0xeefb('0x1eb'),'as':_0xeefb('0x1e7')});db[_0xeefb('0xeb')][_0xeefb('0x11e')](db['User'],{'foreignKey':_0xeefb('0x1dd'),'as':_0xeefb('0x1de')});db[_0xeefb('0xeb')]['belongsTo'](db[_0xeefb('0x10')],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db[_0xeefb('0xeb')][_0xeefb('0x11e')](db[_0xeefb('0x66')],{'foreignKey':_0xeefb('0x1ec'),'as':_0xeefb('0x1e2')});db[_0xeefb('0xeb')][_0xeefb('0x11e')](db[_0xeefb('0x5f')],{'foreignKey':_0xeefb('0x1ed'),'as':_0xeefb('0x1e4')});db[_0xeefb('0x1ee')][_0xeefb('0x11e')](db['SmsMessage'],{});db[_0xeefb('0x1ee')][_0xeefb('0x11e')](db['SmsInteraction'],{});db['SmsTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0x13d')],{'foreignKey':_0xeefb('0x1ef'),'as':_0xeefb('0x1e7')});db[_0xeefb('0x1ee')]['belongsTo'](db[_0xeefb('0x10')],{'foreignKey':_0xeefb('0x1dd'),'as':_0xeefb('0x1de')});db[_0xeefb('0x1ee')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db[_0xeefb('0x1ee')]['belongsTo'](db[_0xeefb('0x5d')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xeefb('0x1ee')][_0xeefb('0x11e')](db[_0xeefb('0x13d')],{'foreignKey':_0xeefb('0x1f0'),'as':_0xeefb('0x1e4')});db['CmList'][_0xeefb('0x10e')](db['Disposition'],{'as':_0xeefb('0x163'),'foreignKey':'ListId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0xee')][_0xeefb('0x10e')](db[_0xeefb('0x1f1')],{'as':_0xeefb('0x1f2'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0xee')]['hasMany'](db[_0xeefb('0x123')],{'as':_0xeefb('0x19c'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0xee')][_0xeefb('0x10e')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xeefb('0x169')});db[_0xeefb('0xee')]['hasMany'](db[_0xeefb('0x115')],{'as':_0xeefb('0x1f3'),'foreignKey':'ListId'});db[_0xeefb('0xee')]['hasMany'](db[_0xeefb('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xeefb('0x169')});db['CmList'][_0xeefb('0x120')](db[_0xeefb('0x18')],{'as':_0xeefb('0x1f4'),'through':_0xeefb('0x154')});db[_0xeefb('0xee')][_0xeefb('0x120')](db[_0xeefb('0x10')],{'as':'Agents','through':_0xeefb('0x1f5')});db[_0xeefb('0x12e')][_0xeefb('0x10e')](db['VoiceExtension'],{'as':_0xeefb('0x112'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0x12e')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x108')});db[_0xeefb('0x12e')][_0xeefb('0x120')](db['Team'],{'through':_0xeefb('0x106'),'as':_0xeefb('0x155')});db[_0xeefb('0xef')][_0xeefb('0x10e')](db['User'],{'as':_0xeefb('0x173'),'foreignKey':_0xeefb('0x11f')});db['UserProfile'][_0xeefb('0x10e')](db[_0xeefb('0xf1')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xeefb('0x10d')});db[_0xeefb('0xf1')][_0xeefb('0x10e')](db[_0xeefb('0xf3')],{'as':_0xeefb('0x1f6'),'foreignKey':_0xeefb('0x1f7'),'onDelete':_0xeefb('0x10d')});db[_0xeefb('0xf6')]['hasMany'](db[_0xeefb('0x7e')],{'as':_0xeefb('0x163'),'foreignKey':_0xeefb('0x1f8'),'onDelete':'cascade'});db[_0xeefb('0xf6')][_0xeefb('0x10e')](db[_0xeefb('0x164')],{'as':_0xeefb('0x165'),'foreignKey':_0xeefb('0x1f8')});db[_0xeefb('0xf6')][_0xeefb('0x10e')](db[_0xeefb('0xfb')],{'as':'Messages','foreignKey':_0xeefb('0x1f8')});db[_0xeefb('0xf6')][_0xeefb('0x10e')](db[_0xeefb('0xf9')],{'as':_0xeefb('0x166')});db[_0xeefb('0xf6')][_0xeefb('0x10e')](db[_0xeefb('0xf7')],{'as':_0xeefb('0x167')});db[_0xeefb('0xf6')]['belongsTo'](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':'ListId'});db[_0xeefb('0xf6')]['belongsTo'](db[_0xeefb('0x82')],{'as':_0xeefb('0x152'),'foreignKey':_0xeefb('0x153')});db[_0xeefb('0xf6')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x13f')});db[_0xeefb('0xf7')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'onDelete':'restrict'});db[_0xeefb('0xf7')][_0xeefb('0x11e')](db[_0xeefb('0x101')],{'onDelete':_0xeefb('0x160')});db[_0xeefb('0xf7')][_0xeefb('0x11e')](db[_0xeefb('0xf6')],{'onDelete':'restrict'});db[_0xeefb('0xf7')]['belongsTo'](db[_0xeefb('0x81')],{'onDelete':_0xeefb('0x160'),'foreignKey':_0xeefb('0x179')});db[_0xeefb('0xf7')][_0xeefb('0x11e')](db[_0xeefb('0x8a')],{'onDelete':'restrict','foreignKey':_0xeefb('0x17a')});db[_0xeefb('0xf9')][_0xeefb('0x10e')](db['WhatsappMessage'],{'as':_0xeefb('0x157'),'onDelete':_0xeefb('0x10d'),'foreignKey':_0xeefb('0x1f9')});db[_0xeefb('0xf9')][_0xeefb('0x11e')](db['WhatsappAccount'],{'as':_0xeefb('0x180'),'foreignKey':'WhatsappAccountId'});db[_0xeefb('0xf9')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':_0xeefb('0x15d')});db[_0xeefb('0xf9')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x16f'),'foreignKey':_0xeefb('0x111')});db[_0xeefb('0xf9')][_0xeefb('0x120')](db[_0xeefb('0x8a')],{'through':_0xeefb('0x1ad'),'as':_0xeefb('0x171')});db[_0xeefb('0xf9')][_0xeefb('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xeefb('0x172')});db[_0xeefb('0xf9')][_0xeefb('0x120')](db['User'],{'as':_0xeefb('0x173'),'through':_0xeefb('0x12c'),'foreignKey':'WhatsappInteractionId'});db[_0xeefb('0xfb')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'as':_0xeefb('0x10')});db[_0xeefb('0xfb')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'onDelete':'cascade','as':_0xeefb('0x16e')});db[_0xeefb('0xfb')][_0xeefb('0x11e')](db[_0xeefb('0xf9')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xeefb('0x1f9')});db[_0xeefb('0xfb')]['belongsTo'](db[_0xeefb('0xf6')],{'as':'Account','foreignKey':_0xeefb('0x1f8')});db['WhatsappQueueReport'][_0xeefb('0x11e')](db[_0xeefb('0xf6')],{});db[_0xeefb('0xfd')][_0xeefb('0x11e')](db[_0xeefb('0xee')],{'as':_0xeefb('0x168'),'foreignKey':_0xeefb('0x169')});db[_0xeefb('0xfd')][_0xeefb('0x11e')](db[_0xeefb('0x123')],{'as':_0xeefb('0x16e'),'foreignKey':'ContactId'});db[_0xeefb('0xfd')][_0xeefb('0x11e')](db[_0xeefb('0xf9')],{});db[_0xeefb('0xfd')][_0xeefb('0x11e')](db[_0xeefb('0x101')],{});db['WhatsappQueueReport'][_0xeefb('0x11e')](db['WhatsappMessage'],{});db[_0xeefb('0xfd')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{});db[_0xeefb('0xff')]['belongsTo'](db[_0xeefb('0xfb')],{});db[_0xeefb('0xff')][_0xeefb('0x11e')](db[_0xeefb('0xf9')],{});db['WhatsappTransferReport'][_0xeefb('0x11e')](db[_0xeefb('0xf6')],{'foreignKey':_0xeefb('0x1fa'),'as':_0xeefb('0x1e7')});db[_0xeefb('0xff')][_0xeefb('0x11e')](db['WhatsappAccount'],{'foreignKey':_0xeefb('0x1fb'),'as':_0xeefb('0x1e4')});db[_0xeefb('0xff')]['belongsTo'](db[_0xeefb('0x101')],{'foreignKey':_0xeefb('0x1fc'),'as':_0xeefb('0x1e2')});db[_0xeefb('0xff')][_0xeefb('0x11e')](db[_0xeefb('0x10')],{'foreignKey':'FromUserId','as':_0xeefb('0x1de')});db[_0xeefb('0xff')]['belongsTo'](db['User'],{'foreignKey':_0xeefb('0x1df'),'as':_0xeefb('0x1e0')});db[_0xeefb('0x101')]['belongsToMany'](db[_0xeefb('0x10')],{'as':_0xeefb('0x16b'),'through':_0xeefb('0x38'),'foreignKey':_0xeefb('0x1fd')});db[_0xeefb('0x101')][_0xeefb('0x120')](db['Team'],{'through':_0xeefb('0x1d7'),'as':_0xeefb('0x155')});db['UserSetting'][_0xeefb('0x11e')](db['User'],{'as':_0xeefb('0x1fe'),'foreignKey':_0xeefb('0x111'),'onDelete':'cascade','hooks':!![]});db[_0xeefb('0x102')][_0xeefb('0x10b')](db[_0xeefb('0x1cb')],{'as':_0xeefb('0x1cb'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x102')][_0xeefb('0x10b')](db['MailServerIn'],{'as':_0xeefb('0x161'),'onDelete':_0xeefb('0x160')});db[_0xeefb('0x102')][_0xeefb('0x10b')](db['MailServerOut'],{'as':_0xeefb('0x162'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ab690a7..0b79ec8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','root','join','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport'];(function(_0x285f12,_0x5c8949){var _0x31f213=function(_0x372f57){while(--_0x372f57){_0x285f12['push'](_0x285f12['shift']());}};_0x31f213(++_0x5c8949);}(_0x008c,0x188));var _0xc008=function(_0x3f3b97,_0x395d93){_0x3f3b97=_0x3f3b97-0x0;var _0xb6ab0c=_0x008c[_0x3f3b97];return _0xb6ab0c;};'use strict';var path=require(_0xc008('0x0'));var express=require(_0xc008('0x1'));var errors=require(_0xc008('0x2'));var config=require(_0xc008('0x3'));var setupLoggers=require(_0xc008('0x4'))['setupLoggers'];var clientSideLogs=require(_0xc008('0x5'));exports[_0xc008('0x6')]=function(_0x10b33c){return setupLoggers(_0x10b33c)[_0xc008('0x7')](function(){_0x10b33c[_0xc008('0x8')](_0xc008('0x9'),require(_0xc008('0xa')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb'),require('./api/voiceChanSpy'));_0x10b33c[_0xc008('0x8')]('/api/voice/contexts',require(_0xc008('0xc')));_0x10b33c['use']('/api/voice/extensions',require(_0xc008('0xd')));_0x10b33c[_0xc008('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x10b33c['use'](_0xc008('0xe'),require(_0xc008('0xf')));_0x10b33c['use'](_0xc008('0x10'),require(_0xc008('0x11')));_0x10b33c[_0xc008('0x8')](_0xc008('0x12'),require(_0xc008('0x13')));_0x10b33c[_0xc008('0x8')](_0xc008('0x14'),require('./api/voiceMail'));_0x10b33c['use'](_0xc008('0x15'),require('./api/voiceMailMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x16'),require(_0xc008('0x17')));_0x10b33c[_0xc008('0x8')](_0xc008('0x18'),require('./api/voiceDialReport'));_0x10b33c['use']('/api/voice/agents/reports',require(_0xc008('0x19')));_0x10b33c[_0xc008('0x8')](_0xc008('0x1a'),require(_0xc008('0x1b')));_0x10b33c['use']('/api/members/reports',require('./api/memberReport'));_0x10b33c['use'](_0xc008('0x1c'),require(_0xc008('0x1d')));_0x10b33c['use'](_0xc008('0x1e'),require('./api/voiceTransferReport'));_0x10b33c['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x10b33c[_0xc008('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x10b33c['use']('/api/mail/queues',require('./api/mailQueue'));_0x10b33c[_0xc008('0x8')](_0xc008('0x1f'),require(_0xc008('0x20')));_0x10b33c[_0xc008('0x8')](_0xc008('0x21'),require(_0xc008('0x22')));_0x10b33c['use'](_0xc008('0x23'),require('./api/mailMessage'));_0x10b33c['use'](_0xc008('0x24'),require(_0xc008('0x25')));_0x10b33c[_0xc008('0x8')](_0xc008('0x26'),require('./api/mailQueueReport'));_0x10b33c['use']('/api/dashboards',require(_0xc008('0x27')));_0x10b33c[_0xc008('0x8')](_0xc008('0x28'),require(_0xc008('0x29')));_0x10b33c['use']('/api/fax/accounts',require('./api/faxAccount'));_0x10b33c['use']('/api/fax/applications',require(_0xc008('0x2a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x2b'),require('./api/faxInteraction'));_0x10b33c[_0xc008('0x8')](_0xc008('0x2c'),require(_0xc008('0x2d')));_0x10b33c[_0xc008('0x8')]('/api/fax/queues',require(_0xc008('0x2e')));_0x10b33c[_0xc008('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x10b33c['use'](_0xc008('0x2f'),require(_0xc008('0x30')));_0x10b33c[_0xc008('0x8')](_0xc008('0x31'),require(_0xc008('0x32')));_0x10b33c[_0xc008('0x8')](_0xc008('0x33'),require(_0xc008('0x34')));_0x10b33c[_0xc008('0x8')](_0xc008('0x35'),require(_0xc008('0x36')));_0x10b33c[_0xc008('0x8')]('/api/sms/queues',require(_0xc008('0x37')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/accounts',require(_0xc008('0x38')));_0x10b33c[_0xc008('0x8')](_0xc008('0x39'),require(_0xc008('0x3a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3b'),require(_0xc008('0x3c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3d'),require('./api/openchannelMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x3e'),require(_0xc008('0x3f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x40'),require(_0xc008('0x41')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/reports/queue',require(_0xc008('0x42')));_0x10b33c[_0xc008('0x8')]('/api/chat/applications',require(_0xc008('0x43')));_0x10b33c[_0xc008('0x8')]('/api/chat/interactions',require(_0xc008('0x44')));_0x10b33c[_0xc008('0x8')](_0xc008('0x45'),require('./api/chatMessage'));_0x10b33c['use']('/api/chat/offline_messages',require(_0xc008('0x46')));_0x10b33c['use'](_0xc008('0x47'),require(_0xc008('0x48')));_0x10b33c[_0xc008('0x8')](_0xc008('0x49'),require(_0xc008('0x4a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4b'),require(_0xc008('0x4c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4d'),require(_0xc008('0x4e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4f'),require(_0xc008('0x50')));_0x10b33c['use'](_0xc008('0x51'),require(_0xc008('0x52')));_0x10b33c[_0xc008('0x8')](_0xc008('0x53'),require('./api/cmHopperBlack'));_0x10b33c[_0xc008('0x8')](_0xc008('0x54'),require(_0xc008('0x55')));_0x10b33c[_0xc008('0x8')](_0xc008('0x56'),require('./api/cmHopperHistory'));_0x10b33c[_0xc008('0x8')](_0xc008('0x57'),require(_0xc008('0x58')));_0x10b33c[_0xc008('0x8')](_0xc008('0x59'),require('./api/action'));_0x10b33c[_0xc008('0x8')](_0xc008('0x5a'),require(_0xc008('0x5b')));_0x10b33c[_0xc008('0x8')]('/api/canned_answers',require(_0xc008('0x5c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x5d'),require('./api/disposition'));_0x10b33c[_0xc008('0x8')]('/api/conditions',require(_0xc008('0x5e')));_0x10b33c['use'](_0xc008('0x5f'),require(_0xc008('0x60')));_0x10b33c['use'](_0xc008('0x61'),require(_0xc008('0x62')));_0x10b33c[_0xc008('0x8')]('/api/cdr',require(_0xc008('0x63')));_0x10b33c[_0xc008('0x8')](_0xc008('0x64'),require(_0xc008('0x65')));_0x10b33c[_0xc008('0x8')](_0xc008('0x66'),require('./api/schedule'));_0x10b33c['use']('/api/sounds',require(_0xc008('0x67')));_0x10b33c[_0xc008('0x8')](_0xc008('0x68'),require(_0xc008('0x69')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6a'),require(_0xc008('0x6b')));_0x10b33c[_0xc008('0x8')]('/api/triggers',require('./api/trigger'));_0x10b33c['use'](_0xc008('0x6c'),require(_0xc008('0x6d')));_0x10b33c[_0xc008('0x8')]('/api/integrations',require(_0xc008('0x6e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6f'),require(_0xc008('0x70')));_0x10b33c[_0xc008('0x8')](_0xc008('0x71'),require(_0xc008('0x72')));_0x10b33c[_0xc008('0x8')](_0xc008('0x73'),require(_0xc008('0x74')));_0x10b33c['use']('/api/analytics/extracted_reports',require(_0xc008('0x75')));_0x10b33c['use'](_0xc008('0x76'),require(_0xc008('0x77')));_0x10b33c[_0xc008('0x8')]('/api/analytics/field_reports',require(_0xc008('0x78')));_0x10b33c[_0xc008('0x8')](_0xc008('0x79'),require(_0xc008('0x7a')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/accounts',require(_0xc008('0x7b')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/configurations',require(_0xc008('0x7c')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x7d'),require(_0xc008('0x7e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x7f'),require('./api/intSugarcrmConfiguration'));_0x10b33c['use'](_0xc008('0x80'),require('./api/intSugarcrmField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x81'),require(_0xc008('0x82')));_0x10b33c[_0xc008('0x8')](_0xc008('0x83'),require(_0xc008('0x84')));_0x10b33c['use'](_0xc008('0x85'),require(_0xc008('0x86')));_0x10b33c[_0xc008('0x8')](_0xc008('0x87'),require(_0xc008('0x88')));_0x10b33c['use'](_0xc008('0x89'),require('./api/intZohoConfiguration'));_0x10b33c['use']('/api/integrations/zoho/fields',require(_0xc008('0x8a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x8b'),require('./api/intZendeskAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0x8c'),require(_0xc008('0x8d')));_0x10b33c['use'](_0xc008('0x8e'),require(_0xc008('0x8f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x90'),require('./api/intFreshdeskAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshdesk/configurations',require(_0xc008('0x91')));_0x10b33c[_0xc008('0x8')](_0xc008('0x92'),require(_0xc008('0x93')));_0x10b33c[_0xc008('0x8')](_0xc008('0x94'),require('./api/intVtigerAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x10b33c[_0xc008('0x8')](_0xc008('0x95'),require('./api/intVtigerField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x96'),require(_0xc008('0x97')));_0x10b33c[_0xc008('0x8')](_0xc008('0x98'),require(_0xc008('0x99')));_0x10b33c[_0xc008('0x8')]('/api/integrations/servicenow/fields',require(_0xc008('0x9a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9b'),require(_0xc008('0x9c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9d'),require(_0xc008('0x9e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9f'),require(_0xc008('0xa0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa1'),require(_0xc008('0xa2')));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshsales/configurations',require(_0xc008('0xa3')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa4'),require('./api/intFreshsalesField'));_0x10b33c[_0xc008('0x8')](_0xc008('0xa5'),require('./api/network'));_0x10b33c['use'](_0xc008('0xa6'),require(_0xc008('0xa7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa8'),require(_0xc008('0xa9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xaa'),require(_0xc008('0xab')));_0x10b33c[_0xc008('0x8')](_0xc008('0xac'),require(_0xc008('0xad')));_0x10b33c['use'](_0xc008('0xae'),require(_0xc008('0xaf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb0'),require('./api/smsQueueReport'));_0x10b33c[_0xc008('0x8')]('/api/square/reports',require(_0xc008('0xb1')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb2'),require('./api/squareReportDetail'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb3'),require(_0xc008('0xb4')));_0x10b33c['use'](_0xc008('0xb5'),require('./api/setting'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb6'),require(_0xc008('0xb7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb8'),require('./api/squareProject'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb9'),require('./api/squareRecording'));_0x10b33c[_0xc008('0x8')]('/api/square/messages',require(_0xc008('0xba')));_0x10b33c['use'](_0xc008('0xbb'),require('./api/team'));_0x10b33c[_0xc008('0x8')](_0xc008('0xbc'),require(_0xc008('0xbd')));_0x10b33c[_0xc008('0x8')]('/api/campaigns',require(_0xc008('0xbe')));_0x10b33c[_0xc008('0x8')](_0xc008('0xbf'),require(_0xc008('0xc0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc1'),require(_0xc008('0xc2')));_0x10b33c[_0xc008('0x8')]('/api/plugins',require(_0xc008('0xc3')));_0x10b33c['use']('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xc4'),require(_0xc008('0xc5')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc6'),require(_0xc008('0xc7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc8'),require(_0xc008('0xc9')));_0x10b33c['use'](_0xc008('0xca'),require(_0xc008('0xcb')));_0x10b33c[_0xc008('0x8')](_0xc008('0xcc'),require(_0xc008('0xcd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xce'),require(_0xc008('0xcf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd0'),require(_0xc008('0xd1')));_0x10b33c[_0xc008('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd2'),require(_0xc008('0xd3')));_0x10b33c['use'](_0xc008('0xd4'),require(_0xc008('0xd5')));_0x10b33c['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd6'),require(_0xc008('0xd7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd8'),require(_0xc008('0xd9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xda'),require(_0xc008('0xdb')));_0x10b33c[_0xc008('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xdc'),require(_0xc008('0xdd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xde'),require(_0xc008('0xdf')));_0x10b33c['use']('/api/cloudProviders',require(_0xc008('0xe0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xe1'),require('./api/realtime'));_0x10b33c['use']('/api/user-settings',require('./api/user-setting'));_0x10b33c['use']('/api/auth/local',require(_0xc008('0xe2')));_0x10b33c['use'](_0xc008('0xe3'),require('./api/authGoogle'));_0x10b33c[_0xc008('0x8')](_0xc008('0xe4'),require(_0xc008('0xe5')));_0x10b33c['use']('/api/jira',require(_0xc008('0xe6')));_0x10b33c['use'](_0xc008('0xe7'),require(_0xc008('0xe8')));_0x10b33c['use'](_0xc008('0xe9'),require('./api/version'));_0x10b33c['use'](_0xc008('0xea'),require(_0xc008('0xeb')));_0x10b33c['use'](_0xc008('0xec'),require(_0xc008('0xed')));_0x10b33c[_0xc008('0x8')]('/api/webbar',require(_0xc008('0xee')));_0x10b33c[_0xc008('0x8')](_0xc008('0xef'),clientSideLogs);_0x10b33c[_0xc008('0x8')](_0xc008('0xf0'),express[_0xc008('0xf1')](path['join'](config[_0xc008('0xf2')],_0xc008('0xf0'))));_0x10b33c[_0xc008('0x8')]('/www',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],'/www')));_0x10b33c['use']('/demo',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf4'))));_0x10b33c[_0xc008('0x8')](_0xc008('0xf5'),express[_0xc008('0xf1')](path[_0xc008('0xf3')](config['root'],_0xc008('0xf6'),_0xc008('0xf7'))));_0x10b33c['use']('/plugins',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf8'))));_0x10b33c[_0xc008('0xf9')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc008('0xfa')](errors[0x194]);_0x10b33c[_0xc008('0xf9')]('/*')['get'](function(_0xb02bd,_0x1cc68f){_0x1cc68f[_0xc008('0xfb')](path[_0xc008('0xfc')](_0x10b33c['get'](_0xc008('0xfd'))+_0xc008('0xfe')));});return _0x10b33c;});}; \ No newline at end of file +var _0x31f0=['./api/openchannelQueueReport','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/system','/api/pm2','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','/snippet','root','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue'];(function(_0x1f8685,_0x31b799){var _0x144705=function(_0x4840b8){while(--_0x4840b8){_0x1f8685['push'](_0x1f8685['shift']());}};_0x144705(++_0x31b799);}(_0x31f0,0xb7));var _0x031f=function(_0x58e180,_0x4de9f2){_0x58e180=_0x58e180-0x0;var _0x1817c9=_0x31f0[_0x58e180];return _0x1817c9;};'use strict';var path=require(_0x031f('0x0'));var express=require('express');var errors=require(_0x031f('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x031f('0x2'))[_0x031f('0x3')];var clientSideLogs=require(_0x031f('0x4'));exports[_0x031f('0x5')]=function(_0x526a45){return setupLoggers(_0x526a45)[_0x031f('0x6')](function(){_0x526a45[_0x031f('0x7')]('/api/users',require('./api/user'));_0x526a45['use'](_0x031f('0x8'),require('./api/voiceChanSpy'));_0x526a45[_0x031f('0x7')](_0x031f('0x9'),require(_0x031f('0xa')));_0x526a45[_0x031f('0x7')]('/api/voice/extensions',require(_0x031f('0xb')));_0x526a45[_0x031f('0x7')](_0x031f('0xc'),require(_0x031f('0xd')));_0x526a45[_0x031f('0x7')](_0x031f('0xe'),require(_0x031f('0xf')));_0x526a45[_0x031f('0x7')]('/api/voice/recordings',require(_0x031f('0x10')));_0x526a45[_0x031f('0x7')](_0x031f('0x11'),require(_0x031f('0x12')));_0x526a45[_0x031f('0x7')](_0x031f('0x13'),require(_0x031f('0x14')));_0x526a45['use'](_0x031f('0x15'),require(_0x031f('0x16')));_0x526a45[_0x031f('0x7')](_0x031f('0x17'),require(_0x031f('0x18')));_0x526a45['use']('/api/voice/dials/reports',require(_0x031f('0x19')));_0x526a45[_0x031f('0x7')](_0x031f('0x1a'),require(_0x031f('0x1b')));_0x526a45['use'](_0x031f('0x1c'),require(_0x031f('0x1d')));_0x526a45['use'](_0x031f('0x1e'),require('./api/memberReport'));_0x526a45[_0x031f('0x7')](_0x031f('0x1f'),require(_0x031f('0x20')));_0x526a45[_0x031f('0x7')](_0x031f('0x21'),require(_0x031f('0x22')));_0x526a45[_0x031f('0x7')](_0x031f('0x23'),require(_0x031f('0x24')));_0x526a45[_0x031f('0x7')](_0x031f('0x25'),require('./api/mailAccount'));_0x526a45[_0x031f('0x7')](_0x031f('0x26'),require(_0x031f('0x27')));_0x526a45['use']('/api/mail/substatuses',require(_0x031f('0x28')));_0x526a45['use'](_0x031f('0x29'),require('./api/mailInteraction'));_0x526a45['use']('/api/mail/messages',require(_0x031f('0x2a')));_0x526a45[_0x031f('0x7')](_0x031f('0x2b'),require(_0x031f('0x2c')));_0x526a45['use'](_0x031f('0x2d'),require('./api/mailQueueReport'));_0x526a45[_0x031f('0x7')](_0x031f('0x2e'),require(_0x031f('0x2f')));_0x526a45['use'](_0x031f('0x30'),require(_0x031f('0x31')));_0x526a45['use'](_0x031f('0x32'),require(_0x031f('0x33')));_0x526a45[_0x031f('0x7')]('/api/fax/applications',require(_0x031f('0x34')));_0x526a45[_0x031f('0x7')](_0x031f('0x35'),require(_0x031f('0x36')));_0x526a45[_0x031f('0x7')](_0x031f('0x37'),require('./api/faxMessage'));_0x526a45[_0x031f('0x7')](_0x031f('0x38'),require(_0x031f('0x39')));_0x526a45[_0x031f('0x7')](_0x031f('0x3a'),require(_0x031f('0x3b')));_0x526a45[_0x031f('0x7')](_0x031f('0x3c'),require(_0x031f('0x3d')));_0x526a45[_0x031f('0x7')](_0x031f('0x3e'),require('./api/smsApplication'));_0x526a45[_0x031f('0x7')](_0x031f('0x3f'),require(_0x031f('0x40')));_0x526a45[_0x031f('0x7')](_0x031f('0x41'),require(_0x031f('0x42')));_0x526a45[_0x031f('0x7')](_0x031f('0x43'),require(_0x031f('0x44')));_0x526a45[_0x031f('0x7')](_0x031f('0x45'),require(_0x031f('0x46')));_0x526a45[_0x031f('0x7')]('/api/openchannel/applications',require(_0x031f('0x47')));_0x526a45[_0x031f('0x7')]('/api/openchannel/interactions',require(_0x031f('0x48')));_0x526a45[_0x031f('0x7')]('/api/openchannel/messages',require(_0x031f('0x49')));_0x526a45[_0x031f('0x7')](_0x031f('0x4a'),require(_0x031f('0x4b')));_0x526a45['use']('/api/chat/websites',require(_0x031f('0x4c')));_0x526a45['use'](_0x031f('0x4d'),require(_0x031f('0x4e')));_0x526a45[_0x031f('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x526a45[_0x031f('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x526a45[_0x031f('0x7')](_0x031f('0x4f'),require(_0x031f('0x50')));_0x526a45[_0x031f('0x7')](_0x031f('0x51'),require(_0x031f('0x52')));_0x526a45[_0x031f('0x7')]('/api/chat/queues',require(_0x031f('0x53')));_0x526a45[_0x031f('0x7')](_0x031f('0x54'),require(_0x031f('0x55')));_0x526a45['use'](_0x031f('0x56'),require(_0x031f('0x57')));_0x526a45[_0x031f('0x7')]('/api/cm/companies',require(_0x031f('0x58')));_0x526a45[_0x031f('0x7')]('/api/cm/contacts',require(_0x031f('0x59')));_0x526a45[_0x031f('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x526a45[_0x031f('0x7')](_0x031f('0x5a'),require(_0x031f('0x5b')));_0x526a45[_0x031f('0x7')](_0x031f('0x5c'),require(_0x031f('0x5d')));_0x526a45[_0x031f('0x7')]('/api/cm/hopper_history',require(_0x031f('0x5e')));_0x526a45[_0x031f('0x7')]('/api/cm/custom_fields',require(_0x031f('0x5f')));_0x526a45['use'](_0x031f('0x60'),require(_0x031f('0x61')));_0x526a45['use'](_0x031f('0x62'),require(_0x031f('0x63')));_0x526a45[_0x031f('0x7')]('/api/canned_answers',require(_0x031f('0x64')));_0x526a45[_0x031f('0x7')](_0x031f('0x65'),require(_0x031f('0x66')));_0x526a45[_0x031f('0x7')](_0x031f('0x67'),require(_0x031f('0x68')));_0x526a45[_0x031f('0x7')](_0x031f('0x69'),require('./api/interval'));_0x526a45[_0x031f('0x7')](_0x031f('0x6a'),require(_0x031f('0x6b')));_0x526a45[_0x031f('0x7')](_0x031f('0x6c'),require(_0x031f('0x6d')));_0x526a45[_0x031f('0x7')](_0x031f('0x6e'),require(_0x031f('0x6f')));_0x526a45['use'](_0x031f('0x70'),require('./api/schedule'));_0x526a45['use'](_0x031f('0x71'),require(_0x031f('0x72')));_0x526a45[_0x031f('0x7')](_0x031f('0x73'),require(_0x031f('0x74')));_0x526a45['use'](_0x031f('0x75'),require(_0x031f('0x76')));_0x526a45[_0x031f('0x7')]('/api/triggers',require(_0x031f('0x77')));_0x526a45[_0x031f('0x7')](_0x031f('0x78'),require(_0x031f('0x79')));_0x526a45[_0x031f('0x7')](_0x031f('0x7a'),require('./api/integration'));_0x526a45['use'](_0x031f('0x7b'),require('./api/integrationReport'));_0x526a45[_0x031f('0x7')](_0x031f('0x7c'),require('./api/analyticCustomReport'));_0x526a45[_0x031f('0x7')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x526a45[_0x031f('0x7')]('/api/analytics/extracted_reports',require(_0x031f('0x7d')));_0x526a45['use'](_0x031f('0x7e'),require(_0x031f('0x7f')));_0x526a45['use'](_0x031f('0x80'),require(_0x031f('0x81')));_0x526a45['use'](_0x031f('0x82'),require('./api/analyticTreeReport'));_0x526a45[_0x031f('0x7')]('/api/integrations/salesforce/accounts',require(_0x031f('0x83')));_0x526a45[_0x031f('0x7')](_0x031f('0x84'),require(_0x031f('0x85')));_0x526a45[_0x031f('0x7')]('/api/integrations/salesforce/fields',require(_0x031f('0x86')));_0x526a45['use'](_0x031f('0x87'),require(_0x031f('0x88')));_0x526a45['use'](_0x031f('0x89'),require(_0x031f('0x8a')));_0x526a45['use'](_0x031f('0x8b'),require(_0x031f('0x8c')));_0x526a45[_0x031f('0x7')]('/api/integrations/desk/accounts',require(_0x031f('0x8d')));_0x526a45['use'](_0x031f('0x8e'),require('./api/intDeskConfiguration'));_0x526a45[_0x031f('0x7')]('/api/integrations/desk/fields',require(_0x031f('0x8f')));_0x526a45[_0x031f('0x7')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x526a45[_0x031f('0x7')](_0x031f('0x90'),require('./api/intZohoConfiguration'));_0x526a45[_0x031f('0x7')](_0x031f('0x91'),require(_0x031f('0x92')));_0x526a45[_0x031f('0x7')](_0x031f('0x93'),require(_0x031f('0x94')));_0x526a45[_0x031f('0x7')](_0x031f('0x95'),require('./api/intZendeskConfiguration'));_0x526a45[_0x031f('0x7')](_0x031f('0x96'),require(_0x031f('0x97')));_0x526a45['use'](_0x031f('0x98'),require(_0x031f('0x99')));_0x526a45['use'](_0x031f('0x9a'),require(_0x031f('0x9b')));_0x526a45[_0x031f('0x7')](_0x031f('0x9c'),require('./api/intFreshdeskField'));_0x526a45['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x526a45[_0x031f('0x7')](_0x031f('0x9d'),require('./api/intVtigerConfiguration'));_0x526a45[_0x031f('0x7')](_0x031f('0x9e'),require('./api/intVtigerField'));_0x526a45[_0x031f('0x7')](_0x031f('0x9f'),require(_0x031f('0xa0')));_0x526a45[_0x031f('0x7')](_0x031f('0xa1'),require(_0x031f('0xa2')));_0x526a45[_0x031f('0x7')](_0x031f('0xa3'),require(_0x031f('0xa4')));_0x526a45['use'](_0x031f('0xa5'),require('./api/intDynamics365Account'));_0x526a45[_0x031f('0x7')](_0x031f('0xa6'),require(_0x031f('0xa7')));_0x526a45['use']('/api/integrations/dynamics365/fields',require(_0x031f('0xa8')));_0x526a45[_0x031f('0x7')](_0x031f('0xa9'),require(_0x031f('0xaa')));_0x526a45['use'](_0x031f('0xab'),require('./api/intFreshsalesConfiguration'));_0x526a45['use'](_0x031f('0xac'),require('./api/intFreshsalesField'));_0x526a45['use'](_0x031f('0xad'),require(_0x031f('0xae')));_0x526a45[_0x031f('0x7')](_0x031f('0xaf'),require(_0x031f('0xb0')));_0x526a45['use']('/api/chat/internal/messages',require(_0x031f('0xb1')));_0x526a45['use'](_0x031f('0xb2'),require(_0x031f('0xb3')));_0x526a45['use'](_0x031f('0xb4'),require(_0x031f('0xb5')));_0x526a45[_0x031f('0x7')](_0x031f('0xb6'),require(_0x031f('0xb7')));_0x526a45[_0x031f('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x526a45[_0x031f('0x7')](_0x031f('0xb8'),require(_0x031f('0xb9')));_0x526a45[_0x031f('0x7')](_0x031f('0xba'),require(_0x031f('0xbb')));_0x526a45[_0x031f('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x526a45['use']('/api/settings',require(_0x031f('0xbc')));_0x526a45[_0x031f('0x7')](_0x031f('0xbd'),require('./api/squareOdbc'));_0x526a45[_0x031f('0x7')](_0x031f('0xbe'),require('./api/squareProject'));_0x526a45[_0x031f('0x7')](_0x031f('0xbf'),require(_0x031f('0xc0')));_0x526a45[_0x031f('0x7')](_0x031f('0xc1'),require(_0x031f('0xc2')));_0x526a45[_0x031f('0x7')]('/api/teams',require('./api/team'));_0x526a45[_0x031f('0x7')]('/api/license',require(_0x031f('0xc3')));_0x526a45['use'](_0x031f('0xc4'),require(_0x031f('0xc5')));_0x526a45[_0x031f('0x7')]('/api/migrations',require(_0x031f('0xc6')));_0x526a45['use'](_0x031f('0xc7'),require(_0x031f('0xc8')));_0x526a45[_0x031f('0x7')]('/api/plugins',require(_0x031f('0xc9')));_0x526a45[_0x031f('0x7')](_0x031f('0xca'),require(_0x031f('0xcb')));_0x526a45[_0x031f('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x526a45[_0x031f('0x7')](_0x031f('0xcc'),require('./api/faxTransferReport'));_0x526a45[_0x031f('0x7')]('/api/openchannel/reports/transfer',require(_0x031f('0xcd')));_0x526a45[_0x031f('0x7')](_0x031f('0xce'),require(_0x031f('0xcf')));_0x526a45['use'](_0x031f('0xd0'),require(_0x031f('0xd1')));_0x526a45[_0x031f('0x7')]('/api/voice/prefixes',require(_0x031f('0xd2')));_0x526a45[_0x031f('0x7')]('/api/userProfiles',require(_0x031f('0xd3')));_0x526a45[_0x031f('0x7')](_0x031f('0xd4'),require(_0x031f('0xd5')));_0x526a45[_0x031f('0x7')](_0x031f('0xd6'),require(_0x031f('0xd7')));_0x526a45['use'](_0x031f('0xd8'),require(_0x031f('0xd9')));_0x526a45[_0x031f('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x526a45[_0x031f('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x526a45[_0x031f('0x7')](_0x031f('0xda'),require(_0x031f('0xdb')));_0x526a45[_0x031f('0x7')](_0x031f('0xdc'),require(_0x031f('0xdd')));_0x526a45[_0x031f('0x7')](_0x031f('0xde'),require(_0x031f('0xdf')));_0x526a45[_0x031f('0x7')](_0x031f('0xe0'),require('./api/whatsappTransferReport'));_0x526a45[_0x031f('0x7')](_0x031f('0xe1'),require(_0x031f('0xe2')));_0x526a45[_0x031f('0x7')]('/api/cloudProviders',require(_0x031f('0xe3')));_0x526a45['use']('/api/realtime',require(_0x031f('0xe4')));_0x526a45[_0x031f('0x7')]('/api/user-settings',require('./api/user-setting'));_0x526a45[_0x031f('0x7')](_0x031f('0xe5'),require(_0x031f('0xe6')));_0x526a45[_0x031f('0x7')](_0x031f('0xe7'),require(_0x031f('0xe8')));_0x526a45['use'](_0x031f('0xe9'),require(_0x031f('0xea')));_0x526a45['use'](_0x031f('0xeb'),require(_0x031f('0xec')));_0x526a45[_0x031f('0x7')](_0x031f('0xed'),require(_0x031f('0xee')));_0x526a45[_0x031f('0x7')](_0x031f('0xef'),require('./api/version'));_0x526a45[_0x031f('0x7')]('/api/system',require(_0x031f('0xf0')));_0x526a45[_0x031f('0x7')](_0x031f('0xf1'),require('./api/pm2'));_0x526a45['use']('/api/webbar',require(_0x031f('0xf2')));_0x526a45[_0x031f('0x7')](_0x031f('0xf3'),clientSideLogs);_0x526a45[_0x031f('0x7')](_0x031f('0xf4'),express[_0x031f('0xf5')](path[_0x031f('0xf6')](config['root'],'/apidoc')));_0x526a45[_0x031f('0x7')](_0x031f('0xf7'),express['static'](path[_0x031f('0xf6')](config['root'],_0x031f('0xf7'))));_0x526a45[_0x031f('0x7')]('/demo',express[_0x031f('0xf5')](path[_0x031f('0xf6')](config['root'],_0x031f('0xf8'))));_0x526a45[_0x031f('0x7')](_0x031f('0xf9'),express['static'](path[_0x031f('0xf6')](config[_0x031f('0xfa')],_0x031f('0xfb'),_0x031f('0xfc'))));_0x526a45[_0x031f('0x7')](_0x031f('0xfd'),express['static'](path[_0x031f('0xf6')](config[_0x031f('0xfa')],_0x031f('0xfe'))));_0x526a45[_0x031f('0xff')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x031f('0x100')](errors[0x194]);_0x526a45[_0x031f('0xff')]('/*')['get'](function(_0x2bd5fb,_0x18db89){_0x18db89[_0x031f('0x101')](path[_0x031f('0x102')](_0x526a45[_0x031f('0x100')](_0x031f('0x103'))+_0x031f('0x104')));});return _0x526a45;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b0f4e86..3493595 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab42=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xab42,0x161));var _0x2ab4=function(_0x356009,_0x16c06f){_0x356009=_0x356009-0x0;var _0x35abfc=_0xab42[_0x356009];return _0x35abfc;};'use strict';var jayson=require(_0x2ab4('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x2ab4('0x1')]=function(){return new Promise(function(_0x52aba1,_0x1b390c){var _0x5c4bda={};_0x5c4bda=_['merge'](_0x5c4bda,require('../api/user/user.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x4')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/voiceRecording/voiceRecording.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x5')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x6')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x7')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x8')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x9')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0xa')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0xb')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0xc')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0xd')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0xe')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0xf')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/mailInteraction/mailInteraction.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/mailMessage/mailMessage.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x10')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x11')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x12')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x13')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x14')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x15')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x16')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x17')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x18')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x19')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x1a')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x1b')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x1c')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x1d')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x1e')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x1f')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/chatMessage/chatMessage.rpc'));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x20')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x21')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x22')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x23')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x24')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x25')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x26')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/interval/interval.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x27')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x28')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x29')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x2a')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x2b')));_0x5c4bda=_['merge'](_0x5c4bda,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x2c')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x2d')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x2e')));_0x5c4bda=_['merge'](_0x5c4bda,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x2f')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x30')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x31')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x32')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x33')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x34')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x35')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x36')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x37')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x38')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x39')));_0x5c4bda=_['merge'](_0x5c4bda,require('../api/squareProject/squareProject.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3a')));_0x5c4bda=_['merge'](_0x5c4bda,require('../api/squareMessage/squareMessage.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require('../api/campaign/campaign.rpc'));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3b')));_0x5c4bda=_['merge'](_0x5c4bda,require(_0x2ab4('0x3c')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3d')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3e')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x3f')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x40')));_0x5c4bda=_[_0x2ab4('0x2')](_0x5c4bda,require(_0x2ab4('0x41')));var _0x5e73cc=jayson[_0x2ab4('0x42')](_0x5c4bda)[_0x2ab4('0x43')]();var _0x3ab396=config['rpc'][_0x2ab4('0x44')]||config[_0x2ab4('0x44')]+0x1;var _0x3fff99=config[_0x2ab4('0x45')]['ip']||_0x2ab4('0x46');_0x5e73cc['on'](_0x2ab4('0x47'),function(_0x6ccb4d){return _0x1b390c(_0x6ccb4d);});_0x5e73cc[_0x2ab4('0x1')](_0x3ab396,_0x3fff99,function(){console[_0x2ab4('0x48')](_0x2ab4('0x49'),_0x3fff99,_0x3ab396);require(_0x2ab4('0x4a'))[_0x2ab4('0x4b')]();return _0x52aba1('RPC\x20listening\x20on\x20'+_0x3fff99+':'+_0x3ab396);});});}; \ No newline at end of file +var _0xa344=['server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0xa344,0x17c));var _0x4a34=function(_0x44628d,_0x32b6d0){_0x44628d=_0x44628d-0x0;var _0x2518b8=_0xa344[_0x44628d];return _0x2518b8;};'use strict';var jayson=require(_0x4a34('0x0'));var _=require('lodash');var config=require(_0x4a34('0x1'));exports[_0x4a34('0x2')]=function(){return new Promise(function(_0x414693,_0x5e0bc7){var _0x135fcd={};_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x4')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x5')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x6')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x7')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x8')));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x9')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0xa')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0xb')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/memberReport/memberReport.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0xc')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0xd')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0xe')));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0xf')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x10')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/mailQueue/mailQueue.rpc'));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x11')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x12')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x13')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x14')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x15')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x16')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x17')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x18')));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x19')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x1a')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x1b')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/smsMessage/smsMessage.rpc'));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x1c')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x1d')));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x1e')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x1f')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x20')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/chatInteraction/chatInteraction.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x21')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x22')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x23')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x24')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x25')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x26')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x27')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x28')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x29')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x2a')));_0x135fcd=_['merge'](_0x135fcd,require('../api/template/template.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/trigger/trigger.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/variable/variable.rpc'));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x2b')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x2c')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x2d')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x2e')));_0x135fcd=_['merge'](_0x135fcd,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x2f')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x135fcd=_['merge'](_0x135fcd,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x30')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x31')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x32')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x33')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x34')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x35')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x36')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x37')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x38')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x39')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x3a')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x3b')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x3c')));_0x135fcd=_['merge'](_0x135fcd,require(_0x4a34('0x3d')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x3e')));_0x135fcd=_[_0x4a34('0x3')](_0x135fcd,require(_0x4a34('0x3f')));var _0x4c8183=jayson[_0x4a34('0x40')](_0x135fcd)[_0x4a34('0x41')]();var _0x510628=config[_0x4a34('0x42')][_0x4a34('0x43')]||config['port']+0x1;var _0x182c04=config[_0x4a34('0x42')]['ip']||_0x4a34('0x44');_0x4c8183['on'](_0x4a34('0x45'),function(_0x204014){return _0x5e0bc7(_0x204014);});_0x4c8183[_0x4a34('0x2')](_0x510628,_0x182c04,function(){console[_0x4a34('0x46')](_0x4a34('0x47'),_0x182c04,_0x510628);require('../config/triggers')[_0x4a34('0x48')]();return _0x414693(_0x4a34('0x49')+_0x182c04+':'+_0x510628);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c9b7904..546219b 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 _0x8f53=['length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','sendRequest','command','sync','prototype','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','exports','util','lodash','events','./error','call','setEncoding','utf8','setTimeout','headers','emit','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x8f53,0x128));var _0x38f5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f53[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x38f5('0x0'));var _=require(_0x38f5('0x1'));var EventEmitter=require(_0x38f5('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x38f5('0x3'));function AGIChannel(_0x2a5dbb){var _0x50c0b4=this,_0x5d954b=new AGIReply(),_0x589f05=![],_0xb0e89f={};EventEmitter[_0x38f5('0x4')](_0x50c0b4);_0x2a5dbb[_0x38f5('0x5')](_0x38f5('0x6'));_0x2a5dbb[_0x38f5('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5d954b[_0x38f5('0x5')](_0x38f5('0x6'));_0x5d954b['on'](_0x38f5('0x8'),function(_0x1e32af){for(var _0x4811bb in _0x1e32af){_0x50c0b4[_0x4811bb]=_0x1e32af[_0x4811bb];}_0x50c0b4[_0x38f5('0x9')]('ready');});_0x5d954b['on']('line',function(_0x3f490f){if(_0x3f490f[_0x38f5('0xa')]()==_0x38f5('0xb')){_0x50c0b4[_0x38f5('0x9')](_0x38f5('0xb'));return;}if(_0x3f490f[_0x38f5('0xc')](0x0,0xb)=='520-Invalid'){_0x589f05=!![];}if(_0x589f05){_0xb0e89f['rx']+=_0x3f490f+'\x0a';if(_0x3f490f[_0x38f5('0xd')](_0x38f5('0xe'))!=-0x1){_0x589f05=![];}}else{_0xb0e89f['rx']=_0x3f490f;}if(_0x589f05){return;}if(typeof _0xb0e89f['cb']==_0x38f5('0xf')){var _0x4b9404=_0xb0e89f['rx'][_0x38f5('0xc')](0x0,0x3),_0x1e9878=null,_0x21abed=null;_0x4b9404=parseInt(_0x4b9404);if(isNaN(_0x4b9404)){_0xb0e89f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x38f5('0x10')});return;}if(_0x4b9404!=0xc8){_0xb0e89f['cb'](null,{'code':_0x4b9404,'result':-0x1,'extra':'KO'});return;}_0x1e9878=_0xb0e89f['rx']['substring'](0x4)[_0x38f5('0x11')](_0x38f5('0x12'),'');if(_0x1e9878['indexOf']('\x20')!=-0x1){_0x1e9878=_0x1e9878[_0x38f5('0x13')](0x0,_0x1e9878['indexOf']('\x20'));}if(_['startsWith'](_0x1e9878,'-1')){_0x1e9878=parseInt(_0x1e9878);}_0x21abed=_0xb0e89f['rx']['split']('\x20');if(_0x21abed['length']==0x3){_0x21abed=_0x21abed[0x2][_0x38f5('0xc')](0x1,_0x21abed[0x2][_0x38f5('0x14')]-0x1);}else if(_0x21abed[_0x38f5('0x14')]>0x3){var _0x318535=/\((.+)\)/;var _0x35c7f8=_0xb0e89f['rx'][_0x38f5('0x15')](_0x318535);if(_0x35c7f8){_0x21abed=_0x35c7f8[0x1];}else{_0x21abed=null;}}else{_0x21abed=null;}_0xb0e89f['cb'](null,{'code':_0x4b9404,'result':_0x1e9878,'extra':_0x21abed});}});_0x2a5dbb['on'](_0x38f5('0x16'),function(_0xf707f){_0x50c0b4[_0x38f5('0x9')]('error',new AGIError(_0x38f5('0x17'),_0xf707f['code']));});_0x2a5dbb['on'](_0x38f5('0x18'),function(){_0x50c0b4['emit'](_0x38f5('0x18'),new AGIError(_0x38f5('0x19')));});_0x2a5dbb['on'](_0x38f5('0x1a'),function(){_0x50c0b4[_0x38f5('0x9')]('timeout',new AGIError(_0x38f5('0x1b')));_0x2a5dbb[_0x38f5('0x1c')]();});_0x2a5dbb[_0x38f5('0x1d')](_0x5d954b);this['command']=function(_0x5639ce,_0x18d6af){var _0x5639ce=_0x5639ce||'',_0x18d6af=typeof _0x18d6af=='function'?_0x18d6af:new Function();_0xb0e89f={'tx':_0x5639ce,'rx':'','cb':_0x18d6af};_0x2a5dbb[_0x38f5('0x1e')](_0x5639ce+'\x0a');},this[_0x38f5('0x18')]=function(){_0x2a5dbb[_0x38f5('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x38f5('0x1f')]=function(_0x1d8fb5){return this[_0x38f5('0x20')][_0x38f5('0x21')](this,_0x1d8fb5);};AGIChannel[_0x38f5('0x22')]['answer']=function(){return this[_0x38f5('0x1f')](_0x38f5('0x23'));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x24')]=function(_0x1b611d,_0x4cb036,_0x3610f3){_0x1b611d=_0x1b611d===undefined?_0x38f5('0x25'):_0x1b611d;_0x4cb036=_0x4cb036===undefined?'5':_0x4cb036;_0x3610f3=_0x3610f3===undefined?'1':_0x3610f3;return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x27'),_0x1b611d,_0x4cb036*0x3e8,_0x3610f3));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x28')]=function(_0x647652){_0x647652=_0x647652||_0x38f5('0x29');return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x2a'),_0x647652));};AGIChannel[_0x38f5('0x22')]['exec']=function(_0x37fd03,_0x341e30){if(_[_0x38f5('0x2b')](_0x341e30)){return this['sendRequest'](util[_0x38f5('0x26')](_0x38f5('0x2c'),_0x37fd03,_0x341e30[_0x38f5('0x2d')](',')));}return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x2c'),_0x37fd03,_0x341e30));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x2e')]=function(_0x592610){return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x2f'),_0x592610));};AGIChannel['prototype'][_0x38f5('0x30')]=function(_0x2b4fd4){return this['sendRequest'](util[_0x38f5('0x26')](_0x38f5('0x31'),_0x2b4fd4));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x32')]=function(_0x434a2b){return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x33'),_0x434a2b));};AGIChannel[_0x38f5('0x22')]['hangup']=function(){return this['sendRequest'](_0x38f5('0x34'));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x35')]=function(_0x46ddee,_0x48f528){var _0x5cd29f=_['isBoolean'](_0x48f528)||_[_0x38f5('0x36')](_0x48f528)?_0x48f528['toString']():_0x48f528;return this['sendRequest'](util[_0x38f5('0x26')](_0x38f5('0x37'),_0x46ddee,_0x5cd29f?_0x5cd29f[_0x38f5('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x39')]=function(_0x9e402b,_0x46c7f5){return this[_0x38f5('0x1f')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x9e402b,_0x46c7f5));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x3a')]=function(_0x5baa42,_0x204824){return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x3b'),_0x5baa42,_0x204824));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x3c')]=function(_0x4e4913,_0x4b7f0b){return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x3d'),_0x4e4913,_0x4b7f0b));};AGIChannel['prototype'][_0x38f5('0x3e')]=function(_0x3ba677,_0x5711ed,_0x4d7c8b){_0x5711ed=_0x5711ed||this[_0x38f5('0x3f')];_0x4d7c8b=_0x4d7c8b||0x1;this[_0x38f5('0x2e')](_0x3ba677);this[_0x38f5('0x30')](_0x5711ed);this[_0x38f5('0x32')](_0x4d7c8b);return this[_0x38f5('0x28')](util[_0x38f5('0x26')](_0x38f5('0x40'),_0x3ba677,_0x5711ed,_0x4d7c8b));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x41')]=function(_0x26d21f){return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x42'),_0x26d21f));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x43')]=function(_0x847a5f,_0x5546aa,_0x1e7653,_0x118daf,_0x1a5775,_0x3a54a6){_0x5546aa=_0x5546aa||_0x38f5('0x44');_0x1e7653=_0x1e7653||'';_0x118daf=_0x118daf===undefined?-0x1:_0x118daf==='-1'?-0x1:_0x118daf*0x3e8;_0x1a5775=_0x1a5775===undefined?'':'s='+_0x1a5775;_0x3a54a6=_0x3a54a6?_0x38f5('0x45'):'';return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x46'),_0x847a5f,_0x5546aa,_0x1e7653,_0x118daf,_0x3a54a6,_0x1a5775));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x47')]=function(_0x5ee248,_0x375908){_0x375908=_0x375908||'';return this[_0x38f5('0x1f')](util[_0x38f5('0x26')](_0x38f5('0x48'),_0x5ee248,_0x375908));};AGIChannel[_0x38f5('0x22')][_0x38f5('0x49')]=function(_0x25c37c){return this[_0x38f5('0x4a')](_0x38f5('0x4b'),_0x25c37c);};AGIChannel[_0x38f5('0x22')][_0x38f5('0x4c')]=function(_0x5ec66e){return this[_0x38f5('0x4a')](_0x38f5('0x4d'),_0x5ec66e);};AGIChannel[_0x38f5('0x22')][_0x38f5('0x16')]=function(_0x400ff3,_0x599e1a){this[_0x38f5('0x28')](util[_0x38f5('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x400ff3['id'],_0x400ff3['label'],_0x599e1a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x38f5('0x4e')]=AGIChannel; \ No newline at end of file +var _0x4540=['sendRequest','getData','beep','format','noop','NO\x20MESSAGE','exec','isArray','join','setContext','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','getVariable','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','exports','util','lodash','./error','call','setEncoding','setTimeout','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','search','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype'];(function(_0x48866b,_0x3a9140){var _0x10119a=function(_0x34236f){while(--_0x34236f){_0x48866b['push'](_0x48866b['shift']());}};_0x10119a(++_0x3a9140);}(_0x4540,0x17b));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0454('0x0'));var _=require(_0x0454('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0454('0x2'));function AGIChannel(_0x51c214){var _0x2f2949=this,_0x3e3d5e=new AGIReply(),_0x111964=![],_0x10cede={};EventEmitter[_0x0454('0x3')](_0x2f2949);_0x51c214[_0x0454('0x4')]('utf8');_0x51c214[_0x0454('0x5')](0x8*0x3c*0x3c*0x3e8);_0x3e3d5e['setEncoding'](_0x0454('0x6'));_0x3e3d5e['on']('headers',function(_0x17cd35){for(var _0x54f288 in _0x17cd35){_0x2f2949[_0x54f288]=_0x17cd35[_0x54f288];}_0x2f2949[_0x0454('0x7')](_0x0454('0x8'));});_0x3e3d5e['on'](_0x0454('0x9'),function(_0x4d1339){if(_0x4d1339[_0x0454('0xa')]()==_0x0454('0xb')){_0x2f2949[_0x0454('0x7')](_0x0454('0xb'));return;}if(_0x4d1339['substring'](0x0,0xb)==_0x0454('0xc')){_0x111964=!![];}if(_0x111964){_0x10cede['rx']+=_0x4d1339+'\x0a';if(_0x4d1339[_0x0454('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x111964=![];}}else{_0x10cede['rx']=_0x4d1339;}if(_0x111964){return;}if(typeof _0x10cede['cb']=='function'){var _0x4f75f0=_0x10cede['rx'][_0x0454('0xe')](0x0,0x3),_0x33294a=null,_0x532ca6=null;_0x4f75f0=parseInt(_0x4f75f0);if(isNaN(_0x4f75f0)){_0x10cede['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4f75f0!=0xc8){_0x10cede['cb'](null,{'code':_0x4f75f0,'result':-0x1,'extra':'KO'});return;}_0x33294a=_0x10cede['rx'][_0x0454('0xe')](0x4)[_0x0454('0xf')](_0x0454('0x10'),'');if(_0x33294a[_0x0454('0x11')]('\x20')!=-0x1){_0x33294a=_0x33294a[_0x0454('0x12')](0x0,_0x33294a[_0x0454('0x11')]('\x20'));}if(_[_0x0454('0x13')](_0x33294a,'-1')){_0x33294a=parseInt(_0x33294a);}_0x532ca6=_0x10cede['rx'][_0x0454('0x14')]('\x20');if(_0x532ca6[_0x0454('0x15')]==0x3){_0x532ca6=_0x532ca6[0x2]['substring'](0x1,_0x532ca6[0x2][_0x0454('0x15')]-0x1);}else if(_0x532ca6[_0x0454('0x15')]>0x3){var _0x3d97ec=/\((.+)\)/;var _0x25d141=_0x10cede['rx'][_0x0454('0x16')](_0x3d97ec);if(_0x25d141){_0x532ca6=_0x25d141[0x1];}else{_0x532ca6=null;}}else{_0x532ca6=null;}_0x10cede['cb'](null,{'code':_0x4f75f0,'result':_0x33294a,'extra':_0x532ca6});}});_0x51c214['on']('error',function(_0x2a8ce2){_0x2f2949[_0x0454('0x7')](_0x0454('0x17'),new AGIError(_0x0454('0x18'),_0x2a8ce2['code']));});_0x51c214['on'](_0x0454('0x19'),function(){_0x2f2949[_0x0454('0x7')]('close',new AGIError(_0x0454('0x1a')));});_0x51c214['on']('timeout',function(){_0x2f2949['emit']('timeout',new AGIError(_0x0454('0x1b')));_0x51c214[_0x0454('0x1c')]();});_0x51c214[_0x0454('0x1d')](_0x3e3d5e);this[_0x0454('0x1e')]=function(_0x1a491c,_0xdb87d5){var _0x1a491c=_0x1a491c||'',_0xdb87d5=typeof _0xdb87d5==_0x0454('0x1f')?_0xdb87d5:new Function();_0x10cede={'tx':_0x1a491c,'rx':'','cb':_0xdb87d5};_0x51c214[_0x0454('0x20')](_0x1a491c+'\x0a');},this[_0x0454('0x19')]=function(){_0x51c214['destroy']();};}util[_0x0454('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x0454('0x22')][_0x0454('0x23')]=function(_0x2c6386){return this[_0x0454('0x1e')]['sync'](this,_0x2c6386);};AGIChannel[_0x0454('0x22')]['answer']=function(){return this[_0x0454('0x23')]('ANSWER');};AGIChannel[_0x0454('0x22')][_0x0454('0x24')]=function(_0x3f44e9,_0xdbd7a,_0x4e81e9){_0x3f44e9=_0x3f44e9===undefined?_0x0454('0x25'):_0x3f44e9;_0xdbd7a=_0xdbd7a===undefined?'5':_0xdbd7a;_0x4e81e9=_0x4e81e9===undefined?'1':_0x4e81e9;return this[_0x0454('0x23')](util[_0x0454('0x26')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3f44e9,_0xdbd7a*0x3e8,_0x4e81e9));};AGIChannel[_0x0454('0x22')][_0x0454('0x27')]=function(_0x22b55b){_0x22b55b=_0x22b55b||_0x0454('0x28');return this['sendRequest'](util[_0x0454('0x26')]('VERBOSE\x20\x22%s\x22',_0x22b55b));};AGIChannel[_0x0454('0x22')][_0x0454('0x29')]=function(_0x2b79d4,_0x4fc646){if(_[_0x0454('0x2a')](_0x4fc646)){return this['sendRequest'](util[_0x0454('0x26')]('EXEC\x20%s\x20%s',_0x2b79d4,_0x4fc646[_0x0454('0x2b')](',')));}return this[_0x0454('0x23')](util['format']('EXEC\x20%s\x20%s',_0x2b79d4,_0x4fc646));};AGIChannel['prototype'][_0x0454('0x2c')]=function(_0x2bdb14){return this[_0x0454('0x23')](util[_0x0454('0x26')]('SET\x20CONTEXT\x20%s',_0x2bdb14));};AGIChannel['prototype'][_0x0454('0x2d')]=function(_0x377a09){return this[_0x0454('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x377a09));};AGIChannel[_0x0454('0x22')]['setPriority']=function(_0x304ec3){return this[_0x0454('0x23')](util[_0x0454('0x26')](_0x0454('0x2e'),_0x304ec3));};AGIChannel[_0x0454('0x22')][_0x0454('0xb')]=function(){return this[_0x0454('0x23')](_0x0454('0x2f'));};AGIChannel[_0x0454('0x22')][_0x0454('0x30')]=function(_0x2fd183,_0x2a6a61){var _0x5346d9=_['isBoolean'](_0x2a6a61)||_[_0x0454('0x31')](_0x2a6a61)?_0x2a6a61[_0x0454('0x32')]():_0x2a6a61;return this[_0x0454('0x23')](util[_0x0454('0x26')](_0x0454('0x33'),_0x2fd183,_0x5346d9?_0x5346d9[_0x0454('0x32')]()[_0x0454('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0454('0x22')][_0x0454('0x34')]=function(_0x5597ed,_0x1774cc){return this[_0x0454('0x23')](util[_0x0454('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x5597ed,_0x1774cc));};AGIChannel[_0x0454('0x22')][_0x0454('0x35')]=function(_0x41c7ed,_0x35fbe3){return this[_0x0454('0x23')](util[_0x0454('0x26')](_0x0454('0x36'),_0x41c7ed,_0x35fbe3));};AGIChannel[_0x0454('0x22')][_0x0454('0x37')]=function(_0x34597f,_0x3cf94b){return this[_0x0454('0x23')](util['format'](_0x0454('0x38'),_0x34597f,_0x3cf94b));};AGIChannel['prototype'][_0x0454('0x39')]=function(_0x48b191,_0x31a78c,_0x3fbdd1){_0x31a78c=_0x31a78c||this[_0x0454('0x3a')];_0x3fbdd1=_0x3fbdd1||0x1;this['setContext'](_0x48b191);this[_0x0454('0x2d')](_0x31a78c);this[_0x0454('0x3b')](_0x3fbdd1);return this[_0x0454('0x27')](util[_0x0454('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x48b191,_0x31a78c,_0x3fbdd1));};AGIChannel[_0x0454('0x22')][_0x0454('0x3c')]=function(_0x2812b9){return this['sendRequest'](util[_0x0454('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x2812b9));};AGIChannel['prototype']['recordFile']=function(_0x5687af,_0x5058e3,_0xea58ac,_0x1cec47,_0xeaf0e8,_0x2e9224){_0x5058e3=_0x5058e3||_0x0454('0x3d');_0xea58ac=_0xea58ac||'';_0x1cec47=_0x1cec47===undefined?-0x1:_0x1cec47==='-1'?-0x1:_0x1cec47*0x3e8;_0xeaf0e8=_0xeaf0e8===undefined?'':'s='+_0xeaf0e8;_0x2e9224=_0x2e9224?_0x0454('0x3e'):'';return this['sendRequest'](util['format'](_0x0454('0x3f'),_0x5687af,_0x5058e3,_0xea58ac,_0x1cec47,_0x2e9224,_0xeaf0e8));};AGIChannel[_0x0454('0x22')]['streamFile']=function(_0x33229c,_0x2bc57f){_0x2bc57f=_0x2bc57f||'';return this[_0x0454('0x23')](util[_0x0454('0x26')](_0x0454('0x40'),_0x33229c,_0x2bc57f));};AGIChannel[_0x0454('0x22')]['agi']=function(_0x1fa3c3){return this[_0x0454('0x29')](_0x0454('0x41'),_0x1fa3c3);};AGIChannel[_0x0454('0x22')][_0x0454('0x42')]=function(_0x123c98){return this[_0x0454('0x29')](_0x0454('0x43'),_0x123c98);};AGIChannel[_0x0454('0x22')][_0x0454('0x17')]=function(_0x3816f3,_0x95961){this[_0x0454('0x27')](util[_0x0454('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3816f3['id'],_0x3816f3['label'],_0x95961));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0454('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 429ac7e..f200d66 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 _0xa442=['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.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa442,0x78));var _0x2a44=function(_0x51d2df,_0x8e611e){_0x51d2df=_0x51d2df-0x0;var _0x1f0504=_0xa442[_0x51d2df];return _0x1f0504;};'use strict';var util=require(_0x2a44('0x0'));var error={'E_AGI_UNDEFINED':_0x2a44('0x1'),'E_AGI_ARGUMENT_PORT':_0x2a44('0x2'),'E_AGI_SERVER_ERROR':_0x2a44('0x3'),'E_AGI_SERVER_CLOSE':_0x2a44('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x2a44('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x2a44('0x6'),'E_AGI_SOCKET_CLOSE':_0x2a44('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x2a44('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2a44('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x599ff9){var _0x599ff9=_0x599ff9||null,_0x3b718e=_0x3b718e||[],_0x5cd981=0x1,_0x3a5891='';if(!error[_0x599ff9]){_0x599ff9=_0x2a44('0xa');}_0x3b718e['push'](error[_0x599ff9]);while(arguments[_0x5cd981]){_0x3b718e[_0x2a44('0xb')](arguments[_0x5cd981]);_0x5cd981++;}_0x3a5891=util[_0x2a44('0xc')][_0x2a44('0xd')](util,_0x3b718e);this[_0x2a44('0xe')]=_0x3a5891;this[_0x2a44('0xf')]=_0x599ff9;}module[_0x2a44('0x10')]=AGIError; \ No newline at end of file +var _0x32be=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','E_AGI_UNDEFINED','push','apply','message','name','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0xc9396b,_0x734ceb){var _0x56d6ee=function(_0x2456c0){while(--_0x2456c0){_0xc9396b['push'](_0xc9396b['shift']());}};_0x56d6ee(++_0x734ceb);}(_0x32be,0x1dd));var _0xe32b=function(_0x5a5ffb,_0x3aaf44){_0x5a5ffb=_0x5a5ffb-0x0;var _0x12d821=_0x32be[_0x5a5ffb];return _0x12d821;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xe32b('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xe32b('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe32b('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xe32b('0x3'),'E_AGI_SOCKET_ERROR':_0xe32b('0x4'),'E_AGI_SOCKET_CLOSE':_0xe32b('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe32b('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3738e1){var _0x3738e1=_0x3738e1||null,_0x233f96=_0x233f96||[],_0x139bee=0x1,_0x3898ce='';if(!error[_0x3738e1]){_0x3738e1=_0xe32b('0x7');}_0x233f96[_0xe32b('0x8')](error[_0x3738e1]);while(arguments[_0x139bee]){_0x233f96[_0xe32b('0x8')](arguments[_0x139bee]);_0x139bee++;}_0x3898ce=util['format'][_0xe32b('0x9')](util,_0x233f96);this[_0xe32b('0xa')]=_0x3898ce;this[_0xe32b('0xb')]=_0x3738e1;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9d7b09d..fe06e46 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 _0x2b2d=['prototype','push','numberOfEdges','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','addVertex'];(function(_0x2ae536,_0x44d3bf){var _0x4e90d2=function(_0x52ec95){while(--_0x52ec95){_0x2ae536['push'](_0x2ae536['shift']());}};_0x4e90d2(++_0x44d3bf);}(_0x2b2d,0x142));var _0xd2b2=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x2b2d[_0x54fc1f];return _0x53f699;};'use strict';var _=require('lodash');var logger=require(_0xd2b2('0x0'))(_0xd2b2('0x1'));var verticesWithRetry=[_0xd2b2('0x2'),_0xd2b2('0x3'),_0xd2b2('0x4')];var Graph=function(){this[_0xd2b2('0x5')]={};this[_0xd2b2('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0xd2b2('0x7')]=function(_0x58969d){this[_0xd2b2('0x5')][_0x58969d['id']]=_0x58969d;this[_0xd2b2('0x6')][_0x58969d['id']]=[];};Graph[_0xd2b2('0x8')]['addEdge']=function(_0x21b4c1,_0x417e80,_0x43e79a){this[_0xd2b2('0x6')][_0x21b4c1][_0xd2b2('0x9')]({'target':_0x417e80,'condition':_0x43e79a});this[_0xd2b2('0xa')]+=0x1;};Graph['prototype'][_0xd2b2('0xb')]=function(){return _[_0xd2b2('0xb')](this[_0xd2b2('0x5')]);};Graph['prototype'][_0xd2b2('0xc')]=function(){return this[_0xd2b2('0xa')];};Graph[_0xd2b2('0x8')]['getVertex']=function(_0x10d261){return this[_0xd2b2('0x5')][_0x10d261];};Graph[_0xd2b2('0x8')][_0xd2b2('0xd')]=function(_0x265d9c,_0x304ad7){if(!this[_0xd2b2('0x5')][_0x265d9c]){return logger[_0xd2b2('0xe')](_0xd2b2('0xf'));}var _0x1e99c1=_0x304ad7(this[_0xd2b2('0x5')][_0x265d9c]);if(!_0x1e99c1){return logger[_0xd2b2('0xe')](_0xd2b2('0x10'));}if(this[_0xd2b2('0x6')][_0x265d9c][_0xd2b2('0x11')]===0x0){return logger[_0xd2b2('0xe')](_0xd2b2('0x12'));}for(var _0x43c457=0x0,_0x2b29cf=[],_0xe24b9b=![];_0x43c457\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','127.0.0.1','nextTick','error','stack','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','indexOf','agi_','inspect','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','stringify','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found'];(function(_0x5a7e61,_0x1d66ae){var _0x5a7b41=function(_0x3585d5){while(--_0x3585d5){_0x5a7e61['push'](_0x5a7e61['shift']());}};_0x5a7b41(++_0x1d66ae);}(_0xa18c,0xbd));var _0xca18=function(_0x4a944e,_0x194c7f){_0x4a944e=_0x4a944e-0x0;var _0x335e8d=_0xa18c[_0x4a944e];return _0x335e8d;};'use strict';var parser=require(_0xca18('0x0'));var _=require(_0xca18('0x1'));var syncho=require(_0xca18('0x2'));var util=require(_0xca18('0x3'));var moment=require(_0xca18('0x4'));var config=require('../../config/environment');var logger=require(_0xca18('0x5'))(_0xca18('0x6'));var utilLicense=require(_0xca18('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xca18('0x8'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xca18('0x6')]=_['defaults'](config[_0xca18('0x6')],{'ip':_0xca18('0x9'),'port':0x11dd});function connectionHandler(_0xc49ac8){process[_0xca18('0xa')](function(){syncho(function(){try{setChannelVariables(_0xc49ac8);agiHandler(_0xc49ac8);}catch(_0x4a2246){logger[_0xca18('0xb')](_0x4a2246[_0xca18('0xc')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xca18('0x6')][_0xca18('0xd')]);logger[_0xca18('0xe')](util[_0xca18('0xf')](_0xca18('0x10'),config['agi']['ip'],config[_0xca18('0x6')]['port']));}function errorHandler(_0x9db1f7){if(_0x9db1f7&&_0x9db1f7[_0xca18('0x11')]&&_0x9db1f7['message']){logger['error'](util['format'](_0xca18('0x12'),_0x9db1f7['name'],_0x9db1f7['message']));}else{logger[_0xca18('0xb')](util[_0xca18('0xf')](_0xca18('0x13'),_0x9db1f7[_0xca18('0xc')]));}}function closeHandler(){logger[_0xca18('0xe')](util['format'](_0xca18('0x14'),this[_0xca18('0x15')],this[_0xca18('0x16')],this['callerid'],this['dnid'],this[_0xca18('0x17')]));try{createSquareReport(this);}catch(_0x38af28){logger[_0xca18('0xb')](_0x38af28[_0xca18('0xc')]);}}function timeoutHandler(){logger[_0xca18('0xe')](util[_0xca18('0xf')](_0xca18('0x18'),this[_0xca18('0x15')],this[_0xca18('0x16')],this[_0xca18('0x19')],this['dnid'],this[_0xca18('0x17')]));}function hangupHandler(){logger[_0xca18('0xe')](util[_0xca18('0xf')](_0xca18('0x1a'),this['arg_1'],this[_0xca18('0x16')],this[_0xca18('0x19')],this[_0xca18('0x1b')],this[_0xca18('0x17')]));this['evtHangup']=!![];}function getRoot(_0x259ad4){return parser[_0xca18('0x1c')](_0x259ad4,{'object':!![]})[_0xca18('0x1d')][_0xca18('0x1e')];}function addVertex(_0x3f4efc,_0x1ecc66,_0x42b721){_0x1ecc66[_0xca18('0x1f')]=_0x42b721;if(_0x1ecc66[_0xca18('0x20')](_0xca18('0x21'))){_0x1ecc66[_0xca18('0x22')]=parseInt(_0x1ecc66[_0xca18('0x21')],0xa);}_0x3f4efc[_0xca18('0x23')](_[_0xca18('0x24')](_0x1ecc66,_0xca18('0x25')));}function initGraph(_0x4b867c,_0x2ffd86){var _0x4b6510=new Graph();for(var _0x26040a in _0x4b867c){if(_0x4b867c['hasOwnProperty'](_0x26040a)){if(_[_0xca18('0x26')](_0x4b867c[_0x26040a])){for(var _0x2daffc=0x0;_0x2daffc<_0x4b867c[_0x26040a][_0xca18('0x27')];_0x2daffc+=0x1){addVertex(_0x4b6510,_0x4b867c[_0x26040a][_0x2daffc],_0x26040a);}}else{addVertex(_0x4b6510,_0x4b867c[_0x26040a],_0x26040a);}}}for(var _0x8dbb47=0x0;_0x8dbb47<_0x2ffd86[_0xca18('0x27')];_0x8dbb47+=0x1){if(_0x2ffd86[_0x8dbb47][_0xca18('0x28')]&&_0x2ffd86[_0x8dbb47][_0xca18('0x29')]){_0x4b6510[_0xca18('0x2a')](_0x2ffd86[_0x8dbb47][_0xca18('0x28')],_0x2ffd86[_0x8dbb47][_0xca18('0x29')],_0x2ffd86[_0x8dbb47][_0xca18('0x2b')]);}}return _0x4b6510;}function getSquareProject(_0x7ca971,_0x1b8e33){rpc[_0xca18('0x2c')](_0x7ca971)[_0xca18('0x2d')](function(_0x54d2fe){_0x1b8e33(null,_0x54d2fe);})['catch'](function(_0x3e4765){_0x1b8e33(null,_0x3e4765);});}function createSquareReport(_0x2e671c,_0x456be7){rpc[_0xca18('0x2e')](_0x2e671c)[_0xca18('0x2d')](function(_0x218fe5){if(_0x456be7){_0x456be7(null,_0x218fe5);}})['catch'](function(_0xff55bf){if(_0x456be7){_0x456be7(null,_0xff55bf);}});}function setChannelVariables(_0x1efeeb){for(var _0x36bb89 in _0x1efeeb){if(_0x1efeeb['hasOwnProperty'](_0x36bb89)){if(_0x36bb89[_0xca18('0x2f')](_0xca18('0x30'))===0x0){_0x1efeeb[_0x36bb89['substring'](0x4)]=_0x1efeeb[_0x36bb89];delete _0x1efeeb[_0x36bb89];}}}}function getLogFromObject(_0x1f716c){return util[_0xca18('0x31')](_0x1f716c,{'showHidden':![],'depth':null});}function agiHandler(_0x5901b9){var _0x4dd6cc,_0x402e35,_0x44b0dc,_0x13e210,_0x52ada5;logger[_0xca18('0x32')]('variables',JSON['stringify'](_0x5901b9,null,0x2));logger[_0xca18('0xe')](util['format'](_0xca18('0x33'),_0x5901b9[_0xca18('0x15')],_0x5901b9['calleridname'],_0x5901b9[_0xca18('0x19')],_0x5901b9[_0xca18('0x1b')],_0x5901b9[_0xca18('0x17')]));_0x5901b9['on']('error',errorHandler);_0x5901b9['on'](_0xca18('0x34'),closeHandler);_0x5901b9['on'](_0xca18('0x35'),timeoutHandler);_0x5901b9[_0xca18('0x36')]=![];_0x5901b9['on'](_0xca18('0x37'),hangupHandler);var _0x49fb44=getSquareProject[_0xca18('0x38')](null,_0x5901b9[_0xca18('0x15')]);if(_0x49fb44){if(_0x49fb44[_0xca18('0x39')]){_0x4dd6cc=getRoot(_0x49fb44['production']);if(_0x4dd6cc&&_0x4dd6cc[_0xca18('0x3a')]){logger[_0xca18('0x32')](_0xca18('0x1e'),JSON[_0xca18('0x3b')](_0x4dd6cc,null,0x2));_0x5901b9[_0xca18('0x3c')]=moment()[_0xca18('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x402e35=initGraph(_[_0xca18('0x24')](_0x4dd6cc,_0xca18('0x25')),_0x4dd6cc[_0xca18('0x25')]);_0x44b0dc=new Vertices(_0x5901b9,rpc,mailRpc);logger['info'](util[_0xca18('0xf')](_0xca18('0x3d'),_0x5901b9[_0xca18('0x15')],_0x5901b9[_0xca18('0x16')],_0x5901b9['callerid'],_0x5901b9['dnid'],_0x5901b9[_0xca18('0x17')]));_0x402e35[_0xca18('0x3e')](_0x4dd6cc[_0xca18('0x3a')]['id'],function(_0x1e1ffd){try{_0x1e1ffd=_0x44b0dc[_0xca18('0x3f')](_0x1e1ffd);logger[_0xca18('0x32')]('vertex',JSON[_0xca18('0x3b')](_0x1e1ffd,null,0x2));if(_0x1e1ffd[_0xca18('0x1f')]===_0xca18('0x40')){logger[_0xca18('0xe')](_0xca18('0x41'));_0x5901b9['context']=_0x1e1ffd[_0xca18('0x42')]||_0x5901b9[_0xca18('0x42')];_0x5901b9[_0xca18('0x43')]=_0x1e1ffd[_0xca18('0x43')];_0x5901b9['priority']=_0x1e1ffd['priority']?_0x1e1ffd[_0xca18('0x44')]-0x1:0x1;return null;}else if(_0x1e1ffd&&_0x44b0dc[_0x1e1ffd[_0xca18('0x1f')]]){_0x52ada5=_0x44b0dc[_0x1e1ffd[_0xca18('0x1f')]](_0x1e1ffd);logger['info'](_0xca18('0x45'),JSON['stringify'](_0x52ada5,null,0x2));if(_0x52ada5&&_0x52ada5[_0xca18('0x46')]===AGI_CODE_SUCCESS&&_0x52ada5[_0xca18('0x47')]!==AGI_RESULT_ERROR&&!_0x5901b9[_0xca18('0x36')]){logger[_0xca18('0x32')](_0xca18('0x45'),getLogFromObject(_0x52ada5));return _[_0xca18('0x48')](_0x52ada5['result'])?null:_0x52ada5[_0xca18('0x47')][_0xca18('0x49')]();}else{logger[_0xca18('0xb')](_0xca18('0x45'),getLogFromObject(_0x52ada5));return null;}}else{logger[_0xca18('0xb')](_0xca18('0x4a'));return null;}}catch(_0xf9b5cc){logger[_0xca18('0xb')](_0xf9b5cc[_0xca18('0xc')]);return null;}});if(_0x4dd6cc[_0xca18('0x4b')]){logger[_0xca18('0xe')](util['format'](_0xca18('0x4c'),_0x5901b9[_0xca18('0x15')],_0x5901b9[_0xca18('0x16')],_0x5901b9[_0xca18('0x19')],_0x5901b9[_0xca18('0x1b')],_0x5901b9['uniqueid']));_0x402e35[_0xca18('0x3e')](_0x4dd6cc[_0xca18('0x4b')]['id'],function(_0x32ea06){try{_0x32ea06=_0x44b0dc['clear'](_0x32ea06);logger[_0xca18('0x32')]('vertex',JSON[_0xca18('0x3b')](_0x32ea06,null,0x2));if(_0x32ea06&&_0x44b0dc[_0x32ea06[_0xca18('0x1f')]]){_0x52ada5=_0x44b0dc[_0x32ea06[_0xca18('0x1f')]](_0x32ea06);if(_0x52ada5){logger[_0xca18('0x32')](_0xca18('0x45'),getLogFromObject(_0x52ada5));return _[_0xca18('0x48')](_0x52ada5['result'])?null:_0x52ada5[_0xca18('0x47')][_0xca18('0x49')]();}else{logger[_0xca18('0xb')](_0xca18('0x45'),getLogFromObject(_0x52ada5));return null;}}else{logger[_0xca18('0xb')](_0xca18('0x4a'));return null;}}catch(_0x534486){logger['error'](_0x534486[_0xca18('0xc')]);return null;}});}logger[_0xca18('0xe')](util[_0xca18('0xf')](_0xca18('0x4d'),_0x5901b9[_0xca18('0x15')],_0x5901b9[_0xca18('0x16')],_0x5901b9[_0xca18('0x19')],_0x5901b9[_0xca18('0x1b')],_0x5901b9['uniqueid']));logger['info'](util[_0xca18('0xf')](_0xca18('0x4e'),_0x5901b9[_0xca18('0x42')],_0x5901b9[_0xca18('0x43')],parseInt(_0x5901b9[_0xca18('0x44')],0xa)+0x1));_0x5901b9[_0xca18('0x4f')](_0x5901b9[_0xca18('0x42')],_0x5901b9[_0xca18('0x43')],parseInt(_0x5901b9['priority'],0xa)+0x1);_0x5901b9[_0xca18('0x34')]();}}else{logger[_0xca18('0xb')](util['format']('Project\x20%s\x20not\x20published',_0x5901b9[_0xca18('0x15')]));_0x5901b9[_0xca18('0x4f')](_0x5901b9[_0xca18('0x42')],_0x5901b9[_0xca18('0x43')],parseInt(_0x5901b9['priority'],0xa)+0x1);_0x5901b9[_0xca18('0x34')]();}}else{logger[_0xca18('0xb')](util[_0xca18('0xf')](_0xca18('0x50'),_0x5901b9[_0xca18('0x15')]));_0x5901b9['continueAt'](_0x5901b9['context'],_0x5901b9['extension'],parseInt(_0x5901b9['priority'],0xa)+0x1);_0x5901b9[_0xca18('0x34')]();}}function main(){var _0x2e4863;return utilLicense['getLicense']()[_0xca18('0x2d')](function(_0xd68769){if(_0xd68769){if(_0xd68769[_0xca18('0x51')]){if(_0xd68769['callysquare']&&_0xd68769['callysquare']>0x0){logger[_0xca18('0xe')](util[_0xca18('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0xd68769['callysquare']));_0x2e4863=_0xd68769[_0xca18('0x52')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xca18('0xe')](_0xca18('0x53'));_0x2e4863=-0x1;}}})['catch'](function(_0x14a3d8){logger['error'](_0xca18('0x54'),_0x14a3d8[_0xca18('0xc')]);})[_0xca18('0x4b')](function(){var _0x11b8f4=require(_0xca18('0x55'))(config[_0xca18('0x6')][_0xca18('0xd')],config[_0xca18('0x6')]['ip'],_0x2e4863);_0x11b8f4['on'](_0xca18('0xb'),errorHandler);_0x11b8f4['on'](_0xca18('0x56'),listeningHandler);_0x11b8f4['on'](_0xca18('0x57'),connectionHandler);_0x11b8f4['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x6007=['extension','priority','response','code','result','toString','finally','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','xml2json','lodash','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','length','source','target','value','getSquareProject','catch','indexOf','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','debug','root','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x24b19c,_0x2b5cc9){var _0x10a0a3=function(_0x4aef46){while(--_0x4aef46){_0x24b19c['push'](_0x24b19c['shift']());}};_0x10a0a3(++_0x2b5cc9);}(_0x6007,0x182));var _0x7600=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x6007[_0x17bb31];return _0x505c71;};'use strict';var parser=require(_0x7600('0x0'));var _=require(_0x7600('0x1'));var syncho=require(_0x7600('0x2'));var util=require(_0x7600('0x3'));var moment=require(_0x7600('0x4'));var config=require('../../config/environment');var logger=require(_0x7600('0x5'))(_0x7600('0x6'));var utilLicense=require(_0x7600('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x7600('0x8'));var Graph=require(_0x7600('0x9'));var Vertices=require(_0x7600('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7600('0x6')]=_[_0x7600('0xb')](config[_0x7600('0x6')],{'ip':_0x7600('0xc'),'port':0x11dd});function connectionHandler(_0x59eb33){process[_0x7600('0xd')](function(){syncho(function(){try{setChannelVariables(_0x59eb33);agiHandler(_0x59eb33);}catch(_0x38ad9b){logger[_0x7600('0xe')](_0x38ad9b[_0x7600('0xf')]);}});});}function listeningHandler(){console[_0x7600('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x7600('0x6')][_0x7600('0x11')]);logger[_0x7600('0x12')](util['format'](_0x7600('0x13'),config[_0x7600('0x6')]['ip'],config[_0x7600('0x6')][_0x7600('0x11')]));}function errorHandler(_0x4d4030){if(_0x4d4030&&_0x4d4030[_0x7600('0x14')]&&_0x4d4030[_0x7600('0x15')]){logger[_0x7600('0xe')](util['format']('[%s]\x20%s',_0x4d4030[_0x7600('0x14')],_0x4d4030['message']));}else{logger[_0x7600('0xe')](util[_0x7600('0x16')](_0x7600('0x17'),_0x4d4030[_0x7600('0xf')]));}}function closeHandler(){logger[_0x7600('0x12')](util[_0x7600('0x16')](_0x7600('0x18'),this[_0x7600('0x19')],this[_0x7600('0x1a')],this[_0x7600('0x1b')],this[_0x7600('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x48ab68){logger[_0x7600('0xe')](_0x48ab68['stack']);}}function timeoutHandler(){logger[_0x7600('0x12')](util[_0x7600('0x16')](_0x7600('0x1d'),this[_0x7600('0x19')],this[_0x7600('0x1a')],this[_0x7600('0x1b')],this['dnid'],this[_0x7600('0x1e')]));}function hangupHandler(){logger['info'](util[_0x7600('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7600('0x19')],this['calleridname'],this[_0x7600('0x1b')],this['dnid'],this['uniqueid']));this[_0x7600('0x1f')]=!![];}function getRoot(_0x324263){return parser[_0x7600('0x20')](_0x324263,{'object':!![]})[_0x7600('0x21')]['root'];}function addVertex(_0x3a2e45,_0x4573d4,_0x2d51e9){_0x4573d4[_0x7600('0x22')]=_0x2d51e9;if(_0x4573d4[_0x7600('0x23')]('retry')){_0x4573d4[_0x7600('0x24')]=parseInt(_0x4573d4[_0x7600('0x25')],0xa);}_0x3a2e45[_0x7600('0x26')](_['omit'](_0x4573d4,_0x7600('0x27')));}function initGraph(_0x2c733d,_0x302e7b){var _0x48b49a=new Graph();for(var _0x29c452 in _0x2c733d){if(_0x2c733d[_0x7600('0x23')](_0x29c452)){if(_[_0x7600('0x28')](_0x2c733d[_0x29c452])){for(var _0x3f5186=0x0;_0x3f5186<_0x2c733d[_0x29c452][_0x7600('0x29')];_0x3f5186+=0x1){addVertex(_0x48b49a,_0x2c733d[_0x29c452][_0x3f5186],_0x29c452);}}else{addVertex(_0x48b49a,_0x2c733d[_0x29c452],_0x29c452);}}}for(var _0x8188bc=0x0;_0x8188bc<_0x302e7b[_0x7600('0x29')];_0x8188bc+=0x1){if(_0x302e7b[_0x8188bc][_0x7600('0x2a')]&&_0x302e7b[_0x8188bc][_0x7600('0x2b')]){_0x48b49a['addEdge'](_0x302e7b[_0x8188bc][_0x7600('0x2a')],_0x302e7b[_0x8188bc][_0x7600('0x2b')],_0x302e7b[_0x8188bc][_0x7600('0x2c')]);}}return _0x48b49a;}function getSquareProject(_0x1d8ce7,_0x4edf4a){rpc[_0x7600('0x2d')](_0x1d8ce7)['then'](function(_0x253cf1){_0x4edf4a(null,_0x253cf1);})[_0x7600('0x2e')](function(_0x4e1f34){_0x4edf4a(null,_0x4e1f34);});}function createSquareReport(_0x341599,_0x41e6ad){rpc['createSquareReport'](_0x341599)['then'](function(_0x37e4c9){if(_0x41e6ad){_0x41e6ad(null,_0x37e4c9);}})['catch'](function(_0x12815c){if(_0x41e6ad){_0x41e6ad(null,_0x12815c);}});}function setChannelVariables(_0x81dd5){for(var _0x146087 in _0x81dd5){if(_0x81dd5['hasOwnProperty'](_0x146087)){if(_0x146087[_0x7600('0x2f')]('agi_')===0x0){_0x81dd5[_0x146087[_0x7600('0x30')](0x4)]=_0x81dd5[_0x146087];delete _0x81dd5[_0x146087];}}}}function getLogFromObject(_0x304654){return util[_0x7600('0x31')](_0x304654,{'showHidden':![],'depth':null});}function agiHandler(_0x2bc000){var _0xdb4131,_0x35807f,_0xbe06fe,_0x274aaa,_0x48d564;logger['debug']('variables',JSON[_0x7600('0x32')](_0x2bc000,null,0x2));logger[_0x7600('0x12')](util[_0x7600('0x16')](_0x7600('0x33'),_0x2bc000['arg_1'],_0x2bc000['calleridname'],_0x2bc000['callerid'],_0x2bc000[_0x7600('0x1c')],_0x2bc000[_0x7600('0x1e')]));_0x2bc000['on'](_0x7600('0xe'),errorHandler);_0x2bc000['on'](_0x7600('0x34'),closeHandler);_0x2bc000['on'](_0x7600('0x35'),timeoutHandler);_0x2bc000[_0x7600('0x1f')]=![];_0x2bc000['on'](_0x7600('0x36'),hangupHandler);var _0x80f4d1=getSquareProject[_0x7600('0x37')](null,_0x2bc000[_0x7600('0x19')]);if(_0x80f4d1){if(_0x80f4d1['production']){_0xdb4131=getRoot(_0x80f4d1[_0x7600('0x38')]);if(_0xdb4131&&_0xdb4131[_0x7600('0x39')]){logger[_0x7600('0x3a')](_0x7600('0x3b'),JSON[_0x7600('0x32')](_0xdb4131,null,0x2));_0x2bc000[_0x7600('0x3c')]=moment()[_0x7600('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x35807f=initGraph(_[_0x7600('0x3d')](_0xdb4131,_0x7600('0x27')),_0xdb4131[_0x7600('0x27')]);_0xbe06fe=new Vertices(_0x2bc000,rpc,mailRpc);logger[_0x7600('0x12')](util[_0x7600('0x16')](_0x7600('0x3e'),_0x2bc000[_0x7600('0x19')],_0x2bc000['calleridname'],_0x2bc000[_0x7600('0x1b')],_0x2bc000['dnid'],_0x2bc000[_0x7600('0x1e')]));_0x35807f[_0x7600('0x3f')](_0xdb4131[_0x7600('0x39')]['id'],function(_0x28bc5f){try{_0x28bc5f=_0xbe06fe[_0x7600('0x40')](_0x28bc5f);logger[_0x7600('0x3a')](_0x7600('0x41'),JSON[_0x7600('0x32')](_0x28bc5f,null,0x2));if(_0x28bc5f[_0x7600('0x22')]===_0x7600('0x42')){logger['info'](_0x7600('0x43'));_0x2bc000[_0x7600('0x44')]=_0x28bc5f[_0x7600('0x44')]||_0x2bc000[_0x7600('0x44')];_0x2bc000[_0x7600('0x45')]=_0x28bc5f['extension'];_0x2bc000['priority']=_0x28bc5f[_0x7600('0x46')]?_0x28bc5f[_0x7600('0x46')]-0x1:0x1;return null;}else if(_0x28bc5f&&_0xbe06fe[_0x28bc5f[_0x7600('0x22')]]){_0x48d564=_0xbe06fe[_0x28bc5f[_0x7600('0x22')]](_0x28bc5f);logger['info'](_0x7600('0x47'),JSON[_0x7600('0x32')](_0x48d564,null,0x2));if(_0x48d564&&_0x48d564[_0x7600('0x48')]===AGI_CODE_SUCCESS&&_0x48d564[_0x7600('0x49')]!==AGI_RESULT_ERROR&&!_0x2bc000['evtHangup']){logger[_0x7600('0x3a')](_0x7600('0x47'),getLogFromObject(_0x48d564));return _['isUndefined'](_0x48d564[_0x7600('0x49')])?null:_0x48d564[_0x7600('0x49')][_0x7600('0x4a')]();}else{logger[_0x7600('0xe')](_0x7600('0x47'),getLogFromObject(_0x48d564));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x6d1901){logger[_0x7600('0xe')](_0x6d1901[_0x7600('0xf')]);return null;}});if(_0xdb4131[_0x7600('0x4b')]){logger['info'](util[_0x7600('0x16')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2bc000[_0x7600('0x19')],_0x2bc000[_0x7600('0x1a')],_0x2bc000[_0x7600('0x1b')],_0x2bc000[_0x7600('0x1c')],_0x2bc000[_0x7600('0x1e')]));_0x35807f[_0x7600('0x3f')](_0xdb4131['finally']['id'],function(_0x3b0138){try{_0x3b0138=_0xbe06fe[_0x7600('0x40')](_0x3b0138);logger[_0x7600('0x3a')](_0x7600('0x41'),JSON[_0x7600('0x32')](_0x3b0138,null,0x2));if(_0x3b0138&&_0xbe06fe[_0x3b0138[_0x7600('0x22')]]){_0x48d564=_0xbe06fe[_0x3b0138[_0x7600('0x22')]](_0x3b0138);if(_0x48d564){logger[_0x7600('0x3a')](_0x7600('0x47'),getLogFromObject(_0x48d564));return _[_0x7600('0x4c')](_0x48d564[_0x7600('0x49')])?null:_0x48d564[_0x7600('0x49')][_0x7600('0x4a')]();}else{logger[_0x7600('0xe')](_0x7600('0x47'),getLogFromObject(_0x48d564));return null;}}else{logger[_0x7600('0xe')](_0x7600('0x4d'));return null;}}catch(_0x72a0c2){logger[_0x7600('0xe')](_0x72a0c2['stack']);return null;}});}logger[_0x7600('0x12')](util['format'](_0x7600('0x4e'),_0x2bc000[_0x7600('0x19')],_0x2bc000['calleridname'],_0x2bc000['callerid'],_0x2bc000[_0x7600('0x1c')],_0x2bc000[_0x7600('0x1e')]));logger[_0x7600('0x12')](util[_0x7600('0x16')](_0x7600('0x4f'),_0x2bc000['context'],_0x2bc000['extension'],parseInt(_0x2bc000[_0x7600('0x46')],0xa)+0x1));_0x2bc000[_0x7600('0x50')](_0x2bc000['context'],_0x2bc000[_0x7600('0x45')],parseInt(_0x2bc000[_0x7600('0x46')],0xa)+0x1);_0x2bc000[_0x7600('0x34')]();}}else{logger[_0x7600('0xe')](util[_0x7600('0x16')](_0x7600('0x51'),_0x2bc000[_0x7600('0x19')]));_0x2bc000[_0x7600('0x50')](_0x2bc000['context'],_0x2bc000['extension'],parseInt(_0x2bc000[_0x7600('0x46')],0xa)+0x1);_0x2bc000[_0x7600('0x34')]();}}else{logger[_0x7600('0xe')](util[_0x7600('0x16')](_0x7600('0x52'),_0x2bc000[_0x7600('0x19')]));_0x2bc000[_0x7600('0x50')](_0x2bc000[_0x7600('0x44')],_0x2bc000[_0x7600('0x45')],parseInt(_0x2bc000[_0x7600('0x46')],0xa)+0x1);_0x2bc000['close']();}}function main(){var _0x5ebaea;return utilLicense[_0x7600('0x53')]()[_0x7600('0x54')](function(_0x5593e7){if(_0x5593e7){if(_0x5593e7[_0x7600('0x55')]){if(_0x5593e7[_0x7600('0x56')]&&_0x5593e7[_0x7600('0x56')]>0x0){logger[_0x7600('0x12')](util['format'](_0x7600('0x57'),_0x5593e7[_0x7600('0x56')]));_0x5ebaea=_0x5593e7[_0x7600('0x56')];}else{logger[_0x7600('0x12')](_0x7600('0x58'));}}else{logger[_0x7600('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5ebaea=-0x1;}}})[_0x7600('0x2e')](function(_0xf01498){logger[_0x7600('0xe')]('[LICENSE]',_0xf01498[_0x7600('0xf')]);})[_0x7600('0x4b')](function(){var _0x1fa2af=require(_0x7600('0x59'))(config[_0x7600('0x6')][_0x7600('0x11')],config[_0x7600('0x6')]['ip'],_0x5ebaea);_0x1fa2af['on'](_0x7600('0xe'),errorHandler);_0x1fa2af['on'](_0x7600('0x5a'),listeningHandler);_0x1fa2af['on']('connection',connectionHandler);_0x1fa2af['on']('close',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 0e1f1e3..24a43e7 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 _0xa166=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa166,0x147));var _0x6a16=function(_0x5bbfba,_0xad361c){_0x5bbfba=_0x5bbfba-0x0;var _0x43515c=_0xa166[_0x5bbfba];return _0x43515c;};'use strict';var BPromise=require(_0x6a16('0x0'));var jayson=require(_0x6a16('0x1'));var client=jayson['client'][_0x6a16('0x2')]({'port':0x232b});function request(_0x13327e,_0x12d1f4){return new BPromise(function(_0x2b75a0,_0x9452f2){return client[_0x6a16('0x3')](_0x13327e,_0x12d1f4)[_0x6a16('0x4')](function(_0x44527c){if(_0x44527c['error']){return _0x9452f2(_0x44527c[_0x6a16('0x5')][_0x6a16('0x6')]);}else{return _0x2b75a0(_0x44527c[_0x6a16('0x7')]);}})[_0x6a16('0x8')](function(_0xe2b444){return _0x9452f2(_0xe2b444);});});}exports[_0x6a16('0x9')]=function(_0x3680b2,_0x4bbe67){return request(_0x6a16('0xa'),{'account':_0x3680b2,'message':_0x4bbe67});}; \ No newline at end of file +var _0x54e9=['http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x25f5b4,_0x536d24){var _0x5bed8e=function(_0x2d0cf9){while(--_0x2d0cf9){_0x25f5b4['push'](_0x25f5b4['shift']());}};_0x5bed8e(++_0x536d24);}(_0x54e9,0x1e2));var _0x954e=function(_0x1ebeaf,_0x2b7387){_0x1ebeaf=_0x1ebeaf-0x0;var _0x388001=_0x54e9[_0x1ebeaf];return _0x388001;};'use strict';var BPromise=require(_0x954e('0x0'));var jayson=require(_0x954e('0x1'));var client=jayson['client'][_0x954e('0x2')]({'port':0x232b});function request(_0x45534c,_0x18ee1b){return new BPromise(function(_0x3cdde4,_0x4ce090){return client[_0x954e('0x3')](_0x45534c,_0x18ee1b)[_0x954e('0x4')](function(_0x482d34){if(_0x482d34[_0x954e('0x5')]){return _0x4ce090(_0x482d34['error'][_0x954e('0x6')]);}else{return _0x3cdde4(_0x482d34[_0x954e('0x7')]);}})[_0x954e('0x8')](function(_0x1ce764){return _0x4ce090(_0x1ce764);});});}exports[_0x954e('0x9')]=function(_0x2ed681,_0x5d52e5){return request(_0x954e('0xa'),{'account':_0x2ed681,'message':_0x5d52e5});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 8d48bde..74d1664 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 _0xc85a=['util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','toString','indexOf','substring','length','split','slice','trim','emit','headers','line'];(function(_0x21e247,_0x119ed4){var _0x23b766=function(_0x5103cb){while(--_0x5103cb){_0x21e247['push'](_0x21e247['shift']());}};_0x23b766(++_0x119ed4);}(_0xc85a,0x90));var _0xac85=function(_0x9ee067,_0x382b5e){_0x9ee067=_0x9ee067-0x0;var _0xf06f43=_0xc85a[_0x9ee067];return _0xf06f43;};'use strict';var util=require(_0xac85('0x0'));var Transform=require(_0xac85('0x1'))[_0xac85('0x2')];function AGIReply(_0x469e94){Transform[_0xac85('0x3')](this,_0x469e94);this[_0xac85('0x4')]='';this[_0xac85('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xac85('0x6')][_0xac85('0x7')]=function(_0x2a579c,_0x3eb94a,_0x4e6a02){var _0x315aca='\x0a',_0x48cf2d=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x514a7c=-0x1,_0x54a6b2=-0x1,_0x3990a7='',_0x4107fe=0x0,_0x19b2ae='',_0xad274d='';this[_0xac85('0x4')]+=_0x2a579c[_0xac85('0x8')]();_0x19b2ae=this['_localBuffer'];if(!this['_inBody']){_0x4107fe=0x0;while(_0x48cf2d[_0x4107fe]){while((_0x54a6b2=_0x19b2ae[_0xac85('0x9')](_0x48cf2d[_0x4107fe]))!=-0x1){_0x3990a7=_0x48cf2d[_0x4107fe];_0xad274d=_0x19b2ae[_0xac85('0xa')](0x0,_0x54a6b2);_0x19b2ae=_0x19b2ae['substring'](_0x54a6b2+_0x3990a7[_0xac85('0xb')]);var _0x3d0ad6=_0xad274d[_0xac85('0xc')](_0x315aca),_0x4ea6ec=0x0,_0x131b39={},_0x1f0e38='',_0x1ff71e='',_0x53288b=-0x1;while(_0x3d0ad6[_0x4ea6ec]){_0x53288b=_0x3d0ad6[_0x4ea6ec][_0xac85('0x9')](':');if(_0x53288b!=-0x1){_0x1f0e38=_0x3d0ad6[_0x4ea6ec][_0xac85('0xd')](0x0,_0x53288b)[_0xac85('0xe')]();_0x1ff71e=_0x3d0ad6[_0x4ea6ec][_0xac85('0xd')](_0x53288b+0x1)[_0xac85('0xe')]();if(_0x1f0e38[_0xac85('0xb')]>0x0){_0x131b39[_0x1f0e38]=_0x1ff71e;}}else{}_0x4ea6ec++;}this[_0xac85('0xf')](_0xac85('0x10'),_0x131b39);this[_0xac85('0x5')]=!![];}_0x4107fe++;}this['_localBuffer']=_0x19b2ae;}else{while((_0x514a7c=_0x19b2ae[_0xac85('0x9')](_0x315aca))!=-0x1){_0xad274d=_0x19b2ae[_0xac85('0xa')](0x0,_0x514a7c);this['emit'](_0xac85('0x11'),_0xad274d);_0x19b2ae=_0x19b2ae[_0xac85('0xa')](_0x514a7c+_0x315aca[_0xac85('0xb')]);}this['_localBuffer']=_0x19b2ae;}_0x4e6a02();};module['exports']=AGIReply; \ No newline at end of file +var _0xd9dd=['headers','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit'];(function(_0x36587e,_0x4fdd5e){var _0x73e98d=function(_0x345401){while(--_0x345401){_0x36587e['push'](_0x36587e['shift']());}};_0x73e98d(++_0x4fdd5e);}(_0xd9dd,0x9b));var _0xdd9d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd9dd[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xdd9d('0x0'));var Transform=require(_0xdd9d('0x1'))['Transform'];function AGIReply(_0x221bfa){Transform[_0xdd9d('0x2')](this,_0x221bfa);this[_0xdd9d('0x3')]='';this[_0xdd9d('0x4')]=![];}util[_0xdd9d('0x5')](AGIReply,Transform);AGIReply[_0xdd9d('0x6')]['_transform']=function(_0x51a410,_0x2ec8fb,_0x2425fa){var _0x273419='\x0a',_0x318236=['\x0a\x0a',_0xdd9d('0x7')],_0x51a8d2=-0x1,_0xb8ebb0=-0x1,_0x30de81='',_0x44b421=0x0,_0x34fb5a='',_0x5ada25='';this['_localBuffer']+=_0x51a410[_0xdd9d('0x8')]();_0x34fb5a=this[_0xdd9d('0x3')];if(!this[_0xdd9d('0x4')]){_0x44b421=0x0;while(_0x318236[_0x44b421]){while((_0xb8ebb0=_0x34fb5a[_0xdd9d('0x9')](_0x318236[_0x44b421]))!=-0x1){_0x30de81=_0x318236[_0x44b421];_0x5ada25=_0x34fb5a[_0xdd9d('0xa')](0x0,_0xb8ebb0);_0x34fb5a=_0x34fb5a['substring'](_0xb8ebb0+_0x30de81[_0xdd9d('0xb')]);var _0x2c09ca=_0x5ada25['split'](_0x273419),_0xfb4e54=0x0,_0x55c8fe={},_0x5c206f='',_0x3b015f='',_0xb14206=-0x1;while(_0x2c09ca[_0xfb4e54]){_0xb14206=_0x2c09ca[_0xfb4e54]['indexOf'](':');if(_0xb14206!=-0x1){_0x5c206f=_0x2c09ca[_0xfb4e54][_0xdd9d('0xc')](0x0,_0xb14206)['trim']();_0x3b015f=_0x2c09ca[_0xfb4e54][_0xdd9d('0xc')](_0xb14206+0x1)[_0xdd9d('0xd')]();if(_0x5c206f[_0xdd9d('0xb')]>0x0){_0x55c8fe[_0x5c206f]=_0x3b015f;}}else{}_0xfb4e54++;}this[_0xdd9d('0xe')](_0xdd9d('0xf'),_0x55c8fe);this['_inBody']=!![];}_0x44b421++;}this[_0xdd9d('0x3')]=_0x34fb5a;}else{while((_0x51a8d2=_0x34fb5a[_0xdd9d('0x9')](_0x273419))!=-0x1){_0x5ada25=_0x34fb5a[_0xdd9d('0xa')](0x0,_0x51a8d2);this[_0xdd9d('0xe')]('line',_0x5ada25);_0x34fb5a=_0x34fb5a[_0xdd9d('0xa')](_0x51a8d2+_0x273419[_0xdd9d('0xb')]);}this['_localBuffer']=_0x34fb5a;}_0x2425fa();};module[_0xdd9d('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6ff1e6a..6a0f182 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 _0xcea7=['ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById'];(function(_0xab0649,_0x30623a){var _0x4f3b3f=function(_0x41ff12){while(--_0x41ff12){_0xab0649['push'](_0xab0649['shift']());}};_0x4f3b3f(++_0x30623a);}(_0xcea7,0xa3));var _0x7cea=function(_0x3b66e5,_0x972866){_0x3b66e5=_0x3b66e5-0x0;var _0x14d27=_0xcea7[_0x3b66e5];return _0x14d27;};'use strict';var BPromise=require(_0x7cea('0x0'));var moment=require(_0x7cea('0x1'));var _=require(_0x7cea('0x2'));var util=require(_0x7cea('0x3'));var jayson=require(_0x7cea('0x4'));var client=jayson['client'][_0x7cea('0x5')]({'port':0x2329});function request(_0x577767,_0x30ec83){return new BPromise(function(_0x1a25a0,_0x4e2268){return client[_0x7cea('0x6')](_0x577767,_0x30ec83)[_0x7cea('0x7')](function(_0x24fec3){if(_0x24fec3[_0x7cea('0x8')]){return _0x4e2268(_0x24fec3[_0x7cea('0x8')][_0x7cea('0x9')]);}else{return _0x1a25a0(_0x24fec3[_0x7cea('0xa')]);}})[_0x7cea('0xb')](function(_0x12d0b1){return _0x4e2268(_0x12d0b1);});});}exports[_0x7cea('0xc')]=function(){return request(_0x7cea('0xd'),{'options':{'raw':![],'attributes':['id','name',_0x7cea('0xe')]}});};exports[_0x7cea('0xf')]=function(_0x172e5f){return request(_0x7cea('0x10'),{'options':{'raw':![],'where':{'name':_0x172e5f},'attributes':['production']}});};exports[_0x7cea('0x11')]=function(_0x38cd4f){return request(_0x7cea('0x12'),{'options':{'raw':![],'where':{'id':_0x38cd4f},'include':[{'model':_0x7cea('0x13'),'as':_0x7cea('0x14'),'include':[{'model':_0x7cea('0x15'),'as':_0x7cea('0x15')}]}],'attributes':['id',_0x7cea('0x16'),_0x7cea('0x17')],'smtp':!![]}});};exports[_0x7cea('0x18')]=function(_0x31274c){return request('ShowSquareProject',{'options':{'where':{'id':_0x31274c},'attributes':[_0x7cea('0x16')]}});};exports[_0x7cea('0x19')]=function(_0x13a403){return request(_0x7cea('0x1a'),{'options':{'where':{'id':_0x13a403},'attributes':['name']}});};exports['getVariableById']=function(_0x2c08c5){return request(_0x7cea('0x1b'),{'options':{'where':{'id':_0x2c08c5},'attributes':[_0x7cea('0x16')]}});};exports[_0x7cea('0x1c')]=function(_0x26f54b){return request(_0x7cea('0x1d'),{'options':{'where':{'id':_0x26f54b},'attributes':[_0x7cea('0x1e')]}});};exports['getUserById']=function(_0x4a72c3){return request(_0x7cea('0x1f'),{'options':{'where':{'id':_0x4a72c3},'attributes':[_0x7cea('0x16')]}});};exports['getContactByPhone']=function(_0x21cbba){return request('GetContactByPhone',{'options':{'where':{'phone':_0x21cbba['phone']},'attributes':['id']}});};exports[_0x7cea('0x20')]=function(_0x3530dc){return request(_0x7cea('0x21'),{'options':{'where':{'id':_0x3530dc},'attributes':['name']}});};exports[_0x7cea('0x22')]=function(_0x323477){return request(_0x7cea('0x23'),{'options':{'where':{'id':_0x323477},'attributes':[_0x7cea('0x24')]}});};exports[_0x7cea('0x25')]=function(_0x8b8716){return request(_0x7cea('0x26'),{'options':{'raw':![],'where':{'id':_0x8b8716},'include':[{'model':_0x7cea('0x27'),'as':_0x7cea('0x28')}]}});};exports[_0x7cea('0x29')]=function(_0x5a3b9a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5a3b9a},'attributes':['id',_0x7cea('0x16')]}});};exports[_0x7cea('0x2a')]=function(_0x4ef312){return request(_0x7cea('0x2b'),{'body':_0x4ef312});};exports[_0x7cea('0x2c')]=function(_0x214c6d){return request(_0x7cea('0x2d'),{'body':_0x214c6d});};exports[_0x7cea('0x2e')]=function(_0x32d73b){return request(_0x7cea('0x2f'),{'body':_[_0x7cea('0x30')](_0x32d73b,{'project_name':_0x32d73b[_0x7cea('0x31')],'prev_project_name':_0x32d73b[_0x7cea('0x32')]||'','is_subproject':_0x32d73b['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x7cea('0x33'))})});};exports[_0x7cea('0x34')]=function(_0x3c51d6){return request('CreateSquareRecording',{'body':_0x3c51d6});};exports[_0x7cea('0x35')]=function(_0x22fc4b){return request(_0x7cea('0x36'),{'body':_0x22fc4b});};exports[_0x7cea('0x37')]=function(_0x58f689){return request(_0x7cea('0x38'),{'options':{'raw':![],'where':{'phone':_0x58f689[_0x7cea('0x39')],'ListId':_0x58f689['ListId']}}})[_0x7cea('0x7')](function(_0x56e86c){if(_0x56e86c){return _0x56e86c;}return request('CreateCmContact',{'body':_0x58f689});});};exports[_0x7cea('0x3a')]=function(_0x20a2f1){return request(_0x7cea('0x3b'),{'options':{'where':{'id':_0x20a2f1},'attributes':['name']}});};exports['agentLogin']=function(_0x296d4b,_0x2912be){return request(_0x7cea('0x3c'),{'body':{'interface':_0x2912be},'options':{'where':_0x296d4b}});};exports[_0x7cea('0x3d')]=function(_0x24618b,_0x24cbfc,_0x3b5084){return request(_0x7cea('0x3e'),{'body':{'type':_0x24cbfc,'uniqueid':_0x3b5084},'options':{'where':_0x24618b}});};exports[_0x7cea('0x3f')]=function(_0x55a407){return request(_0x7cea('0x40'),{'body':{},'options':{'where':_0x55a407}});};exports[_0x7cea('0x41')]=function(_0x498eec){return request('LogoutUser',{'body':{},'options':{'where':_0x498eec}});}; \ No newline at end of file +var _0xd991=['UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentPause','agentUnpause'];(function(_0x5a8583,_0x2d6817){var _0x1f3851=function(_0x1c07e6){while(--_0x1c07e6){_0x5a8583['push'](_0x5a8583['shift']());}};_0x1f3851(++_0x2d6817);}(_0xd991,0xb6));var _0x1d99=function(_0x405649,_0x10b406){_0x405649=_0x405649-0x0;var _0x139042=_0xd991[_0x405649];return _0x139042;};'use strict';var BPromise=require(_0x1d99('0x0'));var moment=require(_0x1d99('0x1'));var _=require(_0x1d99('0x2'));var util=require(_0x1d99('0x3'));var jayson=require(_0x1d99('0x4'));var client=jayson[_0x1d99('0x5')]['http']({'port':0x2329});function request(_0x5986e3,_0x502bcd){return new BPromise(function(_0x297f55,_0x4323bc){return client['request'](_0x5986e3,_0x502bcd)[_0x1d99('0x6')](function(_0x1a8c8c){if(_0x1a8c8c[_0x1d99('0x7')]){return _0x4323bc(_0x1a8c8c[_0x1d99('0x7')][_0x1d99('0x8')]);}else{return _0x297f55(_0x1a8c8c[_0x1d99('0x9')]);}})['catch'](function(_0x116d3f){return _0x4323bc(_0x116d3f);});});}exports[_0x1d99('0xa')]=function(){return request(_0x1d99('0xb'),{'options':{'raw':![],'attributes':['id',_0x1d99('0xc'),_0x1d99('0xd')]}});};exports[_0x1d99('0xe')]=function(_0x3ebe61){return request(_0x1d99('0xf'),{'options':{'raw':![],'where':{'name':_0x3ebe61},'attributes':[_0x1d99('0xd')]}});};exports[_0x1d99('0x10')]=function(_0x37ca95){return request(_0x1d99('0x11'),{'options':{'raw':![],'where':{'id':_0x37ca95},'include':[{'model':'MailServerOut','as':_0x1d99('0x12'),'include':[{'model':'CloudProvider','as':_0x1d99('0x13')}]}],'attributes':['id','name',_0x1d99('0x14')],'smtp':!![]}});};exports[_0x1d99('0x15')]=function(_0x4b8b0a){return request(_0x1d99('0xf'),{'options':{'where':{'id':_0x4b8b0a},'attributes':['name']}});};exports[_0x1d99('0x16')]=function(_0x58ddfc){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x58ddfc},'attributes':[_0x1d99('0xc')]}});};exports['getVariableById']=function(_0x1bb434){return request(_0x1d99('0x17'),{'options':{'where':{'id':_0x1bb434},'attributes':[_0x1d99('0xc')]}});};exports[_0x1d99('0x18')]=function(_0x39b393){return request(_0x1d99('0x19'),{'options':{'where':{'id':_0x39b393},'attributes':[_0x1d99('0x1a')]}});};exports['getUserById']=function(_0x538931){return request(_0x1d99('0x1b'),{'options':{'where':{'id':_0x538931},'attributes':['name']}});};exports[_0x1d99('0x1c')]=function(_0x7a83ce){return request(_0x1d99('0x1d'),{'options':{'where':{'phone':_0x7a83ce[_0x1d99('0x1e')]},'attributes':['id']}});};exports[_0x1d99('0x1f')]=function(_0x4271a8){return request('ShowTrunk',{'options':{'where':{'id':_0x4271a8},'attributes':[_0x1d99('0xc')]}});};exports[_0x1d99('0x20')]=function(_0x58749e){return request(_0x1d99('0x21'),{'options':{'where':{'id':_0x58749e},'attributes':[_0x1d99('0x22')]}});};exports[_0x1d99('0x23')]=function(_0x435c0f){return request(_0x1d99('0x24'),{'options':{'raw':![],'where':{'id':_0x435c0f},'include':[{'model':_0x1d99('0x25'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x13a21f){return request(_0x1d99('0x26'),{'options':{'where':{'id':_0x13a21f},'attributes':['id','name']}});};exports[_0x1d99('0x27')]=function(_0x290d98){return request(_0x1d99('0x28'),{'body':_0x290d98});};exports[_0x1d99('0x29')]=function(_0x40b424){return request(_0x1d99('0x2a'),{'body':_0x40b424});};exports[_0x1d99('0x2b')]=function(_0x5ae396){return request('CreateSquareReport',{'body':_[_0x1d99('0x2c')](_0x5ae396,{'project_name':_0x5ae396[_0x1d99('0x2d')],'prev_project_name':_0x5ae396['arg_2']||'','is_subproject':_0x5ae396[_0x1d99('0x2e')]?!![]:![],'leaveAt':moment()['format'](_0x1d99('0x2f'))})});};exports['createSquareRecording']=function(_0x4cb1e2){return request(_0x1d99('0x30'),{'body':_0x4cb1e2});};exports[_0x1d99('0x31')]=function(_0x64fa62){return request(_0x1d99('0x32'),{'body':_0x64fa62});};exports[_0x1d99('0x33')]=function(_0x4836d9){return request(_0x1d99('0x34'),{'options':{'raw':![],'where':{'phone':_0x4836d9[_0x1d99('0x1e')],'ListId':_0x4836d9[_0x1d99('0x35')]}}})[_0x1d99('0x6')](function(_0x10828f){if(_0x10828f){return _0x10828f;}return request(_0x1d99('0x36'),{'body':_0x4836d9});});};exports['getPauseById']=function(_0x4ed43e){return request(_0x1d99('0x37'),{'options':{'where':{'id':_0x4ed43e},'attributes':[_0x1d99('0xc')]}});};exports['agentLogin']=function(_0x2755c6,_0x92d8db){return request('LoginUser',{'body':{'interface':_0x92d8db},'options':{'where':_0x2755c6}});};exports[_0x1d99('0x38')]=function(_0x14e08b,_0x25c926,_0x1bb2b3){return request('PauseUser',{'body':{'type':_0x25c926,'uniqueid':_0x1bb2b3},'options':{'where':_0x14e08b}});};exports[_0x1d99('0x39')]=function(_0x427459){return request(_0x1d99('0x3a'),{'body':{},'options':{'where':_0x427459}});};exports[_0x1d99('0x3b')]=function(_0x46d1a7){return request('LogoutUser',{'body':{},'options':{'where':_0x46d1a7}});}; \ 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 f3d0c1e..2462975 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 _0xdcfa=['exports','./polly'];(function(_0x3d7fb1,_0x3dd17a){var _0x194ca5=function(_0x38c253){while(--_0x38c253){_0x3d7fb1['push'](_0x3d7fb1['shift']());}};_0x194ca5(++_0x3dd17a);}(_0xdcfa,0xad));var _0xadcf=function(_0xa8d40a,_0x174d0f){_0xa8d40a=_0xa8d40a-0x0;var _0x5bd5a6=_0xdcfa[_0xa8d40a];return _0x5bd5a6;};var polly=require(_0xadcf('0x0'));var lex=require('./lex');module[_0xadcf('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x624c=['./lex','exports'];(function(_0x4f140e,_0x574bee){var _0x357343=function(_0x489ebc){while(--_0x489ebc){_0x4f140e['push'](_0x4f140e['shift']());}};_0x357343(++_0x574bee);}(_0x624c,0x1ee));var _0xc624=function(_0x27567e,_0x2f60b0){_0x27567e=_0x27567e-0x0;var _0xb71bfe=_0x624c[_0x27567e];return _0xb71bfe;};var polly=require('./polly');var lex=require(_0xc624('0x0'));module[_0xc624('0x1')]={'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 db6b579..50bf5f6 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 _0x6f7a=['./lib/api','exports'];(function(_0x13d00a,_0x594206){var _0x4d7d5b=function(_0x5ecc3b){while(--_0x5ecc3b){_0x13d00a['push'](_0x13d00a['shift']());}};_0x4d7d5b(++_0x594206);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x13aa51,_0x5a2958){_0x13aa51=_0x13aa51-0x0;var _0x3d95af=_0x6f7a[_0x13aa51];return _0x3d95af;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ No newline at end of file +var _0x55e0=['./lib/api','exports'];(function(_0x72b8af,_0x358c8d){var _0x158964=function(_0x437681){while(--_0x437681){_0x72b8af['push'](_0x72b8af['shift']());}};_0x158964(++_0x358c8d);}(_0x55e0,0xdc));var _0x055e=function(_0x48ff3b,_0x2578be){_0x48ff3b=_0x48ff3b-0x0;var _0x1fb26e=_0x55e0[_0x48ff3b];return _0x1fb26e;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ 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 285a6c9..84bf802 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(_0x4cc10f,_0x369d01){var _0x389355=function(_0x1fc613){while(--_0x1fc613){_0x4cc10f['push'](_0x4cc10f['shift']());}};_0x389355(++_0x369d01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x3fc491,_0x57c57c){var _0x4b6fa1=function(_0x527c1e){while(--_0x527c1e){_0x3fc491['push'](_0x3fc491['shift']());}};_0x4b6fa1(++_0x57c57c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 8ee10ec..e78c054 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 _0x0e26=['./lib/api'];(function(_0x1068c2,_0x40ee3e){var _0x13af69=function(_0x3ffb99){while(--_0x3ffb99){_0x1068c2['push'](_0x1068c2['shift']());}};_0x13af69(++_0x40ee3e);}(_0x0e26,0x17f));var _0x60e2=function(_0x20c6cd,_0x8b087f){_0x20c6cd=_0x20c6cd-0x0;var _0x3ffbc0=_0x0e26[_0x20c6cd];return _0x3ffbc0;};'use strict';var polly=require(_0x60e2('0x0'));module['exports']=function(_0x36a75e,_0x3b9ae3,_0x2c617d,_0x5e5612,_0x2a0bec,_0xfc66e2,_0x4a7681){return polly(_0x36a75e,_0x3b9ae3,_0x2c617d,_0x5e5612,_0x2a0bec,_0xfc66e2,_0x4a7681);}; \ No newline at end of file +var _0x98f5=['./lib/api','exports'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x98f5,0x1a8));var _0x598f=function(_0x4eaedb,_0x3ef388){_0x4eaedb=_0x4eaedb-0x0;var _0x281a18=_0x98f5[_0x4eaedb];return _0x281a18;};'use strict';var polly=require(_0x598f('0x0'));module[_0x598f('0x1')]=function(_0x4586af,_0x2999a1,_0x2cfdba,_0x257f70,_0x11bc7b,_0x17a047,_0x5c4ec5){return polly(_0x4586af,_0x2999a1,_0x2cfdba,_0x257f70,_0x11bc7b,_0x17a047,_0x5c4ec5);}; \ 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 a1c4947..ca9fdcf 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 _0x4a01=['text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x4a01,0x17d));var _0x14a0=function(_0x1b0f44,_0x296dc2){_0x1b0f44=_0x1b0f44-0x0;var _0xf897e2=_0x4a01[_0x1b0f44];return _0xf897e2;};'use strict';var fs=require('fs');var path=require(_0x14a0('0x0'));var BPromise=require(_0x14a0('0x1'));var rs=require(_0x14a0('0x2'));var AWS=require(_0x14a0('0x3'));function pollyResult(_0x37e159,_0x1b0de1,_0x5b0d36){return new BPromise(function(_0x443275,_0x6e577a){_0x37e159[_0x14a0('0x4')](_0x1b0de1,function(_0x44718c,_0x9d85ce){if(_0x44718c){_0x6e577a(_0x44718c);}else if(_0x9d85ce){if(_0x9d85ce[_0x14a0('0x5')]instanceof Buffer){fs[_0x14a0('0x6')](_0x5b0d36,_0x9d85ce[_0x14a0('0x5')],function(_0xe33b10){if(_0xe33b10){_0x6e577a(_0xe33b10);}else{_0x443275();}});}else{_0x6e577a(new Error(_0x14a0('0x7')));}}else{_0x6e577a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x14a0('0x8')]=function(_0x367268,_0x1f6ee4,_0x301583,_0x297009,_0x477a4b,_0x1f0633,_0x46e730){var _0x452361=new AWS['Polly']({'accessKeyId':_0x367268,'secretAccessKey':_0x1f6ee4,'region':_0x301583});var _0x45eb07={'Text':_0x477a4b,'TextType':_0x1f0633||_0x14a0('0x9'),'OutputFormat':'mp3','VoiceId':_0x297009};return pollyResult(_0x452361,_0x45eb07,_0x46e730);}; \ No newline at end of file +var _0xa047=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xa047,0x102));var _0x7a04=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa047[_0x2112d4];return _0x434972;};'use strict';var fs=require('fs');var path=require(_0x7a04('0x0'));var BPromise=require(_0x7a04('0x1'));var rs=require(_0x7a04('0x2'));var AWS=require(_0x7a04('0x3'));function pollyResult(_0x354bea,_0x2daa8a,_0x2e9a4c){return new BPromise(function(_0x478211,_0x2c9457){_0x354bea[_0x7a04('0x4')](_0x2daa8a,function(_0x4e0f87,_0x48a3be){if(_0x4e0f87){_0x2c9457(_0x4e0f87);}else if(_0x48a3be){if(_0x48a3be[_0x7a04('0x5')]instanceof Buffer){fs[_0x7a04('0x6')](_0x2e9a4c,_0x48a3be['AudioStream'],function(_0x4b79a2){if(_0x4b79a2){_0x2c9457(_0x4b79a2);}else{_0x478211();}});}else{_0x2c9457(new Error(_0x7a04('0x7')));}}else{_0x2c9457(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x4ace7f,_0x244e4b,_0x419a12,_0x1e4a39,_0xee4804,_0x32a5ca,_0x39b44a){var _0x284a01=new AWS[(_0x7a04('0x8'))]({'accessKeyId':_0x4ace7f,'secretAccessKey':_0x244e4b,'region':_0x419a12});var _0x492373={'Text':_0xee4804,'TextType':_0x32a5ca||_0x7a04('0x9'),'OutputFormat':_0x7a04('0xa'),'VoiceId':_0x1e4a39};return pollyResult(_0x284a01,_0x492373,_0x39b44a);}; \ 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 b3eadbd..23db352 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd174=['./lib/api'];(function(_0x3b51be,_0x34b1ce){var _0x4c2b38=function(_0x282304){while(--_0x282304){_0x3b51be['push'](_0x3b51be['shift']());}};_0x4c2b38(++_0x34b1ce);}(_0xd174,0x1cb));var _0x4d17=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd174[_0x2641f9];return _0x585741;};'use strict';var asr=require(_0x4d17('0x0'));module['exports']=function(_0x658335,_0x271cd1,_0x5dc47e,_0x294b17){return asr(_0x658335,_0x271cd1,_0x5dc47e);}; \ No newline at end of file +var _0x602a=['exports'];(function(_0xa79d0f,_0x2c5e22){var _0x2e6ea7=function(_0x2df949){while(--_0x2df949){_0xa79d0f['push'](_0xa79d0f['shift']());}};_0x2e6ea7(++_0x2c5e22);}(_0x602a,0x199));var _0xa602=function(_0x2ea250,_0x308c1f){_0x2ea250=_0x2ea250-0x0;var _0x4055c2=_0x602a[_0x2ea250];return _0x4055c2;};'use strict';var asr=require('./lib/api');module[_0xa602('0x0')]=function(_0x502786,_0x52fb53,_0x47203b,_0x1d6bb8){return asr(_0x502786,_0x52fb53,_0x47203b);}; \ 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 b7393e0..8860005 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 _0xde2c=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key='];(function(_0x249d20,_0x1ce2f2){var _0x25f12c=function(_0x41aa33){while(--_0x41aa33){_0x249d20['push'](_0x249d20['shift']());}};_0x25f12c(++_0x1ce2f2);}(_0xde2c,0x7f));var _0xcde2=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xde2c[_0x3e182f];return _0x23edc9;};'use strict';var url=require(_0xcde2('0x0'));var BPromise=require(_0xcde2('0x1'));var fs=require('fs');var host=_0xcde2('0x2');module[_0xcde2('0x3')]=function(_0x7595ed,_0x40fa0a,_0x33bb0c){return new BPromise(function(_0x3a309f,_0x55c175){var _0x4353c8;if(typeof _0x7595ed!==_0xcde2('0x4')||_0x7595ed[_0xcde2('0x5')]===0x0){return _0x55c175(_0xcde2('0x6'));}if(typeof _0x40fa0a!==_0xcde2('0x4')||_0x40fa0a['length']===0x0){return _0x55c175(_0xcde2('0x7'));}if(typeof _0x33bb0c!==_0xcde2('0x8')&&(typeof _0x33bb0c!==_0xcde2('0x4')||_0x33bb0c['length']===0x0)){return _0x55c175('lang\x20should\x20be\x20a\x20string');}try{_0x4353c8=fs[_0xcde2('0x9')](_0x7595ed)[_0xcde2('0xa')]('base64');}catch(_0x181a73){return _0x55c175(_0x181a73);}return _0x3a309f({'method':_0xcde2('0xb'),'uri':host+_0xcde2('0xc')+_0x40fa0a,'body':{'config':{'encoding':_0xcde2('0xd'),'sampleRateHertz':'8000','languageCode':_0x33bb0c},'audio':{'content':_0x4353c8}},'json':!![]});});}; \ No newline at end of file +var _0x6ff1=['string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x1210cc,_0x2ec2ec){var _0x59cc74=function(_0x11553b){while(--_0x11553b){_0x1210cc['push'](_0x1210cc['shift']());}};_0x59cc74(++_0x2ec2ec);}(_0x6ff1,0x10a));var _0x16ff=function(_0x4a4af5,_0x178289){_0x4a4af5=_0x4a4af5-0x0;var _0x506717=_0x6ff1[_0x4a4af5];return _0x506717;};'use strict';var url=require(_0x16ff('0x0'));var BPromise=require(_0x16ff('0x1'));var fs=require('fs');var host=_0x16ff('0x2');module[_0x16ff('0x3')]=function(_0x4e4d9c,_0x50cd8a,_0x1402f0){return new BPromise(function(_0x5cca46,_0x1db386){var _0x2bf329;if(typeof _0x4e4d9c!==_0x16ff('0x4')||_0x4e4d9c[_0x16ff('0x5')]===0x0){return _0x1db386('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x50cd8a!=='string'||_0x50cd8a['length']===0x0){return _0x1db386('key\x20should\x20be\x20a\x20string');}if(typeof _0x1402f0!==_0x16ff('0x6')&&(typeof _0x1402f0!==_0x16ff('0x4')||_0x1402f0[_0x16ff('0x5')]===0x0)){return _0x1db386(_0x16ff('0x7'));}try{_0x2bf329=fs[_0x16ff('0x8')](_0x4e4d9c)[_0x16ff('0x9')](_0x16ff('0xa'));}catch(_0x3f0e36){return _0x1db386(_0x3f0e36);}return _0x5cca46({'method':_0x16ff('0xb'),'uri':host+_0x16ff('0xc')+_0x50cd8a,'body':{'config':{'encoding':_0x16ff('0xd'),'sampleRateHertz':_0x16ff('0xe'),'languageCode':_0x1402f0},'audio':{'content':_0x2bf329}},'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 124f847..8c99e3a 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 _0x848f=['exports','./asr'];(function(_0xd52ab,_0x38d79b){var _0x6a8af5=function(_0x27719b){while(--_0x27719b){_0xd52ab['push'](_0xd52ab['shift']());}};_0x6a8af5(++_0x38d79b);}(_0x848f,0x161));var _0xf848=function(_0x23c2f9,_0x5e9115){_0x23c2f9=_0x23c2f9-0x0;var _0xc02045=_0x848f[_0x23c2f9];return _0xc02045;};var asr=require(_0xf848('0x0'));module[_0xf848('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe1f7=['exports','./asr'];(function(_0x4171c6,_0xf69bcd){var _0x5ca749=function(_0x3c7c8e){while(--_0x3c7c8e){_0x4171c6['push'](_0x4171c6['shift']());}};_0x5ca749(++_0xf69bcd);}(_0xe1f7,0x193));var _0x7e1f=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0xe1f7[_0x6b6340];return _0x3609bf;};var asr=require(_0x7e1f('0x0'));module[_0x7e1f('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 3da319d..576ca18 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 _0xa467=['request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','end','https:','WHAT_EVER','data','transcode','wav','error\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','stringify','jQ1olc','null','generic','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','tmp','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','intent','displayName','isFallback','languageCode','queryText','fulfillmentText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','protocol','host','get','statusCode','error'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0xa467,0x17d));var _0x7a46=function(_0x169124,_0x16f18c){_0x169124=_0x169124-0x0;var _0x17ba67=_0xa467[_0x169124];return _0x17ba67;};'use strict';var apiai=require(_0x7a46('0x0'));var BPromise=require(_0x7a46('0x1'));var dialogflow=require(_0x7a46('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x7a46('0x3'));var querystring=require(_0x7a46('0x4'));var rp=require(_0x7a46('0x5'));var rs=require('randomstring');var sox=require(_0x7a46('0x6'));var tts=require(_0x7a46('0x7'));var urlParse=require(_0x7a46('0x8'))[_0x7a46('0x9')];var util=require(_0x7a46('0xa'));var aws=require(_0x7a46('0xb'));var google=require(_0x7a46('0xc'));var sestek=require(_0x7a46('0xd'));var tilde=require(_0x7a46('0xe'));var logger=require(_0x7a46('0xf'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5d7de1,_0x4368e2){return new BPromise(function(_0x4cfc90,_0x13c5f1){var _0x213904=urlParse(_0x5d7de1);var _0x251a63=_0x213904[_0x7a46('0x10')]==='https:'?https:http;var _0xcc035={'host':_0x213904[_0x7a46('0x11')],'path':_0x213904[_0x7a46('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x251a63[_0x7a46('0x12')](_0xcc035,function(_0x69a6ae){if(_0x69a6ae[_0x7a46('0x13')]!==0xc8){logger[_0x7a46('0x14')](_0x7a46('0x15')+_0x5d7de1+_0x7a46('0x16')+_0x69a6ae[_0x7a46('0x13')]+'\x20('+_0x69a6ae[_0x7a46('0x17')]+')');_0x13c5f1(new Error(_0x7a46('0x15')+_0x5d7de1+_0x7a46('0x16')+_0x69a6ae[_0x7a46('0x13')]+'\x20('+_0x69a6ae[_0x7a46('0x17')]+')'));return;}var _0x5b1062=fs[_0x7a46('0x18')](_0x4368e2);_0x5b1062['on'](_0x7a46('0x19'),function(){logger[_0x7a46('0x1a')](_0x7a46('0x1b'));_0x5b1062[_0x7a46('0x1c')](_0x4cfc90);});_0x5b1062['on'](_0x7a46('0x14'),function(_0x3fa4f0){fs['unlink'](_0x4368e2);logger[_0x7a46('0x14')]('download\x20error',_0x3fa4f0);_0x13c5f1(_0x3fa4f0);});_0x69a6ae['pipe'](_0x5b1062);})['on']('error',function(_0x22d0a8){logger['error'](_0x22d0a8);_0x13c5f1(_0x22d0a8);})[_0x7a46('0x1d')]();});}function uploadFile(_0x2aa18a){return new BPromise(function(_0x358987,_0x1d79d1){var _0x33782a=urlParse(_0x2aa18a);var _0x137fbf=_0x33782a['protocol']===_0x7a46('0x1e')?https:http;var _0x2f69b1={'host':_0x33782a['host'],'path':_0x33782a['path'],'headers':{'user-agent':_0x7a46('0x1f')}};_0x137fbf[_0x7a46('0x12')](_0x2f69b1,function(_0x16d08f){if(_0x16d08f['statusCode']!==0xc8){_0x1d79d1(new Error(_0x7a46('0x15')+_0x2aa18a+_0x7a46('0x16')+_0x16d08f[_0x7a46('0x13')]+'\x20('+_0x16d08f[_0x7a46('0x17')]+')'));return;}var _0x1d329e='';_0x16d08f['on'](_0x7a46('0x20'),function(_0x14773e){_0x1d329e+=_0x14773e;});_0x16d08f['on']('end',function(){_0x358987(_0x1d329e);});})['on'](_0x7a46('0x14'),function(_0x544a1e){_0x1d79d1(_0x544a1e);})[_0x7a46('0x1d')]();});}function convertFile(_0x301309,_0x5b981f){return new BPromise(function(_0x2b52e4,_0x44d4b2){var _0x333a9f=sox[_0x7a46('0x21')](_0x301309,_0x5b981f,{'sampleRate':0x1f40,'format':_0x7a46('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x333a9f['on'](_0x7a46('0x14'),function(_0x305860){logger['error'](_0x7a46('0x23'),_0x305860);_0x44d4b2(_0x305860);});_0x333a9f['on']('end',function(){logger[_0x7a46('0x1a')]('finish\x20to\x20convert');_0x2b52e4();});_0x333a9f[_0x7a46('0x24')]();});}function base64Decode(_0xd5d19e,_0x500c5e){var _0x48f9c8=path[_0x7a46('0x25')](__dirname,'tmp',rs[_0x7a46('0x26')](0x4)+_0x7a46('0x27'));fs[_0x7a46('0x28')](_0x48f9c8,_0xd5d19e,_0x7a46('0x29'));return convertFile(_0x48f9c8,_0x500c5e)[_0x7a46('0x2a')](function(){try{fs[_0x7a46('0x2b')](_0x48f9c8);fs[_0x7a46('0x2c')](_0x500c5e,_0x7a46('0x2d'));}catch(_0x165953){logger[_0x7a46('0x14')](_0x165953);}return _0x500c5e[_0x7a46('0x2e')]('.')[0x0];});}function base64Encode(_0x5a0410){var _0x27be8b=fs[_0x7a46('0x2f')](_0x5a0410);return new Buffer(_0x27be8b)['toString'](_0x7a46('0x29'));}exports[_0x7a46('0x30')]=function(_0x2b7a61,_0x26eb01,_0x5927dc,_0x589327,_0x21f51f,_0xf98c48){var _0x23a8f4,_0x42db4f;var _0x46bd57=_0x7a46('0x31');var _0x304bdc=_0x7a46('0x32')+_0x2b7a61;var _0x32f6bd={};if(_0x26eb01===_0x7a46('0x33')){_0x32f6bd[_0x7a46('0x34')]={'ssml':_0x5927dc};}else{_0x32f6bd[_0x7a46('0x34')]={'text':_0x5927dc};};_0x32f6bd[_0x7a46('0x35')]={'languageCode':_0x589327,'ssmlGender':_0x21f51f};_0x32f6bd[_0x7a46('0x36')]={'audioEncoding':_0x7a46('0x37'),'sampleRateHertz':0x1f40};var _0x5b1c5d={'url':_0x46bd57+'text:synthesize'+_0x304bdc,'method':_0x7a46('0x38'),'json':!![],'body':_0x32f6bd};return rp(_0x5b1c5d)['then'](function(_0x3319b1){return new BPromise(function(_0x1ee0d4,_0x572a62){_0x23a8f4=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x7a46('0x39'));var _0x242689=Buffer['from'](_0x3319b1[_0x7a46('0x3a')],_0x7a46('0x29'));return fs[_0x7a46('0x3b')](_0x23a8f4,_0x242689,function(_0x2d2a32){_0x572a62(_0x2d2a32);},function(_0x21c5e6){fs[_0x7a46('0x2c')](_0x23a8f4,_0x7a46('0x2d'));_0x1ee0d4(_0x21c5e6);});});})['then'](function(_0x4c33d7){_0x42db4f=path['resolve'](__dirname,'tmp',rs[_0x7a46('0x26')](0x4)+_0x7a46('0x27'));return convertFile(_0x23a8f4,_0x42db4f);})['then'](function(){try{fs[_0x7a46('0x2b')](_0x23a8f4);fs[_0x7a46('0x2c')](_0x42db4f,_0x7a46('0x2d'));}catch(_0x46a05f){logger['error'](_0x46a05f);}logger[_0x7a46('0x1a')](_0x7a46('0x3c'),_0x42db4f[_0x7a46('0x2e')]('.')[0x0]);return _0x42db4f[_0x7a46('0x2e')]('.')[0x0];});};exports[_0x7a46('0x3d')]=function(_0x1646fe,_0x17e055){var _0x3f2059='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x21e8b4,_0x38774a;var _0x22617b;var _0x156a28={'encoding':_0x7a46('0x3e'),'method':_0x7a46('0x38'),'timeout':0x2710,'url':_0x3f2059,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x7a46('0x3f')]([[[_0x7a46('0x40'),JSON[_0x7a46('0x3f')]([_0x1646fe,_0x17e055||'en',![],_0x7a46('0x41')]),null,_0x7a46('0x42')]]]))};return rp(_0x156a28)[_0x7a46('0x2a')](function(_0x578f00){try{_0x22617b=eval(_0x578f00['slice'](0x5))[0x0][0x2];}catch(_0x219914){throw new Error('parse\x20response\x20failed:\x0a'+_0x578f00['data']);}if(!_0x22617b){if(_0x1646fe[_0x7a46('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x7a46('0x44')+_0x17e055+_0x7a46('0x45'));}}try{_0x22617b=eval(_0x22617b)[0x0];}catch(_0x31dd67){throw new Error(_0x7a46('0x46')+res[_0x7a46('0x20')]);}const _0xde76c=_0x22617b;_0x21e8b4=path['resolve'](__dirname,_0x7a46('0x47'),rs['generate'](0x4)+_0x7a46('0x39'));fs[_0x7a46('0x28')](_0x21e8b4,_0x22617b,{'encoding':_0x7a46('0x29')});_0x38774a=path['resolve'](__dirname,_0x7a46('0x47'),rs[_0x7a46('0x26')](0x4)+_0x7a46('0x27'));return convertFile(_0x21e8b4,_0x38774a);})[_0x7a46('0x2a')](function(){try{fs['unlink'](_0x21e8b4);fs[_0x7a46('0x2c')](_0x38774a,_0x7a46('0x2d'));}catch(_0x5cc58d){logger[_0x7a46('0x14')](_0x5cc58d);}logger[_0x7a46('0x1a')](_0x7a46('0x48'),_0x38774a[_0x7a46('0x2e')]('.')[0x0]);return _0x38774a[_0x7a46('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x25e9f7,_0x15c3fc,_0x103ad8){return google[_0x7a46('0x49')](_0x25e9f7,_0x15c3fc,_0x103ad8)[_0x7a46('0x2a')](function(_0x27ec8c){logger[_0x7a46('0x1a')](_0x27ec8c[_0x7a46('0x4a')]);return rp(_0x27ec8c);})['then'](function(_0x11f189){var _0x4d9060='';var _0x50a7d7=0x0;try{fs[_0x7a46('0x2b')](_0x25e9f7);}catch(_0x3464c9){logger[_0x7a46('0x14')](_0x3464c9);}if(_0x11f189&&_0x11f189[_0x7a46('0x4b')]){_0x4d9060=_0x11f189[_0x7a46('0x4b')][_0x7a46('0x4c')](function(_0x2e6828){return _0x2e6828&&_0x2e6828[_0x7a46('0x4d')][0x0]&&_0x2e6828[_0x7a46('0x4d')][0x0][_0x7a46('0x4e')]?_0x2e6828['alternatives'][0x0][_0x7a46('0x4e')]:'';})[_0x7a46('0x4f')]('\x0a');_0x50a7d7=_0x11f189['results']['map'](function(_0x19d69c){return _0x19d69c&&_0x19d69c[_0x7a46('0x4d')][0x0]&&_0x19d69c['alternatives'][0x0][_0x7a46('0x50')]?_0x19d69c[_0x7a46('0x4d')][0x0]['confidence']:0x0;})[_0x7a46('0x4f')]('\x0a');}logger['info'](_0x7a46('0x51'),_0x4d9060);logger['info']('googleASR\x20confidence',_0x50a7d7);return{'transcript':_0x4d9060,'confidence':_0x50a7d7};})[_0x7a46('0x52')](function(_0x3fb926){logger[_0x7a46('0x14')](_0x7a46('0x53'),_0x3fb926[_0x7a46('0x13')],_0x3fb926[_0x7a46('0x54')],_0x3fb926[_0x7a46('0x55')]);});};exports[_0x7a46('0x56')]=function(_0x505871,_0xe9c0c2,_0x3141af,_0xd2d256){var _0x383fa9=apiai(_0xe9c0c2,{'language':_0xd2d256||'en'});return _0x383fa9[_0x7a46('0x57')](_0x3141af,{'sessionId':md5(_0x505871)})[_0x7a46('0x2a')](function(_0x5553db){logger[_0x7a46('0x1a')](JSON[_0x7a46('0x3f')](_0x5553db));return{'source':_0x5553db[_0x7a46('0x58')][_0x7a46('0x59')],'resolvedQuery':_0x5553db[_0x7a46('0x58')][_0x7a46('0x5a')],'action':_0x5553db[_0x7a46('0x58')][_0x7a46('0x5b')],'actionIncomplete':_0x5553db[_0x7a46('0x58')][_0x7a46('0x5c')],'speech':_0x5553db[_0x7a46('0x58')][_0x7a46('0x5d')][_0x7a46('0x5e')],'score':_0x5553db[_0x7a46('0x58')][_0x7a46('0x5f')],'statusCode':_0x5553db['status'][_0x7a46('0x60')],'endConversation':_0x5553db[_0x7a46('0x58')][_0x7a46('0x61')]['endConversation']||![],'isFallbackIntent':_0x5553db[_0x7a46('0x58')][_0x7a46('0x61')][_0x7a46('0x62')]};});};exports[_0x7a46('0x63')]=function(_0x5c5cfe,_0x682120,_0x11f8cb,_0x4953a8,_0x300ce8,_0x3b9ae9){var _0x175921=_0x4953a8['replace'](/\\n/g,'\x0a');var _0x26a701={'credentials':{'private_key':_0x175921,'client_email':_0x11f8cb}};var _0x1a8921=new dialogflow[(_0x7a46('0x64'))](_0x26a701);var _0x17d99a=_0x1a8921[_0x7a46('0x65')](_0x682120,md5(_0x5c5cfe));var _0x1ea36f={'session':_0x17d99a,'queryInput':{'text':{'text':_0x300ce8,'languageCode':_0x3b9ae9}}};return _0x1a8921[_0x7a46('0x66')](_0x1ea36f)[_0x7a46('0x2a')](function(_0x3bd4ba){if(_0x3bd4ba&&_0x3bd4ba[_0x7a46('0x43')]){logger[_0x7a46('0x1a')](_0x7a46('0x67'),JSON[_0x7a46('0x3f')](_0x3bd4ba));var _0x2b2238=_0x3bd4ba[0x0];if(_0x2b2238){var _0x158b10={'action':_0x2b2238[_0x7a46('0x68')]['action'],'allRequiredParamsPresent':_0x2b2238['queryResult'][_0x7a46('0x69')],'endConversation':_0x2b2238['queryResult']['diagnosticInfo']&&_0x2b2238['queryResult']['diagnosticInfo'][_0x7a46('0x6a')]?_0x2b2238[_0x7a46('0x68')][_0x7a46('0x6b')][_0x7a46('0x6a')][_0x7a46('0x6c')]['boolValue']:![],'fulfillmentText':_0x2b2238['queryResult']['fulfillmentText'],'intentName':_0x2b2238[_0x7a46('0x68')][_0x7a46('0x6d')][_0x7a46('0x54')],'intentDisplayName':_0x2b2238['queryResult'][_0x7a46('0x6d')][_0x7a46('0x6e')],'isFallbackIntent':_0x2b2238[_0x7a46('0x68')]['intent'][_0x7a46('0x6f')],'languageCode':_0x2b2238[_0x7a46('0x68')][_0x7a46('0x70')],'queryText':_0x2b2238[_0x7a46('0x68')][_0x7a46('0x71')],'responseId':_0x2b2238['responseId'],'score':_0x2b2238[_0x7a46('0x68')]['intentDetectionConfidence'],'speech':_0x2b2238[_0x7a46('0x68')][_0x7a46('0x72')],'providerResponse':JSON[_0x7a46('0x3f')](_0x3bd4ba)};return _0x158b10;}}});};exports['tildeASR']=function(_0x2fafde,_0x3a2ffd,_0x3892f4,_0x5f4fe2){return tilde[_0x7a46('0x49')](_0x2fafde,_0x3a2ffd,_0x3892f4,_0x5f4fe2)[_0x7a46('0x2a')](function(_0x5b9048){try{fs[_0x7a46('0x2b')](_0x2fafde);}catch(_0x4a6f0b){logger[_0x7a46('0x14')](_0x4a6f0b);}logger['info'](_0x7a46('0x73'),_0x5b9048[_0x7a46('0x4e')]);logger[_0x7a46('0x1a')](_0x7a46('0x74'),_0x5b9048[_0x7a46('0x50')]);return _0x5b9048;});};exports[_0x7a46('0x75')]=function(_0x11a550,_0x3981d6,_0x11d7cf,_0x5ab236,_0x282333,_0x2431d1){var _0x50db80=path['resolve'](__dirname,_0x7a46('0x47'),rs[_0x7a46('0x26')](0x4)+'.mp3');var _0x2060e6;return aws[_0x7a46('0x76')](_0x11a550,_0x3981d6,_0x11d7cf,_0x5ab236,_0x282333,_0x2431d1,_0x50db80)[_0x7a46('0x2a')](function(){_0x2060e6=path[_0x7a46('0x25')](__dirname,'tmp',rs[_0x7a46('0x26')](0x4)+_0x7a46('0x27'));return convertFile(_0x50db80,_0x2060e6);})[_0x7a46('0x2a')](function(){try{fs[_0x7a46('0x2b')](_0x50db80);fs[_0x7a46('0x2c')](_0x2060e6,_0x7a46('0x2d'));}catch(_0xf38517){logger[_0x7a46('0x14')](_0xf38517);}return _0x2060e6[_0x7a46('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x2b127f,_0x3eeeb5,_0x4863fb,_0x4f1f94,_0x2c1631,_0x2a3dc4){return aws[_0x7a46('0x77')](_0x2b127f,_0x3eeeb5,_0x4863fb,_0x4f1f94,_0x2c1631,_0x2a3dc4)[_0x7a46('0x2a')](function(_0x3b8d01){logger[_0x7a46('0x1a')](JSON[_0x7a46('0x3f')](_0x3b8d01));return _0x3b8d01;});};exports[_0x7a46('0x78')]=function(_0x535c96,_0x433926,_0x5ca3a2,_0x41be91){var _0x395087=util[_0x7a46('0x79')](_0x7a46('0x7a'),ISPEECH_API,_0x535c96,encodeURIComponent(_0x433926),_0x5ca3a2,_0x41be91);var _0x37c181=path[_0x7a46('0x25')](__dirname,_0x7a46('0x47'),rs['generate'](0x4)+_0x7a46('0x39'));var _0x2f11db;return downloadFile(_0x395087,_0x37c181)[_0x7a46('0x2a')](function(){_0x2f11db=path[_0x7a46('0x25')](__dirname,_0x7a46('0x47'),rs[_0x7a46('0x26')](0x4)+'.wav');return convertFile(_0x37c181,_0x2f11db);})['then'](function(){try{fs[_0x7a46('0x2b')](_0x37c181);fs[_0x7a46('0x2c')](_0x2f11db,_0x7a46('0x2d'));}catch(_0x901ab4){logger[_0x7a46('0x14')](_0x901ab4);}return _0x2f11db[_0x7a46('0x2e')]('.')[0x0];});};exports[_0x7a46('0x7b')]=function(_0x1e9e2f,_0x3169fd,_0x3ba2c9,_0x3e4431){var _0x427bc3=util[_0x7a46('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3169fd,_0x3ba2c9,base64Encode(_0x1e9e2f),_0x3e4431?util['format'](_0x7a46('0x7c'),encodeURIComponent(_0x3e4431)):_0x7a46('0x7d'));return uploadFile(_0x427bc3)['then'](function(_0x36f0b1){return querystring[_0x7a46('0x9')](_0x36f0b1);});};exports[_0x7a46('0x7e')]=function(_0x1fce27,_0x58c04e){return sestek[_0x7a46('0x7f')](_0x1fce27,_0x58c04e)[_0x7a46('0x2a')](function(_0x3f73bf){logger['info'](JSON[_0x7a46('0x3f')](_0x3f73bf));var _0x35e1c6={'speech':_0x3f73bf['text'],'action':_0x3f73bf[_0x7a46('0x80')]?_0x3f73bf['channelData'][_0x7a46('0x81')]:undefined,'actiondata':_0x3f73bf[_0x7a46('0x80')]?_0x3f73bf[_0x7a46('0x80')]['CustomActionData']:undefined};if(_0x3f73bf['channelData']&&_0x3f73bf['channelData'][_0x7a46('0x82')]){return base64Decode(_0x3f73bf[_0x7a46('0x80')][_0x7a46('0x82')][_0x7a46('0x83')],path['resolve'](__dirname,_0x7a46('0x47'),rs[_0x7a46('0x26')](0x4)+_0x7a46('0x27')))[_0x7a46('0x2a')](function(_0x126c34){_0x35e1c6[_0x7a46('0x84')]=_0x126c34;return _0x35e1c6;});}return _0x35e1c6;});};exports[_0x7a46('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x3441=['querystring','request-promise','randomstring','google-tts-api','url','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','data','wav','error\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','audioContent','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','action','actionIncomplete','speech','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','AudioFromTts','Data','audiofile','dirName','dialogflow','http'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x3441,0x102));var _0x1344=function(_0x1dfdd3,_0x3e1a05){_0x1dfdd3=_0x1dfdd3-0x0;var _0x4dbacf=_0x3441[_0x1dfdd3];return _0x4dbacf;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x1344('0x0'));var fs=require('fs');var http=require(_0x1344('0x1'));var https=require('https');var md5=require('md5');var path=require('path');var querystring=require(_0x1344('0x2'));var rp=require(_0x1344('0x3'));var rs=require(_0x1344('0x4'));var sox=require('sox');var tts=require(_0x1344('0x5'));var urlParse=require(_0x1344('0x6'))['parse'];var util=require('util');var aws=require(_0x1344('0x7'));var google=require(_0x1344('0x8'));var sestek=require(_0x1344('0x9'));var tilde=require(_0x1344('0xa'));var logger=require('../../../config/logger')(_0x1344('0xb'));var ISPEECH_API=_0x1344('0xc');function downloadFile(_0x2d39e9,_0x3ea521){return new BPromise(function(_0x9f38d6,_0x4be1ec){var _0x1cfae1=urlParse(_0x2d39e9);var _0x3160a3=_0x1cfae1[_0x1344('0xd')]===_0x1344('0xe')?https:http;var _0x1fe18b={'host':_0x1cfae1[_0x1344('0xf')],'path':_0x1cfae1[_0x1344('0x10')],'headers':{'user-agent':_0x1344('0x11')}};_0x3160a3[_0x1344('0x12')](_0x1fe18b,function(_0x221721){if(_0x221721[_0x1344('0x13')]!==0xc8){logger[_0x1344('0x14')](_0x1344('0x15')+_0x2d39e9+_0x1344('0x16')+_0x221721[_0x1344('0x13')]+'\x20('+_0x221721[_0x1344('0x17')]+')');_0x4be1ec(new Error(_0x1344('0x15')+_0x2d39e9+_0x1344('0x16')+_0x221721[_0x1344('0x13')]+'\x20('+_0x221721[_0x1344('0x17')]+')'));return;}var _0xba51e7=fs[_0x1344('0x18')](_0x3ea521);_0xba51e7['on'](_0x1344('0x19'),function(){logger[_0x1344('0x1a')](_0x1344('0x1b'));_0xba51e7['close'](_0x9f38d6);});_0xba51e7['on']('error',function(_0x2bfcc9){fs['unlink'](_0x3ea521);logger['error'](_0x1344('0x1c'),_0x2bfcc9);_0x4be1ec(_0x2bfcc9);});_0x221721[_0x1344('0x1d')](_0xba51e7);})['on'](_0x1344('0x14'),function(_0x5e3a83){logger[_0x1344('0x14')](_0x5e3a83);_0x4be1ec(_0x5e3a83);})[_0x1344('0x1e')]();});}function uploadFile(_0x2c048a){return new BPromise(function(_0x3eb33a,_0x112196){var _0x2bcff7=urlParse(_0x2c048a);var _0xde44f4=_0x2bcff7[_0x1344('0xd')]==='https:'?https:http;var _0x316773={'host':_0x2bcff7['host'],'path':_0x2bcff7[_0x1344('0x10')],'headers':{'user-agent':_0x1344('0x11')}};_0xde44f4['get'](_0x316773,function(_0x79d67e){if(_0x79d67e['statusCode']!==0xc8){_0x112196(new Error(_0x1344('0x15')+_0x2c048a+'\x20failed,\x20status\x20code\x20=\x20'+_0x79d67e[_0x1344('0x13')]+'\x20('+_0x79d67e['statusMessage']+')'));return;}var _0x5f4606='';_0x79d67e['on'](_0x1344('0x1f'),function(_0x3e5ee5){_0x5f4606+=_0x3e5ee5;});_0x79d67e['on'](_0x1344('0x1e'),function(){_0x3eb33a(_0x5f4606);});})['on'](_0x1344('0x14'),function(_0x516274){_0x112196(_0x516274);})['end']();});}function convertFile(_0x572399,_0xb91b54){return new BPromise(function(_0x169343,_0x18789e){var _0x5e4849=sox['transcode'](_0x572399,_0xb91b54,{'sampleRate':0x1f40,'format':_0x1344('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5e4849['on'](_0x1344('0x14'),function(_0x3e4205){logger[_0x1344('0x14')](_0x1344('0x21'),_0x3e4205);_0x18789e(_0x3e4205);});_0x5e4849['on'](_0x1344('0x1e'),function(){logger[_0x1344('0x1a')]('finish\x20to\x20convert');_0x169343();});_0x5e4849['start']();});}function base64Decode(_0x1d41a1,_0x2d96bc){var _0x16fa90=path[_0x1344('0x22')](__dirname,'tmp',rs[_0x1344('0x23')](0x4)+_0x1344('0x24'));fs[_0x1344('0x25')](_0x16fa90,_0x1d41a1,_0x1344('0x26'));return convertFile(_0x16fa90,_0x2d96bc)[_0x1344('0x27')](function(){try{fs[_0x1344('0x28')](_0x16fa90);fs[_0x1344('0x29')](_0x2d96bc,_0x1344('0x2a'));}catch(_0x447329){logger[_0x1344('0x14')](_0x447329);}return _0x2d96bc[_0x1344('0x2b')]('.')[0x0];});}function base64Encode(_0x44180d){var _0x2a3d1c=fs['readFileSync'](_0x44180d);return new Buffer(_0x2a3d1c)[_0x1344('0x2c')]('base64');}exports[_0x1344('0x2d')]=function(_0x42a274,_0x1f9f88,_0x261579,_0x2e17f7,_0x21e17a,_0x42878a){var _0x338f4a,_0x44fb7c;var _0x449d82='https://texttospeech.googleapis.com/v1/';var _0x31ebe1=_0x1344('0x2e')+_0x42a274;var _0x49dfb0={};if(_0x1f9f88==='ssml'){_0x49dfb0['input']={'ssml':_0x261579};}else{_0x49dfb0[_0x1344('0x2f')]={'text':_0x261579};};_0x49dfb0[_0x1344('0x30')]={'languageCode':_0x2e17f7,'ssmlGender':_0x21e17a};_0x49dfb0[_0x1344('0x31')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x43d2b9={'url':_0x449d82+_0x1344('0x32')+_0x31ebe1,'method':_0x1344('0x33'),'json':!![],'body':_0x49dfb0};return rp(_0x43d2b9)[_0x1344('0x27')](function(_0x31295d){return new BPromise(function(_0x1df516,_0x413518){_0x338f4a=path[_0x1344('0x22')](__dirname,_0x1344('0x34'),rs[_0x1344('0x23')](0x4)+_0x1344('0x35'));var _0x49f10e=Buffer[_0x1344('0x36')](_0x31295d[_0x1344('0x37')],_0x1344('0x26'));return fs['writeFile'](_0x338f4a,_0x49f10e,function(_0x35aa17){_0x413518(_0x35aa17);},function(_0x4a0182){fs['chmodSync'](_0x338f4a,_0x1344('0x2a'));_0x1df516(_0x4a0182);});});})['then'](function(_0x1e36a0){_0x44fb7c=path[_0x1344('0x22')](__dirname,_0x1344('0x34'),rs['generate'](0x4)+_0x1344('0x24'));return convertFile(_0x338f4a,_0x44fb7c);})[_0x1344('0x27')](function(){try{fs['unlink'](_0x338f4a);fs[_0x1344('0x29')](_0x44fb7c,_0x1344('0x2a'));}catch(_0x270b9d){logger['error'](_0x270b9d);}logger[_0x1344('0x1a')](_0x1344('0x38'),_0x44fb7c['split']('.')[0x0]);return _0x44fb7c['split']('.')[0x0];});};exports['googleTTS']=function(_0x579572,_0x2f937a){var _0xc0cd98=_0x1344('0x39');var _0x4a2ff7,_0x1061c7;var _0x3caa1b;var _0x180099={'encoding':_0x1344('0x3a'),'method':'POST','timeout':0x2710,'url':_0xc0cd98,'headers':{'Content-Type':_0x1344('0x3b')},'body':_0x1344('0x3c')+encodeURIComponent(JSON[_0x1344('0x3d')]([[['jQ1olc',JSON[_0x1344('0x3d')]([_0x579572,_0x2f937a||'en',![],_0x1344('0x3e')]),null,_0x1344('0x3f')]]]))};return rp(_0x180099)[_0x1344('0x27')](function(_0x54fc79){try{_0x3caa1b=eval(_0x54fc79[_0x1344('0x40')](0x5))[0x0][0x2];}catch(_0x458491){throw new Error(_0x1344('0x41')+_0x54fc79[_0x1344('0x1f')]);}if(!_0x3caa1b){if(_0x579572['length']>0xc8){throw new Error(_0x1344('0x42'));}else{throw new Error(_0x1344('0x43')+_0x2f937a+'\x22\x20might\x20not\x20exist');}}try{_0x3caa1b=eval(_0x3caa1b)[0x0];}catch(_0x9ac409){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1344('0x1f')]);}const _0x4726c2=_0x3caa1b;_0x4a2ff7=path['resolve'](__dirname,_0x1344('0x34'),rs[_0x1344('0x23')](0x4)+_0x1344('0x35'));fs[_0x1344('0x25')](_0x4a2ff7,_0x3caa1b,{'encoding':'base64'});_0x1061c7=path[_0x1344('0x22')](__dirname,_0x1344('0x34'),rs['generate'](0x4)+'.wav');return convertFile(_0x4a2ff7,_0x1061c7);})[_0x1344('0x27')](function(){try{fs['unlink'](_0x4a2ff7);fs[_0x1344('0x29')](_0x1061c7,_0x1344('0x2a'));}catch(_0x48fc09){logger[_0x1344('0x14')](_0x48fc09);}logger['info'](_0x1344('0x44'),_0x1061c7[_0x1344('0x2b')]('.')[0x0]);return _0x1061c7[_0x1344('0x2b')]('.')[0x0];});};exports[_0x1344('0x45')]=function(_0x3fdff4,_0xb365bf,_0x42490c){return google[_0x1344('0x46')](_0x3fdff4,_0xb365bf,_0x42490c)['then'](function(_0x1678b5){logger[_0x1344('0x1a')](_0x1678b5[_0x1344('0x47')]);return rp(_0x1678b5);})['then'](function(_0x30bff5){var _0x4e2683='';var _0x26972d=0x0;try{fs['unlink'](_0x3fdff4);}catch(_0x1ba922){logger['error'](_0x1ba922);}if(_0x30bff5&&_0x30bff5[_0x1344('0x48')]){_0x4e2683=_0x30bff5[_0x1344('0x48')]['map'](function(_0x384bbb){return _0x384bbb&&_0x384bbb[_0x1344('0x49')][0x0]&&_0x384bbb[_0x1344('0x49')][0x0]['transcript']?_0x384bbb[_0x1344('0x49')][0x0][_0x1344('0x4a')]:'';})[_0x1344('0x4b')]('\x0a');_0x26972d=_0x30bff5['results']['map'](function(_0x4c44e2){return _0x4c44e2&&_0x4c44e2[_0x1344('0x49')][0x0]&&_0x4c44e2[_0x1344('0x49')][0x0][_0x1344('0x4c')]?_0x4c44e2[_0x1344('0x49')][0x0][_0x1344('0x4c')]:0x0;})[_0x1344('0x4b')]('\x0a');}logger[_0x1344('0x1a')](_0x1344('0x4d'),_0x4e2683);logger[_0x1344('0x1a')](_0x1344('0x4e'),_0x26972d);return{'transcript':_0x4e2683,'confidence':_0x26972d};})[_0x1344('0x4f')](function(_0xdf149e){logger[_0x1344('0x14')](_0x1344('0x50'),_0xdf149e['statusCode'],_0xdf149e[_0x1344('0x51')],_0xdf149e[_0x1344('0x52')]);});};exports[_0x1344('0x53')]=function(_0x47625f,_0x4e20ce,_0x21c621,_0x39ff70){var _0x411363=apiai(_0x4e20ce,{'language':_0x39ff70||'en'});return _0x411363[_0x1344('0x54')](_0x21c621,{'sessionId':md5(_0x47625f)})['then'](function(_0x133fe0){logger['info'](JSON[_0x1344('0x3d')](_0x133fe0));return{'source':_0x133fe0['result'][_0x1344('0x55')],'resolvedQuery':_0x133fe0['result'][_0x1344('0x56')],'action':_0x133fe0[_0x1344('0x57')][_0x1344('0x58')],'actionIncomplete':_0x133fe0[_0x1344('0x57')][_0x1344('0x59')],'speech':_0x133fe0[_0x1344('0x57')]['fulfillment'][_0x1344('0x5a')],'score':_0x133fe0[_0x1344('0x57')]['score'],'statusCode':_0x133fe0[_0x1344('0x5b')][_0x1344('0x5c')],'endConversation':_0x133fe0[_0x1344('0x57')][_0x1344('0x5d')][_0x1344('0x5e')]||![],'isFallbackIntent':_0x133fe0[_0x1344('0x57')]['metadata']['isFallbackIntent']};});};exports[_0x1344('0x5f')]=function(_0x23632c,_0x1d904e,_0x13bfec,_0x3d275d,_0x19fcd6,_0x1da630){var _0xfdc51b=_0x3d275d[_0x1344('0x60')](/\\n/g,'\x0a');var _0x2b92ff={'credentials':{'private_key':_0xfdc51b,'client_email':_0x13bfec}};var _0x54150a=new dialogflow[(_0x1344('0x61'))](_0x2b92ff);var _0x4c2fe4=_0x54150a[_0x1344('0x62')](_0x1d904e,md5(_0x23632c));var _0x48073a={'session':_0x4c2fe4,'queryInput':{'text':{'text':_0x19fcd6,'languageCode':_0x1da630}}};return _0x54150a['detectIntent'](_0x48073a)[_0x1344('0x27')](function(_0x2f9c70){if(_0x2f9c70&&_0x2f9c70['length']){logger[_0x1344('0x1a')](_0x1344('0x63'),JSON[_0x1344('0x3d')](_0x2f9c70));var _0x335a75=_0x2f9c70[0x0];if(_0x335a75){var _0x1fa312={'action':_0x335a75[_0x1344('0x64')][_0x1344('0x58')],'allRequiredParamsPresent':_0x335a75['queryResult']['allRequiredParamsPresent'],'endConversation':_0x335a75[_0x1344('0x64')]['diagnosticInfo']&&_0x335a75['queryResult'][_0x1344('0x65')][_0x1344('0x66')]?_0x335a75[_0x1344('0x64')][_0x1344('0x65')][_0x1344('0x66')][_0x1344('0x67')][_0x1344('0x68')]:![],'fulfillmentText':_0x335a75['queryResult'][_0x1344('0x69')],'intentName':_0x335a75[_0x1344('0x64')][_0x1344('0x6a')][_0x1344('0x51')],'intentDisplayName':_0x335a75[_0x1344('0x64')]['intent']['displayName'],'isFallbackIntent':_0x335a75['queryResult'][_0x1344('0x6a')][_0x1344('0x6b')],'languageCode':_0x335a75[_0x1344('0x64')][_0x1344('0x6c')],'queryText':_0x335a75['queryResult'][_0x1344('0x6d')],'responseId':_0x335a75[_0x1344('0x6e')],'score':_0x335a75['queryResult']['intentDetectionConfidence'],'speech':_0x335a75[_0x1344('0x64')][_0x1344('0x69')],'providerResponse':JSON[_0x1344('0x3d')](_0x2f9c70)};return _0x1fa312;}}});};exports[_0x1344('0x6f')]=function(_0x2eece0,_0x211f3d,_0x5336ba,_0x3fb460){return tilde[_0x1344('0x46')](_0x2eece0,_0x211f3d,_0x5336ba,_0x3fb460)[_0x1344('0x27')](function(_0x56d039){try{fs[_0x1344('0x28')](_0x2eece0);}catch(_0x474d31){logger['error'](_0x474d31);}logger[_0x1344('0x1a')]('Tilde\x20ASR\x20transcription',_0x56d039[_0x1344('0x4a')]);logger[_0x1344('0x1a')](_0x1344('0x70'),_0x56d039[_0x1344('0x4c')]);return _0x56d039;});};exports[_0x1344('0x71')]=function(_0x5ce533,_0x2d18b6,_0x1a3f15,_0x4972af,_0x19270a,_0x327b05){var _0x8f12b0=path['resolve'](__dirname,_0x1344('0x34'),rs[_0x1344('0x23')](0x4)+_0x1344('0x35'));var _0x181fee;return aws[_0x1344('0x72')](_0x5ce533,_0x2d18b6,_0x1a3f15,_0x4972af,_0x19270a,_0x327b05,_0x8f12b0)[_0x1344('0x27')](function(){_0x181fee=path[_0x1344('0x22')](__dirname,'tmp',rs[_0x1344('0x23')](0x4)+_0x1344('0x24'));return convertFile(_0x8f12b0,_0x181fee);})[_0x1344('0x27')](function(){try{fs['unlink'](_0x8f12b0);fs[_0x1344('0x29')](_0x181fee,_0x1344('0x2a'));}catch(_0x45e701){logger['error'](_0x45e701);}return _0x181fee[_0x1344('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x66a1a3,_0x26ca07,_0x347d75,_0x17b028,_0xd5acaf,_0x1e70ba){return aws[_0x1344('0x73')](_0x66a1a3,_0x26ca07,_0x347d75,_0x17b028,_0xd5acaf,_0x1e70ba)[_0x1344('0x27')](function(_0x377bea){logger[_0x1344('0x1a')](JSON['stringify'](_0x377bea));return _0x377bea;});};exports[_0x1344('0x74')]=function(_0x416270,_0x3a11b8,_0xf3465e,_0x6e5be1){var _0x531e38=util[_0x1344('0x75')](_0x1344('0x76'),ISPEECH_API,_0x416270,encodeURIComponent(_0x3a11b8),_0xf3465e,_0x6e5be1);var _0x264b6f=path[_0x1344('0x22')](__dirname,_0x1344('0x34'),rs[_0x1344('0x23')](0x4)+_0x1344('0x35'));var _0x5b2b71;return downloadFile(_0x531e38,_0x264b6f)[_0x1344('0x27')](function(){_0x5b2b71=path['resolve'](__dirname,_0x1344('0x34'),rs['generate'](0x4)+_0x1344('0x24'));return convertFile(_0x264b6f,_0x5b2b71);})['then'](function(){try{fs[_0x1344('0x28')](_0x264b6f);fs['chmodSync'](_0x5b2b71,_0x1344('0x2a'));}catch(_0x8e77fc){logger['error'](_0x8e77fc);}return _0x5b2b71[_0x1344('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x229a5e,_0x26567b,_0x35fc00,_0x28e7dd){var _0x346a08=util[_0x1344('0x75')](_0x1344('0x77'),ISPEECH_API,_0x26567b,_0x35fc00,base64Encode(_0x229a5e),_0x28e7dd?util[_0x1344('0x75')](_0x1344('0x78'),encodeURIComponent(_0x28e7dd)):_0x1344('0x79'));return uploadFile(_0x346a08)[_0x1344('0x27')](function(_0x46d845){return querystring[_0x1344('0x7a')](_0x46d845);});};exports[_0x1344('0x7b')]=function(_0x47c98c,_0x6259f2){return sestek[_0x1344('0x7c')](_0x47c98c,_0x6259f2)[_0x1344('0x27')](function(_0x5d4c79){logger[_0x1344('0x1a')](JSON[_0x1344('0x3d')](_0x5d4c79));var _0x107d9b={'speech':_0x5d4c79['text'],'action':_0x5d4c79[_0x1344('0x7d')]?_0x5d4c79[_0x1344('0x7d')]['CustomAction']:undefined,'actiondata':_0x5d4c79['channelData']?_0x5d4c79[_0x1344('0x7d')]['CustomActionData']:undefined};if(_0x5d4c79[_0x1344('0x7d')]&&_0x5d4c79['channelData'][_0x1344('0x7e')]){return base64Decode(_0x5d4c79[_0x1344('0x7d')][_0x1344('0x7e')][_0x1344('0x7f')],path[_0x1344('0x22')](__dirname,_0x1344('0x34'),rs[_0x1344('0x23')](0x4)+_0x1344('0x24')))['then'](function(_0x172b83){_0x107d9b[_0x1344('0x80')]=_0x172b83;return _0x107d9b;});}return _0x107d9b;});};exports[_0x1344('0x81')]=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 9c3ec67..edee5bc 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 _0x414a=['./nda'];(function(_0x1345fa,_0x11947a){var _0xc32585=function(_0x178016){while(--_0x178016){_0x1345fa['push'](_0x1345fa['shift']());}};_0xc32585(++_0x11947a);}(_0x414a,0x1c3));var _0xa414=function(_0x8f5fc3,_0x232d2a){_0x8f5fc3=_0x8f5fc3-0x0;var _0x48bbf4=_0x414a[_0x8f5fc3];return _0x48bbf4;};var nda=require(_0xa414('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x2ccb=['exports','./nda'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2ccb,0xd5));var _0xb2cc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x2ccb[_0x46698a];return _0x356db0;};var nda=require(_0xb2cc('0x0'));module[_0xb2cc('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 72a50ef..2393d7c 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 _0x7ae7=['AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','calleridname','dnid','extension','Bearer\x20','access_token','body','channelData','ProjectName'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0x7ae7,0xd9));var _0x77ae=function(_0x43cfd6,_0x1de38f){_0x43cfd6=_0x43cfd6-0x0;var _0x43f4c2=_0x7ae7[_0x43cfd6];return _0x43f4c2;};'use strict';var rp=require(_0x77ae('0x0'));var url=require(_0x77ae('0x1'));var logger=require('../../../../../config/logger')(_0x77ae('0x2'));module[_0x77ae('0x3')]=function(_0x176048,_0xf7c23c){var _0xa7b0de={'method':_0x77ae('0x4'),'uri':url[_0x77ae('0x5')](_0xf7c23c[_0x77ae('0x6')],_0x77ae('0x7')),'form':{'grant_type':_0x77ae('0x8'),'username':_0xf7c23c[_0x77ae('0x9')],'password':_0xf7c23c[_0x77ae('0x8')]},'json':!![]};return rp(_0xa7b0de)[_0x77ae('0xa')](function(_0x56197f){var _0x131f0b={'method':_0x77ae('0x4'),'uri':url[_0x77ae('0x5')](_0xf7c23c[_0x77ae('0xb')],_0x77ae('0xc')),'body':{'type':_0xf7c23c[_0x77ae('0xd')]||'message','channelId':_0x77ae('0xe'),'conversation':{'id':_0x176048['uniqueid']},'from':{'id':_0x176048['callerid'],'name':_0x176048[_0x77ae('0xf')]},'recipient':{'id':_0x176048[_0x77ae('0x10')],'name':_0x176048[_0x77ae('0x11')]},'text':_0xf7c23c['text'],'channelData':{}},'headers':{'Authorization':_0x77ae('0x12')+_0x56197f[_0x77ae('0x13')]},'json':!![]};if(_0xf7c23c['project']){_0x131f0b[_0x77ae('0x14')][_0x77ae('0x15')][_0x77ae('0x16')]=_0xf7c23c['project'];}if(_0xf7c23c['ndagenerate_audio']=='1'){_0x131f0b[_0x77ae('0x14')][_0x77ae('0x15')][_0x77ae('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x77ae('0x18')};}if(_0xf7c23c[_0x77ae('0x19')]){_0x131f0b[_0x77ae('0x14')]['channelData']['CustomAction']=_0xf7c23c[_0x77ae('0x19')];if(_0xf7c23c[_0x77ae('0x1a')]){_0x131f0b[_0x77ae('0x14')]['channelData'][_0x77ae('0x1b')]=_0xf7c23c[_0x77ae('0x1a')];}}logger[_0x77ae('0x1c')](JSON[_0x77ae('0x1d')](_0x131f0b));return rp(_0x131f0b);});}; \ No newline at end of file +var _0xa571=['calleridname','dnid','extension','access_token','project','body','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','channelData','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','/token','password','username','then','POST','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x598fa0,_0x183280){var _0x29a6ab=function(_0x2f82f9){while(--_0x2f82f9){_0x598fa0['push'](_0x598fa0['shift']());}};_0x29a6ab(++_0x183280);}(_0xa571,0x107));var _0x1a57=function(_0x3605fb,_0x28324b){_0x3605fb=_0x3605fb-0x0;var _0x1ce016=_0xa571[_0x3605fb];return _0x1ce016;};'use strict';var rp=require(_0x1a57('0x0'));var url=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));module['exports']=function(_0x1a071f,_0x2eebaa){var _0x4d5f7a={'method':'POST','uri':url[_0x1a57('0x4')](_0x2eebaa['ndauth_url'],_0x1a57('0x5')),'form':{'grant_type':_0x1a57('0x6'),'username':_0x2eebaa[_0x1a57('0x7')],'password':_0x2eebaa[_0x1a57('0x6')]},'json':!![]};return rp(_0x4d5f7a)[_0x1a57('0x8')](function(_0x924873){var _0x5d9f45={'method':_0x1a57('0x9'),'uri':url[_0x1a57('0x4')](_0x2eebaa[_0x1a57('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x2eebaa[_0x1a57('0xb')]||_0x1a57('0xc'),'channelId':_0x1a57('0xd'),'conversation':{'id':_0x1a071f[_0x1a57('0xe')]},'from':{'id':_0x1a071f[_0x1a57('0xf')],'name':_0x1a071f[_0x1a57('0x10')]},'recipient':{'id':_0x1a071f[_0x1a57('0x11')],'name':_0x1a071f[_0x1a57('0x12')]},'text':_0x2eebaa['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x924873[_0x1a57('0x13')]},'json':!![]};if(_0x2eebaa[_0x1a57('0x14')]){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x16')]=_0x2eebaa[_0x1a57('0x14')];}if(_0x2eebaa['ndagenerate_audio']=='1'){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1a57('0x18')};}if(_0x2eebaa[_0x1a57('0x19')]){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x1a')]=_0x2eebaa['custom_action'];if(_0x2eebaa['custom_action_data']){_0x5d9f45[_0x1a57('0x15')][_0x1a57('0x1b')][_0x1a57('0x1c')]=_0x2eebaa['custom_action_data'];}}logger[_0x1a57('0x1d')](JSON[_0x1a57('0x1e')](_0x5d9f45));return rp(_0x5d9f45);});}; \ 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 e593cf2..e74255c 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 _0xde66=['./lib/api','exports'];(function(_0x4def1b,_0xa61dda){var _0x1dc1f0=function(_0x14b741){while(--_0x14b741){_0x4def1b['push'](_0x4def1b['shift']());}};_0x1dc1f0(++_0xa61dda);}(_0xde66,0xde));var _0x6de6=function(_0x1a37b2,_0x584b3b){_0x1a37b2=_0x1a37b2-0x0;var _0x130c75=_0xde66[_0x1a37b2];return _0x130c75;};'use strict';var asr=require(_0x6de6('0x0'));module[_0x6de6('0x1')]=function(_0x66e531,_0x4a39b0,_0x1d4ec8,_0x3154b0){return asr(_0x66e531,_0x4a39b0,_0x1d4ec8,_0x3154b0);}; \ No newline at end of file +var _0x04c7=['exports'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x04c7,0xae));var _0x704c=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x04c7[_0x2b0875];return _0xedb8d7;};'use strict';var asr=require('./lib/api');module[_0x704c('0x0')]=function(_0x2c3b55,_0x2c6e5f,_0x3b6150,_0x4c3365){return asr(_0x2c3b55,_0x2c6e5f,_0x3b6150,_0x4c3365);}; \ 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 d8026d1..87b7d08 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 _0x74df=['update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','error','stringify','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74df,0x1ca));var _0xf74d=function(_0x3221f8,_0x4a18bd){_0x3221f8=_0x3221f8-0x0;var _0x3794c4=_0x74df[_0x3221f8];return _0x3794c4;};'use strict';var BPromise=require(_0xf74d('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xf74d('0x1'));var logger=require(_0xf74d('0x2'))(_0xf74d('0x3'));module[_0xf74d('0x4')]=function(_0x504daa,_0x54fcdf,_0x30a7a3,_0xd869cf){return new BPromise(function(_0x24cd94,_0x2a8e97){logger[_0xf74d('0x5')]('Tilde\x20URI',_0xd869cf||_0xf74d('0x6'));var _0x160115=new WebSocket(_0xd869cf||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x21bb30='';var _0x19db3b='0';var _0x3ed775='1';var _0x4a191c=_0xf74d('0x7');function _0x417852(_0x49e576){var _0x4109bf=crypto[_0xf74d('0x8')](_0xf74d('0x9'));_0x4109bf[_0xf74d('0xa')](_0x49e576);return _0x4109bf[_0xf74d('0xb')]('hex');}function _0xf04629(){try{logger[_0xf74d('0x5')](_0xf74d('0xc'));var _0x54c1af=moment()[_0xf74d('0xd')]();var _0x2f341a=_0x417852(_0x54c1af+_0x54fcdf+_0x30a7a3);_0x160115[_0xf74d('0xe')](JSON['stringify']({'appID':_0x54fcdf,'timestamp':_0x54c1af,'appKey':_0x2f341a}));var _0x3f25fe=fs[_0xf74d('0xf')](_0x504daa);_0x3f25fe['on']('data',function(_0x721f50){_0x160115['send'](_0x721f50);});_0x3f25fe['on'](_0xf74d('0x10'),function(){_0x160115[_0xf74d('0xe')](_0xf74d('0x11'));});}catch(_0x58e362){logger[_0xf74d('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0xf74d('0x13')](_0x58e362));_0x160115['terminate']();}}function _0x51d6ae(_0x30ee25){try{if(_0x30ee25){var _0x3474f8=JSON[_0xf74d('0x14')](_0x30ee25);switch(_0x3474f8[_0xf74d('0x15')]){case 0x0:if(_0x3474f8['result']){if(_0x3474f8['result'][_0xf74d('0x16')]){logger[_0xf74d('0x5')](_0xf74d('0x17'),JSON[_0xf74d('0x13')](_0x3474f8[_0xf74d('0x18')]['hypotheses']));_0x21bb30=_0x3474f8[_0xf74d('0x18')]['hypotheses'][0x0]['transcript'];_0x19db3b=_0x3474f8[_0xf74d('0x18')][_0xf74d('0x19')][0x0][_0xf74d('0x1a')];_0x3ed775='0';_0x4a191c=_0xf74d('0x1b');_0x160115[_0xf74d('0x1c')]();}}break;case 0x1:logger[_0xf74d('0x5')](_0xf74d('0x7'));_0x3ed775='1';_0x4a191c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf74d('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3ed775='2';_0x4a191c=_0xf74d('0x1d');break;case 0x9:logger[_0xf74d('0x5')](_0xf74d('0x1e'));_0x3ed775='9';_0x4a191c=_0xf74d('0x1e');break;case 0xa:logger['info'](_0xf74d('0x1f'));_0x3ed775='10';_0x4a191c=_0xf74d('0x1f');break;case 0xb:logger[_0xf74d('0x5')](_0xf74d('0x20'));_0x3ed775='11';_0x4a191c=_0xf74d('0x20');}}}catch(_0x31e5c8){logger['error'](_0xf74d('0x21'),JSON[_0xf74d('0x13')](_0x31e5c8));_0x160115[_0xf74d('0x1c')]();}}function _0x3f3e0c(){logger[_0xf74d('0x5')](_0xf74d('0x22'));_0x24cd94({'transcript':_0x21bb30,'confidence':_0x19db3b,'status':_0x3ed775,'status_message':_0x4a191c});}function _0x9d0df6(_0x2b6e56){logger[_0xf74d('0x12')](_0xf74d('0x23'));if(!_[_0xf74d('0x24')](_0x2b6e56)){logger[_0xf74d('0x12')](_[_0xf74d('0x25')](_0x2b6e56)?JSON[_0xf74d('0x13')](_0x2b6e56):_0x2b6e56);}}_0x160115['on']('open',_0xf04629);_0x160115['on'](_0xf74d('0x26'),_0x51d6ae);_0x160115['on'](_0xf74d('0x10'),_0x3f3e0c);_0x160115['on']('error',_0x9d0df6);});}; \ No newline at end of file +var _0x9225=['send','stringify','data','close','EOS','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x22e1d3,_0x5a7c0c){var _0x124619=function(_0xba7301){while(--_0xba7301){_0x22e1d3['push'](_0x22e1d3['shift']());}};_0x124619(++_0x5a7c0c);}(_0x9225,0xaa));var _0x5922=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9225[_0x21549c];return _0x426cbd;};'use strict';var BPromise=require(_0x5922('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5922('0x1'));var crypto=require(_0x5922('0x2'));var logger=require(_0x5922('0x3'))(_0x5922('0x4'));module['exports']=function(_0x1142af,_0x3bb957,_0x34d3e0,_0x4c59c4){return new BPromise(function(_0x3ba4b3,_0x3f1e17){logger[_0x5922('0x5')](_0x5922('0x6'),_0x4c59c4||_0x5922('0x7'));var _0x1521d0=new WebSocket(_0x4c59c4||_0x5922('0x7'),{'perMessageDeflate':![]});var _0x3672ab='';var _0x461c6f='0';var _0x33c13c='1';var _0x155206=_0x5922('0x8');function _0x2fff5a(_0x4acdd0){var _0x162bf0=crypto[_0x5922('0x9')](_0x5922('0xa'));_0x162bf0[_0x5922('0xb')](_0x4acdd0);return _0x162bf0[_0x5922('0xc')](_0x5922('0xd'));}function _0xcf31f1(){try{logger['info'](_0x5922('0xe'));var _0x2bb5b8=moment()['unix']();var _0x5818a8=_0x2fff5a(_0x2bb5b8+_0x3bb957+_0x34d3e0);_0x1521d0[_0x5922('0xf')](JSON[_0x5922('0x10')]({'appID':_0x3bb957,'timestamp':_0x2bb5b8,'appKey':_0x5818a8}));var _0x37d78e=fs['createReadStream'](_0x1142af);_0x37d78e['on'](_0x5922('0x11'),function(_0x59a18f){_0x1521d0[_0x5922('0xf')](_0x59a18f);});_0x37d78e['on'](_0x5922('0x12'),function(){_0x1521d0[_0x5922('0xf')](_0x5922('0x13'));});}catch(_0x575845){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x5922('0x10')](_0x575845));_0x1521d0[_0x5922('0x14')]();}}function _0x1e39b6(_0x228840){try{if(_0x228840){var _0x3a98a4=JSON[_0x5922('0x15')](_0x228840);switch(_0x3a98a4['status']){case 0x0:if(_0x3a98a4[_0x5922('0x16')]){if(_0x3a98a4[_0x5922('0x16')]['final']){logger['info'](_0x5922('0x17'),JSON[_0x5922('0x10')](_0x3a98a4['result'][_0x5922('0x18')]));_0x3672ab=_0x3a98a4['result']['hypotheses'][0x0]['transcript'];_0x461c6f=_0x3a98a4[_0x5922('0x16')][_0x5922('0x18')][0x0]['likelihood'];_0x33c13c='0';_0x155206=_0x5922('0x19');_0x1521d0[_0x5922('0x14')]();}}break;case 0x1:logger[_0x5922('0x5')](_0x5922('0x8'));_0x33c13c='1';_0x155206='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x5922('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x33c13c='2';_0x155206=_0x5922('0x1a');break;case 0x9:logger[_0x5922('0x5')](_0x5922('0x1b'));_0x33c13c='9';_0x155206=_0x5922('0x1b');break;case 0xa:logger[_0x5922('0x5')]('Authentication\x20failed.');_0x33c13c='10';_0x155206=_0x5922('0x1c');break;case 0xb:logger[_0x5922('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x33c13c='11';_0x155206=_0x5922('0x1d');}}}catch(_0x5d4c4d){logger[_0x5922('0x1e')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x5922('0x10')](_0x5d4c4d));_0x1521d0['terminate']();}}function _0x3e876b(){logger[_0x5922('0x5')](_0x5922('0x1f'));_0x3ba4b3({'transcript':_0x3672ab,'confidence':_0x461c6f,'status':_0x33c13c,'status_message':_0x155206});}function _0x30311f(_0x19c87c){logger['error'](_0x5922('0x20'));if(!_[_0x5922('0x21')](_0x19c87c)){logger[_0x5922('0x1e')](_[_0x5922('0x22')](_0x19c87c)?JSON[_0x5922('0x10')](_0x19c87c):_0x19c87c);}}_0x1521d0['on'](_0x5922('0x23'),_0xcf31f1);_0x1521d0['on'](_0x5922('0x24'),_0x1e39b6);_0x1521d0['on'](_0x5922('0x12'),_0x3e876b);_0x1521d0['on'](_0x5922('0x1e'),_0x30311f);});}; \ 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 458a1c3..9545066 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 _0x427a=['exports','./asr'];(function(_0x57525f,_0x2e7401){var _0x3a15ad=function(_0x5a2a65){while(--_0x5a2a65){_0x57525f['push'](_0x57525f['shift']());}};_0x3a15ad(++_0x2e7401);}(_0x427a,0x10d));var _0xa427=function(_0x458447,_0x25943d){_0x458447=_0x458447-0x0;var _0x436b86=_0x427a[_0x458447];return _0x436b86;};var asr=require(_0xa427('0x0'));module[_0xa427('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7809=['./asr'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7809,0x65));var _0x9780=function(_0x34ba76,_0x55a489){_0x34ba76=_0x34ba76-0x0;var _0x20d0f1=_0x7809[_0x34ba76];return _0x20d0f1;};var asr=require(_0x9780('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8f6ce83..efa9f77 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 _0x47a7=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x47a7,0x113));var _0x747a=function(_0x2bbd23,_0x43c40f){_0x2bbd23=_0x2bbd23-0x0;var _0x4dc031=_0x47a7[_0x2bbd23];return _0x4dc031;};'use strict';var util=require(_0x747a('0x0'));var net=require(_0x747a('0x1'));var EventEmitter=require(_0x747a('0x2'))['EventEmitter'];var AGIError=require(_0x747a('0x3'));var AGIChannel=require(_0x747a('0x4'));var AGIServer=function(_0x111b15,_0x1b3c18,_0x584dce){var _0x555897=this,_0x111b15=_0x111b15||0x11dd,_0x1b3c18=_0x1b3c18||_0x747a('0x5'),_0x6fb653=null,_0x39647b=0x0;EventEmitter['call'](_0x555897);function _0x14cd66(){if(!_0x111b15){_0x555897[_0x747a('0x6')](_0x747a('0x7'),new AGIError(_0x747a('0x8')));return![];}_0x6fb653=net[_0x747a('0x9')]();_0x6fb653[_0x747a('0xa')](_0x111b15,_0x1b3c18);_0x6fb653['on'](_0x747a('0xb'),function(){_0x555897[_0x747a('0x6')](_0x747a('0xb'));});_0x6fb653['on'](_0x747a('0xc'),function(_0x33a7c6){_0x6fb653[_0x747a('0xd')](function(_0x5304eb,_0x57ab9f){if(_0x5304eb){_0x555897[_0x747a('0x6')](_0x747a('0x7'),new AGIError(_0x747a('0xe'),_0x5304eb));}else if(_0x584dce&&_0x584dce<0x0){_0x555897['emit']('error',new AGIError(_0x747a('0xf')));_0x33a7c6[_0x747a('0x10')]();}else if(_0x584dce&&_0x584dce>0x0&&_0x584dce<_0x57ab9f){_0x39647b+=0x1;_0x555897[_0x747a('0x6')](_0x747a('0x7'),new AGIError(_0x747a('0x11'),_0x39647b));_0x33a7c6['destroy']();}else{var _0x3009bc=new AGIChannel(_0x33a7c6);_0x3009bc['on'](_0x747a('0x12'),function(){_0x555897['emit']('connection',_0x3009bc);});}});});_0x6fb653['on'](_0x747a('0x7'),function(_0x3a904c){_0x555897[_0x747a('0x6')](_0x747a('0x7'),new AGIError(_0x747a('0xe'),_0x3a904c['code']));});_0x6fb653['on'](_0x747a('0x13'),function(){_0x555897[_0x747a('0x6')](_0x747a('0x13'),new AGIError(_0x747a('0x14')));});}process[_0x747a('0x15')](function(){_0x14cd66();});};util[_0x747a('0x16')](AGIServer,EventEmitter);module[_0x747a('0x17')]=function(_0x12b940,_0x5d90c1,_0x58ce55){return new AGIServer(_0x12b940,_0x5d90c1,_0x58ce55);}; \ No newline at end of file +var _0x7a7d=['nextTick','inherits','exports','util','net','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','connection','code'];(function(_0x347f9d,_0x2bc1d8){var _0x4dfb44=function(_0x1fef10){while(--_0x1fef10){_0x347f9d['push'](_0x347f9d['shift']());}};_0x4dfb44(++_0x2bc1d8);}(_0x7a7d,0x146));var _0xd7a7=function(_0x2fe632,_0x109da9){_0x2fe632=_0x2fe632-0x0;var _0x20c5e0=_0x7a7d[_0x2fe632];return _0x20c5e0;};'use strict';var util=require(_0xd7a7('0x0'));var net=require(_0xd7a7('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xd7a7('0x2'));var AGIServer=function(_0x2c3ba5,_0x54d608,_0x5943bb){var _0x217591=this,_0x2c3ba5=_0x2c3ba5||0x11dd,_0x54d608=_0x54d608||'127.0.0.1',_0x3318b2=null,_0x3cf11c=0x0;EventEmitter[_0xd7a7('0x3')](_0x217591);function _0x3b4890(){if(!_0x2c3ba5){_0x217591[_0xd7a7('0x4')](_0xd7a7('0x5'),new AGIError(_0xd7a7('0x6')));return![];}_0x3318b2=net[_0xd7a7('0x7')]();_0x3318b2[_0xd7a7('0x8')](_0x2c3ba5,_0x54d608);_0x3318b2['on']('listening',function(){_0x217591['emit'](_0xd7a7('0x9'));});_0x3318b2['on']('connection',function(_0x5b39b4){_0x3318b2[_0xd7a7('0xa')](function(_0xb7c8d5,_0x331940){if(_0xb7c8d5){_0x217591[_0xd7a7('0x4')](_0xd7a7('0x5'),new AGIError(_0xd7a7('0xb'),_0xb7c8d5));}else if(_0x5943bb&&_0x5943bb<0x0){_0x217591[_0xd7a7('0x4')](_0xd7a7('0x5'),new AGIError(_0xd7a7('0xc')));_0x5b39b4['destroy']();}else if(_0x5943bb&&_0x5943bb>0x0&&_0x5943bb<_0x331940){_0x3cf11c+=0x1;_0x217591[_0xd7a7('0x4')](_0xd7a7('0x5'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3cf11c));_0x5b39b4[_0xd7a7('0xd')]();}else{var _0x1f8b9f=new AGIChannel(_0x5b39b4);_0x1f8b9f['on']('ready',function(){_0x217591[_0xd7a7('0x4')](_0xd7a7('0xe'),_0x1f8b9f);});}});});_0x3318b2['on'](_0xd7a7('0x5'),function(_0x579391){_0x217591[_0xd7a7('0x4')]('error',new AGIError(_0xd7a7('0xb'),_0x579391[_0xd7a7('0xf')]));});_0x3318b2['on']('close',function(){_0x217591[_0xd7a7('0x4')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xd7a7('0x10')](function(){_0x3b4890();});};util[_0xd7a7('0x11')](AGIServer,EventEmitter);module[_0xd7a7('0x12')]=function(_0x5edefb,_0x12b585,_0x3945ed){return new AGIServer(_0x5edefb,_0x12b585,_0x3945ed);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index fc39f51..deb03be 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 _0xaa1b=['setVariable','split','replaceAll','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','options','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','NOBEEP','intKey','tildeASR','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','no\x20condition\x20configured','condition','false','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','randomstring','mustache','request-promise','../../config/environment/shared','./scripts','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','toString','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','timeout','number','includes','method','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','url','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0xbaa1('0x0'));var _=require(_0xbaa1('0x1'));var sh=require(_0xbaa1('0x2'));var odbc=require('odbc')();var rs=require(_0xbaa1('0x3'));var moment=require('moment');var Mustache=require(_0xbaa1('0x4'));var rp=require(_0xbaa1('0x5'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var shared=require(_0xbaa1('0x6'));var scripts=require(_0xbaa1('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xbaa1('0x8'),'rawBody'];var verticesWithRetry=[_0xbaa1('0x9'),_0xbaa1('0xa'),_0xbaa1('0xb')];var AGIVertices=function(_0x199376,_0x207b80,_0x1159ee){this['channel']=_0x199376;this[_0xbaa1('0xc')]=_0x207b80;this[_0xbaa1('0xd')]=_0x1159ee;};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xf')]=function(_0x1548da,_0x27d02f){this[_0xbaa1('0xc')][_0xbaa1('0x10')](_0x1548da)[_0xbaa1('0x11')](function(_0xcc0547){_0x27d02f(null,_0xcc0547?_0xcc0547[_0xbaa1('0x12')]:![]);})[_0xbaa1('0x13')](function(_0x5064a4){_0x27d02f(_0x5064a4);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x4f18b0,_0x2184ab){this[_0xbaa1('0xc')][_0xbaa1('0x14')](_0x4f18b0)[_0xbaa1('0x11')](function(_0x41d76a){_0x2184ab(null,_0x41d76a?_0x41d76a[_0xbaa1('0x12')]:![]);})[_0xbaa1('0x13')](function(_0xdbaa8b){_0x2184ab(_0xdbaa8b);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x15')]=function(_0x37c862,_0x42f360){this[_0xbaa1('0xc')][_0xbaa1('0x16')](_0x37c862)[_0xbaa1('0x11')](function(_0x155a16){_0x42f360(null,_0x155a16?_0x155a16[_0xbaa1('0x12')]:![]);})[_0xbaa1('0x13')](function(_0x302cd3){_0x42f360(_0x302cd3);});};AGIVertices['prototype'][_0xbaa1('0x17')]=function(_0x3e3f4a,_0x20d75f){this[_0xbaa1('0xc')][_0xbaa1('0x18')](_0x3e3f4a)[_0xbaa1('0x11')](function(_0x5c2115){_0x20d75f(null,_0x5c2115?_0x5c2115[_0xbaa1('0x19')]:![]);})[_0xbaa1('0x13')](function(_0x1c38f3){_0x20d75f(_0x1c38f3);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1a')]=function(_0x5a7d21,_0x4e4a0c){this[_0xbaa1('0xc')][_0xbaa1('0x1b')](_0x5a7d21)[_0xbaa1('0x11')](function(_0x34946c){_0x4e4a0c(null,_0x34946c?_0x34946c[_0xbaa1('0x12')]:![]);})[_0xbaa1('0x13')](function(_0x4806e7){_0x4e4a0c(_0x4806e7);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1c')]=function(_0x28e508,_0x353730){this[_0xbaa1('0xc')][_0xbaa1('0x1d')](_0x28e508)[_0xbaa1('0x11')](function(_0x2d208e){_0x353730(null,_0x2d208e?_0x2d208e[_0xbaa1('0x12')]:![]);})['catch'](function(_0x2b80a4){_0x353730(_0x2b80a4);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1e')]=function(_0x2913ae,_0x109187){var _0x422925=this;this['rpc']['getSoundById'](_0x2913ae)[_0xbaa1('0x11')](function(_0x1e1869){_0x109187(null,_0x1e1869?_0x422925[_0xbaa1('0x1f')](_0x1e1869['save_name']):![]);})[_0xbaa1('0x13')](function(_0x45c184){_0x109187(_0x45c184);});};AGIVertices['prototype'][_0xbaa1('0x20')]=function(_0x57a4b4,_0x158437){this[_0xbaa1('0xc')][_0xbaa1('0x21')](_0x57a4b4)['then'](function(_0x594250){_0x158437(null,_0x594250?_0x594250:![]);})[_0xbaa1('0x13')](function(_0x15bb86){_0x158437(_0x15bb86);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x22')]=function(_0x5b1e06,_0xb04a37,_0x4bd32e){this[_0xbaa1('0xd')][_0xbaa1('0x22')](_0x5b1e06,_0xb04a37)[_0xbaa1('0x11')](function(){_0x4bd32e(null);})[_0xbaa1('0x13')](function(_0x5d4f46){_0x4bd32e(_0x5d4f46);});};AGIVertices[_0xbaa1('0xe')]['getIntervals']=function(_0x373212,_0x1fb952){this[_0xbaa1('0xc')][_0xbaa1('0x23')](_0x373212)['then'](function(_0x2cf50a){if(_0x2cf50a){if(_0x2cf50a[_0xbaa1('0x24')]){_0x1fb952(null,[_0x2cf50a[_0xbaa1('0x25')]]);}else{_0x1fb952(null,_['map'](_0x2cf50a[_0xbaa1('0x26')],_0xbaa1('0x25')));}}else{_0x1fb952(null,![]);}})['catch'](function(_0xb149f1){_0x1fb952(_0xb149f1);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1f')]=function(_0x4837cc){return util[_0xbaa1('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x4837cc);};AGIVertices['prototype'][_0xbaa1('0x28')]=function(_0x5ba9ad,_0x22de8f,_0x19328f){odbc[_0xbaa1('0x29')](_0x5ba9ad,function(_0x4f6a48){if(_0x4f6a48){logger[_0xbaa1('0x2a')](_0xbaa1('0x2b'),_0x4f6a48);_0x19328f(_0x4f6a48);}else{logger['info'](_0xbaa1('0x2c'));odbc[_0xbaa1('0x2d')](_0x22de8f,function(_0x2ffe91,_0x314001){if(_0x2ffe91){logger[_0xbaa1('0x2e')](_0xbaa1('0x2f'),_0x22de8f);_0x19328f(_0x2ffe91);}else{logger[_0xbaa1('0x2e')](_0xbaa1('0x30'),_0x22de8f);odbc['close'](function(_0x114128){if(_0x114128){logger['error'](_0xbaa1('0x31'),_0x114128);}_0x19328f(null,_0x314001);});}});}});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x32')]=function(_0x4c1bfe,_0x1b2333){this['rpc']['getSmsAccountById'](_0x4c1bfe)[_0xbaa1('0x11')](function(_0x5245a9){_0x1b2333(null,_0x5245a9?_0x5245a9:![]);})[_0xbaa1('0x13')](function(_0x5efda0){_0x1b2333(_0x5efda0);});};AGIVertices['prototype'][_0xbaa1('0x33')]=function(_0x26c7fd,_0x6467fd){this[_0xbaa1('0xc')][_0xbaa1('0x33')](_0x26c7fd)[_0xbaa1('0x11')](function(_0x309950){_0x6467fd(null,_0x309950);})[_0xbaa1('0x13')](function(_0x1aad93){_0x6467fd(_0x1aad93);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x34')]=function(_0xc59188,_0x163605,_0x2c2fcf){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xbaa1('0x35')][_0xbaa1('0x36')],'node':_0xc59188[_0xbaa1('0x37')],'application':_0xc59188[_0xbaa1('0x38')],'data':_0x163605||null,'project_name':this[_0xbaa1('0x35')][_0xbaa1('0x39')],'callerid':this[_0xbaa1('0x35')][_0xbaa1('0x3a')]})['then'](function(_0x2e12d9){if(_0x2c2fcf){_0x2c2fcf(null,_0x2e12d9);}})[_0xbaa1('0x13')](function(_0x2aae88){if(_0x2c2fcf){_0x2c2fcf(_0x2aae88);}});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x3b')]=function(_0x164244,_0x5752df,_0x5289cc,_0x3c6468){this['rpc'][_0xbaa1('0x3b')]({'uniqueid':this[_0xbaa1('0x35')][_0xbaa1('0x36')],'callerid':this['channel'][_0xbaa1('0x3a')],'calleridname':this[_0xbaa1('0x35')][_0xbaa1('0x3c')],'context':this[_0xbaa1('0x35')][_0xbaa1('0x3d')],'extension':this['channel']['extension'],'priority':this[_0xbaa1('0x35')][_0xbaa1('0x3e')],'accountcode':this[_0xbaa1('0x35')][_0xbaa1('0x3f')],'dnid':this[_0xbaa1('0x35')][_0xbaa1('0x40')],'projectName':this[_0xbaa1('0x35')][_0xbaa1('0x39')],'saveName':_0x5752df,'filename':_0x164244[_0xbaa1('0x41')]||_0x5752df,'savePath':_0x5289cc})[_0xbaa1('0x11')](function(_0x471173){_0x3c6468(null,_0x471173);})['catch'](function(_0x35c4a9){_0x3c6468(_0x35c4a9);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x42')]=function(_0x216336,_0x956b31,_0x251fa6,_0x17b55e,_0x5bdc78){this[_0xbaa1('0xc')][_0xbaa1('0x42')]({'uniqueid':this['channel'][_0xbaa1('0x36')],'body':_0x216336,'direction':_0x956b31,'providerName':_0x251fa6,'providerResponse':_0x17b55e})[_0xbaa1('0x11')](function(_0x6e733a){if(_0x5bdc78){_0x5bdc78(null,_0x6e733a);}})[_0xbaa1('0x13')](function(_0x4fd674){if(_0x5bdc78){_0x5bdc78(_0x4fd674);}});};AGIVertices[_0xbaa1('0xe')]['createCmContact']=function(_0x1166c7,_0x166e2a){this[_0xbaa1('0xc')][_0xbaa1('0x43')]({'firstName':_['isEmpty'](_0x1166c7[_0xbaa1('0x12')])||_[_0xbaa1('0x44')](_0x1166c7[_0xbaa1('0x12')])?_0xbaa1('0x45')+Math[_0xbaa1('0x46')]():_0x1166c7[_0xbaa1('0x12')],'lastName':_[_0xbaa1('0x47')](_0x1166c7[_0xbaa1('0x48')])||_['isNil'](_0x1166c7[_0xbaa1('0x48')])?null:_0x1166c7[_0xbaa1('0x48')],'phone':_0x1166c7[_0xbaa1('0x49')],'ListId':_0x1166c7[_0xbaa1('0x4a')],'scheduledat':_0x1166c7[_0xbaa1('0x4b')],'callbackUniqueid':this[_0xbaa1('0x35')][_0xbaa1('0x36')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x1166c7[_0xbaa1('0x4b')][_0xbaa1('0x4c')](),'priority':_0x1166c7['callback_priority']})[_0xbaa1('0x11')](function(_0x2cea6b){_0x166e2a(null,_0x2cea6b);})[_0xbaa1('0x13')](function(_0x51097c){_0x166e2a(_0x51097c);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x4d')]=function(_0x2dd2bd,_0x27367e){this[_0xbaa1('0xc')][_0xbaa1('0x4e')](_0x2dd2bd)['then'](function(_0x38e093){_0x27367e(null,_0x38e093?_0x38e093[_0xbaa1('0x12')]:![]);})['catch'](function(_0x4cbe53){_0x27367e(_0x4cbe53);});};AGIVertices[_0xbaa1('0xe')]['agentPause']=function(_0x2bb374,_0x2c56ef,_0x4351b8){var _0x500124={'role':_0xbaa1('0x4f')};_0x500124[_0x2bb374]=this[_0xbaa1('0x35')][_0xbaa1('0x3a')];this[_0xbaa1('0xc')]['agentPause'](_0x500124,_0x2c56ef,this[_0xbaa1('0x35')][_0xbaa1('0x36')])[_0xbaa1('0x11')](function(_0x17a83e){_0x4351b8(null,_[_0xbaa1('0x44')](_0x17a83e)?![]:!![]);})[_0xbaa1('0x13')](function(_0xbf6fb4){logger[_0xbaa1('0x2a')](_0xbf6fb4);_0x4351b8(null,![]);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x50')]=function(_0x34ac07,_0x1a74bd){var _0x4052ee={'role':'agent'};_0x4052ee[_0x34ac07]=this[_0xbaa1('0x35')][_0xbaa1('0x3a')];this[_0xbaa1('0xc')]['agentUnpause'](_0x4052ee)[_0xbaa1('0x11')](function(_0x37af45){_0x1a74bd(null,_[_0xbaa1('0x44')](_0x37af45)?![]:!![]);})[_0xbaa1('0x13')](function(_0x1a3c34){logger[_0xbaa1('0x2a')](_0x1a3c34);_0x1a74bd(null,![]);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x51')]=function(_0xf48b9c,_0x415535){var _0x3b16da={'role':_0xbaa1('0x4f')};_0x3b16da[_0xf48b9c]=this[_0xbaa1('0x35')]['callerid'];this['rpc'][_0xbaa1('0x51')](_0x3b16da)[_0xbaa1('0x11')](function(_0x1f4a05){_0x415535(null,_[_0xbaa1('0x44')](_0x1f4a05)?![]:!![]);})[_0xbaa1('0x13')](function(_0x15fd0c){logger['error'](_0x15fd0c);_0x415535(null,![]);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x52')]=function(_0x5b2c22,_0x5b0d46){var _0x55475b={'role':_0xbaa1('0x4f')};_0x55475b[_0x5b2c22]=this['channel'][_0xbaa1('0x3a')];var _0x57d9ca=_0x5b2c22!=_0xbaa1('0x53')?util[_0xbaa1('0x27')](_0xbaa1('0x54'),_0xbaa1('0x55'),this['channel'][_0xbaa1('0x3a')]):undefined;this['rpc'][_0xbaa1('0x52')](_0x55475b,_0x57d9ca)[_0xbaa1('0x11')](function(_0x1432b9){_0x5b0d46(null,_[_0xbaa1('0x44')](_0x1432b9)?![]:!![]);})[_0xbaa1('0x13')](function(_0x134906){logger['error'](_0x134906);_0x5b0d46(null,![]);});};AGIVertices[_0xbaa1('0xe')]['shellCommand']=function(_0x438bd6,_0xa9a5f4){sh['exec'](_['trim'](_0x438bd6),function(_0x2c3874,_0x21ac88){var _0x4de3df=_0x21ac88[_0xbaa1('0x56')](/(\r\n|\n|\r)/gm,'');_0xa9a5f4(null,_0x4de3df);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x363c2b,_0x8587a3){scripts[_0xbaa1('0x57')](_0x363c2b[_0xbaa1('0x58')],_0x363c2b['google_cloud_tts_text_type']||'text',_0x363c2b[_0xbaa1('0x59')],_0x363c2b['languageCode']||_0xbaa1('0x5a'),_0x363c2b[_0xbaa1('0x5b')]||'MALE',_0x363c2b[_0xbaa1('0x5c')]||_0xbaa1('0x5d'))[_0xbaa1('0x11')](function(_0x1b5f39){_0x8587a3(null,_0x1b5f39);})[_0xbaa1('0x13')](function(_0x5b4ea2){_0x8587a3(_0x5b4ea2);});};AGIVertices[_0xbaa1('0xe')]['googleTTS']=function(_0xb98816,_0x153628){scripts[_0xbaa1('0x5e')](_0xb98816[_0xbaa1('0x59')],_0xb98816['google_tts_language']||'en',0x1)[_0xbaa1('0x11')](function(_0x2391f7){_0x153628(null,_0x2391f7);})[_0xbaa1('0x13')](function(_0x5686a8){_0x153628(_0x5686a8);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x5f')]=function(_0x41a41e,_0x470c05){var _0x18b948={'uri':_0x41a41e['url'],'method':_0x41a41e['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x41a41e[_0xbaa1('0x60')])===_0xbaa1('0x61')&&parseInt(_0x41a41e['timeout'])>=0x1?parseInt(_0x41a41e[_0xbaa1('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xbaa1('0x62')](['POST','PUT'],_0x18b948[_0xbaa1('0x63')][_0xbaa1('0x64')]())){try{_0x18b948['body']=_0x41a41e[_0xbaa1('0x65')]?JSON[_0xbaa1('0x66')](_0x41a41e['rawBody']):{};}catch(_0x485a07){logger[_0xbaa1('0x2a')](_0xbaa1('0x67'),_0x485a07);}}try{_0x18b948[_0xbaa1('0x68')]=_0x41a41e[_0xbaa1('0x8')]?JSON[_0xbaa1('0x66')](_0x41a41e[_0xbaa1('0x8')]):{};}catch(_0x5083ac){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5083ac);}if(_0x41a41e[_0xbaa1('0x69')]){try{var _0x469184=require(_0x41a41e[_0xbaa1('0x69')])[_0xbaa1('0x6a')](this,_0x18b948);_0x18b948[_0xbaa1('0x6b')]=Mustache['render'](_0x41a41e[_0xbaa1('0x6c')],_0x469184,{},['$$','$$']);if(_0x18b948[_0xbaa1('0x68')]){_0x18b948[_0xbaa1('0x68')]=JSON[_0xbaa1('0x66')](Mustache[_0xbaa1('0x6d')](JSON[_0xbaa1('0x6e')](_0x18b948[_0xbaa1('0x68')]),_0x469184,{},['$$','$$']));}if(_0x18b948[_0xbaa1('0x6f')]){_0x18b948['body']=JSON[_0xbaa1('0x66')](Mustache[_0xbaa1('0x6d')](JSON['stringify'](_0x18b948[_0xbaa1('0x6f')]),_0x469184,{},['$$','$$']));}}catch(_0x411e5a){logger[_0xbaa1('0x2a')](_0xbaa1('0x70'),_0x411e5a);}}rp(_0x18b948)[_0xbaa1('0x11')](function(_0x17f088){var _0x32e58f={'statusCode':_0x17f088['statusCode']||0xc8,'statusMessage':_0x17f088[_0xbaa1('0x71')]||'OK','headers':_0x17f088[_0xbaa1('0x68')]||{},'body':_0x17f088[_0xbaa1('0x6f')]||{}};_0x470c05(null,_0x32e58f);})[_0xbaa1('0x13')](function(_0x4575eb){var _0x51d48f={'statusCode':_0x4575eb[_0xbaa1('0x72')]||0x1f4,'statusMessage':_0x4575eb[_0xbaa1('0x73')]||_0xbaa1('0x74'),'headers':_0x4575eb['options']['headers']||{},'body':_0x4575eb['options']['body']||{}};_0x470c05(null,_0x51d48f);});};AGIVertices[_0xbaa1('0xe')]['googleDialogflow']=function(_0x1c0b10,_0x2e225f){scripts[_0xbaa1('0x75')](this[_0xbaa1('0x35')][_0xbaa1('0x36')],_0x1c0b10[_0xbaa1('0x76')],_0x1c0b10[_0xbaa1('0x59')],_0x1c0b10[_0xbaa1('0x77')]||'en')[_0xbaa1('0x11')](function(_0x2deeec){_0x2e225f(null,_0x2deeec);})[_0xbaa1('0x13')](function(_0x56fa00){_0x2e225f(_0x56fa00);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x78')]=function(_0x18412f,_0x4d3919){scripts[_0xbaa1('0x78')](this[_0xbaa1('0x35')]['uniqueid'],_0x18412f[_0xbaa1('0x79')],_0x18412f[_0xbaa1('0x7a')],_0x18412f['private_key'],_0x18412f[_0xbaa1('0x59')],_0x18412f[_0xbaa1('0x7b')]||'en')[_0xbaa1('0x11')](function(_0x335dfb){_0x4d3919(null,_0x335dfb);})['catch'](function(_0x43867d){_0x4d3919(_0x43867d);});};AGIVertices[_0xbaa1('0xe')]['sestekNDA']=function(_0x5890e3,_0x243527){scripts[_0xbaa1('0x7c')](this['channel'],_0x5890e3)['then'](function(_0x4b07cc){_0x243527(null,_0x4b07cc);})[_0xbaa1('0x13')](function(_0x28d0d4){_0x243527(_0x28d0d4);});};AGIVertices[_0xbaa1('0xe')]['ispeechTTS']=function(_0x5010d3,_0x52fc6c){scripts[_0xbaa1('0x7d')](_0x5010d3[_0xbaa1('0x76')],_0x5010d3['text'],_0x5010d3['ispeech_tts_language']||_0xbaa1('0x5a'),_0x5010d3[_0xbaa1('0x7e')])[_0xbaa1('0x11')](function(_0x41eb83){_0x52fc6c(null,_0x41eb83);})[_0xbaa1('0x13')](function(_0x4c51cd){_0x52fc6c(_0x4c51cd);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x7f')]=function(_0x4fc6da,_0x293458,_0x1e525f){scripts[_0xbaa1('0x7f')](_0x293458,_0x4fc6da[_0xbaa1('0x76')],_0x4fc6da[_0xbaa1('0x80')]||'en-US',this[_0xbaa1('0x81')](_0x4fc6da[_0xbaa1('0x82')])?_0x4fc6da[_0xbaa1('0x82')]:undefined)[_0xbaa1('0x11')](function(_0x4947a7){_0x1e525f(null,_0x4947a7);})[_0xbaa1('0x13')](function(_0x286a44){_0x1e525f(_0x286a44);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x83')]=function(_0x36fcb1,_0x15fb4d){scripts[_0xbaa1('0x83')](_0x36fcb1[_0xbaa1('0x84')],_0x36fcb1[_0xbaa1('0x85')],_0x36fcb1[_0xbaa1('0x86')],_0x36fcb1[_0xbaa1('0x87')]||_0xbaa1('0x88'),_0x36fcb1['text'],_0x36fcb1[_0xbaa1('0x89')]||_0xbaa1('0x59'))[_0xbaa1('0x11')](function(_0x121946){_0x15fb4d(null,_0x121946);})[_0xbaa1('0x13')](function(_0x479f39){_0x15fb4d(_0x479f39);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x8a')]=function(_0x203d0d,_0x53515d){scripts[_0xbaa1('0x8a')](this[_0xbaa1('0x35')][_0xbaa1('0x36')],_0x203d0d[_0xbaa1('0x84')],_0x203d0d[_0xbaa1('0x85')],_0x203d0d['aws_lex_region'],_0x203d0d[_0xbaa1('0x59')],_0x203d0d[_0xbaa1('0x8b')])[_0xbaa1('0x11')](function(_0x573d24){_0x53515d(null,_0x573d24);})['catch'](function(_0x7aaf48){_0x53515d(_0x7aaf48);});};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x8c')]=function(_0x1f3b72,_0x561f25,_0x5e850a){scripts[_0xbaa1('0x8c')](_0x561f25,_0x1f3b72[_0xbaa1('0x76')],_0x1f3b72[_0xbaa1('0x8d')]||'en-US')[_0xbaa1('0x11')](function(_0x4a6df1){_0x5e850a(null,_0x4a6df1);})[_0xbaa1('0x13')](function(_0x1171f7){_0x5e850a(_0x1171f7);});};AGIVertices[_0xbaa1('0xe')]['tildeASR']=function(_0x3b9c15,_0x10a4dc,_0x1b174b){scripts['tildeASR'](_0x10a4dc,_0x3b9c15[_0xbaa1('0x8e')],_0x3b9c15['appsecret'],_0x3b9c15[_0xbaa1('0x6b')])[_0xbaa1('0x11')](function(_0xd34b84){_0x1b174b(null,_0xd34b84);})['catch'](function(_0x468758){_0x1b174b(_0x468758);});};AGIVertices['prototype'][_0xbaa1('0x8f')]=function(_0x3726ba){var _0x57e18b=_[_0xbaa1('0x62')](verticesWithRetry,_0x3726ba['agicommand'])?_0x3726ba:_[_0xbaa1('0x90')](_0x3726ba);for(var _0x42cace in _0x57e18b){if(_0x57e18b[_0xbaa1('0x91')](_0x42cace)){if(_0x57e18b[_0x42cace]&&_[_0xbaa1('0x92')](_0x57e18b[_0x42cace])){if(_[_0xbaa1('0x62')](recursiveMapAttributes,_0x42cace)){_0x57e18b[_0x42cace]=this[_0xbaa1('0x93')](_0x57e18b[_0x42cace]);}else{_0x57e18b[_0x42cace]=this[_0xbaa1('0x94')](_0x57e18b[_0x42cace]);}}}}return _0x57e18b;};AGIVertices['prototype'][_0xbaa1('0x95')]=function(_0x49023f){for(var _0xe6445a in _0x49023f){if(_0x49023f['hasOwnProperty'](_0xe6445a)){if(_[_0xbaa1('0x96')](_0x49023f[_0xe6445a])){this[_0xbaa1('0x95')](_0x49023f[_0xe6445a]);}else if(_[_0xbaa1('0x97')](_0x49023f[_0xe6445a])){for(var _0x24ccf5=0x0;_0x24ccf5<_0x49023f[_0xe6445a]['length'];_0x24ccf5++){this[_0xbaa1('0x95')](_0x49023f[_0xe6445a][_0x24ccf5]);}}else if(_['isString'](_0x49023f[_0xe6445a])){_0x49023f[_0xe6445a]=this[_0xbaa1('0x94')](_0x49023f[_0xe6445a]);}}}};AGIVertices[_0xbaa1('0xe')]['saveRestApiResult']=function(_0x22ccf1,_0x401667){for(var _0x2285f2 in _0x22ccf1){if(_0x22ccf1['hasOwnProperty'](_0x2285f2)){if(_[_0xbaa1('0x96')](_0x22ccf1[_0x2285f2])){if(!_[_0xbaa1('0x47')](_0x22ccf1[_0x2285f2])){this[_0xbaa1('0x98')](_0x22ccf1[_0x2285f2],util[_0xbaa1('0x27')](_0xbaa1('0x99'),_0x401667,_0x2285f2));}}else if(_[_0xbaa1('0x97')](_0x22ccf1[_0x2285f2])){for(var _0xa70506=0x0;_0xa70506<_0x22ccf1[_0x2285f2][_0xbaa1('0x9a')];_0xa70506++){this['saveRestApiResult'](_0x22ccf1[_0x2285f2][_0xa70506],util[_0xbaa1('0x27')]('%s.%s',_0x401667,_0x2285f2+'['+_0xa70506+']'));}}else{if(!_[_0xbaa1('0x44')](_0x22ccf1[_0x2285f2])){this['channel'][_0xbaa1('0x9b')](util[_0xbaa1('0x27')]('%s.%s',_0x401667,_0x2285f2),_0x22ccf1[_0x2285f2]);}}}}};AGIVertices['prototype'][_0xbaa1('0x93')]=function(_0x35feb2){try{var _0x17f7e0=JSON['parse'](_0x35feb2);this[_0xbaa1('0x95')](_0x17f7e0);return JSON[_0xbaa1('0x6e')](_0x17f7e0);}catch(_0x281b61){return this[_0xbaa1('0x94')](_0x35feb2);}};AGIVertices['prototype'][_0xbaa1('0x94')]=function(_0x5ea3bc){var _0x26e0bb=_0x5ea3bc[_0xbaa1('0x9c')]('{');for(var _0x1d2c7d=0x1;_0x1d2c7d<_0x26e0bb[_0xbaa1('0x9a')];_0x1d2c7d+=0x1){var _0x29df90=_0x26e0bb[_0x1d2c7d]['split']('}');if(_0x29df90[_0xbaa1('0x9a')]>0x1){_0x5ea3bc=_0x5ea3bc[_0xbaa1('0x9d')]('{'+_0x29df90[0x0]+'}',this[_0xbaa1('0x35')][_0xbaa1('0xf')](_0x29df90[0x0])[_0xbaa1('0x9e')]||_0x29df90[0x0]);}}if(_0x26e0bb[_0xbaa1('0x9a')]===0x1){return _0x5ea3bc[_0xbaa1('0x4c')]();}return this[_0xbaa1('0x94')](_0x5ea3bc);};AGIVertices[_0xbaa1('0xe')]['getAndSetVariable']=function(_0x4f82f8,_0x56c38b){var _0x4fdace=this[_0xbaa1('0x35')][_0xbaa1('0xf')](_0x4f82f8);if(_0x4fdace['result']===-0x1){return _0x4fdace;}logger[_0xbaa1('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x56c38b,_0x4fdace[_0xbaa1('0x9e')]));return this[_0xbaa1('0x35')]['setVariable'](_0x56c38b,_0x4fdace[_0xbaa1('0x9e')]);};AGIVertices[_0xbaa1('0xe')]['isConfigured']=function(_0x5dd10f){return _0x5dd10f&&_0x5dd10f!=='0'&&_0x5dd10f!=='-1'&&_0x5dd10f!=='';};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x9f')]=function(_0x1370aa){this[_0xbaa1('0x34')]['sync'](this,_0x1370aa,'-');_0x1370aa[_0xbaa1('0xa0')]=_0x1370aa['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xa1')]=function(_0xd08b80){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xd08b80[_0xbaa1('0x37')]));if(!this['isConfigured'](_0xd08b80['text'])){return this['channel'][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}var _0x3c2186='\x22'+_0xd08b80[_0xbaa1('0x59')]+'\x22';if(this['isConfigured'](_0xd08b80[_0xbaa1('0xa4')])){_0x3c2186+=','+_0xd08b80[_0xbaa1('0xa4')];}var _0x1b85c5=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xbaa1('0xa6'),_0x3c2186);if(_0x1b85c5[_0xbaa1('0xa7')]===-0x1){return _0x1b85c5;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format'](_0xbaa1('0xa8'),_0x3c2186));};AGIVertices['prototype']['mrcprecog']=function(_0x581496){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xa9'),_0x581496['label']));if(!this[_0xbaa1('0x81')](_0x581496[_0xbaa1('0xaa')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20grammar\x20configured');}var _0xe7dc93=_0x581496[_0xbaa1('0xaa')];if(this[_0xbaa1('0x81')](_0x581496[_0xbaa1('0xa4')])){_0xe7dc93+=','+_0x581496['options'];}var _0x47d5b2=this[_0xbaa1('0x35')]['exec'](_0xbaa1('0xab'),_0xe7dc93);if(_0x47d5b2[_0xbaa1('0xa7')]===-0x1){return _0x47d5b2;}var _0x36365a=this[_0xbaa1('0xac')](_0xbaa1('0xad'),_0xbaa1('0xae'));if(_0x36365a['result']===-0x1){return _0x36365a;}var _0x121985=this[_0xbaa1('0xac')]('RECOG_INPUT()',_0xbaa1('0xaf'));if(_0x121985[_0xbaa1('0xa7')]===-0x1){return _0x121985;}var _0x1d8f4c=this[_0xbaa1('0xac')](_0xbaa1('0xb0'),_0xbaa1('0xb1'));if(_0x1d8f4c[_0xbaa1('0xa7')]===-0x1){return _0x1d8f4c;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xe7dc93));};AGIVertices['prototype'][_0xbaa1('0xb2')]=function(_0x418e0c){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0xb3'),_0x418e0c[_0xbaa1('0x37')]));return this['channel']['agi']([_0x418e0c[_0xbaa1('0xb4')],_0x418e0c[_0xbaa1('0xb5')]]);};AGIVertices[_0xbaa1('0xe')]['answer']=function(_0x19d193){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0xb6'),_0x19d193[_0xbaa1('0x37')]));if(this[_0xbaa1('0x81')](_0x19d193['timeout'])){logger[_0xbaa1('0x2e')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x19d193['timeout']));var _0x43cbf4=this[_0xbaa1('0x35')][_0xbaa1('0xb7')](_0x19d193[_0xbaa1('0x60')]);if(_0x43cbf4[_0xbaa1('0xa7')]===-0x1){return _0x43cbf4;}}return this[_0xbaa1('0x35')][_0xbaa1('0xb8')]();};AGIVertices['prototype'][_0xbaa1('0xb9')]=function(_0xbe4344){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0xba'),_0xbe4344['label']));if(!this[_0xbaa1('0x81')](_0xbe4344[_0xbaa1('0x4a')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0xbe4344,'no\x20list\x20selected');}_0xbe4344[_0xbaa1('0x4b')]=moment();if(this[_0xbaa1('0x81')](_0xbe4344[_0xbaa1('0xbb')])){_0xbe4344['scheduledAt']=moment()[_0xbaa1('0xbc')](_0xbe4344['delay'],_0xbaa1('0xbd'));}if(!this[_0xbaa1('0x81')](_0xbe4344[_0xbaa1('0xbe')])){_0xbe4344[_0xbaa1('0xbe')]=0x2;}this[_0xbaa1('0x43')]['sync'](this,_0xbe4344);return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xbf'),_0xbe4344[_0xbaa1('0x49')],_0xbe4344[_0xbaa1('0x4a')],_0xbe4344['scheduledAt']));};AGIVertices[_0xbaa1('0xe')]['custom_app']=function(_0xcfb294){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0xc0'),_0xcfb294['label']));var _0x25fec2=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xcfb294[_0xbaa1('0xc1')],_0xcfb294[_0xbaa1('0xa4')]);if(_0x25fec2[_0xbaa1('0xa7')]===-0x1){return _0x25fec2;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xc2'),_0xcfb294['application'],_0xcfb294[_0xbaa1('0xa4')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3aba8f){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xc3'),_0x3aba8f[_0xbaa1('0x37')]));if(!this['isConfigured'](_0x3aba8f[_0xbaa1('0x59')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20text\x20configured');}var _0x95a909='\x22'+_0x3aba8f[_0xbaa1('0x59')]+'\x22';if(this['isConfigured'](_0x3aba8f['options'])){_0x95a909+=','+_0x3aba8f[_0xbaa1('0xa4')];}var _0x452f75=this['channel']['exec'](_0xbaa1('0xa6'),_0x95a909);if(_0x452f75[_0xbaa1('0xa7')]===-0x1){return _0x452f75;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xa8'),_0x95a909));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xc4')]=function(_0x40964a){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xc5'),_0x40964a['label']));if(!this['isConfigured'](_0x40964a[_0xbaa1('0x59')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}var _0xb2ef29='\x22'+_0x40964a[_0xbaa1('0x59')]+'\x22';if(this['isConfigured'](_0x40964a[_0xbaa1('0xa4')])){_0xb2ef29+=','+_0x40964a[_0xbaa1('0xa4')];}var _0x3171b8=this['channel'][_0xbaa1('0xa5')](_0xbaa1('0xa6'),_0xb2ef29);if(_0x3171b8[_0xbaa1('0xa7')]===-0x1){return _0x3171b8;}return this[_0xbaa1('0x35')]['noop'](util['format'](_0xbaa1('0xa8'),_0xb2ef29));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xc6')]=function(_0x1ade7d){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xc7'),_0x1ade7d[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x1ade7d[_0xbaa1('0xaa')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xc8'));}var _0x374129=_0x1ade7d[_0xbaa1('0xaa')];if(this[_0xbaa1('0x81')](_0x1ade7d[_0xbaa1('0xa4')])){_0x374129+=','+_0x1ade7d['options'];}var _0x4daa93=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xbaa1('0xab'),_0x374129);if(_0x4daa93['result']===-0x1){return _0x4daa93;}var _0x1beba0=this[_0xbaa1('0xac')](_0xbaa1('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1beba0[_0xbaa1('0xa7')]===-0x1){return _0x1beba0;}var _0x1a1860=this[_0xbaa1('0xac')](_0xbaa1('0xc9'),_0xbaa1('0xca'));if(_0x1a1860[_0xbaa1('0xa7')]===-0x1){return _0x1a1860;}var _0x30af5f=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x30af5f[_0xbaa1('0xa7')]===-0x1){return _0x30af5f;}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0xcb'),_0x374129));};AGIVertices[_0xbaa1('0xe')]['sestekasr']=function(_0xcd6770){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0xcc'),_0xcd6770[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0xcd6770[_0xbaa1('0xaa')])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0xc8'));}var _0x3fe333=_0xcd6770['grammar'];if(this[_0xbaa1('0x81')](_0xcd6770[_0xbaa1('0xa4')])){_0x3fe333+=','+_0xcd6770[_0xbaa1('0xa4')];}var _0x2f1904=this['channel']['exec']('MRCPRecog',_0x3fe333);if(_0x2f1904[_0xbaa1('0xa7')]===-0x1){return _0x2f1904;}var _0x5cfb4d=this[_0xbaa1('0xac')](_0xbaa1('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x5cfb4d[_0xbaa1('0xa7')]===-0x1){return _0x5cfb4d;}var _0x3d7168=this[_0xbaa1('0xac')]('RECOG_INPUT()',_0xbaa1('0xcd'));if(_0x3d7168[_0xbaa1('0xa7')]===-0x1){return _0x3d7168;}var _0x4f0276=this[_0xbaa1('0xac')](_0xbaa1('0xb0'),_0xbaa1('0xce'));if(_0x4f0276[_0xbaa1('0xa7')]===-0x1){return _0x4f0276;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3fe333));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xcf')]=function(_0x3fbe5f){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xd0'),_0x3fbe5f[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x3fbe5f[_0xbaa1('0xd1')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x3fbe5f,_0xbaa1('0xd2'));}var _0x11a0a9=this['getSquareOdbc'][_0xbaa1('0x6a')](this,_0x3fbe5f[_0xbaa1('0xd1')]);if(!_0x11a0a9){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x3fbe5f,_0xbaa1('0xd3'));}if(!this[_0xbaa1('0x81')](_0x3fbe5f[_0xbaa1('0x2d')])){return this[_0xbaa1('0x35')]['error'](_0x3fbe5f,_0xbaa1('0xd4'));}var _0x555420=_0x3fbe5f[_0xbaa1('0x2d')][_0xbaa1('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format'](_0xbaa1('0xd5'),_0x555420));var _0xaa4fc1=this[_0xbaa1('0x28')][_0xbaa1('0x6a')](this,_0x11a0a9,_0x555420);this['createSquareDetailsReport']['sync'](this,_0x3fbe5f,_0x555420);if(!this[_0xbaa1('0x81')](_0x3fbe5f[_0xbaa1('0xd6')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xd7'));}var _0x2cb087=this[_0xbaa1('0xf')][_0xbaa1('0x6a')](this,_0x3fbe5f[_0xbaa1('0xd6')]);if(!_0x2cb087){return this['channel']['error'](_0x3fbe5f,_0xbaa1('0xd8'));}var _0x32c1f1=this;_0xaa4fc1[_0xbaa1('0xd9')](function(_0x29110a,_0x294fa9){Object[_0xbaa1('0xda')](_0x29110a)[_0xbaa1('0xd9')](function(_0x44f2c7){_0x32c1f1[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0xdb'),_0x2cb087,_0x294fa9,_0x44f2c7),_0x29110a[_0x44f2c7]);});});this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0xdc'),_0x2cb087),_0xaa4fc1['length']);return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xdd'),_0x2cb087));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xde')]=function(_0x1a33bc){logger[_0xbaa1('0xdf')](util[_0xbaa1('0x27')](_0xbaa1('0xe0'),_0x1a33bc['label']));if(!this['isConfigured'](_0x1a33bc[_0xbaa1('0xe1')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x1a33bc,_0xbaa1('0xe2'));}var _0x264c17=this['getUser']['sync'](this,_0x1a33bc[_0xbaa1('0xe1')]);if(!_0x264c17){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x1a33bc,'no\x20user\x20found');}var _0x6036df=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xbaa1('0xe3'),[util['format'](_0xbaa1('0xe4'),_0x264c17),_0x1a33bc[_0xbaa1('0x60')],_0x1a33bc[_0xbaa1('0xe5')],_0x1a33bc['url']]);if(_0x6036df[_0xbaa1('0xa7')]===-0x1){return _0x6036df;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xe6'),'DIAL'));};AGIVertices[_0xbaa1('0xe')]['dialogflow']=function(_0x1be0bc){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1be0bc[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x1be0bc[_0xbaa1('0x76')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xe7'));}if(!this[_0xbaa1('0x81')](_0x1be0bc['text'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}this[_0xbaa1('0x35')][_0xbaa1('0xe8')]=!![];this[_0xbaa1('0x34')](_0x1be0bc);this['createSquareMessage'](_0x1be0bc[_0xbaa1('0x59')],'in','','');this['channel'][_0xbaa1('0xa2')](util['format'](_0xbaa1('0xe9'),_0x1be0bc['text']));var _0x3cd2e5=this['googleDialogflow'][_0xbaa1('0x6a')](this,_0x1be0bc);if(_0x3cd2e5){for(var _0x584c1b in _0x3cd2e5){if(_0x3cd2e5[_0xbaa1('0x91')](_0x584c1b)){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util['format'](_0xbaa1('0xea'),_0x584c1b[_0xbaa1('0x64')]()),_0x3cd2e5[_0x584c1b]);}}this[_0xbaa1('0x42')](_0x3cd2e5['speech'],_0xbaa1('0xeb'),_0xbaa1('0xec'),'');return this['channel']['noop'](util[_0xbaa1('0x27')](_0xbaa1('0xed'),_0x3cd2e5[_0xbaa1('0xee')]));}return this[_0xbaa1('0x35')]['error'](_0x1be0bc,_0xbaa1('0xef'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xf0')]=function(_0xfdbcae){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0xf1'),_0xfdbcae['label']));if(!this['isConfigured'](_0xfdbcae[_0xbaa1('0x79')])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0xf2'));}if(!this[_0xbaa1('0x81')](_0xfdbcae[_0xbaa1('0x7a')])){return this[_0xbaa1('0x35')]['noop']('no\x20client_email\x20configured');}if(!this[_0xbaa1('0x81')](_0xfdbcae['private_key'])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0xf3'));}if(!this['isConfigured'](_0xfdbcae['dialogflowV2_language'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xf4'));}if(!this[_0xbaa1('0x81')](_0xfdbcae['text'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}this[_0xbaa1('0x35')]['bot']=!![];this['createSquareDetailsReport'](_0xfdbcae);this[_0xbaa1('0x42')](_0xfdbcae[_0xbaa1('0x59')],'in','','');this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format'](_0xbaa1('0xf5'),_0xfdbcae['text']));var _0x4a110b=this['googleDialogflowV2'][_0xbaa1('0x6a')](this,_0xfdbcae);if(_0x4a110b){for(var _0x217a2a in _0x4a110b){if(_0x4a110b[_0xbaa1('0x91')](_0x217a2a)){if(_0x217a2a!=='providerResponse'){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0xea'),_0x217a2a['toUpperCase']()),_0x4a110b[_0x217a2a]);}}}this[_0xbaa1('0x42')](_0x4a110b[_0xbaa1('0xee')],'out',_0xbaa1('0xf0'),_0x4a110b[_0xbaa1('0xf6')]);return this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xf7'),_0x4a110b['speech']));}return this['channel'][_0xbaa1('0x2a')](_0xfdbcae,_0xbaa1('0xf8'));};AGIVertices['prototype']['sesteknda']=function(_0x72ba41){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0xf9'),_0x72ba41[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x72ba41[_0xbaa1('0xfa')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xfb'));}if(!this[_0xbaa1('0x81')](_0x72ba41['username'])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0xfc'));}if(!this[_0xbaa1('0x81')](_0x72ba41[_0xbaa1('0xfd')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xfe'));}if(!this[_0xbaa1('0x81')](_0x72ba41[_0xbaa1('0xff')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}this[_0xbaa1('0x35')]['bot']=!![];this[_0xbaa1('0x34')](_0x72ba41);this[_0xbaa1('0x42')](_0x72ba41[_0xbaa1('0x59')],'in','','');this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x100'),_0x72ba41[_0xbaa1('0x59')]));var _0x4fad29=this[_0xbaa1('0x7c')][_0xbaa1('0x6a')](this,_0x72ba41);if(_0x4fad29){for(var _0x22b305 in _0x4fad29){if(_0x4fad29[_0xbaa1('0x91')](_0x22b305)){this['channel'][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0x101'),_0x22b305[_0xbaa1('0x64')]()),_0x4fad29[_0x22b305]);}}this[_0xbaa1('0x42')](_0x4fad29[_0xbaa1('0xee')],'out',_0xbaa1('0x102'),'');if(_0x4fad29['audiofile']){this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x103'),_0x4fad29[_0xbaa1('0x104')]));var _0x227500=this['channel']['streamFile'](_0x4fad29['audiofile']);try{fs[_0xbaa1('0x105')](_0x4fad29[_0xbaa1('0x104')]+'.wav');}catch(_0x1fe3dd){logger[_0xbaa1('0x2a')](_0x1fe3dd);}return _0x227500;}else{return this['channel']['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x106'),_0x4fad29['speech']));}}return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x72ba41,_0xbaa1('0x107'));};AGIVertices[_0xbaa1('0xe')]['end']=function(_0x58563f){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x108'),_0x58563f[_0xbaa1('0x37')]));return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x109'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x10a')]=function(_0x4d27cb){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x10b'),_0x4d27cb['label']));var _0x51446d='';if(_0x4d27cb[_0xbaa1('0x10c')]){if(!this[_0xbaa1('0x81')](_0x4d27cb[_0xbaa1('0x10c')])){return this['channel'][_0xbaa1('0x2a')](_0x4d27cb,_0xbaa1('0x10d'));}else{var _0xa16f68=parseInt(_0x4d27cb['trunk_id'],0xa);if(isNaN(_0xa16f68)){_0x51446d=_0x4d27cb[_0xbaa1('0x10c')];}else{_0x51446d=this['getTrunk']['sync'](this,_0x4d27cb[_0xbaa1('0x10c')]);if(!_0x51446d){return this['channel'][_0xbaa1('0x2a')](_0x4d27cb,_0xbaa1('0x10e'));}}}}else if(_0x4d27cb[_0xbaa1('0x10f')]){_0x51446d=_0x4d27cb['trunk_name'];}else{return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x4d27cb,_0xbaa1('0x10d'));}var _0x5365ef=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xbaa1('0xe3'),[util[_0xbaa1('0x27')](_0xbaa1('0x110'),_0x51446d,_0x4d27cb[_0xbaa1('0x49')]),_0x4d27cb[_0xbaa1('0x60')],_0x4d27cb['opts'],_0x4d27cb[_0xbaa1('0x6c')]]);if(_0x5365ef['result']===-0x1){return _0x5365ef;}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0xe6'),_0xbaa1('0xe3')));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x111')]=function(_0x157418){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x112'),_0x157418['label']));return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x111'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xa')]=function(_0x6e81c3){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x113'),_0x6e81c3[_0xbaa1('0x37')]));if(_0x6e81c3[_0xbaa1('0xa0')]===0x0){return this['maxRetry'](_0x6e81c3);}_0x6e81c3['retry']-=0x1;if(!this[_0xbaa1('0x81')](_0x6e81c3[_0xbaa1('0x114')])){return this['channel'][_0xbaa1('0x2a')](_0x6e81c3,_0xbaa1('0x115'));}var _0x180e0e=this[_0xbaa1('0x1e')][_0xbaa1('0x6a')](this,_0x6e81c3[_0xbaa1('0x114')]);if(!_0x180e0e){return this[_0xbaa1('0x35')]['error'](_0x6e81c3,_0xbaa1('0x116'));}if(!this[_0xbaa1('0x81')](_0x6e81c3['variable_id'])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x46e66d=this[_0xbaa1('0x35')][_0xbaa1('0x117')](_0x180e0e,_0x6e81c3['response'],_0x6e81c3[_0xbaa1('0x118')]);var _0x3fedea=_0x46e66d[_0xbaa1('0xa7')]?_0x46e66d['result'][_0xbaa1('0x4c')]():'';logger['info']('test',JSON[_0xbaa1('0x6e')](_0x46e66d));if(_0x46e66d[_0xbaa1('0xa7')]===-0x1){this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x6e81c3,_0x3fedea);return _0x46e66d;}else if(_0x46e66d['extra']==='timeout'){_0x46e66d[_0xbaa1('0xa7')]=_0x3fedea[_0xbaa1('0x9a')]>=parseInt(_0x6e81c3[_0xbaa1('0x119')])?'x':'i';}else{_0x46e66d[_0xbaa1('0xa7')]=_0x3fedea[_0xbaa1('0x9a')]>=parseInt(_0x6e81c3['mindigit'])&&_0x3fedea[_0xbaa1('0x9a')]<=parseInt(_0x6e81c3[_0xbaa1('0x118')])?'x':'i';}var _0x279ed8=this['getVariable']['sync'](this,_0x6e81c3[_0xbaa1('0xd6')]);if(!_0x279ed8){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x6e81c3,_0xbaa1('0xd8'));}this['channel'][_0xbaa1('0x9b')](_0x279ed8,_0x3fedea);if(this[_0xbaa1('0x81')](_0x6e81c3['hiddendigitsnum'])){var _0x4cd691=parseInt(_0x6e81c3[_0xbaa1('0x11a')],0xa);var _0x2fa5f3=rs[_0xbaa1('0x11b')]({'charset':'*','length':_0x4cd691});var _0x358bea=_0x3fedea[_0xbaa1('0x9a')];if(_0x358bea>0x0){if(_0x358bea>_0x4cd691){this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x6e81c3,_0x6e81c3['hiddendigitspos']==='first'?_0x2fa5f3+_0x3fedea[_0xbaa1('0x11c')](_0x4cd691):_0x3fedea[_0xbaa1('0x11c')](0x0,_0x358bea-_0x4cd691)+_0x2fa5f3);}else{this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x6e81c3,rs[_0xbaa1('0x11b')]({'charset':'*','length':_0x358bea}));}}else{this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x6e81c3,'');}}else{this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x6e81c3,_0x3fedea);}return _0x46e66d;};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xb')]=function(_0x159a75){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x11d'),_0x159a75[_0xbaa1('0x37')]));return this[_0xbaa1('0xa')](_0x159a75);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x11e')]=function(_0x50a0ae){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x11f'),_0x50a0ae[_0xbaa1('0x37')]));this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x50a0ae,_0x50a0ae[_0xbaa1('0x120')]);return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x121'),_0x50a0ae[_0xbaa1('0x120')]));};AGIVertices['prototype'][_0xbaa1('0x122')]=function(_0x184fbd){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x123'),_0x184fbd[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x184fbd[_0xbaa1('0x84')])||!this[_0xbaa1('0x81')](_0x184fbd[_0xbaa1('0x85')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x124'));}if(!this[_0xbaa1('0x81')](_0x184fbd[_0xbaa1('0x59')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20text\x20configured');}this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x125'),_0x184fbd[_0xbaa1('0x59')]));var _0x22b75c=this[_0xbaa1('0x83')][_0xbaa1('0x6a')](this,_0x184fbd);if(_0x22b75c){this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x126'),_0x22b75c));var _0x4937f8=this[_0xbaa1('0x35')][_0xbaa1('0x127')](_0x22b75c);try{fs[_0xbaa1('0x105')](_0x22b75c+_0xbaa1('0x128'));}catch(_0x561e99){logger[_0xbaa1('0x2a')](_0x561e99);}return _0x4937f8;}return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x184fbd,_0xbaa1('0x129'));};AGIVertices[_0xbaa1('0xe')]['awslex']=function(_0x5397e7){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x12a'),_0x5397e7[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x5397e7[_0xbaa1('0x84')])||!this[_0xbaa1('0x81')](_0x5397e7[_0xbaa1('0x85')])){return this[_0xbaa1('0x35')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5397e7['aws_bot_name'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20bot\x20name\x20configured');}if(!this[_0xbaa1('0x81')](_0x5397e7['text'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}this[_0xbaa1('0x35')][_0xbaa1('0xe8')]=!![];this['createSquareDetailsReport'](_0x5397e7);this[_0xbaa1('0x42')](_0x5397e7['text'],'in','','');this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x12b'),_0x5397e7[_0xbaa1('0x59')]));var _0x214a7e=this[_0xbaa1('0x8a')][_0xbaa1('0x6a')](this,_0x5397e7);if(_0x214a7e){for(var _0x33ba14 in _0x214a7e){if(_0x214a7e[_0xbaa1('0x91')](_0x33ba14)&&_['isString'](_0x214a7e[_0x33ba14])){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0x12c'),_0x33ba14[_0xbaa1('0x64')]()),_0x214a7e[_0x33ba14]);}}if(_[_0xbaa1('0x44')](_0x214a7e['message'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x12d'));}else{this[_0xbaa1('0x42')](_0x214a7e[_0xbaa1('0x73')],_0xbaa1('0xeb'),_0xbaa1('0x12e'),'');return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x214a7e[_0xbaa1('0x73')]));}}return this['channel'][_0xbaa1('0x2a')](_0x5397e7,_0xbaa1('0x12f'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x130')]=function(_0x298cef){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x298cef[_0xbaa1('0x37')],_0x298cef[_0xbaa1('0x60')]));if(!this['isConfigured'](_0x298cef[_0xbaa1('0x76')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xe7'));}var _0x586184=_0xbaa1('0x131');var _0x2d32e3=util[_0xbaa1('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xbaa1('0x11b')](0x4));var _0x23cabf=util['format'](_0xbaa1('0x99'),_0x2d32e3,_0x586184);var _0x2120eb=!![];if(_0x298cef[_0xbaa1('0x132')]==='NOBEEP'){_0x2120eb=![];}var _0x17c571=this['channel'][_0xbaa1('0x133')](_0x2d32e3,_0x586184,_0x298cef['intKey'],_0x298cef[_0xbaa1('0x60')],undefined,_0x2120eb);if(_0x17c571[_0xbaa1('0xa7')]!==-0x1){this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x134'),_0x23cabf));var _0x195893=this[_0xbaa1('0x8c')]['sync'](this,_0x298cef,_0x23cabf);if(_0x195893){for(var _0x29ee7e in _0x195893){if(_0x195893[_0xbaa1('0x91')](_0x29ee7e)){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util['format']('GOOGLE_ASR_%s',_0x29ee7e[_0xbaa1('0x64')]()),_0x195893[_0x29ee7e]);}}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x135'),JSON['stringify'](_0x195893)));}}return _0x17c571;};AGIVertices[_0xbaa1('0xe')]['tildeasr']=function(_0x52e8ab){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x136'),_0x52e8ab[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x52e8ab[_0xbaa1('0x8e')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x137'));}if(!this[_0xbaa1('0x81')](_0x52e8ab[_0xbaa1('0x138')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20appsecret\x20configured');}var _0x105f11=_0xbaa1('0x131');var _0x4a305f=util[_0xbaa1('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xbaa1('0x11b')](0x4));var _0x2e3880=util[_0xbaa1('0x27')](_0xbaa1('0x99'),_0x4a305f,_0x105f11);var _0x1edf5c=!![];if(_0x52e8ab[_0xbaa1('0x132')]===_0xbaa1('0x139')){_0x1edf5c=![];}var _0x51d49a=this[_0xbaa1('0x35')][_0xbaa1('0x133')](_0x4a305f,_0x105f11,_0x52e8ab[_0xbaa1('0x13a')],_0x52e8ab[_0xbaa1('0x60')],undefined,_0x1edf5c);if(_0x51d49a[_0xbaa1('0xa7')]!==-0x1){this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')]('tilde\x20%s\x20file\x20created',_0x2e3880));var _0xead5c4=this[_0xbaa1('0x13b')][_0xbaa1('0x6a')](this,_0x52e8ab,_0x2e3880);if(_0xead5c4){for(var _0x23c1b9 in _0xead5c4){if(_0xead5c4[_0xbaa1('0x91')](_0x23c1b9)){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util['format'](_0xbaa1('0x13c'),_0x23c1b9[_0xbaa1('0x64')]()),_0xead5c4[_0x23c1b9]);}}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')]('TildeASR\x20Result\x20%s',JSON[_0xbaa1('0x6e')](_0xead5c4)));}}return _0x51d49a;};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x13d')]=function(_0x4c7e36){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x13e'),_0x4c7e36[_0xbaa1('0x37')]));return this[_0xbaa1('0x35')]['continueAt'](_0x4c7e36[_0xbaa1('0x3d')],_0x4c7e36[_0xbaa1('0x13f')],_0x4c7e36[_0xbaa1('0x3e')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x140')]=function(_0x168715){logger[_0xbaa1('0x2e')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x168715['label']));if(!this['isConfigured'](_0x168715['condition'])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x168715,_0xbaa1('0x141'));}try{var _0xd128e1=eval(_0x168715[_0xbaa1('0x142')])?'true':_0xbaa1('0x143');this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x168715[_0xbaa1('0x142')],_0xd128e1));return{'code':0xc8,'result':_0xd128e1};}catch(_0x393226){return{'code':0xc8,'result':_0xbaa1('0x143')};}};AGIVertices[_0xbaa1('0xe')]['gotoiftime']=function(_0x3165e7){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3165e7[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x3165e7['interval_id'])){return this[_0xbaa1('0x35')]['error'](_0x3165e7,_0xbaa1('0x144'));}var _0x416454=this['getIntervals'][_0xbaa1('0x6a')](this,_0x3165e7[_0xbaa1('0x145')]);if(!_0x416454){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x3165e7,_0xbaa1('0x146'));}for(var _0x23c6ef=0x0;_0x23c6ef<_0x416454[_0xbaa1('0x9a')];_0x23c6ef+=0x1){var _0x100c59=this['channel']['getVariable'](util['format']('IFTIME(%s?true:false)',_0x416454[_0x23c6ef]));if(_0x100c59[_0xbaa1('0xa7')]===-0x1){return _0x100c59;}logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x147'),_0x416454[_0x23c6ef],_0x100c59[_0xbaa1('0x9e')]));if(_0x100c59['extra']===_0xbaa1('0x148')){logger[_0xbaa1('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x416454[_0x23c6ef],_0xbaa1('0x148')));this[_0xbaa1('0x35')]['noop'](util['format'](_0xbaa1('0x147'),_0x416454[_0x23c6ef],'true'));return{'code':0xc8,'result':_0xbaa1('0x148')};}else{logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x147'),_0x416454[_0x23c6ef],_0xbaa1('0x143')));this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format'](_0xbaa1('0x147'),_0x416454[_0x23c6ef],_0xbaa1('0x143')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x149')]=function(_0x73c570){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0x14a'),_0x73c570[_0xbaa1('0x37')]));return this[_0xbaa1('0x35')][_0xbaa1('0x149')]();};AGIVertices[_0xbaa1('0xe')]['ispeechasr']=function(_0x28337f){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x14b'),_0x28337f[_0xbaa1('0x37')]));if(!this['isConfigured'](_0x28337f['key'])){return this['channel'][_0xbaa1('0xa2')](_0xbaa1('0xe7'));}var _0x20fff=_0xbaa1('0x131');var _0xec1862=util[_0xbaa1('0x27')](_0xbaa1('0x14c'),FILES_PATH,rs[_0xbaa1('0x11b')](0x4));var _0x40f70f=util[_0xbaa1('0x27')](_0xbaa1('0x99'),_0xec1862,_0x20fff);var _0x17607d=!![];if(_0x28337f['beep']===_0xbaa1('0x139')){_0x17607d=![];}var _0x2b0c81=this['channel'][_0xbaa1('0x133')](_0xec1862,_0x20fff,_0x28337f[_0xbaa1('0x13a')],_0x28337f[_0xbaa1('0x60')],undefined,_0x17607d);if(_0x2b0c81[_0xbaa1('0xa7')]!==-0x1){this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x14d'),_0x40f70f));var _0x241b7d=this[_0xbaa1('0x7f')]['sync'](this,_0x28337f,_0x40f70f);if(_0x241b7d){for(var _0x19b56a in _0x241b7d){if(_0x241b7d[_0xbaa1('0x91')](_0x19b56a)){this['channel'][_0xbaa1('0x9b')](util['format']('ISPEECH_ASR_%s',_0x19b56a[_0xbaa1('0x64')]()),_0x241b7d[_0x19b56a]);}}return this['channel']['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x14e'),JSON['stringify'](_0x241b7d)));}}return _0x2b0c81;};AGIVertices['prototype']['ispeechtts']=function(_0x3fc469){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x14f'),_0x3fc469[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x3fc469['key'])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xe7'));}if(!this['isConfigured'](_0x3fc469[_0xbaa1('0x59')])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0xa3'));}this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x3fc469[_0xbaa1('0x59')]));var _0x3f0107=this[_0xbaa1('0x7d')][_0xbaa1('0x6a')](this,_0x3fc469);if(_0x3f0107){this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('ispeech\x20%s\x20file\x20created',_0x3f0107));var _0x43927a=this[_0xbaa1('0x35')][_0xbaa1('0x127')](_0x3f0107,_0x3fc469[_0xbaa1('0x13a')]);try{fs[_0xbaa1('0x105')](_0x3f0107+_0xbaa1('0x128'));}catch(_0x7a943b){logger[_0xbaa1('0x2a')](_0x7a943b);}return _0x43927a;}return this[_0xbaa1('0x35')]['error'](_0x3fc469,_0xbaa1('0x150'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x151')]=function(_0x58a3f4){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0x152'),_0x58a3f4[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x58a3f4[_0xbaa1('0x153')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x58a3f4,'no\x20find\x20by\x20configured');}logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x154'),this['channel']['callerid'],_0x58a3f4[_0xbaa1('0x153')]));var _0x3ce9f6=this[_0xbaa1('0x52')][_0xbaa1('0x6a')](this,_0x58a3f4[_0xbaa1('0x153')]);if(_0x3ce9f6){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x155'),this[_0xbaa1('0x35')]['callerid'],_0x58a3f4[_0xbaa1('0x153')]));this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbaa1('0x35')]['callerid'],_0x58a3f4[_0xbaa1('0x153')]));return{'code':0xc8,'result':_0xbaa1('0x156')};}else{logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x58a3f4[_0xbaa1('0x153')]));this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x157'),this['channel'][_0xbaa1('0x3a')],_0x58a3f4[_0xbaa1('0x153')]));return{'code':0xc8,'result':_0xbaa1('0x158')};}};AGIVertices[_0xbaa1('0xe')]['logout']=function(_0x273b92){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x159'),_0x273b92[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x273b92[_0xbaa1('0x153')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x273b92,_0xbaa1('0x15a'));}logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x273b92['findBy']));var _0x14fe42=this[_0xbaa1('0x51')][_0xbaa1('0x6a')](this,_0x273b92[_0xbaa1('0x153')]);if(_0x14fe42){logger['info'](util[_0xbaa1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x273b92[_0xbaa1('0x153')]));this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x155'),this[_0xbaa1('0x35')]['callerid'],_0x273b92[_0xbaa1('0x153')]));return{'code':0xc8,'result':_0xbaa1('0x156')};}else{logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x157'),this[_0xbaa1('0x35')]['callerid'],_0x273b92['findBy']));this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util['format'](_0xbaa1('0x157'),this[_0xbaa1('0x35')]['callerid'],_0x273b92['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbaa1('0xe')]['math']=function(_0x17e335){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x15b'),_0x17e335[_0xbaa1('0x37')]));if(!this['isConfigured'](_0x17e335[_0xbaa1('0x15c')])){return this['channel'][_0xbaa1('0x2a')](_0x17e335,_0xbaa1('0x15d'));}this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x15e'),_0x17e335[_0xbaa1('0x15c')]));var _0x4a47e4=eval(_0x17e335[_0xbaa1('0x15c')]);if(!this[_0xbaa1('0x81')](_0x17e335[_0xbaa1('0xd6')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xd7'));}var _0x239a81=this['getVariable'][_0xbaa1('0x6a')](this,_0x17e335[_0xbaa1('0xd6')]);if(!_0x239a81){return this[_0xbaa1('0x35')]['error'](_0x17e335,_0xbaa1('0xd8'));}if(_[_0xbaa1('0x97')](_0x4a47e4)){var _0x33c8d4=this;_0x4a47e4['forEach'](function(_0x28fa94,_0x47f2d2){_0x33c8d4[_0xbaa1('0x35')]['setVariable'](util[_0xbaa1('0x27')](_0xbaa1('0x15f'),_0x239a81,_0x47f2d2),_0x28fa94);});return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x160'),_0x239a81));}else{return this['channel'][_0xbaa1('0x9b')](_0x239a81,_0x4a47e4);}};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x9')]=function(_0xffde13){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0x161'),_0xffde13[_0xbaa1('0x37')]));if(_0xffde13[_0xbaa1('0xa0')]===0x0){return this[_0xbaa1('0x9f')](_0xffde13);}_0xffde13[_0xbaa1('0xa0')]-=0x1;if(!this[_0xbaa1('0x81')](_0xffde13[_0xbaa1('0x114')])){return this[_0xbaa1('0x35')]['error'](_0xffde13,'no\x20file\x20audio\x20selected');}var _0x13e5ee=this[_0xbaa1('0x1e')][_0xbaa1('0x6a')](this,_0xffde13[_0xbaa1('0x114')]);if(!_0x13e5ee){return this[_0xbaa1('0x35')]['error'](_0xffde13,_0xbaa1('0x116'));}var _0x4ab1fb=this[_0xbaa1('0x35')][_0xbaa1('0x117')](_0x13e5ee,_0xffde13[_0xbaa1('0x162')],_0xffde13[_0xbaa1('0x163')]);var _0x36a2a6=_0x4ab1fb['result'];if(_0x4ab1fb[_0xbaa1('0xa7')]===-0x1){this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0xffde13,'-1');return _0x4ab1fb;}else if(_0x4ab1fb[_0xbaa1('0x9e')]===_0xbaa1('0x60')){_0x4ab1fb['result']=_0x4ab1fb[_0xbaa1('0xa7')][_0xbaa1('0x9a')]>0x0?_0x4ab1fb[_0xbaa1('0xa7')]:'t';}else if(_[_0xbaa1('0x47')](_0x4ab1fb[_0xbaa1('0xa7')])){_0x4ab1fb[_0xbaa1('0xa7')]='#';_0x36a2a6='#';}if(!this[_0xbaa1('0x81')](_0xffde13['variable_id'])){this[_0xbaa1('0x35')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3b2b3d=this[_0xbaa1('0xf')][_0xbaa1('0x6a')](this,_0xffde13['variable_id']);if(!_0x3b2b3d){return this[_0xbaa1('0x35')]['error'](_0xffde13,'no\x20variable\x20found');}this[_0xbaa1('0x35')][_0xbaa1('0x9b')](_0x3b2b3d,_0x36a2a6);}this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0xffde13,_0x36a2a6);return _0x4ab1fb;};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0xa2')]=function(_0x4bdbcf){logger['info'](util[_0xbaa1('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4bdbcf[_0xbaa1('0x37')]));return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0x4bdbcf[_0xbaa1('0x164')]||_0x4bdbcf[_0xbaa1('0x37')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x165')]=function(_0x114421){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x166'),_0x114421[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x114421['findBy'])){return this['channel'][_0xbaa1('0x2a')](_0x114421,_0xbaa1('0x15a'));}logger['info'](util[_0xbaa1('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x114421[_0xbaa1('0x153')]));var _0x4a79d2=this['getPause'][_0xbaa1('0x6a')](this,_0x114421[_0xbaa1('0x167')]);var _0xb49eee=this[_0xbaa1('0x168')][_0xbaa1('0x6a')](this,_0x114421[_0xbaa1('0x153')],_0x4a79d2);if(_0xb49eee){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x155'),this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x114421[_0xbaa1('0x153')]));this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xbaa1('0x3a')],_0x114421[_0xbaa1('0x153')]));return{'code':0xc8,'result':_0xbaa1('0x156')};}else{logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x157'),this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x114421[_0xbaa1('0x153')]));this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xbaa1('0x3a')],_0x114421[_0xbaa1('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbaa1('0xe')]['playback']=function(_0x12ab66){logger['info'](util[_0xbaa1('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x12ab66[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x12ab66['file_id'])){return this[_0xbaa1('0x35')]['error'](_0x12ab66,'no\x20file\x20audio\x20selected');}var _0x28eec8=this[_0xbaa1('0x1e')][_0xbaa1('0x6a')](this,_0x12ab66[_0xbaa1('0x114')]);if(!_0x28eec8){return this['channel']['error'](_0x12ab66,_0xbaa1('0x116'));}var _0x9ad8a5=this[_0xbaa1('0x35')][_0xbaa1('0xa5')]('PLAYBACK',[_0x28eec8,_0x12ab66['opts']]);if(_0x9ad8a5[_0xbaa1('0xa7')]===-0x1){return _0x9ad8a5;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xc2'),_0xbaa1('0x169'),_0x28eec8));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x16a')]=function(_0x580a40){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x16b'),_0x580a40[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x580a40['queue_id'])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x580a40,'no\x20queue\x20selected');}var _0x2a9426='';var _0x2714ba=parseInt(_0x580a40[_0xbaa1('0x16c')],0xa);if(isNaN(_0x2714ba)){_0x2a9426=_0x580a40[_0xbaa1('0x16c')];}else{_0x2a9426=this['getVoiceQueue'][_0xbaa1('0x6a')](this,_0x580a40[_0xbaa1('0x16c')]);if(!_0x2a9426){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x580a40,_0xbaa1('0x16d'));}}var _0x2480b4='';if(this['isConfigured'](_0x580a40['file_id'])){var _0x5287f4=this['getSound'][_0xbaa1('0x6a')](this,_0x580a40[_0xbaa1('0x114')]);if(_0x5287f4){_0x2480b4=_0x5287f4;}}this[_0xbaa1('0x34')]['sync'](this,_0x580a40,_0x2a9426);if(_0x580a40[_0xbaa1('0xe5')][_0xbaa1('0x16e')]('x')<0x0){_0x580a40[_0xbaa1('0xe5')]+='x';}if(_0x580a40[_0xbaa1('0xe5')][_0xbaa1('0x16e')]('X')<0x0){_0x580a40['opts']+='X';}this[_0xbaa1('0x35')]['setVariable'](_0xbaa1('0x16f'),_0x2a9426?_0x2a9426[_0xbaa1('0x170')]():'');var _0x1e863a=this[_0xbaa1('0x35')][_0xbaa1('0xa5')](_0xbaa1('0x171'),[_0x2a9426,_0x580a40[_0xbaa1('0xe5')],_0x580a40[_0xbaa1('0x6c')],_0x2480b4,_0x580a40[_0xbaa1('0x60')],_0x580a40[_0xbaa1('0xb2')],_0x580a40['macro'],_0x580a40['gosub'],'',_0x580a40['position']]);if(_0x1e863a['result']===-0x1){return _0x1e863a;}return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xc2'),_0xbaa1('0x171'),_0x2a9426));};AGIVertices[_0xbaa1('0xe')]['record']=function(_0x4bbec2){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x172'),_0x4bbec2[_0xbaa1('0x37')]));var _0x5c5ce4=_0x4bbec2[_0xbaa1('0x173')]||_0xbaa1('0x131');var _0x77b061=util[_0xbaa1('0x27')](_0xbaa1('0x174'),this[_0xbaa1('0x35')][_0xbaa1('0x36')],rs[_0xbaa1('0x11b')](0x5));var _0x27d094=util[_0xbaa1('0x27')](_0xbaa1('0x175'),FILES_PATH,_0x77b061,_0x5c5ce4);var _0x1a25ad=util[_0xbaa1('0x27')](_0xbaa1('0x14c'),FILES_PATH,_0x77b061);this[_0xbaa1('0x3b')][_0xbaa1('0x6a')](this,_0x4bbec2,_0x77b061,_0x27d094);this['channel'][_0xbaa1('0x9b')](_0xbaa1('0x176'),_0x77b061);logger['info'](_0xbaa1('0x177'),_0x1a25ad,_0x5c5ce4,_0x4bbec2[_0xbaa1('0x178')],_0x4bbec2[_0xbaa1('0x60')]);return this[_0xbaa1('0x35')]['recordFile'](_0x1a25ad,_0x5c5ce4,_0x4bbec2[_0xbaa1('0x178')],_0x4bbec2[_0xbaa1('0x60')],undefined,!![]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x179')]=function(_0x594f29){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x594f29[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x594f29[_0xbaa1('0x6c')])){return this['channel'][_0xbaa1('0xa2')](_0xbaa1('0x17a'));}var _0x524a59=this['restAPI'][_0xbaa1('0x6a')](this,_0x594f29);logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x17b'),util[_0xbaa1('0x17c')](_0x524a59,{'showHidden':![],'depth':null})));if(!this[_0xbaa1('0x81')](_0x594f29[_0xbaa1('0xd6')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x17d'));}var _0x241288=this[_0xbaa1('0xf')]['sync'](this,_0x594f29[_0xbaa1('0xd6')]);if(!_0x241288){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x594f29,_0xbaa1('0xd8'));}this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')]('%s_STATUS_CODE',_0x241288),_0x524a59[_0xbaa1('0x72')]?_0x524a59[_0xbaa1('0x72')]:_0xbaa1('0x17e'));this[_0xbaa1('0x35')][_0xbaa1('0x9b')](util[_0xbaa1('0x27')](_0xbaa1('0x17f'),_0x241288),_0x524a59[_0xbaa1('0x71')]?_0x524a59[_0xbaa1('0x71')]:'OK');if(_0x524a59[_0xbaa1('0x6f')]){try{this['saveRestApiResult'](_0x524a59[_0xbaa1('0x6f')],_0x241288);}catch(_0x143532){logger[_0xbaa1('0x2a')](util[_0xbaa1('0x27')](_0xbaa1('0x180'),_0x241288));}}return this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0xdd'),_0x241288));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x181')]=function(_0x1c6d93){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1c6d93[_0xbaa1('0x37')]));return this['channel'][_0xbaa1('0x182')](_0x1c6d93['digits'][_0xbaa1('0x56')](/\s+/g,''),_0x1c6d93[_0xbaa1('0x178')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x183')]=function(_0x4e5235){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4e5235['label']));return this[_0xbaa1('0x35')][_0xbaa1('0x184')](_0x4e5235[_0xbaa1('0x61')][_0xbaa1('0x56')](/\s+/g,''),_0x4e5235[_0xbaa1('0x178')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x185')]=function(_0x360ba5){logger['info'](util['format'](_0xbaa1('0x186'),_0x360ba5['label']));return this[_0xbaa1('0x35')][_0xbaa1('0x187')](_0x360ba5[_0xbaa1('0x59')],_0x360ba5[_0xbaa1('0x178')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x188')]=function(_0x127379){logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x189'),_0x127379[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x127379['account_id'])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0x18a'));}var _0x456aaf=this[_0xbaa1('0x20')][_0xbaa1('0x6a')](this,_0x127379[_0xbaa1('0x18b')]);if(!_0x456aaf||!_0x456aaf[_0xbaa1('0x18c')]){return this['channel']['error'](_0x127379,_0xbaa1('0x18d'));}var _0x2162e3={'from':util[_0xbaa1('0x27')](_0xbaa1('0x18e'),_0x456aaf['name'],_0x456aaf[_0xbaa1('0x18f')]||_0x456aaf[_0xbaa1('0x18c')][_0xbaa1('0x190')]),'to':_0x127379['to']||'','cc':_0x127379['cc']||'','bcc':_0x127379[_0xbaa1('0x191')]||'','subject':_0x127379[_0xbaa1('0x192')],'html':_0x127379[_0xbaa1('0x59')],'text':_0x127379[_0xbaa1('0x59')]};if(this['isConfigured'](_0x127379['template_id'])){}logger['debug']('sendMail\x20message',JSON[_0xbaa1('0x6e')](_0x2162e3));this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x127379,_0x127379[_0xbaa1('0x18b')]);this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x193'),_0x456aaf[_0xbaa1('0x12')]));this[_0xbaa1('0x22')][_0xbaa1('0x6a')](this,_0x456aaf[_0xbaa1('0x194')],_0x2162e3);return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x195'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x196')]=function(_0x20b274){logger['info'](util[_0xbaa1('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x20b274['label']));return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0x197'));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x198')]=function(_0x4c585a){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x199'),_0x4c585a['label']));if(!this[_0xbaa1('0x81')](_0x4c585a[_0xbaa1('0x19a')])){return this[_0xbaa1('0x35')]['noop'](_0xbaa1('0x19b'));}var _0x34b567=this[_0xbaa1('0x32')][_0xbaa1('0x6a')](this,_0x4c585a['sms_account_id']);if(!_0x34b567){return this['channel']['error'](_0x4c585a,_0xbaa1('0x19c'));}var _0x6ae18f={'body':_0x4c585a[_0xbaa1('0x19d')],'phone':_0x4c585a['to']||'','SmsAccountId':_0x34b567['id']};logger['debug'](_0xbaa1('0x19e'),JSON['stringify'](_0x6ae18f));this['createSquareDetailsReport']['sync'](this,_0x4c585a,_0x4c585a[_0xbaa1('0x19a')]);this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x19f'),_0x34b567[_0xbaa1('0x12')]));this[_0xbaa1('0x33')][_0xbaa1('0x6a')](this,_0x6ae18f);return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x1a0'));};AGIVertices['prototype'][_0xbaa1('0x1a1')]=function(_0x22fbe5){logger['info'](util[_0xbaa1('0x27')](_0xbaa1('0x1a2'),_0x22fbe5[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x22fbe5[_0xbaa1('0xd6')])){return this['channel'][_0xbaa1('0x2a')](_0x22fbe5,_0xbaa1('0x1a3'));}var _0x3e9065=this[_0xbaa1('0xf')]['sync'](this,_0x22fbe5[_0xbaa1('0xd6')]);if(!_0x3e9065){return this[_0xbaa1('0x35')]['error'](_0x22fbe5,_0xbaa1('0xd8'));}return this['channel'][_0xbaa1('0x9b')](_0x3e9065,_0x22fbe5[_0xbaa1('0x1a4')]);};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1a5')]=function(_0x3d8fe9){logger['info'](util[_0xbaa1('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3d8fe9[_0xbaa1('0x37')]));this['channel'][_0xbaa1('0xa2')](_0xbaa1('0x1a6'));if(_0x3d8fe9[_0xbaa1('0xb8')]==='yes'){this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0x1a7'));return this[_0xbaa1('0x35')]['answer']();}return this['channel'][_0xbaa1('0xa2')](_0xbaa1('0x1a8'));};AGIVertices[_0xbaa1('0xe')]['subproject']=function(_0x28a475){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x1a9'),_0x28a475[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x28a475[_0xbaa1('0x1aa')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x28a475,_0xbaa1('0x1ab'));}var _0x5b3f8f=this[_0xbaa1('0x15')][_0xbaa1('0x6a')](this,_0x28a475[_0xbaa1('0x1aa')]);if(!this['isConfigured'](_0x5b3f8f)){return this[_0xbaa1('0x35')]['error'](_0x28a475,util[_0xbaa1('0x27')](_0xbaa1('0x1ac'),_0x28a475[_0xbaa1('0x1aa')]));}if(_0x5b3f8f===this[_0xbaa1('0x35')][_0xbaa1('0x39')]){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x28a475,_0xbaa1('0x1ad'));}this[_0xbaa1('0x34')][_0xbaa1('0x6a')](this,_0x28a475,_0x5b3f8f);var _0x5d756f=this[_0xbaa1('0x35')][_0xbaa1('0xa5')]('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xbaa1('0xb2')][_0xbaa1('0x1ae')]||_0xbaa1('0x1af'),_0x5b3f8f,this['channel']['arg_1']));if(_0x5d756f[_0xbaa1('0xa7')]===-0x1){return _0x5d756f;}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0xc2'),'AGI',_0x5b3f8f));};AGIVertices[_0xbaa1('0xe')]['system']=function(_0x303796){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x1b0'),_0x303796[_0xbaa1('0x37')]));var _0x3c0f64=this[_0xbaa1('0x1b1')]['sync'](this,_0x303796[_0xbaa1('0xb4')]);this[_0xbaa1('0x34')]['sync'](this,_0x303796,_0x303796[_0xbaa1('0xb4')]);if(this[_0xbaa1('0x81')](_0x303796[_0xbaa1('0xd6')])){var _0x1c9b57=this['getVariable']['sync'](this,_0x303796[_0xbaa1('0xd6')]);if(_0x1c9b57){this[_0xbaa1('0x35')][_0xbaa1('0x9b')](_0x1c9b57,_0x3c0f64);return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x1b2'),_0x303796[_0xbaa1('0xb4')],_0x1c9b57));}}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x303796[_0xbaa1('0xb4')]));};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1b3')]=function(_0x210237){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x1b4'),_0x210237[_0xbaa1('0x37')]));_0x210237[_0xbaa1('0x59')]=_0x210237['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x210237[_0xbaa1('0x58')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x210237[_0xbaa1('0x59')])){return this['channel'][_0xbaa1('0xa2')]('no\x20text\x20configured');}this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x210237[_0xbaa1('0x59')]));var _0x5a5815=this[_0xbaa1('0x57')][_0xbaa1('0x6a')](this,_0x210237);if(_0x5a5815){this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x1b5'),_0x5a5815));var _0x39efb0=this['channel'][_0xbaa1('0x127')](_0x5a5815);try{fs[_0xbaa1('0x105')](_0x5a5815+_0xbaa1('0x128'));}catch(_0x1bb68d){logger[_0xbaa1('0x2a')](_0x1bb68d);}return _0x39efb0;}return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x210237,_0xbaa1('0x1b6'));};AGIVertices[_0xbaa1('0xe')]['tts']=function(_0x34b35e){logger['info'](util[_0xbaa1('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x34b35e['label']));_0x34b35e[_0xbaa1('0x59')]=_0x34b35e[_0xbaa1('0x59')][_0xbaa1('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x34b35e[_0xbaa1('0x59')])){return this[_0xbaa1('0x35')][_0xbaa1('0xa2')](_0xbaa1('0xa3'));}this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0x1b7'),_0x34b35e[_0xbaa1('0x59')]));var _0x5cafad=this[_0xbaa1('0x5e')][_0xbaa1('0x6a')](this,_0x34b35e);if(_0x5cafad){this['channel'][_0xbaa1('0xa2')](util[_0xbaa1('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x5cafad));var _0x2ca2c0=this[_0xbaa1('0x35')]['streamFile'](_0x5cafad);try{fs[_0xbaa1('0x105')](_0x5cafad+_0xbaa1('0x128'));}catch(_0x2e8495){logger[_0xbaa1('0x2a')](_0x2e8495);}return _0x2ca2c0;}return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x34b35e,_0xbaa1('0x1b8'));};AGIVertices[_0xbaa1('0xe')]['unpause']=function(_0x36be54){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x36be54[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x36be54['findBy'])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x36be54,'no\x20find\x20by\x20configured');}logger[_0xbaa1('0x2e')](util['format'](_0xbaa1('0x154'),this['channel'][_0xbaa1('0x3a')],_0x36be54['findBy']));var _0x584dd6=this['agentUnpause'][_0xbaa1('0x6a')](this,_0x36be54[_0xbaa1('0x153')]);if(_0x584dd6){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbaa1('0x35')]['callerid'],_0x36be54[_0xbaa1('0x153')]));this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x155'),this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x36be54[_0xbaa1('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x157'),this[_0xbaa1('0x35')][_0xbaa1('0x3a')],_0x36be54[_0xbaa1('0x153')]));this[_0xbaa1('0x35')][_0xbaa1('0xa2')](util[_0xbaa1('0x27')](_0xbaa1('0x157'),this['channel'][_0xbaa1('0x3a')],_0x36be54['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbaa1('0xe')][_0xbaa1('0x1b9')]=function(_0x481235){logger[_0xbaa1('0x2e')](util[_0xbaa1('0x27')](_0xbaa1('0x1ba'),_0x481235[_0xbaa1('0x37')]));var _0xe49d8=this['channel'][_0xbaa1('0xa5')]('VOICEMAIL',[_0x481235[_0xbaa1('0x1bb')],_0x481235['options']]);if(_0xe49d8[_0xbaa1('0xa7')]===-0x1){return _0xe49d8;}return this[_0xbaa1('0x35')]['noop'](util[_0xbaa1('0x27')](_0xbaa1('0xc2'),'VOICEMAIL',_0x481235[_0xbaa1('0x1bb')]));};AGIVertices[_0xbaa1('0xe')]['vswitch']=function(_0x1ef09e){logger['info'](util['format'](_0xbaa1('0x1bc'),_0x1ef09e[_0xbaa1('0x37')]));if(!this[_0xbaa1('0x81')](_0x1ef09e[_0xbaa1('0xd6')])){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x1ef09e,_0xbaa1('0x1a3'));}var _0x4ca0d1=this[_0xbaa1('0xf')][_0xbaa1('0x6a')](this,_0x1ef09e['variable_id']);if(!_0x4ca0d1){return this[_0xbaa1('0x35')][_0xbaa1('0x2a')](_0x1ef09e,_0xbaa1('0xd8'));}var _0x4bf77f=this[_0xbaa1('0x35')][_0xbaa1('0xf')](_0x4ca0d1);return{'code':0xc8,'result':_0x4bf77f[_0xbaa1('0x9e')]?_0x4bf77f['extra']:'-'};};String[_0xbaa1('0xe')][_0xbaa1('0x9d')]=function(_0x1e5dde,_0x5bfe63){return this[_0xbaa1('0x9c')](_0x1e5dde)[_0xbaa1('0x1bd')](_0x5bfe63);};module['exports']=AGIVertices; \ No newline at end of file +var _0x7e22=['googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','IntervalId','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','toString','getPause','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','en-US','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','tildeASR','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','no\x20grammar\x20configured','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','forEach','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','no\x20find\x20by\x20configured','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','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','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','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','apiKey','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'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x7e22,0x1d8));var _0x27e2=function(_0x51d2bb,_0x2df93c){_0x51d2bb=_0x51d2bb-0x0;var _0x17c3ee=_0x7e22[_0x51d2bb];return _0x17c3ee;};'use strict';var fs=require('fs');var util=require(_0x27e2('0x0'));var _=require('lodash');var sh=require(_0x27e2('0x1'));var odbc=require(_0x27e2('0x2'))();var rs=require(_0x27e2('0x3'));var moment=require(_0x27e2('0x4'));var Mustache=require(_0x27e2('0x5'));var rp=require(_0x27e2('0x6'));var logger=require('../../config/logger')(_0x27e2('0x7'));var config=require('../../config/environment');var shared=require(_0x27e2('0x8'));var scripts=require(_0x27e2('0x9'));var FILES_PATH=_0x27e2('0xa');var recursiveMapAttributes=[_0x27e2('0xb'),'rawBody'];var verticesWithRetry=[_0x27e2('0xc'),_0x27e2('0xd'),_0x27e2('0xe')];var AGIVertices=function(_0x49591c,_0x29d007,_0xadcc3e){this[_0x27e2('0xf')]=_0x49591c;this[_0x27e2('0x10')]=_0x29d007;this['mailRpc']=_0xadcc3e;};AGIVertices[_0x27e2('0x11')][_0x27e2('0x12')]=function(_0x485e59,_0x1263c4){this[_0x27e2('0x10')][_0x27e2('0x13')](_0x485e59)[_0x27e2('0x14')](function(_0x5f5603){_0x1263c4(null,_0x5f5603?_0x5f5603[_0x27e2('0x15')]:![]);})['catch'](function(_0x39d327){_0x1263c4(_0x39d327);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x16')]=function(_0x2f60b2,_0x1a6014){this['rpc'][_0x27e2('0x17')](_0x2f60b2)['then'](function(_0x3bc375){_0x1a6014(null,_0x3bc375?_0x3bc375[_0x27e2('0x15')]:![]);})[_0x27e2('0x18')](function(_0x36aa5b){_0x1a6014(_0x36aa5b);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x19')]=function(_0x371885,_0x18a838){this['rpc']['getSquareProjectById'](_0x371885)[_0x27e2('0x14')](function(_0x1c5847){_0x18a838(null,_0x1c5847?_0x1c5847['name']:![]);})[_0x27e2('0x18')](function(_0x1f15d7){_0x18a838(_0x1f15d7);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1a')]=function(_0x127d7e,_0x502c9e){this[_0x27e2('0x10')][_0x27e2('0x1b')](_0x127d7e)[_0x27e2('0x14')](function(_0x4c3e17){_0x502c9e(null,_0x4c3e17?_0x4c3e17[_0x27e2('0x1c')]:![]);})[_0x27e2('0x18')](function(_0x5cd417){_0x502c9e(_0x5cd417);});};AGIVertices['prototype'][_0x27e2('0x1d')]=function(_0x43cc48,_0x2e9b70){this[_0x27e2('0x10')][_0x27e2('0x1e')](_0x43cc48)[_0x27e2('0x14')](function(_0x3cb5b1){_0x2e9b70(null,_0x3cb5b1?_0x3cb5b1['name']:![]);})['catch'](function(_0x3d8126){_0x2e9b70(_0x3d8126);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1f')]=function(_0x270cf3,_0xe04676){this[_0x27e2('0x10')]['getTrunkById'](_0x270cf3)[_0x27e2('0x14')](function(_0x30b0a9){_0xe04676(null,_0x30b0a9?_0x30b0a9['name']:![]);})[_0x27e2('0x18')](function(_0x361ba5){_0xe04676(_0x361ba5);});};AGIVertices['prototype']['getSound']=function(_0x437595,_0x45c242){var _0x3ede2e=this;this[_0x27e2('0x10')][_0x27e2('0x20')](_0x437595)[_0x27e2('0x14')](function(_0x175c05){_0x45c242(null,_0x175c05?_0x3ede2e[_0x27e2('0x21')](_0x175c05['save_name']):![]);})['catch'](function(_0x2a2da3){_0x45c242(_0x2a2da3);});};AGIVertices['prototype'][_0x27e2('0x22')]=function(_0x4e49bb,_0x16412d){this[_0x27e2('0x10')][_0x27e2('0x23')](_0x4e49bb)[_0x27e2('0x14')](function(_0x14203d){_0x16412d(null,_0x14203d?_0x14203d:![]);})[_0x27e2('0x18')](function(_0x5425c7){_0x16412d(_0x5425c7);});};AGIVertices[_0x27e2('0x11')]['sendMailMessage']=function(_0x515d92,_0x1daf49,_0x25ba25){this[_0x27e2('0x24')][_0x27e2('0x25')](_0x515d92,_0x1daf49)[_0x27e2('0x14')](function(){_0x25ba25(null);})[_0x27e2('0x18')](function(_0xb278c6){_0x25ba25(_0xb278c6);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x26')]=function(_0x41f036,_0x121ca5){this['rpc']['getIntervalById'](_0x41f036)[_0x27e2('0x14')](function(_0x576678){if(_0x576678){if(_0x576678[_0x27e2('0x27')]){_0x121ca5(null,[_0x576678['interval']]);}else{_0x121ca5(null,_[_0x27e2('0x28')](_0x576678[_0x27e2('0x29')],'interval'));}}else{_0x121ca5(null,![]);}})['catch'](function(_0x205ae3){_0x121ca5(_0x205ae3);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x21')]=function(_0x2ebfed){return util[_0x27e2('0x2a')](_0x27e2('0x2b'),FILES_PATH,_0x2ebfed);};AGIVertices['prototype'][_0x27e2('0x2c')]=function(_0x59abaa,_0x51a01d,_0x2a07fa){odbc[_0x27e2('0x2d')](_0x59abaa,function(_0x26003d){if(_0x26003d){logger[_0x27e2('0x2e')](_0x27e2('0x2f'),_0x26003d);_0x2a07fa(_0x26003d);}else{logger[_0x27e2('0x30')](_0x27e2('0x31'));odbc[_0x27e2('0x32')](_0x51a01d,function(_0x4bc31f,_0x387ea6){if(_0x4bc31f){logger[_0x27e2('0x30')](_0x27e2('0x33'),_0x51a01d);_0x2a07fa(_0x4bc31f);}else{logger['info'](_0x27e2('0x34'),_0x51a01d);odbc['close'](function(_0x1e2d5d){if(_0x1e2d5d){logger['error'](_0x27e2('0x35'),_0x1e2d5d);}_0x2a07fa(null,_0x387ea6);});}});}});};AGIVertices[_0x27e2('0x11')]['getSmsAccount']=function(_0x609829,_0x2402fc){this[_0x27e2('0x10')][_0x27e2('0x36')](_0x609829)[_0x27e2('0x14')](function(_0x2fd0e5){_0x2402fc(null,_0x2fd0e5?_0x2fd0e5:![]);})['catch'](function(_0xa8ad6){_0x2402fc(_0xa8ad6);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x37')]=function(_0x5da152,_0x2927b3){this[_0x27e2('0x10')][_0x27e2('0x37')](_0x5da152)[_0x27e2('0x14')](function(_0x401215){_0x2927b3(null,_0x401215);})['catch'](function(_0x9cc20d){_0x2927b3(_0x9cc20d);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x38')]=function(_0x2f8f9d,_0x353a3e,_0x2a1062){this[_0x27e2('0x10')][_0x27e2('0x38')]({'uniqueid':this[_0x27e2('0xf')][_0x27e2('0x39')],'node':_0x2f8f9d[_0x27e2('0x3a')],'application':_0x2f8f9d[_0x27e2('0x3b')],'data':_0x353a3e||null,'project_name':this[_0x27e2('0xf')][_0x27e2('0x3c')],'callerid':this[_0x27e2('0xf')]['callerid']})[_0x27e2('0x14')](function(_0x4a0434){if(_0x2a1062){_0x2a1062(null,_0x4a0434);}})['catch'](function(_0x2f2504){if(_0x2a1062){_0x2a1062(_0x2f2504);}});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x3d')]=function(_0x76a086,_0x3e9ac8,_0x5e4b6e,_0x4da6b8){this['rpc'][_0x27e2('0x3d')]({'uniqueid':this[_0x27e2('0xf')][_0x27e2('0x39')],'callerid':this[_0x27e2('0xf')][_0x27e2('0x3e')],'calleridname':this[_0x27e2('0xf')][_0x27e2('0x3f')],'context':this['channel'][_0x27e2('0x40')],'extension':this[_0x27e2('0xf')]['extension'],'priority':this[_0x27e2('0xf')][_0x27e2('0x41')],'accountcode':this[_0x27e2('0xf')][_0x27e2('0x42')],'dnid':this['channel'][_0x27e2('0x43')],'projectName':this[_0x27e2('0xf')][_0x27e2('0x3c')],'saveName':_0x3e9ac8,'filename':_0x76a086[_0x27e2('0x44')]||_0x3e9ac8,'savePath':_0x5e4b6e})[_0x27e2('0x14')](function(_0x49b988){_0x4da6b8(null,_0x49b988);})[_0x27e2('0x18')](function(_0x39d0c7){_0x4da6b8(_0x39d0c7);});};AGIVertices[_0x27e2('0x11')]['createSquareMessage']=function(_0x154476,_0x1df07f,_0x4c509e,_0xbbe0,_0x1e21ef){this[_0x27e2('0x10')][_0x27e2('0x45')]({'uniqueid':this[_0x27e2('0xf')][_0x27e2('0x39')],'body':_0x154476,'direction':_0x1df07f,'providerName':_0x4c509e,'providerResponse':_0xbbe0})[_0x27e2('0x14')](function(_0xfea0c4){if(_0x1e21ef){_0x1e21ef(null,_0xfea0c4);}})[_0x27e2('0x18')](function(_0x121857){if(_0x1e21ef){_0x1e21ef(_0x121857);}});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x46')]=function(_0x5457fa,_0x420217){this['rpc'][_0x27e2('0x46')]({'firstName':_[_0x27e2('0x47')](_0x5457fa[_0x27e2('0x15')])||_[_0x27e2('0x48')](_0x5457fa[_0x27e2('0x15')])?_0x27e2('0x49')+Math[_0x27e2('0x4a')]():_0x5457fa['name'],'lastName':_[_0x27e2('0x47')](_0x5457fa[_0x27e2('0x4b')])||_['isNil'](_0x5457fa[_0x27e2('0x4b')])?null:_0x5457fa['lastName'],'phone':_0x5457fa['phone'],'ListId':_0x5457fa[_0x27e2('0x4c')],'scheduledat':_0x5457fa[_0x27e2('0x4d')],'callbackUniqueid':this[_0x27e2('0xf')]['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x5457fa[_0x27e2('0x4d')][_0x27e2('0x4e')](),'priority':_0x5457fa['callback_priority']})[_0x27e2('0x14')](function(_0x3779d1){_0x420217(null,_0x3779d1);})[_0x27e2('0x18')](function(_0x1414fa){_0x420217(_0x1414fa);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x4f')]=function(_0x21777c,_0x4f1f94){this[_0x27e2('0x10')]['getPauseById'](_0x21777c)[_0x27e2('0x14')](function(_0x7504e9){_0x4f1f94(null,_0x7504e9?_0x7504e9[_0x27e2('0x15')]:![]);})['catch'](function(_0x42c70d){_0x4f1f94(_0x42c70d);});};AGIVertices['prototype']['agentPause']=function(_0x2f5ef4,_0x191a5f,_0x39ce3f){var _0xf7e415={'role':_0x27e2('0x50')};_0xf7e415[_0x2f5ef4]=this[_0x27e2('0xf')][_0x27e2('0x3e')];this[_0x27e2('0x10')][_0x27e2('0x51')](_0xf7e415,_0x191a5f,this['channel'][_0x27e2('0x39')])[_0x27e2('0x14')](function(_0x34e630){_0x39ce3f(null,_[_0x27e2('0x48')](_0x34e630)?![]:!![]);})['catch'](function(_0x1ce851){logger['error'](_0x1ce851);_0x39ce3f(null,![]);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x52')]=function(_0x399510,_0x1bab7c){var _0x2ffd87={'role':_0x27e2('0x50')};_0x2ffd87[_0x399510]=this[_0x27e2('0xf')][_0x27e2('0x3e')];this[_0x27e2('0x10')][_0x27e2('0x52')](_0x2ffd87)[_0x27e2('0x14')](function(_0x4340c6){_0x1bab7c(null,_[_0x27e2('0x48')](_0x4340c6)?![]:!![]);})[_0x27e2('0x18')](function(_0x56732e){logger[_0x27e2('0x2e')](_0x56732e);_0x1bab7c(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x3fac67,_0x59a134){var _0x806cc2={'role':_0x27e2('0x50')};_0x806cc2[_0x3fac67]=this[_0x27e2('0xf')][_0x27e2('0x3e')];this[_0x27e2('0x10')][_0x27e2('0x53')](_0x806cc2)[_0x27e2('0x14')](function(_0x1fb68f){_0x59a134(null,_[_0x27e2('0x48')](_0x1fb68f)?![]:!![]);})['catch'](function(_0x40dc82){logger[_0x27e2('0x2e')](_0x40dc82);_0x59a134(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x15508c,_0x3f95b3){var _0x2158a5={'role':_0x27e2('0x50')};_0x2158a5[_0x15508c]=this[_0x27e2('0xf')][_0x27e2('0x3e')];var _0x39435b=_0x15508c!=_0x27e2('0x54')?util['format'](_0x27e2('0x55'),_0x27e2('0x56'),this[_0x27e2('0xf')]['callerid']):undefined;this[_0x27e2('0x10')][_0x27e2('0x57')](_0x2158a5,_0x39435b)[_0x27e2('0x14')](function(_0x540504){_0x3f95b3(null,_[_0x27e2('0x48')](_0x540504)?![]:!![]);})[_0x27e2('0x18')](function(_0x53f3a2){logger['error'](_0x53f3a2);_0x3f95b3(null,![]);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x58')]=function(_0x30c813,_0x1ee565){sh[_0x27e2('0x59')](_['trim'](_0x30c813),function(_0x582d82,_0x292cd4){var _0x4c099e=_0x292cd4['replace'](/(\r\n|\n|\r)/gm,'');_0x1ee565(null,_0x4c099e);});};AGIVertices['prototype'][_0x27e2('0x5a')]=function(_0x344ab3,_0x53ea1a){scripts[_0x27e2('0x5a')](_0x344ab3['apiKey'],_0x344ab3[_0x27e2('0x5b')]||_0x27e2('0x5c'),_0x344ab3[_0x27e2('0x5c')],_0x344ab3[_0x27e2('0x5d')]||'en-US',_0x344ab3[_0x27e2('0x5e')]||_0x27e2('0x5f'),_0x344ab3['audioEncoding']||_0x27e2('0x60'))[_0x27e2('0x14')](function(_0x266f41){_0x53ea1a(null,_0x266f41);})[_0x27e2('0x18')](function(_0x5bc9e6){_0x53ea1a(_0x5bc9e6);});};AGIVertices[_0x27e2('0x11')]['googleTTS']=function(_0x2b1006,_0x22c99f){scripts['googleTTS'](_0x2b1006[_0x27e2('0x5c')],_0x2b1006[_0x27e2('0x61')]||'en',0x1)[_0x27e2('0x14')](function(_0x3004fd){_0x22c99f(null,_0x3004fd);})[_0x27e2('0x18')](function(_0xeb4026){_0x22c99f(_0xeb4026);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x62')]=function(_0x4d9b8a,_0xfaafa4){var _0x337dc3={'uri':_0x4d9b8a[_0x27e2('0x63')],'method':_0x4d9b8a[_0x27e2('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4d9b8a['timeout'])===_0x27e2('0x65')&&parseInt(_0x4d9b8a[_0x27e2('0x66')])>=0x1?parseInt(_0x4d9b8a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x27e2('0x67')]([_0x27e2('0x68'),_0x27e2('0x69')],_0x337dc3[_0x27e2('0x64')][_0x27e2('0x6a')]())){try{_0x337dc3[_0x27e2('0x6b')]=_0x4d9b8a[_0x27e2('0x6c')]?JSON[_0x27e2('0x6d')](_0x4d9b8a[_0x27e2('0x6c')]):{};}catch(_0x1cc141){logger[_0x27e2('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1cc141);}}try{_0x337dc3[_0x27e2('0x6e')]=_0x4d9b8a['rawHeaders']?JSON['parse'](_0x4d9b8a[_0x27e2('0xb')]):{};}catch(_0x17ad34){logger[_0x27e2('0x2e')](_0x27e2('0x6f'),_0x17ad34);}if(_0x4d9b8a['computedVariables']){try{var _0x225732=require(_0x4d9b8a['computedVariables'])[_0x27e2('0x70')](this,_0x337dc3);_0x337dc3[_0x27e2('0x71')]=Mustache[_0x27e2('0x72')](_0x4d9b8a[_0x27e2('0x63')],_0x225732,{},['$$','$$']);if(_0x337dc3[_0x27e2('0x6e')]){_0x337dc3[_0x27e2('0x6e')]=JSON[_0x27e2('0x6d')](Mustache[_0x27e2('0x72')](JSON[_0x27e2('0x73')](_0x337dc3[_0x27e2('0x6e')]),_0x225732,{},['$$','$$']));}if(_0x337dc3[_0x27e2('0x6b')]){_0x337dc3[_0x27e2('0x6b')]=JSON[_0x27e2('0x6d')](Mustache[_0x27e2('0x72')](JSON['stringify'](_0x337dc3[_0x27e2('0x6b')]),_0x225732,{},['$$','$$']));}}catch(_0x3b0edc){logger[_0x27e2('0x2e')](_0x27e2('0x74'),_0x3b0edc);}}rp(_0x337dc3)[_0x27e2('0x14')](function(_0x10f914){var _0x29346f={'statusCode':_0x10f914['statusCode']||0xc8,'statusMessage':_0x10f914[_0x27e2('0x75')]||'OK','headers':_0x10f914['headers']||{},'body':_0x10f914[_0x27e2('0x6b')]||{}};_0xfaafa4(null,_0x29346f);})[_0x27e2('0x18')](function(_0x17a771){var _0x3f0101={'statusCode':_0x17a771[_0x27e2('0x76')]||0x1f4,'statusMessage':_0x17a771[_0x27e2('0x77')]||_0x27e2('0x78'),'headers':_0x17a771[_0x27e2('0x79')][_0x27e2('0x6e')]||{},'body':_0x17a771[_0x27e2('0x79')]['body']||{}};_0xfaafa4(null,_0x3f0101);});};AGIVertices[_0x27e2('0x11')]['googleDialogflow']=function(_0x41bc73,_0x4901bd){scripts[_0x27e2('0x7a')](this[_0x27e2('0xf')][_0x27e2('0x39')],_0x41bc73['key'],_0x41bc73['text'],_0x41bc73[_0x27e2('0x7b')]||'en')[_0x27e2('0x14')](function(_0x21dd22){_0x4901bd(null,_0x21dd22);})['catch'](function(_0x15e657){_0x4901bd(_0x15e657);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x7c')]=function(_0x49dc28,_0x17b7b4){scripts[_0x27e2('0x7c')](this[_0x27e2('0xf')][_0x27e2('0x39')],_0x49dc28[_0x27e2('0x7d')],_0x49dc28[_0x27e2('0x7e')],_0x49dc28[_0x27e2('0x7f')],_0x49dc28[_0x27e2('0x5c')],_0x49dc28[_0x27e2('0x80')]||'en')[_0x27e2('0x14')](function(_0x66bd73){_0x17b7b4(null,_0x66bd73);})[_0x27e2('0x18')](function(_0x38ddd6){_0x17b7b4(_0x38ddd6);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x81')]=function(_0x56043f,_0x199918){scripts[_0x27e2('0x81')](this[_0x27e2('0xf')],_0x56043f)['then'](function(_0x177aa1){_0x199918(null,_0x177aa1);})[_0x27e2('0x18')](function(_0x441169){_0x199918(_0x441169);});};AGIVertices['prototype']['ispeechTTS']=function(_0x2ef551,_0x57d140){scripts[_0x27e2('0x82')](_0x2ef551[_0x27e2('0x83')],_0x2ef551['text'],_0x2ef551[_0x27e2('0x84')]||_0x27e2('0x85'),_0x2ef551[_0x27e2('0x86')])[_0x27e2('0x14')](function(_0xf9a72c){_0x57d140(null,_0xf9a72c);})[_0x27e2('0x18')](function(_0x4e9fff){_0x57d140(_0x4e9fff);});};AGIVertices['prototype'][_0x27e2('0x87')]=function(_0x6e90bd,_0x127a66,_0x59e9d8){scripts[_0x27e2('0x87')](_0x127a66,_0x6e90bd['key'],_0x6e90bd['ispeech_asr_language']||_0x27e2('0x85'),this['isConfigured'](_0x6e90bd[_0x27e2('0x88')])?_0x6e90bd[_0x27e2('0x88')]:undefined)[_0x27e2('0x14')](function(_0xe40154){_0x59e9d8(null,_0xe40154);})[_0x27e2('0x18')](function(_0x1cb512){_0x59e9d8(_0x1cb512);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x89')]=function(_0xf55619,_0x54d2fe){scripts[_0x27e2('0x89')](_0xf55619[_0x27e2('0x8a')],_0xf55619[_0x27e2('0x8b')],_0xf55619[_0x27e2('0x8c')],_0xf55619[_0x27e2('0x8d')]||_0x27e2('0x8e'),_0xf55619['text'],_0xf55619[_0x27e2('0x8f')]||'text')['then'](function(_0x66202a){_0x54d2fe(null,_0x66202a);})[_0x27e2('0x18')](function(_0x293ffe){_0x54d2fe(_0x293ffe);});};AGIVertices['prototype']['awsLex']=function(_0x30f8b3,_0x1a5231){scripts[_0x27e2('0x90')](this[_0x27e2('0xf')]['uniqueid'],_0x30f8b3[_0x27e2('0x8a')],_0x30f8b3[_0x27e2('0x8b')],_0x30f8b3[_0x27e2('0x91')],_0x30f8b3['text'],_0x30f8b3[_0x27e2('0x92')])[_0x27e2('0x14')](function(_0x39c60c){_0x1a5231(null,_0x39c60c);})[_0x27e2('0x18')](function(_0x32d6c3){_0x1a5231(_0x32d6c3);});};AGIVertices[_0x27e2('0x11')]['googleASR']=function(_0x2405b4,_0x1e28fb,_0x253981){scripts['googleASR'](_0x1e28fb,_0x2405b4[_0x27e2('0x83')],_0x2405b4['google_asr_language']||_0x27e2('0x85'))['then'](function(_0x4fd6df){_0x253981(null,_0x4fd6df);})['catch'](function(_0x46e793){_0x253981(_0x46e793);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x93')]=function(_0x4d2080,_0x5e27cf,_0x545d04){scripts[_0x27e2('0x93')](_0x5e27cf,_0x4d2080['appid'],_0x4d2080[_0x27e2('0x94')],_0x4d2080['uri'])['then'](function(_0x32c43f){_0x545d04(null,_0x32c43f);})[_0x27e2('0x18')](function(_0x303f99){_0x545d04(_0x303f99);});};AGIVertices[_0x27e2('0x11')][_0x27e2('0x95')]=function(_0x5d89ec){var _0x5d2aba=_[_0x27e2('0x67')](verticesWithRetry,_0x5d89ec[_0x27e2('0x3b')])?_0x5d89ec:_[_0x27e2('0x96')](_0x5d89ec);for(var _0x1dfe4b in _0x5d2aba){if(_0x5d2aba[_0x27e2('0x97')](_0x1dfe4b)){if(_0x5d2aba[_0x1dfe4b]&&_['isString'](_0x5d2aba[_0x1dfe4b])){if(_[_0x27e2('0x67')](recursiveMapAttributes,_0x1dfe4b)){_0x5d2aba[_0x1dfe4b]=this[_0x27e2('0x98')](_0x5d2aba[_0x1dfe4b]);}else{_0x5d2aba[_0x1dfe4b]=this['replaceAllVariables'](_0x5d2aba[_0x1dfe4b]);}}}}return _0x5d2aba;};AGIVertices[_0x27e2('0x11')][_0x27e2('0x99')]=function(_0x103d10){for(var _0x2f65cb in _0x103d10){if(_0x103d10[_0x27e2('0x97')](_0x2f65cb)){if(_[_0x27e2('0x9a')](_0x103d10[_0x2f65cb])){this[_0x27e2('0x99')](_0x103d10[_0x2f65cb]);}else if(_[_0x27e2('0x9b')](_0x103d10[_0x2f65cb])){for(var _0x4900d5=0x0;_0x4900d5<_0x103d10[_0x2f65cb][_0x27e2('0x9c')];_0x4900d5++){this[_0x27e2('0x99')](_0x103d10[_0x2f65cb][_0x4900d5]);}}else if(_[_0x27e2('0x9d')](_0x103d10[_0x2f65cb])){_0x103d10[_0x2f65cb]=this['replaceAllVariables'](_0x103d10[_0x2f65cb]);}}}};AGIVertices[_0x27e2('0x11')][_0x27e2('0x9e')]=function(_0x3ea0a0,_0x5a8ac5){for(var _0x51d14e in _0x3ea0a0){if(_0x3ea0a0[_0x27e2('0x97')](_0x51d14e)){if(_['isPlainObject'](_0x3ea0a0[_0x51d14e])){if(!_[_0x27e2('0x47')](_0x3ea0a0[_0x51d14e])){this[_0x27e2('0x9e')](_0x3ea0a0[_0x51d14e],util['format'](_0x27e2('0x9f'),_0x5a8ac5,_0x51d14e));}}else if(_[_0x27e2('0x9b')](_0x3ea0a0[_0x51d14e])){for(var _0x180d28=0x0;_0x180d28<_0x3ea0a0[_0x51d14e][_0x27e2('0x9c')];_0x180d28++){this[_0x27e2('0x9e')](_0x3ea0a0[_0x51d14e][_0x180d28],util[_0x27e2('0x2a')](_0x27e2('0x9f'),_0x5a8ac5,_0x51d14e+'['+_0x180d28+']'));}}else{if(!_[_0x27e2('0x48')](_0x3ea0a0[_0x51d14e])){this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')]('%s.%s',_0x5a8ac5,_0x51d14e),_0x3ea0a0[_0x51d14e]);}}}}};AGIVertices[_0x27e2('0x11')]['replaceObjectAllVariables']=function(_0x1ce379){try{var _0x15a4d2=JSON[_0x27e2('0x6d')](_0x1ce379);this[_0x27e2('0x99')](_0x15a4d2);return JSON[_0x27e2('0x73')](_0x15a4d2);}catch(_0x4ca54b){return this['replaceAllVariables'](_0x1ce379);}};AGIVertices[_0x27e2('0x11')][_0x27e2('0xa1')]=function(_0xacaad3){var _0x1437f7=_0xacaad3['split']('{');for(var _0x543850=0x1;_0x543850<_0x1437f7['length'];_0x543850+=0x1){var _0x588829=_0x1437f7[_0x543850][_0x27e2('0xa2')]('}');if(_0x588829['length']>0x1){_0xacaad3=_0xacaad3[_0x27e2('0xa3')]('{'+_0x588829[0x0]+'}',this['channel'][_0x27e2('0x12')](_0x588829[0x0])[_0x27e2('0xa4')]||_0x588829[0x0]);}}if(_0x1437f7[_0x27e2('0x9c')]===0x1){return _0xacaad3[_0x27e2('0x4e')]();}return this[_0x27e2('0xa1')](_0xacaad3);};AGIVertices[_0x27e2('0x11')][_0x27e2('0xa5')]=function(_0x571310,_0x214863){var _0x13ca9b=this['channel'][_0x27e2('0x12')](_0x571310);if(_0x13ca9b[_0x27e2('0xa6')]===-0x1){return _0x13ca9b;}logger['info'](util[_0x27e2('0x2a')](_0x27e2('0xa7'),_0x214863,_0x13ca9b['extra']));return this[_0x27e2('0xf')][_0x27e2('0xa0')](_0x214863,_0x13ca9b['extra']);};AGIVertices[_0x27e2('0x11')][_0x27e2('0xa8')]=function(_0x27fb6c){return _0x27fb6c&&_0x27fb6c!=='0'&&_0x27fb6c!=='-1'&&_0x27fb6c!=='';};AGIVertices['prototype'][_0x27e2('0xa9')]=function(_0x12efe5){this[_0x27e2('0x38')]['sync'](this,_0x12efe5,'-');_0x12efe5[_0x27e2('0xaa')]=_0x12efe5[_0x27e2('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x27e2('0x11')][_0x27e2('0xab')]=function(_0x4bdea6){logger['info'](util[_0x27e2('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4bdea6[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x4bdea6[_0x27e2('0x5c')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xad'));}var _0x42794d='\x22'+_0x4bdea6[_0x27e2('0x5c')]+'\x22';if(this[_0x27e2('0xa8')](_0x4bdea6[_0x27e2('0x79')])){_0x42794d+=','+_0x4bdea6['options'];}var _0x56c797=this['channel']['exec'](_0x27e2('0xae'),_0x42794d);if(_0x56c797[_0x27e2('0xa6')]===-0x1){return _0x56c797;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0xaf'),_0x42794d));};AGIVertices[_0x27e2('0x11')][_0x27e2('0xb0')]=function(_0x441102){logger[_0x27e2('0x30')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x441102[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x441102[_0x27e2('0xb1')])){return this[_0x27e2('0xf')][_0x27e2('0xac')]('no\x20grammar\x20configured');}var _0x3b2fa0=_0x441102[_0x27e2('0xb1')];if(this['isConfigured'](_0x441102['options'])){_0x3b2fa0+=','+_0x441102[_0x27e2('0x79')];}var _0x1c5dd4=this[_0x27e2('0xf')][_0x27e2('0x59')](_0x27e2('0xb2'),_0x3b2fa0);if(_0x1c5dd4[_0x27e2('0xa6')]===-0x1){return _0x1c5dd4;}var _0x263707=this[_0x27e2('0xa5')](_0x27e2('0xb3'),_0x27e2('0xb4'));if(_0x263707[_0x27e2('0xa6')]===-0x1){return _0x263707;}var _0x3c4b1b=this[_0x27e2('0xa5')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x3c4b1b['result']===-0x1){return _0x3c4b1b;}var _0x2de8de=this[_0x27e2('0xa5')]('RECOG_INSTANCE()',_0x27e2('0xb5'));if(_0x2de8de[_0x27e2('0xa6')]===-0x1){return _0x2de8de;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xb6'),_0x3b2fa0));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x7')]=function(_0x25561d){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xb7'),_0x25561d[_0x27e2('0x3a')]));return this[_0x27e2('0xf')][_0x27e2('0x7')]([_0x25561d[_0x27e2('0xb8')],_0x25561d[_0x27e2('0xb9')]]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0xba')]=function(_0xbe01db){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xbb'),_0xbe01db['label']));if(this['isConfigured'](_0xbe01db[_0x27e2('0x66')])){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xbc'),_0xbe01db[_0x27e2('0x66')]));var _0x1802e0=this['channel'][_0x27e2('0xbd')](_0xbe01db['timeout']);if(_0x1802e0[_0x27e2('0xa6')]===-0x1){return _0x1802e0;}}return this[_0x27e2('0xf')][_0x27e2('0xba')]();};AGIVertices[_0x27e2('0x11')][_0x27e2('0xbe')]=function(_0x3b3939){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3b3939['label']));if(!this[_0x27e2('0xa8')](_0x3b3939['list_id'])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x3b3939,_0x27e2('0xbf'));}_0x3b3939[_0x27e2('0x4d')]=moment();if(this[_0x27e2('0xa8')](_0x3b3939[_0x27e2('0xc0')])){_0x3b3939[_0x27e2('0x4d')]=moment()[_0x27e2('0xc1')](_0x3b3939[_0x27e2('0xc0')],_0x27e2('0xc2'));}if(!this[_0x27e2('0xa8')](_0x3b3939['callback_priority'])){_0x3b3939[_0x27e2('0xc3')]=0x2;}this['createCmContact'][_0x27e2('0x70')](this,_0x3b3939);return this['channel'][_0x27e2('0xac')](util['format'](_0x27e2('0xc4'),_0x3b3939[_0x27e2('0xc5')],_0x3b3939[_0x27e2('0x4c')],_0x3b3939[_0x27e2('0x4d')]));};AGIVertices['prototype'][_0x27e2('0xc6')]=function(_0x2410a8){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xc7'),_0x2410a8['label']));var _0x5767a6=this[_0x27e2('0xf')][_0x27e2('0x59')](_0x2410a8[_0x27e2('0xc8')],_0x2410a8['options']);if(_0x5767a6[_0x27e2('0xa6')]===-0x1){return _0x5767a6;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0xc9'),_0x2410a8[_0x27e2('0xc8')],_0x2410a8[_0x27e2('0x79')]));};AGIVertices['prototype'][_0x27e2('0xca')]=function(_0x25a693){logger['info'](util['format'](_0x27e2('0xcb'),_0x25a693[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x25a693[_0x27e2('0x5c')])){return this['channel'][_0x27e2('0xac')](_0x27e2('0xad'));}var _0x90a3e9='\x22'+_0x25a693[_0x27e2('0x5c')]+'\x22';if(this[_0x27e2('0xa8')](_0x25a693['options'])){_0x90a3e9+=','+_0x25a693[_0x27e2('0x79')];}var _0x3958e1=this[_0x27e2('0xf')][_0x27e2('0x59')](_0x27e2('0xae'),_0x90a3e9);if(_0x3958e1[_0x27e2('0xa6')]===-0x1){return _0x3958e1;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xaf'),_0x90a3e9));};AGIVertices[_0x27e2('0x11')]['sestektts']=function(_0x4ebe56){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0xcc'),_0x4ebe56['label']));if(!this['isConfigured'](_0x4ebe56[_0x27e2('0x5c')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xad'));}var _0x374865='\x22'+_0x4ebe56['text']+'\x22';if(this[_0x27e2('0xa8')](_0x4ebe56[_0x27e2('0x79')])){_0x374865+=','+_0x4ebe56[_0x27e2('0x79')];}var _0x43330f=this[_0x27e2('0xf')]['exec'](_0x27e2('0xae'),_0x374865);if(_0x43330f[_0x27e2('0xa6')]===-0x1){return _0x43330f;}return this['channel']['noop'](util[_0x27e2('0x2a')](_0x27e2('0xaf'),_0x374865));};AGIVertices[_0x27e2('0x11')]['lumenvoxasr']=function(_0x2959c0){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xcd'),_0x2959c0[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x2959c0[_0x27e2('0xb1')])){return this[_0x27e2('0xf')][_0x27e2('0xac')]('no\x20grammar\x20configured');}var _0x3d0e4c=_0x2959c0[_0x27e2('0xb1')];if(this['isConfigured'](_0x2959c0[_0x27e2('0x79')])){_0x3d0e4c+=','+_0x2959c0[_0x27e2('0x79')];}var _0x41eb34=this[_0x27e2('0xf')]['exec']('MRCPRecog',_0x3d0e4c);if(_0x41eb34['result']===-0x1){return _0x41eb34;}var _0x30c9d8=this[_0x27e2('0xa5')](_0x27e2('0xb3'),_0x27e2('0xce'));if(_0x30c9d8[_0x27e2('0xa6')]===-0x1){return _0x30c9d8;}var _0x16d333=this[_0x27e2('0xa5')](_0x27e2('0xcf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x16d333[_0x27e2('0xa6')]===-0x1){return _0x16d333;}var _0x322743=this[_0x27e2('0xa5')]('RECOG_INSTANCE()',_0x27e2('0xd0'));if(_0x322743[_0x27e2('0xa6')]===-0x1){return _0x322743;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0xb6'),_0x3d0e4c));};AGIVertices['prototype'][_0x27e2('0xd1')]=function(_0x3f7032){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x3f7032[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x3f7032[_0x27e2('0xb1')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xd2'));}var _0x4a6373=_0x3f7032[_0x27e2('0xb1')];if(this[_0x27e2('0xa8')](_0x3f7032[_0x27e2('0x79')])){_0x4a6373+=','+_0x3f7032['options'];}var _0x534832=this[_0x27e2('0xf')]['exec']('MRCPRecog',_0x4a6373);if(_0x534832['result']===-0x1){return _0x534832;}var _0x1ef1d5=this[_0x27e2('0xa5')](_0x27e2('0xb3'),'SESTEK_ASR_CONFIDENCE');if(_0x1ef1d5[_0x27e2('0xa6')]===-0x1){return _0x1ef1d5;}var _0x13aff4=this['getAndSetVariable']('RECOG_INPUT()',_0x27e2('0xd3'));if(_0x13aff4['result']===-0x1){return _0x13aff4;}var _0x2186f9=this[_0x27e2('0xa5')](_0x27e2('0xd4'),_0x27e2('0xd5'));if(_0x2186f9['result']===-0x1){return _0x2186f9;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4a6373));};AGIVertices[_0x27e2('0x11')][_0x27e2('0xd6')]=function(_0x36cdda){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xd7'),_0x36cdda[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x36cdda[_0x27e2('0xd8')])){return this[_0x27e2('0xf')]['error'](_0x36cdda,_0x27e2('0xd9'));}var _0x37764e=this[_0x27e2('0x1a')][_0x27e2('0x70')](this,_0x36cdda[_0x27e2('0xd8')]);if(!_0x37764e){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x36cdda,_0x27e2('0xda'));}if(!this[_0x27e2('0xa8')](_0x36cdda['query'])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x36cdda,_0x27e2('0xdb'));}var _0x5cdd2f=_0x36cdda['query'][_0x27e2('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xdd'),_0x5cdd2f));var _0x5d8dfe=this[_0x27e2('0x2c')][_0x27e2('0x70')](this,_0x37764e,_0x5cdd2f);this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x36cdda,_0x5cdd2f);if(!this[_0x27e2('0xa8')](_0x36cdda[_0x27e2('0xde')])){return this['channel'][_0x27e2('0xac')](_0x27e2('0xdf'));}var _0x15dc50=this[_0x27e2('0x12')][_0x27e2('0x70')](this,_0x36cdda[_0x27e2('0xde')]);if(!_0x15dc50){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x36cdda,_0x27e2('0xe0'));}var _0x19a773=this;_0x5d8dfe['forEach'](function(_0x3f4110,_0x5549af){Object['keys'](_0x3f4110)['forEach'](function(_0x2b7415){_0x19a773[_0x27e2('0xf')][_0x27e2('0xa0')](util['format'](_0x27e2('0xe1'),_0x15dc50,_0x5549af,_0x2b7415),_0x3f4110[_0x2b7415]);});});this['channel']['setVariable'](util[_0x27e2('0x2a')](_0x27e2('0xe2'),_0x15dc50),_0x5d8dfe[_0x27e2('0x9c')]);return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0xe3'),_0x15dc50));};AGIVertices[_0x27e2('0x11')][_0x27e2('0xe4')]=function(_0x468bb8){logger[_0x27e2('0xe5')](util[_0x27e2('0x2a')](_0x27e2('0xe6'),_0x468bb8['label']));if(!this[_0x27e2('0xa8')](_0x468bb8[_0x27e2('0xe7')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x468bb8,_0x27e2('0xe8'));}var _0x6643c5=this['getUser'][_0x27e2('0x70')](this,_0x468bb8[_0x27e2('0xe7')]);if(!_0x6643c5){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x468bb8,_0x27e2('0xe9'));}var _0x503fed=this[_0x27e2('0xf')][_0x27e2('0x59')](_0x27e2('0xea'),[util['format'](_0x27e2('0xeb'),_0x6643c5),_0x468bb8[_0x27e2('0x66')],_0x468bb8[_0x27e2('0xec')],_0x468bb8[_0x27e2('0x63')]]);if(_0x503fed[_0x27e2('0xa6')]===-0x1){return _0x503fed;}return this['channel']['noop'](util[_0x27e2('0x2a')]('Executed\x20command\x20%s',_0x27e2('0xea')));};AGIVertices['prototype'][_0x27e2('0xed')]=function(_0x318f65){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0xee'),_0x318f65[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x318f65['key'])){return this[_0x27e2('0xf')][_0x27e2('0xac')]('no\x20key\x20configured');}if(!this[_0x27e2('0xa8')](_0x318f65['text'])){return this['channel'][_0x27e2('0xac')](_0x27e2('0xad'));}this[_0x27e2('0xf')][_0x27e2('0xef')]=!![];this[_0x27e2('0x38')](_0x318f65);this[_0x27e2('0x45')](_0x318f65[_0x27e2('0x5c')],'in','','');this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xf0'),_0x318f65[_0x27e2('0x5c')]));var _0x1288b6=this[_0x27e2('0x7a')]['sync'](this,_0x318f65);if(_0x1288b6){for(var _0x451460 in _0x1288b6){if(_0x1288b6[_0x27e2('0x97')](_0x451460)){this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0xf1'),_0x451460[_0x27e2('0x6a')]()),_0x1288b6[_0x451460]);}}this['createSquareMessage'](_0x1288b6[_0x27e2('0xf2')],_0x27e2('0xf3'),'dialogflow','');return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xf4'),_0x1288b6['speech']));}return this['channel'][_0x27e2('0x2e')](_0x318f65,_0x27e2('0xf5'));};AGIVertices[_0x27e2('0x11')]['dialogflowV2']=function(_0x1359b6){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0xf6'),_0x1359b6[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x1359b6[_0x27e2('0x7d')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xf7'));}if(!this[_0x27e2('0xa8')](_0x1359b6[_0x27e2('0x7e')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xf8'));}if(!this[_0x27e2('0xa8')](_0x1359b6['private_key'])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xf9'));}if(!this[_0x27e2('0xa8')](_0x1359b6['dialogflowV2_language'])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xfa'));}if(!this[_0x27e2('0xa8')](_0x1359b6[_0x27e2('0x5c')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xad'));}this[_0x27e2('0xf')][_0x27e2('0xef')]=!![];this[_0x27e2('0x38')](_0x1359b6);this['createSquareMessage'](_0x1359b6[_0x27e2('0x5c')],'in','','');this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xfb'),_0x1359b6['text']));var _0x5e287f=this[_0x27e2('0x7c')][_0x27e2('0x70')](this,_0x1359b6);if(_0x5e287f){for(var _0x25aaef in _0x5e287f){if(_0x5e287f[_0x27e2('0x97')](_0x25aaef)){if(_0x25aaef!=='providerResponse'){this['channel'][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0xf1'),_0x25aaef[_0x27e2('0x6a')]()),_0x5e287f[_0x25aaef]);}}}this[_0x27e2('0x45')](_0x5e287f[_0x27e2('0xf2')],_0x27e2('0xf3'),_0x27e2('0xfc'),_0x5e287f[_0x27e2('0xfd')]);return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xfe'),_0x5e287f['speech']));}return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x1359b6,_0x27e2('0xff'));};AGIVertices['prototype'][_0x27e2('0x100')]=function(_0x43da59){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x101'),_0x43da59[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x43da59[_0x27e2('0x102')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0x103'));}if(!this[_0x27e2('0xa8')](_0x43da59[_0x27e2('0x104')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x105'));}if(!this['isConfigured'](_0x43da59['password'])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x106'));}if(!this[_0x27e2('0xa8')](_0x43da59[_0x27e2('0x107')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xad'));}this[_0x27e2('0xf')][_0x27e2('0xef')]=!![];this['createSquareDetailsReport'](_0x43da59);this[_0x27e2('0x45')](_0x43da59[_0x27e2('0x5c')],'in','','');this['channel'][_0x27e2('0xac')](util['format']('Trying\x20SestekNDA:\x20%s',_0x43da59[_0x27e2('0x5c')]));var _0x65eb0f=this[_0x27e2('0x81')][_0x27e2('0x70')](this,_0x43da59);if(_0x65eb0f){for(var _0x3f5140 in _0x65eb0f){if(_0x65eb0f[_0x27e2('0x97')](_0x3f5140)){this['channel'][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0x108'),_0x3f5140[_0x27e2('0x6a')]()),_0x65eb0f[_0x3f5140]);}}this[_0x27e2('0x45')](_0x65eb0f[_0x27e2('0xf2')],_0x27e2('0xf3'),'sesteknda','');if(_0x65eb0f[_0x27e2('0x109')]){this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x10a'),_0x65eb0f['audiofile']));var _0x3ee9b6=this[_0x27e2('0xf')][_0x27e2('0x10b')](_0x65eb0f[_0x27e2('0x109')]);try{fs[_0x27e2('0x10c')](_0x65eb0f['audiofile']+'.wav');}catch(_0x4d8f56){logger[_0x27e2('0x2e')](_0x4d8f56);}return _0x3ee9b6;}else{return this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x10d'),_0x65eb0f['speech']));}}return this['channel']['error'](_0x43da59,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x27e2('0x10e')]=function(_0x1da1a0){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x10f'),_0x1da1a0[_0x27e2('0x3a')]));return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x10e'));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x110')]=function(_0x31632b){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x111'),_0x31632b[_0x27e2('0x3a')]));var _0x1302f8='';if(_0x31632b[_0x27e2('0x112')]){if(!this[_0x27e2('0xa8')](_0x31632b[_0x27e2('0x112')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x31632b,'no\x20trunk\x20selected');}else{var _0x2fe9d3=parseInt(_0x31632b[_0x27e2('0x112')],0xa);if(isNaN(_0x2fe9d3)){_0x1302f8=_0x31632b['trunk_id'];}else{_0x1302f8=this['getTrunk']['sync'](this,_0x31632b[_0x27e2('0x112')]);if(!_0x1302f8){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x31632b,'no\x20trunk\x20found');}}}}else if(_0x31632b[_0x27e2('0x113')]){_0x1302f8=_0x31632b[_0x27e2('0x113')];}else{return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x31632b,_0x27e2('0x114'));}var _0x3e88ea=this[_0x27e2('0xf')][_0x27e2('0x59')](_0x27e2('0xea'),[util[_0x27e2('0x2a')](_0x27e2('0x115'),_0x1302f8,_0x31632b[_0x27e2('0xc5')]),_0x31632b[_0x27e2('0x66')],_0x31632b[_0x27e2('0xec')],_0x31632b[_0x27e2('0x63')]]);if(_0x3e88ea[_0x27e2('0xa6')]===-0x1){return _0x3e88ea;}return this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x116'),_0x27e2('0xea')));};AGIVertices['prototype']['finally']=function(_0x138a86){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x117'),_0x138a86[_0x27e2('0x3a')]));return this[_0x27e2('0xf')]['noop'](_0x27e2('0x118'));};AGIVertices['prototype'][_0x27e2('0xd')]=function(_0x340c30){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x119'),_0x340c30['label']));if(_0x340c30[_0x27e2('0xaa')]===0x0){return this[_0x27e2('0xa9')](_0x340c30);}_0x340c30[_0x27e2('0xaa')]-=0x1;if(!this[_0x27e2('0xa8')](_0x340c30[_0x27e2('0x11a')])){return this[_0x27e2('0xf')]['error'](_0x340c30,_0x27e2('0x11b'));}var _0x34dd1a=this['getSound'][_0x27e2('0x70')](this,_0x340c30[_0x27e2('0x11a')]);if(!_0x34dd1a){return this['channel'][_0x27e2('0x2e')](_0x340c30,_0x27e2('0x11c'));}if(!this[_0x27e2('0xa8')](_0x340c30[_0x27e2('0xde')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x27e2('0xdf'));}var _0x5bb434=this['channel'][_0x27e2('0x11d')](_0x34dd1a,_0x340c30[_0x27e2('0x11e')],_0x340c30[_0x27e2('0x11f')]);var _0x33ca5f=_0x5bb434[_0x27e2('0xa6')]?_0x5bb434[_0x27e2('0xa6')][_0x27e2('0x4e')]():'';logger[_0x27e2('0x30')]('test',JSON[_0x27e2('0x73')](_0x5bb434));if(_0x5bb434['result']===-0x1){this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x340c30,_0x33ca5f);return _0x5bb434;}else if(_0x5bb434[_0x27e2('0xa4')]==='timeout'){_0x5bb434['result']=_0x33ca5f[_0x27e2('0x9c')]>=parseInt(_0x340c30[_0x27e2('0x120')])?'x':'i';}else{_0x5bb434[_0x27e2('0xa6')]=_0x33ca5f['length']>=parseInt(_0x340c30['mindigit'])&&_0x33ca5f[_0x27e2('0x9c')]<=parseInt(_0x340c30['maxdigit'])?'x':'i';}var _0x1a7ca9=this['getVariable']['sync'](this,_0x340c30[_0x27e2('0xde')]);if(!_0x1a7ca9){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x340c30,_0x27e2('0xe0'));}this[_0x27e2('0xf')][_0x27e2('0xa0')](_0x1a7ca9,_0x33ca5f);if(this[_0x27e2('0xa8')](_0x340c30[_0x27e2('0x121')])){var _0x46aa4a=parseInt(_0x340c30[_0x27e2('0x121')],0xa);var _0xbb3dc1=rs[_0x27e2('0x122')]({'charset':'*','length':_0x46aa4a});var _0x22d11f=_0x33ca5f['length'];if(_0x22d11f>0x0){if(_0x22d11f>_0x46aa4a){this['createSquareDetailsReport']['sync'](this,_0x340c30,_0x340c30[_0x27e2('0x123')]===_0x27e2('0x124')?_0xbb3dc1+_0x33ca5f['substr'](_0x46aa4a):_0x33ca5f[_0x27e2('0x125')](0x0,_0x22d11f-_0x46aa4a)+_0xbb3dc1);}else{this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x340c30,rs[_0x27e2('0x122')]({'charset':'*','length':_0x22d11f}));}}else{this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x340c30,'');}}else{this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x340c30,_0x33ca5f);}return _0x5bb434;};AGIVertices[_0x27e2('0x11')][_0x27e2('0xe')]=function(_0x49ceda){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x126'),_0x49ceda[_0x27e2('0x3a')]));return this[_0x27e2('0xd')](_0x49ceda);};AGIVertices[_0x27e2('0x11')]['goal']=function(_0x32a13d){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x32a13d[_0x27e2('0x3a')]));this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x32a13d,_0x32a13d[_0x27e2('0x127')]);return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x128'),_0x32a13d['goalname']));};AGIVertices['prototype'][_0x27e2('0x129')]=function(_0x4f58ac){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4f58ac[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x4f58ac[_0x27e2('0x8a')])||!this[_0x27e2('0xa8')](_0x4f58ac[_0x27e2('0x8b')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x12a'));}if(!this[_0x27e2('0xa8')](_0x4f58ac[_0x27e2('0x5c')])){return this['channel'][_0x27e2('0xac')](_0x27e2('0xad'));}this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x12b'),_0x4f58ac[_0x27e2('0x5c')]));var _0x190b76=this[_0x27e2('0x89')][_0x27e2('0x70')](this,_0x4f58ac);if(_0x190b76){this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x12c'),_0x190b76));var _0x409220=this[_0x27e2('0xf')][_0x27e2('0x10b')](_0x190b76);try{fs[_0x27e2('0x10c')](_0x190b76+_0x27e2('0x12d'));}catch(_0x32c10d){logger[_0x27e2('0x2e')](_0x32c10d);}return _0x409220;}return this['channel']['error'](_0x4f58ac,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x27e2('0x12e')]=function(_0x2e0682){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x12f'),_0x2e0682[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x2e0682[_0x27e2('0x8a')])||!this['isConfigured'](_0x2e0682[_0x27e2('0x8b')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x12a'));}if(!this[_0x27e2('0xa8')](_0x2e0682[_0x27e2('0x92')])){return this[_0x27e2('0xf')][_0x27e2('0xac')]('no\x20bot\x20name\x20configured');}if(!this[_0x27e2('0xa8')](_0x2e0682['text'])){return this['channel'][_0x27e2('0xac')]('no\x20text\x20configured');}this[_0x27e2('0xf')][_0x27e2('0xef')]=!![];this[_0x27e2('0x38')](_0x2e0682);this[_0x27e2('0x45')](_0x2e0682[_0x27e2('0x5c')],'in','','');this['channel']['noop'](util[_0x27e2('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2e0682[_0x27e2('0x5c')]));var _0x30da1e=this[_0x27e2('0x90')][_0x27e2('0x70')](this,_0x2e0682);if(_0x30da1e){for(var _0x47a4f6 in _0x30da1e){if(_0x30da1e[_0x27e2('0x97')](_0x47a4f6)&&_[_0x27e2('0x9d')](_0x30da1e[_0x47a4f6])){this['channel']['setVariable'](util[_0x27e2('0x2a')](_0x27e2('0x130'),_0x47a4f6[_0x27e2('0x6a')]()),_0x30da1e[_0x47a4f6]);}}if(_[_0x27e2('0x48')](_0x30da1e[_0x27e2('0x77')])){return this['channel'][_0x27e2('0xac')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x27e2('0x45')](_0x30da1e['message'],_0x27e2('0xf3'),_0x27e2('0x131'),'');return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x132'),_0x30da1e[_0x27e2('0x77')]));}}return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x2e0682,_0x27e2('0x133'));};AGIVertices['prototype'][_0x27e2('0x134')]=function(_0x9741e8){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x135'),_0x9741e8[_0x27e2('0x3a')],_0x9741e8['timeout']));if(!this['isConfigured'](_0x9741e8[_0x27e2('0x83')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x136'));}var _0x124280=_0x27e2('0x137');var _0x4598b3=util[_0x27e2('0x2a')](_0x27e2('0x138'),FILES_PATH,rs[_0x27e2('0x122')](0x4));var _0x4d90d7=util[_0x27e2('0x2a')]('%s.%s',_0x4598b3,_0x124280);var _0x4abec8=!![];if(_0x9741e8[_0x27e2('0x139')]===_0x27e2('0x13a')){_0x4abec8=![];}var _0x456c7c=this['channel'][_0x27e2('0x13b')](_0x4598b3,_0x124280,_0x9741e8['intKey'],_0x9741e8['timeout'],undefined,_0x4abec8);if(_0x456c7c[_0x27e2('0xa6')]!==-0x1){this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0x13c'),_0x4d90d7));var _0x1c3307=this[_0x27e2('0x13d')][_0x27e2('0x70')](this,_0x9741e8,_0x4d90d7);if(_0x1c3307){for(var _0xb86ed1 in _0x1c3307){if(_0x1c3307[_0x27e2('0x97')](_0xb86ed1)){this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0x13e'),_0xb86ed1[_0x27e2('0x6a')]()),_0x1c3307[_0xb86ed1]);}}return this[_0x27e2('0xf')]['noop'](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x27e2('0x73')](_0x1c3307)));}}return _0x456c7c;};AGIVertices[_0x27e2('0x11')][_0x27e2('0x13f')]=function(_0x3533e5){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x140'),_0x3533e5['label']));if(!this[_0x27e2('0xa8')](_0x3533e5[_0x27e2('0x141')])){return this[_0x27e2('0xf')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x3533e5['appsecret'])){return this['channel'][_0x27e2('0xac')](_0x27e2('0x142'));}var _0x139023=_0x27e2('0x137');var _0x370e47=util[_0x27e2('0x2a')](_0x27e2('0x138'),FILES_PATH,rs[_0x27e2('0x122')](0x4));var _0x3589f4=util[_0x27e2('0x2a')]('%s.%s',_0x370e47,_0x139023);var _0x2b5356=!![];if(_0x3533e5[_0x27e2('0x139')]===_0x27e2('0x13a')){_0x2b5356=![];}var _0x2c8afd=this[_0x27e2('0xf')][_0x27e2('0x13b')](_0x370e47,_0x139023,_0x3533e5[_0x27e2('0x143')],_0x3533e5[_0x27e2('0x66')],undefined,_0x2b5356);if(_0x2c8afd[_0x27e2('0xa6')]!==-0x1){this[_0x27e2('0xf')]['noop'](util[_0x27e2('0x2a')](_0x27e2('0x144'),_0x3589f4));var _0x3b8da3=this['tildeASR'][_0x27e2('0x70')](this,_0x3533e5,_0x3589f4);if(_0x3b8da3){for(var _0x3ec91c in _0x3b8da3){if(_0x3b8da3[_0x27e2('0x97')](_0x3ec91c)){this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')]('TILDE_ASR_%s',_0x3ec91c[_0x27e2('0x6a')]()),_0x3b8da3[_0x3ec91c]);}}return this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x145'),JSON[_0x27e2('0x73')](_0x3b8da3)));}}return _0x2c8afd;};AGIVertices[_0x27e2('0x11')][_0x27e2('0x146')]=function(_0x135645){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x147'),_0x135645[_0x27e2('0x3a')]));return this['channel'][_0x27e2('0x148')](_0x135645[_0x27e2('0x40')],_0x135645[_0x27e2('0x149')],_0x135645[_0x27e2('0x41')]);};AGIVertices['prototype']['gotoif']=function(_0x1db5e4){logger['info'](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1db5e4[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x1db5e4['condition'])){return this['channel']['error'](_0x1db5e4,_0x27e2('0x14a'));}try{var _0x6d61fa=eval(_0x1db5e4[_0x27e2('0x14b')])?_0x27e2('0x14c'):'false';this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x14d'),_0x1db5e4['condition'],_0x6d61fa));return{'code':0xc8,'result':_0x6d61fa};}catch(_0x4703ff){return{'code':0xc8,'result':_0x27e2('0x14e')};}};AGIVertices[_0x27e2('0x11')]['gotoiftime']=function(_0x277412){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x14f'),_0x277412[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x277412[_0x27e2('0x150')])){return this['channel'][_0x27e2('0x2e')](_0x277412,_0x27e2('0x151'));}var _0x245aa1=this['getIntervals'][_0x27e2('0x70')](this,_0x277412['interval_id']);if(!_0x245aa1){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x277412,_0x27e2('0x152'));}for(var _0x44d49f=0x0;_0x44d49f<_0x245aa1[_0x27e2('0x9c')];_0x44d49f+=0x1){var _0x1dd7b5=this[_0x27e2('0xf')]['getVariable'](util[_0x27e2('0x2a')](_0x27e2('0x153'),_0x245aa1[_0x44d49f]));if(_0x1dd7b5['result']===-0x1){return _0x1dd7b5;}logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x154'),_0x245aa1[_0x44d49f],_0x1dd7b5[_0x27e2('0xa4')]));if(_0x1dd7b5[_0x27e2('0xa4')]===_0x27e2('0x14c')){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('IFTIME\x20%s\x20%s',_0x245aa1[_0x44d49f],'true'));this['channel']['noop'](util[_0x27e2('0x2a')]('IFTIME\x20%s\x20%s',_0x245aa1[_0x44d49f],_0x27e2('0x14c')));return{'code':0xc8,'result':_0x27e2('0x14c')};}else{logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('IFTIME\x20%s\x20%s',_0x245aa1[_0x44d49f],_0x27e2('0x14e')));this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x154'),_0x245aa1[_0x44d49f],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x27e2('0x155')]=function(_0x3ba1fd){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x156'),_0x3ba1fd['label']));return this['channel']['hangup']();};AGIVertices[_0x27e2('0x11')][_0x27e2('0x157')]=function(_0xa34dc9){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x158'),_0xa34dc9[_0x27e2('0x3a')]));if(!this['isConfigured'](_0xa34dc9['key'])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x136'));}var _0x40a1df=_0x27e2('0x137');var _0x54a794=util[_0x27e2('0x2a')](_0x27e2('0x138'),FILES_PATH,rs[_0x27e2('0x122')](0x4));var _0x11c39a=util['format'](_0x27e2('0x9f'),_0x54a794,_0x40a1df);var _0x3c8400=!![];if(_0xa34dc9['beep']==='NOBEEP'){_0x3c8400=![];}var _0x4f46ab=this[_0x27e2('0xf')]['recordFile'](_0x54a794,_0x40a1df,_0xa34dc9['intKey'],_0xa34dc9[_0x27e2('0x66')],undefined,_0x3c8400);if(_0x4f46ab[_0x27e2('0xa6')]!==-0x1){this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x159'),_0x11c39a));var _0x1eca72=this[_0x27e2('0x87')][_0x27e2('0x70')](this,_0xa34dc9,_0x11c39a);if(_0x1eca72){for(var _0x8026e1 in _0x1eca72){if(_0x1eca72[_0x27e2('0x97')](_0x8026e1)){this['channel']['setVariable'](util[_0x27e2('0x2a')](_0x27e2('0x15a'),_0x8026e1[_0x27e2('0x6a')]()),_0x1eca72[_0x8026e1]);}}return this['channel'][_0x27e2('0xac')](util['format'](_0x27e2('0x15b'),JSON[_0x27e2('0x73')](_0x1eca72)));}}return _0x4f46ab;};AGIVertices[_0x27e2('0x11')][_0x27e2('0x15c')]=function(_0x1560ce){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x15d'),_0x1560ce[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x1560ce[_0x27e2('0x83')])){return this['channel'][_0x27e2('0xac')](_0x27e2('0x136'));}if(!this[_0x27e2('0xa8')](_0x1560ce[_0x27e2('0x5c')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0xad'));}this[_0x27e2('0xf')]['noop'](util['format'](_0x27e2('0x15e'),_0x1560ce[_0x27e2('0x5c')]));var _0x5bbf48=this[_0x27e2('0x82')][_0x27e2('0x70')](this,_0x1560ce);if(_0x5bbf48){this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('ispeech\x20%s\x20file\x20created',_0x5bbf48));var _0x2f024b=this[_0x27e2('0xf')][_0x27e2('0x10b')](_0x5bbf48,_0x1560ce[_0x27e2('0x143')]);try{fs['unlink'](_0x5bbf48+_0x27e2('0x12d'));}catch(_0x5edf0d){logger[_0x27e2('0x2e')](_0x5edf0d);}return _0x2f024b;}return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x1560ce,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x27e2('0x11')][_0x27e2('0x15f')]=function(_0x1a844f){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x160'),_0x1a844f[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x1a844f[_0x27e2('0x161')])){return this['channel']['error'](_0x1a844f,'no\x20find\x20by\x20configured');}logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x162'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x1a844f[_0x27e2('0x161')]));var _0x5b9554=this[_0x27e2('0x57')][_0x27e2('0x70')](this,_0x1a844f[_0x27e2('0x161')]);if(_0x5b9554){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x1a844f[_0x27e2('0x161')]));this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x1a844f[_0x27e2('0x161')]));return{'code':0xc8,'result':_0x27e2('0x163')};}else{logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x164'),this['channel'][_0x27e2('0x3e')],_0x1a844f[_0x27e2('0x161')]));this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x27e2('0x3e')],_0x1a844f['findBy']));return{'code':0xc8,'result':_0x27e2('0x165')};}};AGIVertices[_0x27e2('0x11')]['logout']=function(_0x1d4b62){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x166'),_0x1d4b62[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x1d4b62[_0x27e2('0x161')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x1d4b62,'no\x20find\x20by\x20configured');}logger['info'](util[_0x27e2('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x1d4b62[_0x27e2('0x161')]));var _0x34c3bd=this[_0x27e2('0x53')][_0x27e2('0x70')](this,_0x1d4b62['findBy']);if(_0x34c3bd){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x167'),this['channel']['callerid'],_0x1d4b62[_0x27e2('0x161')]));this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0x167'),this[_0x27e2('0xf')]['callerid'],_0x1d4b62['findBy']));return{'code':0xc8,'result':_0x27e2('0x163')};}else{logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x164'),this['channel']['callerid'],_0x1d4b62[_0x27e2('0x161')]));this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x1d4b62['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x27e2('0x11')][_0x27e2('0x168')]=function(_0x235a5b){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x235a5b[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x235a5b[_0x27e2('0x169')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x235a5b,_0x27e2('0x16a'));}this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x16b'),_0x235a5b[_0x27e2('0x169')]));var _0x5f4d22=eval(_0x235a5b['operation']);if(!this[_0x27e2('0xa8')](_0x235a5b['variable_id'])){return this['channel'][_0x27e2('0xac')](_0x27e2('0xdf'));}var _0x186f1c=this[_0x27e2('0x12')]['sync'](this,_0x235a5b['variable_id']);if(!_0x186f1c){return this['channel'][_0x27e2('0x2e')](_0x235a5b,_0x27e2('0xe0'));}if(_[_0x27e2('0x9b')](_0x5f4d22)){var _0x486f48=this;_0x5f4d22[_0x27e2('0x16c')](function(_0x2bedbd,_0x20ca1b){_0x486f48['channel']['setVariable'](util[_0x27e2('0x2a')]('%s[%s]',_0x186f1c,_0x20ca1b),_0x2bedbd);});return this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x16d'),_0x186f1c));}else{return this[_0x27e2('0xf')][_0x27e2('0xa0')](_0x186f1c,_0x5f4d22);}};AGIVertices[_0x27e2('0x11')][_0x27e2('0xc')]=function(_0x57bd68){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x16e'),_0x57bd68[_0x27e2('0x3a')]));if(_0x57bd68[_0x27e2('0xaa')]===0x0){return this[_0x27e2('0xa9')](_0x57bd68);}_0x57bd68[_0x27e2('0xaa')]-=0x1;if(!this[_0x27e2('0xa8')](_0x57bd68[_0x27e2('0x11a')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x57bd68,'no\x20file\x20audio\x20selected');}var _0x4a471a=this[_0x27e2('0x16f')][_0x27e2('0x70')](this,_0x57bd68[_0x27e2('0x11a')]);if(!_0x4a471a){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x57bd68,_0x27e2('0x11c'));}var _0x43b470=this['channel'][_0x27e2('0x11d')](_0x4a471a,_0x57bd68['response'],_0x57bd68['digit']);var _0x890c9e=_0x43b470['result'];if(_0x43b470[_0x27e2('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x27e2('0x70')](this,_0x57bd68,'-1');return _0x43b470;}else if(_0x43b470[_0x27e2('0xa4')]==='timeout'){_0x43b470[_0x27e2('0xa6')]=_0x43b470[_0x27e2('0xa6')]['length']>0x0?_0x43b470[_0x27e2('0xa6')]:'t';}else if(_[_0x27e2('0x47')](_0x43b470[_0x27e2('0xa6')])){_0x43b470[_0x27e2('0xa6')]='#';_0x890c9e='#';}if(!this[_0x27e2('0xa8')](_0x57bd68['variable_id'])){this['channel']['noop'](_0x27e2('0xdf'));}else{var _0x4553a6=this[_0x27e2('0x12')][_0x27e2('0x70')](this,_0x57bd68[_0x27e2('0xde')]);if(!_0x4553a6){return this['channel']['error'](_0x57bd68,_0x27e2('0xe0'));}this[_0x27e2('0xf')]['setVariable'](_0x4553a6,_0x890c9e);}this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x57bd68,_0x890c9e);return _0x43b470;};AGIVertices['prototype'][_0x27e2('0xac')]=function(_0x2aaf31){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x170'),_0x2aaf31[_0x27e2('0x3a')]));return this['channel']['noop'](_0x2aaf31[_0x27e2('0x171')]||_0x2aaf31[_0x27e2('0x3a')]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0x172')]=function(_0x3275b8){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3275b8[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x3275b8[_0x27e2('0x161')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x3275b8,_0x27e2('0x173'));}logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x162'),this['channel']['callerid'],_0x3275b8[_0x27e2('0x161')]));var _0xdd553d=this[_0x27e2('0x4f')][_0x27e2('0x70')](this,_0x3275b8['pause_id']);var _0x1d8a24=this[_0x27e2('0x51')][_0x27e2('0x70')](this,_0x3275b8[_0x27e2('0x161')],_0xdd553d);if(_0x1d8a24){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x167'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x3275b8[_0x27e2('0x161')]));this['channel'][_0x27e2('0xac')](util['format'](_0x27e2('0x167'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x3275b8[_0x27e2('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x164'),this['channel'][_0x27e2('0x3e')],_0x3275b8['findBy']));this[_0x27e2('0xf')]['noop'](util['format'](_0x27e2('0x167'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x3275b8[_0x27e2('0x161')]));return{'code':0xc8,'result':_0x27e2('0x165')};}};AGIVertices[_0x27e2('0x11')]['playback']=function(_0x853368){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x174'),_0x853368[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x853368[_0x27e2('0x11a')])){return this['channel']['error'](_0x853368,_0x27e2('0x11b'));}var _0x365438=this[_0x27e2('0x16f')]['sync'](this,_0x853368[_0x27e2('0x11a')]);if(!_0x365438){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x853368,_0x27e2('0x11c'));}var _0x492262=this[_0x27e2('0xf')]['exec'](_0x27e2('0x175'),[_0x365438,_0x853368['opts']]);if(_0x492262['result']===-0x1){return _0x492262;}return this[_0x27e2('0xf')]['noop'](util[_0x27e2('0x2a')](_0x27e2('0xc9'),_0x27e2('0x175'),_0x365438));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x176')]=function(_0x4bbf56){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x177'),_0x4bbf56[_0x27e2('0x3a')]));if(!this['isConfigured'](_0x4bbf56[_0x27e2('0x178')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x4bbf56,'no\x20queue\x20selected');}var _0x1fce41='';var _0x40c763=parseInt(_0x4bbf56[_0x27e2('0x178')],0xa);if(isNaN(_0x40c763)){_0x1fce41=_0x4bbf56[_0x27e2('0x178')];}else{_0x1fce41=this[_0x27e2('0x16')][_0x27e2('0x70')](this,_0x4bbf56[_0x27e2('0x178')]);if(!_0x1fce41){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x4bbf56,_0x27e2('0x179'));}}var _0x23153b='';if(this[_0x27e2('0xa8')](_0x4bbf56[_0x27e2('0x11a')])){var _0x1bced0=this[_0x27e2('0x16f')][_0x27e2('0x70')](this,_0x4bbf56['file_id']);if(_0x1bced0){_0x23153b=_0x1bced0;}}this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x4bbf56,_0x1fce41);if(_0x4bbf56['opts'][_0x27e2('0x17a')]('x')<0x0){_0x4bbf56[_0x27e2('0xec')]+='x';}if(_0x4bbf56[_0x27e2('0xec')]['indexOf']('X')<0x0){_0x4bbf56[_0x27e2('0xec')]+='X';}this['channel'][_0x27e2('0xa0')]('XMCS-QUEUE',_0x1fce41?_0x1fce41['toLowerCase']():'');var _0x25981b=this['channel']['exec'](_0x27e2('0x17b'),[_0x1fce41,_0x4bbf56[_0x27e2('0xec')],_0x4bbf56[_0x27e2('0x63')],_0x23153b,_0x4bbf56[_0x27e2('0x66')],_0x4bbf56[_0x27e2('0x7')],_0x4bbf56[_0x27e2('0x17c')],_0x4bbf56[_0x27e2('0x17d')],'',_0x4bbf56[_0x27e2('0x17e')]]);if(_0x25981b[_0x27e2('0xa6')]===-0x1){return _0x25981b;}return this[_0x27e2('0xf')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x27e2('0x17b'),_0x1fce41));};AGIVertices['prototype']['record']=function(_0x281e15){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x17f'),_0x281e15['label']));var _0x36bd11=_0x281e15[_0x27e2('0x180')]||'wav';var _0x49c8b0=util[_0x27e2('0x2a')](_0x27e2('0x181'),this[_0x27e2('0xf')][_0x27e2('0x39')],rs[_0x27e2('0x122')](0x5));var _0x1c2e01=util[_0x27e2('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x49c8b0,_0x36bd11);var _0x244a7b=util[_0x27e2('0x2a')](_0x27e2('0x138'),FILES_PATH,_0x49c8b0);this['createSquareRecording']['sync'](this,_0x281e15,_0x49c8b0,_0x1c2e01);this[_0x27e2('0xf')]['setVariable']('RECORDING_SAVENAME',_0x49c8b0);logger[_0x27e2('0x30')](_0x27e2('0x182'),_0x244a7b,_0x36bd11,_0x281e15[_0x27e2('0x183')],_0x281e15[_0x27e2('0x66')]);return this['channel'][_0x27e2('0x13b')](_0x244a7b,_0x36bd11,_0x281e15[_0x27e2('0x183')],_0x281e15[_0x27e2('0x66')],undefined,!![]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0x184')]=function(_0x307cd3){logger['info'](util[_0x27e2('0x2a')](_0x27e2('0x185'),_0x307cd3[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x307cd3[_0x27e2('0x63')])){return this[_0x27e2('0xf')]['noop']('no\x20url\x20configured');}var _0x495410=this['restAPI'][_0x27e2('0x70')](this,_0x307cd3);logger[_0x27e2('0x30')](util['format'](_0x27e2('0x186'),util[_0x27e2('0x187')](_0x495410,{'showHidden':![],'depth':null})));if(!this[_0x27e2('0xa8')](_0x307cd3[_0x27e2('0xde')])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x188'));}var _0x1d44bc=this[_0x27e2('0x12')][_0x27e2('0x70')](this,_0x307cd3[_0x27e2('0xde')]);if(!_0x1d44bc){return this['channel'][_0x27e2('0x2e')](_0x307cd3,_0x27e2('0xe0'));}this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0x189'),_0x1d44bc),_0x495410[_0x27e2('0x76')]?_0x495410[_0x27e2('0x76')]:_0x27e2('0x18a'));this[_0x27e2('0xf')][_0x27e2('0xa0')](util[_0x27e2('0x2a')](_0x27e2('0x18b'),_0x1d44bc),_0x495410[_0x27e2('0x75')]?_0x495410['statusMessage']:'OK');if(_0x495410['body']){try{this[_0x27e2('0x9e')](_0x495410[_0x27e2('0x6b')],_0x1d44bc);}catch(_0x148022){logger[_0x27e2('0x2e')](util[_0x27e2('0x2a')](_0x27e2('0x18c'),_0x1d44bc));}}return this[_0x27e2('0xf')]['noop'](util[_0x27e2('0x2a')](_0x27e2('0xe3'),_0x1d44bc));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x18d')]=function(_0x18540e){logger['info'](util['format'](_0x27e2('0x18e'),_0x18540e['label']));return this['channel'][_0x27e2('0x18f')](_0x18540e[_0x27e2('0x190')]['replace'](/\s+/g,''),_0x18540e['escape_digits']);};AGIVertices['prototype'][_0x27e2('0x191')]=function(_0x11e9dc){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x192'),_0x11e9dc[_0x27e2('0x3a')]));return this['channel'][_0x27e2('0x193')](_0x11e9dc[_0x27e2('0x65')]['replace'](/\s+/g,''),_0x11e9dc[_0x27e2('0x183')]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0x194')]=function(_0x56c210){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x195'),_0x56c210[_0x27e2('0x3a')]));return this[_0x27e2('0xf')]['sayPhonetic'](_0x56c210[_0x27e2('0x5c')],_0x56c210[_0x27e2('0x183')]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0x196')]=function(_0x33ea5d){logger['info'](util['format'](_0x27e2('0x197'),_0x33ea5d[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x33ea5d[_0x27e2('0x198')])){return this[_0x27e2('0xf')]['noop']('no\x20mail\x20account\x20configured');}var _0x527f1c=this[_0x27e2('0x22')]['sync'](this,_0x33ea5d[_0x27e2('0x198')]);if(!_0x527f1c||!_0x527f1c['Smtp']){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x33ea5d,_0x27e2('0x199'));}var _0xafb48e={'from':util[_0x27e2('0x2a')](_0x27e2('0x19a'),_0x527f1c['name'],_0x527f1c[_0x27e2('0x19b')]||_0x527f1c[_0x27e2('0x19c')][_0x27e2('0x19d')]),'to':_0x33ea5d['to']||'','cc':_0x33ea5d['cc']||'','bcc':_0x33ea5d[_0x27e2('0x19e')]||'','subject':_0x33ea5d[_0x27e2('0x19f')],'html':_0x33ea5d['text'],'text':_0x33ea5d[_0x27e2('0x5c')]};if(this[_0x27e2('0xa8')](_0x33ea5d[_0x27e2('0x1a0')])){}logger[_0x27e2('0xe5')](_0x27e2('0x1a1'),JSON[_0x27e2('0x73')](_0xafb48e));this[_0x27e2('0x38')]['sync'](this,_0x33ea5d,_0x33ea5d[_0x27e2('0x198')]);this['channel']['noop'](util[_0x27e2('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x527f1c['name']));this[_0x27e2('0x25')][_0x27e2('0x70')](this,_0x527f1c['smtpOptions'],_0xafb48e);return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x1a2'));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1a3')]=function(_0x42661e){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x1a4'),_0x42661e['label']));return this[_0x27e2('0xf')]['noop'](_0x27e2('0x1a5'));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1a6')]=function(_0x3a6a78){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3a6a78[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x3a6a78['sms_account_id'])){return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x1a7'));}var _0x3d84d2=this['getSmsAccount'][_0x27e2('0x70')](this,_0x3a6a78[_0x27e2('0x1a8')]);if(!_0x3d84d2){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x3a6a78,_0x27e2('0x1a9'));}var _0x3c9515={'body':_0x3a6a78['sms_text'],'phone':_0x3a6a78['to']||'','SmsAccountId':_0x3d84d2['id']};logger[_0x27e2('0xe5')]('sendSMS\x20message',JSON[_0x27e2('0x73')](_0x3c9515));this['createSquareDetailsReport'][_0x27e2('0x70')](this,_0x3a6a78,_0x3a6a78[_0x27e2('0x1a8')]);this['channel'][_0x27e2('0xac')](util['format'](_0x27e2('0x1aa'),_0x3d84d2[_0x27e2('0x15')]));this['createSmsMessage']['sync'](this,_0x3c9515);return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x1ab'));};AGIVertices['prototype'][_0x27e2('0x1ac')]=function(_0x946cbf){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x1ad'),_0x946cbf[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x946cbf[_0x27e2('0xde')])){return this['channel'][_0x27e2('0x2e')](_0x946cbf,_0x27e2('0x1ae'));}var _0x3a88f3=this[_0x27e2('0x12')]['sync'](this,_0x946cbf['variable_id']);if(!_0x3a88f3){return this['channel'][_0x27e2('0x2e')](_0x946cbf,_0x27e2('0xe0'));}return this['channel'][_0x27e2('0xa0')](_0x3a88f3,_0x946cbf[_0x27e2('0x1af')]);};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1b0')]=function(_0x2021ba){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2021ba[_0x27e2('0x3a')]));this[_0x27e2('0xf')][_0x27e2('0xac')]('START\x20CALLY\x20SQUARE');if(_0x2021ba[_0x27e2('0xba')]===_0x27e2('0x1b1')){this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x1b2'));return this['channel'][_0x27e2('0xba')]();}return this[_0x27e2('0xf')][_0x27e2('0xac')](_0x27e2('0x1b3'));};AGIVertices[_0x27e2('0x11')]['subproject']=function(_0x5e395d){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x1b4'),_0x5e395d['label']));if(!this[_0x27e2('0xa8')](_0x5e395d[_0x27e2('0x1b5')])){return this['channel'][_0x27e2('0x2e')](_0x5e395d,'no\x20subproject\x20selected');}var _0x5f3b0a=this[_0x27e2('0x19')][_0x27e2('0x70')](this,_0x5e395d[_0x27e2('0x1b5')]);if(!this['isConfigured'](_0x5f3b0a)){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x5e395d,util[_0x27e2('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5e395d[_0x27e2('0x1b5')]));}if(_0x5f3b0a===this[_0x27e2('0xf')][_0x27e2('0x3c')]){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x5e395d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x5e395d,_0x5f3b0a);var _0x1add0a=this['channel']['exec'](_0x27e2('0x1b6'),util['format'](_0x27e2('0x1b7'),config['agi'][_0x27e2('0x1b8')]||_0x27e2('0x1b9'),_0x5f3b0a,this[_0x27e2('0xf')][_0x27e2('0x3c')]));if(_0x1add0a[_0x27e2('0xa6')]===-0x1){return _0x1add0a;}return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0xc9'),_0x27e2('0x1b6'),_0x5f3b0a));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1ba')]=function(_0x111600){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x1bb'),_0x111600['label']));var _0x563110=this['shellCommand']['sync'](this,_0x111600['command']);this[_0x27e2('0x38')][_0x27e2('0x70')](this,_0x111600,_0x111600['command']);if(this[_0x27e2('0xa8')](_0x111600[_0x27e2('0xde')])){var _0x4d3034=this[_0x27e2('0x12')][_0x27e2('0x70')](this,_0x111600[_0x27e2('0xde')]);if(_0x4d3034){this[_0x27e2('0xf')][_0x27e2('0xa0')](_0x4d3034,_0x563110);return this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0x1bc'),_0x111600[_0x27e2('0xb8')],_0x4d3034));}}return this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x111600['command']));};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1bd')]=function(_0x34143f){logger['info'](util['format'](_0x27e2('0x1be'),_0x34143f[_0x27e2('0x3a')]));_0x34143f[_0x27e2('0x5c')]=_0x34143f[_0x27e2('0x5c')][_0x27e2('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x34143f[_0x27e2('0x1bf')])){return this['channel'][_0x27e2('0xac')](_0x27e2('0x1c0'));}if(!this[_0x27e2('0xa8')](_0x34143f[_0x27e2('0x5c')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xad'));}this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x1c1'),_0x34143f[_0x27e2('0x5c')]));var _0x28438e=this[_0x27e2('0x5a')][_0x27e2('0x70')](this,_0x34143f);if(_0x28438e){this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x1c2'),_0x28438e));var _0x2f5423=this['channel'][_0x27e2('0x10b')](_0x28438e);try{fs[_0x27e2('0x10c')](_0x28438e+'.wav');}catch(_0x58ca76){logger[_0x27e2('0x2e')](_0x58ca76);}return _0x2f5423;}return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x34143f,_0x27e2('0x1c3'));};AGIVertices[_0x27e2('0x11')]['tts']=function(_0x269aa4){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')](_0x27e2('0x1c4'),_0x269aa4[_0x27e2('0x3a')]));_0x269aa4[_0x27e2('0x5c')]=_0x269aa4[_0x27e2('0x5c')][_0x27e2('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x27e2('0xa8')](_0x269aa4[_0x27e2('0x5c')])){return this[_0x27e2('0xf')]['noop'](_0x27e2('0xad'));}this[_0x27e2('0xf')][_0x27e2('0xac')](util['format'](_0x27e2('0x1c5'),_0x269aa4['text']));var _0x18decb=this[_0x27e2('0x1c6')][_0x27e2('0x70')](this,_0x269aa4);if(_0x18decb){this[_0x27e2('0xf')]['noop'](util['format'](_0x27e2('0x1c7'),_0x18decb));var _0x558099=this[_0x27e2('0xf')][_0x27e2('0x10b')](_0x18decb);try{fs['unlink'](_0x18decb+_0x27e2('0x12d'));}catch(_0xe6f10a){logger[_0x27e2('0x2e')](_0xe6f10a);}return _0x558099;}return this[_0x27e2('0xf')]['error'](_0x269aa4,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x27e2('0x11')][_0x27e2('0x1c8')]=function(_0x5265ff){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x1c9'),_0x5265ff[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x5265ff[_0x27e2('0x161')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x5265ff,_0x27e2('0x173'));}logger[_0x27e2('0x30')](util['format'](_0x27e2('0x162'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x5265ff['findBy']));var _0x3423ee=this[_0x27e2('0x52')][_0x27e2('0x70')](this,_0x5265ff[_0x27e2('0x161')]);if(_0x3423ee){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x5265ff[_0x27e2('0x161')]));this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x167'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x5265ff[_0x27e2('0x161')]));return{'code':0xc8,'result':_0x27e2('0x163')};}else{logger['info'](util['format'](_0x27e2('0x164'),this['channel']['callerid'],_0x5265ff[_0x27e2('0x161')]));this[_0x27e2('0xf')][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0x164'),this[_0x27e2('0xf')][_0x27e2('0x3e')],_0x5265ff['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x27e2('0x1ca')]=function(_0x3760a7){logger[_0x27e2('0x30')](util['format'](_0x27e2('0x1cb'),_0x3760a7[_0x27e2('0x3a')]));var _0xddcf0=this['channel'][_0x27e2('0x59')](_0x27e2('0x1cc'),[_0x3760a7[_0x27e2('0x1cd')],_0x3760a7['options']]);if(_0xddcf0[_0x27e2('0xa6')]===-0x1){return _0xddcf0;}return this['channel'][_0x27e2('0xac')](util[_0x27e2('0x2a')](_0x27e2('0xc9'),'VOICEMAIL',_0x3760a7[_0x27e2('0x1cd')]));};AGIVertices[_0x27e2('0x11')]['vswitch']=function(_0x1e55c9){logger[_0x27e2('0x30')](util[_0x27e2('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1e55c9[_0x27e2('0x3a')]));if(!this[_0x27e2('0xa8')](_0x1e55c9[_0x27e2('0xde')])){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x1e55c9,_0x27e2('0x1ae'));}var _0x3fc229=this['getVariable']['sync'](this,_0x1e55c9[_0x27e2('0xde')]);if(!_0x3fc229){return this[_0x27e2('0xf')][_0x27e2('0x2e')](_0x1e55c9,'no\x20variable\x20found');}var _0x25bbc1=this[_0x27e2('0xf')][_0x27e2('0x12')](_0x3fc229);return{'code':0xc8,'result':_0x25bbc1[_0x27e2('0xa4')]?_0x25bbc1[_0x27e2('0xa4')]:'-'};};String['prototype'][_0x27e2('0xa3')]=function(_0x6d6de8,_0x4d91ac){return this[_0x27e2('0xa2')](_0x6d6de8)['join'](_0x4d91ac);};module[_0x27e2('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d3a04d1..ed6969e 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 _0x5224=['saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','message','attended','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','updateAcw','update','error','catch','finally','[ACW][START]\x20%s','queue','[%s][TIMER][STOP][AGENT:%s]'];(function(_0x4e8abe,_0x247406){var _0x5d5978=function(_0x288118){while(--_0x288118){_0x4e8abe['push'](_0x4e8abe['shift']());}};_0x5d5978(++_0x247406);}(_0x5224,0x6a));var _0x4522=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x5224[_0x2f227c];return _0x5032bc;};'use strict';var util=require(_0x4522('0x0'));var _=require(_0x4522('0x1'));var moment=require('moment');var ami=require(_0x4522('0x2'));var logger=require(_0x4522('0x3'))(_0x4522('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x35ad18){this['voiceQueues']=_0x35ad18[_0x4522('0x5')];this[_0x4522('0x6')]=_0x35ad18[_0x4522('0x6')];this[_0x4522('0x7')]=_0x35ad18[_0x4522('0x7')];this[_0x4522('0x8')]={};ami['on']('agentconnect',this[_0x4522('0x9')][_0x4522('0xa')](this));ami['on'](_0x4522('0xb'),this[_0x4522('0xc')][_0x4522('0xa')](this));ami['on'](_0x4522('0xd'),this[_0x4522('0xe')]['bind'](this));ami['on'](_0x4522('0xf'),this[_0x4522('0x10')][_0x4522('0xa')](this));ami['on'](_0x4522('0x11'),this[_0x4522('0x12')][_0x4522('0xa')](this));ami['on'](_0x4522('0x13'),this[_0x4522('0x14')][_0x4522('0xa')](this));ami['on'](_0x4522('0x15'),this['syncAgentConnectPreview'][_0x4522('0xa')](this));}function getDiff(_0x2e10ea){var _0x132f61=moment()[_0x4522('0x16')](0x0);var _0x2a0529=moment(_0x2e10ea)['milliseconds'](0x0);return _0x132f61[_0x4522('0x17')](_0x2a0529,_0x4522('0x18'));}Acw[_0x4522('0x19')][_0x4522('0x1a')]=function(_0x487d23){try{var _0x4330a5=this;var _0x378ffe=this[_0x4522('0x8')][_0x487d23][_0x4522('0x1b')];var _0x3b40c1=this['channels'][_0x487d23]['queue'];var _0x1ad78a=this[_0x4522('0x5')][_0x3b40c1];var _0x53bb50=![];var _0x139318=_0x4522('0x1c');if(_0x1ad78a[_0x4522('0x1d')]){if(_0x1ad78a[_0x4522('0x1e')][_0x4522('0x1f')]){_0x53bb50=!![];_0x139318=_0x1ad78a[_0x4522('0x1e')][_0x4522('0x1f')];}}ami[_0x4522('0x20')]({'action':_0x4522('0x21'),'interface':_0x378ffe,'paused':!![],'reason':_0x139318})[_0x4522('0x22')](function(_0x1670d6){if(_0x4330a5[_0x4522('0x6')][_0x378ffe]){return RpcUser['getAgent'](_0x4330a5[_0x4522('0x6')][_0x378ffe]['id'])[_0x4522('0x22')](function(_0x56e4a8){if(_0x56e4a8&&!_0x56e4a8[_0x4522('0x23')]){logger[_0x4522('0x24')](_0x4522('0x25'),_0x487d23,_0x378ffe,_0x3b40c1);var _0x2e4e54=_0x4330a5['channels'][_0x487d23]['attended']&&_0x4330a5[_0x4522('0x8')][_0x487d23][_0x4522('0x26')]?_0x4330a5[_0x4522('0x8')][_0x487d23][_0x4522('0x26')]:_0x487d23;return RpcUser[_0x4522('0x27')](_0x4330a5[_0x4522('0x6')][_0x378ffe],_0x139318,_0x2e4e54)[_0x4522('0x22')](function(_0x4a2c57){if(!_0x53bb50){_0x4330a5[_0x4522('0x7')][_0x378ffe]={};logger[_0x4522('0x24')](_0x4522('0x28'),_0x487d23,_0x4330a5[_0x4522('0x5')][_0x3b40c1][_0x4522('0x29')],_0x378ffe,_0x3b40c1);_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2a')]=setTimeout(_0x4330a5[_0x4522('0x2b')][_0x4522('0xa')](_0x4330a5,_0x378ffe),_0x4330a5[_0x4522('0x5')][_0x3b40c1][_0x4522('0x29')]*0x3e8);_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2d')]=_0x487d23;_0x4330a5['timers'][_0x378ffe]['queue']=_0x3b40c1;_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2e')]=function(){var _0x249f0e=getDiff(_0x4330a5['timers'][_0x378ffe][_0x4522('0x2c')]);clearTimeout(_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2a')]);_0x4330a5[_0x4522('0x7')][_0x378ffe]['timer']=![];RpcVoiceAgentReport[_0x4522('0x2f')]({'acwtime':_0x249f0e},_0x4330a5[_0x4522('0x7')][_0x378ffe][_0x4522('0x2d')],_0x378ffe)[_0x4522('0x22')](function(_0x4f4372){logger[_0x4522('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x487d23,_0x249f0e,_0x4f4372);})['catch'](function(_0x5e28fa){logger[_0x4522('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x487d23,_0x5e28fa);});delete _0x4330a5[_0x4522('0x7')][_0x378ffe];};}});}else{logger[_0x4522('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x487d23,_0x378ffe,_0x3b40c1);}});}})[_0x4522('0x31')](function(_0x4ed24e){logger[_0x4522('0x30')](_0x4522('0x28'),_0x487d23,_0x4330a5[_0x4522('0x5')][_0x3b40c1][_0x4522('0x29')],_0x378ffe,_0x3b40c1);})[_0x4522('0x32')](function(){delete _0x4330a5['channels'][_0x487d23];});}catch(_0xe9c7cc){logger[_0x4522('0x30')](_0x4522('0x33'),_0xe9c7cc['message']);}};Acw[_0x4522('0x19')][_0x4522('0x2b')]=function(_0x57d402){try{var _0x54c181=this;if(_0x54c181[_0x4522('0x7')][_0x57d402]){_0x54c181[_0x4522('0x7')][_0x57d402]['timer']=![];var _0x211251=_0x54c181[_0x4522('0x7')][_0x57d402][_0x4522('0x2d')];var _0x2e2667=_0x54c181[_0x4522('0x7')][_0x57d402][_0x4522('0x34')];var _0x520148=_0x54c181[_0x4522('0x5')][_0x2e2667][_0x4522('0x29')];logger[_0x4522('0x24')](_0x4522('0x35'),_0x211251,_0x57d402);RpcUser[_0x4522('0x36')](this[_0x4522('0x6')][_0x57d402]);RpcVoiceAgentReport[_0x4522('0x2f')]({'acwtime':_0x520148,'agentacw':!![]},_0x211251,_0x57d402)[_0x4522('0x22')](function(_0x22ca30){logger[_0x4522('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x211251,_0x520148,_0x22ca30);})[_0x4522('0x31')](function(_0x41c4df){logger[_0x4522('0x30')](_0x4522('0x37'),_0x211251,_0x41c4df);});}else{logger[_0x4522('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x57d402);if(_0x54c181[_0x4522('0x7')]){logger['info'](_0x4522('0x38'),JSON['stringify'](_0x54c181[_0x4522('0x7')]));}}}catch(_0x66eda7){logger[_0x4522('0x30')]('[ACW][STOP]\x20%s',_0x66eda7['message']);}};Acw['prototype'][_0x4522('0x9')]=function(_0x5ab59a){try{if(this['voiceQueues'][_0x5ab59a[_0x4522('0x34')]]&&(this[_0x4522('0x5')][_0x5ab59a['queue']][_0x4522('0x4')]||this[_0x4522('0x5')][_0x5ab59a['queue']][_0x4522('0x1d')])){if(this[_0x4522('0x6')][_0x5ab59a['interface']]){this[_0x4522('0x8')][_0x5ab59a[_0x4522('0x2d')]]={'queue':_0x5ab59a[_0x4522('0x34')],'interface':_0x5ab59a[_0x4522('0x1b')],'destlinkedid':_0x5ab59a['destlinkedid']};}}}catch(_0x19d0ea){logger[_0x4522('0x30')](_0x4522('0x39'),_0x19d0ea['message']);}};Acw[_0x4522('0x19')][_0x4522('0x3a')]=function(_0x5448e9){try{if(this['voiceQueues'][_0x5448e9[_0x4522('0x34')]]&&(this[_0x4522('0x5')][_0x5448e9[_0x4522('0x34')]][_0x4522('0x4')]||this[_0x4522('0x5')][_0x5448e9[_0x4522('0x34')]]['mandatoryDisposition'])){if(this['agents'][_0x5448e9[_0x4522('0x1b')]]){this[_0x4522('0x8')][_0x5448e9['uniqueid']]={'queue':_0x5448e9[_0x4522('0x34')],'interface':_0x5448e9[_0x4522('0x1b')]};}}}catch(_0x4d63f1){logger[_0x4522('0x30')](_0x4522('0x3b'),_0x4d63f1['message']);}};Acw['prototype'][_0x4522('0xc')]=function(_0x1a281f){try{if(this['channels'][_0x1a281f[_0x4522('0x2d')]]&&_['isUndefined'](this['channels'][_0x1a281f['uniqueid']]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x1a281f[_0x4522('0x2d')]);this[_0x4522('0x1a')](_0x1a281f[_0x4522('0x2d')]);}else if(this[_0x4522('0x8')][_0x1a281f[_0x4522('0x3c')]]&&_[_0x4522('0x3d')](this['channels'][_0x1a281f[_0x4522('0x3c')]]['attended'])){logger[_0x4522('0x24')](_0x4522('0x3e'),_0x1a281f[_0x4522('0x3c')]);this[_0x4522('0x1a')](_0x1a281f[_0x4522('0x3c')]);}}catch(_0x266a75){logger[_0x4522('0x30')](_0x4522('0x3f'),_0x266a75[_0x4522('0x40')]);}};Acw[_0x4522('0x19')]['syncHangup']=function(_0x59b364){try{if(this['channels'][_0x59b364['uniqueid']]&&this[_0x4522('0x8')][_0x59b364[_0x4522('0x2d')]][_0x4522('0x41')]){logger[_0x4522('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x59b364['uniqueid']);this[_0x4522('0x1a')](_0x59b364[_0x4522('0x2d')]);}else if(this[_0x4522('0x8')][_0x59b364[_0x4522('0x3c')]]&&this[_0x4522('0x8')][_0x59b364[_0x4522('0x3c')]]['attended']){logger[_0x4522('0x24')](_0x4522('0x42'),_0x59b364[_0x4522('0x3c')]);this[_0x4522('0x1a')](_0x59b364[_0x4522('0x3c')]);}}catch(_0x3b7c3e){logger[_0x4522('0x30')]('[ACW][syncHangup]\x20%s',_0x3b7c3e[_0x4522('0x40')]);}};Acw[_0x4522('0x19')][_0x4522('0x12')]=function(_0x58bea8){try{if(!_[_0x4522('0x43')](this[_0x4522('0x8')][_0x58bea8[_0x4522('0x44')]])){this[_0x4522('0x1a')](_0x58bea8[_0x4522('0x44')]);if(this[_0x4522('0x8')][_0x58bea8['secondtransfereruniqueid']]){this[_0x4522('0x8')][_0x58bea8[_0x4522('0x45')]]['attended']=!![];this['channels'][_0x58bea8[_0x4522('0x46')]]=this[_0x4522('0x8')][_0x58bea8[_0x4522('0x45')]];delete this[_0x4522('0x8')][_0x58bea8[_0x4522('0x45')]];}}else if(!_[_0x4522('0x43')](this[_0x4522('0x8')][_0x58bea8[_0x4522('0x46')]])){this[_0x4522('0x1a')](_0x58bea8[_0x4522('0x46')]);if(this[_0x4522('0x8')][_0x58bea8[_0x4522('0x47')]]){this[_0x4522('0x8')][_0x58bea8[_0x4522('0x47')]][_0x4522('0x41')]=!![];this['channels'][_0x58bea8['transfereeuniqueid']]=this[_0x4522('0x8')][_0x58bea8[_0x4522('0x47')]];delete this[_0x4522('0x8')][_0x58bea8['origtransfereruniqueid']];}}}catch(_0x280c52){logger[_0x4522('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x280c52[_0x4522('0x40')]);}};Acw[_0x4522('0x19')][_0x4522('0x14')]=function(_0xf689ce){try{if(this[_0x4522('0x8')][_0xf689ce[_0x4522('0x48')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0xf689ce[_0x4522('0x48')]));this[_0x4522('0x1a')](_0xf689ce['transfereruniqueid']);}else if(this[_0x4522('0x8')][_0xf689ce[_0x4522('0x49')]]){logger[_0x4522('0x24')](_0x4522('0x4a'),JSON[_0x4522('0x4b')](_0xf689ce[_0x4522('0x49')]));this['startAcw'](_0xf689ce[_0x4522('0x49')]);}}catch(_0x3c1d2d){logger[_0x4522('0x30')](_0x4522('0x4c'),_0x3c1d2d[_0x4522('0x40')]);}};Acw[_0x4522('0x19')][_0x4522('0x10')]=function(_0x4400ee){try{if(this[_0x4522('0x5')][_0x4400ee['queue']]&&this[_0x4522('0x5')][_0x4400ee[_0x4522('0x34')]]['autopause']==='all'){if(this[_0x4522('0x6')][_0x4400ee['interface']]){logger['info'](_0x4522('0x4d'),_0x4400ee[_0x4522('0x2d')],_0x4400ee[_0x4522('0x1b')],_0x4400ee[_0x4522('0x34')]);return RpcUser['savePause'](this['agents'][_0x4400ee[_0x4522('0x1b')]],'Auto-Pause',_0x4400ee['uniqueid']);}}}catch(_0x4392a3){logger['error'](_0x4522('0x4e'),_0x4392a3[_0x4522('0x40')]);}};module[_0x4522('0x4f')]=Acw; \ No newline at end of file +var _0x6a0f=['stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','catch','error','finally','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','Auto-Pause','exports','lodash','moment','../../../config/logger','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer'];(function(_0x3ab88f,_0x32bf4f){var _0x508b78=function(_0x3fa72f){while(--_0x3fa72f){_0x3ab88f['push'](_0x3ab88f['shift']());}};_0x508b78(++_0x32bf4f);}(_0x6a0f,0x1b8));var _0xf6a0=function(_0x51888f,_0x26f3f1){_0x51888f=_0x51888f-0x0;var _0xf0ca71=_0x6a0f[_0x51888f];return _0xf0ca71;};'use strict';var util=require('util');var _=require(_0xf6a0('0x0'));var moment=require(_0xf6a0('0x1'));var ami=require('../ami');var logger=require(_0xf6a0('0x2'))(_0xf6a0('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x123031){this['voiceQueues']=_0x123031[_0xf6a0('0x4')];this[_0xf6a0('0x5')]=_0x123031['agents'];this['timers']=_0x123031[_0xf6a0('0x6')];this[_0xf6a0('0x7')]={};ami['on'](_0xf6a0('0x8'),this[_0xf6a0('0x9')][_0xf6a0('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xf6a0('0xa')](this));ami['on'](_0xf6a0('0xb'),this[_0xf6a0('0xc')][_0xf6a0('0xa')](this));ami['on'](_0xf6a0('0xd'),this['syncAgentRingNoAnswer'][_0xf6a0('0xa')](this));ami['on'](_0xf6a0('0xe'),this[_0xf6a0('0xf')]['bind'](this));ami['on'](_0xf6a0('0x10'),this[_0xf6a0('0x11')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xf6a0('0x12')][_0xf6a0('0xa')](this));}function getDiff(_0xf2bbf5){var _0x58cba3=moment()[_0xf6a0('0x13')](0x0);var _0x2f0206=moment(_0xf2bbf5)['milliseconds'](0x0);return _0x58cba3[_0xf6a0('0x14')](_0x2f0206,'seconds');}Acw[_0xf6a0('0x15')]['startAcw']=function(_0x49aa45){try{var _0x24018a=this;var _0x58c000=this['channels'][_0x49aa45][_0xf6a0('0x16')];var _0x198b1f=this[_0xf6a0('0x7')][_0x49aa45][_0xf6a0('0x17')];var _0x4c748a=this[_0xf6a0('0x4')][_0x198b1f];var _0x4ce284=![];var _0x2ded76=_0xf6a0('0x18');if(_0x4c748a[_0xf6a0('0x19')]){if(_0x4c748a[_0xf6a0('0x1a')][_0xf6a0('0x1b')]){_0x4ce284=!![];_0x2ded76=_0x4c748a[_0xf6a0('0x1a')][_0xf6a0('0x1b')];}}ami[_0xf6a0('0x1c')]({'action':_0xf6a0('0x1d'),'interface':_0x58c000,'paused':!![],'reason':_0x2ded76})['then'](function(_0x266d56){if(_0x24018a[_0xf6a0('0x5')][_0x58c000]){return RpcUser[_0xf6a0('0x1e')](_0x24018a[_0xf6a0('0x5')][_0x58c000]['id'])['then'](function(_0x5e507d){if(_0x5e507d&&!_0x5e507d[_0xf6a0('0x1f')]){logger[_0xf6a0('0x20')](_0xf6a0('0x21'),_0x49aa45,_0x58c000,_0x198b1f);var _0x672940=_0x24018a[_0xf6a0('0x7')][_0x49aa45][_0xf6a0('0x22')]&&_0x24018a[_0xf6a0('0x7')][_0x49aa45][_0xf6a0('0x23')]?_0x24018a[_0xf6a0('0x7')][_0x49aa45][_0xf6a0('0x23')]:_0x49aa45;return RpcUser[_0xf6a0('0x24')](_0x24018a[_0xf6a0('0x5')][_0x58c000],_0x2ded76,_0x672940)[_0xf6a0('0x25')](function(_0x31cab6){if(!_0x4ce284){_0x24018a[_0xf6a0('0x6')][_0x58c000]={};logger[_0xf6a0('0x20')](_0xf6a0('0x26'),_0x49aa45,_0x24018a[_0xf6a0('0x4')][_0x198b1f]['acwTimeout'],_0x58c000,_0x198b1f);_0x24018a['timers'][_0x58c000][_0xf6a0('0x27')]=setTimeout(_0x24018a[_0xf6a0('0x28')][_0xf6a0('0xa')](_0x24018a,_0x58c000),_0x24018a[_0xf6a0('0x4')][_0x198b1f][_0xf6a0('0x29')]*0x3e8);_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x2a')]=moment()[_0xf6a0('0x2b')](_0xf6a0('0x2c'));_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x2d')]=_0x49aa45;_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x17')]=_0x198b1f;_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x2e')]=function(){var _0x1edd77=getDiff(_0x24018a[_0xf6a0('0x6')][_0x58c000]['lastPauseAt']);clearTimeout(_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x27')]);_0x24018a[_0xf6a0('0x6')][_0x58c000]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x1edd77},_0x24018a[_0xf6a0('0x6')][_0x58c000][_0xf6a0('0x2d')],_0x58c000)[_0xf6a0('0x25')](function(_0x11a52b){logger[_0xf6a0('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x49aa45,_0x1edd77,_0x11a52b);})[_0xf6a0('0x2f')](function(_0x3e7e19){logger[_0xf6a0('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x49aa45,_0x3e7e19);});delete _0x24018a[_0xf6a0('0x6')][_0x58c000];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x49aa45,_0x58c000,_0x198b1f);}});}})[_0xf6a0('0x2f')](function(_0x52984a){logger[_0xf6a0('0x30')](_0xf6a0('0x26'),_0x49aa45,_0x24018a[_0xf6a0('0x4')][_0x198b1f][_0xf6a0('0x29')],_0x58c000,_0x198b1f);})[_0xf6a0('0x31')](function(){delete _0x24018a[_0xf6a0('0x7')][_0x49aa45];});}catch(_0xdb50ca){logger[_0xf6a0('0x30')]('[ACW][START]\x20%s',_0xdb50ca[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0x28')]=function(_0x5a53f0){try{var _0x43acb4=this;if(_0x43acb4[_0xf6a0('0x6')][_0x5a53f0]){_0x43acb4[_0xf6a0('0x6')][_0x5a53f0]['timer']=![];var _0xfbbe79=_0x43acb4['timers'][_0x5a53f0]['uniqueid'];var _0x3ea05c=_0x43acb4['timers'][_0x5a53f0][_0xf6a0('0x17')];var _0x31d59c=_0x43acb4[_0xf6a0('0x4')][_0x3ea05c][_0xf6a0('0x29')];logger[_0xf6a0('0x20')](_0xf6a0('0x33'),_0xfbbe79,_0x5a53f0);RpcUser['saveUnpause'](this['agents'][_0x5a53f0]);RpcVoiceAgentReport[_0xf6a0('0x34')]({'acwtime':_0x31d59c,'agentacw':!![]},_0xfbbe79,_0x5a53f0)[_0xf6a0('0x25')](function(_0x241867){logger[_0xf6a0('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xfbbe79,_0x31d59c,_0x241867);})[_0xf6a0('0x2f')](function(_0x25767c){logger[_0xf6a0('0x30')]('[%s][UPDATE][ERRORS:%s]',_0xfbbe79,_0x25767c);});}else{logger[_0xf6a0('0x30')](_0xf6a0('0x35'),_0x5a53f0);if(_0x43acb4['timers']){logger[_0xf6a0('0x20')](_0xf6a0('0x36'),JSON['stringify'](_0x43acb4[_0xf6a0('0x6')]));}}}catch(_0x9333f8){logger[_0xf6a0('0x30')]('[ACW][STOP]\x20%s',_0x9333f8[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')]['syncAgentConnect']=function(_0x52288b){try{if(this[_0xf6a0('0x4')][_0x52288b[_0xf6a0('0x17')]]&&(this['voiceQueues'][_0x52288b['queue']][_0xf6a0('0x3')]||this[_0xf6a0('0x4')][_0x52288b[_0xf6a0('0x17')]][_0xf6a0('0x19')])){if(this[_0xf6a0('0x5')][_0x52288b[_0xf6a0('0x16')]]){this[_0xf6a0('0x7')][_0x52288b['uniqueid']]={'queue':_0x52288b['queue'],'interface':_0x52288b[_0xf6a0('0x16')],'destlinkedid':_0x52288b[_0xf6a0('0x23')]};}}}catch(_0x2579f3){logger['error'](_0xf6a0('0x37'),_0x2579f3[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0x12')]=function(_0x2c1780){try{if(this[_0xf6a0('0x4')][_0x2c1780[_0xf6a0('0x17')]]&&(this['voiceQueues'][_0x2c1780['queue']][_0xf6a0('0x3')]||this[_0xf6a0('0x4')][_0x2c1780['queue']][_0xf6a0('0x19')])){if(this[_0xf6a0('0x5')][_0x2c1780[_0xf6a0('0x16')]]){this[_0xf6a0('0x7')][_0x2c1780[_0xf6a0('0x2d')]]={'queue':_0x2c1780[_0xf6a0('0x17')],'interface':_0x2c1780['interface']};}}}catch(_0x3b47b6){logger[_0xf6a0('0x30')](_0xf6a0('0x38'),_0x3b47b6[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0x39')]=function(_0x1cb6f8){try{if(this[_0xf6a0('0x7')][_0x1cb6f8[_0xf6a0('0x2d')]]&&_['isUndefined'](this[_0xf6a0('0x7')][_0x1cb6f8[_0xf6a0('0x2d')]][_0xf6a0('0x22')])){logger[_0xf6a0('0x20')](_0xf6a0('0x3a'),_0x1cb6f8[_0xf6a0('0x2d')]);this[_0xf6a0('0x3b')](_0x1cb6f8[_0xf6a0('0x2d')]);}else if(this['channels'][_0x1cb6f8['linkedid']]&&_['isUndefined'](this[_0xf6a0('0x7')][_0x1cb6f8['linkedid']]['attended'])){logger[_0xf6a0('0x20')]('[%s][HANGUP:LINKEDID]',_0x1cb6f8[_0xf6a0('0x3c')]);this[_0xf6a0('0x3b')](_0x1cb6f8[_0xf6a0('0x3c')]);}}catch(_0x5402b5){logger['error'](_0xf6a0('0x3d'),_0x5402b5[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0xc')]=function(_0x1a76ad){try{if(this[_0xf6a0('0x7')][_0x1a76ad[_0xf6a0('0x2d')]]&&this[_0xf6a0('0x7')][_0x1a76ad[_0xf6a0('0x2d')]][_0xf6a0('0x22')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1a76ad[_0xf6a0('0x2d')]);this['startAcw'](_0x1a76ad['uniqueid']);}else if(this['channels'][_0x1a76ad[_0xf6a0('0x3c')]]&&this['channels'][_0x1a76ad['linkedid']]['attended']){logger[_0xf6a0('0x20')](_0xf6a0('0x3e'),_0x1a76ad[_0xf6a0('0x3c')]);this['startAcw'](_0x1a76ad[_0xf6a0('0x3c')]);}}catch(_0x594ff0){logger[_0xf6a0('0x30')]('[ACW][syncHangup]\x20%s',_0x594ff0[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0xf')]=function(_0x337403){try{if(!_[_0xf6a0('0x3f')](this[_0xf6a0('0x7')][_0x337403['transfereeuniqueid']])){this[_0xf6a0('0x3b')](_0x337403[_0xf6a0('0x40')]);if(this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x41')]]){this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x41')]][_0xf6a0('0x22')]=!![];this[_0xf6a0('0x7')][_0x337403['transfertargetuniqueid']]=this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x41')]];delete this[_0xf6a0('0x7')][_0x337403['secondtransfereruniqueid']];}}else if(!_[_0xf6a0('0x3f')](this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x42')]])){this[_0xf6a0('0x3b')](_0x337403['transfertargetuniqueid']);if(this['channels'][_0x337403['origtransfereruniqueid']]){this['channels'][_0x337403[_0xf6a0('0x43')]][_0xf6a0('0x22')]=!![];this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x40')]]=this[_0xf6a0('0x7')][_0x337403[_0xf6a0('0x43')]];delete this['channels'][_0x337403[_0xf6a0('0x43')]];}}}catch(_0x1c0a29){logger[_0xf6a0('0x30')](_0xf6a0('0x44'),_0x1c0a29[_0xf6a0('0x32')]);}};Acw['prototype'][_0xf6a0('0x11')]=function(_0x54fcb2){try{if(this[_0xf6a0('0x7')][_0x54fcb2['transfereruniqueid']]){logger[_0xf6a0('0x20')](_0xf6a0('0x45'),JSON[_0xf6a0('0x46')](_0x54fcb2[_0xf6a0('0x47')]));this[_0xf6a0('0x3b')](_0x54fcb2[_0xf6a0('0x47')]);}else if(this['channels'][_0x54fcb2[_0xf6a0('0x48')]]){logger[_0xf6a0('0x20')](_0xf6a0('0x49'),JSON['stringify'](_0x54fcb2['transfererlinkedid']));this[_0xf6a0('0x3b')](_0x54fcb2[_0xf6a0('0x48')]);}}catch(_0x1e4740){logger[_0xf6a0('0x30')](_0xf6a0('0x4a'),_0x1e4740[_0xf6a0('0x32')]);}};Acw[_0xf6a0('0x15')][_0xf6a0('0x4b')]=function(_0x533a96){try{if(this['voiceQueues'][_0x533a96['queue']]&&this[_0xf6a0('0x4')][_0x533a96[_0xf6a0('0x17')]][_0xf6a0('0x4c')]===_0xf6a0('0x4d')){if(this['agents'][_0x533a96['interface']]){logger[_0xf6a0('0x20')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x533a96[_0xf6a0('0x2d')],_0x533a96['interface'],_0x533a96[_0xf6a0('0x17')]);return RpcUser[_0xf6a0('0x24')](this['agents'][_0x533a96[_0xf6a0('0x16')]],_0xf6a0('0x4e'),_0x533a96['uniqueid']);}}}catch(_0x1a06e8){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1a06e8[_0xf6a0('0x32')]);}};module[_0xf6a0('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 710ee39..7f20e7d 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x4423fd,_0x20d528){_0x4423fd=_0x4423fd-0x0;var _0x5c19f5=_0x2032[_0x4423fd];return _0x5c19f5;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','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','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','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'];(function(_0x1b8804,_0x162395){var _0x21df8d=function(_0xd1f98){while(--_0xd1f98){_0x1b8804['push'](_0x1b8804['shift']());}};_0x21df8d(++_0x162395);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1e2df7d..ac4c48c 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x52a3b1,_0x4608d5){var _0x17601b=function(_0x2c27f0){while(--_0x2c27f0){_0x52a3b1['push'](_0x52a3b1['shift']());}};_0x17601b(++_0x4608d5);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x128a79,_0x19f331){_0x128a79=_0x128a79-0x0;var _0x2ff426=_0xbdb7[_0x128a79];return _0x2ff426;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x170cbb,_0x9093e){var _0x39fae4=function(_0x120b6b){while(--_0x120b6b){_0x170cbb['push'](_0x170cbb['shift']());}};_0x39fae4(++_0x9093e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d879d,_0x4f9bb0){_0x4d879d=_0x4d879d-0x0;var _0x167091=_0x9bde[_0x4d879d];return _0x167091;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a373c30..5a2b870 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9830=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','phone','firstName','Contact','number'];(function(_0x141e1c,_0x186b5d){var _0x3abc59=function(_0x4b9a93){while(--_0x4b9a93){_0x141e1c['push'](_0x141e1c['shift']());}};_0x3abc59(++_0x186b5d);}(_0x9830,0x199));var _0x0983=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0x9830[_0x7fd9e9];return _0x285d92;};'use strict';var util=require(_0x0983('0x0'));var _=require('lodash');var moment=require(_0x0983('0x1'));function checkNameSurname(_0x3d9eeb,_0x528570,_0x448051){var _0x4b8b4f='';if(!_[_0x0983('0x2')](_0x528570)&&_0x0983('0x3')===typeof _0x528570){_0x4b8b4f+=_0x528570;}if(!_['isNil'](_0x448051)&&_0x0983('0x3')===typeof _0x448051){_0x4b8b4f+='\x20'+_0x448051;}if(_0x4b8b4f!==''){return _0x4b8b4f;}return _0x3d9eeb;}function Action(_0x1a737f,_0x2dcb47,_0x390e52){this[_0x0983('0x4')]=_0x1a737f;this[_0x0983('0x5')]=_0x390e52||undefined;this[_0x0983('0x6')]=checkNameSurname(_0x2dcb47['Contact'][_0x0983('0x7')],_0x2dcb47['Contact'][_0x0983('0x8')],_0x2dcb47[_0x0983('0x9')]['lastName']);this[_0x0983('0xa')]=_0x2dcb47[_0x0983('0x9')][_0x0983('0x7')];this['queue']=_0x1a737f[_0x0983('0x6')];this['active']=_0x2dcb47[_0x0983('0xb')]||![];this[_0x0983('0xc')]=_0x1a737f['type'];this['dialQueueTimeout']=_0x1a737f[_0x0983('0xd')]||0x3;this[_0x0983('0xe')]=_0x2dcb47[_0x0983('0xe')];this[_0x0983('0xf')]=_0x2dcb47[_0x0983('0xf')];this['countcongestionretry']=_0x2dcb47['countcongestionretry'];this['countnoanswerretry']=_0x2dcb47[_0x0983('0x10')];this[_0x0983('0x11')]=_0x2dcb47[_0x0983('0x11')];this[_0x0983('0x12')]=_0x2dcb47[_0x0983('0x12')];this[_0x0983('0x13')]=_0x2dcb47['countabandonedretry'];this['countmachineretry']=_0x2dcb47[_0x0983('0x14')];this[_0x0983('0x15')]=_0x2dcb47['countagentrejectretry'];this['ContactId']=_0x2dcb47[_0x0983('0x16')];this[_0x0983('0x17')]=_0x2dcb47[_0x0983('0x17')];this[_0x0983('0x18')]=_0x2dcb47[_0x0983('0x18')];this[_0x0983('0x19')]=_0x2dcb47[_0x0983('0x19')];this[_0x0983('0x1a')]=_0x2dcb47[_0x0983('0x1a')];this['idHopper']=_0x2dcb47['id'];this['ContactFirstName']=_0x2dcb47[_0x0983('0x9')][_0x0983('0x8')]||'';this['starttime']=moment()['format'](_0x0983('0x1b'));this[_0x0983('0x1c')]=_0x2dcb47[_0x0983('0x1c')];this[_0x0983('0x1d')]=_0x2dcb47[_0x0983('0x1d')];this[_0x0983('0x1e')]=_0x2dcb47[_0x0983('0x1e')];this[_0x0983('0x1f')]=_0x2dcb47[_0x0983('0x1f')];this[_0x0983('0x20')]='';this[_0x0983('0x21')]='';}Action['prototype'][_0x0983('0x22')]=function(){return util[_0x0983('0x23')](_0x0983('0x24'),this[_0x0983('0x6')],this['voiceQueue'][_0x0983('0x25')]>0x0?this[_0x0983('0xa')]['substring'](this['voiceQueue'][_0x0983('0x25')]):this[_0x0983('0xa')]);};Action[_0x0983('0x26')][_0x0983('0x27')]=function(){return this[_0x0983('0x28')];};module[_0x0983('0x29')]=Action; \ No newline at end of file +var _0x0f58=['moment','isNil','string','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','voiceQueue','dialCutDigit','exports','util','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0f58,0x7c));var _0x80f5=function(_0x1c9c75,_0x5574f3){_0x1c9c75=_0x1c9c75-0x0;var _0x1f167b=_0x0f58[_0x1c9c75];return _0x1f167b;};'use strict';var util=require(_0x80f5('0x0'));var _=require(_0x80f5('0x1'));var moment=require(_0x80f5('0x2'));function checkNameSurname(_0x37987e,_0x1df9d2,_0x4a2b38){var _0x2e2a20='';if(!_[_0x80f5('0x3')](_0x1df9d2)&&_0x80f5('0x4')===typeof _0x1df9d2){_0x2e2a20+=_0x1df9d2;}if(!_[_0x80f5('0x3')](_0x4a2b38)&&_0x80f5('0x4')===typeof _0x4a2b38){_0x2e2a20+='\x20'+_0x4a2b38;}if(_0x2e2a20!==''){return _0x2e2a20;}return _0x37987e;}function Action(_0x18e681,_0x160519,_0x522744){this['voiceQueue']=_0x18e681;this[_0x80f5('0x5')]=_0x522744||undefined;this[_0x80f5('0x6')]=checkNameSurname(_0x160519[_0x80f5('0x7')][_0x80f5('0x8')],_0x160519[_0x80f5('0x7')][_0x80f5('0x9')],_0x160519[_0x80f5('0x7')]['lastName']);this[_0x80f5('0xa')]=_0x160519[_0x80f5('0x7')][_0x80f5('0x8')];this[_0x80f5('0xb')]=_0x18e681['name'];this['active']=_0x160519[_0x80f5('0xc')]||![];this[_0x80f5('0xd')]=_0x18e681[_0x80f5('0xd')];this[_0x80f5('0xe')]=_0x18e681[_0x80f5('0xe')]||0x3;this[_0x80f5('0xf')]=_0x160519['scheduledat'];this[_0x80f5('0x10')]=_0x160519['countbusyretry'];this[_0x80f5('0x11')]=_0x160519[_0x80f5('0x11')];this[_0x80f5('0x12')]=_0x160519['countnoanswerretry'];this[_0x80f5('0x13')]=_0x160519[_0x80f5('0x13')];this[_0x80f5('0x14')]=_0x160519[_0x80f5('0x14')];this[_0x80f5('0x15')]=_0x160519[_0x80f5('0x15')];this[_0x80f5('0x16')]=_0x160519[_0x80f5('0x16')];this[_0x80f5('0x17')]=_0x160519[_0x80f5('0x17')];this[_0x80f5('0x18')]=_0x160519[_0x80f5('0x18')];this[_0x80f5('0x19')]=_0x160519[_0x80f5('0x19')];this['UserId']=_0x160519[_0x80f5('0x1a')];this[_0x80f5('0x1b')]=_0x160519[_0x80f5('0x1b')];this[_0x80f5('0x1c')]=_0x160519[_0x80f5('0x1c')];this[_0x80f5('0x1d')]=_0x160519['id'];this[_0x80f5('0x1e')]=_0x160519[_0x80f5('0x7')][_0x80f5('0x9')]||'';this['starttime']=moment()[_0x80f5('0x1f')](_0x80f5('0x20'));this[_0x80f5('0x21')]=_0x160519[_0x80f5('0x21')];this[_0x80f5('0x22')]=_0x160519[_0x80f5('0x22')];this[_0x80f5('0x23')]=_0x160519['callbackat'];this['recallme']=_0x160519[_0x80f5('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x80f5('0x25')][_0x80f5('0x26')]=function(){return util[_0x80f5('0x1f')]('\x22%s\x22\x20<%s>',this[_0x80f5('0x6')],this[_0x80f5('0x27')][_0x80f5('0x28')]>0x0?this[_0x80f5('0xa')]['substring'](this[_0x80f5('0x27')][_0x80f5('0x28')]):this[_0x80f5('0xa')]);};Action[_0x80f5('0x25')]['getQueue']=function(){return this[_0x80f5('0xb')];};module[_0x80f5('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 56beaee..20955ee 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d43=['membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x1d43,0x187));var _0x31d4=function(_0x243d9f,_0x26611a){_0x243d9f=_0x243d9f-0x0;var _0x2bb206=_0x1d43[_0x243d9f];return _0x2bb206;};'use strict';var util=require(_0x31d4('0x0'));var _=require(_0x31d4('0x1'));var moment=require(_0x31d4('0x2'));function getSeconds(_0x4d9b8b,_0x4a1ba3){var _0xfdcd56=moment(_0x4d9b8b)[_0x31d4('0x3')](0x0);var _0x389da5=moment(_0x4a1ba3)['milliseconds'](0x0);return _0xfdcd56[_0x31d4('0x4')](_0x389da5,'seconds');}function AgentComplete(_0x13304f,_0x10731f){this['state']=0x4;this['statedesc']='Answer';this[_0x31d4('0x5')]=_0x13304f[_0x31d4('0x5')];this['type']=_0x13304f[_0x31d4('0x6')];this[_0x31d4('0x7')]=_0x13304f[_0x31d4('0x6')]===_0x31d4('0x8')?_0x31d4('0x9'):_0x13304f[_0x31d4('0x6')];this[_0x31d4('0xa')]=_0x13304f[_0x31d4('0xa')];this[_0x31d4('0xb')]=_0x13304f['countcongestionretry'];this[_0x31d4('0xc')]=_0x13304f[_0x31d4('0xc')];this['countglobal']=_0x13304f[_0x31d4('0xa')]+_0x13304f[_0x31d4('0xb')]+_0x13304f[_0x31d4('0xc')]+_0x13304f[_0x31d4('0xd')]+_0x13304f[_0x31d4('0xe')]+_0x13304f[_0x31d4('0xf')]+_0x13304f[_0x31d4('0x10')]+_0x13304f[_0x31d4('0x11')];this['countnosuchnumberretry']=_0x13304f[_0x31d4('0xd')];this[_0x31d4('0xe')]=_0x13304f[_0x31d4('0xe')];this[_0x31d4('0xf')]=_0x13304f[_0x31d4('0xf')];this[_0x31d4('0x10')]=_0x13304f['countmachineretry'];this[_0x31d4('0x11')]=_0x13304f[_0x31d4('0x11')];this[_0x31d4('0x12')]=_0x10731f[_0x31d4('0x12')];this[_0x31d4('0x13')]=_0x13304f[_0x31d4('0x14')];this['calleridnum']=_0x13304f[_0x31d4('0x15')];this[_0x31d4('0x16')]=_0x13304f[_0x31d4('0x16')];this[_0x31d4('0x17')]=_0x13304f[_0x31d4('0x17')];this[_0x31d4('0x18')]=_0x13304f[_0x31d4('0x18')];this[_0x31d4('0x19')]=moment()[_0x31d4('0x1a')](_0x31d4('0x1b'));this[_0x31d4('0x1c')]=getSeconds(_0x13304f[_0x31d4('0x17')],_0x13304f[_0x31d4('0x16')]);this['holdtime']=getSeconds(_0x13304f[_0x31d4('0x18')],_0x13304f[_0x31d4('0x17')]);this['talktime']=getSeconds(this[_0x31d4('0x19')],_0x13304f[_0x31d4('0x18')]);this[_0x31d4('0x9')]=_0x10731f[_0x31d4('0x9')];this[_0x31d4('0x1d')]=_0x10731f[_0x31d4('0x1d')];this[_0x31d4('0x1e')]=_0x10731f[_0x31d4('0x1e')];this['callback']=_0x13304f['callback'];this[_0x31d4('0x1f')]=_0x13304f[_0x31d4('0x1f')];this[_0x31d4('0x20')]=_0x13304f[_0x31d4('0x20')];this[_0x31d4('0x21')]=_0x13304f[_0x31d4('0x21')];this[_0x31d4('0x22')]=_0x13304f['ContactId'];this[_0x31d4('0x23')]=_0x13304f['ListId'];this[_0x31d4('0x24')]=_0x13304f[_0x31d4('0x24')];this[_0x31d4('0x25')]=_0x13304f[_0x31d4('0x25')];this[_0x31d4('0x26')]=_0x13304f[_0x31d4('0x26')];this[_0x31d4('0x27')]=_0x13304f[_0x31d4('0x27')]||'';this[_0x31d4('0x28')]=_0x13304f[_0x31d4('0x28')]||'';}module[_0x31d4('0x29')]=AgentComplete; \ No newline at end of file +var _0x4d1f=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','reason','callbackuniqueid','callbackat','recallme'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0x4d1f,0x64));var _0xf4d1=function(_0x313dab,_0x53179c){_0x313dab=_0x313dab-0x0;var _0x18ee37=_0x4d1f[_0x313dab];return _0x18ee37;};'use strict';var util=require(_0xf4d1('0x0'));var _=require(_0xf4d1('0x1'));var moment=require(_0xf4d1('0x2'));function getSeconds(_0x59a5ae,_0x35961b){var _0x3200d2=moment(_0x59a5ae)[_0xf4d1('0x3')](0x0);var _0x2b5c66=moment(_0x35961b)[_0xf4d1('0x3')](0x0);return _0x3200d2[_0xf4d1('0x4')](_0x2b5c66,'seconds');}function AgentComplete(_0x29d40d,_0x5e9f37){this['state']=0x4;this[_0xf4d1('0x5')]=_0xf4d1('0x6');this['scheduledat']=_0x29d40d[_0xf4d1('0x7')];this[_0xf4d1('0x8')]=_0x29d40d['type'];this[_0xf4d1('0x9')]=_0x29d40d['type']===_0xf4d1('0xa')?'queue':_0x29d40d[_0xf4d1('0x8')];this[_0xf4d1('0xb')]=_0x29d40d[_0xf4d1('0xb')];this[_0xf4d1('0xc')]=_0x29d40d['countcongestionretry'];this['countnoanswerretry']=_0x29d40d['countnoanswerretry'];this[_0xf4d1('0xd')]=_0x29d40d[_0xf4d1('0xb')]+_0x29d40d[_0xf4d1('0xc')]+_0x29d40d[_0xf4d1('0xe')]+_0x29d40d[_0xf4d1('0xf')]+_0x29d40d[_0xf4d1('0x10')]+_0x29d40d[_0xf4d1('0x11')]+_0x29d40d[_0xf4d1('0x12')]+_0x29d40d[_0xf4d1('0x13')];this[_0xf4d1('0xf')]=_0x29d40d[_0xf4d1('0xf')];this['countdropretry']=_0x29d40d['countdropretry'];this['countabandonedretry']=_0x29d40d[_0xf4d1('0x11')];this['countmachineretry']=_0x29d40d[_0xf4d1('0x12')];this[_0xf4d1('0x13')]=_0x29d40d['countagentrejectretry'];this[_0xf4d1('0x14')]=_0x5e9f37[_0xf4d1('0x14')];this['calleridname']=_0x29d40d['name'];this[_0xf4d1('0x15')]=_0x29d40d[_0xf4d1('0x16')];this[_0xf4d1('0x17')]=_0x29d40d[_0xf4d1('0x17')];this[_0xf4d1('0x18')]=_0x29d40d[_0xf4d1('0x18')];this[_0xf4d1('0x19')]=_0x29d40d['answertime'];this['endtime']=moment()[_0xf4d1('0x1a')](_0xf4d1('0x1b'));this[_0xf4d1('0x1c')]=getSeconds(_0x29d40d[_0xf4d1('0x18')],_0x29d40d[_0xf4d1('0x17')]);this[_0xf4d1('0x1d')]=getSeconds(_0x29d40d[_0xf4d1('0x19')],_0x29d40d['responsetime']);this[_0xf4d1('0x1e')]=getSeconds(this[_0xf4d1('0x1f')],_0x29d40d[_0xf4d1('0x19')]);this[_0xf4d1('0x20')]=_0x5e9f37['queue'];this[_0xf4d1('0x21')]=_0x5e9f37[_0xf4d1('0x21')];this['reason']=_0x5e9f37[_0xf4d1('0x22')];this['callback']=_0x29d40d['callback'];this[_0xf4d1('0x23')]=_0x29d40d[_0xf4d1('0x23')];this[_0xf4d1('0x24')]=_0x29d40d[_0xf4d1('0x24')];this[_0xf4d1('0x25')]=_0x29d40d['recallme'];this[_0xf4d1('0x26')]=_0x29d40d['ContactId'];this[_0xf4d1('0x27')]=_0x29d40d[_0xf4d1('0x27')];this['UserId']=_0x29d40d[_0xf4d1('0x28')];this[_0xf4d1('0x29')]=_0x29d40d[_0xf4d1('0x29')];this['CampaignId']=_0x29d40d[_0xf4d1('0x2a')];this['originatecalleridnum']=_0x29d40d[_0xf4d1('0x2b')]||'';this[_0xf4d1('0x2c')]=_0x29d40d[_0xf4d1('0x2c')]||'';}module[_0xf4d1('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index ce63480..65be054 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60c2=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x133e7a,_0x1887fb){var _0x323533=function(_0x561f44){while(--_0x561f44){_0x133e7a['push'](_0x133e7a['shift']());}};_0x323533(++_0x1887fb);}(_0x60c2,0x8f));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require('util');var _=require(_0x260c('0x0'));var moment=require(_0x260c('0x1'));function getSeconds(_0x43816a,_0x3ad4c5){var _0x2f5bc8=moment(_0x43816a)[_0x260c('0x2')](0x0);var _0x4cda33=moment(_0x3ad4c5)[_0x260c('0x2')](0x0);return _0x2f5bc8[_0x260c('0x3')](_0x4cda33,_0x260c('0x4'));}function Final(_0x1228a3){this[_0x260c('0x5')]=_0x1228a3['uniqueid'];this[_0x260c('0x6')]=_0x1228a3[_0x260c('0x6')];this[_0x260c('0x7')]=_0x1228a3[_0x260c('0x7')];this['campaigntype']=_0x1228a3[_0x260c('0x7')]===_0x260c('0x8')?_0x260c('0x9'):_0x1228a3[_0x260c('0x7')];this[_0x260c('0xa')]=_0x1228a3[_0x260c('0xa')];this[_0x260c('0xb')]=_0x1228a3['countcongestionretry'];this[_0x260c('0xc')]=_0x1228a3[_0x260c('0xc')];this[_0x260c('0xd')]=_0x1228a3['countbusyretry']+_0x1228a3[_0x260c('0xb')]+_0x1228a3[_0x260c('0xc')]+_0x1228a3[_0x260c('0xe')]+_0x1228a3['countdropretry']+_0x1228a3[_0x260c('0xf')]+_0x1228a3[_0x260c('0x10')]+_0x1228a3[_0x260c('0x11')];this[_0x260c('0xe')]=_0x1228a3[_0x260c('0xe')];this['countdropretry']=_0x1228a3[_0x260c('0x12')];this['countabandonedretry']=_0x1228a3[_0x260c('0xf')];this[_0x260c('0x10')]=_0x1228a3['countmachineretry'];this[_0x260c('0x11')]=_0x1228a3['countagentrejectretry'];this[_0x260c('0x9')]=_0x1228a3[_0x260c('0x9')];this[_0x260c('0x13')]=_0x1228a3[_0x260c('0x13')];this[_0x260c('0x14')]=_0x1228a3[_0x260c('0x14')];this[_0x260c('0x15')]=_0x1228a3[_0x260c('0x15')];this[_0x260c('0x16')]=_0x1228a3[_0x260c('0x16')];this[_0x260c('0x17')]=_0x1228a3['responsetime'];this[_0x260c('0x18')]=_0x1228a3['ringtime']||0x0;this[_0x260c('0x19')]=_0x1228a3[_0x260c('0x19')]||0x0;this['talktime']=_0x1228a3[_0x260c('0x1a')]||0x0;this[_0x260c('0x1b')]=_0x1228a3[_0x260c('0x1b')];this[_0x260c('0x1c')]=_0x1228a3[_0x260c('0x1c')];this[_0x260c('0x1d')]=_0x1228a3['callbackat'];this[_0x260c('0x1e')]=_0x1228a3[_0x260c('0x1e')];this[_0x260c('0x1f')]=_0x1228a3[_0x260c('0x1f')];this['ListId']=_0x1228a3[_0x260c('0x20')];this[_0x260c('0x21')]=_0x1228a3[_0x260c('0x21')];this[_0x260c('0x22')]=_0x1228a3['VoiceQueueId'];this[_0x260c('0x23')]=_0x1228a3[_0x260c('0x23')];this[_0x260c('0x24')]=_0x1228a3[_0x260c('0x24')]||'';this['originatecalleridname']=_0x1228a3[_0x260c('0x25')]||'';}module[_0x260c('0x26')]=Final; \ No newline at end of file +var _0x7da7=['queue','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0x7da7,0x10d));var _0x77da=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x7da7[_0x3e5f6d];return _0x1bea6e;};'use strict';var util=require(_0x77da('0x0'));var _=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));function getSeconds(_0x571213,_0x59892b){var _0x37667b=moment(_0x571213)[_0x77da('0x3')](0x0);var _0x4f60c3=moment(_0x59892b)[_0x77da('0x3')](0x0);return _0x37667b[_0x77da('0x4')](_0x4f60c3,'seconds');}function Final(_0x19331c){this[_0x77da('0x5')]=_0x19331c['uniqueid'];this[_0x77da('0x6')]=_0x19331c['scheduledat'];this[_0x77da('0x7')]=_0x19331c[_0x77da('0x7')];this[_0x77da('0x8')]=_0x19331c[_0x77da('0x7')]===_0x77da('0x9')?'queue':_0x19331c[_0x77da('0x7')];this[_0x77da('0xa')]=_0x19331c[_0x77da('0xa')];this['countcongestionretry']=_0x19331c[_0x77da('0xb')];this[_0x77da('0xc')]=_0x19331c[_0x77da('0xc')];this[_0x77da('0xd')]=_0x19331c['countbusyretry']+_0x19331c[_0x77da('0xb')]+_0x19331c[_0x77da('0xc')]+_0x19331c[_0x77da('0xe')]+_0x19331c['countdropretry']+_0x19331c['countabandonedretry']+_0x19331c[_0x77da('0xf')]+_0x19331c[_0x77da('0x10')];this['countnosuchnumberretry']=_0x19331c[_0x77da('0xe')];this[_0x77da('0x11')]=_0x19331c[_0x77da('0x11')];this[_0x77da('0x12')]=_0x19331c['countabandonedretry'];this[_0x77da('0xf')]=_0x19331c['countmachineretry'];this[_0x77da('0x10')]=_0x19331c[_0x77da('0x10')];this[_0x77da('0x13')]=_0x19331c[_0x77da('0x13')];this['calleridname']=_0x19331c['calleridname'];this['calleridnum']=_0x19331c['calleridnum'];this[_0x77da('0x14')]=_0x19331c[_0x77da('0x14')];this[_0x77da('0x15')]=_0x19331c[_0x77da('0x15')];this[_0x77da('0x16')]=_0x19331c[_0x77da('0x15')];this[_0x77da('0x17')]=_0x19331c[_0x77da('0x17')]||0x0;this['holdtime']=_0x19331c['holdtime']||0x0;this[_0x77da('0x18')]=_0x19331c[_0x77da('0x18')]||0x0;this['callback']=_0x19331c[_0x77da('0x19')];this[_0x77da('0x1a')]=_0x19331c[_0x77da('0x1a')];this['callbackat']=_0x19331c['callbackat'];this[_0x77da('0x1b')]=_0x19331c['recallme'];this[_0x77da('0x1c')]=_0x19331c[_0x77da('0x1c')];this[_0x77da('0x1d')]=_0x19331c[_0x77da('0x1d')];this[_0x77da('0x1e')]=_0x19331c[_0x77da('0x1e')];this[_0x77da('0x1f')]=_0x19331c['VoiceQueueId'];this['CampaignId']=_0x19331c[_0x77da('0x20')];this[_0x77da('0x21')]=_0x19331c[_0x77da('0x21')]||'';this[_0x77da('0x22')]=_0x19331c['originatecalleridname']||'';}module[_0x77da('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9962c0f..b2007a4 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f25=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','Answer','type','campaigntype'];(function(_0xacda6c,_0xad7000){var _0x1790d8=function(_0x48f81f){while(--_0x48f81f){_0xacda6c['push'](_0xacda6c['shift']());}};_0x1790d8(++_0xad7000);}(_0x4f25,0x158));var _0x54f2=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x4f25[_0x139a3c];return _0x2b375b;};'use strict';var util=require('util');var _=require(_0x54f2('0x0'));var moment=require(_0x54f2('0x1'));function getSeconds(_0x2fe409,_0xef53d1){var _0x15d602=moment(_0x2fe409)[_0x54f2('0x2')](0x0);var _0x58fdbf=moment(_0xef53d1)[_0x54f2('0x2')](0x0);return _0x15d602[_0x54f2('0x3')](_0x58fdbf,_0x54f2('0x4'));}function Hangup(_0x366309,_0x3d145a){this['state']=0x4;this['statedesc']=_0x54f2('0x5');this['scheduledat']=_0x366309['scheduledat'];this[_0x54f2('0x6')]=_0x366309[_0x54f2('0x6')];this[_0x54f2('0x7')]=_0x366309['type']===_0x54f2('0x8')?_0x54f2('0x9'):_0x366309[_0x54f2('0x6')];this[_0x54f2('0xa')]=_0x366309[_0x54f2('0xa')];this[_0x54f2('0xb')]=_0x366309[_0x54f2('0xb')];this[_0x54f2('0xc')]=_0x366309[_0x54f2('0xc')];this[_0x54f2('0xd')]=_0x366309[_0x54f2('0xa')]+_0x366309[_0x54f2('0xb')]+_0x366309[_0x54f2('0xc')]+_0x366309['countnosuchnumberretry']+_0x366309['countdropretry']+_0x366309[_0x54f2('0xe')]+_0x366309[_0x54f2('0xf')]+_0x366309['countagentrejectretry'];this[_0x54f2('0x10')]=_0x366309[_0x54f2('0x10')];this[_0x54f2('0x11')]=_0x366309['countdropretry'];this['countabandonedretry']=_0x366309[_0x54f2('0xe')];this[_0x54f2('0xf')]=_0x366309[_0x54f2('0xf')];this[_0x54f2('0x12')]=_0x366309[_0x54f2('0x12')];this[_0x54f2('0x13')]=_0x3d145a[_0x54f2('0x13')];this[_0x54f2('0x14')]=_0x366309[_0x54f2('0x15')];this[_0x54f2('0x16')]=_0x366309[_0x54f2('0x17')];this[_0x54f2('0x18')]=_0x366309['starttime'];this[_0x54f2('0x19')]=_0x366309[_0x54f2('0x19')];this[_0x54f2('0x1a')]=moment()[_0x54f2('0x1b')](_0x54f2('0x1c'));this[_0x54f2('0x1d')]=getSeconds(_0x366309[_0x54f2('0x19')],_0x366309[_0x54f2('0x18')]);this['holdtime']=0x0;this[_0x54f2('0x1e')]=getSeconds(this[_0x54f2('0x1a')],_0x366309['responsetime']);this[_0x54f2('0x9')]=_0x366309[_0x54f2('0x9')];this[_0x54f2('0x1f')]='IVR';this[_0x54f2('0x20')]=_0x3d145a[_0x54f2('0x21')];this[_0x54f2('0x22')]=_0x366309['callback'];this[_0x54f2('0x23')]=_0x366309[_0x54f2('0x23')];this[_0x54f2('0x24')]=_0x366309[_0x54f2('0x24')];this[_0x54f2('0x25')]=_0x366309['recallme'];this[_0x54f2('0x26')]=_0x366309[_0x54f2('0x26')];this[_0x54f2('0x27')]=_0x366309[_0x54f2('0x27')];this[_0x54f2('0x28')]=_0x366309[_0x54f2('0x28')];this['VoiceQueueId']=_0x366309[_0x54f2('0x29')];this[_0x54f2('0x2a')]=_0x366309['CampaignId'];}module[_0x54f2('0x2b')]=Hangup; \ No newline at end of file +var _0xab17=['calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid'];(function(_0x52f511,_0x2e5abb){var _0x342f02=function(_0x3fc3af){while(--_0x3fc3af){_0x52f511['push'](_0x52f511['shift']());}};_0x342f02(++_0x2e5abb);}(_0xab17,0xed));var _0x7ab1=function(_0x303e1e,_0x46fcca){_0x303e1e=_0x303e1e-0x0;var _0x2e9da1=_0xab17[_0x303e1e];return _0x2e9da1;};'use strict';var util=require(_0x7ab1('0x0'));var _=require('lodash');var moment=require(_0x7ab1('0x1'));function getSeconds(_0x326a83,_0x52976f){var _0x1e310d=moment(_0x326a83)[_0x7ab1('0x2')](0x0);var _0x6c4b29=moment(_0x52976f)['milliseconds'](0x0);return _0x1e310d[_0x7ab1('0x3')](_0x6c4b29,_0x7ab1('0x4'));}function Hangup(_0x14448a,_0x2d6127){this[_0x7ab1('0x5')]=0x4;this['statedesc']=_0x7ab1('0x6');this[_0x7ab1('0x7')]=_0x14448a[_0x7ab1('0x7')];this[_0x7ab1('0x8')]=_0x14448a[_0x7ab1('0x8')];this[_0x7ab1('0x9')]=_0x14448a[_0x7ab1('0x8')]===_0x7ab1('0xa')?_0x7ab1('0xb'):_0x14448a[_0x7ab1('0x8')];this[_0x7ab1('0xc')]=_0x14448a[_0x7ab1('0xc')];this[_0x7ab1('0xd')]=_0x14448a[_0x7ab1('0xd')];this[_0x7ab1('0xe')]=_0x14448a['countnoanswerretry'];this['countglobal']=_0x14448a[_0x7ab1('0xc')]+_0x14448a['countcongestionretry']+_0x14448a[_0x7ab1('0xe')]+_0x14448a[_0x7ab1('0xf')]+_0x14448a[_0x7ab1('0x10')]+_0x14448a['countabandonedretry']+_0x14448a[_0x7ab1('0x11')]+_0x14448a['countagentrejectretry'];this[_0x7ab1('0xf')]=_0x14448a[_0x7ab1('0xf')];this[_0x7ab1('0x10')]=_0x14448a['countdropretry'];this['countabandonedretry']=_0x14448a[_0x7ab1('0x12')];this[_0x7ab1('0x11')]=_0x14448a[_0x7ab1('0x11')];this[_0x7ab1('0x13')]=_0x14448a['countagentrejectretry'];this[_0x7ab1('0x14')]=_0x2d6127[_0x7ab1('0x14')];this[_0x7ab1('0x15')]=_0x14448a[_0x7ab1('0x16')];this['calleridnum']=_0x14448a[_0x7ab1('0x17')];this['starttime']=_0x14448a[_0x7ab1('0x18')];this[_0x7ab1('0x19')]=_0x14448a[_0x7ab1('0x19')];this[_0x7ab1('0x1a')]=moment()[_0x7ab1('0x1b')](_0x7ab1('0x1c'));this[_0x7ab1('0x1d')]=getSeconds(_0x14448a[_0x7ab1('0x19')],_0x14448a[_0x7ab1('0x18')]);this[_0x7ab1('0x1e')]=0x0;this['talktime']=getSeconds(this[_0x7ab1('0x1a')],_0x14448a[_0x7ab1('0x19')]);this[_0x7ab1('0xb')]=_0x14448a['queue'];this[_0x7ab1('0x1f')]=_0x7ab1('0x20');this['reason']=_0x2d6127[_0x7ab1('0x21')];this[_0x7ab1('0x22')]=_0x14448a['callback'];this[_0x7ab1('0x23')]=_0x14448a[_0x7ab1('0x23')];this[_0x7ab1('0x24')]=_0x14448a[_0x7ab1('0x24')];this[_0x7ab1('0x25')]=_0x14448a[_0x7ab1('0x25')];this[_0x7ab1('0x26')]=_0x14448a[_0x7ab1('0x26')];this[_0x7ab1('0x27')]=_0x14448a['ListId'];this[_0x7ab1('0x28')]=_0x14448a[_0x7ab1('0x28')];this[_0x7ab1('0x29')]=_0x14448a[_0x7ab1('0x29')];this['CampaignId']=_0x14448a['CampaignId'];}module[_0x7ab1('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 7c8fee0..0336fcc 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0971=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x14bc26,_0x13be0b){var _0x441c92=function(_0x2ff922){while(--_0x2ff922){_0x14bc26['push'](_0x14bc26['shift']());}};_0x441c92(++_0x13be0b);}(_0x0971,0x1d1));var _0x1097=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x0971[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0x1097('0x0'));var _=require(_0x1097('0x1'));var moment=require(_0x1097('0x2'));function getSeconds(_0x16c6be,_0x3ef9ae){var _0x50a768=moment(_0x16c6be)[_0x1097('0x3')](0x0);var _0x15b65a=moment(_0x3ef9ae)[_0x1097('0x3')](0x0);return _0x50a768[_0x1097('0x4')](_0x15b65a,_0x1097('0x5'));}function History(_0x54bb32){this[_0x1097('0x6')]=_0x54bb32[_0x1097('0x6')];this[_0x1097('0x7')]=_0x54bb32['scheduledat']||undefined;this[_0x1097('0x8')]=_0x54bb32[_0x1097('0x8')];this[_0x1097('0x9')]=_0x54bb32[_0x1097('0x8')]==='outbound'?_0x1097('0xa'):_0x54bb32[_0x1097('0x8')];this[_0x1097('0xb')]=_0x54bb32[_0x1097('0xb')];this[_0x1097('0xc')]=_0x54bb32[_0x1097('0xc')];this[_0x1097('0xd')]=_0x54bb32[_0x1097('0xd')];this['countglobal']=_0x54bb32[_0x1097('0xb')]+_0x54bb32[_0x1097('0xc')]+_0x54bb32[_0x1097('0xd')]+_0x54bb32['countnosuchnumberretry']+_0x54bb32[_0x1097('0xe')]+_0x54bb32[_0x1097('0xf')]+_0x54bb32[_0x1097('0x10')]+_0x54bb32['countagentrejectretry'];this[_0x1097('0x11')]=_0x54bb32[_0x1097('0x11')];this[_0x1097('0xe')]=_0x54bb32[_0x1097('0xe')];this[_0x1097('0xf')]=_0x54bb32[_0x1097('0xf')];this[_0x1097('0x10')]=_0x54bb32['countmachineretry'];this['countagentrejectretry']=_0x54bb32[_0x1097('0x12')];this['queue']=_0x54bb32[_0x1097('0xa')];this['calleridname']=_0x54bb32[_0x1097('0x13')];this[_0x1097('0x14')]=_0x54bb32['number'];this[_0x1097('0x15')]=_0x54bb32[_0x1097('0x15')];this[_0x1097('0x16')]=_0x54bb32[_0x1097('0x16')];this[_0x1097('0x17')]=_0x54bb32[_0x1097('0x16')];this[_0x1097('0x18')]=getSeconds(_0x54bb32['responsetime'],_0x54bb32['starttime']);this[_0x1097('0x19')]=0x0;this[_0x1097('0x1a')]=0x0;this['callback']=_0x54bb32[_0x1097('0x1b')];this[_0x1097('0x1c')]=_0x54bb32[_0x1097('0x1c')];this[_0x1097('0x1d')]=_0x54bb32[_0x1097('0x1d')];this[_0x1097('0x1e')]=_0x54bb32[_0x1097('0x1e')];this[_0x1097('0x1f')]=_0x54bb32['ContactId'];this['ListId']=_0x54bb32[_0x1097('0x20')];this[_0x1097('0x21')]=_0x54bb32['UserId'];this['VoiceQueueId']=_0x54bb32[_0x1097('0x22')];this[_0x1097('0x23')]=_0x54bb32['CampaignId'];this[_0x1097('0x24')]=_0x54bb32[_0x1097('0x24')]||'';this['originatecalleridname']=_0x54bb32[_0x1097('0x25')]||'';}module[_0x1097('0x26')]=History; \ No newline at end of file +var _0x75fe=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x75fe,0x1e2));var _0xe75f=function(_0x1d3f5b,_0x5cf186){_0x1d3f5b=_0x1d3f5b-0x0;var _0x378fb0=_0x75fe[_0x1d3f5b];return _0x378fb0;};'use strict';var util=require(_0xe75f('0x0'));var _=require('lodash');var moment=require(_0xe75f('0x1'));function getSeconds(_0xd60f7b,_0x29bfd8){var _0x36df41=moment(_0xd60f7b)[_0xe75f('0x2')](0x0);var _0x15c19e=moment(_0x29bfd8)[_0xe75f('0x2')](0x0);return _0x36df41[_0xe75f('0x3')](_0x15c19e,_0xe75f('0x4'));}function History(_0x597350){this['uniqueid']=_0x597350[_0xe75f('0x5')];this['scheduledat']=_0x597350[_0xe75f('0x6')]||undefined;this[_0xe75f('0x7')]=_0x597350[_0xe75f('0x7')];this['campaigntype']=_0x597350[_0xe75f('0x7')]==='outbound'?_0xe75f('0x8'):_0x597350[_0xe75f('0x7')];this[_0xe75f('0x9')]=_0x597350[_0xe75f('0x9')];this[_0xe75f('0xa')]=_0x597350[_0xe75f('0xa')];this[_0xe75f('0xb')]=_0x597350[_0xe75f('0xb')];this[_0xe75f('0xc')]=_0x597350[_0xe75f('0x9')]+_0x597350[_0xe75f('0xa')]+_0x597350[_0xe75f('0xb')]+_0x597350[_0xe75f('0xd')]+_0x597350[_0xe75f('0xe')]+_0x597350['countabandonedretry']+_0x597350[_0xe75f('0xf')]+_0x597350[_0xe75f('0x10')];this[_0xe75f('0xd')]=_0x597350[_0xe75f('0xd')];this['countdropretry']=_0x597350['countdropretry'];this[_0xe75f('0x11')]=_0x597350[_0xe75f('0x11')];this[_0xe75f('0xf')]=_0x597350[_0xe75f('0xf')];this[_0xe75f('0x10')]=_0x597350['countagentrejectretry'];this['queue']=_0x597350[_0xe75f('0x8')];this[_0xe75f('0x12')]=_0x597350[_0xe75f('0x13')];this[_0xe75f('0x14')]=_0x597350[_0xe75f('0x15')];this['starttime']=_0x597350[_0xe75f('0x16')];this['responsetime']=_0x597350[_0xe75f('0x17')];this['endtime']=_0x597350['responsetime'];this[_0xe75f('0x18')]=getSeconds(_0x597350[_0xe75f('0x17')],_0x597350[_0xe75f('0x16')]);this[_0xe75f('0x19')]=0x0;this['talktime']=0x0;this[_0xe75f('0x1a')]=_0x597350[_0xe75f('0x1a')];this[_0xe75f('0x1b')]=_0x597350[_0xe75f('0x1b')];this[_0xe75f('0x1c')]=_0x597350['callbackat'];this[_0xe75f('0x1d')]=_0x597350[_0xe75f('0x1d')];this[_0xe75f('0x1e')]=_0x597350['ContactId'];this[_0xe75f('0x1f')]=_0x597350[_0xe75f('0x1f')];this[_0xe75f('0x20')]=_0x597350[_0xe75f('0x20')];this[_0xe75f('0x21')]=_0x597350[_0xe75f('0x21')];this[_0xe75f('0x22')]=_0x597350[_0xe75f('0x22')];this[_0xe75f('0x23')]=_0x597350[_0xe75f('0x23')]||'';this[_0xe75f('0x24')]=_0x597350['originatecalleridname']||'';}module[_0xe75f('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a10c96a..61d09ed 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 _0xe48c=['[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','NOT_ACTIVE','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','updateOriginated','notFound','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','saveInDb','syncVarSet','voiceQueues','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','statedesc','HangupInAMD','membername','buildObj','amd','[syncHangupInAMD]','Machine','AMD','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countbusyretry','countnosuchnumberretry','countabandonedretry','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','queueCallerAbandonCreateState','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','roundrobin','stateinterface','locked','push','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','isTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','checkIfTime','pow','random','match','actionOriginate','object','originate','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','countReScheduled','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','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','[abandonmentRate]','p\x20=\x20','Amax\x20=\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]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','newexten','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated'];(function(_0x57fabc,_0x2b4c84){var _0x128d52=function(_0x255f41){while(--_0x255f41){_0x57fabc['push'](_0x57fabc['shift']());}};_0x128d52(++_0x2b4c84);}(_0xe48c,0x183));var _0xce48=function(_0x27448b,_0x37e2d3){_0x27448b=_0x27448b-0x0;var _0x26eb12=_0xe48c[_0x27448b];return _0x26eb12;};'use strict';var util=require(_0xce48('0x0'));var _=require(_0xce48('0x1'));var BPromise=require(_0xce48('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xce48('0x3'));var Redis=require(_0xce48('0x4'));var ut=require(_0xce48('0x5'));var config=require(_0xce48('0x6'));var logger=require(_0xce48('0x7'))(_0xce48('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xce48('0x7'))(_0xce48('0x9'));var loggerPredictiveCalls=require(_0xce48('0x7'))(_0xce48('0xa'));var loggerSyncQueueSummary=require(_0xce48('0x7'))(_0xce48('0xb'));var ami=require(_0xce48('0xc'));config[_0xce48('0xd')]=_['defaults'](config[_0xce48('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce48('0xd')]));var cmHopper=require(_0xce48('0xe'));var cmHopperHistory=require(_0xce48('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0xce48('0x10'));var History=require(_0xce48('0x11'));var Final=require(_0xce48('0x12'));var AgentComplete=require(_0xce48('0x13'));var QueueCallerAbandon=require(_0xce48('0x14'));var Hangup=require('./hangup');var ipAgi=process[_0xce48('0x15')]['XCALLY_IP_AGI']||_0xce48('0x16');var strategy={'rrmemory':_0xce48('0x17'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xce48('0x18')]['enqueue']=function(_0x462fe9){this[_0xce48('0x19')]=this['tail']?this[_0xce48('0x19')][_0xce48('0x1a')](_0x462fe9):_0x462fe9();};function Dialer(_0x90150a,_0x167b16){this[_0xce48('0x1b')]=new Sequence();this[_0xce48('0x1c')]=_0x167b16;this['voiceQueues']=_0x90150a['voiceQueues'];this[_0xce48('0x1d')]=_0x90150a[_0xce48('0x1d')];this[_0xce48('0x1e')]=_0x90150a[_0xce48('0x1e')];this[_0xce48('0x1f')]=_0x90150a['trunks'];this[_0xce48('0x20')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xce48('0x21')]={};this[_0xce48('0x22')]={};this[_0xce48('0x23')]={};this[_0xce48('0x24')]={};this[_0xce48('0x25')]={};this['startProgressive']={};this[_0xce48('0x26')]={};this[_0xce48('0x27')]={};this[_0xce48('0x28')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xce48('0x29')](this));ami['on'](_0xce48('0x2a'),this[_0xce48('0x2b')][_0xce48('0x29')](this));ami['on'](_0xce48('0x2c'),this[_0xce48('0x2d')][_0xce48('0x29')](this));ami['on']('agentcomplete',this[_0xce48('0x2e')]['bind'](this));ami['on'](_0xce48('0x2f'),this[_0xce48('0xb')]['bind'](this));ami['on'](_0xce48('0x30'),this['syncHangup']['bind'](this));ami['on'](_0xce48('0x31'),this['syncNewExten'][_0xce48('0x29')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xce48('0x32'),this[_0xce48('0x33')][_0xce48('0x29')](this));ami['on'](_0xce48('0x34'),this[_0xce48('0x35')][_0xce48('0x29')](this));this[_0xce48('0x36')]();this[_0xce48('0x37')]();RpcSetting['getSettings']()[_0xce48('0x38')](function(_0x457604){previewRecallmeReminderInterval=_0x457604[_0xce48('0x39')];});}function isNotNull(_0x46bf3f){return _0x46bf3f!==null&&!_['isUndefined'](_0x46bf3f);}function checkIsLoggedIn(_0x38c58a,_0x331773){return function(){if(_0x331773<=0x0){_0x38c58a[_0xce48('0x3a')]=_0xce48('0x3b');throw _0x38c58a[_0xce48('0x3c')]+_0xce48('0x3d');}};}function isActive(_0xc92a8){return _0xc92a8;}function checkIsActive(_0x5db1ee,_0x370f9b){return function(){if(!isActive(_0x370f9b)){_0x5db1ee[_0xce48('0x3a')]='NOT_ACTIVE';throw _0x5db1ee[_0xce48('0x3c')]+_0xce48('0x3e');}};}function checkInterval(_0x22e4e4){return function(){if(!isNotNull(_0x22e4e4[_0xce48('0x3f')])){_0x22e4e4['message']=_0xce48('0x40');throw _0x22e4e4[_0xce48('0x3c')]+_0xce48('0x41');}if(!isNotNull(_0x22e4e4[_0xce48('0x3f')][_0xce48('0x42')])){_0x22e4e4[_0xce48('0x3a')]='INTERVAL_IS_NULL';throw _0x22e4e4[_0xce48('0x3c')]+_0xce48('0x41');}if(!isNotNull(_['isEmpty'](_0x22e4e4[_0xce48('0x3f')][_0xce48('0x42')]))){_0x22e4e4[_0xce48('0x3a')]=_0xce48('0x40');throw _0x22e4e4[_0xce48('0x3c')]+_0xce48('0x41');}};}function msgResponse(_0x220f7b,_0x521dd0,_0x7c13c5){return{'action':_0x220f7b,'response':_0x521dd0,'message':_0x7c13c5,'stack':_0x7c13c5};}function myreject(_0x48b8df){return function(_0x31a5ea){return _0x48b8df(msgResponse(_0xce48('0x43'),_0xce48('0x44'),JSON[_0xce48('0x45')](_0x31a5ea)));};}function getSeconds(_0x1fa5fa,_0x47d379){var _0x148508=moment(_0x1fa5fa)[_0xce48('0x46')](0x0);var _0x3a15c7=moment(_0x47d379)[_0xce48('0x46')](0x0);return _0x148508['diff'](_0x3a15c7,_0xce48('0x47'));}function emit(_0x3ee4a9,_0x5d0925,_0x52c965){io['to'](_0x3ee4a9)[_0xce48('0x48')](_0x5d0925,_0x52c965);}function emitVoiceQueueSummary(_0x3d80a6){if(_0x3d80a6['type']===_0xce48('0x49')){var _0x457581={'id':_0x3d80a6['id'],'name':_0x3d80a6[_0xce48('0x3c')],'strategy':_0x3d80a6[_0xce48('0x4a')],'answered':_0x3d80a6[_0xce48('0x4b')],'available':_0x3d80a6[_0xce48('0x4c')],'loggedIn':_0x3d80a6[_0xce48('0x4d')],'pTalking':_0x3d80a6[_0xce48('0x4e')],'sumBillable':_0x3d80a6[_0xce48('0x4f')],'sumDuration':_0x3d80a6[_0xce48('0x50')],'sumHoldTime':_0x3d80a6['sumHoldTime']||0x0,'talking':_0x3d80a6['talking'],'total':_0x3d80a6[_0xce48('0x51')],'type':_0x3d80a6['type'],'unmanaged':_0x3d80a6['unmanaged'],'abandoned':_0x3d80a6[_0xce48('0x52')],'waiting':_0x3d80a6[_0xce48('0x53')],'loggedInDb':_0x3d80a6['loggedInDb'],'dialActive':_0x3d80a6[_0xce48('0x54')],'dialMethod':_0x3d80a6['dialMethod'],'dialOriginateCallerIdName':_0x3d80a6[_0xce48('0x55')],'dialOriginateCallerIdNumber':_0x3d80a6[_0xce48('0x56')],'dialOriginateTimeout':_0x3d80a6[_0xce48('0x57')],'dialPrefix':_0x3d80a6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3d80a6[_0xce48('0x58')],'outboundAnswerCallsDay':_0x3d80a6['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3d80a6[_0xce48('0x59')],'outboundBusyCallsDay':_0x3d80a6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3d80a6['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3d80a6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3d80a6[_0xce48('0x5a')],'outboundDropCallsDayTimeout':_0x3d80a6[_0xce48('0x5b')],'outboundNoAnswerCallsDay':_0x3d80a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3d80a6[_0xce48('0x5c')],'outboundOriginateFailureCallsDay':_0x3d80a6[_0xce48('0x5d')],'outboundReCallsDay':_0x3d80a6[_0xce48('0x5e')],'outboundRejectCallsDay':_0x3d80a6['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3d80a6[_0xce48('0x5f')],'predictiveIntervalAnsweredCalls':_0x3d80a6[_0xce48('0x60')],'predictiveIntervalAvgHoldtime':_0x3d80a6[_0xce48('0x61')],'predictiveIntervalAvgTalktime':_0x3d80a6[_0xce48('0x62')],'predictiveIntervalDroppedCallsCallersExit':_0x3d80a6[_0xce48('0x63')],'predictiveIntervalDroppedCallsTimeout':_0x3d80a6[_0xce48('0x64')],'predictiveIntervalErlangCalls':_0x3d80a6[_0xce48('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x3d80a6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3d80a6[_0xce48('0x66')],'predictiveIntervalMultiplicativeFactor':_0x3d80a6[_0xce48('0x67')],'predictiveIntervalPauses':_0x3d80a6[_0xce48('0x68')],'predictiveIntervalAvailable':_0x3d80a6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3d80a6[_0xce48('0x69')],'message':_0x3d80a6[_0xce48('0x3a')],'originated':_0x3d80a6['originated'],'erlangCalls':_0x3d80a6['erlangCalls'],'erlangCallToSecond':_0x3d80a6[_0xce48('0x6a')],'erlangAbandonmentRate':_0x3d80a6[_0xce48('0x6b')],'erlangBusyFactor':_0x3d80a6[_0xce48('0x6c')],'startPredictive':_0x3d80a6[_0xce48('0x25')],'startProgressive':_0x3d80a6[_0xce48('0x6d')]};if(_0x3d80a6[_0xce48('0x6e')]){_0x457581[_0xce48('0x6e')]={'id':_0x3d80a6[_0xce48('0x6e')]['id'],'name':_0x3d80a6['Trunk']['name'],'active':_0x3d80a6[_0xce48('0x6e')][_0xce48('0x6f')],'callerid':_0x3d80a6['Trunk'][_0xce48('0x70')]};}if(_0x3d80a6[_0xce48('0x3f')]){_0x457581[_0xce48('0x3f')]={'id':_0x3d80a6[_0xce48('0x3f')]['id'],'name':_0x3d80a6['Interval'][_0xce48('0x3c')]};}var _0x553ee1=md5(JSON[_0xce48('0x45')](_0x457581));if(_0x3d80a6[_0xce48('0x3')]!==_0x553ee1){_0x3d80a6[_0xce48('0x3')]=_0x553ee1;emit(util[_0xce48('0x71')](_0xce48('0x72'),_0x457581[_0xce48('0x3c')]),_0xce48('0x73'),_0x457581);}}}function emitCampaignSummary(_0x276149){if(_0x276149[_0xce48('0x74')]===_0xce48('0x75')){emit(util[_0xce48('0x71')](_0xce48('0x76'),_0x276149[_0xce48('0x3c')]),_0xce48('0x77'),_0x276149);}}function checkGetDataPredictive(_0x4baec3){if(isNotNull(_0x4baec3)&&!_['isEmpty'](_0x4baec3)){loggerPredictive['info'](_0xce48('0x78'));loggerPredictive[_0xce48('0x79')](_0xce48('0x7a'),_0x4baec3[_0xce48('0x69')]);loggerPredictive['info'](_0xce48('0x7b'),_0x4baec3[_0xce48('0x60')]);loggerPredictive[_0xce48('0x79')](_0xce48('0x7c'),_0x4baec3[_0xce48('0x64')]);loggerPredictive['info'](_0xce48('0x7d'),_0x4baec3[_0xce48('0x63')]);loggerPredictive['info'](_0xce48('0x7e'),_0x4baec3[_0xce48('0x61')]);loggerPredictive[_0xce48('0x79')](_0xce48('0x7f'),_0x4baec3[_0xce48('0x62')]);loggerPredictive['info'](_0xce48('0x80'));if(_0x4baec3['predictiveIntervalTotalCalls']>0x0){if(!_[_0xce48('0x81')](_0x4baec3[_0xce48('0x62')])&&_0x4baec3[_0xce48('0x62')]>0x0){return!![];}loggerPredictive[_0xce48('0x79')](_0xce48('0x82'));if(!_['isUndefined'](_0x4baec3[_0xce48('0x61')])&&_0x4baec3[_0xce48('0x61')]>0x0){return!![];}loggerPredictive[_0xce48('0x79')](_0xce48('0x83'));}else{loggerPredictive['info'](_0xce48('0x84'));}}else{loggerPredictive['info'](_0xce48('0x85'));}return![];}function mergeDataErlangB(_0x42c991){return function(_0x22824d){loggerPredictive['info'](_0xce48('0x86'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22824d['erlangCalls']);loggerPredictive[_0xce48('0x79')](_0xce48('0x87'),_0x22824d[_0xce48('0x6a')]);loggerPredictive[_0xce48('0x79')](_0xce48('0x88'),_0x22824d[_0xce48('0x6b')]);loggerPredictive[_0xce48('0x79')](_0xce48('0x89'),_0x22824d[_0xce48('0x6c')]);loggerPredictive[_0xce48('0x79')](_0xce48('0x88'),_0x22824d[_0xce48('0x6b')]);loggerPredictive['info'](_0xce48('0x80'));_[_0xce48('0x8a')](_0x42c991,_0x22824d);};}function getDiff(_0x34e9e7){var _0x176bd4=moment()[_0xce48('0x46')](0x0);var _0x113323=moment(_0x34e9e7)[_0xce48('0x46')](0x0);return _0x176bd4[_0xce48('0x8b')](_0x113323,_0xce48('0x47'));}function ifInterval(_0x2ed94a,_0x24d914){if(_[_0xce48('0x81')](_0x24d914)){return![];}return getDiff(_0x24d914)<_0x2ed94a*0x3c;}function freeVariablesPredictive(_0x3c1d37){if(isNotNull(_0x3c1d37)){if(!_[_0xce48('0x81')](_0x3c1d37[_0xce48('0x6d')])){_0x3c1d37[_0xce48('0x6d')]=undefined;loggerPredictive[_0xce48('0x79')](_0x3c1d37['name'],_0xce48('0x8c'));}if(!_[_0xce48('0x81')](_0x3c1d37[_0xce48('0x25')])){_0x3c1d37['startPredictive']=undefined;loggerPredictive[_0xce48('0x79')](_0x3c1d37[_0xce48('0x3c')],_0xce48('0x8d'));}if(!_[_0xce48('0x81')](_0x3c1d37[_0xce48('0x8e')])){clearInterval(_0x3c1d37['handlePredictive']);_0x3c1d37[_0xce48('0x8e')]=undefined;loggerPredictive[_0xce48('0x79')](_0x3c1d37['name'],_0xce48('0x8f'));}}}function erlangb(_0x16e8d4,_0x5ab290){if(_0x5ab290===0x0){return 0x0;}var _0x5c67a5=0x1;for(var _0x557720=0x1;_0x557720<=_0x5ab290;_0x557720+=0x1){_0x5c67a5=0x1+_0x5c67a5*_0x557720/_0x16e8d4;}return 0x1/_0x5c67a5;}function isVoiceQueueOutbound(_0x854dc8){return _0x854dc8===_0xce48('0x49');}function isNotPreview(_0x5ed620){return _0x5ed620!=='preview';}function isCampaignIvr(_0xff6648){return _0xff6648===_0xce48('0x75');}function getCallerId(_0x336577,_0x556bef,_0x4b6b13){if(!_[_0xce48('0x81')](_0x4b6b13)&&typeof _0x4b6b13===_0xce48('0x90')&&!_[_0xce48('0x91')](_0x4b6b13)){if(!_['isUndefined'](_0x556bef)&&typeof _0x556bef===_0xce48('0x90')&&!_[_0xce48('0x91')](_0x556bef)){return util[_0xce48('0x71')](_0xce48('0x92'),_0x556bef,_0x4b6b13);}return util[_0xce48('0x71')](_0xce48('0x92'),_0x4b6b13,_0x4b6b13);}if(!_['isUndefined'](_0x336577)&&typeof _0x336577==='string'&&!_['isEmpty'](_0x336577)){return _0x336577;}return _0xce48('0x93');}function loggerCatchQueueSummary(_0xcea2f,_0x2fe500){return function(_0x5dbf30){freeVariablesPredictive(_0x2fe500);emitVoiceQueueSummary(_0x2fe500);emitCampaignSummary(_0x2fe500);loggerSyncQueueSummary[_0xce48('0x94')](_0xcea2f,util[_0xce48('0x95')](_0x5dbf30,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x110125,_0x48a0e8){return function(_0x327305){loggerPredictive[_0xce48('0x94')](_0x48a0e8[_0xce48('0x3c')],_0x110125);loggerPredictive[_0xce48('0x94')](_0x327305[_0xce48('0x96')]);freeVariablesPredictive(_0x48a0e8);};}function loggerCatch(_0x5017b1){return function(_0x5122cf){logger[_0xce48('0x94')](_0x5017b1,util[_0xce48('0x95')](_0x5122cf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4ffec0){return _0x4ffec0&&!_[_0xce48('0x81')](_0x4ffec0)&&_0x4ffec0[_0xce48('0x97')]>0x0;}function decremetOriginate(_0x80ccaf){if(!_[_0xce48('0x81')](_0x80ccaf)&&_0x80ccaf!==null){if(typeof _0x80ccaf[_0xce48('0x98')]!=='undefined'){if(_0x80ccaf['originated']>0x0){_0x80ccaf[_0xce48('0x98')]-=0x1;}else{logger[_0xce48('0x94')](_0xce48('0x99'));}}}else{logger[_0xce48('0x94')](_0xce48('0x9a'));}}function checkContactLowerLimitOriginate(_0x412177,_0x70ad26,_0xfe42c){if(_0x70ad26>_0xfe42c){for(var _0x433ee0=0x0;_0x433ee0<_0x70ad26-_0xfe42c;_0x433ee0+=0x1){decremetOriginate(_0x412177);}}}function loggerGetContactDialer(_0x114845,_0xb74338,_0x9bc2a7){return function(_0x3ce218){checkContactLowerLimitOriginate(_0xb74338,_0x9bc2a7,0x0);logger['error'](_0x114845,util[_0xce48('0x95')](_0x3ce218,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x13fedd){return function(_0x22425f){if(isNotNull(_0x22425f)&&isNotNull(_0x22425f[0x0])){if(_0x22425f[0x0]['contactsRescheduled']>0x0){_0x13fedd[_0xce48('0x3a')]=_0xce48('0x9b');logger['info'](_0xce48('0x9c')+_0x13fedd[_0xce48('0x3c')],_0x22425f[0x0][_0xce48('0x9d')],_0xce48('0x9e'));}else{_0x13fedd['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xce48('0x79')](_0xce48('0x9f')+_0x13fedd['name']);}}};}function notSendMessagesQueue(_0x5b47d0){if(_0x5b47d0['sendMessageOneNotActive']){freeVariablesPredictive(_0x5b47d0);if(_0x5b47d0[_0xce48('0x98')]===0x0&&_0x5b47d0['talking']===0x0&&_0x5b47d0[_0xce48('0x53')]===0x0&&(_0x5b47d0[_0xce48('0x4e')]||0x0)===0x0){_0x5b47d0['sendMessageOneNotActive']=![];_0x5b47d0['available']=0x0;_0x5b47d0[_0xce48('0x3a')]=_0xce48('0xa0');loggerSyncQueueSummary[_0xce48('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5b47d0['name'],'is\x20not\x20active');}else{_0x5b47d0[_0xce48('0x3a')]=_0xce48('0xa1');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5b47d0['name'],_0xce48('0xa2'));}emitVoiceQueueSummary(_0x5b47d0);}}function notSendMessagesCampaign(_0x8e0a97){if(_0x8e0a97[_0xce48('0xa3')]){if(_0x8e0a97['originated']===0x0){_0x8e0a97[_0xce48('0xa3')]=![];_0x8e0a97[_0xce48('0x3a')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xce48('0x94')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x8e0a97['name'],_0xce48('0xa4'));}else{_0x8e0a97[_0xce48('0x3a')]=_0xce48('0xa1');loggerSyncQueueSummary[_0xce48('0x94')](_0xce48('0xa5'),_0x8e0a97[_0xce48('0x3c')],_0xce48('0xa2'));}emitCampaignSummary(_0x8e0a97);}}function createObjHistory(_0x4251b5,_0x4b4cb3,_0x37735c,_0x40232c,_0x7a06ec){_0x4251b5[_0xce48('0x3a')]=_0x37735c;var _0x5e3e4d=new Action(_0x4251b5,_0x4b4cb3);var _0x2008f0=new History(_0x5e3e4d);_0x2008f0[_0xce48('0xa6')]=_0x40232c;_0x2008f0['statedesc']=_0x7a06ec;_0x2008f0[_0xce48('0xa7')]=_0x5e3e4d[_0xce48('0xa8')];return _0x2008f0;}Dialer[_0xce48('0x18')][_0xce48('0x37')]=function(){var _0x5e9fc5=this;setInterval(function(){_0x5e9fc5[_0xce48('0xa9')](_0x5e9fc5[_0xce48('0x23')],_0xce48('0xaa'));_0x5e9fc5[_0xce48('0xa9')](_0x5e9fc5[_0xce48('0x21')],_0xce48('0xab'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x24cfbe,_0x510b2f){var _0x40b58f=this;for(var _0x121016 in _0x24cfbe){if(typeof _0x24cfbe[_0x121016]!==_0xce48('0xac')){this[_0xce48('0x1b')][_0xce48('0xad')](function(){if(!_[_0xce48('0xae')](_0x24cfbe[_0x121016])){return ami[_0xce48('0xaf')]({'action':_0xce48('0xb0'),'channel':_0x24cfbe[_0x121016][_0xce48('0xb1')]})[_0xce48('0xb2')](function(_0x292c8e){if(_0x292c8e['message']===_0xce48('0xb3')){setTimeout(function(){if(_0x24cfbe[_0x121016]&&_0x24cfbe[_0x121016][_0xce48('0x74')]!==_0xce48('0x75')){_0x40b58f['updateOriginated'](_0x40b58f['voiceQueues'][_0x24cfbe[_0x121016][_0xce48('0xb4')]]);logger[_0xce48('0x94')](_0xce48('0xb5'),_0x510b2f,_0x121016,_0x24cfbe[_0x121016][_0xce48('0xb4')]);delete _0x24cfbe[_0x121016];}if(_0x24cfbe[_0x121016]&&_0x24cfbe[_0x121016]['type']===_0xce48('0x75')){_0x40b58f['updateOriginated'](_0x40b58f['campaigns'][_0x24cfbe[_0x121016]['queue']]);logger[_0xce48('0x94')](_0xce48('0xb6'),_0x510b2f,_0x121016,_0x24cfbe[_0x121016][_0xce48('0xb4')]);delete _0x24cfbe[_0x121016];}},0x2328);}});}});}}};Dialer[_0xce48('0x18')]['countReScheduled']=function(_0x19e4f1){return BPromise[_0xce48('0xb7')]()['then'](cmHopper['countReScheduled'](_0x19e4f1))['catch'](loggerCatch(_0xce48('0xb8')));};Dialer[_0xce48('0x18')][_0xce48('0xb9')]=function(_0x1599ae){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopperBlack['checkIsBlackList'](_0x1599ae))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xce48('0x18')]['checkIsBlackListIvr']=function(_0x34e350){return BPromise['resolve']()[_0xce48('0x38')](cmHopperBlack[_0xce48('0xba')](_0x34e350))['catch'](loggerCatch(_0xce48('0xbb')));};Dialer[_0xce48('0x18')][_0xce48('0xbc')]=function(_0x1d37fe){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopperHistory[_0xce48('0xbd')](_0x1d37fe))[_0xce48('0xb2')](loggerCatch(_0xce48('0xbe')));};Dialer['prototype'][_0xce48('0xbf')]=function(_0x354bfc){return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x354bfc))[_0xce48('0xb2')](loggerCatch(_0xce48('0xc0')));};Dialer[_0xce48('0x18')][_0xce48('0xc1')]=function(_0x5798ec,_0x566a56,_0x486dfc){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopper['unlockContact'](_0x5798ec,_0x566a56,_0x486dfc))['catch'](loggerCatch(_0xce48('0xc2')));};Dialer[_0xce48('0x18')][_0xce48('0xc3')]=function(_0x18da89,_0x40efc5,_0x17038d,_0x4a1217,_0x30451a){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopper[_0xce48('0xc3')](_0x18da89,_0x40efc5,_0x17038d,_0x4a1217))[_0xce48('0xb2')](function(_0x2641dd){_0x30451a[_0xce48('0xc4')]-=_0x17038d;_0x30451a[_0xce48('0xc4')]=_0x30451a[_0xce48('0xc4')]>0x0?_0x30451a[_0xce48('0xc4')]:0x0;loggerCatch(_0xce48('0xc5'))(_0x2641dd);});};Dialer[_0xce48('0x18')][_0xce48('0xc6')]=function(_0x2793be,_0xfb7388,_0x1eaa4d,_0x1021c4){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopper[_0xce48('0xc6')](_0x2793be,_0xfb7388,_0x1eaa4d))[_0xce48('0xb2')](function(_0x41ec59){_0x1021c4[_0xce48('0xc4')]-=_0xfb7388;_0x1021c4[_0xce48('0xc4')]=_0x1021c4[_0xce48('0xc4')]>0x0?_0x1021c4[_0xce48('0xc4')]:0x0;loggerCatch(_0xce48('0xc7'))(_0x41ec59);});};Dialer['prototype'][_0xce48('0xc8')]=function(_0x8e54a5){return BPromise['resolve']()['then'](voiceQueueRt[_0xce48('0xc8')](_0x8e54a5))[_0xce48('0xb2')](loggerCatch(_0xce48('0xc9')));};Dialer[_0xce48('0x18')][_0xce48('0xca')]=function(_0x20614a){return BPromise[_0xce48('0xb7')]()['then'](cmHopper[_0xce48('0xca')](_0x20614a))[_0xce48('0xb2')](loggerCatch(_0xce48('0xcb')));};Dialer[_0xce48('0x18')][_0xce48('0xcc')]=function(_0x4b1267){return BPromise['resolve']()['then'](cmHopperHistory[_0xce48('0xcc')](_0x4b1267))[_0xce48('0xb2')](loggerCatch(_0xce48('0xcd')));};Dialer[_0xce48('0x18')]['updateOriginated']=function(_0x381aea){if(!_['isUndefined'](_0x381aea)&&_0x381aea!==null){if(typeof _0x381aea[_0xce48('0x98')]!==_0xce48('0xac')){if(_0x381aea['originated']>0x0){_0x381aea[_0xce48('0x98')]-=0x1;}else{logger[_0xce48('0x94')](_0xce48('0xce'));}}}else{logger[_0xce48('0x94')](_0xce48('0xcf'));}};Dialer[_0xce48('0x18')][_0xce48('0xd0')]=function(_0x2aa683,_0x24751f){var _0x398862=this;return function(_0x408040){_0x398862[_0xce48('0xd1')](_0x24751f);logger[_0xce48('0x94')](_0x2aa683,util[_0xce48('0x95')](_0x408040,{'showHidden':![],'depth':null}));};};Dialer[_0xce48('0x18')]['emptyContact']=function(_0x1edba4,_0x4f9b52,_0x33d125){var _0x3b0fec={'state':0x19,'statedesc':_0xce48('0xd2')};this[_0xce48('0xd1')](_0x4f9b52);this['saveInDb'](_[_0xce48('0x8a')](_0x3b0fec,_['pick'](_0x33d125,[_0xce48('0xd3'),_0xce48('0xd4'),_0xce48('0xd5'),_0xce48('0xd6'),_0xce48('0xd7')])),_0xce48('0xd8'),_0xce48('0xd9'));logger[_0xce48('0x94')](_0x1edba4);};Dialer[_0xce48('0x18')][_0xce48('0xda')]=function(_0x5e03e8){return _0x5e03e8===_0xce48('0xdb');};Dialer[_0xce48('0x18')]['isTrunkReachable']=function(_0x1662ce){return!_[_0xce48('0x81')](_0x1662ce)&&_0x1662ce&&!_[_0xce48('0x81')](_0x1662ce[_0xce48('0x3c')])&&!_[_0xce48('0x81')](_0x1662ce[_0xce48('0x6f')])&&_0x1662ce[_0xce48('0x6f')]&&(this[_0xce48('0x1f')][util[_0xce48('0x71')](_0xce48('0xdc'),_0x1662ce[_0xce48('0x3c')])][_0xce48('0xb0')]===_0xce48('0xdd')||this['trunks'][util[_0xce48('0x71')](_0xce48('0xdc'),_0x1662ce['name'])][_0xce48('0xb0')]===_0xce48('0xde'));};Dialer[_0xce48('0x18')][_0xce48('0xdf')]=function(_0x26f5e0,_0x12ff99,_0x34cdd6){this['createHistory'](_0x26f5e0)['catch'](loggerCatch(_0x12ff99));this[_0xce48('0xca')](_0x26f5e0)['catch'](loggerCatch(_0x34cdd6));};Dialer[_0xce48('0x18')][_0xce48('0xe0')]=function(_0x49191a){var _0x369e51=this[_0xce48('0x23')][_0x49191a['uniqueid']];var _0x24e56d;if(!_[_0xce48('0xae')](_0x49191a)&&!_[_0xce48('0xae')](_0x49191a['variable'])&&!_[_0xce48('0xae')](_0x49191a['variable']['amdstatus'])&&_0x49191a['exten']==='xcally-motion-dialer'&&_0x369e51){if(_0x369e51[_0xce48('0x74')]!==_0xce48('0x75')&&this[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]][_0xce48('0xe2')]&&_0x49191a[_0xce48('0xe3')]===_0xce48('0xe4')){delete this['uniqueId'][_0x49191a[_0xce48('0xe5')]];this[_0xce48('0xd1')](this[_0xce48('0xe1')][_0x369e51['queue']]);this[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]][_0xce48('0xe6')]+=0x1;this[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]][_0xce48('0x58')]+=0x1;_0x24e56d=new Hangup(_0x369e51,_0x49191a);_0x24e56d['state']=0x12;_0x24e56d[_0xce48('0xe7')]=_0xce48('0xe8');_0x24e56d[_0xce48('0xe9')]='AMD';ami[_0xce48('0x48')]('custom:amd',ut[_0xce48('0xea')](_0x24e56d,_0xce48('0xeb')));this['saveInDb'](_0x24e56d,'[syncHangupInAMD][createHistory]',_0xce48('0xec'));}if(_0x369e51['type']!=='ivr'&&this[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]][_0xce48('0xe2')]&&_0x49191a[_0xce48('0xe3')]==='MACHINE'){var _0x56fc27=this;return new BPromise(function(_0x2171e6,_0x20bcc2){delete _0x56fc27[_0xce48('0x23')][_0x49191a[_0xce48('0xe5')]];_0x56fc27[_0xce48('0xd1')](_0x56fc27[_0xce48('0xe1')][_0x369e51['queue']]);_0x56fc27[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]][_0xce48('0xe6')]+=0x1;_0x56fc27['voiceQueues'][_0x369e51['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x1e9d4b=_0x56fc27[_0xce48('0xe1')][_0x369e51[_0xce48('0xb4')]];var _0x5a33e4=new Hangup(_0x369e51,_0x49191a);_0x5a33e4[_0xce48('0xa6')]=0x13;_0x5a33e4['statedesc']=_0xce48('0xed');_0x5a33e4['membername']=_0xce48('0xee');_0x5a33e4[_0xce48('0xef')]+=0x1;_0x5a33e4[_0xce48('0xf0')]+=0x1;_0x5a33e4[_0xce48('0xeb')]=!![];ami['emit'](_0xce48('0xf1'),ut[_0xce48('0xea')](_0x5a33e4,_0xce48('0xeb')));_0x56fc27[_0xce48('0xcc')](_0x5a33e4)['catch'](loggerCatch(_0xce48('0xf2')));if(_0x5a33e4['countbusyretry']+_0x5a33e4[_0xce48('0xf3')]+_0x5a33e4[_0xce48('0xf4')]+_0x5a33e4['countnosuchnumberretry']+_0x5a33e4[_0xce48('0xf5')]+_0x5a33e4['countabandonedretry']+_0x5a33e4['countmachineretry']+_0x5a33e4[_0xce48('0xf6')]>=_0x1e9d4b[_0xce48('0xf7')]){_0x56fc27[_0xce48('0xf8')](_0x5a33e4,_0x2171e6,_0x20bcc2,'reason19\x20machine....');}else{if(_0x5a33e4[_0xce48('0xef')]>=_0x1e9d4b[_0xce48('0xf9')]){_0x56fc27[_0xce48('0xfa')](_0x5a33e4,_0x2171e6,_0x20bcc2,_0xce48('0xfb'));}else{_0x56fc27[_0xce48('0xbf')]({'active':![],'countmachineretry':_0x5a33e4[_0xce48('0xef')],'scheduledat':moment()[_0xce48('0xfc')](_0x1e9d4b[_0xce48('0xfd')],_0xce48('0xfe'))[_0xce48('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a33e4[_0xce48('0xd3')],'ListId':_0x5a33e4[_0xce48('0xd4')],'VoiceQueueId':_0x5a33e4['VoiceQueueId']||undefined,'CampaignId':_0x5a33e4[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch('[rescheduleContact][Machine]'));_0x2171e6({'reschedule':0x1});}}});}if(_0x369e51[_0xce48('0x74')]===_0xce48('0x75')&&this[_0xce48('0x1d')][_0x369e51['queue']][_0xce48('0xe2')]&&_0x49191a['value']===_0xce48('0xe4')){delete this[_0xce48('0x23')][_0x49191a['uniqueid']];this[_0xce48('0xd1')](this['campaigns'][_0x369e51[_0xce48('0xb4')]]);_0x24e56d=new Hangup(_0x369e51,_0x49191a);_0x24e56d[_0xce48('0xa6')]=0x12;_0x24e56d[_0xce48('0xe7')]=_0xce48('0xe8');_0x24e56d['membername']=_0xce48('0xee');ami['emit']('custom:amd',ut[_0xce48('0xea')](_0x24e56d,_0xce48('0xeb')));this[_0xce48('0xdf')](_0x24e56d,_0xce48('0xff'),_0xce48('0x100'));}if(_0x369e51['type']==='ivr'&&this[_0xce48('0x1d')][_0x369e51[_0xce48('0xb4')]]['dialAMDActive']&&_0x49191a[_0xce48('0xe3')]===_0xce48('0x101')){var _0x56fc27=this;return new BPromise(function(_0x20ce21,_0x2fc924){delete _0x56fc27[_0xce48('0x23')][_0x49191a[_0xce48('0xe5')]];_0x56fc27['updateOriginated'](_0x56fc27[_0xce48('0x1d')][_0x369e51[_0xce48('0xb4')]]);_0x56fc27[_0xce48('0x1d')][_0x369e51[_0xce48('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x56fc27[_0xce48('0x1d')][_0x369e51[_0xce48('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x46b6f8=_0x56fc27[_0xce48('0x1d')][_0x369e51[_0xce48('0xb4')]];var _0x48ced2=new Hangup(_0x369e51,_0x49191a);_0x48ced2[_0xce48('0xa6')]=0x13;_0x48ced2[_0xce48('0xe7')]=_0xce48('0xed');_0x48ced2[_0xce48('0xe9')]=_0xce48('0xee');_0x48ced2['countmachineretry']+=0x1;_0x48ced2[_0xce48('0xf0')]+=0x1;_0x48ced2[_0xce48('0xeb')]=!![];ami['emit'](_0xce48('0xf1'),ut['buildObj'](_0x48ced2,_0xce48('0xeb')));_0x56fc27[_0xce48('0xcc')](_0x48ced2)[_0xce48('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x48ced2[_0xce48('0x102')]+_0x48ced2[_0xce48('0xf3')]+_0x48ced2[_0xce48('0xf4')]+_0x48ced2[_0xce48('0x103')]+_0x48ced2[_0xce48('0xf5')]+_0x48ced2[_0xce48('0x104')]+_0x48ced2['countmachineretry']+_0x48ced2[_0xce48('0xf6')]>=_0x46b6f8[_0xce48('0xf7')]){_0x56fc27[_0xce48('0xf8')](_0x48ced2,_0x20ce21,_0x2fc924,'reason19\x20machine....');}else{if(_0x48ced2[_0xce48('0xef')]>=_0x46b6f8[_0xce48('0xf9')]){_0x56fc27[_0xce48('0xfa')](_0x48ced2,_0x20ce21,_0x2fc924,_0xce48('0xfb'));}else{_0x56fc27[_0xce48('0xbf')]({'active':![],'countmachineretry':_0x48ced2[_0xce48('0xef')],'scheduledat':moment()[_0xce48('0xfc')](_0x46b6f8[_0xce48('0xfd')],'minutes')[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x48ced2[_0xce48('0xd3')],'ListId':_0x48ced2[_0xce48('0xd4')],'VoiceQueueId':_0x48ced2[_0xce48('0xd6')]||undefined,'CampaignId':_0x48ced2['CampaignId']||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x106')));_0x20ce21({'reschedule':0x1});}}});}}};Dialer[_0xce48('0x18')][_0xce48('0x107')]=function(_0x3b7d66){var _0x3986b0=this[_0xce48('0x23')][_0x3b7d66['uniqueid']];var _0x890413=this;var _0x580d83;if(_0x3986b0&&_0x3986b0[_0xce48('0x74')]===_0xce48('0x75')){delete this[_0xce48('0x23')][_0x3b7d66[_0xce48('0xe5')]];this[_0xce48('0xd1')](this[_0xce48('0x1d')][_0x3986b0[_0xce48('0xb4')]]);this[_0xce48('0x1d')][_0x3986b0[_0xce48('0xb4')]][_0xce48('0x108')]+=0x1;_0x580d83=new Hangup(_0x3986b0,_0x3b7d66);this[_0xce48('0xcc')](_0x580d83)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xce48('0xca')](_0x580d83)[_0xce48('0xb2')](loggerCatch(_0xce48('0x109')));}if(_0x3986b0&&_0x3986b0[_0xce48('0x74')]!==_0xce48('0x75')&&isNotNull(this[_0xce48('0xe1')][_0x3986b0[_0xce48('0xb4')]][_0xce48('0x10a')])){delete this[_0xce48('0x23')][_0x3b7d66['uniqueid']];this[_0xce48('0xd1')](this[_0xce48('0xe1')][_0x3986b0['queue']]);this['voiceQueues'][_0x3986b0[_0xce48('0xb4')]][_0xce48('0xe6')]+=0x1;this['voiceQueues'][_0x3986b0[_0xce48('0xb4')]][_0xce48('0x58')]+=0x1;_0x580d83=new Hangup(_0x3986b0,_0x3b7d66);_0x580d83[_0xce48('0xa6')]=0x10;_0x580d83[_0xce48('0xe7')]=_0xce48('0x10b');_0x580d83[_0xce48('0xe9')]=_0xce48('0x10c');this[_0xce48('0xcc')](_0x580d83)[_0xce48('0xb2')](loggerCatch(_0xce48('0x10d')));this[_0xce48('0xca')](_0x580d83)[_0xce48('0xb2')](loggerCatch('[syncHangupIvr]'));}if(_0x3986b0&&_0x3986b0[_0xce48('0x74')]!=='ivr'&&!isNotNull(this[_0xce48('0xe1')][_0x3986b0[_0xce48('0xb4')]][_0xce48('0x10a')])){delete this[_0xce48('0x23')][_0x3b7d66[_0xce48('0xe5')]];this[_0xce48('0xd1')](this['voiceQueues'][_0x3986b0['queue']]);this[_0xce48('0xe1')][_0x3986b0[_0xce48('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x580d83=new Hangup(_0x3986b0,_0x3b7d66);_0x580d83[_0xce48('0xa6')]=0xc;_0x580d83[_0xce48('0xe7')]=_0x3b7d66[_0xce48('0x10e')];_0x580d83[_0xce48('0xe9')]='Unknow';this[_0xce48('0xcc')](_0x580d83)[_0xce48('0xb2')](loggerCatch(_0xce48('0x10d')));this[_0xce48('0xca')](_0x580d83)[_0xce48('0xb2')](loggerCatch(_0xce48('0x109')));}};Dialer['prototype'][_0xce48('0x2e')]=function(_0x48813f){var _0x59f697=this[_0xce48('0x23')][_0x48813f[_0xce48('0xe5')]];var _0x21cfa3=this;if(this['voiceQueues'][_0x48813f[_0xce48('0xb4')]]){if(_0x59f697&&_0x59f697[_0xce48('0x74')]!==_0xce48('0x75')){delete this['uniqueId'][_0x48813f[_0xce48('0xe5')]];this[_0xce48('0xe1')][_0x48813f[_0xce48('0xb4')]]['outboundAnswerCallsDay']+=0x1;var _0x43e20c=new AgentComplete(_0x59f697,_0x48813f);if(_0x48813f[_0xce48('0x10f')]===_0xce48('0x110')){_0x43e20c[_0xce48('0x111')]=this[_0xce48('0xe1')][_0x48813f[_0xce48('0xb4')]][_0xce48('0x112')]&&this[_0xce48('0xe1')][_0x48813f[_0xce48('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0xce48('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xce48('0xcc')](_0x43e20c)[_0xce48('0xb2')](loggerCatch(_0xce48('0x113')));this[_0xce48('0xca')](_0x43e20c)[_0xce48('0xb2')](loggerCatch(_0xce48('0x114')));}}};Dialer[_0xce48('0x18')][_0xce48('0x115')]=function(_0x9b516a){if(this['voiceQueues'][_0x9b516a[_0xce48('0xb4')]]){if(this[_0xce48('0x23')][_0x9b516a[_0xce48('0xe5')]]&&this[_0xce48('0x23')][_0x9b516a[_0xce48('0xe5')]][_0xce48('0x74')]!==_0xce48('0x75')){this['updateOriginated'](this['voiceQueues'][_0x9b516a[_0xce48('0xb4')]]);this[_0xce48('0x23')][_0x9b516a[_0xce48('0xe5')]]['answertime']=moment()[_0xce48('0x71')](_0xce48('0x105'));}}};Dialer[_0xce48('0x18')][_0xce48('0x116')]=function(_0x5b69da){this['createHistory'](_0x5b69da)[_0xce48('0xb2')](loggerCatch(_0xce48('0x113')));this[_0xce48('0xca')](_0x5b69da)[_0xce48('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xce48('0x18')][_0xce48('0x2b')]=function(_0x54e9ea){var _0x516917=this[_0xce48('0x23')][_0x54e9ea['uniqueid']];var _0x4bfb25=this;if(this['voiceQueues'][_0x54e9ea[_0xce48('0xb4')]]){if(_0x516917&&_0x516917[_0xce48('0x74')]!==_0xce48('0x75')){delete this['uniqueId'][_0x54e9ea[_0xce48('0xe5')]];this[_0xce48('0xd1')](this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]]);_0x516917[_0xce48('0x117')]=moment()[_0xce48('0x71')](_0xce48('0x105'));var _0x50938d=new QueueCallerAbandon(_0x516917,_0x54e9ea);if(getSeconds(_0x516917[_0xce48('0x117')],_0x516917[_0xce48('0x118')])>=_0x516917['dialQueueTimeout']){this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]][_0xce48('0x64')]+=0x1;this['voiceQueues'][_0x54e9ea[_0xce48('0xb4')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x54e9ea[_0xce48('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x50938d[_0xce48('0xa6')]=0xa;_0x50938d[_0xce48('0xe7')]=_0xce48('0x119');_0x50938d[_0xce48('0x11a')]=_0xce48('0x11b');_0x50938d['agiafterat']=this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]]['dialQueueProject2']?moment()[_0xce48('0x71')](_0xce48('0x105')):undefined;_0x50938d['countdropretry']+=0x1;_0x50938d['countglobal']+=0x1;if(_0x50938d[_0xce48('0xf5')]>=this[_0xce48('0xe1')][_0x54e9ea['queue']][_0xce48('0x11c')]){this[_0xce48('0x116')](_0x50938d);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x50938d[_0xce48('0xf5')],'scheduledat':moment()['add'](this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]]['dialDropRetryFrequency'],_0xce48('0xfe'))[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x516917['ContactId'],'ListId':_0x516917[_0xce48('0xd4')],'VoiceQueueId':_0x516917[_0xce48('0xd6')]||undefined,'CampaignId':_0x516917['CampaignId']||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x11d')));var _0x29695f=new History(_0x50938d);_0x29695f[_0xce48('0xa6')]=0xa;_0x29695f[_0xce48('0xe7')]=_0xce48('0x119');_0x29695f['starttime']=moment()[_0xce48('0x71')](_0xce48('0x105'));_0x29695f[_0xce48('0xa7')]=_0x29695f[_0xce48('0xa8')];_0x29695f[_0xce48('0x11e')]=_0x50938d[_0xce48('0x11e')];_0x29695f[_0xce48('0x11f')]=_0x50938d[_0xce48('0x11f')];this[_0xce48('0xcc')](_0x29695f)[_0xce48('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xce48('0xe1')][_0x54e9ea['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x54e9ea['queue']][_0xce48('0x5a')]+=0x1;_0x50938d[_0xce48('0xa6')]=0xb;_0x50938d[_0xce48('0xe7')]=_0xce48('0x120');_0x50938d[_0xce48('0x11a')]=_0xce48('0x121');_0x50938d['countabandonedretry']+=0x1;_0x50938d[_0xce48('0xf0')]+=0x1;if(_0x50938d[_0xce48('0x104')]>=this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]][_0xce48('0x122')]){this[_0xce48('0x116')](_0x50938d);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x50938d['countabandonedretry'],'scheduledat':moment()[_0xce48('0xfc')](this[_0xce48('0xe1')][_0x54e9ea[_0xce48('0xb4')]]['dialAbandonedRetryFrequency'],_0xce48('0xfe'))[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x516917[_0xce48('0xd3')],'ListId':_0x516917['ListId'],'VoiceQueueId':_0x516917['VoiceQueueId']||undefined,'CampaignId':_0x516917[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x123')));var _0x29695f=new History(_0x50938d);_0x29695f['state']=0xb;_0x29695f[_0xce48('0xe7')]=_0xce48('0x120');_0x29695f['starttime']=moment()['format'](_0xce48('0x105'));_0x29695f[_0xce48('0xa7')]=_0x29695f[_0xce48('0xa8')];_0x29695f['calleridname']=_0x50938d['calleridname'];_0x29695f[_0xce48('0x11f')]=_0x50938d[_0xce48('0x11f')];this['createHistory'](_0x29695f)[_0xce48('0xb2')](loggerCatch(_0xce48('0x124')));}}}}};Dialer[_0xce48('0x18')][_0xce48('0x125')]=function(_0x34ad5e){if(this[_0xce48('0x21')][_0x34ad5e[_0xce48('0xe5')]]){this[_0xce48('0x21')][_0x34ad5e[_0xce48('0xe5')]][_0xce48('0xb1')]=_0x34ad5e['channel'];}if(this[_0xce48('0x23')][_0x34ad5e[_0xce48('0xe5')]]){this[_0xce48('0x23')][_0x34ad5e[_0xce48('0xe5')]][_0xce48('0xb1')]=_0x34ad5e[_0xce48('0xb1')];}};Dialer[_0xce48('0x18')][_0xce48('0x33')]=function(_0x359652){if(strategy[this[_0xce48('0xe1')][this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]][_0xce48('0xb4')]]['strategy']]===_0xce48('0x127')){if(this['actions'][_0x359652[_0xce48('0x126')]]&&_[_0xce48('0xae')](this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]]['locked'])&&_0x359652[_0xce48('0xb0')]==='1'&&_0x359652['paused']==='0'){if(this[_0xce48('0x1e')][_0x359652[_0xce48('0x128')]]){if(!this[_0xce48('0x1e')][_0x359652[_0xce48('0x128')]][_0xce48('0x129')]){this[_0xce48('0x1e')][_0x359652['stateinterface']][_0xce48('0x129')]=!![];this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]][_0xce48('0x129')]=!![];this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]][_0xce48('0x128')]=_0x359652[_0xce48('0x128')];}}}}else if((strategy[this['voiceQueues'][this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]][_0xce48('0xb4')]]['strategy']]||_0xce48('0x17'))==='rrmemory'){if(this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]]){if(this[_0xce48('0x1e')][_0x359652['stateinterface']]){this[_0xce48('0x21')][_0x359652['actionid']][_0xce48('0x128')]=_0x359652['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]]['queue']])){this[_0xce48('0x27')][this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]]['queue']]=[];}this['queueBooked'][this[_0xce48('0x21')][_0x359652[_0xce48('0x126')]][_0xce48('0xb4')]][_0xce48('0x12a')](_[_0xce48('0x8a')](_[_0xce48('0x12b')](this['actions'][_0x359652[_0xce48('0x126')]],[_0xce48('0x12c'),_0xce48('0x128')]),{'status':_0x359652[_0xce48('0xb0')],'paused':_0x359652[_0xce48('0x12d')]}));}}}};function unlockQueueStatus(_0x410c9c,_0x1eeaef){setTimeout(function(){if(_[_0xce48('0x81')](_0x410c9c[_0xce48('0x12e')])){loggerBooked[_0xce48('0x94')](_0xce48('0x12f'),_0x1eeaef);}_0x410c9c['queueStatusComplete']=!![];loggerBooked['info'](_0xce48('0x130'),_0x1eeaef,JSON[_0xce48('0x45')](_[_0xce48('0x12b')](_0x410c9c,[_0xce48('0x3c'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xce48('0x18')][_0xce48('0x35')]=function(_0x121883){var _0x506b78=this;var _0x34b3d4=_0x506b78[_0xce48('0xe1')][_0x506b78[_0xce48('0x21')][_0x121883['actionid']]['queue']];if(strategy[this[_0xce48('0xe1')][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]['strategy']]===_0xce48('0x127')){if(this[_0xce48('0x21')][_0x121883['actionid']]&&this[_0xce48('0x21')][_0x121883['actionid']][_0xce48('0x128')]){this['preview']['run'](this[_0xce48('0x21')][_0x121883['actionid']][_0xce48('0x12c')],this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0x128')])[_0xce48('0xb2')](function(_0x56d1d5){logger[_0xce48('0x94')](_0xce48('0x131'),util['inspect'](_0x56d1d5,{'showHidden':![],'depth':null}));})[_0xce48('0x1a')](function(){_0x506b78['updateOriginated'](_0x506b78[_0xce48('0xe1')][_0x506b78['actions'][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]);_0x506b78['agents'][_0x506b78[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0x128')]]['locked']=![];delete _0x506b78[_0xce48('0x21')][_0x121883[_0xce48('0x126')]];unlockQueueStatus(_0x34b3d4);});}else{this['updateOriginated'](this[_0xce48('0xe1')][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]]['queue']]);this[_0xce48('0xbf')]({'active':![],'ContactId':this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0xd3')],'ListId':this['actions'][_0x121883[_0xce48('0x126')]]['ListId'],'VoiceQueueId':this['actions'][_0x121883['actionid']][_0xce48('0xd6')]||undefined,'CampaignId':this[_0xce48('0x21')][_0x121883['actionid']][_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]];unlockQueueStatus(_0x34b3d4);}}else if((strategy[this[_0xce48('0xe1')][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]]['queue']]['strategy']]||'rrmemory')===_0xce48('0x17')){var _0x1b9f0e;if(this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]]&&!_['isEmpty'](this['queueBooked'][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]])){if(this[_0xce48('0x28')][_0x506b78[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]){this[_0xce48('0x28')][_0x506b78['actions'][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]=this['queueBookedRR'][this[_0xce48('0x21')][_0x121883['actionid']][_0xce48('0xb4')]]?this[_0xce48('0x28')][this['actions'][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]:this['queueBooked'][this['actions'][_0x121883[_0xce48('0x126')]]['queue']]?this[_0xce48('0x27')][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]][_0xce48('0xb4')]]['_rr']||0x0:0x0;}this[_0xce48('0x27')][this[_0xce48('0x21')][_0x121883[_0xce48('0x126')]]['queue']][_0xce48('0x132')]=this[_0xce48('0x28')][this[_0xce48('0x21')][_0x121883['actionid']]['queue']];for(var _0x553436=0x0;_0x553436=0x0;})['catch'](myreject(_0x242bf5)));}}else{_0x592f05[_0xce48('0x12a')](ami[_0xce48('0xaf')]({'action':_0xce48('0x14a'),'command':util[_0xce48('0x71')](_0xce48('0x14b'),_0x200c0d,!_['isUndefined'](config[_0xce48('0x146')][_0x53b458])?_0x53b458:'')})['then'](function(_0x274230){return _0x274230['content'][_0xce48('0x14c')](_0xce48('0x14d'))>=0x0;})[_0xce48('0xb2')](myreject(_0x242bf5)));}BPromise[_0xce48('0x14e')](_0x592f05)[_0xce48('0x38')](function(_0xdc770){var _0x583131=_[_0xce48('0x14f')](_0xdc770);if(_0x583131){return _0x592229(_0x583131);}else{_0x39c117[_0xce48('0x3a')]=_0x5c5771?_0xce48('0x150'):'INTERVAL_IS_OVERTIME';return _0x242bf5(msgResponse(_0xce48('0x151'),_0xce48('0x145'),_0xce48('0x152')+_0x5c5771+'\x20'+_0x3a0293+'\x20Interval\x20is\x20overtime:\x20'+util[_0xce48('0x95')](_0x200c0d,{'showHidden':![],'depth':null})+_0xce48('0x153')+_0x53b458));}})[_0xce48('0xb2')](function(_0x5ee5c5){return _0x242bf5(msgResponse('ifTime',_0xce48('0x145'),JSON[_0xce48('0x45')](_0x5ee5c5)));});});};Dialer[_0xce48('0x18')][_0xce48('0x154')]=function(_0x2b8aab){var _0x3333d0=this;return function(){switch(_0x2b8aab[_0xce48('0x155')]){case _0xce48('0x156'):freeVariablesPredictive(_0x2b8aab);_0x3333d0['handlePower'](_0x2b8aab,0x1);break;case _0xce48('0x157'):freeVariablesPredictive(_0x2b8aab);_0x3333d0[_0xce48('0x158')](_0x2b8aab,_0x2b8aab[_0xce48('0x159')]);break;case _0xce48('0x9'):_0x3333d0[_0xce48('0x9')](_0x2b8aab);break;case _0xce48('0x15a'):freeVariablesPredictive(_0x2b8aab);_0x3333d0[_0xce48('0x158')](_0x2b8aab,0x1);break;default:freeVariablesPredictive(_0x2b8aab);logger[_0xce48('0x94')]('Queue',_0x2b8aab['name'],'method\x20not\x20recognized');}};};Dialer[_0xce48('0x18')][_0xce48('0x15b')]=function(_0x3a4cde){return BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](cmHopper[_0xce48('0x15c')](_0x3a4cde['id'],previewRecallmeReminderInterval))[_0xce48('0x38')](function(_0x2947ff){for(var _0x379604=0x0;_0x379604<_0x2947ff[_0xce48('0x97')];_0x379604++){var _0x5bd59f=_0x2947ff[_0x379604][_0xce48('0x15d')][_0xce48('0x3c')];if(_0x5bd59f)io['to'](util[_0xce48('0x71')](_0xce48('0x15e'),_0x5bd59f))[_0xce48('0x48')](_0xce48('0x15f'),{'hopper':_0x2947ff[_0x379604]});}})[_0xce48('0xb2')](function(_0x4d5a37){});};Dialer['prototype'][_0xce48('0x160')]=function(_0x4e6d69){var _0x3dafc0=this;return function(){_0x3dafc0[_0xce48('0x161')](_0x4e6d69);};};Dialer[_0xce48('0x18')]['syncQueueSummary']=function(_0x16db57){var _0x598b4=this;if(isNotPreview(_0x16db57['dialMethod'])){if(isVoiceQueueOutbound(_0x16db57[_0xce48('0x74')])&&isActive(_0x16db57[_0xce48('0x54')])){_0x16db57[_0xce48('0xa3')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x16db57,_0x16db57[_0xce48('0x4d')]))[_0xce48('0x38')](checkIsActive(_0x16db57,_0x16db57['dialActive']))[_0xce48('0x38')](checkInterval(_0x16db57))['then'](_0x598b4[_0xce48('0x162')](_0x16db57))['then'](_0x598b4['checkIfTime'](_0x16db57[_0xce48('0x163')],_0x16db57['dialTimezone'],_0x16db57[_0xce48('0x3c')],_0x16db57))[_0xce48('0x38')](_0x598b4[_0xce48('0x141')](_0x16db57[_0xce48('0x3f')],_0x16db57[_0xce48('0x164')],_0x16db57[_0xce48('0x3c')],_0x16db57))['then'](_0x598b4[_0xce48('0x154')](_0x16db57))[_0xce48('0xb2')](loggerCatchQueueSummary(_0xce48('0x165'),_0x16db57));}else{notSendMessagesQueue(_0x16db57);}}else{freeVariablesPredictive(_0x16db57);if(_0x16db57[_0xce48('0x166')]){_0x598b4[_0xce48('0x15b')](_0x16db57);}}};Dialer[_0xce48('0x18')]['syncCampaigns']=function(){var _0x470795=this;var _0x30fe50;for(var _0x431ea6 in this[_0xce48('0x1d')]){if(typeof this[_0xce48('0x1d')][_0x431ea6]!==_0xce48('0xac')){_0x30fe50=this['campaigns'][_0x431ea6];if(isCampaignIvr(_0x30fe50[_0xce48('0x74')])&&isActive(_0x30fe50[_0xce48('0x6f')])){_0x30fe50[_0xce48('0xa3')]=!![];BPromise[_0xce48('0xb7')]()[_0xce48('0x38')](checkIsActive(_0x30fe50,_0x30fe50[_0xce48('0x6f')]))[_0xce48('0x38')](checkInterval(_0x30fe50))[_0xce48('0x38')](_0x470795[_0xce48('0x162')](_0x30fe50))[_0xce48('0x38')](_0x470795[_0xce48('0x167')](_0x30fe50[_0xce48('0x163')],_0x30fe50[_0xce48('0x164')],_0x30fe50[_0xce48('0x3c')],_0x30fe50))['then'](_0x470795[_0xce48('0x141')](_0x30fe50[_0xce48('0x3f')],_0x30fe50[_0xce48('0x164')],_0x30fe50['name'],_0x30fe50))['then'](_0x470795[_0xce48('0x160')](_0x30fe50))[_0xce48('0xb2')](loggerCatchQueueSummary('[syncCampaigns]',_0x30fe50));}else{notSendMessagesCampaign(_0x30fe50);}}}};function getCallerIdRandom(_0xb6b2f6,_0x4ccdd7){var _0xe5626d;var _0x2ad2d6;var _0x769f57;if(_0x4ccdd7<=0x0){_0x4ccdd7=0x1;}_0xe5626d=new RegExp('\x5cw{0,'+_0x4ccdd7+'}$');_0x2ad2d6=Math[_0xce48('0x168')](0xa,_0x4ccdd7-0x1);_0x769f57=Math[_0xce48('0x168')](0xa,_0x4ccdd7)-0x1;return util[_0xce48('0x71')]('%s',_['replace'](_0xb6b2f6,_0xe5626d,_[_0xce48('0x169')](_0x2ad2d6,_0x769f57)));}function extractCalleridName(_0x3b75a0){var _0x1d78c9=_0x3b75a0['match'](/"(.*?)"/);return _0x1d78c9?_0x1d78c9[0x1]:_0x3b75a0;}function extractCalleridNumber(_0x5728a1){var _0x9c6a40=_0x5728a1[_0xce48('0x16a')](/<(.*?)>/);return _0x9c6a40?_0x9c6a40[0x1]:_0x5728a1;}Dialer[_0xce48('0x18')][_0xce48('0x16b')]=function(_0x493bdf,_0x12657b){var _0x21c613=this;var _0x1a6c61=uuid['v4']();this[_0xce48('0x21')][_0x1a6c61]=new Action(_0x493bdf,_0x12657b,_0x1a6c61);return new BPromise(function(_0x3f755a,_0x578ea0){if(_['isUndefined'](_0x493bdf)&&typeof _0x493bdf!==_0xce48('0x16c')){return _0x578ea0(msgResponse(_0xce48('0x16d'),_0xce48('0x145'),'voiceQueue\x20is\x20undefine'));}if(_[_0xce48('0x81')](_0x12657b['Contact'][_0xce48('0x16e')])||_0x12657b[_0xce48('0x16f')]['phone']===null){return _0x578ea0(msgResponse(_0xce48('0x16d'),_0xce48('0x145'),_0xce48('0x170')));}var _0x346d2f={'XMD-CALLERID':_0x21c613[_0xce48('0x21')][_0x1a6c61][_0xce48('0x171')](),'XMD-AGI':_0x493bdf[_0xce48('0x10a')]?util[_0xce48('0x71')](_0xce48('0x172'),ipAgi,_0x493bdf[_0xce48('0x10a')]):_0xce48('0x173'),'XMD-AGIAFTER':_0x493bdf['dialQueueProject2']?util[_0xce48('0x71')](_0xce48('0x172'),ipAgi,_0x493bdf[_0xce48('0x112')]):'NONE','XMD-QUEUE':_0x493bdf[_0xce48('0x74')]===_0xce48('0x49')?util[_0xce48('0x71')](_0xce48('0x174'),_0x493bdf[_0xce48('0x3c')],_0x493bdf[_0xce48('0x175')]||'',_0x493bdf[_0xce48('0x176')]?'c':'',_0x493bdf['dialQueueTimeout']||0x3):_0xce48('0x173'),'XMD-CONTACTID':_0x12657b['ContactId'],'XMD-CDRTYPE':_0xce48('0x8'),'CALLERID(all)':_0x21c613[_0xce48('0x21')][_0x1a6c61][_0xce48('0x171')](),'XMD-AMD':_0x493bdf['dialAMDActive']?_0xce48('0x177'):_0xce48('0x173'),'XMD-DESTINATION':_0xce48('0x178')};if(_0x493bdf['dialAMDActive']){_0x346d2f['XMD-AMDINITIALSILENCE']=_0x493bdf[_0xce48('0x179')]||0x9c4;_0x346d2f[_0xce48('0x17a')]=_0x493bdf[_0xce48('0x17b')]||0x5dc;_0x346d2f[_0xce48('0x17c')]=_0x493bdf['dialAMDAfterGreetingSilence']||0x320;_0x346d2f[_0xce48('0x17d')]=_0x493bdf['dialAMDTotalAnalysisTime']||0x1388;_0x346d2f[_0xce48('0x17e')]=_0x493bdf[_0xce48('0x17f')]||0x64;_0x346d2f[_0xce48('0x180')]=_0x493bdf['dialAMDBetweenWordsSilence']||0x32;_0x346d2f[_0xce48('0x181')]=_0x493bdf['dialAMDMaximumNumberOfWords']||0x3;_0x346d2f[_0xce48('0x182')]=_0x493bdf[_0xce48('0x183')]||0x100;_0x346d2f[_0xce48('0x184')]=_0x493bdf[_0xce48('0x185')]||0x1388;}if(_0x493bdf[_0xce48('0x74')]===_0xce48('0x49')){_0x346d2f[_0xce48('0x186')]=_0x12657b[_0xce48('0xd6')];}else{_0x346d2f[_0xce48('0x187')]=_0x12657b[_0xce48('0xd7')];}for(var _0x55f76c in _0x12657b[_0xce48('0x16f')]){if(typeof _0x12657b[_0xce48('0x16f')][_0x55f76c]!=='undefined'){if(isNotNull(_0x12657b[_0xce48('0x16f')][_0x55f76c])&&_0x55f76c!=='id'&&_0x55f76c!==_0xce48('0x188')&&_0x55f76c!=='createdAt'&&_0x55f76c!==_0xce48('0x189')){_0x346d2f[util[_0xce48('0x71')](_0xce48('0x18a'),'XMD-',_[_0xce48('0x18b')](_0x55f76c))]=_0x12657b['Contact'][_0x55f76c];}}}var _0x3a74c8=_0x21c613['isTrunkReachable'](_0x493bdf[_0xce48('0x6e')])?getCallerId(_0x493bdf['Trunk'][_0xce48('0x70')],_0x493bdf[_0xce48('0x55')],_0x493bdf[_0xce48('0x18c')]>0x0?getCallerIdRandom(_0x493bdf[_0xce48('0x56')],_0x493bdf[_0xce48('0x18c')]):_0x493bdf[_0xce48('0x56')]):getCallerId(_[_0xce48('0xae')](_0x493bdf[_0xce48('0x18d')])?_0x493bdf[_0xce48('0x6e')]['callerid']:_0x493bdf[_0xce48('0x18d')]['callerid'],_0x493bdf[_0xce48('0x55')],_0x493bdf[_0xce48('0x18c')]>0x0?getCallerIdRandom(_0x493bdf[_0xce48('0x56')],_0x493bdf['dialRandomLastDigitCallerIdNumber']):_0x493bdf[_0xce48('0x56')]);if(_0x3a74c8){_0x346d2f[_0xce48('0x18e')]=_0x21c613[_0xce48('0x21')][_0x1a6c61][_0xce48('0x18f')]=extractCalleridName(_0x3a74c8);_0x346d2f['XMD-ORIGINATECALLERIDNUM']=_0x21c613[_0xce48('0x21')][_0x1a6c61][_0xce48('0x190')]=extractCalleridNumber(_0x3a74c8);}return ami[_0xce48('0xaf')]({'actionid':_0x1a6c61,'action':_0xce48('0x16d'),'channel':_0x21c613[_0xce48('0x13f')](_0x493bdf[_0xce48('0x6e')])?util[_0xce48('0x71')](_0xce48('0x191'),_0x493bdf[_0xce48('0x6e')][_0xce48('0x3c')],isNotNull(_0x493bdf[_0xce48('0x192')])?_0x493bdf['dialPrefix'][_0xce48('0x193')]()||'':'',_0x493bdf[_0xce48('0x194')]>0x0?_0x12657b['Contact'][_0xce48('0x16e')][_0xce48('0x195')](_0x493bdf['dialCutDigit']):_0x12657b[_0xce48('0x16f')][_0xce48('0x16e')]):util[_0xce48('0x71')]('SIP/%s/%s%s',_[_0xce48('0xae')](_0x493bdf[_0xce48('0x18d')])?_0x493bdf[_0xce48('0x6e')][_0xce48('0x3c')]:_0x493bdf[_0xce48('0x18d')]['name'],isNotNull(_0x493bdf[_0xce48('0x192')])?_0x493bdf['dialPrefix']['trim']()||'':'',_0x493bdf[_0xce48('0x194')]>0x0?_0x12657b['Contact']['phone'][_0xce48('0x195')](_0x493bdf[_0xce48('0x194')]):_0x12657b['Contact'][_0xce48('0x16e')]),'callerid':_0x3a74c8,'Exten':_0xce48('0x178'),'Context':'from-sip','Priority':'1','variable':_0x346d2f,'timeout':(_0x493bdf[_0xce48('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a6c61})[_0xce48('0x38')](function(_0x27d13d){return _0x3f755a(_0x27d13d);})[_0xce48('0xb2')](function(_0x1f74da){_0x493bdf['outboundOriginateFailureCallsDay']+=0x1;var _0x573591=new History(_0x21c613[_0xce48('0x21')][_0x1a6c61]);logger[_0xce48('0x94')](util[_0xce48('0x71')](_0xce48('0x196'),JSON['stringify'](_0x1f74da)));_0x573591[_0xce48('0xa6')]=0xe;_0x573591[_0xce48('0xe7')]=_0xce48('0x197');_0x573591[_0xce48('0xa8')]=moment()[_0xce48('0x71')](_0xce48('0x105'));_0x573591[_0xce48('0xa7')]=_0x573591[_0xce48('0xa8')];_0x21c613[_0xce48('0xcc')](_0x573591)[_0xce48('0xb2')](loggerCatch(_0xce48('0x198')));_0x21c613[_0xce48('0xca')](_0x573591)[_0xce48('0xb2')](loggerCatch(_0xce48('0x198')))[_0xce48('0x1a')](function(){delete _0x21c613[_0xce48('0x21')][_0x1a6c61];return _0x578ea0(msgResponse(_0xce48('0x16d'),'Error',_0xce48('0x199')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x150745){var _0x2057b7=this[_0xce48('0x21')][_0x150745[_0xce48('0x126')]];if(_0x2057b7){delete this[_0xce48('0x21')][_0x150745[_0xce48('0x126')]];_0x2057b7[_0xce48('0x118')]=moment()[_0xce48('0x71')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4ff492=_0x2057b7[_0xce48('0x74')]==='ivr'?this['campaigns'][_0x2057b7['queue']]:this[_0xce48('0xe1')][_0x2057b7['getQueue']()];if(!this['isSuccess'](_0x150745[_0xce48('0x19a')])){this['updateOriginated'](_0x4ff492);return this['callProgressDetecting'](_0x2057b7,_0x4ff492,_0x150745)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xce48('0x23')][_0x150745[_0xce48('0xe5')]]=_0x2057b7;}};Dialer[_0xce48('0x18')]['checkRetriveMax']=function(_0x2e29c9,_0x1f7a33,_0xea9dc8){var _0x4b35f6=new History(_0x1f7a33);if(_0x4b35f6['countbusyretry']+_0x4b35f6['countcongestionretry']+_0x4b35f6['countnoanswerretry']+_0x4b35f6['countnosuchnumberretry']+_0x4b35f6['countdropretry']+_0x4b35f6[_0xce48('0x104')]+_0x4b35f6[_0xce48('0xef')]+_0x4b35f6['countagentrejectretry']>=_0xea9dc8[_0xce48('0xf7')]-0x1){return!![];}switch(_0x2e29c9){case 0x3:if(_0x4b35f6['countnoanswerretry']>=_0xea9dc8[_0xce48('0x19b')]-0x1){return!![];}this[_0xce48('0xbf')]({'active':![],'countnoanswerretry':_0x4b35f6[_0xce48('0xf4')]+=0x1,'scheduledat':moment()['add'](_0xea9dc8[_0xce48('0x19c')],'minutes')[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6['ListId'],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})['catch'](loggerCatch(_0xce48('0x19d')));break;case 0x5:if(_0x4b35f6['countbusyretry']>=_0xea9dc8['dialBusyMaxRetry']-0x1){return!![];}this[_0xce48('0xbf')]({'active':![],'countbusyretry':_0x4b35f6['countbusyretry']+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8[_0xce48('0x19e')],_0xce48('0xfe'))[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x19f')));break;case 0x8:if(_0x4b35f6[_0xce48('0xf3')]>=_0xea9dc8[_0xce48('0x1a0')]-0x1){return!![];}this[_0xce48('0xbf')]({'active':![],'countcongestionretry':_0x4b35f6[_0xce48('0xf3')]+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8['dialCongestionRetryFrequency'],_0xce48('0xfe'))['format'](_0xce48('0x105')),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x1a1')));break;case 0x0:if(_0x4b35f6['countnosuchnumberretry']>=_0xea9dc8['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xce48('0xbf')]({'active':![],'countnosuchnumberretry':_0x4b35f6[_0xce48('0x103')]+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8[_0xce48('0x1a2')],'minutes')[_0xce48('0x71')](_0xce48('0x105')),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6['CampaignId']||undefined})['catch'](loggerCatch(_0xce48('0x1a3')));}break;case 0xa:if(_0x4b35f6[_0xce48('0xf5')]>=_0xea9dc8[_0xce48('0x11c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4b35f6[_0xce48('0xf5')]+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8['dialDropRetryFrequency'],_0xce48('0xfe'))['format'](_0xce48('0x105')),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x11d')));break;case 0xb:if(_0x4b35f6['countabandonedretry']>=_0xea9dc8['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xce48('0xbf')]({'active':![],'countabandonedretry':_0x4b35f6[_0xce48('0x104')]+=0x1,'scheduledat':moment()['add'](_0xea9dc8['dialAbandonedRetryFrequency'],_0xce48('0xfe'))['format'](_0xce48('0x105')),'ContactId':_0x4b35f6['ContactId'],'ListId':_0x4b35f6['ListId'],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4b35f6[_0xce48('0xef')]>=_0xea9dc8[_0xce48('0xf9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4b35f6[_0xce48('0xef')]+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8[_0xce48('0xfd')],_0xce48('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b35f6[_0xce48('0xd3')],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6['CampaignId']||undefined})[_0xce48('0xb2')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4b35f6[_0xce48('0xf6')]>=_0xea9dc8[_0xce48('0x1a4')]-0x1){return!![];}this[_0xce48('0xbf')]({'active':![],'countagentrejectretry':_0x4b35f6[_0xce48('0xf6')]+=0x1,'scheduledat':moment()[_0xce48('0xfc')](_0xea9dc8[_0xce48('0x1a5')],_0xce48('0xfe'))['format'](_0xce48('0x105')),'ContactId':_0x4b35f6['ContactId'],'ListId':_0x4b35f6[_0xce48('0xd4')],'VoiceQueueId':_0x4b35f6[_0xce48('0xd6')]||undefined,'CampaignId':_0x4b35f6[_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xce48('0x1a6')]=function(_0x1334e8,_0x1252e5,_0x13502f){var _0x329779=this;var _0x217c06=new History(_0x1334e8);return new BPromise(function(_0x32c8b7,_0x37778b){if(_['isUndefined'](_0x1252e5)&&typeof _0x1252e5!==_0xce48('0x16c')){return _0x37778b(msgResponse(_0xce48('0x1a7'),'Failure',_0xce48('0x1a8')));}if(_[_0xce48('0x81')](_0x13502f)&&typeof _0x13502f!==_0xce48('0x16c')){return _0x37778b(msgResponse(_0xce48('0x1a7'),_0xce48('0x145'),_0xce48('0x1a9')));}switch(_0x13502f[_0xce48('0x10f')]){case'0':_0x1252e5[_0xce48('0x5c')]+=0x1;_0x217c06[_0xce48('0xa6')]=0x0;_0x217c06[_0xce48('0xe7')]=_0xce48('0x1aa');_0x217c06[_0xce48('0x103')]+=0x1;_0x217c06['countglobal']+=0x1;ami[_0xce48('0x48')]('custom:agentnosuchnumber',ut[_0xce48('0xea')](_0x1334e8,_0xce48('0x1ab')));_0x329779[_0xce48('0xcc')](_0x217c06)['catch'](loggerCatch(_0xce48('0xf2')));if(_0x329779[_0xce48('0x1ac')](0x0,_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0x103')]>=_0x1252e5['dialNoSuchNumberMaxRetry']){_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1ad'));}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1ad'));}}break;case'3':_0x1252e5[_0xce48('0x1ae')]+=0x1;_0x217c06[_0xce48('0xa6')]=0x3;_0x217c06[_0xce48('0xe7')]=_0xce48('0x1af');_0x217c06[_0xce48('0xf4')]+=0x1;_0x217c06[_0xce48('0xf0')]+=0x1;ami[_0xce48('0x48')](_0xce48('0x1b0'),ut[_0xce48('0xea')](_0x1334e8,_0xce48('0x1b1')));_0x329779['createHistory'](_0x217c06)['catch'](loggerCatch(_0xce48('0x1b2')));if(_0x329779['checkRetriveMax'](0x3,_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0xf4')]>=_0x1252e5[_0xce48('0x19b')]){_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1b3'));}}break;case'5':_0x1252e5[_0xce48('0x1b4')]+=0x1;_0x217c06['state']=0x5;_0x217c06[_0xce48('0xe7')]=_0xce48('0x1b5');_0x217c06[_0xce48('0x102')]+=0x1;_0x217c06['countglobal']+=0x1;ami[_0xce48('0x48')](_0xce48('0x1b6'),ut[_0xce48('0xea')](_0x1334e8,'busy'));_0x329779['createHistory'](_0x217c06)[_0xce48('0xb2')](loggerCatch(_0xce48('0x1b7')));if(_0x329779[_0xce48('0x1ac')](0x5,_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0x102')]>=_0x1252e5[_0xce48('0x1b8')]){_0x329779['createStateFinal'](_0x217c06,_0x32c8b7,_0x37778b,'reason\x205\x20busy');}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,'reason\x205\x20busy');}}break;case'8':_0x1252e5[_0xce48('0x1b9')]+=0x1;_0x217c06[_0xce48('0xa6')]=0x8;_0x217c06[_0xce48('0xe7')]=_0xce48('0x1ba');_0x217c06['countcongestionretry']+=0x1;_0x217c06[_0xce48('0xf0')]+=0x1;ami[_0xce48('0x48')]('custom:agentcongestion',ut[_0xce48('0xea')](_0x1334e8,_0xce48('0x1bb')));_0x329779[_0xce48('0xcc')](_0x217c06)[_0xce48('0xb2')](loggerCatch(_0xce48('0x1bc')));if(_0x329779[_0xce48('0x1ac')](0x8,_0x1334e8,_0x1252e5)){if(_0x217c06['countcongestionretry']>=_0x1252e5[_0xce48('0x1a0')]){_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1bd'));}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,'reason\x208\x20congestion');}}break;case'11':_0x1252e5[_0xce48('0x1be')]+=0x1;_0x217c06[_0xce48('0xa6')]=0xb;_0x217c06['statedesc']=_0xce48('0x120');_0x217c06[_0xce48('0x104')]+=0x1;_0x217c06[_0xce48('0xf0')]+=0x1;_0x329779['createHistory'](_0x217c06)[_0xce48('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x329779[_0xce48('0x1ac')](0xb,_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0x104')]>=_0x1252e5['dialAbandonedMaxRetry']){_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1bf'));}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1bf'));}}break;case'20':_0x1252e5[_0xce48('0x1c0')]+=0x1;_0x217c06[_0xce48('0xa6')]=0x14;_0x217c06['statedesc']=_0xce48('0x1c1');_0x217c06[_0xce48('0xf6')]+=0x1;_0x217c06['countglobal']+=0x1;ami[_0xce48('0x48')](_0xce48('0x1c2'),ut[_0xce48('0xea')](_0x1334e8,_0xce48('0x1c3')));_0x329779['createHistory'](_0x217c06)[_0xce48('0xb2')](loggerCatch(_0xce48('0x1c4')));if(_0x329779[_0xce48('0x1ac')](0x14,_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0xf6')]>=_0x1252e5[_0xce48('0x1a4')]){_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1c5'));}else{_0x329779[_0xce48('0xf8')](_0x217c06,_0x32c8b7,_0x37778b,_0xce48('0x1c5'));}}break;default:_0x1252e5[_0xce48('0x5f')]+=0x1;_0x217c06[_0xce48('0xa6')]=0xc;_0x217c06[_0xce48('0xe7')]=_0x13502f['reason'];_0x329779[_0xce48('0xcc')](_0x217c06)[_0xce48('0xb2')](loggerCatch(_0xce48('0x1c6')));if(_0x329779[_0xce48('0x1ac')](_0x13502f[_0xce48('0x10f')],_0x1334e8,_0x1252e5)){if(_0x217c06[_0xce48('0x102')]+_0x217c06['countcongestionretry']+_0x217c06[_0xce48('0xf4')]+_0x217c06[_0xce48('0x103')]+_0x217c06['countdropretry']+_0x217c06[_0xce48('0x104')]+_0x217c06['countmachineretry']+_0x217c06[_0xce48('0xf6')]>=_0x1252e5[_0xce48('0xf7')]){_0x329779['stateGlobal'](_0x217c06,_0x32c8b7,_0x37778b,_0x13502f[_0xce48('0x10f')]);}else{_0x329779[_0xce48('0xfa')](_0x217c06,_0x32c8b7,_0x37778b,_0x13502f[_0xce48('0x10f')]);}}}});};Dialer[_0xce48('0x18')]['stateGlobal']=function(_0x4a8c89,_0x4c1e95,_0x3606f3,_0x2f0800){var _0x480ced=new Final(_0x4a8c89);_0x480ced[_0xce48('0xa6')]=0xf;_0x480ced[_0xce48('0xe7')]='Global';this[_0xce48('0xfa')](_0x480ced,_0x4c1e95,_0x3606f3,_0x2f0800);};Dialer[_0xce48('0x18')]['createStateFinal']=function(_0x3f4d55,_0x4ba2d0,_0x3c888f,_0x4a8b21){this[_0xce48('0xca')](_0x3f4d55)[_0xce48('0x38')](function(){return _0x4ba2d0(msgResponse(_0xce48('0x1a7'),_0xce48('0xdb'),_0x4a8b21));})[_0xce48('0xb2')](function(){return _0x3c888f(msgResponse(_0xce48('0x1c7'),'Failure',_0xce48('0x1c8')));});};Dialer[_0xce48('0x18')][_0xce48('0x9')]=function(_0x296cb2){var _0x4401dc=_0x296cb2[_0xce48('0x1c9')]/0x64;var _0x2efc99=_0x296cb2['outboundDropCallsDayTimeout']/(_0x296cb2[_0xce48('0x5b')]+_0x296cb2[_0xce48('0xe6')]);var _0x111e16=Math['round'](_0x296cb2[_0xce48('0x1ca')]*(_0x296cb2[_0xce48('0x1cb')]/0x64));var _0x3d53d7=Math[_0xce48('0x1cc')](_0x296cb2[_0xce48('0x1ca')]*(_0x296cb2['predictiveIntervalMinThreshold']/0x64));var _0x13a713=_0x296cb2['available']+_0x296cb2[_0xce48('0x1cd')];var _0x3dc322=Math[_0xce48('0x1ce')](_0x296cb2['erlangCalls']*_0x296cb2[_0xce48('0x6b')]*_0x296cb2[_0xce48('0x66')]*_0x296cb2['predictiveIntervalMultiplicativeFactor']);if(_[_0xce48('0x81')](_0x296cb2['startProgressive'])){if(!_[_0xce48('0x81')](_0x296cb2[_0xce48('0x25')])){_0x296cb2[_0xce48('0x25')]=undefined;loggerPredictive['error'](_0xce48('0x1cf'),_0xce48('0x1d0'));}if(!_[_0xce48('0x81')](_0x296cb2['handlePredictive'])){loggerPredictive[_0xce48('0x94')](_0xce48('0x1cf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x296cb2['handlePredictive']);_0x296cb2[_0xce48('0x8e')]=undefined;}_0x296cb2[_0xce48('0x6d')]=moment()[_0xce48('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xce48('0x79')](_0x296cb2['name'],_0xce48('0x1d1'),_0x296cb2[_0xce48('0x6d')]);this['handlePower'](_0x296cb2,0x1);}else if(ifInterval(_0x296cb2[_0xce48('0x1d2')],_0x296cb2['startProgressive'])){this[_0xce48('0x158')](_0x296cb2,0x1);loggerPredictiveCalls[_0xce48('0x79')](_0xce48('0x1d3'),_0x296cb2['startProgressive'],_0x296cb2[_0xce48('0x3c')]);_0x296cb2[_0xce48('0x1d4')]=0x0;_0x296cb2[_0xce48('0x1d5')]=0x0;}else if(_0x4401dc<_0x2efc99&&_0x296cb2[_0xce48('0x1d6')]===_0xce48('0x1d7')){freeVariablesPredictive(_0x296cb2);loggerPredictive[_0xce48('0x79')](_0xce48('0x1d8'),_0xce48('0x1d9'),_0x2efc99,_0xce48('0x6d'),_0x296cb2['name']);}else if(_0x3dc322<_0x296cb2[_0xce48('0x1d5')]&&_0x296cb2[_0xce48('0x1d6')]===_0xce48('0x1d7')){freeVariablesPredictive(_0x296cb2);loggerPredictive[_0xce48('0x79')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xce48('0x1da'),_0x3dc322,_0xce48('0x1db'),_0x296cb2[_0xce48('0x1d5')],_0xce48('0x6d'),_0x296cb2[_0xce48('0x3c')]);}else if(!ifInterval(_0x296cb2['dialPredictiveInterval'],_0x296cb2[_0xce48('0x6d')])&&_['isUndefined'](_0x296cb2[_0xce48('0x25')])&&!_['isUndefined'](_0x296cb2['startProgressive'])){_0x296cb2['startPredictive']=moment()[_0xce48('0x71')](_0xce48('0x105'));loggerPredictive[_0xce48('0x79')](_0x296cb2[_0xce48('0x3c')],_0xce48('0x1dc'),_0x296cb2[_0xce48('0x25')]);this[_0xce48('0xbc')](_0x296cb2[_0xce48('0x1d2')])[_0xce48('0x38')](this['getDataPredictive'](_0x296cb2))['then'](mergeDataErlangB(_0x296cb2))[_0xce48('0x38')](this[_0xce48('0x1dd')](_0x296cb2))[_0xce48('0xb2')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x296cb2));}else if(!ifInterval(_0x296cb2[_0xce48('0x1d2')],_0x296cb2[_0xce48('0x25')])){_0x296cb2[_0xce48('0x1d5')]=0x0;_0x296cb2[_0xce48('0x25')]=moment()[_0xce48('0x71')](_0xce48('0x105'));loggerPredictive['info'](_0x296cb2['name'],_0xce48('0x1de'),_0x296cb2[_0xce48('0x25')]);clearInterval(_0x296cb2[_0xce48('0x8e')]);_0x296cb2[_0xce48('0x8e')]=undefined;this[_0xce48('0xbc')](_0x296cb2[_0xce48('0x1d2')])[_0xce48('0x38')](this['getDataPredictive'](_0x296cb2))['then'](mergeDataErlangB(_0x296cb2))['then'](this[_0xce48('0x1dd')](_0x296cb2))['catch'](loggerCatchPredictive(_0xce48('0x1df'),_0x296cb2));}else if(_0x296cb2[_0xce48('0x1ca')]&&_0x13a713<_0x296cb2[_0xce48('0x1ca')]-_0x3d53d7){freeVariablesPredictive(_0x296cb2);loggerPredictive['info'](_0x296cb2[_0xce48('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x13a713,')\x20are\x20less\x20than\x20threshold\x20(',_0x296cb2['predictiveIntervalAvailable'],'-',_0x3d53d7,'=',_0x296cb2[_0xce48('0x1ca')]-_0x3d53d7,')');}else if(_0x296cb2['predictiveIntervalAvailable']&&_0x13a713>_0x296cb2[_0xce48('0x1ca')]+_0x111e16){freeVariablesPredictive(_0x296cb2);loggerPredictive[_0xce48('0x79')](_0x296cb2[_0xce48('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x13a713,')\x20are\x20more\x20than\x20threshold\x20(',_0x296cb2[_0xce48('0x1ca')],'+',_0x111e16,'=',_0x296cb2[_0xce48('0x1ca')]+_0x111e16,')');}};Dialer[_0xce48('0x18')]['getDataPredictive']=function(_0x2e1bca){var _0x566770=this;return function(_0x330338){return new BPromise(function(_0x1e1cdd,_0xfc475f){_['merge'](_0x2e1bca,_0x330338[0x0]);if(checkGetDataPredictive(_0x330338[0x0])){var _0x3857e0=_0x2e1bca[_0xce48('0x1ca')]=_0x2e1bca['talking']+_0x2e1bca[_0xce48('0x4c')];var _0x5a62ad=_0x2e1bca[_0xce48('0x1d2')]*0x3c;var _0x168b27=_0x330338[0x0][_0xce48('0x62')]+_0x330338[0x0][_0xce48('0x61')];var _0x45bd50=(_0x330338[0x0][_0xce48('0x60')]+_0x330338[0x0][_0xce48('0x64')]+_0x330338[0x0][_0xce48('0x63')])/_0x330338[0x0][_0xce48('0x69')];_0x2e1bca[_0xce48('0x66')]=_0x45bd50>0x0?_0x45bd50:0x1;switch(_0x2e1bca[_0xce48('0x1d6')]){case _0xce48('0x1d7'):var _0x52e7d7=_0x2e1bca[_0xce48('0x1c9')]/0x64;return _0x566770[_0xce48('0x1e0')](_0x3857e0,_0x5a62ad,_0x168b27,_0x45bd50,_0x52e7d7)['then'](function(_0x536620){return _0x1e1cdd(_0x536620);});case _0xce48('0x1e1'):var _0x116914=_0x2e1bca['dialPredictiveOptimizationPercentage']/0x64;return _0x566770[_0xce48('0x1e2')](_0x3857e0,_0x5a62ad,_0x168b27,_0x45bd50,_0x116914)['then'](function(_0x5e9f23){return _0x1e1cdd(_0x5e9f23);});default:return _0xfc475f(msgResponse('[getDataPredictive]',_0xce48('0x145'),'Unknown\x20Predictive'));}}else{return _0xfc475f(msgResponse(_0xce48('0x1e3'),'Failure',_0xce48('0x1e4')));}});};};Dialer['prototype'][_0xce48('0x1e5')]=function(_0x79b3e7){var _0x289436=this;return function(_0xdd4b49){return new BPromise(function(_0xce5f8b,_0x29d7c5){_[_0xce48('0x8a')](_0x79b3e7,_0xdd4b49[0x0]);if(checkGetDataPredictive(_0xdd4b49[0x0])){loggerPredictive[_0xce48('0x79')](JSON['stringify'](_0xdd4b49[0x0]));if(_0x79b3e7[_0xce48('0x1d6')]===_0xce48('0x1d7')){return _0x289436['getVoiceQueueRtPauses'](_0x79b3e7['id'])['then'](function(_0x3585a3){var _0x4e341e=_0x79b3e7[_0xce48('0x4d')]-_0x3585a3[0x0]['outboundQueuePauses'];var _0x57febe=_0x79b3e7[_0xce48('0x1d2')]*0x3c;var _0x4d831e=_0xdd4b49[0x0]['predictiveIntervalAvgTalktime']+_0xdd4b49[0x0][_0xce48('0x61')];var _0x48c77f=(_0xdd4b49[0x0][_0xce48('0x60')]+_0xdd4b49[0x0][_0xce48('0x64')]+_0xdd4b49[0x0][_0xce48('0x63')])/_0xdd4b49[0x0][_0xce48('0x69')];var _0x2bb2c3=_0x79b3e7['dialPredictiveOptimizationPercentage']/0x64;_0x79b3e7[_0xce48('0x68')]=_0x3585a3[0x0][_0xce48('0x1e6')]||0x0;_0x79b3e7[_0xce48('0x66')]=_0x48c77f>0x0?_0x48c77f:0x1;return _0x289436[_0xce48('0x1e0')](_0x4e341e,_0x57febe,_0x4d831e,_0x48c77f,_0x2bb2c3);})[_0xce48('0x38')](function(_0x6c9164){return _0xce5f8b(_0x6c9164);})[_0xce48('0xb2')](function(_0xb72480){return _0x29d7c5(msgResponse(_0xce48('0x1e7'),_0xce48('0x145'),JSON[_0xce48('0x45')](_0xb72480)));});}if(_0x79b3e7[_0xce48('0x1d6')]===_0xce48('0x1e1')){return _0x289436[_0xce48('0xc8')](_0x79b3e7['id'])['then'](function(_0x362a69){var _0x305cb8=_0x79b3e7[_0xce48('0x4d')]-_0x362a69[0x0][_0xce48('0x1e6')];var _0x2c4cd5=_0x79b3e7[_0xce48('0x1d2')]*0x3c;var _0xd438ce=_0xdd4b49[0x0]['predictiveIntervalAvgTalktime']+_0xdd4b49[0x0][_0xce48('0x61')];var _0xc59abc=(_0xdd4b49[0x0][_0xce48('0x60')]+_0xdd4b49[0x0][_0xce48('0x64')]+_0xdd4b49[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xdd4b49[0x0][_0xce48('0x69')];var _0x4dcdc4=_0x79b3e7[_0xce48('0x1c9')]/0x64;_0x79b3e7['predictiveIntervalPauses']=_0x362a69[0x0]['outboundQueuePauses']||0x0;_0x79b3e7[_0xce48('0x66')]=_0xc59abc>0x0?_0xc59abc:0x1;return _0x289436[_0xce48('0x1e2')](_0x305cb8,_0x2c4cd5,_0xd438ce,_0xc59abc,_0x4dcdc4);})['then'](function(_0x4e1298){return _0xce5f8b(_0x4e1298);})['catch'](function(_0x1575e7){return _0x29d7c5(msgResponse(_0xce48('0x1e7'),_0xce48('0x145'),JSON[_0xce48('0x45')](_0x1575e7)));});}}else{return _0x29d7c5(msgResponse(_0xce48('0x1e3'),_0xce48('0x145'),_0xce48('0x1e4')));}});};};Dialer['prototype'][_0xce48('0x1dd')]=function(_0xbe552d){var _0x446346=this;return function(){var _0x2040e7=0x0;var _0x202fc9=Math[_0xce48('0x1ce')](_0xbe552d[_0xce48('0x6a')]*0x3e8);if(_0x202fc9>0x0){_0x202fc9=_0x202fc9<0x64?0x64:_0x202fc9;loggerPredictive[_0xce48('0x79')](_0xbe552d[_0xce48('0x3c')],'one\x20call\x20every:',_0x202fc9,_0xce48('0x46'));_0xbe552d[_0xce48('0x8e')]=setInterval(function(){_0x446346['handlePredictive'](_0xbe552d);loggerPredictiveCalls[_0xce48('0x79')](_0xce48('0x1e8'),_0x2040e7+=0x1);},_0x202fc9);}else{loggerPredictive[_0xce48('0x79')](_0xbe552d[_0xce48('0x3c')],_0xce48('0x1e9'));}};};Dialer[_0xce48('0x18')][_0xce48('0x1ea')]=function(_0x117051,_0x199cf3){var _0xa87fc=this;return function(_0x338498){if(_[_0xce48('0x91')](_0x338498)){if(_[_0xce48('0xae')](_0x199cf3['UserId'])||!_0x199cf3[_0xce48('0x1eb')]){if(_0x117051['dialMethod']==='booked'){_0x117051[_0xce48('0x12e')]=_['isUndefined'](_0x117051[_0xce48('0x12e')])?!![]:_0x117051[_0xce48('0x12e')];var _0x39b176=uuid['v4']();_0xa87fc[_0xce48('0x21')][_0x39b176]=new Action(_0x117051,_0x199cf3,_0x39b176);loggerBooked[_0xce48('0x79')](_0xce48('0x1ec'),_0x39b176,'queueStatusComplete:\x20',JSON['stringify'](_0x117051[_0xce48('0x12e')]),_0xce48('0x1ed'),_0x117051[_0xce48('0x3c')]);if(_0x117051[_0xce48('0x12e')]){_0x117051['queueStatusComplete']=![];_0xa87fc[_0xce48('0x27')][_0xa87fc[_0xce48('0x21')][_0x39b176][_0xce48('0xb4')]]=[];ami[_0xce48('0xaf')]({'actionid':_0x39b176,'action':_0xce48('0x1ee'),'queue':_0x117051[_0xce48('0x3c')]})[_0xce48('0xb2')](function(){_0xa87fc[_0xce48('0xd1')](_0x117051);_0xa87fc[_0xce48('0xbf')]({'active':![],'ContactId':_0xa87fc[_0xce48('0x21')][_0x39b176]['ContactId'],'ListId':_0xa87fc['actions'][_0x39b176][_0xce48('0xd4')],'VoiceQueueId':_0xa87fc['actions'][_0x39b176]['VoiceQueueId']||undefined,'CampaignId':_0xa87fc[_0xce48('0x21')][_0x39b176]['CampaignId']||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x1ef')));delete _0xa87fc['actions'][_0x39b176];});}else{loggerBooked[_0xce48('0x79')](_0xce48('0x1f0'),JSON[_0xce48('0x45')](_0x117051[_0xce48('0x12e')]),'Queue:\x20',_0x117051[_0xce48('0x3c')]);_0xa87fc[_0xce48('0xd1')](_0x117051);_0xa87fc[_0xce48('0xbf')]({'active':![],'ContactId':_0xa87fc['actions'][_0x39b176][_0xce48('0xd3')],'ListId':_0xa87fc[_0xce48('0x21')][_0x39b176][_0xce48('0xd4')],'VoiceQueueId':_0xa87fc[_0xce48('0x21')][_0x39b176][_0xce48('0xd6')]||undefined,'CampaignId':_0xa87fc['actions'][_0x39b176][_0xce48('0xd7')]||undefined})[_0xce48('0xb2')](loggerCatch(_0xce48('0x1ef')));delete _0xa87fc[_0xce48('0x21')][_0x39b176];}}else{return _0xa87fc['actionOriginate'](_0x117051,_0x199cf3);}}else{if(getDiff(_0x199cf3[_0xce48('0x1f1')])<_0x117051['dialRecallMeTimeout']*0x3c){if(_0x199cf3[_0xce48('0x15d')]&&!_0x199cf3['Agent'][_0xce48('0x1f2')]){_0xa87fc[_0xce48('0x1c')]['run'](_0x199cf3['id'])[_0xce48('0x1a')](function(){_0xa87fc[_0xce48('0xd1')](_0x117051);});}else{_0xa87fc[_0xce48('0xc1')]({'active':![]},_0x199cf3['id'],0x1)[_0xce48('0x1a')](function(){_0xa87fc[_0xce48('0xd1')](_0x117051);});}}else{_0x117051[_0xce48('0x5e')]+=0x1;_0xa87fc[_0xce48('0xd1')](_0x117051);if(_0x117051[_0xce48('0x1f3')]){_0xa87fc['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x199cf3['ContactId'],'ListId':_0x199cf3[_0xce48('0xd4')],'VoiceQueueId':_0x199cf3[_0xce48('0xd6')]||undefined,'CampaignId':_0x199cf3['CampaignId']||undefined})[_0xce48('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xa87fc[_0xce48('0xcc')](createObjHistory(_0x117051,_0x199cf3,_0xce48('0x1f4'),0x17,_0xce48('0x1f5')))['catch'](loggerCatch(_0xce48('0x1f6')));}else{_0xa87fc['saveInDb'](createObjHistory(_0x117051,_0x199cf3,_0xce48('0x1f7'),0x16,_0xce48('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0xce48('0x1f9'));}}}}else{_0x117051['outboundBlacklistCallsDay']+=0x1;_0xa87fc[_0xce48('0xdf')](createObjHistory(_0x117051,_0x199cf3,_0xce48('0x1fa'),0xd,_0xce48('0x1fb')),_0xce48('0x1fc'),_0xce48('0x1fd'));throw'inBlackList';}};};Dialer[_0xce48('0x18')][_0xce48('0x161')]=function(_0xc98f34){var _0x31261c=this;var _0xa8df7=_0xc98f34['limitCalls']-_0xc98f34[_0xce48('0x98')]-_0xc98f34['temp'];emitCampaignSummary(_0xc98f34);if(_0xa8df7>0x0){if(_0xa8df7>this['maxNumberOriginate']){_0xa8df7=this[_0xce48('0x20')];}_0xc98f34[_0xce48('0xc4')]+=_0xa8df7;this[_0xce48('0xc6')](_0xc98f34['id'],_0xa8df7,_0xc98f34[_0xce48('0x1fe')],_0xc98f34)['then'](function(_0x1f9e37){_0xc98f34['temp']-=_0xa8df7;_0xc98f34[_0xce48('0xc4')]=_0xc98f34[_0xce48('0xc4')]>0x0?_0xc98f34[_0xce48('0xc4')]:0x0;if(!checkContactEmpty(_0x1f9e37)){_0xc98f34[_0xce48('0x3a')]=_0xce48('0x1ff');logger[_0xce48('0x79')](_0xce48('0x200')+_0xc98f34['name']);}else{_0xc98f34['originated']+=_0x1f9e37[_0xce48('0x97')];_0xc98f34[_0xce48('0x3a')]=_0xce48('0x201');for(var _0x320536=0x0;_0x320536<_0x1f9e37[_0xce48('0x97')];_0x320536+=0x1){_0xc98f34[_0xce48('0x202')]+=0x1;if(_[_0xce48('0xae')](_0x1f9e37[_0x320536])||_[_0xce48('0xae')](_0x1f9e37[_0x320536][_0xce48('0x16f')])||_[_0xce48('0xae')](_0x1f9e37[_0x320536][_0xce48('0x16f')][_0xce48('0x16e')])){_0x31261c[_0xce48('0x203')]('[actionOriginate]\x20',_0xc98f34,_0x1f9e37[_0x320536]);}else{_0x31261c['checkIsBlackListIvr'](_[_0xce48('0x12b')](_0x1f9e37[_0x320536],['CampaignId','Contact.phone']))[_0xce48('0x38')](_0x31261c[_0xce48('0x1ea')](_0xc98f34,_0x1f9e37[_0x320536]))[_0xce48('0xb2')](_0x31261c[_0xce48('0xd0')](_0xce48('0x204'),_0xc98f34));}}}})[_0xce48('0xb2')](loggerGetContactDialer('[getContactCampaign2]',_0xc98f34,_0xa8df7));}};Dialer[_0xce48('0x18')][_0xce48('0x158')]=function(_0x27538a,_0x340918){var _0x3f1b18=this;var _0x13b4a9=[];var _0x5a2e1d=_0x340918>=0x1?_0x340918:0x1;if(_0x27538a[_0xce48('0x155')]===_0xce48('0x15a')){_0x5a2e1d=0x1;}var _0x105585=Math['floor'](_0x27538a['available']*_0x5a2e1d)-_0x27538a[_0xce48('0x98')]-_0x27538a[_0xce48('0xc4')];emitVoiceQueueSummary(_0x27538a);if(_0x27538a[_0xce48('0x205')]>0x0){var _0xa84d4f=_0x27538a[_0xce48('0x205')]-_0x27538a[_0xce48('0x98')]-_0x27538a[_0xce48('0x1cd')]-_0x27538a[_0xce48('0xc4')]-_0x27538a[_0xce48('0x4e')];if(_0x105585>_0xa84d4f){_0x105585=_0xa84d4f;}}if(_0x105585>0x0){if(_0x27538a[_0xce48('0x155')]===_0xce48('0x15a')){_0x105585=0x1;}if(_0x105585>this[_0xce48('0x20')]){_0x105585=this['maxNumberOriginate'];}_0x27538a[_0xce48('0xc4')]+=_0x105585;for(var _0x1becfb in this[_0xce48('0x1e')]){if(typeof this[_0xce48('0x1e')][_0x1becfb]!==_0xce48('0xac')){if(this[_0xce48('0x1e')][_0x1becfb][_0xce48('0xa6')]===_0xce48('0x206')&&this[_0xce48('0x1e')][_0x1becfb][_0xce48('0xb0')]===_0xce48('0xdd')){_0x13b4a9['push'](this[_0xce48('0x1e')][_0x1becfb]['id']);}}}this[_0xce48('0xc3')](_0x27538a['id'],_0x13b4a9,_0x105585,_0x27538a[_0xce48('0x1fe')],_0x27538a)[_0xce48('0x38')](function(_0xf61a18){_0x27538a[_0xce48('0xc4')]-=_0x105585;_0x27538a[_0xce48('0xc4')]=_0x27538a[_0xce48('0xc4')]>0x0?_0x27538a[_0xce48('0xc4')]:0x0;if(!checkContactEmpty(_0xf61a18)){_0x3f1b18[_0xce48('0x207')](_0x27538a)['then'](sendMessageReschedule(_0x27538a))[_0xce48('0xb2')](loggerCatch(_0xce48('0xb8')));}else{_0x27538a[_0xce48('0x98')]+=_0xf61a18[_0xce48('0x97')];_0x27538a[_0xce48('0x3a')]=_0x27538a[_0xce48('0x155')]===_0xce48('0x15a')?_0xce48('0x177'):_0xce48('0x201');for(var _0x551cd6=0x0;_0x551cd6<_0xf61a18[_0xce48('0x97')];_0x551cd6+=0x1){if(_[_0xce48('0xae')](_0xf61a18[_0x551cd6])||_[_0xce48('0xae')](_0xf61a18[_0x551cd6]['Contact'])||_['isNil'](_0xf61a18[_0x551cd6][_0xce48('0x16f')][_0xce48('0x16e')])){_0x3f1b18[_0xce48('0x203')](_0xce48('0x208'),_0x27538a,_0xf61a18[_0x551cd6]);}else{_0x3f1b18['checkIsBlackList'](_[_0xce48('0x12b')](_0xf61a18[_0x551cd6],[_0xce48('0xd6'),_0xce48('0x209')]))['then'](_0x3f1b18[_0xce48('0x1ea')](_0x27538a,_0xf61a18[_0x551cd6]))['catch'](_0x3f1b18[_0xce48('0xd0')](_0xce48('0x208'),_0x27538a));}}}})['catch'](loggerGetContactDialer(_0xce48('0x20a'),_0x27538a,_0x105585));}};Dialer['prototype'][_0xce48('0x8e')]=function(_0x4facc5){if(_0x4facc5[_0xce48('0x205')]>0x0){var _0x410ec8=_0x4facc5['dialLimitQueue']-_0x4facc5[_0xce48('0x98')]-_0x4facc5[_0xce48('0x1cd')];if(_0x410ec8>0x0){this[_0xce48('0x20b')](_0x4facc5);}else{loggerPredictiveCalls['info'](_0xce48('0x20c'));}}else{this[_0xce48('0x20b')](_0x4facc5);}};Dialer[_0xce48('0x18')]['tryOriginatePredictive']=function(_0x3066d4){var _0x3526f9=this;var _0x406662=[];_0x3066d4['originated']+=0x1;for(var _0x168d06 in this[_0xce48('0x1e')]){if(typeof this[_0xce48('0x1e')][_0x168d06]!==_0xce48('0xac')){if(this[_0xce48('0x1e')][_0x168d06][_0xce48('0xa6')]==='not_inuse'&&this['agents'][_0x168d06][_0xce48('0xb0')]===_0xce48('0xdd')){_0x406662[_0xce48('0x12a')](this['agents'][_0x168d06]['id']);}}}this['getContactDialer'](_0x3066d4['id'],_0x406662,0x1,_0x3066d4[_0xce48('0x1fe')],_0x3066d4)[_0xce48('0x38')](function(_0xe6f8a3){if(!checkContactEmpty(_0xe6f8a3)){checkContactLowerLimitOriginate(_0x3066d4,0x1,0x0);_0x3526f9[_0xce48('0x207')](_0x3066d4)[_0xce48('0x38')](sendMessageReschedule(_0x3066d4))[_0xce48('0xb2')](loggerCatch(_0xce48('0xb8')));}else{_0x3066d4[_0xce48('0x3a')]=_0xce48('0x201');if(_[_0xce48('0xae')](_0xe6f8a3[0x0])||_[_0xce48('0xae')](_0xe6f8a3[0x0]['Contact'])||_['isNil'](_0xe6f8a3[0x0][_0xce48('0x16f')]['phone'])){_0x3526f9[_0xce48('0x203')](_0xce48('0x208'),_0x3066d4,_0xe6f8a3[0x0]);}else{_0x3526f9[_0xce48('0xb9')](_['pick'](_0xe6f8a3[0x0],['VoiceQueueId',_0xce48('0x209')]))[_0xce48('0x38')](_0x3526f9[_0xce48('0x1ea')](_0x3066d4,_0xe6f8a3[0x0]))[_0xce48('0xb2')](_0x3526f9[_0xce48('0xd0')]('[actionOriginatePredictive]\x20',_0x3066d4));}}})['catch'](loggerGetContactDialer(_0xce48('0x20d'),_0x3066d4,0x1));emitVoiceQueueSummary(_0x3066d4);};Dialer[_0xce48('0x18')][_0xce48('0x1e0')]=function(_0x311a26,_0x1e5a0b,_0x271688,_0x8cf22b,_0x2ceae8,_0xe99bc7){loggerPredictive[_0xce48('0x79')](_0xce48('0x20e'));loggerPredictive[_0xce48('0x79')](_0xce48('0x20f'),_0x311a26);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e5a0b);loggerPredictive[_0xce48('0x79')](_0xce48('0x210'),_0x271688);loggerPredictive[_0xce48('0x79')](_0xce48('0x211'),_0x8cf22b);loggerPredictive[_0xce48('0x79')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ceae8);loggerPredictive[_0xce48('0x79')](_0xce48('0x80'));return new BPromise(function(_0x383bf1,_0x140f0f){if(_0x311a26<=0x0||isNaN(_0x311a26)){return _0x140f0f(msgResponse(_0xce48('0x212'),_0xce48('0x44'),'m\x20=\x20'+_0x311a26));}if(_0x271688<=0x0||isNaN(_0x271688)){return _0x140f0f(msgResponse(_0xce48('0x212'),_0xce48('0x44'),'Ts\x20=\x20'+_0x271688));}if(_0x8cf22b<=0x0||isNaN(_0x8cf22b)){return _0x140f0f(msgResponse(_0xce48('0x212'),_0xce48('0x44'),_0xce48('0x213')+_0x8cf22b));}if(_0x1e5a0b<=0x0||isNaN(_0x1e5a0b)){return _0x140f0f(msgResponse(_0xce48('0x212'),_0xce48('0x44'),'interval\x20=\x20'+_0x1e5a0b));}if(_0x2ceae8<=0x0||isNaN(_0x2ceae8)){return _0x140f0f(msgResponse('[abandonmentRate]','Error',_0xce48('0x214')+_0x2ceae8));}_0xe99bc7=_0xe99bc7||0x0;var _0x4e1535=0x1/_0x271688;var _0x2867d3=0x0;var _0x2d5c5e=0x0;var _0x49b7ec=0x0;var _0x116104=0x0;for(var _0x2b1ad1=0x0;_0x49b7ec<_0x2ceae8;_0x2b1ad1+=0x1){_0x2d5c5e=_0x2b1ad1/_0x1e5a0b;_0x2867d3=(_0x8cf22b*_0x2d5c5e+_0xe99bc7)/_0x4e1535;_0x49b7ec=erlangb(_0x2867d3,_0x311a26);_0x116104=_0x2867d3/_0x311a26*(0x1-erlangb(_0x2867d3,_0x311a26));}return _0x383bf1({'erlangCalls':_0x2b1ad1,'erlangCallToSecond':_0x1e5a0b/_0x2b1ad1,'erlangAbandonmentRate':_0x49b7ec,'erlangBusyFactor':_0x116104});});};Dialer[_0xce48('0x18')][_0xce48('0x1e2')]=function(_0x411a0b,_0xf993d9,_0x34245f,_0x7f7229,_0x51f24e,_0x1feb62){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xce48('0x79')]('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',_0x411a0b);loggerPredictive['info'](_0xce48('0x215'),_0xf993d9);loggerPredictive[_0xce48('0x79')](_0xce48('0x210'),_0x34245f);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7f7229);loggerPredictive[_0xce48('0x79')](_0xce48('0x216'),_0x51f24e);loggerPredictive[_0xce48('0x79')](_0xce48('0x80'));return new BPromise(function(_0x46d495,_0x3d7079){if(_0x411a0b<=0x0||isNaN(_0x411a0b)){return _0x3d7079(msgResponse(_0xce48('0x217'),_0xce48('0x44'),_0xce48('0x218')+_0x411a0b));}if(_0x34245f<=0x0||isNaN(_0x34245f)){return _0x3d7079(msgResponse(_0xce48('0x217'),_0xce48('0x44'),_0xce48('0x219')+_0x34245f));}if(_0x7f7229<=0x0||isNaN(_0x7f7229)){return _0x3d7079(msgResponse(_0xce48('0x217'),_0xce48('0x44'),_0xce48('0x213')+_0x7f7229));}if(_0xf993d9<=0x0||isNaN(_0xf993d9)){return _0x3d7079(msgResponse(_0xce48('0x217'),_0xce48('0x44'),_0xce48('0x21a')+_0xf993d9));}if(_0x51f24e<=0x0||isNaN(_0x51f24e)){return _0x3d7079(msgResponse(_0xce48('0x217'),_0xce48('0x44'),_0xce48('0x21b')+_0x51f24e));}_0x1feb62=_0x1feb62||0x0;var _0x357ea5=0x1/_0x34245f;var _0x40860a=0x0;var _0x58ba98=0x0;var _0x4716ac=0x0;var _0x4c825f=0x0;for(var _0x51652d=0x0;_0x4c825f<_0x51f24e;_0x51652d+=0x1){_0x58ba98=_0x51652d/_0xf993d9;_0x40860a=(_0x7f7229*_0x58ba98+_0x1feb62)/_0x357ea5;_0x4716ac=erlangb(_0x40860a,_0x411a0b);_0x4c825f=_0x40860a/_0x411a0b*(0x1-erlangb(_0x40860a,_0x411a0b));}return _0x46d495({'erlangCalls':_0x51652d,'erlangCallToSecond':_0xf993d9/_0x51652d,'erlangAbandonmentRate':_0x4716ac,'erlangBusyFactor':_0x4c825f});});};module['exports']=Dialer; \ No newline at end of file +var _0x0f3d=['Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','idHopper','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','push','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','predictive','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','handleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','dialPreviewRecallmeReminder','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','reachable','[getContactDialer2]','tryOriginatePredictive','not_inuse','[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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\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]','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','type','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','talking','waiting','available','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','uniqueid','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','rescheduleContact','add','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','Machine','membername','createStateFinal','dialMachineRetryFrequency','minutes','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','reason','agent','agiafterat','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','queueCallerAbandonCreateState','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]'];(function(_0x39443c,_0x25bf1f){var _0x39a016=function(_0x352fc3){while(--_0x352fc3){_0x39443c['push'](_0x39443c['shift']());}};_0x39a016(++_0x25bf1f);}(_0x0f3d,0xfe));var _0xd0f3=function(_0x42473d,_0x2c40d9){_0x42473d=_0x42473d-0x0;var _0x3f6b5f=_0x0f3d[_0x42473d];return _0x3f6b5f;};'use strict';var util=require(_0xd0f3('0x0'));var _=require('lodash');var BPromise=require(_0xd0f3('0x1'));var uuid=require(_0xd0f3('0x2'));var moment=require(_0xd0f3('0x3'));var rr=require('rr');var md5=require(_0xd0f3('0x4'));var Redis=require(_0xd0f3('0x5'));var ut=require(_0xd0f3('0x6'));var config=require('../../../config/environment/');var logger=require(_0xd0f3('0x7'))(_0xd0f3('0x8'));var loggerBooked=require('../../../config/logger')(_0xd0f3('0x9'));var loggerPredictive=require(_0xd0f3('0x7'))('predictive');var loggerPredictiveCalls=require(_0xd0f3('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xd0f3('0x7'))(_0xd0f3('0xa'));var ami=require(_0xd0f3('0xb'));config[_0xd0f3('0xc')]=_['defaults'](config['redis'],{'host':_0xd0f3('0xd'),'port':0x18eb});var io=require(_0xd0f3('0xe'))(new Redis(config[_0xd0f3('0xc')]));var cmHopper=require(_0xd0f3('0xf'));var cmHopperHistory=require(_0xd0f3('0x10'));var cmHopperBlack=require(_0xd0f3('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xd0f3('0x12'));var Action=require(_0xd0f3('0x13'));var History=require(_0xd0f3('0x14'));var Final=require('./final');var AgentComplete=require(_0xd0f3('0x15'));var QueueCallerAbandon=require(_0xd0f3('0x16'));var Hangup=require(_0xd0f3('0x17'));var ipAgi=process['env'][_0xd0f3('0x18')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0xd0f3('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xd0f3('0x1a')][_0xd0f3('0x1b')]=function(_0x522add){this['tail']=this[_0xd0f3('0x1c')]?this['tail'][_0xd0f3('0x1d')](_0x522add):_0x522add();};function Dialer(_0x4db635,_0x4c661a){this[_0xd0f3('0x1e')]=new Sequence();this[_0xd0f3('0x1f')]=_0x4c661a;this[_0xd0f3('0x20')]=_0x4db635['voiceQueues'];this[_0xd0f3('0x21')]=_0x4db635[_0xd0f3('0x21')];this[_0xd0f3('0x22')]=_0x4db635[_0xd0f3('0x22')];this[_0xd0f3('0x23')]=_0x4db635[_0xd0f3('0x23')];this[_0xd0f3('0x24')]=config[_0xd0f3('0x24')]||0x2;this[_0xd0f3('0x25')]={};this[_0xd0f3('0x26')]={};this[_0xd0f3('0x27')]={};this[_0xd0f3('0x28')]={};this[_0xd0f3('0x29')]={};this[_0xd0f3('0x2a')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xd0f3('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xd0f3('0x2c'),this['syncAgentConnect'][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x2e'),this[_0xd0f3('0x2f')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x30'),this[_0xd0f3('0x31')][_0xd0f3('0x2d')](this));ami['on']('agentcomplete',this[_0xd0f3('0x32')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x33'),this[_0xd0f3('0xa')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x34'),this[_0xd0f3('0x35')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x36'),this[_0xd0f3('0x37')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x38'),this[_0xd0f3('0x39')][_0xd0f3('0x2d')](this));ami['on'](_0xd0f3('0x3a'),this[_0xd0f3('0x3b')]['bind'](this));ami['on'](_0xd0f3('0x3c'),this[_0xd0f3('0x3d')][_0xd0f3('0x2d')](this));this[_0xd0f3('0x3e')]();this[_0xd0f3('0x3f')]();RpcSetting[_0xd0f3('0x40')]()[_0xd0f3('0x41')](function(_0x28247d){previewRecallmeReminderInterval=_0x28247d['previewRecallmeReminderInterval'];});}function isNotNull(_0x161d40){return _0x161d40!==null&&!_[_0xd0f3('0x42')](_0x161d40);}function checkIsLoggedIn(_0xa3b8ac,_0x43224b){return function(){if(_0x43224b<=0x0){_0xa3b8ac['message']=_0xd0f3('0x43');throw _0xa3b8ac['name']+_0xd0f3('0x44');}};}function isActive(_0x2e30a3){return _0x2e30a3;}function checkIsActive(_0x47bf5f,_0x3f825d){return function(){if(!isActive(_0x3f825d)){_0x47bf5f[_0xd0f3('0x45')]=_0xd0f3('0x46');throw _0x47bf5f['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x532306){return function(){if(!isNotNull(_0x532306[_0xd0f3('0x47')])){_0x532306['message']=_0xd0f3('0x48');throw _0x532306[_0xd0f3('0x49')]+_0xd0f3('0x4a');}if(!isNotNull(_0x532306[_0xd0f3('0x47')][_0xd0f3('0x4b')])){_0x532306[_0xd0f3('0x45')]=_0xd0f3('0x48');throw _0x532306[_0xd0f3('0x49')]+_0xd0f3('0x4a');}if(!isNotNull(_[_0xd0f3('0x4c')](_0x532306[_0xd0f3('0x47')][_0xd0f3('0x4b')]))){_0x532306['message']=_0xd0f3('0x48');throw _0x532306['name']+_0xd0f3('0x4a');}};}function msgResponse(_0x1497bf,_0x5bc170,_0x8716){return{'action':_0x1497bf,'response':_0x5bc170,'message':_0x8716,'stack':_0x8716};}function myreject(_0x551f7e){return function(_0x509540){return _0x551f7e(msgResponse(_0xd0f3('0x4d'),_0xd0f3('0x4e'),JSON[_0xd0f3('0x4f')](_0x509540)));};}function getSeconds(_0x563bf7,_0x4370e7){var _0x1351df=moment(_0x563bf7)[_0xd0f3('0x50')](0x0);var _0xcc1526=moment(_0x4370e7)[_0xd0f3('0x50')](0x0);return _0x1351df['diff'](_0xcc1526,_0xd0f3('0x51'));}function emit(_0x577523,_0x3005dc,_0x5489b7){io['to'](_0x577523)[_0xd0f3('0x52')](_0x3005dc,_0x5489b7);}function emitVoiceQueueSummary(_0x4e7f1e){if(_0x4e7f1e[_0xd0f3('0x53')]==='outbound'){var _0xb457be={'id':_0x4e7f1e['id'],'name':_0x4e7f1e[_0xd0f3('0x49')],'strategy':_0x4e7f1e[_0xd0f3('0x54')],'answered':_0x4e7f1e[_0xd0f3('0x55')],'available':_0x4e7f1e['available'],'loggedIn':_0x4e7f1e[_0xd0f3('0x56')],'pTalking':_0x4e7f1e[_0xd0f3('0x57')],'sumBillable':_0x4e7f1e[_0xd0f3('0x58')],'sumDuration':_0x4e7f1e[_0xd0f3('0x59')],'sumHoldTime':_0x4e7f1e['sumHoldTime']||0x0,'talking':_0x4e7f1e['talking'],'total':_0x4e7f1e[_0xd0f3('0x5a')],'type':_0x4e7f1e[_0xd0f3('0x53')],'unmanaged':_0x4e7f1e[_0xd0f3('0x5b')],'abandoned':_0x4e7f1e['abandoned'],'waiting':_0x4e7f1e['waiting'],'loggedInDb':_0x4e7f1e[_0xd0f3('0x5c')],'dialActive':_0x4e7f1e[_0xd0f3('0x5d')],'dialMethod':_0x4e7f1e[_0xd0f3('0x5e')],'dialOriginateCallerIdName':_0x4e7f1e['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4e7f1e[_0xd0f3('0x5f')],'dialOriginateTimeout':_0x4e7f1e[_0xd0f3('0x60')],'dialPrefix':_0x4e7f1e[_0xd0f3('0x61')],'outboundAnswerAgiCallsDay':_0x4e7f1e[_0xd0f3('0x62')],'outboundAnswerCallsDay':_0x4e7f1e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4e7f1e['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4e7f1e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4e7f1e[_0xd0f3('0x63')],'outboundDropCallsDayACS':_0x4e7f1e[_0xd0f3('0x64')],'outboundDropCallsDayCallersExit':_0x4e7f1e[_0xd0f3('0x65')],'outboundDropCallsDayTimeout':_0x4e7f1e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4e7f1e[_0xd0f3('0x66')],'outboundNoSuchCallsDay':_0x4e7f1e[_0xd0f3('0x67')],'outboundOriginateFailureCallsDay':_0x4e7f1e['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4e7f1e['outboundReCallsDay'],'outboundRejectCallsDay':_0x4e7f1e[_0xd0f3('0x68')],'outboundUnknownCallsDay':_0x4e7f1e['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4e7f1e[_0xd0f3('0x69')],'predictiveIntervalAvgHoldtime':_0x4e7f1e[_0xd0f3('0x6a')],'predictiveIntervalAvgTalktime':_0x4e7f1e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4e7f1e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4e7f1e[_0xd0f3('0x6b')],'predictiveIntervalErlangCalls':_0x4e7f1e[_0xd0f3('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x4e7f1e[_0xd0f3('0x6d')],'predictiveIntervalHitRate':_0x4e7f1e[_0xd0f3('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x4e7f1e[_0xd0f3('0x6f')],'predictiveIntervalPauses':_0x4e7f1e[_0xd0f3('0x70')],'predictiveIntervalAvailable':_0x4e7f1e[_0xd0f3('0x71')],'predictiveIntervalTotalCalls':_0x4e7f1e[_0xd0f3('0x72')],'message':_0x4e7f1e[_0xd0f3('0x45')],'originated':_0x4e7f1e[_0xd0f3('0x73')],'erlangCalls':_0x4e7f1e[_0xd0f3('0x74')],'erlangCallToSecond':_0x4e7f1e[_0xd0f3('0x75')],'erlangAbandonmentRate':_0x4e7f1e[_0xd0f3('0x76')],'erlangBusyFactor':_0x4e7f1e[_0xd0f3('0x77')],'startPredictive':_0x4e7f1e['startPredictive'],'startProgressive':_0x4e7f1e[_0xd0f3('0x78')]};if(_0x4e7f1e['Trunk']){_0xb457be[_0xd0f3('0x79')]={'id':_0x4e7f1e[_0xd0f3('0x79')]['id'],'name':_0x4e7f1e[_0xd0f3('0x79')][_0xd0f3('0x49')],'active':_0x4e7f1e[_0xd0f3('0x79')][_0xd0f3('0x7a')],'callerid':_0x4e7f1e[_0xd0f3('0x79')][_0xd0f3('0x7b')]};}if(_0x4e7f1e[_0xd0f3('0x47')]){_0xb457be['Interval']={'id':_0x4e7f1e[_0xd0f3('0x47')]['id'],'name':_0x4e7f1e[_0xd0f3('0x47')][_0xd0f3('0x49')]};}var _0x3b0722=md5(JSON[_0xd0f3('0x4f')](_0xb457be));if(_0x4e7f1e[_0xd0f3('0x4')]!==_0x3b0722){_0x4e7f1e[_0xd0f3('0x4')]=_0x3b0722;emit(util[_0xd0f3('0x7c')](_0xd0f3('0x7d'),_0xb457be[_0xd0f3('0x49')]),_0xd0f3('0x7e'),_0xb457be);}}}function emitCampaignSummary(_0x168466){if(_0x168466[_0xd0f3('0x53')]===_0xd0f3('0x7f')){emit(util[_0xd0f3('0x7c')](_0xd0f3('0x80'),_0x168466['name']),_0xd0f3('0x81'),_0x168466);}}function checkGetDataPredictive(_0x292772){if(isNotNull(_0x292772)&&!_[_0xd0f3('0x4c')](_0x292772)){loggerPredictive[_0xd0f3('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x83'),_0x292772[_0xd0f3('0x72')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x84'),_0x292772[_0xd0f3('0x69')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x85'),_0x292772[_0xd0f3('0x6b')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x86'),_0x292772[_0xd0f3('0x87')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x88'),_0x292772[_0xd0f3('0x6a')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x89'),_0x292772[_0xd0f3('0x8a')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x8b'));if(_0x292772['predictiveIntervalTotalCalls']>0x0){if(!_[_0xd0f3('0x42')](_0x292772[_0xd0f3('0x8a')])&&_0x292772[_0xd0f3('0x8a')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x292772[_0xd0f3('0x6a')])&&_0x292772['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x8c'));}else{loggerPredictive['info'](_0xd0f3('0x8d'));}}else{loggerPredictive['info'](_0xd0f3('0x8e'));}return![];}function mergeDataErlangB(_0x47979d){return function(_0x2ebf79){loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x8f'));loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x90'),_0x2ebf79['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ebf79[_0xd0f3('0x75')]);loggerPredictive[_0xd0f3('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ebf79[_0xd0f3('0x76')]);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x91'),_0x2ebf79['erlangBusyFactor']);loggerPredictive[_0xd0f3('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ebf79[_0xd0f3('0x76')]);loggerPredictive['info'](_0xd0f3('0x8b'));_[_0xd0f3('0x92')](_0x47979d,_0x2ebf79);};}function getDiff(_0x11957c){var _0x310c04=moment()[_0xd0f3('0x50')](0x0);var _0x595a2e=moment(_0x11957c)[_0xd0f3('0x50')](0x0);return _0x310c04['diff'](_0x595a2e,_0xd0f3('0x51'));}function ifInterval(_0x2067c6,_0x21568e){if(_[_0xd0f3('0x42')](_0x21568e)){return![];}return getDiff(_0x21568e)<_0x2067c6*0x3c;}function freeVariablesPredictive(_0x1ae271){if(isNotNull(_0x1ae271)){if(!_[_0xd0f3('0x42')](_0x1ae271[_0xd0f3('0x78')])){_0x1ae271[_0xd0f3('0x78')]=undefined;loggerPredictive[_0xd0f3('0x82')](_0x1ae271[_0xd0f3('0x49')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x1ae271[_0xd0f3('0x2a')])){_0x1ae271['startPredictive']=undefined;loggerPredictive['info'](_0x1ae271[_0xd0f3('0x49')],_0xd0f3('0x93'));}if(!_[_0xd0f3('0x42')](_0x1ae271[_0xd0f3('0x94')])){clearInterval(_0x1ae271[_0xd0f3('0x94')]);_0x1ae271['handlePredictive']=undefined;loggerPredictive[_0xd0f3('0x82')](_0x1ae271['name'],_0xd0f3('0x95'));}}}function erlangb(_0x4a1132,_0x5b871d){if(_0x5b871d===0x0){return 0x0;}var _0x352595=0x1;for(var _0x49fe92=0x1;_0x49fe92<=_0x5b871d;_0x49fe92+=0x1){_0x352595=0x1+_0x352595*_0x49fe92/_0x4a1132;}return 0x1/_0x352595;}function isVoiceQueueOutbound(_0x10526e){return _0x10526e===_0xd0f3('0x96');}function isNotPreview(_0x3c943b){return _0x3c943b!=='preview';}function isCampaignIvr(_0x2c570d){return _0x2c570d===_0xd0f3('0x7f');}function getCallerId(_0x5250d3,_0x4899e4,_0x56ed71){if(!_[_0xd0f3('0x42')](_0x56ed71)&&typeof _0x56ed71===_0xd0f3('0x97')&&!_[_0xd0f3('0x4c')](_0x56ed71)){if(!_[_0xd0f3('0x42')](_0x4899e4)&&typeof _0x4899e4===_0xd0f3('0x97')&&!_['isEmpty'](_0x4899e4)){return util['format']('\x22%s\x22\x20<%s>',_0x4899e4,_0x56ed71);}return util[_0xd0f3('0x7c')](_0xd0f3('0x98'),_0x56ed71,_0x56ed71);}if(!_['isUndefined'](_0x5250d3)&&typeof _0x5250d3===_0xd0f3('0x97')&&!_[_0xd0f3('0x4c')](_0x5250d3)){return _0x5250d3;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x279f4c,_0x5e66d9){return function(_0x198614){freeVariablesPredictive(_0x5e66d9);emitVoiceQueueSummary(_0x5e66d9);emitCampaignSummary(_0x5e66d9);loggerSyncQueueSummary[_0xd0f3('0x99')](_0x279f4c,util['inspect'](_0x198614,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x10d6e7,_0x5ff70f){return function(_0x2140c3){loggerPredictive['error'](_0x5ff70f['name'],_0x10d6e7);loggerPredictive[_0xd0f3('0x99')](_0x2140c3[_0xd0f3('0x9a')]);freeVariablesPredictive(_0x5ff70f);};}function loggerCatch(_0x15e80f){return function(_0x2affc6){logger[_0xd0f3('0x99')](_0x15e80f,util[_0xd0f3('0x9b')](_0x2affc6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x293f45){return _0x293f45&&!_['isUndefined'](_0x293f45)&&_0x293f45['length']>0x0;}function decremetOriginate(_0xb9595f){if(!_[_0xd0f3('0x42')](_0xb9595f)&&_0xb9595f!==null){if(typeof _0xb9595f[_0xd0f3('0x73')]!==_0xd0f3('0x9c')){if(_0xb9595f[_0xd0f3('0x73')]>0x0){_0xb9595f[_0xd0f3('0x73')]-=0x1;}else{logger['error'](_0xd0f3('0x9d'));}}}else{logger[_0xd0f3('0x99')](_0xd0f3('0x9e'));}}function checkContactLowerLimitOriginate(_0x295a6d,_0x12baca,_0x45bc3d){if(_0x12baca>_0x45bc3d){for(var _0x37834d=0x0;_0x37834d<_0x12baca-_0x45bc3d;_0x37834d+=0x1){decremetOriginate(_0x295a6d);}}}function loggerGetContactDialer(_0xc6a264,_0x31079f,_0x5bc2ee){return function(_0x1fccbe){checkContactLowerLimitOriginate(_0x31079f,_0x5bc2ee,0x0);logger[_0xd0f3('0x99')](_0xc6a264,util[_0xd0f3('0x9b')](_0x1fccbe,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x63a3c3){return function(_0xae2eb3){if(isNotNull(_0xae2eb3)&&isNotNull(_0xae2eb3[0x0])){if(_0xae2eb3[0x0]['contactsRescheduled']>0x0){_0x63a3c3[_0xd0f3('0x45')]=_0xd0f3('0x9f');logger[_0xd0f3('0x82')](_0xd0f3('0xa0')+_0x63a3c3['name'],_0xae2eb3[0x0][_0xd0f3('0xa1')],_0xd0f3('0xa2'));}else{_0x63a3c3[_0xd0f3('0x45')]=_0xd0f3('0xa3');logger[_0xd0f3('0x82')]('[getContactDialer2][Empty]'+_0x63a3c3[_0xd0f3('0x49')]);}}};}function notSendMessagesQueue(_0x315a11){if(_0x315a11['sendMessageOneNotActive']){freeVariablesPredictive(_0x315a11);if(_0x315a11[_0xd0f3('0x73')]===0x0&&_0x315a11[_0xd0f3('0xa4')]===0x0&&_0x315a11[_0xd0f3('0xa5')]===0x0&&(_0x315a11[_0xd0f3('0x57')]||0x0)===0x0){_0x315a11['sendMessageOneNotActive']=![];_0x315a11[_0xd0f3('0xa6')]=0x0;_0x315a11[_0xd0f3('0x45')]=_0xd0f3('0x46');loggerSyncQueueSummary[_0xd0f3('0x99')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x315a11[_0xd0f3('0x49')],_0xd0f3('0xa7'));}else{_0x315a11[_0xd0f3('0x45')]=_0xd0f3('0xa8');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x315a11[_0xd0f3('0x49')],_0xd0f3('0xa9'));}emitVoiceQueueSummary(_0x315a11);}}function notSendMessagesCampaign(_0x73e9dc){if(_0x73e9dc[_0xd0f3('0xaa')]){if(_0x73e9dc['originated']===0x0){_0x73e9dc[_0xd0f3('0xaa')]=![];_0x73e9dc[_0xd0f3('0x45')]=_0xd0f3('0x46');loggerSyncQueueSummary[_0xd0f3('0x99')](_0xd0f3('0xab'),_0x73e9dc[_0xd0f3('0x49')],_0xd0f3('0xa7'));}else{_0x73e9dc[_0xd0f3('0x45')]=_0xd0f3('0xa8');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x73e9dc[_0xd0f3('0x49')],_0xd0f3('0xa9'));}emitCampaignSummary(_0x73e9dc);}}function createObjHistory(_0x5f1250,_0x155395,_0x9358ee,_0xd852f9,_0x2ddf5e){_0x5f1250[_0xd0f3('0x45')]=_0x9358ee;var _0x3e0f2e=new Action(_0x5f1250,_0x155395);var _0x2240bb=new History(_0x3e0f2e);_0x2240bb[_0xd0f3('0xac')]=_0xd852f9;_0x2240bb[_0xd0f3('0xad')]=_0x2ddf5e;_0x2240bb[_0xd0f3('0xae')]=_0x3e0f2e[_0xd0f3('0xaf')];return _0x2240bb;}Dialer[_0xd0f3('0x1a')][_0xd0f3('0x3f')]=function(){var _0x9265d4=this;setInterval(function(){_0x9265d4[_0xd0f3('0xb0')](_0x9265d4[_0xd0f3('0x28')],_0xd0f3('0xb1'));_0x9265d4[_0xd0f3('0xb0')](_0x9265d4[_0xd0f3('0x26')],_0xd0f3('0xb2'));},0x32c8);};Dialer['prototype'][_0xd0f3('0xb0')]=function(_0x54b644,_0x149749){var _0x5a8d8a=this;for(var _0x4abc8f in _0x54b644){if(typeof _0x54b644[_0x4abc8f]!==_0xd0f3('0x9c')){this[_0xd0f3('0x1e')][_0xd0f3('0x1b')](function(){if(!_[_0xd0f3('0xb3')](_0x54b644[_0x4abc8f])){return ami[_0xd0f3('0xb4')]({'action':_0xd0f3('0xb5'),'channel':_0x54b644[_0x4abc8f][_0xd0f3('0xb6')]})[_0xd0f3('0xb7')](function(_0x3c7bd3){if(_0x3c7bd3[_0xd0f3('0x45')]===_0xd0f3('0xb8')){setTimeout(function(){if(_0x54b644[_0x4abc8f]&&_0x54b644[_0x4abc8f]['type']!==_0xd0f3('0x7f')){_0x5a8d8a[_0xd0f3('0xb9')](_0x5a8d8a['voiceQueues'][_0x54b644[_0x4abc8f][_0xd0f3('0xba')]]);logger[_0xd0f3('0x99')]('[Dialer][checkChannel]',_0x149749,_0x4abc8f,_0x54b644[_0x4abc8f][_0xd0f3('0xba')]);delete _0x54b644[_0x4abc8f];}if(_0x54b644[_0x4abc8f]&&_0x54b644[_0x4abc8f][_0xd0f3('0x53')]==='ivr'){_0x5a8d8a[_0xd0f3('0xb9')](_0x5a8d8a['campaigns'][_0x54b644[_0x4abc8f]['queue']]);logger[_0xd0f3('0x99')]('[Dialer][checkChannel][ivr]',_0x149749,_0x4abc8f,_0x54b644[_0x4abc8f][_0xd0f3('0xba')]);delete _0x54b644[_0x4abc8f];}},0x2328);}});}});}}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xbb')]=function(_0x21cab0){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x21cab0))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xbc')));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xbd')]=function(_0x437b5d){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopperBlack[_0xd0f3('0xbd')](_0x437b5d))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xbf')));};Dialer['prototype'][_0xd0f3('0xc0')]=function(_0x6e9648){return BPromise[_0xd0f3('0xbe')]()['then'](cmHopperBlack[_0xd0f3('0xc0')](_0x6e9648))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xc1')));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xc2')]=function(_0x39351b){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopperHistory[_0xd0f3('0xc3')](_0x39351b))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xc4')));};Dialer[_0xd0f3('0x1a')]['rescheduleContact']=function(_0x4776f2){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopper['rescheduleContact'](_0x4776f2))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xc5')));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xc6')]=function(_0x16f45a,_0x45ff40,_0x2bd187){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopper[_0xd0f3('0xc6')](_0x16f45a,_0x45ff40,_0x2bd187))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xc7')));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xc8')]=function(_0x556bb2,_0x4953c0,_0xb8856e,_0x50fd75,_0x274e96){return BPromise[_0xd0f3('0xbe')]()['then'](cmHopper[_0xd0f3('0xc8')](_0x556bb2,_0x4953c0,_0xb8856e,_0x50fd75))['catch'](function(_0x33702d){_0x274e96[_0xd0f3('0xc9')]-=_0xb8856e;_0x274e96[_0xd0f3('0xc9')]=_0x274e96[_0xd0f3('0xc9')]>0x0?_0x274e96[_0xd0f3('0xc9')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x33702d);});};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xca')]=function(_0x3d8699,_0x30726d,_0x5aa80c,_0x537056){return BPromise[_0xd0f3('0xbe')]()['then'](cmHopper[_0xd0f3('0xca')](_0x3d8699,_0x30726d,_0x5aa80c))[_0xd0f3('0xb7')](function(_0xaca1e7){_0x537056[_0xd0f3('0xc9')]-=_0x30726d;_0x537056[_0xd0f3('0xc9')]=_0x537056['temp']>0x0?_0x537056[_0xd0f3('0xc9')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0xaca1e7);});};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x1216d4){return BPromise['resolve']()[_0xd0f3('0x41')](voiceQueueRt[_0xd0f3('0xcb')](_0x1216d4))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xcc')));};Dialer['prototype'][_0xd0f3('0xcd')]=function(_0x476a61){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopper['moveContactManagedDialer'](_0x476a61))[_0xd0f3('0xb7')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xce')]=function(_0x464f5b){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopperHistory['createHistory'](_0x464f5b))[_0xd0f3('0xb7')](loggerCatch('[createHistory]\x20'));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xb9')]=function(_0x45bede){if(!_[_0xd0f3('0x42')](_0x45bede)&&_0x45bede!==null){if(typeof _0x45bede['originated']!==_0xd0f3('0x9c')){if(_0x45bede[_0xd0f3('0x73')]>0x0){_0x45bede[_0xd0f3('0x73')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xd0f3('0x99')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0xd0f3('0xcf')]=function(_0x309d11,_0x431670){var _0x4afc83=this;return function(_0x502a48){_0x4afc83[_0xd0f3('0xb9')](_0x431670);logger[_0xd0f3('0x99')](_0x309d11,util[_0xd0f3('0x9b')](_0x502a48,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xd0f3('0xd0')]=function(_0x55a1a1,_0x40f0b3,_0x5b8102){var _0x4d6c9c={'state':0x19,'statedesc':_0xd0f3('0xd1')};this[_0xd0f3('0xb9')](_0x40f0b3);this['saveInDb'](_['merge'](_0x4d6c9c,_[_0xd0f3('0xd2')](_0x5b8102,[_0xd0f3('0xd3'),_0xd0f3('0xd4'),_0xd0f3('0xd5'),'VoiceQueueId','CampaignId'])),_0xd0f3('0xd6'),_0xd0f3('0xd7'));logger[_0xd0f3('0x99')](_0x55a1a1);};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xd8')]=function(_0x2a6d08){return _0x2a6d08===_0xd0f3('0xd9');};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xda')]=function(_0xd05391){return!_[_0xd0f3('0x42')](_0xd05391)&&_0xd05391&&!_[_0xd0f3('0x42')](_0xd05391[_0xd0f3('0x49')])&&!_['isUndefined'](_0xd05391[_0xd0f3('0x7a')])&&_0xd05391[_0xd0f3('0x7a')]&&(this['trunks'][util['format'](_0xd0f3('0xdb'),_0xd05391['name'])]['status']==='reachable'||this[_0xd0f3('0x23')][util[_0xd0f3('0x7c')](_0xd0f3('0xdb'),_0xd05391['name'])][_0xd0f3('0xb5')]===_0xd0f3('0xdc'));};Dialer['prototype'][_0xd0f3('0xdd')]=function(_0x1cecf9,_0x46eb7f,_0x94913a){this['createHistory'](_0x1cecf9)[_0xd0f3('0xb7')](loggerCatch(_0x46eb7f));this[_0xd0f3('0xcd')](_0x1cecf9)[_0xd0f3('0xb7')](loggerCatch(_0x94913a));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x39')]=function(_0x28a197){var _0x53b673=this['uniqueId'][_0x28a197['uniqueid']];var _0x46661e;if(!_[_0xd0f3('0xb3')](_0x28a197)&&!_[_0xd0f3('0xb3')](_0x28a197['variable'])&&!_['isNil'](_0x28a197[_0xd0f3('0xde')][_0xd0f3('0xdf')])&&_0x28a197[_0xd0f3('0xe0')]===_0xd0f3('0xe1')&&_0x53b673){if(_0x53b673[_0xd0f3('0x53')]!=='ivr'&&this[_0xd0f3('0x20')][_0x53b673[_0xd0f3('0xba')]][_0xd0f3('0xe2')]&&_0x28a197[_0xd0f3('0xe3')]==='HANGUP'){delete this[_0xd0f3('0x28')][_0x28a197['uniqueid']];this[_0xd0f3('0xb9')](this['voiceQueues'][_0x53b673['queue']]);this[_0xd0f3('0x20')][_0x53b673[_0xd0f3('0xba')]][_0xd0f3('0xe4')]+=0x1;this['voiceQueues'][_0x53b673[_0xd0f3('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;_0x46661e=new Hangup(_0x53b673,_0x28a197);_0x46661e[_0xd0f3('0xac')]=0x12;_0x46661e[_0xd0f3('0xad')]=_0xd0f3('0xe5');_0x46661e['membername']=_0xd0f3('0xe6');ami[_0xd0f3('0x52')](_0xd0f3('0xe7'),ut[_0xd0f3('0xe8')](_0x46661e,_0xd0f3('0xe9')));this[_0xd0f3('0xdd')](_0x46661e,_0xd0f3('0xea'),_0xd0f3('0xeb'));}if(_0x53b673['type']!==_0xd0f3('0x7f')&&this['voiceQueues'][_0x53b673[_0xd0f3('0xba')]][_0xd0f3('0xe2')]&&_0x28a197[_0xd0f3('0xe3')]===_0xd0f3('0xec')){var _0x10f12a=this;return new BPromise(function(_0x466d3a,_0x3a9358){delete _0x10f12a[_0xd0f3('0x28')][_0x28a197[_0xd0f3('0xed')]];_0x10f12a[_0xd0f3('0xb9')](_0x10f12a[_0xd0f3('0x20')][_0x53b673[_0xd0f3('0xba')]]);_0x10f12a['voiceQueues'][_0x53b673[_0xd0f3('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x10f12a[_0xd0f3('0x20')][_0x53b673[_0xd0f3('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xede687=_0x10f12a[_0xd0f3('0x20')][_0x53b673[_0xd0f3('0xba')]];var _0x4156b8=new Hangup(_0x53b673,_0x28a197);_0x4156b8['state']=0x13;_0x4156b8[_0xd0f3('0xad')]='Machine';_0x4156b8['membername']='AMD';_0x4156b8[_0xd0f3('0xee')]+=0x1;_0x4156b8[_0xd0f3('0xef')]+=0x1;_0x4156b8[_0xd0f3('0xe9')]=!![];ami[_0xd0f3('0x52')](_0xd0f3('0xe7'),ut[_0xd0f3('0xe8')](_0x4156b8,_0xd0f3('0xe9')));_0x10f12a['createHistory'](_0x4156b8)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xf0')));if(_0x4156b8[_0xd0f3('0xf1')]+_0x4156b8[_0xd0f3('0xf2')]+_0x4156b8[_0xd0f3('0xf3')]+_0x4156b8[_0xd0f3('0xf4')]+_0x4156b8[_0xd0f3('0xf5')]+_0x4156b8[_0xd0f3('0xf6')]+_0x4156b8[_0xd0f3('0xee')]+_0x4156b8[_0xd0f3('0xf7')]>=_0xede687[_0xd0f3('0xf8')]){_0x10f12a[_0xd0f3('0xf9')](_0x4156b8,_0x466d3a,_0x3a9358,_0xd0f3('0xfa'));}else{if(_0x4156b8['countmachineretry']>=_0xede687[_0xd0f3('0xfb')]){_0x10f12a['createStateFinal'](_0x4156b8,_0x466d3a,_0x3a9358,_0xd0f3('0xfc'));}else{_0x10f12a[_0xd0f3('0xfd')]({'active':![],'countmachineretry':_0x4156b8['countmachineretry'],'scheduledat':moment()[_0xd0f3('0xfe')](_0xede687['dialMachineRetryFrequency'],'minutes')[_0xd0f3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4156b8[_0xd0f3('0xd3')],'ListId':_0x4156b8['ListId'],'VoiceQueueId':_0x4156b8[_0xd0f3('0xff')]||undefined,'CampaignId':_0x4156b8[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x101')));_0x466d3a({'reschedule':0x1});}}});}if(_0x53b673['type']===_0xd0f3('0x7f')&&this['campaigns'][_0x53b673['queue']]['dialAMDActive']&&_0x28a197[_0xd0f3('0xe3')]===_0xd0f3('0x102')){delete this[_0xd0f3('0x28')][_0x28a197['uniqueid']];this[_0xd0f3('0xb9')](this[_0xd0f3('0x21')][_0x53b673[_0xd0f3('0xba')]]);_0x46661e=new Hangup(_0x53b673,_0x28a197);_0x46661e[_0xd0f3('0xac')]=0x12;_0x46661e['statedesc']=_0xd0f3('0xe5');_0x46661e['membername']=_0xd0f3('0xe6');ami[_0xd0f3('0x52')](_0xd0f3('0xe7'),ut[_0xd0f3('0xe8')](_0x46661e,_0xd0f3('0xe9')));this['saveInDb'](_0x46661e,'[syncHangupInAMDIvr][createHistory]',_0xd0f3('0x103'));}if(_0x53b673[_0xd0f3('0x53')]==='ivr'&&this[_0xd0f3('0x21')][_0x53b673[_0xd0f3('0xba')]]['dialAMDActive']&&_0x28a197['value']===_0xd0f3('0xec')){var _0x10f12a=this;return new BPromise(function(_0x2cddac,_0x14b699){delete _0x10f12a['uniqueId'][_0x28a197[_0xd0f3('0xed')]];_0x10f12a[_0xd0f3('0xb9')](_0x10f12a[_0xd0f3('0x21')][_0x53b673[_0xd0f3('0xba')]]);_0x10f12a['campaigns'][_0x53b673[_0xd0f3('0xba')]][_0xd0f3('0xe4')]+=0x1;_0x10f12a[_0xd0f3('0x21')][_0x53b673[_0xd0f3('0xba')]][_0xd0f3('0x62')]+=0x1;var _0x48340f=_0x10f12a['campaigns'][_0x53b673['queue']];var _0x2a77c2=new Hangup(_0x53b673,_0x28a197);_0x2a77c2[_0xd0f3('0xac')]=0x13;_0x2a77c2['statedesc']=_0xd0f3('0x104');_0x2a77c2[_0xd0f3('0x105')]='AMD';_0x2a77c2[_0xd0f3('0xee')]+=0x1;_0x2a77c2[_0xd0f3('0xef')]+=0x1;_0x2a77c2[_0xd0f3('0xe9')]=!![];ami[_0xd0f3('0x52')]('custom:amd',ut[_0xd0f3('0xe8')](_0x2a77c2,_0xd0f3('0xe9')));_0x10f12a[_0xd0f3('0xce')](_0x2a77c2)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xf0')));if(_0x2a77c2[_0xd0f3('0xf1')]+_0x2a77c2[_0xd0f3('0xf2')]+_0x2a77c2[_0xd0f3('0xf3')]+_0x2a77c2[_0xd0f3('0xf4')]+_0x2a77c2[_0xd0f3('0xf5')]+_0x2a77c2[_0xd0f3('0xf6')]+_0x2a77c2['countmachineretry']+_0x2a77c2[_0xd0f3('0xf7')]>=_0x48340f['dialGlobalMaxRetry']){_0x10f12a[_0xd0f3('0xf9')](_0x2a77c2,_0x2cddac,_0x14b699,_0xd0f3('0xfa'));}else{if(_0x2a77c2['countmachineretry']>=_0x48340f['dialMachineMaxRetry']){_0x10f12a[_0xd0f3('0x106')](_0x2a77c2,_0x2cddac,_0x14b699,_0xd0f3('0xfc'));}else{_0x10f12a['rescheduleContact']({'active':![],'countmachineretry':_0x2a77c2[_0xd0f3('0xee')],'scheduledat':moment()[_0xd0f3('0xfe')](_0x48340f[_0xd0f3('0x107')],_0xd0f3('0x108'))[_0xd0f3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a77c2['ContactId'],'ListId':_0x2a77c2['ListId'],'VoiceQueueId':_0x2a77c2[_0xd0f3('0xff')]||undefined,'CampaignId':_0x2a77c2[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch('[rescheduleContact][Machine]'));_0x2cddac({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xd0f3('0x35')]=function(_0x1f293d){var _0x1d73bd=this[_0xd0f3('0x28')][_0x1f293d['uniqueid']];var _0x1022e5=this;var _0x3e2336;if(_0x1d73bd&&_0x1d73bd[_0xd0f3('0x53')]==='ivr'){delete this[_0xd0f3('0x28')][_0x1f293d[_0xd0f3('0xed')]];this['updateOriginated'](this[_0xd0f3('0x21')][_0x1d73bd[_0xd0f3('0xba')]]);this[_0xd0f3('0x21')][_0x1d73bd['queue']]['ivrAnswerCallsDay']+=0x1;_0x3e2336=new Hangup(_0x1d73bd,_0x1f293d);this[_0xd0f3('0xce')](_0x3e2336)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x109')));this[_0xd0f3('0xcd')](_0x3e2336)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x10a')));}if(_0x1d73bd&&_0x1d73bd[_0xd0f3('0x53')]!=='ivr'&&isNotNull(this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]][_0xd0f3('0x10b')])){delete this['uniqueId'][_0x1f293d[_0xd0f3('0xed')]];this[_0xd0f3('0xb9')](this['voiceQueues'][_0x1d73bd[_0xd0f3('0xba')]]);this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]][_0xd0f3('0xe4')]+=0x1;this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]][_0xd0f3('0x62')]+=0x1;_0x3e2336=new Hangup(_0x1d73bd,_0x1f293d);_0x3e2336[_0xd0f3('0xac')]=0x10;_0x3e2336[_0xd0f3('0xad')]=_0xd0f3('0x10c');_0x3e2336[_0xd0f3('0x105')]=_0xd0f3('0x10d');this[_0xd0f3('0xce')](_0x3e2336)['catch'](loggerCatch(_0xd0f3('0x109')));this[_0xd0f3('0xcd')](_0x3e2336)[_0xd0f3('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x1d73bd&&_0x1d73bd[_0xd0f3('0x53')]!==_0xd0f3('0x7f')&&!isNotNull(this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]]['dialQueueProject'])){delete this[_0xd0f3('0x28')][_0x1f293d[_0xd0f3('0xed')]];this[_0xd0f3('0xb9')](this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]]);this[_0xd0f3('0x20')][_0x1d73bd[_0xd0f3('0xba')]][_0xd0f3('0x10e')]+=0x1;_0x3e2336=new Hangup(_0x1d73bd,_0x1f293d);_0x3e2336[_0xd0f3('0xac')]=0xc;_0x3e2336[_0xd0f3('0xad')]=_0x1f293d[_0xd0f3('0x10f')];_0x3e2336[_0xd0f3('0x105')]=_0xd0f3('0x110');this['createHistory'](_0x3e2336)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x109')));this[_0xd0f3('0xcd')](_0x3e2336)['catch'](loggerCatch(_0xd0f3('0x10a')));}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x32')]=function(_0xddbd4a){var _0x5bef0d=this[_0xd0f3('0x28')][_0xddbd4a['uniqueid']];var _0xe46150=this;if(this[_0xd0f3('0x20')][_0xddbd4a[_0xd0f3('0xba')]]){if(_0x5bef0d&&_0x5bef0d[_0xd0f3('0x53')]!=='ivr'){delete this[_0xd0f3('0x28')][_0xddbd4a[_0xd0f3('0xed')]];this[_0xd0f3('0x20')][_0xddbd4a[_0xd0f3('0xba')]]['outboundAnswerCallsDay']+=0x1;var _0x58c215=new AgentComplete(_0x5bef0d,_0xddbd4a);if(_0xddbd4a[_0xd0f3('0x111')]===_0xd0f3('0x112')){_0x58c215[_0xd0f3('0x113')]=this['voiceQueues'][_0xddbd4a['queue']]['dialQueueProject2']&&this[_0xd0f3('0x20')][_0xddbd4a[_0xd0f3('0xba')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xd0f3('0x114')):undefined;}this['createHistory'](_0x58c215)['catch'](loggerCatch(_0xd0f3('0x115')));this['moveContactManagedDialer'](_0x58c215)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x116')));}}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x117')]=function(_0x5b9f54){if(this[_0xd0f3('0x20')][_0x5b9f54[_0xd0f3('0xba')]]){if(this[_0xd0f3('0x28')][_0x5b9f54[_0xd0f3('0xed')]]&&this[_0xd0f3('0x28')][_0x5b9f54[_0xd0f3('0xed')]][_0xd0f3('0x53')]!==_0xd0f3('0x7f')){this[_0xd0f3('0xb9')](this[_0xd0f3('0x20')][_0x5b9f54[_0xd0f3('0xba')]]);this['uniqueId'][_0x5b9f54[_0xd0f3('0xed')]]['answertime']=moment()['format'](_0xd0f3('0x114'));}}};Dialer['prototype'][_0xd0f3('0x118')]=function(_0x3a27be){this[_0xd0f3('0xce')](_0x3a27be)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x115')));this[_0xd0f3('0xcd')](_0x3a27be)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x2f')]=function(_0x558829){var _0x1cda26=this[_0xd0f3('0x28')][_0x558829[_0xd0f3('0xed')]];var _0x224375=this;if(this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]]){if(_0x1cda26&&_0x1cda26[_0xd0f3('0x53')]!==_0xd0f3('0x7f')){delete this['uniqueId'][_0x558829[_0xd0f3('0xed')]];this[_0xd0f3('0xb9')](this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]]);_0x1cda26[_0xd0f3('0x119')]=moment()[_0xd0f3('0x7c')](_0xd0f3('0x114'));var _0x297853=new QueueCallerAbandon(_0x1cda26,_0x558829);if(getSeconds(_0x1cda26[_0xd0f3('0x119')],_0x1cda26['responsetime'])>=_0x1cda26[_0xd0f3('0x11a')]){this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x6b')]+=0x1;this['voiceQueues'][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x11b')]+=0x1;this[_0xd0f3('0x20')][_0x558829['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x297853[_0xd0f3('0xac')]=0xa;_0x297853[_0xd0f3('0xad')]=_0xd0f3('0x11c');_0x297853[_0xd0f3('0x11d')]=_0xd0f3('0x11e');_0x297853[_0xd0f3('0x113')]=this['voiceQueues'][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x11f')]?moment()[_0xd0f3('0x7c')](_0xd0f3('0x114')):undefined;_0x297853['countdropretry']+=0x1;_0x297853[_0xd0f3('0xef')]+=0x1;if(_0x297853[_0xd0f3('0xf5')]>=this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x120')]){this[_0xd0f3('0x118')](_0x297853);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x297853[_0xd0f3('0xf5')],'scheduledat':moment()['add'](this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x121')],_0xd0f3('0x108'))[_0xd0f3('0x7c')](_0xd0f3('0x114')),'ContactId':_0x1cda26[_0xd0f3('0xd3')],'ListId':_0x1cda26[_0xd0f3('0xd4')],'VoiceQueueId':_0x1cda26[_0xd0f3('0xff')]||undefined,'CampaignId':_0x1cda26['CampaignId']||undefined})[_0xd0f3('0xb7')](loggerCatch('[rescheduleContact][Drop]'));var _0x3edab1=new History(_0x297853);_0x3edab1[_0xd0f3('0xac')]=0xa;_0x3edab1[_0xd0f3('0xad')]=_0xd0f3('0x11c');_0x3edab1['starttime']=moment()[_0xd0f3('0x7c')](_0xd0f3('0x114'));_0x3edab1[_0xd0f3('0xae')]=_0x3edab1['starttime'];_0x3edab1[_0xd0f3('0x122')]=_0x297853[_0xd0f3('0x122')];_0x3edab1['calleridnum']=_0x297853[_0xd0f3('0x123')];this['createHistory'](_0x3edab1)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x124')));}}else{this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x87')]+=0x1;this[_0xd0f3('0x20')][_0x558829['queue']][_0xd0f3('0x65')]+=0x1;_0x297853[_0xd0f3('0xac')]=0xb;_0x297853[_0xd0f3('0xad')]=_0xd0f3('0x125');_0x297853['dropreason']=_0xd0f3('0x126');_0x297853['countabandonedretry']+=0x1;_0x297853[_0xd0f3('0xef')]+=0x1;if(_0x297853[_0xd0f3('0xf6')]>=this[_0xd0f3('0x20')][_0x558829[_0xd0f3('0xba')]][_0xd0f3('0x127')]){this[_0xd0f3('0x118')](_0x297853);}else{this[_0xd0f3('0xfd')]({'active':![],'countabandonedretry':_0x297853[_0xd0f3('0xf6')],'scheduledat':moment()[_0xd0f3('0xfe')](this[_0xd0f3('0x20')][_0x558829['queue']][_0xd0f3('0x128')],'minutes')['format'](_0xd0f3('0x114')),'ContactId':_0x1cda26[_0xd0f3('0xd3')],'ListId':_0x1cda26[_0xd0f3('0xd4')],'VoiceQueueId':_0x1cda26[_0xd0f3('0xff')]||undefined,'CampaignId':_0x1cda26['CampaignId']||undefined})['catch'](loggerCatch(_0xd0f3('0x129')));var _0x3edab1=new History(_0x297853);_0x3edab1['state']=0xb;_0x3edab1['statedesc']='Abandoned';_0x3edab1[_0xd0f3('0xaf')]=moment()['format'](_0xd0f3('0x114'));_0x3edab1['endtime']=_0x3edab1[_0xd0f3('0xaf')];_0x3edab1[_0xd0f3('0x122')]=_0x297853[_0xd0f3('0x122')];_0x3edab1[_0xd0f3('0x123')]=_0x297853['calleridnum'];this[_0xd0f3('0xce')](_0x3edab1)['catch'](loggerCatch(_0xd0f3('0x12a')));}}}}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x37')]=function(_0x588fd2){if(this[_0xd0f3('0x26')][_0x588fd2['uniqueid']]){this['actions'][_0x588fd2[_0xd0f3('0xed')]][_0xd0f3('0xb6')]=_0x588fd2[_0xd0f3('0xb6')];}if(this['uniqueId'][_0x588fd2['uniqueid']]){this[_0xd0f3('0x28')][_0x588fd2[_0xd0f3('0xed')]]['channel']=_0x588fd2[_0xd0f3('0xb6')];}};Dialer['prototype']['syncQueueMember']=function(_0x23cbf0){if(strategy[this[_0xd0f3('0x20')][this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0xba')]][_0xd0f3('0x54')]]===_0xd0f3('0x19')){if(this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]]&&_[_0xd0f3('0xb3')](this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0x12c')])&&_0x23cbf0['status']==='1'&&_0x23cbf0[_0xd0f3('0x12d')]==='0'){if(this[_0xd0f3('0x22')][_0x23cbf0[_0xd0f3('0x12e')]]){if(!this[_0xd0f3('0x22')][_0x23cbf0[_0xd0f3('0x12e')]][_0xd0f3('0x12c')]){this['agents'][_0x23cbf0[_0xd0f3('0x12e')]]['locked']=!![];this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0x12c')]=!![];this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0x12e')]=_0x23cbf0[_0xd0f3('0x12e')];}}}}else if((strategy[this[_0xd0f3('0x20')][this[_0xd0f3('0x26')][_0x23cbf0['actionid']][_0xd0f3('0xba')]][_0xd0f3('0x54')]]||_0xd0f3('0x12f'))===_0xd0f3('0x12f')){if(this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]]){if(this[_0xd0f3('0x22')][_0x23cbf0[_0xd0f3('0x12e')]]){this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0x12e')]=_0x23cbf0['stateinterface'];if(_['isNil'](this[_0xd0f3('0x2b')][this['actions'][_0x23cbf0[_0xd0f3('0x12b')]]['queue']])){this['queueBooked'][this['actions'][_0x23cbf0[_0xd0f3('0x12b')]][_0xd0f3('0xba')]]=[];}this['queueBooked'][this[_0xd0f3('0x26')][_0x23cbf0['actionid']]['queue']]['push'](_[_0xd0f3('0x92')](_[_0xd0f3('0xd2')](this[_0xd0f3('0x26')][_0x23cbf0[_0xd0f3('0x12b')]],[_0xd0f3('0x130'),_0xd0f3('0x12e')]),{'status':_0x23cbf0[_0xd0f3('0xb5')],'paused':_0x23cbf0[_0xd0f3('0x12d')]}));}}}};function unlockQueueStatus(_0x5cca89,_0x3fcdbc){setTimeout(function(){if(_[_0xd0f3('0x42')](_0x5cca89[_0xd0f3('0x131')])){loggerBooked[_0xd0f3('0x99')]('[unlockQueueStatus][undefined]',_0x3fcdbc);}_0x5cca89[_0xd0f3('0x131')]=!![];loggerBooked[_0xd0f3('0x82')]('[booked][unlockQueueStatus]',_0x3fcdbc,JSON[_0xd0f3('0x4f')](_[_0xd0f3('0xd2')](_0x5cca89,[_0xd0f3('0x49'),_0xd0f3('0x131')])));},0x1f3);}Dialer[_0xd0f3('0x1a')][_0xd0f3('0x3d')]=function(_0x1a1b6a){var _0x1544af=this;var _0x1fc2ad=_0x1544af[_0xd0f3('0x20')][_0x1544af[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]];if(strategy[this['voiceQueues'][this['actions'][_0x1a1b6a['actionid']][_0xd0f3('0xba')]][_0xd0f3('0x54')]]===_0xd0f3('0x19')){if(this['actions'][_0x1a1b6a[_0xd0f3('0x12b')]]&&this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0x12e')]){this[_0xd0f3('0x1f')][_0xd0f3('0x132')](this['actions'][_0x1a1b6a['actionid']][_0xd0f3('0x130')],this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0x12e')])[_0xd0f3('0xb7')](function(_0x4f3c2d){logger['error'](_0xd0f3('0x133'),util[_0xd0f3('0x9b')](_0x4f3c2d,{'showHidden':![],'depth':null}));})[_0xd0f3('0x1d')](function(){_0x1544af[_0xd0f3('0xb9')](_0x1544af[_0xd0f3('0x20')][_0x1544af[_0xd0f3('0x26')][_0x1a1b6a['actionid']]['queue']]);_0x1544af[_0xd0f3('0x22')][_0x1544af[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0x12e')]][_0xd0f3('0x12c')]=![];delete _0x1544af[_0xd0f3('0x26')][_0x1a1b6a['actionid']];unlockQueueStatus(_0x1fc2ad);});}else{this[_0xd0f3('0xb9')](this['voiceQueues'][this['actions'][_0x1a1b6a['actionid']]['queue']]);this[_0xd0f3('0xfd')]({'active':![],'ContactId':this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xd3')],'ListId':this['actions'][_0x1a1b6a['actionid']][_0xd0f3('0xd4')],'VoiceQueueId':this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0xff')]||undefined,'CampaignId':this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]]['CampaignId']||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x134')));delete this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]];unlockQueueStatus(_0x1fc2ad);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]][_0xd0f3('0x54')]]||_0xd0f3('0x12f'))===_0xd0f3('0x12f')){var _0x2533d8;if(this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]]&&!_[_0xd0f3('0x4c')](this[_0xd0f3('0x2b')][this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]])){if(this[_0xd0f3('0x135')][_0x1544af['actions'][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]]){this[_0xd0f3('0x135')][_0x1544af[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]]=this['queueBookedRR'][this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0xba')]]?this[_0xd0f3('0x135')][this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0xba')]]:this[_0xd0f3('0x2b')][this[_0xd0f3('0x26')][_0x1a1b6a['actionid']]['queue']]?this[_0xd0f3('0x2b')][this[_0xd0f3('0x26')][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]][_0xd0f3('0x136')]||0x0:0x0;}this[_0xd0f3('0x2b')][this[_0xd0f3('0x26')][_0x1a1b6a['actionid']][_0xd0f3('0xba')]][_0xd0f3('0x136')]=this[_0xd0f3('0x135')][this['actions'][_0x1a1b6a[_0xd0f3('0x12b')]][_0xd0f3('0xba')]];for(var _0x64c6d2=0x0;_0x64c6d2=0x0;})[_0xd0f3('0xb7')](myreject(_0xae87bb)));}}else{_0x4b33a2[_0xd0f3('0x14e')](ami['Action']({'action':'command','command':util[_0xd0f3('0x7c')]('iftime\x20%s,%s',_0x35e247,!_[_0xd0f3('0x42')](config['timezones'][_0xd520a2])?_0xd520a2:'')})[_0xd0f3('0x41')](function(_0x5ed92b){return _0x5ed92b[_0xd0f3('0x152')][_0xd0f3('0x153')]('true')>=0x0;})[_0xd0f3('0xb7')](myreject(_0xae87bb)));}BPromise[_0xd0f3('0x155')](_0x4b33a2)[_0xd0f3('0x41')](function(_0x62fc5e){var _0x90fb6d=_['some'](_0x62fc5e);if(_0x90fb6d){return _0x5e1931(_0x90fb6d);}else{_0x5343a8[_0xd0f3('0x45')]=_0x30d049?'GLOBAL_INTERVAL_IS_OVERTIME':_0xd0f3('0x156');return _0xae87bb(msgResponse(_0xd0f3('0x157'),_0xd0f3('0x14c'),_0xd0f3('0x158')+_0x30d049+'\x20'+_0x439ab7+_0xd0f3('0x159')+util[_0xd0f3('0x9b')](_0x35e247,{'showHidden':![],'depth':null})+_0xd0f3('0x15a')+_0xd520a2));}})[_0xd0f3('0xb7')](function(_0x3e69c2){return _0xae87bb(msgResponse(_0xd0f3('0x146'),_0xd0f3('0x14c'),JSON[_0xd0f3('0x4f')](_0x3e69c2)));});});};Dialer[_0xd0f3('0x1a')]['checkDialMethod']=function(_0x4ba1fe){var _0x5326a2=this;return function(){switch(_0x4ba1fe['dialMethod']){case _0xd0f3('0x15b'):freeVariablesPredictive(_0x4ba1fe);_0x5326a2['handlePower'](_0x4ba1fe,0x1);break;case'power':freeVariablesPredictive(_0x4ba1fe);_0x5326a2[_0xd0f3('0x15c')](_0x4ba1fe,_0x4ba1fe[_0xd0f3('0x15d')]);break;case _0xd0f3('0x15e'):_0x5326a2[_0xd0f3('0x15e')](_0x4ba1fe);break;case'booked':freeVariablesPredictive(_0x4ba1fe);_0x5326a2[_0xd0f3('0x15c')](_0x4ba1fe,0x1);break;default:freeVariablesPredictive(_0x4ba1fe);logger[_0xd0f3('0x99')](_0xd0f3('0x15f'),_0x4ba1fe['name'],'method\x20not\x20recognized');}};};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x160')]=function(_0x41dd62){return BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](cmHopper[_0xd0f3('0x161')](_0x41dd62['id'],previewRecallmeReminderInterval))['then'](function(_0x580649){for(var _0x16dbdb=0x0;_0x16dbdb<_0x580649[_0xd0f3('0x137')];_0x16dbdb++){var _0x3b72f3=_0x580649[_0x16dbdb][_0xd0f3('0x162')][_0xd0f3('0x49')];if(_0x3b72f3)io['to'](util[_0xd0f3('0x7c')]('user:%s',_0x3b72f3))[_0xd0f3('0x52')]('user:dialPreviewRecallReminder',{'hopper':_0x580649[_0x16dbdb]});}})[_0xd0f3('0xb7')](function(_0x1ed1b8){});};Dialer[_0xd0f3('0x1a')]['launchHandleIvr']=function(_0xffd2bf){var _0x5adc40=this;return function(){_0x5adc40[_0xd0f3('0x163')](_0xffd2bf);};};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xa')]=function(_0x5b0338){var _0x3c093e=this;if(isNotPreview(_0x5b0338['dialMethod'])){if(isVoiceQueueOutbound(_0x5b0338[_0xd0f3('0x53')])&&isActive(_0x5b0338[_0xd0f3('0x5d')])){_0x5b0338[_0xd0f3('0xaa')]=!![];BPromise['resolve']()[_0xd0f3('0x41')](checkIsLoggedIn(_0x5b0338,_0x5b0338['loggedIn']))[_0xd0f3('0x41')](checkIsActive(_0x5b0338,_0x5b0338['dialActive']))[_0xd0f3('0x41')](checkInterval(_0x5b0338))[_0xd0f3('0x41')](_0x3c093e['checkIsTrunkReachable'](_0x5b0338))[_0xd0f3('0x41')](_0x3c093e[_0xd0f3('0x145')](_0x5b0338['dialGlobalInterval'],_0x5b0338[_0xd0f3('0x164')],_0x5b0338[_0xd0f3('0x49')],_0x5b0338))[_0xd0f3('0x41')](_0x3c093e[_0xd0f3('0x147')](_0x5b0338[_0xd0f3('0x47')],_0x5b0338[_0xd0f3('0x164')],_0x5b0338['name'],_0x5b0338))[_0xd0f3('0x41')](_0x3c093e[_0xd0f3('0x165')](_0x5b0338))['catch'](loggerCatchQueueSummary(_0xd0f3('0x166'),_0x5b0338));}else{notSendMessagesQueue(_0x5b0338);}}else{freeVariablesPredictive(_0x5b0338);if(_0x5b0338[_0xd0f3('0x167')]){_0x3c093e['checkPreviewRecallReminder'](_0x5b0338);}}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x141')]=function(){var _0x20b752=this;var _0x47e4f0;for(var _0x8d55d0 in this[_0xd0f3('0x21')]){if(typeof this[_0xd0f3('0x21')][_0x8d55d0]!=='undefined'){_0x47e4f0=this[_0xd0f3('0x21')][_0x8d55d0];if(isCampaignIvr(_0x47e4f0[_0xd0f3('0x53')])&&isActive(_0x47e4f0[_0xd0f3('0x7a')])){_0x47e4f0[_0xd0f3('0xaa')]=!![];BPromise[_0xd0f3('0xbe')]()[_0xd0f3('0x41')](checkIsActive(_0x47e4f0,_0x47e4f0[_0xd0f3('0x7a')]))[_0xd0f3('0x41')](checkInterval(_0x47e4f0))[_0xd0f3('0x41')](_0x20b752[_0xd0f3('0x142')](_0x47e4f0))['then'](_0x20b752[_0xd0f3('0x145')](_0x47e4f0[_0xd0f3('0x168')],_0x47e4f0['dialTimezone'],_0x47e4f0[_0xd0f3('0x49')],_0x47e4f0))['then'](_0x20b752[_0xd0f3('0x147')](_0x47e4f0[_0xd0f3('0x47')],_0x47e4f0[_0xd0f3('0x164')],_0x47e4f0['name'],_0x47e4f0))[_0xd0f3('0x41')](_0x20b752['launchHandleIvr'](_0x47e4f0))[_0xd0f3('0xb7')](loggerCatchQueueSummary(_0xd0f3('0x169'),_0x47e4f0));}else{notSendMessagesCampaign(_0x47e4f0);}}}};function getCallerIdRandom(_0x2a7472,_0x4ed928){var _0x1b5066;var _0x4b6f66;var _0x5b9aaa;if(_0x4ed928<=0x0){_0x4ed928=0x1;}_0x1b5066=new RegExp(_0xd0f3('0x16a')+_0x4ed928+'}$');_0x4b6f66=Math[_0xd0f3('0x16b')](0xa,_0x4ed928-0x1);_0x5b9aaa=Math[_0xd0f3('0x16b')](0xa,_0x4ed928)-0x1;return util['format']('%s',_['replace'](_0x2a7472,_0x1b5066,_['random'](_0x4b6f66,_0x5b9aaa)));}function extractCalleridName(_0x418056){var _0x16d78c=_0x418056[_0xd0f3('0x16c')](/"(.*?)"/);return _0x16d78c?_0x16d78c[0x1]:_0x418056;}function extractCalleridNumber(_0x525acc){var _0x259be6=_0x525acc[_0xd0f3('0x16c')](/<(.*?)>/);return _0x259be6?_0x259be6[0x1]:_0x525acc;}Dialer[_0xd0f3('0x1a')][_0xd0f3('0x16d')]=function(_0xa1c923,_0x5020f1){var _0x4aae49=this;var _0x534627=uuid['v4']();this['actions'][_0x534627]=new Action(_0xa1c923,_0x5020f1,_0x534627);return new BPromise(function(_0x2449a9,_0x3daa01){if(_[_0xd0f3('0x42')](_0xa1c923)&&typeof _0xa1c923!==_0xd0f3('0x16e')){return _0x3daa01(msgResponse(_0xd0f3('0x16f'),_0xd0f3('0x14c'),_0xd0f3('0x170')));}if(_[_0xd0f3('0x42')](_0x5020f1['Contact'][_0xd0f3('0x171')])||_0x5020f1[_0xd0f3('0x172')]['phone']===null){return _0x3daa01(msgResponse(_0xd0f3('0x16f'),_0xd0f3('0x14c'),'contact\x20is\x20undefine'));}var _0x37b82e={'XMD-CALLERID':_0x4aae49[_0xd0f3('0x26')][_0x534627][_0xd0f3('0x173')](),'XMD-AGI':_0xa1c923['dialQueueProject']?util['format'](_0xd0f3('0x174'),ipAgi,_0xa1c923[_0xd0f3('0x10b')]):_0xd0f3('0x175'),'XMD-AGIAFTER':_0xa1c923[_0xd0f3('0x11f')]?util[_0xd0f3('0x7c')](_0xd0f3('0x174'),ipAgi,_0xa1c923['dialQueueProject2']):_0xd0f3('0x175'),'XMD-QUEUE':_0xa1c923[_0xd0f3('0x53')]===_0xd0f3('0x96')?util['format']('\x22%s,%s%s,,,%s\x22',_0xa1c923['name'],_0xa1c923['dialQueueOptions']||'',_0xa1c923[_0xd0f3('0x176')]?'c':'',_0xa1c923[_0xd0f3('0x11a')]||0x3):_0xd0f3('0x175'),'XMD-CONTACTID':_0x5020f1[_0xd0f3('0xd3')],'XMD-CDRTYPE':_0xd0f3('0x8'),'CALLERID(all)':_0x4aae49['actions'][_0x534627][_0xd0f3('0x173')](),'XMD-AMD':_0xa1c923[_0xd0f3('0xe2')]?_0xd0f3('0x177'):_0xd0f3('0x175'),'XMD-DESTINATION':_0xd0f3('0xe1')};if(_0xa1c923[_0xd0f3('0xe2')]){_0x37b82e[_0xd0f3('0x178')]=_0xa1c923[_0xd0f3('0x179')]||0x9c4;_0x37b82e[_0xd0f3('0x17a')]=_0xa1c923[_0xd0f3('0x17b')]||0x5dc;_0x37b82e[_0xd0f3('0x17c')]=_0xa1c923[_0xd0f3('0x17d')]||0x320;_0x37b82e[_0xd0f3('0x17e')]=_0xa1c923[_0xd0f3('0x17f')]||0x1388;_0x37b82e[_0xd0f3('0x180')]=_0xa1c923[_0xd0f3('0x181')]||0x64;_0x37b82e[_0xd0f3('0x182')]=_0xa1c923[_0xd0f3('0x183')]||0x32;_0x37b82e[_0xd0f3('0x184')]=_0xa1c923[_0xd0f3('0x185')]||0x3;_0x37b82e['XMD-AMDSILENCETHRESHOLD']=_0xa1c923[_0xd0f3('0x186')]||0x100;_0x37b82e[_0xd0f3('0x187')]=_0xa1c923[_0xd0f3('0x188')]||0x1388;}if(_0xa1c923['type']==='outbound'){_0x37b82e[_0xd0f3('0x189')]=_0x5020f1[_0xd0f3('0xff')];}else{_0x37b82e['XMD-CAMPAIGNID']=_0x5020f1[_0xd0f3('0x100')];}for(var _0x5e35c9 in _0x5020f1['Contact']){if(typeof _0x5020f1[_0xd0f3('0x172')][_0x5e35c9]!==_0xd0f3('0x9c')){if(isNotNull(_0x5020f1[_0xd0f3('0x172')][_0x5e35c9])&&_0x5e35c9!=='id'&&_0x5e35c9!==_0xd0f3('0x18a')&&_0x5e35c9!==_0xd0f3('0x18b')&&_0x5e35c9!=='updatedAt'){_0x37b82e[util[_0xd0f3('0x7c')]('%s%s','XMD-',_[_0xd0f3('0x18c')](_0x5e35c9))]=_0x5020f1[_0xd0f3('0x172')][_0x5e35c9];}}}var _0x1d2c11=_0x4aae49[_0xd0f3('0xda')](_0xa1c923[_0xd0f3('0x79')])?getCallerId(_0xa1c923[_0xd0f3('0x79')]['callerid'],_0xa1c923[_0xd0f3('0x18d')],_0xa1c923[_0xd0f3('0x18e')]>0x0?getCallerIdRandom(_0xa1c923[_0xd0f3('0x5f')],_0xa1c923[_0xd0f3('0x18e')]):_0xa1c923['dialOriginateCallerIdNumber']):getCallerId(_[_0xd0f3('0xb3')](_0xa1c923[_0xd0f3('0x18f')])?_0xa1c923[_0xd0f3('0x79')][_0xd0f3('0x7b')]:_0xa1c923[_0xd0f3('0x18f')][_0xd0f3('0x7b')],_0xa1c923[_0xd0f3('0x18d')],_0xa1c923['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xa1c923[_0xd0f3('0x5f')],_0xa1c923['dialRandomLastDigitCallerIdNumber']):_0xa1c923[_0xd0f3('0x5f')]);if(_0x1d2c11){_0x37b82e[_0xd0f3('0x190')]=_0x4aae49[_0xd0f3('0x26')][_0x534627][_0xd0f3('0x191')]=extractCalleridName(_0x1d2c11);_0x37b82e[_0xd0f3('0x192')]=_0x4aae49['actions'][_0x534627][_0xd0f3('0x193')]=extractCalleridNumber(_0x1d2c11);}return ami['Action']({'actionid':_0x534627,'action':_0xd0f3('0x16f'),'channel':_0x4aae49[_0xd0f3('0xda')](_0xa1c923[_0xd0f3('0x79')])?util[_0xd0f3('0x7c')](_0xd0f3('0x194'),_0xa1c923[_0xd0f3('0x79')][_0xd0f3('0x49')],isNotNull(_0xa1c923[_0xd0f3('0x61')])?_0xa1c923[_0xd0f3('0x61')]['trim']()||'':'',_0xa1c923[_0xd0f3('0x195')]>0x0?_0x5020f1[_0xd0f3('0x172')][_0xd0f3('0x171')]['substring'](_0xa1c923[_0xd0f3('0x195')]):_0x5020f1['Contact'][_0xd0f3('0x171')]):util['format'](_0xd0f3('0x194'),_[_0xd0f3('0xb3')](_0xa1c923[_0xd0f3('0x18f')])?_0xa1c923[_0xd0f3('0x79')][_0xd0f3('0x49')]:_0xa1c923[_0xd0f3('0x18f')]['name'],isNotNull(_0xa1c923[_0xd0f3('0x61')])?_0xa1c923[_0xd0f3('0x61')][_0xd0f3('0x196')]()||'':'',_0xa1c923[_0xd0f3('0x195')]>0x0?_0x5020f1[_0xd0f3('0x172')][_0xd0f3('0x171')][_0xd0f3('0x197')](_0xa1c923['dialCutDigit']):_0x5020f1['Contact'][_0xd0f3('0x171')]),'callerid':_0x1d2c11,'Exten':_0xd0f3('0xe1'),'Context':_0xd0f3('0x198'),'Priority':'1','variable':_0x37b82e,'timeout':(_0xa1c923[_0xd0f3('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x534627})[_0xd0f3('0x41')](function(_0x1dd642){return _0x2449a9(_0x1dd642);})['catch'](function(_0x50d536){_0xa1c923[_0xd0f3('0x199')]+=0x1;var _0x173fb5=new History(_0x4aae49[_0xd0f3('0x26')][_0x534627]);logger[_0xd0f3('0x99')](util['format'](_0xd0f3('0x19a'),JSON[_0xd0f3('0x4f')](_0x50d536)));_0x173fb5[_0xd0f3('0xac')]=0xe;_0x173fb5[_0xd0f3('0xad')]=_0xd0f3('0x19b');_0x173fb5[_0xd0f3('0xaf')]=moment()[_0xd0f3('0x7c')](_0xd0f3('0x114'));_0x173fb5[_0xd0f3('0xae')]=_0x173fb5[_0xd0f3('0xaf')];_0x4aae49[_0xd0f3('0xce')](_0x173fb5)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x19c')));_0x4aae49[_0xd0f3('0xcd')](_0x173fb5)['catch'](loggerCatch(_0xd0f3('0x19c')))[_0xd0f3('0x1d')](function(){delete _0x4aae49[_0xd0f3('0x26')][_0x534627];return _0x3daa01(msgResponse('originate','Error',_0xd0f3('0x19d')));});});});};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x31')]=function(_0x5ef807){var _0x5818a2=this[_0xd0f3('0x26')][_0x5ef807[_0xd0f3('0x12b')]];if(_0x5818a2){delete this[_0xd0f3('0x26')][_0x5ef807['actionid']];_0x5818a2[_0xd0f3('0x19e')]=moment()['format'](_0xd0f3('0x114'));var _0x14e033=_0x5818a2[_0xd0f3('0x53')]==='ivr'?this[_0xd0f3('0x21')][_0x5818a2[_0xd0f3('0xba')]]:this[_0xd0f3('0x20')][_0x5818a2[_0xd0f3('0x19f')]()];if(!this[_0xd0f3('0xd8')](_0x5ef807['response'])){this[_0xd0f3('0xb9')](_0x14e033);return this['callProgressDetecting'](_0x5818a2,_0x14e033,_0x5ef807)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1a0')));}this[_0xd0f3('0x28')][_0x5ef807['uniqueid']]=_0x5818a2;}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1a1')]=function(_0x57d376,_0x58fc68,_0x384bde){var _0x50fd82=new History(_0x58fc68);if(_0x50fd82[_0xd0f3('0xf1')]+_0x50fd82[_0xd0f3('0xf2')]+_0x50fd82[_0xd0f3('0xf3')]+_0x50fd82[_0xd0f3('0xf4')]+_0x50fd82['countdropretry']+_0x50fd82[_0xd0f3('0xf6')]+_0x50fd82['countmachineretry']+_0x50fd82[_0xd0f3('0xf7')]>=_0x384bde[_0xd0f3('0xf8')]-0x1){return!![];}switch(_0x57d376){case 0x3:if(_0x50fd82[_0xd0f3('0xf3')]>=_0x384bde[_0xd0f3('0x1a2')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countnoanswerretry':_0x50fd82[_0xd0f3('0xf3')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde[_0xd0f3('0x1a3')],_0xd0f3('0x108'))[_0xd0f3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82['ListId'],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82['CampaignId']||undefined})['catch'](loggerCatch(_0xd0f3('0x1a4')));break;case 0x5:if(_0x50fd82['countbusyretry']>=_0x384bde[_0xd0f3('0x1a5')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countbusyretry':_0x50fd82[_0xd0f3('0xf1')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde[_0xd0f3('0x1a6')],_0xd0f3('0x108'))[_0xd0f3('0x7c')](_0xd0f3('0x114')),'ContactId':_0x50fd82['ContactId'],'ListId':_0x50fd82['ListId'],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1a7')));break;case 0x8:if(_0x50fd82['countcongestionretry']>=_0x384bde[_0xd0f3('0x1a8')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countcongestionretry':_0x50fd82[_0xd0f3('0xf2')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde[_0xd0f3('0x1a9')],_0xd0f3('0x108'))[_0xd0f3('0x7c')](_0xd0f3('0x114')),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1aa')));break;case 0x0:if(_0x50fd82['countnosuchnumberretry']>=_0x384bde[_0xd0f3('0x1ab')]-0x1){return!![];}else{this[_0xd0f3('0xfd')]({'active':![],'countnosuchnumberretry':_0x50fd82[_0xd0f3('0xf4')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde['dialNoSuchNumberRetryFrequency'],_0xd0f3('0x108'))[_0xd0f3('0x7c')](_0xd0f3('0x114')),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1ac')));}break;case 0xa:if(_0x50fd82[_0xd0f3('0xf5')]>=_0x384bde[_0xd0f3('0x120')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countdropretry':_0x50fd82['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x384bde['dialDropRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82['VoiceQueueId']||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x50fd82[_0xd0f3('0xf6')]>=_0x384bde[_0xd0f3('0x127')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countabandonedretry':_0x50fd82[_0xd0f3('0xf6')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde['dialAbandonedRetryFrequency'],_0xd0f3('0x108'))['format'](_0xd0f3('0x114')),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x129')));break;case 0x13:if(_0x50fd82[_0xd0f3('0xee')]>=_0x384bde['dialMachineMaxRetry']-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countmachineretry':_0x50fd82[_0xd0f3('0xee')]+=0x1,'scheduledat':moment()['add'](_0x384bde[_0xd0f3('0x107')],_0xd0f3('0x108'))[_0xd0f3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82['VoiceQueueId']||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x101')));break;case 0x14:if(_0x50fd82[_0xd0f3('0xf7')]>=_0x384bde[_0xd0f3('0x1ad')]-0x1){return!![];}this[_0xd0f3('0xfd')]({'active':![],'countagentrejectretry':_0x50fd82[_0xd0f3('0xf7')]+=0x1,'scheduledat':moment()[_0xd0f3('0xfe')](_0x384bde[_0xd0f3('0x1ae')],_0xd0f3('0x108'))['format'](_0xd0f3('0x114')),'ContactId':_0x50fd82[_0xd0f3('0xd3')],'ListId':_0x50fd82[_0xd0f3('0xd4')],'VoiceQueueId':_0x50fd82[_0xd0f3('0xff')]||undefined,'CampaignId':_0x50fd82[_0xd0f3('0x100')]||undefined})['catch'](loggerCatch(_0xd0f3('0x1af')));break;default:return!![];}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1b0')]=function(_0x550a9b,_0x5387c3,_0x16b03f){var _0x4b9759=this;var _0x4ecfee=new History(_0x550a9b);return new BPromise(function(_0xe7fb0a,_0x3e0e7e){if(_['isUndefined'](_0x5387c3)&&typeof _0x5387c3!==_0xd0f3('0x16e')){return _0x3e0e7e(msgResponse('[callProgressDetecting]',_0xd0f3('0x14c'),'entity\x20is\x20undefine'));}if(_[_0xd0f3('0x42')](_0x16b03f)&&typeof _0x16b03f!==_0xd0f3('0x16e')){return _0x3e0e7e(msgResponse(_0xd0f3('0x1b1'),_0xd0f3('0x14c'),_0xd0f3('0x1b2')));}switch(_0x16b03f['reason']){case'0':_0x5387c3[_0xd0f3('0x67')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0x0;_0x4ecfee[_0xd0f3('0xad')]=_0xd0f3('0x1b3');_0x4ecfee[_0xd0f3('0xf4')]+=0x1;_0x4ecfee['countglobal']+=0x1;ami['emit'](_0xd0f3('0x1b4'),ut[_0xd0f3('0xe8')](_0x550a9b,_0xd0f3('0x1b5')));_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4b9759[_0xd0f3('0x1a1')](0x0,_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf4')]>=_0x5387c3[_0xd0f3('0x1ab')]){_0x4b9759['createStateFinal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1b6'));}else{_0x4b9759[_0xd0f3('0xf9')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5387c3[_0xd0f3('0x66')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0x3;_0x4ecfee[_0xd0f3('0xad')]=_0xd0f3('0x1b7');_0x4ecfee[_0xd0f3('0xf3')]+=0x1;_0x4ecfee['countglobal']+=0x1;ami['emit'](_0xd0f3('0x1b8'),ut[_0xd0f3('0xe8')](_0x550a9b,'noanswer'));_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1b9')));if(_0x4b9759[_0xd0f3('0x1a1')](0x3,_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf3')]>=_0x5387c3[_0xd0f3('0x1a2')]){_0x4b9759['createStateFinal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4b9759[_0xd0f3('0xf9')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1ba'));}}break;case'5':_0x5387c3[_0xd0f3('0x1bb')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0x5;_0x4ecfee[_0xd0f3('0xad')]=_0xd0f3('0x1bc');_0x4ecfee[_0xd0f3('0xf1')]+=0x1;_0x4ecfee['countglobal']+=0x1;ami[_0xd0f3('0x52')](_0xd0f3('0x1bd'),ut[_0xd0f3('0xe8')](_0x550a9b,_0xd0f3('0x1be')));_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)['catch'](loggerCatch(_0xd0f3('0x1bf')));if(_0x4b9759[_0xd0f3('0x1a1')](0x5,_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf1')]>=_0x5387c3['dialBusyMaxRetry']){_0x4b9759[_0xd0f3('0x106')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c0'));}else{_0x4b9759[_0xd0f3('0xf9')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c0'));}}break;case'8':_0x5387c3[_0xd0f3('0x63')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0x8;_0x4ecfee[_0xd0f3('0xad')]=_0xd0f3('0x1c1');_0x4ecfee[_0xd0f3('0xf2')]+=0x1;_0x4ecfee[_0xd0f3('0xef')]+=0x1;ami[_0xd0f3('0x52')](_0xd0f3('0x1c2'),ut[_0xd0f3('0xe8')](_0x550a9b,'congestion'));_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)[_0xd0f3('0xb7')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4b9759[_0xd0f3('0x1a1')](0x8,_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf2')]>=_0x5387c3[_0xd0f3('0x1a8')]){_0x4b9759['createStateFinal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c3'));}else{_0x4b9759['stateGlobal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c3'));}}break;case'11':_0x5387c3['outboundAbandonedCallsDay']+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0xb;_0x4ecfee[_0xd0f3('0xad')]=_0xd0f3('0x125');_0x4ecfee['countabandonedretry']+=0x1;_0x4ecfee['countglobal']+=0x1;_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x12a')));if(_0x4b9759['checkRetriveMax'](0xb,_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf6')]>=_0x5387c3[_0xd0f3('0x127')]){_0x4b9759['createStateFinal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,'reason\x2011\x20abandoned');}else{_0x4b9759[_0xd0f3('0xf9')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c4'));}}break;case'20':_0x5387c3[_0xd0f3('0x68')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0x14;_0x4ecfee['statedesc']=_0xd0f3('0x1c5');_0x4ecfee[_0xd0f3('0xf7')]+=0x1;_0x4ecfee['countglobal']+=0x1;ami[_0xd0f3('0x52')](_0xd0f3('0x1c6'),ut['buildObj'](_0x550a9b,_0xd0f3('0x1c7')));_0x4b9759['createHistory'](_0x4ecfee)[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1c8')));if(_0x4b9759[_0xd0f3('0x1a1')](0x14,_0x550a9b,_0x5387c3)){if(_0x4ecfee['countagentrejectretry']>=_0x5387c3[_0xd0f3('0x1ad')]){_0x4b9759[_0xd0f3('0x106')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,'reason\x2020\x20agentreject');}else{_0x4b9759[_0xd0f3('0xf9')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0xd0f3('0x1c9'));}}break;default:_0x5387c3[_0xd0f3('0x10e')]+=0x1;_0x4ecfee[_0xd0f3('0xac')]=0xc;_0x4ecfee['statedesc']=_0x16b03f['reason'];_0x4b9759[_0xd0f3('0xce')](_0x4ecfee)['catch'](loggerCatch(_0xd0f3('0x1ca')));if(_0x4b9759[_0xd0f3('0x1a1')](_0x16b03f['reason'],_0x550a9b,_0x5387c3)){if(_0x4ecfee[_0xd0f3('0xf1')]+_0x4ecfee[_0xd0f3('0xf2')]+_0x4ecfee['countnoanswerretry']+_0x4ecfee['countnosuchnumberretry']+_0x4ecfee[_0xd0f3('0xf5')]+_0x4ecfee['countabandonedretry']+_0x4ecfee[_0xd0f3('0xee')]+_0x4ecfee[_0xd0f3('0xf7')]>=_0x5387c3[_0xd0f3('0xf8')]){_0x4b9759['stateGlobal'](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0x16b03f[_0xd0f3('0x111')]);}else{_0x4b9759[_0xd0f3('0x106')](_0x4ecfee,_0xe7fb0a,_0x3e0e7e,_0x16b03f[_0xd0f3('0x111')]);}}}});};Dialer[_0xd0f3('0x1a')][_0xd0f3('0xf9')]=function(_0x313642,_0x45664b,_0x5cca2e,_0x1b7c2c){var _0xaa94e5=new Final(_0x313642);_0xaa94e5[_0xd0f3('0xac')]=0xf;_0xaa94e5[_0xd0f3('0xad')]=_0xd0f3('0x1cb');this[_0xd0f3('0x106')](_0xaa94e5,_0x45664b,_0x5cca2e,_0x1b7c2c);};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x106')]=function(_0x19c111,_0x3fd31b,_0x32a641,_0xcc466a){this['moveContactManagedDialer'](_0x19c111)[_0xd0f3('0x41')](function(){return _0x3fd31b(msgResponse(_0xd0f3('0x1b1'),_0xd0f3('0xd9'),_0xcc466a));})[_0xd0f3('0xb7')](function(){return _0x32a641(msgResponse(_0xd0f3('0x1cc'),_0xd0f3('0x14c'),_0xd0f3('0x1cd')));});};Dialer[_0xd0f3('0x1a')]['predictive']=function(_0x2ee1b1){var _0x22905d=_0x2ee1b1['dialPredictiveOptimizationPercentage']/0x64;var _0x16354f=_0x2ee1b1[_0xd0f3('0x11b')]/(_0x2ee1b1[_0xd0f3('0x11b')]+_0x2ee1b1[_0xd0f3('0xe4')]);var _0x49575a=Math['round'](_0x2ee1b1['predictiveIntervalAvailable']*(_0x2ee1b1['predictiveIntervalMaxThreshold']/0x64));var _0x46286c=Math[_0xd0f3('0x1ce')](_0x2ee1b1['predictiveIntervalAvailable']*(_0x2ee1b1[_0xd0f3('0x1cf')]/0x64));var _0xe26cee=_0x2ee1b1[_0xd0f3('0xa6')]+_0x2ee1b1[_0xd0f3('0xa4')];var _0x1a6ff5=Math[_0xd0f3('0x1d0')](_0x2ee1b1[_0xd0f3('0x74')]*_0x2ee1b1[_0xd0f3('0x76')]*_0x2ee1b1['predictiveIntervalHitRate']*_0x2ee1b1[_0xd0f3('0x6f')]);if(_[_0xd0f3('0x42')](_0x2ee1b1[_0xd0f3('0x78')])){if(!_[_0xd0f3('0x42')](_0x2ee1b1[_0xd0f3('0x2a')])){_0x2ee1b1['startPredictive']=undefined;loggerPredictive[_0xd0f3('0x99')](_0xd0f3('0x1d1'),_0xd0f3('0x1d2'));}if(!_[_0xd0f3('0x42')](_0x2ee1b1[_0xd0f3('0x94')])){loggerPredictive[_0xd0f3('0x99')](_0xd0f3('0x1d1'),_0xd0f3('0x1d3'));clearInterval(_0x2ee1b1[_0xd0f3('0x94')]);_0x2ee1b1[_0xd0f3('0x94')]=undefined;}_0x2ee1b1[_0xd0f3('0x78')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2ee1b1['name'],_0xd0f3('0x1d4'),_0x2ee1b1[_0xd0f3('0x78')]);this[_0xd0f3('0x15c')](_0x2ee1b1,0x1);}else if(ifInterval(_0x2ee1b1[_0xd0f3('0x1d5')],_0x2ee1b1[_0xd0f3('0x78')])){this[_0xd0f3('0x15c')](_0x2ee1b1,0x1);loggerPredictiveCalls[_0xd0f3('0x82')](_0xd0f3('0x1d6'),_0x2ee1b1[_0xd0f3('0x78')],_0x2ee1b1[_0xd0f3('0x49')]);_0x2ee1b1['erlangCalls']=0x0;_0x2ee1b1['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x22905d<_0x16354f&&_0x2ee1b1['dialPredictiveOptimization']===_0xd0f3('0x1d7')){freeVariablesPredictive(_0x2ee1b1);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x1d8'),'Dropped\x20calls\x20day',_0x16354f,_0xd0f3('0x78'),_0x2ee1b1['name']);}else if(_0x1a6ff5<_0x2ee1b1[_0xd0f3('0x6d')]&&_0x2ee1b1[_0xd0f3('0x1d9')]===_0xd0f3('0x1d7')){freeVariablesPredictive(_0x2ee1b1);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x1da'),_0xd0f3('0x1db'),_0x1a6ff5,_0xd0f3('0x1dc'),_0x2ee1b1[_0xd0f3('0x6d')],_0xd0f3('0x78'),_0x2ee1b1['name']);}else if(!ifInterval(_0x2ee1b1['dialPredictiveInterval'],_0x2ee1b1[_0xd0f3('0x78')])&&_[_0xd0f3('0x42')](_0x2ee1b1['startPredictive'])&&!_[_0xd0f3('0x42')](_0x2ee1b1[_0xd0f3('0x78')])){_0x2ee1b1[_0xd0f3('0x2a')]=moment()[_0xd0f3('0x7c')](_0xd0f3('0x114'));loggerPredictive[_0xd0f3('0x82')](_0x2ee1b1['name'],'started\x20in\x20predictive\x20at',_0x2ee1b1[_0xd0f3('0x2a')]);this['averageHandleTime'](_0x2ee1b1[_0xd0f3('0x1d5')])['then'](this['getDataPredictive'](_0x2ee1b1))[_0xd0f3('0x41')](mergeDataErlangB(_0x2ee1b1))[_0xd0f3('0x41')](this[_0xd0f3('0x1dd')](_0x2ee1b1))[_0xd0f3('0xb7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2ee1b1));}else if(!ifInterval(_0x2ee1b1[_0xd0f3('0x1d5')],_0x2ee1b1[_0xd0f3('0x2a')])){_0x2ee1b1['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2ee1b1[_0xd0f3('0x2a')]=moment()[_0xd0f3('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xd0f3('0x82')](_0x2ee1b1[_0xd0f3('0x49')],_0xd0f3('0x1de'),_0x2ee1b1[_0xd0f3('0x2a')]);clearInterval(_0x2ee1b1[_0xd0f3('0x94')]);_0x2ee1b1[_0xd0f3('0x94')]=undefined;this[_0xd0f3('0xc2')](_0x2ee1b1[_0xd0f3('0x1d5')])[_0xd0f3('0x41')](this[_0xd0f3('0x1df')](_0x2ee1b1))['then'](mergeDataErlangB(_0x2ee1b1))[_0xd0f3('0x41')](this[_0xd0f3('0x1dd')](_0x2ee1b1))[_0xd0f3('0xb7')](loggerCatchPredictive(_0xd0f3('0x1e0'),_0x2ee1b1));}else if(_0x2ee1b1[_0xd0f3('0x71')]&&_0xe26cee<_0x2ee1b1[_0xd0f3('0x71')]-_0x46286c){freeVariablesPredictive(_0x2ee1b1);loggerPredictive[_0xd0f3('0x82')](_0x2ee1b1[_0xd0f3('0x49')],_0xd0f3('0x1e1'),_0xe26cee,_0xd0f3('0x1e2'),_0x2ee1b1['predictiveIntervalAvailable'],'-',_0x46286c,'=',_0x2ee1b1[_0xd0f3('0x71')]-_0x46286c,')');}else if(_0x2ee1b1['predictiveIntervalAvailable']&&_0xe26cee>_0x2ee1b1[_0xd0f3('0x71')]+_0x49575a){freeVariablesPredictive(_0x2ee1b1);loggerPredictive[_0xd0f3('0x82')](_0x2ee1b1['name'],_0xd0f3('0x1e1'),_0xe26cee,_0xd0f3('0x1e3'),_0x2ee1b1[_0xd0f3('0x71')],'+',_0x49575a,'=',_0x2ee1b1[_0xd0f3('0x71')]+_0x49575a,')');}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1df')]=function(_0x52be7a){var _0x427c50=this;return function(_0x3c0699){return new BPromise(function(_0x1a7894,_0x5eb33c){_[_0xd0f3('0x92')](_0x52be7a,_0x3c0699[0x0]);if(checkGetDataPredictive(_0x3c0699[0x0])){var _0x30e79=_0x52be7a['predictiveIntervalAvailable']=_0x52be7a[_0xd0f3('0xa4')]+_0x52be7a[_0xd0f3('0xa6')];var _0x806dab=_0x52be7a[_0xd0f3('0x1d5')]*0x3c;var _0x54d4c4=_0x3c0699[0x0][_0xd0f3('0x8a')]+_0x3c0699[0x0][_0xd0f3('0x6a')];var _0x52ea46=(_0x3c0699[0x0][_0xd0f3('0x69')]+_0x3c0699[0x0][_0xd0f3('0x6b')]+_0x3c0699[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3c0699[0x0][_0xd0f3('0x72')];_0x52be7a[_0xd0f3('0x6e')]=_0x52ea46>0x0?_0x52ea46:0x1;switch(_0x52be7a[_0xd0f3('0x1d9')]){case _0xd0f3('0x1d7'):var _0xf5efec=_0x52be7a[_0xd0f3('0x1e4')]/0x64;return _0x427c50['abandonmentRate'](_0x30e79,_0x806dab,_0x54d4c4,_0x52ea46,_0xf5efec)[_0xd0f3('0x41')](function(_0x3c39a1){return _0x1a7894(_0x3c39a1);});case _0xd0f3('0x1e5'):var _0x5b7c9f=_0x52be7a['dialPredictiveOptimizationPercentage']/0x64;return _0x427c50[_0xd0f3('0x1e6')](_0x30e79,_0x806dab,_0x54d4c4,_0x52ea46,_0x5b7c9f)[_0xd0f3('0x41')](function(_0x28d3c6){return _0x1a7894(_0x28d3c6);});default:return _0x5eb33c(msgResponse(_0xd0f3('0x1e7'),_0xd0f3('0x14c'),_0xd0f3('0x1e8')));}}else{return _0x5eb33c(msgResponse(_0xd0f3('0x1e7'),_0xd0f3('0x14c'),_0xd0f3('0x1e9')));}});};};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1ea')]=function(_0x22f28a){var _0x34f423=this;return function(_0x5c0b53){return new BPromise(function(_0x367c23,_0x48cedd){_[_0xd0f3('0x92')](_0x22f28a,_0x5c0b53[0x0]);if(checkGetDataPredictive(_0x5c0b53[0x0])){loggerPredictive[_0xd0f3('0x82')](JSON[_0xd0f3('0x4f')](_0x5c0b53[0x0]));if(_0x22f28a[_0xd0f3('0x1d9')]==='dropRate'){return _0x34f423[_0xd0f3('0xcb')](_0x22f28a['id'])[_0xd0f3('0x41')](function(_0x21568d){var _0x5c1feb=_0x22f28a['loggedIn']-_0x21568d[0x0][_0xd0f3('0x1eb')];var _0x564cb6=_0x22f28a[_0xd0f3('0x1d5')]*0x3c;var _0x5da627=_0x5c0b53[0x0][_0xd0f3('0x8a')]+_0x5c0b53[0x0][_0xd0f3('0x6a')];var _0xfec846=(_0x5c0b53[0x0][_0xd0f3('0x69')]+_0x5c0b53[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5c0b53[0x0][_0xd0f3('0x87')])/_0x5c0b53[0x0][_0xd0f3('0x72')];var _0x3dc04f=_0x22f28a['dialPredictiveOptimizationPercentage']/0x64;_0x22f28a[_0xd0f3('0x70')]=_0x21568d[0x0]['outboundQueuePauses']||0x0;_0x22f28a[_0xd0f3('0x6e')]=_0xfec846>0x0?_0xfec846:0x1;return _0x34f423[_0xd0f3('0x1ec')](_0x5c1feb,_0x564cb6,_0x5da627,_0xfec846,_0x3dc04f);})[_0xd0f3('0x41')](function(_0x4bb529){return _0x367c23(_0x4bb529);})[_0xd0f3('0xb7')](function(_0x28d914){return _0x48cedd(msgResponse('[CatchErlangB]',_0xd0f3('0x14c'),JSON[_0xd0f3('0x4f')](_0x28d914)));});}if(_0x22f28a[_0xd0f3('0x1d9')]===_0xd0f3('0x1e5')){return _0x34f423[_0xd0f3('0xcb')](_0x22f28a['id'])[_0xd0f3('0x41')](function(_0x431f52){var _0x461e46=_0x22f28a[_0xd0f3('0x56')]-_0x431f52[0x0][_0xd0f3('0x1eb')];var _0x5a1a72=_0x22f28a['dialPredictiveInterval']*0x3c;var _0x17d114=_0x5c0b53[0x0][_0xd0f3('0x8a')]+_0x5c0b53[0x0][_0xd0f3('0x6a')];var _0x36205d=(_0x5c0b53[0x0]['predictiveIntervalAnsweredCalls']+_0x5c0b53[0x0][_0xd0f3('0x6b')]+_0x5c0b53[0x0][_0xd0f3('0x87')])/_0x5c0b53[0x0][_0xd0f3('0x72')];var _0x2528a1=_0x22f28a[_0xd0f3('0x1e4')]/0x64;_0x22f28a[_0xd0f3('0x70')]=_0x431f52[0x0][_0xd0f3('0x1eb')]||0x0;_0x22f28a[_0xd0f3('0x6e')]=_0x36205d>0x0?_0x36205d:0x1;return _0x34f423[_0xd0f3('0x1e6')](_0x461e46,_0x5a1a72,_0x17d114,_0x36205d,_0x2528a1);})[_0xd0f3('0x41')](function(_0x2671bc){return _0x367c23(_0x2671bc);})[_0xd0f3('0xb7')](function(_0x2d1a1f){return _0x48cedd(msgResponse(_0xd0f3('0x1ed'),'Failure',JSON[_0xd0f3('0x4f')](_0x2d1a1f)));});}}else{return _0x48cedd(msgResponse(_0xd0f3('0x1e7'),_0xd0f3('0x14c'),_0xd0f3('0x1e9')));}});};};Dialer[_0xd0f3('0x1a')]['startMethodPredictive']=function(_0x1f3df1){var _0x2f88c6=this;return function(){var _0x33171e=0x0;var _0x5d04d9=Math[_0xd0f3('0x1d0')](_0x1f3df1[_0xd0f3('0x75')]*0x3e8);if(_0x5d04d9>0x0){_0x5d04d9=_0x5d04d9<0x64?0x64:_0x5d04d9;loggerPredictive[_0xd0f3('0x82')](_0x1f3df1[_0xd0f3('0x49')],_0xd0f3('0x1ee'),_0x5d04d9,'milliseconds');_0x1f3df1['handlePredictive']=setInterval(function(){_0x2f88c6[_0xd0f3('0x94')](_0x1f3df1);loggerPredictiveCalls[_0xd0f3('0x82')](_0xd0f3('0x1ef'),_0x33171e+=0x1);},_0x5d04d9);}else{loggerPredictive[_0xd0f3('0x82')](_0x1f3df1['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1f0')]=function(_0x53017e,_0x56edde){var _0x3e0cce=this;return function(_0x3a5984){if(_[_0xd0f3('0x4c')](_0x3a5984)){if(_[_0xd0f3('0xb3')](_0x56edde['UserId'])||!_0x56edde[_0xd0f3('0x1f1')]){if(_0x53017e[_0xd0f3('0x5e')]===_0xd0f3('0x9')){_0x53017e['queueStatusComplete']=_[_0xd0f3('0x42')](_0x53017e['queueStatusComplete'])?!![]:_0x53017e[_0xd0f3('0x131')];var _0x176966=uuid['v4']();_0x3e0cce[_0xd0f3('0x26')][_0x176966]=new Action(_0x53017e,_0x56edde,_0x176966);loggerBooked[_0xd0f3('0x82')](_0xd0f3('0x1f2'),_0x176966,_0xd0f3('0x1f3'),JSON[_0xd0f3('0x4f')](_0x53017e[_0xd0f3('0x131')]),_0xd0f3('0x1f4'),_0x53017e[_0xd0f3('0x49')]);if(_0x53017e[_0xd0f3('0x131')]){_0x53017e[_0xd0f3('0x131')]=![];_0x3e0cce[_0xd0f3('0x2b')][_0x3e0cce[_0xd0f3('0x26')][_0x176966]['queue']]=[];ami[_0xd0f3('0xb4')]({'actionid':_0x176966,'action':'queuestatus','queue':_0x53017e[_0xd0f3('0x49')]})[_0xd0f3('0xb7')](function(){_0x3e0cce[_0xd0f3('0xb9')](_0x53017e);_0x3e0cce['rescheduleContact']({'active':![],'ContactId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0xd3')],'ListId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0xd4')],'VoiceQueueId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0xff')]||undefined,'CampaignId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1f5')));delete _0x3e0cce[_0xd0f3('0x26')][_0x176966];});}else{loggerBooked[_0xd0f3('0x82')](_0xd0f3('0x1f6'),JSON['stringify'](_0x53017e[_0xd0f3('0x131')]),_0xd0f3('0x1f4'),_0x53017e[_0xd0f3('0x49')]);_0x3e0cce[_0xd0f3('0xb9')](_0x53017e);_0x3e0cce['rescheduleContact']({'active':![],'ContactId':_0x3e0cce[_0xd0f3('0x26')][_0x176966]['ContactId'],'ListId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0xd4')],'VoiceQueueId':_0x3e0cce[_0xd0f3('0x26')][_0x176966]['VoiceQueueId']||undefined,'CampaignId':_0x3e0cce[_0xd0f3('0x26')][_0x176966][_0xd0f3('0x100')]||undefined})[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1f5')));delete _0x3e0cce['actions'][_0x176966];}}else{return _0x3e0cce[_0xd0f3('0x16d')](_0x53017e,_0x56edde);}}else{if(getDiff(_0x56edde[_0xd0f3('0x1f7')])<_0x53017e[_0xd0f3('0x1f8')]*0x3c){if(_0x56edde[_0xd0f3('0x162')]&&!_0x56edde[_0xd0f3('0x162')][_0xd0f3('0x1f9')]){_0x3e0cce[_0xd0f3('0x1f')][_0xd0f3('0x132')](_0x56edde['id'])[_0xd0f3('0x1d')](function(){_0x3e0cce['updateOriginated'](_0x53017e);});}else{_0x3e0cce[_0xd0f3('0xc6')]({'active':![]},_0x56edde['id'],0x1)[_0xd0f3('0x1d')](function(){_0x3e0cce[_0xd0f3('0xb9')](_0x53017e);});}}else{_0x53017e[_0xd0f3('0x1fa')]+=0x1;_0x3e0cce[_0xd0f3('0xb9')](_0x53017e);if(_0x53017e[_0xd0f3('0x1fb')]){_0x3e0cce['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x56edde[_0xd0f3('0xd3')],'ListId':_0x56edde['ListId'],'VoiceQueueId':_0x56edde[_0xd0f3('0xff')]||undefined,'CampaignId':_0x56edde[_0xd0f3('0x100')]||undefined})['catch'](loggerCatch(_0xd0f3('0x1fc')));_0x3e0cce[_0xd0f3('0xce')](createObjHistory(_0x53017e,_0x56edde,_0xd0f3('0x1fd'),0x17,_0xd0f3('0x1fe')))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0x1ff')));}else{_0x3e0cce[_0xd0f3('0xdd')](createObjHistory(_0x53017e,_0x56edde,_0xd0f3('0x200'),0x16,_0xd0f3('0x201')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x53017e[_0xd0f3('0x202')]+=0x1;_0x3e0cce['saveInDb'](createObjHistory(_0x53017e,_0x56edde,_0xd0f3('0x203'),0xd,_0xd0f3('0x204')),'[Originate][historyBlacklist]',_0xd0f3('0x205'));throw _0xd0f3('0x206');}};};Dialer['prototype']['handleIvr']=function(_0x4bae8a){var _0x26b067=this;var _0x142cd1=_0x4bae8a[_0xd0f3('0x207')]-_0x4bae8a['originated']-_0x4bae8a[_0xd0f3('0xc9')];emitCampaignSummary(_0x4bae8a);if(_0x142cd1>0x0){if(_0x142cd1>this[_0xd0f3('0x24')]){_0x142cd1=this[_0xd0f3('0x24')];}_0x4bae8a[_0xd0f3('0xc9')]+=_0x142cd1;this[_0xd0f3('0xca')](_0x4bae8a['id'],_0x142cd1,_0x4bae8a[_0xd0f3('0x208')],_0x4bae8a)[_0xd0f3('0x41')](function(_0x3420ea){_0x4bae8a[_0xd0f3('0xc9')]-=_0x142cd1;_0x4bae8a['temp']=_0x4bae8a['temp']>0x0?_0x4bae8a[_0xd0f3('0xc9')]:0x0;if(!checkContactEmpty(_0x3420ea)){_0x4bae8a['message']=_0xd0f3('0xa3');logger[_0xd0f3('0x82')]('[getContactCampaign2][Empty]'+_0x4bae8a[_0xd0f3('0x49')]);}else{_0x4bae8a[_0xd0f3('0x73')]+=_0x3420ea['length'];_0x4bae8a[_0xd0f3('0x45')]=_0xd0f3('0x209');for(var _0x1cbc96=0x0;_0x1cbc96<_0x3420ea[_0xd0f3('0x137')];_0x1cbc96+=0x1){_0x4bae8a[_0xd0f3('0x20a')]+=0x1;if(_['isNil'](_0x3420ea[_0x1cbc96])||_[_0xd0f3('0xb3')](_0x3420ea[_0x1cbc96][_0xd0f3('0x172')])||_[_0xd0f3('0xb3')](_0x3420ea[_0x1cbc96]['Contact']['phone'])){_0x26b067[_0xd0f3('0xd0')](_0xd0f3('0x20b'),_0x4bae8a,_0x3420ea[_0x1cbc96]);}else{_0x26b067[_0xd0f3('0xc0')](_['pick'](_0x3420ea[_0x1cbc96],['CampaignId',_0xd0f3('0x20c')]))[_0xd0f3('0x41')](_0x26b067['checkContactBlack'](_0x4bae8a,_0x3420ea[_0x1cbc96]))['catch'](_0x26b067[_0xd0f3('0xcf')](_0xd0f3('0x20d'),_0x4bae8a));}}}})[_0xd0f3('0xb7')](loggerGetContactDialer('[getContactCampaign2]',_0x4bae8a,_0x142cd1));}};Dialer[_0xd0f3('0x1a')]['handlePower']=function(_0x293ef5,_0x26e736){var _0xcc463d=this;var _0x5ca1c5=[];var _0x13838b=_0x26e736>=0x1?_0x26e736:0x1;if(_0x293ef5[_0xd0f3('0x5e')]==='booked'){_0x13838b=0x1;}var _0x4d8e8e=Math[_0xd0f3('0x1d0')](_0x293ef5[_0xd0f3('0xa6')]*_0x13838b)-_0x293ef5[_0xd0f3('0x73')]-_0x293ef5[_0xd0f3('0xc9')];emitVoiceQueueSummary(_0x293ef5);if(_0x293ef5[_0xd0f3('0x20e')]>0x0){var _0x10bfb4=_0x293ef5[_0xd0f3('0x20e')]-_0x293ef5['originated']-_0x293ef5[_0xd0f3('0xa4')]-_0x293ef5[_0xd0f3('0xc9')]-_0x293ef5[_0xd0f3('0x57')];if(_0x4d8e8e>_0x10bfb4){_0x4d8e8e=_0x10bfb4;}}if(_0x4d8e8e>0x0){if(_0x293ef5[_0xd0f3('0x5e')]==='booked'){_0x4d8e8e=0x1;}if(_0x4d8e8e>this['maxNumberOriginate']){_0x4d8e8e=this['maxNumberOriginate'];}_0x293ef5[_0xd0f3('0xc9')]+=_0x4d8e8e;for(var _0x2ed12a in this['agents']){if(typeof this[_0xd0f3('0x22')][_0x2ed12a]!==_0xd0f3('0x9c')){if(this[_0xd0f3('0x22')][_0x2ed12a][_0xd0f3('0xac')]==='not_inuse'&&this[_0xd0f3('0x22')][_0x2ed12a][_0xd0f3('0xb5')]===_0xd0f3('0x20f')){_0x5ca1c5[_0xd0f3('0x14e')](this[_0xd0f3('0x22')][_0x2ed12a]['id']);}}}this['getContactDialer'](_0x293ef5['id'],_0x5ca1c5,_0x4d8e8e,_0x293ef5[_0xd0f3('0x208')],_0x293ef5)[_0xd0f3('0x41')](function(_0x372be7){_0x293ef5[_0xd0f3('0xc9')]-=_0x4d8e8e;_0x293ef5[_0xd0f3('0xc9')]=_0x293ef5[_0xd0f3('0xc9')]>0x0?_0x293ef5[_0xd0f3('0xc9')]:0x0;if(!checkContactEmpty(_0x372be7)){_0xcc463d[_0xd0f3('0xbb')](_0x293ef5)['then'](sendMessageReschedule(_0x293ef5))[_0xd0f3('0xb7')](loggerCatch(_0xd0f3('0xbc')));}else{_0x293ef5[_0xd0f3('0x73')]+=_0x372be7[_0xd0f3('0x137')];_0x293ef5[_0xd0f3('0x45')]=_0x293ef5[_0xd0f3('0x5e')]===_0xd0f3('0x9')?'ACTIVE':_0xd0f3('0x209');for(var _0x1619d4=0x0;_0x1619d4<_0x372be7[_0xd0f3('0x137')];_0x1619d4+=0x1){if(_[_0xd0f3('0xb3')](_0x372be7[_0x1619d4])||_[_0xd0f3('0xb3')](_0x372be7[_0x1619d4]['Contact'])||_[_0xd0f3('0xb3')](_0x372be7[_0x1619d4][_0xd0f3('0x172')][_0xd0f3('0x171')])){_0xcc463d['emptyContact'](_0xd0f3('0x20b'),_0x293ef5,_0x372be7[_0x1619d4]);}else{_0xcc463d[_0xd0f3('0xbd')](_[_0xd0f3('0xd2')](_0x372be7[_0x1619d4],['VoiceQueueId','Contact.phone']))[_0xd0f3('0x41')](_0xcc463d['checkContactBlack'](_0x293ef5,_0x372be7[_0x1619d4]))['catch'](_0xcc463d[_0xd0f3('0xcf')]('[actionOriginate]\x20',_0x293ef5));}}}})['catch'](loggerGetContactDialer(_0xd0f3('0x210'),_0x293ef5,_0x4d8e8e));}};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x94')]=function(_0x30cedd){if(_0x30cedd[_0xd0f3('0x20e')]>0x0){var _0x24c8dc=_0x30cedd[_0xd0f3('0x20e')]-_0x30cedd[_0xd0f3('0x73')]-_0x30cedd[_0xd0f3('0xa4')];if(_0x24c8dc>0x0){this['tryOriginatePredictive'](_0x30cedd);}else{loggerPredictiveCalls[_0xd0f3('0x82')]('[handlePredictive][limitChannel]');}}else{this[_0xd0f3('0x211')](_0x30cedd);}};Dialer['prototype'][_0xd0f3('0x211')]=function(_0x46a6af){var _0x390740=this;var _0x53a13f=[];_0x46a6af[_0xd0f3('0x73')]+=0x1;for(var _0x5a81ce in this['agents']){if(typeof this['agents'][_0x5a81ce]!==_0xd0f3('0x9c')){if(this[_0xd0f3('0x22')][_0x5a81ce][_0xd0f3('0xac')]===_0xd0f3('0x212')&&this[_0xd0f3('0x22')][_0x5a81ce][_0xd0f3('0xb5')]===_0xd0f3('0x20f')){_0x53a13f['push'](this[_0xd0f3('0x22')][_0x5a81ce]['id']);}}}this[_0xd0f3('0xc8')](_0x46a6af['id'],_0x53a13f,0x1,_0x46a6af[_0xd0f3('0x208')],_0x46a6af)['then'](function(_0x1f29d7){if(!checkContactEmpty(_0x1f29d7)){checkContactLowerLimitOriginate(_0x46a6af,0x1,0x0);_0x390740['countReScheduled'](_0x46a6af)[_0xd0f3('0x41')](sendMessageReschedule(_0x46a6af))[_0xd0f3('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x46a6af[_0xd0f3('0x45')]='RUNNING';if(_[_0xd0f3('0xb3')](_0x1f29d7[0x0])||_[_0xd0f3('0xb3')](_0x1f29d7[0x0]['Contact'])||_['isNil'](_0x1f29d7[0x0][_0xd0f3('0x172')]['phone'])){_0x390740[_0xd0f3('0xd0')](_0xd0f3('0x20b'),_0x46a6af,_0x1f29d7[0x0]);}else{_0x390740[_0xd0f3('0xbd')](_[_0xd0f3('0xd2')](_0x1f29d7[0x0],[_0xd0f3('0xff'),_0xd0f3('0x20c')]))[_0xd0f3('0x41')](_0x390740[_0xd0f3('0x1f0')](_0x46a6af,_0x1f29d7[0x0]))[_0xd0f3('0xb7')](_0x390740['loggerHandler']('[actionOriginatePredictive]\x20',_0x46a6af));}}})['catch'](loggerGetContactDialer(_0xd0f3('0x213'),_0x46a6af,0x1));emitVoiceQueueSummary(_0x46a6af);};Dialer[_0xd0f3('0x1a')][_0xd0f3('0x1ec')]=function(_0x44bdad,_0x57675f,_0x404c99,_0x50f33f,_0x5295e5,_0x2b2953){loggerPredictive['info'](_0xd0f3('0x214'));loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x215'),_0x44bdad);loggerPredictive['info'](_0xd0f3('0x216'),_0x57675f);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x217'),_0x404c99);loggerPredictive['info'](_0xd0f3('0x218'),_0x50f33f);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x219'),_0x5295e5);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x8b'));return new BPromise(function(_0x52d95f,_0x16bf2f){if(_0x44bdad<=0x0||isNaN(_0x44bdad)){return _0x16bf2f(msgResponse(_0xd0f3('0x21a'),'Error',_0xd0f3('0x21b')+_0x44bdad));}if(_0x404c99<=0x0||isNaN(_0x404c99)){return _0x16bf2f(msgResponse('[abandonmentRate]',_0xd0f3('0x4e'),_0xd0f3('0x21c')+_0x404c99));}if(_0x50f33f<=0x0||isNaN(_0x50f33f)){return _0x16bf2f(msgResponse('[abandonmentRate]',_0xd0f3('0x4e'),'p\x20=\x20'+_0x50f33f));}if(_0x57675f<=0x0||isNaN(_0x57675f)){return _0x16bf2f(msgResponse(_0xd0f3('0x21a'),'Error',_0xd0f3('0x21d')+_0x57675f));}if(_0x5295e5<=0x0||isNaN(_0x5295e5)){return _0x16bf2f(msgResponse(_0xd0f3('0x21a'),_0xd0f3('0x4e'),_0xd0f3('0x21e')+_0x5295e5));}_0x2b2953=_0x2b2953||0x0;var _0x161aa7=0x1/_0x404c99;var _0x5829e7=0x0;var _0x24d506=0x0;var _0x2cadec=0x0;var _0x572930=0x0;for(var _0x1f842e=0x0;_0x2cadec<_0x5295e5;_0x1f842e+=0x1){_0x24d506=_0x1f842e/_0x57675f;_0x5829e7=(_0x50f33f*_0x24d506+_0x2b2953)/_0x161aa7;_0x2cadec=erlangb(_0x5829e7,_0x44bdad);_0x572930=_0x5829e7/_0x44bdad*(0x1-erlangb(_0x5829e7,_0x44bdad));}return _0x52d95f({'erlangCalls':_0x1f842e,'erlangCallToSecond':_0x57675f/_0x1f842e,'erlangAbandonmentRate':_0x2cadec,'erlangBusyFactor':_0x572930});});};Dialer['prototype'][_0xd0f3('0x1e6')]=function(_0x55cc90,_0x4fd5aa,_0x10b8f8,_0x376a95,_0x1a2382,_0x37c829){loggerPredictive['info'](_0xd0f3('0x21f'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55cc90);loggerPredictive[_0xd0f3('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4fd5aa);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x217'),_0x10b8f8);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x218'),_0x376a95);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x220'),_0x1a2382);loggerPredictive[_0xd0f3('0x82')](_0xd0f3('0x8b'));return new BPromise(function(_0x3ed6ff,_0x2f8981){if(_0x55cc90<=0x0||isNaN(_0x55cc90)){return _0x2f8981(msgResponse(_0xd0f3('0x221'),_0xd0f3('0x4e'),_0xd0f3('0x21b')+_0x55cc90));}if(_0x10b8f8<=0x0||isNaN(_0x10b8f8)){return _0x2f8981(msgResponse(_0xd0f3('0x221'),_0xd0f3('0x4e'),_0xd0f3('0x21c')+_0x10b8f8));}if(_0x376a95<=0x0||isNaN(_0x376a95)){return _0x2f8981(msgResponse(_0xd0f3('0x221'),'Error','p\x20=\x20'+_0x376a95));}if(_0x4fd5aa<=0x0||isNaN(_0x4fd5aa)){return _0x2f8981(msgResponse('[busyFactor]',_0xd0f3('0x4e'),_0xd0f3('0x21d')+_0x4fd5aa));}if(_0x1a2382<=0x0||isNaN(_0x1a2382)){return _0x2f8981(msgResponse(_0xd0f3('0x221'),_0xd0f3('0x4e'),'Umin\x20=\x20'+_0x1a2382));}_0x37c829=_0x37c829||0x0;var _0x203d51=0x1/_0x10b8f8;var _0x2e99bf=0x0;var _0x658e53=0x0;var _0x619bad=0x0;var _0x5c3451=0x0;for(var _0x1534a8=0x0;_0x5c3451<_0x1a2382;_0x1534a8+=0x1){_0x658e53=_0x1534a8/_0x4fd5aa;_0x2e99bf=(_0x376a95*_0x658e53+_0x37c829)/_0x203d51;_0x619bad=erlangb(_0x2e99bf,_0x55cc90);_0x5c3451=_0x2e99bf/_0x55cc90*(0x1-erlangb(_0x2e99bf,_0x55cc90));}return _0x3ed6ff({'erlangCalls':_0x1534a8,'erlangCallToSecond':_0x4fd5aa/_0x1534a8,'erlangAbandonmentRate':_0x619bad,'erlangBusyFactor':_0x5c3451});});};module[_0xd0f3('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 3db169b..9c04239 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x111b=['diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','endtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x5d7780,_0x3e4a55){var _0x19fa98=function(_0x50d583){while(--_0x50d583){_0x5d7780['push'](_0x5d7780['shift']());}};_0x19fa98(++_0x3e4a55);}(_0x111b,0xec));var _0xb111=function(_0x152968,_0x31e0c9){_0x152968=_0x152968-0x0;var _0x2514cc=_0x111b[_0x152968];return _0x2514cc;};'use strict';var util=require(_0xb111('0x0'));var _=require(_0xb111('0x1'));var moment=require(_0xb111('0x2'));function getSeconds(_0x586338,_0x2e6d62){var _0x50f1e4=moment(_0x586338)[_0xb111('0x3')](0x0);var _0x2708e5=moment(_0x2e6d62)[_0xb111('0x3')](0x0);return _0x50f1e4[_0xb111('0x4')](_0x2708e5,_0xb111('0x5'));}function QueueCallerAbandon(_0x55a3ed,_0x26746b){this['scheduledat']=_0x55a3ed['scheduledat'];this['type']=_0x55a3ed['type'];this['campaigntype']=_0x55a3ed[_0xb111('0x6')]===_0xb111('0x7')?_0xb111('0x8'):_0x55a3ed[_0xb111('0x6')];this[_0xb111('0x9')]=_0x55a3ed[_0xb111('0x9')];this[_0xb111('0xa')]=_0x55a3ed[_0xb111('0xa')];this[_0xb111('0xb')]=_0x55a3ed[_0xb111('0xb')];this['countglobal']=_0x55a3ed[_0xb111('0x9')]+_0x55a3ed[_0xb111('0xa')]+_0x55a3ed[_0xb111('0xb')]+_0x55a3ed[_0xb111('0xc')]+_0x55a3ed[_0xb111('0xd')]+_0x55a3ed[_0xb111('0xe')]+_0x55a3ed[_0xb111('0xf')]+_0x55a3ed[_0xb111('0x10')];this[_0xb111('0xc')]=_0x55a3ed[_0xb111('0xc')];this['countdropretry']=_0x55a3ed[_0xb111('0xd')];this[_0xb111('0xe')]=_0x55a3ed[_0xb111('0xe')];this[_0xb111('0xf')]=_0x55a3ed[_0xb111('0xf')];this['countagentrejectretry']=_0x55a3ed['countagentrejectretry'];this[_0xb111('0x11')]=_0x26746b[_0xb111('0x11')];this['calleridname']=_0x55a3ed[_0xb111('0x12')];this[_0xb111('0x13')]=_0x55a3ed['number'];this[_0xb111('0x14')]=_0x55a3ed[_0xb111('0x14')];this['responsetime']=_0x55a3ed[_0xb111('0x15')];this[_0xb111('0x16')]=_0x55a3ed[_0xb111('0x16')];this[_0xb111('0x17')]=this[_0xb111('0x16')];this['ringtime']=getSeconds(_0x55a3ed[_0xb111('0x15')],_0x55a3ed[_0xb111('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x55a3ed[_0xb111('0x15')]);this[_0xb111('0x18')]=0x0;this[_0xb111('0x8')]=_0x26746b[_0xb111('0x8')];this[_0xb111('0x19')]=_0x26746b[_0xb111('0x1a')];this[_0xb111('0x1b')]=_0x26746b[_0xb111('0x1b')];this[_0xb111('0x1c')]=_0x55a3ed[_0xb111('0x1c')];this[_0xb111('0x1d')]=_0x55a3ed['callbackuniqueid'];this[_0xb111('0x1e')]=_0x55a3ed[_0xb111('0x1e')];this[_0xb111('0x1f')]=_0x55a3ed['recallme'];this[_0xb111('0x20')]=_0x55a3ed['ContactId'];this[_0xb111('0x21')]=_0x55a3ed['ListId'];this['UserId']=_0x55a3ed[_0xb111('0x22')];this[_0xb111('0x23')]=_0x55a3ed[_0xb111('0x23')];this[_0xb111('0x24')]=_0x55a3ed[_0xb111('0x24')];this[_0xb111('0x25')]=_0x55a3ed[_0xb111('0x25')]||'';this[_0xb111('0x26')]=_0x55a3ed[_0xb111('0x26')]||'';}module[_0xb111('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x2c24=['type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat'];(function(_0x5cd02d,_0x18400c){var _0x1f207e=function(_0x18fa71){while(--_0x18fa71){_0x5cd02d['push'](_0x5cd02d['shift']());}};_0x1f207e(++_0x18400c);}(_0x2c24,0x1e6));var _0x42c2=function(_0x2279e8,_0x166ab8){_0x2279e8=_0x2279e8-0x0;var _0xa4e36e=_0x2c24[_0x2279e8];return _0xa4e36e;};'use strict';var util=require(_0x42c2('0x0'));var _=require(_0x42c2('0x1'));var moment=require(_0x42c2('0x2'));function getSeconds(_0x92723a,_0xc23daf){var _0x1fda71=moment(_0x92723a)[_0x42c2('0x3')](0x0);var _0x8aac5f=moment(_0xc23daf)[_0x42c2('0x3')](0x0);return _0x1fda71['diff'](_0x8aac5f,_0x42c2('0x4'));}function QueueCallerAbandon(_0xe8e360,_0x4950c1){this[_0x42c2('0x5')]=_0xe8e360[_0x42c2('0x5')];this[_0x42c2('0x6')]=_0xe8e360[_0x42c2('0x6')];this[_0x42c2('0x7')]=_0xe8e360[_0x42c2('0x6')]===_0x42c2('0x8')?'queue':_0xe8e360['type'];this[_0x42c2('0x9')]=_0xe8e360[_0x42c2('0x9')];this[_0x42c2('0xa')]=_0xe8e360['countcongestionretry'];this[_0x42c2('0xb')]=_0xe8e360[_0x42c2('0xb')];this['countglobal']=_0xe8e360['countbusyretry']+_0xe8e360[_0x42c2('0xa')]+_0xe8e360[_0x42c2('0xb')]+_0xe8e360['countnosuchnumberretry']+_0xe8e360['countdropretry']+_0xe8e360[_0x42c2('0xc')]+_0xe8e360[_0x42c2('0xd')]+_0xe8e360['countagentrejectretry'];this[_0x42c2('0xe')]=_0xe8e360[_0x42c2('0xe')];this[_0x42c2('0xf')]=_0xe8e360[_0x42c2('0xf')];this[_0x42c2('0xc')]=_0xe8e360[_0x42c2('0xc')];this[_0x42c2('0xd')]=_0xe8e360[_0x42c2('0xd')];this[_0x42c2('0x10')]=_0xe8e360[_0x42c2('0x10')];this[_0x42c2('0x11')]=_0x4950c1[_0x42c2('0x11')];this['calleridname']=_0xe8e360[_0x42c2('0x12')];this[_0x42c2('0x13')]=_0xe8e360['number'];this[_0x42c2('0x14')]=_0xe8e360['starttime'];this[_0x42c2('0x15')]=_0xe8e360[_0x42c2('0x15')];this['droptime']=_0xe8e360[_0x42c2('0x16')];this[_0x42c2('0x17')]=this[_0x42c2('0x16')];this['ringtime']=getSeconds(_0xe8e360['responsetime'],_0xe8e360[_0x42c2('0x14')]);this[_0x42c2('0x18')]=getSeconds(this[_0x42c2('0x16')],_0xe8e360['responsetime']);this[_0x42c2('0x19')]=0x0;this['queue']=_0x4950c1[_0x42c2('0x1a')];this[_0x42c2('0x1b')]=_0x4950c1[_0x42c2('0x1c')];this[_0x42c2('0x1d')]=_0x4950c1['reason'];this['callback']=_0xe8e360[_0x42c2('0x1e')];this['callbackuniqueid']=_0xe8e360['callbackuniqueid'];this[_0x42c2('0x1f')]=_0xe8e360[_0x42c2('0x1f')];this[_0x42c2('0x20')]=_0xe8e360['recallme'];this['ContactId']=_0xe8e360[_0x42c2('0x21')];this[_0x42c2('0x22')]=_0xe8e360[_0x42c2('0x22')];this[_0x42c2('0x23')]=_0xe8e360[_0x42c2('0x23')];this[_0x42c2('0x24')]=_0xe8e360[_0x42c2('0x24')];this['CampaignId']=_0xe8e360[_0x42c2('0x25')];this[_0x42c2('0x26')]=_0xe8e360[_0x42c2('0x26')]||'';this[_0x42c2('0x27')]=_0xe8e360[_0x42c2('0x27')]||'';}module[_0x42c2('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2493355..d206a6c 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(_0x1ceac2,_0x108337){var _0x3eb622=function(_0x20a4b0){while(--_0x20a4b0){_0x1ceac2['push'](_0x1ceac2['shift']());}};_0x3eb622(++_0x108337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x39e596,_0x2c7186){var _0x4fd1da=function(_0xe7efd1){while(--_0xe7efd1){_0x39e596['push'](_0x39e596['shift']());}};_0x4fd1da(++_0x2c7186);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 6b9a03f..481e5b1 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 _0xbaf0=['resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','send','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0x4e4ac4,_0x36fa21){var _0xe33e97=function(_0x2ff141){while(--_0x2ff141){_0x4e4ac4['push'](_0x4e4ac4['shift']());}};_0xe33e97(++_0x36fa21);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var util=require('util');var _=require(_0x0baf('0x0'));var BPromise=require(_0x0baf('0x1'));var uuid=require(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var path=require(_0x0baf('0x4'));var tiff2pdf=require(_0x0baf('0x5'));var gs=require('./util/gs');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var ami=require(_0x0baf('0x8'));var rpcDb=require(_0x0baf('0x9'));var Channel=require(_0x0baf('0xa'));var ut=require(_0x0baf('0xb'));var Action=require(_0x0baf('0xc'));var faxAccount=require(_0x0baf('0xd'));var attachment=require(_0x0baf('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x11b947){this['channels']={};this[_0x0baf('0xf')]=_0x11b947[_0x0baf('0xf')];this[_0x0baf('0x10')]=_0x11b947[_0x0baf('0x10')];this[_0x0baf('0x11')]={};ami['on'](_0x0baf('0x12'),this[_0x0baf('0x13')][_0x0baf('0x14')](this));ami['on'](_0x0baf('0x15'),this[_0x0baf('0x16')][_0x0baf('0x14')](this));ami['on']('newstate',this['syncNewState'][_0x0baf('0x14')](this));ami['on'](_0x0baf('0x17'),this[_0x0baf('0x18')][_0x0baf('0x14')](this));ami['on']('faxstatus',this[_0x0baf('0x19')]['bind'](this));ami['on'](_0x0baf('0x1a'),this[_0x0baf('0x1b')][_0x0baf('0x14')](this));ami['on'](_0x0baf('0x1c'),this[_0x0baf('0x1d')][_0x0baf('0x14')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x0baf('0x14')](this));}Fax[_0x0baf('0x1e')][_0x0baf('0x13')]=function(_0x3d83a3){if(_0x3d83a3[_0x0baf('0x1f')]===_0x0baf('0x20')){for(var _0x53c338 in this[_0x0baf('0xf')]){if(this[_0x0baf('0xf')][_0x0baf('0x21')](_0x53c338)){if(_0x3d83a3[_0x0baf('0x22')]===this[_0x0baf('0xf')][_0x53c338][_0x0baf('0x23')]){this['channels'][_0x3d83a3['uniqueid']]={};this[_0x0baf('0x24')][_0x3d83a3[_0x0baf('0x25')]][_0x0baf('0x26')]=_0x3d83a3[_0x0baf('0x26')];this[_0x0baf('0x24')][_0x3d83a3[_0x0baf('0x25')]]['id']=this[_0x0baf('0xf')][_0x53c338]['id'];this[_0x0baf('0x24')][_0x3d83a3[_0x0baf('0x25')]][_0x0baf('0x27')]=this['faxAccounts'][_0x53c338][_0x0baf('0x27')];logger['info'](_0x3d83a3[_0x0baf('0x25')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x3d83a3[_0x0baf('0x25')]]){this['channels'][_0x3d83a3['uniqueid']]={};this[_0x0baf('0x24')][_0x3d83a3[_0x0baf('0x25')]][_0x0baf('0x26')]=_0x3d83a3[_0x0baf('0x26')];logger[_0x0baf('0x28')](_0x3d83a3['uniqueid'],_0x0baf('0x29'));}};Fax[_0x0baf('0x1e')][_0x0baf('0x16')]=function(_0x366e71){if(this[_0x0baf('0x24')][_0x366e71[_0x0baf('0x25')]]){for(var _0x453525 in _0x366e71['variable']){if(_0x366e71[_0x0baf('0x2a')][_0x0baf('0x21')](_0x453525)){this[_0x0baf('0x24')][_0x366e71[_0x0baf('0x25')]][_0x453525]=_0x366e71['value'];}}}};Fax[_0x0baf('0x1e')][_0x0baf('0x2b')]=function(_0x5d9d7f){if(this[_0x0baf('0x24')][_0x5d9d7f[_0x0baf('0x25')]]){this[_0x0baf('0x24')][_0x5d9d7f[_0x0baf('0x25')]][_0x0baf('0x2c')]=_0x5d9d7f[_0x0baf('0x2c')];this[_0x0baf('0x24')][_0x5d9d7f['uniqueid']][_0x0baf('0x2d')]=_0x5d9d7f[_0x0baf('0x2d')];}};Fax[_0x0baf('0x1e')][_0x0baf('0x18')]=function(_0x24ecee){if(this[_0x0baf('0x24')][_0x24ecee[_0x0baf('0x25')]]){for(var _0x2f0a45 in _0x24ecee[_0x0baf('0x2a')]){if(_0x24ecee[_0x0baf('0x2a')][_0x0baf('0x21')](_0x2f0a45)){this[_0x0baf('0x24')][_0x24ecee[_0x0baf('0x25')]][_0x2f0a45]=_0x24ecee[_0x0baf('0x2e')];}}}};Fax['prototype'][_0x0baf('0x19')]=function(_0x53ae1d){if(this[_0x0baf('0x24')][_0x53ae1d[_0x0baf('0x25')]]){this[_0x0baf('0x24')][_0x53ae1d[_0x0baf('0x25')]]['operation']=_0x53ae1d[_0x0baf('0x2f')];this[_0x0baf('0x24')][_0x53ae1d['uniqueid']][_0x0baf('0x30')]=_0x53ae1d[_0x0baf('0x30')];this[_0x0baf('0x24')][_0x53ae1d[_0x0baf('0x25')]][_0x0baf('0x23')]=_0x53ae1d[_0x0baf('0x23')];this[_0x0baf('0x24')][_0x53ae1d[_0x0baf('0x25')]]['filename']=_0x53ae1d[_0x0baf('0x31')];logger[_0x0baf('0x28')](_0x53ae1d['uniqueid'],_0x0baf('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x11bc49){var _0x81af83=this;if(this['channels'][_0x11bc49['uniqueid']]){var _0x628603=this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]]['id'];this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]][_0x0baf('0x33')]=_0x11bc49[_0x0baf('0x33')];this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]][_0x0baf('0x34')]=_0x11bc49[_0x0baf('0x34')];this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]][_0x0baf('0x23')]=_0x11bc49['localstationid'];this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]]['resolution']=_0x11bc49[_0x0baf('0x35')];this[_0x0baf('0x24')][_0x11bc49[_0x0baf('0x25')]][_0x0baf('0x36')]=_0x11bc49[_0x0baf('0x36')];this[_0x0baf('0x24')][_0x11bc49['uniqueid']][_0x0baf('0x31')]=_0x11bc49[_0x0baf('0x31')];this['channels'][_0x11bc49[_0x0baf('0x25')]][_0x0baf('0x37')]=_0x11bc49[_0x0baf('0x37')];if(this[_0x0baf('0x24')][_0x11bc49['uniqueid']][_0x0baf('0x34')]>0x0){tiff2pdf(_0x11bc49[_0x0baf('0x31')],_0x0baf('0x38'),function(_0x13e16a){logger[_0x0baf('0x28')](_0x11bc49[_0x0baf('0x25')],_0x0baf('0x39'),_0x13e16a[_0x0baf('0x3a')]);attachment[_0x0baf('0x3b')]({'name':path[_0x0baf('0x3c')](_0x11bc49['filename'])[_0x0baf('0x27')],'basename':path[_0x0baf('0x3c')](_0x11bc49[_0x0baf('0x31')])[_0x0baf('0x27')]+_0x0baf('0x3d'),'type':'application/pdf'})[_0x0baf('0x3e')](function(_0x310240){faxAccount[_0x0baf('0x3f')](_0x628603,{'from':_0x11bc49[_0x0baf('0x37')],'mapKey':_0x0baf('0x7'),'body':path['parse'](_0x11bc49[_0x0baf('0x31')])[_0x0baf('0x27')]+_0x0baf('0x3d'),'AttachmentId':_0x310240['id']})[_0x0baf('0x40')](function(_0x41599f){logger[_0x0baf('0x41')](_0x11bc49[_0x0baf('0x25')],'\x20notify\x20',JSON[_0x0baf('0x42')](_0x41599f));});})[_0x0baf('0x40')](function(_0x3a6489){logger['error'](_0x11bc49[_0x0baf('0x25')],_0x0baf('0x43'),JSON[_0x0baf('0x42')](_0x3a6489));});});}logger[_0x0baf('0x28')](_0x11bc49[_0x0baf('0x25')],_0x0baf('0x43'));}};Fax[_0x0baf('0x1e')]['syncOriginateResponse']=function(_0x22c451){if(this[_0x0baf('0x11')][_0x22c451[_0x0baf('0x25')]]){_[_0x0baf('0x44')](this[_0x0baf('0x24')][_0x22c451[_0x0baf('0x25')]],_[_0x0baf('0x45')](_0x22c451,[_0x0baf('0x46'),_0x0baf('0x47')]));}};function updateStatus(_0x19c008){if(_0x19c008[_0x0baf('0x48')]){faxMessage['update'](_0x19c008['AttachmentId'],{'failMessage':_0x0baf('0x49')})[_0x0baf('0x3e')](function(_0x1cd114){ut[_0x0baf('0x4a')](_0x0baf('0x4b'),_0x1cd114);})[_0x0baf('0x40')](function(_0x3403d5){ut['logger'](_0x0baf('0x4c'),_0x3403d5);});}else{ut[_0x0baf('0x4a')](_0x0baf('0x4d'));}}Fax[_0x0baf('0x1e')][_0x0baf('0x4e')]=function(_0x1e2671,_0x5e1849,_0x3eebe5){var _0x5f123c=this;var _0x151741={};if(_0x5e1849){_0x151741={'read':_0x5e1849};}else{_0x151741={'failMessage':_0x3eebe5};}if(this['actions'][_0x1e2671][_0x0baf('0x48')]){faxMessage['update'](this[_0x0baf('0x11')][_0x1e2671]['AttachmentId'],_0x151741)[_0x0baf('0x3e')](function(_0xcf7b8d){ut[_0x0baf('0x4a')](_0x0baf('0x4f'),_0xcf7b8d);})[_0x0baf('0x40')](function(_0x576475){ut[_0x0baf('0x4a')](_0x0baf('0x50'),_0x576475);})[_0x0baf('0x51')](function(){delete _0x5f123c[_0x0baf('0x24')][_0x1e2671];delete _0x5f123c[_0x0baf('0x11')][_0x1e2671];});}else{ut[_0x0baf('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x0baf('0x24')][_0x1e2671];delete this[_0x0baf('0x11')][_0x1e2671];}};Fax[_0x0baf('0x1e')][_0x0baf('0x1d')]=function(_0xbc7cc2){var _0x1a7ffb=this;if(this[_0x0baf('0x24')][_0xbc7cc2['uniqueid']]){if(this['actions'][_0xbc7cc2[_0x0baf('0x25')]]){this[_0x0baf('0x24')][_0xbc7cc2[_0x0baf('0x25')]]['id']=this[_0x0baf('0x11')][_0xbc7cc2[_0x0baf('0x25')]]['id'];this[_0x0baf('0x24')][_0xbc7cc2[_0x0baf('0x25')]][_0x0baf('0x27')]=this[_0x0baf('0x11')][_0xbc7cc2['uniqueid']][_0x0baf('0x27')];}logger[_0x0baf('0x28')](_0xbc7cc2[_0x0baf('0x25')],this[_0x0baf('0x11')][_0xbc7cc2[_0x0baf('0x25')]]?_0x0baf('0x52'):_0x0baf('0x53'),JSON['stringify'](this[_0x0baf('0x24')][_0xbc7cc2[_0x0baf('0x25')]]));if(this[_0x0baf('0x11')][_0xbc7cc2[_0x0baf('0x25')]]){if(this[_0x0baf('0x24')][_0xbc7cc2[_0x0baf('0x25')]][_0x0baf('0x54')]>0x0&&this[_0x0baf('0x24')][_0xbc7cc2['uniqueid']][_0x0baf('0x55')]==='SUCCESS'){this[_0x0baf('0x4e')](_0xbc7cc2['uniqueid'],!![]);}else{this['updateStatus'](_0xbc7cc2[_0x0baf('0x25')],![],this['channels'][_0xbc7cc2[_0x0baf('0x25')]][_0x0baf('0x56')]?'SENDING\x20FAILED:\x20'+this[_0x0baf('0x24')][_0xbc7cc2[_0x0baf('0x25')]][_0x0baf('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x0baf('0x57')]=function(_0x7e8946){var _0x6d789f=this;return new BPromise(function(_0x7f49e,_0x784e1a){_0x6d789f['execOriginate'](_0x7e8946,_0x6d789f[_0x0baf('0xf')][_0x7e8946['FaxAccountId']])['then'](function(_0x59a0b2){ut[_0x0baf('0x4a')]('[Fax][execOriginate][success]',_0x59a0b2);_0x7f49e(ut['message'](_0x0baf('0x58')));})[_0x0baf('0x40')](function(_0x1af6ce){ut[_0x0baf('0x4a')](_0x0baf('0x59'),_0x1af6ce);updateStatus(_0x7e8946);_0x784e1a(ut[_0x0baf('0x3a')]('Fax\x20failed'));});});};Fax[_0x0baf('0x1e')][_0x0baf('0x5a')]=function(_0x185473){var _0x2b2dc8=this;return new BPromise(function(_0x46a4cf,_0x1273f4){var _0x5cf3d3=_0x2b2dc8[_0x0baf('0x5b')](_0x2b2dc8[_0x0baf('0xf')][_0x185473[_0x0baf('0x5c')]]['Trunk'],_0x185473);if(_0x5cf3d3[_0x0baf('0x5d')]){_0x46a4cf(ut[_0x0baf('0x3a')](_0x0baf('0x5e')));}else{_0x1273f4(ut[_0x0baf('0x3a')](_0x5cf3d3[_0x0baf('0x3a')]));}});};function originate(_0x27a959,_0x4cc046,_0x5874cc){return new BPromise(function(_0x54353a,_0x4b7caa){if(_0x5874cc){var _0x6ce83c=util[_0x0baf('0x5f')](_0x0baf('0x60'),path[_0x0baf('0x3c')](_0x27a959[_0x0baf('0x4')])[_0x0baf('0x27')],_0x27a959['path']);gs['execute'](_0x6ce83c)[_0x0baf('0x3e')](function(){_0x27a959['path']=util[_0x0baf('0x5f')](_0x0baf('0x61'),path['parse'](_0x27a959[_0x0baf('0x4')])[_0x0baf('0x62')],path[_0x0baf('0x3c')](_0x27a959[_0x0baf('0x4')])[_0x0baf('0x27')]);_0x4cc046[_0x0baf('0x63')]=_0x27a959[_0x0baf('0x4')];ut[_0x0baf('0x4a')](_0x0baf('0x64'),'');ami['Action'](ut['variablesAction'](_0x27a959,_0x4cc046))['then'](function(_0x493784){_0x54353a(_0x493784);})['catch'](function(_0x418c45){_0x4b7caa(_0x418c45);});})[_0x0baf('0x40')](function(_0x333b07){_0x4b7caa(_0x333b07);});}else{ami[_0x0baf('0x65')](ut['variablesAction'](_0x27a959,_0x4cc046))[_0x0baf('0x3e')](function(_0x410f6c){_0x54353a(_0x410f6c);})['catch'](function(_0x4b2226){_0x4b7caa(_0x4b2226);});}});}Fax[_0x0baf('0x1e')][_0x0baf('0x66')]=function(_0x16fc9f,_0x442e5f){var _0x30b35e=this;return new BPromise(function(_0x3edf8d,_0x3ce111){var _0x399f40=uuid['v4']();var _0x5e0c1b=ut[_0x0baf('0x67')](_0x16fc9f,_0x442e5f);_0x30b35e[_0x0baf('0x11')][_0x399f40]=new Action(_0x399f40,_0x442e5f,_0x16fc9f);var _0x560c0f=_0x30b35e[_0x0baf('0x11')][_0x399f40];if(path[_0x0baf('0x3c')](_0x16fc9f['path'])[_0x0baf('0x68')]===_0x0baf('0x3d')){originate(_0x560c0f,_0x5e0c1b,!![])[_0x0baf('0x3e')](function(_0x2baede){_0x3edf8d(_0x2baede);})[_0x0baf('0x40')](function(_0x4fc5af){_0x3ce111(_0x4fc5af);});}else{originate(_0x560c0f,_0x5e0c1b,![])['then'](function(_0x1dab50){_0x3edf8d(_0x1dab50);})[_0x0baf('0x40')](function(_0x5dcd9e){_0x3ce111(_0x5dcd9e);});}});};Fax[_0x0baf('0x1e')][_0x0baf('0x69')]=function(_0x21ad25){return!_['isNil'](_0x21ad25)&&!_[_0x0baf('0x6a')](_0x21ad25[_0x0baf('0x27')])&&!_[_0x0baf('0x6a')](_0x21ad25['active'])&&_0x21ad25[_0x0baf('0x6b')]&&!_['isNil'](this[_0x0baf('0x10')][util[_0x0baf('0x5f')](_0x0baf('0x6c'),_0x21ad25[_0x0baf('0x27')])])&&!_[_0x0baf('0x6a')](this['trunks'][util[_0x0baf('0x5f')](_0x0baf('0x6c'),_0x21ad25['name'])][_0x0baf('0x30')])&&(this[_0x0baf('0x10')][util[_0x0baf('0x5f')](_0x0baf('0x6c'),_0x21ad25[_0x0baf('0x27')])][_0x0baf('0x30')]===_0x0baf('0x6d')||this[_0x0baf('0x10')][util[_0x0baf('0x5f')](_0x0baf('0x6c'),_0x21ad25[_0x0baf('0x27')])][_0x0baf('0x30')]==='unmonitored');};Fax['prototype'][_0x0baf('0x5b')]=function(_0x322a09,_0x384c29){if(!this['isTrunkReachable'](_0x322a09)){ut['logger'](_0x0baf('0x6e'),_[_0x0baf('0x6a')](_0x322a09)?'':_0x322a09[_0x0baf('0x27')]+_0x0baf('0x6f'));return{'isValid':![],'message':_0x0baf('0x70')};}if(_[_0x0baf('0x6a')](_0x384c29[_0x0baf('0x7')])){ut[_0x0baf('0x4a')](_0x0baf('0x71'),JSON['stringify'](_0x384c29));return{'isValid':![],'message':_0x0baf('0x72')};}if(_[_0x0baf('0x6a')](_0x384c29[_0x0baf('0x4')])){ut[_0x0baf('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x384c29));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0baf('0x73')};};module[_0x0baf('0x74')]=Fax; \ No newline at end of file +var _0x2f68=['reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','Convert\x20pdf\x20to\x20tif','Action','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','info','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','pick'];(function(_0x58607a,_0x1c9e31){var _0x264495=function(_0x251f32){while(--_0x251f32){_0x58607a['push'](_0x58607a['shift']());}};_0x264495(++_0x1c9e31);}(_0x2f68,0x9a));var _0x82f6=function(_0x14d6ad,_0x4225c3){_0x14d6ad=_0x14d6ad-0x0;var _0x3dd0f6=_0x2f68[_0x14d6ad];return _0x3dd0f6;};'use strict';var util=require('util');var _=require(_0x82f6('0x0'));var BPromise=require(_0x82f6('0x1'));var uuid=require(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var path=require('path');var tiff2pdf=require(_0x82f6('0x4'));var gs=require('./util/gs');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var ami=require('../ami');var rpcDb=require(_0x82f6('0x7'));var Channel=require(_0x82f6('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x82f6('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x864400){this[_0x82f6('0xa')]={};this[_0x82f6('0xb')]=_0x864400['faxAccounts'];this[_0x82f6('0xc')]=_0x864400[_0x82f6('0xc')];this['actions']={};ami['on'](_0x82f6('0xd'),this[_0x82f6('0xe')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x10'),this[_0x82f6('0x11')][_0x82f6('0xf')](this));ami['on']('newstate',this[_0x82f6('0x12')][_0x82f6('0xf')](this));ami['on']('newexten',this[_0x82f6('0x13')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x14'),this[_0x82f6('0x15')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x16'),this[_0x82f6('0x17')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x18'),this['syncHangup'][_0x82f6('0xf')](this));ami['on']('originateresponse',this[_0x82f6('0x19')][_0x82f6('0xf')](this));}Fax[_0x82f6('0x1a')][_0x82f6('0xe')]=function(_0x18e8dd){if(_0x18e8dd[_0x82f6('0x1b')]===_0x82f6('0x1c')){for(var _0xcbc95f in this[_0x82f6('0xb')]){if(this[_0x82f6('0xb')][_0x82f6('0x1d')](_0xcbc95f)){if(_0x18e8dd[_0x82f6('0x1e')]===this[_0x82f6('0xb')][_0xcbc95f][_0x82f6('0x1f')]){this[_0x82f6('0xa')][_0x18e8dd['uniqueid']]={};this[_0x82f6('0xa')][_0x18e8dd[_0x82f6('0x20')]]['channel']=_0x18e8dd[_0x82f6('0x21')];this[_0x82f6('0xa')][_0x18e8dd[_0x82f6('0x20')]]['id']=this[_0x82f6('0xb')][_0xcbc95f]['id'];this['channels'][_0x18e8dd[_0x82f6('0x20')]]['name']=this[_0x82f6('0xb')][_0xcbc95f][_0x82f6('0x22')];logger['info'](_0x18e8dd['uniqueid'],_0x82f6('0x23'));}}}}if(this[_0x82f6('0x24')][_0x18e8dd['uniqueid']]){this['channels'][_0x18e8dd[_0x82f6('0x20')]]={};this[_0x82f6('0xa')][_0x18e8dd['uniqueid']][_0x82f6('0x21')]=_0x18e8dd[_0x82f6('0x21')];logger['info'](_0x18e8dd['uniqueid'],_0x82f6('0x23'));}};Fax['prototype'][_0x82f6('0x11')]=function(_0x5a6d69){if(this['channels'][_0x5a6d69[_0x82f6('0x20')]]){for(var _0x15c9b7 in _0x5a6d69[_0x82f6('0x25')]){if(_0x5a6d69[_0x82f6('0x25')]['hasOwnProperty'](_0x15c9b7)){this[_0x82f6('0xa')][_0x5a6d69[_0x82f6('0x20')]][_0x15c9b7]=_0x5a6d69[_0x82f6('0x26')];}}}};Fax[_0x82f6('0x1a')][_0x82f6('0x12')]=function(_0x328707){if(this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]]){this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]][_0x82f6('0x27')]=_0x328707[_0x82f6('0x27')];this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]]['channelstatedesc']=_0x328707[_0x82f6('0x28')];}};Fax[_0x82f6('0x1a')][_0x82f6('0x13')]=function(_0x5a51b4){if(this[_0x82f6('0xa')][_0x5a51b4[_0x82f6('0x20')]]){for(var _0x831131 in _0x5a51b4[_0x82f6('0x25')]){if(_0x5a51b4[_0x82f6('0x25')][_0x82f6('0x1d')](_0x831131)){this[_0x82f6('0xa')][_0x5a51b4[_0x82f6('0x20')]][_0x831131]=_0x5a51b4[_0x82f6('0x26')];}}}};Fax[_0x82f6('0x1a')][_0x82f6('0x15')]=function(_0x31df71){if(this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]]){this['channels'][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x29')]=_0x31df71[_0x82f6('0x29')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x2a')]=_0x31df71[_0x82f6('0x2a')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x1f')]=_0x31df71[_0x82f6('0x1f')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x2b')]=_0x31df71['filename'];logger[_0x82f6('0x2c')](_0x31df71['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x82f6('0x1a')][_0x82f6('0x17')]=function(_0x5e8828){var _0x249cae=this;if(this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]]){var _0x56e5f1=this[_0x82f6('0xa')][_0x5e8828['uniqueid']]['id'];this[_0x82f6('0xa')][_0x5e8828['uniqueid']][_0x82f6('0x2d')]=_0x5e8828['remotestationid'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]]['pagestransferred']=_0x5e8828[_0x82f6('0x2e')];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x1f')]=_0x5e8828['localstationid'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2f')]=_0x5e8828[_0x82f6('0x2f')];this['channels'][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x30')]=_0x5e8828['transferrate'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2b')]=_0x5e8828[_0x82f6('0x2b')];this[_0x82f6('0xa')][_0x5e8828['uniqueid']][_0x82f6('0x31')]=_0x5e8828['calleridnum'];if(this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2e')]>0x0){tiff2pdf(_0x5e8828[_0x82f6('0x2b')],_0x82f6('0x32'),function(_0x293002){logger[_0x82f6('0x2c')](_0x5e8828['uniqueid'],_0x82f6('0x33'),_0x293002[_0x82f6('0x34')]);attachment[_0x82f6('0x35')]({'name':path[_0x82f6('0x36')](_0x5e8828['filename'])[_0x82f6('0x22')],'basename':path['parse'](_0x5e8828[_0x82f6('0x2b')])[_0x82f6('0x22')]+_0x82f6('0x37'),'type':_0x82f6('0x38')})[_0x82f6('0x39')](function(_0xa8b529){faxAccount['notify'](_0x56e5f1,{'from':_0x5e8828[_0x82f6('0x31')],'mapKey':_0x82f6('0x6'),'body':path[_0x82f6('0x36')](_0x5e8828[_0x82f6('0x2b')])[_0x82f6('0x22')]+_0x82f6('0x37'),'AttachmentId':_0xa8b529['id']})[_0x82f6('0x3a')](function(_0x33e630){logger['error'](_0x5e8828[_0x82f6('0x20')],_0x82f6('0x3b'),JSON['stringify'](_0x33e630));});})[_0x82f6('0x3a')](function(_0x5cc23b){logger[_0x82f6('0x3c')](_0x5e8828['uniqueid'],_0x82f6('0x3d'),JSON[_0x82f6('0x3e')](_0x5cc23b));});});}logger[_0x82f6('0x2c')](_0x5e8828[_0x82f6('0x20')],_0x82f6('0x3d'));}};Fax[_0x82f6('0x1a')]['syncOriginateResponse']=function(_0x3cb1f0){if(this[_0x82f6('0x24')][_0x3cb1f0['uniqueid']]){_['merge'](this[_0x82f6('0xa')][_0x3cb1f0[_0x82f6('0x20')]],_[_0x82f6('0x3f')](_0x3cb1f0,['response',_0x82f6('0x40')]));}};function updateStatus(_0x7614da){if(_0x7614da[_0x82f6('0x41')]){faxMessage[_0x82f6('0x42')](_0x7614da['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x82f6('0x39')](function(_0x1d56e7){ut[_0x82f6('0x43')]('[Fax][Message][Error][Updated]',_0x1d56e7);})[_0x82f6('0x3a')](function(_0x26194c){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x26194c);});}else{ut['logger'](_0x82f6('0x44'));}}Fax['prototype'][_0x82f6('0x45')]=function(_0x57c023,_0x33c359,_0x4f69de){var _0x9fae5a=this;var _0x58f89b={};if(_0x33c359){_0x58f89b={'read':_0x33c359};}else{_0x58f89b={'failMessage':_0x4f69de};}if(this[_0x82f6('0x24')][_0x57c023][_0x82f6('0x41')]){faxMessage[_0x82f6('0x42')](this[_0x82f6('0x24')][_0x57c023][_0x82f6('0x41')],_0x58f89b)[_0x82f6('0x39')](function(_0x597844){ut[_0x82f6('0x43')](_0x82f6('0x46'),_0x597844);})[_0x82f6('0x3a')](function(_0x5bd7c4){ut['logger'](_0x82f6('0x47'),_0x5bd7c4);})[_0x82f6('0x48')](function(){delete _0x9fae5a[_0x82f6('0xa')][_0x57c023];delete _0x9fae5a[_0x82f6('0x24')][_0x57c023];});}else{ut['logger'](_0x82f6('0x49'));delete this[_0x82f6('0xa')][_0x57c023];delete this[_0x82f6('0x24')][_0x57c023];}};Fax['prototype']['syncHangup']=function(_0x5f0801){var _0x44218c=this;if(this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]){if(this[_0x82f6('0x24')][_0x5f0801[_0x82f6('0x20')]]){this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['id']=this[_0x82f6('0x24')][_0x5f0801['uniqueid']]['id'];this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x22')]=this[_0x82f6('0x24')][_0x5f0801['uniqueid']]['name'];}logger[_0x82f6('0x2c')](_0x5f0801[_0x82f6('0x20')],this['actions'][_0x5f0801[_0x82f6('0x20')]]?_0x82f6('0x4a'):_0x82f6('0x4b'),JSON['stringify'](this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]));if(this[_0x82f6('0x24')][_0x5f0801[_0x82f6('0x20')]]){if(this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['faxpages']>0x0&&this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x14')]===_0x82f6('0x4c')){this[_0x82f6('0x45')](_0x5f0801['uniqueid'],!![]);}else{this[_0x82f6('0x45')](_0x5f0801[_0x82f6('0x20')],![],this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x4d')]?_0x82f6('0x4e')+this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['faxstatusstring']:_0x82f6('0x4f'));}}}};Fax['prototype'][_0x82f6('0x50')]=function(_0x85ea2e){var _0x4e51a6=this;return new BPromise(function(_0x843458,_0x32e43d){_0x4e51a6[_0x82f6('0x51')](_0x85ea2e,_0x4e51a6['faxAccounts'][_0x85ea2e['FaxAccountId']])[_0x82f6('0x39')](function(_0x31f3cc){ut['logger']('[Fax][execOriginate][success]',_0x31f3cc);_0x843458(ut[_0x82f6('0x34')](_0x82f6('0x52')));})[_0x82f6('0x3a')](function(_0x3b3712){ut[_0x82f6('0x43')](_0x82f6('0x53'),_0x3b3712);updateStatus(_0x85ea2e);_0x32e43d(ut[_0x82f6('0x34')](_0x82f6('0x54')));});});};Fax[_0x82f6('0x1a')][_0x82f6('0x55')]=function(_0x385902){var _0x41354f=this;return new BPromise(function(_0x53d931,_0xeade13){var _0x16776e=_0x41354f[_0x82f6('0x56')](_0x41354f[_0x82f6('0xb')][_0x385902[_0x82f6('0x57')]]['Trunk'],_0x385902);if(_0x16776e[_0x82f6('0x58')]){_0x53d931(ut[_0x82f6('0x34')](_0x82f6('0x59')));}else{_0xeade13(ut['message'](_0x16776e[_0x82f6('0x34')]));}});};function originate(_0x192dc7,_0x17924d,_0x27a79c){return new BPromise(function(_0xeec407,_0x39a4b3){if(_0x27a79c){var _0x2c6e37=util['format'](_0x82f6('0x5a'),path['parse'](_0x192dc7[_0x82f6('0x5b')])[_0x82f6('0x22')],_0x192dc7[_0x82f6('0x5b')]);gs[_0x82f6('0x5c')](_0x2c6e37)[_0x82f6('0x39')](function(){_0x192dc7[_0x82f6('0x5b')]=util[_0x82f6('0x5d')](_0x82f6('0x5e'),path[_0x82f6('0x36')](_0x192dc7['path'])[_0x82f6('0x5f')],path[_0x82f6('0x36')](_0x192dc7[_0x82f6('0x5b')])[_0x82f6('0x22')]);_0x17924d[_0x82f6('0x60')]=_0x192dc7[_0x82f6('0x5b')];ut['logger'](_0x82f6('0x61'),'');ami[_0x82f6('0x62')](ut['variablesAction'](_0x192dc7,_0x17924d))['then'](function(_0x983983){_0xeec407(_0x983983);})[_0x82f6('0x3a')](function(_0xa8c047){_0x39a4b3(_0xa8c047);});})[_0x82f6('0x3a')](function(_0x3cef94){_0x39a4b3(_0x3cef94);});}else{ami[_0x82f6('0x62')](ut['variablesAction'](_0x192dc7,_0x17924d))[_0x82f6('0x39')](function(_0x5a325f){_0xeec407(_0x5a325f);})[_0x82f6('0x3a')](function(_0x483442){_0x39a4b3(_0x483442);});}});}Fax[_0x82f6('0x1a')]['execOriginate']=function(_0xa7bd08,_0xc21e55){var _0x203168=this;return new BPromise(function(_0x584f76,_0x18fb4c){var _0x5e8d8e=uuid['v4']();var _0xcd5dcd=ut[_0x82f6('0x63')](_0xa7bd08,_0xc21e55);_0x203168[_0x82f6('0x24')][_0x5e8d8e]=new Action(_0x5e8d8e,_0xc21e55,_0xa7bd08);var _0x4d1bfd=_0x203168[_0x82f6('0x24')][_0x5e8d8e];if(path[_0x82f6('0x36')](_0xa7bd08[_0x82f6('0x5b')])['ext']==='.pdf'){originate(_0x4d1bfd,_0xcd5dcd,!![])[_0x82f6('0x39')](function(_0x30327a){_0x584f76(_0x30327a);})[_0x82f6('0x3a')](function(_0x1a1082){_0x18fb4c(_0x1a1082);});}else{originate(_0x4d1bfd,_0xcd5dcd,![])[_0x82f6('0x39')](function(_0xf822a6){_0x584f76(_0xf822a6);})[_0x82f6('0x3a')](function(_0x286f4e){_0x18fb4c(_0x286f4e);});}});};Fax['prototype'][_0x82f6('0x64')]=function(_0x34de40){return!_['isNil'](_0x34de40)&&!_[_0x82f6('0x65')](_0x34de40[_0x82f6('0x22')])&&!_[_0x82f6('0x65')](_0x34de40['active'])&&_0x34de40[_0x82f6('0x66')]&&!_[_0x82f6('0x65')](this[_0x82f6('0xc')][util[_0x82f6('0x5d')]('SIP/%s',_0x34de40[_0x82f6('0x22')])])&&!_[_0x82f6('0x65')](this[_0x82f6('0xc')][util[_0x82f6('0x5d')](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])]['status'])&&(this[_0x82f6('0xc')][util[_0x82f6('0x5d')](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])][_0x82f6('0x2a')]==='reachable'||this[_0x82f6('0xc')][util['format'](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])][_0x82f6('0x2a')]===_0x82f6('0x68'));};Fax[_0x82f6('0x1a')][_0x82f6('0x56')]=function(_0x199740,_0x4d7198){if(!this[_0x82f6('0x64')](_0x199740)){ut[_0x82f6('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x82f6('0x65')](_0x199740)?'':_0x199740[_0x82f6('0x22')]+_0x82f6('0x69'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x82f6('0x65')](_0x4d7198['fax'])){ut[_0x82f6('0x43')](_0x82f6('0x6a'),JSON['stringify'](_0x4d7198));return{'isValid':![],'message':_0x82f6('0x6b')};}if(_[_0x82f6('0x65')](_0x4d7198[_0x82f6('0x5b')])){ut[_0x82f6('0x43')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x82f6('0x3e')](_0x4d7198));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x82f6('0x6c')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 341b2a7..b01f99b 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 _0x357f=['lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','preview'];(function(_0x1c445a,_0xea7543){var _0x33e4ad=function(_0xbf0ca7){while(--_0xbf0ca7){_0x1c445a['push'](_0x1c445a['shift']());}};_0x33e4ad(++_0xea7543);}(_0x357f,0xaa));var _0xf357=function(_0x41d45c,_0x83ef05){_0x41d45c=_0x41d45c-0x0;var _0x28c6ca=_0x357f[_0x41d45c];return _0x28c6ca;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xf357('0x0'));var _=require(_0xf357('0x1'));var faxAccount=require(_0xf357('0x2'));function loggerCatch(_0x5f26ad){return function(_0xcc7d29){logger[_0xf357('0x3')](_0x5f26ad,util['inspect'](_0xcc7d29,{'showHidden':![],'depth':null}));};}exports[_0xf357('0x4')]=function(_0x51a645,_0x17e671){return BPromise[_0xf357('0x5')]()[_0xf357('0x6')](faxAccount['notify'](_0x51a645,_0x17e671))[_0xf357('0x7')](loggerCatch(_0xf357('0x8')));}; \ No newline at end of file +var _0x07a5=['inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','lodash','error'];(function(_0xd16fc0,_0x87ffe3){var _0x105cee=function(_0x43919d){while(--_0x43919d){_0xd16fc0['push'](_0xd16fc0['shift']());}};_0x105cee(++_0x87ffe3);}(_0x07a5,0xa7));var _0x507a=function(_0xd6a1c9,_0x203324){_0xd6a1c9=_0xd6a1c9-0x0;var _0x51ea29=_0x07a5[_0xd6a1c9];return _0x51ea29;};'use strict';var util=require(_0x507a('0x0'));var BPromise=require(_0x507a('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x507a('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2d4c28){return function(_0x3d4a69){logger[_0x507a('0x3')](_0x2d4c28,util[_0x507a('0x4')](_0x3d4a69,{'showHidden':![],'depth':null}));};}exports[_0x507a('0x5')]=function(_0x5c43f9,_0x187be0){return BPromise[_0x507a('0x6')]()['then'](faxAccount['notify'](_0x5c43f9,_0x187be0))[_0x507a('0x7')](loggerCatch(_0x507a('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 642fb17..7ad6d7d 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 _0xd63c=['../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util'];(function(_0x201457,_0xede44b){var _0x2a61ea=function(_0x1392a9){while(--_0x1392a9){_0x201457['push'](_0x201457['shift']());}};_0x2a61ea(++_0xede44b);}(_0xd63c,0x112));var _0xcd63=function(_0x41fcc3,_0x4f1d0b){_0x41fcc3=_0x41fcc3-0x0;var _0x34155a=_0xd63c[_0x41fcc3];return _0x34155a;};'use strict';var util=require(_0xcd63('0x0'));var logger=require(_0xcd63('0x1'))(_0xcd63('0x2'));var BPromise=require(_0xcd63('0x3'));var exec=require(_0xcd63('0x4'))[_0xcd63('0x5')];exports[_0xcd63('0x6')]=function(_0x1620a8){return new BPromise(function(_0xa0126,_0x4f7bb2){exec(_0x1620a8,function(_0xa1b98c,_0x3282aa,_0x5a5a09){logger['info'](_0xcd63('0x7'),_0x3282aa);if(_0xa1b98c){logger[_0xcd63('0x8')](_0xcd63('0x7'),_0xcd63('0x9'),util[_0xcd63('0xa')](_0xa1b98c,{'showHidden':![],'depth':null}),_0x3282aa,_0x5a5a09);_0x4f7bb2(_0xa1b98c);}_0xa0126(_0x3282aa);});});}; \ No newline at end of file +var _0x1ff1=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x117696,_0x18926a){var _0x5bef49=function(_0x1662cb){while(--_0x1662cb){_0x117696['push'](_0x117696['shift']());}};_0x5bef49(++_0x18926a);}(_0x1ff1,0x17a));var _0x11ff=function(_0x2c8fcd,_0x19a325){_0x2c8fcd=_0x2c8fcd-0x0;var _0x164a51=_0x1ff1[_0x2c8fcd];return _0x164a51;};'use strict';var util=require(_0x11ff('0x0'));var logger=require(_0x11ff('0x1'))(_0x11ff('0x2'));var BPromise=require(_0x11ff('0x3'));var exec=require(_0x11ff('0x4'))[_0x11ff('0x5')];exports[_0x11ff('0x6')]=function(_0x2a7030){return new BPromise(function(_0x43d4c6,_0x2bc762){exec(_0x2a7030,function(_0x16102d,_0x4edf6b,_0x4592da){logger[_0x11ff('0x7')](_0x11ff('0x8'),_0x4edf6b);if(_0x16102d){logger[_0x11ff('0x7')](_0x11ff('0x8'),_0x11ff('0x9'),util[_0x11ff('0xa')](_0x16102d,{'showHidden':![],'depth':null}),_0x4edf6b,_0x4592da);_0x2bc762(_0x16102d);}_0x43d4c6(_0x4edf6b);});});}; \ 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 e92f7c4..1f43522 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 _0xe248=['channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','fax','message','logger','info','addVariables','headerinfo','minrate','format','modem','gateway','t38timeout','path','variablesAction','uniqueid','originate'];(function(_0x3b3bbf,_0x4a674c){var _0x521e45=function(_0x53950e){while(--_0x53950e){_0x3b3bbf['push'](_0x3b3bbf['shift']());}};_0x521e45(++_0x4a674c);}(_0xe248,0xa6));var _0x8e24=function(_0x468c76,_0x32065b){_0x468c76=_0x468c76-0x0;var _0x4d991d=_0xe248[_0x468c76];return _0x4d991d;};'use strict';var util=require(_0x8e24('0x0'));var _=require(_0x8e24('0x1'));var moment=require(_0x8e24('0x2'));var logger=require('../../../../config/logger')(_0x8e24('0x3'));exports[_0x8e24('0x4')]=function(_0x438e9d){return{'message':_0x438e9d};};exports[_0x8e24('0x5')]=function(_0x22bb62,_0x5a27cc){logger[_0x8e24('0x6')](_0x22bb62,util['inspect'](_0x5a27cc,{'showHidden':![],'depth':null}));};exports[_0x8e24('0x7')]=function(_0x3a691c,_0x15f44a){var _0xb07a3e={'XMF-ECM':_0x15f44a['ecm'],'XMF-HEADERINFO':_0x15f44a[_0x8e24('0x8')],'XMF-MINRATE':_0x15f44a[_0x8e24('0x9')],'XMF-MAXRATE':_0x15f44a['maxrate'],'XMF-MODEM':util[_0x8e24('0xa')]('\x22%s\x22',_0x15f44a[_0x8e24('0xb')]),'XMF-GATEWAY':_0x15f44a[_0x8e24('0xc')],'XMF-FAXDETECT':_0x15f44a['faxdetect'],'XMF-T38TIMEOUT':_0x15f44a[_0x8e24('0xd')],'XMF-LOCALSTATIONID':_0x15f44a['localstationid'],'XMF-PATH':_0x3a691c[_0x8e24('0xe')]};return _0xb07a3e;};exports[_0x8e24('0xf')]=function(_0x143183,_0x199437){return{'actionid':_0x143183[_0x8e24('0x10')],'action':_0x8e24('0x11'),'channel':_0x143183[_0x8e24('0x12')],'Exten':_0x8e24('0x13'),'Context':_0x8e24('0x14'),'Priority':'1','callerid':util[_0x8e24('0xa')](_0x8e24('0x15'),_0x143183[_0x8e24('0x8')]?_0x143183['headerinfo']:'',_0x143183[_0x8e24('0x16')]),'variable':_0x199437,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x143183[_0x8e24('0x10')]};}; \ No newline at end of file +var _0xb757=['headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','channel','xcally-motion-fax','from-sip','util','lodash','moment','fax','message','info','ecm'];(function(_0x140b3e,_0x2cf7eb){var _0x557ead=function(_0x3bec9f){while(--_0x3bec9f){_0x140b3e['push'](_0x140b3e['shift']());}};_0x557ead(++_0x2cf7eb);}(_0xb757,0x1d9));var _0x7b75=function(_0x3479e5,_0x358d98){_0x3479e5=_0x3479e5-0x0;var _0x8f555a=_0xb757[_0x3479e5];return _0x8f555a;};'use strict';var util=require(_0x7b75('0x0'));var _=require(_0x7b75('0x1'));var moment=require(_0x7b75('0x2'));var logger=require('../../../../config/logger')(_0x7b75('0x3'));exports[_0x7b75('0x4')]=function(_0x477da7){return{'message':_0x477da7};};exports['logger']=function(_0x1f6251,_0x45a446){logger[_0x7b75('0x5')](_0x1f6251,util['inspect'](_0x45a446,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x26665b,_0x9aa158){var _0x156718={'XMF-ECM':_0x9aa158[_0x7b75('0x6')],'XMF-HEADERINFO':_0x9aa158[_0x7b75('0x7')],'XMF-MINRATE':_0x9aa158[_0x7b75('0x8')],'XMF-MAXRATE':_0x9aa158[_0x7b75('0x9')],'XMF-MODEM':util[_0x7b75('0xa')](_0x7b75('0xb'),_0x9aa158[_0x7b75('0xc')]),'XMF-GATEWAY':_0x9aa158[_0x7b75('0xd')],'XMF-FAXDETECT':_0x9aa158[_0x7b75('0xe')],'XMF-T38TIMEOUT':_0x9aa158['t38timeout'],'XMF-LOCALSTATIONID':_0x9aa158[_0x7b75('0xf')],'XMF-PATH':_0x26665b[_0x7b75('0x10')]};return _0x156718;};exports['variablesAction']=function(_0xe1a791,_0x2ec337){return{'actionid':_0xe1a791['uniqueid'],'action':'originate','channel':_0xe1a791[_0x7b75('0x11')],'Exten':_0x7b75('0x12'),'Context':_0x7b75('0x13'),'Priority':'1','callerid':util[_0x7b75('0xa')]('\x22%s\x22\x20<%s>',_0xe1a791[_0x7b75('0x7')]?_0xe1a791[_0x7b75('0x7')]:'',_0xe1a791[_0x7b75('0xf')]),'variable':_0x2ec337,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xe1a791['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 22c8cbf..b906f86 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 _0xdd89=['initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','error','[index.js][main]','bluebird','moment','./server','./realtime','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xdd89,0xf9));var _0x9dd8=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xdd89[_0x3181cc];return _0x547a4a;};'use strict';var BPromise=require(_0x9dd8('0x0'));var util=require('util');var moment=require(_0x9dd8('0x1'));var server=require(_0x9dd8('0x2'));var Realtime=require(_0x9dd8('0x3'));var Report=require('./report');var Acw=require(_0x9dd8('0x4'));var Trigger=require(_0x9dd8('0x5'));var Dialer=require(_0x9dd8('0x6'));var Preview=require('./preview');var Fax=require(_0x9dd8('0x7'));var user=require(_0x9dd8('0x8'));var voiceQueue=require(_0x9dd8('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x9dd8('0xa'));var trunk=require(_0x9dd8('0xb'));var trigger=require(_0x9dd8('0xc'));var template=require(_0x9dd8('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x9dd8('0xe'));var voiceExtension=require(_0x9dd8('0xf'));var faxAccount=require(_0x9dd8('0x10'));var zendesk=require(_0x9dd8('0x11'));var salesforce=require(_0x9dd8('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9dd8('0x13'));var desk=require(_0x9dd8('0x14'));var zoho=require(_0x9dd8('0x15'));var vtiger=require(_0x9dd8('0x16'));var freshsales=require(_0x9dd8('0x17'));var servicenow=require(_0x9dd8('0x18'));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(_0x9dd8('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9dd8('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9dd8('0x1b')](_0x9dd8('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9dd8('0x1c')]()[_0x9dd8('0x1d')](user[_0x9dd8('0x1e')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x1f')]())[_0x9dd8('0x1d')](user[_0x9dd8('0x20')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x21')]())[_0x9dd8('0x1d')](trunk[_0x9dd8('0x22')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x23')]())[_0x9dd8('0x1d')](voiceQueue['getVoiceQueues']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x24')]())[_0x9dd8('0x1d')](trigger[_0x9dd8('0x25')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x26')]())['then'](template[_0x9dd8('0x27')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x28')]())[_0x9dd8('0x1d')](zendesk[_0x9dd8('0x29')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x2a')]())[_0x9dd8('0x1d')](salesforce[_0x9dd8('0x2b')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x2c')]())[_0x9dd8('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x2d')]())[_0x9dd8('0x1d')](freshdesk[_0x9dd8('0x2e')]())[_0x9dd8('0x1d')](realtime['initFreshdeskAccounts']())['then'](desk[_0x9dd8('0x2f')]())['then'](realtime[_0x9dd8('0x30')]())[_0x9dd8('0x1d')](zoho['getZohoAccounts']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x31')]())[_0x9dd8('0x1d')](vtiger['getVtigerAccounts']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x32')]())[_0x9dd8('0x1d')](freshsales['getFreshsalesAccounts']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x33')]())[_0x9dd8('0x1d')](servicenow['getServicenowAccounts']())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x34')]())[_0x9dd8('0x1d')](dynamics365[_0x9dd8('0x35')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x36')]())['then'](campaign[_0x9dd8('0x37')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x38')]())[_0x9dd8('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())[_0x9dd8('0x1d')](faxAccount[_0x9dd8('0x39')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x3a')]())[_0x9dd8('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x9dd8('0x1c')]()['then'](voiceQueueReport[_0x9dd8('0x3b')]())[_0x9dd8('0x1d')](realtime[_0x9dd8('0x3c')]())[_0x9dd8('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x9dd8('0x3d')]())[_0x9dd8('0x1d')](cmHopperHistory[_0x9dd8('0x3e')]())[_0x9dd8('0x1d')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x9dd8('0x3f')]())['then'](realtime[_0x9dd8('0x40')]())[_0x9dd8('0x41')](function(_0x3c0b06){logger['error'](_0x9dd8('0x42'),util[_0x9dd8('0x43')](_0x3c0b06,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9dd8('0x44')](realtime,preview,fax)[_0x9dd8('0x1d')](function(_0x527192){return initRealtime();})[_0x9dd8('0x1d')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x9dd8('0x41')](function(_0x26ba07){logger[_0x9dd8('0x45')](_0x9dd8('0x46'),util[_0x9dd8('0x43')](_0x26ba07,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4137=['error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4137,0x1b1));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var server=require(_0x7413('0x3'));var Realtime=require(_0x7413('0x4'));var Report=require(_0x7413('0x5'));var Acw=require(_0x7413('0x6'));var Trigger=require(_0x7413('0x7'));var Dialer=require('./dialer');var Preview=require(_0x7413('0x8'));var Fax=require(_0x7413('0x9'));var user=require(_0x7413('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x7413('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7413('0xc'));var trigger=require(_0x7413('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x7413('0xe'));var campaign=require(_0x7413('0xf'));var voiceExtension=require(_0x7413('0x10'));var faxAccount=require(_0x7413('0x11'));var zendesk=require(_0x7413('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7413('0x13'));var freshdesk=require(_0x7413('0x14'));var desk=require(_0x7413('0x15'));var zoho=require(_0x7413('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x7413('0x17'));var servicenow=require(_0x7413('0x18'));var dynamics365=require(_0x7413('0x19'));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(_0x7413('0x1a'))(_0x7413('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7413('0x1c')](_0x7413('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7413('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7413('0x1e')]()[_0x7413('0x1f')](user[_0x7413('0x20')]())['then'](realtime['initAgents']())[_0x7413('0x1f')](user[_0x7413('0x21')]())['then'](realtime[_0x7413('0x22')]())[_0x7413('0x1f')](trunk[_0x7413('0x23')]())[_0x7413('0x1f')](realtime[_0x7413('0x24')]())[_0x7413('0x1f')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0x7413('0x1f')](trigger[_0x7413('0x25')]())[_0x7413('0x1f')](realtime[_0x7413('0x26')]())[_0x7413('0x1f')](template[_0x7413('0x27')]())[_0x7413('0x1f')](realtime[_0x7413('0x28')]())[_0x7413('0x1f')](zendesk[_0x7413('0x29')]())[_0x7413('0x1f')](realtime[_0x7413('0x2a')]())['then'](salesforce[_0x7413('0x2b')]())[_0x7413('0x1f')](realtime[_0x7413('0x2c')]())[_0x7413('0x1f')](sugarcrm[_0x7413('0x2d')]())[_0x7413('0x1f')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x7413('0x2e')]())[_0x7413('0x1f')](realtime['initFreshdeskAccounts']())[_0x7413('0x1f')](desk['getDeskAccounts']())[_0x7413('0x1f')](realtime[_0x7413('0x2f')]())[_0x7413('0x1f')](zoho['getZohoAccounts']())[_0x7413('0x1f')](realtime[_0x7413('0x30')]())[_0x7413('0x1f')](vtiger['getVtigerAccounts']())[_0x7413('0x1f')](realtime[_0x7413('0x31')]())['then'](freshsales[_0x7413('0x32')]())[_0x7413('0x1f')](realtime['initFreshsalesAccounts']())[_0x7413('0x1f')](servicenow[_0x7413('0x33')]())[_0x7413('0x1f')](realtime[_0x7413('0x34')]())[_0x7413('0x1f')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x7413('0x35')]())[_0x7413('0x1f')](campaign[_0x7413('0x36')]())[_0x7413('0x1f')](realtime[_0x7413('0x37')]())[_0x7413('0x1f')](voiceExtension[_0x7413('0x38')]())['then'](realtime[_0x7413('0x39')]())[_0x7413('0x1f')](faxAccount['getFaxAccounts']())[_0x7413('0x1f')](realtime[_0x7413('0x3a')]())[_0x7413('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x7413('0x1e')]()[_0x7413('0x1f')](voiceQueueReport[_0x7413('0x3b')]())[_0x7413('0x1f')](realtime[_0x7413('0x3c')]())[_0x7413('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x7413('0x3d')]())[_0x7413('0x1f')](cmHopperHistory[_0x7413('0x3e')]())[_0x7413('0x1f')](realtime[_0x7413('0x3f')]())[_0x7413('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x7413('0x1f')](realtime['initVoiceCallReports']())['catch'](function(_0x27bb1c){logger[_0x7413('0x40')](_0x7413('0x41'),util[_0x7413('0x42')](_0x27bb1c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7413('0x43')](realtime,preview,fax)['then'](function(_0x1b6ab6){return initRealtime();})[_0x7413('0x1f')](function(){return initParams();})[_0x7413('0x1f')](function(){report[_0x7413('0x44')]();setInterval(initRealtime,0x1388);})[_0x7413('0x45')](function(_0x10c3a3){logger[_0x7413('0x40')](_0x7413('0x46'),util[_0x7413('0x42')](_0x10c3a3,{'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 bf78a16..b5dbea2 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x1cd7ce,_0x34af1f){var _0xd8d682=function(_0x541b93){while(--_0x541b93){_0x1cd7ce['push'](_0x1cd7ce['shift']());}};_0xd8d682(++_0x34af1f);}(_0x70e0,0x17b));var _0x070e=function(_0x1ca16c,_0x2c51b8){_0x1ca16c=_0x1ca16c-0x0;var _0x213d65=_0x70e0[_0x1ca16c];return _0x213d65;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x4f6a59,_0x5f0303){var _0x36e0dd=function(_0x5bf726){while(--_0x5bf726){_0x4f6a59['push'](_0x4f6a59['shift']());}};_0x36e0dd(++_0x5f0303);}(_0xe706,0xa3));var _0x6e70=function(_0x46b057,_0x25aa56){_0x46b057=_0x46b057-0x0;var _0x25cf84=_0xe706[_0x46b057];return _0x25cf84;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index d067fba..b6e7cfb 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 _0xb104=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb104,0x8c));var _0x4b10=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb104[_0x40220a];return _0x3903cc;};'use strict';function Campaign(_0x524d18){this['id']=_0x524d18['id']||0x0;this['name']=_0x524d18[_0x4b10('0x0')]||'';this[_0x4b10('0x1')]=_0x524d18[_0x4b10('0x1')]||'campaign';this[_0x4b10('0x2')]=0x0;this[_0x4b10('0x3')]=0x0;this[_0x4b10('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x4b10('0x5')]=!![];this[_0x4b10('0x6')]=_0x524d18[_0x4b10('0x6')];this[_0x4b10('0x7')]=_0x524d18[_0x4b10('0x7')];this[_0x4b10('0x8')]=_0x524d18['dialTimezone']||null;this[_0x4b10('0x9')]=_0x524d18[_0x4b10('0x9')]?_0x524d18[_0x4b10('0x9')]:null;this[_0x4b10('0xa')]=_0x524d18['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x524d18[_0x4b10('0xb')];this[_0x4b10('0xc')]=_0x524d18[_0x4b10('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x524d18[_0x4b10('0xd')];this[_0x4b10('0xe')]=_0x524d18[_0x4b10('0xe')];this[_0x4b10('0xf')]=_0x524d18[_0x4b10('0xf')];this[_0x4b10('0x10')]=_0x524d18['dialBusyRetryFrequency'];this[_0x4b10('0x11')]=_0x524d18[_0x4b10('0x11')];this[_0x4b10('0x12')]=_0x524d18[_0x4b10('0x12')];this[_0x4b10('0x13')]=_0x524d18[_0x4b10('0x13')];this[_0x4b10('0x14')]=_0x524d18['dialNoSuchNumberMaxRetry']||0x3;this[_0x4b10('0x15')]=_0x524d18['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4b10('0x16')]=_0x524d18[_0x4b10('0x16')]||0x3;this[_0x4b10('0x17')]=_0x524d18[_0x4b10('0x17')]||0x96;this[_0x4b10('0x18')]=_0x524d18[_0x4b10('0x18')]||0x3;this[_0x4b10('0x19')]=_0x524d18[_0x4b10('0x19')]||0x96;this['dialMachineMaxRetry']=_0x524d18[_0x4b10('0x1a')]||0x3;this[_0x4b10('0x1b')]=_0x524d18[_0x4b10('0x1b')]||0x96;this[_0x4b10('0x1c')]=_0x524d18[_0x4b10('0x1c')]||0x3;this[_0x4b10('0x1d')]=_0x524d18['dialAgentRejectRetryFrequency']||0x96;this[_0x4b10('0x1e')]=_0x524d18['dialOrderByScheduledAt']||_0x4b10('0x1f');this['dialPrefix']=_0x524d18[_0x4b10('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x524d18[_0x4b10('0x21')]||undefined;this[_0x4b10('0x22')]=_0x524d18['dialCutDigit']||undefined;this[_0x4b10('0x23')]=_0x524d18['TrunkBackup']?_0x524d18[_0x4b10('0x23')]:undefined;this['Trunk']=_0x524d18['Trunk']?_0x524d18['Trunk']:undefined;this['Interval']=_0x524d18[_0x4b10('0x24')]?_0x524d18[_0x4b10('0x24')]:undefined;this[_0x4b10('0x25')]=_0x524d18[_0x4b10('0x25')]?_0x524d18['SquareProject']:undefined;this[_0x4b10('0x26')]=_0x524d18['SquareProject']?_0x524d18[_0x4b10('0x25')][_0x4b10('0x0')]:undefined;this[_0x4b10('0x27')]=_0x524d18[_0x4b10('0x27')]||![];this['dialAMDInitialSilence']=_0x524d18[_0x4b10('0x28')];this[_0x4b10('0x29')]=_0x524d18[_0x4b10('0x29')];this[_0x4b10('0x2a')]=_0x524d18['dialAMDAfterGreetingSilence'];this[_0x4b10('0x2b')]=_0x524d18[_0x4b10('0x2b')];this[_0x4b10('0x2c')]=_0x524d18[_0x4b10('0x2c')];this[_0x4b10('0x2d')]=_0x524d18[_0x4b10('0x2d')];this[_0x4b10('0x2e')]=_0x524d18[_0x4b10('0x2e')];this[_0x4b10('0x2f')]=_0x524d18[_0x4b10('0x2f')];this[_0x4b10('0x30')]=_0x524d18[_0x4b10('0x30')];}module[_0x4b10('0x31')]=Campaign; \ No newline at end of file +var _0x27ef=['dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x27ef,0x1de));var _0xf27e=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x27ef[_0x2dc7c9];return _0x3e6536;};'use strict';function Campaign(_0x4c2d3d){this['id']=_0x4c2d3d['id']||0x0;this[_0xf27e('0x0')]=_0x4c2d3d[_0xf27e('0x0')]||'';this[_0xf27e('0x1')]=_0x4c2d3d[_0xf27e('0x1')]||'campaign';this['originated']=0x0;this[_0xf27e('0x2')]=0x0;this[_0xf27e('0x3')]=0x0;this[_0xf27e('0x4')]=0x0;this['message']='';this[_0xf27e('0x5')]=!![];this[_0xf27e('0x6')]=_0x4c2d3d[_0xf27e('0x6')];this[_0xf27e('0x7')]=_0x4c2d3d[_0xf27e('0x7')];this[_0xf27e('0x8')]=_0x4c2d3d[_0xf27e('0x8')]||null;this[_0xf27e('0x9')]=_0x4c2d3d[_0xf27e('0x9')]?_0x4c2d3d[_0xf27e('0x9')]:null;this[_0xf27e('0xa')]=_0x4c2d3d[_0xf27e('0xa')];this[_0xf27e('0xb')]=_0x4c2d3d['dialOriginateCallerIdNumber'];this[_0xf27e('0xc')]=_0x4c2d3d['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x4c2d3d['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4c2d3d[_0xf27e('0xd')];this[_0xf27e('0xe')]=_0x4c2d3d[_0xf27e('0xe')];this['dialBusyRetryFrequency']=_0x4c2d3d[_0xf27e('0xf')];this[_0xf27e('0x10')]=_0x4c2d3d[_0xf27e('0x10')];this[_0xf27e('0x11')]=_0x4c2d3d[_0xf27e('0x11')];this[_0xf27e('0x12')]=_0x4c2d3d[_0xf27e('0x12')];this[_0xf27e('0x13')]=_0x4c2d3d[_0xf27e('0x13')]||0x3;this[_0xf27e('0x14')]=_0x4c2d3d[_0xf27e('0x14')]||0x96;this[_0xf27e('0x15')]=_0x4c2d3d[_0xf27e('0x15')]||0x3;this[_0xf27e('0x16')]=_0x4c2d3d[_0xf27e('0x16')]||0x96;this[_0xf27e('0x17')]=_0x4c2d3d[_0xf27e('0x17')]||0x3;this[_0xf27e('0x18')]=_0x4c2d3d[_0xf27e('0x18')]||0x96;this[_0xf27e('0x19')]=_0x4c2d3d['dialMachineMaxRetry']||0x3;this[_0xf27e('0x1a')]=_0x4c2d3d[_0xf27e('0x1a')]||0x96;this[_0xf27e('0x1b')]=_0x4c2d3d[_0xf27e('0x1b')]||0x3;this[_0xf27e('0x1c')]=_0x4c2d3d[_0xf27e('0x1c')]||0x96;this[_0xf27e('0x1d')]=_0x4c2d3d[_0xf27e('0x1d')]||'DESC';this['dialPrefix']=_0x4c2d3d[_0xf27e('0x1e')]||undefined;this[_0xf27e('0x1f')]=_0x4c2d3d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf27e('0x20')]=_0x4c2d3d[_0xf27e('0x20')]||undefined;this[_0xf27e('0x21')]=_0x4c2d3d[_0xf27e('0x21')]?_0x4c2d3d['TrunkBackup']:undefined;this[_0xf27e('0x22')]=_0x4c2d3d[_0xf27e('0x22')]?_0x4c2d3d['Trunk']:undefined;this[_0xf27e('0x23')]=_0x4c2d3d['Interval']?_0x4c2d3d[_0xf27e('0x23')]:undefined;this[_0xf27e('0x24')]=_0x4c2d3d['SquareProject']?_0x4c2d3d[_0xf27e('0x24')]:undefined;this[_0xf27e('0x25')]=_0x4c2d3d[_0xf27e('0x24')]?_0x4c2d3d[_0xf27e('0x24')][_0xf27e('0x0')]:undefined;this[_0xf27e('0x26')]=_0x4c2d3d['dialAMDActive']||![];this[_0xf27e('0x27')]=_0x4c2d3d['dialAMDInitialSilence'];this[_0xf27e('0x28')]=_0x4c2d3d[_0xf27e('0x28')];this[_0xf27e('0x29')]=_0x4c2d3d[_0xf27e('0x29')];this[_0xf27e('0x2a')]=_0x4c2d3d[_0xf27e('0x2a')];this[_0xf27e('0x2b')]=_0x4c2d3d[_0xf27e('0x2b')];this['dialAMDBetweenWordsSilence']=_0x4c2d3d[_0xf27e('0x2c')];this[_0xf27e('0x2d')]=_0x4c2d3d[_0xf27e('0x2d')];this['dialAMDSilenceThreshold']=_0x4c2d3d[_0xf27e('0x2e')];this['dialAMDMaximumWordLength']=_0x4c2d3d[_0xf27e('0x2f')];}module[_0xf27e('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 30da3f9..dea9e9c 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 _0xf347=['holdtime','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','context','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds'];(function(_0x287a86,_0x58f52d){var _0x37079f=function(_0x2238fb){while(--_0x2238fb){_0x287a86['push'](_0x287a86['shift']());}};_0x37079f(++_0x58f52d);}(_0xf347,0xa1));var _0x7f34=function(_0x23c500,_0x411893){_0x23c500=_0x23c500-0x0;var _0x298bf2=_0xf347[_0x23c500];return _0x298bf2;};'use strict';function Channel(){this[_0x7f34('0x0')]=null;this[_0x7f34('0x1')]='';this['destinationchannel']='';this[_0x7f34('0x2')]=0x0;this['calleridname']='';this[_0x7f34('0x3')]=undefined;this[_0x7f34('0x4')]=undefined;this['accountcode']=0x0;this[_0x7f34('0x5')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x7f34('0x6')]=0x0;this[_0x7f34('0x7')]=![];this[_0x7f34('0x8')]=null;this['endtime']=null;this[_0x7f34('0x9')]=![];this[_0x7f34('0xa')]=![];this[_0x7f34('0xb')]='';this['lastdata']='';this[_0x7f34('0xc')]=0x0;this[_0x7f34('0xd')]=0x0;this[_0x7f34('0xe')]=0x0;this['type']=null;this[_0x7f34('0xf')]=null;this[_0x7f34('0x10')]=null;this[_0x7f34('0x11')]=![];this[_0x7f34('0x12')]=null;this[_0x7f34('0x13')]=null;this['monitors']=[];this[_0x7f34('0x14')]=undefined;this[_0x7f34('0x15')]=undefined;this[_0x7f34('0x16')]=undefined;this[_0x7f34('0x17')]=0x0;}module[_0x7f34('0x18')]=Channel; \ No newline at end of file +var _0x3ace=['mohtime','exports','channel','destinationchannel','calleridnum','connectedlinename','accountcode','context','linkedid','answertime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x433f7b,_0x40ce1a){var _0x5a20b2=function(_0x2eb8d9){while(--_0x2eb8d9){_0x433f7b['push'](_0x433f7b['shift']());}};_0x5a20b2(++_0x40ce1a);}(_0x3ace,0xda));var _0xe3ac=function(_0x6b984e,_0x68c344){_0x6b984e=_0x6b984e-0x0;var _0x7a7581=_0x3ace[_0x6b984e];return _0x7a7581;};'use strict';function Channel(){this['starttime']=null;this[_0xe3ac('0x0')]='';this[_0xe3ac('0x1')]='';this[_0xe3ac('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xe3ac('0x3')]=undefined;this[_0xe3ac('0x4')]=0x0;this[_0xe3ac('0x5')]='';this['uniqueid']=0x0;this[_0xe3ac('0x6')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xe3ac('0x7')]=null;this['endtime']=null;this[_0xe3ac('0x8')]=![];this['abandoned']=![];this[_0xe3ac('0x9')]='';this[_0xe3ac('0xa')]='';this[_0xe3ac('0xb')]=0x0;this[_0xe3ac('0xc')]=0x0;this[_0xe3ac('0xd')]=0x0;this['type']=null;this[_0xe3ac('0xe')]=null;this[_0xe3ac('0xf')]=null;this[_0xe3ac('0x10')]=![];this['monitorFilename']=null;this[_0xe3ac('0x11')]=null;this[_0xe3ac('0x12')]=[];this[_0xe3ac('0x13')]=undefined;this[_0xe3ac('0x14')]=undefined;this[_0xe3ac('0x15')]=undefined;this[_0xe3ac('0x16')]=0x0;}module[_0xe3ac('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c94d3b3..bf0b6f5 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 _0x3eeb=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0x3eeb,0x143));var _0xb3ee=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3eeb[_0x1facfa];return _0x9ec701;};'use strict';function DeskAccount(_0x8217b7){this['id']=_0x8217b7['id']||0x0;this[_0xb3ee('0x0')]=_0x8217b7[_0xb3ee('0x0')]||'';this[_0xb3ee('0x1')]=_0x8217b7[_0xb3ee('0x1')]||'';this[_0xb3ee('0x2')]=_0x8217b7['remoteUri']||'';this[_0xb3ee('0x3')]=_0x8217b7['authType']||'';this[_0xb3ee('0x4')]=_0x8217b7[_0xb3ee('0x4')]||'';this['consumerKey']=_0x8217b7[_0xb3ee('0x5')]||'';this[_0xb3ee('0x6')]=_0x8217b7[_0xb3ee('0x6')]||'';this[_0xb3ee('0x7')]=_0x8217b7[_0xb3ee('0x7')]||'';this[_0xb3ee('0x8')]=_0x8217b7['tokenSecret']||'';this[_0xb3ee('0x9')]=_0x8217b7[_0xb3ee('0x9')]||'';this[_0xb3ee('0xa')]=_0x8217b7[_0xb3ee('0xa')]||'';this[_0xb3ee('0xb')]=_0x8217b7[_0xb3ee('0xb')]||{};}module[_0xb3ee('0xc')]=DeskAccount; \ No newline at end of file +var _0x6d84=['authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4e755d,_0x522543){var _0x347f46=function(_0x14c75b){while(--_0x14c75b){_0x4e755d['push'](_0x4e755d['shift']());}};_0x347f46(++_0x522543);}(_0x6d84,0x75));var _0x46d8=function(_0x395417,_0x37f24b){_0x395417=_0x395417-0x0;var _0x5b50ac=_0x6d84[_0x395417];return _0x5b50ac;};'use strict';function DeskAccount(_0xf960fd){this['id']=_0xf960fd['id']||0x0;this['name']=_0xf960fd[_0x46d8('0x0')]||'';this[_0x46d8('0x1')]=_0xf960fd[_0x46d8('0x1')]||'';this[_0x46d8('0x2')]=_0xf960fd[_0x46d8('0x2')]||'';this[_0x46d8('0x3')]=_0xf960fd['authType']||'';this['password']=_0xf960fd['password']||'';this[_0x46d8('0x4')]=_0xf960fd['consumerKey']||'';this[_0x46d8('0x5')]=_0xf960fd['consumerSecret']||'';this[_0x46d8('0x6')]=_0xf960fd[_0x46d8('0x6')]||'';this[_0x46d8('0x7')]=_0xf960fd['tokenSecret']||'';this[_0x46d8('0x8')]=_0xf960fd[_0x46d8('0x8')]||'';this[_0x46d8('0x9')]=_0xf960fd['serverUrl']||'';this[_0x46d8('0xa')]=_0xf960fd['Configurations']||{};}module[_0x46d8('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7f133b5..5360000 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 _0xafe7=['clientSecret','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xafe7,0x9a));var _0x7afe=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xafe7[_0xefd519];return _0x4bb882;};'use strict';function Dynamics365Account(_0x8bc01d){this['id']=_0x8bc01d['id']||0x0;this['name']=_0x8bc01d[_0x7afe('0x0')]||'';this[_0x7afe('0x1')]=_0x8bc01d[_0x7afe('0x1')]||'';this[_0x7afe('0x2')]=_0x8bc01d[_0x7afe('0x2')]||'';this[_0x7afe('0x3')]=_0x8bc01d[_0x7afe('0x3')]||'';this[_0x7afe('0x4')]=_0x8bc01d[_0x7afe('0x4')]||'';this[_0x7afe('0x5')]=_0x8bc01d[_0x7afe('0x5')]||'';this[_0x7afe('0x6')]=_0x8bc01d[_0x7afe('0x6')]||{};this['serverUrl']=_0x8bc01d['serverUrl']||'';this[_0x7afe('0x7')]=_0x8bc01d[_0x7afe('0x7')]||![];this[_0x7afe('0x8')]=_0x8bc01d[_0x7afe('0x8')]||{};this[_0x7afe('0x9')]=_0x8bc01d['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xa6dc=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x2c9583,_0xa6e8b0){var _0x30dd9f=function(_0x14fa7c){while(--_0x14fa7c){_0x2c9583['push'](_0x2c9583['shift']());}};_0x30dd9f(++_0xa6e8b0);}(_0xa6dc,0x127));var _0xca6d=function(_0x3f67b0,_0x1218f7){_0x3f67b0=_0x3f67b0-0x0;var _0xc14917=_0xa6dc[_0x3f67b0];return _0xc14917;};'use strict';function Dynamics365Account(_0x15db23){this['id']=_0x15db23['id']||0x0;this['name']=_0x15db23[_0xca6d('0x0')]||'';this[_0xca6d('0x1')]=_0x15db23[_0xca6d('0x1')]||'';this[_0xca6d('0x2')]=_0x15db23['password']||'';this['remoteUri']=_0x15db23[_0xca6d('0x3')]||'';this[_0xca6d('0x4')]=_0x15db23[_0xca6d('0x4')]||'';this['clientId']=_0x15db23[_0xca6d('0x5')]||'';this[_0xca6d('0x6')]=_0x15db23[_0xca6d('0x6')]||{};this[_0xca6d('0x7')]=_0x15db23[_0xca6d('0x7')]||'';this[_0xca6d('0x8')]=_0x15db23[_0xca6d('0x8')]||![];this['Configurations']=_0x15db23[_0xca6d('0x9')]||{};this[_0xca6d('0xa')]=_0x15db23[_0xca6d('0xa')]||{};}module[_0xca6d('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 e5da543..8ca9901 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 _0x29f9=['t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x5e5c5a,_0x5883aa){var _0x24a118=function(_0x4abe98){while(--_0x4abe98){_0x5e5c5a['push'](_0x5e5c5a['shift']());}};_0x24a118(++_0x5883aa);}(_0x29f9,0x96));var _0x929f=function(_0x3299e7,_0x3e302b){_0x3299e7=_0x3299e7-0x0;var _0x4baade=_0x29f9[_0x3299e7];return _0x4baade;};'use strict';function FaxAccount(_0x14921a){this['id']=_0x14921a['id']||0x0;this[_0x929f('0x0')]=_0x14921a[_0x929f('0x0')]||'';this[_0x929f('0x1')]=_0x14921a['description'];this[_0x929f('0x2')]=_0x14921a[_0x929f('0x2')];this['headerinfo']=_0x14921a[_0x929f('0x3')];this[_0x929f('0x4')]=_0x14921a[_0x929f('0x4')];this[_0x929f('0x5')]=_0x14921a[_0x929f('0x5')]||0x960;this[_0x929f('0x6')]=_0x14921a[_0x929f('0x6')]||0x3840;this[_0x929f('0x7')]=_0x14921a[_0x929f('0x7')]||_0x929f('0x8');this[_0x929f('0x9')]=_0x14921a[_0x929f('0x9')]||'no';this['faxdetect']=_0x14921a['faxdetect']||'no';this[_0x929f('0xa')]=_0x14921a[_0x929f('0xa')]||0x1388;this[_0x929f('0xb')]=_0x14921a[_0x929f('0xb')]||_0x929f('0xc');this[_0x929f('0xd')]=_0x14921a[_0x929f('0xd')]?_0x14921a['Trunk']:undefined;this[_0x929f('0xe')]=_0x14921a[_0x929f('0xe')];this[_0x929f('0xf')]=_0x14921a['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x5935=['gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5935,0x149));var _0x5593=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x5935[_0x31eb67];return _0x2a8cb8;};'use strict';function FaxAccount(_0x1a3568){this['id']=_0x1a3568['id']||0x0;this[_0x5593('0x0')]=_0x1a3568[_0x5593('0x0')]||'';this[_0x5593('0x1')]=_0x1a3568[_0x5593('0x1')];this[_0x5593('0x2')]=_0x1a3568[_0x5593('0x2')];this[_0x5593('0x3')]=_0x1a3568[_0x5593('0x3')];this[_0x5593('0x4')]=_0x1a3568[_0x5593('0x4')];this[_0x5593('0x5')]=_0x1a3568[_0x5593('0x5')]||0x960;this['maxrate']=_0x1a3568['maxrate']||0x3840;this['modem']=_0x1a3568['modem']||_0x5593('0x6');this[_0x5593('0x7')]=_0x1a3568[_0x5593('0x7')]||'no';this['faxdetect']=_0x1a3568[_0x5593('0x8')]||'no';this[_0x5593('0x9')]=_0x1a3568[_0x5593('0x9')]||0x1388;this[_0x5593('0xa')]=_0x1a3568[_0x5593('0xa')]||'SIP';this[_0x5593('0xb')]=_0x1a3568[_0x5593('0xb')]?_0x1a3568[_0x5593('0xb')]:undefined;this[_0x5593('0xc')]=_0x1a3568[_0x5593('0xc')];this[_0x5593('0xd')]=_0x1a3568[_0x5593('0xd')];}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 6ecbd42..f95169c 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 _0xce08=['serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4dd1a7,_0x6c68cb){var _0x596428=function(_0x467ad0){while(--_0x467ad0){_0x4dd1a7['push'](_0x4dd1a7['shift']());}};_0x596428(++_0x6c68cb);}(_0xce08,0x1ca));var _0x8ce0=function(_0x4ff7e8,_0x30888e){_0x4ff7e8=_0x4ff7e8-0x0;var _0x12d11b=_0xce08[_0x4ff7e8];return _0x12d11b;};'use strict';function FreshdeskAccount(_0x101d49){this['id']=_0x101d49['id']||0x0;this[_0x8ce0('0x0')]=_0x101d49[_0x8ce0('0x0')]||'';this[_0x8ce0('0x1')]=_0x101d49[_0x8ce0('0x1')]||'';this[_0x8ce0('0x2')]=_0x101d49[_0x8ce0('0x3')]||'';this['remoteUri']=_0x101d49['remoteUri']||'';this[_0x8ce0('0x4')]=_0x101d49['serverUrl']||'';this[_0x8ce0('0x5')]=_0x101d49[_0x8ce0('0x5')]||{};}module[_0x8ce0('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x559b=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x4bdee7,_0x1d9bde){var _0x5b39cd=function(_0xb4774){while(--_0xb4774){_0x4bdee7['push'](_0x4bdee7['shift']());}};_0x5b39cd(++_0x1d9bde);}(_0x559b,0x17e));var _0xb559=function(_0x509236,_0x492491){_0x509236=_0x509236-0x0;var _0x5dff26=_0x559b[_0x509236];return _0x5dff26;};'use strict';function FreshdeskAccount(_0x3a9b35){this['id']=_0x3a9b35['id']||0x0;this['name']=_0x3a9b35[_0xb559('0x0')]||'';this[_0xb559('0x1')]=_0x3a9b35[_0xb559('0x1')]||'';this[_0xb559('0x2')]=_0x3a9b35['token']||'';this[_0xb559('0x3')]=_0x3a9b35[_0xb559('0x3')]||'';this[_0xb559('0x4')]=_0x3a9b35['serverUrl']||'';this[_0xb559('0x5')]=_0x3a9b35[_0xb559('0x5')]||{};}module[_0xb559('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ce35016..95f8625 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 _0x647c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x145c99,_0x3fdb01){var _0x52a05f=function(_0x36feb0){while(--_0x36feb0){_0x145c99['push'](_0x145c99['shift']());}};_0x52a05f(++_0x3fdb01);}(_0x647c,0x1d3));var _0xc647=function(_0x166e33,_0x127e77){_0x166e33=_0x166e33-0x0;var _0x1a2409=_0x647c[_0x166e33];return _0x1a2409;};'use strict';function FreshsalesAccount(_0x473a5d){this['id']=_0x473a5d['id']||0x0;this['name']=_0x473a5d[_0xc647('0x0')]||'';this[_0xc647('0x1')]=_0x473a5d['username']||'';this[_0xc647('0x2')]=_0x473a5d[_0xc647('0x3')]||'';this[_0xc647('0x4')]=_0x473a5d[_0xc647('0x4')]||'';this[_0xc647('0x5')]=_0x473a5d['serverUrl']||'';this[_0xc647('0x6')]=_0x473a5d[_0xc647('0x6')]||{};}module[_0xc647('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x96f1=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x5eb9e4,_0xfe886d){var _0xf661a4=function(_0x4aaa95){while(--_0x4aaa95){_0x5eb9e4['push'](_0x5eb9e4['shift']());}};_0xf661a4(++_0xfe886d);}(_0x96f1,0x19c));var _0x196f=function(_0x5439b6,_0x5365e8){_0x5439b6=_0x5439b6-0x0;var _0x2de07c=_0x96f1[_0x5439b6];return _0x2de07c;};'use strict';function FreshsalesAccount(_0xf5b6fa){this['id']=_0xf5b6fa['id']||0x0;this[_0x196f('0x0')]=_0xf5b6fa[_0x196f('0x0')]||'';this[_0x196f('0x1')]=_0xf5b6fa[_0x196f('0x1')]||'';this[_0x196f('0x2')]=_0xf5b6fa[_0x196f('0x3')]||'';this[_0x196f('0x4')]=_0xf5b6fa['remoteUri']||'';this['serverUrl']=_0xf5b6fa[_0x196f('0x5')]||'';this[_0x196f('0x6')]=_0xf5b6fa[_0x196f('0x6')]||{};}module[_0x196f('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f62bfb9..46dbe27 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 _0x63ac=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type'];(function(_0x42a9c8,_0x21397e){var _0x320503=function(_0x2f495c){while(--_0x2f495c){_0x42a9c8['push'](_0x42a9c8['shift']());}};_0x320503(++_0x21397e);}(_0x63ac,0x103));var _0xc63a=function(_0x38add1,_0x44b935){_0x38add1=_0x38add1-0x0;var _0x234c6f=_0x63ac[_0x38add1];return _0x234c6f;};'use strict';function QueueReport(){this[_0xc63a('0x0')]='inbound';this[_0xc63a('0x1')]='';this[_0xc63a('0x2')]='';this[_0xc63a('0x3')]='';this[_0xc63a('0x4')]='';this[_0xc63a('0x5')]=null;this[_0xc63a('0x6')]=null;this[_0xc63a('0x7')]=0x1;this[_0xc63a('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc63a('0x9')]=![];this[_0xc63a('0xa')]=null;this[_0xc63a('0xb')]=![];this[_0xc63a('0xc')]=null;this[_0xc63a('0xd')]=0x1;this[_0xc63a('0xe')]='';this[_0xc63a('0xf')]='';this[_0xc63a('0x10')]='';this['accountcode']='';this[_0xc63a('0x11')]='';this['exten']='';this[_0xc63a('0x12')]='';this[_0xc63a('0x13')]=0x0;this[_0xc63a('0x14')]=![];this[_0xc63a('0x15')]='';this[_0xc63a('0x16')]='voice';this[_0xc63a('0x17')]=0x0;this[_0xc63a('0x18')]={};}module[_0xc63a('0x19')]=QueueReport; \ No newline at end of file +var _0x75e8=['queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports','inbound','uniqueid','calleridname'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x75e8,0x195));var _0x875e=function(_0x260406,_0x51c131){_0x260406=_0x260406-0x0;var _0x20be38=_0x75e8[_0x260406];return _0x20be38;};'use strict';function QueueReport(){this['type']=_0x875e('0x0');this[_0x875e('0x1')]='';this['calleridnum']='';this[_0x875e('0x2')]='';this[_0x875e('0x3')]='';this[_0x875e('0x4')]=null;this[_0x875e('0x5')]=null;this[_0x875e('0x6')]=0x1;this['count']=0x1;this[_0x875e('0x7')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x875e('0x8')]=null;this[_0x875e('0x9')]=![];this[_0x875e('0xa')]=null;this[_0x875e('0xb')]=0x1;this[_0x875e('0xc')]='';this[_0x875e('0xd')]='';this[_0x875e('0xe')]='';this['accountcode']='';this[_0x875e('0xf')]='';this['exten']='';this[_0x875e('0x10')]='';this[_0x875e('0x11')]=0x0;this[_0x875e('0x12')]=![];this[_0x875e('0x13')]='';this['motionChannel']=_0x875e('0x14');this[_0x875e('0x15')]=0x0;this[_0x875e('0x16')]={};}module[_0x875e('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 4c00240..a30b432 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 _0xaee1=['password','clientId','securityToken','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x3543e7,_0x501fcf){var _0x42df23=function(_0x467049){while(--_0x467049){_0x3543e7['push'](_0x3543e7['shift']());}};_0x42df23(++_0x501fcf);}(_0xaee1,0x12f));var _0x1aee=function(_0x355c4e,_0x43e7ff){_0x355c4e=_0x355c4e-0x0;var _0xa03c35=_0xaee1[_0x355c4e];return _0xa03c35;};'use strict';function SalesforceAccount(_0x5ac827){this['id']=_0x5ac827['id']||0x0;this['name']=_0x5ac827[_0x1aee('0x0')]||'';this['username']=_0x5ac827[_0x1aee('0x1')]||'';this[_0x1aee('0x2')]=_0x5ac827[_0x1aee('0x2')]||'';this[_0x1aee('0x3')]=_0x5ac827[_0x1aee('0x3')]||'';this['clientId']=_0x5ac827[_0x1aee('0x4')]||'';this['clientSecret']=_0x5ac827['clientSecret']||'';this[_0x1aee('0x5')]=_0x5ac827[_0x1aee('0x5')]||'';this[_0x1aee('0x6')]=_0x5ac827[_0x1aee('0x6')]||'integrationTab';this[_0x1aee('0x7')]=_0x5ac827[_0x1aee('0x7')]||'';this[_0x1aee('0x8')]=_0x5ac827[_0x1aee('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x3a6f=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x2edcf8,_0x2ee814){var _0x386a54=function(_0x2e5632){while(--_0x2e5632){_0x2edcf8['push'](_0x2edcf8['shift']());}};_0x386a54(++_0x2ee814);}(_0x3a6f,0x1b3));var _0xf3a6=function(_0x16a054,_0x5179b9){_0x16a054=_0x16a054-0x0;var _0xbb48f8=_0x3a6f[_0x16a054];return _0xbb48f8;};'use strict';function SalesforceAccount(_0x425de5){this['id']=_0x425de5['id']||0x0;this[_0xf3a6('0x0')]=_0x425de5[_0xf3a6('0x0')]||'';this['username']=_0x425de5[_0xf3a6('0x1')]||'';this[_0xf3a6('0x2')]=_0x425de5[_0xf3a6('0x2')]||'';this[_0xf3a6('0x3')]=_0x425de5[_0xf3a6('0x3')]||'';this['clientId']=_0x425de5[_0xf3a6('0x4')]||'';this['clientSecret']=_0x425de5[_0xf3a6('0x5')]||'';this[_0xf3a6('0x6')]=_0x425de5[_0xf3a6('0x6')]||'';this[_0xf3a6('0x7')]=_0x425de5[_0xf3a6('0x7')]||_0xf3a6('0x8');this[_0xf3a6('0x9')]=_0x425de5[_0xf3a6('0x9')]||'';this[_0xf3a6('0xa')]=_0x425de5['Configurations']||{};}module[_0xf3a6('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 0dd668c..0a4521a 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 _0x092a=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x092a,0xf4));var _0xa092=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0x092a[_0x5b474c];return _0x273b2c;};'use strict';function ServicenowAccount(_0x5114bd){this['id']=_0x5114bd['id']||0x0;this[_0xa092('0x0')]=_0x5114bd[_0xa092('0x0')]||'';this['username']=_0x5114bd[_0xa092('0x1')]||'';this[_0xa092('0x2')]=_0x5114bd['password']||'';this['remoteUri']=_0x5114bd[_0xa092('0x3')]||'';this[_0xa092('0x4')]=_0x5114bd[_0xa092('0x4')]||'';this[_0xa092('0x5')]=_0x5114bd[_0xa092('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x0367=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x14ecc5,_0x1bdc5d){var _0x125555=function(_0x8d35f6){while(--_0x8d35f6){_0x14ecc5['push'](_0x14ecc5['shift']());}};_0x125555(++_0x1bdc5d);}(_0x0367,0x1e7));var _0x7036=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0367[_0x126558];return _0x1f6d14;};'use strict';function ServicenowAccount(_0x58e0dd){this['id']=_0x58e0dd['id']||0x0;this[_0x7036('0x0')]=_0x58e0dd['name']||'';this[_0x7036('0x1')]=_0x58e0dd[_0x7036('0x1')]||'';this[_0x7036('0x2')]=_0x58e0dd['password']||'';this[_0x7036('0x3')]=_0x58e0dd[_0x7036('0x3')]||'';this[_0x7036('0x4')]=_0x58e0dd[_0x7036('0x4')]||'';this[_0x7036('0x5')]=_0x58e0dd[_0x7036('0x5')]||{};}module[_0x7036('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 150efd8..09b3dc4 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 _0x4673=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x30775e,_0x21b017){var _0x150e2e=function(_0x483075){while(--_0x483075){_0x30775e['push'](_0x30775e['shift']());}};_0x150e2e(++_0x21b017);}(_0x4673,0x147));var _0x3467=function(_0x2bd74f,_0x47231f){_0x2bd74f=_0x2bd74f-0x0;var _0x5d50e3=_0x4673[_0x2bd74f];return _0x5d50e3;};'use strict';function SugarcrmAccount(_0x1eca31){this['id']=_0x1eca31['id']||0x0;this[_0x3467('0x0')]=_0x1eca31[_0x3467('0x0')]||'';this[_0x3467('0x1')]=_0x1eca31[_0x3467('0x1')]||'';this['password']=_0x1eca31['password']||'';this[_0x3467('0x2')]=_0x1eca31[_0x3467('0x2')]||'';this[_0x3467('0x3')]=_0x1eca31[_0x3467('0x3')]||'';this[_0x3467('0x4')]=_0x1eca31[_0x3467('0x4')]||{};}module[_0x3467('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x2406=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x378551,_0x5c86dc){var _0x1a3f6e=function(_0x140b99){while(--_0x140b99){_0x378551['push'](_0x378551['shift']());}};_0x1a3f6e(++_0x5c86dc);}(_0x2406,0x1a7));var _0x6240=function(_0x3d8502,_0x5b23b4){_0x3d8502=_0x3d8502-0x0;var _0x2e8073=_0x2406[_0x3d8502];return _0x2e8073;};'use strict';function SugarcrmAccount(_0x2c42e0){this['id']=_0x2c42e0['id']||0x0;this[_0x6240('0x0')]=_0x2c42e0['name']||'';this[_0x6240('0x1')]=_0x2c42e0['username']||'';this[_0x6240('0x2')]=_0x2c42e0[_0x6240('0x2')]||'';this['remoteUri']=_0x2c42e0[_0x6240('0x3')]||'';this[_0x6240('0x4')]=_0x2c42e0[_0x6240('0x4')]||'';this[_0x6240('0x5')]=_0x2c42e0[_0x6240('0x5')]||{};}module[_0x6240('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7e18893..dd306c1 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 _0xf290=['state','unknown','stateTime','status','exports','name','accountcode'];(function(_0x2daf43,_0x2ef229){var _0x4b2790=function(_0x1d9292){while(--_0x1d9292){_0x2daf43['push'](_0x2daf43['shift']());}};_0x4b2790(++_0x2ef229);}(_0xf290,0xde));var _0x0f29=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf290[_0xfae23b];return _0x200640;};'use strict';function Telephone(_0x1149f4){this['id']=_0x1149f4['id']||0x0;this[_0x0f29('0x0')]=_0x1149f4['name']||'';this[_0x0f29('0x1')]=_0x1149f4['accountcode']||'';this[_0x0f29('0x2')]=_0x0f29('0x3');this[_0x0f29('0x4')]=0x0;this[_0x0f29('0x5')]=_0x0f29('0x3');this['address']='';}module[_0x0f29('0x6')]=Telephone; \ No newline at end of file +var _0x64a6=['address','exports','name','state','stateTime','status','unknown'];(function(_0x15642b,_0x353a11){var _0x1c0b0e=function(_0x4871d1){while(--_0x4871d1){_0x15642b['push'](_0x15642b['shift']());}};_0x1c0b0e(++_0x353a11);}(_0x64a6,0x183));var _0x664a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x64a6[_0x3e5086];return _0xfeb102;};'use strict';function Telephone(_0x5e88ce){this['id']=_0x5e88ce['id']||0x0;this[_0x664a('0x0')]=_0x5e88ce[_0x664a('0x0')]||'';this['accountcode']=_0x5e88ce['accountcode']||'';this[_0x664a('0x1')]='unknown';this[_0x664a('0x2')]=0x0;this[_0x664a('0x3')]=_0x664a('0x4');this[_0x664a('0x5')]='';}module[_0x664a('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4aec996..ce03661 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(_0x1a470d,_0x3b8afc){var _0x3b634e=function(_0x1e7464){while(--_0x1e7464){_0x1a470d['push'](_0x1a470d['shift']());}};_0x3b634e(++_0x3b8afc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x2bcc5a,_0x46d8dc){var _0x4f707d=function(_0x44fc66){while(--_0x44fc66){_0x2bcc5a['push'](_0x2bcc5a['shift']());}};_0x4f707d(++_0x46d8dc);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xb10b[_0x2d4340];return _0x5a2e9e;};'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 7bc037a..6d65a3c 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(_0x57e79f,_0x29430a){var _0x32bd35=function(_0x4877a8){while(--_0x4877a8){_0x57e79f['push'](_0x57e79f['shift']());}};_0x32bd35(++_0x29430a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0xb10b[_0x5a7dd3];return _0x2f4d07;};'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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x32fbc9,_0x51965c){var _0x5afe68=function(_0x405251){while(--_0x405251){_0x32fbc9['push'](_0x32fbc9['shift']());}};_0x5afe68(++_0x51965c);}(_0x757a,0xde));var _0xa757=function(_0x1d343e,_0xf68611){_0x1d343e=_0x1d343e-0x0;var _0xec7dc7=_0x757a[_0x1d343e];return _0xec7dc7;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 23813db..4cb8f7f 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 _0xc230=['domain','domainport','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split','port'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xc230,0x12b));var _0x0c23=function(_0x5a78c4,_0x26b3f1){_0x5a78c4=_0x5a78c4-0x0;var _0x5b1c1c=_0xc230[_0x5a78c4];return _0x5b1c1c;};'use strict';function Trunk(_0x25b867){this['id']=_0x25b867['id']||0x0;this[_0x0c23('0x0')]=_0x25b867[_0x0c23('0x0')]||![];this['name']=_0x25b867[_0x0c23('0x1')]||'';this[_0x0c23('0x2')]=_0x0c23('0x3');this[_0x0c23('0x4')]=0x0;this['status']='unknown';this[_0x0c23('0x5')]=_0x25b867[_0x0c23('0x5')]&&_0x25b867[_0x0c23('0x5')][_0x0c23('0x6')](':')?_0x25b867[_0x0c23('0x5')][_0x0c23('0x7')](':')[0x0]:'';this['host']='';this[_0x0c23('0x8')]='';this[_0x0c23('0x9')]='';this[_0x0c23('0xa')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0x0c23('0xb')]='';this[_0x0c23('0xc')]='';this[_0x0c23('0xd')]=_0x25b867['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x453c=['name','stateTime','status','unknown','registry','indexOf','host','domain','registrationtime','address','defaultuser','exports','active'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x453c,0x103));var _0xc453=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x453c[_0x1db831];return _0x39ba56;};'use strict';function Trunk(_0x46d4b8){this['id']=_0x46d4b8['id']||0x0;this['active']=_0x46d4b8[_0xc453('0x0')]||![];this[_0xc453('0x1')]=_0x46d4b8[_0xc453('0x1')]||'';this['state']='unknown';this[_0xc453('0x2')]=0x0;this[_0xc453('0x3')]=_0xc453('0x4');this['registry']=_0x46d4b8[_0xc453('0x5')]&&_0x46d4b8[_0xc453('0x5')][_0xc453('0x6')](':')?_0x46d4b8[_0xc453('0x5')]['split'](':')[0x0]:'';this[_0xc453('0x7')]='';this['port']='';this[_0xc453('0x8')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0xc453('0x4');this[_0xc453('0x9')]='';this[_0xc453('0xa')]='';this[_0xc453('0xb')]=_0x46d4b8[_0xc453('0xb')]||'';}module[_0xc453('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ffe92e8..6e1d3ba 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 _0xe89b=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x140830,_0x4e99a4){var _0x5753bf=function(_0x5da608){while(--_0x5da608){_0x140830['push'](_0x140830['shift']());}};_0x5753bf(++_0x4e99a4);}(_0xe89b,0x14a));var _0xbe89=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe89b[_0x618414];return _0x21c19a;};'use strict';function voiceExtension(_0x216f1e){this['id']=_0x216f1e['id']||0x0;this[_0xbe89('0x0')]=_0x216f1e[_0xbe89('0x0')]||'';this[_0xbe89('0x1')]=_0x216f1e['recordingFormat']||_0xbe89('0x2');this[_0xbe89('0x3')]=_0x216f1e[_0xbe89('0x3')]||![];}module[_0xbe89('0x4')]=voiceExtension; \ No newline at end of file +var _0x9fb7=['none','mandatoryDisposition','exports','exten'];(function(_0xab226d,_0x3ddb7a){var _0x5dee59=function(_0x4e1cf4){while(--_0x4e1cf4){_0xab226d['push'](_0xab226d['shift']());}};_0x5dee59(++_0x3ddb7a);}(_0x9fb7,0x1b3));var _0x79fb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9fb7[_0x13e741];return _0x3f8bb3;};'use strict';function voiceExtension(_0x36045b){this['id']=_0x36045b['id']||0x0;this[_0x79fb('0x0')]=_0x36045b[_0x79fb('0x0')]||'';this['recordingFormat']=_0x36045b['recordingFormat']||_0x79fb('0x1');this[_0x79fb('0x2')]=_0x36045b[_0x79fb('0x2')]||![];}module[_0x79fb('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1e3dabf..ade6714 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 _0xfc74=['dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x3eede2,_0x6327ac){var _0xb9be5e=function(_0x1897e8){while(--_0x1897e8){_0x3eede2['push'](_0x3eede2['shift']());}};_0xb9be5e(++_0x6327ac);}(_0xfc74,0x12d));var _0x4fc7=function(_0x374aa9,_0x2576bd){_0x374aa9=_0x374aa9-0x0;var _0x50f09d=_0xfc74[_0x374aa9];return _0x50f09d;};'use strict';var statusDesc=['unknown',_0x4fc7('0x0'),'inuse','busy',_0x4fc7('0x1'),'unavailable',_0x4fc7('0x2'),_0x4fc7('0x3'),_0x4fc7('0x4')];var monitorFormat={'wav':_0x4fc7('0x5'),'wav49':_0x4fc7('0x6'),'gsm':_0x4fc7('0x7')};var strategy={'rrmemory':_0x4fc7('0x8'),'roundrobin':_0x4fc7('0x9')};function VoiceQueue(_0x58ea83){this['id']=_0x58ea83['id']||0x0;this[_0x4fc7('0xa')]=_0x58ea83[_0x4fc7('0xa')]||'';this[_0x4fc7('0xb')]=_0x58ea83[_0x4fc7('0xb')]||'';this[_0x4fc7('0xc')]=_0x58ea83[_0x4fc7('0xc')]||'inbound';this[_0x4fc7('0xd')]=0x0;this[_0x4fc7('0xe')]=0x0;this[_0x4fc7('0xf')]=0x0;this[_0x4fc7('0x10')]=0x0;this[_0x4fc7('0x11')]=0x0;this[_0x4fc7('0x12')]=0x0;this[_0x4fc7('0x13')]=0x0;this['unmanaged']=0x0;this[_0x4fc7('0x14')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x4fc7('0x15')]=_0x58ea83[_0x4fc7('0x15')]||![];this['acwTimeout']=_0x58ea83['acwTimeout']||0xa;this[_0x4fc7('0x16')]=_0x58ea83[_0x4fc7('0x16')]||'no';this[_0x4fc7('0x17')]=!![];this[_0x4fc7('0x18')]='';this[_0x4fc7('0x19')]=0x0;this[_0x4fc7('0x1a')]=0x0;this['dialTimezone']=_0x58ea83['dialTimezone']||null;this['dialGlobalInterval']=_0x58ea83[_0x4fc7('0x1b')]?_0x58ea83[_0x4fc7('0x1b')]:null;this[_0x4fc7('0x1c')]=_0x58ea83[_0x4fc7('0x1c')];this[_0x4fc7('0x1d')]=_0x58ea83[_0x4fc7('0x1d')]||_0x4fc7('0x1e');this['dialLimitChannel']=_0x58ea83[_0x4fc7('0x1f')]||0x0;this[_0x4fc7('0x20')]=_0x58ea83['dialLimitQueue']||0x0;this[_0x4fc7('0x21')]=_0x58ea83[_0x4fc7('0x21')]||0x1;this[_0x4fc7('0x22')]=_0x58ea83[_0x4fc7('0x22')]||_0x4fc7('0x23');this['dialPredictiveOptimizationPercentage']=_0x58ea83[_0x4fc7('0x24')]||0.03;this[_0x4fc7('0x25')]=_0x58ea83[_0x4fc7('0x25')]||0x258;this[_0x4fc7('0x26')]=_0x58ea83[_0x4fc7('0x26')]||_0x4fc7('0x27');this[_0x4fc7('0x28')]=_0x58ea83[_0x4fc7('0x28')]||_0x4fc7('0x27');this[_0x4fc7('0x29')]=_0x58ea83['dialOriginateTimeout']||0x1e;this[_0x4fc7('0x2a')]=_0x58ea83[_0x4fc7('0x2a')]||_0x4fc7('0x2b');this[_0x4fc7('0x2c')]=_0x58ea83[_0x4fc7('0x2c')]||0x3;this[_0x4fc7('0x2d')]=_0x58ea83[_0x4fc7('0x2d')]||undefined;this[_0x4fc7('0x2e')]=_0x58ea83[_0x4fc7('0x2e')]||0x3;this[_0x4fc7('0x2f')]=_0x58ea83[_0x4fc7('0x2f')]||0x96;this[_0x4fc7('0x30')]=_0x58ea83[_0x4fc7('0x30')]||0x3;this[_0x4fc7('0x31')]=_0x58ea83[_0x4fc7('0x31')]||0x96;this[_0x4fc7('0x32')]=_0x58ea83[_0x4fc7('0x32')]||0x3;this[_0x4fc7('0x33')]=_0x58ea83['dialNoAnswerRetryFrequency']||0x96;this[_0x4fc7('0x34')]=_0x58ea83['dialNoSuchNumberMaxRetry']||0x3;this[_0x4fc7('0x35')]=_0x58ea83[_0x4fc7('0x35')]||0x96;this['dialDropMaxRetry']=_0x58ea83[_0x4fc7('0x36')]||0x3;this['dialDropRetryFrequency']=_0x58ea83[_0x4fc7('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x58ea83['dialAbandonedMaxRetry']||0x3;this[_0x4fc7('0x38')]=_0x58ea83[_0x4fc7('0x38')]||0x96;this[_0x4fc7('0x39')]=_0x58ea83[_0x4fc7('0x39')]||0x3;this[_0x4fc7('0x3a')]=_0x58ea83['dialMachineRetryFrequency']||0x96;this[_0x4fc7('0x3b')]=_0x58ea83['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x58ea83['dialAgentRejectRetryFrequency']||0x96;this[_0x4fc7('0x3c')]=_0x58ea83[_0x4fc7('0x3c')]||0x4;this[_0x4fc7('0x3d')]=_0x58ea83['Trunk']?_0x58ea83[_0x4fc7('0x3d')]:undefined;this[_0x4fc7('0x3e')]=_0x58ea83['TrunkBackup']?_0x58ea83[_0x4fc7('0x3e')]:undefined;this[_0x4fc7('0x3f')]=_0x58ea83[_0x4fc7('0x3f')]||undefined;this[_0x4fc7('0x40')]=_0x58ea83[_0x4fc7('0x40')]?_0x58ea83[_0x4fc7('0x40')]:undefined;this[_0x4fc7('0x41')]=_0x58ea83[_0x4fc7('0x41')]||_0x4fc7('0x42');this[_0x4fc7('0x43')]=_0x58ea83[_0x4fc7('0x43')]||undefined;this[_0x4fc7('0x44')]=_0x58ea83[_0x4fc7('0x44')]||undefined;this[_0x4fc7('0x45')]=strategy[_0x58ea83[_0x4fc7('0x45')]]||_0x4fc7('0x8');this[_0x4fc7('0x46')]=!![];this[_0x4fc7('0x47')]=_0x58ea83[_0x4fc7('0x47')]||![];this[_0x4fc7('0x48')]=_0x58ea83[_0x4fc7('0x48')];this['dialAMDGreeting']=_0x58ea83[_0x4fc7('0x49')];this[_0x4fc7('0x4a')]=_0x58ea83[_0x4fc7('0x4a')];this[_0x4fc7('0x4b')]=_0x58ea83['dialAMDTotalAnalysisTime'];this[_0x4fc7('0x4c')]=_0x58ea83['dialAMDMinWordLength'];this[_0x4fc7('0x4d')]=_0x58ea83[_0x4fc7('0x4d')];this[_0x4fc7('0x4e')]=_0x58ea83[_0x4fc7('0x4e')];this[_0x4fc7('0x4f')]=_0x58ea83['dialAMDSilenceThreshold'];this[_0x4fc7('0x50')]=_0x58ea83[_0x4fc7('0x50')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x4fc7('0x51')]=_0x58ea83[_0x4fc7('0x51')];this[_0x4fc7('0x52')]=0x0;this[_0x4fc7('0x53')]=0x0;this[_0x4fc7('0x54')]=0x0;this[_0x4fc7('0x55')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x4fc7('0x56')]=0x0;this[_0x4fc7('0x57')]=0x0;this[_0x4fc7('0x58')]=0x0;this[_0x4fc7('0x59')]=0x0;this[_0x4fc7('0x5a')]=0x0;this[_0x4fc7('0x5b')]=0x0;this[_0x4fc7('0x5c')]=0x0;this['outboundReCallsDay']=0x0;this[_0x4fc7('0x5d')]=0x0;this[_0x4fc7('0x5e')]=undefined;this[_0x4fc7('0x5f')]=undefined;this[_0x4fc7('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x4fc7('0x61')]=0x0;this[_0x4fc7('0x62')]=0x0;this[_0x4fc7('0x63')]=0x0;this[_0x4fc7('0x64')]=0x0;this[_0x4fc7('0x65')]=0x0;this[_0x4fc7('0x66')]=0x0;this[_0x4fc7('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x4fc7('0x68')]=_0x58ea83[_0x4fc7('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0x58ea83[_0x4fc7('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x4fc7('0x6a')]=0x0;this[_0x4fc7('0x6b')]=0x1;this[_0x4fc7('0x6c')]=0x0;this[_0x4fc7('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x4fc7('0x6e')]=0x0;this[_0x4fc7('0x6f')]=_0x58ea83[_0x4fc7('0x6f')]||0x1e;this[_0x4fc7('0x70')]=_0x58ea83[_0x4fc7('0x70')]||![];this['dialPreviewAutoRecallMe']=!!_0x58ea83[_0x4fc7('0x71')]||![];this[_0x4fc7('0x72')]=!!_0x58ea83['dialPreviewRecallmeReminder']||![];this[_0x4fc7('0x73')]=_0x58ea83[_0x4fc7('0x73')]||undefined;this[_0x4fc7('0x74')]=_0x58ea83[_0x4fc7('0x74')]||![];this[_0x4fc7('0x75')]=_0x58ea83[_0x4fc7('0x75')]||![];this['monitor_format']=monitorFormat[_0x58ea83[_0x4fc7('0xb')]]?monitorFormat[_0x58ea83[_0x4fc7('0xb')]]:undefined;this['mandatoryDisposition']=_0x58ea83[_0x4fc7('0x76')]||![];this[_0x4fc7('0x77')]=_0x58ea83[_0x4fc7('0x77')]?_0x58ea83[_0x4fc7('0x77')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xc19e=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','busy','unavailable','ringing','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence'];(function(_0x44e550,_0x31850c){var _0x235b91=function(_0x3dc4d6){while(--_0x3dc4d6){_0x44e550['push'](_0x44e550['shift']());}};_0x235b91(++_0x31850c);}(_0xc19e,0x116));var _0xec19=function(_0x4d08f3,_0x46ef06){_0x4d08f3=_0x4d08f3-0x0;var _0x48d035=_0xc19e[_0x4d08f3];return _0x48d035;};'use strict';var statusDesc=[_0xec19('0x0'),_0xec19('0x1'),'inuse',_0xec19('0x2'),'invalid',_0xec19('0x3'),_0xec19('0x4'),'ringinuse',_0xec19('0x5')];var monitorFormat={'wav':_0xec19('0x6'),'wav49':_0xec19('0x7'),'gsm':_0xec19('0x8')};var strategy={'rrmemory':_0xec19('0x9'),'roundrobin':_0xec19('0xa')};function VoiceQueue(_0x2e3d75){this['id']=_0x2e3d75['id']||0x0;this[_0xec19('0xb')]=_0x2e3d75[_0xec19('0xb')]||'';this[_0xec19('0xc')]=_0x2e3d75[_0xec19('0xc')]||'';this[_0xec19('0xd')]=_0x2e3d75[_0xec19('0xd')]||_0xec19('0xe');this[_0xec19('0xf')]=0x0;this[_0xec19('0x10')]=0x0;this[_0xec19('0x11')]=0x0;this[_0xec19('0x12')]=0x0;this[_0xec19('0x13')]=0x0;this[_0xec19('0x14')]=0x0;this[_0xec19('0x15')]=0x0;this['unmanaged']=0x0;this[_0xec19('0x16')]=0x0;this[_0xec19('0x17')]=0x0;this[_0xec19('0x18')]=0x0;this[_0xec19('0x19')]=_0x2e3d75[_0xec19('0x19')]||![];this[_0xec19('0x1a')]=_0x2e3d75[_0xec19('0x1a')]||0xa;this['autopause']=_0x2e3d75[_0xec19('0x1b')]||'no';this[_0xec19('0x1c')]=!![];this['message']='';this[_0xec19('0x1d')]=0x0;this[_0xec19('0x1e')]=0x0;this[_0xec19('0x1f')]=_0x2e3d75['dialTimezone']||null;this[_0xec19('0x20')]=_0x2e3d75['dialGlobalInterval']?_0x2e3d75[_0xec19('0x20')]:null;this[_0xec19('0x21')]=_0x2e3d75['dialActive'];this['dialMethod']=_0x2e3d75[_0xec19('0x22')]||'progressive';this[_0xec19('0x23')]=_0x2e3d75[_0xec19('0x23')]||0x0;this[_0xec19('0x24')]=_0x2e3d75[_0xec19('0x24')]||0x0;this[_0xec19('0x25')]=_0x2e3d75[_0xec19('0x25')]||0x1;this[_0xec19('0x26')]=_0x2e3d75['dialPredictiveOptimization']||_0xec19('0x27');this['dialPredictiveOptimizationPercentage']=_0x2e3d75[_0xec19('0x28')]||0.03;this[_0xec19('0x29')]=_0x2e3d75[_0xec19('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x2e3d75[_0xec19('0x2a')]||_0xec19('0x2b');this['dialOriginateCallerIdNumber']=_0x2e3d75[_0xec19('0x2c')]||_0xec19('0x2b');this[_0xec19('0x2d')]=_0x2e3d75[_0xec19('0x2d')]||0x1e;this[_0xec19('0x2e')]=_0x2e3d75[_0xec19('0x2e')]||_0xec19('0x2f');this['dialQueueTimeout']=_0x2e3d75['dialQueueTimeout']||0x3;this[_0xec19('0x30')]=_0x2e3d75[_0xec19('0x30')]||undefined;this[_0xec19('0x31')]=_0x2e3d75[_0xec19('0x31')]||0x3;this[_0xec19('0x32')]=_0x2e3d75[_0xec19('0x32')]||0x96;this['dialBusyMaxRetry']=_0x2e3d75['dialBusyMaxRetry']||0x3;this[_0xec19('0x33')]=_0x2e3d75[_0xec19('0x33')]||0x96;this[_0xec19('0x34')]=_0x2e3d75[_0xec19('0x34')]||0x3;this[_0xec19('0x35')]=_0x2e3d75[_0xec19('0x35')]||0x96;this[_0xec19('0x36')]=_0x2e3d75[_0xec19('0x36')]||0x3;this[_0xec19('0x37')]=_0x2e3d75[_0xec19('0x37')]||0x96;this[_0xec19('0x38')]=_0x2e3d75['dialDropMaxRetry']||0x3;this[_0xec19('0x39')]=_0x2e3d75[_0xec19('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x2e3d75['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x2e3d75[_0xec19('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x2e3d75['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2e3d75[_0xec19('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x2e3d75[_0xec19('0x3c')]||0x3;this[_0xec19('0x3d')]=_0x2e3d75[_0xec19('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x2e3d75['dialGlobalMaxRetry']||0x4;this[_0xec19('0x3e')]=_0x2e3d75[_0xec19('0x3e')]?_0x2e3d75['Trunk']:undefined;this[_0xec19('0x3f')]=_0x2e3d75['TrunkBackup']?_0x2e3d75[_0xec19('0x3f')]:undefined;this['dialPrefix']=_0x2e3d75[_0xec19('0x40')]||undefined;this[_0xec19('0x41')]=_0x2e3d75[_0xec19('0x41')]?_0x2e3d75[_0xec19('0x41')]:undefined;this[_0xec19('0x42')]=_0x2e3d75[_0xec19('0x42')]||_0xec19('0x43');this[_0xec19('0x44')]=_0x2e3d75[_0xec19('0x44')]||undefined;this[_0xec19('0x45')]=_0x2e3d75['dialCutDigit']||undefined;this[_0xec19('0x46')]=strategy[_0x2e3d75[_0xec19('0x46')]]||_0xec19('0x9');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x2e3d75[_0xec19('0x47')]||![];this[_0xec19('0x48')]=_0x2e3d75[_0xec19('0x48')];this[_0xec19('0x49')]=_0x2e3d75['dialAMDGreeting'];this[_0xec19('0x4a')]=_0x2e3d75[_0xec19('0x4a')];this[_0xec19('0x4b')]=_0x2e3d75[_0xec19('0x4b')];this[_0xec19('0x4c')]=_0x2e3d75[_0xec19('0x4c')];this[_0xec19('0x4d')]=_0x2e3d75[_0xec19('0x4d')];this[_0xec19('0x4e')]=_0x2e3d75[_0xec19('0x4e')];this[_0xec19('0x4f')]=_0x2e3d75[_0xec19('0x4f')];this[_0xec19('0x50')]=_0x2e3d75[_0xec19('0x50')];this['outboundRejectCallsDay']=0x0;this[_0xec19('0x51')]=0x0;this['timeout']=_0x2e3d75['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xec19('0x52')]=0x0;this[_0xec19('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xec19('0x54')]=0x0;this[_0xec19('0x55')]=0x0;this[_0xec19('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xec19('0x57')]=0x0;this[_0xec19('0x58')]=0x0;this[_0xec19('0x59')]=0x0;this[_0xec19('0x5a')]=0x0;this[_0xec19('0x5b')]=0x0;this[_0xec19('0x5c')]=undefined;this[_0xec19('0x5d')]=undefined;this[_0xec19('0x5e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xec19('0x5f')]=0x0;this[_0xec19('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xec19('0x61')]=0x0;this[_0xec19('0x62')]=0x0;this[_0xec19('0x63')]=0x0;this[_0xec19('0x64')]=0x0;this[_0xec19('0x65')]=_0x2e3d75[_0xec19('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x2e3d75[_0xec19('0x66')]||0xa;this[_0xec19('0x67')]=0x0;this[_0xec19('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xec19('0x69')]=0x0;this[_0xec19('0x6a')]=0x0;this[_0xec19('0x6b')]=0x0;this['erlangBusyFactor']=0x0;this[_0xec19('0x6c')]=_0x2e3d75[_0xec19('0x6c')]||0x1e;this[_0xec19('0x6d')]=_0x2e3d75[_0xec19('0x6d')]||![];this[_0xec19('0x6e')]=!!_0x2e3d75[_0xec19('0x6e')]||![];this['dialPreviewRecallmeReminder']=!!_0x2e3d75[_0xec19('0x6f')]||![];this[_0xec19('0x70')]=_0x2e3d75[_0xec19('0x70')]||undefined;this[_0xec19('0x71')]=_0x2e3d75['dialAgiAfterHangupClient']||![];this[_0xec19('0x72')]=_0x2e3d75[_0xec19('0x72')]||![];this[_0xec19('0xc')]=monitorFormat[_0x2e3d75[_0xec19('0xc')]]?monitorFormat[_0x2e3d75[_0xec19('0xc')]]:undefined;this['mandatoryDisposition']=_0x2e3d75['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2e3d75[_0xec19('0x73')]?_0x2e3d75[_0xec19('0x73')]:undefined;}module[_0xec19('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e0385e6..9780c9b 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 _0xcc4c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcc4c,0xfd));var _0xccc4=function(_0x54e7aa,_0x4ff9e4){_0x54e7aa=_0x54e7aa-0x0;var _0x39df9c=_0xcc4c[_0x54e7aa];return _0x39df9c;};'use strict';function VtigerAccount(_0x4a1c20){this['id']=_0x4a1c20['id']||0x0;this['name']=_0x4a1c20[_0xccc4('0x0')]||'';this[_0xccc4('0x1')]=_0x4a1c20[_0xccc4('0x1')]||'';this[_0xccc4('0x2')]=_0x4a1c20[_0xccc4('0x2')]||'';this[_0xccc4('0x3')]=_0x4a1c20[_0xccc4('0x3')]||'';this[_0xccc4('0x4')]=_0x4a1c20['serverUrl']||'';this[_0xccc4('0x5')]=_0x4a1c20['Configurations']||{};}module[_0xccc4('0x6')]=VtigerAccount; \ No newline at end of file +var _0xc977=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x13c673,_0x73db44){var _0x27dd05=function(_0x3b1506){while(--_0x3b1506){_0x13c673['push'](_0x13c673['shift']());}};_0x27dd05(++_0x73db44);}(_0xc977,0x126));var _0x7c97=function(_0x419560,_0x16a92c){_0x419560=_0x419560-0x0;var _0x52a0a9=_0xc977[_0x419560];return _0x52a0a9;};'use strict';function VtigerAccount(_0x5a758e){this['id']=_0x5a758e['id']||0x0;this[_0x7c97('0x0')]=_0x5a758e[_0x7c97('0x0')]||'';this[_0x7c97('0x1')]=_0x5a758e[_0x7c97('0x1')]||'';this['accessKey']=_0x5a758e[_0x7c97('0x2')]||'';this[_0x7c97('0x3')]=_0x5a758e[_0x7c97('0x3')]||'';this[_0x7c97('0x4')]=_0x5a758e[_0x7c97('0x4')]||'';this[_0x7c97('0x5')]=_0x5a758e[_0x7c97('0x5')]||{};}module[_0x7c97('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index abfd037..99805ca 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 _0xd09e=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x5cc79c,_0x421dd1){var _0x4d1425=function(_0x474959){while(--_0x474959){_0x5cc79c['push'](_0x5cc79c['shift']());}};_0x4d1425(++_0x421dd1);}(_0xd09e,0x11b));var _0xed09=function(_0x2cb278,_0xefd5aa){_0x2cb278=_0x2cb278-0x0;var _0xadf602=_0xd09e[_0x2cb278];return _0xadf602;};'use strict';function ZendeskAccount(_0xb66490){this['id']=_0xb66490['id']||0x0;this['name']=_0xb66490[_0xed09('0x0')]||'';this[_0xed09('0x1')]=_0xb66490[_0xed09('0x1')]||'';this['password']=_0xb66490[_0xed09('0x2')]||'';this[_0xed09('0x3')]=_0xb66490[_0xed09('0x3')]||'';this[_0xed09('0x4')]=_0xb66490[_0xed09('0x4')]||'';this[_0xed09('0x5')]=_0xb66490[_0xed09('0x5')]||'';this[_0xed09('0x6')]=_0xb66490['type']||'integrationTab';this[_0xed09('0x7')]=_0xb66490[_0xed09('0x7')]||'';this[_0xed09('0x8')]=_0xb66490['Configurations']||{};}module[_0xed09('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5338=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0xc98c6,_0x1da7dc){var _0x5a1735=function(_0x3b905a){while(--_0x3b905a){_0xc98c6['push'](_0xc98c6['shift']());}};_0x5a1735(++_0x1da7dc);}(_0x5338,0xbe));var _0x8533=function(_0x525366,_0x51223a){_0x525366=_0x525366-0x0;var _0x192c86=_0x5338[_0x525366];return _0x192c86;};'use strict';function ZendeskAccount(_0x2b8b9f){this['id']=_0x2b8b9f['id']||0x0;this[_0x8533('0x0')]=_0x2b8b9f[_0x8533('0x0')]||'';this[_0x8533('0x1')]=_0x2b8b9f['username']||'';this['password']=_0x2b8b9f[_0x8533('0x2')]||'';this['token']=_0x2b8b9f[_0x8533('0x3')]||'';this['remoteUri']=_0x2b8b9f[_0x8533('0x4')]||'';this[_0x8533('0x5')]=_0x2b8b9f[_0x8533('0x5')]||'';this[_0x8533('0x6')]=_0x2b8b9f['type']||'integrationTab';this['serverUrl']=_0x2b8b9f[_0x8533('0x7')]||'';this[_0x8533('0x8')]=_0x2b8b9f[_0x8533('0x8')]||{};}module[_0x8533('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 193ac92..6529e91 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 _0x69ca=['clientId','clientSecret','code','refreshToken','Configurations','exports','description','host','zone'];(function(_0x4e65cd,_0x13674b){var _0x524a1c=function(_0x43c6d4){while(--_0x43c6d4){_0x4e65cd['push'](_0x4e65cd['shift']());}};_0x524a1c(++_0x13674b);}(_0x69ca,0x1e3));var _0xa69c=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x69ca[_0x3ef2d5];return _0x2fefb2;};'use strict';function ZohoAccount(_0xfae2ed){this['id']=_0xfae2ed['id']||0x0;this['name']=_0xfae2ed['name']||'';this[_0xa69c('0x0')]=_0xfae2ed[_0xa69c('0x0')]||'';this[_0xa69c('0x1')]=_0xfae2ed['host']||'';this[_0xa69c('0x2')]=_0xfae2ed['zone']||'';this[_0xa69c('0x3')]=_0xfae2ed[_0xa69c('0x3')]||'';this[_0xa69c('0x4')]=_0xfae2ed[_0xa69c('0x4')]||'';this['serverUrl']=_0xfae2ed['serverUrl']||'';this[_0xa69c('0x5')]=_0xfae2ed[_0xa69c('0x5')]||'';this[_0xa69c('0x6')]=_0xfae2ed[_0xa69c('0x6')]||'';this['Configurations']=_0xfae2ed[_0xa69c('0x7')]||{};}module[_0xa69c('0x8')]=ZohoAccount; \ No newline at end of file +var _0x761e=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x3846cc,_0x356ef3){var _0x4bf043=function(_0x193f25){while(--_0x193f25){_0x3846cc['push'](_0x3846cc['shift']());}};_0x4bf043(++_0x356ef3);}(_0x761e,0xca));var _0xe761=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0x761e[_0x16bb0e];return _0x102b8b;};'use strict';function ZohoAccount(_0x12ffbd){this['id']=_0x12ffbd['id']||0x0;this[_0xe761('0x0')]=_0x12ffbd[_0xe761('0x0')]||'';this[_0xe761('0x1')]=_0x12ffbd[_0xe761('0x1')]||'';this[_0xe761('0x2')]=_0x12ffbd[_0xe761('0x2')]||'';this[_0xe761('0x3')]=_0x12ffbd['zone']||'';this[_0xe761('0x4')]=_0x12ffbd[_0xe761('0x4')]||'';this[_0xe761('0x5')]=_0x12ffbd[_0xe761('0x5')]||'';this['serverUrl']=_0x12ffbd[_0xe761('0x6')]||'';this[_0xe761('0x7')]=_0x12ffbd[_0xe761('0x7')]||'';this[_0xe761('0x8')]=_0x12ffbd['refreshToken']||'';this[_0xe761('0x9')]=_0x12ffbd[_0xe761('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ab25221..77a55b7 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 _0xe987=['lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','firstName'];(function(_0x535ad8,_0x16f8b2){var _0x241383=function(_0x10aa40){while(--_0x10aa40){_0x535ad8['push'](_0x535ad8['shift']());}};_0x241383(++_0x16f8b2);}(_0xe987,0xc4));var _0x7e98=function(_0x6b9266,_0x2afdb1){_0x6b9266=_0x6b9266-0x0;var _0x1ad2c1=_0xe987[_0x6b9266];return _0x1ad2c1;};'use strict';var util=require(_0x7e98('0x0'));var _=require(_0x7e98('0x1'));var moment=require(_0x7e98('0x2'));function checkNameSurname(_0x4d4048,_0x236a9d,_0x83877c){var _0xd1634e='';if(!_[_0x7e98('0x3')](_0x236a9d)&&_0x7e98('0x4')===typeof _0x236a9d){_0xd1634e+=_0x236a9d;}if(!_[_0x7e98('0x3')](_0x83877c)&&_0x7e98('0x4')===typeof _0x83877c){_0xd1634e+='\x20'+_0x83877c;}if(_0xd1634e!==''){return _0xd1634e;}return _0x4d4048;}function Action(_0xf00092,_0x352ed6,_0x59172f,_0x47dd76,_0x1a45b4){this['uniqueid']=_0x59172f||undefined;this[_0x7e98('0x5')]=_0xf00092['id'];this[_0x7e98('0x6')]=_0x352ed6['name'];this[_0x7e98('0x7')]=_0x352ed6[_0x7e98('0x7')];this[_0x7e98('0x8')]=_0x7e98('0x6');this[_0x7e98('0x9')]=![];this['membername']=_[_0x7e98('0x3')](_0xf00092[_0x7e98('0xa')])?undefined:_0xf00092['Agent'][_0x7e98('0xb')];this[_0x7e98('0xc')]=this[_0x7e98('0xd')]?util[_0x7e98('0xe')](_0x7e98('0xf'),this[_0x7e98('0xd')]):_0x47dd76||undefined;this[_0x7e98('0x10')]=checkNameSurname(_0xf00092[_0x7e98('0x11')]['phone'],_0xf00092[_0x7e98('0x11')][_0x7e98('0x12')],_0xf00092['Contact'][_0x7e98('0x13')]);this[_0x7e98('0x14')]=_0xf00092['active']||![];this['calleridnum']=_0xf00092[_0x7e98('0x11')][_0x7e98('0x15')];this[_0x7e98('0x16')]=_0xf00092[_0x7e98('0x16')];this[_0x7e98('0x17')]=_0xf00092[_0x7e98('0x17')]||0x0;this[_0x7e98('0x18')]=_0xf00092[_0x7e98('0x18')]||0x0;this[_0x7e98('0x19')]=_0xf00092[_0x7e98('0x19')]||0x0;this[_0x7e98('0x1a')]=(_0xf00092[_0x7e98('0x17')]||0x0)+(_0xf00092[_0x7e98('0x18')]||0x0)+(_0xf00092[_0x7e98('0x19')]||0x0)+(_0xf00092[_0x7e98('0x1b')]||0x0)+(_0xf00092[_0x7e98('0x1c')]||0x0)+(_0xf00092['countabandonedretry']||0x0)+(_0xf00092['countmachineretry']||0x0)+(_0xf00092[_0x7e98('0x1d')]||0x0);this[_0x7e98('0x1b')]=_0xf00092[_0x7e98('0x1b')]||0x0;this[_0x7e98('0x1c')]=_0xf00092[_0x7e98('0x1c')]||0x0;this[_0x7e98('0x1e')]=_0xf00092['countabandonedretry']||0x0;this[_0x7e98('0x1f')]=_0xf00092[_0x7e98('0x1f')]||0x0;this['countagentrejectretry']=_0xf00092[_0x7e98('0x1d')]||0x0;this['callback']=_0xf00092[_0x7e98('0x20')];this[_0x7e98('0x21')]=_0xf00092['callbackuniqueid'];this[_0x7e98('0x22')]=_0xf00092[_0x7e98('0x22')];this[_0x7e98('0x23')]=_0xf00092['recallme'];this['ContactId']=_0xf00092['ContactId'];this[_0x7e98('0x24')]=_0xf00092[_0x7e98('0x24')];this[_0x7e98('0x25')]=_[_0x7e98('0x3')](_0xf00092[_0x7e98('0xa')])?_0xf00092[_0x7e98('0x25')]:_0xf00092[_0x7e98('0xa')]['id'];this[_0x7e98('0x26')]=_0xf00092[_0x7e98('0x26')];this['originatecalleridnum']='';this[_0x7e98('0x27')]='';}Action['prototype'][_0x7e98('0x28')]=function(){return util[_0x7e98('0xe')](_0x7e98('0x29'),this[_0x7e98('0x10')],this['number']);};module[_0x7e98('0x2a')]=Action; \ No newline at end of file +var _0x0b1e=['recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b1e,0x118));var _0xe0b1=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0x0b1e[_0x1be790];return _0x7668c8;};'use strict';var util=require(_0xe0b1('0x0'));var _=require('lodash');var moment=require(_0xe0b1('0x1'));function checkNameSurname(_0x1a2bcc,_0x3c0615,_0x439a29){var _0x44f57e='';if(!_[_0xe0b1('0x2')](_0x3c0615)&&_0xe0b1('0x3')===typeof _0x3c0615){_0x44f57e+=_0x3c0615;}if(!_[_0xe0b1('0x2')](_0x439a29)&&'string'===typeof _0x439a29){_0x44f57e+='\x20'+_0x439a29;}if(_0x44f57e!==''){return _0x44f57e;}return _0x1a2bcc;}function Action(_0x3436c5,_0x1ee705,_0xdceb10,_0x407412,_0x52b9a3){this[_0xe0b1('0x4')]=_0xdceb10||undefined;this[_0xe0b1('0x5')]=_0x3436c5['id'];this[_0xe0b1('0x6')]=_0x1ee705[_0xe0b1('0x7')];this['type']=_0x1ee705[_0xe0b1('0x8')];this[_0xe0b1('0x9')]=_0xe0b1('0x6');this[_0xe0b1('0xa')]=![];this[_0xe0b1('0xb')]=_[_0xe0b1('0x2')](_0x3436c5[_0xe0b1('0xc')])?undefined:_0x3436c5['Agent']['name'];this[_0xe0b1('0xd')]=this['membername']?util[_0xe0b1('0xe')](_0xe0b1('0xf'),this[_0xe0b1('0xb')]):_0x407412||undefined;this[_0xe0b1('0x10')]=checkNameSurname(_0x3436c5[_0xe0b1('0x11')]['phone'],_0x3436c5[_0xe0b1('0x11')][_0xe0b1('0x12')],_0x3436c5[_0xe0b1('0x11')][_0xe0b1('0x13')]);this[_0xe0b1('0x14')]=_0x3436c5[_0xe0b1('0x14')]||![];this['calleridnum']=_0x3436c5['Contact'][_0xe0b1('0x15')];this['scheduledat']=_0x3436c5[_0xe0b1('0x16')];this['countbusyretry']=_0x3436c5['countbusyretry']||0x0;this['countcongestionretry']=_0x3436c5[_0xe0b1('0x17')]||0x0;this['countnoanswerretry']=_0x3436c5[_0xe0b1('0x18')]||0x0;this[_0xe0b1('0x19')]=(_0x3436c5[_0xe0b1('0x1a')]||0x0)+(_0x3436c5[_0xe0b1('0x17')]||0x0)+(_0x3436c5[_0xe0b1('0x18')]||0x0)+(_0x3436c5[_0xe0b1('0x1b')]||0x0)+(_0x3436c5[_0xe0b1('0x1c')]||0x0)+(_0x3436c5[_0xe0b1('0x1d')]||0x0)+(_0x3436c5[_0xe0b1('0x1e')]||0x0)+(_0x3436c5[_0xe0b1('0x1f')]||0x0);this[_0xe0b1('0x1b')]=_0x3436c5[_0xe0b1('0x1b')]||0x0;this[_0xe0b1('0x1c')]=_0x3436c5[_0xe0b1('0x1c')]||0x0;this[_0xe0b1('0x1d')]=_0x3436c5[_0xe0b1('0x1d')]||0x0;this[_0xe0b1('0x1e')]=_0x3436c5[_0xe0b1('0x1e')]||0x0;this['countagentrejectretry']=_0x3436c5[_0xe0b1('0x1f')]||0x0;this[_0xe0b1('0x20')]=_0x3436c5[_0xe0b1('0x20')];this['callbackuniqueid']=_0x3436c5[_0xe0b1('0x21')];this[_0xe0b1('0x22')]=_0x3436c5[_0xe0b1('0x22')];this['recallme']=_0x3436c5[_0xe0b1('0x23')];this['ContactId']=_0x3436c5[_0xe0b1('0x24')];this[_0xe0b1('0x25')]=_0x3436c5[_0xe0b1('0x25')];this[_0xe0b1('0x26')]=_[_0xe0b1('0x2')](_0x3436c5[_0xe0b1('0xc')])?_0x3436c5['UserId']:_0x3436c5[_0xe0b1('0xc')]['id'];this[_0xe0b1('0x27')]=_0x3436c5['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xe0b1('0x28')][_0xe0b1('0x29')]=function(){return util[_0xe0b1('0xe')](_0xe0b1('0x2a'),this[_0xe0b1('0x10')],this[_0xe0b1('0x2b')]);};module[_0xe0b1('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 430ea84..0f32f09 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 _0x9f62=['[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','prototype','enqueue','tail','sequence','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20disactive','hasOwnProperty','booked','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','ListId','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','active','trunks','SIP/%s','status','disableContact','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','trim','substring','dialCutDigit','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','starttime','Action','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','unlockContact','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer'];(function(_0x5750f7,_0x12e6ba){var _0x157d42=function(_0x38bbb2){while(--_0x38bbb2){_0x5750f7['push'](_0x5750f7['shift']());}};_0x157d42(++_0x12e6ba);}(_0x9f62,0x154));var _0x29f6=function(_0xa7ead3,_0x4099e0){_0xa7ead3=_0xa7ead3-0x0;var _0x42a740=_0x9f62[_0xa7ead3];return _0x42a740;};'use strict';var util=require('util');var _=require(_0x29f6('0x0'));var BPromise=require('bluebird');var uuid=require(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var md5=require(_0x29f6('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var loggerAction=require(_0x29f6('0x4'))(_0x29f6('0x6'));var ami=require('../ami');var rpcDb=require(_0x29f6('0x7'));var Action=require(_0x29f6('0x8'));var ut=require(_0x29f6('0x9'));config[_0x29f6('0xa')]=_[_0x29f6('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x29f6('0xc')][_0x29f6('0xd')]=function(_0x4fb455){this['tail']=this[_0x29f6('0xe')]?this[_0x29f6('0xe')]['finally'](_0x4fb455):_0x4fb455();};function Preview(_0x17b69c){this[_0x29f6('0xf')]=new Sequence();this['campaignsPreview']=_0x17b69c['voiceQueues'];this['trunks']=_0x17b69c['trunks'];this[_0x29f6('0x10')]={};this[_0x29f6('0x11')]=_0x17b69c[_0x29f6('0x11')];this[_0x29f6('0x12')]=0x0;ami['on'](_0x29f6('0x13'),this[_0x29f6('0x14')][_0x29f6('0x15')](this));ami['on'](_0x29f6('0x16'),this[_0x29f6('0x17')][_0x29f6('0x15')](this));ami['on'](_0x29f6('0x18'),this[_0x29f6('0x19')][_0x29f6('0x15')](this));ami['on'](_0x29f6('0x1a'),this[_0x29f6('0x1b')][_0x29f6('0x15')](this));ami['on'](_0x29f6('0x1c'),this['syncNewExten']['bind'](this));ami['on'](_0x29f6('0x1d'),this[_0x29f6('0x1e')][_0x29f6('0x15')](this));ami['on']('attendedtransfer',this[_0x29f6('0x1f')][_0x29f6('0x15')](this));ami['on']('blindtransfer',this[_0x29f6('0x20')][_0x29f6('0x15')](this));this[_0x29f6('0x21')](this[_0x29f6('0x22')]);}function emit(_0xb6e7a9,_0x2bfb3d,_0x5673c8){io['to'](_0xb6e7a9)[_0x29f6('0x23')](_0x2bfb3d,_0x5673c8);}function emitCampaignPreview(_0x59def4){if(_0x59def4['type']===_0x29f6('0x24')){var _0x1fa159={'id':_0x59def4['id'],'name':_0x59def4[_0x29f6('0x25')],'strategy':_0x59def4[_0x29f6('0x26')],'answered':_0x59def4['answered'],'available':_0x59def4[_0x29f6('0x27')],'loggedIn':_0x59def4['loggedIn'],'pTalking':_0x59def4[_0x29f6('0x28')],'sumBillable':_0x59def4[_0x29f6('0x29')],'sumDuration':_0x59def4[_0x29f6('0x2a')],'sumHoldTime':_0x59def4[_0x29f6('0x2b')]||0x0,'talking':_0x59def4['talking'],'total':_0x59def4[_0x29f6('0x2c')],'type':_0x59def4[_0x29f6('0x2d')],'unmanaged':_0x59def4['unmanaged'],'abandoned':_0x59def4[_0x29f6('0x2e')],'waiting':_0x59def4[_0x29f6('0x2f')],'loggedInDb':_0x59def4[_0x29f6('0x30')],'dialActive':_0x59def4[_0x29f6('0x31')],'dialMethod':_0x59def4[_0x29f6('0x32')],'dialOriginateCallerIdName':_0x59def4[_0x29f6('0x33')],'dialOriginateCallerIdNumber':_0x59def4[_0x29f6('0x34')],'dialOriginateTimeout':_0x59def4['dialOriginateTimeout'],'dialPrefix':_0x59def4[_0x29f6('0x35')],'outboundAnswerAgiCallsDay':_0x59def4[_0x29f6('0x36')],'outboundAnswerCallsDay':_0x59def4[_0x29f6('0x37')],'outboundBlacklistCallsDay':_0x59def4[_0x29f6('0x38')],'outboundBusyCallsDay':_0x59def4[_0x29f6('0x39')],'outboundCongestionCallsDay':_0x59def4[_0x29f6('0x3a')],'outboundDropCallsDayACS':_0x59def4[_0x29f6('0x3b')],'outboundDropCallsDayCallersExit':_0x59def4[_0x29f6('0x3c')],'outboundDropCallsDayTimeout':_0x59def4[_0x29f6('0x3d')],'outboundNoAnswerCallsDay':_0x59def4[_0x29f6('0x3e')],'outboundNoSuchCallsDay':_0x59def4[_0x29f6('0x3f')],'outboundOriginateFailureCallsDay':_0x59def4[_0x29f6('0x40')],'outboundReCallsDay':_0x59def4[_0x29f6('0x41')],'outboundRejectCallsDay':_0x59def4[_0x29f6('0x42')],'outboundUnknownCallsDay':_0x59def4[_0x29f6('0x43')],'outboundAbandonedCallsDay':_0x59def4[_0x29f6('0x44')],'predictiveIntervalAnsweredCalls':_0x59def4[_0x29f6('0x45')],'predictiveIntervalAvgHoldtime':_0x59def4['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x59def4['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x59def4[_0x29f6('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x59def4['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x59def4[_0x29f6('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x59def4[_0x29f6('0x48')],'predictiveIntervalHitRate':_0x59def4[_0x29f6('0x49')],'predictiveIntervalMultiplicativeFactor':_0x59def4[_0x29f6('0x4a')],'predictiveIntervalPauses':_0x59def4['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x59def4['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x59def4[_0x29f6('0x4b')],'message':_0x59def4[_0x29f6('0x4c')],'originated':_0x59def4[_0x29f6('0x4d')],'erlangCalls':_0x59def4[_0x29f6('0x4e')],'erlangCallToSecond':_0x59def4[_0x29f6('0x4f')],'erlangAbandonmentRate':_0x59def4[_0x29f6('0x50')],'erlangBusyFactor':_0x59def4[_0x29f6('0x51')],'startPredictive':_0x59def4[_0x29f6('0x52')],'startProgressive':_0x59def4[_0x29f6('0x53')]};if(_0x59def4[_0x29f6('0x54')]){_0x1fa159[_0x29f6('0x54')]={'id':_0x59def4[_0x29f6('0x54')]['id'],'name':_0x59def4[_0x29f6('0x54')][_0x29f6('0x25')],'active':_0x59def4['Trunk']['active'],'callerid':_0x59def4[_0x29f6('0x54')][_0x29f6('0x55')]};}if(_0x59def4[_0x29f6('0x56')]){_0x1fa159['Interval']={'id':_0x59def4[_0x29f6('0x56')]['id'],'name':_0x59def4[_0x29f6('0x56')][_0x29f6('0x25')]};}var _0x27d945=md5(JSON[_0x29f6('0x57')](_0x1fa159));if(_0x59def4['md5']!==_0x27d945){_0x59def4[_0x29f6('0x3')]=_0x27d945;emit(util[_0x29f6('0x58')](_0x29f6('0x59'),_0x1fa159[_0x29f6('0x25')]),'voice_queue:save',_0x1fa159);}}}function emitVoiceQueueChannelRemove(_0x30d747){logger[_0x29f6('0x5a')](_0x29f6('0x5b'),JSON[_0x29f6('0x57')](_0x30d747));emit(util['format']('voice:queue:%s',_0x30d747[_0x29f6('0x25')]),'voice_queue_channel:remove',_0x30d747);io[_0x29f6('0x23')]('voice_queue_presence:remove',_0x30d747);}function notSendMessagesQueue(_0x3a1a75){if(_0x3a1a75['sendMessageOneNotActive']){if(_0x3a1a75[_0x29f6('0x4d')]===0x0&&_0x3a1a75[_0x29f6('0x28')]===0x0){_0x3a1a75['sendMessageOneNotActive']=![];_0x3a1a75[_0x29f6('0x27')]=0x0;_0x3a1a75['paused']=0x0;_0x3a1a75[_0x29f6('0x4c')]=_0x29f6('0x5c');ut['logger'](_0x29f6('0x5d'),_0x3a1a75[_0x29f6('0x25')]+_0x29f6('0x5e'));}else{_0x3a1a75[_0x29f6('0x4c')]='IS_DISACTIVED';ut[_0x29f6('0x5f')](_0x29f6('0x5d'),_0x3a1a75[_0x29f6('0x25')]+_0x29f6('0x60'));}emitCampaignPreview(_0x3a1a75);}}Preview[_0x29f6('0xc')]['loopCampaigns']=function(){var _0xb5f2b1=this;setInterval(function(){_0xb5f2b1['syncCampaigns']();},0x7cf);};Preview[_0x29f6('0xc')]['syncCampaigns']=function(){var _0xbfe671=this[_0x29f6('0x22')];this['clockClearZombieChannels']+=0x1;for(var _0x28046c in _0xbfe671){if(_0xbfe671[_0x29f6('0x61')](_0x28046c)&&(_0xbfe671[_0x28046c][_0x29f6('0x32')]===_0x29f6('0x5')||_0xbfe671[_0x28046c]['dialMethod']===_0x29f6('0x62'))&&_0xbfe671[_0x28046c][_0x29f6('0x2d')]===_0x29f6('0x24')){if(this['clockClearZombieChannels']>0x7){this[_0x29f6('0x12')]=0x0;this['clearZombieChannels']();}}if(_0xbfe671[_0x29f6('0x61')](_0x28046c)&&_0xbfe671[_0x28046c]['dialMethod']==='preview'&&_0xbfe671[_0x28046c]['type']===_0x29f6('0x24')){if(_0xbfe671[_0x28046c][_0x29f6('0x31')]){this[_0x29f6('0x63')](_0xbfe671[_0x28046c]);if(_0xbfe671[_0x28046c][_0x29f6('0x64')])this[_0x29f6('0x65')](_0xbfe671[_0x28046c]);}else{notSendMessagesQueue(_0xbfe671[_0x28046c]);}}}};Preview[_0x29f6('0xc')][_0x29f6('0x66')]=function(_0x155ffb){var _0x352119=this;this[_0x29f6('0xf')]['enqueue'](function(){if(!_['isNil'](_0x352119[_0x29f6('0x10')][_0x155ffb])){loggerAction[_0x29f6('0x5a')](_0x29f6('0x67'),_0x155ffb,_0x29f6('0x68'),_0x352119['actions'][_0x155ffb][_0x29f6('0x69')],_0x29f6('0x6a'),JSON['stringify'](_0x352119[_0x29f6('0x22')][_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x69')]][_0x29f6('0x4d')]),_0x29f6('0x6b'),JSON[_0x29f6('0x57')](_0x352119[_0x29f6('0x22')][_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x69')]][_0x29f6('0x28')]),JSON[_0x29f6('0x57')](_0x352119[_0x29f6('0x10')][_0x155ffb]['dialAnswer']),JSON[_0x29f6('0x57')](_[_0x29f6('0x6c')](_0x352119[_0x29f6('0x10')][_0x155ffb],[_0x29f6('0x6d'),_0x29f6('0x6e'),'VoiceQueueId',_0x29f6('0x6f')])));return ami['Action']({'action':'status','channel':_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x70')]})[_0x29f6('0x71')](function(_0x1a566f){if(_0x1a566f[_0x29f6('0x4c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x352119[_0x29f6('0x10')][_0x155ffb]){ut[_0x29f6('0x72')](_0x352119['campaignsPreview'][_0x352119[_0x29f6('0x10')][_0x155ffb]['queue']],_0x29f6('0x73'));if(_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x74')]===!![]){ut[_0x29f6('0x75')](_0x352119['campaignsPreview'][_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x69')]],_0x29f6('0x73'));ut[_0x29f6('0x76')](_0x29f6('0x77')+_0x155ffb,_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x69')]);}ut['loggerError'](_0x29f6('0x78')+_0x155ffb,_0x352119[_0x29f6('0x10')][_0x155ffb][_0x29f6('0x69')]);delete _0x352119[_0x29f6('0x10')][_0x155ffb];}},0x2328);}});}});};Preview[_0x29f6('0xc')][_0x29f6('0x79')]=function(){var _0x37c3c1=this;loggerAction[_0x29f6('0x5a')](_0x29f6('0x7a'),_[_0x29f6('0x7b')](this['actions']));for(var _0x5d7c9a in this[_0x29f6('0x10')]){if(_0x37c3c1[_0x29f6('0x10')][_0x29f6('0x61')](_0x5d7c9a)){_0x37c3c1['clearZombieChannel'](_0x5d7c9a);}}};Preview[_0x29f6('0xc')]['recallMe']=function(_0x550190){var _0x22b8ef=this;rpcDb[_0x29f6('0x7c')](_0x550190['id'],ut['agentReadyId'](this['agents']))[_0x29f6('0x7d')](function(_0x46998c){if(!_[_0x29f6('0x7e')](_0x46998c)){for(var _0x58694e=0x0;_0x58694e<_0x46998c[_0x29f6('0x7f')];_0x58694e+=0x1){if(ut[_0x29f6('0x80')](_0x46998c[_0x58694e][_0x29f6('0x81')])<_0x550190[_0x29f6('0x82')]*0x3c){if(_0x46998c[_0x58694e][_0x29f6('0x83')]&&!_0x46998c[_0x58694e][_0x29f6('0x83')][_0x29f6('0x84')]){_0x22b8ef[_0x29f6('0x85')](_0x46998c[_0x58694e]['id'])[_0x29f6('0x7d')](ut[_0x29f6('0x86')](_0x29f6('0x87')))[_0x29f6('0x71')](ut[_0x29f6('0x86')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x46998c[_0x58694e]['id']);}}else{var _0x2bd7d9=new Action(_0x46998c[_0x58694e],_0x550190);_0x2bd7d9['starttime']=moment()[_0x29f6('0x58')](_0x29f6('0x88'));_0x550190[_0x29f6('0x41')]+=0x1;ut[_0x29f6('0x89')](_0x2bd7d9,0x17,_0x29f6('0x8a'));if(_0x550190['dialRecallInQueue']){rpcDb[_0x29f6('0x8b')](ut[_0x29f6('0x8c')](_0x46998c[_0x58694e]));rpcDb[_0x29f6('0x8d')](_0x2bd7d9,_0x29f6('0x8e'));}else{ut[_0x29f6('0x89')](_0x2bd7d9,0x16,'RecallFailedTimeout');rpcDb[_0x29f6('0x8d')](_0x2bd7d9,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x2bd7d9,_0x29f6('0x8f'));}}}}})[_0x29f6('0x71')](ut['logger2'](_0x29f6('0x90')));};Preview[_0x29f6('0xc')]['setMessage']=function(_0x44b3ee){_0x44b3ee[_0x29f6('0x91')]=!![];if(ut[_0x29f6('0x92')](_0x44b3ee[_0x29f6('0x93')])){_0x44b3ee[_0x29f6('0x4c')]=_0x29f6('0x94');}else if(!ut[_0x29f6('0x95')](_0x44b3ee['dialActive'])){_0x44b3ee[_0x29f6('0x4c')]='NOT_ACTIVE';}else if(!this[_0x29f6('0x96')](_0x44b3ee['Trunk'])){if(!this['isTrunkReachable'](_0x44b3ee[_0x29f6('0x97')])){_0x44b3ee[_0x29f6('0x4c')]=_0x29f6('0x98');}else{_0x44b3ee['message']=_0x29f6('0x99');}}else{_0x44b3ee[_0x29f6('0x4c')]=_0x29f6('0x99');}emitCampaignPreview(_0x44b3ee);};Preview['prototype'][_0x29f6('0x9a')]=function(_0x35623a,_0x66a7bb,_0xc50331){var _0x1f9a9d=this;var _0x15cf8e=this[_0x29f6('0x10')][_0x66a7bb];var _0x41c1b9=this['campaignsPreview'][_0x15cf8e[_0x29f6('0x69')]];var _0x6e77a1;if(_0x41c1b9){switch(_0xc50331){case'1':_0x41c1b9[_0x29f6('0x3f')]+=0x1;_0x15cf8e[_0x29f6('0x9b')]+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x0,_0x29f6('0x9e'));ami['emit'](_0x29f6('0x9f'),ut[_0x29f6('0xa0')](_0x15cf8e,'nosuchnumber'));rpcDb[_0x29f6('0x8d')](_0x15cf8e,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x29f6('0x9d')](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut['cloneAction'](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb[_0x29f6('0xa3')](_0x6e77a1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x15cf8e['countnosuchnumberretry']>=_0x41c1b9['dialNoSuchNumberMaxRetry']){rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xa4'));}else{rpcDb[_0x29f6('0xa5')](ut[_0x29f6('0xa6')](_0x15cf8e,_0x29f6('0x9b'),_0x41c1b9[_0x29f6('0xa7')]),_0x15cf8e[_0x29f6('0xa8')],_0x15cf8e['activeContact']);}}delete this[_0x29f6('0x10')][_0x35623a[_0x29f6('0xa9')]];break;case _0x29f6('0xaa'):var _0x1869fe=moment()['format'](_0x29f6('0x88'));_0x15cf8e[_0x29f6('0xab')]=_0x1869fe;_0x15cf8e[_0x29f6('0xac')]=_0x1869fe;_0x15cf8e[_0x29f6('0x74')]=!![];_0x41c1b9[_0x29f6('0x28')]+=0x1;logger['info'](_0x29f6('0xad'),_0x15cf8e[_0x29f6('0xae')],_0x29f6('0xaf'),_0x41c1b9[_0x29f6('0x25')],_0x29f6('0x6b'),_0x41c1b9[_0x29f6('0x28')]);ami['emit'](_0x29f6('0xb0'),ut['buildObj'](_0x15cf8e,'connect',this['campaignsPreview'][_0x15cf8e[_0x29f6('0x69')]]));if(_0x41c1b9['acw']){ami[_0x29f6('0x23')](_0x29f6('0xb1'),ut[_0x29f6('0xb2')](_0x15cf8e));}break;case'16':ami[_0x29f6('0x23')](_0x29f6('0xb3'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xb4'),this['campaignsPreview'][_0x15cf8e[_0x29f6('0x69')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x15cf8e,_0x29f6('0xb4')));_0x41c1b9[_0x29f6('0x37')]+=0x1;_0x41c1b9[_0x29f6('0x2c')]+=0x1;_0x41c1b9[_0x29f6('0xb5')]+=0x1;ut[_0x29f6('0x75')](_0x41c1b9,_0x29f6('0xb6'));_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x4,_0x29f6('0xb7'));rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xb8'));rpcDb['createCustomerFinal'](_0x15cf8e,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x15cf8e);_0x41c1b9[_0x29f6('0x2a')]+=_0x15cf8e[_0x29f6('0xb9')];_0x41c1b9['sumBillable']+=_0x15cf8e[_0x29f6('0xb9')];logger['info'](_0x29f6('0xba'),_0x15cf8e[_0x29f6('0xae')],_0x29f6('0xaf'),_0x41c1b9[_0x29f6('0x25')],_0x29f6('0x6b'),_0x41c1b9[_0x29f6('0x28')]);delete this[_0x29f6('0x10')][_0x35623a[_0x29f6('0xa9')]];break;case _0x29f6('0xbb'):_0x41c1b9[_0x29f6('0x39')]+=0x1;_0x15cf8e['countbusyretry']+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut['totalGlobal'](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x5,_0x29f6('0xbc'));ami[_0x29f6('0x23')](_0x29f6('0xbd'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xbe')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xbf'));if(ut['totalGlobal'](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,'Global');rpcDb['createCustomerFinal'](_0x6e77a1,_0x29f6('0xc1'));}else{if(_0x15cf8e[_0x29f6('0xc2')]>=_0x41c1b9[_0x29f6('0xc3')]){rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xbf'));}else{rpcDb[_0x29f6('0xa5')](ut[_0x29f6('0xa6')](_0x15cf8e,_0x29f6('0xc2'),_0x41c1b9[_0x29f6('0xc4')]),_0x15cf8e[_0x29f6('0xa8')],_0x15cf8e[_0x29f6('0xc5')]);}}break;case _0x29f6('0xc6'):_0x41c1b9['outboundNoAnswerCallsDay']+=0x1;_0x15cf8e['countnoanswerretry']+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut['logCustomer'](_0x15cf8e,0x3,_0x29f6('0xc7'));ami[_0x29f6('0x23')](_0x29f6('0xc8'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xc9')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xca'));if(ut['totalGlobal'](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb['createCustomerFinal'](_0x6e77a1,_0x29f6('0xcb'));}else{if(_0x15cf8e[_0x29f6('0xcc')]>=_0x41c1b9['dialNoAnswerMaxRetry']){rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xca'));}else{rpcDb['rescheduleContact'](ut[_0x29f6('0xa6')](_0x15cf8e,'countnoanswerretry',_0x41c1b9[_0x29f6('0xcd')]),_0x15cf8e[_0x29f6('0xa8')],_0x15cf8e[_0x29f6('0xc5')]);}}break;case _0x29f6('0xce'):_0x41c1b9[_0x29f6('0x3a')]+=0x1;_0x15cf8e[_0x29f6('0xcf')]+=0x1;_0x15cf8e['countglobal']=ut['totalGlobal'](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x8,_0x29f6('0xd0'));ami['emit'](_0x29f6('0xd1'),ut['buildObj'](_0x15cf8e,_0x29f6('0xd2')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xd3'));if(ut[_0x29f6('0x9d')](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb['createCustomerFinal'](_0x6e77a1,_0x29f6('0xd4'));}else{if(_0x15cf8e[_0x29f6('0xcf')]>=_0x41c1b9[_0x29f6('0xd5')]){rpcDb['createCustomerFinal'](_0x15cf8e,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x15cf8e,_0x29f6('0xcf'),_0x41c1b9['dialBusyRetryFrequency']),_0x15cf8e['unlockAgent'],_0x15cf8e['activeContact']);}}break;case _0x29f6('0xd6'):_0x41c1b9[_0x29f6('0x42')]+=0x1;_0x15cf8e[_0x29f6('0xd7')]+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut['logCustomer'](_0x15cf8e,0x14,_0x29f6('0xd8'));ami['emit'](_0x29f6('0xd9'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xda')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0x14,_0x29f6('0xd8'));rpcDb['createCustomerFinal'](_0x6e77a1,_0x29f6('0xdb'));}else{if(_0x15cf8e[_0x29f6('0xd7')]>=_0x41c1b9['dialAgentRejectMaxRetry']){rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xdb'));}else{rpcDb[_0x29f6('0xa5')](ut[_0x29f6('0xa6')](_0x15cf8e,_0x29f6('0xd7'),_0x41c1b9[_0x29f6('0xdc')]),_0x15cf8e[_0x29f6('0xa8')],_0x15cf8e[_0x29f6('0xc5')]);}}break;case _0x29f6('0xdd'):_0x41c1b9[_0x29f6('0x44')]+=0x1;_0x15cf8e['countabandonedretry']+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut['totalGlobal'](_0x15cf8e);ut['logCustomer'](_0x15cf8e,0xb,'Abandoned');rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xde'));if(ut['totalGlobal'](_0x15cf8e)>=_0x41c1b9['dialGlobalMaxRetry']){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb['createCustomerFinal'](_0x6e77a1,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x15cf8e['countabandonedetry']>=_0x41c1b9['dialAbandonedMaxRety']){rpcDb[_0x29f6('0xa3')](_0x15cf8e,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x29f6('0xa5')](ut[_0x29f6('0xa6')](_0x15cf8e,'countabandonedretry',_0x41c1b9[_0x29f6('0xdf')]),_0x15cf8e[_0x29f6('0xa8')],_0x15cf8e['activeContact']);}}break;case'18':_0x41c1b9[_0x29f6('0x43')]+=0x1;_0x15cf8e[_0x29f6('0xe0')]+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x12,_0x35623a[_0x29f6('0xe1')]||_0x35623a[_0x29f6('0xe2')]);ami[_0x29f6('0x23')](_0x29f6('0xe3'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xe4')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xe5'));if(ut[_0x29f6('0x9d')](_0x15cf8e)>=_0x41c1b9['dialGlobalMaxRetry']){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb[_0x29f6('0xa3')](_0x6e77a1,_0x29f6('0xe5'));}else{rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xe5'));}delete this[_0x29f6('0x10')][_0x35623a['linkedid']];break;case'19':_0x41c1b9[_0x29f6('0x43')]+=0x1;_0x15cf8e['countglobal']=ut[_0x29f6('0x9d')](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0x13,_0x35623a[_0x29f6('0xe1')]||_0x35623a[_0x29f6('0xe2')]);ami[_0x29f6('0x23')](_0x29f6('0xe3'),ut[_0x29f6('0xa0')](_0x15cf8e,_0x29f6('0xe4')));rpcDb[_0x29f6('0x8d')](_0x15cf8e,'[callProgressDetectingCustomer][machine]');if(ut[_0x29f6('0x9d')](_0x15cf8e)>=_0x41c1b9[_0x29f6('0xa1')]){_0x6e77a1=ut['cloneAction'](_0x15cf8e,0xf,'Global');rpcDb[_0x29f6('0xa3')](_0x6e77a1,_0x29f6('0xe6'));}else{rpcDb[_0x29f6('0xa3')](_0x15cf8e,_0x29f6('0xe6'));}delete this['actions'][_0x35623a[_0x29f6('0xa9')]];break;default:if(_0x15cf8e[_0x29f6('0x74')]){ut['decrementTalkink'](_0x41c1b9,_0x29f6('0xe7'));ut[_0x29f6('0x76')](_0x29f6('0xe8')+_0x41c1b9[_0x29f6('0x25')],_0x35623a);}_0x41c1b9[_0x29f6('0x43')]+=0x1;_0x15cf8e[_0x29f6('0x9c')]=ut[_0x29f6('0x9d')](_0x15cf8e);ut[_0x29f6('0x89')](_0x15cf8e,0xc,_0x35623a[_0x29f6('0xe1')]||_0x35623a[_0x29f6('0xe2')]);rpcDb[_0x29f6('0x8d')](_0x15cf8e,_0x29f6('0xe9'));if(ut[_0x29f6('0x9d')](_0x15cf8e)>=_0x41c1b9['dialGlobalMaxRetry']){_0x6e77a1=ut[_0x29f6('0xc0')](_0x15cf8e,0xf,_0x29f6('0xa2'));rpcDb[_0x29f6('0xa3')](_0x6e77a1,_0x29f6('0xea'));}else{rpcDb['createCustomerFinal'](_0x15cf8e,_0x29f6('0xea'));}delete this[_0x29f6('0x10')][_0x35623a[_0x29f6('0xa9')]];}if(!(_0x15cf8e['dialAnswer']&&_0xc50331==='16')){ut[_0x29f6('0x72')](_0x41c1b9,_0x29f6('0xeb'));logger['info'](_0x29f6('0xec'),_0x15cf8e[_0x29f6('0xae')],_0x29f6('0xaf'),_0x41c1b9[_0x29f6('0x25')],_0x29f6('0x6a'),_0x41c1b9[_0x29f6('0x4d')]);}if(_0xc50331!==_0x29f6('0xaa')){delete this[_0x29f6('0x10')][_0x35623a[_0x29f6('0xa9')]];delete this[_0x29f6('0x10')][_0x35623a[_0x29f6('0xed')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x454126,_0x201d43,_0x1621b7){if(_[_0x29f6('0xee')](_0x201d43)&&_0x29f6('0xef')!==typeof _0x201d43){return;}if(_[_0x29f6('0xee')](_0x1621b7)&&_0x29f6('0xef')!==typeof _0x1621b7){return;}switch(_0x1621b7[_0x29f6('0xf0')]){case'0':ut['logAgent'](_0x454126,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x454126,_0x29f6('0xf1'));break;case'3':ut[_0x29f6('0xf2')](_0x454126,0x3,_0x29f6('0xc7'));rpcDb[_0x29f6('0xf3')](_0x454126,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x29f6('0xf2')](_0x454126,0x5,_0x29f6('0xbc'));rpcDb['createAgentHistory'](_0x454126,_0x29f6('0xf4'));break;case'8':ut['logAgent'](_0x454126,0x8,_0x29f6('0xd0'));rpcDb[_0x29f6('0xf3')](_0x454126,_0x29f6('0xf5'));break;case'22':ut[_0x29f6('0xf2')](_0x454126,0x16,'AnswerAGI');rpcDb[_0x29f6('0xf3')](_0x454126,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x29f6('0xf2')](_0x454126,0xc,_0x1621b7[_0x29f6('0xf0')]);rpcDb[_0x29f6('0xf3')](_0x454126,_0x29f6('0xf5'));}ut[_0x29f6('0x72')](_0x201d43,_0x29f6('0xf6'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x454126[_0x29f6('0xae')],'\x20Queue',_0x201d43['name'],_0x29f6('0x6a'),_0x201d43['originated']);delete this[_0x29f6('0x10')][_0x454126[_0x29f6('0xae')]];};Preview[_0x29f6('0xc')][_0x29f6('0xf7')]=function(_0x78e714,_0x35846c,_0x4b3a84,_0x4290af,_0xcf0cdd){var _0x3698a9=this;return new BPromise(function(_0x3b2594,_0xa941e6){if(_[_0x29f6('0x7e')](_0x35846c)||_[_0x29f6('0x7e')](_0x35846c[_0x29f6('0xf8')])||_[_0x29f6('0x7e')](_0x35846c[_0x29f6('0xf8')][_0x29f6('0xf9')])||_['isNil'](_0x35846c[_0x29f6('0xfa')])){_0xa941e6(ut[_0x29f6('0x4c')]('Contact\x20is\x20undefined',_0x4290af,_0xcf0cdd));return;}var _0x361b74=uuid['v4']();var _0x41854a=_0x3698a9[_0x29f6('0x22')][_0x35846c['Queue']['name']];var _0x1413a5=_0x4b3a84?_0x3698a9[_0x29f6('0x11')][_0x4b3a84]['id']:undefined;_0x3698a9[_0x29f6('0x10')][_0x361b74]=new Action(_0x35846c,_0x41854a,_0x361b74,_0x4b3a84,_0x1413a5);var _0xd8fdd9=_0x3698a9[_0x29f6('0x10')][_0x361b74];_0xd8fdd9[_0x29f6('0xa8')]=_0x4290af;_0xd8fdd9['activeContact']=_0xcf0cdd;_0xd8fdd9[_0x29f6('0xfb')]=_0x4b3a84;if(_[_0x29f6('0xfc')](_0x78e714)){_0x3698a9['execCall'](_0xd8fdd9,_0x41854a,_0x35846c,_0x4b3a84)['then'](function(_0x540ff0){logger[_0x29f6('0x5a')]('[Preview][execCall][success]',_0x29f6('0xfd')+_0xd8fdd9['queue']+_0x29f6('0xfe')+_0xd8fdd9[_0x29f6('0xff')],JSON[_0x29f6('0x57')](_0x540ff0));ami[_0x29f6('0x23')](_0x29f6('0x100'),ut['buildObj'](_0xd8fdd9,_0x29f6('0x101'),_0x3698a9['campaignsPreview'][_0xd8fdd9[_0x29f6('0x69')]]));_0x3b2594(ut[_0x29f6('0x4c')](_0x29f6('0x102')));})[_0x29f6('0x71')](function(_0x478660){ut[_0x29f6('0x5f')](_0x29f6('0x103'),_0x478660);_0xa941e6(ut[_0x29f6('0x4c')]('Call\x20failed',_0x4290af,_0xcf0cdd));});}else{_0x41854a[_0x29f6('0x38')]+=0x1;ut['logBlacklist'](_0xd8fdd9);rpcDb[_0x29f6('0x104')](_0xd8fdd9,_0x29f6('0x105'));delete _0x3698a9['actions'][_0x361b74];_0xa941e6(ut[_0x29f6('0x4c')]('Contact\x20in\x20black\x20List',_0x4290af,_0xcf0cdd));}});};Preview[_0x29f6('0xc')][_0x29f6('0x96')]=function(_0x52c66d){return!_[_0x29f6('0x7e')](_0x52c66d)&&!_[_0x29f6('0x7e')](_0x52c66d['name'])&&!_[_0x29f6('0x7e')](_0x52c66d[_0x29f6('0x106')])&&_0x52c66d[_0x29f6('0x106')]&&!_[_0x29f6('0x7e')](this[_0x29f6('0x107')][util[_0x29f6('0x58')](_0x29f6('0x108'),_0x52c66d[_0x29f6('0x25')])])&&!_['isNil'](this[_0x29f6('0x107')][util[_0x29f6('0x58')](_0x29f6('0x108'),_0x52c66d[_0x29f6('0x25')])]['status'])&&(this[_0x29f6('0x107')][util[_0x29f6('0x58')](_0x29f6('0x108'),_0x52c66d[_0x29f6('0x25')])][_0x29f6('0x109')]==='reachable'||this['trunks'][util[_0x29f6('0x58')](_0x29f6('0x108'),_0x52c66d['name'])][_0x29f6('0x109')]==='unmonitored');};Preview['prototype'][_0x29f6('0x85')]=function(_0x56c8de,_0x26015a){var _0x24a7fb=this;return new BPromise(function(_0x454c4c,_0x2e7b38){_0x24a7fb['execRun'](_0x56c8de,_0x26015a)[_0x29f6('0x7d')](function(_0xdf7522){_0x454c4c(_[_0x29f6('0x6c')](_0xdf7522,[_0x29f6('0x4c')]));})[_0x29f6('0x71')](function(_0x42650f){if(_0x42650f['unlock']){rpcDb['unlockContact'](_0x56c8de);}if(_0x42650f[_0x29f6('0x106')]){rpcDb[_0x29f6('0x10a')](_0x56c8de);}_0x2e7b38(_[_0x29f6('0x6c')](_0x42650f,[_0x29f6('0x4c')]));});});};Preview[_0x29f6('0xc')][_0x29f6('0x10b')]=function(_0x215780,_0x24757c){var _0x3d131a=this;return new BPromise(function(_0x2bc181,_0x415b83){var _0x3d559f,_0x36f0c0;rpcDb[_0x29f6('0x10c')](_0x215780)[_0x29f6('0x7d')](function(_0x583f5f){if(!_[_0x29f6('0x7e')](_0x583f5f[0x0])){_0x36f0c0=_0x583f5f[0x0][_0x29f6('0x10d')]?![]:!![];_0x3d559f=_0x583f5f[0x0][_0x29f6('0x10d')]?!![]:![];_0x3d559f=_0x24757c?!![]:_0x3d559f;}var _0x2c8a2e=_0x3d131a[_0x29f6('0x10e')](_0x583f5f);if(_0x2c8a2e['isValid']){rpcDb[_0x29f6('0x10f')](_[_0x29f6('0x6c')](_0x583f5f[0x0],[_0x29f6('0xfa'),'Contact.phone']))[_0x29f6('0x7d')](function(_0x2a5414){_0x3d131a[_0x29f6('0xf7')](_0x2a5414,_0x583f5f[0x0],_0x24757c,_0x36f0c0,_0x3d559f)[_0x29f6('0x7d')](function(_0x58d094){_0x2bc181(_0x58d094);})[_0x29f6('0x71')](function(_0x4f9bf9){_0x415b83(_0x4f9bf9);});})[_0x29f6('0x71')](function(_0x5c067f){ut[_0x29f6('0x5f')](_0x29f6('0x110'),_0x5c067f);_0x415b83(ut[_0x29f6('0x4c')](_0x29f6('0x111'),_0x36f0c0,_0x3d559f));});}else{_0x415b83(ut['message'](_0x2c8a2e[_0x29f6('0x4c')],_0x36f0c0,_0x3d559f));}})[_0x29f6('0x71')](function(_0x4577ee){ut[_0x29f6('0x5f')](_0x29f6('0x112'),_0x4577ee);_0x415b83(ut[_0x29f6('0x4c')](_0x29f6('0x111'),![],!![]));});});};Preview[_0x29f6('0xc')][_0x29f6('0x10e')]=function(_0x421f62){if(_[_0x29f6('0x7e')](_0x421f62)||_[_0x29f6('0xfc')](_0x421f62)||!_['isNil'](_0x421f62[0x0][_0x29f6('0x83')])&&_[_0x29f6('0x7e')](_0x421f62[0x0][_0x29f6('0x83')][_0x29f6('0x25')])){ut[_0x29f6('0x5f')](_0x29f6('0x113'),_0x421f62);return{'isValid':![],'message':_0x29f6('0x114')};}var _0xea8577=this['campaignsPreview'][_0x421f62[0x0][_0x29f6('0x68')]['name']];_0xea8577['message']=_0x29f6('0x99');if(_['isNil'](_0xea8577)){ut[_0x29f6('0x5f')](_0x29f6('0x115'),_0xea8577);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x29f6('0x96')](_0xea8577[_0x29f6('0x54')])){ut[_0x29f6('0x5f')](_0x29f6('0x116'),_0x29f6('0x117')+_0xea8577[_0x29f6('0x25')]+_0x29f6('0x118'));if(!this['isTrunkReachable'](_0xea8577[_0x29f6('0x97')])){ut[_0x29f6('0x5f')](_0x29f6('0x116'),_0xea8577[_0x29f6('0x25')]+_0x29f6('0x119'));return{'isValid':![],'message':_0x29f6('0x11a')};}}if(!ut['isActive'](_0xea8577[_0x29f6('0x31')])){ut[_0x29f6('0x5f')]('[Preview][validateContact][Campaign\x20Active]',_0xea8577[_0x29f6('0x25')]+_0x29f6('0x11b'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xea8577[_0x29f6('0x25')]+_0x29f6('0x11b')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x29f6('0xc')]['execCall']=function(_0x5ad6fa,_0x2fad0e,_0x51fa5e,_0x35cdca){var _0x1c8289=this;return new BPromise(function(_0x581020,_0x58173c){var _0x5235cb=_0x5ad6fa[_0x29f6('0xae')];var _0x2586ec=_0x1c8289[_0x29f6('0x96')](_0x2fad0e[_0x29f6('0x54')])?util[_0x29f6('0x58')](_0x29f6('0x11c'),_0x2fad0e[_0x29f6('0x54')][_0x29f6('0x25')],_[_0x29f6('0x7e')](_0x2fad0e[_0x29f6('0x35')])?'':_0x2fad0e[_0x29f6('0x35')][_0x29f6('0x11d')]()||'',_0x2fad0e['dialCutDigit']>0x0?_0x51fa5e['Contact'][_0x29f6('0xf9')][_0x29f6('0x11e')](_0x2fad0e['dialCutDigit']):_0x51fa5e[_0x29f6('0xf8')][_0x29f6('0xf9')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x2fad0e[_0x29f6('0x97')])?_0x2fad0e[_0x29f6('0x54')][_0x29f6('0x25')]:_0x2fad0e[_0x29f6('0x97')]['name'],_[_0x29f6('0x7e')](_0x2fad0e[_0x29f6('0x35')])?'':_0x2fad0e[_0x29f6('0x35')][_0x29f6('0x11d')]()||'',_0x2fad0e[_0x29f6('0x11f')]>0x0?_0x51fa5e[_0x29f6('0xf8')][_0x29f6('0xf9')][_0x29f6('0x11e')](_0x2fad0e[_0x29f6('0x11f')]):_0x51fa5e['Contact'][_0x29f6('0xf9')]);var _0x294136=_0x1c8289[_0x29f6('0x96')](_0x2fad0e[_0x29f6('0x54')])?ut['getCallerId'](_0x2fad0e['Trunk'][_0x29f6('0x55')],_0x2fad0e[_0x29f6('0x33')],_0x2fad0e[_0x29f6('0x120')]>0x0?ut[_0x29f6('0x121')](_0x2fad0e[_0x29f6('0x34')],_0x2fad0e['dialRandomLastDigitCallerIdNumber']):_0x2fad0e[_0x29f6('0x34')]):ut[_0x29f6('0x122')](_[_0x29f6('0x7e')](_0x2fad0e[_0x29f6('0x97')])?_0x2fad0e[_0x29f6('0x54')][_0x29f6('0x55')]:_0x2fad0e[_0x29f6('0x97')]['callerid'],_0x2fad0e[_0x29f6('0x33')],_0x2fad0e[_0x29f6('0x120')]>0x0?ut[_0x29f6('0x121')](_0x2fad0e[_0x29f6('0x34')],_0x2fad0e['dialRandomLastDigitCallerIdNumber']):_0x2fad0e[_0x29f6('0x34')]);if(_0x294136){_0x5ad6fa[_0x29f6('0x123')]=ut[_0x29f6('0x124')](_0x294136);_0x5ad6fa[_0x29f6('0x125')]=ut['extractCalleridNumber'](_0x294136);}var _0x226c3b=ut[_0x29f6('0x126')](_0x2fad0e,_0x51fa5e,_0x2586ec,_0x294136,_0x5235cb,_0x5ad6fa);_[_0x29f6('0x127')](_0x5ad6fa,ut['toLowerVariables'](_0x226c3b));_0x5ad6fa[_0x29f6('0x128')]=moment()[_0x29f6('0x58')](_0x29f6('0x88'));ami[_0x29f6('0x129')](ut['variablesAction'](_0x5ad6fa,_0x2fad0e,_0x226c3b,_0x5ad6fa[_0x29f6('0xc5')],_0x35cdca))[_0x29f6('0x7d')](function(_0x488d3c){_0x2fad0e['originated']+=0x1;logger['info'](_0x29f6('0x12a'),_0x5235cb,_0x29f6('0xaf'),_0x2fad0e['name'],_0x29f6('0x6a'),_0x2fad0e[_0x29f6('0x4d')]);_0x581020(_0x488d3c);})[_0x29f6('0x71')](function(_0x39ec33){ut[_0x29f6('0xf2')](_0x5ad6fa,0xe,'OriginateError');rpcDb[_0x29f6('0xf3')](_0x5ad6fa,_0x29f6('0x12b'));_0x58173c(_0x39ec33);});});};Preview[_0x29f6('0xc')][_0x29f6('0x12c')]=function(_0xd8ac78){if(this[_0x29f6('0x10')][_0xd8ac78[_0x29f6('0xa9')]]){this[_0x29f6('0x10')][_0xd8ac78[_0x29f6('0xa9')]][_0x29f6('0x70')]=_0xd8ac78['channel'];}};Preview[_0x29f6('0xc')][_0x29f6('0x14')]=function(_0x56bfe5){var _0x1869bd=this;var _0x267900=this[_0x29f6('0x10')][_0x56bfe5[_0x29f6('0x12d')]];if(_0x267900){if(_0x267900[_0x29f6('0xfb')]&&this['agents'][_0x267900[_0x29f6('0xfb')]]){ut[_0x29f6('0x12e')](_0x267900,this[_0x29f6('0x11')][_0x267900['lookAgent']]['name'],this[_0x29f6('0x11')][_0x267900[_0x29f6('0xfb')]]['id']);}var _0x38a921=_[_0x29f6('0x12f')](_0x267900);_0x38a921[_0x29f6('0xab')]=moment()[_0x29f6('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4d889e=_0x1869bd[_0x29f6('0x22')][_0x267900[_0x29f6('0x69')]];if(ut[_0x29f6('0x130')](_0x56bfe5[_0x29f6('0x131')])){if(_0x267900[_0x29f6('0xa8')]){rpcDb[_0x29f6('0x132')](_0x267900['idContact']);}if(_0x267900['activeContact']){rpcDb[_0x29f6('0x10a')](_0x267900[_0x29f6('0xff')]);}ami[_0x29f6('0x23')]('custom:agentringnoanswer',ut['buildObj'](_0x267900,'rejected',this[_0x29f6('0x22')][_0x267900['queue']]));this[_0x29f6('0x133')](_0x38a921,_0x4d889e,_0x56bfe5);}else{_0x267900[_0x29f6('0x128')]=moment()[_0x29f6('0x58')](_0x29f6('0x88'));ut[_0x29f6('0xf2')](_0x38a921,0x4,_0x29f6('0xb7'));rpcDb[_0x29f6('0xf3')](_0x38a921,_0x29f6('0x134'));}}};Preview[_0x29f6('0xc')]['syncHangup']=function(_0x2e1bd5){var _0x173977=this;var _0x50183d=this[_0x29f6('0x10')][_0x2e1bd5[_0x29f6('0xa9')]];var _0x43acdc;if(_0x50183d){_0x43acdc=this[_0x29f6('0x22')][_0x50183d['queue']];logger['info'](_0x29f6('0x135'),_0x2e1bd5[_0x29f6('0xa9')],_0x29f6('0xaf'),_0x43acdc[_0x29f6('0x25')],_0x29f6('0x6b'),_0x43acdc['pTalking']);}if(this['actions'][_0x2e1bd5[_0x29f6('0xa9')]]&&_0x2e1bd5[_0x29f6('0xa9')]!==_0x2e1bd5['uniqueid']){if(_0x2e1bd5['cause']==='16'&&this['actions'][_0x2e1bd5[_0x29f6('0xa9')]][_0x29f6('0x74')]){this[_0x29f6('0x9a')](_0x2e1bd5,_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5[_0x29f6('0x136')]);}else if(this['actions'][_0x2e1bd5[_0x29f6('0xa9')]][_0x29f6('0x74')]){logger[_0x29f6('0x5a')](_0x29f6('0x137'),_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5['cause'],_0x29f6('0xaf'),_0x43acdc[_0x29f6('0x25')],_0x29f6('0x6b'),_0x43acdc[_0x29f6('0x28')]);this[_0x29f6('0x9a')](_0x2e1bd5,_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5[_0x29f6('0x136')]);}}else if(_0x50183d&&_[_0x29f6('0x7e')](_0x50183d['statedesc'])&&_0x43acdc[_0x29f6('0x138')]&&_0x2e1bd5[_0x29f6('0xa9')]===_0x2e1bd5['uniqueid']&&_[_0x29f6('0x7e')](_0x2e1bd5[_0x29f6('0xf0')])&&_0x2e1bd5[_0x29f6('0x136')]==='16'&&_0x2e1bd5['channelstate']==='6'&&_['isUndefined'](_0x50183d['transfer'])){if(_0x50183d['unlockAgent']){rpcDb[_0x29f6('0x132')](_0x50183d[_0x29f6('0xff')]);}if(_0x50183d[_0x29f6('0xc5')]){rpcDb[_0x29f6('0x10a')](_0x50183d[_0x29f6('0xff')]);}_0x2e1bd5[_0x29f6('0xf0')]='22';this[_0x29f6('0x133')](_0x50183d,_0x43acdc,_0x2e1bd5);}else if(_0x50183d&&_0x50183d[_0x29f6('0x139')]){if(_0x2e1bd5[_0x29f6('0x136')]==='16'&&this[_0x29f6('0x10')][_0x2e1bd5['linkedid']][_0x29f6('0x74')]){logger['info'](_0x29f6('0x13a'),_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5[_0x29f6('0x136')],_0x29f6('0xaf'),_0x43acdc[_0x29f6('0x25')],_0x29f6('0x6b'),_0x43acdc[_0x29f6('0x28')]);this[_0x29f6('0x9a')](_0x2e1bd5,_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5['cause']);}else if(this['actions'][_0x2e1bd5[_0x29f6('0xa9')]]['dialAnswer']){logger[_0x29f6('0x5a')](_0x29f6('0x137'),_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5[_0x29f6('0x136')],_0x29f6('0xaf'),_0x43acdc['name'],_0x29f6('0x6b'),_0x43acdc[_0x29f6('0x28')]);this[_0x29f6('0x9a')](_0x2e1bd5,_0x2e1bd5[_0x29f6('0xa9')],_0x2e1bd5[_0x29f6('0x136')]);}}};Preview[_0x29f6('0xc')][_0x29f6('0x1b')]=function(_0x44e960){if(this[_0x29f6('0x10')][_0x44e960[_0x29f6('0xed')]]&&_0x44e960[_0x29f6('0xed')]!==_0x44e960['destuniqueid']){this[_0x29f6('0x9a')](_0x44e960,_0x44e960['destlinkedid'],_0x44e960[_0x29f6('0xe2')]);}};Preview[_0x29f6('0xc')]['syncHangupRequest']=function(_0x5d1cec){if(this[_0x29f6('0x10')][_0x5d1cec[_0x29f6('0xa9')]]&&_0x5d1cec['linkedid']!==_0x5d1cec[_0x29f6('0xae')]&&!this[_0x29f6('0x10')][_0x5d1cec[_0x29f6('0xa9')]][_0x29f6('0x74')]){if(_0x5d1cec[_0x29f6('0x136')]==='1'){this['callProgressDetectingCustomer'](_0x5d1cec,_0x5d1cec['linkedid'],_0x5d1cec[_0x29f6('0x136')]);}}};Preview['prototype'][_0x29f6('0x13b')]=function(_0x354dba,_0x50a9f8,_0x380dcc){if(this[_0x29f6('0x10')][_0x354dba]){if(_['isNil'](this[_0x29f6('0x10')][_0x354dba][_0x29f6('0x13c')])){this['actions'][_0x354dba]['variables']={};}this[_0x29f6('0x10')][_0x354dba][_0x29f6('0x13c')][_0x50a9f8]=_0x380dcc;}};Preview[_0x29f6('0xc')][_0x29f6('0x1e')]=function(_0x2bc603){try{if(!_[_0x29f6('0x7e')](_0x2bc603)){if(ut[_0x29f6('0x13d')](_[_0x29f6('0x13e')](_0x2bc603[_0x29f6('0x13f')])[0x0])){this[_0x29f6('0x13b')](_0x2bc603[_0x29f6('0xae')],_[_0x29f6('0x13e')](_0x2bc603[_0x29f6('0x13f')])[0x0],_0x2bc603[_0x29f6('0x140')]);}}}catch(_0x3b078b){logger[_0x29f6('0x141')](_0x29f6('0x142'),util[_0x29f6('0x143')](_0x3b078b,{'showHidden':![],'depth':null}));}};Preview[_0x29f6('0xc')][_0x29f6('0x1f')]=function(_0x326fc5){if(_0x326fc5){if(this['actions'][_0x326fc5[_0x29f6('0x144')]]){this[_0x29f6('0x10')][_0x326fc5[_0x29f6('0x144')]][_0x29f6('0x139')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xad9431){if(_0xad9431){if(this[_0x29f6('0x10')][_0xad9431[_0x29f6('0x145')]]){this['actions'][_0xad9431[_0x29f6('0x145')]][_0x29f6('0x139')]=!![];}}};module[_0x29f6('0x146')]=Preview; \ No newline at end of file +var _0x5636=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice:queue:%s','info','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','booked','outbound','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','enqueue','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','clearZombieChannel','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','complete','total','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','clone','response','custom:agentringnoanswer','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','strategy','answered','pTalking','sumDuration','sumHoldTime','talking','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x5636,0x102));var _0x6563=function(_0x49e937,_0x5dd77d){_0x49e937=_0x49e937-0x0;var _0x11b221=_0x5636[_0x49e937];return _0x11b221;};'use strict';var util=require(_0x6563('0x0'));var _=require(_0x6563('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x6563('0x2'));var Redis=require(_0x6563('0x3'));var config=require(_0x6563('0x4'));var logger=require('../../../config/logger')(_0x6563('0x5'));var loggerAction=require(_0x6563('0x6'))(_0x6563('0x7'));var ami=require(_0x6563('0x8'));var rpcDb=require(_0x6563('0x9'));var Action=require(_0x6563('0xa'));var ut=require(_0x6563('0xb'));config[_0x6563('0xc')]=_[_0x6563('0xd')](config[_0x6563('0xc')],{'host':_0x6563('0xe'),'port':0x18eb});var io=require(_0x6563('0xf'))(new Redis(config[_0x6563('0xc')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2946f3){this[_0x6563('0x10')]=this['tail']?this['tail']['finally'](_0x2946f3):_0x2946f3();};function Preview(_0x1ef002){this[_0x6563('0x11')]=new Sequence();this[_0x6563('0x12')]=_0x1ef002[_0x6563('0x13')];this[_0x6563('0x14')]=_0x1ef002[_0x6563('0x14')];this[_0x6563('0x15')]={};this[_0x6563('0x16')]=_0x1ef002[_0x6563('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0x6563('0x17'),this['syncOriginateResponse'][_0x6563('0x18')](this));ami['on'](_0x6563('0x19'),this[_0x6563('0x1a')][_0x6563('0x18')](this));ami['on']('hanguprequest',this[_0x6563('0x1b')][_0x6563('0x18')](this));ami['on'](_0x6563('0x1c'),this[_0x6563('0x1d')]['bind'](this));ami['on'](_0x6563('0x1e'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0x6563('0x1f')]['bind'](this));ami['on']('attendedtransfer',this[_0x6563('0x20')][_0x6563('0x18')](this));ami['on'](_0x6563('0x21'),this[_0x6563('0x22')][_0x6563('0x18')](this));this[_0x6563('0x23')](this[_0x6563('0x12')]);}function emit(_0x93a45,_0x2a70f0,_0x5bf608){io['to'](_0x93a45)[_0x6563('0x24')](_0x2a70f0,_0x5bf608);}function emitCampaignPreview(_0x9c3da7){if(_0x9c3da7[_0x6563('0x25')]==='outbound'){var _0x293db2={'id':_0x9c3da7['id'],'name':_0x9c3da7['name'],'strategy':_0x9c3da7[_0x6563('0x26')],'answered':_0x9c3da7[_0x6563('0x27')],'available':_0x9c3da7['available'],'loggedIn':_0x9c3da7['loggedIn'],'pTalking':_0x9c3da7[_0x6563('0x28')],'sumBillable':_0x9c3da7['sumBillable'],'sumDuration':_0x9c3da7[_0x6563('0x29')],'sumHoldTime':_0x9c3da7[_0x6563('0x2a')]||0x0,'talking':_0x9c3da7[_0x6563('0x2b')],'total':_0x9c3da7['total'],'type':_0x9c3da7[_0x6563('0x25')],'unmanaged':_0x9c3da7['unmanaged'],'abandoned':_0x9c3da7[_0x6563('0x2c')],'waiting':_0x9c3da7[_0x6563('0x2d')],'loggedInDb':_0x9c3da7['loggedInDb'],'dialActive':_0x9c3da7[_0x6563('0x2e')],'dialMethod':_0x9c3da7[_0x6563('0x2f')],'dialOriginateCallerIdName':_0x9c3da7['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x9c3da7[_0x6563('0x30')],'dialOriginateTimeout':_0x9c3da7['dialOriginateTimeout'],'dialPrefix':_0x9c3da7[_0x6563('0x31')],'outboundAnswerAgiCallsDay':_0x9c3da7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x9c3da7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x9c3da7[_0x6563('0x32')],'outboundBusyCallsDay':_0x9c3da7[_0x6563('0x33')],'outboundCongestionCallsDay':_0x9c3da7[_0x6563('0x34')],'outboundDropCallsDayACS':_0x9c3da7[_0x6563('0x35')],'outboundDropCallsDayCallersExit':_0x9c3da7[_0x6563('0x36')],'outboundDropCallsDayTimeout':_0x9c3da7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x9c3da7[_0x6563('0x37')],'outboundNoSuchCallsDay':_0x9c3da7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x9c3da7['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x9c3da7[_0x6563('0x38')],'outboundRejectCallsDay':_0x9c3da7[_0x6563('0x39')],'outboundUnknownCallsDay':_0x9c3da7[_0x6563('0x3a')],'outboundAbandonedCallsDay':_0x9c3da7[_0x6563('0x3b')],'predictiveIntervalAnsweredCalls':_0x9c3da7[_0x6563('0x3c')],'predictiveIntervalAvgHoldtime':_0x9c3da7[_0x6563('0x3d')],'predictiveIntervalAvgTalktime':_0x9c3da7[_0x6563('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x9c3da7[_0x6563('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x9c3da7[_0x6563('0x40')],'predictiveIntervalErlangCalls':_0x9c3da7[_0x6563('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x9c3da7['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x9c3da7[_0x6563('0x42')],'predictiveIntervalMultiplicativeFactor':_0x9c3da7[_0x6563('0x43')],'predictiveIntervalPauses':_0x9c3da7[_0x6563('0x44')],'predictiveIntervalAvailable':_0x9c3da7[_0x6563('0x45')],'predictiveIntervalTotalCalls':_0x9c3da7[_0x6563('0x46')],'message':_0x9c3da7[_0x6563('0x47')],'originated':_0x9c3da7[_0x6563('0x48')],'erlangCalls':_0x9c3da7['erlangCalls'],'erlangCallToSecond':_0x9c3da7[_0x6563('0x49')],'erlangAbandonmentRate':_0x9c3da7[_0x6563('0x4a')],'erlangBusyFactor':_0x9c3da7[_0x6563('0x4b')],'startPredictive':_0x9c3da7[_0x6563('0x4c')],'startProgressive':_0x9c3da7[_0x6563('0x4d')]};if(_0x9c3da7[_0x6563('0x4e')]){_0x293db2['Trunk']={'id':_0x9c3da7[_0x6563('0x4e')]['id'],'name':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x4f')],'active':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x50')],'callerid':_0x9c3da7[_0x6563('0x4e')][_0x6563('0x51')]};}if(_0x9c3da7['Interval']){_0x293db2[_0x6563('0x52')]={'id':_0x9c3da7[_0x6563('0x52')]['id'],'name':_0x9c3da7['Interval'][_0x6563('0x4f')]};}var _0x1ff47d=md5(JSON['stringify'](_0x293db2));if(_0x9c3da7['md5']!==_0x1ff47d){_0x9c3da7[_0x6563('0x2')]=_0x1ff47d;emit(util[_0x6563('0x53')](_0x6563('0x54'),_0x293db2[_0x6563('0x4f')]),'voice_queue:save',_0x293db2);}}}function emitVoiceQueueChannelRemove(_0x2d36d4){logger[_0x6563('0x55')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6563('0x56')](_0x2d36d4));emit(util[_0x6563('0x53')](_0x6563('0x54'),_0x2d36d4[_0x6563('0x4f')]),_0x6563('0x57'),_0x2d36d4);io[_0x6563('0x24')](_0x6563('0x58'),_0x2d36d4);}function notSendMessagesQueue(_0x15c23e){if(_0x15c23e[_0x6563('0x59')]){if(_0x15c23e['originated']===0x0&&_0x15c23e[_0x6563('0x28')]===0x0){_0x15c23e[_0x6563('0x59')]=![];_0x15c23e[_0x6563('0x5a')]=0x0;_0x15c23e[_0x6563('0x5b')]=0x0;_0x15c23e['message']='NOT_ACTIVE';ut[_0x6563('0x5c')](_0x6563('0x5d'),_0x15c23e[_0x6563('0x4f')]+'\x20is\x20not\x20active');}else{_0x15c23e[_0x6563('0x47')]='IS_DISACTIVED';ut[_0x6563('0x5c')](_0x6563('0x5d'),_0x15c23e['name']+_0x6563('0x5e'));}emitCampaignPreview(_0x15c23e);}}Preview[_0x6563('0x5f')][_0x6563('0x23')]=function(){var _0xcf92cd=this;setInterval(function(){_0xcf92cd[_0x6563('0x60')]();},0x7cf);};Preview[_0x6563('0x5f')][_0x6563('0x60')]=function(){var _0x32932f=this[_0x6563('0x12')];this[_0x6563('0x61')]+=0x1;for(var _0x2acb52 in _0x32932f){if(_0x32932f['hasOwnProperty'](_0x2acb52)&&(_0x32932f[_0x2acb52]['dialMethod']===_0x6563('0x5')||_0x32932f[_0x2acb52][_0x6563('0x2f')]===_0x6563('0x62'))&&_0x32932f[_0x2acb52][_0x6563('0x25')]===_0x6563('0x63')){if(this[_0x6563('0x61')]>0x7){this[_0x6563('0x61')]=0x0;this['clearZombieChannels']();}}if(_0x32932f[_0x6563('0x64')](_0x2acb52)&&_0x32932f[_0x2acb52][_0x6563('0x2f')]===_0x6563('0x5')&&_0x32932f[_0x2acb52][_0x6563('0x25')]==='outbound'){if(_0x32932f[_0x2acb52][_0x6563('0x2e')]){this[_0x6563('0x65')](_0x32932f[_0x2acb52]);if(_0x32932f[_0x2acb52][_0x6563('0x66')])this[_0x6563('0x67')](_0x32932f[_0x2acb52]);}else{notSendMessagesQueue(_0x32932f[_0x2acb52]);}}}};Preview[_0x6563('0x5f')]['clearZombieChannel']=function(_0x496602){var _0x1504ca=this;this[_0x6563('0x11')][_0x6563('0x68')](function(){if(!_['isNil'](_0x1504ca[_0x6563('0x15')][_0x496602])){loggerAction[_0x6563('0x55')](_0x6563('0x69'),_0x496602,_0x6563('0x6a'),_0x1504ca['actions'][_0x496602][_0x6563('0x6b')],_0x6563('0x6c'),JSON[_0x6563('0x56')](_0x1504ca['campaignsPreview'][_0x1504ca[_0x6563('0x15')][_0x496602]['queue']][_0x6563('0x48')]),'pTalking:\x20',JSON['stringify'](_0x1504ca[_0x6563('0x12')][_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6b')]][_0x6563('0x28')]),JSON[_0x6563('0x56')](_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6d')]),JSON[_0x6563('0x56')](_[_0x6563('0x6e')](_0x1504ca[_0x6563('0x15')][_0x496602],['contactId',_0x6563('0x6f'),'VoiceQueueId',_0x6563('0x70')])));return ami[_0x6563('0x71')]({'action':_0x6563('0x72'),'channel':_0x1504ca['actions'][_0x496602][_0x6563('0x73')]})[_0x6563('0x74')](function(_0x4f9884){if(_0x4f9884[_0x6563('0x47')]===_0x6563('0x75')){setTimeout(function(){if(_0x1504ca[_0x6563('0x15')][_0x496602]){ut[_0x6563('0x76')](_0x1504ca[_0x6563('0x12')][_0x1504ca['actions'][_0x496602][_0x6563('0x6b')]],'[clearZombieChannel]');if(_0x1504ca[_0x6563('0x15')][_0x496602]['dialAnswer']===!![]){ut[_0x6563('0x77')](_0x1504ca['campaignsPreview'][_0x1504ca['actions'][_0x496602]['queue']],'[clearZombieChannel]');ut[_0x6563('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x496602,_0x1504ca[_0x6563('0x15')][_0x496602]['queue']);}ut[_0x6563('0x78')](_0x6563('0x79')+_0x496602,_0x1504ca[_0x6563('0x15')][_0x496602][_0x6563('0x6b')]);delete _0x1504ca[_0x6563('0x15')][_0x496602];}},0x2328);}});}});};Preview[_0x6563('0x5f')][_0x6563('0x7a')]=function(){var _0xdc94f8=this;loggerAction[_0x6563('0x55')]('[action]',_[_0x6563('0x7b')](this[_0x6563('0x15')]));for(var _0x97ee3 in this[_0x6563('0x15')]){if(_0xdc94f8[_0x6563('0x15')][_0x6563('0x64')](_0x97ee3)){_0xdc94f8[_0x6563('0x7c')](_0x97ee3);}}};Preview[_0x6563('0x5f')][_0x6563('0x67')]=function(_0x2c7e9d){var _0x1fc431=this;rpcDb['getContactRecallMe'](_0x2c7e9d['id'],ut[_0x6563('0x7d')](this[_0x6563('0x16')]))[_0x6563('0x7e')](function(_0x2e9c69){if(!_[_0x6563('0x7f')](_0x2e9c69)){for(var _0x3c06ac=0x0;_0x3c06ac<_0x2e9c69[_0x6563('0x80')];_0x3c06ac+=0x1){if(ut[_0x6563('0x81')](_0x2e9c69[_0x3c06ac]['scheduledat'])<_0x2c7e9d[_0x6563('0x82')]*0x3c){if(_0x2e9c69[_0x3c06ac]['Agent']&&!_0x2e9c69[_0x3c06ac][_0x6563('0x83')][_0x6563('0x84')]){_0x1fc431['run'](_0x2e9c69[_0x3c06ac]['id'])['then'](ut[_0x6563('0x85')](_0x6563('0x86')))[_0x6563('0x74')](ut[_0x6563('0x85')]('[RecallMe]'));}else{rpcDb[_0x6563('0x87')](_0x2e9c69[_0x3c06ac]['id']);}}else{var _0x49c1e0=new Action(_0x2e9c69[_0x3c06ac],_0x2c7e9d);_0x49c1e0[_0x6563('0x88')]=moment()[_0x6563('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c7e9d['outboundReCallsDay']+=0x1;ut[_0x6563('0x89')](_0x49c1e0,0x17,'RecallInQueue');if(_0x2c7e9d['dialRecallInQueue']){rpcDb[_0x6563('0x8a')](ut['createBody'](_0x2e9c69[_0x3c06ac]));rpcDb[_0x6563('0x8b')](_0x49c1e0,_0x6563('0x8c'));}else{ut[_0x6563('0x89')](_0x49c1e0,0x16,_0x6563('0x8d'));rpcDb['createCustomerHistory'](_0x49c1e0,_0x6563('0x8e'));rpcDb[_0x6563('0x8f')](_0x49c1e0,_0x6563('0x8e'));}}}}})[_0x6563('0x74')](ut[_0x6563('0x85')](_0x6563('0x90')));};Preview[_0x6563('0x5f')][_0x6563('0x65')]=function(_0x58728d){_0x58728d['sendMessageOneNotActive']=!![];if(ut[_0x6563('0x91')](_0x58728d[_0x6563('0x92')])){_0x58728d['message']='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x58728d[_0x6563('0x2e')])){_0x58728d[_0x6563('0x47')]=_0x6563('0x93');}else if(!this[_0x6563('0x94')](_0x58728d['Trunk'])){if(!this[_0x6563('0x94')](_0x58728d[_0x6563('0x95')])){_0x58728d[_0x6563('0x47')]=_0x6563('0x96');}else{_0x58728d[_0x6563('0x47')]='ACTIVE';}}else{_0x58728d['message']=_0x6563('0x97');}emitCampaignPreview(_0x58728d);};Preview[_0x6563('0x5f')][_0x6563('0x98')]=function(_0x5d365e,_0x23a3e2,_0x5e8a05){var _0x311036=this;var _0x29dfff=this[_0x6563('0x15')][_0x23a3e2];var _0x2ddaac=this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]];var _0x500aa1;if(_0x2ddaac){switch(_0x5e8a05){case'1':_0x2ddaac['outboundNoSuchCallsDay']+=0x1;_0x29dfff['countnosuchnumberretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x0,_0x6563('0x9b'));ami[_0x6563('0x24')](_0x6563('0x9c'),ut['buildObj'](_0x29dfff,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x29dfff,_0x6563('0x9d'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb['createCustomerFinal'](_0x500aa1,_0x6563('0xa1'));}else{if(_0x29dfff[_0x6563('0xa2')]>=_0x2ddaac[_0x6563('0xa3')]){rpcDb[_0x6563('0x8f')](_0x29dfff,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xa2'),_0x2ddaac[_0x6563('0xa6')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case _0x6563('0xaa'):var _0x1e08a8=moment()[_0x6563('0x53')](_0x6563('0xab'));_0x29dfff[_0x6563('0xac')]=_0x1e08a8;_0x29dfff[_0x6563('0xad')]=_0x1e08a8;_0x29dfff[_0x6563('0x6d')]=!![];_0x2ddaac['pTalking']+=0x1;logger[_0x6563('0x55')](_0x6563('0xae'),_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0xb1'),_0x2ddaac[_0x6563('0x28')]);ami[_0x6563('0x24')](_0x6563('0xb2'),ut[_0x6563('0xb3')](_0x29dfff,'connect',this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]]));if(_0x2ddaac[_0x6563('0xb4')]){ami[_0x6563('0x24')](_0x6563('0xb5'),ut[_0x6563('0xb6')](_0x29dfff));}break;case'16':ami[_0x6563('0x24')]('custom:agentcomplete',ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xb7'),this[_0x6563('0x12')][_0x29dfff[_0x6563('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xb7')));_0x2ddaac['outboundAnswerCallsDay']+=0x1;_0x2ddaac[_0x6563('0xb8')]+=0x1;_0x2ddaac[_0x6563('0x27')]+=0x1;ut[_0x6563('0x77')](_0x2ddaac,'[16]');_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x4,'Answer');rpcDb['createCustomerHistory'](_0x29dfff,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xb9'));rpcDb[_0x6563('0xba')](_0x29dfff);_0x2ddaac[_0x6563('0x29')]+=_0x29dfff['talktime'];_0x2ddaac[_0x6563('0xbb')]+=_0x29dfff[_0x6563('0xbc')];logger['info']('[syncHangup][talking][decrement]',_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0xb1'),_0x2ddaac['pTalking']);delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case _0x6563('0xbd'):_0x2ddaac[_0x6563('0x33')]+=0x1;_0x29dfff[_0x6563('0xbe')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x5,_0x6563('0xbf'));ami['emit'](_0x6563('0xc0'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xc1')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xc2'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x29dfff['countbusyretry']>=_0x2ddaac[_0x6563('0xc3')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xc2'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,'countbusyretry',_0x2ddaac['dialBusyRetryFrequency']),_0x29dfff[_0x6563('0xa7')],_0x29dfff['activeContact']);}}break;case _0x6563('0xc4'):_0x2ddaac['outboundNoAnswerCallsDay']+=0x1;_0x29dfff['countnoanswerretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x3,_0x6563('0xc5'));ami[_0x6563('0x24')](_0x6563('0xc6'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xc7')));rpcDb['createCustomerHistory'](_0x29dfff,_0x6563('0xc8'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x29dfff[_0x6563('0xc9')]>=_0x2ddaac[_0x6563('0xca')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xc8'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xc9'),_0x2ddaac[_0x6563('0xcb')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xcc'):_0x2ddaac[_0x6563('0x34')]+=0x1;_0x29dfff['countcongestionretry']+=0x1;_0x29dfff[_0x6563('0x99')]=ut['totalGlobal'](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x8,_0x6563('0xcd'));ami[_0x6563('0x24')](_0x6563('0xce'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xcf')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xd0'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xd1'));}else{if(_0x29dfff[_0x6563('0xd2')]>=_0x2ddaac['dialCongestionMaxRetry']){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xd0'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xd2'),_0x2ddaac[_0x6563('0xd3')]),_0x29dfff['unlockAgent'],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xd4'):_0x2ddaac['outboundRejectCallsDay']+=0x1;_0x29dfff[_0x6563('0xd5')]+=0x1;_0x29dfff['countglobal']=ut['totalGlobal'](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x14,_0x6563('0xd6'));ami[_0x6563('0x24')](_0x6563('0xd7'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xd8')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xd9'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut['cloneAction'](_0x29dfff,0x14,_0x6563('0xd6'));rpcDb[_0x6563('0x8f')](_0x500aa1,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x29dfff['countagentrejectretry']>=_0x2ddaac[_0x6563('0xda')]){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xdb'));}else{rpcDb[_0x6563('0xa4')](ut['scheduledAt'](_0x29dfff,_0x6563('0xd5'),_0x2ddaac['dialAgentRejectRetryFrequency']),_0x29dfff[_0x6563('0xa7')],_0x29dfff[_0x6563('0xa8')]);}}break;case _0x6563('0xdc'):_0x2ddaac[_0x6563('0x3b')]+=0x1;_0x29dfff[_0x6563('0xdd')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut['totalGlobal'](_0x29dfff);ut['logCustomer'](_0x29dfff,0xb,_0x6563('0xde'));rpcDb[_0x6563('0x8b')](_0x29dfff,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut['cloneAction'](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xdf'));}else{if(_0x29dfff[_0x6563('0xe0')]>=_0x2ddaac['dialAbandonedMaxRety']){rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xdf'));}else{rpcDb[_0x6563('0xa4')](ut[_0x6563('0xa5')](_0x29dfff,_0x6563('0xdd'),_0x2ddaac[_0x6563('0xe1')]),_0x29dfff[_0x6563('0xa7')],_0x29dfff['activeContact']);}}break;case'18':_0x2ddaac[_0x6563('0x3a')]+=0x1;_0x29dfff[_0x6563('0xe2')]+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut['logCustomer'](_0x29dfff,0x12,_0x5d365e['cause-txt']||_0x5d365e[_0x6563('0xe3')]);ami[_0x6563('0x24')](_0x6563('0xe4'),ut[_0x6563('0xb3')](_0x29dfff,_0x6563('0xe5')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xe6'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut['cloneAction'](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xe6'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xe6'));}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];break;case'19':_0x2ddaac['outboundUnknownCallsDay']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut[_0x6563('0x89')](_0x29dfff,0x13,_0x5d365e[_0x6563('0xe7')]||_0x5d365e[_0x6563('0xe3')]);ami[_0x6563('0x24')](_0x6563('0xe4'),ut['buildObj'](_0x29dfff,_0x6563('0xe5')));rpcDb[_0x6563('0x8b')](_0x29dfff,_0x6563('0xe8'));if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac['dialGlobalMaxRetry']){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,_0x6563('0xa0'));rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xe8'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xe8'));}delete this[_0x6563('0x15')][_0x5d365e['linkedid']];break;default:if(_0x29dfff['dialAnswer']){ut[_0x6563('0x77')](_0x2ddaac,_0x6563('0xe9'));ut[_0x6563('0x78')](_0x6563('0xea')+_0x2ddaac['name'],_0x5d365e);}_0x2ddaac['outboundUnknownCallsDay']+=0x1;_0x29dfff[_0x6563('0x99')]=ut[_0x6563('0x9a')](_0x29dfff);ut['logCustomer'](_0x29dfff,0xc,_0x5d365e[_0x6563('0xe7')]||_0x5d365e['dialstatus']);rpcDb[_0x6563('0x8b')](_0x29dfff,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x6563('0x9a')](_0x29dfff)>=_0x2ddaac[_0x6563('0x9e')]){_0x500aa1=ut[_0x6563('0x9f')](_0x29dfff,0xf,'Global');rpcDb[_0x6563('0x8f')](_0x500aa1,_0x6563('0xeb'));}else{rpcDb[_0x6563('0x8f')](_0x29dfff,_0x6563('0xeb'));}delete this[_0x6563('0x15')][_0x5d365e[_0x6563('0xa9')]];}if(!(_0x29dfff['dialAnswer']&&_0x5e8a05==='16')){ut[_0x6563('0x76')](_0x2ddaac,_0x6563('0xec'));logger[_0x6563('0x55')](_0x6563('0xed'),_0x29dfff[_0x6563('0xaf')],_0x6563('0xb0'),_0x2ddaac[_0x6563('0x4f')],_0x6563('0x6c'),_0x2ddaac['originated']);}if(_0x5e8a05!==_0x6563('0xaa')){delete this['actions'][_0x5d365e[_0x6563('0xa9')]];delete this[_0x6563('0x15')][_0x5d365e['destlinkedid']];}}};Preview[_0x6563('0x5f')][_0x6563('0xee')]=function(_0x3a6135,_0x3a1c66,_0x367404){if(_[_0x6563('0xef')](_0x3a1c66)&&_0x6563('0xf0')!==typeof _0x3a1c66){return;}if(_['isUndefined'](_0x367404)&&_0x6563('0xf0')!==typeof _0x367404){return;}switch(_0x367404[_0x6563('0xf1')]){case'0':ut[_0x6563('0xf2')](_0x3a6135,0x0,_0x6563('0x9b'));rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf4'));break;case'3':ut[_0x6563('0xf2')](_0x3a6135,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3a6135,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x6563('0xf2')](_0x3a6135,0x5,_0x6563('0xbf'));rpcDb['createAgentHistory'](_0x3a6135,_0x6563('0xf5'));break;case'8':ut[_0x6563('0xf2')](_0x3a6135,0x8,_0x6563('0xcd'));rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf6'));break;case'22':ut[_0x6563('0xf2')](_0x3a6135,0x16,_0x6563('0xf7'));rpcDb['createAgentHistory'](_0x3a6135,_0x6563('0xf8'));break;default:ut[_0x6563('0xf2')](_0x3a6135,0xc,_0x367404[_0x6563('0xf1')]);rpcDb[_0x6563('0xf3')](_0x3a6135,_0x6563('0xf6'));}ut[_0x6563('0x76')](_0x3a1c66,_0x6563('0xf9'));logger[_0x6563('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x3a6135[_0x6563('0xaf')],'\x20Queue',_0x3a1c66[_0x6563('0x4f')],_0x6563('0x6c'),_0x3a1c66[_0x6563('0x48')]);delete this[_0x6563('0x15')][_0x3a6135['uniqueid']];};Preview[_0x6563('0x5f')][_0x6563('0xfa')]=function(_0x399926,_0x471981,_0x6fef3d,_0x8dea03,_0x141eb9){var _0x7f3bbd=this;return new BPromise(function(_0x4fd06b,_0x438160){if(_['isNil'](_0x471981)||_[_0x6563('0x7f')](_0x471981[_0x6563('0xfb')])||_[_0x6563('0x7f')](_0x471981[_0x6563('0xfb')][_0x6563('0xfc')])||_['isNil'](_0x471981['VoiceQueueId'])){_0x438160(ut['message'](_0x6563('0xfd'),_0x8dea03,_0x141eb9));return;}var _0x49ff52=uuid['v4']();var _0x25cd9e=_0x7f3bbd['campaignsPreview'][_0x471981[_0x6563('0x6a')][_0x6563('0x4f')]];var _0x1e75f7=_0x6fef3d?_0x7f3bbd[_0x6563('0x16')][_0x6fef3d]['id']:undefined;_0x7f3bbd[_0x6563('0x15')][_0x49ff52]=new Action(_0x471981,_0x25cd9e,_0x49ff52,_0x6fef3d,_0x1e75f7);var _0x1f75f7=_0x7f3bbd['actions'][_0x49ff52];_0x1f75f7['unlockAgent']=_0x8dea03;_0x1f75f7[_0x6563('0xa8')]=_0x141eb9;_0x1f75f7['lookAgent']=_0x6fef3d;if(_[_0x6563('0xfe')](_0x399926)){_0x7f3bbd[_0x6563('0xff')](_0x1f75f7,_0x25cd9e,_0x471981,_0x6fef3d)['then'](function(_0x374780){logger[_0x6563('0x55')]('[Preview][execCall][success]',_0x6563('0x100')+_0x1f75f7[_0x6563('0x6b')]+_0x6563('0x101')+_0x1f75f7[_0x6563('0x102')],JSON[_0x6563('0x56')](_0x374780));ami['emit'](_0x6563('0x103'),ut[_0x6563('0xb3')](_0x1f75f7,_0x6563('0x104'),_0x7f3bbd[_0x6563('0x12')][_0x1f75f7[_0x6563('0x6b')]]));_0x4fd06b(ut[_0x6563('0x47')](_0x6563('0x105')));})[_0x6563('0x74')](function(_0x35cbd2){ut[_0x6563('0x5c')](_0x6563('0x106'),_0x35cbd2);_0x438160(ut[_0x6563('0x47')](_0x6563('0x107'),_0x8dea03,_0x141eb9));});}else{_0x25cd9e[_0x6563('0x32')]+=0x1;ut[_0x6563('0x108')](_0x1f75f7);rpcDb[_0x6563('0x109')](_0x1f75f7,_0x6563('0x10a'));delete _0x7f3bbd[_0x6563('0x15')][_0x49ff52];_0x438160(ut[_0x6563('0x47')]('Contact\x20in\x20black\x20List',_0x8dea03,_0x141eb9));}});};Preview[_0x6563('0x5f')][_0x6563('0x94')]=function(_0x1a8f03){return!_[_0x6563('0x7f')](_0x1a8f03)&&!_[_0x6563('0x7f')](_0x1a8f03[_0x6563('0x4f')])&&!_[_0x6563('0x7f')](_0x1a8f03[_0x6563('0x50')])&&_0x1a8f03[_0x6563('0x50')]&&!_['isNil'](this[_0x6563('0x14')][util['format'](_0x6563('0x10b'),_0x1a8f03[_0x6563('0x4f')])])&&!_[_0x6563('0x7f')](this['trunks'][util[_0x6563('0x53')](_0x6563('0x10b'),_0x1a8f03['name'])][_0x6563('0x72')])&&(this[_0x6563('0x14')][util[_0x6563('0x53')]('SIP/%s',_0x1a8f03[_0x6563('0x4f')])]['status']===_0x6563('0x10c')||this[_0x6563('0x14')][util['format'](_0x6563('0x10b'),_0x1a8f03['name'])]['status']===_0x6563('0x10d'));};Preview[_0x6563('0x5f')][_0x6563('0x10e')]=function(_0x1036f0,_0x7a1eca){var _0x32f037=this;return new BPromise(function(_0x32ee06,_0x399455){_0x32f037[_0x6563('0x10f')](_0x1036f0,_0x7a1eca)[_0x6563('0x7e')](function(_0x2d0e3b){_0x32ee06(_[_0x6563('0x6e')](_0x2d0e3b,[_0x6563('0x47')]));})[_0x6563('0x74')](function(_0x5e5c86){if(_0x5e5c86[_0x6563('0x110')]){rpcDb[_0x6563('0x111')](_0x1036f0);}if(_0x5e5c86[_0x6563('0x50')]){rpcDb['disableContact'](_0x1036f0);}_0x399455(_[_0x6563('0x6e')](_0x5e5c86,['message']));});});};Preview[_0x6563('0x5f')][_0x6563('0x10f')]=function(_0x32f54a,_0x52f5a8){var _0x474a74=this;return new BPromise(function(_0x425980,_0x4a66cb){var _0x2cef73,_0x13b2dc;rpcDb[_0x6563('0x112')](_0x32f54a)[_0x6563('0x7e')](function(_0x3c8318){if(!_['isNil'](_0x3c8318[0x0])){_0x13b2dc=_0x3c8318[0x0][_0x6563('0x113')]?![]:!![];_0x2cef73=_0x3c8318[0x0][_0x6563('0x113')]?!![]:![];_0x2cef73=_0x52f5a8?!![]:_0x2cef73;}var _0x5ab66e=_0x474a74[_0x6563('0x114')](_0x3c8318);if(_0x5ab66e['isValid']){rpcDb['checkIsBlackList'](_[_0x6563('0x6e')](_0x3c8318[0x0],[_0x6563('0x115'),_0x6563('0x116')]))[_0x6563('0x7e')](function(_0x12a51c){_0x474a74[_0x6563('0xfa')](_0x12a51c,_0x3c8318[0x0],_0x52f5a8,_0x13b2dc,_0x2cef73)[_0x6563('0x7e')](function(_0x134f0a){_0x425980(_0x134f0a);})[_0x6563('0x74')](function(_0x2dd813){_0x4a66cb(_0x2dd813);});})['catch'](function(_0x361107){ut[_0x6563('0x5c')](_0x6563('0x117'),_0x361107);_0x4a66cb(ut[_0x6563('0x47')](_0x6563('0x118'),_0x13b2dc,_0x2cef73));});}else{_0x4a66cb(ut[_0x6563('0x47')](_0x5ab66e['message'],_0x13b2dc,_0x2cef73));}})[_0x6563('0x74')](function(_0x11f51d){ut[_0x6563('0x5c')](_0x6563('0x119'),_0x11f51d);_0x4a66cb(ut[_0x6563('0x47')](_0x6563('0x118'),![],!![]));});});};Preview[_0x6563('0x5f')][_0x6563('0x114')]=function(_0x11359a){if(_[_0x6563('0x7f')](_0x11359a)||_['isEmpty'](_0x11359a)||!_['isNil'](_0x11359a[0x0][_0x6563('0x83')])&&_['isNil'](_0x11359a[0x0][_0x6563('0x83')][_0x6563('0x4f')])){ut[_0x6563('0x5c')]('[Preview][validateContact][Empty\x20Contact]',_0x11359a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x262de2=this['campaignsPreview'][_0x11359a[0x0]['Queue'][_0x6563('0x4f')]];_0x262de2['message']=_0x6563('0x97');if(_[_0x6563('0x7f')](_0x262de2)){ut[_0x6563('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0x262de2);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x6563('0x94')](_0x262de2['Trunk'])){ut[_0x6563('0x5c')](_0x6563('0x11a'),_0x6563('0x11b')+_0x262de2[_0x6563('0x4f')]+_0x6563('0x11c'));if(!this[_0x6563('0x94')](_0x262de2[_0x6563('0x95')])){ut[_0x6563('0x5c')](_0x6563('0x11a'),_0x262de2[_0x6563('0x4f')]+_0x6563('0x11d'));return{'isValid':![],'message':_0x6563('0x11e')};}}if(!ut[_0x6563('0x11f')](_0x262de2[_0x6563('0x2e')])){ut[_0x6563('0x5c')](_0x6563('0x120'),_0x262de2[_0x6563('0x4f')]+_0x6563('0x121'));return{'isValid':![],'message':_0x6563('0x11b')+_0x262de2[_0x6563('0x4f')]+_0x6563('0x121')};}return{'isValid':!![],'message':_0x6563('0x122')};};Preview[_0x6563('0x5f')][_0x6563('0xff')]=function(_0x2eccd6,_0x4ae945,_0x4a8de0,_0x324cc1){var _0x2ca1c7=this;return new BPromise(function(_0x4ce85c,_0xf30ae6){var _0x251555=_0x2eccd6['uniqueid'];var _0xdcdce=_0x2ca1c7[_0x6563('0x94')](_0x4ae945[_0x6563('0x4e')])?util[_0x6563('0x53')](_0x6563('0x123'),_0x4ae945[_0x6563('0x4e')]['name'],_['isNil'](_0x4ae945[_0x6563('0x31')])?'':_0x4ae945[_0x6563('0x31')][_0x6563('0x124')]()||'',_0x4ae945['dialCutDigit']>0x0?_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')][_0x6563('0x125')](_0x4ae945[_0x6563('0x126')]):_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]):util[_0x6563('0x53')]('SIP/%s/%s%s',_[_0x6563('0x7f')](_0x4ae945[_0x6563('0x95')])?_0x4ae945[_0x6563('0x4e')]['name']:_0x4ae945[_0x6563('0x95')][_0x6563('0x4f')],_['isNil'](_0x4ae945[_0x6563('0x31')])?'':_0x4ae945['dialPrefix'][_0x6563('0x124')]()||'',_0x4ae945[_0x6563('0x126')]>0x0?_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]['substring'](_0x4ae945[_0x6563('0x126')]):_0x4a8de0[_0x6563('0xfb')][_0x6563('0xfc')]);var _0x183752=_0x2ca1c7[_0x6563('0x94')](_0x4ae945[_0x6563('0x4e')])?ut[_0x6563('0x127')](_0x4ae945['Trunk'][_0x6563('0x51')],_0x4ae945[_0x6563('0x128')],_0x4ae945[_0x6563('0x129')]>0x0?ut[_0x6563('0x12a')](_0x4ae945[_0x6563('0x30')],_0x4ae945[_0x6563('0x129')]):_0x4ae945['dialOriginateCallerIdNumber']):ut[_0x6563('0x127')](_[_0x6563('0x7f')](_0x4ae945['TrunkBackup'])?_0x4ae945['Trunk'][_0x6563('0x51')]:_0x4ae945[_0x6563('0x95')][_0x6563('0x51')],_0x4ae945['dialOriginateCallerIdName'],_0x4ae945[_0x6563('0x129')]>0x0?ut[_0x6563('0x12a')](_0x4ae945[_0x6563('0x30')],_0x4ae945[_0x6563('0x129')]):_0x4ae945['dialOriginateCallerIdNumber']);if(_0x183752){_0x2eccd6['originatecalleridname']=ut[_0x6563('0x12b')](_0x183752);_0x2eccd6[_0x6563('0x12c')]=ut['extractCalleridNumber'](_0x183752);}var _0x18b7f7=ut[_0x6563('0x12d')](_0x4ae945,_0x4a8de0,_0xdcdce,_0x183752,_0x251555,_0x2eccd6);_[_0x6563('0x12e')](_0x2eccd6,ut[_0x6563('0x12f')](_0x18b7f7));_0x2eccd6[_0x6563('0x88')]=moment()[_0x6563('0x53')](_0x6563('0xab'));ami[_0x6563('0x71')](ut['variablesAction'](_0x2eccd6,_0x4ae945,_0x18b7f7,_0x2eccd6[_0x6563('0xa8')],_0x324cc1))[_0x6563('0x7e')](function(_0x67ad58){_0x4ae945[_0x6563('0x48')]+=0x1;logger[_0x6563('0x55')]('[originated][increment]',_0x251555,_0x6563('0xb0'),_0x4ae945[_0x6563('0x4f')],_0x6563('0x6c'),_0x4ae945[_0x6563('0x48')]);_0x4ce85c(_0x67ad58);})[_0x6563('0x74')](function(_0x1fe118){ut[_0x6563('0xf2')](_0x2eccd6,0xe,'OriginateError');rpcDb[_0x6563('0xf3')](_0x2eccd6,_0x6563('0x130'));_0xf30ae6(_0x1fe118);});});};Preview[_0x6563('0x5f')][_0x6563('0x131')]=function(_0xf7c630){if(this[_0x6563('0x15')][_0xf7c630[_0x6563('0xa9')]]){this[_0x6563('0x15')][_0xf7c630[_0x6563('0xa9')]][_0x6563('0x73')]=_0xf7c630[_0x6563('0x73')];}};Preview[_0x6563('0x5f')]['syncOriginateResponse']=function(_0x4db603){var _0x10e9e0=this;var _0x23b935=this['actions'][_0x4db603[_0x6563('0x132')]];if(_0x23b935){if(_0x23b935[_0x6563('0x133')]&&this['agents'][_0x23b935['lookAgent']]){ut['logLookAgent'](_0x23b935,this[_0x6563('0x16')][_0x23b935[_0x6563('0x133')]]['name'],this[_0x6563('0x16')][_0x23b935['lookAgent']]['id']);}var _0xca19b5=_[_0x6563('0x134')](_0x23b935);_0xca19b5['responsetime']=moment()[_0x6563('0x53')](_0x6563('0xab'));var _0x3078a4=_0x10e9e0[_0x6563('0x12')][_0x23b935[_0x6563('0x6b')]];if(ut['isFailure'](_0x4db603[_0x6563('0x135')])){if(_0x23b935['unlockAgent']){rpcDb[_0x6563('0x111')](_0x23b935[_0x6563('0x102')]);}if(_0x23b935[_0x6563('0xa8')]){rpcDb['disableContact'](_0x23b935[_0x6563('0x102')]);}ami['emit'](_0x6563('0x136'),ut[_0x6563('0xb3')](_0x23b935,_0x6563('0x137'),this[_0x6563('0x12')][_0x23b935['queue']]));this[_0x6563('0xee')](_0xca19b5,_0x3078a4,_0x4db603);}else{_0x23b935[_0x6563('0x88')]=moment()[_0x6563('0x53')](_0x6563('0xab'));ut[_0x6563('0xf2')](_0xca19b5,0x4,_0x6563('0x138'));rpcDb['createAgentHistory'](_0xca19b5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6563('0x5f')][_0x6563('0x1a')]=function(_0x4f0647){var _0x4c5265=this;var _0x9d364f=this[_0x6563('0x15')][_0x4f0647['linkedid']];var _0x38ae7f;if(_0x9d364f){_0x38ae7f=this[_0x6563('0x12')][_0x9d364f[_0x6563('0x6b')]];logger[_0x6563('0x55')](_0x6563('0x139'),_0x4f0647[_0x6563('0xa9')],_0x6563('0xb0'),_0x38ae7f['name'],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);}if(this[_0x6563('0x15')][_0x4f0647[_0x6563('0xa9')]]&&_0x4f0647[_0x6563('0xa9')]!==_0x4f0647[_0x6563('0xaf')]){if(_0x4f0647['cause']==='16'&&this['actions'][_0x4f0647[_0x6563('0xa9')]][_0x6563('0x6d')]){this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')]);}else if(this[_0x6563('0x15')][_0x4f0647['linkedid']][_0x6563('0x6d')]){logger[_0x6563('0x55')](_0x6563('0x13b'),_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')],_0x6563('0xb0'),_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647[_0x6563('0xa9')],_0x4f0647[_0x6563('0x13a')]);}}else if(_0x9d364f&&_[_0x6563('0x7f')](_0x9d364f[_0x6563('0x13c')])&&_0x38ae7f['dialQueueProject']&&_0x4f0647['linkedid']===_0x4f0647[_0x6563('0xaf')]&&_[_0x6563('0x7f')](_0x4f0647['reason'])&&_0x4f0647['cause']==='16'&&_0x4f0647[_0x6563('0x13d')]==='6'&&_[_0x6563('0xef')](_0x9d364f[_0x6563('0x13e')])){if(_0x9d364f[_0x6563('0xa7')]){rpcDb['unlockContact'](_0x9d364f['idContact']);}if(_0x9d364f['activeContact']){rpcDb['disableContact'](_0x9d364f[_0x6563('0x102')]);}_0x4f0647['reason']='22';this[_0x6563('0xee')](_0x9d364f,_0x38ae7f,_0x4f0647);}else if(_0x9d364f&&_0x9d364f[_0x6563('0x13e')]){if(_0x4f0647['cause']==='16'&&this[_0x6563('0x15')][_0x4f0647['linkedid']]['dialAnswer']){logger['info'](_0x6563('0x13f'),_0x4f0647[_0x6563('0xa9')],_0x4f0647['cause'],'\x20Queue',_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647[_0x6563('0x13a')]);}else if(this['actions'][_0x4f0647[_0x6563('0xa9')]]['dialAnswer']){logger[_0x6563('0x55')](_0x6563('0x13b'),_0x4f0647[_0x6563('0xa9')],_0x4f0647['cause'],'\x20Queue',_0x38ae7f[_0x6563('0x4f')],_0x6563('0xb1'),_0x38ae7f[_0x6563('0x28')]);this[_0x6563('0x98')](_0x4f0647,_0x4f0647['linkedid'],_0x4f0647['cause']);}}};Preview['prototype'][_0x6563('0x1d')]=function(_0x90878e){if(this[_0x6563('0x15')][_0x90878e[_0x6563('0x140')]]&&_0x90878e[_0x6563('0x140')]!==_0x90878e['destuniqueid']){this[_0x6563('0x98')](_0x90878e,_0x90878e[_0x6563('0x140')],_0x90878e[_0x6563('0xe3')]);}};Preview['prototype'][_0x6563('0x1b')]=function(_0x5ab964){if(this[_0x6563('0x15')][_0x5ab964[_0x6563('0xa9')]]&&_0x5ab964['linkedid']!==_0x5ab964['uniqueid']&&!this[_0x6563('0x15')][_0x5ab964[_0x6563('0xa9')]][_0x6563('0x6d')]){if(_0x5ab964[_0x6563('0x13a')]==='1'){this[_0x6563('0x98')](_0x5ab964,_0x5ab964['linkedid'],_0x5ab964[_0x6563('0x13a')]);}}};Preview['prototype'][_0x6563('0x141')]=function(_0x546047,_0x32c097,_0xf809af){if(this['actions'][_0x546047]){if(_['isNil'](this[_0x6563('0x15')][_0x546047][_0x6563('0x142')])){this[_0x6563('0x15')][_0x546047][_0x6563('0x142')]={};}this[_0x6563('0x15')][_0x546047][_0x6563('0x142')][_0x32c097]=_0xf809af;}};Preview[_0x6563('0x5f')][_0x6563('0x1f')]=function(_0x35989a){try{if(!_[_0x6563('0x7f')](_0x35989a)){if(ut[_0x6563('0x143')](_[_0x6563('0x144')](_0x35989a[_0x6563('0x145')])[0x0])){this[_0x6563('0x141')](_0x35989a[_0x6563('0xaf')],_[_0x6563('0x144')](_0x35989a[_0x6563('0x145')])[0x0],_0x35989a[_0x6563('0x146')]);}}}catch(_0x370d72){logger['error'](_0x6563('0x147'),util['inspect'](_0x370d72,{'showHidden':![],'depth':null}));}};Preview[_0x6563('0x5f')]['syncAttendedTransfer']=function(_0x5b4722){if(_0x5b4722){if(this[_0x6563('0x15')][_0x5b4722[_0x6563('0x148')]]){this[_0x6563('0x15')][_0x5b4722[_0x6563('0x148')]]['transfer']=!![];}}};Preview[_0x6563('0x5f')][_0x6563('0x22')]=function(_0x451bc0){if(_0x451bc0){if(this[_0x6563('0x15')][_0x451bc0[_0x6563('0x149')]]){this[_0x6563('0x15')][_0x451bc0[_0x6563('0x149')]]['transfer']=!![];}}};module[_0x6563('0x14a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6f62c07..e28e42a 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 _0xb479=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x37f8b0,_0x2da2c3){var _0x3896c5=function(_0x2fe426){while(--_0x2fe426){_0x37f8b0['push'](_0x37f8b0['shift']());}};_0x3896c5(++_0x2da2c3);}(_0xb479,0x11b));var _0x9b47=function(_0x462528,_0x54bbf0){_0x462528=_0x462528-0x0;var _0x3791a5=_0xb479[_0x462528];return _0x3791a5;};'use strict';var util=require(_0x9b47('0x0'));var BPromise=require(_0x9b47('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x9b47('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x9b47('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9b47('0x4'));var voiceQueueRt=require(_0x9b47('0x5'));var agentReportPreview=require(_0x9b47('0x6'));var voiceQueueReport=require(_0x9b47('0x7'));function loggerCatch(_0x31d8be){return function(_0x534c35){logger[_0x9b47('0x8')](_0x31d8be,util[_0x9b47('0x9')](_0x534c35,{'showHidden':![],'depth':null}));};}function create(_0x47cc47){return BPromise[_0x9b47('0xa')]()[_0x9b47('0xb')](cmHopperHistory[_0x9b47('0xc')](_0x47cc47))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x559455){return BPromise[_0x9b47('0xa')]()['then'](agentReportPreview[_0x9b47('0xc')](_0x559455))[_0x9b47('0xd')](loggerCatch(_0x9b47('0xe')));}function moveContact(_0x1d4f41){return BPromise['resolve']()[_0x9b47('0xb')](cmHopper['moveContactManagedDialer'](_0x1d4f41,!![]))[_0x9b47('0xd')](loggerCatch(_0x9b47('0xf')));}exports[_0x9b47('0x10')]=function(_0x5d5f89){return BPromise[_0x9b47('0xa')]()['then'](cmHopperBlack[_0x9b47('0x10')](_0x5d5f89))['catch'](loggerCatch(_0x9b47('0x11')));};exports[_0x9b47('0x12')]=function(_0x73475a){return BPromise['resolve']()['then'](cmHopper[_0x9b47('0x12')](_0x73475a))[_0x9b47('0xd')](loggerCatch(_0x9b47('0x13')));};exports['createHistory']=function(_0x3bfd6f,_0x2207a9){create(_0x3bfd6f)['catch'](loggerCatch(_0x2207a9));moveContact(_0x3bfd6f)['catch'](loggerCatch(_0x2207a9));};exports['createAgentHistory']=function(_0x3629ba,_0x10680f){createAgent(_0x3629ba)[_0x9b47('0xd')](loggerCatch(_0x10680f));};exports[_0x9b47('0x14')]=function(_0x4731ab,_0x1b668a){create(_0x4731ab)[_0x9b47('0xd')](loggerCatch(_0x1b668a));};exports[_0x9b47('0x15')]=function(_0x10bcc2,_0x3ec348){moveContact(_0x10bcc2)[_0x9b47('0xd')](loggerCatch(_0x3ec348));};exports[_0x9b47('0x16')]=function(_0x103862,_0x2a0b4f,_0x12642c){if(_0x2a0b4f){_0x103862['UserId']=null;}if(_0x12642c){_0x103862['active']=![];}return BPromise['resolve']()[_0x9b47('0xb')](cmHopper['rescheduleContact'](_0x103862))['catch'](loggerCatch(_0x9b47('0x17')));};exports[_0x9b47('0x18')]=function(_0x2ccf1f){return BPromise[_0x9b47('0xa')]()[_0x9b47('0xb')](cmHopper[_0x9b47('0x18')](_0x2ccf1f))[_0x9b47('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x9b47('0x19')]=function(_0xdd461b){return BPromise['resolve']()['then'](cmHopper[_0x9b47('0x19')]({'UserId':null},_0xdd461b,0x1))[_0x9b47('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0x9b47('0x1a')]=function(_0x3f14c3){return BPromise[_0x9b47('0xa')]()[_0x9b47('0xb')](cmHopper['unlockContact']({'active':![]},_0x3f14c3,0x1))[_0x9b47('0xd')](loggerCatch(_0x9b47('0x1b')));};exports[_0x9b47('0x1c')]=function(_0x20f932){var _0x195058={};_0x195058[_0x9b47('0x1d')]=_0x20f932[_0x9b47('0x1d')];_0x195058['uniqueid']=_0x20f932['uniqueid'];_0x195058[_0x9b47('0x1e')]=_0x20f932[_0x9b47('0x1e')];_0x195058[_0x9b47('0x1f')]=_0x20f932[_0x9b47('0x1f')];_0x195058[_0x9b47('0x20')]=_0x20f932['queue'];_0x195058[_0x9b47('0x21')]=_0x20f932['answertime'];_0x195058['queuecallerleaveAt']=_0x20f932[_0x9b47('0x22')];_0x195058[_0x9b47('0x23')]=0x1;_0x195058[_0x9b47('0x24')]=_0x20f932[_0x9b47('0x25')];_0x195058[_0x9b47('0x26')]=_0x20f932[_0x9b47('0x27')];_0x195058[_0x9b47('0x28')]=_0x9b47('0x29');_0x195058[_0x9b47('0x2a')]='xcally-motion-preview';_0x195058[_0x9b47('0x2b')]=0x0;_0x195058[_0x9b47('0x2c')]=0x1;_0x195058['lastAssignedTo']=_0x20f932[_0x9b47('0x27')];_0x195058[_0x9b47('0x2d')]=_0x9b47('0x2e');return BPromise['resolve']()['then'](voiceQueueReport[_0x9b47('0x2f')](_0x195058))['catch'](loggerCatch(_0x9b47('0x30')));};exports[_0x9b47('0x31')]=function(_0x58bc35,_0xf42466){return BPromise['resolve']()[_0x9b47('0xb')](cmHopper['getContactRecallMe'](_0x58bc35,_0xf42466))[_0x9b47('0xd')](loggerCatch(_0x9b47('0x32')));};exports[_0x9b47('0x33')]=function(_0x2789f3){return BPromise[_0x9b47('0xa')]()[_0x9b47('0xb')](cmHopper[_0x9b47('0x16')](_0x2789f3,!![],!![]))[_0x9b47('0xd')](loggerCatch(_0x9b47('0x34')));}; \ No newline at end of file +var _0x5621=['../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','createHistory','catch','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x5621,0xd8));var _0x1562=function(_0x3f007a,_0x2995ce){_0x3f007a=_0x3f007a-0x0;var _0x2d2ad3=_0x5621[_0x3f007a];return _0x2d2ad3;};'use strict';var util=require(_0x1562('0x0'));var BPromise=require(_0x1562('0x1'));var logger=require(_0x1562('0x2'))(_0x1562('0x3'));var _=require(_0x1562('0x4'));var cmHopper=require(_0x1562('0x5'));var cmHopperFinal=require(_0x1562('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x1562('0x7'));var voiceQueueRt=require(_0x1562('0x8'));var agentReportPreview=require(_0x1562('0x9'));var voiceQueueReport=require(_0x1562('0xa'));function loggerCatch(_0x5b852a){return function(_0x3759d3){logger['error'](_0x5b852a,util[_0x1562('0xb')](_0x3759d3,{'showHidden':![],'depth':null}));};}function create(_0x36f14f){return BPromise[_0x1562('0xc')]()['then'](cmHopperHistory[_0x1562('0xd')](_0x36f14f))[_0x1562('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2264ef){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](agentReportPreview[_0x1562('0xd')](_0x2264ef))[_0x1562('0xe')](loggerCatch(_0x1562('0x10')));}function moveContact(_0x3087d6){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x11')](_0x3087d6,!![]))[_0x1562('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1562('0x12')]=function(_0x26ee9a){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopperBlack[_0x1562('0x12')](_0x26ee9a))[_0x1562('0xe')](loggerCatch(_0x1562('0x13')));};exports[_0x1562('0x14')]=function(_0xe9c2a3){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x14')](_0xe9c2a3))[_0x1562('0xe')](loggerCatch(_0x1562('0x15')));};exports[_0x1562('0xd')]=function(_0x5122b7,_0x520625){create(_0x5122b7)[_0x1562('0xe')](loggerCatch(_0x520625));moveContact(_0x5122b7)[_0x1562('0xe')](loggerCatch(_0x520625));};exports['createAgentHistory']=function(_0x1cff40,_0x53f8d4){createAgent(_0x1cff40)['catch'](loggerCatch(_0x53f8d4));};exports[_0x1562('0x16')]=function(_0x411ed3,_0x37273b){create(_0x411ed3)['catch'](loggerCatch(_0x37273b));};exports[_0x1562('0x17')]=function(_0x20aefb,_0x4fff5b){moveContact(_0x20aefb)[_0x1562('0xe')](loggerCatch(_0x4fff5b));};exports[_0x1562('0x18')]=function(_0x1740c1,_0x392b60,_0x2a72e6){if(_0x392b60){_0x1740c1[_0x1562('0x19')]=null;}if(_0x2a72e6){_0x1740c1['active']=![];}return BPromise['resolve']()[_0x1562('0xf')](cmHopper[_0x1562('0x18')](_0x1740c1))[_0x1562('0xe')](loggerCatch(_0x1562('0x1a')));};exports[_0x1562('0x1b')]=function(_0x519493){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x1b')](_0x519493))[_0x1562('0xe')](loggerCatch(_0x1562('0x1c')));};exports[_0x1562('0x1d')]=function(_0xf1e3c0){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x1d')]({'UserId':null},_0xf1e3c0,0x1))[_0x1562('0xe')](loggerCatch(_0x1562('0x1e')));};exports['disableContact']=function(_0x28f9d2){return BPromise['resolve']()[_0x1562('0xf')](cmHopper[_0x1562('0x1d')]({'active':![]},_0x28f9d2,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x1562('0x1f')]=function(_0x45ef18){var _0x411cfc={};_0x411cfc[_0x1562('0x20')]=_0x45ef18[_0x1562('0x20')];_0x411cfc[_0x1562('0x21')]=_0x45ef18[_0x1562('0x21')];_0x411cfc[_0x1562('0x22')]=_0x45ef18[_0x1562('0x22')];_0x411cfc[_0x1562('0x23')]=_0x45ef18[_0x1562('0x23')];_0x411cfc[_0x1562('0x24')]=_0x45ef18[_0x1562('0x24')];_0x411cfc[_0x1562('0x25')]=_0x45ef18[_0x1562('0x26')];_0x411cfc[_0x1562('0x27')]=_0x45ef18[_0x1562('0x26')];_0x411cfc[_0x1562('0x28')]=0x1;_0x411cfc['queuecallercompleteAt']=_0x45ef18[_0x1562('0x29')];_0x411cfc['connectedlinename']=_0x45ef18[_0x1562('0x2a')];_0x411cfc[_0x1562('0x2b')]=_0x1562('0x2c');_0x411cfc['exten']=_0x1562('0x2d');_0x411cfc[_0x1562('0x2e')]=0x0;_0x411cfc[_0x1562('0x2f')]=0x1;_0x411cfc[_0x1562('0x30')]=_0x45ef18['membername'];_0x411cfc[_0x1562('0x31')]=_0x1562('0x32');return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](voiceQueueReport[_0x1562('0x33')](_0x411cfc))[_0x1562('0xe')](loggerCatch(_0x1562('0x34')));};exports[_0x1562('0x35')]=function(_0x54132f,_0xe0db2d){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x35')](_0x54132f,_0xe0db2d))['catch'](loggerCatch(_0x1562('0x36')));};exports['rescheduleContactInQueue']=function(_0x11e74e){return BPromise[_0x1562('0xc')]()[_0x1562('0xf')](cmHopper[_0x1562('0x18')](_0x11e74e,!![],!![]))[_0x1562('0xe')](loggerCatch(_0x1562('0x37')));}; \ 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 88f63cd..22bdc0b 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 _0x140f=['string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','format','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','UserId','logCustomer','talktime','answertime','isFailure','Failure','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','channelAgent','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','inspect','logger','info','message','getCallerId'];(function(_0x3dddb9,_0x3b2f73){var _0x4df584=function(_0x1b839f){while(--_0x1b839f){_0x3dddb9['push'](_0x3dddb9['shift']());}};_0x4df584(++_0x3b2f73);}(_0x140f,0x1a0));var _0xf140=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x140f[_0x3a9661];return _0x5bb119;};'use strict';var util=require(_0xf140('0x0'));var _=require(_0xf140('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xf140('0x2')][_0xf140('0x3')]||_0xf140('0x4');function getSeconds(_0x34133e,_0x519595){var _0x49c9f0=moment(_0x34133e)[_0xf140('0x5')](0x0);var _0x5dcf55=moment(_0x519595)['milliseconds'](0x0);return _0x49c9f0[_0xf140('0x6')](_0x5dcf55,'seconds');}exports['loggerCatch']=function(_0x20682f){return function(_0x2f8016){logger[_0xf140('0x7')](_0x20682f,util[_0xf140('0x8')](_0x2f8016,{'showHidden':![],'depth':null}));};};exports[_0xf140('0x9')]=function(_0x11c80b,_0x389ea1){logger[_0xf140('0xa')](_0x11c80b,util[_0xf140('0x8')](_0x389ea1,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x369ed3,_0x57b02a){logger['error'](_0x369ed3,util['inspect'](_0x57b02a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x507494){return function(_0x3406fc){logger[_0xf140('0xa')](_0x507494,util['inspect'](_0x3406fc,{'showHidden':![],'depth':null}));};};exports[_0xf140('0xb')]=function(_0x238fa7,_0x3a3589,_0x219162){return{'message':_0x238fa7,'unlock':_0x3a3589,'active':_0x219162};};exports[_0xf140('0xc')]=function(_0x1642c0,_0x1a243f,_0x58bf8f){if(!_['isUndefined'](_0x58bf8f)&&_0xf140('0xd')===typeof _0x58bf8f&&!_[_0xf140('0xe')](_0x58bf8f)){if(!_[_0xf140('0xf')](_0x1a243f)&&_0xf140('0xd')===typeof _0x1a243f&&!_[_0xf140('0xe')](_0x1a243f)){return util['format'](_0xf140('0x10'),_0x1a243f,_0x58bf8f);}return util[_0xf140('0x11')](_0xf140('0x10'),_0x58bf8f,_0x58bf8f);}if(!_[_0xf140('0xf')](_0x1642c0)&&_0xf140('0xd')===typeof _0x1642c0&&!_[_0xf140('0xe')](_0x1642c0)){return _0x1642c0;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x2b6654){if(_[_0xf140('0x12')](_0x2b6654)){return![];}return _0x2b6654;};exports[_0xf140('0x13')]=function(_0x24ac71,_0x219d8c,_0x1f4925,_0x109739,_0x227f95,_0x71759){var _0x8e92c1={'XMD-QUEUE':_0x219d8c[_0xf140('0x14')]?_0x219d8c['Queue'][_0xf140('0x15')]:'','XMD-CALLERID':_0x109739,'XMD-CALLERID-PREVIEW':_0x71759?util[_0xf140('0x11')](_0xf140('0x10'),_0x71759[_0xf140('0x16')],_0x71759[_0xf140('0x17')]):_0x109739,'XMD-DIALID':_0x227f95,'XMD-CONTACTID':_0x219d8c['ContactId'],'XMD-CDRTYPE':_0xf140('0x18'),'CALLERID(all)':_0x109739,'XMD-VOICEQUEUEID':_0x219d8c[_0xf140('0x19')],'XMD-DIALCHANNEL':_0x1f4925,'XMD-DIALTIMEOUT':_0x24ac71[_0xf140('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xf140('0x11')]('\x22rtTxX%s%s\x22',_0x24ac71['dialQueueProject2']?'g':'',_['isEmpty'](_0x24ac71[_0xf140('0x1b')])?'':_0xf140('0x1c')),'XMD-DIALURL':_0x24ac71['dialPreviewUrl']||'','XMD-AGI':_0x24ac71[_0xf140('0x1d')]?util[_0xf140('0x11')](_0xf140('0x1e'),ipAgi,_0x24ac71[_0xf140('0x1d')]):_0xf140('0x1f'),'XMD-AGIAFTER':_0x24ac71['dialQueueProject2']?util[_0xf140('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x24ac71[_0xf140('0x20')]):_0xf140('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x71759?_0x71759['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x71759?_0x71759[_0xf140('0x21')]:'','XMD-DESTINATION':_0xf140('0x22'),'SIPADDHEADER':_0xf140('0x23')};if(!_[_0xf140('0xe')](_0x24ac71[_0xf140('0x1b')])){_0x8e92c1[util[_0xf140('0x11')]('%s',_0xf140('0x24'))]=_0x24ac71[_0xf140('0x1b')];_0x8e92c1[util[_0xf140('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x227f95;}if(_0x219d8c&&_0x219d8c['Contact']){for(var _0x5d864c in _0x219d8c[_0xf140('0x25')]){if(_0x219d8c[_0xf140('0x25')][_0xf140('0x26')](_0x5d864c)){if(!_['isNil'](_0x219d8c[_0xf140('0x25')][_0x5d864c])&&_0x5d864c!=='id'&&_0x5d864c!==_0xf140('0x27')&&_0x5d864c!==_0xf140('0x28')&&_0x5d864c!==_0xf140('0x29')){_0x8e92c1[util[_0xf140('0x11')]('%s%s',_0xf140('0x2a'),_[_0xf140('0x2b')](_0x5d864c))]=_0x219d8c[_0xf140('0x25')][_0x5d864c];}}}}return _0x8e92c1;};exports[_0xf140('0x2c')]=function(_0x1d9397){var _0x3466c0={};for(var _0x114659 in _0x1d9397){if(_0x1d9397[_0xf140('0x26')](_0x114659)){_0x3466c0[util[_0xf140('0x11')]('%s',_[_0xf140('0x2d')](_0x114659))]=_0x1d9397[_0x114659];}}return{'variables':_0x3466c0};};exports[_0xf140('0x2e')]=function(_0x39f63e,_0x46c0f5){if(!_['isNil'](_0x39f63e)){if(_0x39f63e[_0xf140('0x26')](_0xf140('0x2f'))){if(_0x39f63e['originated']>0x0){_0x39f63e[_0xf140('0x2f')]-=0x1;}else{logger[_0xf140('0x7')](_0xf140('0x30'),_0x46c0f5);}}}else{logger['error'](_0xf140('0x31'),_0x46c0f5);}};exports[_0xf140('0x32')]=function(_0x803a51){var _0x497215=moment()[_0xf140('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x803a51[_0xf140('0x33')]=0xd;_0x803a51[_0xf140('0x34')]=_0xf140('0x35');_0x803a51['starttime']=_0x497215;_0x803a51[_0xf140('0x36')]=_0x497215;_0x803a51[_0xf140('0x37')]=_0x497215;};exports[_0xf140('0x38')]=function(_0x4eb1a6,_0x5765bc,_0x1e3a34){var _0x1591ac=moment()[_0xf140('0x11')](_0xf140('0x39'));_0x4eb1a6[_0xf140('0x33')]=_0x5765bc;_0x4eb1a6[_0xf140('0x34')]=_0x1e3a34;_0x4eb1a6[_0xf140('0x36')]=_0x1591ac;_0x4eb1a6['ringtime']=getSeconds(_0x4eb1a6[_0xf140('0x36')],_0x4eb1a6[_0xf140('0x3a')]);};exports['logLookAgent']=function(_0x711fa1,_0x23615c,_0x4bb658){_0x711fa1['membername']=_0x23615c;_0x711fa1[_0xf140('0x3b')]=_0x4bb658;};exports[_0xf140('0x3c')]=function(_0x3b6c02,_0x3468a3,_0x33759e){var _0x383740=moment()[_0xf140('0x11')](_0xf140('0x39'));_0x3b6c02[_0xf140('0x33')]=_0x3468a3;_0x3b6c02[_0xf140('0x34')]=_0x33759e;_0x3b6c02[_0xf140('0x36')]=_0x3b6c02['responsetime']?_0x3b6c02[_0xf140('0x36')]:_0x383740;_0x3b6c02['endtime']=_0x3b6c02['endtime']?_0x3b6c02[_0xf140('0x37')]:_0x383740;_0x3b6c02['ringtime']=getSeconds(_0x3b6c02['responsetime']||0x0,_0x3b6c02[_0xf140('0x3a')]||0x0);_0x3b6c02[_0xf140('0x3d')]=_0x3b6c02[_0xf140('0x3e')]?getSeconds(_0x3b6c02[_0xf140('0x37')],_0x3b6c02['answertime']):0x0;};exports[_0xf140('0x3f')]=function(_0x3d984b){return _0x3d984b===_0xf140('0x40');};exports['variablesAction']=function(_0x23c57b,_0x1fdea7,_0x55463a,_0x37c409,_0x567dda){var _0x5f389a=_0x37c409?'RECALL':_0x23c57b['calleridname'];_0x5f389a=_0x567dda?_0xf140('0x41'):_0x5f389a;return{'actionid':_0x23c57b['uniqueid'],'action':_0xf140('0x42'),'channel':_0x23c57b['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x5f389a,_0x23c57b[_0xf140('0x17')]),'Exten':_0xf140('0x22'),'Context':_0xf140('0x43'),'Priority':'1','variable':_0x55463a,'timeout':(_0x1fdea7[_0xf140('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x23c57b[_0xf140('0x45')]};};exports[_0xf140('0x46')]=function(_0xa7dea){return _0xa7dea['countbusyretry']+_0xa7dea['countcongestionretry']+_0xa7dea[_0xf140('0x47')]+_0xa7dea[_0xf140('0x48')]+_0xa7dea[_0xf140('0x49')];};exports[_0xf140('0x4a')]=function(_0x1232f9){var _0x55ab5b=_[_0xf140('0x4b')](_0x1232f9);_0x55ab5b['state']=0xf;_0x55ab5b[_0xf140('0x34')]=_0xf140('0x4c');return _0x55ab5b;};exports[_0xf140('0x4d')]=function(_0x535d0f,_0x566ab9,_0x5cce5c){var _0x273365={};_0x273365[_0x566ab9]=_0x535d0f[_0x566ab9];_0x273365[_0xf140('0x4e')]=![];_0x273365[_0xf140('0x4f')]=moment()[_0xf140('0x50')](_0x5cce5c,_0xf140('0x51'))[_0xf140('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x273365['ContactId']=_0x535d0f[_0xf140('0x52')];_0x273365[_0xf140('0x53')]=_0x535d0f['ListId'];_0x273365[_0xf140('0x19')]=_0x535d0f[_0xf140('0x19')]||undefined;return _0x273365;};exports[_0xf140('0x54')]=function(_0x5c4430,_0x157bee){if(!_['isNil'](_0x5c4430)){if(_0x5c4430[_0xf140('0x55')]>0x0){_0x5c4430['pTalking']-=0x1;}else{logger[_0xf140('0x7')](_0x157bee,_0xf140('0x56'));}}else{logger[_0xf140('0x7')](_0x157bee,_0xf140('0x57'));}};exports[_0xf140('0x58')]=function(_0x4fb5b9){if(_0x4fb5b9<=0x0){return!![];}return![];};exports[_0xf140('0x59')]=function(_0x1130cb,_0x2667b9,_0x462cde){_0x1130cb['lastevent']=_0x2667b9;_0x1130cb[_0xf140('0x15')]=_0x1130cb[_0xf140('0x5a')];_0x1130cb[_0xf140('0x5b')]=_0x1130cb[_0xf140('0x5c')];_0x1130cb['motionChannel']='voice';if(_0x462cde){_0x1130cb['mandatoryDisposition']=_0x462cde['mandatoryDisposition'];}return _0x1130cb;};exports[_0xf140('0x5d')]=function(_0x204f1a){var _0x14b4c8={};_0x14b4c8[_0xf140('0x5a')]=_0x204f1a[_0xf140('0x5a')];_0x14b4c8[_0xf140('0x5b')]=_0x204f1a[_0xf140('0x5c')];_0x14b4c8[_0xf140('0x45')]=_0x204f1a[_0xf140('0x45')];return _0x14b4c8;};exports[_0xf140('0x5e')]=function(_0x3c0775){var _0x72fb98=[];for(var _0xa4c57e in _0x3c0775){if(_0x3c0775['hasOwnProperty'](_0xa4c57e)){if(!_[_0xf140('0x12')](_0x3c0775[_0xa4c57e])&&_0x3c0775[_0xa4c57e][_0xf140('0x33')]===_0xf140('0x5f')&&_0x3c0775[_0xa4c57e][_0xf140('0x60')]==='reachable'){_0x72fb98[_0xf140('0x61')](_0x3c0775[_0xa4c57e]['id']);}}}return _0x72fb98;};exports[_0xf140('0x62')]=function(_0xf1fb44){var _0x59657b=moment()[_0xf140('0x5')](0x0);var _0x2bdd2c=moment(_0xf1fb44)[_0xf140('0x5')](0x0);return _0x59657b[_0xf140('0x6')](_0x2bdd2c,'seconds');};exports[_0xf140('0x63')]=function(_0x151bf1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x151bf1['ContactId'],'ListId':_0x151bf1[_0xf140('0x53')],'VoiceQueueId':_0x151bf1[_0xf140('0x19')]||undefined,'CampaignId':_0x151bf1[_0xf140('0x64')]||undefined};};exports[_0xf140('0x65')]=function(_0x18d1f4){if(_0x18d1f4==='uniqueid'||_0x18d1f4===_0xf140('0x66')||_0x18d1f4===_0xf140('0x5a')||_0x18d1f4===_0xf140('0x67')||_0x18d1f4===_0xf140('0x68')||_0x18d1f4===_0xf140('0x69')||_0x18d1f4===_0xf140('0x6a')||_0x18d1f4===_0xf140('0x5c')||_0x18d1f4===_0xf140('0x16')||_0x18d1f4===_0xf140('0x4e')||_0x18d1f4===_0xf140('0x17')||_0x18d1f4===_0xf140('0x4f')||_0x18d1f4===_0xf140('0x6b')||_0x18d1f4===_0xf140('0x6c')||_0x18d1f4===_0xf140('0x47')||_0x18d1f4===_0xf140('0x6d')||_0x18d1f4===_0xf140('0x6e')||_0x18d1f4===_0xf140('0x6f')||_0x18d1f4===_0xf140('0x70')||_0x18d1f4===_0xf140('0x71')||_0x18d1f4===_0xf140('0x52')||_0x18d1f4===_0xf140('0x53')||_0x18d1f4===_0xf140('0x3b')||_0x18d1f4==='VoiceQueueId'||_0x18d1f4===_0xf140('0x72')||_0x18d1f4===_0xf140('0x73')||_0x18d1f4===_0xf140('0x74')||_0x18d1f4===_0xf140('0x75')||_0x18d1f4===_0xf140('0x76')||_0x18d1f4===_0xf140('0x77')||_0x18d1f4==='xmd-dialtimeout'||_0x18d1f4===_0xf140('0x78')||_0x18d1f4===_0xf140('0x79')||_0x18d1f4===_0xf140('0x7a')||_0x18d1f4==='xmd-contactid'||_0x18d1f4===_0xf140('0x7b')||_0x18d1f4===_0xf140('0x7c')||_0x18d1f4===_0xf140('0x7d')||_0x18d1f4===_0xf140('0x7e')||_0x18d1f4==='rtpaudioqos'||_0x18d1f4===_0xf140('0x7f')||_0x18d1f4===_0xf140('0x80')||_0x18d1f4===_0xf140('0x81')||_0x18d1f4===_0xf140('0x82')||_0x18d1f4==='rtpaudioqoslossbridged'||_0x18d1f4===_0xf140('0x83')||_0x18d1f4===_0xf140('0x84')||_0x18d1f4==='rtpaudioqos'||_0x18d1f4==='rtpaudioqosbridged'||_0x18d1f4==='rtpaudioqosjitter'||_0x18d1f4===_0xf140('0x81')||_0x18d1f4===_0xf140('0x82')||_0x18d1f4===_0xf140('0x85')||_0x18d1f4===_0xf140('0x83')||_0x18d1f4===_0xf140('0x84')||_0x18d1f4===_0xf140('0x86')||_0x18d1f4===_0xf140('0x87')||_0x18d1f4===_0xf140('0x33')||_0x18d1f4==='statedesc'){return![];}return!![];};exports[_0xf140('0x88')]=function(_0x315d59,_0x368818){var _0x4bf66b,_0x592f66,_0x35241e;if(_0x368818<=0x0){_0x368818=0x1;}_0x4bf66b=new RegExp(_0xf140('0x89')+_0x368818+'}$');_0x592f66=Math['pow'](0xa,_0x368818-0x1);_0x35241e=Math[_0xf140('0x8a')](0xa,_0x368818)-0x1;return util['format']('%s',_[_0xf140('0x8b')](_0x315d59,_0x4bf66b,_[_0xf140('0x8c')](_0x592f66,_0x35241e)));};exports['extractCalleridName']=function(_0xf1fb9a){var _0x8236a2=_0xf1fb9a[_0xf140('0x8d')](/"(.*?)"/);return _0x8236a2?_0x8236a2[0x1]:_0xf1fb9a;};exports[_0xf140('0x8e')]=function(_0x5d2453){var _0x37123b=_0x5d2453[_0xf140('0x8d')](/<(.*?)>/);return _0x37123b?_0x37123b[0x1]:_0x5d2453;}; \ No newline at end of file +var _0x1096=['error','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','getDiff','CampaignId','filterKey','type','campaigntype','dialAnswer','callbackuniqueid','callbackat','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqoslossbridged','bridgepeer','statedesc','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1096,0x78));var _0x6109=function(_0x55dcf1,_0x309b92){_0x55dcf1=_0x55dcf1-0x0;var _0x1d58fd=_0x1096[_0x55dcf1];return _0x1d58fd;};'use strict';var util=require(_0x6109('0x0'));var _=require(_0x6109('0x1'));var moment=require(_0x6109('0x2'));var logger=require('../../../../config/logger')(_0x6109('0x3'));var ipAgi=process['env'][_0x6109('0x4')]||_0x6109('0x5');function getSeconds(_0x38b52c,_0x50d294){var _0x522d1c=moment(_0x38b52c)[_0x6109('0x6')](0x0);var _0xcdf3fa=moment(_0x50d294)[_0x6109('0x6')](0x0);return _0x522d1c[_0x6109('0x7')](_0xcdf3fa,_0x6109('0x8'));}exports[_0x6109('0x9')]=function(_0xbaba1b){return function(_0x28226f){logger['error'](_0xbaba1b,util[_0x6109('0xa')](_0x28226f,{'showHidden':![],'depth':null}));};};exports[_0x6109('0xb')]=function(_0x40e41f,_0x480092){logger[_0x6109('0xc')](_0x40e41f,util[_0x6109('0xa')](_0x480092,{'showHidden':![],'depth':null}));};exports[_0x6109('0xd')]=function(_0x161d08,_0x3df246){logger[_0x6109('0xe')](_0x161d08,util['inspect'](_0x3df246,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2fe2a0){return function(_0x141da4){logger['info'](_0x2fe2a0,util[_0x6109('0xa')](_0x141da4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5df521,_0x717356,_0x5983d6){return{'message':_0x5df521,'unlock':_0x717356,'active':_0x5983d6};};exports[_0x6109('0xf')]=function(_0x3949f6,_0x44a49e,_0x56eb53){if(!_['isUndefined'](_0x56eb53)&&_0x6109('0x10')===typeof _0x56eb53&&!_[_0x6109('0x11')](_0x56eb53)){if(!_[_0x6109('0x12')](_0x44a49e)&&_0x6109('0x10')===typeof _0x44a49e&&!_[_0x6109('0x11')](_0x44a49e)){return util[_0x6109('0x13')](_0x6109('0x14'),_0x44a49e,_0x56eb53);}return util['format'](_0x6109('0x14'),_0x56eb53,_0x56eb53);}if(!_['isUndefined'](_0x3949f6)&&_0x6109('0x10')===typeof _0x3949f6&&!_[_0x6109('0x11')](_0x3949f6)){return _0x3949f6;}return _0x6109('0x15');};exports[_0x6109('0x16')]=function(_0x30c14e){if(_[_0x6109('0x17')](_0x30c14e)){return![];}return _0x30c14e;};exports[_0x6109('0x18')]=function(_0x55fc65,_0xb40f49,_0x3fea66,_0x1f57ef,_0x1400b9,_0x39395a){var _0x55b2c0={'XMD-QUEUE':_0xb40f49[_0x6109('0x19')]?_0xb40f49[_0x6109('0x19')][_0x6109('0x1a')]:'','XMD-CALLERID':_0x1f57ef,'XMD-CALLERID-PREVIEW':_0x39395a?util['format']('\x22%s\x22\x20<%s>',_0x39395a[_0x6109('0x1b')],_0x39395a[_0x6109('0x1c')]):_0x1f57ef,'XMD-DIALID':_0x1400b9,'XMD-CONTACTID':_0xb40f49[_0x6109('0x1d')],'XMD-CDRTYPE':_0x6109('0x1e'),'CALLERID(all)':_0x1f57ef,'XMD-VOICEQUEUEID':_0xb40f49['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3fea66,'XMD-DIALTIMEOUT':_0x55fc65[_0x6109('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x6109('0x13')]('\x22rtTxX%s%s\x22',_0x55fc65[_0x6109('0x20')]?'g':'',_[_0x6109('0x11')](_0x55fc65[_0x6109('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x55fc65[_0x6109('0x22')]||'','XMD-AGI':_0x55fc65['dialQueueProject']?util[_0x6109('0x13')](_0x6109('0x23'),ipAgi,_0x55fc65[_0x6109('0x24')]):'NONE','XMD-AGIAFTER':_0x55fc65['dialQueueProject2']?util[_0x6109('0x13')](_0x6109('0x23'),ipAgi,_0x55fc65['dialQueueProject2']):_0x6109('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x39395a?_0x39395a['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x39395a?_0x39395a[_0x6109('0x26')]:'','XMD-DESTINATION':_0x6109('0x27'),'SIPADDHEADER':_0x6109('0x28')};if(!_['isEmpty'](_0x55fc65[_0x6109('0x21')])){_0x55b2c0[util[_0x6109('0x13')]('%s',_0x6109('0x29'))]=_0x55fc65[_0x6109('0x21')];_0x55b2c0[util[_0x6109('0x13')]('%s',_0x6109('0x2a'))]=_0x1400b9;}if(_0xb40f49&&_0xb40f49[_0x6109('0x2b')]){for(var _0x450b75 in _0xb40f49[_0x6109('0x2b')]){if(_0xb40f49[_0x6109('0x2b')][_0x6109('0x2c')](_0x450b75)){if(!_[_0x6109('0x17')](_0xb40f49['Contact'][_0x450b75])&&_0x450b75!=='id'&&_0x450b75!==_0x6109('0x2d')&&_0x450b75!=='createdAt'&&_0x450b75!==_0x6109('0x2e')){_0x55b2c0[util[_0x6109('0x13')](_0x6109('0x2f'),_0x6109('0x30'),_[_0x6109('0x31')](_0x450b75))]=_0xb40f49[_0x6109('0x2b')][_0x450b75];}}}}return _0x55b2c0;};exports['toLowerVariables']=function(_0x35a49c){var _0x3f077c={};for(var _0x3d1925 in _0x35a49c){if(_0x35a49c['hasOwnProperty'](_0x3d1925)){_0x3f077c[util[_0x6109('0x13')]('%s',_['toLower'](_0x3d1925))]=_0x35a49c[_0x3d1925];}}return{'variables':_0x3f077c};};exports['updateOriginated']=function(_0x48b0da,_0x16aa8d){if(!_[_0x6109('0x17')](_0x48b0da)){if(_0x48b0da[_0x6109('0x2c')](_0x6109('0x32'))){if(_0x48b0da[_0x6109('0x32')]>0x0){_0x48b0da['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x16aa8d);}}}else{logger['error'](_0x6109('0x33'),_0x16aa8d);}};exports[_0x6109('0x34')]=function(_0x4dd9c5){var _0x42d73d=moment()[_0x6109('0x13')](_0x6109('0x35'));_0x4dd9c5[_0x6109('0x36')]=0xd;_0x4dd9c5['statedesc']='Blacklist';_0x4dd9c5[_0x6109('0x37')]=_0x42d73d;_0x4dd9c5[_0x6109('0x38')]=_0x42d73d;_0x4dd9c5[_0x6109('0x39')]=_0x42d73d;};exports[_0x6109('0x3a')]=function(_0x4bb88b,_0x2850b0,_0x544a23){var _0x1ed1c0=moment()[_0x6109('0x13')](_0x6109('0x35'));_0x4bb88b[_0x6109('0x36')]=_0x2850b0;_0x4bb88b['statedesc']=_0x544a23;_0x4bb88b[_0x6109('0x38')]=_0x1ed1c0;_0x4bb88b[_0x6109('0x3b')]=getSeconds(_0x4bb88b[_0x6109('0x38')],_0x4bb88b[_0x6109('0x37')]);};exports[_0x6109('0x3c')]=function(_0xbca1f6,_0x5a6f09,_0x440812){_0xbca1f6[_0x6109('0x3d')]=_0x5a6f09;_0xbca1f6[_0x6109('0x3e')]=_0x440812;};exports[_0x6109('0x3f')]=function(_0x34d5f4,_0x57c2a8,_0x3fdb40){var _0x39c4a8=moment()['format'](_0x6109('0x35'));_0x34d5f4[_0x6109('0x36')]=_0x57c2a8;_0x34d5f4['statedesc']=_0x3fdb40;_0x34d5f4['responsetime']=_0x34d5f4[_0x6109('0x38')]?_0x34d5f4[_0x6109('0x38')]:_0x39c4a8;_0x34d5f4['endtime']=_0x34d5f4[_0x6109('0x39')]?_0x34d5f4['endtime']:_0x39c4a8;_0x34d5f4[_0x6109('0x3b')]=getSeconds(_0x34d5f4['responsetime']||0x0,_0x34d5f4[_0x6109('0x37')]||0x0);_0x34d5f4['talktime']=_0x34d5f4[_0x6109('0x40')]?getSeconds(_0x34d5f4[_0x6109('0x39')],_0x34d5f4[_0x6109('0x40')]):0x0;};exports['isFailure']=function(_0x31f955){return _0x31f955===_0x6109('0x41');};exports[_0x6109('0x42')]=function(_0xa33bf4,_0x1bc3ad,_0x59b58a,_0x1be4e8,_0x3ea96d){var _0x19ae57=_0x1be4e8?_0x6109('0x43'):_0xa33bf4[_0x6109('0x1b')];_0x19ae57=_0x3ea96d?_0x6109('0x44'):_0x19ae57;return{'actionid':_0xa33bf4[_0x6109('0x45')],'action':_0x6109('0x46'),'channel':_0xa33bf4[_0x6109('0x47')],'callerid':util[_0x6109('0x13')]('\x22%s\x22\x20<%s>',_0x19ae57,_0xa33bf4[_0x6109('0x1c')]),'Exten':_0x6109('0x27'),'Context':'from-sip','Priority':'1','variable':_0x59b58a,'timeout':(_0x1bc3ad[_0x6109('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0xa33bf4['uniqueid']};};exports['totalGlobal']=function(_0x504e6c){return _0x504e6c['countbusyretry']+_0x504e6c[_0x6109('0x49')]+_0x504e6c[_0x6109('0x4a')]+_0x504e6c[_0x6109('0x4b')]+_0x504e6c[_0x6109('0x4c')];};exports[_0x6109('0x4d')]=function(_0x414ff2){var _0x1a5770=_['clone'](_0x414ff2);_0x1a5770['state']=0xf;_0x1a5770['statedesc']=_0x6109('0x4e');return _0x1a5770;};exports['scheduledAt']=function(_0x5c79f5,_0x400f74,_0x3cd378){var _0x27a671={};_0x27a671[_0x400f74]=_0x5c79f5[_0x400f74];_0x27a671[_0x6109('0x4f')]=![];_0x27a671[_0x6109('0x50')]=moment()[_0x6109('0x51')](_0x3cd378,'minutes')[_0x6109('0x13')](_0x6109('0x35'));_0x27a671['ContactId']=_0x5c79f5[_0x6109('0x1d')];_0x27a671[_0x6109('0x52')]=_0x5c79f5[_0x6109('0x52')];_0x27a671[_0x6109('0x53')]=_0x5c79f5[_0x6109('0x53')]||undefined;return _0x27a671;};exports[_0x6109('0x54')]=function(_0x4945ca,_0x44eafc){if(!_[_0x6109('0x17')](_0x4945ca)){if(_0x4945ca[_0x6109('0x55')]>0x0){_0x4945ca[_0x6109('0x55')]-=0x1;}else{logger[_0x6109('0xe')](_0x44eafc,_0x6109('0x56'));}}else{logger[_0x6109('0xe')](_0x44eafc,_0x6109('0x57'));}};exports[_0x6109('0x58')]=function(_0x293a10){if(_0x293a10<=0x0){return!![];}return![];};exports[_0x6109('0x59')]=function(_0x4d5437,_0x3bc6f1,_0x55974b){_0x4d5437['lastevent']=_0x3bc6f1;_0x4d5437[_0x6109('0x1a')]=_0x4d5437[_0x6109('0x5a')];_0x4d5437[_0x6109('0x5b')]=_0x4d5437['channelAgent'];_0x4d5437['motionChannel']=_0x6109('0x5c');if(_0x55974b){_0x4d5437[_0x6109('0x5d')]=_0x55974b[_0x6109('0x5d')];}return _0x4d5437;};exports[_0x6109('0x5e')]=function(_0x5f2c77){var _0x53370d={};_0x53370d[_0x6109('0x5a')]=_0x5f2c77[_0x6109('0x5a')];_0x53370d[_0x6109('0x5b')]=_0x5f2c77[_0x6109('0x47')];_0x53370d[_0x6109('0x45')]=_0x5f2c77['uniqueid'];return _0x53370d;};exports[_0x6109('0x5f')]=function(_0x276658){var _0x4e855e=[];for(var _0x3e0d36 in _0x276658){if(_0x276658[_0x6109('0x2c')](_0x3e0d36)){if(!_[_0x6109('0x17')](_0x276658[_0x3e0d36])&&_0x276658[_0x3e0d36][_0x6109('0x36')]==='not_inuse'&&_0x276658[_0x3e0d36][_0x6109('0x60')]===_0x6109('0x61')){_0x4e855e[_0x6109('0x62')](_0x276658[_0x3e0d36]['id']);}}}return _0x4e855e;};exports[_0x6109('0x63')]=function(_0xfe9f5c){var _0x26180d=moment()['milliseconds'](0x0);var _0x105831=moment(_0xfe9f5c)['milliseconds'](0x0);return _0x26180d[_0x6109('0x7')](_0x105831,_0x6109('0x8'));};exports['createBody']=function(_0x4a5802){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a5802[_0x6109('0x1d')],'ListId':_0x4a5802['ListId'],'VoiceQueueId':_0x4a5802[_0x6109('0x53')]||undefined,'CampaignId':_0x4a5802[_0x6109('0x64')]||undefined};};exports[_0x6109('0x65')]=function(_0x5f2b74){if(_0x5f2b74==='uniqueid'||_0x5f2b74==='idContact'||_0x5f2b74===_0x6109('0x5a')||_0x5f2b74===_0x6109('0x66')||_0x5f2b74===_0x6109('0x67')||_0x5f2b74===_0x6109('0x68')||_0x5f2b74==='membername'||_0x5f2b74===_0x6109('0x47')||_0x5f2b74===_0x6109('0x1b')||_0x5f2b74===_0x6109('0x4f')||_0x5f2b74===_0x6109('0x1c')||_0x5f2b74===_0x6109('0x50')||_0x5f2b74==='countbusyretry'||_0x5f2b74===_0x6109('0x49')||_0x5f2b74==='countnoanswerretry'||_0x5f2b74==='countglobal'||_0x5f2b74==='callback'||_0x5f2b74===_0x6109('0x69')||_0x5f2b74===_0x6109('0x6a')||_0x5f2b74==='recallme'||_0x5f2b74===_0x6109('0x1d')||_0x5f2b74===_0x6109('0x52')||_0x5f2b74===_0x6109('0x3e')||_0x5f2b74==='VoiceQueueId'||_0x5f2b74==='sipcallid'||_0x5f2b74==='xmd-voicequeueid'||_0x5f2b74==='xmd-queue'||_0x5f2b74===_0x6109('0x6b')||_0x5f2b74===_0x6109('0x6c')||_0x5f2b74===_0x6109('0x6d')||_0x5f2b74===_0x6109('0x6e')||_0x5f2b74==='xmd-dialoptions'||_0x5f2b74==='xmd-dialid'||_0x5f2b74===_0x6109('0x6f')||_0x5f2b74===_0x6109('0x70')||_0x5f2b74===_0x6109('0x71')||_0x5f2b74===_0x6109('0x72')||_0x5f2b74==='xmd-agiafter'||_0x5f2b74===_0x6109('0x73')||_0x5f2b74==='rtpaudioqos'||_0x5f2b74===_0x6109('0x74')||_0x5f2b74===_0x6109('0x75')||_0x5f2b74===_0x6109('0x76')||_0x5f2b74===_0x6109('0x77')||_0x5f2b74==='rtpaudioqoslossbridged'||_0x5f2b74===_0x6109('0x78')||_0x5f2b74===_0x6109('0x79')||_0x5f2b74===_0x6109('0x7a')||_0x5f2b74===_0x6109('0x74')||_0x5f2b74===_0x6109('0x75')||_0x5f2b74===_0x6109('0x76')||_0x5f2b74===_0x6109('0x77')||_0x5f2b74===_0x6109('0x7b')||_0x5f2b74===_0x6109('0x78')||_0x5f2b74===_0x6109('0x79')||_0x5f2b74===_0x6109('0x7c')||_0x5f2b74==='bridgepvtcallid'||_0x5f2b74===_0x6109('0x36')||_0x5f2b74===_0x6109('0x7d')){return![];}return!![];};exports[_0x6109('0x7e')]=function(_0x2b7945,_0x380e26){var _0x513694,_0x16d02a,_0x48571d;if(_0x380e26<=0x0){_0x380e26=0x1;}_0x513694=new RegExp(_0x6109('0x7f')+_0x380e26+'}$');_0x16d02a=Math[_0x6109('0x80')](0xa,_0x380e26-0x1);_0x48571d=Math[_0x6109('0x80')](0xa,_0x380e26)-0x1;return util[_0x6109('0x13')]('%s',_[_0x6109('0x81')](_0x2b7945,_0x513694,_[_0x6109('0x82')](_0x16d02a,_0x48571d)));};exports[_0x6109('0x83')]=function(_0x3e9a34){var _0x19fed=_0x3e9a34[_0x6109('0x84')](/"(.*?)"/);return _0x19fed?_0x19fed[0x1]:_0x3e9a34;};exports[_0x6109('0x85')]=function(_0x55753){var _0x283b89=_0x55753[_0x6109('0x84')](/<(.*?)>/);return _0x283b89?_0x283b89[0x1]:_0x55753;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8446509..56a2d8f 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 _0x4149=['boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number'];(function(_0x441cb6,_0x4709fb){var _0x4e1401=function(_0x53b3cf){while(--_0x53b3cf){_0x441cb6['push'](_0x441cb6['shift']());}};_0x4e1401(++_0x4709fb);}(_0x4149,0xa6));var _0x9414=function(_0xb63b40,_0x57579c){_0xb63b40=_0xb63b40-0x0;var _0x2e82e0=_0x4149[_0xb63b40];return _0x2e82e0;};'use strict';exports['queueadd']={'queue':{'type':_0x9414('0x0'),'required':!![]},'interface':{'type':_0x9414('0x0'),'required':!![]},'membername':{'type':_0x9414('0x0'),'required':!![]},'penalty':{'type':_0x9414('0x1'),'required':![]},'paused':{'type':_0x9414('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x9414('0x0'),'required':!![]},'interface':{'type':_0x9414('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x9414('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x9414('0x0'),'required':![]}};exports[_0x9414('0x3')]={'module':{'type':_0x9414('0x0'),'required':![]}};exports[_0x9414('0x4')]={'uniqueid':{'type':_0x9414('0x0'),'required':!![]}};exports[_0x9414('0x5')]={'uniqueid':{'type':_0x9414('0x0'),'required':!![]},'filename':{'type':_0x9414('0x0')},'format':{'type':_0x9414('0x0')},'mixmonitorid':{'type':_0x9414('0x0')}};exports[_0x9414('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x9414('0x7')]={'uniqueid':{'type':_0x9414('0x0'),'required':!![]},'exten':{'type':_0x9414('0x0'),'required':!![]},'context':{'type':_0x9414('0x0')}}; \ No newline at end of file +var _0x26f8=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel'];(function(_0x194780,_0x4b5849){var _0x392016=function(_0x3a8745){while(--_0x3a8745){_0x194780['push'](_0x194780['shift']());}};_0x392016(++_0x4b5849);}(_0x26f8,0x198));var _0x826f=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0x26f8[_0x5ece84];return _0x2a12c4;};'use strict';exports[_0x826f('0x0')]={'queue':{'type':_0x826f('0x1'),'required':!![]},'interface':{'type':_0x826f('0x1'),'required':!![]},'membername':{'type':_0x826f('0x1'),'required':!![]},'penalty':{'type':_0x826f('0x2'),'required':![]},'paused':{'type':_0x826f('0x3'),'required':![]}};exports[_0x826f('0x4')]={'queue':{'type':_0x826f('0x1'),'required':!![]},'interface':{'type':_0x826f('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x826f('0x3')},'reason':{'type':_0x826f('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x826f('0x1'),'required':![]}};exports[_0x826f('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x826f('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x826f('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x826f('0x1')}};exports[_0x826f('0x7')]={'uniqueid':{'type':_0x826f('0x1'),'required':!![]}};exports[_0x826f('0x8')]={'uniqueid':{'type':_0x826f('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x826f('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d231b1a..6de8620 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 _0xdd17=['initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','total','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','interface','isUndefined','initVoiceQueues','voiceQueues','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts'];(function(_0x5b5498,_0x2f6fb7){var _0x41e953=function(_0x2b8bdc){while(--_0x2b8bdc){_0x5b5498['push'](_0x5b5498['shift']());}};_0x41e953(++_0x2f6fb7);}(_0xdd17,0x15d));var _0x7dd1=function(_0x2fd6ce,_0x5d47a8){_0x2fd6ce=_0x2fd6ce-0x0;var _0x50c911=_0xdd17[_0x2fd6ce];return _0x50c911;};'use strict';var BPromise=require('bluebird');var util=require(_0x7dd1('0x0'));var _=require(_0x7dd1('0x1'));var moment=require(_0x7dd1('0x2'));var Agent=require(_0x7dd1('0x3'));var Telephone=require(_0x7dd1('0x4'));var Trunk=require(_0x7dd1('0x5'));var VoiceQueue=require(_0x7dd1('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x7dd1('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x7dd1('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x7dd1('0x9'));var SugarcrmAccount=require(_0x7dd1('0xa'));var ZohoAccount=require(_0x7dd1('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x7dd1('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x7dd1('0xd'));var FreshsalesAccount=require(_0x7dd1('0xe'));var FaxAccount=require(_0x7dd1('0xf'));var Realtime=function(){this[_0x7dd1('0x10')]={};this[_0x7dd1('0x11')]={};this[_0x7dd1('0x12')]={};this['voiceQueues']={};this[_0x7dd1('0x13')]={};this[_0x7dd1('0x14')]={};this[_0x7dd1('0x15')]={};this[_0x7dd1('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x7dd1('0x17')]={};this[_0x7dd1('0x18')]={};this[_0x7dd1('0x19')]={};this[_0x7dd1('0x1a')]={};this[_0x7dd1('0x1b')]={};this[_0x7dd1('0x1c')]={};this['salesforceAccounts']={};this[_0x7dd1('0x1d')]={};this[_0x7dd1('0x1e')]={};this[_0x7dd1('0x1f')]={};this[_0x7dd1('0x20')]={};this[_0x7dd1('0x21')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0x7dd1('0x22')]={};this[_0x7dd1('0x23')]={};};function freeIsNotKey(_0x1f03b7,_0x2aa35,_0x189b22){var _0x3fe638=_['mapKeys'](_0x1f03b7,function(_0x516548,_0x3e7778){return _0x516548[_0x189b22];});for(var _0x1e3515 in _0x2aa35){if(_0x2aa35[_0x7dd1('0x24')](_0x1e3515)){if(!_0x3fe638[_0x1e3515]){delete _0x2aa35[_0x1e3515];}}}}function freeIsNotKeySip(_0x3af2f8,_0x3ed28d){var _0x412be5=_[_0x7dd1('0x25')](_0x3af2f8,function(_0x21686c,_0x144469){return util[_0x7dd1('0x26')](_0x7dd1('0x27'),_0x21686c[_0x7dd1('0x28')]);});for(var _0x1fbb85 in _0x3ed28d){if(_0x3ed28d['hasOwnProperty'](_0x1fbb85)){if(!_0x412be5[_0x1fbb85]){delete _0x3ed28d[_0x1fbb85];}}}}function freeIsNotKeyAgent(_0x1702ad,_0x3f1b94){var _0x348682=_[_0x7dd1('0x25')](_0x1702ad,function(_0x37ad69,_0x5d55ea){var _0x29d7d5=_['isNil'](_0x37ad69['interface'])?util[_0x7dd1('0x26')](_0x7dd1('0x27'),_0x37ad69[_0x7dd1('0x28')]):_0x37ad69['interface'];return _0x29d7d5;});for(var _0x18e3d2 in _0x3f1b94){if(_0x3f1b94['hasOwnProperty'](_0x18e3d2)){if(!_0x348682[_0x18e3d2]){delete _0x3f1b94[_0x18e3d2];}}}}function clearVoiceCallReports(_0x267c27){_0x267c27[_0x7dd1('0x29')]=0x0;_0x267c27[_0x7dd1('0x2a')]=0x0;_0x267c27['sumHoldTime']=0x0;_0x267c27[_0x7dd1('0x2b')]=0x0;_0x267c27['sumBillable']=0x0;}function clearCampaigns(_0x54a06e){if(!_[_0x7dd1('0x2c')](_0x54a06e)){for(var _0x3c2acb in _0x54a06e){if(_0x54a06e[_0x7dd1('0x24')](_0x3c2acb)){_0x54a06e[_0x3c2acb][_0x7dd1('0x2d')]=0x0;_0x54a06e[_0x3c2acb][_0x7dd1('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x4f6bb3){if(!_[_0x7dd1('0x2c')](_0x4f6bb3)){for(var _0x2e990e in _0x4f6bb3){if(_0x4f6bb3['hasOwnProperty'](_0x2e990e)){_0x4f6bb3[_0x2e990e][_0x7dd1('0x29')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x2a')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x2f')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x30')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x31')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x2b')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x32')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x33')]=0x0;_0x4f6bb3[_0x2e990e]['outboundNoAnswerCallsDay']=0x0;_0x4f6bb3[_0x2e990e]['outboundBusyCallsDay']=0x0;_0x4f6bb3[_0x2e990e]['outboundCongestionCallsDay']=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x34')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x35')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x36')]=0x0;_0x4f6bb3[_0x2e990e]['outboundDropCallsDayCallersExit']=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x37')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x38')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x39')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x3a')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x33')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x3b')]=0x0;_0x4f6bb3[_0x2e990e][_0x7dd1('0x3c')]=!![];}}}}Realtime['prototype'][_0x7dd1('0x3d')]=function(_0x12710a,_0x25965e){for(var _0x3a2249 in _0x25965e){if(_0x12710a[_0x7dd1('0x24')](_0x3a2249)){_0x12710a[_0x3a2249]=_0x25965e[_0x3a2249];}}};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x3f')]=function(){var _0x3cff24=this;return function(_0x4974d3){if(_0x4974d3){freeIsNotKeyAgent(_0x4974d3,_0x3cff24['agents']);for(var _0x33f178=0x0,_0xb8f2={},_0x3bc076={};_0x33f178<_0x4974d3[_0x7dd1('0x40')];_0x33f178+=0x1){_0xb8f2=_0x4974d3[_0x33f178];var _0x1b2578=_[_0x7dd1('0x41')](_0xb8f2[_0x7dd1('0x42')])?util[_0x7dd1('0x26')]('SIP/%s',_0xb8f2['name']):_0xb8f2[_0x7dd1('0x42')];if(_[_0x7dd1('0x43')](_0x3cff24[_0x7dd1('0x10')][_0x1b2578])){_0x3cff24[_0x7dd1('0x10')][_0x1b2578]=new Agent(_0xb8f2);}else{_0x3cff24['mergeFromDatabase'](_0x3cff24[_0x7dd1('0x10')][_0x1b2578],_0xb8f2);}}}return _0x3cff24[_0x7dd1('0x10')];};};Realtime[_0x7dd1('0x3e')]['initTelephones']=function(){var _0x460bfe=this;return function(_0x2c00b4){if(_0x2c00b4){freeIsNotKeySip(_0x2c00b4,_0x460bfe['telephones']);for(var _0x497c2b=0x0,_0x460acb={},_0x1e6bac={};_0x497c2b<_0x2c00b4[_0x7dd1('0x40')];_0x497c2b+=0x1){_0x460acb=_0x2c00b4[_0x497c2b];if(_[_0x7dd1('0x43')](_0x460bfe['telephones'][util[_0x7dd1('0x26')](_0x7dd1('0x27'),_0x460acb[_0x7dd1('0x28')])])){_0x460bfe['telephones'][util[_0x7dd1('0x26')]('SIP/%s',_0x460acb[_0x7dd1('0x28')])]=new Telephone(_0x460acb);}else{_0x460bfe[_0x7dd1('0x3d')](_0x460bfe[_0x7dd1('0x11')][util['format'](_0x7dd1('0x27'),_0x460acb[_0x7dd1('0x28')])],_0x460acb);}}}return _0x460bfe[_0x7dd1('0x11')];};};Realtime[_0x7dd1('0x3e')]['initTrunks']=function(){var _0x2ae22e=this;return function(_0x444792){if(_0x444792){freeIsNotKeySip(_0x444792,_0x2ae22e['trunks']);for(var _0x672266=0x0,_0xbfaa78={},_0x8a40f8={};_0x672266<_0x444792[_0x7dd1('0x40')];_0x672266+=0x1){_0xbfaa78=_0x444792[_0x672266];if(_[_0x7dd1('0x43')](_0x2ae22e[_0x7dd1('0x12')][util['format'](_0x7dd1('0x27'),_0xbfaa78['name'])])){_0x2ae22e[_0x7dd1('0x12')][util['format'](_0x7dd1('0x27'),_0xbfaa78[_0x7dd1('0x28')])]=new Trunk(_0xbfaa78);}else{_0x2ae22e[_0x7dd1('0x3d')](_0x2ae22e['trunks'][util[_0x7dd1('0x26')](_0x7dd1('0x27'),_0xbfaa78[_0x7dd1('0x28')])],_0xbfaa78);}}}return _0x2ae22e[_0x7dd1('0x12')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x44')]=function(){var _0xfadfbf=this;return function(_0x1ff82c){if(_0x1ff82c){freeIsNotKey(_0x1ff82c,_0xfadfbf[_0x7dd1('0x45')],_0x7dd1('0x28'));for(var _0x446d9f=0x0,_0x2efef0={},_0x14ff87={};_0x446d9f<_0x1ff82c['length'];_0x446d9f+=0x1){_0x2efef0=_0x1ff82c[_0x446d9f];if(_[_0x7dd1('0x43')](_0xfadfbf[_0x7dd1('0x45')][_0x2efef0['name']])){_0xfadfbf[_0x7dd1('0x45')][_0x2efef0['name']]=new VoiceQueue(_0x2efef0);}else{_0xfadfbf[_0x7dd1('0x3d')](_0xfadfbf[_0x7dd1('0x45')][_0x2efef0[_0x7dd1('0x28')]],_0x2efef0);}}}return _0xfadfbf[_0x7dd1('0x45')];};};Realtime[_0x7dd1('0x3e')]['initTriggers']=function(){var _0x24cb3f=this;return function(_0x161322){if(_0x161322){freeIsNotKey(_0x161322,_0x24cb3f[_0x7dd1('0x13')],'id');for(var _0x24762f=0x0,_0x584394={},_0x4100cd={};_0x24762f<_0x161322['length'];_0x24762f+=0x1){_0x584394=_0x161322[_0x24762f];if(_['isUndefined'](_0x24cb3f[_0x7dd1('0x13')][_0x584394['id']])){_0x24cb3f['triggers'][_0x584394['id']]=new Trigger(_0x584394);}else{_0x24cb3f[_0x7dd1('0x3d')](_0x24cb3f['triggers'][_0x584394['id']],_0x584394);}}}return _0x24cb3f['triggers'];};};Realtime[_0x7dd1('0x3e')]['initTemplates']=function(){var _0x5f0d42=this;return function(_0x17225f){if(_0x17225f){freeIsNotKey(_0x17225f,_0x5f0d42[_0x7dd1('0x15')],'id');for(var _0x501357=0x0,_0x544e8f={},_0x974dc={};_0x501357<_0x17225f[_0x7dd1('0x40')];_0x501357+=0x1){_0x544e8f=_0x17225f[_0x501357];if(_[_0x7dd1('0x43')](_0x5f0d42[_0x7dd1('0x15')][_0x544e8f['id']])){_0x5f0d42[_0x7dd1('0x15')][_0x544e8f['id']]=new Template(_0x544e8f);}else{_0x5f0d42[_0x7dd1('0x3d')](_0x5f0d42[_0x7dd1('0x15')][_0x544e8f['id']],_0x544e8f);}}}return _0x5f0d42[_0x7dd1('0x15')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x46')]=function(){var _0x19f4b1=this;return function(_0x544e1e){if(_0x544e1e){freeIsNotKey(_0x544e1e,_0x19f4b1[_0x7dd1('0x1c')],'id');for(var _0x25bd23=0x0,_0x401ad6={},_0x4b456a={};_0x25bd23<_0x544e1e[_0x7dd1('0x40')];_0x25bd23+=0x1){_0x401ad6=_0x544e1e[_0x25bd23];if(_[_0x7dd1('0x43')](_0x19f4b1['zendeskAccounts'][_0x401ad6['id']])){_0x19f4b1[_0x7dd1('0x1c')][_0x401ad6['id']]=new ZendeskAccount(_0x401ad6);}else{_0x19f4b1[_0x7dd1('0x3d')](_0x19f4b1[_0x7dd1('0x1c')][_0x401ad6['id']],_0x401ad6);}}}return _0x19f4b1[_0x7dd1('0x1c')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x47')]=function(){var _0xedca31=this;return function(_0xd244e1){if(_0xd244e1){freeIsNotKey(_0xd244e1,_0xedca31['salesforceAccounts'],'id');for(var _0x56f7e9=0x0,_0x45bdf6={},_0x58e4da={};_0x56f7e9<_0xd244e1[_0x7dd1('0x40')];_0x56f7e9+=0x1){_0x45bdf6=_0xd244e1[_0x56f7e9];if(_[_0x7dd1('0x43')](_0xedca31['salesforceAccounts'][_0x45bdf6['id']])){_0xedca31[_0x7dd1('0x48')][_0x45bdf6['id']]=new SalesforceAccount(_0x45bdf6);}else{_0xedca31[_0x7dd1('0x3d')](_0xedca31[_0x7dd1('0x48')][_0x45bdf6['id']],_0x45bdf6);}}}return _0xedca31[_0x7dd1('0x48')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x49')]=function(){var _0x4a6ecb=this;return function(_0x1aaf22){if(_0x1aaf22){freeIsNotKey(_0x1aaf22,_0x4a6ecb[_0x7dd1('0x1e')],'id');for(var _0x2e7633=0x0,_0xdb0ed9={},_0x1356ed={};_0x2e7633<_0x1aaf22[_0x7dd1('0x40')];_0x2e7633+=0x1){_0xdb0ed9=_0x1aaf22[_0x2e7633];if(_[_0x7dd1('0x43')](_0x4a6ecb[_0x7dd1('0x1e')][_0xdb0ed9['id']])){_0x4a6ecb[_0x7dd1('0x1e')][_0xdb0ed9['id']]=new FreshdeskAccount(_0xdb0ed9);}else{_0x4a6ecb[_0x7dd1('0x3d')](_0x4a6ecb[_0x7dd1('0x1e')][_0xdb0ed9['id']],_0xdb0ed9);}}}return _0x4a6ecb[_0x7dd1('0x1e')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x4a')]=function(){var _0x413744=this;return function(_0x537d98){if(_0x537d98){freeIsNotKey(_0x537d98,_0x413744[_0x7dd1('0x1f')],'id');for(var _0x3ae332=0x0,_0x2336b6={},_0x36ebb6={};_0x3ae332<_0x537d98['length'];_0x3ae332+=0x1){_0x2336b6=_0x537d98[_0x3ae332];if(_[_0x7dd1('0x43')](_0x413744[_0x7dd1('0x1f')][_0x2336b6['id']])){_0x413744[_0x7dd1('0x1f')][_0x2336b6['id']]=new ZohoAccount(_0x2336b6);}else{_0x413744[_0x7dd1('0x3d')](_0x413744['zohoAccounts'][_0x2336b6['id']],_0x2336b6);}}}return _0x413744[_0x7dd1('0x1f')];};};Realtime['prototype'][_0x7dd1('0x4b')]=function(){var _0x857163=this;return function(_0x35fbb1){if(_0x35fbb1){freeIsNotKey(_0x35fbb1,_0x857163[_0x7dd1('0x20')],'id');for(var _0x296056=0x0,_0x58a8e1={},_0xd36d3e={};_0x296056<_0x35fbb1[_0x7dd1('0x40')];_0x296056+=0x1){_0x58a8e1=_0x35fbb1[_0x296056];if(_[_0x7dd1('0x43')](_0x857163[_0x7dd1('0x20')][_0x58a8e1['id']])){_0x857163[_0x7dd1('0x20')][_0x58a8e1['id']]=new DeskAccount(_0x58a8e1);}else{_0x857163[_0x7dd1('0x3d')](_0x857163['deskAccounts'][_0x58a8e1['id']],_0x58a8e1);}}}return _0x857163[_0x7dd1('0x20')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x4c')]=function(){var _0x28056d=this;return function(_0x1f662d){if(_0x1f662d){freeIsNotKey(_0x1f662d,_0x28056d[_0x7dd1('0x1d')],'id');for(var _0xe5dd51=0x0,_0x7392ea={},_0x152557={};_0xe5dd51<_0x1f662d[_0x7dd1('0x40')];_0xe5dd51+=0x1){_0x7392ea=_0x1f662d[_0xe5dd51];if(_[_0x7dd1('0x43')](_0x28056d['sugarcrmAccounts'][_0x7392ea['id']])){_0x28056d[_0x7dd1('0x1d')][_0x7392ea['id']]=new SugarcrmAccount(_0x7392ea);}else{_0x28056d[_0x7dd1('0x3d')](_0x28056d[_0x7dd1('0x1d')][_0x7392ea['id']],_0x7392ea);}}}return _0x28056d[_0x7dd1('0x1d')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x4d')]=function(){var _0x13355c=this;return function(_0x499b8c){if(_0x499b8c){freeIsNotKey(_0x499b8c,_0x13355c[_0x7dd1('0x21')],'id');for(var _0x164a07=0x0,_0x2348c0={},_0x37e3f0={};_0x164a07<_0x499b8c[_0x7dd1('0x40')];_0x164a07+=0x1){_0x2348c0=_0x499b8c[_0x164a07];if(_[_0x7dd1('0x43')](_0x13355c[_0x7dd1('0x21')][_0x2348c0['id']])){_0x13355c[_0x7dd1('0x21')][_0x2348c0['id']]=new VtigerAccount(_0x2348c0);}else{_0x13355c['mergeFromDatabase'](_0x13355c['vtigerAccounts'][_0x2348c0['id']],_0x2348c0);}}}return _0x13355c[_0x7dd1('0x21')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x4e')]=function(){var _0x507558=this;return function(_0x5602cd){if(_0x5602cd){freeIsNotKey(_0x5602cd,_0x507558[_0x7dd1('0x4f')],'id');for(var _0x4b54de=0x0,_0x53e115={},_0x520bb2={};_0x4b54de<_0x5602cd[_0x7dd1('0x40')];_0x4b54de+=0x1){_0x53e115=_0x5602cd[_0x4b54de];if(_[_0x7dd1('0x43')](_0x507558[_0x7dd1('0x4f')][_0x53e115['id']])){_0x507558[_0x7dd1('0x4f')][_0x53e115['id']]=new ServicenowAccount(_0x53e115);}else{_0x507558[_0x7dd1('0x3d')](_0x507558[_0x7dd1('0x4f')][_0x53e115['id']],_0x53e115);}}}return _0x507558[_0x7dd1('0x4f')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x50')]=function(){var _0x577558=this;return function(_0x2db22a){if(_0x2db22a){freeIsNotKey(_0x2db22a,_0x577558[_0x7dd1('0x51')],'id');for(var _0x419469=0x0,_0x2b8582={},_0x4fab94={};_0x419469<_0x2db22a[_0x7dd1('0x40')];_0x419469+=0x1){_0x2b8582=_0x2db22a[_0x419469];if(_['isUndefined'](_0x577558[_0x7dd1('0x51')][_0x2b8582['id']])){_0x577558['dynamics365Accounts'][_0x2b8582['id']]=new Dynamics365Account(_0x2b8582);}else{_0x577558[_0x7dd1('0x3d')](_0x577558[_0x7dd1('0x51')][_0x2b8582['id']],_0x2b8582);}}}return _0x577558['dynamics365Accounts'];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x52')]=function(){var _0x47ea49=this;return function(_0x374b7b){if(_0x374b7b){freeIsNotKey(_0x374b7b,_0x47ea49[_0x7dd1('0x22')],'id');for(var _0x240843=0x0,_0x9319e3={},_0x4da09b={};_0x240843<_0x374b7b[_0x7dd1('0x40')];_0x240843+=0x1){_0x9319e3=_0x374b7b[_0x240843];if(_[_0x7dd1('0x43')](_0x47ea49['freshsalesAccounts'][_0x9319e3['id']])){_0x47ea49[_0x7dd1('0x22')][_0x9319e3['id']]=new FreshsalesAccount(_0x9319e3);}else{_0x47ea49[_0x7dd1('0x3d')](_0x47ea49[_0x7dd1('0x22')][_0x9319e3['id']],_0x9319e3);}}}return _0x47ea49[_0x7dd1('0x22')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x53')]=function(){var _0x1b0b13=this;return function(_0x3d45f1){for(var _0xbee2a0=0x0;_0xbee2a0<_0x3d45f1[_0x7dd1('0x40')];_0xbee2a0+=0x1){_['merge'](_0x1b0b13[_0x7dd1('0x45')][_0x3d45f1[_0xbee2a0][_0x7dd1('0x28')]],_0x3d45f1[_0xbee2a0]);}return _0x1b0b13[_0x7dd1('0x45')];};};Realtime[_0x7dd1('0x3e')]['initVoiceQueueReports']=function(){var _0x46204f=this;return function(_0x5a0790){clearVoiceQueues(_0x46204f[_0x7dd1('0x45')]);if(_0x5a0790){_0x5a0790=_[_0x7dd1('0x54')](_0x5a0790,_0x7dd1('0x55'));for(var _0x1dc9c5 in _0x5a0790){if(_0x5a0790[_0x7dd1('0x24')](_0x1dc9c5)){var _0x54f6f8={};for(var _0x2c9727=0x0;_0x2c9727<_0x5a0790[_0x1dc9c5][_0x7dd1('0x40')];_0x2c9727+=0x1){var _0x21f714=_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x56')];if(_0x46204f['voiceQueues'][_0x21f714]){if(_0x5a0790[_0x1dc9c5][_0x2c9727]['queuecallerexit']){_0x46204f['voiceQueues'][_0x21f714][_0x7dd1('0x2f')]+=0x1;}if(_0x5a0790[_0x1dc9c5][_0x2c9727]['queuecallerabandon']){_0x46204f[_0x7dd1('0x45')][_0x21f714]['abandoned']+=0x1;}_0x46204f['voiceQueues'][_0x21f714]['sumHoldTime']+=moment(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x57')])[_0x7dd1('0x58')](moment(_0x5a0790[_0x1dc9c5][_0x2c9727]['queuecallerjoinAt']),_0x7dd1('0x59'))||0x0;if(_0x2c9727===_0x5a0790[_0x1dc9c5][_0x7dd1('0x40')]-0x1){_0x46204f[_0x7dd1('0x45')][_0x21f714][_0x7dd1('0x2b')]+=moment(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x5a')]||_0x5a0790[_0x1dc9c5][_0x2c9727]['queuecallerabandonAt']||_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x5b')])[_0x7dd1('0x58')](moment(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x5c')]),_0x7dd1('0x59'))||0x0;_0x46204f[_0x7dd1('0x45')][_0x21f714][_0x7dd1('0x29')]+=0x1;if(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x5d')]){_0x46204f[_0x7dd1('0x45')][_0x21f714][_0x7dd1('0x2a')]+=0x1;_0x46204f[_0x7dd1('0x45')][_0x21f714][_0x7dd1('0x32')]+=moment(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x5a')])[_0x7dd1('0x58')](moment(_0x5a0790[_0x1dc9c5][_0x2c9727][_0x7dd1('0x57')]),_0x7dd1('0x59'))||0x0;}}else{_0x46204f['voiceQueues'][_0x21f714][_0x7dd1('0x2b')]+=_0x46204f[_0x7dd1('0x45')][_0x21f714][_0x7dd1('0x31')]||0x0;}}}}}}return _0x46204f[_0x7dd1('0x45')];};};Realtime[_0x7dd1('0x3e')]['initVoiceCallReports']=function(){var _0x32377d=this;return function(_0x7d89d){clearVoiceCallReports(_0x32377d['outbound']);if(_0x7d89d){for(var _0x397166=0x0;_0x397166<_0x7d89d[_0x7dd1('0x40')];_0x397166+=0x1){_0x32377d[_0x7dd1('0x16')][_0x7dd1('0x29')]+=0x1;_0x32377d[_0x7dd1('0x16')]['sumDuration']+=_0x7d89d[_0x397166][_0x7dd1('0x5e')];if(_0x7d89d[_0x397166][_0x7dd1('0x5f')]===_0x7dd1('0x60')){_0x32377d['outbound'][_0x7dd1('0x2a')]+=0x1;_0x32377d['outbound'][_0x7dd1('0x31')]+=_0x7d89d[_0x397166][_0x7dd1('0x5e')]-_0x7d89d[_0x397166][_0x7dd1('0x61')]||0x0;_0x32377d[_0x7dd1('0x16')][_0x7dd1('0x32')]+=_0x7d89d[_0x397166][_0x7dd1('0x61')];}}}return _0x32377d[_0x7dd1('0x16')];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x62')]=function(){var _0x59afa9=this;return function(_0x9594b4){if(_0x9594b4){freeIsNotKey(_0x9594b4,_0x59afa9[_0x7dd1('0x14')],_0x7dd1('0x28'));for(var _0x2d23c9=0x0,_0x358b91={};_0x2d23c9<_0x9594b4[_0x7dd1('0x40')];_0x2d23c9+=0x1){_0x358b91=_0x9594b4[_0x2d23c9];if(_['isUndefined'](_0x59afa9[_0x7dd1('0x14')][_0x358b91[_0x7dd1('0x28')]])){_0x59afa9[_0x7dd1('0x14')][_0x358b91[_0x7dd1('0x28')]]=new Campaign(_0x358b91);}else{_0x59afa9[_0x7dd1('0x3d')](_0x59afa9['campaigns'][_0x358b91[_0x7dd1('0x28')]],_0x358b91);_0x59afa9[_0x7dd1('0x14')][_0x358b91[_0x7dd1('0x28')]][_0x7dd1('0x63')]=_0x358b91[_0x7dd1('0x64')]?_0x358b91[_0x7dd1('0x64')][_0x7dd1('0x28')]:undefined;}}}return _0x59afa9[_0x7dd1('0x14')];};};Realtime[_0x7dd1('0x3e')]['initVoiceExtensions']=function(){var _0x416c2a=this;return function(_0x469a91){if(_0x469a91){freeIsNotKey(_0x469a91,_0x416c2a[_0x7dd1('0x65')],'id');for(var _0x106d5d=0x0,_0x88c88d={};_0x106d5d<_0x469a91[_0x7dd1('0x40')];_0x106d5d+=0x1){_0x88c88d=_0x469a91[_0x106d5d];if(_['isUndefined'](_0x416c2a[_0x7dd1('0x65')][_0x88c88d['id']])){_0x416c2a[_0x7dd1('0x65')][_0x88c88d['id']]=new VoiceExtension(_0x88c88d);}else{_0x416c2a[_0x7dd1('0x3d')](_0x416c2a[_0x7dd1('0x65')][_0x88c88d['id']],_0x88c88d);}}}return _0x416c2a['voiceExtensions'];};};Realtime[_0x7dd1('0x3e')][_0x7dd1('0x66')]=function(){var _0x56f3fa=this;return function(_0x3ecc01){clearCampaigns(_0x56f3fa[_0x7dd1('0x14')]);for(var _0xab743e=0x0;_0xab743e<_0x3ecc01[_0x7dd1('0x40')];_0xab743e+=0x1){_[_0x7dd1('0x67')](_0x56f3fa[_0x7dd1('0x14')][_0x3ecc01[_0xab743e][_0x7dd1('0x28')]],_0x3ecc01[_0xab743e]);}return _0x56f3fa['campaigns'];};};Realtime['prototype'][_0x7dd1('0x68')]=function(){var _0x2cab28=this;return function(_0xa03fad){if(_0xa03fad){freeIsNotKey(_0xa03fad,_0x2cab28[_0x7dd1('0x23')],'id');for(var _0x45433f=0x0,_0x261cf1={},_0x3aac95={};_0x45433f<_0xa03fad[_0x7dd1('0x40')];_0x45433f+=0x1){_0x261cf1=_0xa03fad[_0x45433f];if(_[_0x7dd1('0x43')](_0x2cab28[_0x7dd1('0x23')][_0x261cf1['id']])){_0x2cab28[_0x7dd1('0x23')][_0x261cf1['id']]=new FaxAccount(_0x261cf1);}else{_0x2cab28[_0x7dd1('0x3d')](_0x2cab28['faxAccounts'][_0x261cf1['id']],_0x261cf1);}}}return _0x2cab28[_0x7dd1('0x23')];};};module[_0x7dd1('0x69')]=Realtime; \ No newline at end of file +var _0xa7d8=['outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','bluebird','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','settings','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','isEmpty','ivrAnswerCallsDay','unmanaged','sumDuration','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay'];(function(_0x1b5dff,_0x27aa60){var _0x3f7b8b=function(_0x347642){while(--_0x347642){_0x1b5dff['push'](_0x1b5dff['shift']());}};_0x3f7b8b(++_0x27aa60);}(_0xa7d8,0xfd));var _0x8a7d=function(_0x4a8a55,_0x2d3009){_0x4a8a55=_0x4a8a55-0x0;var _0x1de991=_0xa7d8[_0x4a8a55];return _0x1de991;};'use strict';var BPromise=require(_0x8a7d('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x8a7d('0x1'));var Agent=require(_0x8a7d('0x2'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x8a7d('0x3'));var Trigger=require(_0x8a7d('0x4'));var Template=require('../model/template');var Campaign=require(_0x8a7d('0x5'));var VoiceExtension=require(_0x8a7d('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x8a7d('0x7'));var FreshdeskAccount=require(_0x8a7d('0x8'));var SugarcrmAccount=require(_0x8a7d('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x8a7d('0xa'));var VtigerAccount=require(_0x8a7d('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x8a7d('0xc'));var FreshsalesAccount=require(_0x8a7d('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x8a7d('0xe')]={};this[_0x8a7d('0xf')]={};this[_0x8a7d('0x10')]={};this['voiceQueues']={};this[_0x8a7d('0x11')]={};this[_0x8a7d('0x12')]={};this[_0x8a7d('0x13')]={};this[_0x8a7d('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8a7d('0x15')]={};this[_0x8a7d('0x16')]={};this[_0x8a7d('0x17')]={};this['outboundChannels']={};this['timers']={};this[_0x8a7d('0x18')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x8a7d('0x19')]={};this[_0x8a7d('0x1a')]={};this[_0x8a7d('0x1b')]={};this[_0x8a7d('0x1c')]={};this['vtigerAccounts']={};this[_0x8a7d('0x1d')]={};this[_0x8a7d('0x1e')]={};this['freshsalesAccounts']={};this[_0x8a7d('0x1f')]={};};function freeIsNotKey(_0x1ce1b9,_0x1daf3b,_0xf1b7c9){var _0x22c8e0=_[_0x8a7d('0x20')](_0x1ce1b9,function(_0x2687f9,_0x207211){return _0x2687f9[_0xf1b7c9];});for(var _0x335727 in _0x1daf3b){if(_0x1daf3b[_0x8a7d('0x21')](_0x335727)){if(!_0x22c8e0[_0x335727]){delete _0x1daf3b[_0x335727];}}}}function freeIsNotKeySip(_0x3a85ce,_0x50c21b){var _0x2d0a67=_['mapKeys'](_0x3a85ce,function(_0x4373b5,_0x4f2144){return util[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x4373b5[_0x8a7d('0x24')]);});for(var _0x207975 in _0x50c21b){if(_0x50c21b[_0x8a7d('0x21')](_0x207975)){if(!_0x2d0a67[_0x207975]){delete _0x50c21b[_0x207975];}}}}function freeIsNotKeyAgent(_0x5b151c,_0x4f72a1){var _0x3b7a90=_['mapKeys'](_0x5b151c,function(_0x217b7a,_0x158a12){var _0x21df7b=_[_0x8a7d('0x25')](_0x217b7a['interface'])?util[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x217b7a[_0x8a7d('0x24')]):_0x217b7a[_0x8a7d('0x26')];return _0x21df7b;});for(var _0x4b3858 in _0x4f72a1){if(_0x4f72a1[_0x8a7d('0x21')](_0x4b3858)){if(!_0x3b7a90[_0x4b3858]){delete _0x4f72a1[_0x4b3858];}}}}function clearVoiceCallReports(_0x1052a5){_0x1052a5[_0x8a7d('0x27')]=0x0;_0x1052a5[_0x8a7d('0x28')]=0x0;_0x1052a5[_0x8a7d('0x29')]=0x0;_0x1052a5['sumDuration']=0x0;_0x1052a5['sumBillable']=0x0;}function clearCampaigns(_0x3cb75c){if(!_[_0x8a7d('0x2a')](_0x3cb75c)){for(var _0x5e6ee5 in _0x3cb75c){if(_0x3cb75c[_0x8a7d('0x21')](_0x5e6ee5)){_0x3cb75c[_0x5e6ee5]['ivrTotalCallsDays']=0x0;_0x3cb75c[_0x5e6ee5][_0x8a7d('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x1944f5){if(!_[_0x8a7d('0x2a')](_0x1944f5)){for(var _0x7b78b in _0x1944f5){if(_0x1944f5[_0x8a7d('0x21')](_0x7b78b)){_0x1944f5[_0x7b78b][_0x8a7d('0x27')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x28')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x2c')]=0x0;_0x1944f5[_0x7b78b]['abandoned']=0x0;_0x1944f5[_0x7b78b]['sumHoldTime']=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x2d')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x2e')]=0x0;_0x1944f5[_0x7b78b]['outboundAnswerAgiCallsDay']=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x2f')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x30')]=0x0;_0x1944f5[_0x7b78b]['outboundCongestionCallsDay']=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x31')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x32')]=0x0;_0x1944f5[_0x7b78b]['outboundDropCallsDayTimeout']=0x0;_0x1944f5[_0x7b78b]['outboundDropCallsDayCallersExit']=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x33')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x34')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x35')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x36')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x37')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x38')]=0x0;_0x1944f5[_0x7b78b][_0x8a7d('0x39')]=!![];}}}}Realtime[_0x8a7d('0x3a')][_0x8a7d('0x3b')]=function(_0x5678c7,_0x382158){for(var _0x2d46df in _0x382158){if(_0x5678c7['hasOwnProperty'](_0x2d46df)){_0x5678c7[_0x2d46df]=_0x382158[_0x2d46df];}}};Realtime[_0x8a7d('0x3a')]['initAgents']=function(){var _0x5e7638=this;return function(_0x4054ce){if(_0x4054ce){freeIsNotKeyAgent(_0x4054ce,_0x5e7638[_0x8a7d('0xe')]);for(var _0x108bc3=0x0,_0x1db66e={},_0x38ed5a={};_0x108bc3<_0x4054ce[_0x8a7d('0x3c')];_0x108bc3+=0x1){_0x1db66e=_0x4054ce[_0x108bc3];var _0x1d0cea=_[_0x8a7d('0x25')](_0x1db66e[_0x8a7d('0x26')])?util[_0x8a7d('0x22')]('SIP/%s',_0x1db66e[_0x8a7d('0x24')]):_0x1db66e[_0x8a7d('0x26')];if(_[_0x8a7d('0x3d')](_0x5e7638[_0x8a7d('0xe')][_0x1d0cea])){_0x5e7638[_0x8a7d('0xe')][_0x1d0cea]=new Agent(_0x1db66e);}else{_0x5e7638[_0x8a7d('0x3b')](_0x5e7638['agents'][_0x1d0cea],_0x1db66e);}}}return _0x5e7638[_0x8a7d('0xe')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x3e')]=function(){var _0x84c743=this;return function(_0x204a42){if(_0x204a42){freeIsNotKeySip(_0x204a42,_0x84c743[_0x8a7d('0xf')]);for(var _0x2490e7=0x0,_0x3da86b={},_0x2cd808={};_0x2490e7<_0x204a42['length'];_0x2490e7+=0x1){_0x3da86b=_0x204a42[_0x2490e7];if(_[_0x8a7d('0x3d')](_0x84c743['telephones'][util[_0x8a7d('0x22')]('SIP/%s',_0x3da86b[_0x8a7d('0x24')])])){_0x84c743['telephones'][util[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x3da86b[_0x8a7d('0x24')])]=new Telephone(_0x3da86b);}else{_0x84c743[_0x8a7d('0x3b')](_0x84c743['telephones'][util[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x3da86b[_0x8a7d('0x24')])],_0x3da86b);}}}return _0x84c743['telephones'];};};Realtime['prototype'][_0x8a7d('0x3f')]=function(){var _0x441b62=this;return function(_0x4705ce){if(_0x4705ce){freeIsNotKeySip(_0x4705ce,_0x441b62['trunks']);for(var _0x3ffcbb=0x0,_0x5b7d8a={},_0x394a6c={};_0x3ffcbb<_0x4705ce[_0x8a7d('0x3c')];_0x3ffcbb+=0x1){_0x5b7d8a=_0x4705ce[_0x3ffcbb];if(_[_0x8a7d('0x3d')](_0x441b62['trunks'][util['format'](_0x8a7d('0x23'),_0x5b7d8a[_0x8a7d('0x24')])])){_0x441b62[_0x8a7d('0x10')][util[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x5b7d8a[_0x8a7d('0x24')])]=new Trunk(_0x5b7d8a);}else{_0x441b62[_0x8a7d('0x3b')](_0x441b62['trunks'][util['format'](_0x8a7d('0x23'),_0x5b7d8a['name'])],_0x5b7d8a);}}}return _0x441b62[_0x8a7d('0x10')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x40')]=function(){var _0x272867=this;return function(_0x2882be){if(_0x2882be){freeIsNotKey(_0x2882be,_0x272867[_0x8a7d('0x41')],_0x8a7d('0x24'));for(var _0x27283b=0x0,_0x356371={},_0x479271={};_0x27283b<_0x2882be[_0x8a7d('0x3c')];_0x27283b+=0x1){_0x356371=_0x2882be[_0x27283b];if(_['isUndefined'](_0x272867[_0x8a7d('0x41')][_0x356371[_0x8a7d('0x24')]])){_0x272867[_0x8a7d('0x41')][_0x356371[_0x8a7d('0x24')]]=new VoiceQueue(_0x356371);}else{_0x272867[_0x8a7d('0x3b')](_0x272867['voiceQueues'][_0x356371[_0x8a7d('0x24')]],_0x356371);}}}return _0x272867[_0x8a7d('0x41')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x42')]=function(){var _0x41eba4=this;return function(_0x1e0e56){if(_0x1e0e56){freeIsNotKey(_0x1e0e56,_0x41eba4[_0x8a7d('0x11')],'id');for(var _0x413299=0x0,_0x56afee={},_0x39d491={};_0x413299<_0x1e0e56[_0x8a7d('0x3c')];_0x413299+=0x1){_0x56afee=_0x1e0e56[_0x413299];if(_[_0x8a7d('0x3d')](_0x41eba4['triggers'][_0x56afee['id']])){_0x41eba4[_0x8a7d('0x11')][_0x56afee['id']]=new Trigger(_0x56afee);}else{_0x41eba4['mergeFromDatabase'](_0x41eba4[_0x8a7d('0x11')][_0x56afee['id']],_0x56afee);}}}return _0x41eba4[_0x8a7d('0x11')];};};Realtime['prototype'][_0x8a7d('0x43')]=function(){var _0x3ce5d9=this;return function(_0x482dbe){if(_0x482dbe){freeIsNotKey(_0x482dbe,_0x3ce5d9['templates'],'id');for(var _0x57e6d5=0x0,_0x510945={},_0xa8ef03={};_0x57e6d5<_0x482dbe[_0x8a7d('0x3c')];_0x57e6d5+=0x1){_0x510945=_0x482dbe[_0x57e6d5];if(_['isUndefined'](_0x3ce5d9[_0x8a7d('0x13')][_0x510945['id']])){_0x3ce5d9[_0x8a7d('0x13')][_0x510945['id']]=new Template(_0x510945);}else{_0x3ce5d9[_0x8a7d('0x3b')](_0x3ce5d9['templates'][_0x510945['id']],_0x510945);}}}return _0x3ce5d9[_0x8a7d('0x13')];};};Realtime['prototype'][_0x8a7d('0x44')]=function(){var _0x41fadc=this;return function(_0x5bb534){if(_0x5bb534){freeIsNotKey(_0x5bb534,_0x41fadc['zendeskAccounts'],'id');for(var _0x559af9=0x0,_0x58ebf4={},_0x389dc7={};_0x559af9<_0x5bb534[_0x8a7d('0x3c')];_0x559af9+=0x1){_0x58ebf4=_0x5bb534[_0x559af9];if(_['isUndefined'](_0x41fadc[_0x8a7d('0x45')][_0x58ebf4['id']])){_0x41fadc[_0x8a7d('0x45')][_0x58ebf4['id']]=new ZendeskAccount(_0x58ebf4);}else{_0x41fadc['mergeFromDatabase'](_0x41fadc['zendeskAccounts'][_0x58ebf4['id']],_0x58ebf4);}}}return _0x41fadc[_0x8a7d('0x45')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x46')]=function(){var _0x2ce67c=this;return function(_0x398203){if(_0x398203){freeIsNotKey(_0x398203,_0x2ce67c[_0x8a7d('0x47')],'id');for(var _0x15d2f6=0x0,_0x4873ac={},_0x1ae40b={};_0x15d2f6<_0x398203[_0x8a7d('0x3c')];_0x15d2f6+=0x1){_0x4873ac=_0x398203[_0x15d2f6];if(_[_0x8a7d('0x3d')](_0x2ce67c[_0x8a7d('0x47')][_0x4873ac['id']])){_0x2ce67c['salesforceAccounts'][_0x4873ac['id']]=new SalesforceAccount(_0x4873ac);}else{_0x2ce67c[_0x8a7d('0x3b')](_0x2ce67c['salesforceAccounts'][_0x4873ac['id']],_0x4873ac);}}}return _0x2ce67c[_0x8a7d('0x47')];};};Realtime[_0x8a7d('0x3a')]['initFreshdeskAccounts']=function(){var _0x275b63=this;return function(_0x2fd5fc){if(_0x2fd5fc){freeIsNotKey(_0x2fd5fc,_0x275b63['freshdeskAccounts'],'id');for(var _0x55923c=0x0,_0x47f570={},_0x160cdc={};_0x55923c<_0x2fd5fc['length'];_0x55923c+=0x1){_0x47f570=_0x2fd5fc[_0x55923c];if(_['isUndefined'](_0x275b63[_0x8a7d('0x1a')][_0x47f570['id']])){_0x275b63['freshdeskAccounts'][_0x47f570['id']]=new FreshdeskAccount(_0x47f570);}else{_0x275b63[_0x8a7d('0x3b')](_0x275b63[_0x8a7d('0x1a')][_0x47f570['id']],_0x47f570);}}}return _0x275b63[_0x8a7d('0x1a')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x497ff9=this;return function(_0x3fa91e){if(_0x3fa91e){freeIsNotKey(_0x3fa91e,_0x497ff9[_0x8a7d('0x1b')],'id');for(var _0x49ca38=0x0,_0x301a39={},_0x341324={};_0x49ca38<_0x3fa91e['length'];_0x49ca38+=0x1){_0x301a39=_0x3fa91e[_0x49ca38];if(_['isUndefined'](_0x497ff9[_0x8a7d('0x1b')][_0x301a39['id']])){_0x497ff9[_0x8a7d('0x1b')][_0x301a39['id']]=new ZohoAccount(_0x301a39);}else{_0x497ff9[_0x8a7d('0x3b')](_0x497ff9[_0x8a7d('0x1b')][_0x301a39['id']],_0x301a39);}}}return _0x497ff9['zohoAccounts'];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x48')]=function(){var _0xd3b752=this;return function(_0xd87824){if(_0xd87824){freeIsNotKey(_0xd87824,_0xd3b752[_0x8a7d('0x1c')],'id');for(var _0x3a59ce=0x0,_0x62bb22={},_0x60e7ce={};_0x3a59ce<_0xd87824['length'];_0x3a59ce+=0x1){_0x62bb22=_0xd87824[_0x3a59ce];if(_['isUndefined'](_0xd3b752['deskAccounts'][_0x62bb22['id']])){_0xd3b752['deskAccounts'][_0x62bb22['id']]=new DeskAccount(_0x62bb22);}else{_0xd3b752['mergeFromDatabase'](_0xd3b752['deskAccounts'][_0x62bb22['id']],_0x62bb22);}}}return _0xd3b752[_0x8a7d('0x1c')];};};Realtime['prototype'][_0x8a7d('0x49')]=function(){var _0x35e253=this;return function(_0x1db840){if(_0x1db840){freeIsNotKey(_0x1db840,_0x35e253[_0x8a7d('0x19')],'id');for(var _0x3bbb9f=0x0,_0x4738d8={},_0x33b81d={};_0x3bbb9f<_0x1db840[_0x8a7d('0x3c')];_0x3bbb9f+=0x1){_0x4738d8=_0x1db840[_0x3bbb9f];if(_[_0x8a7d('0x3d')](_0x35e253[_0x8a7d('0x19')][_0x4738d8['id']])){_0x35e253[_0x8a7d('0x19')][_0x4738d8['id']]=new SugarcrmAccount(_0x4738d8);}else{_0x35e253[_0x8a7d('0x3b')](_0x35e253['sugarcrmAccounts'][_0x4738d8['id']],_0x4738d8);}}}return _0x35e253[_0x8a7d('0x19')];};};Realtime[_0x8a7d('0x3a')]['initVtigerAccounts']=function(){var _0x340ad3=this;return function(_0x17e3b2){if(_0x17e3b2){freeIsNotKey(_0x17e3b2,_0x340ad3[_0x8a7d('0x4a')],'id');for(var _0x285304=0x0,_0x51f6b0={},_0x57fd8d={};_0x285304<_0x17e3b2[_0x8a7d('0x3c')];_0x285304+=0x1){_0x51f6b0=_0x17e3b2[_0x285304];if(_[_0x8a7d('0x3d')](_0x340ad3[_0x8a7d('0x4a')][_0x51f6b0['id']])){_0x340ad3[_0x8a7d('0x4a')][_0x51f6b0['id']]=new VtigerAccount(_0x51f6b0);}else{_0x340ad3['mergeFromDatabase'](_0x340ad3[_0x8a7d('0x4a')][_0x51f6b0['id']],_0x51f6b0);}}}return _0x340ad3[_0x8a7d('0x4a')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x4b')]=function(){var _0x1cc4ef=this;return function(_0x5ef930){if(_0x5ef930){freeIsNotKey(_0x5ef930,_0x1cc4ef['servicenowAccounts'],'id');for(var _0x423a1e=0x0,_0x471cf7={},_0x309df1={};_0x423a1e<_0x5ef930[_0x8a7d('0x3c')];_0x423a1e+=0x1){_0x471cf7=_0x5ef930[_0x423a1e];if(_[_0x8a7d('0x3d')](_0x1cc4ef['servicenowAccounts'][_0x471cf7['id']])){_0x1cc4ef[_0x8a7d('0x1d')][_0x471cf7['id']]=new ServicenowAccount(_0x471cf7);}else{_0x1cc4ef[_0x8a7d('0x3b')](_0x1cc4ef[_0x8a7d('0x1d')][_0x471cf7['id']],_0x471cf7);}}}return _0x1cc4ef[_0x8a7d('0x1d')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x38bf6a=this;return function(_0x43eed7){if(_0x43eed7){freeIsNotKey(_0x43eed7,_0x38bf6a['dynamics365Accounts'],'id');for(var _0x347eaa=0x0,_0x7b894b={},_0x3585e0={};_0x347eaa<_0x43eed7[_0x8a7d('0x3c')];_0x347eaa+=0x1){_0x7b894b=_0x43eed7[_0x347eaa];if(_[_0x8a7d('0x3d')](_0x38bf6a['dynamics365Accounts'][_0x7b894b['id']])){_0x38bf6a[_0x8a7d('0x1e')][_0x7b894b['id']]=new Dynamics365Account(_0x7b894b);}else{_0x38bf6a[_0x8a7d('0x3b')](_0x38bf6a['dynamics365Accounts'][_0x7b894b['id']],_0x7b894b);}}}return _0x38bf6a[_0x8a7d('0x1e')];};};Realtime[_0x8a7d('0x3a')]['initFreshsalesAccounts']=function(){var _0x64869=this;return function(_0x5dd6f9){if(_0x5dd6f9){freeIsNotKey(_0x5dd6f9,_0x64869[_0x8a7d('0x4c')],'id');for(var _0x20d1b3=0x0,_0x66c363={},_0x5e16af={};_0x20d1b3<_0x5dd6f9[_0x8a7d('0x3c')];_0x20d1b3+=0x1){_0x66c363=_0x5dd6f9[_0x20d1b3];if(_['isUndefined'](_0x64869['freshsalesAccounts'][_0x66c363['id']])){_0x64869[_0x8a7d('0x4c')][_0x66c363['id']]=new FreshsalesAccount(_0x66c363);}else{_0x64869[_0x8a7d('0x3b')](_0x64869[_0x8a7d('0x4c')][_0x66c363['id']],_0x66c363);}}}return _0x64869['freshsalesAccounts'];};};Realtime['prototype'][_0x8a7d('0x4d')]=function(){var _0x10fc15=this;return function(_0x20f9c0){for(var _0x4c828f=0x0;_0x4c828f<_0x20f9c0[_0x8a7d('0x3c')];_0x4c828f+=0x1){_[_0x8a7d('0x4e')](_0x10fc15[_0x8a7d('0x41')][_0x20f9c0[_0x4c828f][_0x8a7d('0x24')]],_0x20f9c0[_0x4c828f]);}return _0x10fc15[_0x8a7d('0x41')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x4f')]=function(){var _0x35b8ea=this;return function(_0x1a13b7){clearVoiceQueues(_0x35b8ea[_0x8a7d('0x41')]);if(_0x1a13b7){_0x1a13b7=_[_0x8a7d('0x50')](_0x1a13b7,_0x8a7d('0x51'));for(var _0x54cc18 in _0x1a13b7){if(_0x1a13b7[_0x8a7d('0x21')](_0x54cc18)){var _0x4252f4={};for(var _0xff09b6=0x0;_0xff09b6<_0x1a13b7[_0x54cc18][_0x8a7d('0x3c')];_0xff09b6+=0x1){var _0x38e4f6=_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x52')];if(_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6]){if(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x53')]){_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6][_0x8a7d('0x2c')]+=0x1;}if(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x54')]){_0x35b8ea['voiceQueues'][_0x38e4f6]['abandoned']+=0x1;}_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6][_0x8a7d('0x29')]+=moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x55')])['diff'](moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x56')]),_0x8a7d('0x57'))||0x0;if(_0xff09b6===_0x1a13b7[_0x54cc18]['length']-0x1){_0x35b8ea['voiceQueues'][_0x38e4f6][_0x8a7d('0x2d')]+=moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x58')]||_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x59')]||_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x5a')])[_0x8a7d('0x5b')](moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x56')]),'seconds')||0x0;_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6]['total']+=0x1;if(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x5c')]){_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6][_0x8a7d('0x28')]+=0x1;_0x35b8ea['voiceQueues'][_0x38e4f6][_0x8a7d('0x2e')]+=moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x58')])['diff'](moment(_0x1a13b7[_0x54cc18][_0xff09b6][_0x8a7d('0x55')]),_0x8a7d('0x57'))||0x0;}}else{_0x35b8ea[_0x8a7d('0x41')][_0x38e4f6][_0x8a7d('0x2d')]+=_0x35b8ea['voiceQueues'][_0x38e4f6]['sumHoldTime']||0x0;}}}}}}return _0x35b8ea['voiceQueues'];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x5d')]=function(){var _0x58203e=this;return function(_0xe87b01){clearVoiceCallReports(_0x58203e[_0x8a7d('0x14')]);if(_0xe87b01){for(var _0xe5b63b=0x0;_0xe5b63b<_0xe87b01['length'];_0xe5b63b+=0x1){_0x58203e[_0x8a7d('0x14')][_0x8a7d('0x27')]+=0x1;_0x58203e['outbound'][_0x8a7d('0x2d')]+=_0xe87b01[_0xe5b63b][_0x8a7d('0x5e')];if(_0xe87b01[_0xe5b63b][_0x8a7d('0x5f')]===_0x8a7d('0x60')){_0x58203e[_0x8a7d('0x14')][_0x8a7d('0x28')]+=0x1;_0x58203e[_0x8a7d('0x14')][_0x8a7d('0x29')]+=_0xe87b01[_0xe5b63b][_0x8a7d('0x5e')]-_0xe87b01[_0xe5b63b]['billableseconds']||0x0;_0x58203e[_0x8a7d('0x14')][_0x8a7d('0x2e')]+=_0xe87b01[_0xe5b63b]['billableseconds'];}}}return _0x58203e[_0x8a7d('0x14')];};};Realtime[_0x8a7d('0x3a')][_0x8a7d('0x61')]=function(){var _0x1e9393=this;return function(_0x35eacb){if(_0x35eacb){freeIsNotKey(_0x35eacb,_0x1e9393[_0x8a7d('0x12')],_0x8a7d('0x24'));for(var _0x33789e=0x0,_0x43e8e6={};_0x33789e<_0x35eacb['length'];_0x33789e+=0x1){_0x43e8e6=_0x35eacb[_0x33789e];if(_[_0x8a7d('0x3d')](_0x1e9393[_0x8a7d('0x12')][_0x43e8e6[_0x8a7d('0x24')]])){_0x1e9393[_0x8a7d('0x12')][_0x43e8e6[_0x8a7d('0x24')]]=new Campaign(_0x43e8e6);}else{_0x1e9393[_0x8a7d('0x3b')](_0x1e9393[_0x8a7d('0x12')][_0x43e8e6[_0x8a7d('0x24')]],_0x43e8e6);_0x1e9393[_0x8a7d('0x12')][_0x43e8e6[_0x8a7d('0x24')]][_0x8a7d('0x62')]=_0x43e8e6[_0x8a7d('0x63')]?_0x43e8e6[_0x8a7d('0x63')][_0x8a7d('0x24')]:undefined;}}}return _0x1e9393['campaigns'];};};Realtime['prototype'][_0x8a7d('0x64')]=function(){var _0x2e8e06=this;return function(_0x9136c6){if(_0x9136c6){freeIsNotKey(_0x9136c6,_0x2e8e06['voiceExtensions'],'id');for(var _0x31b2ff=0x0,_0xf921c8={};_0x31b2ff<_0x9136c6[_0x8a7d('0x3c')];_0x31b2ff+=0x1){_0xf921c8=_0x9136c6[_0x31b2ff];if(_['isUndefined'](_0x2e8e06[_0x8a7d('0x15')][_0xf921c8['id']])){_0x2e8e06['voiceExtensions'][_0xf921c8['id']]=new VoiceExtension(_0xf921c8);}else{_0x2e8e06[_0x8a7d('0x3b')](_0x2e8e06[_0x8a7d('0x15')][_0xf921c8['id']],_0xf921c8);}}}return _0x2e8e06[_0x8a7d('0x15')];};};Realtime[_0x8a7d('0x3a')]['initCampaignHopperHistory']=function(){var _0x2a1258=this;return function(_0x587a0e){clearCampaigns(_0x2a1258['campaigns']);for(var _0x4ea4d5=0x0;_0x4ea4d5<_0x587a0e[_0x8a7d('0x3c')];_0x4ea4d5+=0x1){_[_0x8a7d('0x4e')](_0x2a1258[_0x8a7d('0x12')][_0x587a0e[_0x4ea4d5][_0x8a7d('0x24')]],_0x587a0e[_0x4ea4d5]);}return _0x2a1258['campaigns'];};};Realtime[_0x8a7d('0x3a')]['initFaxAccounts']=function(){var _0x3fb451=this;return function(_0x21bfc7){if(_0x21bfc7){freeIsNotKey(_0x21bfc7,_0x3fb451[_0x8a7d('0x1f')],'id');for(var _0x1f6710=0x0,_0x350131={},_0x101aad={};_0x1f6710<_0x21bfc7[_0x8a7d('0x3c')];_0x1f6710+=0x1){_0x350131=_0x21bfc7[_0x1f6710];if(_['isUndefined'](_0x3fb451[_0x8a7d('0x1f')][_0x350131['id']])){_0x3fb451['faxAccounts'][_0x350131['id']]=new FaxAccount(_0x350131);}else{_0x3fb451[_0x8a7d('0x3b')](_0x3fb451[_0x8a7d('0x1f')][_0x350131['id']],_0x350131);}}}return _0x3fb451[_0x8a7d('0x1f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ee0dbe9..be26ac2 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 _0xf566=['monitorFilename','filename','createdAt','calleridname','connectedlinename','isArray','startsWith','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','bind','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','type','UserId','monitor','monitors'];(function(_0x5e9e3d,_0x567718){var _0x579c2c=function(_0xc24425){while(--_0xc24425){_0x5e9e3d['push'](_0x5e9e3d['shift']());}};_0x579c2c(++_0x567718);}(_0xf566,0x183));var _0x6f56=function(_0x1c63a9,_0x49726c){_0x1c63a9=_0x1c63a9-0x0;var _0x4a3b03=_0xf566[_0x1c63a9];return _0x4a3b03;};'use strict';var _=require(_0x6f56('0x0'));var moment=require(_0x6f56('0x1'));var util=require(_0x6f56('0x2'));var config=require(_0x6f56('0x3'));var ami=require(_0x6f56('0x4'));var RpcVoiceAgentReport=require(_0x6f56('0x5'));var RpcVoiceCallReport=require(_0x6f56('0x6'));var RpcVoiceDialReport=require(_0x6f56('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x6f56('0x8'));var RpcVoiceRecording=require(_0x6f56('0x9'));var RpcVoiceTransferReport=require(_0x6f56('0xa'));var VoiceQueueReport=require(_0x6f56('0xb'));var VoiceCallReport=require(_0x6f56('0xc'));var VoiceAgentReport=require(_0x6f56('0xd'));var VoiceDialReport=require(_0x6f56('0xe'));var UserReport=require(_0x6f56('0xf'));function Report(_0x47a324){this[_0x6f56('0x10')]=_0x47a324;this[_0x6f56('0x11')]=_0x47a324[_0x6f56('0x11')];this[_0x6f56('0x12')]=_0x47a324[_0x6f56('0x12')];}Report[_0x6f56('0x13')][_0x6f56('0x14')]=function(_0x19f0b0){var _0x247ecd=new VoiceQueueReport(this[_0x6f56('0x10')]);var _0x4f92df=new VoiceAgentReport(this[_0x6f56('0x10')]);var _0x1cb006=new VoiceDialReport(this[_0x6f56('0x10')]);var _0x111212=new VoiceCallReport(this[_0x6f56('0x10')]);var _0x3d4f8a=new UserReport(this['realtime']);if(config[_0x6f56('0x15')]&&config[_0x6f56('0x15')][_0x6f56('0x16')]){ami['on'](_0x6f56('0x17'),this[_0x6f56('0x18')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x6f56('0x19')]['bind'](this));ami['on'](_0x6f56('0x1a'),this[_0x6f56('0x1b')]['bind'](this));ami['on'](_0x6f56('0x1c'),this[_0x6f56('0x1d')][_0x6f56('0x1e')](this));ami['on'](_0x6f56('0x1f'),this[_0x6f56('0x20')]['bind'](this));ami['on'](_0x6f56('0x21'),this['attendedTransfer'][_0x6f56('0x1e')](this));}};Report[_0x6f56('0x13')][_0x6f56('0x22')]=function(_0x3dc9c6){var _0x3d33e3;_0x3d33e3=_[_0x6f56('0x23')](this[_0x6f56('0x11')],function(_0x29001a){return _0x29001a[_0x6f56('0x24')]==_0x3dc9c6||_0x29001a[_0x6f56('0x25')]==_0x3dc9c6;});if(_['isNil'](_0x3d33e3)){var _0x12327a=_['find'](this[_0x6f56('0x12')],function(_0x444aa3){return _0x444aa3[_0x6f56('0x24')]==_0x3dc9c6||_0x444aa3[_0x6f56('0x25')]==_0x3dc9c6;});if(_0x12327a){_0x3d33e3=_[_0x6f56('0x23')](this[_0x6f56('0x11')],function(_0x1f761a){return _0x1f761a[_0x6f56('0x26')]==util[_0x6f56('0x27')](_0x6f56('0x28'),_0x12327a[_0x6f56('0x25')]);});}}return _0x3d33e3;};Report[_0x6f56('0x13')][_0x6f56('0x18')]=function(_0x8d3ad3){for(var _0x2d0072=0x0;_0x2d0072<_0x8d3ad3[_0x6f56('0x29')];_0x2d0072+=0x1){var _0x5a485b=this[_0x6f56('0x22')](_0x8d3ad3[_0x2d0072]['connectedlinenum']);if(_0x5a485b){_0x8d3ad3[_0x2d0072]['accountcode']=_0x5a485b[_0x6f56('0x24')];_0x8d3ad3[_0x2d0072][_0x6f56('0x2a')]=!![];_0x8d3ad3[_0x2d0072][_0x6f56('0x2b')]=_0x5a485b['name'];_0x8d3ad3[_0x2d0072][_0x6f56('0x26')]=_[_0x6f56('0x2c')](_0x5a485b[_0x6f56('0x26')])?util[_0x6f56('0x27')](_0x6f56('0x28'),_0x5a485b[_0x6f56('0x25')]):_0x5a485b[_0x6f56('0x26')];if(_0x8d3ad3[_0x2d0072][_0x6f56('0x2d')]){_0x8d3ad3[_0x2d0072]['queuecallercompleteAt']=moment()[_0x6f56('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x8d3ad3[_0x2d0072]['queuecallerexit']){_0x8d3ad3[_0x2d0072][_0x6f56('0x2e')]=moment()[_0x6f56('0x27')](_0x6f56('0x2f'));}RpcMemberReport[_0x6f56('0x18')](_0x8d3ad3[_0x2d0072]);}RpcVoiceQueueReport[_0x6f56('0x30')](_0x8d3ad3[_0x2d0072]);}};function extractCalleridNumber(_0x537e8d){var _0x4bb954=_0x537e8d['match'](/<(.*?)>/);return _0x4bb954?_0x4bb954[0x1]:_0x537e8d;}Report[_0x6f56('0x13')][_0x6f56('0x31')]=function(_0x3a05b7){for(var _0xb8251f=0x0;_0xb8251f','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','lastIndexOf','exports'];(function(_0x179cbf,_0x7892eb){var _0x2b5c13=function(_0x4640a1){while(--_0x4640a1){_0x179cbf['push'](_0x179cbf['shift']());}};_0x2b5c13(++_0x7892eb);}(_0x250c,0xb4));var _0xc250=function(_0x56d947,_0x35e9b9){_0x56d947=_0x56d947-0x0;var _0x48f4e9=_0x250c[_0x56d947];return _0x48f4e9;};'use strict';var _=require(_0xc250('0x0'));var moment=require(_0xc250('0x1'));var util=require(_0xc250('0x2'));var config=require('../../../config/environment');var ami=require(_0xc250('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc250('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc250('0x5'));var RpcVoiceTransferReport=require(_0xc250('0x6'));var VoiceQueueReport=require(_0xc250('0x7'));var VoiceCallReport=require(_0xc250('0x8'));var VoiceAgentReport=require(_0xc250('0x9'));var VoiceDialReport=require(_0xc250('0xa'));var UserReport=require(_0xc250('0xb'));function Report(_0x596a62){this[_0xc250('0xc')]=_0x596a62;this[_0xc250('0xd')]=_0x596a62[_0xc250('0xd')];this[_0xc250('0xe')]=_0x596a62['telephones'];}Report['prototype']['sync']=function(_0x4578cc){var _0x23d007=new VoiceQueueReport(this['realtime']);var _0x4927f0=new VoiceAgentReport(this['realtime']);var _0x3013ca=new VoiceDialReport(this[_0xc250('0xc')]);var _0x2072b3=new VoiceCallReport(this[_0xc250('0xc')]);var _0x28ac2a=new UserReport(this[_0xc250('0xc')]);if(config[_0xc250('0xf')]&&config[_0xc250('0xf')]['disabled']){ami['on'](_0xc250('0x10'),this['voiceQueueReport'][_0xc250('0x11')](this));ami['on'](_0xc250('0x12'),this['voiceCallReport']['bind'](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0xc250('0x13'),this[_0xc250('0x14')][_0xc250('0x11')](this));ami['on'](_0xc250('0x15'),this[_0xc250('0x16')][_0xc250('0x11')](this));ami['on'](_0xc250('0x17'),this[_0xc250('0x18')]['bind'](this));}};Report[_0xc250('0x19')][_0xc250('0x1a')]=function(_0x5a68d5){var _0x252672;_0x252672=_[_0xc250('0x1b')](this['agents'],function(_0x36ee88){return _0x36ee88[_0xc250('0x1c')]==_0x5a68d5||_0x36ee88[_0xc250('0x1d')]==_0x5a68d5;});if(_[_0xc250('0x1e')](_0x252672)){var _0x38607b=_[_0xc250('0x1b')](this[_0xc250('0xe')],function(_0x32bd77){return _0x32bd77['accountcode']==_0x5a68d5||_0x32bd77[_0xc250('0x1d')]==_0x5a68d5;});if(_0x38607b){_0x252672=_[_0xc250('0x1b')](this[_0xc250('0xd')],function(_0x256792){return _0x256792[_0xc250('0x1f')]==util[_0xc250('0x20')](_0xc250('0x21'),_0x38607b[_0xc250('0x1d')]);});}}return _0x252672;};Report['prototype'][_0xc250('0x22')]=function(_0x3786e4){for(var _0x1fa912=0x0;_0x1fa912<_0x3786e4[_0xc250('0x23')];_0x1fa912+=0x1){var _0x4b785e=this['findAgent'](_0x3786e4[_0x1fa912]['connectedlinenum']);if(_0x4b785e){_0x3786e4[_0x1fa912][_0xc250('0x1c')]=_0x4b785e[_0xc250('0x1c')];_0x3786e4[_0x1fa912]['assigned']=!![];_0x3786e4[_0x1fa912][_0xc250('0x24')]=_0x4b785e[_0xc250('0x1d')];_0x3786e4[_0x1fa912][_0xc250('0x1f')]=_['isNil'](_0x4b785e[_0xc250('0x1f')])?util[_0xc250('0x20')]('SIP/%s',_0x4b785e[_0xc250('0x1d')]):_0x4b785e[_0xc250('0x1f')];if(_0x3786e4[_0x1fa912][_0xc250('0x25')]){_0x3786e4[_0x1fa912][_0xc250('0x26')]=moment()[_0xc250('0x20')](_0xc250('0x27'));}if(_0x3786e4[_0x1fa912][_0xc250('0x28')]){_0x3786e4[_0x1fa912][_0xc250('0x29')]=moment()[_0xc250('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc250('0x22')](_0x3786e4[_0x1fa912]);}RpcVoiceQueueReport['create'](_0x3786e4[_0x1fa912]);}};function extractCalleridNumber(_0x14d39a){var _0x1f6204=_0x14d39a[_0xc250('0x2a')](/<(.*?)>/);return _0x1f6204?_0x1f6204[0x1]:_0x14d39a;}Report[_0xc250('0x19')]['getAgentByInternal']=function(_0x48ef77){for(var _0x471ef9=0x0;_0x471ef90x0?_0x3ac5ee:0x0;this[_0x9351('0x12')][_0x429994[_0x9351('0x68')]]['talking']=this[_0x9351('0x12')][_0x429994['queue']]['talking']>_[_0x9351('0x6c')](_0x429994[_0x9351('0x6e')])?_[_0x9351('0x6c')](_0x429994[_0x9351('0x6e')]):this[_0x9351('0x12')][_0x429994[_0x9351('0x68')]][_0x9351('0x52')];this[_0x9351('0x4a')](this['voiceQueues'][_0x429994[_0x9351('0x68')]],_0x9351('0x15'));}logger[_0x9351('0x41')](_0x9351('0x6f'),util[_0x9351('0x38')](this[_0x9351('0x12')][_0x429994['queue']],{'showHidden':![],'depth':null}));ami[_0x9351('0x3f')]('custom:queuesummary',this[_0x9351('0x12')][_0x429994[_0x9351('0x68')]]);}}}catch(_0x3c3006){logger[_0x9351('0x36')](_0x9351('0x66'),util[_0x9351('0x38')](_0x3c3006,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')]['syncQueueSummaryComplete']=function(_0x145245){logger[_0x9351('0x41')](_0x9351('0x70'),util[_0x9351('0x38')](_0x145245,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x9351('0xb')][_0x9351('0x1a')]=function(_0x5ec8b4){try{if(this[_0x9351('0x60')](_0x5ec8b4)){logger[_0x9351('0x41')](_0x9351('0x71'),_0x5ec8b4[_0x9351('0x44')],util[_0x9351('0x38')](_0x5ec8b4,{'showHidden':![],'depth':null}));if(_[_0x9351('0x61')](this['queueReports'][_0x5ec8b4[_0x9351('0x44')]]))this[_0x9351('0xe')][_0x5ec8b4[_0x9351('0x44')]]=[];if(_['isUndefined'](this[_0x9351('0x10')][_0x5ec8b4[_0x9351('0x44')]]))this[_0x9351('0x10')][_0x5ec8b4[_0x9351('0x44')]]={};var _0x42bd29=new QueueReport();_0x42bd29[_0x9351('0x46')]=_0x5ec8b4[_0x9351('0x68')];_0x42bd29[_0x9351('0x54')]=this[_0x9351('0x12')][_0x42bd29['name']]&&this['voiceQueues'][_0x42bd29[_0x9351('0x46')]]['type']?this[_0x9351('0x12')][_0x42bd29['name']][_0x9351('0x54')]||_0x9351('0x4b'):_0x9351('0x4b');_0x42bd29['queue']=_0x5ec8b4['queue'];_0x42bd29[_0x9351('0x72')]=moment()[_0x9351('0x45')](_0x9351('0x73'));_0x42bd29['position']=_0x5ec8b4[_0x9351('0x74')];_0x42bd29['count']=_0x5ec8b4[_0x9351('0x75')];_0x42bd29[_0x9351('0x44')]=_0x5ec8b4[_0x9351('0x44')];_0x42bd29[_0x9351('0x76')]=this['channels'][_0x5ec8b4[_0x9351('0x44')]][_0x9351('0x76')];logger[_0x9351('0x77')](_0x9351('0x78'),_0x42bd29['name'],_0x42bd29[_0x9351('0x54')]);_[_0x9351('0x79')](_0x42bd29,_[_0x9351('0x7a')](_0x5ec8b4,_[_0x9351('0x7b')](_0x42bd29)));this['queueReports'][_0x5ec8b4[_0x9351('0x44')]][_0x9351('0x7c')](_0x42bd29);this[_0x9351('0x10')][_0x5ec8b4[_0x9351('0x44')]]=_0x42bd29;this[_0x9351('0x40')](_0x42bd29,'queuecallerjoin');}}catch(_0x1b5176){logger[_0x9351('0x36')](_0x9351('0x71'),_0x5ec8b4[_0x9351('0x44')],util[_0x9351('0x38')](_0x1b5176,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')]['syncQueueCallerAbandon']=function(_0x599b5e){try{if(this[_0x9351('0x60')](_0x599b5e)){logger[_0x9351('0x41')](_0x9351('0x7d'),_0x599b5e[_0x9351('0x44')],util[_0x9351('0x38')](_0x599b5e,{'showHidden':![],'depth':null}));if(this[_0x9351('0xe')][_0x599b5e[_0x9351('0x44')]]){var _0x362d53=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0x599b5e[_0x9351('0x44')]]);_0x362d53['queuecallercomplete']=![];_0x362d53[_0x9351('0x7f')]=null;_0x362d53[_0x9351('0x80')]=_0x599b5e[_0x9351('0x80')];_0x362d53[_0x9351('0x81')]=_0x599b5e['originalposition'];_0x362d53[_0x9351('0x82')]=!![];_0x362d53[_0x9351('0x83')]=moment()['format'](_0x9351('0x73'));_0x362d53['queuecallerexitreason']=_0x9351('0x84');_0x362d53[_0x9351('0x85')]=null;logger[_0x9351('0x77')](_0x9351('0x86'),_0x362d53[_0x9351('0x46')],_0x362d53[_0x9351('0x54')]);this[_0x9351('0x10')][_0x599b5e[_0x9351('0x44')]]=_0x362d53;this[_0x9351('0x3e')](_0x362d53,_0x9351('0x82'));}}}catch(_0x5f17e2){logger[_0x9351('0x36')]('[%s][voiceQueueReport][queuecallerabandon]',_0x599b5e[_0x9351('0x44')],util[_0x9351('0x38')](_0x5f17e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')][_0x9351('0x87')]=function(_0xc57d4c){try{if(this['isNotNull'](_0xc57d4c)){logger[_0x9351('0x41')](_0x9351('0x88'),_0xc57d4c['uniqueid'],util[_0x9351('0x38')](_0xc57d4c,{'showHidden':![],'depth':null}));if(this[_0x9351('0xe')][_0xc57d4c['uniqueid']]){var _0x67889b=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0xc57d4c[_0x9351('0x44')]]);_0x67889b[_0x9351('0x89')]=moment()[_0x9351('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x67889b[_0x9351('0x8a')]=_0xc57d4c[_0x9351('0x8a')];_0x67889b['connectedlinename']=_0xc57d4c[_0x9351('0x8b')];logger[_0x9351('0x77')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x67889b[_0x9351('0x46')],_0x67889b[_0x9351('0x54')],_0xc57d4c[_0x9351('0x8a')],_0xc57d4c[_0x9351('0x8b')]);this[_0x9351('0x10')][_0xc57d4c[_0x9351('0x44')]]=_0x67889b;this[_0x9351('0x40')](_0x67889b,_0x9351('0x1c'));}}}catch(_0x5a77ac){logger[_0x9351('0x36')]('[%s][voiceQueueReport][queuecallerleave]',_0xc57d4c[_0x9351('0x44')],util[_0x9351('0x38')](_0x5a77ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')][_0x9351('0x8c')]=function(_0x5d3769){try{if(this[_0x9351('0x60')](_0x5d3769)){logger[_0x9351('0x41')]('[%s][voiceQueueReport][agentconnect]',_0x5d3769['uniqueid'],util['inspect'](_0x5d3769,{'showHidden':![],'depth':null}));if(this[_0x9351('0xe')][_0x5d3769['uniqueid']]){var _0x5c3cfe=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0x5d3769[_0x9351('0x44')]]);_0x5c3cfe[_0x9351('0x8d')]=!![];_0x5c3cfe['queuecallerexitreason']=_0x9351('0x8e');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5c3cfe[_0x9351('0x46')],_0x5c3cfe['type']);}}}catch(_0x1a4661){logger['error'](_0x9351('0x8f'),_0x5d3769[_0x9351('0x44')],util['inspect'](_0x1a4661,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')]['syncAgentComplete']=function(_0x36942e){try{if(this[_0x9351('0x60')](_0x36942e)){logger[_0x9351('0x41')](_0x9351('0x90'),_0x36942e[_0x9351('0x44')],util[_0x9351('0x38')](_0x36942e,{'showHidden':![],'depth':null}));if(this[_0x9351('0xe')][_0x36942e['uniqueid']]){var _0x3e7622=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0x36942e['uniqueid']]);_0x3e7622['queuecallerabandon']=![];_0x3e7622[_0x9351('0x83')]=null;_0x3e7622[_0x9351('0x91')]=!![];_0x3e7622[_0x9351('0x85')]=_0x36942e[_0x9351('0x92')];_0x3e7622['holdtime']=_0x36942e['holdtime'];_0x3e7622['queuecallercomplete']=!![];_0x3e7622[_0x9351('0x93')]=![];_0x3e7622[_0x9351('0x94')]=null;if(!_0x3e7622[_0x9351('0x95')]){if(_0x36942e[_0x9351('0x96')]==_0x9351('0x95')){_0x3e7622[_0x9351('0x48')]=_0x9351('0x97');logger[_0x9351('0x77')](_0x9351('0x98'),_0x3e7622[_0x9351('0x46')],_0x3e7622[_0x9351('0x54')]);}else{if(_['startsWith'](_0x36942e['channel'][_0x9351('0x99')](),_0x9351('0x9a'))){if(this[_0x9351('0xe')][_0x36942e['linkedid']]){var _0x25b26f=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0x36942e[_0x9351('0x9b')]]);_0x25b26f[_0x9351('0x8d')]=![];_0x25b26f[_0x9351('0x93')]=!![];_0x25b26f[_0x9351('0x94')]=moment(_0x3e7622['queuecallerjoinAt'])[_0x9351('0x9c')](_0x36942e['holdtime'],_0x9351('0x9d'))[_0x9351('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x25b26f[_0x9351('0x48')]=_0x9351('0x9e');_0x25b26f[_0x9351('0x95')]=!![];_0x25b26f[_0x9351('0x9f')]='FORWARD';_0x25b26f[_0x9351('0xa0')]=_0x36942e['destexten'];_0x25b26f[_0x9351('0xa1')]=_0x36942e[_0x9351('0x44')];logger[_0x9351('0x77')](_0x9351('0xa2'),_0x25b26f[_0x9351('0x46')],_0x25b26f['type']);var _0x3f0e2a=this[_0x9351('0xe')][_0x36942e[_0x9351('0x9b')]];this[_0x9351('0xe')][_0x36942e['linkedid']]=this[_0x9351('0xe')][_0x36942e['uniqueid']];this[_0x9351('0xe')][_0x36942e[_0x9351('0x44')]]=_0x3f0e2a;}}else{_0x3e7622[_0x9351('0x48')]=_0x9351('0xa3')+_0x36942e[_0x9351('0x96')]['toUpperCase']();logger[_0x9351('0x77')](_0x9351('0xa4'),_0x3e7622[_0x9351('0x46')],_0x3e7622[_0x9351('0x54')],_0x3e7622[_0x9351('0x48')]);}}}this[_0x9351('0x10')][_0x36942e[_0x9351('0x44')]]=_0x3e7622;this['emitVoiceQueueChannelRemove'](_0x3e7622,_0x9351('0xa5'));}}}catch(_0x3fbcc7){logger[_0x9351('0x36')](_0x9351('0x90'),_0x36942e[_0x9351('0x44')],util['inspect'](_0x3fbcc7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')]['syncVarSet']=function(_0xad8419){try{if(this[_0x9351('0x60')](_0xad8419)){logger[_0x9351('0x41')](_0x9351('0xa6'),_0xad8419['uniqueid'],util[_0x9351('0x38')](_0xad8419,{'showHidden':![],'depth':null}));this['addVariable'](_0xad8419['uniqueid'],_[_0x9351('0x7b')](_0xad8419[_0x9351('0xa7')])[0x0],_0xad8419[_0x9351('0xa8')]);if(this[_0x9351('0xe')][_0xad8419[_0x9351('0x44')]]){var _0x2bdad5=_[_0x9351('0x7e')](this[_0x9351('0xe')][_0xad8419[_0x9351('0x44')]]);if(_0x2bdad5){if(this[_0x9351('0x60')](_0xad8419[_0x9351('0xa7')])&&this[_0x9351('0x60')](_0xad8419[_0x9351('0xa7')][_0x9351('0xa9')])){switch(_0xad8419[_0x9351('0xa8')]){case _0x9351('0xaa'):_0x2bdad5[_0x9351('0x93')]=![];_0x2bdad5['queuecallerexitAt']=null;break;case _0x9351('0xab'):_0x2bdad5[_0x9351('0xac')]=_0x9351('0xad');_0x2bdad5[_0x9351('0x93')]=!![];_0x2bdad5[_0x9351('0x94')]=moment()[_0x9351('0x45')](_0x9351('0x73'));_0x2bdad5[_0x9351('0x89')]=moment()[_0x9351('0x45')](_0x9351('0x73'));logger[_0x9351('0x41')](_0x9351('0xae'),_0xad8419[_0x9351('0x44')],util[_0x9351('0x38')](_0x2bdad5,{'showHidden':![],'depth':null}));ami[_0x9351('0x3f')](_0x9351('0xaf'),_0x2bdad5);break;default:_0x2bdad5[_0x9351('0x93')]=!![];_0x2bdad5[_0x9351('0x94')]=moment()['format'](_0x9351('0x73'));_0x2bdad5[_0x9351('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2bdad5['queuecallerabandon']=![];_0x2bdad5[_0x9351('0x83')]=null;_0x2bdad5[_0x9351('0x48')]=_0xad8419['value'];this[_0x9351('0x10')][_0xad8419[_0x9351('0x44')]]=_0x2bdad5;this[_0x9351('0x3e')](_0x2bdad5,_0x9351('0x1f'));}else if(this[_0x9351('0x60')](_0xad8419[_0x9351('0xa7')])&&this[_0x9351('0x60')](_0xad8419[_0x9351('0xa7')][_0x9351('0xb0')])){if(!_0x2bdad5[_0x9351('0x82')]){_0x2bdad5[_0x9351('0x93')]=!![];_0x2bdad5[_0x9351('0x94')]=moment()[_0x9351('0x45')](_0x9351('0x73'));_0x2bdad5[_0x9351('0x48')]=_0x9351('0xb1');_0x2bdad5[_0x9351('0x89')]=moment()[_0x9351('0x45')](_0x9351('0x73'));this[_0x9351('0x10')][_0xad8419[_0x9351('0x44')]]=_0x2bdad5;}}logger[_0x9351('0x77')](_0x9351('0xb2'),_0xad8419[_0x9351('0x44')],_0x2bdad5[_0x9351('0x46')],_0x2bdad5[_0x9351('0x54')],_[_0x9351('0x7b')](_0xad8419[_0x9351('0xa7')])[0x0],_0xad8419[_0x9351('0xa8')]);_0x2bdad5['variables']=this[_0x9351('0x14')][_0xad8419[_0x9351('0x44')]];}}}}catch(_0x10539a){logger['error'](_0x9351('0xa6'),_0xad8419[_0x9351('0x44')],util[_0x9351('0x38')](_0x10539a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9351('0xb')][_0x9351('0xb3')]=function(_0x36f222,_0x1519b0,_0x5247f9){var _0xecc938=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x9351('0xb4'),'rtpaudioqosloss',_0x9351('0xb5'),_0x9351('0xb6'),_0x9351('0xb7'),'sipcallid',_0x9351('0xb8'),_0x9351('0xb9'),'bridgepvtcallid','membercalls',_0x9351('0xba'),_0x9351('0xbb'),'memberlastcall',_0x9351('0x92'),_0x9351('0xbc'),'memberrealtime'];if(!_[_0x9351('0xbd')](_0x1519b0)&&!_[_0x9351('0xbe')](_0xecc938,_0x1519b0)){if(_[_0x9351('0x61')](this[_0x9351('0x14')][_0x36f222])){this[_0x9351('0x14')][_0x36f222]={};}this['variables'][_0x36f222][_0x1519b0]=_0x5247f9;}};VoiceQueueReport['prototype'][_0x9351('0xbf')]=function(_0x271396){try{if(this[_0x9351('0x60')](_0x271396)){logger[_0x9351('0x41')](_0x9351('0xc0'),_0x271396[_0x9351('0x44')],util['inspect'](_0x271396,{'showHidden':![],'depth':null}));if(this[_0x9351('0xe')][_0x271396[_0x9351('0x44')]]){for(var _0x14f80e=0x0,_0x11be8c={};_0x14f80e0x0?_0x42b2fb:0x0;this[_0xdbd2('0x14')][_0xc3396d[_0xdbd2('0x6b')]][_0xdbd2('0x31')]=this[_0xdbd2('0x14')][_0xc3396d[_0xdbd2('0x6b')]]['talking']>_[_0xdbd2('0x6d')](_0xc3396d['loggedin'])?_[_0xdbd2('0x6d')](_0xc3396d[_0xdbd2('0x70')]):this['voiceQueues'][_0xc3396d[_0xdbd2('0x6b')]]['talking'];this[_0xdbd2('0x4f')](this['voiceQueues'][_0xc3396d['queue']],_0xdbd2('0x17'));}logger[_0xdbd2('0x45')](_0xdbd2('0x71'),util[_0xdbd2('0x3d')](this[_0xdbd2('0x14')][_0xc3396d[_0xdbd2('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xdbd2('0x43')](_0xdbd2('0x72'),this[_0xdbd2('0x14')][_0xc3396d[_0xdbd2('0x6b')]]);}}}catch(_0x52a0a3){logger['error']('[voiceQueueReport][queuesummary]',util[_0xdbd2('0x3d')](_0x52a0a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0x73')]=function(_0x18821c){logger['debug'](_0xdbd2('0x74'),util[_0xdbd2('0x3d')](_0x18821c,{'showHidden':![],'depth':null}));this[_0xdbd2('0x15')]=!![];};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0x75')]=function(_0x2ca9b2){try{if(this[_0xdbd2('0x62')](_0x2ca9b2)){logger[_0xdbd2('0x45')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2ca9b2[_0xdbd2('0x47')],util['inspect'](_0x2ca9b2,{'showHidden':![],'depth':null}));if(_[_0xdbd2('0x63')](this[_0xdbd2('0x10')][_0x2ca9b2[_0xdbd2('0x47')]]))this[_0xdbd2('0x10')][_0x2ca9b2['uniqueid']]=[];if(_[_0xdbd2('0x63')](this['channels'][_0x2ca9b2[_0xdbd2('0x47')]]))this[_0xdbd2('0x12')][_0x2ca9b2[_0xdbd2('0x47')]]={};var _0x4b205e=new QueueReport();_0x4b205e[_0xdbd2('0x49')]=_0x2ca9b2[_0xdbd2('0x6b')];_0x4b205e[_0xdbd2('0x50')]=this[_0xdbd2('0x14')][_0x4b205e['name']]&&this[_0xdbd2('0x14')][_0x4b205e[_0xdbd2('0x49')]][_0xdbd2('0x50')]?this['voiceQueues'][_0x4b205e[_0xdbd2('0x49')]][_0xdbd2('0x50')]||_0xdbd2('0x51'):_0xdbd2('0x51');_0x4b205e[_0xdbd2('0x6b')]=_0x2ca9b2[_0xdbd2('0x6b')];_0x4b205e[_0xdbd2('0x76')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));_0x4b205e[_0xdbd2('0x78')]=_0x2ca9b2[_0xdbd2('0x78')];_0x4b205e[_0xdbd2('0x79')]=_0x2ca9b2[_0xdbd2('0x79')];_0x4b205e['uniqueid']=_0x2ca9b2['uniqueid'];_0x4b205e[_0xdbd2('0x7a')]=this[_0xdbd2('0x12')][_0x2ca9b2[_0xdbd2('0x47')]]['routealias'];logger[_0xdbd2('0x69')](_0xdbd2('0x7b'),_0x4b205e[_0xdbd2('0x49')],_0x4b205e[_0xdbd2('0x50')]);_[_0xdbd2('0x7c')](_0x4b205e,_[_0xdbd2('0x7d')](_0x2ca9b2,_[_0xdbd2('0x7e')](_0x4b205e)));this[_0xdbd2('0x10')][_0x2ca9b2[_0xdbd2('0x47')]][_0xdbd2('0x7f')](_0x4b205e);this[_0xdbd2('0x12')][_0x2ca9b2[_0xdbd2('0x47')]]=_0x4b205e;this[_0xdbd2('0x44')](_0x4b205e,'queuecallerjoin');}}catch(_0x4250b5){logger[_0xdbd2('0x3b')](_0xdbd2('0x80'),_0x2ca9b2[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x4250b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0x1d')]=function(_0x4b2364){try{if(this[_0xdbd2('0x62')](_0x4b2364)){logger['debug'](_0xdbd2('0x81'),_0x4b2364[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x4b2364,{'showHidden':![],'depth':null}));if(this[_0xdbd2('0x10')][_0x4b2364[_0xdbd2('0x47')]]){var _0x15b64a=_[_0xdbd2('0x82')](this[_0xdbd2('0x10')][_0x4b2364[_0xdbd2('0x47')]]);_0x15b64a[_0xdbd2('0x83')]=![];_0x15b64a[_0xdbd2('0x84')]=null;_0x15b64a[_0xdbd2('0x85')]=_0x4b2364[_0xdbd2('0x85')];_0x15b64a[_0xdbd2('0x86')]=_0x4b2364['originalposition'];_0x15b64a[_0xdbd2('0x1c')]=!![];_0x15b64a[_0xdbd2('0x87')]=moment()['format'](_0xdbd2('0x77'));_0x15b64a[_0xdbd2('0x4b')]=_0xdbd2('0x88');_0x15b64a[_0xdbd2('0x89')]=null;logger['info'](_0xdbd2('0x8a'),_0x15b64a['name'],_0x15b64a['type']);this[_0xdbd2('0x12')][_0x4b2364['uniqueid']]=_0x15b64a;this[_0xdbd2('0x42')](_0x15b64a,_0xdbd2('0x1c'));}}}catch(_0x221263){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x4b2364[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x221263,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0x1f')]=function(_0x2320d7){try{if(this[_0xdbd2('0x62')](_0x2320d7)){logger[_0xdbd2('0x45')](_0xdbd2('0x8b'),_0x2320d7[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x2320d7,{'showHidden':![],'depth':null}));if(this[_0xdbd2('0x10')][_0x2320d7[_0xdbd2('0x47')]]){var _0x4ac5bc=_['last'](this['queueReports'][_0x2320d7['uniqueid']]);_0x4ac5bc[_0xdbd2('0x8c')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));_0x4ac5bc['connectedlinenum']=_0x2320d7[_0xdbd2('0x8d')];_0x4ac5bc[_0xdbd2('0x8e')]=_0x2320d7[_0xdbd2('0x8e')];logger[_0xdbd2('0x69')](_0xdbd2('0x8f'),_0x4ac5bc['name'],_0x4ac5bc[_0xdbd2('0x50')],_0x2320d7['connectedlinenum'],_0x2320d7[_0xdbd2('0x8e')]);this[_0xdbd2('0x12')][_0x2320d7[_0xdbd2('0x47')]]=_0x4ac5bc;this[_0xdbd2('0x44')](_0x4ac5bc,_0xdbd2('0x1e'));}}}catch(_0x431f89){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x2320d7[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x431f89,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xdbd2('0x22')]=function(_0x94f039){try{if(this[_0xdbd2('0x62')](_0x94f039)){logger[_0xdbd2('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x94f039['uniqueid'],util[_0xdbd2('0x3d')](_0x94f039,{'showHidden':![],'depth':null}));if(this[_0xdbd2('0x10')][_0x94f039[_0xdbd2('0x47')]]){var _0x38a15c=_[_0xdbd2('0x82')](this[_0xdbd2('0x10')][_0x94f039[_0xdbd2('0x47')]]);_0x38a15c[_0xdbd2('0x83')]=!![];_0x38a15c[_0xdbd2('0x4b')]=_0xdbd2('0x90');logger[_0xdbd2('0x69')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x38a15c[_0xdbd2('0x49')],_0x38a15c['type']);}}}catch(_0x2ccc3d){logger[_0xdbd2('0x3b')](_0xdbd2('0x91'),_0x94f039[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x2ccc3d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x45c3fe){try{if(this[_0xdbd2('0x62')](_0x45c3fe)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x45c3fe['uniqueid'],util[_0xdbd2('0x3d')](_0x45c3fe,{'showHidden':![],'depth':null}));if(this[_0xdbd2('0x10')][_0x45c3fe['uniqueid']]){var _0x1fa8f0=_[_0xdbd2('0x82')](this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x47')]]);_0x1fa8f0[_0xdbd2('0x1c')]=![];_0x1fa8f0[_0xdbd2('0x87')]=null;_0x1fa8f0[_0xdbd2('0x92')]=!![];_0x1fa8f0[_0xdbd2('0x89')]=_0x45c3fe['membername'];_0x1fa8f0[_0xdbd2('0x85')]=_0x45c3fe['holdtime'];_0x1fa8f0[_0xdbd2('0x83')]=!![];_0x1fa8f0[_0xdbd2('0x93')]=![];_0x1fa8f0[_0xdbd2('0x94')]=null;if(!_0x1fa8f0['transfer']){if(_0x45c3fe[_0xdbd2('0x95')]==_0xdbd2('0x96')){_0x1fa8f0[_0xdbd2('0x4b')]=_0xdbd2('0x97');logger['info'](_0xdbd2('0x98'),_0x1fa8f0[_0xdbd2('0x49')],_0x1fa8f0['type']);}else{if(_[_0xdbd2('0x99')](_0x45c3fe[_0xdbd2('0x9a')][_0xdbd2('0x9b')](),_0xdbd2('0x9c'))){if(this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x9d')]]){var _0x1c0001=_['last'](this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x9d')]]);_0x1c0001[_0xdbd2('0x83')]=![];_0x1c0001['queuecallerexit']=!![];_0x1c0001[_0xdbd2('0x94')]=moment(_0x1fa8f0[_0xdbd2('0x76')])[_0xdbd2('0x9e')](_0x45c3fe[_0xdbd2('0x85')],_0xdbd2('0x9f'))[_0xdbd2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c0001['queuecallerexitreason']=_0xdbd2('0xa0');_0x1c0001[_0xdbd2('0x96')]=!![];_0x1c0001['transfertype']=_0xdbd2('0xa1');_0x1c0001[_0xdbd2('0xa2')]=_0x45c3fe[_0xdbd2('0xa3')];_0x1c0001[_0xdbd2('0xa4')]=_0x45c3fe[_0xdbd2('0x47')];logger[_0xdbd2('0x69')](_0xdbd2('0xa5'),_0x1c0001[_0xdbd2('0x49')],_0x1c0001[_0xdbd2('0x50')]);var _0x40b772=this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x9d')]];this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x9d')]]=this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x47')]];this[_0xdbd2('0x10')][_0x45c3fe[_0xdbd2('0x47')]]=_0x40b772;}}else{_0x1fa8f0['queuecallerexitreason']='COMPLETEDBY'+_0x45c3fe[_0xdbd2('0x95')]['toUpperCase']();logger[_0xdbd2('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1fa8f0[_0xdbd2('0x49')],_0x1fa8f0[_0xdbd2('0x50')],_0x1fa8f0['queuecallerexitreason']);}}}this['channels'][_0x45c3fe[_0xdbd2('0x47')]]=_0x1fa8f0;this[_0xdbd2('0x42')](_0x1fa8f0,'agentcomplete');}}}catch(_0x2dade5){logger['error'](_0xdbd2('0xa6'),_0x45c3fe[_0xdbd2('0x47')],util['inspect'](_0x2dade5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0x24')]=function(_0x3e579a){try{if(this[_0xdbd2('0x62')](_0x3e579a)){logger[_0xdbd2('0x45')](_0xdbd2('0xa7'),_0x3e579a[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x3e579a,{'showHidden':![],'depth':null}));this['addVariable'](_0x3e579a[_0xdbd2('0x47')],_[_0xdbd2('0x7e')](_0x3e579a[_0xdbd2('0xa8')])[0x0],_0x3e579a[_0xdbd2('0xa9')]);if(this[_0xdbd2('0x10')][_0x3e579a[_0xdbd2('0x47')]]){var _0x204566=_['last'](this[_0xdbd2('0x10')][_0x3e579a[_0xdbd2('0x47')]]);if(_0x204566){if(this[_0xdbd2('0x62')](_0x3e579a['variable'])&&this['isNotNull'](_0x3e579a[_0xdbd2('0xa8')][_0xdbd2('0xaa')])){switch(_0x3e579a[_0xdbd2('0xa9')]){case'CONTINUE':_0x204566['queuecallerexit']=![];_0x204566[_0xdbd2('0x94')]=null;break;case _0xdbd2('0xab'):_0x204566[_0xdbd2('0xac')]='timeout';_0x204566['queuecallerexit']=!![];_0x204566[_0xdbd2('0x94')]=moment()[_0xdbd2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x204566[_0xdbd2('0x8c')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));logger[_0xdbd2('0x45')](_0xdbd2('0xad'),_0x3e579a[_0xdbd2('0x47')],util['inspect'](_0x204566,{'showHidden':![],'depth':null}));ami[_0xdbd2('0x43')](_0xdbd2('0xae'),_0x204566);break;default:_0x204566[_0xdbd2('0x93')]=!![];_0x204566[_0xdbd2('0x94')]=moment()['format'](_0xdbd2('0x77'));_0x204566[_0xdbd2('0x8c')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));}_0x204566[_0xdbd2('0x1c')]=![];_0x204566['queuecallerabandonAt']=null;_0x204566[_0xdbd2('0x4b')]=_0x3e579a[_0xdbd2('0xa9')];this[_0xdbd2('0x12')][_0x3e579a[_0xdbd2('0x47')]]=_0x204566;this[_0xdbd2('0x42')](_0x204566,'varset');}else if(this[_0xdbd2('0x62')](_0x3e579a[_0xdbd2('0xa8')])&&this[_0xdbd2('0x62')](_0x3e579a[_0xdbd2('0xa8')]['queueposition'])){if(!_0x204566[_0xdbd2('0x1c')]){_0x204566[_0xdbd2('0x93')]=!![];_0x204566[_0xdbd2('0x94')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));_0x204566[_0xdbd2('0x4b')]=_0xdbd2('0xaf');_0x204566[_0xdbd2('0x8c')]=moment()[_0xdbd2('0x48')](_0xdbd2('0x77'));this['channels'][_0x3e579a['uniqueid']]=_0x204566;}}logger[_0xdbd2('0x69')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3e579a[_0xdbd2('0x47')],_0x204566[_0xdbd2('0x49')],_0x204566[_0xdbd2('0x50')],_[_0xdbd2('0x7e')](_0x3e579a['variable'])[0x0],_0x3e579a[_0xdbd2('0xa9')]);_0x204566[_0xdbd2('0x16')]=this[_0xdbd2('0x16')][_0x3e579a[_0xdbd2('0x47')]];}}}}catch(_0x999ff7){logger[_0xdbd2('0x3b')](_0xdbd2('0xa7'),_0x3e579a[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x999ff7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xdbd2('0xb0')]=function(_0x3ee149,_0x1d462a,_0x543be1){var _0xa0448=[_0xdbd2('0xb1'),'rtpaudioqosbridged',_0xdbd2('0xb2'),_0xdbd2('0xb3'),_0xdbd2('0xb4'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xdbd2('0xb5'),_0xdbd2('0xb6'),_0xdbd2('0xb7'),_0xdbd2('0xb8'),_0xdbd2('0xb9'),_0xdbd2('0xba'),_0xdbd2('0xbb'),_0xdbd2('0xbc'),'memberpenalty','memberrealtime'];if(!_[_0xdbd2('0x37')](_0x1d462a)&&!_[_0xdbd2('0xbd')](_0xa0448,_0x1d462a)){if(_[_0xdbd2('0x63')](this[_0xdbd2('0x16')][_0x3ee149])){this[_0xdbd2('0x16')][_0x3ee149]={};}this[_0xdbd2('0x16')][_0x3ee149][_0x1d462a]=_0x543be1;}};VoiceQueueReport[_0xdbd2('0xb')][_0xdbd2('0xbe')]=function(_0x5700c9){try{if(this['isNotNull'](_0x5700c9)){logger[_0xdbd2('0x45')]('[%s][voiceQueueReport][hangup]',_0x5700c9[_0xdbd2('0x47')],util[_0xdbd2('0x3d')](_0x5700c9,{'showHidden':![],'depth':null}));if(this[_0xdbd2('0x10')][_0x5700c9[_0xdbd2('0x47')]]){for(var _0x1073b3=0x0,_0x16aed2={};_0x1073b3=0x0?moment(_0x3af771[_0xe9c1('0x1b')])[_0xe9c1('0x10')](_0x3af771['starttime'],_0xe9c1('0x11')):null,'data1':_0xe9c1('0x1c'),'data2':_0x3af771[_0xe9c1('0x17')],'data3':_0x3af771[_0xe9c1('0x14')],'data4':_0x3af771[_0xe9c1('0x1d')]||null,'role':_0xe9c1('0x16'),'internal':_0x3af771[_0xe9c1('0x17')]?_[_0xe9c1('0x1e')](_0x3af771[_0xe9c1('0x17')]):undefined,'uniqueid':_0x3af771['uniqueid']},'log':_0xe9c1('0x7')});}; \ No newline at end of file +var _0xac94=['SIP/%s','lastAssignedTo','interface','queuecallerleaveAt','diff','seconds','calleridnum','queue','agent','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','endtime','outbound','dialstring','accountcode','moment','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','voice'];(function(_0x59f691,_0x1b656d){var _0x1f80bb=function(_0x1df45b){while(--_0x1df45b){_0x59f691['push'](_0x59f691['shift']());}};_0x1f80bb(++_0x1b656d);}(_0xac94,0x18e));var _0x4ac9=function(_0xfda4e2,_0x5d9621){_0xfda4e2=_0xfda4e2-0x0;var _0x48683e=_0xac94[_0xfda4e2];return _0x48683e;};'use strict';var moment=require(_0x4ac9('0x0'));var _=require('lodash');var util=require(_0x4ac9('0x1'));var client=require(_0x4ac9('0x2'));exports['voiceQueueReport']=function(_0x4738b2){var _0x45ca6a=_0x4738b2[_0x4ac9('0x3')]||_0x4738b2[_0x4ac9('0x4')];return client[_0x4ac9('0x5')]('CreateMemberReport',{'body':{'channel':_0x4ac9('0x6'),'membername':_0x4738b2['lastAssignedTo'],'interface':_['isNil'](_0x4738b2['interface'])?util['format'](_0x4ac9('0x7'),_0x4738b2[_0x4ac9('0x8')]):_0x4738b2[_0x4ac9('0x9')],'type':'TALKING','enterAt':_0x4738b2[_0x4ac9('0xa')],'exitAt':_0x45ca6a,'duration':moment(_0x45ca6a)[_0x4ac9('0xb')](_0x4738b2[_0x4ac9('0xa')],_0x4ac9('0xc')),'data1':'inbound','data2':_0x4738b2[_0x4ac9('0xd')],'data3':_0x4738b2['exten'],'data4':null,'data5':_0x4738b2[_0x4ac9('0xe')],'role':_0x4ac9('0xf'),'internal':_0x4738b2['accountcode']?_[_0x4ac9('0x10')](_0x4738b2['accountcode']):undefined,'uniqueid':_0x4738b2[_0x4ac9('0x11')]},'log':_0x4ac9('0x12')});};exports[_0x4ac9('0x13')]=function(_0x16c4d5){return client['Request'](_0x4ac9('0x12'),{'body':{'channel':_0x4ac9('0x6'),'membername':_0x16c4d5[_0x4ac9('0x14')],'interface':_0x16c4d5['interface'],'type':_0x4ac9('0x15'),'enterAt':_0x16c4d5[_0x4ac9('0x16')],'exitAt':_0x16c4d5['endtime'],'duration':moment(_0x16c4d5[_0x4ac9('0x17')])[_0x4ac9('0xb')](_0x16c4d5[_0x4ac9('0x16')],_0x4ac9('0xc'))>=0x0?moment(_0x16c4d5[_0x4ac9('0x17')])[_0x4ac9('0xb')](_0x16c4d5[_0x4ac9('0x16')],'seconds'):null,'data1':_0x4ac9('0x18'),'data2':_0x16c4d5['accountcode'],'data3':_0x16c4d5['exten'],'data4':_0x16c4d5[_0x4ac9('0x19')]||null,'role':'agent','internal':_0x16c4d5[_0x4ac9('0x1a')]?_[_0x4ac9('0x10')](_0x16c4d5[_0x4ac9('0x1a')]):undefined,'uniqueid':_0x16c4d5['uniqueid']},'log':_0x4ac9('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index cf27f64..e40f268 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 _0x153c=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0xe4dd6d,_0x3f809d){var _0x2720e4=function(_0x174c11){while(--_0x174c11){_0xe4dd6d['push'](_0xe4dd6d['shift']());}};_0x2720e4(++_0x3f809d);}(_0x153c,0x8c));var _0xc153=function(_0x3ea7d1,_0xb45e2a){_0x3ea7d1=_0x3ea7d1-0x0;var _0x4e2e72=_0x153c[_0x3ea7d1];return _0x4e2e72;};'use strict';var client=require(_0xc153('0x0'));exports[_0xc153('0x1')]=function(){return client[_0xc153('0x2')](_0xc153('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xc153('0x4')]},'log':_0xc153('0x5')});}; \ No newline at end of file +var _0xd53c=['stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd53c,0xe6));var _0xcd53=function(_0x3e0e53,_0x3ed8fe){_0x3e0e53=_0x3e0e53-0x0;var _0x394f1e=_0xd53c[_0x3e0e53];return _0x394f1e;};'use strict';var client=require(_0xcd53('0x0'));exports[_0xcd53('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcd53('0x2'),_0xcd53('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2f9e8ea..dc1e14d 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 _0xd7da=['Request','GetTemplate','name','html'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0xd7da,0xec));var _0xad7d=function(_0x2daff6,_0x18a06f){_0x2daff6=_0x2daff6-0x0;var _0x19a3d6=_0xd7da[_0x2daff6];return _0x19a3d6;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3e9218){return function(_0x2f8c95){return client[_0xad7d('0x0')](_0xad7d('0x1'),{'options':{'raw':!![],'attributes':['id',_0xad7d('0x2'),_0xad7d('0x3')]},'log':_0xad7d('0x1')});};}; \ No newline at end of file +var _0xdaf9=['html','GetTemplate','../client','getTemplates','Request'];(function(_0x53f901,_0x151045){var _0x3ef860=function(_0x115bad){while(--_0x115bad){_0x53f901['push'](_0x53f901['shift']());}};_0x3ef860(++_0x151045);}(_0xdaf9,0xac));var _0x9daf=function(_0x4632c2,_0x5b3d6d){_0x4632c2=_0x4632c2-0x0;var _0x219724=_0xdaf9[_0x4632c2];return _0x219724;};'use strict';var client=require(_0x9daf('0x0'));exports[_0x9daf('0x1')]=function(_0x314ced){return function(_0x5cf444){return client[_0x9daf('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x9daf('0x3')]},'log':_0x9daf('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8589504..a33be08 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 _0xaebb=['AnyConditions','Actions','action','data1','data2','data4','data5','data7','getTriggers','Request','GetTrigger','channel','status','AllConditions','field','operator','value'];(function(_0x5d55a4,_0x5a6073){var _0x354354=function(_0x17dc3a){while(--_0x17dc3a){_0x5d55a4['push'](_0x5d55a4['shift']());}};_0x354354(++_0x5a6073);}(_0xaebb,0x17e));var _0xbaeb=function(_0x426267,_0x422e6e){_0x426267=_0x426267-0x0;var _0x59e163=_0xaebb[_0x426267];return _0x59e163;};'use strict';var client=require('../client');exports[_0xbaeb('0x0')]=function(_0x59ee54){return function(_0x3aacc9){return client[_0xbaeb('0x1')](_0xbaeb('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbaeb('0x3'),_0xbaeb('0x4')],'include':[{'model':'Condition','as':_0xbaeb('0x5'),'attributes':['id',_0xbaeb('0x6'),_0xbaeb('0x7'),_0xbaeb('0x8')]},{'model':'Condition','as':_0xbaeb('0x9'),'attributes':['id',_0xbaeb('0x6'),_0xbaeb('0x7'),_0xbaeb('0x8')]},{'model':'Action','as':_0xbaeb('0xa'),'attributes':['id',_0xbaeb('0xb'),_0xbaeb('0xc'),_0xbaeb('0xd'),'data3',_0xbaeb('0xe'),_0xbaeb('0xf'),'data6',_0xbaeb('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x2acb=['action','data1','data2','data3','data4','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','Action'];(function(_0x1ecf26,_0x5c752b){var _0x2aff1a=function(_0x2b7af8){while(--_0x2b7af8){_0x1ecf26['push'](_0x1ecf26['shift']());}};_0x2aff1a(++_0x5c752b);}(_0x2acb,0x1ec));var _0xb2ac=function(_0x5a517c,_0x3fbb6d){_0x5a517c=_0x5a517c-0x0;var _0x290bf4=_0x2acb[_0x5a517c];return _0x290bf4;};'use strict';var client=require(_0xb2ac('0x0'));exports[_0xb2ac('0x1')]=function(_0x38a43b){return function(_0x1c5e1e){return client[_0xb2ac('0x2')](_0xb2ac('0x3'),{'options':{'raw':![],'attributes':['id',_0xb2ac('0x4'),_0xb2ac('0x5'),_0xb2ac('0x6')],'include':[{'model':_0xb2ac('0x7'),'as':_0xb2ac('0x8'),'attributes':['id',_0xb2ac('0x9'),_0xb2ac('0xa'),'value']},{'model':_0xb2ac('0x7'),'as':'AnyConditions','attributes':['id',_0xb2ac('0x9'),_0xb2ac('0xa'),'value']},{'model':_0xb2ac('0xb'),'as':'Actions','attributes':['id',_0xb2ac('0xc'),_0xb2ac('0xd'),_0xb2ac('0xe'),_0xb2ac('0xf'),_0xb2ac('0x10'),'data5',_0xb2ac('0x11'),'data7']}]},'log':_0xb2ac('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f50d24d..c6c99ce 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 _0x3378=['Request','GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0x3378,0xc2));var _0x8337=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x3378[_0x671369];return _0x33f2b4;};'use strict';var client=require(_0x8337('0x0'));exports[_0x8337('0x1')]=function(_0x12f448){return function(_0x1331e4){return client[_0x8337('0x2')](_0x8337('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8337('0x4'),_0x8337('0x5'),_0x8337('0x6')]},'log':_0x8337('0x3')});};}; \ No newline at end of file +var _0xcbcc=['../client','Request','name','registry','defaultuser','GetTrunk'];(function(_0x529c6a,_0x1b6bbf){var _0x4ca96a=function(_0x1f0dc9){while(--_0x1f0dc9){_0x529c6a['push'](_0x529c6a['shift']());}};_0x4ca96a(++_0x1b6bbf);}(_0xcbcc,0x198));var _0xccbc=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xcbcc[_0x12fc8d];return _0x3f9d04;};'use strict';var client=require(_0xccbc('0x0'));exports['getTrunks']=function(_0x57770f){return function(_0x362ea2){return client[_0xccbc('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xccbc('0x2'),_0xccbc('0x3'),_0xccbc('0x4')]},'log':_0xccbc('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2acaa20..92c99c4 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +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(_0x2ef9d3,_0x32f2d3){var _0x334811=function(_0x463aff){while(--_0x463aff){_0x2ef9d3['push'](_0x2ef9d3['shift']());}};_0x334811(++_0x32f2d3);}(_0xedd9,0xfc));var _0x9edd=function(_0x5eb296,_0x5bf221){_0x5eb296=_0x5eb296-0x0;var _0x45be38=_0xedd9[_0x5eb296];return _0x45be38;};'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 cdac14f..f4953ca 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 _0xe932=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x218ea3,_0x36f59c){var _0x49265e=function(_0x2f18e8){while(--_0x2f18e8){_0x218ea3['push'](_0x218ea3['shift']());}};_0x49265e(++_0x36f59c);}(_0xe932,0x9f));var _0x2e93=function(_0x4bf198,_0x79e7aa){_0x4bf198=_0x4bf198-0x0;var _0x5cf508=_0xe932[_0x4bf198];return _0x5cf508;};'use strict';var client=require(_0x2e93('0x0'));exports[_0x2e93('0x1')]=function(_0x300c68){return client[_0x2e93('0x2')](_0x2e93('0x3'),{'body':_0x300c68,'log':_0x2e93('0x3')});};exports[_0x2e93('0x4')]=function(_0x275f4b,_0x4653de,_0x7c489a){return client[_0x2e93('0x2')](_0x2e93('0x5'),{'body':_0x275f4b,'options':{'where':{'uniqueid':_0x4653de,'interface':_0x7c489a,'agentcomplete':!![]}},'log':_0x2e93('0x5')});}; \ No newline at end of file +var _0x2a18=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x2adb04,_0x4d4356){var _0x3c1bca=function(_0x5e3b88){while(--_0x5e3b88){_0x2adb04['push'](_0x2adb04['shift']());}};_0x3c1bca(++_0x4d4356);}(_0x2a18,0x141));var _0x82a1=function(_0x20b1ca,_0xcaa99b){_0x20b1ca=_0x20b1ca-0x0;var _0x13a457=_0x2a18[_0x20b1ca];return _0x13a457;};'use strict';var client=require(_0x82a1('0x0'));exports[_0x82a1('0x1')]=function(_0x32539a){return client[_0x82a1('0x2')](_0x82a1('0x3'),{'body':_0x32539a,'log':_0x82a1('0x3')});};exports[_0x82a1('0x4')]=function(_0x1eb741,_0x515569,_0x192a0b){return client[_0x82a1('0x2')](_0x82a1('0x5'),{'body':_0x1eb741,'options':{'where':{'uniqueid':_0x515569,'interface':_0x192a0b,'agentcomplete':!![]}},'log':_0x82a1('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 86a2e6c..197dfce 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 _0xb5be=['format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','moment','../client','create','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','day'];(function(_0x4aeac1,_0x40cd68){var _0x5655a0=function(_0x56b192){while(--_0x56b192){_0x4aeac1['push'](_0x4aeac1['shift']());}};_0x5655a0(++_0x40cd68);}(_0xb5be,0x149));var _0xeb5b=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb5be[_0x35885a];return _0xe86249;};'use strict';var moment=require(_0xeb5b('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xeb5b('0x1'));exports[_0xeb5b('0x2')]=function(_0x242f76){return client['Request'](_0xeb5b('0x3'),{'body':_[_0xeb5b('0x4')](_0x242f76,{'source':_0x242f76['calleridnum'],'destinationcontext':_0x242f76[_0xeb5b('0x5')],'callerid':_0x242f76[_0xeb5b('0x6')],'amaflags':_0xeb5b('0x7')}),'log':_0xeb5b('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xeb5b('0x8'),{'options':{'where':{'type':[_0xeb5b('0x9')],'createdAt':{'$between':[moment()['startOf'](_0xeb5b('0xa'))[_0xeb5b('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xeb5b('0xc')](_0xeb5b('0xa'))[_0xeb5b('0xb')](_0xeb5b('0xd'))]}},'attributes':['type',_0xeb5b('0xe'),_0xeb5b('0xf'),_0xeb5b('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xa3e9=['Request','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports'];(function(_0x2da3fe,_0x55ad2d){var _0x564b34=function(_0x1c0510){while(--_0x1c0510){_0x2da3fe['push'](_0x2da3fe['shift']());}};_0x564b34(++_0x55ad2d);}(_0xa3e9,0x6a));var _0x9a3e=function(_0x1cb769,_0xc7c9e6){_0x1cb769=_0x1cb769-0x0;var _0x4a83e5=_0xa3e9[_0x1cb769];return _0x4a83e5;};'use strict';var moment=require(_0x9a3e('0x0'));var util=require(_0x9a3e('0x1'));var _=require(_0x9a3e('0x2'));var client=require('../client');exports['create']=function(_0x191a60){return client['Request'](_0x9a3e('0x3'),{'body':_[_0x9a3e('0x4')](_0x191a60,{'source':_0x191a60['calleridnum'],'destinationcontext':_0x191a60[_0x9a3e('0x5')],'callerid':_0x191a60[_0x9a3e('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x9a3e('0x3')});};exports[_0x9a3e('0x7')]=function(){return function(){return client[_0x9a3e('0x8')](_0x9a3e('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x9a3e('0xa')]('day')[_0x9a3e('0xb')](_0x9a3e('0xc')),moment()['endOf'](_0x9a3e('0xd'))[_0x9a3e('0xb')](_0x9a3e('0xc'))]}},'attributes':[_0x9a3e('0xe'),_0x9a3e('0xf'),_0x9a3e('0x10'),_0x9a3e('0x11')]},'log':_0x9a3e('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9aad1c5..7acd01f 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 _0x2faa=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2faa,0x116));var _0xa2fa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2faa[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xa2fa('0x0'));exports[_0xa2fa('0x1')]=function(_0x400e59){return client[_0xa2fa('0x2')](_0xa2fa('0x3'),{'body':_0x400e59,'log':_0xa2fa('0x3')});}; \ No newline at end of file +var _0xc685=['CreateVoiceDialReport','../client','create'];(function(_0x12ad1b,_0x106d01){var _0x22efbb=function(_0x468f70){while(--_0x468f70){_0x12ad1b['push'](_0x12ad1b['shift']());}};_0x22efbb(++_0x106d01);}(_0xc685,0x1f0));var _0x5c68=function(_0x55dc68,_0x1b43f8){_0x55dc68=_0x55dc68-0x0;var _0x2341c4=_0xc685[_0x55dc68];return _0x2341c4;};'use strict';var client=require(_0x5c68('0x0'));exports[_0x5c68('0x1')]=function(_0x5684f4){return client['Request']('CreateVoiceDialReport',{'body':_0x5684f4,'log':_0x5c68('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d00cbb0..6ab891e 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 _0xa9e0=['getVoiceExtensions','Request','recordingFormat','../client'];(function(_0x5b5e7e,_0xaabed0){var _0x1f82d9=function(_0x64f3b4){while(--_0x64f3b4){_0x5b5e7e['push'](_0x5b5e7e['shift']());}};_0x1f82d9(++_0xaabed0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x0a9e('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x54f3=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x284d1b,_0x2c16af){var _0x4c83c0=function(_0x47c1c3){while(--_0x47c1c3){_0x284d1b['push'](_0x284d1b['shift']());}};_0x4c83c0(++_0x2c16af);}(_0x54f3,0x120));var _0x354f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x54f3[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x354f('0x0')]=function(){return function(){return client[_0x354f('0x1')](_0x354f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x354f('0x3'),_0x354f('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d6e247e..0d60575 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 _0xc7a3=['dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','Trunk','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialQueueOptions','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x3813cc,_0xd22a36){var _0xabf6c5=function(_0x1b8436){while(--_0x1b8436){_0x3813cc['push'](_0x3813cc['shift']());}};_0xabf6c5(++_0xd22a36);}(_0xc7a3,0x109));var _0x3c7a=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0xc7a3[_0x1b81ae];return _0x33ba48;};'use strict';var client=require(_0x3c7a('0x0'));exports[_0x3c7a('0x1')]=function(){return function(){return client['Request'](_0x3c7a('0x2'),{'options':{'raw':![],'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x4'),'acwTimeout',_0x3c7a('0x5'),_0x3c7a('0x6'),_0x3c7a('0x7'),_0x3c7a('0x8'),_0x3c7a('0x9'),_0x3c7a('0xa'),_0x3c7a('0xb'),_0x3c7a('0xc'),'dialPredictiveOptimization',_0x3c7a('0xd'),'dialPredictiveInterval',_0x3c7a('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x3c7a('0xf'),'dialQueueTimeout','dialQueueProject',_0x3c7a('0x10'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x3c7a('0x11'),_0x3c7a('0x12'),_0x3c7a('0x13'),_0x3c7a('0x14'),_0x3c7a('0x15'),_0x3c7a('0x16'),_0x3c7a('0x17'),'dialCheckDuplicateType',_0x3c7a('0x18'),_0x3c7a('0x19'),_0x3c7a('0x1a'),_0x3c7a('0x1b'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x3c7a('0x1c'),_0x3c7a('0x1d'),_0x3c7a('0x1e'),'dialAMDMaximumWordLength',_0x3c7a('0x1f'),'dialRecallMeTimeout',_0x3c7a('0x20'),_0x3c7a('0x21'),_0x3c7a('0x22'),_0x3c7a('0x23'),_0x3c7a('0x24'),_0x3c7a('0x6'),_0x3c7a('0x25'),_0x3c7a('0x26'),_0x3c7a('0x27'),_0x3c7a('0x28'),_0x3c7a('0x29'),'dialDropMaxRetry',_0x3c7a('0x2a'),'dialAbandonedMaxRetry',_0x3c7a('0x2b'),_0x3c7a('0x2c'),_0x3c7a('0x2d'),_0x3c7a('0x2e'),_0x3c7a('0x2f'),_0x3c7a('0x30'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x3c7a('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x3c7a('0x32'),'as':_0x3c7a('0x32'),'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x33'),'active']},{'model':_0x3c7a('0x34'),'as':_0x3c7a('0x35'),'attributes':['id',_0x3c7a('0x3')]},{'model':_0x3c7a('0x32'),'as':'TrunkBackup','attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x33'),_0x3c7a('0x36')]},{'model':'Interval','as':'Interval','attributes':['id',_0x3c7a('0x3')],'include':[{'model':_0x3c7a('0x37'),'as':_0x3c7a('0x38'),'attributes':['id',_0x3c7a('0x3'),'interval']}]}]},'log':_0x3c7a('0x1')});};}; \ No newline at end of file +var _0x8dad=['getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','Pause','mandatoryDispositionPause','active','Interval','interval','../client'];(function(_0x2cb11a,_0x27f77a){var _0xe67271=function(_0x5e4e3e){while(--_0x5e4e3e){_0x2cb11a['push'](_0x2cb11a['shift']());}};_0xe67271(++_0x27f77a);}(_0x8dad,0x19c));var _0xd8da=function(_0x953b32,_0x2d223){_0x953b32=_0x953b32-0x0;var _0x19e217=_0x8dad[_0x953b32];return _0x19e217;};'use strict';var client=require(_0xd8da('0x0'));exports[_0xd8da('0x1')]=function(){return function(){return client[_0xd8da('0x2')](_0xd8da('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd8da('0x4'),'acwTimeout',_0xd8da('0x5'),_0xd8da('0x6'),_0xd8da('0x7'),'dialActive',_0xd8da('0x8'),'dialLimitChannel','dialLimitQueue',_0xd8da('0x9'),_0xd8da('0xa'),_0xd8da('0xb'),'dialPredictiveInterval',_0xd8da('0xc'),'dialOriginateCallerIdNumber',_0xd8da('0xd'),'dialQueueOptions',_0xd8da('0xe'),_0xd8da('0xf'),_0xd8da('0x10'),_0xd8da('0x11'),'dialBusyMaxRetry',_0xd8da('0x12'),_0xd8da('0x13'),_0xd8da('0x14'),'dialGlobalMaxRetry',_0xd8da('0x15'),_0xd8da('0x16'),_0xd8da('0x17'),_0xd8da('0x18'),_0xd8da('0x19'),_0xd8da('0x1a'),_0xd8da('0x1b'),_0xd8da('0x1c'),_0xd8da('0x1d'),_0xd8da('0x1e'),_0xd8da('0x1f'),_0xd8da('0x20'),_0xd8da('0x21'),'dialAMDMaximumWordLength',_0xd8da('0x22'),_0xd8da('0x23'),_0xd8da('0x24'),'dialOrderByScheduledAt',_0xd8da('0x25'),_0xd8da('0x26'),_0xd8da('0x27'),_0xd8da('0x6'),_0xd8da('0x28'),_0xd8da('0x29'),'dialCutDigit',_0xd8da('0x2a'),_0xd8da('0x2b'),'dialDropMaxRetry','dialDropRetryFrequency',_0xd8da('0x2c'),_0xd8da('0x2d'),_0xd8da('0x2e'),_0xd8da('0x2f'),_0xd8da('0x30'),_0xd8da('0x31'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xd8da('0x32'),_0xd8da('0x33')],'include':[{'model':_0xd8da('0x34'),'as':_0xd8da('0x34'),'attributes':['id',_0xd8da('0x35'),'callerid','active']},{'model':_0xd8da('0x36'),'as':_0xd8da('0x37'),'attributes':['id',_0xd8da('0x35')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xd8da('0x35'),'callerid',_0xd8da('0x38')]},{'model':_0xd8da('0x39'),'as':'Interval','attributes':['id',_0xd8da('0x35')],'include':[{'model':_0xd8da('0x39'),'as':'Intervals','attributes':['id',_0xd8da('0x35'),_0xd8da('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 7cdb61f..289ba7d 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(_0x46e755,_0x5bf8c9){var _0x3f7eb6=function(_0x3dd0b5){while(--_0x3dd0b5){_0x46e755['push'](_0x46e755['shift']());}};_0x3f7eb6(++_0x5bf8c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x140c27,_0x2f6765){var _0x545b74=function(_0x23f3d1){while(--_0x23f3d1){_0x140c27['push'](_0x140c27['shift']());}};_0x545b74(++_0x2f6765);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 7166aca..922273b 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 _0xa097=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0xf24b97,_0x2e1781){var _0x3c6bad=function(_0x4874ec){while(--_0x4874ec){_0xf24b97['push'](_0xf24b97['shift']());}};_0x3c6bad(++_0x2e1781);}(_0xa097,0x16c));var _0x7a09=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0xa097[_0x30780e];return _0x5b9129;};'use strict';var client=require(_0x7a09('0x0'));exports[_0x7a09('0x1')]=function(_0x581645){return function(){return client['Request'](_0x7a09('0x2'),{'options':{'where':{'VoiceQueueId':_0x581645,'paused':!![]},'raw':!![]},'log':_0x7a09('0x1')});};}; \ No newline at end of file +var _0xe5bc=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0xe5bc,0xca));var _0xce5b=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xe5bc[_0x378b4];return _0x11d07b;};'use strict';var client=require(_0xce5b('0x0'));exports[_0xce5b('0x1')]=function(_0xb9fcac){return function(){return client[_0xce5b('0x2')](_0xce5b('0x3'),{'options':{'where':{'VoiceQueueId':_0xb9fcac,'paused':!![]},'raw':!![]},'log':_0xce5b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3207aa6..cc9db21 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4ff3d6,_0x265502){var _0x5bc4b5=function(_0x369b07){while(--_0x369b07){_0x4ff3d6['push'](_0x4ff3d6['shift']());}};_0x5bc4b5(++_0x265502);}(_0x7a54,0x106));var _0x47a5=function(_0x784b94,_0x269ed5){_0x784b94=_0x784b94-0x0;var _0x4192c6=_0x7a54[_0x784b94];return _0x4192c6;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x13cee6,_0x5c2fff){var _0x15957f=function(_0x2ea78f){while(--_0x2ea78f){_0x13cee6['push'](_0x13cee6['shift']());}};_0x15957f(++_0x5c2fff);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c29750d..e78d495 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 _0xd2da=['attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd2da,0x149));var _0xad2d=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0xd2da[_0x1168a1];return _0xcc5ad8;};'use strict';var client=require('../client');exports[_0xad2d('0x0')]={};exports[_0xad2d('0x1')]=function(_0x5f4ebc){return client[_0xad2d('0x2')](_0xad2d('0x3'),{'body':{'result':_0x5f4ebc[_0xad2d('0x4')],'transfererchannel':_0x5f4ebc[_0xad2d('0x5')],'transferercalleridnum':_0x5f4ebc[_0xad2d('0x6')],'transferercalleridname':_0x5f4ebc[_0xad2d('0x7')],'transfererconnectedlinenum':_0x5f4ebc[_0xad2d('0x8')],'transfererconnectedlinename':_0x5f4ebc[_0xad2d('0x9')],'transfereraccountcode':_0x5f4ebc[_0xad2d('0xa')],'transferercontext':_0x5f4ebc['transferercontext'],'transfererexten':_0x5f4ebc[_0xad2d('0xb')],'transfererlinkedid':_0x5f4ebc[_0xad2d('0xc')],'transfereechannel':_0x5f4ebc[_0xad2d('0xd')],'transfereecalleridnum':_0x5f4ebc[_0xad2d('0xe')],'transfereecalleridname':_0x5f4ebc[_0xad2d('0xf')],'transfereeconnectedlinenum':_0x5f4ebc[_0xad2d('0x10')],'transfereeconnectedlinename':_0x5f4ebc['transfereeconnectedlinename'],'transfereeaccountcode':_0x5f4ebc[_0xad2d('0x11')],'transfereecontext':_0x5f4ebc[_0xad2d('0x12')],'transfereeexten':_0x5f4ebc[_0xad2d('0x13')],'transfereelinkedid':_0x5f4ebc['transfereelinkedid'],'isexternal':_0x5f4ebc[_0xad2d('0x14')],'context':_0x5f4ebc[_0xad2d('0x15')],'extension':_0x5f4ebc[_0xad2d('0x16')],'type':_0xad2d('0x17')},'log':_0xad2d('0x3')});};exports[_0xad2d('0x18')]=function(_0x5d6744){return client[_0xad2d('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x5d6744[_0xad2d('0x4')],'transfererchannel':_0x5d6744[_0xad2d('0x19')],'transferercalleridnum':_0x5d6744[_0xad2d('0x1a')],'transferercalleridname':_0x5d6744[_0xad2d('0x1b')],'transfererconnectedlinenum':_0x5d6744[_0xad2d('0x1c')],'transfererconnectedlinename':_0x5d6744['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5d6744['origtransfereraccountcode'],'transferercontext':_0x5d6744[_0xad2d('0x1d')],'transfererexten':_0x5d6744[_0xad2d('0x1e')],'transfererlinkedid':_0x5d6744[_0xad2d('0x1f')],'transfereechannel':_0x5d6744[_0xad2d('0x20')],'transfereecalleridnum':_0x5d6744['transfertargetcalleridnum'],'transfereecalleridname':_0x5d6744[_0xad2d('0x21')],'transfereeconnectedlinenum':_0x5d6744['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5d6744[_0xad2d('0x22')],'transfereeaccountcode':_0x5d6744[_0xad2d('0x23')],'transfereecontext':_0x5d6744['transfertargetcontext'],'transfereeexten':_0x5d6744[_0xad2d('0x24')],'transfereelinkedid':_0x5d6744[_0xad2d('0x25')],'isexternal':_0x5d6744['isexternal'],'context':_0x5d6744[_0xad2d('0x26')],'extension':_0x5d6744[_0xad2d('0x27')],'type':_0xad2d('0x28')},'log':_0xad2d('0x3')});}; \ No newline at end of file +var _0x4929=['transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x4929,0x108));var _0x9492=function(_0x51a2a8,_0x1deb4c){_0x51a2a8=_0x51a2a8-0x0;var _0x42f4cb=_0x4929[_0x51a2a8];return _0x42f4cb;};'use strict';var client=require(_0x9492('0x0'));exports['transfers']={};exports[_0x9492('0x1')]=function(_0x52959c){return client[_0x9492('0x2')](_0x9492('0x3'),{'body':{'result':_0x52959c['result'],'transfererchannel':_0x52959c[_0x9492('0x4')],'transferercalleridnum':_0x52959c[_0x9492('0x5')],'transferercalleridname':_0x52959c[_0x9492('0x6')],'transfererconnectedlinenum':_0x52959c[_0x9492('0x7')],'transfererconnectedlinename':_0x52959c[_0x9492('0x8')],'transfereraccountcode':_0x52959c['transfereraccountcode'],'transferercontext':_0x52959c[_0x9492('0x9')],'transfererexten':_0x52959c[_0x9492('0xa')],'transfererlinkedid':_0x52959c['transfererlinkedid'],'transfereechannel':_0x52959c['transfereechannel'],'transfereecalleridnum':_0x52959c[_0x9492('0xb')],'transfereecalleridname':_0x52959c['transfereecalleridname'],'transfereeconnectedlinenum':_0x52959c[_0x9492('0xc')],'transfereeconnectedlinename':_0x52959c[_0x9492('0xd')],'transfereeaccountcode':_0x52959c['transfereeaccountcode'],'transfereecontext':_0x52959c[_0x9492('0xe')],'transfereeexten':_0x52959c[_0x9492('0xf')],'transfereelinkedid':_0x52959c['transfereelinkedid'],'isexternal':_0x52959c['isexternal'],'context':_0x52959c[_0x9492('0x10')],'extension':_0x52959c[_0x9492('0x11')],'type':_0x9492('0x12')},'log':_0x9492('0x3')});};exports[_0x9492('0x13')]=function(_0x23f63d){return client['Request'](_0x9492('0x3'),{'body':{'result':_0x23f63d[_0x9492('0x14')],'transfererchannel':_0x23f63d[_0x9492('0x15')],'transferercalleridnum':_0x23f63d['origtransferercalleridnum'],'transferercalleridname':_0x23f63d[_0x9492('0x16')],'transfererconnectedlinenum':_0x23f63d[_0x9492('0x17')],'transfererconnectedlinename':_0x23f63d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x23f63d['origtransfereraccountcode'],'transferercontext':_0x23f63d['secondtransferercontext'],'transfererexten':_0x23f63d[_0x9492('0x18')],'transfererlinkedid':_0x23f63d[_0x9492('0x19')],'transfereechannel':_0x23f63d['transfertargetchannel'],'transfereecalleridnum':_0x23f63d['transfertargetcalleridnum'],'transfereecalleridname':_0x23f63d[_0x9492('0x1a')],'transfereeconnectedlinenum':_0x23f63d[_0x9492('0x1b')],'transfereeconnectedlinename':_0x23f63d[_0x9492('0x1c')],'transfereeaccountcode':_0x23f63d[_0x9492('0x1d')],'transfereecontext':_0x23f63d[_0x9492('0x1e')],'transfereeexten':_0x23f63d[_0x9492('0x1f')],'transfereelinkedid':_0x23f63d[_0x9492('0x20')],'isexternal':_0x23f63d[_0x9492('0x21')],'context':_0x23f63d[_0x9492('0x22')],'extension':_0x23f63d[_0x9492('0x23')],'type':_0x9492('0x24')},'log':_0x9492('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d60cc0d..6ef67ea 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 _0x2675=['pick','keys','module','action','Reload','Action','then','message','catch','username','command','Command','voiceQueues','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','ami\x20disconnected','voicechannel','validate','map','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','channels','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','emit','custom:','faxAccounts','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','bluebird','moment','../properties','../ami','format','SIP','name','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','join'];(function(_0x5c2f0b,_0x101c15){var _0x273e88=function(_0x50713f){while(--_0x50713f){_0x5c2f0b['push'](_0x5c2f0b['shift']());}};_0x273e88(++_0x101c15);}(_0x2675,0x75));var _0x5267=function(_0x54d085,_0x3d1ff1){_0x54d085=_0x54d085-0x0;var _0x4879ff=_0x2675[_0x54d085];return _0x4879ff;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var config=require('../../../config/environment');var properties=require(_0x5267('0x3'));var ami=require(_0x5267('0x4'));exports['listen']=function(_0x328776,_0xf2b350,_0x4bd042){return new BPromise(function(_0x10f92c,_0x20f065){var _0xc56cd5={'QueuePause':function(_0x527c16){return new Promise(function(_0x9e0a27,_0x46bfdf){var _0x506fd7=util[_0x5267('0x5')]('%s/%s',_0x5267('0x6'),_0x527c16[_0x5267('0x7')]);if(_0x328776[_0x5267('0x8')]&&_0x328776['timers'][_0x506fd7]&&_0x328776[_0x5267('0x8')][_0x506fd7]['timer']){_0x328776[_0x5267('0x8')][_0x506fd7]['updateAcw']();}if(_0x328776[_0x5267('0x9')][_0x506fd7]){_0x328776[_0x5267('0x9')][_0x506fd7][_0x5267('0xa')]({'statePause':_0x527c16[_0x5267('0xb')]?!![]:![]});}_0x9e0a27({'code':0xc8,'message':_0x5267('0xc')});});},'Reload':function(_0x1171b9){var _0x20785c=this;return new Promise(function(_0x36dc17,_0x3e19e4){if(ami[_0x5267('0xd')]()==![]){return _0x3e19e4(_0x20785c[_0x5267('0xe')](0x1f4,[config[_0x5267('0xf')]['ip'],config[_0x5267('0xf')]['username'],'ami\x20disconnected'][_0x5267('0x10')]('\x20')));}_0x1171b9=_[_0x5267('0x11')](_0x1171b9,_[_0x5267('0x12')](properties[_0x5267('0x13')]));_0x1171b9[_0x5267('0x14')]=_0x5267('0x15');return ami[_0x5267('0x16')](_0x1171b9)[_0x5267('0x17')](function(_0x15d81e){_0x36dc17({'code':0xc8,'message':_0x15d81e[_0x5267('0x18')]});})[_0x5267('0x19')](function(_0x1ab03){_0x3e19e4(_0x20785c['error'](0x1f5,_0x1ab03[_0x5267('0x18')]));});});},'Command':function(_0x2afd38){var _0x5069e8=this;return new Promise(function(_0x20cb50,_0x56733e){if(ami[_0x5267('0xd')]()==![]){return _0x56733e(_0x5069e8[_0x5267('0xe')](0x1f4,[config[_0x5267('0xf')]['ip'],config[_0x5267('0xf')][_0x5267('0x1a')],'ami\x20disconnected'][_0x5267('0x10')]('\x20')));}_0x2afd38=_['pick'](_0x2afd38,_0x5267('0x1b'));_0x2afd38[_0x5267('0x14')]=_0x5267('0x1c');return ami['Action'](_0x2afd38)['then'](function(_0x5546e2){_0x20cb50({'code':0xc8,'message':_0x5546e2['content']});})['catch'](function(_0x26c7f8){_0x56733e(_0x5069e8[_0x5267('0xe')](0x1f5,_0x26c7f8[_0x5267('0x18')]));});});},'VoiceQueues':function(_0x279377){return new Promise(function(_0x11c8ea,_0x40d1be){var _0x126a97=[];for(var _0x220e03 in _0x328776[_0x5267('0x1d')]){if(_0x328776['voiceQueues']['hasOwnProperty'](_0x220e03)){var _0x354111=_0x328776[_0x5267('0x1d')][_0x220e03];var _0x5abf95={'id':_0x354111['id'],'name':_0x354111[_0x5267('0x7')],'strategy':_0x354111['strategy'],'answered':_0x354111['answered'],'available':_0x354111[_0x5267('0x1e')],'loggedIn':_0x354111[_0x5267('0x1f')],'pTalking':_0x354111[_0x5267('0x20')],'sumBillable':_0x354111[_0x5267('0x21')],'sumDuration':_0x354111[_0x5267('0x22')],'sumHoldTime':_0x354111['sumHoldTime']||0x0,'talking':_0x354111['talking'],'total':_0x354111[_0x5267('0x23')],'type':_0x354111[_0x5267('0x24')],'unmanaged':_0x354111[_0x5267('0x25')],'abandoned':_0x354111['abandoned'],'waiting':_0x354111['waiting'],'loggedInDb':_0x354111[_0x5267('0x26')]};if(_0x354111[_0x5267('0x24')]===_0x5267('0x27')){_0x5abf95['dialActive']=_0x354111['dialActive'];_0x5abf95[_0x5267('0x28')]=_0x354111[_0x5267('0x28')];_0x5abf95[_0x5267('0x29')]=_0x354111[_0x5267('0x29')];_0x5abf95['dialOriginateCallerIdNumber']=_0x354111[_0x5267('0x2a')];_0x5abf95[_0x5267('0x2b')]=_0x354111[_0x5267('0x2b')];_0x5abf95[_0x5267('0x2c')]=_0x354111[_0x5267('0x2c')];_0x5abf95[_0x5267('0x2d')]=_0x354111[_0x5267('0x2d')];_0x5abf95[_0x5267('0x2e')]=_0x354111['outboundAnswerAgiCallsDay'];_0x5abf95['outboundAnswerCallsDay']=_0x354111[_0x5267('0x2f')];_0x5abf95['outboundBlacklistCallsDay']=_0x354111[_0x5267('0x30')];_0x5abf95[_0x5267('0x31')]=_0x354111[_0x5267('0x31')];_0x5abf95[_0x5267('0x32')]=_0x354111['outboundCongestionCallsDay'];_0x5abf95[_0x5267('0x33')]=_0x354111[_0x5267('0x33')];_0x5abf95[_0x5267('0x34')]=_0x354111[_0x5267('0x34')];_0x5abf95[_0x5267('0x35')]=_0x354111[_0x5267('0x35')];_0x5abf95[_0x5267('0x36')]=_0x354111[_0x5267('0x36')];_0x5abf95['outboundNoSuchCallsDay']=_0x354111[_0x5267('0x37')];_0x5abf95['outboundOriginateFailureCallsDay']=_0x354111[_0x5267('0x38')];_0x5abf95[_0x5267('0x39')]=_0x354111[_0x5267('0x39')];_0x5abf95[_0x5267('0x3a')]=_0x354111[_0x5267('0x3a')];_0x5abf95[_0x5267('0x3b')]=_0x354111[_0x5267('0x3b')];_0x5abf95['predictiveIntervalAnsweredCalls']=_0x354111[_0x5267('0x3c')];_0x5abf95[_0x5267('0x3d')]=_0x354111[_0x5267('0x3d')];_0x5abf95[_0x5267('0x3e')]=_0x354111[_0x5267('0x3e')];_0x5abf95[_0x5267('0x3f')]=_0x354111[_0x5267('0x3f')];_0x5abf95['predictiveIntervalDroppedCallsTimeout']=_0x354111[_0x5267('0x40')];_0x5abf95['predictiveIntervalErlangCalls']=_0x354111[_0x5267('0x41')];_0x5abf95['predictiveIntervalErlangCallsDroppedCalls']=_0x354111['predictiveIntervalErlangCallsDroppedCalls'];_0x5abf95['predictiveIntervalHitRate']=_0x354111[_0x5267('0x42')];_0x5abf95['predictiveIntervalMultiplicativeFactor']=_0x354111[_0x5267('0x43')];_0x5abf95[_0x5267('0x44')]=_0x354111[_0x5267('0x44')];_0x5abf95[_0x5267('0x45')]=_0x354111['predictiveIntervalAvailable'];_0x5abf95[_0x5267('0x46')]=_0x354111[_0x5267('0x46')];_0x5abf95['message']=_0x354111['message'];_0x5abf95[_0x5267('0x47')]=_0x354111['originated'];_0x5abf95[_0x5267('0x48')]=_0x354111[_0x5267('0x48')];_0x5abf95[_0x5267('0x49')]=_0x354111[_0x5267('0x49')];_0x5abf95[_0x5267('0x4a')]=_0x354111[_0x5267('0x4a')];_0x5abf95[_0x5267('0x4b')]=_0x354111['erlangBusyFactor'];_0x5abf95['startPredictive']=_0x354111[_0x5267('0x4c')];_0x5abf95['startProgressive']=_0x354111[_0x5267('0x4d')];}if(_0x354111[_0x5267('0x4e')]){_0x5abf95['Trunk']={'id':_0x354111[_0x5267('0x4e')]['id'],'name':_0x354111[_0x5267('0x4e')][_0x5267('0x7')],'active':_0x354111[_0x5267('0x4e')][_0x5267('0x4f')],'callerid':_0x354111[_0x5267('0x4e')][_0x5267('0x50')]};}if(_0x354111[_0x5267('0x51')]){_0x5abf95[_0x5267('0x51')]={'id':_0x354111['Interval']['id'],'name':_0x354111[_0x5267('0x51')][_0x5267('0x7')]};}_0x126a97[_0x5267('0x52')](_0x5abf95);}}_0x11c8ea({'count':_0x126a97[_0x5267('0x53')],'rows':_0x126a97});});},'UpdateVoiceQueue':function(_0x1270d4){return new Promise(function(_0x5a97f5,_0x3d15ac){var _0x4e0132=_[_0x5267('0x54')](_0x328776['voiceQueues'],{'id':parseInt(_0x1270d4['id'])});var _0x4ae9f9=_[_0x5267('0x55')](_0x1270d4,['id']);if(_0x4e0132){for(var _0x56d33f in _0x4ae9f9){if(typeof _0x4ae9f9[_0x56d33f]!==_0x5267('0x56')&&typeof _0x4e0132[_0x56d33f]!==_0x5267('0x56')){_0x4e0132[_0x56d33f]=_0x4ae9f9[_0x56d33f];}}_0x5a97f5(_0x4e0132);}else{_0x3d15ac();}});},'VoiceChannels':function(_0x222c9f){return new Promise(function(_0x29ab9b,_0x5bddff){var _0x12d6a8=_['values'](_0x328776['channels']);_0x29ab9b({'count':_0x12d6a8[_0x5267('0x53')],'rows':_0x12d6a8});});},'VoiceChannelMixMonitor':function(_0x3a277c){var _0x47d8dd=this;return new Promise(function(_0x49ce4f,_0x383ebe){if(ami[_0x5267('0xd')]()==![]){return _0x383ebe(_0x47d8dd[_0x5267('0xe')](0x1f4,[config[_0x5267('0xf')]['ip'],config[_0x5267('0xf')][_0x5267('0x1a')],_0x5267('0x57')][_0x5267('0x10')]('\x20')));}var _0x4332c7=schema(properties[_0x5267('0x58')])[_0x5267('0x59')](_0x3a277c);if(_0x4332c7[_0x5267('0x53')]>0x0){return _0x383ebe(_0x47d8dd[_0x5267('0xe')](0x1f4,_[_0x5267('0x5a')](_0x4332c7,'message')[_0x5267('0x10')](',\x20')));}var _0x466d46=_[_0x5267('0x54')](_0x328776['channels'],{'uniqueid':_0x3a277c[_0x5267('0x5b')]});if(_0x466d46&&_0x466d46[_0x5267('0x5c')]){var _0x31b722=util[_0x5267('0x5')](_0x5267('0x5d'),_0x3a277c[_0x5267('0x5e')]||_0x3a277c['uniqueid'],_0x3a277c[_0x5267('0x5')]||'wav');return ami[_0x5267('0x16')]({'action':_0x5267('0x5f'),'channel':_0x466d46[_0x5267('0x5c')],'file':_0x31b722,'options':_0x5267('0x60')})[_0x5267('0x17')](function(_0x3f9664){var _0x19bfd6=_['find'](_0x466d46['monitors'],{'filename':_0x5267('0x61')+_0x31b722[_0x5267('0x62')]()});if(_['isNil'](_0x19bfd6)){_0x466d46[_0x5267('0x63')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x31b722[_0x5267('0x62')](),'createdAt':moment()[_0x5267('0x5')](_0x5267('0x64')),'mixmonitorid':_0x3f9664[_0x5267('0x65')],'status':_0x5267('0x66')});}else{_0x19bfd6[_0x5267('0x65')]=_0x3f9664[_0x5267('0x65')];_0x19bfd6[_0x5267('0x67')]=_0x5267('0x66');}_0x49ce4f({'code':0xc8,'message':[_0x3a277c[_0x5267('0x5b')],'MixMonitor\x20Success',_0x3f9664[_0x5267('0x65')]][_0x5267('0x10')]('\x20'),'mixmonitorid':_0x3f9664[_0x5267('0x65')]});})[_0x5267('0x19')](function(_0x2544f1){_0x383ebe(_0x47d8dd[_0x5267('0xe')](0x1f5,[_0x3a277c['uniqueid'],_0x2544f1[_0x5267('0x18')]['toLowerCase']()][_0x5267('0x10')]('\x20')));});}else{return _0x383ebe(_0x47d8dd[_0x5267('0xe')](0x1f5,_0x5267('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x4a72c3){var _0x1593ce=this;return new Promise(function(_0x161dab,_0x181079){if(ami[_0x5267('0xd')]()==![]){return _0x181079(_0x1593ce[_0x5267('0xe')](0x1f4,[config[_0x5267('0xf')]['ip'],config['asterisk'][_0x5267('0x1a')],_0x5267('0x57')][_0x5267('0x10')]('\x20')));}var _0x2c3168=schema(properties['voicechannel'])['validate'](_0x4a72c3);if(_0x2c3168[_0x5267('0x53')]>0x0){return _0x181079(_0x1593ce['error'](0x1f4,_[_0x5267('0x5a')](_0x2c3168,_0x5267('0x18'))['join'](',\x20')));}var _0x489780=_[_0x5267('0x54')](_0x328776[_0x5267('0x69')],{'uniqueid':_0x4a72c3[_0x5267('0x5b')]});if(_0x489780){return BPromise['resolve']()[_0x5267('0x17')](function(){if(_0x489780[_0x5267('0x5c')]){return ami[_0x5267('0x16')]({'action':_0x5267('0x6a'),'channel':_0x489780['channel'],'mixmonitorid':_0x4a72c3['mixmonitorid']})['catch'](function(_0x3be34e){});}})[_0x5267('0x17')](function(){if(_0x489780[_0x5267('0x6b')]){return ami[_0x5267('0x16')]({'action':_0x5267('0x6a'),'channel':_0x489780[_0x5267('0x6b')],'mixmonitorid':_0x4a72c3[_0x5267('0x65')]})[_0x5267('0x19')](function(_0x486b02){});}})[_0x5267('0x17')](function(_0x667b5d){var _0x5dbe25=_[_0x5267('0x54')](_0x489780[_0x5267('0x63')],{'mixmonitorid':_0x4a72c3[_0x5267('0x65')]});if(_0x5dbe25){_0x5dbe25[_0x5267('0x67')]=_0x5267('0x6c');}})[_0x5267('0x17')](function(){var _0x4915f4=util[_0x5267('0x5')](_0x5267('0x5d'),_0x4a72c3[_0x5267('0x5e')]||_0x4a72c3[_0x5267('0x5b')],_0x4a72c3[_0x5267('0x5')]||_0x5267('0x6d'));var _0x4aac32=_[_0x5267('0x54')](_0x489780[_0x5267('0x63')],{'filename':_0x5267('0x61')+_0x4915f4[_0x5267('0x62')]()});if(_0x4aac32){_0x4aac32[_0x5267('0x67')]=_0x5267('0x6c');}})['then'](function(){_0x161dab({'code':0xc8,'message':[_0x4a72c3[_0x5267('0x5b')],_0x5267('0x6e')][_0x5267('0x10')]('\x20')});})[_0x5267('0x19')](function(_0x490b8c){_0x181079(_0x1593ce['error'](0x1f5,[_0x4a72c3['uniqueid'],_0x490b8c[_0x5267('0x18')]['toLowerCase']()][_0x5267('0x10')]('\x20')));});}else{return _0x181079(_0x1593ce['error'](0x1f5,_0x5267('0x68')));}});},'VoiceQueuesChannels':function(_0x1150ba){return new Promise(function(_0x3fdb33,_0x439411){var _0x8674cb=_[_0x5267('0x6f')](_0x328776[_0x5267('0x70')]);_0x3fdb33({'count':_0x8674cb[_0x5267('0x53')],'rows':_0x8674cb});});},'VoiceQueuesChannel':function(_0x489b9a){var _0x489f46=this;return new Promise(function(_0x5853e9,_0x30ce72){var _0x28a101=schema(properties[_0x5267('0x71')])[_0x5267('0x59')](_0x489b9a);if(_0x28a101['length']>0x0){return _0x30ce72(_0x489f46[_0x5267('0xe')](0x1f4,_[_0x5267('0x5a')](_0x28a101,_0x5267('0x18'))[_0x5267('0x10')](',\x20')));}var _0x5a0e73=_[_0x5267('0x54')](_0x328776[_0x5267('0x70')],{'uniqueid':_0x489b9a['uniqueid']});if(_0x5a0e73){_0x5853e9(_0x5a0e73);}else{return _0x30ce72(_0x489f46[_0x5267('0xe')](0x1f5,_0x5267('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x4a9995){var _0x47e235=this;return new Promise(function(_0x1521c4,_0x1c4c6b){if(ami['isConnected']()==![]){return _0x1c4c6b(_0x47e235['error'](0x1f4,[config[_0x5267('0xf')]['ip'],config[_0x5267('0xf')][_0x5267('0x1a')],_0x5267('0x57')][_0x5267('0x10')]('\x20')));}var _0x48a589=schema(properties[_0x5267('0x72')])[_0x5267('0x59')](_0x4a9995);if(_0x48a589['length']>0x0){return _0x1c4c6b(_0x47e235[_0x5267('0xe')](0x1f4,_[_0x5267('0x5a')](_0x48a589,_0x5267('0x18'))[_0x5267('0x10')](',\x20')));}var _0xb8c52c=_[_0x5267('0x54')](_0x328776[_0x5267('0x70')],{'uniqueid':_0x4a9995[_0x5267('0x5b')]});if(_0xb8c52c&&_0xb8c52c['channel']){return ami['Action']({'action':_0x5267('0x73'),'channel':_0xb8c52c[_0x5267('0x5c')]})[_0x5267('0x17')](function(_0x3a6ad7){_0x1521c4({'code':0xc8,'message':[_0x4a9995['uniqueid'],_0x3a6ad7[_0x5267('0x18')]['toLowerCase']()][_0x5267('0x10')]('\x20')});})[_0x5267('0x19')](function(_0x1bf43a){_0x1c4c6b(_0x47e235[_0x5267('0xe')](0x1f5,[_0x4a9995['uniqueid'],_0x1bf43a['message'][_0x5267('0x62')]()][_0x5267('0x10')]('\x20')));});}else{return _0x1c4c6b(_0x47e235[_0x5267('0xe')](0x1f5,_0x5267('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x162506){var _0x371302=this;return new Promise(function(_0x5e1ba4,_0x1b8d72){if(ami['isConnected']()==![]){return _0x1b8d72(_0x371302[_0x5267('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x5267('0xf')][_0x5267('0x1a')],_0x5267('0x57')][_0x5267('0x10')]('\x20')));}var _0x164cc1=schema(properties[_0x5267('0x74')])[_0x5267('0x59')](_0x162506);if(_0x164cc1[_0x5267('0x53')]>0x0){return _0x1b8d72(_0x371302[_0x5267('0xe')](0x1f4,_[_0x5267('0x5a')](_0x164cc1,_0x5267('0x18'))['join'](',\x20')));}var _0x40c7b5=_[_0x5267('0x54')](_0x328776['queueChannels'],{'uniqueid':_0x162506[_0x5267('0x5b')]});if(_0x40c7b5&&_0x40c7b5[_0x5267('0x5c')]){return ami[_0x5267('0x16')]({'action':_0x5267('0x75'),'channel':_0x40c7b5[_0x5267('0x5c')],'exten':_0x162506[_0x5267('0x76')],'context':_0x162506[_0x5267('0x77')]||_0x40c7b5['context'],'priority':0x1})[_0x5267('0x17')](function(_0x2f8b17){_0x5e1ba4({'code':0xc8,'message':[_0x162506[_0x5267('0x5b')],_0x2f8b17[_0x5267('0x18')][_0x5267('0x62')]()]['join']('\x20')});})['catch'](function(_0x34d446){_0x1b8d72(_0x371302[_0x5267('0xe')](0x1f5,[_0x162506[_0x5267('0x5b')],_0x34d446[_0x5267('0x18')]['toLowerCase']()][_0x5267('0x10')]('\x20')));});}else{return _0x1b8d72(_0x371302[_0x5267('0xe')](0x1f5,_0x5267('0x68')));}});},'Agents':function(_0x2dffd8){return new Promise(function(_0x21a451,_0x7d8077){var _0x2b38f2=_[_0x5267('0x6f')](_0x328776[_0x5267('0x9')]);_0x21a451({'count':_0x2b38f2[_0x5267('0x53')],'rows':_0x2b38f2});});},'Telephones':function(_0x91509a){return new Promise(function(_0x212bcc,_0x1fc382){var _0x4a0422=_[_0x5267('0x6f')](_0x328776[_0x5267('0x78')]);_0x212bcc({'count':_0x4a0422[_0x5267('0x53')],'rows':_0x4a0422});});},'Trunks':function(_0x16374d){return new Promise(function(_0x447b5f,_0x25ce90){var _0x257c69=_[_0x5267('0x6f')](_0x328776[_0x5267('0x79')]);_0x447b5f({'count':_0x257c69[_0x5267('0x53')],'rows':_0x257c69});});},'OutboundChannels':function(_0x3a4696){return new Promise(function(_0x24058e,_0x204570){var _0x209669=_[_0x5267('0x6f')](_0x328776[_0x5267('0x7a')]);_0x24058e({'count':_0x209669[_0x5267('0x53')],'rows':_0x209669});});},'Outbound':function(_0x35a4a3){return new Promise(function(_0x7ecf0e,_0x676556){_0x7ecf0e(_0x328776[_0x5267('0x27')]);});},'Campaigns':function(_0x1464ae){return new Promise(function(_0x87fc43,_0x59233f){var _0x339f3f=_[_0x5267('0x6f')](_0x328776[_0x5267('0x7b')]);_0x87fc43({'count':_0x339f3f[_0x5267('0x53')],'rows':_0x339f3f});});},'VoiceQueuesPreview':function(_0x38f5b7){var _0x557749=this;return new Promise(function(_0xf814eb,_0x3c5418){_0xf2b350['run'](_0x38f5b7['id'])['then'](function(_0x4bdf77){_0xf814eb({'code':0xc8,'message':_0x4bdf77[_0x5267('0x18')]});})['catch'](function(_0x1183d0){_0x3c5418(_0x557749['error'](0x1f4,_0x1183d0['message']));});});},'EventManager':function(_0x21431b){var _0x4703cb=this;return new Promise(function(_0x2fdc63,_0x41dcd1){if(!_0x21431b[_0x5267('0x7c')]){return _0x41dcd1(_0x4703cb['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x5267('0x7d')](_0x5267('0x7e')+_0x21431b[_0x5267('0x7c')],_0x21431b[_0x5267('0x18')]);_0x2fdc63({'code':0xc8,'message':_0x21431b});});},'FaxAccounts':function(_0x5a728d){return new Promise(function(_0x586a50,_0x1205a2){var _0x5bece1=_['values'](_0x328776[_0x5267('0x7f')]);_0x586a50({'count':_0x5bece1['length'],'rows':_0x5bece1});});},'SendFax':function(_0x5da8d6){var _0x3ebe63=this;return new Promise(function(_0x321322,_0x5085d8){_0x4bd042['send'](_0x5da8d6)['then'](function(_0xaaf010){_0x321322({'code':0xc8,'message':_0xaaf010['message']});})[_0x5267('0x19')](function(_0x59af19){_0x5085d8(_0x3ebe63[_0x5267('0xe')](0x1f4,_0x59af19[_0x5267('0x18')]));});});},'CheckAfterSend':function(_0x58cc0b){var _0x1ae9fe=this;return new Promise(function(_0x367841,_0x3906d6){_0x4bd042[_0x5267('0x80')](_0x58cc0b)[_0x5267('0x17')](function(_0x835563){_0x367841({'code':0xc8,'message':_0x835563['message']});})['catch'](function(_0x1ebe0f){_0x3906d6(_0x1ae9fe['error'](0x1f4,_0x1ebe0f['message']));});});}};var _0x1a3146=jayson['server'](_0xc56cd5)[_0x5267('0x81')]();_0x1a3146['on']('error',function(_0x67f1c9){return _0x20f065(_0x67f1c9);});_0x1a3146['listen'](0x232a,_0x5267('0x82'),function(){console[_0x5267('0x83')](_0x5267('0x84'),0x232a);return _0x10f92c(_0x5267('0x85')+0x232a);});});}; \ No newline at end of file +var _0xf69c=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','omit','undefined','voicechannel','map','find','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','status','MixMonitor\x20Success','mixmonitorid','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','event','emit','custom:','faxAccounts','send','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','username','join','pick','keys','module','Reload','Action','message','catch','error','isConnected','asterisk','ami\x20disconnected','command','action','Command','then','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x1b3fd8,_0x52b4f8){var _0x1aa4f7=function(_0x4bbdbd){while(--_0x4bbdbd){_0x1b3fd8['push'](_0x1b3fd8['shift']());}};_0x1aa4f7(++_0x52b4f8);}(_0xf69c,0x151));var _0xcf69=function(_0x508dc5,_0x1aa23c){_0x508dc5=_0x508dc5-0x0;var _0x403554=_0xf69c[_0x508dc5];return _0x403554;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var jayson=require(_0xcf69('0x1'));var schema=require(_0xcf69('0x2'));var BPromise=require('bluebird');var moment=require(_0xcf69('0x3'));var config=require('../../../config/environment');var properties=require(_0xcf69('0x4'));var ami=require('../ami');exports[_0xcf69('0x5')]=function(_0x4d8180,_0x1c813d,_0x168197){return new BPromise(function(_0x225c65,_0x35aa67){var _0x3b7608={'QueuePause':function(_0x5f1e98){return new Promise(function(_0x38478c,_0xbeb916){var _0x46b433=util[_0xcf69('0x6')]('%s/%s',_0xcf69('0x7'),_0x5f1e98[_0xcf69('0x8')]);if(_0x4d8180[_0xcf69('0x9')]&&_0x4d8180[_0xcf69('0x9')][_0x46b433]&&_0x4d8180[_0xcf69('0x9')][_0x46b433][_0xcf69('0xa')]){_0x4d8180['timers'][_0x46b433][_0xcf69('0xb')]();}if(_0x4d8180['agents'][_0x46b433]){_0x4d8180[_0xcf69('0xc')][_0x46b433][_0xcf69('0xd')]({'statePause':_0x5f1e98[_0xcf69('0xe')]?!![]:![]});}_0x38478c({'code':0xc8,'message':_0xcf69('0xf')});});},'Reload':function(_0x329250){var _0x2981ab=this;return new Promise(function(_0x182dde,_0x34e299){if(ami['isConnected']()==![]){return _0x34e299(_0x2981ab['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xcf69('0x10')],'ami\x20disconnected'][_0xcf69('0x11')]('\x20')));}_0x329250=_[_0xcf69('0x12')](_0x329250,_[_0xcf69('0x13')](properties[_0xcf69('0x14')]));_0x329250['action']=_0xcf69('0x15');return ami[_0xcf69('0x16')](_0x329250)['then'](function(_0x486e06){_0x182dde({'code':0xc8,'message':_0x486e06[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x39306a){_0x34e299(_0x2981ab[_0xcf69('0x19')](0x1f5,_0x39306a[_0xcf69('0x17')]));});});},'Command':function(_0xfd30d2){var _0x120980=this;return new Promise(function(_0x210630,_0x53666e){if(ami[_0xcf69('0x1a')]()==![]){return _0x53666e(_0x120980['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}_0xfd30d2=_[_0xcf69('0x12')](_0xfd30d2,_0xcf69('0x1d'));_0xfd30d2[_0xcf69('0x1e')]=_0xcf69('0x1f');return ami[_0xcf69('0x16')](_0xfd30d2)[_0xcf69('0x20')](function(_0x7d86bc){_0x210630({'code':0xc8,'message':_0x7d86bc[_0xcf69('0x21')]});})[_0xcf69('0x18')](function(_0x3ec2fb){_0x53666e(_0x120980['error'](0x1f5,_0x3ec2fb[_0xcf69('0x17')]));});});},'VoiceQueues':function(_0x1abce9){return new Promise(function(_0x183067,_0x278ce3){var _0x9a006b=[];for(var _0x1a0b33 in _0x4d8180['voiceQueues']){if(_0x4d8180['voiceQueues'][_0xcf69('0x22')](_0x1a0b33)){var _0x59de98=_0x4d8180[_0xcf69('0x23')][_0x1a0b33];var _0x81a49f={'id':_0x59de98['id'],'name':_0x59de98[_0xcf69('0x8')],'strategy':_0x59de98[_0xcf69('0x24')],'answered':_0x59de98[_0xcf69('0x25')],'available':_0x59de98[_0xcf69('0x26')],'loggedIn':_0x59de98[_0xcf69('0x27')],'pTalking':_0x59de98[_0xcf69('0x28')],'sumBillable':_0x59de98['sumBillable'],'sumDuration':_0x59de98['sumDuration'],'sumHoldTime':_0x59de98[_0xcf69('0x29')]||0x0,'talking':_0x59de98[_0xcf69('0x2a')],'total':_0x59de98[_0xcf69('0x2b')],'type':_0x59de98[_0xcf69('0x2c')],'unmanaged':_0x59de98['unmanaged'],'abandoned':_0x59de98[_0xcf69('0x2d')],'waiting':_0x59de98[_0xcf69('0x2e')],'loggedInDb':_0x59de98[_0xcf69('0x2f')]};if(_0x59de98[_0xcf69('0x2c')]===_0xcf69('0x30')){_0x81a49f[_0xcf69('0x31')]=_0x59de98[_0xcf69('0x31')];_0x81a49f[_0xcf69('0x32')]=_0x59de98[_0xcf69('0x32')];_0x81a49f[_0xcf69('0x33')]=_0x59de98['dialOriginateCallerIdName'];_0x81a49f[_0xcf69('0x34')]=_0x59de98['dialOriginateCallerIdNumber'];_0x81a49f[_0xcf69('0x35')]=_0x59de98[_0xcf69('0x35')];_0x81a49f[_0xcf69('0x36')]=_0x59de98[_0xcf69('0x36')];_0x81a49f[_0xcf69('0x37')]=_0x59de98[_0xcf69('0x37')];_0x81a49f[_0xcf69('0x38')]=_0x59de98[_0xcf69('0x38')];_0x81a49f[_0xcf69('0x39')]=_0x59de98[_0xcf69('0x39')];_0x81a49f['outboundBlacklistCallsDay']=_0x59de98[_0xcf69('0x3a')];_0x81a49f[_0xcf69('0x3b')]=_0x59de98['outboundBusyCallsDay'];_0x81a49f[_0xcf69('0x3c')]=_0x59de98['outboundCongestionCallsDay'];_0x81a49f[_0xcf69('0x3d')]=_0x59de98['outboundDropCallsDayACS'];_0x81a49f['outboundDropCallsDayCallersExit']=_0x59de98[_0xcf69('0x3e')];_0x81a49f[_0xcf69('0x3f')]=_0x59de98[_0xcf69('0x3f')];_0x81a49f[_0xcf69('0x40')]=_0x59de98[_0xcf69('0x40')];_0x81a49f[_0xcf69('0x41')]=_0x59de98['outboundNoSuchCallsDay'];_0x81a49f['outboundOriginateFailureCallsDay']=_0x59de98[_0xcf69('0x42')];_0x81a49f[_0xcf69('0x43')]=_0x59de98[_0xcf69('0x43')];_0x81a49f[_0xcf69('0x44')]=_0x59de98[_0xcf69('0x44')];_0x81a49f[_0xcf69('0x45')]=_0x59de98[_0xcf69('0x45')];_0x81a49f[_0xcf69('0x46')]=_0x59de98[_0xcf69('0x46')];_0x81a49f[_0xcf69('0x47')]=_0x59de98[_0xcf69('0x47')];_0x81a49f[_0xcf69('0x48')]=_0x59de98[_0xcf69('0x48')];_0x81a49f[_0xcf69('0x49')]=_0x59de98[_0xcf69('0x49')];_0x81a49f[_0xcf69('0x4a')]=_0x59de98[_0xcf69('0x4a')];_0x81a49f[_0xcf69('0x4b')]=_0x59de98[_0xcf69('0x4b')];_0x81a49f[_0xcf69('0x4c')]=_0x59de98[_0xcf69('0x4c')];_0x81a49f['predictiveIntervalHitRate']=_0x59de98['predictiveIntervalHitRate'];_0x81a49f[_0xcf69('0x4d')]=_0x59de98[_0xcf69('0x4d')];_0x81a49f[_0xcf69('0x4e')]=_0x59de98[_0xcf69('0x4e')];_0x81a49f['predictiveIntervalAvailable']=_0x59de98[_0xcf69('0x4f')];_0x81a49f[_0xcf69('0x50')]=_0x59de98[_0xcf69('0x50')];_0x81a49f[_0xcf69('0x17')]=_0x59de98[_0xcf69('0x17')];_0x81a49f['originated']=_0x59de98[_0xcf69('0x51')];_0x81a49f[_0xcf69('0x52')]=_0x59de98['erlangCalls'];_0x81a49f[_0xcf69('0x53')]=_0x59de98[_0xcf69('0x53')];_0x81a49f[_0xcf69('0x54')]=_0x59de98['erlangAbandonmentRate'];_0x81a49f[_0xcf69('0x55')]=_0x59de98['erlangBusyFactor'];_0x81a49f[_0xcf69('0x56')]=_0x59de98[_0xcf69('0x56')];_0x81a49f['startProgressive']=_0x59de98['startProgressive'];}if(_0x59de98[_0xcf69('0x57')]){_0x81a49f[_0xcf69('0x57')]={'id':_0x59de98[_0xcf69('0x57')]['id'],'name':_0x59de98['Trunk']['name'],'active':_0x59de98[_0xcf69('0x57')][_0xcf69('0x58')],'callerid':_0x59de98['Trunk'][_0xcf69('0x59')]};}if(_0x59de98[_0xcf69('0x5a')]){_0x81a49f[_0xcf69('0x5a')]={'id':_0x59de98[_0xcf69('0x5a')]['id'],'name':_0x59de98[_0xcf69('0x5a')][_0xcf69('0x8')]};}_0x9a006b['push'](_0x81a49f);}}_0x183067({'count':_0x9a006b[_0xcf69('0x5b')],'rows':_0x9a006b});});},'UpdateVoiceQueue':function(_0x39522d){return new Promise(function(_0x3e33e6,_0x58e261){var _0x1a1270=_['find'](_0x4d8180[_0xcf69('0x23')],{'id':parseInt(_0x39522d['id'])});var _0x81d8a7=_[_0xcf69('0x5c')](_0x39522d,['id']);if(_0x1a1270){for(var _0x45c458 in _0x81d8a7){if(typeof _0x81d8a7[_0x45c458]!==_0xcf69('0x5d')&&typeof _0x1a1270[_0x45c458]!=='undefined'){_0x1a1270[_0x45c458]=_0x81d8a7[_0x45c458];}}_0x3e33e6(_0x1a1270);}else{_0x58e261();}});},'VoiceChannels':function(_0x57748d){return new Promise(function(_0xca4bc0,_0x29dfbf){var _0x43ded1=_['values'](_0x4d8180['channels']);_0xca4bc0({'count':_0x43ded1['length'],'rows':_0x43ded1});});},'VoiceChannelMixMonitor':function(_0x2f2b20){var _0x814320=this;return new Promise(function(_0x91069e,_0x4c55e4){if(ami[_0xcf69('0x1a')]()==![]){return _0x4c55e4(_0x814320['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config['asterisk'][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x2f8346=schema(properties[_0xcf69('0x5e')])[_0xcf69('0x2')](_0x2f2b20);if(_0x2f8346[_0xcf69('0x5b')]>0x0){return _0x4c55e4(_0x814320[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x2f8346,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52473a=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x61')],{'uniqueid':_0x2f2b20[_0xcf69('0x62')]});if(_0x52473a&&_0x52473a['channel']){var _0x294e08=util['format'](_0xcf69('0x63'),_0x2f2b20[_0xcf69('0x64')]||_0x2f2b20[_0xcf69('0x62')],_0x2f2b20[_0xcf69('0x6')]||_0xcf69('0x65'));return ami[_0xcf69('0x16')]({'action':_0xcf69('0x66'),'channel':_0x52473a[_0xcf69('0x67')],'file':_0x294e08,'options':_0xcf69('0x68')})[_0xcf69('0x20')](function(_0x2f83f6){var _0x2be62c=_[_0xcf69('0x60')](_0x52473a['monitors'],{'filename':_0xcf69('0x69')+_0x294e08[_0xcf69('0x6a')]()});if(_[_0xcf69('0x6b')](_0x2be62c)){_0x52473a['monitors']['push']({'filename':_0xcf69('0x69')+_0x294e08['toLowerCase'](),'createdAt':moment()[_0xcf69('0x6')](_0xcf69('0x6c')),'mixmonitorid':_0x2f83f6['mixmonitorid'],'status':_0xcf69('0x6d')});}else{_0x2be62c['mixmonitorid']=_0x2f83f6['mixmonitorid'];_0x2be62c[_0xcf69('0x6e')]=_0xcf69('0x6d');}_0x91069e({'code':0xc8,'message':[_0x2f2b20[_0xcf69('0x62')],_0xcf69('0x6f'),_0x2f83f6['mixmonitorid']][_0xcf69('0x11')]('\x20'),'mixmonitorid':_0x2f83f6[_0xcf69('0x70')]});})[_0xcf69('0x18')](function(_0x5996eb){_0x4c55e4(_0x814320['error'](0x1f5,[_0x2f2b20[_0xcf69('0x62')],_0x5996eb[_0xcf69('0x17')][_0xcf69('0x6a')]()]['join']('\x20')));});}else{return _0x4c55e4(_0x814320['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4ab987){var _0x5d036b=this;return new Promise(function(_0x4bfd20,_0x1ace3c){if(ami[_0xcf69('0x1a')]()==![]){return _0x1ace3c(_0x5d036b['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x19310e=schema(properties['voicechannel'])['validate'](_0x4ab987);if(_0x19310e[_0xcf69('0x5b')]>0x0){return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x19310e,_0xcf69('0x17'))['join'](',\x20')));}var _0x593502=_['find'](_0x4d8180['channels'],{'uniqueid':_0x4ab987[_0xcf69('0x62')]});if(_0x593502){return BPromise[_0xcf69('0x71')]()[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502['channel'],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x111089){});}})[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x73')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502[_0xcf69('0x73')],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x16d25d){});}})['then'](function(_0x1d5dc1){var _0x3e5450=_[_0xcf69('0x60')](_0x593502['monitors'],{'mixmonitorid':_0x4ab987[_0xcf69('0x70')]});if(_0x3e5450){_0x3e5450['status']=_0xcf69('0x74');}})['then'](function(){var _0x4b3250=util[_0xcf69('0x6')](_0xcf69('0x63'),_0x4ab987[_0xcf69('0x64')]||_0x4ab987[_0xcf69('0x62')],_0x4ab987[_0xcf69('0x6')]||'wav');var _0x5d098a=_[_0xcf69('0x60')](_0x593502[_0xcf69('0x75')],{'filename':'/var/spool/asterisk/monitor/'+_0x4b3250['toLowerCase']()});if(_0x5d098a){_0x5d098a['status']=_0xcf69('0x74');}})[_0xcf69('0x20')](function(){_0x4bfd20({'code':0xc8,'message':[_0x4ab987['uniqueid'],_0xcf69('0x76')]['join']('\x20')});})[_0xcf69('0x18')](function(_0x3b76ce){_0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,[_0x4ab987[_0xcf69('0x62')],_0x3b76ce[_0xcf69('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x188d15){return new Promise(function(_0x54cf09,_0x53ee6c){var _0x5a183e=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x78')]);_0x54cf09({'count':_0x5a183e[_0xcf69('0x5b')],'rows':_0x5a183e});});},'VoiceQueuesChannel':function(_0xbb5438){var _0x566520=this;return new Promise(function(_0x287912,_0x5658f4){var _0x243fda=schema(properties['voicequeuechannel'])[_0xcf69('0x2')](_0xbb5438);if(_0x243fda[_0xcf69('0x5b')]>0x0){return _0x5658f4(_0x566520['error'](0x1f4,_[_0xcf69('0x5f')](_0x243fda,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x490cce=_['find'](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0xbb5438[_0xcf69('0x62')]});if(_0x490cce){_0x287912(_0x490cce);}else{return _0x5658f4(_0x566520['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x38e0b2){var _0x746a64=this;return new Promise(function(_0x4bc426,_0x48774f){if(ami[_0xcf69('0x1a')]()==![]){return _0x48774f(_0x746a64['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')]['username'],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x5b68b8=schema(properties[_0xcf69('0x7a')])['validate'](_0x38e0b2);if(_0x5b68b8[_0xcf69('0x5b')]>0x0){return _0x48774f(_0x746a64[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x5b68b8,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52eae3=_[_0xcf69('0x60')](_0x4d8180['queueChannels'],{'uniqueid':_0x38e0b2[_0xcf69('0x62')]});if(_0x52eae3&&_0x52eae3[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7b'),'channel':_0x52eae3['channel']})['then'](function(_0x2f97f5){_0x4bc426({'code':0xc8,'message':[_0x38e0b2[_0xcf69('0x62')],_0x2f97f5[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')});})[_0xcf69('0x18')](function(_0x5d5dfe){_0x48774f(_0x746a64[_0xcf69('0x19')](0x1f5,[_0x38e0b2[_0xcf69('0x62')],_0x5d5dfe[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x48774f(_0x746a64['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x595e2f){var _0x4dbf4e=this;return new Promise(function(_0x96cf1d,_0x270e79){if(ami['isConnected']()==![]){return _0x270e79(_0x4dbf4e['error'](0x1f4,[config['asterisk']['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x3d1055=schema(properties[_0xcf69('0x7c')])['validate'](_0x595e2f);if(_0x3d1055[_0xcf69('0x5b')]>0x0){return _0x270e79(_0x4dbf4e[_0xcf69('0x19')](0x1f4,_['map'](_0x3d1055,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x3cfb21=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0x595e2f[_0xcf69('0x62')]});if(_0x3cfb21&&_0x3cfb21['channel']){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7d'),'channel':_0x3cfb21[_0xcf69('0x67')],'exten':_0x595e2f[_0xcf69('0x7e')],'context':_0x595e2f['context']||_0x3cfb21[_0xcf69('0x7f')],'priority':0x1})[_0xcf69('0x20')](function(_0x2cdcc3){_0x96cf1d({'code':0xc8,'message':[_0x595e2f[_0xcf69('0x62')],_0x2cdcc3['message'][_0xcf69('0x6a')]()]['join']('\x20')});})[_0xcf69('0x18')](function(_0x1af8a0){_0x270e79(_0x4dbf4e['error'](0x1f5,[_0x595e2f['uniqueid'],_0x1af8a0['message'][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x270e79(_0x4dbf4e['error'](0x1f5,_0xcf69('0x79')));}});},'Agents':function(_0x2002e1){return new Promise(function(_0x145bde,_0x2cd107){var _0x1cb7fd=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0xc')]);_0x145bde({'count':_0x1cb7fd[_0xcf69('0x5b')],'rows':_0x1cb7fd});});},'Telephones':function(_0x3f67d7){return new Promise(function(_0x4a7f65,_0x455dd0){var _0x2ca0d3=_[_0xcf69('0x77')](_0x4d8180['telephones']);_0x4a7f65({'count':_0x2ca0d3['length'],'rows':_0x2ca0d3});});},'Trunks':function(_0x57f3cb){return new Promise(function(_0x24194c,_0x587c1b){var _0x5eabdb=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x80')]);_0x24194c({'count':_0x5eabdb[_0xcf69('0x5b')],'rows':_0x5eabdb});});},'OutboundChannels':function(_0x352d40){return new Promise(function(_0x2b79f0,_0x1fc8db){var _0xeb1b54=_['values'](_0x4d8180[_0xcf69('0x81')]);_0x2b79f0({'count':_0xeb1b54[_0xcf69('0x5b')],'rows':_0xeb1b54});});},'Outbound':function(_0x29e5fc){return new Promise(function(_0x2fbec3,_0x53438c){_0x2fbec3(_0x4d8180[_0xcf69('0x30')]);});},'Campaigns':function(_0xf339fa){return new Promise(function(_0x29d887,_0x3c7db3){var _0xac1fa9=_['values'](_0x4d8180['campaigns']);_0x29d887({'count':_0xac1fa9[_0xcf69('0x5b')],'rows':_0xac1fa9});});},'VoiceQueuesPreview':function(_0x165f37){var _0x4ece02=this;return new Promise(function(_0x14e9d6,_0x45a3a7){_0x1c813d['run'](_0x165f37['id'])[_0xcf69('0x20')](function(_0x548195){_0x14e9d6({'code':0xc8,'message':_0x548195[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3d1fb0){_0x45a3a7(_0x4ece02[_0xcf69('0x19')](0x1f4,_0x3d1fb0[_0xcf69('0x17')]));});});},'EventManager':function(_0x1fe4a9){var _0x29574f=this;return new Promise(function(_0x478426,_0x3748b5){if(!_0x1fe4a9[_0xcf69('0x82')]){return _0x3748b5(_0x29574f[_0xcf69('0x19')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xcf69('0x83')](_0xcf69('0x84')+_0x1fe4a9['event'],_0x1fe4a9['message']);_0x478426({'code':0xc8,'message':_0x1fe4a9});});},'FaxAccounts':function(_0x11cdad){return new Promise(function(_0x437d15,_0x3f7b13){var _0x4c8346=_['values'](_0x4d8180[_0xcf69('0x85')]);_0x437d15({'count':_0x4c8346[_0xcf69('0x5b')],'rows':_0x4c8346});});},'SendFax':function(_0x8a4d91){var _0x47d3cb=this;return new Promise(function(_0x172362,_0x2f2ca0){_0x168197[_0xcf69('0x86')](_0x8a4d91)['then'](function(_0x363533){_0x172362({'code':0xc8,'message':_0x363533[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3e73b9){_0x2f2ca0(_0x47d3cb[_0xcf69('0x19')](0x1f4,_0x3e73b9[_0xcf69('0x17')]));});});},'CheckAfterSend':function(_0x2d1bbf){var _0x4bca3d=this;return new Promise(function(_0x3e29d3,_0x1279fc){_0x168197['checkAfterSend'](_0x2d1bbf)[_0xcf69('0x20')](function(_0x17ef57){_0x3e29d3({'code':0xc8,'message':_0x17ef57[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x18db19){_0x1279fc(_0x4bca3d[_0xcf69('0x19')](0x1f4,_0x18db19['message']));});});}};var _0x1d7528=jayson[_0xcf69('0x87')](_0x3b7608)[_0xcf69('0x88')]();_0x1d7528['on'](_0xcf69('0x19'),function(_0x220220){return _0x35aa67(_0x220220);});_0x1d7528['listen'](0x232a,_0xcf69('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x225c65(_0xcf69('0x8a')+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 d3a9850..e9426dc 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 _0x0e85=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x0e85,0x7c));var _0x50e8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x0e85[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var Redis=require('ioredis');var util=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x50e8('0x4')]=_['defaults'](config[_0x50e8('0x4')],{'host':_0x50e8('0x5'),'port':0x18eb});var io=require(_0x50e8('0x6'))(new Redis(config[_0x50e8('0x4')]));function emit(_0x5e8b01,_0x3ce904,_0x108edc,_0x42665e,_0x988da0){logger[_0x50e8('0x7')](_0x50e8('0x8'),_0x5e8b01,_0x3ce904['id'],_0x108edc,_0x42665e,JSON['stringify'](_0x988da0));io['to'](_0x108edc)[_0x50e8('0x9')](_0x42665e,_0x988da0);}exports[_0x50e8('0xa')]=function(_0x19d1bc,_0x2d4750,_0x154b9e,_0x194a89){var _0x45dc6f,_0x3d25ea;var _0x55ba0a={};var _0x56707f=Number(_0x154b9e[_0x50e8('0xb')]);var _0x24d381=_0x154b9e['data2']?Boolean(Number(_0x154b9e['data2'])):![];var _0x3cb45c;var _0x2abda1=![];if(!_[_0x50e8('0xc')](_0x154b9e[_0x50e8('0xd')])){if(_0x154b9e['data5']=='1')_0x2abda1=!![];}if(!_0x2abda1){if(_0x194a89[_0x50e8('0xe')]){_0x55ba0a['id']=_0x194a89[_0x50e8('0xe')];}}if(!_0x55ba0a['id']){_0x55ba0a[_0x50e8('0xf')]=_0x56707f;_0x3cb45c=_0x154b9e['data3']&&_0x154b9e['data3']!=='0'?_0x154b9e[_0x50e8('0x10')][_0x50e8('0x11')](','):[_0x50e8('0x12')];_0x55ba0a[_0x50e8('0x13')]=_[_0x50e8('0x14')](_0x3cb45c,function(_0x1f0338){var _0x5642bf={};_0x5642bf[_0x1f0338]=_0x194a89['routeId']?_0x194a89[_0x50e8('0x15')]:_0x194a89[_0x50e8('0x16')];return _0x5642bf;});}var _0x40d060=['id',_0x50e8('0x17'),_0x50e8('0x18'),_0x50e8('0x12'),_0x50e8('0x19'),'fax',_0x50e8('0xf'),'createdAt',_0x50e8('0x1a'),_0x50e8('0x1b')];var _0xd263d=_[_0x50e8('0x1c')](_0x40d060,_0x3cb45c);BPromise[_0x50e8('0x1d')]()['then'](cmContactRpc[_0x50e8('0x1e')]({'attributes':_0xd263d,'where':_0x55ba0a}))[_0x50e8('0x1f')](function(_0x58110d){_0x3d25ea=_0x58110d;if(!_[_0x50e8('0x20')](_0x3d25ea)){if(_0x3d25ea[_0x50e8('0x21')]===0x1){_0x45dc6f=_0x3d25ea[0x0];logger['info'](_0x50e8('0x22'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id'],_0x45dc6f['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x194a89['uniqueid'],_0x2d4750['id'],_[_0x50e8('0x14')](_0x3d25ea,'id')[_0x50e8('0x24')](','));}return;}else{logger[_0x50e8('0x7')](_0x50e8('0x25'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);var _0x13b6e9={'ListId':_0x56707f};var _0x53d848=_0x154b9e[_0x50e8('0x26')]&&_0x154b9e[_0x50e8('0x26')]!=='0'?_0x154b9e['data4']:_0x50e8('0x12');if(_0x24d381){logger[_0x50e8('0x7')](_0x50e8('0x27'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_['isNil'](_0x194a89[_0x50e8('0x28')])?_0x194a89['calleridnum']:_0x194a89[_0x50e8('0x15')];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9['firstName']=_0x194a89[_0x50e8('0x29')]&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x29')]:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89['destcalleridname']!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x50e8('0x1f')](cmContactRpc[_0x50e8('0x2d')](_0x13b6e9))[_0x50e8('0x1f')](function(_0x47ace2){_0x45dc6f=_0x47ace2;_0x3d25ea['push'](_0x47ace2);if(_0x45dc6f){logger[_0x50e8('0x7')](_0x50e8('0x2e'),_0x194a89['uniqueid'],_0x2d4750['id'],_0x45dc6f['id']);}return;});}else{logger[_0x50e8('0x7')](_0x50e8('0x2f'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_[_0x50e8('0xc')](_0x194a89['routeId'])?_0x194a89[_0x50e8('0x16')]:_0x194a89['destcalleridnum'];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9[_0x50e8('0x17')]=_0x194a89['calleridname']&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89['calleridname']:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89[_0x50e8('0x2c')]!==''?_0x194a89[_0x50e8('0x2c')]:_0x50e8('0x2b');}_0x45dc6f=_0x13b6e9;_0x3d25ea[_0x50e8('0x30')](_0x13b6e9);return;}}})[_0x50e8('0x1f')](function(){if(_0x19d1bc){emit(_0x194a89['uniqueid'],_0x2d4750,util[_0x50e8('0x31')](_0x50e8('0x32'),_0x19d1bc[_0x50e8('0x33')]),util['format']('trigger:%s',_0x154b9e['action'][_0x50e8('0x34')]()),{'evt':_[_0x50e8('0x35')](_0x194a89,{'autoCreate':_0x24d381}),'contact':_0x45dc6f===undefined?{}:_0x45dc6f,'contacts':_0x3d25ea[_0x50e8('0x21')]===0x0?undefined:_0x3d25ea});}});}; \ No newline at end of file +var _0xbec5=['fax','scheduledAt','union','resolve','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','firstName','phone','mobile'];(function(_0x1343fe,_0x1b99ab){var _0x354bc7=function(_0x5e87d7){while(--_0x5e87d7){_0x1343fe['push'](_0x1343fe['shift']());}};_0x354bc7(++_0x1b99ab);}(_0xbec5,0xe5));var _0x5bec=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xbec5[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var Redis=require('ioredis');var util=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));var logger=require(_0x5bec('0x4'))(_0x5bec('0x5'));var cmContactRpc=require(_0x5bec('0x6'));config['redis']=_[_0x5bec('0x7')](config[_0x5bec('0x8')],{'host':_0x5bec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bec('0x8')]));function emit(_0x28a427,_0x38456e,_0x406e65,_0x43d96e,_0x302aae){logger[_0x5bec('0xa')](_0x5bec('0xb'),_0x28a427,_0x38456e['id'],_0x406e65,_0x43d96e,JSON['stringify'](_0x302aae));io['to'](_0x406e65)[_0x5bec('0xc')](_0x43d96e,_0x302aae);}exports['exec']=function(_0x748f75,_0x2a70a7,_0x117162,_0x4a5482){var _0x288d1b,_0x18fa47;var _0x16226b={};var _0x57ffc4=Number(_0x117162[_0x5bec('0xd')]);var _0x1c888f=_0x117162['data2']?Boolean(Number(_0x117162[_0x5bec('0xe')])):![];var _0xaa984d;var _0x35393a=![];if(!_[_0x5bec('0xf')](_0x117162[_0x5bec('0x10')])){if(_0x117162[_0x5bec('0x10')]=='1')_0x35393a=!![];}if(!_0x35393a){if(_0x4a5482[_0x5bec('0x11')]){_0x16226b['id']=_0x4a5482[_0x5bec('0x11')];}}if(!_0x16226b['id']){_0x16226b[_0x5bec('0x12')]=_0x57ffc4;_0xaa984d=_0x117162[_0x5bec('0x13')]&&_0x117162[_0x5bec('0x13')]!=='0'?_0x117162[_0x5bec('0x13')][_0x5bec('0x14')](','):['phone'];_0x16226b['$or']=_[_0x5bec('0x15')](_0xaa984d,function(_0x773740){var _0x31ad9c={};_0x31ad9c[_0x773740]=_0x4a5482[_0x5bec('0x16')]?_0x4a5482['destcalleridnum']:_0x4a5482['calleridnum'];return _0x31ad9c;});}var _0x3cd354=['id',_0x5bec('0x17'),'lastName',_0x5bec('0x18'),_0x5bec('0x19'),_0x5bec('0x1a'),_0x5bec('0x12'),'createdAt',_0x5bec('0x1b'),'updatedAt'];var _0x191c0f=_[_0x5bec('0x1c')](_0x3cd354,_0xaa984d);BPromise[_0x5bec('0x1d')]()[_0x5bec('0x1e')](cmContactRpc[_0x5bec('0x1f')]({'attributes':_0x191c0f,'where':_0x16226b}))['then'](function(_0x232584){_0x18fa47=_0x232584;if(!_['isEmpty'](_0x18fa47)){if(_0x18fa47[_0x5bec('0x20')]===0x1){_0x288d1b=_0x18fa47[0x0];logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}else{logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_[_0x5bec('0x15')](_0x18fa47,'id')[_0x5bec('0x22')](','));}return;}else{logger[_0x5bec('0xa')](_0x5bec('0x23'),_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);var _0x2dc014={'ListId':_0x57ffc4};var _0x4de66a=_0x117162['data4']&&_0x117162['data4']!=='0'?_0x117162[_0x5bec('0x24')]:_0x5bec('0x18');if(_0x1c888f){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482['routeId'])?_0x4a5482[_0x5bec('0x25')]:_0x4a5482[_0x5bec('0x26')];if(_['isNil'](_0x4a5482['routeId'])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482[_0x5bec('0x27')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x27')]:_0x5bec('0x29');}else{_0x2dc014['firstName']=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482['destcalleridname']!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:_0x5bec('0x29');}return BPromise[_0x5bec('0x1d')]()['then'](cmContactRpc[_0x5bec('0x2b')](_0x2dc014))[_0x5bec('0x1e')](function(_0xfc7d41){_0x288d1b=_0xfc7d41;_0x18fa47['push'](_0xfc7d41);if(_0x288d1b){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}return;});}else{logger[_0x5bec('0xa')](_0x5bec('0x2c'),_0x4a5482['uniqueid'],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])?_0x4a5482['calleridnum']:_0x4a5482[_0x5bec('0x26')];if(_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482['calleridname']!==_0x5bec('0x28')?_0x4a5482['calleridname']:_0x5bec('0x29');}else{_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482[_0x5bec('0x2a')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:'Unknown';}_0x288d1b=_0x2dc014;_0x18fa47[_0x5bec('0x2d')](_0x2dc014);return;}}})[_0x5bec('0x1e')](function(){if(_0x748f75){emit(_0x4a5482[_0x5bec('0x21')],_0x2a70a7,util['format'](_0x5bec('0x2e'),_0x748f75[_0x5bec('0x2f')]),util['format'](_0x5bec('0x30'),_0x117162['action'][_0x5bec('0x31')]()),{'evt':_[_0x5bec('0x32')](_0x4a5482,{'autoCreate':_0x1c888f}),'contact':_0x288d1b===undefined?{}:_0x288d1b,'contacts':_0x18fa47[_0x5bec('0x20')]===0x0?undefined:_0x18fa47});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 752197d..4b18750 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 _0x9a18=['account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','util','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','popup','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','clone','motionChannel','undefined','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','contactmanager','motionbar','browser','data1','data2','html','templates','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','600','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','toLowerCase','exec','queue','routeId','urlforward','parse','query','search','checkTrigger','AllConditions','checkConditions','channel','AnyConditions','length','some'];(function(_0xcc69c5,_0x5b35b2){var _0x14ec59=function(_0x4377ec){while(--_0x4377ec){_0xcc69c5['push'](_0xcc69c5['shift']());}};_0x14ec59(++_0x5b35b2);}(_0x9a18,0x187));var _0x89a1=function(_0x30f2e9,_0x5e5c49){_0x30f2e9=_0x30f2e9-0x0;var _0x161694=_0x9a18[_0x30f2e9];return _0x161694;};'use strict';var util=require(_0x89a1('0x0'));var _=require('lodash');var url=require(_0x89a1('0x1'));var Mustache=require(_0x89a1('0x2'));var Redis=require(_0x89a1('0x3'));var urlforward=require(_0x89a1('0x4'));var integration=require(_0x89a1('0x5'));var cmContact=require('./cmContact');var script=require(_0x89a1('0x6'));var config=require(_0x89a1('0x7'));var logger=require(_0x89a1('0x8'))(_0x89a1('0x9'));var ami=require(_0x89a1('0xa'));config[_0x89a1('0xb')]=_[_0x89a1('0xc')](config[_0x89a1('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x89a1('0xb')]));var operators={'equals':function(_0x4993c1,_0x751fb3){return _0x4993c1==_0x751fb3;},'not_equals':function(_0x541951,_0x3c7e38){return _0x541951!=_0x3c7e38;}};var barAndWebActions=[_0x89a1('0xd'),_0x89a1('0x1'),_0x89a1('0xe')];function Trigger(_0x25fef3){this[_0x89a1('0xf')]=_0x25fef3[_0x89a1('0xf')];this[_0x89a1('0x10')]=_0x25fef3[_0x89a1('0x10')];this[_0x89a1('0x11')]=_0x25fef3[_0x89a1('0x11')];this['templates']=_0x25fef3['templates'];this[_0x89a1('0x12')]=_0x25fef3[_0x89a1('0x12')];this[_0x89a1('0x13')]=_0x25fef3[_0x89a1('0x13')];this['freshdeskAccounts']=_0x25fef3[_0x89a1('0x14')];this[_0x89a1('0x15')]=_0x25fef3['salesforceAccounts'];this[_0x89a1('0x16')]=_0x25fef3[_0x89a1('0x16')];this[_0x89a1('0x17')]=_0x25fef3[_0x89a1('0x17')];this[_0x89a1('0x18')]=_0x25fef3[_0x89a1('0x18')];this[_0x89a1('0x19')]=_0x25fef3[_0x89a1('0x19')];this['servicenowAccounts']=_0x25fef3[_0x89a1('0x1a')];this[_0x89a1('0x1b')]=_0x25fef3[_0x89a1('0x1b')];this[_0x89a1('0x1c')]=_0x25fef3[_0x89a1('0x1c')];this['accounts']={'zendesk':this[_0x89a1('0x13')],'salesforce':this[_0x89a1('0x15')],'freshdesk':this[_0x89a1('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x89a1('0x17')],'desk':this[_0x89a1('0x18')],'vtiger':this[_0x89a1('0x19')],'dynamics365':this[_0x89a1('0x1b')],'freshsales':this[_0x89a1('0x1c')],'servicenow':this[_0x89a1('0x1a')]};ami['on']('custom:agentcalled',this[_0x89a1('0x1d')]['bind'](this));ami['on'](_0x89a1('0x1e'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x20'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x21'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x89a1('0x23'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x24'),this[_0x89a1('0x1d')]['bind'](this));ami['on'](_0x89a1('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x89a1('0x26'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x27'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x28'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on']('custom:dialbegin',this[_0x89a1('0x29')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x2a'),this[_0x89a1('0x29')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x2b'),this[_0x89a1('0x29')]['bind'](this));ami['on'](_0x89a1('0x2c'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on']('custom:closedinteraction',this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x2d'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x2e'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x2f'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x30'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x31'),this[_0x89a1('0x1d')][_0x89a1('0x1f')](this));ami['on'](_0x89a1('0x32'),this['syncCustomEvent'][_0x89a1('0x1f')](this));}Trigger[_0x89a1('0x33')][_0x89a1('0x34')]=function(_0x2b86dd,_0xb270d1,_0x2cf63f){logger['info'](_0x2b86dd,_0xb270d1,JSON[_0x89a1('0x35')](_0x2cf63f));io['to'](_0x2b86dd)[_0x89a1('0x34')](_0xb270d1,_0x2cf63f);};Trigger['prototype'][_0x89a1('0x1d')]=function(_0x52e779){var _0x435d95=_[_0x89a1('0x36')](_0x52e779);if(typeof _0x435d95[_0x89a1('0x37')]===_0x89a1('0x38')){_0x435d95[_0x89a1('0x37')]='voice';}this[_0x89a1('0x39')](_0x435d95);};Trigger[_0x89a1('0x33')][_0x89a1('0x29')]=function(_0x51118f){if(this[_0x89a1('0x10')][_0x51118f[_0x89a1('0x3a')]]){this[_0x89a1('0x1d')](_0x51118f);}};Trigger[_0x89a1('0x33')][_0x89a1('0x39')]=function(_0x315b40){var _0x270fe6;for(var _0x361c1b in this['triggers']){if(this['triggers'][_0x89a1('0x3b')](_0x361c1b)){if(this[_0x89a1('0xf')][_0x361c1b][_0x89a1('0x3c')]){_0x270fe6=this['checkTrigger'](this[_0x89a1('0xf')][_0x361c1b],_0x315b40);if(_0x270fe6){_[_0x89a1('0x3d')](_0x315b40,_0x315b40[_0x89a1('0x3e')]);for(var _0x357dee=0x0,_0x4c2247,_0x21b3d4,_0x702874;_0x357dee0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x326f,0xd1));var _0xf326=function(_0x55d189,_0xe1358b){_0x55d189=_0x55d189-0x0;var _0x485fdf=_0x326f[_0x55d189];return _0x485fdf;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 76c0868..b823a49 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 _0xa417=['Fields','phonecall','callDirection','queue','phonecalls','headers','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/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','replace','%2b','Bearer\x20','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts('];(function(_0x32b84b,_0x4f4e57){var _0x2110ad=function(_0x59e8b5){while(--_0x59e8b5){_0x32b84b['push'](_0x32b84b['shift']());}};_0x2110ad(++_0x4f4e57);}(_0xa417,0xf6));var _0x7a41=function(_0x4a8bea,_0x44a102){_0x4a8bea=_0x4a8bea-0x0;var _0x946365=_0xa417[_0x4a8bea];return _0x946365;};'use strict';var _=require('lodash');var rp=require(_0x7a41('0x0'));var util=require(_0x7a41('0x1'));var intUtil=require('./util');var md5=require(_0x7a41('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x7a41('0x3'));var config=require('../../../../config/environment');config[_0x7a41('0x4')]=_[_0x7a41('0x5')](config[_0x7a41('0x4')],{'host':_0x7a41('0x6'),'port':0x18eb});var io=require(_0x7a41('0x7'))(new Redis(config[_0x7a41('0x4')]));function getAuthToken(_0xf4924e,_0x41ea6e,_0x33e540){if(_0xf4924e[_0x7a41('0x8')]){_0xf4924e[_0x7a41('0x9')]=_0xf4924e[_0x7a41('0xa')][_0x7a41('0xb')];_0xf4924e[_0x7a41('0xc')]=_0xf4924e[_0x7a41('0xa')]['data2'];return Promise['resolve'](_0xf4924e['CloudProvider'][_0x7a41('0xd')]);}var _0x1c8bb8={'method':_0x7a41('0xe'),'uri':_0x41ea6e,'form':{'client_id':_0xf4924e[_0x7a41('0xf')],'resource':_0xf4924e[_0x7a41('0x9')],'username':_0xf4924e[_0x7a41('0x10')],'password':_0xf4924e[_0x7a41('0x11')],'grant_type':_0x7a41('0x11'),'client_secret':_0xf4924e[_0x7a41('0x12')]},'json':!![]};return rp(_0x1c8bb8)['then'](function(_0x14825c){return _0x14825c[_0x7a41('0x13')];})[_0x7a41('0x14')](function(_0x4a42ba){logger[_0x7a41('0x15')]('['+[_0x33e540[_0x7a41('0x16')]()]+_0x7a41('0x17'));return _0x4a42ba[_0x7a41('0x18')];});}function getUser(_0x5abe4f,_0x185625,_0x3f35b7,_0x442a6f,_0x33a135,_0x23ce43){return new Promise(function(_0x4b92d9,_0x22cd5c){return getAuthToken(_0x185625,_0x442a6f,_0x23ce43)[_0x7a41('0x19')](function(_0x1e2068){var _0x11b4f9={'method':_0x7a41('0x1a'),'uri':_0x33a135+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x1e2068,'OData-Version':_0x7a41('0x1b')},'json':!![]};return rp(_0x11b4f9);})[_0x7a41('0x19')](function(_0x2665f2){var _0x26b3d9=_0x2665f2[_0x7a41('0x1c')];var _0x52d475=![];var _0x31e54a=null;if(!_['isNil'](_0x3f35b7)){if(intUtil[_0x7a41('0x1d')](_0x3f35b7[_0x7a41('0x1e')])){_0x5abe4f[_0x7a41('0x1f')]=_0x3f35b7['email'];for(_0x31e54a=0x0;_0x31e54a<_0x26b3d9[_0x7a41('0x20')];_0x31e54a++){if(_0x26b3d9[_0x31e54a][_0x7a41('0x21')]===_0x3f35b7[_0x7a41('0x1e')]&&!_0x26b3d9[_0x31e54a][_0x7a41('0x22')]){_0x52d475=!![];logger[_0x7a41('0x23')]('['+[_0x23ce43[_0x7a41('0x16')]()]+']\x20Agent\x20found\x20'+_0x26b3d9[_0x31e54a]['systemuserid']+'!');_0x5abe4f[_0x7a41('0x24')]=_0x26b3d9[_0x31e54a][_0x7a41('0x25')];}}}}if(!_0x52d475){logger[_0x7a41('0x23')]('['+[_0x23ce43['toUpperCase']()]+_0x7a41('0x26'));_0x5abe4f[_0x7a41('0x1f')]=_0x185625['username'];for(_0x31e54a=0x0;_0x31e54a<_0x26b3d9[_0x7a41('0x20')];_0x31e54a++){if(_0x26b3d9[_0x31e54a][_0x7a41('0x21')]===_0x185625[_0x7a41('0x10')]){_0x5abe4f[_0x7a41('0x24')]=_0x26b3d9[_0x31e54a][_0x7a41('0x25')];}}}_0x4b92d9(_0x5abe4f);})['catch'](function(_0x5bb940){_0x22cd5c(_0x5bb940['message']);});});}function createEndUser(_0x2ad596,_0x5a2099,_0x360c7b,_0x2b72f6,_0x393039,_0x3e8411){return new Promise(function(_0xaacefc,_0x4bdb78){return getAuthToken(_0x5a2099,_0x360c7b,_0x3e8411)[_0x7a41('0x19')](function(_0x23c0c4){var _0x1860ff=_0x3e8411[_0x7a41('0x27')]()===_0x7a41('0x28')?_0x393039['destcalleridnum']:_0x393039[_0x7a41('0x29')];var _0x18098a={'method':_0x7a41('0xe'),'uri':_0x2b72f6+_0x7a41('0x2a'),'body':{'telephone1':_0x1860ff,'fullname':_0x1860ff,'firstname':_0x1860ff,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7a41('0x2b')+_0x2ad596['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x23c0c4,'OData-Version':_0x7a41('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x18098a);})['then'](function(_0x19c01a){var _0xdd816a=_0x19c01a['headers'][_0x7a41('0x2c')];var _0x856eea=_0xdd816a[_0x7a41('0x2d')](_0xdd816a[_0x7a41('0x2e')]('(')+0x1,_0xdd816a[_0x7a41('0x2e')](')'));_0x2ad596[_0x7a41('0x2f')]=_0x856eea;_0xaacefc(_0x2ad596);})[_0x7a41('0x14')](function(_0x50ea95){_0x4bdb78(_0x50ea95['message']);});});}function getEndUser(_0x33831d,_0x5da84c,_0x504538,_0xcc58ce,_0x2860f6,_0x495caf,_0x2b6ebb){var _0x1ac4b6=_0x495caf['toLowerCase']()===_0x7a41('0x28')?_0x2860f6[_0x7a41('0x30')]:_0x2860f6['calleridnum'];return getAuthToken(_0x5da84c,_0x504538,_0x495caf)[_0x7a41('0x19')](function(_0x51804f){var _0x4bb29b={'method':_0x7a41('0x1a'),'uri':_0xcc58ce+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x1ac4b6[_0x7a41('0x31')]('+',_0x7a41('0x32'))+'\x27','headers':{'Authorization':_0x7a41('0x33')+_0x51804f,'If-None-Match':null,'OData-Version':_0x7a41('0x1b')},'json':!![]};return rp(_0x4bb29b);})['then'](function(_0x5d0c6b){var _0xe97d0a=![];if(!_0x5d0c6b)return _0xe97d0a;var _0x301d7a=_0x5d0c6b[_0x7a41('0x1c')];for(var _0x36d697=0x0;_0x36d697<_0x301d7a['length'];_0x36d697++){if(_0x301d7a[_0x36d697][_0x7a41('0x34')]===_0x1ac4b6){_0xe97d0a=!![];_0x33831d[_0x7a41('0x2f')]=_0x301d7a[_0x36d697][_0x7a41('0x35')];}}return _0xe97d0a;})[_0x7a41('0x19')](function(_0x105509){if(_0x105509)return _0x33831d;if(_0x2b6ebb===_0x7a41('0x36')){logger[_0x7a41('0x23')]('['+[_0x495caf[_0x7a41('0x16')]()]+_0x7a41('0x37'));return _0x33831d;}return createEndUser(_0x33831d,_0x5da84c,_0x504538,_0xcc58ce,_0x2860f6,_0x495caf)[_0x7a41('0x19')](function(_0x3db4aa){logger['info']('['+[_0x495caf[_0x7a41('0x16')]()]+_0x7a41('0x38'),_0x3db4aa[_0x7a41('0x2f')]);return _0x3db4aa;});});}function getCustomFields(_0x8f5ce3,_0x689c88,_0xbe6b2a){var _0x30405b={};if(_0x8f5ce3['length']>0x0){_[_0x7a41('0x39')](_0x8f5ce3,function(_0x3ce16a){if(_[_0x7a41('0x3a')]([_0x7a41('0x3b'),_0x7a41('0x3c')],_0x3ce16a[_0x7a41('0x3d')])&&_0x3ce16a[_0x7a41('0x3e')]&&!_0x3ce16a[_0x7a41('0x3f')]){var _0xf01102=_0x3ce16a[_0x7a41('0x40')]['toLowerCase']();var _0x53bea0=_0xf01102['substring'](0x0,_0xf01102['indexOf']('_'));var _0x5fd999=_0xf01102[_0x7a41('0x2d')](_0xf01102[_0x7a41('0x41')]('_')+0x1);if(_0x53bea0===_0xbe6b2a){_0x30405b[_0x5fd999]=_0x3ce16a[_0x7a41('0x42')];}}});}return _0x30405b;}function getTicket(_0x57add2,_0x52b346,_0x565007,_0x32c6a2,_0xc438d5,_0x2a28a5,_0x58e28e){return new Promise(function(_0x4fdd85,_0x30d43d){var _0x409c4e;return getAuthToken(_0x52b346,_0x565007,_0x58e28e)[_0x7a41('0x19')](function(_0x2246f1){if(_0x2a28a5[_0x7a41('0x43')]===_0x7a41('0x44')){_0x409c4e={'method':_0x7a41('0xe'),'uri':_0x32c6a2+_0x7a41('0x45'),'body':Object[_0x7a41('0x46')]({},{'title':intUtil[_0x7a41('0x47')](_0x2a28a5[_0x7a41('0x48')],_0xc438d5,'\x20'),'description':intUtil['getString'](_0x2a28a5[_0x7a41('0x49')],_0xc438d5,'\x0a'),'customerid_contact@odata.bind':_0x57add2[_0x7a41('0x2f')]?_0x7a41('0x4a')+_0x57add2[_0x7a41('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x57add2['userId']+')','caseorigincode':'1'},getCustomFields(_0x2a28a5[_0x7a41('0x4b')],_0xc438d5,_0x2a28a5[_0x7a41('0x43')])),'headers':{'Authorization':_0x7a41('0x33')+_0x2246f1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2a28a5[_0x7a41('0x43')]===_0x7a41('0x4c')){var _0xbcd00c=_0x57add2[_0x7a41('0x2f')]?[{'partyid_systemuser@odata.bind':_0x7a41('0x2b')+_0x57add2[_0x7a41('0x24')]+')','participationtypemask':_0x57add2[_0x7a41('0x4d')]===_0x7a41('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x57add2[_0x7a41('0x2f')]+')','participationtypemask':_0x57add2[_0x7a41('0x4d')]===_0x7a41('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x57add2['userId']+')','participationtypemask':_0x57add2[_0x7a41('0x4d')]===_0x7a41('0x4e')?0x2:0x1}];_0x409c4e={'method':'POST','uri':_0x32c6a2+_0x7a41('0x4f'),'body':Object['assign']({},{'subject':intUtil[_0x7a41('0x47')](_0x2a28a5[_0x7a41('0x48')],_0xc438d5,'\x20'),'phonenumber':String(_0xc438d5[_0x7a41('0x29')]),'description':intUtil[_0x7a41('0x47')](_0x2a28a5[_0x7a41('0x49')],_0xc438d5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x57add2[_0x7a41('0x2f')]?_0x7a41('0x4a')+_0x57add2[_0x7a41('0x2f')]+')':undefined,'ownerid@odata.bind':_0x7a41('0x2b')+_0x57add2[_0x7a41('0x24')]+')','directioncode':_0x57add2['callDirection']===_0x7a41('0x4e')?![]:!![],'phonecall_activity_parties':_0xbcd00c},getCustomFields(_0x2a28a5[_0x7a41('0x4b')],_0xc438d5,_0x2a28a5['ticketType'])),'headers':{'Authorization':_0x7a41('0x33')+_0x2246f1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x409c4e);})[_0x7a41('0x19')](function(_0x25caa7){var _0x1bed46=_0x25caa7[_0x7a41('0x50')][_0x7a41('0x2c')];var _0x3cf08e=_0x1bed46['substring'](_0x1bed46[_0x7a41('0x2e')]('(')+0x1,_0x1bed46['lastIndexOf'](')'));_0x57add2[_0x7a41('0x51')]=_0x3cf08e;_0x4fdd85(_0x57add2);})[_0x7a41('0x14')](function(_0x2cc05d){_0x30d43d(_0x2cc05d[_0x7a41('0x18')]);});});}function emit(_0x464510,_0x3c4f15,_0x4a32f9,_0x18362b){var _0x174be0={'uri':util[_0x7a41('0x52')](_0x7a41('0x53'),_0x464510,_0x4a32f9,_0x18362b)};io['to'](util['format'](_0x7a41('0x54'),_0x3c4f15))[_0x7a41('0x55')](_0x7a41('0x56'),_0x174be0);}exports['cs']=function(_0x273577,_0x34c107,_0x349ff3,_0xe8d7f2,_0x2875da,_0x1865fa,_0x465c3a,_0x22ede0){var _0x5b9cd9={};_0x1865fa[_0x7a41('0x9')]=_0x1865fa['modernAuthentication']?intUtil['stripTrailingSlash'](_0x1865fa[_0x7a41('0xa')][_0x7a41('0xb')]):intUtil[_0x7a41('0x57')](_0x1865fa[_0x7a41('0x9')]);_0x1865fa[_0x7a41('0x58')]=intUtil[_0x7a41('0x57')](_0x1865fa[_0x7a41('0x58')]);_0x5b9cd9[_0x7a41('0x4d')]=_0x22ede0===_0x7a41('0x4e')||_0x22ede0===_0x7a41('0x59')?_0x7a41('0x4e'):_0x7a41('0x28');var _0x2ecee4=_0x1865fa[_0x7a41('0x8')]?util[_0x7a41('0x52')](_0x7a41('0x5a'),_0x1865fa[_0x7a41('0xa')][_0x7a41('0xb')]):util['format'](_0x7a41('0x5a'),_0x1865fa[_0x7a41('0x9')]);var _0x309360=util['format'](_0x7a41('0x5b'),_0x1865fa[_0x7a41('0xc')]);var _0x10b42e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1865fa[_0x7a41('0x58')],_0x34c107[_0x7a41('0x5c')],md5(_0x34c107[_0x7a41('0x5c')]));if(_0x2875da&&_0x2875da['monitor_format']){logger[_0x7a41('0x23')](_0x7a41('0x5d'),_0x7a41('0x5e'));_0x34c107['recordingURL']=_0x10b42e;}else if(_0x465c3a&&_0x465c3a['recordingFormat']&&_0x465c3a[_0x7a41('0x5f')]!=='none'){logger[_0x7a41('0x23')](_0x7a41('0x60'),_0x7a41('0x5e'));_0x34c107[_0x7a41('0x61')]=_0x10b42e;}else{_0x34c107[_0x7a41('0x61')]='';}return getUser(_0x5b9cd9,_0x1865fa,_0xe8d7f2,_0x309360,_0x2ecee4,_0x22ede0)[_0x7a41('0x19')](function(_0x29816c){logger['info']('['+_0x22ede0['toUpperCase']()+_0x7a41('0x62'),_0x29816c[_0x7a41('0x24')]);logger['info']('['+_0x22ede0['toUpperCase']()+_0x7a41('0x63'),_0x29816c[_0x7a41('0x1f')]);return getEndUser(_0x29816c,_0x1865fa,_0x309360,_0x2ecee4,_0x34c107,_0x22ede0,_0x349ff3[_0x7a41('0x64')]);})[_0x7a41('0x19')](function(_0x420928){logger[_0x7a41('0x23')]('['+_0x22ede0[_0x7a41('0x16')]()+_0x7a41('0x65'),_0x420928[_0x7a41('0x2f')]);logger[_0x7a41('0x23')]('['+_0x22ede0[_0x7a41('0x16')]()+_0x7a41('0x66'),_0x34c107['calleridnum']);return getTicket(_0x420928,_0x1865fa,_0x309360,_0x2ecee4,_0x34c107,_0x349ff3,_0x22ede0);})[_0x7a41('0x19')](function(_0x57c373){logger['info'](util[_0x7a41('0x52')]('['+_0x22ede0[_0x7a41('0x16')]()+_0x7a41('0x67'),_0x349ff3[_0x7a41('0x43')],_0x57c373[_0x7a41('0x51')]));logger[_0x7a41('0x23')](util[_0x7a41('0x52')]('['+_0x22ede0['toUpperCase']()+_0x7a41('0x68'),_0x22ede0));if(_0x22ede0!==_0x7a41('0x59')){logger[_0x7a41('0x23')]('['+_0x22ede0['toUpperCase']()+']',_0x7a41('0x69'));emit(_0x1865fa[_0x7a41('0x9')],_0xe8d7f2['name'],_0x349ff3['ticketType'],_0x57c373[_0x7a41('0x51')]);}})[_0x7a41('0x14')](function(_0x434d2f){logger[_0x7a41('0x15')]('['+_0x22ede0['toUpperCase']()+_0x7a41('0x6a'),_0x434d2f['message']);});}; \ No newline at end of file +var _0x0a9a=['ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','resolve','data5','POST','clientId','username','password','clientSecret','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','contacts','odata-entityid','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20created!','forEach','string','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','queue','callDirection','phonecalls','calleridnum','headers','lastIndexOf','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','lodash'];(function(_0x507494,_0x5adb3d){var _0x26ba02=function(_0x5da67d){while(--_0x5da67d){_0x507494['push'](_0x507494['shift']());}};_0x26ba02(++_0x5adb3d);}(_0x0a9a,0x1a7));var _0xa0a9=function(_0x1a4161,_0x4087cb){_0x1a4161=_0x1a4161-0x0;var _0x1a96c1=_0x0a9a[_0x1a4161];return _0x1a96c1;};'use strict';var _=require(_0xa0a9('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xa0a9('0x1'));var logger=require(_0xa0a9('0x2'))(_0xa0a9('0x3'));var config=require(_0xa0a9('0x4'));config[_0xa0a9('0x5')]=_[_0xa0a9('0x6')](config['redis'],{'host':_0xa0a9('0x7'),'port':0x18eb});var io=require(_0xa0a9('0x8'))(new Redis(config[_0xa0a9('0x5')]));function getAuthToken(_0x1f2f0d,_0x102dbf,_0x330f31){if(_0x1f2f0d[_0xa0a9('0x9')]){_0x1f2f0d[_0xa0a9('0xa')]=_0x1f2f0d[_0xa0a9('0xb')][_0xa0a9('0xc')];_0x1f2f0d['tenantId']=_0x1f2f0d[_0xa0a9('0xb')]['data2'];return Promise[_0xa0a9('0xd')](_0x1f2f0d[_0xa0a9('0xb')][_0xa0a9('0xe')]);}var _0x500c72={'method':_0xa0a9('0xf'),'uri':_0x102dbf,'form':{'client_id':_0x1f2f0d[_0xa0a9('0x10')],'resource':_0x1f2f0d[_0xa0a9('0xa')],'username':_0x1f2f0d[_0xa0a9('0x11')],'password':_0x1f2f0d[_0xa0a9('0x12')],'grant_type':_0xa0a9('0x12'),'client_secret':_0x1f2f0d[_0xa0a9('0x13')]},'json':!![]};return rp(_0x500c72)['then'](function(_0x753745){return _0x753745['access_token'];})['catch'](function(_0x2c8254){logger['error']('['+[_0x330f31[_0xa0a9('0x14')]()]+_0xa0a9('0x15'));return _0x2c8254[_0xa0a9('0x16')];});}function getUser(_0x4f901a,_0x2255ae,_0x174c2b,_0x3283b9,_0x134763,_0x2d280f){return new Promise(function(_0x58d702,_0x139923){return getAuthToken(_0x2255ae,_0x3283b9,_0x2d280f)[_0xa0a9('0x17')](function(_0x3fcd6a){var _0xfc7e28={'method':_0xa0a9('0x18'),'uri':_0x134763+_0xa0a9('0x19'),'headers':{'Authorization':_0xa0a9('0x1a')+_0x3fcd6a,'OData-Version':_0xa0a9('0x1b')},'json':!![]};return rp(_0xfc7e28);})[_0xa0a9('0x17')](function(_0x31fe51){var _0x58c1a5=_0x31fe51[_0xa0a9('0x1c')];var _0x43b1b8=![];var _0x39b20d=null;if(!_[_0xa0a9('0x1d')](_0x174c2b)){if(intUtil['validateEmail'](_0x174c2b[_0xa0a9('0x1e')])){_0x4f901a[_0xa0a9('0x1f')]=_0x174c2b['email'];for(_0x39b20d=0x0;_0x39b20d<_0x58c1a5[_0xa0a9('0x20')];_0x39b20d++){if(_0x58c1a5[_0x39b20d][_0xa0a9('0x21')]===_0x174c2b[_0xa0a9('0x1e')]&&!_0x58c1a5[_0x39b20d][_0xa0a9('0x22')]){_0x43b1b8=!![];logger[_0xa0a9('0x23')]('['+[_0x2d280f[_0xa0a9('0x14')]()]+_0xa0a9('0x24')+_0x58c1a5[_0x39b20d][_0xa0a9('0x25')]+'!');_0x4f901a[_0xa0a9('0x26')]=_0x58c1a5[_0x39b20d][_0xa0a9('0x25')];}}}}if(!_0x43b1b8){logger['info']('['+[_0x2d280f[_0xa0a9('0x14')]()]+_0xa0a9('0x27'));_0x4f901a[_0xa0a9('0x1f')]=_0x2255ae['username'];for(_0x39b20d=0x0;_0x39b20d<_0x58c1a5['length'];_0x39b20d++){if(_0x58c1a5[_0x39b20d][_0xa0a9('0x21')]===_0x2255ae['username']){_0x4f901a[_0xa0a9('0x26')]=_0x58c1a5[_0x39b20d][_0xa0a9('0x25')];}}}_0x58d702(_0x4f901a);})[_0xa0a9('0x28')](function(_0x57de51){_0x139923(_0x57de51[_0xa0a9('0x16')]);});});}function createEndUser(_0x5c3f81,_0x4b1780,_0x20cfe1,_0x23e8be,_0x41fc9f,_0x290b8e){return new Promise(function(_0x3817d1,_0x16ed1e){return getAuthToken(_0x4b1780,_0x20cfe1,_0x290b8e)[_0xa0a9('0x17')](function(_0x20309d){var _0x370903=_0x290b8e['toLowerCase']()===_0xa0a9('0x29')?_0x41fc9f[_0xa0a9('0x2a')]:_0x41fc9f['calleridnum'];var _0x4ba374={'method':_0xa0a9('0xf'),'uri':_0x23e8be+_0xa0a9('0x2b'),'body':{'telephone1':_0x370903,'fullname':_0x370903,'firstname':_0x370903,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5c3f81['userId']+')'},'headers':{'Authorization':_0xa0a9('0x1a')+_0x20309d,'OData-Version':_0xa0a9('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4ba374);})[_0xa0a9('0x17')](function(_0xc16dd9){var _0x49fe8b=_0xc16dd9['headers'][_0xa0a9('0x2c')];var _0x2f61a9=_0x49fe8b['substring'](_0x49fe8b['lastIndexOf']('(')+0x1,_0x49fe8b['lastIndexOf'](')'));_0x5c3f81[_0xa0a9('0x2d')]=_0x2f61a9;_0x3817d1(_0x5c3f81);})[_0xa0a9('0x28')](function(_0x51daef){_0x16ed1e(_0x51daef[_0xa0a9('0x16')]);});});}function getEndUser(_0x254b11,_0x4d584e,_0x14ce36,_0x483c16,_0x10f6e9,_0x150c09,_0x76dbe0){var _0x3ecd20=_0x150c09[_0xa0a9('0x2e')]()===_0xa0a9('0x29')?_0x10f6e9[_0xa0a9('0x2a')]:_0x10f6e9['calleridnum'];return getAuthToken(_0x4d584e,_0x14ce36,_0x150c09)[_0xa0a9('0x17')](function(_0x1ad7b1){var _0x40b9de={'method':'GET','uri':_0x483c16+_0xa0a9('0x2f')+_0x3ecd20[_0xa0a9('0x30')]('+',_0xa0a9('0x31'))+'\x27','headers':{'Authorization':_0xa0a9('0x1a')+_0x1ad7b1,'If-None-Match':null,'OData-Version':_0xa0a9('0x1b')},'json':!![]};return rp(_0x40b9de);})[_0xa0a9('0x17')](function(_0x36322b){var _0x53ea06=![];if(!_0x36322b)return _0x53ea06;var _0x2d3e03=_0x36322b[_0xa0a9('0x1c')];for(var _0x4c2c22=0x0;_0x4c2c22<_0x2d3e03[_0xa0a9('0x20')];_0x4c2c22++){if(_0x2d3e03[_0x4c2c22][_0xa0a9('0x32')]===_0x3ecd20){_0x53ea06=!![];_0x254b11[_0xa0a9('0x2d')]=_0x2d3e03[_0x4c2c22][_0xa0a9('0x33')];}}return _0x53ea06;})[_0xa0a9('0x17')](function(_0x59308f){if(_0x59308f)return _0x254b11;if(_0x76dbe0===_0xa0a9('0x34')){logger[_0xa0a9('0x23')]('['+[_0x150c09['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x254b11;}return createEndUser(_0x254b11,_0x4d584e,_0x14ce36,_0x483c16,_0x10f6e9,_0x150c09)[_0xa0a9('0x17')](function(_0x20b5e5){logger[_0xa0a9('0x23')]('['+[_0x150c09[_0xa0a9('0x14')]()]+_0xa0a9('0x35'),_0x20b5e5[_0xa0a9('0x2d')]);return _0x20b5e5;});});}function getCustomFields(_0x18d48c,_0x3b9ad0,_0x2d1e4e){var _0x437097={};if(_0x18d48c[_0xa0a9('0x20')]>0x0){_[_0xa0a9('0x36')](_0x18d48c,function(_0x49cb45){if(_['includes']([_0xa0a9('0x37'),'picklist'],_0x49cb45[_0xa0a9('0x38')])&&_0x49cb45[_0xa0a9('0x39')]&&!_0x49cb45[_0xa0a9('0x3a')]){var _0x16c1c2=_0x49cb45[_0xa0a9('0x3b')][_0xa0a9('0x2e')]();var _0x3ce39b=_0x16c1c2[_0xa0a9('0x3c')](0x0,_0x16c1c2[_0xa0a9('0x3d')]('_'));var _0x7ebece=_0x16c1c2[_0xa0a9('0x3c')](_0x16c1c2[_0xa0a9('0x3d')]('_')+0x1);if(_0x3ce39b===_0x2d1e4e){_0x437097[_0x7ebece]=_0x49cb45[_0xa0a9('0x3e')];}}});}return _0x437097;}function getTicket(_0x15c806,_0x35b7ea,_0x1743e2,_0x40c070,_0x343261,_0x570243,_0x3e597c){return new Promise(function(_0x4da682,_0xac28f4){var _0x18644d;return getAuthToken(_0x35b7ea,_0x1743e2,_0x3e597c)[_0xa0a9('0x17')](function(_0x2c1aee){if(_0x570243[_0xa0a9('0x3f')]===_0xa0a9('0x40')){_0x18644d={'method':_0xa0a9('0xf'),'uri':_0x40c070+_0xa0a9('0x41'),'body':Object[_0xa0a9('0x42')]({},{'title':intUtil[_0xa0a9('0x43')](_0x570243[_0xa0a9('0x44')],_0x343261,'\x20'),'description':intUtil['getString'](_0x570243[_0xa0a9('0x45')],_0x343261,'\x0a'),'customerid_contact@odata.bind':_0x15c806[_0xa0a9('0x2d')]?_0xa0a9('0x46')+_0x15c806[_0xa0a9('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x15c806[_0xa0a9('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x570243[_0xa0a9('0x47')],_0x343261,_0x570243[_0xa0a9('0x3f')])),'headers':{'Authorization':_0xa0a9('0x1a')+_0x2c1aee,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x570243[_0xa0a9('0x3f')]===_0xa0a9('0x48')){var _0x4762a5=_0x15c806[_0xa0a9('0x2d')]?[{'partyid_systemuser@odata.bind':_0xa0a9('0x49')+_0x15c806[_0xa0a9('0x26')]+')','participationtypemask':_0x15c806['callDirection']===_0xa0a9('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xa0a9('0x46')+_0x15c806[_0xa0a9('0x2d')]+')','participationtypemask':_0x15c806[_0xa0a9('0x4b')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa0a9('0x49')+_0x15c806[_0xa0a9('0x26')]+')','participationtypemask':_0x15c806[_0xa0a9('0x4b')]==='queue'?0x2:0x1}];_0x18644d={'method':'POST','uri':_0x40c070+_0xa0a9('0x4c'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x570243[_0xa0a9('0x44')],_0x343261,'\x20'),'phonenumber':String(_0x343261[_0xa0a9('0x4d')]),'description':intUtil[_0xa0a9('0x43')](_0x570243[_0xa0a9('0x45')],_0x343261,'\x0a'),'regardingobjectid_contact@odata.bind':_0x15c806[_0xa0a9('0x2d')]?_0xa0a9('0x46')+_0x15c806[_0xa0a9('0x2d')]+')':undefined,'ownerid@odata.bind':_0xa0a9('0x49')+_0x15c806[_0xa0a9('0x26')]+')','directioncode':_0x15c806['callDirection']===_0xa0a9('0x4a')?![]:!![],'phonecall_activity_parties':_0x4762a5},getCustomFields(_0x570243['Fields'],_0x343261,_0x570243[_0xa0a9('0x3f')])),'headers':{'Authorization':_0xa0a9('0x1a')+_0x2c1aee,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x18644d);})[_0xa0a9('0x17')](function(_0x406548){var _0x3b15e5=_0x406548[_0xa0a9('0x4e')]['odata-entityid'];var _0x157fe2=_0x3b15e5[_0xa0a9('0x3c')](_0x3b15e5[_0xa0a9('0x4f')]('(')+0x1,_0x3b15e5[_0xa0a9('0x4f')](')'));_0x15c806[_0xa0a9('0x50')]=_0x157fe2;_0x4da682(_0x15c806);})[_0xa0a9('0x28')](function(_0x373c46){_0xac28f4(_0x373c46[_0xa0a9('0x16')]);});});}function emit(_0x41adc0,_0x14d8b6,_0x76451d,_0x20eb44){var _0x461723={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x41adc0,_0x76451d,_0x20eb44)};io['to'](util[_0xa0a9('0x51')](_0xa0a9('0x52'),_0x14d8b6))[_0xa0a9('0x53')](_0xa0a9('0x54'),_0x461723);}exports['cs']=function(_0x2342eb,_0x27ed2d,_0x1c9a39,_0x272c4b,_0x561a55,_0x4d15b3,_0x5cd907,_0x3695e9){var _0x3936c3={};_0x4d15b3[_0xa0a9('0xa')]=_0x4d15b3[_0xa0a9('0x9')]?intUtil[_0xa0a9('0x55')](_0x4d15b3['CloudProvider'][_0xa0a9('0xc')]):intUtil[_0xa0a9('0x55')](_0x4d15b3[_0xa0a9('0xa')]);_0x4d15b3[_0xa0a9('0x56')]=intUtil[_0xa0a9('0x55')](_0x4d15b3[_0xa0a9('0x56')]);_0x3936c3[_0xa0a9('0x4b')]=_0x3695e9===_0xa0a9('0x4a')||_0x3695e9===_0xa0a9('0x57')?_0xa0a9('0x4a'):_0xa0a9('0x29');var _0x53ebd7=_0x4d15b3[_0xa0a9('0x9')]?util[_0xa0a9('0x51')](_0xa0a9('0x58'),_0x4d15b3[_0xa0a9('0xb')]['data7']):util['format'](_0xa0a9('0x58'),_0x4d15b3[_0xa0a9('0xa')]);var _0x469159=util[_0xa0a9('0x51')](_0xa0a9('0x59'),_0x4d15b3[_0xa0a9('0x5a')]);var _0x2aaa95=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d15b3[_0xa0a9('0x56')],_0x27ed2d[_0xa0a9('0x5b')],md5(_0x27ed2d[_0xa0a9('0x5b')]));if(_0x561a55&&_0x561a55['monitor_format']){logger[_0xa0a9('0x23')](_0xa0a9('0x5c'),'Recording\x20is\x20enabled!');_0x27ed2d[_0xa0a9('0x5d')]=_0x2aaa95;}else if(_0x5cd907&&_0x5cd907[_0xa0a9('0x5e')]&&_0x5cd907[_0xa0a9('0x5e')]!=='none'){logger['info'](_0xa0a9('0x5f'),'Recording\x20is\x20enabled!');_0x27ed2d[_0xa0a9('0x5d')]=_0x2aaa95;}else{_0x27ed2d['recordingURL']='';}return getUser(_0x3936c3,_0x4d15b3,_0x272c4b,_0x469159,_0x53ebd7,_0x3695e9)[_0xa0a9('0x17')](function(_0x336b2d){logger['info']('['+_0x3695e9[_0xa0a9('0x14')]()+_0xa0a9('0x60'),_0x336b2d[_0xa0a9('0x26')]);logger[_0xa0a9('0x23')]('['+_0x3695e9[_0xa0a9('0x14')]()+_0xa0a9('0x61'),_0x336b2d[_0xa0a9('0x1f')]);return getEndUser(_0x336b2d,_0x4d15b3,_0x469159,_0x53ebd7,_0x27ed2d,_0x3695e9,_0x1c9a39[_0xa0a9('0x62')]);})['then'](function(_0x14c35f){logger[_0xa0a9('0x23')]('['+_0x3695e9['toUpperCase']()+_0xa0a9('0x63'),_0x14c35f['enduserId']);logger[_0xa0a9('0x23')]('['+_0x3695e9[_0xa0a9('0x14')]()+_0xa0a9('0x64'),_0x27ed2d[_0xa0a9('0x4d')]);return getTicket(_0x14c35f,_0x4d15b3,_0x469159,_0x53ebd7,_0x27ed2d,_0x1c9a39,_0x3695e9);})[_0xa0a9('0x17')](function(_0x17ae56){logger[_0xa0a9('0x23')](util['format']('['+_0x3695e9['toUpperCase']()+_0xa0a9('0x65'),_0x1c9a39['ticketType'],_0x17ae56[_0xa0a9('0x50')]));logger[_0xa0a9('0x23')](util[_0xa0a9('0x51')]('['+_0x3695e9['toUpperCase']()+_0xa0a9('0x66'),_0x3695e9));if(_0x3695e9!==_0xa0a9('0x57')){logger[_0xa0a9('0x23')]('['+_0x3695e9[_0xa0a9('0x14')]()+']',_0xa0a9('0x67'));emit(_0x4d15b3[_0xa0a9('0xa')],_0x272c4b[_0xa0a9('0x68')],_0x1c9a39['ticketType'],_0x17ae56[_0xa0a9('0x50')]);}})[_0xa0a9('0x28')](function(_0x399200){logger[_0xa0a9('0x69')]('['+_0x3695e9[_0xa0a9('0x14')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x399200[_0xa0a9('0x16')]);});}; \ 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 7411d4d..3bb4546 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 _0xe8c2=['Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','destcalleridnum','catch','toUpperCase','lastevent','lodash','request-promise','util','ioredis','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','customField','nameField','content','idField','push','variable','variableName','customVariable'];(function(_0x18c0d8,_0x9bc3f7){var _0xaab5e1=function(_0x50a50d){while(--_0x50a50d){_0x18c0d8['push'](_0x18c0d8['shift']());}};_0xaab5e1(++_0x9bc3f7);}(_0xe8c2,0x194));var _0x2e8c=function(_0x19a989,_0x5ed6eb){_0x19a989=_0x19a989-0x0;var _0x2f66c2=_0xe8c2[_0x19a989];return _0x2f66c2;};'use strict';var _=require(_0x2e8c('0x0'));var rp=require(_0x2e8c('0x1'));var md5=require('md5');var util=require(_0x2e8c('0x2'));var Redis=require(_0x2e8c('0x3'));var intUtil=require('./util');var config=require(_0x2e8c('0x4'));var logger=require('../../../../config/logger')(_0x2e8c('0x5'));config['redis']=_[_0x2e8c('0x6')](config[_0x2e8c('0x7')],{'host':_0x2e8c('0x8'),'port':0x18eb});var io=require(_0x2e8c('0x9'))(new Redis(config[_0x2e8c('0x7')]));var headers={'Content-Type':_0x2e8c('0xa'),'Accept':_0x2e8c('0xa')};function emit(_0x16a608,_0x1acc55,_0x4763be){io['to'](_0x16a608)[_0x2e8c('0xb')](_0x1acc55,_0x4763be);}function getTicket(_0x41de85,_0x4cd70f,_0x407808,_0x1f216e,_0x325e5a){logger[_0x2e8c('0xc')](_0x2e8c('0xd'));var _0x4cf2da=_[_0x2e8c('0xe')]({'responder_id':_0x4cd70f['id'],'requester_id':_0x407808['id'],'name':util[_0x2e8c('0xf')]('Caller\x20-\x20%s',_0x325e5a[_0x2e8c('0x10')]),'phone':_0x325e5a[_0x2e8c('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2e8c('0x12')](_0x1f216e[_0x2e8c('0x13')],_0x325e5a,'\x20'),'description':intUtil[_0x2e8c('0x12')](_0x1f216e[_0x2e8c('0x14')],_0x325e5a,'
'),'tags':getTags(_0x1f216e[_0x2e8c('0x15')],'name')},getCustomFields(_0x1f216e[_0x2e8c('0x16')],_0x325e5a));_0x4cf2da[_0x2e8c('0x17')]=_[_0x2e8c('0x18')](_[_0x2e8c('0x19')](_0x4cf2da[_0x2e8c('0x17')],'id'),_0x2e8c('0x1a'));return request({'uri':util[_0x2e8c('0xf')](_0x2e8c('0x1b'),_0x41de85[_0x2e8c('0x1c')]),'method':_0x2e8c('0x1d'),'body':_0x4cf2da})['then'](function(_0xc43345){logger['info'](_0x2e8c('0x1e'));return _0xc43345;});}function getUser(_0x5ae81c,_0x26e386){if(intUtil[_0x2e8c('0x1f')](_0x26e386)){return request({'uri':util[_0x2e8c('0xf')]('%s/api/v2/agents',_0x5ae81c[_0x2e8c('0x1c')]),'qs':{'email':_0x26e386}})[_0x2e8c('0x20')](function(_0x2ad1e2){if(_0x2ad1e2[_0x2e8c('0x21')]){logger['info'](_0x2e8c('0x22'));return _[_0x2e8c('0x23')](_0x2ad1e2,function(_0x4ada41){return _0x4ada41[_0x2e8c('0x24')][_0x2e8c('0x25')]===_0x26e386;});}else{logger[_0x2e8c('0xc')](_0x2e8c('0x26'));return request({'uri':util[_0x2e8c('0xf')](_0x2e8c('0x27'),_0x5ae81c[_0x2e8c('0x1c')])})[_0x2e8c('0x20')](function(_0x3e4c8e){logger[_0x2e8c('0xc')](_0x2e8c('0x28'));return _0x3e4c8e;});}});}else{logger[_0x2e8c('0xc')](_0x2e8c('0x29'));return request({'uri':util[_0x2e8c('0xf')](_0x2e8c('0x27'),_0x5ae81c[_0x2e8c('0x1c')])})[_0x2e8c('0x20')](function(_0x15141b){logger[_0x2e8c('0xc')](_0x2e8c('0x28'));return _0x15141b;});}}function getEndUser(_0x447fbe,_0x4febe8,_0x416817){logger[_0x2e8c('0xc')](_0x2e8c('0x2a'),_0x416817);return request({'uri':util[_0x2e8c('0xf')](_0x2e8c('0x2b'),_0x447fbe[_0x2e8c('0x1c')]),'qs':{'phone':_0x416817}})[_0x2e8c('0x20')](function(_0x25399b){if(_0x25399b[_0x2e8c('0x21')]){logger[_0x2e8c('0xc')](_0x2e8c('0x2c'));return _['find'](_0x25399b,{'phone':_0x416817});}else{logger['info'](_0x2e8c('0x2d'));return request({'uri':util[_0x2e8c('0xf')](_0x2e8c('0x2b'),_0x447fbe[_0x2e8c('0x1c')]),'method':_0x2e8c('0x1d'),'body':{'name':_0x4febe8,'phone':_0x416817}})[_0x2e8c('0x20')](function(_0x5b62d5){logger[_0x2e8c('0xc')](_0x2e8c('0x2e'));return _0x5b62d5;});}});}function getAuth(_0x44d5dd){return util['format']('Basic\x20%s',new Buffer(_0x44d5dd[_0x2e8c('0x2f')]+':X')[_0x2e8c('0x30')]('base64'));}function request(_0x64475a){logger[_0x2e8c('0x31')](_0x2e8c('0x32'),JSON[_0x2e8c('0x33')](_0x64475a));return rp(_[_0x2e8c('0x6')](_0x64475a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xae887c,_0x2df696){var _0x22dd63=[];if(_0xae887c&&_0xae887c[_0x2e8c('0x21')]>0x0){_0x22dd63=_[_0x2e8c('0x34')](_0xae887c,_0x2df696);}return _0x22dd63;}function getCustomFields(_0x5c795d,_0x45e1f2){var _0x3a41d7=[];var _0x3e13a9={'custom_fields':[]};if(_0x5c795d['length']>0x0){_[_0x2e8c('0x35')](_0x5c795d,function(_0x2e3bb2){if(_[_0x2e8c('0x36')]([_0x2e8c('0x37'),_0x2e8c('0x38')],_0x2e3bb2[_0x2e8c('0x39')])&&_0x2e3bb2['nameField']&&!_0x2e3bb2[_0x2e8c('0x3a')]){_0x3e13a9[_0x2e3bb2[_0x2e8c('0x3b')]['toLowerCase']()]=_0x2e3bb2[_0x2e8c('0x3c')][_0x2e8c('0x30')]();}else if(_[_0x2e8c('0x36')](['string','picklist'],_0x2e3bb2[_0x2e8c('0x39')])&&_0x2e3bb2[_0x2e8c('0x3d')]&&_0x2e3bb2[_0x2e8c('0x3a')]){_0x3e13a9[_0x2e8c('0x17')][_0x2e8c('0x3e')]({'id':_0x2e3bb2[_0x2e8c('0x3d')],'value':_0x2e3bb2[_0x2e8c('0x3c')][_0x2e8c('0x30')]()});}else if(_0x2e3bb2['type']===_0x2e8c('0x3f')&&_0x2e3bb2['variableName']&&_0x2e3bb2[_0x2e8c('0x3d')]&&_0x2e3bb2[_0x2e8c('0x3a')]){_0x45e1f2[_0x2e3bb2[_0x2e8c('0x40')]]&&_0x3e13a9['custom_fields'][_0x2e8c('0x3e')]({'id':_0x2e3bb2[_0x2e8c('0x3d')],'value':_0x45e1f2[_0x2e3bb2[_0x2e8c('0x40')]][_0x2e8c('0x30')]()});}else if(_0x2e3bb2[_0x2e8c('0x39')]===_0x2e8c('0x41')&&_0x2e3bb2[_0x2e8c('0x42')]&&_0x2e3bb2[_0x2e8c('0x42')][_0x2e8c('0x43')]&&_0x2e3bb2['idField']&&_0x2e3bb2[_0x2e8c('0x3a')]){_0x45e1f2[_0x2e3bb2['Variable']['name'][_0x2e8c('0x44')]()]&&_0x3e13a9['custom_fields'][_0x2e8c('0x3e')]({'id':_0x2e3bb2['idField'],'value':_0x45e1f2[_0x2e3bb2[_0x2e8c('0x42')]['name'][_0x2e8c('0x44')]()][_0x2e8c('0x30')]()});}});}return _0x3e13a9;}exports[_0x2e8c('0x45')]=function(_0x39fd2d,_0x1f6022,_0x1c73d6,_0x149817,_0x3932c1,_0x999857){var _0x46ecae,_0x4a2fb5;_0x999857[_0x2e8c('0x1c')]=intUtil[_0x2e8c('0x46')](_0x999857[_0x2e8c('0x1c')]);_0x999857[_0x2e8c('0x47')]=intUtil['stripTrailingSlash'](_0x999857[_0x2e8c('0x47')]);if(_0x3932c1&&_0x3932c1[_0x2e8c('0x48')]){logger[_0x2e8c('0xc')]('[QUEUE]',_0x2e8c('0x49'));_0x1f6022[_0x2e8c('0x4a')]=util[_0x2e8c('0xf')](_0x2e8c('0x4b'),_0x999857['serverUrl'],_0x1f6022[_0x2e8c('0x4c')],md5(_0x1f6022[_0x2e8c('0x4c')]));}else{_0x1f6022[_0x2e8c('0x4a')]='';}headers[_0x2e8c('0x4d')]=getAuth(_0x999857);return getUser(_0x999857,_0x149817[_0x2e8c('0x25')])[_0x2e8c('0x20')](function(_0x2ac20a){_0x46ecae=_0x2ac20a;logger[_0x2e8c('0xc')](_0x2e8c('0x4e'),_0x46ecae['id']);return getEndUser(_0x999857,_0x1f6022[_0x2e8c('0x10')],_0x1f6022['calleridnum']);})[_0x2e8c('0x20')](function(_0x65ee09){_0x4a2fb5=_0x65ee09;logger['info'](_0x2e8c('0x4f'),_0x4a2fb5['id']);return getTicket(_0x999857,_0x46ecae,_0x4a2fb5,_0x1c73d6,_0x1f6022);})[_0x2e8c('0x20')](function(_0x3c8596){if(_0x3c8596&&_0x3c8596['id']){logger[_0x2e8c('0xc')](_0x2e8c('0x1e'));logger[_0x2e8c('0xc')](_0x2e8c('0x50'),_0x3c8596['id']);logger[_0x2e8c('0xc')](_0x2e8c('0x51'),_0x2e8c('0x52'));emit(util[_0x2e8c('0xf')](_0x2e8c('0x53'),_0x149817[_0x2e8c('0x43')]),_0x2e8c('0x54'),{'uri':util[_0x2e8c('0xf')](_0x2e8c('0x55'),_0x999857['remoteUri'],_0x3c8596['id'])});}})['catch'](function(_0x36b729){logger[_0x2e8c('0x56')](_0x2e8c('0x51'),JSON[_0x2e8c('0x33')](_0x36b729));});};exports[_0x2e8c('0x57')]=function(_0x520121,_0x4b50d7,_0x10df0b,_0x54392b,_0x26b6a5,_0x2698e1,_0x114152){var _0x184d4d,_0x127cf5;_0x2698e1['remoteUri']=intUtil[_0x2e8c('0x46')](_0x2698e1[_0x2e8c('0x1c')]);_0x2698e1[_0x2e8c('0x47')]=intUtil[_0x2e8c('0x46')](_0x2698e1[_0x2e8c('0x47')]);if(_0x114152&&_0x114152[_0x2e8c('0x58')]&&_0x114152['recordingFormat']!==_0x2e8c('0x59')){logger[_0x2e8c('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4b50d7[_0x2e8c('0x4a')]=util['format'](_0x2e8c('0x4b'),_0x2698e1[_0x2e8c('0x47')],_0x4b50d7[_0x2e8c('0x4c')],md5(_0x4b50d7[_0x2e8c('0x4c')]));}headers[_0x2e8c('0x4d')]=getAuth(_0x2698e1);return getUser(_0x2698e1,_0x54392b[_0x2e8c('0x25')])[_0x2e8c('0x20')](function(_0x5054ee){_0x184d4d=_0x5054ee;logger[_0x2e8c('0xc')](_0x2e8c('0x4e'),_0x184d4d['id']);return getEndUser(_0x2698e1,_0x4b50d7['destcalleridname'],_0x4b50d7[_0x2e8c('0x5a')]);})[_0x2e8c('0x20')](function(_0x4e5050){_0x127cf5=_0x4e5050;logger['info']('The\x20Enduser\x20ID\x20is:',_0x127cf5['id']);return getTicket(_0x2698e1,_0x184d4d,_0x127cf5,_0x10df0b,_0x4b50d7);})[_0x2e8c('0x20')](function(_0x2dc5bd){if(_0x2dc5bd&&_0x2dc5bd['id']){logger[_0x2e8c('0xc')](_0x2e8c('0x1e'));logger[_0x2e8c('0xc')](_0x2e8c('0x50'),_0x2dc5bd['id']);logger['info']('[OUTBOUND]',_0x2e8c('0x52'));emit(util[_0x2e8c('0xf')](_0x2e8c('0x53'),_0x54392b[_0x2e8c('0x43')]),_0x2e8c('0x54'),{'uri':util['format'](_0x2e8c('0x55'),_0x2698e1[_0x2e8c('0x1c')],_0x2dc5bd['id'])});}})[_0x2e8c('0x5b')](function(_0x5c6c0b){logger[_0x2e8c('0x56')]('[OUTBOUND]',JSON[_0x2e8c('0x33')](_0x5c6c0b));});};exports['unmanaged']=function(_0x3f83ca,_0x160c98,_0x3bc195,_0x127ba9,_0x326d86,_0x5c7c0e){var _0x3f6e26,_0x39a731;_0x5c7c0e[_0x2e8c('0x1c')]=intUtil['stripTrailingSlash'](_0x5c7c0e[_0x2e8c('0x1c')]);_0x5c7c0e[_0x2e8c('0x47')]=intUtil[_0x2e8c('0x46')](_0x5c7c0e['serverUrl']);if(_0x326d86&&_0x326d86[_0x2e8c('0x48')]){logger[_0x2e8c('0xc')]('['+_0x160c98['lastevent'][_0x2e8c('0x5c')]()+']','Recording\x20is\x20enabled!');_0x160c98[_0x2e8c('0x4a')]=util['format'](_0x2e8c('0x4b'),_0x5c7c0e['serverUrl'],_0x160c98[_0x2e8c('0x4c')],md5(_0x160c98[_0x2e8c('0x4c')]));}else{_0x160c98['recordingURL']='';}headers[_0x2e8c('0x4d')]=getAuth(_0x5c7c0e);return getUser(_0x5c7c0e,'')['then'](function(_0x39b7d4){_0x3f6e26=_0x39b7d4;logger[_0x2e8c('0xc')](_0x2e8c('0x4e'),_0x3f6e26['id']);return getEndUser(_0x5c7c0e,_0x160c98['calleridname'],_0x160c98[_0x2e8c('0x11')]);})[_0x2e8c('0x20')](function(_0x2ae1ee){_0x39a731=_0x2ae1ee;logger[_0x2e8c('0xc')](_0x2e8c('0x4f'),_0x39a731['id']);return getTicket(_0x5c7c0e,_0x3f6e26,_0x39a731,_0x3bc195,_0x160c98);})['then'](function(_0x13b22f){if(_0x13b22f){logger['info'](_0x2e8c('0x1e'));logger[_0x2e8c('0xc')](_0x2e8c('0x50'),_0x13b22f['id']);}})[_0x2e8c('0x5b')](function(_0x24d4c9){logger[_0x2e8c('0x56')]('['+_0x160c98[_0x2e8c('0x5d')][_0x2e8c('0x5c')]()+']',JSON[_0x2e8c('0x33')](_0x24d4c9));});}; \ No newline at end of file +var _0x668c=['user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','[OUTBOUND]','destcalleridname','destcalleridnum','catch','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','GET','includes','string','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x9ae13a,_0xd3081d){var _0x53ca20=function(_0x264202){while(--_0x264202){_0x9ae13a['push'](_0x9ae13a['shift']());}};_0x53ca20(++_0xd3081d);}(_0x668c,0x1f2));var _0xc668=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0x668c[_0x56fd29];return _0x2a0bf7;};'use strict';var _=require(_0xc668('0x0'));var rp=require(_0xc668('0x1'));var md5=require(_0xc668('0x2'));var util=require(_0xc668('0x3'));var Redis=require(_0xc668('0x4'));var intUtil=require(_0xc668('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc668('0x6'))(_0xc668('0x7'));config[_0xc668('0x8')]=_[_0xc668('0x9')](config[_0xc668('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc668('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xc668('0xb'),'Accept':'application/json'};function emit(_0x194ed4,_0x4e4be5,_0x50aac7){io['to'](_0x194ed4)[_0xc668('0xc')](_0x4e4be5,_0x50aac7);}function getTicket(_0x397984,_0x54914f,_0xd1ac97,_0x57d55c,_0x941e7d){logger['info'](_0xc668('0xd'));var _0x248c03=_[_0xc668('0xe')]({'responder_id':_0x54914f['id'],'requester_id':_0xd1ac97['id'],'name':util[_0xc668('0xf')](_0xc668('0x10'),_0x941e7d[_0xc668('0x11')]),'phone':_0x941e7d[_0xc668('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc668('0x13')](_0x57d55c[_0xc668('0x14')],_0x941e7d,'\x20'),'description':intUtil['getString'](_0x57d55c[_0xc668('0x15')],_0x941e7d,_0xc668('0x16')),'tags':getTags(_0x57d55c['Tags'],_0xc668('0x17'))},getCustomFields(_0x57d55c[_0xc668('0x18')],_0x941e7d));_0x248c03['custom_fields']=_[_0xc668('0x19')](_[_0xc668('0x1a')](_0x248c03['custom_fields'],'id'),_0xc668('0x1b'));return request({'uri':util['format'](_0xc668('0x1c'),_0x397984['remoteUri']),'method':_0xc668('0x1d'),'body':_0x248c03})[_0xc668('0x1e')](function(_0x10437d){logger['info'](_0xc668('0x1f'));return _0x10437d;});}function getUser(_0x4187ff,_0x6f6b78){if(intUtil[_0xc668('0x20')](_0x6f6b78)){return request({'uri':util[_0xc668('0xf')](_0xc668('0x21'),_0x4187ff['remoteUri']),'qs':{'email':_0x6f6b78}})[_0xc668('0x1e')](function(_0x4a4be5){if(_0x4a4be5[_0xc668('0x22')]){logger[_0xc668('0x23')](_0xc668('0x24'));return _[_0xc668('0x25')](_0x4a4be5,function(_0x2b53a1){return _0x2b53a1[_0xc668('0x26')][_0xc668('0x27')]===_0x6f6b78;});}else{logger[_0xc668('0x23')](_0xc668('0x28'));return request({'uri':util['format'](_0xc668('0x29'),_0x4187ff[_0xc668('0x2a')])})[_0xc668('0x1e')](function(_0x3e6414){logger[_0xc668('0x23')](_0xc668('0x2b'));return _0x3e6414;});}});}else{logger[_0xc668('0x23')](_0xc668('0x2c'));return request({'uri':util['format'](_0xc668('0x29'),_0x4187ff[_0xc668('0x2a')])})['then'](function(_0x2efe56){logger['info']('Admin\x20account\x20selected.');return _0x2efe56;});}}function getEndUser(_0x5045ec,_0x442bad,_0x422683){logger[_0xc668('0x23')](_0xc668('0x2d'),_0x422683);return request({'uri':util['format'](_0xc668('0x2e'),_0x5045ec[_0xc668('0x2a')]),'qs':{'phone':_0x422683}})['then'](function(_0x30dd5b){if(_0x30dd5b[_0xc668('0x22')]){logger[_0xc668('0x23')](_0xc668('0x2f'));return _[_0xc668('0x25')](_0x30dd5b,{'phone':_0x422683});}else{logger[_0xc668('0x23')](_0xc668('0x30'));return request({'uri':util[_0xc668('0xf')]('%s/api/v2/contacts',_0x5045ec[_0xc668('0x2a')]),'method':'POST','body':{'name':_0x442bad,'phone':_0x422683}})[_0xc668('0x1e')](function(_0x36f836){logger['info'](_0xc668('0x31'));return _0x36f836;});}});}function getAuth(_0x430548){return util['format'](_0xc668('0x32'),new Buffer(_0x430548[_0xc668('0x33')]+':X')[_0xc668('0x34')]('base64'));}function request(_0x47c39a){logger['debug'](_0xc668('0x35'),JSON[_0xc668('0x36')](_0x47c39a));return rp(_[_0xc668('0x9')](_0x47c39a,{'method':_0xc668('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1b72d0,_0x747b6f){var _0x40a20c=[];if(_0x1b72d0&&_0x1b72d0[_0xc668('0x22')]>0x0){_0x40a20c=_['map'](_0x1b72d0,_0x747b6f);}return _0x40a20c;}function getCustomFields(_0x76d010,_0x3363c3){var _0x3887ab=[];var _0x500195={'custom_fields':[]};if(_0x76d010[_0xc668('0x22')]>0x0){_['forEach'](_0x76d010,function(_0x5911b5){if(_[_0xc668('0x38')]([_0xc668('0x39'),_0xc668('0x3a')],_0x5911b5[_0xc668('0x3b')])&&_0x5911b5[_0xc668('0x3c')]&&!_0x5911b5[_0xc668('0x3d')]){_0x500195[_0x5911b5[_0xc668('0x3c')][_0xc668('0x3e')]()]=_0x5911b5['content'][_0xc668('0x34')]();}else if(_['includes']([_0xc668('0x39'),_0xc668('0x3a')],_0x5911b5[_0xc668('0x3b')])&&_0x5911b5[_0xc668('0x3f')]&&_0x5911b5[_0xc668('0x3d')]){_0x500195[_0xc668('0x40')][_0xc668('0x41')]({'id':_0x5911b5[_0xc668('0x3f')],'value':_0x5911b5[_0xc668('0x42')][_0xc668('0x34')]()});}else if(_0x5911b5['type']===_0xc668('0x43')&&_0x5911b5[_0xc668('0x44')]&&_0x5911b5[_0xc668('0x3f')]&&_0x5911b5['customField']){_0x3363c3[_0x5911b5[_0xc668('0x44')]]&&_0x500195[_0xc668('0x40')][_0xc668('0x41')]({'id':_0x5911b5['idField'],'value':_0x3363c3[_0x5911b5['variableName']][_0xc668('0x34')]()});}else if(_0x5911b5[_0xc668('0x3b')]===_0xc668('0x45')&&_0x5911b5[_0xc668('0x46')]&&_0x5911b5[_0xc668('0x46')][_0xc668('0x17')]&&_0x5911b5[_0xc668('0x3f')]&&_0x5911b5[_0xc668('0x3d')]){_0x3363c3[_0x5911b5[_0xc668('0x46')][_0xc668('0x17')][_0xc668('0x3e')]()]&&_0x500195[_0xc668('0x40')]['push']({'id':_0x5911b5[_0xc668('0x3f')],'value':_0x3363c3[_0x5911b5['Variable'][_0xc668('0x17')][_0xc668('0x3e')]()][_0xc668('0x34')]()});}});}return _0x500195;}exports[_0xc668('0x47')]=function(_0x1d7cc7,_0x304c34,_0x92755d,_0xdfc142,_0x17d540,_0x141059){var _0x4f156b,_0x1e0901;_0x141059[_0xc668('0x2a')]=intUtil[_0xc668('0x48')](_0x141059[_0xc668('0x2a')]);_0x141059[_0xc668('0x49')]=intUtil[_0xc668('0x48')](_0x141059[_0xc668('0x49')]);if(_0x17d540&&_0x17d540[_0xc668('0x4a')]){logger[_0xc668('0x23')](_0xc668('0x4b'),_0xc668('0x4c'));_0x304c34[_0xc668('0x4d')]=util[_0xc668('0xf')](_0xc668('0x4e'),_0x141059[_0xc668('0x49')],_0x304c34['uniqueid'],md5(_0x304c34[_0xc668('0x4f')]));}else{_0x304c34['recordingURL']='';}headers[_0xc668('0x50')]=getAuth(_0x141059);return getUser(_0x141059,_0xdfc142[_0xc668('0x27')])[_0xc668('0x1e')](function(_0x1157da){_0x4f156b=_0x1157da;logger[_0xc668('0x23')](_0xc668('0x51'),_0x4f156b['id']);return getEndUser(_0x141059,_0x304c34[_0xc668('0x11')],_0x304c34[_0xc668('0x12')]);})['then'](function(_0x2e1155){_0x1e0901=_0x2e1155;logger[_0xc668('0x23')]('The\x20Enduser\x20ID\x20is:',_0x1e0901['id']);return getTicket(_0x141059,_0x4f156b,_0x1e0901,_0x92755d,_0x304c34);})[_0xc668('0x1e')](function(_0x273dd8){if(_0x273dd8&&_0x273dd8['id']){logger[_0xc668('0x23')](_0xc668('0x1f'));logger[_0xc668('0x23')](_0xc668('0x52'),_0x273dd8['id']);logger[_0xc668('0x23')]('[QUEUE]',_0xc668('0x53'));emit(util[_0xc668('0xf')](_0xc668('0x54'),_0xdfc142['name']),_0xc668('0x55'),{'uri':util[_0xc668('0xf')](_0xc668('0x56'),_0x141059[_0xc668('0x2a')],_0x273dd8['id'])});}})['catch'](function(_0x5a761b){logger[_0xc668('0x57')](_0xc668('0x4b'),JSON[_0xc668('0x36')](_0x5a761b));});};exports[_0xc668('0x58')]=function(_0x3673dd,_0x40dd18,_0x35b59e,_0x2acdb2,_0x72fd64,_0x51f0ba,_0x5b4f26){var _0x412592,_0x39596c;_0x51f0ba[_0xc668('0x2a')]=intUtil[_0xc668('0x48')](_0x51f0ba[_0xc668('0x2a')]);_0x51f0ba[_0xc668('0x49')]=intUtil[_0xc668('0x48')](_0x51f0ba[_0xc668('0x49')]);if(_0x5b4f26&&_0x5b4f26['recordingFormat']&&_0x5b4f26['recordingFormat']!=='none'){logger[_0xc668('0x23')](_0xc668('0x59'),'Recording\x20is\x20enabled!');_0x40dd18[_0xc668('0x4d')]=util[_0xc668('0xf')](_0xc668('0x4e'),_0x51f0ba['serverUrl'],_0x40dd18[_0xc668('0x4f')],md5(_0x40dd18[_0xc668('0x4f')]));}headers[_0xc668('0x50')]=getAuth(_0x51f0ba);return getUser(_0x51f0ba,_0x2acdb2[_0xc668('0x27')])[_0xc668('0x1e')](function(_0x1fde49){_0x412592=_0x1fde49;logger[_0xc668('0x23')](_0xc668('0x51'),_0x412592['id']);return getEndUser(_0x51f0ba,_0x40dd18[_0xc668('0x5a')],_0x40dd18[_0xc668('0x5b')]);})[_0xc668('0x1e')](function(_0x1b0685){_0x39596c=_0x1b0685;logger[_0xc668('0x23')]('The\x20Enduser\x20ID\x20is:',_0x39596c['id']);return getTicket(_0x51f0ba,_0x412592,_0x39596c,_0x35b59e,_0x40dd18);})[_0xc668('0x1e')](function(_0x31d83f){if(_0x31d83f&&_0x31d83f['id']){logger[_0xc668('0x23')](_0xc668('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x31d83f['id']);logger[_0xc668('0x23')](_0xc668('0x59'),_0xc668('0x53'));emit(util[_0xc668('0xf')](_0xc668('0x54'),_0x2acdb2['name']),_0xc668('0x55'),{'uri':util[_0xc668('0xf')]('%s/helpdesk/tickets/%d',_0x51f0ba[_0xc668('0x2a')],_0x31d83f['id'])});}})[_0xc668('0x5c')](function(_0x997505){logger[_0xc668('0x57')](_0xc668('0x59'),JSON['stringify'](_0x997505));});};exports[_0xc668('0x5d')]=function(_0x547c39,_0x1d7fe5,_0x21f76a,_0x407fd2,_0x38d376,_0x2e325b){var _0x5979ca,_0x577abf;_0x2e325b['remoteUri']=intUtil[_0xc668('0x48')](_0x2e325b[_0xc668('0x2a')]);_0x2e325b[_0xc668('0x49')]=intUtil['stripTrailingSlash'](_0x2e325b[_0xc668('0x49')]);if(_0x38d376&&_0x38d376['monitor_format']){logger[_0xc668('0x23')]('['+_0x1d7fe5[_0xc668('0x5e')][_0xc668('0x5f')]()+']',_0xc668('0x4c'));_0x1d7fe5[_0xc668('0x4d')]=util['format'](_0xc668('0x4e'),_0x2e325b[_0xc668('0x49')],_0x1d7fe5[_0xc668('0x4f')],md5(_0x1d7fe5[_0xc668('0x4f')]));}else{_0x1d7fe5[_0xc668('0x4d')]='';}headers[_0xc668('0x50')]=getAuth(_0x2e325b);return getUser(_0x2e325b,'')[_0xc668('0x1e')](function(_0xfca3b6){_0x5979ca=_0xfca3b6;logger[_0xc668('0x23')](_0xc668('0x51'),_0x5979ca['id']);return getEndUser(_0x2e325b,_0x1d7fe5[_0xc668('0x11')],_0x1d7fe5[_0xc668('0x12')]);})[_0xc668('0x1e')](function(_0xef9862){_0x577abf=_0xef9862;logger[_0xc668('0x23')](_0xc668('0x60'),_0x577abf['id']);return getTicket(_0x2e325b,_0x5979ca,_0x577abf,_0x21f76a,_0x1d7fe5);})[_0xc668('0x1e')](function(_0x1acfa7){if(_0x1acfa7){logger[_0xc668('0x23')](_0xc668('0x1f'));logger[_0xc668('0x23')](_0xc668('0x52'),_0x1acfa7['id']);}})[_0xc668('0x5c')](function(_0x345326){logger[_0xc668('0x57')]('['+_0x1d7fe5[_0xc668('0x5e')]['toUpperCase']()+']',JSON[_0xc668('0x36')](_0x345326));});}; \ 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 394a369..5771853 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 _0x7dec=['user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','ticketId','task','Task\x20created:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dec,0x119));var _0xc7de=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x7dec[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0xc7de('0x0'));var rp=require('request-promise');var md5=require(_0xc7de('0x1'));var util=require(_0xc7de('0x2'));var moment=require(_0xc7de('0x3'));var Promise=require(_0xc7de('0x4'));var Redis=require(_0xc7de('0x5'));var intUtil=require(_0xc7de('0x6'));var config=require('../../../../config/environment');var logger=require(_0xc7de('0x7'))(_0xc7de('0x8'));config['redis']=_[_0xc7de('0x9')](config['redis'],{'host':_0xc7de('0xa'),'port':0x18eb});var io=require(_0xc7de('0xb'))(new Redis(config[_0xc7de('0xc')]));function getAdminId(_0x2f34c5,_0x4f3e71,_0x1450db,_0x42c81f){return new Promise(function(_0x26aa93,_0x52ecee){var _0x34c6c6=![];var _0x14cfd4={'method':_0xc7de('0xd'),'uri':_0x42c81f+_0xc7de('0xe'),'json':!![]};_0x14cfd4['headers']=_0x1450db;logger['info'](_0xc7de('0xf'));return rp(_0x14cfd4)[_0xc7de('0x10')](function(_0x327dc8){if(_0x327dc8){var _0x43571a=_0x327dc8[_0xc7de('0x11')];var _0x572522=null;for(_0x572522=0x0;_0x572522<_0x43571a[_0xc7de('0x12')];_0x572522++){if(_0x43571a[_0x572522][_0xc7de('0x13')]===_0x2f34c5[_0xc7de('0x14')]){_0x2f34c5[_0xc7de('0x15')]=_0x43571a[_0x572522]['id'];_0x34c6c6=!![];}}if(_0x34c6c6){logger['info'](_0xc7de('0x16'),_0x2f34c5['adminId']);_0x26aa93(_0x2f34c5);}else{_0x52ecee({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x52ecee({'statusCode':0x194,'message':_0xc7de('0x17')});}})[_0xc7de('0x18')](function(_0x3e2cee){logger[_0xc7de('0x19')]('['+[_0x4f3e71[_0xc7de('0x1a')]()]+']',_0x3e2cee[_0xc7de('0x1b')]);_0x52ecee(_0x3e2cee);});});}function getUser(_0x37952a,_0x3523c3,_0x4952be){return function(_0x167e51){return new Promise(function(_0x5ca71a,_0x4bec96){var _0x4050db={'method':'GET','uri':_0x4952be+'/api/selector/owners','json':!![]};_0x4050db[_0xc7de('0x1c')]=_0x3523c3;logger[_0xc7de('0x1d')](_0xc7de('0x1e'));return rp(_0x4050db)['then'](function(_0x161274){if(_0x161274){var _0x5c6d4d=_0x161274['users'];var _0x2c59f7=![];var _0x2136b7=null;if(_0x167e51[_0xc7de('0x1f')]!==null){logger['info'](_0xc7de('0x20'),_0x167e51[_0xc7de('0x1f')]);_0x167e51[_0xc7de('0x21')]=_0x167e51[_0xc7de('0x1f')];for(_0x2136b7=0x0;_0x2136b7<_0x5c6d4d[_0xc7de('0x12')];_0x2136b7++){if(_0x5c6d4d[_0x2136b7][_0xc7de('0x13')]===_0x167e51[_0xc7de('0x1f')]){_0x2c59f7=!![];_0x167e51[_0xc7de('0x22')]=_0x5c6d4d[_0x2136b7]['id'];logger['info'](_0xc7de('0x23'),_0x167e51['userId']);}}}if(!_0x2c59f7){logger[_0xc7de('0x1d')]('Admin\x20selected');_0x167e51[_0xc7de('0x21')]=_0x167e51['adminEmail'];_0x167e51[_0xc7de('0x22')]=_0x167e51[_0xc7de('0x15')];_0x2c59f7=!![];}if(_0x2c59f7){_0x5ca71a(_0x167e51);}else{_0x4bec96({'statusCode':0x194,'message':_0xc7de('0x17')});}}else{_0x4bec96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc7de('0x18')](function(_0x58d1ee){logger[_0xc7de('0x19')]('['+[_0x37952a[_0xc7de('0x1a')]()]+']',_0x58d1ee[_0xc7de('0x1b')]);_0x4bec96(_0x58d1ee);});});};}function searchContact(_0x22526e,_0x2bc77b,_0x28f41b,_0xdb9af4){return new Promise(function(_0x74c300,_0x1ef3d4){var _0x45336c={'method':'GET','headers':_0x2bc77b,'uri':_0x22526e+'/api/lookup?q='+_0xdb9af4+_0xc7de('0x24')+_0x28f41b+_0xc7de('0x25'),'json':!![]};rp(_0x45336c)[_0xc7de('0x10')](function(_0x5b56d5){var _0x4c6e6e=_['find'](_0x5b56d5[_0xc7de('0x26')][_0xc7de('0x26')],[_0x28f41b,_0xdb9af4]);_0x74c300(_0x4c6e6e);})['catch'](function(_0x459c15){_0x1ef3d4(_0x459c15);});});}function getEndUser(_0x167c84,_0x1fb7ad,_0x3ddaeb){return function(_0xbb8fef){return new Promise(function(_0x828933,_0x5a7be3){logger[_0xc7de('0x1d')](util['format'](_0xc7de('0x27'),_0xbb8fef[_0xc7de('0x28')]));searchContact(_0x3ddaeb,_0x1fb7ad,'mobile_number',_0xbb8fef['contactNumber'])[_0xc7de('0x10')](function(_0x12e04f){if(_0x12e04f){_0xbb8fef['endUserId']=_0x12e04f['id'];logger[_0xc7de('0x1d')]('Contact\x20found\x20mobile_number:',_0xbb8fef[_0xc7de('0x29')]);return _0x828933(_0xbb8fef);}searchContact(_0x3ddaeb,_0x1fb7ad,_0xc7de('0x2a'),_0xbb8fef[_0xc7de('0x28')])[_0xc7de('0x10')](function(_0x36eb35){if(_0x36eb35){_0xbb8fef[_0xc7de('0x29')]=_0x36eb35['id'];logger[_0xc7de('0x1d')](_0xc7de('0x2b'),_0xbb8fef[_0xc7de('0x29')]);return _0x828933(_0xbb8fef);}createEndUser(_0xbb8fef,_0x167c84,_0x1fb7ad,_0x3ddaeb)[_0xc7de('0x10')](function(_0x15108e){logger['info'](_0xc7de('0x2c'),_0x15108e[_0xc7de('0x29')]);return _0x828933(_0x15108e);});});})['catch'](function(_0x413c67){_0x5a7be3(_0x413c67);});});};}function createEndUser(_0x17a16c,_0x4bf1da,_0x3b66b1,_0x308724){return new Promise(function(_0x2fe5a9,_0x36a4ea){var _0x45471e=moment();var _0x47b685={'method':'POST','uri':_0x308724+_0xc7de('0x2d'),'body':{'contact':{'last_name':_0x17a16c['contactNumber'],'work_number':_0x17a16c[_0xc7de('0x28')],'mobile_number':_0x17a16c[_0xc7de('0x28')],'owner_id':_0x17a16c[_0xc7de('0x22')],'created_at':_0x45471e[_0xc7de('0x2e')](_0xc7de('0x2f'))}},'json':!![]};_0x47b685['headers']=_0x3b66b1;logger[_0xc7de('0x1d')](_0xc7de('0x30'));return rp(_0x47b685)[_0xc7de('0x10')](function(_0x13a549){_0x17a16c[_0xc7de('0x29')]=_0x13a549[_0xc7de('0x31')]['id'];_0x2fe5a9(_0x17a16c);})[_0xc7de('0x18')](function(_0x30c9a8){logger[_0xc7de('0x19')]('['+[_0x4bf1da[_0xc7de('0x1a')]()]+']',_0x30c9a8[_0xc7de('0x1b')]);_0x36a4ea(_0x30c9a8['message']);});});}function getTicket(_0x97b72e,_0x216874,_0x2ba072,_0x3a6d24,_0x54f240){return function(_0x5c7db4){logger[_0xc7de('0x1d')](_0xc7de('0x32'));return new Promise(function(_0x556611,_0x5d1533){var _0x108661=moment();var _0x5b9bdf={'method':_0xc7de('0x33'),'uri':_0x2ba072+_0xc7de('0x34'),'body':{'title':intUtil[_0xc7de('0x35')](_0x3a6d24['Subjects'],_0x54f240,'\x20'),'description':intUtil[_0xc7de('0x35')](_0x3a6d24[_0xc7de('0x36')],_0x54f240,'\x0a'),'owner_id':_0x5c7db4[_0xc7de('0x22')],'creater_id':_0x5c7db4[_0xc7de('0x15')],'targetable_id':_0x5c7db4['endUserId'],'targetable_type':_0xc7de('0x37'),'created_at':_0x108661[_0xc7de('0x2e')](_0xc7de('0x2f')),'due_date':_0x108661['add'](0x1e,'m')[_0xc7de('0x2e')](_0xc7de('0x2f'))},'json':!![]};_0x5b9bdf[_0xc7de('0x1c')]=_0x216874;return rp(_0x5b9bdf)[_0xc7de('0x10')](function(_0x39b689){_0x5c7db4[_0xc7de('0x38')]=_0x39b689[_0xc7de('0x39')]['id'];logger[_0xc7de('0x1d')](_0xc7de('0x3a'),_0x5c7db4['ticketId']);_0x556611(_0x5c7db4);})[_0xc7de('0x18')](function(_0x3ec1b4){logger[_0xc7de('0x19')]('['+[_0x97b72e[_0xc7de('0x1a')]()]+']',_0x3ec1b4['message']);_0x5d1533(_0x3ec1b4[_0xc7de('0x1b')]);});});};}function emit(_0xcc995f,_0x1abe55,_0x36949f){var _0x27e14f={'uri':_0xcc995f+'/contacts/'+_0x36949f};io['to'](util[_0xc7de('0x2e')](_0xc7de('0x3b'),_0x1abe55))[_0xc7de('0x3c')](_0xc7de('0x3d'),_0x27e14f);}exports['cs']=function(_0x12bc4e,_0x313a25,_0x3727bc,_0x59e031,_0x48e1e8,_0x2de8d2,_0xe45227,_0x5cff69){var _0x5a6539={};var _0xd8bbf8={'Authorization':_0xc7de('0x3e')+_0x2de8d2[_0xc7de('0x3f')]};_0x2de8d2['remoteUri']=intUtil[_0xc7de('0x40')](_0x2de8d2[_0xc7de('0x41')]);_0x2de8d2['serverUrl']=intUtil['stripTrailingSlash'](_0x2de8d2['serverUrl']);var _0x1279c6=_0x2de8d2[_0xc7de('0x41')];_0x5a6539[_0xc7de('0x14')]=_0x2de8d2[_0xc7de('0x42')];_0x5a6539['contactNumber']=_0x5cff69[_0xc7de('0x43')]()===_0xc7de('0x44')?_0x313a25[_0xc7de('0x45')]:_0x313a25[_0xc7de('0x46')];_0x5a6539['callDirection']=_0x5cff69==='queue'||_0x5cff69==='unmanaged'?'queue':_0xc7de('0x44');if(_0x59e031){_0x5a6539[_0xc7de('0x1f')]=_0x59e031['email'];}var _0x599146=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2de8d2[_0xc7de('0x47')],_0x313a25[_0xc7de('0x48')],md5(_0x313a25[_0xc7de('0x48')]));if(_0x48e1e8&&_0x48e1e8[_0xc7de('0x49')]){logger[_0xc7de('0x1d')](_0xc7de('0x4a'),'Recording\x20is\x20enabled!');_0x313a25['recordingURL']=_0x599146;}else if(_0xe45227&&_0xe45227[_0xc7de('0x4b')]&&_0xe45227[_0xc7de('0x4b')]!==_0xc7de('0x4c')){logger[_0xc7de('0x1d')](_0xc7de('0x4d'),_0xc7de('0x4e'));_0x313a25[_0xc7de('0x4f')]=_0x599146;}else{_0x313a25[_0xc7de('0x4f')]='';}return getAdminId(_0x5a6539,_0x5cff69,_0xd8bbf8,_0x1279c6)[_0xc7de('0x10')](getUser(_0x5cff69,_0xd8bbf8,_0x1279c6))['then'](getEndUser(_0x5cff69,_0xd8bbf8,_0x1279c6))[_0xc7de('0x10')](getTicket(_0x5cff69,_0xd8bbf8,_0x1279c6,_0x3727bc,_0x313a25))[_0xc7de('0x10')](function(_0x2364fe){logger['info'](util[_0xc7de('0x2e')](_0xc7de('0x50'),_0x2364fe['ticketId']));if(_0x5cff69!=='unmanaged'){logger['info']('['+[_0x5cff69[_0xc7de('0x1a')]()]+']',_0xc7de('0x51'));emit(_0x1279c6,_0x59e031[_0xc7de('0x52')],_0x2364fe[_0xc7de('0x29')]);}})['catch'](function(_0x315140){logger[_0xc7de('0x19')]('['+[_0x5cff69['toUpperCase']()]+_0xc7de('0x53'),util[_0xc7de('0x54')](_0x315140,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3eea=['Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url'];(function(_0x2d9062,_0x17a037){var _0xe74884=function(_0x4c016d){while(--_0x4c016d){_0x2d9062['push'](_0x2d9062['shift']());}};_0xe74884(++_0x17a037);}(_0x3eea,0x71));var _0xa3ee=function(_0x475f95,_0x249b14){_0x475f95=_0x475f95-0x0;var _0x2d15a3=_0x3eea[_0x475f95];return _0x2d15a3;};'use strict';var _=require(_0xa3ee('0x0'));var rp=require(_0xa3ee('0x1'));var md5=require(_0xa3ee('0x2'));var util=require(_0xa3ee('0x3'));var moment=require('moment');var Promise=require(_0xa3ee('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xa3ee('0x5'));var logger=require(_0xa3ee('0x6'))(_0xa3ee('0x7'));config[_0xa3ee('0x8')]=_[_0xa3ee('0x9')](config[_0xa3ee('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa3ee('0xa'))(new Redis(config[_0xa3ee('0x8')]));function getAdminId(_0x5864e4,_0xddaaac,_0x1d3eff,_0x4c6de3){return new Promise(function(_0x10750e,_0x1673a8){var _0x980e8f=![];var _0x49f8b2={'method':_0xa3ee('0xb'),'uri':_0x4c6de3+_0xa3ee('0xc'),'json':!![]};_0x49f8b2[_0xa3ee('0xd')]=_0x1d3eff;logger[_0xa3ee('0xe')](_0xa3ee('0xf'));return rp(_0x49f8b2)['then'](function(_0x1e86d8){if(_0x1e86d8){var _0x48bea3=_0x1e86d8[_0xa3ee('0x10')];var _0x40545e=null;for(_0x40545e=0x0;_0x40545e<_0x48bea3[_0xa3ee('0x11')];_0x40545e++){if(_0x48bea3[_0x40545e][_0xa3ee('0x12')]===_0x5864e4[_0xa3ee('0x13')]){_0x5864e4[_0xa3ee('0x14')]=_0x48bea3[_0x40545e]['id'];_0x980e8f=!![];}}if(_0x980e8f){logger[_0xa3ee('0xe')](_0xa3ee('0x15'),_0x5864e4[_0xa3ee('0x14')]);_0x10750e(_0x5864e4);}else{_0x1673a8({'statusCode':0x194,'message':_0xa3ee('0x16')});}}else{_0x1673a8({'statusCode':0x194,'message':_0xa3ee('0x16')});}})[_0xa3ee('0x17')](function(_0x485ced){logger['error']('['+[_0xddaaac[_0xa3ee('0x18')]()]+']',_0x485ced[_0xa3ee('0x19')]);_0x1673a8(_0x485ced);});});}function getUser(_0x163387,_0x5df00b,_0x1d3826){return function(_0xd7324f){return new Promise(function(_0x5a1626,_0xb3b2c4){var _0x14461b={'method':'GET','uri':_0x1d3826+_0xa3ee('0xc'),'json':!![]};_0x14461b[_0xa3ee('0xd')]=_0x5df00b;logger[_0xa3ee('0xe')](_0xa3ee('0x1a'));return rp(_0x14461b)[_0xa3ee('0x1b')](function(_0x133fc2){if(_0x133fc2){var _0x2a2a1b=_0x133fc2[_0xa3ee('0x10')];var _0x4cc213=![];var _0x3faa0b=null;if(_0xd7324f['agentEmail']!==null){logger['info'](_0xa3ee('0x1c'),_0xd7324f['agentEmail']);_0xd7324f['userEmail']=_0xd7324f['agentEmail'];for(_0x3faa0b=0x0;_0x3faa0b<_0x2a2a1b[_0xa3ee('0x11')];_0x3faa0b++){if(_0x2a2a1b[_0x3faa0b]['email']===_0xd7324f[_0xa3ee('0x1d')]){_0x4cc213=!![];_0xd7324f[_0xa3ee('0x1e')]=_0x2a2a1b[_0x3faa0b]['id'];logger[_0xa3ee('0xe')](_0xa3ee('0x1f'),_0xd7324f[_0xa3ee('0x1e')]);}}}if(!_0x4cc213){logger['info'](_0xa3ee('0x20'));_0xd7324f[_0xa3ee('0x21')]=_0xd7324f[_0xa3ee('0x13')];_0xd7324f['userId']=_0xd7324f[_0xa3ee('0x14')];_0x4cc213=!![];}if(_0x4cc213){_0x5a1626(_0xd7324f);}else{_0xb3b2c4({'statusCode':0x194,'message':_0xa3ee('0x16')});}}else{_0xb3b2c4({'statusCode':0x194,'message':_0xa3ee('0x16')});}})[_0xa3ee('0x17')](function(_0x478d70){logger[_0xa3ee('0x22')]('['+[_0x163387[_0xa3ee('0x18')]()]+']',_0x478d70[_0xa3ee('0x19')]);_0xb3b2c4(_0x478d70);});});};}function searchContact(_0x3a7f1e,_0x1ac0f3,_0x665d6d,_0xe3a886){return new Promise(function(_0x55b46d,_0x12c7ff){var _0x5ddab2={'method':_0xa3ee('0xb'),'headers':_0x1ac0f3,'uri':_0x3a7f1e+_0xa3ee('0x23')+_0xe3a886+_0xa3ee('0x24')+_0x665d6d+_0xa3ee('0x25'),'json':!![]};rp(_0x5ddab2)[_0xa3ee('0x1b')](function(_0x1b9396){var _0x47dc81=_['find'](_0x1b9396['contacts'][_0xa3ee('0x26')],[_0x665d6d,_0xe3a886]);_0x55b46d(_0x47dc81);})['catch'](function(_0xf3eb4e){_0x12c7ff(_0xf3eb4e);});});}function getEndUser(_0x344e86,_0x350f90,_0x70839f){return function(_0x37dcb7){return new Promise(function(_0x10e9ed,_0xb9ff65){logger[_0xa3ee('0xe')](util[_0xa3ee('0x27')](_0xa3ee('0x28'),_0x37dcb7['contactNumber']));searchContact(_0x70839f,_0x350f90,'mobile_number',_0x37dcb7[_0xa3ee('0x29')])[_0xa3ee('0x1b')](function(_0x1f9e71){if(_0x1f9e71){_0x37dcb7[_0xa3ee('0x2a')]=_0x1f9e71['id'];logger[_0xa3ee('0xe')](_0xa3ee('0x2b'),_0x37dcb7[_0xa3ee('0x2a')]);return _0x10e9ed(_0x37dcb7);}searchContact(_0x70839f,_0x350f90,'work_number',_0x37dcb7['contactNumber'])[_0xa3ee('0x1b')](function(_0x269c62){if(_0x269c62){_0x37dcb7[_0xa3ee('0x2a')]=_0x269c62['id'];logger[_0xa3ee('0xe')](_0xa3ee('0x2c'),_0x37dcb7['endUserId']);return _0x10e9ed(_0x37dcb7);}createEndUser(_0x37dcb7,_0x344e86,_0x350f90,_0x70839f)[_0xa3ee('0x1b')](function(_0x1bef25){logger[_0xa3ee('0xe')](_0xa3ee('0x2d'),_0x1bef25[_0xa3ee('0x2a')]);return _0x10e9ed(_0x1bef25);});});})[_0xa3ee('0x17')](function(_0x21db14){_0xb9ff65(_0x21db14);});});};}function createEndUser(_0xa62842,_0x12f953,_0x276c2d,_0x429381){return new Promise(function(_0x37bb01,_0x4331ce){var _0x16ea63=moment();var _0x55d031={'method':'POST','uri':_0x429381+'/api/contacts','body':{'contact':{'last_name':_0xa62842[_0xa3ee('0x29')],'work_number':_0xa62842['contactNumber'],'mobile_number':_0xa62842[_0xa3ee('0x29')],'owner_id':_0xa62842['userId'],'created_at':_0x16ea63[_0xa3ee('0x27')](_0xa3ee('0x2e'))}},'json':!![]};_0x55d031[_0xa3ee('0xd')]=_0x276c2d;logger['info'](_0xa3ee('0x2f'));return rp(_0x55d031)[_0xa3ee('0x1b')](function(_0x53c256){_0xa62842[_0xa3ee('0x2a')]=_0x53c256[_0xa3ee('0x30')]['id'];_0x37bb01(_0xa62842);})['catch'](function(_0x251c52){logger[_0xa3ee('0x22')]('['+[_0x12f953[_0xa3ee('0x18')]()]+']',_0x251c52['message']);_0x4331ce(_0x251c52['message']);});});}function getTicket(_0x481b6c,_0x51d1b5,_0x3f68c3,_0x3e9310,_0xebb7b4){return function(_0x1cafee){logger['info'](_0xa3ee('0x31'));return new Promise(function(_0x9046ae,_0x3cbb1d){var _0x33239e=moment();var _0x27da78={'method':_0xa3ee('0x32'),'uri':_0x3f68c3+_0xa3ee('0x33'),'body':{'title':intUtil['getString'](_0x3e9310[_0xa3ee('0x34')],_0xebb7b4,'\x20'),'description':intUtil[_0xa3ee('0x35')](_0x3e9310[_0xa3ee('0x36')],_0xebb7b4,'\x0a'),'owner_id':_0x1cafee['userId'],'creater_id':_0x1cafee[_0xa3ee('0x14')],'targetable_id':_0x1cafee[_0xa3ee('0x2a')],'targetable_type':_0xa3ee('0x37'),'created_at':_0x33239e[_0xa3ee('0x27')](_0xa3ee('0x2e')),'due_date':_0x33239e[_0xa3ee('0x38')](0x1e,'m')[_0xa3ee('0x27')](_0xa3ee('0x2e'))},'json':!![]};_0x27da78[_0xa3ee('0xd')]=_0x51d1b5;return rp(_0x27da78)[_0xa3ee('0x1b')](function(_0x3b488c){_0x1cafee[_0xa3ee('0x39')]=_0x3b488c[_0xa3ee('0x3a')]['id'];logger['info'](_0xa3ee('0x3b'),_0x1cafee[_0xa3ee('0x39')]);_0x9046ae(_0x1cafee);})[_0xa3ee('0x17')](function(_0x1d5eaa){logger[_0xa3ee('0x22')]('['+[_0x481b6c[_0xa3ee('0x18')]()]+']',_0x1d5eaa[_0xa3ee('0x19')]);_0x3cbb1d(_0x1d5eaa[_0xa3ee('0x19')]);});});};}function emit(_0x109f77,_0x10e2be,_0x398d66){var _0x3a9dc8={'uri':_0x109f77+_0xa3ee('0x3c')+_0x398d66};io['to'](util[_0xa3ee('0x27')]('user:%s',_0x10e2be))[_0xa3ee('0x3d')](_0xa3ee('0x3e'),_0x3a9dc8);}exports['cs']=function(_0x2c6242,_0x58f95b,_0x151f34,_0x59f9e3,_0x132585,_0x3e1b07,_0x1a491d,_0x2a2a48){var _0x23261a={};var _0x57660c={'Authorization':_0xa3ee('0x3f')+_0x3e1b07[_0xa3ee('0x40')]};_0x3e1b07[_0xa3ee('0x41')]=intUtil[_0xa3ee('0x42')](_0x3e1b07[_0xa3ee('0x41')]);_0x3e1b07[_0xa3ee('0x43')]=intUtil[_0xa3ee('0x42')](_0x3e1b07[_0xa3ee('0x43')]);var _0x4f1681=_0x3e1b07[_0xa3ee('0x41')];_0x23261a[_0xa3ee('0x13')]=_0x3e1b07[_0xa3ee('0x44')];_0x23261a[_0xa3ee('0x29')]=_0x2a2a48['toLowerCase']()===_0xa3ee('0x45')?_0x58f95b[_0xa3ee('0x46')]:_0x58f95b[_0xa3ee('0x47')];_0x23261a[_0xa3ee('0x48')]=_0x2a2a48===_0xa3ee('0x49')||_0x2a2a48===_0xa3ee('0x4a')?'queue':_0xa3ee('0x45');if(_0x59f9e3){_0x23261a['agentEmail']=_0x59f9e3[_0xa3ee('0x12')];}var _0x48209b=util[_0xa3ee('0x27')](_0xa3ee('0x4b'),_0x3e1b07[_0xa3ee('0x43')],_0x58f95b[_0xa3ee('0x4c')],md5(_0x58f95b[_0xa3ee('0x4c')]));if(_0x132585&&_0x132585[_0xa3ee('0x4d')]){logger[_0xa3ee('0xe')](_0xa3ee('0x4e'),_0xa3ee('0x4f'));_0x58f95b[_0xa3ee('0x50')]=_0x48209b;}else if(_0x1a491d&&_0x1a491d['recordingFormat']&&_0x1a491d[_0xa3ee('0x51')]!==_0xa3ee('0x52')){logger[_0xa3ee('0xe')](_0xa3ee('0x53'),_0xa3ee('0x4f'));_0x58f95b['recordingURL']=_0x48209b;}else{_0x58f95b[_0xa3ee('0x50')]='';}return getAdminId(_0x23261a,_0x2a2a48,_0x57660c,_0x4f1681)[_0xa3ee('0x1b')](getUser(_0x2a2a48,_0x57660c,_0x4f1681))['then'](getEndUser(_0x2a2a48,_0x57660c,_0x4f1681))['then'](getTicket(_0x2a2a48,_0x57660c,_0x4f1681,_0x151f34,_0x58f95b))[_0xa3ee('0x1b')](function(_0x103169){logger[_0xa3ee('0xe')](util[_0xa3ee('0x27')](_0xa3ee('0x54'),_0x103169[_0xa3ee('0x39')]));if(_0x2a2a48!==_0xa3ee('0x4a')){logger['info']('['+[_0x2a2a48['toUpperCase']()]+']',_0xa3ee('0x55'));emit(_0x4f1681,_0x59f9e3[_0xa3ee('0x56')],_0x103169[_0xa3ee('0x2a')]);}})[_0xa3ee('0x17')](function(_0x3de3a5){logger[_0xa3ee('0x22')]('['+[_0x2a2a48[_0xa3ee('0x18')]()]+_0xa3ee('0x57'),util['inspect'](_0x3de3a5,{'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 7e7b94f..62bb9d8 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 _0xe9d0=['./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce'];(function(_0x43ad18,_0x21f334){var _0x3bdc6a=function(_0x16fbd5){while(--_0x16fbd5){_0x43ad18['push'](_0x43ad18['shift']());}};_0x3bdc6a(++_0x21f334);}(_0xe9d0,0x124));var _0x0e9d=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0xe9d0[_0x43f552];return _0x17911b;};'use strict';var _=require(_0x0e9d('0x0'));var util=require(_0x0e9d('0x1'));var zendesk=require(_0x0e9d('0x2'));var salesforce=require(_0x0e9d('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0e9d('0x4'));var zoho=require(_0x0e9d('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x0e9d('0x6'));var dynamics365=require(_0x0e9d('0x7'));var freshsales=require(_0x0e9d('0x8'));var integrations=[_0x0e9d('0x9'),_0x0e9d('0xa'),_0x0e9d('0xb'),_0x0e9d('0xc'),_0x0e9d('0xd'),_0x0e9d('0xe'),_0x0e9d('0xf'),_0x0e9d('0x10'),_0x0e9d('0x11'),_0x0e9d('0x12')];exports[_0x0e9d('0x13')]=function(_0x3b0608,_0x568067,_0xb234f1,_0x50b15a,_0x232506,_0x35ec64){if(_0xb234f1){if(_[_0x0e9d('0x14')](integrations,_0x3b0608[_0x0e9d('0x15')]['toLowerCase']())){try{var _0x499e7f=null;var _0x328e97='';var _0x15f121=_0xb234f1[_0x3b0608[_0x0e9d('0x15')][_0x0e9d('0x16')]()];if(_0x15f121){var _0x218685=_0x15f121[_0x3b0608[_0x0e9d('0x17')]];if(_0x218685){var _0x32298d=_[_0x0e9d('0x18')](_0x218685[_0x0e9d('0x19')],{'id':parseInt(_0x3b0608[_0x0e9d('0x1a')],0xa)});if(_0x32298d){if(_0x50b15a){if(_0x232506&&_0x568067[_0x0e9d('0x1b')]){_0x328e97=_0x0e9d('0x1b');}else if(_0x568067[_0x0e9d('0x1c')]){_0x328e97=_0x0e9d('0x1d');}else{console[_0x0e9d('0x1e')]('EVENT\x20UNKNOWN',_0x568067);}}else{_0x328e97='unmanaged';}switch(_0x3b0608[_0x0e9d('0x15')][_0x0e9d('0x16')]()){case _0x0e9d('0x9'):zendesk[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xa'):salesforce[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xb'):sugarcrm[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xc'):freshdesk[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xd'):zoho[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xe'):desk[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0xf'):vtiger[_0x328e97](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64);break;case _0x0e9d('0x11'):freshsales['cs'](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64,_0x328e97);break;case'servicenow':servicenow['cs'](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64,_0x328e97);break;case _0x0e9d('0x10'):dynamics365['cs'](_0x3b0608,_0x568067,_0x32298d,_0x50b15a,_0x232506,_0x218685,_0x35ec64,_0x328e97);break;default:console[_0x0e9d('0x1e')]('unknown\x20integration');}}else{_0x499e7f=require(_0x0e9d('0x1f'))(_0x3b0608[_0x0e9d('0x15')][_0x0e9d('0x16')]());_0x499e7f[_0x0e9d('0x20')]('[EXEC]',util[_0x0e9d('0x21')](_0x0e9d('0x22'),_0x3b0608[_0x0e9d('0x15')][_0x0e9d('0x16')](),_0x3b0608[_0x0e9d('0x1a')]));}}else{_0x499e7f=require(_0x0e9d('0x1f'))(_0x3b0608['data1'][_0x0e9d('0x16')]());_0x499e7f['error'](_0x0e9d('0x23'),util[_0x0e9d('0x21')](_0x0e9d('0x24'),_0x3b0608[_0x0e9d('0x15')][_0x0e9d('0x16')](),_0x3b0608[_0x0e9d('0x17')]));}}else{}}catch(_0x36a2f4){console['error'](_0x36a2f4);}}}}; \ No newline at end of file +var _0x56d8=['format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','../../../../config/logger','error','[EXEC]'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x56d8,0xda));var _0x856d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x56d8[_0x432682];return _0x463d05;};'use strict';var _=require(_0x856d('0x0'));var util=require(_0x856d('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x856d('0x2'));var sugarcrm=require(_0x856d('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x856d('0x4'));var desk=require(_0x856d('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x856d('0x6'));var dynamics365=require(_0x856d('0x7'));var freshsales=require(_0x856d('0x8'));var integrations=[_0x856d('0x9'),_0x856d('0xa'),_0x856d('0xb'),_0x856d('0xc'),_0x856d('0xd'),_0x856d('0xe'),_0x856d('0xf'),'dynamics365',_0x856d('0x10'),_0x856d('0x11')];exports[_0x856d('0x12')]=function(_0x269b4b,_0x1380f9,_0x3132a9,_0x46002a,_0x5ecdd4,_0xd7774d){if(_0x3132a9){if(_['includes'](integrations,_0x269b4b[_0x856d('0x13')][_0x856d('0x14')]())){try{var _0x5b2380=null;var _0x46f919='';var _0x38c470=_0x3132a9[_0x269b4b[_0x856d('0x13')]['toLowerCase']()];if(_0x38c470){var _0x284a2b=_0x38c470[_0x269b4b[_0x856d('0x15')]];if(_0x284a2b){var _0x509e8f=_[_0x856d('0x16')](_0x284a2b[_0x856d('0x17')],{'id':parseInt(_0x269b4b[_0x856d('0x18')],0xa)});if(_0x509e8f){if(_0x46002a){if(_0x5ecdd4&&_0x1380f9[_0x856d('0x19')]){_0x46f919=_0x856d('0x19');}else if(_0x1380f9[_0x856d('0x1a')]){_0x46f919=_0x856d('0x1b');}else{console[_0x856d('0x1c')](_0x856d('0x1d'),_0x1380f9);}}else{_0x46f919=_0x856d('0x1e');}switch(_0x269b4b['data1'][_0x856d('0x14')]()){case _0x856d('0x9'):zendesk[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xa'):salesforce[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xb'):sugarcrm[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xc'):freshdesk[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xd'):zoho[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xe'):desk[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0xf'):vtiger[_0x46f919](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d);break;case _0x856d('0x10'):freshsales['cs'](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d,_0x46f919);break;case'servicenow':servicenow['cs'](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d,_0x46f919);break;case'dynamics365':dynamics365['cs'](_0x269b4b,_0x1380f9,_0x509e8f,_0x46002a,_0x5ecdd4,_0x284a2b,_0xd7774d,_0x46f919);break;default:console['log']('unknown\x20integration');}}else{_0x5b2380=require(_0x856d('0x1f'))(_0x269b4b[_0x856d('0x13')][_0x856d('0x14')]());_0x5b2380[_0x856d('0x20')](_0x856d('0x21'),util[_0x856d('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x269b4b[_0x856d('0x13')]['toLowerCase'](),_0x269b4b[_0x856d('0x18')]));}}else{_0x5b2380=require(_0x856d('0x1f'))(_0x269b4b[_0x856d('0x13')][_0x856d('0x14')]());_0x5b2380['error']('[EXEC]',util[_0x856d('0x22')](_0x856d('0x23'),_0x269b4b[_0x856d('0x13')][_0x856d('0x14')](),_0x269b4b[_0x856d('0x15')]));}}else{}}catch(_0x3d107b){console[_0x856d('0x20')](_0x3d107b);}}}}; \ 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 dde2e07..85dd4bc 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 _0x566d=['getString','Subjects','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','$or','Account','execute','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','assign'];(function(_0x239e9e,_0x4719b8){var _0xec38f2=function(_0x29630c){while(--_0x29630c){_0x239e9e['push'](_0x239e9e['shift']());}};_0xec38f2(++_0x4719b8);}(_0x566d,0x171));var _0xd566=function(_0x593656,_0xb796d9){_0x593656=_0x593656-0x0;var _0x36531a=_0x566d[_0x593656];return _0x36531a;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd566('0x0'));var md5=require(_0xd566('0x1'));var jsforce=require(_0xd566('0x2'));var util=require(_0xd566('0x3'));var Redis=require(_0xd566('0x4'));var intUtil=require('./util');var config=require(_0xd566('0x5'));var logger=require('../../../../config/logger')(_0xd566('0x6'));config['redis']=_['defaults'](config[_0xd566('0x7')],{'host':_0xd566('0x8'),'port':0x18eb});var io=require(_0xd566('0x9'))(new Redis(config[_0xd566('0x7')]));function emit(_0x51eb72,_0x45f3b7,_0x353eb0){io['to'](_0x51eb72)[_0xd566('0xa')](_0x45f3b7,_0x353eb0);}function getTicket(_0x5253a7,_0x421f6a,_0x293819,_0x12e51b,_0x9c1b86,_0x2674a1,_0x4c03b6,_0x580d85){var _0x49325a=Object[_0xd566('0xb')]({},{'OwnerId':_0x421f6a['id'],'Subject':intUtil[_0xd566('0xc')](_0x12e51b[_0xd566('0xd')],_0x9c1b86,'\x20'),'Description':intUtil[_0xd566('0xc')](_0x12e51b['Descriptions'],_0x9c1b86,'\x0a')},getCustomFields(_0x2674a1,_0x9c1b86));if(_0x293819){if(_0x12e51b[_0xd566('0xe')]===_0xd566('0xf')){_0x49325a['ActivityDate']=moment[_0xd566('0x10')]();_0x49325a[_0xd566('0x11')]=![];_0x49325a[_0xd566('0x12')]=![];if(_0x293819[_0xd566('0x13')]===_0xd566('0x14')||_0x293819[_0xd566('0x13')]===_0xd566('0x15')){_0x49325a[_0xd566('0x16')]=_0x293819['id'];}else if(_0x293819[_0xd566('0x13')]===_0xd566('0x17')){_0x49325a[_0xd566('0x18')]=_0x293819['id'];}}else if(_0x12e51b[_0xd566('0xe')]===_0xd566('0x19')){if(_0x293819[_0xd566('0x13')]===_0xd566('0x14')){_0x49325a[_0xd566('0x1a')]=_0x293819['id'];}else if(_0x293819[_0xd566('0x13')]===_0xd566('0x17')){_0x49325a[_0xd566('0x1b')]=_0x293819['id'];}else if(_0x293819[_0xd566('0x13')]===_0xd566('0x15')&&_0x12e51b[_0xd566('0x1c')]){_0x49325a[_0x12e51b[_0xd566('0x1c')]]=_0x293819['id'];}else{logger[_0xd566('0x1d')](_0xd566('0x1e'));}}}return _0x4c03b6[_0xd566('0x1f')](_0x12e51b[_0xd566('0xe')])[_0xd566('0x20')](_0x49325a);}function getUser(_0x179ed4,_0x18a3bb,_0x54acfd){if(!_[_0xd566('0x21')](_0x18a3bb)&&intUtil[_0xd566('0x22')](_0x18a3bb)){var _0x265bdc={'Email':_0x18a3bb};var _0x14f873={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x54acfd['sobject'](_0xd566('0x23'))[_0xd566('0x24')](_0x265bdc,_0x14f873)['execute']()[_0xd566('0x25')](function(_0x128db4){if(_0x128db4[_0xd566('0x26')]){var _0x1799d8=_[_0xd566('0x24')](_0x128db4,function(_0x17fb8e){return _0x17fb8e[_0xd566('0x27')]===_0x18a3bb;});if(_0x1799d8){logger[_0xd566('0x1d')](_0xd566('0x28'),_0x18a3bb);return BPromise['resolve']({'id':_0x1799d8['Id'],'name':_0x1799d8[_0xd566('0x29')]});}}else{logger[_0xd566('0x1d')](_0xd566('0x2a'),_0x18a3bb);return _0x54acfd['identity']()[_0xd566('0x25')](function(_0xd0259){return BPromise[_0xd566('0x2b')]({'id':_0xd0259[_0xd566('0x2c')],'name':_0xd0259[_0xd566('0x2d')]});});}});}else{logger[_0xd566('0x1d')](_0xd566('0x2a'),_0x18a3bb);return _0x54acfd['identity']()[_0xd566('0x25')](function(_0x451cb2){return BPromise[_0xd566('0x2b')]({'id':_0x451cb2[_0xd566('0x2c')],'name':_0x451cb2[_0xd566('0x2d')]});});}}function getEndUser(_0x3085f8,_0x18be3d,_0x1caa42,_0x2cfa87,_0x476695){var _0xe65f3={'$or':{'Phone':_0x2cfa87}};var _0x58c883={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xd566('0x25')](function(){logger[_0xd566('0x1d')](_0xd566('0x2e'),_0x2cfa87,_0x18be3d[_0xd566('0x2f')]);switch(_0x18be3d[_0xd566('0x2f')]){case _0xd566('0x30'):var _0x388c16=_['cloneDeep'](_0xe65f3);if(_0x18be3d[_0xd566('0x31')]){var _0x44380b={};_0x44380b[_0x18be3d[_0xd566('0x31')]]=_0x2cfa87;_['merge'](_0x388c16['$or'],_0x44380b);}return _0x476695['sobject'](_0xd566('0x32'))['find'](_0x388c16,_0x58c883)['execute']()[_0xd566('0x25')](function(_0x49568f){if(_0x49568f&&_0x49568f[_0xd566('0x26')]){return _0x49568f;}else{var _0x25bcb1=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d[_0xd566('0x34')]){var _0x18659f={};_0x18659f[_0x18be3d[_0xd566('0x34')]]=_0x2cfa87;_[_0xd566('0x35')](_0x25bcb1['$or'],_0x18659f);}return _0x476695[_0xd566('0x1f')](_0xd566('0x36'))[_0xd566('0x24')](_0x25bcb1,_0x58c883);}});case'account_contact_lead':var _0x1add6f=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d[_0xd566('0x37')]){var _0x44380b={};_0x44380b[_0x18be3d[_0xd566('0x37')]]=_0x2cfa87;_['merge'](_0x1add6f[_0xd566('0x38')],_0x44380b);}return _0x476695['sobject'](_0xd566('0x39'))[_0xd566('0x24')](_0x1add6f,_0x58c883)[_0xd566('0x3a')]()[_0xd566('0x25')](function(_0x346d61){if(_0x346d61&&_0x346d61[_0xd566('0x26')]){return _0x346d61;}else{var _0x1c2687=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d[_0xd566('0x31')]){var _0x57794d={};_0x57794d[_0x18be3d['additionalSearchContact']]=_0x2cfa87;_[_0xd566('0x35')](_0x1c2687[_0xd566('0x38')],_0x57794d);}return _0x476695[_0xd566('0x1f')](_0xd566('0x32'))['find'](_0x1c2687,_0x58c883)[_0xd566('0x25')](function(_0x40deeb){if(_0x40deeb&&_0x40deeb[_0xd566('0x26')]){return _0x40deeb;}else{var _0x2acf2d=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d[_0xd566('0x34')]){var _0x52eaaf={};_0x52eaaf[_0x18be3d['additionalSearchLead']]=_0x2cfa87;_[_0xd566('0x35')](_0x2acf2d[_0xd566('0x38')],_0x52eaaf);}return _0x476695[_0xd566('0x1f')](_0xd566('0x36'))[_0xd566('0x24')](_0x2acf2d,_0x58c883);}});}});case _0xd566('0x14'):var _0x388c16=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d['additionalSearchContact']){var _0x44380b={};_0x44380b[_0x18be3d[_0xd566('0x31')]]=_0x2cfa87;_['merge'](_0x388c16[_0xd566('0x38')],_0x44380b);}return _0x476695[_0xd566('0x1f')](_0xd566('0x32'))['find'](_0x388c16,_0x58c883)[_0xd566('0x3a')]();case _0xd566('0x15'):var _0x131fc0=_['cloneDeep'](_0xe65f3);if(_0x18be3d['additionalSearchLead']){var _0x44380b={};_0x44380b[_0x18be3d[_0xd566('0x34')]]=_0x2cfa87;_[_0xd566('0x35')](_0x131fc0['$or'],_0x44380b);}return _0x476695[_0xd566('0x1f')](_0xd566('0x36'))[_0xd566('0x24')](_0x131fc0,_0x58c883);case _0xd566('0x17'):var _0x1add6f=_[_0xd566('0x33')](_0xe65f3);if(_0x18be3d[_0xd566('0x37')]){var _0x44380b={};_0x44380b[_0x18be3d[_0xd566('0x37')]]=_0x2cfa87;_[_0xd566('0x35')](_0x1add6f[_0xd566('0x38')],_0x44380b);}return _0x476695[_0xd566('0x1f')](_0xd566('0x39'))['find'](_0x1add6f,_0x58c883);default:return null;}})['then'](function(_0x15d364){if(_0x15d364&&_0x15d364['length']){var _0x54d466=_[_0xd566('0x3b')](_0x15d364);if(_0x54d466){return BPromise[_0xd566('0x2b')]({'id':_0x54d466['Id'],'name':_0x54d466[_0xd566('0x29')],'phone':_0x54d466[_0xd566('0x3c')],'endUserType':_0x54d466[_0xd566('0x3d')][_0xd566('0x3e')][_0xd566('0x3f')]()});}}})[_0xd566('0x25')](function(_0x2989e6){if(_0x2989e6){logger[_0xd566('0x1d')](_0xd566('0x40'),_0x2989e6[_0xd566('0x13')],_0x2cfa87);return BPromise[_0xd566('0x2b')](_0x2989e6);}else{logger[_0xd566('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2cfa87);var _0x3648de={'Phone':_0x2cfa87};if(_0x18be3d['moduleCreate']){if(_0x18be3d[_0xd566('0x41')]===_0xd566('0x14')){logger['info'](_0xd566('0x42'),_0x2cfa87,_0x18be3d[_0xd566('0x41')]);_0x3648de[_0xd566('0x43')]=_0x1caa42!==_0xd566('0x44')?_0x1caa42:util['format'](_0xd566('0x45'),_0x2cfa87);}else if(_0x18be3d[_0xd566('0x41')]==='lead'){logger[_0xd566('0x1d')](_0xd566('0x42'),_0x2cfa87,_0x18be3d[_0xd566('0x41')]);_0x3648de[_0xd566('0x43')]=_0x1caa42!==_0xd566('0x44')?_0x1caa42:util[_0xd566('0x46')]('Caller\x20-\x20%s',_0x2cfa87);_0x3648de[_0xd566('0x47')]='No\x20Company';}else if(_0x18be3d[_0xd566('0x41')]===_0xd566('0x17')){logger[_0xd566('0x1d')](_0xd566('0x42'),_0x2cfa87,_0x18be3d['moduleCreate']);_0x3648de[_0xd566('0x29')]=_0x1caa42!==_0xd566('0x44')?_0x1caa42:util[_0xd566('0x46')]('Caller\x20-\x20%s',_0x2cfa87);}else{return null;}}return _0x476695['sobject'](_[_0xd566('0x48')](_0x18be3d[_0xd566('0x41')]))[_0xd566('0x20')](_0x3648de)[_0xd566('0x25')](function(_0x394250){return BPromise[_0xd566('0x2b')]({'id':_0x394250['id'],'endUserType':_0x18be3d[_0xd566('0x41')]});});}});}function getCustomFields(_0x54d0b7,_0x2a0fde){var _0x5ee80f={};if(_0x54d0b7['length']>0x0){_[_0xd566('0x49')](_0x54d0b7,function(_0x21f0e7){if(_[_0xd566('0x4a')]([_0xd566('0x4b'),_0xd566('0x4c')],_0x21f0e7[_0xd566('0x3e')])&&_0x21f0e7[_0xd566('0x4d')]){_0x5ee80f[_0x21f0e7[_0xd566('0x4d')]]=_0x21f0e7[_0xd566('0x4e')][_0xd566('0x4f')]();}else if(_0x21f0e7[_0xd566('0x3e')]===_0xd566('0x50')&&_0x21f0e7[_0xd566('0x51')]&&_0x21f0e7[_0xd566('0x4d')]){_0x2a0fde[_0x21f0e7['variableName']]&&(_0x5ee80f[_0x21f0e7[_0xd566('0x4d')]]=_0x2a0fde[_0x21f0e7[_0xd566('0x51')]][_0xd566('0x4f')]());}else if(_0x21f0e7[_0xd566('0x3e')]===_0xd566('0x52')&&_0x21f0e7[_0xd566('0x53')]&&_0x21f0e7[_0xd566('0x53')]['name']&&_0x21f0e7['idField']){_0x2a0fde[_0x21f0e7['Variable'][_0xd566('0x54')][_0xd566('0x3f')]()]&&(_0x5ee80f[_0x21f0e7[_0xd566('0x4d')]]=_0x2a0fde[_0x21f0e7[_0xd566('0x53')][_0xd566('0x54')][_0xd566('0x3f')]()][_0xd566('0x4f')]());}});}return _0x5ee80f;}function getConnection(_0x4444ed){var _0x14750b=_0x4444ed[_0xd566('0x55')][_0xd566('0x56')](_0x4444ed[_0xd566('0x57')]);var _0x3f0a9f=new jsforce[(_0xd566('0x58'))]({'oauth2':{'loginUrl':_0x4444ed['remoteUri']||_0xd566('0x59'),'clientId':_0x4444ed[_0xd566('0x5a')],'clientSecret':_0x4444ed[_0xd566('0x5b')]}});return _0x3f0a9f[_0xd566('0x5c')](_0x4444ed['username'],_0x14750b)[_0xd566('0x25')](function(){logger[_0xd566('0x1d')](_0xd566('0x5d'));return _0x3f0a9f;});}exports[_0xd566('0x5e')]=function(_0x3a6683,_0xc2b10e,_0x44c6cd,_0x30010d,_0x240afa,_0x3c2f5b){var _0x1251fe,_0x39bd2d,_0x55f615,_0x13fcd8;_0x3c2f5b['serverUrl']=intUtil[_0xd566('0x5f')](_0x3c2f5b[_0xd566('0x60')]);_0x3c2f5b[_0xd566('0x61')]=intUtil['stripTrailingSlash'](_0x3c2f5b[_0xd566('0x61')]);if(_0x240afa&&_0x240afa[_0xd566('0x62')]){logger[_0xd566('0x1d')](_0xd566('0x63'),_0xd566('0x64'));_0xc2b10e[_0xd566('0x65')]=util[_0xd566('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c2f5b[_0xd566('0x60')],_0xc2b10e[_0xd566('0x66')],md5(_0xc2b10e[_0xd566('0x66')]));}else{_0xc2b10e['recordingURL']='';}return getConnection(_0x3c2f5b)[_0xd566('0x25')](function(_0x5b3eaf){_0x13fcd8=_0x5b3eaf;return getUser(_0x3c2f5b,_0x30010d['email'],_0x13fcd8);})[_0xd566('0x25')](function(_0x2dfbfe){_0x1251fe=_0x2dfbfe;return getEndUser(_0x3c2f5b,_0x44c6cd,_0xc2b10e['calleridname'],_0xc2b10e[_0xd566('0x67')],_0x13fcd8);})[_0xd566('0x25')](function(_0x147790){_0x39bd2d=_0x147790;return getTicket(_0x3c2f5b,_0x1251fe,_0x39bd2d,_0x44c6cd,_0xc2b10e,_0x44c6cd[_0xd566('0x68')],_0x13fcd8,_0xd566('0x5e'));})[_0xd566('0x25')](function(_0x331a38){_0x55f615=_0x331a38;logger[_0xd566('0x1d')](_0xd566('0x69'),_0x55f615['id']);logger[_0xd566('0x1d')](_0xd566('0x6a'),_0x55f615['id'],_0x30010d[_0xd566('0x54')],_0x3c2f5b[_0xd566('0x3e')]);switch(_0x3c2f5b['type']){case _0xd566('0x6b'):emit(util[_0xd566('0x46')](_0xd566('0x6c'),_0x30010d[_0xd566('0x54')]),_0xd566('0x6d'),{'recordId':_0x55f615['id']});break;case _0xd566('0x6e'):emit(util[_0xd566('0x46')](_0xd566('0x6c'),_0x30010d['name']),_0xd566('0x6f'),{'uri':util[_0xd566('0x46')](_0xd566('0x70'),_0x13fcd8[_0xd566('0x71')],_0x55f615['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xd566('0x72')](function(_0x57acef){logger['error'](_0xd566('0x63'),_0x57acef);});};exports[_0xd566('0x73')]=function(_0x11d71d,_0x38393,_0x34b29f,_0x2c63c1,_0x2bc8c9,_0x3722de,_0x4216b7){var _0x65cbed,_0x356b15,_0x298269,_0x487b0a;_0x3722de['serverUrl']=intUtil[_0xd566('0x5f')](_0x3722de[_0xd566('0x60')]);_0x3722de[_0xd566('0x61')]=intUtil['stripTrailingSlash'](_0x3722de[_0xd566('0x61')]);if(_0x4216b7&&_0x4216b7[_0xd566('0x74')]&&_0x4216b7['recordingFormat']!==_0xd566('0x75')){logger[_0xd566('0x1d')](_0xd566('0x76'),'Recording\x20is\x20enabled!');_0x38393[_0xd566('0x65')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3722de[_0xd566('0x60')],_0x38393[_0xd566('0x66')],md5(_0x38393[_0xd566('0x66')]));}return getConnection(_0x3722de)[_0xd566('0x25')](function(_0x5f22c4){_0x487b0a=_0x5f22c4;return getUser(_0x3722de,_0x2c63c1['email'],_0x487b0a);})[_0xd566('0x25')](function(_0x2e56bd){_0x65cbed=_0x2e56bd;return getEndUser(_0x3722de,_0x34b29f,_0x38393[_0xd566('0x77')],_0x38393['destcalleridnum'],_0x487b0a);})[_0xd566('0x25')](function(_0xdc8a99){_0x356b15=_0xdc8a99;return getTicket(_0x3722de,_0x65cbed,_0x356b15,_0x34b29f,_0x38393,_0x34b29f[_0xd566('0x68')],_0x487b0a,'outbound');})[_0xd566('0x25')](function(_0x4179ac){_0x298269=_0x4179ac;logger[_0xd566('0x1d')](_0xd566('0x78'),_0x298269['id']);logger[_0xd566('0x1d')](_0xd566('0x79'),_0x298269['id'],_0x2c63c1['name'],_0x3722de['type']);switch(_0x3722de[_0xd566('0x3e')]){case _0xd566('0x6b'):emit(util[_0xd566('0x46')]('user:%s',_0x2c63c1['name']),_0xd566('0x6d'),{'recordId':_0x298269['id']});break;case'newTab':emit(util[_0xd566('0x46')](_0xd566('0x6c'),_0x2c63c1['name']),_0xd566('0x6f'),{'uri':util[_0xd566('0x46')](_0xd566('0x70'),_0x487b0a['instanceUrl'],_0x298269['id'])});break;default:logger[_0xd566('0x7a')](_0xd566('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x14f658){logger[_0xd566('0x7a')](_0xd566('0x76'),_0x14f658);});};exports['unmanaged']=function(_0x45ebb7,_0x2170ef,_0x5790af,_0x428f91,_0x39f9e3,_0x178045){var _0x3f03f0,_0xacf92,_0x2a67ad,_0x5c84b4;_0x178045[_0xd566('0x60')]=intUtil[_0xd566('0x5f')](_0x178045['serverUrl']);_0x178045['remoteUri']=intUtil['stripTrailingSlash'](_0x178045[_0xd566('0x61')]);if(_0x39f9e3&&_0x39f9e3[_0xd566('0x62')]){logger['info']('['+_0x2170ef[_0xd566('0x7b')][_0xd566('0x7c')]()+']','Recording\x20is\x20enabled!');_0x2170ef['recordingURL']=util[_0xd566('0x46')](_0xd566('0x7d'),_0x178045['serverUrl'],_0x2170ef['uniqueid'],md5(_0x2170ef['uniqueid']));}else{_0x2170ef['recordingURL']='';}return getConnection(_0x178045)['then'](function(_0x122338){_0x5c84b4=_0x122338;if(!_[_0xd566('0x21')](_0x428f91)){return getUser(_0x178045,_0x428f91[_0xd566('0x54')],_0x5c84b4);}else{return getUser(_0x178045,null,_0x5c84b4);}})[_0xd566('0x25')](function(_0x1cabb6){_0x3f03f0=_0x1cabb6;return getEndUser(_0x178045,_0x5790af,_0x2170ef[_0xd566('0x7e')],_0x2170ef['calleridnum'],_0x5c84b4);})[_0xd566('0x25')](function(_0x43065f){_0xacf92=_0x43065f;return getTicket(_0x178045,_0x3f03f0,_0xacf92,_0x5790af,_0x2170ef,_0x5790af['Fields'],_0x5c84b4);})[_0xd566('0x25')](function(_0x70c4a8){_0x2a67ad=_0x70c4a8;logger['info']('['+_0x2170ef[_0xd566('0x7b')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x2a67ad['id']);logger['info']('['+_0x2170ef[_0xd566('0x7b')][_0xd566('0x7c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x178045[_0xd566('0x3e')]);})[_0xd566('0x72')](function(_0x47b1df){logger[_0xd566('0x7a')]('['+_0x2170ef[_0xd566('0x7b')][_0xd566('0x7c')]()+']',_0x47b1df);});}; \ No newline at end of file +var _0x4398=['trigger:browser:url','%s/%s/e','error','catch','outbound','stripTrailingSlash','recordingFormat','none','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhatId','Case','ContactId','account','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','length','Email','info','Agent\x20%s\x20found.','resolve','Name','display_name','identity','then','user_id','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','Company','upperFirst','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridnum','Fields','integrationTab','user:%s'];(function(_0x55c09c,_0x406cfe){var _0x35c8ed=function(_0x2d3612){while(--_0x2d3612){_0x55c09c['push'](_0x55c09c['shift']());}};_0x35c8ed(++_0x406cfe);}(_0x4398,0x8c));var _0x8439=function(_0x2100cf,_0x57982c){_0x2100cf=_0x2100cf-0x0;var _0x57417e=_0x4398[_0x2100cf];return _0x57417e;};'use strict';var _=require(_0x8439('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x8439('0x1'));var jsforce=require(_0x8439('0x2'));var util=require('util');var Redis=require(_0x8439('0x3'));var intUtil=require(_0x8439('0x4'));var config=require(_0x8439('0x5'));var logger=require('../../../../config/logger')(_0x8439('0x6'));config[_0x8439('0x7')]=_[_0x8439('0x8')](config[_0x8439('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8439('0x9'))(new Redis(config[_0x8439('0x7')]));function emit(_0x13d1c5,_0x4d3f30,_0x38114b){io['to'](_0x13d1c5)[_0x8439('0xa')](_0x4d3f30,_0x38114b);}function getTicket(_0x52a490,_0x34d53b,_0x396142,_0x491fa3,_0x3be3b3,_0x3eb588,_0x5bd216,_0x3691a2){var _0x16b681=Object[_0x8439('0xb')]({},{'OwnerId':_0x34d53b['id'],'Subject':intUtil[_0x8439('0xc')](_0x491fa3['Subjects'],_0x3be3b3,'\x20'),'Description':intUtil[_0x8439('0xc')](_0x491fa3[_0x8439('0xd')],_0x3be3b3,'\x0a')},getCustomFields(_0x3eb588,_0x3be3b3));if(_0x396142){if(_0x491fa3[_0x8439('0xe')]===_0x8439('0xf')){_0x16b681[_0x8439('0x10')]=moment[_0x8439('0x11')]();_0x16b681['IsReminderSet']=![];_0x16b681[_0x8439('0x12')]=![];if(_0x396142[_0x8439('0x13')]===_0x8439('0x14')||_0x396142[_0x8439('0x13')]===_0x8439('0x15')){_0x16b681['WhoId']=_0x396142['id'];}else if(_0x396142[_0x8439('0x13')]==='account'){_0x16b681[_0x8439('0x16')]=_0x396142['id'];}}else if(_0x491fa3[_0x8439('0xe')]===_0x8439('0x17')){if(_0x396142['endUserType']===_0x8439('0x14')){_0x16b681[_0x8439('0x18')]=_0x396142['id'];}else if(_0x396142['endUserType']===_0x8439('0x19')){_0x16b681['AccountId']=_0x396142['id'];}else if(_0x396142[_0x8439('0x13')]===_0x8439('0x15')&&_0x491fa3[_0x8439('0x1a')]){_0x16b681[_0x491fa3['leadId']]=_0x396142['id'];}else{logger['info'](_0x8439('0x1b'));}}}return _0x5bd216[_0x8439('0x1c')](_0x491fa3[_0x8439('0xe')])[_0x8439('0x1d')](_0x16b681);}function getUser(_0x44b666,_0x45fcf3,_0x5273a7){if(!_[_0x8439('0x1e')](_0x45fcf3)&&intUtil[_0x8439('0x1f')](_0x45fcf3)){var _0x5c87cb={'Email':_0x45fcf3};var _0x2545ec={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5273a7[_0x8439('0x1c')]('User')[_0x8439('0x20')](_0x5c87cb,_0x2545ec)[_0x8439('0x21')]()['then'](function(_0x27fe45){if(_0x27fe45[_0x8439('0x22')]){var _0x2b14ea=_[_0x8439('0x20')](_0x27fe45,function(_0x4e53a7){return _0x4e53a7[_0x8439('0x23')]===_0x45fcf3;});if(_0x2b14ea){logger[_0x8439('0x24')](_0x8439('0x25'),_0x45fcf3);return BPromise[_0x8439('0x26')]({'id':_0x2b14ea['Id'],'name':_0x2b14ea[_0x8439('0x27')]});}}else{logger[_0x8439('0x24')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x45fcf3);return _0x5273a7['identity']()['then'](function(_0x3e186f){return BPromise[_0x8439('0x26')]({'id':_0x3e186f['user_id'],'name':_0x3e186f[_0x8439('0x28')]});});}});}else{logger[_0x8439('0x24')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x45fcf3);return _0x5273a7[_0x8439('0x29')]()[_0x8439('0x2a')](function(_0x1d5f14){return BPromise[_0x8439('0x26')]({'id':_0x1d5f14[_0x8439('0x2b')],'name':_0x1d5f14['display_name']});});}}function getEndUser(_0x1ec7a2,_0x427050,_0x5a4a3a,_0x50ff4a,_0x46668d){var _0x28f028={'$or':{'Phone':_0x50ff4a}};var _0x3f5edf={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8439('0x26')]()[_0x8439('0x2a')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x50ff4a,_0x427050[_0x8439('0x2c')]);switch(_0x427050['moduleSearch']){case'contact_lead':var _0x54afc4=_[_0x8439('0x2d')](_0x28f028);if(_0x427050['additionalSearchContact']){var _0x6a76e7={};_0x6a76e7[_0x427050[_0x8439('0x2e')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x54afc4[_0x8439('0x30')],_0x6a76e7);}return _0x46668d['sobject'](_0x8439('0x31'))[_0x8439('0x20')](_0x54afc4,_0x3f5edf)[_0x8439('0x21')]()['then'](function(_0x24d2e1){if(_0x24d2e1&&_0x24d2e1[_0x8439('0x22')]){return _0x24d2e1;}else{var _0x14d9f3=_[_0x8439('0x2d')](_0x28f028);if(_0x427050[_0x8439('0x32')]){var _0x3b5dbb={};_0x3b5dbb[_0x427050[_0x8439('0x32')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x14d9f3[_0x8439('0x30')],_0x3b5dbb);}return _0x46668d[_0x8439('0x1c')](_0x8439('0x33'))[_0x8439('0x20')](_0x14d9f3,_0x3f5edf);}});case _0x8439('0x34'):var _0x1db432=_[_0x8439('0x2d')](_0x28f028);if(_0x427050[_0x8439('0x35')]){var _0x6a76e7={};_0x6a76e7[_0x427050[_0x8439('0x35')]]=_0x50ff4a;_['merge'](_0x1db432[_0x8439('0x30')],_0x6a76e7);}return _0x46668d[_0x8439('0x1c')]('Account')[_0x8439('0x20')](_0x1db432,_0x3f5edf)[_0x8439('0x21')]()[_0x8439('0x2a')](function(_0x243d23){if(_0x243d23&&_0x243d23[_0x8439('0x22')]){return _0x243d23;}else{var _0x3f43f4=_[_0x8439('0x2d')](_0x28f028);if(_0x427050[_0x8439('0x2e')]){var _0x49efe5={};_0x49efe5[_0x427050[_0x8439('0x2e')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x3f43f4['$or'],_0x49efe5);}return _0x46668d[_0x8439('0x1c')](_0x8439('0x31'))['find'](_0x3f43f4,_0x3f5edf)[_0x8439('0x2a')](function(_0x8ce40d){if(_0x8ce40d&&_0x8ce40d['length']){return _0x8ce40d;}else{var _0xc6d8cc=_[_0x8439('0x2d')](_0x28f028);if(_0x427050[_0x8439('0x32')]){var _0xe8be2d={};_0xe8be2d[_0x427050[_0x8439('0x32')]]=_0x50ff4a;_[_0x8439('0x2f')](_0xc6d8cc['$or'],_0xe8be2d);}return _0x46668d['sobject'](_0x8439('0x33'))[_0x8439('0x20')](_0xc6d8cc,_0x3f5edf);}});}});case _0x8439('0x14'):var _0x54afc4=_['cloneDeep'](_0x28f028);if(_0x427050[_0x8439('0x2e')]){var _0x6a76e7={};_0x6a76e7[_0x427050[_0x8439('0x2e')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x54afc4[_0x8439('0x30')],_0x6a76e7);}return _0x46668d[_0x8439('0x1c')]('Contact')['find'](_0x54afc4,_0x3f5edf)[_0x8439('0x21')]();case _0x8439('0x15'):var _0x42cef3=_[_0x8439('0x2d')](_0x28f028);if(_0x427050['additionalSearchLead']){var _0x6a76e7={};_0x6a76e7[_0x427050[_0x8439('0x32')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x42cef3[_0x8439('0x30')],_0x6a76e7);}return _0x46668d[_0x8439('0x1c')](_0x8439('0x33'))[_0x8439('0x20')](_0x42cef3,_0x3f5edf);case _0x8439('0x19'):var _0x1db432=_['cloneDeep'](_0x28f028);if(_0x427050[_0x8439('0x35')]){var _0x6a76e7={};_0x6a76e7[_0x427050[_0x8439('0x35')]]=_0x50ff4a;_[_0x8439('0x2f')](_0x1db432['$or'],_0x6a76e7);}return _0x46668d[_0x8439('0x1c')](_0x8439('0x36'))[_0x8439('0x20')](_0x1db432,_0x3f5edf);default:return null;}})[_0x8439('0x2a')](function(_0x4d07e7){if(_0x4d07e7&&_0x4d07e7['length']){var _0xaa6ce4=_[_0x8439('0x37')](_0x4d07e7);if(_0xaa6ce4){return BPromise[_0x8439('0x26')]({'id':_0xaa6ce4['Id'],'name':_0xaa6ce4['Name'],'phone':_0xaa6ce4['Phone'],'endUserType':_0xaa6ce4[_0x8439('0x38')][_0x8439('0x39')][_0x8439('0x3a')]()});}}})[_0x8439('0x2a')](function(_0x177077){if(_0x177077){logger['info'](_0x8439('0x3b'),_0x177077[_0x8439('0x13')],_0x50ff4a);return BPromise[_0x8439('0x26')](_0x177077);}else{logger['info'](_0x8439('0x3c'),_0x50ff4a);var _0x3b2b48={'Phone':_0x50ff4a};if(_0x427050[_0x8439('0x3d')]){if(_0x427050[_0x8439('0x3d')]===_0x8439('0x14')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x50ff4a,_0x427050[_0x8439('0x3d')]);_0x3b2b48[_0x8439('0x3e')]=_0x5a4a3a!==_0x8439('0x3f')?_0x5a4a3a:util[_0x8439('0x40')]('Caller\x20-\x20%s',_0x50ff4a);}else if(_0x427050[_0x8439('0x3d')]==='lead'){logger[_0x8439('0x24')](_0x8439('0x41'),_0x50ff4a,_0x427050[_0x8439('0x3d')]);_0x3b2b48[_0x8439('0x3e')]=_0x5a4a3a!==_0x8439('0x3f')?_0x5a4a3a:util['format'](_0x8439('0x42'),_0x50ff4a);_0x3b2b48[_0x8439('0x43')]='No\x20Company';}else if(_0x427050[_0x8439('0x3d')]==='account'){logger['info'](_0x8439('0x41'),_0x50ff4a,_0x427050[_0x8439('0x3d')]);_0x3b2b48[_0x8439('0x27')]=_0x5a4a3a!==_0x8439('0x3f')?_0x5a4a3a:util[_0x8439('0x40')]('Caller\x20-\x20%s',_0x50ff4a);}else{return null;}}return _0x46668d[_0x8439('0x1c')](_[_0x8439('0x44')](_0x427050['moduleCreate']))[_0x8439('0x1d')](_0x3b2b48)['then'](function(_0x1f5d33){return BPromise[_0x8439('0x26')]({'id':_0x1f5d33['id'],'endUserType':_0x427050[_0x8439('0x3d')]});});}});}function getCustomFields(_0x1da383,_0xa6c418){var _0x50e95c={};if(_0x1da383[_0x8439('0x22')]>0x0){_['forEach'](_0x1da383,function(_0x5642f6){if(_[_0x8439('0x45')]([_0x8439('0x46'),'picklist'],_0x5642f6['type'])&&_0x5642f6['idField']){_0x50e95c[_0x5642f6[_0x8439('0x47')]]=_0x5642f6[_0x8439('0x48')][_0x8439('0x49')]();}else if(_0x5642f6['type']===_0x8439('0x4a')&&_0x5642f6[_0x8439('0x4b')]&&_0x5642f6[_0x8439('0x47')]){_0xa6c418[_0x5642f6[_0x8439('0x4b')]]&&(_0x50e95c[_0x5642f6['idField']]=_0xa6c418[_0x5642f6[_0x8439('0x4b')]][_0x8439('0x49')]());}else if(_0x5642f6[_0x8439('0x39')]===_0x8439('0x4c')&&_0x5642f6[_0x8439('0x4d')]&&_0x5642f6[_0x8439('0x4d')][_0x8439('0x4e')]&&_0x5642f6['idField']){_0xa6c418[_0x5642f6[_0x8439('0x4d')][_0x8439('0x4e')]['toLowerCase']()]&&(_0x50e95c[_0x5642f6['idField']]=_0xa6c418[_0x5642f6['Variable'][_0x8439('0x4e')][_0x8439('0x3a')]()]['toString']());}});}return _0x50e95c;}function getConnection(_0x1d213d){var _0x431140=_0x1d213d['password'][_0x8439('0x4f')](_0x1d213d[_0x8439('0x50')]);var _0x174e64=new jsforce[(_0x8439('0x51'))]({'oauth2':{'loginUrl':_0x1d213d[_0x8439('0x52')]||_0x8439('0x53'),'clientId':_0x1d213d[_0x8439('0x54')],'clientSecret':_0x1d213d[_0x8439('0x55')]}});return _0x174e64['login'](_0x1d213d[_0x8439('0x56')],_0x431140)[_0x8439('0x2a')](function(){logger['info'](_0x8439('0x57'));return _0x174e64;});}exports[_0x8439('0x58')]=function(_0x122be7,_0x2cefe9,_0x7646d0,_0x30922d,_0x34e6b5,_0x49a073){var _0x5da117,_0x41c7db,_0x3bd931,_0xd2b23f;_0x49a073['serverUrl']=intUtil['stripTrailingSlash'](_0x49a073['serverUrl']);_0x49a073[_0x8439('0x52')]=intUtil['stripTrailingSlash'](_0x49a073['remoteUri']);if(_0x34e6b5&&_0x34e6b5[_0x8439('0x59')]){logger[_0x8439('0x24')](_0x8439('0x5a'),_0x8439('0x5b'));_0x2cefe9[_0x8439('0x5c')]=util['format'](_0x8439('0x5d'),_0x49a073[_0x8439('0x5e')],_0x2cefe9[_0x8439('0x5f')],md5(_0x2cefe9[_0x8439('0x5f')]));}else{_0x2cefe9[_0x8439('0x5c')]='';}return getConnection(_0x49a073)['then'](function(_0x470c8d){_0xd2b23f=_0x470c8d;return getUser(_0x49a073,_0x30922d['email'],_0xd2b23f);})[_0x8439('0x2a')](function(_0x27df13){_0x5da117=_0x27df13;return getEndUser(_0x49a073,_0x7646d0,_0x2cefe9['calleridname'],_0x2cefe9[_0x8439('0x60')],_0xd2b23f);})['then'](function(_0x1266f0){_0x41c7db=_0x1266f0;return getTicket(_0x49a073,_0x5da117,_0x41c7db,_0x7646d0,_0x2cefe9,_0x7646d0[_0x8439('0x61')],_0xd2b23f,_0x8439('0x58'));})[_0x8439('0x2a')](function(_0x34f456){_0x3bd931=_0x34f456;logger[_0x8439('0x24')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3bd931['id']);logger[_0x8439('0x24')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3bd931['id'],_0x30922d[_0x8439('0x4e')],_0x49a073['type']);switch(_0x49a073[_0x8439('0x39')]){case _0x8439('0x62'):emit(util[_0x8439('0x40')](_0x8439('0x63'),_0x30922d[_0x8439('0x4e')]),'trigger:salesforce:display',{'recordId':_0x3bd931['id']});break;case'newTab':emit(util['format'](_0x8439('0x63'),_0x30922d[_0x8439('0x4e')]),_0x8439('0x64'),{'uri':util[_0x8439('0x40')](_0x8439('0x65'),_0xd2b23f['instanceUrl'],_0x3bd931['id'])});break;default:logger[_0x8439('0x66')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8439('0x67')](function(_0x178ad2){logger[_0x8439('0x66')](_0x8439('0x5a'),_0x178ad2);});};exports[_0x8439('0x68')]=function(_0x351794,_0x25720d,_0x5184ff,_0x1124bf,_0x7dd83e,_0x217c27,_0x263299){var _0x3bd186,_0x461860,_0x1cbb82,_0x3f964f;_0x217c27[_0x8439('0x5e')]=intUtil[_0x8439('0x69')](_0x217c27[_0x8439('0x5e')]);_0x217c27['remoteUri']=intUtil[_0x8439('0x69')](_0x217c27[_0x8439('0x52')]);if(_0x263299&&_0x263299[_0x8439('0x6a')]&&_0x263299['recordingFormat']!==_0x8439('0x6b')){logger['info']('[OUTBOUND]',_0x8439('0x5b'));_0x25720d[_0x8439('0x5c')]=util[_0x8439('0x40')](_0x8439('0x5d'),_0x217c27[_0x8439('0x5e')],_0x25720d[_0x8439('0x5f')],md5(_0x25720d['uniqueid']));}return getConnection(_0x217c27)[_0x8439('0x2a')](function(_0x43e828){_0x3f964f=_0x43e828;return getUser(_0x217c27,_0x1124bf[_0x8439('0x6c')],_0x3f964f);})[_0x8439('0x2a')](function(_0xde619b){_0x3bd186=_0xde619b;return getEndUser(_0x217c27,_0x5184ff,_0x25720d[_0x8439('0x6d')],_0x25720d['destcalleridnum'],_0x3f964f);})[_0x8439('0x2a')](function(_0x4448d9){_0x461860=_0x4448d9;return getTicket(_0x217c27,_0x3bd186,_0x461860,_0x5184ff,_0x25720d,_0x5184ff[_0x8439('0x61')],_0x3f964f,'outbound');})[_0x8439('0x2a')](function(_0xa70e6e){_0x1cbb82=_0xa70e6e;logger['info'](_0x8439('0x6e'),_0x1cbb82['id']);logger[_0x8439('0x24')](_0x8439('0x6f'),_0x1cbb82['id'],_0x1124bf[_0x8439('0x4e')],_0x217c27[_0x8439('0x39')]);switch(_0x217c27['type']){case'integrationTab':emit(util[_0x8439('0x40')](_0x8439('0x63'),_0x1124bf[_0x8439('0x4e')]),'trigger:salesforce:display',{'recordId':_0x1cbb82['id']});break;case _0x8439('0x70'):emit(util['format']('user:%s',_0x1124bf[_0x8439('0x4e')]),'trigger:browser:url',{'uri':util['format'](_0x8439('0x65'),_0x3f964f[_0x8439('0x71')],_0x1cbb82['id'])});break;default:logger[_0x8439('0x66')](_0x8439('0x72'),_0x8439('0x73'));}})['catch'](function(_0x5d4147){logger[_0x8439('0x66')](_0x8439('0x72'),_0x5d4147);});};exports['unmanaged']=function(_0x149da1,_0x5dddd4,_0x1c6d86,_0x2a03ae,_0x434427,_0x182870){var _0x27fb6e,_0x5c5b53,_0x48241b,_0x46ec9f;_0x182870[_0x8439('0x5e')]=intUtil[_0x8439('0x69')](_0x182870['serverUrl']);_0x182870[_0x8439('0x52')]=intUtil[_0x8439('0x69')](_0x182870[_0x8439('0x52')]);if(_0x434427&&_0x434427[_0x8439('0x59')]){logger['info']('['+_0x5dddd4[_0x8439('0x74')]['toUpperCase']()+']',_0x8439('0x5b'));_0x5dddd4[_0x8439('0x5c')]=util[_0x8439('0x40')](_0x8439('0x5d'),_0x182870[_0x8439('0x5e')],_0x5dddd4['uniqueid'],md5(_0x5dddd4[_0x8439('0x5f')]));}else{_0x5dddd4[_0x8439('0x5c')]='';}return getConnection(_0x182870)['then'](function(_0x25c347){_0x46ec9f=_0x25c347;if(!_[_0x8439('0x1e')](_0x2a03ae)){return getUser(_0x182870,_0x2a03ae[_0x8439('0x4e')],_0x46ec9f);}else{return getUser(_0x182870,null,_0x46ec9f);}})[_0x8439('0x2a')](function(_0x270032){_0x27fb6e=_0x270032;return getEndUser(_0x182870,_0x1c6d86,_0x5dddd4[_0x8439('0x75')],_0x5dddd4['calleridnum'],_0x46ec9f);})[_0x8439('0x2a')](function(_0x5bd788){_0x5c5b53=_0x5bd788;return getTicket(_0x182870,_0x27fb6e,_0x5c5b53,_0x1c6d86,_0x5dddd4,_0x1c6d86['Fields'],_0x46ec9f);})[_0x8439('0x2a')](function(_0x201d8b){_0x48241b=_0x201d8b;logger[_0x8439('0x24')]('['+_0x5dddd4[_0x8439('0x74')][_0x8439('0x76')]()+_0x8439('0x77'),_0x48241b['id']);logger[_0x8439('0x24')]('['+_0x5dddd4[_0x8439('0x74')][_0x8439('0x76')]()+']\x20Integration\x20account\x20type\x20%s.',_0x182870['type']);})[_0x8439('0x67')](function(_0x48518f){logger[_0x8439('0x66')]('['+_0x5dddd4[_0x8439('0x74')]['toUpperCase']()+']',_0x48518f);});}; \ 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 ecd3cb8..a2de169 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 _0xe168=['push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','ticketId','unmanaged','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','forEach'];(function(_0x509cb5,_0x2a4dc9){var _0x4b8b92=function(_0xef2368){while(--_0xef2368){_0x509cb5['push'](_0x509cb5['shift']());}};_0x4b8b92(++_0x2a4dc9);}(_0xe168,0x159));var _0x8e16=function(_0x828e3e,_0x1c23c2){_0x828e3e=_0x828e3e-0x0;var _0x5da2a7=_0xe168[_0x828e3e];return _0x5da2a7;};'use strict';var _=require(_0x8e16('0x0'));var Promise=require(_0x8e16('0x1'));var rp=require(_0x8e16('0x2'));var util=require(_0x8e16('0x3'));var md5=require(_0x8e16('0x4'));var Redis=require(_0x8e16('0x5'));var intUtil=require(_0x8e16('0x6'));var config=require(_0x8e16('0x7'));var logger=require(_0x8e16('0x8'))(_0x8e16('0x9'));config[_0x8e16('0xa')]=_[_0x8e16('0xb')](config[_0x8e16('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x8e16('0xc'))(new Redis(config[_0x8e16('0xa')]));function getAdminUser(_0xbab5e4,_0xb901dc,_0x55a870,_0x32842f,_0x47fa70,_0x57d5c9){return new Promise(function(_0x3229da,_0x5199dc){var _0x456d16={'method':_0x8e16('0xd'),'uri':_0x32842f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x47fa70+'&'+_0x57d5c9,'auth':_0xb901dc,'json':!![]};return rp(_0x456d16)[_0x8e16('0xe')](function(_0x50e621){if(_0x50e621['result'][_0x8e16('0xf')]>0x0){_0x55a870['adminId']=_0x50e621[_0x8e16('0x10')][0x0][_0x8e16('0x11')];}logger[_0x8e16('0x12')]('['+[_0xbab5e4[_0x8e16('0x13')]()]+_0x8e16('0x14'),_0x55a870);_0x3229da(_0x55a870);})[_0x8e16('0x15')](function(_0x176c08){logger[_0x8e16('0x16')]('['+[_0xbab5e4[_0x8e16('0x13')]()]+']',_0x176c08[_0x8e16('0x17')]);_0x5199dc(_0x176c08[_0x8e16('0x17')]);});});}function getUser(_0x4e07c8,_0x49f089,_0x2e4548,_0x37670f,_0x50f836){return function(_0x183356){logger['info']('['+[_0x4e07c8['toUpperCase']()]+_0x8e16('0x18'),_0x183356);return new Promise(function(_0x1b12ec,_0x4ef0a6){if(intUtil[_0x8e16('0x19')](_0x183356[_0x8e16('0x1a')])){var _0x234ad5={'method':_0x8e16('0xd'),'uri':_0x2e4548+_0x8e16('0x1b')+_0x183356[_0x8e16('0x1a')]+'&'+_0x37670f+'&'+_0x50f836,'auth':_0x49f089,'json':!![]};logger['info']('['+[_0x4e07c8['toUpperCase']()]+_0x8e16('0x1c'),_0x234ad5);return rp(_0x234ad5)[_0x8e16('0xe')](function(_0x25e3de){logger[_0x8e16('0x12')]('['+[_0x4e07c8['toUpperCase']()]+'],\x20getUser\x20entity',_0x25e3de);if(_0x25e3de[_0x8e16('0x10')][_0x8e16('0xf')]>0x0&&String(_0x25e3de[_0x8e16('0x10')][0x0][_0x8e16('0x1d')])==='true'){_0x183356[_0x8e16('0x1e')]=_0x25e3de[_0x8e16('0x10')][0x0]['sys_id'];}else{_0x183356[_0x8e16('0x1e')]=_0x183356[_0x8e16('0x1f')];_0x183356[_0x8e16('0x1a')]=_0x183356[_0x8e16('0x20')];}logger[_0x8e16('0x12')]('['+[_0x4e07c8[_0x8e16('0x13')]()]+_0x8e16('0x21'),_0x183356);_0x1b12ec(_0x183356);})[_0x8e16('0x15')](function(_0x4f7ab6){logger['error']('['+[_0x4e07c8[_0x8e16('0x13')]()]+']',_0x4f7ab6['message']);_0x4ef0a6(_0x4f7ab6[_0x8e16('0x17')]);});}else{logger[_0x8e16('0x12')]('['+[_0x4e07c8[_0x8e16('0x13')]()]+']\x20using\x20admin\x20profile');_0x183356[_0x8e16('0x1e')]=_0x183356['adminId'];_0x183356[_0x8e16('0x1a')]=_0x183356[_0x8e16('0x20')];_0x1b12ec(_0x183356);}});};}function createEndUser(_0x213b7e,_0x51f7ca,_0x3486e6,_0x6e9859,_0x4192d1){logger['info']('['+[_0x213b7e[_0x8e16('0x13')]()]+_0x8e16('0x22'),_0x3486e6);return new Promise(function(_0x50b14b,_0xb65572){var _0x123ef6={'method':_0x8e16('0x23'),'uri':_0x6e9859+_0x8e16('0x24')+_0x4192d1,'body':{'user_name':_0x3486e6[_0x8e16('0x25')],'roles':'user','first_name':_0x3486e6[_0x8e16('0x25')],'active':_0x8e16('0x26'),'date_format':'System','phone':_0x3486e6[_0x8e16('0x25')]},'auth':_0x51f7ca,'json':!![]};return rp(_0x123ef6)[_0x8e16('0xe')](function(_0xf21545){logger['info']('['+[_0x213b7e[_0x8e16('0x13')]()]+_0x8e16('0x27'),_0xf21545['result']);_0x3486e6[_0x8e16('0x28')]=_0xf21545[_0x8e16('0x10')][_0x8e16('0x11')];_0x50b14b(_0x3486e6);})[_0x8e16('0x15')](function(_0x11270b){logger[_0x8e16('0x16')]('['+[_0x213b7e[_0x8e16('0x13')]()]+']',_0x11270b[_0x8e16('0x17')]);_0xb65572(_0x11270b['message']);});});}function getEndUser(_0x15271c,_0x593844,_0x285bf7,_0xeb663c,_0x261c35){return function(_0x51e2c7){logger[_0x8e16('0x12')]('['+[_0x15271c['toUpperCase']()]+_0x8e16('0x29'),_0x51e2c7);return new Promise(function(_0x23b00d,_0x2f8557){var _0x3e54b7={'method':'GET','uri':_0x285bf7+_0x8e16('0x2a')+_0x51e2c7['endUserNumber']+'&'+_0xeb663c+'&'+_0x261c35,'auth':_0x593844,'json':!![]};return rp(_0x3e54b7)['then'](function(_0x24e280){if(_0x24e280[_0x8e16('0x10')]['length']>0x0){_0x51e2c7[_0x8e16('0x28')]=_0x24e280['result'][0x0][_0x8e16('0x11')];logger[_0x8e16('0x12')]('['+[_0x15271c[_0x8e16('0x13')]()]+_0x8e16('0x2b'),_0x51e2c7);_0x23b00d(_0x51e2c7);}else{return createEndUser(_0x15271c,_0x593844,_0x51e2c7,_0x285bf7,_0xeb663c)[_0x8e16('0xe')](function(_0x377ed4){logger[_0x8e16('0x12')]('['+[_0x15271c[_0x8e16('0x13')]()]+'],\x20createEndUser\x20crm',_0x377ed4);_0x23b00d(_0x377ed4);});}})[_0x8e16('0x15')](function(_0x26516b){logger[_0x8e16('0x16')]('['+[_0x15271c[_0x8e16('0x13')]()]+']',_0x26516b[_0x8e16('0x17')]);_0x2f8557(_0x26516b['message']);});});};}function getCustomFields(_0x34135f,_0x447b6e){var _0x35eb50={};if(_0x34135f[_0x8e16('0xf')]>0x0){_['forEach'](_0x34135f,function(_0x39645b){if(_[_0x8e16('0x2c')](['string',_0x8e16('0x2d')],_0x39645b[_0x8e16('0x2e')])&&_0x39645b[_0x8e16('0x2f')]&&!_0x39645b[_0x8e16('0x30')]){_0x35eb50[_0x39645b['nameField'][_0x8e16('0x31')]()]=_0x39645b[_0x8e16('0x32')][_0x8e16('0x33')]();}else if(_[_0x8e16('0x2c')]([_0x8e16('0x34'),_0x8e16('0x2d')],_0x39645b[_0x8e16('0x2e')])&&_0x39645b[_0x8e16('0x35')]&&_0x39645b[_0x8e16('0x30')]){_0x35eb50[_0x39645b[_0x8e16('0x35')][_0x8e16('0x31')]()]=_0x39645b[_0x8e16('0x32')][_0x8e16('0x33')]();}else if(_0x39645b[_0x8e16('0x2e')]===_0x8e16('0x36')&&_0x39645b[_0x8e16('0x37')]&&_0x39645b[_0x8e16('0x35')]&&_0x39645b[_0x8e16('0x30')]){_0x35eb50[_0x39645b[_0x8e16('0x35')]['toLowerCase']()]=_0x447b6e[_0x39645b[_0x8e16('0x37')]]['toString']();}else if(_0x39645b[_0x8e16('0x2e')]===_0x8e16('0x38')&&_0x39645b[_0x8e16('0x39')]&&_0x39645b[_0x8e16('0x39')][_0x8e16('0x3a')]&&_0x39645b[_0x8e16('0x35')]&&_0x39645b['customField']){_0x35eb50[_0x39645b['idField']['toLowerCase']()]=_0x447b6e[_0x39645b[_0x8e16('0x39')][_0x8e16('0x3a')][_0x8e16('0x31')]()][_0x8e16('0x33')]();}});}return _0x35eb50;}function getTicket(_0x111638,_0x2b4753,_0x2f3f57,_0x477a29,_0x1279ba,_0x18cbf4){return function(_0x6fdadb){logger[_0x8e16('0x12')]('['+[_0x111638[_0x8e16('0x13')]()]+_0x8e16('0x3b'),_0x6fdadb);return new Promise(function(_0x4d41d5,_0x2c5889){var _0x3790b1=_0x111638[_0x8e16('0x31')]()===_0x8e16('0x3c')?_0x6fdadb[_0x8e16('0x1e')]:_0x6fdadb[_0x8e16('0x28')];var _0x4be6d4={'method':_0x8e16('0x23'),'uri':_0x2f3f57+_0x8e16('0x3d')+'?'+_0x18cbf4,'body':Object[_0x8e16('0x3e')]({},{'active':_0x8e16('0x26'),'caller_id':_0x3790b1,'assigned_to':_0x6fdadb[_0x8e16('0x1e')],'short_description':intUtil[_0x8e16('0x3f')](_0x477a29['Subjects'],_0x1279ba,'\x20'),'description':intUtil[_0x8e16('0x3f')](_0x477a29[_0x8e16('0x40')],_0x1279ba,'\x0a')},getCustomFields(_0x477a29[_0x8e16('0x41')],_0x1279ba)),'auth':_0x2b4753,'json':!![]};return rp(_0x4be6d4)[_0x8e16('0xe')](function(_0x477aa2){logger['info']('['+[_0x111638[_0x8e16('0x13')]()]+_0x8e16('0x42'),_0x477aa2['result']);_0x6fdadb['ticketId']=_0x477aa2[_0x8e16('0x10')][_0x8e16('0x11')];_0x6fdadb[_0x8e16('0x43')]=_0x477aa2['result'][_0x8e16('0x44')];logger['info']('['+[_0x111638[_0x8e16('0x13')]()]+_0x8e16('0x45'),_0x6fdadb);_0x4d41d5(_0x6fdadb);})[_0x8e16('0x15')](function(_0x28d4ba){logger['error']('['+[_0x111638[_0x8e16('0x13')]()]+']',_0x28d4ba[_0x8e16('0x17')]);_0x2c5889(_0x28d4ba[_0x8e16('0x17')]);});});};}function createRemoteTag(_0xabc118,_0x3ba5ea,_0x58a2f3,_0x20d7b5){return new Promise(function(_0x3c6bc5,_0xc8567){var _0x53995a={'method':_0x8e16('0x23'),'uri':_0x58a2f3+_0x8e16('0x46')+'?'+_0x20d7b5,'body':{'short_description':_0xabc118,'global':!![],'active':!![],'name':_0xabc118},'auth':_0x3ba5ea,'json':!![]};return rp(_0x53995a)[_0x8e16('0xe')](function(_0x1e0113){var _0x2bca6e=_0x1e0113[_0x8e16('0x10')][_0x8e16('0x11')];_0x3c6bc5(_0x2bca6e);});});}function getRemoteTag(_0x1460b9,_0x27bf02,_0x3fd0a6,_0x152ec1,_0x141028){return new Promise(function(_0x510d30,_0x4c9c17){var _0x5a900d={'method':_0x8e16('0xd'),'uri':_0x3fd0a6+_0x8e16('0x46')+'?sysparm_query=name%3D'+_0x1460b9+'&'+_0x152ec1,'auth':_0x27bf02,'json':!![]};return rp(_0x5a900d)[_0x8e16('0xe')](function(_0x55b211){if(_0x55b211[_0x8e16('0x10')][_0x8e16('0xf')]>0x0){var _0x133261=_0x55b211[_0x8e16('0x10')][0x0]['sys_id'];_0x510d30(_0x133261);}else{return createRemoteTag(_0x1460b9,_0x27bf02,_0x3fd0a6,_0x152ec1)[_0x8e16('0xe')](function(_0x1ca6b4){_0x510d30(_0x1ca6b4);});}});});}function assignTagToIncident(_0xc0ccca,_0x3cdfee,_0x1cf57c,_0x249dc1,_0x54584c){return new Promise(function(_0x436a68,_0x3a3761){var _0x8c8c8e={'method':_0x8e16('0x23'),'uri':_0x1cf57c+_0x8e16('0x47')+'?'+_0x54584c,'body':{'label':_0xc0ccca,'table':'incident','id_type':_0x8e16('0x48'),'table_key':_0x249dc1['ticketId'],'title':_0x8e16('0x49')+_0x249dc1[_0x8e16('0x43')],'id_display':_0x249dc1[_0x8e16('0x43')]},'auth':_0x3cdfee,'json':!![]};return rp(_0x8c8c8e)[_0x8e16('0xe')](function(_0x4523f6){_0x436a68();})[_0x8e16('0x15')](function(){_0x436a68();});});}function manageTags(_0x196fd1,_0x597edf,_0x34c13d,_0x3d9608,_0x230474,_0x17a776,_0x1fa314){return new Promise(function(_0x166e64,_0x5582df){var _0x4d5a3c=[];_0x597edf[_0x8e16('0x4a')](function(_0x512768){_0x4d5a3c[_0x8e16('0x4b')](getRemoteTag(_0x512768,_0x34c13d,_0x3d9608,_0x17a776,_0x1fa314));});return Promise[_0x8e16('0x4c')](_0x4d5a3c)[_0x8e16('0xe')](function(_0x382034){if(_0x382034['length']){logger[_0x8e16('0x12')]('['+[_0x196fd1[_0x8e16('0x13')]()]+_0x8e16('0x4d'),_0x382034);var _0x58714d=[];_0x382034[_0x8e16('0x4a')](function(_0x3f846f){_0x58714d[_0x8e16('0x4b')](assignTagToIncident(_0x3f846f,_0x34c13d,_0x3d9608,_0x230474,_0x17a776));});return Promise[_0x8e16('0x4c')](_0x58714d)[_0x8e16('0xe')](function(){_0x166e64();})[_0x8e16('0x15')](function(){_0x166e64();});}else{_0x166e64();}});});}function getTags(_0x5df123,_0x170532,_0xfbed53,_0xb265ae,_0x261f7f,_0x800074){return function(_0x1bddb9){return new Promise(function(_0x512b39,_0x24421f){var _0x2ddbf1=[];var _0x1ae926=_0xb265ae[_0x8e16('0x4e')];if(_0x1ae926&&_0x1ae926[_0x8e16('0xf')]>0x0){_0x2ddbf1=_['map'](_0x1ae926,'name');}if(_0x2ddbf1[_0x8e16('0xf')]>0x0){return manageTags(_0x5df123,_0x2ddbf1,_0x170532,_0xfbed53,_0x1bddb9,_0x261f7f,_0x800074)[_0x8e16('0xe')](function(){_0x512b39(_0x1bddb9);});}else{_0x512b39(_0x1bddb9);}});};}function emit(_0x2bf91d,_0x24f24f,_0x129b22){var _0x553289=_0x8e16('0x4f')+_0x8e16('0x50')+_0x8e16('0x51')+_0x8e16('0x52');var _0x4d6423={'uri':_0x2bf91d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x129b22+_0x553289};io['to'](util[_0x8e16('0x53')]('user:%s',_0x24f24f))['emit'](_0x8e16('0x54'),_0x4d6423);}exports['cs']=function(_0x4a963c,_0xa94618,_0x6c9522,_0x19b85a,_0x3b8707,_0x41cfe1,_0xb77926,_0x149fb4){var _0x4ab8fb={};var _0x3be06c={'user':_0x41cfe1['username'],'pass':_0x41cfe1[_0x8e16('0x55')]};var _0x27ed9c=_0x8e16('0x56');var _0x100df1=_0x8e16('0x57');_0x41cfe1[_0x8e16('0x58')]=intUtil[_0x8e16('0x59')](_0x41cfe1[_0x8e16('0x58')]);_0x41cfe1['serverUrl']=intUtil[_0x8e16('0x59')](_0x41cfe1[_0x8e16('0x5a')]);var _0x4ec1a3=util[_0x8e16('0x53')](_0x8e16('0x5b'),_0x41cfe1[_0x8e16('0x58')]);_0x4ab8fb[_0x8e16('0x1a')]=!_[_0x8e16('0x5c')](_0x19b85a)?_0x19b85a[_0x8e16('0x5d')]:null;_0x4ab8fb[_0x8e16('0x20')]=_0x41cfe1[_0x8e16('0x5d')];_0x4ab8fb['endUserNumber']=_0x149fb4[_0x8e16('0x31')]()===_0x8e16('0x3c')?_0xa94618[_0x8e16('0x5e')]:_0xa94618[_0x8e16('0x5f')];_0x4ab8fb[_0x8e16('0x60')]=_0x149fb4===_0x8e16('0x61')||_0x149fb4==='unmanaged'?_0x8e16('0x61'):_0x8e16('0x3c');var _0xc4c458=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41cfe1[_0x8e16('0x5a')],_0xa94618[_0x8e16('0x62')],md5(_0xa94618[_0x8e16('0x62')]));if(_0x3b8707&&_0x3b8707['monitor_format']){logger[_0x8e16('0x12')]('[QUEUE]',_0x8e16('0x63'));_0xa94618[_0x8e16('0x64')]=_0xc4c458;}else if(_0xb77926&&_0xb77926[_0x8e16('0x65')]&&_0xb77926[_0x8e16('0x65')]!=='none'){logger[_0x8e16('0x12')](_0x8e16('0x66'),_0x8e16('0x63'));_0xa94618[_0x8e16('0x64')]=_0xc4c458;}else{_0xa94618[_0x8e16('0x64')]='';}return getAdminUser(_0x149fb4,_0x3be06c,_0x4ab8fb,_0x4ec1a3,_0x100df1,_0x27ed9c)[_0x8e16('0xe')](getUser(_0x149fb4,_0x3be06c,_0x4ec1a3,_0x100df1,_0x27ed9c))[_0x8e16('0xe')](getEndUser(_0x149fb4,_0x3be06c,_0x4ec1a3,_0x100df1,_0x27ed9c))[_0x8e16('0xe')](getTicket(_0x149fb4,_0x3be06c,_0x4ec1a3,_0x6c9522,_0xa94618,_0x100df1))[_0x8e16('0xe')](function(_0x48b908){logger[_0x8e16('0x12')](util[_0x8e16('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x48b908[_0x8e16('0x67')]));logger[_0x8e16('0x12')](util[_0x8e16('0x53')]('call\x20direction:\x20%s',_0x149fb4));if(_0x149fb4!==_0x8e16('0x68')){logger['info']('['+[_0x149fb4[_0x8e16('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x41cfe1[_0x8e16('0x58')],_0x19b85a[_0x8e16('0x3a')],_0x48b908['ticketId']);}})[_0x8e16('0x15')](function(_0x3e5170){logger['error']('['+[_0x149fb4[_0x8e16('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x3e5170,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x53e0=['?sysparm_query=name%3D','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','string','picklist','type','nameField','toLowerCase','content','includes','idField','customField','variable','variableName','toString','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','label'];(function(_0x56fc1a,_0x2a9c44){var _0x4e8a29=function(_0x1d58c9){while(--_0x1d58c9){_0x56fc1a['push'](_0x56fc1a['shift']());}};_0x4e8a29(++_0x2a9c44);}(_0x53e0,0x169));var _0x053e=function(_0x30b547,_0x5b89e9){_0x30b547=_0x30b547-0x0;var _0xab9618=_0x53e0[_0x30b547];return _0xab9618;};'use strict';var _=require(_0x053e('0x0'));var Promise=require('bluebird');var rp=require(_0x053e('0x1'));var util=require(_0x053e('0x2'));var md5=require(_0x053e('0x3'));var Redis=require('ioredis');var intUtil=require(_0x053e('0x4'));var config=require(_0x053e('0x5'));var logger=require(_0x053e('0x6'))(_0x053e('0x7'));config[_0x053e('0x8')]=_[_0x053e('0x9')](config[_0x053e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x053e('0xa'))(new Redis(config[_0x053e('0x8')]));function getAdminUser(_0x341200,_0x48229a,_0x3bc176,_0x4e56b6,_0x563340,_0x561661){return new Promise(function(_0x14cf93,_0x10a6b2){var _0x57b2d5={'method':_0x053e('0xb'),'uri':_0x4e56b6+_0x053e('0xc')+'&'+_0x563340+'&'+_0x561661,'auth':_0x48229a,'json':!![]};return rp(_0x57b2d5)[_0x053e('0xd')](function(_0x3479b4){if(_0x3479b4['result'][_0x053e('0xe')]>0x0){_0x3bc176[_0x053e('0xf')]=_0x3479b4[_0x053e('0x10')][0x0][_0x053e('0x11')];}logger[_0x053e('0x12')]('['+[_0x341200[_0x053e('0x13')]()]+'],\x20getAdminUser\x20crm',_0x3bc176);_0x14cf93(_0x3bc176);})[_0x053e('0x14')](function(_0xbdf61c){logger[_0x053e('0x15')]('['+[_0x341200[_0x053e('0x13')]()]+']',_0xbdf61c[_0x053e('0x16')]);_0x10a6b2(_0xbdf61c[_0x053e('0x16')]);});});}function getUser(_0x10cd13,_0x5b946f,_0x3c9651,_0x22d720,_0x571469){return function(_0xd7b32a){logger[_0x053e('0x12')]('['+[_0x10cd13['toUpperCase']()]+_0x053e('0x17'),_0xd7b32a);return new Promise(function(_0x230472,_0x146f95){if(intUtil[_0x053e('0x18')](_0xd7b32a[_0x053e('0x19')])){var _0x1d606b={'method':_0x053e('0xb'),'uri':_0x3c9651+_0x053e('0x1a')+_0xd7b32a['userEmail']+'&'+_0x22d720+'&'+_0x571469,'auth':_0x5b946f,'json':!![]};logger[_0x053e('0x12')]('['+[_0x10cd13[_0x053e('0x13')]()]+_0x053e('0x1b'),_0x1d606b);return rp(_0x1d606b)[_0x053e('0xd')](function(_0x19b553){logger[_0x053e('0x12')]('['+[_0x10cd13[_0x053e('0x13')]()]+_0x053e('0x1c'),_0x19b553);if(_0x19b553[_0x053e('0x10')][_0x053e('0xe')]>0x0&&String(_0x19b553['result'][0x0][_0x053e('0x1d')])===_0x053e('0x1e')){_0xd7b32a[_0x053e('0x1f')]=_0x19b553['result'][0x0][_0x053e('0x11')];}else{_0xd7b32a[_0x053e('0x1f')]=_0xd7b32a[_0x053e('0xf')];_0xd7b32a['userEmail']=_0xd7b32a[_0x053e('0x20')];}logger[_0x053e('0x12')]('['+[_0x10cd13[_0x053e('0x13')]()]+_0x053e('0x21'),_0xd7b32a);_0x230472(_0xd7b32a);})[_0x053e('0x14')](function(_0x1a421e){logger['error']('['+[_0x10cd13[_0x053e('0x13')]()]+']',_0x1a421e[_0x053e('0x16')]);_0x146f95(_0x1a421e['message']);});}else{logger[_0x053e('0x12')]('['+[_0x10cd13[_0x053e('0x13')]()]+_0x053e('0x22'));_0xd7b32a[_0x053e('0x1f')]=_0xd7b32a[_0x053e('0xf')];_0xd7b32a[_0x053e('0x19')]=_0xd7b32a[_0x053e('0x20')];_0x230472(_0xd7b32a);}});};}function createEndUser(_0x15ca48,_0x2f048e,_0x14601c,_0x29b509,_0x30e9d){logger['info']('['+[_0x15ca48['toUpperCase']()]+_0x053e('0x23'),_0x14601c);return new Promise(function(_0x195421,_0x2f67d1){var _0x59569b={'method':_0x053e('0x24'),'uri':_0x29b509+_0x053e('0x25')+_0x30e9d,'body':{'user_name':_0x14601c[_0x053e('0x26')],'roles':_0x053e('0x27'),'first_name':_0x14601c['endUserNumber'],'active':_0x053e('0x1e'),'date_format':_0x053e('0x28'),'phone':_0x14601c[_0x053e('0x26')]},'auth':_0x2f048e,'json':!![]};return rp(_0x59569b)['then'](function(_0x1f928a){logger[_0x053e('0x12')]('['+[_0x15ca48['toUpperCase']()]+_0x053e('0x29'),_0x1f928a[_0x053e('0x10')]);_0x14601c[_0x053e('0x2a')]=_0x1f928a[_0x053e('0x10')][_0x053e('0x11')];_0x195421(_0x14601c);})[_0x053e('0x14')](function(_0x27a714){logger[_0x053e('0x15')]('['+[_0x15ca48[_0x053e('0x13')]()]+']',_0x27a714[_0x053e('0x16')]);_0x2f67d1(_0x27a714[_0x053e('0x16')]);});});}function getEndUser(_0x3fda51,_0x26f37d,_0x168475,_0x4a58a9,_0x34fd5d){return function(_0x2135ff){logger[_0x053e('0x12')]('['+[_0x3fda51[_0x053e('0x13')]()]+_0x053e('0x2b'),_0x2135ff);return new Promise(function(_0x2384ac,_0x4d3640){var _0x26d03b={'method':'GET','uri':_0x168475+_0x053e('0x2c')+_0x2135ff[_0x053e('0x26')]+'&'+_0x4a58a9+'&'+_0x34fd5d,'auth':_0x26f37d,'json':!![]};return rp(_0x26d03b)[_0x053e('0xd')](function(_0x422e09){if(_0x422e09[_0x053e('0x10')]['length']>0x0){_0x2135ff[_0x053e('0x2a')]=_0x422e09['result'][0x0]['sys_id'];logger[_0x053e('0x12')]('['+[_0x3fda51[_0x053e('0x13')]()]+'],\x20getEndUser\x20crm',_0x2135ff);_0x2384ac(_0x2135ff);}else{return createEndUser(_0x3fda51,_0x26f37d,_0x2135ff,_0x168475,_0x4a58a9)['then'](function(_0x348328){logger['info']('['+[_0x3fda51[_0x053e('0x13')]()]+'],\x20createEndUser\x20crm',_0x348328);_0x2384ac(_0x348328);});}})[_0x053e('0x14')](function(_0x21381f){logger[_0x053e('0x15')]('['+[_0x3fda51['toUpperCase']()]+']',_0x21381f['message']);_0x4d3640(_0x21381f[_0x053e('0x16')]);});});};}function getCustomFields(_0x59dc95,_0x339c66){var _0x2f2527={};if(_0x59dc95['length']>0x0){_[_0x053e('0x2d')](_0x59dc95,function(_0x4c55cf){if(_['includes']([_0x053e('0x2e'),_0x053e('0x2f')],_0x4c55cf[_0x053e('0x30')])&&_0x4c55cf[_0x053e('0x31')]&&!_0x4c55cf['customField']){_0x2f2527[_0x4c55cf[_0x053e('0x31')][_0x053e('0x32')]()]=_0x4c55cf[_0x053e('0x33')]['toString']();}else if(_[_0x053e('0x34')]([_0x053e('0x2e'),'picklist'],_0x4c55cf[_0x053e('0x30')])&&_0x4c55cf[_0x053e('0x35')]&&_0x4c55cf[_0x053e('0x36')]){_0x2f2527[_0x4c55cf[_0x053e('0x35')][_0x053e('0x32')]()]=_0x4c55cf[_0x053e('0x33')]['toString']();}else if(_0x4c55cf[_0x053e('0x30')]===_0x053e('0x37')&&_0x4c55cf[_0x053e('0x38')]&&_0x4c55cf[_0x053e('0x35')]&&_0x4c55cf[_0x053e('0x36')]){_0x2f2527[_0x4c55cf[_0x053e('0x35')]['toLowerCase']()]=_0x339c66[_0x4c55cf[_0x053e('0x38')]][_0x053e('0x39')]();}else if(_0x4c55cf[_0x053e('0x30')]===_0x053e('0x3a')&&_0x4c55cf[_0x053e('0x3b')]&&_0x4c55cf[_0x053e('0x3b')]['name']&&_0x4c55cf[_0x053e('0x35')]&&_0x4c55cf['customField']){_0x2f2527[_0x4c55cf['idField'][_0x053e('0x32')]()]=_0x339c66[_0x4c55cf[_0x053e('0x3b')]['name'][_0x053e('0x32')]()]['toString']();}});}return _0x2f2527;}function getTicket(_0x307127,_0x309a6c,_0x3f691c,_0x268d68,_0x177a89,_0x1ffe0f){return function(_0x23b393){logger['info']('['+[_0x307127['toUpperCase']()]+_0x053e('0x3c'),_0x23b393);return new Promise(function(_0x57fa53,_0x4fe4e7){var _0x3a2960=_0x307127[_0x053e('0x32')]()===_0x053e('0x3d')?_0x23b393[_0x053e('0x1f')]:_0x23b393['endUserId'];var _0x18fe93={'method':_0x053e('0x24'),'uri':_0x3f691c+_0x053e('0x3e')+'?'+_0x1ffe0f,'body':Object[_0x053e('0x3f')]({},{'active':_0x053e('0x1e'),'caller_id':_0x3a2960,'assigned_to':_0x23b393[_0x053e('0x1f')],'short_description':intUtil[_0x053e('0x40')](_0x268d68[_0x053e('0x41')],_0x177a89,'\x20'),'description':intUtil[_0x053e('0x40')](_0x268d68['Descriptions'],_0x177a89,'\x0a')},getCustomFields(_0x268d68[_0x053e('0x42')],_0x177a89)),'auth':_0x309a6c,'json':!![]};return rp(_0x18fe93)[_0x053e('0xd')](function(_0x130601){logger['info']('['+[_0x307127['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x130601[_0x053e('0x10')]);_0x23b393[_0x053e('0x43')]=_0x130601['result'][_0x053e('0x11')];_0x23b393[_0x053e('0x44')]=_0x130601[_0x053e('0x10')]['number'];logger[_0x053e('0x12')]('['+[_0x307127[_0x053e('0x13')]()]+_0x053e('0x45'),_0x23b393);_0x57fa53(_0x23b393);})[_0x053e('0x14')](function(_0x4bbf04){logger[_0x053e('0x15')]('['+[_0x307127[_0x053e('0x13')]()]+']',_0x4bbf04[_0x053e('0x16')]);_0x4fe4e7(_0x4bbf04['message']);});});};}function createRemoteTag(_0x559746,_0x5cf77e,_0x567749,_0x515c84){return new Promise(function(_0x214869,_0x118e1d){var _0x5f554c={'method':'POST','uri':_0x567749+_0x053e('0x46')+'?'+_0x515c84,'body':{'short_description':_0x559746,'global':!![],'active':!![],'name':_0x559746},'auth':_0x5cf77e,'json':!![]};return rp(_0x5f554c)[_0x053e('0xd')](function(_0x37d143){var _0x5e85c5=_0x37d143[_0x053e('0x10')]['sys_id'];_0x214869(_0x5e85c5);});});}function getRemoteTag(_0x313f87,_0xb7a61c,_0x50f0a3,_0x2807fb,_0x1cb3c9){return new Promise(function(_0xd5e370,_0x41a30a){var _0x2d9506={'method':_0x053e('0xb'),'uri':_0x50f0a3+_0x053e('0x46')+_0x053e('0x47')+_0x313f87+'&'+_0x2807fb,'auth':_0xb7a61c,'json':!![]};return rp(_0x2d9506)[_0x053e('0xd')](function(_0x3cf5c3){if(_0x3cf5c3[_0x053e('0x10')][_0x053e('0xe')]>0x0){var _0x572800=_0x3cf5c3[_0x053e('0x10')][0x0][_0x053e('0x11')];_0xd5e370(_0x572800);}else{return createRemoteTag(_0x313f87,_0xb7a61c,_0x50f0a3,_0x2807fb)[_0x053e('0xd')](function(_0x3cccf7){_0xd5e370(_0x3cccf7);});}});});}function assignTagToIncident(_0x582a69,_0x58d66c,_0x1e3d42,_0x21b1de,_0x5bbc5c){return new Promise(function(_0x40544a,_0x1cba9b){var _0x2e6f5b={'method':_0x053e('0x24'),'uri':_0x1e3d42+'label_entry'+'?'+_0x5bbc5c,'body':{'label':_0x582a69,'table':_0x053e('0x3e'),'id_type':'Incident','table_key':_0x21b1de[_0x053e('0x43')],'title':_0x053e('0x48')+_0x21b1de[_0x053e('0x44')],'id_display':_0x21b1de[_0x053e('0x44')]},'auth':_0x58d66c,'json':!![]};return rp(_0x2e6f5b)[_0x053e('0xd')](function(_0x5464e2){_0x40544a();})[_0x053e('0x14')](function(){_0x40544a();});});}function manageTags(_0x27f077,_0x355317,_0x562bfd,_0x25fefc,_0x355a8a,_0x392955,_0x32db2b){return new Promise(function(_0x36be31,_0x153a4f){var _0x57a16d=[];_0x355317[_0x053e('0x2d')](function(_0x4ce92d){_0x57a16d[_0x053e('0x49')](getRemoteTag(_0x4ce92d,_0x562bfd,_0x25fefc,_0x392955,_0x32db2b));});return Promise['all'](_0x57a16d)['then'](function(_0x5acc55){if(_0x5acc55[_0x053e('0xe')]){logger[_0x053e('0x12')]('['+[_0x27f077['toUpperCase']()]+_0x053e('0x4a'),_0x5acc55);var _0x1ad921=[];_0x5acc55['forEach'](function(_0x460830){_0x1ad921[_0x053e('0x49')](assignTagToIncident(_0x460830,_0x562bfd,_0x25fefc,_0x355a8a,_0x392955));});return Promise['all'](_0x1ad921)[_0x053e('0xd')](function(){_0x36be31();})[_0x053e('0x14')](function(){_0x36be31();});}else{_0x36be31();}});});}function getTags(_0x2bbd85,_0x3b1b98,_0x67e781,_0x1dee79,_0x32e79b,_0x241a43){return function(_0x2da06f){return new Promise(function(_0x53252d,_0x320cce){var _0x1c83fe=[];var _0x16bfbb=_0x1dee79[_0x053e('0x4b')];if(_0x16bfbb&&_0x16bfbb[_0x053e('0xe')]>0x0){_0x1c83fe=_[_0x053e('0x4c')](_0x16bfbb,'name');}if(_0x1c83fe[_0x053e('0xe')]>0x0){return manageTags(_0x2bbd85,_0x1c83fe,_0x3b1b98,_0x67e781,_0x2da06f,_0x32e79b,_0x241a43)[_0x053e('0xd')](function(){_0x53252d(_0x2da06f);});}else{_0x53252d(_0x2da06f);}});};}function emit(_0x10835e,_0x5bdf05,_0x421497){var _0x7c62d3=_0x053e('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x053e('0x4e');var _0x58ba90={'uri':_0x10835e+_0x053e('0x4f')+_0x421497+_0x7c62d3};io['to'](util['format']('user:%s',_0x5bdf05))['emit'](_0x053e('0x50'),_0x58ba90);}exports['cs']=function(_0x2c6aae,_0x577473,_0x1d942b,_0x4048b0,_0x3ae5ea,_0x29748b,_0x1f920c,_0x45fa88){var _0x47197e={};var _0x5f17c4={'user':_0x29748b[_0x053e('0x51')],'pass':_0x29748b[_0x053e('0x52')]};var _0x4362c5=_0x053e('0x53');var _0x4656c8=_0x053e('0x54');_0x29748b[_0x053e('0x55')]=intUtil[_0x053e('0x56')](_0x29748b[_0x053e('0x55')]);_0x29748b[_0x053e('0x57')]=intUtil[_0x053e('0x56')](_0x29748b[_0x053e('0x57')]);var _0x4ae157=util[_0x053e('0x58')](_0x053e('0x59'),_0x29748b[_0x053e('0x55')]);_0x47197e['userEmail']=!_[_0x053e('0x5a')](_0x4048b0)?_0x4048b0[_0x053e('0x5b')]:null;_0x47197e[_0x053e('0x20')]=_0x29748b['email'];_0x47197e[_0x053e('0x26')]=_0x45fa88[_0x053e('0x32')]()===_0x053e('0x3d')?_0x577473[_0x053e('0x5c')]:_0x577473[_0x053e('0x5d')];_0x47197e[_0x053e('0x5e')]=_0x45fa88===_0x053e('0x5f')||_0x45fa88===_0x053e('0x60')?_0x053e('0x5f'):_0x053e('0x3d');var _0x16a7df=util[_0x053e('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29748b['serverUrl'],_0x577473[_0x053e('0x61')],md5(_0x577473[_0x053e('0x61')]));if(_0x3ae5ea&&_0x3ae5ea[_0x053e('0x62')]){logger[_0x053e('0x12')]('[QUEUE]',_0x053e('0x63'));_0x577473[_0x053e('0x64')]=_0x16a7df;}else if(_0x1f920c&&_0x1f920c[_0x053e('0x65')]&&_0x1f920c[_0x053e('0x65')]!==_0x053e('0x66')){logger[_0x053e('0x12')](_0x053e('0x67'),_0x053e('0x63'));_0x577473[_0x053e('0x64')]=_0x16a7df;}else{_0x577473[_0x053e('0x64')]='';}return getAdminUser(_0x45fa88,_0x5f17c4,_0x47197e,_0x4ae157,_0x4656c8,_0x4362c5)[_0x053e('0xd')](getUser(_0x45fa88,_0x5f17c4,_0x4ae157,_0x4656c8,_0x4362c5))['then'](getEndUser(_0x45fa88,_0x5f17c4,_0x4ae157,_0x4656c8,_0x4362c5))[_0x053e('0xd')](getTicket(_0x45fa88,_0x5f17c4,_0x4ae157,_0x1d942b,_0x577473,_0x4656c8))[_0x053e('0xd')](function(_0x6abc78){logger[_0x053e('0x12')](util[_0x053e('0x58')]('The\x20ticket\x20ID\x20is:\x20%s',_0x6abc78['ticketId']));logger['info'](util['format'](_0x053e('0x68'),_0x45fa88));if(_0x45fa88!=='unmanaged'){logger[_0x053e('0x12')]('['+[_0x45fa88[_0x053e('0x13')]()]+']',_0x053e('0x69'));emit(_0x29748b[_0x053e('0x55')],_0x4048b0[_0x053e('0x6a')],_0x6abc78[_0x053e('0x43')]);}})[_0x053e('0x14')](function(_0x30a112){logger[_0x053e('0x15')]('['+[_0x45fa88[_0x053e('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x053e('0x6b')](_0x30a112,{'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 3717daa..0560877 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 _0xe755=['POST','emit','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','getString','date_start','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','type','customField','nameField','string','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe755,0xdf));var _0x5e75=function(_0x16c858,_0x193fd5){_0x16c858=_0x16c858-0x0;var _0x39b345=_0xe755[_0x16c858];return _0x39b345;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x5e75('0x0'));var util=require('util');var Redis=require(_0x5e75('0x1'));var intUtil=require(_0x5e75('0x2'));var config=require(_0x5e75('0x3'));var logger=require(_0x5e75('0x4'))('sugarcrm');config['redis']=_[_0x5e75('0x5')](config['redis'],{'host':_0x5e75('0x6'),'port':0x18eb});var io=require(_0x5e75('0x7'))(new Redis(config[_0x5e75('0x8')]));var def={'method':_0x5e75('0x9'),'json':!![]};function emit(_0x4af917,_0x190f05,_0x2c0f4f){io['to'](_0x4af917)[_0x5e75('0xa')](_0x190f05,_0x2c0f4f);}function getTicket(_0xffc425,_0x9c8f58,_0x395759,_0x49d4df,_0x567e73,_0x2d6830,_0x3f69d1,_0x28af46){logger['info'](_0x5e75('0xb'));var _0x494026=new Date();var _0x1a8f59=[{'name':_0x5e75('0xc'),'value':intUtil['getString'](_0x49d4df['Subjects'],_0x567e73,'\x20')},{'name':_0x5e75('0xd'),'value':_0x9c8f58['id']},{'name':_0x5e75('0xe'),'value':_0x9c8f58['id']},{'name':'description','value':intUtil[_0x5e75('0xf')](_0x49d4df['Descriptions'],_0x567e73,'\x0a')},{'name':_0x5e75('0x10'),'value':_0x494026['toISOString']()['slice'](0x0,0x13)[_0x5e75('0x11')]('T','\x20')},{'name':_0x5e75('0x12'),'value':'0'},{'name':_0x5e75('0x13'),'value':'15'},{'name':'parent_id','value':_0x395759['id']},{'name':_0x5e75('0x14'),'value':_0x5e75('0x15')},{'name':_0x5e75('0x16'),'value':_0x395759[_0x5e75('0xc')]},{'name':'direction','value':_0x28af46}];if(_0x2d6830[_0x5e75('0x17')]){_[_0x5e75('0x18')](_0x2d6830,function(_0x22b788){if(_0x567e73[_0x22b788['variableName']]){_0x1a8f59[_0x5e75('0x19')]({'name':_0x22b788[_0x5e75('0x1a')],'value':_0x567e73[_0x22b788[_0x5e75('0x1b')]]});}});}return request({'form':{'method':_0x5e75('0x1c'),'input_type':'JSON','response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'session':_0x3f69d1['id'],'module_name':_0x5e75('0x1f'),'name_value_list':_0x1a8f59})}});}function getAuth(_0x2ebc12){return util[_0x5e75('0x20')]('Basic\x20%s',new Buffer(_0x2ebc12[_0x5e75('0x21')]+':X')[_0x5e75('0x22')]('base64'));}function getServerInfo(_0x5c7318){return request({'form':{'method':_0x5e75('0x23'),'input_type':_0x5e75('0x1d'),'response_type':_0x5e75('0x1d'),'rest_data':JSON['stringify']({'session':_0x5c7318['id']})}});}function getUser(_0x16cb82,_0x584e8d,_0x255be4){if(!_[_0x5e75('0x24')](_0x584e8d)){logger[_0x5e75('0x25')](_0x5e75('0x26'),_0x584e8d);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'session':_0x255be4['id'],'module_name':'Employees','query':util[_0x5e75('0x20')](_0x5e75('0x27'),_0x584e8d),'order_by':'','offset':'0','select_fields':['id','name',_0x5e75('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e75('0x29')](function(_0x26df8e){if(_0x26df8e['entry_list']['length']){var _0x1621f8=_[_0x5e75('0x2a')](_0x26df8e[_0x5e75('0x2b')],function(_0x3955c3){return _0x3955c3['name_value_list'][_0x5e75('0x28')][_0x5e75('0x2c')]===_0x584e8d;});if(_0x1621f8){logger['info'](_0x5e75('0x2d'));return BPromise['resolve']({'id':_0x1621f8[_0x5e75('0x2e')]['id'][_0x5e75('0x2c')],'name':_0x1621f8['name_value_list'][_0x5e75('0xc')][_0x5e75('0x2c')]});}}logger[_0x5e75('0x25')](_0x5e75('0x2f'));return BPromise[_0x5e75('0x30')]({'id':_0x255be4[_0x5e75('0x2e')][_0x5e75('0x31')][_0x5e75('0x2c')],'name':_0x255be4[_0x5e75('0x2e')][_0x5e75('0x28')]['value']});});}else{logger[_0x5e75('0x25')](_0x5e75('0x32'));return BPromise[_0x5e75('0x30')]({'id':_0x255be4[_0x5e75('0x2e')][_0x5e75('0x31')][_0x5e75('0x2c')],'name':_0x255be4[_0x5e75('0x2e')][_0x5e75('0x28')][_0x5e75('0x2c')]});}}function getEndUser(_0x15909b,_0xf877c1,_0x3a11c1,_0x37488b){logger[_0x5e75('0x25')](_0x5e75('0x33'),_0x3a11c1);return request({'form':{'method':_0x5e75('0x34'),'input_type':_0x5e75('0x1d'),'response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'session':_0x37488b['id'],'module_name':_0x5e75('0x15'),'query':util['format'](_0x5e75('0x35'),_0x3a11c1),'order_by':'','offset':'0','select_fields':['id',_0x5e75('0xc'),_0x5e75('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5e75('0x29')](function(_0x2059fb){if(_0x2059fb[_0x5e75('0x2b')]['length']){var _0x2463b6=_['find'](_0x2059fb[_0x5e75('0x2b')],function(_0x100e74){return _0x100e74[_0x5e75('0x2e')][_0x5e75('0x36')][_0x5e75('0x2c')]===_0x3a11c1;});if(_0x2463b6){logger[_0x5e75('0x25')](_0x5e75('0x37'));return BPromise[_0x5e75('0x30')]({'id':_0x2463b6[_0x5e75('0x2e')]['id'][_0x5e75('0x2c')],'name':_0x2463b6[_0x5e75('0x2e')][_0x5e75('0xc')][_0x5e75('0x2c')],'phone':_0x2463b6[_0x5e75('0x2e')][_0x5e75('0x36')][_0x5e75('0x2c')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x5e75('0x1d'),'response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'session':_0x37488b['id'],'module_name':_0x5e75('0x15'),'name_value_list':[{'name':'first_name','value':_0xf877c1!==_0x5e75('0x38')?_0xf877c1:util[_0x5e75('0x20')](_0x5e75('0x39'),_0x3a11c1)},{'name':_0x5e75('0x36'),'value':_0x3a11c1}]})}})[_0x5e75('0x29')](function(_0x5ae6e5){logger[_0x5e75('0x25')]('Enduser\x20created.');return BPromise[_0x5e75('0x30')]({'id':_0x5ae6e5['id'],'name':_0x5ae6e5['entry_list'][_0x5e75('0x3a')]['value'],'phone':_0x5ae6e5[_0x5e75('0x2b')]['phone_home'][_0x5e75('0x2c')]});});}});}function request(_0x3e3bf4){logger[_0x5e75('0x3b')](_0x5e75('0x3c'),JSON[_0x5e75('0x1e')](_0x3e3bf4));return rp(_[_0x5e75('0x3d')](def,_0x3e3bf4));}function getTags(_0x5ca3c6,_0x284b7d){var _0x1b7007=[];if(_0x5ca3c6&&_0x5ca3c6['length']>0x0){_0x1b7007=_[_0x5e75('0x3e')](_0x5ca3c6,_0x284b7d);}return _0x1b7007;}function getCustomFields(_0x487bc4,_0x210596){var _0x5b2e96=[];var _0x25c6a8={'custom_fields':[]};if(_0x487bc4['length']>0x0){_[_0x5e75('0x18')](_0x487bc4,function(_0x1c9a76){if(_0x1c9a76[_0x5e75('0x3f')]==='string'&&_0x1c9a76['nameField']&&!_0x1c9a76[_0x5e75('0x40')]){_0x25c6a8[_0x1c9a76[_0x5e75('0x41')]['toLowerCase']()]=_0x1c9a76['content'][_0x5e75('0x22')]();}else if(_0x1c9a76[_0x5e75('0x3f')]===_0x5e75('0x42')&&_0x1c9a76['idField']&&_0x1c9a76[_0x5e75('0x40')]){_0x25c6a8[_0x5e75('0x43')][_0x5e75('0x19')]({'id':_0x1c9a76[_0x5e75('0x1a')],'value':_0x1c9a76['content']['toString']()});}else if(_0x1c9a76[_0x5e75('0x3f')]===_0x5e75('0x44')&&_0x1c9a76[_0x5e75('0x1b')]&&_0x1c9a76['idField']&&_0x1c9a76['customField']){_0x210596[_0x1c9a76[_0x5e75('0x1b')]]&&_0x25c6a8['custom_fields'][_0x5e75('0x19')]({'id':_0x1c9a76['idField'],'value':_0x210596[_0x1c9a76['variableName']][_0x5e75('0x22')]()});}else if(_0x1c9a76[_0x5e75('0x3f')]===_0x5e75('0x45')&&_0x1c9a76[_0x5e75('0x46')]&&_0x1c9a76[_0x5e75('0x46')][_0x5e75('0xc')]&&_0x1c9a76[_0x5e75('0x1a')]&&_0x1c9a76['customField']){_0x210596[_0x1c9a76['Variable'][_0x5e75('0xc')][_0x5e75('0x47')]()]&&_0x25c6a8[_0x5e75('0x43')][_0x5e75('0x19')]({'id':_0x1c9a76['idField'],'value':_0x210596[_0x1c9a76[_0x5e75('0x46')][_0x5e75('0xc')]['toLowerCase']()]['toString']()});}});}return _0x25c6a8;}function getConnection(_0x31e74c){return request({'method':_0x5e75('0x9'),'form':{'method':_0x5e75('0x48'),'input_type':_0x5e75('0x1d'),'response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'user_auth':{'user_name':_0x31e74c[_0x5e75('0x49')],'password':_0x31e74c['password'],'encryption':_0x5e75('0x4a')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x157953){var _0x443203=_0x157953;if(_0x443203['id']){def['sessionID']=_0x443203['id'];return BPromise[_0x5e75('0x30')](_0x443203);}else{throw new Error(util[_0x5e75('0x20')](_0x5e75('0x4b'),_0x31e74c['id']));}});}function setRelationship(_0x11f2bd,_0x1f28d4,_0x2bcc1e,_0xc21f11){return request({'form':{'method':_0x5e75('0x4c'),'input_type':_0x5e75('0x1d'),'response_type':_0x5e75('0x1d'),'rest_data':JSON[_0x5e75('0x1e')]({'session':_0x11f2bd['id'],'module_name':_0x5e75('0x1f'),'module_id':_0x2bcc1e['id'],'link_field_name':_0xc21f11,'related_ids':[_0x1f28d4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5e75('0x4d')]=function(_0x254798,_0x7ed797,_0x45c453,_0x296a57,_0x3301e2,_0x14d177){var _0x22830d,_0x296114,_0x34f5dd,_0x44840b;_0x14d177['remoteUri']=intUtil['stripTrailingSlash'](_0x14d177[_0x5e75('0x4e')]);_0x14d177['serverUrl']=intUtil[_0x5e75('0x4f')](_0x14d177[_0x5e75('0x50')]);def[_0x5e75('0x51')]=util[_0x5e75('0x20')](_0x5e75('0x52'),_0x14d177['remoteUri']);if(_0x3301e2&&_0x3301e2['monitor_format']){logger[_0x5e75('0x25')]('[QUEUE]','Recording\x20is\x20enabled!');_0x7ed797[_0x5e75('0x53')]=util[_0x5e75('0x20')](_0x5e75('0x54'),_0x14d177[_0x5e75('0x50')],_0x7ed797[_0x5e75('0x55')],md5(_0x7ed797[_0x5e75('0x55')]));}else{_0x7ed797[_0x5e75('0x53')]='';}return getConnection(_0x14d177)['then'](function(_0x59dcf7){_0x44840b=_0x59dcf7;return getUser(_0x14d177,_0x296a57[_0x5e75('0xc')],_0x44840b);})[_0x5e75('0x29')](function(_0x1c84e0){_0x22830d=_0x1c84e0;logger[_0x5e75('0x25')]('The\x20User\x20ID\x20is:',_0x22830d['id']);return getEndUser(_0x14d177,_0x7ed797['calleridname'],_0x7ed797[_0x5e75('0x56')],_0x44840b);})[_0x5e75('0x29')](function(_0x945fc5){_0x296114=_0x945fc5;logger[_0x5e75('0x25')](_0x5e75('0x57'),_0x296114['id']);return getTicket(_0x14d177,_0x22830d,_0x296114,_0x45c453,_0x7ed797,_0x45c453[_0x5e75('0x58')],_0x44840b,_0x5e75('0x59'));})[_0x5e75('0x29')](function(_0x57a55b){_0x34f5dd=_0x57a55b;logger[_0x5e75('0x25')](_0x5e75('0x5a'));logger[_0x5e75('0x25')]('The\x20Ticket\x20ID\x20is:',_0x34f5dd['id']);return setRelationship(_0x44840b,_0x22830d,_0x34f5dd,'users');})['then'](function(){return setRelationship(_0x44840b,_0x296114,_0x34f5dd,_0x5e75('0x5b'));})['then'](function(){return getServerInfo(_0x44840b);})[_0x5e75('0x29')](function(_0x568067){var _0xa524e3=parseInt(_0x568067[_0x5e75('0x5c')][_0x5e75('0x5d')](0x0));var _0x32f941=util[_0x5e75('0x20')](_0x5e75('0x5e'),_0x14d177[_0x5e75('0x4e')],_0x34f5dd['id']);if(_0xa524e3>0x6){_0x32f941=util[_0x5e75('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x14d177[_0x5e75('0x4e')],_0x34f5dd['id']);}logger['info'](_0x5e75('0x5f'),_0x5e75('0x60'));emit(util[_0x5e75('0x20')](_0x5e75('0x61'),_0x296a57[_0x5e75('0xc')]),'trigger:browser:url',{'uri':_0x32f941});})[_0x5e75('0x62')](function(_0x151f4a){logger[_0x5e75('0x63')]('[QUEUE]',JSON[_0x5e75('0x1e')](_0x151f4a));});};exports[_0x5e75('0x64')]=function(_0x2858c5,_0x3cf452,_0x1b0427,_0x1f4898,_0xbd7fc9,_0x4b3f82,_0x565797){var _0xca73d9,_0x5e6c17,_0x289a88,_0x113824;_0x4b3f82['remoteUri']=intUtil[_0x5e75('0x4f')](_0x4b3f82[_0x5e75('0x4e')]);_0x4b3f82['serverUrl']=intUtil[_0x5e75('0x4f')](_0x4b3f82[_0x5e75('0x50')]);def[_0x5e75('0x51')]=util[_0x5e75('0x20')](_0x5e75('0x52'),_0x4b3f82['remoteUri']);if(_0x565797&&_0x565797[_0x5e75('0x65')]&&_0x565797[_0x5e75('0x65')]!==_0x5e75('0x66')){logger[_0x5e75('0x25')](_0x5e75('0x67'),_0x5e75('0x68'));_0x3cf452[_0x5e75('0x53')]=util[_0x5e75('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b3f82[_0x5e75('0x50')],_0x3cf452['uniqueid'],md5(_0x3cf452[_0x5e75('0x55')]));}return getConnection(_0x4b3f82)[_0x5e75('0x29')](function(_0x124747){_0x113824=_0x124747;return getUser(_0x4b3f82,_0x1f4898['name'],_0x113824);})[_0x5e75('0x29')](function(_0x28d7dc){_0xca73d9=_0x28d7dc;logger[_0x5e75('0x25')](_0x5e75('0x69'),_0xca73d9['id']);return getEndUser(_0x4b3f82,_0x3cf452[_0x5e75('0x6a')],_0x3cf452['destcalleridnum'],_0x113824);})[_0x5e75('0x29')](function(_0x5785d4){_0x5e6c17=_0x5785d4;logger[_0x5e75('0x25')]('The\x20Enduser\x20ID\x20is:',_0x5e6c17['id']);return getTicket(_0x4b3f82,_0xca73d9,_0x5e6c17,_0x1b0427,_0x3cf452,_0x1b0427['Fields'],_0x113824,_0x5e75('0x6b'));})[_0x5e75('0x29')](function(_0x3472a4){_0x289a88=_0x3472a4;logger[_0x5e75('0x25')](_0x5e75('0x5a'));logger['info'](_0x5e75('0x6c'),_0x289a88['id']);return setRelationship(_0x113824,_0xca73d9,_0x289a88,_0x5e75('0x6d'));})['then'](function(){return setRelationship(_0x113824,_0x5e6c17,_0x289a88,_0x5e75('0x5b'));})['then'](function(){return getServerInfo(_0x113824);})[_0x5e75('0x29')](function(_0x3a70b6){var _0x520705=parseInt(_0x3a70b6['version'][_0x5e75('0x5d')](0x0));var _0x4aa413=util['format'](_0x5e75('0x5e'),_0x4b3f82[_0x5e75('0x4e')],_0x289a88['id']);if(_0x520705>0x6){_0x4aa413=util[_0x5e75('0x20')](_0x5e75('0x6e'),_0x4b3f82[_0x5e75('0x4e')],_0x289a88['id']);}logger[_0x5e75('0x25')](_0x5e75('0x67'),_0x5e75('0x60'));emit(util[_0x5e75('0x20')](_0x5e75('0x61'),_0x1f4898['name']),_0x5e75('0x6f'),{'uri':_0x4aa413});})[_0x5e75('0x62')](function(_0xacbe89){logger[_0x5e75('0x63')](_0x5e75('0x67'),JSON[_0x5e75('0x1e')](_0xacbe89));});};exports[_0x5e75('0x70')]=function(_0x836785,_0x5b3d1f,_0x5d1586,_0x31c888,_0x4ef3c3,_0x3e33b9){var _0x13fc28,_0x717905,_0xb91462,_0xf10b42;_0x3e33b9[_0x5e75('0x4e')]=intUtil[_0x5e75('0x4f')](_0x3e33b9[_0x5e75('0x4e')]);_0x3e33b9[_0x5e75('0x50')]=intUtil['stripTrailingSlash'](_0x3e33b9['serverUrl']);def['uri']=util[_0x5e75('0x20')](_0x5e75('0x52'),_0x3e33b9[_0x5e75('0x4e')]);if(_0x4ef3c3&&_0x4ef3c3[_0x5e75('0x71')]){logger['info']('['+_0x5b3d1f['lastevent'][_0x5e75('0x72')]()+']','Recording\x20is\x20enabled!');_0x5b3d1f[_0x5e75('0x53')]=util['format'](_0x5e75('0x54'),_0x3e33b9[_0x5e75('0x50')],_0x5b3d1f[_0x5e75('0x55')],md5(_0x5b3d1f[_0x5e75('0x55')]));}else{_0x5b3d1f[_0x5e75('0x53')]='';}return getConnection(_0x3e33b9)[_0x5e75('0x29')](function(_0x50717e){_0xf10b42=_0x50717e;if(!_[_0x5e75('0x24')](_0x31c888)){return getUser(_0x3e33b9,_0x31c888[_0x5e75('0xc')],_0xf10b42);}else{return getUser(_0x3e33b9,null,_0xf10b42);}})['then'](function(_0x3fe164){_0x13fc28=_0x3fe164;logger['info']('The\x20User\x20ID\x20is:',_0x13fc28['id']);return getEndUser(_0x3e33b9,_0x5b3d1f[_0x5e75('0x73')],_0x5b3d1f[_0x5e75('0x56')],_0xf10b42);})[_0x5e75('0x29')](function(_0x58319f){_0x717905=_0x58319f;logger[_0x5e75('0x25')](_0x5e75('0x57'),_0x717905['id']);return getTicket(_0x3e33b9,_0x13fc28,_0x717905,_0x5d1586,_0x5b3d1f,_0x5d1586[_0x5e75('0x58')],_0xf10b42,'Inbound');})[_0x5e75('0x29')](function(_0x253244){_0xb91462=_0x253244;logger[_0x5e75('0x25')](_0x5e75('0x5a'));logger[_0x5e75('0x25')](_0x5e75('0x6c'),_0xb91462['id']);return setRelationship(_0xf10b42,_0x13fc28,_0xb91462,_0x5e75('0x6d'));})['then'](function(){return setRelationship(_0xf10b42,_0x717905,_0xb91462,_0x5e75('0x5b'));})[_0x5e75('0x29')](function(){return getServerInfo(_0xf10b42);})[_0x5e75('0x62')](function(_0x4e29f0){logger['error']('['+_0x5b3d1f['lastevent'][_0x5e75('0x72')]()+']',JSON[_0x5e75('0x1e')](_0x4e29f0));});}; \ No newline at end of file +var _0x1049=['date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','variableName','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','users','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions'];(function(_0x3a49d0,_0x359834){var _0x229363=function(_0x14c7dc){while(--_0x14c7dc){_0x3a49d0['push'](_0x3a49d0['shift']());}};_0x229363(++_0x359834);}(_0x1049,0x64));var _0x9104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1049[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9104('0x0'));var rp=require('request-promise');var BPromise=require(_0x9104('0x1'));var md5=require(_0x9104('0x2'));var util=require('util');var Redis=require(_0x9104('0x3'));var intUtil=require(_0x9104('0x4'));var config=require(_0x9104('0x5'));var logger=require('../../../../config/logger')(_0x9104('0x6'));config[_0x9104('0x7')]=_[_0x9104('0x8')](config[_0x9104('0x7')],{'host':_0x9104('0x9'),'port':0x18eb});var io=require(_0x9104('0xa'))(new Redis(config[_0x9104('0x7')]));var def={'method':_0x9104('0xb'),'json':!![]};function emit(_0x40308c,_0x4ef866,_0x54386d){io['to'](_0x40308c)[_0x9104('0xc')](_0x4ef866,_0x54386d);}function getTicket(_0x55ffba,_0x3611c6,_0x3e8f3a,_0x51421d,_0x40cdc5,_0x66bdae,_0x119b80,_0x108a61){logger[_0x9104('0xd')](_0x9104('0xe'));var _0x466ae8=new Date();var _0x121f6d=[{'name':_0x9104('0xf'),'value':intUtil[_0x9104('0x10')](_0x51421d[_0x9104('0x11')],_0x40cdc5,'\x20')},{'name':_0x9104('0x12'),'value':_0x3611c6['id']},{'name':_0x9104('0x13'),'value':_0x3611c6['id']},{'name':_0x9104('0x14'),'value':intUtil[_0x9104('0x10')](_0x51421d[_0x9104('0x15')],_0x40cdc5,'\x0a')},{'name':_0x9104('0x16'),'value':_0x466ae8[_0x9104('0x17')]()[_0x9104('0x18')](0x0,0x13)[_0x9104('0x19')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x9104('0x1a'),'value':'15'},{'name':_0x9104('0x1b'),'value':_0x3e8f3a['id']},{'name':_0x9104('0x1c'),'value':_0x9104('0x1d')},{'name':_0x9104('0x1e'),'value':_0x3e8f3a[_0x9104('0xf')]},{'name':_0x9104('0x1f'),'value':_0x108a61}];if(_0x66bdae[_0x9104('0x20')]){_[_0x9104('0x21')](_0x66bdae,function(_0x264f2c){if(_0x40cdc5[_0x264f2c['variableName']]){_0x121f6d[_0x9104('0x22')]({'name':_0x264f2c['idField'],'value':_0x40cdc5[_0x264f2c[_0x9104('0x23')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9104('0x24'),'rest_data':JSON['stringify']({'session':_0x119b80['id'],'module_name':_0x9104('0x25'),'name_value_list':_0x121f6d})}});}function getAuth(_0xa109ba){return util['format'](_0x9104('0x26'),new Buffer(_0xa109ba[_0x9104('0x27')]+':X')[_0x9104('0x28')](_0x9104('0x29')));}function getServerInfo(_0x121b42){return request({'form':{'method':_0x9104('0x2a'),'input_type':'JSON','response_type':_0x9104('0x24'),'rest_data':JSON[_0x9104('0x2b')]({'session':_0x121b42['id']})}});}function getUser(_0x389145,_0x3b32b4,_0x3a1939){if(!_[_0x9104('0x2c')](_0x3b32b4)){logger[_0x9104('0xd')](_0x9104('0x2d'),_0x3b32b4);return request({'form':{'method':_0x9104('0x2e'),'input_type':_0x9104('0x24'),'response_type':_0x9104('0x24'),'rest_data':JSON[_0x9104('0x2b')]({'session':_0x3a1939['id'],'module_name':_0x9104('0x2f'),'query':util[_0x9104('0x30')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3b32b4),'order_by':'','offset':'0','select_fields':['id',_0x9104('0xf'),_0x9104('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9104('0x32')](function(_0x51d1b1){if(_0x51d1b1[_0x9104('0x33')][_0x9104('0x20')]){var _0xd52371=_[_0x9104('0x34')](_0x51d1b1[_0x9104('0x33')],function(_0x49fa6b){return _0x49fa6b[_0x9104('0x35')][_0x9104('0x31')]['value']===_0x3b32b4;});if(_0xd52371){logger[_0x9104('0xd')]('Agent\x20found!');return BPromise[_0x9104('0x36')]({'id':_0xd52371[_0x9104('0x35')]['id'][_0x9104('0x37')],'name':_0xd52371['name_value_list']['name'][_0x9104('0x37')]});}}logger[_0x9104('0xd')](_0x9104('0x38'));return BPromise[_0x9104('0x36')]({'id':_0x3a1939[_0x9104('0x35')][_0x9104('0x39')][_0x9104('0x37')],'name':_0x3a1939[_0x9104('0x35')]['user_name']['value']});});}else{logger['info'](_0x9104('0x3a'));return BPromise[_0x9104('0x36')]({'id':_0x3a1939[_0x9104('0x35')][_0x9104('0x39')][_0x9104('0x37')],'name':_0x3a1939[_0x9104('0x35')][_0x9104('0x31')][_0x9104('0x37')]});}}function getEndUser(_0x181fcc,_0x47f455,_0x2d8d5d,_0x536890){logger[_0x9104('0xd')]('Searching\x20enduser\x20with\x20phone',_0x2d8d5d);return request({'form':{'method':_0x9104('0x2e'),'input_type':_0x9104('0x24'),'response_type':_0x9104('0x24'),'rest_data':JSON[_0x9104('0x2b')]({'session':_0x536890['id'],'module_name':_0x9104('0x1d'),'query':util[_0x9104('0x30')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x2d8d5d),'order_by':'','offset':'0','select_fields':['id',_0x9104('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9104('0x32')](function(_0x43684f){if(_0x43684f[_0x9104('0x33')][_0x9104('0x20')]){var _0x365c1f=_[_0x9104('0x34')](_0x43684f[_0x9104('0x33')],function(_0x2400d2){return _0x2400d2[_0x9104('0x35')][_0x9104('0x3b')]['value']===_0x2d8d5d;});if(_0x365c1f){logger[_0x9104('0xd')](_0x9104('0x3c'));return BPromise[_0x9104('0x36')]({'id':_0x365c1f['name_value_list']['id'][_0x9104('0x37')],'name':_0x365c1f[_0x9104('0x35')][_0x9104('0xf')][_0x9104('0x37')],'phone':_0x365c1f[_0x9104('0x35')][_0x9104('0x3b')][_0x9104('0x37')]});}}else{logger[_0x9104('0xd')](_0x9104('0x3d'));return request({'form':{'method':_0x9104('0x3e'),'input_type':_0x9104('0x24'),'response_type':_0x9104('0x24'),'rest_data':JSON[_0x9104('0x2b')]({'session':_0x536890['id'],'module_name':_0x9104('0x1d'),'name_value_list':[{'name':'first_name','value':_0x47f455!==''?_0x47f455:util[_0x9104('0x30')]('Caller\x20-\x20%s',_0x2d8d5d)},{'name':_0x9104('0x3b'),'value':_0x2d8d5d}]})}})[_0x9104('0x32')](function(_0x398b57){logger[_0x9104('0xd')](_0x9104('0x3f'));return BPromise[_0x9104('0x36')]({'id':_0x398b57['id'],'name':_0x398b57[_0x9104('0x33')][_0x9104('0x40')][_0x9104('0x37')],'phone':_0x398b57[_0x9104('0x33')][_0x9104('0x3b')]['value']});});}});}function request(_0x1849db){logger[_0x9104('0x41')](_0x9104('0x42'),JSON[_0x9104('0x2b')](_0x1849db));return rp(_[_0x9104('0x43')](def,_0x1849db));}function getTags(_0xfee395,_0x109945){var _0x5abf2f=[];if(_0xfee395&&_0xfee395['length']>0x0){_0x5abf2f=_[_0x9104('0x44')](_0xfee395,_0x109945);}return _0x5abf2f;}function getCustomFields(_0x23b568,_0x2daf85){var _0x37c9f3=[];var _0x282fb0={'custom_fields':[]};if(_0x23b568[_0x9104('0x20')]>0x0){_[_0x9104('0x21')](_0x23b568,function(_0x5d8f26){if(_0x5d8f26[_0x9104('0x45')]===_0x9104('0x46')&&_0x5d8f26[_0x9104('0x47')]&&!_0x5d8f26[_0x9104('0x48')]){_0x282fb0[_0x5d8f26[_0x9104('0x47')][_0x9104('0x49')]()]=_0x5d8f26[_0x9104('0x4a')][_0x9104('0x28')]();}else if(_0x5d8f26[_0x9104('0x45')]===_0x9104('0x46')&&_0x5d8f26[_0x9104('0x4b')]&&_0x5d8f26['customField']){_0x282fb0['custom_fields'][_0x9104('0x22')]({'id':_0x5d8f26['idField'],'value':_0x5d8f26['content']['toString']()});}else if(_0x5d8f26[_0x9104('0x45')]===_0x9104('0x4c')&&_0x5d8f26['variableName']&&_0x5d8f26[_0x9104('0x4b')]&&_0x5d8f26[_0x9104('0x48')]){_0x2daf85[_0x5d8f26[_0x9104('0x23')]]&&_0x282fb0[_0x9104('0x4d')]['push']({'id':_0x5d8f26['idField'],'value':_0x2daf85[_0x5d8f26[_0x9104('0x23')]][_0x9104('0x28')]()});}else if(_0x5d8f26[_0x9104('0x45')]===_0x9104('0x4e')&&_0x5d8f26['Variable']&&_0x5d8f26[_0x9104('0x4f')][_0x9104('0xf')]&&_0x5d8f26['idField']&&_0x5d8f26[_0x9104('0x48')]){_0x2daf85[_0x5d8f26['Variable'][_0x9104('0xf')][_0x9104('0x49')]()]&&_0x282fb0['custom_fields']['push']({'id':_0x5d8f26['idField'],'value':_0x2daf85[_0x5d8f26['Variable'][_0x9104('0xf')][_0x9104('0x49')]()][_0x9104('0x28')]()});}});}return _0x282fb0;}function getConnection(_0x20ca34){return request({'method':_0x9104('0xb'),'form':{'method':_0x9104('0x50'),'input_type':_0x9104('0x24'),'response_type':'JSON','rest_data':JSON[_0x9104('0x2b')]({'user_auth':{'user_name':_0x20ca34[_0x9104('0x51')],'password':_0x20ca34[_0x9104('0x52')],'encryption':_0x9104('0x53')},'application':_0x9104('0x54')})}})[_0x9104('0x32')](function(_0x480552){var _0x55a720=_0x480552;if(_0x55a720['id']){def['sessionID']=_0x55a720['id'];return BPromise[_0x9104('0x36')](_0x55a720);}else{throw new Error(util[_0x9104('0x30')]('Account\x20%d\x20is\x20not\x20valid',_0x20ca34['id']));}});}function setRelationship(_0x348e49,_0x4154d9,_0x38007c,_0x29faeb){return request({'form':{'method':_0x9104('0x55'),'input_type':_0x9104('0x24'),'response_type':'JSON','rest_data':JSON[_0x9104('0x2b')]({'session':_0x348e49['id'],'module_name':'Calls','module_id':_0x38007c['id'],'link_field_name':_0x29faeb,'related_ids':[_0x4154d9['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x20dd5e,_0x52321f,_0x21977e,_0x41b3d5,_0x4341e8,_0x5d4e16){var _0x6ec9e8,_0x41bd89,_0x2c0c67,_0x526326;_0x5d4e16['remoteUri']=intUtil[_0x9104('0x56')](_0x5d4e16[_0x9104('0x57')]);_0x5d4e16[_0x9104('0x58')]=intUtil['stripTrailingSlash'](_0x5d4e16[_0x9104('0x58')]);def[_0x9104('0x59')]=util[_0x9104('0x30')]('%s/service/v4_1/rest.php',_0x5d4e16[_0x9104('0x57')]);if(_0x4341e8&&_0x4341e8[_0x9104('0x5a')]){logger[_0x9104('0xd')](_0x9104('0x5b'),_0x9104('0x5c'));_0x52321f[_0x9104('0x5d')]=util[_0x9104('0x30')](_0x9104('0x5e'),_0x5d4e16[_0x9104('0x58')],_0x52321f[_0x9104('0x5f')],md5(_0x52321f[_0x9104('0x5f')]));}else{_0x52321f[_0x9104('0x5d')]='';}return getConnection(_0x5d4e16)[_0x9104('0x32')](function(_0x1ce76b){_0x526326=_0x1ce76b;return getUser(_0x5d4e16,_0x41b3d5['name'],_0x526326);})[_0x9104('0x32')](function(_0x36ed9a){_0x6ec9e8=_0x36ed9a;logger[_0x9104('0xd')]('The\x20User\x20ID\x20is:',_0x6ec9e8['id']);return getEndUser(_0x5d4e16,_0x52321f[_0x9104('0x60')],_0x52321f[_0x9104('0x61')],_0x526326);})[_0x9104('0x32')](function(_0x361997){_0x41bd89=_0x361997;logger['info'](_0x9104('0x62'),_0x41bd89['id']);return getTicket(_0x5d4e16,_0x6ec9e8,_0x41bd89,_0x21977e,_0x52321f,_0x21977e[_0x9104('0x63')],_0x526326,_0x9104('0x64'));})[_0x9104('0x32')](function(_0x3bd6b8){_0x2c0c67=_0x3bd6b8;logger[_0x9104('0xd')](_0x9104('0x65'));logger['info'](_0x9104('0x66'),_0x2c0c67['id']);return setRelationship(_0x526326,_0x6ec9e8,_0x2c0c67,'users');})[_0x9104('0x32')](function(){return setRelationship(_0x526326,_0x41bd89,_0x2c0c67,_0x9104('0x67'));})[_0x9104('0x32')](function(){return getServerInfo(_0x526326);})[_0x9104('0x32')](function(_0x4819a0){var _0x19985b=parseInt(_0x4819a0[_0x9104('0x68')][_0x9104('0x69')](0x0));var _0x166e53=util['format'](_0x9104('0x6a'),_0x5d4e16[_0x9104('0x57')],_0x2c0c67['id']);if(_0x19985b>0x6){_0x166e53=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5d4e16['remoteUri'],_0x2c0c67['id']);}logger['info'](_0x9104('0x5b'),_0x9104('0x6b'));emit(util[_0x9104('0x30')](_0x9104('0x6c'),_0x41b3d5[_0x9104('0xf')]),'trigger:browser:url',{'uri':_0x166e53});})[_0x9104('0x6d')](function(_0x100d34){logger[_0x9104('0x6e')](_0x9104('0x5b'),JSON[_0x9104('0x2b')](_0x100d34));});};exports[_0x9104('0x6f')]=function(_0x3d652e,_0x585ae3,_0x56c2c0,_0x30b701,_0x4849fc,_0x1b2593,_0x223ca1){var _0x59ba47,_0x19fb07,_0x291bb3,_0x3861a4;_0x1b2593[_0x9104('0x57')]=intUtil[_0x9104('0x56')](_0x1b2593[_0x9104('0x57')]);_0x1b2593['serverUrl']=intUtil[_0x9104('0x56')](_0x1b2593[_0x9104('0x58')]);def[_0x9104('0x59')]=util[_0x9104('0x30')]('%s/service/v4_1/rest.php',_0x1b2593[_0x9104('0x57')]);if(_0x223ca1&&_0x223ca1['recordingFormat']&&_0x223ca1[_0x9104('0x70')]!==_0x9104('0x71')){logger[_0x9104('0xd')](_0x9104('0x72'),_0x9104('0x5c'));_0x585ae3[_0x9104('0x5d')]=util[_0x9104('0x30')](_0x9104('0x5e'),_0x1b2593['serverUrl'],_0x585ae3[_0x9104('0x5f')],md5(_0x585ae3[_0x9104('0x5f')]));}return getConnection(_0x1b2593)[_0x9104('0x32')](function(_0x29a5ce){_0x3861a4=_0x29a5ce;return getUser(_0x1b2593,_0x30b701['name'],_0x3861a4);})[_0x9104('0x32')](function(_0x2f0700){_0x59ba47=_0x2f0700;logger[_0x9104('0xd')](_0x9104('0x73'),_0x59ba47['id']);return getEndUser(_0x1b2593,_0x585ae3[_0x9104('0x74')],_0x585ae3['destcalleridnum'],_0x3861a4);})[_0x9104('0x32')](function(_0x1dd517){_0x19fb07=_0x1dd517;logger[_0x9104('0xd')]('The\x20Enduser\x20ID\x20is:',_0x19fb07['id']);return getTicket(_0x1b2593,_0x59ba47,_0x19fb07,_0x56c2c0,_0x585ae3,_0x56c2c0[_0x9104('0x63')],_0x3861a4,_0x9104('0x75'));})[_0x9104('0x32')](function(_0x185098){_0x291bb3=_0x185098;logger[_0x9104('0xd')](_0x9104('0x65'));logger[_0x9104('0xd')]('The\x20Ticket\x20ID\x20is:',_0x291bb3['id']);return setRelationship(_0x3861a4,_0x59ba47,_0x291bb3,_0x9104('0x76'));})[_0x9104('0x32')](function(){return setRelationship(_0x3861a4,_0x19fb07,_0x291bb3,'contacts');})[_0x9104('0x32')](function(){return getServerInfo(_0x3861a4);})[_0x9104('0x32')](function(_0x3f0572){var _0x3a43c9=parseInt(_0x3f0572['version'][_0x9104('0x69')](0x0));var _0x7164e2=util[_0x9104('0x30')](_0x9104('0x6a'),_0x1b2593['remoteUri'],_0x291bb3['id']);if(_0x3a43c9>0x6){_0x7164e2=util[_0x9104('0x30')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1b2593[_0x9104('0x57')],_0x291bb3['id']);}logger['info'](_0x9104('0x72'),_0x9104('0x6b'));emit(util[_0x9104('0x30')](_0x9104('0x6c'),_0x30b701[_0x9104('0xf')]),'trigger:browser:url',{'uri':_0x7164e2});})['catch'](function(_0x342fd6){logger[_0x9104('0x6e')](_0x9104('0x72'),JSON[_0x9104('0x2b')](_0x342fd6));});};exports[_0x9104('0x77')]=function(_0x11352f,_0x59c351,_0x482165,_0x2c630c,_0x3e6a6a,_0x226c21){var _0x13aa1b,_0x11945d,_0xd24db4,_0x2097a5;_0x226c21[_0x9104('0x57')]=intUtil[_0x9104('0x56')](_0x226c21['remoteUri']);_0x226c21['serverUrl']=intUtil[_0x9104('0x56')](_0x226c21[_0x9104('0x58')]);def[_0x9104('0x59')]=util[_0x9104('0x30')]('%s/service/v4_1/rest.php',_0x226c21[_0x9104('0x57')]);if(_0x3e6a6a&&_0x3e6a6a['monitor_format']){logger['info']('['+_0x59c351[_0x9104('0x78')][_0x9104('0x79')]()+']',_0x9104('0x5c'));_0x59c351[_0x9104('0x5d')]=util['format'](_0x9104('0x5e'),_0x226c21[_0x9104('0x58')],_0x59c351[_0x9104('0x5f')],md5(_0x59c351[_0x9104('0x5f')]));}else{_0x59c351[_0x9104('0x5d')]='';}return getConnection(_0x226c21)[_0x9104('0x32')](function(_0x5ccbc7){_0x2097a5=_0x5ccbc7;if(!_[_0x9104('0x2c')](_0x2c630c)){return getUser(_0x226c21,_0x2c630c[_0x9104('0xf')],_0x2097a5);}else{return getUser(_0x226c21,null,_0x2097a5);}})[_0x9104('0x32')](function(_0x43773e){_0x13aa1b=_0x43773e;logger[_0x9104('0xd')](_0x9104('0x73'),_0x13aa1b['id']);return getEndUser(_0x226c21,_0x59c351[_0x9104('0x60')],_0x59c351[_0x9104('0x61')],_0x2097a5);})[_0x9104('0x32')](function(_0xc844df){_0x11945d=_0xc844df;logger[_0x9104('0xd')](_0x9104('0x62'),_0x11945d['id']);return getTicket(_0x226c21,_0x13aa1b,_0x11945d,_0x482165,_0x59c351,_0x482165[_0x9104('0x63')],_0x2097a5,_0x9104('0x64'));})[_0x9104('0x32')](function(_0x2024ec){_0xd24db4=_0x2024ec;logger['info'](_0x9104('0x65'));logger['info'](_0x9104('0x66'),_0xd24db4['id']);return setRelationship(_0x2097a5,_0x13aa1b,_0xd24db4,'users');})['then'](function(){return setRelationship(_0x2097a5,_0x11945d,_0xd24db4,_0x9104('0x67'));})['then'](function(){return getServerInfo(_0x2097a5);})[_0x9104('0x6d')](function(_0x2a1632){logger['error']('['+_0x59c351[_0x9104('0x78')][_0x9104('0x79')]()+']',JSON[_0x9104('0x2b')](_0x2a1632));});}; \ 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 57a5276..8ec3765 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 _0x705c=['name','toLowerCase','keyValue','string','key','%s:\x20%s','keyContent','keyType','format','customVariable','join','stripTrailingSlash','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','Variable'];(function(_0x57cff6,_0x21e0ca){var _0x205fba=function(_0x45acd9){while(--_0x45acd9){_0x57cff6['push'](_0x57cff6['shift']());}};_0x205fba(++_0x21e0ca);}(_0x705c,0x103));var _0xc705=function(_0x1a95fe,_0x32252a){_0x1a95fe=_0x1a95fe-0x0;var _0x3f6733=_0x705c[_0x1a95fe];return _0x3f6733;};'use strict';var _=require(_0xc705('0x0'));var util=require(_0xc705('0x1'));exports[_0xc705('0x2')]=function(_0x2f6403,_0x448006,_0x145318){var _0x25cf8c=[];if(_0x2f6403[_0xc705('0x3')]>0x0){var _0x37e8e5=_[_0xc705('0x4')](_0x2f6403,['id']);for(var _0x3d59d0=0x0;_0x3d59d0<_0x37e8e5[_0xc705('0x3')];_0x3d59d0++){var _0x14dce9=_0x37e8e5[_0x3d59d0];if(_0x14dce9[_0xc705('0x5')]==='string'){_0x25cf8c[_0xc705('0x6')](_0x14dce9[_0xc705('0x7')]);}else if(_0x14dce9['type']===_0xc705('0x8')&&_0x14dce9[_0xc705('0x9')]){_0x448006[_0x14dce9[_0xc705('0x9')]]&&_0x25cf8c['push'](_0x448006[_0x14dce9['variableName']]['toString']());}else if(_0x14dce9[_0xc705('0x5')]==='customVariable'&&_0x14dce9[_0xc705('0xa')]&&_0x14dce9[_0xc705('0xa')][_0xc705('0xb')]){_0x448006[_0x14dce9[_0xc705('0xa')]['name']['toLowerCase']()]&&_0x25cf8c[_0xc705('0x6')](_0x448006[_0x14dce9[_0xc705('0xa')][_0xc705('0xb')][_0xc705('0xc')]()]['toString']());}else if(_0x14dce9['type']===_0xc705('0xd')){if(_0x14dce9['keyType']===_0xc705('0xe')&&_0x14dce9[_0xc705('0xf')]){_0x25cf8c[_0xc705('0x6')](util['format'](_0xc705('0x10'),_0x14dce9[_0xc705('0xf')],_0x14dce9[_0xc705('0x11')]));}else if(_0x14dce9[_0xc705('0x12')]===_0xc705('0x8')&&_0x14dce9[_0xc705('0x9')]&&_0x14dce9[_0xc705('0xf')]){_0x448006[_0x14dce9[_0xc705('0x9')]]&&_0x25cf8c[_0xc705('0x6')](util[_0xc705('0x13')](_0xc705('0x10'),_0x14dce9['key'],_0x448006[_0x14dce9[_0xc705('0x9')]]));}else if(_0x14dce9['keyType']===_0xc705('0x14')&&_0x14dce9[_0xc705('0xa')]&&_0x14dce9[_0xc705('0xa')][_0xc705('0xb')]&&_0x14dce9[_0xc705('0xf')]){_0x448006[_0x14dce9[_0xc705('0xa')][_0xc705('0xb')][_0xc705('0xc')]()]&&_0x25cf8c[_0xc705('0x6')](util[_0xc705('0x13')](_0xc705('0x10'),_0x14dce9['key'],_0x448006[_0x14dce9[_0xc705('0xa')][_0xc705('0xb')][_0xc705('0xc')]()]));}}}}return _0x25cf8c[_0xc705('0x15')](_0x145318);};exports[_0xc705('0x16')]=function(_0x1a4656){var _0x137d0c=_0x1a4656['slice'](-0x1);if(_0x137d0c==='/'){_0x1a4656=_0x1a4656[_0xc705('0x17')](0x0,_0x1a4656['lastIndexOf'](_0x137d0c));}return _0x1a4656;};exports[_0xc705('0x18')]=function(_0x5a8570){if(!_[_0xc705('0x19')](_0x5a8570)&&_0x5a8570!==''){var _0x51b87c=/^(([^<>()\[\]\\.,;:\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 _0x51b87c[_0xc705('0x1a')](String(_0x5a8570)[_0xc705('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xe941=['sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0xe941,0x14c));var _0x1e94=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe941[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1e94('0x0'));var util=require(_0x1e94('0x1'));exports[_0x1e94('0x2')]=function(_0x512ada,_0x12fc91,_0x34e458){var _0x5931bd=[];if(_0x512ada[_0x1e94('0x3')]>0x0){var _0x17b018=_[_0x1e94('0x4')](_0x512ada,['id']);for(var _0x2919cd=0x0;_0x2919cd<_0x17b018['length'];_0x2919cd++){var _0x54c7e7=_0x17b018[_0x2919cd];if(_0x54c7e7['type']===_0x1e94('0x5')){_0x5931bd[_0x1e94('0x6')](_0x54c7e7[_0x1e94('0x7')]);}else if(_0x54c7e7[_0x1e94('0x8')]===_0x1e94('0x9')&&_0x54c7e7[_0x1e94('0xa')]){_0x12fc91[_0x54c7e7[_0x1e94('0xa')]]&&_0x5931bd[_0x1e94('0x6')](_0x12fc91[_0x54c7e7[_0x1e94('0xa')]][_0x1e94('0xb')]());}else if(_0x54c7e7[_0x1e94('0x8')]===_0x1e94('0xc')&&_0x54c7e7[_0x1e94('0xd')]&&_0x54c7e7[_0x1e94('0xd')][_0x1e94('0xe')]){_0x12fc91[_0x54c7e7[_0x1e94('0xd')][_0x1e94('0xe')][_0x1e94('0xf')]()]&&_0x5931bd['push'](_0x12fc91[_0x54c7e7[_0x1e94('0xd')][_0x1e94('0xe')]['toLowerCase']()]['toString']());}else if(_0x54c7e7[_0x1e94('0x8')]===_0x1e94('0x10')){if(_0x54c7e7[_0x1e94('0x11')]===_0x1e94('0x5')&&_0x54c7e7[_0x1e94('0x12')]){_0x5931bd[_0x1e94('0x6')](util[_0x1e94('0x13')](_0x1e94('0x14'),_0x54c7e7['key'],_0x54c7e7['keyContent']));}else if(_0x54c7e7[_0x1e94('0x11')]===_0x1e94('0x9')&&_0x54c7e7[_0x1e94('0xa')]&&_0x54c7e7[_0x1e94('0x12')]){_0x12fc91[_0x54c7e7['variableName']]&&_0x5931bd['push'](util[_0x1e94('0x13')](_0x1e94('0x14'),_0x54c7e7[_0x1e94('0x12')],_0x12fc91[_0x54c7e7[_0x1e94('0xa')]]));}else if(_0x54c7e7[_0x1e94('0x11')]==='customVariable'&&_0x54c7e7[_0x1e94('0xd')]&&_0x54c7e7['Variable']['name']&&_0x54c7e7[_0x1e94('0x12')]){_0x12fc91[_0x54c7e7['Variable'][_0x1e94('0xe')]['toLowerCase']()]&&_0x5931bd[_0x1e94('0x6')](util[_0x1e94('0x13')]('%s:\x20%s',_0x54c7e7[_0x1e94('0x12')],_0x12fc91[_0x54c7e7[_0x1e94('0xd')]['name'][_0x1e94('0xf')]()]));}}}}return _0x5931bd['join'](_0x34e458);};exports[_0x1e94('0x15')]=function(_0x39c199){var _0x140960=_0x39c199[_0x1e94('0x16')](-0x1);if(_0x140960==='/'){_0x39c199=_0x39c199[_0x1e94('0x17')](0x0,_0x39c199[_0x1e94('0x18')](_0x140960));}return _0x39c199;};exports[_0x1e94('0x19')]=function(_0x2a160c){if(!_[_0x1e94('0x1a')](_0x2a160c)&&_0x2a160c!==''){var _0x2f37c7=/^(([^<>()\[\]\\.,;:\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 _0x2f37c7[_0x1e94('0x1b')](String(_0x2a160c)[_0x1e94('0xf')]());}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 143fb7e..8490c8a 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(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','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]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 c079d7a..eccf4b7 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 _0x759d=['The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','content','toString','custom_fields','push','variableName','idField','customVariable','Variable','name','customField','toLowerCase','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x759d,0x105));var _0xd759=function(_0x242f11,_0x5ef5da){_0x242f11=_0x242f11-0x0;var _0x514fae=_0x759d[_0x242f11];return _0x514fae;};'use strict';var _=require('lodash');var rp=require(_0xd759('0x0'));var md5=require(_0xd759('0x1'));var util=require(_0xd759('0x2'));var Redis=require(_0xd759('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd759('0x4'))(_0xd759('0x5'));config[_0xd759('0x6')]=_[_0xd759('0x7')](config['redis'],{'host':_0xd759('0x8'),'port':0x18eb});var io=require(_0xd759('0x9'))(new Redis(config[_0xd759('0x6')]));function emit(_0x2d0dc9,_0x289b55,_0x207ebe){io['to'](_0x2d0dc9)[_0xd759('0xa')](_0x289b55,_0x207ebe);}var headers={'Content-Type':_0xd759('0xb'),'Accept':_0xd759('0xb')};function getTicket(_0x500b2a,_0x558e17,_0x46571e,_0x130074,_0x5f387d){logger['info'](_0xd759('0xc'));return request({'uri':util[_0xd759('0xd')](_0xd759('0xe'),_0x500b2a[_0xd759('0xf')]),'method':'POST','body':{'ticket':_[_0xd759('0x10')]({'requester_id':_0x46571e['id'],'submitter_id':_0x558e17?_0x558e17['id']:undefined,'assignee_id':_0x558e17?_0x558e17['id']:undefined,'tags':getTags(_0x130074[_0xd759('0x11')],'name'),'subject':intUtil[_0xd759('0x12')](_0x130074[_0xd759('0x13')],_0x5f387d,'\x20'),'description':intUtil[_0xd759('0x12')](_0x130074[_0xd759('0x14')],_0x5f387d,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd759('0x12')](_0x130074['Descriptions'],_0x5f387d,'\x0a')}},getCustomFields(_0x130074[_0xd759('0x15')],_0x5f387d))}})['then'](function(_0x510a11){logger[_0xd759('0x16')](_0xd759('0x17'));return _0x510a11['ticket'];});}function getUser(_0x46774f,_0x3c8281){if(intUtil['validateEmail'](_0x3c8281)){logger[_0xd759('0x16')](_0xd759('0x18'),_0x3c8281);return request({'uri':util['format'](_0xd759('0x19'),_0x46774f[_0xd759('0xf')]),'qs':{'query':util[_0xd759('0xd')](_0xd759('0x1a'),_0x3c8281)}})[_0xd759('0x1b')](function(_0x5b0b5f){if(_0x5b0b5f['count']){logger['info'](_0xd759('0x1c'));return _[_0xd759('0x1d')](_0x5b0b5f['results'],{'email':_0x3c8281,'role':_0xd759('0x1e')});}else{logger[_0xd759('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x46774f[_0xd759('0xf')])})['then'](function(_0x18e6f9){logger[_0xd759('0x16')](_0xd759('0x1f'));return _0x18e6f9[_0xd759('0x20')];});}});}else{logger[_0xd759('0x16')](_0xd759('0x21'));return request({'uri':util[_0xd759('0xd')](_0xd759('0x22'),_0x46774f[_0xd759('0xf')])})['then'](function(_0x26330a){logger[_0xd759('0x16')](_0xd759('0x1f'));return _0x26330a['user'];});}}function getEndUser(_0x4fe3ea,_0x5e8889,_0x5bc360){logger[_0xd759('0x16')](_0xd759('0x23'),_0x5bc360);return request({'uri':util['format'](_0xd759('0x19'),_0x4fe3ea['remoteUri']),'qs':{'query':util[_0xd759('0xd')](_0xd759('0x24'),_0x5bc360)}})[_0xd759('0x1b')](function(_0x12940e){var _0x2b3f56;if(_0x12940e[_0xd759('0x25')][_0xd759('0x26')]){_0x12940e[_0xd759('0x25')]=_[_0xd759('0x27')](_0x12940e['results'],{'suspended':![],'role':_0xd759('0x28')});if(_0x12940e[_0xd759('0x25')][_0xd759('0x26')]){_0x2b3f56=_[_0xd759('0x29')](_0x12940e[_0xd759('0x25')]);}}if(_0x2b3f56){logger[_0xd759('0x16')]('Enduser\x20found!');return _0x2b3f56;}else{logger[_0xd759('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd759('0xd')](_0xd759('0x2a'),_0x4fe3ea[_0xd759('0xf')]),'method':_0xd759('0x2b'),'body':{'user':{'role':_0xd759('0x28'),'name':util[_0xd759('0xd')](_0xd759('0x2c'),_0x5e8889||_0x5bc360),'phone':_0x5bc360}}})['then'](function(_0x4adc67){logger['info'](_0xd759('0x2d'));return _0x4adc67[_0xd759('0x20')];});}});}function getAuth(_0x90ebd){var _0x2565e9;if(_0x90ebd[_0xd759('0x2e')]==='password'){_0x2565e9=util['format'](_0xd759('0x2f'),_0x90ebd[_0xd759('0x30')],_0x90ebd['password']);}else if(_0x90ebd['authType']===_0xd759('0x31')){_0x2565e9=util['format'](_0xd759('0x32'),_0x90ebd[_0xd759('0x30')],_0x90ebd[_0xd759('0x31')]);}return util['format'](_0xd759('0x33'),new Buffer(_0x2565e9)['toString'](_0xd759('0x34')));}function request(_0x54d02e){logger[_0xd759('0x35')](_0xd759('0x36'),JSON[_0xd759('0x37')](_0x54d02e));return rp(_['defaults'](_0x54d02e,{'method':_0xd759('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x328079,_0x4ac26f){var _0x504952=[];if(_0x328079&&_0x328079[_0xd759('0x26')]>0x0){_0x504952=_[_0xd759('0x39')](_0x328079,_0x4ac26f);}return _0x504952;}function getCustomFields(_0x5a975f,_0x2e64ce){var _0x237dd8=[];var _0x2596d3={'custom_fields':[]};if(_0x5a975f[_0xd759('0x26')]>0x0){_[_0xd759('0x3a')](_0x5a975f,function(_0x83e59b){if(_[_0xd759('0x3b')]([_0xd759('0x3c'),_0xd759('0x3d')],_0x83e59b[_0xd759('0x3e')])&&_0x83e59b[_0xd759('0x3f')]&&!_0x83e59b['customField']){_0x2596d3[_0x83e59b[_0xd759('0x3f')]['toLowerCase']()]=_0x83e59b[_0xd759('0x40')][_0xd759('0x41')]();}else if(_[_0xd759('0x3b')](['string',_0xd759('0x3d')],_0x83e59b['type'])&&_0x83e59b['idField']&&_0x83e59b['customField']){_0x2596d3[_0xd759('0x42')][_0xd759('0x43')]({'id':_0x83e59b['idField'],'value':_0x83e59b['content']['toString']()});}else if(_0x83e59b['type']==='variable'&&_0x83e59b[_0xd759('0x44')]&&_0x83e59b[_0xd759('0x45')]&&_0x83e59b['customField']){_0x2e64ce[_0x83e59b[_0xd759('0x44')]]&&_0x2596d3[_0xd759('0x42')][_0xd759('0x43')]({'id':_0x83e59b[_0xd759('0x45')],'value':_0x2e64ce[_0x83e59b[_0xd759('0x44')]][_0xd759('0x41')]()});}else if(_0x83e59b['type']===_0xd759('0x46')&&_0x83e59b[_0xd759('0x47')]&&_0x83e59b[_0xd759('0x47')][_0xd759('0x48')]&&_0x83e59b[_0xd759('0x45')]&&_0x83e59b[_0xd759('0x49')]){_0x2e64ce[_0x83e59b[_0xd759('0x47')][_0xd759('0x48')][_0xd759('0x4a')]()]&&_0x2596d3[_0xd759('0x42')][_0xd759('0x43')]({'id':_0x83e59b[_0xd759('0x45')],'value':_0x2e64ce[_0x83e59b[_0xd759('0x47')][_0xd759('0x48')][_0xd759('0x4a')]()]['toString']()});}});}return _0x2596d3;}exports[_0xd759('0x4b')]=function(_0x442c75,_0x2696a0,_0x48d864,_0x17327a,_0x323f20,_0x53c053){var _0x26b36c,_0x5313f9;_0x53c053[_0xd759('0xf')]=intUtil['stripTrailingSlash'](_0x53c053[_0xd759('0xf')]);_0x53c053['serverUrl']=intUtil['stripTrailingSlash'](_0x53c053['serverUrl']);if(_0x323f20&&_0x323f20[_0xd759('0x4c')]){logger[_0xd759('0x16')](_0xd759('0x4d'),_0xd759('0x4e'));_0x2696a0['recordingURL']=util[_0xd759('0xd')](_0xd759('0x4f'),_0x53c053['serverUrl'],_0x2696a0[_0xd759('0x50')],md5(_0x2696a0[_0xd759('0x50')]));}else{_0x2696a0[_0xd759('0x51')]='';}headers[_0xd759('0x52')]=getAuth(_0x53c053);return getUser(_0x53c053,_0x17327a[_0xd759('0x53')])['then'](function(_0x2b32cf){_0x26b36c=_0x2b32cf;logger[_0xd759('0x16')](_0xd759('0x54'),_0x26b36c['id']);return getEndUser(_0x53c053,_0x2696a0[_0xd759('0x55')],_0x2696a0[_0xd759('0x56')]);})['then'](function(_0x27e6fe){_0x5313f9=_0x27e6fe;logger[_0xd759('0x16')](_0xd759('0x57'),_0x5313f9['id']);return getTicket(_0x53c053,_0x26b36c,_0x5313f9,_0x48d864,_0x2696a0);})['then'](function(_0x5a50b0){if(_0x5a50b0){logger['info'](_0xd759('0x58'),_0x5a50b0['id']);switch(_0x53c053[_0xd759('0x3e')]){case'integrationTab':logger[_0xd759('0x16')](_0xd759('0x4d'),_0xd759('0x59'));return request({'uri':util[_0xd759('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x53c053[_0xd759('0xf')],_0x26b36c['id'],_0x5a50b0['id']),'method':_0xd759('0x2b')});case _0xd759('0x5a'):logger[_0xd759('0x16')](_0xd759('0x4d'),_0xd759('0x5b'));emit(util[_0xd759('0xd')](_0xd759('0x5c'),_0x17327a[_0xd759('0x48')]),_0xd759('0x5d'),{'uri':util['format'](_0xd759('0x5e'),_0x53c053[_0xd759('0xf')][_0xd759('0x5f')](_0xd759('0x60'),''),_0x5a50b0['id'])});break;default:logger[_0xd759('0x61')](_0xd759('0x4d'),_0xd759('0x62'));}}})[_0xd759('0x63')](function(_0x5cbb77){logger[_0xd759('0x61')](_0xd759('0x64'),util[_0xd759('0x65')](_0x5cbb77,{'showHidden':!![],'depth':null}));});};exports[_0xd759('0x66')]=function(_0xfbaade,_0xa2386b,_0x33e7f9,_0x5d4180,_0x4a6618,_0x4a1686,_0x428008){var _0x519dc5,_0xec55b;_0x4a1686[_0xd759('0xf')]=intUtil[_0xd759('0x67')](_0x4a1686[_0xd759('0xf')]);_0x4a1686[_0xd759('0x68')]=intUtil[_0xd759('0x67')](_0x4a1686[_0xd759('0x68')]);if(_0x428008&&_0x428008['recordingFormat']&&_0x428008[_0xd759('0x69')]!==_0xd759('0x6a')){logger[_0xd759('0x16')](_0xd759('0x6b'),_0xd759('0x4e'));_0xa2386b[_0xd759('0x51')]=util[_0xd759('0xd')](_0xd759('0x4f'),_0x4a1686[_0xd759('0x68')],_0xa2386b[_0xd759('0x50')],md5(_0xa2386b['uniqueid']));}headers[_0xd759('0x52')]=getAuth(_0x4a1686);return getUser(_0x4a1686,_0x5d4180[_0xd759('0x53')])[_0xd759('0x1b')](function(_0x1a4b9a){_0x519dc5=_0x1a4b9a;logger[_0xd759('0x16')](_0xd759('0x54'),_0x519dc5['id']);return getEndUser(_0x4a1686,_0xa2386b[_0xd759('0x6c')],_0xa2386b[_0xd759('0x6d')]);})['then'](function(_0x341d12){_0xec55b=_0x341d12;logger[_0xd759('0x16')](_0xd759('0x57'),_0xec55b['id']);return getTicket(_0x4a1686,_0x519dc5,_0xec55b,_0x33e7f9,_0xa2386b);})[_0xd759('0x1b')](function(_0x1e2e02){if(_0x1e2e02){logger[_0xd759('0x16')](_0xd759('0x58'),_0x1e2e02['id']);switch(_0x4a1686[_0xd759('0x3e')]){case _0xd759('0x6e'):logger[_0xd759('0x16')](_0xd759('0x6b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd759('0xd')](_0xd759('0x6f'),_0x4a1686[_0xd759('0xf')],_0x519dc5['id'],_0x1e2e02['id']),'method':_0xd759('0x2b')});case _0xd759('0x5a'):logger[_0xd759('0x16')](_0xd759('0x6b'),_0xd759('0x5b'));emit(util['format'](_0xd759('0x5c'),_0x5d4180[_0xd759('0x48')]),'trigger:browser:url',{'uri':util[_0xd759('0xd')](_0xd759('0x5e'),_0x4a1686[_0xd759('0xf')][_0xd759('0x5f')](_0xd759('0x60'),''),_0x1e2e02['id'])});break;default:logger[_0xd759('0x61')](_0xd759('0x6b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd759('0x63')](function(_0x5acdd1){logger[_0xd759('0x61')](_0xd759('0x70'),util['inspect'](_0x5acdd1,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3a1d13,_0x367c2a,_0x597f3b,_0x330be3,_0x5c1f59,_0x1d4d25){var _0x1798b3,_0x2abc2a;_0x1d4d25[_0xd759('0xf')]=intUtil[_0xd759('0x67')](_0x1d4d25[_0xd759('0xf')]);_0x1d4d25[_0xd759('0x68')]=intUtil[_0xd759('0x67')](_0x1d4d25[_0xd759('0x68')]);if(_0x5c1f59&&_0x5c1f59['monitor_format']){logger[_0xd759('0x16')]('['+_0x367c2a[_0xd759('0x71')][_0xd759('0x72')]()+']',_0xd759('0x4e'));_0x367c2a['recordingURL']=util[_0xd759('0xd')](_0xd759('0x4f'),_0x1d4d25['serverUrl'],_0x367c2a['uniqueid'],md5(_0x367c2a[_0xd759('0x50')]));}else{_0x367c2a[_0xd759('0x51')]='';}headers['Authorization']=getAuth(_0x1d4d25);return getUser(_0x1d4d25)[_0xd759('0x1b')](function(_0x4e1a7f){_0x1798b3=_0x4e1a7f;logger[_0xd759('0x16')](_0xd759('0x54'),_0x1798b3['id']);return getEndUser(_0x1d4d25,_0x367c2a[_0xd759('0x55')],_0x367c2a[_0xd759('0x56')]);})[_0xd759('0x1b')](function(_0xeaaf86){_0x2abc2a=_0xeaaf86;logger[_0xd759('0x16')](_0xd759('0x57'),_0x2abc2a['id']);return getTicket(_0x1d4d25,_0x1798b3,_0x2abc2a,_0x597f3b,_0x367c2a);})[_0xd759('0x1b')](function(_0x5a10ac){if(_0x5a10ac){logger['info'](_0xd759('0x58'),_0x5a10ac['id']);}})[_0xd759('0x63')](function(_0x488efe){logger[_0xd759('0x61')]('['+_0x367c2a[_0xd759('0x71')][_0xd759('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xd759('0x65')](_0x488efe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0049=['authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','customField','custom_fields','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','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','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','newTab','/api/v2','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','application/json','format','%s/tickets.json','POST','merge','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x444ef9,_0x5d1b9f){var _0x586574=function(_0xceb7a4){while(--_0xceb7a4){_0x444ef9['push'](_0x444ef9['shift']());}};_0x586574(++_0x5d1b9f);}(_0x0049,0x18d));var _0x9004=function(_0x4e2c6d,_0x578afe){_0x4e2c6d=_0x4e2c6d-0x0;var _0x5af7ff=_0x0049[_0x4e2c6d];return _0x5af7ff;};'use strict';var _=require(_0x9004('0x0'));var rp=require(_0x9004('0x1'));var md5=require(_0x9004('0x2'));var util=require(_0x9004('0x3'));var Redis=require(_0x9004('0x4'));var intUtil=require(_0x9004('0x5'));var config=require(_0x9004('0x6'));var logger=require('../../../../config/logger')('zendesk');config[_0x9004('0x7')]=_[_0x9004('0x8')](config[_0x9004('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9004('0x9'))(new Redis(config[_0x9004('0x7')]));function emit(_0x5a6ed1,_0x376993,_0x5bc9fc){io['to'](_0x5a6ed1)[_0x9004('0xa')](_0x376993,_0x5bc9fc);}var headers={'Content-Type':_0x9004('0xb'),'Accept':_0x9004('0xb')};function getTicket(_0x29d4c5,_0x243636,_0x3f2073,_0x2187a8,_0x1e24c9){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x9004('0xc')](_0x9004('0xd'),_0x29d4c5['remoteUri']),'method':_0x9004('0xe'),'body':{'ticket':_[_0x9004('0xf')]({'requester_id':_0x3f2073['id'],'submitter_id':_0x243636?_0x243636['id']:undefined,'assignee_id':_0x243636?_0x243636['id']:undefined,'tags':getTags(_0x2187a8[_0x9004('0x10')],_0x9004('0x11')),'subject':intUtil[_0x9004('0x12')](_0x2187a8['Subjects'],_0x1e24c9,'\x20'),'description':intUtil[_0x9004('0x12')](_0x2187a8[_0x9004('0x13')],_0x1e24c9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9004('0x12')](_0x2187a8['Descriptions'],_0x1e24c9,'\x0a')}},getCustomFields(_0x2187a8[_0x9004('0x14')],_0x1e24c9))}})[_0x9004('0x15')](function(_0x1d9413){logger[_0x9004('0x16')](_0x9004('0x17'));return _0x1d9413[_0x9004('0x18')];});}function getUser(_0x5dda39,_0x5f3dcf){if(intUtil[_0x9004('0x19')](_0x5f3dcf)){logger['info'](_0x9004('0x1a'),_0x5f3dcf);return request({'uri':util[_0x9004('0xc')](_0x9004('0x1b'),_0x5dda39[_0x9004('0x1c')]),'qs':{'query':util['format'](_0x9004('0x1d'),_0x5f3dcf)}})[_0x9004('0x15')](function(_0x5134ed){if(_0x5134ed[_0x9004('0x1e')]){logger[_0x9004('0x16')]('Agent\x20found!');return _[_0x9004('0x1f')](_0x5134ed[_0x9004('0x20')],{'email':_0x5f3dcf,'role':'agent'});}else{logger['info'](_0x9004('0x21'));return request({'uri':util[_0x9004('0xc')](_0x9004('0x22'),_0x5dda39[_0x9004('0x1c')])})[_0x9004('0x15')](function(_0x21d50e){logger[_0x9004('0x16')](_0x9004('0x23'));return _0x21d50e[_0x9004('0x24')];});}});}else{logger[_0x9004('0x16')](_0x9004('0x21'));return request({'uri':util[_0x9004('0xc')](_0x9004('0x22'),_0x5dda39[_0x9004('0x1c')])})[_0x9004('0x15')](function(_0x341005){logger[_0x9004('0x16')](_0x9004('0x23'));return _0x341005['user'];});}}function getEndUser(_0x5c9785,_0x285a65,_0x4ba3f5){logger['info'](_0x9004('0x25'),_0x4ba3f5);return request({'uri':util[_0x9004('0xc')](_0x9004('0x1b'),_0x5c9785[_0x9004('0x1c')]),'qs':{'query':util[_0x9004('0xc')](_0x9004('0x26'),_0x4ba3f5)}})[_0x9004('0x15')](function(_0xa1ab1){var _0x19168d;if(_0xa1ab1[_0x9004('0x20')]['length']){_0xa1ab1['results']=_[_0x9004('0x27')](_0xa1ab1[_0x9004('0x20')],{'suspended':![],'role':'end-user'});if(_0xa1ab1[_0x9004('0x20')][_0x9004('0x28')]){_0x19168d=_[_0x9004('0x29')](_0xa1ab1[_0x9004('0x20')]);}}if(_0x19168d){logger['info'](_0x9004('0x2a'));return _0x19168d;}else{logger[_0x9004('0x16')](_0x9004('0x2b'));return request({'uri':util[_0x9004('0xc')](_0x9004('0x2c'),_0x5c9785[_0x9004('0x1c')]),'method':_0x9004('0xe'),'body':{'user':{'role':'end-user','name':util[_0x9004('0xc')](_0x9004('0x2d'),_0x285a65||_0x4ba3f5),'phone':_0x4ba3f5}}})[_0x9004('0x15')](function(_0x40c70e){logger['info'](_0x9004('0x2e'));return _0x40c70e['user'];});}});}function getAuth(_0x5e02af){var _0x2f69dd;if(_0x5e02af[_0x9004('0x2f')]===_0x9004('0x30')){_0x2f69dd=util[_0x9004('0xc')](_0x9004('0x31'),_0x5e02af[_0x9004('0x32')],_0x5e02af['password']);}else if(_0x5e02af['authType']===_0x9004('0x33')){_0x2f69dd=util[_0x9004('0xc')](_0x9004('0x34'),_0x5e02af[_0x9004('0x32')],_0x5e02af[_0x9004('0x33')]);}return util['format'](_0x9004('0x35'),new Buffer(_0x2f69dd)['toString'](_0x9004('0x36')));}function request(_0xc516ea){logger['debug'](_0x9004('0x37'),JSON[_0x9004('0x38')](_0xc516ea));return rp(_[_0x9004('0x8')](_0xc516ea,{'method':_0x9004('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x5cc8fc,_0x1767c2){var _0x1aae14=[];if(_0x5cc8fc&&_0x5cc8fc[_0x9004('0x28')]>0x0){_0x1aae14=_[_0x9004('0x3a')](_0x5cc8fc,_0x1767c2);}return _0x1aae14;}function getCustomFields(_0x1f1825,_0x20296a){var _0x29de6d=[];var _0x119e59={'custom_fields':[]};if(_0x1f1825[_0x9004('0x28')]>0x0){_[_0x9004('0x3b')](_0x1f1825,function(_0x4b7794){if(_[_0x9004('0x3c')]([_0x9004('0x3d'),_0x9004('0x3e')],_0x4b7794[_0x9004('0x3f')])&&_0x4b7794['nameField']&&!_0x4b7794['customField']){_0x119e59[_0x4b7794[_0x9004('0x40')][_0x9004('0x41')]()]=_0x4b7794[_0x9004('0x42')][_0x9004('0x43')]();}else if(_[_0x9004('0x3c')]([_0x9004('0x3d'),_0x9004('0x3e')],_0x4b7794['type'])&&_0x4b7794['idField']&&_0x4b7794[_0x9004('0x44')]){_0x119e59[_0x9004('0x45')][_0x9004('0x46')]({'id':_0x4b7794[_0x9004('0x47')],'value':_0x4b7794[_0x9004('0x42')][_0x9004('0x43')]()});}else if(_0x4b7794[_0x9004('0x3f')]==='variable'&&_0x4b7794[_0x9004('0x48')]&&_0x4b7794[_0x9004('0x47')]&&_0x4b7794['customField']){_0x20296a[_0x4b7794[_0x9004('0x48')]]&&_0x119e59['custom_fields'][_0x9004('0x46')]({'id':_0x4b7794[_0x9004('0x47')],'value':_0x20296a[_0x4b7794[_0x9004('0x48')]]['toString']()});}else if(_0x4b7794[_0x9004('0x3f')]===_0x9004('0x49')&&_0x4b7794[_0x9004('0x4a')]&&_0x4b7794[_0x9004('0x4a')]['name']&&_0x4b7794['idField']&&_0x4b7794[_0x9004('0x44')]){_0x20296a[_0x4b7794[_0x9004('0x4a')]['name']['toLowerCase']()]&&_0x119e59[_0x9004('0x45')][_0x9004('0x46')]({'id':_0x4b7794[_0x9004('0x47')],'value':_0x20296a[_0x4b7794[_0x9004('0x4a')][_0x9004('0x11')][_0x9004('0x41')]()][_0x9004('0x43')]()});}});}return _0x119e59;}exports[_0x9004('0x4b')]=function(_0x3e4fa0,_0x32cf62,_0x4ebc01,_0x12b7c3,_0x46e5e8,_0x1cb1c6){var _0x1a2c99,_0x23a974;_0x1cb1c6[_0x9004('0x1c')]=intUtil['stripTrailingSlash'](_0x1cb1c6[_0x9004('0x1c')]);_0x1cb1c6['serverUrl']=intUtil[_0x9004('0x4c')](_0x1cb1c6[_0x9004('0x4d')]);if(_0x46e5e8&&_0x46e5e8[_0x9004('0x4e')]){logger[_0x9004('0x16')](_0x9004('0x4f'),_0x9004('0x50'));_0x32cf62[_0x9004('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cb1c6[_0x9004('0x4d')],_0x32cf62[_0x9004('0x52')],md5(_0x32cf62['uniqueid']));}else{_0x32cf62['recordingURL']='';}headers[_0x9004('0x53')]=getAuth(_0x1cb1c6);return getUser(_0x1cb1c6,_0x12b7c3[_0x9004('0x54')])[_0x9004('0x15')](function(_0x40a13f){_0x1a2c99=_0x40a13f;logger[_0x9004('0x16')](_0x9004('0x55'),_0x1a2c99['id']);return getEndUser(_0x1cb1c6,_0x32cf62['calleridname'],_0x32cf62[_0x9004('0x56')]);})[_0x9004('0x15')](function(_0x1a3eb7){_0x23a974=_0x1a3eb7;logger[_0x9004('0x16')]('The\x20Enduser\x20ID\x20is:',_0x23a974['id']);return getTicket(_0x1cb1c6,_0x1a2c99,_0x23a974,_0x4ebc01,_0x32cf62);})[_0x9004('0x15')](function(_0x51db7c){if(_0x51db7c){logger[_0x9004('0x16')](_0x9004('0x57'),_0x51db7c['id']);switch(_0x1cb1c6[_0x9004('0x3f')]){case _0x9004('0x58'):logger[_0x9004('0x16')](_0x9004('0x4f'),_0x9004('0x59'));return request({'uri':util['format'](_0x9004('0x5a'),_0x1cb1c6[_0x9004('0x1c')],_0x1a2c99['id'],_0x51db7c['id']),'method':_0x9004('0xe')});case'newTab':logger[_0x9004('0x16')](_0x9004('0x4f'),_0x9004('0x5b'));emit(util['format'](_0x9004('0x5c'),_0x12b7c3[_0x9004('0x11')]),_0x9004('0x5d'),{'uri':util[_0x9004('0xc')]('%s/agent/tickets/%s',_0x1cb1c6[_0x9004('0x1c')][_0x9004('0x5e')]('/api/v2',''),_0x51db7c['id'])});break;default:logger[_0x9004('0x5f')]('[QUEUE]',_0x9004('0x60'));}}})[_0x9004('0x61')](function(_0x3c31f4){logger[_0x9004('0x5f')](_0x9004('0x62'),util[_0x9004('0x63')](_0x3c31f4,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x6d0373,_0x3446c7,_0x195e27,_0x33c0b3,_0x2c350e,_0x545026,_0x48afb7){var _0x46457b,_0x496d84;_0x545026[_0x9004('0x1c')]=intUtil[_0x9004('0x4c')](_0x545026[_0x9004('0x1c')]);_0x545026[_0x9004('0x4d')]=intUtil['stripTrailingSlash'](_0x545026[_0x9004('0x4d')]);if(_0x48afb7&&_0x48afb7[_0x9004('0x64')]&&_0x48afb7[_0x9004('0x64')]!==_0x9004('0x65')){logger[_0x9004('0x16')](_0x9004('0x66'),_0x9004('0x50'));_0x3446c7[_0x9004('0x51')]=util[_0x9004('0xc')](_0x9004('0x67'),_0x545026['serverUrl'],_0x3446c7[_0x9004('0x52')],md5(_0x3446c7[_0x9004('0x52')]));}headers['Authorization']=getAuth(_0x545026);return getUser(_0x545026,_0x33c0b3['email'])[_0x9004('0x15')](function(_0x55c3d6){_0x46457b=_0x55c3d6;logger['info'](_0x9004('0x55'),_0x46457b['id']);return getEndUser(_0x545026,_0x3446c7['destcalleridname'],_0x3446c7[_0x9004('0x68')]);})[_0x9004('0x15')](function(_0x1bdae7){_0x496d84=_0x1bdae7;logger['info'](_0x9004('0x69'),_0x496d84['id']);return getTicket(_0x545026,_0x46457b,_0x496d84,_0x195e27,_0x3446c7);})[_0x9004('0x15')](function(_0x51edf5){if(_0x51edf5){logger['info'](_0x9004('0x57'),_0x51edf5['id']);switch(_0x545026[_0x9004('0x3f')]){case _0x9004('0x58'):logger[_0x9004('0x16')](_0x9004('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9004('0xc')](_0x9004('0x5a'),_0x545026['remoteUri'],_0x46457b['id'],_0x51edf5['id']),'method':_0x9004('0xe')});case _0x9004('0x6a'):logger[_0x9004('0x16')](_0x9004('0x66'),_0x9004('0x5b'));emit(util[_0x9004('0xc')](_0x9004('0x5c'),_0x33c0b3['name']),_0x9004('0x5d'),{'uri':util[_0x9004('0xc')]('%s/agent/tickets/%s',_0x545026[_0x9004('0x1c')][_0x9004('0x5e')](_0x9004('0x6b'),''),_0x51edf5['id'])});break;default:logger[_0x9004('0x5f')](_0x9004('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x9004('0x61')](function(_0x53cd3e){logger[_0x9004('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x53cd3e,{'showHidden':!![],'depth':null}));});};exports[_0x9004('0x6c')]=function(_0x30085d,_0x304ed3,_0x24d0e8,_0x20f227,_0x5eb4f8,_0x1fe501){var _0x3a7155,_0x588c9d;_0x1fe501['remoteUri']=intUtil[_0x9004('0x4c')](_0x1fe501['remoteUri']);_0x1fe501[_0x9004('0x4d')]=intUtil[_0x9004('0x4c')](_0x1fe501['serverUrl']);if(_0x5eb4f8&&_0x5eb4f8[_0x9004('0x4e')]){logger['info']('['+_0x304ed3[_0x9004('0x6d')]['toUpperCase']()+']',_0x9004('0x50'));_0x304ed3[_0x9004('0x51')]=util[_0x9004('0xc')](_0x9004('0x67'),_0x1fe501[_0x9004('0x4d')],_0x304ed3[_0x9004('0x52')],md5(_0x304ed3['uniqueid']));}else{_0x304ed3[_0x9004('0x51')]='';}headers[_0x9004('0x53')]=getAuth(_0x1fe501);return getUser(_0x1fe501)['then'](function(_0x6789c2){_0x3a7155=_0x6789c2;logger[_0x9004('0x16')](_0x9004('0x55'),_0x3a7155['id']);return getEndUser(_0x1fe501,_0x304ed3['calleridname'],_0x304ed3[_0x9004('0x56')]);})[_0x9004('0x15')](function(_0x41658e){_0x588c9d=_0x41658e;logger[_0x9004('0x16')]('The\x20Enduser\x20ID\x20is:',_0x588c9d['id']);return getTicket(_0x1fe501,_0x3a7155,_0x588c9d,_0x24d0e8,_0x304ed3);})['then'](function(_0x5b3e34){if(_0x5b3e34){logger[_0x9004('0x16')](_0x9004('0x57'),_0x5b3e34['id']);}})['catch'](function(_0xa917a2){logger[_0x9004('0x5f')]('['+_0x304ed3[_0x9004('0x6d')][_0x9004('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xa917a2,{'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 c502f24..9a45ddd 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 _0xd1d4=['user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','Call_Type','merge','Fields','code','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','destcalleridname','Outbound','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','Using\x20the\x20admin\x20account!','findIndex','users','Administrator'];(function(_0x1eb24f,_0x5229b6){var _0x23594a=function(_0x57c5d2){while(--_0x57c5d2){_0x1eb24f['push'](_0x1eb24f['shift']());}};_0x23594a(++_0x5229b6);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xd1d4[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x4d1d('0x0'));var rp=require(_0x4d1d('0x1'));var md5=require('md5');var util=require(_0x4d1d('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x4d1d('0x3'));var BPromise=require(_0x4d1d('0x4'));var config=require(_0x4d1d('0x5'));var logger=require(_0x4d1d('0x6'))(_0x4d1d('0x7'));config[_0x4d1d('0x8')]=_[_0x4d1d('0x9')](config[_0x4d1d('0x8')],{'host':_0x4d1d('0xa'),'port':0x18eb});var io=require(_0x4d1d('0xb'))(new Redis(config[_0x4d1d('0x8')]));function emit(_0x54da0f,_0x4d6679,_0x26fbcf){io['to'](_0x54da0f)[_0x4d1d('0xc')](_0x4d6679,_0x26fbcf);}function request(_0x52cbbf){logger[_0x4d1d('0xd')](_0x4d1d('0xe'),JSON[_0x4d1d('0xf')](_0x52cbbf));return rp(_0x52cbbf);}function getCustomFields(_0x248db3,_0x2d4e00){var _0x1d8ca8={};if(_0x248db3[_0x4d1d('0x10')]>0x0){_[_0x4d1d('0x11')](_0x248db3,function(_0xa12ed9){if(_[_0x4d1d('0x12')]([_0x4d1d('0x13'),_0x4d1d('0x14')],_0xa12ed9[_0x4d1d('0x15')])&&_0xa12ed9['idField']){_0x1d8ca8[_0xa12ed9[_0x4d1d('0x16')]]=_0xa12ed9[_0x4d1d('0x17')][_0x4d1d('0x18')]();}else if(_0xa12ed9[_0x4d1d('0x15')]==='variable'&&_0xa12ed9['variableName']&&_0xa12ed9[_0x4d1d('0x16')]&&_0x2d4e00[_0xa12ed9[_0x4d1d('0x19')]]){_0x1d8ca8[_0xa12ed9[_0x4d1d('0x16')]]=_0x2d4e00[_0xa12ed9['variableName']][_0x4d1d('0x18')]();}else if(_0xa12ed9[_0x4d1d('0x15')]===_0x4d1d('0x1a')&&_0xa12ed9[_0x4d1d('0x1b')]&&_0xa12ed9['Variable']['name']&&_0xa12ed9['idField']&&_0x2d4e00[_0xa12ed9[_0x4d1d('0x1b')][_0x4d1d('0x1c')][_0x4d1d('0x1d')]()]){_0x1d8ca8[_0xa12ed9[_0x4d1d('0x16')]]=_0x2d4e00[_0xa12ed9[_0x4d1d('0x1b')]['name'][_0x4d1d('0x1d')]()][_0x4d1d('0x18')]();}});}return _0x1d8ca8;}function getName(_0x40250e){if(_0x40250e[_0x4d1d('0x1e')]('\x20')>0x0){var _0x10c894=_0x40250e[_0x4d1d('0x1f')](/ (.+)/);if(_0x10c894[0x1]){return _0x10c894;}}return[_0x40250e,_0x40250e];}var accountsTokens={};function getAccessToken(_0x1a5dae){return new Promise(function(_0x5a325c,_0x866ad8){if(!_['isNil'](accountsTokens[_0x1a5dae['id']])&&!_[_0x4d1d('0x20')](accountsTokens[_0x1a5dae['id']][_0x4d1d('0x21')])){if(moment()[_0x4d1d('0x22')](accountsTokens[_0x1a5dae['id']][_0x4d1d('0x23')])){_0x5a325c(accountsTokens[_0x1a5dae['id']][_0x4d1d('0x21')]);}}var _0x2e0b46;switch(_0x1a5dae[_0x4d1d('0x24')]){case'US':_0x2e0b46='https://accounts.zoho.com';break;case'AU':_0x2e0b46=_0x4d1d('0x25');break;case'EU':_0x2e0b46=_0x4d1d('0x26');break;case'IN':_0x2e0b46=_0x4d1d('0x27');break;case'CN':_0x2e0b46=_0x4d1d('0x28');break;default:_0x2e0b46=_0x4d1d('0x26');break;}var _0x50e7b0={'method':_0x4d1d('0x29'),'uri':_0x2e0b46+_0x4d1d('0x2a'),'qs':{'refresh_token':_0x1a5dae[_0x4d1d('0x2b')],'client_id':_0x1a5dae[_0x4d1d('0x2c')],'client_secret':_0x1a5dae[_0x4d1d('0x2d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x50e7b0)[_0x4d1d('0x2e')](function(_0x58ac25){accountsTokens[_0x1a5dae['id']]={'access_token':_0x58ac25[_0x4d1d('0x21')],'expires_in':moment()[_0x4d1d('0x2f')](_0x58ac25[_0x4d1d('0x23')],_0x4d1d('0x30'))};_0x5a325c(_0x58ac25[_0x4d1d('0x21')]);})[_0x4d1d('0x31')](function(_0x54e905){logger[_0x4d1d('0x32')](_0x4d1d('0x33'),_0x54e905[_0x4d1d('0x34')]);_0x866ad8(_0x54e905);});});}function getUser(_0x558888,_0x3c84b9,_0x380e9b,_0x5f0bec){logger[_0x4d1d('0x35')](_0x4d1d('0x36'));return request({'method':_0x4d1d('0x37'),'uri':util[_0x4d1d('0x38')](_0x4d1d('0x39'),_0x3c84b9),'qs':{'type':_0x4d1d('0x3a')},'headers':{'Authorization':_0x4d1d('0x3b')+_0x558888},'json':!![]})[_0x4d1d('0x2e')](function(_0x4bf86c){if(_0x4bf86c['users']){var _0x2276d3=-0x1;if(_[_0x4d1d('0x3c')](_0x4bf86c['users'])){if(!_[_0x4d1d('0x20')](_0x5f0bec)){_0x2276d3=_['findIndex'](_0x4bf86c['users'],function(_0x243007){return _0x243007['email']===_0x5f0bec;});}if(_0x2276d3>=0x0){logger[_0x4d1d('0x35')]('Agent\x20found!');}else{logger['info'](_0x4d1d('0x3d'));_0x2276d3=_[_0x4d1d('0x3e')](_0x4bf86c[_0x4d1d('0x3f')],function(_0x1dbf43){return _0x1dbf43['profile']['name']===_0x4d1d('0x40');});}return _0x4bf86c[_0x4d1d('0x3f')][_0x2276d3];}else{if(_0x4bf86c[_0x4d1d('0x41')][_0x4d1d('0x42')][_0x4d1d('0x1c')]===_0x4d1d('0x40')){logger['info'](_0x4d1d('0x3d'));user=_0x4bf86c[_0x4d1d('0x41')];return user;}else{logger[_0x4d1d('0x32')](_0x4d1d('0x43'),JSON[_0x4d1d('0xf')](_0x4bf86c));throw new Error(_0x4d1d('0x44')+JSON['stringify'](_0x4bf86c));}}}else{logger[_0x4d1d('0x32')](_0x4d1d('0x43'),JSON[_0x4d1d('0xf')](_0x4bf86c));throw new Error(_0x4d1d('0x44')+JSON['stringify'](_0x4bf86c));}})[_0x4d1d('0x31')](function(_0x1560d4){console['error'](_0x1560d4);});}function getZohoUser(_0x4f8bcb,_0x885ba4){return new BPromise(function(_0x1fd29b,_0x4dc6ef){request(_0x4f8bcb)[_0x4d1d('0x2e')](function(_0x131607){var _0x168021=null;if(_0x131607){_0x168021=_0x131607[_0x4d1d('0x45')][0x0];_0x168021[_0x4d1d('0x46')]=_0x885ba4;}_0x1fd29b(_0x168021);})[_0x4d1d('0x31')](function(_0x2860f9){_0x4dc6ef(_0x2860f9);});});}function createEndUser(_0x2a8ada,_0x1b4a25,_0x249ecc,_0x40e449,_0x490d6b,_0x440788){var _0x249ecc=getName(_0x249ecc);return request({'method':_0x4d1d('0x29'),'uri':'https://www.zohoapis.'+_0x1b4a25+_0x4d1d('0x47')+_[_0x4d1d('0x48')](_0x440788[_0x4d1d('0x49')])+'s','body':{'data':[{'Last_Name':_0x249ecc[0x1],'First_Name':_0x249ecc[0x0],'Phone':_0x40e449,'Owner':{'name':!_[_0x4d1d('0x20')](_0x490d6b[_0x4d1d('0x4a')][_0x4d1d('0x1c')])?_0x490d6b['role'][_0x4d1d('0x1c')]:!_[_0x4d1d('0x20')](_0x490d6b[_0x4d1d('0x4b')])?_0x490d6b['first_name']+'\x20'+_0x490d6b['last_name']:_0x490d6b[_0x4d1d('0x4c')],'id':_0x490d6b['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2a8ada},'json':!![]})[_0x4d1d('0x2e')](function(_0x19e35a){if(_0x19e35a&&_0x19e35a['data'][0x0]['code']===_0x4d1d('0x4d')){var _0x2611a5=_0x19e35a[_0x4d1d('0x45')][0x0][_0x4d1d('0x4e')];_0x2611a5[_0x4d1d('0x46')]=_['startCase'](_0x440788[_0x4d1d('0x49')])+'s';return _0x2611a5;}logger[_0x4d1d('0x32')](_0x4d1d('0x43'),JSON[_0x4d1d('0xf')](data));throw new Error('Error:\x20'+JSON[_0x4d1d('0xf')](data));})[_0x4d1d('0x31')](function(_0x1a153c){console[_0x4d1d('0x4f')](_0x4d1d('0x50'),_0x1a153c);});}function getEndUser(_0x44f131,_0x4cc8a6,_0x3ac21a,_0x3b4fd8,_0x1d91e9,_0x3b20ec,_0x322b25){var _0x2ac778={'method':_0x4d1d('0x37'),'uri':'','headers':{'Authorization':_0x4d1d('0x3b')+_0x44f131},'json':!![]};switch(_0x322b25['moduleSearch']){case _0x4d1d('0x51'):_0x2ac778['uri']=_0x4d1d('0x52')+_0x4cc8a6+_0x4d1d('0x53')+_0x1d91e9+'))';return getZohoUser(_0x2ac778,_0x4d1d('0x54'))['then'](function(_0x48f89d){if(_0x48f89d)return _0x48f89d;_0x2ac778[_0x4d1d('0x55')]=_0x4d1d('0x52')+_0x4cc8a6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1d91e9+'))';return getZohoUser(_0x2ac778,_0x4d1d('0x56'))[_0x4d1d('0x2e')](function(_0x143e13){if(_0x143e13)return _0x143e13;if(_0x322b25[_0x4d1d('0x49')]!=_0x4d1d('0x57')){return createEndUser(_0x44f131,_0x4cc8a6,_0x3b4fd8,_0x1d91e9,_0x3b20ec,_0x322b25);}else{return{};}});});break;case'contact':_0x2ac778[_0x4d1d('0x55')]='https://www.zohoapis.'+_0x4cc8a6+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1d91e9+'))';return getZohoUser(_0x2ac778,_0x4d1d('0x54'))[_0x4d1d('0x2e')](function(_0xa218ee){if(_0xa218ee)return _0xa218ee;if(_0x322b25[_0x4d1d('0x49')]!=_0x4d1d('0x57')){return createEndUser(_0x44f131,_0x4cc8a6,_0x3b4fd8,_0x1d91e9,_0x3b20ec,_0x322b25);}else{return{};}});break;case _0x4d1d('0x58'):_0x2ac778['uri']=_0x4d1d('0x52')+_0x4cc8a6+_0x4d1d('0x59')+_0x1d91e9+'))';return getZohoUser(_0x2ac778,'Leads')[_0x4d1d('0x2e')](function(_0x1f5923){if(_0x1f5923)return _0x1f5923;if(_0x322b25[_0x4d1d('0x49')]!=_0x4d1d('0x57')){return createEndUser(_0x44f131,_0x4cc8a6,_0x3b4fd8,_0x1d91e9,_0x3b20ec,_0x322b25);}else{return{};}});break;}}function getCall(_0x576d60,_0x30378f,_0xfeca9e,_0x2fd491,_0x12b9ce,_0x16d63b,_0x61acde,_0x58a58c){logger['info'](_0x4d1d('0x5a'));var _0x2061de={};_0x2061de[_0x4d1d('0x5b')]={'name':!_[_0x4d1d('0x20')](_0x2fd491['role']['name'])&&!_[_0x4d1d('0x20')](_0x2fd491[_0x4d1d('0x42')][_0x4d1d('0x1c')])&&_0x2fd491[_0x4d1d('0x42')][_0x4d1d('0x1c')]===_0x4d1d('0x5c')?_0x2fd491[_0x4d1d('0x4a')][_0x4d1d('0x1c')]:!_[_0x4d1d('0x20')](_0x2fd491[_0x4d1d('0x4b')])?_0x2fd491[_0x4d1d('0x4b')]+'\x20'+_0x2fd491['last_name']:_0x2fd491[_0x4d1d('0x4c')],'id':_0x2fd491['id']};_0x2061de[_0x4d1d('0x5d')]=intUtil[_0x4d1d('0x5e')](_0x16d63b[_0x4d1d('0x5f')],_0x61acde,'\x20');_0x2061de[_0x4d1d('0x60')]=intUtil[_0x4d1d('0x5e')](_0x16d63b[_0x4d1d('0x61')],_0x61acde,'\x0a');if(_0x12b9ce[_0x4d1d('0x46')]==='Contacts'){_0x2061de[_0x4d1d('0x62')]={'name':!_[_0x4d1d('0x20')](_0x12b9ce['Full_Name'])?_0x12b9ce[_0x4d1d('0x63')]:!_[_0x4d1d('0x20')](_0x12b9ce[_0x4d1d('0x64')])?_0x12b9ce['First_Name']+'\x20'+_0x12b9ce[_0x4d1d('0x65')]:_0x12b9ce[_0x4d1d('0x65')],'id':_0x12b9ce['id']};}if(_0x12b9ce[_0x4d1d('0x46')]===_0x4d1d('0x56')){_0x2061de[_0x4d1d('0x66')]={'name':!_[_0x4d1d('0x20')](_0x12b9ce['Full_Name'])?_0x12b9ce['Full_Name']:!_[_0x4d1d('0x20')](_0x12b9ce['First_Name'])?_0x12b9ce[_0x4d1d('0x64')]+'\x20'+_0x12b9ce[_0x4d1d('0x65')]:_0x12b9ce[_0x4d1d('0x65')],'id':_0x12b9ce['id']};_0x2061de[_0x4d1d('0x67')]=_[_0x4d1d('0x48')](_0x12b9ce['enduserType']);}if(_0x61acde[_0x4d1d('0x68')]){_0x2061de[_0x4d1d('0x69')]=moment[_0x4d1d('0x6a')](parseInt(_0x61acde['talktime'])*0x3e8)[_0x4d1d('0x38')](_0x4d1d('0x6b'));}else if(_0x61acde[_0x4d1d('0x6c')]&&_0x61acde[_0x4d1d('0x6d')]){_0x2061de[_0x4d1d('0x69')]=moment[_0x4d1d('0x6a')](moment(_0x61acde[_0x4d1d('0x6d')],_0x4d1d('0x6e'))['diff'](moment(_0x61acde[_0x4d1d('0x6f')],_0x4d1d('0x6e'))))[_0x4d1d('0x38')](_0x4d1d('0x6b'));}switch(_0x61acde[_0x4d1d('0x70')]){case _0x4d1d('0x71'):_0x2061de[_0x4d1d('0x72')]=_0x4d1d('0x73');break;case _0x4d1d('0x74'):case'connect':_0x2061de['Call_Result']='Answered';break;case _0x4d1d('0x75'):_0x2061de['Call_Result']=_0x4d1d('0x76');break;case'abandoned':_0x2061de[_0x4d1d('0x72')]=_0x4d1d('0x77');break;case _0x4d1d('0x78'):_0x2061de[_0x4d1d('0x72')]=_0x4d1d('0x79');default:}_0x2061de[_0x4d1d('0x7a')]=(_0x58a58c==='outbound'?moment(_0x61acde[_0x4d1d('0x6f')])[_0x4d1d('0x38')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x61acde['agentcalledAt'])[_0x4d1d('0x38')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x4d1d('0x38')](_0x4d1d('0x6e'));_0x2061de[_0x4d1d('0x7b')]=_0x58a58c||'Inbound';_0x2061de=_[_0x4d1d('0x7c')](_0x2061de,getCustomFields(_0x16d63b[_0x4d1d('0x7d')],_0x61acde));return request({'method':_0x4d1d('0x29'),'uri':_0x4d1d('0x52')+_0x30378f+'/crm/v2/Calls','headers':{'Authorization':_0x4d1d('0x3b')+_0x576d60},'body':{'data':[_0x2061de]},'json':!![]})[_0x4d1d('0x2e')](function(_0x38b7c9){if(_0x38b7c9&&_0x38b7c9[_0x4d1d('0x45')][0x0][_0x4d1d('0x7e')]===_0x4d1d('0x4d')){logger[_0x4d1d('0x35')](_0x4d1d('0x7f'));return{'id':_0x38b7c9[_0x4d1d('0x45')][0x0][_0x4d1d('0x4e')]['id']};}})[_0x4d1d('0x31')](function(_0x688c6b){logger['info']('err',_0x688c6b[_0x4d1d('0x34')]);console['log'](_0x4d1d('0x80'),_0x688c6b);});}exports[_0x4d1d('0x81')]=function(_0x34d572,_0x1d7149,_0x16f71a,_0x1e99c5,_0x1bf925,_0x5b9e20){var _0x3fee14,_0x32e0c7,_0x3b1a7b;_0x5b9e20['host']=intUtil[_0x4d1d('0x82')](_0x5b9e20[_0x4d1d('0x83')]);_0x5b9e20[_0x4d1d('0x84')]=intUtil['stripTrailingSlash'](_0x5b9e20['serverUrl']);if(_0x1bf925&&_0x1bf925[_0x4d1d('0x85')]){logger['info'](_0x4d1d('0x86'),_0x4d1d('0x87'));_0x1d7149[_0x4d1d('0x88')]=_0x5b9e20['serverUrl']+_0x4d1d('0x89')+_0x1d7149[_0x4d1d('0x8a')]+_0x4d1d('0x8b')+md5(_0x1d7149['uniqueid']);}else{_0x1d7149[_0x4d1d('0x88')]='';}var _0x372f92=_0x5b9e20['host']===_0x4d1d('0x8c')?'eu':'com';return getAccessToken(_0x5b9e20)['then'](function(_0x4b592f){_0x3b1a7b=_0x4b592f;return getUser(_0x3b1a7b,_0x372f92,_0x5b9e20,_0x1e99c5['email']);})['then'](function(_0x2886c4){_0x3fee14=_0x2886c4;logger[_0x4d1d('0x35')](_0x4d1d('0x8d'),_0x3fee14['id']);return getEndUser(_0x3b1a7b,_0x372f92,_0x5b9e20,_0x1d7149[_0x4d1d('0x8e')],_0x1d7149['calleridnum'],_0x3fee14,_0x16f71a);})[_0x4d1d('0x2e')](function(_0x27616f){_0x32e0c7=_0x27616f;return getCall(_0x3b1a7b,_0x372f92,_0x5b9e20,_0x3fee14,_0x32e0c7,_0x16f71a,_0x1d7149,'Inbound');})[_0x4d1d('0x2e')](function(_0x1c0791){if(_0x1c0791){logger['info'](_0x4d1d('0x8f'),_0x1c0791['id']);logger['info'](_0x4d1d('0x86'),_0x4d1d('0x90'));emit(util[_0x4d1d('0x38')](_0x4d1d('0x91'),_0x1e99c5[_0x4d1d('0x1c')]),_0x4d1d('0x92'),{'uri':_0x4d1d('0x93')+_0x5b9e20[_0x4d1d('0x83')]+_0x4d1d('0x94')+_0x1c0791['id']});}})[_0x4d1d('0x31')](function(_0x44f13b){logger['error'](_0x4d1d('0x86'),JSON[_0x4d1d('0xf')](_0x44f13b));});};exports['outbound']=function(_0x34a418,_0x4bd395,_0x22ce71,_0x582eb9,_0x596739,_0x1dfd3e,_0x3e6143){var _0x3fa070,_0x3dff52,_0x33bd39;_0x1dfd3e[_0x4d1d('0x83')]=intUtil['stripTrailingSlash'](_0x1dfd3e[_0x4d1d('0x83')]);_0x1dfd3e['serverUrl']=intUtil[_0x4d1d('0x82')](_0x1dfd3e['serverUrl']);if(_0x3e6143&&_0x3e6143[_0x4d1d('0x95')]&&_0x3e6143[_0x4d1d('0x95')]!==_0x4d1d('0x96')){logger[_0x4d1d('0x35')](_0x4d1d('0x97'),_0x4d1d('0x87'));_0x4bd395[_0x4d1d('0x88')]=_0x1dfd3e[_0x4d1d('0x84')]+'/api/voice/recordings/'+_0x4bd395[_0x4d1d('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x4bd395[_0x4d1d('0x8a')]);}var _0x5503d6=_0x1dfd3e[_0x4d1d('0x83')]===_0x4d1d('0x8c')?'eu':_0x4d1d('0x98');return getAccessToken(_0x1dfd3e)[_0x4d1d('0x2e')](function(_0x7ce0b4){_0x33bd39=_0x7ce0b4;return getUser(_0x33bd39,_0x5503d6,_0x1dfd3e,_0x582eb9['email']);})[_0x4d1d('0x2e')](function(_0x4f9066){_0x3fa070=_0x4f9066;logger[_0x4d1d('0x35')](_0x4d1d('0x8d'),_0x3fa070['id']);return getEndUser(_0x33bd39,_0x5503d6,_0x1dfd3e,_0x4bd395[_0x4d1d('0x99')],_0x4bd395['destcalleridnum'],_0x3fa070,_0x22ce71);})[_0x4d1d('0x2e')](function(_0x4a0c18){_0x3dff52=_0x4a0c18;return getCall(_0x33bd39,_0x5503d6,_0x1dfd3e,_0x3fa070,_0x3dff52,_0x22ce71,_0x4bd395,_0x4d1d('0x9a'));})['then'](function(_0x11fade){if(_0x11fade){logger[_0x4d1d('0x35')](_0x4d1d('0x8f'),_0x11fade['id']);logger[_0x4d1d('0x35')](_0x4d1d('0x97'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4d1d('0x38')](_0x4d1d('0x91'),_0x582eb9['name']),_0x4d1d('0x92'),{'uri':'https://crm.'+_0x1dfd3e[_0x4d1d('0x83')]+_0x4d1d('0x94')+_0x11fade['id']});}})[_0x4d1d('0x31')](function(_0x2d3679){logger[_0x4d1d('0x32')](_0x4d1d('0x97'),JSON['stringify'](_0x2d3679));});};exports[_0x4d1d('0x9b')]=function(_0x3bbfe1,_0x44bcff,_0x525b09,_0x35a8b3,_0x5a3e21,_0x52db9d){var _0x841ce5,_0x30d3fc,_0x12f5a4;_0x52db9d[_0x4d1d('0x83')]=intUtil[_0x4d1d('0x82')](_0x52db9d[_0x4d1d('0x83')]);_0x52db9d[_0x4d1d('0x84')]=intUtil[_0x4d1d('0x82')](_0x52db9d[_0x4d1d('0x84')]);if(_0x5a3e21&&_0x5a3e21[_0x4d1d('0x85')]){logger['info']('['+_0x44bcff[_0x4d1d('0x70')][_0x4d1d('0x9c')]()+']',_0x4d1d('0x87'));_0x44bcff['recordingURL']=_0x52db9d[_0x4d1d('0x84')]+_0x4d1d('0x89')+_0x44bcff['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x44bcff[_0x4d1d('0x8a')]);}else{_0x44bcff[_0x4d1d('0x88')]='';}var _0x50e2f2=_0x52db9d['host']===_0x4d1d('0x8c')?'eu':_0x4d1d('0x98');return getAccessToken(_0x52db9d)['then'](function(_0x3eb855){_0x12f5a4=_0x3eb855;return getUser(_0x12f5a4,_0x50e2f2,_0x52db9d);})['then'](function(_0x3af106){_0x841ce5=_0x3af106;logger['info'](_0x4d1d('0x8d'),_0x841ce5['id']);return getEndUser(_0x12f5a4,_0x50e2f2,_0x52db9d,_0x44bcff[_0x4d1d('0x8e')],_0x44bcff[_0x4d1d('0x9d')],_0x841ce5,_0x525b09);})[_0x4d1d('0x2e')](function(_0x4f840c){_0x30d3fc=_0x4f840c;return getCall(_0x12f5a4,_0x50e2f2,_0x52db9d,_0x841ce5,_0x30d3fc,_0x525b09,_0x44bcff,'Inbound');})['then'](function(_0x52cfc9){if(_0x52cfc9){logger[_0x4d1d('0x35')]('The\x20Call\x20ID\x20is:',_0x52cfc9['id']);}})[_0x4d1d('0x31')](function(_0x44a79a){logger['error']('['+_0x44bcff[_0x4d1d('0x70')][_0x4d1d('0x9c')]()+']',JSON[_0x4d1d('0xf')](_0x44a79a));});}; \ No newline at end of file +var _0x252f=['Call_Duration','answertime','endtime','utc','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','/api/voice/recordings/','zoho.eu','Outbound','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','toUpperCase','calleridnum','lodash','request-promise','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','length','forEach','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','info','profile','user','Administrator','Using\x20the\x20admin\x20account!','error','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','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:','nothing','lead','Leads','Creating\x20new\x20call...','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime'];(function(_0x46d09b,_0x167779){var _0x205f50=function(_0x50a151){while(--_0x50a151){_0x46d09b['push'](_0x46d09b['shift']());}};_0x205f50(++_0x167779);}(_0x252f,0xd0));var _0xf252=function(_0x593a37,_0x20ac5b){_0x593a37=_0x593a37-0x0;var _0x4bde96=_0x252f[_0x593a37];return _0x4bde96;};'use strict';var _=require(_0xf252('0x0'));var rp=require(_0xf252('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xf252('0x2'));var moment=require(_0xf252('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xf252('0x4'));var logger=require(_0xf252('0x5'))(_0xf252('0x6'));config[_0xf252('0x7')]=_[_0xf252('0x8')](config['redis'],{'host':_0xf252('0x9'),'port':0x18eb});var io=require(_0xf252('0xa'))(new Redis(config[_0xf252('0x7')]));function emit(_0xc8ae97,_0x25e8af,_0x4e95aa){io['to'](_0xc8ae97)[_0xf252('0xb')](_0x25e8af,_0x4e95aa);}function request(_0x352951){logger['debug'](_0xf252('0xc'),JSON['stringify'](_0x352951));return rp(_0x352951);}function getCustomFields(_0x3bd392,_0x5aa122){var _0x4b624f={};if(_0x3bd392[_0xf252('0xd')]>0x0){_[_0xf252('0xe')](_0x3bd392,function(_0x51fa4){if(_['includes']([_0xf252('0xf'),_0xf252('0x10')],_0x51fa4[_0xf252('0x11')])&&_0x51fa4[_0xf252('0x12')]){_0x4b624f[_0x51fa4[_0xf252('0x12')]]=_0x51fa4[_0xf252('0x13')]['toString']();}else if(_0x51fa4[_0xf252('0x11')]===_0xf252('0x14')&&_0x51fa4[_0xf252('0x15')]&&_0x51fa4['idField']&&_0x5aa122[_0x51fa4[_0xf252('0x15')]]){_0x4b624f[_0x51fa4[_0xf252('0x12')]]=_0x5aa122[_0x51fa4[_0xf252('0x15')]][_0xf252('0x16')]();}else if(_0x51fa4['type']===_0xf252('0x17')&&_0x51fa4['Variable']&&_0x51fa4[_0xf252('0x18')][_0xf252('0x19')]&&_0x51fa4[_0xf252('0x12')]&&_0x5aa122[_0x51fa4['Variable']['name'][_0xf252('0x1a')]()]){_0x4b624f[_0x51fa4[_0xf252('0x12')]]=_0x5aa122[_0x51fa4[_0xf252('0x18')]['name'][_0xf252('0x1a')]()]['toString']();}});}return _0x4b624f;}function getName(_0x5acc79){if(_0x5acc79[_0xf252('0x1b')]('\x20')>0x0){var _0x273673=_0x5acc79[_0xf252('0x1c')](/ (.+)/);if(_0x273673[0x1]){return _0x273673;}}return[_0x5acc79,_0x5acc79];}var accountsTokens={};function getAccessToken(_0x2ab64c){return new Promise(function(_0x4c86fb,_0x8b9d7e){if(!_[_0xf252('0x1d')](accountsTokens[_0x2ab64c['id']])&&!_[_0xf252('0x1d')](accountsTokens[_0x2ab64c['id']][_0xf252('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x2ab64c['id']]['expires_in'])){_0x4c86fb(accountsTokens[_0x2ab64c['id']][_0xf252('0x1e')]);}}var _0x453220;switch(_0x2ab64c[_0xf252('0x1f')]){case'US':_0x453220='https://accounts.zoho.com';break;case'AU':_0x453220=_0xf252('0x20');break;case'EU':_0x453220=_0xf252('0x21');break;case'IN':_0x453220=_0xf252('0x22');break;case'CN':_0x453220='https://accounts.zoho.com.cn';break;default:_0x453220=_0xf252('0x21');break;}var _0x7848e8={'method':_0xf252('0x23'),'uri':_0x453220+_0xf252('0x24'),'qs':{'refresh_token':_0x2ab64c[_0xf252('0x25')],'client_id':_0x2ab64c[_0xf252('0x26')],'client_secret':_0x2ab64c['clientSecret'],'grant_type':_0xf252('0x27')},'json':!![]};return rp(_0x7848e8)[_0xf252('0x28')](function(_0x2c6073){accountsTokens[_0x2ab64c['id']]={'access_token':_0x2c6073[_0xf252('0x1e')],'expires_in':moment()[_0xf252('0x29')](_0x2c6073[_0xf252('0x2a')],_0xf252('0x2b'))};_0x4c86fb(_0x2c6073[_0xf252('0x1e')]);})[_0xf252('0x2c')](function(_0x404eb0){logger['error'](_0xf252('0x2d'),_0x404eb0['stack']);_0x8b9d7e(_0x404eb0);});});}function getUser(_0x534c98,_0x418fc5,_0x311f51,_0x58617f){logger['info']('Search\x20user');return request({'method':_0xf252('0x2e'),'uri':util[_0xf252('0x2f')](_0xf252('0x30'),_0x418fc5),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf252('0x31')+_0x534c98},'json':!![]})['then'](function(_0x35ef76){if(_0x35ef76['users']){var _0x2e2114=-0x1;if(_[_0xf252('0x32')](_0x35ef76[_0xf252('0x33')])){if(!_[_0xf252('0x1d')](_0x58617f)){_0x2e2114=_[_0xf252('0x34')](_0x35ef76[_0xf252('0x33')],function(_0x3ada46){return _0x3ada46[_0xf252('0x35')]===_0x58617f;});}if(_0x2e2114>=0x0){logger[_0xf252('0x36')]('Agent\x20found!');}else{logger[_0xf252('0x36')]('Using\x20the\x20admin\x20account!');_0x2e2114=_['findIndex'](_0x35ef76[_0xf252('0x33')],function(_0x471018){return _0x471018[_0xf252('0x37')][_0xf252('0x19')]==='Administrator';});}return _0x35ef76['users'][_0x2e2114];}else{if(_0x35ef76[_0xf252('0x38')][_0xf252('0x37')][_0xf252('0x19')]===_0xf252('0x39')){logger[_0xf252('0x36')](_0xf252('0x3a'));user=_0x35ef76['user'];return user;}else{logger[_0xf252('0x3b')]('The\x20failing\x20result\x20is',JSON[_0xf252('0x3c')](_0x35ef76));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf252('0x3c')](_0x35ef76));}}}else{logger[_0xf252('0x3b')](_0xf252('0x3d'),JSON[_0xf252('0x3c')](_0x35ef76));throw new Error(_0xf252('0x3e')+JSON['stringify'](_0x35ef76));}})[_0xf252('0x2c')](function(_0x103f90){console[_0xf252('0x3b')](_0x103f90);});}function getZohoUser(_0xa24058,_0x1070ce){return new BPromise(function(_0xa361c3,_0x396ca1){request(_0xa24058)[_0xf252('0x28')](function(_0x53d405){var _0x285ad7=null;if(_0x53d405){_0x285ad7=_0x53d405['data'][0x0];_0x285ad7[_0xf252('0x3f')]=_0x1070ce;}_0xa361c3(_0x285ad7);})[_0xf252('0x2c')](function(_0x262d1a){_0x396ca1(_0x262d1a);});});}function createEndUser(_0x3e46fe,_0xa199aa,_0x2d6325,_0x1256ff,_0x5b9bdd,_0x452256){var _0x2d6325=getName(_0x2d6325);return request({'method':_0xf252('0x23'),'uri':'https://www.zohoapis.'+_0xa199aa+_0xf252('0x40')+_[_0xf252('0x41')](_0x452256[_0xf252('0x42')])+'s','body':{'data':[{'Last_Name':_0x2d6325[0x1],'First_Name':_0x2d6325[0x0],'Phone':_0x1256ff,'Owner':{'name':!_['isNil'](_0x5b9bdd[_0xf252('0x43')][_0xf252('0x19')])?_0x5b9bdd['role']['name']:!_['isNil'](_0x5b9bdd[_0xf252('0x44')])?_0x5b9bdd[_0xf252('0x44')]+'\x20'+_0x5b9bdd[_0xf252('0x45')]:_0x5b9bdd['last_name'],'id':_0x5b9bdd['id']}}]},'headers':{'Authorization':_0xf252('0x31')+_0x3e46fe},'json':!![]})['then'](function(_0x2c19dc){if(_0x2c19dc&&_0x2c19dc[_0xf252('0x46')][0x0][_0xf252('0x47')]===_0xf252('0x48')){var _0x302a20=_0x2c19dc[_0xf252('0x46')][0x0][_0xf252('0x49')];_0x302a20[_0xf252('0x3f')]=_[_0xf252('0x41')](_0x452256[_0xf252('0x42')])+'s';return _0x302a20;}logger[_0xf252('0x3b')](_0xf252('0x3d'),JSON[_0xf252('0x3c')](data));throw new Error(_0xf252('0x4a')+JSON[_0xf252('0x3c')](data));})[_0xf252('0x2c')](function(_0x550180){console[_0xf252('0x4b')](_0xf252('0x4c'),_0x550180);});}function getEndUser(_0x41cc49,_0x59f8f8,_0x29b907,_0x427c17,_0x2983a3,_0x5d5233,_0x4eb107){var _0x291c95={'method':_0xf252('0x2e'),'uri':'','headers':{'Authorization':_0xf252('0x31')+_0x41cc49},'json':!![]};switch(_0x4eb107[_0xf252('0x4d')]){case _0xf252('0x4e'):_0x291c95[_0xf252('0x4f')]=_0xf252('0x50')+_0x59f8f8+_0xf252('0x51')+_0x2983a3+'))';return getZohoUser(_0x291c95,_0xf252('0x52'))['then'](function(_0x498089){if(_0x498089)return _0x498089;_0x291c95['uri']=_0xf252('0x50')+_0x59f8f8+_0xf252('0x53')+_0x2983a3+'))';return getZohoUser(_0x291c95,'Leads')[_0xf252('0x28')](function(_0x48d8b2){if(_0x48d8b2)return _0x48d8b2;if(_0x4eb107[_0xf252('0x42')]!=_0xf252('0x54')){return createEndUser(_0x41cc49,_0x59f8f8,_0x427c17,_0x2983a3,_0x5d5233,_0x4eb107);}else{return{};}});});break;case'contact':_0x291c95['uri']='https://www.zohoapis.'+_0x59f8f8+_0xf252('0x51')+_0x2983a3+'))';return getZohoUser(_0x291c95,_0xf252('0x52'))[_0xf252('0x28')](function(_0x516ef2){if(_0x516ef2)return _0x516ef2;if(_0x4eb107[_0xf252('0x42')]!=_0xf252('0x54')){return createEndUser(_0x41cc49,_0x59f8f8,_0x427c17,_0x2983a3,_0x5d5233,_0x4eb107);}else{return{};}});break;case _0xf252('0x55'):_0x291c95['uri']=_0xf252('0x50')+_0x59f8f8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2983a3+'))';return getZohoUser(_0x291c95,_0xf252('0x56'))[_0xf252('0x28')](function(_0x669cc6){if(_0x669cc6)return _0x669cc6;if(_0x4eb107[_0xf252('0x42')]!='nothing'){return createEndUser(_0x41cc49,_0x59f8f8,_0x427c17,_0x2983a3,_0x5d5233,_0x4eb107);}else{return{};}});break;}}function getCall(_0x580d14,_0x20350b,_0x2e4f1,_0x53cc93,_0x52be84,_0x222a5a,_0xc1d9c7,_0xa4c618){logger[_0xf252('0x36')](_0xf252('0x57'));var _0x31d1d8={};_0x31d1d8['Owner']={'name':!_[_0xf252('0x1d')](_0x53cc93[_0xf252('0x43')][_0xf252('0x19')])&&!_['isNil'](_0x53cc93['profile']['name'])&&_0x53cc93['profile'][_0xf252('0x19')]==='administrator'?_0x53cc93['role'][_0xf252('0x19')]:!_[_0xf252('0x1d')](_0x53cc93[_0xf252('0x44')])?_0x53cc93[_0xf252('0x44')]+'\x20'+_0x53cc93[_0xf252('0x45')]:_0x53cc93['last_name'],'id':_0x53cc93['id']};_0x31d1d8['Subject']=intUtil['getString'](_0x222a5a[_0xf252('0x58')],_0xc1d9c7,'\x20');_0x31d1d8[_0xf252('0x59')]=intUtil[_0xf252('0x5a')](_0x222a5a['Descriptions'],_0xc1d9c7,'\x0a');if(_0x52be84[_0xf252('0x3f')]===_0xf252('0x52')){_0x31d1d8[_0xf252('0x5b')]={'name':!_[_0xf252('0x1d')](_0x52be84['Full_Name'])?_0x52be84[_0xf252('0x5c')]:!_['isNil'](_0x52be84[_0xf252('0x5d')])?_0x52be84[_0xf252('0x5d')]+'\x20'+_0x52be84[_0xf252('0x5e')]:_0x52be84['Last_Name'],'id':_0x52be84['id']};}if(_0x52be84[_0xf252('0x3f')]===_0xf252('0x56')){_0x31d1d8[_0xf252('0x5f')]={'name':!_[_0xf252('0x1d')](_0x52be84[_0xf252('0x5c')])?_0x52be84['Full_Name']:!_['isNil'](_0x52be84['First_Name'])?_0x52be84[_0xf252('0x5d')]+'\x20'+_0x52be84['Last_Name']:_0x52be84[_0xf252('0x5e')],'id':_0x52be84['id']};_0x31d1d8[_0xf252('0x60')]=_[_0xf252('0x41')](_0x52be84['enduserType']);}if(_0xc1d9c7[_0xf252('0x61')]){_0x31d1d8[_0xf252('0x62')]=moment['utc'](parseInt(_0xc1d9c7[_0xf252('0x61')])*0x3e8)['format']('mm:ss');}else if(_0xc1d9c7[_0xf252('0x63')]&&_0xc1d9c7[_0xf252('0x64')]){_0x31d1d8[_0xf252('0x62')]=moment[_0xf252('0x65')](moment(_0xc1d9c7[_0xf252('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xf252('0x66')](moment(_0xc1d9c7[_0xf252('0x67')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0xc1d9c7[_0xf252('0x68')]){case _0xf252('0x69'):_0x31d1d8[_0xf252('0x6a')]=_0xf252('0x6b');break;case _0xf252('0x6c'):case _0xf252('0x6d'):_0x31d1d8[_0xf252('0x6a')]=_0xf252('0x6e');break;case _0xf252('0x6f'):_0x31d1d8[_0xf252('0x6a')]=_0xf252('0x70');break;case'abandoned':_0x31d1d8[_0xf252('0x6a')]=_0xf252('0x71');break;case _0xf252('0x72'):_0x31d1d8[_0xf252('0x6a')]='Timeout';default:}_0x31d1d8[_0xf252('0x73')]=(_0xa4c618===_0xf252('0x74')?moment(_0xc1d9c7[_0xf252('0x67')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0xc1d9c7['agentcalledAt'])[_0xf252('0x2f')](_0xf252('0x75')))||moment()[_0xf252('0x2f')](_0xf252('0x75'));_0x31d1d8[_0xf252('0x76')]=_0xa4c618||_0xf252('0x77');_0x31d1d8=_[_0xf252('0x78')](_0x31d1d8,getCustomFields(_0x222a5a[_0xf252('0x79')],_0xc1d9c7));return request({'method':_0xf252('0x23'),'uri':'https://www.zohoapis.'+_0x20350b+_0xf252('0x7a'),'headers':{'Authorization':_0xf252('0x31')+_0x580d14},'body':{'data':[_0x31d1d8]},'json':!![]})['then'](function(_0x24a691){if(_0x24a691&&_0x24a691['data'][0x0][_0xf252('0x47')]==='SUCCESS'){logger['info'](_0xf252('0x7b'));return{'id':_0x24a691[_0xf252('0x46')][0x0][_0xf252('0x49')]['id']};}})['catch'](function(_0x275b24){logger[_0xf252('0x36')]('err',_0x275b24[_0xf252('0x7c')]);console[_0xf252('0x4b')](_0xf252('0x7d'),_0x275b24);});}exports['queue']=function(_0x4b53a7,_0x151d63,_0x5eaee2,_0x5a8b3c,_0x342742,_0x58a093){var _0x23cfcc,_0x4181e8,_0x4b2b44;_0x58a093[_0xf252('0x7e')]=intUtil['stripTrailingSlash'](_0x58a093[_0xf252('0x7e')]);_0x58a093[_0xf252('0x7f')]=intUtil[_0xf252('0x80')](_0x58a093[_0xf252('0x7f')]);if(_0x342742&&_0x342742[_0xf252('0x81')]){logger[_0xf252('0x36')]('[QUEUE]',_0xf252('0x82'));_0x151d63[_0xf252('0x83')]=_0x58a093[_0xf252('0x7f')]+'/api/voice/recordings/'+_0x151d63[_0xf252('0x84')]+_0xf252('0x85')+md5(_0x151d63[_0xf252('0x84')]);}else{_0x151d63[_0xf252('0x83')]='';}var _0x554773=_0x58a093[_0xf252('0x7e')]==='zoho.eu'?'eu':_0xf252('0x86');return getAccessToken(_0x58a093)['then'](function(_0x4337b3){_0x4b2b44=_0x4337b3;return getUser(_0x4b2b44,_0x554773,_0x58a093,_0x5a8b3c['email']);})[_0xf252('0x28')](function(_0x5e60cb){_0x23cfcc=_0x5e60cb;logger[_0xf252('0x36')](_0xf252('0x87'),_0x23cfcc['id']);return getEndUser(_0x4b2b44,_0x554773,_0x58a093,_0x151d63[_0xf252('0x88')],_0x151d63['calleridnum'],_0x23cfcc,_0x5eaee2);})[_0xf252('0x28')](function(_0x44b68b){_0x4181e8=_0x44b68b;return getCall(_0x4b2b44,_0x554773,_0x58a093,_0x23cfcc,_0x4181e8,_0x5eaee2,_0x151d63,'Inbound');})[_0xf252('0x28')](function(_0x2641a6){if(_0x2641a6){logger[_0xf252('0x36')](_0xf252('0x89'),_0x2641a6['id']);logger[_0xf252('0x36')]('[QUEUE]',_0xf252('0x8a'));emit(util[_0xf252('0x2f')]('user:%s',_0x5a8b3c[_0xf252('0x19')]),'trigger:browser:url',{'uri':_0xf252('0x8b')+_0x58a093[_0xf252('0x7e')]+_0xf252('0x8c')+_0x2641a6['id']});}})[_0xf252('0x2c')](function(_0x3983d4){logger[_0xf252('0x3b')](_0xf252('0x8d'),JSON[_0xf252('0x3c')](_0x3983d4));});};exports[_0xf252('0x74')]=function(_0xabbed0,_0x30c754,_0x4a243e,_0x1c1f2d,_0x56f3e9,_0x40ecf4,_0x3d7a22){var _0x427a13,_0x4b4cb3,_0x2d328d;_0x40ecf4[_0xf252('0x7e')]=intUtil[_0xf252('0x80')](_0x40ecf4[_0xf252('0x7e')]);_0x40ecf4[_0xf252('0x7f')]=intUtil[_0xf252('0x80')](_0x40ecf4[_0xf252('0x7f')]);if(_0x3d7a22&&_0x3d7a22[_0xf252('0x8e')]&&_0x3d7a22[_0xf252('0x8e')]!==_0xf252('0x8f')){logger[_0xf252('0x36')]('[OUTBOUND]',_0xf252('0x82'));_0x30c754[_0xf252('0x83')]=_0x40ecf4[_0xf252('0x7f')]+_0xf252('0x90')+_0x30c754['uniqueid']+_0xf252('0x85')+md5(_0x30c754[_0xf252('0x84')]);}var _0x3d3e41=_0x40ecf4['host']===_0xf252('0x91')?'eu':_0xf252('0x86');return getAccessToken(_0x40ecf4)[_0xf252('0x28')](function(_0x3aecee){_0x2d328d=_0x3aecee;return getUser(_0x2d328d,_0x3d3e41,_0x40ecf4,_0x1c1f2d[_0xf252('0x35')]);})[_0xf252('0x28')](function(_0x2978b3){_0x427a13=_0x2978b3;logger[_0xf252('0x36')](_0xf252('0x87'),_0x427a13['id']);return getEndUser(_0x2d328d,_0x3d3e41,_0x40ecf4,_0x30c754['destcalleridname'],_0x30c754['destcalleridnum'],_0x427a13,_0x4a243e);})[_0xf252('0x28')](function(_0x43ae42){_0x4b4cb3=_0x43ae42;return getCall(_0x2d328d,_0x3d3e41,_0x40ecf4,_0x427a13,_0x4b4cb3,_0x4a243e,_0x30c754,_0xf252('0x92'));})[_0xf252('0x28')](function(_0x5aeb13){if(_0x5aeb13){logger[_0xf252('0x36')](_0xf252('0x89'),_0x5aeb13['id']);logger['info'](_0xf252('0x93'),_0xf252('0x8a'));emit(util[_0xf252('0x2f')](_0xf252('0x94'),_0x1c1f2d[_0xf252('0x19')]),_0xf252('0x95'),{'uri':_0xf252('0x8b')+_0x40ecf4[_0xf252('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5aeb13['id']});}})['catch'](function(_0x1b0616){logger[_0xf252('0x3b')](_0xf252('0x93'),JSON[_0xf252('0x3c')](_0x1b0616));});};exports[_0xf252('0x96')]=function(_0x2f0d6d,_0x376455,_0xd35006,_0x3c63ee,_0x357acf,_0xd5b38c){var _0x2a9fc0,_0x125534,_0x5cf72e;_0xd5b38c[_0xf252('0x7e')]=intUtil[_0xf252('0x80')](_0xd5b38c[_0xf252('0x7e')]);_0xd5b38c[_0xf252('0x7f')]=intUtil[_0xf252('0x80')](_0xd5b38c[_0xf252('0x7f')]);if(_0x357acf&&_0x357acf[_0xf252('0x81')]){logger[_0xf252('0x36')]('['+_0x376455[_0xf252('0x68')][_0xf252('0x97')]()+']',_0xf252('0x82'));_0x376455['recordingURL']=_0xd5b38c[_0xf252('0x7f')]+_0xf252('0x90')+_0x376455[_0xf252('0x84')]+_0xf252('0x85')+md5(_0x376455[_0xf252('0x84')]);}else{_0x376455[_0xf252('0x83')]='';}var _0x46e074=_0xd5b38c[_0xf252('0x7e')]===_0xf252('0x91')?'eu':_0xf252('0x86');return getAccessToken(_0xd5b38c)['then'](function(_0x174120){_0x5cf72e=_0x174120;return getUser(_0x5cf72e,_0x46e074,_0xd5b38c);})['then'](function(_0x1e204e){_0x2a9fc0=_0x1e204e;logger[_0xf252('0x36')](_0xf252('0x87'),_0x2a9fc0['id']);return getEndUser(_0x5cf72e,_0x46e074,_0xd5b38c,_0x376455[_0xf252('0x88')],_0x376455[_0xf252('0x98')],_0x2a9fc0,_0xd35006);})['then'](function(_0xb404f5){_0x125534=_0xb404f5;return getCall(_0x5cf72e,_0x46e074,_0xd5b38c,_0x2a9fc0,_0x125534,_0xd35006,_0x376455,_0xf252('0x77'));})['then'](function(_0xbfd16a){if(_0xbfd16a){logger['info']('The\x20Call\x20ID\x20is:',_0xbfd16a['id']);}})[_0xf252('0x2c')](function(_0x4bf71d){logger['error']('['+_0x376455[_0xf252('0x68')][_0xf252('0x97')]()+']',JSON[_0xf252('0x3c')](_0x4bf71d));});}; \ 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 bf896b0..7d0f02a 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 _0xce3c=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','Script','data3'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0xce3c,0x157));var _0xcce3=function(_0x535a5b,_0x52fe21){_0x535a5b=_0x535a5b-0x0;var _0x1b0f2a=_0xce3c[_0x535a5b];return _0x1b0f2a;};'use strict';var util=require(_0xcce3('0x0'));var sh=require(_0xcce3('0x1'));var Mustache=require(_0xcce3('0x2'));var logger=require(_0xcce3('0x3'))(_0xcce3('0x4'));exports[_0xcce3('0x5')]=function(_0x3e04c7,_0xf6d9f6){var _0xd183d=_0x3e04c7['data2']?_0x3e04c7['data2']:_0xcce3('0x6');var _0x1079d4=_0x3e04c7[_0xcce3('0x7')]?Mustache[_0xcce3('0x8')](_0x3e04c7[_0xcce3('0x7')],_0xf6d9f6):_0xf6d9f6;sh[_0xcce3('0x5')](_0x1079d4,function(_0x1397ac,_0x535612,_0x82d295){if(_0x1397ac!==0x0){logger[_0xcce3('0x9')](util[_0xcce3('0xa')](_0xcce3('0xb'),_0xd183d,_0x1079d4,_0x1397ac,_0x82d295));}else{logger['info'](util[_0xcce3('0xa')](_0xcce3('0xc'),_0xd183d,_0x1079d4,_0x535612));}});}; \ No newline at end of file +var _0x7aea=['trigger','exec','data2','render','data3','error','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger'];(function(_0x6ba58d,_0x55effe){var _0x8c999a=function(_0x538d35){while(--_0x538d35){_0x6ba58d['push'](_0x6ba58d['shift']());}};_0x8c999a(++_0x55effe);}(_0x7aea,0x165));var _0xa7ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7aea[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xa7ae('0x0'));var sh=require('shelljs');var Mustache=require(_0xa7ae('0x1'));var logger=require(_0xa7ae('0x2'))(_0xa7ae('0x3'));exports[_0xa7ae('0x4')]=function(_0x21cf96,_0x14d5f7){var _0x598450=_0x21cf96[_0xa7ae('0x5')]?_0x21cf96[_0xa7ae('0x5')]:'Script';var _0x1a99f6=_0x21cf96['data3']?Mustache[_0xa7ae('0x6')](_0x21cf96[_0xa7ae('0x7')],_0x14d5f7):_0x14d5f7;sh['exec'](_0x1a99f6,function(_0x257e83,_0x26daf5,_0xb17155){if(_0x257e83!==0x0){logger[_0xa7ae('0x8')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x598450,_0x1a99f6,_0x257e83,_0xb17155));}else{logger[_0xa7ae('0x9')](util[_0xa7ae('0xa')](_0xa7ae('0xb'),_0x598450,_0x1a99f6,_0x26daf5));}});}; \ 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 45d3ece..b4b13e5 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 _0xd8dd=['lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data5','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x496709,_0x572736){var _0x56ddc3=function(_0x1eba61){while(--_0x1eba61){_0x496709['push'](_0x496709['shift']());}};_0x56ddc3(++_0x572736);}(_0xd8dd,0x127));var _0xdd8d=function(_0x25b114,_0x593634){_0x25b114=_0x25b114-0x0;var _0x2ef5f8=_0xd8dd[_0x25b114];return _0x2ef5f8;};'use strict';var rp=require(_0xdd8d('0x0'));var util=require(_0xdd8d('0x1'));var _=require(_0xdd8d('0x2'));var Mustache=require(_0xdd8d('0x3'));var logger=require(_0xdd8d('0x4'))(_0xdd8d('0x5'));exports['exec']=function(_0xb99da1,_0x22fde0){var _0x76c263,_0xa58e9;var _0x3c897f={'method':_0xb99da1[_0xdd8d('0x6')][_0xdd8d('0x7')](),'uri':Mustache[_0xdd8d('0x8')](_0xb99da1['data2'],_0x22fde0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb99da1[_0xdd8d('0x9')])==='number'&&parseInt(_0xb99da1[_0xdd8d('0x9')])>=0x1&&parseInt(_0xb99da1[_0xdd8d('0x9')])<=0xa?parseInt(_0xb99da1[_0xdd8d('0x9')])*0x3e8:0x5*0x3e8};try{_0x3c897f[_0xdd8d('0xa')]=_0xb99da1[_0xdd8d('0xb')]?JSON[_0xdd8d('0xc')](Mustache[_0xdd8d('0x8')](_0xb99da1[_0xdd8d('0xb')],_0x22fde0)):{};}catch(_0x1b351f){logger[_0xdd8d('0xd')](_0x1b351f[_0xdd8d('0xe')]);}switch(_0xb99da1['data1']['toUpperCase']()){case _0xdd8d('0xf'):case _0xdd8d('0x10'):_0x76c263=null;_0x3c897f['qs']=_0x22fde0;break;case _0xdd8d('0x11'):case _0xdd8d('0x12'):if(_0xb99da1[_0xdd8d('0x13')]){try{_0x76c263=JSON[_0xdd8d('0xc')](Mustache[_0xdd8d('0x8')](_0xb99da1[_0xdd8d('0x13')],_0x22fde0));_0x3c897f['body']=_0x76c263;}catch(_0x435d3d){logger[_0xdd8d('0xd')](_0x435d3d[_0xdd8d('0xe')]);logger[_0xdd8d('0xd')](_0xdd8d('0x14'));}}else{_0x76c263=_0x22fde0;_0x3c897f[_0xdd8d('0x15')]=_0x76c263;}break;}logger['info'](util[_0xdd8d('0x16')](_0xdd8d('0x17'),_0xb99da1[_0xdd8d('0x6')],_0xb99da1[_0xdd8d('0x18')],JSON['stringify'](_0x3c897f)));rp(_0x3c897f)[_0xdd8d('0x19')](function(_0x4136d6){_0x76c263=!_['isNil'](_0x76c263)?_0xdd8d('0x1a')+_0x76c263:'';_0xa58e9=typeof _0x4136d6[_0xdd8d('0x15')]==='object'?JSON[_0xdd8d('0x1b')](_0x4136d6[_0xdd8d('0x15')]):_0x4136d6[_0xdd8d('0x15')];logger['info'](util['format'](_0xdd8d('0x1c'),_0xb99da1[_0xdd8d('0x6')],_0xb99da1['data2'],_0x4136d6[_0xdd8d('0x1d')],_0xa58e9));})['catch'](function(_0x51bd08){logger['error'](util['format'](_0xdd8d('0x1e'),_0xb99da1[_0xdd8d('0x6')],_0xb99da1[_0xdd8d('0x18')],_0x51bd08[_0xdd8d('0x1d')],_0x51bd08[_0xdd8d('0x1f')],_0x51bd08[_0xdd8d('0x20')]));});}; \ No newline at end of file +var _0xd67f=['lodash','../../../../config/logger','data1','toUpperCase','render','data2','data5','headers','data6','parse','error','stack','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util'];(function(_0x409c8b,_0x4892d4){var _0x430500=function(_0x386132){while(--_0x386132){_0x409c8b['push'](_0x409c8b['shift']());}};_0x430500(++_0x4892d4);}(_0xd67f,0x135));var _0xfd67=function(_0x5f2add,_0x536554){_0x5f2add=_0x5f2add-0x0;var _0x588f18=_0xd67f[_0x5f2add];return _0x588f18;};'use strict';var rp=require('request-promise');var util=require(_0xfd67('0x0'));var _=require(_0xfd67('0x1'));var Mustache=require('mustache');var logger=require(_0xfd67('0x2'))('trigger');exports['exec']=function(_0x2bb457,_0x403be1){var _0x15d373,_0x62b6b4;var _0x3201d5={'method':_0x2bb457[_0xfd67('0x3')][_0xfd67('0x4')](),'uri':Mustache[_0xfd67('0x5')](_0x2bb457[_0xfd67('0x6')],_0x403be1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2bb457[_0xfd67('0x7')])==='number'&&parseInt(_0x2bb457[_0xfd67('0x7')])>=0x1&&parseInt(_0x2bb457[_0xfd67('0x7')])<=0xa?parseInt(_0x2bb457[_0xfd67('0x7')])*0x3e8:0x5*0x3e8};try{_0x3201d5[_0xfd67('0x8')]=_0x2bb457[_0xfd67('0x9')]?JSON[_0xfd67('0xa')](Mustache[_0xfd67('0x5')](_0x2bb457['data6'],_0x403be1)):{};}catch(_0x403b6d){logger[_0xfd67('0xb')](_0x403b6d[_0xfd67('0xc')]);}switch(_0x2bb457[_0xfd67('0x3')][_0xfd67('0x4')]()){case _0xfd67('0xd'):case'DELETE':_0x15d373=null;_0x3201d5['qs']=_0x403be1;break;case _0xfd67('0xe'):case _0xfd67('0xf'):if(_0x2bb457[_0xfd67('0x10')]){try{_0x15d373=JSON[_0xfd67('0xa')](Mustache['render'](_0x2bb457[_0xfd67('0x10')],_0x403be1));_0x3201d5[_0xfd67('0x11')]=_0x15d373;}catch(_0x3f34d7){logger[_0xfd67('0xb')](_0x3f34d7['stack']);logger['error'](_0xfd67('0x12'));}}else{_0x15d373=_0x403be1;_0x3201d5['body']=_0x15d373;}break;}logger[_0xfd67('0x13')](util['format'](_0xfd67('0x14'),_0x2bb457[_0xfd67('0x3')],_0x2bb457[_0xfd67('0x6')],JSON[_0xfd67('0x15')](_0x3201d5)));rp(_0x3201d5)[_0xfd67('0x16')](function(_0x26f93a){_0x15d373=!_[_0xfd67('0x17')](_0x15d373)?_0xfd67('0x18')+_0x15d373:'';_0x62b6b4=typeof _0x26f93a['body']==='object'?JSON[_0xfd67('0x15')](_0x26f93a['body']):_0x26f93a[_0xfd67('0x11')];logger[_0xfd67('0x13')](util[_0xfd67('0x19')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2bb457['data1'],_0x2bb457['data2'],_0x26f93a[_0xfd67('0x1a')],_0x62b6b4));})[_0xfd67('0x1b')](function(_0x3b9693){logger[_0xfd67('0xb')](util[_0xfd67('0x19')](_0xfd67('0x1c'),_0x2bb457['data1'],_0x2bb457[_0xfd67('0x6')],_0x3b9693[_0xfd67('0x1a')],_0x3b9693[_0xfd67('0x1d')],_0x3b9693[_0xfd67('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 261cf95..474fed8 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 _0x0101=['request','then','error','rpc','routing','message','result','catch','jayson/promise','bluebird','../../config/logger','client','http','Request'];(function(_0x577210,_0x1a0966){var _0x1991b1=function(_0x4d61ff){while(--_0x4d61ff){_0x577210['push'](_0x577210['shift']());}};_0x1991b1(++_0x1a0966);}(_0x0101,0x1d6));var _0x1010=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0101[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x1010('0x0'));var BPromise=require(_0x1010('0x1'));var logger=require(_0x1010('0x2'))('routing');var client=jayson[_0x1010('0x3')][_0x1010('0x4')]({'port':0x2329});client[_0x1010('0x5')]=function(_0x54653d,_0x371783){return new BPromise(function(_0x1c5d50,_0x300775){return client[_0x1010('0x6')](_0x54653d,_0x371783)[_0x1010('0x7')](function(_0x3939f6){logger['debug']('rpc','routing',_0x54653d,_0x371783,_0x3939f6);if(_0x3939f6[_0x1010('0x8')]){logger[_0x1010('0x8')](_0x1010('0x9'),_0x1010('0xa'),_0x54653d,_0x3939f6[_0x1010('0x8')][_0x1010('0xb')],_0x371783);return _0x300775(_0x3939f6[_0x1010('0x8')]['message']);}else{return _0x1c5d50(_0x3939f6[_0x1010('0xc')]);}})[_0x1010('0xd')](function(_0x20eb41){logger['error']('rpc',_0x1010('0xa'),_0x54653d,_0x20eb41,_0x371783);return _0x300775(_0x20eb41);});});};module['exports']=client; \ No newline at end of file +var _0x05ee=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch','exports'];(function(_0x4ec159,_0x99b8b8){var _0x4e5c24=function(_0x49df86){while(--_0x49df86){_0x4ec159['push'](_0x4ec159['shift']());}};_0x4e5c24(++_0x99b8b8);}(_0x05ee,0xb4));var _0xe05e=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x05ee[_0x3fba9f];return _0x192cf1;};'use strict';var jayson=require(_0xe05e('0x0'));var BPromise=require(_0xe05e('0x1'));var logger=require(_0xe05e('0x2'))(_0xe05e('0x3'));var client=jayson[_0xe05e('0x4')][_0xe05e('0x5')]({'port':0x2329});client[_0xe05e('0x6')]=function(_0x36c121,_0x55e23f){return new BPromise(function(_0x3b97bf,_0x41f313){return client[_0xe05e('0x7')](_0x36c121,_0x55e23f)['then'](function(_0x33f713){logger[_0xe05e('0x8')](_0xe05e('0x9'),_0xe05e('0x3'),_0x36c121,_0x55e23f,_0x33f713);if(_0x33f713['error']){logger['error'](_0xe05e('0x9'),_0xe05e('0x3'),_0x36c121,_0x33f713[_0xe05e('0xa')][_0xe05e('0xb')],_0x55e23f);return _0x41f313(_0x33f713['error'][_0xe05e('0xb')]);}else{return _0x3b97bf(_0x33f713[_0xe05e('0xc')]);}})[_0xe05e('0xd')](function(_0x34253d){logger[_0xe05e('0xa')](_0xe05e('0x9'),'routing',_0x36c121,_0x34253d,_0x55e23f);return _0x41f313(_0x34253d);});});};module[_0xe05e('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 17b5e0f..31632b0 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 _0x4146=['email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger'];(function(_0x3536dd,_0x14e817){var _0x2203f2=function(_0x4a33c0){while(--_0x4a33c0){_0x3536dd['push'](_0x3536dd['shift']());}};_0x2203f2(++_0x14e817);}(_0x4146,0x11a));var _0x6414=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x4146[_0x4f08dd];return _0x3017ee;};'use strict';var server=require(_0x6414('0x0'));var Realtime=require(_0x6414('0x1'));var EmailChannel=require(_0x6414('0x2'));var mailAccount=require(_0x6414('0x3'));var setting=require(_0x6414('0x4'));var logger=require(_0x6414('0x5'))(_0x6414('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6414('0x7')]()[_0x6414('0x8')](mailAccount[_0x6414('0x9')]())[_0x6414('0x8')](realtime['initMailAccounts']())[_0x6414('0x8')](function(){email[_0x6414('0xa')](realtime[_0x6414('0xb')]);return realtime;});}function main(){return server[_0x6414('0xc')](realtime,email)[_0x6414('0x8')](function(){return initRealtime();})[_0x6414('0x8')](function(){return setting['getSettings']();})[_0x6414('0x8')](function(_0x46319b){return setInterval(initRealtime,_0x46319b[_0x6414('0xd')]*0x3e8);})[_0x6414('0xe')](function(_0xff816e){logger[_0x6414('0xf')]('Email\x20service\x20initialization',_0xff816e);});}main(); \ No newline at end of file +var _0x6825=['Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','error'];(function(_0x11cd98,_0x316193){var _0x171478=function(_0x2e93a6){while(--_0x2e93a6){_0x11cd98['push'](_0x11cd98['shift']());}};_0x171478(++_0x316193);}(_0x6825,0x1c1));var _0x5682=function(_0x5765f9,_0x464bb9){_0x5765f9=_0x5765f9-0x0;var _0x21db5d=_0x6825[_0x5765f9];return _0x21db5d;};'use strict';var server=require(_0x5682('0x0'));var Realtime=require(_0x5682('0x1'));var EmailChannel=require(_0x5682('0x2'));var mailAccount=require(_0x5682('0x3'));var setting=require(_0x5682('0x4'));var logger=require(_0x5682('0x5'))(_0x5682('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x5682('0x7')](mailAccount[_0x5682('0x8')]())[_0x5682('0x7')](realtime[_0x5682('0x9')]())[_0x5682('0x7')](function(){email[_0x5682('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x5682('0x7')](function(){return initRealtime();})[_0x5682('0x7')](function(){return setting[_0x5682('0xb')]();})[_0x5682('0x7')](function(_0x4739c7){return setInterval(initRealtime,_0x4739c7[_0x5682('0xc')]*0x3e8);})[_0x5682('0xd')](function(_0x20539e){logger[_0x5682('0xe')](_0x5682('0xf'),_0x20539e);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 19cbb87..9ca752c 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 _0xd006=['handleImapError','disabled','messageStatus','handleImapBox','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','verifySmtp','Smtp','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','bind','handleImapEmail','end','handleImapEnd','error'];(function(_0x2d8ca8,_0x22bcb6){var _0x268164=function(_0x58d046){while(--_0x58d046){_0x2d8ca8['push'](_0x2d8ca8['shift']());}};_0x268164(++_0x22bcb6);}(_0xd006,0xf8));var _0x6d00=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xd006[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x6d00('0x0'));var moment=require(_0x6d00('0x1'));var BPromise=require(_0x6d00('0x2'));var md5=require(_0x6d00('0x3'));var Redis=require(_0x6d00('0x4'));var config=require(_0x6d00('0x5'));var logger=require('../../../config/logger')(_0x6d00('0x6'));config[_0x6d00('0x7')]=_[_0x6d00('0x8')](config[_0x6d00('0x7')],{'host':_0x6d00('0x9'),'port':0x18eb});var io=require(_0x6d00('0xa'))(new Redis(config[_0x6d00('0x7')]));var EmailImap=require(_0x6d00('0xb'));var EmailSmtp=require(_0x6d00('0xc'));var mailAccount=require(_0x6d00('0xd'));var md5Accounts={};function EmailChannel(_0x51e0e0){logger[_0x6d00('0xe')]('start\x20email\x20channel');this['mailAccounts']=_0x51e0e0[_0x6d00('0xf')];this[_0x6d00('0x10')]={};this[_0x6d00('0x11')]=new EmailSmtp();}EmailChannel[_0x6d00('0x12')][_0x6d00('0x13')]=function(_0x3c6e52){var _0x5cd32e=this[_0x6d00('0xf')][_0x3c6e52];var _0x1ef526={'id':_0x5cd32e['id'],'name':_0x5cd32e[_0x6d00('0x14')],'key':_0x5cd32e['key'],'active':_0x5cd32e[_0x6d00('0x15')],'Imap':{'status':_0x5cd32e[_0x6d00('0x16')][_0x6d00('0x17')],'messageStatus':_0x5cd32e['Imap']['messageStatus'],'total':_0x5cd32e[_0x6d00('0x16')][_0x6d00('0x18')]}};if(_[_0x6d00('0x19')](md5Accounts[_0x3c6e52])){md5Accounts[_0x3c6e52]={};}var _0x13c72e=md5(JSON[_0x6d00('0x1a')](_0x1ef526));if(md5Accounts[_0x3c6e52]['md5']!==_0x13c72e){md5Accounts[_0x3c6e52]['md5']=_0x13c72e;io['emit'](_0x6d00('0x1b'),_0x1ef526);}};EmailChannel[_0x6d00('0x12')][_0x6d00('0x1c')]=function(_0x5dbf45){for(var _0x3af711 in _0x5dbf45){if(_0x5dbf45[_0x6d00('0x1d')](_0x3af711)){if(_0x5dbf45[_0x3af711][_0x6d00('0x16')]&&_0x5dbf45[_0x3af711][_0x6d00('0x15')]){var _0x5c89e4=_0x5dbf45[_0x3af711][_0x6d00('0x16')];if(!_0x5c89e4[_0x6d00('0x1e')]&&_0x5dbf45[_0x3af711][_0x6d00('0x1f')]!=='custom')_0x5c89e4[_0x6d00('0x1e')]=_0x5dbf45[_0x3af711]['provider'];if(!this['imapAccounts'][_0x6d00('0x1d')](_0x5c89e4['id'])){this[_0x6d00('0x10')][_0x5c89e4['id']]=new EmailImap(_0x5c89e4,_0x5dbf45[_0x3af711][_0x6d00('0x6')]);this['imapAccounts'][_0x5c89e4['id']]['on']('box',this['handleImapBox'][_0x6d00('0x20')](this,_0x3af711));this[_0x6d00('0x10')][_0x5c89e4['id']]['on']('email',this[_0x6d00('0x21')][_0x6d00('0x20')](this,_0x3af711));this['imapAccounts'][_0x5c89e4['id']]['on'](_0x6d00('0x22'),this[_0x6d00('0x23')]['bind'](this,_0x3af711));this[_0x6d00('0x10')][_0x5c89e4['id']]['on'](_0x6d00('0x24'),this[_0x6d00('0x25')][_0x6d00('0x20')](this,_0x3af711));}}else{if(_[_0x6d00('0x19')](this[_0x6d00('0xf')][_0x3af711]['Imap'])){this['mailAccounts'][_0x3af711][_0x6d00('0x16')]={};}this[_0x6d00('0xf')][_0x3af711][_0x6d00('0x16')][_0x6d00('0x17')]=_0x6d00('0x26');this[_0x6d00('0xf')][_0x3af711][_0x6d00('0x16')][_0x6d00('0x27')]='';this[_0x6d00('0x13')](_0x3af711);}}}};EmailChannel[_0x6d00('0x12')][_0x6d00('0x28')]=function(_0x2be35e,_0x43a4f8){if(this[_0x6d00('0xf')][_0x2be35e]){this['mailAccounts'][_0x2be35e][_0x6d00('0x16')][_0x6d00('0x17')]='connected';this[_0x6d00('0xf')][_0x2be35e][_0x6d00('0x16')][_0x6d00('0x27')]=_0x43a4f8[_0x6d00('0x14')];if(_0x43a4f8['messages']){this['mailAccounts'][_0x2be35e][_0x6d00('0x16')][_0x6d00('0x18')]=_0x43a4f8[_0x6d00('0x29')]['total'];}return this[_0x6d00('0x13')](_0x2be35e);}};EmailChannel[_0x6d00('0x12')]['handleImapEmail']=function(_0x3a6aff,_0x54f292){logger['info'](_0x6d00('0x2a'),_0x54f292[_0x6d00('0x2b')],_0x54f292[_0x6d00('0x2c')],_0x54f292[_0x6d00('0x2d')],_0x3a6aff);if(this[_0x6d00('0xf')][_0x3a6aff]){return mailAccount[_0x6d00('0x2e')](_0x3a6aff,_0x54f292)[_0x6d00('0x2f')](function(_0x26acbd){if(_0x26acbd){logger[_0x6d00('0xe')](_0x6d00('0x30'));}})[_0x6d00('0x31')](function(_0x4c0cfb){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x6d00('0x1a')](_0x4c0cfb));});}};EmailChannel[_0x6d00('0x12')][_0x6d00('0x23')]=function(_0x4d06f1){if(this['mailAccounts'][_0x4d06f1]&&this[_0x6d00('0xf')][_0x4d06f1][_0x6d00('0x16')]){if(this[_0x6d00('0x10')][this[_0x6d00('0xf')][_0x4d06f1][_0x6d00('0x16')]['id']]){delete this[_0x6d00('0x10')][this['mailAccounts'][_0x4d06f1][_0x6d00('0x16')]['id']];}this['mailAccounts'][_0x4d06f1][_0x6d00('0x16')][_0x6d00('0x32')]=moment();this[_0x6d00('0x13')](_0x4d06f1);}};EmailChannel[_0x6d00('0x12')][_0x6d00('0x25')]=function(_0x12c829,_0x59b5da){if(this[_0x6d00('0xf')][_0x12c829]){this[_0x6d00('0xf')][_0x12c829]['Imap']['status']=_0x6d00('0x24');this[_0x6d00('0xf')][_0x12c829][_0x6d00('0x16')][_0x6d00('0x27')]=_0x59b5da;return this[_0x6d00('0x13')](_0x12c829);}};EmailChannel['prototype'][_0x6d00('0x33')]=function(_0x2dc44d,_0x506a81){return this[_0x6d00('0x11')][_0x6d00('0x34')](_0x2dc44d,_0x506a81);};EmailChannel[_0x6d00('0x12')][_0x6d00('0x35')]=function(_0x5e1c7a){var _0x3a8516=this;if(this['mailAccounts'][_0x5e1c7a['id']]){if(_['isNil'](this[_0x6d00('0xf')][_0x5e1c7a['id']][_0x6d00('0x36')])){this[_0x6d00('0xf')][_0x5e1c7a['id']]['Smtp']={};}this[_0x6d00('0xf')][_0x5e1c7a['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0xa8e402,_0x23857b){return _0x3a8516['smtp']['verify'](_0x5e1c7a)[_0x6d00('0x2f')](function(_0x5a813c){_0x3a8516[_0x6d00('0xf')][_0x5e1c7a['id']][_0x6d00('0x36')][_0x6d00('0x17')]=_0x6d00('0x37');_0x3a8516['mailAccounts'][_0x5e1c7a['id']][_0x6d00('0x36')]['messageStatus']='';_0x3a8516['emit'](_0x5e1c7a['id']);_0xa8e402(_0x5a813c);})[_0x6d00('0x31')](function(_0x1b8a4f){_0x3a8516[_0x6d00('0xf')][_0x5e1c7a['id']]['Smtp'][_0x6d00('0x17')]='error';_0x3a8516[_0x6d00('0xf')][_0x5e1c7a['id']]['Smtp'][_0x6d00('0x27')]=_0x1b8a4f;_0x3a8516[_0x6d00('0x13')](_0x5e1c7a['id']);_0x23857b(_0x1b8a4f);});});}return this[_0x6d00('0x11')]['verify'](_0x5e1c7a);};module[_0x6d00('0x38')]=EmailChannel; \ No newline at end of file +var _0x4104=['disabled','prototype','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','error','lastSync','handleImapError','send','verifySmtp','Smtp','verify','verified','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','service','custom','provider','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','status'];(function(_0x58c2ac,_0x58c01b){var _0x10cb51=function(_0x57d85d){while(--_0x57d85d){_0x58c2ac['push'](_0x58c2ac['shift']());}};_0x10cb51(++_0x58c01b);}(_0x4104,0x1d6));var _0x4410=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x4104[_0x4fb1b8];return _0x146c71;};'use strict';var _=require(_0x4410('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x4410('0x1'));var Redis=require(_0x4410('0x2'));var config=require(_0x4410('0x3'));var logger=require(_0x4410('0x4'))(_0x4410('0x5'));config[_0x4410('0x6')]=_['defaults'](config[_0x4410('0x6')],{'host':_0x4410('0x7'),'port':0x18eb});var io=require(_0x4410('0x8'))(new Redis(config[_0x4410('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x4410('0x9'));var md5Accounts={};function EmailChannel(_0x211eaa){logger[_0x4410('0xa')](_0x4410('0xb'));this[_0x4410('0xc')]=_0x211eaa['mailAccounts'];this['imapAccounts']={};this[_0x4410('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x4410('0xe')]=function(_0x49ae98){var _0x617f65=this['mailAccounts'][_0x49ae98];var _0x71741d={'id':_0x617f65['id'],'name':_0x617f65['name'],'key':_0x617f65[_0x4410('0xf')],'active':_0x617f65[_0x4410('0x10')],'Imap':{'status':_0x617f65['Imap']['status'],'messageStatus':_0x617f65[_0x4410('0x11')][_0x4410('0x12')],'total':_0x617f65['Imap'][_0x4410('0x13')]}};if(_[_0x4410('0x14')](md5Accounts[_0x49ae98])){md5Accounts[_0x49ae98]={};}var _0x38b6df=md5(JSON[_0x4410('0x15')](_0x71741d));if(md5Accounts[_0x49ae98][_0x4410('0x1')]!==_0x38b6df){md5Accounts[_0x49ae98][_0x4410('0x1')]=_0x38b6df;io['emit'](_0x4410('0x16'),_0x71741d);}};EmailChannel['prototype']['refresh']=function(_0x20f21b){for(var _0x14560f in _0x20f21b){if(_0x20f21b[_0x4410('0x17')](_0x14560f)){if(_0x20f21b[_0x14560f][_0x4410('0x11')]&&_0x20f21b[_0x14560f][_0x4410('0x10')]){var _0x2a4f42=_0x20f21b[_0x14560f][_0x4410('0x11')];if(!_0x2a4f42[_0x4410('0x18')]&&_0x20f21b[_0x14560f]['provider']!==_0x4410('0x19'))_0x2a4f42[_0x4410('0x18')]=_0x20f21b[_0x14560f][_0x4410('0x1a')];if(!this[_0x4410('0x1b')]['hasOwnProperty'](_0x2a4f42['id'])){this[_0x4410('0x1b')][_0x2a4f42['id']]=new EmailImap(_0x2a4f42,_0x20f21b[_0x14560f][_0x4410('0x5')]);this[_0x4410('0x1b')][_0x2a4f42['id']]['on'](_0x4410('0x1c'),this['handleImapBox'][_0x4410('0x1d')](this,_0x14560f));this['imapAccounts'][_0x2a4f42['id']]['on'](_0x4410('0x5'),this[_0x4410('0x1e')][_0x4410('0x1d')](this,_0x14560f));this[_0x4410('0x1b')][_0x2a4f42['id']]['on'](_0x4410('0x1f'),this[_0x4410('0x20')][_0x4410('0x1d')](this,_0x14560f));this['imapAccounts'][_0x2a4f42['id']]['on']('error',this['handleImapError'][_0x4410('0x1d')](this,_0x14560f));}}else{if(_[_0x4410('0x14')](this[_0x4410('0xc')][_0x14560f][_0x4410('0x11')])){this[_0x4410('0xc')][_0x14560f][_0x4410('0x11')]={};}this['mailAccounts'][_0x14560f][_0x4410('0x11')][_0x4410('0x21')]=_0x4410('0x22');this[_0x4410('0xc')][_0x14560f]['Imap'][_0x4410('0x12')]='';this['emit'](_0x14560f);}}}};EmailChannel[_0x4410('0x23')][_0x4410('0x24')]=function(_0x5e9853,_0x33310d){if(this[_0x4410('0xc')][_0x5e9853]){this[_0x4410('0xc')][_0x5e9853][_0x4410('0x11')][_0x4410('0x21')]=_0x4410('0x25');this[_0x4410('0xc')][_0x5e9853][_0x4410('0x11')]['messageStatus']=_0x33310d[_0x4410('0x26')];if(_0x33310d['messages']){this[_0x4410('0xc')][_0x5e9853][_0x4410('0x11')][_0x4410('0x13')]=_0x33310d[_0x4410('0x27')][_0x4410('0x13')];}return this[_0x4410('0xe')](_0x5e9853);}};EmailChannel[_0x4410('0x23')][_0x4410('0x1e')]=function(_0x164b10,_0x40db2d){logger[_0x4410('0xa')](_0x4410('0x28'),_0x40db2d[_0x4410('0x29')],_0x40db2d[_0x4410('0x2a')],_0x40db2d[_0x4410('0x2b')],_0x164b10);if(this[_0x4410('0xc')][_0x164b10]){return mailAccount[_0x4410('0x2c')](_0x164b10,_0x40db2d)[_0x4410('0x2d')](function(_0x4838f3){if(_0x4838f3){logger[_0x4410('0xa')]('Mail\x20accepted\x20from\x20routing');}})[_0x4410('0x2e')](function(_0x59eb2c){logger[_0x4410('0x2f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4410('0x15')](_0x59eb2c));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x4ab773){if(this[_0x4410('0xc')][_0x4ab773]&&this[_0x4410('0xc')][_0x4ab773][_0x4410('0x11')]){if(this[_0x4410('0x1b')][this[_0x4410('0xc')][_0x4ab773][_0x4410('0x11')]['id']]){delete this[_0x4410('0x1b')][this[_0x4410('0xc')][_0x4ab773][_0x4410('0x11')]['id']];}this[_0x4410('0xc')][_0x4ab773][_0x4410('0x11')][_0x4410('0x30')]=moment();this[_0x4410('0xe')](_0x4ab773);}};EmailChannel[_0x4410('0x23')][_0x4410('0x31')]=function(_0x1d9787,_0x4687c6){if(this[_0x4410('0xc')][_0x1d9787]){this[_0x4410('0xc')][_0x1d9787]['Imap'][_0x4410('0x21')]=_0x4410('0x2f');this['mailAccounts'][_0x1d9787][_0x4410('0x11')][_0x4410('0x12')]=_0x4687c6;return this[_0x4410('0xe')](_0x1d9787);}};EmailChannel[_0x4410('0x23')]['sendMail']=function(_0x315b41,_0x3a8c86){return this[_0x4410('0xd')][_0x4410('0x32')](_0x315b41,_0x3a8c86);};EmailChannel['prototype'][_0x4410('0x33')]=function(_0x1fa9fe){var _0x2029ee=this;if(this[_0x4410('0xc')][_0x1fa9fe['id']]){if(_['isNil'](this['mailAccounts'][_0x1fa9fe['id']][_0x4410('0x34')])){this[_0x4410('0xc')][_0x1fa9fe['id']]['Smtp']={};}this[_0x4410('0xc')][_0x1fa9fe['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x341ff2,_0x5598d2){return _0x2029ee[_0x4410('0xd')][_0x4410('0x35')](_0x1fa9fe)[_0x4410('0x2d')](function(_0x535450){_0x2029ee['mailAccounts'][_0x1fa9fe['id']][_0x4410('0x34')][_0x4410('0x21')]=_0x4410('0x36');_0x2029ee[_0x4410('0xc')][_0x1fa9fe['id']][_0x4410('0x34')][_0x4410('0x12')]='';_0x2029ee[_0x4410('0xe')](_0x1fa9fe['id']);_0x341ff2(_0x535450);})[_0x4410('0x2e')](function(_0x2d1423){_0x2029ee['mailAccounts'][_0x1fa9fe['id']][_0x4410('0x34')][_0x4410('0x21')]='error';_0x2029ee[_0x4410('0xc')][_0x1fa9fe['id']]['Smtp'][_0x4410('0x12')]=_0x2d1423;_0x2029ee[_0x4410('0xe')](_0x1fa9fe['id']);_0x5598d2(_0x2d1423);});});}return this[_0x4410('0xd')][_0x4410('0x35')](_0x1fa9fe);};module[_0x4410('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ecb1a21..29afc0a 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 _0xa46e=['emit','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','once','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','events','./utils','email','mailbox','account','getAccount','imap','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','generateXOAuth2Token','CloudProvider','password','host','tls','required','handleReady','openBox','handleOpenBox'];(function(_0x8df2bf,_0x42b29b){var _0x267fc3=function(_0x334709){while(--_0x334709){_0x8df2bf['push'](_0x8df2bf['shift']());}};_0x267fc3(++_0x42b29b);}(_0xa46e,0x8a));var _0xea46=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xa46e[_0x4c9380];return _0x49a523;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var Imap=require('imap');var simpleParser=require(_0xea46('0x2'))[_0xea46('0x3')];var Iconv=require(_0xea46('0x4'))['Iconv'];var EventEmitter=require(_0xea46('0x5'))['EventEmitter'];var utils=require(_0xea46('0x6'));var logger=require('../../../config/logger')(_0xea46('0x7'));function EmailImap(_0x528404,_0x10bee5){this[_0xea46('0x8')]='INBOX';this[_0xea46('0x9')]=this[_0xea46('0xa')](_0x528404,_0x10bee5);this[_0xea46('0xb')]=new Imap(this[_0xea46('0x9')]);this[_0xea46('0xb')]['once']('ready',this['handleReady'][_0xea46('0xc')](this));this[_0xea46('0xb')]['once'](_0xea46('0xd'),this[_0xea46('0xe')][_0xea46('0xc')](this));this['imap']['on'](_0xea46('0xf'),this[_0xea46('0x10')]['bind'](this));this[_0xea46('0xb')][_0xea46('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xea46('0x12')]['getAccount']=function(_0x3024af,_0x42c328){var _0x6c4bc4={'connTimeout':_0x3024af[_0xea46('0x13')]?_0x3024af[_0xea46('0x13')]*0x3e8:0x2710,'authTimeout':_0x3024af[_0xea46('0x14')]?_0x3024af[_0xea46('0x14')]*0x3e8:0x1388};if(_0x3024af[_0xea46('0x15')]){_0x6c4bc4[_0xea46('0x16')]=_0x3024af['user'];_0x6c4bc4[_0xea46('0x7')]=_0x42c328||_0x3024af[_0xea46('0x16')]||_0xea46('0x17');if(_0x3024af['modernAuthentication']){_0x6c4bc4['xoauth2']=utils[_0xea46('0x18')](_0x3024af[_0xea46('0x19')]['data5'],_0x3024af['user']);}else{_0x6c4bc4[_0xea46('0x1a')]=_0x3024af[_0xea46('0x1a')];}}else{if(_0x3024af['authentication']){_0x6c4bc4[_0xea46('0x16')]=_0x3024af[_0xea46('0x16')];_0x6c4bc4[_0xea46('0x1a')]=_0x3024af[_0xea46('0x1a')];}}_0x6c4bc4['host']=_0x3024af[_0xea46('0x1b')];_0x6c4bc4['port']=_0x3024af['port']||0x3e1;if(_0x3024af[_0xea46('0x1c')]){_0x6c4bc4['tls']=!![];}else{_0x6c4bc4['tls']=![];_0x6c4bc4['autotls']=_0xea46('0x1d');}return _0x6c4bc4;};EmailImap[_0xea46('0x12')][_0xea46('0x1e')]=function(){this['imap'][_0xea46('0x1f')](this['mailbox'],![],this[_0xea46('0x20')][_0xea46('0xc')](this));};EmailImap['prototype'][_0xea46('0x20')]=function(_0x5480eb,_0x2b3a8f){if(_0x5480eb){this[_0xea46('0x10')](_0x5480eb,!![]);}else{this[_0xea46('0x21')]('box',_0x2b3a8f);this['readUnseen']();}};EmailImap[_0xea46('0x12')][_0xea46('0x22')]=function(_0x4b369c){if(_0x4b369c){this[_0xea46('0x10')](_0x4b369c,!![]);}else{this['imap'][_0xea46('0xd')]();}};EmailImap['prototype'][_0xea46('0x23')]=function(){this[_0xea46('0xb')][_0xea46('0x24')]([_0xea46('0x25')],this[_0xea46('0x26')][_0xea46('0xc')](this));};EmailImap['prototype'][_0xea46('0x26')]=function(_0x338e96,_0x200e10){if(_0x338e96){this['handleError'](_0x338e96,!![]);}else{if(_0x200e10[_0xea46('0x27')]){try{var _0x3cdf96=this[_0xea46('0xb')]['fetch'](_0x200e10,{'bodies':'','markSeen':!![]});_0x3cdf96['on']('message',this['handleFetchMessage'][_0xea46('0xc')](this));_0x3cdf96[_0xea46('0x28')](_0xea46('0xf'),this[_0xea46('0x29')][_0xea46('0xc')](this));_0x3cdf96[_0xea46('0x28')](_0xea46('0xd'),this[_0xea46('0x2a')][_0xea46('0xc')](this));}catch(_0x1c7201){logger[_0xea46('0xf')](_0x1c7201);}}else{this['imap'][_0xea46('0x2b')](!![],this[_0xea46('0x22')][_0xea46('0xc')](this));}}};EmailImap[_0xea46('0x12')][_0xea46('0x2c')]=function(_0x23aefd){_0x23aefd['on'](_0xea46('0x2d'),this['handleMessageBody'][_0xea46('0xc')](this));_0x23aefd[_0xea46('0x28')](_0xea46('0x2e'),this[_0xea46('0x2f')][_0xea46('0xc')](this));_0x23aefd['once']('end',this[_0xea46('0x30')][_0xea46('0xc')](this));};EmailImap['prototype'][_0xea46('0x31')]=function(_0x2de735){simpleParser(_0x2de735,{'Iconv':Iconv},this[_0xea46('0x32')][_0xea46('0xc')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0xea46('0x12')]['handleMessageEnd']=function(){};EmailImap[_0xea46('0x12')][_0xea46('0x32')]=function(_0x5aa717,_0x1e61fd){if(_0x5aa717){logger[_0xea46('0xf')](_0x5aa717);}else{var _0x5f5697=this;utils[_0xea46('0x33')](this[_0xea46('0x9')],_0x1e61fd,function(_0x5f37f2){_0x5f5697[_0xea46('0x21')](_0xea46('0x7'),_0x5f37f2);});}};EmailImap[_0xea46('0x12')][_0xea46('0x2a')]=function(){this['imap'][_0xea46('0x2b')](!![],this[_0xea46('0x22')][_0xea46('0xc')](this));};EmailImap[_0xea46('0x12')][_0xea46('0x29')]=function(_0x504ad3){this[_0xea46('0x10')](_0x504ad3);this[_0xea46('0xb')]['closeBox'](!![],this[_0xea46('0x22')][_0xea46('0xc')](this));};EmailImap[_0xea46('0x12')][_0xea46('0xe')]=function(){this['emit'](_0xea46('0xd'));};EmailImap[_0xea46('0x12')][_0xea46('0x10')]=function(_0x4d0129,_0x39fd2d){logger[_0xea46('0xf')](_0xea46('0x10'),this[_0xea46('0x9')][_0xea46('0x7')],JSON[_0xea46('0x34')](_0x4d0129));var _0x23940c='';if(_0x4d0129){if(_0x4d0129[_0xea46('0x35')]){_0x23940c=_0x4d0129[_0xea46('0x35')];}else{for(var _0x23ab02 in _0x4d0129){if(_0x4d0129[_0xea46('0x36')](_0x23ab02)){_0x23940c+=_[_0xea46('0x37')](_0x23ab02)+':\x20'+_0x4d0129[_0x23ab02]+'\x0a';}}}}if(_0x39fd2d){this[_0xea46('0xb')][_0xea46('0xd')]();}else{this[_0xea46('0x21')]('error',_0x23940c);this['emit'](_0xea46('0xd'));}};module[_0xea46('0x38')]=EmailImap; \ No newline at end of file +var _0xaa64=['hasOwnProperty','upperFirst','exports','lodash','util','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','imap','account','once','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','data5','password','authentication','host','port','tls','required','openBox','emit','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','textCode'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xaa64,0xf7));var _0x4aa6=function(_0x1cf969,_0x5a6238){_0x1cf969=_0x1cf969-0x0;var _0x4711f0=_0xaa64[_0x1cf969];return _0x4711f0;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var Imap=require('imap');var simpleParser=require(_0x4aa6('0x2'))['simpleParser'];var Iconv=require(_0x4aa6('0x3'))[_0x4aa6('0x4')];var EventEmitter=require(_0x4aa6('0x5'))['EventEmitter'];var utils=require(_0x4aa6('0x6'));var logger=require(_0x4aa6('0x7'))(_0x4aa6('0x8'));function EmailImap(_0x37a260,_0x426bd6){this[_0x4aa6('0x9')]=_0x4aa6('0xa');this['account']=this['getAccount'](_0x37a260,_0x426bd6);this[_0x4aa6('0xb')]=new Imap(this[_0x4aa6('0xc')]);this['imap'][_0x4aa6('0xd')]('ready',this[_0x4aa6('0xe')][_0x4aa6('0xf')](this));this[_0x4aa6('0xb')][_0x4aa6('0xd')]('end',this[_0x4aa6('0x10')][_0x4aa6('0xf')](this));this[_0x4aa6('0xb')]['on'](_0x4aa6('0x11'),this[_0x4aa6('0x12')][_0x4aa6('0xf')](this));this[_0x4aa6('0xb')][_0x4aa6('0x13')]();}util[_0x4aa6('0x14')](EmailImap,EventEmitter);EmailImap[_0x4aa6('0x15')]['getAccount']=function(_0x413222,_0x5b0133){var _0x561f5d={'connTimeout':_0x413222[_0x4aa6('0x16')]?_0x413222[_0x4aa6('0x16')]*0x3e8:0x2710,'authTimeout':_0x413222[_0x4aa6('0x17')]?_0x413222[_0x4aa6('0x17')]*0x3e8:0x1388};if(_0x413222[_0x4aa6('0x18')]){_0x561f5d[_0x4aa6('0x19')]=_0x413222[_0x4aa6('0x19')];_0x561f5d[_0x4aa6('0x8')]=_0x5b0133||_0x413222['user']||_0x4aa6('0x1a');if(_0x413222['modernAuthentication']){_0x561f5d[_0x4aa6('0x1b')]=utils['generateXOAuth2Token'](_0x413222['CloudProvider'][_0x4aa6('0x1c')],_0x413222[_0x4aa6('0x19')]);}else{_0x561f5d[_0x4aa6('0x1d')]=_0x413222[_0x4aa6('0x1d')];}}else{if(_0x413222[_0x4aa6('0x1e')]){_0x561f5d[_0x4aa6('0x19')]=_0x413222[_0x4aa6('0x19')];_0x561f5d[_0x4aa6('0x1d')]=_0x413222[_0x4aa6('0x1d')];}}_0x561f5d['host']=_0x413222[_0x4aa6('0x1f')];_0x561f5d[_0x4aa6('0x20')]=_0x413222[_0x4aa6('0x20')]||0x3e1;if(_0x413222[_0x4aa6('0x21')]){_0x561f5d[_0x4aa6('0x21')]=!![];}else{_0x561f5d[_0x4aa6('0x21')]=![];_0x561f5d['autotls']=_0x4aa6('0x22');}return _0x561f5d;};EmailImap[_0x4aa6('0x15')][_0x4aa6('0xe')]=function(){this[_0x4aa6('0xb')][_0x4aa6('0x23')](this[_0x4aa6('0x9')],![],this['handleOpenBox'][_0x4aa6('0xf')](this));};EmailImap[_0x4aa6('0x15')]['handleOpenBox']=function(_0x5947c4,_0x347856){if(_0x5947c4){this[_0x4aa6('0x12')](_0x5947c4,!![]);}else{this[_0x4aa6('0x24')](_0x4aa6('0x25'),_0x347856);this[_0x4aa6('0x26')]();}};EmailImap['prototype'][_0x4aa6('0x27')]=function(_0x185fdf){if(_0x185fdf){this[_0x4aa6('0x12')](_0x185fdf,!![]);}else{this[_0x4aa6('0xb')][_0x4aa6('0x28')]();}};EmailImap[_0x4aa6('0x15')]['readUnseen']=function(){this[_0x4aa6('0xb')][_0x4aa6('0x29')](['UNSEEN'],this[_0x4aa6('0x2a')][_0x4aa6('0xf')](this));};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x2a')]=function(_0x4d4b60,_0x21efc9){if(_0x4d4b60){this[_0x4aa6('0x12')](_0x4d4b60,!![]);}else{if(_0x21efc9[_0x4aa6('0x2b')]){try{var _0x52b038=this[_0x4aa6('0xb')][_0x4aa6('0x2c')](_0x21efc9,{'bodies':'','markSeen':!![]});_0x52b038['on'](_0x4aa6('0x2d'),this['handleFetchMessage'][_0x4aa6('0xf')](this));_0x52b038[_0x4aa6('0xd')]('error',this[_0x4aa6('0x2e')][_0x4aa6('0xf')](this));_0x52b038[_0x4aa6('0xd')](_0x4aa6('0x28'),this[_0x4aa6('0x2f')]['bind'](this));}catch(_0x5b7ecc){logger[_0x4aa6('0x11')](_0x5b7ecc);}}else{this[_0x4aa6('0xb')][_0x4aa6('0x30')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x31')]=function(_0x3efc36){_0x3efc36['on'](_0x4aa6('0x32'),this[_0x4aa6('0x33')][_0x4aa6('0xf')](this));_0x3efc36[_0x4aa6('0xd')](_0x4aa6('0x34'),this['handleMessageAttributes'][_0x4aa6('0xf')](this));_0x3efc36[_0x4aa6('0xd')](_0x4aa6('0x28'),this[_0x4aa6('0x35')][_0x4aa6('0xf')](this));};EmailImap[_0x4aa6('0x15')]['handleMessageBody']=function(_0x223616){simpleParser(_0x223616,{'Iconv':Iconv},this[_0x4aa6('0x36')]['bind'](this));};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x37')]=function(){};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x35')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1126c4,_0x2ad1bd){if(_0x1126c4){logger[_0x4aa6('0x11')](_0x1126c4);}else{var _0x5a74e8=this;utils[_0x4aa6('0x38')](this[_0x4aa6('0xc')],_0x2ad1bd,function(_0x5e8661){_0x5a74e8[_0x4aa6('0x24')](_0x4aa6('0x8'),_0x5e8661);});}};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x2f')]=function(){this[_0x4aa6('0xb')][_0x4aa6('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x2e')]=function(_0x3267c6){this[_0x4aa6('0x12')](_0x3267c6);this[_0x4aa6('0xb')]['closeBox'](!![],this[_0x4aa6('0x27')][_0x4aa6('0xf')](this));};EmailImap['prototype'][_0x4aa6('0x10')]=function(){this[_0x4aa6('0x24')](_0x4aa6('0x28'));};EmailImap[_0x4aa6('0x15')][_0x4aa6('0x12')]=function(_0x519e41,_0x29bbf5){logger[_0x4aa6('0x11')]('handleError',this[_0x4aa6('0xc')][_0x4aa6('0x8')],JSON['stringify'](_0x519e41));var _0x12e6da='';if(_0x519e41){if(_0x519e41[_0x4aa6('0x39')]){_0x12e6da=_0x519e41['textCode'];}else{for(var _0x1468d1 in _0x519e41){if(_0x519e41[_0x4aa6('0x3a')](_0x1468d1)){_0x12e6da+=_[_0x4aa6('0x3b')](_0x1468d1)+':\x20'+_0x519e41[_0x1468d1]+'\x0a';}}}}if(_0x29bbf5){this[_0x4aa6('0xb')][_0x4aa6('0x28')]();}else{this[_0x4aa6('0x24')](_0x4aa6('0x11'),_0x12e6da);this['emit'](_0x4aa6('0x28'));}};module[_0x4aa6('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index aa0606a..7cd6782 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 _0x5b24=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString'];(function(_0xe8ec99,_0x2f348a){var _0x282e11=function(_0x3329b){while(--_0x3329b){_0xe8ec99['push'](_0xe8ec99['shift']());}};_0x282e11(++_0x2f348a);}(_0x5b24,0x19a));var _0x45b2=function(_0x5826da,_0x4ffb7f){_0x5826da=_0x5826da-0x0;var _0x127236=_0x5b24[_0x5826da];return _0x127236;};'use strict';var nodemailer=require(_0x45b2('0x0'));var inlineBase64=require(_0x45b2('0x1'));function EmailSmtp(){}EmailSmtp[_0x45b2('0x2')][_0x45b2('0x3')]=function(_0x137da7,_0x4d9f9d){return new Promise(function(_0x3c5ade,_0x5b0abe){var _0x130a39=nodemailer[_0x45b2('0x4')](_0x137da7);_0x130a39['use'](_0x45b2('0x5'),inlineBase64());_0x130a39[_0x45b2('0x6')](_0x4d9f9d,function(_0xf91c33,_0x32aed0){if(_0xf91c33){_0x5b0abe(_0xf91c33[_0x45b2('0x7')]());}else{_0x3c5ade(_0x32aed0);}});});};EmailSmtp[_0x45b2('0x2')][_0x45b2('0x8')]=function(_0x5cb307){return new Promise(function(_0x1c53e4,_0x5eecef){var _0x4f2911=nodemailer['createTransport'](_0x5cb307);_0x4f2911[_0x45b2('0x8')](function(_0x2fc489,_0x235a98){if(_0x2fc489){_0x5eecef(_0x2fc489[_0x45b2('0x7')]());}else{if(_0x235a98){_0x1c53e4(_0x235a98);}else{_0x5eecef(_0x45b2('0x9'));}}});});};module[_0x45b2('0xa')]=EmailSmtp; \ No newline at end of file +var _0x1427=['sendMail','verify','createTransport','toString','Not\x20verifired','exports','nodemailer','prototype','send','use'];(function(_0x138c22,_0x33b565){var _0x33a940=function(_0x24bd3c){while(--_0x24bd3c){_0x138c22['push'](_0x138c22['shift']());}};_0x33a940(++_0x33b565);}(_0x1427,0x114));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0x7142('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x7142('0x1')][_0x7142('0x2')]=function(_0x10f098,_0x1b8726){return new Promise(function(_0x534a6b,_0x4e0e48){var _0x8805f9=nodemailer['createTransport'](_0x10f098);_0x8805f9[_0x7142('0x3')]('compile',inlineBase64());_0x8805f9[_0x7142('0x4')](_0x1b8726,function(_0x1fda5d,_0x3bdebe){if(_0x1fda5d){_0x4e0e48(_0x1fda5d['toString']());}else{_0x534a6b(_0x3bdebe);}});});};EmailSmtp['prototype'][_0x7142('0x5')]=function(_0x42c876){return new Promise(function(_0x40e608,_0x23c647){var _0x2e84d9=nodemailer[_0x7142('0x6')](_0x42c876);_0x2e84d9[_0x7142('0x5')](function(_0x4e0ba8,_0x1c9bd4){if(_0x4e0ba8){_0x23c647(_0x4e0ba8[_0x7142('0x7')]());}else{if(_0x1c9bd4){_0x40e608(_0x1c9bd4);}else{_0x23c647(_0x7142('0x8'));}}});});};module[_0x7142('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 188d474..56da129 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 _0x4493=['root','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','utf-8','toString','base64','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','indexOf','split','slice','Anonymous','isEmpty','anonymous','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5446d0[_0x3449('0xf')](0x0,-0x1)['join']('\x20'):_0x1e898d[_0x3449('0xc')];}return _0x3449('0x10');}function getLastName(_0x317f2c){var _0x20466a=_[_0x3449('0x7')](_0x317f2c[_0x3449('0x8')]);if(_0x20466a&&_0x20466a[_0x3449('0xc')]){var _0x4f6632=_0x20466a[_0x3449('0xc')][_0x3449('0xe')](/\s+/);return _0x4f6632['length']>0x1?_0x4f6632['pop']():'';}return'';}function getMails(_0xf14ff9,_0x99438e){var _0x3ccec0='';for(var _0x6c891e=0x0;_0x6c891e<_0x99438e[_0x3449('0x8')]['length'];_0x6c891e+=0x1){if(_0x99438e['value'][_0x6c891e][_0x3449('0x9')]!==_0xf14ff9){if(!_[_0x3449('0x11')](_0x3ccec0)){_0x3ccec0+=',';}_0x3ccec0+=_0x99438e[_0x3449('0x8')][_0x6c891e][_0x3449('0xc')]||_0x99438e[_0x3449('0x8')][_0x6c891e]['address']||'';_0x3ccec0+='\x20<';_0x3ccec0+=_0x99438e['value'][_0x6c891e][_0x3449('0x9')]?_0x99438e['value'][_0x6c891e][_0x3449('0x9')]:_0x3449('0x12')+random[_0x3449('0xa')](0x6)+_0x3449('0xb');_0x3ccec0+='>';}}return _0x3ccec0;}function parseEmail(_0x47fc2e,_0x341ae7,_0x86b88a){if(_0x341ae7['html']){var _0x35c0e9=/)<[^<]*)*<\/script>/gi;while(_0x35c0e9[_0x3449('0x13')](_0x341ae7[_0x3449('0x14')])){_0x341ae7[_0x3449('0x14')]=_0x341ae7[_0x3449('0x14')][_0x3449('0x15')](_0x35c0e9,'');}if(_0x341ae7[_0x3449('0x14')][_0x3449('0x16')](_0x3449('0x17'))){var _0x457ae1=[];_0x341ae7[_0x3449('0x18')][_0x3449('0x19')](_0x48317c=>{_0x457ae1['push'](_0x48317c[_0x3449('0x1a')]);});var _0x42949b=/]+>/g;var _0x568470=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x36d640=_0x341ae7['html'][_0x3449('0x15')](_0x568470,_0x3449('0x1b'));var _0xf02a63=_0x36d640[_0x3449('0x15')](_0x42949b,_0x3449('0x1c'));for(let _0x316067=0x0;_0x316067<_0x457ae1[_0x3449('0x1d')];_0x316067++){var _0x3bb8ed=_0xf02a63[_0x3449('0x15')](_0x3449('0x1c'),_0x3449('0x1e')+_0x457ae1[_0x316067]+_0x3449('0x1f'));_0xf02a63=_0x3bb8ed;}_0x341ae7[_0x3449('0x14')]=_0xf02a63;}_0x86b88a[_0x3449('0x20')]=_0x341ae7[_0x3449('0x14')];}else{_0x86b88a['body']=_0x341ae7[_0x3449('0x21')];}if(_0x86b88a[_0x3449('0x20')]){_0x86b88a['body']=_0x86b88a[_0x3449('0x20')]['replace'](/0x0){var _0x1adadb=[_0x3449('0x33'),'X-Auto-Response-Suppress:\x20All',_0x3449('0x34')];for(var _0x4fd440=0x0;_0x4fd440<_0x341ae7[_0x3449('0x32')]['length'];_0x4fd440++){var _0x16e693=_[_0x3449('0xd')](_0x1adadb,_0x341ae7[_0x3449('0x32')][_0x4fd440][_0x3449('0x35')]);if(_0x16e693>=0x0){_0x86b88a[_0x3449('0x36')]=!![];}}}return _0x86b88a;}exports[_0x3449('0x37')]=function(_0x1fa4ac,_0x3d6f89,_0x56edc1){var _0x8b61bc={'from':getAddress(_0x3d6f89[_0x3449('0x38')]),'firstName':getFirstName(_0x3d6f89[_0x3449('0x38')]),'lastName':getLastName(_0x3d6f89[_0x3449('0x38')]),'mapKey':_0x3449('0x25'),'message':{'from':getMails(_0x1fa4ac[_0x3449('0x25')],_0x3d6f89['from']),'to':_0x1fa4ac[_0x3449('0x25')],'cc':'','subject':_0x3d6f89[_0x3449('0x39')]||'','messageId':_0x3d6f89['messageId'],'inReplyTo':_0x3d6f89[_0x3449('0x3a')],'sentAt':moment(_0x3d6f89[_0x3449('0x3b')])['format'](_0x3449('0x3c')),'attach':![],'attachments':[]}};if(!_0x3d6f89[_0x3449('0x14')]&&!_0x3d6f89[_0x3449('0x21')]){var _0xd0999f=_['filter'](_0x3d6f89[_0x3449('0x18')],{'contentType':_0x3449('0x3d')});if(_0xd0999f[_0x3449('0x1d')]){logger[_0x3449('0x3e')](util[_0x3449('0x2a')](_0x3449('0x3f'),_0x3d6f89['messageId']));tnef['parseBuffer'](_[_0x3449('0x40')](_0xd0999f)[_0x3449('0x41')],function(_0x1b4719,_0x33783f){if(_0x33783f){_0x3d6f89[_0x3449('0x14')]=_0x33783f[_0x3449('0x42')]||_0x3449('0x43');if(_0x33783f[_0x3449('0x44')]){for(var _0x4fbbd0=0x0;_0x4fbbd0<_0x33783f[_0x3449('0x44')][_0x3449('0x1d')];_0x4fbbd0++){var _0x148ffd=_0x33783f[_0x3449('0x44')][_0x4fbbd0];_0x8b61bc[_0x3449('0x23')][_0x3449('0x18')]['push']({'filename':_0x148ffd[_0x3449('0x45')],'content':Buffer['from'](_0x148ffd[_0x3449('0x46')])});}}}_0x56edc1(parseEmail(_0x1fa4ac,_0x3d6f89,_0x8b61bc));});}else{_0x3d6f89[_0x3449('0x14')]=_0x3449('0x43');_0x56edc1(parseEmail(_0x1fa4ac,_0x3d6f89,_0x8b61bc));}}else{_0x56edc1(parseEmail(_0x1fa4ac,_0x3d6f89,_0x8b61bc));}};exports[_0x3449('0x47')]=function(_0x296d26,_0x1ba7b0){var _0x14d2c0=['user='+(_0x1ba7b0||''),'auth=Bearer\x20'+_0x296d26,'',''];return Buffer[_0x3449('0x38')](_0x14d2c0[_0x3449('0x2d')](''),_0x3449('0x48'))[_0x3449('0x49')](_0x3449('0x4a'));}; \ No newline at end of file +var _0x5626=['base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','value','address','anonymous','@xcally.com','name','substring','split','length','slice','Anonymous','pop','generate','html','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','user=','auth=Bearer\x20','utf-8','toString'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x5626,0x9b));var _0x6562=function(_0x6840c,_0x40cc30){_0x6840c=_0x6840c-0x0;var _0x528d1c=_0x5626[_0x6840c];return _0x528d1c;};'use strict';var _=require(_0x6562('0x0'));var moment=require(_0x6562('0x1'));var random=require(_0x6562('0x2'));var fs=require('fs');var path=require(_0x6562('0x3'));var util=require(_0x6562('0x4'));var tnef=require(_0x6562('0x5'));var logger=require(_0x6562('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x5bfce3){var _0x5ce7cf=_[_0x6562('0x7')](_0x5bfce3[_0x6562('0x8')]);return _0x5ce7cf&&_0x5ce7cf[_0x6562('0x9')]?_0x5ce7cf[_0x6562('0x9')]:_0x6562('0xa')+random['generate'](0x6)+_0x6562('0xb');}function getFirstName(_0x4f3c16){var _0x49fc4b=_[_0x6562('0x7')](_0x4f3c16[_0x6562('0x8')]);if(_0x49fc4b&&_0x49fc4b[_0x6562('0xc')]){if(_0x49fc4b[_0x6562('0xc')]==_0x49fc4b[_0x6562('0x9')]){return _0x49fc4b[_0x6562('0xc')][_0x6562('0xd')](0x0,_0x49fc4b[_0x6562('0xc')]['indexOf']('@'));}var _0x13e794=_0x49fc4b[_0x6562('0xc')][_0x6562('0xe')](/\s+/);return _0x13e794[_0x6562('0xf')]>0x1?_0x13e794[_0x6562('0x10')](0x0,-0x1)['join']('\x20'):_0x49fc4b[_0x6562('0xc')];}return _0x6562('0x11');}function getLastName(_0x5511cd){var _0x59f345=_['head'](_0x5511cd['value']);if(_0x59f345&&_0x59f345[_0x6562('0xc')]){var _0x2c0d37=_0x59f345[_0x6562('0xc')][_0x6562('0xe')](/\s+/);return _0x2c0d37[_0x6562('0xf')]>0x1?_0x2c0d37[_0x6562('0x12')]():'';}return'';}function getMails(_0x2082d7,_0x2d1ba8){var _0x113eae='';for(var _0x54cd8b=0x0;_0x54cd8b<_0x2d1ba8[_0x6562('0x8')][_0x6562('0xf')];_0x54cd8b+=0x1){if(_0x2d1ba8[_0x6562('0x8')][_0x54cd8b][_0x6562('0x9')]!==_0x2082d7){if(!_['isEmpty'](_0x113eae)){_0x113eae+=',';}_0x113eae+=_0x2d1ba8[_0x6562('0x8')][_0x54cd8b][_0x6562('0xc')]||_0x2d1ba8[_0x6562('0x8')][_0x54cd8b][_0x6562('0x9')]||'';_0x113eae+='\x20<';_0x113eae+=_0x2d1ba8[_0x6562('0x8')][_0x54cd8b][_0x6562('0x9')]?_0x2d1ba8[_0x6562('0x8')][_0x54cd8b][_0x6562('0x9')]:_0x6562('0xa')+random[_0x6562('0x13')](0x6)+'@xcally.com';_0x113eae+='>';}}return _0x113eae;}function parseEmail(_0x3da1d9,_0x269b5f,_0x179c67){if(_0x269b5f[_0x6562('0x14')]){var _0x4671ef=/)<[^<]*)*<\/script>/gi;while(_0x4671ef['test'](_0x269b5f['html'])){_0x269b5f[_0x6562('0x14')]=_0x269b5f['html'][_0x6562('0x15')](_0x4671ef,'');}if(_0x269b5f[_0x6562('0x14')][_0x6562('0x16')](_0x6562('0x17'))){var _0x4c3f99=[];_0x269b5f[_0x6562('0x18')][_0x6562('0x19')](_0x55bebd=>{_0x4c3f99[_0x6562('0x1a')](_0x55bebd['filename']);});var _0x3a3eac=/]+>/g;var _0x4868bd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b6a92=_0x269b5f['html']['replace'](_0x4868bd,_0x6562('0x1b'));var _0x2a7419=_0x5b6a92[_0x6562('0x15')](_0x3a3eac,_0x6562('0x1c'));for(let _0x3154f6=0x0;_0x3154f6<_0x4c3f99[_0x6562('0xf')];_0x3154f6++){var _0x26c609=_0x2a7419[_0x6562('0x15')](_0x6562('0x1c'),_0x6562('0x1d')+_0x4c3f99[_0x3154f6]+_0x6562('0x1e'));_0x2a7419=_0x26c609;}_0x269b5f[_0x6562('0x14')]=_0x2a7419;}_0x179c67[_0x6562('0x1f')]=_0x269b5f[_0x6562('0x14')];}else{_0x179c67[_0x6562('0x1f')]=_0x269b5f['textAsHtml'];}if(_0x179c67['body']){_0x179c67[_0x6562('0x1f')]=_0x179c67[_0x6562('0x1f')]['replace'](/0x0){var _0x148b83=[_0x6562('0x32'),_0x6562('0x33'),_0x6562('0x34')];for(var _0x343c4e=0x0;_0x343c4e<_0x269b5f['headerLines'][_0x6562('0xf')];_0x343c4e++){var _0x4aec34=_[_0x6562('0x35')](_0x148b83,_0x269b5f[_0x6562('0x31')][_0x343c4e][_0x6562('0x36')]);if(_0x4aec34>=0x0){_0x179c67[_0x6562('0x37')]=!![];}}}return _0x179c67;}exports[_0x6562('0x38')]=function(_0x3fd2e5,_0x17e815,_0xbcfd39){var _0xa37b3b={'from':getAddress(_0x17e815[_0x6562('0x39')]),'firstName':getFirstName(_0x17e815[_0x6562('0x39')]),'lastName':getLastName(_0x17e815[_0x6562('0x39')]),'mapKey':_0x6562('0x23'),'message':{'from':getMails(_0x3fd2e5['email'],_0x17e815['from']),'to':_0x3fd2e5['email'],'cc':'','subject':_0x17e815[_0x6562('0x3a')]||'','messageId':_0x17e815[_0x6562('0x3b')],'inReplyTo':_0x17e815[_0x6562('0x3c')],'sentAt':moment(_0x17e815[_0x6562('0x3d')])[_0x6562('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x17e815['html']&&!_0x17e815[_0x6562('0x3f')]){var _0x54d7f9=_['filter'](_0x17e815[_0x6562('0x18')],{'contentType':_0x6562('0x40')});if(_0x54d7f9[_0x6562('0xf')]){logger['info'](util[_0x6562('0x3e')](_0x6562('0x41'),_0x17e815[_0x6562('0x3b')]));tnef[_0x6562('0x42')](_['first'](_0x54d7f9)[_0x6562('0x43')],function(_0x3df5ba,_0x3a3b31){if(_0x3a3b31){_0x17e815['html']=_0x3a3b31[_0x6562('0x44')]||_0x6562('0x45');if(_0x3a3b31['Attachments']){for(var _0x2c9ee9=0x0;_0x2c9ee9<_0x3a3b31['Attachments'][_0x6562('0xf')];_0x2c9ee9++){var _0x53cc0a=_0x3a3b31[_0x6562('0x46')][_0x2c9ee9];_0xa37b3b[_0x6562('0x21')][_0x6562('0x18')][_0x6562('0x1a')]({'filename':_0x53cc0a[_0x6562('0x47')],'content':Buffer['from'](_0x53cc0a['Data'])});}}}_0xbcfd39(parseEmail(_0x3fd2e5,_0x17e815,_0xa37b3b));});}else{_0x17e815[_0x6562('0x14')]=_0x6562('0x45');_0xbcfd39(parseEmail(_0x3fd2e5,_0x17e815,_0xa37b3b));}}else{_0xbcfd39(parseEmail(_0x3fd2e5,_0x17e815,_0xa37b3b));}};exports['generateXOAuth2Token']=function(_0x79621c,_0x42b91f){var _0x139012=[_0x6562('0x48')+(_0x42b91f||''),_0x6562('0x49')+_0x79621c,'',''];return Buffer['from'](_0x139012[_0x6562('0x2d')](''),_0x6562('0x4a'))[_0x6562('0x4b')](_0x6562('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6febe1e..ef84930 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 _0xd0c8=['name','Service','key','SERV','Imap','Smtp','exports','lodash'];(function(_0x2b7188,_0x5cce6e){var _0x2118c8=function(_0x413447){while(--_0x413447){_0x2b7188['push'](_0x2b7188['shift']());}};_0x2118c8(++_0x5cce6e);}(_0xd0c8,0x87));var _0x8d0c=function(_0x42c839,_0x37543c){_0x42c839=_0x42c839-0x0;var _0x560fa2=_0xd0c8[_0x42c839];return _0x560fa2;};'use strict';var _=require(_0x8d0c('0x0'));function MailAccount(_0x50eb19){this['id']=_0x50eb19['id']||0x0;this[_0x8d0c('0x1')]=_0x50eb19[_0x8d0c('0x1')]||_0x8d0c('0x2');this[_0x8d0c('0x3')]=_0x50eb19['key']||_0x8d0c('0x4');this['active']=_0x50eb19['active']||![];this[_0x8d0c('0x5')]=_0x50eb19[_0x8d0c('0x5')]||[];this[_0x8d0c('0x6')]=_0x50eb19[_0x8d0c('0x6')]||[];}module[_0x8d0c('0x7')]=MailAccount; \ No newline at end of file +var _0xbaf7=['SERV','Imap','name','Service','key'];(function(_0x1bd4c4,_0x112f9f){var _0x5d6450=function(_0xa6cf6f){while(--_0xa6cf6f){_0x1bd4c4['push'](_0x1bd4c4['shift']());}};_0x5d6450(++_0x112f9f);}(_0xbaf7,0x115));var _0x7baf=function(_0x2e47a7,_0x48d263){_0x2e47a7=_0x2e47a7-0x0;var _0x171e31=_0xbaf7[_0x2e47a7];return _0x171e31;};'use strict';var _=require('lodash');function MailAccount(_0x3cd6b8){this['id']=_0x3cd6b8['id']||0x0;this[_0x7baf('0x0')]=_0x3cd6b8[_0x7baf('0x0')]||_0x7baf('0x1');this[_0x7baf('0x2')]=_0x3cd6b8['key']||_0x7baf('0x3');this['active']=_0x3cd6b8['active']||![];this['Imap']=_0x3cd6b8[_0x7baf('0x4')]||[];this['Smtp']=_0x3cd6b8['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d9b546f..95e57c1 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 _0x47be=['lodash','../model/mailAccount','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','mailAccounts','length','isUndefined','merge'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x47be,0x190));var _0xe47b=function(_0x14090e,_0x30c2f7){_0x14090e=_0x14090e-0x0;var _0x554da7=_0x47be[_0x14090e];return _0x554da7;};'use strict';var _=require(_0xe47b('0x0'));var MailAccount=require(_0xe47b('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x52c9b6,_0xc0b90,_0x3eea6c){var _0x3df1ca=_['mapKeys'](_0x52c9b6,function(_0x1e617b,_0x27dcf5){return _0x1e617b[_0x3eea6c];});for(var _0x533853 in _0xc0b90){if(_0xc0b90[_0xe47b('0x2')](_0x533853)){if(!_0x3df1ca[_0x533853]){delete _0xc0b90[_0x533853];}}}}Realtime['prototype'][_0xe47b('0x3')]=function(_0x5be5aa,_0x447989){for(var _0x2e4dcd in _0x447989){if(_0x5be5aa[_0xe47b('0x2')](_0x2e4dcd)){_0x5be5aa[_0x2e4dcd]=_0x447989[_0x2e4dcd];}}};Realtime[_0xe47b('0x4')][_0xe47b('0x5')]=function(){var _0x5074bc=this;return function(_0x518f4d){if(_0x518f4d){freeIsNotKey(_0x518f4d,_0x5074bc[_0xe47b('0x6')],'id');for(var _0x1cee9d=0x0,_0x1b1eb4={},_0x4979f7={};_0x1cee9d<_0x518f4d[_0xe47b('0x7')];_0x1cee9d+=0x1){_0x1b1eb4=_0x518f4d[_0x1cee9d];if(_[_0xe47b('0x8')](_0x5074bc[_0xe47b('0x6')][_0x1b1eb4['id']])){_0x5074bc[_0xe47b('0x6')][_0x1b1eb4['id']]=new MailAccount(_0x1b1eb4);}else{_[_0xe47b('0x9')](_0x5074bc[_0xe47b('0x6')][_0x1b1eb4['id']],_0x1b1eb4);}}}return _0x5074bc['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x26c8=['mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts','length','isUndefined','merge','lodash','mapKeys','prototype'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x26c8,0x75));var _0x826c=function(_0x5bbe7a,_0x287322){_0x5bbe7a=_0x5bbe7a-0x0;var _0x1c4e60=_0x26c8[_0x5bbe7a];return _0x1c4e60;};'use strict';var _=require(_0x826c('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2ddc96,_0x451a6b,_0x4e7840){var _0x82ff8=_[_0x826c('0x1')](_0x2ddc96,function(_0x4e446d,_0x2d8961){return _0x4e446d[_0x4e7840];});for(var _0x570bf9 in _0x451a6b){if(_0x451a6b['hasOwnProperty'](_0x570bf9)){if(!_0x82ff8[_0x570bf9]){delete _0x451a6b[_0x570bf9];}}}}Realtime[_0x826c('0x2')][_0x826c('0x3')]=function(_0x21905b,_0x1f41f8){for(var _0x1d4179 in _0x1f41f8){if(_0x21905b[_0x826c('0x4')](_0x1d4179)){_0x21905b[_0x1d4179]=_0x1f41f8[_0x1d4179];}}};Realtime['prototype'][_0x826c('0x5')]=function(){var _0x4e38a6=this;return function(_0x3b66ef){if(_0x3b66ef){freeIsNotKey(_0x3b66ef,_0x4e38a6[_0x826c('0x6')],'id');for(var _0x2f0b7b=0x0,_0x918b96={},_0x3022d5={};_0x2f0b7b<_0x3b66ef[_0x826c('0x7')];_0x2f0b7b+=0x1){_0x918b96=_0x3b66ef[_0x2f0b7b];if(_[_0x826c('0x8')](_0x4e38a6[_0x826c('0x6')][_0x918b96['id']])){_0x4e38a6[_0x826c('0x6')][_0x918b96['id']]=new MailAccount(_0x918b96);}else{_[_0x826c('0x9')](_0x4e38a6[_0x826c('0x6')][_0x918b96['id']],_0x918b96);}}}return _0x4e38a6[_0x826c('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 524c129..257b02e 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 _0xd47c=['provider','service','email','active','key','ListId','MailServerIn','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','NotifyMailAccount','getMailAccounts','Request','name'];(function(_0x573c72,_0x103ec0){var _0x516703=function(_0x50ecb9){while(--_0x50ecb9){_0x573c72['push'](_0x573c72['shift']());}};_0x516703(++_0x103ec0);}(_0xd47c,0x195));var _0xcd47=function(_0x1415ef,_0x5c219e){_0x1415ef=_0x1415ef-0x0;var _0x234acc=_0xd47c[_0x1415ef];return _0x234acc;};'use strict';var client=require('../client');exports[_0xcd47('0x0')]=function(){return function(){return client[_0xcd47('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xcd47('0x2'),_0xcd47('0x3'),_0xcd47('0x4'),_0xcd47('0x5'),_0xcd47('0x6'),_0xcd47('0x7'),_0xcd47('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xcd47('0x9'),'as':'Imap','include':[{'model':_0xcd47('0xa'),'attributes':['id',_0xcd47('0x2'),_0xcd47('0x4'),'type',_0xcd47('0xb')],'as':_0xcd47('0xa')}]},{'model':_0xcd47('0xc'),'as':_0xcd47('0xd'),'include':[{'model':_0xcd47('0xa'),'attributes':['id',_0xcd47('0x2'),_0xcd47('0x4'),_0xcd47('0xe'),_0xcd47('0xb')],'as':'CloudProvider'}]}]},'log':_0xcd47('0xf')});};};exports['notify']=function(_0x5e0f04,_0x4a4f16){return client[_0xcd47('0x1')](_0xcd47('0x10'),{'account':{'id':_0x5e0f04},'body':_0x4a4f16,'log':_0xcd47('0x10')});}; \ No newline at end of file +var _0x8ac9=['NotifyMailAccount','../client','getMailAccounts','Request','provider','service','email','ListId','TemplateId','MailServerIn','name','type','data5','CloudProvider','MailServerOut','getMailAccount','notify'];(function(_0x49c31f,_0x14b236){var _0x4c7256=function(_0x294b64){while(--_0x294b64){_0x49c31f['push'](_0x49c31f['shift']());}};_0x4c7256(++_0x14b236);}(_0x8ac9,0x199));var _0x98ac=function(_0x2be806,_0x506d74){_0x2be806=_0x2be806-0x0;var _0x42865b=_0x8ac9[_0x2be806];return _0x42865b;};'use strict';var client=require(_0x98ac('0x0'));exports[_0x98ac('0x1')]=function(){return function(){return client[_0x98ac('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x98ac('0x3'),_0x98ac('0x4'),_0x98ac('0x5'),'active','key',_0x98ac('0x6'),_0x98ac('0x7')],'raw':![],'include':[{'model':_0x98ac('0x8'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x98ac('0x9'),_0x98ac('0x4'),_0x98ac('0xa'),_0x98ac('0xb')],'as':_0x98ac('0xc')}]},{'model':_0x98ac('0xd'),'as':'Smtp','include':[{'model':_0x98ac('0xc'),'attributes':['id','name',_0x98ac('0x4'),_0x98ac('0xa'),_0x98ac('0xb')],'as':_0x98ac('0xc')}]}]},'log':_0x98ac('0xe')});};};exports[_0x98ac('0xf')]=function(_0x2ea2a8,_0x53b73a){return client['Request'](_0x98ac('0x10'),{'account':{'id':_0x2ea2a8},'body':_0x53b73a,'log':_0x98ac('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 083a964..af5acdd 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 _0xfa3d=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1b8045,_0x52fe44){var _0x850367=function(_0x4edab0){while(--_0x4edab0){_0x1b8045['push'](_0x1b8045['shift']());}};_0x850367(++_0x52fe44);}(_0xfa3d,0x181));var _0xdfa3=function(_0x5d7f99,_0x2f7145){_0x5d7f99=_0x5d7f99-0x0;var _0x22dbbd=_0xfa3d[_0x5d7f99];return _0x22dbbd;};'use strict';var client=require(_0xdfa3('0x0'));exports[_0xdfa3('0x1')]=function(){return client['Request'](_0xdfa3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdfa3('0x3')]},'log':_0xdfa3('0x4')});}; \ No newline at end of file +var _0x7d02=['getSettings','Request','GetSettings','../client'];(function(_0x24c811,_0x3bb49a){var _0x536236=function(_0x3d0f87){while(--_0x3d0f87){_0x24c811['push'](_0x24c811['shift']());}};_0x536236(++_0x3bb49a);}(_0x7d02,0x103));var _0x27d0=function(_0xc14b23,_0x547b28){_0xc14b23=_0xc14b23-0x0;var _0x56ea08=_0x7d02[_0xc14b23];return _0x56ea08;};'use strict';var client=require(_0x27d0('0x0'));exports[_0x27d0('0x1')]=function(){return client[_0x27d0('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x27d0('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 88b5213..27d7973 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 81999ff..785fe01 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 _0x3074=['pmessage','__keyspace@0__:expired','replace','_expire','split','checkUserIsOnline','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','redis','localhost','timeout','port','socket.io','websocket','polling','adapter','socket.io-redis','../../config/triggers','config','notify-keyspace-events','EKx','psubscribe','__key*__:expired'];(function(_0x57b740,_0x2827f3){var _0x7793=function(_0x2ed942){while(--_0x2ed942){_0x57b740['push'](_0x57b740['shift']());}};_0x7793(++_0x2827f3);}(_0x3074,0x1dd));var _0x4307=function(_0x20e441,_0x5467b7){_0x20e441=_0x20e441-0x0;var _0x298726=_0x3074[_0x20e441];return _0x298726;};'use strict';var _=require(_0x4307('0x0'));var http=require('http');var express=require(_0x4307('0x1'));var sticky=require(_0x4307('0x2'));var Redis=require(_0x4307('0x3'));var config=require('../../config/environment');config[_0x4307('0x4')]=_['defaults'](config[_0x4307('0x4')],{'host':_0x4307('0x5'),'port':0x18eb});var app=express();var server=http['createServer'](app);server[_0x4307('0x6')]=0xdbba0;var pub=new Redis(config[_0x4307('0x4')]);var sub=new Redis(config[_0x4307('0x4')]);if(sticky['listen'](server,config[_0x4307('0x7')])){var socketio=require(_0x4307('0x8'))(server,{'transports':[_0x4307('0x9'),_0x4307('0xa')]});socketio[_0x4307('0xb')](require(_0x4307('0xc'))({'pubClient':new Redis(config[_0x4307('0x4')]),'subClient':new Redis(config[_0x4307('0x4')])}));require(_0x4307('0xd'))['default']();var configSocketio=require('../../config/socketio');configSocketio['default'](socketio,pub);pub[_0x4307('0xe')]('SET',_0x4307('0xf'),_0x4307('0x10'));sub[_0x4307('0x11')](_0x4307('0x12'));sub['on'](_0x4307('0x13'),function(_0x232cfd,_0xbd3609,_0x148569){if(_0xbd3609==='__keyevent@0__:expired'||_0xbd3609===_0x4307('0x14')){var _0x529a61=_0x148569[_0x4307('0x15')](_0x4307('0x16'),'');var _0x51362a=_[_0x4307('0x17')](_0x529a61,':');var _0x4f32f7={'id':_0x51362a[0x0],'name':_0x51362a[0x1]};configSocketio[_0x4307('0x18')](_0x4f32f7);}});require('../../config/express')[_0x4307('0x19')](app);require(_0x4307('0x1a'))[_0x4307('0x19')](app);}else{server[_0x4307('0x1b')](_0x4307('0x1c'),function(){console[_0x4307('0x1d')](_0x4307('0x1e'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0xe0a3=['default','../../config/socketio','config','SET','notify-keyspace-events','EKx','psubscribe','__key*__:expired','pmessage','__keyevent@0__:expired','_expire','split','../../config/express','../../routes','once','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','redis','defaults','localhost','createServer','timeout','listen','port','socket.io','polling','adapter','socket.io-redis','../../config/triggers'];(function(_0x1f6617,_0x4349df){var _0x5241a9=function(_0x824e2b){while(--_0x824e2b){_0x1f6617['push'](_0x1f6617['shift']());}};_0x5241a9(++_0x4349df);}(_0xe0a3,0xba));var _0x3e0a=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0xe0a3[_0x503790];return _0x388092;};'use strict';var _=require(_0x3e0a('0x0'));var http=require(_0x3e0a('0x1'));var express=require(_0x3e0a('0x2'));var sticky=require(_0x3e0a('0x3'));var Redis=require(_0x3e0a('0x4'));var config=require(_0x3e0a('0x5'));config[_0x3e0a('0x6')]=_[_0x3e0a('0x7')](config['redis'],{'host':_0x3e0a('0x8'),'port':0x18eb});var app=express();var server=http[_0x3e0a('0x9')](app);server[_0x3e0a('0xa')]=0xdbba0;var pub=new Redis(config[_0x3e0a('0x6')]);var sub=new Redis(config['redis']);if(sticky[_0x3e0a('0xb')](server,config[_0x3e0a('0xc')])){var socketio=require(_0x3e0a('0xd'))(server,{'transports':['websocket',_0x3e0a('0xe')]});socketio[_0x3e0a('0xf')](require(_0x3e0a('0x10'))({'pubClient':new Redis(config[_0x3e0a('0x6')]),'subClient':new Redis(config[_0x3e0a('0x6')])}));require(_0x3e0a('0x11'))[_0x3e0a('0x12')]();var configSocketio=require(_0x3e0a('0x13'));configSocketio[_0x3e0a('0x12')](socketio,pub);pub[_0x3e0a('0x14')](_0x3e0a('0x15'),_0x3e0a('0x16'),_0x3e0a('0x17'));sub[_0x3e0a('0x18')](_0x3e0a('0x19'));sub['on'](_0x3e0a('0x1a'),function(_0x11aa1c,_0x4fc4b9,_0x12acc8){if(_0x4fc4b9===_0x3e0a('0x1b')||_0x4fc4b9==='__keyspace@0__:expired'){var _0x3bad70=_0x12acc8['replace'](_0x3e0a('0x1c'),'');var _0x49b509=_[_0x3e0a('0x1d')](_0x3bad70,':');var _0x499516={'id':_0x49b509[0x0],'name':_0x49b509[0x1]};configSocketio['checkUserIsOnline'](_0x499516);}});require(_0x3e0a('0x1e'))[_0x3e0a('0x12')](app);require(_0x3e0a('0x1f'))[_0x3e0a('0x12')](app);}else{server[_0x3e0a('0x20')]('listening',function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3e0a('0xc')]);});}exports=module[_0x3e0a('0x21')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 854d674..612eac6 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 _0x96d4=['debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird','routing','client','http','Request','then'];(function(_0x35f08c,_0xa0ebfe){var _0x148335=function(_0x2957e7){while(--_0x2957e7){_0x35f08c['push'](_0x35f08c['shift']());}};_0x148335(++_0xa0ebfe);}(_0x96d4,0x1f1));var _0x496d=function(_0x22d471,_0x28ee97){_0x22d471=_0x22d471-0x0;var _0x177e7a=_0x96d4[_0x22d471];return _0x177e7a;};'use strict';var jayson=require(_0x496d('0x0'));var BPromise=require(_0x496d('0x1'));var logger=require('../../config/logger')(_0x496d('0x2'));var client=jayson[_0x496d('0x3')][_0x496d('0x4')]({'port':0x2329});client[_0x496d('0x5')]=function(_0x366b57,_0x486fa2){return new BPromise(function(_0x2e9d17,_0x1d4728){return client['request'](_0x366b57,_0x486fa2)[_0x496d('0x6')](function(_0x106e95){logger[_0x496d('0x7')]('rpc',_0x496d('0x2'),_0x366b57,_0x486fa2,_0x106e95);if(_0x106e95[_0x496d('0x8')]){logger['error']('rpc','routing',_0x366b57,_0x106e95[_0x496d('0x8')][_0x496d('0x9')],_0x486fa2);return _0x1d4728(_0x106e95[_0x496d('0x8')][_0x496d('0x9')]);}else{return _0x2e9d17(_0x106e95[_0x496d('0xa')]);}})[_0x496d('0xb')](function(_0x13ae0c){logger[_0x496d('0x8')](_0x496d('0xc'),_0x496d('0x2'),_0x366b57,_0x13ae0c,_0x486fa2);return _0x1d4728(_0x13ae0c);});});};module[_0x496d('0xd')]=client; \ No newline at end of file +var _0xfa32=['exports','jayson/promise','bluebird','../../config/logger','routing','http','then','error','rpc','message','result','catch'];(function(_0x358170,_0x4ca1c3){var _0x4a328c=function(_0x199cb8){while(--_0x199cb8){_0x358170['push'](_0x358170['shift']());}};_0x4a328c(++_0x4ca1c3);}(_0xfa32,0xa9));var _0x2fa3=function(_0xab840,_0x48ed14){_0xab840=_0xab840-0x0;var _0x2e6dbc=_0xfa32[_0xab840];return _0x2e6dbc;};'use strict';var jayson=require(_0x2fa3('0x0'));var BPromise=require(_0x2fa3('0x1'));var logger=require(_0x2fa3('0x2'))(_0x2fa3('0x3'));var client=jayson['client'][_0x2fa3('0x4')]({'port':0x2329});client['Request']=function(_0x4e4f2d,_0x9d4fc5){return new BPromise(function(_0x5bca7c,_0x230e57){return client['request'](_0x4e4f2d,_0x9d4fc5)[_0x2fa3('0x5')](function(_0x5cbca4){logger['debug']('rpc',_0x2fa3('0x3'),_0x4e4f2d,_0x9d4fc5,_0x5cbca4);if(_0x5cbca4[_0x2fa3('0x6')]){logger[_0x2fa3('0x6')](_0x2fa3('0x7'),'routing',_0x4e4f2d,_0x5cbca4[_0x2fa3('0x6')][_0x2fa3('0x8')],_0x9d4fc5);return _0x230e57(_0x5cbca4[_0x2fa3('0x6')][_0x2fa3('0x8')]);}else{return _0x5bca7c(_0x5cbca4[_0x2fa3('0x9')]);}})[_0x2fa3('0xa')](function(_0x308fa7){logger['error'](_0x2fa3('0x7'),_0x2fa3('0x3'),_0x4e4f2d,_0x308fa7,_0x9d4fc5);return _0x230e57(_0x308fa7);});});};module[_0x2fa3('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6982c64..da8480a 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 _0x41ea=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x9204d3,_0x5225f2){var _0x2783be=function(_0x589618){while(--_0x589618){_0x9204d3['push'](_0x9204d3['shift']());}};_0x2783be(++_0x5225f2);}(_0x41ea,0x179));var _0xa41e=function(_0x200ae6,_0x433216){_0x200ae6=_0x200ae6-0x0;var _0x4fbb75=_0x41ea[_0x200ae6];return _0x4fbb75;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xa41e('0x0'));var user=require('./rpc/user');var interval=require(_0xa41e('0x1'));var openchannelQueue=require(_0xa41e('0x2'));var chatQueue=require(_0xa41e('0x3'));var smsQueue=require(_0xa41e('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xa41e('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa41e('0x6')]()[_0xa41e('0x7')](user[_0xa41e('0x8')]())[_0xa41e('0x7')](realtime[_0xa41e('0x9')]())[_0xa41e('0x7')](interval['getIntervals']())[_0xa41e('0x7')](realtime[_0xa41e('0xa')]())[_0xa41e('0x7')](openchannelQueue[_0xa41e('0xb')]())['then'](realtime[_0xa41e('0xc')]())[_0xa41e('0x7')](chatQueue[_0xa41e('0xd')]())['then'](realtime[_0xa41e('0xe')]())[_0xa41e('0x7')](smsQueue[_0xa41e('0xf')]())[_0xa41e('0x7')](realtime[_0xa41e('0x10')]())[_0xa41e('0x7')](mailQueue[_0xa41e('0x11')]())[_0xa41e('0x7')](realtime[_0xa41e('0x12')]())[_0xa41e('0x7')](faxQueue[_0xa41e('0x13')]())[_0xa41e('0x7')](realtime[_0xa41e('0x14')]())[_0xa41e('0x7')](whatsappQueue[_0xa41e('0x15')]())[_0xa41e('0x7')](realtime[_0xa41e('0x16')]())[_0xa41e('0x7')](function(){return realtime;});}function main(){return server[_0xa41e('0x17')](realtime)[_0xa41e('0x7')](function(_0x5bb697){return initRealtime();})[_0xa41e('0x7')](function(_0x2da06c){return setInterval(initRealtime,0x1388);})[_0xa41e('0x18')](function(_0x343a94){console[_0xa41e('0x19')](_0x343a94);});}main(); \ No newline at end of file +var _0x9258=['initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x9258,0x19d));var _0x8925=function(_0x4df15d,_0x1c2a67){_0x4df15d=_0x4df15d-0x0;var _0x119b2d=_0x9258[_0x4df15d];return _0x119b2d;};'use strict';var BPromise=require(_0x8925('0x0'));var server=require(_0x8925('0x1'));var Realtime=require(_0x8925('0x2'));var user=require(_0x8925('0x3'));var interval=require(_0x8925('0x4'));var openchannelQueue=require(_0x8925('0x5'));var chatQueue=require(_0x8925('0x6'));var smsQueue=require(_0x8925('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8925('0x8'));var whatsappQueue=require(_0x8925('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x8925('0xa')](user[_0x8925('0xb')]())[_0x8925('0xa')](realtime[_0x8925('0xc')]())[_0x8925('0xa')](interval[_0x8925('0xd')]())['then'](realtime[_0x8925('0xe')]())['then'](openchannelQueue[_0x8925('0xf')]())['then'](realtime[_0x8925('0x10')]())[_0x8925('0xa')](chatQueue['getChatQueues']())[_0x8925('0xa')](realtime[_0x8925('0x11')]())['then'](smsQueue[_0x8925('0x12')]())[_0x8925('0xa')](realtime[_0x8925('0x13')]())[_0x8925('0xa')](mailQueue[_0x8925('0x14')]())['then'](realtime['initMailQueues']())[_0x8925('0xa')](faxQueue['getFaxQueues']())['then'](realtime[_0x8925('0x15')]())['then'](whatsappQueue[_0x8925('0x16')]())[_0x8925('0xa')](realtime['initWhatsappQueues']())[_0x8925('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x8925('0xa')](function(_0x3a3e49){return initRealtime();})[_0x8925('0xa')](function(_0x301ea7){return setInterval(initRealtime,0x1388);})['catch'](function(_0x11c865){console[_0x8925('0x17')](_0x11c865);});}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 19c88c0..5c1623c 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4244ab,_0x23e725){var _0x79799d=function(_0xd231cd){while(--_0xd231cd){_0x4244ab['push'](_0x4244ab['shift']());}};_0x79799d(++_0x23e725);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x5fc3[_0x54d49e];return _0x4af0f1;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x1b3dc8,_0x5dec12){var _0x3bfce7=function(_0x3ea1fc){while(--_0x3ea1fc){_0x1b3dc8['push'](_0x1b3dc8['shift']());}};_0x3bfce7(++_0x5dec12);}(_0x2ef3,0xba));var _0x32ef=function(_0x44674b,_0x47932e){_0x44674b=_0x44674b-0x0;var _0x1b3739=_0x2ef3[_0x44674b];return _0x1b3739;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e29c2d1..5084a2a 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 _0x04e6=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2b0275,_0x3fe1fe){var _0x43708e=function(_0x4f410c){while(--_0x4f410c){_0x2b0275['push'](_0x2b0275['shift']());}};_0x43708e(++_0x3fe1fe);}(_0x04e6,0x67));var _0x604e=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x04e6[_0x5cc8];return _0x450661;};'use strict';var BPromise=require(_0x604e('0x0'));var jayson=require(_0x604e('0x1'));var client=jayson[_0x604e('0x2')][_0x604e('0x3')]({'port':0x232b});function request(_0x5c33a8,_0x7191ce){return new BPromise(function(_0x1b6cae,_0x33af32){return client[_0x604e('0x4')](_0x5c33a8,_0x7191ce)['then'](function(_0x4b5746){if(_0x4b5746['error']){return _0x33af32(_0x4b5746[_0x604e('0x5')][_0x604e('0x6')]);}else{return _0x1b6cae(_0x4b5746['result']);}})[_0x604e('0x7')](function(_0x25ad5d){return _0x33af32(_0x25ad5d);});});}exports[_0x604e('0x8')]=function(_0x324a54,_0x15674e){return request(_0x604e('0x9'),{'account':_0x324a54,'message':_0x15674e});}; \ No newline at end of file +var _0x26fa=['request','then','message','result','catch','sendMailMessage','bluebird','client','http'];(function(_0x1d7291,_0x438f21){var _0x1eb877=function(_0x292621){while(--_0x292621){_0x1d7291['push'](_0x1d7291['shift']());}};_0x1eb877(++_0x438f21);}(_0x26fa,0x114));var _0xa26f=function(_0x3444b8,_0x3a06af){_0x3444b8=_0x3444b8-0x0;var _0x1aafed=_0x26fa[_0x3444b8];return _0x1aafed;};'use strict';var BPromise=require(_0xa26f('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xa26f('0x1')][_0xa26f('0x2')]({'port':0x232b});function request(_0x469a31,_0x1fcd91){return new BPromise(function(_0x2ead2e,_0x932a28){return client[_0xa26f('0x3')](_0x469a31,_0x1fcd91)[_0xa26f('0x4')](function(_0x59c824){if(_0x59c824['error']){return _0x932a28(_0x59c824['error'][_0xa26f('0x5')]);}else{return _0x2ead2e(_0x59c824[_0xa26f('0x6')]);}})[_0xa26f('0x7')](function(_0x4950b7){return _0x932a28(_0x4950b7);});});}exports[_0xa26f('0x8')]=function(_0x4c8f8d,_0x33d95a){return request('SendMail',{'account':_0x4c8f8d,'message':_0x33d95a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 98b647d..da70ed7 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 _0x13eb=['idle','mail','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','mailStatusTime','whatsappStatusTime','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x16d70b,_0x58f12d){var _0x51d627=function(_0x34059d){while(--_0x34059d){_0x16d70b['push'](_0x16d70b['shift']());}};_0x51d627(++_0x58f12d);}(_0x13eb,0x8f));var _0xb13e=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x13eb[_0x11f598];return _0x2a37dc;};'use strict';var _=require(_0xb13e('0x0'));var moment=require(_0xb13e('0x1'));var md5=require('md5');var Redis=require(_0xb13e('0x2'));var config=require(_0xb13e('0x3'));config['redis']=_[_0xb13e('0x4')](config[_0xb13e('0x5')],{'host':_0xb13e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x366188){this['id']=_0x366188['id']||0x0;this[_0xb13e('0x7')]=_0x366188[_0xb13e('0x7')]||'';this[_0xb13e('0x8')]=_0x366188[_0xb13e('0x8')]||!![];this[_0xb13e('0x9')]=_0x366188['voicePause']||![];this[_0xb13e('0xa')]=_0x366188[_0xb13e('0xa')]||![];this['mailPause']=_0x366188[_0xb13e('0xb')]||![];this[_0xb13e('0xc')]=_0x366188[_0xb13e('0xc')]||![];this[_0xb13e('0xd')]=_0x366188[_0xb13e('0xd')]||![];this[_0xb13e('0xe')]=_0x366188[_0xb13e('0xe')]||![];this[_0xb13e('0xf')]=_0xb13e('0x10');this[_0xb13e('0x11')]=0x0;this['chatCapacity']=_0x366188[_0xb13e('0x12')]||0x0;this[_0xb13e('0x13')]=0x0;this[_0xb13e('0x14')]=_0xb13e('0x10');this['mailStatusTime']=0x0;this[_0xb13e('0x15')]=_0x366188[_0xb13e('0x15')]||0x0;this[_0xb13e('0x16')]=0x0;this[_0xb13e('0x17')]=_0xb13e('0x10');this[_0xb13e('0x18')]=0x0;this[_0xb13e('0x19')]=_0x366188[_0xb13e('0x19')]||0x0;this[_0xb13e('0x1a')]=0x0;this[_0xb13e('0x1b')]=_0xb13e('0x10');this[_0xb13e('0x1c')]=0x0;this[_0xb13e('0x1d')]=_0x366188[_0xb13e('0x1d')]||0x0;this[_0xb13e('0x1e')]=0x0;this[_0xb13e('0x1f')]=_0xb13e('0x10');this['whatsappStatusTime']=0x0;this[_0xb13e('0x20')]=_0x366188[_0xb13e('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xb13e('0x21')]=_0xb13e('0x10');this['openchannelStatusTime']=0x0;this[_0xb13e('0x22')]=_0x366188[_0xb13e('0x22')]||0x0;this[_0xb13e('0x23')]=0x0;this[_0xb13e('0x24')]=![];this[_0xb13e('0x25')]=undefined;this[_0xb13e('0x26')]='';this[_0xb13e('0x27')]();}Agent[_0xb13e('0x28')][_0xb13e('0x29')]=function(_0x5a31d8){if(this[_0x5a31d8+_0xb13e('0x2a')]>0x0){if(this[_0x5a31d8+_0xb13e('0x2b')]>0x0&&this[_0x5a31d8+_0xb13e('0x2a')]>=this[_0x5a31d8+_0xb13e('0x2b')]){return _0xb13e('0x2c');}else{return _0xb13e('0x2d');}}else{return _0xb13e('0x2e');}};Agent[_0xb13e('0x28')][_0xb13e('0x27')]=function(){var _0x1493bb=[_0xb13e('0x2f'),'chat',_0xb13e('0x30'),_0xb13e('0x31'),_0xb13e('0x32'),'whatsapp'];for(var _0x149000=0x0;_0x149000<_0x1493bb[_0xb13e('0x33')];_0x149000+=0x1){var _0x40cec5=this['getChannelStatus'](_0x1493bb[_0x149000]);if(this[_0x1493bb[_0x149000]+_0xb13e('0x34')]!==_0x40cec5){this[_0x1493bb[_0x149000]+_0xb13e('0x35')]=_[_0xb13e('0x36')](moment()[_0xb13e('0x37')]('x'));}this[_0x1493bb[_0x149000]+'Status']=_0x40cec5;}var _0x27c7bb={'id':this['id'],'name':this[_0xb13e('0x7')],'online':this[_0xb13e('0x8')],'voicePause':this[_0xb13e('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xb13e('0xb')],'smsPause':this[_0xb13e('0xd')],'faxPause':this[_0xb13e('0xc')],'openchannelPause':this[_0xb13e('0xe')],'chatStatus':this[_0xb13e('0xf')],'chatStatusTime':this[_0xb13e('0x11')],'chatCapacity':this[_0xb13e('0x12')],'chatCurrentCapacity':this[_0xb13e('0x13')],'mailStatus':this[_0xb13e('0x14')],'mailStatusTime':this[_0xb13e('0x38')],'mailCapacity':this[_0xb13e('0x15')],'mailCurrentCapacity':this[_0xb13e('0x16')],'faxStatus':this[_0xb13e('0x17')],'faxStatusTime':this[_0xb13e('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xb13e('0x1a')],'smsStatus':this[_0xb13e('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xb13e('0x1e')],'whatsappStatus':this[_0xb13e('0x1f')],'whatsappStatusTime':this[_0xb13e('0x39')],'whatsappCapacity':this[_0xb13e('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xb13e('0x21')],'openchannelStatusTime':this[_0xb13e('0x3a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xb13e('0x23')],'busy':this[_0xb13e('0x24')],'busyQueue':this[_0xb13e('0x25')]};var _0x2f2447=md5(JSON[_0xb13e('0x3b')](_0x27c7bb));if(this[_0xb13e('0x26')]!==_0x2f2447){this[_0xb13e('0x26')]=_0x2f2447;io[_0xb13e('0x3c')](_0xb13e('0x3d'),_0x27c7bb);}};module[_0xb13e('0x3e')]=Agent; \ No newline at end of file +var _0x64eb=['Capacity','maxcapacity','idle','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailPause','mailStatus','smsCurrentCapacity','stringify','user:save','exports','lodash','moment','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity'];(function(_0xe3fa54,_0x17a479){var _0x3deb6c=function(_0x23b5d0){while(--_0x23b5d0){_0xe3fa54['push'](_0xe3fa54['shift']());}};_0x3deb6c(++_0x17a479);}(_0x64eb,0xc6));var _0xb64e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x64eb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb64e('0x0'));var moment=require(_0xb64e('0x1'));var md5=require('md5');var Redis=require(_0xb64e('0x2'));var config=require('../../../config/environment');config[_0xb64e('0x3')]=_[_0xb64e('0x4')](config[_0xb64e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xb64e('0x5'))(new Redis(config['redis']));function Agent(_0x24245d){this['id']=_0x24245d['id']||0x0;this[_0xb64e('0x6')]=_0x24245d[_0xb64e('0x6')]||'';this[_0xb64e('0x7')]=_0x24245d[_0xb64e('0x7')]||!![];this[_0xb64e('0x8')]=_0x24245d[_0xb64e('0x8')]||![];this[_0xb64e('0x9')]=_0x24245d[_0xb64e('0x9')]||![];this['mailPause']=_0x24245d['mailPause']||![];this[_0xb64e('0xa')]=_0x24245d[_0xb64e('0xa')]||![];this[_0xb64e('0xb')]=_0x24245d[_0xb64e('0xb')]||![];this[_0xb64e('0xc')]=_0x24245d[_0xb64e('0xc')]||![];this[_0xb64e('0xd')]=_0xb64e('0xe');this[_0xb64e('0xf')]=0x0;this[_0xb64e('0x10')]=_0x24245d[_0xb64e('0x10')]||0x0;this[_0xb64e('0x11')]=0x0;this['mailStatus']=_0xb64e('0xe');this[_0xb64e('0x12')]=0x0;this[_0xb64e('0x13')]=_0x24245d[_0xb64e('0x13')]||0x0;this[_0xb64e('0x14')]=0x0;this[_0xb64e('0x15')]=_0xb64e('0xe');this[_0xb64e('0x16')]=0x0;this[_0xb64e('0x17')]=_0x24245d[_0xb64e('0x17')]||0x0;this[_0xb64e('0x18')]=0x0;this[_0xb64e('0x19')]=_0xb64e('0xe');this[_0xb64e('0x1a')]=0x0;this[_0xb64e('0x1b')]=_0x24245d[_0xb64e('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xb64e('0x1c')]=_0xb64e('0xe');this[_0xb64e('0x1d')]=0x0;this[_0xb64e('0x1e')]=_0x24245d['whatsappCapacity']||0x0;this[_0xb64e('0x1f')]=0x0;this[_0xb64e('0x20')]=_0xb64e('0xe');this[_0xb64e('0x21')]=0x0;this[_0xb64e('0x22')]=_0x24245d[_0xb64e('0x22')]||0x0;this[_0xb64e('0x23')]=0x0;this[_0xb64e('0x24')]=![];this[_0xb64e('0x25')]=undefined;this['md5']='';this[_0xb64e('0x26')]();}Agent[_0xb64e('0x27')][_0xb64e('0x28')]=function(_0x31fad1){if(this[_0x31fad1+_0xb64e('0x29')]>0x0){if(this[_0x31fad1+'Capacity']>0x0&&this[_0x31fad1+_0xb64e('0x29')]>=this[_0x31fad1+_0xb64e('0x2a')]){return _0xb64e('0x2b');}else{return'working';}}else{return _0xb64e('0x2c');}};Agent[_0xb64e('0x27')]['updateRealtime']=function(){var _0x458723=['mail',_0xb64e('0x2d'),'openchannel',_0xb64e('0x2e'),_0xb64e('0x2f'),_0xb64e('0x30')];for(var _0xb18390=0x0;_0xb18390<_0x458723[_0xb64e('0x31')];_0xb18390+=0x1){var _0x2bf614=this[_0xb64e('0x28')](_0x458723[_0xb18390]);if(this[_0x458723[_0xb18390]+_0xb64e('0x32')]!==_0x2bf614){this[_0x458723[_0xb18390]+_0xb64e('0x33')]=_[_0xb64e('0x34')](moment()[_0xb64e('0x35')]('x'));}this[_0x458723[_0xb18390]+'Status']=_0x2bf614;}var _0x2740cf={'id':this['id'],'name':this[_0xb64e('0x6')],'online':this[_0xb64e('0x7')],'voicePause':this[_0xb64e('0x8')],'chatPause':this[_0xb64e('0x9')],'mailPause':this[_0xb64e('0x36')],'smsPause':this[_0xb64e('0xb')],'faxPause':this[_0xb64e('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xb64e('0xd')],'chatStatusTime':this[_0xb64e('0xf')],'chatCapacity':this[_0xb64e('0x10')],'chatCurrentCapacity':this[_0xb64e('0x11')],'mailStatus':this[_0xb64e('0x37')],'mailStatusTime':this[_0xb64e('0x12')],'mailCapacity':this[_0xb64e('0x13')],'mailCurrentCapacity':this[_0xb64e('0x14')],'faxStatus':this[_0xb64e('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xb64e('0x17')],'faxCurrentCapacity':this[_0xb64e('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xb64e('0x1a')],'smsCapacity':this[_0xb64e('0x1b')],'smsCurrentCapacity':this[_0xb64e('0x38')],'whatsappStatus':this[_0xb64e('0x1c')],'whatsappStatusTime':this[_0xb64e('0x1d')],'whatsappCapacity':this[_0xb64e('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xb64e('0x20')],'openchannelStatusTime':this[_0xb64e('0x21')],'openchannelCapacity':this[_0xb64e('0x22')],'openchannelCurrentCapacity':this[_0xb64e('0x23')],'busy':this[_0xb64e('0x24')],'busyQueue':this[_0xb64e('0x25')]};var _0x4d2d7e=md5(JSON[_0xb64e('0x39')](_0x2740cf));if(this['md5']!==_0x4d2d7e){this['md5']=_0x4d2d7e;io['emit'](_0xb64e('0x3a'),_0x2740cf);}};module[_0xb64e('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 667d301..e3dffb8 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 _0xb121=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','redis'];(function(_0xe571b7,_0x4d9a13){var _0x4eca74=function(_0x3d9cb8){while(--_0x3d9cb8){_0xe571b7['push'](_0xe571b7['shift']());}};_0x4eca74(++_0x4d9a13);}(_0xb121,0xc7));var _0x1b12=function(_0x147a0,_0xc2c805){_0x147a0=_0x147a0-0x0;var _0x30aae9=_0xb121[_0x147a0];return _0x30aae9;};'use strict';var _=require(_0x1b12('0x0'));var md5=require(_0x1b12('0x1'));var util=require('util');var Redis=require(_0x1b12('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x1b12('0x3')],{'host':_0x1b12('0x4'),'port':0x18eb});var io=require(_0x1b12('0x5'))(new Redis(config['redis']));function ChatQueue(_0x6d4c1f){this['id']=_0x6d4c1f['id']||0x0;this[_0x1b12('0x6')]=_0x6d4c1f[_0x1b12('0x6')]||'';this[_0x1b12('0x7')]=_0x6d4c1f[_0x1b12('0x7')]||0xa;this[_0x1b12('0x8')]=_0x6d4c1f[_0x1b12('0x8')]||_0x1b12('0x9');this['Agents']=_0x6d4c1f[_0x1b12('0xa')];this[_0x1b12('0xb')]={};this[_0x1b12('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x1b12('0xd')]();}ChatQueue[_0x1b12('0xe')][_0x1b12('0xf')]=function(){var _0x213db2=this[_0x1b12('0xb')][_0x1b12('0x10')];this['mapAgentsId']=_[_0x1b12('0x11')](this[_0x1b12('0xa')],'id');this[_0x1b12('0xb')]['_rr']=_0x213db2;};ChatQueue[_0x1b12('0xe')][_0x1b12('0xd')]=function(){this[_0x1b12('0x12')]=0x0;this[_0x1b12('0x13')]=0x0;for(var _0x27b32b=0x0;_0x27b32b=0x0?this[_0x1b12('0x17')]:0x0;var _0x4ebea0={'id':this['id'],'available':this[_0x1b12('0x17')],'loggedIn':this[_0x1b12('0x12')],'name':this['name'],'paused':this[_0x1b12('0x13')],'waiting':this['waiting']};var _0x3370b3=md5(JSON[_0x1b12('0x18')](_0x4ebea0));if(this['md5']!==_0x3370b3){this['md5']=_0x3370b3;io['to'](util[_0x1b12('0x19')](_0x1b12('0x1a'),_0x4ebea0[_0x1b12('0x6')]))[_0x1b12('0x1b')]('chat_queue:save',_0x4ebea0);}};module[_0x1b12('0x1c')]=ChatQueue; \ No newline at end of file +var _0xb997=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x1f39f7,_0x1d1b55){var _0x73bca6=function(_0x1be37f){while(--_0x1be37f){_0x1f39f7['push'](_0x1f39f7['shift']());}};_0x73bca6(++_0x1d1b55);}(_0xb997,0x8d));var _0x7b99=function(_0x4a8b72,_0xb54e90){_0x4a8b72=_0x4a8b72-0x0;var _0x217237=_0xb997[_0x4a8b72];return _0x217237;};'use strict';var _=require(_0x7b99('0x0'));var md5=require(_0x7b99('0x1'));var util=require(_0x7b99('0x2'));var Redis=require(_0x7b99('0x3'));var config=require(_0x7b99('0x4'));config[_0x7b99('0x5')]=_[_0x7b99('0x6')](config[_0x7b99('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7b99('0x7'))(new Redis(config[_0x7b99('0x5')]));function ChatQueue(_0x2c99e4){this['id']=_0x2c99e4['id']||0x0;this['name']=_0x2c99e4[_0x7b99('0x8')]||'';this[_0x7b99('0x9')]=_0x2c99e4[_0x7b99('0x9')]||0xa;this['strategy']=_0x2c99e4['strategy']||_0x7b99('0xa');this[_0x7b99('0xb')]=_0x2c99e4[_0x7b99('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7b99('0x1')]='';this[_0x7b99('0xc')]();this[_0x7b99('0xd')]();}ChatQueue[_0x7b99('0xe')][_0x7b99('0xc')]=function(){var _0x1639f1=this['mapAgentsId'][_0x7b99('0xf')];this[_0x7b99('0x10')]=_[_0x7b99('0x11')](this[_0x7b99('0xb')],'id');this[_0x7b99('0x10')][_0x7b99('0xf')]=_0x1639f1;};ChatQueue['prototype'][_0x7b99('0xd')]=function(){this[_0x7b99('0x12')]=0x0;this[_0x7b99('0x13')]=0x0;for(var _0x34139d=0x0;_0x34139d=0x0?this[_0x7b99('0x16')]:0x0;var _0x59f73d={'id':this['id'],'available':this[_0x7b99('0x16')],'loggedIn':this[_0x7b99('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x509bac=md5(JSON[_0x7b99('0x17')](_0x59f73d));if(this[_0x7b99('0x1')]!==_0x509bac){this['md5']=_0x509bac;io['to'](util[_0x7b99('0x18')](_0x7b99('0x19'),_0x59f73d[_0x7b99('0x8')]))[_0x7b99('0x1a')](_0x7b99('0x1b'),_0x59f73d);}};module[_0x7b99('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index f220d3e..9e7e3a8 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 _0x168e=['map','_rr','loggedIn','paused','length','online','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x168e,0x179));var _0xe168=function(_0x2f4798,_0x438aeb){_0x2f4798=_0x2f4798-0x0;var _0x3ba3dd=_0x168e[_0x2f4798];return _0x3ba3dd;};'use strict';var _=require('lodash');var md5=require(_0xe168('0x0'));var util=require(_0xe168('0x1'));var Redis=require(_0xe168('0x2'));var config=require(_0xe168('0x3'));config[_0xe168('0x4')]=_['defaults'](config[_0xe168('0x4')],{'host':_0xe168('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x53a00c){this['id']=_0x53a00c['id']||0x0;this[_0xe168('0x6')]=_0x53a00c[_0xe168('0x6')]||'';this[_0xe168('0x7')]=_0x53a00c[_0xe168('0x7')]||0xa;this[_0xe168('0x8')]=_0x53a00c['strategy']||_0xe168('0x9');this[_0xe168('0xa')]=_0x53a00c[_0xe168('0xa')];this[_0xe168('0xb')]={};this['waiting']=0x0;this[_0xe168('0x0')]='';this[_0xe168('0xc')]();this[_0xe168('0xd')]();}FaxQueue[_0xe168('0xe')][_0xe168('0xc')]=function(){var _0x18d818=this[_0xe168('0xb')]['_rr'];this['mapAgentsId']=_[_0xe168('0xf')](this[_0xe168('0xa')],'id');this[_0xe168('0xb')][_0xe168('0x10')]=_0x18d818;};FaxQueue['prototype']['updateRealtime']=function(){this[_0xe168('0x11')]=0x0;this[_0xe168('0x12')]=0x0;for(var _0x3d5e6b=0x0;_0x3d5e6b=0x0?this[_0xe168('0x16')]:0x0;var _0x417d73={'id':this['id'],'available':this[_0xe168('0x16')],'loggedIn':this[_0xe168('0x11')],'name':this['name'],'paused':this[_0xe168('0x12')],'waiting':this[_0xe168('0x17')]};var _0x10191a=md5(JSON[_0xe168('0x18')](_0x417d73));if(this[_0xe168('0x0')]!==_0x10191a){this[_0xe168('0x0')]=_0x10191a;io['to'](util[_0xe168('0x19')](_0xe168('0x1a'),_0x417d73['name']))[_0xe168('0x1b')]('fax_queue:save',_0x417d73);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xdb28=['_rr','paused','length','online','loggedIn','available','name','stringify','fax_queue:save','exports','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0xb2b102,_0x158925){var _0x20f6b2=function(_0x4fa720){while(--_0x4fa720){_0xb2b102['push'](_0xb2b102['shift']());}};_0x20f6b2(++_0x158925);}(_0xdb28,0x11d));var _0x8db2=function(_0x182583,_0x54a0c9){_0x182583=_0x182583-0x0;var _0x3ead30=_0xdb28[_0x182583];return _0x3ead30;};'use strict';var _=require('lodash');var md5=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var Redis=require('ioredis');var config=require(_0x8db2('0x2'));config[_0x8db2('0x3')]=_['defaults'](config[_0x8db2('0x3')],{'host':_0x8db2('0x4'),'port':0x18eb});var io=require(_0x8db2('0x5'))(new Redis(config['redis']));function FaxQueue(_0xa07867){this['id']=_0xa07867['id']||0x0;this['name']=_0xa07867['name']||'';this[_0x8db2('0x6')]=_0xa07867[_0x8db2('0x6')]||0xa;this[_0x8db2('0x7')]=_0xa07867[_0x8db2('0x7')]||_0x8db2('0x8');this[_0x8db2('0x9')]=_0xa07867[_0x8db2('0x9')];this[_0x8db2('0xa')]={};this[_0x8db2('0xb')]=0x0;this['md5']='';this[_0x8db2('0xc')]();this[_0x8db2('0xd')]();}FaxQueue[_0x8db2('0xe')][_0x8db2('0xc')]=function(){var _0x4775c9=this[_0x8db2('0xa')][_0x8db2('0xf')];this[_0x8db2('0xa')]=_['map'](this[_0x8db2('0x9')],'id');this['mapAgentsId'][_0x8db2('0xf')]=_0x4775c9;};FaxQueue['prototype'][_0x8db2('0xd')]=function(){this['loggedIn']=0x0;this[_0x8db2('0x10')]=0x0;for(var _0x227248=0x0;_0x227248=0x0?this['available']:0x0;var _0x5af49={'id':this['id'],'available':this[_0x8db2('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x8db2('0x15')],'paused':this[_0x8db2('0x10')],'waiting':this[_0x8db2('0xb')]};var _0x4f71f4=md5(JSON[_0x8db2('0x16')](_0x5af49));if(this[_0x8db2('0x0')]!==_0x4f71f4){this[_0x8db2('0x0')]=_0x4f71f4;io['to'](util['format']('fax:queue:%s',_0x5af49[_0x8db2('0x15')]))['emit'](_0x8db2('0x17'),_0x5af49);}};module[_0x8db2('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 95990c5..240551d 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 _0x3ad0=['name','Intervals','exports'];(function(_0x17f9c0,_0x176f66){var _0x1d34fc=function(_0x36c62e){while(--_0x36c62e){_0x17f9c0['push'](_0x17f9c0['shift']());}};_0x1d34fc(++_0x176f66);}(_0x3ad0,0x123));var _0x03ad=function(_0x107e88,_0x12b93e){_0x107e88=_0x107e88-0x0;var _0xb1ee49=_0x3ad0[_0x107e88];return _0xb1ee49;};'use strict';function Interval(_0x496475){this['id']=_0x496475['id']||0x0;this[_0x03ad('0x0')]=_0x496475[_0x03ad('0x0')]||'';this[_0x03ad('0x1')]=_0x496475[_0x03ad('0x1')]||{};}module[_0x03ad('0x2')]=Interval; \ No newline at end of file +var _0xad7d=['name','Intervals','exports'];(function(_0x2395be,_0x15844){var _0x48dddc=function(_0x3e7647){while(--_0x3e7647){_0x2395be['push'](_0x2395be['shift']());}};_0x48dddc(++_0x15844);}(_0xad7d,0x69));var _0xdad7=function(_0x39522,_0x4d21e5){_0x39522=_0x39522-0x0;var _0x296cae=_0xad7d[_0x39522];return _0x296cae;};'use strict';function Interval(_0x10a714){this['id']=_0x10a714['id']||0x0;this['name']=_0x10a714[_0xdad7('0x0')]||'';this[_0xdad7('0x1')]=_0x10a714[_0xdad7('0x1')]||{};}module[_0xdad7('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 fb96a74..fd85bdf 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 _0xef79=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','loggedIn','paused','length','online','available','format','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x3a16fb,_0x277003){var _0x266e1a=function(_0x559647){while(--_0x559647){_0x3a16fb['push'](_0x3a16fb['shift']());}};_0x266e1a(++_0x277003);}(_0xef79,0x1d7));var _0x9ef7=function(_0x47155f,_0x38a6a1){_0x47155f=_0x47155f-0x0;var _0x724ea5=_0xef79[_0x47155f];return _0x724ea5;};'use strict';var _=require(_0x9ef7('0x0'));var md5=require(_0x9ef7('0x1'));var util=require('util');var Redis=require(_0x9ef7('0x2'));var config=require(_0x9ef7('0x3'));config[_0x9ef7('0x4')]=_[_0x9ef7('0x5')](config['redis'],{'host':_0x9ef7('0x6'),'port':0x18eb});var io=require(_0x9ef7('0x7'))(new Redis(config[_0x9ef7('0x4')]));function MailQueue(_0x47a8e9){this['id']=_0x47a8e9['id']||0x0;this[_0x9ef7('0x8')]=_0x47a8e9['name']||'';this[_0x9ef7('0x9')]=_0x47a8e9[_0x9ef7('0x9')]||0xa;this[_0x9ef7('0xa')]=_0x47a8e9['strategy']||_0x9ef7('0xb');this[_0x9ef7('0xc')]=_0x47a8e9[_0x9ef7('0xc')];this[_0x9ef7('0xd')]={};this[_0x9ef7('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x9ef7('0xf')]();}MailQueue['prototype'][_0x9ef7('0x10')]=function(){var _0xf72830=this[_0x9ef7('0xd')][_0x9ef7('0x11')];this['mapAgentsId']=_[_0x9ef7('0x12')](this[_0x9ef7('0xc')],'id');this[_0x9ef7('0xd')][_0x9ef7('0x11')]=_0xf72830;};MailQueue[_0x9ef7('0x13')][_0x9ef7('0xf')]=function(){this[_0x9ef7('0x14')]=0x0;this[_0x9ef7('0x15')]=0x0;for(var _0x2bcd6d=0x0;_0x2bcd6d=0x0?this[_0x9ef7('0x18')]:0x0;var _0x15bf7b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9ef7('0x15')],'waiting':this[_0x9ef7('0xe')]};var _0x414ebb=md5(JSON['stringify'](_0x15bf7b));if(this[_0x9ef7('0x1')]!==_0x414ebb){this[_0x9ef7('0x1')]=_0x414ebb;io['to'](util[_0x9ef7('0x19')]('mail:queue:%s',_0x15bf7b[_0x9ef7('0x8')]))['emit'](_0x9ef7('0x1a'),_0x15bf7b);}};module[_0x9ef7('0x1b')]=MailQueue; \ No newline at end of file +var _0x6d61=['stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','mailPause','paused','available','waiting'];(function(_0x896a6a,_0x31678a){var _0x1dedce=function(_0x3ad79e){while(--_0x3ad79e){_0x896a6a['push'](_0x896a6a['shift']());}};_0x1dedce(++_0x31678a);}(_0x6d61,0x81));var _0x16d6=function(_0x5b4b3e,_0x2dd356){_0x5b4b3e=_0x5b4b3e-0x0;var _0x589d5a=_0x6d61[_0x5b4b3e];return _0x589d5a;};'use strict';var _=require(_0x16d6('0x0'));var md5=require(_0x16d6('0x1'));var util=require(_0x16d6('0x2'));var Redis=require(_0x16d6('0x3'));var config=require(_0x16d6('0x4'));config[_0x16d6('0x5')]=_[_0x16d6('0x6')](config[_0x16d6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x16d6('0x7'))(new Redis(config[_0x16d6('0x5')]));function MailQueue(_0xc74f20){this['id']=_0xc74f20['id']||0x0;this['name']=_0xc74f20[_0x16d6('0x8')]||'';this[_0x16d6('0x9')]=_0xc74f20[_0x16d6('0x9')]||0xa;this[_0x16d6('0xa')]=_0xc74f20[_0x16d6('0xa')]||_0x16d6('0xb');this[_0x16d6('0xc')]=_0xc74f20[_0x16d6('0xc')];this[_0x16d6('0xd')]={};this['waiting']=0x0;this[_0x16d6('0x1')]='';this[_0x16d6('0xe')]();this['updateRealtime']();}MailQueue[_0x16d6('0xf')]['updateRouting']=function(){var _0x10b69f=this[_0x16d6('0xd')][_0x16d6('0x10')];this[_0x16d6('0xd')]=_[_0x16d6('0x11')](this['Agents'],'id');this[_0x16d6('0xd')][_0x16d6('0x10')]=_0x10b69f;};MailQueue[_0x16d6('0xf')][_0x16d6('0x12')]=function(){this[_0x16d6('0x13')]=0x0;this['paused']=0x0;for(var _0x87b552=0x0;_0x87b552=0x0?this['available']:0x0;var _0x41dec5={'id':this['id'],'available':this[_0x16d6('0x18')],'loggedIn':this[_0x16d6('0x13')],'name':this[_0x16d6('0x8')],'paused':this[_0x16d6('0x17')],'waiting':this[_0x16d6('0x19')]};var _0x5253b8=md5(JSON[_0x16d6('0x1a')](_0x41dec5));if(this['md5']!==_0x5253b8){this[_0x16d6('0x1')]=_0x5253b8;io['to'](util['format'](_0x16d6('0x1b'),_0x41dec5['name']))[_0x16d6('0x1c')](_0x16d6('0x1d'),_0x41dec5);}};module[_0x16d6('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 21086e4..4307dfe 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7a54,0x106));var _0x47a5=function(_0x2f102a,_0x4d8ee5){_0x2f102a=_0x2f102a-0x0;var _0x200a0e=_0x7a54[_0x2f102a];return _0x200a0e;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x7a54,0x106));var _0x47a5=function(_0x57aad1,_0x34f9dd){_0x57aad1=_0x57aad1-0x0;var _0x28456f=_0x7a54[_0x57aad1];return _0x28456f;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0c74de2..898f6ef 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 _0xf194=['stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','smsPause','available'];(function(_0x20cad4,_0x423f21){var _0x49a8d4=function(_0x1efcc4){while(--_0x1efcc4){_0x20cad4['push'](_0x20cad4['shift']());}};_0x49a8d4(++_0x423f21);}(_0xf194,0x91));var _0x4f19=function(_0x4517af,_0xde0196){_0x4517af=_0x4517af-0x0;var _0x103f61=_0xf194[_0x4517af];return _0x103f61;};'use strict';var _=require(_0x4f19('0x0'));var md5=require(_0x4f19('0x1'));var util=require(_0x4f19('0x2'));var Redis=require(_0x4f19('0x3'));var config=require('../../../config/environment');config[_0x4f19('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4f19('0x5'))(new Redis(config[_0x4f19('0x4')]));function SmsQueue(_0x13ddda){this['id']=_0x13ddda['id']||0x0;this['name']=_0x13ddda[_0x4f19('0x6')]||'';this[_0x4f19('0x7')]=_0x13ddda['timeout']||0xa;this['strategy']=_0x13ddda[_0x4f19('0x8')]||_0x4f19('0x9');this[_0x4f19('0xa')]=_0x13ddda[_0x4f19('0xa')];this['mapAgentsId']={};this[_0x4f19('0xb')]=0x0;this[_0x4f19('0x1')]='';this[_0x4f19('0xc')]();this[_0x4f19('0xd')]();}SmsQueue[_0x4f19('0xe')][_0x4f19('0xc')]=function(){var _0x57b5e9=this['mapAgentsId']['_rr'];this[_0x4f19('0xf')]=_[_0x4f19('0x10')](this['Agents'],'id');this[_0x4f19('0xf')][_0x4f19('0x11')]=_0x57b5e9;};SmsQueue[_0x4f19('0xe')][_0x4f19('0xd')]=function(){this['loggedIn']=0x0;this[_0x4f19('0x12')]=0x0;for(var _0x25e5ce=0x0;_0x25e5ce=0x0?this['available']:0x0;var _0x1d9bf3={'id':this['id'],'available':this[_0x4f19('0x16')],'loggedIn':this[_0x4f19('0x14')],'name':this[_0x4f19('0x6')],'paused':this[_0x4f19('0x12')],'waiting':this['waiting']};var _0xf401d7=md5(JSON[_0x4f19('0x17')](_0x1d9bf3));if(this['md5']!==_0xf401d7){this[_0x4f19('0x1')]=_0xf401d7;io['to'](util[_0x4f19('0x18')](_0x4f19('0x19'),_0x1d9bf3[_0x4f19('0x6')]))['emit'](_0x4f19('0x1a'),_0x1d9bf3);}};module[_0x4f19('0x1b')]=SmsQueue; \ No newline at end of file +var _0x1ef3=['exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','updateRealtime','paused','length','online','loggedIn','smsPause','available','format','sms:queue:%s','sms_queue:save'];(function(_0x336847,_0x31a539){var _0x14a440=function(_0x38157c){while(--_0x38157c){_0x336847['push'](_0x336847['shift']());}};_0x14a440(++_0x31a539);}(_0x1ef3,0x69));var _0x31ef=function(_0x5058ea,_0x42e244){_0x5058ea=_0x5058ea-0x0;var _0x41840f=_0x1ef3[_0x5058ea];return _0x41840f;};'use strict';var _=require(_0x31ef('0x0'));var md5=require(_0x31ef('0x1'));var util=require('util');var Redis=require(_0x31ef('0x2'));var config=require(_0x31ef('0x3'));config[_0x31ef('0x4')]=_['defaults'](config[_0x31ef('0x4')],{'host':_0x31ef('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x31ef('0x4')]));function SmsQueue(_0x28b51b){this['id']=_0x28b51b['id']||0x0;this[_0x31ef('0x6')]=_0x28b51b[_0x31ef('0x6')]||'';this[_0x31ef('0x7')]=_0x28b51b[_0x31ef('0x7')]||0xa;this['strategy']=_0x28b51b[_0x31ef('0x8')]||_0x31ef('0x9');this[_0x31ef('0xa')]=_0x28b51b[_0x31ef('0xa')];this['mapAgentsId']={};this[_0x31ef('0xb')]=0x0;this['md5']='';this[_0x31ef('0xc')]();this['updateRealtime']();}SmsQueue['prototype']['updateRouting']=function(){var _0x21219a=this[_0x31ef('0xd')][_0x31ef('0xe')];this[_0x31ef('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x21219a;};SmsQueue['prototype'][_0x31ef('0xf')]=function(){this['loggedIn']=0x0;this[_0x31ef('0x10')]=0x0;for(var _0x22f9e2=0x0;_0x22f9e2=0x0?this[_0x31ef('0x15')]:0x0;var _0xf71183={'id':this['id'],'available':this[_0x31ef('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x31ef('0x6')],'paused':this[_0x31ef('0x10')],'waiting':this[_0x31ef('0xb')]};var _0x1e8227=md5(JSON['stringify'](_0xf71183));if(this['md5']!==_0x1e8227){this[_0x31ef('0x1')]=_0x1e8227;io['to'](util[_0x31ef('0x16')](_0x31ef('0x17'),_0xf71183[_0x31ef('0x6')]))['emit'](_0x31ef('0x18'),_0xf71183);}};module[_0x31ef('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index cc49938..ceaa7f6 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 _0x8b13=['prototype','_rr','map','loggedIn','paused','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime'];(function(_0x1f6c50,_0x2c44db){var _0x44ba9f=function(_0x424344){while(--_0x424344){_0x1f6c50['push'](_0x1f6c50['shift']());}};_0x44ba9f(++_0x2c44db);}(_0x8b13,0x77));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x38b1('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x38b1('0x1'));var config=require(_0x38b1('0x2'));config[_0x38b1('0x3')]=_[_0x38b1('0x4')](config[_0x38b1('0x3')],{'host':_0x38b1('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x1bf055){this['id']=_0x1bf055['id']||0x0;this[_0x38b1('0x6')]=_0x1bf055[_0x38b1('0x6')]||'';this[_0x38b1('0x7')]=_0x1bf055['timeout']||0xa;this[_0x38b1('0x8')]=_0x1bf055[_0x38b1('0x8')]||_0x38b1('0x9');this[_0x38b1('0xa')]=_0x1bf055[_0x38b1('0xa')];this[_0x38b1('0xb')]={};this[_0x38b1('0xc')]=0x0;this[_0x38b1('0xd')]='';this[_0x38b1('0xe')]();this[_0x38b1('0xf')]();}WhatsappQueue[_0x38b1('0x10')][_0x38b1('0xe')]=function(){var _0x20ce89=this[_0x38b1('0xb')][_0x38b1('0x11')];this[_0x38b1('0xb')]=_[_0x38b1('0x12')](this['Agents'],'id');this[_0x38b1('0xb')][_0x38b1('0x11')]=_0x20ce89;};WhatsappQueue[_0x38b1('0x10')][_0x38b1('0xf')]=function(){this[_0x38b1('0x13')]=0x0;this[_0x38b1('0x14')]=0x0;for(var _0x235697=0x0;_0x235697=0x0?this[_0x38b1('0x16')]:0x0;var _0x1759e6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x38b1('0x13')],'name':this[_0x38b1('0x6')],'paused':this[_0x38b1('0x14')],'waiting':this[_0x38b1('0xc')]};var _0x2f6ad5=md5(JSON[_0x38b1('0x17')](_0x1759e6));if(this[_0x38b1('0xd')]!==_0x2f6ad5){this[_0x38b1('0xd')]=_0x2f6ad5;io['to'](util[_0x38b1('0x18')](_0x38b1('0x19'),_0x1759e6[_0x38b1('0x6')]))[_0x38b1('0x1a')]('whatsapp_queue:save',_0x1759e6);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xebdc=['prototype','_rr','paused','length','online','whatsappPause','available','loggedIn','waiting','stringify','md5','format','whatsapp:queue:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xebdc,0xf7));var _0xcebd=function(_0x17328a,_0x2a82eb){_0x17328a=_0x17328a-0x0;var _0x4424e9=_0xebdc[_0x17328a];return _0x4424e9;};'use strict';var _=require(_0xcebd('0x0'));var md5=require('md5');var util=require(_0xcebd('0x1'));var Redis=require(_0xcebd('0x2'));var config=require(_0xcebd('0x3'));config[_0xcebd('0x4')]=_[_0xcebd('0x5')](config['redis'],{'host':_0xcebd('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcebd('0x4')]));function WhatsappQueue(_0xbce866){this['id']=_0xbce866['id']||0x0;this['name']=_0xbce866[_0xcebd('0x7')]||'';this[_0xcebd('0x8')]=_0xbce866['timeout']||0xa;this[_0xcebd('0x9')]=_0xbce866[_0xcebd('0x9')]||'beepall';this[_0xcebd('0xa')]=_0xbce866[_0xcebd('0xa')];this[_0xcebd('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xcebd('0xc')]();this[_0xcebd('0xd')]();}WhatsappQueue[_0xcebd('0xe')][_0xcebd('0xc')]=function(){var _0x492d0d=this[_0xcebd('0xb')]['_rr'];this['mapAgentsId']=_['map'](this[_0xcebd('0xa')],'id');this['mapAgentsId'][_0xcebd('0xf')]=_0x492d0d;};WhatsappQueue[_0xcebd('0xe')][_0xcebd('0xd')]=function(){this['loggedIn']=0x0;this[_0xcebd('0x10')]=0x0;for(var _0x7fce3d=0x0;_0x7fce3d=0x0?this[_0xcebd('0x14')]:0x0;var _0xf023d9={'id':this['id'],'available':this[_0xcebd('0x14')],'loggedIn':this[_0xcebd('0x15')],'name':this['name'],'paused':this[_0xcebd('0x10')],'waiting':this[_0xcebd('0x16')]};var _0x883158=md5(JSON[_0xcebd('0x17')](_0xf023d9));if(this[_0xcebd('0x18')]!==_0x883158){this[_0xcebd('0x18')]=_0x883158;io['to'](util[_0xcebd('0x19')](_0xcebd('0x1a'),_0xf023d9[_0xcebd('0x7')]))[_0xcebd('0x1b')]('whatsapp_queue:save',_0xf023d9);}};module[_0xcebd('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 e9c75f2..7e7349e 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 _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(_0x1a3080,_0x512e9c){var _0x22b856=function(_0x12396b){while(--_0x12396b){_0x1a3080['push'](_0x1a3080['shift']());}};_0x22b856(++_0x512e9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xb10b[_0x40927b];return _0x2635e8;};'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 +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 10da8e1..373098b 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 _0x8e7f=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x8e7f,0x97));var _0xf8e7=function(_0x2b9822,_0x29d732){_0x2b9822=_0x2b9822-0x0;var _0x53e3f6=_0x8e7f[_0x2b9822];return _0x53e3f6;};'use strict';var client=require(_0xf8e7('0x0'));exports[_0xf8e7('0x1')]=function(_0x2b7a28,_0x276f54){return client[_0xf8e7('0x2')](_0xf8e7('0x3'),{'body':_0x276f54,'options':{'where':{'id':_0x2b7a28}},'log':_0xf8e7('0x4')});};exports[_0xf8e7('0x5')]=function(_0x3905b3,_0x1957dd){return client[_0xf8e7('0x2')](_0xf8e7('0x6'),{'body':_0x1957dd,'options':{'where':{'id':_0x3905b3}},'log':_0xf8e7('0x7')});}; \ No newline at end of file +var _0xf041=['addTagsToChatInteraction','../client','update','addTags','Request','AddTagsToChatInteraction'];(function(_0x22b098,_0x5d4555){var _0x1394a7=function(_0x5c71ec){while(--_0x5c71ec){_0x22b098['push'](_0x22b098['shift']());}};_0x1394a7(++_0x5d4555);}(_0xf041,0x16f));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x1f04('0x0'));exports[_0x1f04('0x1')]=function(_0x43fa08,_0x53986b){return client['Request']('UpdateChatInteraction',{'body':_0x53986b,'options':{'where':{'id':_0x43fa08}},'log':'updateChatInteraction'});};exports[_0x1f04('0x2')]=function(_0x1e8b6a,_0x15f236){return client[_0x1f04('0x3')](_0x1f04('0x4'),{'body':_0x15f236,'options':{'where':{'id':_0x1e8b6a}},'log':_0x1f04('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ec04182..19d3569 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 _0x4ccf=['Request','CreateChatMessage'];(function(_0x249754,_0x167b6b){var _0x57fbb7=function(_0xe4a76d){while(--_0xe4a76d){_0x249754['push'](_0x249754['shift']());}};_0x57fbb7(++_0x167b6b);}(_0x4ccf,0x88));var _0xf4cc=function(_0x4ad864,_0x35c16f){_0x4ad864=_0x4ad864-0x0;var _0x272be0=_0x4ccf[_0x4ad864];return _0x272be0;};'use strict';var client=require('../client');exports['create']=function(_0x59906b){return client[_0xf4cc('0x0')](_0xf4cc('0x1'),{'body':_0x59906b,'log':'createChatMessage'});}; \ No newline at end of file +var _0x192b=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x192b,0x11e));var _0xb192=function(_0x27c021,_0x190f72){_0x27c021=_0x27c021-0x0;var _0x1d0700=_0x192b[_0x27c021];return _0x1d0700;};'use strict';var client=require(_0xb192('0x0'));exports[_0xb192('0x1')]=function(_0x3e8a2e){return client[_0xb192('0x2')](_0xb192('0x3'),{'body':_0x3e8a2e,'log':_0xb192('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 12e8ca8..bdd4924 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 _0xc18a=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xc18a,0x1cf));var _0xac18=function(_0x453a05,_0x102018){_0x453a05=_0x453a05-0x0;var _0xc42c7d=_0xc18a[_0x453a05];return _0xc42c7d;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(){return function(){return client[_0xac18('0x2')](_0xac18('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xac18('0x4'),_0xac18('0x5')],'include':[{'model':_0xac18('0x6'),'as':_0xac18('0x7'),'attributes':['id',_0xac18('0x8'),_0xac18('0x9'),_0xac18('0xa')]}]},'log':_0xac18('0x1')});};}; \ No newline at end of file +var _0xafca=['../client','Request','GetChatQueue','strategy','User','Agents','name','online','getChatQueues'];(function(_0x308802,_0x88f9ae){var _0x5b5a19=function(_0x1a0fdd){while(--_0x1a0fdd){_0x308802['push'](_0x308802['shift']());}};_0x5b5a19(++_0x88f9ae);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaafc('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xaafc('0x1')](_0xaafc('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xaafc('0x3')],'include':[{'model':_0xaafc('0x4'),'as':_0xaafc('0x5'),'attributes':['id',_0xaafc('0x6'),_0xaafc('0x7'),'chatPause']}]},'log':_0xaafc('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index a0ee5f4..322a971 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 _0x4156=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x3736a7,_0x5d1aa0){var _0x3de867=function(_0x5e3bae){while(--_0x5e3bae){_0x3736a7['push'](_0x3736a7['shift']());}};_0x3de867(++_0x5d1aa0);}(_0x4156,0xf1));var _0x6415=function(_0xea63ad,_0x5df802){_0xea63ad=_0xea63ad-0x0;var _0x33692=_0x4156[_0xea63ad];return _0x33692;};'use strict';var client=require(_0x6415('0x0'));exports[_0x6415('0x1')]=function(_0x283016){return client[_0x6415('0x2')](_0x6415('0x3'),{'body':_0x283016,'log':'CreateChatQueueReport'});};exports[_0x6415('0x4')]=function(_0x4d8c74,_0xfd06c2){return client[_0x6415('0x2')](_0x6415('0x5'),{'body':_0xfd06c2,'options':{'where':{'uniqueid':_0x4d8c74},'order':[['id',_0x6415('0x6')]],'limit':0x1},'log':_0x6415('0x5')});}; \ No newline at end of file +var _0x130d=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd130('0x0'));exports['create']=function(_0x23e485){return client['Request'](_0xd130('0x1'),{'body':_0x23e485,'log':_0xd130('0x1')});};exports[_0xd130('0x2')]=function(_0x77d691,_0x321e49){return client[_0xd130('0x3')](_0xd130('0x4'),{'body':_0x321e49,'options':{'where':{'uniqueid':_0x77d691},'order':[['id',_0xd130('0x5')]],'limit':0x1},'log':_0xd130('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ea75065..b05eac9 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x7a54,0x106));var _0x47a5=function(_0x503aae,_0x3f10b7){_0x503aae=_0x503aae-0x0;var _0x446332=_0x7a54[_0x503aae];return _0x446332;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x7a54,0x106));var _0x47a5=function(_0x1ada5c,_0x189eff){_0x1ada5c=_0x1ada5c-0x0;var _0x2d19d1=_0x7a54[_0x1ada5c];return _0x2d19d1;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ead3605..2fbd831 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 _0xad2f=['../client','CreateFaxMessage'];(function(_0x1d3b89,_0x2cfd49){var _0x5f4a22=function(_0x4792a5){while(--_0x4792a5){_0x1d3b89['push'](_0x1d3b89['shift']());}};_0x5f4a22(++_0x2cfd49);}(_0xad2f,0x194));var _0xfad2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xad2f[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xfad2('0x0'));exports['create']=function(_0xce74a){return client['Request'](_0xfad2('0x1'),{'body':_0xce74a,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x8647=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x436233,_0x46e989){var _0x5e0d8c=function(_0x56646e){while(--_0x56646e){_0x436233['push'](_0x436233['shift']());}};_0x5e0d8c(++_0x46e989);}(_0x8647,0xa3));var _0x7864=function(_0x343b3f,_0x101674){_0x343b3f=_0x343b3f-0x0;var _0x4465a4=_0x8647[_0x343b3f];return _0x4465a4;};'use strict';var client=require(_0x7864('0x0'));exports[_0x7864('0x1')]=function(_0x5f46db){return client[_0x7864('0x2')](_0x7864('0x3'),{'body':_0x5f46db,'log':_0x7864('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 83b8201..97895cf 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 _0x1765=['GetFaxQueue','name','User','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x2daa7d,_0x48e3a8){var _0x16f505=function(_0x3109f2){while(--_0x3109f2){_0x2daa7d['push'](_0x2daa7d['shift']());}};_0x16f505(++_0x48e3a8);}(_0x1765,0xee));var _0x5176=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x1765[_0x2cde0a];return _0x260610;};'use strict';var client=require(_0x5176('0x0'));exports[_0x5176('0x1')]=function(){return function(){return client['Request'](_0x5176('0x2'),{'options':{'raw':![],'attributes':['id',_0x5176('0x3'),'timeout','strategy'],'include':[{'model':_0x5176('0x4'),'as':_0x5176('0x5'),'attributes':['id','name',_0x5176('0x6'),_0x5176('0x7')]}]},'log':_0x5176('0x1')});};}; \ No newline at end of file +var _0xc61a=['faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','Agents','online'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xc61a,0x65));var _0xac61=function(_0x3c2a1a,_0x49008a){_0x3c2a1a=_0x3c2a1a-0x0;var _0x279dfa=_0xc61a[_0x3c2a1a];return _0x279dfa;};'use strict';var client=require(_0xac61('0x0'));exports[_0xac61('0x1')]=function(){return function(){return client['Request'](_0xac61('0x2'),{'options':{'raw':![],'attributes':['id',_0xac61('0x3'),_0xac61('0x4'),_0xac61('0x5')],'include':[{'model':_0xac61('0x6'),'as':_0xac61('0x7'),'attributes':['id',_0xac61('0x3'),_0xac61('0x8'),_0xac61('0x9')]}]},'log':_0xac61('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 92a9d46..285b150 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 _0x935d=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x935d,0x1e5));var _0xd935=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x935d[_0xb7b878];return _0x3c84b9;};'use strict';var client=require('../client');exports['create']=function(_0x57c8a1){return client[_0xd935('0x0')](_0xd935('0x1'),{'body':_0x57c8a1,'log':_0xd935('0x1')});};exports[_0xd935('0x2')]=function(_0x3f4037,_0x4c3ef5){return client[_0xd935('0x0')](_0xd935('0x3'),{'body':_0x4c3ef5,'options':{'where':{'uniqueid':_0x3f4037},'order':[['id',_0xd935('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x35a9=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x395dbb,_0x3c745e){var _0x432c8a=function(_0x185515){while(--_0x185515){_0x395dbb['push'](_0x395dbb['shift']());}};_0x432c8a(++_0x3c745e);}(_0x35a9,0x7a));var _0x935a=function(_0x47c623,_0x3b0dda){_0x47c623=_0x47c623-0x0;var _0x3adb1f=_0x35a9[_0x47c623];return _0x3adb1f;};'use strict';var client=require(_0x935a('0x0'));exports[_0x935a('0x1')]=function(_0x28a5aa){return client[_0x935a('0x2')](_0x935a('0x3'),{'body':_0x28a5aa,'log':_0x935a('0x3')});};exports['update']=function(_0x3737cd,_0x494f3e){return client[_0x935a('0x2')](_0x935a('0x4'),{'body':_0x494f3e,'options':{'where':{'uniqueid':_0x3737cd},'order':[['id',_0x935a('0x5')]],'limit':0x1},'log':_0x935a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a2b0acf..2f10dd0 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 _0x4358=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4358,0x1a7));var _0x8435=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x4358[_0x276468];return _0x36dc3a;};'use strict';var client=require(_0x8435('0x0'));exports[_0x8435('0x1')]=function(){return function(){return client[_0x8435('0x2')](_0x8435('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8435('0x4')],'include':[{'model':_0x8435('0x5'),'as':_0x8435('0x6'),'attributes':['id','name',_0x8435('0x7')]}]},'log':_0x8435('0x1')});};}; \ No newline at end of file +var _0xe366=['getIntervals','GetInterval','name','Intervals','interval','../client'];(function(_0x42e3a0,_0x983ac0){var _0x2281a2=function(_0x1b4af0){while(--_0x1b4af0){_0x42e3a0['push'](_0x42e3a0['shift']());}};_0x2281a2(++_0x983ac0);}(_0xe366,0x95));var _0x6e36=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xe366[_0x37c22c];return _0x119d79;};'use strict';var client=require(_0x6e36('0x0'));exports[_0x6e36('0x1')]=function(){return function(){return client['Request'](_0x6e36('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6e36('0x3')],'include':[{'model':'Interval','as':_0x6e36('0x4'),'attributes':['id',_0x6e36('0x3'),_0x6e36('0x5')]}]},'log':_0x6e36('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e980008..e637ecb 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 _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4093bf,_0x52381f){var _0x2ca68f=function(_0x2b93d9){while(--_0x2b93d9){_0x4093bf['push'](_0x4093bf['shift']());}};_0x2ca68f(++_0x52381f);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x590b6e,_0x3e38bf){_0x590b6e=_0x590b6e-0x0;var _0x20c165=_0xcf2f[_0x590b6e];return _0x20c165;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file +var _0xd117=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5ccb9e,_0x28e61d){var _0x8e1f0e=function(_0xf9fa9f){while(--_0xf9fa9f){_0x5ccb9e['push'](_0x5ccb9e['shift']());}};_0x8e1f0e(++_0x28e61d);}(_0xd117,0x182));var _0x7d11=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd117[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x7d11('0x0'));exports[_0x7d11('0x1')]=function(_0x2737ce,_0x45ee65){return client[_0x7d11('0x2')](_0x7d11('0x3'),{'body':_0x45ee65,'options':{'where':{'id':_0x2737ce}},'log':_0x7d11('0x4')});};exports[_0x7d11('0x5')]=function(_0x3c07be,_0x31fcb0){return client[_0x7d11('0x2')](_0x7d11('0x6'),{'body':_0x31fcb0,'options':{'where':{'id':_0x3c07be}},'log':_0x7d11('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9ee0c01..34f164c 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 _0x1218=['CreateMailMessage','../client','create'];(function(_0xe5f9b1,_0xe06eba){var _0x263a34=function(_0xa8b57){while(--_0xa8b57){_0xe5f9b1['push'](_0xe5f9b1['shift']());}};_0x263a34(++_0xe06eba);}(_0x1218,0x1c6));var _0x8121=function(_0x56deb5,_0x1df33d){_0x56deb5=_0x56deb5-0x0;var _0x19be73=_0x1218[_0x56deb5];return _0x19be73;};'use strict';var client=require(_0x8121('0x0'));exports[_0x8121('0x1')]=function(_0x3e3413){return client['Request'](_0x8121('0x2'),{'body':_0x3e3413,'log':'createMailMessage'});}; \ No newline at end of file +var _0x63f8=['create','createMailMessage'];(function(_0x40ece9,_0x25f3c2){var _0x5c3e5a=function(_0x3d2bbd){while(--_0x3d2bbd){_0x40ece9['push'](_0x40ece9['shift']());}};_0x5c3e5a(++_0x25f3c2);}(_0x63f8,0x1cc));var _0x863f=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x63f8[_0x13b8f3];return _0x1a6d06;};'use strict';var client=require('../client');exports[_0x863f('0x0')]=function(_0x377596){return client['Request']('CreateMailMessage',{'body':_0x377596,'log':_0x863f('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 23808ee..a648a73 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 _0x3125=['mailPause','getMailQueues','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x208d56,_0x5070d7){var _0x3af91a=function(_0x217325){while(--_0x217325){_0x208d56['push'](_0x208d56['shift']());}};_0x3af91a(++_0x5070d7);}(_0x3125,0x1e9));var _0x5312=function(_0x467db5,_0x396fff){_0x467db5=_0x467db5-0x0;var _0x22a9e1=_0x3125[_0x467db5];return _0x22a9e1;};'use strict';var client=require('../client');exports[_0x5312('0x0')]=function(){return function(){return client['Request'](_0x5312('0x1'),{'options':{'raw':![],'attributes':['id',_0x5312('0x2'),_0x5312('0x3'),_0x5312('0x4')],'include':[{'model':'User','as':_0x5312('0x5'),'attributes':['id',_0x5312('0x2'),_0x5312('0x6'),_0x5312('0x7')]}]},'log':_0x5312('0x0')});};}; \ No newline at end of file +var _0xf023=['getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x479b99,_0x1e5bec){var _0x1e7eb7=function(_0x52ac6c){while(--_0x52ac6c){_0x479b99['push'](_0x479b99['shift']());}};_0x1e7eb7(++_0x1e5bec);}(_0xf023,0x153));var _0x3f02=function(_0x3736c4,_0x20cb36){_0x3736c4=_0x3736c4-0x0;var _0x4110f9=_0xf023[_0x3736c4];return _0x4110f9;};'use strict';var client=require(_0x3f02('0x0'));exports[_0x3f02('0x1')]=function(){return function(){return client['Request'](_0x3f02('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f02('0x3'),_0x3f02('0x4'),_0x3f02('0x5')],'include':[{'model':_0x3f02('0x6'),'as':_0x3f02('0x7'),'attributes':['id',_0x3f02('0x3'),_0x3f02('0x8'),_0x3f02('0x9')]}]},'log':_0x3f02('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8b86dac..9ca291c 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 _0x3bfb=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x59dbfe,_0x11f378){var _0x4bebee=function(_0x2e63a0){while(--_0x2e63a0){_0x59dbfe['push'](_0x59dbfe['shift']());}};_0x4bebee(++_0x11f378);}(_0x3bfb,0x117));var _0xb3bf=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x3bfb[_0x4812e0];return _0x252e0f;};'use strict';var client=require('../client');exports[_0xb3bf('0x0')]=function(_0x45f4ef){return client[_0xb3bf('0x1')](_0xb3bf('0x2'),{'body':_0x45f4ef,'log':_0xb3bf('0x2')});};exports[_0xb3bf('0x3')]=function(_0x12fc92,_0x3b9226){return client[_0xb3bf('0x1')](_0xb3bf('0x4'),{'body':_0x3b9226,'options':{'where':{'uniqueid':_0x12fc92},'order':[['id',_0xb3bf('0x5')]],'limit':0x1},'log':_0xb3bf('0x4')});}; \ No newline at end of file +var _0xcfa2=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x1620b1,_0x2671ec){var _0x329961=function(_0x3a8978){while(--_0x3a8978){_0x1620b1['push'](_0x1620b1['shift']());}};_0x329961(++_0x2671ec);}(_0xcfa2,0xb3));var _0x2cfa=function(_0xbad1f4,_0x399fa3){_0xbad1f4=_0xbad1f4-0x0;var _0x3073d5=_0xcfa2[_0xbad1f4];return _0x3073d5;};'use strict';var client=require(_0x2cfa('0x0'));exports[_0x2cfa('0x1')]=function(_0x3a034e){return client[_0x2cfa('0x2')]('CreateMailQueueReport',{'body':_0x3a034e,'log':_0x2cfa('0x3')});};exports[_0x2cfa('0x4')]=function(_0x38a945,_0x326e37){return client['Request'](_0x2cfa('0x5'),{'body':_0x326e37,'options':{'where':{'uniqueid':_0x38a945},'order':[['id','DESC']],'limit':0x1},'log':_0x2cfa('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9f725a4..436b04a 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 _0x03dd=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x1418dc,_0xb8dbbd){var _0x443c59=function(_0xcffe28){while(--_0xcffe28){_0x1418dc['push'](_0x1418dc['shift']());}};_0x443c59(++_0xb8dbbd);}(_0x03dd,0x1f4));var _0xd03d=function(_0xa9c870,_0x111b20){_0xa9c870=_0xa9c870-0x0;var _0x2d13a3=_0x03dd[_0xa9c870];return _0x2d13a3;};'use strict';var client=require(_0xd03d('0x0'));exports[_0xd03d('0x1')]=function(_0x22de52,_0x28d7d7){return client[_0xd03d('0x2')](_0xd03d('0x3'),{'body':_0x28d7d7,'options':{'where':{'id':_0x22de52}},'log':_0xd03d('0x4')});};exports[_0xd03d('0x5')]=function(_0x32ffbd,_0x67ce2f){return client[_0xd03d('0x2')](_0xd03d('0x6'),{'body':_0x67ce2f,'options':{'where':{'id':_0x32ffbd}},'log':_0xd03d('0x7')});}; \ No newline at end of file +var _0x92e5=['update','Request','UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x92e5,0xf5));var _0x592e=function(_0x5eaec1,_0x1e4809){_0x5eaec1=_0x5eaec1-0x0;var _0x265841=_0x92e5[_0x5eaec1];return _0x265841;};'use strict';var client=require('../client');exports[_0x592e('0x0')]=function(_0x50baec,_0x517ba7){return client[_0x592e('0x1')](_0x592e('0x2'),{'body':_0x517ba7,'options':{'where':{'id':_0x50baec}},'log':'updateOpenchannelInteraction'});};exports[_0x592e('0x3')]=function(_0x254c55,_0x331d08){return client[_0x592e('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x331d08,'options':{'where':{'id':_0x254c55}},'log':_0x592e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 65906ef..a56df2f 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 _0xf01e=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x4f1649,_0x489230){var _0xbf6176=function(_0x34c173){while(--_0x34c173){_0x4f1649['push'](_0x4f1649['shift']());}};_0xbf6176(++_0x489230);}(_0xf01e,0x1b3));var _0xef01=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xf01e[_0x265003];return _0x33c743;};'use strict';var client=require(_0xef01('0x0'));exports[_0xef01('0x1')]=function(_0x57a0b0){return client[_0xef01('0x2')](_0xef01('0x3'),{'body':_0x57a0b0,'log':_0xef01('0x4')});}; \ No newline at end of file +var _0xb933=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb933,0xf5));var _0x3b93=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xb933[_0x173d7e];return _0x2220d6;};'use strict';var client=require(_0x3b93('0x0'));exports[_0x3b93('0x1')]=function(_0x286725){return client[_0x3b93('0x2')](_0x3b93('0x3'),{'body':_0x286725,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index dfec3ac..204959d 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 _0x04e7=['Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x04e7,0x6e));var _0x704e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x04e7[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0x704e('0x0'));exports[_0x704e('0x1')]=function(){return function(){return client[_0x704e('0x2')](_0x704e('0x3'),{'options':{'raw':![],'attributes':['id',_0x704e('0x4'),_0x704e('0x5'),_0x704e('0x6')],'include':[{'model':'User','as':_0x704e('0x7'),'attributes':['id',_0x704e('0x4'),'online',_0x704e('0x8')]}]},'log':_0x704e('0x1')});};}; \ No newline at end of file +var _0x1bd9=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0x1bd9,0xbd));var _0x91bd=function(_0xa3d3b6,_0x1ba220){_0xa3d3b6=_0xa3d3b6-0x0;var _0x807355=_0x1bd9[_0xa3d3b6];return _0x807355;};'use strict';var client=require(_0x91bd('0x0'));exports[_0x91bd('0x1')]=function(){return function(){return client['Request'](_0x91bd('0x2'),{'options':{'raw':![],'attributes':['id',_0x91bd('0x3'),_0x91bd('0x4'),_0x91bd('0x5')],'include':[{'model':'User','as':_0x91bd('0x6'),'attributes':['id',_0x91bd('0x3'),_0x91bd('0x7'),_0x91bd('0x8')]}]},'log':_0x91bd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0d954c2..f27c4d1 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 _0xd125=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','create','Request'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0xd125,0x92));var _0x5d12=function(_0x395580,_0x744e24){_0x395580=_0x395580-0x0;var _0x5ce937=_0xd125[_0x395580];return _0x5ce937;};'use strict';var client=require('../client');exports[_0x5d12('0x0')]=function(_0x393387){return client[_0x5d12('0x1')](_0x5d12('0x2'),{'body':_0x393387,'log':_0x5d12('0x2')});};exports['update']=function(_0xfbadae,_0x2a1291){return client['Request'](_0x5d12('0x3'),{'body':_0x2a1291,'options':{'where':{'uniqueid':_0xfbadae},'order':[['id','DESC']],'limit':0x1},'log':_0x5d12('0x3')});}; \ No newline at end of file +var _0x7208=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x2bbfa4,_0x3c59a8){var _0x1ed59b=function(_0x44c905){while(--_0x44c905){_0x2bbfa4['push'](_0x2bbfa4['shift']());}};_0x1ed59b(++_0x3c59a8);}(_0x7208,0x199));var _0x8720=function(_0x1a20af,_0x296328){_0x1a20af=_0x1a20af-0x0;var _0x52817b=_0x7208[_0x1a20af];return _0x52817b;};'use strict';var client=require(_0x8720('0x0'));exports[_0x8720('0x1')]=function(_0x3d1845){return client[_0x8720('0x2')](_0x8720('0x3'),{'body':_0x3d1845,'log':'CreateOpenchannelQueueReport'});};exports[_0x8720('0x4')]=function(_0x153d47,_0x4fdf07){return client[_0x8720('0x2')](_0x8720('0x5'),{'body':_0x4fdf07,'options':{'where':{'uniqueid':_0x153d47},'order':[['id',_0x8720('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 65e704e..97350b4 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 _0x9f5a=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x4f2332,_0x2c356b){_0x4f2332=_0x4f2332-0x0;var _0x15e2a2=_0x9f5a[_0x4f2332];return _0x15e2a2;};'use strict';var client=require(_0xa9f5('0x0'));exports[_0xa9f5('0x1')]=function(_0x218f89,_0x308912){return client['Request'](_0xa9f5('0x2'),{'body':_0x308912,'options':{'where':{'id':_0x218f89}},'log':_0xa9f5('0x3')});};exports[_0xa9f5('0x4')]=function(_0x4eeedd,_0x20f51f){return client['Request'](_0xa9f5('0x5'),{'body':_0x20f51f,'options':{'where':{'id':_0x4eeedd}},'log':_0xa9f5('0x6')});}; \ No newline at end of file +var _0x1280=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x4baba2,_0x4cee12){var _0x1182ca=function(_0x52ff88){while(--_0x52ff88){_0x4baba2['push'](_0x4baba2['shift']());}};_0x1182ca(++_0x4cee12);}(_0x1280,0xba));var _0x0128=function(_0x883d7,_0x28edb8){_0x883d7=_0x883d7-0x0;var _0x1559d6=_0x1280[_0x883d7];return _0x1559d6;};'use strict';var client=require(_0x0128('0x0'));exports[_0x0128('0x1')]=function(_0xf27e34,_0x869975){return client[_0x0128('0x2')](_0x0128('0x3'),{'body':_0x869975,'options':{'where':{'id':_0xf27e34}},'log':_0x0128('0x4')});};exports[_0x0128('0x5')]=function(_0x403dd9,_0x551461){return client[_0x0128('0x2')](_0x0128('0x6'),{'body':_0x551461,'options':{'where':{'id':_0x403dd9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 99a252c..dbf6c0c 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 _0x21b4=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x1a00a0,_0x398200){var _0x912193=function(_0x2df985){while(--_0x2df985){_0x1a00a0['push'](_0x1a00a0['shift']());}};_0x912193(++_0x398200);}(_0x21b4,0xa5));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x421b('0x0'));exports[_0x421b('0x1')]=function(_0x7fbf85){return client[_0x421b('0x2')](_0x421b('0x3'),{'body':_0x7fbf85,'log':_0x421b('0x4')});}; \ No newline at end of file +var _0xfef9=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0xc313c5,_0x54ee3c){var _0x5a1d9b=function(_0x39be15){while(--_0x39be15){_0xc313c5['push'](_0xc313c5['shift']());}};_0x5a1d9b(++_0x54ee3c);}(_0xfef9,0xb3));var _0x9fef=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xfef9[_0x3dc68d];return _0xdf7f94;};'use strict';var client=require('../client');exports[_0x9fef('0x0')]=function(_0x510f59){return client[_0x9fef('0x1')](_0x9fef('0x2'),{'body':_0x510f59,'log':_0x9fef('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c2a7e03..08ec88e 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x3bcb87,_0x2f49fe){var _0x9a1ab6=function(_0x4daebd){while(--_0x4daebd){_0x3bcb87['push'](_0x3bcb87['shift']());}};_0x9a1ab6(++_0x2f49fe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x30aa63,_0x899e1c){var _0x24cfb1=function(_0x5112c5){while(--_0x5112c5){_0x30aa63['push'](_0x30aa63['shift']());}};_0x24cfb1(++_0x899e1c);}(_0x70e0,0x17b));var _0x070e=function(_0x24b7c4,_0x327e25){_0x24b7c4=_0x24b7c4-0x0;var _0x13a0eb=_0x70e0[_0x24b7c4];return _0x13a0eb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a652d24..1c272cf 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xfe123c,_0x421cc9){var _0x11260a=function(_0x289959){while(--_0x289959){_0xfe123c['push'](_0xfe123c['shift']());}};_0x11260a(++_0x421cc9);}(_0x34e8,0x12c));var _0x834e=function(_0x2f0928,_0x29cfee){_0x2f0928=_0x2f0928-0x0;var _0x340ced=_0x34e8[_0x2f0928];return _0x340ced;};'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 +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1bb548,_0x4263a4){var _0x3b90f5=function(_0x4b8fb3){while(--_0x4b8fb3){_0x1bb548['push'](_0x1bb548['shift']());}};_0x3b90f5(++_0x4263a4);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 9238108..9fe33f8 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(_0x497827,_0x114d9f){var _0x192ce5=function(_0x5d0b7c){while(--_0x5d0b7c){_0x497827['push'](_0x497827['shift']());}};_0x192ce5(++_0x114d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x53b8e5,_0x574005){var _0x4c54e5=function(_0x5a06f1){while(--_0x5a06f1){_0x53b8e5['push'](_0x53b8e5['shift']());}};_0x4c54e5(++_0x574005);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 07fa2c7..d144ce1 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 _0x7096=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x52eb16,_0x89c3d8){var _0x382d3f=function(_0x378238){while(--_0x378238){_0x52eb16['push'](_0x52eb16['shift']());}};_0x382d3f(++_0x89c3d8);}(_0x7096,0x10c));var _0x6709=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7096[_0x1facfa];return _0x9ec701;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file +var _0x8b8e=['Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x2bac49,_0x3ae389){var _0x183acc=function(_0x305b33){while(--_0x305b33){_0x2bac49['push'](_0x2bac49['shift']());}};_0x183acc(++_0x3ae389);}(_0x8b8e,0x108));var _0xe8b8=function(_0x1b714d,_0x9f9c79){_0x1b714d=_0x1b714d-0x0;var _0x243757=_0x8b8e[_0x1b714d];return _0x243757;};'use strict';var client=require(_0xe8b8('0x0'));exports['update']=function(_0x33fd9a,_0x4cf54e){return client[_0xe8b8('0x1')]('UpdateWhatsappInteraction',{'body':_0x4cf54e,'options':{'where':{'id':_0x33fd9a}},'log':'updateWhatsappInteraction'});};exports[_0xe8b8('0x2')]=function(_0x472a91,_0x13a865){return client[_0xe8b8('0x1')](_0xe8b8('0x3'),{'body':_0x13a865,'options':{'where':{'id':_0x472a91}},'log':_0xe8b8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 842c591..3400610 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 _0xcb80=['../client','Request','createWhatsappMessage'];(function(_0x4c9dbc,_0x2810cb){var _0x4a1b05=function(_0xdcc8d2){while(--_0xdcc8d2){_0x4c9dbc['push'](_0x4c9dbc['shift']());}};_0x4a1b05(++_0x2810cb);}(_0xcb80,0x87));var _0x0cb8=function(_0x3bb480,_0x1db940){_0x3bb480=_0x3bb480-0x0;var _0x13bd1d=_0xcb80[_0x3bb480];return _0x13bd1d;};'use strict';var client=require(_0x0cb8('0x0'));exports['create']=function(_0x2a86ca){return client[_0x0cb8('0x1')]('CreateWhatsappMessage',{'body':_0x2a86ca,'log':_0x0cb8('0x2')});}; \ No newline at end of file +var _0x77e8=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0xdda570,_0x288d58){var _0x37f80a=function(_0x3da7be){while(--_0x3da7be){_0xdda570['push'](_0xdda570['shift']());}};_0x37f80a(++_0x288d58);}(_0x77e8,0x91));var _0x877e=function(_0x20e81e,_0x2ad41f){_0x20e81e=_0x20e81e-0x0;var _0x3e6654=_0x77e8[_0x20e81e];return _0x3e6654;};'use strict';var client=require(_0x877e('0x0'));exports[_0x877e('0x1')]=function(_0x1de81f){return client[_0x877e('0x2')](_0x877e('0x3'),{'body':_0x1de81f,'log':_0x877e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 96e077c..9b1fc06 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 _0xe2b4=['User','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x45e2dc,_0x6c15c3){var _0x255daa=function(_0xc25a9c){while(--_0xc25a9c){_0x45e2dc['push'](_0x45e2dc['shift']());}};_0x255daa(++_0x6c15c3);}(_0xe2b4,0xc2));var _0x4e2b=function(_0x550154,_0x2ffaf1){_0x550154=_0x550154-0x0;var _0x13a29b=_0xe2b4[_0x550154];return _0x13a29b;};'use strict';var client=require(_0x4e2b('0x0'));exports[_0x4e2b('0x1')]=function(){return function(){return client[_0x4e2b('0x2')](_0x4e2b('0x3'),{'options':{'raw':![],'attributes':['id',_0x4e2b('0x4'),_0x4e2b('0x5'),'strategy'],'include':[{'model':_0x4e2b('0x6'),'as':'Agents','attributes':['id',_0x4e2b('0x4'),_0x4e2b('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x38b2=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','whatsappPause'];(function(_0x3369eb,_0x16953c){var _0xa05bad=function(_0x2913da){while(--_0x2913da){_0x3369eb['push'](_0x3369eb['shift']());}};_0xa05bad(++_0x16953c);}(_0x38b2,0xcb));var _0x238b=function(_0xd5a34b,_0x233f5b){_0xd5a34b=_0xd5a34b-0x0;var _0x3f3169=_0x38b2[_0xd5a34b];return _0x3f3169;};'use strict';var client=require('../client');exports[_0x238b('0x0')]=function(){return function(){return client[_0x238b('0x1')](_0x238b('0x2'),{'options':{'raw':![],'attributes':['id',_0x238b('0x3'),_0x238b('0x4'),_0x238b('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x238b('0x3'),'online',_0x238b('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 812bad3..87efd67 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 _0x8e61=['UpdateWhatsappQueueReport','DESC','Request','CreateWhatsappQueueReport'];(function(_0x60e4a8,_0x54176b){var _0x38243c=function(_0x371668){while(--_0x371668){_0x60e4a8['push'](_0x60e4a8['shift']());}};_0x38243c(++_0x54176b);}(_0x8e61,0xd2));var _0x18e6=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x8e61[_0x2b7764];return _0x848dcb;};'use strict';var client=require('../client');exports['create']=function(_0x30c68f){return client[_0x18e6('0x0')](_0x18e6('0x1'),{'body':_0x30c68f,'log':_0x18e6('0x1')});};exports['update']=function(_0x539373,_0x1ee8dc){return client[_0x18e6('0x0')](_0x18e6('0x2'),{'body':_0x1ee8dc,'options':{'where':{'uniqueid':_0x539373},'order':[['id',_0x18e6('0x3')]],'limit':0x1},'log':_0x18e6('0x2')});}; \ No newline at end of file +var _0x78a1=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xa2f497,_0x4d757d){var _0x202e66=function(_0x424e75){while(--_0x424e75){_0xa2f497['push'](_0xa2f497['shift']());}};_0x202e66(++_0x4d757d);}(_0x78a1,0xd8));var _0x178a=function(_0x106441,_0x56ba36){_0x106441=_0x106441-0x0;var _0x4f2b88=_0x78a1[_0x106441];return _0x4f2b88;};'use strict';var client=require('../client');exports[_0x178a('0x0')]=function(_0x1570eb){return client[_0x178a('0x1')]('CreateWhatsappQueueReport',{'body':_0x1570eb,'log':_0x178a('0x2')});};exports[_0x178a('0x3')]=function(_0x5f32e2,_0x248ce2){return client[_0x178a('0x1')](_0x178a('0x4'),{'body':_0x248ce2,'options':{'where':{'uniqueid':_0x5f32e2},'order':[['id',_0x178a('0x5')]],'limit':0x1},'log':_0x178a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7161199..8aec9da 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 _0x9d5c=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','agents','name','createQueue','atimeout'];(function(_0x57fc4d,_0x66d31){var _0x342711=function(_0x3fb475){while(--_0x3fb475){_0x57fc4d['push'](_0x57fc4d['shift']());}};_0x342711(++_0x66d31);}(_0x9d5c,0xfa));var _0xc9d5=function(_0x26e3aa,_0x3c12d2){_0x26e3aa=_0x26e3aa-0x0;var _0x2dfd89=_0x9d5c[_0x26e3aa];return _0x2dfd89;};'use strict';var schema=require('validate');var _=require(_0xc9d5('0x0'));var util=require('util');var seqqueue=require(_0xc9d5('0x1'));var logger=require(_0xc9d5('0x2'))(_0xc9d5('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xc9d5('0x4'),'required':!![],'message':_0xc9d5('0x5')},'timeout':{'type':_0xc9d5('0x6'),'message':_0xc9d5('0x7')}});function writeLog(_0x2f4a9e,_0x4a76c8,_0x386b5f){return logger['info'](util[_0xc9d5('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2f4a9e,_0x4a76c8['name'],_0x386b5f));}function handleFindAgent(_0x47edbc){return function(_0x377a5c){return _0x377a5c['name']['toLowerCase']()===_0x47edbc[_0xc9d5('0x9')]();};}exports[_0xc9d5('0xa')]=function(_0x38a719,_0x34d13f,_0x497499,_0x561bb9){return function(_0x993f4c){try{var _0x1daf02={'name':_0x34d13f[0x0],'timeout':_0x34d13f[0x1]};var _0x2b3962=queue[_0xc9d5('0xb')](_0x1daf02,{'typecast':!![]});if(_0x2b3962[_0xc9d5('0xc')]){logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x38a719,_[_0xc9d5('0xf')](_0x2b3962,_0xc9d5('0x10'))['join'](',\x20'));_0x993f4c[_0xc9d5('0x11')]();}else{var _0x4170be=_['find'](_0x497499[_0xc9d5('0x12')],handleFindAgent(_0x1daf02[_0xc9d5('0x13')]));if(_0x4170be){var _0x14c8e2=(_0x1daf02['timeout']||0xa)*0x3e8;var _0x1a4444,_0x4105a6;var _0x1f8e62=seqqueue[_0xc9d5('0x14')](_0x14c8e2);_0x1f8e62['id']=_0x38a719;_0x1f8e62[_0xc9d5('0x15')]=_0x14c8e2;_0x1f8e62[_0xc9d5('0x16')]=_0x561bb9[_0xc9d5('0x16')];writeLog(_0x38a719,_0x4170be,util[_0xc9d5('0x8')](_0xc9d5('0x17'),_0x14c8e2));_0x497499[_0xc9d5('0x18')][_0x38a719]['on'](_0xc9d5('0x19'),function(){logger['info'](_0xc9d5('0x1a'),_0x38a719);clearTimeout(_0x4105a6);_0x4105a6=undefined;_0x1f8e62[_0xc9d5('0x1b')]();if(_0x497499[_0xc9d5('0x18')][_0x38a719]){delete _0x497499[_0xc9d5('0x18')][_0x38a719];}_0x993f4c['stop']();});_0x497499[_0xc9d5('0x18')][_0x38a719]['on']('complete',function(){if(_0x497499['rules'][_0x38a719]){delete _0x497499[_0xc9d5('0x18')][_0x38a719];}});_0x4105a6=setTimeout(function(){logger['info'](_0xc9d5('0x1c'),_0x38a719);clearTimeout(_0x4105a6);_0x1f8e62[_0xc9d5('0x1b')]();_0x993f4c[_0xc9d5('0x1d')]();},_0x14c8e2);strategy[_0xc9d5('0x1e')](_0x1f8e62,_0x4170be,_0x497499,_0x561bb9);}else{logger[_0xc9d5('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x38a719,_0x1daf02[_0xc9d5('0x13')]);_0x993f4c[_0xc9d5('0x11')]();}}}catch(_0x2370f5){console[_0xc9d5('0x1f')](_0x2370f5);logger[_0xc9d5('0xd')](_0xc9d5('0x20'),_0x38a719,_0x2370f5[_0xc9d5('0x21')]);_0x993f4c[_0xc9d5('0x11')]();}};}; \ No newline at end of file +var _0xbb15=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','log','[%s][QUEUE]\x20%s','stack','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x1b38d8,_0x1a86ac){var _0x1929af=function(_0x2659eb){while(--_0x2659eb){_0x1b38d8['push'](_0x1b38d8['shift']());}};_0x1929af(++_0x1a86ac);}(_0xbb15,0x158));var _0x5bb1=function(_0x326704,_0x28e132){_0x326704=_0x326704-0x0;var _0x5631a7=_0xbb15[_0x326704];return _0x5631a7;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0x5bb1('0x0'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5bb1('0x1'));var queue=schema({'name':{'type':_0x5bb1('0x2'),'required':!![],'message':_0x5bb1('0x3')},'timeout':{'type':_0x5bb1('0x4'),'message':_0x5bb1('0x5')}});function writeLog(_0x20e087,_0x388029,_0x4d2797){return logger[_0x5bb1('0x6')](util[_0x5bb1('0x7')](_0x5bb1('0x8'),_0x20e087,_0x388029[_0x5bb1('0x9')],_0x4d2797));}function handleFindAgent(_0x50d01){return function(_0x7cb395){return _0x7cb395['name']['toLowerCase']()===_0x50d01[_0x5bb1('0xa')]();};}exports[_0x5bb1('0xb')]=function(_0x577e64,_0x2ed1fa,_0x38042b,_0x51f8a1){return function(_0x503d20){try{var _0x18f65b={'name':_0x2ed1fa[0x0],'timeout':_0x2ed1fa[0x1]};var _0x13e77e=queue[_0x5bb1('0xc')](_0x18f65b,{'typecast':!![]});if(_0x13e77e['length']){logger[_0x5bb1('0xd')](_0x5bb1('0xe'),_0x577e64,_[_0x5bb1('0xf')](_0x13e77e,_0x5bb1('0x10'))['join'](',\x20'));_0x503d20[_0x5bb1('0x11')]();}else{var _0x1b9788=_[_0x5bb1('0x12')](_0x38042b[_0x5bb1('0x13')],handleFindAgent(_0x18f65b[_0x5bb1('0x9')]));if(_0x1b9788){var _0x24c0c7=(_0x18f65b[_0x5bb1('0x14')]||0xa)*0x3e8;var _0x53e6e2,_0x1d5353;var _0x2a0aab=seqqueue[_0x5bb1('0x15')](_0x24c0c7);_0x2a0aab['id']=_0x577e64;_0x2a0aab[_0x5bb1('0x16')]=_0x24c0c7;_0x2a0aab[_0x5bb1('0x17')]=_0x51f8a1[_0x5bb1('0x17')];writeLog(_0x577e64,_0x1b9788,util[_0x5bb1('0x7')]('START:%s',_0x24c0c7));_0x38042b[_0x5bb1('0x18')][_0x577e64]['on'](_0x5bb1('0x19'),function(){logger[_0x5bb1('0x6')](_0x5bb1('0x1a'),_0x577e64);clearTimeout(_0x1d5353);_0x1d5353=undefined;_0x2a0aab['close']();if(_0x38042b[_0x5bb1('0x18')][_0x577e64]){delete _0x38042b[_0x5bb1('0x18')][_0x577e64];}_0x503d20[_0x5bb1('0x11')]();});_0x38042b[_0x5bb1('0x18')][_0x577e64]['on'](_0x5bb1('0x1b'),function(){if(_0x38042b[_0x5bb1('0x18')][_0x577e64]){delete _0x38042b[_0x5bb1('0x18')][_0x577e64];}});_0x1d5353=setTimeout(function(){logger[_0x5bb1('0x6')](_0x5bb1('0x1c'),_0x577e64);clearTimeout(_0x1d5353);_0x2a0aab['close']();_0x503d20['next']();},_0x24c0c7);strategy['agent'](_0x2a0aab,_0x1b9788,_0x38042b,_0x51f8a1);}else{logger[_0x5bb1('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x577e64,_0x18f65b[_0x5bb1('0x9')]);_0x503d20[_0x5bb1('0x11')]();}}}catch(_0x2df5e4){console[_0x5bb1('0x1d')](_0x2df5e4);logger[_0x5bb1('0xd')](_0x5bb1('0x1e'),_0x577e64,_0x2df5e4[_0x5bb1('0x1f')]);_0x503d20['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5c35f8b..a22e7ab 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 _0xdf3e=['ChatWebsiteId','account','upperFirst','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','providerResponse','stringify','Failed','next','stop','lodash','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','interaction'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0xdf3e,0xeb));var _0xedf3=function(_0x271d4b,_0xbfde00){_0x271d4b=_0x271d4b-0x0;var _0xe4a45b=_0xdf3e[_0x271d4b];return _0xe4a45b;};'use strict';var _=require(_0xedf3('0x0'));var moment=require('moment');var AWS=require(_0xedf3('0x1'));var utils=require('./utils');var logger=require(_0xedf3('0x2'))('routing');var rpc={'chatMessage':require(_0xedf3('0x3')),'openchannelMessage':require(_0xedf3('0x4')),'mailMessage':require(_0xedf3('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xedf3('0x6')]=function(_0x524781,_0x1a841d){return function(_0x38be9c){try{if(!_['isNil'](this['interaction'][_0xedf3('0x7')])){logger['info'](_0xedf3('0x8'),_0x524781,_0xedf3('0x9'));return _0x38be9c['next']();}var _0x585aec={'ContactId':this['contact']['id'],'sentAt':moment()[_0xedf3('0xa')](_0xedf3('0xb')),'direction':_0xedf3('0xc')};if(this['channel']===_0xedf3('0xd')||this[_0xedf3('0xe')]==='whatsapp'){_0x585aec[_0xedf3('0xf')]=this[_0xedf3('0x10')][_0xedf3('0xf')];}var _0x248024=this[_0xedf3('0xe')];if(_0x248024==='chat'){_0x585aec[_0xedf3('0x11')]=this[_0xedf3('0x12')]['id'];}else{_0x585aec[_[_0xedf3('0x13')](_0x248024)+'AccountId']=this[_0xedf3('0x12')]['id'];}_0x585aec[_['upperFirst'](_0x248024)+'InteractionId']=this['interaction']['id'];if(this[_0xedf3('0x10')]['created']){var _0x5c248b=_0x1a841d[0x4];if(!_[_0xedf3('0x14')](_0x5c248b)){_0x585aec[_0xedf3('0x15')]=utils[_0xedf3('0x16')](_0x5c248b,this);return rpc[_0x248024+_0xedf3('0x17')][_0xedf3('0x18')](_0x585aec)[_0xedf3('0x19')](function(_0x2f5c98){logger[_0xedf3('0x1a')](_0xedf3('0x8'),_0x524781,_0x585aec[_0xedf3('0x15')]);})[_0xedf3('0x1b')](function(_0x2eff39){logger[_0xedf3('0x1c')](_0xedf3('0x8'),_0x524781,JSON['stringify'](_0x2eff39));})['finally'](function(){logger[_0xedf3('0x1a')](_0xedf3('0x1d'),_0x524781);_0x38be9c['stop']();});}else{logger[_0xedf3('0x1a')](_0xedf3('0x1e'),_0x524781);_0x38be9c['stop']();}}else{var _0x66a3bb=this;var _0x20fa4b=new AWS[(_0xedf3('0x1f'))]({'accessKeyId':_0x1a841d[0x0],'secretAccessKey':_0x1a841d[0x1],'region':_0x1a841d[0x2]});var _0x205147={'botAlias':'$LATEST','botName':_0x1a841d[0x3],'inputText':this[_0xedf3('0x20')][_0xedf3('0x15')],'userId':this['channel']+':'+this['interaction']['id'][_0xedf3('0x21')]()};_0x20fa4b[_0xedf3('0x22')](_0x205147,function(_0x4c1bf4,_0x2d8e47){if(_0x4c1bf4){logger['error'](_0xedf3('0x8'),_0x524781,_0x4c1bf4[_0xedf3('0x20')]);_0x38be9c['next']();}else if(_0x2d8e47&&_0x2d8e47[_0xedf3('0x20')]){_0x66a3bb[_0xedf3('0x15')]['amazonlex']=_0x2d8e47;_0x585aec[_0xedf3('0x15')]=_0x2d8e47[_0xedf3('0x20')];_0x585aec[_0xedf3('0x23')]=_0xedf3('0x24');_0x585aec[_0xedf3('0x25')]=JSON[_0xedf3('0x26')](_0x2d8e47);return rpc[_0x248024+_0xedf3('0x17')]['create'](_0x585aec)['then'](function(_0x2cade7){logger[_0xedf3('0x1a')](_0xedf3('0x8'),_0x524781,_0x585aec[_0xedf3('0x15')]);if(_0x2d8e47['dialogState']==_0xedf3('0x27')){_0x38be9c[_0xedf3('0x28')]();}else{_0x38be9c[_0xedf3('0x29')]();}})['catch'](function(_0x5c6b0a){logger[_0xedf3('0x1c')](_0xedf3('0x8'),_0x524781,JSON[_0xedf3('0x26')](_0x5c6b0a));_0x38be9c[_0xedf3('0x28')]();});}else{_0x38be9c['next']();}});}}catch(_0x3db1b6){logger[_0xedf3('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x524781,JSON[_0xedf3('0x26')](_0x3db1b6));_0x38be9c[_0xedf3('0x29')]();}};}; \ No newline at end of file +var _0x6e08=['error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerResponse','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch'];(function(_0x4830f0,_0x3116dc){var _0xfc8df9=function(_0x2ca367){while(--_0x2ca367){_0x4830f0['push'](_0x4830f0['shift']());}};_0xfc8df9(++_0x3116dc);}(_0x6e08,0x1e1));var _0x86e0=function(_0x130615,_0x340b88){_0x130615=_0x130615-0x0;var _0x350edb=_0x6e08[_0x130615];return _0x350edb;};'use strict';var _=require(_0x86e0('0x0'));var moment=require(_0x86e0('0x1'));var AWS=require(_0x86e0('0x2'));var utils=require(_0x86e0('0x3'));var logger=require(_0x86e0('0x4'))(_0x86e0('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x86e0('0x6')),'mailMessage':require(_0x86e0('0x7')),'smsMessage':require(_0x86e0('0x8')),'faxMessage':require(_0x86e0('0x9')),'whatsappMessage':require(_0x86e0('0xa'))};exports[_0x86e0('0xb')]=function(_0x32c580,_0x356d91){return function(_0x49504e){try{if(!_[_0x86e0('0xc')](this['interaction'][_0x86e0('0xd')])){logger[_0x86e0('0xe')](_0x86e0('0xf'),_0x32c580,_0x86e0('0x10'));return _0x49504e[_0x86e0('0x11')]();}var _0x465490={'ContactId':this[_0x86e0('0x12')]['id'],'sentAt':moment()[_0x86e0('0x13')](_0x86e0('0x14')),'direction':_0x86e0('0x15')};if(this[_0x86e0('0x16')]===_0x86e0('0x17')||this['channel']===_0x86e0('0x18')){_0x465490[_0x86e0('0x19')]=this[_0x86e0('0x1a')][_0x86e0('0x19')];}var _0x320ce8=this['channel'];if(_0x320ce8==='chat'){_0x465490[_0x86e0('0x1b')]=this[_0x86e0('0x1c')]['id'];}else{_0x465490[_[_0x86e0('0x1d')](_0x320ce8)+_0x86e0('0x1e')]=this[_0x86e0('0x1c')]['id'];}_0x465490[_[_0x86e0('0x1d')](_0x320ce8)+_0x86e0('0x1f')]=this[_0x86e0('0x1a')]['id'];if(this[_0x86e0('0x1a')][_0x86e0('0x20')]){var _0x1a19d1=_0x356d91[0x4];if(!_[_0x86e0('0x21')](_0x1a19d1)){_0x465490[_0x86e0('0x22')]=utils[_0x86e0('0x23')](_0x1a19d1,this);return rpc[_0x320ce8+_0x86e0('0x24')]['create'](_0x465490)[_0x86e0('0x25')](function(_0x4523b0){logger[_0x86e0('0xe')](_0x86e0('0xf'),_0x32c580,_0x465490['body']);})[_0x86e0('0x26')](function(_0x542b86){logger[_0x86e0('0x27')](_0x86e0('0xf'),_0x32c580,JSON[_0x86e0('0x28')](_0x542b86));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x32c580);_0x49504e[_0x86e0('0x29')]();});}else{logger['info'](_0x86e0('0x2a'),_0x32c580);_0x49504e[_0x86e0('0x29')]();}}else{var _0x293a94=this;var _0x41dc84=new AWS[(_0x86e0('0x2b'))]({'accessKeyId':_0x356d91[0x0],'secretAccessKey':_0x356d91[0x1],'region':_0x356d91[0x2]});var _0x59d78a={'botAlias':_0x86e0('0x2c'),'botName':_0x356d91[0x3],'inputText':this[_0x86e0('0x2d')][_0x86e0('0x22')],'userId':this['channel']+':'+this['interaction']['id'][_0x86e0('0x2e')]()};_0x41dc84['postText'](_0x59d78a,function(_0x5ace21,_0x37fcce){if(_0x5ace21){logger[_0x86e0('0x27')]('[%s][AMAZONLEX]\x20%s',_0x32c580,_0x5ace21['message']);_0x49504e['next']();}else if(_0x37fcce&&_0x37fcce[_0x86e0('0x2d')]){_0x293a94[_0x86e0('0x22')][_0x86e0('0x2f')]=_0x37fcce;_0x465490[_0x86e0('0x22')]=_0x37fcce['message'];_0x465490['providerName']=_0x86e0('0x2f');_0x465490[_0x86e0('0x30')]=JSON[_0x86e0('0x28')](_0x37fcce);return rpc[_0x320ce8+'Message'][_0x86e0('0x31')](_0x465490)[_0x86e0('0x25')](function(_0x20c85c){logger['info']('[%s][AMAZONLEX]\x20%s',_0x32c580,_0x465490[_0x86e0('0x22')]);if(_0x37fcce[_0x86e0('0x32')]==_0x86e0('0x33')){_0x49504e[_0x86e0('0x11')]();}else{_0x49504e[_0x86e0('0x29')]();}})['catch'](function(_0x193da6){logger[_0x86e0('0x27')](_0x86e0('0xf'),_0x32c580,JSON[_0x86e0('0x28')](_0x193da6));_0x49504e['next']();});}else{_0x49504e[_0x86e0('0x11')]();}});}}catch(_0x19003e){logger['error'](_0x86e0('0xf'),_0x32c580,JSON['stringify'](_0x19003e));_0x49504e[_0x86e0('0x29')]();}};}; \ 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 457ff6b..4c410ec 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 _0x990e=['created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','inReplyTo','messageId','','';_0x4a86d7[_0xe990('0x30')]={'Auto-Submitted':_0xe990('0x31'),'X-Auto-Response-Suppress':'All','Precedence':_0xe990('0x32')};return mailRpc[_0xe990('0x33')](this[_0xe990('0x29')][_0xe990('0x34')],_0x4a86d7)[_0xe990('0x35')](function(_0x3479c0){logger['info'](_0xe990('0x36'),_0x48d802);_0x4a86d7[_0xe990('0x2c')]=_0x3479c0[_0xe990('0x1e')][_0xe990('0x2c')];return rpc[_0x6b0a1f+_0xe990('0x37')][_0xe990('0x38')](_0x4a86d7);})[_0xe990('0x35')](function(_0x22d83c){logger[_0xe990('0x10')]('[%s][AUTOREPLY]\x20%s',_0x48d802,JSON[_0xe990('0x39')](_0x22d83c));})['catch'](function(_0x5b6b83){logger[_0xe990('0x3a')](_0xe990('0x3b'),_0x48d802,JSON[_0xe990('0x39')](_0x5b6b83));})[_0xe990('0x3c')](function(){Promise[_0xe990('0x3d')]()[_0xe990('0x35')](function(){if(_0x53a12f[0x0]!=='2'||_0x2f6be9[_0xe990('0x17')])return;return rpc[_0x6b0a1f+'Interaction'][_0xe990('0x3e')](_0x2f6be9['id'],{'autoreplyExecuted':!![]})[_0xe990('0x35')](function(_0x15abc8){logger[_0xe990('0x10')](_0xe990('0x18'),_0x48d802,JSON['stringify'](_0x15abc8));})[_0xe990('0x3f')](function(_0x5b8adb){logger[_0xe990('0x3a')](_0xe990('0x40'),_0x48d802,JSON[_0xe990('0x39')](_0x5b8adb));});})[_0xe990('0x35')](function(){_0x447fd9['next']();});});}else{return rpc[this['channel']+_0xe990('0x37')]['create'](_0x4a86d7)[_0xe990('0x35')](function(){logger[_0xe990('0x10')](_0xe990('0x11'),_0x48d802,_0x4a86d7[_0xe990('0x1c')]);})['catch'](function(_0x11dd7e){logger[_0xe990('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x48d802,JSON['stringify'](_0x11dd7e));})[_0xe990('0x3c')](function(){Promise[_0xe990('0x3d')]()[_0xe990('0x35')](function(){if(_0x53a12f[0x0]!=='2'||_0x2f6be9[_0xe990('0x17')])return;return rpc[_0x6b0a1f+_0xe990('0x41')]['update'](_0x2f6be9['id'],{'autoreplyExecuted':!![]})[_0xe990('0x35')](function(_0x164e07){logger[_0xe990('0x10')](_0xe990('0x18'),_0x48d802,JSON[_0xe990('0x39')](_0x164e07));})[_0xe990('0x3f')](function(_0x4e2c86){logger['error'](_0xe990('0x40'),_0x48d802,JSON[_0xe990('0x39')](_0x4e2c86));});})[_0xe990('0x35')](function(){_0x447fd9[_0xe990('0x13')]();});});}}}catch(_0x2a256b){logger[_0xe990('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x48d802,JSON[_0xe990('0x39')](_0x2a256b));_0x447fd9[_0xe990('0x42')]();}};}; \ No newline at end of file +var _0xd16c=['account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','';_0xf37c54[_0xcd16('0x31')]={'Auto-Submitted':_0xcd16('0x32'),'X-Auto-Response-Suppress':_0xcd16('0x33'),'Precedence':_0xcd16('0x34')};return mailRpc['sendMailMessage'](this[_0xcd16('0x27')][_0xcd16('0x35')],_0xf37c54)[_0xcd16('0x36')](function(_0x18bb16){logger[_0xcd16('0x10')](_0xcd16('0x37'),_0x17e2b8);_0xf37c54[_0xcd16('0x2c')]=_0x18bb16['message'][_0xcd16('0x2c')];return rpc[_0x11356b+_0xcd16('0x2b')][_0xcd16('0x38')](_0xf37c54);})[_0xcd16('0x36')](function(_0x4a896f){logger['info'](_0xcd16('0x11'),_0x17e2b8,JSON[_0xcd16('0x39')](_0x4a896f));})[_0xcd16('0x3a')](function(_0x1759df){logger[_0xcd16('0x3b')](_0xcd16('0x3c'),_0x17e2b8,JSON['stringify'](_0x1759df));})[_0xcd16('0x3d')](function(){Promise[_0xcd16('0x3e')]()['then'](function(){if(_0x5b075e[0x0]!=='2'||_0x48f312[_0xcd16('0x18')])return;return rpc[_0x11356b+_0xcd16('0x3f')][_0xcd16('0x40')](_0x48f312['id'],{'autoreplyExecuted':!![]})[_0xcd16('0x36')](function(_0x40ed65){logger[_0xcd16('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x17e2b8,JSON[_0xcd16('0x39')](_0x40ed65));})[_0xcd16('0x3a')](function(_0x24bd72){logger[_0xcd16('0x3b')](_0xcd16('0x41'),_0x17e2b8,JSON['stringify'](_0x24bd72));});})['then'](function(){_0x4ec769[_0xcd16('0x13')]();});});}else{return rpc[this['channel']+_0xcd16('0x2b')][_0xcd16('0x38')](_0xf37c54)['then'](function(){logger[_0xcd16('0x10')](_0xcd16('0x11'),_0x17e2b8,_0xf37c54[_0xcd16('0x1f')]);})['catch'](function(_0x26e544){logger[_0xcd16('0x3b')](_0xcd16('0x11'),_0x17e2b8,JSON[_0xcd16('0x39')](_0x26e544));})[_0xcd16('0x3d')](function(){Promise['resolve']()[_0xcd16('0x36')](function(){if(_0x5b075e[0x0]!=='2'||_0x48f312[_0xcd16('0x18')])return;return rpc[_0x11356b+_0xcd16('0x3f')][_0xcd16('0x40')](_0x48f312['id'],{'autoreplyExecuted':!![]})[_0xcd16('0x36')](function(_0x1e5cbf){logger[_0xcd16('0x10')](_0xcd16('0x19'),_0x17e2b8,JSON[_0xcd16('0x39')](_0x1e5cbf));})[_0xcd16('0x3a')](function(_0x2ab19f){logger[_0xcd16('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x17e2b8,JSON['stringify'](_0x2ab19f));});})[_0xcd16('0x36')](function(){_0x4ec769['next']();});});}}}catch(_0x74b63e){logger[_0xcd16('0x3b')](_0xcd16('0x11'),_0x17e2b8,JSON[_0xcd16('0x39')](_0x74b63e));_0x4ec769[_0xcd16('0x42')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index c803169..687140d 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf033=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','moment','routing','../../rpc/chatInteraction'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0xf033,0x189));var _0x3f03=function(_0x2929ba,_0x506aa6){_0x2929ba=_0x2929ba-0x0;var _0x365e6e=_0xf033[_0x2929ba];return _0x365e6e;};'use strict';var moment=require(_0x3f03('0x0'));var logger=require('../../../../config/logger')(_0x3f03('0x1'));var rpc={'chatInteraction':require(_0x3f03('0x2')),'openchannelInteraction':require(_0x3f03('0x3')),'smsInteraction':require(_0x3f03('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3f03('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x3f03('0x6')]=function(_0x2bfa65,_0x31f792,_0x2b0aab,_0x4cfcfa){return function(_0x578b7d){try{logger[_0x3f03('0x7')](_0x3f03('0x8'),_0x2bfa65,_0x31f792[0x0]);var _0x102e50={'closed':0x1,'closedAt':moment()[_0x3f03('0x9')](_0x3f03('0xa')),'closeReason':_0x3f03('0xb'),'disposition':_0x31f792[0x0]};if(rpc[_0x4cfcfa[_0x3f03('0xc')]+'Interaction']){rpc[_0x4cfcfa['channel']+'Interaction'][_0x3f03('0xd')](_0x4cfcfa[_0x3f03('0xe')]['id'],_0x102e50)[_0x3f03('0xf')](function(_0x4b39c7){logger[_0x3f03('0x7')](_0x3f03('0x10'),_0x2bfa65,_0x4cfcfa[_0x3f03('0xe')]['id']);})[_0x3f03('0x11')](function(_0x3c4c33){logger[_0x3f03('0x12')](_0x3f03('0x13'),_0x2bfa65,JSON[_0x3f03('0x14')](_0x3c4c33));})[_0x3f03('0x15')](function(){_0x578b7d['stop']();});}}catch(_0x5fed09){logger[_0x3f03('0x12')](_0x3f03('0x13'),_0x2bfa65,JSON['stringify'](_0x5fed09));_0x578b7d['stop']();}};}; \ No newline at end of file +var _0xe5d0=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/smsInteraction'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xe5d0,0x178));var _0x0e5d=function(_0x2c5b9f,_0x2fce4e){_0x2c5b9f=_0x2c5b9f-0x0;var _0x321c18=_0xe5d0[_0x2c5b9f];return _0x321c18;};'use strict';var moment=require(_0x0e5d('0x0'));var logger=require(_0x0e5d('0x1'))(_0x0e5d('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0e5d('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0e5d('0x4')),'whatsappInteraction':require(_0x0e5d('0x5'))};exports[_0x0e5d('0x6')]=function(_0x1e26ff,_0xf82dd4,_0x153336,_0x195627){return function(_0x31015a){try{logger[_0x0e5d('0x7')](_0x0e5d('0x8'),_0x1e26ff,_0xf82dd4[0x0]);var _0x349f1={'closed':0x1,'closedAt':moment()['format'](_0x0e5d('0x9')),'closeReason':_0x0e5d('0xa'),'disposition':_0xf82dd4[0x0]};if(rpc[_0x195627[_0x0e5d('0xb')]+'Interaction']){rpc[_0x195627[_0x0e5d('0xb')]+'Interaction'][_0x0e5d('0xc')](_0x195627[_0x0e5d('0xd')]['id'],_0x349f1)['then'](function(_0x10a358){logger[_0x0e5d('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1e26ff,_0x195627[_0x0e5d('0xd')]['id']);})[_0x0e5d('0xe')](function(_0x12abf4){logger[_0x0e5d('0xf')]('[%s][CLOSE]\x20%s',_0x1e26ff,JSON[_0x0e5d('0x10')](_0x12abf4));})[_0x0e5d('0x11')](function(){_0x31015a[_0x0e5d('0x12')]();});}}catch(_0x1c70ba){logger[_0x0e5d('0xf')](_0x0e5d('0x13'),_0x1e26ff,JSON['stringify'](_0x1c70ba));_0x31015a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 8e4c35f..eff2f8d 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4da5=['interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','Message','create','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','stringify','message','next','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4da5,0x1b7));var _0x54da=function(_0x154875,_0x1586fa){_0x154875=_0x154875-0x0;var _0x5998ac=_0x4da5[_0x154875];return _0x5998ac;};'use strict';var _=require('lodash');var moment=require(_0x54da('0x0'));var apiai=require(_0x54da('0x1'));var md5=require(_0x54da('0x2'));var utils=require('./utils');var logger=require(_0x54da('0x3'))('routing');var rpc={'chatMessage':require(_0x54da('0x4')),'openchannelMessage':require(_0x54da('0x5')),'mailMessage':require(_0x54da('0x6')),'smsMessage':require(_0x54da('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x54da('0x8'))};exports[_0x54da('0x9')]=function(_0x259062,_0x1b2b5c){return function(_0x2fe7cc){try{if(!_[_0x54da('0xa')](this[_0x54da('0xb')]['UserId'])){logger[_0x54da('0xc')](_0x54da('0xd'),_0x259062,_0x54da('0xe'));return _0x2fe7cc['next']();}var _0x270a06={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x54da('0xf')),'direction':_0x54da('0x10')};if(this[_0x54da('0x11')]===_0x54da('0x12')||this[_0x54da('0x11')]===_0x54da('0x13')){_0x270a06[_0x54da('0x14')]=this[_0x54da('0xb')][_0x54da('0x14')];}var _0x1ff5fc=this[_0x54da('0x11')];if(_0x1ff5fc===_0x54da('0x15')){_0x270a06[_0x54da('0x16')]=this['account']['id'];}else{_0x270a06[_[_0x54da('0x17')](_0x1ff5fc)+_0x54da('0x18')]=this[_0x54da('0x19')]['id'];}_0x270a06[_[_0x54da('0x17')](_0x1ff5fc)+'InteractionId']=this[_0x54da('0xb')]['id'];if(this[_0x54da('0xb')][_0x54da('0x1a')]){var _0x25261c=_0x1b2b5c[0x2];if(!_[_0x54da('0x1b')](_0x25261c)){_0x270a06[_0x54da('0x1c')]=utils['getMustacheRender'](_0x25261c,this);return rpc[_0x1ff5fc+_0x54da('0x1d')][_0x54da('0x1e')](_0x270a06)['then'](function(_0x2cad22){logger[_0x54da('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x259062,_0x270a06['body']);})[_0x54da('0x1f')](function(_0x5d9ba2){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON['stringify'](_0x5d9ba2));})[_0x54da('0x21')](function(){logger[_0x54da('0xc')](_0x54da('0x22'),_0x259062);_0x2fe7cc[_0x54da('0x23')]();});}else{logger[_0x54da('0xc')](_0x54da('0x24'),_0x259062);_0x2fe7cc[_0x54da('0x23')]();}}else{var _0x415598=this;var _0x340d26=apiai(_0x1b2b5c[0x0],{'language':_0x1b2b5c[0x1]||'en'});return _0x340d26[_0x54da('0x25')](this['message'][_0x54da('0x1c')],{'sessionId':md5(this[_0x54da('0xb')]['id'])})[_0x54da('0x26')](function(_0x3d062b){_0x415598[_0x54da('0x1c')][_0x54da('0x27')]=_0x3d062b;_0x270a06['body']=_0x3d062b[_0x54da('0x28')][_0x54da('0x29')][_0x54da('0x2a')];_0x270a06[_0x54da('0x2b')]=_0x54da('0x27');_0x270a06[_0x54da('0x2c')]=JSON['stringify'](_0x3d062b);return rpc[_0x1ff5fc+_0x54da('0x1d')]['create'](_0x270a06)[_0x54da('0x26')](function(_0x39c306){logger[_0x54da('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x259062,_0x270a06['body']);if(_0x3d062b[_0x54da('0x28')][_0x54da('0x2d')][_0x54da('0x2e')]){_0x2fe7cc['next']();}else{_0x2fe7cc[_0x54da('0x23')]();}})[_0x54da('0x1f')](function(_0x56942a){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON[_0x54da('0x2f')](_0x56942a));_0x2fe7cc['next']();});})['catch'](function(_0x21784e){logger['error'](_0x54da('0xd'),_0x259062,_0x21784e[_0x54da('0x30')]);_0x2fe7cc[_0x54da('0x31')]();});}}catch(_0x23b48e){logger[_0x54da('0x20')](_0x54da('0xd'),_0x259062,JSON[_0x54da('0x2f')](_0x23b48e));_0x2fe7cc[_0x54da('0x23')]();}};}; \ No newline at end of file +var _0xa751=['isEmpty','body','getMustacheRender','Message','create','then','info','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','providerResponse','result','metadata','endConversation','stringify','error','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId'];(function(_0x1457f6,_0x530d7e){var _0x4b8aa8=function(_0x334f98){while(--_0x334f98){_0x1457f6['push'](_0x1457f6['shift']());}};_0x4b8aa8(++_0x530d7e);}(_0xa751,0x175));var _0x1a75=function(_0x37fa52,_0x3c6639){_0x37fa52=_0x37fa52-0x0;var _0x97ecc1=_0xa751[_0x37fa52];return _0x97ecc1;};'use strict';var _=require(_0x1a75('0x0'));var moment=require(_0x1a75('0x1'));var apiai=require(_0x1a75('0x2'));var md5=require(_0x1a75('0x3'));var utils=require('./utils');var logger=require(_0x1a75('0x4'))('routing');var rpc={'chatMessage':require(_0x1a75('0x5')),'openchannelMessage':require(_0x1a75('0x6')),'mailMessage':require(_0x1a75('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1a75('0x8')),'whatsappMessage':require(_0x1a75('0x9'))};exports[_0x1a75('0xa')]=function(_0x2af95b,_0x1ec106){return function(_0x692ac0){try{if(!_[_0x1a75('0xb')](this['interaction']['UserId'])){logger['info'](_0x1a75('0xc'),_0x2af95b,_0x1a75('0xd'));return _0x692ac0[_0x1a75('0xe')]();}var _0x271286={'ContactId':this[_0x1a75('0xf')]['id'],'sentAt':moment()[_0x1a75('0x10')](_0x1a75('0x11')),'direction':_0x1a75('0x12')};if(this['channel']==='sms'||this['channel']===_0x1a75('0x13')){_0x271286[_0x1a75('0x14')]=this[_0x1a75('0x15')][_0x1a75('0x14')];}var _0x500d60=this['channel'];if(_0x500d60===_0x1a75('0x16')){_0x271286[_0x1a75('0x17')]=this['account']['id'];}else{_0x271286[_[_0x1a75('0x18')](_0x500d60)+_0x1a75('0x19')]=this['account']['id'];}_0x271286[_[_0x1a75('0x18')](_0x500d60)+_0x1a75('0x1a')]=this[_0x1a75('0x15')]['id'];if(this['interaction']['created']){var _0x4c89b7=_0x1ec106[0x2];if(!_[_0x1a75('0x1b')](_0x4c89b7)){_0x271286[_0x1a75('0x1c')]=utils[_0x1a75('0x1d')](_0x4c89b7,this);return rpc[_0x500d60+_0x1a75('0x1e')][_0x1a75('0x1f')](_0x271286)[_0x1a75('0x20')](function(_0x47f384){logger[_0x1a75('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x2af95b,_0x271286['body']);})[_0x1a75('0x22')](function(_0x3928b7){logger['error'](_0x1a75('0xc'),_0x2af95b,JSON['stringify'](_0x3928b7));})[_0x1a75('0x23')](function(){logger[_0x1a75('0x21')](_0x1a75('0x24'),_0x2af95b);_0x692ac0[_0x1a75('0x25')]();});}else{logger[_0x1a75('0x21')](_0x1a75('0x26'),_0x2af95b);_0x692ac0['stop']();}}else{var _0x3ed5e9=this;var _0x4dc595=apiai(_0x1ec106[0x0],{'language':_0x1ec106[0x1]||'en'});return _0x4dc595[_0x1a75('0x27')](this[_0x1a75('0x28')][_0x1a75('0x1c')],{'sessionId':md5(this['interaction']['id'])})[_0x1a75('0x20')](function(_0x5e6617){_0x3ed5e9[_0x1a75('0x1c')][_0x1a75('0x29')]=_0x5e6617;_0x271286[_0x1a75('0x1c')]=_0x5e6617['result'][_0x1a75('0x2a')][_0x1a75('0x2b')];_0x271286['providerName']=_0x1a75('0x29');_0x271286[_0x1a75('0x2c')]=JSON['stringify'](_0x5e6617);return rpc[_0x500d60+_0x1a75('0x1e')][_0x1a75('0x1f')](_0x271286)[_0x1a75('0x20')](function(_0x184d87){logger['info'](_0x1a75('0xc'),_0x2af95b,_0x271286[_0x1a75('0x1c')]);if(_0x5e6617[_0x1a75('0x2d')][_0x1a75('0x2e')][_0x1a75('0x2f')]){_0x692ac0[_0x1a75('0xe')]();}else{_0x692ac0[_0x1a75('0x25')]();}})[_0x1a75('0x22')](function(_0x5518ed){logger['error'](_0x1a75('0xc'),_0x2af95b,JSON[_0x1a75('0x30')](_0x5518ed));_0x692ac0[_0x1a75('0xe')]();});})[_0x1a75('0x22')](function(_0x6f02dc){logger[_0x1a75('0x31')](_0x1a75('0xc'),_0x2af95b,_0x6f02dc[_0x1a75('0x28')]);_0x692ac0['next']();});}}catch(_0x4d6f8d){logger['error'](_0x1a75('0xc'),_0x2af95b,JSON[_0x1a75('0x30')](_0x4d6f8d));_0x692ac0[_0x1a75('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 3a0349d..ee32e7e 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x319c=['message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','next','lodash','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x319c,0x1d9));var _0xc319=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x319c[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xc319('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xc319('0x1'));var moment=require(_0xc319('0x2'));var Promise=require(_0xc319('0x3'));var logger=require('../../../../config/logger')(_0xc319('0x4'));var utils=require(_0xc319('0x5'));var rpc={'chatMessage':require(_0xc319('0x6')),'openchannelMessage':require(_0xc319('0x7')),'mailMessage':require(_0xc319('0x8')),'smsMessage':require(_0xc319('0x9')),'faxMessage':require(_0xc319('0xa')),'whatsappMessage':require(_0xc319('0xb'))};function createMessage(_0x373ad2,_0x1c6ae2,_0x16f155,_0x7a3e50){return new Promise(function(_0x3ea00e,_0x4a71ee){var _0x1b4a57=_[_0xc319('0xc')](_0x16f155);_0x1b4a57[_0xc319('0xd')]=_0x7a3e50;return rpc[_0x1c6ae2+_0xc319('0xe')][_0xc319('0xf')](_0x1b4a57)[_0xc319('0x10')](function(){logger[_0xc319('0x11')](_0xc319('0x12'),_0x373ad2,_0x1b4a57[_0xc319('0xd')]);_0x3ea00e();})[_0xc319('0x13')](function(_0x6f7980){logger[_0xc319('0x14')](_0xc319('0x12'),_0x373ad2,JSON[_0xc319('0x15')](_0x6f7980));_0x4a71ee(_0x6f7980);});});}exports[_0xc319('0x16')]=function(_0x277741,_0x5879dc){return function(_0x1d9439){try{if(!_[_0xc319('0x17')](this[_0xc319('0x18')][_0xc319('0x19')])){logger[_0xc319('0x11')](_0xc319('0x12'),_0x277741,_0xc319('0x1a'));return _0x1d9439['next']();}var _0x4ff6cd={'ContactId':this[_0xc319('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc319('0x1c')};if(this[_0xc319('0x1d')]===_0xc319('0x1e')||this[_0xc319('0x1d')]==='whatsapp'){_0x4ff6cd[_0xc319('0x1f')]=this[_0xc319('0x18')][_0xc319('0x1f')];}var _0x3c0612=this[_0xc319('0x1d')];if(_0x3c0612===_0xc319('0x20')){_0x4ff6cd['ChatWebsiteId']=this[_0xc319('0x21')]['id'];}else{_0x4ff6cd[_[_0xc319('0x22')](_0x3c0612)+_0xc319('0x23')]=this[_0xc319('0x21')]['id'];}_0x4ff6cd[_[_0xc319('0x22')](_0x3c0612)+_0xc319('0x24')]=this[_0xc319('0x18')]['id'];if(this[_0xc319('0x18')][_0xc319('0x25')]){var _0x30d6c8=_0x5879dc[0x4];if(!_[_0xc319('0x26')](_0x30d6c8)){_0x4ff6cd['body']=utils['getMustacheRender'](_0x30d6c8,this);return rpc[_0x3c0612+_0xc319('0xe')][_0xc319('0xf')](_0x4ff6cd)[_0xc319('0x10')](function(_0x35d5d3){logger[_0xc319('0x11')](_0xc319('0x12'),_0x277741,_0x4ff6cd[_0xc319('0xd')]);})[_0xc319('0x13')](function(_0xd97f2d){logger[_0xc319('0x14')](_0xc319('0x12'),_0x277741,JSON['stringify'](_0xd97f2d));})[_0xc319('0x27')](function(){logger['info'](_0xc319('0x28'),_0x277741);_0x1d9439['stop']();});}else{logger[_0xc319('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x277741);_0x1d9439[_0xc319('0x29')]();}}else{var _0x58606a=this;var _0x106fe4=_0x5879dc[0x2][_0xc319('0x2a')](/\\n/g,'\x0a');var _0x5b2500={'credentials':{'private_key':_0x106fe4,'client_email':_0x5879dc[0x1]}};var _0x1dd654=new dialogflow[(_0xc319('0x2b'))](_0x5b2500);var _0x310485=_0x1dd654[_0xc319('0x2c')](_0x5879dc[0x0],md5(_0x58606a['interaction']['id']));var _0x4337d5={'session':_0x310485,'queryInput':{'text':{'text':_0x58606a[_0xc319('0x2d')][_0xc319('0xd')],'languageCode':_0x5879dc[0x3]||'en'}}};return _0x1dd654['detectIntent'](_0x4337d5)[_0xc319('0x10')](function(_0x2b3f60){if(_0x2b3f60&&_0x2b3f60[_0xc319('0x2e')]){_0x58606a[_0xc319('0xd')][_0xc319('0x2f')]=_0x2b3f60;var _0x2cd374=_0x2b3f60[0x0];var _0x3823a8=_0x2cd374[_0xc319('0x30')][_0xc319('0x31')]&&_0x2cd374[_0xc319('0x30')][_0xc319('0x31')]['fields']?_0x2cd374[_0xc319('0x30')][_0xc319('0x31')][_0xc319('0x32')][_0xc319('0x33')][_0xc319('0x34')]:![];_0x58606a['body'][_0xc319('0x35')]=_0x2cd374[_0xc319('0x30')][_0xc319('0x36')];_0x58606a['body'][_0xc319('0x37')]=_0x2cd374[_0xc319('0x30')]['allRequiredParamsPresent'];_0x58606a[_0xc319('0xd')][_0xc319('0x38')]=_0x2cd374[_0xc319('0x30')]['diagnosticInfo']&&_0x2cd374[_0xc319('0x30')][_0xc319('0x31')][_0xc319('0x32')]?_0x2cd374['queryResult'][_0xc319('0x31')][_0xc319('0x32')][_0xc319('0x33')][_0xc319('0x34')]:![];_0x58606a[_0xc319('0xd')][_0xc319('0x39')]=_0x2cd374['queryResult'][_0xc319('0x3a')]['name'];_0x58606a[_0xc319('0xd')][_0xc319('0x3b')]=_0x2cd374['queryResult'][_0xc319('0x3a')][_0xc319('0x3c')];_0x58606a['body'][_0xc319('0x3d')]=_0x2cd374['queryResult'][_0xc319('0x3a')][_0xc319('0x3e')];_0x58606a['body'][_0xc319('0x3f')]=_0x2cd374[_0xc319('0x30')][_0xc319('0x40')];_0x58606a['body'][_0xc319('0x41')]=_0x2cd374[_0xc319('0x30')][_0xc319('0x42')];_0x58606a[_0xc319('0xd')][_0xc319('0x43')]=_0x2cd374['queryResult'][_0xc319('0x44')];_0x4ff6cd[_0xc319('0x45')]='dialogflowV2';_0x4ff6cd[_0xc319('0x46')]=JSON['stringify'](_0x2b3f60);var _0xbd25bb=[];for(var _0x3d4726=0x0;_0x3d4726<_0x2b3f60[_0xc319('0x2e')];_0x3d4726++){var _0x3a13b7=_0x2b3f60[_0x3d4726];if(_0x3a13b7&&_0x3a13b7['queryResult']&&_0x3a13b7[_0xc319('0x30')]['fulfillmentText']){_0xbd25bb['push'](createMessage(_0x277741,_0x3c0612,_0x4ff6cd,_0x3a13b7['queryResult'][_0xc319('0x47')]));}}return Promise[_0xc319('0x48')](_0xbd25bb)['then'](function(){if(_0x3823a8){_0x1d9439[_0xc319('0x49')]();}else{_0x1d9439[_0xc319('0x29')]();}})[_0xc319('0x13')](function(_0xa60707){logger[_0xc319('0x14')](_0xc319('0x12'),_0x277741,JSON[_0xc319('0x15')](_0xa60707));_0x1d9439[_0xc319('0x49')]();});}})[_0xc319('0x13')](function(_0x2f490b){logger['error'](_0xc319('0x12'),_0x277741,_0x2f490b[_0xc319('0x2d')]);_0x1d9439[_0xc319('0x49')]();});}}catch(_0x1808b8){logger[_0xc319('0x14')](_0xc319('0x12'),_0x277741,JSON[_0xc319('0x15')](_0x1808b8));_0x1d9439['stop']();}};}; \ No newline at end of file +var _0xeebc=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','fields','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','all','next','lodash','dialogflow','md5','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0xfd084b,_0x26977e){var _0x375d60=function(_0xfec175){while(--_0xfec175){_0xfd084b['push'](_0xfd084b['shift']());}};_0x375d60(++_0x26977e);}(_0xeebc,0x6f));var _0xceeb=function(_0x43f3ee,_0x4b3678){_0x43f3ee=_0x43f3ee-0x0;var _0x18c1fd=_0xeebc[_0x43f3ee];return _0x18c1fd;};'use strict';var _=require(_0xceeb('0x0'));var dialogflow=require(_0xceeb('0x1'));var md5=require(_0xceeb('0x2'));var moment=require(_0xceeb('0x3'));var Promise=require('bluebird');var logger=require(_0xceeb('0x4'))(_0xceeb('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xceeb('0x6')),'openchannelMessage':require(_0xceeb('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xceeb('0x8')),'faxMessage':require(_0xceeb('0x9')),'whatsappMessage':require(_0xceeb('0xa'))};function createMessage(_0x5c1c88,_0x49ac08,_0x23bfac,_0x5a4908){return new Promise(function(_0x364eb5,_0x56624b){var _0x2996f7=_[_0xceeb('0xb')](_0x23bfac);_0x2996f7[_0xceeb('0xc')]=_0x5a4908;return rpc[_0x49ac08+_0xceeb('0xd')][_0xceeb('0xe')](_0x2996f7)['then'](function(){logger[_0xceeb('0xf')](_0xceeb('0x10'),_0x5c1c88,_0x2996f7[_0xceeb('0xc')]);_0x364eb5();})[_0xceeb('0x11')](function(_0x2b9cb4){logger[_0xceeb('0x12')](_0xceeb('0x10'),_0x5c1c88,JSON[_0xceeb('0x13')](_0x2b9cb4));_0x56624b(_0x2b9cb4);});});}exports['consequence']=function(_0x4e9edf,_0x3f6797){return function(_0x49fb66){try{if(!_['isNil'](this[_0xceeb('0x14')][_0xceeb('0x15')])){logger[_0xceeb('0xf')](_0xceeb('0x10'),_0x4e9edf,_0xceeb('0x16'));return _0x49fb66['next']();}var _0x41b8f4={'ContactId':this[_0xceeb('0x17')]['id'],'sentAt':moment()[_0xceeb('0x18')](_0xceeb('0x19')),'direction':_0xceeb('0x1a')};if(this[_0xceeb('0x1b')]==='sms'||this['channel']==='whatsapp'){_0x41b8f4[_0xceeb('0x1c')]=this['interaction'][_0xceeb('0x1c')];}var _0x35c414=this[_0xceeb('0x1b')];if(_0x35c414===_0xceeb('0x1d')){_0x41b8f4[_0xceeb('0x1e')]=this[_0xceeb('0x1f')]['id'];}else{_0x41b8f4[_[_0xceeb('0x20')](_0x35c414)+_0xceeb('0x21')]=this[_0xceeb('0x1f')]['id'];}_0x41b8f4[_[_0xceeb('0x20')](_0x35c414)+_0xceeb('0x22')]=this[_0xceeb('0x14')]['id'];if(this[_0xceeb('0x14')]['created']){var _0x5de570=_0x3f6797[0x4];if(!_['isEmpty'](_0x5de570)){_0x41b8f4[_0xceeb('0xc')]=utils[_0xceeb('0x23')](_0x5de570,this);return rpc[_0x35c414+'Message'][_0xceeb('0xe')](_0x41b8f4)[_0xceeb('0x24')](function(_0x3902a4){logger[_0xceeb('0xf')](_0xceeb('0x10'),_0x4e9edf,_0x41b8f4[_0xceeb('0xc')]);})['catch'](function(_0x13dae9){logger[_0xceeb('0x12')](_0xceeb('0x10'),_0x4e9edf,JSON['stringify'](_0x13dae9));})[_0xceeb('0x25')](function(){logger['info'](_0xceeb('0x26'),_0x4e9edf);_0x49fb66['stop']();});}else{logger[_0xceeb('0xf')](_0xceeb('0x27'),_0x4e9edf);_0x49fb66[_0xceeb('0x28')]();}}else{var _0x6492b0=this;var _0x49a641=_0x3f6797[0x2][_0xceeb('0x29')](/\\n/g,'\x0a');var _0x3f87be={'credentials':{'private_key':_0x49a641,'client_email':_0x3f6797[0x1]}};var _0x12690c=new dialogflow[(_0xceeb('0x2a'))](_0x3f87be);var _0x20d886=_0x12690c[_0xceeb('0x2b')](_0x3f6797[0x0],md5(_0x6492b0[_0xceeb('0x14')]['id']));var _0x920b08={'session':_0x20d886,'queryInput':{'text':{'text':_0x6492b0[_0xceeb('0x2c')][_0xceeb('0xc')],'languageCode':_0x3f6797[0x3]||'en'}}};return _0x12690c[_0xceeb('0x2d')](_0x920b08)[_0xceeb('0x24')](function(_0x3cacb2){if(_0x3cacb2&&_0x3cacb2[_0xceeb('0x2e')]){_0x6492b0['body']['dialogflowV2']=_0x3cacb2;var _0x2c051e=_0x3cacb2[0x0];var _0x5124b8=_0x2c051e[_0xceeb('0x2f')]['diagnosticInfo']&&_0x2c051e[_0xceeb('0x2f')]['diagnosticInfo'][_0xceeb('0x30')]?_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x31')]['fields'][_0xceeb('0x32')][_0xceeb('0x33')]:![];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x34')]=_0x2c051e[_0xceeb('0x2f')]['action'];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x35')]=_0x2c051e['queryResult'][_0xceeb('0x36')];_0x6492b0['body'][_0xceeb('0x37')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x31')]&&_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x31')][_0xceeb('0x30')]?_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x31')][_0xceeb('0x30')]['end_conversation']['boolValue']:![];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x38')]=_0x2c051e[_0xceeb('0x2f')]['intent'][_0xceeb('0x39')];_0x6492b0['body'][_0xceeb('0x3a')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x3b')][_0xceeb('0x3c')];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x3d')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x3b')][_0xceeb('0x3e')];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x3f')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x40')];_0x6492b0['body'][_0xceeb('0x41')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x42')];_0x6492b0[_0xceeb('0xc')][_0xceeb('0x43')]=_0x2c051e[_0xceeb('0x2f')][_0xceeb('0x44')];_0x41b8f4[_0xceeb('0x45')]=_0xceeb('0x46');_0x41b8f4['providerResponse']=JSON[_0xceeb('0x13')](_0x3cacb2);var _0x378ce1=[];for(var _0x5bb864=0x0;_0x5bb864<_0x3cacb2[_0xceeb('0x2e')];_0x5bb864++){var _0x569d5a=_0x3cacb2[_0x5bb864];if(_0x569d5a&&_0x569d5a[_0xceeb('0x2f')]&&_0x569d5a['queryResult'][_0xceeb('0x47')]){_0x378ce1[_0xceeb('0x48')](createMessage(_0x4e9edf,_0x35c414,_0x41b8f4,_0x569d5a['queryResult']['fulfillmentText']));}}return Promise[_0xceeb('0x49')](_0x378ce1)['then'](function(){if(_0x5124b8){_0x49fb66[_0xceeb('0x4a')]();}else{_0x49fb66[_0xceeb('0x28')]();}})[_0xceeb('0x11')](function(_0x423ab2){logger[_0xceeb('0x12')](_0xceeb('0x10'),_0x4e9edf,JSON[_0xceeb('0x13')](_0x423ab2));_0x49fb66[_0xceeb('0x4a')]();});}})[_0xceeb('0x11')](function(_0x1a4273){logger['error'](_0xceeb('0x10'),_0x4e9edf,_0x1a4273[_0xceeb('0x2c')]);_0x49fb66[_0xceeb('0x4a')]();});}}catch(_0x2e1f3e){logger[_0xceeb('0x12')](_0xceeb('0x10'),_0x4e9edf,JSON[_0xceeb('0x13')](_0x2e1f3e));_0x49fb66[_0xceeb('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index c6ad5f3..8e7adab 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a0b=['getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString'];(function(_0x4adb2b,_0x1b139d){var _0x1dcef6=function(_0x5abe66){while(--_0x5abe66){_0x4adb2b['push'](_0x4adb2b['shift']());}};_0x1dcef6(++_0x1b139d);}(_0x2a0b,0xdf));var _0xb2a0=function(_0x99392d,_0x47ec58){_0x99392d=_0x99392d-0x0;var _0x1f4274=_0x2a0b[_0x99392d];return _0x1f4274;};'use strict';var schema=require('validate');var _=require(_0xb2a0('0x0'));var htmlToText=require(_0xb2a0('0x1'));var utils=require(_0xb2a0('0x2'));var logger=require(_0xb2a0('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xb2a0('0x4'),'required':!![],'message':_0xb2a0('0x5')},'priorityTrue':{'type':_0xb2a0('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xb2a0('0x7')]=function(_0x69e88b,_0x45c5ce){return function(_0x53c084){try{var _0x158687={'condition':htmlToText[_0xb2a0('0x8')](utils[_0xb2a0('0x9')](_0x45c5ce[0x0],this),{'wordwrap':![]})[_0xb2a0('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x45c5ce[0x1],'priorityFalse':_0x45c5ce[0x2]};var _0x1b69a8=gotoif[_0xb2a0('0xb')](_0x158687,{'typecast':!![]});if(_0x1b69a8[_0xb2a0('0xc')]){logger[_0xb2a0('0xd')](_0xb2a0('0xe'),_0x69e88b,_[_0xb2a0('0xf')](_0x1b69a8,_0xb2a0('0x10'))[_0xb2a0('0x11')](',\x20'));_0x53c084[_0xb2a0('0x12')]();}else{try{var _0x5a3a76=eval('('+_0x158687[_0xb2a0('0x13')]+')');var _0x4b6ce9=_0x5a3a76?_0x158687[_0xb2a0('0x14')]:_0x158687[_0xb2a0('0x15')];logger[_0xb2a0('0x16')](_0xb2a0('0x17'),_0x69e88b,_0x158687[_0xb2a0('0x13')],_0x5a3a76,_0x4b6ce9||_0xb2a0('0x18'));if(_0x4b6ce9){var _0x32bcb6=_['findIndex'](_0x53c084[_0xb2a0('0x19')](),{'p':_0x4b6ce9});if(_0x32bcb6>=0x0){logger[_0xb2a0('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x69e88b,_0x4b6ce9||'next',_0x32bcb6);_0x53c084['next'](_0x32bcb6);}else{logger[_0xb2a0('0x16')](_0xb2a0('0x1a'),_0x69e88b,_0x4b6ce9||_0xb2a0('0x18'));_0x53c084['stop']();}}else{_0x53c084[_0xb2a0('0x18')]();}}catch(_0x2327ee){logger['error'](_0xb2a0('0x1b'),_0x69e88b,_0x2327ee[_0xb2a0('0x10')]);_0x53c084['stop']();}}}catch(_0x169f48){logger[_0xb2a0('0xd')](_0xb2a0('0xe'),_0x69e88b,JSON[_0xb2a0('0x1c')](_0x169f48));_0x53c084[_0xb2a0('0x12')]();}};}; \ No newline at end of file +var _0xd12a=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','error','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger'];(function(_0x1e477c,_0x56633b){var _0x5217e8=function(_0x20481c){while(--_0x20481c){_0x1e477c['push'](_0x1e477c['shift']());}};_0x5217e8(++_0x56633b);}(_0xd12a,0xe6));var _0xad12=function(_0x5c0c77,_0x506e0f){_0x5c0c77=_0x5c0c77-0x0;var _0x3e7ef5=_0xd12a[_0x5c0c77];return _0x3e7ef5;};'use strict';var schema=require('validate');var _=require(_0xad12('0x0'));var htmlToText=require(_0xad12('0x1'));var utils=require(_0xad12('0x2'));var logger=require(_0xad12('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xad12('0x4')},'priorityTrue':{'type':_0xad12('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0xad12('0x6')}});exports[_0xad12('0x7')]=function(_0x28cb7e,_0x439070){return function(_0x1ce392){try{var _0x59d5ee={'condition':htmlToText[_0xad12('0x8')](utils['getMustacheRender'](_0x439070[0x0],this),{'wordwrap':![]})[_0xad12('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x439070[0x1],'priorityFalse':_0x439070[0x2]};var _0x3db1b3=gotoif[_0xad12('0xa')](_0x59d5ee,{'typecast':!![]});if(_0x3db1b3['length']){logger[_0xad12('0xb')]('[%s][GOTOIF]\x20%s',_0x28cb7e,_[_0xad12('0xc')](_0x3db1b3,_0xad12('0xd'))[_0xad12('0xe')](',\x20'));_0x1ce392['stop']();}else{try{var _0x3e2af7=eval('('+_0x59d5ee['condition']+')');var _0x147955=_0x3e2af7?_0x59d5ee[_0xad12('0xf')]:_0x59d5ee[_0xad12('0x10')];logger[_0xad12('0x11')](_0xad12('0x12'),_0x28cb7e,_0x59d5ee[_0xad12('0x13')],_0x3e2af7,_0x147955||_0xad12('0x14'));if(_0x147955){var _0x3f202b=_['findIndex'](_0x1ce392['rules'](),{'p':_0x147955});if(_0x3f202b>=0x0){logger['info'](_0xad12('0x15'),_0x28cb7e,_0x147955||_0xad12('0x14'),_0x3f202b);_0x1ce392[_0xad12('0x14')](_0x3f202b);}else{logger[_0xad12('0x11')](_0xad12('0x16'),_0x28cb7e,_0x147955||_0xad12('0x14'));_0x1ce392[_0xad12('0x17')]();}}else{_0x1ce392[_0xad12('0x14')]();}}catch(_0x213692){logger[_0xad12('0xb')](_0xad12('0x18'),_0x28cb7e,_0x213692[_0xad12('0xd')]);_0x1ce392[_0xad12('0x17')]();}}}catch(_0x3a50d3){logger[_0xad12('0xb')]('[%s][GOTOIF]\x20%s',_0x28cb7e,JSON[_0xad12('0x19')](_0x3a50d3));_0x1ce392[_0xad12('0x17')]();}};}; \ 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 3154192..74455a9 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 _0xfc60=['map','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','number','length'];(function(_0x515cff,_0x4fb356){var _0x128bf4=function(_0x2805c1){while(--_0x2805c1){_0x515cff['push'](_0x515cff['shift']());}};_0x128bf4(++_0x4fb356);}(_0xfc60,0x1c6));var _0x0fc6=function(_0x3689df,_0x444b02){_0x3689df=_0x3689df-0x0;var _0x13f667=_0xfc60[_0x3689df];return _0x13f667;};'use strict';var schema=require(_0x0fc6('0x0'));var _=require(_0x0fc6('0x1'));var logger=require(_0x0fc6('0x2'))('routing');var gotop=schema({'priority':{'type':_0x0fc6('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1a2a60,_0x3ac10b){return function(_0x389eb9){try{var _0x4d022c={'priority':_0x3ac10b[0x0]};var _0x296b70=gotop[_0x0fc6('0x0')](_0x4d022c,{'typecast':!![]});if(_0x296b70[_0x0fc6('0x4')]){logger['error']('[%s][GOTOP]\x20%s',_0x1a2a60,_[_0x0fc6('0x5')](_0x296b70,'message')[_0x0fc6('0x6')](',\x20'));_0x389eb9[_0x0fc6('0x7')]();}else{logger[_0x0fc6('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x1a2a60,_0x4d022c[_0x0fc6('0x9')]);if(_0x4d022c[_0x0fc6('0x9')]){var _0x1868d8=_[_0x0fc6('0xa')](_0x389eb9['rules'](),{'p':_0x4d022c[_0x0fc6('0x9')]});if(_0x1868d8>=0x0){logger['info'](_0x0fc6('0xb'),_0x1a2a60,_0x4d022c[_0x0fc6('0x9')]||'next',_0x1868d8);_0x389eb9[_0x0fc6('0xc')](_0x1868d8);}else{logger[_0x0fc6('0x8')](_0x0fc6('0xd'),_0x1a2a60,_0x4d022c[_0x0fc6('0x9')]||_0x0fc6('0xc'));_0x389eb9[_0x0fc6('0x7')]();}}else{_0x389eb9[_0x0fc6('0xc')]();}}}catch(_0x1c894e){logger[_0x0fc6('0xe')](_0x0fc6('0xf'),_0x1a2a60,JSON[_0x0fc6('0x10')](_0x1c894e));_0x389eb9[_0x0fc6('0x7')]();}};}; \ No newline at end of file +var _0xa143=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger'];(function(_0x2324fb,_0x246bd1){var _0x423796=function(_0x59efb3){while(--_0x59efb3){_0x2324fb['push'](_0x2324fb['shift']());}};_0x423796(++_0x246bd1);}(_0xa143,0x11d));var _0x3a14=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa143[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x3a14('0x0'));var _=require(_0x3a14('0x1'));var logger=require(_0x3a14('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3a14('0x3')}});exports['consequence']=function(_0x18b2c3,_0x37bd89){return function(_0xf03fc1){try{var _0x41be14={'priority':_0x37bd89[0x0]};var _0x13f611=gotop[_0x3a14('0x0')](_0x41be14,{'typecast':!![]});if(_0x13f611[_0x3a14('0x4')]){logger[_0x3a14('0x5')](_0x3a14('0x6'),_0x18b2c3,_[_0x3a14('0x7')](_0x13f611,_0x3a14('0x8'))[_0x3a14('0x9')](',\x20'));_0xf03fc1[_0x3a14('0xa')]();}else{logger[_0x3a14('0xb')](_0x3a14('0xc'),_0x18b2c3,_0x41be14[_0x3a14('0xd')]);if(_0x41be14['priority']){var _0x21ea48=_[_0x3a14('0xe')](_0xf03fc1[_0x3a14('0xf')](),{'p':_0x41be14['priority']});if(_0x21ea48>=0x0){logger['info'](_0x3a14('0x10'),_0x18b2c3,_0x41be14['priority']||_0x3a14('0x11'),_0x21ea48);_0xf03fc1['next'](_0x21ea48);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x18b2c3,_0x41be14[_0x3a14('0xd')]||_0x3a14('0x11'));_0xf03fc1[_0x3a14('0xa')]();}}else{_0xf03fc1['next']();}}}catch(_0x2f6cdd){logger[_0x3a14('0x5')](_0x3a14('0x6'),_0x18b2c3,JSON['stringify'](_0x2f6cdd));_0xf03fc1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c1ab1a1..0e7592d 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 _0xe0c0=['interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','account','upperFirst','InteractionId'];(function(_0x17cb36,_0x3cfc3e){var _0x3ae236=function(_0x47530f){while(--_0x47530f){_0x17cb36['push'](_0x17cb36['shift']());}};_0x3ae236(++_0x3cfc3e);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x1d34bf,_0x11b47d){_0x1d34bf=_0x1d34bf-0x0;var _0x531b77=_0xe0c0[_0x1d34bf];return _0x531b77;};'use strict';var _=require(_0x0e0c('0x0'));var utils=require('./utils');var logger=require(_0x0e0c('0x1'))(_0x0e0c('0x2'));var rpc={'chatMessage':require(_0x0e0c('0x3')),'openchannelMessage':require(_0x0e0c('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0e0c('0x5')),'faxMessage':require(_0x0e0c('0x6')),'whatsappMessage':require(_0x0e0c('0x7'))};exports['consequence']=function(_0x4271d1,_0x2856d7){return function(_0x4a094c){try{var _0x14e5de={'body':utils[_0x0e0c('0x8')](_0x2856d7[0x0],this),'ContactId':this[_0x0e0c('0x9')]['id']};if(this[_0x0e0c('0xa')]===_0x0e0c('0xb')){_0x14e5de['ChatWebsiteId']=this['account']['id'];}else{_0x14e5de[_['upperFirst'](this[_0x0e0c('0xa')])+'AccountId']=this[_0x0e0c('0xc')]['id'];}_0x14e5de[_[_0x0e0c('0xd')](this[_0x0e0c('0xa')])+_0x0e0c('0xe')]=this[_0x0e0c('0xf')]['id'];if(rpc[this[_0x0e0c('0xa')]+_0x0e0c('0x10')]){return rpc[this[_0x0e0c('0xa')]+'Message'][_0x0e0c('0x11')](_0x14e5de)['then'](function(_0x5794fa){logger[_0x0e0c('0x12')](_0x0e0c('0x13'),_0x4271d1,_0x14e5de[_0x0e0c('0x14')]);_0x4a094c[_0x0e0c('0x15')]();})[_0x0e0c('0x16')](function(_0x19f315){logger['error'](_0x0e0c('0x13'),_0x4271d1,JSON[_0x0e0c('0x17')](_0x19f315));_0x4a094c[_0x0e0c('0x18')]();});}}catch(_0x4ebe33){logger[_0x0e0c('0x19')](_0x0e0c('0x13'),_0x4271d1,JSON[_0x0e0c('0x17')](_0x4ebe33));_0x4a094c[_0x0e0c('0x18')]();}};}; \ No newline at end of file +var _0xa49b=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','account','upperFirst','AccountId','InteractionId','Message','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x269967,_0x295ffe){var _0x1eaf4d=function(_0x12009a){while(--_0x12009a){_0x269967['push'](_0x269967['shift']());}};_0x1eaf4d(++_0x295ffe);}(_0xa49b,0x126));var _0xba49=function(_0x529ac4,_0x51bc05){_0x529ac4=_0x529ac4-0x0;var _0x4e0a30=_0xa49b[_0x529ac4];return _0x4e0a30;};'use strict';var _=require('lodash');var utils=require(_0xba49('0x0'));var logger=require(_0xba49('0x1'))(_0xba49('0x2'));var rpc={'chatMessage':require(_0xba49('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xba49('0x4')),'smsMessage':require(_0xba49('0x5')),'faxMessage':require(_0xba49('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xba49('0x7')]=function(_0x17710a,_0x3315bc){return function(_0x525dfd){try{var _0xd5d20d={'body':utils['getMustacheRender'](_0x3315bc[0x0],this),'ContactId':this[_0xba49('0x8')]['id']};if(this[_0xba49('0x9')]===_0xba49('0xa')){_0xd5d20d['ChatWebsiteId']=this[_0xba49('0xb')]['id'];}else{_0xd5d20d[_[_0xba49('0xc')](this[_0xba49('0x9')])+_0xba49('0xd')]=this['account']['id'];}_0xd5d20d[_[_0xba49('0xc')](this[_0xba49('0x9')])+_0xba49('0xe')]=this['interaction']['id'];if(rpc[this['channel']+_0xba49('0xf')]){return rpc[this['channel']+'Message']['create'](_0xd5d20d)[_0xba49('0x10')](function(_0x498a91){logger['info'](_0xba49('0x11'),_0x17710a,_0xd5d20d[_0xba49('0x12')]);_0x525dfd[_0xba49('0x13')]();})[_0xba49('0x14')](function(_0x5cc5b2){logger[_0xba49('0x15')](_0xba49('0x11'),_0x17710a,JSON['stringify'](_0x5cc5b2));_0x525dfd['stop']();});}}catch(_0xc1053a){logger[_0xba49('0x15')](_0xba49('0x11'),_0x17710a,JSON[_0xba49('0x16')](_0xc1053a));_0x525dfd['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 596e0cc..83b30e5 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 _0x2dd9=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','consequence'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x2dd9,0x177));var _0x92dd=function(_0x3ba8d4,_0x59cce0){_0x3ba8d4=_0x3ba8d4-0x0;var _0xb23f68=_0x2dd9[_0x3ba8d4];return _0xb23f68;};'use strict';var utils=require(_0x92dd('0x0'));var logger=require(_0x92dd('0x1'))('routing');exports[_0x92dd('0x2')]=function(_0x37e9a3,_0x254984){return function(_0x56dc83){try{logger['info'](_0x92dd('0x3'),_0x37e9a3,utils[_0x92dd('0x4')](_0x254984[0x0],this));_0x56dc83[_0x92dd('0x5')]();}catch(_0x2e8768){logger[_0x92dd('0x6')](_0x92dd('0x3'),_0x37e9a3,JSON[_0x92dd('0x7')](_0x2e8768));_0x56dc83[_0x92dd('0x8')]();}};}; \ No newline at end of file +var _0xca3e=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','error','stringify','stop'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0xca3e,0x13b));var _0xeca3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xca3e[_0x167cc1];return _0x10bc4b;};'use strict';var utils=require('./utils');var logger=require(_0xeca3('0x0'))(_0xeca3('0x1'));exports['consequence']=function(_0x26db0e,_0x2bde96){return function(_0x27c5ef){try{logger[_0xeca3('0x2')](_0xeca3('0x3'),_0x26db0e,utils['getMustacheRender'](_0x2bde96[0x0],this));_0x27c5ef['next']();}catch(_0x1277e3){logger[_0xeca3('0x4')](_0xeca3('0x3'),_0x26db0e,JSON[_0xeca3('0x5')](_0x1277e3));_0x27c5ef[_0xeca3('0x6')]();}};}; \ 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 3307077..303411d 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 _0x953a=['update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','localhost','socket.io-emitter','redis','queue_id','account','from','joinAt','emit','clone','queue','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x953a,0x72));var _0xa953=function(_0x11d245,_0x20e739){_0x11d245=_0x11d245-0x0;var _0x2a5569=_0x953a[_0x11d245];return _0x2a5569;};'use strict';var schema=require(_0xa953('0x0'));var _=require(_0xa953('0x1'));var util=require(_0xa953('0x2'));var seqqueue=require(_0xa953('0x3'));var moment=require(_0xa953('0x4'));var Redis=require(_0xa953('0x5'));var config=require(_0xa953('0x6'));var logger=require(_0xa953('0x7'))(_0xa953('0x8'));var strategy=require(_0xa953('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xa953('0xa'),'port':0x18eb});var io=require(_0xa953('0xb'))(new Redis(config[_0xa953('0xc')]));var attributes=['id',_0xa953('0xd'),_0xa953('0xe'),'queue',_0xa953('0xf'),_0xa953('0x10')];function emit(_0x2b4401,_0x9ba3dc,_0xbfb27d){io['to'](_0x2b4401)[_0xa953('0x11')](_0x9ba3dc,_0xbfb27d);}function emitChannelQueueInteraction(_0x1b6026,_0x3d6b67,_0xb1fd4b,_0x262fb2,_0x28418e,_0x497fa2,_0x5031a4,_0x8d25e){var _0x3d350e=_[_0xa953('0x12')](_0xb1fd4b);_0x3d350e[_0xa953('0xd')]=_0x8d25e;_0x3d350e[_0xa953('0x13')]=_0x3d6b67;_0x3d350e[_0xa953('0xe')]=_0x262fb2;_0x3d350e['id']=_0x28418e;if(_0x497fa2){_0x5031a4[util['format']('%sQueuesWaitingInteractions',_0x1b6026)][_0x28418e]=_[_0xa953('0x14')](_0x3d350e,attributes);}else{delete _0x5031a4[util[_0xa953('0x15')](_0xa953('0x16'),_0x1b6026)][_0x28418e];}emit(util['format'](_0xa953('0x17'),_0x1b6026,_0x3d6b67),util[_0xa953('0x15')](_0xa953('0x18'),_0x1b6026,_0x497fa2?_0xa953('0x19'):_0xa953('0x1a')),_[_0xa953('0x14')](_0x3d350e,attributes));}var rpc={'openchannelQueueReport':require(_0xa953('0x1b')),'mailQueueReport':require(_0xa953('0x1c')),'chatQueueReport':require(_0xa953('0x1d')),'smsQueueReport':require(_0xa953('0x1e')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa953('0x1f'))};var queue=schema({'name':{'type':_0xa953('0x20'),'required':!![],'message':_0xa953('0x21')},'timeout':{'type':_0xa953('0x22'),'message':_0xa953('0x23')}});function startRouting(_0x5c32f1,_0x1d44bd,_0x54680d,_0x18ac83){if(_0x5c32f1&&_0x1d44bd&&_0x54680d){_0x1d44bd[_0xa953('0x24')]+=0x1;var _0x371c09={'uniqueid':_0x5c32f1,'from':_0x54680d['body']?_0x54680d['body'][_0xa953('0xf')]:'','joinAt':moment()[_0xa953('0x15')](_0xa953('0x25')),'ContactId':_0x54680d[_0xa953('0x26')]?_0x54680d[_0xa953('0x26')]['id']:null,'ListId':_0x54680d['list']?_0x54680d['list']['id']:null};_0x371c09[_[_0xa953('0x27')](_0x54680d[_0xa953('0x28')])+_0xa953('0x29')]=_0x1d44bd['id']||null;_0x371c09[_[_0xa953('0x27')](_0x54680d[_0xa953('0x28')])+_0xa953('0x2a')]=_0x54680d[_0xa953('0x2b')]?_0x54680d['interaction']['id']:null;_0x371c09[_['upperFirst'](_0x54680d['channel'])+'MessageId']=_0x54680d[_0xa953('0x2c')]?_0x54680d[_0xa953('0x2c')]['id']:null;_0x371c09[_[_0xa953('0x27')](_0x54680d[_0xa953('0x28')])+(_0x54680d[_0xa953('0x28')]!==_0xa953('0x2d')?'AccountId':_0xa953('0x2e'))]=_0x54680d[_0xa953('0xe')]?_0x54680d[_0xa953('0xe')]['id']:null;logger[_0xa953('0x2f')](util[_0xa953('0x15')](_0xa953('0x30'),_0x5c32f1,_0x1d44bd[_0xa953('0x31')]));emitChannelQueueInteraction(_0x54680d['channel'],_0x1d44bd['name'],_0x371c09,_0x54680d['account'][_0xa953('0x31')],_0x54680d[_0xa953('0x2c')]['id'],!![],_0x18ac83,_0x1d44bd['id']);if(rpc[_0x54680d[_0xa953('0x28')]+_0xa953('0x32')]){return rpc[_0x54680d['channel']+_0xa953('0x32')][_0xa953('0x33')](_0x371c09)[_0xa953('0x34')](function(_0x2712a6){logger[_0xa953('0x35')](_0xa953('0x36'));});}}}function stopRouting(_0x1895fe,_0x4000ae,_0x21c4fb,_0x14d99c){if(_0x1895fe&&_0x4000ae){_0x4000ae[_0xa953('0x24')]-=0x1;var _0x457df0={'leaveAt':moment()['format'](_0xa953('0x25')),'acceptAt':moment()[_0xa953('0x15')](_0xa953('0x25')),'reason':_0xa953('0x37')};logger['info'](util['format'](_0xa953('0x38'),_0x1895fe,_0x4000ae[_0xa953('0x31')]));emitChannelQueueInteraction(_0x21c4fb['channel'],_0x4000ae[_0xa953('0x31')],_0x21c4fb[_0xa953('0x39')],_0x21c4fb[_0xa953('0xe')][_0xa953('0x31')],_0x21c4fb['message']['id'],![],_0x14d99c,_0x4000ae['id']);if(rpc[_0x21c4fb[_0xa953('0x28')]+_0xa953('0x32')]){return rpc[_0x21c4fb[_0xa953('0x28')]+_0xa953('0x32')][_0xa953('0x3a')](_0x1895fe,_0x457df0)[_0xa953('0x34')](function(_0x467e0a){logger[_0xa953('0x35')](_0xa953('0x3b'));});}}}function endRouting(_0x3dcf74,_0x367ef6,_0x387836,_0x2411f1){if(_0x3dcf74&&_0x367ef6){_0x367ef6['waiting']-=0x1;var _0x4a9923={'leaveAt':moment()[_0xa953('0x15')](_0xa953('0x25')),'exitAt':moment()[_0xa953('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa953('0x3c')};logger[_0xa953('0x2f')](util[_0xa953('0x15')](_0xa953('0x3d'),_0x3dcf74,_0x367ef6[_0xa953('0x31')]));emitChannelQueueInteraction(_0x387836[_0xa953('0x28')],_0x367ef6[_0xa953('0x31')],_0x387836[_0xa953('0x39')],_0x387836[_0xa953('0xe')]['name'],_0x387836[_0xa953('0x2c')]['id'],![],_0x2411f1);if(rpc[_0x387836[_0xa953('0x28')]+_0xa953('0x32')]){return rpc[_0x387836[_0xa953('0x28')]+'QueueReport'][_0xa953('0x3a')](_0x3dcf74,_0x4a9923)[_0xa953('0x34')](function(_0x5b0cc6){logger[_0xa953('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x553101){return function(_0x105192){return _0x105192['name']['toLowerCase']()===_0x553101[_0xa953('0x3e')]();};}exports[_0xa953('0x3f')]=function(_0x5a9aab,_0x1abb87,_0x2422ee,_0x20d919){return function(_0x453ddc){try{var _0x124a4a={'name':_0x1abb87[0x0],'timeout':_0x1abb87[0x1]};var _0x1004c3=queue[_0xa953('0x0')](_0x124a4a,{'typecast':!![]});if(_0x1004c3[_0xa953('0x40')]){logger['error'](_0xa953('0x41'),_0x5a9aab,_[_0xa953('0x42')](_0x1004c3,'message')['join'](',\x20'));_0x453ddc[_0xa953('0x43')]();}else{var _0x2e187a=_[_0xa953('0x44')](_0x2422ee[_0x20d919[_0xa953('0x28')]+_0xa953('0x45')],handleFindQueue(_0x124a4a[_0xa953('0x31')]));if(_0x2e187a){startRouting(_0x5a9aab,_0x2e187a,_0x20d919,_0x2422ee);var _0x58a6cf=(_0x2e187a['timeout']||0xa)*0x3e8;var _0x4e3c63=(_0x124a4a[_0xa953('0x3c')]||0x14)*0x3e8;var _0x3ce1e7,_0x329f4e;if(_0x58a6cf>_0x4e3c63){_0x4e3c63=_0x58a6cf;}var _0x53788d=seqqueue[_0xa953('0x46')](_0x58a6cf);_0x53788d['id']=_0x5a9aab;_0x53788d[_0xa953('0x47')]=_0x58a6cf;_0x53788d[_0xa953('0x48')]=_0x4e3c63;_0x53788d[_0xa953('0x28')]=_0x20d919[_0xa953('0x28')];_0x2422ee[_0xa953('0x49')][_0x5a9aab]['on'](_0xa953('0x4a'),function(){logger[_0xa953('0x2f')](_0xa953('0x4b'),_0x5a9aab);stopRouting(_0x5a9aab,_0x2e187a,_0x20d919,_0x2422ee);clearTimeout(_0x3ce1e7);_0x3ce1e7=undefined;_0x53788d[_0xa953('0x4c')](!![]);if(_0x2422ee[_0xa953('0x49')][_0x5a9aab]){delete _0x2422ee[_0xa953('0x49')][_0x5a9aab];}_0x453ddc[_0xa953('0x43')]();});_0x2422ee[_0xa953('0x49')][_0x5a9aab]['on'](_0xa953('0x4d'),function(){if(_0x2422ee['rules'][_0x5a9aab]){delete _0x2422ee[_0xa953('0x49')][_0x5a9aab];}});_0x3ce1e7=setTimeout(function(){logger['info'](_0xa953('0x4e'),_0x5a9aab);endRouting(_0x5a9aab,_0x2e187a,_0x20d919,_0x2422ee);clearTimeout(_0x3ce1e7);_0x53788d['close'](!![]);_0x453ddc[_0xa953('0x4f')]();},_0x4e3c63);switch(_0x2e187a[_0xa953('0x50')]){case _0xa953('0x51'):strategy[_0xa953('0x51')](_0x53788d,_0x2e187a,_0x2422ee,_0x20d919);break;default:strategy[_0xa953('0x52')](_0x53788d,_0x2e187a,_0x2422ee,_0x20d919);}}else{logger[_0xa953('0x35')](_0xa953('0x53'),_0x5a9aab,_0x124a4a[_0xa953('0x31')]);_0x453ddc['stop']();}}}catch(_0x1919a8){console[_0xa953('0x54')](_0x1919a8);logger[_0xa953('0x35')](_0xa953('0x41'),_0x5a9aab,_0x1919a8[_0xa953('0x55')]);_0x453ddc[_0xa953('0x43')]();}};}; \ No newline at end of file +var _0x52ea=['joinAt','emit','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','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','InteractionId','interaction','MessageId','message','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','info','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from'];(function(_0x370d13,_0xff3f46){var _0x55114b=function(_0x690144){while(--_0x690144){_0x370d13['push'](_0x370d13['shift']());}};_0x55114b(++_0xff3f46);}(_0x52ea,0x136));var _0xa52e=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0x52ea[_0x4e2272];return _0x45511c;};'use strict';var schema=require(_0xa52e('0x0'));var _=require(_0xa52e('0x1'));var util=require(_0xa52e('0x2'));var seqqueue=require(_0xa52e('0x3'));var moment=require(_0xa52e('0x4'));var Redis=require(_0xa52e('0x5'));var config=require(_0xa52e('0x6'));var logger=require(_0xa52e('0x7'))(_0xa52e('0x8'));var strategy=require(_0xa52e('0x9'));config[_0xa52e('0xa')]=_[_0xa52e('0xb')](config[_0xa52e('0xa')],{'host':_0xa52e('0xc'),'port':0x18eb});var io=require(_0xa52e('0xd'))(new Redis(config['redis']));var attributes=['id',_0xa52e('0xe'),_0xa52e('0xf'),_0xa52e('0x10'),_0xa52e('0x11'),_0xa52e('0x12')];function emit(_0x400768,_0x19b6c8,_0x4ade4d){io['to'](_0x400768)[_0xa52e('0x13')](_0x19b6c8,_0x4ade4d);}function emitChannelQueueInteraction(_0x17896a,_0x50a195,_0x1f20ee,_0x28979f,_0x290454,_0x5e2e76,_0x23b69b,_0x46ad7c){var _0x5d4ed9=_['clone'](_0x1f20ee);_0x5d4ed9[_0xa52e('0xe')]=_0x46ad7c;_0x5d4ed9[_0xa52e('0x10')]=_0x50a195;_0x5d4ed9['account']=_0x28979f;_0x5d4ed9['id']=_0x290454;if(_0x5e2e76){_0x23b69b[util[_0xa52e('0x14')]('%sQueuesWaitingInteractions',_0x17896a)][_0x290454]=_[_0xa52e('0x15')](_0x5d4ed9,attributes);}else{delete _0x23b69b[util[_0xa52e('0x14')](_0xa52e('0x16'),_0x17896a)][_0x290454];}emit(util[_0xa52e('0x14')](_0xa52e('0x17'),_0x17896a,_0x50a195),util['format'](_0xa52e('0x18'),_0x17896a,_0x5e2e76?_0xa52e('0x19'):'remove'),_[_0xa52e('0x15')](_0x5d4ed9,attributes));}var rpc={'openchannelQueueReport':require(_0xa52e('0x1a')),'mailQueueReport':require(_0xa52e('0x1b')),'chatQueueReport':require(_0xa52e('0x1c')),'smsQueueReport':require(_0xa52e('0x1d')),'faxQueueReport':require(_0xa52e('0x1e')),'whatsappQueueReport':require(_0xa52e('0x1f'))};var queue=schema({'name':{'type':_0xa52e('0x20'),'required':!![],'message':_0xa52e('0x21')},'timeout':{'type':_0xa52e('0x22'),'message':_0xa52e('0x23')}});function startRouting(_0x1f78b5,_0x5b3bcb,_0x14fd08,_0x226ead){if(_0x1f78b5&&_0x5b3bcb&&_0x14fd08){_0x5b3bcb[_0xa52e('0x24')]+=0x1;var _0x32dc0a={'uniqueid':_0x1f78b5,'from':_0x14fd08[_0xa52e('0x25')]?_0x14fd08[_0xa52e('0x25')][_0xa52e('0x11')]:'','joinAt':moment()[_0xa52e('0x14')](_0xa52e('0x26')),'ContactId':_0x14fd08[_0xa52e('0x27')]?_0x14fd08[_0xa52e('0x27')]['id']:null,'ListId':_0x14fd08[_0xa52e('0x28')]?_0x14fd08[_0xa52e('0x28')]['id']:null};_0x32dc0a[_[_0xa52e('0x29')](_0x14fd08['channel'])+_0xa52e('0x2a')]=_0x5b3bcb['id']||null;_0x32dc0a[_['upperFirst'](_0x14fd08[_0xa52e('0x2b')])+_0xa52e('0x2c')]=_0x14fd08['interaction']?_0x14fd08[_0xa52e('0x2d')]['id']:null;_0x32dc0a[_[_0xa52e('0x29')](_0x14fd08[_0xa52e('0x2b')])+_0xa52e('0x2e')]=_0x14fd08[_0xa52e('0x2f')]?_0x14fd08[_0xa52e('0x2f')]['id']:null;_0x32dc0a[_[_0xa52e('0x29')](_0x14fd08['channel'])+(_0x14fd08[_0xa52e('0x2b')]!=='chat'?'AccountId':'WebsiteId')]=_0x14fd08['account']?_0x14fd08['account']['id']:null;logger['info'](util[_0xa52e('0x14')](_0xa52e('0x30'),_0x1f78b5,_0x5b3bcb['name']));emitChannelQueueInteraction(_0x14fd08[_0xa52e('0x2b')],_0x5b3bcb[_0xa52e('0x31')],_0x32dc0a,_0x14fd08[_0xa52e('0xf')][_0xa52e('0x31')],_0x14fd08['message']['id'],!![],_0x226ead,_0x5b3bcb['id']);if(rpc[_0x14fd08[_0xa52e('0x2b')]+_0xa52e('0x32')]){return rpc[_0x14fd08[_0xa52e('0x2b')]+_0xa52e('0x32')][_0xa52e('0x33')](_0x32dc0a)[_0xa52e('0x34')](function(_0x1f0090){logger[_0xa52e('0x35')](_0xa52e('0x36'));});}}}function stopRouting(_0x3ec04d,_0x1aa0ce,_0x24c9b7,_0x5bbd68){if(_0x3ec04d&&_0x1aa0ce){_0x1aa0ce['waiting']-=0x1;var _0x19b282={'leaveAt':moment()[_0xa52e('0x14')](_0xa52e('0x26')),'acceptAt':moment()[_0xa52e('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa52e('0x37')};logger['info'](util['format'](_0xa52e('0x38'),_0x3ec04d,_0x1aa0ce[_0xa52e('0x31')]));emitChannelQueueInteraction(_0x24c9b7[_0xa52e('0x2b')],_0x1aa0ce[_0xa52e('0x31')],_0x24c9b7[_0xa52e('0x25')],_0x24c9b7[_0xa52e('0xf')][_0xa52e('0x31')],_0x24c9b7['message']['id'],![],_0x5bbd68,_0x1aa0ce['id']);if(rpc[_0x24c9b7['channel']+_0xa52e('0x32')]){return rpc[_0x24c9b7[_0xa52e('0x2b')]+_0xa52e('0x32')][_0xa52e('0x39')](_0x3ec04d,_0x19b282)[_0xa52e('0x34')](function(_0x392bee){logger[_0xa52e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x4ccda7,_0xd7e3c2,_0x561e06,_0x334b74){if(_0x4ccda7&&_0xd7e3c2){_0xd7e3c2[_0xa52e('0x24')]-=0x1;var _0x26c9c5={'leaveAt':moment()[_0xa52e('0x14')](_0xa52e('0x26')),'exitAt':moment()[_0xa52e('0x14')](_0xa52e('0x26')),'reason':_0xa52e('0x3a')};logger[_0xa52e('0x3b')](util[_0xa52e('0x14')](_0xa52e('0x3c'),_0x4ccda7,_0xd7e3c2[_0xa52e('0x31')]));emitChannelQueueInteraction(_0x561e06[_0xa52e('0x2b')],_0xd7e3c2[_0xa52e('0x31')],_0x561e06[_0xa52e('0x25')],_0x561e06[_0xa52e('0xf')][_0xa52e('0x31')],_0x561e06[_0xa52e('0x2f')]['id'],![],_0x334b74);if(rpc[_0x561e06[_0xa52e('0x2b')]+_0xa52e('0x32')]){return rpc[_0x561e06[_0xa52e('0x2b')]+_0xa52e('0x32')][_0xa52e('0x39')](_0x4ccda7,_0x26c9c5)[_0xa52e('0x34')](function(_0x2a835d){logger[_0xa52e('0x35')](_0xa52e('0x3d'));});}}}function handleFindQueue(_0xbfe445){return function(_0x12e449){return _0x12e449[_0xa52e('0x31')]['toLowerCase']()===_0xbfe445[_0xa52e('0x3e')]();};}exports[_0xa52e('0x3f')]=function(_0x28dc70,_0x197feb,_0x4fdb0d,_0x21b8fa){return function(_0x5dd7e9){try{var _0x1fdfd9={'name':_0x197feb[0x0],'timeout':_0x197feb[0x1]};var _0x33a65d=queue[_0xa52e('0x0')](_0x1fdfd9,{'typecast':!![]});if(_0x33a65d['length']){logger[_0xa52e('0x35')](_0xa52e('0x40'),_0x28dc70,_[_0xa52e('0x41')](_0x33a65d,_0xa52e('0x2f'))['join'](',\x20'));_0x5dd7e9[_0xa52e('0x42')]();}else{var _0x133429=_['find'](_0x4fdb0d[_0x21b8fa[_0xa52e('0x2b')]+_0xa52e('0x43')],handleFindQueue(_0x1fdfd9[_0xa52e('0x31')]));if(_0x133429){startRouting(_0x28dc70,_0x133429,_0x21b8fa,_0x4fdb0d);var _0x2c15f3=(_0x133429['timeout']||0xa)*0x3e8;var _0x11026d=(_0x1fdfd9[_0xa52e('0x3a')]||0x14)*0x3e8;var _0x24f0e3,_0x5515cd;if(_0x2c15f3>_0x11026d){_0x11026d=_0x2c15f3;}var _0x5bf92b=seqqueue[_0xa52e('0x44')](_0x2c15f3);_0x5bf92b['id']=_0x28dc70;_0x5bf92b[_0xa52e('0x45')]=_0x2c15f3;_0x5bf92b['qtimeout']=_0x11026d;_0x5bf92b[_0xa52e('0x2b')]=_0x21b8fa[_0xa52e('0x2b')];_0x4fdb0d[_0xa52e('0x46')][_0x28dc70]['on'](_0xa52e('0x47'),function(){logger[_0xa52e('0x3b')](_0xa52e('0x48'),_0x28dc70);stopRouting(_0x28dc70,_0x133429,_0x21b8fa,_0x4fdb0d);clearTimeout(_0x24f0e3);_0x24f0e3=undefined;_0x5bf92b['close'](!![]);if(_0x4fdb0d[_0xa52e('0x46')][_0x28dc70]){delete _0x4fdb0d[_0xa52e('0x46')][_0x28dc70];}_0x5dd7e9[_0xa52e('0x42')]();});_0x4fdb0d[_0xa52e('0x46')][_0x28dc70]['on'](_0xa52e('0x49'),function(){if(_0x4fdb0d[_0xa52e('0x46')][_0x28dc70]){delete _0x4fdb0d['rules'][_0x28dc70];}});_0x24f0e3=setTimeout(function(){logger[_0xa52e('0x3b')](_0xa52e('0x4a'),_0x28dc70);endRouting(_0x28dc70,_0x133429,_0x21b8fa,_0x4fdb0d);clearTimeout(_0x24f0e3);_0x5bf92b[_0xa52e('0x4b')](!![]);_0x5dd7e9[_0xa52e('0x4c')]();},_0x11026d);switch(_0x133429[_0xa52e('0x4d')]){case'rrmemory':strategy[_0xa52e('0x4e')](_0x5bf92b,_0x133429,_0x4fdb0d,_0x21b8fa);break;default:strategy['beepall'](_0x5bf92b,_0x133429,_0x4fdb0d,_0x21b8fa);}}else{logger[_0xa52e('0x35')](_0xa52e('0x4f'),_0x28dc70,_0x1fdfd9[_0xa52e('0x31')]);_0x5dd7e9[_0xa52e('0x42')]();}}}catch(_0x375e87){console[_0xa52e('0x50')](_0x375e87);logger[_0xa52e('0x35')](_0xa52e('0x40'),_0x28dc70,_0x375e87[_0xa52e('0x51')]);_0x5dd7e9[_0xa52e('0x42')]();}};}; \ 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 538fbd9..680efee 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 _0xc7c6=['hideNotification','STOP','TIMEOUT','uuid','./util','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xc7c6,0x14d));var _0x6c7c=function(_0x44db5e,_0x471108){_0x44db5e=_0x44db5e-0x0;var _0x58fc0f=_0xc7c6[_0x44db5e];return _0x58fc0f;};'use strict';var _=require('lodash');var uuid=require(_0x6c7c('0x0'));var util=require(_0x6c7c('0x1'));var logger=require('../../../../../config/logger')(_0x6c7c('0x2'));var Agent=function(_0x4cc829,_0xab99d0,_0x5af7e4,_0x50fe14){this[_0x6c7c('0x3')]=uuid['v4']();this[_0x6c7c('0x4')]=_0x4cc829;this[_0x6c7c('0x5')]=_0xab99d0;this[_0x6c7c('0x6')]=_0x5af7e4;this[_0x6c7c('0x2')]=_0x50fe14;this[_0x6c7c('0x4')][_0x6c7c('0x7')](this['handleRun'][_0x6c7c('0x8')](this),this[_0x6c7c('0x9')][_0x6c7c('0x8')](this));this[_0x6c7c('0x4')]['on'](_0x6c7c('0xa'),this[_0x6c7c('0x9')][_0x6c7c('0x8')](this));this[_0x6c7c('0x4')]['on'](_0x6c7c('0xb'),this[_0x6c7c('0xc')]['bind'](this));};Agent[_0x6c7c('0xd')]['push']=function(){this[_0x6c7c('0x4')][_0x6c7c('0x7')](this[_0x6c7c('0xe')][_0x6c7c('0x8')](this),this[_0x6c7c('0x9')][_0x6c7c('0x8')](this));};Agent[_0x6c7c('0xd')][_0x6c7c('0xc')]=function(){this[_0x6c7c('0x9')](!![]);};Agent[_0x6c7c('0xd')][_0x6c7c('0xe')]=function(_0x301474){logger[_0x6c7c('0xf')](_0x6c7c('0x10'),this[_0x6c7c('0x4')]['id'],this['agent']['id']);if(_[_0x6c7c('0x11')](this[_0x6c7c('0x6')][_0x6c7c('0x12')][this['agent']['id']])){logger[_0x6c7c('0xf')](_0x6c7c('0x13'),this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x5')]['id']);setTimeout(this[_0x6c7c('0x7')][_0x6c7c('0x8')](this),0x3e8);}else{if(this[_0x6c7c('0x2')][_0x6c7c('0x14')]||util[_0x6c7c('0x15')](this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x6')][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']],this[_0x6c7c('0x4')][_0x6c7c('0x16')],![])){this[_0x6c7c('0x6')][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']]['busy']=!![];this['realtime'][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']][_0x6c7c('0x17')]=undefined;util[_0x6c7c('0x18')](this[_0x6c7c('0x3')],this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x6')][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']],null,this[_0x6c7c('0x2')]);util[_0x6c7c('0x19')](this['squeue']['id'],this['realtime'][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']],_0x6c7c('0x1a')+(this['routing']['forcedOwnership']?_0x6c7c('0x1b'):''));}else{logger[_0x6c7c('0xf')](_0x6c7c('0x1c'),this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x5')]['id']);setTimeout(this['push'][_0x6c7c('0x8')](this),0x3e8);}}};Agent[_0x6c7c('0xd')][_0x6c7c('0x9')]=function(_0x312138){if(_[_0x6c7c('0x11')](this[_0x6c7c('0x6')][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']])){return logger[_0x6c7c('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x5')]['id']);}else{logger[_0x6c7c('0xf')](_0x6c7c('0x1d'),this['squeue']['id'],this[_0x6c7c('0x5')]['id']);util[_0x6c7c('0x1e')](this[_0x6c7c('0x3')],this['squeue']['id'],this[_0x6c7c('0x6')]['agents'][this[_0x6c7c('0x5')]['id']],null,this['routing']);this[_0x6c7c('0x6')][_0x6c7c('0x12')][this[_0x6c7c('0x5')]['id']]['busy']=![];this[_0x6c7c('0x6')][_0x6c7c('0x12')][this['agent']['id']][_0x6c7c('0x17')]=undefined;util['writeLog'](this[_0x6c7c('0x4')]['id'],this[_0x6c7c('0x6')]['agents'][this[_0x6c7c('0x5')]['id']],_0x312138?_0x6c7c('0x1f'):_0x6c7c('0x20'));}if(!_0x312138){setTimeout(this[_0x6c7c('0x7')]['bind'](this),0x3e8);}};function agent(_0x296c7a,_0x5b1f40,_0xed2cb1,_0xfa5670){return new Agent(_0x296c7a,_0x5b1f40,_0xed2cb1,_0xfa5670);}module['exports']=agent; \ No newline at end of file +var _0x8d65=['handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','./util','squeue','agent','realtime','push'];(function(_0x12ad43,_0x42c740){var _0x3a9741=function(_0x21114e){while(--_0x21114e){_0x12ad43['push'](_0x12ad43['shift']());}};_0x3a9741(++_0x42c740);}(_0x8d65,0x8c));var _0x58d6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8d65[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x58d6('0x0'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x8bac0a,_0x72524c,_0x25b631,_0x11c5c8){this['notificationId']=uuid['v4']();this[_0x58d6('0x1')]=_0x8bac0a;this[_0x58d6('0x2')]=_0x72524c;this[_0x58d6('0x3')]=_0x25b631;this['routing']=_0x11c5c8;this[_0x58d6('0x1')][_0x58d6('0x4')](this[_0x58d6('0x5')][_0x58d6('0x6')](this),this[_0x58d6('0x7')][_0x58d6('0x6')](this));this['squeue']['on'](_0x58d6('0x8'),this[_0x58d6('0x7')]['bind'](this));this['squeue']['on'](_0x58d6('0x9'),this['handleDrained'][_0x58d6('0x6')](this));};Agent[_0x58d6('0xa')][_0x58d6('0x4')]=function(){this[_0x58d6('0x1')][_0x58d6('0x4')](this[_0x58d6('0x5')][_0x58d6('0x6')](this),this[_0x58d6('0x7')][_0x58d6('0x6')](this));};Agent[_0x58d6('0xa')][_0x58d6('0xb')]=function(){this[_0x58d6('0x7')](!![]);};Agent[_0x58d6('0xa')][_0x58d6('0x5')]=function(_0x200de3){logger[_0x58d6('0xc')](_0x58d6('0xd'),this[_0x58d6('0x1')]['id'],this['agent']['id']);if(_[_0x58d6('0xe')](this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']])){logger[_0x58d6('0xc')](_0x58d6('0x10'),this[_0x58d6('0x1')]['id'],this[_0x58d6('0x2')]['id']);setTimeout(this[_0x58d6('0x4')]['bind'](this),0x3e8);}else{if(this[_0x58d6('0x11')]['forcedOwnership']||util[_0x58d6('0x12')](this[_0x58d6('0x1')]['id'],this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']],this[_0x58d6('0x1')][_0x58d6('0x13')],![])){this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']][_0x58d6('0x14')]=!![];this[_0x58d6('0x3')]['agents'][this[_0x58d6('0x2')]['id']][_0x58d6('0x15')]=undefined;util[_0x58d6('0x16')](this['notificationId'],this[_0x58d6('0x1')]['id'],this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']],null,this['routing']);util[_0x58d6('0x17')](this[_0x58d6('0x1')]['id'],this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']],'RINGING'+(this[_0x58d6('0x11')]['forcedOwnership']?_0x58d6('0x18'):''));}else{logger[_0x58d6('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x58d6('0x1')]['id'],this[_0x58d6('0x2')]['id']);setTimeout(this[_0x58d6('0x4')][_0x58d6('0x6')](this),0x3e8);}}};Agent[_0x58d6('0xa')][_0x58d6('0x7')]=function(_0x3b99a6){if(_['isNil'](this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']])){return logger[_0x58d6('0xc')](_0x58d6('0x10'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x58d6('0xc')](_0x58d6('0x19'),this[_0x58d6('0x1')]['id'],this[_0x58d6('0x2')]['id']);util[_0x58d6('0x1a')](this['notificationId'],this['squeue']['id'],this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']],null,this[_0x58d6('0x11')]);this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']][_0x58d6('0x14')]=![];this[_0x58d6('0x3')][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']][_0x58d6('0x15')]=undefined;util[_0x58d6('0x17')](this[_0x58d6('0x1')]['id'],this['realtime'][_0x58d6('0xf')][this[_0x58d6('0x2')]['id']],_0x3b99a6?'STOP':_0x58d6('0x1b'));}if(!_0x3b99a6){setTimeout(this[_0x58d6('0x4')][_0x58d6('0x6')](this),0x3e8);}};function agent(_0x1cf44c,_0x55b2a0,_0x1839e6,_0x3c4a48){return new Agent(_0x1cf44c,_0x55b2a0,_0x1839e6,_0x3c4a48);}module[_0x58d6('0x1c')]=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 7feca39..d3068af 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 _0x1247=['squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','lodash','uuid','routing','notificationId'];(function(_0x49d466,_0x20d11d){var _0x1934d3=function(_0xb680ee){while(--_0xb680ee){_0x49d466['push'](_0x49d466['shift']());}};_0x1934d3(++_0x20d11d);}(_0x1247,0xb6));var _0x7124=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x1247[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x7124('0x0'));var uuid=require(_0x7124('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x7124('0x2'));var Beepall=function(_0x461882,_0x37ccf8,_0x5ebbfa,_0x3bdce3){this[_0x7124('0x3')]=uuid['v4']();this[_0x7124('0x4')]=_0x461882;this[_0x7124('0x5')]=_0x37ccf8;this[_0x7124('0x6')]=_0x5ebbfa;this[_0x7124('0x2')]=_0x3bdce3;this[_0x7124('0x4')][_0x7124('0x7')](this[_0x7124('0x8')][_0x7124('0x9')](this),this['handleTimeout'][_0x7124('0x9')](this));this[_0x7124('0x4')]['on'](_0x7124('0xa'),this[_0x7124('0xb')][_0x7124('0x9')](this));this[_0x7124('0x4')]['on'](_0x7124('0xc'),this['handleDrained'][_0x7124('0x9')](this));};Beepall['prototype'][_0x7124('0x7')]=function(){this[_0x7124('0x4')][_0x7124('0x7')](this[_0x7124('0x8')]['bind'](this),this[_0x7124('0xb')][_0x7124('0x9')](this));};Beepall['prototype']['handleDrained']=function(_0x3e6a87){this[_0x7124('0xb')](!![]);};Beepall[_0x7124('0xd')][_0x7124('0x8')]=function(_0x3d0f8e){var _0x19c70c=!![];if(!_[_0x7124('0xe')](this[_0x7124('0x5')])&&!_[_0x7124('0xe')](this[_0x7124('0x5')][_0x7124('0xf')])&&this[_0x7124('0x5')][_0x7124('0xf')][_0x7124('0x10')]>0x0){for(var _0x2df549=0x0,_0x4721d2;_0x2df5490x0){for(var _0x1d973c=0x0,_0x35af37;_0x1d973c0x0&&_0x2a1bdd[_0x3b118f+_0x7ef1('0x22')]>=_0x2a1bdd[_0x3b118f+'Capacity']){writeLog(_0x490162,_0x2a1bdd,_0x3b118f[_0x7ef1('0x23')]()+_0x7ef1('0x24'));return![];}}return!![];};exports[_0x7ef1('0x25')]=function(_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee){return sendNotification(!![],_0x4af5f5,_0x232f4e,_0x238fdc,_0x21e8c5,_0x58e7ee);};exports[_0x7ef1('0x26')]=function(_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de){return sendNotification(![],_0x4b0380,_0x3306b0,_0x2546bf,_0x4b5fde,_0x5f25de);};exports[_0x7ef1('0x27')]=writeLog; \ No newline at end of file +var _0x3a6d=['getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','name','user:save','account','notificationSound','notificationShake','body','queue','msg'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3a6d,0x143));var _0xd3a6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3a6d[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var utils=require('../utils');var Mustache=require(_0xd3a6('0x2'));var Redis=require(_0xd3a6('0x3'));var config=require(_0xd3a6('0x4'));var logger=require(_0xd3a6('0x5'))(_0xd3a6('0x6'));config['redis']=_[_0xd3a6('0x7')](config[_0xd3a6('0x8')],{'host':_0xd3a6('0x9'),'port':0x18eb});var io=require(_0xd3a6('0xa'))(new Redis(config[_0xd3a6('0x8')]));function emit(_0x282cb1,_0x58d83a,_0x121bd2){io['to'](_0x282cb1)[_0xd3a6('0xb')](_0x58d83a,_0x121bd2);}function sendNotification(_0x16858,_0x410dac,_0x14b46b,_0xa67661,_0x1dbcce,_0x4094a2){io['to'](util[_0xd3a6('0xc')]('user:%s',_0xa67661[_0xd3a6('0xd')]))[_0xd3a6('0xb')](_0xd3a6('0xe'),_0xa67661);var _0x225399=_0x4094a2||{};var _0x2bd4f0=_0x14b46b['split']('.');var _0x5430c0={'uniqueid':_0x410dac,'channel':_0x2bd4f0[0x0],'id':_0x2bd4f0[0x1],'title':_0x2bd4f0[0x0]+'\x20interaction','interactionId':_0x2bd4f0[0x2],'queue':_0x1dbcce?_0x1dbcce[_0xd3a6('0xd')]:null,'sound':_0x225399[_0xd3a6('0xf')][_0xd3a6('0x10')],'shake':_0x225399[_0xd3a6('0xf')][_0xd3a6('0x11')]};try{if(!_0x225399[_0xd3a6('0x12')]){_0x225399[_0xd3a6('0x12')]={};}if(_0x1dbcce){_0x225399['body'][_0xd3a6('0x13')]=_0x1dbcce;}else if(_0x225399[_0xd3a6('0x12')][_0xd3a6('0x13')]){delete _0x225399['body'][_0xd3a6('0x13')];}_0x5430c0[_0xd3a6('0x14')]=utils[_0xd3a6('0x15')](_0x225399['account'][_0xd3a6('0x16')],_0x225399);}catch(_0x5174e0){_0x5430c0['msg']=_0xd3a6('0x17');logger[_0xd3a6('0x18')](util[_0xd3a6('0xc')](_0xd3a6('0x19'),_0x410dac,_0x5174e0[_0xd3a6('0x1a')]));}io['to'](util[_0xd3a6('0xc')](_0xd3a6('0x1b'),_0xa67661['name']))[_0xd3a6('0xb')](util['format'](_0xd3a6('0x1c'),_0x16858?_0xd3a6('0x1d'):_0xd3a6('0x1e')),_0x5430c0);}function writeLog(_0x20a34e,_0x465d25,_0x6ecd88){return logger['info'](util[_0xd3a6('0xc')](_0xd3a6('0x1f'),_0x20a34e,_0x465d25['name'],_0x6ecd88));}exports['isAgentAvailable']=function(_0x5846bc,_0x573870,_0x5c9075,_0x98a12a){if(_0x573870[_0xd3a6('0x20')]){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x21'));return![];}if(!_0x573870['online']){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x22'));return![];}if(_0x573870[_0x5c9075+'Pause']){writeLog(_0x5846bc,_0x573870,_0xd3a6('0x23'));return![];}if(_0x98a12a&&_0x573870[_0xd3a6('0x24')](_0x5c9075+_0xd3a6('0x25'))&&_0x573870['hasOwnProperty'](_0x5c9075+_0xd3a6('0x26'))){if(_0x573870[_0x5c9075+_0xd3a6('0x25')]>0x0&&_0x573870[_0x5c9075+_0xd3a6('0x26')]>=_0x573870[_0x5c9075+_0xd3a6('0x25')]){writeLog(_0x5846bc,_0x573870,_0x5c9075[_0xd3a6('0x27')]()+_0xd3a6('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2){return sendNotification(!![],_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2);};exports[_0xd3a6('0x29')]=function(_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c){return sendNotification(![],_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c);};exports[_0xd3a6('0x2a')]=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 b293b29..1832a8e 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 _0xe8cf=['replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','shelljs','routing','string','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','info','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8cf,0xb6));var _0xfe8c=function(_0x5d689d,_0x3fac90){_0x5d689d=_0x5d689d-0x0;var _0x33a7a7=_0xe8cf[_0x5d689d];return _0x33a7a7;};'use strict';var schema=require(_0xfe8c('0x0'));var sh=require(_0xfe8c('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xfe8c('0x2'));var system=schema({'command':{'type':_0xfe8c('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5b0f91,_0x15d22a){return function(_0x2e1769){try{var _0x11ce91={'command':_0x15d22a[0x0]};var _0x399f8=system['validate'](_0x11ce91,{'typecast':!![]});if(_0x399f8[_0xfe8c('0x4')]){logger[_0xfe8c('0x5')](_0xfe8c('0x6'),_0x5b0f91,_[_0xfe8c('0x7')](_0x399f8,_0xfe8c('0x8'))[_0xfe8c('0x9')](',\x20'));logger['info'](_0xfe8c('0xa'),_0x5b0f91);_0x2e1769[_0xfe8c('0xb')]();}else{var _0x5b8d5d=this;var _0x3f27c4=utils[_0xfe8c('0xc')](_0x15d22a[0x0],this);logger['info'](_0xfe8c('0xd'),_0x5b0f91,_0x3f27c4);sh['exec'](_['trim'](_0x3f27c4),function(_0xa7a178,_0x1fb1e2){logger[_0xfe8c('0xe')](_0xfe8c('0xf'),_0x5b0f91,_0xa7a178);if(_0xa7a178==0x0){var _0x4f3dde=_0x1fb1e2[_0xfe8c('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xfe8c('0x11')](_0x15d22a[0x1])||_[_0xfe8c('0x12')](_0x15d22a[0x1])){logger['info'](_0xfe8c('0x13'),_0x5b0f91);_0x5b8d5d['body'][_0x15d22a[0x1]]=_0x4f3dde;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5b0f91,_0x15d22a[0x1],_0x4f3dde);_0x5b8d5d[_0xfe8c('0x14')][_0x15d22a[0x1]]=_0x4f3dde;}}_0x2e1769[_0xfe8c('0xb')]();});}}catch(_0x140614){logger[_0xfe8c('0x5')](_0xfe8c('0x6'),_0x5b0f91,_['isObject'](_0x140614)?JSON[_0xfe8c('0x15')](_0x140614):_0x140614);logger[_0xfe8c('0xe')](_0xfe8c('0xa'),_0x5b0f91);_0x2e1769[_0xfe8c('0xb')]();}};}; \ No newline at end of file +var _0x6882=['replace','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','stringify','validate','shelljs','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x2f601c,_0x5a94a2){var _0x50a269=function(_0x1c4680){while(--_0x1c4680){_0x2f601c['push'](_0x2f601c['shift']());}};_0x50a269(++_0x5a94a2);}(_0x6882,0x84));var _0x2688=function(_0x469bd4,_0x4c45ff){_0x469bd4=_0x469bd4-0x0;var _0xa2939=_0x6882[_0x469bd4];return _0xa2939;};'use strict';var schema=require(_0x2688('0x0'));var sh=require(_0x2688('0x1'));var _=require(_0x2688('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2688('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2688('0x4')}});exports[_0x2688('0x5')]=function(_0x14384c,_0x308f56){return function(_0x53163c){try{var _0x4f8881={'command':_0x308f56[0x0]};var _0x5cb8a8=system['validate'](_0x4f8881,{'typecast':!![]});if(_0x5cb8a8[_0x2688('0x6')]){logger['error'](_0x2688('0x7'),_0x14384c,_['map'](_0x5cb8a8,'message')[_0x2688('0x8')](',\x20'));logger['info'](_0x2688('0x9'),_0x14384c);_0x53163c[_0x2688('0xa')]();}else{var _0xb6d3ad=this;var _0x365011=utils['getMustacheRender'](_0x308f56[0x0],this);logger['info'](_0x2688('0xb'),_0x14384c,_0x365011);sh['exec'](_[_0x2688('0xc')](_0x365011),function(_0x2e61a4,_0x451527){logger[_0x2688('0xd')](_0x2688('0xe'),_0x14384c,_0x2e61a4);if(_0x2e61a4==0x0){var _0x590cd1=_0x451527[_0x2688('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x308f56[0x1])||_['isEmpty'](_0x308f56[0x1])){logger[_0x2688('0xd')](_0x2688('0x10'),_0x14384c);_0xb6d3ad[_0x2688('0x11')][_0x308f56[0x1]]=_0x590cd1;}else{logger[_0x2688('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x14384c,_0x308f56[0x1],_0x590cd1);_0xb6d3ad[_0x2688('0x11')][_0x308f56[0x1]]=_0x590cd1;}}_0x53163c[_0x2688('0xa')]();});}}catch(_0x36d110){logger[_0x2688('0x12')](_0x2688('0x7'),_0x14384c,_[_0x2688('0x13')](_0x36d110)?JSON[_0x2688('0x14')](_0x36d110):_0x36d110);logger[_0x2688('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x14384c);_0x53163c[_0x2688('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index ae8c0a8..06bf85a 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 _0xd89d=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join'];(function(_0x2def20,_0x1428fe){var _0xeb5dfa=function(_0x35fe17){while(--_0x35fe17){_0x2def20['push'](_0x2def20['shift']());}};_0xeb5dfa(++_0x1428fe);}(_0xd89d,0x84));var _0xdd89=function(_0x225596,_0x2aca36){_0x225596=_0x225596-0x0;var _0x3ffc29=_0xd89d[_0x225596];return _0x3ffc29;};'use strict';var schema=require(_0xdd89('0x0'));var _=require(_0xdd89('0x1'));var rpc={'chatInteraction':require(_0xdd89('0x2')),'openchannelInteraction':require(_0xdd89('0x3')),'smsInteraction':require(_0xdd89('0x4')),'mailInteraction':require(_0xdd89('0x5')),'faxInteraction':require(_0xdd89('0x6')),'whatsappInteraction':require(_0xdd89('0x7'))};var logger=require(_0xdd89('0x8'))(_0xdd89('0x9'));var tag=schema({'tag':{'type':_0xdd89('0xa'),'required':!![],'message':_0xdd89('0xb')}});exports[_0xdd89('0xc')]=function(_0x52284d,_0x1a8a98,_0x21f6fd,_0x50dc73){return function(_0x307724){try{var _0x299200={'tag':_0x1a8a98[0x0]};var _0x1a38f6=tag[_0xdd89('0x0')](_0x299200,{'typecast':!![]});if(_0x1a38f6[_0xdd89('0xd')]){logger['error'](_0xdd89('0xe'),_0x52284d,_[_0xdd89('0xf')](_0x1a38f6,_0xdd89('0x10'))[_0xdd89('0x11')](',\x20'));logger['info'](_0xdd89('0x12'),_0x52284d);_0x307724[_0xdd89('0x13')]();}else{var _0x4d9967={'ids':[_0x1a8a98[0x0]]};if(rpc[_0x50dc73[_0xdd89('0x14')]+_0xdd89('0x15')]){rpc[_0x50dc73[_0xdd89('0x14')]+_0xdd89('0x15')][_0xdd89('0x16')](_0x50dc73[_0xdd89('0x17')]['id'],_0x4d9967)['then'](function(_0xf75273){logger[_0xdd89('0x18')](_0xdd89('0x19'),_0x52284d,_0x1a8a98[0x1],_0x50dc73[_0xdd89('0x14')],_0x50dc73[_0xdd89('0x17')]['id']);})[_0xdd89('0x1a')](function(_0x459236){logger[_0xdd89('0x1b')](_0xdd89('0xe'),_0x52284d,JSON[_0xdd89('0x1c')](_0x459236));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x52284d);})['finally'](function(){_0x307724[_0xdd89('0x13')]();});}}}catch(_0x1afdca){logger[_0xdd89('0x1b')](_0xdd89('0xe'),_0x52284d,_[_0xdd89('0x1d')](_0x1afdca)?JSON[_0xdd89('0x1c')](_0x1afdca):_0x1afdca);logger[_0xdd89('0x18')](_0xdd89('0x12'),_0x52284d);_0x307724['next']();}};}; \ No newline at end of file +var _0x36f1=['message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map'];(function(_0x3c819e,_0x1d0c31){var _0x122739=function(_0x2deea9){while(--_0x2deea9){_0x3c819e['push'](_0x3c819e['shift']());}};_0x122739(++_0x1d0c31);}(_0x36f1,0x15d));var _0x136f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x36f1[_0x2b10c6];return _0x3789d2;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x136f('0x0')),'openchannelInteraction':require(_0x136f('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x136f('0x2')),'faxInteraction':require(_0x136f('0x3')),'whatsappInteraction':require(_0x136f('0x4'))};var logger=require(_0x136f('0x5'))(_0x136f('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x136f('0x7')}});exports['consequence']=function(_0x5a071,_0x290786,_0x54fd82,_0x42b53b){return function(_0x4182c8){try{var _0x76ab41={'tag':_0x290786[0x0]};var _0x2e38f3=tag['validate'](_0x76ab41,{'typecast':!![]});if(_0x2e38f3[_0x136f('0x8')]){logger[_0x136f('0x9')]('[%s][TAG]\x20%s',_0x5a071,_[_0x136f('0xa')](_0x2e38f3,_0x136f('0xb'))[_0x136f('0xc')](',\x20'));logger[_0x136f('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a071);_0x4182c8[_0x136f('0xe')]();}else{var _0x2a868f={'ids':[_0x290786[0x0]]};if(rpc[_0x42b53b[_0x136f('0xf')]+_0x136f('0x10')]){rpc[_0x42b53b['channel']+'Interaction'][_0x136f('0x11')](_0x42b53b[_0x136f('0x12')]['id'],_0x2a868f)[_0x136f('0x13')](function(_0x4fc850){logger[_0x136f('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5a071,_0x290786[0x1],_0x42b53b[_0x136f('0xf')],_0x42b53b['interaction']['id']);})['catch'](function(_0x236e59){logger[_0x136f('0x9')](_0x136f('0x14'),_0x5a071,JSON[_0x136f('0x15')](_0x236e59));logger[_0x136f('0xd')](_0x136f('0x16'),_0x5a071);})['finally'](function(){_0x4182c8[_0x136f('0xe')]();});}}}catch(_0x1c7a08){logger['error']('[%s][TAG]\x20%s',_0x5a071,_[_0x136f('0x17')](_0x1c7a08)?JSON[_0x136f('0x15')](_0x1c7a08):_0x1c7a08);logger[_0x136f('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a071);_0x4182c8[_0x136f('0xe')]();}};}; \ 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 b9d5e2b..9ada623 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 _0xf08e=['error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','login','params','POST','application/json-rpc','parse','result','logged','&serviceId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch'];(function(_0x4092f7,_0xeeac3c){var _0x1e3948=function(_0x2c8fcb){while(--_0x2c8fcb){_0x4092f7['push'](_0x4092f7['shift']());}};_0x1e3948(++_0xeeac3c);}(_0xf08e,0x190));var _0xef08=function(_0x3ded04,_0x28b2b9){_0x3ded04=_0x3ded04-0x0;var _0xe5ac3=_0xf08e[_0x3ded04];return _0xe5ac3;};'use strict';var rp=require(_0xef08('0x0'));var logger=require(_0xef08('0x1'))(_0xef08('0x2'));var _=require(_0xef08('0x3'));var arr=[];exports[_0xef08('0x4')]=function(_0x2f9526,_0x54babe){return function(_0x1fb71a){var _0x274e62=_0x54babe[0xa];var _0xc3887a=_0x54babe[0xb];var _0x300cca=_0x54babe[0xc];var _0x1e986f=_0x54babe[0xd];var _0x2e774d=_0x54babe[0xe];var _0x2240d7=_0x54babe[0xf][_0xef08('0x5')](/\n/g,_0xef08('0x6'));var _0x56b17f=_0x54babe[0x10][_0xef08('0x5')](/\n/g,'\x20');if(!arr[_0xef08('0x7')](_0xc3887a)){arr[_0xef08('0x8')](_0xc3887a);var _0x1e1b53=_0x54babe[0x3];var _0x2ff361=_0x54babe[0x4];var _0x55668a=_0x54babe[0x1];var _0x475d05=_0x54babe[0x0];var _0xc4cbb1={};_0xc4cbb1['urlOnAnswer']=_0x54babe[0x8]+_0xef08('0x9')+_0x300cca+'|'+_0x274e62+'|'+_0x1e986f+'|'+_0xc3887a+'|'+_0x2e774d;_0xc4cbb1[_0xef08('0xa')]=_0x54babe[0x7]+_0xef08('0x9')+_0x300cca+'|'+_0x274e62+'|'+_0x1e986f+'|'+_0xc3887a+'|'+_0x2e774d+'|'+_0x2240d7+'|'+_0x56b17f;_0xc4cbb1[_0xef08('0xb')]=_0x54babe[0x9];var _0x53facf={};_0x53facf[_0xef08('0xc')]=_0xef08('0xd');_0x53facf['method']=_0xef08('0xe');var _0x351ca5=[];_0x351ca5['push'](_0x54babe[0x2]);_0x351ca5[_0xef08('0x8')](_0x54babe[0x5]);_0x351ca5[_0xef08('0x8')](_0x54babe[0x6]);_0x53facf[_0xef08('0xf')]=_0x351ca5;_0x53facf['id']=0x1;var _0x1bd4b4=JSON['stringify'](_0x53facf);var _0x3cfe31={'encoding':'utf8','method':_0xef08('0x10'),'timeout':0x2710,'url':_0x1e1b53,'headers':{'Content-Type':_0xef08('0x11')},'body':_0x1bd4b4};return rp(_0x3cfe31)['then'](function(_0x42aac3){const _0x5622de=JSON[_0xef08('0x12')](_0x42aac3);if(!_0x5622de[_0xef08('0x13')][_0xef08('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x5a436d=_0xc3887a;var _0x2d81b6='channelId='+_0x55668a+_0xef08('0x15')+_0x475d05+_0xef08('0x16')+_0x5a436d+_0xef08('0x17')+JSON[_0xef08('0x18')](_0xc4cbb1);var _0x1ff2e9=_0x2ff361+'?'+_0x2d81b6;return rp(_0x1ff2e9);})[_0xef08('0x19')](function(_0x370ccd){logger[_0xef08('0x1a')](_0xef08('0x1b'),_0x2f9526,_0x370ccd);_0x1fb71a['stop']();})[_0xef08('0x1c')](function(_0x574c2f){logger[_0xef08('0x1d')](_0xef08('0x1e'),_0x2f9526,_[_0xef08('0x1f')](_0x574c2f)?JSON[_0xef08('0x18')](_0x574c2f):_0x574c2f);_0x1fb71a['stop']();});}else{logger[_0xef08('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2f9526);_0x1fb71a[_0xef08('0x20')]();}};}; \ No newline at end of file +var _0x7c06=['next','../../../../config/logger','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next'];(function(_0xfe65db,_0x420aee){var _0x5d2212=function(_0x5b04cb){while(--_0x5b04cb){_0xfe65db['push'](_0xfe65db['shift']());}};_0x5d2212(++_0x420aee);}(_0x7c06,0xc7));var _0x67c0=function(_0x3d1e90,_0x33e6bd){_0x3d1e90=_0x3d1e90-0x0;var _0x49ccc2=_0x7c06[_0x3d1e90];return _0x49ccc2;};'use strict';var rp=require('request-promise');var logger=require(_0x67c0('0x0'))('routing');var _=require('lodash');var arr=[];exports[_0x67c0('0x1')]=function(_0x43f700,_0x49d3d2){return function(_0x43ccde){var _0xa061c9=_0x49d3d2[0xa];var _0x44f358=_0x49d3d2[0xb];var _0x3b9473=_0x49d3d2[0xc];var _0x1fd712=_0x49d3d2[0xd];var _0x2a7986=_0x49d3d2[0xe];var _0x241d1e=_0x49d3d2[0xf][_0x67c0('0x2')](/\n/g,_0x67c0('0x3'));var _0x607e8b=_0x49d3d2[0x10][_0x67c0('0x2')](/\n/g,'\x20');if(!arr[_0x67c0('0x4')](_0x44f358)){arr[_0x67c0('0x5')](_0x44f358);var _0x20cf0a=_0x49d3d2[0x3];var _0x51a33a=_0x49d3d2[0x4];var _0x10662e=_0x49d3d2[0x1];var _0x248dab=_0x49d3d2[0x0];var _0x1715d6={};_0x1715d6[_0x67c0('0x6')]=_0x49d3d2[0x8]+_0x67c0('0x7')+_0x3b9473+'|'+_0xa061c9+'|'+_0x1fd712+'|'+_0x44f358+'|'+_0x2a7986;_0x1715d6['urlOnRing']=_0x49d3d2[0x7]+'?params='+_0x3b9473+'|'+_0xa061c9+'|'+_0x1fd712+'|'+_0x44f358+'|'+_0x2a7986+'|'+_0x241d1e+'|'+_0x607e8b;_0x1715d6[_0x67c0('0x8')]=_0x49d3d2[0x9];var _0xed7a6={};_0xed7a6[_0x67c0('0x9')]=_0x67c0('0xa');_0xed7a6[_0x67c0('0xb')]=_0x67c0('0xc');var _0x20e18a=[];_0x20e18a['push'](_0x49d3d2[0x2]);_0x20e18a['push'](_0x49d3d2[0x5]);_0x20e18a['push'](_0x49d3d2[0x6]);_0xed7a6[_0x67c0('0xd')]=_0x20e18a;_0xed7a6['id']=0x1;var _0x300620=JSON[_0x67c0('0xe')](_0xed7a6);var _0x583ea7={'encoding':'utf8','method':_0x67c0('0xf'),'timeout':0x2710,'url':_0x20cf0a,'headers':{'Content-Type':'application/json-rpc'},'body':_0x300620};return rp(_0x583ea7)[_0x67c0('0x10')](function(_0x3f9609){const _0x3747c4=JSON[_0x67c0('0x11')](_0x3f9609);if(!_0x3747c4['result'][_0x67c0('0x12')]){throw new Error(_0x67c0('0x13'));}var _0x2193c4=_0x44f358;var _0x4f8a71=_0x67c0('0x14')+_0x10662e+_0x67c0('0x15')+_0x248dab+_0x67c0('0x16')+_0x2193c4+_0x67c0('0x17')+JSON['stringify'](_0x1715d6);var _0x233fd4=_0x51a33a+'?'+_0x4f8a71;return rp(_0x233fd4);})[_0x67c0('0x10')](function(_0x171d35){logger['info'](_0x67c0('0x18'),_0x43f700,_0x171d35);_0x43ccde[_0x67c0('0x19')]();})[_0x67c0('0x1a')](function(_0xbf71ad){logger[_0x67c0('0x1b')](_0x67c0('0x1c'),_0x43f700,_[_0x67c0('0x1d')](_0xbf71ad)?JSON[_0x67c0('0xe')](_0xbf71ad):_0xbf71ad);_0x43ccde[_0x67c0('0x19')]();});}else{logger[_0x67c0('0x1e')](_0x67c0('0x1f'),_0x43f700);_0x43ccde[_0x67c0('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 6b9958a..25f9499 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(_0xa440fd,_0x1a456a){var _0x47fb4d=function(_0x2f81db){while(--_0x2f81db){_0xa440fd['push'](_0xa440fd['shift']());}};_0x47fb4d(++_0x1a456a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x44cea1,_0x5a384b){var _0x3a2d53=function(_0x52c37e){while(--_0x52c37e){_0x44cea1['push'](_0x44cea1['shift']());}};_0x3a2d53(++_0x5a384b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8d41d4f..2bd27dd 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 _0x407f=['../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','%s:%s:%s','./interval','condition','./applications/','priority','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport'];(function(_0x50bb64,_0x233838){var _0x26f7d2=function(_0x121aa4){while(--_0x121aa4){_0x50bb64['push'](_0x50bb64['shift']());}};_0x26f7d2(++_0x233838);}(_0x407f,0xc2));var _0xf407=function(_0x45be52,_0x46d496){_0x45be52=_0x45be52-0x0;var _0x15294f=_0x407f[_0x45be52];return _0x15294f;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xf407('0x0'));var BPromise=require(_0xf407('0x1'));var uuid=require(_0xf407('0x2'));var utils=require(_0xf407('0x3'));var config=require(_0xf407('0x4'));var logger=require(_0xf407('0x5'))(_0xf407('0x6'));var rpc={'openchannelQueueReport':require(_0xf407('0x7')),'mailQueueReport':require(_0xf407('0x8')),'chatQueueReport':require(_0xf407('0x9')),'smsQueueReport':require(_0xf407('0xa')),'faxQueueReport':require(_0xf407('0xb')),'whatsappQueueReport':require(_0xf407('0xc'))};var RuleEngine=require(_0xf407('0xd'));function getId(_0x38ee37,_0x3ab539,_0x5dc169){return util[_0xf407('0xe')](_0xf407('0xf'),_0x38ee37,_0x3ab539||0x0,_0x5dc169||0x0);}function getIntervals(_0x436e03,_0x5af7b8){var _0x4ff28e=[];if(!_['isNil'](_0x5af7b8['IntervalId'])&&!_[_0xf407('0x10')](_0x436e03[_0x5af7b8[_0xf407('0x11')]])&&!_[_0xf407('0x10')](_0x436e03[_0x5af7b8[_0xf407('0x11')]][_0xf407('0x12')])){_0x4ff28e=_['map'](_0x436e03[_0x5af7b8[_0xf407('0x11')]][_0xf407('0x12')],_0xf407('0x13'));}else if(!_[_0xf407('0x10')](_0x5af7b8[_0xf407('0x13')])){_0x4ff28e=[_0x5af7b8[_0xf407('0x13')]];}return _0x4ff28e;}exports[_0xf407('0x14')]=function(_0x5257ef){_0x5257ef['rules']={};return new BPromise(function(_0x50bb74,_0x280a9f){var _0x593e36={'Start':function(_0x454710){var _0x4c1320=this;return new Promise(function(_0x48fd5d,_0x768926){if(_0x454710){try{var _0x331782=[];var _0x1cdc81=getId(_0x454710[_0xf407('0x15')],_0x454710[_0xf407('0x16')]?_0x454710[_0xf407('0x16')]['id']:0x0,_0x454710[_0xf407('0x17')]?_0x454710[_0xf407('0x17')]['id']:0x0);if(_0x454710['applications']&&_[_0xf407('0x18')](_0x454710[_0xf407('0x19')])&&_0x454710[_0xf407('0x19')][_0xf407('0x1a')]){for(var _0x54e838=0x0;_0x54e838<_0x454710[_0xf407('0x19')]['length'];_0x54e838+=0x1){var _0x2aa4c3=_0x454710[_0xf407('0x19')][_0x54e838];if(fs[_0xf407('0x1b')](path[_0xf407('0x1c')](__dirname,'applications',_0x2aa4c3[_0xf407('0x1d')]+_0xf407('0x1e')))){var _0x23659c=[];switch(_0x2aa4c3[_0xf407('0x1d')]['toLowerCase']()){case'autoreply':var _0x14cf2f=_0x2aa4c3[_0xf407('0x1f')][_0xf407('0x20')](',');if(_0x454710[_0xf407('0x15')]===_0xf407('0x21')){_0x23659c[_0xf407('0x22')](_0x14cf2f[0x0]);_0x23659c[_0xf407('0x22')](_0x14cf2f[0x1]);_0x23659c['push'](_0x14cf2f[_0xf407('0x23')](0x2,_0x14cf2f[_0xf407('0x1a')])[_0xf407('0x1c')](','));}else{_0x23659c['push'](_0x14cf2f[0x0]);_0x23659c[_0xf407('0x22')](_0x14cf2f[_0xf407('0x23')](0x1,_0x14cf2f[_0xf407('0x1a')])[_0xf407('0x1c')](','));}break;case _0xf407('0x24'):var _0x187c93=_0x2aa4c3['appdata'][_0xf407('0x20')](',');_0x23659c['push'](_0x187c93[0x0]);_0x23659c['push'](_0x187c93[0x1]);_0x23659c[_0xf407('0x22')](_0x187c93[_0xf407('0x23')](0x2,_0x187c93[_0xf407('0x1a')])[_0xf407('0x1c')](','));break;case _0xf407('0x25'):var _0x249028=_0x2aa4c3['appdata'][_0xf407('0x20')](',');_0x23659c[_0xf407('0x22')](_0x249028[0x0]);_0x23659c[_0xf407('0x22')](_0x249028[0x1]);_0x23659c[_0xf407('0x22')](_0x249028[0x2]);_0x23659c[_0xf407('0x22')](_0x249028[0x3]);_0x23659c['push'](_0x249028['slice'](0x4,_0x249028[_0xf407('0x1a')])[_0xf407('0x1c')](','));break;case _0xf407('0x26'):var _0x50c461=_0x2aa4c3[_0xf407('0x1f')][_0xf407('0x20')](',');_0x23659c[_0xf407('0x22')](_0x50c461[0x0]);_0x23659c['push'](_0x50c461[0x1]);_0x23659c[_0xf407('0x22')](_0x50c461[0x2]);_0x23659c['push'](_0x50c461[0x3]);_0x23659c[_0xf407('0x22')](_0x50c461[_0xf407('0x23')](0x4,_0x50c461['length'])['join'](','));break;case'message':_0x23659c[_0xf407('0x22')](_0x2aa4c3[_0xf407('0x1f')]);break;case'tag':_0x23659c[_0xf407('0x22')](_0x2aa4c3[_0xf407('0x27')]);_0x23659c[_0xf407('0x22')](_0x2aa4c3[_0xf407('0x1f')]);break;case'tvox':var _0x478d81=utils[_0xf407('0x28')](_0x454710[_0xf407('0x29')][_0xf407('0x2a')],_0x454710);var _0x38d7e1=_0x2aa4c3[_0xf407('0x1f')][_0xf407('0x20')](',');_0x23659c[_0xf407('0x22')](_0x38d7e1[0x0]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x1]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x2]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x3]);_0x23659c['push'](_0x38d7e1[0x4]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x5]);_0x23659c['push'](_0x38d7e1[0x6]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x7]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x8]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0x9]);_0x23659c[_0xf407('0x22')](_0x38d7e1[0xa]);_0x23659c[_0xf407('0x22')](_0x454710['interaction']['id']);_0x23659c[_0xf407('0x22')](_0x454710[_0xf407('0x16')]['id']);_0x23659c[_0xf407('0x22')](_0x2aa4c3[_0xf407('0x2b')]);_0x23659c['push'](_0x454710[_0xf407('0x17')][_0xf407('0x2c')]);_0x23659c[_0xf407('0x22')](_0x454710['body']['body']);_0x23659c[_0xf407('0x22')](_0x478d81);break;default:_0x23659c=_['isNil'](_0x2aa4c3['appdata'])?[]:_0x2aa4c3[_0xf407('0x1f')][_0xf407('0x20')](',');}var _0x4890ae={'id':util[_0xf407('0xe')](_0xf407('0x2d'),_0x1cdc81,_0x2aa4c3['id'],_0x2aa4c3[_0xf407('0x1d')]),'condition':require(_0xf407('0x2e'))[_0xf407('0x2f')](_0x1cdc81,getIntervals(_0x5257ef['intervals'],_0x2aa4c3),_0x5257ef),'consequence':require(_0xf407('0x30')+_0x2aa4c3['app'])['consequence'](_0x1cdc81,_0x23659c,_0x5257ef,_0x454710),'p':_0x2aa4c3[_0xf407('0x31')]||0x0};logger[_0xf407('0x32')]('Push\x20new\x20rule',_0x4890ae['id'],_0xf407('0x33'),getIntervals(_0x5257ef[_0xf407('0x34')],_0x2aa4c3)[_0xf407('0x1c')](_0xf407('0x35')));_0x331782[_0xf407('0x22')](_0x4890ae);}else{logger[_0xf407('0x36')](_0xf407('0x37'),path[_0xf407('0x1c')](__dirname,'applications',_0x2aa4c3[_0xf407('0x1d')]+'.js'));}}_0x5257ef[_0xf407('0x38')][_0x1cdc81]=new RuleEngine(_0x331782);_0x5257ef['rules'][_0x1cdc81][_0xf407('0x39')](_0x454710,function(_0x56ea2b){logger[_0xf407('0x32')](_0xf407('0x3a'),JSON[_0xf407('0x3b')](_0x56ea2b[_0xf407('0x3c')]));if(_0x5257ef[_0xf407('0x38')][_0x1cdc81]){_0x5257ef[_0xf407('0x38')][_0x1cdc81][_0xf407('0x3d')]('complete');}});return _0x48fd5d({'code':0xc8,'message':_0x454710});}else{logger[_0xf407('0x32')](_0xf407('0x3e'));return _0x48fd5d({'code':0xc8,'message':_0x454710});}}catch(_0x440ef9){logger[_0xf407('0x36')](_0x440ef9[_0xf407('0x3f')]);return _0x768926(_0x4c1320[_0xf407('0x36')](0x1f4,_0x440ef9));}}return _0x768926('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2cb6e1){var _0x1e74aa=this;return new Promise(function(_0x19951d,_0xb03de0){if(_0x2cb6e1[_0xf407('0x40')]&&_0x2cb6e1[_0xf407('0x40')]['id']){if(_0x5257ef['agents'][_0x2cb6e1[_0xf407('0x40')]['id']]){_0x5257ef[_0xf407('0x41')][_0x2cb6e1[_0xf407('0x40')]['id']]['busy']=![];_0x5257ef[_0xf407('0x41')][_0x2cb6e1['agent']['id']][_0xf407('0x42')]=undefined;}}if(_0x2cb6e1[_0xf407('0x16')]&&_0x2cb6e1[_0xf407('0x16')]['id']){try{var _0x2c39d1=getId(_0x2cb6e1['channel'],_0x2cb6e1[_0xf407('0x16')]?_0x2cb6e1[_0xf407('0x16')]['id']:0x0,_0x2cb6e1[_0xf407('0x17')]?_0x2cb6e1['interaction']['id']:0x0);if(_0x5257ef['rules'][_0x2c39d1]){_0x5257ef[_0xf407('0x38')][_0x2c39d1][_0xf407('0x3d')](_0xf407('0x43'));if(rpc[_0x2cb6e1['channel']+_0xf407('0x44')]){rpc[_0x2cb6e1[_0xf407('0x15')]+_0xf407('0x44')][_0xf407('0x45')](_0x2c39d1,{'UserId':_0x2cb6e1['message'][_0xf407('0x46')]})[_0xf407('0x47')](function(_0x4e8483){logger[_0xf407('0x36')](_0xf407('0x48'));});}}return _0x19951d({'code':0xc8,'message':_0x2cb6e1});}catch(_0x274a87){logger['error'](_0x274a87[_0xf407('0x3f')]);return _0xb03de0(_0x1e74aa[_0xf407('0x36')](0x1f4,_0x274a87));}}logger[_0xf407('0x36')](_0xf407('0x49'));return _0xb03de0(_0x1e74aa['error'](0x1f4,_0xf407('0x49')));});},'RejectMessage':function(_0x3a7210){var _0x5b69d2=this;return new Promise(function(_0x179b54,_0x588fd7){if(_0x3a7210[_0xf407('0x40')]&&_0x3a7210[_0xf407('0x40')]['id']){try{if(_0x5257ef['agents'][_0x3a7210[_0xf407('0x40')]['id']]){_0x5257ef[_0xf407('0x41')][_0x3a7210['agent']['id']][_0xf407('0x4a')]=![];_0x5257ef['agents'][_0x3a7210['agent']['id']][_0xf407('0x42')]=undefined;}return _0x179b54({'code':0xc8,'message':_0x3a7210});}catch(_0x5b6693){logger[_0xf407('0x36')](_0x5b6693[_0xf407('0x3f')]);return _0x588fd7(_0x5b69d2[_0xf407('0x36')](0x1f4,_0x5b6693));}}logger[_0xf407('0x36')]('message\x20is\x20empty');return _0x588fd7(_0x5b69d2['error'](0x1f4,_0xf407('0x49')));});},'AbandonInteraction':function(_0x34cdf1){var _0x417bdd=this;return new Promise(function(_0x1a9fb2,_0x264cd2){if(_0x34cdf1[_0xf407('0x15')]&&_0x34cdf1['interaction']&&_0x34cdf1[_0xf407('0x17')]['id']){try{var _0x27f280=getId(_0x34cdf1[_0xf407('0x15')],_0x34cdf1[_0xf407('0x16')]?_0x34cdf1[_0xf407('0x16')]['id']:0x0,_0x34cdf1[_0xf407('0x17')]?_0x34cdf1['interaction']['id']:0x0);if(_0x5257ef[_0xf407('0x38')][_0x27f280]){_0x5257ef[_0xf407('0x38')][_0x27f280]['emit']('end');}return _0x1a9fb2({'code':0xc8,'message':_0x34cdf1});}catch(_0xa365b5){logger[_0xf407('0x36')](_0xa365b5[_0xf407('0x3f')]);return _0x264cd2(_0x417bdd[_0xf407('0x36')](0x1f4,_0xa365b5));}}logger[_0xf407('0x36')](_0xf407('0x49'));return _0x264cd2(_0x417bdd[_0xf407('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x54c8cb){var _0x4782fa=this;return new Promise(function(_0x30aa30,_0x2ce443){if(_0x5257ef[_0xf407('0x41')][_0xf407('0x4b')](_0x54c8cb['id'])){for(var _0x2859d6 in _0x54c8cb[_0xf407('0x4c')]){if(_0x54c8cb['capacity'][_0xf407('0x4b')](_0x2859d6)){if(_0x5257ef[_0xf407('0x41')][_0x54c8cb['id']]['hasOwnProperty'](_0x2859d6+_0xf407('0x4d'))){_0x5257ef[_0xf407('0x41')][_0x54c8cb['id']][_0x2859d6+_0xf407('0x4d')]=parseInt(_0x54c8cb[_0xf407('0x4c')][_0x2859d6],0xa);}}}_0x5257ef[_0xf407('0x41')][_0x54c8cb['id']][_0xf407('0x4e')]();return _0x30aa30({'code':0xc8,'message':_0x5257ef[_0xf407('0x41')][_0x54c8cb['id']]});}else{return _0x2ce443(_0x4782fa[_0xf407('0x36')](0x1f4,_0xf407('0x4f')));}});},'Agents':function(_0x274c55){return new Promise(function(_0x5413cf,_0x32642f){var _0x15bde9=_[_0xf407('0x50')](_0x5257ef[_0xf407('0x41')]);_0x5413cf({'count':_0x15bde9['length'],'rows':_0x15bde9});});},'ChatQueues':function(_0x249ab1){return new Promise(function(_0x215c09,_0x4bab98){var _0x5f3452=[];for(var _0x1b34d4 in _0x5257ef[_0xf407('0x51')]){if(_0x5257ef[_0xf407('0x51')][_0xf407('0x4b')](_0x1b34d4)){var _0x3d9ce4=_0x5257ef[_0xf407('0x51')][_0x1b34d4];var _0x18d511={'id':_0x3d9ce4['id'],'available':_0x3d9ce4[_0xf407('0x52')],'loggedIn':_0x3d9ce4[_0xf407('0x53')],'name':_0x3d9ce4[_0xf407('0x54')],'paused':_0x3d9ce4[_0xf407('0x55')],'waiting':_0x3d9ce4[_0xf407('0x56')]};_0x5f3452[_0xf407('0x22')](_0x18d511);}}_0x215c09({'count':_0x5f3452[_0xf407('0x1a')],'rows':_0x5f3452});});},'MailQueues':function(_0x4e4221){return new Promise(function(_0x568e4e,_0x8dc40d){var _0x1cbfa0=[];for(var _0x183bbf in _0x5257ef[_0xf407('0x57')]){if(_0x5257ef[_0xf407('0x57')]['hasOwnProperty'](_0x183bbf)){var _0x5668e0=_0x5257ef['mailQueues'][_0x183bbf];var _0x12f0ab={'id':_0x5668e0['id'],'available':_0x5668e0[_0xf407('0x52')],'loggedIn':_0x5668e0[_0xf407('0x53')],'name':_0x5668e0[_0xf407('0x54')],'paused':_0x5668e0[_0xf407('0x55')],'waiting':_0x5668e0[_0xf407('0x56')]};_0x1cbfa0[_0xf407('0x22')](_0x12f0ab);}}_0x568e4e({'count':_0x1cbfa0['length'],'rows':_0x1cbfa0});});},'OpenchannelQueues':function(_0x4f6fbf){return new Promise(function(_0x2510c0,_0x32d076){var _0x3974e2=[];for(var _0x17cc96 in _0x5257ef[_0xf407('0x58')]){if(_0x5257ef[_0xf407('0x58')][_0xf407('0x4b')](_0x17cc96)){var _0x2494d0=_0x5257ef[_0xf407('0x58')][_0x17cc96];var _0x11a92f={'id':_0x2494d0['id'],'available':_0x2494d0[_0xf407('0x52')],'loggedIn':_0x2494d0['loggedIn'],'name':_0x2494d0[_0xf407('0x54')],'paused':_0x2494d0[_0xf407('0x55')],'waiting':_0x2494d0[_0xf407('0x56')]};_0x3974e2[_0xf407('0x22')](_0x11a92f);}}_0x2510c0({'count':_0x3974e2['length'],'rows':_0x3974e2});});},'SmsQueues':function(_0x85f1d3){return new Promise(function(_0x2834de,_0x56feaf){var _0x2299bc=[];for(var _0x4aa1e0 in _0x5257ef[_0xf407('0x59')]){if(_0x5257ef[_0xf407('0x59')][_0xf407('0x4b')](_0x4aa1e0)){var _0x11299a=_0x5257ef[_0xf407('0x59')][_0x4aa1e0];var _0xb08d83={'id':_0x11299a['id'],'available':_0x11299a['available'],'loggedIn':_0x11299a[_0xf407('0x53')],'name':_0x11299a[_0xf407('0x54')],'paused':_0x11299a[_0xf407('0x55')],'waiting':_0x11299a['waiting']};_0x2299bc[_0xf407('0x22')](_0xb08d83);}}_0x2834de({'count':_0x2299bc[_0xf407('0x1a')],'rows':_0x2299bc});});},'FaxQueues':function(_0x1c85b3){return new Promise(function(_0x18431f,_0x1ca487){var _0x1f5848=[];for(var _0x155412 in _0x5257ef[_0xf407('0x5a')]){if(_0x5257ef['faxQueues'][_0xf407('0x4b')](_0x155412)){var _0x4e85e5=_0x5257ef[_0xf407('0x5a')][_0x155412];var _0xf863cb={'id':_0x4e85e5['id'],'available':_0x4e85e5[_0xf407('0x52')],'loggedIn':_0x4e85e5['loggedIn'],'name':_0x4e85e5['name'],'paused':_0x4e85e5[_0xf407('0x55')],'waiting':_0x4e85e5[_0xf407('0x56')]};_0x1f5848[_0xf407('0x22')](_0xf863cb);}}_0x18431f({'count':_0x1f5848[_0xf407('0x1a')],'rows':_0x1f5848});});},'WhatsappQueues':function(_0x284608){return new Promise(function(_0xa79502,_0x527b51){var _0x4d60a6=[];for(var _0x38372f in _0x5257ef[_0xf407('0x5b')]){if(_0x5257ef[_0xf407('0x5b')][_0xf407('0x4b')](_0x38372f)){var _0xd152a3=_0x5257ef['whatsappQueues'][_0x38372f];var _0x577b77={'id':_0xd152a3['id'],'available':_0xd152a3[_0xf407('0x52')],'loggedIn':_0xd152a3[_0xf407('0x53')],'name':_0xd152a3[_0xf407('0x54')],'paused':_0xd152a3[_0xf407('0x55')],'waiting':_0xd152a3[_0xf407('0x56')]};_0x4d60a6[_0xf407('0x22')](_0x577b77);}}_0xa79502({'count':_0x4d60a6[_0xf407('0x1a')],'rows':_0x4d60a6});});},'ChatQueuesWaitingInteractions':function(_0x13c562){return new Promise(function(_0x2e8ce0,_0x3309cf){var _0x321717=_[_0xf407('0x50')](_0x5257ef[_0xf407('0x5c')]);_0x2e8ce0({'count':_0x321717[_0xf407('0x1a')],'rows':_0x321717});});},'MailQueuesWaitingInteractions':function(_0x4c2791){return new Promise(function(_0x4e6495,_0x4d3d69){var _0x5c352c=_[_0xf407('0x50')](_0x5257ef[_0xf407('0x5d')]);_0x4e6495({'count':_0x5c352c[_0xf407('0x1a')],'rows':_0x5c352c});});},'OpenchannelQueuesWaitingInteractions':function(_0x58c951){return new Promise(function(_0x5b4d93,_0x309a8f){var _0x3004aa=_[_0xf407('0x50')](_0x5257ef['openchannelQueuesWaitingInteractions']);_0x5b4d93({'count':_0x3004aa['length'],'rows':_0x3004aa});});},'SmsQueuesWaitingInteractions':function(_0x58e1d7){return new Promise(function(_0xc21479,_0x1fca85){var _0x3630c9=_[_0xf407('0x50')](_0x5257ef[_0xf407('0x5e')]);_0xc21479({'count':_0x3630c9[_0xf407('0x1a')],'rows':_0x3630c9});});},'FaxQueuesWaitingInteractions':function(_0x3d120e){return new Promise(function(_0x77951d,_0x3a8bc4){var _0x118b07=_['values'](_0x5257ef[_0xf407('0x5f')]);_0x77951d({'count':_0x118b07[_0xf407('0x1a')],'rows':_0x118b07});});},'WhatsappQueuesWaitingInteractions':function(_0x3182a6){return new Promise(function(_0x18abec,_0x128f50){var _0x9cb570=_[_0xf407('0x50')](_0x5257ef['whatsappQueuesWaitingInteractions']);_0x18abec({'count':_0x9cb570[_0xf407('0x1a')],'rows':_0x9cb570});});}};var _0x3500ab=jayson['server'](_0x593e36)[_0xf407('0x60')]();_0x3500ab['on'](_0xf407('0x36'),function(_0x515e20){logger[_0xf407('0x36')](JSON[_0xf407('0x3b')](_0x515e20));return _0x280a9f(_0x515e20);});_0x3500ab[_0xf407('0x14')](0x232c,_0xf407('0x61'),function(){console[_0xf407('0x62')](_0xf407('0x63'),0x232c);return _0x50bb74(_0xf407('0x64')+0x232c);});});}; \ No newline at end of file +var _0xf45e=['account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','available','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','length','join','app','.js','toLowerCase','appdata','split','channel','mail','push','slice','amazonlex','tag','TagId','tvox'];(function(_0x1d136e,_0x3c20c3){var _0x280fcf=function(_0x10a84f){while(--_0x10a84f){_0x1d136e['push'](_0x1d136e['shift']());}};_0x280fcf(++_0x3c20c3);}(_0xf45e,0x115));var _0xef45=function(_0x584ca3,_0x498aaa){_0x584ca3=_0x584ca3-0x0;var _0x1d26a0=_0xf45e[_0x584ca3];return _0x1d26a0;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xef45('0x2'));var uuid=require(_0xef45('0x3'));var utils=require(_0xef45('0x4'));var config=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var rpc={'openchannelQueueReport':require(_0xef45('0x8')),'mailQueueReport':require(_0xef45('0x9')),'chatQueueReport':require(_0xef45('0xa')),'smsQueueReport':require(_0xef45('0xb')),'faxQueueReport':require(_0xef45('0xc')),'whatsappQueueReport':require(_0xef45('0xd'))};var RuleEngine=require(_0xef45('0xe'));function getId(_0x1e0def,_0x268ef6,_0x143523){return util[_0xef45('0xf')](_0xef45('0x10'),_0x1e0def,_0x268ef6||0x0,_0x143523||0x0);}function getIntervals(_0xdac512,_0x4d5cc7){var _0x3e852f=[];if(!_[_0xef45('0x11')](_0x4d5cc7[_0xef45('0x12')])&&!_[_0xef45('0x11')](_0xdac512[_0x4d5cc7[_0xef45('0x12')]])&&!_[_0xef45('0x11')](_0xdac512[_0x4d5cc7['IntervalId']][_0xef45('0x13')])){_0x3e852f=_[_0xef45('0x14')](_0xdac512[_0x4d5cc7[_0xef45('0x12')]][_0xef45('0x13')],_0xef45('0x15'));}else if(!_['isNil'](_0x4d5cc7['interval'])){_0x3e852f=[_0x4d5cc7[_0xef45('0x15')]];}return _0x3e852f;}exports['listen']=function(_0x2ae89a){_0x2ae89a[_0xef45('0x16')]={};return new BPromise(function(_0x37c207,_0x536e46){var _0x5b3136={'Start':function(_0x29c0c4){var _0x5530e6=this;return new Promise(function(_0x11cd3a,_0x2a342e){if(_0x29c0c4){try{var _0x1068a1=[];var _0x3f40e5=getId(_0x29c0c4['channel'],_0x29c0c4['message']?_0x29c0c4[_0xef45('0x17')]['id']:0x0,_0x29c0c4[_0xef45('0x18')]?_0x29c0c4[_0xef45('0x18')]['id']:0x0);if(_0x29c0c4[_0xef45('0x19')]&&_['isArray'](_0x29c0c4['applications'])&&_0x29c0c4[_0xef45('0x19')][_0xef45('0x1a')]){for(var _0xba941b=0x0;_0xba941b<_0x29c0c4[_0xef45('0x19')][_0xef45('0x1a')];_0xba941b+=0x1){var _0xde347f=_0x29c0c4[_0xef45('0x19')][_0xba941b];if(fs['existsSync'](path[_0xef45('0x1b')](__dirname,_0xef45('0x19'),_0xde347f[_0xef45('0x1c')]+_0xef45('0x1d')))){var _0x27322f=[];switch(_0xde347f['app'][_0xef45('0x1e')]()){case'autoreply':var _0x4aabb7=_0xde347f[_0xef45('0x1f')][_0xef45('0x20')](',');if(_0x29c0c4[_0xef45('0x21')]===_0xef45('0x22')){_0x27322f[_0xef45('0x23')](_0x4aabb7[0x0]);_0x27322f[_0xef45('0x23')](_0x4aabb7[0x1]);_0x27322f[_0xef45('0x23')](_0x4aabb7['slice'](0x2,_0x4aabb7[_0xef45('0x1a')])['join'](','));}else{_0x27322f[_0xef45('0x23')](_0x4aabb7[0x0]);_0x27322f[_0xef45('0x23')](_0x4aabb7['slice'](0x1,_0x4aabb7[_0xef45('0x1a')])[_0xef45('0x1b')](','));}break;case'dialogflow':var _0x1096af=_0xde347f['appdata']['split'](',');_0x27322f['push'](_0x1096af[0x0]);_0x27322f['push'](_0x1096af[0x1]);_0x27322f[_0xef45('0x23')](_0x1096af[_0xef45('0x24')](0x2,_0x1096af[_0xef45('0x1a')])[_0xef45('0x1b')](','));break;case'dialogflowv2':var _0x18f304=_0xde347f['appdata'][_0xef45('0x20')](',');_0x27322f['push'](_0x18f304[0x0]);_0x27322f[_0xef45('0x23')](_0x18f304[0x1]);_0x27322f['push'](_0x18f304[0x2]);_0x27322f['push'](_0x18f304[0x3]);_0x27322f[_0xef45('0x23')](_0x18f304[_0xef45('0x24')](0x4,_0x18f304[_0xef45('0x1a')])[_0xef45('0x1b')](','));break;case _0xef45('0x25'):var _0x5d56ae=_0xde347f['appdata']['split'](',');_0x27322f[_0xef45('0x23')](_0x5d56ae[0x0]);_0x27322f[_0xef45('0x23')](_0x5d56ae[0x1]);_0x27322f[_0xef45('0x23')](_0x5d56ae[0x2]);_0x27322f[_0xef45('0x23')](_0x5d56ae[0x3]);_0x27322f[_0xef45('0x23')](_0x5d56ae[_0xef45('0x24')](0x4,_0x5d56ae[_0xef45('0x1a')])['join'](','));break;case'message':_0x27322f[_0xef45('0x23')](_0xde347f['appdata']);break;case _0xef45('0x26'):_0x27322f['push'](_0xde347f[_0xef45('0x27')]);_0x27322f[_0xef45('0x23')](_0xde347f[_0xef45('0x1f')]);break;case _0xef45('0x28'):var _0x3d5dbf=utils['getMustacheRender'](_0x29c0c4[_0xef45('0x29')][_0xef45('0x2a')],_0x29c0c4);var _0x9df07e=_0xde347f['appdata']['split'](',');_0x27322f[_0xef45('0x23')](_0x9df07e[0x0]);_0x27322f[_0xef45('0x23')](_0x9df07e[0x1]);_0x27322f['push'](_0x9df07e[0x2]);_0x27322f[_0xef45('0x23')](_0x9df07e[0x3]);_0x27322f['push'](_0x9df07e[0x4]);_0x27322f['push'](_0x9df07e[0x5]);_0x27322f[_0xef45('0x23')](_0x9df07e[0x6]);_0x27322f[_0xef45('0x23')](_0x9df07e[0x7]);_0x27322f[_0xef45('0x23')](_0x9df07e[0x8]);_0x27322f['push'](_0x9df07e[0x9]);_0x27322f[_0xef45('0x23')](_0x9df07e[0xa]);_0x27322f[_0xef45('0x23')](_0x29c0c4[_0xef45('0x18')]['id']);_0x27322f[_0xef45('0x23')](_0x29c0c4['message']['id']);_0x27322f['push'](_0xde347f[_0xef45('0x2b')]);_0x27322f[_0xef45('0x23')](_0x29c0c4[_0xef45('0x18')][_0xef45('0x2c')]);_0x27322f[_0xef45('0x23')](_0x29c0c4[_0xef45('0x2d')][_0xef45('0x2d')]);_0x27322f[_0xef45('0x23')](_0x3d5dbf);break;default:_0x27322f=_['isNil'](_0xde347f['appdata'])?[]:_0xde347f[_0xef45('0x1f')][_0xef45('0x20')](',');}var _0x154e72={'id':util[_0xef45('0xf')](_0xef45('0x2e'),_0x3f40e5,_0xde347f['id'],_0xde347f[_0xef45('0x1c')]),'condition':require(_0xef45('0x2f'))[_0xef45('0x30')](_0x3f40e5,getIntervals(_0x2ae89a[_0xef45('0x31')],_0xde347f),_0x2ae89a),'consequence':require(_0xef45('0x32')+_0xde347f[_0xef45('0x1c')])[_0xef45('0x33')](_0x3f40e5,_0x27322f,_0x2ae89a,_0x29c0c4),'p':_0xde347f[_0xef45('0x34')]||0x0};logger[_0xef45('0x35')](_0xef45('0x36'),_0x154e72['id'],_0xef45('0x37'),getIntervals(_0x2ae89a['intervals'],_0xde347f)[_0xef45('0x1b')](_0xef45('0x38')));_0x1068a1[_0xef45('0x23')](_0x154e72);}else{logger[_0xef45('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xef45('0x1b')](__dirname,'applications',_0xde347f[_0xef45('0x1c')]+'.js'));}}_0x2ae89a[_0xef45('0x16')][_0x3f40e5]=new RuleEngine(_0x1068a1);_0x2ae89a[_0xef45('0x16')][_0x3f40e5][_0xef45('0x3a')](_0x29c0c4,function(_0x36e81a){logger[_0xef45('0x35')](_0xef45('0x3b'),JSON[_0xef45('0x3c')](_0x36e81a['matchPath']));if(_0x2ae89a[_0xef45('0x16')][_0x3f40e5]){_0x2ae89a[_0xef45('0x16')][_0x3f40e5][_0xef45('0x3d')](_0xef45('0x3e'));}});return _0x11cd3a({'code':0xc8,'message':_0x29c0c4});}else{logger[_0xef45('0x35')](_0xef45('0x3f'));return _0x11cd3a({'code':0xc8,'message':_0x29c0c4});}}catch(_0xc692c0){logger[_0xef45('0x39')](_0xc692c0[_0xef45('0x40')]);return _0x2a342e(_0x5530e6[_0xef45('0x39')](0x1f4,_0xc692c0));}}return _0x2a342e(_0xef45('0x41'));});},'AcceptMessage':function(_0x3a246c){var _0x2ee0ba=this;return new Promise(function(_0x46861b,_0x32a3a2){if(_0x3a246c['agent']&&_0x3a246c[_0xef45('0x42')]['id']){if(_0x2ae89a[_0xef45('0x43')][_0x3a246c[_0xef45('0x42')]['id']]){_0x2ae89a['agents'][_0x3a246c['agent']['id']]['busy']=![];_0x2ae89a[_0xef45('0x43')][_0x3a246c[_0xef45('0x42')]['id']][_0xef45('0x44')]=undefined;}}if(_0x3a246c[_0xef45('0x17')]&&_0x3a246c[_0xef45('0x17')]['id']){try{var _0x21fe04=getId(_0x3a246c['channel'],_0x3a246c[_0xef45('0x17')]?_0x3a246c[_0xef45('0x17')]['id']:0x0,_0x3a246c[_0xef45('0x18')]?_0x3a246c['interaction']['id']:0x0);if(_0x2ae89a['rules'][_0x21fe04]){_0x2ae89a[_0xef45('0x16')][_0x21fe04][_0xef45('0x3d')]('end');if(rpc[_0x3a246c[_0xef45('0x21')]+_0xef45('0x45')]){rpc[_0x3a246c[_0xef45('0x21')]+_0xef45('0x45')][_0xef45('0x46')](_0x21fe04,{'UserId':_0x3a246c[_0xef45('0x17')][_0xef45('0x47')]})[_0xef45('0x48')](function(_0x1961b4){logger[_0xef45('0x39')](_0xef45('0x49'));});}}return _0x46861b({'code':0xc8,'message':_0x3a246c});}catch(_0x453329){logger[_0xef45('0x39')](_0x453329[_0xef45('0x40')]);return _0x32a3a2(_0x2ee0ba['error'](0x1f4,_0x453329));}}logger[_0xef45('0x39')](_0xef45('0x4a'));return _0x32a3a2(_0x2ee0ba[_0xef45('0x39')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x416236){var _0x3f9b9a=this;return new Promise(function(_0x464bda,_0x1531ea){if(_0x416236['agent']&&_0x416236[_0xef45('0x42')]['id']){try{if(_0x2ae89a[_0xef45('0x43')][_0x416236[_0xef45('0x42')]['id']]){_0x2ae89a[_0xef45('0x43')][_0x416236[_0xef45('0x42')]['id']][_0xef45('0x4b')]=![];_0x2ae89a[_0xef45('0x43')][_0x416236[_0xef45('0x42')]['id']][_0xef45('0x44')]=undefined;}return _0x464bda({'code':0xc8,'message':_0x416236});}catch(_0x295fd6){logger[_0xef45('0x39')](_0x295fd6[_0xef45('0x40')]);return _0x1531ea(_0x3f9b9a['error'](0x1f4,_0x295fd6));}}logger[_0xef45('0x39')](_0xef45('0x4a'));return _0x1531ea(_0x3f9b9a[_0xef45('0x39')](0x1f4,_0xef45('0x4a')));});},'AbandonInteraction':function(_0x2fe9cf){var _0x32232f=this;return new Promise(function(_0x4f57f0,_0x4f75a3){if(_0x2fe9cf[_0xef45('0x21')]&&_0x2fe9cf['interaction']&&_0x2fe9cf[_0xef45('0x18')]['id']){try{var _0x2841df=getId(_0x2fe9cf[_0xef45('0x21')],_0x2fe9cf['message']?_0x2fe9cf[_0xef45('0x17')]['id']:0x0,_0x2fe9cf[_0xef45('0x18')]?_0x2fe9cf['interaction']['id']:0x0);if(_0x2ae89a[_0xef45('0x16')][_0x2841df]){_0x2ae89a['rules'][_0x2841df]['emit'](_0xef45('0x4c'));}return _0x4f57f0({'code':0xc8,'message':_0x2fe9cf});}catch(_0x4f78ac){logger[_0xef45('0x39')](_0x4f78ac[_0xef45('0x40')]);return _0x4f75a3(_0x32232f[_0xef45('0x39')](0x1f4,_0x4f78ac));}}logger['error'](_0xef45('0x4a'));return _0x4f75a3(_0x32232f[_0xef45('0x39')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xe92f2b){var _0x107cf3=this;return new Promise(function(_0x3aa8ec,_0x40aec3){if(_0x2ae89a[_0xef45('0x43')][_0xef45('0x4d')](_0xe92f2b['id'])){for(var _0x3552fa in _0xe92f2b[_0xef45('0x4e')]){if(_0xe92f2b['capacity'][_0xef45('0x4d')](_0x3552fa)){if(_0x2ae89a['agents'][_0xe92f2b['id']]['hasOwnProperty'](_0x3552fa+_0xef45('0x4f'))){_0x2ae89a['agents'][_0xe92f2b['id']][_0x3552fa+_0xef45('0x4f')]=parseInt(_0xe92f2b[_0xef45('0x4e')][_0x3552fa],0xa);}}}_0x2ae89a['agents'][_0xe92f2b['id']][_0xef45('0x50')]();return _0x3aa8ec({'code':0xc8,'message':_0x2ae89a[_0xef45('0x43')][_0xe92f2b['id']]});}else{return _0x40aec3(_0x107cf3[_0xef45('0x39')](0x1f4,_0xef45('0x51')));}});},'Agents':function(_0x19bc2b){return new Promise(function(_0x37932e,_0x5b04eb){var _0x3a7cf2=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x43')]);_0x37932e({'count':_0x3a7cf2[_0xef45('0x1a')],'rows':_0x3a7cf2});});},'ChatQueues':function(_0x1d8c97){return new Promise(function(_0x51f841,_0x2a7857){var _0x5e485d=[];for(var _0x10723e in _0x2ae89a[_0xef45('0x53')]){if(_0x2ae89a['chatQueues'][_0xef45('0x4d')](_0x10723e)){var _0x322df5=_0x2ae89a[_0xef45('0x53')][_0x10723e];var _0x49a4ef={'id':_0x322df5['id'],'available':_0x322df5['available'],'loggedIn':_0x322df5[_0xef45('0x54')],'name':_0x322df5[_0xef45('0x55')],'paused':_0x322df5[_0xef45('0x56')],'waiting':_0x322df5['waiting']};_0x5e485d[_0xef45('0x23')](_0x49a4ef);}}_0x51f841({'count':_0x5e485d[_0xef45('0x1a')],'rows':_0x5e485d});});},'MailQueues':function(_0x49131e){return new Promise(function(_0xb7784f,_0x5a7af6){var _0x2ea2c6=[];for(var _0x6d0e51 in _0x2ae89a[_0xef45('0x57')]){if(_0x2ae89a[_0xef45('0x57')][_0xef45('0x4d')](_0x6d0e51)){var _0xfa4b8a=_0x2ae89a[_0xef45('0x57')][_0x6d0e51];var _0x287f54={'id':_0xfa4b8a['id'],'available':_0xfa4b8a['available'],'loggedIn':_0xfa4b8a[_0xef45('0x54')],'name':_0xfa4b8a[_0xef45('0x55')],'paused':_0xfa4b8a[_0xef45('0x56')],'waiting':_0xfa4b8a[_0xef45('0x58')]};_0x2ea2c6[_0xef45('0x23')](_0x287f54);}}_0xb7784f({'count':_0x2ea2c6[_0xef45('0x1a')],'rows':_0x2ea2c6});});},'OpenchannelQueues':function(_0xef7b79){return new Promise(function(_0x14ae27,_0x444d39){var _0x41952f=[];for(var _0xbf9898 in _0x2ae89a['openchannelQueues']){if(_0x2ae89a[_0xef45('0x59')][_0xef45('0x4d')](_0xbf9898)){var _0x3a3aa3=_0x2ae89a[_0xef45('0x59')][_0xbf9898];var _0x2b0bca={'id':_0x3a3aa3['id'],'available':_0x3a3aa3['available'],'loggedIn':_0x3a3aa3[_0xef45('0x54')],'name':_0x3a3aa3[_0xef45('0x55')],'paused':_0x3a3aa3['paused'],'waiting':_0x3a3aa3['waiting']};_0x41952f[_0xef45('0x23')](_0x2b0bca);}}_0x14ae27({'count':_0x41952f[_0xef45('0x1a')],'rows':_0x41952f});});},'SmsQueues':function(_0x4b3078){return new Promise(function(_0x5c0e8b,_0x49cb4f){var _0x6b7e57=[];for(var _0x297b2e in _0x2ae89a['smsQueues']){if(_0x2ae89a['smsQueues'][_0xef45('0x4d')](_0x297b2e)){var _0x48580b=_0x2ae89a[_0xef45('0x5a')][_0x297b2e];var _0x3e4f43={'id':_0x48580b['id'],'available':_0x48580b[_0xef45('0x5b')],'loggedIn':_0x48580b[_0xef45('0x54')],'name':_0x48580b[_0xef45('0x55')],'paused':_0x48580b[_0xef45('0x56')],'waiting':_0x48580b[_0xef45('0x58')]};_0x6b7e57['push'](_0x3e4f43);}}_0x5c0e8b({'count':_0x6b7e57[_0xef45('0x1a')],'rows':_0x6b7e57});});},'FaxQueues':function(_0x36f7bb){return new Promise(function(_0x19548b,_0x26d598){var _0x3505d7=[];for(var _0x3c7a0f in _0x2ae89a['faxQueues']){if(_0x2ae89a['faxQueues'][_0xef45('0x4d')](_0x3c7a0f)){var _0x13f5b6=_0x2ae89a[_0xef45('0x5c')][_0x3c7a0f];var _0x34874e={'id':_0x13f5b6['id'],'available':_0x13f5b6[_0xef45('0x5b')],'loggedIn':_0x13f5b6[_0xef45('0x54')],'name':_0x13f5b6[_0xef45('0x55')],'paused':_0x13f5b6[_0xef45('0x56')],'waiting':_0x13f5b6['waiting']};_0x3505d7[_0xef45('0x23')](_0x34874e);}}_0x19548b({'count':_0x3505d7[_0xef45('0x1a')],'rows':_0x3505d7});});},'WhatsappQueues':function(_0x2591ad){return new Promise(function(_0x388283,_0x7a0cf4){var _0x19ddd7=[];for(var _0x2f878b in _0x2ae89a['whatsappQueues']){if(_0x2ae89a[_0xef45('0x5d')]['hasOwnProperty'](_0x2f878b)){var _0x87502=_0x2ae89a[_0xef45('0x5d')][_0x2f878b];var _0x54df7c={'id':_0x87502['id'],'available':_0x87502[_0xef45('0x5b')],'loggedIn':_0x87502[_0xef45('0x54')],'name':_0x87502[_0xef45('0x55')],'paused':_0x87502['paused'],'waiting':_0x87502[_0xef45('0x58')]};_0x19ddd7['push'](_0x54df7c);}}_0x388283({'count':_0x19ddd7[_0xef45('0x1a')],'rows':_0x19ddd7});});},'ChatQueuesWaitingInteractions':function(_0x2bcb1c){return new Promise(function(_0x32a346,_0x3179ec){var _0x51ffc3=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x5e')]);_0x32a346({'count':_0x51ffc3[_0xef45('0x1a')],'rows':_0x51ffc3});});},'MailQueuesWaitingInteractions':function(_0x4de8e9){return new Promise(function(_0x40f7a8,_0x7fdab3){var _0x3fa1e9=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x5f')]);_0x40f7a8({'count':_0x3fa1e9['length'],'rows':_0x3fa1e9});});},'OpenchannelQueuesWaitingInteractions':function(_0x1cf416){return new Promise(function(_0x322b05,_0x20f03c){var _0x34ff2b=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x60')]);_0x322b05({'count':_0x34ff2b[_0xef45('0x1a')],'rows':_0x34ff2b});});},'SmsQueuesWaitingInteractions':function(_0x3ab5d6){return new Promise(function(_0xb896b,_0x598bf9){var _0xd3a51e=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x61')]);_0xb896b({'count':_0xd3a51e['length'],'rows':_0xd3a51e});});},'FaxQueuesWaitingInteractions':function(_0xcd8038){return new Promise(function(_0x4fbf84,_0x32964d){var _0x343cb9=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x62')]);_0x4fbf84({'count':_0x343cb9[_0xef45('0x1a')],'rows':_0x343cb9});});},'WhatsappQueuesWaitingInteractions':function(_0x3474fb){return new Promise(function(_0x1816e5,_0xa9261b){var _0xc93df8=_[_0xef45('0x52')](_0x2ae89a[_0xef45('0x63')]);_0x1816e5({'count':_0xc93df8[_0xef45('0x1a')],'rows':_0xc93df8});});}};var _0x41916f=jayson[_0xef45('0x64')](_0x5b3136)[_0xef45('0x65')]();_0x41916f['on'](_0xef45('0x39'),function(_0x36fa20){logger[_0xef45('0x39')](JSON[_0xef45('0x3c')](_0x36fa20));return _0x536e46(_0x36fa20);});_0x41916f[_0xef45('0x66')](0x232c,_0xef45('0x67'),function(){console[_0xef45('0x68')](_0xef45('0x69'),0x232c);return _0x37c207('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 168f798..f211707 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 _0x2b4e=['then','error','message','result','catch','rules','info','stop','length','push','Command','format','iftime\x20%s','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','bluebird','jayson/promise','http','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2b4e,0x1b6));var _0xe2b4=function(_0x515f78,_0x3b69be){_0x515f78=_0x515f78-0x0;var _0x506f6c=_0x2b4e[_0x515f78];return _0x506f6c;};'use strict';var util=require('util');var BPromise=require(_0xe2b4('0x0'));var jayson=require(_0xe2b4('0x1'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0xe2b4('0x2')]({'port':0x232a});function request(_0x2951b8,_0x438441){return new BPromise(function(_0x130358,_0x55a75d){return client[_0xe2b4('0x3')](_0x2951b8,_0x438441)[_0xe2b4('0x4')](function(_0x59199f){if(_0x59199f[_0xe2b4('0x5')]){return _0x55a75d(_0x59199f[_0xe2b4('0x5')][_0xe2b4('0x6')]);}else{return _0x130358(_0x59199f[_0xe2b4('0x7')]);}})[_0xe2b4('0x8')](function(_0x4d50b2){return _0x55a75d(_0x4d50b2);});});}exports['condition']=function(_0x124469,_0x201ca7,_0x217fa8){return function(_0x4d54d3){if(_0x217fa8[_0xe2b4('0x9')]&&!_0x217fa8[_0xe2b4('0x9')][_0x124469]){logger[_0xe2b4('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x124469);return _0x4d54d3[_0xe2b4('0xb')]();}var _0x1be886=[];for(var _0x2613c6=0x0;_0x2613c6<_0x201ca7[_0xe2b4('0xc')];_0x2613c6+=0x1){_0x1be886[_0xe2b4('0xd')](request(_0xe2b4('0xe'),{'command':util[_0xe2b4('0xf')](_0xe2b4('0x10'),_0x201ca7[_0x2613c6])})[_0xe2b4('0x4')](function(_0x371813){return _0x371813&&_0x371813[_0xe2b4('0x6')]&&_0x371813[_0xe2b4('0x6')][_0xe2b4('0x11')](_0xe2b4('0x12'))>=0x0?!![]:![];})[_0xe2b4('0x8')](function(_0x4925f6){logger[_0xe2b4('0x5')]('[%s][INTERVAL]\x20%s',_0x124469,_0x201ca7[_0x2613c6]);}));}BPromise[_0xe2b4('0x13')](_0x1be886)['then'](function(_0x976aed){var _0x43cdf7=_[_0xe2b4('0x14')](_0x976aed);logger[_0xe2b4('0xa')](_0xe2b4('0x15'),_0x124469,_0x201ca7[_0xe2b4('0x16')](_0xe2b4('0x17')),_0x43cdf7);_0x4d54d3[_0xe2b4('0x18')](_0x43cdf7);})[_0xe2b4('0x8')](function(_0x3cd745){console[_0xe2b4('0x19')](_0x3cd745);logger['error'](_0xe2b4('0x15'),_0x124469,_0x201ca7['join'](_0xe2b4('0x17')),_0x3cd745['stack']);_0x4d54d3[_0xe2b4('0xb')]();});};}; \ No newline at end of file +var _0x9c60=['log','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','indexOf','catch','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when'];(function(_0x25ca44,_0x111633){var _0x4897c1=function(_0xf344b9){while(--_0xf344b9){_0x25ca44['push'](_0x25ca44['shift']());}};_0x4897c1(++_0x111633);}(_0x9c60,0xf4));var _0x09c6=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x9c60[_0x5bd426];return _0x23a7eb;};'use strict';var util=require(_0x09c6('0x0'));var BPromise=require(_0x09c6('0x1'));var jayson=require(_0x09c6('0x2'));var _=require(_0x09c6('0x3'));var logger=require(_0x09c6('0x4'))(_0x09c6('0x5'));var client=jayson['client'][_0x09c6('0x6')]({'port':0x232a});function request(_0x34e4ee,_0xadc5be){return new BPromise(function(_0x331ae9,_0x3f4efa){return client[_0x09c6('0x7')](_0x34e4ee,_0xadc5be)[_0x09c6('0x8')](function(_0xb1850){if(_0xb1850['error']){return _0x3f4efa(_0xb1850[_0x09c6('0x9')][_0x09c6('0xa')]);}else{return _0x331ae9(_0xb1850[_0x09c6('0xb')]);}})['catch'](function(_0x4d7558){return _0x3f4efa(_0x4d7558);});});}exports[_0x09c6('0xc')]=function(_0x213cfa,_0x2dd3ac,_0x5c2fcc){return function(_0x2d17f6){if(_0x5c2fcc[_0x09c6('0xd')]&&!_0x5c2fcc[_0x09c6('0xd')][_0x213cfa]){logger[_0x09c6('0xe')](_0x09c6('0xf'),_0x213cfa);return _0x2d17f6['stop']();}var _0x25ceac=[];for(var _0x598d80=0x0;_0x598d80<_0x2dd3ac[_0x09c6('0x10')];_0x598d80+=0x1){_0x25ceac[_0x09c6('0x11')](request(_0x09c6('0x12'),{'command':util[_0x09c6('0x13')]('iftime\x20%s',_0x2dd3ac[_0x598d80])})[_0x09c6('0x8')](function(_0x289917){return _0x289917&&_0x289917[_0x09c6('0xa')]&&_0x289917[_0x09c6('0xa')][_0x09c6('0x14')]('true')>=0x0?!![]:![];})[_0x09c6('0x15')](function(_0x890eb6){logger[_0x09c6('0x9')]('[%s][INTERVAL]\x20%s',_0x213cfa,_0x2dd3ac[_0x598d80]);}));}BPromise['all'](_0x25ceac)[_0x09c6('0x8')](function(_0x5a37d3){var _0x188cdb=_[_0x09c6('0x16')](_0x5a37d3);logger[_0x09c6('0xe')](_0x09c6('0x17'),_0x213cfa,_0x2dd3ac['join'](_0x09c6('0x18')),_0x188cdb);_0x2d17f6[_0x09c6('0x19')](_0x188cdb);})[_0x09c6('0x15')](function(_0xf1e191){console[_0x09c6('0x1a')](_0xf1e191);logger[_0x09c6('0x9')](_0x09c6('0x17'),_0x213cfa,_0x2dd3ac[_0x09c6('0x1b')](_0x09c6('0x18')),_0xf1e191[_0x09c6('0x1c')]);_0x2d17f6[_0x09c6('0x1d')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 29e93bb..a9f3fc6 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 _0x282b=['talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','clone','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','lastevent','called','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','holdtime','ringtime'];(function(_0x3c3852,_0x2a33d3){var _0x3bc1fe=function(_0x13e105){while(--_0x13e105){_0x3c3852['push'](_0x3c3852['shift']());}};_0x3bc1fe(++_0x2a33d3);}(_0x282b,0xec));var _0xb282=function(_0x4a0a01,_0x4f8c5c){_0x4a0a01=_0x4a0a01-0x0;var _0x296c8c=_0x282b[_0x4a0a01];return _0x296c8c;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var utils=require(_0xb282('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2251b5,_0x527989){utils['info'](util['format'](_0xb282('0x3'),_0x2251b5['uniqueid'],_0x2251b5[_0xb282('0x4')],_0x2251b5[_0xb282('0x5')],_0x2251b5[_0xb282('0x6')],_0x2251b5[_0xb282('0x7')],_0x2251b5[_0xb282('0x8')],_0x2251b5[_0xb282('0x9')],_0x2251b5['lastevent']));if(_0x2251b5['queue']){utils[_0xb282('0xa')](_0x2251b5[_0xb282('0x5')])['then'](function(_0x2928cf){if(_0x2928cf){_0x2251b5[_0xb282('0xb')]=_0x2928cf[_0xb282('0xb')];_0x2251b5[_0xb282('0xc')]=_0x2251b5['agentcomplete']?_0x2928cf['acw']:![];_0x2251b5[_0xb282('0xd')]=_0x2251b5[_0xb282('0xc')]?_0x2928cf[_0xb282('0xe')]:0x0;}utils[_0xb282('0xf')](_0xb282('0x10'),_0x2251b5);});}else{utils['request']('CreateVoiceAgentReport',_0x2251b5);}if(_0x527989){delete transfers[_0x2251b5[_0xb282('0x11')]];}else{delete agents[_0x2251b5[_0xb282('0x12')]];}}exports[_0xb282('0x13')]=function(_0x9e9072){try{utils[_0xb282('0x14')](util['format'](_0xb282('0x15'),_0x9e9072['uniqueid']),_0x9e9072);agents[_0x9e9072[_0xb282('0x12')]]=_0x9e9072;agents[_0x9e9072[_0xb282('0x12')]]['agentcalledAt']=utils['now']();agents[_0x9e9072['destuniqueid']][_0xb282('0x16')]=_0xb282('0x17');agents[_0x9e9072[_0xb282('0x12')]][_0xb282('0x9')]=null;agents[_0x9e9072[_0xb282('0x12')]]['connectedlinename']=null;utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x1a'),_0x9e9072[_0xb282('0x11')],agents[_0x9e9072[_0xb282('0x12')]]['membername'],_0x9e9072['destuniqueid']));}catch(_0xcea320){utils[_0xb282('0x1b')](util['format'](_0xb282('0x15'),_0x9e9072[_0xb282('0x11')]),_0xcea320);}};exports[_0xb282('0x1c')]=function(_0x438dbe){try{if(!_[_0xb282('0x1d')](agents[_0x438dbe['destuniqueid']])){utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x1e'),_0x438dbe['uniqueid']),_0x438dbe);utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x1f'),_0x438dbe[_0xb282('0x11')],agents[_0x438dbe[_0xb282('0x12')]]['membername'],_0x438dbe['destuniqueid']));agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x1c')]=!![];agents[_0x438dbe['destuniqueid']]['agentringnoanswerAt']=utils[_0xb282('0x20')]();agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x16')]=_0xb282('0x21');agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x22')]='timeout';agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x23')]=_0x438dbe['ringtime']?parseInt(_0x438dbe[_0xb282('0x24')])/0x3e8:0x0;agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x25')]=0x0;unanswered[_0xb282('0x26')](_0x438dbe['destuniqueid']);}}catch(_0x1520b1){utils[_0xb282('0x1b')](util[_0xb282('0x19')](_0xb282('0x1e'),_0x438dbe[_0xb282('0x11')]),_0x1520b1);}};exports[_0xb282('0x27')]=function(_0x22f657){try{_['forIn'](agents,function(_0x1b15b5,_0x1e2861){if(_0x1b15b5[_0xb282('0x11')]==_0x22f657[_0xb282('0x11')]&&!_[_0xb282('0x28')](unanswered,_0x1b15b5['destuniqueid'])){utils[_0xb282('0x14')](util['format'](_0xb282('0x29'),_0x22f657[_0xb282('0x11')]),_0x22f657);utils[_0xb282('0x18')](util['format'](_0xb282('0x2a'),_0x22f657['uniqueid'],_0x1b15b5[_0xb282('0x6')],_0x1b15b5[_0xb282('0x12')]));_0x1b15b5[_0xb282('0x1c')]=!![];_0x1b15b5[_0xb282('0x2b')]=utils[_0xb282('0x20')]();_0x1b15b5[_0xb282('0x16')]='abandoned';_0x1b15b5[_0xb282('0x22')]=_0xb282('0x2c');_0x1b15b5['holdtime']=_0x22f657['holdtime'];_0x1b15b5[_0xb282('0x25')]=0x0;writeDB(_0x1b15b5);}});}catch(_0x271643){utils[_0xb282('0x1b')](util['format']('[%s][agents][queuecallerabandon]',_0x22f657['uniqueid']),_0x271643);}};exports[_0xb282('0x2d')]=function(_0x2a7362){try{if(agents[_0x2a7362[_0xb282('0x12')]]){utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x2e'),_0x2a7362[_0xb282('0x11')]),_0x2a7362);utils['info'](util[_0xb282('0x19')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a7362[_0xb282('0x11')],agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x6')],_0x2a7362['destuniqueid']));agents[_0x2a7362[_0xb282('0x12')]]['agentconnectAt']=utils[_0xb282('0x20')]();agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x9')]=_0x2a7362[_0xb282('0x9')];agents[_0x2a7362['destuniqueid']]['connectedlinename']=_0x2a7362[_0xb282('0x2f')];agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x23')]=_0x2a7362[_0xb282('0x24')];agents[_0x2a7362['destuniqueid']][_0xb282('0x16')]='connect';_[_0xb282('0x30')](agents,function(_0x1a1b50,_0x482ff9){if(_0x1a1b50[_0xb282('0x12')]!=_0x2a7362[_0xb282('0x12')]&&_0x1a1b50[_0xb282('0x11')]==_0x2a7362[_0xb282('0x11')]){_0x1a1b50[_0xb282('0x25')]=0x0;_0x1a1b50[_0xb282('0x23')]=_0x2a7362[_0xb282('0x24')];_0x1a1b50[_0xb282('0x1c')]=!![];_0x1a1b50[_0xb282('0x2b')]=utils[_0xb282('0x20')]();_0x1a1b50[_0xb282('0x16')]=_0xb282('0x31');_0x1a1b50[_0xb282('0x22')]=_0xb282('0x31');_0x1a1b50[_0xb282('0x32')]=_0x2a7362[_0xb282('0x12')];_0x1a1b50[_0xb282('0x33')]=_0x2a7362[_0xb282('0x6')];writeDB(_0x1a1b50);}});}}catch(_0x573da7){utils[_0xb282('0x1b')](util['format'](_0xb282('0x2e'),_0x2a7362[_0xb282('0x11')]),_0x573da7);}};exports[_0xb282('0x34')]=function(_0x2f2ce8){try{if(!_[_0xb282('0x1d')](agents[_0x2f2ce8[_0xb282('0x12')]])){utils['debug'](util['format'](_0xb282('0x35'),_0x2f2ce8['uniqueid']),_0x2f2ce8);utils[_0xb282('0x18')](util[_0xb282('0x19')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f2ce8[_0xb282('0x11')],agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x6')],_0x2f2ce8['destuniqueid']));agents[_0x2f2ce8['destuniqueid']][_0xb282('0x34')]=!![];agents[_0x2f2ce8['destuniqueid']][_0xb282('0x36')]=utils[_0xb282('0x20')]();agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x25')]=utils[_0xb282('0x37')](agents[_0x2f2ce8[_0xb282('0x12')]]['agentcompleteAt'],agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x38')]);agents[_0x2f2ce8[_0xb282('0x12')]]['reason']=_0x2f2ce8[_0xb282('0x22')];agents[_0x2f2ce8['destuniqueid']][_0xb282('0x16')]='complete';writeDB(agents[_0x2f2ce8[_0xb282('0x12')]]);}}catch(_0x4ac56f){utils['error'](util['format'](_0xb282('0x35'),_0x2f2ce8[_0xb282('0x11')]),_0x4ac56f);}};exports[_0xb282('0x39')]=function(_0x7a5aa4){try{if(!_['isNil'](agents[_0x7a5aa4['transfereruniqueid']])){utils['debug'](util[_0xb282('0x19')](_0xb282('0x3a'),_0x7a5aa4[_0xb282('0x11')]),_0x7a5aa4);utils[_0xb282('0x18')](util['format'](_0xb282('0x3b'),_0x7a5aa4[_0xb282('0x11')],agents[_0x7a5aa4['transfereruniqueid']][_0xb282('0x6')],agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x11')]));agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x3d')]=!![];agents[_0x7a5aa4['transfereruniqueid']][_0xb282('0x3e')]=_0xb282('0x3f');agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x40')]=_0x7a5aa4[_0xb282('0x41')];agents[_0x7a5aa4[_0xb282('0x3c')]]['transferuniqueid']=agents[_0x7a5aa4[_0xb282('0x3c')]]['uniqueid'];}}catch(_0x4554f1){utils[_0xb282('0x1b')](util['format'](_0xb282('0x3a'),_0x7a5aa4[_0xb282('0x11')]),_0x4554f1);}};exports[_0xb282('0x42')]=function(_0x49fc44){try{utils['debug'](util[_0xb282('0x19')](_0xb282('0x43'),_0x49fc44[_0xb282('0x44')]),_0x49fc44);if(_0x49fc44['origtransfereruniqueid']==_0x49fc44[_0xb282('0x45')]){if(!_['isNil'](agents[_0x49fc44[_0xb282('0x46')]])){utils[_0xb282('0x18')](util['format'](_0xb282('0x47'),_0x49fc44['origtransfereruniqueid'],agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x6')]));agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x3d')]=!![];agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x3e')]='ATTENDED';agents[_0x49fc44[_0xb282('0x46')]]['transferexten']=_0x49fc44[_0xb282('0x48')];agents[_0x49fc44[_0xb282('0x46')]]['transferuniqueid']=_0x49fc44['origtransfereruniqueid'];}if(_0x49fc44[_0xb282('0x49')]&&agents[_0x49fc44[_0xb282('0x49')]]){agents[_0x49fc44[_0xb282('0x49')]]['agententerreason']=0x1;transfers[_0x49fc44['transfereeuniqueid']]=_[_0xb282('0x4a')](agents[_0x49fc44[_0xb282('0x49')]]);transfers[_0x49fc44[_0xb282('0x49')]]['calleridnum']=agents[_0x49fc44[_0xb282('0x46')]]['calleridnum'];transfers[_0x49fc44[_0xb282('0x49')]][_0xb282('0x4b')]=agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x4b')];transfers[_0x49fc44[_0xb282('0x49')]][_0xb282('0x4c')]=utils[_0xb282('0x20')]();transfers[_0x49fc44['transfereeuniqueid']][_0xb282('0x38')]=utils[_0xb282('0x20')]();transfers[_0x49fc44[_0xb282('0x49')]]['holdtime']=0x0;transfers[_0x49fc44['transfereeuniqueid']][_0xb282('0x4d')]=0x2;}}else if(_0x49fc44[_0xb282('0x46')]==_0x49fc44[_0xb282('0x4e')]){if(!_['isNil'](agents[_0x49fc44['origtransfereruniqueid']])){utils[_0xb282('0x18')](util[_0xb282('0x19')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x49fc44[_0xb282('0x44')],agents[_0x49fc44[_0xb282('0x44')]][_0xb282('0x6')]));agents[_0x49fc44['origtransfereruniqueid']][_0xb282('0x3d')]=!![];agents[_0x49fc44[_0xb282('0x44')]]['transfertype']=_0xb282('0x4f');agents[_0x49fc44[_0xb282('0x44')]][_0xb282('0x40')]=_0x49fc44[_0xb282('0x50')];agents[_0x49fc44['origtransfereruniqueid']]['transferuniqueid']=_0x49fc44[_0xb282('0x46')];}if(_0x49fc44[_0xb282('0x51')]&&agents[_0x49fc44['transfertargetuniqueid']]){agents[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4d')]=0x1;transfers[_0x49fc44[_0xb282('0x51')]]=_[_0xb282('0x4a')](agents[_0x49fc44[_0xb282('0x51')]]);transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x8')]=agents[_0x49fc44[_0xb282('0x44')]]['calleridnum'];transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4b')]=agents[_0x49fc44[_0xb282('0x44')]]['calleridname'];transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4c')]=utils['now']();transfers[_0x49fc44['transfertargetuniqueid']][_0xb282('0x38')]=utils[_0xb282('0x20')]();transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x23')]=0x0;transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4d')]=0x2;}}}catch(_0x3cb0c6){utils[_0xb282('0x1b')](util[_0xb282('0x19')](_0xb282('0x43'),_0x49fc44[_0xb282('0x44')]),_0x3cb0c6);}};exports[_0xb282('0x52')]=function(_0x88dfa6){try{utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x53'),_0x88dfa6['uniqueid']),_0x88dfa6);if(agents[_0x88dfa6[_0xb282('0x11')]]&&agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]===_0xb282('0x21')){if(_0x88dfa6[_0xb282('0x54')]==='21'){agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]=_0xb282('0x55');agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x55');}utils['info'](util[_0xb282('0x19')](_0xb282('0x56'),_0x88dfa6[_0xb282('0x11')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x6')],agents[_0x88dfa6['uniqueid']]['reason'],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(agents[_0x88dfa6[_0xb282('0x11')]]);var _0x449adc=unanswered[_0xb282('0x57')](_0x88dfa6[_0xb282('0x11')]);if(_0x449adc>-0x1){unanswered[_0xb282('0x58')](_0x449adc,0x1);}}if(transfers[_0x88dfa6['uniqueid']]){transfers[_0x88dfa6['uniqueid']][_0xb282('0x34')]=!![];transfers[_0x88dfa6[_0xb282('0x11')]]['agentcompleteAt']=utils['now']();transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x25')]=utils[_0xb282('0x37')](transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x38')]);transfers[_0x88dfa6['uniqueid']][_0xb282('0x22')]=_0xb282('0x59');transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x5a');utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x56'),_0x88dfa6[_0xb282('0x11')],transfers[_0x88dfa6[_0xb282('0x11')]]['membername'],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(transfers[_0x88dfa6[_0xb282('0x11')]],!![]);}if(agents[_0x88dfa6[_0xb282('0x11')]]&&agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x38')]){agents[_0x88dfa6['uniqueid']][_0xb282('0x34')]=!![];agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')]=utils[_0xb282('0x20')]();agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x25')]=utils['diffTime'](agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')],agents[_0x88dfa6[_0xb282('0x11')]]['agentconnectAt']);agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]=agents[_0x88dfa6['uniqueid']][_0xb282('0x3d')]?_0xb282('0x3d'):_0xb282('0x59');agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x5a');utils[_0xb282('0x18')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x88dfa6[_0xb282('0x11')],agents[_0x88dfa6['uniqueid']][_0xb282('0x6')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(agents[_0x88dfa6['uniqueid']]);}}catch(_0xa1f33c){utils[_0xb282('0x1b')](util[_0xb282('0x19')]('[%s][agents][hangup]',_0x88dfa6[_0xb282('0x11')]),_0xa1f33c);}}; \ No newline at end of file +var _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x492597,_0x590e98){var _0x1cbe60=function(_0x187add){while(--_0x187add){_0x492597['push'](_0x492597['shift']());}};_0x1cbe60(++_0x590e98);}(_0xf290,0xde));var _0x0f29=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xf290[_0x2bf888];return _0x3038d6;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c0f298a..5ff3c47 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 _0xdec3=['xmd-phone','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','ANSWERED','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','source','value'];(function(_0x26d955,_0x37dc8c){var _0x1fbc07=function(_0x5ec184){while(--_0x5ec184){_0x26d955['push'](_0x26d955['shift']());}};_0x1fbc07(++_0x37dc8c);}(_0xdec3,0x89));var _0x3dec=function(_0x4212f6,_0xf9fb41){_0x4212f6=_0x4212f6-0x0;var _0x57aaa9=_0xdec3[_0x4212f6];return _0x57aaa9;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var utils=require(_0x3dec('0x1'));var transfers=require(_0x3dec('0x2'));var dispositions=[_0x3dec('0x3'),'FAILED',_0x3dec('0x4'),_0x3dec('0x3'),_0x3dec('0x3'),_0x3dec('0x3'),'ANSWERED',_0x3dec('0x5'),_0x3dec('0x4'),_0x3dec('0x4'),_0x3dec('0x4')];var channels={};function writeDB(_0x1826ab){var _0x311a74;if(transfers[_0x3dec('0x6')][_0x1826ab['uniqueid']]){_0x311a74=_0x1826ab[_0x3dec('0x7')];_0x1826ab[_0x3dec('0x7')]=transfers['blinds'][_0x1826ab[_0x3dec('0x7')]]['transfereeuniqueid'];}utils['info'](util[_0x3dec('0x8')](_0x3dec('0x9'),_0x1826ab['uniqueid'],_0x1826ab[_0x3dec('0xa')],_0x1826ab[_0x3dec('0xb')],_0x1826ab['membername'],_0x1826ab[_0x3dec('0xc')],_0x1826ab[_0x3dec('0xd')],_0x1826ab[_0x3dec('0xe')],_0x1826ab[_0x3dec('0xf')]));if(_0x1826ab[_0x3dec('0x10')]){utils[_0x3dec('0x11')](_0x1826ab['accountcode'])['then'](function(_0x3d4759){if(_0x3d4759){_0x1826ab['UserId']=_0x3d4759['id'];}utils[_0x3dec('0x12')](_0x3dec('0x13'),_0x1826ab);});}else{utils['request']('CreateVoiceCallReport',_0x1826ab);}if(channels[_0x1826ab[_0x3dec('0x7')]]){delete channels[_0x1826ab['uniqueid']];}else if(_0x311a74&&channels[_0x311a74]){if(!transfers[_0x3dec('0x6')][_0x311a74]['recording'])delete transfers[_0x3dec('0x6')][_0x311a74];delete channels[_0x311a74];}}exports['newchannel']=function(_0x258402){try{utils[_0x3dec('0x14')](util['format'](_0x3dec('0x15'),_0x258402[_0x3dec('0x7')]),_0x258402);if(_0x258402[_0x3dec('0x7')]==_0x258402[_0x3dec('0x16')]&&_0x258402[_0x3dec('0xa')]!=_0x3dec('0x17')){utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x19'),_0x258402[_0x3dec('0x7')],_0x258402[_0x3dec('0x1a')],_0x258402[_0x3dec('0x1b')]));channels[_0x258402[_0x3dec('0x7')]]={'uniqueid':_0x258402[_0x3dec('0x7')],'accountcode':_0x258402[_0x3dec('0x10')],'source':_0x258402[_0x3dec('0xd')],'destination':_0x258402[_0x3dec('0x1b')],'destinationcontext':_0x258402['context'],'channel':_0x258402['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3dec('0x1c')};}}catch(_0x5a40bc){utils[_0x3dec('0x1d')](util[_0x3dec('0x8')](_0x3dec('0x15'),_0x258402[_0x3dec('0x7')]),_0x5a40bc);}};exports[_0x3dec('0x1e')]=function(_0x362f3c){try{utils[_0x3dec('0x14')](util['format'](_0x3dec('0x1f'),_0x362f3c[_0x3dec('0x7')]),_0x362f3c);if(!_[_0x3dec('0x20')](channels[_0x362f3c['uniqueid']])&&_0x362f3c[_0x3dec('0x21')]==0x6){utils[_0x3dec('0x18')](util['format'](_0x3dec('0x22'),_0x362f3c[_0x3dec('0x7')],_0x362f3c['context'],_0x362f3c[_0x3dec('0xa')]));if(_[_0x3dec('0x20')](channels[_0x362f3c[_0x3dec('0x7')]][_0x3dec('0x23')])){channels[_0x362f3c[_0x3dec('0x7')]]['systemanswertime']=utils[_0x3dec('0x24')]();}}else if(!_['isNil'](channels[_0x362f3c['linkedid']])&&_0x362f3c[_0x3dec('0x21')]==0x6&&_0x362f3c['context']!='transfer'){utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x25'),_0x362f3c[_0x3dec('0x7')],_0x362f3c['linkedid'],_0x362f3c[_0x3dec('0x1a')],_0x362f3c[_0x3dec('0xa')]));channels[_0x362f3c[_0x3dec('0x16')]][_0x3dec('0x10')]=_0x362f3c['accountcode'];channels[_0x362f3c[_0x3dec('0x16')]]['destinationchannel']=_0x362f3c['channel'];if(_[_0x3dec('0x20')](channels[_0x362f3c[_0x3dec('0x16')]][_0x3dec('0x26')])){channels[_0x362f3c[_0x3dec('0x16')]][_0x3dec('0x26')]=utils[_0x3dec('0x24')]();}channels[_0x362f3c['linkedid']]['disposition']=dispositions[_[_0x3dec('0x27')](_0x362f3c['channelstate'])]||_0x3dec('0x28');}}catch(_0x361535){utils[_0x3dec('0x1d')](util[_0x3dec('0x8')]('[%s][calls][newstate]',_0x362f3c[_0x3dec('0x7')]),_0x361535);}};exports['hangup']=function(_0x87e30b){try{if(!_[_0x3dec('0x20')](channels[_0x87e30b[_0x3dec('0x7')]])){utils[_0x3dec('0x14')](util['format']('[%s][calls][hangup]',_0x87e30b[_0x3dec('0x7')]),_0x87e30b);if(_[_0x3dec('0x20')](channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x29')])){channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x29')]=_0x87e30b[_0x3dec('0x2a')]+'\x20<'+_0x87e30b[_0x3dec('0xd')]+'>';}utils['info'](util['format'](_0x3dec('0x2b'),_0x87e30b[_0x3dec('0x7')],channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x29')],_0x87e30b[_0x3dec('0x2c')]));channels[_0x87e30b['uniqueid']][_0x3dec('0x2d')]=utils[_0x3dec('0x24')]();channels[_0x87e30b['uniqueid']][_0x3dec('0x2e')]=utils[_0x3dec('0x2f')](channels[_0x87e30b[_0x3dec('0x7')]]['endtime'],channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x30')]);channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x31')]=channels[_0x87e30b[_0x3dec('0x7')]]['answertime']?utils[_0x3dec('0x2f')](channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x2d')],channels[_0x87e30b[_0x3dec('0x7')]][_0x3dec('0x26')]):0x0;writeDB(channels[_0x87e30b[_0x3dec('0x7')]]);}}catch(_0x500e51){utils[_0x3dec('0x1d')](util[_0x3dec('0x8')](_0x3dec('0x32'),_0x87e30b[_0x3dec('0x7')]),_0x500e51);}};exports[_0x3dec('0x33')]=function(_0x3ecc4f){try{if(!_['isNil'](channels[_0x3ecc4f[_0x3dec('0x34')]])){utils[_0x3dec('0x14')](util['format']('[%s][calls][attendedtransfer]',_0x3ecc4f[_0x3dec('0x35')]),_0x3ecc4f);if(channels[_0x3ecc4f['localtwolinkedid']][_0x3dec('0xa')]==_0x3ecc4f[_0x3dec('0x36')]){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3ecc4f[_0x3dec('0x35')],_0x3ecc4f['localtwolinkedid'],_0x3ecc4f['secondtransfererchannel']));channels[_0x3ecc4f[_0x3dec('0x34')]][_0x3dec('0x37')]=_0x3ecc4f[_0x3dec('0x38')];channels[_0x3ecc4f[_0x3dec('0x34')]][_0x3dec('0x39')]=_0x3dec('0x3a');}else if(channels[_0x3ecc4f['localtwolinkedid']][_0x3dec('0xa')]=_0x3ecc4f[_0x3dec('0x3b')]){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3ecc4f['origtransfereruniqueid'],_0x3ecc4f[_0x3dec('0x34')],_0x3ecc4f[_0x3dec('0x3c')]));channels[_0x3ecc4f['localtwolinkedid']]['destinationchannel']=_0x3ecc4f[_0x3dec('0x3c')];channels[_0x3ecc4f['localtwolinkedid']][_0x3dec('0x39')]='_attended';}}}catch(_0x5b0839){utils[_0x3dec('0x1d')](util[_0x3dec('0x8')]('[%s][calls][attendedtransfer]',_0x3ecc4f[_0x3dec('0x35')]),_0x5b0839);}};exports[_0x3dec('0x3d')]=function(_0x55a1a1){try{if(!_[_0x3dec('0x20')](channels[_0x55a1a1[_0x3dec('0x7')]])){utils['debug'](util[_0x3dec('0x8')](_0x3dec('0x3e'),_0x55a1a1[_0x3dec('0x7')]),_0x55a1a1);channels[_0x55a1a1[_0x3dec('0x7')]][_0x3dec('0x3f')]=utils['now']();utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x40'),_0x55a1a1[_0x3dec('0x7')],channels[_0x55a1a1[_0x3dec('0x7')]][_0x3dec('0x3f')]));}}catch(_0x575831){utils[_0x3dec('0x1d')](util[_0x3dec('0x8')](_0x3dec('0x3e'),_0x55a1a1[_0x3dec('0x7')]),_0x575831);}};exports[_0x3dec('0x41')]=function(_0x54b031){try{if(!_[_0x3dec('0x20')](channels[_0x54b031[_0x3dec('0x7')]])){utils['debug'](util[_0x3dec('0x8')](_0x3dec('0x42'),_0x54b031[_0x3dec('0x7')]),_0x54b031);if(!_[_0x3dec('0x20')](channels[_0x54b031['uniqueid']][_0x3dec('0x3f')])){channels[_0x54b031[_0x3dec('0x7')]][_0x3dec('0x43')]+=utils[_0x3dec('0x2f')](utils['now'](),channels[_0x54b031['uniqueid']][_0x3dec('0x3f')]);utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x44'),_0x54b031['uniqueid'],channels[_0x54b031['uniqueid']]['mohtime']));delete channels[_0x54b031[_0x3dec('0x7')]]['musiconholdstartAt'];}}}catch(_0x225476){utils['error'](util['format'](_0x3dec('0x42'),_0x54b031[_0x3dec('0x7')]),_0x225476);}};exports['varset']=function(_0x40e8ae){try{if(!_[_0x3dec('0x20')](channels[_0x40e8ae[_0x3dec('0x7')]])){utils[_0x3dec('0x14')](util[_0x3dec('0x8')](_0x3dec('0x45'),_0x40e8ae[_0x3dec('0x7')]),_0x40e8ae);if(!_['isNil'](_0x40e8ae[_0x3dec('0x46')]['xmd-originatecalleridnum'])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x40e8ae['uniqueid'],_0x40e8ae['value']));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x47')]=_0x40e8ae[_0x3dec('0x48')];}if(!_['isNil'](_0x40e8ae[_0x3dec('0x46')][_0x3dec('0x49')])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x40e8ae[_0x3dec('0x7')],_0x40e8ae['value']));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x4a')]=_0x40e8ae[_0x3dec('0x48')];channels[_0x40e8ae[_0x3dec('0x7')]]['callerid']='\x22'+_0x40e8ae[_0x3dec('0x48')]+'\x22\x20<'+_0x40e8ae[_0x3dec('0x48')]+'>';}if(!_['isNil'](_0x40e8ae[_0x3dec('0x46')]['xmd-callerid-preview'])||!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')][_0x3dec('0x4b')])){utils['info'](util[_0x3dec('0x8')](_0x3dec('0x4c'),_0x40e8ae[_0x3dec('0x7')],!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')]['xmd-callerid-preview'])?_0x3dec('0x4d'):_0x3dec('0x4b'),_0x40e8ae['value']));channels[_0x40e8ae[_0x3dec('0x7')]]['callerid']=_0x40e8ae['value'];}if(!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')][_0x3dec('0x4e')])||!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')]['xmcs-queue'])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x4c'),_0x40e8ae[_0x3dec('0x7')],!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')]['xmd-queue'])?_0x3dec('0x4e'):_0x3dec('0x4f'),_0x40e8ae[_0x3dec('0x48')]));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x50')]=_0x3dec('0x51');channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x52')]=_0x40e8ae[_0x3dec('0x48')];channels[_0x40e8ae[_0x3dec('0x7')]]['queue']=!![];}if(!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')]['xmd-contactid'])){utils['info'](util[_0x3dec('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x40e8ae[_0x3dec('0x7')],_0x40e8ae[_0x3dec('0x48')]));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x53')]=_0x40e8ae[_0x3dec('0x48')];}if(!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')]['xmd-cdrtype'])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x54'),_0x40e8ae[_0x3dec('0x7')],_0x40e8ae['value']));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x55')]=_0x40e8ae[_0x3dec('0x48')];}if(!_[_0x3dec('0x20')](_0x40e8ae['variable'][_0x3dec('0x56')])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x40e8ae[_0x3dec('0x7')],_0x40e8ae[_0x3dec('0x48')]));channels[_0x40e8ae[_0x3dec('0x7')]][_0x3dec('0x57')]=_0x40e8ae[_0x3dec('0x48')];}if(!_[_0x3dec('0x20')](_0x40e8ae[_0x3dec('0x46')][_0x3dec('0x58')])){utils[_0x3dec('0x18')](util[_0x3dec('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x40e8ae[_0x3dec('0x7')],_0x40e8ae[_0x3dec('0x48')]));channels[_0x40e8ae['uniqueid']]['sipcallid']=_0x40e8ae[_0x3dec('0x48')];}}}catch(_0x55c97f){utils[_0x3dec('0x1d')](util['format'](_0x3dec('0x45'),_0x40e8ae[_0x3dec('0x7')]),_0x55c97f);}};exports[_0x3dec('0x59')]=function(_0x121a8d){try{if(!_[_0x3dec('0x20')](channels[_0x121a8d[_0x3dec('0x7')]])){utils[_0x3dec('0x14')](util[_0x3dec('0x8')]('[%s][calls][newexten]',_0x121a8d[_0x3dec('0x7')]),_0x121a8d);utils[_0x3dec('0x18')](util[_0x3dec('0x8')](_0x3dec('0x5a'),_0x121a8d[_0x3dec('0x7')],_0x121a8d[_0x3dec('0x5b')],_0x121a8d[_0x3dec('0x5c')]));if(_0x121a8d['application'][_0x3dec('0x5d')]()==_0x3dec('0x5e')&&_[_0x3dec('0x5f')](_0x121a8d[_0x3dec('0x5c')]['toLowerCase'](),_0x3dec('0x60'))){var _0x2d9b8f=_0x121a8d[_0x3dec('0x5c')][_0x3dec('0x61')]('=');var _0x270b9d=_0x2d9b8f[0x0][_0x3dec('0x62')](_0x2d9b8f[0x0]['lastIndexOf']('(')+0x1,_0x2d9b8f[0x0][_0x3dec('0x63')](')'));var _0x231d74=_0x2d9b8f[0x1];channels[_0x121a8d[_0x3dec('0x7')]][_0x270b9d]=_0x231d74;}if(!_['includes']([_0x3dec('0x64'),_0x3dec('0x65'),_0x3dec('0x66'),'set',_0x3dec('0x67')],_0x121a8d['application'][_0x3dec('0x5d')]())){channels[_0x121a8d[_0x3dec('0x7')]]['lastapplication']=_0x121a8d[_0x3dec('0x5b')];channels[_0x121a8d[_0x3dec('0x7')]][_0x3dec('0x52')]=_0x121a8d[_0x3dec('0x5c')];}}}catch(_0x165b98){utils['error'](util[_0x3dec('0x8')](_0x3dec('0x68'),_0x121a8d[_0x3dec('0x7')]),_0x165b98);}}; \ No newline at end of file +var _0x19c9=['[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','lodash','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','format','[%s][calls][newchannel]','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','toNumber','error','hangup','debug','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','billableseconds','[%s][calls][hangup]','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid'];(function(_0xff6158,_0x4a0472){var _0x3376a9=function(_0x238bee){while(--_0x238bee){_0xff6158['push'](_0xff6158['shift']());}};_0x3376a9(++_0x4a0472);}(_0x19c9,0x1bf));var _0x919c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x19c9[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x919c('0x0'));var util=require('util');var utils=require(_0x919c('0x1'));var transfers=require(_0x919c('0x2'));var dispositions=['NO\x20ANSWER',_0x919c('0x3'),_0x919c('0x3'),'NO\x20ANSWER',_0x919c('0x4'),_0x919c('0x4'),_0x919c('0x5'),'BUSY',_0x919c('0x3'),_0x919c('0x3'),'FAILED'];var channels={};function writeDB(_0x15b068){var _0x14c53c;if(transfers[_0x919c('0x6')][_0x15b068[_0x919c('0x7')]]){_0x14c53c=_0x15b068[_0x919c('0x7')];_0x15b068[_0x919c('0x7')]=transfers[_0x919c('0x6')][_0x15b068[_0x919c('0x7')]][_0x919c('0x8')];}utils[_0x919c('0x9')](util['format'](_0x919c('0xa'),_0x15b068[_0x919c('0x7')],_0x15b068['channel'],_0x15b068[_0x919c('0xb')],_0x15b068['membername'],_0x15b068[_0x919c('0xc')],_0x15b068['calleridnum'],_0x15b068[_0x919c('0xd')],_0x15b068[_0x919c('0xe')]));if(_0x15b068['accountcode']){utils[_0x919c('0xf')](_0x15b068[_0x919c('0x10')])[_0x919c('0x11')](function(_0x346ce4){if(_0x346ce4){_0x15b068[_0x919c('0x12')]=_0x346ce4['id'];}utils[_0x919c('0x13')](_0x919c('0x14'),_0x15b068);});}else{utils[_0x919c('0x13')]('CreateVoiceCallReport',_0x15b068);}if(channels[_0x15b068['uniqueid']]){delete channels[_0x15b068['uniqueid']];}else if(_0x14c53c&&channels[_0x14c53c]){if(!transfers['blinds'][_0x14c53c]['recording'])delete transfers['blinds'][_0x14c53c];delete channels[_0x14c53c];}}exports[_0x919c('0x15')]=function(_0x53e6f7){try{utils['debug'](util[_0x919c('0x16')](_0x919c('0x17'),_0x53e6f7[_0x919c('0x7')]),_0x53e6f7);if(_0x53e6f7[_0x919c('0x7')]==_0x53e6f7['linkedid']&&_0x53e6f7[_0x919c('0x18')]!='OutgoingSpoolFailed'){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x19'),_0x53e6f7['uniqueid'],_0x53e6f7['context'],_0x53e6f7[_0x919c('0x1a')]));channels[_0x53e6f7[_0x919c('0x7')]]={'uniqueid':_0x53e6f7[_0x919c('0x7')],'accountcode':_0x53e6f7[_0x919c('0x10')],'source':_0x53e6f7['calleridnum'],'destination':_0x53e6f7[_0x919c('0x1a')],'destinationcontext':_0x53e6f7[_0x919c('0x1b')],'channel':_0x53e6f7[_0x919c('0x18')],'starttime':utils[_0x919c('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x919c('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x4222f1){utils['error'](util[_0x919c('0x16')](_0x919c('0x17'),_0x53e6f7['uniqueid']),_0x4222f1);}};exports[_0x919c('0x1d')]=function(_0x434811){try{utils['debug'](util[_0x919c('0x16')](_0x919c('0x1e'),_0x434811[_0x919c('0x7')]),_0x434811);if(!_[_0x919c('0x1f')](channels[_0x434811[_0x919c('0x7')]])&&_0x434811['channelstate']==0x6){utils[_0x919c('0x9')](util['format'](_0x919c('0x20'),_0x434811[_0x919c('0x7')],_0x434811[_0x919c('0x1b')],_0x434811[_0x919c('0x18')]));if(_['isNil'](channels[_0x434811[_0x919c('0x7')]][_0x919c('0x21')])){channels[_0x434811[_0x919c('0x7')]][_0x919c('0x21')]=utils[_0x919c('0x1c')]();}}else if(!_[_0x919c('0x1f')](channels[_0x434811['linkedid']])&&_0x434811['channelstate']==0x6&&_0x434811[_0x919c('0x1b')]!='transfer'){utils[_0x919c('0x9')](util['format'](_0x919c('0x22'),_0x434811[_0x919c('0x7')],_0x434811[_0x919c('0x23')],_0x434811[_0x919c('0x1b')],_0x434811[_0x919c('0x18')]));channels[_0x434811[_0x919c('0x23')]][_0x919c('0x10')]=_0x434811[_0x919c('0x10')];channels[_0x434811['linkedid']][_0x919c('0x24')]=_0x434811[_0x919c('0x18')];if(_[_0x919c('0x1f')](channels[_0x434811[_0x919c('0x23')]][_0x919c('0x25')])){channels[_0x434811[_0x919c('0x23')]][_0x919c('0x25')]=utils['now']();}channels[_0x434811[_0x919c('0x23')]]['disposition']=dispositions[_[_0x919c('0x26')](_0x434811['channelstate'])]||_0x919c('0x5');}}catch(_0x496cd0){utils[_0x919c('0x27')](util['format']('[%s][calls][newstate]',_0x434811['uniqueid']),_0x496cd0);}};exports[_0x919c('0x28')]=function(_0x2f0721){try{if(!_['isNil'](channels[_0x2f0721[_0x919c('0x7')]])){utils[_0x919c('0x29')](util[_0x919c('0x16')]('[%s][calls][hangup]',_0x2f0721[_0x919c('0x7')]),_0x2f0721);if(_[_0x919c('0x1f')](channels[_0x2f0721['uniqueid']][_0x919c('0x2a')])){channels[_0x2f0721['uniqueid']][_0x919c('0x2a')]=_0x2f0721['calleridname']+'\x20<'+_0x2f0721[_0x919c('0x2b')]+'>';}utils['info'](util[_0x919c('0x16')](_0x919c('0x2c'),_0x2f0721[_0x919c('0x7')],channels[_0x2f0721[_0x919c('0x7')]]['callerid'],_0x2f0721['cause-txt']));channels[_0x2f0721[_0x919c('0x7')]]['endtime']=utils[_0x919c('0x1c')]();channels[_0x2f0721[_0x919c('0x7')]][_0x919c('0x2d')]=utils[_0x919c('0x2e')](channels[_0x2f0721[_0x919c('0x7')]][_0x919c('0x2f')],channels[_0x2f0721[_0x919c('0x7')]]['starttime']);channels[_0x2f0721['uniqueid']][_0x919c('0x30')]=channels[_0x2f0721[_0x919c('0x7')]]['answertime']?utils[_0x919c('0x2e')](channels[_0x2f0721['uniqueid']]['endtime'],channels[_0x2f0721['uniqueid']]['answertime']):0x0;writeDB(channels[_0x2f0721[_0x919c('0x7')]]);}}catch(_0x4a0d9d){utils[_0x919c('0x27')](util[_0x919c('0x16')](_0x919c('0x31'),_0x2f0721[_0x919c('0x7')]),_0x4a0d9d);}};exports['attendedtransfer']=function(_0x3cdd79){try{if(!_['isNil'](channels[_0x3cdd79['localtwolinkedid']])){utils[_0x919c('0x29')](util[_0x919c('0x16')](_0x919c('0x32'),_0x3cdd79[_0x919c('0x33')]),_0x3cdd79);if(channels[_0x3cdd79['localtwolinkedid']]['channel']==_0x3cdd79[_0x919c('0x34')]){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x35'),_0x3cdd79[_0x919c('0x33')],_0x3cdd79[_0x919c('0x36')],_0x3cdd79[_0x919c('0x37')]));channels[_0x3cdd79[_0x919c('0x36')]][_0x919c('0x24')]=_0x3cdd79[_0x919c('0x37')];channels[_0x3cdd79[_0x919c('0x36')]][_0x919c('0x38')]=_0x919c('0x39');}else if(channels[_0x3cdd79['localtwolinkedid']][_0x919c('0x18')]=_0x3cdd79[_0x919c('0x3a')]){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x35'),_0x3cdd79[_0x919c('0x33')],_0x3cdd79[_0x919c('0x36')],_0x3cdd79['origtransfererchannel']));channels[_0x3cdd79[_0x919c('0x36')]][_0x919c('0x24')]=_0x3cdd79['origtransfererchannel'];channels[_0x3cdd79['localtwolinkedid']][_0x919c('0x38')]=_0x919c('0x39');}}}catch(_0x27bd1f){utils[_0x919c('0x27')](util[_0x919c('0x16')](_0x919c('0x32'),_0x3cdd79['origtransfereruniqueid']),_0x27bd1f);}};exports[_0x919c('0x3b')]=function(_0x2e255d){try{if(!_[_0x919c('0x1f')](channels[_0x2e255d[_0x919c('0x7')]])){utils['debug'](util['format'](_0x919c('0x3c'),_0x2e255d['uniqueid']),_0x2e255d);channels[_0x2e255d[_0x919c('0x7')]]['musiconholdstartAt']=utils[_0x919c('0x1c')]();utils['info'](util[_0x919c('0x16')](_0x919c('0x3d'),_0x2e255d[_0x919c('0x7')],channels[_0x2e255d[_0x919c('0x7')]][_0x919c('0x3e')]));}}catch(_0x1a8c80){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x2e255d['uniqueid']),_0x1a8c80);}};exports[_0x919c('0x3f')]=function(_0x18a2b9){try{if(!_[_0x919c('0x1f')](channels[_0x18a2b9[_0x919c('0x7')]])){utils[_0x919c('0x29')](util[_0x919c('0x16')](_0x919c('0x40'),_0x18a2b9[_0x919c('0x7')]),_0x18a2b9);if(!_[_0x919c('0x1f')](channels[_0x18a2b9[_0x919c('0x7')]][_0x919c('0x3e')])){channels[_0x18a2b9[_0x919c('0x7')]][_0x919c('0x41')]+=utils[_0x919c('0x2e')](utils[_0x919c('0x1c')](),channels[_0x18a2b9[_0x919c('0x7')]][_0x919c('0x3e')]);utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x42'),_0x18a2b9[_0x919c('0x7')],channels[_0x18a2b9['uniqueid']][_0x919c('0x41')]));delete channels[_0x18a2b9['uniqueid']]['musiconholdstartAt'];}}}catch(_0x3d94a6){utils[_0x919c('0x27')](util[_0x919c('0x16')](_0x919c('0x40'),_0x18a2b9[_0x919c('0x7')]),_0x3d94a6);}};exports[_0x919c('0x43')]=function(_0x1fe276){try{if(!_['isNil'](channels[_0x1fe276[_0x919c('0x7')]])){utils[_0x919c('0x29')](util[_0x919c('0x16')]('[%s][calls][varset]',_0x1fe276[_0x919c('0x7')]),_0x1fe276);if(!_['isNil'](_0x1fe276[_0x919c('0x44')]['xmd-originatecalleridnum'])){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x45'),_0x1fe276[_0x919c('0x7')],_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x47')]=_0x1fe276[_0x919c('0x46')];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x48')])){utils[_0x919c('0x9')](util['format'](_0x919c('0x49'),_0x1fe276['uniqueid'],_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x4a')]=_0x1fe276[_0x919c('0x46')];channels[_0x1fe276['uniqueid']][_0x919c('0x2a')]='\x22'+_0x1fe276[_0x919c('0x46')]+_0x919c('0x4b')+_0x1fe276[_0x919c('0x46')]+'>';}if(!_[_0x919c('0x1f')](_0x1fe276['variable'][_0x919c('0x4c')])||!_['isNil'](_0x1fe276[_0x919c('0x44')]['xmd-callerid'])){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x4d'),_0x1fe276[_0x919c('0x7')],!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')]['xmd-callerid-preview'])?_0x919c('0x4c'):'xmd-callerid',_0x1fe276['value']));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x2a')]=_0x1fe276[_0x919c('0x46')];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x4e')])||!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x4f')])){utils[_0x919c('0x9')](util[_0x919c('0x16')](_0x919c('0x4d'),_0x1fe276[_0x919c('0x7')],!_['isNil'](_0x1fe276[_0x919c('0x44')][_0x919c('0x4e')])?'xmd-queue':_0x919c('0x4f'),_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x50')]=_0x919c('0x51');channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x52')]=_0x1fe276['value'];channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0xb')]=!![];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x53')])){utils[_0x919c('0x9')](util['format'](_0x919c('0x54'),_0x1fe276['uniqueid'],_0x1fe276['value']));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x55')]=_0x1fe276[_0x919c('0x46')];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x56')])){utils['info'](util[_0x919c('0x16')](_0x919c('0x57'),_0x1fe276[_0x919c('0x7')],_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x58')]=_0x1fe276[_0x919c('0x46')];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x59')])){utils['info'](util[_0x919c('0x16')](_0x919c('0x5a'),_0x1fe276[_0x919c('0x7')],_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x5b')]=_0x1fe276[_0x919c('0x46')];}if(!_[_0x919c('0x1f')](_0x1fe276[_0x919c('0x44')][_0x919c('0x5c')])){utils[_0x919c('0x9')](util[_0x919c('0x16')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1fe276['uniqueid'],_0x1fe276[_0x919c('0x46')]));channels[_0x1fe276[_0x919c('0x7')]][_0x919c('0x5c')]=_0x1fe276[_0x919c('0x46')];}}}catch(_0x4340ba){utils[_0x919c('0x27')](util['format'](_0x919c('0x5d'),_0x1fe276[_0x919c('0x7')]),_0x4340ba);}};exports[_0x919c('0x5e')]=function(_0x2df11e){try{if(!_['isNil'](channels[_0x2df11e[_0x919c('0x7')]])){utils[_0x919c('0x29')](util['format'](_0x919c('0x5f'),_0x2df11e[_0x919c('0x7')]),_0x2df11e);utils['info'](util[_0x919c('0x16')](_0x919c('0x60'),_0x2df11e[_0x919c('0x7')],_0x2df11e['application'],_0x2df11e[_0x919c('0x61')]));if(_0x2df11e[_0x919c('0x62')][_0x919c('0x63')]()==_0x919c('0x64')&&_[_0x919c('0x65')](_0x2df11e[_0x919c('0x61')][_0x919c('0x63')](),_0x919c('0x66'))){var _0x18d222=_0x2df11e[_0x919c('0x61')][_0x919c('0x67')]('=');var _0x1c0772=_0x18d222[0x0]['substring'](_0x18d222[0x0][_0x919c('0x68')]('(')+0x1,_0x18d222[0x0][_0x919c('0x68')](')'));var _0x2ac612=_0x18d222[0x1];channels[_0x2df11e[_0x919c('0x7')]][_0x1c0772]=_0x2ac612;}if(!_[_0x919c('0x69')]([_0x919c('0x28'),_0x919c('0x6a'),_0x919c('0x6b'),_0x919c('0x64'),'gotoif'],_0x2df11e[_0x919c('0x62')][_0x919c('0x63')]())){channels[_0x2df11e['uniqueid']]['lastapplication']=_0x2df11e[_0x919c('0x62')];channels[_0x2df11e['uniqueid']][_0x919c('0x52')]=_0x2df11e[_0x919c('0x61')];}}}catch(_0x17848a){utils[_0x919c('0x27')](util[_0x919c('0x16')]('[%s][calls][newexten]',_0x2df11e['uniqueid']),_0x17848a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 225eb68..c77314b 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 _0x9352=['shutdown','[core]\x20shutdown','info','[core]\x20fullybooted','error','[core]\x20error','close','./utils','connect'];(function(_0x11ef3d,_0x233c33){var _0x4b5775=function(_0x20a5ff){while(--_0x20a5ff){_0x11ef3d['push'](_0x11ef3d['shift']());}};_0x4b5775(++_0x233c33);}(_0x9352,0xa9));var _0x2935=function(_0x5b467e,_0x21bc0e){_0x5b467e=_0x5b467e-0x0;var _0x4f3615=_0x9352[_0x5b467e];return _0x4f3615;};'use strict';var utils=require(_0x2935('0x0'));exports[_0x2935('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x2935('0x2')]=function(){utils['info'](_0x2935('0x3'));};exports['fullybooted']=function(){utils[_0x2935('0x4')](_0x2935('0x5'));};exports[_0x2935('0x6')]=function(_0x186f8b){utils[_0x2935('0x6')](_0x2935('0x7'),_0x186f8b);};exports[_0x2935('0x8')]=function(){utils[_0x2935('0x4')]('[core]\x20close');};exports['managerevent']=function(_0x144143){}; \ No newline at end of file +var _0xffae=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x3a677a,_0x5f422a){var _0x2ffbb1=function(_0xee397c){while(--_0xee397c){_0x3a677a['push'](_0x3a677a['shift']());}};_0x2ffbb1(++_0x5f422a);}(_0xffae,0x73));var _0xeffa=function(_0x2e9961,_0x38aacc){_0x2e9961=_0x2e9961-0x0;var _0xf14ff6=_0xffae[_0x2e9961];return _0xf14ff6;};'use strict';var utils=require(_0xeffa('0x0'));exports[_0xeffa('0x1')]=function(){utils[_0xeffa('0x2')](_0xeffa('0x3'));};exports[_0xeffa('0x4')]=function(){utils[_0xeffa('0x2')]('[core]\x20shutdown');};exports[_0xeffa('0x5')]=function(){utils[_0xeffa('0x2')](_0xeffa('0x6'));};exports[_0xeffa('0x7')]=function(_0x34b894){utils['error'](_0xeffa('0x8'),_0x34b894);};exports[_0xeffa('0x9')]=function(){utils[_0xeffa('0x2')](_0xeffa('0xa'));};exports[_0xeffa('0xb')]=function(_0x20ff1d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 912f4a7..973b250 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 _0xd975=['set','startsWith','toLowerCase','cdr(routeid)','split','error','debug','[%s][dials][varset]','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd975,0x90));var _0x5d97=function(_0x3cfbb5,_0x247455){_0x3cfbb5=_0x3cfbb5-0x0;var _0x48bec4=_0xd975[_0x3cfbb5];return _0x48bec4;};'use strict';var _=require('lodash');var util=require(_0x5d97('0x0'));var utils=require(_0x5d97('0x1'));var dials={};function writeDB(_0x1bd89a){utils['info'](util[_0x5d97('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1bd89a[_0x5d97('0x3')],_0x1bd89a[_0x5d97('0x4')],_0x1bd89a[_0x5d97('0x5')],_0x1bd89a[_0x5d97('0x6')],_0x1bd89a[_0x5d97('0x7')],_0x1bd89a[_0x5d97('0x8')]));utils[_0x5d97('0x9')]('CreateVoiceDialReport',_0x1bd89a);delete dials[_0x1bd89a['uniqueid']];}exports[_0x5d97('0xa')]=function(_0xb21ea2){try{utils['debug'](util['format'](_0x5d97('0xb'),_0xb21ea2['uniqueid']),_0xb21ea2);utils['info'](util[_0x5d97('0x2')](_0x5d97('0xc'),_0xb21ea2[_0x5d97('0x3')],_0xb21ea2[_0x5d97('0xd')],_0xb21ea2[_0x5d97('0xe')]));if(_0xb21ea2[_0x5d97('0xd')]['toLowerCase']()==_0x5d97('0xf')&&_[_0x5d97('0x10')](_0xb21ea2[_0x5d97('0xe')][_0x5d97('0x11')](),_0x5d97('0x12'))){var _0x5027ec=_0xb21ea2[_0x5d97('0xe')][_0x5d97('0x13')]('=');dials[_0xb21ea2['uniqueid']]={'routeId':_0x5027ec[0x1]};}}catch(_0x24f525){utils[_0x5d97('0x14')](util['format'](_0x5d97('0xb'),_0xb21ea2[_0x5d97('0x3')]),_0x24f525);}};exports['varset']=function(_0x5af4cd){try{utils[_0x5d97('0x15')](util[_0x5d97('0x2')](_0x5d97('0x16'),_0x5af4cd[_0x5d97('0x3')]),_0x5af4cd);if(!_['isNil'](_0x5af4cd[_0x5d97('0x17')][_0x5d97('0x18')])){utils[_0x5d97('0x19')](util[_0x5d97('0x2')](_0x5d97('0x1a'),_0x5af4cd['uniqueid'],_0x5af4cd[_0x5d97('0x1b')]));dials[_0x5af4cd[_0x5d97('0x3')]]={'routeId':_0x5af4cd['value']};}}catch(_0x3319c4){utils[_0x5d97('0x14')](util['format']('[%s][dials][varset]',_0x5af4cd['uniqueid']),_0x3319c4);}};exports[_0x5d97('0x1c')]=function(_0x4dd8a3){try{if(!_[_0x5d97('0x1d')](dials[_0x4dd8a3[_0x5d97('0x3')]])){utils['debug'](util[_0x5d97('0x2')](_0x5d97('0x1e'),_0x4dd8a3[_0x5d97('0x3')]),_0x4dd8a3);dials[_0x4dd8a3['uniqueid']]=_[_0x5d97('0x1f')](dials[_0x4dd8a3[_0x5d97('0x3')]],_0x4dd8a3);dials[_0x4dd8a3[_0x5d97('0x3')]][_0x5d97('0x20')]=utils[_0x5d97('0x21')]();dials[_0x4dd8a3[_0x5d97('0x3')]]['lastevent']=_0x5d97('0x22');utils[_0x5d97('0x19')](util[_0x5d97('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4dd8a3['uniqueid'],dials[_0x4dd8a3[_0x5d97('0x3')]][_0x5d97('0x20')]));}}catch(_0x9c150a){utils['error'](util[_0x5d97('0x2')](_0x5d97('0x1e'),_0x4dd8a3['uniqueid']),_0x9c150a);}};exports[_0x5d97('0x23')]=function(_0x472d0c){try{if(!_[_0x5d97('0x1d')](dials[_0x472d0c[_0x5d97('0x3')]])){utils[_0x5d97('0x15')](util[_0x5d97('0x2')](_0x5d97('0x24'),_0x472d0c[_0x5d97('0x3')]),_0x472d0c);dials[_0x472d0c[_0x5d97('0x3')]][_0x5d97('0x8')]=_0x472d0c[_0x5d97('0x8')];if(_0x472d0c[_0x5d97('0x8')]==_0x5d97('0x25')){dials[_0x472d0c['uniqueid']]=_[_0x5d97('0x1f')](dials[_0x472d0c[_0x5d97('0x3')]],_0x472d0c);dials[_0x472d0c['uniqueid']][_0x5d97('0x26')]=utils[_0x5d97('0x21')]();dials[_0x472d0c[_0x5d97('0x3')]][_0x5d97('0x27')]=_0x5d97('0x28');utils[_0x5d97('0x19')](util[_0x5d97('0x2')](_0x5d97('0x29'),_0x472d0c[_0x5d97('0x3')],_0x472d0c[_0x5d97('0x8')],dials[_0x472d0c[_0x5d97('0x3')]]['answertime']));}else{utils[_0x5d97('0x19')](util[_0x5d97('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x472d0c[_0x5d97('0x3')],_0x472d0c[_0x5d97('0x8')]));}}}catch(_0x2b1cb9){utils[_0x5d97('0x14')](util[_0x5d97('0x2')](_0x5d97('0x24'),_0x472d0c[_0x5d97('0x3')]),_0x2b1cb9);}};exports[_0x5d97('0x2a')]=function(_0x122449){try{if(!_['isNil'](dials[_0x122449[_0x5d97('0x3')]])){utils[_0x5d97('0x15')](util[_0x5d97('0x2')](_0x5d97('0x2b'),_0x122449[_0x5d97('0x3')]),_0x122449);utils[_0x5d97('0x19')](util[_0x5d97('0x2')](_0x5d97('0x2c'),_0x122449[_0x5d97('0x3')],_0x122449[_0x5d97('0x6')],_0x122449[_0x5d97('0x2d')],_0x122449[_0x5d97('0x2e')]));dials[_0x122449[_0x5d97('0x3')]]=_['assign'](dials[_0x122449['uniqueid']],{'endtime':utils[_0x5d97('0x21')](),'lastevent':_0x5d97('0x2f')});dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x30')]=utils['diffTime'](dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x31')],dials[_0x122449[_0x5d97('0x3')]]['starttime']);dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x32')]=utils[_0x5d97('0x33')](dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x26')]||dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x31')],dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x20')]);dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x34')]=dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x26')]?utils[_0x5d97('0x33')](dials[_0x122449['uniqueid']][_0x5d97('0x31')],dials[_0x122449[_0x5d97('0x3')]][_0x5d97('0x26')]):0x0;writeDB(dials[_0x122449[_0x5d97('0x3')]]);}}catch(_0x379d00){utils[_0x5d97('0x14')](util[_0x5d97('0x2')]('[%s][dials][hangup]',_0x122449[_0x5d97('0x3')]),_0x379d00);}}; \ No newline at end of file +var _0x8792=['endtime','holdtime','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','dialend','[%s][dials][dialend]','ANSWER','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime'];(function(_0x39d07a,_0x435200){var _0x253bea=function(_0x56298){while(--_0x56298){_0x39d07a['push'](_0x39d07a['shift']());}};_0x253bea(++_0x435200);}(_0x8792,0x1b2));var _0x2879=function(_0x422334,_0x4f260b){_0x422334=_0x422334-0x0;var _0x1aaf5e=_0x8792[_0x422334];return _0x1aaf5e;};'use strict';var _=require('lodash');var util=require(_0x2879('0x0'));var utils=require(_0x2879('0x1'));var dials={};function writeDB(_0xaa9102){utils[_0x2879('0x2')](util[_0x2879('0x3')](_0x2879('0x4'),_0xaa9102[_0x2879('0x5')],_0xaa9102[_0x2879('0x6')],_0xaa9102[_0x2879('0x7')],_0xaa9102[_0x2879('0x8')],_0xaa9102[_0x2879('0x9')],_0xaa9102[_0x2879('0xa')]));utils[_0x2879('0xb')]('CreateVoiceDialReport',_0xaa9102);delete dials[_0xaa9102[_0x2879('0x5')]];}exports[_0x2879('0xc')]=function(_0x26ab2f){try{utils[_0x2879('0xd')](util[_0x2879('0x3')](_0x2879('0xe'),_0x26ab2f[_0x2879('0x5')]),_0x26ab2f);utils['info'](util[_0x2879('0x3')](_0x2879('0xf'),_0x26ab2f['uniqueid'],_0x26ab2f[_0x2879('0x10')],_0x26ab2f[_0x2879('0x11')]));if(_0x26ab2f['application'][_0x2879('0x12')]()=='set'&&_[_0x2879('0x13')](_0x26ab2f[_0x2879('0x11')]['toLowerCase'](),_0x2879('0x14'))){var _0x40a8cf=_0x26ab2f[_0x2879('0x11')][_0x2879('0x15')]('=');dials[_0x26ab2f[_0x2879('0x5')]]={'routeId':_0x40a8cf[0x1]};}}catch(_0x5a5cb3){utils[_0x2879('0x16')](util['format'](_0x2879('0xe'),_0x26ab2f[_0x2879('0x5')]),_0x5a5cb3);}};exports[_0x2879('0x17')]=function(_0x26f599){try{utils[_0x2879('0xd')](util[_0x2879('0x3')](_0x2879('0x18'),_0x26f599['uniqueid']),_0x26f599);if(!_[_0x2879('0x19')](_0x26f599[_0x2879('0x1a')]['outboundrouteid'])){utils[_0x2879('0x2')](util[_0x2879('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x26f599[_0x2879('0x5')],_0x26f599[_0x2879('0x1b')]));dials[_0x26f599[_0x2879('0x5')]]={'routeId':_0x26f599[_0x2879('0x1b')]};}}catch(_0x2c583f){utils[_0x2879('0x16')](util['format']('[%s][dials][varset]',_0x26f599[_0x2879('0x5')]),_0x2c583f);}};exports[_0x2879('0x1c')]=function(_0x59d9e7){try{if(!_[_0x2879('0x19')](dials[_0x59d9e7[_0x2879('0x5')]])){utils['debug'](util[_0x2879('0x3')](_0x2879('0x1d'),_0x59d9e7[_0x2879('0x5')]),_0x59d9e7);dials[_0x59d9e7[_0x2879('0x5')]]=_[_0x2879('0x1e')](dials[_0x59d9e7[_0x2879('0x5')]],_0x59d9e7);dials[_0x59d9e7[_0x2879('0x5')]][_0x2879('0x1f')]=utils['now']();dials[_0x59d9e7[_0x2879('0x5')]][_0x2879('0x20')]='called';utils[_0x2879('0x2')](util[_0x2879('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x59d9e7[_0x2879('0x5')],dials[_0x59d9e7[_0x2879('0x5')]][_0x2879('0x1f')]));}}catch(_0x7136bf){utils[_0x2879('0x16')](util[_0x2879('0x3')](_0x2879('0x1d'),_0x59d9e7[_0x2879('0x5')]),_0x7136bf);}};exports[_0x2879('0x21')]=function(_0x4e4075){try{if(!_[_0x2879('0x19')](dials[_0x4e4075['uniqueid']])){utils['debug'](util[_0x2879('0x3')](_0x2879('0x22'),_0x4e4075[_0x2879('0x5')]),_0x4e4075);dials[_0x4e4075[_0x2879('0x5')]][_0x2879('0xa')]=_0x4e4075[_0x2879('0xa')];if(_0x4e4075[_0x2879('0xa')]==_0x2879('0x23')){dials[_0x4e4075[_0x2879('0x5')]]=_[_0x2879('0x1e')](dials[_0x4e4075[_0x2879('0x5')]],_0x4e4075);dials[_0x4e4075['uniqueid']]['answertime']=utils[_0x2879('0x24')]();dials[_0x4e4075[_0x2879('0x5')]][_0x2879('0x20')]=_0x2879('0x25');utils[_0x2879('0x2')](util['format'](_0x2879('0x26'),_0x4e4075['uniqueid'],_0x4e4075[_0x2879('0xa')],dials[_0x4e4075[_0x2879('0x5')]][_0x2879('0x27')]));}else{utils[_0x2879('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x4e4075[_0x2879('0x5')],_0x4e4075['dialstatus']));}}}catch(_0xa8900c){utils[_0x2879('0x16')](util['format']('[%s][dials][dialend]',_0x4e4075[_0x2879('0x5')]),_0xa8900c);}};exports[_0x2879('0x28')]=function(_0x3352ca){try{if(!_[_0x2879('0x19')](dials[_0x3352ca[_0x2879('0x5')]])){utils['debug'](util[_0x2879('0x3')]('[%s][dials][hangup]',_0x3352ca['uniqueid']),_0x3352ca);utils[_0x2879('0x2')](util[_0x2879('0x3')](_0x2879('0x29'),_0x3352ca['uniqueid'],_0x3352ca[_0x2879('0x8')],_0x3352ca['calleridname'],_0x3352ca[_0x2879('0x2a')]));dials[_0x3352ca[_0x2879('0x5')]]=_['assign'](dials[_0x3352ca[_0x2879('0x5')]],{'endtime':utils[_0x2879('0x24')](),'lastevent':_0x2879('0x2b')});dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x2c')]=utils[_0x2879('0x2d')](dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x2e')],dials[_0x3352ca[_0x2879('0x5')]]['starttime']);dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x2f')]=utils[_0x2879('0x2d')](dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x27')]||dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x2e')],dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x1f')]);dials[_0x3352ca[_0x2879('0x5')]]['billableseconds']=dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x27')]?utils['diffTime'](dials[_0x3352ca[_0x2879('0x5')]][_0x2879('0x2e')],dials[_0x3352ca[_0x2879('0x5')]]['answertime']):0x0;writeDB(dials[_0x3352ca['uniqueid']]);}}catch(_0x20f5cb){utils[_0x2879('0x16')](util[_0x2879('0x3')]('[%s][dials][hangup]',_0x3352ca[_0x2879('0x5')]),_0x20f5cb);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c24b556..4c37f91 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 _0x5513=['[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','debug','devicestatechange','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','error','uniqueid','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]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5513,0x117));var _0x3551=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x5513[_0x2bf141];return _0x48277b;};var AsteriskManager=require('asterisk-manager');var config=require(_0x3551('0x0'));var utils=require(_0x3551('0x1'));var util=require(_0x3551('0x2'));var isXDREnabled=config[_0x3551('0x3')]&&config[_0x3551('0x3')][_0x3551('0x4')]?!config[_0x3551('0x3')][_0x3551('0x4')]:!![];var isProduction=config['env']===_0x3551('0x5')||![];var isLocalAsterisk=config[_0x3551('0x3')]&&config[_0x3551('0x3')][_0x3551('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0x3551('0x7')]['ip'],config[_0x3551('0x7')][_0x3551('0x8')],config[_0x3551('0x7')][_0x3551('0x9')],!![]);ami[_0x3551('0xa')]();if(!isXDREnabled){utils[_0x3551('0xb')](_0x3551('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x3551('0xb')](_0x3551('0xd'));}else{var agents=require(_0x3551('0xe'));var calls=require(_0x3551('0xf'));var queues=require(_0x3551('0x10'));var recordings=require(_0x3551('0x11'));var members=require(_0x3551('0x12'));var dials=require('./dials.controller');var transfers=require(_0x3551('0x13'));var core=require('./core.controller');ami['on'](_0x3551('0x14'),core[_0x3551('0x14')]);ami['on'](_0x3551('0x15'),core[_0x3551('0x15')]);ami['on'](_0x3551('0x16'),core[_0x3551('0x16')]);ami['on']('error',core['error']);ami['on']('close',core[_0x3551('0x17')]);ami['on'](_0x3551('0x18'),core[_0x3551('0x18')]);ami['on']('devicestatechange',function(_0x3093d7){try{utils[_0x3551('0x19')](util['format']('[%s][index][devicestatechange]',_0x3093d7['device']),_0x3093d7);members[_0x3551('0x1a')](_0x3093d7);}catch(_0x3fd82e){utils['error'](util[_0x3551('0x1b')]('[%s][index][devicestatechange]',_0x3093d7['device']),_0x3fd82e);}});ami['on'](_0x3551('0x1c'),function(_0x24138b){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')]('[%s][index][agentcalled]',_0x24138b['uniqueid']),_0x24138b);agents['agentcalled'](_0x24138b);}catch(_0x48e38b){utils['error'](util[_0x3551('0x1b')](_0x3551('0x1d'),_0x24138b['uniqueid']),_0x48e38b);}});ami['on'](_0x3551('0x1e'),function(_0x88ec69){try{utils['debug'](util['format'](_0x3551('0x1f'),_0x88ec69['uniqueid']),_0x88ec69);agents[_0x3551('0x1e')](_0x88ec69);}catch(_0x5e1166){utils[_0x3551('0x20')](util['format'](_0x3551('0x1f'),_0x88ec69[_0x3551('0x21')]),_0x5e1166);}});ami['on'](_0x3551('0x22'),function(_0x1e6887){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x1e6887[_0x3551('0x21')]),_0x1e6887);agents[_0x3551('0x22')](_0x1e6887);queues['agentconnect'](_0x1e6887);}catch(_0xbcb5d5){utils[_0x3551('0x20')](util['format'](_0x3551('0x23'),_0x1e6887[_0x3551('0x21')]),_0xbcb5d5);}});ami['on']('agentcomplete',function(_0x4f20da){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')]('[%s][index][agentcomplete]',_0x4f20da[_0x3551('0x21')]),_0x4f20da);agents[_0x3551('0x24')](_0x4f20da);queues[_0x3551('0x24')](_0x4f20da);members[_0x3551('0x24')](_0x4f20da);}catch(_0x397808){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x25'),_0x4f20da[_0x3551('0x21')]),_0x397808);}});ami['on'](_0x3551('0x26'),function(_0x9a98e4){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x27'),_0x9a98e4['uniqueid']),_0x9a98e4);agents[_0x3551('0x26')](_0x9a98e4);queues['queuecallerabandon'](_0x9a98e4);}catch(_0x3da3f9){utils['error'](util[_0x3551('0x1b')](_0x3551('0x27'),_0x9a98e4[_0x3551('0x21')]),_0x3da3f9);}});ami['on'](_0x3551('0x28'),function(_0x2aa88f){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x29'),_0x2aa88f[_0x3551('0x21')]),_0x2aa88f);queues[_0x3551('0x28')](_0x2aa88f);recordings[_0x3551('0x28')](_0x2aa88f);}catch(_0x36c0ef){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x29'),_0x2aa88f['uniqueid']),_0x36c0ef);}});ami['on'](_0x3551('0x2a'),function(_0x375a7c){try{utils[_0x3551('0x19')](util['format'](_0x3551('0x2b'),_0x375a7c[_0x3551('0x21')]),_0x375a7c);queues[_0x3551('0x2a')](_0x375a7c);}catch(_0x1c8082){utils['error'](util[_0x3551('0x1b')](_0x3551('0x2b'),_0x375a7c[_0x3551('0x21')]),_0x1c8082);}});ami['on'](_0x3551('0x2c'),function(_0x227a4b){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')]('[%s][index][musiconholdstart]',_0x227a4b[_0x3551('0x21')]),_0x227a4b);queues[_0x3551('0x2c')](_0x227a4b);calls['musiconholdstart'](_0x227a4b);}catch(_0x45b499){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x2d'),_0x227a4b['uniqueid']),_0x45b499);}});ami['on'](_0x3551('0x2e'),function(_0x5b7c1a){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x2f'),_0x5b7c1a[_0x3551('0x21')]),_0x5b7c1a);queues[_0x3551('0x2e')](_0x5b7c1a);calls[_0x3551('0x2e')](_0x5b7c1a);}catch(_0x3dd927){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x2f'),_0x5b7c1a[_0x3551('0x21')]),_0x3dd927);}});ami['on']('newstate',function(_0x2f7b3){try{utils[_0x3551('0x19')](util['format'](_0x3551('0x30'),_0x2f7b3[_0x3551('0x21')]),_0x2f7b3);calls[_0x3551('0x31')](_0x2f7b3);recordings[_0x3551('0x31')](_0x2f7b3);}catch(_0xa64f0d){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x30'),_0x2f7b3['uniqueid']),_0xa64f0d);}});ami['on'](_0x3551('0x32'),function(_0x1d7d6c){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x33'),_0x1d7d6c['uniqueid']),_0x1d7d6c);calls['hangup'](_0x1d7d6c);recordings[_0x3551('0x32')](_0x1d7d6c);dials['hangup'](_0x1d7d6c);agents[_0x3551('0x32')](_0x1d7d6c);queues[_0x3551('0x32')](_0x1d7d6c);}catch(_0x311633){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x33'),_0x1d7d6c[_0x3551('0x21')]),_0x311633);}});ami['on'](_0x3551('0x34'),function(_0x5eeafa){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x35'),_0x5eeafa['uniqueid']),_0x5eeafa);members[_0x3551('0x34')](_0x5eeafa);}catch(_0x45f3d1){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x35'),_0x5eeafa['uniqueid']),_0x45f3d1);}});ami['on'](_0x3551('0x36'),function(_0x10336d){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x37'),_0x10336d['uniqueid']),_0x10336d);queues[_0x3551('0x36')](_0x10336d);agents[_0x3551('0x36')](_0x10336d);transfers[_0x3551('0x36')](_0x10336d);recordings[_0x3551('0x36')](_0x10336d);}catch(_0x4f74ac){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x37'),_0x10336d[_0x3551('0x21')]),_0x4f74ac);}});ami['on'](_0x3551('0x38'),function(_0x5a85d7){try{utils['debug'](util[_0x3551('0x1b')](_0x3551('0x39'),_0x5a85d7[_0x3551('0x3a')]),_0x5a85d7);queues[_0x3551('0x38')](_0x5a85d7);transfers[_0x3551('0x38')](_0x5a85d7);agents[_0x3551('0x38')](_0x5a85d7);calls['attendedtransfer'](_0x5a85d7);}catch(_0x17b44c){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x39'),_0x5a85d7['origtransfereruniqueid']),_0x17b44c);}});ami['on'](_0x3551('0x3b'),function(_0x347cba){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x3c'),_0x347cba[_0x3551('0x21')]),_0x347cba);queues['varset'](_0x347cba);recordings['varset'](_0x347cba);calls[_0x3551('0x3b')](_0x347cba);dials['varset'](_0x347cba);}catch(_0x38698){utils[_0x3551('0x20')](util['format'](_0x3551('0x3c'),_0x347cba[_0x3551('0x21')]),_0x38698);}});ami['on'](_0x3551('0x3d'),function(_0x15c5ce){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')](_0x3551('0x3e'),_0x15c5ce[_0x3551('0x21')]),_0x15c5ce);calls['newexten'](_0x15c5ce);recordings['newexten'](_0x15c5ce);dials['newexten'](_0x15c5ce);}catch(_0x59b510){utils[_0x3551('0x20')](util[_0x3551('0x1b')]('[%s][index][newexten]',_0x15c5ce['uniqueid']),_0x59b510);}});ami['on'](_0x3551('0x3f'),function(_0x12e067){try{utils['debug'](util['format'](_0x3551('0x40'),_0x12e067[_0x3551('0x21')]),_0x12e067);calls[_0x3551('0x3f')](_0x12e067);recordings[_0x3551('0x3f')](_0x12e067);}catch(_0x28e0ca){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x40'),_0x12e067[_0x3551('0x21')]),_0x28e0ca);}});ami['on'](_0x3551('0x41'),function(_0x3ad6f4){try{utils[_0x3551('0x19')](util[_0x3551('0x1b')]('[%s][index][dialbegin]',_0x3ad6f4[_0x3551('0x21')]),_0x3ad6f4);dials[_0x3551('0x41')](_0x3ad6f4);}catch(_0x3bdb11){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x42'),_0x3ad6f4[_0x3551('0x21')]),_0x3bdb11);}});ami['on'](_0x3551('0x43'),function(_0x44be66){try{utils[_0x3551('0x19')](util['format'](_0x3551('0x44'),_0x44be66[_0x3551('0x21')]),_0x44be66);dials[_0x3551('0x43')](_0x44be66);}catch(_0x50c1fd){utils[_0x3551('0x20')](util[_0x3551('0x1b')](_0x3551('0x44'),_0x44be66['uniqueid']),_0x50c1fd);}});} \ No newline at end of file +var _0x75da=['connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','uniqueid','agentcalled','[%s][index][agentcalled]','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]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller'];(function(_0x16f38d,_0x993ab3){var _0x48b708=function(_0x3d2194){while(--_0x3d2194){_0x16f38d['push'](_0x16f38d['shift']());}};_0x48b708(++_0x993ab3);}(_0x75da,0x108));var _0xa75d=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x75da[_0x13524d];return _0x9918b4;};var AsteriskManager=require(_0xa75d('0x0'));var config=require(_0xa75d('0x1'));var utils=require(_0xa75d('0x2'));var util=require(_0xa75d('0x3'));var isXDREnabled=config[_0xa75d('0x4')]&&config[_0xa75d('0x4')][_0xa75d('0x5')]?!config['xdr'][_0xa75d('0x5')]:!![];var isProduction=config[_0xa75d('0x6')]===_0xa75d('0x7')||![];var isLocalAsterisk=config[_0xa75d('0x4')]&&config[_0xa75d('0x4')][_0xa75d('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config['asterisk']['ip'],config[_0xa75d('0x9')][_0xa75d('0xa')],config[_0xa75d('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xa75d('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xa75d('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xa75d('0xd'));var calls=require(_0xa75d('0xe'));var queues=require(_0xa75d('0xf'));var recordings=require(_0xa75d('0x10'));var members=require(_0xa75d('0x11'));var dials=require(_0xa75d('0x12'));var transfers=require('./transfers.controller');var core=require(_0xa75d('0x13'));ami['on'](_0xa75d('0x14'),core['connect']);ami['on'](_0xa75d('0x15'),core[_0xa75d('0x15')]);ami['on']('fullybooted',core[_0xa75d('0x16')]);ami['on'](_0xa75d('0x17'),core[_0xa75d('0x17')]);ami['on'](_0xa75d('0x18'),core[_0xa75d('0x18')]);ami['on'](_0xa75d('0x19'),core['managerevent']);ami['on']('devicestatechange',function(_0x4d8985){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x1c'),_0x4d8985[_0xa75d('0x1d')]),_0x4d8985);members[_0xa75d('0x1e')](_0x4d8985);}catch(_0x4f3ddb){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x1c'),_0x4d8985['device']),_0x4f3ddb);}});ami['on']('agentcalled',function(_0xeccd7a){try{utils['debug'](util['format']('[%s][index][agentcalled]',_0xeccd7a[_0xa75d('0x1f')]),_0xeccd7a);agents[_0xa75d('0x20')](_0xeccd7a);}catch(_0x5b6f9b){utils[_0xa75d('0x17')](util['format'](_0xa75d('0x21'),_0xeccd7a['uniqueid']),_0x5b6f9b);}});ami['on'](_0xa75d('0x22'),function(_0x12c304){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x23'),_0x12c304[_0xa75d('0x1f')]),_0x12c304);agents[_0xa75d('0x22')](_0x12c304);}catch(_0x14c3a9){utils[_0xa75d('0x17')](util['format'](_0xa75d('0x23'),_0x12c304[_0xa75d('0x1f')]),_0x14c3a9);}});ami['on'](_0xa75d('0x24'),function(_0x8f8169){try{utils[_0xa75d('0x1a')](util['format'](_0xa75d('0x25'),_0x8f8169[_0xa75d('0x1f')]),_0x8f8169);agents['agentconnect'](_0x8f8169);queues[_0xa75d('0x24')](_0x8f8169);}catch(_0x1fa13b){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x25'),_0x8f8169[_0xa75d('0x1f')]),_0x1fa13b);}});ami['on']('agentcomplete',function(_0x111fdc){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')]('[%s][index][agentcomplete]',_0x111fdc[_0xa75d('0x1f')]),_0x111fdc);agents[_0xa75d('0x26')](_0x111fdc);queues['agentcomplete'](_0x111fdc);members[_0xa75d('0x26')](_0x111fdc);}catch(_0x16be57){utils[_0xa75d('0x17')](util['format'](_0xa75d('0x27'),_0x111fdc[_0xa75d('0x1f')]),_0x16be57);}});ami['on'](_0xa75d('0x28'),function(_0x3f523b){try{utils[_0xa75d('0x1a')](util['format'](_0xa75d('0x29'),_0x3f523b[_0xa75d('0x1f')]),_0x3f523b);agents['queuecallerabandon'](_0x3f523b);queues[_0xa75d('0x28')](_0x3f523b);}catch(_0x3ee5cb){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')]('[%s][index][queuecallerabandon]',_0x3f523b[_0xa75d('0x1f')]),_0x3ee5cb);}});ami['on'](_0xa75d('0x2a'),function(_0x2caece){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')]('[%s][index][queuecallerjoin]',_0x2caece[_0xa75d('0x1f')]),_0x2caece);queues[_0xa75d('0x2a')](_0x2caece);recordings[_0xa75d('0x2a')](_0x2caece);}catch(_0x55702a){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x2b'),_0x2caece[_0xa75d('0x1f')]),_0x55702a);}});ami['on'](_0xa75d('0x2c'),function(_0x56504a){try{utils['debug'](util[_0xa75d('0x1b')]('[%s][index][queuecallerleave]',_0x56504a[_0xa75d('0x1f')]),_0x56504a);queues[_0xa75d('0x2c')](_0x56504a);}catch(_0x541494){utils[_0xa75d('0x17')](util['format'](_0xa75d('0x2d'),_0x56504a[_0xa75d('0x1f')]),_0x541494);}});ami['on'](_0xa75d('0x2e'),function(_0x1a0017){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x2f'),_0x1a0017[_0xa75d('0x1f')]),_0x1a0017);queues[_0xa75d('0x2e')](_0x1a0017);calls[_0xa75d('0x2e')](_0x1a0017);}catch(_0x3e2e06){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x2f'),_0x1a0017[_0xa75d('0x1f')]),_0x3e2e06);}});ami['on'](_0xa75d('0x30'),function(_0x502926){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x31'),_0x502926[_0xa75d('0x1f')]),_0x502926);queues['musiconholdstop'](_0x502926);calls[_0xa75d('0x30')](_0x502926);}catch(_0x3d8783){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x31'),_0x502926[_0xa75d('0x1f')]),_0x3d8783);}});ami['on']('newstate',function(_0x3ceab5){try{utils['debug'](util[_0xa75d('0x1b')](_0xa75d('0x32'),_0x3ceab5['uniqueid']),_0x3ceab5);calls[_0xa75d('0x33')](_0x3ceab5);recordings[_0xa75d('0x33')](_0x3ceab5);}catch(_0x25d541){utils[_0xa75d('0x17')](util['format']('[%s][index][newstate]',_0x3ceab5[_0xa75d('0x1f')]),_0x25d541);}});ami['on'](_0xa75d('0x34'),function(_0x41759a){try{utils['debug'](util[_0xa75d('0x1b')](_0xa75d('0x35'),_0x41759a[_0xa75d('0x1f')]),_0x41759a);calls['hangup'](_0x41759a);recordings['hangup'](_0x41759a);dials[_0xa75d('0x34')](_0x41759a);agents[_0xa75d('0x34')](_0x41759a);queues['hangup'](_0x41759a);}catch(_0x1ccda1){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x35'),_0x41759a[_0xa75d('0x1f')]),_0x1ccda1);}});ami['on']('cdr',function(_0x23853b){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')]('[%s][index][cdr]',_0x23853b['uniqueid']),_0x23853b);members[_0xa75d('0x36')](_0x23853b);}catch(_0x32f9a4){utils['error'](util['format'](_0xa75d('0x37'),_0x23853b[_0xa75d('0x1f')]),_0x32f9a4);}});ami['on'](_0xa75d('0x38'),function(_0x2d5681){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x39'),_0x2d5681['uniqueid']),_0x2d5681);queues[_0xa75d('0x38')](_0x2d5681);agents[_0xa75d('0x38')](_0x2d5681);transfers[_0xa75d('0x38')](_0x2d5681);recordings[_0xa75d('0x38')](_0x2d5681);}catch(_0x486a47){utils['error'](util[_0xa75d('0x1b')](_0xa75d('0x39'),_0x2d5681[_0xa75d('0x1f')]),_0x486a47);}});ami['on'](_0xa75d('0x3a'),function(_0x57d606){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')]('[%s][index][attendedtransfer]',_0x57d606['origtransfereruniqueid']),_0x57d606);queues[_0xa75d('0x3a')](_0x57d606);transfers[_0xa75d('0x3a')](_0x57d606);agents[_0xa75d('0x3a')](_0x57d606);calls['attendedtransfer'](_0x57d606);}catch(_0xfe8385){utils['error'](util[_0xa75d('0x1b')](_0xa75d('0x3b'),_0x57d606[_0xa75d('0x3c')]),_0xfe8385);}});ami['on']('varset',function(_0x40ed18){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x3d'),_0x40ed18[_0xa75d('0x1f')]),_0x40ed18);queues['varset'](_0x40ed18);recordings['varset'](_0x40ed18);calls['varset'](_0x40ed18);dials[_0xa75d('0x3e')](_0x40ed18);}catch(_0x2b0964){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x3d'),_0x40ed18[_0xa75d('0x1f')]),_0x2b0964);}});ami['on'](_0xa75d('0x3f'),function(_0x29845a){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x40'),_0x29845a[_0xa75d('0x1f')]),_0x29845a);calls[_0xa75d('0x3f')](_0x29845a);recordings[_0xa75d('0x3f')](_0x29845a);dials[_0xa75d('0x3f')](_0x29845a);}catch(_0x33c58f){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x40'),_0x29845a[_0xa75d('0x1f')]),_0x33c58f);}});ami['on'](_0xa75d('0x41'),function(_0x8192bf){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x42'),_0x8192bf[_0xa75d('0x1f')]),_0x8192bf);calls['newchannel'](_0x8192bf);recordings[_0xa75d('0x41')](_0x8192bf);}catch(_0x14c5f4){utils['error'](util[_0xa75d('0x1b')]('[%s][index][newchannel]',_0x8192bf[_0xa75d('0x1f')]),_0x14c5f4);}});ami['on']('dialbegin',function(_0x401208){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x43'),_0x401208[_0xa75d('0x1f')]),_0x401208);dials[_0xa75d('0x44')](_0x401208);}catch(_0x4b6cf6){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')]('[%s]dialbegin',_0x401208[_0xa75d('0x1f')]),_0x4b6cf6);}});ami['on']('dialend',function(_0x4d048f){try{utils[_0xa75d('0x1a')](util[_0xa75d('0x1b')](_0xa75d('0x45'),_0x4d048f['uniqueid']),_0x4d048f);dials[_0xa75d('0x46')](_0x4d048f);}catch(_0x58dd4d){utils[_0xa75d('0x17')](util[_0xa75d('0x1b')](_0xa75d('0x45'),_0x4d048f[_0xa75d('0x1f')]),_0x58dd4d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f3098c1..03223d1 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 _0x0fec=['diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','then','internal','CreateMemberReport','split','name','request','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','now'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x48a852,_0x4ce058){_0x48a852=_0x48a852-0x0;var _0x9d7018=_0x0fec[_0x48a852];return _0x9d7018;};'use strict';var _=require(_0xc0fe('0x0'));var util=require(_0xc0fe('0x1'));var utils=require(_0xc0fe('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x36377d){utils['info'](util[_0xc0fe('0x3')](_0xc0fe('0x4'),_0x36377d['uniqueid'],_0x36377d[_0xc0fe('0x5')],_0x36377d['channel'],_0x36377d[_0xc0fe('0x6')],_0x36377d[_0xc0fe('0x7')],_0x36377d['type']));if(_0x36377d['interface']){utils['getUserByInterface'](_0x36377d[_0xc0fe('0x5')])[_0xc0fe('0x8')](function(_0x1e5dd3){if(_0x1e5dd3){_0x36377d['membername']=_0x1e5dd3['name'];_0x36377d['internal']=_0x1e5dd3[_0xc0fe('0x9')];utils['request'](_0xc0fe('0xa'),_0x36377d);}else{utils['getUserByName'](_0x36377d[_0xc0fe('0x5')][_0xc0fe('0xb')]('/')[0x1])[_0xc0fe('0x8')](function(_0x6931c2){if(_0x6931c2){_0x36377d[_0xc0fe('0x7')]=_0x6931c2[_0xc0fe('0xc')];_0x36377d['internal']=_0x6931c2[_0xc0fe('0x9')];utils[_0xc0fe('0xd')]('CreateMemberReport',_0x36377d);}});}})['catch'](function(_0x512541){utils[_0xc0fe('0xe')](util[_0xc0fe('0x3')](_0xc0fe('0xf'),_0x36377d['uniqueid']),_0x512541);});}delete members[_0x36377d[_0xc0fe('0x5')]];}function startsWith(_0x46f20f,_0x5ae053){return _['some'](_0x46f20f,function(_0x1c7b1c){return _[_0xc0fe('0x10')](_0x5ae053,_0x1c7b1c);});}exports[_0xc0fe('0x11')]=function(_0x1dd571){try{utils[_0xc0fe('0x12')](util[_0xc0fe('0x3')](_0xc0fe('0x13'),members[_0x1dd571[_0xc0fe('0x14')]]?members[_0x1dd571['device']][_0xc0fe('0x15')]:_0x1dd571[_0xc0fe('0x14')]),_0x1dd571);utils[_0xc0fe('0x16')](util[_0xc0fe('0x3')](_0xc0fe('0x17'),members[_0x1dd571[_0xc0fe('0x14')]]?members[_0x1dd571[_0xc0fe('0x14')]][_0xc0fe('0x15')]:_0x1dd571['device'],_0x1dd571[_0xc0fe('0x18')],_0x1dd571[_0xc0fe('0x14')]));switch(_0x1dd571[_0xc0fe('0x18')]){case _0xc0fe('0x19'):case _0xc0fe('0x1a'):if(!startsWith(exclude,_0x1dd571[_0xc0fe('0x14')])){members[_0x1dd571[_0xc0fe('0x14')]]={'channel':_0xc0fe('0x1b'),'interface':_0x1dd571[_0xc0fe('0x14')],'type':'TALKING','enterAt':utils['now'](),'role':_0xc0fe('0x1c')};}break;case _0xc0fe('0x1d'):if(!_[_0xc0fe('0x1e')](members[_0x1dd571['device']])){members[_0x1dd571[_0xc0fe('0x14')]]['exitAt']=utils[_0xc0fe('0x1f')]();members[_0x1dd571[_0xc0fe('0x14')]]['duration']=utils[_0xc0fe('0x20')](members[_0x1dd571['device']][_0xc0fe('0x21')],members[_0x1dd571[_0xc0fe('0x14')]][_0xc0fe('0x22')]);if(members[_0x1dd571['device']][_0xc0fe('0x15')]){writeDB(members[_0x1dd571['device']]);}}break;default:break;}}catch(_0x408272){utils[_0xc0fe('0xe')](util[_0xc0fe('0x3')](_0xc0fe('0x13'),members[_0x1dd571['device']]?members[_0x1dd571[_0xc0fe('0x14')]][_0xc0fe('0x15')]:_0x1dd571[_0xc0fe('0x14')]),_0x408272);}};exports['agentcomplete']=function(_0x5c23cd){try{if(!_['isNil'](members[_0x5c23cd[_0xc0fe('0x5')]])){utils['debug'](util[_0xc0fe('0x3')](_0xc0fe('0x23'),_0x5c23cd['uniqueid']),_0x5c23cd);utils[_0xc0fe('0x16')](util['format'](_0xc0fe('0x24'),_0x5c23cd[_0xc0fe('0x15')],_0x5c23cd['interface'],_0x5c23cd[_0xc0fe('0x25')]));members[_0x5c23cd[_0xc0fe('0x5')]]=_[_0xc0fe('0x26')](members[_0x5c23cd[_0xc0fe('0x5')]],{'data4':_0x5c23cd[_0xc0fe('0x25')],'uniqueid':_0x5c23cd[_0xc0fe('0x15')]});}}catch(_0x57ee59){utils['error'](util[_0xc0fe('0x3')](_0xc0fe('0x23'),_0x5c23cd[_0xc0fe('0x15')]),_0x57ee59);}};exports[_0xc0fe('0x27')]=function(_0x249da6){try{utils[_0xc0fe('0x12')](util['format']('[%s][members][cdr]',_0x249da6[_0xc0fe('0x15')]),_0x249da6);if(_0x249da6[_0xc0fe('0x28')]){var _0x5db240=_0x249da6[_0xc0fe('0x28')][_0xc0fe('0xb')]('-')[0x0];if(!_['isNil'](members[_0x5db240])){members[_0x5db240]=_[_0xc0fe('0x26')](members[_0x5db240],{'data1':members[_0x5db240][_0xc0fe('0x29')]||_0x249da6[_0xc0fe('0x2a')],'data2':members[_0x5db240][_0xc0fe('0x6')]||_0x249da6[_0xc0fe('0x2b')],'data3':members[_0x5db240][_0xc0fe('0x2c')]||_0x249da6[_0xc0fe('0x2d')],'uniqueid':members[_0x5db240][_0xc0fe('0x15')]||_0x249da6[_0xc0fe('0x15')]});utils[_0xc0fe('0x16')](util[_0xc0fe('0x3')](_0xc0fe('0x2e'),_0x249da6[_0xc0fe('0x15')],members[_0x5db240]['data1'],members[_0x5db240][_0xc0fe('0x6')],members[_0x5db240][_0xc0fe('0x2c')]));if(members[_0x5db240][_0xc0fe('0x21')]){writeDB(members[_0x5db240]);}}}if(_0x249da6['destinationchannel']){var _0x1ce699=_0x249da6[_0xc0fe('0x2f')][_0xc0fe('0xb')]('-')[0x0];if(!_[_0xc0fe('0x1e')](members[_0x1ce699])){members[_0x1ce699]=_[_0xc0fe('0x26')](members[_0x1ce699],{'data1':members[_0x1ce699][_0xc0fe('0x29')]||_0x249da6[_0xc0fe('0x2a')],'data2':members[_0x1ce699][_0xc0fe('0x6')]||_0x249da6[_0xc0fe('0x2b')],'data3':members[_0x1ce699][_0xc0fe('0x2c')]||_0x249da6[_0xc0fe('0x2d')],'uniqueid':members[_0x1ce699][_0xc0fe('0x15')]||_0x249da6[_0xc0fe('0x15')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x249da6['uniqueid'],members[_0x1ce699]['data1'],members[_0x1ce699][_0xc0fe('0x6')],members[_0x1ce699][_0xc0fe('0x2c')]));if(members[_0x1ce699][_0xc0fe('0x21')]){writeDB(members[_0x1ce699]);}}}}catch(_0x5be64a){utils[_0xc0fe('0xe')](util[_0xc0fe('0x3')](_0xc0fe('0x30'),_0x249da6[_0xc0fe('0x15')]),_0x5be64a);}}; \ No newline at end of file +var _0x48ea=['source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','lodash','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','request','catch','error','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','isNil','exitAt','now','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1'];(function(_0x296498,_0x1d2ab5){var _0x9d5b34=function(_0x556f53){while(--_0x556f53){_0x296498['push'](_0x296498['shift']());}};_0x9d5b34(++_0x1d2ab5);}(_0x48ea,0x9c));var _0xa48e=function(_0x2f6c13,_0x54b9d7){_0x2f6c13=_0x2f6c13-0x0;var _0x4d2521=_0x48ea[_0x2f6c13];return _0x4d2521;};'use strict';var _=require(_0xa48e('0x0'));var util=require('util');var utils=require(_0xa48e('0x1'));var members={};var exclude=[_0xa48e('0x2'),_0xa48e('0x3')];function writeDB(_0x492009){utils['info'](util[_0xa48e('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x492009[_0xa48e('0x5')],_0x492009[_0xa48e('0x6')],_0x492009[_0xa48e('0x7')],_0x492009[_0xa48e('0x8')],_0x492009[_0xa48e('0x9')],_0x492009[_0xa48e('0xa')]));if(_0x492009[_0xa48e('0x6')]){utils[_0xa48e('0xb')](_0x492009[_0xa48e('0x6')])[_0xa48e('0xc')](function(_0x3585a6){if(_0x3585a6){_0x492009[_0xa48e('0x9')]=_0x3585a6[_0xa48e('0xd')];_0x492009[_0xa48e('0xe')]=_0x3585a6[_0xa48e('0xe')];utils['request'](_0xa48e('0xf'),_0x492009);}else{utils['getUserByName'](_0x492009['interface']['split']('/')[0x1])[_0xa48e('0xc')](function(_0x5899a8){if(_0x5899a8){_0x492009[_0xa48e('0x9')]=_0x5899a8[_0xa48e('0xd')];_0x492009['internal']=_0x5899a8[_0xa48e('0xe')];utils[_0xa48e('0x10')](_0xa48e('0xf'),_0x492009);}});}})[_0xa48e('0x11')](function(_0x2eeef3){utils[_0xa48e('0x12')](util[_0xa48e('0x4')]('[%s][members][writeDB]',_0x492009[_0xa48e('0x5')]),_0x2eeef3);});}delete members[_0x492009[_0xa48e('0x6')]];}function startsWith(_0x2653d1,_0x58b8b){return _['some'](_0x2653d1,function(_0x188faf){return _[_0xa48e('0x13')](_0x58b8b,_0x188faf);});}exports[_0xa48e('0x14')]=function(_0x28c15c){try{utils[_0xa48e('0x15')](util[_0xa48e('0x4')](_0xa48e('0x16'),members[_0x28c15c[_0xa48e('0x17')]]?members[_0x28c15c[_0xa48e('0x17')]][_0xa48e('0x5')]:_0x28c15c[_0xa48e('0x17')]),_0x28c15c);utils[_0xa48e('0x18')](util[_0xa48e('0x4')](_0xa48e('0x19'),members[_0x28c15c[_0xa48e('0x17')]]?members[_0x28c15c['device']]['uniqueid']:_0x28c15c[_0xa48e('0x17')],_0x28c15c['state'],_0x28c15c[_0xa48e('0x17')]));switch(_0x28c15c[_0xa48e('0x1a')]){case _0xa48e('0x1b'):case _0xa48e('0x1c'):if(!startsWith(exclude,_0x28c15c[_0xa48e('0x17')])){members[_0x28c15c[_0xa48e('0x17')]]={'channel':_0xa48e('0x1d'),'interface':_0x28c15c['device'],'type':_0xa48e('0x1e'),'enterAt':utils['now'](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0xa48e('0x1f')](members[_0x28c15c[_0xa48e('0x17')]])){members[_0x28c15c[_0xa48e('0x17')]][_0xa48e('0x20')]=utils[_0xa48e('0x21')]();members[_0x28c15c[_0xa48e('0x17')]][_0xa48e('0x22')]=utils[_0xa48e('0x23')](members[_0x28c15c[_0xa48e('0x17')]][_0xa48e('0x20')],members[_0x28c15c[_0xa48e('0x17')]]['enterAt']);if(members[_0x28c15c[_0xa48e('0x17')]][_0xa48e('0x5')]){writeDB(members[_0x28c15c[_0xa48e('0x17')]]);}}break;default:break;}}catch(_0x5f3d71){utils[_0xa48e('0x12')](util[_0xa48e('0x4')](_0xa48e('0x16'),members[_0x28c15c[_0xa48e('0x17')]]?members[_0x28c15c['device']][_0xa48e('0x5')]:_0x28c15c['device']),_0x5f3d71);}};exports[_0xa48e('0x24')]=function(_0xb8aff0){try{if(!_[_0xa48e('0x1f')](members[_0xb8aff0[_0xa48e('0x6')]])){utils[_0xa48e('0x15')](util[_0xa48e('0x4')]('[%s][members][agentcomplete]',_0xb8aff0['uniqueid']),_0xb8aff0);utils[_0xa48e('0x18')](util[_0xa48e('0x4')](_0xa48e('0x25'),_0xb8aff0[_0xa48e('0x5')],_0xb8aff0[_0xa48e('0x6')],_0xb8aff0[_0xa48e('0x26')]));members[_0xb8aff0[_0xa48e('0x6')]]=_[_0xa48e('0x27')](members[_0xb8aff0[_0xa48e('0x6')]],{'data4':_0xb8aff0[_0xa48e('0x26')],'uniqueid':_0xb8aff0[_0xa48e('0x5')]});}}catch(_0x1be4fb){utils['error'](util[_0xa48e('0x4')](_0xa48e('0x28'),_0xb8aff0[_0xa48e('0x5')]),_0x1be4fb);}};exports[_0xa48e('0x29')]=function(_0x53ac88){try{utils[_0xa48e('0x15')](util[_0xa48e('0x4')](_0xa48e('0x2a'),_0x53ac88[_0xa48e('0x5')]),_0x53ac88);if(_0x53ac88[_0xa48e('0x7')]){var _0x26155d=_0x53ac88['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x26155d])){members[_0x26155d]=_[_0xa48e('0x27')](members[_0x26155d],{'data1':members[_0x26155d][_0xa48e('0x2b')]||_0x53ac88[_0xa48e('0xa')],'data2':members[_0x26155d][_0xa48e('0x8')]||_0x53ac88[_0xa48e('0x2c')],'data3':members[_0x26155d]['data3']||_0x53ac88[_0xa48e('0x2d')],'uniqueid':members[_0x26155d][_0xa48e('0x5')]||_0x53ac88[_0xa48e('0x5')]});utils[_0xa48e('0x18')](util['format'](_0xa48e('0x2e'),_0x53ac88[_0xa48e('0x5')],members[_0x26155d][_0xa48e('0x2b')],members[_0x26155d]['data2'],members[_0x26155d][_0xa48e('0x2f')]));if(members[_0x26155d]['exitAt']){writeDB(members[_0x26155d]);}}}if(_0x53ac88[_0xa48e('0x30')]){var _0x54344e=_0x53ac88[_0xa48e('0x30')][_0xa48e('0x31')]('-')[0x0];if(!_[_0xa48e('0x1f')](members[_0x54344e])){members[_0x54344e]=_[_0xa48e('0x27')](members[_0x54344e],{'data1':members[_0x54344e]['data1']||_0x53ac88[_0xa48e('0xa')],'data2':members[_0x54344e][_0xa48e('0x8')]||_0x53ac88[_0xa48e('0x2c')],'data3':members[_0x54344e][_0xa48e('0x2f')]||_0x53ac88[_0xa48e('0x2d')],'uniqueid':members[_0x54344e][_0xa48e('0x5')]||_0x53ac88['uniqueid']});utils['info'](util[_0xa48e('0x4')](_0xa48e('0x2e'),_0x53ac88[_0xa48e('0x5')],members[_0x54344e]['data1'],members[_0x54344e][_0xa48e('0x8')],members[_0x54344e]['data3']));if(members[_0x54344e][_0xa48e('0x20')]){writeDB(members[_0x54344e]);}}}}catch(_0x34e296){utils[_0xa48e('0x12')](util[_0xa48e('0x4')](_0xa48e('0x2a'),_0x53ac88[_0xa48e('0x5')]),_0x34e296);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 9aa0abc..bae36ed 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 _0x6a4f=['EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentcomplete]','assigned','lastAssignedTo','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','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','transfertargetuniqueid','holdtime','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][varset]','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition'];(function(_0x878d94,_0x5612ae){var _0x4ad1b0=function(_0x146f4c){while(--_0x146f4c){_0x878d94['push'](_0x878d94['shift']());}};_0x4ad1b0(++_0x5612ae);}(_0x6a4f,0x179));var _0xf6a4=function(_0x2859da,_0x5d6b1b){_0x2859da=_0x2859da-0x0;var _0x50c5ce=_0x6a4f[_0x2859da];return _0x50c5ce;};'use strict';var _=require(_0xf6a4('0x0'));var util=require('util');var utils=require(_0xf6a4('0x1'));var queues={};function writeDB(_0x103878){utils['info'](util[_0xf6a4('0x2')](_0xf6a4('0x3'),_0x103878[_0xf6a4('0x4')],_0x103878[_0xf6a4('0x5')],_0x103878[_0xf6a4('0x6')],_0x103878['lastAssignedTo'],_0x103878[_0xf6a4('0x7')],_0x103878[_0xf6a4('0x8')],_0x103878[_0xf6a4('0x9')]));if(_0x103878[_0xf6a4('0x6')]){utils[_0xf6a4('0xa')](_0x103878[_0xf6a4('0x6')])['then'](function(_0xd33bab){if(_0xd33bab){_0x103878[_0xf6a4('0xb')]=_0xd33bab[_0xf6a4('0xb')];}utils[_0xf6a4('0xc')]('CreateVoiceQueueReport',_0x103878);});}else{utils['request'](_0xf6a4('0xd'),_0x103878);}if(_0x103878[_0xf6a4('0xe')]){delete queues[_0x103878[_0xf6a4('0xe')]];}else{delete queues[_0x103878['uniqueid']];}}exports[_0xf6a4('0xf')]=function(_0x3d0a49){try{utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')](_0xf6a4('0x11'),_0x3d0a49[_0xf6a4('0x4')]),_0x3d0a49);utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3d0a49[_0xf6a4('0x4')],_0x3d0a49[_0xf6a4('0x6')],_0x3d0a49[_0xf6a4('0x13')]));queues[_0x3d0a49[_0xf6a4('0x4')]]=_['assign'](_0x3d0a49,{'originalposition':_0x3d0a49[_0xf6a4('0x13')],'queuecallerjoinAt':utils[_0xf6a4('0x14')](),'mohtime':0x0});}catch(_0x32274b){utils[_0xf6a4('0x15')](util[_0xf6a4('0x2')](_0xf6a4('0x11'),_0x3d0a49['uniqueid']),_0x32274b);}};exports[_0xf6a4('0x16')]=function(_0x12ba84){try{if(!_[_0xf6a4('0x17')](queues[_0x12ba84[_0xf6a4('0x4')]])){utils['debug'](util['format'](_0xf6a4('0x18'),_0x12ba84[_0xf6a4('0x4')]),_0x12ba84);if(queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x19')]){if(!queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x1a')]&&!queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x1b')]){queues[_0x12ba84['uniqueid']][_0xf6a4('0x1c')]=!![];queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x1d')]=utils['now']();queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x9')]=_0xf6a4('0x1e');}utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x1f'),_0x12ba84[_0xf6a4('0x4')],queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x20')],queues[_0x12ba84[_0xf6a4('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x12ba84['uniqueid']]);}else if(queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0xe')]){utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x21'),_0x12ba84[_0xf6a4('0x4')],queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0x20')],queues[_0x12ba84[_0xf6a4('0x4')]][_0xf6a4('0xe')]));queues[queues[_0x12ba84[_0xf6a4('0x4')]]['transfereduniqueid']]=queues[_0x12ba84[_0xf6a4('0x4')]];queues[queues[_0x12ba84[_0xf6a4('0x4')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x12ba84[_0xf6a4('0x4')]];}}}catch(_0xf547ce){utils[_0xf6a4('0x15')](util[_0xf6a4('0x2')](_0xf6a4('0x18'),_0x12ba84[_0xf6a4('0x4')]),_0xf547ce);}};exports['varset']=function(_0x2cdcf7){try{utils[_0xf6a4('0x10')](util['format'](_0xf6a4('0x22'),_0x2cdcf7[_0xf6a4('0x4')]),_0x2cdcf7);if(!_[_0xf6a4('0x17')](_0x2cdcf7['variable'][_0xf6a4('0x23')])&&_0x2cdcf7['value'][_0xf6a4('0x24')]()!=='CONTINUE'){if(!_[_0xf6a4('0x17')](queues[_0x2cdcf7['uniqueid']])){queues[_0x2cdcf7[_0xf6a4('0x4')]]['queuecallerabandon']=![];queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x25')]=null;queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x1b')]=!![];queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x26')]=utils[_0xf6a4('0x14')]();queues[_0x2cdcf7['uniqueid']][_0xf6a4('0x9')]=_0x2cdcf7[_0xf6a4('0x27')][_0xf6a4('0x24')]();utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x28'),_0x2cdcf7[_0xf6a4('0x4')],queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x20')],_0x2cdcf7[_0xf6a4('0x27')],queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x9')]));writeDB(queues[_0x2cdcf7[_0xf6a4('0x4')]]);}}else if(!_[_0xf6a4('0x17')](_0x2cdcf7[_0xf6a4('0x29')][_0xf6a4('0x2a')])){if(!_[_0xf6a4('0x17')](queues[_0x2cdcf7[_0xf6a4('0x4')]])&&!queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x1a')]){queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x1a')]=![];queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x25')]=null;queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x1b')]=!![];queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x26')]=utils[_0xf6a4('0x14')]();queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x9')]=_0xf6a4('0x2b');utils['info'](util[_0xf6a4('0x2')](_0xf6a4('0x2c'),_0x2cdcf7[_0xf6a4('0x4')],queues[_0x2cdcf7[_0xf6a4('0x4')]][_0xf6a4('0x20')],_0x2cdcf7[_0xf6a4('0x27')],queues[_0x2cdcf7[_0xf6a4('0x4')]]['queuecallerexitreason']));}}}catch(_0x2654f0){utils[_0xf6a4('0x15')](util['format']('[%s][queues][varset]',_0x2cdcf7[_0xf6a4('0x4')]),_0x2654f0);}};exports[_0xf6a4('0x1a')]=function(_0x41fefb){try{if(!_['isNil'](queues[_0x41fefb[_0xf6a4('0x4')]])){utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')]('[%s][queues][queuecallerabandon]',_0x41fefb[_0xf6a4('0x4')]),_0x41fefb);queues[_0x41fefb[_0xf6a4('0x4')]][_0xf6a4('0x1b')]=![];queues[_0x41fefb['uniqueid']][_0xf6a4('0x26')]=null;queues[_0x41fefb[_0xf6a4('0x4')]][_0xf6a4('0x1a')]=!![];queues[_0x41fefb[_0xf6a4('0x4')]][_0xf6a4('0x25')]=utils[_0xf6a4('0x14')]();queues[_0x41fefb[_0xf6a4('0x4')]][_0xf6a4('0x9')]=_0xf6a4('0x2d');utils[_0xf6a4('0x12')](util['format'](_0xf6a4('0x2e'),_0x41fefb[_0xf6a4('0x4')],queues[_0x41fefb[_0xf6a4('0x4')]][_0xf6a4('0x20')],queues[_0x41fefb[_0xf6a4('0x4')]]['queuecallerexitreason']));}}catch(_0x391479){utils[_0xf6a4('0x15')](util[_0xf6a4('0x2')](_0xf6a4('0x2f'),_0x41fefb[_0xf6a4('0x4')]),_0x391479);}};exports['queuecallerleave']=function(_0x1210f8){try{if(!_[_0xf6a4('0x17')](queues[_0x1210f8[_0xf6a4('0x4')]])){utils[_0xf6a4('0x10')](util['format'](_0xf6a4('0x30'),_0x1210f8[_0xf6a4('0x4')]),_0x1210f8);utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x31'),_0x1210f8[_0xf6a4('0x4')],queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x20')],_0x1210f8[_0xf6a4('0x32')],_0x1210f8[_0xf6a4('0x33')]));queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x34')]=!![];queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x19')]=utils[_0xf6a4('0x14')]();queues[_0x1210f8[_0xf6a4('0x4')]]['holdtime']=utils[_0xf6a4('0x35')](queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x19')],queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x36')]);queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x13')]=_0x1210f8[_0xf6a4('0x13')];queues[_0x1210f8['uniqueid']][_0xf6a4('0x37')]=_0x1210f8[_0xf6a4('0x37')];queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x32')]=_0x1210f8[_0xf6a4('0x32')];queues[_0x1210f8[_0xf6a4('0x4')]][_0xf6a4('0x33')]=_0x1210f8[_0xf6a4('0x33')];}}catch(_0x31236c){utils[_0xf6a4('0x15')](util['format'](_0xf6a4('0x30'),_0x1210f8[_0xf6a4('0x4')]),_0x31236c);}};exports[_0xf6a4('0x38')]=function(_0x1c7e2f){try{if(!_['isNil'](queues[_0x1c7e2f['uniqueid']])){utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')](_0xf6a4('0x39'),_0x1c7e2f['uniqueid']),_0x1c7e2f);utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x3a'),_0x1c7e2f[_0xf6a4('0x4')],queues[_0x1c7e2f[_0xf6a4('0x4')]][_0xf6a4('0x20')],_0x1c7e2f[_0xf6a4('0x3b')],_0x1c7e2f[_0xf6a4('0x3c')]));queues[_0x1c7e2f[_0xf6a4('0x4')]][_0xf6a4('0x1a')]=![];queues[_0x1c7e2f['uniqueid']][_0xf6a4('0x1a')]=![];queues[_0x1c7e2f[_0xf6a4('0x4')]][_0xf6a4('0x25')]=null;queues[_0x1c7e2f[_0xf6a4('0x4')]]['queuecallerexit']=![];queues[_0x1c7e2f[_0xf6a4('0x4')]][_0xf6a4('0x9')]=null;queues[_0x1c7e2f[_0xf6a4('0x4')]][_0xf6a4('0x26')]=null;queues[_0x1c7e2f[_0xf6a4('0x4')]]['assigned']=!![];queues[_0x1c7e2f['uniqueid']]['accountcode']=_0x1c7e2f[_0xf6a4('0x3c')];queues[_0x1c7e2f[_0xf6a4('0x4')]]['lastAssignedTo']=_0x1c7e2f[_0xf6a4('0x3b')];}}catch(_0x179a5a){utils['error'](util[_0xf6a4('0x2')](_0xf6a4('0x39'),_0x1c7e2f['uniqueid']),_0x179a5a);}};exports['agentcomplete']=function(_0x2e1b0c){try{if(!_[_0xf6a4('0x17')](queues[_0x2e1b0c['uniqueid']])){if(queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x19')]){utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')](_0xf6a4('0x3d'),_0x2e1b0c[_0xf6a4('0x4')]),_0x2e1b0c);queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x1a')]=![];queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x1a')]=![];queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x25')]=null;queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x1b')]=![];queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x26')]=null;queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x3e')]=!![];queues[_0x2e1b0c['uniqueid']][_0xf6a4('0x3f')]=_0x2e1b0c[_0xf6a4('0x3b')];queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x1c')]=!![];queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x1d')]=utils[_0xf6a4('0x14')]();if(_0x2e1b0c['reason']==_0xf6a4('0x40')){if(!queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x40')]){queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x9')]=_0xf6a4('0x41');}}else{queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x9')]=_0xf6a4('0x42')+_0x2e1b0c[_0xf6a4('0x43')][_0xf6a4('0x24')]();}utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x44'),_0x2e1b0c[_0xf6a4('0x4')],queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x20')],_0x2e1b0c[_0xf6a4('0x3b')],queues[_0x2e1b0c[_0xf6a4('0x4')]][_0xf6a4('0x9')]));writeDB(queues[_0x2e1b0c[_0xf6a4('0x4')]]);}}}catch(_0x4d780f){utils['error'](util[_0xf6a4('0x2')](_0xf6a4('0x3d'),_0x2e1b0c['uniqueid']),_0x4d780f);}};exports[_0xf6a4('0x45')]=function(_0x1f24f5){try{if(!_['isNil'](queues[_0x1f24f5[_0xf6a4('0x46')]])){utils[_0xf6a4('0x10')](util['format'](_0xf6a4('0x47'),_0x1f24f5[_0xf6a4('0x4')]),_0x1f24f5);queues[_0x1f24f5[_0xf6a4('0x46')]]['transfer']=!![];queues[_0x1f24f5[_0xf6a4('0x46')]][_0xf6a4('0x48')]='BLIND';queues[_0x1f24f5[_0xf6a4('0x46')]][_0xf6a4('0x49')]=_0x1f24f5[_0xf6a4('0x4a')];queues[_0x1f24f5[_0xf6a4('0x46')]]['transferuniqueid']=_0x1f24f5[_0xf6a4('0x46')];queues[_0x1f24f5['transfereeuniqueid']]['queuecallerexitreason']=_0xf6a4('0x4b');utils[_0xf6a4('0x12')](util['format'](_0xf6a4('0x4c'),_0x1f24f5[_0xf6a4('0x4')],queues[_0x1f24f5[_0xf6a4('0x46')]][_0xf6a4('0x20')],_0x1f24f5['transfereeuniqueid'],_0x1f24f5[_0xf6a4('0x4a')]));}}catch(_0xe1d5a9){utils['error'](util[_0xf6a4('0x2')](_0xf6a4('0x47'),_0x1f24f5[_0xf6a4('0x4')]),_0xe1d5a9);}};exports[_0xf6a4('0x4d')]=function(_0x54378){try{utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')](_0xf6a4('0x4e'),_0x54378['origtransfereruniqueid']),_0x54378);if(_0x54378[_0xf6a4('0x4f')]==_0x54378[_0xf6a4('0x50')]){if(!_[_0xf6a4('0x17')](queues[_0x54378['secondtransfererlinkedid']])){utils['info'](util[_0xf6a4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x54378[_0xf6a4('0x4f')],queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x20')],_0x54378[_0xf6a4('0x52')]));queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x40')]=!![];queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x48')]=_0xf6a4('0x53');queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x49')]=_0x54378[_0xf6a4('0x52')];queues[_0x54378[_0xf6a4('0x51')]]['transferuniqueid']=_0x54378[_0xf6a4('0x4f')];queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x9')]=_0xf6a4('0x54');}if(!_['isNil'](queues[_0x54378[_0xf6a4('0x50')]])){if(_0x54378[_0xf6a4('0x55')]&&queues[_0x54378[_0xf6a4('0x55')]]){queues[_0x54378[_0xf6a4('0x55')]][_0xf6a4('0x56')]=0x1;queues[_0x54378[_0xf6a4('0x46')]]=_[_0xf6a4('0x57')](queues[_0x54378[_0xf6a4('0x55')]]);queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0xe')]=_0x54378['transfertargetuniqueid'];queues[_0x54378[_0xf6a4('0x46')]]['queuecallerenterreason']=0x2;queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0x7')]=queues[_0x54378[_0xf6a4('0x51')]]['calleridnum'];queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0x58')]=queues[_0x54378[_0xf6a4('0x51')]][_0xf6a4('0x58')];queues[_0x54378['transfereeuniqueid']][_0xf6a4('0x36')]=utils[_0xf6a4('0x14')]();queues[_0x54378['transfereeuniqueid']][_0xf6a4('0x19')]=utils[_0xf6a4('0x14')]();queues[_0x54378[_0xf6a4('0x46')]]['holdtime']=0x0;queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0x59')]=0x0;utils['info'](util[_0xf6a4('0x2')](_0xf6a4('0x5a'),_0x54378['origtransfereruniqueid'],queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0x20')],queues[_0x54378[_0xf6a4('0x46')]][_0xf6a4('0x7')],queues[_0x54378['transfereeuniqueid']][_0xf6a4('0x58')]));}else{utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x5b'),_0x54378[_0xf6a4('0x4f')],queues[_0x54378['origtransfererlinkedid']][_0xf6a4('0x20')],_0x54378[_0xf6a4('0x51')]));queues[_0x54378[_0xf6a4('0x50')]][_0xf6a4('0xe')]=_0x54378['secondtransfererlinkedid'];}}}else if(_0x54378[_0xf6a4('0x5c')]==_0x54378['secondtransfererlinkedid']){if(!_[_0xf6a4('0x17')](queues[_0x54378[_0xf6a4('0x50')]])){utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x5d'),_0x54378[_0xf6a4('0x4f')],queues[_0x54378[_0xf6a4('0x50')]][_0xf6a4('0x20')],_0x54378[_0xf6a4('0x5c')],_0x54378['secondtransfererexten']));queues[_0x54378[_0xf6a4('0x50')]]['transfer']=!![];queues[_0x54378[_0xf6a4('0x50')]]['transfertype']=_0xf6a4('0x53');queues[_0x54378['origtransfererlinkedid']][_0xf6a4('0x49')]=_0x54378[_0xf6a4('0x5e')];queues[_0x54378[_0xf6a4('0x50')]]['transferuniqueid']=_0x54378[_0xf6a4('0x5c')];queues[_0x54378[_0xf6a4('0x50')]][_0xf6a4('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xf6a4('0x17')](queues[_0x54378['secondtransfererlinkedid']])){if(_0x54378[_0xf6a4('0x5f')]&&queues[_0x54378[_0xf6a4('0x5f')]]){queues[_0x54378[_0xf6a4('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x54378['transfertargetuniqueid']]=_[_0xf6a4('0x57')](queues[_0x54378[_0xf6a4('0x5f')]]);queues[_0x54378['transfertargetuniqueid']][_0xf6a4('0xe')]=_0x54378['transfertargetuniqueid'];queues[_0x54378[_0xf6a4('0x60')]]['queuecallerenterreason']=0x2;queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x7')]=queues[_0x54378[_0xf6a4('0x50')]][_0xf6a4('0x7')];queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x58')]=queues[_0x54378[_0xf6a4('0x50')]][_0xf6a4('0x58')];queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x36')]=utils['now']();queues[_0x54378['transfertargetuniqueid']][_0xf6a4('0x19')]=utils[_0xf6a4('0x14')]();queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x61')]=0x0;queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x59')]=0x0;utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x54378[_0xf6a4('0x4f')],queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x20')],queues[_0x54378[_0xf6a4('0x60')]]['transfereduniqueid'],queues[_0x54378[_0xf6a4('0x60')]]['calleridnum'],queues[_0x54378[_0xf6a4('0x60')]][_0xf6a4('0x58')]));}else{utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x5b'),_0x54378[_0xf6a4('0x4f')],queues[_0x54378['secondtransfererlinkedid']][_0xf6a4('0x20')],_0x54378[_0xf6a4('0x50')]));queues[_0x54378['secondtransfererlinkedid']][_0xf6a4('0xe')]=_0x54378[_0xf6a4('0x50')];}}}}catch(_0x192eca){utils[_0xf6a4('0x15')](util['format'](_0xf6a4('0x4e'),_0x54378['origtransfereruniqueid']),_0x192eca);}};exports[_0xf6a4('0x62')]=function(_0x3976ad){try{if(!_['isNil'](queues[_0x3976ad[_0xf6a4('0x4')]])){utils[_0xf6a4('0x10')](util[_0xf6a4('0x2')]('[%s][queues][musiconholdstart]',_0x3976ad[_0xf6a4('0x4')]),_0x3976ad);queues[_0x3976ad['uniqueid']]['musiconholdstartAt']=utils[_0xf6a4('0x14')]();utils['info'](util[_0xf6a4('0x2')](_0xf6a4('0x63'),_0x3976ad['uniqueid'],queues[_0x3976ad['uniqueid']][_0xf6a4('0x20')],queues[_0x3976ad[_0xf6a4('0x4')]]['musiconholdstartAt']));}}catch(_0x488861){utils[_0xf6a4('0x15')](util['format'](_0xf6a4('0x64'),_0x3976ad['uniqueid']),_0x488861);}};exports[_0xf6a4('0x65')]=function(_0xdc3e85){try{if(!_[_0xf6a4('0x17')](queues[_0xdc3e85['uniqueid']])){if(!_[_0xf6a4('0x17')](queues[_0xdc3e85[_0xf6a4('0x4')]][_0xf6a4('0x66')])){utils['debug'](util['format'](_0xf6a4('0x67'),_0xdc3e85[_0xf6a4('0x4')]),_0xdc3e85);queues[_0xdc3e85[_0xf6a4('0x4')]][_0xf6a4('0x59')]+=utils[_0xf6a4('0x35')](utils[_0xf6a4('0x14')](),queues[_0xdc3e85[_0xf6a4('0x4')]][_0xf6a4('0x66')]);utils[_0xf6a4('0x12')](util[_0xf6a4('0x2')](_0xf6a4('0x68'),_0xdc3e85[_0xf6a4('0x4')],queues[_0xdc3e85['uniqueid']][_0xf6a4('0x20')],queues[_0xdc3e85[_0xf6a4('0x4')]][_0xf6a4('0x59')]));delete queues[_0xdc3e85[_0xf6a4('0x4')]][_0xf6a4('0x66')];}}}catch(_0x563cfe){utils[_0xf6a4('0x15')](util['format'](_0xf6a4('0x67'),_0xdc3e85['uniqueid']),_0x563cfe);}}; \ No newline at end of file +var _0x9c3c=['calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','variable','queuestatus','CONTINUE','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','queuecallerabandonAt','value','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue'];(function(_0x54aa73,_0x1a53a5){var _0x12e83d=function(_0x543726){while(--_0x543726){_0x54aa73['push'](_0x54aa73['shift']());}};_0x12e83d(++_0x1a53a5);}(_0x9c3c,0x12b));var _0xc9c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9c3c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc9c3('0x0'));var util=require(_0xc9c3('0x1'));var utils=require(_0xc9c3('0x2'));var queues={};function writeDB(_0x245413){utils['info'](util[_0xc9c3('0x3')](_0xc9c3('0x4'),_0x245413['uniqueid'],_0x245413[_0xc9c3('0x5')],_0x245413[_0xc9c3('0x6')],_0x245413['lastAssignedTo'],_0x245413[_0xc9c3('0x7')],_0x245413[_0xc9c3('0x8')],_0x245413[_0xc9c3('0x9')]));if(_0x245413[_0xc9c3('0x6')]){utils[_0xc9c3('0xa')](_0x245413['queue'])[_0xc9c3('0xb')](function(_0xd8b71e){if(_0xd8b71e){_0x245413[_0xc9c3('0xc')]=_0xd8b71e[_0xc9c3('0xc')];}utils[_0xc9c3('0xd')](_0xc9c3('0xe'),_0x245413);});}else{utils[_0xc9c3('0xd')](_0xc9c3('0xe'),_0x245413);}if(_0x245413[_0xc9c3('0xf')]){delete queues[_0x245413[_0xc9c3('0xf')]];}else{delete queues[_0x245413[_0xc9c3('0x10')]];}}exports[_0xc9c3('0x11')]=function(_0x1d8d82){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x1d8d82[_0xc9c3('0x10')]),_0x1d8d82);utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x13'),_0x1d8d82[_0xc9c3('0x10')],_0x1d8d82[_0xc9c3('0x6')],_0x1d8d82[_0xc9c3('0x14')]));queues[_0x1d8d82[_0xc9c3('0x10')]]=_[_0xc9c3('0x15')](_0x1d8d82,{'originalposition':_0x1d8d82[_0xc9c3('0x14')],'queuecallerjoinAt':utils[_0xc9c3('0x16')](),'mohtime':0x0});}catch(_0x4e13d9){utils['error'](util[_0xc9c3('0x3')](_0xc9c3('0x17'),_0x1d8d82[_0xc9c3('0x10')]),_0x4e13d9);}};exports[_0xc9c3('0x18')]=function(_0x537f70){try{if(!_[_0xc9c3('0x19')](queues[_0x537f70['uniqueid']])){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')](_0xc9c3('0x1b'),_0x537f70[_0xc9c3('0x10')]),_0x537f70);if(queues[_0x537f70[_0xc9c3('0x10')]][_0xc9c3('0x1c')]){if(!queues[_0x537f70[_0xc9c3('0x10')]][_0xc9c3('0x1d')]&&!queues[_0x537f70['uniqueid']]['queuecallerexit']){queues[_0x537f70['uniqueid']]['queuecallercomplete']=!![];queues[_0x537f70['uniqueid']][_0xc9c3('0x1e')]=utils[_0xc9c3('0x16')]();queues[_0x537f70[_0xc9c3('0x10')]][_0xc9c3('0x9')]=_0xc9c3('0x1f');}utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x537f70[_0xc9c3('0x10')],queues[_0x537f70[_0xc9c3('0x10')]]['name'],queues[_0x537f70[_0xc9c3('0x10')]][_0xc9c3('0x9')]));writeDB(queues[_0x537f70[_0xc9c3('0x10')]]);}else if(queues[_0x537f70[_0xc9c3('0x10')]]['transfereduniqueid']){utils['info'](util[_0xc9c3('0x3')](_0xc9c3('0x20'),_0x537f70[_0xc9c3('0x10')],queues[_0x537f70['uniqueid']]['name'],queues[_0x537f70[_0xc9c3('0x10')]]['transfereduniqueid']));queues[queues[_0x537f70[_0xc9c3('0x10')]]['transfereduniqueid']]=queues[_0x537f70['uniqueid']];queues[queues[_0x537f70[_0xc9c3('0x10')]][_0xc9c3('0xf')]][_0xc9c3('0x21')]=0x2;delete queues[_0x537f70[_0xc9c3('0x10')]];}}}catch(_0x428641){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')](_0xc9c3('0x1b'),_0x537f70['uniqueid']),_0x428641);}};exports[_0xc9c3('0x23')]=function(_0x2bf9ed){try{utils[_0xc9c3('0x1a')](util['format']('[%s][queues][varset]',_0x2bf9ed[_0xc9c3('0x10')]),_0x2bf9ed);if(!_['isNil'](_0x2bf9ed[_0xc9c3('0x24')][_0xc9c3('0x25')])&&_0x2bf9ed['value']['toUpperCase']()!==_0xc9c3('0x26')){if(!_[_0xc9c3('0x19')](queues[_0x2bf9ed['uniqueid']])){queues[_0x2bf9ed['uniqueid']][_0xc9c3('0x1d')]=![];queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerabandonAt']=null;queues[_0x2bf9ed[_0xc9c3('0x10')]][_0xc9c3('0x27')]=!![];queues[_0x2bf9ed['uniqueid']][_0xc9c3('0x28')]=utils[_0xc9c3('0x16')]();queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerexitreason']=_0x2bf9ed['value']['toUpperCase']();utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x29'),_0x2bf9ed[_0xc9c3('0x10')],queues[_0x2bf9ed[_0xc9c3('0x10')]][_0xc9c3('0x2a')],_0x2bf9ed['value'],queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x2bf9ed[_0xc9c3('0x10')]]);}}else if(!_[_0xc9c3('0x19')](_0x2bf9ed[_0xc9c3('0x24')][_0xc9c3('0x2b')])){if(!_['isNil'](queues[_0x2bf9ed[_0xc9c3('0x10')]])&&!queues[_0x2bf9ed[_0xc9c3('0x10')]][_0xc9c3('0x1d')]){queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerabandon']=![];queues[_0x2bf9ed[_0xc9c3('0x10')]][_0xc9c3('0x2c')]=null;queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerexit']=!![];queues[_0x2bf9ed['uniqueid']][_0xc9c3('0x28')]=utils[_0xc9c3('0x16')]();queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2bf9ed[_0xc9c3('0x10')],queues[_0x2bf9ed[_0xc9c3('0x10')]][_0xc9c3('0x2a')],_0x2bf9ed[_0xc9c3('0x2d')],queues[_0x2bf9ed[_0xc9c3('0x10')]]['queuecallerexitreason']));}}}catch(_0xc91a85){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')](_0xc9c3('0x2e'),_0x2bf9ed[_0xc9c3('0x10')]),_0xc91a85);}};exports[_0xc9c3('0x1d')]=function(_0x2d300d){try{if(!_['isNil'](queues[_0x2d300d[_0xc9c3('0x10')]])){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')]('[%s][queues][queuecallerabandon]',_0x2d300d[_0xc9c3('0x10')]),_0x2d300d);queues[_0x2d300d[_0xc9c3('0x10')]]['queuecallerexit']=![];queues[_0x2d300d['uniqueid']]['queuecallerexitAt']=null;queues[_0x2d300d['uniqueid']][_0xc9c3('0x1d')]=!![];queues[_0x2d300d[_0xc9c3('0x10')]][_0xc9c3('0x2c')]=utils[_0xc9c3('0x16')]();queues[_0x2d300d[_0xc9c3('0x10')]][_0xc9c3('0x9')]=_0xc9c3('0x2f');utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x30'),_0x2d300d[_0xc9c3('0x10')],queues[_0x2d300d[_0xc9c3('0x10')]]['name'],queues[_0x2d300d[_0xc9c3('0x10')]][_0xc9c3('0x9')]));}}catch(_0x3f90dc){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')]('[%s][queues][queuecallerabandon]',_0x2d300d[_0xc9c3('0x10')]),_0x3f90dc);}};exports[_0xc9c3('0x31')]=function(_0x4d258f){try{if(!_[_0xc9c3('0x19')](queues[_0x4d258f[_0xc9c3('0x10')]])){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')](_0xc9c3('0x32'),_0x4d258f['uniqueid']),_0x4d258f);utils['info'](util['format'](_0xc9c3('0x33'),_0x4d258f[_0xc9c3('0x10')],queues[_0x4d258f[_0xc9c3('0x10')]]['name'],_0x4d258f[_0xc9c3('0x34')],_0x4d258f[_0xc9c3('0x35')]));queues[_0x4d258f['uniqueid']][_0xc9c3('0x31')]=!![];queues[_0x4d258f[_0xc9c3('0x10')]]['queuecallerleaveAt']=utils[_0xc9c3('0x16')]();queues[_0x4d258f[_0xc9c3('0x10')]]['holdtime']=utils['diffTime'](queues[_0x4d258f[_0xc9c3('0x10')]][_0xc9c3('0x1c')],queues[_0x4d258f[_0xc9c3('0x10')]][_0xc9c3('0x36')]);queues[_0x4d258f['uniqueid']][_0xc9c3('0x14')]=_0x4d258f[_0xc9c3('0x14')];queues[_0x4d258f[_0xc9c3('0x10')]][_0xc9c3('0x37')]=_0x4d258f[_0xc9c3('0x37')];queues[_0x4d258f['uniqueid']][_0xc9c3('0x34')]=_0x4d258f[_0xc9c3('0x34')];queues[_0x4d258f[_0xc9c3('0x10')]]['connectedlinename']=_0x4d258f[_0xc9c3('0x35')];}}catch(_0x32e855){utils['error'](util[_0xc9c3('0x3')]('[%s][queues][queuecallerleave]',_0x4d258f['uniqueid']),_0x32e855);}};exports['agentconnect']=function(_0x1631e3){try{if(!_[_0xc9c3('0x19')](queues[_0x1631e3[_0xc9c3('0x10')]])){utils['debug'](util['format'](_0xc9c3('0x38'),_0x1631e3[_0xc9c3('0x10')]),_0x1631e3);utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x39'),_0x1631e3['uniqueid'],queues[_0x1631e3[_0xc9c3('0x10')]][_0xc9c3('0x2a')],_0x1631e3[_0xc9c3('0x3a')],_0x1631e3[_0xc9c3('0x3b')]));queues[_0x1631e3['uniqueid']][_0xc9c3('0x1d')]=![];queues[_0x1631e3['uniqueid']][_0xc9c3('0x1d')]=![];queues[_0x1631e3['uniqueid']][_0xc9c3('0x2c')]=null;queues[_0x1631e3[_0xc9c3('0x10')]][_0xc9c3('0x27')]=![];queues[_0x1631e3['uniqueid']][_0xc9c3('0x9')]=null;queues[_0x1631e3[_0xc9c3('0x10')]]['queuecallerexitAt']=null;queues[_0x1631e3[_0xc9c3('0x10')]][_0xc9c3('0x3c')]=!![];queues[_0x1631e3[_0xc9c3('0x10')]]['accountcode']=_0x1631e3['destaccountcode'];queues[_0x1631e3[_0xc9c3('0x10')]]['lastAssignedTo']=_0x1631e3['membername'];}}catch(_0x3126da){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')]('[%s][queues][agentconnect]',_0x1631e3[_0xc9c3('0x10')]),_0x3126da);}};exports['agentcomplete']=function(_0x386e08){try{if(!_['isNil'](queues[_0x386e08[_0xc9c3('0x10')]])){if(queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x1c')]){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')]('[%s][queues][agentcomplete]',_0x386e08[_0xc9c3('0x10')]),_0x386e08);queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x1d')]=![];queues[_0x386e08['uniqueid']]['queuecallerabandon']=![];queues[_0x386e08[_0xc9c3('0x10')]]['queuecallerabandonAt']=null;queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x27')]=![];queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x28')]=null;queues[_0x386e08[_0xc9c3('0x10')]]['assigned']=!![];queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x3d')]=_0x386e08[_0xc9c3('0x3a')];queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x3e')]=!![];queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x1e')]=utils[_0xc9c3('0x16')]();if(_0x386e08[_0xc9c3('0x3f')]==_0xc9c3('0x40')){if(!queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x40')]){queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x9')]=_0xc9c3('0x41');}}else{queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x9')]='COMPLETEDBY'+_0x386e08['reason']['toUpperCase']();}utils[_0xc9c3('0x12')](util['format'](_0xc9c3('0x42'),_0x386e08[_0xc9c3('0x10')],queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x2a')],_0x386e08[_0xc9c3('0x3a')],queues[_0x386e08[_0xc9c3('0x10')]][_0xc9c3('0x9')]));writeDB(queues[_0x386e08['uniqueid']]);}}}catch(_0xd1fa7b){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')]('[%s][queues][agentcomplete]',_0x386e08[_0xc9c3('0x10')]),_0xd1fa7b);}};exports[_0xc9c3('0x43')]=function(_0x89a6cc){try{if(!_['isNil'](queues[_0x89a6cc[_0xc9c3('0x44')]])){utils[_0xc9c3('0x1a')](util['format']('[%s][queues][blindtransfer]',_0x89a6cc[_0xc9c3('0x10')]),_0x89a6cc);queues[_0x89a6cc[_0xc9c3('0x44')]]['transfer']=!![];queues[_0x89a6cc['transfereeuniqueid']]['transfertype']='BLIND';queues[_0x89a6cc[_0xc9c3('0x44')]][_0xc9c3('0x45')]=_0x89a6cc[_0xc9c3('0x46')];queues[_0x89a6cc[_0xc9c3('0x44')]][_0xc9c3('0x47')]=_0x89a6cc[_0xc9c3('0x44')];queues[_0x89a6cc[_0xc9c3('0x44')]]['queuecallerexitreason']=_0xc9c3('0x48');utils['info'](util[_0xc9c3('0x3')](_0xc9c3('0x49'),_0x89a6cc[_0xc9c3('0x10')],queues[_0x89a6cc['transfereeuniqueid']][_0xc9c3('0x2a')],_0x89a6cc[_0xc9c3('0x44')],_0x89a6cc[_0xc9c3('0x46')]));}}catch(_0xe0eaa0){utils[_0xc9c3('0x22')](util['format']('[%s][queues][blindtransfer]',_0x89a6cc[_0xc9c3('0x10')]),_0xe0eaa0);}};exports[_0xc9c3('0x4a')]=function(_0x281dbc){try{utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')]('[%s][queues][attendedtransfer]',_0x281dbc['origtransfereruniqueid']),_0x281dbc);if(_0x281dbc['origtransfereruniqueid']==_0x281dbc[_0xc9c3('0x4b')]){if(!_[_0xc9c3('0x19')](queues[_0x281dbc[_0xc9c3('0x4c')]])){utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x2a')],_0x281dbc[_0xc9c3('0x4e')]));queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x40')]=!![];queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x4f')]=_0xc9c3('0x50');queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x45')]=_0x281dbc[_0xc9c3('0x4e')];queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x47')]=_0x281dbc[_0xc9c3('0x4d')];queues[_0x281dbc['secondtransfererlinkedid']]['queuecallerexitreason']=_0xc9c3('0x51');}if(!_[_0xc9c3('0x19')](queues[_0x281dbc[_0xc9c3('0x4b')]])){if(_0x281dbc[_0xc9c3('0x52')]&&queues[_0x281dbc[_0xc9c3('0x52')]]){queues[_0x281dbc[_0xc9c3('0x52')]][_0xc9c3('0x21')]=0x1;queues[_0x281dbc['transfereeuniqueid']]=_[_0xc9c3('0x53')](queues[_0x281dbc['transfereelinkedid']]);queues[_0x281dbc[_0xc9c3('0x44')]]['transfereduniqueid']=_0x281dbc['transfertargetuniqueid'];queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x21')]=0x2;queues[_0x281dbc['transfereeuniqueid']][_0xc9c3('0x7')]=queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x7')];queues[_0x281dbc['transfereeuniqueid']]['calleridname']=queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x54')];queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x36')]=utils[_0xc9c3('0x16')]();queues[_0x281dbc['transfereeuniqueid']][_0xc9c3('0x1c')]=utils['now']();queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x55')]=0x0;queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x56')]=0x0;utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x2a')],queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x7')],queues[_0x281dbc[_0xc9c3('0x44')]][_0xc9c3('0x54')]));}else{utils['info'](util['format'](_0xc9c3('0x57'),_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x2a')],_0x281dbc['secondtransfererlinkedid']));queues[_0x281dbc[_0xc9c3('0x4b')]]['transfereduniqueid']=_0x281dbc[_0xc9c3('0x4c')];}}}else if(_0x281dbc[_0xc9c3('0x58')]==_0x281dbc[_0xc9c3('0x4c')]){if(!_[_0xc9c3('0x19')](queues[_0x281dbc['origtransfererlinkedid']])){utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x59'),_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc['origtransfererlinkedid']]['name'],_0x281dbc['secondtransfereruniqueid'],_0x281dbc[_0xc9c3('0x5a')]));queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x40')]=!![];queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x4f')]='ATTENDED';queues[_0x281dbc[_0xc9c3('0x4b')]]['transferexten']=_0x281dbc[_0xc9c3('0x5a')];queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x47')]=_0x281dbc[_0xc9c3('0x58')];queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x281dbc[_0xc9c3('0x4c')]])){if(_0x281dbc[_0xc9c3('0x5b')]&&queues[_0x281dbc['transfertargetlinkedid']]){queues[_0x281dbc[_0xc9c3('0x5b')]][_0xc9c3('0x21')]=0x1;queues[_0x281dbc['transfertargetuniqueid']]=_['clone'](queues[_0x281dbc['transfertargetlinkedid']]);queues[_0x281dbc['transfertargetuniqueid']][_0xc9c3('0xf')]=_0x281dbc['transfertargetuniqueid'];queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x21')]=0x2;queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x7')]=queues[_0x281dbc[_0xc9c3('0x4b')]][_0xc9c3('0x7')];queues[_0x281dbc[_0xc9c3('0x5c')]]['calleridname']=queues[_0x281dbc[_0xc9c3('0x4b')]]['calleridname'];queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x36')]=utils[_0xc9c3('0x16')]();queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x1c')]=utils[_0xc9c3('0x16')]();queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x55')]=0x0;queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x56')]=0x0;utils['info'](util[_0xc9c3('0x3')](_0xc9c3('0x5d'),_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc['transfertargetuniqueid']][_0xc9c3('0x2a')],queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0xf')],queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x7')],queues[_0x281dbc[_0xc9c3('0x5c')]][_0xc9c3('0x54')]));}else{utils[_0xc9c3('0x12')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x281dbc[_0xc9c3('0x4d')],queues[_0x281dbc[_0xc9c3('0x4c')]][_0xc9c3('0x2a')],_0x281dbc[_0xc9c3('0x4b')]));queues[_0x281dbc['secondtransfererlinkedid']][_0xc9c3('0xf')]=_0x281dbc[_0xc9c3('0x4b')];}}}}catch(_0x5e0b24){utils[_0xc9c3('0x22')](util['format'](_0xc9c3('0x5e'),_0x281dbc['origtransfereruniqueid']),_0x5e0b24);}};exports[_0xc9c3('0x5f')]=function(_0x27e6ae){try{if(!_[_0xc9c3('0x19')](queues[_0x27e6ae['uniqueid']])){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')](_0xc9c3('0x60'),_0x27e6ae[_0xc9c3('0x10')]),_0x27e6ae);queues[_0x27e6ae[_0xc9c3('0x10')]][_0xc9c3('0x61')]=utils[_0xc9c3('0x16')]();utils[_0xc9c3('0x12')](util['format'](_0xc9c3('0x62'),_0x27e6ae['uniqueid'],queues[_0x27e6ae[_0xc9c3('0x10')]]['name'],queues[_0x27e6ae[_0xc9c3('0x10')]][_0xc9c3('0x61')]));}}catch(_0x51cc92){utils[_0xc9c3('0x22')](util[_0xc9c3('0x3')](_0xc9c3('0x60'),_0x27e6ae['uniqueid']),_0x51cc92);}};exports['musiconholdstop']=function(_0x512022){try{if(!_[_0xc9c3('0x19')](queues[_0x512022[_0xc9c3('0x10')]])){if(!_[_0xc9c3('0x19')](queues[_0x512022[_0xc9c3('0x10')]][_0xc9c3('0x61')])){utils[_0xc9c3('0x1a')](util[_0xc9c3('0x3')](_0xc9c3('0x63'),_0x512022[_0xc9c3('0x10')]),_0x512022);queues[_0x512022[_0xc9c3('0x10')]][_0xc9c3('0x56')]+=utils[_0xc9c3('0x64')](utils[_0xc9c3('0x16')](),queues[_0x512022[_0xc9c3('0x10')]][_0xc9c3('0x61')]);utils[_0xc9c3('0x12')](util[_0xc9c3('0x3')](_0xc9c3('0x65'),_0x512022[_0xc9c3('0x10')],queues[_0x512022['uniqueid']]['name'],queues[_0x512022[_0xc9c3('0x10')]][_0xc9c3('0x56')]));delete queues[_0x512022[_0xc9c3('0x10')]][_0xc9c3('0x61')];}}}catch(_0x2c4b8c){utils['error'](util[_0xc9c3('0x3')]('[%s][queues][musiconholdstop]',_0x512022[_0xc9c3('0x10')]),_0x2c4b8c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e27c635..704d140 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 _0xb6ba=['newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','info','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','monitors','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./transfers.controller','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording'];(function(_0x4a560c,_0x1230a7){var _0x3bc3ff=function(_0x3fa4ff){while(--_0x3fa4ff){_0x4a560c['push'](_0x4a560c['shift']());}};_0x3bc3ff(++_0x1230a7);}(_0xb6ba,0x15a));var _0xab6b=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xb6ba[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0xab6b('0x0'));var util=require(_0xab6b('0x1'));var utils=require('./utils');var transfers=require(_0xab6b('0x2'));var recordings={};function writeDB(_0x936632){var _0x2b0965;utils['info'](util[_0xab6b('0x3')]('[%s][recordings][writeDB]',_0x936632[_0xab6b('0x4')]));if(transfers['blinds'][_0x936632['uniqueid']]){_0x2b0965=_0x936632[_0xab6b('0x4')];_0x936632['uniqueid']=transfers[_0xab6b('0x5')][_0x936632[_0xab6b('0x4')]][_0xab6b('0x6')];}if(_0x936632['accountcode']){utils['getUserByInternal'](_0x936632[_0xab6b('0x7')])[_0xab6b('0x8')](function(_0x463f53){if(_0x463f53){_0x936632[_0xab6b('0x9')]=_0x463f53[_0xab6b('0xa')];_0x936632[_0xab6b('0xb')]=_0x463f53['id'];}utils[_0xab6b('0xc')](_0xab6b('0xd'),_0x936632);});}else{utils[_0xab6b('0xc')](_0xab6b('0xd'),_0x936632);}if(_0x2b0965)delete transfers['blinds'][_0x2b0965];}exports[_0xab6b('0xe')]=function(_0x32c6f3){try{utils[_0xab6b('0xf')](util[_0xab6b('0x3')]('[%s][recordings][newchannel]',_0x32c6f3[_0xab6b('0x4')]),_0x32c6f3);if(_0x32c6f3[_0xab6b('0x4')]==_0x32c6f3[_0xab6b('0x10')]){utils['info'](util[_0xab6b('0x3')](_0xab6b('0x11'),_0x32c6f3[_0xab6b('0x4')],_0x32c6f3[_0xab6b('0x12')],_0x32c6f3[_0xab6b('0x13')]));recordings[_0x32c6f3[_0xab6b('0x4')]]={'uniqueid':_0x32c6f3[_0xab6b('0x4')],'accountcode':_0x32c6f3[_0xab6b('0x7')],'exten':_0x32c6f3[_0xab6b('0x13')],'context':_0x32c6f3['context'],'channel':_0x32c6f3['channel'],'monitors':[]};}}catch(_0x3e434d){utils[_0xab6b('0x14')](util[_0xab6b('0x3')](_0xab6b('0x15'),_0x32c6f3[_0xab6b('0x4')]),_0x3e434d);}};exports[_0xab6b('0x16')]=function(_0x27382f){try{utils[_0xab6b('0xf')](util[_0xab6b('0x3')](_0xab6b('0x17'),_0x27382f['uniqueid']),_0x27382f);if(!_[_0xab6b('0x18')](recordings[_0x27382f['uniqueid']])&&_0x27382f[_0xab6b('0x19')]==0x6){utils[_0xab6b('0x1a')](util[_0xab6b('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x27382f[_0xab6b('0x4')],_0x27382f[_0xab6b('0x12')],_0x27382f['channel']));}else if(!_[_0xab6b('0x18')](recordings[_0x27382f['linkedid']])&&_0x27382f[_0xab6b('0x19')]==0x6&&_0x27382f[_0xab6b('0x12')]!=_0xab6b('0x1b')){utils[_0xab6b('0x1a')](util[_0xab6b('0x3')](_0xab6b('0x1c'),_0x27382f[_0xab6b('0x4')],_0x27382f['linkedid'],_0x27382f[_0xab6b('0x12')],_0x27382f[_0xab6b('0x1d')]));recordings[_0x27382f[_0xab6b('0x10')]][_0xab6b('0x7')]=_0x27382f['accountcode'];}}catch(_0x1e35b3){utils[_0xab6b('0x14')](util['format']('[%s][recordings][newstate]',_0x27382f['uniqueid']),_0x1e35b3);}};exports[_0xab6b('0x1e')]=function(_0x290341){try{if(!_[_0xab6b('0x18')](_0x290341[_0xab6b('0x1f')])&&!_[_0xab6b('0x18')](_0x290341['variable'][_0xab6b('0x20')])){utils[_0xab6b('0xf')](util[_0xab6b('0x3')]('[%s][recordings][varset]',_0x290341[_0xab6b('0x4')]),_0x290341);utils[_0xab6b('0x1a')](util[_0xab6b('0x3')](_0xab6b('0x21'),_0x290341[_0xab6b('0x4')],_0x290341['variable'],_0x290341[_0xab6b('0x22')]));if(_[_0xab6b('0x23')](_0x290341[_0xab6b('0x22')],_0xab6b('0x24'))){_0x290341['value']=_0x290341[_0xab6b('0x22')][_0xab6b('0x25')](_0xab6b('0x24'),_0xab6b('0x26'));}if(recordings[_0x290341['linkedid']]){var _0x2de87a=_['find'](recordings[_0x290341[_0xab6b('0x10')]]['monitors'],{'value':_0x290341['value']});if(_['isNil'](_0x2de87a)){recordings[_0x290341[_0xab6b('0x10')]]['monitors'][_0xab6b('0x27')]({'value':_0x290341['value']});}}}}catch(_0x6396d5){utils[_0xab6b('0x14')](util[_0xab6b('0x3')](_0xab6b('0x28'),_0x290341['uniqueid']),_0x6396d5);}};exports[_0xab6b('0x29')]=function(_0x40a546){try{if(!_[_0xab6b('0x18')](recordings[_0x40a546['uniqueid']])){utils[_0xab6b('0xf')](util['format'](_0xab6b('0x2a'),_0x40a546[_0xab6b('0x4')]),_0x40a546);utils[_0xab6b('0x1a')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x40a546[_0xab6b('0x4')],_0x40a546['calleridnum'],_0x40a546[_0xab6b('0x2b')],_0x40a546[_0xab6b('0x2c')]));recordings[_0x40a546['uniqueid']][_0xab6b('0x2d')]=_0x40a546['calleridnum'];recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x2b')]=_0x40a546[_0xab6b('0x2b')];recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x2e')]=_0x40a546[_0xab6b('0x2e')];recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x2f')]=_0x40a546[_0xab6b('0x2f')];if(recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x30')]=='outbound'&&recordings[_0x40a546['uniqueid']][_0xab6b('0x7')]){recordings[_0x40a546[_0xab6b('0x4')]]['connectedlinenum']=recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x7')];recordings[_0x40a546[_0xab6b('0x4')]][_0xab6b('0x2f')]='';}recordings[_0x40a546['uniqueid']][_0xab6b('0x31')]['forEach'](function(_0x538414){var _0x2e968f=_[_0xab6b('0x32')](recordings[_0x40a546[_0xab6b('0x4')]]);_0x2e968f[_0xab6b('0x22')]=_0x538414[_0xab6b('0x22')];writeDB(_0x2e968f);});delete recordings[_0x40a546['uniqueid']];}}catch(_0x5a8736){utils[_0xab6b('0x14')](util['format']('[%s][recordings][hangup]',_0x40a546[_0xab6b('0x4')]),_0x5a8736);}};exports[_0xab6b('0x33')]=function(_0x3414d4){try{if(!_[_0xab6b('0x18')](recordings[_0x3414d4['uniqueid']])){utils[_0xab6b('0xf')](util[_0xab6b('0x3')](_0xab6b('0x34'),_0x3414d4[_0xab6b('0x4')]),_0x3414d4);utils['info'](util[_0xab6b('0x3')](_0xab6b('0x35'),_0x3414d4[_0xab6b('0x4')],_0x3414d4['application'],_0x3414d4[_0xab6b('0x36')]));if(_0x3414d4[_0xab6b('0x37')][_0xab6b('0x38')]()==_0xab6b('0x39')&&_[_0xab6b('0x3a')](_0x3414d4[_0xab6b('0x36')][_0xab6b('0x38')](),_0xab6b('0x3b'))){var _0x11705c=_0x3414d4[_0xab6b('0x36')][_0xab6b('0x3c')]('=');var _0x12e810=_0x11705c[0x0]['substring'](_0x11705c[0x0][_0xab6b('0x3d')]('(')+0x1,_0x11705c[0x0][_0xab6b('0x3d')](')'));var _0x542ab6=_0x11705c[0x1];recordings[_0x3414d4[_0xab6b('0x4')]][_0x12e810]=_0x542ab6;}}}catch(_0x76bb08){utils[_0xab6b('0x14')](util[_0xab6b('0x3')](_0xab6b('0x34'),_0x3414d4[_0xab6b('0x4')]),_0x76bb08);}};exports['queuecallerjoin']=function(_0x522c8c){try{if(!_[_0xab6b('0x18')](recordings[_0x522c8c[_0xab6b('0x4')]])){utils[_0xab6b('0xf')](util[_0xab6b('0x3')](_0xab6b('0x3e'),_0x522c8c['uniqueid']),_0x522c8c);utils['info'](util[_0xab6b('0x3')](_0xab6b('0x3f'),_0x522c8c['uniqueid'],_0x522c8c[_0xab6b('0x40')]));recordings[_0x522c8c[_0xab6b('0x4')]][_0xab6b('0x40')]=_0x522c8c['queue'];}}catch(_0x4a9197){utils[_0xab6b('0x14')](util['format'](_0xab6b('0x3e'),_0x522c8c[_0xab6b('0x4')]),_0x4a9197);}};exports[_0xab6b('0x41')]=function(_0x4a58f0){try{utils[_0xab6b('0xf')](util[_0xab6b('0x3')](_0xab6b('0x42'),_0x4a58f0[_0xab6b('0x4')]),_0x4a58f0);utils['info'](util['format'](_0xab6b('0x43'),_0x4a58f0[_0xab6b('0x4')],_0x4a58f0['transferercalleridnum'],_0x4a58f0[_0xab6b('0x44')],_0x4a58f0[_0xab6b('0x45')],_0x4a58f0[_0xab6b('0x46')]));if(recordings[_0x4a58f0[_0xab6b('0x47')]]&&transfers[_0xab6b('0x5')][_0x4a58f0[_0xab6b('0x47')]]){transfers[_0xab6b('0x5')][_0x4a58f0[_0xab6b('0x47')]]['recording']=!![];}}catch(_0xd2b13b){utils[_0xab6b('0x14')](util[_0xab6b('0x3')]('[%s][recordings][blindtransfer]',_0x4a58f0[_0xab6b('0x4')]),_0xd2b13b);}}; \ No newline at end of file +var _0x70a8=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','name','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','format','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]'];(function(_0x13fa16,_0x1e6a9a){var _0x54d2ac=function(_0x12fed6){while(--_0x12fed6){_0x13fa16['push'](_0x13fa16['shift']());}};_0x54d2ac(++_0x1e6a9a);}(_0x70a8,0xa7));var _0x870a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x70a8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x870a('0x0'));var util=require(_0x870a('0x1'));var utils=require('./utils');var transfers=require(_0x870a('0x2'));var recordings={};function writeDB(_0x47c38f){var _0x2ed95d;utils[_0x870a('0x3')](util['format'](_0x870a('0x4'),_0x47c38f[_0x870a('0x5')]));if(transfers[_0x870a('0x6')][_0x47c38f[_0x870a('0x5')]]){_0x2ed95d=_0x47c38f['uniqueid'];_0x47c38f[_0x870a('0x5')]=transfers[_0x870a('0x6')][_0x47c38f['uniqueid']][_0x870a('0x7')];}if(_0x47c38f[_0x870a('0x8')]){utils['getUserByInternal'](_0x47c38f[_0x870a('0x8')])[_0x870a('0x9')](function(_0x54766e){if(_0x54766e){_0x47c38f['membername']=_0x54766e[_0x870a('0xa')];_0x47c38f['UserId']=_0x54766e['id'];}utils['request']('CreateVoiceRecording',_0x47c38f);});}else{utils['request'](_0x870a('0xb'),_0x47c38f);}if(_0x2ed95d)delete transfers[_0x870a('0x6')][_0x2ed95d];}exports['newchannel']=function(_0x463f26){try{utils[_0x870a('0xc')](util['format'](_0x870a('0xd'),_0x463f26[_0x870a('0x5')]),_0x463f26);if(_0x463f26[_0x870a('0x5')]==_0x463f26[_0x870a('0xe')]){utils[_0x870a('0x3')](util[_0x870a('0xf')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x463f26[_0x870a('0x5')],_0x463f26[_0x870a('0x10')],_0x463f26[_0x870a('0x11')]));recordings[_0x463f26[_0x870a('0x5')]]={'uniqueid':_0x463f26[_0x870a('0x5')],'accountcode':_0x463f26[_0x870a('0x8')],'exten':_0x463f26[_0x870a('0x11')],'context':_0x463f26[_0x870a('0x10')],'channel':_0x463f26[_0x870a('0x12')],'monitors':[]};}}catch(_0x206cfd){utils[_0x870a('0x13')](util[_0x870a('0xf')](_0x870a('0xd'),_0x463f26[_0x870a('0x5')]),_0x206cfd);}};exports[_0x870a('0x14')]=function(_0x4d55be){try{utils[_0x870a('0xc')](util['format']('[%s][recordings][newstate]',_0x4d55be[_0x870a('0x5')]),_0x4d55be);if(!_[_0x870a('0x15')](recordings[_0x4d55be[_0x870a('0x5')]])&&_0x4d55be[_0x870a('0x16')]==0x6){utils['info'](util['format'](_0x870a('0x17'),_0x4d55be[_0x870a('0x5')],_0x4d55be[_0x870a('0x10')],_0x4d55be['channel']));}else if(!_[_0x870a('0x15')](recordings[_0x4d55be['linkedid']])&&_0x4d55be[_0x870a('0x16')]==0x6&&_0x4d55be[_0x870a('0x10')]!='transfer'){utils[_0x870a('0x3')](util[_0x870a('0xf')](_0x870a('0x18'),_0x4d55be[_0x870a('0x5')],_0x4d55be[_0x870a('0xe')],_0x4d55be['context'],_0x4d55be[_0x870a('0x12')]));recordings[_0x4d55be[_0x870a('0xe')]][_0x870a('0x8')]=_0x4d55be[_0x870a('0x8')];}}catch(_0x218b98){utils[_0x870a('0x13')](util[_0x870a('0xf')]('[%s][recordings][newstate]',_0x4d55be[_0x870a('0x5')]),_0x218b98);}};exports['varset']=function(_0x59fc76){try{if(!_[_0x870a('0x15')](_0x59fc76[_0x870a('0x19')])&&!_[_0x870a('0x15')](_0x59fc76[_0x870a('0x19')][_0x870a('0x1a')])){utils[_0x870a('0xc')](util[_0x870a('0xf')](_0x870a('0x1b'),_0x59fc76[_0x870a('0x5')]),_0x59fc76);utils['info'](util[_0x870a('0xf')](_0x870a('0x1c'),_0x59fc76[_0x870a('0x5')],_0x59fc76['variable'],_0x59fc76['value']));if(_['endsWith'](_0x59fc76[_0x870a('0x1d')],_0x870a('0x1e'))){_0x59fc76[_0x870a('0x1d')]=_0x59fc76[_0x870a('0x1d')][_0x870a('0x1f')]('.wav49','.WAV');}if(recordings[_0x59fc76[_0x870a('0xe')]]){var _0x333c40=_[_0x870a('0x20')](recordings[_0x59fc76['linkedid']][_0x870a('0x21')],{'value':_0x59fc76['value']});if(_['isNil'](_0x333c40)){recordings[_0x59fc76[_0x870a('0xe')]][_0x870a('0x21')][_0x870a('0x22')]({'value':_0x59fc76[_0x870a('0x1d')]});}}}}catch(_0xe053e3){utils[_0x870a('0x13')](util[_0x870a('0xf')]('[%s][recordings][varset]',_0x59fc76[_0x870a('0x5')]),_0xe053e3);}};exports[_0x870a('0x23')]=function(_0x1af922){try{if(!_[_0x870a('0x15')](recordings[_0x1af922[_0x870a('0x5')]])){utils['debug'](util[_0x870a('0xf')](_0x870a('0x24'),_0x1af922[_0x870a('0x5')]),_0x1af922);utils['info'](util[_0x870a('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1af922[_0x870a('0x5')],_0x1af922[_0x870a('0x25')],_0x1af922[_0x870a('0x26')],_0x1af922[_0x870a('0x27')]));recordings[_0x1af922['uniqueid']][_0x870a('0x25')]=_0x1af922[_0x870a('0x25')];recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x26')]=_0x1af922[_0x870a('0x26')];recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x28')]=_0x1af922['connectedlinenum'];recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x29')]=_0x1af922[_0x870a('0x29')];if(recordings[_0x1af922[_0x870a('0x5')]]['type']==_0x870a('0x2a')&&recordings[_0x1af922['uniqueid']][_0x870a('0x8')]){recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x28')]=recordings[_0x1af922['uniqueid']][_0x870a('0x8')];recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x29')]='';}recordings[_0x1af922[_0x870a('0x5')]][_0x870a('0x21')][_0x870a('0x2b')](function(_0x22ba28){var _0x19aefd=_['clone'](recordings[_0x1af922[_0x870a('0x5')]]);_0x19aefd[_0x870a('0x1d')]=_0x22ba28[_0x870a('0x1d')];writeDB(_0x19aefd);});delete recordings[_0x1af922[_0x870a('0x5')]];}}catch(_0x5162cf){utils[_0x870a('0x13')](util[_0x870a('0xf')](_0x870a('0x24'),_0x1af922[_0x870a('0x5')]),_0x5162cf);}};exports['newexten']=function(_0x52ed5a){try{if(!_[_0x870a('0x15')](recordings[_0x52ed5a[_0x870a('0x5')]])){utils[_0x870a('0xc')](util[_0x870a('0xf')](_0x870a('0x2c'),_0x52ed5a[_0x870a('0x5')]),_0x52ed5a);utils[_0x870a('0x3')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x52ed5a[_0x870a('0x5')],_0x52ed5a[_0x870a('0x2d')],_0x52ed5a[_0x870a('0x2e')]));if(_0x52ed5a[_0x870a('0x2d')][_0x870a('0x2f')]()==_0x870a('0x30')&&_[_0x870a('0x31')](_0x52ed5a[_0x870a('0x2e')]['toLowerCase'](),_0x870a('0x32'))){var _0x3cbe8e=_0x52ed5a['appdata'][_0x870a('0x33')]('=');var _0x42e83c=_0x3cbe8e[0x0][_0x870a('0x34')](_0x3cbe8e[0x0]['lastIndexOf']('(')+0x1,_0x3cbe8e[0x0][_0x870a('0x35')](')'));var _0x3d30b0=_0x3cbe8e[0x1];recordings[_0x52ed5a[_0x870a('0x5')]][_0x42e83c]=_0x3d30b0;}}}catch(_0x325026){utils[_0x870a('0x13')](util['format']('[%s][recordings][newexten]',_0x52ed5a[_0x870a('0x5')]),_0x325026);}};exports[_0x870a('0x36')]=function(_0xd36cb5){try{if(!_['isNil'](recordings[_0xd36cb5[_0x870a('0x5')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0xd36cb5[_0x870a('0x5')]),_0xd36cb5);utils[_0x870a('0x3')](util[_0x870a('0xf')](_0x870a('0x37'),_0xd36cb5[_0x870a('0x5')],_0xd36cb5[_0x870a('0x38')]));recordings[_0xd36cb5['uniqueid']][_0x870a('0x38')]=_0xd36cb5[_0x870a('0x38')];}}catch(_0x43b6d8){utils['error'](util[_0x870a('0xf')](_0x870a('0x39'),_0xd36cb5[_0x870a('0x5')]),_0x43b6d8);}};exports[_0x870a('0x3a')]=function(_0x46b382){try{utils['debug'](util[_0x870a('0xf')](_0x870a('0x3b'),_0x46b382[_0x870a('0x5')]),_0x46b382);utils['info'](util[_0x870a('0xf')](_0x870a('0x3c'),_0x46b382[_0x870a('0x5')],_0x46b382[_0x870a('0x3d')],_0x46b382[_0x870a('0x3e')],_0x46b382['transfereecalleridnum'],_0x46b382['transfereecalleridname']));if(recordings[_0x46b382[_0x870a('0x3f')]]&&transfers['blinds'][_0x46b382[_0x870a('0x3f')]]){transfers['blinds'][_0x46b382[_0x870a('0x3f')]][_0x870a('0x40')]=!![];}}catch(_0x3284cd){utils[_0x870a('0x13')](util[_0x870a('0xf')](_0x870a('0x3b'),_0x46b382[_0x870a('0x5')]),_0x3284cd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9f99d27..db90da0 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 _0xdbc8=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','assign','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','format','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info'];(function(_0x2a87e9,_0x25c03e){var _0x5de0e6=function(_0x15e7e7){while(--_0x15e7e7){_0x2a87e9['push'](_0x2a87e9['shift']());}};_0x5de0e6(++_0x25c03e);}(_0xdbc8,0x18b));var _0x8dbc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdbc8[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x8dbc('0x0'));var util=require(_0x8dbc('0x1'));var utils=require(_0x8dbc('0x2'));function writeDB(_0x3c36b0){utils['info'](util[_0x8dbc('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x3c36b0['type']==='attended'?_0x3c36b0['origtransfereruniqueid']:_0x3c36b0[_0x8dbc('0x4')],_0x3c36b0[_0x8dbc('0x5')]));utils[_0x8dbc('0x6')](_0x8dbc('0x7'),_0x3c36b0);}exports['blinds']={};exports[_0x8dbc('0x8')]=function(_0x31034c){try{utils[_0x8dbc('0x9')](util[_0x8dbc('0x3')](_0x8dbc('0xa'),_0x31034c['uniqueid']),_0x31034c);utils[_0x8dbc('0xb')](util[_0x8dbc('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x31034c[_0x8dbc('0x4')],_0x31034c[_0x8dbc('0xc')],_0x31034c[_0x8dbc('0xd')],_0x31034c[_0x8dbc('0xe')],_0x31034c[_0x8dbc('0xf')]));_0x31034c['type']=_0x8dbc('0x10');exports['blinds'][_0x31034c[_0x8dbc('0x11')]]=_0x31034c;writeDB(_0x31034c);}catch(_0x334b4b){utils['error'](util['format'](_0x8dbc('0xa'),_0x31034c['uniqueid']),_0x334b4b);}};exports['attendedtransfer']=function(_0x5ab5ae){try{utils['debug'](util[_0x8dbc('0x3')](_0x8dbc('0x12'),_0x5ab5ae[_0x8dbc('0x13')]),_0x5ab5ae);utils[_0x8dbc('0xb')](util[_0x8dbc('0x3')](_0x8dbc('0x14'),_0x5ab5ae['origtransfereruniqueid'],_0x5ab5ae[_0x8dbc('0x15')],_0x5ab5ae['origtransferercalleridname'],_0x5ab5ae['transfertargetcalleridnum'],_0x5ab5ae[_0x8dbc('0x16')]));_0x5ab5ae=_['assign'](_0x5ab5ae,{'transfererchannel':_0x5ab5ae[_0x8dbc('0x17')],'transferercalleridnum':_0x5ab5ae[_0x8dbc('0x15')],'transferercalleridname':_0x5ab5ae['origtransferercalleridname'],'transfererconnectedlinenum':_0x5ab5ae['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5ab5ae[_0x8dbc('0x18')],'transfereraccountcode':_0x5ab5ae['origtransfereraccountcode'],'transferercontext':_0x5ab5ae[_0x8dbc('0x19')],'transfererexten':_0x5ab5ae['secondtransfererexten'],'transfererlinkedid':_0x5ab5ae[_0x8dbc('0x1a')],'context':_0x5ab5ae[_0x8dbc('0x1b')],'extension':_0x5ab5ae[_0x8dbc('0x1c')],'type':'attended'});if(_[_0x8dbc('0x1d')](_0x5ab5ae['transfereechannel'])){_0x5ab5ae=_[_0x8dbc('0x1e')](_0x5ab5ae,{'transfereechannel':_0x5ab5ae['transfertargetchannel'],'transfereecalleridnum':_0x5ab5ae[_0x8dbc('0x1f')],'transfereecalleridname':_0x5ab5ae[_0x8dbc('0x16')],'transfereeconnectedlinenum':_0x5ab5ae[_0x8dbc('0x20')],'transfereeconnectedlinename':_0x5ab5ae['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5ab5ae['transfertargetaccountcode'],'transfereecontext':_0x5ab5ae[_0x8dbc('0x21')],'transfereeexten':_0x5ab5ae[_0x8dbc('0x22')],'transfereelinkedid':_0x5ab5ae[_0x8dbc('0x23')]});}writeDB(_0x5ab5ae);}catch(_0x27cc3e){utils[_0x8dbc('0x24')](util[_0x8dbc('0x3')]('[%s][transfers][attendedtransfer]',_0x5ab5ae[_0x8dbc('0x13')]),_0x27cc3e);}}; \ No newline at end of file +var _0x29c0=['transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','attended','isNil'];(function(_0x2344b4,_0x1be650){var _0x481005=function(_0x6ce897){while(--_0x6ce897){_0x2344b4['push'](_0x2344b4['shift']());}};_0x481005(++_0x1be650);}(_0x29c0,0x9b));var _0x029c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x29c0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x029c('0x0'));var util=require('util');var utils=require(_0x029c('0x1'));function writeDB(_0x6744bf){utils['info'](util[_0x029c('0x2')](_0x029c('0x3'),_0x6744bf['type']==='attended'?_0x6744bf[_0x029c('0x4')]:_0x6744bf['uniqueid'],_0x6744bf['type']));utils[_0x029c('0x5')]('CreateVoiceTransferReport',_0x6744bf);}exports[_0x029c('0x6')]={};exports[_0x029c('0x7')]=function(_0x76d272){try{utils[_0x029c('0x8')](util[_0x029c('0x2')](_0x029c('0x9'),_0x76d272[_0x029c('0xa')]),_0x76d272);utils['info'](util[_0x029c('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x76d272[_0x029c('0xa')],_0x76d272[_0x029c('0xb')],_0x76d272[_0x029c('0xc')],_0x76d272[_0x029c('0xd')],_0x76d272[_0x029c('0xe')]));_0x76d272['type']=_0x029c('0xf');exports[_0x029c('0x6')][_0x76d272[_0x029c('0x10')]]=_0x76d272;writeDB(_0x76d272);}catch(_0x2d5253){utils[_0x029c('0x11')](util[_0x029c('0x2')](_0x029c('0x9'),_0x76d272[_0x029c('0xa')]),_0x2d5253);}};exports['attendedtransfer']=function(_0x48428d){try{utils[_0x029c('0x8')](util[_0x029c('0x2')]('[%s][transfers][attendedtransfer]',_0x48428d[_0x029c('0x4')]),_0x48428d);utils['info'](util[_0x029c('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x48428d[_0x029c('0x4')],_0x48428d[_0x029c('0x12')],_0x48428d['origtransferercalleridname'],_0x48428d[_0x029c('0x13')],_0x48428d[_0x029c('0x14')]));_0x48428d=_['assign'](_0x48428d,{'transfererchannel':_0x48428d[_0x029c('0x15')],'transferercalleridnum':_0x48428d['origtransferercalleridnum'],'transferercalleridname':_0x48428d[_0x029c('0x16')],'transfererconnectedlinenum':_0x48428d[_0x029c('0x17')],'transfererconnectedlinename':_0x48428d[_0x029c('0x18')],'transfereraccountcode':_0x48428d[_0x029c('0x19')],'transferercontext':_0x48428d['secondtransferercontext'],'transfererexten':_0x48428d[_0x029c('0x1a')],'transfererlinkedid':_0x48428d['origtransfererlinkedid'],'context':_0x48428d[_0x029c('0x1b')],'extension':_0x48428d['origtransfererexten'],'type':_0x029c('0x1c')});if(_[_0x029c('0x1d')](_0x48428d[_0x029c('0x1e')])){_0x48428d=_['assign'](_0x48428d,{'transfereechannel':_0x48428d[_0x029c('0x1f')],'transfereecalleridnum':_0x48428d[_0x029c('0x13')],'transfereecalleridname':_0x48428d[_0x029c('0x14')],'transfereeconnectedlinenum':_0x48428d[_0x029c('0x20')],'transfereeconnectedlinename':_0x48428d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x48428d[_0x029c('0x21')],'transfereecontext':_0x48428d[_0x029c('0x22')],'transfereeexten':_0x48428d[_0x029c('0x23')],'transfereelinkedid':_0x48428d[_0x029c('0x24')]});}writeDB(_0x48428d);}catch(_0x108f74){utils[_0x029c('0x11')](util[_0x029c('0x2')]('[%s][transfers][attendedtransfer]',_0x48428d[_0x029c('0x4')]),_0x108f74);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 226eced..cc1dbc1 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 _0x779f=['[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','seconds','sumTime','isAfter','jayson/promise','client','http','../../config/logger','xdr','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','result','length','found','catch','[utils][getUserByInternal]','getUserByInterface','info'];(function(_0x40de0d,_0x5d18ac){var _0x103ac5=function(_0x279884){while(--_0x279884){_0x40de0d['push'](_0x40de0d['shift']());}};_0x103ac5(++_0x5d18ac);}(_0x779f,0x9a));var _0xf779=function(_0x429ed6,_0x23c229){_0x429ed6=_0x429ed6-0x0;var _0x3dbb07=_0x779f[_0x429ed6];return _0x3dbb07;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf779('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0xf779('0x1')][_0xf779('0x2')]({'port':0x2329});var logger=require(_0xf779('0x3'))(_0xf779('0x4'));exports['info']=function(_0x54cb9f,_0x28a9ba){logger['info'](_0x54cb9f,_0x28a9ba?util[_0xf779('0x5')](_0x28a9ba,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2a0367,_0xb09f7a){logger[_0xf779('0x6')](_0x2a0367,_0xb09f7a?util['inspect'](_0xb09f7a,{'showHidden':![],'depth':null}):'');};exports[_0xf779('0x7')]=function(_0x15c4ab,_0x4c15ea){logger[_0xf779('0x7')](_0x15c4ab,_0x4c15ea?util[_0xf779('0x5')](_0x4c15ea,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4d4112,_0x593b77){return client[_0xf779('0x8')](_0x4d4112,{'body':_0x593b77})[_0xf779('0x9')](function(_0x3ab01d){logger[_0xf779('0x6')](_0xf779('0xa'),_0x4d4112,_0x3ab01d?util[_0xf779('0x5')](_0x3ab01d,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4c6c94){logger[_0xf779('0x7')]('[utils][request]\x20name:%s',_0x4d4112,_0x4c6c94?util[_0xf779('0x5')](_0x4c6c94,{'showHidden':![],'depth':null}):'');});};function getUser(_0x8c5691){return client[_0xf779('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xf779('0xb'),_0xf779('0xc'),_0xf779('0xd')],'where':_0x8c5691,'limit':0x1}})[_0xf779('0x9')](function(_0x1e51c5){logger[_0xf779('0x6')](_0xf779('0xe'),JSON['stringify'](_0x8c5691),_0x1e51c5?util[_0xf779('0x5')](_0x1e51c5,{'showHidden':![],'depth':null}):'');return _0x1e51c5[_0xf779('0xf')][_0xf779('0x10')]?_0x1e51c5['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x101fca){return new BPromise(function(_0x5ddc20,_0x16eef0){if(_0x101fca){return getUser({'internal':_0x101fca})['then'](function(_0x17ec0a){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x101fca,_0x17ec0a?_0xf779('0x11'):'notfound');return _0x5ddc20(_0x17ec0a);})[_0xf779('0x12')](function(_0x3672c6){logger['error'](_0xf779('0x13'),_0x3672c6?util['inspect'](_0x3672c6,{'showHidden':![],'depth':null}):'');return _0x5ddc20(null);});}return _0x5ddc20(null);});};exports[_0xf779('0x14')]=function(_0x4fb07a){return new BPromise(function(_0x5513bd,_0x5afe68){if(_0x4fb07a){return getUser({'interface':_0x4fb07a})['then'](function(_0x247fc3){logger[_0xf779('0x15')](_0xf779('0x16'),_0x4fb07a,_0x247fc3?'found':'notfound');return _0x5513bd(_0x247fc3);})[_0xf779('0x12')](function(_0xa9b525){logger[_0xf779('0x7')]('[utils][getUserByInterface]',_0xa9b525?util[_0xf779('0x5')](_0xa9b525,{'showHidden':![],'depth':null}):'');return _0x5513bd(null);});}return _0x5513bd(null);});};exports[_0xf779('0x17')]=function(_0x3797b5){return new BPromise(function(_0x21c73a,_0x1988f7){if(_0x3797b5){return getUser({'name':_0x3797b5})[_0xf779('0x9')](function(_0x362a71){logger['info'](_0xf779('0x18'),_0x3797b5,_0x362a71?_0xf779('0x11'):_0xf779('0x19'));return _0x21c73a(_0x362a71);})[_0xf779('0x12')](function(_0x18d0b4){logger[_0xf779('0x7')](_0xf779('0x1a'),_0x18d0b4?util[_0xf779('0x5')](_0x18d0b4,{'showHidden':![],'depth':null}):'');return _0x21c73a(null);});}return _0x21c73a(null);});};exports[_0xf779('0x1b')]=function(_0x11e526){return new BPromise(function(_0x231b4e,_0x3c6b00){if(_0x11e526){return client[_0xf779('0x8')](_0xf779('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0xf779('0x1d'),_0xf779('0x1e'),_0xf779('0x1f')],'where':{'name':_0x11e526},'limit':0x1}})['then'](function(_0x263d06){logger[_0xf779('0x6')](_0xf779('0x20'),_0x11e526,_0x263d06?util[_0xf779('0x5')](_0x263d06,{'showHidden':![],'depth':null}):'');logger[_0xf779('0x15')](_0xf779('0x21'),_0x11e526,_0x263d06?'found':'notfound');return _0x231b4e(_0x263d06[_0xf779('0xf')]['length']?_0x263d06['result'][0x0]:null);})[_0xf779('0x12')](function(_0x489da5){logger['error'](_0xf779('0x22'),_0x489da5?util['inspect'](_0x489da5,{'showHidden':![],'depth':null}):'');return _0x231b4e(null);});}return _0x231b4e(null);});};exports[_0xf779('0x23')]=function(_0x57aaf3,_0x36574d){return moment(_0x57aaf3)[_0xf779('0x24')](_0x36574d,'seconds')[_0xf779('0x25')](_0xf779('0x26'));};exports['subtractTime']=function(_0x38987f,_0x324859){return moment(_0x38987f)['subtract'](_0x324859,'seconds')[_0xf779('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf779('0x27')]=function(_0x1ac287,_0x526313){return moment(_0x1ac287)[_0xf779('0x28')](moment(_0x526313),_0xf779('0x29'));};exports[_0xf779('0x2a')]=function(_0x55aa07,_0x349525){return parseInt(_0x55aa07,0xa)+parseInt(_0x349525,0xa);};exports['now']=function(){return moment()[_0xf779('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf779('0x2b')]=function(_0x112028,_0xbee25f){if(_0xbee25f){return moment(_0x112028)[_0xf779('0x2b')](_0xbee25f);}return!![];};exports['isBefore']=function(_0x3e0805,_0x8c4523){if(_0x8c4523){return moment(_0x3e0805)['isBefore'](_0x8c4523);}else if(_0x3e0805){return!![];}return![];}; \ No newline at end of file +var _0x8b43=['GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','length','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s'];(function(_0x16a71a,_0x2eff15){var _0x325325=function(_0x13bfc3){while(--_0x13bfc3){_0x16a71a['push'](_0x16a71a['shift']());}};_0x325325(++_0x2eff15);}(_0x8b43,0x7e));var _0x38b4=function(_0x3ef16f,_0x1ef22f){_0x3ef16f=_0x3ef16f-0x0;var _0x1c7c82=_0x8b43[_0x3ef16f];return _0x1c7c82;};'use strict';var BPromise=require(_0x38b4('0x0'));var jayson=require(_0x38b4('0x1'));var moment=require(_0x38b4('0x2'));var util=require('util');var client=jayson['client'][_0x38b4('0x3')]({'port':0x2329});var logger=require(_0x38b4('0x4'))(_0x38b4('0x5'));exports['info']=function(_0x1d7c99,_0x560139){logger[_0x38b4('0x6')](_0x1d7c99,_0x560139?util[_0x38b4('0x7')](_0x560139,{'showHidden':![],'depth':null}):'');};exports[_0x38b4('0x8')]=function(_0x1afafc,_0x37ab7b){logger['debug'](_0x1afafc,_0x37ab7b?util[_0x38b4('0x7')](_0x37ab7b,{'showHidden':![],'depth':null}):'');};exports[_0x38b4('0x9')]=function(_0x26277c,_0x162b1d){logger[_0x38b4('0x9')](_0x26277c,_0x162b1d?util[_0x38b4('0x7')](_0x162b1d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3f16dd,_0x2d3fe4){return client[_0x38b4('0xa')](_0x3f16dd,{'body':_0x2d3fe4})['then'](function(_0x2bbe89){logger[_0x38b4('0x8')](_0x38b4('0xb'),_0x3f16dd,_0x2bbe89?util[_0x38b4('0x7')](_0x2bbe89,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3f65cc){logger[_0x38b4('0x9')](_0x38b4('0xb'),_0x3f16dd,_0x3f65cc?util[_0x38b4('0x7')](_0x3f65cc,{'showHidden':![],'depth':null}):'');});};function getUser(_0x110640){return client[_0x38b4('0xa')](_0x38b4('0xc'),{'options':{'raw':!![],'attributes':['id',_0x38b4('0xd'),_0x38b4('0xe'),_0x38b4('0xf')],'where':_0x110640,'limit':0x1}})[_0x38b4('0x10')](function(_0x52cf96){logger[_0x38b4('0x8')](_0x38b4('0x11'),JSON[_0x38b4('0x12')](_0x110640),_0x52cf96?util['inspect'](_0x52cf96,{'showHidden':![],'depth':null}):'');return _0x52cf96['result'][_0x38b4('0x13')]?_0x52cf96[_0x38b4('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0x20302e){return new BPromise(function(_0x1005e8,_0x51ece1){if(_0x20302e){return getUser({'internal':_0x20302e})['then'](function(_0x329d13){logger[_0x38b4('0x6')](_0x38b4('0x15'),_0x20302e,_0x329d13?_0x38b4('0x16'):_0x38b4('0x17'));return _0x1005e8(_0x329d13);})[_0x38b4('0x18')](function(_0x5e5514){logger[_0x38b4('0x9')]('[utils][getUserByInternal]',_0x5e5514?util['inspect'](_0x5e5514,{'showHidden':![],'depth':null}):'');return _0x1005e8(null);});}return _0x1005e8(null);});};exports[_0x38b4('0x19')]=function(_0x308669){return new BPromise(function(_0x20acf2,_0x3f6f70){if(_0x308669){return getUser({'interface':_0x308669})[_0x38b4('0x10')](function(_0x18ed65){logger[_0x38b4('0x6')](_0x38b4('0x1a'),_0x308669,_0x18ed65?_0x38b4('0x16'):_0x38b4('0x17'));return _0x20acf2(_0x18ed65);})[_0x38b4('0x18')](function(_0xf27258){logger[_0x38b4('0x9')]('[utils][getUserByInterface]',_0xf27258?util[_0x38b4('0x7')](_0xf27258,{'showHidden':![],'depth':null}):'');return _0x20acf2(null);});}return _0x20acf2(null);});};exports[_0x38b4('0x1b')]=function(_0xe09d28){return new BPromise(function(_0x128239,_0x501d6a){if(_0xe09d28){return getUser({'name':_0xe09d28})['then'](function(_0x22ca3e){logger['info'](_0x38b4('0x1c'),_0xe09d28,_0x22ca3e?_0x38b4('0x16'):_0x38b4('0x17'));return _0x128239(_0x22ca3e);})[_0x38b4('0x18')](function(_0x5ed1dc){logger[_0x38b4('0x9')](_0x38b4('0x1d'),_0x5ed1dc?util[_0x38b4('0x7')](_0x5ed1dc,{'showHidden':![],'depth':null}):'');return _0x128239(null);});}return _0x128239(null);});};exports['getVoiceQueueByName']=function(_0x360e60){return new BPromise(function(_0x38147a,_0xdb86cf){if(_0x360e60){return client[_0x38b4('0xa')](_0x38b4('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x38b4('0x1f'),_0x38b4('0x20'),'acwTimeout'],'where':{'name':_0x360e60},'limit':0x1}})[_0x38b4('0x10')](function(_0x1794ad){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x360e60,_0x1794ad?util[_0x38b4('0x7')](_0x1794ad,{'showHidden':![],'depth':null}):'');logger[_0x38b4('0x6')](_0x38b4('0x21'),_0x360e60,_0x1794ad?_0x38b4('0x16'):'notfound');return _0x38147a(_0x1794ad[_0x38b4('0x14')][_0x38b4('0x13')]?_0x1794ad[_0x38b4('0x14')][0x0]:null);})['catch'](function(_0x429b03){logger['error'](_0x38b4('0x22'),_0x429b03?util['inspect'](_0x429b03,{'showHidden':![],'depth':null}):'');return _0x38147a(null);});}return _0x38147a(null);});};exports[_0x38b4('0x23')]=function(_0x4933c8,_0x2cf742){return moment(_0x4933c8)['add'](_0x2cf742,_0x38b4('0x24'))[_0x38b4('0x25')](_0x38b4('0x26'));};exports[_0x38b4('0x27')]=function(_0x3afb2d,_0x3ef6af){return moment(_0x3afb2d)[_0x38b4('0x28')](_0x3ef6af,'seconds')[_0x38b4('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x38b4('0x29')]=function(_0x465af2,_0x15892d){return moment(_0x465af2)['diff'](moment(_0x15892d),_0x38b4('0x24'));};exports[_0x38b4('0x2a')]=function(_0x257b7c,_0x359f9f){return parseInt(_0x257b7c,0xa)+parseInt(_0x359f9f,0xa);};exports[_0x38b4('0x2b')]=function(){return moment()[_0x38b4('0x25')](_0x38b4('0x26'));};exports['isAfter']=function(_0x27c59e,_0x174cf9){if(_0x174cf9){return moment(_0x27c59e)[_0x38b4('0x2c')](_0x174cf9);}return!![];};exports[_0x38b4('0x2d')]=function(_0x1cc3be,_0x2aed5b){if(_0x2aed5b){return moment(_0x1cc3be)[_0x38b4('0x2d')](_0x2aed5b);}else if(_0x1cc3be){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 0e9f393..98ed2b7 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 _0x45c6=['agent_name','test','fs-extra','lodash','util','./loggers','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','use','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','agent_id'];(function(_0x35182f,_0x4f2c3e){var _0x535cfc=function(_0x4eca4e){while(--_0x4eca4e){_0x35182f['push'](_0x35182f['shift']());}};_0x535cfc(++_0x4f2c3e);}(_0x45c6,0x12f));var _0x645c=function(_0x508474,_0x4452e2){_0x508474=_0x508474-0x0;var _0x30fc39=_0x45c6[_0x508474];return _0x30fc39;};var fs=require(_0x645c('0x0'));var _=require(_0x645c('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x645c('0x2'));var fileLogger=require(_0x645c('0x3'))[_0x645c('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x645c('0x5'))[_0x645c('0x6')];function ClientSideLogger(){function _0x2ea6c9(_0x57682c){var _0x2851d4=path[_0x645c('0x7')](_0x645c('0x8'),_0x645c('0x9'),_0x645c('0xa'));var _0x2721c5=path[_0x645c('0x7')](_0x645c('0xb'),_0x57682c[_0x645c('0xc')]+'-'+_0x57682c[_0x645c('0xd')]);return fs[_0x645c('0xe')](path[_0x645c('0x7')](_0x2851d4,_0x2721c5))[_0x645c('0xf')](function(){var _0x418f96=fileLogger(_0x645c('0xb'),path[_0x645c('0x7')](_0x2851d4,_0x2721c5));return _0x418f96;})['catch'](function(_0x19274c){throw _0x19274c;});}this[_0x645c('0x9')]=function(_0x2cf88b,_0x5547fb,_0x55afbd,_0x4422a0){return _0x2ea6c9(_0x2cf88b['user'])[_0x645c('0xf')](function(_0x35063f){var _0x1fdae4=_0x35063f[_0x5547fb];return _0x1fdae4;})['then'](function(_0x179bce){var _0x12689e=_0x2cf88b[_0x645c('0x10')]?_0x2cf88b[_0x645c('0x10')]['id']:'no-user';var _0x12f17d=_0x4422a0[_0x645c('0x11')];var _0x42386d=_0x4422a0[_0x645c('0x12')];var _0x4a7f3f=new Date(Number(_0x42386d));return _0x179bce(_0x12689e,_0x4a7f3f,_0x55afbd,_0x12f17d);})['catch'](function(_0x223e34){fileLogger('client')[_0x645c('0x13')](_0x223e34);});};}function setupLoggers(_0x8ee1ba){return new Promise(function(_0x280a6d){var _0x49d4ec=new ClientSideLogger();var _0x4e7d87=fileLogger(_0x645c('0x14'));var _0x50aba1=fileLogger(_0x645c('0x15'));_0x8ee1ba[_0x645c('0x16')](_0x645c('0x17'),_0x49d4ec);_0x8ee1ba['use'](ewinston[_0x645c('0x18')]({'winstonInstance':_0x4e7d87,'meta':![],'statusLevels':!![],'msg':function(_0x2c1a92,_0x5bc88b){var _0x38de9e=_0x645c('0x19');if(!_['isEmpty'](_0x2c1a92[_0x645c('0x1a')])){_0x38de9e+=_0x645c('0x1b');var _0x4c5a7e=_0x2c1a92[_0x645c('0x1a')];maskSensitiveData(_0x4c5a7e);}return safeTemplate(util[_0x645c('0x1c')](_0x38de9e,_0x2c1a92[_0x645c('0x1d')],_0x2c1a92['headers'][_0x645c('0x1e')]?_0x2c1a92[_0x645c('0x1f')]['x-forwarded-for']:_0x2c1a92[_0x645c('0x20')][_0x645c('0x21')]||_0x2c1a92['ip'],_0x2c1a92[_0x645c('0x22')],_0x5bc88b[_0x645c('0x23')],_0x5bc88b['responseTime'],_0x2c1a92['user']?_0x2c1a92['user']['id']:null,_0x2c1a92[_0x645c('0x10')]?_0x2c1a92[_0x645c('0x10')]['name']:null,_0x2c1a92[_0x645c('0x10')]?_0x2c1a92[_0x645c('0x10')]['role']:null,_0x4c5a7e?util['inspect'](_0x4c5a7e,![],null):''));}}));_0x8ee1ba[_0x645c('0x24')](ewinston[_0x645c('0x18')]({'winstonInstance':_0x50aba1,'meta':![],'statusLevels':!![],'msg':function(_0x534932,_0x50c5bf){var _0x68a5f3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x534932[_0x645c('0x1a')]&&_0x534932[_0x645c('0x1a')][_0x645c('0x25')]&&_0x534932[_0x645c('0x1a')]['agent_id']){_0x68a5f3=_0x645c('0x26');}return util[_0x645c('0x1c')](_0x68a5f3,_0x534932[_0x645c('0x1d')],_0x534932[_0x645c('0x1f')][_0x645c('0x1e')]?_0x534932[_0x645c('0x1f')][_0x645c('0x1e')]:_0x534932['connection'][_0x645c('0x21')]||_0x534932['ip'],_0x534932[_0x645c('0x22')],_0x50c5bf[_0x645c('0x23')],_0x50c5bf[_0x645c('0x27')],_0x534932['user']?_0x534932[_0x645c('0x10')]['id']:null,_0x534932[_0x645c('0x10')]?_0x534932[_0x645c('0x10')][_0x645c('0xd')]:null,_0x534932[_0x645c('0x10')]?_0x534932[_0x645c('0x10')][_0x645c('0xc')]:null,_0x534932['body']&&_0x534932[_0x645c('0x1a')][_0x645c('0x25')]?_0x534932[_0x645c('0x1a')][_0x645c('0x25')]:'other',_0x534932[_0x645c('0x1a')]&&_0x534932[_0x645c('0x1a')][_0x645c('0x28')]?_0x534932['body'][_0x645c('0x28')]:'',_0x534932['body']&&_0x534932[_0x645c('0x1a')][_0x645c('0x29')]?_0x534932['body'][_0x645c('0x29')]:'');},'ignoreRoute':function(_0x137d96){var _0x2bd31f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2bd31f[_0x645c('0x2a')](_0x137d96[_0x645c('0x22')]);}}));return _0x280a6d();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xbc08=['\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','util','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','ensureDir','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','logger','isEmpty','body'];(function(_0x5da40a,_0x4ccdb7){var _0x15158a=function(_0x4ea492){while(--_0x4ea492){_0x5da40a['push'](_0x5da40a['shift']());}};_0x15158a(++_0x4ccdb7);}(_0xbc08,0xfa));var _0x8bc0=function(_0x3a4b20,_0x409ea6){_0x3a4b20=_0x3a4b20-0x0;var _0x593ff3=_0xbc08[_0x3a4b20];return _0x593ff3;};var fs=require(_0x8bc0('0x0'));var _=require(_0x8bc0('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x8bc0('0x2'));var fileLogger=require('./loggers')[_0x8bc0('0x3')];var safeTemplate=require(_0x8bc0('0x4'))['safeTemplate'];var maskSensitiveData=require(_0x8bc0('0x5'))[_0x8bc0('0x6')];function ClientSideLogger(){function _0xcb43a(_0x5385bb){var _0x557dbb=path[_0x8bc0('0x7')](_0x8bc0('0x8'),_0x8bc0('0x9'),_0x8bc0('0xa'));var _0x2f1d5d=path['join'](_0x8bc0('0xb'),_0x5385bb['role']+'-'+_0x5385bb['name']);return fs[_0x8bc0('0xc')](path[_0x8bc0('0x7')](_0x557dbb,_0x2f1d5d))[_0x8bc0('0xd')](function(){var _0x1f08ba=fileLogger(_0x8bc0('0xb'),path['join'](_0x557dbb,_0x2f1d5d));return _0x1f08ba;})[_0x8bc0('0xe')](function(_0x1fc931){throw _0x1fc931;});}this[_0x8bc0('0x9')]=function(_0x4d8b3d,_0x4160d4,_0xc4a8c4,_0x24bdc1){return _0xcb43a(_0x4d8b3d[_0x8bc0('0xf')])[_0x8bc0('0xd')](function(_0x4c322b){var _0x598d30=_0x4c322b[_0x4160d4];return _0x598d30;})[_0x8bc0('0xd')](function(_0x22a198){var _0x2f89b2=_0x4d8b3d[_0x8bc0('0xf')]?_0x4d8b3d[_0x8bc0('0xf')]['id']:'no-user';var _0x5ce94b=_0x24bdc1[_0x8bc0('0x10')];var _0x2cb5eb=_0x24bdc1[_0x8bc0('0x11')];var _0x5d0f49=new Date(Number(_0x2cb5eb));return _0x22a198(_0x2f89b2,_0x5d0f49,_0xc4a8c4,_0x5ce94b);})[_0x8bc0('0xe')](function(_0x2d9541){fileLogger(_0x8bc0('0xb'))[_0x8bc0('0x12')](_0x2d9541);});};}function setupLoggers(_0x24895b){return new Promise(function(_0x13f16d){var _0x38d62d=new ClientSideLogger();var _0x1a7ecb=fileLogger(_0x8bc0('0x13'));var _0xbbcac8=fileLogger(_0x8bc0('0x14'));_0x24895b[_0x8bc0('0x15')](_0x8bc0('0x16'),_0x38d62d);_0x24895b['use'](ewinston[_0x8bc0('0x17')]({'winstonInstance':_0x1a7ecb,'meta':![],'statusLevels':!![],'msg':function(_0x1f451a,_0x2f175e){var _0x33ad97='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x8bc0('0x18')](_0x1f451a[_0x8bc0('0x19')])){_0x33ad97+=_0x8bc0('0x1a');var _0x4dc572=_0x1f451a[_0x8bc0('0x19')];maskSensitiveData(_0x4dc572);}return safeTemplate(util[_0x8bc0('0x1b')](_0x33ad97,_0x1f451a[_0x8bc0('0x1c')],_0x1f451a[_0x8bc0('0x1d')][_0x8bc0('0x1e')]?_0x1f451a[_0x8bc0('0x1d')][_0x8bc0('0x1e')]:_0x1f451a[_0x8bc0('0x1f')][_0x8bc0('0x20')]||_0x1f451a['ip'],_0x1f451a[_0x8bc0('0x21')],_0x2f175e[_0x8bc0('0x22')],_0x2f175e[_0x8bc0('0x23')],_0x1f451a[_0x8bc0('0xf')]?_0x1f451a['user']['id']:null,_0x1f451a[_0x8bc0('0xf')]?_0x1f451a[_0x8bc0('0xf')][_0x8bc0('0x24')]:null,_0x1f451a[_0x8bc0('0xf')]?_0x1f451a[_0x8bc0('0xf')][_0x8bc0('0x25')]:null,_0x4dc572?util['inspect'](_0x4dc572,![],null):''));}}));_0x24895b[_0x8bc0('0x26')](ewinston[_0x8bc0('0x17')]({'winstonInstance':_0xbbcac8,'meta':![],'statusLevels':!![],'msg':function(_0x43af2f,_0x350f59){var _0x2ee2e4=_0x8bc0('0x27');if(_0x43af2f[_0x8bc0('0x19')]&&_0x43af2f[_0x8bc0('0x19')]['device']&&_0x43af2f[_0x8bc0('0x19')]['agent_id']){_0x2ee2e4=_0x8bc0('0x28');}return util['format'](_0x2ee2e4,_0x43af2f[_0x8bc0('0x1c')],_0x43af2f[_0x8bc0('0x1d')][_0x8bc0('0x1e')]?_0x43af2f[_0x8bc0('0x1d')][_0x8bc0('0x1e')]:_0x43af2f[_0x8bc0('0x1f')][_0x8bc0('0x20')]||_0x43af2f['ip'],_0x43af2f['url'],_0x350f59[_0x8bc0('0x22')],_0x350f59[_0x8bc0('0x23')],_0x43af2f[_0x8bc0('0xf')]?_0x43af2f['user']['id']:null,_0x43af2f[_0x8bc0('0xf')]?_0x43af2f[_0x8bc0('0xf')][_0x8bc0('0x24')]:null,_0x43af2f[_0x8bc0('0xf')]?_0x43af2f[_0x8bc0('0xf')][_0x8bc0('0x25')]:null,_0x43af2f[_0x8bc0('0x19')]&&_0x43af2f['body'][_0x8bc0('0x29')]?_0x43af2f[_0x8bc0('0x19')][_0x8bc0('0x29')]:'other',_0x43af2f[_0x8bc0('0x19')]&&_0x43af2f[_0x8bc0('0x19')][_0x8bc0('0x2a')]?_0x43af2f['body'][_0x8bc0('0x2a')]:'',_0x43af2f[_0x8bc0('0x19')]&&_0x43af2f[_0x8bc0('0x19')][_0x8bc0('0x2b')]?_0x43af2f[_0x8bc0('0x19')][_0x8bc0('0x2b')]:'');},'ignoreRoute':function(_0x275455){var _0x260e6a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x260e6a[_0x8bc0('0x2c')](_0x275455['url']);}}));return _0x13f16d();});}exports[_0x8bc0('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 89214c0..4b365be 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a65=['toUpperCase','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','transports','warn','File','error','%s-%s','Console','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20green','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x2a65,0x155));var _0x52a6=function(_0x47f8d2,_0x259040){_0x47f8d2=_0x47f8d2-0x0;var _0x5b31bb=_0x2a65[_0x47f8d2];return _0x5b31bb;};'use strict';var path=require(_0x52a6('0x0'));var util=require('util');var moment=require(_0x52a6('0x1'));var winston=require(_0x52a6('0x2'));var config=require(_0x52a6('0x3'));var debugLevel=config[_0x52a6('0x4')]?config[_0x52a6('0x4')][_0x52a6('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x52a6('0x6'),'error':_0x52a6('0x7'),'warn':_0x52a6('0x8'),'info':_0x52a6('0x9'),'print':'bold\x20white','success':_0x52a6('0xa'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x52a6('0xb')};winston[_0x52a6('0xc')](XC_LOG_COLORS);function getLogFileName(_0x1a3225,_0x130cfa,_0x81bdce){var _0x54fb65=_0x1a3225||_0x52a6('0xd');return path['join'](_0x54fb65,util[_0x52a6('0xe')](_0x52a6('0xf'),_0x130cfa,_0x81bdce));}function formatter(_0xd5d714,_0x2cb95e){_0x2cb95e[_0x52a6('0x10')]=_0x2cb95e[_0x52a6('0x10')][_0x52a6('0x11')](/@@{/g,_0x52a6('0x12'))[_0x52a6('0x11')](/}@@/g,_0x52a6('0x13'))[_0x52a6('0x11')](/@{/g,'{{')[_0x52a6('0x11')](/}@/g,'}}');return util[_0x52a6('0xe')](_0x52a6('0x14'),moment()[_0x52a6('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2cb95e[_0x52a6('0x15')][_0x52a6('0x16')](),_0xd5d714,_0x2cb95e[_0x52a6('0x10')]);}function fileFormat(_0x2aea55,_0x586aa6){_0x586aa6[_0x52a6('0x10')]=_0x586aa6[_0x52a6('0x10')]['replace'](/@@{/g,'{{{')[_0x52a6('0x11')](/}@@/g,_0x52a6('0x13'))[_0x52a6('0x11')](/@{/g,'{{')[_0x52a6('0x11')](/}@/g,'}}');var _0x407aa0=_0x586aa6[_0x52a6('0x17')]&&Object['keys'](_0x586aa6[_0x52a6('0x17')])['length']?'\x0a\x09'+JSON['stringify'](_0x586aa6[_0x52a6('0x17')]):'';return util[_0x52a6('0xe')](_0x52a6('0x18'),moment()[_0x52a6('0xe')](_0x52a6('0x19')),_0x586aa6[_0x52a6('0x15')]['toUpperCase'](),_0x2aea55,_0x586aa6[_0x52a6('0x10')],_0x407aa0);}function consoleLogger(){var _0x2933d5=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x52a6('0x1a'))]['Console']({'level':_0x52a6('0x1b'),'json':![],'formatter':function(_0x5f1407){return formatter('',_0x5f1407);}})]});return _0x2933d5;}function fileLogger(_0x4842a9,_0x4d9ebe){var _0xd5f3ea=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x52a6('0x1a'))][(_0x52a6('0x1c'))]({'name':util[_0x52a6('0xe')]('%s-%s',_0x4842a9,_0x52a6('0x1d')),'filename':getLogFileName(_0x4d9ebe,_0x4842a9,'error'),'level':_0x52a6('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2be21f){return fileFormat(_0x4842a9,_0x2be21f);}}),new winston[(_0x52a6('0x1a'))][(_0x52a6('0x1c'))]({'name':util[_0x52a6('0xe')](_0x52a6('0x1e'),_0x4842a9,debugLevel),'filename':getLogFileName(_0x4d9ebe,_0x4842a9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x982ae7){return fileFormat(_0x4842a9,_0x982ae7);}}),new winston['transports'][(_0x52a6('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x3eeff1){return fileFormat(_0x4842a9,_0x3eeff1);}})]});return _0xd5f3ea;}exports['consoleLogger']=consoleLogger;exports[_0x52a6('0x20')]=fileLogger; \ No newline at end of file +var _0x8b2b=['stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','error','File','%s-%s','consoleLogger','fileLogger','path','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length'];(function(_0x209d9b,_0x224737){var _0x11b39b=function(_0xd8298f){while(--_0xd8298f){_0x209d9b['push'](_0x209d9b['shift']());}};_0x11b39b(++_0x224737);}(_0x8b2b,0xef));var _0xb8b2=function(_0x362fc7,_0x272fc2){_0x362fc7=_0x362fc7-0x0;var _0x263011=_0x8b2b[_0x362fc7];return _0x263011;};'use strict';var path=require(_0xb8b2('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0xb8b2('0x1'));var config=require(_0xb8b2('0x2'));var debugLevel=config[_0xb8b2('0x3')]?config[_0xb8b2('0x3')][_0xb8b2('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xb8b2('0x5'),'error':'red','warn':_0xb8b2('0x6'),'info':_0xb8b2('0x7'),'print':_0xb8b2('0x8'),'success':_0xb8b2('0x9'),'http':_0xb8b2('0xa'),'verbose':_0xb8b2('0xb'),'debug':_0xb8b2('0xc'),'silly':'bold\x20cyan'};winston[_0xb8b2('0xd')](XC_LOG_COLORS);function getLogFileName(_0x569a17,_0x206095,_0x28693b){var _0x1a2872=_0x569a17||'/var/log/xcally';return path[_0xb8b2('0xe')](_0x1a2872,util[_0xb8b2('0xf')](_0xb8b2('0x10'),_0x206095,_0x28693b));}function formatter(_0x4b4ecc,_0x34bcd7){_0x34bcd7[_0xb8b2('0x11')]=_0x34bcd7[_0xb8b2('0x11')][_0xb8b2('0x12')](/@@{/g,_0xb8b2('0x13'))[_0xb8b2('0x12')](/}@@/g,_0xb8b2('0x14'))[_0xb8b2('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xb8b2('0x15')),_0x34bcd7[_0xb8b2('0x16')][_0xb8b2('0x17')](),_0x4b4ecc,_0x34bcd7[_0xb8b2('0x11')]);}function fileFormat(_0x5c2f14,_0x447ada){_0x447ada[_0xb8b2('0x11')]=_0x447ada['message'][_0xb8b2('0x12')](/@@{/g,_0xb8b2('0x13'))[_0xb8b2('0x12')](/}@@/g,'}}}')[_0xb8b2('0x12')](/@{/g,'{{')[_0xb8b2('0x12')](/}@/g,'}}');var _0x1cdf03=_0x447ada['meta']&&Object[_0xb8b2('0x18')](_0x447ada[_0xb8b2('0x19')])[_0xb8b2('0x1a')]?'\x0a\x09'+JSON[_0xb8b2('0x1b')](_0x447ada[_0xb8b2('0x19')]):'';return util[_0xb8b2('0xf')](_0xb8b2('0x1c'),moment()[_0xb8b2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x447ada[_0xb8b2('0x16')]['toUpperCase'](),_0x5c2f14,_0x447ada[_0xb8b2('0x11')],_0x1cdf03);}function consoleLogger(){var _0x5e5b74=new winston[(_0xb8b2('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb8b2('0x1e'))][(_0xb8b2('0x1f'))]({'level':_0xb8b2('0x20'),'json':![],'formatter':function(_0x400027){return formatter('',_0x400027);}})]});return _0x5e5b74;}function fileLogger(_0x432954,_0x1469c9){var _0x32eab4=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb8b2('0x1e'))]['File']({'name':util[_0xb8b2('0xf')]('%s-%s',_0x432954,'error'),'filename':getLogFileName(_0x1469c9,_0x432954,_0xb8b2('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x364801){return fileFormat(_0x432954,_0x364801);}}),new winston[(_0xb8b2('0x1e'))][(_0xb8b2('0x22'))]({'name':util[_0xb8b2('0xf')](_0xb8b2('0x23'),_0x432954,debugLevel),'filename':getLogFileName(_0x1469c9,_0x432954,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c15ff){return fileFormat(_0x432954,_0x3c15ff);}}),new winston['transports']['Console']({'level':_0xb8b2('0x20'),'json':![],'formatter':function(_0x2d58d2){return fileFormat(_0x432954,_0x2d58d2);}})]});return _0x32eab4;}exports[_0xb8b2('0x24')]=consoleLogger;exports[_0xb8b2('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index b187662..23df956 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 _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x4c2af9,_0x559307){var _0x552e41=function(_0xeb9209){while(--_0xeb9209){_0x4c2af9['push'](_0x4c2af9['shift']());}};_0x552e41(++_0x559307);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x57ca,0x108));var _0xa57c=function(_0x1e980c,_0x59695c){_0x1e980c=_0x1e980c-0x0;var _0x157872=_0x57ca[_0x1e980c];return _0x157872;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 8eedf0c..30e13a6 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 _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x8952,0x17e));var _0x2895=function(_0x3a4402,_0x13a3e0){_0x3a4402=_0x3a4402-0x0;var _0x32d8f3=_0x8952[_0x3a4402];return _0x32d8f3;};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 +var _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x1184fc,_0x1c4b54){var _0x361c4d=function(_0x330384){while(--_0x330384){_0x1184fc['push'](_0x1184fc['shift']());}};_0x361c4d(++_0x1c4b54);}(_0xb10b,0x12a));var _0xbb10=function(_0x28b930,_0x19b05f){_0x28b930=_0x28b930-0x0;var _0x112256=_0xb10b[_0x28b930];return _0x112256;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file